From: Cris Di Sclafani Date: Fri, 29 Jan 2021 14:41:55 +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%7B%7Blicense.openchannel?a=commitdiff_plain;h=f6b5951670fde5e0cdcdf6d95a1bc028cc594adf;p=motion2.git Built motion from commit (unavailable).|2.5.14 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 554cbb5..137534e 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-29T14:19:45.830Z", "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-29T14:32:31.377Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index ff0c79e..4d3159e 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-29T14:19:45.830Z", "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-29T14:32:31.377Z", "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 e91158c..498d79f 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 _0xb463=['INTEGER','sequelize'];(function(_0x56b678,_0x5e39de){var _0x4a38b2=function(_0x16fa39){while(--_0x16fa39){_0x56b678['push'](_0x56b678['shift']());}};_0x4a38b2(++_0x5e39de);}(_0xb463,0x17f));var _0x3b46=function(_0x21b9fe,_0x4a505a){_0x21b9fe=_0x21b9fe-0x0;var _0x5da6b0=_0xb463[_0x21b9fe];return _0x5da6b0;};'use strict';var Sequelize=require(_0x3b46('0x0'));module['exports']={'ChatInteractionId':{'type':Sequelize[_0x3b46('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x3b46('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0xa833=['sequelize','INTEGER'];(function(_0x29b84c,_0x5cc283){var _0x351829=function(_0x56c5cf){while(--_0x56c5cf){_0x29b84c['push'](_0x29b84c['shift']());}};_0x351829(++_0x5cc283);}(_0xa833,0x15e));var _0x3a83=function(_0x1d8103,_0x1a09b3){_0x1d8103=_0x1d8103-0x0;var _0x41daac=_0xa833[_0x1d8103];return _0x41daac;};'use strict';var Sequelize=require(_0x3a83('0x0'));module['exports']={'ChatInteractionId':{'type':Sequelize[_0x3a83('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x3a83('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.controller.js b/server/api/UserChatInteraction/UserChatInteraction.controller.js index 73bca30..56f1ffa 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 _0xff47=['includeAll','findAll','rows','show','params','UserChatInteraction','rawAttributes','keys','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','options','count'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xff47,0x15c));var _0x7ff4=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0xff47[_0x37e886];return _0x57c5cd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7ff4('0x0'));var zipdir=require(_0x7ff4('0x1'));var jsonpatch=require(_0x7ff4('0x2'));var rp=require(_0x7ff4('0x3'));var moment=require(_0x7ff4('0x4'));var BPromise=require(_0x7ff4('0x5'));var Mustache=require(_0x7ff4('0x6'));var util=require('util');var path=require(_0x7ff4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7ff4('0x8'));var jsforce=require(_0x7ff4('0x9'));var deskjs=require(_0x7ff4('0xa'));var toCsv=require(_0x7ff4('0xb'));var querystring=require(_0x7ff4('0xc'));var Papa=require(_0x7ff4('0xd'));var Redis=require(_0x7ff4('0xe'));var authService=require(_0x7ff4('0xf'));var qs=require(_0x7ff4('0x10'));var as=require(_0x7ff4('0x11'));var hardwareService=require(_0x7ff4('0x12'));var logger=require(_0x7ff4('0x13'))(_0x7ff4('0x14'));var utils=require(_0x7ff4('0x15'));var config=require(_0x7ff4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7ff4('0x17'))['db'];function respondWithStatusCode(_0x2a4ce7,_0x149aa5){_0x149aa5=_0x149aa5||0xcc;return function(_0x16ed6f){if(_0x16ed6f){return _0x2a4ce7[_0x7ff4('0x18')](_0x149aa5);}return _0x2a4ce7[_0x7ff4('0x19')](_0x149aa5)['end']();};}function respondWithResult(_0x526d04,_0x2f1af0){_0x2f1af0=_0x2f1af0||0xc8;return function(_0xdecad3){if(_0xdecad3){return _0x526d04[_0x7ff4('0x19')](_0x2f1af0)[_0x7ff4('0x1a')](_0xdecad3);}};}function respondWithFilteredResult(_0x46912b,_0x197001){return function(_0xf950b7){if(_0xf950b7){var _0x2d28f1=_0xf950b7['count'],_0x3ae6b3=_0x197001[_0x7ff4('0x1b')],_0x3a0168=_0x197001[_0x7ff4('0x1b')]+_0x197001['limit'],_0x41b58d;if(_0x3a0168>=_0x2d28f1){_0x3a0168=_0x2d28f1;_0x41b58d=0xc8;}else{_0x41b58d=0xce;}_0x46912b['status'](_0x41b58d);return _0x46912b[_0x7ff4('0x1c')](_0x7ff4('0x1d'),_0x3ae6b3+'-'+_0x3a0168+'/'+_0x2d28f1)['json'](_0xf950b7);}return null;};}function patchUpdates(_0x3d78ab){return function(_0x4f9da7){try{jsonpatch[_0x7ff4('0x1e')](_0x4f9da7,_0x3d78ab,!![]);}catch(_0x16390d){return BPromise[_0x7ff4('0x1f')](_0x16390d);}return _0x4f9da7[_0x7ff4('0x20')]();};}function saveUpdates(_0x4ad58f,_0x18bf55){return function(_0x1fb7aa){if(_0x1fb7aa){return _0x1fb7aa[_0x7ff4('0x21')](_0x4ad58f)[_0x7ff4('0x22')](function(_0xc4b4e8){return _0xc4b4e8;});}return null;};}function removeEntity(_0x548071,_0x224ab7){return function(_0xe5f150){if(_0xe5f150){return _0xe5f150[_0x7ff4('0x23')]()['then'](function(){var _0x5e1798=_0xe5f150[_0x7ff4('0x24')]({'plain':!![]});var _0x4bbfa='UserChatInteractions';return db['UserProfileResource'][_0x7ff4('0x23')]({'where':{'type':_0x4bbfa,'resourceId':_0x5e1798['id']}})[_0x7ff4('0x22')](function(){return _0xe5f150;});})[_0x7ff4('0x22')](function(){_0x548071[_0x7ff4('0x19')](0xcc)[_0x7ff4('0x25')]();});}};}function handleEntityNotFound(_0x1892d4,_0x3aae44){return function(_0x432d72){if(!_0x432d72){_0x1892d4[_0x7ff4('0x18')](0x194);}return _0x432d72;};}function handleError(_0x2e3d10,_0x4f4054){_0x4f4054=_0x4f4054||0x1f4;return function(_0x331fc4){logger[_0x7ff4('0x26')](_0x331fc4[_0x7ff4('0x27')]);if(_0x331fc4[_0x7ff4('0x28')]){delete _0x331fc4['name'];}_0x2e3d10[_0x7ff4('0x19')](_0x4f4054)[_0x7ff4('0x29')](_0x331fc4);};}exports['index']=function(_0x1f9114,_0x2d5025){var _0x49eea7={},_0x36d20e={},_0x5c9f88={'count':0x0,'rows':[]};var _0x345f4f=_[_0x7ff4('0x2a')](db['UserChatInteraction']['rawAttributes'],function(_0x18e98b){return{'name':_0x18e98b[_0x7ff4('0x2b')],'type':_0x18e98b[_0x7ff4('0x2c')][_0x7ff4('0x2d')]};});_0x36d20e[_0x7ff4('0x2e')]=_[_0x7ff4('0x2a')](_0x345f4f,_0x7ff4('0x28'));_0x36d20e[_0x7ff4('0x2f')]=_['keys'](_0x1f9114[_0x7ff4('0x2f')]);_0x36d20e[_0x7ff4('0x30')]=_[_0x7ff4('0x31')](_0x36d20e[_0x7ff4('0x2e')],_0x36d20e[_0x7ff4('0x2f')]);_0x49eea7[_0x7ff4('0x32')]=_[_0x7ff4('0x31')](_0x36d20e['model'],qs['fields'](_0x1f9114[_0x7ff4('0x2f')][_0x7ff4('0x33')]));_0x49eea7['attributes']=_0x49eea7[_0x7ff4('0x32')][_0x7ff4('0x34')]?_0x49eea7[_0x7ff4('0x32')]:_0x36d20e[_0x7ff4('0x2e')];if(!_0x1f9114[_0x7ff4('0x2f')][_0x7ff4('0x35')]('nolimit')){_0x49eea7[_0x7ff4('0x36')]=qs[_0x7ff4('0x36')](_0x1f9114[_0x7ff4('0x2f')]['limit']);_0x49eea7[_0x7ff4('0x1b')]=qs[_0x7ff4('0x1b')](_0x1f9114[_0x7ff4('0x2f')][_0x7ff4('0x1b')]);}_0x49eea7[_0x7ff4('0x37')]=qs['sort'](_0x1f9114['query'][_0x7ff4('0x38')]);_0x49eea7[_0x7ff4('0x39')]=qs['filters'](_['pick'](_0x1f9114[_0x7ff4('0x2f')],_0x36d20e[_0x7ff4('0x30')]),_0x345f4f);if(_0x1f9114[_0x7ff4('0x2f')][_0x7ff4('0x3a')]){_0x49eea7['where']=_[_0x7ff4('0x3b')](_0x49eea7[_0x7ff4('0x39')],{'$or':_[_0x7ff4('0x2a')](_0x345f4f,function(_0x4c8289){if(_0x4c8289[_0x7ff4('0x2c')]!=='VIRTUAL'){var _0x168a25={};_0x168a25[_0x4c8289[_0x7ff4('0x28')]]={'$like':'%'+_0x1f9114['query'][_0x7ff4('0x3a')]+'%'};return _0x168a25;}})});}_0x49eea7=_[_0x7ff4('0x3b')]({},_0x49eea7,_0x1f9114[_0x7ff4('0x3c')]);var _0x1e4fa8={'where':_0x49eea7[_0x7ff4('0x39')]};return db['UserChatInteraction']['count'](_0x1e4fa8)[_0x7ff4('0x22')](function(_0x33b0f9){_0x5c9f88[_0x7ff4('0x3d')]=_0x33b0f9;if(_0x1f9114['query'][_0x7ff4('0x3e')]){_0x49eea7['include']=[{'all':!![]}];}return db['UserChatInteraction'][_0x7ff4('0x3f')](_0x49eea7);})['then'](function(_0x20113d){_0x5c9f88[_0x7ff4('0x40')]=_0x20113d;return _0x5c9f88;})[_0x7ff4('0x22')](respondWithFilteredResult(_0x2d5025,_0x49eea7))['catch'](handleError(_0x2d5025,null));};exports[_0x7ff4('0x41')]=function(_0x765c69,_0x542377){var _0x3c4153={'raw':!![],'where':{'id':_0x765c69[_0x7ff4('0x42')]['id']}},_0x27e4df={};_0x27e4df[_0x7ff4('0x2e')]=_['keys'](db[_0x7ff4('0x43')][_0x7ff4('0x44')]);_0x27e4df['query']=_[_0x7ff4('0x45')](_0x765c69[_0x7ff4('0x2f')]);_0x27e4df[_0x7ff4('0x30')]=_[_0x7ff4('0x31')](_0x27e4df[_0x7ff4('0x2e')],_0x27e4df[_0x7ff4('0x2f')]);_0x3c4153['attributes']=_[_0x7ff4('0x31')](_0x27e4df[_0x7ff4('0x2e')],qs[_0x7ff4('0x33')](_0x765c69[_0x7ff4('0x2f')]['fields']));_0x3c4153[_0x7ff4('0x32')]=_0x3c4153[_0x7ff4('0x32')][_0x7ff4('0x34')]?_0x3c4153['attributes']:_0x27e4df[_0x7ff4('0x2e')];if(_0x765c69[_0x7ff4('0x2f')][_0x7ff4('0x3e')]){_0x3c4153[_0x7ff4('0x46')]=[{'all':!![]}];}_0x3c4153=_[_0x7ff4('0x3b')]({},_0x3c4153,_0x765c69['options']);return db[_0x7ff4('0x43')][_0x7ff4('0x47')](_0x3c4153)[_0x7ff4('0x22')](handleEntityNotFound(_0x542377,null))[_0x7ff4('0x22')](respondWithResult(_0x542377,null))[_0x7ff4('0x48')](handleError(_0x542377,null));};exports[_0x7ff4('0x49')]=function(_0x2f613a,_0x35002e){return db['UserChatInteraction'][_0x7ff4('0x49')](_0x2f613a[_0x7ff4('0x4a')],{})[_0x7ff4('0x22')](function(_0x3df2e8){var _0x32b66e=_0x2f613a[_0x7ff4('0x4b')]['get']({'plain':!![]});if(!_0x32b66e)throw new Error(_0x7ff4('0x4c'));if(_0x32b66e[_0x7ff4('0x4d')]===_0x7ff4('0x4b')){var _0x4762d3=_0x3df2e8[_0x7ff4('0x24')]({'plain':!![]});var _0xf9ea09='UserChatInteractions';return db[_0x7ff4('0x4e')]['find']({'where':{'name':_0xf9ea09,'userProfileId':_0x32b66e[_0x7ff4('0x4f')]},'raw':!![]})[_0x7ff4('0x22')](function(_0x4a94d8){if(_0x4a94d8&&_0x4a94d8['autoAssociation']===0x0){return db[_0x7ff4('0x50')]['create']({'name':_0x4762d3['name'],'resourceId':_0x4762d3['id'],'type':_0x4a94d8[_0x7ff4('0x28')],'sectionId':_0x4a94d8['id']},{})[_0x7ff4('0x22')](function(){return _0x3df2e8;});}else{return _0x3df2e8;}})[_0x7ff4('0x48')](function(_0x519e8f){logger['error'](_0x7ff4('0x51'),_0x519e8f);throw _0x519e8f;});}return _0x3df2e8;})['then'](respondWithResult(_0x35002e,0xc9))[_0x7ff4('0x48')](handleError(_0x35002e,null));};exports['update']=function(_0x28a913,_0x37ff1e){if(_0x28a913['body']['id']){delete _0x28a913['body']['id'];}return db['UserChatInteraction'][_0x7ff4('0x47')]({'where':{'id':_0x28a913['params']['id']}})[_0x7ff4('0x22')](handleEntityNotFound(_0x37ff1e,null))[_0x7ff4('0x22')](saveUpdates(_0x28a913[_0x7ff4('0x4a')],null))[_0x7ff4('0x22')](respondWithResult(_0x37ff1e,null))[_0x7ff4('0x48')](handleError(_0x37ff1e,null));};exports[_0x7ff4('0x23')]=function(_0x5e5607,_0x3dfa76){return db['UserChatInteraction'][_0x7ff4('0x47')]({'where':{'id':_0x5e5607[_0x7ff4('0x42')]['id']}})[_0x7ff4('0x22')](handleEntityNotFound(_0x3dfa76,null))[_0x7ff4('0x22')](removeEntity(_0x3dfa76,null))[_0x7ff4('0x48')](handleError(_0x3dfa76,null));}; \ No newline at end of file +var _0xb9dd=['rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','limit','order','sort','where','pick','type','VIRTUAL','filter','merge','UserChatInteraction','includeAll','include','rows','catch','show','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','UserChatInteractions','UserProfileResource','stack','name','send','index','map'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb9dd,0x74));var _0xdb9d=function(_0x2f6c2d,_0x1bd264){_0x2f6c2d=_0x2f6c2d-0x0;var _0x21a17f=_0xb9dd[_0x2f6c2d];return _0x21a17f;};'use strict';var pdf=require(_0xdb9d('0x0'));var emlformat=require(_0xdb9d('0x1'));var rimraf=require(_0xdb9d('0x2'));var zipdir=require(_0xdb9d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdb9d('0x4'));var BPromise=require(_0xdb9d('0x5'));var Mustache=require('mustache');var util=require(_0xdb9d('0x6'));var path=require('path');var sox=require(_0xdb9d('0x7'));var csv=require(_0xdb9d('0x8'));var ejs=require(_0xdb9d('0x9'));var fs=require('fs');var _=require(_0xdb9d('0xa'));var squel=require(_0xdb9d('0xb'));var crypto=require(_0xdb9d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdb9d('0xd'));var toCsv=require(_0xdb9d('0x8'));var querystring=require('querystring');var Papa=require(_0xdb9d('0xe'));var Redis=require('ioredis');var authService=require(_0xdb9d('0xf'));var qs=require(_0xdb9d('0x10'));var as=require(_0xdb9d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdb9d('0x12'));var config=require(_0xdb9d('0x13'));var licenseUtil=require(_0xdb9d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11e7e9,_0x5e8794){_0x5e8794=_0x5e8794||0xcc;return function(_0xe81ab5){if(_0xe81ab5){return _0x11e7e9[_0xdb9d('0x15')](_0x5e8794);}return _0x11e7e9['status'](_0x5e8794)[_0xdb9d('0x16')]();};}function respondWithResult(_0x297df5,_0x1d5405){_0x1d5405=_0x1d5405||0xc8;return function(_0x571783){if(_0x571783){return _0x297df5['status'](_0x1d5405)[_0xdb9d('0x17')](_0x571783);}};}function respondWithFilteredResult(_0x465b5e,_0x3052ab){return function(_0x36ecac){if(_0x36ecac){var _0x1da1d5=_0x36ecac[_0xdb9d('0x18')],_0x507401=_0x3052ab[_0xdb9d('0x19')],_0x22d96e=_0x3052ab[_0xdb9d('0x19')]+_0x3052ab['limit'],_0x443010;if(_0x22d96e>=_0x1da1d5){_0x22d96e=_0x1da1d5;_0x443010=0xc8;}else{_0x443010=0xce;}_0x465b5e[_0xdb9d('0x1a')](_0x443010);return _0x465b5e[_0xdb9d('0x1b')](_0xdb9d('0x1c'),_0x507401+'-'+_0x22d96e+'/'+_0x1da1d5)['json'](_0x36ecac);}return null;};}function patchUpdates(_0x47464a){return function(_0x2c01d9){try{jsonpatch[_0xdb9d('0x1d')](_0x2c01d9,_0x47464a,!![]);}catch(_0xd97bb7){return BPromise[_0xdb9d('0x1e')](_0xd97bb7);}return _0x2c01d9[_0xdb9d('0x1f')]();};}function saveUpdates(_0x751962,_0x5ca67e){return function(_0x3451b0){if(_0x3451b0){return _0x3451b0[_0xdb9d('0x20')](_0x751962)[_0xdb9d('0x21')](function(_0x46eedc){return _0x46eedc;});}return null;};}function removeEntity(_0x7c1ea9,_0x584a08){return function(_0x2b33ca){if(_0x2b33ca){return _0x2b33ca[_0xdb9d('0x22')]()[_0xdb9d('0x21')](function(){var _0x308703=_0x2b33ca['get']({'plain':!![]});var _0x7be39d=_0xdb9d('0x23');return db[_0xdb9d('0x24')][_0xdb9d('0x22')]({'where':{'type':_0x7be39d,'resourceId':_0x308703['id']}})['then'](function(){return _0x2b33ca;});})[_0xdb9d('0x21')](function(){_0x7c1ea9[_0xdb9d('0x1a')](0xcc)[_0xdb9d('0x16')]();});}};}function handleEntityNotFound(_0x34c232,_0x324064){return function(_0x448bf3){if(!_0x448bf3){_0x34c232[_0xdb9d('0x15')](0x194);}return _0x448bf3;};}function handleError(_0x5c83cc,_0x3a0789){_0x3a0789=_0x3a0789||0x1f4;return function(_0x34c758){logger['error'](_0x34c758[_0xdb9d('0x25')]);if(_0x34c758[_0xdb9d('0x26')]){delete _0x34c758[_0xdb9d('0x26')];}_0x5c83cc[_0xdb9d('0x1a')](_0x3a0789)[_0xdb9d('0x27')](_0x34c758);};}exports[_0xdb9d('0x28')]=function(_0x3041d6,_0x39ee95){var _0x4ea71d={},_0x298c0e={},_0x26141f={'count':0x0,'rows':[]};var _0x218fc7=_[_0xdb9d('0x29')](db['UserChatInteraction'][_0xdb9d('0x2a')],function(_0x5924e9){return{'name':_0x5924e9[_0xdb9d('0x2b')],'type':_0x5924e9['type'][_0xdb9d('0x2c')]};});_0x298c0e[_0xdb9d('0x2d')]=_['map'](_0x218fc7,_0xdb9d('0x26'));_0x298c0e['query']=_[_0xdb9d('0x2e')](_0x3041d6[_0xdb9d('0x2f')]);_0x298c0e[_0xdb9d('0x30')]=_['intersection'](_0x298c0e[_0xdb9d('0x2d')],_0x298c0e[_0xdb9d('0x2f')]);_0x4ea71d[_0xdb9d('0x31')]=_[_0xdb9d('0x32')](_0x298c0e[_0xdb9d('0x2d')],qs[_0xdb9d('0x33')](_0x3041d6[_0xdb9d('0x2f')][_0xdb9d('0x33')]));_0x4ea71d[_0xdb9d('0x31')]=_0x4ea71d[_0xdb9d('0x31')][_0xdb9d('0x34')]?_0x4ea71d[_0xdb9d('0x31')]:_0x298c0e[_0xdb9d('0x2d')];if(!_0x3041d6[_0xdb9d('0x2f')]['hasOwnProperty']('nolimit')){_0x4ea71d[_0xdb9d('0x35')]=qs['limit'](_0x3041d6[_0xdb9d('0x2f')][_0xdb9d('0x35')]);_0x4ea71d['offset']=qs['offset'](_0x3041d6[_0xdb9d('0x2f')]['offset']);}_0x4ea71d[_0xdb9d('0x36')]=qs[_0xdb9d('0x37')](_0x3041d6[_0xdb9d('0x2f')][_0xdb9d('0x37')]);_0x4ea71d[_0xdb9d('0x38')]=qs[_0xdb9d('0x30')](_[_0xdb9d('0x39')](_0x3041d6[_0xdb9d('0x2f')],_0x298c0e['filters']),_0x218fc7);if(_0x3041d6[_0xdb9d('0x2f')]['filter']){_0x4ea71d[_0xdb9d('0x38')]=_['merge'](_0x4ea71d[_0xdb9d('0x38')],{'$or':_[_0xdb9d('0x29')](_0x218fc7,function(_0x328711){if(_0x328711[_0xdb9d('0x3a')]!==_0xdb9d('0x3b')){var _0x2c06c6={};_0x2c06c6[_0x328711[_0xdb9d('0x26')]]={'$like':'%'+_0x3041d6['query'][_0xdb9d('0x3c')]+'%'};return _0x2c06c6;}})});}_0x4ea71d=_[_0xdb9d('0x3d')]({},_0x4ea71d,_0x3041d6['options']);var _0x439568={'where':_0x4ea71d[_0xdb9d('0x38')]};return db[_0xdb9d('0x3e')]['count'](_0x439568)[_0xdb9d('0x21')](function(_0x1ca8ff){_0x26141f[_0xdb9d('0x18')]=_0x1ca8ff;if(_0x3041d6[_0xdb9d('0x2f')][_0xdb9d('0x3f')]){_0x4ea71d[_0xdb9d('0x40')]=[{'all':!![]}];}return db[_0xdb9d('0x3e')]['findAll'](_0x4ea71d);})[_0xdb9d('0x21')](function(_0x115c9e){_0x26141f[_0xdb9d('0x41')]=_0x115c9e;return _0x26141f;})[_0xdb9d('0x21')](respondWithFilteredResult(_0x39ee95,_0x4ea71d))[_0xdb9d('0x42')](handleError(_0x39ee95,null));};exports[_0xdb9d('0x43')]=function(_0xe3edf4,_0x50859c){var _0x1ee1a0={'raw':!![],'where':{'id':_0xe3edf4['params']['id']}},_0x5dae54={};_0x5dae54[_0xdb9d('0x2d')]=_['keys'](db['UserChatInteraction'][_0xdb9d('0x2a')]);_0x5dae54[_0xdb9d('0x2f')]=_['keys'](_0xe3edf4[_0xdb9d('0x2f')]);_0x5dae54['filters']=_[_0xdb9d('0x32')](_0x5dae54[_0xdb9d('0x2d')],_0x5dae54[_0xdb9d('0x2f')]);_0x1ee1a0[_0xdb9d('0x31')]=_['intersection'](_0x5dae54[_0xdb9d('0x2d')],qs[_0xdb9d('0x33')](_0xe3edf4[_0xdb9d('0x2f')][_0xdb9d('0x33')]));_0x1ee1a0[_0xdb9d('0x31')]=_0x1ee1a0['attributes'][_0xdb9d('0x34')]?_0x1ee1a0['attributes']:_0x5dae54[_0xdb9d('0x2d')];if(_0xe3edf4[_0xdb9d('0x2f')]['includeAll']){_0x1ee1a0[_0xdb9d('0x40')]=[{'all':!![]}];}_0x1ee1a0=_[_0xdb9d('0x3d')]({},_0x1ee1a0,_0xe3edf4[_0xdb9d('0x44')]);return db[_0xdb9d('0x3e')]['find'](_0x1ee1a0)[_0xdb9d('0x21')](handleEntityNotFound(_0x50859c,null))['then'](respondWithResult(_0x50859c,null))['catch'](handleError(_0x50859c,null));};exports[_0xdb9d('0x45')]=function(_0x5255d9,_0x2c5839){return db['UserChatInteraction'][_0xdb9d('0x45')](_0x5255d9[_0xdb9d('0x46')],{})[_0xdb9d('0x21')](function(_0x32f5ac){var _0x11c4e9=_0x5255d9[_0xdb9d('0x47')][_0xdb9d('0x48')]({'plain':!![]});if(!_0x11c4e9)throw new Error(_0xdb9d('0x49'));if(_0x11c4e9[_0xdb9d('0x4a')]===_0xdb9d('0x47')){var _0x2954cd=_0x32f5ac[_0xdb9d('0x48')]({'plain':!![]});var _0xe2480a=_0xdb9d('0x23');return db['UserProfileSection']['find']({'where':{'name':_0xe2480a,'userProfileId':_0x11c4e9['userProfileId']},'raw':!![]})['then'](function(_0x33c76a){if(_0x33c76a&&_0x33c76a['autoAssociation']===0x0){return db[_0xdb9d('0x24')][_0xdb9d('0x45')]({'name':_0x2954cd[_0xdb9d('0x26')],'resourceId':_0x2954cd['id'],'type':_0x33c76a[_0xdb9d('0x26')],'sectionId':_0x33c76a['id']},{})[_0xdb9d('0x21')](function(){return _0x32f5ac;});}else{return _0x32f5ac;}})[_0xdb9d('0x42')](function(_0x1864a9){logger[_0xdb9d('0x4b')](_0xdb9d('0x4c'),_0x1864a9);throw _0x1864a9;});}return _0x32f5ac;})[_0xdb9d('0x21')](respondWithResult(_0x2c5839,0xc9))['catch'](handleError(_0x2c5839,null));};exports[_0xdb9d('0x20')]=function(_0x38b434,_0x20bd38){if(_0x38b434[_0xdb9d('0x46')]['id']){delete _0x38b434[_0xdb9d('0x46')]['id'];}return db[_0xdb9d('0x3e')][_0xdb9d('0x4d')]({'where':{'id':_0x38b434[_0xdb9d('0x4e')]['id']}})[_0xdb9d('0x21')](handleEntityNotFound(_0x20bd38,null))[_0xdb9d('0x21')](saveUpdates(_0x38b434[_0xdb9d('0x46')],null))['then'](respondWithResult(_0x20bd38,null))[_0xdb9d('0x42')](handleError(_0x20bd38,null));};exports[_0xdb9d('0x22')]=function(_0x13cf80,_0x44783c){return db[_0xdb9d('0x3e')][_0xdb9d('0x4d')]({'where':{'id':_0x13cf80[_0xdb9d('0x4e')]['id']}})[_0xdb9d('0x21')](handleEntityNotFound(_0x44783c,null))[_0xdb9d('0x21')](removeEntity(_0x44783c,null))[_0xdb9d('0x42')](handleError(_0x44783c,null));}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.model.js b/server/api/UserChatInteraction/UserChatInteraction.model.js index b52aee5..7f5a6e6 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 _0x83cc=['define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./UserChatInteraction.attributes'];(function(_0x5afc86,_0x5705a3){var _0x1cfae3=function(_0x36eabe){while(--_0x36eabe){_0x5afc86['push'](_0x5afc86['shift']());}};_0x1cfae3(++_0x5705a3);}(_0x83cc,0x1c4));var _0xc83c=function(_0x2e8a70,_0x43d2b0){_0x2e8a70=_0x2e8a70-0x0;var _0x1ffcdf=_0x83cc[_0x2e8a70];return _0x1ffcdf;};'use strict';var _=require('lodash');var util=require(_0xc83c('0x0'));var logger=require(_0xc83c('0x1'))(_0xc83c('0x2'));var moment=require(_0xc83c('0x3'));var BPromise=require(_0xc83c('0x4'));var rp=require(_0xc83c('0x5'));var fs=require('fs');var path=require(_0xc83c('0x6'));var rimraf=require(_0xc83c('0x7'));var config=require(_0xc83c('0x8'));var attributes=require(_0xc83c('0x9'));module['exports']=function(_0x53d7d5,_0x428647){return _0x53d7d5[_0xc83c('0xa')]('UserChatInteraction',attributes,{'tableName':'user_has_chat_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd295=['./UserChatInteraction.attributes','exports','UserChatInteraction','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5f46e7,_0x62f9f8){var _0x567e95=function(_0x5cb693){while(--_0x5cb693){_0x5f46e7['push'](_0x5f46e7['shift']());}};_0x567e95(++_0x62f9f8);}(_0xd295,0x15f));var _0x5d29=function(_0x143e32,_0x3b7391){_0x143e32=_0x143e32-0x0;var _0xa905c3=_0xd295[_0x143e32];return _0xa905c3;};'use strict';var _=require('lodash');var util=require(_0x5d29('0x0'));var logger=require(_0x5d29('0x1'))(_0x5d29('0x2'));var moment=require(_0x5d29('0x3'));var BPromise=require(_0x5d29('0x4'));var rp=require(_0x5d29('0x5'));var fs=require('fs');var path=require(_0x5d29('0x6'));var rimraf=require(_0x5d29('0x7'));var config=require(_0x5d29('0x8'));var attributes=require(_0x5d29('0x9'));module[_0x5d29('0xa')]=function(_0x3784c3,_0x60c97c){return _0x3784c3['define'](_0x5d29('0xb'),attributes,{'tableName':'user_has_chat_interactions','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 8818d01..5ed14ac 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 _0x3220=['stringify','error','UserChatInteraction,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug'];(function(_0x5ed928,_0x2dbbdc){var _0x2effcc=function(_0x19ba45){while(--_0x19ba45){_0x5ed928['push'](_0x5ed928['shift']());}};_0x2effcc(++_0x2dbbdc);}(_0x3220,0x156));var _0x0322=function(_0x5460fb,_0xb4e34d){_0x5460fb=_0x5460fb-0x0;var _0x3a4026=_0x3220[_0x5460fb];return _0x3a4026;};'use strict';var _=require(_0x0322('0x0'));var util=require('util');var moment=require(_0x0322('0x1'));var BPromise=require('bluebird');var rs=require(_0x0322('0x2'));var fs=require('fs');var Redis=require(_0x0322('0x3'));var db=require(_0x0322('0x4'))['db'];var utils=require(_0x0322('0x5'));var logger=require(_0x0322('0x6'))(_0x0322('0x7'));var config=require(_0x0322('0x8'));var jayson=require(_0x0322('0x9'));var client=jayson[_0x0322('0xa')][_0x0322('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2314ce,_0x18f4ac,_0x20137e){return new BPromise(function(_0x5472f6,_0x4e636c){return client['request'](_0x2314ce,_0x20137e)['then'](function(_0x519f57){logger[_0x0322('0xc')]('UserChatInteraction,\x20%s,\x20%s',_0x18f4ac,_0x0322('0xd'));logger[_0x0322('0xe')]('UserChatInteraction,\x20%s,\x20%s,\x20%s',_0x18f4ac,_0x0322('0xd'),JSON[_0x0322('0xf')](_0x519f57));if(_0x519f57[_0x0322('0x10')]){if(_0x519f57['error']['code']===0x1f4){logger['error'](_0x0322('0x11'),_0x18f4ac,_0x519f57['error']['message']);return _0x4e636c(_0x519f57['error'][_0x0322('0x12')]);}logger[_0x0322('0x10')](_0x0322('0x11'),_0x18f4ac,_0x519f57[_0x0322('0x10')][_0x0322('0x12')]);return _0x5472f6(_0x519f57[_0x0322('0x10')][_0x0322('0x12')]);}else{logger[_0x0322('0xc')](_0x0322('0x11'),_0x18f4ac,'request\x20sent');_0x5472f6(_0x519f57[_0x0322('0x13')]['message']);}})[_0x0322('0x14')](function(_0x4ff819){logger['error'](_0x0322('0x11'),_0x18f4ac,_0x4ff819);_0x4e636c(_0x4ff819);});});} \ No newline at end of file +var _0xf1c5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','UserChatInteraction,\x20%s,\x20%s','debug','UserChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird'];(function(_0x226a77,_0x143aed){var _0x4af6a7=function(_0x5e4b4b){while(--_0x5e4b4b){_0x226a77['push'](_0x226a77['shift']());}};_0x4af6a7(++_0x143aed);}(_0xf1c5,0x1a1));var _0x5f1c=function(_0x44b7e7,_0x50b7bd){_0x44b7e7=_0x44b7e7-0x0;var _0x49064c=_0xf1c5[_0x44b7e7];return _0x49064c;};'use strict';var _=require(_0x5f1c('0x0'));var util=require('util');var moment=require(_0x5f1c('0x1'));var BPromise=require(_0x5f1c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f1c('0x3'));var db=require(_0x5f1c('0x4'))['db'];var utils=require(_0x5f1c('0x5'));var logger=require(_0x5f1c('0x6'))(_0x5f1c('0x7'));var config=require(_0x5f1c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5f1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48a050,_0x52339f,_0x4f66dd){return new BPromise(function(_0x5a941e,_0x2445b2){return client['request'](_0x48a050,_0x4f66dd)[_0x5f1c('0xa')](function(_0x21c04d){logger[_0x5f1c('0xb')](_0x5f1c('0xc'),_0x52339f,'request\x20sent');logger[_0x5f1c('0xd')](_0x5f1c('0xe'),_0x52339f,_0x5f1c('0xf'),JSON[_0x5f1c('0x10')](_0x21c04d));if(_0x21c04d[_0x5f1c('0x11')]){if(_0x21c04d['error'][_0x5f1c('0x12')]===0x1f4){logger['error']('UserChatInteraction,\x20%s,\x20%s',_0x52339f,_0x21c04d[_0x5f1c('0x11')]['message']);return _0x2445b2(_0x21c04d[_0x5f1c('0x11')][_0x5f1c('0x13')]);}logger[_0x5f1c('0x11')]('UserChatInteraction,\x20%s,\x20%s',_0x52339f,_0x21c04d['error'][_0x5f1c('0x13')]);return _0x5a941e(_0x21c04d[_0x5f1c('0x11')][_0x5f1c('0x13')]);}else{logger[_0x5f1c('0xb')](_0x5f1c('0xc'),_0x52339f,_0x5f1c('0xf'));_0x5a941e(_0x21c04d['result'][_0x5f1c('0x13')]);}})[_0x5f1c('0x14')](function(_0x59f4f3){logger['error'](_0x5f1c('0xc'),_0x52339f,_0x59f4f3);_0x2445b2(_0x59f4f3);});});} \ No newline at end of file diff --git a/server/api/UserChatInteraction/index.js b/server/api/UserChatInteraction/index.js index edcaa5c..2d57ff8 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 _0x3ce8=['connect-timeout','express','../../components/auth/service','../../config/environment','./UserChatInteraction.controller','get','index','isAuthenticated','show','create','put','delete','destroy','exports','multer','util'];(function(_0x282983,_0x4c4038){var _0x48dc28=function(_0x1078d0){while(--_0x1078d0){_0x282983['push'](_0x282983['shift']());}};_0x48dc28(++_0x4c4038);}(_0x3ce8,0xde));var _0x83ce=function(_0x34e408,_0xf259df){_0x34e408=_0x34e408-0x0;var _0x33787d=_0x3ce8[_0x34e408];return _0x33787d;};'use strict';var multer=require(_0x83ce('0x0'));var util=require(_0x83ce('0x1'));var path=require('path');var timeout=require(_0x83ce('0x2'));var express=require(_0x83ce('0x3'));var router=express['Router']();var auth=require(_0x83ce('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x83ce('0x5'));var controller=require(_0x83ce('0x6'));router[_0x83ce('0x7')]('/',auth['isAuthenticated'](),controller[_0x83ce('0x8')]);router['get']('/:id',auth[_0x83ce('0x9')](),controller[_0x83ce('0xa')]);router['post']('/',auth[_0x83ce('0x9')](),controller[_0x83ce('0xb')]);router[_0x83ce('0xc')]('/:id',auth[_0x83ce('0x9')](),controller['update']);router[_0x83ce('0xd')]('/:id',auth[_0x83ce('0x9')](),controller[_0x83ce('0xe')]);module[_0x83ce('0xf')]=router; \ No newline at end of file +var _0xce4d=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserChatInteraction.controller','index','isAuthenticated','show','post','create','put','/:id','delete','destroy','multer','util','path'];(function(_0xa62f67,_0x57d2b6){var _0x4ecc75=function(_0xcb608c){while(--_0xcb608c){_0xa62f67['push'](_0xa62f67['shift']());}};_0x4ecc75(++_0x57d2b6);}(_0xce4d,0x82));var _0xdce4=function(_0x334aa6,_0x1882a4){_0x334aa6=_0x334aa6-0x0;var _0xe10207=_0xce4d[_0x334aa6];return _0xe10207;};'use strict';var multer=require(_0xdce4('0x0'));var util=require(_0xdce4('0x1'));var path=require(_0xdce4('0x2'));var timeout=require(_0xdce4('0x3'));var express=require(_0xdce4('0x4'));var router=express[_0xdce4('0x5')]();var auth=require(_0xdce4('0x6'));var interaction=require(_0xdce4('0x7'));var config=require(_0xdce4('0x8'));var controller=require(_0xdce4('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xdce4('0xa')]);router['get']('/:id',auth[_0xdce4('0xb')](),controller[_0xdce4('0xc')]);router[_0xdce4('0xd')]('/',auth[_0xdce4('0xb')](),controller[_0xdce4('0xe')]);router[_0xdce4('0xf')](_0xdce4('0x10'),auth[_0xdce4('0xb')](),controller['update']);router[_0xdce4('0x11')](_0xdce4('0x10'),auth[_0xdce4('0xb')](),controller[_0xdce4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js b/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js index a1b48a6..c47f4b4 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 _0x499f=['sequelize','exports','INTEGER'];(function(_0x252328,_0x4c22f0){var _0xaa85b7=function(_0x2623d0){while(--_0x2623d0){_0x252328['push'](_0x252328['shift']());}};_0xaa85b7(++_0x4c22f0);}(_0x499f,0x99));var _0xf499=function(_0x42c341,_0x31d467){_0x42c341=_0x42c341-0x0;var _0x43621b=_0x499f[_0x42c341];return _0x43621b;};'use strict';var Sequelize=require(_0xf499('0x0'));module[_0xf499('0x1')]={'FaxInteractionId':{'type':Sequelize[_0xf499('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xf499('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0x4409=['INTEGER','exports'];(function(_0x2c7e18,_0x455821){var _0x2d780d=function(_0x22b5ac){while(--_0x22b5ac){_0x2c7e18['push'](_0x2c7e18['shift']());}};_0x2d780d(++_0x455821);}(_0x4409,0x87));var _0x9440=function(_0x10b348,_0x37e569){_0x10b348=_0x10b348-0x0;var _0x10fe34=_0x4409[_0x10b348];return _0x10fe34;};'use strict';var Sequelize=require('sequelize');module[_0x9440('0x0')]={'FaxInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x9440('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.controller.js b/server/api/UserFaxInteraction/UserFaxInteraction.controller.js index 7cc8e89..fc84983 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 _0xdb5a=['Content-Range','apply','reject','save','update','then','UserFaxInteractions','UserProfileResource','error','stack','name','index','rawAttributes','model','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','map','type','options','UserFaxInteraction','includeAll','include','findAll','rows','show','params','keys','filters','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','to-csv','ejs','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','count','offset'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0xdb5a,0x1af));var _0xadb5=function(_0x34cc41,_0x313cf8){_0x34cc41=_0x34cc41-0x0;var _0x101747=_0xdb5a[_0x34cc41];return _0x101747;};'use strict';var pdf=require(_0xadb5('0x0'));var emlformat=require(_0xadb5('0x1'));var rimraf=require(_0xadb5('0x2'));var zipdir=require(_0xadb5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xadb5('0x4'));var moment=require('moment');var BPromise=require(_0xadb5('0x5'));var Mustache=require(_0xadb5('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xadb5('0x7'));var ejs=require(_0xadb5('0x8'));var fs=require('fs');var _=require(_0xadb5('0x9'));var squel=require(_0xadb5('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xadb5('0x7'));var querystring=require(_0xadb5('0xb'));var Papa=require('papaparse');var Redis=require(_0xadb5('0xc'));var authService=require(_0xadb5('0xd'));var qs=require(_0xadb5('0xe'));var as=require(_0xadb5('0xf'));var hardwareService=require(_0xadb5('0x10'));var logger=require('../../config/logger')(_0xadb5('0x11'));var utils=require(_0xadb5('0x12'));var config=require(_0xadb5('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf3cd36,_0x3e8e65){_0x3e8e65=_0x3e8e65||0xcc;return function(_0x4e1849){if(_0x4e1849){return _0xf3cd36['sendStatus'](_0x3e8e65);}return _0xf3cd36[_0xadb5('0x14')](_0x3e8e65)[_0xadb5('0x15')]();};}function respondWithResult(_0x256ed5,_0x30fe95){_0x30fe95=_0x30fe95||0xc8;return function(_0x4f4a28){if(_0x4f4a28){return _0x256ed5['status'](_0x30fe95)[_0xadb5('0x16')](_0x4f4a28);}};}function respondWithFilteredResult(_0x1c9237,_0x43a263){return function(_0x345742){if(_0x345742){var _0x5c279d=_0x345742[_0xadb5('0x17')],_0x3251ce=_0x43a263[_0xadb5('0x18')],_0x226da5=_0x43a263[_0xadb5('0x18')]+_0x43a263['limit'],_0x2ebb74;if(_0x226da5>=_0x5c279d){_0x226da5=_0x5c279d;_0x2ebb74=0xc8;}else{_0x2ebb74=0xce;}_0x1c9237['status'](_0x2ebb74);return _0x1c9237['set'](_0xadb5('0x19'),_0x3251ce+'-'+_0x226da5+'/'+_0x5c279d)['json'](_0x345742);}return null;};}function patchUpdates(_0x5ea742){return function(_0x454f64){try{jsonpatch[_0xadb5('0x1a')](_0x454f64,_0x5ea742,!![]);}catch(_0x5a949c){return BPromise[_0xadb5('0x1b')](_0x5a949c);}return _0x454f64[_0xadb5('0x1c')]();};}function saveUpdates(_0xea86b6,_0x53bfc4){return function(_0x15cf0a){if(_0x15cf0a){return _0x15cf0a[_0xadb5('0x1d')](_0xea86b6)[_0xadb5('0x1e')](function(_0x189a6a){return _0x189a6a;});}return null;};}function removeEntity(_0x572346,_0x2a7471){return function(_0x53f3c4){if(_0x53f3c4){return _0x53f3c4['destroy']()[_0xadb5('0x1e')](function(){var _0x5a2691=_0x53f3c4['get']({'plain':!![]});var _0x207192=_0xadb5('0x1f');return db[_0xadb5('0x20')]['destroy']({'where':{'type':_0x207192,'resourceId':_0x5a2691['id']}})[_0xadb5('0x1e')](function(){return _0x53f3c4;});})[_0xadb5('0x1e')](function(){_0x572346[_0xadb5('0x14')](0xcc)[_0xadb5('0x15')]();});}};}function handleEntityNotFound(_0x481f2a,_0x107ab2){return function(_0x3f022f){if(!_0x3f022f){_0x481f2a['sendStatus'](0x194);}return _0x3f022f;};}function handleError(_0x518a2c,_0x2038e9){_0x2038e9=_0x2038e9||0x1f4;return function(_0x1a99fe){logger[_0xadb5('0x21')](_0x1a99fe[_0xadb5('0x22')]);if(_0x1a99fe[_0xadb5('0x23')]){delete _0x1a99fe[_0xadb5('0x23')];}_0x518a2c['status'](_0x2038e9)['send'](_0x1a99fe);};}exports[_0xadb5('0x24')]=function(_0x3367af,_0x39b7ea){var _0x4f8252={},_0x575447={},_0x13ee39={'count':0x0,'rows':[]};var _0x291c5c=_['map'](db['UserFaxInteraction'][_0xadb5('0x25')],function(_0x351330){return{'name':_0x351330['fieldName'],'type':_0x351330['type']['key']};});_0x575447[_0xadb5('0x26')]=_['map'](_0x291c5c,_0xadb5('0x23'));_0x575447[_0xadb5('0x27')]=_['keys'](_0x3367af[_0xadb5('0x27')]);_0x575447['filters']=_[_0xadb5('0x28')](_0x575447[_0xadb5('0x26')],_0x575447['query']);_0x4f8252['attributes']=_[_0xadb5('0x28')](_0x575447[_0xadb5('0x26')],qs['fields'](_0x3367af[_0xadb5('0x27')][_0xadb5('0x29')]));_0x4f8252[_0xadb5('0x2a')]=_0x4f8252[_0xadb5('0x2a')][_0xadb5('0x2b')]?_0x4f8252[_0xadb5('0x2a')]:_0x575447['model'];if(!_0x3367af['query'][_0xadb5('0x2c')]('nolimit')){_0x4f8252[_0xadb5('0x2d')]=qs[_0xadb5('0x2d')](_0x3367af[_0xadb5('0x27')][_0xadb5('0x2d')]);_0x4f8252[_0xadb5('0x18')]=qs[_0xadb5('0x18')](_0x3367af[_0xadb5('0x27')]['offset']);}_0x4f8252[_0xadb5('0x2e')]=qs[_0xadb5('0x2f')](_0x3367af[_0xadb5('0x27')][_0xadb5('0x2f')]);_0x4f8252['where']=qs['filters'](_[_0xadb5('0x30')](_0x3367af['query'],_0x575447['filters']),_0x291c5c);if(_0x3367af[_0xadb5('0x27')][_0xadb5('0x31')]){_0x4f8252[_0xadb5('0x32')]=_[_0xadb5('0x33')](_0x4f8252[_0xadb5('0x32')],{'$or':_[_0xadb5('0x34')](_0x291c5c,function(_0x5044be){if(_0x5044be[_0xadb5('0x35')]!=='VIRTUAL'){var _0x314ea1={};_0x314ea1[_0x5044be[_0xadb5('0x23')]]={'$like':'%'+_0x3367af['query'][_0xadb5('0x31')]+'%'};return _0x314ea1;}})});}_0x4f8252=_['merge']({},_0x4f8252,_0x3367af[_0xadb5('0x36')]);var _0x2be007={'where':_0x4f8252[_0xadb5('0x32')]};return db[_0xadb5('0x37')][_0xadb5('0x17')](_0x2be007)[_0xadb5('0x1e')](function(_0x2856df){_0x13ee39[_0xadb5('0x17')]=_0x2856df;if(_0x3367af[_0xadb5('0x27')][_0xadb5('0x38')]){_0x4f8252[_0xadb5('0x39')]=[{'all':!![]}];}return db[_0xadb5('0x37')][_0xadb5('0x3a')](_0x4f8252);})[_0xadb5('0x1e')](function(_0x1b9b0c){_0x13ee39[_0xadb5('0x3b')]=_0x1b9b0c;return _0x13ee39;})[_0xadb5('0x1e')](respondWithFilteredResult(_0x39b7ea,_0x4f8252))['catch'](handleError(_0x39b7ea,null));};exports[_0xadb5('0x3c')]=function(_0x375daf,_0x196efe){var _0x2c9730={'raw':!![],'where':{'id':_0x375daf[_0xadb5('0x3d')]['id']}},_0x36e09d={};_0x36e09d['model']=_[_0xadb5('0x3e')](db[_0xadb5('0x37')]['rawAttributes']);_0x36e09d[_0xadb5('0x27')]=_['keys'](_0x375daf[_0xadb5('0x27')]);_0x36e09d[_0xadb5('0x3f')]=_[_0xadb5('0x28')](_0x36e09d[_0xadb5('0x26')],_0x36e09d[_0xadb5('0x27')]);_0x2c9730[_0xadb5('0x2a')]=_[_0xadb5('0x28')](_0x36e09d[_0xadb5('0x26')],qs['fields'](_0x375daf[_0xadb5('0x27')][_0xadb5('0x29')]));_0x2c9730[_0xadb5('0x2a')]=_0x2c9730['attributes']['length']?_0x2c9730[_0xadb5('0x2a')]:_0x36e09d['model'];if(_0x375daf[_0xadb5('0x27')][_0xadb5('0x38')]){_0x2c9730[_0xadb5('0x39')]=[{'all':!![]}];}_0x2c9730=_['merge']({},_0x2c9730,_0x375daf[_0xadb5('0x36')]);return db[_0xadb5('0x37')][_0xadb5('0x40')](_0x2c9730)[_0xadb5('0x1e')](handleEntityNotFound(_0x196efe,null))[_0xadb5('0x1e')](respondWithResult(_0x196efe,null))[_0xadb5('0x41')](handleError(_0x196efe,null));};exports[_0xadb5('0x42')]=function(_0x51acfc,_0x4c0e6b){return db[_0xadb5('0x37')][_0xadb5('0x42')](_0x51acfc[_0xadb5('0x43')],{})[_0xadb5('0x1e')](function(_0x1bf4b2){var _0x5a0786=_0x51acfc[_0xadb5('0x44')][_0xadb5('0x45')]({'plain':!![]});if(!_0x5a0786)throw new Error(_0xadb5('0x46'));if(_0x5a0786['role']==='user'){var _0x363425=_0x1bf4b2['get']({'plain':!![]});var _0x4a9b3e=_0xadb5('0x1f');return db[_0xadb5('0x47')]['find']({'where':{'name':_0x4a9b3e,'userProfileId':_0x5a0786[_0xadb5('0x48')]},'raw':!![]})['then'](function(_0x5bba06){if(_0x5bba06&&_0x5bba06[_0xadb5('0x49')]===0x0){return db[_0xadb5('0x20')][_0xadb5('0x42')]({'name':_0x363425['name'],'resourceId':_0x363425['id'],'type':_0x5bba06[_0xadb5('0x23')],'sectionId':_0x5bba06['id']},{})[_0xadb5('0x1e')](function(){return _0x1bf4b2;});}else{return _0x1bf4b2;}})[_0xadb5('0x41')](function(_0x244218){logger['error'](_0xadb5('0x4a'),_0x244218);throw _0x244218;});}return _0x1bf4b2;})[_0xadb5('0x1e')](respondWithResult(_0x4c0e6b,0xc9))[_0xadb5('0x41')](handleError(_0x4c0e6b,null));};exports[_0xadb5('0x1d')]=function(_0x129f42,_0x518f92){if(_0x129f42['body']['id']){delete _0x129f42[_0xadb5('0x43')]['id'];}return db[_0xadb5('0x37')][_0xadb5('0x40')]({'where':{'id':_0x129f42[_0xadb5('0x3d')]['id']}})['then'](handleEntityNotFound(_0x518f92,null))[_0xadb5('0x1e')](saveUpdates(_0x129f42[_0xadb5('0x43')],null))[_0xadb5('0x1e')](respondWithResult(_0x518f92,null))[_0xadb5('0x41')](handleError(_0x518f92,null));};exports[_0xadb5('0x4b')]=function(_0x5f088e,_0x51c0dc){return db['UserFaxInteraction'][_0xadb5('0x40')]({'where':{'id':_0x5f088e[_0xadb5('0x3d')]['id']}})[_0xadb5('0x1e')](handleEntityNotFound(_0x51c0dc,null))[_0xadb5('0x1e')](removeEntity(_0x51c0dc,null))['catch'](handleError(_0x51c0dc,null));}; \ No newline at end of file +var _0x5ab4=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','name','options','UserFaxInteraction','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','end','stack','send','index','rawAttributes','fieldName','type','model','map','query'];(function(_0x178114,_0x1f3a24){var _0x1d7119=function(_0x3d4bb9){while(--_0x3d4bb9){_0x178114['push'](_0x178114['shift']());}};_0x1d7119(++_0x1f3a24);}(_0x5ab4,0x1e2));var _0x45ab=function(_0x55bddb,_0x149133){_0x55bddb=_0x55bddb-0x0;var _0x3c1661=_0x5ab4[_0x55bddb];return _0x3c1661;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x45ab('0x0'));var rimraf=require(_0x45ab('0x1'));var zipdir=require(_0x45ab('0x2'));var jsonpatch=require(_0x45ab('0x3'));var rp=require(_0x45ab('0x4'));var moment=require(_0x45ab('0x5'));var BPromise=require(_0x45ab('0x6'));var Mustache=require(_0x45ab('0x7'));var util=require(_0x45ab('0x8'));var path=require(_0x45ab('0x9'));var sox=require(_0x45ab('0xa'));var csv=require(_0x45ab('0xb'));var ejs=require(_0x45ab('0xc'));var fs=require('fs');var _=require(_0x45ab('0xd'));var squel=require(_0x45ab('0xe'));var crypto=require(_0x45ab('0xf'));var jsforce=require(_0x45ab('0x10'));var deskjs=require(_0x45ab('0x11'));var toCsv=require(_0x45ab('0xb'));var querystring=require(_0x45ab('0x12'));var Papa=require(_0x45ab('0x13'));var Redis=require(_0x45ab('0x14'));var authService=require(_0x45ab('0x15'));var qs=require(_0x45ab('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45ab('0x17'));var logger=require('../../config/logger')(_0x45ab('0x18'));var utils=require(_0x45ab('0x19'));var config=require(_0x45ab('0x1a'));var licenseUtil=require(_0x45ab('0x1b'));var db=require(_0x45ab('0x1c'))['db'];function respondWithStatusCode(_0x37863a,_0x17b4be){_0x17b4be=_0x17b4be||0xcc;return function(_0x41654f){if(_0x41654f){return _0x37863a[_0x45ab('0x1d')](_0x17b4be);}return _0x37863a['status'](_0x17b4be)['end']();};}function respondWithResult(_0x56119c,_0x193b97){_0x193b97=_0x193b97||0xc8;return function(_0x24a3e5){if(_0x24a3e5){return _0x56119c[_0x45ab('0x1e')](_0x193b97)[_0x45ab('0x1f')](_0x24a3e5);}};}function respondWithFilteredResult(_0x120d9a,_0x149f9d){return function(_0x1e9e9a){if(_0x1e9e9a){var _0x45de85=_0x1e9e9a[_0x45ab('0x20')],_0x17e664=_0x149f9d[_0x45ab('0x21')],_0x38a70a=_0x149f9d[_0x45ab('0x21')]+_0x149f9d['limit'],_0x26e5a6;if(_0x38a70a>=_0x45de85){_0x38a70a=_0x45de85;_0x26e5a6=0xc8;}else{_0x26e5a6=0xce;}_0x120d9a[_0x45ab('0x1e')](_0x26e5a6);return _0x120d9a[_0x45ab('0x22')](_0x45ab('0x23'),_0x17e664+'-'+_0x38a70a+'/'+_0x45de85)[_0x45ab('0x1f')](_0x1e9e9a);}return null;};}function patchUpdates(_0x28aa5b){return function(_0x1a867e){try{jsonpatch[_0x45ab('0x24')](_0x1a867e,_0x28aa5b,!![]);}catch(_0x1e9d36){return BPromise[_0x45ab('0x25')](_0x1e9d36);}return _0x1a867e['save']();};}function saveUpdates(_0xef4991,_0x475c75){return function(_0x1d3a11){if(_0x1d3a11){return _0x1d3a11[_0x45ab('0x26')](_0xef4991)[_0x45ab('0x27')](function(_0x3715f6){return _0x3715f6;});}return null;};}function removeEntity(_0x3c3a8f,_0x4cd86e){return function(_0x38c561){if(_0x38c561){return _0x38c561[_0x45ab('0x28')]()[_0x45ab('0x27')](function(){var _0x35ea08=_0x38c561['get']({'plain':!![]});var _0x175474='UserFaxInteractions';return db[_0x45ab('0x29')][_0x45ab('0x28')]({'where':{'type':_0x175474,'resourceId':_0x35ea08['id']}})[_0x45ab('0x27')](function(){return _0x38c561;});})[_0x45ab('0x27')](function(){_0x3c3a8f['status'](0xcc)[_0x45ab('0x2a')]();});}};}function handleEntityNotFound(_0x586acc,_0x4c3dba){return function(_0x3fcbfd){if(!_0x3fcbfd){_0x586acc[_0x45ab('0x1d')](0x194);}return _0x3fcbfd;};}function handleError(_0x1b812e,_0x4e8ae8){_0x4e8ae8=_0x4e8ae8||0x1f4;return function(_0xc8a08b){logger['error'](_0xc8a08b[_0x45ab('0x2b')]);if(_0xc8a08b['name']){delete _0xc8a08b['name'];}_0x1b812e[_0x45ab('0x1e')](_0x4e8ae8)[_0x45ab('0x2c')](_0xc8a08b);};}exports[_0x45ab('0x2d')]=function(_0xf13733,_0xbf60a4){var _0x86e3de={},_0x10f796={},_0x1dca48={'count':0x0,'rows':[]};var _0x2cafcb=_['map'](db['UserFaxInteraction'][_0x45ab('0x2e')],function(_0x1f909d){return{'name':_0x1f909d[_0x45ab('0x2f')],'type':_0x1f909d[_0x45ab('0x30')]['key']};});_0x10f796[_0x45ab('0x31')]=_[_0x45ab('0x32')](_0x2cafcb,'name');_0x10f796[_0x45ab('0x33')]=_['keys'](_0xf13733[_0x45ab('0x33')]);_0x10f796[_0x45ab('0x34')]=_[_0x45ab('0x35')](_0x10f796[_0x45ab('0x31')],_0x10f796[_0x45ab('0x33')]);_0x86e3de[_0x45ab('0x36')]=_[_0x45ab('0x35')](_0x10f796[_0x45ab('0x31')],qs['fields'](_0xf13733[_0x45ab('0x33')][_0x45ab('0x37')]));_0x86e3de[_0x45ab('0x36')]=_0x86e3de[_0x45ab('0x36')][_0x45ab('0x38')]?_0x86e3de[_0x45ab('0x36')]:_0x10f796[_0x45ab('0x31')];if(!_0xf13733[_0x45ab('0x33')][_0x45ab('0x39')](_0x45ab('0x3a'))){_0x86e3de[_0x45ab('0x3b')]=qs[_0x45ab('0x3b')](_0xf13733[_0x45ab('0x33')][_0x45ab('0x3b')]);_0x86e3de['offset']=qs[_0x45ab('0x21')](_0xf13733[_0x45ab('0x33')]['offset']);}_0x86e3de[_0x45ab('0x3c')]=qs[_0x45ab('0x3d')](_0xf13733[_0x45ab('0x33')][_0x45ab('0x3d')]);_0x86e3de[_0x45ab('0x3e')]=qs[_0x45ab('0x34')](_[_0x45ab('0x3f')](_0xf13733[_0x45ab('0x33')],_0x10f796[_0x45ab('0x34')]),_0x2cafcb);if(_0xf13733[_0x45ab('0x33')][_0x45ab('0x40')]){_0x86e3de['where']=_[_0x45ab('0x41')](_0x86e3de[_0x45ab('0x3e')],{'$or':_[_0x45ab('0x32')](_0x2cafcb,function(_0x595488){if(_0x595488[_0x45ab('0x30')]!=='VIRTUAL'){var _0x4de7fb={};_0x4de7fb[_0x595488[_0x45ab('0x42')]]={'$like':'%'+_0xf13733[_0x45ab('0x33')]['filter']+'%'};return _0x4de7fb;}})});}_0x86e3de=_[_0x45ab('0x41')]({},_0x86e3de,_0xf13733[_0x45ab('0x43')]);var _0x625947={'where':_0x86e3de[_0x45ab('0x3e')]};return db[_0x45ab('0x44')]['count'](_0x625947)[_0x45ab('0x27')](function(_0x2376e5){_0x1dca48[_0x45ab('0x20')]=_0x2376e5;if(_0xf13733['query'][_0x45ab('0x45')]){_0x86e3de[_0x45ab('0x46')]=[{'all':!![]}];}return db[_0x45ab('0x44')][_0x45ab('0x47')](_0x86e3de);})[_0x45ab('0x27')](function(_0x88c236){_0x1dca48[_0x45ab('0x48')]=_0x88c236;return _0x1dca48;})[_0x45ab('0x27')](respondWithFilteredResult(_0xbf60a4,_0x86e3de))[_0x45ab('0x49')](handleError(_0xbf60a4,null));};exports[_0x45ab('0x4a')]=function(_0x212536,_0x3b8765){var _0x2fceb0={'raw':!![],'where':{'id':_0x212536[_0x45ab('0x4b')]['id']}},_0x2ad4b6={};_0x2ad4b6['model']=_[_0x45ab('0x4c')](db[_0x45ab('0x44')][_0x45ab('0x2e')]);_0x2ad4b6[_0x45ab('0x33')]=_[_0x45ab('0x4c')](_0x212536[_0x45ab('0x33')]);_0x2ad4b6[_0x45ab('0x34')]=_[_0x45ab('0x35')](_0x2ad4b6[_0x45ab('0x31')],_0x2ad4b6[_0x45ab('0x33')]);_0x2fceb0[_0x45ab('0x36')]=_[_0x45ab('0x35')](_0x2ad4b6[_0x45ab('0x31')],qs[_0x45ab('0x37')](_0x212536[_0x45ab('0x33')][_0x45ab('0x37')]));_0x2fceb0[_0x45ab('0x36')]=_0x2fceb0['attributes']['length']?_0x2fceb0['attributes']:_0x2ad4b6[_0x45ab('0x31')];if(_0x212536[_0x45ab('0x33')][_0x45ab('0x45')]){_0x2fceb0[_0x45ab('0x46')]=[{'all':!![]}];}_0x2fceb0=_[_0x45ab('0x41')]({},_0x2fceb0,_0x212536['options']);return db[_0x45ab('0x44')][_0x45ab('0x4d')](_0x2fceb0)[_0x45ab('0x27')](handleEntityNotFound(_0x3b8765,null))[_0x45ab('0x27')](respondWithResult(_0x3b8765,null))[_0x45ab('0x49')](handleError(_0x3b8765,null));};exports[_0x45ab('0x4e')]=function(_0x53b301,_0x2a6193){return db['UserFaxInteraction'][_0x45ab('0x4e')](_0x53b301[_0x45ab('0x4f')],{})['then'](function(_0x386690){var _0x3d1b36=_0x53b301[_0x45ab('0x50')][_0x45ab('0x51')]({'plain':!![]});if(!_0x3d1b36)throw new Error(_0x45ab('0x52'));if(_0x3d1b36[_0x45ab('0x53')]===_0x45ab('0x50')){var _0x255564=_0x386690[_0x45ab('0x51')]({'plain':!![]});var _0x2574b0='UserFaxInteractions';return db[_0x45ab('0x54')][_0x45ab('0x4d')]({'where':{'name':_0x2574b0,'userProfileId':_0x3d1b36[_0x45ab('0x55')]},'raw':!![]})['then'](function(_0x30ea93){if(_0x30ea93&&_0x30ea93[_0x45ab('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x255564[_0x45ab('0x42')],'resourceId':_0x255564['id'],'type':_0x30ea93[_0x45ab('0x42')],'sectionId':_0x30ea93['id']},{})[_0x45ab('0x27')](function(){return _0x386690;});}else{return _0x386690;}})[_0x45ab('0x49')](function(_0x1a3b94){logger[_0x45ab('0x57')](_0x45ab('0x58'),_0x1a3b94);throw _0x1a3b94;});}return _0x386690;})[_0x45ab('0x27')](respondWithResult(_0x2a6193,0xc9))[_0x45ab('0x49')](handleError(_0x2a6193,null));};exports[_0x45ab('0x26')]=function(_0x49ac4e,_0x18c259){if(_0x49ac4e[_0x45ab('0x4f')]['id']){delete _0x49ac4e[_0x45ab('0x4f')]['id'];}return db[_0x45ab('0x44')]['find']({'where':{'id':_0x49ac4e[_0x45ab('0x4b')]['id']}})['then'](handleEntityNotFound(_0x18c259,null))['then'](saveUpdates(_0x49ac4e[_0x45ab('0x4f')],null))[_0x45ab('0x27')](respondWithResult(_0x18c259,null))[_0x45ab('0x49')](handleError(_0x18c259,null));};exports[_0x45ab('0x28')]=function(_0x36a41d,_0xb100f3){return db['UserFaxInteraction'][_0x45ab('0x4d')]({'where':{'id':_0x36a41d['params']['id']}})['then'](handleEntityNotFound(_0xb100f3,null))[_0x45ab('0x27')](removeEntity(_0xb100f3,null))['catch'](handleError(_0xb100f3,null));}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.model.js b/server/api/UserFaxInteraction/UserFaxInteraction.model.js index 16c4eb2..82567c2 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(_0x163d61,_0x480ef2){var _0x222960=function(_0x3d9ba0){while(--_0x3d9ba0){_0x163d61['push'](_0x163d61['shift']());}};_0x222960(++_0x480ef2);}(_0xdb28,0x106));var _0x8db2=function(_0xc1b896,_0x612ac4){_0xc1b896=_0xc1b896-0x0;var _0x2cd0f9=_0xdb28[_0xc1b896];return _0x2cd0f9;};'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 _0x5f66=['request-promise','path','../../config/environment','exports','UserFaxInteraction','user_has_fax_interactions','util','api','moment','bluebird'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./UserFaxInteraction.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'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 8c94191..26971d5 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 _0x192f=['../../config/environment','jayson/promise','client','request','then','UserFaxInteraction,\x20%s,\x20%s','debug','UserFaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird','../../config/logger','rpc'];(function(_0x1acc01,_0x5cb80c){var _0x5603f1=function(_0x5e7558){while(--_0x5e7558){_0x1acc01['push'](_0x1acc01['shift']());}};_0x5603f1(++_0x5cb80c);}(_0x192f,0x1ef));var _0xf192=function(_0x101dd5,_0x3d3e31){_0x101dd5=_0x101dd5-0x0;var _0x59296f=_0x192f[_0x101dd5];return _0x59296f;};'use strict';var _=require('lodash');var util=require(_0xf192('0x0'));var moment=require(_0xf192('0x1'));var BPromise=require(_0xf192('0x2'));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(_0xf192('0x3'))(_0xf192('0x4'));var config=require(_0xf192('0x5'));var jayson=require(_0xf192('0x6'));var client=jayson[_0xf192('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f55de,_0x2b418c,_0x3aea03){return new BPromise(function(_0x2a0d04,_0x5ecb82){return client[_0xf192('0x8')](_0x4f55de,_0x3aea03)[_0xf192('0x9')](function(_0x593527){logger['info'](_0xf192('0xa'),_0x2b418c,'request\x20sent');logger[_0xf192('0xb')](_0xf192('0xc'),_0x2b418c,_0xf192('0xd'),JSON[_0xf192('0xe')](_0x593527));if(_0x593527[_0xf192('0xf')]){if(_0x593527[_0xf192('0xf')]['code']===0x1f4){logger['error'](_0xf192('0xa'),_0x2b418c,_0x593527[_0xf192('0xf')][_0xf192('0x10')]);return _0x5ecb82(_0x593527[_0xf192('0xf')][_0xf192('0x10')]);}logger[_0xf192('0xf')]('UserFaxInteraction,\x20%s,\x20%s',_0x2b418c,_0x593527['error'][_0xf192('0x10')]);return _0x2a0d04(_0x593527[_0xf192('0xf')][_0xf192('0x10')]);}else{logger[_0xf192('0x11')](_0xf192('0xa'),_0x2b418c,_0xf192('0xd'));_0x2a0d04(_0x593527[_0xf192('0x12')][_0xf192('0x10')]);}})[_0xf192('0x13')](function(_0x17cb5f){logger['error'](_0xf192('0xa'),_0x2b418c,_0x17cb5f);_0x5ecb82(_0x17cb5f);});});} \ No newline at end of file +var _0x2050=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','UserFaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxInteraction,\x20%s,\x20%s','message','info','result','catch'];(function(_0x5aada8,_0x460a35){var _0xf5247e=function(_0x507709){while(--_0x507709){_0x5aada8['push'](_0x5aada8['shift']());}};_0xf5247e(++_0x460a35);}(_0x2050,0x168));var _0x0205=function(_0x4c1a76,_0x41f32e){_0x4c1a76=_0x4c1a76-0x0;var _0x5e373a=_0x2050[_0x4c1a76];return _0x5e373a;};'use strict';var _=require(_0x0205('0x0'));var util=require(_0x0205('0x1'));var moment=require(_0x0205('0x2'));var BPromise=require(_0x0205('0x3'));var rs=require(_0x0205('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0205('0x5'))['db'];var utils=require(_0x0205('0x6'));var logger=require('../../config/logger')(_0x0205('0x7'));var config=require(_0x0205('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0205('0x9')][_0x0205('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44f4f3,_0x3caff8,_0xe3506a){return new BPromise(function(_0x3de482,_0x873b7d){return client[_0x0205('0xb')](_0x44f4f3,_0xe3506a)[_0x0205('0xc')](function(_0x277c23){logger['info']('UserFaxInteraction,\x20%s,\x20%s',_0x3caff8,_0x0205('0xd'));logger[_0x0205('0xe')](_0x0205('0xf'),_0x3caff8,_0x0205('0xd'),JSON[_0x0205('0x10')](_0x277c23));if(_0x277c23[_0x0205('0x11')]){if(_0x277c23[_0x0205('0x11')][_0x0205('0x12')]===0x1f4){logger['error'](_0x0205('0x13'),_0x3caff8,_0x277c23['error']['message']);return _0x873b7d(_0x277c23[_0x0205('0x11')]['message']);}logger['error']('UserFaxInteraction,\x20%s,\x20%s',_0x3caff8,_0x277c23[_0x0205('0x11')][_0x0205('0x14')]);return _0x3de482(_0x277c23[_0x0205('0x11')]['message']);}else{logger[_0x0205('0x15')](_0x0205('0x13'),_0x3caff8,_0x0205('0xd'));_0x3de482(_0x277c23[_0x0205('0x16')][_0x0205('0x14')]);}})[_0x0205('0x17')](function(_0x3efca3){logger[_0x0205('0x11')](_0x0205('0x13'),_0x3caff8,_0x3efca3);_0x873b7d(_0x3efca3);});});} \ No newline at end of file diff --git a/server/api/UserFaxInteraction/index.js b/server/api/UserFaxInteraction/index.js index 1fb8713..50ec6c4 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 _0x5609=['../../components/interaction/service','../../config/environment','./UserFaxInteraction.controller','get','isAuthenticated','show','post','put','/:id','delete','exports','util','path','express','../../components/auth/service'];(function(_0x15fe32,_0x48b3b6){var _0x147cba=function(_0x4fb18d){while(--_0x4fb18d){_0x15fe32['push'](_0x15fe32['shift']());}};_0x147cba(++_0x48b3b6);}(_0x5609,0xdd));var _0x9560=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5609[_0x4a9fb1];return _0x348672;};'use strict';var multer=require('multer');var util=require(_0x9560('0x0'));var path=require(_0x9560('0x1'));var timeout=require('connect-timeout');var express=require(_0x9560('0x2'));var router=express['Router']();var auth=require(_0x9560('0x3'));var interaction=require(_0x9560('0x4'));var config=require(_0x9560('0x5'));var controller=require(_0x9560('0x6'));router[_0x9560('0x7')]('/',auth[_0x9560('0x8')](),controller['index']);router[_0x9560('0x7')]('/:id',auth[_0x9560('0x8')](),controller[_0x9560('0x9')]);router[_0x9560('0xa')]('/',auth[_0x9560('0x8')](),controller['create']);router[_0x9560('0xb')](_0x9560('0xc'),auth[_0x9560('0x8')](),controller['update']);router[_0x9560('0xd')](_0x9560('0xc'),auth[_0x9560('0x8')](),controller['destroy']);module[_0x9560('0xe')]=router; \ No newline at end of file +var _0x9a0e=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserFaxInteraction.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x63354f,_0x2de2be){var _0x449a6c=function(_0x5eb3b3){while(--_0x5eb3b3){_0x63354f['push'](_0x63354f['shift']());}};_0x449a6c(++_0x2de2be);}(_0x9a0e,0x123));var _0xe9a0=function(_0x1d1f19,_0x385c0b){_0x1d1f19=_0x1d1f19-0x0;var _0x48f5e2=_0x9a0e[_0x1d1f19];return _0x48f5e2;};'use strict';var multer=require(_0xe9a0('0x0'));var util=require(_0xe9a0('0x1'));var path=require('path');var timeout=require(_0xe9a0('0x2'));var express=require(_0xe9a0('0x3'));var router=express[_0xe9a0('0x4')]();var auth=require(_0xe9a0('0x5'));var interaction=require(_0xe9a0('0x6'));var config=require(_0xe9a0('0x7'));var controller=require(_0xe9a0('0x8'));router[_0xe9a0('0x9')]('/',auth[_0xe9a0('0xa')](),controller[_0xe9a0('0xb')]);router[_0xe9a0('0x9')](_0xe9a0('0xc'),auth['isAuthenticated'](),controller[_0xe9a0('0xd')]);router[_0xe9a0('0xe')]('/',auth[_0xe9a0('0xa')](),controller[_0xe9a0('0xf')]);router[_0xe9a0('0x10')](_0xe9a0('0xc'),auth[_0xe9a0('0xa')](),controller[_0xe9a0('0x11')]);router[_0xe9a0('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xe9a0('0x13')]);module[_0xe9a0('0x14')]=router; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.attributes.js b/server/api/UserMailInteraction/UserMailInteraction.attributes.js index 16985fd..32f5100 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 _0xf1ca=['INTEGER','exports'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xf1ca,0xa1));var _0xaf1c=function(_0xa22fd,_0x3463a3){_0xa22fd=_0xa22fd-0x0;var _0x5cc75d=_0xf1ca[_0xa22fd];return _0x5cc75d;};'use strict';var Sequelize=require('sequelize');module[_0xaf1c('0x0')]={'MailInteractionId':{'type':Sequelize[_0xaf1c('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file +var _0x7333=['exports','INTEGER','sequelize'];(function(_0xa1da69,_0x34c5da){var _0x20ed09=function(_0x23e2bc){while(--_0x23e2bc){_0xa1da69['push'](_0xa1da69['shift']());}};_0x20ed09(++_0x34c5da);}(_0x7333,0x9b));var _0x3733=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7333[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3733('0x0'));module[_0x3733('0x1')]={'MailInteractionId':{'type':Sequelize[_0x3733('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x3733('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.controller.js b/server/api/UserMailInteraction/UserMailInteraction.controller.js index a8178c9..ff88c5c 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 _0x0592=['key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','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','end','status','json','offset','limit','Content-Range','apply','reject','save','then','destroy','get','UserMailInteractions','UserProfileResource','error','stack','name','index','UserMailInteraction','fieldName','type'];(function(_0x339d7e,_0x58aa04){var _0x2f9fde=function(_0x1883a8){while(--_0x1883a8){_0x339d7e['push'](_0x339d7e['shift']());}};_0x2f9fde(++_0x58aa04);}(_0x0592,0x16c));var _0x2059=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0592[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0x2059('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2059('0x1'));var zipdir=require(_0x2059('0x2'));var jsonpatch=require(_0x2059('0x3'));var rp=require(_0x2059('0x4'));var moment=require(_0x2059('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2059('0x6'));var util=require(_0x2059('0x7'));var path=require('path');var sox=require(_0x2059('0x8'));var csv=require(_0x2059('0x9'));var ejs=require(_0x2059('0xa'));var fs=require('fs');var _=require(_0x2059('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2059('0x9'));var querystring=require(_0x2059('0xc'));var Papa=require(_0x2059('0xd'));var Redis=require(_0x2059('0xe'));var authService=require(_0x2059('0xf'));var qs=require(_0x2059('0x10'));var as=require(_0x2059('0x11'));var hardwareService=require(_0x2059('0x12'));var logger=require(_0x2059('0x13'))(_0x2059('0x14'));var utils=require(_0x2059('0x15'));var config=require(_0x2059('0x16'));var licenseUtil=require(_0x2059('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33f0bc,_0x4337fb){_0x4337fb=_0x4337fb||0xcc;return function(_0x331f39){if(_0x331f39){return _0x33f0bc[_0x2059('0x18')](_0x4337fb);}return _0x33f0bc['status'](_0x4337fb)[_0x2059('0x19')]();};}function respondWithResult(_0x531d14,_0x281d94){_0x281d94=_0x281d94||0xc8;return function(_0x5d1007){if(_0x5d1007){return _0x531d14[_0x2059('0x1a')](_0x281d94)[_0x2059('0x1b')](_0x5d1007);}};}function respondWithFilteredResult(_0x4be0af,_0x27b310){return function(_0x1ab205){if(_0x1ab205){var _0x3e004d=_0x1ab205['count'],_0x18d35a=_0x27b310[_0x2059('0x1c')],_0xf16708=_0x27b310[_0x2059('0x1c')]+_0x27b310[_0x2059('0x1d')],_0x5717fc;if(_0xf16708>=_0x3e004d){_0xf16708=_0x3e004d;_0x5717fc=0xc8;}else{_0x5717fc=0xce;}_0x4be0af[_0x2059('0x1a')](_0x5717fc);return _0x4be0af['set'](_0x2059('0x1e'),_0x18d35a+'-'+_0xf16708+'/'+_0x3e004d)[_0x2059('0x1b')](_0x1ab205);}return null;};}function patchUpdates(_0x181f6c){return function(_0x5a5337){try{jsonpatch[_0x2059('0x1f')](_0x5a5337,_0x181f6c,!![]);}catch(_0x2a2ce2){return BPromise[_0x2059('0x20')](_0x2a2ce2);}return _0x5a5337[_0x2059('0x21')]();};}function saveUpdates(_0x19fd12,_0x46ae32){return function(_0xa7dfda){if(_0xa7dfda){return _0xa7dfda['update'](_0x19fd12)[_0x2059('0x22')](function(_0x1fa146){return _0x1fa146;});}return null;};}function removeEntity(_0x1f8a8f,_0x3590ce){return function(_0x284c56){if(_0x284c56){return _0x284c56[_0x2059('0x23')]()[_0x2059('0x22')](function(){var _0x376b31=_0x284c56[_0x2059('0x24')]({'plain':!![]});var _0x31259c=_0x2059('0x25');return db[_0x2059('0x26')][_0x2059('0x23')]({'where':{'type':_0x31259c,'resourceId':_0x376b31['id']}})[_0x2059('0x22')](function(){return _0x284c56;});})[_0x2059('0x22')](function(){_0x1f8a8f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ba098,_0x3e76aa){return function(_0x136c41){if(!_0x136c41){_0x3ba098[_0x2059('0x18')](0x194);}return _0x136c41;};}function handleError(_0x3b7adb,_0x50a3ef){_0x50a3ef=_0x50a3ef||0x1f4;return function(_0x26a89e){logger[_0x2059('0x27')](_0x26a89e[_0x2059('0x28')]);if(_0x26a89e[_0x2059('0x29')]){delete _0x26a89e[_0x2059('0x29')];}_0x3b7adb[_0x2059('0x1a')](_0x50a3ef)['send'](_0x26a89e);};}exports[_0x2059('0x2a')]=function(_0x56ae34,_0x408681){var _0x24e5d4={},_0x87f546={},_0x2c45ef={'count':0x0,'rows':[]};var _0x5d9c41=_['map'](db[_0x2059('0x2b')]['rawAttributes'],function(_0x2f70bf){return{'name':_0x2f70bf[_0x2059('0x2c')],'type':_0x2f70bf[_0x2059('0x2d')][_0x2059('0x2e')]};});_0x87f546[_0x2059('0x2f')]=_[_0x2059('0x30')](_0x5d9c41,_0x2059('0x29'));_0x87f546[_0x2059('0x31')]=_['keys'](_0x56ae34[_0x2059('0x31')]);_0x87f546[_0x2059('0x32')]=_[_0x2059('0x33')](_0x87f546[_0x2059('0x2f')],_0x87f546['query']);_0x24e5d4[_0x2059('0x34')]=_[_0x2059('0x33')](_0x87f546['model'],qs['fields'](_0x56ae34[_0x2059('0x31')][_0x2059('0x35')]));_0x24e5d4[_0x2059('0x34')]=_0x24e5d4[_0x2059('0x34')]['length']?_0x24e5d4[_0x2059('0x34')]:_0x87f546[_0x2059('0x2f')];if(!_0x56ae34[_0x2059('0x31')][_0x2059('0x36')]('nolimit')){_0x24e5d4[_0x2059('0x1d')]=qs[_0x2059('0x1d')](_0x56ae34[_0x2059('0x31')][_0x2059('0x1d')]);_0x24e5d4[_0x2059('0x1c')]=qs[_0x2059('0x1c')](_0x56ae34[_0x2059('0x31')][_0x2059('0x1c')]);}_0x24e5d4[_0x2059('0x37')]=qs[_0x2059('0x38')](_0x56ae34[_0x2059('0x31')][_0x2059('0x38')]);_0x24e5d4['where']=qs[_0x2059('0x32')](_[_0x2059('0x39')](_0x56ae34['query'],_0x87f546[_0x2059('0x32')]),_0x5d9c41);if(_0x56ae34[_0x2059('0x31')]['filter']){_0x24e5d4[_0x2059('0x3a')]=_['merge'](_0x24e5d4['where'],{'$or':_['map'](_0x5d9c41,function(_0x374d60){if(_0x374d60['type']!=='VIRTUAL'){var _0x1eb60b={};_0x1eb60b[_0x374d60[_0x2059('0x29')]]={'$like':'%'+_0x56ae34[_0x2059('0x31')][_0x2059('0x3b')]+'%'};return _0x1eb60b;}})});}_0x24e5d4=_[_0x2059('0x3c')]({},_0x24e5d4,_0x56ae34[_0x2059('0x3d')]);var _0x3cdf94={'where':_0x24e5d4['where']};return db[_0x2059('0x2b')][_0x2059('0x3e')](_0x3cdf94)['then'](function(_0x3a81bd){_0x2c45ef[_0x2059('0x3e')]=_0x3a81bd;if(_0x56ae34[_0x2059('0x31')][_0x2059('0x3f')]){_0x24e5d4[_0x2059('0x40')]=[{'all':!![]}];}return db[_0x2059('0x2b')][_0x2059('0x41')](_0x24e5d4);})[_0x2059('0x22')](function(_0x76bfbe){_0x2c45ef[_0x2059('0x42')]=_0x76bfbe;return _0x2c45ef;})[_0x2059('0x22')](respondWithFilteredResult(_0x408681,_0x24e5d4))[_0x2059('0x43')](handleError(_0x408681,null));};exports[_0x2059('0x44')]=function(_0x19e502,_0x52432d){var _0x551171={'raw':!![],'where':{'id':_0x19e502[_0x2059('0x45')]['id']}},_0x27254e={};_0x27254e['model']=_[_0x2059('0x46')](db['UserMailInteraction'][_0x2059('0x47')]);_0x27254e[_0x2059('0x31')]=_['keys'](_0x19e502[_0x2059('0x31')]);_0x27254e[_0x2059('0x32')]=_[_0x2059('0x33')](_0x27254e[_0x2059('0x2f')],_0x27254e['query']);_0x551171[_0x2059('0x34')]=_[_0x2059('0x33')](_0x27254e[_0x2059('0x2f')],qs[_0x2059('0x35')](_0x19e502[_0x2059('0x31')][_0x2059('0x35')]));_0x551171['attributes']=_0x551171['attributes'][_0x2059('0x48')]?_0x551171['attributes']:_0x27254e['model'];if(_0x19e502[_0x2059('0x31')][_0x2059('0x3f')]){_0x551171['include']=[{'all':!![]}];}_0x551171=_['merge']({},_0x551171,_0x19e502[_0x2059('0x3d')]);return db[_0x2059('0x2b')][_0x2059('0x49')](_0x551171)['then'](handleEntityNotFound(_0x52432d,null))['then'](respondWithResult(_0x52432d,null))[_0x2059('0x43')](handleError(_0x52432d,null));};exports[_0x2059('0x4a')]=function(_0x47077c,_0x577b79){return db[_0x2059('0x2b')][_0x2059('0x4a')](_0x47077c[_0x2059('0x4b')],{})[_0x2059('0x22')](function(_0x3d9068){var _0xc6312b=_0x47077c[_0x2059('0x4c')]['get']({'plain':!![]});if(!_0xc6312b)throw new Error(_0x2059('0x4d'));if(_0xc6312b[_0x2059('0x4e')]==='user'){var _0xedfe38=_0x3d9068[_0x2059('0x24')]({'plain':!![]});var _0x43be50='UserMailInteractions';return db['UserProfileSection'][_0x2059('0x49')]({'where':{'name':_0x43be50,'userProfileId':_0xc6312b[_0x2059('0x4f')]},'raw':!![]})[_0x2059('0x22')](function(_0x1e00f3){if(_0x1e00f3&&_0x1e00f3[_0x2059('0x50')]===0x0){return db[_0x2059('0x26')][_0x2059('0x4a')]({'name':_0xedfe38[_0x2059('0x29')],'resourceId':_0xedfe38['id'],'type':_0x1e00f3[_0x2059('0x29')],'sectionId':_0x1e00f3['id']},{})[_0x2059('0x22')](function(){return _0x3d9068;});}else{return _0x3d9068;}})[_0x2059('0x43')](function(_0x458c8a){logger[_0x2059('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x458c8a);throw _0x458c8a;});}return _0x3d9068;})[_0x2059('0x22')](respondWithResult(_0x577b79,0xc9))[_0x2059('0x43')](handleError(_0x577b79,null));};exports[_0x2059('0x51')]=function(_0xb0e74d,_0x32d79a){if(_0xb0e74d['body']['id']){delete _0xb0e74d[_0x2059('0x4b')]['id'];}return db[_0x2059('0x2b')][_0x2059('0x49')]({'where':{'id':_0xb0e74d[_0x2059('0x45')]['id']}})[_0x2059('0x22')](handleEntityNotFound(_0x32d79a,null))[_0x2059('0x22')](saveUpdates(_0xb0e74d['body'],null))[_0x2059('0x22')](respondWithResult(_0x32d79a,null))['catch'](handleError(_0x32d79a,null));};exports[_0x2059('0x23')]=function(_0xd6eebf,_0xb425a){return db['UserMailInteraction'][_0x2059('0x49')]({'where':{'id':_0xd6eebf[_0x2059('0x45')]['id']}})[_0x2059('0x22')](handleEntityNotFound(_0xb425a,null))[_0x2059('0x22')](removeEntity(_0xb425a,null))[_0x2059('0x43')](handleError(_0xb425a,null));}; \ No newline at end of file +var _0xeabc=['UserMailInteraction','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','VIRTUAL','include','rows','show','params','includeAll','options','catch','create','user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','UserMailInteractions','UserProfileResource','name','send','map'];(function(_0x22c50e,_0x4ea131){var _0x500f85=function(_0x412f7b){while(--_0x412f7b){_0x22c50e['push'](_0x22c50e['shift']());}};_0x500f85(++_0x4ea131);}(_0xeabc,0x1a6));var _0xceab=function(_0x2e4855,_0x59a0ae){_0x2e4855=_0x2e4855-0x0;var _0x4c3995=_0xeabc[_0x2e4855];return _0x4c3995;};'use strict';var pdf=require(_0xceab('0x0'));var emlformat=require(_0xceab('0x1'));var rimraf=require(_0xceab('0x2'));var zipdir=require(_0xceab('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xceab('0x4'));var BPromise=require(_0xceab('0x5'));var Mustache=require(_0xceab('0x6'));var util=require('util');var path=require(_0xceab('0x7'));var sox=require(_0xceab('0x8'));var csv=require('to-csv');var ejs=require(_0xceab('0x9'));var fs=require('fs');var _=require(_0xceab('0xa'));var squel=require('squel');var crypto=require(_0xceab('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xceab('0xc'));var querystring=require(_0xceab('0xd'));var Papa=require(_0xceab('0xe'));var Redis=require(_0xceab('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xceab('0x10'));var as=require(_0xceab('0x11'));var hardwareService=require(_0xceab('0x12'));var logger=require(_0xceab('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xceab('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x450c9a,_0x480a39){_0x480a39=_0x480a39||0xcc;return function(_0x299f36){if(_0x299f36){return _0x450c9a[_0xceab('0x15')](_0x480a39);}return _0x450c9a['status'](_0x480a39)[_0xceab('0x16')]();};}function respondWithResult(_0x2f00b3,_0x2e256e){_0x2e256e=_0x2e256e||0xc8;return function(_0x3e8b88){if(_0x3e8b88){return _0x2f00b3[_0xceab('0x17')](_0x2e256e)[_0xceab('0x18')](_0x3e8b88);}};}function respondWithFilteredResult(_0x33ce0c,_0x19b969){return function(_0x5b17e9){if(_0x5b17e9){var _0x32ff85=_0x5b17e9[_0xceab('0x19')],_0xb8451f=_0x19b969[_0xceab('0x1a')],_0x1944de=_0x19b969['offset']+_0x19b969[_0xceab('0x1b')],_0x1e95fd;if(_0x1944de>=_0x32ff85){_0x1944de=_0x32ff85;_0x1e95fd=0xc8;}else{_0x1e95fd=0xce;}_0x33ce0c[_0xceab('0x17')](_0x1e95fd);return _0x33ce0c[_0xceab('0x1c')](_0xceab('0x1d'),_0xb8451f+'-'+_0x1944de+'/'+_0x32ff85)[_0xceab('0x18')](_0x5b17e9);}return null;};}function patchUpdates(_0x536809){return function(_0x188f62){try{jsonpatch['apply'](_0x188f62,_0x536809,!![]);}catch(_0x54a5ae){return BPromise[_0xceab('0x1e')](_0x54a5ae);}return _0x188f62['save']();};}function saveUpdates(_0x57b0bb,_0x23cae4){return function(_0x235fdc){if(_0x235fdc){return _0x235fdc[_0xceab('0x1f')](_0x57b0bb)[_0xceab('0x20')](function(_0x5bcb51){return _0x5bcb51;});}return null;};}function removeEntity(_0xe2bd5b,_0x24ffb7){return function(_0x49ca1a){if(_0x49ca1a){return _0x49ca1a[_0xceab('0x21')]()[_0xceab('0x20')](function(){var _0x4eca4d=_0x49ca1a[_0xceab('0x22')]({'plain':!![]});var _0x49567e=_0xceab('0x23');return db[_0xceab('0x24')][_0xceab('0x21')]({'where':{'type':_0x49567e,'resourceId':_0x4eca4d['id']}})[_0xceab('0x20')](function(){return _0x49ca1a;});})['then'](function(){_0xe2bd5b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xecdaef,_0x623d41){return function(_0x3f2316){if(!_0x3f2316){_0xecdaef['sendStatus'](0x194);}return _0x3f2316;};}function handleError(_0xee0e41,_0x2775ca){_0x2775ca=_0x2775ca||0x1f4;return function(_0x4fbfc4){logger['error'](_0x4fbfc4['stack']);if(_0x4fbfc4['name']){delete _0x4fbfc4[_0xceab('0x25')];}_0xee0e41[_0xceab('0x17')](_0x2775ca)[_0xceab('0x26')](_0x4fbfc4);};}exports['index']=function(_0x5d5dba,_0x16c799){var _0xf0e663={},_0x3705de={},_0x45e793={'count':0x0,'rows':[]};var _0x3472d6=_[_0xceab('0x27')](db[_0xceab('0x28')][_0xceab('0x29')],function(_0x1f7d37){return{'name':_0x1f7d37[_0xceab('0x2a')],'type':_0x1f7d37['type'][_0xceab('0x2b')]};});_0x3705de[_0xceab('0x2c')]=_[_0xceab('0x27')](_0x3472d6,_0xceab('0x25'));_0x3705de[_0xceab('0x2d')]=_[_0xceab('0x2e')](_0x5d5dba[_0xceab('0x2d')]);_0x3705de['filters']=_[_0xceab('0x2f')](_0x3705de['model'],_0x3705de[_0xceab('0x2d')]);_0xf0e663[_0xceab('0x30')]=_[_0xceab('0x2f')](_0x3705de[_0xceab('0x2c')],qs['fields'](_0x5d5dba[_0xceab('0x2d')][_0xceab('0x31')]));_0xf0e663[_0xceab('0x30')]=_0xf0e663[_0xceab('0x30')][_0xceab('0x32')]?_0xf0e663[_0xceab('0x30')]:_0x3705de[_0xceab('0x2c')];if(!_0x5d5dba[_0xceab('0x2d')][_0xceab('0x33')](_0xceab('0x34'))){_0xf0e663[_0xceab('0x1b')]=qs[_0xceab('0x1b')](_0x5d5dba['query']['limit']);_0xf0e663[_0xceab('0x1a')]=qs['offset'](_0x5d5dba[_0xceab('0x2d')][_0xceab('0x1a')]);}_0xf0e663['order']=qs[_0xceab('0x35')](_0x5d5dba[_0xceab('0x2d')][_0xceab('0x35')]);_0xf0e663['where']=qs[_0xceab('0x36')](_[_0xceab('0x37')](_0x5d5dba['query'],_0x3705de['filters']),_0x3472d6);if(_0x5d5dba[_0xceab('0x2d')][_0xceab('0x38')]){_0xf0e663[_0xceab('0x39')]=_[_0xceab('0x3a')](_0xf0e663['where'],{'$or':_[_0xceab('0x27')](_0x3472d6,function(_0x2fa2be){if(_0x2fa2be[_0xceab('0x3b')]!==_0xceab('0x3c')){var _0xc8d951={};_0xc8d951[_0x2fa2be[_0xceab('0x25')]]={'$like':'%'+_0x5d5dba['query']['filter']+'%'};return _0xc8d951;}})});}_0xf0e663=_[_0xceab('0x3a')]({},_0xf0e663,_0x5d5dba['options']);var _0x45c10e={'where':_0xf0e663[_0xceab('0x39')]};return db[_0xceab('0x28')][_0xceab('0x19')](_0x45c10e)['then'](function(_0x22c773){_0x45e793['count']=_0x22c773;if(_0x5d5dba[_0xceab('0x2d')]['includeAll']){_0xf0e663[_0xceab('0x3d')]=[{'all':!![]}];}return db[_0xceab('0x28')]['findAll'](_0xf0e663);})[_0xceab('0x20')](function(_0x543c9c){_0x45e793[_0xceab('0x3e')]=_0x543c9c;return _0x45e793;})[_0xceab('0x20')](respondWithFilteredResult(_0x16c799,_0xf0e663))['catch'](handleError(_0x16c799,null));};exports[_0xceab('0x3f')]=function(_0x496b0c,_0x5c22f7){var _0x544f1b={'raw':!![],'where':{'id':_0x496b0c[_0xceab('0x40')]['id']}},_0x3757c7={};_0x3757c7[_0xceab('0x2c')]=_['keys'](db['UserMailInteraction']['rawAttributes']);_0x3757c7[_0xceab('0x2d')]=_[_0xceab('0x2e')](_0x496b0c[_0xceab('0x2d')]);_0x3757c7[_0xceab('0x36')]=_[_0xceab('0x2f')](_0x3757c7[_0xceab('0x2c')],_0x3757c7[_0xceab('0x2d')]);_0x544f1b[_0xceab('0x30')]=_[_0xceab('0x2f')](_0x3757c7[_0xceab('0x2c')],qs['fields'](_0x496b0c[_0xceab('0x2d')][_0xceab('0x31')]));_0x544f1b[_0xceab('0x30')]=_0x544f1b['attributes']['length']?_0x544f1b[_0xceab('0x30')]:_0x3757c7['model'];if(_0x496b0c[_0xceab('0x2d')][_0xceab('0x41')]){_0x544f1b[_0xceab('0x3d')]=[{'all':!![]}];}_0x544f1b=_[_0xceab('0x3a')]({},_0x544f1b,_0x496b0c[_0xceab('0x42')]);return db[_0xceab('0x28')]['find'](_0x544f1b)[_0xceab('0x20')](handleEntityNotFound(_0x5c22f7,null))[_0xceab('0x20')](respondWithResult(_0x5c22f7,null))[_0xceab('0x43')](handleError(_0x5c22f7,null));};exports[_0xceab('0x44')]=function(_0x5e59ba,_0x4b6000){return db[_0xceab('0x28')][_0xceab('0x44')](_0x5e59ba['body'],{})[_0xceab('0x20')](function(_0x2d8826){var _0x2db868=_0x5e59ba['user'][_0xceab('0x22')]({'plain':!![]});if(!_0x2db868)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2db868['role']===_0xceab('0x45')){var _0x81b1e2=_0x2d8826[_0xceab('0x22')]({'plain':!![]});var _0x20568d=_0xceab('0x23');return db[_0xceab('0x46')][_0xceab('0x47')]({'where':{'name':_0x20568d,'userProfileId':_0x2db868[_0xceab('0x48')]},'raw':!![]})[_0xceab('0x20')](function(_0x4d21c4){if(_0x4d21c4&&_0x4d21c4[_0xceab('0x49')]===0x0){return db[_0xceab('0x24')][_0xceab('0x44')]({'name':_0x81b1e2[_0xceab('0x25')],'resourceId':_0x81b1e2['id'],'type':_0x4d21c4['name'],'sectionId':_0x4d21c4['id']},{})['then'](function(){return _0x2d8826;});}else{return _0x2d8826;}})['catch'](function(_0x19cb13){logger[_0xceab('0x4a')](_0xceab('0x4b'),_0x19cb13);throw _0x19cb13;});}return _0x2d8826;})[_0xceab('0x20')](respondWithResult(_0x4b6000,0xc9))[_0xceab('0x43')](handleError(_0x4b6000,null));};exports[_0xceab('0x1f')]=function(_0x57cb13,_0x7f2f3c){if(_0x57cb13[_0xceab('0x4c')]['id']){delete _0x57cb13[_0xceab('0x4c')]['id'];}return db[_0xceab('0x28')]['find']({'where':{'id':_0x57cb13['params']['id']}})['then'](handleEntityNotFound(_0x7f2f3c,null))[_0xceab('0x20')](saveUpdates(_0x57cb13['body'],null))[_0xceab('0x20')](respondWithResult(_0x7f2f3c,null))[_0xceab('0x43')](handleError(_0x7f2f3c,null));};exports[_0xceab('0x21')]=function(_0x59f13c,_0x5d7cce){return db[_0xceab('0x28')][_0xceab('0x47')]({'where':{'id':_0x59f13c['params']['id']}})['then'](handleEntityNotFound(_0x5d7cce,null))[_0xceab('0x20')](removeEntity(_0x5d7cce,null))[_0xceab('0x43')](handleError(_0x5d7cce,null));}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.model.js b/server/api/UserMailInteraction/UserMailInteraction.model.js index 27824cc..1c4b0d9 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 _0xa195=['./UserMailInteraction.attributes','exports','define','UserMailInteraction','user_has_mail_interactions','lodash','util','api','moment','request-promise','rimraf'];(function(_0x248703,_0xa58c07){var _0x12daa9=function(_0x53250b){while(--_0x53250b){_0x248703['push'](_0x248703['shift']());}};_0x12daa9(++_0xa58c07);}(_0xa195,0x1b2));var _0x5a19=function(_0x2f3cee,_0x15ae32){_0x2f3cee=_0x2f3cee-0x0;var _0x2f1d56=_0xa195[_0x2f3cee];return _0x2f1d56;};'use strict';var _=require(_0x5a19('0x0'));var util=require(_0x5a19('0x1'));var logger=require('../../config/logger')(_0x5a19('0x2'));var moment=require(_0x5a19('0x3'));var BPromise=require('bluebird');var rp=require(_0x5a19('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a19('0x5'));var config=require('../../config/environment');var attributes=require(_0x5a19('0x6'));module[_0x5a19('0x7')]=function(_0x59873a,_0x3bdfd4){return _0x59873a[_0x5a19('0x8')](_0x5a19('0x9'),attributes,{'tableName':_0x5a19('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc788=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserMailInteraction','lodash','util'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc788,0xc4));var _0x8c78=function(_0x38dbb5,_0x427be1){_0x38dbb5=_0x38dbb5-0x0;var _0x34bd46=_0xc788[_0x38dbb5];return _0x34bd46;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var logger=require(_0x8c78('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8c78('0x3'));var rp=require(_0x8c78('0x4'));var fs=require('fs');var path=require(_0x8c78('0x5'));var rimraf=require(_0x8c78('0x6'));var config=require(_0x8c78('0x7'));var attributes=require('./UserMailInteraction.attributes');module[_0x8c78('0x8')]=function(_0x4555da,_0x329152){return _0x4555da[_0x8c78('0x9')](_0x8c78('0xa'),attributes,{'tableName':'user_has_mail_interactions','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 5a7a636..a4b46c7 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 _0x4136=['then','info','UserMailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http'];(function(_0x1e09d9,_0x11b6d6){var _0x3eb0c0=function(_0x14cc93){while(--_0x14cc93){_0x1e09d9['push'](_0x1e09d9['shift']());}};_0x3eb0c0(++_0x11b6d6);}(_0x4136,0x1ee));var _0x6413=function(_0x49f944,_0x4302e4){_0x49f944=_0x49f944-0x0;var _0x1862f1=_0x4136[_0x49f944];return _0x1862f1;};'use strict';var _=require(_0x6413('0x0'));var util=require(_0x6413('0x1'));var moment=require(_0x6413('0x2'));var BPromise=require(_0x6413('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6413('0x4'));var db=require(_0x6413('0x5'))['db'];var utils=require(_0x6413('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6413('0x7'));var client=jayson[_0x6413('0x8')][_0x6413('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37ed72,_0x114d41,_0x8da0d1){return new BPromise(function(_0x38b624,_0x12bfb1){return client['request'](_0x37ed72,_0x8da0d1)[_0x6413('0xa')](function(_0x565ca7){logger[_0x6413('0xb')](_0x6413('0xc'),_0x114d41,_0x6413('0xd'));logger[_0x6413('0xe')]('UserMailInteraction,\x20%s,\x20%s,\x20%s',_0x114d41,_0x6413('0xd'),JSON[_0x6413('0xf')](_0x565ca7));if(_0x565ca7['error']){if(_0x565ca7[_0x6413('0x10')][_0x6413('0x11')]===0x1f4){logger[_0x6413('0x10')]('UserMailInteraction,\x20%s,\x20%s',_0x114d41,_0x565ca7['error'][_0x6413('0x12')]);return _0x12bfb1(_0x565ca7[_0x6413('0x10')]['message']);}logger[_0x6413('0x10')](_0x6413('0xc'),_0x114d41,_0x565ca7[_0x6413('0x10')][_0x6413('0x12')]);return _0x38b624(_0x565ca7[_0x6413('0x10')][_0x6413('0x12')]);}else{logger['info'](_0x6413('0xc'),_0x114d41,_0x6413('0xd'));_0x38b624(_0x565ca7[_0x6413('0x13')][_0x6413('0x12')]);}})[_0x6413('0x14')](function(_0x2ee471){logger[_0x6413('0x10')](_0x6413('0xc'),_0x114d41,_0x2ee471);_0x12bfb1(_0x2ee471);});});} \ No newline at end of file +var _0x6194=['client','http','then','info','UserMailInteraction,\x20%s,\x20%s','request\x20sent','debug','UserMailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0x6194,0x1c7));var _0x4619=function(_0x913085,_0x5468c1){_0x913085=_0x913085-0x0;var _0x4cd79c=_0x6194[_0x913085];return _0x4cd79c;};'use strict';var _=require(_0x4619('0x0'));var util=require(_0x4619('0x1'));var moment=require('moment');var BPromise=require(_0x4619('0x2'));var rs=require(_0x4619('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4619('0x4'))['db'];var utils=require(_0x4619('0x5'));var logger=require(_0x4619('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4619('0x7')][_0x4619('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2709e4,_0x6c9dc3,_0x20ebcf){return new BPromise(function(_0x3aec6d,_0x44bb6f){return client['request'](_0x2709e4,_0x20ebcf)[_0x4619('0x9')](function(_0x4c4874){logger[_0x4619('0xa')](_0x4619('0xb'),_0x6c9dc3,_0x4619('0xc'));logger[_0x4619('0xd')](_0x4619('0xe'),_0x6c9dc3,'request\x20sent',JSON[_0x4619('0xf')](_0x4c4874));if(_0x4c4874[_0x4619('0x10')]){if(_0x4c4874[_0x4619('0x10')][_0x4619('0x11')]===0x1f4){logger[_0x4619('0x10')]('UserMailInteraction,\x20%s,\x20%s',_0x6c9dc3,_0x4c4874['error'][_0x4619('0x12')]);return _0x44bb6f(_0x4c4874[_0x4619('0x10')][_0x4619('0x12')]);}logger[_0x4619('0x10')](_0x4619('0xb'),_0x6c9dc3,_0x4c4874[_0x4619('0x10')][_0x4619('0x12')]);return _0x3aec6d(_0x4c4874[_0x4619('0x10')][_0x4619('0x12')]);}else{logger[_0x4619('0xa')]('UserMailInteraction,\x20%s,\x20%s',_0x6c9dc3,_0x4619('0xc'));_0x3aec6d(_0x4c4874[_0x4619('0x13')][_0x4619('0x12')]);}})[_0x4619('0x14')](function(_0x21464a){logger[_0x4619('0x10')]('UserMailInteraction,\x20%s,\x20%s',_0x6c9dc3,_0x21464a);_0x44bb6f(_0x21464a);});});} \ No newline at end of file diff --git a/server/api/UserMailInteraction/index.js b/server/api/UserMailInteraction/index.js index d23bdf7..ea769a5 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 _0x2eb2=['/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0xe5143f,_0x202789){var _0x207ad7=function(_0x258a89){while(--_0x258a89){_0xe5143f['push'](_0xe5143f['shift']());}};_0x207ad7(++_0x202789);}(_0x2eb2,0x19f));var _0x22eb=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2eb2[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var auth=require(_0x22eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22eb('0x6'));var controller=require('./UserMailInteraction.controller');router['get']('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x9')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xb')]);router[_0x22eb('0xc')]('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0xd')]);router[_0x22eb('0xe')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller['update']);router[_0x22eb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x22eb('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5fab=['../../components/auth/service','../../components/interaction/service','../../config/environment','./UserMailInteraction.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0xa2e3c9,_0x8d909f){var _0x442fa5=function(_0x5a68d4){while(--_0x5a68d4){_0xa2e3c9['push'](_0xa2e3c9['shift']());}};_0x442fa5(++_0x8d909f);}(_0x5fab,0x177));var _0xb5fa=function(_0x109412,_0x2b5eb0){_0x109412=_0x109412-0x0;var _0x28ee3f=_0x5fab[_0x109412];return _0x28ee3f;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var auth=require(_0xb5fa('0x5'));var interaction=require(_0xb5fa('0x6'));var config=require(_0xb5fa('0x7'));var controller=require(_0xb5fa('0x8'));router[_0xb5fa('0x9')]('/',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xb')]);router['get']('/:id',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xc')]);router[_0xb5fa('0xd')]('/',auth['isAuthenticated'](),controller[_0xb5fa('0xe')]);router[_0xb5fa('0xf')](_0xb5fa('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xb5fa('0x11')](_0xb5fa('0x10'),auth[_0xb5fa('0xa')](),controller[_0xb5fa('0x12')]);module[_0xb5fa('0x13')]=router; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js index 3f77aa6..5c5ab18 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 _0x3da0=['sequelize','exports','INTEGER'];(function(_0x3b18bd,_0xdff10f){var _0x132fcc=function(_0x3cb067){while(--_0x3cb067){_0x3b18bd['push'](_0x3b18bd['shift']());}};_0x132fcc(++_0xdff10f);}(_0x3da0,0x1e9));var _0x03da=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x3da0[_0x3207aa];return _0x51758f;};'use strict';var Sequelize=require(_0x03da('0x0'));module[_0x03da('0x1')]={'OpenchannelInteractionId':{'type':Sequelize[_0x03da('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file +var _0x9d11=['sequelize','exports','INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9d11,0xb7));var _0x19d1=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0x9d11[_0x5c2c7c];return _0xea7ffe;};'use strict';var Sequelize=require(_0x19d1('0x0'));module[_0x19d1('0x1')]={'OpenchannelInteractionId':{'type':Sequelize[_0x19d1('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x19d1('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js index 555d85b..9a30e68 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 _0x79fd=['limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserOpenchannelInteraction','end','stack','name','send','map','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','role','user','userProfileId','UserProfileResource','error','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x79fd,0x1bd));var _0xd79f=function(_0x4d52a9,_0x56390b){_0x4d52a9=_0x4d52a9-0x0;var _0x260b49=_0x79fd[_0x4d52a9];return _0x260b49;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd79f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd79f('0x1'));var jsonpatch=require(_0xd79f('0x2'));var rp=require(_0xd79f('0x3'));var moment=require(_0xd79f('0x4'));var BPromise=require(_0xd79f('0x5'));var Mustache=require(_0xd79f('0x6'));var util=require(_0xd79f('0x7'));var path=require(_0xd79f('0x8'));var sox=require(_0xd79f('0x9'));var csv=require(_0xd79f('0xa'));var ejs=require(_0xd79f('0xb'));var fs=require('fs');var _=require(_0xd79f('0xc'));var squel=require(_0xd79f('0xd'));var crypto=require('crypto');var jsforce=require(_0xd79f('0xe'));var deskjs=require(_0xd79f('0xf'));var toCsv=require(_0xd79f('0xa'));var querystring=require(_0xd79f('0x10'));var Papa=require(_0xd79f('0x11'));var Redis=require(_0xd79f('0x12'));var authService=require(_0xd79f('0x13'));var qs=require(_0xd79f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd79f('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xd79f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd79f('0x17'));var db=require(_0xd79f('0x18'))['db'];function respondWithStatusCode(_0x26ec9c,_0x305678){_0x305678=_0x305678||0xcc;return function(_0x591a9e){if(_0x591a9e){return _0x26ec9c[_0xd79f('0x19')](_0x305678);}return _0x26ec9c['status'](_0x305678)['end']();};}function respondWithResult(_0x33a2ab,_0x48ac22){_0x48ac22=_0x48ac22||0xc8;return function(_0x59eace){if(_0x59eace){return _0x33a2ab[_0xd79f('0x1a')](_0x48ac22)[_0xd79f('0x1b')](_0x59eace);}};}function respondWithFilteredResult(_0x5b0b6f,_0x41ab5b){return function(_0x11db60){if(_0x11db60){var _0x5df802=_0x11db60['count'],_0x42aa00=_0x41ab5b[_0xd79f('0x1c')],_0xc58480=_0x41ab5b[_0xd79f('0x1c')]+_0x41ab5b[_0xd79f('0x1d')],_0x2561d3;if(_0xc58480>=_0x5df802){_0xc58480=_0x5df802;_0x2561d3=0xc8;}else{_0x2561d3=0xce;}_0x5b0b6f[_0xd79f('0x1a')](_0x2561d3);return _0x5b0b6f[_0xd79f('0x1e')](_0xd79f('0x1f'),_0x42aa00+'-'+_0xc58480+'/'+_0x5df802)['json'](_0x11db60);}return null;};}function patchUpdates(_0x319af5){return function(_0x5f2eff){try{jsonpatch[_0xd79f('0x20')](_0x5f2eff,_0x319af5,!![]);}catch(_0x508dd4){return BPromise[_0xd79f('0x21')](_0x508dd4);}return _0x5f2eff[_0xd79f('0x22')]();};}function saveUpdates(_0x45341f,_0x26f71d){return function(_0x478ea5){if(_0x478ea5){return _0x478ea5[_0xd79f('0x23')](_0x45341f)[_0xd79f('0x24')](function(_0x4a63e5){return _0x4a63e5;});}return null;};}function removeEntity(_0x59d249,_0x4abdbf){return function(_0x1c8f3b){if(_0x1c8f3b){return _0x1c8f3b[_0xd79f('0x25')]()[_0xd79f('0x24')](function(){var _0x51f5d2=_0x1c8f3b[_0xd79f('0x26')]({'plain':!![]});var _0xc7928f=_0xd79f('0x27');return db['UserProfileResource'][_0xd79f('0x25')]({'where':{'type':_0xc7928f,'resourceId':_0x51f5d2['id']}})[_0xd79f('0x24')](function(){return _0x1c8f3b;});})[_0xd79f('0x24')](function(){_0x59d249[_0xd79f('0x1a')](0xcc)[_0xd79f('0x28')]();});}};}function handleEntityNotFound(_0x204387,_0x609a44){return function(_0x52136a){if(!_0x52136a){_0x204387[_0xd79f('0x19')](0x194);}return _0x52136a;};}function handleError(_0x13bd59,_0x5ede33){_0x5ede33=_0x5ede33||0x1f4;return function(_0x39ef19){logger['error'](_0x39ef19[_0xd79f('0x29')]);if(_0x39ef19[_0xd79f('0x2a')]){delete _0x39ef19[_0xd79f('0x2a')];}_0x13bd59[_0xd79f('0x1a')](_0x5ede33)[_0xd79f('0x2b')](_0x39ef19);};}exports['index']=function(_0x2c5afe,_0x335ae2){var _0x70bb9d={},_0x3273f2={},_0x4a7346={'count':0x0,'rows':[]};var _0xfe9833=_[_0xd79f('0x2c')](db[_0xd79f('0x27')][_0xd79f('0x2d')],function(_0x42b70e){return{'name':_0x42b70e['fieldName'],'type':_0x42b70e[_0xd79f('0x2e')][_0xd79f('0x2f')]};});_0x3273f2[_0xd79f('0x30')]=_[_0xd79f('0x2c')](_0xfe9833,_0xd79f('0x2a'));_0x3273f2['query']=_[_0xd79f('0x31')](_0x2c5afe[_0xd79f('0x32')]);_0x3273f2['filters']=_['intersection'](_0x3273f2[_0xd79f('0x30')],_0x3273f2['query']);_0x70bb9d[_0xd79f('0x33')]=_[_0xd79f('0x34')](_0x3273f2[_0xd79f('0x30')],qs[_0xd79f('0x35')](_0x2c5afe[_0xd79f('0x32')][_0xd79f('0x35')]));_0x70bb9d[_0xd79f('0x33')]=_0x70bb9d['attributes'][_0xd79f('0x36')]?_0x70bb9d['attributes']:_0x3273f2['model'];if(!_0x2c5afe[_0xd79f('0x32')]['hasOwnProperty']('nolimit')){_0x70bb9d[_0xd79f('0x1d')]=qs[_0xd79f('0x1d')](_0x2c5afe[_0xd79f('0x32')][_0xd79f('0x1d')]);_0x70bb9d['offset']=qs['offset'](_0x2c5afe[_0xd79f('0x32')][_0xd79f('0x1c')]);}_0x70bb9d[_0xd79f('0x37')]=qs['sort'](_0x2c5afe[_0xd79f('0x32')][_0xd79f('0x38')]);_0x70bb9d[_0xd79f('0x39')]=qs[_0xd79f('0x3a')](_[_0xd79f('0x3b')](_0x2c5afe[_0xd79f('0x32')],_0x3273f2[_0xd79f('0x3a')]),_0xfe9833);if(_0x2c5afe[_0xd79f('0x32')][_0xd79f('0x3c')]){_0x70bb9d['where']=_[_0xd79f('0x3d')](_0x70bb9d['where'],{'$or':_[_0xd79f('0x2c')](_0xfe9833,function(_0x15b95c){if(_0x15b95c[_0xd79f('0x2e')]!=='VIRTUAL'){var _0x5cd640={};_0x5cd640[_0x15b95c[_0xd79f('0x2a')]]={'$like':'%'+_0x2c5afe[_0xd79f('0x32')][_0xd79f('0x3c')]+'%'};return _0x5cd640;}})});}_0x70bb9d=_['merge']({},_0x70bb9d,_0x2c5afe[_0xd79f('0x3e')]);var _0x796138={'where':_0x70bb9d['where']};return db[_0xd79f('0x27')][_0xd79f('0x3f')](_0x796138)['then'](function(_0x1f3e42){_0x4a7346[_0xd79f('0x3f')]=_0x1f3e42;if(_0x2c5afe['query'][_0xd79f('0x40')]){_0x70bb9d[_0xd79f('0x41')]=[{'all':!![]}];}return db['UserOpenchannelInteraction'][_0xd79f('0x42')](_0x70bb9d);})[_0xd79f('0x24')](function(_0x2431ab){_0x4a7346[_0xd79f('0x43')]=_0x2431ab;return _0x4a7346;})[_0xd79f('0x24')](respondWithFilteredResult(_0x335ae2,_0x70bb9d))[_0xd79f('0x44')](handleError(_0x335ae2,null));};exports[_0xd79f('0x45')]=function(_0xb105bb,_0x34cf5d){var _0x70c17a={'raw':!![],'where':{'id':_0xb105bb[_0xd79f('0x46')]['id']}},_0x1abfc3={};_0x1abfc3['model']=_[_0xd79f('0x31')](db[_0xd79f('0x27')][_0xd79f('0x2d')]);_0x1abfc3[_0xd79f('0x32')]=_[_0xd79f('0x31')](_0xb105bb[_0xd79f('0x32')]);_0x1abfc3[_0xd79f('0x3a')]=_['intersection'](_0x1abfc3['model'],_0x1abfc3[_0xd79f('0x32')]);_0x70c17a['attributes']=_[_0xd79f('0x34')](_0x1abfc3[_0xd79f('0x30')],qs[_0xd79f('0x35')](_0xb105bb[_0xd79f('0x32')][_0xd79f('0x35')]));_0x70c17a[_0xd79f('0x33')]=_0x70c17a['attributes'][_0xd79f('0x36')]?_0x70c17a['attributes']:_0x1abfc3[_0xd79f('0x30')];if(_0xb105bb[_0xd79f('0x32')][_0xd79f('0x40')]){_0x70c17a['include']=[{'all':!![]}];}_0x70c17a=_[_0xd79f('0x3d')]({},_0x70c17a,_0xb105bb[_0xd79f('0x3e')]);return db[_0xd79f('0x27')][_0xd79f('0x47')](_0x70c17a)[_0xd79f('0x24')](handleEntityNotFound(_0x34cf5d,null))[_0xd79f('0x24')](respondWithResult(_0x34cf5d,null))['catch'](handleError(_0x34cf5d,null));};exports[_0xd79f('0x48')]=function(_0x552bfa,_0x430377){return db[_0xd79f('0x27')][_0xd79f('0x48')](_0x552bfa[_0xd79f('0x49')],{})[_0xd79f('0x24')](function(_0x2e9a6b){var _0x4f9223=_0x552bfa['user'][_0xd79f('0x26')]({'plain':!![]});if(!_0x4f9223)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f9223[_0xd79f('0x4a')]===_0xd79f('0x4b')){var _0x52c324=_0x2e9a6b['get']({'plain':!![]});var _0x41e3d1='UserOpenchannelInteraction';return db['UserProfileSection'][_0xd79f('0x47')]({'where':{'name':_0x41e3d1,'userProfileId':_0x4f9223[_0xd79f('0x4c')]},'raw':!![]})['then'](function(_0x2d83f6){if(_0x2d83f6&&_0x2d83f6['autoAssociation']===0x0){return db[_0xd79f('0x4d')]['create']({'name':_0x52c324[_0xd79f('0x2a')],'resourceId':_0x52c324['id'],'type':_0x2d83f6['name'],'sectionId':_0x2d83f6['id']},{})[_0xd79f('0x24')](function(){return _0x2e9a6b;});}else{return _0x2e9a6b;}})[_0xd79f('0x44')](function(_0x2a7c3a){logger[_0xd79f('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a7c3a);throw _0x2a7c3a;});}return _0x2e9a6b;})['then'](respondWithResult(_0x430377,0xc9))['catch'](handleError(_0x430377,null));};exports[_0xd79f('0x23')]=function(_0x14f07b,_0x3bcff0){if(_0x14f07b['body']['id']){delete _0x14f07b[_0xd79f('0x49')]['id'];}return db[_0xd79f('0x27')][_0xd79f('0x47')]({'where':{'id':_0x14f07b[_0xd79f('0x46')]['id']}})[_0xd79f('0x24')](handleEntityNotFound(_0x3bcff0,null))[_0xd79f('0x24')](saveUpdates(_0x14f07b[_0xd79f('0x49')],null))['then'](respondWithResult(_0x3bcff0,null))[_0xd79f('0x44')](handleError(_0x3bcff0,null));};exports[_0xd79f('0x25')]=function(_0x54db72,_0xd266d9){return db['UserOpenchannelInteraction'][_0xd79f('0x47')]({'where':{'id':_0x54db72[_0xd79f('0x46')]['id']}})['then'](handleEntityNotFound(_0xd266d9,null))[_0xd79f('0x24')](removeEntity(_0xd266d9,null))[_0xd79f('0x44')](handleError(_0xd266d9,null));}; \ No newline at end of file +var _0xf2d8=['UserProfileResource','sendStatus','error','stack','name','map','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','VIRTUAL','filter','merge','options','count','includeAll','rows','catch','rawAttributes','create','body','user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','set','Content-Range','apply','save','update','then','destroy','get','UserOpenchannelInteraction'];(function(_0x1915e5,_0xe53420){var _0x148dd0=function(_0x5b51cc){while(--_0x5b51cc){_0x1915e5['push'](_0x1915e5['shift']());}};_0x148dd0(++_0xe53420);}(_0xf2d8,0xbf));var _0x8f2d=function(_0x1a675c,_0x4648bc){_0x1a675c=_0x1a675c-0x0;var _0x4ee1dc=_0xf2d8[_0x1a675c];return _0x4ee1dc;};'use strict';var pdf=require(_0x8f2d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8f2d('0x1'));var jsonpatch=require(_0x8f2d('0x2'));var rp=require('request-promise');var moment=require(_0x8f2d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8f2d('0x4'));var util=require(_0x8f2d('0x5'));var path=require('path');var sox=require(_0x8f2d('0x6'));var csv=require(_0x8f2d('0x7'));var ejs=require(_0x8f2d('0x8'));var fs=require('fs');var _=require(_0x8f2d('0x9'));var squel=require(_0x8f2d('0xa'));var crypto=require(_0x8f2d('0xb'));var jsforce=require(_0x8f2d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8f2d('0x7'));var querystring=require(_0x8f2d('0xd'));var Papa=require(_0x8f2d('0xe'));var Redis=require('ioredis');var authService=require(_0x8f2d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8f2d('0x10'));var hardwareService=require(_0x8f2d('0x11'));var logger=require(_0x8f2d('0x12'))(_0x8f2d('0x13'));var utils=require(_0x8f2d('0x14'));var config=require(_0x8f2d('0x15'));var licenseUtil=require(_0x8f2d('0x16'));var db=require(_0x8f2d('0x17'))['db'];function respondWithStatusCode(_0x249e70,_0x171f6d){_0x171f6d=_0x171f6d||0xcc;return function(_0x44bd23){if(_0x44bd23){return _0x249e70['sendStatus'](_0x171f6d);}return _0x249e70[_0x8f2d('0x18')](_0x171f6d)[_0x8f2d('0x19')]();};}function respondWithResult(_0x5b19f0,_0x36a0f7){_0x36a0f7=_0x36a0f7||0xc8;return function(_0x4caa84){if(_0x4caa84){return _0x5b19f0[_0x8f2d('0x18')](_0x36a0f7)[_0x8f2d('0x1a')](_0x4caa84);}};}function respondWithFilteredResult(_0x49c8a9,_0x4a8c30){return function(_0x264dfa){if(_0x264dfa){var _0x4f343b=_0x264dfa['count'],_0x5b7624=_0x4a8c30[_0x8f2d('0x1b')],_0x754900=_0x4a8c30[_0x8f2d('0x1b')]+_0x4a8c30['limit'],_0xe97bdd;if(_0x754900>=_0x4f343b){_0x754900=_0x4f343b;_0xe97bdd=0xc8;}else{_0xe97bdd=0xce;}_0x49c8a9[_0x8f2d('0x18')](_0xe97bdd);return _0x49c8a9[_0x8f2d('0x1c')](_0x8f2d('0x1d'),_0x5b7624+'-'+_0x754900+'/'+_0x4f343b)[_0x8f2d('0x1a')](_0x264dfa);}return null;};}function patchUpdates(_0x3d899f){return function(_0xca76e9){try{jsonpatch[_0x8f2d('0x1e')](_0xca76e9,_0x3d899f,!![]);}catch(_0x266bdb){return BPromise['reject'](_0x266bdb);}return _0xca76e9[_0x8f2d('0x1f')]();};}function saveUpdates(_0xfa529a,_0x52e61b){return function(_0x7492bd){if(_0x7492bd){return _0x7492bd[_0x8f2d('0x20')](_0xfa529a)[_0x8f2d('0x21')](function(_0x5708f7){return _0x5708f7;});}return null;};}function removeEntity(_0x5c03ab,_0x153ef1){return function(_0x313d57){if(_0x313d57){return _0x313d57[_0x8f2d('0x22')]()['then'](function(){var _0x3694f7=_0x313d57[_0x8f2d('0x23')]({'plain':!![]});var _0x119f40=_0x8f2d('0x24');return db[_0x8f2d('0x25')]['destroy']({'where':{'type':_0x119f40,'resourceId':_0x3694f7['id']}})[_0x8f2d('0x21')](function(){return _0x313d57;});})[_0x8f2d('0x21')](function(){_0x5c03ab[_0x8f2d('0x18')](0xcc)[_0x8f2d('0x19')]();});}};}function handleEntityNotFound(_0x1f9bcf,_0x2c7e4f){return function(_0xe35ef9){if(!_0xe35ef9){_0x1f9bcf[_0x8f2d('0x26')](0x194);}return _0xe35ef9;};}function handleError(_0x5ec9fe,_0x37d314){_0x37d314=_0x37d314||0x1f4;return function(_0x710f10){logger[_0x8f2d('0x27')](_0x710f10[_0x8f2d('0x28')]);if(_0x710f10[_0x8f2d('0x29')]){delete _0x710f10[_0x8f2d('0x29')];}_0x5ec9fe[_0x8f2d('0x18')](_0x37d314)['send'](_0x710f10);};}exports['index']=function(_0x2d5d7a,_0x4ab04d){var _0x521b13={},_0x5d3ad3={},_0x4b4a62={'count':0x0,'rows':[]};var _0x305bbd=_[_0x8f2d('0x2a')](db[_0x8f2d('0x24')]['rawAttributes'],function(_0x3dfae8){return{'name':_0x3dfae8['fieldName'],'type':_0x3dfae8[_0x8f2d('0x2b')][_0x8f2d('0x2c')]};});_0x5d3ad3[_0x8f2d('0x2d')]=_['map'](_0x305bbd,_0x8f2d('0x29'));_0x5d3ad3['query']=_[_0x8f2d('0x2e')](_0x2d5d7a[_0x8f2d('0x2f')]);_0x5d3ad3['filters']=_[_0x8f2d('0x30')](_0x5d3ad3[_0x8f2d('0x2d')],_0x5d3ad3[_0x8f2d('0x2f')]);_0x521b13[_0x8f2d('0x31')]=_[_0x8f2d('0x30')](_0x5d3ad3['model'],qs[_0x8f2d('0x32')](_0x2d5d7a[_0x8f2d('0x2f')]['fields']));_0x521b13[_0x8f2d('0x31')]=_0x521b13[_0x8f2d('0x31')][_0x8f2d('0x33')]?_0x521b13[_0x8f2d('0x31')]:_0x5d3ad3[_0x8f2d('0x2d')];if(!_0x2d5d7a[_0x8f2d('0x2f')][_0x8f2d('0x34')](_0x8f2d('0x35'))){_0x521b13[_0x8f2d('0x36')]=qs['limit'](_0x2d5d7a[_0x8f2d('0x2f')][_0x8f2d('0x36')]);_0x521b13[_0x8f2d('0x1b')]=qs['offset'](_0x2d5d7a[_0x8f2d('0x2f')][_0x8f2d('0x1b')]);}_0x521b13[_0x8f2d('0x37')]=qs[_0x8f2d('0x38')](_0x2d5d7a[_0x8f2d('0x2f')][_0x8f2d('0x38')]);_0x521b13[_0x8f2d('0x39')]=qs[_0x8f2d('0x3a')](_['pick'](_0x2d5d7a['query'],_0x5d3ad3[_0x8f2d('0x3a')]),_0x305bbd);if(_0x2d5d7a[_0x8f2d('0x2f')]['filter']){_0x521b13[_0x8f2d('0x39')]=_['merge'](_0x521b13[_0x8f2d('0x39')],{'$or':_[_0x8f2d('0x2a')](_0x305bbd,function(_0x4bc563){if(_0x4bc563['type']!==_0x8f2d('0x3b')){var _0x4020e6={};_0x4020e6[_0x4bc563['name']]={'$like':'%'+_0x2d5d7a['query'][_0x8f2d('0x3c')]+'%'};return _0x4020e6;}})});}_0x521b13=_[_0x8f2d('0x3d')]({},_0x521b13,_0x2d5d7a[_0x8f2d('0x3e')]);var _0x12278b={'where':_0x521b13['where']};return db[_0x8f2d('0x24')][_0x8f2d('0x3f')](_0x12278b)[_0x8f2d('0x21')](function(_0x2df549){_0x4b4a62[_0x8f2d('0x3f')]=_0x2df549;if(_0x2d5d7a[_0x8f2d('0x2f')][_0x8f2d('0x40')]){_0x521b13['include']=[{'all':!![]}];}return db['UserOpenchannelInteraction']['findAll'](_0x521b13);})['then'](function(_0x45c911){_0x4b4a62[_0x8f2d('0x41')]=_0x45c911;return _0x4b4a62;})[_0x8f2d('0x21')](respondWithFilteredResult(_0x4ab04d,_0x521b13))[_0x8f2d('0x42')](handleError(_0x4ab04d,null));};exports['show']=function(_0x56851b,_0x549313){var _0xa04aa4={'raw':!![],'where':{'id':_0x56851b['params']['id']}},_0x1f52f3={};_0x1f52f3[_0x8f2d('0x2d')]=_[_0x8f2d('0x2e')](db[_0x8f2d('0x24')][_0x8f2d('0x43')]);_0x1f52f3['query']=_[_0x8f2d('0x2e')](_0x56851b[_0x8f2d('0x2f')]);_0x1f52f3['filters']=_[_0x8f2d('0x30')](_0x1f52f3['model'],_0x1f52f3[_0x8f2d('0x2f')]);_0xa04aa4[_0x8f2d('0x31')]=_[_0x8f2d('0x30')](_0x1f52f3['model'],qs['fields'](_0x56851b['query'][_0x8f2d('0x32')]));_0xa04aa4[_0x8f2d('0x31')]=_0xa04aa4[_0x8f2d('0x31')][_0x8f2d('0x33')]?_0xa04aa4[_0x8f2d('0x31')]:_0x1f52f3['model'];if(_0x56851b['query'][_0x8f2d('0x40')]){_0xa04aa4['include']=[{'all':!![]}];}_0xa04aa4=_[_0x8f2d('0x3d')]({},_0xa04aa4,_0x56851b[_0x8f2d('0x3e')]);return db['UserOpenchannelInteraction']['find'](_0xa04aa4)[_0x8f2d('0x21')](handleEntityNotFound(_0x549313,null))[_0x8f2d('0x21')](respondWithResult(_0x549313,null))[_0x8f2d('0x42')](handleError(_0x549313,null));};exports[_0x8f2d('0x44')]=function(_0x42ebd8,_0x3b6df9){return db[_0x8f2d('0x24')][_0x8f2d('0x44')](_0x42ebd8[_0x8f2d('0x45')],{})[_0x8f2d('0x21')](function(_0xd2b3e0){var _0x31b8be=_0x42ebd8[_0x8f2d('0x46')][_0x8f2d('0x23')]({'plain':!![]});if(!_0x31b8be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31b8be[_0x8f2d('0x47')]===_0x8f2d('0x46')){var _0x2c8a41=_0xd2b3e0[_0x8f2d('0x23')]({'plain':!![]});var _0x5ed524=_0x8f2d('0x24');return db['UserProfileSection'][_0x8f2d('0x48')]({'where':{'name':_0x5ed524,'userProfileId':_0x31b8be[_0x8f2d('0x49')]},'raw':!![]})[_0x8f2d('0x21')](function(_0x5cc0d7){if(_0x5cc0d7&&_0x5cc0d7['autoAssociation']===0x0){return db[_0x8f2d('0x25')]['create']({'name':_0x2c8a41[_0x8f2d('0x29')],'resourceId':_0x2c8a41['id'],'type':_0x5cc0d7[_0x8f2d('0x29')],'sectionId':_0x5cc0d7['id']},{})[_0x8f2d('0x21')](function(){return _0xd2b3e0;});}else{return _0xd2b3e0;}})[_0x8f2d('0x42')](function(_0x14f3dd){logger['error'](_0x8f2d('0x4a'),_0x14f3dd);throw _0x14f3dd;});}return _0xd2b3e0;})[_0x8f2d('0x21')](respondWithResult(_0x3b6df9,0xc9))[_0x8f2d('0x42')](handleError(_0x3b6df9,null));};exports['update']=function(_0x346e16,_0x335fa7){if(_0x346e16['body']['id']){delete _0x346e16[_0x8f2d('0x45')]['id'];}return db[_0x8f2d('0x24')][_0x8f2d('0x48')]({'where':{'id':_0x346e16['params']['id']}})['then'](handleEntityNotFound(_0x335fa7,null))['then'](saveUpdates(_0x346e16[_0x8f2d('0x45')],null))[_0x8f2d('0x21')](respondWithResult(_0x335fa7,null))[_0x8f2d('0x42')](handleError(_0x335fa7,null));};exports[_0x8f2d('0x22')]=function(_0x1e0f00,_0x3ab578){return db['UserOpenchannelInteraction'][_0x8f2d('0x48')]({'where':{'id':_0x1e0f00[_0x8f2d('0x4b')]['id']}})[_0x8f2d('0x21')](handleEntityNotFound(_0x3ab578,null))[_0x8f2d('0x21')](removeEntity(_0x3ab578,null))[_0x8f2d('0x42')](handleError(_0x3ab578,null));}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js index ca93a39..0396de9 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 _0x7f62=['user_has_openchannel_interactions','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./UserOpenchannelInteraction.attributes','UserOpenchannelInteraction'];(function(_0x2351e5,_0x19f252){var _0x13d2c6=function(_0x4eb4bc){while(--_0x4eb4bc){_0x2351e5['push'](_0x2351e5['shift']());}};_0x13d2c6(++_0x19f252);}(_0x7f62,0x156));var _0x27f6=function(_0x55ef8b,_0x5deb5e){_0x55ef8b=_0x55ef8b-0x0;var _0x359c84=_0x7f62[_0x55ef8b];return _0x359c84;};'use strict';var _=require(_0x27f6('0x0'));var util=require(_0x27f6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x27f6('0x2'));var BPromise=require(_0x27f6('0x3'));var rp=require(_0x27f6('0x4'));var fs=require('fs');var path=require(_0x27f6('0x5'));var rimraf=require(_0x27f6('0x6'));var config=require(_0x27f6('0x7'));var attributes=require(_0x27f6('0x8'));module['exports']=function(_0xda306f,_0x112ec0){return _0xda306f['define'](_0x27f6('0x9'),attributes,{'tableName':_0x27f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba85=['util','moment','bluebird','path','../../config/environment','define','UserOpenchannelInteraction','user_has_openchannel_interactions'];(function(_0x434f4d,_0x3c5008){var _0x369f4d=function(_0xbf313f){while(--_0xbf313f){_0x434f4d['push'](_0x434f4d['shift']());}};_0x369f4d(++_0x3c5008);}(_0xba85,0x120));var _0x5ba8=function(_0x4a0184,_0x4efa55){_0x4a0184=_0x4a0184-0x0;var _0x51ebbd=_0xba85[_0x4a0184];return _0x51ebbd;};'use strict';var _=require('lodash');var util=require(_0x5ba8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5ba8('0x1'));var BPromise=require(_0x5ba8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ba8('0x3'));var rimraf=require('rimraf');var config=require(_0x5ba8('0x4'));var attributes=require('./UserOpenchannelInteraction.attributes');module['exports']=function(_0xf23bc7,_0x319fd3){return _0xf23bc7[_0x5ba8('0x5')](_0x5ba8('0x6'),attributes,{'tableName':_0x5ba8('0x7'),'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 ebbf429..697bb3c 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 _0x2428=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','UserOpenchannelInteraction,\x20%s,\x20%s','error','message'];(function(_0x3ced99,_0x1101ed){var _0x528e12=function(_0x563284){while(--_0x563284){_0x3ced99['push'](_0x3ced99['shift']());}};_0x528e12(++_0x1101ed);}(_0x2428,0xd3));var _0x8242=function(_0x2ec06f,_0x560d3a){_0x2ec06f=_0x2ec06f-0x0;var _0x38d19c=_0x2428[_0x2ec06f];return _0x38d19c;};'use strict';var _=require('lodash');var util=require(_0x8242('0x0'));var moment=require(_0x8242('0x1'));var BPromise=require(_0x8242('0x2'));var rs=require(_0x8242('0x3'));var fs=require('fs');var Redis=require(_0x8242('0x4'));var db=require(_0x8242('0x5'))['db'];var utils=require(_0x8242('0x6'));var logger=require(_0x8242('0x7'))(_0x8242('0x8'));var config=require(_0x8242('0x9'));var jayson=require(_0x8242('0xa'));var client=jayson['client'][_0x8242('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11da5f,_0x3fb12e,_0x3712f3){return new BPromise(function(_0x1501e8,_0x4b9617){return client[_0x8242('0xc')](_0x11da5f,_0x3712f3)[_0x8242('0xd')](function(_0x12b115){logger[_0x8242('0xe')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x3fb12e,_0x8242('0xf'));logger[_0x8242('0x10')]('UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x3fb12e,_0x8242('0xf'),JSON['stringify'](_0x12b115));if(_0x12b115['error']){if(_0x12b115['error']['code']===0x1f4){logger['error'](_0x8242('0x11'),_0x3fb12e,_0x12b115[_0x8242('0x12')]['message']);return _0x4b9617(_0x12b115['error'][_0x8242('0x13')]);}logger[_0x8242('0x12')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x3fb12e,_0x12b115[_0x8242('0x12')]['message']);return _0x1501e8(_0x12b115[_0x8242('0x12')][_0x8242('0x13')]);}else{logger[_0x8242('0xe')](_0x8242('0x11'),_0x3fb12e,_0x8242('0xf'));_0x1501e8(_0x12b115[_0x8242('0x14')][_0x8242('0x13')]);}})['catch'](function(_0x4ad29d){logger[_0x8242('0x12')](_0x8242('0x11'),_0x3fb12e,_0x4ad29d);_0x4b9617(_0x4ad29d);});});} \ No newline at end of file +var _0xc409=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','debug','UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserOpenchannelInteraction,\x20%s,\x20%s','message','result','catch'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0xc409,0xc6));var _0x9c40=function(_0x4021b1,_0x4c634e){_0x4021b1=_0x4021b1-0x0;var _0x16f811=_0xc409[_0x4021b1];return _0x16f811;};'use strict';var _=require(_0x9c40('0x0'));var util=require(_0x9c40('0x1'));var moment=require(_0x9c40('0x2'));var BPromise=require(_0x9c40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c40('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c40('0x5'));var logger=require(_0x9c40('0x6'))(_0x9c40('0x7'));var config=require(_0x9c40('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9c40('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x211744,_0x20f7ea,_0x16bb9d){return new BPromise(function(_0x47b333,_0x8b7d1){return client[_0x9c40('0xa')](_0x211744,_0x16bb9d)['then'](function(_0x2f7752){logger[_0x9c40('0xb')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x20f7ea,'request\x20sent');logger[_0x9c40('0xc')](_0x9c40('0xd'),_0x20f7ea,_0x9c40('0xe'),JSON[_0x9c40('0xf')](_0x2f7752));if(_0x2f7752['error']){if(_0x2f7752[_0x9c40('0x10')][_0x9c40('0x11')]===0x1f4){logger[_0x9c40('0x10')](_0x9c40('0x12'),_0x20f7ea,_0x2f7752['error'][_0x9c40('0x13')]);return _0x8b7d1(_0x2f7752['error'][_0x9c40('0x13')]);}logger[_0x9c40('0x10')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x20f7ea,_0x2f7752[_0x9c40('0x10')][_0x9c40('0x13')]);return _0x47b333(_0x2f7752[_0x9c40('0x10')][_0x9c40('0x13')]);}else{logger[_0x9c40('0xb')](_0x9c40('0x12'),_0x20f7ea,_0x9c40('0xe'));_0x47b333(_0x2f7752[_0x9c40('0x14')][_0x9c40('0x13')]);}})[_0x9c40('0x15')](function(_0x3d6ebe){logger[_0x9c40('0x10')](_0x9c40('0x12'),_0x20f7ea,_0x3d6ebe);_0x8b7d1(_0x3d6ebe);});});} \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/index.js b/server/api/UserOpenchannelInteraction/index.js index d11a97c..79e3768 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 _0x4138=['../../config/environment','./UserOpenchannelInteraction.controller','get','isAuthenticated','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0xc9b877,_0x463ba9){var _0x1b77a0=function(_0x3a3917){while(--_0x3a3917){_0xc9b877['push'](_0xc9b877['shift']());}};_0x1b77a0(++_0x463ba9);}(_0x4138,0x93));var _0x8413=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4138[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x8413('0x0'));var util=require(_0x8413('0x1'));var path=require(_0x8413('0x2'));var timeout=require(_0x8413('0x3'));var express=require(_0x8413('0x4'));var router=express['Router']();var auth=require(_0x8413('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8413('0x6'));var controller=require(_0x8413('0x7'));router[_0x8413('0x8')]('/',auth[_0x8413('0x9')](),controller['index']);router[_0x8413('0x8')](_0x8413('0xa'),auth[_0x8413('0x9')](),controller[_0x8413('0xb')]);router['post']('/',auth[_0x8413('0x9')](),controller['create']);router[_0x8413('0xc')](_0x8413('0xa'),auth[_0x8413('0x9')](),controller[_0x8413('0xd')]);router[_0x8413('0xe')](_0x8413('0xa'),auth[_0x8413('0x9')](),controller[_0x8413('0xf')]);module[_0x8413('0x10')]=router; \ No newline at end of file +var _0x33ea=['/:id','update','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./UserOpenchannelInteraction.controller','isAuthenticated','get','show','post','create','put'];(function(_0x52e9cd,_0x40342d){var _0x7f287=function(_0x5922c6){while(--_0x5922c6){_0x52e9cd['push'](_0x52e9cd['shift']());}};_0x7f287(++_0x40342d);}(_0x33ea,0x17a));var _0xa33e=function(_0x4c5c41,_0x28ce98){_0x4c5c41=_0x4c5c41-0x0;var _0x4863b7=_0x33ea[_0x4c5c41];return _0x4863b7;};'use strict';var multer=require(_0xa33e('0x0'));var util=require('util');var path=require(_0xa33e('0x1'));var timeout=require(_0xa33e('0x2'));var express=require('express');var router=express[_0xa33e('0x3')]();var auth=require(_0xa33e('0x4'));var interaction=require(_0xa33e('0x5'));var config=require('../../config/environment');var controller=require(_0xa33e('0x6'));router['get']('/',auth[_0xa33e('0x7')](),controller['index']);router[_0xa33e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xa33e('0x9')]);router[_0xa33e('0xa')]('/',auth[_0xa33e('0x7')](),controller[_0xa33e('0xb')]);router[_0xa33e('0xc')](_0xa33e('0xd'),auth[_0xa33e('0x7')](),controller[_0xa33e('0xe')]);router[_0xa33e('0xf')](_0xa33e('0xd'),auth['isAuthenticated'](),controller[_0xa33e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js b/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js index 2387d1f..69f06bb 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 _0x5598=['sequelize','exports','INTEGER'];(function(_0x324db7,_0x5b7b3f){var _0x20b62f=function(_0x5060fe){while(--_0x5060fe){_0x324db7['push'](_0x324db7['shift']());}};_0x20b62f(++_0x5b7b3f);}(_0x5598,0x111));var _0x8559=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x5598[_0x351509];return _0x4e9861;};'use strict';var Sequelize=require(_0x8559('0x0'));module[_0x8559('0x1')]={'SmsInteractionId':{'type':Sequelize[_0x8559('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x8559('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0x6a2f=['exports'];(function(_0x2c0870,_0x46f889){var _0x1e410e=function(_0x57ef07){while(--_0x57ef07){_0x2c0870['push'](_0x2c0870['shift']());}};_0x1e410e(++_0x46f889);}(_0x6a2f,0xbf));var _0xf6a2=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x6a2f[_0x59c301];return _0x3866b9;};'use strict';var Sequelize=require('sequelize');module[_0xf6a2('0x0')]={'SmsInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.controller.js b/server/api/UserSmsInteraction/UserSmsInteraction.controller.js index e7c96ad..6d64846 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(_0x4d916c,_0x5126de){var _0x1780fc=function(_0x482e7d){while(--_0x482e7d){_0x4d916c['push'](_0x4d916c['shift']());}};_0x1780fc(++_0x5126de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x494aa1,_0x1bcfcc){var _0x154162=function(_0x492d56){while(--_0x492d56){_0x494aa1['push'](_0x494aa1['shift']());}};_0x154162(++_0x1bcfcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 27e7adc..5a66ef2 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 _0x1de4=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./UserSmsInteraction.attributes','exports','define','UserSmsInteraction','user_has_sms_interactions'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x1de4,0x12b));var _0x41de=function(_0x413f1f,_0x2fc742){_0x413f1f=_0x413f1f-0x0;var _0x29372a=_0x1de4[_0x413f1f];return _0x29372a;};'use strict';var _=require(_0x41de('0x0'));var util=require(_0x41de('0x1'));var logger=require('../../config/logger')(_0x41de('0x2'));var moment=require('moment');var BPromise=require(_0x41de('0x3'));var rp=require(_0x41de('0x4'));var fs=require('fs');var path=require(_0x41de('0x5'));var rimraf=require(_0x41de('0x6'));var config=require(_0x41de('0x7'));var attributes=require(_0x41de('0x8'));module[_0x41de('0x9')]=function(_0x4c4371,_0xc295fd){return _0x4c4371[_0x41de('0xa')](_0x41de('0xb'),attributes,{'tableName':_0x41de('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6fe=['bluebird','path','rimraf','../../config/environment','./UserSmsInteraction.attributes','exports','define','UserSmsInteraction','user_has_sms_interactions','util','../../config/logger','moment'];(function(_0x4c2769,_0x42aadd){var _0x27bdf9=function(_0x4136a5){while(--_0x4136a5){_0x4c2769['push'](_0x4c2769['shift']());}};_0x27bdf9(++_0x42aadd);}(_0xf6fe,0x8d));var _0xef6f=function(_0xdb75d4,_0x294ca6){_0xdb75d4=_0xdb75d4-0x0;var _0x2c51a5=_0xf6fe[_0xdb75d4];return _0x2c51a5;};'use strict';var _=require('lodash');var util=require(_0xef6f('0x0'));var logger=require(_0xef6f('0x1'))('api');var moment=require(_0xef6f('0x2'));var BPromise=require(_0xef6f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef6f('0x4'));var rimraf=require(_0xef6f('0x5'));var config=require(_0xef6f('0x6'));var attributes=require(_0xef6f('0x7'));module[_0xef6f('0x8')]=function(_0x42b2a6,_0x202992){return _0x42b2a6[_0xef6f('0x9')](_0xef6f('0xa'),attributes,{'tableName':_0xef6f('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 69d20fa..9df254e 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 _0xa51a=['rpc','../../config/environment','jayson/promise','http','UserSmsInteraction,\x20%s,\x20%s','request\x20sent','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2fbe5f,_0x4c5c13){var _0x21db60=function(_0x467893){while(--_0x467893){_0x2fbe5f['push'](_0x2fbe5f['shift']());}};_0x21db60(++_0x4c5c13);}(_0xa51a,0x14a));var _0xaa51=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa51a[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0xaa51('0x0'));var util=require('util');var moment=require(_0xaa51('0x1'));var BPromise=require(_0xaa51('0x2'));var rs=require(_0xaa51('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa51('0x4'))['db'];var utils=require(_0xaa51('0x5'));var logger=require('../../config/logger')(_0xaa51('0x6'));var config=require(_0xaa51('0x7'));var jayson=require(_0xaa51('0x8'));var client=jayson['client'][_0xaa51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2aa9da,_0x372e9f,_0x144bda){return new BPromise(function(_0x2dbfbc,_0x3c2df8){return client['request'](_0x2aa9da,_0x144bda)['then'](function(_0x4aab35){logger['info'](_0xaa51('0xa'),_0x372e9f,_0xaa51('0xb'));logger[_0xaa51('0xc')](_0xaa51('0xd'),_0x372e9f,_0xaa51('0xb'),JSON[_0xaa51('0xe')](_0x4aab35));if(_0x4aab35[_0xaa51('0xf')]){if(_0x4aab35[_0xaa51('0xf')][_0xaa51('0x10')]===0x1f4){logger['error'](_0xaa51('0xa'),_0x372e9f,_0x4aab35[_0xaa51('0xf')][_0xaa51('0x11')]);return _0x3c2df8(_0x4aab35[_0xaa51('0xf')][_0xaa51('0x11')]);}logger[_0xaa51('0xf')](_0xaa51('0xa'),_0x372e9f,_0x4aab35[_0xaa51('0xf')]['message']);return _0x2dbfbc(_0x4aab35['error'][_0xaa51('0x11')]);}else{logger[_0xaa51('0x12')]('UserSmsInteraction,\x20%s,\x20%s',_0x372e9f,'request\x20sent');_0x2dbfbc(_0x4aab35[_0xaa51('0x13')]['message']);}})[_0xaa51('0x14')](function(_0x3878f8){logger[_0xaa51('0xf')](_0xaa51('0xa'),_0x372e9f,_0x3878f8);_0x3c2df8(_0x3878f8);});});} \ No newline at end of file +var _0x1228=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsInteraction,\x20%s,\x20%s','request\x20sent','UserSmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x362d5e,_0xebf1ff){var _0x240ac2=function(_0x51f741){while(--_0x51f741){_0x362d5e['push'](_0x362d5e['shift']());}};_0x240ac2(++_0xebf1ff);}(_0x1228,0x19b));var _0x8122=function(_0x455b35,_0x5d2b5e){_0x455b35=_0x455b35-0x0;var _0x1fc095=_0x1228[_0x455b35];return _0x1fc095;};'use strict';var _=require(_0x8122('0x0'));var util=require(_0x8122('0x1'));var moment=require(_0x8122('0x2'));var BPromise=require('bluebird');var rs=require(_0x8122('0x3'));var fs=require('fs');var Redis=require(_0x8122('0x4'));var db=require(_0x8122('0x5'))['db'];var utils=require(_0x8122('0x6'));var logger=require('../../config/logger')(_0x8122('0x7'));var config=require(_0x8122('0x8'));var jayson=require(_0x8122('0x9'));var client=jayson[_0x8122('0xa')][_0x8122('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5149a8,_0x4687b6,_0xdb7e00){return new BPromise(function(_0x615305,_0x2efde1){return client[_0x8122('0xc')](_0x5149a8,_0xdb7e00)[_0x8122('0xd')](function(_0x2b6755){logger[_0x8122('0xe')](_0x8122('0xf'),_0x4687b6,_0x8122('0x10'));logger['debug'](_0x8122('0x11'),_0x4687b6,_0x8122('0x10'),JSON['stringify'](_0x2b6755));if(_0x2b6755[_0x8122('0x12')]){if(_0x2b6755[_0x8122('0x12')][_0x8122('0x13')]===0x1f4){logger[_0x8122('0x12')]('UserSmsInteraction,\x20%s,\x20%s',_0x4687b6,_0x2b6755[_0x8122('0x12')][_0x8122('0x14')]);return _0x2efde1(_0x2b6755[_0x8122('0x12')][_0x8122('0x14')]);}logger[_0x8122('0x12')](_0x8122('0xf'),_0x4687b6,_0x2b6755[_0x8122('0x12')][_0x8122('0x14')]);return _0x615305(_0x2b6755[_0x8122('0x12')]['message']);}else{logger[_0x8122('0xe')](_0x8122('0xf'),_0x4687b6,_0x8122('0x10'));_0x615305(_0x2b6755[_0x8122('0x15')]['message']);}})['catch'](function(_0x1eb662){logger[_0x8122('0x12')](_0x8122('0xf'),_0x4687b6,_0x1eb662);_0x2efde1(_0x1eb662);});});} \ No newline at end of file diff --git a/server/api/UserSmsInteraction/index.js b/server/api/UserSmsInteraction/index.js index 73eaa71..f8b9843 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 _0xacad=['/:id','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserSmsInteraction.controller','get','index','isAuthenticated','show','create','put','update','delete'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xacad,0x133));var _0xdaca=function(_0x50408c,_0x486e25){_0x50408c=_0x50408c-0x0;var _0x4ff663=_0xacad[_0x50408c];return _0x4ff663;};'use strict';var multer=require(_0xdaca('0x0'));var util=require('util');var path=require(_0xdaca('0x1'));var timeout=require('connect-timeout');var express=require(_0xdaca('0x2'));var router=express[_0xdaca('0x3')]();var auth=require(_0xdaca('0x4'));var interaction=require(_0xdaca('0x5'));var config=require(_0xdaca('0x6'));var controller=require(_0xdaca('0x7'));router[_0xdaca('0x8')]('/',auth['isAuthenticated'](),controller[_0xdaca('0x9')]);router[_0xdaca('0x8')]('/:id',auth[_0xdaca('0xa')](),controller[_0xdaca('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdaca('0xc')]);router[_0xdaca('0xd')]('/:id',auth[_0xdaca('0xa')](),controller[_0xdaca('0xe')]);router[_0xdaca('0xf')](_0xdaca('0x10'),auth[_0xdaca('0xa')](),controller[_0xdaca('0x11')]);module[_0xdaca('0x12')]=router; \ No newline at end of file +var _0x74b9=['post','create','put','update','destroy','exports','multer','path','express','Router','../../config/environment','./UserSmsInteraction.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5d0ab5,_0x589a12){var _0x70d5a9=function(_0x22a368){while(--_0x22a368){_0x5d0ab5['push'](_0x5d0ab5['shift']());}};_0x70d5a9(++_0x589a12);}(_0x74b9,0x116));var _0x974b=function(_0x4e50be,_0x29b999){_0x4e50be=_0x4e50be-0x0;var _0x23f5b6=_0x74b9[_0x4e50be];return _0x23f5b6;};'use strict';var multer=require(_0x974b('0x0'));var util=require('util');var path=require(_0x974b('0x1'));var timeout=require('connect-timeout');var express=require(_0x974b('0x2'));var router=express[_0x974b('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x974b('0x4'));var controller=require(_0x974b('0x5'));router[_0x974b('0x6')]('/',auth[_0x974b('0x7')](),controller[_0x974b('0x8')]);router[_0x974b('0x6')](_0x974b('0x9'),auth[_0x974b('0x7')](),controller[_0x974b('0xa')]);router[_0x974b('0xb')]('/',auth['isAuthenticated'](),controller[_0x974b('0xc')]);router[_0x974b('0xd')](_0x974b('0x9'),auth[_0x974b('0x7')](),controller[_0x974b('0xe')]);router['delete'](_0x974b('0x9'),auth['isAuthenticated'](),controller[_0x974b('0xf')]);module[_0x974b('0x10')]=router; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js index de314f4..34babb1 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 _0xa0af=['exports','INTEGER','sequelize'];(function(_0x256239,_0x407308){var _0x3bb9bb=function(_0x46c307){while(--_0x46c307){_0x256239['push'](_0x256239['shift']());}};_0x3bb9bb(++_0x407308);}(_0xa0af,0x185));var _0xfa0a=function(_0x42556c,_0x2bc292){_0x42556c=_0x42556c-0x0;var _0x24e27d=_0xa0af[_0x42556c];return _0x24e27d;};'use strict';var Sequelize=require(_0xfa0a('0x0'));module[_0xfa0a('0x1')]={'WhatsappInteractionId':{'type':Sequelize[_0xfa0a('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xfa0a('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0x602a=['sequelize','INTEGER'];(function(_0x267905,_0x4d7568){var _0x1d8196=function(_0x1f45f3){while(--_0x1f45f3){_0x267905['push'](_0x267905['shift']());}};_0x1d8196(++_0x4d7568);}(_0x602a,0x1de));var _0xa602=function(_0x1ea964,_0x2b5908){_0x1ea964=_0x1ea964-0x0;var _0x2eebcf=_0x602a[_0x1ea964];return _0x2eebcf;};'use strict';var Sequelize=require(_0xa602('0x0'));module['exports']={'WhatsappInteractionId':{'type':Sequelize[_0xa602('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xa602('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js index 9a00a34..f587fa9 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 _0xb9b4=['UserWhatsappInteraction','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','Content-Range','json','reject','save','then','destroy','get','UserWhatsappInteractions','end','error','name','send','map'];(function(_0x1ee6de,_0x46794e){var _0x4d9c17=function(_0x5ec731){while(--_0x5ec731){_0x1ee6de['push'](_0x1ee6de['shift']());}};_0x4d9c17(++_0x46794e);}(_0xb9b4,0x1a8));var _0x4b9b=function(_0x120578,_0x565b59){_0x120578=_0x120578-0x0;var _0x5a0bed=_0xb9b4[_0x120578];return _0x5a0bed;};'use strict';var pdf=require(_0x4b9b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4b9b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b9b('0x2'));var rp=require('request-promise');var moment=require(_0x4b9b('0x3'));var BPromise=require(_0x4b9b('0x4'));var Mustache=require(_0x4b9b('0x5'));var util=require(_0x4b9b('0x6'));var path=require(_0x4b9b('0x7'));var sox=require(_0x4b9b('0x8'));var csv=require(_0x4b9b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4b9b('0xa'));var squel=require(_0x4b9b('0xb'));var crypto=require('crypto');var jsforce=require(_0x4b9b('0xc'));var deskjs=require(_0x4b9b('0xd'));var toCsv=require(_0x4b9b('0x9'));var querystring=require('querystring');var Papa=require(_0x4b9b('0xe'));var Redis=require(_0x4b9b('0xf'));var authService=require(_0x4b9b('0x10'));var qs=require(_0x4b9b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4b9b('0x12'));var utils=require(_0x4b9b('0x13'));var config=require(_0x4b9b('0x14'));var licenseUtil=require(_0x4b9b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d87f6,_0x30051b){_0x30051b=_0x30051b||0xcc;return function(_0x5bc30b){if(_0x5bc30b){return _0x5d87f6[_0x4b9b('0x16')](_0x30051b);}return _0x5d87f6['status'](_0x30051b)['end']();};}function respondWithResult(_0xead097,_0x2e5338){_0x2e5338=_0x2e5338||0xc8;return function(_0x25140e){if(_0x25140e){return _0xead097[_0x4b9b('0x17')](_0x2e5338)['json'](_0x25140e);}};}function respondWithFilteredResult(_0x405a51,_0x5186a0){return function(_0x442656){if(_0x442656){var _0x3e342e=_0x442656['count'],_0x4b974c=_0x5186a0[_0x4b9b('0x18')],_0x5b9497=_0x5186a0[_0x4b9b('0x18')]+_0x5186a0['limit'],_0x3b1953;if(_0x5b9497>=_0x3e342e){_0x5b9497=_0x3e342e;_0x3b1953=0xc8;}else{_0x3b1953=0xce;}_0x405a51[_0x4b9b('0x17')](_0x3b1953);return _0x405a51['set'](_0x4b9b('0x19'),_0x4b974c+'-'+_0x5b9497+'/'+_0x3e342e)[_0x4b9b('0x1a')](_0x442656);}return null;};}function patchUpdates(_0x34572e){return function(_0x56489e){try{jsonpatch['apply'](_0x56489e,_0x34572e,!![]);}catch(_0x4f094f){return BPromise[_0x4b9b('0x1b')](_0x4f094f);}return _0x56489e[_0x4b9b('0x1c')]();};}function saveUpdates(_0x15c795,_0x2676fe){return function(_0x36293c){if(_0x36293c){return _0x36293c['update'](_0x15c795)[_0x4b9b('0x1d')](function(_0x535703){return _0x535703;});}return null;};}function removeEntity(_0x10cf74,_0xa05e03){return function(_0xfdbbf){if(_0xfdbbf){return _0xfdbbf[_0x4b9b('0x1e')]()[_0x4b9b('0x1d')](function(){var _0x13319e=_0xfdbbf[_0x4b9b('0x1f')]({'plain':!![]});var _0x10615d=_0x4b9b('0x20');return db['UserProfileResource'][_0x4b9b('0x1e')]({'where':{'type':_0x10615d,'resourceId':_0x13319e['id']}})[_0x4b9b('0x1d')](function(){return _0xfdbbf;});})['then'](function(){_0x10cf74[_0x4b9b('0x17')](0xcc)[_0x4b9b('0x21')]();});}};}function handleEntityNotFound(_0x435df5,_0xaacabe){return function(_0x7d4fdd){if(!_0x7d4fdd){_0x435df5['sendStatus'](0x194);}return _0x7d4fdd;};}function handleError(_0x2b184f,_0x2c5330){_0x2c5330=_0x2c5330||0x1f4;return function(_0x2a87e7){logger[_0x4b9b('0x22')](_0x2a87e7['stack']);if(_0x2a87e7[_0x4b9b('0x23')]){delete _0x2a87e7[_0x4b9b('0x23')];}_0x2b184f[_0x4b9b('0x17')](_0x2c5330)[_0x4b9b('0x24')](_0x2a87e7);};}exports['index']=function(_0xa11164,_0x33cc9e){var _0x107185={},_0xc65d0={},_0x514fbf={'count':0x0,'rows':[]};var _0x6065e7=_[_0x4b9b('0x25')](db[_0x4b9b('0x26')]['rawAttributes'],function(_0x2bd1e0){return{'name':_0x2bd1e0[_0x4b9b('0x27')],'type':_0x2bd1e0['type'][_0x4b9b('0x28')]};});_0xc65d0[_0x4b9b('0x29')]=_[_0x4b9b('0x25')](_0x6065e7,_0x4b9b('0x23'));_0xc65d0[_0x4b9b('0x2a')]=_[_0x4b9b('0x2b')](_0xa11164[_0x4b9b('0x2a')]);_0xc65d0['filters']=_[_0x4b9b('0x2c')](_0xc65d0[_0x4b9b('0x29')],_0xc65d0[_0x4b9b('0x2a')]);_0x107185['attributes']=_[_0x4b9b('0x2c')](_0xc65d0[_0x4b9b('0x29')],qs[_0x4b9b('0x2d')](_0xa11164[_0x4b9b('0x2a')]['fields']));_0x107185['attributes']=_0x107185[_0x4b9b('0x2e')][_0x4b9b('0x2f')]?_0x107185[_0x4b9b('0x2e')]:_0xc65d0[_0x4b9b('0x29')];if(!_0xa11164[_0x4b9b('0x2a')]['hasOwnProperty'](_0x4b9b('0x30'))){_0x107185[_0x4b9b('0x31')]=qs[_0x4b9b('0x31')](_0xa11164[_0x4b9b('0x2a')][_0x4b9b('0x31')]);_0x107185['offset']=qs[_0x4b9b('0x18')](_0xa11164[_0x4b9b('0x2a')][_0x4b9b('0x18')]);}_0x107185[_0x4b9b('0x32')]=qs['sort'](_0xa11164[_0x4b9b('0x2a')][_0x4b9b('0x33')]);_0x107185[_0x4b9b('0x34')]=qs[_0x4b9b('0x35')](_['pick'](_0xa11164[_0x4b9b('0x2a')],_0xc65d0[_0x4b9b('0x35')]),_0x6065e7);if(_0xa11164[_0x4b9b('0x2a')][_0x4b9b('0x36')]){_0x107185[_0x4b9b('0x34')]=_[_0x4b9b('0x37')](_0x107185[_0x4b9b('0x34')],{'$or':_['map'](_0x6065e7,function(_0x10516c){if(_0x10516c[_0x4b9b('0x38')]!==_0x4b9b('0x39')){var _0x4b7ba6={};_0x4b7ba6[_0x10516c[_0x4b9b('0x23')]]={'$like':'%'+_0xa11164[_0x4b9b('0x2a')]['filter']+'%'};return _0x4b7ba6;}})});}_0x107185=_[_0x4b9b('0x37')]({},_0x107185,_0xa11164[_0x4b9b('0x3a')]);var _0x585047={'where':_0x107185['where']};return db[_0x4b9b('0x26')]['count'](_0x585047)[_0x4b9b('0x1d')](function(_0x502e1f){_0x514fbf[_0x4b9b('0x3b')]=_0x502e1f;if(_0xa11164[_0x4b9b('0x2a')]['includeAll']){_0x107185[_0x4b9b('0x3c')]=[{'all':!![]}];}return db[_0x4b9b('0x26')][_0x4b9b('0x3d')](_0x107185);})['then'](function(_0x5a2b66){_0x514fbf[_0x4b9b('0x3e')]=_0x5a2b66;return _0x514fbf;})[_0x4b9b('0x1d')](respondWithFilteredResult(_0x33cc9e,_0x107185))[_0x4b9b('0x3f')](handleError(_0x33cc9e,null));};exports[_0x4b9b('0x40')]=function(_0x158d7d,_0x10cf99){var _0x5ed1b6={'raw':!![],'where':{'id':_0x158d7d[_0x4b9b('0x41')]['id']}},_0x4638d7={};_0x4638d7[_0x4b9b('0x29')]=_[_0x4b9b('0x2b')](db[_0x4b9b('0x26')][_0x4b9b('0x42')]);_0x4638d7[_0x4b9b('0x2a')]=_[_0x4b9b('0x2b')](_0x158d7d[_0x4b9b('0x2a')]);_0x4638d7[_0x4b9b('0x35')]=_[_0x4b9b('0x2c')](_0x4638d7['model'],_0x4638d7[_0x4b9b('0x2a')]);_0x5ed1b6[_0x4b9b('0x2e')]=_[_0x4b9b('0x2c')](_0x4638d7[_0x4b9b('0x29')],qs[_0x4b9b('0x2d')](_0x158d7d[_0x4b9b('0x2a')]['fields']));_0x5ed1b6[_0x4b9b('0x2e')]=_0x5ed1b6[_0x4b9b('0x2e')][_0x4b9b('0x2f')]?_0x5ed1b6[_0x4b9b('0x2e')]:_0x4638d7[_0x4b9b('0x29')];if(_0x158d7d[_0x4b9b('0x2a')][_0x4b9b('0x43')]){_0x5ed1b6[_0x4b9b('0x3c')]=[{'all':!![]}];}_0x5ed1b6=_['merge']({},_0x5ed1b6,_0x158d7d[_0x4b9b('0x3a')]);return db[_0x4b9b('0x26')][_0x4b9b('0x44')](_0x5ed1b6)[_0x4b9b('0x1d')](handleEntityNotFound(_0x10cf99,null))[_0x4b9b('0x1d')](respondWithResult(_0x10cf99,null))['catch'](handleError(_0x10cf99,null));};exports[_0x4b9b('0x45')]=function(_0x1f060e,_0x497b31){return db[_0x4b9b('0x26')][_0x4b9b('0x45')](_0x1f060e[_0x4b9b('0x46')],{})['then'](function(_0xde800c){var _0x52d7a6=_0x1f060e[_0x4b9b('0x47')][_0x4b9b('0x1f')]({'plain':!![]});if(!_0x52d7a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52d7a6['role']==='user'){var _0x45db0f=_0xde800c[_0x4b9b('0x1f')]({'plain':!![]});var _0x43dbad=_0x4b9b('0x20');return db[_0x4b9b('0x48')][_0x4b9b('0x44')]({'where':{'name':_0x43dbad,'userProfileId':_0x52d7a6[_0x4b9b('0x49')]},'raw':!![]})[_0x4b9b('0x1d')](function(_0xf73c0){if(_0xf73c0&&_0xf73c0['autoAssociation']===0x0){return db[_0x4b9b('0x4a')][_0x4b9b('0x45')]({'name':_0x45db0f['name'],'resourceId':_0x45db0f['id'],'type':_0xf73c0['name'],'sectionId':_0xf73c0['id']},{})[_0x4b9b('0x1d')](function(){return _0xde800c;});}else{return _0xde800c;}})['catch'](function(_0x2ed11a){logger['error'](_0x4b9b('0x4b'),_0x2ed11a);throw _0x2ed11a;});}return _0xde800c;})[_0x4b9b('0x1d')](respondWithResult(_0x497b31,0xc9))[_0x4b9b('0x3f')](handleError(_0x497b31,null));};exports[_0x4b9b('0x4c')]=function(_0x4b4e47,_0x3f81b7){if(_0x4b4e47['body']['id']){delete _0x4b4e47['body']['id'];}return db[_0x4b9b('0x26')]['find']({'where':{'id':_0x4b4e47[_0x4b9b('0x41')]['id']}})[_0x4b9b('0x1d')](handleEntityNotFound(_0x3f81b7,null))['then'](saveUpdates(_0x4b4e47['body'],null))[_0x4b9b('0x1d')](respondWithResult(_0x3f81b7,null))['catch'](handleError(_0x3f81b7,null));};exports[_0x4b9b('0x1e')]=function(_0x54b6a0,_0x9257c0){return db[_0x4b9b('0x26')]['find']({'where':{'id':_0x54b6a0[_0x4b9b('0x41')]['id']}})['then'](handleEntityNotFound(_0x9257c0,null))[_0x4b9b('0x1d')](removeEntity(_0x9257c0,null))[_0x4b9b('0x3f')](handleError(_0x9257c0,null));}; \ No newline at end of file +var _0x6c3e=['update','then','destroy','get','error','stack','name','send','index','UserWhatsappInteraction','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','show','params','keys','length','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserWhatsappInteractions','UserProfileSection','autoAssociation','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','reject','save'];(function(_0x2b28cd,_0x5dae8e){var _0x273ef1=function(_0x2a2ddc){while(--_0x2a2ddc){_0x2b28cd['push'](_0x2b28cd['shift']());}};_0x273ef1(++_0x5dae8e);}(_0x6c3e,0x1c9));var _0xe6c3=function(_0x1c7d57,_0x14141e){_0x1c7d57=_0x1c7d57-0x0;var _0x4f78db=_0x6c3e[_0x1c7d57];return _0x4f78db;};'use strict';var pdf=require(_0xe6c3('0x0'));var emlformat=require(_0xe6c3('0x1'));var rimraf=require(_0xe6c3('0x2'));var zipdir=require(_0xe6c3('0x3'));var jsonpatch=require(_0xe6c3('0x4'));var rp=require('request-promise');var moment=require(_0xe6c3('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe6c3('0x6'));var path=require(_0xe6c3('0x7'));var sox=require(_0xe6c3('0x8'));var csv=require(_0xe6c3('0x9'));var ejs=require(_0xe6c3('0xa'));var fs=require('fs');var _=require(_0xe6c3('0xb'));var squel=require(_0xe6c3('0xc'));var crypto=require(_0xe6c3('0xd'));var jsforce=require(_0xe6c3('0xe'));var deskjs=require(_0xe6c3('0xf'));var toCsv=require(_0xe6c3('0x9'));var querystring=require(_0xe6c3('0x10'));var Papa=require(_0xe6c3('0x11'));var Redis=require(_0xe6c3('0x12'));var authService=require(_0xe6c3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe6c3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6c3('0x15'))(_0xe6c3('0x16'));var utils=require(_0xe6c3('0x17'));var config=require(_0xe6c3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6c3('0x19'))['db'];function respondWithStatusCode(_0x3ba908,_0x470490){_0x470490=_0x470490||0xcc;return function(_0x1c54df){if(_0x1c54df){return _0x3ba908[_0xe6c3('0x1a')](_0x470490);}return _0x3ba908[_0xe6c3('0x1b')](_0x470490)['end']();};}function respondWithResult(_0x3e2b4a,_0x316386){_0x316386=_0x316386||0xc8;return function(_0x2b4377){if(_0x2b4377){return _0x3e2b4a[_0xe6c3('0x1b')](_0x316386)['json'](_0x2b4377);}};}function respondWithFilteredResult(_0x2f7ba8,_0x21f938){return function(_0x4b36fb){if(_0x4b36fb){var _0x4b7d2d=_0x4b36fb[_0xe6c3('0x1c')],_0x3c301f=_0x21f938[_0xe6c3('0x1d')],_0x1c4225=_0x21f938['offset']+_0x21f938[_0xe6c3('0x1e')],_0x593065;if(_0x1c4225>=_0x4b7d2d){_0x1c4225=_0x4b7d2d;_0x593065=0xc8;}else{_0x593065=0xce;}_0x2f7ba8[_0xe6c3('0x1b')](_0x593065);return _0x2f7ba8[_0xe6c3('0x1f')](_0xe6c3('0x20'),_0x3c301f+'-'+_0x1c4225+'/'+_0x4b7d2d)['json'](_0x4b36fb);}return null;};}function patchUpdates(_0x2dba90){return function(_0x319f00){try{jsonpatch['apply'](_0x319f00,_0x2dba90,!![]);}catch(_0x24e646){return BPromise[_0xe6c3('0x21')](_0x24e646);}return _0x319f00[_0xe6c3('0x22')]();};}function saveUpdates(_0x40b821,_0x409130){return function(_0x244130){if(_0x244130){return _0x244130[_0xe6c3('0x23')](_0x40b821)[_0xe6c3('0x24')](function(_0x1d9327){return _0x1d9327;});}return null;};}function removeEntity(_0x1fe576,_0x238718){return function(_0x570866){if(_0x570866){return _0x570866[_0xe6c3('0x25')]()[_0xe6c3('0x24')](function(){var _0x16c864=_0x570866[_0xe6c3('0x26')]({'plain':!![]});var _0x58051a='UserWhatsappInteractions';return db['UserProfileResource'][_0xe6c3('0x25')]({'where':{'type':_0x58051a,'resourceId':_0x16c864['id']}})[_0xe6c3('0x24')](function(){return _0x570866;});})[_0xe6c3('0x24')](function(){_0x1fe576[_0xe6c3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c19cf,_0x5a3a40){return function(_0x31911f){if(!_0x31911f){_0x2c19cf[_0xe6c3('0x1a')](0x194);}return _0x31911f;};}function handleError(_0x4ac1b2,_0x2b840c){_0x2b840c=_0x2b840c||0x1f4;return function(_0x20812a){logger[_0xe6c3('0x27')](_0x20812a[_0xe6c3('0x28')]);if(_0x20812a[_0xe6c3('0x29')]){delete _0x20812a[_0xe6c3('0x29')];}_0x4ac1b2[_0xe6c3('0x1b')](_0x2b840c)[_0xe6c3('0x2a')](_0x20812a);};}exports[_0xe6c3('0x2b')]=function(_0x4d2303,_0x38e0cf){var _0x1a63c3={},_0x12f8b3={},_0x47b341={'count':0x0,'rows':[]};var _0x3567e3=_['map'](db[_0xe6c3('0x2c')][_0xe6c3('0x2d')],function(_0x272fe8){return{'name':_0x272fe8[_0xe6c3('0x2e')],'type':_0x272fe8[_0xe6c3('0x2f')][_0xe6c3('0x30')]};});_0x12f8b3[_0xe6c3('0x31')]=_[_0xe6c3('0x32')](_0x3567e3,_0xe6c3('0x29'));_0x12f8b3[_0xe6c3('0x33')]=_['keys'](_0x4d2303[_0xe6c3('0x33')]);_0x12f8b3[_0xe6c3('0x34')]=_[_0xe6c3('0x35')](_0x12f8b3[_0xe6c3('0x31')],_0x12f8b3[_0xe6c3('0x33')]);_0x1a63c3['attributes']=_['intersection'](_0x12f8b3['model'],qs[_0xe6c3('0x36')](_0x4d2303[_0xe6c3('0x33')][_0xe6c3('0x36')]));_0x1a63c3[_0xe6c3('0x37')]=_0x1a63c3[_0xe6c3('0x37')]['length']?_0x1a63c3[_0xe6c3('0x37')]:_0x12f8b3[_0xe6c3('0x31')];if(!_0x4d2303[_0xe6c3('0x33')][_0xe6c3('0x38')](_0xe6c3('0x39'))){_0x1a63c3['limit']=qs[_0xe6c3('0x1e')](_0x4d2303[_0xe6c3('0x33')][_0xe6c3('0x1e')]);_0x1a63c3[_0xe6c3('0x1d')]=qs[_0xe6c3('0x1d')](_0x4d2303['query']['offset']);}_0x1a63c3[_0xe6c3('0x3a')]=qs['sort'](_0x4d2303['query'][_0xe6c3('0x3b')]);_0x1a63c3[_0xe6c3('0x3c')]=qs[_0xe6c3('0x34')](_['pick'](_0x4d2303[_0xe6c3('0x33')],_0x12f8b3[_0xe6c3('0x34')]),_0x3567e3);if(_0x4d2303[_0xe6c3('0x33')][_0xe6c3('0x3d')]){_0x1a63c3[_0xe6c3('0x3c')]=_[_0xe6c3('0x3e')](_0x1a63c3['where'],{'$or':_['map'](_0x3567e3,function(_0xd9d25f){if(_0xd9d25f['type']!=='VIRTUAL'){var _0x178cd1={};_0x178cd1[_0xd9d25f[_0xe6c3('0x29')]]={'$like':'%'+_0x4d2303[_0xe6c3('0x33')][_0xe6c3('0x3d')]+'%'};return _0x178cd1;}})});}_0x1a63c3=_[_0xe6c3('0x3e')]({},_0x1a63c3,_0x4d2303[_0xe6c3('0x3f')]);var _0x2f9ddb={'where':_0x1a63c3[_0xe6c3('0x3c')]};return db[_0xe6c3('0x2c')][_0xe6c3('0x1c')](_0x2f9ddb)['then'](function(_0x48487a){_0x47b341[_0xe6c3('0x1c')]=_0x48487a;if(_0x4d2303[_0xe6c3('0x33')]['includeAll']){_0x1a63c3[_0xe6c3('0x40')]=[{'all':!![]}];}return db[_0xe6c3('0x2c')][_0xe6c3('0x41')](_0x1a63c3);})['then'](function(_0x447a53){_0x47b341[_0xe6c3('0x42')]=_0x447a53;return _0x47b341;})[_0xe6c3('0x24')](respondWithFilteredResult(_0x38e0cf,_0x1a63c3))['catch'](handleError(_0x38e0cf,null));};exports[_0xe6c3('0x43')]=function(_0x2c7fdf,_0x46c5c3){var _0x20a8cc={'raw':!![],'where':{'id':_0x2c7fdf[_0xe6c3('0x44')]['id']}},_0x517b54={};_0x517b54[_0xe6c3('0x31')]=_[_0xe6c3('0x45')](db['UserWhatsappInteraction'][_0xe6c3('0x2d')]);_0x517b54[_0xe6c3('0x33')]=_[_0xe6c3('0x45')](_0x2c7fdf[_0xe6c3('0x33')]);_0x517b54['filters']=_['intersection'](_0x517b54[_0xe6c3('0x31')],_0x517b54[_0xe6c3('0x33')]);_0x20a8cc['attributes']=_[_0xe6c3('0x35')](_0x517b54['model'],qs[_0xe6c3('0x36')](_0x2c7fdf[_0xe6c3('0x33')][_0xe6c3('0x36')]));_0x20a8cc[_0xe6c3('0x37')]=_0x20a8cc[_0xe6c3('0x37')][_0xe6c3('0x46')]?_0x20a8cc['attributes']:_0x517b54[_0xe6c3('0x31')];if(_0x2c7fdf[_0xe6c3('0x33')][_0xe6c3('0x47')]){_0x20a8cc[_0xe6c3('0x40')]=[{'all':!![]}];}_0x20a8cc=_[_0xe6c3('0x3e')]({},_0x20a8cc,_0x2c7fdf[_0xe6c3('0x3f')]);return db[_0xe6c3('0x2c')][_0xe6c3('0x48')](_0x20a8cc)[_0xe6c3('0x24')](handleEntityNotFound(_0x46c5c3,null))[_0xe6c3('0x24')](respondWithResult(_0x46c5c3,null))[_0xe6c3('0x49')](handleError(_0x46c5c3,null));};exports[_0xe6c3('0x4a')]=function(_0x557e16,_0x49a6e7){return db[_0xe6c3('0x2c')][_0xe6c3('0x4a')](_0x557e16['body'],{})[_0xe6c3('0x24')](function(_0x9864e){var _0x2d5413=_0x557e16[_0xe6c3('0x4b')][_0xe6c3('0x26')]({'plain':!![]});if(!_0x2d5413)throw new Error(_0xe6c3('0x4c'));if(_0x2d5413[_0xe6c3('0x4d')]==='user'){var _0x4b9d68=_0x9864e['get']({'plain':!![]});var _0x1ba97d=_0xe6c3('0x4e');return db[_0xe6c3('0x4f')]['find']({'where':{'name':_0x1ba97d,'userProfileId':_0x2d5413['userProfileId']},'raw':!![]})[_0xe6c3('0x24')](function(_0x1ec818){if(_0x1ec818&&_0x1ec818[_0xe6c3('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x4b9d68[_0xe6c3('0x29')],'resourceId':_0x4b9d68['id'],'type':_0x1ec818[_0xe6c3('0x29')],'sectionId':_0x1ec818['id']},{})['then'](function(){return _0x9864e;});}else{return _0x9864e;}})[_0xe6c3('0x49')](function(_0x108851){logger[_0xe6c3('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x108851);throw _0x108851;});}return _0x9864e;})[_0xe6c3('0x24')](respondWithResult(_0x49a6e7,0xc9))['catch'](handleError(_0x49a6e7,null));};exports[_0xe6c3('0x23')]=function(_0x2aff74,_0x5e903b){if(_0x2aff74['body']['id']){delete _0x2aff74['body']['id'];}return db[_0xe6c3('0x2c')][_0xe6c3('0x48')]({'where':{'id':_0x2aff74[_0xe6c3('0x44')]['id']}})[_0xe6c3('0x24')](handleEntityNotFound(_0x5e903b,null))[_0xe6c3('0x24')](saveUpdates(_0x2aff74[_0xe6c3('0x51')],null))['then'](respondWithResult(_0x5e903b,null))['catch'](handleError(_0x5e903b,null));};exports[_0xe6c3('0x25')]=function(_0x5b302f,_0x4b4173){return db['UserWhatsappInteraction']['find']({'where':{'id':_0x5b302f[_0xe6c3('0x44')]['id']}})[_0xe6c3('0x24')](handleEntityNotFound(_0x4b4173,null))[_0xe6c3('0x24')](removeEntity(_0x4b4173,null))['catch'](handleError(_0x4b4173,null));}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js index 98c9e77..b7d9e72 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 _0x2eb0=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./UserWhatsappInteraction.attributes','UserWhatsappInteraction'];(function(_0x67f6f,_0xe598d9){var _0x306716=function(_0x26b8bc){while(--_0x26b8bc){_0x67f6f['push'](_0x67f6f['shift']());}};_0x306716(++_0xe598d9);}(_0x2eb0,0x1d6));var _0x02eb=function(_0x148ff6,_0x377c0e){_0x148ff6=_0x148ff6-0x0;var _0x3aa3c8=_0x2eb0[_0x148ff6];return _0x3aa3c8;};'use strict';var _=require(_0x02eb('0x0'));var util=require(_0x02eb('0x1'));var logger=require(_0x02eb('0x2'))('api');var moment=require(_0x02eb('0x3'));var BPromise=require(_0x02eb('0x4'));var rp=require(_0x02eb('0x5'));var fs=require('fs');var path=require(_0x02eb('0x6'));var rimraf=require(_0x02eb('0x7'));var config=require('../../config/environment');var attributes=require(_0x02eb('0x8'));module['exports']=function(_0xcf6a8e,_0xb36eff){return _0xcf6a8e['define'](_0x02eb('0x9'),attributes,{'tableName':'user_has_whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b2e=['./UserWhatsappInteraction.attributes','exports','define','UserWhatsappInteraction','user_has_whatsapp_interactions','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3725ff,_0x2f8366){var _0x3e6746=function(_0x34dacd){while(--_0x34dacd){_0x3725ff['push'](_0x3725ff['shift']());}};_0x3e6746(++_0x2f8366);}(_0x9b2e,0xe9));var _0xe9b2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9b2e[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xe9b2('0x0'));var util=require(_0xe9b2('0x1'));var logger=require(_0xe9b2('0x2'))(_0xe9b2('0x3'));var moment=require(_0xe9b2('0x4'));var BPromise=require('bluebird');var rp=require(_0xe9b2('0x5'));var fs=require('fs');var path=require(_0xe9b2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe9b2('0x7'));module[_0xe9b2('0x8')]=function(_0x905c18,_0x124593){return _0x905c18[_0xe9b2('0x9')](_0xe9b2('0xa'),attributes,{'tableName':_0xe9b2('0xb'),'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 1da5767..428ff8e 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 _0xa8d6=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappInteraction,\x20%s,\x20%s','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','randomstring','../../config/logger'];(function(_0x5b5f75,_0x468d75){var _0x52fd79=function(_0x2d0fa0){while(--_0x2d0fa0){_0x5b5f75['push'](_0x5b5f75['shift']());}};_0x52fd79(++_0x468d75);}(_0xa8d6,0x18b));var _0x6a8d=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xa8d6[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x6a8d('0x0'));var util=require(_0x6a8d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6a8d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6a8d('0x3'))(_0x6a8d('0x4'));var config=require(_0x6a8d('0x5'));var jayson=require(_0x6a8d('0x6'));var client=jayson[_0x6a8d('0x7')][_0x6a8d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b4bcd,_0x2dd18c,_0x6a09bd){return new BPromise(function(_0x6b4c2e,_0x382367){return client[_0x6a8d('0x9')](_0x3b4bcd,_0x6a09bd)[_0x6a8d('0xa')](function(_0x346d4b){logger[_0x6a8d('0xb')](_0x6a8d('0xc'),_0x2dd18c,'request\x20sent');logger[_0x6a8d('0xd')](_0x6a8d('0xe'),_0x2dd18c,'request\x20sent',JSON[_0x6a8d('0xf')](_0x346d4b));if(_0x346d4b[_0x6a8d('0x10')]){if(_0x346d4b['error']['code']===0x1f4){logger[_0x6a8d('0x10')](_0x6a8d('0xc'),_0x2dd18c,_0x346d4b[_0x6a8d('0x10')][_0x6a8d('0x11')]);return _0x382367(_0x346d4b[_0x6a8d('0x10')][_0x6a8d('0x11')]);}logger['error'](_0x6a8d('0xc'),_0x2dd18c,_0x346d4b[_0x6a8d('0x10')][_0x6a8d('0x11')]);return _0x6b4c2e(_0x346d4b[_0x6a8d('0x10')][_0x6a8d('0x11')]);}else{logger[_0x6a8d('0xb')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x2dd18c,_0x6a8d('0x12'));_0x6b4c2e(_0x346d4b[_0x6a8d('0x13')][_0x6a8d('0x11')]);}})[_0x6a8d('0x14')](function(_0x2a2004){logger[_0x6a8d('0x10')](_0x6a8d('0xc'),_0x2dd18c,_0x2a2004);_0x382367(_0x2a2004);});});} \ No newline at end of file +var _0xe0f8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserWhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4762f0,_0x50b4c1){var _0x5b3012=function(_0x61bb77){while(--_0x61bb77){_0x4762f0['push'](_0x4762f0['shift']());}};_0x5b3012(++_0x50b4c1);}(_0xe0f8,0x6e));var _0x8e0f=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xe0f8[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8e0f('0x0'));var rs=require(_0x8e0f('0x1'));var fs=require('fs');var Redis=require(_0x8e0f('0x2'));var db=require(_0x8e0f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e0f('0x4'))(_0x8e0f('0x5'));var config=require(_0x8e0f('0x6'));var jayson=require(_0x8e0f('0x7'));var client=jayson[_0x8e0f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1df5b0,_0xbcb8bb,_0x48a356){return new BPromise(function(_0x57efea,_0x548866){return client[_0x8e0f('0x9')](_0x1df5b0,_0x48a356)[_0x8e0f('0xa')](function(_0x7b477d){logger[_0x8e0f('0xb')](_0x8e0f('0xc'),_0xbcb8bb,_0x8e0f('0xd'));logger[_0x8e0f('0xe')]('UserWhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xbcb8bb,'request\x20sent',JSON[_0x8e0f('0xf')](_0x7b477d));if(_0x7b477d[_0x8e0f('0x10')]){if(_0x7b477d[_0x8e0f('0x10')]['code']===0x1f4){logger['error'](_0x8e0f('0xc'),_0xbcb8bb,_0x7b477d[_0x8e0f('0x10')][_0x8e0f('0x11')]);return _0x548866(_0x7b477d[_0x8e0f('0x10')][_0x8e0f('0x11')]);}logger[_0x8e0f('0x10')](_0x8e0f('0xc'),_0xbcb8bb,_0x7b477d[_0x8e0f('0x10')][_0x8e0f('0x11')]);return _0x57efea(_0x7b477d['error']['message']);}else{logger['info'](_0x8e0f('0xc'),_0xbcb8bb,_0x8e0f('0xd'));_0x57efea(_0x7b477d[_0x8e0f('0x12')]['message']);}})['catch'](function(_0x23a792){logger['error'](_0x8e0f('0xc'),_0xbcb8bb,_0x23a792);_0x548866(_0x23a792);});});} \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/index.js b/server/api/UserWhatsappInteraction/index.js index f68fe0f..64ca5bb 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 _0xc2e8=['multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','create','put','/:id','update','delete','destroy','exports'];(function(_0x5c1da0,_0x38529f){var _0x12bf5e=function(_0x2471fe){while(--_0x2471fe){_0x5c1da0['push'](_0x5c1da0['shift']());}};_0x12bf5e(++_0x38529f);}(_0xc2e8,0x70));var _0x8c2e=function(_0x59d375,_0x33e59c){_0x59d375=_0x59d375-0x0;var _0x570a20=_0xc2e8[_0x59d375];return _0x570a20;};'use strict';var multer=require(_0x8c2e('0x0'));var util=require(_0x8c2e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8c2e('0x2'));var router=express['Router']();var auth=require(_0x8c2e('0x3'));var interaction=require(_0x8c2e('0x4'));var config=require(_0x8c2e('0x5'));var controller=require('./UserWhatsappInteraction.controller');router[_0x8c2e('0x6')]('/',auth[_0x8c2e('0x7')](),controller[_0x8c2e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x8c2e('0x7')](),controller[_0x8c2e('0x9')]);router[_0x8c2e('0xa')](_0x8c2e('0xb'),auth[_0x8c2e('0x7')](),controller[_0x8c2e('0xc')]);router[_0x8c2e('0xd')](_0x8c2e('0xb'),auth['isAuthenticated'](),controller[_0x8c2e('0xe')]);module[_0x8c2e('0xf')]=router; \ No newline at end of file +var _0x00b3=['get','isAuthenticated','index','show','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x57abbd,_0xe79e74){var _0x22f54c=function(_0x2c37a7){while(--_0x2c37a7){_0x57abbd['push'](_0x57abbd['shift']());}};_0x22f54c(++_0xe79e74);}(_0x00b3,0x17a));var _0x300b=function(_0x3b7a14,_0x14e11e){_0x3b7a14=_0x3b7a14-0x0;var _0x50dbf7=_0x00b3[_0x3b7a14];return _0x50dbf7;};'use strict';var multer=require('multer');var util=require(_0x300b('0x0'));var path=require(_0x300b('0x1'));var timeout=require(_0x300b('0x2'));var express=require(_0x300b('0x3'));var router=express['Router']();var auth=require(_0x300b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x300b('0x5'));var controller=require('./UserWhatsappInteraction.controller');router[_0x300b('0x6')]('/',auth[_0x300b('0x7')](),controller[_0x300b('0x8')]);router[_0x300b('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x300b('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x300b('0xa')]);router[_0x300b('0xb')](_0x300b('0xc'),auth['isAuthenticated'](),controller[_0x300b('0xd')]);router[_0x300b('0xe')](_0x300b('0xc'),auth[_0x300b('0x7')](),controller['destroy']);module[_0x300b('0xf')]=router; \ No newline at end of file diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index f01d014..4b9ac75 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 _0xfd9f=['urlForward','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]','sequelize','exports','VIRTUAL','getDataValue','action','contactManager','integration','motionbar'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xfd9f,0xa2));var _0xffd9=function(_0x1f41b9,_0x5661e5){_0x1f41b9=_0x1f41b9-0x0;var _0x1ede03=_0xfd9f[_0x1f41b9];return _0x1ede03;};'use strict';var Sequelize=require(_0xffd9('0x0'));module[_0xffd9('0x1')]={'name':{'type':Sequelize[_0xffd9('0x2')],'get':function(_0x50a0fa){return this[_0xffd9('0x3')](_0xffd9('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xffd9('0x5'),_0xffd9('0x6'),_0xffd9('0x7'),'jscripty',_0xffd9('0x8'),_0xffd9('0x9'),_0xffd9('0xa'),_0xffd9('0xb')]],'msg':_0xffd9('0xc')}},'comment':_0xffd9('0xc')},'data1':{'type':Sequelize[_0xffd9('0xd')](0x1000),'comment':_0xffd9('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xffd9('0xf')},'data3':{'type':Sequelize[_0xffd9('0xd')](0x1000),'comment':_0xffd9('0x10')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0xffd9('0xd')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7eb4=['STRING','contactManager','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','VIRTUAL','action'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7eb4,0x14e));var _0x47eb=function(_0x9db328,_0x230939){_0x9db328=_0x9db328-0x0;var _0x14ffcf=_0x7eb4[_0x9db328];return _0x14ffcf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x47eb('0x0')],'get':function(_0x1b990f){return this['getDataValue'](_0x47eb('0x1'));}},'action':{'type':Sequelize[_0x47eb('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x47eb('0x3'),'integration',_0x47eb('0x4'),_0x47eb('0x5'),_0x47eb('0x6'),'browser',_0x47eb('0x7'),_0x47eb('0x8')]],'msg':_0x47eb('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x47eb('0xa')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x47eb('0xb')},'data4':{'type':Sequelize[_0x47eb('0x2')](0x1000)},'data5':{'type':Sequelize[_0x47eb('0x2')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 7378134..b9d78fd 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 _0x598a=['eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','update','then','sendStatus','error','name','Action','find','body','destroy','catch','html-pdf'];(function(_0xcbd79c,_0x387d8a){var _0x22277d=function(_0x35a795){while(--_0x35a795){_0xcbd79c['push'](_0xcbd79c['shift']());}};_0x22277d(++_0x387d8a);}(_0x598a,0xfb));var _0xa598=function(_0x48b955,_0x1a99b8){_0x48b955=_0x48b955-0x0;var _0x5317cb=_0x598a[_0x48b955];return _0x5317cb;};'use strict';var pdf=require(_0xa598('0x0'));var emlformat=require(_0xa598('0x1'));var rimraf=require(_0xa598('0x2'));var zipdir=require(_0xa598('0x3'));var jsonpatch=require(_0xa598('0x4'));var rp=require('request-promise');var moment=require(_0xa598('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa598('0x6'));var sox=require(_0xa598('0x7'));var csv=require(_0xa598('0x8'));var ejs=require(_0xa598('0x9'));var fs=require('fs');var _=require(_0xa598('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa598('0xb'));var deskjs=require(_0xa598('0xc'));var toCsv=require(_0xa598('0x8'));var querystring=require(_0xa598('0xd'));var Papa=require(_0xa598('0xe'));var Redis=require(_0xa598('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa598('0x10'));var hardwareService=require(_0xa598('0x11'));var logger=require(_0xa598('0x12'))(_0xa598('0x13'));var utils=require(_0xa598('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa598('0x15'));var db=require(_0xa598('0x16'))['db'];function respondWithStatusCode(_0x468710,_0x5041d4){_0x5041d4=_0x5041d4||0xcc;return function(_0xe8f905){if(_0xe8f905){return _0x468710['sendStatus'](_0x5041d4);}return _0x468710[_0xa598('0x17')](_0x5041d4)[_0xa598('0x18')]();};}function respondWithResult(_0xb3288a,_0x38afa9){_0x38afa9=_0x38afa9||0xc8;return function(_0x1949b5){if(_0x1949b5){return _0xb3288a[_0xa598('0x17')](_0x38afa9)[_0xa598('0x19')](_0x1949b5);}};}function respondWithFilteredResult(_0x41d3fe,_0x28534a){return function(_0x4b100b){if(_0x4b100b){var _0x88df86=_0x4b100b[_0xa598('0x1a')],_0x82a6cc=_0x28534a[_0xa598('0x1b')],_0x6e6ff5=_0x28534a[_0xa598('0x1b')]+_0x28534a[_0xa598('0x1c')],_0x27c34e;if(_0x6e6ff5>=_0x88df86){_0x6e6ff5=_0x88df86;_0x27c34e=0xc8;}else{_0x27c34e=0xce;}_0x41d3fe[_0xa598('0x17')](_0x27c34e);return _0x41d3fe[_0xa598('0x1d')]('Content-Range',_0x82a6cc+'-'+_0x6e6ff5+'/'+_0x88df86)[_0xa598('0x19')](_0x4b100b);}return null;};}function patchUpdates(_0x80e1ad){return function(_0x3fd5a4){try{jsonpatch[_0xa598('0x1e')](_0x3fd5a4,_0x80e1ad,!![]);}catch(_0x2ad4ff){return BPromise[_0xa598('0x1f')](_0x2ad4ff);}return _0x3fd5a4['save']();};}function saveUpdates(_0x56fc63,_0x2923d5){return function(_0x47e84d){if(_0x47e84d){return _0x47e84d[_0xa598('0x20')](_0x56fc63)[_0xa598('0x21')](function(_0x399f23){return _0x399f23;});}return null;};}function removeEntity(_0x2222b0,_0x261868){return function(_0x24f4f0){if(_0x24f4f0){return _0x24f4f0['destroy']()[_0xa598('0x21')](function(){_0x2222b0[_0xa598('0x17')](0xcc)[_0xa598('0x18')]();});}};}function handleEntityNotFound(_0x14643d,_0x802679){return function(_0x3c533a){if(!_0x3c533a){_0x14643d[_0xa598('0x22')](0x194);}return _0x3c533a;};}function handleError(_0xf366b1,_0x50c9d8){_0x50c9d8=_0x50c9d8||0x1f4;return function(_0x473d07){logger[_0xa598('0x23')](_0x473d07['stack']);if(_0x473d07['name']){delete _0x473d07[_0xa598('0x24')];}_0xf366b1['status'](_0x50c9d8)['send'](_0x473d07);};}exports[_0xa598('0x20')]=function(_0x5918f1,_0x34689e){if(_0x5918f1['body']['id']){delete _0x5918f1['body']['id'];}return db[_0xa598('0x25')][_0xa598('0x26')]({'where':{'id':_0x5918f1['params']['id']}})[_0xa598('0x21')](handleEntityNotFound(_0x34689e,null))[_0xa598('0x21')](saveUpdates(_0x5918f1[_0xa598('0x27')],null))[_0xa598('0x21')](respondWithResult(_0x34689e,null))['catch'](handleError(_0x34689e,null));};exports[_0xa598('0x28')]=function(_0x5ab302,_0x5d70aa){return db['Action'][_0xa598('0x26')]({'where':{'id':_0x5ab302['params']['id']}})[_0xa598('0x21')](handleEntityNotFound(_0x5d70aa,null))[_0xa598('0x21')](removeEntity(_0x5d70aa,null))[_0xa598('0x29')](handleError(_0x5d70aa,null));}; \ No newline at end of file +var _0x3baf=['Action','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','name','body','params'];(function(_0x5a84b2,_0x318c61){var _0xd5404f=function(_0x3347df){while(--_0x3347df){_0x5a84b2['push'](_0x5a84b2['shift']());}};_0xd5404f(++_0x318c61);}(_0x3baf,0xf7));var _0xf3ba=function(_0x9e689c,_0x2600d8){_0x9e689c=_0x9e689c-0x0;var _0x13ee00=_0x3baf[_0x9e689c];return _0x13ee00;};'use strict';var pdf=require(_0xf3ba('0x0'));var emlformat=require(_0xf3ba('0x1'));var rimraf=require(_0xf3ba('0x2'));var zipdir=require(_0xf3ba('0x3'));var jsonpatch=require(_0xf3ba('0x4'));var rp=require(_0xf3ba('0x5'));var moment=require(_0xf3ba('0x6'));var BPromise=require(_0xf3ba('0x7'));var Mustache=require(_0xf3ba('0x8'));var util=require(_0xf3ba('0x9'));var path=require(_0xf3ba('0xa'));var sox=require(_0xf3ba('0xb'));var csv=require(_0xf3ba('0xc'));var ejs=require(_0xf3ba('0xd'));var fs=require('fs');var _=require(_0xf3ba('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf3ba('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf3ba('0x10'));var Papa=require(_0xf3ba('0x11'));var Redis=require(_0xf3ba('0x12'));var authService=require(_0xf3ba('0x13'));var qs=require(_0xf3ba('0x14'));var as=require(_0xf3ba('0x15'));var hardwareService=require(_0xf3ba('0x16'));var logger=require(_0xf3ba('0x17'))(_0xf3ba('0x18'));var utils=require(_0xf3ba('0x19'));var config=require(_0xf3ba('0x1a'));var licenseUtil=require(_0xf3ba('0x1b'));var db=require(_0xf3ba('0x1c'))['db'];function respondWithStatusCode(_0x85939e,_0x26cefe){_0x26cefe=_0x26cefe||0xcc;return function(_0x17673a){if(_0x17673a){return _0x85939e[_0xf3ba('0x1d')](_0x26cefe);}return _0x85939e[_0xf3ba('0x1e')](_0x26cefe)['end']();};}function respondWithResult(_0x327675,_0x56816b){_0x56816b=_0x56816b||0xc8;return function(_0x815037){if(_0x815037){return _0x327675[_0xf3ba('0x1e')](_0x56816b)[_0xf3ba('0x1f')](_0x815037);}};}function respondWithFilteredResult(_0x1e2969,_0x235c8a){return function(_0x53f848){if(_0x53f848){var _0x301856=_0x53f848[_0xf3ba('0x20')],_0x29e45b=_0x235c8a[_0xf3ba('0x21')],_0x13d899=_0x235c8a[_0xf3ba('0x21')]+_0x235c8a[_0xf3ba('0x22')],_0x550dd3;if(_0x13d899>=_0x301856){_0x13d899=_0x301856;_0x550dd3=0xc8;}else{_0x550dd3=0xce;}_0x1e2969['status'](_0x550dd3);return _0x1e2969[_0xf3ba('0x23')](_0xf3ba('0x24'),_0x29e45b+'-'+_0x13d899+'/'+_0x301856)['json'](_0x53f848);}return null;};}function patchUpdates(_0x479d65){return function(_0x35a03c){try{jsonpatch[_0xf3ba('0x25')](_0x35a03c,_0x479d65,!![]);}catch(_0x854fc4){return BPromise['reject'](_0x854fc4);}return _0x35a03c[_0xf3ba('0x26')]();};}function saveUpdates(_0x327723,_0x35d6d4){return function(_0x7ebcea){if(_0x7ebcea){return _0x7ebcea[_0xf3ba('0x27')](_0x327723)[_0xf3ba('0x28')](function(_0x168961){return _0x168961;});}return null;};}function removeEntity(_0x4caf74,_0x4e94a7){return function(_0x4a065a){if(_0x4a065a){return _0x4a065a[_0xf3ba('0x29')]()[_0xf3ba('0x28')](function(){_0x4caf74[_0xf3ba('0x1e')](0xcc)[_0xf3ba('0x2a')]();});}};}function handleEntityNotFound(_0x2cc01a,_0x545ee1){return function(_0x505560){if(!_0x505560){_0x2cc01a[_0xf3ba('0x1d')](0x194);}return _0x505560;};}function handleError(_0xd6c2da,_0x5410a2){_0x5410a2=_0x5410a2||0x1f4;return function(_0x1c9d6a){logger[_0xf3ba('0x2b')](_0x1c9d6a['stack']);if(_0x1c9d6a['name']){delete _0x1c9d6a[_0xf3ba('0x2c')];}_0xd6c2da[_0xf3ba('0x1e')](_0x5410a2)['send'](_0x1c9d6a);};}exports[_0xf3ba('0x27')]=function(_0x318817,_0x15ac44){if(_0x318817['body']['id']){delete _0x318817[_0xf3ba('0x2d')]['id'];}return db['Action']['find']({'where':{'id':_0x318817[_0xf3ba('0x2e')]['id']}})[_0xf3ba('0x28')](handleEntityNotFound(_0x15ac44,null))['then'](saveUpdates(_0x318817[_0xf3ba('0x2d')],null))[_0xf3ba('0x28')](respondWithResult(_0x15ac44,null))['catch'](handleError(_0x15ac44,null));};exports['destroy']=function(_0x49f234,_0x1c6062){return db[_0xf3ba('0x2f')]['find']({'where':{'id':_0x49f234[_0xf3ba('0x2e')]['id']}})['then'](handleEntityNotFound(_0x1c6062,null))['then'](removeEntity(_0x1c6062,null))[_0xf3ba('0x30')](handleError(_0x1c6062,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 956ce1c..b97ee49 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 _0x7aeb=['bluebird','path','exports','Action','../../config/logger','api','moment'];(function(_0x45dd26,_0xdc6e79){var _0x4ba4b2=function(_0x2e74ce){while(--_0x2e74ce){_0x45dd26['push'](_0x45dd26['shift']());}};_0x4ba4b2(++_0xdc6e79);}(_0x7aeb,0xac));var _0xb7ae=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x7aeb[_0x45783c];return _0x1161da;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb7ae('0x0'))(_0xb7ae('0x1'));var moment=require(_0xb7ae('0x2'));var BPromise=require(_0xb7ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7ae('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0xb7ae('0x5')]=function(_0x427a99,_0x41fe72){return _0x427a99['define'](_0xb7ae('0x6'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88b8=['moment','bluebird','request-promise','./action.attributes','exports','define','tools_actions','lodash','util','../../config/logger','api'];(function(_0x52bf44,_0x11dd87){var _0x16c86b=function(_0x41dc3d){while(--_0x41dc3d){_0x52bf44['push'](_0x52bf44['shift']());}};_0x16c86b(++_0x11dd87);}(_0x88b8,0x146));var _0x888b=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0x88b8[_0x2e7a43];return _0x52e9e1;};'use strict';var _=require(_0x888b('0x0'));var util=require(_0x888b('0x1'));var logger=require(_0x888b('0x2'))(_0x888b('0x3'));var moment=require(_0x888b('0x4'));var BPromise=require(_0x888b('0x5'));var rp=require(_0x888b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x888b('0x7'));module[_0x888b('0x8')]=function(_0x132560,_0x2ef750){return _0x132560[_0x888b('0x9')]('Action',attributes,{'tableName':_0x888b('0xa'),'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 0e4269e..4c369b4 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(_0x75e7c4,_0x1cb7ae){var _0x536ff8=function(_0x27b2e7){while(--_0x27b2e7){_0x75e7c4['push'](_0x75e7c4['shift']());}};_0x536ff8(++_0x1cb7ae);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xb7e7[_0x34843e];return _0x598f7f;};'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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x5d0792,_0x486759){var _0x2885a6=function(_0x5da30c){while(--_0x5da30c){_0x5d0792['push'](_0x5d0792['shift']());}};_0x2885a6(++_0x486759);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var 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);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 65527f9..8a04ac9 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 _0x7d42=['/:id','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','./action.controller','put'];(function(_0x239847,_0x3d6c44){var _0x253171=function(_0x3502a4){while(--_0x3502a4){_0x239847['push'](_0x239847['shift']());}};_0x253171(++_0x3d6c44);}(_0x7d42,0x17e));var _0x27d4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7d42[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x27d4('0x0'));var util=require(_0x27d4('0x1'));var path=require(_0x27d4('0x2'));var timeout=require(_0x27d4('0x3'));var express=require(_0x27d4('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x27d4('0x5'));var config=require('../../config/environment');var controller=require(_0x27d4('0x6'));router[_0x27d4('0x7')](_0x27d4('0x8'),auth[_0x27d4('0x9')](),controller[_0x27d4('0xa')]);router[_0x27d4('0xb')]('/:id',auth[_0x27d4('0x9')](),controller[_0x27d4('0xc')]);module['exports']=router; \ No newline at end of file +var _0x18d4=['/:id','isAuthenticated','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0x18d4,0xc8));var _0x418d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x18d4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x418d('0x0'));var util=require(_0x418d('0x1'));var path=require('path');var timeout=require(_0x418d('0x2'));var express=require(_0x418d('0x3'));var router=express['Router']();var auth=require(_0x418d('0x4'));var interaction=require(_0x418d('0x5'));var config=require(_0x418d('0x6'));var controller=require(_0x418d('0x7'));router['put'](_0x418d('0x8'),auth[_0x418d('0x9')](),controller[_0x418d('0xa')]);router[_0x418d('0xb')](_0x418d('0x8'),auth[_0x418d('0x9')](),controller[_0x418d('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 38798ae..b6af3be 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 _0xebed=['exports','STRING','TEXT','sequelize'];(function(_0x197878,_0x4c265c){var _0x2371e7=function(_0x4a81a3){while(--_0x4a81a3){_0x197878['push'](_0x197878['shift']());}};_0x2371e7(++_0x4c265c);}(_0xebed,0x163));var _0xdebe=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xebed[_0x55d8c5];return _0x225ae5;};'use strict';var Sequelize=require(_0xdebe('0x0'));module[_0xdebe('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xdebe('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xdebe('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x78ce=['TEXT','sequelize','exports','STRING'];(function(_0x3fc530,_0x38ea3b){var _0x3acbfd=function(_0x723920){while(--_0x723920){_0x3fc530['push'](_0x3fc530['shift']());}};_0x3acbfd(++_0x38ea3b);}(_0x78ce,0x14d));var _0xe78c=function(_0x15e6fe,_0x1a5c39){_0x15e6fe=_0x15e6fe-0x0;var _0x34894d=_0x78ce[_0x15e6fe];return _0x34894d;};'use strict';var Sequelize=require(_0xe78c('0x0'));module[_0xe78c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xe78c('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xe78c('0x3')]},'joins':{'type':Sequelize[_0xe78c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index fa20a6e..6455027 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 _0x0507=['custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','countTable','COUNT(*)','run','runReport','SUM(%s)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CustomReports','error','stack','name','send','map','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','AnalyticCustomReport','includeAll','include','rows','catch','show','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','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)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','findAll','keyBy','select','MetricId','metric','function','replace','format','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','Please\x20insert\x20at\x20least\x20one\x20field','from','groupBy','clone','No\x20available\x20data','output','web','fullPath','generate'];(function(_0x11fc92,_0x4b1a76){var _0xc7373f=function(_0x3a51a2){while(--_0x3a51a2){_0x11fc92['push'](_0x11fc92['shift']());}};_0xc7373f(++_0x4b1a76);}(_0x0507,0xb8));var _0x7050=function(_0x45b196,_0x1486b4){_0x45b196=_0x45b196-0x0;var _0x247cbb=_0x0507[_0x45b196];return _0x247cbb;};'use strict';var pdf=require(_0x7050('0x0'));var emlformat=require(_0x7050('0x1'));var rimraf=require(_0x7050('0x2'));var zipdir=require(_0x7050('0x3'));var jsonpatch=require(_0x7050('0x4'));var rp=require(_0x7050('0x5'));var moment=require(_0x7050('0x6'));var BPromise=require(_0x7050('0x7'));var Mustache=require(_0x7050('0x8'));var util=require(_0x7050('0x9'));var path=require(_0x7050('0xa'));var sox=require(_0x7050('0xb'));var csv=require(_0x7050('0xc'));var ejs=require(_0x7050('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7050('0xe'));var crypto=require('crypto');var jsforce=require(_0x7050('0xf'));var deskjs=require(_0x7050('0x10'));var toCsv=require(_0x7050('0xc'));var querystring=require(_0x7050('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7050('0x12'));var qs=require(_0x7050('0x13'));var as=require(_0x7050('0x14'));var hardwareService=require(_0x7050('0x15'));var logger=require(_0x7050('0x16'))('api');var utils=require(_0x7050('0x17'));var config=require(_0x7050('0x18'));var licenseUtil=require(_0x7050('0x19'));var db=require('../../mysqldb')['db'];var dbH=require(_0x7050('0x1a'))[_0x7050('0x1b')];function respondWithStatusCode(_0x17b8e7,_0x95b5b1){_0x95b5b1=_0x95b5b1||0xcc;return function(_0xe1a9cc){if(_0xe1a9cc){return _0x17b8e7[_0x7050('0x1c')](_0x95b5b1);}return _0x17b8e7['status'](_0x95b5b1)[_0x7050('0x1d')]();};}function respondWithResult(_0x236b8a,_0x457ceb){_0x457ceb=_0x457ceb||0xc8;return function(_0x86f42e){if(_0x86f42e){return _0x236b8a[_0x7050('0x1e')](_0x457ceb)['json'](_0x86f42e);}};}function respondWithFilteredResult(_0x2a43fb,_0x3f11e5){return function(_0xafe8c4){if(_0xafe8c4){var _0x157f2e=_0xafe8c4[_0x7050('0x1f')],_0x2b5959=_0x3f11e5['offset'],_0x2dbc7d=_0x3f11e5[_0x7050('0x20')]+_0x3f11e5[_0x7050('0x21')],_0x402588;if(_0x2dbc7d>=_0x157f2e){_0x2dbc7d=_0x157f2e;_0x402588=0xc8;}else{_0x402588=0xce;}_0x2a43fb['status'](_0x402588);return _0x2a43fb[_0x7050('0x22')](_0x7050('0x23'),_0x2b5959+'-'+_0x2dbc7d+'/'+_0x157f2e)[_0x7050('0x24')](_0xafe8c4);}return null;};}function patchUpdates(_0x2d8522){return function(_0x1c7fe1){try{jsonpatch[_0x7050('0x25')](_0x1c7fe1,_0x2d8522,!![]);}catch(_0x3a66bf){return BPromise[_0x7050('0x26')](_0x3a66bf);}return _0x1c7fe1[_0x7050('0x27')]();};}function saveUpdates(_0x1c9931,_0x424e5b){return function(_0x142a93){if(_0x142a93){return _0x142a93[_0x7050('0x28')](_0x1c9931)[_0x7050('0x29')](function(_0x160d21){return _0x160d21;});}return null;};}function removeEntity(_0x2594e5,_0x904e60){return function(_0x27896b){if(_0x27896b){return _0x27896b[_0x7050('0x2a')]()[_0x7050('0x29')](function(){var _0xafed3d=_0x27896b[_0x7050('0x2b')]({'plain':!![]});var _0x32ae81=_0x7050('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x32ae81,'resourceId':_0xafed3d['id']}})[_0x7050('0x29')](function(){return _0x27896b;});})[_0x7050('0x29')](function(){_0x2594e5[_0x7050('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a67c9,_0x38a399){return function(_0x70093){if(!_0x70093){_0x5a67c9[_0x7050('0x1c')](0x194);}return _0x70093;};}function handleError(_0x5e9ff1,_0x1365a9){_0x1365a9=_0x1365a9||0x1f4;return function(_0xdb0f06){logger[_0x7050('0x2d')](_0xdb0f06[_0x7050('0x2e')]);if(_0xdb0f06[_0x7050('0x2f')]){delete _0xdb0f06[_0x7050('0x2f')];}_0x5e9ff1[_0x7050('0x1e')](_0x1365a9)[_0x7050('0x30')](_0xdb0f06);};}exports['index']=function(_0x5a0712,_0x2684ce){var _0x50bddc={},_0x59d086={},_0xbc7899={'count':0x0,'rows':[]};var _0x132422=_[_0x7050('0x31')](db['AnalyticCustomReport'][_0x7050('0x32')],function(_0x1aa4cc){return{'name':_0x1aa4cc[_0x7050('0x33')],'type':_0x1aa4cc['type']['key']};});_0x59d086[_0x7050('0x34')]=_[_0x7050('0x31')](_0x132422,_0x7050('0x2f'));_0x59d086[_0x7050('0x35')]=_[_0x7050('0x36')](_0x5a0712[_0x7050('0x35')]);_0x59d086[_0x7050('0x37')]=_['intersection'](_0x59d086[_0x7050('0x34')],_0x59d086['query']);_0x50bddc[_0x7050('0x38')]=_[_0x7050('0x39')](_0x59d086[_0x7050('0x34')],qs[_0x7050('0x3a')](_0x5a0712[_0x7050('0x35')][_0x7050('0x3a')]));_0x50bddc['attributes']=_0x50bddc[_0x7050('0x38')][_0x7050('0x3b')]?_0x50bddc[_0x7050('0x38')]:_0x59d086[_0x7050('0x34')];if(!_0x5a0712[_0x7050('0x35')][_0x7050('0x3c')](_0x7050('0x3d'))){_0x50bddc[_0x7050('0x21')]=qs[_0x7050('0x21')](_0x5a0712[_0x7050('0x35')][_0x7050('0x21')]);_0x50bddc[_0x7050('0x20')]=qs[_0x7050('0x20')](_0x5a0712['query'][_0x7050('0x20')]);}_0x50bddc[_0x7050('0x3e')]=qs['sort'](_0x5a0712[_0x7050('0x35')][_0x7050('0x3f')]);_0x50bddc[_0x7050('0x40')]=qs[_0x7050('0x37')](_['pick'](_0x5a0712[_0x7050('0x35')],_0x59d086[_0x7050('0x37')]),_0x132422);if(_0x5a0712[_0x7050('0x35')][_0x7050('0x41')]){_0x50bddc[_0x7050('0x40')]=_[_0x7050('0x42')](_0x50bddc[_0x7050('0x40')],{'$or':_[_0x7050('0x31')](_0x132422,function(_0x303ca7){if(_0x303ca7[_0x7050('0x43')]!==_0x7050('0x44')){var _0x14943c={};_0x14943c[_0x303ca7[_0x7050('0x2f')]]={'$like':'%'+_0x5a0712[_0x7050('0x35')][_0x7050('0x41')]+'%'};return _0x14943c;}})});}_0x50bddc=_[_0x7050('0x42')]({},_0x50bddc,_0x5a0712['options']);var _0x2a9ae7={'where':_0x50bddc[_0x7050('0x40')]};return db[_0x7050('0x45')][_0x7050('0x1f')](_0x2a9ae7)['then'](function(_0x473a15){_0xbc7899['count']=_0x473a15;if(_0x5a0712[_0x7050('0x35')][_0x7050('0x46')]){_0x50bddc[_0x7050('0x47')]=[{'all':!![]}];}return db[_0x7050('0x45')]['findAll'](_0x50bddc);})[_0x7050('0x29')](function(_0x101976){_0xbc7899[_0x7050('0x48')]=_0x101976;return _0xbc7899;})['then'](respondWithFilteredResult(_0x2684ce,_0x50bddc))[_0x7050('0x49')](handleError(_0x2684ce,null));};exports[_0x7050('0x4a')]=function(_0x4497dc,_0x21ed0a){var _0x38ce94={'raw':![],'where':{'id':_0x4497dc['params']['id']}},_0x223c52={};_0x223c52[_0x7050('0x34')]=_[_0x7050('0x36')](db[_0x7050('0x45')][_0x7050('0x32')]);_0x223c52[_0x7050('0x35')]=_['keys'](_0x4497dc['query']);_0x223c52[_0x7050('0x37')]=_['intersection'](_0x223c52[_0x7050('0x34')],_0x223c52[_0x7050('0x35')]);_0x38ce94[_0x7050('0x38')]=_[_0x7050('0x39')](_0x223c52[_0x7050('0x34')],qs[_0x7050('0x3a')](_0x4497dc[_0x7050('0x35')][_0x7050('0x3a')]));_0x38ce94[_0x7050('0x38')]=_0x38ce94['attributes'][_0x7050('0x3b')]?_0x38ce94[_0x7050('0x38')]:_0x223c52[_0x7050('0x34')];if(_0x4497dc['query'][_0x7050('0x46')]){_0x38ce94[_0x7050('0x47')]=[{'all':!![]}];}_0x38ce94=_[_0x7050('0x42')]({},_0x38ce94,_0x4497dc[_0x7050('0x4b')]);return db[_0x7050('0x45')][_0x7050('0x4c')](_0x38ce94)[_0x7050('0x29')](handleEntityNotFound(_0x21ed0a,null))[_0x7050('0x29')](respondWithResult(_0x21ed0a,null))['catch'](handleError(_0x21ed0a,null));};exports[_0x7050('0x4d')]=function(_0x62508,_0x3c2c3a){return db[_0x7050('0x45')][_0x7050('0x4d')](_0x62508['body'],{})[_0x7050('0x29')](function(_0x40f8f6){var _0xfcbb72=_0x62508[_0x7050('0x4e')][_0x7050('0x2b')]({'plain':!![]});if(!_0xfcbb72)throw new Error(_0x7050('0x4f'));if(_0xfcbb72['role']===_0x7050('0x4e')){var _0x200ccb=_0x40f8f6[_0x7050('0x2b')]({'plain':!![]});var _0xcf102c='Reports';return db[_0x7050('0x50')][_0x7050('0x4c')]({'where':{'name':_0xcf102c,'userProfileId':_0xfcbb72[_0x7050('0x51')]},'raw':!![]})[_0x7050('0x29')](function(_0x1efb0b){if(_0x1efb0b&&_0x1efb0b[_0x7050('0x52')]===0x0){return db[_0x7050('0x53')]['create']({'name':_0x200ccb['name'],'resourceId':_0x200ccb['id'],'type':_0x7050('0x2c'),'sectionId':_0x1efb0b['id']},{})[_0x7050('0x29')](function(){return _0x40f8f6;});}else{return _0x40f8f6;}})['catch'](function(_0x25fb2a){logger[_0x7050('0x2d')](_0x7050('0x54'),_0x25fb2a);throw _0x25fb2a;});}return _0x40f8f6;})[_0x7050('0x29')](respondWithResult(_0x3c2c3a,0xc9))[_0x7050('0x49')](handleError(_0x3c2c3a,null));};exports[_0x7050('0x28')]=function(_0x493728,_0x43ed8c){if(_0x493728[_0x7050('0x55')]['id']){delete _0x493728[_0x7050('0x55')]['id'];}return db[_0x7050('0x45')]['find']({'where':{'id':_0x493728[_0x7050('0x56')]['id']}})['then'](handleEntityNotFound(_0x43ed8c,null))['then'](saveUpdates(_0x493728['body'],null))[_0x7050('0x29')](respondWithResult(_0x43ed8c,null))[_0x7050('0x49')](handleError(_0x43ed8c,null));};exports[_0x7050('0x2a')]=function(_0xf7ea22,_0x4e2506){return db[_0x7050('0x45')][_0x7050('0x4c')]({'where':{'id':_0xf7ea22[_0x7050('0x56')]['id']}})[_0x7050('0x29')](handleEntityNotFound(_0x4e2506,null))[_0x7050('0x29')](removeEntity(_0x4e2506,null))[_0x7050('0x49')](handleError(_0x4e2506,null));};exports[_0x7050('0x57')]=function(_0x578626,_0x3543af){var _0x4ba2c8=0xa;var _0x5a1072=[_0x7050('0x58'),_0x7050('0x59'),_0x7050('0x5a'),_0x7050('0x5b')];var _0x353d90={'SUM':'SUM(%s)','COUNT':_0x7050('0x5c'),'COUNT DISTINCT':_0x7050('0x5d'),'MAX':_0x7050('0x5e'),'MIN':_0x7050('0x5f'),'AVG':_0x7050('0x60'),'GROUP_CONCAT':_0x7050('0x61'),'GROUP_CONCAT ASC':_0x7050('0x62'),'GROUP_CONCAT DESC':_0x7050('0x63')};var _0x3bf2cd={'SEC_TO_TIME':_0x7050('0x64'),'DATE':_0x7050('0x65'),'HOUR':_0x7050('0x66'),'ROUND':_0x7050('0x67'),'UNIX_TIMESTAMP':_0x7050('0x68')};var _0x3f279b=function(_0x1e22a3){return!_[_0x7050('0x69')]([_0x7050('0x6a'),_0x7050('0x6b'),_0x7050('0x6c'),'IS\x20NOT\x20EMPTY'],_0x1e22a3);};var _0x4e0861=function(_0xa6820a){if(!_0xa6820a||!_0xa6820a[_0x7050('0x6d')]['length']){return'';}for(var _0x311715='(',_0x174ccc=0x0;_0x174ccc<_0xa6820a[_0x7050('0x6d')][_0x7050('0x3b')];_0x174ccc+=0x1){_0x174ccc>0x0&&(_0x311715+='\x20'+_0xa6820a[_0x7050('0x6e')]+'\x20');_0x311715+=_0xa6820a[_0x7050('0x6d')][_0x174ccc][_0x7050('0x6f')]?_0x4e0861(_0xa6820a[_0x7050('0x6d')][_0x174ccc]['group']):_0xa6820a[_0x7050('0x6d')][_0x174ccc][_0x7050('0x70')]+'\x20'+_0xa6820a[_0x7050('0x6d')][_0x174ccc]['condition']+(_0x3f279b(_0xa6820a[_0x7050('0x6d')][_0x174ccc][_0x7050('0x71')])?'\x20'+_0xa6820a[_0x7050('0x6d')][_0x174ccc][_0x7050('0x72')]:'');}return _0x311715+')';};var _0x39ad6b={'where':{'id':_0x578626[_0x7050('0x56')]['id']}},_0x372af6,_0x16a4f5,_0x8583ac,_0x8ccfa6,_0xbdeacf;_0x39ad6b=_[_0x7050('0x42')]({},_0x39ad6b,_0x578626[_0x7050('0x4b')]);return db[_0x7050('0x45')][_0x7050('0x4c')](_0x39ad6b)[_0x7050('0x29')](function(_0x7f3d19){if(_0x7f3d19){_0x372af6=_0x7f3d19;return _0x7f3d19[_0x7050('0x73')]();}return null;})[_0x7050('0x29')](function(_0x3d0986){if(_0x3d0986){if(!_0x3d0986['length']){throw new db[(_0x7050('0x74'))][(_0x7050('0x75'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x16a4f5=_0x3d0986;return db[_0x7050('0x76')][_0x7050('0x77')]({'raw':!![]});}return null;})[_0x7050('0x29')](function(_0x465f97){if(_0x465f97){_0x8583ac=_[_0x7050('0x78')](_0x465f97,'id');var _0x925800;var _0x166183=squel[_0x7050('0x79')]();_0x166183['from'](_0x372af6['table']);for(var _0x2c2635=0x0;_0x2c2635<_0x16a4f5['length'];_0x2c2635+=0x1){_0x925800=_0x16a4f5[_0x2c2635][_0x7050('0x7a')]?_0x8583ac[_0x16a4f5[_0x2c2635][_0x7050('0x7a')]][_0x7050('0x7b')]:_0x16a4f5[_0x2c2635][_0x7050('0x70')];_0x925800=_0x16a4f5[_0x2c2635][_0x7050('0x7c')]?_['replace'](_0x353d90[_0x16a4f5[_0x2c2635][_0x7050('0x7c')]],'%s',_0x925800):_0x925800;_0x925800=_0x16a4f5[_0x2c2635]['format']?_[_0x7050('0x7d')](_0x3bf2cd[_0x16a4f5[_0x2c2635][_0x7050('0x7e')]],'%s',_0x925800):_0x925800;if(_0x16a4f5[_0x2c2635]['groupBy']){_0x166183[_0x7050('0x6f')](_0x925800);}_0x16a4f5[_0x2c2635][_0x7050('0x7f')]&&_0x166183[_0x7050('0x3e')](_0x925800,_0x16a4f5[_0x2c2635][_0x7050('0x7f')]==='DESC'?![]:!![]);_0x166183[_0x7050('0x70')](_0x925800,_0x16a4f5[_0x2c2635][_0x7050('0x80')]||_0x925800);}if(_0x372af6[_0x7050('0x81')]){_0x372af6['joins']=JSON[_0x7050('0x82')](_0x372af6[_0x7050('0x81')]);for(var _0x694a72=0x0;_0x694a72<_0x372af6['joins'][_0x7050('0x3b')];_0x694a72+=0x1){if(_0x372af6[_0x7050('0x81')][_0x694a72][_0x7050('0x43')]&&_[_0x7050('0x69')](_0x5a1072,_0x372af6['joins'][_0x694a72][_0x7050('0x43')])&&_0x372af6[_0x7050('0x81')][_0x694a72][_0x7050('0x83')]&&_0x372af6[_0x7050('0x81')][_0x694a72][_0x7050('0x84')]&&_0x372af6[_0x7050('0x81')][_0x694a72][_0x7050('0x85')]){_0x166183[_0x372af6[_0x7050('0x81')][_0x694a72]['type']](_0x372af6['joins'][_0x694a72][_0x7050('0x84')],null,util[_0x7050('0x7e')](_0x7050('0x86'),_0x372af6[_0x7050('0x87')],_0x372af6[_0x7050('0x81')][_0x694a72]['parentKey'],_0x372af6[_0x7050('0x81')][_0x694a72][_0x7050('0x84')],_0x372af6[_0x7050('0x81')][_0x694a72][_0x7050('0x85')]));}}}if(_0x372af6[_0x7050('0x88')]){_0x372af6[_0x7050('0x88')]=JSON[_0x7050('0x82')](_0x372af6[_0x7050('0x88')]);_0x166183[_0x7050('0x40')](_0x4e0861(_0x372af6['conditions']['group']));}_0xbdeacf=_0x166183['clone']();_0x166183['limit'](_0x4ba2c8);_0x166183[_0x7050('0x20')](0x0);logger[_0x7050('0x89')](_0x7050('0x8a'),_0x166183['toString']());return db[_0x7050('0x8b')][_0x7050('0x35')](_0x166183[_0x7050('0x8c')](),{'type':db[_0x7050('0x8b')][_0x7050('0x8d')][_0x7050('0x8e')]});}})['then'](respondWithResult(_0x3543af,null))[_0x7050('0x49')](handleError(_0x3543af,null));};function runReport(_0x5b5bfd,_0x7dead0,_0x5e795d){var _0x1c7fd7=_0x7dead0[_0x7050('0x2f')];var _0x1e1d92=0xa;var _0x503401=[_0x7050('0x58'),_0x7050('0x59'),_0x7050('0x5a'),_0x7050('0x5b')];var _0x37253d={'SUM':'SUM(%s)','COUNT':_0x7050('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x7050('0x5f'),'AVG':_0x7050('0x60'),'GROUP_CONCAT':_0x7050('0x61'),'GROUP_CONCAT ASC':_0x7050('0x62'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x31e224={'SEC_TO_TIME':_0x7050('0x64'),'DATE':_0x7050('0x65'),'HOUR':_0x7050('0x66'),'ROUND':_0x7050('0x67'),'UNIX_TIMESTAMP':_0x7050('0x68')};var _0x2849d2=function(_0x196366){return!_['includes']([_0x7050('0x6a'),'IS\x20NOT\x20NULL',_0x7050('0x6c'),'IS\x20NOT\x20EMPTY'],_0x196366);};var _0x4cf5cd=function(_0xc43771){if(!_0xc43771||!_0xc43771[_0x7050('0x6d')][_0x7050('0x3b')]){return'';}for(var _0x22dbbf='(',_0x159bc1=0x0;_0x159bc1<_0xc43771['rules']['length'];_0x159bc1+=0x1){_0x159bc1>0x0&&(_0x22dbbf+='\x20'+_0xc43771['operator']+'\x20');_0x22dbbf+=_0xc43771[_0x7050('0x6d')][_0x159bc1][_0x7050('0x6f')]?_0x4cf5cd(_0xc43771[_0x7050('0x6d')][_0x159bc1][_0x7050('0x6f')]):_0xc43771[_0x7050('0x6d')][_0x159bc1]['field']+'\x20'+_0xc43771[_0x7050('0x6d')][_0x159bc1][_0x7050('0x71')]+(_0x2849d2(_0xc43771[_0x7050('0x6d')][_0x159bc1][_0x7050('0x71')])?'\x20'+_0xc43771['rules'][_0x159bc1]['value']:'');}return _0x22dbbf+')';};var _0x3ff85b={'where':{'id':_0x5b5bfd['id']}},_0x994828,_0x32a212,_0x123eb3,_0x524d52,_0x8f9cda;_0x3ff85b=_[_0x7050('0x42')]({},_0x3ff85b,_0x5e795d);return db['AnalyticCustomReport'][_0x7050('0x4c')](_0x3ff85b)['then'](function(_0x4eeabc){if(_0x4eeabc){_0x994828=_0x4eeabc;return _0x4eeabc[_0x7050('0x73')]();}return null;})[_0x7050('0x29')](function(_0x34f1ed){if(_0x34f1ed){if(!_0x34f1ed[_0x7050('0x3b')]){throw new db[(_0x7050('0x74'))][(_0x7050('0x75'))](_0x7050('0x8f'),0x193);}_0x32a212=_0x34f1ed;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x7050('0x29')](function(_0x4d25eb){if(_0x4d25eb){_0x123eb3=_['keyBy'](_0x4d25eb,'id');var _0x3122;var _0x9c84f8=squel[_0x7050('0x79')]();_0x9c84f8[_0x7050('0x90')](_0x994828[_0x7050('0x87')]);for(var _0x2583a7=0x0;_0x2583a7<_0x32a212[_0x7050('0x3b')];_0x2583a7+=0x1){_0x3122=_0x32a212[_0x2583a7][_0x7050('0x7a')]?_0x123eb3[_0x32a212[_0x2583a7][_0x7050('0x7a')]][_0x7050('0x7b')]:_0x32a212[_0x2583a7][_0x7050('0x70')];_0x3122=_0x32a212[_0x2583a7][_0x7050('0x7c')]?_[_0x7050('0x7d')](_0x37253d[_0x32a212[_0x2583a7][_0x7050('0x7c')]],'%s',_0x3122):_0x3122;_0x3122=_0x32a212[_0x2583a7][_0x7050('0x7e')]?_[_0x7050('0x7d')](_0x31e224[_0x32a212[_0x2583a7][_0x7050('0x7e')]],'%s',_0x3122):_0x3122;if(_0x32a212[_0x2583a7][_0x7050('0x91')]){_0x9c84f8[_0x7050('0x6f')](_0x3122);}_0x32a212[_0x2583a7][_0x7050('0x7f')]&&_0x9c84f8['order'](_0x3122,_0x32a212[_0x2583a7][_0x7050('0x7f')]==='DESC'?![]:!![]);_0x9c84f8[_0x7050('0x70')](_0x3122,_0x32a212[_0x2583a7][_0x7050('0x80')]||_0x3122);}if(_0x994828['joins']){_0x994828[_0x7050('0x81')]=JSON[_0x7050('0x82')](_0x994828[_0x7050('0x81')]);for(var _0x2a35a0=0x0;_0x2a35a0<_0x994828[_0x7050('0x81')][_0x7050('0x3b')];_0x2a35a0+=0x1){if(_0x994828[_0x7050('0x81')][_0x2a35a0][_0x7050('0x43')]&&_[_0x7050('0x69')](_0x503401,_0x994828['joins'][_0x2a35a0][_0x7050('0x43')])&&_0x994828['joins'][_0x2a35a0][_0x7050('0x83')]&&_0x994828[_0x7050('0x81')][_0x2a35a0]['foreignTable']&&_0x994828['joins'][_0x2a35a0][_0x7050('0x85')]){_0x9c84f8[_0x994828['joins'][_0x2a35a0][_0x7050('0x43')]](_0x994828[_0x7050('0x81')][_0x2a35a0][_0x7050('0x84')],null,util[_0x7050('0x7e')](_0x7050('0x86'),_0x994828[_0x7050('0x87')],_0x994828[_0x7050('0x81')][_0x2a35a0][_0x7050('0x83')],_0x994828[_0x7050('0x81')][_0x2a35a0][_0x7050('0x84')],_0x994828[_0x7050('0x81')][_0x2a35a0][_0x7050('0x85')]));}}}if(_0x994828[_0x7050('0x88')]){_0x994828[_0x7050('0x88')]=JSON[_0x7050('0x82')](_0x994828[_0x7050('0x88')]);_0x9c84f8[_0x7050('0x40')](_0x4cf5cd(_0x994828['conditions'][_0x7050('0x6f')]));}_0x8f9cda=_0x9c84f8[_0x7050('0x92')]();_0x9c84f8[_0x7050('0x21')](_0x1e1d92);_0x9c84f8[_0x7050('0x20')](0x0);logger[_0x7050('0x89')]('Limited\x20Query:',_0x9c84f8[_0x7050('0x8c')]());return db[_0x7050('0x8b')][_0x7050('0x35')](_0x9c84f8['toString'](),{'type':db[_0x7050('0x8b')][_0x7050('0x8d')][_0x7050('0x8e')]});}})[_0x7050('0x29')](function(_0x16e5ec){if(!_0x16e5ec[_0x7050('0x3b')]){throw new db[(_0x7050('0x74'))][(_0x7050('0x75'))](_0x7050('0x93'),0xcc);}if(_0x7dead0[_0x7050('0x94')]===_0x7050('0x95')){return null;}var _0x5e7c99=_[_0x7050('0x42')](_0x7dead0,{'name':_0x7dead0[_0x7050('0x96')]||_0x7dead0[_0x7050('0x2f')]||_0x994828['name'],'basename':_0x1c7fd7,'savename':util[_0x7050('0x7e')]('%s-%s.%s',_0x7dead0[_0x7050('0x2f')]||_0x994828['name'],require('randomstring')[_0x7050('0x97')](0x4),_0x7dead0['output']||'csv'),'reportId':_0x994828['id'],'reportType':_0x7050('0x98')});return db['AnalyticExtractedReport'][_0x7050('0x4d')](_0x5e7c99,{'raw':!![]});})[_0x7050('0x29')](function(_0x437340){if(_0x994828[_0x7050('0x87')]===_0x7050('0x99')){_0x8f9cda['where'](_0x994828[_0x7050('0x87')]+_0x7050('0x9a'),_0x7dead0[_0x7050('0x9b')],_0x7dead0['endDate']);}else{_0x8f9cda['where'](_0x994828[_0x7050('0x87')]+_0x7050('0x9c'),_0x7dead0[_0x7050('0x9b')],_0x7dead0[_0x7050('0x9d')]);}if(_0x437340){logger[_0x7050('0x9e')](_0x7050('0x9f'),_0x8f9cda[_0x7050('0x8c')]());require(_0x7050('0xa0'))[_0x7050('0xa1')](path[_0x7050('0x58')](__dirname,_0x7050('0xa2'),_0x437340[_0x7050('0x94')]),[_0x437340['id'],_0x8f9cda[_0x7050('0x8c')](),path[_0x7050('0x58')](__dirname,'../../files/reports',_0x437340['savename']),_0x1c7fd7]);return _0x437340;}else{var _0x4c05a5=squel[_0x7050('0x79')]();_0x4c05a5['from']('('+_0x8f9cda[_0x7050('0x8c')]()+')',_0x7050('0xa3'));_0x4c05a5[_0x7050('0x70')](_0x7050('0xa4'),_0x7050('0x1f'));_0x8f9cda[_0x7050('0x21')](_0x7dead0['limit']||_0x1e1d92);_0x8f9cda['offset'](_0x7dead0[_0x7050('0x20')]||0x0);return dbH[_0x7050('0x8b')][_0x7050('0x35')](_0x4c05a5[_0x7050('0x8c')](),{'type':dbH['sequelize'][_0x7050('0x8d')][_0x7050('0x8e')]})[_0x7050('0x29')](function(_0x31508c){if(!_0x31508c[_0x7050('0x3b')]){_0x524d52=0x0;}else{_0x524d52=_0x31508c[0x0][_0x7050('0x1f')]||0x0;}return dbH[_0x7050('0x8b')][_0x7050('0x35')](_0x8f9cda[_0x7050('0x8c')](),{'type':dbH[_0x7050('0x8b')][_0x7050('0x8d')][_0x7050('0x8e')]});})[_0x7050('0x29')](function(_0x32fa1d){return{'rows':_0x32fa1d||[],'count':_0x524d52};});}});}exports[_0x7050('0xa5')]=function(_0x5f4178,_0x2dad2b){return runReport(_0x5f4178[_0x7050('0x56')],_0x5f4178['query'],_0x5f4178[_0x7050('0x4b')])[_0x7050('0x29')](respondWithResult(_0x2dad2b,null))['catch'](handleError(_0x2dad2b,null));};exports[_0x7050('0xa6')]=runReport;exports[_0x7050('0x35')]=function(_0x4b557e,_0x28747b){var _0x2ce745=0xa;var _0x4d2c78=[_0x7050('0x58'),_0x7050('0x59'),_0x7050('0x5a'),_0x7050('0x5b')];var _0x7b4daf={'SUM':_0x7050('0xa7'),'COUNT':_0x7050('0x5c'),'COUNT DISTINCT':_0x7050('0x5d'),'MAX':_0x7050('0x5e'),'MIN':_0x7050('0x5f'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x7050('0x61'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x8989f2={'SEC_TO_TIME':_0x7050('0x64'),'DATE':_0x7050('0x65'),'HOUR':_0x7050('0x66'),'ROUND':_0x7050('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x143850=function(_0x337e8a){return!_['includes']([_0x7050('0x6a'),'IS\x20NOT\x20NULL',_0x7050('0x6c'),'IS\x20NOT\x20EMPTY'],_0x337e8a);};var _0x3d74ea=function(_0x13f51a){if(!_0x13f51a||!_0x13f51a[_0x7050('0x6d')][_0x7050('0x3b')]){return'';}for(var _0x3aed1b='(',_0x15e628=0x0;_0x15e628<_0x13f51a[_0x7050('0x6d')][_0x7050('0x3b')];_0x15e628+=0x1){_0x15e628>0x0&&(_0x3aed1b+='\x20'+_0x13f51a['operator']+'\x20');_0x3aed1b+=_0x13f51a[_0x7050('0x6d')][_0x15e628][_0x7050('0x6f')]?_0x3d74ea(_0x13f51a[_0x7050('0x6d')][_0x15e628][_0x7050('0x6f')]):_0x13f51a[_0x7050('0x6d')][_0x15e628]['field']+'\x20'+_0x13f51a['rules'][_0x15e628][_0x7050('0x71')]+(_0x143850(_0x13f51a['rules'][_0x15e628]['condition'])?'\x20'+_0x13f51a[_0x7050('0x6d')][_0x15e628]['value']:'');}return _0x3aed1b+')';};var _0x4d52fb={'where':{'id':_0x4b557e['params']['id']}},_0x5def99,_0x18a8ca,_0x3e5587,_0x223889,_0x3a9b84;_0x4d52fb=_['merge']({},_0x4d52fb,_0x4b557e[_0x7050('0x4b')]);return db[_0x7050('0x45')]['find'](_0x4d52fb)[_0x7050('0x29')](function(_0x487c20){if(_0x487c20){_0x5def99=_0x487c20;return _0x487c20[_0x7050('0x73')]();}return null;})['then'](function(_0x4d136f){if(_0x4d136f){if(!_0x4d136f[_0x7050('0x3b')]){throw new db[(_0x7050('0x74'))][(_0x7050('0x75'))](_0x7050('0x8f'),0x193);}_0x18a8ca=_0x4d136f;return db['AnalyticMetric'][_0x7050('0x77')]({'raw':!![]});}return null;})[_0x7050('0x29')](function(_0x2b8a3f){if(_0x2b8a3f){_0x3e5587=_[_0x7050('0x78')](_0x2b8a3f,'id');var _0x29a375;var _0x3aa4df=squel['select']();_0x3aa4df[_0x7050('0x90')](_0x5def99['table']);for(var _0x138224=0x0;_0x138224<_0x18a8ca[_0x7050('0x3b')];_0x138224+=0x1){_0x29a375=_0x18a8ca[_0x138224][_0x7050('0x7a')]?_0x3e5587[_0x18a8ca[_0x138224][_0x7050('0x7a')]]['metric']:_0x18a8ca[_0x138224][_0x7050('0x70')];_0x29a375=_0x18a8ca[_0x138224][_0x7050('0x7c')]?_['replace'](_0x7b4daf[_0x18a8ca[_0x138224][_0x7050('0x7c')]],'%s',_0x29a375):_0x29a375;_0x29a375=_0x18a8ca[_0x138224][_0x7050('0x7e')]?_[_0x7050('0x7d')](_0x8989f2[_0x18a8ca[_0x138224][_0x7050('0x7e')]],'%s',_0x29a375):_0x29a375;if(_0x18a8ca[_0x138224]['groupBy']){_0x3aa4df[_0x7050('0x6f')](_0x29a375);}_0x18a8ca[_0x138224][_0x7050('0x7f')]&&_0x3aa4df[_0x7050('0x3e')](_0x29a375,_0x18a8ca[_0x138224][_0x7050('0x7f')]==='DESC'?![]:!![]);_0x3aa4df[_0x7050('0x70')](_0x29a375,_0x18a8ca[_0x138224][_0x7050('0x80')]||_0x29a375);}if(_0x5def99[_0x7050('0x81')]){_0x5def99[_0x7050('0x81')]=JSON['parse'](_0x5def99[_0x7050('0x81')]);for(var _0x16aae8=0x0;_0x16aae8<_0x5def99[_0x7050('0x81')][_0x7050('0x3b')];_0x16aae8+=0x1){if(_0x5def99[_0x7050('0x81')][_0x16aae8][_0x7050('0x43')]&&_[_0x7050('0x69')](_0x4d2c78,_0x5def99[_0x7050('0x81')][_0x16aae8][_0x7050('0x43')])&&_0x5def99[_0x7050('0x81')][_0x16aae8][_0x7050('0x83')]&&_0x5def99[_0x7050('0x81')][_0x16aae8][_0x7050('0x84')]&&_0x5def99['joins'][_0x16aae8][_0x7050('0x85')]){_0x3aa4df[_0x5def99[_0x7050('0x81')][_0x16aae8][_0x7050('0x43')]](_0x5def99[_0x7050('0x81')][_0x16aae8]['foreignTable'],null,util['format'](_0x7050('0x86'),_0x5def99[_0x7050('0x87')],_0x5def99[_0x7050('0x81')][_0x16aae8][_0x7050('0x83')],_0x5def99[_0x7050('0x81')][_0x16aae8][_0x7050('0x84')],_0x5def99['joins'][_0x16aae8][_0x7050('0x85')]));}}}if(_0x5def99[_0x7050('0x88')]){_0x5def99[_0x7050('0x88')]=JSON[_0x7050('0x82')](_0x5def99[_0x7050('0x88')]);_0x3aa4df[_0x7050('0x40')](_0x3d74ea(_0x5def99['conditions'][_0x7050('0x6f')]));}_0x3a9b84=_0x3aa4df[_0x7050('0x92')]();_0x3aa4df[_0x7050('0x21')](_0x2ce745);_0x3aa4df[_0x7050('0x20')](0x0);logger['debug'](_0x7050('0x8a'),_0x3aa4df[_0x7050('0x8c')]());return db[_0x7050('0x8b')]['query'](_0x3aa4df[_0x7050('0x8c')](),{'type':db[_0x7050('0x8b')][_0x7050('0x8d')][_0x7050('0x8e')]});}})['then'](function(){return{'sql':_0x3a9b84[_0x7050('0x8c')]()};})[_0x7050('0x29')](respondWithResult(_0x28747b,null))[_0x7050('0x49')](handleError(_0x28747b,null));}; \ No newline at end of file +var _0xb736=['query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','options','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','sequelize','QueryTypes','GROUP_CONCAT(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','select','metric','Limited\x20Query:','toString','SELECT','No\x20available\x20data','web','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','right_join','value','Sequelize','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','update','destroy','then','get','CustomReports','UserProfileResource','error','name','send','index','map','AnalyticCustomReport','fieldName','key'];(function(_0x58277b,_0x515346){var _0x3be591=function(_0x33abd2){while(--_0x33abd2){_0x58277b['push'](_0x58277b['shift']());}};_0x3be591(++_0x515346);}(_0xb736,0x74));var _0x6b73=function(_0x5cb2f1,_0x1a62cc){_0x5cb2f1=_0x5cb2f1-0x0;var _0x29a7d0=_0xb736[_0x5cb2f1];return _0x29a7d0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6b73('0x0'));var rimraf=require(_0x6b73('0x1'));var zipdir=require(_0x6b73('0x2'));var jsonpatch=require(_0x6b73('0x3'));var rp=require(_0x6b73('0x4'));var moment=require(_0x6b73('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6b73('0x6'));var util=require(_0x6b73('0x7'));var path=require(_0x6b73('0x8'));var sox=require(_0x6b73('0x9'));var csv=require(_0x6b73('0xa'));var ejs=require(_0x6b73('0xb'));var fs=require('fs');var _=require(_0x6b73('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b73('0xd'));var deskjs=require(_0x6b73('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6b73('0xf'));var Papa=require(_0x6b73('0x10'));var Redis=require(_0x6b73('0x11'));var authService=require(_0x6b73('0x12'));var qs=require(_0x6b73('0x13'));var as=require(_0x6b73('0x14'));var hardwareService=require(_0x6b73('0x15'));var logger=require(_0x6b73('0x16'))(_0x6b73('0x17'));var utils=require('../../config/utils');var config=require(_0x6b73('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b73('0x19'))['db'];var dbH=require(_0x6b73('0x19'))['dbH'];function respondWithStatusCode(_0xb7a7a5,_0x44091b){_0x44091b=_0x44091b||0xcc;return function(_0x179e33){if(_0x179e33){return _0xb7a7a5[_0x6b73('0x1a')](_0x44091b);}return _0xb7a7a5[_0x6b73('0x1b')](_0x44091b)[_0x6b73('0x1c')]();};}function respondWithResult(_0x50d3f1,_0x5230a9){_0x5230a9=_0x5230a9||0xc8;return function(_0x15c04a){if(_0x15c04a){return _0x50d3f1[_0x6b73('0x1b')](_0x5230a9)['json'](_0x15c04a);}};}function respondWithFilteredResult(_0x46ee2f,_0x479e7f){return function(_0x312529){if(_0x312529){var _0x3b2a7a=_0x312529[_0x6b73('0x1d')],_0x57fac2=_0x479e7f[_0x6b73('0x1e')],_0x1d86f4=_0x479e7f[_0x6b73('0x1e')]+_0x479e7f[_0x6b73('0x1f')],_0x441d78;if(_0x1d86f4>=_0x3b2a7a){_0x1d86f4=_0x3b2a7a;_0x441d78=0xc8;}else{_0x441d78=0xce;}_0x46ee2f[_0x6b73('0x1b')](_0x441d78);return _0x46ee2f['set'](_0x6b73('0x20'),_0x57fac2+'-'+_0x1d86f4+'/'+_0x3b2a7a)[_0x6b73('0x21')](_0x312529);}return null;};}function patchUpdates(_0x370849){return function(_0x45bf82){try{jsonpatch[_0x6b73('0x22')](_0x45bf82,_0x370849,!![]);}catch(_0x16cdab){return BPromise[_0x6b73('0x23')](_0x16cdab);}return _0x45bf82['save']();};}function saveUpdates(_0x2a4ae6,_0xd8dc1f){return function(_0x302128){if(_0x302128){return _0x302128[_0x6b73('0x24')](_0x2a4ae6)['then'](function(_0x247db6){return _0x247db6;});}return null;};}function removeEntity(_0x70d3e3,_0x3cd690){return function(_0x21ca20){if(_0x21ca20){return _0x21ca20[_0x6b73('0x25')]()[_0x6b73('0x26')](function(){var _0x504c4d=_0x21ca20[_0x6b73('0x27')]({'plain':!![]});var _0x36fcec=_0x6b73('0x28');return db[_0x6b73('0x29')][_0x6b73('0x25')]({'where':{'type':_0x36fcec,'resourceId':_0x504c4d['id']}})[_0x6b73('0x26')](function(){return _0x21ca20;});})[_0x6b73('0x26')](function(){_0x70d3e3[_0x6b73('0x1b')](0xcc)[_0x6b73('0x1c')]();});}};}function handleEntityNotFound(_0x2e887f,_0x5c3c75){return function(_0x545946){if(!_0x545946){_0x2e887f[_0x6b73('0x1a')](0x194);}return _0x545946;};}function handleError(_0x5b8c85,_0x57c0af){_0x57c0af=_0x57c0af||0x1f4;return function(_0xe6f6a1){logger[_0x6b73('0x2a')](_0xe6f6a1['stack']);if(_0xe6f6a1[_0x6b73('0x2b')]){delete _0xe6f6a1['name'];}_0x5b8c85[_0x6b73('0x1b')](_0x57c0af)[_0x6b73('0x2c')](_0xe6f6a1);};}exports[_0x6b73('0x2d')]=function(_0x5c63d3,_0x2078cd){var _0x56723c={},_0x10f979={},_0x5a95da={'count':0x0,'rows':[]};var _0x34833a=_[_0x6b73('0x2e')](db[_0x6b73('0x2f')]['rawAttributes'],function(_0xb2352d){return{'name':_0xb2352d[_0x6b73('0x30')],'type':_0xb2352d['type'][_0x6b73('0x31')]};});_0x10f979['model']=_['map'](_0x34833a,'name');_0x10f979[_0x6b73('0x32')]=_[_0x6b73('0x33')](_0x5c63d3[_0x6b73('0x32')]);_0x10f979[_0x6b73('0x34')]=_[_0x6b73('0x35')](_0x10f979['model'],_0x10f979[_0x6b73('0x32')]);_0x56723c[_0x6b73('0x36')]=_['intersection'](_0x10f979[_0x6b73('0x37')],qs[_0x6b73('0x38')](_0x5c63d3[_0x6b73('0x32')][_0x6b73('0x38')]));_0x56723c[_0x6b73('0x36')]=_0x56723c[_0x6b73('0x36')][_0x6b73('0x39')]?_0x56723c[_0x6b73('0x36')]:_0x10f979[_0x6b73('0x37')];if(!_0x5c63d3[_0x6b73('0x32')][_0x6b73('0x3a')](_0x6b73('0x3b'))){_0x56723c[_0x6b73('0x1f')]=qs[_0x6b73('0x1f')](_0x5c63d3[_0x6b73('0x32')][_0x6b73('0x1f')]);_0x56723c['offset']=qs[_0x6b73('0x1e')](_0x5c63d3[_0x6b73('0x32')][_0x6b73('0x1e')]);}_0x56723c[_0x6b73('0x3c')]=qs[_0x6b73('0x3d')](_0x5c63d3[_0x6b73('0x32')][_0x6b73('0x3d')]);_0x56723c[_0x6b73('0x3e')]=qs['filters'](_['pick'](_0x5c63d3[_0x6b73('0x32')],_0x10f979[_0x6b73('0x34')]),_0x34833a);if(_0x5c63d3[_0x6b73('0x32')][_0x6b73('0x3f')]){_0x56723c['where']=_[_0x6b73('0x40')](_0x56723c['where'],{'$or':_[_0x6b73('0x2e')](_0x34833a,function(_0x3a868c){if(_0x3a868c[_0x6b73('0x41')]!==_0x6b73('0x42')){var _0x512538={};_0x512538[_0x3a868c[_0x6b73('0x2b')]]={'$like':'%'+_0x5c63d3[_0x6b73('0x32')][_0x6b73('0x3f')]+'%'};return _0x512538;}})});}_0x56723c=_[_0x6b73('0x40')]({},_0x56723c,_0x5c63d3['options']);var _0x10d7f4={'where':_0x56723c['where']};return db['AnalyticCustomReport']['count'](_0x10d7f4)[_0x6b73('0x26')](function(_0x57c4fe){_0x5a95da[_0x6b73('0x1d')]=_0x57c4fe;if(_0x5c63d3['query'][_0x6b73('0x43')]){_0x56723c[_0x6b73('0x44')]=[{'all':!![]}];}return db[_0x6b73('0x2f')][_0x6b73('0x45')](_0x56723c);})['then'](function(_0x3cca7e){_0x5a95da['rows']=_0x3cca7e;return _0x5a95da;})[_0x6b73('0x26')](respondWithFilteredResult(_0x2078cd,_0x56723c))[_0x6b73('0x46')](handleError(_0x2078cd,null));};exports[_0x6b73('0x47')]=function(_0x2c7958,_0x510054){var _0x3f027b={'raw':![],'where':{'id':_0x2c7958[_0x6b73('0x48')]['id']}},_0x4ba0aa={};_0x4ba0aa[_0x6b73('0x37')]=_[_0x6b73('0x33')](db[_0x6b73('0x2f')][_0x6b73('0x49')]);_0x4ba0aa[_0x6b73('0x32')]=_[_0x6b73('0x33')](_0x2c7958['query']);_0x4ba0aa[_0x6b73('0x34')]=_[_0x6b73('0x35')](_0x4ba0aa[_0x6b73('0x37')],_0x4ba0aa['query']);_0x3f027b[_0x6b73('0x36')]=_['intersection'](_0x4ba0aa[_0x6b73('0x37')],qs[_0x6b73('0x38')](_0x2c7958[_0x6b73('0x32')][_0x6b73('0x38')]));_0x3f027b[_0x6b73('0x36')]=_0x3f027b[_0x6b73('0x36')][_0x6b73('0x39')]?_0x3f027b[_0x6b73('0x36')]:_0x4ba0aa[_0x6b73('0x37')];if(_0x2c7958[_0x6b73('0x32')][_0x6b73('0x43')]){_0x3f027b['include']=[{'all':!![]}];}_0x3f027b=_[_0x6b73('0x40')]({},_0x3f027b,_0x2c7958['options']);return db[_0x6b73('0x2f')]['find'](_0x3f027b)['then'](handleEntityNotFound(_0x510054,null))[_0x6b73('0x26')](respondWithResult(_0x510054,null))[_0x6b73('0x46')](handleError(_0x510054,null));};exports[_0x6b73('0x4a')]=function(_0xc607f3,_0x250fb8){return db['AnalyticCustomReport'][_0x6b73('0x4a')](_0xc607f3[_0x6b73('0x4b')],{})['then'](function(_0x3772e0){var _0x4ac2f2=_0xc607f3[_0x6b73('0x4c')][_0x6b73('0x27')]({'plain':!![]});if(!_0x4ac2f2)throw new Error(_0x6b73('0x4d'));if(_0x4ac2f2[_0x6b73('0x4e')]==='user'){var _0x427b17=_0x3772e0[_0x6b73('0x27')]({'plain':!![]});var _0x5942df='Reports';return db['UserProfileSection'][_0x6b73('0x4f')]({'where':{'name':_0x5942df,'userProfileId':_0x4ac2f2['userProfileId']},'raw':!![]})[_0x6b73('0x26')](function(_0x284c93){if(_0x284c93&&_0x284c93['autoAssociation']===0x0){return db[_0x6b73('0x29')][_0x6b73('0x4a')]({'name':_0x427b17['name'],'resourceId':_0x427b17['id'],'type':_0x6b73('0x28'),'sectionId':_0x284c93['id']},{})['then'](function(){return _0x3772e0;});}else{return _0x3772e0;}})[_0x6b73('0x46')](function(_0x543206){logger[_0x6b73('0x2a')](_0x6b73('0x50'),_0x543206);throw _0x543206;});}return _0x3772e0;})[_0x6b73('0x26')](respondWithResult(_0x250fb8,0xc9))[_0x6b73('0x46')](handleError(_0x250fb8,null));};exports[_0x6b73('0x24')]=function(_0x1b47e1,_0x25082b){if(_0x1b47e1['body']['id']){delete _0x1b47e1[_0x6b73('0x4b')]['id'];}return db[_0x6b73('0x2f')]['find']({'where':{'id':_0x1b47e1[_0x6b73('0x48')]['id']}})[_0x6b73('0x26')](handleEntityNotFound(_0x25082b,null))['then'](saveUpdates(_0x1b47e1['body'],null))[_0x6b73('0x26')](respondWithResult(_0x25082b,null))['catch'](handleError(_0x25082b,null));};exports['destroy']=function(_0x3cc98b,_0x990f0e){return db[_0x6b73('0x2f')]['find']({'where':{'id':_0x3cc98b[_0x6b73('0x48')]['id']}})[_0x6b73('0x26')](handleEntityNotFound(_0x990f0e,null))['then'](removeEntity(_0x990f0e,null))['catch'](handleError(_0x990f0e,null));};exports[_0x6b73('0x51')]=function(_0x39976a,_0x31b488){var _0x50eb23=0xa;var _0x4b39e5=[_0x6b73('0x52'),_0x6b73('0x53'),'right_join',_0x6b73('0x54')];var _0x415b24={'SUM':_0x6b73('0x55'),'COUNT':_0x6b73('0x56'),'COUNT DISTINCT':_0x6b73('0x57'),'MAX':_0x6b73('0x58'),'MIN':_0x6b73('0x59'),'AVG':_0x6b73('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x6b73('0x5b'),'GROUP_CONCAT DESC':_0x6b73('0x5c')};var _0x101aae={'SEC_TO_TIME':_0x6b73('0x5d'),'DATE':_0x6b73('0x5e'),'HOUR':_0x6b73('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x6b73('0x60')};var _0x57ba7b=function(_0x7fba4b){return!_[_0x6b73('0x61')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x6b73('0x62'),_0x6b73('0x63')],_0x7fba4b);};var _0xd9fb6c=function(_0x1428b3){if(!_0x1428b3||!_0x1428b3[_0x6b73('0x64')][_0x6b73('0x39')]){return'';}for(var _0x32027b='(',_0x377a4e=0x0;_0x377a4e<_0x1428b3[_0x6b73('0x64')][_0x6b73('0x39')];_0x377a4e+=0x1){_0x377a4e>0x0&&(_0x32027b+='\x20'+_0x1428b3[_0x6b73('0x65')]+'\x20');_0x32027b+=_0x1428b3['rules'][_0x377a4e][_0x6b73('0x66')]?_0xd9fb6c(_0x1428b3[_0x6b73('0x64')][_0x377a4e]['group']):_0x1428b3[_0x6b73('0x64')][_0x377a4e][_0x6b73('0x67')]+'\x20'+_0x1428b3[_0x6b73('0x64')][_0x377a4e][_0x6b73('0x68')]+(_0x57ba7b(_0x1428b3['rules'][_0x377a4e][_0x6b73('0x68')])?'\x20'+_0x1428b3['rules'][_0x377a4e]['value']:'');}return _0x32027b+')';};var _0x54ba51={'where':{'id':_0x39976a[_0x6b73('0x48')]['id']}},_0x4b4328,_0x192977,_0x16333c,_0x2e4ba9,_0x4b3ccd;_0x54ba51=_[_0x6b73('0x40')]({},_0x54ba51,_0x39976a[_0x6b73('0x69')]);return db[_0x6b73('0x2f')][_0x6b73('0x4f')](_0x54ba51)['then'](function(_0x315b02){if(_0x315b02){_0x4b4328=_0x315b02;return _0x315b02[_0x6b73('0x6a')]();}return null;})[_0x6b73('0x26')](function(_0x325961){if(_0x325961){if(!_0x325961[_0x6b73('0x39')]){throw new db['Sequelize'][(_0x6b73('0x6b'))](_0x6b73('0x6c'),0x193);}_0x192977=_0x325961;return db[_0x6b73('0x6d')][_0x6b73('0x45')]({'raw':!![]});}return null;})[_0x6b73('0x26')](function(_0x522f3b){if(_0x522f3b){_0x16333c=_[_0x6b73('0x6e')](_0x522f3b,'id');var _0x3b6c65;var _0x3b02c3=squel['select']();_0x3b02c3[_0x6b73('0x6f')](_0x4b4328[_0x6b73('0x70')]);for(var _0x174133=0x0;_0x174133<_0x192977[_0x6b73('0x39')];_0x174133+=0x1){_0x3b6c65=_0x192977[_0x174133][_0x6b73('0x71')]?_0x16333c[_0x192977[_0x174133][_0x6b73('0x71')]]['metric']:_0x192977[_0x174133]['field'];_0x3b6c65=_0x192977[_0x174133]['function']?_[_0x6b73('0x72')](_0x415b24[_0x192977[_0x174133][_0x6b73('0x73')]],'%s',_0x3b6c65):_0x3b6c65;_0x3b6c65=_0x192977[_0x174133][_0x6b73('0x74')]?_[_0x6b73('0x72')](_0x101aae[_0x192977[_0x174133]['format']],'%s',_0x3b6c65):_0x3b6c65;if(_0x192977[_0x174133][_0x6b73('0x75')]){_0x3b02c3['group'](_0x3b6c65);}_0x192977[_0x174133][_0x6b73('0x76')]&&_0x3b02c3[_0x6b73('0x3c')](_0x3b6c65,_0x192977[_0x174133][_0x6b73('0x76')]===_0x6b73('0x77')?![]:!![]);_0x3b02c3[_0x6b73('0x67')](_0x3b6c65,_0x192977[_0x174133][_0x6b73('0x78')]||_0x3b6c65);}if(_0x4b4328[_0x6b73('0x79')]){_0x4b4328['joins']=JSON[_0x6b73('0x7a')](_0x4b4328[_0x6b73('0x79')]);for(var _0x504038=0x0;_0x504038<_0x4b4328['joins'][_0x6b73('0x39')];_0x504038+=0x1){if(_0x4b4328[_0x6b73('0x79')][_0x504038]['type']&&_[_0x6b73('0x61')](_0x4b39e5,_0x4b4328['joins'][_0x504038][_0x6b73('0x41')])&&_0x4b4328[_0x6b73('0x79')][_0x504038]['parentKey']&&_0x4b4328[_0x6b73('0x79')][_0x504038][_0x6b73('0x7b')]&&_0x4b4328['joins'][_0x504038][_0x6b73('0x7c')]){_0x3b02c3[_0x4b4328[_0x6b73('0x79')][_0x504038][_0x6b73('0x41')]](_0x4b4328[_0x6b73('0x79')][_0x504038][_0x6b73('0x7b')],null,util[_0x6b73('0x74')](_0x6b73('0x7d'),_0x4b4328[_0x6b73('0x70')],_0x4b4328[_0x6b73('0x79')][_0x504038][_0x6b73('0x7e')],_0x4b4328[_0x6b73('0x79')][_0x504038][_0x6b73('0x7b')],_0x4b4328[_0x6b73('0x79')][_0x504038]['foreignKey']));}}}if(_0x4b4328[_0x6b73('0x7f')]){_0x4b4328[_0x6b73('0x7f')]=JSON['parse'](_0x4b4328[_0x6b73('0x7f')]);_0x3b02c3[_0x6b73('0x3e')](_0xd9fb6c(_0x4b4328[_0x6b73('0x7f')]['group']));}_0x4b3ccd=_0x3b02c3[_0x6b73('0x80')]();_0x3b02c3[_0x6b73('0x1f')](_0x50eb23);_0x3b02c3[_0x6b73('0x1e')](0x0);logger[_0x6b73('0x81')]('Limited\x20Query:',_0x3b02c3['toString']());return db[_0x6b73('0x82')][_0x6b73('0x32')](_0x3b02c3['toString'](),{'type':db[_0x6b73('0x82')][_0x6b73('0x83')]['SELECT']});}})[_0x6b73('0x26')](respondWithResult(_0x31b488,null))[_0x6b73('0x46')](handleError(_0x31b488,null));};function runReport(_0x164e58,_0x5aa02a,_0x5b3ccd){var _0x548a39=_0x5aa02a['name'];var _0x584357=0xa;var _0x4c8baf=[_0x6b73('0x52'),'left_join','right_join',_0x6b73('0x54')];var _0x5aa29a={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x6b73('0x84'),'GROUP_CONCAT ASC':_0x6b73('0x5b'),'GROUP_CONCAT DESC':_0x6b73('0x5c')};var _0x3e384b={'SEC_TO_TIME':_0x6b73('0x5d'),'DATE':_0x6b73('0x5e'),'HOUR':_0x6b73('0x5f'),'ROUND':_0x6b73('0x85'),'UNIX_TIMESTAMP':_0x6b73('0x60')};var _0x5f0792=function(_0xaa7a3f){return!_[_0x6b73('0x61')]([_0x6b73('0x86'),_0x6b73('0x87'),_0x6b73('0x62'),'IS\x20NOT\x20EMPTY'],_0xaa7a3f);};var _0xa699bd=function(_0x13c88d){if(!_0x13c88d||!_0x13c88d[_0x6b73('0x64')]['length']){return'';}for(var _0x5289f0='(',_0x1bb904=0x0;_0x1bb904<_0x13c88d[_0x6b73('0x64')][_0x6b73('0x39')];_0x1bb904+=0x1){_0x1bb904>0x0&&(_0x5289f0+='\x20'+_0x13c88d[_0x6b73('0x65')]+'\x20');_0x5289f0+=_0x13c88d[_0x6b73('0x64')][_0x1bb904][_0x6b73('0x66')]?_0xa699bd(_0x13c88d[_0x6b73('0x64')][_0x1bb904][_0x6b73('0x66')]):_0x13c88d['rules'][_0x1bb904][_0x6b73('0x67')]+'\x20'+_0x13c88d[_0x6b73('0x64')][_0x1bb904][_0x6b73('0x68')]+(_0x5f0792(_0x13c88d[_0x6b73('0x64')][_0x1bb904][_0x6b73('0x68')])?'\x20'+_0x13c88d[_0x6b73('0x64')][_0x1bb904]['value']:'');}return _0x5289f0+')';};var _0x230473={'where':{'id':_0x164e58['id']}},_0x5dec50,_0x2f29eb,_0x2fae33,_0x3eb165,_0x381338;_0x230473=_['merge']({},_0x230473,_0x5b3ccd);return db[_0x6b73('0x2f')]['find'](_0x230473)[_0x6b73('0x26')](function(_0x30d0e0){if(_0x30d0e0){_0x5dec50=_0x30d0e0;return _0x30d0e0[_0x6b73('0x6a')]();}return null;})[_0x6b73('0x26')](function(_0x17cf5f){if(_0x17cf5f){if(!_0x17cf5f['length']){throw new db['Sequelize'][(_0x6b73('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2f29eb=_0x17cf5f;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x289b83){if(_0x289b83){_0x2fae33=_[_0x6b73('0x6e')](_0x289b83,'id');var _0x1443a7;var _0x2c69ec=squel[_0x6b73('0x88')]();_0x2c69ec[_0x6b73('0x6f')](_0x5dec50[_0x6b73('0x70')]);for(var _0x5b3d53=0x0;_0x5b3d53<_0x2f29eb[_0x6b73('0x39')];_0x5b3d53+=0x1){_0x1443a7=_0x2f29eb[_0x5b3d53][_0x6b73('0x71')]?_0x2fae33[_0x2f29eb[_0x5b3d53][_0x6b73('0x71')]][_0x6b73('0x89')]:_0x2f29eb[_0x5b3d53]['field'];_0x1443a7=_0x2f29eb[_0x5b3d53][_0x6b73('0x73')]?_['replace'](_0x5aa29a[_0x2f29eb[_0x5b3d53]['function']],'%s',_0x1443a7):_0x1443a7;_0x1443a7=_0x2f29eb[_0x5b3d53][_0x6b73('0x74')]?_[_0x6b73('0x72')](_0x3e384b[_0x2f29eb[_0x5b3d53][_0x6b73('0x74')]],'%s',_0x1443a7):_0x1443a7;if(_0x2f29eb[_0x5b3d53][_0x6b73('0x75')]){_0x2c69ec['group'](_0x1443a7);}_0x2f29eb[_0x5b3d53]['orderBy']&&_0x2c69ec['order'](_0x1443a7,_0x2f29eb[_0x5b3d53][_0x6b73('0x76')]===_0x6b73('0x77')?![]:!![]);_0x2c69ec[_0x6b73('0x67')](_0x1443a7,_0x2f29eb[_0x5b3d53][_0x6b73('0x78')]||_0x1443a7);}if(_0x5dec50[_0x6b73('0x79')]){_0x5dec50['joins']=JSON[_0x6b73('0x7a')](_0x5dec50[_0x6b73('0x79')]);for(var _0x54240b=0x0;_0x54240b<_0x5dec50['joins'][_0x6b73('0x39')];_0x54240b+=0x1){if(_0x5dec50[_0x6b73('0x79')][_0x54240b][_0x6b73('0x41')]&&_[_0x6b73('0x61')](_0x4c8baf,_0x5dec50[_0x6b73('0x79')][_0x54240b][_0x6b73('0x41')])&&_0x5dec50[_0x6b73('0x79')][_0x54240b][_0x6b73('0x7e')]&&_0x5dec50[_0x6b73('0x79')][_0x54240b][_0x6b73('0x7b')]&&_0x5dec50[_0x6b73('0x79')][_0x54240b][_0x6b73('0x7c')]){_0x2c69ec[_0x5dec50['joins'][_0x54240b][_0x6b73('0x41')]](_0x5dec50[_0x6b73('0x79')][_0x54240b][_0x6b73('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5dec50[_0x6b73('0x70')],_0x5dec50[_0x6b73('0x79')][_0x54240b][_0x6b73('0x7e')],_0x5dec50[_0x6b73('0x79')][_0x54240b][_0x6b73('0x7b')],_0x5dec50[_0x6b73('0x79')][_0x54240b][_0x6b73('0x7c')]));}}}if(_0x5dec50['conditions']){_0x5dec50[_0x6b73('0x7f')]=JSON[_0x6b73('0x7a')](_0x5dec50[_0x6b73('0x7f')]);_0x2c69ec[_0x6b73('0x3e')](_0xa699bd(_0x5dec50[_0x6b73('0x7f')][_0x6b73('0x66')]));}_0x381338=_0x2c69ec['clone']();_0x2c69ec['limit'](_0x584357);_0x2c69ec[_0x6b73('0x1e')](0x0);logger[_0x6b73('0x81')](_0x6b73('0x8a'),_0x2c69ec[_0x6b73('0x8b')]());return db['sequelize'][_0x6b73('0x32')](_0x2c69ec[_0x6b73('0x8b')](),{'type':db[_0x6b73('0x82')][_0x6b73('0x83')][_0x6b73('0x8c')]});}})['then'](function(_0x24a325){if(!_0x24a325[_0x6b73('0x39')]){throw new db['Sequelize'][(_0x6b73('0x6b'))](_0x6b73('0x8d'),0xcc);}if(_0x5aa02a['output']===_0x6b73('0x8e')){return null;}var _0x214819=_[_0x6b73('0x40')](_0x5aa02a,{'name':_0x5aa02a['fullPath']||_0x5aa02a[_0x6b73('0x2b')]||_0x5dec50['name'],'basename':_0x548a39,'savename':util[_0x6b73('0x74')](_0x6b73('0x8f'),_0x5aa02a[_0x6b73('0x2b')]||_0x5dec50[_0x6b73('0x2b')],require(_0x6b73('0x90'))[_0x6b73('0x91')](0x4),_0x5aa02a[_0x6b73('0x92')]||_0x6b73('0x93')),'reportId':_0x5dec50['id'],'reportType':_0x6b73('0x94')});return db[_0x6b73('0x95')][_0x6b73('0x4a')](_0x214819,{'raw':!![]});})[_0x6b73('0x26')](function(_0x5caf7d){if(_0x5dec50['table']===_0x6b73('0x96')){_0x381338[_0x6b73('0x3e')](_0x5dec50[_0x6b73('0x70')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x5aa02a[_0x6b73('0x97')],_0x5aa02a['endDate']);}else{_0x381338['where'](_0x5dec50[_0x6b73('0x70')]+_0x6b73('0x98'),_0x5aa02a[_0x6b73('0x97')],_0x5aa02a[_0x6b73('0x99')]);}if(_0x5caf7d){logger[_0x6b73('0x9a')](_0x6b73('0x9b'),_0x381338[_0x6b73('0x8b')]());require(_0x6b73('0x9c'))[_0x6b73('0x9d')](path[_0x6b73('0x52')](__dirname,_0x6b73('0x9e'),_0x5caf7d[_0x6b73('0x92')]),[_0x5caf7d['id'],_0x381338['toString'](),path[_0x6b73('0x52')](__dirname,_0x6b73('0x9f'),_0x5caf7d[_0x6b73('0xa0')]),_0x548a39]);return _0x5caf7d;}else{var _0x41ff98=squel[_0x6b73('0x88')]();_0x41ff98[_0x6b73('0x6f')]('('+_0x381338['toString']()+')',_0x6b73('0xa1'));_0x41ff98[_0x6b73('0x67')](_0x6b73('0xa2'),_0x6b73('0x1d'));_0x381338[_0x6b73('0x1f')](_0x5aa02a[_0x6b73('0x1f')]||_0x584357);_0x381338[_0x6b73('0x1e')](_0x5aa02a['offset']||0x0);return dbH['sequelize'][_0x6b73('0x32')](_0x41ff98[_0x6b73('0x8b')](),{'type':dbH[_0x6b73('0x82')][_0x6b73('0x83')][_0x6b73('0x8c')]})['then'](function(_0x5aed31){if(!_0x5aed31[_0x6b73('0x39')]){_0x3eb165=0x0;}else{_0x3eb165=_0x5aed31[0x0]['count']||0x0;}return dbH[_0x6b73('0x82')][_0x6b73('0x32')](_0x381338[_0x6b73('0x8b')](),{'type':dbH[_0x6b73('0x82')]['QueryTypes']['SELECT']});})['then'](function(_0x2df761){return{'rows':_0x2df761||[],'count':_0x3eb165};});}});}exports['run']=function(_0x3b2581,_0x3bd447){return runReport(_0x3b2581[_0x6b73('0x48')],_0x3b2581[_0x6b73('0x32')],_0x3b2581[_0x6b73('0x69')])[_0x6b73('0x26')](respondWithResult(_0x3bd447,null))[_0x6b73('0x46')](handleError(_0x3bd447,null));};exports['runReport']=runReport;exports['query']=function(_0x1e1328,_0x5794bc){var _0x41dd42=0xa;var _0x3d2043=[_0x6b73('0x52'),_0x6b73('0x53'),_0x6b73('0xa3'),_0x6b73('0x54')];var _0x4fd72a={'SUM':_0x6b73('0x55'),'COUNT':_0x6b73('0x56'),'COUNT DISTINCT':_0x6b73('0x57'),'MAX':_0x6b73('0x58'),'MIN':_0x6b73('0x59'),'AVG':_0x6b73('0x5a'),'GROUP_CONCAT':_0x6b73('0x84'),'GROUP_CONCAT ASC':_0x6b73('0x5b'),'GROUP_CONCAT DESC':_0x6b73('0x5c')};var _0x37f239={'SEC_TO_TIME':_0x6b73('0x5d'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x6b73('0x85'),'UNIX_TIMESTAMP':_0x6b73('0x60')};var _0x5cdc0f=function(_0x42ee55){return!_[_0x6b73('0x61')]([_0x6b73('0x86'),_0x6b73('0x87'),'IS\x20EMPTY',_0x6b73('0x63')],_0x42ee55);};var _0x5e7c65=function(_0xa5fbc0){if(!_0xa5fbc0||!_0xa5fbc0[_0x6b73('0x64')][_0x6b73('0x39')]){return'';}for(var _0x452148='(',_0x40d6dd=0x0;_0x40d6dd<_0xa5fbc0[_0x6b73('0x64')]['length'];_0x40d6dd+=0x1){_0x40d6dd>0x0&&(_0x452148+='\x20'+_0xa5fbc0[_0x6b73('0x65')]+'\x20');_0x452148+=_0xa5fbc0[_0x6b73('0x64')][_0x40d6dd][_0x6b73('0x66')]?_0x5e7c65(_0xa5fbc0['rules'][_0x40d6dd][_0x6b73('0x66')]):_0xa5fbc0[_0x6b73('0x64')][_0x40d6dd]['field']+'\x20'+_0xa5fbc0[_0x6b73('0x64')][_0x40d6dd][_0x6b73('0x68')]+(_0x5cdc0f(_0xa5fbc0[_0x6b73('0x64')][_0x40d6dd][_0x6b73('0x68')])?'\x20'+_0xa5fbc0[_0x6b73('0x64')][_0x40d6dd][_0x6b73('0xa4')]:'');}return _0x452148+')';};var _0x8dd3bb={'where':{'id':_0x1e1328[_0x6b73('0x48')]['id']}},_0x5123c6,_0x2e4796,_0x58c8d1,_0x21160c,_0x36f904;_0x8dd3bb=_[_0x6b73('0x40')]({},_0x8dd3bb,_0x1e1328['options']);return db['AnalyticCustomReport'][_0x6b73('0x4f')](_0x8dd3bb)['then'](function(_0x3ff78e){if(_0x3ff78e){_0x5123c6=_0x3ff78e;return _0x3ff78e[_0x6b73('0x6a')]();}return null;})['then'](function(_0xebb2b5){if(_0xebb2b5){if(!_0xebb2b5['length']){throw new db[(_0x6b73('0xa5'))][(_0x6b73('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2e4796=_0xebb2b5;return db[_0x6b73('0x6d')][_0x6b73('0x45')]({'raw':!![]});}return null;})[_0x6b73('0x26')](function(_0x3a332f){if(_0x3a332f){_0x58c8d1=_['keyBy'](_0x3a332f,'id');var _0x29e3b6;var _0x32b226=squel[_0x6b73('0x88')]();_0x32b226['from'](_0x5123c6['table']);for(var _0x472893=0x0;_0x472893<_0x2e4796['length'];_0x472893+=0x1){_0x29e3b6=_0x2e4796[_0x472893]['MetricId']?_0x58c8d1[_0x2e4796[_0x472893][_0x6b73('0x71')]][_0x6b73('0x89')]:_0x2e4796[_0x472893][_0x6b73('0x67')];_0x29e3b6=_0x2e4796[_0x472893][_0x6b73('0x73')]?_[_0x6b73('0x72')](_0x4fd72a[_0x2e4796[_0x472893][_0x6b73('0x73')]],'%s',_0x29e3b6):_0x29e3b6;_0x29e3b6=_0x2e4796[_0x472893][_0x6b73('0x74')]?_[_0x6b73('0x72')](_0x37f239[_0x2e4796[_0x472893][_0x6b73('0x74')]],'%s',_0x29e3b6):_0x29e3b6;if(_0x2e4796[_0x472893][_0x6b73('0x75')]){_0x32b226[_0x6b73('0x66')](_0x29e3b6);}_0x2e4796[_0x472893][_0x6b73('0x76')]&&_0x32b226['order'](_0x29e3b6,_0x2e4796[_0x472893][_0x6b73('0x76')]===_0x6b73('0x77')?![]:!![]);_0x32b226[_0x6b73('0x67')](_0x29e3b6,_0x2e4796[_0x472893][_0x6b73('0x78')]||_0x29e3b6);}if(_0x5123c6[_0x6b73('0x79')]){_0x5123c6[_0x6b73('0x79')]=JSON[_0x6b73('0x7a')](_0x5123c6['joins']);for(var _0xb6f4e3=0x0;_0xb6f4e3<_0x5123c6[_0x6b73('0x79')][_0x6b73('0x39')];_0xb6f4e3+=0x1){if(_0x5123c6[_0x6b73('0x79')][_0xb6f4e3][_0x6b73('0x41')]&&_['includes'](_0x3d2043,_0x5123c6[_0x6b73('0x79')][_0xb6f4e3][_0x6b73('0x41')])&&_0x5123c6['joins'][_0xb6f4e3][_0x6b73('0x7e')]&&_0x5123c6['joins'][_0xb6f4e3][_0x6b73('0x7b')]&&_0x5123c6[_0x6b73('0x79')][_0xb6f4e3][_0x6b73('0x7c')]){_0x32b226[_0x5123c6['joins'][_0xb6f4e3][_0x6b73('0x41')]](_0x5123c6[_0x6b73('0x79')][_0xb6f4e3][_0x6b73('0x7b')],null,util[_0x6b73('0x74')](_0x6b73('0x7d'),_0x5123c6[_0x6b73('0x70')],_0x5123c6[_0x6b73('0x79')][_0xb6f4e3][_0x6b73('0x7e')],_0x5123c6[_0x6b73('0x79')][_0xb6f4e3][_0x6b73('0x7b')],_0x5123c6['joins'][_0xb6f4e3][_0x6b73('0x7c')]));}}}if(_0x5123c6[_0x6b73('0x7f')]){_0x5123c6[_0x6b73('0x7f')]=JSON[_0x6b73('0x7a')](_0x5123c6[_0x6b73('0x7f')]);_0x32b226['where'](_0x5e7c65(_0x5123c6[_0x6b73('0x7f')]['group']));}_0x36f904=_0x32b226['clone']();_0x32b226[_0x6b73('0x1f')](_0x41dd42);_0x32b226[_0x6b73('0x1e')](0x0);logger['debug'](_0x6b73('0x8a'),_0x32b226[_0x6b73('0x8b')]());return db[_0x6b73('0x82')][_0x6b73('0x32')](_0x32b226[_0x6b73('0x8b')](),{'type':db[_0x6b73('0x82')][_0x6b73('0x83')]['SELECT']});}})[_0x6b73('0x26')](function(){return{'sql':_0x36f904[_0x6b73('0x8b')]()};})[_0x6b73('0x26')](respondWithResult(_0x5794bc,null))['catch'](handleError(_0x5794bc,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 15934ca..1f267ac 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 _0x0175=['api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger'];(function(_0x2fe9f6,_0x549f77){var _0xaf71da=function(_0x1de2f8){while(--_0x1de2f8){_0x2fe9f6['push'](_0x2fe9f6['shift']());}};_0xaf71da(++_0x549f77);}(_0x0175,0x6d));var _0x5017=function(_0x479650,_0x2bee99){_0x479650=_0x479650-0x0;var _0x26b288=_0x0175[_0x479650];return _0x26b288;};'use strict';var _=require(_0x5017('0x0'));var util=require(_0x5017('0x1'));var logger=require(_0x5017('0x2'))(_0x5017('0x3'));var moment=require('moment');var BPromise=require(_0x5017('0x4'));var rp=require(_0x5017('0x5'));var fs=require('fs');var path=require(_0x5017('0x6'));var rimraf=require(_0x5017('0x7'));var config=require(_0x5017('0x8'));var attributes=require(_0x5017('0x9'));module[_0x5017('0xa')]=function(_0xf5eda6,_0x1cebb9){return _0xf5eda6[_0x5017('0xb')](_0x5017('0xc'),attributes,{'tableName':_0x5017('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cd7=['api','moment','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x573010,_0x2923c4){var _0x84c43d=function(_0x22c44d){while(--_0x22c44d){_0x573010['push'](_0x573010['shift']());}};_0x84c43d(++_0x2923c4);}(_0x5cd7,0x77));var _0x75cd=function(_0x1f6e37,_0x560390){_0x1f6e37=_0x1f6e37-0x0;var _0x3d17ad=_0x5cd7[_0x1f6e37];return _0x3d17ad;};'use strict';var _=require(_0x75cd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x75cd('0x1'));var moment=require(_0x75cd('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x75cd('0x3'));var config=require(_0x75cd('0x4'));var attributes=require(_0x75cd('0x5'));module[_0x75cd('0x6')]=function(_0x7f9102,_0x480037){return _0x7f9102[_0x75cd('0x7')](_0x75cd('0x8'),attributes,{'tableName':_0x75cd('0x9'),'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 2310c48..02c60e0 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 _0xa143=['jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5a34e0,_0x485210){var _0x5db53a=function(_0x452847){while(--_0x452847){_0x5a34e0['push'](_0x5a34e0['shift']());}};_0x5db53a(++_0x485210);}(_0xa143,0x115));var _0x3a14=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa143[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3a14('0x0'));var util=require(_0x3a14('0x1'));var moment=require(_0x3a14('0x2'));var BPromise=require(_0x3a14('0x3'));var rs=require(_0x3a14('0x4'));var fs=require('fs');var Redis=require(_0x3a14('0x5'));var db=require(_0x3a14('0x6'))['db'];var utils=require(_0x3a14('0x7'));var logger=require(_0x3a14('0x8'))(_0x3a14('0x9'));var config=require(_0x3a14('0xa'));var jayson=require(_0x3a14('0xb'));var client=jayson['client'][_0x3a14('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c2f0c,_0x332857,_0x3fb806){return new BPromise(function(_0x698ed8,_0x2fafa0){return client[_0x3a14('0xd')](_0x2c2f0c,_0x3fb806)[_0x3a14('0xe')](function(_0x28d9ef){logger[_0x3a14('0xf')](_0x3a14('0x10'),_0x332857,_0x3a14('0x11'));logger[_0x3a14('0x12')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x332857,_0x3a14('0x11'),JSON[_0x3a14('0x13')](_0x28d9ef));if(_0x28d9ef['error']){if(_0x28d9ef[_0x3a14('0x14')]['code']===0x1f4){logger[_0x3a14('0x14')](_0x3a14('0x10'),_0x332857,_0x28d9ef[_0x3a14('0x14')][_0x3a14('0x15')]);return _0x2fafa0(_0x28d9ef[_0x3a14('0x14')]['message']);}logger[_0x3a14('0x14')](_0x3a14('0x10'),_0x332857,_0x28d9ef[_0x3a14('0x14')][_0x3a14('0x15')]);return _0x698ed8(_0x28d9ef[_0x3a14('0x14')][_0x3a14('0x15')]);}else{logger[_0x3a14('0xf')](_0x3a14('0x10'),_0x332857,'request\x20sent');_0x698ed8(_0x28d9ef[_0x3a14('0x16')]['message']);}})[_0x3a14('0x17')](function(_0x34ede5){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x332857,_0x34ede5);_0x2fafa0(_0x34ede5);});});} \ No newline at end of file +var _0xf72c=['info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x2c7d37,_0x1b995c){var _0x4c6830=function(_0xd2d47d){while(--_0xd2d47d){_0x2c7d37['push'](_0x2c7d37['shift']());}};_0x4c6830(++_0x1b995c);}(_0xf72c,0x134));var _0xcf72=function(_0xdcfb3,_0x27f442){_0xdcfb3=_0xdcfb3-0x0;var _0x143c40=_0xf72c[_0xdcfb3];return _0x143c40;};'use strict';var _=require(_0xcf72('0x0'));var util=require(_0xcf72('0x1'));var moment=require(_0xcf72('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf72('0x3'));var fs=require('fs');var Redis=require(_0xcf72('0x4'));var db=require(_0xcf72('0x5'))['db'];var utils=require(_0xcf72('0x6'));var logger=require(_0xcf72('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcf72('0x8'));var client=jayson[_0xcf72('0x9')][_0xcf72('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ea6e0,_0x14ce0d,_0x538f87){return new BPromise(function(_0x3d1d35,_0x2dc622){return client[_0xcf72('0xb')](_0x2ea6e0,_0x538f87)['then'](function(_0x53c5cc){logger[_0xcf72('0xc')](_0xcf72('0xd'),_0x14ce0d,_0xcf72('0xe'));logger[_0xcf72('0xf')](_0xcf72('0x10'),_0x14ce0d,_0xcf72('0xe'),JSON['stringify'](_0x53c5cc));if(_0x53c5cc[_0xcf72('0x11')]){if(_0x53c5cc[_0xcf72('0x11')][_0xcf72('0x12')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x14ce0d,_0x53c5cc[_0xcf72('0x11')]['message']);return _0x2dc622(_0x53c5cc['error'][_0xcf72('0x13')]);}logger[_0xcf72('0x11')](_0xcf72('0xd'),_0x14ce0d,_0x53c5cc[_0xcf72('0x11')]['message']);return _0x3d1d35(_0x53c5cc[_0xcf72('0x11')]['message']);}else{logger[_0xcf72('0xc')](_0xcf72('0xd'),_0x14ce0d,_0xcf72('0xe'));_0x3d1d35(_0x53c5cc['result']['message']);}})['catch'](function(_0x40618e){logger[_0xcf72('0x11')](_0xcf72('0xd'),_0x14ce0d,_0x40618e);_0x2dc622(_0x40618e);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3be9d82..51c19ee 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 _0x295b=['../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','/:id','show','get','/:id/preview','preview','/:id/run','run','query','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x16a4d1,_0x1926ad){var _0x4f4d61=function(_0x244f00){while(--_0x244f00){_0x16a4d1['push'](_0x16a4d1['shift']());}};_0x4f4d61(++_0x1926ad);}(_0x295b,0x14b));var _0xb295=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x295b[_0x4e7d25];return _0x526fe6;};'use strict';var multer=require(_0xb295('0x0'));var util=require('util');var path=require(_0xb295('0x1'));var timeout=require(_0xb295('0x2'));var express=require('express');var router=express[_0xb295('0x3')]();var auth=require(_0xb295('0x4'));var interaction=require(_0xb295('0x5'));var config=require(_0xb295('0x6'));var controller=require(_0xb295('0x7'));router['get']('/',auth[_0xb295('0x8')](),controller[_0xb295('0x9')]);router['get'](_0xb295('0xa'),auth['isAuthenticated'](),controller[_0xb295('0xb')]);router[_0xb295('0xc')](_0xb295('0xd'),auth[_0xb295('0x8')](),controller[_0xb295('0xe')]);router[_0xb295('0xc')](_0xb295('0xf'),auth[_0xb295('0x8')](),controller[_0xb295('0x10')]);router['get']('/:id/query',auth[_0xb295('0x8')](),controller[_0xb295('0x11')]);router[_0xb295('0x12')]('/',auth[_0xb295('0x8')](),controller['create']);router[_0xb295('0x13')](_0xb295('0xa'),auth['isAuthenticated'](),controller[_0xb295('0x14')]);router[_0xb295('0x15')](_0xb295('0xa'),auth[_0xb295('0x8')](),controller[_0xb295('0x16')]);module[_0xb295('0x17')]=router; \ No newline at end of file +var _0x67b4=['create','put','update','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','index','get','/:id','isAuthenticated','show','/:id/preview','run','/:id/query'];(function(_0x214747,_0x36dfed){var _0x4a5980=function(_0x15f619){while(--_0x15f619){_0x214747['push'](_0x214747['shift']());}};_0x4a5980(++_0x36dfed);}(_0x67b4,0x135));var _0x467b=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x67b4[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require(_0x467b('0x0'));var util=require('util');var path=require(_0x467b('0x1'));var timeout=require(_0x467b('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x467b('0x3'));var interaction=require(_0x467b('0x4'));var config=require('../../config/environment');var controller=require(_0x467b('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x467b('0x6')]);router[_0x467b('0x7')](_0x467b('0x8'),auth[_0x467b('0x9')](),controller[_0x467b('0xa')]);router['get'](_0x467b('0xb'),auth[_0x467b('0x9')](),controller['preview']);router[_0x467b('0x7')]('/:id/run',auth[_0x467b('0x9')](),controller[_0x467b('0xc')]);router[_0x467b('0x7')](_0x467b('0xd'),auth[_0x467b('0x9')](),controller['query']);router['post']('/',auth[_0x467b('0x9')](),controller[_0x467b('0xe')]);router[_0x467b('0xf')](_0x467b('0x8'),auth[_0x467b('0x9')](),controller[_0x467b('0x10')]);router[_0x467b('0x11')](_0x467b('0x8'),auth[_0x467b('0x9')](),controller['destroy']);module[_0x467b('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 0af8a81..4b7ab69 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 _0x42cf=['STRING','sequelize','exports'];(function(_0x51aec2,_0x2a0ac3){var _0x52aff4=function(_0x66e576){while(--_0x66e576){_0x51aec2['push'](_0x51aec2['shift']());}};_0x52aff4(++_0x2a0ac3);}(_0x42cf,0x16c));var _0xf42c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x42cf[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xf42c('0x0'));module[_0xf42c('0x1')]={'name':{'type':Sequelize[_0xf42c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf42c('0x2')]},'parent':{'type':Sequelize[_0xf42c('0x2')]},'table':{'type':Sequelize[_0xf42c('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4171=['sequelize','exports','STRING'];(function(_0x492221,_0x9e2521){var _0x398bf9=function(_0x303c5b){while(--_0x303c5b){_0x492221['push'](_0x492221['shift']());}};_0x398bf9(++_0x9e2521);}(_0x4171,0x183));var _0x1417=function(_0x4d7056,_0x2098cc){_0x4d7056=_0x4d7056-0x0;var _0x4d8a2c=_0x4171[_0x4d7056];return _0x4d8a2c;};'use strict';var Sequelize=require(_0x1417('0x0'));module[_0x1417('0x1')]={'name':{'type':Sequelize[_0x1417('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1417('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x1417('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index f95e67e..f243ead 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 _0xe437=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','select','table','MetricId','metric','function','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','left_join','SUM(%s)','AVG(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','AnalyticMetric','from','format','foreignTable','No\x20available\x20data','output','web','randomstring','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','COUNT(*)','ROUND(%s)','keyBy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','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','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','DefaultReports','sendStatus','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0xce58df,_0x4b6850){var _0x57b86a=function(_0x4599cd){while(--_0x4599cd){_0xce58df['push'](_0xce58df['shift']());}};_0x57b86a(++_0x4b6850);}(_0xe437,0x69));var _0x7e43=function(_0x15ee3b,_0x5e1a1f){_0x15ee3b=_0x15ee3b-0x0;var _0x10b5c2=_0xe437[_0x15ee3b];return _0x10b5c2;};'use strict';var pdf=require(_0x7e43('0x0'));var emlformat=require(_0x7e43('0x1'));var rimraf=require(_0x7e43('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e43('0x3'));var rp=require(_0x7e43('0x4'));var moment=require(_0x7e43('0x5'));var BPromise=require(_0x7e43('0x6'));var Mustache=require(_0x7e43('0x7'));var util=require(_0x7e43('0x8'));var path=require(_0x7e43('0x9'));var sox=require(_0x7e43('0xa'));var csv=require('to-csv');var ejs=require(_0x7e43('0xb'));var fs=require('fs');var _=require(_0x7e43('0xc'));var squel=require(_0x7e43('0xd'));var crypto=require(_0x7e43('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7e43('0xf'));var toCsv=require(_0x7e43('0x10'));var querystring=require(_0x7e43('0x11'));var Papa=require(_0x7e43('0x12'));var Redis=require(_0x7e43('0x13'));var authService=require(_0x7e43('0x14'));var qs=require(_0x7e43('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e43('0x16'));var logger=require(_0x7e43('0x17'))(_0x7e43('0x18'));var utils=require(_0x7e43('0x19'));var config=require(_0x7e43('0x1a'));var licenseUtil=require(_0x7e43('0x1b'));var db=require(_0x7e43('0x1c'))['db'];var dbH=require(_0x7e43('0x1c'))['dbH'];function respondWithStatusCode(_0x107643,_0x5a6670){_0x5a6670=_0x5a6670||0xcc;return function(_0x53b301){if(_0x53b301){return _0x107643['sendStatus'](_0x5a6670);}return _0x107643['status'](_0x5a6670)[_0x7e43('0x1d')]();};}function respondWithResult(_0x57f727,_0x538b66){_0x538b66=_0x538b66||0xc8;return function(_0x6bad1b){if(_0x6bad1b){return _0x57f727[_0x7e43('0x1e')](_0x538b66)[_0x7e43('0x1f')](_0x6bad1b);}};}function respondWithFilteredResult(_0x3b0809,_0x543c24){return function(_0xd4fa2){if(_0xd4fa2){var _0x1f14f7=_0xd4fa2[_0x7e43('0x20')],_0x2a66ee=_0x543c24[_0x7e43('0x21')],_0x1362bf=_0x543c24['offset']+_0x543c24[_0x7e43('0x22')],_0x1d8277;if(_0x1362bf>=_0x1f14f7){_0x1362bf=_0x1f14f7;_0x1d8277=0xc8;}else{_0x1d8277=0xce;}_0x3b0809[_0x7e43('0x1e')](_0x1d8277);return _0x3b0809[_0x7e43('0x23')](_0x7e43('0x24'),_0x2a66ee+'-'+_0x1362bf+'/'+_0x1f14f7)[_0x7e43('0x1f')](_0xd4fa2);}return null;};}function patchUpdates(_0x2b9bc8){return function(_0x3ad016){try{jsonpatch[_0x7e43('0x25')](_0x3ad016,_0x2b9bc8,!![]);}catch(_0x4075c3){return BPromise['reject'](_0x4075c3);}return _0x3ad016[_0x7e43('0x26')]();};}function saveUpdates(_0x5b24f6,_0x912aa8){return function(_0x11c00f){if(_0x11c00f){return _0x11c00f['update'](_0x5b24f6)[_0x7e43('0x27')](function(_0xf1eb33){return _0xf1eb33;});}return null;};}function removeEntity(_0x424126,_0x4d9701){return function(_0xa1b15f){if(_0xa1b15f){return _0xa1b15f[_0x7e43('0x28')]()[_0x7e43('0x27')](function(){var _0x295b46=_0xa1b15f['get']({'plain':!![]});var _0x1c41d4=_0x7e43('0x29');return db['UserProfileResource'][_0x7e43('0x28')]({'where':{'type':_0x1c41d4,'resourceId':_0x295b46['id']}})[_0x7e43('0x27')](function(){return _0xa1b15f;});})[_0x7e43('0x27')](function(){_0x424126[_0x7e43('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30a9c5,_0x5b1f73){return function(_0xbdea56){if(!_0xbdea56){_0x30a9c5[_0x7e43('0x2a')](0x194);}return _0xbdea56;};}function handleError(_0x55100c,_0x3ae37c){_0x3ae37c=_0x3ae37c||0x1f4;return function(_0x51725c){logger[_0x7e43('0x2b')](_0x51725c[_0x7e43('0x2c')]);if(_0x51725c[_0x7e43('0x2d')]){delete _0x51725c[_0x7e43('0x2d')];}_0x55100c['status'](_0x3ae37c)['send'](_0x51725c);};}exports[_0x7e43('0x2e')]=function(_0x106c52,_0x243ac4){var _0x8e2aad={},_0x136956={},_0x5dffc8={'count':0x0,'rows':[]};var _0x4e570d=_['map'](db[_0x7e43('0x2f')][_0x7e43('0x30')],function(_0x2ba47d){return{'name':_0x2ba47d['fieldName'],'type':_0x2ba47d[_0x7e43('0x31')][_0x7e43('0x32')]};});_0x136956[_0x7e43('0x33')]=_[_0x7e43('0x34')](_0x4e570d,_0x7e43('0x2d'));_0x136956[_0x7e43('0x35')]=_[_0x7e43('0x36')](_0x106c52[_0x7e43('0x35')]);_0x136956[_0x7e43('0x37')]=_[_0x7e43('0x38')](_0x136956[_0x7e43('0x33')],_0x136956[_0x7e43('0x35')]);_0x8e2aad[_0x7e43('0x39')]=_[_0x7e43('0x38')](_0x136956[_0x7e43('0x33')],qs[_0x7e43('0x3a')](_0x106c52[_0x7e43('0x35')]['fields']));_0x8e2aad[_0x7e43('0x39')]=_0x8e2aad['attributes']['length']?_0x8e2aad[_0x7e43('0x39')]:_0x136956[_0x7e43('0x33')];if(!_0x106c52[_0x7e43('0x35')][_0x7e43('0x3b')](_0x7e43('0x3c'))){_0x8e2aad[_0x7e43('0x22')]=qs[_0x7e43('0x22')](_0x106c52[_0x7e43('0x35')][_0x7e43('0x22')]);_0x8e2aad['offset']=qs[_0x7e43('0x21')](_0x106c52[_0x7e43('0x35')]['offset']);}_0x8e2aad[_0x7e43('0x3d')]=qs[_0x7e43('0x3e')](_0x106c52[_0x7e43('0x35')]['sort']);_0x8e2aad[_0x7e43('0x3f')]=qs['filters'](_[_0x7e43('0x40')](_0x106c52[_0x7e43('0x35')],_0x136956['filters']),_0x4e570d);if(_0x106c52['query'][_0x7e43('0x41')]){_0x8e2aad[_0x7e43('0x3f')]=_[_0x7e43('0x42')](_0x8e2aad[_0x7e43('0x3f')],{'$or':_[_0x7e43('0x34')](_0x4e570d,function(_0x2ee997){if(_0x2ee997[_0x7e43('0x31')]!==_0x7e43('0x43')){var _0x1885c3={};_0x1885c3[_0x2ee997[_0x7e43('0x2d')]]={'$like':'%'+_0x106c52[_0x7e43('0x35')][_0x7e43('0x41')]+'%'};return _0x1885c3;}})});}_0x8e2aad=_[_0x7e43('0x42')]({},_0x8e2aad,_0x106c52[_0x7e43('0x44')]);var _0x4c9065={'where':_0x8e2aad[_0x7e43('0x3f')]};return db['AnalyticDefaultReport'][_0x7e43('0x20')](_0x4c9065)['then'](function(_0x27775d){_0x5dffc8[_0x7e43('0x20')]=_0x27775d;if(_0x106c52[_0x7e43('0x35')][_0x7e43('0x45')]){_0x8e2aad[_0x7e43('0x46')]=[{'all':!![]}];}return db[_0x7e43('0x2f')][_0x7e43('0x47')](_0x8e2aad);})[_0x7e43('0x27')](function(_0xdd4699){_0x5dffc8['rows']=_0xdd4699;return _0x5dffc8;})[_0x7e43('0x27')](respondWithFilteredResult(_0x243ac4,_0x8e2aad))[_0x7e43('0x48')](handleError(_0x243ac4,null));};exports[_0x7e43('0x49')]=function(_0x32be32,_0x2f9764){var _0x16ff8f={'raw':!![],'where':{'id':_0x32be32['params']['id']}},_0x2551df={};_0x2551df[_0x7e43('0x33')]=_[_0x7e43('0x36')](db['AnalyticDefaultReport'][_0x7e43('0x30')]);_0x2551df[_0x7e43('0x35')]=_[_0x7e43('0x36')](_0x32be32[_0x7e43('0x35')]);_0x2551df[_0x7e43('0x37')]=_[_0x7e43('0x38')](_0x2551df['model'],_0x2551df[_0x7e43('0x35')]);_0x16ff8f[_0x7e43('0x39')]=_[_0x7e43('0x38')](_0x2551df[_0x7e43('0x33')],qs[_0x7e43('0x3a')](_0x32be32[_0x7e43('0x35')][_0x7e43('0x3a')]));_0x16ff8f[_0x7e43('0x39')]=_0x16ff8f[_0x7e43('0x39')][_0x7e43('0x4a')]?_0x16ff8f[_0x7e43('0x39')]:_0x2551df['model'];if(_0x32be32[_0x7e43('0x35')][_0x7e43('0x45')]){_0x16ff8f['include']=[{'all':!![]}];}_0x16ff8f=_[_0x7e43('0x42')]({},_0x16ff8f,_0x32be32[_0x7e43('0x44')]);return db[_0x7e43('0x2f')][_0x7e43('0x4b')](_0x16ff8f)[_0x7e43('0x27')](handleEntityNotFound(_0x2f9764,null))[_0x7e43('0x27')](respondWithResult(_0x2f9764,null))[_0x7e43('0x48')](handleError(_0x2f9764,null));};exports['create']=function(_0x2a0362,_0x11ab4a){return db[_0x7e43('0x2f')]['create'](_0x2a0362[_0x7e43('0x4c')],{})[_0x7e43('0x27')](function(_0x69e96){var _0x30e40f=_0x2a0362[_0x7e43('0x4d')][_0x7e43('0x4e')]({'plain':!![]});if(!_0x30e40f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30e40f[_0x7e43('0x4f')]===_0x7e43('0x4d')){var _0x5e4b90=_0x69e96[_0x7e43('0x4e')]({'plain':!![]});var _0x44b31b='Reports';return db[_0x7e43('0x50')][_0x7e43('0x4b')]({'where':{'name':_0x44b31b,'userProfileId':_0x30e40f[_0x7e43('0x51')]},'raw':!![]})[_0x7e43('0x27')](function(_0x223109){if(_0x223109&&_0x223109[_0x7e43('0x52')]===0x0){return db[_0x7e43('0x53')][_0x7e43('0x54')]({'name':_0x5e4b90[_0x7e43('0x2d')],'resourceId':_0x5e4b90['id'],'type':_0x7e43('0x29'),'sectionId':_0x223109['id']},{})[_0x7e43('0x27')](function(){return _0x69e96;});}else{return _0x69e96;}})[_0x7e43('0x48')](function(_0x238a96){logger[_0x7e43('0x2b')](_0x7e43('0x55'),_0x238a96);throw _0x238a96;});}return _0x69e96;})[_0x7e43('0x27')](respondWithResult(_0x11ab4a,0xc9))['catch'](handleError(_0x11ab4a,null));};exports[_0x7e43('0x56')]=function(_0xa8923d,_0x4ed1b1){if(_0xa8923d[_0x7e43('0x4c')]['id']){delete _0xa8923d[_0x7e43('0x4c')]['id'];}return db[_0x7e43('0x2f')][_0x7e43('0x4b')]({'where':{'id':_0xa8923d[_0x7e43('0x57')]['id']}})[_0x7e43('0x27')](handleEntityNotFound(_0x4ed1b1,null))[_0x7e43('0x27')](saveUpdates(_0xa8923d[_0x7e43('0x4c')],null))[_0x7e43('0x27')](respondWithResult(_0x4ed1b1,null))[_0x7e43('0x48')](handleError(_0x4ed1b1,null));};exports[_0x7e43('0x28')]=function(_0x234f19,_0x5012b0){return db[_0x7e43('0x2f')][_0x7e43('0x4b')]({'where':{'id':_0x234f19[_0x7e43('0x57')]['id']}})[_0x7e43('0x27')](handleEntityNotFound(_0x5012b0,null))[_0x7e43('0x27')](removeEntity(_0x5012b0,null))[_0x7e43('0x48')](handleError(_0x5012b0,null));};exports[_0x7e43('0x58')]=function(_0x538edc,_0x198815){var _0x59d77c=0xa;var _0x7c1bd=['join','left_join',_0x7e43('0x59'),_0x7e43('0x5a')];var _0x2a2744={'SUM':'SUM(%s)','COUNT':_0x7e43('0x5b'),'COUNT DISTINCT':_0x7e43('0x5c'),'MAX':_0x7e43('0x5d'),'MIN':_0x7e43('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x7e43('0x5f'),'GROUP_CONCAT ASC':_0x7e43('0x60'),'GROUP_CONCAT DESC':_0x7e43('0x61')};var _0x905a48={'SEC_TO_TIME':_0x7e43('0x62'),'DATE':_0x7e43('0x63'),'HOUR':_0x7e43('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7e43('0x65')};var _0x4950c3=function(_0x5d6bcc){return!_[_0x7e43('0x66')]([_0x7e43('0x67'),_0x7e43('0x68'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x5d6bcc);};var _0x1764b0=function(_0x3c5c3d){if(!_0x3c5c3d||!_0x3c5c3d[_0x7e43('0x69')][_0x7e43('0x4a')]){return'';}for(var _0x2578fe='(',_0x5e8db8=0x0;_0x5e8db8<_0x3c5c3d['rules'][_0x7e43('0x4a')];_0x5e8db8+=0x1){_0x5e8db8>0x0&&(_0x2578fe+='\x20'+_0x3c5c3d[_0x7e43('0x6a')]+'\x20');_0x2578fe+=_0x3c5c3d[_0x7e43('0x69')][_0x5e8db8][_0x7e43('0x6b')]?_0x1764b0(_0x3c5c3d['rules'][_0x5e8db8][_0x7e43('0x6b')]):_0x3c5c3d[_0x7e43('0x69')][_0x5e8db8][_0x7e43('0x6c')]+'\x20'+_0x3c5c3d[_0x7e43('0x69')][_0x5e8db8][_0x7e43('0x6d')]+(_0x4950c3(_0x3c5c3d[_0x7e43('0x69')][_0x5e8db8][_0x7e43('0x6d')])?'\x20'+_0x3c5c3d[_0x7e43('0x69')][_0x5e8db8][_0x7e43('0x6e')]:'');}return _0x2578fe+')';};var _0x2fa0c5={'where':{'id':_0x538edc[_0x7e43('0x57')]['id']}},_0x267f84,_0xdc06c,_0x1395ba,_0x79c520,_0x372ee4;_0x2fa0c5=_[_0x7e43('0x42')]({},_0x2fa0c5,_0x538edc['options']);return db[_0x7e43('0x2f')]['find'](_0x2fa0c5)['then'](function(_0x72ea82){if(_0x72ea82){_0x267f84=_0x72ea82;return _0x72ea82[_0x7e43('0x6f')]();}return null;})[_0x7e43('0x27')](function(_0x4473c7){if(_0x4473c7){if(!_0x4473c7[_0x7e43('0x4a')]){throw new db[(_0x7e43('0x70'))][(_0x7e43('0x71'))](_0x7e43('0x72'),0x193);}_0xdc06c=_0x4473c7;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x7e43('0x27')](function(_0x460186){if(_0x460186){_0x1395ba=_['keyBy'](_0x460186,'id');var _0x254adb;var _0x2e63f3=squel[_0x7e43('0x73')]();_0x2e63f3['from'](_0x267f84[_0x7e43('0x74')]);for(var _0x45e058=0x0;_0x45e058<_0xdc06c['length'];_0x45e058+=0x1){_0x254adb=_0xdc06c[_0x45e058]['MetricId']?_0x1395ba[_0xdc06c[_0x45e058][_0x7e43('0x75')]][_0x7e43('0x76')]:_0xdc06c[_0x45e058][_0x7e43('0x6c')];_0x254adb=_0xdc06c[_0x45e058]['function']?_['replace'](_0x2a2744[_0xdc06c[_0x45e058][_0x7e43('0x77')]],'%s',_0x254adb):_0x254adb;_0x254adb=_0xdc06c[_0x45e058]['format']?_[_0x7e43('0x78')](_0x905a48[_0xdc06c[_0x45e058]['format']],'%s',_0x254adb):_0x254adb;if(_0xdc06c[_0x45e058][_0x7e43('0x79')]){_0x2e63f3[_0x7e43('0x6b')](_0x254adb);}_0xdc06c[_0x45e058][_0x7e43('0x7a')]&&_0x2e63f3[_0x7e43('0x3d')](_0x254adb,_0xdc06c[_0x45e058][_0x7e43('0x7a')]===_0x7e43('0x7b')?![]:!![]);_0x2e63f3[_0x7e43('0x6c')](_0x254adb,_0xdc06c[_0x45e058][_0x7e43('0x7c')]||_0x254adb);}if(_0x267f84[_0x7e43('0x7d')]){_0x267f84[_0x7e43('0x7d')]=JSON[_0x7e43('0x7e')](_0x267f84[_0x7e43('0x7d')]);for(var _0x373b3a=0x0;_0x373b3a<_0x267f84[_0x7e43('0x7d')][_0x7e43('0x4a')];_0x373b3a+=0x1){if(_0x267f84['joins'][_0x373b3a][_0x7e43('0x31')]&&_[_0x7e43('0x66')](_0x7c1bd,_0x267f84[_0x7e43('0x7d')][_0x373b3a][_0x7e43('0x31')])&&_0x267f84['joins'][_0x373b3a][_0x7e43('0x7f')]&&_0x267f84[_0x7e43('0x7d')][_0x373b3a]['foreignTable']&&_0x267f84['joins'][_0x373b3a][_0x7e43('0x80')]){_0x2e63f3[_0x267f84[_0x7e43('0x7d')][_0x373b3a][_0x7e43('0x31')]](_0x267f84['joins'][_0x373b3a]['foreignTable'],null,util['format'](_0x7e43('0x81'),_0x267f84[_0x7e43('0x74')],_0x267f84[_0x7e43('0x7d')][_0x373b3a][_0x7e43('0x7f')],_0x267f84[_0x7e43('0x7d')][_0x373b3a]['foreignTable'],_0x267f84[_0x7e43('0x7d')][_0x373b3a][_0x7e43('0x80')]));}}}if(_0x267f84[_0x7e43('0x82')]){_0x267f84[_0x7e43('0x82')]=JSON[_0x7e43('0x7e')](_0x267f84['conditions']);_0x2e63f3[_0x7e43('0x3f')](_0x1764b0(_0x267f84[_0x7e43('0x82')][_0x7e43('0x6b')]));}_0x372ee4=_0x2e63f3[_0x7e43('0x83')]();_0x2e63f3['limit'](_0x59d77c);_0x2e63f3[_0x7e43('0x21')](0x0);logger[_0x7e43('0x84')](_0x7e43('0x85'),_0x2e63f3['toString']());return db['sequelize'][_0x7e43('0x35')](_0x2e63f3[_0x7e43('0x86')](),{'type':db[_0x7e43('0x87')][_0x7e43('0x88')][_0x7e43('0x89')]});}})[_0x7e43('0x27')](respondWithResult(_0x198815,null))[_0x7e43('0x48')](handleError(_0x198815,null));};function runReport(_0x55611a,_0xe80549,_0x1f02bc){var _0x490c50=_0xe80549[_0x7e43('0x2d')];var _0x58bd6c=0xa;var _0x1f9073=[_0x7e43('0x8a'),_0x7e43('0x8b'),_0x7e43('0x59'),_0x7e43('0x5a')];var _0x184180={'SUM':_0x7e43('0x8c'),'COUNT':_0x7e43('0x5b'),'COUNT DISTINCT':_0x7e43('0x5c'),'MAX':_0x7e43('0x5d'),'MIN':_0x7e43('0x5e'),'AVG':_0x7e43('0x8d'),'GROUP_CONCAT':_0x7e43('0x5f'),'GROUP_CONCAT ASC':_0x7e43('0x60'),'GROUP_CONCAT DESC':_0x7e43('0x61')};var _0x2c8ec5={'SEC_TO_TIME':_0x7e43('0x62'),'DATE':_0x7e43('0x63'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7e43('0x65')};var _0x16655f=function(_0x1c92ce){return!_['includes']([_0x7e43('0x67'),_0x7e43('0x68'),_0x7e43('0x8e'),_0x7e43('0x8f')],_0x1c92ce);};var _0x44e74d=function(_0x158444){if(!_0x158444||!_0x158444[_0x7e43('0x69')][_0x7e43('0x4a')]){return'';}for(var _0x40403d='(',_0x558b4f=0x0;_0x558b4f<_0x158444['rules']['length'];_0x558b4f+=0x1){_0x558b4f>0x0&&(_0x40403d+='\x20'+_0x158444[_0x7e43('0x6a')]+'\x20');_0x40403d+=_0x158444[_0x7e43('0x69')][_0x558b4f][_0x7e43('0x6b')]?_0x44e74d(_0x158444[_0x7e43('0x69')][_0x558b4f][_0x7e43('0x6b')]):_0x158444[_0x7e43('0x69')][_0x558b4f][_0x7e43('0x6c')]+'\x20'+_0x158444[_0x7e43('0x69')][_0x558b4f]['condition']+(_0x16655f(_0x158444['rules'][_0x558b4f][_0x7e43('0x6d')])?'\x20'+_0x158444['rules'][_0x558b4f]['value']:'');}return _0x40403d+')';};var _0x3c5c95={'where':{'id':_0x55611a['id']}},_0x4fef29,_0x2fc36d,_0x4c2b66,_0x35b603,_0x4ec1f4;_0x3c5c95=_[_0x7e43('0x42')]({},_0x3c5c95,_0x1f02bc);return db['AnalyticDefaultReport']['find'](_0x3c5c95)[_0x7e43('0x27')](function(_0x4589c1){if(_0x4589c1){_0x4fef29=_0x4589c1;return _0x4589c1['getFields']();}return null;})[_0x7e43('0x27')](function(_0x3497f6){if(_0x3497f6){if(!_0x3497f6[_0x7e43('0x4a')]){throw new db[(_0x7e43('0x70'))]['ValidationErrorItem'](_0x7e43('0x72'),0x193);}_0x2fc36d=_0x3497f6;return db[_0x7e43('0x90')]['findAll']({'raw':!![]});}return null;})[_0x7e43('0x27')](function(_0x5dbe90){if(_0x5dbe90){_0x4c2b66=_['keyBy'](_0x5dbe90,'id');var _0x4a5a7d;var _0xed4b31=squel['select']();_0xed4b31[_0x7e43('0x91')](_0x4fef29[_0x7e43('0x74')]);for(var _0x353e5a=0x0;_0x353e5a<_0x2fc36d[_0x7e43('0x4a')];_0x353e5a+=0x1){_0x4a5a7d=_0x2fc36d[_0x353e5a][_0x7e43('0x75')]?_0x4c2b66[_0x2fc36d[_0x353e5a]['MetricId']][_0x7e43('0x76')]:_0x2fc36d[_0x353e5a][_0x7e43('0x6c')];_0x4a5a7d=_0x2fc36d[_0x353e5a]['function']?_[_0x7e43('0x78')](_0x184180[_0x2fc36d[_0x353e5a][_0x7e43('0x77')]],'%s',_0x4a5a7d):_0x4a5a7d;_0x4a5a7d=_0x2fc36d[_0x353e5a][_0x7e43('0x92')]?_[_0x7e43('0x78')](_0x2c8ec5[_0x2fc36d[_0x353e5a][_0x7e43('0x92')]],'%s',_0x4a5a7d):_0x4a5a7d;if(_0x2fc36d[_0x353e5a][_0x7e43('0x79')]){_0xed4b31[_0x7e43('0x6b')](_0x4a5a7d);}_0x2fc36d[_0x353e5a][_0x7e43('0x7a')]&&_0xed4b31[_0x7e43('0x3d')](_0x4a5a7d,_0x2fc36d[_0x353e5a][_0x7e43('0x7a')]===_0x7e43('0x7b')?![]:!![]);_0xed4b31[_0x7e43('0x6c')](_0x4a5a7d,_0x2fc36d[_0x353e5a][_0x7e43('0x7c')]||_0x4a5a7d);}if(_0x4fef29[_0x7e43('0x7d')]){_0x4fef29[_0x7e43('0x7d')]=JSON[_0x7e43('0x7e')](_0x4fef29[_0x7e43('0x7d')]);for(var _0x485e3e=0x0;_0x485e3e<_0x4fef29[_0x7e43('0x7d')][_0x7e43('0x4a')];_0x485e3e+=0x1){if(_0x4fef29[_0x7e43('0x7d')][_0x485e3e][_0x7e43('0x31')]&&_[_0x7e43('0x66')](_0x1f9073,_0x4fef29[_0x7e43('0x7d')][_0x485e3e][_0x7e43('0x31')])&&_0x4fef29['joins'][_0x485e3e][_0x7e43('0x7f')]&&_0x4fef29['joins'][_0x485e3e][_0x7e43('0x93')]&&_0x4fef29[_0x7e43('0x7d')][_0x485e3e]['foreignKey']){_0xed4b31[_0x4fef29['joins'][_0x485e3e]['type']](_0x4fef29[_0x7e43('0x7d')][_0x485e3e]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x4fef29[_0x7e43('0x74')],_0x4fef29[_0x7e43('0x7d')][_0x485e3e][_0x7e43('0x7f')],_0x4fef29[_0x7e43('0x7d')][_0x485e3e][_0x7e43('0x93')],_0x4fef29[_0x7e43('0x7d')][_0x485e3e][_0x7e43('0x80')]));}}}if(_0x4fef29[_0x7e43('0x82')]){_0x4fef29[_0x7e43('0x82')]=JSON[_0x7e43('0x7e')](_0x4fef29[_0x7e43('0x82')]);_0xed4b31[_0x7e43('0x3f')](_0x44e74d(_0x4fef29[_0x7e43('0x82')][_0x7e43('0x6b')]));}_0x4ec1f4=_0xed4b31['clone']();_0xed4b31['limit'](_0x58bd6c);_0xed4b31[_0x7e43('0x21')](0x0);logger[_0x7e43('0x84')](_0x7e43('0x85'),_0xed4b31['toString']());return db[_0x7e43('0x87')]['query'](_0xed4b31[_0x7e43('0x86')](),{'type':db['sequelize'][_0x7e43('0x88')]['SELECT']});}})[_0x7e43('0x27')](function(_0x2d7f2c){if(!_0x2d7f2c[_0x7e43('0x4a')]){throw new db[(_0x7e43('0x70'))][(_0x7e43('0x71'))](_0x7e43('0x94'),0xcc);}if(_0xe80549[_0x7e43('0x95')]===_0x7e43('0x96')){return null;}var _0x3ac714=_[_0x7e43('0x42')](_0xe80549,{'name':_0xe80549['fullPath']||_0xe80549[_0x7e43('0x2d')]||_0x4fef29[_0x7e43('0x2d')],'basename':_0x490c50,'savename':util['format']('%s-%s.%s',_0xe80549[_0x7e43('0x2d')]||_0x4fef29[_0x7e43('0x2d')],require(_0x7e43('0x97'))['generate'](0x4),_0xe80549[_0x7e43('0x95')]||_0x7e43('0x98')),'reportId':_0x4fef29['id'],'reportType':_0x7e43('0x99')});return db[_0x7e43('0x9a')][_0x7e43('0x54')](_0x3ac714,{'raw':!![]});})[_0x7e43('0x27')](function(_0xe44802){if(_0x4fef29['table']===_0x7e43('0x9b')){_0x4ec1f4[_0x7e43('0x3f')](_0x4fef29[_0x7e43('0x74')]+_0x7e43('0x9c'),_0xe80549[_0x7e43('0x9d')],_0xe80549[_0x7e43('0x9e')]);}else{_0x4ec1f4[_0x7e43('0x3f')](_0x4fef29[_0x7e43('0x74')]+_0x7e43('0x9f'),_0xe80549[_0x7e43('0x9d')],_0xe80549[_0x7e43('0x9e')]);}if(_0xe44802){logger[_0x7e43('0xa0')](_0x7e43('0xa1'),_0x4ec1f4[_0x7e43('0x86')]());require(_0x7e43('0xa2'))[_0x7e43('0xa3')](path['join'](__dirname,_0x7e43('0xa4'),_0xe44802[_0x7e43('0x95')]),[_0xe44802['id'],_0x4ec1f4['toString'](),path[_0x7e43('0x8a')](__dirname,_0x7e43('0xa5'),_0xe44802['savename']),_0x490c50]);return _0xe44802;}else{var _0x4908dc=squel[_0x7e43('0x73')]();_0x4908dc[_0x7e43('0x91')]('('+_0x4ec1f4[_0x7e43('0x86')]()+')','countTable');_0x4908dc['field'](_0x7e43('0xa6'),'count');_0x4ec1f4['limit'](_0xe80549['limit']||_0x58bd6c);_0x4ec1f4[_0x7e43('0x21')](_0xe80549[_0x7e43('0x21')]||0x0);return dbH[_0x7e43('0x87')][_0x7e43('0x35')](_0x4908dc[_0x7e43('0x86')](),{'type':dbH[_0x7e43('0x87')][_0x7e43('0x88')][_0x7e43('0x89')]})[_0x7e43('0x27')](function(_0x1a0b55){if(!_0x1a0b55[_0x7e43('0x4a')]){_0x35b603=0x0;}else{_0x35b603=_0x1a0b55[0x0]['count']||0x0;}return dbH[_0x7e43('0x87')][_0x7e43('0x35')](_0x4ec1f4[_0x7e43('0x86')](),{'type':dbH[_0x7e43('0x87')][_0x7e43('0x88')]['SELECT']});})[_0x7e43('0x27')](function(_0x3cc251){return{'rows':_0x3cc251||[],'count':_0x35b603};});}});}exports['run']=function(_0x479583,_0x58c5dc){return runReport(_0x479583[_0x7e43('0x57')],_0x479583[_0x7e43('0x35')],_0x479583[_0x7e43('0x44')])[_0x7e43('0x27')](respondWithResult(_0x58c5dc,null))[_0x7e43('0x48')](handleError(_0x58c5dc,null));};exports['runReport']=runReport;exports[_0x7e43('0x35')]=function(_0x14d0b0,_0x4633c1){var _0xcb9c1e=0xa;var _0xc78ac7=[_0x7e43('0x8a'),_0x7e43('0x8b'),_0x7e43('0x59'),_0x7e43('0x5a')];var _0x16e525={'SUM':_0x7e43('0x8c'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7e43('0x5d'),'MIN':_0x7e43('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7e43('0x60'),'GROUP_CONCAT DESC':_0x7e43('0x61')};var _0x1fff7e={'SEC_TO_TIME':_0x7e43('0x62'),'DATE':_0x7e43('0x63'),'HOUR':_0x7e43('0x64'),'ROUND':_0x7e43('0xa7'),'UNIX_TIMESTAMP':_0x7e43('0x65')};var _0x36035e=function(_0x33954e){return!_[_0x7e43('0x66')]([_0x7e43('0x67'),_0x7e43('0x68'),_0x7e43('0x8e'),_0x7e43('0x8f')],_0x33954e);};var _0x451644=function(_0x5d9691){if(!_0x5d9691||!_0x5d9691[_0x7e43('0x69')][_0x7e43('0x4a')]){return'';}for(var _0x48bb8a='(',_0x4d7640=0x0;_0x4d7640<_0x5d9691[_0x7e43('0x69')][_0x7e43('0x4a')];_0x4d7640+=0x1){_0x4d7640>0x0&&(_0x48bb8a+='\x20'+_0x5d9691['operator']+'\x20');_0x48bb8a+=_0x5d9691[_0x7e43('0x69')][_0x4d7640][_0x7e43('0x6b')]?_0x451644(_0x5d9691['rules'][_0x4d7640][_0x7e43('0x6b')]):_0x5d9691[_0x7e43('0x69')][_0x4d7640]['field']+'\x20'+_0x5d9691[_0x7e43('0x69')][_0x4d7640]['condition']+(_0x36035e(_0x5d9691[_0x7e43('0x69')][_0x4d7640][_0x7e43('0x6d')])?'\x20'+_0x5d9691[_0x7e43('0x69')][_0x4d7640]['value']:'');}return _0x48bb8a+')';};var _0x15873b={'where':{'id':_0x14d0b0['params']['id']}},_0x305dc5,_0x499879,_0x50f723,_0x3e5dd8,_0x2eb825;_0x15873b=_[_0x7e43('0x42')]({},_0x15873b,_0x14d0b0[_0x7e43('0x44')]);return db[_0x7e43('0x2f')][_0x7e43('0x4b')](_0x15873b)[_0x7e43('0x27')](function(_0x9f9baa){if(_0x9f9baa){_0x305dc5=_0x9f9baa;return _0x9f9baa[_0x7e43('0x6f')]();}return null;})[_0x7e43('0x27')](function(_0x51d989){if(_0x51d989){if(!_0x51d989['length']){throw new db[(_0x7e43('0x70'))]['ValidationErrorItem'](_0x7e43('0x72'),0x193);}_0x499879=_0x51d989;return db['AnalyticMetric'][_0x7e43('0x47')]({'raw':!![]});}return null;})[_0x7e43('0x27')](function(_0x4cf11a){if(_0x4cf11a){_0x50f723=_[_0x7e43('0xa8')](_0x4cf11a,'id');var _0x18bad2;var _0x464f92=squel[_0x7e43('0x73')]();_0x464f92[_0x7e43('0x91')](_0x305dc5[_0x7e43('0x74')]);for(var _0x157092=0x0;_0x157092<_0x499879['length'];_0x157092+=0x1){_0x18bad2=_0x499879[_0x157092][_0x7e43('0x75')]?_0x50f723[_0x499879[_0x157092]['MetricId']][_0x7e43('0x76')]:_0x499879[_0x157092][_0x7e43('0x6c')];_0x18bad2=_0x499879[_0x157092][_0x7e43('0x77')]?_[_0x7e43('0x78')](_0x16e525[_0x499879[_0x157092][_0x7e43('0x77')]],'%s',_0x18bad2):_0x18bad2;_0x18bad2=_0x499879[_0x157092][_0x7e43('0x92')]?_[_0x7e43('0x78')](_0x1fff7e[_0x499879[_0x157092][_0x7e43('0x92')]],'%s',_0x18bad2):_0x18bad2;if(_0x499879[_0x157092][_0x7e43('0x79')]){_0x464f92[_0x7e43('0x6b')](_0x18bad2);}_0x499879[_0x157092][_0x7e43('0x7a')]&&_0x464f92[_0x7e43('0x3d')](_0x18bad2,_0x499879[_0x157092][_0x7e43('0x7a')]===_0x7e43('0x7b')?![]:!![]);_0x464f92[_0x7e43('0x6c')](_0x18bad2,_0x499879[_0x157092]['alias']||_0x18bad2);}if(_0x305dc5[_0x7e43('0x7d')]){_0x305dc5[_0x7e43('0x7d')]=JSON[_0x7e43('0x7e')](_0x305dc5[_0x7e43('0x7d')]);for(var _0x6005e1=0x0;_0x6005e1<_0x305dc5[_0x7e43('0x7d')][_0x7e43('0x4a')];_0x6005e1+=0x1){if(_0x305dc5[_0x7e43('0x7d')][_0x6005e1]['type']&&_[_0x7e43('0x66')](_0xc78ac7,_0x305dc5[_0x7e43('0x7d')][_0x6005e1][_0x7e43('0x31')])&&_0x305dc5[_0x7e43('0x7d')][_0x6005e1][_0x7e43('0x7f')]&&_0x305dc5[_0x7e43('0x7d')][_0x6005e1]['foreignTable']&&_0x305dc5['joins'][_0x6005e1][_0x7e43('0x80')]){_0x464f92[_0x305dc5['joins'][_0x6005e1][_0x7e43('0x31')]](_0x305dc5['joins'][_0x6005e1][_0x7e43('0x93')],null,util[_0x7e43('0x92')](_0x7e43('0x81'),_0x305dc5['table'],_0x305dc5['joins'][_0x6005e1][_0x7e43('0x7f')],_0x305dc5[_0x7e43('0x7d')][_0x6005e1][_0x7e43('0x93')],_0x305dc5[_0x7e43('0x7d')][_0x6005e1]['foreignKey']));}}}if(_0x305dc5[_0x7e43('0x82')]){_0x305dc5['conditions']=JSON[_0x7e43('0x7e')](_0x305dc5[_0x7e43('0x82')]);_0x464f92[_0x7e43('0x3f')](_0x451644(_0x305dc5[_0x7e43('0x82')]['group']));}_0x2eb825=_0x464f92['clone']();_0x464f92['limit'](_0xcb9c1e);_0x464f92['offset'](0x0);logger['debug']('Limited\x20Query:',_0x464f92[_0x7e43('0x86')]());return db[_0x7e43('0x87')][_0x7e43('0x35')](_0x464f92[_0x7e43('0x86')](),{'type':db[_0x7e43('0x87')][_0x7e43('0x88')][_0x7e43('0x89')]});}})['then'](function(){return{'sql':_0x2eb825[_0x7e43('0x86')]()};})[_0x7e43('0x27')](respondWithResult(_0x4633c1,null))[_0x7e43('0x48')](handleError(_0x4633c1,null));}; \ No newline at end of file +var _0xfad1=['startDate','endDate','info','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','IS\x20NULL','AnalyticMetric','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','../../components/parsers/qs','../../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','get','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','autoAssociation','UserProfileResource','create','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','join','left_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\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','debug','sequelize','toString','QueryTypes','SELECT','right_join','ROUND(%s)','IS\x20NOT\x20NULL','ValidationErrorItem','metric','clone','Limited\x20Query:','Sequelize','No\x20available\x20data','fullPath','%s-%s.%s','randomstring','output','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xfad1,0xb0));var _0x1fad=function(_0x2d12ca,_0x309888){_0x2d12ca=_0x2d12ca-0x0;var _0x305f4a=_0xfad1[_0x2d12ca];return _0x305f4a;};'use strict';var pdf=require(_0x1fad('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1fad('0x1'));var zipdir=require(_0x1fad('0x2'));var jsonpatch=require(_0x1fad('0x3'));var rp=require('request-promise');var moment=require(_0x1fad('0x4'));var BPromise=require(_0x1fad('0x5'));var Mustache=require(_0x1fad('0x6'));var util=require(_0x1fad('0x7'));var path=require(_0x1fad('0x8'));var sox=require(_0x1fad('0x9'));var csv=require(_0x1fad('0xa'));var ejs=require(_0x1fad('0xb'));var fs=require('fs');var _=require(_0x1fad('0xc'));var squel=require(_0x1fad('0xd'));var crypto=require(_0x1fad('0xe'));var jsforce=require(_0x1fad('0xf'));var deskjs=require(_0x1fad('0x10'));var toCsv=require(_0x1fad('0xa'));var querystring=require(_0x1fad('0x11'));var Papa=require(_0x1fad('0x12'));var Redis=require('ioredis');var authService=require(_0x1fad('0x13'));var qs=require(_0x1fad('0x14'));var as=require(_0x1fad('0x15'));var hardwareService=require(_0x1fad('0x16'));var logger=require(_0x1fad('0x17'))(_0x1fad('0x18'));var utils=require(_0x1fad('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1fad('0x1a'));var db=require(_0x1fad('0x1b'))['db'];var dbH=require(_0x1fad('0x1b'))['dbH'];function respondWithStatusCode(_0x2e6d4f,_0x57cdfc){_0x57cdfc=_0x57cdfc||0xcc;return function(_0xf21a5){if(_0xf21a5){return _0x2e6d4f[_0x1fad('0x1c')](_0x57cdfc);}return _0x2e6d4f[_0x1fad('0x1d')](_0x57cdfc)[_0x1fad('0x1e')]();};}function respondWithResult(_0x9c182e,_0x517051){_0x517051=_0x517051||0xc8;return function(_0x3daf92){if(_0x3daf92){return _0x9c182e['status'](_0x517051)[_0x1fad('0x1f')](_0x3daf92);}};}function respondWithFilteredResult(_0x2f37b7,_0x4dee4c){return function(_0x177804){if(_0x177804){var _0x2abb34=_0x177804[_0x1fad('0x20')],_0xfec86e=_0x4dee4c[_0x1fad('0x21')],_0x581a9b=_0x4dee4c[_0x1fad('0x21')]+_0x4dee4c[_0x1fad('0x22')],_0x539f0a;if(_0x581a9b>=_0x2abb34){_0x581a9b=_0x2abb34;_0x539f0a=0xc8;}else{_0x539f0a=0xce;}_0x2f37b7['status'](_0x539f0a);return _0x2f37b7[_0x1fad('0x23')](_0x1fad('0x24'),_0xfec86e+'-'+_0x581a9b+'/'+_0x2abb34)[_0x1fad('0x1f')](_0x177804);}return null;};}function patchUpdates(_0x57b3b1){return function(_0x4d5482){try{jsonpatch[_0x1fad('0x25')](_0x4d5482,_0x57b3b1,!![]);}catch(_0x153e1b){return BPromise[_0x1fad('0x26')](_0x153e1b);}return _0x4d5482['save']();};}function saveUpdates(_0x3f371c,_0x890db2){return function(_0x2d864c){if(_0x2d864c){return _0x2d864c[_0x1fad('0x27')](_0x3f371c)[_0x1fad('0x28')](function(_0x146daf){return _0x146daf;});}return null;};}function removeEntity(_0xc1fb15,_0x95000d){return function(_0x27b575){if(_0x27b575){return _0x27b575[_0x1fad('0x29')]()['then'](function(){var _0x3d03d6=_0x27b575[_0x1fad('0x2a')]({'plain':!![]});var _0x36c05a='DefaultReports';return db['UserProfileResource'][_0x1fad('0x29')]({'where':{'type':_0x36c05a,'resourceId':_0x3d03d6['id']}})[_0x1fad('0x28')](function(){return _0x27b575;});})[_0x1fad('0x28')](function(){_0xc1fb15[_0x1fad('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19d9e8,_0x526183){return function(_0x482f85){if(!_0x482f85){_0x19d9e8['sendStatus'](0x194);}return _0x482f85;};}function handleError(_0x32be59,_0x3641a0){_0x3641a0=_0x3641a0||0x1f4;return function(_0x3e5955){logger[_0x1fad('0x2b')](_0x3e5955[_0x1fad('0x2c')]);if(_0x3e5955[_0x1fad('0x2d')]){delete _0x3e5955[_0x1fad('0x2d')];}_0x32be59[_0x1fad('0x1d')](_0x3641a0)[_0x1fad('0x2e')](_0x3e5955);};}exports[_0x1fad('0x2f')]=function(_0x4fdb67,_0xf08bce){var _0x1fb465={},_0x5e6ec5={},_0x213aa8={'count':0x0,'rows':[]};var _0x1a94af=_[_0x1fad('0x30')](db[_0x1fad('0x31')][_0x1fad('0x32')],function(_0x40c144){return{'name':_0x40c144['fieldName'],'type':_0x40c144[_0x1fad('0x33')][_0x1fad('0x34')]};});_0x5e6ec5[_0x1fad('0x35')]=_[_0x1fad('0x30')](_0x1a94af,_0x1fad('0x2d'));_0x5e6ec5[_0x1fad('0x36')]=_[_0x1fad('0x37')](_0x4fdb67[_0x1fad('0x36')]);_0x5e6ec5[_0x1fad('0x38')]=_['intersection'](_0x5e6ec5[_0x1fad('0x35')],_0x5e6ec5[_0x1fad('0x36')]);_0x1fb465[_0x1fad('0x39')]=_[_0x1fad('0x3a')](_0x5e6ec5[_0x1fad('0x35')],qs[_0x1fad('0x3b')](_0x4fdb67[_0x1fad('0x36')][_0x1fad('0x3b')]));_0x1fb465[_0x1fad('0x39')]=_0x1fb465[_0x1fad('0x39')][_0x1fad('0x3c')]?_0x1fb465[_0x1fad('0x39')]:_0x5e6ec5[_0x1fad('0x35')];if(!_0x4fdb67['query']['hasOwnProperty'](_0x1fad('0x3d'))){_0x1fb465[_0x1fad('0x22')]=qs[_0x1fad('0x22')](_0x4fdb67[_0x1fad('0x36')][_0x1fad('0x22')]);_0x1fb465[_0x1fad('0x21')]=qs[_0x1fad('0x21')](_0x4fdb67['query']['offset']);}_0x1fb465[_0x1fad('0x3e')]=qs['sort'](_0x4fdb67[_0x1fad('0x36')][_0x1fad('0x3f')]);_0x1fb465[_0x1fad('0x40')]=qs['filters'](_['pick'](_0x4fdb67['query'],_0x5e6ec5['filters']),_0x1a94af);if(_0x4fdb67['query']['filter']){_0x1fb465['where']=_[_0x1fad('0x41')](_0x1fb465['where'],{'$or':_[_0x1fad('0x30')](_0x1a94af,function(_0x4749b9){if(_0x4749b9[_0x1fad('0x33')]!==_0x1fad('0x42')){var _0x12be5d={};_0x12be5d[_0x4749b9[_0x1fad('0x2d')]]={'$like':'%'+_0x4fdb67['query'][_0x1fad('0x43')]+'%'};return _0x12be5d;}})});}_0x1fb465=_[_0x1fad('0x41')]({},_0x1fb465,_0x4fdb67[_0x1fad('0x44')]);var _0x26ae6f={'where':_0x1fb465[_0x1fad('0x40')]};return db[_0x1fad('0x31')][_0x1fad('0x20')](_0x26ae6f)[_0x1fad('0x28')](function(_0xfd7d83){_0x213aa8[_0x1fad('0x20')]=_0xfd7d83;if(_0x4fdb67[_0x1fad('0x36')]['includeAll']){_0x1fb465[_0x1fad('0x45')]=[{'all':!![]}];}return db[_0x1fad('0x31')][_0x1fad('0x46')](_0x1fb465);})['then'](function(_0x1c9b4b){_0x213aa8[_0x1fad('0x47')]=_0x1c9b4b;return _0x213aa8;})[_0x1fad('0x28')](respondWithFilteredResult(_0xf08bce,_0x1fb465))[_0x1fad('0x48')](handleError(_0xf08bce,null));};exports[_0x1fad('0x49')]=function(_0x5da5fa,_0xc1901){var _0x548cb2={'raw':!![],'where':{'id':_0x5da5fa[_0x1fad('0x4a')]['id']}},_0x2bc6dc={};_0x2bc6dc[_0x1fad('0x35')]=_[_0x1fad('0x37')](db[_0x1fad('0x31')][_0x1fad('0x32')]);_0x2bc6dc[_0x1fad('0x36')]=_[_0x1fad('0x37')](_0x5da5fa[_0x1fad('0x36')]);_0x2bc6dc['filters']=_[_0x1fad('0x3a')](_0x2bc6dc['model'],_0x2bc6dc[_0x1fad('0x36')]);_0x548cb2[_0x1fad('0x39')]=_[_0x1fad('0x3a')](_0x2bc6dc[_0x1fad('0x35')],qs[_0x1fad('0x3b')](_0x5da5fa[_0x1fad('0x36')][_0x1fad('0x3b')]));_0x548cb2[_0x1fad('0x39')]=_0x548cb2['attributes']['length']?_0x548cb2[_0x1fad('0x39')]:_0x2bc6dc[_0x1fad('0x35')];if(_0x5da5fa[_0x1fad('0x36')][_0x1fad('0x4b')]){_0x548cb2[_0x1fad('0x45')]=[{'all':!![]}];}_0x548cb2=_[_0x1fad('0x41')]({},_0x548cb2,_0x5da5fa[_0x1fad('0x44')]);return db['AnalyticDefaultReport']['find'](_0x548cb2)['then'](handleEntityNotFound(_0xc1901,null))[_0x1fad('0x28')](respondWithResult(_0xc1901,null))[_0x1fad('0x48')](handleError(_0xc1901,null));};exports['create']=function(_0x8ef278,_0x3e0797){return db[_0x1fad('0x31')]['create'](_0x8ef278[_0x1fad('0x4c')],{})[_0x1fad('0x28')](function(_0x5eaa99){var _0x559ffa=_0x8ef278['user'][_0x1fad('0x2a')]({'plain':!![]});if(!_0x559ffa)throw new Error(_0x1fad('0x4d'));if(_0x559ffa[_0x1fad('0x4e')]===_0x1fad('0x4f')){var _0x7629a6=_0x5eaa99[_0x1fad('0x2a')]({'plain':!![]});var _0x1b8b61=_0x1fad('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x1b8b61,'userProfileId':_0x559ffa['userProfileId']},'raw':!![]})[_0x1fad('0x28')](function(_0xedace5){if(_0xedace5&&_0xedace5[_0x1fad('0x51')]===0x0){return db[_0x1fad('0x52')][_0x1fad('0x53')]({'name':_0x7629a6[_0x1fad('0x2d')],'resourceId':_0x7629a6['id'],'type':_0x1fad('0x54'),'sectionId':_0xedace5['id']},{})[_0x1fad('0x28')](function(){return _0x5eaa99;});}else{return _0x5eaa99;}})['catch'](function(_0x33ddbd){logger['error'](_0x1fad('0x55'),_0x33ddbd);throw _0x33ddbd;});}return _0x5eaa99;})[_0x1fad('0x28')](respondWithResult(_0x3e0797,0xc9))[_0x1fad('0x48')](handleError(_0x3e0797,null));};exports[_0x1fad('0x27')]=function(_0x2a3cf8,_0x91fbf4){if(_0x2a3cf8[_0x1fad('0x4c')]['id']){delete _0x2a3cf8['body']['id'];}return db[_0x1fad('0x31')][_0x1fad('0x56')]({'where':{'id':_0x2a3cf8[_0x1fad('0x4a')]['id']}})['then'](handleEntityNotFound(_0x91fbf4,null))['then'](saveUpdates(_0x2a3cf8[_0x1fad('0x4c')],null))['then'](respondWithResult(_0x91fbf4,null))[_0x1fad('0x48')](handleError(_0x91fbf4,null));};exports[_0x1fad('0x29')]=function(_0x5e8d00,_0x499ade){return db[_0x1fad('0x31')][_0x1fad('0x56')]({'where':{'id':_0x5e8d00[_0x1fad('0x4a')]['id']}})['then'](handleEntityNotFound(_0x499ade,null))['then'](removeEntity(_0x499ade,null))[_0x1fad('0x48')](handleError(_0x499ade,null));};exports['preview']=function(_0x4fab46,_0x30c532){var _0x59ef7b=0xa;var _0x45f0cd=[_0x1fad('0x57'),_0x1fad('0x58'),'right_join',_0x1fad('0x59')];var _0x1e2df9={'SUM':_0x1fad('0x5a'),'COUNT':_0x1fad('0x5b'),'COUNT DISTINCT':_0x1fad('0x5c'),'MAX':_0x1fad('0x5d'),'MIN':_0x1fad('0x5e'),'AVG':_0x1fad('0x5f'),'GROUP_CONCAT':_0x1fad('0x60'),'GROUP_CONCAT ASC':_0x1fad('0x61'),'GROUP_CONCAT DESC':_0x1fad('0x62')};var _0x5e0d76={'SEC_TO_TIME':_0x1fad('0x63'),'DATE':'DATE(%s)','HOUR':_0x1fad('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x1fad('0x65')};var _0x572875=function(_0xd5da6b){return!_[_0x1fad('0x66')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x1fad('0x67'),_0x1fad('0x68')],_0xd5da6b);};var _0x260f39=function(_0x313cfe){if(!_0x313cfe||!_0x313cfe[_0x1fad('0x69')]['length']){return'';}for(var _0x3c136a='(',_0x31523c=0x0;_0x31523c<_0x313cfe['rules'][_0x1fad('0x3c')];_0x31523c+=0x1){_0x31523c>0x0&&(_0x3c136a+='\x20'+_0x313cfe[_0x1fad('0x6a')]+'\x20');_0x3c136a+=_0x313cfe[_0x1fad('0x69')][_0x31523c][_0x1fad('0x6b')]?_0x260f39(_0x313cfe['rules'][_0x31523c][_0x1fad('0x6b')]):_0x313cfe['rules'][_0x31523c][_0x1fad('0x6c')]+'\x20'+_0x313cfe[_0x1fad('0x69')][_0x31523c][_0x1fad('0x6d')]+(_0x572875(_0x313cfe[_0x1fad('0x69')][_0x31523c][_0x1fad('0x6d')])?'\x20'+_0x313cfe[_0x1fad('0x69')][_0x31523c][_0x1fad('0x6e')]:'');}return _0x3c136a+')';};var _0x370172={'where':{'id':_0x4fab46[_0x1fad('0x4a')]['id']}},_0x25edfb,_0x24aa1d,_0x5ecf46,_0x358356,_0x3fe844;_0x370172=_[_0x1fad('0x41')]({},_0x370172,_0x4fab46[_0x1fad('0x44')]);return db[_0x1fad('0x31')][_0x1fad('0x56')](_0x370172)['then'](function(_0x54df9a){if(_0x54df9a){_0x25edfb=_0x54df9a;return _0x54df9a[_0x1fad('0x6f')]();}return null;})['then'](function(_0x4868b9){if(_0x4868b9){if(!_0x4868b9[_0x1fad('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x1fad('0x70'),0x193);}_0x24aa1d=_0x4868b9;return db['AnalyticMetric'][_0x1fad('0x46')]({'raw':!![]});}return null;})[_0x1fad('0x28')](function(_0x53fb15){if(_0x53fb15){_0x5ecf46=_[_0x1fad('0x71')](_0x53fb15,'id');var _0x5b4c69;var _0x1ae1d7=squel[_0x1fad('0x72')]();_0x1ae1d7[_0x1fad('0x73')](_0x25edfb['table']);for(var _0x3cda2a=0x0;_0x3cda2a<_0x24aa1d[_0x1fad('0x3c')];_0x3cda2a+=0x1){_0x5b4c69=_0x24aa1d[_0x3cda2a][_0x1fad('0x74')]?_0x5ecf46[_0x24aa1d[_0x3cda2a][_0x1fad('0x74')]]['metric']:_0x24aa1d[_0x3cda2a][_0x1fad('0x6c')];_0x5b4c69=_0x24aa1d[_0x3cda2a][_0x1fad('0x75')]?_[_0x1fad('0x76')](_0x1e2df9[_0x24aa1d[_0x3cda2a][_0x1fad('0x75')]],'%s',_0x5b4c69):_0x5b4c69;_0x5b4c69=_0x24aa1d[_0x3cda2a]['format']?_[_0x1fad('0x76')](_0x5e0d76[_0x24aa1d[_0x3cda2a][_0x1fad('0x77')]],'%s',_0x5b4c69):_0x5b4c69;if(_0x24aa1d[_0x3cda2a][_0x1fad('0x78')]){_0x1ae1d7['group'](_0x5b4c69);}_0x24aa1d[_0x3cda2a][_0x1fad('0x79')]&&_0x1ae1d7['order'](_0x5b4c69,_0x24aa1d[_0x3cda2a]['orderBy']===_0x1fad('0x7a')?![]:!![]);_0x1ae1d7[_0x1fad('0x6c')](_0x5b4c69,_0x24aa1d[_0x3cda2a][_0x1fad('0x7b')]||_0x5b4c69);}if(_0x25edfb['joins']){_0x25edfb[_0x1fad('0x7c')]=JSON[_0x1fad('0x7d')](_0x25edfb['joins']);for(var _0x1be858=0x0;_0x1be858<_0x25edfb['joins'][_0x1fad('0x3c')];_0x1be858+=0x1){if(_0x25edfb[_0x1fad('0x7c')][_0x1be858]['type']&&_[_0x1fad('0x66')](_0x45f0cd,_0x25edfb[_0x1fad('0x7c')][_0x1be858][_0x1fad('0x33')])&&_0x25edfb['joins'][_0x1be858][_0x1fad('0x7e')]&&_0x25edfb[_0x1fad('0x7c')][_0x1be858][_0x1fad('0x7f')]&&_0x25edfb[_0x1fad('0x7c')][_0x1be858]['foreignKey']){_0x1ae1d7[_0x25edfb[_0x1fad('0x7c')][_0x1be858]['type']](_0x25edfb['joins'][_0x1be858][_0x1fad('0x7f')],null,util[_0x1fad('0x77')](_0x1fad('0x80'),_0x25edfb[_0x1fad('0x81')],_0x25edfb['joins'][_0x1be858]['parentKey'],_0x25edfb['joins'][_0x1be858][_0x1fad('0x7f')],_0x25edfb['joins'][_0x1be858][_0x1fad('0x82')]));}}}if(_0x25edfb['conditions']){_0x25edfb[_0x1fad('0x83')]=JSON[_0x1fad('0x7d')](_0x25edfb[_0x1fad('0x83')]);_0x1ae1d7[_0x1fad('0x40')](_0x260f39(_0x25edfb[_0x1fad('0x83')][_0x1fad('0x6b')]));}_0x3fe844=_0x1ae1d7['clone']();_0x1ae1d7[_0x1fad('0x22')](_0x59ef7b);_0x1ae1d7[_0x1fad('0x21')](0x0);logger[_0x1fad('0x84')]('Limited\x20Query:',_0x1ae1d7['toString']());return db[_0x1fad('0x85')][_0x1fad('0x36')](_0x1ae1d7[_0x1fad('0x86')](),{'type':db[_0x1fad('0x85')][_0x1fad('0x87')][_0x1fad('0x88')]});}})[_0x1fad('0x28')](respondWithResult(_0x30c532,null))['catch'](handleError(_0x30c532,null));};function runReport(_0x20269e,_0x393d28,_0x2c6ff6){var _0x25a79b=_0x393d28[_0x1fad('0x2d')];var _0xbbc7f9=0xa;var _0x598ff0=[_0x1fad('0x57'),_0x1fad('0x58'),_0x1fad('0x89'),_0x1fad('0x59')];var _0x30b5f8={'SUM':'SUM(%s)','COUNT':_0x1fad('0x5b'),'COUNT DISTINCT':_0x1fad('0x5c'),'MAX':_0x1fad('0x5d'),'MIN':_0x1fad('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x1fad('0x62')};var _0x156c42={'SEC_TO_TIME':_0x1fad('0x63'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x1fad('0x8a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x17e747=function(_0x1013cf){return!_[_0x1fad('0x66')](['IS\x20NULL',_0x1fad('0x8b'),_0x1fad('0x67'),_0x1fad('0x68')],_0x1013cf);};var _0x53d614=function(_0x27fdde){if(!_0x27fdde||!_0x27fdde[_0x1fad('0x69')][_0x1fad('0x3c')]){return'';}for(var _0x55f829='(',_0x326b11=0x0;_0x326b11<_0x27fdde[_0x1fad('0x69')][_0x1fad('0x3c')];_0x326b11+=0x1){_0x326b11>0x0&&(_0x55f829+='\x20'+_0x27fdde[_0x1fad('0x6a')]+'\x20');_0x55f829+=_0x27fdde[_0x1fad('0x69')][_0x326b11][_0x1fad('0x6b')]?_0x53d614(_0x27fdde[_0x1fad('0x69')][_0x326b11][_0x1fad('0x6b')]):_0x27fdde['rules'][_0x326b11][_0x1fad('0x6c')]+'\x20'+_0x27fdde[_0x1fad('0x69')][_0x326b11]['condition']+(_0x17e747(_0x27fdde[_0x1fad('0x69')][_0x326b11][_0x1fad('0x6d')])?'\x20'+_0x27fdde[_0x1fad('0x69')][_0x326b11][_0x1fad('0x6e')]:'');}return _0x55f829+')';};var _0x2ee660={'where':{'id':_0x20269e['id']}},_0x3b6456,_0x121414,_0x289553,_0x2ed0a6,_0x1ed0c1;_0x2ee660=_[_0x1fad('0x41')]({},_0x2ee660,_0x2c6ff6);return db['AnalyticDefaultReport'][_0x1fad('0x56')](_0x2ee660)[_0x1fad('0x28')](function(_0x374d94){if(_0x374d94){_0x3b6456=_0x374d94;return _0x374d94['getFields']();}return null;})['then'](function(_0x5806a3){if(_0x5806a3){if(!_0x5806a3['length']){throw new db['Sequelize'][(_0x1fad('0x8c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x121414=_0x5806a3;return db['AnalyticMetric'][_0x1fad('0x46')]({'raw':!![]});}return null;})[_0x1fad('0x28')](function(_0x397386){if(_0x397386){_0x289553=_['keyBy'](_0x397386,'id');var _0x309d78;var _0x3f38d1=squel[_0x1fad('0x72')]();_0x3f38d1[_0x1fad('0x73')](_0x3b6456['table']);for(var _0x25255d=0x0;_0x25255d<_0x121414['length'];_0x25255d+=0x1){_0x309d78=_0x121414[_0x25255d][_0x1fad('0x74')]?_0x289553[_0x121414[_0x25255d][_0x1fad('0x74')]][_0x1fad('0x8d')]:_0x121414[_0x25255d]['field'];_0x309d78=_0x121414[_0x25255d]['function']?_[_0x1fad('0x76')](_0x30b5f8[_0x121414[_0x25255d][_0x1fad('0x75')]],'%s',_0x309d78):_0x309d78;_0x309d78=_0x121414[_0x25255d][_0x1fad('0x77')]?_['replace'](_0x156c42[_0x121414[_0x25255d]['format']],'%s',_0x309d78):_0x309d78;if(_0x121414[_0x25255d][_0x1fad('0x78')]){_0x3f38d1[_0x1fad('0x6b')](_0x309d78);}_0x121414[_0x25255d]['orderBy']&&_0x3f38d1[_0x1fad('0x3e')](_0x309d78,_0x121414[_0x25255d][_0x1fad('0x79')]===_0x1fad('0x7a')?![]:!![]);_0x3f38d1['field'](_0x309d78,_0x121414[_0x25255d]['alias']||_0x309d78);}if(_0x3b6456['joins']){_0x3b6456[_0x1fad('0x7c')]=JSON['parse'](_0x3b6456[_0x1fad('0x7c')]);for(var _0x461e65=0x0;_0x461e65<_0x3b6456[_0x1fad('0x7c')]['length'];_0x461e65+=0x1){if(_0x3b6456[_0x1fad('0x7c')][_0x461e65][_0x1fad('0x33')]&&_[_0x1fad('0x66')](_0x598ff0,_0x3b6456['joins'][_0x461e65][_0x1fad('0x33')])&&_0x3b6456['joins'][_0x461e65][_0x1fad('0x7e')]&&_0x3b6456[_0x1fad('0x7c')][_0x461e65][_0x1fad('0x7f')]&&_0x3b6456[_0x1fad('0x7c')][_0x461e65][_0x1fad('0x82')]){_0x3f38d1[_0x3b6456['joins'][_0x461e65][_0x1fad('0x33')]](_0x3b6456['joins'][_0x461e65][_0x1fad('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3b6456[_0x1fad('0x81')],_0x3b6456[_0x1fad('0x7c')][_0x461e65][_0x1fad('0x7e')],_0x3b6456[_0x1fad('0x7c')][_0x461e65]['foreignTable'],_0x3b6456['joins'][_0x461e65][_0x1fad('0x82')]));}}}if(_0x3b6456[_0x1fad('0x83')]){_0x3b6456[_0x1fad('0x83')]=JSON['parse'](_0x3b6456[_0x1fad('0x83')]);_0x3f38d1['where'](_0x53d614(_0x3b6456[_0x1fad('0x83')][_0x1fad('0x6b')]));}_0x1ed0c1=_0x3f38d1[_0x1fad('0x8e')]();_0x3f38d1[_0x1fad('0x22')](_0xbbc7f9);_0x3f38d1[_0x1fad('0x21')](0x0);logger[_0x1fad('0x84')](_0x1fad('0x8f'),_0x3f38d1[_0x1fad('0x86')]());return db['sequelize']['query'](_0x3f38d1[_0x1fad('0x86')](),{'type':db[_0x1fad('0x85')][_0x1fad('0x87')]['SELECT']});}})[_0x1fad('0x28')](function(_0x4fb9f2){if(!_0x4fb9f2[_0x1fad('0x3c')]){throw new db[(_0x1fad('0x90'))][(_0x1fad('0x8c'))](_0x1fad('0x91'),0xcc);}if(_0x393d28['output']==='web'){return null;}var _0x206bb0=_['merge'](_0x393d28,{'name':_0x393d28[_0x1fad('0x92')]||_0x393d28[_0x1fad('0x2d')]||_0x3b6456['name'],'basename':_0x25a79b,'savename':util['format'](_0x1fad('0x93'),_0x393d28[_0x1fad('0x2d')]||_0x3b6456[_0x1fad('0x2d')],require(_0x1fad('0x94'))['generate'](0x4),_0x393d28[_0x1fad('0x95')]||_0x1fad('0x96')),'reportId':_0x3b6456['id'],'reportType':'default'});return db[_0x1fad('0x97')][_0x1fad('0x53')](_0x206bb0,{'raw':!![]});})[_0x1fad('0x28')](function(_0x3a5dbc){if(_0x3b6456[_0x1fad('0x81')]==='cdr'){_0x1ed0c1[_0x1fad('0x40')](_0x3b6456['table']+_0x1fad('0x98'),_0x393d28['startDate'],_0x393d28['endDate']);}else{_0x1ed0c1[_0x1fad('0x40')](_0x3b6456[_0x1fad('0x81')]+_0x1fad('0x99'),_0x393d28[_0x1fad('0x9a')],_0x393d28[_0x1fad('0x9b')]);}if(_0x3a5dbc){logger[_0x1fad('0x9c')]('Run\x20Query:',_0x1ed0c1[_0x1fad('0x86')]());require('child_process')[_0x1fad('0x9d')](path[_0x1fad('0x57')](__dirname,_0x1fad('0x9e'),_0x3a5dbc[_0x1fad('0x95')]),[_0x3a5dbc['id'],_0x1ed0c1[_0x1fad('0x86')](),path[_0x1fad('0x57')](__dirname,'../../files/reports',_0x3a5dbc[_0x1fad('0x9f')]),_0x25a79b]);return _0x3a5dbc;}else{var _0x3c1661=squel[_0x1fad('0x72')]();_0x3c1661[_0x1fad('0x73')]('('+_0x1ed0c1['toString']()+')',_0x1fad('0xa0'));_0x3c1661[_0x1fad('0x6c')](_0x1fad('0xa1'),_0x1fad('0x20'));_0x1ed0c1[_0x1fad('0x22')](_0x393d28[_0x1fad('0x22')]||_0xbbc7f9);_0x1ed0c1[_0x1fad('0x21')](_0x393d28[_0x1fad('0x21')]||0x0);return dbH['sequelize'][_0x1fad('0x36')](_0x3c1661['toString'](),{'type':dbH[_0x1fad('0x85')][_0x1fad('0x87')][_0x1fad('0x88')]})['then'](function(_0x391235){if(!_0x391235[_0x1fad('0x3c')]){_0x2ed0a6=0x0;}else{_0x2ed0a6=_0x391235[0x0][_0x1fad('0x20')]||0x0;}return dbH['sequelize'][_0x1fad('0x36')](_0x1ed0c1['toString'](),{'type':dbH['sequelize'][_0x1fad('0x87')][_0x1fad('0x88')]});})[_0x1fad('0x28')](function(_0x4c00d3){return{'rows':_0x4c00d3||[],'count':_0x2ed0a6};});}});}exports['run']=function(_0xd6c683,_0x9ab351){return runReport(_0xd6c683[_0x1fad('0x4a')],_0xd6c683[_0x1fad('0x36')],_0xd6c683[_0x1fad('0x44')])[_0x1fad('0x28')](respondWithResult(_0x9ab351,null))[_0x1fad('0x48')](handleError(_0x9ab351,null));};exports[_0x1fad('0xa2')]=runReport;exports[_0x1fad('0x36')]=function(_0x1d4323,_0x5274af){var _0x408c7d=0xa;var _0x299a06=['join',_0x1fad('0x58'),_0x1fad('0x89'),_0x1fad('0x59')];var _0x162272={'SUM':_0x1fad('0x5a'),'COUNT':_0x1fad('0x5b'),'COUNT DISTINCT':_0x1fad('0x5c'),'MAX':_0x1fad('0x5d'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x1fad('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x246da0={'SEC_TO_TIME':_0x1fad('0x63'),'DATE':'DATE(%s)','HOUR':_0x1fad('0x64'),'ROUND':_0x1fad('0x8a'),'UNIX_TIMESTAMP':_0x1fad('0x65')};var _0x57226b=function(_0x24ebeb){return!_[_0x1fad('0x66')]([_0x1fad('0xa3'),_0x1fad('0x8b'),_0x1fad('0x67'),_0x1fad('0x68')],_0x24ebeb);};var _0x564f95=function(_0x4da61b){if(!_0x4da61b||!_0x4da61b[_0x1fad('0x69')][_0x1fad('0x3c')]){return'';}for(var _0x3a9b50='(',_0x14fe67=0x0;_0x14fe67<_0x4da61b['rules'][_0x1fad('0x3c')];_0x14fe67+=0x1){_0x14fe67>0x0&&(_0x3a9b50+='\x20'+_0x4da61b[_0x1fad('0x6a')]+'\x20');_0x3a9b50+=_0x4da61b[_0x1fad('0x69')][_0x14fe67][_0x1fad('0x6b')]?_0x564f95(_0x4da61b['rules'][_0x14fe67][_0x1fad('0x6b')]):_0x4da61b[_0x1fad('0x69')][_0x14fe67]['field']+'\x20'+_0x4da61b[_0x1fad('0x69')][_0x14fe67][_0x1fad('0x6d')]+(_0x57226b(_0x4da61b['rules'][_0x14fe67]['condition'])?'\x20'+_0x4da61b[_0x1fad('0x69')][_0x14fe67][_0x1fad('0x6e')]:'');}return _0x3a9b50+')';};var _0x17f0dd={'where':{'id':_0x1d4323['params']['id']}},_0x11449e,_0x2cfb10,_0x4e5855,_0x299aae,_0x5e98e9;_0x17f0dd=_[_0x1fad('0x41')]({},_0x17f0dd,_0x1d4323[_0x1fad('0x44')]);return db[_0x1fad('0x31')][_0x1fad('0x56')](_0x17f0dd)['then'](function(_0xd0102d){if(_0xd0102d){_0x11449e=_0xd0102d;return _0xd0102d[_0x1fad('0x6f')]();}return null;})[_0x1fad('0x28')](function(_0x11b670){if(_0x11b670){if(!_0x11b670[_0x1fad('0x3c')]){throw new db[(_0x1fad('0x90'))][(_0x1fad('0x8c'))](_0x1fad('0x70'),0x193);}_0x2cfb10=_0x11b670;return db[_0x1fad('0xa4')][_0x1fad('0x46')]({'raw':!![]});}return null;})[_0x1fad('0x28')](function(_0x907c71){if(_0x907c71){_0x4e5855=_[_0x1fad('0x71')](_0x907c71,'id');var _0x183c54;var _0x55bbea=squel[_0x1fad('0x72')]();_0x55bbea['from'](_0x11449e[_0x1fad('0x81')]);for(var _0x5d12ca=0x0;_0x5d12ca<_0x2cfb10[_0x1fad('0x3c')];_0x5d12ca+=0x1){_0x183c54=_0x2cfb10[_0x5d12ca][_0x1fad('0x74')]?_0x4e5855[_0x2cfb10[_0x5d12ca][_0x1fad('0x74')]][_0x1fad('0x8d')]:_0x2cfb10[_0x5d12ca][_0x1fad('0x6c')];_0x183c54=_0x2cfb10[_0x5d12ca][_0x1fad('0x75')]?_[_0x1fad('0x76')](_0x162272[_0x2cfb10[_0x5d12ca][_0x1fad('0x75')]],'%s',_0x183c54):_0x183c54;_0x183c54=_0x2cfb10[_0x5d12ca][_0x1fad('0x77')]?_[_0x1fad('0x76')](_0x246da0[_0x2cfb10[_0x5d12ca][_0x1fad('0x77')]],'%s',_0x183c54):_0x183c54;if(_0x2cfb10[_0x5d12ca]['groupBy']){_0x55bbea[_0x1fad('0x6b')](_0x183c54);}_0x2cfb10[_0x5d12ca]['orderBy']&&_0x55bbea[_0x1fad('0x3e')](_0x183c54,_0x2cfb10[_0x5d12ca]['orderBy']===_0x1fad('0x7a')?![]:!![]);_0x55bbea[_0x1fad('0x6c')](_0x183c54,_0x2cfb10[_0x5d12ca][_0x1fad('0x7b')]||_0x183c54);}if(_0x11449e[_0x1fad('0x7c')]){_0x11449e['joins']=JSON['parse'](_0x11449e[_0x1fad('0x7c')]);for(var _0x41372f=0x0;_0x41372f<_0x11449e[_0x1fad('0x7c')][_0x1fad('0x3c')];_0x41372f+=0x1){if(_0x11449e[_0x1fad('0x7c')][_0x41372f][_0x1fad('0x33')]&&_[_0x1fad('0x66')](_0x299a06,_0x11449e[_0x1fad('0x7c')][_0x41372f][_0x1fad('0x33')])&&_0x11449e['joins'][_0x41372f][_0x1fad('0x7e')]&&_0x11449e[_0x1fad('0x7c')][_0x41372f][_0x1fad('0x7f')]&&_0x11449e[_0x1fad('0x7c')][_0x41372f]['foreignKey']){_0x55bbea[_0x11449e[_0x1fad('0x7c')][_0x41372f][_0x1fad('0x33')]](_0x11449e['joins'][_0x41372f][_0x1fad('0x7f')],null,util[_0x1fad('0x77')]('%s.%s\x20=\x20%s.%s',_0x11449e[_0x1fad('0x81')],_0x11449e['joins'][_0x41372f][_0x1fad('0x7e')],_0x11449e[_0x1fad('0x7c')][_0x41372f][_0x1fad('0x7f')],_0x11449e[_0x1fad('0x7c')][_0x41372f][_0x1fad('0x82')]));}}}if(_0x11449e[_0x1fad('0x83')]){_0x11449e[_0x1fad('0x83')]=JSON[_0x1fad('0x7d')](_0x11449e['conditions']);_0x55bbea['where'](_0x564f95(_0x11449e[_0x1fad('0x83')]['group']));}_0x5e98e9=_0x55bbea['clone']();_0x55bbea[_0x1fad('0x22')](_0x408c7d);_0x55bbea[_0x1fad('0x21')](0x0);logger[_0x1fad('0x84')](_0x1fad('0x8f'),_0x55bbea[_0x1fad('0x86')]());return db[_0x1fad('0x85')]['query'](_0x55bbea[_0x1fad('0x86')](),{'type':db[_0x1fad('0x85')][_0x1fad('0x87')][_0x1fad('0x88')]});}})['then'](function(){return{'sql':_0x5e98e9[_0x1fad('0x86')]()};})[_0x1fad('0x28')](respondWithResult(_0x5274af,null))[_0x1fad('0x48')](handleError(_0x5274af,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index a698ed5..b1aa231 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 _0xd99d=['analytics_default_reports','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd99d,0x1ae));var _0xdd99=function(_0x289143,_0x277942){_0x289143=_0x289143-0x0;var _0x493931=_0xd99d[_0x289143];return _0x493931;};'use strict';var _=require(_0xdd99('0x0'));var util=require('util');var logger=require(_0xdd99('0x1'))(_0xdd99('0x2'));var moment=require('moment');var BPromise=require(_0xdd99('0x3'));var rp=require(_0xdd99('0x4'));var fs=require('fs');var path=require(_0xdd99('0x5'));var rimraf=require(_0xdd99('0x6'));var config=require(_0xdd99('0x7'));var attributes=require(_0xdd99('0x8'));module[_0xdd99('0x9')]=function(_0x2537e5,_0x30b828){return _0x2537e5[_0xdd99('0xa')](_0xdd99('0xb'),attributes,{'tableName':_0xdd99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03a2=['../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','moment','bluebird','path','rimraf'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0x03a2,0xd7));var _0x203a=function(_0xf298c,_0xba7ce4){_0xf298c=_0xf298c-0x0;var _0x2542b5=_0x03a2[_0xf298c];return _0x2542b5;};'use strict';var _=require(_0x203a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x203a('0x1'));var BPromise=require(_0x203a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x203a('0x3'));var rimraf=require(_0x203a('0x4'));var config=require(_0x203a('0x5'));var attributes=require(_0x203a('0x6'));module[_0x203a('0x7')]=function(_0x1969da,_0x3c3743){return _0x1969da[_0x203a('0x8')]('AnalyticDefaultReport',attributes,{'tableName':_0x203a('0x9'),'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 fd3fa48..fbe3a73 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 _0x7b37=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird'];(function(_0x34d38c,_0x4f1295){var _0x4be108=function(_0x263e0f){while(--_0x263e0f){_0x34d38c['push'](_0x34d38c['shift']());}};_0x4be108(++_0x4f1295);}(_0x7b37,0xd9));var _0x77b3=function(_0x36d14b,_0x1ba5eb){_0x36d14b=_0x36d14b-0x0;var _0x4be643=_0x7b37[_0x36d14b];return _0x4be643;};'use strict';var _=require(_0x77b3('0x0'));var util=require(_0x77b3('0x1'));var moment=require('moment');var BPromise=require(_0x77b3('0x2'));var rs=require(_0x77b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77b3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77b3('0x5'))(_0x77b3('0x6'));var config=require(_0x77b3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x77b3('0x8')][_0x77b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x515f06,_0x49aded,_0x2f896b){return new BPromise(function(_0x5b3fb4,_0x35becb){return client[_0x77b3('0xa')](_0x515f06,_0x2f896b)['then'](function(_0x46dc45){logger[_0x77b3('0xb')](_0x77b3('0xc'),_0x49aded,_0x77b3('0xd'));logger[_0x77b3('0xe')](_0x77b3('0xf'),_0x49aded,_0x77b3('0xd'),JSON[_0x77b3('0x10')](_0x46dc45));if(_0x46dc45[_0x77b3('0x11')]){if(_0x46dc45[_0x77b3('0x11')]['code']===0x1f4){logger[_0x77b3('0x11')](_0x77b3('0xc'),_0x49aded,_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);return _0x35becb(_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);}logger[_0x77b3('0x11')](_0x77b3('0xc'),_0x49aded,_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);return _0x5b3fb4(_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);}else{logger['info'](_0x77b3('0xc'),_0x49aded,_0x77b3('0xd'));_0x5b3fb4(_0x46dc45[_0x77b3('0x13')][_0x77b3('0x12')]);}})['catch'](function(_0x224303){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x49aded,_0x224303);_0x35becb(_0x224303);});});} \ No newline at end of file +var _0xc29b=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4210a6,_0x4d1109){var _0x184fe5=function(_0x5da7a5){while(--_0x5da7a5){_0x4210a6['push'](_0x4210a6['shift']());}};_0x184fe5(++_0x4d1109);}(_0xc29b,0x12d));var _0xbc29=function(_0x3bc610,_0x4b378b){_0x3bc610=_0x3bc610-0x0;var _0x10d19b=_0xc29b[_0x3bc610];return _0x10d19b;};'use strict';var _=require(_0xbc29('0x0'));var util=require(_0xbc29('0x1'));var moment=require(_0xbc29('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc29('0x3'));var fs=require('fs');var Redis=require(_0xbc29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc29('0x5'));var logger=require(_0xbc29('0x6'))(_0xbc29('0x7'));var config=require(_0xbc29('0x8'));var jayson=require(_0xbc29('0x9'));var client=jayson[_0xbc29('0xa')][_0xbc29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40f0c9,_0x463e2b,_0x37d9dd){return new BPromise(function(_0x2e5fb7,_0x29b188){return client[_0xbc29('0xc')](_0x40f0c9,_0x37d9dd)[_0xbc29('0xd')](function(_0x320cb4){logger[_0xbc29('0xe')](_0xbc29('0xf'),_0x463e2b,_0xbc29('0x10'));logger[_0xbc29('0x11')](_0xbc29('0x12'),_0x463e2b,'request\x20sent',JSON[_0xbc29('0x13')](_0x320cb4));if(_0x320cb4[_0xbc29('0x14')]){if(_0x320cb4[_0xbc29('0x14')][_0xbc29('0x15')]===0x1f4){logger[_0xbc29('0x14')](_0xbc29('0xf'),_0x463e2b,_0x320cb4[_0xbc29('0x14')]['message']);return _0x29b188(_0x320cb4[_0xbc29('0x14')][_0xbc29('0x16')]);}logger[_0xbc29('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x463e2b,_0x320cb4['error'][_0xbc29('0x16')]);return _0x2e5fb7(_0x320cb4['error'][_0xbc29('0x16')]);}else{logger[_0xbc29('0xe')](_0xbc29('0xf'),_0x463e2b,'request\x20sent');_0x2e5fb7(_0x320cb4[_0xbc29('0x17')]['message']);}})[_0xbc29('0x18')](function(_0x3b5bae){logger[_0xbc29('0x14')](_0xbc29('0xf'),_0x463e2b,_0x3b5bae);_0x29b188(_0x3b5bae);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 31ad0de..0fbf7e4 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 _0xae7d=['index','get','show','/:id/preview','preview','run','/:id/query','query','create','/:id','update','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xae7d,0x19b));var _0xdae7=function(_0x1c7168,_0xb55a8c){_0x1c7168=_0x1c7168-0x0;var _0x58054b=_0xae7d[_0x1c7168];return _0x58054b;};'use strict';var multer=require('multer');var util=require(_0xdae7('0x0'));var path=require('path');var timeout=require(_0xdae7('0x1'));var express=require(_0xdae7('0x2'));var router=express[_0xdae7('0x3')]();var auth=require(_0xdae7('0x4'));var interaction=require(_0xdae7('0x5'));var config=require(_0xdae7('0x6'));var controller=require(_0xdae7('0x7'));router['get']('/',auth[_0xdae7('0x8')](),controller[_0xdae7('0x9')]);router[_0xdae7('0xa')]('/:id',auth[_0xdae7('0x8')](),controller[_0xdae7('0xb')]);router['get'](_0xdae7('0xc'),auth['isAuthenticated'](),controller[_0xdae7('0xd')]);router[_0xdae7('0xa')]('/:id/run',auth[_0xdae7('0x8')](),controller[_0xdae7('0xe')]);router[_0xdae7('0xa')](_0xdae7('0xf'),auth[_0xdae7('0x8')](),controller[_0xdae7('0x10')]);router['post']('/',auth[_0xdae7('0x8')](),controller[_0xdae7('0x11')]);router['put'](_0xdae7('0x12'),auth[_0xdae7('0x8')](),controller[_0xdae7('0x13')]);router['delete']('/:id',auth[_0xdae7('0x8')](),controller['destroy']);module[_0xdae7('0x14')]=router; \ No newline at end of file +var _0xd775=['/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','put','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index'];(function(_0x44a1a1,_0x4226d7){var _0x38b5e3=function(_0x4ab4a3){while(--_0x4ab4a3){_0x44a1a1['push'](_0x44a1a1['shift']());}};_0x38b5e3(++_0x4226d7);}(_0xd775,0x8f));var _0x5d77=function(_0x32332e,_0x25ac03){_0x32332e=_0x32332e-0x0;var _0xe4ac39=_0xd775[_0x32332e];return _0xe4ac39;};'use strict';var multer=require(_0x5d77('0x0'));var util=require(_0x5d77('0x1'));var path=require(_0x5d77('0x2'));var timeout=require(_0x5d77('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x5d77('0x4'));var interaction=require(_0x5d77('0x5'));var config=require(_0x5d77('0x6'));var controller=require(_0x5d77('0x7'));router[_0x5d77('0x8')]('/',auth[_0x5d77('0x9')](),controller[_0x5d77('0xa')]);router[_0x5d77('0x8')](_0x5d77('0xb'),auth['isAuthenticated'](),controller[_0x5d77('0xc')]);router[_0x5d77('0x8')](_0x5d77('0xd'),auth[_0x5d77('0x9')](),controller[_0x5d77('0xe')]);router[_0x5d77('0x8')](_0x5d77('0xf'),auth[_0x5d77('0x9')](),controller[_0x5d77('0x10')]);router[_0x5d77('0x8')](_0x5d77('0x11'),auth[_0x5d77('0x9')](),controller[_0x5d77('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5d77('0x13')]('/:id',auth[_0x5d77('0x9')](),controller['update']);router[_0x5d77('0x14')](_0x5d77('0xb'),auth['isAuthenticated'](),controller[_0x5d77('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index a9bdadf..61bf5d4 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 _0x6546=['moment','STRING','csv','xlsx','DATE','manual','scheduled','UNSIGNED','sequelize'];(function(_0x2929a9,_0x344e5d){var _0x253bb1=function(_0x46530e){while(--_0x46530e){_0x2929a9['push'](_0x2929a9['shift']());}};_0x253bb1(++_0x344e5d);}(_0x6546,0x11f));var _0x6654=function(_0x195053,_0x1d22a6){_0x195053=_0x195053-0x0;var _0x556b3b=_0x6546[_0x195053];return _0x556b3b;};'use strict';var Sequelize=require(_0x6654('0x0'));var moment=require(_0x6654('0x1'));module['exports']={'name':{'type':Sequelize[_0x6654('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x6654('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x6654('0x3'),'pdf',_0x6654('0x4')),'allowNull':![],'defaultValue':_0x6654('0x3')},'savename':{'type':Sequelize[_0x6654('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x6654('0x5')]},'endDate':{'type':Sequelize[_0x6654('0x5')]},'status':{'type':Sequelize[_0x6654('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x6654('0x6'),_0x6654('0x7')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x6654('0x8')]},'reportType':{'type':Sequelize[_0x6654('0x2')]}}; \ No newline at end of file +var _0xc13e=['STRING','csv','pdf','xlsx','DATE','Loading','ENUM','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports'];(function(_0x4a0c27,_0x61303f){var _0x53435c=function(_0x5102df){while(--_0x5102df){_0x4a0c27['push'](_0x4a0c27['shift']());}};_0x53435c(++_0x61303f);}(_0xc13e,0x97));var _0xec13=function(_0x5ad360,_0x33c99e){_0x5ad360=_0x5ad360-0x0;var _0x25bd0c=_0xc13e[_0x5ad360];return _0x25bd0c;};'use strict';var Sequelize=require(_0xec13('0x0'));var moment=require(_0xec13('0x1'));module[_0xec13('0x2')]={'name':{'type':Sequelize[_0xec13('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xec13('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xec13('0x4'),_0xec13('0x5'),_0xec13('0x6')),'allowNull':![],'defaultValue':_0xec13('0x4')},'savename':{'type':Sequelize[_0xec13('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xec13('0x7')]},'endDate':{'type':Sequelize[_0xec13('0x7')]},'status':{'type':Sequelize[_0xec13('0x3')],'defaultValue':_0xec13('0x8')},'type':{'type':Sequelize[_0xec13('0x9')](_0xec13('0xa'),_0xec13('0xb')),'allowNull':![],'defaultValue':_0xec13('0xa')},'reportId':{'type':Sequelize[_0xec13('0xc')](0xb)[_0xec13('0xd')]},'reportType':{'type':Sequelize[_0xec13('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 16872ee..92936a3 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 _0x4534=['root','format','%s.%s','toLowerCase','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','lodash','squel','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','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','AnalyticExtractedReport','fieldName','model','map','query','intersection','fields','attributes','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x4534,0x11e));var _0x4453=function(_0x2bbec7,_0x83c575){_0x2bbec7=_0x2bbec7-0x0;var _0x464a4d=_0x4534[_0x2bbec7];return _0x464a4d;};'use strict';var pdf=require(_0x4453('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4453('0x1'));var zipdir=require(_0x4453('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4453('0x3'));var moment=require(_0x4453('0x4'));var BPromise=require(_0x4453('0x5'));var Mustache=require(_0x4453('0x6'));var util=require('util');var path=require(_0x4453('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4453('0x8'));var squel=require(_0x4453('0x9'));var crypto=require(_0x4453('0xa'));var jsforce=require(_0x4453('0xb'));var deskjs=require(_0x4453('0xc'));var toCsv=require(_0x4453('0xd'));var querystring=require(_0x4453('0xe'));var Papa=require(_0x4453('0xf'));var Redis=require(_0x4453('0x10'));var authService=require(_0x4453('0x11'));var qs=require(_0x4453('0x12'));var as=require(_0x4453('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4453('0x14'))(_0x4453('0x15'));var utils=require(_0x4453('0x16'));var config=require(_0x4453('0x17'));var licenseUtil=require(_0x4453('0x18'));var db=require(_0x4453('0x19'))['db'];function respondWithStatusCode(_0xb04938,_0x51c4df){_0x51c4df=_0x51c4df||0xcc;return function(_0x4f0142){if(_0x4f0142){return _0xb04938[_0x4453('0x1a')](_0x51c4df);}return _0xb04938['status'](_0x51c4df)['end']();};}function respondWithResult(_0x4bc43e,_0x379f55){_0x379f55=_0x379f55||0xc8;return function(_0x5d08ed){if(_0x5d08ed){return _0x4bc43e[_0x4453('0x1b')](_0x379f55)['json'](_0x5d08ed);}};}function respondWithFilteredResult(_0x564fa3,_0x3b8933){return function(_0x2a9c56){if(_0x2a9c56){var _0x31cb4f=_0x2a9c56['count'],_0x443f07=_0x3b8933['offset'],_0x1d13cf=_0x3b8933[_0x4453('0x1c')]+_0x3b8933[_0x4453('0x1d')],_0xa94f7f;if(_0x1d13cf>=_0x31cb4f){_0x1d13cf=_0x31cb4f;_0xa94f7f=0xc8;}else{_0xa94f7f=0xce;}_0x564fa3[_0x4453('0x1b')](_0xa94f7f);return _0x564fa3[_0x4453('0x1e')](_0x4453('0x1f'),_0x443f07+'-'+_0x1d13cf+'/'+_0x31cb4f)[_0x4453('0x20')](_0x2a9c56);}return null;};}function patchUpdates(_0x56e324){return function(_0x82946a){try{jsonpatch[_0x4453('0x21')](_0x82946a,_0x56e324,!![]);}catch(_0x18d748){return BPromise[_0x4453('0x22')](_0x18d748);}return _0x82946a[_0x4453('0x23')]();};}function saveUpdates(_0x6be702,_0x52af14){return function(_0x3a221d){if(_0x3a221d){return _0x3a221d[_0x4453('0x24')](_0x6be702)[_0x4453('0x25')](function(_0x4d963c){return _0x4d963c;});}return null;};}function removeEntity(_0x4f3ed3,_0x249021){return function(_0x15ee4a){if(_0x15ee4a){return _0x15ee4a[_0x4453('0x26')]()['then'](function(){var _0x1c3f5e=_0x15ee4a[_0x4453('0x27')]({'plain':!![]});var _0x1ab06a='ExtractedReports';return db[_0x4453('0x28')][_0x4453('0x26')]({'where':{'type':_0x1ab06a,'resourceId':_0x1c3f5e['id']}})[_0x4453('0x25')](function(){return _0x15ee4a;});})[_0x4453('0x25')](function(){_0x4f3ed3[_0x4453('0x1b')](0xcc)[_0x4453('0x29')]();});}};}function handleEntityNotFound(_0x42bb2d,_0x281c05){return function(_0x5ce08d){if(!_0x5ce08d){_0x42bb2d[_0x4453('0x1a')](0x194);}return _0x5ce08d;};}function handleError(_0x32ff1a,_0xa5056d){_0xa5056d=_0xa5056d||0x1f4;return function(_0x4e77e5){logger[_0x4453('0x2a')](_0x4e77e5['stack']);if(_0x4e77e5['name']){delete _0x4e77e5[_0x4453('0x2b')];}_0x32ff1a[_0x4453('0x1b')](_0xa5056d)[_0x4453('0x2c')](_0x4e77e5);};}exports[_0x4453('0x2d')]=function(_0x28c8ab,_0xbebc2){var _0x272470={},_0x117e92={},_0x4dc9b5={'count':0x0,'rows':[]};var _0x3c6dc0=_['map'](db[_0x4453('0x2e')]['rawAttributes'],function(_0x295fa8){return{'name':_0x295fa8[_0x4453('0x2f')],'type':_0x295fa8['type']['key']};});_0x117e92[_0x4453('0x30')]=_[_0x4453('0x31')](_0x3c6dc0,_0x4453('0x2b'));_0x117e92['query']=_['keys'](_0x28c8ab[_0x4453('0x32')]);_0x117e92['filters']=_[_0x4453('0x33')](_0x117e92[_0x4453('0x30')],_0x117e92[_0x4453('0x32')]);_0x272470['attributes']=_[_0x4453('0x33')](_0x117e92[_0x4453('0x30')],qs[_0x4453('0x34')](_0x28c8ab['query']['fields']));_0x272470['attributes']=_0x272470[_0x4453('0x35')]['length']?_0x272470[_0x4453('0x35')]:_0x117e92[_0x4453('0x30')];if(!_0x28c8ab['query']['hasOwnProperty']('nolimit')){_0x272470['limit']=qs['limit'](_0x28c8ab['query'][_0x4453('0x1d')]);_0x272470[_0x4453('0x1c')]=qs['offset'](_0x28c8ab[_0x4453('0x32')][_0x4453('0x1c')]);}_0x272470['order']=qs[_0x4453('0x36')](_0x28c8ab['query'][_0x4453('0x36')]);_0x272470[_0x4453('0x37')]=qs[_0x4453('0x38')](_['pick'](_0x28c8ab[_0x4453('0x32')],_0x117e92[_0x4453('0x38')]),_0x3c6dc0);if(_0x28c8ab[_0x4453('0x32')][_0x4453('0x39')]){_0x272470[_0x4453('0x37')]=_[_0x4453('0x3a')](_0x272470[_0x4453('0x37')],{'$or':_[_0x4453('0x31')](_0x3c6dc0,function(_0x5c5950){if(_0x5c5950['type']!==_0x4453('0x3b')){var _0x4b9c22={};_0x4b9c22[_0x5c5950[_0x4453('0x2b')]]={'$like':'%'+_0x28c8ab['query'][_0x4453('0x39')]+'%'};return _0x4b9c22;}})});}_0x272470=_[_0x4453('0x3a')]({},_0x272470,_0x28c8ab[_0x4453('0x3c')]);var _0x3e3ae6={'where':_0x272470[_0x4453('0x37')]};return db[_0x4453('0x2e')][_0x4453('0x3d')](_0x3e3ae6)[_0x4453('0x25')](function(_0x11fff9){_0x4dc9b5['count']=_0x11fff9;if(_0x28c8ab[_0x4453('0x32')][_0x4453('0x3e')]){_0x272470['include']=[{'all':!![]}];}return db[_0x4453('0x2e')][_0x4453('0x3f')](_0x272470);})[_0x4453('0x25')](function(_0x359e03){_0x4dc9b5[_0x4453('0x40')]=_0x359e03;return _0x4dc9b5;})[_0x4453('0x25')](respondWithFilteredResult(_0xbebc2,_0x272470))[_0x4453('0x41')](handleError(_0xbebc2,null));};exports['show']=function(_0x2f2f1e,_0x1247de){var _0x212b20={'raw':!![],'where':{'id':_0x2f2f1e[_0x4453('0x42')]['id']}},_0x2271c7={};_0x2271c7[_0x4453('0x30')]=_['keys'](db[_0x4453('0x2e')][_0x4453('0x43')]);_0x2271c7[_0x4453('0x32')]=_['keys'](_0x2f2f1e[_0x4453('0x32')]);_0x2271c7[_0x4453('0x38')]=_['intersection'](_0x2271c7['model'],_0x2271c7[_0x4453('0x32')]);_0x212b20[_0x4453('0x35')]=_['intersection'](_0x2271c7[_0x4453('0x30')],qs[_0x4453('0x34')](_0x2f2f1e[_0x4453('0x32')][_0x4453('0x34')]));_0x212b20[_0x4453('0x35')]=_0x212b20[_0x4453('0x35')][_0x4453('0x44')]?_0x212b20[_0x4453('0x35')]:_0x2271c7[_0x4453('0x30')];if(_0x2f2f1e[_0x4453('0x32')][_0x4453('0x3e')]){_0x212b20[_0x4453('0x45')]=[{'all':!![]}];}_0x212b20=_[_0x4453('0x3a')]({},_0x212b20,_0x2f2f1e['options']);return db[_0x4453('0x2e')][_0x4453('0x46')](_0x212b20)[_0x4453('0x25')](handleEntityNotFound(_0x1247de,null))[_0x4453('0x25')](respondWithResult(_0x1247de,null))[_0x4453('0x41')](handleError(_0x1247de,null));};exports['create']=function(_0x29d1b4,_0x14381d){return db['AnalyticExtractedReport'][_0x4453('0x47')](_0x29d1b4[_0x4453('0x48')],{})[_0x4453('0x25')](function(_0x725505){var _0x1fd16d=_0x29d1b4[_0x4453('0x49')][_0x4453('0x27')]({'plain':!![]});if(!_0x1fd16d)throw new Error(_0x4453('0x4a'));if(_0x1fd16d[_0x4453('0x4b')]==='user'){var _0x4f9f09=_0x725505['get']({'plain':!![]});var _0x104844=_0x4453('0x4c');return db['UserProfileSection'][_0x4453('0x46')]({'where':{'name':_0x104844,'userProfileId':_0x1fd16d[_0x4453('0x4d')]},'raw':!![]})[_0x4453('0x25')](function(_0x3fd925){if(_0x3fd925&&_0x3fd925[_0x4453('0x4e')]===0x0){return db[_0x4453('0x28')][_0x4453('0x47')]({'name':_0x4f9f09[_0x4453('0x2b')],'resourceId':_0x4f9f09['id'],'type':_0x3fd925[_0x4453('0x2b')],'sectionId':_0x3fd925['id']},{})[_0x4453('0x25')](function(){return _0x725505;});}else{return _0x725505;}})['catch'](function(_0x10625e){logger[_0x4453('0x2a')](_0x4453('0x4f'),_0x10625e);throw _0x10625e;});}return _0x725505;})[_0x4453('0x25')](respondWithResult(_0x14381d,0xc9))[_0x4453('0x41')](handleError(_0x14381d,null));};exports[_0x4453('0x24')]=function(_0x346996,_0x1eb6da){if(_0x346996['body']['id']){delete _0x346996['body']['id'];}return db['AnalyticExtractedReport'][_0x4453('0x46')]({'where':{'id':_0x346996['params']['id']}})[_0x4453('0x25')](handleEntityNotFound(_0x1eb6da,null))['then'](saveUpdates(_0x346996[_0x4453('0x48')],null))[_0x4453('0x25')](respondWithResult(_0x1eb6da,null))['catch'](handleError(_0x1eb6da,null));};exports[_0x4453('0x26')]=function(_0x45be4d,_0x3d7c7a){return db[_0x4453('0x2e')][_0x4453('0x46')]({'where':{'id':_0x45be4d[_0x4453('0x42')]['id']}})['then'](handleEntityNotFound(_0x3d7c7a,null))['then'](removeEntity(_0x3d7c7a,null))[_0x4453('0x41')](handleError(_0x3d7c7a,null));};exports[_0x4453('0x50')]=function(_0x3eb055,_0x3d54d7,_0x4061f8){return db[_0x4453('0x2e')][_0x4453('0x46')]({'where':{'id':_0x3eb055['params']['id']},'attributes':[_0x4453('0x2b'),_0x4453('0x51'),_0x4453('0x52'),_0x4453('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x3d54d7,null))['then'](function(_0x4641f1){if(_0x4641f1){if(!fs[_0x4453('0x54')](path['join'](config['root'],_0x4453('0x55'),_0x4641f1['savename']))){throw new db['Sequelize'][(_0x4453('0x56'))](_0x4453('0x57'));}if(_0x3eb055['query'][_0x4453('0x58')]){return _0x3d54d7[_0x4453('0x1a')](0xc8);}return _0x3d54d7['download'](path[_0x4453('0x59')](config[_0x4453('0x5a')],'server/files/reports',_0x4641f1[_0x4453('0x52')]),util[_0x4453('0x5b')](_0x4453('0x5c'),_0x4641f1[_0x4453('0x51')]||_0x4641f1[_0x4453('0x2b')],_0x4641f1[_0x4453('0x53')][_0x4453('0x5d')]()));}})[_0x4453('0x41')](handleError(_0x3d54d7,null));}; \ No newline at end of file +var _0x143a=['jsforce','desk.js','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','save','update','destroy','get','ExtractedReports','UserProfileResource','then','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','includeAll','AnalyticExtractedReport','rows','catch','show','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','basename','savename','output','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','format','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x819e88,_0xbce164){var _0x4ed85b=function(_0x36f049){while(--_0x36f049){_0x819e88['push'](_0x819e88['shift']());}};_0x4ed85b(++_0xbce164);}(_0x143a,0x1b9));var _0xa143=function(_0x48e7ba,_0x120483){_0x48e7ba=_0x48e7ba-0x0;var _0x50a06c=_0x143a[_0x48e7ba];return _0x50a06c;};'use strict';var pdf=require(_0xa143('0x0'));var emlformat=require(_0xa143('0x1'));var rimraf=require(_0xa143('0x2'));var zipdir=require(_0xa143('0x3'));var jsonpatch=require(_0xa143('0x4'));var rp=require('request-promise');var moment=require(_0xa143('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa143('0x6'));var util=require('util');var path=require(_0xa143('0x7'));var sox=require(_0xa143('0x8'));var csv=require(_0xa143('0x9'));var ejs=require(_0xa143('0xa'));var fs=require('fs');var _=require(_0xa143('0xb'));var squel=require(_0xa143('0xc'));var crypto=require(_0xa143('0xd'));var jsforce=require(_0xa143('0xe'));var deskjs=require(_0xa143('0xf'));var toCsv=require(_0xa143('0x9'));var querystring=require(_0xa143('0x10'));var Papa=require(_0xa143('0x11'));var Redis=require('ioredis');var authService=require(_0xa143('0x12'));var qs=require(_0xa143('0x13'));var as=require(_0xa143('0x14'));var hardwareService=require(_0xa143('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa143('0x16'));var config=require(_0xa143('0x17'));var licenseUtil=require(_0xa143('0x18'));var db=require(_0xa143('0x19'))['db'];function respondWithStatusCode(_0xc3cc21,_0x3a5c00){_0x3a5c00=_0x3a5c00||0xcc;return function(_0x226303){if(_0x226303){return _0xc3cc21[_0xa143('0x1a')](_0x3a5c00);}return _0xc3cc21[_0xa143('0x1b')](_0x3a5c00)[_0xa143('0x1c')]();};}function respondWithResult(_0x49807f,_0x1988fe){_0x1988fe=_0x1988fe||0xc8;return function(_0x29146e){if(_0x29146e){return _0x49807f[_0xa143('0x1b')](_0x1988fe)[_0xa143('0x1d')](_0x29146e);}};}function respondWithFilteredResult(_0x4318c1,_0x47d554){return function(_0x72f2c7){if(_0x72f2c7){var _0x3f2771=_0x72f2c7[_0xa143('0x1e')],_0x3e6572=_0x47d554[_0xa143('0x1f')],_0x5aab5f=_0x47d554['offset']+_0x47d554[_0xa143('0x20')],_0x4935ad;if(_0x5aab5f>=_0x3f2771){_0x5aab5f=_0x3f2771;_0x4935ad=0xc8;}else{_0x4935ad=0xce;}_0x4318c1[_0xa143('0x1b')](_0x4935ad);return _0x4318c1['set']('Content-Range',_0x3e6572+'-'+_0x5aab5f+'/'+_0x3f2771)[_0xa143('0x1d')](_0x72f2c7);}return null;};}function patchUpdates(_0x147a4d){return function(_0xae3471){try{jsonpatch['apply'](_0xae3471,_0x147a4d,!![]);}catch(_0x3d6453){return BPromise['reject'](_0x3d6453);}return _0xae3471[_0xa143('0x21')]();};}function saveUpdates(_0x25254a,_0x27d8a8){return function(_0xedb252){if(_0xedb252){return _0xedb252[_0xa143('0x22')](_0x25254a)['then'](function(_0x3170b2){return _0x3170b2;});}return null;};}function removeEntity(_0x3a1998,_0x51eb32){return function(_0x419024){if(_0x419024){return _0x419024[_0xa143('0x23')]()['then'](function(){var _0xb90b5c=_0x419024[_0xa143('0x24')]({'plain':!![]});var _0x320f20=_0xa143('0x25');return db[_0xa143('0x26')][_0xa143('0x23')]({'where':{'type':_0x320f20,'resourceId':_0xb90b5c['id']}})[_0xa143('0x27')](function(){return _0x419024;});})[_0xa143('0x27')](function(){_0x3a1998[_0xa143('0x1b')](0xcc)[_0xa143('0x1c')]();});}};}function handleEntityNotFound(_0x28ecd6,_0x5f4bca){return function(_0x3b4ded){if(!_0x3b4ded){_0x28ecd6['sendStatus'](0x194);}return _0x3b4ded;};}function handleError(_0x84591a,_0x38a98b){_0x38a98b=_0x38a98b||0x1f4;return function(_0x422e04){logger['error'](_0x422e04['stack']);if(_0x422e04['name']){delete _0x422e04['name'];}_0x84591a[_0xa143('0x1b')](_0x38a98b)['send'](_0x422e04);};}exports[_0xa143('0x28')]=function(_0x324402,_0xb6144c){var _0x4494b1={},_0x404be2={},_0x5ee3b0={'count':0x0,'rows':[]};var _0x3d133b=_[_0xa143('0x29')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x4c8da8){return{'name':_0x4c8da8[_0xa143('0x2a')],'type':_0x4c8da8[_0xa143('0x2b')][_0xa143('0x2c')]};});_0x404be2[_0xa143('0x2d')]=_[_0xa143('0x29')](_0x3d133b,'name');_0x404be2[_0xa143('0x2e')]=_[_0xa143('0x2f')](_0x324402[_0xa143('0x2e')]);_0x404be2[_0xa143('0x30')]=_[_0xa143('0x31')](_0x404be2['model'],_0x404be2['query']);_0x4494b1[_0xa143('0x32')]=_[_0xa143('0x31')](_0x404be2[_0xa143('0x2d')],qs[_0xa143('0x33')](_0x324402['query'][_0xa143('0x33')]));_0x4494b1['attributes']=_0x4494b1[_0xa143('0x32')][_0xa143('0x34')]?_0x4494b1[_0xa143('0x32')]:_0x404be2[_0xa143('0x2d')];if(!_0x324402[_0xa143('0x2e')][_0xa143('0x35')]('nolimit')){_0x4494b1['limit']=qs['limit'](_0x324402['query'][_0xa143('0x20')]);_0x4494b1[_0xa143('0x1f')]=qs[_0xa143('0x1f')](_0x324402[_0xa143('0x2e')][_0xa143('0x1f')]);}_0x4494b1[_0xa143('0x36')]=qs[_0xa143('0x37')](_0x324402[_0xa143('0x2e')][_0xa143('0x37')]);_0x4494b1['where']=qs[_0xa143('0x30')](_['pick'](_0x324402[_0xa143('0x2e')],_0x404be2[_0xa143('0x30')]),_0x3d133b);if(_0x324402[_0xa143('0x2e')][_0xa143('0x38')]){_0x4494b1[_0xa143('0x39')]=_['merge'](_0x4494b1[_0xa143('0x39')],{'$or':_[_0xa143('0x29')](_0x3d133b,function(_0xcb674e){if(_0xcb674e[_0xa143('0x2b')]!==_0xa143('0x3a')){var _0x2ba1d2={};_0x2ba1d2[_0xcb674e['name']]={'$like':'%'+_0x324402[_0xa143('0x2e')]['filter']+'%'};return _0x2ba1d2;}})});}_0x4494b1=_[_0xa143('0x3b')]({},_0x4494b1,_0x324402[_0xa143('0x3c')]);var _0x30c4a2={'where':_0x4494b1[_0xa143('0x39')]};return db['AnalyticExtractedReport'][_0xa143('0x1e')](_0x30c4a2)['then'](function(_0x8a24c5){_0x5ee3b0[_0xa143('0x1e')]=_0x8a24c5;if(_0x324402[_0xa143('0x2e')][_0xa143('0x3d')]){_0x4494b1['include']=[{'all':!![]}];}return db[_0xa143('0x3e')]['findAll'](_0x4494b1);})['then'](function(_0x172f33){_0x5ee3b0[_0xa143('0x3f')]=_0x172f33;return _0x5ee3b0;})[_0xa143('0x27')](respondWithFilteredResult(_0xb6144c,_0x4494b1))[_0xa143('0x40')](handleError(_0xb6144c,null));};exports[_0xa143('0x41')]=function(_0x5835bb,_0x9f650f){var _0x2e481f={'raw':!![],'where':{'id':_0x5835bb['params']['id']}},_0x10e3e7={};_0x10e3e7[_0xa143('0x2d')]=_['keys'](db[_0xa143('0x3e')][_0xa143('0x42')]);_0x10e3e7[_0xa143('0x2e')]=_[_0xa143('0x2f')](_0x5835bb[_0xa143('0x2e')]);_0x10e3e7[_0xa143('0x30')]=_['intersection'](_0x10e3e7[_0xa143('0x2d')],_0x10e3e7[_0xa143('0x2e')]);_0x2e481f[_0xa143('0x32')]=_['intersection'](_0x10e3e7[_0xa143('0x2d')],qs['fields'](_0x5835bb[_0xa143('0x2e')][_0xa143('0x33')]));_0x2e481f[_0xa143('0x32')]=_0x2e481f[_0xa143('0x32')][_0xa143('0x34')]?_0x2e481f['attributes']:_0x10e3e7[_0xa143('0x2d')];if(_0x5835bb['query'][_0xa143('0x3d')]){_0x2e481f['include']=[{'all':!![]}];}_0x2e481f=_[_0xa143('0x3b')]({},_0x2e481f,_0x5835bb[_0xa143('0x3c')]);return db[_0xa143('0x3e')][_0xa143('0x43')](_0x2e481f)[_0xa143('0x27')](handleEntityNotFound(_0x9f650f,null))['then'](respondWithResult(_0x9f650f,null))[_0xa143('0x40')](handleError(_0x9f650f,null));};exports[_0xa143('0x44')]=function(_0x16c60d,_0x1aef5){return db[_0xa143('0x3e')][_0xa143('0x44')](_0x16c60d['body'],{})[_0xa143('0x27')](function(_0x5f5b1b){var _0x340392=_0x16c60d[_0xa143('0x45')][_0xa143('0x24')]({'plain':!![]});if(!_0x340392)throw new Error(_0xa143('0x46'));if(_0x340392['role']===_0xa143('0x45')){var _0x27369f=_0x5f5b1b[_0xa143('0x24')]({'plain':!![]});var _0x1c6c2b=_0xa143('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x1c6c2b,'userProfileId':_0x340392[_0xa143('0x47')]},'raw':!![]})['then'](function(_0x1bc17f){if(_0x1bc17f&&_0x1bc17f[_0xa143('0x48')]===0x0){return db['UserProfileResource'][_0xa143('0x44')]({'name':_0x27369f['name'],'resourceId':_0x27369f['id'],'type':_0x1bc17f[_0xa143('0x49')],'sectionId':_0x1bc17f['id']},{})[_0xa143('0x27')](function(){return _0x5f5b1b;});}else{return _0x5f5b1b;}})[_0xa143('0x40')](function(_0x39db9a){logger[_0xa143('0x4a')](_0xa143('0x4b'),_0x39db9a);throw _0x39db9a;});}return _0x5f5b1b;})['then'](respondWithResult(_0x1aef5,0xc9))[_0xa143('0x40')](handleError(_0x1aef5,null));};exports[_0xa143('0x22')]=function(_0x48b43b,_0x3fbf72){if(_0x48b43b[_0xa143('0x4c')]['id']){delete _0x48b43b[_0xa143('0x4c')]['id'];}return db[_0xa143('0x3e')][_0xa143('0x43')]({'where':{'id':_0x48b43b[_0xa143('0x4d')]['id']}})[_0xa143('0x27')](handleEntityNotFound(_0x3fbf72,null))[_0xa143('0x27')](saveUpdates(_0x48b43b['body'],null))[_0xa143('0x27')](respondWithResult(_0x3fbf72,null))[_0xa143('0x40')](handleError(_0x3fbf72,null));};exports[_0xa143('0x23')]=function(_0x22104f,_0x495059){return db[_0xa143('0x3e')][_0xa143('0x43')]({'where':{'id':_0x22104f[_0xa143('0x4d')]['id']}})[_0xa143('0x27')](handleEntityNotFound(_0x495059,null))[_0xa143('0x27')](removeEntity(_0x495059,null))[_0xa143('0x40')](handleError(_0x495059,null));};exports['download']=function(_0x279f12,_0x4fa214,_0x1d76fc){return db[_0xa143('0x3e')][_0xa143('0x43')]({'where':{'id':_0x279f12[_0xa143('0x4d')]['id']},'attributes':[_0xa143('0x49'),_0xa143('0x4e'),_0xa143('0x4f'),_0xa143('0x50')],'raw':!![]})[_0xa143('0x27')](handleEntityNotFound(_0x4fa214,null))['then'](function(_0x37c434){if(_0x37c434){if(!fs[_0xa143('0x51')](path['join'](config[_0xa143('0x52')],_0xa143('0x53'),_0x37c434[_0xa143('0x4f')]))){throw new db[(_0xa143('0x54'))][(_0xa143('0x55'))](_0xa143('0x56'));}if(_0x279f12[_0xa143('0x2e')][_0xa143('0x57')]){return _0x4fa214[_0xa143('0x1a')](0xc8);}return _0x4fa214['download'](path[_0xa143('0x58')](config[_0xa143('0x52')],_0xa143('0x53'),_0x37c434[_0xa143('0x4f')]),util[_0xa143('0x59')]('%s.%s',_0x37c434[_0xa143('0x4e')]||_0x37c434[_0xa143('0x49')],_0x37c434[_0xa143('0x50')][_0xa143('0x5a')]()));}})[_0xa143('0x40')](handleError(_0x4fa214,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 481546a..aead5a6 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 _0x3f62=['analytics_extracted_reports','util','../../config/logger','api','moment','request-promise','rimraf','exports','define','AnalyticExtractedReport'];(function(_0x1a6ca3,_0x5dc083){var _0x27ffc0=function(_0x2053dd){while(--_0x2053dd){_0x1a6ca3['push'](_0x1a6ca3['shift']());}};_0x27ffc0(++_0x5dc083);}(_0x3f62,0xab));var _0x23f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x3f62[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x23f6('0x0'));var logger=require(_0x23f6('0x1'))(_0x23f6('0x2'));var moment=require(_0x23f6('0x3'));var BPromise=require('bluebird');var rp=require(_0x23f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x23f6('0x5'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0x23f6('0x6')]=function(_0x1331bc,_0x2c402f){return _0x1331bc[_0x23f6('0x7')](_0x23f6('0x8'),attributes,{'tableName':_0x23f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x764f=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x720299,_0x10a69b){var _0x45ffb2=function(_0x4ce95d){while(--_0x4ce95d){_0x720299['push'](_0x720299['shift']());}};_0x45ffb2(++_0x10a69b);}(_0x764f,0xe5));var _0xf764=function(_0x518223,_0x2ca5d7){_0x518223=_0x518223-0x0;var _0x45bd12=_0x764f[_0x518223];return _0x45bd12;};'use strict';var _=require(_0xf764('0x0'));var util=require(_0xf764('0x1'));var logger=require('../../config/logger')(_0xf764('0x2'));var moment=require(_0xf764('0x3'));var BPromise=require(_0xf764('0x4'));var rp=require(_0xf764('0x5'));var fs=require('fs');var path=require(_0xf764('0x6'));var rimraf=require(_0xf764('0x7'));var config=require(_0xf764('0x8'));var attributes=require(_0xf764('0x9'));module[_0xf764('0xa')]=function(_0x227e45,_0x4d1d08){return _0x227e45[_0xf764('0xb')](_0xf764('0xc'),attributes,{'tableName':_0xf764('0xd'),'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 cf22375..cc0b1a9 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 _0x1728=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message'];(function(_0x50db4f,_0x2b918c){var _0x16b18d=function(_0x2ddb7a){while(--_0x2ddb7a){_0x50db4f['push'](_0x50db4f['shift']());}};_0x16b18d(++_0x2b918c);}(_0x1728,0x1ce));var _0x8172=function(_0x32fd30,_0x2b11c2){_0x32fd30=_0x32fd30-0x0;var _0x68f611=_0x1728[_0x32fd30];return _0x68f611;};'use strict';var _=require(_0x8172('0x0'));var util=require(_0x8172('0x1'));var moment=require('moment');var BPromise=require(_0x8172('0x2'));var rs=require(_0x8172('0x3'));var fs=require('fs');var Redis=require(_0x8172('0x4'));var db=require(_0x8172('0x5'))['db'];var utils=require(_0x8172('0x6'));var logger=require('../../config/logger')(_0x8172('0x7'));var config=require(_0x8172('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8172('0x9')][_0x8172('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57b47a,_0x4275b6,_0x401f5c){return new BPromise(function(_0x3bb7a3,_0x426a57){return client['request'](_0x57b47a,_0x401f5c)[_0x8172('0xb')](function(_0x276af6){logger[_0x8172('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4275b6,_0x8172('0xd'));logger[_0x8172('0xe')](_0x8172('0xf'),_0x4275b6,_0x8172('0xd'),JSON[_0x8172('0x10')](_0x276af6));if(_0x276af6[_0x8172('0x11')]){if(_0x276af6['error'][_0x8172('0x12')]===0x1f4){logger[_0x8172('0x11')](_0x8172('0x13'),_0x4275b6,_0x276af6[_0x8172('0x11')][_0x8172('0x14')]);return _0x426a57(_0x276af6[_0x8172('0x11')][_0x8172('0x14')]);}logger[_0x8172('0x11')](_0x8172('0x13'),_0x4275b6,_0x276af6['error'][_0x8172('0x14')]);return _0x3bb7a3(_0x276af6[_0x8172('0x11')][_0x8172('0x14')]);}else{logger[_0x8172('0xc')](_0x8172('0x13'),_0x4275b6,_0x8172('0xd'));_0x3bb7a3(_0x276af6['result'][_0x8172('0x14')]);}})['catch'](function(_0x422941){logger[_0x8172('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4275b6,_0x422941);_0x426a57(_0x422941);});});} \ No newline at end of file +var _0x9981=['jayson/promise','client','request','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x529b24,_0x121c3a){var _0x11a306=function(_0x244e2d){while(--_0x244e2d){_0x529b24['push'](_0x529b24['shift']());}};_0x11a306(++_0x121c3a);}(_0x9981,0xdf));var _0x1998=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x9981[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0x1998('0x0'));var util=require(_0x1998('0x1'));var moment=require(_0x1998('0x2'));var BPromise=require(_0x1998('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1998('0x4'))['db'];var utils=require(_0x1998('0x5'));var logger=require(_0x1998('0x6'))('rpc');var config=require(_0x1998('0x7'));var jayson=require(_0x1998('0x8'));var client=jayson[_0x1998('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9d44e8,_0x8218a0,_0x1236a5){return new BPromise(function(_0x50a55b,_0x35f9b7){return client[_0x1998('0xa')](_0x9d44e8,_0x1236a5)['then'](function(_0x20c99e){logger['info'](_0x1998('0xb'),_0x8218a0,_0x1998('0xc'));logger['debug'](_0x1998('0xd'),_0x8218a0,'request\x20sent',JSON[_0x1998('0xe')](_0x20c99e));if(_0x20c99e[_0x1998('0xf')]){if(_0x20c99e[_0x1998('0xf')][_0x1998('0x10')]===0x1f4){logger[_0x1998('0xf')](_0x1998('0xb'),_0x8218a0,_0x20c99e[_0x1998('0xf')][_0x1998('0x11')]);return _0x35f9b7(_0x20c99e['error'][_0x1998('0x11')]);}logger['error'](_0x1998('0xb'),_0x8218a0,_0x20c99e[_0x1998('0xf')][_0x1998('0x11')]);return _0x50a55b(_0x20c99e[_0x1998('0xf')][_0x1998('0x11')]);}else{logger[_0x1998('0x12')](_0x1998('0xb'),_0x8218a0,_0x1998('0xc'));_0x50a55b(_0x20c99e[_0x1998('0x13')][_0x1998('0x11')]);}})[_0x1998('0x14')](function(_0x23a126){logger['error'](_0x1998('0xb'),_0x8218a0,_0x23a126);_0x35f9b7(_0x23a126);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index aacfbd0..cc3e6b7 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 _0x93e7=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/download','isAuthenticated','download','post','create','put','delete','destroy','exports','multer','path'];(function(_0x55ee1f,_0x540a70){var _0x24bedc=function(_0x4a6213){while(--_0x4a6213){_0x55ee1f['push'](_0x55ee1f['shift']());}};_0x24bedc(++_0x540a70);}(_0x93e7,0x9e));var _0x793e=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0x93e7[_0x5ecadc];return _0x565037;};'use strict';var multer=require(_0x793e('0x0'));var util=require('util');var path=require(_0x793e('0x1'));var timeout=require(_0x793e('0x2'));var express=require('express');var router=express[_0x793e('0x3')]();var auth=require(_0x793e('0x4'));var interaction=require(_0x793e('0x5'));var config=require(_0x793e('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0x793e('0x7')]('/',auth['isAuthenticated'](),controller[_0x793e('0x8')]);router['get'](_0x793e('0x9'),auth['isAuthenticated'](),controller[_0x793e('0xa')]);router[_0x793e('0x7')](_0x793e('0xb'),auth[_0x793e('0xc')](),controller[_0x793e('0xd')]);router[_0x793e('0xe')]('/',auth[_0x793e('0xc')](),controller[_0x793e('0xf')]);router[_0x793e('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x793e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x793e('0x12')]);module[_0x793e('0x13')]=router; \ No newline at end of file +var _0x80b8=['../../config/environment','./analyticExtractedReport.controller','isAuthenticated','get','/:id','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x80b8,0x175));var _0x880b=function(_0x18e8d2,_0x371fd0){_0x18e8d2=_0x18e8d2-0x0;var _0x2f2916=_0x80b8[_0x18e8d2];return _0x2f2916;};'use strict';var multer=require(_0x880b('0x0'));var util=require('util');var path=require(_0x880b('0x1'));var timeout=require(_0x880b('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x880b('0x3'));var interaction=require(_0x880b('0x4'));var config=require(_0x880b('0x5'));var controller=require(_0x880b('0x6'));router['get']('/',auth[_0x880b('0x7')](),controller['index']);router[_0x880b('0x8')](_0x880b('0x9'),auth[_0x880b('0x7')](),controller['show']);router[_0x880b('0x8')](_0x880b('0xa'),auth[_0x880b('0x7')](),controller[_0x880b('0xb')]);router[_0x880b('0xc')]('/',auth[_0x880b('0x7')](),controller[_0x880b('0xd')]);router[_0x880b('0xe')](_0x880b('0x9'),auth[_0x880b('0x7')](),controller[_0x880b('0xf')]);router['delete'](_0x880b('0x9'),auth[_0x880b('0x7')](),controller[_0x880b('0x10')]);module[_0x880b('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 48bf709..76ff2ea 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 _0x7217=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x23622b,_0x36b0fa){var _0x4d977f=function(_0x4ce9ee){while(--_0x4ce9ee){_0x23622b['push'](_0x23622b['shift']());}};_0x4d977f(++_0x36b0fa);}(_0x7217,0x19e));var _0x7721=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x7217[_0x45e98e];return _0x374dba;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'field':{'type':Sequelize[_0x7721('0x1')]},'alias':{'type':Sequelize[_0x7721('0x2')]},'function':{'type':Sequelize[_0x7721('0x2')]},'format':{'type':Sequelize[_0x7721('0x2')]},'groupBy':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x73f87f,_0x2eb5c5){var _0x11899b=function(_0x5b2560){while(--_0x5b2560){_0x73f87f['push'](_0x73f87f['shift']());}};_0x11899b(++_0x2eb5c5);}(_0x814b,0x1a2));var _0xb814=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0x814b[_0x16dbfd];return _0x382254;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'field':{'type':Sequelize[_0xb814('0x2')]},'alias':{'type':Sequelize[_0xb814('0x3')]},'function':{'type':Sequelize[_0xb814('0x3')]},'format':{'type':Sequelize[_0xb814('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb814('0x3')]},'custom':{'type':Sequelize[_0xb814('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 7810730..eea7c84 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 _0x1bde=['update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','options','include','findAll','show','length','includeAll','catch','create','body','bulkCreate','find','params','ids','AnalyticCustomReport','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x1bde,0xc4));var _0xe1bd=function(_0x32003d,_0x50ed19){_0x32003d=_0x32003d-0x0;var _0x4c09ee=_0x1bde[_0x32003d];return _0x4c09ee;};'use strict';var pdf=require(_0xe1bd('0x0'));var emlformat=require(_0xe1bd('0x1'));var rimraf=require(_0xe1bd('0x2'));var zipdir=require(_0xe1bd('0x3'));var jsonpatch=require(_0xe1bd('0x4'));var rp=require('request-promise');var moment=require(_0xe1bd('0x5'));var BPromise=require(_0xe1bd('0x6'));var Mustache=require(_0xe1bd('0x7'));var util=require(_0xe1bd('0x8'));var path=require('path');var sox=require(_0xe1bd('0x9'));var csv=require(_0xe1bd('0xa'));var ejs=require(_0xe1bd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe1bd('0xc'));var crypto=require('crypto');var jsforce=require(_0xe1bd('0xd'));var deskjs=require(_0xe1bd('0xe'));var toCsv=require(_0xe1bd('0xa'));var querystring=require(_0xe1bd('0xf'));var Papa=require(_0xe1bd('0x10'));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(_0xe1bd('0x11'));var logger=require(_0xe1bd('0x12'))(_0xe1bd('0x13'));var utils=require(_0xe1bd('0x14'));var config=require(_0xe1bd('0x15'));var licenseUtil=require(_0xe1bd('0x16'));var db=require(_0xe1bd('0x17'))['db'];function respondWithStatusCode(_0x17e745,_0x3588bb){_0x3588bb=_0x3588bb||0xcc;return function(_0xc6d47c){if(_0xc6d47c){return _0x17e745[_0xe1bd('0x18')](_0x3588bb);}return _0x17e745[_0xe1bd('0x19')](_0x3588bb)[_0xe1bd('0x1a')]();};}function respondWithResult(_0x1bd098,_0x57959e){_0x57959e=_0x57959e||0xc8;return function(_0x226d1b){if(_0x226d1b){return _0x1bd098['status'](_0x57959e)[_0xe1bd('0x1b')](_0x226d1b);}};}function respondWithFilteredResult(_0x4e4345,_0x5585d7){return function(_0x268a3d){if(_0x268a3d){var _0x3a2e65=_0x268a3d[_0xe1bd('0x1c')],_0x4d9e70=_0x5585d7[_0xe1bd('0x1d')],_0x403cc4=_0x5585d7[_0xe1bd('0x1d')]+_0x5585d7[_0xe1bd('0x1e')],_0x2a37b2;if(_0x403cc4>=_0x3a2e65){_0x403cc4=_0x3a2e65;_0x2a37b2=0xc8;}else{_0x2a37b2=0xce;}_0x4e4345[_0xe1bd('0x19')](_0x2a37b2);return _0x4e4345['set'](_0xe1bd('0x1f'),_0x4d9e70+'-'+_0x403cc4+'/'+_0x3a2e65)[_0xe1bd('0x1b')](_0x268a3d);}return null;};}function patchUpdates(_0xa38770){return function(_0x1cfe67){try{jsonpatch[_0xe1bd('0x20')](_0x1cfe67,_0xa38770,!![]);}catch(_0x157ea7){return BPromise[_0xe1bd('0x21')](_0x157ea7);}return _0x1cfe67[_0xe1bd('0x22')]();};}function saveUpdates(_0x35e520,_0x39b35f){return function(_0x3be5b9){if(_0x3be5b9){return _0x3be5b9[_0xe1bd('0x23')](_0x35e520)[_0xe1bd('0x24')](function(_0x1901c1){return _0x1901c1;});}return null;};}function removeEntity(_0xaa5dfa,_0x5a34c3){return function(_0x435980){if(_0x435980){return _0x435980[_0xe1bd('0x25')]()['then'](function(){_0xaa5dfa[_0xe1bd('0x19')](0xcc)[_0xe1bd('0x1a')]();});}};}function handleEntityNotFound(_0x3f9651,_0x39cccb){return function(_0x3dda79){if(!_0x3dda79){_0x3f9651[_0xe1bd('0x18')](0x194);}return _0x3dda79;};}function handleError(_0x39a211,_0x602736){_0x602736=_0x602736||0x1f4;return function(_0x5bdc70){logger[_0xe1bd('0x26')](_0x5bdc70[_0xe1bd('0x27')]);if(_0x5bdc70[_0xe1bd('0x28')]){delete _0x5bdc70[_0xe1bd('0x28')];}_0x39a211[_0xe1bd('0x19')](_0x602736)[_0xe1bd('0x29')](_0x5bdc70);};}exports[_0xe1bd('0x2a')]=function(_0x355d0d,_0x68ab31){var _0x4266de={},_0x4e0747={},_0x22ca30={'count':0x0,'rows':[]};var _0x434919=_[_0xe1bd('0x2b')](db[_0xe1bd('0x2c')][_0xe1bd('0x2d')],function(_0x1133b4){return{'name':_0x1133b4['fieldName'],'type':_0x1133b4[_0xe1bd('0x2e')][_0xe1bd('0x2f')]};});_0x4e0747[_0xe1bd('0x30')]=_[_0xe1bd('0x2b')](_0x434919,'name');_0x4e0747[_0xe1bd('0x31')]=_[_0xe1bd('0x32')](_0x355d0d[_0xe1bd('0x31')]);_0x4e0747[_0xe1bd('0x33')]=_[_0xe1bd('0x34')](_0x4e0747[_0xe1bd('0x30')],_0x4e0747[_0xe1bd('0x31')]);_0x4266de[_0xe1bd('0x35')]=_[_0xe1bd('0x34')](_0x4e0747[_0xe1bd('0x30')],qs['fields'](_0x355d0d['query'][_0xe1bd('0x36')]));_0x4266de['attributes']=_0x4266de[_0xe1bd('0x35')]['length']?_0x4266de[_0xe1bd('0x35')]:_0x4e0747[_0xe1bd('0x30')];if(!_0x355d0d['query'][_0xe1bd('0x37')](_0xe1bd('0x38'))){_0x4266de[_0xe1bd('0x1e')]=qs[_0xe1bd('0x1e')](_0x355d0d[_0xe1bd('0x31')][_0xe1bd('0x1e')]);_0x4266de[_0xe1bd('0x1d')]=qs[_0xe1bd('0x1d')](_0x355d0d[_0xe1bd('0x31')][_0xe1bd('0x1d')]);}_0x4266de[_0xe1bd('0x39')]=qs['sort'](_0x355d0d[_0xe1bd('0x31')]['sort']);_0x4266de['where']=qs[_0xe1bd('0x33')](_[_0xe1bd('0x3a')](_0x355d0d[_0xe1bd('0x31')],_0x4e0747[_0xe1bd('0x33')]),_0x434919);if(_0x355d0d[_0xe1bd('0x31')][_0xe1bd('0x3b')]){_0x4266de[_0xe1bd('0x3c')]=_[_0xe1bd('0x3d')](_0x4266de[_0xe1bd('0x3c')],{'$or':_[_0xe1bd('0x2b')](_0x434919,function(_0x1303d8){if(_0x1303d8[_0xe1bd('0x2e')]!=='VIRTUAL'){var _0x3ef58b={};_0x3ef58b[_0x1303d8[_0xe1bd('0x28')]]={'$like':'%'+_0x355d0d['query'][_0xe1bd('0x3b')]+'%'};return _0x3ef58b;}})});}_0x4266de=_[_0xe1bd('0x3d')]({},_0x4266de,_0x355d0d[_0xe1bd('0x3e')]);var _0x45c065={'where':_0x4266de[_0xe1bd('0x3c')]};return db[_0xe1bd('0x2c')][_0xe1bd('0x1c')](_0x45c065)[_0xe1bd('0x24')](function(_0x532b8d){_0x22ca30[_0xe1bd('0x1c')]=_0x532b8d;if(_0x355d0d[_0xe1bd('0x31')]['includeAll']){_0x4266de[_0xe1bd('0x3f')]=[{'all':!![]}];}return db[_0xe1bd('0x2c')][_0xe1bd('0x40')](_0x4266de);})['then'](function(_0x10e01e){_0x22ca30['rows']=_0x10e01e;return _0x22ca30;})[_0xe1bd('0x24')](respondWithFilteredResult(_0x68ab31,_0x4266de))['catch'](handleError(_0x68ab31,null));};exports[_0xe1bd('0x41')]=function(_0x5c501c,_0x3eba5e){var _0x4a6df1={'raw':![],'where':{'id':_0x5c501c['params']['id']}},_0x4bdfe1={};_0x4bdfe1[_0xe1bd('0x30')]=_[_0xe1bd('0x32')](db[_0xe1bd('0x2c')][_0xe1bd('0x2d')]);_0x4bdfe1['query']=_[_0xe1bd('0x32')](_0x5c501c['query']);_0x4bdfe1[_0xe1bd('0x33')]=_[_0xe1bd('0x34')](_0x4bdfe1['model'],_0x4bdfe1[_0xe1bd('0x31')]);_0x4a6df1['attributes']=_[_0xe1bd('0x34')](_0x4bdfe1[_0xe1bd('0x30')],qs[_0xe1bd('0x36')](_0x5c501c[_0xe1bd('0x31')]['fields']));_0x4a6df1[_0xe1bd('0x35')]=_0x4a6df1['attributes'][_0xe1bd('0x42')]?_0x4a6df1[_0xe1bd('0x35')]:_0x4bdfe1[_0xe1bd('0x30')];if(_0x5c501c[_0xe1bd('0x31')][_0xe1bd('0x43')]){_0x4a6df1[_0xe1bd('0x3f')]=[{'all':!![]}];}_0x4a6df1=_[_0xe1bd('0x3d')]({},_0x4a6df1,_0x5c501c['options']);return db['AnalyticFieldReport']['find'](_0x4a6df1)[_0xe1bd('0x24')](handleEntityNotFound(_0x3eba5e,null))[_0xe1bd('0x24')](respondWithResult(_0x3eba5e,null))[_0xe1bd('0x44')](handleError(_0x3eba5e,null));};exports['create']=function(_0x19bfe0,_0x2cb1d1){return db['AnalyticFieldReport'][_0xe1bd('0x45')](_0x19bfe0[_0xe1bd('0x46')],{})[_0xe1bd('0x24')](respondWithResult(_0x2cb1d1,0xc9))[_0xe1bd('0x44')](handleError(_0x2cb1d1,null));};exports[_0xe1bd('0x47')]=function(_0x4be840,_0x581984){return db[_0xe1bd('0x2c')]['bulkCreate'](_0x4be840[_0xe1bd('0x46')],{'raw':![],'individualHooks':!![]})[_0xe1bd('0x24')](respondWithResult(_0x581984,0xc9))['catch'](handleError(_0x581984,null));};exports['update']=function(_0x158477,_0x2adb60){if(_0x158477[_0xe1bd('0x46')]['id']){delete _0x158477[_0xe1bd('0x46')]['id'];}return db[_0xe1bd('0x2c')][_0xe1bd('0x48')]({'where':{'id':_0x158477[_0xe1bd('0x49')]['id']}})[_0xe1bd('0x24')](handleEntityNotFound(_0x2adb60,null))[_0xe1bd('0x24')](saveUpdates(_0x158477[_0xe1bd('0x46')],null))[_0xe1bd('0x24')](respondWithResult(_0x2adb60,null))[_0xe1bd('0x44')](handleError(_0x2adb60,null));};exports['destroy']=function(_0x4ae916,_0x518ee7){return db[_0xe1bd('0x2c')][_0xe1bd('0x48')]({'where':{'id':_0x4ae916[_0xe1bd('0x49')]['id']}})[_0xe1bd('0x24')](handleEntityNotFound(_0x518ee7,null))[_0xe1bd('0x24')](removeEntity(_0x518ee7,null))['catch'](handleError(_0x518ee7,null));};exports['bulkDestroy']=function(_0x3a3fbc,_0x540c34){return db['AnalyticFieldReport'][_0xe1bd('0x25')]({'where':{'id':_0x3a3fbc[_0xe1bd('0x31')][_0xe1bd('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xe1bd('0x24')](respondWithResult(_0x540c34,0xcc))[_0xe1bd('0x44')](handleError(_0x540c34,null));};exports['addFields']=function(_0x135675,_0x4f9b36,_0x313f21){return db[_0xe1bd('0x4b')][_0xe1bd('0x4c')]({'where':{'id':_0x135675[_0xe1bd('0x49')]['id']}})[_0xe1bd('0x24')](handleEntityNotFound(_0x4f9b36,null))[_0xe1bd('0x24')](function(_0x4340c7){if(_0x4340c7){return db['sequelize']['transaction'](function(_0x4ca6c4){return db['AnalyticFieldReport'][_0xe1bd('0x25')]({'where':{'CustomReportId':_0x135675[_0xe1bd('0x49')]['id']},'transaction':_0x4ca6c4})[_0xe1bd('0x24')](function(_0x4711bf){var _0x492cb5=_[_0xe1bd('0x2b')](_0x135675['body'],function(_0x48556c){delete _0x48556c['id'];_0x48556c['CustomReportId']=_0x135675[_0xe1bd('0x49')]['id'];return _0x48556c;});return db['AnalyticFieldReport'][_0xe1bd('0x47')](_0x492cb5,{'transaction':_0x4ca6c4});});})[_0xe1bd('0x24')](function(){return db[_0xe1bd('0x2c')]['findAll']({'where':{'CustomReportId':_0x135675[_0xe1bd('0x49')]['id']}});});}})[_0xe1bd('0x24')](respondWithResult(_0x4f9b36,null))['catch'](handleError(_0x4f9b36,null));}; \ No newline at end of file +var _0x88ba=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','save','update','then','destroy','sendStatus','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','params','length','find','create','body','catch','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce'];(function(_0x4a67c1,_0x5e5c3f){var _0x2052b8=function(_0x2c3dc8){while(--_0x2c3dc8){_0x4a67c1['push'](_0x4a67c1['shift']());}};_0x2052b8(++_0x5e5c3f);}(_0x88ba,0x90));var _0xa88b=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0x88ba[_0x22b39b];return _0x280e1d;};'use strict';var pdf=require(_0xa88b('0x0'));var emlformat=require(_0xa88b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa88b('0x2'));var rp=require(_0xa88b('0x3'));var moment=require(_0xa88b('0x4'));var BPromise=require(_0xa88b('0x5'));var Mustache=require(_0xa88b('0x6'));var util=require(_0xa88b('0x7'));var path=require(_0xa88b('0x8'));var sox=require(_0xa88b('0x9'));var csv=require(_0xa88b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa88b('0xb'));var crypto=require(_0xa88b('0xc'));var jsforce=require(_0xa88b('0xd'));var deskjs=require(_0xa88b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa88b('0xf'));var Papa=require(_0xa88b('0x10'));var Redis=require('ioredis');var authService=require(_0xa88b('0x11'));var qs=require(_0xa88b('0x12'));var as=require(_0xa88b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa88b('0x14'))(_0xa88b('0x15'));var utils=require('../../config/utils');var config=require(_0xa88b('0x16'));var licenseUtil=require(_0xa88b('0x17'));var db=require(_0xa88b('0x18'))['db'];function respondWithStatusCode(_0x396f58,_0xccbfb0){_0xccbfb0=_0xccbfb0||0xcc;return function(_0x1d815d){if(_0x1d815d){return _0x396f58['sendStatus'](_0xccbfb0);}return _0x396f58[_0xa88b('0x19')](_0xccbfb0)[_0xa88b('0x1a')]();};}function respondWithResult(_0x450da5,_0x4cd282){_0x4cd282=_0x4cd282||0xc8;return function(_0x526cca){if(_0x526cca){return _0x450da5['status'](_0x4cd282)[_0xa88b('0x1b')](_0x526cca);}};}function respondWithFilteredResult(_0x292f7b,_0x1af094){return function(_0x2a0b77){if(_0x2a0b77){var _0x2e4a3d=_0x2a0b77[_0xa88b('0x1c')],_0x164e2a=_0x1af094[_0xa88b('0x1d')],_0x3f0fef=_0x1af094[_0xa88b('0x1d')]+_0x1af094['limit'],_0x32b0a9;if(_0x3f0fef>=_0x2e4a3d){_0x3f0fef=_0x2e4a3d;_0x32b0a9=0xc8;}else{_0x32b0a9=0xce;}_0x292f7b['status'](_0x32b0a9);return _0x292f7b[_0xa88b('0x1e')](_0xa88b('0x1f'),_0x164e2a+'-'+_0x3f0fef+'/'+_0x2e4a3d)[_0xa88b('0x1b')](_0x2a0b77);}return null;};}function patchUpdates(_0x4874ea){return function(_0x169478){try{jsonpatch['apply'](_0x169478,_0x4874ea,!![]);}catch(_0x297468){return BPromise['reject'](_0x297468);}return _0x169478[_0xa88b('0x20')]();};}function saveUpdates(_0x25ea57,_0x30bfd3){return function(_0x5d9b26){if(_0x5d9b26){return _0x5d9b26[_0xa88b('0x21')](_0x25ea57)[_0xa88b('0x22')](function(_0x1a9911){return _0x1a9911;});}return null;};}function removeEntity(_0x2366d6,_0x1dba7e){return function(_0x1b259f){if(_0x1b259f){return _0x1b259f[_0xa88b('0x23')]()['then'](function(){_0x2366d6[_0xa88b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x545697,_0x45883c){return function(_0x140d1e){if(!_0x140d1e){_0x545697[_0xa88b('0x24')](0x194);}return _0x140d1e;};}function handleError(_0x20a865,_0x11c73b){_0x11c73b=_0x11c73b||0x1f4;return function(_0x246352){logger['error'](_0x246352[_0xa88b('0x25')]);if(_0x246352[_0xa88b('0x26')]){delete _0x246352[_0xa88b('0x26')];}_0x20a865['status'](_0x11c73b)[_0xa88b('0x27')](_0x246352);};}exports[_0xa88b('0x28')]=function(_0x3ceea3,_0x434f47){var _0x523309={},_0x33618b={},_0x3e87c3={'count':0x0,'rows':[]};var _0x1bd701=_[_0xa88b('0x29')](db[_0xa88b('0x2a')][_0xa88b('0x2b')],function(_0x1b3f7b){return{'name':_0x1b3f7b[_0xa88b('0x2c')],'type':_0x1b3f7b['type'][_0xa88b('0x2d')]};});_0x33618b[_0xa88b('0x2e')]=_[_0xa88b('0x29')](_0x1bd701,_0xa88b('0x26'));_0x33618b[_0xa88b('0x2f')]=_[_0xa88b('0x30')](_0x3ceea3['query']);_0x33618b['filters']=_['intersection'](_0x33618b['model'],_0x33618b[_0xa88b('0x2f')]);_0x523309[_0xa88b('0x31')]=_[_0xa88b('0x32')](_0x33618b[_0xa88b('0x2e')],qs[_0xa88b('0x33')](_0x3ceea3[_0xa88b('0x2f')][_0xa88b('0x33')]));_0x523309[_0xa88b('0x31')]=_0x523309[_0xa88b('0x31')]['length']?_0x523309[_0xa88b('0x31')]:_0x33618b['model'];if(!_0x3ceea3[_0xa88b('0x2f')]['hasOwnProperty'](_0xa88b('0x34'))){_0x523309[_0xa88b('0x35')]=qs[_0xa88b('0x35')](_0x3ceea3[_0xa88b('0x2f')]['limit']);_0x523309[_0xa88b('0x1d')]=qs[_0xa88b('0x1d')](_0x3ceea3[_0xa88b('0x2f')]['offset']);}_0x523309[_0xa88b('0x36')]=qs[_0xa88b('0x37')](_0x3ceea3[_0xa88b('0x2f')][_0xa88b('0x37')]);_0x523309[_0xa88b('0x38')]=qs['filters'](_[_0xa88b('0x39')](_0x3ceea3['query'],_0x33618b[_0xa88b('0x3a')]),_0x1bd701);if(_0x3ceea3[_0xa88b('0x2f')][_0xa88b('0x3b')]){_0x523309['where']=_[_0xa88b('0x3c')](_0x523309[_0xa88b('0x38')],{'$or':_[_0xa88b('0x29')](_0x1bd701,function(_0x1ced57){if(_0x1ced57['type']!=='VIRTUAL'){var _0x5a29df={};_0x5a29df[_0x1ced57['name']]={'$like':'%'+_0x3ceea3['query'][_0xa88b('0x3b')]+'%'};return _0x5a29df;}})});}_0x523309=_['merge']({},_0x523309,_0x3ceea3[_0xa88b('0x3d')]);var _0x44f73a={'where':_0x523309[_0xa88b('0x38')]};return db[_0xa88b('0x2a')][_0xa88b('0x1c')](_0x44f73a)[_0xa88b('0x22')](function(_0x3c7a62){_0x3e87c3[_0xa88b('0x1c')]=_0x3c7a62;if(_0x3ceea3[_0xa88b('0x2f')][_0xa88b('0x3e')]){_0x523309[_0xa88b('0x3f')]=[{'all':!![]}];}return db[_0xa88b('0x2a')][_0xa88b('0x40')](_0x523309);})[_0xa88b('0x22')](function(_0x336ae0){_0x3e87c3[_0xa88b('0x41')]=_0x336ae0;return _0x3e87c3;})[_0xa88b('0x22')](respondWithFilteredResult(_0x434f47,_0x523309))['catch'](handleError(_0x434f47,null));};exports['show']=function(_0x236c76,_0x55ddb8){var _0x107091={'raw':![],'where':{'id':_0x236c76[_0xa88b('0x42')]['id']}},_0x158ff2={};_0x158ff2[_0xa88b('0x2e')]=_[_0xa88b('0x30')](db[_0xa88b('0x2a')]['rawAttributes']);_0x158ff2['query']=_[_0xa88b('0x30')](_0x236c76[_0xa88b('0x2f')]);_0x158ff2['filters']=_[_0xa88b('0x32')](_0x158ff2['model'],_0x158ff2[_0xa88b('0x2f')]);_0x107091[_0xa88b('0x31')]=_['intersection'](_0x158ff2['model'],qs[_0xa88b('0x33')](_0x236c76[_0xa88b('0x2f')][_0xa88b('0x33')]));_0x107091[_0xa88b('0x31')]=_0x107091[_0xa88b('0x31')][_0xa88b('0x43')]?_0x107091[_0xa88b('0x31')]:_0x158ff2[_0xa88b('0x2e')];if(_0x236c76['query'][_0xa88b('0x3e')]){_0x107091[_0xa88b('0x3f')]=[{'all':!![]}];}_0x107091=_[_0xa88b('0x3c')]({},_0x107091,_0x236c76[_0xa88b('0x3d')]);return db[_0xa88b('0x2a')][_0xa88b('0x44')](_0x107091)[_0xa88b('0x22')](handleEntityNotFound(_0x55ddb8,null))[_0xa88b('0x22')](respondWithResult(_0x55ddb8,null))['catch'](handleError(_0x55ddb8,null));};exports[_0xa88b('0x45')]=function(_0x3be8c8,_0x4db579){return db[_0xa88b('0x2a')]['create'](_0x3be8c8['body'],{})['then'](respondWithResult(_0x4db579,0xc9))['catch'](handleError(_0x4db579,null));};exports['bulkCreate']=function(_0x243139,_0x58b4cf){return db[_0xa88b('0x2a')]['bulkCreate'](_0x243139[_0xa88b('0x46')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x58b4cf,0xc9))[_0xa88b('0x47')](handleError(_0x58b4cf,null));};exports[_0xa88b('0x21')]=function(_0x6649dd,_0x3d3cf2){if(_0x6649dd[_0xa88b('0x46')]['id']){delete _0x6649dd[_0xa88b('0x46')]['id'];}return db[_0xa88b('0x2a')][_0xa88b('0x44')]({'where':{'id':_0x6649dd[_0xa88b('0x42')]['id']}})[_0xa88b('0x22')](handleEntityNotFound(_0x3d3cf2,null))['then'](saveUpdates(_0x6649dd[_0xa88b('0x46')],null))[_0xa88b('0x22')](respondWithResult(_0x3d3cf2,null))[_0xa88b('0x47')](handleError(_0x3d3cf2,null));};exports[_0xa88b('0x23')]=function(_0x445007,_0x57f511){return db[_0xa88b('0x2a')][_0xa88b('0x44')]({'where':{'id':_0x445007[_0xa88b('0x42')]['id']}})['then'](handleEntityNotFound(_0x57f511,null))['then'](removeEntity(_0x57f511,null))[_0xa88b('0x47')](handleError(_0x57f511,null));};exports['bulkDestroy']=function(_0x48c464,_0x48ee26){return db[_0xa88b('0x2a')][_0xa88b('0x23')]({'where':{'id':_0x48c464[_0xa88b('0x2f')][_0xa88b('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0xa88b('0x22')](respondWithResult(_0x48ee26,0xcc))[_0xa88b('0x47')](handleError(_0x48ee26,null));};exports[_0xa88b('0x49')]=function(_0x1010dd,_0x3c89a1,_0x46cb39){return db[_0xa88b('0x4a')][_0xa88b('0x4b')]({'where':{'id':_0x1010dd['params']['id']}})[_0xa88b('0x22')](handleEntityNotFound(_0x3c89a1,null))[_0xa88b('0x22')](function(_0x1f15a7){if(_0x1f15a7){return db[_0xa88b('0x4c')][_0xa88b('0x4d')](function(_0xae1deb){return db[_0xa88b('0x2a')][_0xa88b('0x23')]({'where':{'CustomReportId':_0x1010dd[_0xa88b('0x42')]['id']},'transaction':_0xae1deb})[_0xa88b('0x22')](function(_0x57dd3c){var _0x3c9ab7=_[_0xa88b('0x29')](_0x1010dd[_0xa88b('0x46')],function(_0x1d11ac){delete _0x1d11ac['id'];_0x1d11ac[_0xa88b('0x4e')]=_0x1010dd['params']['id'];return _0x1d11ac;});return db[_0xa88b('0x2a')]['bulkCreate'](_0x3c9ab7,{'transaction':_0xae1deb});});})['then'](function(){return db[_0xa88b('0x2a')][_0xa88b('0x40')]({'where':{'CustomReportId':_0x1010dd[_0xa88b('0x42')]['id']}});});}})[_0xa88b('0x22')](respondWithResult(_0x3c89a1,null))[_0xa88b('0x47')](handleError(_0x3c89a1,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 640d39e..87c19eb 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 _0xd89c=['rimraf','../../config/environment','./analyticFieldReport.attributes','define','analytics_report_fields','lodash','util','api','bluebird','request-promise','path'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xd89c,0x1c8));var _0xcd89=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd89c[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xcd89('0x0'));var util=require(_0xcd89('0x1'));var logger=require('../../config/logger')(_0xcd89('0x2'));var moment=require('moment');var BPromise=require(_0xcd89('0x3'));var rp=require(_0xcd89('0x4'));var fs=require('fs');var path=require(_0xcd89('0x5'));var rimraf=require(_0xcd89('0x6'));var config=require(_0xcd89('0x7'));var attributes=require(_0xcd89('0x8'));module['exports']=function(_0x5354f4,_0x4c9c8c){return _0x5354f4[_0xcd89('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0xcd89('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d84=['analytics_report_fields','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x9d84,0xf3));var _0x49d8=function(_0x5c6e98,_0x445ff5){_0x5c6e98=_0x5c6e98-0x0;var _0x1702db=_0x9d84[_0x5c6e98];return _0x1702db;};'use strict';var _=require(_0x49d8('0x0'));var util=require(_0x49d8('0x1'));var logger=require(_0x49d8('0x2'))('api');var moment=require(_0x49d8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x49d8('0x4'));var rimraf=require(_0x49d8('0x5'));var config=require(_0x49d8('0x6'));var attributes=require(_0x49d8('0x7'));module['exports']=function(_0xa8c971,_0x3844a0){return _0xa8c971[_0x49d8('0x8')](_0x49d8('0x9'),attributes,{'tableName':_0x49d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 8b2a85e..2773878 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 _0xd112=['moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x1446fc,_0x13d287){var _0x184ce1=function(_0x607563){while(--_0x607563){_0x1446fc['push'](_0x1446fc['shift']());}};_0x184ce1(++_0x13d287);}(_0xd112,0x91));var _0x2d11=function(_0x26ce19,_0x56cb79){_0x26ce19=_0x26ce19-0x0;var _0x3b923e=_0xd112[_0x26ce19];return _0x3b923e;};'use strict';var _=require(_0x2d11('0x0'));var util=require(_0x2d11('0x1'));var moment=require(_0x2d11('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d11('0x3'));var db=require(_0x2d11('0x4'))['db'];var utils=require(_0x2d11('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2d11('0x6'));var jayson=require(_0x2d11('0x7'));var client=jayson['client'][_0x2d11('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18c69c,_0x3f53dc,_0x1208e4){return new BPromise(function(_0xa9b3dc,_0x52eb5f){return client[_0x2d11('0x9')](_0x18c69c,_0x1208e4)[_0x2d11('0xa')](function(_0x317803){logger[_0x2d11('0xb')](_0x2d11('0xc'),_0x3f53dc,_0x2d11('0xd'));logger[_0x2d11('0xe')](_0x2d11('0xf'),_0x3f53dc,_0x2d11('0xd'),JSON[_0x2d11('0x10')](_0x317803));if(_0x317803[_0x2d11('0x11')]){if(_0x317803[_0x2d11('0x11')][_0x2d11('0x12')]===0x1f4){logger[_0x2d11('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3f53dc,_0x317803[_0x2d11('0x11')][_0x2d11('0x13')]);return _0x52eb5f(_0x317803[_0x2d11('0x11')][_0x2d11('0x13')]);}logger['error'](_0x2d11('0xc'),_0x3f53dc,_0x317803[_0x2d11('0x11')]['message']);return _0xa9b3dc(_0x317803[_0x2d11('0x11')][_0x2d11('0x13')]);}else{logger[_0x2d11('0xb')](_0x2d11('0xc'),_0x3f53dc,'request\x20sent');_0xa9b3dc(_0x317803['result']['message']);}})[_0x2d11('0x14')](function(_0x7a7238){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x3f53dc,_0x7a7238);_0x52eb5f(_0x7a7238);});});} \ No newline at end of file +var _0x2709=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash'];(function(_0x1f65b6,_0x24394a){var _0x3d6de2=function(_0xcf5f1){while(--_0xcf5f1){_0x1f65b6['push'](_0x1f65b6['shift']());}};_0x3d6de2(++_0x24394a);}(_0x2709,0x6d));var _0x9270=function(_0x2b211e,_0x3eed60){_0x2b211e=_0x2b211e-0x0;var _0x4a7f71=_0x2709[_0x2b211e];return _0x4a7f71;};'use strict';var _=require(_0x9270('0x0'));var util=require(_0x9270('0x1'));var moment=require(_0x9270('0x2'));var BPromise=require(_0x9270('0x3'));var rs=require(_0x9270('0x4'));var fs=require('fs');var Redis=require(_0x9270('0x5'));var db=require(_0x9270('0x6'))['db'];var utils=require(_0x9270('0x7'));var logger=require(_0x9270('0x8'))('rpc');var config=require(_0x9270('0x9'));var jayson=require(_0x9270('0xa'));var client=jayson['client'][_0x9270('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38fa72,_0x1c0285,_0xc6c9d4){return new BPromise(function(_0x1ad81c,_0x25170e){return client['request'](_0x38fa72,_0xc6c9d4)[_0x9270('0xc')](function(_0xec64d0){logger[_0x9270('0xd')](_0x9270('0xe'),_0x1c0285,'request\x20sent');logger[_0x9270('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x1c0285,_0x9270('0x10'),JSON[_0x9270('0x11')](_0xec64d0));if(_0xec64d0['error']){if(_0xec64d0[_0x9270('0x12')][_0x9270('0x13')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x1c0285,_0xec64d0[_0x9270('0x12')]['message']);return _0x25170e(_0xec64d0['error']['message']);}logger[_0x9270('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1c0285,_0xec64d0[_0x9270('0x12')][_0x9270('0x14')]);return _0x1ad81c(_0xec64d0[_0x9270('0x12')][_0x9270('0x14')]);}else{logger[_0x9270('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1c0285,'request\x20sent');_0x1ad81c(_0xec64d0[_0x9270('0x15')][_0x9270('0x14')]);}})['catch'](function(_0x241bf7){logger[_0x9270('0x12')](_0x9270('0xe'),_0x1c0285,_0x241bf7);_0x25170e(_0x241bf7);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 03afa73..e896f82 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 _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(_0x531a94,_0xbf2864){var _0x4ad3e1=function(_0x5e98b4){while(--_0x5e98b4){_0x531a94['push'](_0x531a94['shift']());}};_0x4ad3e1(++_0xbf2864);}(_0x7217,0x19e));var _0x7721=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7217[_0x19e35c];return _0x3e1fe8;};'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 +var _0x3e74=['./analyticFieldReport.controller','get','isAuthenticated','index','show','post','create','/create_many','/:id/create_many','addFields','/:id','delete','/destroy_many','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x2b1cdd,_0x1c47ef){var _0xc554f2=function(_0x4ad4e8){while(--_0x4ad4e8){_0x2b1cdd['push'](_0x2b1cdd['shift']());}};_0xc554f2(++_0x1c47ef);}(_0x3e74,0x175));var _0x43e7=function(_0x139e5d,_0x289174){_0x139e5d=_0x139e5d-0x0;var _0x5b4860=_0x3e74[_0x139e5d];return _0x5b4860;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['post'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x43e7('0xa')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router['put'](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0x11'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x12')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x13')]);module[_0x43e7('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index c42e5a6..906ff0b 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 _0xc434=['STRING','name','TEXT','sequelize','exports'];(function(_0x45cb02,_0x1f26d4){var _0x333239=function(_0x41f9fa){while(--_0x41f9fa){_0x45cb02['push'](_0x45cb02['shift']());}};_0x333239(++_0x1f26d4);}(_0xc434,0x16b));var _0x4c43=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc434[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x4c43('0x0'));module[_0x4c43('0x1')]={'name':{'type':Sequelize[_0x4c43('0x2')],'allowNull':![],'unique':_0x4c43('0x3')},'table':{'type':Sequelize[_0x4c43('0x2')]},'metric':{'type':Sequelize[_0x4c43('0x4')]},'description':{'type':Sequelize[_0x4c43('0x2')]}}; \ No newline at end of file +var _0xc23d=['name','TEXT','sequelize','exports','STRING'];(function(_0x38be59,_0x146a3a){var _0x15ceb7=function(_0x737f31){while(--_0x737f31){_0x38be59['push'](_0x38be59['shift']());}};_0x15ceb7(++_0x146a3a);}(_0xc23d,0x7f));var _0xdc23=function(_0x564615,_0x51000c){_0x564615=_0x564615-0x0;var _0x3e5c3c=_0xc23d[_0x564615];return _0x3e5c3c;};'use strict';var Sequelize=require(_0xdc23('0x0'));module[_0xdc23('0x1')]={'name':{'type':Sequelize[_0xdc23('0x2')],'allowNull':![],'unique':_0xdc23('0x3')},'table':{'type':Sequelize[_0xdc23('0x2')]},'metric':{'type':Sequelize[_0xdc23('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index f30be4f..cd63d47 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 _0x2723=['apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticMetric','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x20ce85,_0x2c4499){var _0x2f174d=function(_0x595460){while(--_0x595460){_0x20ce85['push'](_0x20ce85['shift']());}};_0x2f174d(++_0x2c4499);}(_0x2723,0x18e));var _0x3272=function(_0x4e7971,_0x4e9656){_0x4e7971=_0x4e7971-0x0;var _0x54a675=_0x2723[_0x4e7971];return _0x54a675;};'use strict';var pdf=require(_0x3272('0x0'));var emlformat=require(_0x3272('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3272('0x2'));var jsonpatch=require(_0x3272('0x3'));var rp=require(_0x3272('0x4'));var moment=require(_0x3272('0x5'));var BPromise=require(_0x3272('0x6'));var Mustache=require(_0x3272('0x7'));var util=require(_0x3272('0x8'));var path=require(_0x3272('0x9'));var sox=require(_0x3272('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3272('0xb'));var squel=require(_0x3272('0xc'));var crypto=require(_0x3272('0xd'));var jsforce=require(_0x3272('0xe'));var deskjs=require(_0x3272('0xf'));var toCsv=require(_0x3272('0x10'));var querystring=require('querystring');var Papa=require(_0x3272('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3272('0x12'));var as=require(_0x3272('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3272('0x14'))(_0x3272('0x15'));var utils=require('../../config/utils');var config=require(_0x3272('0x16'));var licenseUtil=require(_0x3272('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x593ca0,_0x15c224){_0x15c224=_0x15c224||0xcc;return function(_0x496064){if(_0x496064){return _0x593ca0['sendStatus'](_0x15c224);}return _0x593ca0[_0x3272('0x18')](_0x15c224)[_0x3272('0x19')]();};}function respondWithResult(_0x25984b,_0x4b4537){_0x4b4537=_0x4b4537||0xc8;return function(_0x553cef){if(_0x553cef){return _0x25984b[_0x3272('0x18')](_0x4b4537)[_0x3272('0x1a')](_0x553cef);}};}function respondWithFilteredResult(_0x9b438,_0x38fef3){return function(_0x226b9f){if(_0x226b9f){var _0x3fd4e7=_0x226b9f[_0x3272('0x1b')],_0x534bfd=_0x38fef3['offset'],_0x56d03b=_0x38fef3[_0x3272('0x1c')]+_0x38fef3[_0x3272('0x1d')],_0xf44614;if(_0x56d03b>=_0x3fd4e7){_0x56d03b=_0x3fd4e7;_0xf44614=0xc8;}else{_0xf44614=0xce;}_0x9b438[_0x3272('0x18')](_0xf44614);return _0x9b438[_0x3272('0x1e')](_0x3272('0x1f'),_0x534bfd+'-'+_0x56d03b+'/'+_0x3fd4e7)[_0x3272('0x1a')](_0x226b9f);}return null;};}function patchUpdates(_0x191252){return function(_0x3222a9){try{jsonpatch[_0x3272('0x20')](_0x3222a9,_0x191252,!![]);}catch(_0x1392eb){return BPromise[_0x3272('0x21')](_0x1392eb);}return _0x3222a9[_0x3272('0x22')]();};}function saveUpdates(_0x2ee503,_0x170378){return function(_0x513c4d){if(_0x513c4d){return _0x513c4d[_0x3272('0x23')](_0x2ee503)[_0x3272('0x24')](function(_0x520ff0){return _0x520ff0;});}return null;};}function removeEntity(_0x532e89,_0x34d46f){return function(_0x3ed390){if(_0x3ed390){return _0x3ed390[_0x3272('0x25')]()[_0x3272('0x24')](function(){var _0x5a9aa0=_0x3ed390[_0x3272('0x26')]({'plain':!![]});var _0x17581a=_0x3272('0x27');return db[_0x3272('0x28')]['destroy']({'where':{'type':_0x17581a,'resourceId':_0x5a9aa0['id']}})[_0x3272('0x24')](function(){return _0x3ed390;});})['then'](function(){_0x532e89[_0x3272('0x18')](0xcc)[_0x3272('0x19')]();});}};}function handleEntityNotFound(_0x104184,_0x18ea1f){return function(_0x50c3d8){if(!_0x50c3d8){_0x104184[_0x3272('0x29')](0x194);}return _0x50c3d8;};}function handleError(_0x4b6cad,_0x2187a6){_0x2187a6=_0x2187a6||0x1f4;return function(_0x4b9b4b){logger[_0x3272('0x2a')](_0x4b9b4b[_0x3272('0x2b')]);if(_0x4b9b4b[_0x3272('0x2c')]){delete _0x4b9b4b[_0x3272('0x2c')];}_0x4b6cad[_0x3272('0x18')](_0x2187a6)[_0x3272('0x2d')](_0x4b9b4b);};}exports[_0x3272('0x2e')]=function(_0x3776eb,_0x47af9a){var _0x2fd0d2={},_0x2f2540={},_0x386370={'count':0x0,'rows':[]};var _0x2621d1=_[_0x3272('0x2f')](db['AnalyticMetric'][_0x3272('0x30')],function(_0x1d1ab3){return{'name':_0x1d1ab3[_0x3272('0x31')],'type':_0x1d1ab3[_0x3272('0x32')]['key']};});_0x2f2540['model']=_[_0x3272('0x2f')](_0x2621d1,_0x3272('0x2c'));_0x2f2540['query']=_[_0x3272('0x33')](_0x3776eb['query']);_0x2f2540[_0x3272('0x34')]=_[_0x3272('0x35')](_0x2f2540[_0x3272('0x36')],_0x2f2540[_0x3272('0x37')]);_0x2fd0d2[_0x3272('0x38')]=_[_0x3272('0x35')](_0x2f2540[_0x3272('0x36')],qs[_0x3272('0x39')](_0x3776eb[_0x3272('0x37')]['fields']));_0x2fd0d2['attributes']=_0x2fd0d2[_0x3272('0x38')][_0x3272('0x3a')]?_0x2fd0d2[_0x3272('0x38')]:_0x2f2540['model'];if(!_0x3776eb['query'][_0x3272('0x3b')](_0x3272('0x3c'))){_0x2fd0d2[_0x3272('0x1d')]=qs[_0x3272('0x1d')](_0x3776eb['query'][_0x3272('0x1d')]);_0x2fd0d2['offset']=qs[_0x3272('0x1c')](_0x3776eb['query'][_0x3272('0x1c')]);}_0x2fd0d2[_0x3272('0x3d')]=qs[_0x3272('0x3e')](_0x3776eb['query'][_0x3272('0x3e')]);_0x2fd0d2[_0x3272('0x3f')]=qs[_0x3272('0x34')](_[_0x3272('0x40')](_0x3776eb[_0x3272('0x37')],_0x2f2540[_0x3272('0x34')]),_0x2621d1);if(_0x3776eb[_0x3272('0x37')][_0x3272('0x41')]){_0x2fd0d2[_0x3272('0x3f')]=_[_0x3272('0x42')](_0x2fd0d2[_0x3272('0x3f')],{'$or':_[_0x3272('0x2f')](_0x2621d1,function(_0x5a2194){if(_0x5a2194[_0x3272('0x32')]!==_0x3272('0x43')){var _0x12657b={};_0x12657b[_0x5a2194[_0x3272('0x2c')]]={'$like':'%'+_0x3776eb[_0x3272('0x37')][_0x3272('0x41')]+'%'};return _0x12657b;}})});}_0x2fd0d2=_[_0x3272('0x42')]({},_0x2fd0d2,_0x3776eb[_0x3272('0x44')]);var _0x3f3fc4={'where':_0x2fd0d2[_0x3272('0x3f')]};return db[_0x3272('0x45')]['count'](_0x3f3fc4)[_0x3272('0x24')](function(_0x7abcb5){_0x386370[_0x3272('0x1b')]=_0x7abcb5;if(_0x3776eb[_0x3272('0x37')][_0x3272('0x46')]){_0x2fd0d2[_0x3272('0x47')]=[{'all':!![]}];}return db[_0x3272('0x45')][_0x3272('0x48')](_0x2fd0d2);})['then'](function(_0xe5c134){_0x386370[_0x3272('0x49')]=_0xe5c134;return _0x386370;})[_0x3272('0x24')](respondWithFilteredResult(_0x47af9a,_0x2fd0d2))['catch'](handleError(_0x47af9a,null));};exports[_0x3272('0x4a')]=function(_0x326a9c,_0x1f1864){var _0x10ce12={'raw':!![],'where':{'id':_0x326a9c[_0x3272('0x4b')]['id']}},_0x32f3de={};_0x32f3de[_0x3272('0x36')]=_[_0x3272('0x33')](db[_0x3272('0x45')]['rawAttributes']);_0x32f3de['query']=_[_0x3272('0x33')](_0x326a9c[_0x3272('0x37')]);_0x32f3de[_0x3272('0x34')]=_[_0x3272('0x35')](_0x32f3de[_0x3272('0x36')],_0x32f3de[_0x3272('0x37')]);_0x10ce12[_0x3272('0x38')]=_[_0x3272('0x35')](_0x32f3de[_0x3272('0x36')],qs[_0x3272('0x39')](_0x326a9c['query']['fields']));_0x10ce12[_0x3272('0x38')]=_0x10ce12[_0x3272('0x38')]['length']?_0x10ce12[_0x3272('0x38')]:_0x32f3de[_0x3272('0x36')];if(_0x326a9c[_0x3272('0x37')]['includeAll']){_0x10ce12['include']=[{'all':!![]}];}_0x10ce12=_['merge']({},_0x10ce12,_0x326a9c[_0x3272('0x44')]);return db[_0x3272('0x45')][_0x3272('0x4c')](_0x10ce12)[_0x3272('0x24')](handleEntityNotFound(_0x1f1864,null))[_0x3272('0x24')](respondWithResult(_0x1f1864,null))[_0x3272('0x4d')](handleError(_0x1f1864,null));};exports['create']=function(_0x53226b,_0x4224ed){return db[_0x3272('0x45')][_0x3272('0x4e')](_0x53226b[_0x3272('0x4f')],{})[_0x3272('0x24')](function(_0x470972){var _0xf5e8dd=_0x53226b[_0x3272('0x50')][_0x3272('0x26')]({'plain':!![]});if(!_0xf5e8dd)throw new Error(_0x3272('0x51'));if(_0xf5e8dd[_0x3272('0x52')]===_0x3272('0x50')){var _0x40c003=_0x470972['get']({'plain':!![]});var _0x87f91d=_0x3272('0x27');return db[_0x3272('0x53')][_0x3272('0x4c')]({'where':{'name':_0x87f91d,'userProfileId':_0xf5e8dd[_0x3272('0x54')]},'raw':!![]})[_0x3272('0x24')](function(_0x181e31){if(_0x181e31&&_0x181e31[_0x3272('0x55')]===0x0){return db['UserProfileResource'][_0x3272('0x4e')]({'name':_0x40c003[_0x3272('0x2c')],'resourceId':_0x40c003['id'],'type':_0x181e31[_0x3272('0x2c')],'sectionId':_0x181e31['id']},{})[_0x3272('0x24')](function(){return _0x470972;});}else{return _0x470972;}})[_0x3272('0x4d')](function(_0x11cd5b){logger[_0x3272('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11cd5b);throw _0x11cd5b;});}return _0x470972;})[_0x3272('0x24')](respondWithResult(_0x4224ed,0xc9))[_0x3272('0x4d')](handleError(_0x4224ed,null));};exports['update']=function(_0x32987a,_0x574500){if(_0x32987a['body']['id']){delete _0x32987a[_0x3272('0x4f')]['id'];}return db[_0x3272('0x45')][_0x3272('0x4c')]({'where':{'id':_0x32987a['params']['id']}})[_0x3272('0x24')](handleEntityNotFound(_0x574500,null))[_0x3272('0x24')](saveUpdates(_0x32987a['body'],null))[_0x3272('0x24')](respondWithResult(_0x574500,null))[_0x3272('0x4d')](handleError(_0x574500,null));};exports[_0x3272('0x25')]=function(_0x3df618,_0x3b35b8){return db[_0x3272('0x45')][_0x3272('0x4c')]({'where':{'id':_0x3df618[_0x3272('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3b35b8,null))[_0x3272('0x24')](removeEntity(_0x3b35b8,null))[_0x3272('0x4d')](handleError(_0x3b35b8,null));}; \ No newline at end of file +var _0xf40b=['UserProfileSection','find','userProfileId','error','body','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','update','destroy','then','get','Metrics','UserProfileResource','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0x288cf1,_0x3e1860){var _0x38c98b=function(_0x525eff){while(--_0x525eff){_0x288cf1['push'](_0x288cf1['shift']());}};_0x38c98b(++_0x3e1860);}(_0xf40b,0x190));var _0xbf40=function(_0x36f284,_0x24cbd1){_0x36f284=_0x36f284-0x0;var _0x4ea099=_0xf40b[_0x36f284];return _0x4ea099;};'use strict';var pdf=require(_0xbf40('0x0'));var emlformat=require(_0xbf40('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbf40('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf40('0x3'));var BPromise=require(_0xbf40('0x4'));var Mustache=require(_0xbf40('0x5'));var util=require('util');var path=require(_0xbf40('0x6'));var sox=require(_0xbf40('0x7'));var csv=require('to-csv');var ejs=require(_0xbf40('0x8'));var fs=require('fs');var _=require(_0xbf40('0x9'));var squel=require(_0xbf40('0xa'));var crypto=require(_0xbf40('0xb'));var jsforce=require(_0xbf40('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbf40('0xd'));var querystring=require(_0xbf40('0xe'));var Papa=require(_0xbf40('0xf'));var Redis=require(_0xbf40('0x10'));var authService=require(_0xbf40('0x11'));var qs=require(_0xbf40('0x12'));var as=require(_0xbf40('0x13'));var hardwareService=require(_0xbf40('0x14'));var logger=require('../../config/logger')(_0xbf40('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30c401,_0x244acb){_0x244acb=_0x244acb||0xcc;return function(_0x2d1af0){if(_0x2d1af0){return _0x30c401[_0xbf40('0x16')](_0x244acb);}return _0x30c401[_0xbf40('0x17')](_0x244acb)[_0xbf40('0x18')]();};}function respondWithResult(_0x258058,_0x5f39f0){_0x5f39f0=_0x5f39f0||0xc8;return function(_0x3501c4){if(_0x3501c4){return _0x258058[_0xbf40('0x17')](_0x5f39f0)['json'](_0x3501c4);}};}function respondWithFilteredResult(_0x36ebb5,_0x399128){return function(_0xfa5b23){if(_0xfa5b23){var _0x37bdd0=_0xfa5b23[_0xbf40('0x19')],_0x41a4d7=_0x399128['offset'],_0x4dee04=_0x399128[_0xbf40('0x1a')]+_0x399128[_0xbf40('0x1b')],_0x1eccc4;if(_0x4dee04>=_0x37bdd0){_0x4dee04=_0x37bdd0;_0x1eccc4=0xc8;}else{_0x1eccc4=0xce;}_0x36ebb5['status'](_0x1eccc4);return _0x36ebb5['set'](_0xbf40('0x1c'),_0x41a4d7+'-'+_0x4dee04+'/'+_0x37bdd0)[_0xbf40('0x1d')](_0xfa5b23);}return null;};}function patchUpdates(_0x5ab6c0){return function(_0x4ba828){try{jsonpatch[_0xbf40('0x1e')](_0x4ba828,_0x5ab6c0,!![]);}catch(_0x3133c8){return BPromise['reject'](_0x3133c8);}return _0x4ba828['save']();};}function saveUpdates(_0x24797f,_0x4b4c16){return function(_0x4db60e){if(_0x4db60e){return _0x4db60e[_0xbf40('0x1f')](_0x24797f)['then'](function(_0x5d92bb){return _0x5d92bb;});}return null;};}function removeEntity(_0x8a352a,_0x176bce){return function(_0x2974f2){if(_0x2974f2){return _0x2974f2[_0xbf40('0x20')]()[_0xbf40('0x21')](function(){var _0x6f2dc8=_0x2974f2[_0xbf40('0x22')]({'plain':!![]});var _0x36b240=_0xbf40('0x23');return db[_0xbf40('0x24')]['destroy']({'where':{'type':_0x36b240,'resourceId':_0x6f2dc8['id']}})[_0xbf40('0x21')](function(){return _0x2974f2;});})[_0xbf40('0x21')](function(){_0x8a352a[_0xbf40('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x436b35,_0x1a6a83){return function(_0x8f9d28){if(!_0x8f9d28){_0x436b35[_0xbf40('0x16')](0x194);}return _0x8f9d28;};}function handleError(_0x41f137,_0x16296f){_0x16296f=_0x16296f||0x1f4;return function(_0xde6ff5){logger['error'](_0xde6ff5[_0xbf40('0x25')]);if(_0xde6ff5[_0xbf40('0x26')]){delete _0xde6ff5[_0xbf40('0x26')];}_0x41f137['status'](_0x16296f)['send'](_0xde6ff5);};}exports[_0xbf40('0x27')]=function(_0x5894d3,_0x55a733){var _0x40b812={},_0x42f845={},_0x68858b={'count':0x0,'rows':[]};var _0xd2ae66=_[_0xbf40('0x28')](db[_0xbf40('0x29')][_0xbf40('0x2a')],function(_0x319152){return{'name':_0x319152[_0xbf40('0x2b')],'type':_0x319152[_0xbf40('0x2c')][_0xbf40('0x2d')]};});_0x42f845[_0xbf40('0x2e')]=_[_0xbf40('0x28')](_0xd2ae66,_0xbf40('0x26'));_0x42f845['query']=_['keys'](_0x5894d3[_0xbf40('0x2f')]);_0x42f845['filters']=_['intersection'](_0x42f845[_0xbf40('0x2e')],_0x42f845['query']);_0x40b812[_0xbf40('0x30')]=_[_0xbf40('0x31')](_0x42f845[_0xbf40('0x2e')],qs[_0xbf40('0x32')](_0x5894d3[_0xbf40('0x2f')]['fields']));_0x40b812[_0xbf40('0x30')]=_0x40b812['attributes']['length']?_0x40b812[_0xbf40('0x30')]:_0x42f845[_0xbf40('0x2e')];if(!_0x5894d3[_0xbf40('0x2f')][_0xbf40('0x33')](_0xbf40('0x34'))){_0x40b812[_0xbf40('0x1b')]=qs['limit'](_0x5894d3['query'][_0xbf40('0x1b')]);_0x40b812[_0xbf40('0x1a')]=qs[_0xbf40('0x1a')](_0x5894d3[_0xbf40('0x2f')][_0xbf40('0x1a')]);}_0x40b812[_0xbf40('0x35')]=qs['sort'](_0x5894d3['query'][_0xbf40('0x36')]);_0x40b812[_0xbf40('0x37')]=qs[_0xbf40('0x38')](_[_0xbf40('0x39')](_0x5894d3['query'],_0x42f845[_0xbf40('0x38')]),_0xd2ae66);if(_0x5894d3[_0xbf40('0x2f')][_0xbf40('0x3a')]){_0x40b812[_0xbf40('0x37')]=_[_0xbf40('0x3b')](_0x40b812[_0xbf40('0x37')],{'$or':_[_0xbf40('0x28')](_0xd2ae66,function(_0x21bc28){if(_0x21bc28['type']!=='VIRTUAL'){var _0x3ea5b3={};_0x3ea5b3[_0x21bc28[_0xbf40('0x26')]]={'$like':'%'+_0x5894d3['query'][_0xbf40('0x3a')]+'%'};return _0x3ea5b3;}})});}_0x40b812=_[_0xbf40('0x3b')]({},_0x40b812,_0x5894d3[_0xbf40('0x3c')]);var _0x1821a3={'where':_0x40b812[_0xbf40('0x37')]};return db['AnalyticMetric'][_0xbf40('0x19')](_0x1821a3)['then'](function(_0x1177a6){_0x68858b['count']=_0x1177a6;if(_0x5894d3[_0xbf40('0x2f')][_0xbf40('0x3d')]){_0x40b812[_0xbf40('0x3e')]=[{'all':!![]}];}return db['AnalyticMetric'][_0xbf40('0x3f')](_0x40b812);})[_0xbf40('0x21')](function(_0x4740e4){_0x68858b[_0xbf40('0x40')]=_0x4740e4;return _0x68858b;})[_0xbf40('0x21')](respondWithFilteredResult(_0x55a733,_0x40b812))[_0xbf40('0x41')](handleError(_0x55a733,null));};exports[_0xbf40('0x42')]=function(_0xf5a77f,_0x23d2f1){var _0x4b7f52={'raw':!![],'where':{'id':_0xf5a77f[_0xbf40('0x43')]['id']}},_0x39e513={};_0x39e513[_0xbf40('0x2e')]=_[_0xbf40('0x44')](db['AnalyticMetric'][_0xbf40('0x2a')]);_0x39e513[_0xbf40('0x2f')]=_[_0xbf40('0x44')](_0xf5a77f[_0xbf40('0x2f')]);_0x39e513[_0xbf40('0x38')]=_[_0xbf40('0x31')](_0x39e513[_0xbf40('0x2e')],_0x39e513[_0xbf40('0x2f')]);_0x4b7f52[_0xbf40('0x30')]=_[_0xbf40('0x31')](_0x39e513[_0xbf40('0x2e')],qs[_0xbf40('0x32')](_0xf5a77f[_0xbf40('0x2f')][_0xbf40('0x32')]));_0x4b7f52[_0xbf40('0x30')]=_0x4b7f52[_0xbf40('0x30')][_0xbf40('0x45')]?_0x4b7f52['attributes']:_0x39e513['model'];if(_0xf5a77f['query'][_0xbf40('0x3d')]){_0x4b7f52['include']=[{'all':!![]}];}_0x4b7f52=_[_0xbf40('0x3b')]({},_0x4b7f52,_0xf5a77f['options']);return db[_0xbf40('0x29')]['find'](_0x4b7f52)['then'](handleEntityNotFound(_0x23d2f1,null))[_0xbf40('0x21')](respondWithResult(_0x23d2f1,null))['catch'](handleError(_0x23d2f1,null));};exports[_0xbf40('0x46')]=function(_0x295d34,_0x5dcf55){return db[_0xbf40('0x29')]['create'](_0x295d34['body'],{})[_0xbf40('0x21')](function(_0x599c7a){var _0xfad827=_0x295d34['user']['get']({'plain':!![]});if(!_0xfad827)throw new Error(_0xbf40('0x47'));if(_0xfad827[_0xbf40('0x48')]===_0xbf40('0x49')){var _0x199a43=_0x599c7a[_0xbf40('0x22')]({'plain':!![]});var _0x1bba18=_0xbf40('0x23');return db[_0xbf40('0x4a')][_0xbf40('0x4b')]({'where':{'name':_0x1bba18,'userProfileId':_0xfad827[_0xbf40('0x4c')]},'raw':!![]})[_0xbf40('0x21')](function(_0xf8be3f){if(_0xf8be3f&&_0xf8be3f['autoAssociation']===0x0){return db[_0xbf40('0x24')]['create']({'name':_0x199a43[_0xbf40('0x26')],'resourceId':_0x199a43['id'],'type':_0xf8be3f['name'],'sectionId':_0xf8be3f['id']},{})[_0xbf40('0x21')](function(){return _0x599c7a;});}else{return _0x599c7a;}})[_0xbf40('0x41')](function(_0x2e5168){logger[_0xbf40('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e5168);throw _0x2e5168;});}return _0x599c7a;})[_0xbf40('0x21')](respondWithResult(_0x5dcf55,0xc9))['catch'](handleError(_0x5dcf55,null));};exports['update']=function(_0x3c7cfe,_0x307f9c){if(_0x3c7cfe['body']['id']){delete _0x3c7cfe[_0xbf40('0x4e')]['id'];}return db['AnalyticMetric'][_0xbf40('0x4b')]({'where':{'id':_0x3c7cfe[_0xbf40('0x43')]['id']}})['then'](handleEntityNotFound(_0x307f9c,null))['then'](saveUpdates(_0x3c7cfe['body'],null))[_0xbf40('0x21')](respondWithResult(_0x307f9c,null))[_0xbf40('0x41')](handleError(_0x307f9c,null));};exports[_0xbf40('0x20')]=function(_0x2909a0,_0x12c213){return db['AnalyticMetric'][_0xbf40('0x4b')]({'where':{'id':_0x2909a0['params']['id']}})[_0xbf40('0x21')](handleEntityNotFound(_0x12c213,null))['then'](removeEntity(_0x12c213,null))[_0xbf40('0x41')](handleError(_0x12c213,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 31953ce..384b4fd 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 _0x0211=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x0211,0xa5));var _0x1021=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x0211[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x1021('0x0'));var util=require(_0x1021('0x1'));var logger=require('../../config/logger')(_0x1021('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1021('0x3'));var fs=require('fs');var path=require(_0x1021('0x4'));var rimraf=require(_0x1021('0x5'));var config=require(_0x1021('0x6'));var attributes=require(_0x1021('0x7'));module[_0x1021('0x8')]=function(_0x221dc6,_0x4e08ca){return _0x221dc6['define'](_0x1021('0x9'),attributes,{'tableName':_0x1021('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf342=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','request-promise','../../config/environment'];(function(_0xc12271,_0xc84412){var _0x224219=function(_0x4e90dc){while(--_0x4e90dc){_0xc12271['push'](_0xc12271['shift']());}};_0x224219(++_0xc84412);}(_0xf342,0xd6));var _0x2f34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf342[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2f34('0x0'));var util=require(_0x2f34('0x1'));var logger=require(_0x2f34('0x2'))(_0x2f34('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f34('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2f34('0x5'));var attributes=require(_0x2f34('0x6'));module[_0x2f34('0x7')]=function(_0x344eb2,_0x171991){return _0x344eb2[_0x2f34('0x8')](_0x2f34('0x9'),attributes,{'tableName':_0x2f34('0xa'),'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 45bf999..fb014aa 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 _0x6f91=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird'];(function(_0x686273,_0x456bed){var _0x34b0a6=function(_0x458a06){while(--_0x458a06){_0x686273['push'](_0x686273['shift']());}};_0x34b0a6(++_0x456bed);}(_0x6f91,0xac));var _0x16f9=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0x6f91[_0x44a3b0];return _0x39e6f6;};'use strict';var _=require(_0x16f9('0x0'));var util=require(_0x16f9('0x1'));var moment=require(_0x16f9('0x2'));var BPromise=require(_0x16f9('0x3'));var rs=require(_0x16f9('0x4'));var fs=require('fs');var Redis=require(_0x16f9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x16f9('0x6'))(_0x16f9('0x7'));var config=require(_0x16f9('0x8'));var jayson=require(_0x16f9('0x9'));var client=jayson['client'][_0x16f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15ee4e,_0x4ddd49,_0x28207a){return new BPromise(function(_0x23935c,_0x4f33ca){return client[_0x16f9('0xb')](_0x15ee4e,_0x28207a)[_0x16f9('0xc')](function(_0x449d76){logger[_0x16f9('0xd')](_0x16f9('0xe'),_0x4ddd49,'request\x20sent');logger[_0x16f9('0xf')](_0x16f9('0x10'),_0x4ddd49,_0x16f9('0x11'),JSON[_0x16f9('0x12')](_0x449d76));if(_0x449d76['error']){if(_0x449d76[_0x16f9('0x13')][_0x16f9('0x14')]===0x1f4){logger[_0x16f9('0x13')](_0x16f9('0xe'),_0x4ddd49,_0x449d76['error']['message']);return _0x4f33ca(_0x449d76[_0x16f9('0x13')]['message']);}logger['error'](_0x16f9('0xe'),_0x4ddd49,_0x449d76['error'][_0x16f9('0x15')]);return _0x23935c(_0x449d76['error']['message']);}else{logger[_0x16f9('0xd')](_0x16f9('0xe'),_0x4ddd49,_0x16f9('0x11'));_0x23935c(_0x449d76['result'][_0x16f9('0x15')]);}})['catch'](function(_0x260252){logger[_0x16f9('0x13')](_0x16f9('0xe'),_0x4ddd49,_0x260252);_0x4f33ca(_0x260252);});});} \ No newline at end of file +var _0x3d42=['result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x16093a,_0x395fdc){var _0x1abc0d=function(_0x512ae7){while(--_0x512ae7){_0x16093a['push'](_0x16093a['shift']());}};_0x1abc0d(++_0x395fdc);}(_0x3d42,0x16b));var _0x23d4=function(_0x551e56,_0x2b118c){_0x551e56=_0x551e56-0x0;var _0x31876e=_0x3d42[_0x551e56];return _0x31876e;};'use strict';var _=require(_0x23d4('0x0'));var util=require(_0x23d4('0x1'));var moment=require('moment');var BPromise=require(_0x23d4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x23d4('0x3'));var logger=require(_0x23d4('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x23d4('0x5'));var client=jayson[_0x23d4('0x6')][_0x23d4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x154ba6,_0x33b3ca,_0x24d396){return new BPromise(function(_0x5d9238,_0x3826fe){return client['request'](_0x154ba6,_0x24d396)[_0x23d4('0x8')](function(_0x441b4f){logger[_0x23d4('0x9')](_0x23d4('0xa'),_0x33b3ca,_0x23d4('0xb'));logger[_0x23d4('0xc')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x33b3ca,_0x23d4('0xb'),JSON[_0x23d4('0xd')](_0x441b4f));if(_0x441b4f['error']){if(_0x441b4f[_0x23d4('0xe')][_0x23d4('0xf')]===0x1f4){logger[_0x23d4('0xe')](_0x23d4('0xa'),_0x33b3ca,_0x441b4f[_0x23d4('0xe')]['message']);return _0x3826fe(_0x441b4f[_0x23d4('0xe')][_0x23d4('0x10')]);}logger[_0x23d4('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x33b3ca,_0x441b4f[_0x23d4('0xe')][_0x23d4('0x10')]);return _0x5d9238(_0x441b4f['error'][_0x23d4('0x10')]);}else{logger[_0x23d4('0x9')](_0x23d4('0xa'),_0x33b3ca,_0x23d4('0xb'));_0x5d9238(_0x441b4f[_0x23d4('0x11')][_0x23d4('0x10')]);}})[_0x23d4('0x12')](function(_0x30d2c2){logger['error'](_0x23d4('0xa'),_0x33b3ca,_0x30d2c2);_0x3826fe(_0x30d2c2);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 5724014..3a1acef 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 _0xda19=['post','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show'];(function(_0x214db9,_0x203265){var _0x59601c=function(_0x586bf5){while(--_0x586bf5){_0x214db9['push'](_0x214db9['shift']());}};_0x59601c(++_0x203265);}(_0xda19,0xd5));var _0x9da1=function(_0x485f66,_0x17840c){_0x485f66=_0x485f66-0x0;var _0x1ba707=_0xda19[_0x485f66];return _0x1ba707;};'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('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9da1('0x9'),auth['isAuthenticated'](),controller[_0x9da1('0xc')]);router[_0x9da1('0xd')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xe')]);module[_0x9da1('0xf')]=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(_0x51f0b5,_0x5293cb){var _0xc33589=function(_0x17b653){while(--_0x17b653){_0x51f0b5['push'](_0x51f0b5['shift']());}};_0xc33589(++_0x5293cb);}(_0x524e,0x15e));var _0xe524=function(_0x2189e7,_0x5a55fe){_0x2189e7=_0x2189e7-0x0;var _0x574ff2=_0x524e[_0x2189e7];return _0x574ff2;};'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 643c362..3414f98 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 _0x1bbf=['TEXT','sequelize','exports'];(function(_0x32db0f,_0x4e61f1){var _0x582328=function(_0x44bb85){while(--_0x44bb85){_0x32db0f['push'](_0x32db0f['shift']());}};_0x582328(++_0x4e61f1);}(_0x1bbf,0x1ed));var _0xf1bb=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x1bbf[_0x1589dd];return _0x1bddd1;};'use strict';var Sequelize=require(_0xf1bb('0x0'));module[_0xf1bb('0x1')]={'tree':{'type':Sequelize[_0xf1bb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xbc6c=['sequelize','exports','TEXT'];(function(_0x4f1e1e,_0x118076){var _0x5acac8=function(_0x4727f6){while(--_0x4727f6){_0x4f1e1e['push'](_0x4f1e1e['shift']());}};_0x5acac8(++_0x118076);}(_0xbc6c,0x17d));var _0xcbc6=function(_0xca663c,_0xb4dd19){_0xca663c=_0xca663c-0x0;var _0x2563ee=_0xbc6c[_0xca663c];return _0x2563ee;};'use strict';var Sequelize=require(_0xcbc6('0x0'));module[_0xcbc6('0x1')]={'tree':{'type':Sequelize[_0xcbc6('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 4889216..1b66d1c 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 _0x28ce=['order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','limit','status','set','Content-Range','reject','update','then','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x46b0e4,_0x2abe87){var _0x574ac0=function(_0x3e4f6c){while(--_0x3e4f6c){_0x46b0e4['push'](_0x46b0e4['shift']());}};_0x574ac0(++_0x2abe87);}(_0x28ce,0xa6));var _0xe28c=function(_0x235680,_0x2ef5f1){_0x235680=_0x235680-0x0;var _0x252f7e=_0x28ce[_0x235680];return _0x252f7e;};'use strict';var pdf=require(_0xe28c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe28c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe28c('0x2'));var rp=require(_0xe28c('0x3'));var moment=require(_0xe28c('0x4'));var BPromise=require(_0xe28c('0x5'));var Mustache=require(_0xe28c('0x6'));var util=require(_0xe28c('0x7'));var path=require(_0xe28c('0x8'));var sox=require(_0xe28c('0x9'));var csv=require(_0xe28c('0xa'));var ejs=require(_0xe28c('0xb'));var fs=require('fs');var _=require(_0xe28c('0xc'));var squel=require(_0xe28c('0xd'));var crypto=require(_0xe28c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe28c('0xf'));var toCsv=require(_0xe28c('0xa'));var querystring=require('querystring');var Papa=require(_0xe28c('0x10'));var Redis=require(_0xe28c('0x11'));var authService=require(_0xe28c('0x12'));var qs=require(_0xe28c('0x13'));var as=require(_0xe28c('0x14'));var hardwareService=require(_0xe28c('0x15'));var logger=require('../../config/logger')(_0xe28c('0x16'));var utils=require(_0xe28c('0x17'));var config=require(_0xe28c('0x18'));var licenseUtil=require(_0xe28c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfdaedc,_0x4bbaaa){_0x4bbaaa=_0x4bbaaa||0xcc;return function(_0x38977b){if(_0x38977b){return _0xfdaedc[_0xe28c('0x1a')](_0x4bbaaa);}return _0xfdaedc['status'](_0x4bbaaa)[_0xe28c('0x1b')]();};}function respondWithResult(_0x42fdb7,_0x350e6d){_0x350e6d=_0x350e6d||0xc8;return function(_0x28aa38){if(_0x28aa38){return _0x42fdb7['status'](_0x350e6d)[_0xe28c('0x1c')](_0x28aa38);}};}function respondWithFilteredResult(_0x5a1314,_0x10f357){return function(_0x2d1dd2){if(_0x2d1dd2){var _0x509045=_0x2d1dd2[_0xe28c('0x1d')],_0x40ebdf=_0x10f357[_0xe28c('0x1e')],_0x1a0d40=_0x10f357[_0xe28c('0x1e')]+_0x10f357[_0xe28c('0x1f')],_0x16e6aa;if(_0x1a0d40>=_0x509045){_0x1a0d40=_0x509045;_0x16e6aa=0xc8;}else{_0x16e6aa=0xce;}_0x5a1314[_0xe28c('0x20')](_0x16e6aa);return _0x5a1314[_0xe28c('0x21')](_0xe28c('0x22'),_0x40ebdf+'-'+_0x1a0d40+'/'+_0x509045)[_0xe28c('0x1c')](_0x2d1dd2);}return null;};}function patchUpdates(_0x3691c7){return function(_0x2e7f1e){try{jsonpatch['apply'](_0x2e7f1e,_0x3691c7,!![]);}catch(_0x222a70){return BPromise[_0xe28c('0x23')](_0x222a70);}return _0x2e7f1e['save']();};}function saveUpdates(_0x3c57a1,_0x3d6a1d){return function(_0x2aa243){if(_0x2aa243){return _0x2aa243[_0xe28c('0x24')](_0x3c57a1)['then'](function(_0x728eed){return _0x728eed;});}return null;};}function removeEntity(_0x59ba0c,_0xe9f9d1){return function(_0x43fbc8){if(_0x43fbc8){return _0x43fbc8['destroy']()[_0xe28c('0x25')](function(){_0x59ba0c['status'](0xcc)[_0xe28c('0x1b')]();});}};}function handleEntityNotFound(_0x4b2b51,_0x3b7419){return function(_0x1957cf){if(!_0x1957cf){_0x4b2b51[_0xe28c('0x1a')](0x194);}return _0x1957cf;};}function handleError(_0x41aa95,_0x1f5827){_0x1f5827=_0x1f5827||0x1f4;return function(_0x589f09){logger[_0xe28c('0x26')](_0x589f09[_0xe28c('0x27')]);if(_0x589f09[_0xe28c('0x28')]){delete _0x589f09['name'];}_0x41aa95['status'](_0x1f5827)[_0xe28c('0x29')](_0x589f09);};}exports['index']=function(_0x5729cd,_0x47a741){var _0x71dd2d={},_0x3d6cd5={},_0x5acd82={'count':0x0,'rows':[]};var _0x3e0194=_[_0xe28c('0x2a')](db[_0xe28c('0x2b')][_0xe28c('0x2c')],function(_0x48cc04){return{'name':_0x48cc04[_0xe28c('0x2d')],'type':_0x48cc04['type']['key']};});_0x3d6cd5[_0xe28c('0x2e')]=_['map'](_0x3e0194,_0xe28c('0x28'));_0x3d6cd5['query']=_[_0xe28c('0x2f')](_0x5729cd['query']);_0x3d6cd5[_0xe28c('0x30')]=_[_0xe28c('0x31')](_0x3d6cd5[_0xe28c('0x2e')],_0x3d6cd5[_0xe28c('0x32')]);_0x71dd2d['attributes']=_['intersection'](_0x3d6cd5['model'],qs[_0xe28c('0x33')](_0x5729cd[_0xe28c('0x32')][_0xe28c('0x33')]));_0x71dd2d[_0xe28c('0x34')]=_0x71dd2d['attributes'][_0xe28c('0x35')]?_0x71dd2d[_0xe28c('0x34')]:_0x3d6cd5[_0xe28c('0x2e')];if(!_0x5729cd[_0xe28c('0x32')][_0xe28c('0x36')](_0xe28c('0x37'))){_0x71dd2d[_0xe28c('0x1f')]=qs[_0xe28c('0x1f')](_0x5729cd[_0xe28c('0x32')]['limit']);_0x71dd2d['offset']=qs[_0xe28c('0x1e')](_0x5729cd[_0xe28c('0x32')][_0xe28c('0x1e')]);}_0x71dd2d[_0xe28c('0x38')]=qs[_0xe28c('0x39')](_0x5729cd[_0xe28c('0x32')][_0xe28c('0x39')]);_0x71dd2d[_0xe28c('0x3a')]=qs[_0xe28c('0x30')](_[_0xe28c('0x3b')](_0x5729cd[_0xe28c('0x32')],_0x3d6cd5['filters']),_0x3e0194);if(_0x5729cd['query'][_0xe28c('0x3c')]){_0x71dd2d[_0xe28c('0x3a')]=_[_0xe28c('0x3d')](_0x71dd2d['where'],{'$or':_['map'](_0x3e0194,function(_0x2c3987){if(_0x2c3987[_0xe28c('0x3e')]!=='VIRTUAL'){var _0x3aa093={};_0x3aa093[_0x2c3987[_0xe28c('0x28')]]={'$like':'%'+_0x5729cd['query'][_0xe28c('0x3c')]+'%'};return _0x3aa093;}})});}_0x71dd2d=_['merge']({},_0x71dd2d,_0x5729cd[_0xe28c('0x3f')]);var _0x14cec6={'where':_0x71dd2d['where']};return db['AnalyticTreeReport'][_0xe28c('0x1d')](_0x14cec6)['then'](function(_0x400758){_0x5acd82['count']=_0x400758;if(_0x5729cd[_0xe28c('0x32')][_0xe28c('0x40')]){_0x71dd2d[_0xe28c('0x41')]=[{'all':!![]}];}return db[_0xe28c('0x2b')][_0xe28c('0x42')](_0x71dd2d);})[_0xe28c('0x25')](function(_0x55156d){_0x5acd82[_0xe28c('0x43')]=_0x55156d;return _0x5acd82;})['then'](respondWithFilteredResult(_0x47a741,_0x71dd2d))[_0xe28c('0x44')](handleError(_0x47a741,null));};exports[_0xe28c('0x45')]=function(_0x551ee2,_0x121661){var _0x18292a={'raw':!![],'where':{'id':_0x551ee2[_0xe28c('0x46')]['id']}},_0x43f805={};_0x43f805[_0xe28c('0x2e')]=_[_0xe28c('0x2f')](db['AnalyticTreeReport']['rawAttributes']);_0x43f805[_0xe28c('0x32')]=_['keys'](_0x551ee2[_0xe28c('0x32')]);_0x43f805[_0xe28c('0x30')]=_[_0xe28c('0x31')](_0x43f805[_0xe28c('0x2e')],_0x43f805[_0xe28c('0x32')]);_0x18292a[_0xe28c('0x34')]=_[_0xe28c('0x31')](_0x43f805[_0xe28c('0x2e')],qs[_0xe28c('0x33')](_0x551ee2[_0xe28c('0x32')][_0xe28c('0x33')]));_0x18292a[_0xe28c('0x34')]=_0x18292a[_0xe28c('0x34')][_0xe28c('0x35')]?_0x18292a['attributes']:_0x43f805[_0xe28c('0x2e')];if(_0x551ee2['query'][_0xe28c('0x40')]){_0x18292a[_0xe28c('0x41')]=[{'all':!![]}];}_0x18292a=_['merge']({},_0x18292a,_0x551ee2[_0xe28c('0x3f')]);return db[_0xe28c('0x2b')][_0xe28c('0x47')](_0x18292a)[_0xe28c('0x25')](handleEntityNotFound(_0x121661,null))[_0xe28c('0x25')](respondWithResult(_0x121661,null))[_0xe28c('0x44')](handleError(_0x121661,null));};exports['create']=function(_0x1dbb8e,_0x1e197c){return db['AnalyticTreeReport']['create'](_0x1dbb8e[_0xe28c('0x48')],{})[_0xe28c('0x25')](respondWithResult(_0x1e197c,0xc9))[_0xe28c('0x44')](handleError(_0x1e197c,null));};exports[_0xe28c('0x24')]=function(_0x5a355a,_0x5c1c1d){if(_0x5a355a[_0xe28c('0x48')]['id']){delete _0x5a355a['body']['id'];}return db[_0xe28c('0x2b')][_0xe28c('0x47')]({'where':{'id':_0x5a355a['params']['id']}})[_0xe28c('0x25')](handleEntityNotFound(_0x5c1c1d,null))[_0xe28c('0x25')](saveUpdates(_0x5a355a[_0xe28c('0x48')],null))[_0xe28c('0x25')](respondWithResult(_0x5c1c1d,null))[_0xe28c('0x44')](handleError(_0x5c1c1d,null));};exports[_0xe28c('0x49')]=function(_0x3481fc,_0x152e10){return db[_0xe28c('0x2b')][_0xe28c('0x47')]({'where':{'id':_0x3481fc['params']['id']}})['then'](handleEntityNotFound(_0x152e10,null))['then'](removeEntity(_0x152e10,null))[_0xe28c('0x44')](handleError(_0x152e10,null));}; \ No newline at end of file +var _0x9414=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','create','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','count','offset','limit','json','apply','save','update','then','destroy','end','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9414,0x152));var _0x4941=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0x9414[_0x1526e1];return _0x249a1e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4941('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4941('0x1'));var rp=require(_0x4941('0x2'));var moment=require(_0x4941('0x3'));var BPromise=require(_0x4941('0x4'));var Mustache=require(_0x4941('0x5'));var util=require(_0x4941('0x6'));var path=require(_0x4941('0x7'));var sox=require('sox');var csv=require(_0x4941('0x8'));var ejs=require(_0x4941('0x9'));var fs=require('fs');var _=require(_0x4941('0xa'));var squel=require(_0x4941('0xb'));var crypto=require(_0x4941('0xc'));var jsforce=require(_0x4941('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4941('0x8'));var querystring=require(_0x4941('0xe'));var Papa=require('papaparse');var Redis=require(_0x4941('0xf'));var authService=require(_0x4941('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4941('0x11'));var logger=require(_0x4941('0x12'))('api');var utils=require(_0x4941('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a89c2,_0x4d4c1f){_0x4d4c1f=_0x4d4c1f||0xcc;return function(_0x12112c){if(_0x12112c){return _0x5a89c2[_0x4941('0x14')](_0x4d4c1f);}return _0x5a89c2[_0x4941('0x15')](_0x4d4c1f)['end']();};}function respondWithResult(_0x5a22d9,_0x32ccfa){_0x32ccfa=_0x32ccfa||0xc8;return function(_0x2bc979){if(_0x2bc979){return _0x5a22d9[_0x4941('0x15')](_0x32ccfa)['json'](_0x2bc979);}};}function respondWithFilteredResult(_0x2f0c72,_0x330949){return function(_0x923a80){if(_0x923a80){var _0x497945=_0x923a80[_0x4941('0x16')],_0x25bccd=_0x330949[_0x4941('0x17')],_0x457cd8=_0x330949[_0x4941('0x17')]+_0x330949[_0x4941('0x18')],_0x20b4a0;if(_0x457cd8>=_0x497945){_0x457cd8=_0x497945;_0x20b4a0=0xc8;}else{_0x20b4a0=0xce;}_0x2f0c72[_0x4941('0x15')](_0x20b4a0);return _0x2f0c72['set']('Content-Range',_0x25bccd+'-'+_0x457cd8+'/'+_0x497945)[_0x4941('0x19')](_0x923a80);}return null;};}function patchUpdates(_0x1b7e4c){return function(_0x272644){try{jsonpatch[_0x4941('0x1a')](_0x272644,_0x1b7e4c,!![]);}catch(_0x34cbc0){return BPromise['reject'](_0x34cbc0);}return _0x272644[_0x4941('0x1b')]();};}function saveUpdates(_0x14505e,_0x3950f4){return function(_0x5b45bf){if(_0x5b45bf){return _0x5b45bf[_0x4941('0x1c')](_0x14505e)[_0x4941('0x1d')](function(_0x34b24f){return _0x34b24f;});}return null;};}function removeEntity(_0x791964,_0x43422f){return function(_0x21293a){if(_0x21293a){return _0x21293a[_0x4941('0x1e')]()['then'](function(){_0x791964[_0x4941('0x15')](0xcc)[_0x4941('0x1f')]();});}};}function handleEntityNotFound(_0x154035,_0x44916a){return function(_0x251ec6){if(!_0x251ec6){_0x154035[_0x4941('0x14')](0x194);}return _0x251ec6;};}function handleError(_0x11a260,_0x3e81bb){_0x3e81bb=_0x3e81bb||0x1f4;return function(_0x59c743){logger[_0x4941('0x20')](_0x59c743[_0x4941('0x21')]);if(_0x59c743[_0x4941('0x22')]){delete _0x59c743[_0x4941('0x22')];}_0x11a260[_0x4941('0x15')](_0x3e81bb)['send'](_0x59c743);};}exports[_0x4941('0x23')]=function(_0x216ef7,_0x1bd0cb){var _0x4968c5={},_0x4fec14={},_0x38e37d={'count':0x0,'rows':[]};var _0x467bf9=_[_0x4941('0x24')](db[_0x4941('0x25')][_0x4941('0x26')],function(_0x495496){return{'name':_0x495496['fieldName'],'type':_0x495496[_0x4941('0x27')][_0x4941('0x28')]};});_0x4fec14[_0x4941('0x29')]=_['map'](_0x467bf9,_0x4941('0x22'));_0x4fec14['query']=_['keys'](_0x216ef7[_0x4941('0x2a')]);_0x4fec14[_0x4941('0x2b')]=_[_0x4941('0x2c')](_0x4fec14['model'],_0x4fec14['query']);_0x4968c5[_0x4941('0x2d')]=_[_0x4941('0x2c')](_0x4fec14[_0x4941('0x29')],qs[_0x4941('0x2e')](_0x216ef7[_0x4941('0x2a')][_0x4941('0x2e')]));_0x4968c5['attributes']=_0x4968c5[_0x4941('0x2d')]['length']?_0x4968c5[_0x4941('0x2d')]:_0x4fec14[_0x4941('0x29')];if(!_0x216ef7['query'][_0x4941('0x2f')]('nolimit')){_0x4968c5[_0x4941('0x18')]=qs[_0x4941('0x18')](_0x216ef7[_0x4941('0x2a')]['limit']);_0x4968c5['offset']=qs[_0x4941('0x17')](_0x216ef7['query'][_0x4941('0x17')]);}_0x4968c5[_0x4941('0x30')]=qs['sort'](_0x216ef7[_0x4941('0x2a')][_0x4941('0x31')]);_0x4968c5[_0x4941('0x32')]=qs['filters'](_[_0x4941('0x33')](_0x216ef7['query'],_0x4fec14['filters']),_0x467bf9);if(_0x216ef7[_0x4941('0x2a')]['filter']){_0x4968c5[_0x4941('0x32')]=_[_0x4941('0x34')](_0x4968c5[_0x4941('0x32')],{'$or':_[_0x4941('0x24')](_0x467bf9,function(_0x98517e){if(_0x98517e[_0x4941('0x27')]!==_0x4941('0x35')){var _0x3fc443={};_0x3fc443[_0x98517e['name']]={'$like':'%'+_0x216ef7[_0x4941('0x2a')]['filter']+'%'};return _0x3fc443;}})});}_0x4968c5=_['merge']({},_0x4968c5,_0x216ef7[_0x4941('0x36')]);var _0x5ed476={'where':_0x4968c5[_0x4941('0x32')]};return db[_0x4941('0x25')][_0x4941('0x16')](_0x5ed476)[_0x4941('0x1d')](function(_0x139fa1){_0x38e37d[_0x4941('0x16')]=_0x139fa1;if(_0x216ef7[_0x4941('0x2a')][_0x4941('0x37')]){_0x4968c5[_0x4941('0x38')]=[{'all':!![]}];}return db[_0x4941('0x25')][_0x4941('0x39')](_0x4968c5);})[_0x4941('0x1d')](function(_0x40204b){_0x38e37d[_0x4941('0x3a')]=_0x40204b;return _0x38e37d;})['then'](respondWithFilteredResult(_0x1bd0cb,_0x4968c5))[_0x4941('0x3b')](handleError(_0x1bd0cb,null));};exports['show']=function(_0x4a51f6,_0x249361){var _0x40574f={'raw':!![],'where':{'id':_0x4a51f6['params']['id']}},_0x1d1ec4={};_0x1d1ec4['model']=_[_0x4941('0x3c')](db[_0x4941('0x25')][_0x4941('0x26')]);_0x1d1ec4['query']=_[_0x4941('0x3c')](_0x4a51f6['query']);_0x1d1ec4[_0x4941('0x2b')]=_['intersection'](_0x1d1ec4[_0x4941('0x29')],_0x1d1ec4[_0x4941('0x2a')]);_0x40574f['attributes']=_[_0x4941('0x2c')](_0x1d1ec4[_0x4941('0x29')],qs['fields'](_0x4a51f6[_0x4941('0x2a')][_0x4941('0x2e')]));_0x40574f[_0x4941('0x2d')]=_0x40574f[_0x4941('0x2d')]['length']?_0x40574f[_0x4941('0x2d')]:_0x1d1ec4[_0x4941('0x29')];if(_0x4a51f6[_0x4941('0x2a')][_0x4941('0x37')]){_0x40574f[_0x4941('0x38')]=[{'all':!![]}];}_0x40574f=_['merge']({},_0x40574f,_0x4a51f6[_0x4941('0x36')]);return db[_0x4941('0x25')][_0x4941('0x3d')](_0x40574f)[_0x4941('0x1d')](handleEntityNotFound(_0x249361,null))['then'](respondWithResult(_0x249361,null))[_0x4941('0x3b')](handleError(_0x249361,null));};exports[_0x4941('0x3e')]=function(_0x145fa7,_0x5b1b73){return db['AnalyticTreeReport'][_0x4941('0x3e')](_0x145fa7['body'],{})[_0x4941('0x1d')](respondWithResult(_0x5b1b73,0xc9))[_0x4941('0x3b')](handleError(_0x5b1b73,null));};exports['update']=function(_0x3cabee,_0x5a7aff){if(_0x3cabee[_0x4941('0x3f')]['id']){delete _0x3cabee['body']['id'];}return db[_0x4941('0x25')][_0x4941('0x3d')]({'where':{'id':_0x3cabee[_0x4941('0x40')]['id']}})[_0x4941('0x1d')](handleEntityNotFound(_0x5a7aff,null))['then'](saveUpdates(_0x3cabee[_0x4941('0x3f')],null))[_0x4941('0x1d')](respondWithResult(_0x5a7aff,null))[_0x4941('0x3b')](handleError(_0x5a7aff,null));};exports[_0x4941('0x1e')]=function(_0x227427,_0x4e7c60){return db[_0x4941('0x25')][_0x4941('0x3d')]({'where':{'id':_0x227427['params']['id']}})['then'](handleEntityNotFound(_0x4e7c60,null))['then'](removeEntity(_0x4e7c60,null))['catch'](handleError(_0x4e7c60,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 53e3397..72aa50d 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 _0xb422=['analytics_report_trees','api','request-promise','rimraf','./analyticTreeReport.attributes','define'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0xb422,0x85));var _0x2b42=function(_0x1443d5,_0x21f839){_0x1443d5=_0x1443d5-0x0;var _0x3f8e34=_0xb422[_0x1443d5];return _0x3f8e34;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2b42('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2b42('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b42('0x2'));var config=require('../../config/environment');var attributes=require(_0x2b42('0x3'));module['exports']=function(_0x406d93,_0x1a0fbe){return _0x406d93[_0x2b42('0x4')]('AnalyticTreeReport',attributes,{'tableName':_0x2b42('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74af=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x317231,_0x3e35c2){var _0x447abc=function(_0x1c8580){while(--_0x1c8580){_0x317231['push'](_0x317231['shift']());}};_0x447abc(++_0x3e35c2);}(_0x74af,0x178));var _0xf74a=function(_0x5d0747,_0x1a85a6){_0x5d0747=_0x5d0747-0x0;var _0x963506=_0x74af[_0x5d0747];return _0x963506;};'use strict';var _=require(_0xf74a('0x0'));var util=require(_0xf74a('0x1'));var logger=require(_0xf74a('0x2'))(_0xf74a('0x3'));var moment=require(_0xf74a('0x4'));var BPromise=require(_0xf74a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf74a('0x6'));var rimraf=require(_0xf74a('0x7'));var config=require(_0xf74a('0x8'));var attributes=require(_0xf74a('0x9'));module[_0xf74a('0xa')]=function(_0x41c258,_0x110741){return _0x41c258['define'](_0xf74a('0xb'),attributes,{'tableName':_0xf74a('0xc'),'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 e67f25f..9fb7f2f 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 _0x5305=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s'];(function(_0x4bb14e,_0x4be3d1){var _0x1c1568=function(_0x4e24db){while(--_0x4e24db){_0x4bb14e['push'](_0x4bb14e['shift']());}};_0x1c1568(++_0x4be3d1);}(_0x5305,0x1d1));var _0x5530=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5305[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x5530('0x0'));var util=require(_0x5530('0x1'));var moment=require(_0x5530('0x2'));var BPromise=require(_0x5530('0x3'));var rs=require(_0x5530('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5530('0x5'))['db'];var utils=require(_0x5530('0x6'));var logger=require('../../config/logger')(_0x5530('0x7'));var config=require(_0x5530('0x8'));var jayson=require(_0x5530('0x9'));var client=jayson[_0x5530('0xa')][_0x5530('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f4d88,_0x69ecce,_0x97fc7a){return new BPromise(function(_0x249fc9,_0xbbd379){return client['request'](_0x5f4d88,_0x97fc7a)[_0x5530('0xc')](function(_0x3201ae){logger[_0x5530('0xd')](_0x5530('0xe'),_0x69ecce,_0x5530('0xf'));logger[_0x5530('0x10')](_0x5530('0x11'),_0x69ecce,_0x5530('0xf'),JSON['stringify'](_0x3201ae));if(_0x3201ae[_0x5530('0x12')]){if(_0x3201ae['error'][_0x5530('0x13')]===0x1f4){logger[_0x5530('0x12')]('AnalyticTreeReport,\x20%s,\x20%s',_0x69ecce,_0x3201ae[_0x5530('0x12')][_0x5530('0x14')]);return _0xbbd379(_0x3201ae['error'][_0x5530('0x14')]);}logger['error'](_0x5530('0xe'),_0x69ecce,_0x3201ae[_0x5530('0x12')][_0x5530('0x14')]);return _0x249fc9(_0x3201ae[_0x5530('0x12')]['message']);}else{logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x69ecce,_0x5530('0xf'));_0x249fc9(_0x3201ae[_0x5530('0x15')][_0x5530('0x14')]);}})[_0x5530('0x16')](function(_0x1a4131){logger['error'](_0x5530('0xe'),_0x69ecce,_0x1a4131);_0xbbd379(_0x1a4131);});});} \ No newline at end of file +var _0x0ec9=['moment','bluebird','randomstring','rpc','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x16cb49,_0x531ce8){var _0x53d3e0=function(_0x2a5814){while(--_0x2a5814){_0x16cb49['push'](_0x16cb49['shift']());}};_0x53d3e0(++_0x531ce8);}(_0x0ec9,0xb3));var _0x90ec=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x0ec9[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x90ec('0x0'));var util=require('util');var moment=require(_0x90ec('0x1'));var BPromise=require(_0x90ec('0x2'));var rs=require(_0x90ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x90ec('0x4'));var config=require('../../config/environment');var jayson=require(_0x90ec('0x5'));var client=jayson[_0x90ec('0x6')][_0x90ec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1b9883,_0x67f5db,_0x3f821d){return new BPromise(function(_0x2c5c6f,_0x62cfa0){return client[_0x90ec('0x8')](_0x1b9883,_0x3f821d)[_0x90ec('0x9')](function(_0x4ea43c){logger['info'](_0x90ec('0xa'),_0x67f5db,_0x90ec('0xb'));logger[_0x90ec('0xc')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x67f5db,'request\x20sent',JSON[_0x90ec('0xd')](_0x4ea43c));if(_0x4ea43c[_0x90ec('0xe')]){if(_0x4ea43c['error'][_0x90ec('0xf')]===0x1f4){logger[_0x90ec('0xe')](_0x90ec('0xa'),_0x67f5db,_0x4ea43c[_0x90ec('0xe')][_0x90ec('0x10')]);return _0x62cfa0(_0x4ea43c[_0x90ec('0xe')][_0x90ec('0x10')]);}logger[_0x90ec('0xe')](_0x90ec('0xa'),_0x67f5db,_0x4ea43c[_0x90ec('0xe')][_0x90ec('0x10')]);return _0x2c5c6f(_0x4ea43c['error'][_0x90ec('0x10')]);}else{logger['info'](_0x90ec('0xa'),_0x67f5db,_0x90ec('0xb'));_0x2c5c6f(_0x4ea43c['result']['message']);}})[_0x90ec('0x11')](function(_0x661009){logger[_0x90ec('0xe')]('AnalyticTreeReport,\x20%s,\x20%s',_0x67f5db,_0x661009);_0x62cfa0(_0x661009);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index d2ffd1a..7a67cbc 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 _0x8576=['exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','put','/:id','delete','destroy'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x8576,0x127));var _0x6857=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x8576[_0x36ed3c];return _0x52a2e0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6857('0x0'));var timeout=require(_0x6857('0x1'));var express=require('express');var router=express[_0x6857('0x2')]();var auth=require(_0x6857('0x3'));var interaction=require(_0x6857('0x4'));var config=require(_0x6857('0x5'));var controller=require(_0x6857('0x6'));router['get']('/',auth[_0x6857('0x7')](),controller[_0x6857('0x8')]);router['get']('/:id',auth[_0x6857('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6857('0x9')](_0x6857('0xa'),auth[_0x6857('0x7')](),controller['update']);router[_0x6857('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x6857('0xc')]);module[_0x6857('0xd')]=router; \ No newline at end of file +var _0xc1d7=['./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x5e2589,_0x57b325){var _0x315d8f=function(_0x35c89b){while(--_0x35c89b){_0x5e2589['push'](_0x5e2589['shift']());}};_0x315d8f(++_0x57b325);}(_0xc1d7,0xdd));var _0x7c1d=function(_0x403fc7,_0x32931a){_0x403fc7=_0x403fc7-0x0;var _0x5d0827=_0xc1d7[_0x403fc7];return _0x5d0827;};'use strict';var multer=require(_0x7c1d('0x0'));var util=require('util');var path=require(_0x7c1d('0x1'));var timeout=require(_0x7c1d('0x2'));var express=require(_0x7c1d('0x3'));var router=express[_0x7c1d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7c1d('0x5'));var config=require(_0x7c1d('0x6'));var controller=require(_0x7c1d('0x7'));router[_0x7c1d('0x8')]('/',auth['isAuthenticated'](),controller[_0x7c1d('0x9')]);router[_0x7c1d('0x8')](_0x7c1d('0xa'),auth[_0x7c1d('0xb')](),controller[_0x7c1d('0xc')]);router[_0x7c1d('0xd')]('/',auth[_0x7c1d('0xb')](),controller['create']);router[_0x7c1d('0xe')](_0x7c1d('0xa'),auth['isAuthenticated'](),controller[_0x7c1d('0xf')]);router[_0x7c1d('0x10')](_0x7c1d('0xa'),auth[_0x7c1d('0xb')](),controller[_0x7c1d('0x11')]);module[_0x7c1d('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 85aa9ec..519454b 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 _0xa5a1=['STRING','sequelize','exports'];(function(_0x533913,_0x525f70){var _0x327c32=function(_0x49f4f9){while(--_0x49f4f9){_0x533913['push'](_0x533913['shift']());}};_0x327c32(++_0x525f70);}(_0xa5a1,0xc1));var _0x1a5a=function(_0x234ab7,_0x4e8666){_0x234ab7=_0x234ab7-0x0;var _0x1093ff=_0xa5a1[_0x234ab7];return _0x1093ff;};'use strict';var Sequelize=require(_0x1a5a('0x0'));module[_0x1a5a('0x1')]={'name':{'type':Sequelize[_0x1a5a('0x2')]},'basename':{'type':Sequelize[_0x1a5a('0x2')]},'type':{'type':Sequelize[_0x1a5a('0x2')]}}; \ No newline at end of file +var _0xdef8=['exports','STRING','sequelize'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xdef8,0xbf));var _0x8def=function(_0x16e0d7,_0x4be04c){_0x16e0d7=_0x16e0d7-0x0;var _0x5aee3f=_0xdef8[_0x16e0d7];return _0x5aee3f;};'use strict';var Sequelize=require(_0x8def('0x0'));module[_0x8def('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8def('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index cfe8639..5016e2c 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 _0x9583=['updatedAt','create','originalname','basename','file','filename','findOne','download','join','root','server/files/attachments/','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','Attachment','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','clone','get','omit','createdAt','body'];(function(_0xc60c8d,_0x44d17c){var _0x440913=function(_0x268a4a){while(--_0x268a4a){_0xc60c8d['push'](_0xc60c8d['shift']());}};_0x440913(++_0x44d17c);}(_0x9583,0x16b));var _0x3958=function(_0x32b161,_0x1a6d39){_0x32b161=_0x32b161-0x0;var _0x3ed298=_0x9583[_0x32b161];return _0x3ed298;};'use strict';var pdf=require(_0x3958('0x0'));var emlformat=require(_0x3958('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3958('0x2'));var jsonpatch=require(_0x3958('0x3'));var rp=require(_0x3958('0x4'));var moment=require(_0x3958('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3958('0x6'));var path=require(_0x3958('0x7'));var sox=require(_0x3958('0x8'));var csv=require(_0x3958('0x9'));var ejs=require(_0x3958('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3958('0xb'));var jsforce=require(_0x3958('0xc'));var deskjs=require(_0x3958('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3958('0xe'));var authService=require(_0x3958('0xf'));var qs=require(_0x3958('0x10'));var as=require(_0x3958('0x11'));var hardwareService=require(_0x3958('0x12'));var logger=require(_0x3958('0x13'))(_0x3958('0x14'));var utils=require('../../config/utils');var config=require(_0x3958('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3958('0x16'))['db'];function respondWithStatusCode(_0x44f99a,_0x39a249){_0x39a249=_0x39a249||0xcc;return function(_0x2e0455){if(_0x2e0455){return _0x44f99a[_0x3958('0x17')](_0x39a249);}return _0x44f99a[_0x3958('0x18')](_0x39a249)[_0x3958('0x19')]();};}function respondWithResult(_0x3d601e,_0x4ae7d0){_0x4ae7d0=_0x4ae7d0||0xc8;return function(_0x42a822){if(_0x42a822){return _0x3d601e[_0x3958('0x18')](_0x4ae7d0)[_0x3958('0x1a')](_0x42a822);}};}function respondWithFilteredResult(_0x5446ba,_0x4f13a4){return function(_0x11a811){if(_0x11a811){var _0x2342aa=_0x11a811['count'],_0x2ccb5d=_0x4f13a4['offset'],_0x5a5b1a=_0x4f13a4[_0x3958('0x1b')]+_0x4f13a4[_0x3958('0x1c')],_0x5944d9;if(_0x5a5b1a>=_0x2342aa){_0x5a5b1a=_0x2342aa;_0x5944d9=0xc8;}else{_0x5944d9=0xce;}_0x5446ba[_0x3958('0x18')](_0x5944d9);return _0x5446ba[_0x3958('0x1d')](_0x3958('0x1e'),_0x2ccb5d+'-'+_0x5a5b1a+'/'+_0x2342aa)[_0x3958('0x1a')](_0x11a811);}return null;};}function patchUpdates(_0x39cb12){return function(_0x56bdaa){try{jsonpatch[_0x3958('0x1f')](_0x56bdaa,_0x39cb12,!![]);}catch(_0x4c22e8){return BPromise[_0x3958('0x20')](_0x4c22e8);}return _0x56bdaa[_0x3958('0x21')]();};}function saveUpdates(_0x30e583,_0x3efc5a){return function(_0x1ae889){if(_0x1ae889){return _0x1ae889[_0x3958('0x22')](_0x30e583)['then'](function(_0x2e0439){return _0x2e0439;});}return null;};}function removeEntity(_0x32b2e3,_0x437d4d){return function(_0x2f385a){if(_0x2f385a){return _0x2f385a[_0x3958('0x23')]()[_0x3958('0x24')](function(){_0x32b2e3[_0x3958('0x18')](0xcc)[_0x3958('0x19')]();});}};}function handleEntityNotFound(_0x4cdfdf,_0x587076){return function(_0x3b3008){if(!_0x3b3008){_0x4cdfdf['sendStatus'](0x194);}return _0x3b3008;};}function handleError(_0x1a2b53,_0x2b7ab5){_0x2b7ab5=_0x2b7ab5||0x1f4;return function(_0x237beb){logger[_0x3958('0x25')](_0x237beb[_0x3958('0x26')]);if(_0x237beb['name']){delete _0x237beb[_0x3958('0x27')];}_0x1a2b53[_0x3958('0x18')](_0x2b7ab5)[_0x3958('0x28')](_0x237beb);};}exports[_0x3958('0x29')]=function(_0x44c0f7,_0x1dc9be){var _0x4ffb8f={},_0x1be9d0={},_0x33fb7f={'count':0x0,'rows':[]};var _0x1d6da1=_[_0x3958('0x2a')](db[_0x3958('0x2b')]['rawAttributes'],function(_0x2de404){return{'name':_0x2de404[_0x3958('0x2c')],'type':_0x2de404[_0x3958('0x2d')][_0x3958('0x2e')]};});_0x1be9d0[_0x3958('0x2f')]=_[_0x3958('0x2a')](_0x1d6da1,_0x3958('0x27'));_0x1be9d0['query']=_[_0x3958('0x30')](_0x44c0f7[_0x3958('0x31')]);_0x1be9d0[_0x3958('0x32')]=_[_0x3958('0x33')](_0x1be9d0[_0x3958('0x2f')],_0x1be9d0['query']);_0x4ffb8f['attributes']=_['intersection'](_0x1be9d0['model'],qs[_0x3958('0x34')](_0x44c0f7['query']['fields']));_0x4ffb8f[_0x3958('0x35')]=_0x4ffb8f[_0x3958('0x35')][_0x3958('0x36')]?_0x4ffb8f[_0x3958('0x35')]:_0x1be9d0['model'];if(!_0x44c0f7[_0x3958('0x31')]['hasOwnProperty'](_0x3958('0x37'))){_0x4ffb8f[_0x3958('0x1c')]=qs['limit'](_0x44c0f7[_0x3958('0x31')]['limit']);_0x4ffb8f[_0x3958('0x1b')]=qs[_0x3958('0x1b')](_0x44c0f7[_0x3958('0x31')]['offset']);}_0x4ffb8f['order']=qs['sort'](_0x44c0f7[_0x3958('0x31')][_0x3958('0x38')]);_0x4ffb8f[_0x3958('0x39')]=qs[_0x3958('0x32')](_['pick'](_0x44c0f7[_0x3958('0x31')],_0x1be9d0[_0x3958('0x32')]),_0x1d6da1);if(_0x44c0f7[_0x3958('0x31')][_0x3958('0x3a')]){_0x4ffb8f[_0x3958('0x39')]=_[_0x3958('0x3b')](_0x4ffb8f['where'],{'$or':_['map'](_0x1d6da1,function(_0x32f43e){if(_0x32f43e[_0x3958('0x2d')]!==_0x3958('0x3c')){var _0x1a8713={};_0x1a8713[_0x32f43e[_0x3958('0x27')]]={'$like':'%'+_0x44c0f7[_0x3958('0x31')][_0x3958('0x3a')]+'%'};return _0x1a8713;}})});}_0x4ffb8f=_[_0x3958('0x3b')]({},_0x4ffb8f,_0x44c0f7[_0x3958('0x3d')]);var _0x30dd87={'where':_0x4ffb8f[_0x3958('0x39')]};return db[_0x3958('0x2b')]['count'](_0x30dd87)[_0x3958('0x24')](function(_0x1b9d24){_0x33fb7f[_0x3958('0x3e')]=_0x1b9d24;if(_0x44c0f7[_0x3958('0x31')]['includeAll']){_0x4ffb8f['include']=[{'all':!![]}];}return db[_0x3958('0x2b')][_0x3958('0x3f')](_0x4ffb8f);})[_0x3958('0x24')](function(_0x11db19){_0x33fb7f[_0x3958('0x40')]=_0x11db19;return _0x33fb7f;})[_0x3958('0x24')](respondWithFilteredResult(_0x1dc9be,_0x4ffb8f))[_0x3958('0x41')](handleError(_0x1dc9be,null));};exports[_0x3958('0x42')]=function(_0x28ceb5,_0x500254){var _0x1e9a10={'raw':!![],'where':{'id':_0x28ceb5[_0x3958('0x43')]['id']}},_0x43c6cf={};_0x43c6cf[_0x3958('0x2f')]=_['keys'](db[_0x3958('0x2b')][_0x3958('0x44')]);_0x43c6cf[_0x3958('0x31')]=_['keys'](_0x28ceb5[_0x3958('0x31')]);_0x43c6cf[_0x3958('0x32')]=_[_0x3958('0x33')](_0x43c6cf['model'],_0x43c6cf['query']);_0x1e9a10[_0x3958('0x35')]=_['intersection'](_0x43c6cf[_0x3958('0x2f')],qs[_0x3958('0x34')](_0x28ceb5['query'][_0x3958('0x34')]));_0x1e9a10[_0x3958('0x35')]=_0x1e9a10[_0x3958('0x35')][_0x3958('0x36')]?_0x1e9a10[_0x3958('0x35')]:_0x43c6cf['model'];if(_0x28ceb5[_0x3958('0x31')][_0x3958('0x45')]){_0x1e9a10[_0x3958('0x46')]=[{'all':!![]}];}_0x1e9a10=_[_0x3958('0x3b')]({},_0x1e9a10,_0x28ceb5[_0x3958('0x3d')]);return db['Attachment'][_0x3958('0x47')](_0x1e9a10)[_0x3958('0x24')](handleEntityNotFound(_0x500254,null))[_0x3958('0x24')](respondWithResult(_0x500254,null))[_0x3958('0x41')](handleError(_0x500254,null));};exports[_0x3958('0x48')]=function(_0x3d1b64,_0x503efb){var _0x3fb78f={'where':{'id':_0x3d1b64[_0x3958('0x43')]['id']}},_0x44815e={};_0x44815e[_0x3958('0x2f')]=_[_0x3958('0x30')](db[_0x3958('0x2b')][_0x3958('0x44')]);_0x3fb78f['attributes']=_[_0x3958('0x33')](_0x44815e['model'],qs[_0x3958('0x34')](_0x3d1b64[_0x3958('0x31')][_0x3958('0x34')]));_0x3fb78f[_0x3958('0x35')]=_0x3fb78f[_0x3958('0x35')]['length']?_0x3fb78f['attributes']:_0x44815e[_0x3958('0x2f')];if(_0x3d1b64[_0x3958('0x31')][_0x3958('0x45')]){_0x3fb78f[_0x3958('0x46')]=[{'all':!![]}];}_0x3fb78f=_['merge']({},_0x3fb78f,_0x3d1b64[_0x3958('0x3d')]);return db[_0x3958('0x2b')]['find'](_0x3fb78f)[_0x3958('0x24')](handleEntityNotFound(_0x503efb,null))[_0x3958('0x24')](function(_0x35a03f){if(_0x35a03f){var _0x35eb67=_0x35a03f[_0x3958('0x49')]({'plain':!![]});_0x35eb67=qs[_0x3958('0x4a')](_0x35eb67,['id',_0x3958('0x4b'),'updatedAt']);_0x3d1b64['body']=_['omit'](_0x3d1b64[_0x3958('0x4c')],['id','createdAt',_0x3958('0x4d')]);return db[_0x3958('0x2b')][_0x3958('0x4e')](_[_0x3958('0x3b')](_0x35eb67,_0x3d1b64['body']),{'include':_0x3d1b64[_0x3958('0x31')][_0x3958('0x45')]?[{'all':!![]}]:undefined});}})[_0x3958('0x24')](respondWithResult(_0x503efb,0xc9))[_0x3958('0x41')](handleError(_0x503efb,null));};exports[_0x3958('0x22')]=function(_0x44f217,_0x5a35c2){if(_0x44f217[_0x3958('0x4c')]['id']){delete _0x44f217[_0x3958('0x4c')]['id'];}return db['Attachment']['find']({'where':{'id':_0x44f217[_0x3958('0x43')]['id']}})[_0x3958('0x24')](handleEntityNotFound(_0x5a35c2,null))['then'](saveUpdates(_0x44f217['body'],null))[_0x3958('0x24')](respondWithResult(_0x5a35c2,null))[_0x3958('0x41')](handleError(_0x5a35c2,null));};exports[_0x3958('0x23')]=function(_0x27eef6,_0x4871de){return db['Attachment'][_0x3958('0x47')]({'where':{'id':_0x27eef6[_0x3958('0x43')]['id']}})[_0x3958('0x24')](handleEntityNotFound(_0x4871de,null))['then'](removeEntity(_0x4871de,null))['catch'](handleError(_0x4871de,null));};exports['create']=function(_0x32fe74,_0x3d19b9,_0x202cf9){_0x32fe74['body'][_0x3958('0x27')]=_0x32fe74['file'][_0x3958('0x4f')];_0x32fe74[_0x3958('0x4c')][_0x3958('0x50')]=_0x32fe74[_0x3958('0x51')][_0x3958('0x52')];_0x32fe74[_0x3958('0x4c')][_0x3958('0x2d')]=_0x32fe74[_0x3958('0x51')]['mimetype'];return db[_0x3958('0x2b')]['create'](_0x32fe74[_0x3958('0x4c')])[_0x3958('0x24')](respondWithResult(_0x3d19b9,0xc9))[_0x3958('0x41')](handleError(_0x3d19b9,null));};exports['download']=function(_0x3efe48,_0x1fb4ca,_0x31e3af){return db[_0x3958('0x2b')][_0x3958('0x53')]({'where':{'id':_0x3efe48[_0x3958('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1fb4ca,null))[_0x3958('0x24')](function(_0x508e47){if(_0x508e47){return _0x1fb4ca[_0x3958('0x54')](path[_0x3958('0x55')](config[_0x3958('0x56')],_0x3958('0x57'),_0x508e47[_0x3958('0x50')]));}})[_0x3958('0x41')](handleError(_0x1fb4ca,null));}; \ No newline at end of file +var _0xddc2=['join','root','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','Attachment','fieldName','type','key','query','keys','filters','model','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','fields','find','options','get','createdAt','body','omit','updatedAt','create','file','originalname','basename','filename','download','findOne'];(function(_0x526e27,_0x2f4509){var _0x435288=function(_0x485978){while(--_0x485978){_0x526e27['push'](_0x526e27['shift']());}};_0x435288(++_0x2f4509);}(_0xddc2,0xa2));var _0x2ddc=function(_0x2d3d53,_0x44cc45){_0x2d3d53=_0x2d3d53-0x0;var _0x208d47=_0xddc2[_0x2d3d53];return _0x208d47;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2ddc('0x0'));var jsonpatch=require(_0x2ddc('0x1'));var rp=require(_0x2ddc('0x2'));var moment=require(_0x2ddc('0x3'));var BPromise=require(_0x2ddc('0x4'));var Mustache=require(_0x2ddc('0x5'));var util=require(_0x2ddc('0x6'));var path=require('path');var sox=require(_0x2ddc('0x7'));var csv=require('to-csv');var ejs=require(_0x2ddc('0x8'));var fs=require('fs');var _=require(_0x2ddc('0x9'));var squel=require(_0x2ddc('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2ddc('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2ddc('0xc'));var authService=require(_0x2ddc('0xd'));var qs=require(_0x2ddc('0xe'));var as=require(_0x2ddc('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ddc('0x10'))(_0x2ddc('0x11'));var utils=require(_0x2ddc('0x12'));var config=require(_0x2ddc('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2ddc('0x14'))['db'];function respondWithStatusCode(_0x2573f3,_0xd909bb){_0xd909bb=_0xd909bb||0xcc;return function(_0x58dab1){if(_0x58dab1){return _0x2573f3[_0x2ddc('0x15')](_0xd909bb);}return _0x2573f3[_0x2ddc('0x16')](_0xd909bb)[_0x2ddc('0x17')]();};}function respondWithResult(_0x13668a,_0x4a5631){_0x4a5631=_0x4a5631||0xc8;return function(_0x526c0c){if(_0x526c0c){return _0x13668a[_0x2ddc('0x16')](_0x4a5631)['json'](_0x526c0c);}};}function respondWithFilteredResult(_0xae7243,_0x33c5a5){return function(_0x1b7b34){if(_0x1b7b34){var _0x22b8f8=_0x1b7b34[_0x2ddc('0x18')],_0x34b539=_0x33c5a5['offset'],_0x39822c=_0x33c5a5[_0x2ddc('0x19')]+_0x33c5a5[_0x2ddc('0x1a')],_0x199029;if(_0x39822c>=_0x22b8f8){_0x39822c=_0x22b8f8;_0x199029=0xc8;}else{_0x199029=0xce;}_0xae7243['status'](_0x199029);return _0xae7243[_0x2ddc('0x1b')]('Content-Range',_0x34b539+'-'+_0x39822c+'/'+_0x22b8f8)['json'](_0x1b7b34);}return null;};}function patchUpdates(_0x1f9f08){return function(_0x2c9e54){try{jsonpatch[_0x2ddc('0x1c')](_0x2c9e54,_0x1f9f08,!![]);}catch(_0x215c5a){return BPromise[_0x2ddc('0x1d')](_0x215c5a);}return _0x2c9e54[_0x2ddc('0x1e')]();};}function saveUpdates(_0x1f16b4,_0x4d8e86){return function(_0x319756){if(_0x319756){return _0x319756[_0x2ddc('0x1f')](_0x1f16b4)['then'](function(_0x520cc0){return _0x520cc0;});}return null;};}function removeEntity(_0x388730,_0x3badaa){return function(_0x1ac490){if(_0x1ac490){return _0x1ac490[_0x2ddc('0x20')]()[_0x2ddc('0x21')](function(){_0x388730[_0x2ddc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25114e,_0xaf7f55){return function(_0x152221){if(!_0x152221){_0x25114e[_0x2ddc('0x15')](0x194);}return _0x152221;};}function handleError(_0x1e970e,_0x18f396){_0x18f396=_0x18f396||0x1f4;return function(_0x1b1835){logger['error'](_0x1b1835[_0x2ddc('0x22')]);if(_0x1b1835[_0x2ddc('0x23')]){delete _0x1b1835[_0x2ddc('0x23')];}_0x1e970e[_0x2ddc('0x16')](_0x18f396)[_0x2ddc('0x24')](_0x1b1835);};}exports[_0x2ddc('0x25')]=function(_0x3adb34,_0x28b50e){var _0xd87c79={},_0x329812={},_0x1926ce={'count':0x0,'rows':[]};var _0x2f6dea=_[_0x2ddc('0x26')](db[_0x2ddc('0x27')]['rawAttributes'],function(_0x25f956){return{'name':_0x25f956[_0x2ddc('0x28')],'type':_0x25f956[_0x2ddc('0x29')][_0x2ddc('0x2a')]};});_0x329812['model']=_[_0x2ddc('0x26')](_0x2f6dea,_0x2ddc('0x23'));_0x329812[_0x2ddc('0x2b')]=_[_0x2ddc('0x2c')](_0x3adb34['query']);_0x329812[_0x2ddc('0x2d')]=_['intersection'](_0x329812[_0x2ddc('0x2e')],_0x329812[_0x2ddc('0x2b')]);_0xd87c79[_0x2ddc('0x2f')]=_['intersection'](_0x329812['model'],qs['fields'](_0x3adb34[_0x2ddc('0x2b')]['fields']));_0xd87c79[_0x2ddc('0x2f')]=_0xd87c79[_0x2ddc('0x2f')][_0x2ddc('0x30')]?_0xd87c79['attributes']:_0x329812[_0x2ddc('0x2e')];if(!_0x3adb34[_0x2ddc('0x2b')][_0x2ddc('0x31')](_0x2ddc('0x32'))){_0xd87c79['limit']=qs['limit'](_0x3adb34[_0x2ddc('0x2b')][_0x2ddc('0x1a')]);_0xd87c79[_0x2ddc('0x19')]=qs['offset'](_0x3adb34['query'][_0x2ddc('0x19')]);}_0xd87c79['order']=qs[_0x2ddc('0x33')](_0x3adb34['query'][_0x2ddc('0x33')]);_0xd87c79[_0x2ddc('0x34')]=qs[_0x2ddc('0x2d')](_['pick'](_0x3adb34['query'],_0x329812[_0x2ddc('0x2d')]),_0x2f6dea);if(_0x3adb34[_0x2ddc('0x2b')][_0x2ddc('0x35')]){_0xd87c79[_0x2ddc('0x34')]=_['merge'](_0xd87c79['where'],{'$or':_[_0x2ddc('0x26')](_0x2f6dea,function(_0xc42712){if(_0xc42712['type']!=='VIRTUAL'){var _0x2e429a={};_0x2e429a[_0xc42712['name']]={'$like':'%'+_0x3adb34[_0x2ddc('0x2b')][_0x2ddc('0x35')]+'%'};return _0x2e429a;}})});}_0xd87c79=_[_0x2ddc('0x36')]({},_0xd87c79,_0x3adb34['options']);var _0x350698={'where':_0xd87c79[_0x2ddc('0x34')]};return db[_0x2ddc('0x27')][_0x2ddc('0x18')](_0x350698)[_0x2ddc('0x21')](function(_0x58ede4){_0x1926ce[_0x2ddc('0x18')]=_0x58ede4;if(_0x3adb34[_0x2ddc('0x2b')][_0x2ddc('0x37')]){_0xd87c79[_0x2ddc('0x38')]=[{'all':!![]}];}return db[_0x2ddc('0x27')][_0x2ddc('0x39')](_0xd87c79);})['then'](function(_0x1ea8c6){_0x1926ce[_0x2ddc('0x3a')]=_0x1ea8c6;return _0x1926ce;})[_0x2ddc('0x21')](respondWithFilteredResult(_0x28b50e,_0xd87c79))[_0x2ddc('0x3b')](handleError(_0x28b50e,null));};exports['show']=function(_0x238287,_0x37595b){var _0x2f0d3e={'raw':!![],'where':{'id':_0x238287[_0x2ddc('0x3c')]['id']}},_0x9afa41={};_0x9afa41[_0x2ddc('0x2e')]=_[_0x2ddc('0x2c')](db['Attachment'][_0x2ddc('0x3d')]);_0x9afa41[_0x2ddc('0x2b')]=_[_0x2ddc('0x2c')](_0x238287[_0x2ddc('0x2b')]);_0x9afa41[_0x2ddc('0x2d')]=_[_0x2ddc('0x3e')](_0x9afa41['model'],_0x9afa41[_0x2ddc('0x2b')]);_0x2f0d3e[_0x2ddc('0x2f')]=_['intersection'](_0x9afa41['model'],qs[_0x2ddc('0x3f')](_0x238287[_0x2ddc('0x2b')][_0x2ddc('0x3f')]));_0x2f0d3e[_0x2ddc('0x2f')]=_0x2f0d3e['attributes'][_0x2ddc('0x30')]?_0x2f0d3e[_0x2ddc('0x2f')]:_0x9afa41[_0x2ddc('0x2e')];if(_0x238287[_0x2ddc('0x2b')][_0x2ddc('0x37')]){_0x2f0d3e[_0x2ddc('0x38')]=[{'all':!![]}];}_0x2f0d3e=_['merge']({},_0x2f0d3e,_0x238287['options']);return db['Attachment'][_0x2ddc('0x40')](_0x2f0d3e)[_0x2ddc('0x21')](handleEntityNotFound(_0x37595b,null))['then'](respondWithResult(_0x37595b,null))[_0x2ddc('0x3b')](handleError(_0x37595b,null));};exports['clone']=function(_0x2c8ab5,_0xc92acf){var _0x3621ed={'where':{'id':_0x2c8ab5[_0x2ddc('0x3c')]['id']}},_0x4abceb={};_0x4abceb['model']=_[_0x2ddc('0x2c')](db[_0x2ddc('0x27')][_0x2ddc('0x3d')]);_0x3621ed[_0x2ddc('0x2f')]=_['intersection'](_0x4abceb[_0x2ddc('0x2e')],qs['fields'](_0x2c8ab5[_0x2ddc('0x2b')][_0x2ddc('0x3f')]));_0x3621ed['attributes']=_0x3621ed[_0x2ddc('0x2f')][_0x2ddc('0x30')]?_0x3621ed[_0x2ddc('0x2f')]:_0x4abceb[_0x2ddc('0x2e')];if(_0x2c8ab5[_0x2ddc('0x2b')][_0x2ddc('0x37')]){_0x3621ed['include']=[{'all':!![]}];}_0x3621ed=_[_0x2ddc('0x36')]({},_0x3621ed,_0x2c8ab5[_0x2ddc('0x41')]);return db[_0x2ddc('0x27')][_0x2ddc('0x40')](_0x3621ed)[_0x2ddc('0x21')](handleEntityNotFound(_0xc92acf,null))[_0x2ddc('0x21')](function(_0x3a2adb){if(_0x3a2adb){var _0x4cef28=_0x3a2adb[_0x2ddc('0x42')]({'plain':!![]});_0x4cef28=qs['omit'](_0x4cef28,['id',_0x2ddc('0x43'),'updatedAt']);_0x2c8ab5[_0x2ddc('0x44')]=_[_0x2ddc('0x45')](_0x2c8ab5['body'],['id',_0x2ddc('0x43'),_0x2ddc('0x46')]);return db['Attachment'][_0x2ddc('0x47')](_[_0x2ddc('0x36')](_0x4cef28,_0x2c8ab5['body']),{'include':_0x2c8ab5[_0x2ddc('0x2b')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x2ddc('0x21')](respondWithResult(_0xc92acf,0xc9))[_0x2ddc('0x3b')](handleError(_0xc92acf,null));};exports['update']=function(_0x5ce10c,_0x5e6a79){if(_0x5ce10c[_0x2ddc('0x44')]['id']){delete _0x5ce10c[_0x2ddc('0x44')]['id'];}return db[_0x2ddc('0x27')][_0x2ddc('0x40')]({'where':{'id':_0x5ce10c[_0x2ddc('0x3c')]['id']}})[_0x2ddc('0x21')](handleEntityNotFound(_0x5e6a79,null))['then'](saveUpdates(_0x5ce10c[_0x2ddc('0x44')],null))['then'](respondWithResult(_0x5e6a79,null))['catch'](handleError(_0x5e6a79,null));};exports['destroy']=function(_0xc96a69,_0x52f33e){return db['Attachment'][_0x2ddc('0x40')]({'where':{'id':_0xc96a69[_0x2ddc('0x3c')]['id']}})[_0x2ddc('0x21')](handleEntityNotFound(_0x52f33e,null))[_0x2ddc('0x21')](removeEntity(_0x52f33e,null))[_0x2ddc('0x3b')](handleError(_0x52f33e,null));};exports['create']=function(_0x3c042b,_0x1eaae3,_0xfe7029){_0x3c042b[_0x2ddc('0x44')][_0x2ddc('0x23')]=_0x3c042b[_0x2ddc('0x48')][_0x2ddc('0x49')];_0x3c042b[_0x2ddc('0x44')][_0x2ddc('0x4a')]=_0x3c042b[_0x2ddc('0x48')][_0x2ddc('0x4b')];_0x3c042b['body'][_0x2ddc('0x29')]=_0x3c042b['file']['mimetype'];return db['Attachment'][_0x2ddc('0x47')](_0x3c042b['body'])[_0x2ddc('0x21')](respondWithResult(_0x1eaae3,0xc9))[_0x2ddc('0x3b')](handleError(_0x1eaae3,null));};exports[_0x2ddc('0x4c')]=function(_0x56b027,_0xfcf408,_0x33083b){return db[_0x2ddc('0x27')][_0x2ddc('0x4d')]({'where':{'id':_0x56b027['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0xfcf408,null))['then'](function(_0x138a50){if(_0x138a50){return _0xfcf408[_0x2ddc('0x4c')](path[_0x2ddc('0x4e')](config[_0x2ddc('0x4f')],'server/files/attachments/',_0x138a50[_0x2ddc('0x4a')]));}})[_0x2ddc('0x3b')](handleError(_0xfcf408,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index dd224ba..09d517d 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 _0x4959=['attachments','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','Attachment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4959,0x9b));var _0x9495=function(_0x135f17,_0x598388){_0x135f17=_0x135f17-0x0;var _0x28ca45=_0x4959[_0x135f17];return _0x28ca45;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9495('0x0'))(_0x9495('0x1'));var moment=require(_0x9495('0x2'));var BPromise=require('bluebird');var rp=require(_0x9495('0x3'));var fs=require('fs');var path=require(_0x9495('0x4'));var rimraf=require(_0x9495('0x5'));var config=require(_0x9495('0x6'));var attributes=require('./attachment.attributes');module[_0x9495('0x7')]=function(_0x2225a0,_0x2c716d){return _0x2225a0[_0x9495('0x8')](_0x9495('0x9'),attributes,{'tableName':_0x9495('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe027=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','Attachment','lodash','util'];(function(_0x24682e,_0x2f4ec7){var _0x281dea=function(_0x39837d){while(--_0x39837d){_0x24682e['push'](_0x24682e['shift']());}};_0x281dea(++_0x2f4ec7);}(_0xe027,0x106));var _0x7e02=function(_0x20ce55,_0x190932){_0x20ce55=_0x20ce55-0x0;var _0x4740b7=_0xe027[_0x20ce55];return _0x4740b7;};'use strict';var _=require(_0x7e02('0x0'));var util=require(_0x7e02('0x1'));var logger=require(_0x7e02('0x2'))(_0x7e02('0x3'));var moment=require(_0x7e02('0x4'));var BPromise=require(_0x7e02('0x5'));var rp=require(_0x7e02('0x6'));var fs=require('fs');var path=require(_0x7e02('0x7'));var rimraf=require(_0x7e02('0x8'));var config=require(_0x7e02('0x9'));var attributes=require(_0x7e02('0xa'));module['exports']=function(_0x5811b3,_0x2b08a3){return _0x5811b3['define'](_0x7e02('0xb'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 8f4bef6..93ea48b 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 _0x730d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','Attachment,\x20%s,\x20%s','message','result','catch','Attachment','create','body','options','info','CreateAttachment','lodash','moment','bluebird','randomstring'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x730d,0x11e));var _0xd730=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x730d[_0x550d12];return _0x12103d;};'use strict';var _=require(_0xd730('0x0'));var util=require('util');var moment=require(_0xd730('0x1'));var BPromise=require(_0xd730('0x2'));var rs=require(_0xd730('0x3'));var fs=require('fs');var Redis=require(_0xd730('0x4'));var db=require(_0xd730('0x5'))['db'];var utils=require(_0xd730('0x6'));var logger=require(_0xd730('0x7'))(_0xd730('0x8'));var config=require('../../config/environment');var jayson=require(_0xd730('0x9'));var client=jayson[_0xd730('0xa')][_0xd730('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc46b9c,_0x5a1027,_0x375b99){return new BPromise(function(_0xfe9ae4,_0x1ef189){return client[_0xd730('0xc')](_0xc46b9c,_0x375b99)[_0xd730('0xd')](function(_0x49596e){logger['info']('Attachment,\x20%s,\x20%s',_0x5a1027,_0xd730('0xe'));logger[_0xd730('0xf')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5a1027,_0xd730('0xe'),JSON[_0xd730('0x10')](_0x49596e));if(_0x49596e[_0xd730('0x11')]){if(_0x49596e['error'][_0xd730('0x12')]===0x1f4){logger[_0xd730('0x11')](_0xd730('0x13'),_0x5a1027,_0x49596e[_0xd730('0x11')][_0xd730('0x14')]);return _0x1ef189(_0x49596e[_0xd730('0x11')][_0xd730('0x14')]);}logger['error'](_0xd730('0x13'),_0x5a1027,_0x49596e[_0xd730('0x11')]['message']);return _0xfe9ae4(_0x49596e[_0xd730('0x11')]['message']);}else{logger['info'](_0xd730('0x13'),_0x5a1027,_0xd730('0xe'));_0xfe9ae4(_0x49596e[_0xd730('0x15')][_0xd730('0x14')]);}})[_0xd730('0x16')](function(_0x443bcf){logger['error'](_0xd730('0x13'),_0x5a1027,_0x443bcf);_0x1ef189(_0x443bcf);});});}exports['CreateAttachment']=function(_0x46e6a1){var _0x403e17=this;return new Promise(function(_0x62bd1d,_0x4527ce){return db[_0xd730('0x17')][_0xd730('0x18')](_0x46e6a1[_0xd730('0x19')],{'raw':_0x46e6a1[_0xd730('0x1a')]?_0x46e6a1[_0xd730('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xd730('0xd')](function(_0x3e965d){logger[_0xd730('0x1b')]('CreateAttachment',_0x46e6a1);logger[_0xd730('0xf')](_0xd730('0x1c'),_0x46e6a1,JSON[_0xd730('0x10')](_0x3e965d));_0x62bd1d(_0x3e965d);})[_0xd730('0x16')](function(_0x13cb64){logger[_0xd730('0x11')]('CreateAttachment',_0x13cb64[_0xd730('0x14')],_0x46e6a1);_0x4527ce(_0x403e17[_0xd730('0x11')](0x1f4,_0x13cb64[_0xd730('0x14')]));});});}; \ No newline at end of file +var _0xb8d5=['debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateAttachment','Attachment','body','options'];(function(_0x8e2d4d,_0x310930){var _0x5e3047=function(_0x4665e4){while(--_0x4665e4){_0x8e2d4d['push'](_0x8e2d4d['shift']());}};_0x5e3047(++_0x310930);}(_0xb8d5,0x6d));var _0x5b8d=function(_0x2f301c,_0x2b6558){_0x2f301c=_0x2f301c-0x0;var _0x541357=_0xb8d5[_0x2f301c];return _0x541357;};'use strict';var _=require(_0x5b8d('0x0'));var util=require('util');var moment=require(_0x5b8d('0x1'));var BPromise=require(_0x5b8d('0x2'));var rs=require(_0x5b8d('0x3'));var fs=require('fs');var Redis=require(_0x5b8d('0x4'));var db=require(_0x5b8d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b8d('0x6'))(_0x5b8d('0x7'));var config=require(_0x5b8d('0x8'));var jayson=require(_0x5b8d('0x9'));var client=jayson['client'][_0x5b8d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1164f2,_0x2eab7d,_0xa777b1){return new BPromise(function(_0xe22e99,_0x4b5b19){return client[_0x5b8d('0xb')](_0x1164f2,_0xa777b1)['then'](function(_0x1cc4fa){logger[_0x5b8d('0xc')](_0x5b8d('0xd'),_0x2eab7d,_0x5b8d('0xe'));logger['debug'](_0x5b8d('0xf'),_0x2eab7d,_0x5b8d('0xe'),JSON[_0x5b8d('0x10')](_0x1cc4fa));if(_0x1cc4fa['error']){if(_0x1cc4fa['error'][_0x5b8d('0x11')]===0x1f4){logger[_0x5b8d('0x12')](_0x5b8d('0xd'),_0x2eab7d,_0x1cc4fa['error']['message']);return _0x4b5b19(_0x1cc4fa[_0x5b8d('0x12')][_0x5b8d('0x13')]);}logger[_0x5b8d('0x12')](_0x5b8d('0xd'),_0x2eab7d,_0x1cc4fa[_0x5b8d('0x12')]['message']);return _0xe22e99(_0x1cc4fa[_0x5b8d('0x12')][_0x5b8d('0x13')]);}else{logger[_0x5b8d('0xc')](_0x5b8d('0xd'),_0x2eab7d,'request\x20sent');_0xe22e99(_0x1cc4fa[_0x5b8d('0x14')][_0x5b8d('0x13')]);}})[_0x5b8d('0x15')](function(_0x46ae84){logger[_0x5b8d('0x12')]('Attachment,\x20%s,\x20%s',_0x2eab7d,_0x46ae84);_0x4b5b19(_0x46ae84);});});}exports[_0x5b8d('0x16')]=function(_0x492a0c){var _0x4a5d5f=this;return new Promise(function(_0x4c731b,_0x181d34){return db[_0x5b8d('0x17')]['create'](_0x492a0c[_0x5b8d('0x18')],{'raw':_0x492a0c[_0x5b8d('0x19')]?_0x492a0c[_0x5b8d('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4b4b38){logger[_0x5b8d('0xc')](_0x5b8d('0x16'),_0x492a0c);logger[_0x5b8d('0x1a')](_0x5b8d('0x16'),_0x492a0c,JSON['stringify'](_0x4b4b38));_0x4c731b(_0x4b4b38);})[_0x5b8d('0x15')](function(_0x4d9f29){logger[_0x5b8d('0x12')]('CreateAttachment',_0x4d9f29[_0x5b8d('0x13')],_0x492a0c);_0x181d34(_0x4a5d5f[_0x5b8d('0x12')](0x1f4,_0x4d9f29[_0x5b8d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 67af451..ffa3582 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 _0x672d=['single','file','create','put','update','delete','destroy','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','download','post','/:id/clone','clone','join','root','server/files/attachments/','format','%s-%s','now','replace'];(function(_0x36665f,_0x4f9488){var _0x481d25=function(_0x3779cc){while(--_0x3779cc){_0x36665f['push'](_0x36665f['shift']());}};_0x481d25(++_0x4f9488);}(_0x672d,0x181));var _0xd672=function(_0x4c4a94,_0x4fa642){_0x4c4a94=_0x4c4a94-0x0;var _0x4fb4a7=_0x672d[_0x4c4a94];return _0x4fb4a7;};'use strict';var multer=require(_0xd672('0x0'));var util=require('util');var path=require(_0xd672('0x1'));var timeout=require(_0xd672('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd672('0x3'));var config=require(_0xd672('0x4'));var controller=require('./attachment.controller');router[_0xd672('0x5')]('/',auth['isAuthenticated'](),controller[_0xd672('0x6')]);router[_0xd672('0x5')](_0xd672('0x7'),auth[_0xd672('0x8')](),controller[_0xd672('0x9')]);router[_0xd672('0x5')]('/:id/download',auth[_0xd672('0x8')](),controller[_0xd672('0xa')]);router[_0xd672('0xb')](_0xd672('0xc'),auth[_0xd672('0x8')](),controller[_0xd672('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5ae10e,_0x10a391,_0x1a02d9){_0x1a02d9(null,path[_0xd672('0xe')](config[_0xd672('0xf')],_0xd672('0x10')));},'filename':function(_0x4f2338,_0x339813,_0x51f4db){_0x51f4db(null,util[_0xd672('0x11')](_0xd672('0x12'),Date[_0xd672('0x13')](),_0x339813['originalname'][_0xd672('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd672('0xb')]('/',upload[_0xd672('0x15')](_0xd672('0x16')),controller[_0xd672('0x17')]);router[_0xd672('0x18')]('/:id',auth[_0xd672('0x8')](),controller[_0xd672('0x19')]);router[_0xd672('0x1a')]('/:id',auth[_0xd672('0x8')](),controller[_0xd672('0x1b')]);module[_0xd672('0x1c')]=router; \ No newline at end of file +var _0xcb1a=['destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./attachment.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','post','/:id/clone','clone','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','create','put'];(function(_0x59c321,_0x2b4f2c){var _0x263f97=function(_0xc1ca0a){while(--_0xc1ca0a){_0x59c321['push'](_0x59c321['shift']());}};_0x263f97(++_0x2b4f2c);}(_0xcb1a,0xb6));var _0xacb1=function(_0x8c688a,_0x50d6c1){_0x8c688a=_0x8c688a-0x0;var _0x566eca=_0xcb1a[_0x8c688a];return _0x566eca;};'use strict';var multer=require(_0xacb1('0x0'));var util=require(_0xacb1('0x1'));var path=require(_0xacb1('0x2'));var timeout=require(_0xacb1('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xacb1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xacb1('0x5'));var controller=require(_0xacb1('0x6'));router['get']('/',auth[_0xacb1('0x7')](),controller[_0xacb1('0x8')]);router[_0xacb1('0x9')](_0xacb1('0xa'),auth[_0xacb1('0x7')](),controller[_0xacb1('0xb')]);router['get'](_0xacb1('0xc'),auth[_0xacb1('0x7')](),controller[_0xacb1('0xd')]);router[_0xacb1('0xe')](_0xacb1('0xf'),auth[_0xacb1('0x7')](),controller[_0xacb1('0x10')]);var upload=multer({'storage':multer[_0xacb1('0x11')]({'destination':function(_0x1d97a2,_0x13955b,_0x3eb9c1){_0x3eb9c1(null,path['join'](config[_0xacb1('0x12')],_0xacb1('0x13')));},'filename':function(_0x47bbe7,_0x5b868c,_0x436df5){_0x436df5(null,util[_0xacb1('0x14')](_0xacb1('0x15'),Date[_0xacb1('0x16')](),_0x5b868c[_0xacb1('0x17')][_0xacb1('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0xacb1('0x19')]('file'),controller[_0xacb1('0x1a')]);router[_0xacb1('0x1b')](_0xacb1('0xa'),auth[_0xacb1('0x7')](),controller['update']);router['delete'](_0xacb1('0xa'),auth[_0xacb1('0x7')](),controller[_0xacb1('0x1c')]);module[_0xacb1('0x1d')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index b6a9ee9..72aadcd 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 _0x59e0=['User','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blockedAt','clearBlockUser','getLicense','passport','passport-google-oauth20','Strategy','moment','signToken','login','authenticate','google','/login','profile','email','callback','use','clientID','clientSecret','secret','callbackURL','allowedLoginAttempts'];(function(_0x3a062d,_0x503f80){var _0x2c5410=function(_0x1a5d54){while(--_0x1a5d54){_0x3a062d['push'](_0x3a062d['shift']());}};_0x2c5410(++_0x503f80);}(_0x59e0,0x1e6));var _0x059e=function(_0x61ed56,_0x4d394a){_0x61ed56=_0x61ed56-0x0;var _0x224ba8=_0x59e0[_0x61ed56];return _0x224ba8;};'use strict';var _=require('lodash');var passport=require(_0x059e('0x0'));var GoogleStrategy=require(_0x059e('0x1'))[_0x059e('0x2')];var moment=require(_0x059e('0x3'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')[_0x059e('0x4')];var utils=require('../../config/utils');exports[_0x059e('0x5')]=passport[_0x059e('0x6')](_0x059e('0x7'),{'failureRedirect':_0x059e('0x8'),'scope':[_0x059e('0x9'),_0x059e('0xa')],'session':![]});exports[_0x059e('0xb')]=passport[_0x059e('0x6')](_0x059e('0x7'),{'failureRedirect':'/login','session':![]});passport[_0x059e('0xc')](new GoogleStrategy({'clientID':config[_0x059e('0x7')]?config[_0x059e('0x7')][_0x059e('0xd')]:'id','clientSecret':config[_0x059e('0x7')]?config['google'][_0x059e('0xe')]:_0x059e('0xf'),'callbackURL':config[_0x059e('0x7')]?config['google'][_0x059e('0x10')]:''},function(_0x288e0c,_0x48f1df,_0x414ff7,_0x3adcc9){var _0x49679a,_0x416eb7;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x059e('0x11'),'blockDuration'],'raw':!![]})['then'](function(_0x9adcac){_0x49679a=_0x9adcac;return db[_0x059e('0x12')]['find']({'where':{'email':_['map'](_0x414ff7['emails'],'value'),'role':{'$or':[_0x059e('0x13'),_0x059e('0x14'),'agent']}}});})[_0x059e('0x15')](function(_0x362262){_0x416eb7=_0x362262;if(_0x416eb7){if(_0x416eb7[_0x059e('0x16')]){return _0x3adcc9(_0x059e('0x17'));}else if(_0x49679a[_0x059e('0x18')]>0x0){if(_0x416eb7['blocked']){if(moment(_0x416eb7[_0x059e('0x19')])['add'](_0x49679a['blockDuration'],'minutes')>moment()){return _0x3adcc9(_0x059e('0x17'));}else{return utils[_0x059e('0x1a')](_0x416eb7,0x0,![],null)['then'](function(){return utils[_0x059e('0x1b')](_0x416eb7);})[_0x059e('0x15')](function(){return _0x3adcc9(null,_0x416eb7);});}}else{return utils[_0x059e('0x1b')](_0x416eb7)[_0x059e('0x15')](function(){return _0x3adcc9(null,_0x416eb7);});}}else{return utils['getLicense'](_0x416eb7)[_0x059e('0x15')](function(){return _0x3adcc9(null,_0x416eb7);});}}return _0x3adcc9(_0x059e('0x17'));})['catch'](function(_0x5aab7d){_0x3adcc9(_0x5aab7d);});})); \ No newline at end of file +var _0x4112=['moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','authenticate','/login','profile','email','callback','google','clientID','secret','findOne','blockDuration','then','find','map','emails','value','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy'];(function(_0x553279,_0x29ddf1){var _0x55e691=function(_0x55ed6a){while(--_0x55ed6a){_0x553279['push'](_0x553279['shift']());}};_0x55e691(++_0x29ddf1);}(_0x4112,0xd5));var _0x2411=function(_0x199dc1,_0x7d5d6f){_0x199dc1=_0x199dc1-0x0;var _0x2639c4=_0x4112[_0x199dc1];return _0x2639c4;};'use strict';var _=require(_0x2411('0x0'));var passport=require(_0x2411('0x1'));var GoogleStrategy=require(_0x2411('0x2'))[_0x2411('0x3')];var moment=require(_0x2411('0x4'));var db=require(_0x2411('0x5'))['db'];var config=require(_0x2411('0x6'));var signToken=require(_0x2411('0x7'))[_0x2411('0x8')];var utils=require(_0x2411('0x9'));exports['login']=passport[_0x2411('0xa')]('google',{'failureRedirect':_0x2411('0xb'),'scope':[_0x2411('0xc'),_0x2411('0xd')],'session':![]});exports[_0x2411('0xe')]=passport[_0x2411('0xa')](_0x2411('0xf'),{'failureRedirect':'/login','session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x2411('0xf')]?config[_0x2411('0xf')][_0x2411('0x10')]:'id','clientSecret':config[_0x2411('0xf')]?config[_0x2411('0xf')]['clientSecret']:_0x2411('0x11'),'callbackURL':config['google']?config[_0x2411('0xf')]['callbackURL']:''},function(_0x47f31e,_0x33e835,_0xef294f,_0x1c5870){var _0x501e59,_0x5d9197;return db['Setting'][_0x2411('0x12')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x2411('0x13')],'raw':!![]})[_0x2411('0x14')](function(_0x590cff){_0x501e59=_0x590cff;return db['User'][_0x2411('0x15')]({'where':{'email':_[_0x2411('0x16')](_0xef294f[_0x2411('0x17')],_0x2411('0x18')),'role':{'$or':['admin','user','agent']}}});})[_0x2411('0x14')](function(_0x1975ee){_0x5d9197=_0x1975ee;if(_0x5d9197){if(_0x5d9197[_0x2411('0x19')]){return _0x1c5870(_0x2411('0x1a'));}else if(_0x501e59[_0x2411('0x13')]>0x0){if(_0x5d9197[_0x2411('0x1b')]){if(moment(_0x5d9197['blockedAt'])[_0x2411('0x1c')](_0x501e59['blockDuration'],'minutes')>moment()){return _0x1c5870(_0x2411('0x1a'));}else{return utils['clearBlockUser'](_0x5d9197,0x0,![],null)[_0x2411('0x14')](function(){return utils['getLicense'](_0x5d9197);})[_0x2411('0x14')](function(){return _0x1c5870(null,_0x5d9197);});}}else{return utils[_0x2411('0x1d')](_0x5d9197)['then'](function(){return _0x1c5870(null,_0x5d9197);});}}else{return utils['getLicense'](_0x5d9197)[_0x2411('0x14')](function(){return _0x1c5870(null,_0x5d9197);});}}return _0x1c5870(_0x2411('0x1a'));})[_0x2411('0x1e')](function(_0x206686){_0x1c5870(_0x206686);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 19e69c0..e362226 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 _0xc3b0=['login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','get'];(function(_0x32540e,_0x33ac43){var _0x69befd=function(_0x30bcad){while(--_0x30bcad){_0x32540e['push'](_0x32540e['shift']());}};_0x69befd(++_0x33ac43);}(_0xc3b0,0x166));var _0x0c3b=function(_0x5a6bf5,_0x544768){_0x5a6bf5=_0x5a6bf5-0x0;var _0x1d1b78=_0xc3b0[_0x5a6bf5];return _0x1d1b78;};'use strict';var express=require(_0x0c3b('0x0'));var passport=require(_0x0c3b('0x1'));var router=express[_0x0c3b('0x2')]();var controller=require(_0x0c3b('0x3'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0x0c3b('0x4')]('/',controller[_0x0c3b('0x5')]);router['get'](_0x0c3b('0x6'),controller[_0x0c3b('0x7')],authService[_0x0c3b('0x8')],userController['login'],authService[_0x0c3b('0x9')]);module[_0x0c3b('0xa')]=router; \ No newline at end of file +var _0x66fa=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router'];(function(_0x3011b7,_0x56b4b0){var _0x304ca2=function(_0x5832be){while(--_0x5832be){_0x3011b7['push'](_0x3011b7['shift']());}};_0x304ca2(++_0x56b4b0);}(_0x66fa,0x168));var _0xa66f=function(_0x45ca16,_0x4df970){_0x45ca16=_0x45ca16-0x0;var _0x13ceea=_0x66fa[_0x45ca16];return _0x13ceea;};'use strict';var express=require(_0xa66f('0x0'));var passport=require(_0xa66f('0x1'));var router=express[_0xa66f('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0xa66f('0x3'));router[_0xa66f('0x4')]('/',controller[_0xa66f('0x5')]);router[_0xa66f('0x4')](_0xa66f('0x6'),controller[_0xa66f('0x7')],authService[_0xa66f('0x8')],userController[_0xa66f('0x5')],authService[_0xa66f('0x9')]);module[_0xa66f('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index deeade0..4842d78 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 _0x8f9d=['catch','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','port','secure','auth','merge','format','\x22%s\x22\x20<%s>','request','error','stringify','send','message','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','email','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','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','status','Reset\x20Email\x20sent!','reset','params','token','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','Password\x20reset!','use','util','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','findOne','name','password','salt','role','disabled','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','loginAttempts','add','minutes','clearBlockUser','blocked','blockDuration','getLicense'];(function(_0x4bd632,_0x1cfa89){var _0xb49e18=function(_0x2d9057){while(--_0x2d9057){_0x4bd632['push'](_0x4bd632['shift']());}};_0xb49e18(++_0x1cfa89);}(_0x8f9d,0x93));var _0xd8f9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8f9d[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0xd8f9('0x0'));var passport=require('passport');var LocalStrategy=require(_0xd8f9('0x1'))['Strategy'];var jayson=require(_0xd8f9('0x2'));var _=require(_0xd8f9('0x3'));var rs=require(_0xd8f9('0x4'));var moment=require(_0xd8f9('0x5'));var db=require(_0xd8f9('0x6'))['db'];var authService=require(_0xd8f9('0x7'));var utils=require(_0xd8f9('0x8'));var client=jayson['client'][_0xd8f9('0x9')]({'port':0x232b});function localAuthenticate(_0x24dd1e,_0x25d417,_0x241aaa,_0xf6105){var _0x5c410f,_0x46babd;return db[_0xd8f9('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xd8f9('0xb'),'blockDuration'],'raw':!![]})['then'](function(_0x421aca){_0x5c410f=_0x421aca;return _0x24dd1e[_0xd8f9('0xc')]({'attributes':['id',_0xd8f9('0xd'),_0xd8f9('0xe'),_0xd8f9('0xf'),_0xd8f9('0x10'),_0xd8f9('0x11'),'blocked',_0xd8f9('0x12'),'loginAttempts'],'where':{'name':_0x25d417,'role':{'$or':[_0xd8f9('0x13'),_0xd8f9('0x14'),_0xd8f9('0x15')]}}});})['then'](function(_0x46468b){if(!_0x46468b||_0x46468b&&_0x46468b[_0xd8f9('0xd')]!==_0x25d417){throw new Error(_0xd8f9('0x16'));}else{_0x46babd=_0x46468b;return _0x46babd;}})[_0xd8f9('0x17')](function(){_0x46babd['authenticate'](_0x241aaa,function(_0x3529e9,_0x1525d6){var _0x234901=_0x46babd[_0xd8f9('0x18')]+0x1;if(_0x3529e9){return _0xf6105(_0x3529e9);}else if(!_0x1525d6){if(_0x46babd[_0xd8f9('0x11')]){return _0xf6105(null,![],{'message':_0xd8f9('0x16')});}else if(_0x5c410f[_0xd8f9('0xb')]>0x0){if(_0x46babd['blocked']){if(_0x5c410f['blockDuration']>0x0){if(moment(_0x46babd[_0xd8f9('0x12')])[_0xd8f9('0x19')](_0x5c410f['blockDuration'],_0xd8f9('0x1a'))>moment()){return _0xf6105(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xd8f9('0x1b')](_0x46babd,_0x234901,![],null)['then'](function(){return _0xf6105(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0xf6105(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x234901>=_0x5c410f[_0xd8f9('0xb')]){return utils['clearBlockUser'](_0x46babd,0x0,!![],moment())[_0xd8f9('0x17')](function(){return _0xf6105(null,![],{'message':_0xd8f9('0x16')});});}else{return utils[_0xd8f9('0x1b')](_0x46babd,_0x234901,![],null)[_0xd8f9('0x17')](function(){return _0xf6105(null,![],{'message':_0xd8f9('0x16')});});}}}else{return _0xf6105(null,![],{'message':_0xd8f9('0x16')});}}else{if(_0x46babd['disabled']){return _0xf6105(null,![],{'message':_0xd8f9('0x16')});}else if(_0x5c410f[_0xd8f9('0xb')]>0x0){if(_0x46babd[_0xd8f9('0x1c')]){if(_0x5c410f[_0xd8f9('0x1d')]>0x0){if(moment(_0x46babd[_0xd8f9('0x12')])[_0xd8f9('0x19')](_0x5c410f['blockDuration'],_0xd8f9('0x1a'))>moment()){return _0xf6105(null,![],{'message':_0xd8f9('0x16')});}else{return utils[_0xd8f9('0x1b')](_0x46babd,0x0,![],null)[_0xd8f9('0x17')](function(){return utils[_0xd8f9('0x1e')](_0x46babd);})['then'](function(){return _0xf6105(null,_0x46babd);});}}else{return _0xf6105(null,![],{'message':_0xd8f9('0x16')});}}else{return utils[_0xd8f9('0x1b')](_0x46babd,0x0,![],null)[_0xd8f9('0x17')](function(){return utils[_0xd8f9('0x1e')](_0x46babd);})[_0xd8f9('0x17')](function(){return _0xf6105(null,_0x46babd);})[_0xd8f9('0x1f')](function(_0x175123){return _0xf6105(null,![],_0x175123);});}}else{if(_0x46babd[_0xd8f9('0x1c')]){return _0xf6105(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xd8f9('0x1e')](_0x46babd)[_0xd8f9('0x17')](function(){return _0xf6105(null,_0x46babd);});}}}});})[_0xd8f9('0x1f')](function(_0x58a3ca){return _0xf6105(null,![],_0x58a3ca);});}function sendServiceMail(_0x5bd32e){return db['MailAccount'][_0xd8f9('0x20')]({'where':{'service':!![]},'attributes':['id',_0xd8f9('0xd'),'email'],'include':[{'model':db[_0xd8f9('0x21')],'as':_0xd8f9('0x22')}]})['then'](function(_0x4b0de7){if(!_0x4b0de7){throw new Error(_0xd8f9('0x23'));}var _0x2786db={'tls':{'rejectUnauthorized':![]}};if(_0x4b0de7['Smtp'][_0xd8f9('0x24')]){_0x2786db['service']=_0x4b0de7[_0xd8f9('0x22')][_0xd8f9('0x24')];}else{_0x2786db['host']=_0x4b0de7[_0xd8f9('0x22')]['host'];_0x2786db[_0xd8f9('0x25')]=_0x4b0de7[_0xd8f9('0x22')][_0xd8f9('0x25')];_0x2786db[_0xd8f9('0x26')]=_0x4b0de7[_0xd8f9('0x22')][_0xd8f9('0x26')];}if(_0x4b0de7[_0xd8f9('0x22')]['authentication']){_0x2786db[_0xd8f9('0x27')]={'user':_0x4b0de7['Smtp']['user'],'pass':_0x4b0de7['Smtp']['pass']};}var _0x3690d7={'account':_0x2786db,'message':_[_0xd8f9('0x28')]({'from':util[_0xd8f9('0x29')](_0xd8f9('0x2a'),_0x4b0de7[_0xd8f9('0xd')],_0x4b0de7['email']||_0x4b0de7['Smtp'][_0xd8f9('0x14')])},_0x5bd32e)};return client[_0xd8f9('0x2b')]('SendMail',_0x3690d7);})[_0xd8f9('0x17')](function(_0x204ead){if(_0x204ead[_0xd8f9('0x2c')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x204ead['error']['message']||JSON[_0xd8f9('0x2d')](_0x204ead[_0xd8f9('0x2c')])));}return!![];});}function handleError(_0x324541,_0x219c5f,_0x1d41e2){return _0x324541['status'](_0x219c5f||0x1f4)[_0xd8f9('0x2e')]({'message':_0x1d41e2?_0x1d41e2[_0xd8f9('0x2f')]||_0x1d41e2:''});}exports[_0xd8f9('0x30')]=function(_0xb9ba18,_0x2758e8,_0x16e1f8){passport[_0xd8f9('0x31')](_0xd8f9('0x32'),function(_0x36aa04,_0x1953af,_0x2a94d6){var _0x5d16b8=_0x36aa04||_0x2a94d6;if(_0x5d16b8){return handleError(_0x2758e8,0x191,_0x5d16b8);}if(!_0x1953af){return handleError(_0x2758e8,0x194,{'message':_0xd8f9('0x33')});}else{var _0x3cfd69={'payload':{'id':_0x1953af['id'],'role':_0x1953af[_0xd8f9('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xd8f9('0x34')](_0x3cfd69)['then'](function(_0x157dfd){_0x2758e8[_0xd8f9('0x35')]({'id':_0x1953af['id'],'token':_0x157dfd,'statusCall':'','isAlreadyLogged':_0x1953af[_0xd8f9('0x36')]});});}})(_0xb9ba18,_0x2758e8,_0x16e1f8);};exports[_0xd8f9('0x37')]=function(_0x1ab301,_0x23330a,_0x597357){if(!_0x1ab301['body']['email']){return handleError(_0x23330a,0x1f4,{'message':_0xd8f9('0x38')});}var _0x293179=rs[_0xd8f9('0x39')]();_0x1ab301[_0xd8f9('0x3a')][_0xd8f9('0x3b')]=_0x1ab301[_0xd8f9('0x3a')][_0xd8f9('0x3b')][_0xd8f9('0x3c')]()[_0xd8f9('0x3d')]();var _0x5ed1b7;return db['Setting'][_0xd8f9('0xc')]({'where':{'id':0x1},'attributes':[_0xd8f9('0xb'),_0xd8f9('0x1d')],'raw':!![]})['then'](function(_0x5ad80d){_0x5ed1b7=_0x5ad80d;return db[_0xd8f9('0x3e')][_0xd8f9('0x20')]({'where':{'email':_0x1ab301[_0xd8f9('0x3a')]['email']}});})[_0xd8f9('0x17')](function(_0x388188){if(!_0x388188){throw new Error(_0xd8f9('0x3f'));}if(_0x388188[_0xd8f9('0x11')]){throw new Error(_0xd8f9('0x40'));}if(_0x388188[_0xd8f9('0x1c')]){if(moment(_0x388188[_0xd8f9('0x12')])[_0xd8f9('0x19')](_0x5ed1b7[_0xd8f9('0x1d')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x388188['blocked']=![];_0x388188[_0xd8f9('0x12')]=null;}}_0x388188[_0xd8f9('0x41')]=_0x293179;_0x388188[_0xd8f9('0x42')]=Date[_0xd8f9('0x43')]()+0x36ee80;return _0x388188[_0xd8f9('0x44')]();})[_0xd8f9('0x17')](function(){return sendServiceMail({'to':_0x1ab301[_0xd8f9('0x3a')][_0xd8f9('0x3b')],'subject':_0xd8f9('0x45'),'text':_0xd8f9('0x46')+_0xd8f9('0x47')+_0xd8f9('0x48')+_0x1ab301[_0xd8f9('0x49')]['host']+_0xd8f9('0x4a')+_0x293179+'\x0a\x0a'+_0xd8f9('0x4b')});})[_0xd8f9('0x17')](function(){_0x23330a[_0xd8f9('0x4c')](0xc8)['send']({'message':_0xd8f9('0x4d')});})['catch'](function(_0x59952e){return handleError(_0x23330a,0x1f4,_0x59952e);});};exports[_0xd8f9('0x4e')]=function(_0x14e622,_0x1614aa,_0x1361c4){return db[_0xd8f9('0x3e')][_0xd8f9('0x20')]({'where':{'resetPasswordToken':_0x14e622[_0xd8f9('0x4f')][_0xd8f9('0x50')],'resetPasswordExpires':{'$gt':Date[_0xd8f9('0x43')]()}}})[_0xd8f9('0x17')](function(_0x54b5d4){if(!_0x54b5d4){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0xd8f9('0xc')]({'attributes':['id',_0xd8f9('0x51'),'enforcePasswordHistory',_0xd8f9('0x52')]})[_0xd8f9('0x17')](function(_0x1101ce){if(_0x1101ce[_0xd8f9('0x51')])authService[_0xd8f9('0x53')](_0x14e622[_0xd8f9('0x3a')][_0xd8f9('0xe')]);if(!_0x1101ce[_0xd8f9('0x54')]||!_0x54b5d4['previousPasswords'])return _0x54b5d4;authService[_0xd8f9('0x55')](_0x14e622[_0xd8f9('0x3a')][_0xd8f9('0xe')],_0x54b5d4[_0xd8f9('0x56')],_0x1101ce[_0xd8f9('0x52')]);return _0x54b5d4;})[_0xd8f9('0x17')](function(){_0x54b5d4[_0xd8f9('0xe')]=_0x14e622[_0xd8f9('0x3a')][_0xd8f9('0xe')];_0x54b5d4[_0xd8f9('0x41')]=null;_0x54b5d4[_0xd8f9('0x42')]=null;return _0x54b5d4['save']();});})[_0xd8f9('0x17')](function(){_0x1614aa[_0xd8f9('0x4c')](0xc8)[_0xd8f9('0x2e')]({'message':_0xd8f9('0x57')});})['catch'](function(_0x2de50d){return handleError(_0x1614aa,0x1f4,_0x2de50d);});};passport[_0xd8f9('0x58')](new LocalStrategy({'usernameField':_0xd8f9('0xd'),'passwordField':'password'},function(_0x101bd3,_0x195a46,_0x2218da){return localAuthenticate(db[_0xd8f9('0x3e')],_0x101bd3,_0x195a46,_0x2218da);})); \ No newline at end of file +var _0x2d72=['../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','name','password','salt','blocked','loginAttempts','admin','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','service','Smtp','host','port','secure','authentication','user','pass','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','body','generate','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment'];(function(_0x4b94d7,_0x483a68){var _0x40edd4=function(_0x53965b){while(--_0x53965b){_0x4b94d7['push'](_0x4b94d7['shift']());}};_0x40edd4(++_0x483a68);}(_0x2d72,0xa8));var _0x22d7=function(_0x318655,_0x356c7){_0x318655=_0x318655-0x0;var _0x361cf3=_0x2d72[_0x318655];return _0x361cf3;};'use strict';var util=require(_0x22d7('0x0'));var passport=require(_0x22d7('0x1'));var LocalStrategy=require(_0x22d7('0x2'))[_0x22d7('0x3')];var jayson=require(_0x22d7('0x4'));var _=require(_0x22d7('0x5'));var rs=require(_0x22d7('0x6'));var moment=require(_0x22d7('0x7'));var db=require(_0x22d7('0x8'))['db'];var authService=require(_0x22d7('0x9'));var utils=require(_0x22d7('0xa'));var client=jayson[_0x22d7('0xb')][_0x22d7('0xc')]({'port':0x232b});function localAuthenticate(_0x100426,_0x52a3e3,_0x23a731,_0x3791d6){var _0x492ca8,_0x3b12cd;return db[_0x22d7('0xd')][_0x22d7('0xe')]({'where':{'id':0x1},'attributes':[_0x22d7('0xf'),'blockDuration'],'raw':!![]})['then'](function(_0x1810b8){_0x492ca8=_0x1810b8;return _0x100426[_0x22d7('0xe')]({'attributes':['id',_0x22d7('0x10'),_0x22d7('0x11'),_0x22d7('0x12'),'role','disabled',_0x22d7('0x13'),'blockedAt',_0x22d7('0x14')],'where':{'name':_0x52a3e3,'role':{'$or':[_0x22d7('0x15'),'user',_0x22d7('0x16')]}}});})[_0x22d7('0x17')](function(_0x204439){if(!_0x204439||_0x204439&&_0x204439[_0x22d7('0x10')]!==_0x52a3e3){throw new Error(_0x22d7('0x18'));}else{_0x3b12cd=_0x204439;return _0x3b12cd;}})[_0x22d7('0x17')](function(){_0x3b12cd[_0x22d7('0x19')](_0x23a731,function(_0x286a87,_0x534223){var _0x352a78=_0x3b12cd[_0x22d7('0x14')]+0x1;if(_0x286a87){return _0x3791d6(_0x286a87);}else if(!_0x534223){if(_0x3b12cd[_0x22d7('0x1a')]){return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x492ca8['allowedLoginAttempts']>0x0){if(_0x3b12cd['blocked']){if(_0x492ca8[_0x22d7('0x1b')]>0x0){if(moment(_0x3b12cd[_0x22d7('0x1c')])[_0x22d7('0x1d')](_0x492ca8[_0x22d7('0x1b')],_0x22d7('0x1e'))>moment()){return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x22d7('0x1f')](_0x3b12cd,_0x352a78,![],null)[_0x22d7('0x17')](function(){return _0x3791d6(null,![],{'message':_0x22d7('0x18')});});}}else{return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x352a78>=_0x492ca8[_0x22d7('0xf')]){return utils[_0x22d7('0x1f')](_0x3b12cd,0x0,!![],moment())[_0x22d7('0x17')](function(){return _0x3791d6(null,![],{'message':_0x22d7('0x18')});});}else{return utils[_0x22d7('0x1f')](_0x3b12cd,_0x352a78,![],null)['then'](function(){return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x3791d6(null,![],{'message':_0x22d7('0x18')});}}else{if(_0x3b12cd[_0x22d7('0x1a')]){return _0x3791d6(null,![],{'message':_0x22d7('0x18')});}else if(_0x492ca8[_0x22d7('0xf')]>0x0){if(_0x3b12cd['blocked']){if(_0x492ca8[_0x22d7('0x1b')]>0x0){if(moment(_0x3b12cd[_0x22d7('0x1c')])[_0x22d7('0x1d')](_0x492ca8['blockDuration'],_0x22d7('0x1e'))>moment()){return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x22d7('0x1f')](_0x3b12cd,0x0,![],null)[_0x22d7('0x17')](function(){return utils[_0x22d7('0x20')](_0x3b12cd);})['then'](function(){return _0x3791d6(null,_0x3b12cd);});}}else{return _0x3791d6(null,![],{'message':_0x22d7('0x18')});}}else{return utils['clearBlockUser'](_0x3b12cd,0x0,![],null)['then'](function(){return utils[_0x22d7('0x20')](_0x3b12cd);})[_0x22d7('0x17')](function(){return _0x3791d6(null,_0x3b12cd);})[_0x22d7('0x21')](function(_0x27998a){return _0x3791d6(null,![],_0x27998a);});}}else{if(_0x3b12cd[_0x22d7('0x13')]){return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x22d7('0x20')](_0x3b12cd)[_0x22d7('0x17')](function(){return _0x3791d6(null,_0x3b12cd);});}}}});})[_0x22d7('0x21')](function(_0xce7f15){return _0x3791d6(null,![],_0xce7f15);});}function sendServiceMail(_0x45dc29){return db['MailAccount'][_0x22d7('0x22')]({'where':{'service':!![]},'attributes':['id',_0x22d7('0x10'),_0x22d7('0x23')],'include':[{'model':db[_0x22d7('0x24')],'as':'Smtp'}]})[_0x22d7('0x17')](function(_0x21c334){if(!_0x21c334){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x5a672d={'tls':{'rejectUnauthorized':![]}};if(_0x21c334['Smtp'][_0x22d7('0x25')]){_0x5a672d[_0x22d7('0x25')]=_0x21c334[_0x22d7('0x26')]['service'];}else{_0x5a672d[_0x22d7('0x27')]=_0x21c334['Smtp'][_0x22d7('0x27')];_0x5a672d[_0x22d7('0x28')]=_0x21c334[_0x22d7('0x26')][_0x22d7('0x28')];_0x5a672d[_0x22d7('0x29')]=_0x21c334[_0x22d7('0x26')]['secure'];}if(_0x21c334['Smtp'][_0x22d7('0x2a')]){_0x5a672d['auth']={'user':_0x21c334[_0x22d7('0x26')][_0x22d7('0x2b')],'pass':_0x21c334[_0x22d7('0x26')][_0x22d7('0x2c')]};}var _0x3b8d37={'account':_0x5a672d,'message':_['merge']({'from':util['format'](_0x22d7('0x2d'),_0x21c334['name'],_0x21c334['email']||_0x21c334[_0x22d7('0x26')]['user'])},_0x45dc29)};return client[_0x22d7('0x2e')](_0x22d7('0x2f'),_0x3b8d37);})[_0x22d7('0x17')](function(_0x5976d6){if(_0x5976d6[_0x22d7('0x30')]){throw new Error(util[_0x22d7('0x31')](_0x22d7('0x32'),_0x5976d6[_0x22d7('0x30')][_0x22d7('0x33')]||JSON[_0x22d7('0x34')](_0x5976d6[_0x22d7('0x30')])));}return!![];});}function handleError(_0x158ccd,_0x4f487d,_0x52e1ae){return _0x158ccd[_0x22d7('0x35')](_0x4f487d||0x1f4)[_0x22d7('0x36')]({'message':_0x52e1ae?_0x52e1ae[_0x22d7('0x33')]||_0x52e1ae:''});}exports[_0x22d7('0x37')]=function(_0x4bc6cc,_0x33239e,_0x5191d1){passport['authenticate'](_0x22d7('0x38'),function(_0x296ad3,_0x3b7808,_0x431592){var _0x798f9a=_0x296ad3||_0x431592;if(_0x798f9a){return handleError(_0x33239e,0x191,_0x798f9a);}if(!_0x3b7808){return handleError(_0x33239e,0x194,{'message':_0x22d7('0x39')});}else{var _0x33d434={'payload':{'id':_0x3b7808['id'],'role':_0x3b7808[_0x22d7('0x3a')]},'options':{'expiresIn':0x15180}};return authService[_0x22d7('0x3b')](_0x33d434)[_0x22d7('0x17')](function(_0x3b30b5){_0x33239e[_0x22d7('0x3c')]({'id':_0x3b7808['id'],'token':_0x3b30b5,'statusCall':'','isAlreadyLogged':_0x3b7808[_0x22d7('0x3d')]});});}})(_0x4bc6cc,_0x33239e,_0x5191d1);};exports['forgot']=function(_0x3f2cdb,_0x1033a2,_0x1aa4d8){if(!_0x3f2cdb[_0x22d7('0x3e')][_0x22d7('0x23')]){return handleError(_0x1033a2,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x53b10f=rs[_0x22d7('0x3f')]();_0x3f2cdb[_0x22d7('0x3e')][_0x22d7('0x23')]=_0x3f2cdb[_0x22d7('0x3e')]['email']['trim']()[_0x22d7('0x40')]();var _0x4613b2;return db['Setting'][_0x22d7('0xe')]({'where':{'id':0x1},'attributes':[_0x22d7('0xf'),_0x22d7('0x1b')],'raw':!![]})[_0x22d7('0x17')](function(_0x32f8ef){_0x4613b2=_0x32f8ef;return db['User']['find']({'where':{'email':_0x3f2cdb['body'][_0x22d7('0x23')]}});})[_0x22d7('0x17')](function(_0xbdc416){if(!_0xbdc416){throw new Error(_0x22d7('0x41'));}if(_0xbdc416[_0x22d7('0x1a')]){throw new Error(_0x22d7('0x42'));}if(_0xbdc416[_0x22d7('0x13')]){if(moment(_0xbdc416[_0x22d7('0x1c')])['add'](_0x4613b2[_0x22d7('0x1b')],'minutes')>moment()){throw new Error(_0x22d7('0x43'));}else{_0xbdc416[_0x22d7('0x13')]=![];_0xbdc416[_0x22d7('0x1c')]=null;}}_0xbdc416[_0x22d7('0x44')]=_0x53b10f;_0xbdc416['resetPasswordExpires']=Date['now']()+0x36ee80;return _0xbdc416[_0x22d7('0x45')]();})[_0x22d7('0x17')](function(){return sendServiceMail({'to':_0x3f2cdb[_0x22d7('0x3e')][_0x22d7('0x23')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x22d7('0x46')+'https://'+_0x3f2cdb[_0x22d7('0x47')][_0x22d7('0x27')]+'/reset/'+_0x53b10f+'\x0a\x0a'+_0x22d7('0x48')});})[_0x22d7('0x17')](function(){_0x1033a2[_0x22d7('0x35')](0xc8)[_0x22d7('0x36')]({'message':_0x22d7('0x49')});})['catch'](function(_0x2e9dcf){return handleError(_0x1033a2,0x1f4,_0x2e9dcf);});};exports[_0x22d7('0x4a')]=function(_0x43edb0,_0x447938,_0x35206a){return db[_0x22d7('0x4b')][_0x22d7('0x22')]({'where':{'resetPasswordToken':_0x43edb0[_0x22d7('0x4c')][_0x22d7('0x4d')],'resetPasswordExpires':{'$gt':Date[_0x22d7('0x4e')]()}}})[_0x22d7('0x17')](function(_0x4c4a7d){if(!_0x4c4a7d){throw new Error(_0x22d7('0x4f'));}return db[_0x22d7('0xd')][_0x22d7('0xe')]({'attributes':['id',_0x22d7('0x50'),_0x22d7('0x51'),_0x22d7('0x52')]})[_0x22d7('0x17')](function(_0xf7e694){if(_0xf7e694[_0x22d7('0x50')])authService['validatePasswordPattern'](_0x43edb0[_0x22d7('0x3e')][_0x22d7('0x11')]);if(!_0xf7e694[_0x22d7('0x51')]||!_0x4c4a7d['previousPasswords'])return _0x4c4a7d;authService[_0x22d7('0x53')](_0x43edb0['body'][_0x22d7('0x11')],_0x4c4a7d[_0x22d7('0x54')],_0xf7e694[_0x22d7('0x52')]);return _0x4c4a7d;})['then'](function(){_0x4c4a7d[_0x22d7('0x11')]=_0x43edb0['body'][_0x22d7('0x11')];_0x4c4a7d[_0x22d7('0x44')]=null;_0x4c4a7d[_0x22d7('0x55')]=null;return _0x4c4a7d[_0x22d7('0x45')]();});})['then'](function(){_0x447938[_0x22d7('0x35')](0xc8)[_0x22d7('0x36')]({'message':_0x22d7('0x56')});})['catch'](function(_0x22d330){return handleError(_0x447938,0x1f4,_0x22d330);});};passport[_0x22d7('0x57')](new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x221542,_0x1c20ca,_0x3ee60f){return localAuthenticate(db[_0x22d7('0x4b')],_0x221542,_0x1c20ca,_0x3ee60f);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 60b691b..84dc350 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 _0x6ec0=['post','login','forgot','/reset/:token','reset','express','./authLocal.controller'];(function(_0x4bfc70,_0x4ddbfd){var _0x32f0ee=function(_0x24a180){while(--_0x24a180){_0x4bfc70['push'](_0x4bfc70['shift']());}};_0x32f0ee(++_0x4ddbfd);}(_0x6ec0,0x9f));var _0x06ec=function(_0x276dda,_0x79c0ae){_0x276dda=_0x276dda-0x0;var _0x40a023=_0x6ec0[_0x276dda];return _0x40a023;};'use strict';var express=require(_0x06ec('0x0'));var router=express['Router']();var controller=require(_0x06ec('0x1'));router[_0x06ec('0x2')]('/',controller[_0x06ec('0x3')]);router[_0x06ec('0x2')]('/forgot',controller[_0x06ec('0x4')]);router[_0x06ec('0x2')](_0x06ec('0x5'),controller[_0x06ec('0x6')]);module['exports']=router; \ No newline at end of file +var _0xa049=['exports','express','Router','./authLocal.controller','post','login','/forgot','/reset/:token','reset'];(function(_0x528103,_0x2d07d3){var _0x1f5dab=function(_0x26015d){while(--_0x26015d){_0x528103['push'](_0x528103['shift']());}};_0x1f5dab(++_0x2d07d3);}(_0xa049,0x18d));var _0x9a04=function(_0x3bb21a,_0x353b56){_0x3bb21a=_0x3bb21a-0x0;var _0x5f3983=_0xa049[_0x3bb21a];return _0x5f3983;};'use strict';var express=require(_0x9a04('0x0'));var router=express[_0x9a04('0x1')]();var controller=require(_0x9a04('0x2'));router[_0x9a04('0x3')]('/',controller[_0x9a04('0x4')]);router[_0x9a04('0x3')](_0x9a04('0x5'),controller['forgot']);router[_0x9a04('0x3')](_0x9a04('0x6'),controller[_0x9a04('0x7')]);module[_0x9a04('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 888b251..c828dcd 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 _0xa7b7=['STRING','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7b7,0x1d6));var _0x7a7b=function(_0x565556,_0x477373){_0x565556=_0x565556-0x0;var _0x1c06f8=_0xa7b7[_0x565556];return _0x1c06f8;};'use strict';var Sequelize=require(_0x7a7b('0x0'));module[_0x7a7b('0x1')]={'name':{'type':Sequelize[_0x7a7b('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x7a7b('0x2')]},'description':{'type':Sequelize[_0x7a7b('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x7a7b('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7044=['BOOLEAN','INTEGER','sequelize','STRING'];(function(_0x20ae9d,_0x77e369){var _0x1a616f=function(_0x2c7e76){while(--_0x2c7e76){_0x20ae9d['push'](_0x20ae9d['shift']());}};_0x1a616f(++_0x77e369);}(_0x7044,0x6e));var _0x4704=function(_0x391699,_0x34c62e){_0x391699=_0x391699-0x0;var _0x2cc4b7=_0x7044[_0x391699];return _0x2cc4b7;};'use strict';var Sequelize=require(_0x4704('0x0'));module['exports']={'name':{'type':Sequelize[_0x4704('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x4704('0x1')]},'description':{'type':Sequelize[_0x4704('0x1')]},'status':{'type':Sequelize[_0x4704('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x4704('0x3')],'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 f99b55e..d8556fa 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(_0x36595c,_0x3228ca){var _0x55a293=function(_0x4a9346){while(--_0x4a9346){_0x36595c['push'](_0x36595c['shift']());}};_0x55a293(++_0x3228ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x457d48,_0x4e3cf7){var _0x53f62f=function(_0xd3702){while(--_0xd3702){_0x457d48['push'](_0x457d48['shift']());}};_0x53f62f(++_0x4e3cf7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 5f5fbf7..6d38e90 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 _0xee24=['Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','define'];(function(_0x295ea9,_0x19d658){var _0x59a3fe=function(_0x35be54){while(--_0x35be54){_0x295ea9['push'](_0x295ea9['shift']());}};_0x59a3fe(++_0x19d658);}(_0xee24,0x80));var _0x4ee2=function(_0x1e8ec3,_0x3f0312){_0x1e8ec3=_0x1e8ec3-0x0;var _0x2d5f70=_0xee24[_0x1e8ec3];return _0x2d5f70;};'use strict';var _=require(_0x4ee2('0x0'));var util=require(_0x4ee2('0x1'));var logger=require(_0x4ee2('0x2'))(_0x4ee2('0x3'));var moment=require(_0x4ee2('0x4'));var BPromise=require(_0x4ee2('0x5'));var rp=require(_0x4ee2('0x6'));var fs=require('fs');var path=require(_0x4ee2('0x7'));var rimraf=require(_0x4ee2('0x8'));var config=require(_0x4ee2('0x9'));var attributes=require(_0x4ee2('0xa'));module['exports']=function(_0x4a4675,_0x2f80d8){return _0x4a4675[_0x4ee2('0xb')](_0x4ee2('0xc'),attributes,{'tableName':_0x4ee2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeabf=['define','tools_automations','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./automation.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeabf,0x1a4));var _0xfeab=function(_0x17ad22,_0x27b4ed){_0x17ad22=_0x17ad22-0x0;var _0x250244=_0xeabf[_0x17ad22];return _0x250244;};'use strict';var _=require(_0xfeab('0x0'));var util=require(_0xfeab('0x1'));var logger=require(_0xfeab('0x2'))('api');var moment=require(_0xfeab('0x3'));var BPromise=require(_0xfeab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfeab('0x5'));var rimraf=require(_0xfeab('0x6'));var config=require('../../config/environment');var attributes=require(_0xfeab('0x7'));module[_0xfeab('0x8')]=function(_0x5c1569,_0xdb2b4a){return _0x5c1569[_0xfeab('0x9')]('Automation',attributes,{'tableName':_0xfeab('0xa'),'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 8a80204..ef6384e 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 _0x361b=['stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x21adf5,_0x1a4e48){var _0x555ada=function(_0x5e5a96){while(--_0x5e5a96){_0x21adf5['push'](_0x21adf5['shift']());}};_0x555ada(++_0x1a4e48);}(_0x361b,0x97));var _0xb361=function(_0x584f4f,_0x5a676d){_0x584f4f=_0x584f4f-0x0;var _0x48db23=_0x361b[_0x584f4f];return _0x48db23;};'use strict';var _=require(_0xb361('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb361('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb361('0x2'));var db=require(_0xb361('0x3'))['db'];var utils=require(_0xb361('0x4'));var logger=require(_0xb361('0x5'))(_0xb361('0x6'));var config=require(_0xb361('0x7'));var jayson=require(_0xb361('0x8'));var client=jayson[_0xb361('0x9')][_0xb361('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32a10f,_0x413f23,_0x4d9bae){return new BPromise(function(_0x553d93,_0x546a1c){return client[_0xb361('0xb')](_0x32a10f,_0x4d9bae)[_0xb361('0xc')](function(_0x46bec2){logger[_0xb361('0xd')]('Automation,\x20%s,\x20%s',_0x413f23,_0xb361('0xe'));logger[_0xb361('0xf')](_0xb361('0x10'),_0x413f23,_0xb361('0xe'),JSON[_0xb361('0x11')](_0x46bec2));if(_0x46bec2['error']){if(_0x46bec2[_0xb361('0x12')][_0xb361('0x13')]===0x1f4){logger['error'](_0xb361('0x14'),_0x413f23,_0x46bec2['error'][_0xb361('0x15')]);return _0x546a1c(_0x46bec2['error'][_0xb361('0x15')]);}logger['error']('Automation,\x20%s,\x20%s',_0x413f23,_0x46bec2[_0xb361('0x12')][_0xb361('0x15')]);return _0x553d93(_0x46bec2[_0xb361('0x12')][_0xb361('0x15')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x413f23,'request\x20sent');_0x553d93(_0x46bec2[_0xb361('0x16')][_0xb361('0x15')]);}})[_0xb361('0x17')](function(_0x114d23){logger[_0xb361('0x12')](_0xb361('0x14'),_0x413f23,_0x114d23);_0x546a1c(_0x114d23);});});} \ No newline at end of file +var _0xec1a=['Automation,\x20%s,\x20%s','message','request\x20sent','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec1a,0x130));var _0xaec1=function(_0x3869f6,_0x2ea2d5){_0x3869f6=_0x3869f6-0x0;var _0x536687=_0xec1a[_0x3869f6];return _0x536687;};'use strict';var _=require('lodash');var util=require(_0xaec1('0x0'));var moment=require('moment');var BPromise=require(_0xaec1('0x1'));var rs=require(_0xaec1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaec1('0x3'))['db'];var utils=require(_0xaec1('0x4'));var logger=require('../../config/logger')(_0xaec1('0x5'));var config=require(_0xaec1('0x6'));var jayson=require(_0xaec1('0x7'));var client=jayson[_0xaec1('0x8')][_0xaec1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e281c,_0x5ef402,_0x1071f6){return new BPromise(function(_0x2f82e6,_0x5b4762){return client[_0xaec1('0xa')](_0x3e281c,_0x1071f6)[_0xaec1('0xb')](function(_0x19d8f4){logger[_0xaec1('0xc')]('Automation,\x20%s,\x20%s',_0x5ef402,'request\x20sent');logger[_0xaec1('0xd')](_0xaec1('0xe'),_0x5ef402,'request\x20sent',JSON[_0xaec1('0xf')](_0x19d8f4));if(_0x19d8f4['error']){if(_0x19d8f4[_0xaec1('0x10')][_0xaec1('0x11')]===0x1f4){logger['error'](_0xaec1('0x12'),_0x5ef402,_0x19d8f4[_0xaec1('0x10')][_0xaec1('0x13')]);return _0x5b4762(_0x19d8f4[_0xaec1('0x10')]['message']);}logger['error'](_0xaec1('0x12'),_0x5ef402,_0x19d8f4['error'][_0xaec1('0x13')]);return _0x2f82e6(_0x19d8f4['error']['message']);}else{logger['info'](_0xaec1('0x12'),_0x5ef402,_0xaec1('0x14'));_0x2f82e6(_0x19d8f4[_0xaec1('0x15')][_0xaec1('0x13')]);}})[_0xaec1('0x16')](function(_0x853743){logger[_0xaec1('0x10')](_0xaec1('0x12'),_0x5ef402,_0x853743);_0x5b4762(_0x853743);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 0a37e34..3bdbeed 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 _0xf777=['/:id/actions','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/conditions','getConditions','getActions','post','create','addConditions'];(function(_0x766e06,_0x17423a){var _0x22f402=function(_0x57ad4f){while(--_0x57ad4f){_0x766e06['push'](_0x766e06['shift']());}};_0x22f402(++_0x17423a);}(_0xf777,0x1e9));var _0x7f77=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf777[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7f77('0x0'));var util=require(_0x7f77('0x1'));var path=require(_0x7f77('0x2'));var timeout=require(_0x7f77('0x3'));var express=require(_0x7f77('0x4'));var router=express[_0x7f77('0x5')]();var auth=require(_0x7f77('0x6'));var interaction=require(_0x7f77('0x7'));var config=require(_0x7f77('0x8'));var controller=require('./automation.controller');router[_0x7f77('0x9')]('/',auth[_0x7f77('0xa')](),controller['index']);router[_0x7f77('0x9')]('/:id',auth[_0x7f77('0xa')](),controller['show']);router[_0x7f77('0x9')](_0x7f77('0xb'),auth[_0x7f77('0xa')](),controller[_0x7f77('0xc')]);router[_0x7f77('0x9')]('/:id/actions',auth['isAuthenticated'](),controller[_0x7f77('0xd')]);router[_0x7f77('0xe')]('/',auth[_0x7f77('0xa')](),controller[_0x7f77('0xf')]);router[_0x7f77('0xe')]('/:id/conditions',auth[_0x7f77('0xa')](),controller[_0x7f77('0x10')]);router[_0x7f77('0xe')](_0x7f77('0x11'),auth[_0x7f77('0xa')](),controller['addActions']);router['put'](_0x7f77('0x12'),auth[_0x7f77('0xa')](),controller[_0x7f77('0x13')]);router[_0x7f77('0x14')](_0x7f77('0x12'),auth[_0x7f77('0xa')](),controller[_0x7f77('0x15')]);module[_0x7f77('0x16')]=router; \ No newline at end of file +var _0xbccd=['Router','../../components/auth/service','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','getConditions','/:id/actions','post','addConditions','put','/:id','delete','destroy','multer','util','path','connect-timeout'];(function(_0x40b83e,_0x48c32f){var _0x233f75=function(_0x53a835){while(--_0x53a835){_0x40b83e['push'](_0x40b83e['shift']());}};_0x233f75(++_0x48c32f);}(_0xbccd,0xd8));var _0xdbcc=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xbccd[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0xdbcc('0x0'));var util=require(_0xdbcc('0x1'));var path=require(_0xdbcc('0x2'));var timeout=require(_0xdbcc('0x3'));var express=require('express');var router=express[_0xdbcc('0x4')]();var auth=require(_0xdbcc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdbcc('0x6'));router[_0xdbcc('0x7')]('/',auth[_0xdbcc('0x8')](),controller[_0xdbcc('0x9')]);router['get']('/:id',auth[_0xdbcc('0x8')](),controller[_0xdbcc('0xa')]);router[_0xdbcc('0x7')](_0xdbcc('0xb'),auth[_0xdbcc('0x8')](),controller[_0xdbcc('0xc')]);router['get'](_0xdbcc('0xd'),auth[_0xdbcc('0x8')](),controller['getActions']);router['post']('/',auth[_0xdbcc('0x8')](),controller['create']);router[_0xdbcc('0xe')](_0xdbcc('0xb'),auth[_0xdbcc('0x8')](),controller[_0xdbcc('0xf')]);router[_0xdbcc('0xe')](_0xdbcc('0xd'),auth[_0xdbcc('0x8')](),controller['addActions']);router[_0xdbcc('0x10')](_0xdbcc('0x11'),auth[_0xdbcc('0x8')](),controller['update']);router[_0xdbcc('0x12')](_0xdbcc('0x11'),auth[_0xdbcc('0x8')](),controller[_0xdbcc('0x13')]);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 6589bbf..f5f2548 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 _0x5685=['Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','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)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)'];(function(_0x3ec82f,_0x5c5787){var _0x5e81aa=function(_0x183518){while(--_0x183518){_0x3ec82f['push'](_0x3ec82f['shift']());}};_0x5e81aa(++_0x5c5787);}(_0x5685,0xf9));var _0x5568=function(_0x2afb28,_0x19e8b0){_0x2afb28=_0x2afb28-0x0;var _0x41d764=_0x5685[_0x2afb28];return _0x41d764;};'use strict';var Sequelize=require(_0x5568('0x0'));module[_0x5568('0x1')]={'name':{'type':Sequelize[_0x5568('0x2')],'unique':_0x5568('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x5568('0x4')),'allowNull':![],'defaultValue':_0x5568('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5568('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x5568('0x6')](0x4)[_0x5568('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5568('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5568('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5568('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5568('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5568('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)[_0x5568('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5568('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)[_0x5568('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5568('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'defaultValue':0x3,'comment':_0x5568('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)[_0x5568('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5568('0xd')},'dialTimezone':{'type':Sequelize[_0x5568('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5568('0x2')],'defaultValue':_0x5568('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x5568('0xf')](_0x5568('0x10'),_0x5568('0x11'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x5568('0x5')],'defaultValue':0x0,'comment':_0x5568('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5568('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5568('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x5568('0x6')](0x9)[_0x5568('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5568('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5568('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5568('0x6')](0x9)[_0x5568('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5568('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5568('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5568('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5568('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5568('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5568('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5568('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5568('0x6')](0x5)[_0x5568('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5568('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5568('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x5568('0x1a'),_0x5568('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5568('0x1c')},'dialCutDigit':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5568('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)[_0x5568('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5568('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)[_0x5568('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5568('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5568('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5568('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5568('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5568('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)[_0x5568('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5568('0x22')}}; \ No newline at end of file +var _0x26ed=['always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','ENUM','ivr','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','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)','07:00-22:00,*,*,*'];(function(_0x1402a3,_0x219705){var _0xaf92d7=function(_0x2ecf6c){while(--_0x2ecf6c){_0x1402a3['push'](_0x1402a3['shift']());}};_0xaf92d7(++_0x219705);}(_0x26ed,0xb3));var _0xd26e=function(_0x528bb5,_0x119c5b){_0x528bb5=_0x528bb5-0x0;var _0x58e8ca=_0x26ed[_0x528bb5];return _0x58e8ca;};'use strict';var Sequelize=require(_0xd26e('0x0'));module['exports']={'name':{'type':Sequelize[_0xd26e('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd26e('0x2')](_0xd26e('0x3')),'allowNull':![],'defaultValue':_0xd26e('0x3')},'description':{'type':Sequelize[_0xd26e('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd26e('0x4')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd26e('0x5')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd26e('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xd26e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd26e('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd26e('0x6')](0x3)[_0xd26e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd26e('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd26e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd26e('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xd26e('0x6')](0x3)[_0xd26e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd26e('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd26e('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd26e('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd26e('0x6')](0x3)[_0xd26e('0x8')],'defaultValue':0x3,'comment':_0xd26e('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd26e('0x6')](0x5)[_0xd26e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd26e('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd26e('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xd26e('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd26e('0x1')],'defaultValue':_0xd26e('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xd26e('0x2')](_0xd26e('0x10'),_0xd26e('0x11'),_0xd26e('0x12')),'defaultValue':_0xd26e('0x10')},'dialAMDActive':{'type':Sequelize[_0xd26e('0x13')],'defaultValue':0x0,'comment':_0xd26e('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd26e('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd26e('0x15')},'dialAMDGreeting':{'type':Sequelize[_0xd26e('0x6')](0x9)[_0xd26e('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd26e('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd26e('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd26e('0x6')](0x9)[_0xd26e('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd26e('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0xd26e('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd26e('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd26e('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd26e('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xd26e('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd26e('0x6')](0x5)[_0xd26e('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd26e('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd26e('0x6')](0x9)[_0xd26e('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd26e('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xd26e('0x1d'),_0xd26e('0x1e')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xd26e('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd26e('0x6')](0x3)[_0xd26e('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd26e('0x1f')},'dialCutDigit':{'type':Sequelize[_0xd26e('0x6')](0x3)[_0xd26e('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd26e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd26e('0x6')](0x5)[_0xd26e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd26e('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0xd26e('0x6')](0x3)[_0xd26e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd26e('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xd26e('0x6')](0x5)[_0xd26e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd26e('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd26e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd26e('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xd26e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd26e('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd26e('0x6')](0x3)[_0xd26e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd26e('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd26e('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 8572f26..50b3b99 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(_0x1849da,_0x2459c9){var _0x377831=function(_0x3fdfe2){while(--_0x3fdfe2){_0x1849da['push'](_0x1849da['shift']());}};_0x377831(++_0x2459c9);}(_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('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(_0x4e74a4,_0x46dc15){var _0x202675=function(_0x12cf3e){while(--_0x12cf3e){_0x4e74a4['push'](_0x4e74a4['shift']());}};_0x202675(++_0x46dc15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 90fe3b9..da9d0d6 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 _0xa1d5=['bluebird','request-promise','rimraf','./campaign.attributes','exports','Campaign','campaigns','lodash','util','api','moment'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa1d5,0xa1));var _0x5a1d=function(_0x2c8904,_0x222507){_0x2c8904=_0x2c8904-0x0;var _0xac620f=_0xa1d5[_0x2c8904];return _0xac620f;};'use strict';var _=require(_0x5a1d('0x0'));var util=require(_0x5a1d('0x1'));var logger=require('../../config/logger')(_0x5a1d('0x2'));var moment=require(_0x5a1d('0x3'));var BPromise=require(_0x5a1d('0x4'));var rp=require(_0x5a1d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a1d('0x6'));var config=require('../../config/environment');var attributes=require(_0x5a1d('0x7'));module[_0x5a1d('0x8')]=function(_0x8c8615,_0x350457){return _0x8c8615['define'](_0x5a1d('0x9'),attributes,{'tableName':_0x5a1d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2c6=['../../config/environment','./campaign.attributes','define','Campaign','campaigns','lodash','util','api','moment'];(function(_0x2595ed,_0x4d286c){var _0x52ffe0=function(_0x2720b7){while(--_0x2720b7){_0x2595ed['push'](_0x2595ed['shift']());}};_0x52ffe0(++_0x4d286c);}(_0xd2c6,0x140));var _0x6d2c=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xd2c6[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0x6d2c('0x0'));var util=require(_0x6d2c('0x1'));var logger=require('../../config/logger')(_0x6d2c('0x2'));var moment=require(_0x6d2c('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(_0x6d2c('0x4'));var attributes=require(_0x6d2c('0x5'));module['exports']=function(_0x14e2a0,_0x213592){return _0x14e2a0[_0x6d2c('0x6')](_0x6d2c('0x7'),attributes,{'tableName':_0x6d2c('0x8'),'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 70df8a5..8c49466 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x5da6b4,_0x18694d){var _0x34ce85=function(_0x149978){while(--_0x149978){_0x5da6b4['push'](_0x5da6b4['shift']());}};_0x34ce85(++_0x18694d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x4f7690,_0x4de715){var _0x3209ae=function(_0x26d937){while(--_0x26d937){_0x4f7690['push'](_0x4f7690['shift']());}};_0x3209ae(++_0x4de715);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 1b3e4fc..53d867c 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 _0x4667=['destroy','removeLists','delete','/:id/blacklists','removeBlackLists','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','show','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','put','update'];(function(_0x3f668b,_0x6ab15c){var _0x259a77=function(_0x5c56e1){while(--_0x5c56e1){_0x3f668b['push'](_0x3f668b['shift']());}};_0x259a77(++_0x6ab15c);}(_0x4667,0x12f));var _0x7466=function(_0x9b7ba,_0x38b333){_0x9b7ba=_0x9b7ba-0x0;var _0x184dc1=_0x4667[_0x9b7ba];return _0x184dc1;};'use strict';var multer=require(_0x7466('0x0'));var util=require(_0x7466('0x1'));var path=require('path');var timeout=require(_0x7466('0x2'));var express=require(_0x7466('0x3'));var router=express[_0x7466('0x4')]();var auth=require(_0x7466('0x5'));var interaction=require(_0x7466('0x6'));var config=require('../../config/environment');var controller=require(_0x7466('0x7'));router[_0x7466('0x8')]('/',auth[_0x7466('0x9')](),controller[_0x7466('0xa')]);router['get'](_0x7466('0xb'),auth[_0x7466('0x9')](),controller[_0x7466('0xc')]);router[_0x7466('0x8')]('/:id/hoppers',auth[_0x7466('0x9')](),controller['getHoppers']);router[_0x7466('0x8')]('/:id/hopper_histories',auth[_0x7466('0x9')](),controller[_0x7466('0xd')]);router[_0x7466('0x8')](_0x7466('0xe'),auth[_0x7466('0x9')](),controller['getHopperFinals']);router[_0x7466('0x8')](_0x7466('0xf'),auth['isAuthenticated'](),controller[_0x7466('0x10')]);router[_0x7466('0x8')](_0x7466('0x11'),auth[_0x7466('0x9')](),controller[_0x7466('0x12')]);router[_0x7466('0x8')]('/:id/blacklists',auth[_0x7466('0x9')](),controller[_0x7466('0x13')]);router['post']('/',auth[_0x7466('0x9')](),controller['create']);router[_0x7466('0x14')](_0x7466('0x15'),auth[_0x7466('0x9')](),controller[_0x7466('0x16')]);router[_0x7466('0x14')](_0x7466('0x11'),auth[_0x7466('0x9')](),controller[_0x7466('0x17')]);router[_0x7466('0x14')]('/:id/blacklists',auth[_0x7466('0x9')](),controller[_0x7466('0x18')]);router[_0x7466('0x19')]('/:id',auth[_0x7466('0x9')](),controller[_0x7466('0x1a')]);router['delete'](_0x7466('0xb'),auth[_0x7466('0x9')](),controller[_0x7466('0x1b')]);router['delete']('/:id/lists',auth[_0x7466('0x9')](),controller[_0x7466('0x1c')]);router[_0x7466('0x1d')](_0x7466('0x1e'),auth[_0x7466('0x9')](),controller[_0x7466('0x1f')]);module[_0x7466('0x20')]=router; \ No newline at end of file +var _0x3b40=['clone','addLists','addBlackLists','update','delete','destroy','removeLists','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','post','create'];(function(_0x222291,_0x2f0e7c){var _0x1bf2c0=function(_0x223328){while(--_0x223328){_0x222291['push'](_0x222291['shift']());}};_0x1bf2c0(++_0x2f0e7c);}(_0x3b40,0x1e7));var _0x03b4=function(_0x449efb,_0x1144ed){_0x449efb=_0x449efb-0x0;var _0x200466=_0x3b40[_0x449efb];return _0x200466;};'use strict';var multer=require(_0x03b4('0x0'));var util=require(_0x03b4('0x1'));var path=require(_0x03b4('0x2'));var timeout=require(_0x03b4('0x3'));var express=require(_0x03b4('0x4'));var router=express[_0x03b4('0x5')]();var auth=require(_0x03b4('0x6'));var interaction=require(_0x03b4('0x7'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x03b4('0x8')]('/',auth[_0x03b4('0x9')](),controller[_0x03b4('0xa')]);router[_0x03b4('0x8')](_0x03b4('0xb'),auth[_0x03b4('0x9')](),controller[_0x03b4('0xc')]);router[_0x03b4('0x8')]('/:id/hoppers',auth[_0x03b4('0x9')](),controller['getHoppers']);router['get'](_0x03b4('0xd'),auth[_0x03b4('0x9')](),controller[_0x03b4('0xe')]);router[_0x03b4('0x8')](_0x03b4('0xf'),auth[_0x03b4('0x9')](),controller[_0x03b4('0x10')]);router['get'](_0x03b4('0x11'),auth['isAuthenticated'](),controller[_0x03b4('0x12')]);router[_0x03b4('0x8')](_0x03b4('0x13'),auth[_0x03b4('0x9')](),controller['getLists']);router[_0x03b4('0x8')](_0x03b4('0x14'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x03b4('0x15')]('/',auth[_0x03b4('0x9')](),controller[_0x03b4('0x16')]);router[_0x03b4('0x15')]('/:id/clone',auth['isAuthenticated'](),controller[_0x03b4('0x17')]);router['post']('/:id/lists',auth['isAuthenticated'](),controller[_0x03b4('0x18')]);router[_0x03b4('0x15')]('/:id/blacklists',auth[_0x03b4('0x9')](),controller[_0x03b4('0x19')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x03b4('0x1a')]);router[_0x03b4('0x1b')](_0x03b4('0xb'),auth[_0x03b4('0x9')](),controller[_0x03b4('0x1c')]);router[_0x03b4('0x1b')](_0x03b4('0x13'),auth['isAuthenticated'](),controller[_0x03b4('0x1d')]);router[_0x03b4('0x1b')](_0x03b4('0x14'),auth[_0x03b4('0x9')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 859d365..273c506 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 _0x92d7=['exports','STRING','VIRTUAL','getDataValue','sequelize'];(function(_0x1af539,_0x2b31e5){var _0x305778=function(_0x3a7621){while(--_0x3a7621){_0x1af539['push'](_0x1af539['shift']());}};_0x305778(++_0x2b31e5);}(_0x92d7,0x10d));var _0x792d=function(_0x1a8347,_0xb15b3d){_0x1a8347=_0x1a8347-0x0;var _0x33b70b=_0x92d7[_0x1a8347];return _0x33b70b;};'use strict';var Sequelize=require(_0x792d('0x0'));module[_0x792d('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x792d('0x2')]},'name':{'type':Sequelize[_0x792d('0x3')],'get':function(){return this[_0x792d('0x4')]('key');}}}; \ No newline at end of file +var _0x6690=['VIRTUAL','getDataValue','key','sequelize','exports','STRING','TEXT'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x6690,0xa4));var _0x0669=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x6690[_0x1b828b];return _0x98da1a;};'use strict';var Sequelize=require(_0x0669('0x0'));module[_0x0669('0x1')]={'key':{'type':Sequelize[_0x0669('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x0669('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x0669('0x2')]},'name':{'type':Sequelize[_0x0669('0x4')],'get':function(){return this[_0x0669('0x5')](_0x0669('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index d4414fb..408b677 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(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_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 _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(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index c52917c..a5cc31c 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 _0x74c3=['define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x39fd25,_0x1bd49d){var _0x37eb85=function(_0x4c3945){while(--_0x4c3945){_0x39fd25['push'](_0x39fd25['shift']());}};_0x37eb85(++_0x1bd49d);}(_0x74c3,0x94));var _0x374c=function(_0x5dea8a,_0x473eaa){_0x5dea8a=_0x5dea8a-0x0;var _0x47758b=_0x74c3[_0x5dea8a];return _0x47758b;};'use strict';var _=require(_0x374c('0x0'));var util=require(_0x374c('0x1'));var logger=require('../../config/logger')(_0x374c('0x2'));var moment=require(_0x374c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x374c('0x4'));var rimraf=require(_0x374c('0x5'));var config=require(_0x374c('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x374c('0x7')]=function(_0x5cdbe3,_0x56b272){return _0x5cdbe3[_0x374c('0x8')](_0x374c('0x9'),attributes,{'tableName':_0x374c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x374c('0xb')});}; \ No newline at end of file +var _0xd84c=['rimraf','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x361f9b,_0x1ab949){var _0x30750c=function(_0x3822a3){while(--_0x3822a3){_0x361f9b['push'](_0x361f9b['shift']());}};_0x30750c(++_0x1ab949);}(_0xd84c,0x102));var _0xcd84=function(_0x4fab09,_0x36613d){_0x4fab09=_0x4fab09-0x0;var _0x1951d9=_0xd84c[_0x4fab09];return _0x1951d9;};'use strict';var _=require(_0xcd84('0x0'));var util=require(_0xcd84('0x1'));var logger=require(_0xcd84('0x2'))(_0xcd84('0x3'));var moment=require(_0xcd84('0x4'));var BPromise=require(_0xcd84('0x5'));var rp=require(_0xcd84('0x6'));var fs=require('fs');var path=require(_0xcd84('0x7'));var rimraf=require(_0xcd84('0x8'));var config=require('../../config/environment');var attributes=require(_0xcd84('0x9'));module[_0xcd84('0xa')]=function(_0x159209,_0x3df569){return _0x159209['define'](_0xcd84('0xb'),attributes,{'tableName':_0xcd84('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcd84('0xd'),'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 094e112..7b6f1e7 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 _0x6b3d=['CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0x6b3d,0xd1));var _0xd6b3=function(_0xc7a361,_0x204fd7){_0xc7a361=_0xc7a361-0x0;var _0x19f0c2=_0x6b3d[_0xc7a361];return _0x19f0c2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd6b3('0x0'));var BPromise=require('bluebird');var rs=require(_0xd6b3('0x1'));var fs=require('fs');var Redis=require(_0xd6b3('0x2'));var db=require(_0xd6b3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6b3('0x4'))('rpc');var config=require(_0xd6b3('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd6b3('0x6')][_0xd6b3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x8a74a1,_0x411d6b,_0x55f9cb){return new BPromise(function(_0x4f2634,_0x4e6f25){return client[_0xd6b3('0x8')](_0x8a74a1,_0x55f9cb)[_0xd6b3('0x9')](function(_0x4f1035){logger[_0xd6b3('0xa')](_0xd6b3('0xb'),_0x411d6b,_0xd6b3('0xc'));logger[_0xd6b3('0xd')](_0xd6b3('0xe'),_0x411d6b,'request\x20sent',JSON[_0xd6b3('0xf')](_0x4f1035));if(_0x4f1035[_0xd6b3('0x10')]){if(_0x4f1035[_0xd6b3('0x10')][_0xd6b3('0x11')]===0x1f4){logger[_0xd6b3('0x10')](_0xd6b3('0xb'),_0x411d6b,_0x4f1035[_0xd6b3('0x10')]['message']);return _0x4e6f25(_0x4f1035[_0xd6b3('0x10')]['message']);}logger[_0xd6b3('0x10')](_0xd6b3('0xb'),_0x411d6b,_0x4f1035[_0xd6b3('0x10')][_0xd6b3('0x12')]);return _0x4f2634(_0x4f1035['error'][_0xd6b3('0x12')]);}else{logger['info'](_0xd6b3('0xb'),_0x411d6b,_0xd6b3('0xc'));_0x4f2634(_0x4f1035[_0xd6b3('0x13')][_0xd6b3('0x12')]);}})['catch'](function(_0x3fce69){logger['error'](_0xd6b3('0xb'),_0x411d6b,_0x3fce69);_0x4e6f25(_0x3fce69);});});} \ No newline at end of file +var _0x3e72=['jayson/promise','client','http','request','info','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CannedAnswer,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x3e72,0xa5));var _0x23e7=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0x3e72[_0x2a3c4d];return _0x55c390;};'use strict';var _=require(_0x23e7('0x0'));var util=require(_0x23e7('0x1'));var moment=require(_0x23e7('0x2'));var BPromise=require(_0x23e7('0x3'));var rs=require(_0x23e7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23e7('0x5'))['db'];var utils=require(_0x23e7('0x6'));var logger=require(_0x23e7('0x7'))(_0x23e7('0x8'));var config=require(_0x23e7('0x9'));var jayson=require(_0x23e7('0xa'));var client=jayson[_0x23e7('0xb')][_0x23e7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x538bab,_0x5b8538,_0x223e49){return new BPromise(function(_0xc6a3bf,_0x4f7f64){return client[_0x23e7('0xd')](_0x538bab,_0x223e49)['then'](function(_0x2a67c3){logger[_0x23e7('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x5b8538,'request\x20sent');logger[_0x23e7('0xf')](_0x23e7('0x10'),_0x5b8538,_0x23e7('0x11'),JSON[_0x23e7('0x12')](_0x2a67c3));if(_0x2a67c3[_0x23e7('0x13')]){if(_0x2a67c3[_0x23e7('0x13')][_0x23e7('0x14')]===0x1f4){logger['error'](_0x23e7('0x15'),_0x5b8538,_0x2a67c3[_0x23e7('0x13')]['message']);return _0x4f7f64(_0x2a67c3['error']['message']);}logger[_0x23e7('0x13')](_0x23e7('0x15'),_0x5b8538,_0x2a67c3[_0x23e7('0x13')][_0x23e7('0x16')]);return _0xc6a3bf(_0x2a67c3['error'][_0x23e7('0x16')]);}else{logger[_0x23e7('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x5b8538,_0x23e7('0x11'));_0xc6a3bf(_0x2a67c3[_0x23e7('0x17')][_0x23e7('0x16')]);}})[_0x23e7('0x18')](function(_0x53f610){logger[_0x23e7('0x13')](_0x23e7('0x15'),_0x5b8538,_0x53f610);_0x4f7f64(_0x53f610);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index e9bb569..3ef79b4 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 _0x9028=['isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','show','post'];(function(_0x1e6eab,_0x216f5b){var _0x5f5517=function(_0x1acf8b){while(--_0x1acf8b){_0x1e6eab['push'](_0x1e6eab['shift']());}};_0x5f5517(++_0x216f5b);}(_0x9028,0x16d));var _0x8902=function(_0x5c6ba9,_0x5412c5){_0x5c6ba9=_0x5c6ba9-0x0;var _0x377b7a=_0x9028[_0x5c6ba9];return _0x377b7a;};'use strict';var multer=require(_0x8902('0x0'));var util=require(_0x8902('0x1'));var path=require('path');var timeout=require(_0x8902('0x2'));var express=require(_0x8902('0x3'));var router=express[_0x8902('0x4')]();var auth=require(_0x8902('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8902('0x6'));var controller=require(_0x8902('0x7'));router[_0x8902('0x8')]('/',auth['isAuthenticated'](),controller[_0x8902('0x9')]);router[_0x8902('0x8')](_0x8902('0xa'),auth['isAuthenticated'](),controller[_0x8902('0xb')]);router[_0x8902('0xc')]('/',auth[_0x8902('0xd')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8902('0xe')]);router[_0x8902('0xf')](_0x8902('0xa'),auth[_0x8902('0xd')](),controller[_0x8902('0x10')]);module[_0x8902('0x11')]=router; \ No newline at end of file +var _0xfa78=['destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','put','update'];(function(_0x288af2,_0x2b86b5){var _0x5871d3=function(_0x4ef8c1){while(--_0x4ef8c1){_0x288af2['push'](_0x288af2['shift']());}};_0x5871d3(++_0x2b86b5);}(_0xfa78,0x1e2));var _0x8fa7=function(_0x1be6ac,_0x47a0a7){_0x1be6ac=_0x1be6ac-0x0;var _0x59a477=_0xfa78[_0x1be6ac];return _0x59a477;};'use strict';var multer=require('multer');var util=require(_0x8fa7('0x0'));var path=require(_0x8fa7('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fa7('0x2'));var router=express['Router']();var auth=require(_0x8fa7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8fa7('0x4'));var controller=require(_0x8fa7('0x5'));router[_0x8fa7('0x6')]('/',auth[_0x8fa7('0x7')](),controller[_0x8fa7('0x8')]);router[_0x8fa7('0x6')](_0x8fa7('0x9'),auth[_0x8fa7('0x7')](),controller['show']);router[_0x8fa7('0xa')]('/',auth[_0x8fa7('0x7')](),controller['create']);router[_0x8fa7('0xb')]('/:id',auth[_0x8fa7('0x7')](),controller[_0x8fa7('0xc')]);router['delete']('/:id',auth[_0x8fa7('0x7')](),controller[_0x8fa7('0xd')]);module[_0x8fa7('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 69256a4..e674036 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 _0x03d3=['STRING','INTEGER','sequelize','exports','DATE'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x03d3,0x19c));var _0x303d=function(_0x55f4b4,_0xa50319){_0x55f4b4=_0x55f4b4-0x0;var _0x2f9b9d=_0x03d3[_0x55f4b4];return _0x2f9b9d;};'use strict';var Sequelize=require(_0x303d('0x0'));module[_0x303d('0x1')]={'calldate':{'type':Sequelize[_0x303d('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x303d('0x3')]},'src':{'type':Sequelize[_0x303d('0x3')]},'dst':{'type':Sequelize[_0x303d('0x3')]},'dcontext':{'type':Sequelize[_0x303d('0x3')]},'channel':{'type':Sequelize[_0x303d('0x3')]},'dstchannel':{'type':Sequelize[_0x303d('0x3')]},'lastapp':{'type':Sequelize[_0x303d('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x303d('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x303d('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x303d('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x303d('0x3')]},'uniqueid':{'type':Sequelize[_0x303d('0x3')]},'linkedid':{'type':Sequelize[_0x303d('0x3')]},'sequence':{'type':Sequelize[_0x303d('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x303d('0x3')]},'tag':{'type':Sequelize[_0x303d('0x3')]}}; \ No newline at end of file +var _0x3efa=['STRING','INTEGER','sequelize','exports','DATE'];(function(_0x578985,_0x524f80){var _0x546f0c=function(_0x35fc21){while(--_0x35fc21){_0x578985['push'](_0x578985['shift']());}};_0x546f0c(++_0x524f80);}(_0x3efa,0x1dd));var _0xa3ef=function(_0x44f9db,_0x2743c7){_0x44f9db=_0x44f9db-0x0;var _0x18f999=_0x3efa[_0x44f9db];return _0x18f999;};'use strict';var Sequelize=require(_0xa3ef('0x0'));module[_0xa3ef('0x1')]={'calldate':{'type':Sequelize[_0xa3ef('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xa3ef('0x3')]},'src':{'type':Sequelize[_0xa3ef('0x3')]},'dst':{'type':Sequelize[_0xa3ef('0x3')]},'dcontext':{'type':Sequelize[_0xa3ef('0x3')]},'channel':{'type':Sequelize[_0xa3ef('0x3')]},'dstchannel':{'type':Sequelize[_0xa3ef('0x3')]},'lastapp':{'type':Sequelize[_0xa3ef('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xa3ef('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa3ef('0x3')]},'amaflags':{'type':Sequelize[_0xa3ef('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xa3ef('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa3ef('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xa3ef('0x3')]},'peeraccount':{'type':Sequelize[_0xa3ef('0x3')]},'type':{'type':Sequelize[_0xa3ef('0x3')]},'tag':{'type':Sequelize[_0xa3ef('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 9d31af4..01ac8bf 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 _0xfcdc=['options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','name','index','map','Cdr','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge'];(function(_0xe66f4f,_0x2566da){var _0x47e05e=function(_0x1cbdd9){while(--_0x1cbdd9){_0xe66f4f['push'](_0xe66f4f['shift']());}};_0x47e05e(++_0x2566da);}(_0xfcdc,0x1ca));var _0xcfcd=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xfcdc[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0xcfcd('0x0'));var emlformat=require(_0xcfcd('0x1'));var rimraf=require(_0xcfcd('0x2'));var zipdir=require(_0xcfcd('0x3'));var jsonpatch=require(_0xcfcd('0x4'));var rp=require(_0xcfcd('0x5'));var moment=require('moment');var BPromise=require(_0xcfcd('0x6'));var Mustache=require('mustache');var util=require(_0xcfcd('0x7'));var path=require(_0xcfcd('0x8'));var sox=require('sox');var csv=require(_0xcfcd('0x9'));var ejs=require(_0xcfcd('0xa'));var fs=require('fs');var _=require(_0xcfcd('0xb'));var squel=require('squel');var crypto=require(_0xcfcd('0xc'));var jsforce=require(_0xcfcd('0xd'));var deskjs=require(_0xcfcd('0xe'));var toCsv=require(_0xcfcd('0x9'));var querystring=require(_0xcfcd('0xf'));var Papa=require(_0xcfcd('0x10'));var Redis=require(_0xcfcd('0x11'));var authService=require(_0xcfcd('0x12'));var qs=require(_0xcfcd('0x13'));var as=require(_0xcfcd('0x14'));var hardwareService=require(_0xcfcd('0x15'));var logger=require(_0xcfcd('0x16'))(_0xcfcd('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcfcd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f0394,_0xd7af68){_0xd7af68=_0xd7af68||0xcc;return function(_0x7b2156){if(_0x7b2156){return _0x1f0394[_0xcfcd('0x19')](_0xd7af68);}return _0x1f0394[_0xcfcd('0x1a')](_0xd7af68)[_0xcfcd('0x1b')]();};}function respondWithResult(_0x17615d,_0x230f3d){_0x230f3d=_0x230f3d||0xc8;return function(_0xf33cf1){if(_0xf33cf1){return _0x17615d[_0xcfcd('0x1a')](_0x230f3d)[_0xcfcd('0x1c')](_0xf33cf1);}};}function respondWithFilteredResult(_0x342799,_0x1fcec9){return function(_0x3820c0){if(_0x3820c0){var _0x4bc862=_0x3820c0[_0xcfcd('0x1d')],_0x375664=_0x1fcec9[_0xcfcd('0x1e')],_0x333995=_0x1fcec9[_0xcfcd('0x1e')]+_0x1fcec9[_0xcfcd('0x1f')],_0x330407;if(_0x333995>=_0x4bc862){_0x333995=_0x4bc862;_0x330407=0xc8;}else{_0x330407=0xce;}_0x342799[_0xcfcd('0x1a')](_0x330407);return _0x342799['set'](_0xcfcd('0x20'),_0x375664+'-'+_0x333995+'/'+_0x4bc862)[_0xcfcd('0x1c')](_0x3820c0);}return null;};}function patchUpdates(_0x4f3f59){return function(_0x213107){try{jsonpatch[_0xcfcd('0x21')](_0x213107,_0x4f3f59,!![]);}catch(_0x85944e){return BPromise['reject'](_0x85944e);}return _0x213107[_0xcfcd('0x22')]();};}function saveUpdates(_0x3e5852,_0x325226){return function(_0x15ccca){if(_0x15ccca){return _0x15ccca[_0xcfcd('0x23')](_0x3e5852)[_0xcfcd('0x24')](function(_0x393e96){return _0x393e96;});}return null;};}function removeEntity(_0x345e3f,_0x2fecc5){return function(_0x4e4e08){if(_0x4e4e08){return _0x4e4e08[_0xcfcd('0x25')]()[_0xcfcd('0x24')](function(){_0x345e3f['status'](0xcc)[_0xcfcd('0x1b')]();});}};}function handleEntityNotFound(_0x43e437,_0x1e6dde){return function(_0xa87ea4){if(!_0xa87ea4){_0x43e437[_0xcfcd('0x19')](0x194);}return _0xa87ea4;};}function handleError(_0x1bd91f,_0x560d4f){_0x560d4f=_0x560d4f||0x1f4;return function(_0xdb56dd){logger[_0xcfcd('0x26')](_0xdb56dd['stack']);if(_0xdb56dd['name']){delete _0xdb56dd[_0xcfcd('0x27')];}_0x1bd91f[_0xcfcd('0x1a')](_0x560d4f)['send'](_0xdb56dd);};}exports[_0xcfcd('0x28')]=function(_0x1eb146,_0x2a8852){var _0x46b382={},_0x5cfff7={},_0xa44641={'count':0x0,'rows':[]};var _0x3782b0=_[_0xcfcd('0x29')](db[_0xcfcd('0x2a')]['rawAttributes'],function(_0x19b069){return{'name':_0x19b069[_0xcfcd('0x2b')],'type':_0x19b069[_0xcfcd('0x2c')][_0xcfcd('0x2d')]};});_0x5cfff7['model']=_[_0xcfcd('0x29')](_0x3782b0,_0xcfcd('0x27'));_0x5cfff7['query']=_['keys'](_0x1eb146[_0xcfcd('0x2e')]);_0x5cfff7['filters']=_[_0xcfcd('0x2f')](_0x5cfff7[_0xcfcd('0x30')],_0x5cfff7['query']);_0x46b382['attributes']=_[_0xcfcd('0x2f')](_0x5cfff7[_0xcfcd('0x30')],qs[_0xcfcd('0x31')](_0x1eb146['query'][_0xcfcd('0x31')]));_0x46b382['attributes']=_0x46b382[_0xcfcd('0x32')][_0xcfcd('0x33')]?_0x46b382[_0xcfcd('0x32')]:_0x5cfff7[_0xcfcd('0x30')];if(!_0x1eb146[_0xcfcd('0x2e')][_0xcfcd('0x34')](_0xcfcd('0x35'))){_0x46b382[_0xcfcd('0x1f')]=qs[_0xcfcd('0x1f')](_0x1eb146[_0xcfcd('0x2e')][_0xcfcd('0x1f')]);_0x46b382[_0xcfcd('0x1e')]=qs['offset'](_0x1eb146[_0xcfcd('0x2e')][_0xcfcd('0x1e')]);}_0x46b382['order']=qs['sort'](_0x1eb146[_0xcfcd('0x2e')][_0xcfcd('0x36')]);_0x46b382[_0xcfcd('0x37')]=qs[_0xcfcd('0x38')](_[_0xcfcd('0x39')](_0x1eb146['query'],_0x5cfff7[_0xcfcd('0x38')]),_0x3782b0);if(_0x1eb146[_0xcfcd('0x2e')][_0xcfcd('0x3a')]){_0x46b382[_0xcfcd('0x37')]=_[_0xcfcd('0x3b')](_0x46b382[_0xcfcd('0x37')],{'$or':_[_0xcfcd('0x29')](_0x3782b0,function(_0x96a401){if(_0x96a401[_0xcfcd('0x2c')]!=='VIRTUAL'){var _0x44677d={};_0x44677d[_0x96a401['name']]={'$like':'%'+_0x1eb146['query'][_0xcfcd('0x3a')]+'%'};return _0x44677d;}})});}_0x46b382=_[_0xcfcd('0x3b')]({},_0x46b382,_0x1eb146[_0xcfcd('0x3c')]);var _0x5766d4={'where':_0x46b382[_0xcfcd('0x37')]};return db[_0xcfcd('0x2a')]['count'](_0x5766d4)['then'](function(_0x55ea8f){_0xa44641[_0xcfcd('0x1d')]=_0x55ea8f;if(_0x1eb146[_0xcfcd('0x2e')][_0xcfcd('0x3d')]){_0x46b382[_0xcfcd('0x3e')]=[{'all':!![]}];}return db[_0xcfcd('0x2a')][_0xcfcd('0x3f')](_0x46b382);})[_0xcfcd('0x24')](function(_0x2cc12e){_0xa44641[_0xcfcd('0x40')]=_0x2cc12e;return _0xa44641;})[_0xcfcd('0x24')](respondWithFilteredResult(_0x2a8852,_0x46b382))[_0xcfcd('0x41')](handleError(_0x2a8852,null));};exports[_0xcfcd('0x42')]=function(_0xb7e5b2,_0x26c7c5){var _0x5b6458={'raw':!![],'where':{'id':_0xb7e5b2[_0xcfcd('0x43')]['id']}},_0x10ed31={};_0x10ed31[_0xcfcd('0x30')]=_['keys'](db[_0xcfcd('0x2a')][_0xcfcd('0x44')]);_0x10ed31['query']=_[_0xcfcd('0x45')](_0xb7e5b2[_0xcfcd('0x2e')]);_0x10ed31[_0xcfcd('0x38')]=_[_0xcfcd('0x2f')](_0x10ed31[_0xcfcd('0x30')],_0x10ed31['query']);_0x5b6458[_0xcfcd('0x32')]=_[_0xcfcd('0x2f')](_0x10ed31[_0xcfcd('0x30')],qs[_0xcfcd('0x31')](_0xb7e5b2[_0xcfcd('0x2e')][_0xcfcd('0x31')]));_0x5b6458[_0xcfcd('0x32')]=_0x5b6458[_0xcfcd('0x32')][_0xcfcd('0x33')]?_0x5b6458['attributes']:_0x10ed31[_0xcfcd('0x30')];if(_0xb7e5b2[_0xcfcd('0x2e')][_0xcfcd('0x3d')]){_0x5b6458[_0xcfcd('0x3e')]=[{'all':!![]}];}_0x5b6458=_['merge']({},_0x5b6458,_0xb7e5b2[_0xcfcd('0x3c')]);return db['Cdr'][_0xcfcd('0x46')](_0x5b6458)[_0xcfcd('0x24')](handleEntityNotFound(_0x26c7c5,null))[_0xcfcd('0x24')](respondWithResult(_0x26c7c5,null))[_0xcfcd('0x41')](handleError(_0x26c7c5,null));};exports[_0xcfcd('0x47')]=function(_0x1a369e,_0x3980c2){return db[_0xcfcd('0x2a')][_0xcfcd('0x47')](_0x1a369e['body'],{})['then'](respondWithResult(_0x3980c2,0xc9))[_0xcfcd('0x41')](handleError(_0x3980c2,null));};exports[_0xcfcd('0x23')]=function(_0x1f010f,_0x2b957a){if(_0x1f010f['body']['id']){delete _0x1f010f[_0xcfcd('0x48')]['id'];}return db['Cdr'][_0xcfcd('0x46')]({'where':{'id':_0x1f010f[_0xcfcd('0x43')]['id']}})[_0xcfcd('0x24')](handleEntityNotFound(_0x2b957a,null))[_0xcfcd('0x24')](saveUpdates(_0x1f010f[_0xcfcd('0x48')],null))[_0xcfcd('0x24')](respondWithResult(_0x2b957a,null))[_0xcfcd('0x41')](handleError(_0x2b957a,null));};exports[_0xcfcd('0x25')]=function(_0xb70ef8,_0x13cc1c){return db[_0xcfcd('0x2a')][_0xcfcd('0x46')]({'where':{'id':_0xb70ef8['params']['id']}})[_0xcfcd('0x24')](handleEntityNotFound(_0x13cc1c,null))['then'](removeEntity(_0x13cc1c,null))[_0xcfcd('0x41')](handleError(_0x13cc1c,null));};exports[_0xcfcd('0x49')]=function(_0x10fda1,_0x353905){return db[_0xcfcd('0x2a')][_0xcfcd('0x49')]()[_0xcfcd('0x24')](respondWithResult(_0x353905,null))[_0xcfcd('0x41')](handleError(_0x353905,null));}; \ No newline at end of file +var _0x33cf=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','show','keys','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../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','index','map','Cdr','rawAttributes','fieldName','type','key','model','query'];(function(_0x2aa3ed,_0x21bb61){var _0x4e0881=function(_0x581164){while(--_0x581164){_0x2aa3ed['push'](_0x2aa3ed['shift']());}};_0x4e0881(++_0x21bb61);}(_0x33cf,0xba));var _0xf33c=function(_0x56cdb6,_0x404562){_0x56cdb6=_0x56cdb6-0x0;var _0x4da43e=_0x33cf[_0x56cdb6];return _0x4da43e;};'use strict';var pdf=require(_0xf33c('0x0'));var emlformat=require(_0xf33c('0x1'));var rimraf=require(_0xf33c('0x2'));var zipdir=require(_0xf33c('0x3'));var jsonpatch=require(_0xf33c('0x4'));var rp=require(_0xf33c('0x5'));var moment=require(_0xf33c('0x6'));var BPromise=require(_0xf33c('0x7'));var Mustache=require(_0xf33c('0x8'));var util=require(_0xf33c('0x9'));var path=require(_0xf33c('0xa'));var sox=require('sox');var csv=require(_0xf33c('0xb'));var ejs=require(_0xf33c('0xc'));var fs=require('fs');var _=require(_0xf33c('0xd'));var squel=require(_0xf33c('0xe'));var crypto=require('crypto');var jsforce=require(_0xf33c('0xf'));var deskjs=require(_0xf33c('0x10'));var toCsv=require(_0xf33c('0xb'));var querystring=require(_0xf33c('0x11'));var Papa=require(_0xf33c('0x12'));var Redis=require(_0xf33c('0x13'));var authService=require(_0xf33c('0x14'));var qs=require(_0xf33c('0x15'));var as=require(_0xf33c('0x16'));var hardwareService=require(_0xf33c('0x17'));var logger=require(_0xf33c('0x18'))('api');var utils=require(_0xf33c('0x19'));var config=require(_0xf33c('0x1a'));var licenseUtil=require(_0xf33c('0x1b'));var db=require(_0xf33c('0x1c'))['db'];function respondWithStatusCode(_0x50f8cd,_0x24793d){_0x24793d=_0x24793d||0xcc;return function(_0x136cc6){if(_0x136cc6){return _0x50f8cd[_0xf33c('0x1d')](_0x24793d);}return _0x50f8cd['status'](_0x24793d)[_0xf33c('0x1e')]();};}function respondWithResult(_0x59d6c5,_0x57188c){_0x57188c=_0x57188c||0xc8;return function(_0x49282d){if(_0x49282d){return _0x59d6c5[_0xf33c('0x1f')](_0x57188c)[_0xf33c('0x20')](_0x49282d);}};}function respondWithFilteredResult(_0x145531,_0x90b03a){return function(_0x43fd22){if(_0x43fd22){var _0x3f5d39=_0x43fd22[_0xf33c('0x21')],_0x2c5941=_0x90b03a[_0xf33c('0x22')],_0x5376c6=_0x90b03a[_0xf33c('0x22')]+_0x90b03a[_0xf33c('0x23')],_0xf6cc56;if(_0x5376c6>=_0x3f5d39){_0x5376c6=_0x3f5d39;_0xf6cc56=0xc8;}else{_0xf6cc56=0xce;}_0x145531['status'](_0xf6cc56);return _0x145531[_0xf33c('0x24')](_0xf33c('0x25'),_0x2c5941+'-'+_0x5376c6+'/'+_0x3f5d39)[_0xf33c('0x20')](_0x43fd22);}return null;};}function patchUpdates(_0x4b187e){return function(_0x491cdc){try{jsonpatch[_0xf33c('0x26')](_0x491cdc,_0x4b187e,!![]);}catch(_0x3aa491){return BPromise[_0xf33c('0x27')](_0x3aa491);}return _0x491cdc[_0xf33c('0x28')]();};}function saveUpdates(_0x217e9b,_0x8163eb){return function(_0x3e8472){if(_0x3e8472){return _0x3e8472[_0xf33c('0x29')](_0x217e9b)[_0xf33c('0x2a')](function(_0x48a963){return _0x48a963;});}return null;};}function removeEntity(_0x2487ae,_0x19e516){return function(_0x303774){if(_0x303774){return _0x303774[_0xf33c('0x2b')]()[_0xf33c('0x2a')](function(){_0x2487ae[_0xf33c('0x1f')](0xcc)[_0xf33c('0x1e')]();});}};}function handleEntityNotFound(_0x373a76,_0x38291e){return function(_0x30f9f4){if(!_0x30f9f4){_0x373a76[_0xf33c('0x1d')](0x194);}return _0x30f9f4;};}function handleError(_0xd7f068,_0x4f820a){_0x4f820a=_0x4f820a||0x1f4;return function(_0x50a6f4){logger[_0xf33c('0x2c')](_0x50a6f4[_0xf33c('0x2d')]);if(_0x50a6f4[_0xf33c('0x2e')]){delete _0x50a6f4[_0xf33c('0x2e')];}_0xd7f068[_0xf33c('0x1f')](_0x4f820a)[_0xf33c('0x2f')](_0x50a6f4);};}exports[_0xf33c('0x30')]=function(_0x3a74ea,_0x457747){var _0x8a2986={},_0x2ad6ce={},_0x53fa6e={'count':0x0,'rows':[]};var _0x37fa13=_[_0xf33c('0x31')](db[_0xf33c('0x32')][_0xf33c('0x33')],function(_0x6af8ca){return{'name':_0x6af8ca[_0xf33c('0x34')],'type':_0x6af8ca[_0xf33c('0x35')][_0xf33c('0x36')]};});_0x2ad6ce[_0xf33c('0x37')]=_[_0xf33c('0x31')](_0x37fa13,_0xf33c('0x2e'));_0x2ad6ce[_0xf33c('0x38')]=_['keys'](_0x3a74ea[_0xf33c('0x38')]);_0x2ad6ce['filters']=_[_0xf33c('0x39')](_0x2ad6ce[_0xf33c('0x37')],_0x2ad6ce[_0xf33c('0x38')]);_0x8a2986[_0xf33c('0x3a')]=_[_0xf33c('0x39')](_0x2ad6ce[_0xf33c('0x37')],qs[_0xf33c('0x3b')](_0x3a74ea[_0xf33c('0x38')][_0xf33c('0x3b')]));_0x8a2986[_0xf33c('0x3a')]=_0x8a2986['attributes'][_0xf33c('0x3c')]?_0x8a2986[_0xf33c('0x3a')]:_0x2ad6ce[_0xf33c('0x37')];if(!_0x3a74ea[_0xf33c('0x38')][_0xf33c('0x3d')](_0xf33c('0x3e'))){_0x8a2986[_0xf33c('0x23')]=qs[_0xf33c('0x23')](_0x3a74ea['query'][_0xf33c('0x23')]);_0x8a2986[_0xf33c('0x22')]=qs[_0xf33c('0x22')](_0x3a74ea[_0xf33c('0x38')][_0xf33c('0x22')]);}_0x8a2986[_0xf33c('0x3f')]=qs[_0xf33c('0x40')](_0x3a74ea[_0xf33c('0x38')][_0xf33c('0x40')]);_0x8a2986[_0xf33c('0x41')]=qs[_0xf33c('0x42')](_[_0xf33c('0x43')](_0x3a74ea[_0xf33c('0x38')],_0x2ad6ce[_0xf33c('0x42')]),_0x37fa13);if(_0x3a74ea[_0xf33c('0x38')][_0xf33c('0x44')]){_0x8a2986[_0xf33c('0x41')]=_['merge'](_0x8a2986[_0xf33c('0x41')],{'$or':_['map'](_0x37fa13,function(_0x321913){if(_0x321913[_0xf33c('0x35')]!=='VIRTUAL'){var _0x4791f6={};_0x4791f6[_0x321913[_0xf33c('0x2e')]]={'$like':'%'+_0x3a74ea[_0xf33c('0x38')][_0xf33c('0x44')]+'%'};return _0x4791f6;}})});}_0x8a2986=_[_0xf33c('0x45')]({},_0x8a2986,_0x3a74ea[_0xf33c('0x46')]);var _0x272c03={'where':_0x8a2986[_0xf33c('0x41')]};return db['Cdr'][_0xf33c('0x21')](_0x272c03)['then'](function(_0x1ff784){_0x53fa6e[_0xf33c('0x21')]=_0x1ff784;if(_0x3a74ea[_0xf33c('0x38')][_0xf33c('0x47')]){_0x8a2986[_0xf33c('0x48')]=[{'all':!![]}];}return db[_0xf33c('0x32')][_0xf33c('0x49')](_0x8a2986);})[_0xf33c('0x2a')](function(_0x50fa21){_0x53fa6e['rows']=_0x50fa21;return _0x53fa6e;})[_0xf33c('0x2a')](respondWithFilteredResult(_0x457747,_0x8a2986))[_0xf33c('0x4a')](handleError(_0x457747,null));};exports[_0xf33c('0x4b')]=function(_0x24105e,_0x2761ee){var _0x30976d={'raw':!![],'where':{'id':_0x24105e['params']['id']}},_0x560633={};_0x560633[_0xf33c('0x37')]=_[_0xf33c('0x4c')](db[_0xf33c('0x32')][_0xf33c('0x33')]);_0x560633[_0xf33c('0x38')]=_['keys'](_0x24105e['query']);_0x560633[_0xf33c('0x42')]=_['intersection'](_0x560633['model'],_0x560633[_0xf33c('0x38')]);_0x30976d['attributes']=_[_0xf33c('0x39')](_0x560633[_0xf33c('0x37')],qs['fields'](_0x24105e[_0xf33c('0x38')][_0xf33c('0x3b')]));_0x30976d['attributes']=_0x30976d['attributes'][_0xf33c('0x3c')]?_0x30976d['attributes']:_0x560633[_0xf33c('0x37')];if(_0x24105e[_0xf33c('0x38')][_0xf33c('0x47')]){_0x30976d['include']=[{'all':!![]}];}_0x30976d=_[_0xf33c('0x45')]({},_0x30976d,_0x24105e[_0xf33c('0x46')]);return db[_0xf33c('0x32')][_0xf33c('0x4d')](_0x30976d)[_0xf33c('0x2a')](handleEntityNotFound(_0x2761ee,null))[_0xf33c('0x2a')](respondWithResult(_0x2761ee,null))[_0xf33c('0x4a')](handleError(_0x2761ee,null));};exports[_0xf33c('0x4e')]=function(_0xabfc35,_0x47b3e0){return db[_0xf33c('0x32')][_0xf33c('0x4e')](_0xabfc35['body'],{})[_0xf33c('0x2a')](respondWithResult(_0x47b3e0,0xc9))[_0xf33c('0x4a')](handleError(_0x47b3e0,null));};exports['update']=function(_0x300ab2,_0x5effdd){if(_0x300ab2['body']['id']){delete _0x300ab2[_0xf33c('0x4f')]['id'];}return db[_0xf33c('0x32')][_0xf33c('0x4d')]({'where':{'id':_0x300ab2['params']['id']}})['then'](handleEntityNotFound(_0x5effdd,null))[_0xf33c('0x2a')](saveUpdates(_0x300ab2[_0xf33c('0x4f')],null))[_0xf33c('0x2a')](respondWithResult(_0x5effdd,null))['catch'](handleError(_0x5effdd,null));};exports[_0xf33c('0x2b')]=function(_0xf1e66d,_0x49d73a){return db[_0xf33c('0x32')][_0xf33c('0x4d')]({'where':{'id':_0xf1e66d[_0xf33c('0x50')]['id']}})[_0xf33c('0x2a')](handleEntityNotFound(_0x49d73a,null))[_0xf33c('0x2a')](removeEntity(_0x49d73a,null))[_0xf33c('0x4a')](handleError(_0x49d73a,null));};exports['describe']=function(_0x45eaf6,_0x495070){return db['Cdr']['describe']()[_0xf33c('0x2a')](respondWithResult(_0x495070,null))[_0xf33c('0x4a')](handleError(_0x495070,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 34cf1e8..5702f51 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 _0x5fab=['request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x3b26cb,_0x56edae){var _0x2403d2=function(_0x41268c){while(--_0x41268c){_0x3b26cb['push'](_0x3b26cb['shift']());}};_0x2403d2(++_0x56edae);}(_0x5fab,0x177));var _0xb5fa=function(_0x6ffa12,_0x45a92a){_0x6ffa12=_0x6ffa12-0x0;var _0x17b047=_0x5fab[_0x6ffa12];return _0x17b047;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['accountcode']},{'name':_0xb5fa('0xe'),'fields':[_0xb5fa('0xe')]},{'name':_0xb5fa('0xf'),'fields':['disposition']},{'name':'dst','fields':[_0xb5fa('0x10')]},{'name':_0xb5fa('0x11'),'fields':[_0xb5fa('0x11')]},{'name':_0xb5fa('0x12'),'fields':[_0xb5fa('0x12')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1623=['disposition','src','uniqueid','lodash','api','moment','bluebird','request-promise','path','./cdr.attributes','Cdr','cdr','accountcode','calldate'];(function(_0x5d3f80,_0x10ba8d){var _0x155897=function(_0x7b5f){while(--_0x7b5f){_0x5d3f80['push'](_0x5d3f80['shift']());}};_0x155897(++_0x10ba8d);}(_0x1623,0xab));var _0x3162=function(_0x412d39,_0x2e0a5a){_0x412d39=_0x412d39-0x0;var _0x3f73b8=_0x1623[_0x412d39];return _0x3f73b8;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));module['exports']=function(_0x1b55f2,_0x428de6){return _0x1b55f2['define'](_0x3162('0x7'),attributes,{'tableName':_0x3162('0x8'),'paranoid':![],'indexes':[{'name':_0x3162('0x9'),'fields':[_0x3162('0x9')]},{'name':_0x3162('0xa'),'fields':[_0x3162('0xa')]},{'name':_0x3162('0xb'),'fields':[_0x3162('0xb')]},{'name':'dst','fields':['dst']},{'name':_0x3162('0xc'),'fields':[_0x3162('0xc')]},{'name':_0x3162('0xd'),'fields':[_0x3162('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 439c2a6..7884d4c 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 _0x00a9=['message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x7dbd65,_0x18da49){var _0x33d551=function(_0x7ce789){while(--_0x7ce789){_0x7dbd65['push'](_0x7dbd65['shift']());}};_0x33d551(++_0x18da49);}(_0x00a9,0xe8));var _0x900a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x00a9[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x900a('0x0'));var util=require(_0x900a('0x1'));var moment=require(_0x900a('0x2'));var BPromise=require('bluebird');var rs=require(_0x900a('0x3'));var fs=require('fs');var Redis=require(_0x900a('0x4'));var db=require(_0x900a('0x5'))['db'];var utils=require(_0x900a('0x6'));var logger=require(_0x900a('0x7'))(_0x900a('0x8'));var config=require(_0x900a('0x9'));var jayson=require(_0x900a('0xa'));var client=jayson[_0x900a('0xb')][_0x900a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3fc710,_0x3920be,_0x2051b9){return new BPromise(function(_0x11a308,_0x5e2672){return client[_0x900a('0xd')](_0x3fc710,_0x2051b9)[_0x900a('0xe')](function(_0x580e6f){logger[_0x900a('0xf')](_0x900a('0x10'),_0x3920be,_0x900a('0x11'));logger['debug'](_0x900a('0x12'),_0x3920be,_0x900a('0x11'),JSON['stringify'](_0x580e6f));if(_0x580e6f[_0x900a('0x13')]){if(_0x580e6f[_0x900a('0x13')][_0x900a('0x14')]===0x1f4){logger[_0x900a('0x13')]('Cdr,\x20%s,\x20%s',_0x3920be,_0x580e6f[_0x900a('0x13')]['message']);return _0x5e2672(_0x580e6f[_0x900a('0x13')][_0x900a('0x15')]);}logger[_0x900a('0x13')](_0x900a('0x10'),_0x3920be,_0x580e6f[_0x900a('0x13')][_0x900a('0x15')]);return _0x11a308(_0x580e6f[_0x900a('0x13')][_0x900a('0x15')]);}else{logger['info'](_0x900a('0x10'),_0x3920be,_0x900a('0x11'));_0x11a308(_0x580e6f[_0x900a('0x16')][_0x900a('0x15')]);}})['catch'](function(_0x2ca193){logger['error'](_0x900a('0x10'),_0x3920be,_0x2ca193);_0x5e2672(_0x2ca193);});});} \ No newline at end of file +var _0x3b34=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x447feb,_0x512e68){var _0x1036a7=function(_0x36dcbe){while(--_0x36dcbe){_0x447feb['push'](_0x447feb['shift']());}};_0x1036a7(++_0x512e68);}(_0x3b34,0x1a4));var _0x43b3=function(_0x50ea02,_0x4c8e80){_0x50ea02=_0x50ea02-0x0;var _0x1c2df0=_0x3b34[_0x50ea02];return _0x1c2df0;};'use strict';var _=require(_0x43b3('0x0'));var util=require('util');var moment=require(_0x43b3('0x1'));var BPromise=require('bluebird');var rs=require(_0x43b3('0x2'));var fs=require('fs');var Redis=require(_0x43b3('0x3'));var db=require(_0x43b3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x43b3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x43b3('0x6'));var client=jayson['client'][_0x43b3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2514c3,_0x5bc444,_0x346f26){return new BPromise(function(_0x1aff14,_0x45f421){return client[_0x43b3('0x8')](_0x2514c3,_0x346f26)['then'](function(_0x18f84d){logger[_0x43b3('0x9')](_0x43b3('0xa'),_0x5bc444,_0x43b3('0xb'));logger[_0x43b3('0xc')](_0x43b3('0xd'),_0x5bc444,_0x43b3('0xb'),JSON[_0x43b3('0xe')](_0x18f84d));if(_0x18f84d[_0x43b3('0xf')]){if(_0x18f84d[_0x43b3('0xf')]['code']===0x1f4){logger['error'](_0x43b3('0xa'),_0x5bc444,_0x18f84d['error'][_0x43b3('0x10')]);return _0x45f421(_0x18f84d[_0x43b3('0xf')][_0x43b3('0x10')]);}logger[_0x43b3('0xf')](_0x43b3('0xa'),_0x5bc444,_0x18f84d[_0x43b3('0xf')][_0x43b3('0x10')]);return _0x1aff14(_0x18f84d['error'][_0x43b3('0x10')]);}else{logger['info'](_0x43b3('0xa'),_0x5bc444,_0x43b3('0xb'));_0x1aff14(_0x18f84d[_0x43b3('0x11')]['message']);}})[_0x43b3('0x12')](function(_0x1dfd48){logger[_0x43b3('0xf')]('Cdr,\x20%s,\x20%s',_0x5bc444,_0x1dfd48);_0x45f421(_0x1dfd48);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 6122f5d..d8c16ef 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 _0xaf95=['put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xaf95,0x180));var _0x5af9=function(_0x2db4c1,_0x3d87fd){_0x2db4c1=_0x2db4c1-0x0;var _0x3fe1c3=_0xaf95[_0x2db4c1];return _0x3fe1c3;};'use strict';var multer=require(_0x5af9('0x0'));var util=require('util');var path=require(_0x5af9('0x1'));var timeout=require(_0x5af9('0x2'));var express=require(_0x5af9('0x3'));var router=express[_0x5af9('0x4')]();var auth=require(_0x5af9('0x5'));var interaction=require(_0x5af9('0x6'));var config=require(_0x5af9('0x7'));var controller=require(_0x5af9('0x8'));router[_0x5af9('0x9')]('/',auth[_0x5af9('0xa')](),controller[_0x5af9('0xb')]);router['get']('/describe',auth[_0x5af9('0xa')](),controller[_0x5af9('0xc')]);router[_0x5af9('0x9')](_0x5af9('0xd'),auth[_0x5af9('0xa')](),controller[_0x5af9('0xe')]);router[_0x5af9('0xf')]('/',auth[_0x5af9('0xa')](),controller['create']);router[_0x5af9('0x10')](_0x5af9('0xd'),auth[_0x5af9('0xa')](),controller['update']);router[_0x5af9('0x11')](_0x5af9('0xd'),auth[_0x5af9('0xa')](),controller[_0x5af9('0x12')]);module[_0x5af9('0x13')]=router; \ No newline at end of file +var _0xa946=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','express'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xa946,0x1c8));var _0x6a94=function(_0x5e2ac7,_0x45265d){_0x5e2ac7=_0x5e2ac7-0x0;var _0x4fb946=_0xa946[_0x5e2ac7];return _0x4fb946;};'use strict';var multer=require(_0x6a94('0x0'));var util=require(_0x6a94('0x1'));var path=require(_0x6a94('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a94('0x3'));var router=express[_0x6a94('0x4')]();var auth=require(_0x6a94('0x5'));var interaction=require(_0x6a94('0x6'));var config=require(_0x6a94('0x7'));var controller=require(_0x6a94('0x8'));router[_0x6a94('0x9')]('/',auth[_0x6a94('0xa')](),controller['index']);router['get'](_0x6a94('0xb'),auth['isAuthenticated'](),controller[_0x6a94('0xc')]);router[_0x6a94('0x9')](_0x6a94('0xd'),auth[_0x6a94('0xa')](),controller[_0x6a94('0xe')]);router[_0x6a94('0xf')]('/',auth[_0x6a94('0xa')](),controller['create']);router['put'](_0x6a94('0xd'),auth[_0x6a94('0xa')](),controller[_0x6a94('0x10')]);router[_0x6a94('0x11')](_0x6a94('0xd'),auth[_0x6a94('0xa')](),controller[_0x6a94('0x12')]);module[_0x6a94('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index d79a9b8..052b316 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 _0xaa3b=['INTEGER','STRING','noop','sequelize','exports'];(function(_0x4c85e4,_0x24d438){var _0x424be6=function(_0x4f9e44){while(--_0x4f9e44){_0x4c85e4['push'](_0x4c85e4['shift']());}};_0x424be6(++_0x24d438);}(_0xaa3b,0xcb));var _0xbaa3=function(_0x413d74,_0x5bab1b){_0x413d74=_0x413d74-0x0;var _0x177f90=_0xaa3b[_0x413d74];return _0x177f90;};'use strict';var Sequelize=require(_0xbaa3('0x0'));module[_0xbaa3('0x1')]={'priority':{'type':Sequelize[_0xbaa3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbaa3('0x3')],'allowNull':![],'defaultValue':_0xbaa3('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbaa3('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xdc45=['sequelize','exports','INTEGER','noop','STRING','*,*,*,*'];(function(_0x65e5a1,_0x42c821){var _0x42cb2e=function(_0xaab53f){while(--_0xaab53f){_0x65e5a1['push'](_0x65e5a1['shift']());}};_0x42cb2e(++_0x42c821);}(_0xdc45,0x156));var _0x5dc4=function(_0x191018,_0x1903b3){_0x191018=_0x191018-0x0;var _0x5d00ca=_0xdc45[_0x191018];return _0x5d00ca;};'use strict';var Sequelize=require(_0x5dc4('0x0'));module[_0x5dc4('0x1')]={'priority':{'type':Sequelize[_0x5dc4('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5dc4('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5dc4('0x4')],'defaultValue':_0x5dc4('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 76fa2aa..3eb36a7 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 _0xabd3=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','params','model','keys','rawAttributes','query','attributes','intersection','fields','length','includeAll','merge','options','ChatApplication','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0xabd3,0xa1));var _0x3abd=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0xabd3[_0x41c381];return _0x427981;};'use strict';var pdf=require(_0x3abd('0x0'));var emlformat=require(_0x3abd('0x1'));var rimraf=require(_0x3abd('0x2'));var zipdir=require(_0x3abd('0x3'));var jsonpatch=require(_0x3abd('0x4'));var rp=require(_0x3abd('0x5'));var moment=require(_0x3abd('0x6'));var BPromise=require(_0x3abd('0x7'));var Mustache=require(_0x3abd('0x8'));var util=require('util');var path=require(_0x3abd('0x9'));var sox=require(_0x3abd('0xa'));var csv=require('to-csv');var ejs=require(_0x3abd('0xb'));var fs=require('fs');var _=require(_0x3abd('0xc'));var squel=require(_0x3abd('0xd'));var crypto=require(_0x3abd('0xe'));var jsforce=require(_0x3abd('0xf'));var deskjs=require(_0x3abd('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3abd('0x11'));var Redis=require(_0x3abd('0x12'));var authService=require(_0x3abd('0x13'));var qs=require(_0x3abd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3abd('0x15'));var logger=require(_0x3abd('0x16'))('api');var utils=require(_0x3abd('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3abd('0x18'))['db'];function respondWithStatusCode(_0x2d9641,_0x409f34){_0x409f34=_0x409f34||0xcc;return function(_0x2f0014){if(_0x2f0014){return _0x2d9641[_0x3abd('0x19')](_0x409f34);}return _0x2d9641['status'](_0x409f34)[_0x3abd('0x1a')]();};}function respondWithResult(_0x38cb36,_0x5d2929){_0x5d2929=_0x5d2929||0xc8;return function(_0x546a90){if(_0x546a90){return _0x38cb36['status'](_0x5d2929)[_0x3abd('0x1b')](_0x546a90);}};}function respondWithFilteredResult(_0x33fc08,_0x451120){return function(_0x406e16){if(_0x406e16){var _0x30f4e1=_0x406e16[_0x3abd('0x1c')],_0x5ae55a=_0x451120[_0x3abd('0x1d')],_0x3e642e=_0x451120[_0x3abd('0x1d')]+_0x451120['limit'],_0x45381d;if(_0x3e642e>=_0x30f4e1){_0x3e642e=_0x30f4e1;_0x45381d=0xc8;}else{_0x45381d=0xce;}_0x33fc08['status'](_0x45381d);return _0x33fc08[_0x3abd('0x1e')](_0x3abd('0x1f'),_0x5ae55a+'-'+_0x3e642e+'/'+_0x30f4e1)[_0x3abd('0x1b')](_0x406e16);}return null;};}function patchUpdates(_0x4e863f){return function(_0x19710e){try{jsonpatch[_0x3abd('0x20')](_0x19710e,_0x4e863f,!![]);}catch(_0x314478){return BPromise[_0x3abd('0x21')](_0x314478);}return _0x19710e[_0x3abd('0x22')]();};}function saveUpdates(_0x496a5e,_0x2a2731){return function(_0xba2f51){if(_0xba2f51){return _0xba2f51[_0x3abd('0x23')](_0x496a5e)[_0x3abd('0x24')](function(_0x369b06){return _0x369b06;});}return null;};}function removeEntity(_0x2a9a39,_0x367eff){return function(_0x36ea11){if(_0x36ea11){return _0x36ea11[_0x3abd('0x25')]()[_0x3abd('0x24')](function(){_0x2a9a39[_0x3abd('0x26')](0xcc)[_0x3abd('0x1a')]();});}};}function handleEntityNotFound(_0xf48bf1,_0x2ad07a){return function(_0x4c50fa){if(!_0x4c50fa){_0xf48bf1[_0x3abd('0x19')](0x194);}return _0x4c50fa;};}function handleError(_0x31fa12,_0x52abd4){_0x52abd4=_0x52abd4||0x1f4;return function(_0x58bbaf){logger[_0x3abd('0x27')](_0x58bbaf[_0x3abd('0x28')]);if(_0x58bbaf[_0x3abd('0x29')]){delete _0x58bbaf['name'];}_0x31fa12[_0x3abd('0x26')](_0x52abd4)[_0x3abd('0x2a')](_0x58bbaf);};}exports['show']=function(_0x2f70b5,_0x5b6db0){var _0x5ace67={'raw':!![],'where':{'id':_0x2f70b5[_0x3abd('0x2b')]['id']}},_0x131c7d={};_0x131c7d[_0x3abd('0x2c')]=_[_0x3abd('0x2d')](db['ChatApplication'][_0x3abd('0x2e')]);_0x131c7d[_0x3abd('0x2f')]=_['keys'](_0x2f70b5[_0x3abd('0x2f')]);_0x131c7d['filters']=_['intersection'](_0x131c7d[_0x3abd('0x2c')],_0x131c7d[_0x3abd('0x2f')]);_0x5ace67[_0x3abd('0x30')]=_[_0x3abd('0x31')](_0x131c7d['model'],qs[_0x3abd('0x32')](_0x2f70b5['query']['fields']));_0x5ace67[_0x3abd('0x30')]=_0x5ace67['attributes'][_0x3abd('0x33')]?_0x5ace67[_0x3abd('0x30')]:_0x131c7d['model'];if(_0x2f70b5['query'][_0x3abd('0x34')]){_0x5ace67['include']=[{'all':!![]}];}_0x5ace67=_[_0x3abd('0x35')]({},_0x5ace67,_0x2f70b5[_0x3abd('0x36')]);return db[_0x3abd('0x37')][_0x3abd('0x38')](_0x5ace67)[_0x3abd('0x24')](handleEntityNotFound(_0x5b6db0,null))['then'](respondWithResult(_0x5b6db0,null))[_0x3abd('0x39')](handleError(_0x5b6db0,null));};exports['update']=function(_0x32fb4e,_0x9c53ce){if(_0x32fb4e['body']['id']){delete _0x32fb4e[_0x3abd('0x3a')]['id'];}return db['ChatApplication'][_0x3abd('0x38')]({'where':{'id':_0x32fb4e[_0x3abd('0x2b')]['id']}})[_0x3abd('0x24')](handleEntityNotFound(_0x9c53ce,null))[_0x3abd('0x24')](saveUpdates(_0x32fb4e[_0x3abd('0x3a')],null))['then'](respondWithResult(_0x9c53ce,null))[_0x3abd('0x39')](handleError(_0x9c53ce,null));};exports['destroy']=function(_0x20f533,_0x53963d){return db['ChatApplication']['find']({'where':{'id':_0x20f533[_0x3abd('0x2b')]['id']}})[_0x3abd('0x24')](handleEntityNotFound(_0x53963d,null))[_0x3abd('0x24')](removeEntity(_0x53963d,null))[_0x3abd('0x39')](handleError(_0x53963d,null));}; \ No newline at end of file +var _0x7de0=['name','send','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','find','then','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','status','end'];(function(_0x3fd531,_0x538738){var _0x5bd9db=function(_0x676411){while(--_0x676411){_0x3fd531['push'](_0x3fd531['shift']());}};_0x5bd9db(++_0x538738);}(_0x7de0,0x17c));var _0x07de=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7de0[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x07de('0x0'));var emlformat=require(_0x07de('0x1'));var rimraf=require(_0x07de('0x2'));var zipdir=require(_0x07de('0x3'));var jsonpatch=require(_0x07de('0x4'));var rp=require(_0x07de('0x5'));var moment=require(_0x07de('0x6'));var BPromise=require(_0x07de('0x7'));var Mustache=require(_0x07de('0x8'));var util=require(_0x07de('0x9'));var path=require(_0x07de('0xa'));var sox=require(_0x07de('0xb'));var csv=require(_0x07de('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x07de('0xd'));var squel=require(_0x07de('0xe'));var crypto=require(_0x07de('0xf'));var jsforce=require(_0x07de('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x07de('0xc'));var querystring=require(_0x07de('0x11'));var Papa=require(_0x07de('0x12'));var Redis=require(_0x07de('0x13'));var authService=require(_0x07de('0x14'));var qs=require(_0x07de('0x15'));var as=require(_0x07de('0x16'));var hardwareService=require(_0x07de('0x17'));var logger=require(_0x07de('0x18'))(_0x07de('0x19'));var utils=require('../../config/utils');var config=require(_0x07de('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x185f6f,_0x58851e){_0x58851e=_0x58851e||0xcc;return function(_0xf0b8fc){if(_0xf0b8fc){return _0x185f6f[_0x07de('0x1b')](_0x58851e);}return _0x185f6f['status'](_0x58851e)['end']();};}function respondWithResult(_0xa220de,_0xa24e04){_0xa24e04=_0xa24e04||0xc8;return function(_0x5e7f78){if(_0x5e7f78){return _0xa220de['status'](_0xa24e04)[_0x07de('0x1c')](_0x5e7f78);}};}function respondWithFilteredResult(_0x124025,_0x299f61){return function(_0x1de2ed){if(_0x1de2ed){var _0x43c20b=_0x1de2ed[_0x07de('0x1d')],_0x5c8d77=_0x299f61[_0x07de('0x1e')],_0x2cb4fb=_0x299f61['offset']+_0x299f61['limit'],_0x56ef7d;if(_0x2cb4fb>=_0x43c20b){_0x2cb4fb=_0x43c20b;_0x56ef7d=0xc8;}else{_0x56ef7d=0xce;}_0x124025['status'](_0x56ef7d);return _0x124025[_0x07de('0x1f')](_0x07de('0x20'),_0x5c8d77+'-'+_0x2cb4fb+'/'+_0x43c20b)[_0x07de('0x1c')](_0x1de2ed);}return null;};}function patchUpdates(_0x17b96b){return function(_0x25f820){try{jsonpatch[_0x07de('0x21')](_0x25f820,_0x17b96b,!![]);}catch(_0x1b1dc6){return BPromise[_0x07de('0x22')](_0x1b1dc6);}return _0x25f820[_0x07de('0x23')]();};}function saveUpdates(_0x120915,_0x1ddaa2){return function(_0x2789cf){if(_0x2789cf){return _0x2789cf[_0x07de('0x24')](_0x120915)['then'](function(_0xa3e70){return _0xa3e70;});}return null;};}function removeEntity(_0x17c554,_0x5104ad){return function(_0x232255){if(_0x232255){return _0x232255[_0x07de('0x25')]()['then'](function(){_0x17c554[_0x07de('0x26')](0xcc)[_0x07de('0x27')]();});}};}function handleEntityNotFound(_0x263ba7,_0x3ed2c8){return function(_0x251e5f){if(!_0x251e5f){_0x263ba7[_0x07de('0x1b')](0x194);}return _0x251e5f;};}function handleError(_0x31a806,_0x1c3687){_0x1c3687=_0x1c3687||0x1f4;return function(_0x168c4f){logger['error'](_0x168c4f['stack']);if(_0x168c4f[_0x07de('0x28')]){delete _0x168c4f['name'];}_0x31a806[_0x07de('0x26')](_0x1c3687)[_0x07de('0x29')](_0x168c4f);};}exports[_0x07de('0x2a')]=function(_0x305a20,_0x337b7c){var _0x292035={'raw':!![],'where':{'id':_0x305a20[_0x07de('0x2b')]['id']}},_0x12f2fa={};_0x12f2fa[_0x07de('0x2c')]=_[_0x07de('0x2d')](db[_0x07de('0x2e')][_0x07de('0x2f')]);_0x12f2fa[_0x07de('0x30')]=_['keys'](_0x305a20['query']);_0x12f2fa['filters']=_[_0x07de('0x31')](_0x12f2fa[_0x07de('0x2c')],_0x12f2fa['query']);_0x292035[_0x07de('0x32')]=_[_0x07de('0x31')](_0x12f2fa[_0x07de('0x2c')],qs[_0x07de('0x33')](_0x305a20[_0x07de('0x30')][_0x07de('0x33')]));_0x292035[_0x07de('0x32')]=_0x292035[_0x07de('0x32')][_0x07de('0x34')]?_0x292035[_0x07de('0x32')]:_0x12f2fa[_0x07de('0x2c')];if(_0x305a20[_0x07de('0x30')][_0x07de('0x35')]){_0x292035[_0x07de('0x36')]=[{'all':!![]}];}_0x292035=_[_0x07de('0x37')]({},_0x292035,_0x305a20['options']);return db['ChatApplication'][_0x07de('0x38')](_0x292035)[_0x07de('0x39')](handleEntityNotFound(_0x337b7c,null))['then'](respondWithResult(_0x337b7c,null))[_0x07de('0x3a')](handleError(_0x337b7c,null));};exports[_0x07de('0x24')]=function(_0x41f55a,_0x50c238){if(_0x41f55a[_0x07de('0x3b')]['id']){delete _0x41f55a[_0x07de('0x3b')]['id'];}return db[_0x07de('0x2e')][_0x07de('0x38')]({'where':{'id':_0x41f55a[_0x07de('0x2b')]['id']}})['then'](handleEntityNotFound(_0x50c238,null))[_0x07de('0x39')](saveUpdates(_0x41f55a[_0x07de('0x3b')],null))[_0x07de('0x39')](respondWithResult(_0x50c238,null))[_0x07de('0x3a')](handleError(_0x50c238,null));};exports[_0x07de('0x25')]=function(_0x106f09,_0x11127d){return db[_0x07de('0x2e')][_0x07de('0x38')]({'where':{'id':_0x106f09[_0x07de('0x2b')]['id']}})[_0x07de('0x39')](handleEntityNotFound(_0x11127d,null))['then'](removeEntity(_0x11127d,null))['catch'](handleError(_0x11127d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 65da842..a9515d1 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 83f9792..6cf269b 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 _0x9197=['info','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x5913d7,_0x3df32d){var _0xa64bd1=function(_0x436d0c){while(--_0x436d0c){_0x5913d7['push'](_0x5913d7['shift']());}};_0xa64bd1(++_0x3df32d);}(_0x9197,0x1c2));var _0x7919=function(_0x564094,_0x566b75){_0x564094=_0x564094-0x0;var _0x2c196d=_0x9197[_0x564094];return _0x2c196d;};'use strict';var _=require(_0x7919('0x0'));var util=require(_0x7919('0x1'));var moment=require(_0x7919('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7919('0x3'));var db=require(_0x7919('0x4'))['db'];var utils=require(_0x7919('0x5'));var logger=require(_0x7919('0x6'))('rpc');var config=require(_0x7919('0x7'));var jayson=require(_0x7919('0x8'));var client=jayson[_0x7919('0x9')][_0x7919('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e06b1,_0x3a9aac,_0x40756f){return new BPromise(function(_0x456799,_0x1677bb){return client[_0x7919('0xb')](_0x4e06b1,_0x40756f)['then'](function(_0xe05fd3){logger[_0x7919('0xc')]('ChatApplication,\x20%s,\x20%s',_0x3a9aac,_0x7919('0xd'));logger['debug'](_0x7919('0xe'),_0x3a9aac,'request\x20sent',JSON[_0x7919('0xf')](_0xe05fd3));if(_0xe05fd3['error']){if(_0xe05fd3[_0x7919('0x10')][_0x7919('0x11')]===0x1f4){logger[_0x7919('0x10')](_0x7919('0x12'),_0x3a9aac,_0xe05fd3[_0x7919('0x10')][_0x7919('0x13')]);return _0x1677bb(_0xe05fd3[_0x7919('0x10')][_0x7919('0x13')]);}logger[_0x7919('0x10')]('ChatApplication,\x20%s,\x20%s',_0x3a9aac,_0xe05fd3[_0x7919('0x10')]['message']);return _0x456799(_0xe05fd3['error'][_0x7919('0x13')]);}else{logger[_0x7919('0xc')](_0x7919('0x12'),_0x3a9aac,_0x7919('0xd'));_0x456799(_0xe05fd3['result'][_0x7919('0x13')]);}})[_0x7919('0x14')](function(_0x34c695){logger[_0x7919('0x10')](_0x7919('0x12'),_0x3a9aac,_0x34c695);_0x1677bb(_0x34c695);});});} \ No newline at end of file +var _0x114d=['stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x114d,0x9f));var _0xd114=function(_0x5b2090,_0x3d1d18){_0x5b2090=_0x5b2090-0x0;var _0x50bfa5=_0x114d[_0x5b2090];return _0x50bfa5;};'use strict';var _=require(_0xd114('0x0'));var util=require(_0xd114('0x1'));var moment=require('moment');var BPromise=require(_0xd114('0x2'));var rs=require(_0xd114('0x3'));var fs=require('fs');var Redis=require(_0xd114('0x4'));var db=require(_0xd114('0x5'))['db'];var utils=require(_0xd114('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd114('0x7'));var jayson=require(_0xd114('0x8'));var client=jayson['client'][_0xd114('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4eac77,_0x138084,_0x14e962){return new BPromise(function(_0x1e847b,_0x47b912){return client[_0xd114('0xa')](_0x4eac77,_0x14e962)[_0xd114('0xb')](function(_0x5074ba){logger[_0xd114('0xc')](_0xd114('0xd'),_0x138084,_0xd114('0xe'));logger[_0xd114('0xf')](_0xd114('0x10'),_0x138084,_0xd114('0xe'),JSON[_0xd114('0x11')](_0x5074ba));if(_0x5074ba[_0xd114('0x12')]){if(_0x5074ba[_0xd114('0x12')][_0xd114('0x13')]===0x1f4){logger[_0xd114('0x12')](_0xd114('0xd'),_0x138084,_0x5074ba[_0xd114('0x12')]['message']);return _0x47b912(_0x5074ba[_0xd114('0x12')][_0xd114('0x14')]);}logger[_0xd114('0x12')](_0xd114('0xd'),_0x138084,_0x5074ba[_0xd114('0x12')][_0xd114('0x14')]);return _0x1e847b(_0x5074ba[_0xd114('0x12')]['message']);}else{logger[_0xd114('0xc')](_0xd114('0xd'),_0x138084,'request\x20sent');_0x1e847b(_0x5074ba['result']['message']);}})[_0xd114('0x15')](function(_0x53c836){logger[_0xd114('0x12')](_0xd114('0xd'),_0x138084,_0x53c836);_0x47b912(_0x53c836);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index c340a2b..7ecfe15 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 _0xb2fc=['multer','util','path','express','../../components/auth/service','../../config/environment','./chatApplication.controller','/:id','show','put','update','delete','isAuthenticated','destroy','exports'];(function(_0x75e624,_0x576b2a){var _0x4b986e=function(_0x302120){while(--_0x302120){_0x75e624['push'](_0x75e624['shift']());}};_0x4b986e(++_0x576b2a);}(_0xb2fc,0x14a));var _0xcb2f=function(_0x5bb5e6,_0xfeff09){_0x5bb5e6=_0x5bb5e6-0x0;var _0x703993=_0xb2fc[_0x5bb5e6];return _0x703993;};'use strict';var multer=require(_0xcb2f('0x0'));var util=require(_0xcb2f('0x1'));var path=require(_0xcb2f('0x2'));var timeout=require('connect-timeout');var express=require(_0xcb2f('0x3'));var router=express['Router']();var auth=require(_0xcb2f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcb2f('0x5'));var controller=require(_0xcb2f('0x6'));router['get'](_0xcb2f('0x7'),auth['isAuthenticated'](),controller[_0xcb2f('0x8')]);router[_0xcb2f('0x9')](_0xcb2f('0x7'),auth['isAuthenticated'](),controller[_0xcb2f('0xa')]);router[_0xcb2f('0xb')](_0xcb2f('0x7'),auth[_0xcb2f('0xc')](),controller[_0xcb2f('0xd')]);module[_0xcb2f('0xe')]=router; \ No newline at end of file +var _0x9fb8=['Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','/:id','isAuthenticated','show','update','delete','path','express'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9fb8,0x17f));var _0x89fb=function(_0x42e4d7,_0x4bd202){_0x42e4d7=_0x42e4d7-0x0;var _0x346cd8=_0x9fb8[_0x42e4d7];return _0x346cd8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x89fb('0x0'));var timeout=require('connect-timeout');var express=require(_0x89fb('0x1'));var router=express[_0x89fb('0x2')]();var auth=require(_0x89fb('0x3'));var interaction=require(_0x89fb('0x4'));var config=require('../../config/environment');var controller=require(_0x89fb('0x5'));router['get'](_0x89fb('0x6'),auth[_0x89fb('0x7')](),controller[_0x89fb('0x8')]);router['put'](_0x89fb('0x6'),auth[_0x89fb('0x7')](),controller[_0x89fb('0x9')]);router[_0x89fb('0xa')](_0x89fb('0x6'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index c306f4a..2666a4c 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 _0x9fcf=['BOOLEAN','exports','STRING'];(function(_0x35a5d9,_0x19253f){var _0x1c001d=function(_0x47dd5e){while(--_0x47dd5e){_0x35a5d9['push'](_0x35a5d9['shift']());}};_0x1c001d(++_0x19253f);}(_0x9fcf,0x11e));var _0xf9fc=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x9fcf[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0xf9fc('0x0')]={'name':{'type':Sequelize[_0xf9fc('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf9fc('0x1')]},'write':{'type':Sequelize[_0xf9fc('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xca99=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xca99,0x136));var _0x9ca9=function(_0x41cc67,_0x5db581){_0x41cc67=_0x41cc67-0x0;var _0x5222e2=_0xca99[_0x41cc67];return _0x5222e2;};'use strict';var Sequelize=require(_0x9ca9('0x0'));module[_0x9ca9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9ca9('0x2')]},'write':{'type':Sequelize[_0x9ca9('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 8eeae2b..f7bbef9 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 _0xf0f4=['then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','set','apply','reject','save','update','stack','name','send','index','map','ChatGroup','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','where','VIRTUAL','merge','options','count','include','findAll','params','includeAll','find','create','body','describe','getUnread','user','addMembers','ids','omit','findOne','User','length','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','rawAttributes','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','fast-json-patch','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0xf0f4,0x182));var _0x4f0f=function(_0x198072,_0x1fa6d9){_0x198072=_0x198072-0x0;var _0xcd47cd=_0xf0f4[_0x198072];return _0xcd47cd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4f0f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f0f('0x1'));var rp=require(_0x4f0f('0x2'));var moment=require('moment');var BPromise=require(_0x4f0f('0x3'));var Mustache=require(_0x4f0f('0x4'));var util=require(_0x4f0f('0x5'));var path=require(_0x4f0f('0x6'));var sox=require(_0x4f0f('0x7'));var csv=require(_0x4f0f('0x8'));var ejs=require(_0x4f0f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4f0f('0xa'));var crypto=require(_0x4f0f('0xb'));var jsforce=require(_0x4f0f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4f0f('0x8'));var querystring=require(_0x4f0f('0xd'));var Papa=require(_0x4f0f('0xe'));var Redis=require(_0x4f0f('0xf'));var authService=require(_0x4f0f('0x10'));var qs=require(_0x4f0f('0x11'));var as=require(_0x4f0f('0x12'));var hardwareService=require(_0x4f0f('0x13'));var logger=require('../../config/logger')(_0x4f0f('0x14'));var utils=require(_0x4f0f('0x15'));var config=require(_0x4f0f('0x16'));var licenseUtil=require(_0x4f0f('0x17'));var db=require(_0x4f0f('0x18'))['db'];config[_0x4f0f('0x19')]=_[_0x4f0f('0x1a')](config[_0x4f0f('0x19')],{'host':_0x4f0f('0x1b'),'port':0x18eb});var socket=require(_0x4f0f('0x1c'))(new Redis(config[_0x4f0f('0x19')]));require('./chatGroup.socket')[_0x4f0f('0x1d')](socket);var jayson=require(_0x4f0f('0x1e'));var client=jayson[_0x4f0f('0x1f')][_0x4f0f('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x51a713,_0xd9ad12,_0x46d7cf,_0x5783){return new BPromise(function(_0x1c0aa1,_0x4038fd){var _0x5f171b=_0x5783||client;return _0x5f171b[_0x4f0f('0x21')](_0x51a713,_0x46d7cf)[_0x4f0f('0x22')](function(_0x20423e){logger['info'](_0x4f0f('0x23'),_0xd9ad12,_0x4f0f('0x24'));logger[_0x4f0f('0x25')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0xd9ad12,_0x4f0f('0x24'),JSON[_0x4f0f('0x26')](_0x20423e));if(_0x20423e[_0x4f0f('0x27')]){if(_0x20423e[_0x4f0f('0x27')][_0x4f0f('0x28')]===0x1f4){logger[_0x4f0f('0x27')]('ChatGroup,\x20%s,\x20%s',_0xd9ad12,_0x20423e[_0x4f0f('0x27')]['message']);return _0x4038fd(_0x20423e[_0x4f0f('0x27')][_0x4f0f('0x29')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0xd9ad12,_0x20423e[_0x4f0f('0x27')]['message']);return _0x1c0aa1(_0x20423e[_0x4f0f('0x27')][_0x4f0f('0x29')]);}else{logger[_0x4f0f('0x2a')](_0x4f0f('0x23'),_0xd9ad12,_0x4f0f('0x24'));_0x1c0aa1(_0x20423e[_0x4f0f('0x2b')]['message']);}})[_0x4f0f('0x2c')](function(_0xcdcd05){logger[_0x4f0f('0x27')](_0x4f0f('0x23'),_0xd9ad12,_0xcdcd05);_0x4038fd(_0xcdcd05);});});}function respondWithStatusCode(_0xe969c7,_0x3e6b72){_0x3e6b72=_0x3e6b72||0xcc;return function(_0x166ea6){if(_0x166ea6){return _0xe969c7[_0x4f0f('0x2d')](_0x3e6b72);}return _0xe969c7[_0x4f0f('0x2e')](_0x3e6b72)[_0x4f0f('0x2f')]();};}function respondWithResult(_0x37ae8f,_0x394303){_0x394303=_0x394303||0xc8;return function(_0x381329){if(_0x381329){return _0x37ae8f['status'](_0x394303)[_0x4f0f('0x30')](_0x381329);}};}function respondWithFilteredResult(_0x269563,_0x2ebabc){return function(_0x58ec43){if(_0x58ec43){var _0xa8a240=_0x58ec43['count'],_0x4e5f0d=_0x2ebabc['offset'],_0x449788=_0x2ebabc[_0x4f0f('0x31')]+_0x2ebabc['limit'],_0x1f4e1d;if(_0x449788>=_0xa8a240){_0x449788=_0xa8a240;_0x1f4e1d=0xc8;}else{_0x1f4e1d=0xce;}_0x269563[_0x4f0f('0x2e')](_0x1f4e1d);return _0x269563[_0x4f0f('0x32')]('Content-Range',_0x4e5f0d+'-'+_0x449788+'/'+_0xa8a240)[_0x4f0f('0x30')](_0x58ec43);}return null;};}function patchUpdates(_0xf7acac){return function(_0x8b2dad){try{jsonpatch[_0x4f0f('0x33')](_0x8b2dad,_0xf7acac,!![]);}catch(_0x4db575){return BPromise[_0x4f0f('0x34')](_0x4db575);}return _0x8b2dad[_0x4f0f('0x35')]();};}function saveUpdates(_0x3c4462,_0x1ce86e){return function(_0x5ea512){if(_0x5ea512){return _0x5ea512[_0x4f0f('0x36')](_0x3c4462)[_0x4f0f('0x22')](function(_0x1c85cb){return _0x1c85cb;});}return null;};}function removeEntity(_0x59a400,_0x3724fc){return function(_0x797230){if(_0x797230){return _0x797230['destroy']()[_0x4f0f('0x22')](function(){_0x59a400[_0x4f0f('0x2e')](0xcc)[_0x4f0f('0x2f')]();});}};}function handleEntityNotFound(_0x341c6c,_0x57e133){return function(_0x2231cb){if(!_0x2231cb){_0x341c6c[_0x4f0f('0x2d')](0x194);}return _0x2231cb;};}function handleError(_0x35611d,_0xa790fa){_0xa790fa=_0xa790fa||0x1f4;return function(_0x3e582a){logger[_0x4f0f('0x27')](_0x3e582a[_0x4f0f('0x37')]);if(_0x3e582a[_0x4f0f('0x38')]){delete _0x3e582a['name'];}_0x35611d[_0x4f0f('0x2e')](_0xa790fa)[_0x4f0f('0x39')](_0x3e582a);};}exports[_0x4f0f('0x3a')]=function(_0x3d2f46,_0x122d51){var _0x3e2cb6={},_0x1849ca={},_0x5db25a={'count':0x0,'rows':[]};var _0x59b7b2=_[_0x4f0f('0x3b')](db[_0x4f0f('0x3c')]['rawAttributes'],function(_0x171e41){return{'name':_0x171e41['fieldName'],'type':_0x171e41[_0x4f0f('0x3d')]['key']};});_0x1849ca[_0x4f0f('0x3e')]=_[_0x4f0f('0x3b')](_0x59b7b2,'name');_0x1849ca[_0x4f0f('0x3f')]=_[_0x4f0f('0x40')](_0x3d2f46[_0x4f0f('0x3f')]);_0x1849ca['filters']=_[_0x4f0f('0x41')](_0x1849ca[_0x4f0f('0x3e')],_0x1849ca[_0x4f0f('0x3f')]);_0x3e2cb6[_0x4f0f('0x42')]=_[_0x4f0f('0x41')](_0x1849ca[_0x4f0f('0x3e')],qs[_0x4f0f('0x43')](_0x3d2f46[_0x4f0f('0x3f')][_0x4f0f('0x43')]));_0x3e2cb6[_0x4f0f('0x42')]=_0x3e2cb6[_0x4f0f('0x42')]['length']?_0x3e2cb6[_0x4f0f('0x42')]:_0x1849ca[_0x4f0f('0x3e')];if(!_0x3d2f46[_0x4f0f('0x3f')][_0x4f0f('0x44')](_0x4f0f('0x45'))){_0x3e2cb6[_0x4f0f('0x46')]=qs[_0x4f0f('0x46')](_0x3d2f46['query'][_0x4f0f('0x46')]);_0x3e2cb6[_0x4f0f('0x31')]=qs[_0x4f0f('0x31')](_0x3d2f46[_0x4f0f('0x3f')][_0x4f0f('0x31')]);}_0x3e2cb6[_0x4f0f('0x47')]=qs['sort'](_0x3d2f46[_0x4f0f('0x3f')][_0x4f0f('0x48')]);_0x3e2cb6['where']=qs['filters'](_[_0x4f0f('0x49')](_0x3d2f46[_0x4f0f('0x3f')],_0x1849ca[_0x4f0f('0x4a')]),_0x59b7b2);if(_0x3d2f46['query'][_0x4f0f('0x4b')]){_0x3e2cb6['where']=_['merge'](_0x3e2cb6[_0x4f0f('0x4c')],{'$or':_[_0x4f0f('0x3b')](_0x59b7b2,function(_0x257d3e){if(_0x257d3e[_0x4f0f('0x3d')]!==_0x4f0f('0x4d')){var _0x159c29={};_0x159c29[_0x257d3e['name']]={'$like':'%'+_0x3d2f46['query'][_0x4f0f('0x4b')]+'%'};return _0x159c29;}})});}_0x3e2cb6=_[_0x4f0f('0x4e')]({},_0x3e2cb6,_0x3d2f46[_0x4f0f('0x4f')]);var _0x541dd0={'where':_0x3e2cb6[_0x4f0f('0x4c')]};return db[_0x4f0f('0x3c')][_0x4f0f('0x50')](_0x541dd0)['then'](function(_0x3a10f7){_0x5db25a['count']=_0x3a10f7;if(_0x3d2f46[_0x4f0f('0x3f')]['includeAll']){_0x3e2cb6[_0x4f0f('0x51')]=[{'all':!![]}];}return db[_0x4f0f('0x3c')][_0x4f0f('0x52')](_0x3e2cb6);})[_0x4f0f('0x22')](function(_0x56c354){_0x5db25a['rows']=_0x56c354;return _0x5db25a;})['then'](respondWithFilteredResult(_0x122d51,_0x3e2cb6))[_0x4f0f('0x2c')](handleError(_0x122d51,null));};exports['show']=function(_0x12e587,_0x32d298){var _0x18f968={'raw':!![],'where':{'id':_0x12e587[_0x4f0f('0x53')]['id']}},_0x204a1b={};_0x204a1b[_0x4f0f('0x3e')]=_[_0x4f0f('0x40')](db[_0x4f0f('0x3c')]['rawAttributes']);_0x204a1b[_0x4f0f('0x3f')]=_[_0x4f0f('0x40')](_0x12e587[_0x4f0f('0x3f')]);_0x204a1b[_0x4f0f('0x4a')]=_[_0x4f0f('0x41')](_0x204a1b[_0x4f0f('0x3e')],_0x204a1b[_0x4f0f('0x3f')]);_0x18f968[_0x4f0f('0x42')]=_[_0x4f0f('0x41')](_0x204a1b[_0x4f0f('0x3e')],qs['fields'](_0x12e587[_0x4f0f('0x3f')]['fields']));_0x18f968[_0x4f0f('0x42')]=_0x18f968[_0x4f0f('0x42')]['length']?_0x18f968[_0x4f0f('0x42')]:_0x204a1b[_0x4f0f('0x3e')];if(_0x12e587[_0x4f0f('0x3f')][_0x4f0f('0x54')]){_0x18f968[_0x4f0f('0x51')]=[{'all':!![]}];}_0x18f968=_[_0x4f0f('0x4e')]({},_0x18f968,_0x12e587[_0x4f0f('0x4f')]);return db[_0x4f0f('0x3c')][_0x4f0f('0x55')](_0x18f968)['then'](handleEntityNotFound(_0x32d298,null))[_0x4f0f('0x22')](respondWithResult(_0x32d298,null))[_0x4f0f('0x2c')](handleError(_0x32d298,null));};exports[_0x4f0f('0x56')]=function(_0x404000,_0xb12986){return db[_0x4f0f('0x3c')][_0x4f0f('0x56')](_0x404000['body'],{})['then'](respondWithResult(_0xb12986,0xc9))[_0x4f0f('0x2c')](handleError(_0xb12986,null));};exports[_0x4f0f('0x36')]=function(_0x374cd3,_0x2c99d9){if(_0x374cd3[_0x4f0f('0x57')]['id']){delete _0x374cd3[_0x4f0f('0x57')]['id'];}return db[_0x4f0f('0x3c')][_0x4f0f('0x55')]({'where':{'id':_0x374cd3[_0x4f0f('0x53')]['id']}})[_0x4f0f('0x22')](handleEntityNotFound(_0x2c99d9,null))[_0x4f0f('0x22')](saveUpdates(_0x374cd3[_0x4f0f('0x57')],null))['then'](respondWithResult(_0x2c99d9,null))[_0x4f0f('0x2c')](handleError(_0x2c99d9,null));};exports['destroy']=function(_0x2dd87f,_0xb472c2){return db['ChatGroup']['find']({'where':{'id':_0x2dd87f['params']['id']}})[_0x4f0f('0x22')](handleEntityNotFound(_0xb472c2,null))[_0x4f0f('0x22')](removeEntity(_0xb472c2,null))[_0x4f0f('0x2c')](handleError(_0xb472c2,null));};exports['describe']=function(_0x5df4e0,_0x4b58ff){return db[_0x4f0f('0x3c')][_0x4f0f('0x58')]()[_0x4f0f('0x22')](respondWithResult(_0x4b58ff,null))[_0x4f0f('0x2c')](handleError(_0x4b58ff,null));};exports[_0x4f0f('0x59')]=function(_0x143e84,_0x25ec74,_0x4952b0){return db['ChatInternalMessage'][_0x4f0f('0x50')]({'where':{'ChatGroupId':_0x143e84[_0x4f0f('0x53')]['id'],'ToId':_0x143e84[_0x4f0f('0x5a')]['id'],'read':![]}})['then'](function(_0x41f8a9){return{'id':_['toInteger'](_0x143e84[_0x4f0f('0x53')]['id']),'count':_0x41f8a9};})['then'](respondWithResult(_0x25ec74,null))[_0x4f0f('0x2c')](handleError(_0x25ec74,null));};exports['addMembers']=function(_0x24d60a,_0x2ddac3,_0x4446e0){return db[_0x4f0f('0x3c')][_0x4f0f('0x55')]({'where':{'id':_0x24d60a[_0x4f0f('0x53')]['id']}})[_0x4f0f('0x22')](handleEntityNotFound(_0x2ddac3,null))[_0x4f0f('0x22')](function(_0x5becd9){if(_0x5becd9){return _0x5becd9[_0x4f0f('0x5b')](_0x24d60a[_0x4f0f('0x57')][_0x4f0f('0x5c')],_[_0x4f0f('0x5d')](_0x24d60a['body'],[_0x4f0f('0x5c'),'id'])||{});}})[_0x4f0f('0x22')](respondWithResult(_0x2ddac3,null))['catch'](handleError(_0x2ddac3,null));};exports['getMembers']=function(_0x29532b,_0x32e9a7,_0x264550){var _0x1e5050={};var _0x1b67c9={};var _0x54367e;var _0x1ad24a;return db[_0x4f0f('0x3c')][_0x4f0f('0x5e')]({'where':{'id':_0x29532b['params']['id']}})[_0x4f0f('0x22')](handleEntityNotFound(_0x32e9a7,null))[_0x4f0f('0x22')](function(_0x329283){if(_0x329283){_0x54367e=_0x329283;_0x1b67c9['model']=_[_0x4f0f('0x40')](db[_0x4f0f('0x5f')]['rawAttributes']);_0x1b67c9[_0x4f0f('0x3f')]=_[_0x4f0f('0x40')](_0x29532b[_0x4f0f('0x3f')]);_0x1b67c9[_0x4f0f('0x4a')]=_[_0x4f0f('0x41')](_0x1b67c9[_0x4f0f('0x3e')],_0x1b67c9['query']);_0x1e5050['attributes']=_['intersection'](_0x1b67c9['model'],qs['fields'](_0x29532b[_0x4f0f('0x3f')][_0x4f0f('0x43')]));_0x1e5050[_0x4f0f('0x42')]=_0x1e5050[_0x4f0f('0x42')][_0x4f0f('0x60')]?_0x1e5050[_0x4f0f('0x42')]:_0x1b67c9[_0x4f0f('0x3e')];_0x1e5050[_0x4f0f('0x47')]=qs[_0x4f0f('0x48')](_0x29532b[_0x4f0f('0x3f')][_0x4f0f('0x48')]);_0x1e5050[_0x4f0f('0x4c')]=qs[_0x4f0f('0x4a')](_[_0x4f0f('0x49')](_0x29532b[_0x4f0f('0x3f')],_0x1b67c9['filters']));if(_0x29532b[_0x4f0f('0x3f')][_0x4f0f('0x4b')]){_0x1e5050[_0x4f0f('0x4c')]=_[_0x4f0f('0x4e')](_0x1e5050[_0x4f0f('0x4c')],{'$or':_[_0x4f0f('0x3b')](_0x1e5050['attributes'],function(_0x21ff97){var _0x52211c={};_0x52211c[_0x21ff97]={'$like':'%'+_0x29532b[_0x4f0f('0x3f')]['filter']+'%'};return _0x52211c;})});}_0x1e5050=_[_0x4f0f('0x4e')]({},_0x1e5050,_0x29532b[_0x4f0f('0x4f')]);return _0x54367e[_0x4f0f('0x61')](_0x1e5050);}})['then'](function(_0xe37fb){if(_0xe37fb){_0x1ad24a=_0xe37fb[_0x4f0f('0x60')];if(!_0x29532b[_0x4f0f('0x3f')][_0x4f0f('0x44')](_0x4f0f('0x45'))){_0x1e5050['limit']=qs[_0x4f0f('0x46')](_0x29532b[_0x4f0f('0x3f')][_0x4f0f('0x46')]);_0x1e5050[_0x4f0f('0x31')]=qs[_0x4f0f('0x31')](_0x29532b[_0x4f0f('0x3f')][_0x4f0f('0x31')]);}return _0x54367e[_0x4f0f('0x61')](_0x1e5050);}})['then'](function(_0xca74cc){if(_0xca74cc){return _0xca74cc?{'count':_0x1ad24a,'rows':_0xca74cc}:null;}})[_0x4f0f('0x22')](respondWithResult(_0x32e9a7,null))['catch'](handleError(_0x32e9a7,null));};exports[_0x4f0f('0x62')]=function(_0x33bc1e,_0x198096,_0x4da9d6){return db[_0x4f0f('0x3c')]['find']({'where':{'id':_0x33bc1e[_0x4f0f('0x53')]['id']}})[_0x4f0f('0x22')](handleEntityNotFound(_0x198096,null))['then'](function(_0x1ca539){if(_0x1ca539){return _0x1ca539[_0x4f0f('0x62')](_0x33bc1e[_0x4f0f('0x3f')]['ids']);}})[_0x4f0f('0x22')](respondWithStatusCode(_0x198096,null))[_0x4f0f('0x2c')](handleError(_0x198096,null));};exports[_0x4f0f('0x63')]=function(_0x4a3efb,_0x1928df,_0x46bfb5){if(_0x4a3efb['body']['id']){delete _0x4a3efb['body']['id'];}return db[_0x4f0f('0x3c')][_0x4f0f('0x55')]({'where':{'id':_0x4a3efb['params']['id']}})[_0x4f0f('0x22')](handleEntityNotFound(_0x1928df,null))[_0x4f0f('0x22')](function(_0x229592){if(_0x229592){_0x4a3efb[_0x4f0f('0x57')][_0x4f0f('0x64')]=_0x229592['id'];return db['ChatInternalMessage']['create'](_0x4a3efb[_0x4f0f('0x57')]);}})['then'](respondWithResult(_0x1928df,null))[_0x4f0f('0x2c')](handleError(_0x1928df,null));};exports[_0x4f0f('0x65')]=function(_0x4331bb,_0x5d2077,_0x5aeb66){var _0x3bdd58={};var _0x3ddf77={};var _0x586029;var _0x126c15;return db[_0x4f0f('0x3c')][_0x4f0f('0x5e')]({'where':{'id':_0x4331bb[_0x4f0f('0x53')]['id']}})['then'](handleEntityNotFound(_0x5d2077,null))['then'](function(_0x3c209a){if(_0x3c209a){_0x586029=_0x3c209a;_0x3ddf77[_0x4f0f('0x3e')]=_[_0x4f0f('0x40')](db['ChatInternalMessage'][_0x4f0f('0x66')]);_0x3ddf77['query']=_['keys'](_0x4331bb[_0x4f0f('0x3f')]);_0x3ddf77[_0x4f0f('0x4a')]=_[_0x4f0f('0x41')](_0x3ddf77[_0x4f0f('0x3e')],_0x3ddf77['query']);_0x3bdd58[_0x4f0f('0x42')]=_[_0x4f0f('0x41')](_0x3ddf77['model'],qs['fields'](_0x4331bb['query'][_0x4f0f('0x43')]));_0x3bdd58[_0x4f0f('0x42')]=_0x3bdd58['attributes'][_0x4f0f('0x60')]?_0x3bdd58[_0x4f0f('0x42')]:_0x3ddf77['model'];_0x3bdd58[_0x4f0f('0x47')]=qs[_0x4f0f('0x48')](_0x4331bb[_0x4f0f('0x3f')]['sort']);_0x3bdd58[_0x4f0f('0x4c')]=qs[_0x4f0f('0x4a')](_[_0x4f0f('0x49')](_0x4331bb[_0x4f0f('0x3f')],_0x3ddf77[_0x4f0f('0x4a')]));if(_0x4331bb[_0x4f0f('0x3f')][_0x4f0f('0x4b')]){_0x3bdd58['where']=_[_0x4f0f('0x4e')](_0x3bdd58['where'],{'$or':_['map'](_0x3bdd58['attributes'],function(_0x5d8361){var _0x16b51c={};_0x16b51c[_0x5d8361]={'$like':'%'+_0x4331bb[_0x4f0f('0x3f')][_0x4f0f('0x4b')]+'%'};return _0x16b51c;})});}if(_0x4331bb[_0x4f0f('0x3f')]['$gte']){var _0xdc77cf=_0x4331bb[_0x4f0f('0x3f')]['$gte']['split'](',');var _0x251cf0={};_0x251cf0[_0xdc77cf[0x0]]={'$gte':moment(_0xdc77cf[0x1])[_0x4f0f('0x67')](_0x4f0f('0x68'))};_0x3bdd58[_0x4f0f('0x4c')]=_[_0x4f0f('0x4e')](_0x3bdd58['where'],_0x251cf0);}_0x3bdd58=_[_0x4f0f('0x4e')]({},_0x3bdd58,_0x4331bb['options']);return _0x586029[_0x4f0f('0x65')](_0x3bdd58);}})[_0x4f0f('0x22')](function(_0x109e1b){if(_0x109e1b){_0x126c15=_0x109e1b['length'];if(!_0x4331bb[_0x4f0f('0x3f')][_0x4f0f('0x44')](_0x4f0f('0x45'))){_0x3bdd58[_0x4f0f('0x46')]=qs[_0x4f0f('0x46')](_0x4331bb[_0x4f0f('0x3f')][_0x4f0f('0x46')]);_0x3bdd58[_0x4f0f('0x31')]=qs[_0x4f0f('0x31')](_0x4331bb[_0x4f0f('0x3f')][_0x4f0f('0x31')]);}return _0x586029[_0x4f0f('0x65')](_0x3bdd58);}})['then'](function(_0x4501d8){if(_0x4501d8){return _0x4501d8?{'count':_0x126c15,'rows':_0x4501d8}:null;}})[_0x4f0f('0x22')](respondWithResult(_0x5d2077,null))['catch'](handleError(_0x5d2077,null));}; \ No newline at end of file +var _0xfd2e=['format','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto','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','redis','localhost','./chatGroup.socket','register','jayson/promise','client','http','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','show','options','find','create','body','params','describe','user','toInteger','addMembers','ids','omit','findOne','order','getMembers','hasOwnProperty','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','$gte'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0xfd2e,0x6e));var _0xefd2=function(_0x517344,_0x302170){_0x517344=_0x517344-0x0;var _0x5269c7=_0xfd2e[_0x517344];return _0x5269c7;};'use strict';var pdf=require(_0xefd2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xefd2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xefd2('0x2'));var rp=require('request-promise');var moment=require(_0xefd2('0x3'));var BPromise=require(_0xefd2('0x4'));var Mustache=require(_0xefd2('0x5'));var util=require(_0xefd2('0x6'));var path=require(_0xefd2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xefd2('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xefd2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xefd2('0xa'));var toCsv=require(_0xefd2('0xb'));var querystring=require(_0xefd2('0xc'));var Papa=require(_0xefd2('0xd'));var Redis=require(_0xefd2('0xe'));var authService=require(_0xefd2('0xf'));var qs=require(_0xefd2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefd2('0x11'));var logger=require(_0xefd2('0x12'))(_0xefd2('0x13'));var utils=require(_0xefd2('0x14'));var config=require(_0xefd2('0x15'));var licenseUtil=require(_0xefd2('0x16'));var db=require(_0xefd2('0x17'))['db'];config[_0xefd2('0x18')]=_['defaults'](config['redis'],{'host':_0xefd2('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xefd2('0x1a'))[_0xefd2('0x1b')](socket);var jayson=require(_0xefd2('0x1c'));var client=jayson[_0xefd2('0x1d')][_0xefd2('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x518354,_0x1a35b7,_0x20192b,_0x2e706a){return new BPromise(function(_0x1823f0,_0x293c78){var _0x471e3b=_0x2e706a||client;return _0x471e3b['request'](_0x518354,_0x20192b)['then'](function(_0xd75a31){logger[_0xefd2('0x1f')](_0xefd2('0x20'),_0x1a35b7,_0xefd2('0x21'));logger[_0xefd2('0x22')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1a35b7,_0xefd2('0x21'),JSON[_0xefd2('0x23')](_0xd75a31));if(_0xd75a31[_0xefd2('0x24')]){if(_0xd75a31[_0xefd2('0x24')]['code']===0x1f4){logger[_0xefd2('0x24')](_0xefd2('0x20'),_0x1a35b7,_0xd75a31[_0xefd2('0x24')][_0xefd2('0x25')]);return _0x293c78(_0xd75a31['error'][_0xefd2('0x25')]);}logger[_0xefd2('0x24')](_0xefd2('0x20'),_0x1a35b7,_0xd75a31[_0xefd2('0x24')][_0xefd2('0x25')]);return _0x1823f0(_0xd75a31[_0xefd2('0x24')][_0xefd2('0x25')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x1a35b7,_0xefd2('0x21'));_0x1823f0(_0xd75a31[_0xefd2('0x26')][_0xefd2('0x25')]);}})[_0xefd2('0x27')](function(_0x1d294c){logger[_0xefd2('0x24')](_0xefd2('0x20'),_0x1a35b7,_0x1d294c);_0x293c78(_0x1d294c);});});}function respondWithStatusCode(_0x35ea40,_0x159a53){_0x159a53=_0x159a53||0xcc;return function(_0x519d9){if(_0x519d9){return _0x35ea40[_0xefd2('0x28')](_0x159a53);}return _0x35ea40['status'](_0x159a53)[_0xefd2('0x29')]();};}function respondWithResult(_0x37feb6,_0x127e4f){_0x127e4f=_0x127e4f||0xc8;return function(_0x398ce2){if(_0x398ce2){return _0x37feb6[_0xefd2('0x2a')](_0x127e4f)[_0xefd2('0x2b')](_0x398ce2);}};}function respondWithFilteredResult(_0x14f0fe,_0x5955a4){return function(_0x386ee1){if(_0x386ee1){var _0x12a0f5=_0x386ee1['count'],_0x25f25a=_0x5955a4[_0xefd2('0x2c')],_0x46e68d=_0x5955a4[_0xefd2('0x2c')]+_0x5955a4['limit'],_0x168a43;if(_0x46e68d>=_0x12a0f5){_0x46e68d=_0x12a0f5;_0x168a43=0xc8;}else{_0x168a43=0xce;}_0x14f0fe[_0xefd2('0x2a')](_0x168a43);return _0x14f0fe[_0xefd2('0x2d')](_0xefd2('0x2e'),_0x25f25a+'-'+_0x46e68d+'/'+_0x12a0f5)[_0xefd2('0x2b')](_0x386ee1);}return null;};}function patchUpdates(_0x15d7b7){return function(_0x180359){try{jsonpatch[_0xefd2('0x2f')](_0x180359,_0x15d7b7,!![]);}catch(_0x1202a2){return BPromise[_0xefd2('0x30')](_0x1202a2);}return _0x180359[_0xefd2('0x31')]();};}function saveUpdates(_0x2ba82c,_0x5a90d7){return function(_0x25644c){if(_0x25644c){return _0x25644c[_0xefd2('0x32')](_0x2ba82c)[_0xefd2('0x33')](function(_0x25d94d){return _0x25d94d;});}return null;};}function removeEntity(_0x2ffbf3,_0x37ff34){return function(_0x2712cc){if(_0x2712cc){return _0x2712cc[_0xefd2('0x34')]()[_0xefd2('0x33')](function(){_0x2ffbf3[_0xefd2('0x2a')](0xcc)[_0xefd2('0x29')]();});}};}function handleEntityNotFound(_0x59edc7,_0x20b1dd){return function(_0x1df05c){if(!_0x1df05c){_0x59edc7['sendStatus'](0x194);}return _0x1df05c;};}function handleError(_0x38ed70,_0xd54536){_0xd54536=_0xd54536||0x1f4;return function(_0x4aab97){logger['error'](_0x4aab97[_0xefd2('0x35')]);if(_0x4aab97['name']){delete _0x4aab97[_0xefd2('0x36')];}_0x38ed70[_0xefd2('0x2a')](_0xd54536)[_0xefd2('0x37')](_0x4aab97);};}exports[_0xefd2('0x38')]=function(_0x19ea27,_0x59759d){var _0x12e6b7={},_0x9f118d={},_0x9f9b4b={'count':0x0,'rows':[]};var _0x100def=_[_0xefd2('0x39')](db[_0xefd2('0x3a')][_0xefd2('0x3b')],function(_0x284594){return{'name':_0x284594[_0xefd2('0x3c')],'type':_0x284594[_0xefd2('0x3d')][_0xefd2('0x3e')]};});_0x9f118d[_0xefd2('0x3f')]=_[_0xefd2('0x39')](_0x100def,_0xefd2('0x36'));_0x9f118d[_0xefd2('0x40')]=_[_0xefd2('0x41')](_0x19ea27[_0xefd2('0x40')]);_0x9f118d[_0xefd2('0x42')]=_[_0xefd2('0x43')](_0x9f118d[_0xefd2('0x3f')],_0x9f118d[_0xefd2('0x40')]);_0x12e6b7['attributes']=_[_0xefd2('0x43')](_0x9f118d['model'],qs[_0xefd2('0x44')](_0x19ea27['query']['fields']));_0x12e6b7[_0xefd2('0x45')]=_0x12e6b7[_0xefd2('0x45')][_0xefd2('0x46')]?_0x12e6b7[_0xefd2('0x45')]:_0x9f118d[_0xefd2('0x3f')];if(!_0x19ea27['query']['hasOwnProperty'](_0xefd2('0x47'))){_0x12e6b7['limit']=qs[_0xefd2('0x48')](_0x19ea27[_0xefd2('0x40')]['limit']);_0x12e6b7[_0xefd2('0x2c')]=qs[_0xefd2('0x2c')](_0x19ea27[_0xefd2('0x40')][_0xefd2('0x2c')]);}_0x12e6b7['order']=qs[_0xefd2('0x49')](_0x19ea27[_0xefd2('0x40')]['sort']);_0x12e6b7[_0xefd2('0x4a')]=qs['filters'](_[_0xefd2('0x4b')](_0x19ea27['query'],_0x9f118d['filters']),_0x100def);if(_0x19ea27[_0xefd2('0x40')][_0xefd2('0x4c')]){_0x12e6b7['where']=_[_0xefd2('0x4d')](_0x12e6b7['where'],{'$or':_[_0xefd2('0x39')](_0x100def,function(_0x4d7968){if(_0x4d7968[_0xefd2('0x3d')]!==_0xefd2('0x4e')){var _0x4bcaa6={};_0x4bcaa6[_0x4d7968['name']]={'$like':'%'+_0x19ea27[_0xefd2('0x40')][_0xefd2('0x4c')]+'%'};return _0x4bcaa6;}})});}_0x12e6b7=_['merge']({},_0x12e6b7,_0x19ea27['options']);var _0x269f58={'where':_0x12e6b7[_0xefd2('0x4a')]};return db['ChatGroup'][_0xefd2('0x4f')](_0x269f58)[_0xefd2('0x33')](function(_0x18c4ed){_0x9f9b4b[_0xefd2('0x4f')]=_0x18c4ed;if(_0x19ea27['query'][_0xefd2('0x50')]){_0x12e6b7[_0xefd2('0x51')]=[{'all':!![]}];}return db[_0xefd2('0x3a')]['findAll'](_0x12e6b7);})[_0xefd2('0x33')](function(_0x4c268f){_0x9f9b4b[_0xefd2('0x52')]=_0x4c268f;return _0x9f9b4b;})['then'](respondWithFilteredResult(_0x59759d,_0x12e6b7))[_0xefd2('0x27')](handleError(_0x59759d,null));};exports[_0xefd2('0x53')]=function(_0x501288,_0x2a4f7b){var _0x2d82eb={'raw':!![],'where':{'id':_0x501288['params']['id']}},_0xada2a0={};_0xada2a0['model']=_[_0xefd2('0x41')](db['ChatGroup'][_0xefd2('0x3b')]);_0xada2a0[_0xefd2('0x40')]=_[_0xefd2('0x41')](_0x501288['query']);_0xada2a0['filters']=_['intersection'](_0xada2a0[_0xefd2('0x3f')],_0xada2a0[_0xefd2('0x40')]);_0x2d82eb[_0xefd2('0x45')]=_[_0xefd2('0x43')](_0xada2a0[_0xefd2('0x3f')],qs['fields'](_0x501288[_0xefd2('0x40')][_0xefd2('0x44')]));_0x2d82eb[_0xefd2('0x45')]=_0x2d82eb[_0xefd2('0x45')][_0xefd2('0x46')]?_0x2d82eb[_0xefd2('0x45')]:_0xada2a0[_0xefd2('0x3f')];if(_0x501288[_0xefd2('0x40')][_0xefd2('0x50')]){_0x2d82eb[_0xefd2('0x51')]=[{'all':!![]}];}_0x2d82eb=_[_0xefd2('0x4d')]({},_0x2d82eb,_0x501288[_0xefd2('0x54')]);return db[_0xefd2('0x3a')][_0xefd2('0x55')](_0x2d82eb)[_0xefd2('0x33')](handleEntityNotFound(_0x2a4f7b,null))[_0xefd2('0x33')](respondWithResult(_0x2a4f7b,null))[_0xefd2('0x27')](handleError(_0x2a4f7b,null));};exports[_0xefd2('0x56')]=function(_0x4519f3,_0x522840){return db[_0xefd2('0x3a')][_0xefd2('0x56')](_0x4519f3[_0xefd2('0x57')],{})[_0xefd2('0x33')](respondWithResult(_0x522840,0xc9))['catch'](handleError(_0x522840,null));};exports[_0xefd2('0x32')]=function(_0x3a7211,_0x1037c4){if(_0x3a7211[_0xefd2('0x57')]['id']){delete _0x3a7211[_0xefd2('0x57')]['id'];}return db[_0xefd2('0x3a')][_0xefd2('0x55')]({'where':{'id':_0x3a7211[_0xefd2('0x58')]['id']}})[_0xefd2('0x33')](handleEntityNotFound(_0x1037c4,null))[_0xefd2('0x33')](saveUpdates(_0x3a7211[_0xefd2('0x57')],null))['then'](respondWithResult(_0x1037c4,null))[_0xefd2('0x27')](handleError(_0x1037c4,null));};exports[_0xefd2('0x34')]=function(_0x111c38,_0x13fa0e){return db[_0xefd2('0x3a')][_0xefd2('0x55')]({'where':{'id':_0x111c38[_0xefd2('0x58')]['id']}})[_0xefd2('0x33')](handleEntityNotFound(_0x13fa0e,null))[_0xefd2('0x33')](removeEntity(_0x13fa0e,null))[_0xefd2('0x27')](handleError(_0x13fa0e,null));};exports[_0xefd2('0x59')]=function(_0x8759fb,_0x42abff){return db[_0xefd2('0x3a')]['describe']()[_0xefd2('0x33')](respondWithResult(_0x42abff,null))[_0xefd2('0x27')](handleError(_0x42abff,null));};exports['getUnread']=function(_0x43c786,_0x2ccbc2,_0x2aebd8){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x43c786[_0xefd2('0x58')]['id'],'ToId':_0x43c786[_0xefd2('0x5a')]['id'],'read':![]}})['then'](function(_0x3f9477){return{'id':_[_0xefd2('0x5b')](_0x43c786[_0xefd2('0x58')]['id']),'count':_0x3f9477};})['then'](respondWithResult(_0x2ccbc2,null))['catch'](handleError(_0x2ccbc2,null));};exports[_0xefd2('0x5c')]=function(_0x61ed2a,_0x559c64,_0x414746){return db[_0xefd2('0x3a')][_0xefd2('0x55')]({'where':{'id':_0x61ed2a[_0xefd2('0x58')]['id']}})['then'](handleEntityNotFound(_0x559c64,null))[_0xefd2('0x33')](function(_0x4c659a){if(_0x4c659a){return _0x4c659a['addMembers'](_0x61ed2a['body'][_0xefd2('0x5d')],_[_0xefd2('0x5e')](_0x61ed2a[_0xefd2('0x57')],['ids','id'])||{});}})['then'](respondWithResult(_0x559c64,null))['catch'](handleError(_0x559c64,null));};exports['getMembers']=function(_0x24824d,_0x42d9b8,_0x2a7606){var _0x1eaf9f={};var _0x298040={};var _0x2ef297;var _0x5e1e31;return db[_0xefd2('0x3a')][_0xefd2('0x5f')]({'where':{'id':_0x24824d['params']['id']}})[_0xefd2('0x33')](handleEntityNotFound(_0x42d9b8,null))['then'](function(_0x22f531){if(_0x22f531){_0x2ef297=_0x22f531;_0x298040[_0xefd2('0x3f')]=_[_0xefd2('0x41')](db['User']['rawAttributes']);_0x298040['query']=_['keys'](_0x24824d[_0xefd2('0x40')]);_0x298040[_0xefd2('0x42')]=_[_0xefd2('0x43')](_0x298040[_0xefd2('0x3f')],_0x298040[_0xefd2('0x40')]);_0x1eaf9f[_0xefd2('0x45')]=_['intersection'](_0x298040[_0xefd2('0x3f')],qs[_0xefd2('0x44')](_0x24824d['query'][_0xefd2('0x44')]));_0x1eaf9f[_0xefd2('0x45')]=_0x1eaf9f[_0xefd2('0x45')][_0xefd2('0x46')]?_0x1eaf9f[_0xefd2('0x45')]:_0x298040[_0xefd2('0x3f')];_0x1eaf9f[_0xefd2('0x60')]=qs[_0xefd2('0x49')](_0x24824d[_0xefd2('0x40')][_0xefd2('0x49')]);_0x1eaf9f[_0xefd2('0x4a')]=qs[_0xefd2('0x42')](_[_0xefd2('0x4b')](_0x24824d['query'],_0x298040[_0xefd2('0x42')]));if(_0x24824d[_0xefd2('0x40')][_0xefd2('0x4c')]){_0x1eaf9f['where']=_[_0xefd2('0x4d')](_0x1eaf9f[_0xefd2('0x4a')],{'$or':_[_0xefd2('0x39')](_0x1eaf9f[_0xefd2('0x45')],function(_0x2627fd){var _0x425522={};_0x425522[_0x2627fd]={'$like':'%'+_0x24824d[_0xefd2('0x40')][_0xefd2('0x4c')]+'%'};return _0x425522;})});}_0x1eaf9f=_[_0xefd2('0x4d')]({},_0x1eaf9f,_0x24824d['options']);return _0x2ef297[_0xefd2('0x61')](_0x1eaf9f);}})[_0xefd2('0x33')](function(_0x361284){if(_0x361284){_0x5e1e31=_0x361284['length'];if(!_0x24824d[_0xefd2('0x40')][_0xefd2('0x62')](_0xefd2('0x47'))){_0x1eaf9f['limit']=qs[_0xefd2('0x48')](_0x24824d[_0xefd2('0x40')]['limit']);_0x1eaf9f['offset']=qs[_0xefd2('0x2c')](_0x24824d['query'][_0xefd2('0x2c')]);}return _0x2ef297['getMembers'](_0x1eaf9f);}})[_0xefd2('0x33')](function(_0x105fee){if(_0x105fee){return _0x105fee?{'count':_0x5e1e31,'rows':_0x105fee}:null;}})[_0xefd2('0x33')](respondWithResult(_0x42d9b8,null))[_0xefd2('0x27')](handleError(_0x42d9b8,null));};exports[_0xefd2('0x63')]=function(_0x51fd70,_0x3368f0,_0xb10583){return db['ChatGroup'][_0xefd2('0x55')]({'where':{'id':_0x51fd70[_0xefd2('0x58')]['id']}})[_0xefd2('0x33')](handleEntityNotFound(_0x3368f0,null))['then'](function(_0x4ceb8a){if(_0x4ceb8a){return _0x4ceb8a[_0xefd2('0x63')](_0x51fd70[_0xefd2('0x40')][_0xefd2('0x5d')]);}})[_0xefd2('0x33')](respondWithStatusCode(_0x3368f0,null))['catch'](handleError(_0x3368f0,null));};exports[_0xefd2('0x64')]=function(_0x3695a6,_0x27eee9,_0x48d16b){if(_0x3695a6[_0xefd2('0x57')]['id']){delete _0x3695a6[_0xefd2('0x57')]['id'];}return db[_0xefd2('0x3a')]['find']({'where':{'id':_0x3695a6[_0xefd2('0x58')]['id']}})[_0xefd2('0x33')](handleEntityNotFound(_0x27eee9,null))['then'](function(_0x470050){if(_0x470050){_0x3695a6[_0xefd2('0x57')][_0xefd2('0x65')]=_0x470050['id'];return db[_0xefd2('0x66')]['create'](_0x3695a6[_0xefd2('0x57')]);}})[_0xefd2('0x33')](respondWithResult(_0x27eee9,null))[_0xefd2('0x27')](handleError(_0x27eee9,null));};exports['getMessages']=function(_0x1725c2,_0xe47b3,_0x8326ea){var _0x785809={};var _0x4ec9e0={};var _0x2c4523;var _0x5b2da3;return db[_0xefd2('0x3a')]['findOne']({'where':{'id':_0x1725c2[_0xefd2('0x58')]['id']}})[_0xefd2('0x33')](handleEntityNotFound(_0xe47b3,null))[_0xefd2('0x33')](function(_0x15fa90){if(_0x15fa90){_0x2c4523=_0x15fa90;_0x4ec9e0[_0xefd2('0x3f')]=_[_0xefd2('0x41')](db[_0xefd2('0x66')]['rawAttributes']);_0x4ec9e0[_0xefd2('0x40')]=_[_0xefd2('0x41')](_0x1725c2['query']);_0x4ec9e0['filters']=_[_0xefd2('0x43')](_0x4ec9e0['model'],_0x4ec9e0[_0xefd2('0x40')]);_0x785809['attributes']=_[_0xefd2('0x43')](_0x4ec9e0[_0xefd2('0x3f')],qs[_0xefd2('0x44')](_0x1725c2[_0xefd2('0x40')][_0xefd2('0x44')]));_0x785809[_0xefd2('0x45')]=_0x785809[_0xefd2('0x45')][_0xefd2('0x46')]?_0x785809['attributes']:_0x4ec9e0['model'];_0x785809[_0xefd2('0x60')]=qs[_0xefd2('0x49')](_0x1725c2[_0xefd2('0x40')][_0xefd2('0x49')]);_0x785809[_0xefd2('0x4a')]=qs['filters'](_[_0xefd2('0x4b')](_0x1725c2['query'],_0x4ec9e0[_0xefd2('0x42')]));if(_0x1725c2[_0xefd2('0x40')][_0xefd2('0x4c')]){_0x785809[_0xefd2('0x4a')]=_[_0xefd2('0x4d')](_0x785809[_0xefd2('0x4a')],{'$or':_[_0xefd2('0x39')](_0x785809[_0xefd2('0x45')],function(_0x5e151e){var _0x2b7979={};_0x2b7979[_0x5e151e]={'$like':'%'+_0x1725c2[_0xefd2('0x40')]['filter']+'%'};return _0x2b7979;})});}if(_0x1725c2[_0xefd2('0x40')][_0xefd2('0x67')]){var _0x549686=_0x1725c2[_0xefd2('0x40')][_0xefd2('0x67')]['split'](',');var _0x2338ca={};_0x2338ca[_0x549686[0x0]]={'$gte':moment(_0x549686[0x1])[_0xefd2('0x68')](_0xefd2('0x69'))};_0x785809['where']=_[_0xefd2('0x4d')](_0x785809[_0xefd2('0x4a')],_0x2338ca);}_0x785809=_[_0xefd2('0x4d')]({},_0x785809,_0x1725c2[_0xefd2('0x54')]);return _0x2c4523[_0xefd2('0x6a')](_0x785809);}})[_0xefd2('0x33')](function(_0x135f16){if(_0x135f16){_0x5b2da3=_0x135f16[_0xefd2('0x46')];if(!_0x1725c2[_0xefd2('0x40')]['hasOwnProperty'](_0xefd2('0x47'))){_0x785809[_0xefd2('0x48')]=qs[_0xefd2('0x48')](_0x1725c2['query'][_0xefd2('0x48')]);_0x785809['offset']=qs[_0xefd2('0x2c')](_0x1725c2[_0xefd2('0x40')]['offset']);}return _0x2c4523[_0xefd2('0x6a')](_0x785809);}})[_0xefd2('0x33')](function(_0x59aae9){if(_0x59aae9){return _0x59aae9?{'count':_0x5b2da3,'rows':_0x59aae9}:null;}})[_0xefd2('0x33')](respondWithResult(_0xe47b3,null))[_0xefd2('0x27')](handleError(_0xe47b3,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 58eda97..f39785c 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 _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x2032,0xd9));var _0x2203=function(_0x7dfa90,_0x6aa15c){_0x7dfa90=_0x7dfa90-0x0;var _0x2adb01=_0x2032[_0x7dfa90];return _0x2adb01;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x16258e,_0x1d139b){var _0xdc9d39=function(_0x522473){while(--_0x522473){_0x16258e['push'](_0x16258e['shift']());}};_0xdc9d39(++_0x1d139b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x510354,_0x56cf30){_0x510354=_0x510354-0x0;var _0x1ab274=_0x5f2f[_0x510354];return _0x1ab274;};'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 diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 38fb20c..e6cb6b0 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 _0x8ce1=['bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash','util','../../config/logger','api','moment'];(function(_0x2313e8,_0x332e97){var _0x482a35=function(_0xe736a0){while(--_0xe736a0){_0x2313e8['push'](_0x2313e8['shift']());}};_0x482a35(++_0x332e97);}(_0x8ce1,0x183));var _0x18ce=function(_0x98ea42,_0x2ad02e){_0x98ea42=_0x98ea42-0x0;var _0x37260e=_0x8ce1[_0x98ea42];return _0x37260e;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var logger=require(_0x18ce('0x2'))(_0x18ce('0x3'));var moment=require(_0x18ce('0x4'));var BPromise=require(_0x18ce('0x5'));var rp=require(_0x18ce('0x6'));var fs=require('fs');var path=require(_0x18ce('0x7'));var rimraf=require(_0x18ce('0x8'));var config=require(_0x18ce('0x9'));var attributes=require(_0x18ce('0xa'));module[_0x18ce('0xb')]=function(_0x13ff9d,_0x36f8db){return _0x13ff9d[_0x18ce('0xc')](_0x18ce('0xd'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b6d=['request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird'];(function(_0x31aab5,_0x5bff12){var _0x17dcda=function(_0x86d16c){while(--_0x86d16c){_0x31aab5['push'](_0x31aab5['shift']());}};_0x17dcda(++_0x5bff12);}(_0x9b6d,0x105));var _0xd9b6=function(_0x5be805,_0x472ca3){_0x5be805=_0x5be805-0x0;var _0x86f52f=_0x9b6d[_0x5be805];return _0x86f52f;};'use strict';var _=require('lodash');var util=require(_0xd9b6('0x0'));var logger=require(_0xd9b6('0x1'))(_0xd9b6('0x2'));var moment=require(_0xd9b6('0x3'));var BPromise=require(_0xd9b6('0x4'));var rp=require(_0xd9b6('0x5'));var fs=require('fs');var path=require(_0xd9b6('0x6'));var rimraf=require(_0xd9b6('0x7'));var config=require(_0xd9b6('0x8'));var attributes=require(_0xd9b6('0x9'));module[_0xd9b6('0xa')]=function(_0x5724e3,_0x2d38ce){return _0x5724e3[_0xd9b6('0xb')](_0xd9b6('0xc'),attributes,{'tableName':_0xd9b6('0xd'),'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 e98170b..1ed988c 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 _0x9ce9=['client','http','redis','localhost','./chatGroup.socket','register','request','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0x9ce9,0xdd));var _0x99ce=function(_0x4cb213,_0x2b29d3){_0x4cb213=_0x4cb213-0x0;var _0x2a9c7b=_0x9ce9[_0x4cb213];return _0x2a9c7b;};'use strict';var _=require('lodash');var util=require(_0x99ce('0x0'));var moment=require(_0x99ce('0x1'));var BPromise=require(_0x99ce('0x2'));var rs=require(_0x99ce('0x3'));var fs=require('fs');var Redis=require(_0x99ce('0x4'));var db=require(_0x99ce('0x5'))['db'];var utils=require(_0x99ce('0x6'));var logger=require(_0x99ce('0x7'))(_0x99ce('0x8'));var config=require(_0x99ce('0x9'));var jayson=require(_0x99ce('0xa'));var client=jayson[_0x99ce('0xb')][_0x99ce('0xc')]({'port':0x232a});config[_0x99ce('0xd')]=_['defaults'](config[_0x99ce('0xd')],{'host':_0x99ce('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x99ce('0xd')]));require(_0x99ce('0xf'))[_0x99ce('0x10')](socket);function respondWithRpcPromise(_0x5b9405,_0x30ca6c,_0x2b1c7d){return new BPromise(function(_0x19036c,_0x21c611){return client[_0x99ce('0x11')](_0x5b9405,_0x2b1c7d)[_0x99ce('0x12')](function(_0x56699d){logger['info']('ChatGroup,\x20%s,\x20%s',_0x30ca6c,_0x99ce('0x13'));logger[_0x99ce('0x14')](_0x99ce('0x15'),_0x30ca6c,_0x99ce('0x13'),JSON[_0x99ce('0x16')](_0x56699d));if(_0x56699d[_0x99ce('0x17')]){if(_0x56699d[_0x99ce('0x17')][_0x99ce('0x18')]===0x1f4){logger[_0x99ce('0x17')](_0x99ce('0x19'),_0x30ca6c,_0x56699d['error'][_0x99ce('0x1a')]);return _0x21c611(_0x56699d[_0x99ce('0x17')][_0x99ce('0x1a')]);}logger[_0x99ce('0x17')]('ChatGroup,\x20%s,\x20%s',_0x30ca6c,_0x56699d[_0x99ce('0x17')][_0x99ce('0x1a')]);return _0x19036c(_0x56699d[_0x99ce('0x17')]['message']);}else{logger[_0x99ce('0x1b')](_0x99ce('0x19'),_0x30ca6c,_0x99ce('0x13'));_0x19036c(_0x56699d[_0x99ce('0x1c')][_0x99ce('0x1a')]);}})['catch'](function(_0x57c156){logger[_0x99ce('0x17')](_0x99ce('0x19'),_0x30ca6c,_0x57c156);_0x21c611(_0x57c156);});});} \ No newline at end of file +var _0xe484=['rpc','../../config/environment','client','http','redis','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x29aa04,_0x52e876){var _0x20c12b=function(_0xb851c4){while(--_0xb851c4){_0x29aa04['push'](_0x29aa04['shift']());}};_0x20c12b(++_0x52e876);}(_0xe484,0x1f3));var _0x4e48=function(_0x2dfc1c,_0x1af2b9){_0x2dfc1c=_0x2dfc1c-0x0;var _0x3bc7be=_0xe484[_0x2dfc1c];return _0x3bc7be;};'use strict';var _=require('lodash');var util=require(_0x4e48('0x0'));var moment=require(_0x4e48('0x1'));var BPromise=require('bluebird');var rs=require(_0x4e48('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e48('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e48('0x4'))(_0x4e48('0x5'));var config=require(_0x4e48('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4e48('0x7')][_0x4e48('0x8')]({'port':0x232a});config[_0x4e48('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4e48('0xa'))(new Redis(config['redis']));require(_0x4e48('0xb'))[_0x4e48('0xc')](socket);function respondWithRpcPromise(_0x4f9b04,_0x3e5983,_0x4a681f){return new BPromise(function(_0x50bb72,_0x261ac6){return client[_0x4e48('0xd')](_0x4f9b04,_0x4a681f)[_0x4e48('0xe')](function(_0x231feb){logger[_0x4e48('0xf')](_0x4e48('0x10'),_0x3e5983,_0x4e48('0x11'));logger['debug'](_0x4e48('0x12'),_0x3e5983,_0x4e48('0x11'),JSON[_0x4e48('0x13')](_0x231feb));if(_0x231feb['error']){if(_0x231feb[_0x4e48('0x14')][_0x4e48('0x15')]===0x1f4){logger[_0x4e48('0x14')]('ChatGroup,\x20%s,\x20%s',_0x3e5983,_0x231feb[_0x4e48('0x14')][_0x4e48('0x16')]);return _0x261ac6(_0x231feb[_0x4e48('0x14')][_0x4e48('0x16')]);}logger[_0x4e48('0x14')](_0x4e48('0x10'),_0x3e5983,_0x231feb[_0x4e48('0x14')][_0x4e48('0x16')]);return _0x50bb72(_0x231feb[_0x4e48('0x14')][_0x4e48('0x16')]);}else{logger[_0x4e48('0xf')](_0x4e48('0x10'),_0x3e5983,_0x4e48('0x11'));_0x50bb72(_0x231feb['result'][_0x4e48('0x16')]);}})[_0x4e48('0x17')](function(_0x1254fa){logger[_0x4e48('0x14')]('ChatGroup,\x20%s,\x20%s',_0x3e5983,_0x1254fa);_0x261ac6(_0x1254fa);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index d85d858..51ef82c 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 _0xb460=['update','emit','removeListener','register','chatGroup:','./chatGroup.events','save'];(function(_0x17fedc,_0xb5d047){var _0x1c3e1a=function(_0x41e5c2){while(--_0x41e5c2){_0x17fedc['push'](_0x17fedc['shift']());}};_0x1c3e1a(++_0xb5d047);}(_0xb460,0xe5));var _0x0b46=function(_0x22d9fc,_0x42e62d){_0x22d9fc=_0x22d9fc-0x0;var _0x38fae0=_0xb460[_0x22d9fc];return _0x38fae0;};'use strict';var ChatGroupEvents=require(_0x0b46('0x0'));var events=[_0x0b46('0x1'),'remove',_0x0b46('0x2')];function createListener(_0x5264b7,_0x553e3d){return function(_0x57980b){_0x553e3d[_0x0b46('0x3')](_0x5264b7,_0x57980b);};}function removeListener(_0x1d2646,_0x5d4162){return function(){ChatGroupEvents[_0x0b46('0x4')](_0x1d2646,_0x5d4162);};}exports[_0x0b46('0x5')]=function(_0x217c92){for(var _0x232249=0x0,_0x30f9d9=events['length'];_0x232249<_0x30f9d9;_0x232249++){var _0x3af5d7=events[_0x232249];var _0x51ffc4=createListener(_0x0b46('0x6')+_0x3af5d7,_0x217c92);ChatGroupEvents['on'](_0x3af5d7,_0x51ffc4);}}; \ No newline at end of file +var _0xceda=['remove','update','removeListener','chatGroup:','./chatGroup.events','save'];(function(_0x32bd72,_0x1ced2b){var _0x1409dc=function(_0x4e77ba){while(--_0x4e77ba){_0x32bd72['push'](_0x32bd72['shift']());}};_0x1409dc(++_0x1ced2b);}(_0xceda,0x142));var _0xaced=function(_0xe07fb3,_0x29feac){_0xe07fb3=_0xe07fb3-0x0;var _0x3484d8=_0xceda[_0xe07fb3];return _0x3484d8;};'use strict';var ChatGroupEvents=require(_0xaced('0x0'));var events=[_0xaced('0x1'),_0xaced('0x2'),_0xaced('0x3')];function createListener(_0x5178d2,_0x162a4e){return function(_0x419fab){_0x162a4e['emit'](_0x5178d2,_0x419fab);};}function removeListener(_0x2dbd40,_0x468bb5){return function(){ChatGroupEvents[_0xaced('0x4')](_0x2dbd40,_0x468bb5);};}exports['register']=function(_0x635a2){for(var _0x1ff90a=0x0,_0x55095d=events['length'];_0x1ff90a<_0x55095d;_0x1ff90a++){var _0x533085=events[_0x1ff90a];var _0x3410a9=createListener(_0xaced('0x5')+_0x533085,_0x635a2);ChatGroupEvents['on'](_0x533085,_0x3410a9);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 6a8fb0e..223e279 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 _0xd5a0=['describe','/:id','show','getMembers','getMessages','create','post','/:id/members','addMembers','/:id/messages','addMessage','update','delete','destroy','removeMembers','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe'];(function(_0x2623a3,_0x3828af){var _0x38dcc8=function(_0x134e0f){while(--_0x134e0f){_0x2623a3['push'](_0x2623a3['shift']());}};_0x38dcc8(++_0x3828af);}(_0xd5a0,0xb1));var _0x0d5a=function(_0x5c97a7,_0x3896d6){_0x5c97a7=_0x5c97a7-0x0;var _0x26be80=_0xd5a0[_0x5c97a7];return _0x26be80;};'use strict';var multer=require(_0x0d5a('0x0'));var util=require(_0x0d5a('0x1'));var path=require('path');var timeout=require(_0x0d5a('0x2'));var express=require('express');var router=express[_0x0d5a('0x3')]();var auth=require(_0x0d5a('0x4'));var interaction=require(_0x0d5a('0x5'));var config=require(_0x0d5a('0x6'));var controller=require(_0x0d5a('0x7'));router['get']('/',auth[_0x0d5a('0x8')](),controller[_0x0d5a('0x9')]);router[_0x0d5a('0xa')](_0x0d5a('0xb'),auth[_0x0d5a('0x8')](),controller[_0x0d5a('0xc')]);router[_0x0d5a('0xa')](_0x0d5a('0xd'),auth[_0x0d5a('0x8')](),controller[_0x0d5a('0xe')]);router[_0x0d5a('0xa')]('/:id/unread',auth[_0x0d5a('0x8')](),controller['getUnread']);router['get']('/:id/members',auth[_0x0d5a('0x8')](),controller[_0x0d5a('0xf')]);router[_0x0d5a('0xa')]('/:id/messages',auth[_0x0d5a('0x8')](),controller[_0x0d5a('0x10')]);router['post']('/',auth[_0x0d5a('0x8')](),controller[_0x0d5a('0x11')]);router[_0x0d5a('0x12')](_0x0d5a('0x13'),auth[_0x0d5a('0x8')](),controller[_0x0d5a('0x14')]);router[_0x0d5a('0x12')](_0x0d5a('0x15'),auth['isAuthenticated'](),controller[_0x0d5a('0x16')]);router['put'](_0x0d5a('0xd'),auth['isAuthenticated'](),controller[_0x0d5a('0x17')]);router[_0x0d5a('0x18')](_0x0d5a('0xd'),auth[_0x0d5a('0x8')](),controller[_0x0d5a('0x19')]);router[_0x0d5a('0x18')]('/:id/members',auth[_0x0d5a('0x8')](),controller[_0x0d5a('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xc5da=['update','delete','/:id','removeMembers','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMessage','put'];(function(_0x510809,_0x365172){var _0x237682=function(_0x10af65){while(--_0x10af65){_0x510809['push'](_0x510809['shift']());}};_0x237682(++_0x365172);}(_0xc5da,0xa7));var _0xac5d=function(_0xea3814,_0xb7a4bd){_0xea3814=_0xea3814-0x0;var _0x5f12b9=_0xc5da[_0xea3814];return _0x5f12b9;};'use strict';var multer=require(_0xac5d('0x0'));var util=require('util');var path=require(_0xac5d('0x1'));var timeout=require(_0xac5d('0x2'));var express=require(_0xac5d('0x3'));var router=express[_0xac5d('0x4')]();var auth=require(_0xac5d('0x5'));var interaction=require(_0xac5d('0x6'));var config=require(_0xac5d('0x7'));var controller=require('./chatGroup.controller');router[_0xac5d('0x8')]('/',auth[_0xac5d('0x9')](),controller[_0xac5d('0xa')]);router['get'](_0xac5d('0xb'),auth['isAuthenticated'](),controller[_0xac5d('0xc')]);router[_0xac5d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xac5d('0xd')]);router[_0xac5d('0x8')]('/:id/unread',auth['isAuthenticated'](),controller[_0xac5d('0xe')]);router[_0xac5d('0x8')](_0xac5d('0xf'),auth[_0xac5d('0x9')](),controller[_0xac5d('0x10')]);router[_0xac5d('0x8')](_0xac5d('0x11'),auth[_0xac5d('0x9')](),controller[_0xac5d('0x12')]);router['post']('/',auth[_0xac5d('0x9')](),controller['create']);router[_0xac5d('0x13')]('/:id/members',auth[_0xac5d('0x9')](),controller['addMembers']);router[_0xac5d('0x13')](_0xac5d('0x11'),auth[_0xac5d('0x9')](),controller[_0xac5d('0x14')]);router[_0xac5d('0x15')]('/:id',auth[_0xac5d('0x9')](),controller[_0xac5d('0x16')]);router[_0xac5d('0x17')](_0xac5d('0x18'),auth[_0xac5d('0x9')](),controller['destroy']);router[_0xac5d('0x17')](_0xac5d('0xf'),auth[_0xac5d('0x9')](),controller[_0xac5d('0x19')]);module[_0xac5d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 177818b..46128ea 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 _0x9fe2=['STRING','DATE','out','exports','BOOLEAN','INTEGER','star','thumb','TEXT'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x9fe2,0x6f));var _0x29fe=function(_0x2a21e4,_0x2349f4){_0x2a21e4=_0x2a21e4-0x0;var _0x497ff8=_0x9fe2[_0x2a21e4];return _0x497ff8;};'use strict';var Sequelize=require('sequelize');module[_0x29fe('0x0')]={'closed':{'type':Sequelize[_0x29fe('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x29fe('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x29fe('0x3'),_0x29fe('0x4')),'defaultValue':_0x29fe('0x3')},'ratingMessage':{'type':Sequelize[_0x29fe('0x5')]},'pathTranscript':{'type':Sequelize[_0x29fe('0x5')]},'mailTranscript':{'type':Sequelize[_0x29fe('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x29fe('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x29fe('0x6')]},'thirdDisposition':{'type':Sequelize[_0x29fe('0x6')]},'note':{'type':Sequelize[_0x29fe('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x29fe('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x29fe('0x6')]},'deviceModel':{'type':Sequelize[_0x29fe('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x29fe('0x6')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x29fe('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x29fe('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x29fe('0x6')]},'customerPort':{'type':Sequelize[_0x29fe('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x29fe('0x5')]}}; \ No newline at end of file +var _0xae1b=['exports','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xae1b,0x96));var _0xbae1=function(_0x5b38ca,_0x400edd){_0x5b38ca=_0x5b38ca-0x0;var _0x35bf02=_0xae1b[_0x5b38ca];return _0x35bf02;};'use strict';var Sequelize=require('sequelize');module[_0xbae1('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xbae1('0x1')]},'ratingType':{'type':Sequelize[_0xbae1('0x2')](_0xbae1('0x3'),_0xbae1('0x4')),'defaultValue':_0xbae1('0x3')},'ratingMessage':{'type':Sequelize[_0xbae1('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xbae1('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xbae1('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xbae1('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbae1('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xbae1('0x6')]},'osName':{'type':Sequelize[_0xbae1('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xbae1('0x6')]},'deviceVendor':{'type':Sequelize[_0xbae1('0x6')]},'deviceType':{'type':Sequelize[_0xbae1('0x6')]},'referer':{'type':Sequelize[_0xbae1('0x5')]},'customerIp':{'type':Sequelize[_0xbae1('0x6')]},'formData':{'type':Sequelize[_0xbae1('0x5')](_0xbae1('0x8'))},'read1stAt':{'type':Sequelize[_0xbae1('0x7')]},'lastMsgAt':{'type':Sequelize[_0xbae1('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xbae1('0x2')]('in',_0xbae1('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xbae1('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index d661b35..7af8fa7 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 _0xe02a=['tag','isArray','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','sequelize','merge','ChatInteraction','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','contactName','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','show','intersection','includeAll','include','create','body','params','destroy','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','join_url','ChatMessage','ValidationError','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','originalname','basename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','download','join','root','server/files/attachments/','format','now','pathTranscript','ChatWebsite','CmContact','customer','Visitor','agentIdentifier','website_alias','%s%d','agentAlias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','MailServerOut','Smtp','service','host','port','secure','auth','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','secret','includeAgent','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','Contact','firstName','lastName','Messages','Account','Owner','mkdirSync','40px','30px','%s\x20#%d','YYYY-MM-DD','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','out','views','downloadInteraction.html','log','err','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','client','http','info','ChatInteraction,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','end','json','count','offset','set','apply','save','update','then','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.ChatInteractionId','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','expr','parseSearch','search','conditions','find','value','having','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read'];(function(_0xc7b8d2,_0x10da03){var _0x38934d=function(_0x8a5089){while(--_0x8a5089){_0xc7b8d2['push'](_0xc7b8d2['shift']());}};_0x38934d(++_0x10da03);}(_0xe02a,0xa3));var _0xae02=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe02a[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0xae02('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xae02('0x1'));var moment=require(_0xae02('0x2'));var BPromise=require(_0xae02('0x3'));var Mustache=require(_0xae02('0x4'));var util=require(_0xae02('0x5'));var path=require(_0xae02('0x6'));var sox=require(_0xae02('0x7'));var csv=require(_0xae02('0x8'));var ejs=require(_0xae02('0x9'));var fs=require('fs');var _=require(_0xae02('0xa'));var squel=require(_0xae02('0xb'));var crypto=require(_0xae02('0xc'));var jsforce=require(_0xae02('0xd'));var deskjs=require(_0xae02('0xe'));var toCsv=require(_0xae02('0x8'));var querystring=require(_0xae02('0xf'));var Papa=require(_0xae02('0x10'));var Redis=require(_0xae02('0x11'));var authService=require(_0xae02('0x12'));var qs=require(_0xae02('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae02('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xae02('0x15'));var config=require(_0xae02('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xae02('0x17'))['db'];config[_0xae02('0x18')]=_[_0xae02('0x19')](config['redis'],{'host':_0xae02('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae02('0x18')]));require(_0xae02('0x1b'))[_0xae02('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xae02('0x1d')]['http']({'port':0x232b});var client9004=jayson[_0xae02('0x1d')][_0xae02('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x29d574,_0x110ccb,_0x227c5a,_0x1872c2){return new BPromise(function(_0x24dead,_0x737da8){var _0x1bfa33=_0x1872c2||client;return _0x1bfa33['request'](_0x29d574,_0x227c5a)['then'](function(_0x28fd31){logger[_0xae02('0x1f')](_0xae02('0x20'),_0x110ccb,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x110ccb,'request\x20sent',JSON[_0xae02('0x21')](_0x28fd31));if(_0x28fd31[_0xae02('0x22')]){if(_0x28fd31[_0xae02('0x22')][_0xae02('0x23')]===0x1f4){logger[_0xae02('0x22')](_0xae02('0x20'),_0x110ccb,_0x28fd31[_0xae02('0x22')][_0xae02('0x24')]);return _0x737da8(_0x28fd31[_0xae02('0x22')][_0xae02('0x24')]);}logger[_0xae02('0x22')](_0xae02('0x20'),_0x110ccb,_0x28fd31[_0xae02('0x22')][_0xae02('0x24')]);return _0x24dead(_0x28fd31['error']['message']);}else{logger[_0xae02('0x1f')](_0xae02('0x20'),_0x110ccb,_0xae02('0x25'));_0x24dead(_0x28fd31[_0xae02('0x26')][_0xae02('0x24')]);}})['catch'](function(_0x261851){logger[_0xae02('0x22')](_0xae02('0x20'),_0x110ccb,_0x261851);_0x737da8(_0x261851);});});}function respondWithStatusCode(_0x3a3ebe,_0x23a32b){_0x23a32b=_0x23a32b||0xcc;return function(_0x374576){if(_0x374576){return _0x3a3ebe[_0xae02('0x27')](_0x23a32b);}return _0x3a3ebe[_0xae02('0x28')](_0x23a32b)[_0xae02('0x29')]();};}function respondWithResult(_0x123c25,_0xb4c47f){_0xb4c47f=_0xb4c47f||0xc8;return function(_0x29f9c7){if(_0x29f9c7){return _0x123c25['status'](_0xb4c47f)[_0xae02('0x2a')](_0x29f9c7);}};}function respondWithFilteredResult(_0xe8b9a4,_0x111af2){return function(_0x50c35e){if(_0x50c35e){var _0x536694=_0x50c35e[_0xae02('0x2b')],_0x2b3b08=_0x111af2[_0xae02('0x2c')],_0x10a8ad=_0x111af2[_0xae02('0x2c')]+_0x111af2['limit'],_0x1834c2;if(_0x10a8ad>=_0x536694){_0x10a8ad=_0x536694;_0x1834c2=0xc8;}else{_0x1834c2=0xce;}_0xe8b9a4[_0xae02('0x28')](_0x1834c2);return _0xe8b9a4[_0xae02('0x2d')]('Content-Range',_0x2b3b08+'-'+_0x10a8ad+'/'+_0x536694)[_0xae02('0x2a')](_0x50c35e);}return null;};}function patchUpdates(_0xb564aa){return function(_0xdf336d){try{jsonpatch[_0xae02('0x2e')](_0xdf336d,_0xb564aa,!![]);}catch(_0x4214aa){return BPromise['reject'](_0x4214aa);}return _0xdf336d[_0xae02('0x2f')]();};}function saveUpdates(_0x423682,_0x1e642e){return function(_0x1dd14d){if(_0x1dd14d){return _0x1dd14d[_0xae02('0x30')](_0x423682)[_0xae02('0x31')](function(_0x30882e){return _0x30882e;});}return null;};}function removeEntity(_0x5c8dc7,_0x2e92bc){return function(_0xf93fb0){if(_0xf93fb0){return _0xf93fb0['destroy']()[_0xae02('0x31')](function(){_0x5c8dc7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8348,_0x1d1c61){return function(_0x366244){if(!_0x366244){_0x3f8348[_0xae02('0x27')](0x194);}return _0x366244;};}function handleError(_0x30e729,_0x17bc44){_0x17bc44=_0x17bc44||0x1f4;return function(_0x4e6b55){logger[_0xae02('0x22')](_0x4e6b55[_0xae02('0x32')]);if(_0x4e6b55[_0xae02('0x33')]){delete _0x4e6b55[_0xae02('0x33')];}_0x30e729[_0xae02('0x28')](_0x17bc44)[_0xae02('0x34')](_0x4e6b55);};}function getInteractionUsers(_0x53b577,_0x22d9e1){return new BPromise(function(_0x2c8adc,_0x213991){try{if(_0x22d9e1[_0x53b577['id']]){_0x53b577[_0xae02('0x35')]=_[_0xae02('0x36')](_0x22d9e1[_0x53b577['id']],function(_0xd02747){return{'id':_0xd02747['id'],'fullname':_0xd02747[_0xae02('0x37')]};});}}catch(_0x15e61a){_0x213991(_0x15e61a);}_0x2c8adc(_0x53b577);});}function getInteractionTags(_0x156d2a,_0x4caabe){return new BPromise(function(_0x41ce30,_0x14930d){try{if(_0x156d2a[_0xae02('0x38')]){_0x156d2a[_0xae02('0x39')]=[];_0x156d2a[_0xae02('0x38')][_0xae02('0x3a')](',')['forEach'](function(_0x2007b5){_0x156d2a[_0xae02('0x39')][_0xae02('0x3b')](_0x4caabe[_0x2007b5]);});}delete _0x156d2a['TagIds'];}catch(_0x3685f1){_0x14930d(_0x3685f1);}_0x41ce30(_0x156d2a);});}function updateChatInteraction(_0x2e4c78,_0x47bb8b,_0x2b3217){return new BPromise(function(_0x249a76,_0x273eba){return getInteractionUsers(_0x2e4c78,_0x2b3217)['then'](function(_0x2614cf){return getInteractionTags(_0x2614cf,_0x47bb8b);})[_0xae02('0x31')](function(_0x37ffcd){_0x249a76(_0x37ffcd);})[_0xae02('0x3c')](function(_0x27f751){_0x273eba(_0x27f751);});});}exports['index']=function(_0x5db078,_0x1fdbaa){var _0x206275={},_0x22fa90={},_0x1238db={'count':0x0,'rows':[]};var _0x40ed68=_[_0xae02('0x36')](db['ChatInteraction'][_0xae02('0x3d')],function(_0x491b79){return{'name':_0x491b79[_0xae02('0x3e')],'type':_0x491b79[_0xae02('0x3f')][_0xae02('0x40')]};});_0x22fa90[_0xae02('0x41')]=_[_0xae02('0x36')](_0x40ed68,_0xae02('0x33'));_0x22fa90[_0xae02('0x42')]=_[_0xae02('0x43')](_0x5db078[_0xae02('0x42')]);_0x22fa90[_0xae02('0x44')]=_['intersection'](_0x22fa90['model'],_0x22fa90[_0xae02('0x42')]);_0x206275[_0xae02('0x45')]=_['intersection'](_0x22fa90[_0xae02('0x41')],qs[_0xae02('0x46')](_0x5db078[_0xae02('0x42')][_0xae02('0x46')]));_0x206275[_0xae02('0x45')]=_0x206275[_0xae02('0x45')][_0xae02('0x47')]?_0x206275[_0xae02('0x45')]:_0x22fa90[_0xae02('0x41')];if(!_0x5db078[_0xae02('0x42')][_0xae02('0x48')](_0xae02('0x49'))){_0x206275['limit']=qs[_0xae02('0x4a')](_0x5db078[_0xae02('0x42')]['limit']);_0x206275[_0xae02('0x2c')]=qs[_0xae02('0x2c')](_0x5db078[_0xae02('0x42')][_0xae02('0x2c')]);}_0x206275[_0xae02('0x4b')]=qs[_0xae02('0x4c')](_0x5db078['query'][_0xae02('0x4c')]);_0x206275[_0xae02('0x4d')]=qs[_0xae02('0x44')](_[_0xae02('0x4e')](_0x5db078['query'],_0x22fa90[_0xae02('0x44')]),_0x40ed68);var _0x51dabc=[];var _0x296044=squel[_0xae02('0x4f')]()[_0xae02('0x50')]('id')[_0xae02('0x50')](_0xae02('0x33'))['field'](_0xae02('0x51'))[_0xae02('0x52')](_0xae02('0x53'));var _0x219cf1=squel[_0xae02('0x4f')]()['field'](_0xae02('0x54'))[_0xae02('0x50')]('u.fullname')[_0xae02('0x50')](_0xae02('0x55'))[_0xae02('0x52')](_0xae02('0x56'),'ui')['left_join'](_0xae02('0x57'),'u',_0xae02('0x58'));var _0x4fc387=squel['select']()[_0xae02('0x52')](_0xae02('0x59'),'i')[_0xae02('0x5a')](_0xae02('0x5b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xae02('0x57'),'o',_0xae02('0x5c'))[_0xae02('0x5a')](_0xae02('0x5d'),'a',_0xae02('0x5e'))[_0xae02('0x5a')](_0xae02('0x5f'),'me',_0xae02('0x60'))[_0xae02('0x5a')](_0xae02('0x61'),'it','it.ChatInteractionId\x20=\x20i.id')['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x2b7648=squel[_0xae02('0x62')]();var _0x3d73f1=[];var _0x3d889a=squel[_0xae02('0x62')]();var _0x5c0c01;if(_0x5db078[_0xae02('0x42')]['search']){_0x5c0c01=as[_0xae02('0x63')](_0x5db078[_0xae02('0x42')][_0xae02('0x64')]);var _0x1999c2=_0x5c0c01['sqlOperator'];for(var _0x18dc6d=0x0;_0x18dc6d<_0x5c0c01['conditions']['length'];_0x18dc6d++){var _0x31cff3=_0x5c0c01[_0xae02('0x65')][_0x18dc6d];var _0x2d763c='i';var _0x2a0f2a=_[_0xae02('0x66')](_0x40ed68,[_0xae02('0x33'),_0x31cff3[_0xae02('0x50')]]);if(!_0x2a0f2a){switch(_0x31cff3[_0xae02('0x50')]){case'unreadMessages':if(_0x31cff3[_0xae02('0x67')]==0x1){_0x4fc387['having']('`'+_0x31cff3[_0xae02('0x50')]+'`\x20=\x200');}else{_0x4fc387[_0xae02('0x68')]('`'+_0x31cff3['field']+'`\x20>\x200');}break;case'Contact':if(_0x31cff3[_0xae02('0x69')]==='$substring'){if(_0x31cff3[_0xae02('0x67')][_0xae02('0x3a')]('\x20')[_0xae02('0x47')]>0x1){_0x2b7648[_0x1999c2](_0xae02('0x6a'),qs[_0xae02('0x6b')](_0x31cff3[_0xae02('0x67')]),null);}else{var _0x1dce81='%'+_0x31cff3[_0xae02('0x67')]+'%';_0x2b7648[_0x1999c2](_0xae02('0x6c'),_0x1dce81,_0x1dce81,_0x1dce81);}}else{_0x2a0f2a=_[_0xae02('0x66')](_0x40ed68,[_0xae02('0x33'),'ContactId']);_0x31cff3[_0xae02('0x50')]=_0xae02('0x6d');_0x17eddb=as[_0xae02('0x6e')](_0x2d763c,_0x2a0f2a[_0xae02('0x3f')],_0x31cff3);_0x2b7648[_0x1999c2](_0x17eddb['text'],_0x17eddb[_0xae02('0x67')][_0xae02('0x6f')],_0x17eddb[_0xae02('0x67')][_0xae02('0x29')]);}break;case'Tag':var _0x1c1473=_0x31cff3[_0xae02('0x67')][_0xae02('0x3a')](',')['map'](function(_0x45e6f9){return Number(_0x45e6f9);});_0x1c1473[_0xae02('0x70')](function(_0x4c4621){_0x3d889a['or'](_0xae02('0x71'),'%,'+_0x4c4621+',%');});_0x3d73f1=_['union'](_0x3d73f1,_0x1c1473);break;case _0xae02('0x72'):if(_0x31cff3[_0xae02('0x69')]===_0xae02('0x73')){_0x2b7648[_0x1999c2](_0xae02('0x74'),'%'+_0x31cff3[_0xae02('0x67')]+'%',null);}else{_0x2a0f2a=_[_0xae02('0x66')](_0x40ed68,[_0xae02('0x33'),_0xae02('0x75')]);_0x31cff3['field']=_0xae02('0x75');_0x17eddb=as[_0xae02('0x6e')](_0x2d763c,_0x2a0f2a[_0xae02('0x3f')],_0x31cff3);_0x2b7648[_0x1999c2](_0x17eddb['text'],_0x17eddb['value'][_0xae02('0x6f')],_0x17eddb[_0xae02('0x67')][_0xae02('0x29')]);}break;case'body':_0x17eddb=as['buildExpression']('me',null,_0x31cff3);_0x2b7648[_0x1999c2](_0x17eddb['text'],_0x17eddb[_0xae02('0x67')]['start'],_0x17eddb[_0xae02('0x67')][_0xae02('0x29')]);break;}}else{var _0x17eddb=as[_0xae02('0x6e')](_0x2d763c,_0x2a0f2a[_0xae02('0x3f')],_0x31cff3);_0x2b7648[_0x1999c2](_0x17eddb['text'],_0x17eddb[_0xae02('0x67')][_0xae02('0x6f')],_0x17eddb[_0xae02('0x67')][_0xae02('0x29')]);}}}else{var _0x2c2562=_(_0x5db078[_0xae02('0x42')])[_0xae02('0x43')]()[_0xae02('0x36')](function(_0x3caa80){return _[_0xae02('0x76')](_0x40ed68,[_0xae02('0x33'),_0x3caa80])?_0x3caa80:undefined;})[_0xae02('0x77')]()[_0xae02('0x67')]();if(!_[_0xae02('0x78')](_0x2c2562)){_0x2c2562[_0xae02('0x70')](function(_0xe7e0ee){if(_0xe7e0ee===_0xae02('0x79')){_0x4fc387[_0xae02('0x4d')](_0xae02('0x7a'),[]['concat'](_0x5db078[_0xae02('0x42')][_0xe7e0ee]));}else if(_0xe7e0ee===_0xae02('0x7b')){var _0x2f49a1=JSON[_0xae02('0x7c')](_0x5db078['query'][_0xe7e0ee])[_0xae02('0x7d')];var _0x4ae71d=JSON['parse'](_0x5db078[_0xae02('0x42')][_0xe7e0ee])[_0xae02('0x7e')];_0x4fc387['where'](_0xae02('0x7f'),_0x2f49a1,_0x4ae71d);}else{if(_0x5db078[_0xae02('0x42')][_0xe7e0ee]==='null'){_0x4fc387['where']('i.'+_0xe7e0ee+_0xae02('0x80'));}else{_0x4fc387[_0xae02('0x4d')]('i.'+_0xe7e0ee+_0xae02('0x81'),_0x5db078[_0xae02('0x42')][_0xe7e0ee]);}}});}if(_0x5db078['query'][_0xae02('0x82')]){if(_0x5db078[_0xae02('0x42')]['read']==0x1){_0x4fc387[_0xae02('0x68')]('`unreadMessages`\x20=\x200');}else{_0x4fc387['having']('`unreadMessages`\x20>\x200');}}if(_0x5db078[_0xae02('0x42')][_0xae02('0x83')]){_0x3d73f1=_[_0xae02('0x84')](_0x5db078[_0xae02('0x42')][_0xae02('0x83')])?_0x5db078[_0xae02('0x42')][_0xae02('0x83')]:new Array(_0x5db078[_0xae02('0x42')][_0xae02('0x83')]);_0x3d73f1[_0xae02('0x70')](function(_0x4d0e9b){_0x3d889a['or'](_0xae02('0x71'),'%,'+_0x4d0e9b+',%');});}if(_0x5db078['query'][_0xae02('0x85')]){var _0x2293b6=_0x5db078[_0xae02('0x42')][_0xae02('0x85')]['replace']('\x5c','\x5c\x5c')[_0xae02('0x86')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2293b6)){_0x2b7648['or'](_0xae02('0x87'),_0x2293b6+'%');}else{_0x2b7648['or'](_0xae02('0x88'),qs[_0xae02('0x6b')](_0x2293b6))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2293b6+'%');}}}_0x4fc387[_0xae02('0x4d')](_0x2b7648);_0x4fc387[_0xae02('0x89')]('i.id');var _0x13eb66={'type':db[_0xae02('0x8a')][_0xae02('0x8b')][_0xae02('0x8c')],'raw':!![]};var _0x252174=_0x4fc387['clone']();_0x252174[_0xae02('0x50')](_0xae02('0x8d'));_0x252174[_0xae02('0x50')](_0xae02('0x8e'),'unreadMessages');if(_0x206275[_0xae02('0x4b')]){_0x206275[_0xae02('0x4b')]['forEach'](function(_0x595aa9){var _0xef192e=_0x595aa9[0x0]==='contactName'?_0x595aa9[0x0]:'i.'+_0x595aa9[0x0];_0x4fc387[_0xae02('0x4b')](_0xef192e,_0x595aa9[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x3d73f1)){_0x4fc387[_0xae02('0x68')](_0x3d889a);_0x252174['where'](_0xae02('0x8f'),_0x3d73f1);}BPromise[_0xae02('0x90')]()[_0xae02('0x31')](function(){if(!_0x5c0c01){if(_0x5db078[_0xae02('0x42')][_0xae02('0x79')]||_0x5db078[_0xae02('0x42')]['journey'])return;_0x252174[_0xae02('0x4d')](_0xae02('0x91'));_0x4fc387[_0xae02('0x4d')](_0xae02('0x91'));return;}if(_0x5db078['user'][_0xae02('0x92')]!==_0xae02('0x93'))return;return _0x5db078[_0xae02('0x94')][_0xae02('0x95')]({'attributes':['id'],'raw':!![]})[_0xae02('0x31')](function(_0x37b926){if(_[_0xae02('0x78')](_0x37b926)){_0x252174['where'](_0xae02('0x96'));_0x4fc387[_0xae02('0x4d')](_0xae02('0x96'));}else{_0x252174[_0xae02('0x4d')](_0xae02('0x7a'),_[_0xae02('0x36')](_0x37b926,'id'));_0x4fc387[_0xae02('0x4d')]('i.ChatWebsiteId\x20IN\x20?',_[_0xae02('0x36')](_0x37b926,'id'));}});})[_0xae02('0x31')](function(){if(_0x5db078[_0xae02('0x94')][_0xae02('0x92')]===_0xae02('0x93')&&!_0x5c0c01&&!_0x5db078[_0xae02('0x42')][_0xae02('0x79')])return[];return db['sequelize']['query'](_0x252174[_0xae02('0x97')](),_0x13eb66);})[_0xae02('0x31')](function(_0x4353eb){_0x1238db['count']=_0x4353eb['length'];if(_0x1238db[_0xae02('0x2b')]===0x0)return[];return db[_0xae02('0x98')][_0xae02('0x42')](_0x296044[_0xae02('0x97')](),_0x13eb66)[_0xae02('0x31')](function(_0x4b6ba9){_0x51dabc=_['keyBy'](_0x4b6ba9,'id');_0x13eb66=_[_0xae02('0x99')](_0x13eb66,{'model':db[_0xae02('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5db078['query'][_0xae02('0x46')]){_0x206275[_0xae02('0x45')]['forEach'](function(_0x37a5f9){_0x4fc387['field']('i.'+_0x37a5f9);});}else{_0x4fc387[_0xae02('0x50')](_0xae02('0x8e'),_0xae02('0x9b'));_0x4fc387[_0xae02('0x50')](_0xae02('0x9c'),_0xae02('0x9d'));_0x4fc387[_0xae02('0x50')](_0xae02('0x9e'),_0xae02('0x9f'));_0x4fc387[_0xae02('0x50')](_0xae02('0xa0'),_0xae02('0xa1'));_0x4fc387[_0xae02('0x50')](_0xae02('0xa2'));_0x4fc387['field'](_0xae02('0xa3'),'Contact.firstName');_0x4fc387[_0xae02('0x50')](_0xae02('0xa4'),_0xae02('0xa5'));_0x4fc387[_0xae02('0x50')](_0xae02('0xa6'),_0xae02('0xa7'));_0x4fc387[_0xae02('0x50')](_0xae02('0xa8'),_0xae02('0xa9'));_0x4fc387['field'](_0xae02('0xaa'),_0xae02('0xab'));_0x4fc387[_0xae02('0x50')]('c.fax','Contact.fax');_0x4fc387[_0xae02('0x50')]('o.fullname',_0xae02('0xac'));_0x4fc387[_0xae02('0x50')]('o.internal',_0xae02('0xad'));_0x4fc387[_0xae02('0x50')](_0xae02('0xae'),_0xae02('0x38'));}if(_0x206275[_0xae02('0x4a')])_0x4fc387[_0xae02('0x4a')](_0x206275['limit']);if(_0x206275[_0xae02('0x2c')])_0x4fc387[_0xae02('0x2c')](_0x206275['offset']);return db[_0xae02('0x98')][_0xae02('0x42')](_0x4fc387[_0xae02('0x97')](),_0x13eb66);})[_0xae02('0x31')](function(_0x2843ac){_0x219cf1[_0xae02('0x4d')](_0xae02('0xaf'),_[_0xae02('0x36')](_0x2843ac,'id'));return db['sequelize'][_0xae02('0x42')](_0x219cf1[_0xae02('0x97')](),_0x13eb66)['then'](function(_0x82bb75){var _0x51c225=_[_0xae02('0xb0')](_0x82bb75,_0xae02('0xb1'));var _0x1291c5=[];_0x2843ac['forEach'](function(_0x5cfa84){_0x1291c5[_0xae02('0x3b')](updateChatInteraction(_0x5cfa84,_0x51dabc,_0x51c225));});return BPromise[_0xae02('0xb2')](_0x1291c5);});});})[_0xae02('0x31')](function(_0x2f4a06){_0x1238db['rows']=_0x2f4a06;return _0x1238db;})[_0xae02('0x31')](respondWithFilteredResult(_0x1fdbaa,_0x206275))['catch'](handleError(_0x1fdbaa,null));};exports[_0xae02('0xb3')]=function(_0x3db6c7,_0x57b525){var _0x31b00b={'raw':![],'where':{'id':_0x3db6c7['params']['id']}},_0x14f09={};_0x14f09[_0xae02('0x41')]=_[_0xae02('0x43')](db[_0xae02('0x9a')][_0xae02('0x3d')]);_0x14f09['query']=_[_0xae02('0x43')](_0x3db6c7['query']);_0x14f09[_0xae02('0x44')]=_['intersection'](_0x14f09[_0xae02('0x41')],_0x14f09['query']);_0x31b00b[_0xae02('0x45')]=_[_0xae02('0xb4')](_0x14f09[_0xae02('0x41')],qs[_0xae02('0x46')](_0x3db6c7[_0xae02('0x42')]['fields']));_0x31b00b[_0xae02('0x45')]=_0x31b00b[_0xae02('0x45')][_0xae02('0x47')]?_0x31b00b[_0xae02('0x45')]:_0x14f09[_0xae02('0x41')];if(_0x3db6c7[_0xae02('0x42')][_0xae02('0xb5')]){_0x31b00b[_0xae02('0xb6')]=[{'all':!![]}];}_0x31b00b=_[_0xae02('0x99')]({},_0x31b00b,_0x3db6c7['options']);return db[_0xae02('0x9a')]['find'](_0x31b00b)[_0xae02('0x31')](handleEntityNotFound(_0x57b525,null))[_0xae02('0x31')](respondWithResult(_0x57b525,null))[_0xae02('0x3c')](handleError(_0x57b525,null));};exports[_0xae02('0xb7')]=function(_0x5d8e59,_0x3514b8){return db[_0xae02('0x9a')]['create'](_0x5d8e59[_0xae02('0xb8')],{})[_0xae02('0x31')](respondWithResult(_0x3514b8,0xc9))[_0xae02('0x3c')](handleError(_0x3514b8,null));};exports[_0xae02('0x30')]=function(_0x102211,_0x171512){if(_0x102211['body']['id']){delete _0x102211['body']['id'];}return db['ChatInteraction'][_0xae02('0x66')]({'where':{'id':_0x102211[_0xae02('0xb9')]['id']}})['then'](handleEntityNotFound(_0x171512,null))[_0xae02('0x31')](saveUpdates(_0x102211[_0xae02('0xb8')],null))[_0xae02('0x31')](respondWithResult(_0x171512,null))[_0xae02('0x3c')](handleError(_0x171512,null));};exports[_0xae02('0xba')]=function(_0x2869cd,_0x5f1abf){return db[_0xae02('0x9a')][_0xae02('0x66')]({'where':{'id':_0x2869cd[_0xae02('0xb9')]['id']}})[_0xae02('0x31')](handleEntityNotFound(_0x5f1abf,null))['then'](removeEntity(_0x5f1abf,null))[_0xae02('0x3c')](handleError(_0x5f1abf,null));};exports[_0xae02('0xbb')]=function(_0x3aa598,_0x3b101d){return db[_0xae02('0x9a')][_0xae02('0xbb')]()[_0xae02('0x31')](respondWithResult(_0x3b101d,null))[_0xae02('0x3c')](handleError(_0x3b101d,null));};exports[_0xae02('0xbc')]=function(_0x4b5130,_0x2ae50e){var _0x97dd62=_0x4b5130[_0xae02('0xb9')]['id'];var _0x405dd9;var _0x55ebc1;var _0x1bc43b;return db[_0xae02('0x9a')][_0xae02('0xbd')]({'where':{'id':_0x97dd62}})[_0xae02('0x31')](function(_0xbe90f0){_0x405dd9=_0xbe90f0;return db['ChatWebsite'][_0xae02('0xbd')]({'where':{'id':_0xbe90f0[_0xae02('0x79')]},'attributes':['id',_0xae02('0xbe'),_0xae02('0xbf')],'raw':!![]});})[_0xae02('0x31')](function(_0x54740d){if(_0x54740d&&_0x54740d['vidaooApiKey']&&_0x54740d[_0xae02('0xbf')]){_0x55ebc1=_0x54740d;var _0x3c49b4={'rejectUnauthorized':![],'method':_0xae02('0xc0'),'uri':_0xae02('0xc1'),'headers':{'X-APIKEY':_0x54740d['vidaooApiKey']},'body':{'name':_0xae02('0xc2')+_0x97dd62},'redirect':'follow','json':!![]};return rp(_0x3c49b4);}else{throw new db[(_0xae02('0x8a'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0xae02('0x31')](function(_0x368ec3){_0x1bc43b=_0x368ec3;if(_0x1bc43b['id']){var _0x4e5922={'body':_0x1bc43b[_0xae02('0xc3')],'ChatWebsiteId':_0x55ebc1['id'],'ChatInteractionId':_0x405dd9['id'],'direction':'out','UserId':_0x4b5130[_0xae02('0x94')]['id']};return db[_0xae02('0xc4')][_0xae02('0xb7')](_0x4e5922,{});}else{throw new db[(_0xae02('0x8a'))][(_0xae02('0xc5'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x405dd9[_0xae02('0xc6')]({'vidaooSessionId':_0x1bc43b['id']});})['then'](respondWithResult(_0x2ae50e,null))[_0xae02('0x3c')](handleError(_0x2ae50e,null));};exports['customUpdate']=function(_0x1e0110,_0x1cf463){if(_0x1e0110[_0xae02('0xb8')]['id']){delete _0x1e0110[_0xae02('0xb8')]['id'];}return db[_0xae02('0x9a')][_0xae02('0x66')]({'where':{'id':_0x1e0110[_0xae02('0xb9')]['id']}})[_0xae02('0x31')](handleEntityNotFound(_0x1cf463,null))[_0xae02('0x31')](saveUpdates(_0x1e0110[_0xae02('0xb8')],null))[_0xae02('0x31')](respondWithResult(_0x1cf463,null))[_0xae02('0x3c')](handleError(_0x1cf463,null));};exports[_0xae02('0xc7')]=function(_0x1e7253,_0x4159c5,_0x100711){if(_0x1e7253[_0xae02('0xb8')]['id']){delete _0x1e7253[_0xae02('0xb8')]['id'];}return db[_0xae02('0x9a')][_0xae02('0x66')]({'where':{'id':_0x1e7253[_0xae02('0xb9')]['id']}})[_0xae02('0x31')](function(_0x480587){if(!_0x480587){logger[_0xae02('0x22')](_0xae02('0xc8'),_0xae02('0xc7'),0x194,'entity\x20not\x20found');_0x4159c5[_0xae02('0x27')](0x194);}else{if(_0x480587[_0xae02('0x75')]){throw new db[(_0xae02('0x8a'))][(_0xae02('0xc5'))](_0xae02('0xc9'));}}return _0x480587;})[_0xae02('0x31')](function(_0x5f510e){if(_0x5f510e){return _0x5f510e[_0xae02('0x30')]({'closed':_0x1e7253[_0xae02('0xb8')][_0xae02('0xca')],'disposition':_0x1e7253[_0xae02('0xb8')][_0xae02('0xcb')]})['then'](function(_0xd8a3dd){return _0xd8a3dd;});}})[_0xae02('0x31')](function(_0x15c0c2){return respondWithRpcPromise(_0xae02('0xcc'),_0xae02('0xc7'),_0x1e7253['body'],client9004);})[_0xae02('0x31')](respondWithResult(_0x4159c5,null))['catch'](handleError(_0x4159c5,null));};exports['attachmentUpload']=function(_0x106a2c,_0x5cd8a3,_0xaeab78){_0x106a2c[_0xae02('0xb8')]['name']=_0x106a2c['file'][_0xae02('0xcd')];_0x106a2c['body'][_0xae02('0xce')]=_0x106a2c['file']['filename'];_0x106a2c[_0xae02('0xb8')]['type']=_0x106a2c['file'][_0xae02('0xcf')];return db[_0xae02('0xd0')][_0xae02('0xb7')](_0x106a2c[_0xae02('0xb8')])['then'](respondWithResult(_0x5cd8a3,0xc9))[_0xae02('0x3c')](handleError(_0x5cd8a3,null));};exports[_0xae02('0xd1')]=function(_0x5c906b,_0x372c5d,_0x2cc444){return db[_0xae02('0x9a')][_0xae02('0xbd')]({'where':{'id':_0x5c906b[_0xae02('0xb9')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x372c5d,null))[_0xae02('0x31')](function(_0x7b36b5){if(_0x7b36b5){if(_0x7b36b5[_0xae02('0xca')]){return _0x372c5d[_0xae02('0x28')](0x193)[_0xae02('0x2a')]({'status':0x193,'message':_0xae02('0xd2')});}return db['Attachment'][_0xae02('0xbd')]({'where':{'id':_0x5c906b[_0xae02('0x42')][_0xae02('0xd3')]},'raw':!![]})[_0xae02('0x31')](handleEntityNotFound(_0x372c5d,null));}})[_0xae02('0x31')](function(_0x432540){if(_0x432540){return _0x372c5d[_0xae02('0xd4')](path[_0xae02('0xd5')](config[_0xae02('0xd6')],_0xae02('0xd7'),_0x432540[_0xae02('0xce')]));}})[_0xae02('0x3c')](handleError(_0x372c5d,null));};exports['close']=function(_0x181eb6,_0x23ee54){var _0x49908b=null;var _0x91bb3b=null;var _0x2a1d58=null;var _0x7e10ca=null;if(_0x181eb6[_0xae02('0xb8')]['id']){delete _0x181eb6['body']['id'];}if(_0x181eb6[_0xae02('0xb8')]['mailTranscript']){_0x7e10ca=path[_0xae02('0xd5')](config[_0xae02('0xd6')],'server/files/chat/upload/',util[_0xae02('0xd8')]('transcript-%s.txt',Date[_0xae02('0xd9')]()));_0x181eb6[_0xae02('0xb8')][_0xae02('0xda')]=_0x7e10ca;}return db[_0xae02('0x9a')][_0xae02('0x66')]({'where':{'id':_0x181eb6['params']['id']},'include':[{'model':db[_0xae02('0xc4')],'as':'Messages','include':[{'model':db['User'],'as':'User'}]}]})['then'](handleEntityNotFound(_0x23ee54,null))[_0xae02('0x31')](saveUpdates(_0x181eb6[_0xae02('0xb8')],null))[_0xae02('0x31')](function(_0x5440c9){if(_0x5440c9){_0x49908b=_0x5440c9;return db[_0xae02('0xdb')][_0xae02('0x66')]({'where':{'id':_0x49908b[_0xae02('0x79')]}});}})[_0xae02('0x31')](function(_0x10d772){if(_0x10d772){_0x2a1d58=_0x10d772;return db[_0xae02('0xdc')][_0xae02('0x66')]({'where':{'id':_0x49908b[_0xae02('0x6d')]}});}})[_0xae02('0x31')](function(_0x5101dd){if(_0x5101dd){_0x91bb3b=_0x5101dd;if(_0x7e10ca){var _0x18e4ea=null;for(var _0x3fa25d=0x1;_0x3fa25d<_0x49908b['Messages'][_0xae02('0x47')];++_0x3fa25d){_0x18e4ea=_0x49908b['Messages'][_0x3fa25d];var _0x361f50=_0x18e4ea[_0xae02('0x75')]?util[_0xae02('0xd8')]('%s%d',_0x2a1d58['agentAlias'],_0x18e4ea[_0xae02('0x75')]):'System';var _0x20d448=_0x181eb6[_0xae02('0xb8')][_0xae02('0xdd')]||util[_0xae02('0xd8')]('%s%d',_0xae02('0xde'),_0x18e4ea['ContactId']);switch(_0x2a1d58[_0xae02('0xdf')]){case _0xae02('0xe0'):_0x361f50=_0x18e4ea[_0xae02('0x75')]?util[_0xae02('0xd8')](_0xae02('0xe1'),_0x2a1d58[_0xae02('0xe2')],_0x18e4ea[_0xae02('0x75')]):_0xae02('0xe3');break;case _0xae02('0xe4'):_0x361f50=_0x18e4ea['UserId']?_0x18e4ea['User'][_0xae02('0xe5')]||_0x18e4ea['User'][_0xae02('0x37')]:'System';break;case _0xae02('0xe6'):_0x361f50=_0x18e4ea[_0xae02('0x75')]?_0x18e4ea['User'][_0xae02('0x37')]:_0xae02('0xe3');break;default:_0x361f50=_0x18e4ea[_0xae02('0x75')]?util[_0xae02('0xd8')](_0xae02('0xe1'),_0x2a1d58[_0xae02('0xe2')],_0x18e4ea['UserId']):_0xae02('0xe3');}var _0x1b53c8=util[_0xae02('0xd8')](_0xae02('0xe7'),moment(_0x18e4ea[_0xae02('0x7b')])['format'](_0xae02('0xe8')),_0x18e4ea[_0xae02('0xe9')]==='in'?_0x20d448:_0x361f50,_0x18e4ea[_0xae02('0xb8')]);if(!_0x18e4ea['secret']){fs['appendFileSync'](_0x7e10ca,_0x1b53c8);}}return db['MailAccount'][_0xae02('0xbd')]({'where':{'service':!![]},'include':[{'model':db[_0xae02('0xea')],'as':_0xae02('0xeb'),'raw':!![]}]});}}})['then'](function(_0x5d17d5){if(_0x5d17d5&&_0x5d17d5[_0xae02('0xeb')]&&_0x181eb6[_0xae02('0xb8')]){var _0xe675bd={'tls':{'rejectUnauthorized':![]}};if(_0x5d17d5[_0xae02('0xeb')][_0xae02('0xec')]){_0xe675bd[_0xae02('0xec')]=_0x5d17d5[_0xae02('0xeb')][_0xae02('0xec')];}else{_0xe675bd[_0xae02('0xed')]=_0x5d17d5['Smtp'][_0xae02('0xed')];_0xe675bd['port']=_0x5d17d5[_0xae02('0xeb')][_0xae02('0xee')];_0xe675bd[_0xae02('0xef')]=_0x5d17d5[_0xae02('0xeb')][_0xae02('0xef')];}if(_0x5d17d5[_0xae02('0xeb')]['authentication']){_0xe675bd[_0xae02('0xf0')]={'user':_0x5d17d5['Smtp']['user'],'pass':_0x5d17d5['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0xae02('0xf1'),{'account':_0xe675bd,'message':{'from':util[_0xae02('0xd8')](_0xae02('0xf2'),_0x5d17d5['name'],_0x5d17d5[_0xae02('0xf3')]||_0x5d17d5[_0xae02('0xeb')][_0xae02('0x94')]),'to':_0x181eb6['body'][_0xae02('0xf4')],'subject':'Mail\x20Transcript','text':util[_0xae02('0xd8')](_0xae02('0xf5'),_0x181eb6['body'][_0xae02('0xf4')]),'attachments':[{'path':_0x7e10ca}]}})[_0xae02('0x31')](function(){return _0x49908b;})['catch'](function(_0x4549f9){console[_0xae02('0x22')](_0x4549f9);});}else{return _0x49908b;}})[_0xae02('0x31')](respondWithStatusCode(_0x23ee54,0xc8))['catch'](handleError(_0x23ee54,null));};exports[_0xae02('0xf6')]=function(_0x45f878,_0x1a8700,_0xeb137c){return db[_0xae02('0xc4')][_0xae02('0x66')]({'where':{'id':_0x45f878[_0xae02('0xb9')]['id']}})[_0xae02('0x31')](handleEntityNotFound(_0x1a8700,null))['then'](function(_0x549864){if(_0x549864){return _0x549864[_0xae02('0xf6')](_0x45f878[_0xae02('0xb8')][_0xae02('0xf7')],_[_0xae02('0xf8')](_0x45f878[_0xae02('0xb8')],[_0xae02('0xf7'),'id'])||{});}})[_0xae02('0x31')](respondWithResult(_0x1a8700,null))[_0xae02('0x3c')](handleError(_0x1a8700,null));};exports[_0xae02('0xf9')]=function(_0x2e2a0e,_0x46046b,_0x1e150f){var _0x1fa4fd={'raw':![],'where':{}};var _0x5b810e={};var _0x5a4277={'count':0x0,'rows':[]};return db[_0xae02('0x9a')]['findOne']({'where':{'id':_0x2e2a0e[_0xae02('0xb9')]['id']}})['then'](handleEntityNotFound(_0x46046b,null))[_0xae02('0x31')](function(_0x30ebe8){if(_0x30ebe8){_0x5b810e[_0xae02('0x41')]=_[_0xae02('0x43')](db['ChatMessage'][_0xae02('0x3d')]);_0x5b810e[_0xae02('0x42')]=_['keys'](_0x2e2a0e['query']);_0x5b810e['filters']=_[_0xae02('0xb4')](_0x5b810e[_0xae02('0x41')],_0x5b810e['query']);_0x1fa4fd['attributes']=_[_0xae02('0xb4')](_0x5b810e[_0xae02('0x41')],qs['fields'](_0x2e2a0e[_0xae02('0x42')][_0xae02('0x46')]));_0x1fa4fd[_0xae02('0x45')]=_0x1fa4fd['attributes']['length']?_0x1fa4fd[_0xae02('0x45')]:_0x5b810e[_0xae02('0x41')];if(!_0x2e2a0e['query'][_0xae02('0x48')](_0xae02('0x49'))){_0x1fa4fd[_0xae02('0x4a')]=qs[_0xae02('0x4a')](_0x2e2a0e['query'][_0xae02('0x4a')]);_0x1fa4fd[_0xae02('0x2c')]=qs[_0xae02('0x2c')](_0x2e2a0e['query'][_0xae02('0x2c')]);}_0x1fa4fd[_0xae02('0x4b')]=qs['sort'](_0x2e2a0e[_0xae02('0x42')][_0xae02('0x4c')]);_0x1fa4fd[_0xae02('0x4d')]=qs[_0xae02('0x44')](_[_0xae02('0x4e')](_0x2e2a0e[_0xae02('0x42')],_0x5b810e[_0xae02('0x44')]));_0x1fa4fd[_0xae02('0x4d')]['ChatInteractionId']=_0x30ebe8['id'];if(_0x2e2a0e[_0xae02('0x42')][_0xae02('0x85')]){_0x1fa4fd['where']=_[_0xae02('0x99')](_0x1fa4fd[_0xae02('0x4d')],{'$or':_[_0xae02('0x36')](_0x1fa4fd[_0xae02('0x45')],function(_0x1b85c5){var _0x22e461={};_0x22e461[_0x1b85c5]={'$like':'%'+_0x2e2a0e[_0xae02('0x42')]['filter']+'%'};return _0x22e461;})});}if(_0x2e2a0e[_0xae02('0x42')][_0xae02('0x7d')]){var _0x1309e2=_0x2e2a0e[_0xae02('0x42')][_0xae02('0x7d')][_0xae02('0x3a')](',');var _0x7ed84f={};_0x7ed84f[_0x1309e2[0x0]]={'$gte':moment(_0x1309e2[0x1])['format'](_0xae02('0xfa'))};_0x1fa4fd[_0xae02('0x4d')]=_[_0xae02('0x99')](_0x1fa4fd['where'],_0x7ed84f);}_0x1fa4fd=_['merge']({},_0x1fa4fd,_0x2e2a0e[_0xae02('0xfb')]);return db[_0xae02('0xc4')]['count']({'where':_0x1fa4fd[_0xae02('0x4d')]})[_0xae02('0x31')](function(_0x2c2efd){_0x5a4277[_0xae02('0x2b')]=_0x2c2efd;if(_0x2e2a0e[_0xae02('0x42')]['includeAll']){_0x1fa4fd[_0xae02('0xb6')]=[{'all':!![]}];}return db[_0xae02('0xc4')][_0xae02('0xfc')](_0x1fa4fd);})[_0xae02('0x31')](function(_0x44380f){_0x5a4277[_0xae02('0xfd')]=_0x44380f;return _0x5a4277;});}})[_0xae02('0x31')](respondWithFilteredResult(_0x46046b,_0x1fa4fd))[_0xae02('0x3c')](handleError(_0x46046b,null));};exports['getMyMessages']=function(_0x2dcafd,_0x6a3810,_0x4d4ffc){var _0x3f5881={'where':{}},_0x546517={},_0x25fae3={'count':0x0,'rows':[]};return db[_0xae02('0x9a')][_0xae02('0xbd')]({'where':{'id':_0x2dcafd[_0xae02('0xb9')]['id']}})['then'](handleEntityNotFound(_0x6a3810,null))['then'](function(_0x1a265c){if(_0x1a265c){_0x546517[_0xae02('0x41')]=_['keys'](db['ChatMessage'][_0xae02('0x3d')]);_0x546517[_0xae02('0x42')]=_['keys'](_0x2dcafd['query']);_0x546517[_0xae02('0x44')]=_[_0xae02('0xb4')](_0x546517[_0xae02('0x41')],_0x546517['query']);_0x3f5881[_0xae02('0x45')]=_[_0xae02('0xb4')](_0x546517[_0xae02('0x41')],qs[_0xae02('0x46')](_0x2dcafd['query'][_0xae02('0x46')]));_0x3f5881['attributes']=_0x3f5881[_0xae02('0x45')][_0xae02('0x47')]?_0x3f5881['attributes']:_0x546517[_0xae02('0x41')];if(!_0x2dcafd[_0xae02('0x42')][_0xae02('0x48')]('nolimit')){_0x3f5881['limit']=qs[_0xae02('0x4a')](_0x2dcafd[_0xae02('0x42')]['limit']);_0x3f5881['offset']=qs[_0xae02('0x2c')](_0x2dcafd[_0xae02('0x42')][_0xae02('0x2c')]);}_0x3f5881[_0xae02('0x4b')]=qs[_0xae02('0x4c')](_0x2dcafd['query'][_0xae02('0x4c')]);_0x3f5881[_0xae02('0x4d')]=qs['filters'](_['pick'](_0x2dcafd[_0xae02('0x42')],_0x546517[_0xae02('0x44')]));_0x3f5881[_0xae02('0x4d')]['ChatInteractionId']=_0x1a265c['id'];if(_0x2dcafd[_0xae02('0x42')][_0xae02('0x85')]){_0x3f5881[_0xae02('0x4d')]=_[_0xae02('0x99')](_0x3f5881[_0xae02('0x4d')],{'$or':_[_0xae02('0x36')](_0x3f5881[_0xae02('0x45')],function(_0x392885){var _0xfe939={};_0xfe939[_0x392885]={'$like':'%'+_0x2dcafd['query'][_0xae02('0x85')]+'%'};return _0xfe939;})});}_0x3f5881[_0xae02('0x4d')][_0xae02('0xfe')]=![];if(_0x2dcafd[_0xae02('0x42')]['id']){_0x3f5881[_0xae02('0x4d')]['id']={'$gt':_0x2dcafd[_0xae02('0x42')]['id']};}_0x3f5881=_[_0xae02('0x99')]({},_0x3f5881,_0x2dcafd[_0xae02('0xfb')]);return db['ChatMessage']['count']({'where':_0x3f5881['where']})[_0xae02('0x31')](function(_0x2a29dc){_0x25fae3[_0xae02('0x2b')]=_0x2a29dc;_0x3f5881[_0xae02('0xb6')]=[];if(_0x2dcafd[_0xae02('0x42')][_0xae02('0xff')]){_0x3f5881['include'][_0xae02('0x3b')]({'model':db[_0xae02('0x72')],'as':'User','attributes':['id',_0xae02('0x37'),_0xae02('0xe5')]});}if(_0x2dcafd[_0xae02('0x42')][_0xae02('0xb5')]){_0x3f5881[_0xae02('0xb6')]=[{'all':!![]}];}return db[_0xae02('0xc4')][_0xae02('0xfc')](_0x3f5881);})[_0xae02('0x31')](function(_0x51964b){_0x25fae3[_0xae02('0xfd')]=_0x51964b;return _0x25fae3;});}})['then'](respondWithFilteredResult(_0x6a3810,_0x3f5881))[_0xae02('0x3c')](handleError(_0x6a3810,null));};exports[_0xae02('0x100')]=function(_0x1d574b,_0x19c411,_0x42b3cd){return db[_0xae02('0x9a')]['find']({'where':{'id':_0x1d574b[_0xae02('0xb9')]['id']}})[_0xae02('0x31')](handleEntityNotFound(_0x19c411,null))[_0xae02('0x31')](function(_0x2c0295){if(_0x2c0295){return _0x2c0295[_0xae02('0x101')](_0x1d574b['body']['ids'],_['omit'](_0x1d574b[_0xae02('0xb8')],[_0xae02('0xf7'),'id'])||{})[_0xae02('0x102')](function(){return db['Tag'][_0xae02('0xfc')]({'attributes':['id','name','color'],'where':{'id':_0x1d574b[_0xae02('0xb8')][_0xae02('0xf7')]}});})[_0xae02('0x31')](function(_0x49882d){socket[_0xae02('0x103')](_0xae02('0x104'),{'id':Number(_0x1d574b[_0xae02('0xb9')]['id']),'tags':_0x49882d||[]});return{'id':Number(_0x1d574b['params']['id']),'tags':_0x49882d||[]};});}})['then'](respondWithResult(_0x19c411,null))[_0xae02('0x3c')](handleError(_0x19c411,null));};exports[_0xae02('0x105')]=function(_0x460e0c,_0x48914b,_0x10c4d9){return db[_0xae02('0x9a')]['find']({'where':{'id':_0x460e0c['params']['id']}})[_0xae02('0x31')](handleEntityNotFound(_0x48914b,null))['then'](function(_0x7dab61){if(_0x7dab61){return _0x7dab61[_0xae02('0x105')](_0x460e0c[_0xae02('0x42')][_0xae02('0xf7')]);}})['then'](respondWithStatusCode(_0x48914b,null))['catch'](handleError(_0x48914b,null));};exports[_0xae02('0xd4')]=function(_0x33dd95,_0x188f0f){var _0x5b5cde=moment()[_0xae02('0x106')]()[_0xae02('0x97')]();var _0x10f384=path['join'](config['root'],_0xae02('0x107'),_0xae02('0x108'),_0xae02('0x109'));var _0x295f0d=path['join'](config[_0xae02('0xd6')],_0xae02('0x107'),_0xae02('0x108'),_0xae02('0x10a'));var _0x44cca2=path[_0xae02('0xd5')](_0x10f384,_0x5b5cde);var _0x7645ac=util[_0xae02('0xd8')]('transcript-%d-%s.zip',_0x33dd95[_0xae02('0xb9')]['id'],_0x5b5cde);var _0x192ed4=path[_0xae02('0xd5')](_0x10f384,_0x7645ac);var _0x3908c5=[];_0x3908c5[_0xae02('0x3b')]({'model':db[_0xae02('0x72')],'as':_0xae02('0x72'),'attributes':['id',_0xae02('0x37')],'raw':!![]});_0x3908c5[_0xae02('0x3b')]({'model':db[_0xae02('0xdc')],'as':_0xae02('0x10b'),'attributes':['id',_0xae02('0x10c'),_0xae02('0x10d')],'raw':!![]});if(_0x33dd95['query'][_0xae02('0x10a')]){_0x3908c5[_0xae02('0x3b')]({'model':db[_0xae02('0xd0')],'as':_0xae02('0xd0'),'raw':!![]});}var _0x52a89c=[{'model':db[_0xae02('0xc4')],'as':_0xae02('0x10e'),'attributes':['id',_0xae02('0xb8'),_0xae02('0x7b'),_0xae02('0xe9'),_0xae02('0xfe'),_0xae02('0x82')],'include':_0x3908c5}];_0x52a89c[_0xae02('0x3b')]({'model':db[_0xae02('0xdb')],'as':_0xae02('0x10f'),'attributes':['id',_0xae02('0x33')]});_0x52a89c[_0xae02('0x3b')]({'model':db[_0xae02('0x72')],'as':_0xae02('0x110'),'attributes':['id','fullname']});return db[_0xae02('0x9a')][_0xae02('0x66')]({'where':{'id':_0x33dd95[_0xae02('0xb9')]['id']},'include':_0x52a89c})[_0xae02('0x31')](handleEntityNotFound(_0x188f0f,null))['then'](function(_0x54ba29){if(_0x54ba29){var _0xd0c567=_0x54ba29['get']({'plain':!![]});fs[_0xae02('0x111')](_0x44cca2);var _0x114e2b={'format':'A4','border':'10px','header':{'height':_0xae02('0x112'),'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':_0xae02('0x113'),'contents':{'default':util[_0xae02('0xd8')]('\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[_0xae02('0xd8')](_0xae02('0x114'),'Chat',_0xd0c567['id']),moment()[_0xae02('0xd8')](_0xae02('0x115'))[_0xae02('0x97')]())}}};var _0x5a47a5={'channel':_0xae02('0x116'),'account':_0xd0c567[_0xae02('0x10f')][_0xae02('0x33')],'agent':_0xd0c567[_0xae02('0x110')]?_0xd0c567['Owner'][_0xae02('0x37')]:_0xae02('0x117'),'createdAt':moment(_0xd0c567[_0xae02('0x7b')])['format'](_0xae02('0xfa'))['toString'](),'closedAt':_0xd0c567[_0xae02('0xca')]?moment(_0xd0c567['closedAt'])[_0xae02('0xd8')](_0xae02('0xfa'))['toString']():'','disposition':_0xd0c567['disposition'],'chatInfo':{'browser':_0xd0c567[_0xae02('0x118')],'os':_0xd0c567[_0xae02('0x119')],'referer':_0xd0c567[_0xae02('0x11a')],'customerIp':_0xd0c567[_0xae02('0x11b')],'customerPort':_0xd0c567[_0xae02('0x11c')]?_0xd0c567[_0xae02('0x11c')]:_0xae02('0x117')},'messages':_(_0xd0c567[_0xae02('0x10e')])[_0xae02('0x11d')]()['filter']({'secret':![]})[_0xae02('0x36')](function(_0x47e543){if(_0x47e543['Attachment']){var _0x1338c3=path[_0xae02('0xd5')](_0x295f0d,_0x47e543['Attachment'][_0xae02('0xce')]);if(fs['existsSync'](_0x1338c3)){fs[_0xae02('0x11e')](_0x1338c3)[_0xae02('0x11f')](fs[_0xae02('0x120')](path['join'](_0x44cca2,_0x47e543[_0xae02('0xd0')][_0xae02('0xce')])));}}return{'date':moment(_0x47e543[_0xae02('0x7b')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x47e543[_0xae02('0xe9')]===_0xae02('0x121')?_0x47e543[_0xae02('0x72')]?_0x47e543['User']['fullname']:_0xae02('0xe3'):_0x47e543[_0xae02('0x10b')][_0xae02('0x10c')]+(_0x47e543['Contact'][_0xae02('0x10d')]?'\x20'+_0x47e543[_0xae02('0x10b')]['lastName']:''),'body':_0x47e543['Attachment']?_0x47e543[_0xae02('0xd0')]['basename']:_0x47e543[_0xae02('0xb8')],'direction':_0x47e543[_0xae02('0xe9')]===_0xae02('0x121')?'A':'C','secret':_0x47e543[_0xae02('0xfe')],'read':_0x47e543[_0xae02('0x82')],'attachment':_0x47e543[_0xae02('0xd0')]};})[_0xae02('0x67')]()};return ejs['renderFile'](path[_0xae02('0xd5')](config[_0xae02('0xd6')],'server',_0xae02('0x122'),_0xae02('0x123')),{'interaction':_0x5a47a5})['then'](function(_0x4ef68c){return new BPromise(function(_0x520861,_0x195c18){pdf[_0xae02('0xb7')](_0x4ef68c,_0x114e2b)['toFile'](path[_0xae02('0xd5')](_0x44cca2,'transcript-'+_0xd0c567['id']+'-'+_0x5b5cde+'.pdf'),function(_0x4e7a3d,_0x7bde6c){if(_0x4e7a3d)return _0x195c18(_0x4e7a3d);_0x520861(_0x7bde6c);});});})[_0xae02('0x31')](function(){return new BPromise(function(_0x5d0821,_0x52c5ac){zipdir(_0x44cca2,{'saveTo':_0x192ed4},function(_0x26aec9,_0x561cde){if(_0x26aec9)return _0x52c5ac(_0x26aec9);return _0x5d0821(_0x561cde);});})[_0xae02('0x31')](function(){return new BPromise(function(_0x5b5c33,_0x4b6e8b){rimraf(_0x44cca2,function(_0x5446f5){if(_0x5446f5)_0x4b6e8b(_0x5446f5);return _0x5b5c33();});});})[_0xae02('0x31')](function(){return _0x188f0f[_0xae02('0xd4')](_0x192ed4,_0x7645ac,function(_0x3eb5ca){if(_0x3eb5ca){console[_0xae02('0x124')](_0xae02('0x125'),_0x3eb5ca);}else{fs['unlinkSync'](_0x192ed4);}});});});}else{return _0x188f0f[_0xae02('0x27')](0xc8);}})['catch'](handleError(_0x188f0f,null));}; \ No newline at end of file +var _0xaa7c=['join','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','Visitor','agentIdentifier','agentAlias','System','agent_alias','alias','agent_fullname','fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMyMessages','hasOwnProperty','includeAgent','findAll','spread','emit','chatInteractionTags:save','removeTags','download','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','Owner','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','YYYY-MM-DD','Chat','Account','N.A.','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','browserName','osName','referer','tail','existsSync','createReadStream','pipe','Contact','lastName','renderFile','views','downloadInteraction.html','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','TagIds','Tags','split','forEach','push','index','ChatInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','parseSearch','sqlOperator','conditions','length','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\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','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','isEmpty','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','count','keyBy','merge','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','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','params','rawAttributes','includeAll','include','options','create','describe','createVidaooSession','ChatWebsite','findOne','vidaooEscalation','vidaooApiKey','POST','https://api-vidaoo.xcally.com/api/v1/sessions','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','updateAttributes','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','closed','Unauthorized','attachId','root','close','mailTranscript'];(function(_0x4ed2d6,_0x3c7ce8){var _0x2a7198=function(_0x1dcf4a){while(--_0x1dcf4a){_0x4ed2d6['push'](_0x4ed2d6['shift']());}};_0x2a7198(++_0x3c7ce8);}(_0xaa7c,0x18e));var _0xcaa7=function(_0x15c671,_0x531c1d){_0x15c671=_0x15c671-0x0;var _0x2e314d=_0xaa7c[_0x15c671];return _0x2e314d;};'use strict';var pdf=require(_0xcaa7('0x0'));var emlformat=require(_0xcaa7('0x1'));var rimraf=require(_0xcaa7('0x2'));var zipdir=require(_0xcaa7('0x3'));var jsonpatch=require(_0xcaa7('0x4'));var rp=require('request-promise');var moment=require(_0xcaa7('0x5'));var BPromise=require(_0xcaa7('0x6'));var Mustache=require(_0xcaa7('0x7'));var util=require(_0xcaa7('0x8'));var path=require(_0xcaa7('0x9'));var sox=require(_0xcaa7('0xa'));var csv=require('to-csv');var ejs=require(_0xcaa7('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcaa7('0xc'));var crypto=require(_0xcaa7('0xd'));var jsforce=require(_0xcaa7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcaa7('0xf'));var querystring=require(_0xcaa7('0x10'));var Papa=require(_0xcaa7('0x11'));var Redis=require(_0xcaa7('0x12'));var authService=require(_0xcaa7('0x13'));var qs=require(_0xcaa7('0x14'));var as=require(_0xcaa7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcaa7('0x16'))(_0xcaa7('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcaa7('0x18'));var db=require(_0xcaa7('0x19'))['db'];config[_0xcaa7('0x1a')]=_['defaults'](config[_0xcaa7('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInteraction.socket')[_0xcaa7('0x1b')](socket);var jayson=require(_0xcaa7('0x1c'));var client=jayson[_0xcaa7('0x1d')][_0xcaa7('0x1e')]({'port':0x232b});var client9004=jayson[_0xcaa7('0x1d')][_0xcaa7('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x221c68,_0x15d730,_0x4eb035,_0x15b18c){return new BPromise(function(_0x34f082,_0x18777f){var _0x2f69e8=_0x15b18c||client;return _0x2f69e8[_0xcaa7('0x1f')](_0x221c68,_0x4eb035)[_0xcaa7('0x20')](function(_0x520766){logger[_0xcaa7('0x21')](_0xcaa7('0x22'),_0x15d730,_0xcaa7('0x23'));logger[_0xcaa7('0x24')](_0xcaa7('0x25'),_0x15d730,_0xcaa7('0x23'),JSON[_0xcaa7('0x26')](_0x520766));if(_0x520766[_0xcaa7('0x27')]){if(_0x520766['error'][_0xcaa7('0x28')]===0x1f4){logger['error'](_0xcaa7('0x22'),_0x15d730,_0x520766[_0xcaa7('0x27')][_0xcaa7('0x29')]);return _0x18777f(_0x520766[_0xcaa7('0x27')]['message']);}logger[_0xcaa7('0x27')](_0xcaa7('0x22'),_0x15d730,_0x520766[_0xcaa7('0x27')][_0xcaa7('0x29')]);return _0x34f082(_0x520766['error'][_0xcaa7('0x29')]);}else{logger[_0xcaa7('0x21')](_0xcaa7('0x22'),_0x15d730,_0xcaa7('0x23'));_0x34f082(_0x520766[_0xcaa7('0x2a')][_0xcaa7('0x29')]);}})[_0xcaa7('0x2b')](function(_0x438047){logger[_0xcaa7('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x15d730,_0x438047);_0x18777f(_0x438047);});});}function respondWithStatusCode(_0x168385,_0x2c2667){_0x2c2667=_0x2c2667||0xcc;return function(_0x31ccf6){if(_0x31ccf6){return _0x168385[_0xcaa7('0x2c')](_0x2c2667);}return _0x168385[_0xcaa7('0x2d')](_0x2c2667)[_0xcaa7('0x2e')]();};}function respondWithResult(_0x473e74,_0x454ee7){_0x454ee7=_0x454ee7||0xc8;return function(_0x29089){if(_0x29089){return _0x473e74[_0xcaa7('0x2d')](_0x454ee7)[_0xcaa7('0x2f')](_0x29089);}};}function respondWithFilteredResult(_0x56e9c4,_0x17558a){return function(_0x453c4d){if(_0x453c4d){var _0x31be4a=_0x453c4d['count'],_0x523270=_0x17558a[_0xcaa7('0x30')],_0x4daafc=_0x17558a[_0xcaa7('0x30')]+_0x17558a[_0xcaa7('0x31')],_0x117670;if(_0x4daafc>=_0x31be4a){_0x4daafc=_0x31be4a;_0x117670=0xc8;}else{_0x117670=0xce;}_0x56e9c4[_0xcaa7('0x2d')](_0x117670);return _0x56e9c4[_0xcaa7('0x32')](_0xcaa7('0x33'),_0x523270+'-'+_0x4daafc+'/'+_0x31be4a)[_0xcaa7('0x2f')](_0x453c4d);}return null;};}function patchUpdates(_0x435967){return function(_0x35660e){try{jsonpatch[_0xcaa7('0x34')](_0x35660e,_0x435967,!![]);}catch(_0x1d00cf){return BPromise[_0xcaa7('0x35')](_0x1d00cf);}return _0x35660e[_0xcaa7('0x36')]();};}function saveUpdates(_0x6ddb2e,_0x4d819c){return function(_0x58aa65){if(_0x58aa65){return _0x58aa65[_0xcaa7('0x37')](_0x6ddb2e)[_0xcaa7('0x20')](function(_0x5edac0){return _0x5edac0;});}return null;};}function removeEntity(_0x5b5094,_0x48ba13){return function(_0x4b666a){if(_0x4b666a){return _0x4b666a[_0xcaa7('0x38')]()[_0xcaa7('0x20')](function(){_0x5b5094['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x769a4f,_0x4b2bda){return function(_0x45b03e){if(!_0x45b03e){_0x769a4f[_0xcaa7('0x2c')](0x194);}return _0x45b03e;};}function handleError(_0xb32708,_0x358fac){_0x358fac=_0x358fac||0x1f4;return function(_0x4b6c0d){logger['error'](_0x4b6c0d[_0xcaa7('0x39')]);if(_0x4b6c0d[_0xcaa7('0x3a')]){delete _0x4b6c0d[_0xcaa7('0x3a')];}_0xb32708['status'](_0x358fac)[_0xcaa7('0x3b')](_0x4b6c0d);};}function getInteractionUsers(_0x4e431f,_0x2c6373){return new BPromise(function(_0x4eaf8f,_0x5e8265){try{if(_0x2c6373[_0x4e431f['id']]){_0x4e431f['Users']=_[_0xcaa7('0x3c')](_0x2c6373[_0x4e431f['id']],function(_0x6a2bb8){return{'id':_0x6a2bb8['id'],'fullname':_0x6a2bb8['fullname']};});}}catch(_0x45c0b4){_0x5e8265(_0x45c0b4);}_0x4eaf8f(_0x4e431f);});}function getInteractionTags(_0x260522,_0x17fb6a){return new BPromise(function(_0x14b526,_0x4abb6e){try{if(_0x260522[_0xcaa7('0x3d')]){_0x260522[_0xcaa7('0x3e')]=[];_0x260522[_0xcaa7('0x3d')][_0xcaa7('0x3f')](',')[_0xcaa7('0x40')](function(_0x5ae528){_0x260522[_0xcaa7('0x3e')][_0xcaa7('0x41')](_0x17fb6a[_0x5ae528]);});}delete _0x260522['TagIds'];}catch(_0x35b989){_0x4abb6e(_0x35b989);}_0x14b526(_0x260522);});}function updateChatInteraction(_0x4a7ac6,_0x5846ce,_0x43d0a1){return new BPromise(function(_0xada7dc,_0x25395c){return getInteractionUsers(_0x4a7ac6,_0x43d0a1)[_0xcaa7('0x20')](function(_0x470ade){return getInteractionTags(_0x470ade,_0x5846ce);})[_0xcaa7('0x20')](function(_0x105147){_0xada7dc(_0x105147);})[_0xcaa7('0x2b')](function(_0x429e68){_0x25395c(_0x429e68);});});}exports[_0xcaa7('0x42')]=function(_0x5307ea,_0x26625f){var _0x3d4e7d={},_0x18a844={},_0x98beb1={'count':0x0,'rows':[]};var _0x3b527c=_[_0xcaa7('0x3c')](db[_0xcaa7('0x43')]['rawAttributes'],function(_0x4ad0e2){return{'name':_0x4ad0e2[_0xcaa7('0x44')],'type':_0x4ad0e2[_0xcaa7('0x45')][_0xcaa7('0x46')]};});_0x18a844[_0xcaa7('0x47')]=_[_0xcaa7('0x3c')](_0x3b527c,_0xcaa7('0x3a'));_0x18a844[_0xcaa7('0x48')]=_[_0xcaa7('0x49')](_0x5307ea[_0xcaa7('0x48')]);_0x18a844[_0xcaa7('0x4a')]=_[_0xcaa7('0x4b')](_0x18a844[_0xcaa7('0x47')],_0x18a844[_0xcaa7('0x48')]);_0x3d4e7d[_0xcaa7('0x4c')]=_[_0xcaa7('0x4b')](_0x18a844[_0xcaa7('0x47')],qs[_0xcaa7('0x4d')](_0x5307ea['query'][_0xcaa7('0x4d')]));_0x3d4e7d['attributes']=_0x3d4e7d[_0xcaa7('0x4c')]['length']?_0x3d4e7d[_0xcaa7('0x4c')]:_0x18a844[_0xcaa7('0x47')];if(!_0x5307ea[_0xcaa7('0x48')]['hasOwnProperty'](_0xcaa7('0x4e'))){_0x3d4e7d[_0xcaa7('0x31')]=qs[_0xcaa7('0x31')](_0x5307ea['query'][_0xcaa7('0x31')]);_0x3d4e7d[_0xcaa7('0x30')]=qs[_0xcaa7('0x30')](_0x5307ea[_0xcaa7('0x48')][_0xcaa7('0x30')]);}_0x3d4e7d['order']=qs[_0xcaa7('0x4f')](_0x5307ea[_0xcaa7('0x48')]['sort']);_0x3d4e7d[_0xcaa7('0x50')]=qs[_0xcaa7('0x4a')](_[_0xcaa7('0x51')](_0x5307ea[_0xcaa7('0x48')],_0x18a844[_0xcaa7('0x4a')]),_0x3b527c);var _0x407c97=[];var _0x35e95a=squel[_0xcaa7('0x52')]()[_0xcaa7('0x53')]('id')['field']('name')[_0xcaa7('0x53')](_0xcaa7('0x54'))['from'](_0xcaa7('0x55'));var _0x3b2df9=squel['select']()['field'](_0xcaa7('0x56'))[_0xcaa7('0x53')](_0xcaa7('0x57'))[_0xcaa7('0x53')](_0xcaa7('0x58'))[_0xcaa7('0x59')](_0xcaa7('0x5a'),'ui')[_0xcaa7('0x5b')](_0xcaa7('0x5c'),'u',_0xcaa7('0x5d'));var _0x1dc0f8=squel[_0xcaa7('0x52')]()[_0xcaa7('0x59')](_0xcaa7('0x5e'),'i')['left_join'](_0xcaa7('0x5f'),'c',_0xcaa7('0x60'))[_0xcaa7('0x5b')](_0xcaa7('0x5c'),'o',_0xcaa7('0x61'))['left_join'](_0xcaa7('0x62'),'a',_0xcaa7('0x63'))[_0xcaa7('0x5b')](_0xcaa7('0x64'),'me',_0xcaa7('0x65'))[_0xcaa7('0x5b')](_0xcaa7('0x66'),'it',_0xcaa7('0x67'))['left_join'](_0xcaa7('0x55'),'t','t.id\x20=\x20it.TagId');var _0x8590b=squel[_0xcaa7('0x68')]();var _0x12a94b=[];var _0xcb2c20=squel['expr']();var _0x566017;if(_0x5307ea['query']['search']){_0x566017=as[_0xcaa7('0x69')](_0x5307ea['query']['search']);var _0x114ea9=_0x566017[_0xcaa7('0x6a')];for(var _0x48e911=0x0;_0x48e911<_0x566017[_0xcaa7('0x6b')][_0xcaa7('0x6c')];_0x48e911++){var _0x30c542=_0x566017[_0xcaa7('0x6b')][_0x48e911];var _0x3d67a='i';var _0x252fed=_['find'](_0x3b527c,[_0xcaa7('0x3a'),_0x30c542[_0xcaa7('0x53')]]);if(!_0x252fed){switch(_0x30c542['field']){case _0xcaa7('0x6d'):if(_0x30c542[_0xcaa7('0x6e')]==0x1){_0x1dc0f8[_0xcaa7('0x6f')]('`'+_0x30c542[_0xcaa7('0x53')]+_0xcaa7('0x70'));}else{_0x1dc0f8[_0xcaa7('0x6f')]('`'+_0x30c542[_0xcaa7('0x53')]+_0xcaa7('0x71'));}break;case'Contact':if(_0x30c542['operator']==='$substring'){if(_0x30c542[_0xcaa7('0x6e')]['split']('\x20')['length']>0x1){_0x8590b[_0x114ea9](_0xcaa7('0x72'),qs[_0xcaa7('0x73')](_0x30c542[_0xcaa7('0x6e')]),null);}else{var _0x46621e='%'+_0x30c542[_0xcaa7('0x6e')]+'%';_0x8590b[_0x114ea9](_0xcaa7('0x74'),_0x46621e,_0x46621e,_0x46621e);}}else{_0x252fed=_[_0xcaa7('0x75')](_0x3b527c,[_0xcaa7('0x3a'),_0xcaa7('0x76')]);_0x30c542[_0xcaa7('0x53')]=_0xcaa7('0x76');_0x919b9=as['buildExpression'](_0x3d67a,_0x252fed[_0xcaa7('0x45')],_0x30c542);_0x8590b[_0x114ea9](_0x919b9[_0xcaa7('0x77')],_0x919b9[_0xcaa7('0x6e')][_0xcaa7('0x78')],_0x919b9[_0xcaa7('0x6e')]['end']);}break;case _0xcaa7('0x79'):var _0x35771b=_0x30c542[_0xcaa7('0x6e')][_0xcaa7('0x3f')](',')[_0xcaa7('0x3c')](function(_0x5120e5){return Number(_0x5120e5);});_0x35771b[_0xcaa7('0x40')](function(_0x4c3b1e){_0xcb2c20['or'](_0xcaa7('0x7a'),'%,'+_0x4c3b1e+',%');});_0x12a94b=_[_0xcaa7('0x7b')](_0x12a94b,_0x35771b);break;case _0xcaa7('0x7c'):if(_0x30c542[_0xcaa7('0x7d')]===_0xcaa7('0x7e')){_0x8590b[_0x114ea9](_0xcaa7('0x7f'),'%'+_0x30c542[_0xcaa7('0x6e')]+'%',null);}else{_0x252fed=_[_0xcaa7('0x75')](_0x3b527c,[_0xcaa7('0x3a'),_0xcaa7('0x80')]);_0x30c542[_0xcaa7('0x53')]=_0xcaa7('0x80');_0x919b9=as[_0xcaa7('0x81')](_0x3d67a,_0x252fed['type'],_0x30c542);_0x8590b[_0x114ea9](_0x919b9[_0xcaa7('0x77')],_0x919b9[_0xcaa7('0x6e')][_0xcaa7('0x78')],_0x919b9[_0xcaa7('0x6e')][_0xcaa7('0x2e')]);}break;case _0xcaa7('0x82'):_0x919b9=as['buildExpression']('me',null,_0x30c542);_0x8590b[_0x114ea9](_0x919b9['text'],_0x919b9['value'][_0xcaa7('0x78')],_0x919b9[_0xcaa7('0x6e')][_0xcaa7('0x2e')]);break;}}else{var _0x919b9=as[_0xcaa7('0x81')](_0x3d67a,_0x252fed[_0xcaa7('0x45')],_0x30c542);_0x8590b[_0x114ea9](_0x919b9[_0xcaa7('0x77')],_0x919b9[_0xcaa7('0x6e')][_0xcaa7('0x78')],_0x919b9[_0xcaa7('0x6e')]['end']);}}}else{var _0x23f65c=_(_0x5307ea[_0xcaa7('0x48')])['keys']()['map'](function(_0x4c44b3){return _['some'](_0x3b527c,[_0xcaa7('0x3a'),_0x4c44b3])?_0x4c44b3:undefined;})[_0xcaa7('0x83')]()['value']();if(!_['isEmpty'](_0x23f65c)){_0x23f65c[_0xcaa7('0x40')](function(_0x4ba481){if(_0x4ba481===_0xcaa7('0x84')){_0x1dc0f8['where'](_0xcaa7('0x85'),[]['concat'](_0x5307ea[_0xcaa7('0x48')][_0x4ba481]));}else if(_0x4ba481===_0xcaa7('0x86')){var _0x599c62=JSON[_0xcaa7('0x87')](_0x5307ea[_0xcaa7('0x48')][_0x4ba481])[_0xcaa7('0x88')];var _0x4a839d=JSON[_0xcaa7('0x87')](_0x5307ea['query'][_0x4ba481])[_0xcaa7('0x89')];_0x1dc0f8[_0xcaa7('0x50')](_0xcaa7('0x8a'),_0x599c62,_0x4a839d);}else{if(_0x5307ea[_0xcaa7('0x48')][_0x4ba481]===_0xcaa7('0x8b')){_0x1dc0f8[_0xcaa7('0x50')]('i.'+_0x4ba481+_0xcaa7('0x8c'));}else{_0x1dc0f8[_0xcaa7('0x50')]('i.'+_0x4ba481+_0xcaa7('0x8d'),_0x5307ea[_0xcaa7('0x48')][_0x4ba481]);}}});}if(_0x5307ea['query']['read']){if(_0x5307ea[_0xcaa7('0x48')][_0xcaa7('0x8e')]==0x1){_0x1dc0f8['having'](_0xcaa7('0x8f'));}else{_0x1dc0f8[_0xcaa7('0x6f')](_0xcaa7('0x90'));}}if(_0x5307ea[_0xcaa7('0x48')][_0xcaa7('0x91')]){_0x12a94b=_[_0xcaa7('0x92')](_0x5307ea[_0xcaa7('0x48')][_0xcaa7('0x91')])?_0x5307ea[_0xcaa7('0x48')][_0xcaa7('0x91')]:new Array(_0x5307ea[_0xcaa7('0x48')][_0xcaa7('0x91')]);_0x12a94b[_0xcaa7('0x40')](function(_0x449cd4){_0xcb2c20['or'](_0xcaa7('0x7a'),'%,'+_0x449cd4+',%');});}if(_0x5307ea['query'][_0xcaa7('0x93')]){var _0x4955a0=_0x5307ea[_0xcaa7('0x48')][_0xcaa7('0x93')][_0xcaa7('0x94')]('\x5c','\x5c\x5c')[_0xcaa7('0x94')](/'/g,'\x27\x27');if(qs[_0xcaa7('0x95')](_0x4955a0)){_0x8590b['or'](_0xcaa7('0x96'),_0x4955a0+'%');}else{_0x8590b['or'](_0xcaa7('0x97'),qs['getFullTextValue'](_0x4955a0))['or'](_0xcaa7('0x98'),_0x4955a0+'%');}}}_0x1dc0f8[_0xcaa7('0x50')](_0x8590b);_0x1dc0f8['group'](_0xcaa7('0x99'));var _0x587525={'type':db[_0xcaa7('0x9a')][_0xcaa7('0x9b')]['SELECT'],'raw':!![]};var _0x53c72f=_0x1dc0f8['clone']();_0x53c72f[_0xcaa7('0x53')]('i.id');_0x53c72f['field'](_0xcaa7('0x9c'),_0xcaa7('0x6d'));if(_0x3d4e7d[_0xcaa7('0x9d')]){_0x3d4e7d['order'][_0xcaa7('0x40')](function(_0x32b5a0){var _0x474c4a=_0x32b5a0[0x0]===_0xcaa7('0x9e')?_0x32b5a0[0x0]:'i.'+_0x32b5a0[0x0];_0x1dc0f8['order'](_0x474c4a,_0x32b5a0[0x1]==='DESC'?![]:!![]);});}if(!_[_0xcaa7('0x9f')](_0x12a94b)){_0x1dc0f8[_0xcaa7('0x6f')](_0xcb2c20);_0x53c72f[_0xcaa7('0x50')](_0xcaa7('0xa0'),_0x12a94b);}BPromise['resolve']()[_0xcaa7('0x20')](function(){if(!_0x566017){if(_0x5307ea[_0xcaa7('0x48')][_0xcaa7('0x84')]||_0x5307ea[_0xcaa7('0x48')]['journey'])return;_0x53c72f['where'](_0xcaa7('0xa1'));_0x1dc0f8[_0xcaa7('0x50')](_0xcaa7('0xa1'));return;}if(_0x5307ea[_0xcaa7('0xa2')]['role']!==_0xcaa7('0xa3'))return;return _0x5307ea['user'][_0xcaa7('0xa4')]({'attributes':['id'],'raw':!![]})[_0xcaa7('0x20')](function(_0x4f0b07){if(_[_0xcaa7('0x9f')](_0x4f0b07)){_0x53c72f[_0xcaa7('0x50')](_0xcaa7('0xa5'));_0x1dc0f8['where'](_0xcaa7('0xa5'));}else{_0x53c72f['where'](_0xcaa7('0x85'),_[_0xcaa7('0x3c')](_0x4f0b07,'id'));_0x1dc0f8['where'](_0xcaa7('0x85'),_[_0xcaa7('0x3c')](_0x4f0b07,'id'));}});})['then'](function(){if(_0x5307ea[_0xcaa7('0xa2')][_0xcaa7('0xa6')]===_0xcaa7('0xa3')&&!_0x566017&&!_0x5307ea[_0xcaa7('0x48')][_0xcaa7('0x84')])return[];return db[_0xcaa7('0xa7')][_0xcaa7('0x48')](_0x53c72f[_0xcaa7('0xa8')](),_0x587525);})['then'](function(_0x299eb3){_0x98beb1[_0xcaa7('0xa9')]=_0x299eb3[_0xcaa7('0x6c')];if(_0x98beb1[_0xcaa7('0xa9')]===0x0)return[];return db['sequelize'][_0xcaa7('0x48')](_0x35e95a[_0xcaa7('0xa8')](),_0x587525)[_0xcaa7('0x20')](function(_0x5979a9){_0x407c97=_[_0xcaa7('0xaa')](_0x5979a9,'id');_0x587525=_[_0xcaa7('0xab')](_0x587525,{'model':db[_0xcaa7('0x43')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5307ea[_0xcaa7('0x48')]['fields']){_0x3d4e7d[_0xcaa7('0x4c')][_0xcaa7('0x40')](function(_0x25262f){_0x1dc0f8[_0xcaa7('0x53')]('i.'+_0x25262f);});}else{_0x1dc0f8['field'](_0xcaa7('0x9c'),_0xcaa7('0x6d'));_0x1dc0f8[_0xcaa7('0x53')](_0xcaa7('0xac'),_0xcaa7('0xad'));_0x1dc0f8[_0xcaa7('0x53')](_0xcaa7('0xae'),'Account.mandatoryDisposition');_0x1dc0f8['field'](_0xcaa7('0xaf'),_0xcaa7('0x9e'));_0x1dc0f8['field'](_0xcaa7('0xb0'));_0x1dc0f8[_0xcaa7('0x53')](_0xcaa7('0xb1'),'Contact.firstName');_0x1dc0f8[_0xcaa7('0x53')](_0xcaa7('0xb2'),_0xcaa7('0xb3'));_0x1dc0f8[_0xcaa7('0x53')](_0xcaa7('0xb4'),_0xcaa7('0xb5'));_0x1dc0f8[_0xcaa7('0x53')](_0xcaa7('0xb6'),_0xcaa7('0xb7'));_0x1dc0f8[_0xcaa7('0x53')](_0xcaa7('0xb8'),_0xcaa7('0xb9'));_0x1dc0f8[_0xcaa7('0x53')](_0xcaa7('0xba'),_0xcaa7('0xbb'));_0x1dc0f8[_0xcaa7('0x53')](_0xcaa7('0xbc'),_0xcaa7('0xbd'));_0x1dc0f8['field'](_0xcaa7('0xbe'),'Owner.internal');_0x1dc0f8[_0xcaa7('0x53')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xcaa7('0x3d'));}if(_0x3d4e7d[_0xcaa7('0x31')])_0x1dc0f8[_0xcaa7('0x31')](_0x3d4e7d['limit']);if(_0x3d4e7d[_0xcaa7('0x30')])_0x1dc0f8[_0xcaa7('0x30')](_0x3d4e7d['offset']);return db[_0xcaa7('0xa7')][_0xcaa7('0x48')](_0x1dc0f8[_0xcaa7('0xa8')](),_0x587525);})[_0xcaa7('0x20')](function(_0x42d8ca){_0x3b2df9[_0xcaa7('0x50')](_0xcaa7('0xbf'),_[_0xcaa7('0x3c')](_0x42d8ca,'id'));return db[_0xcaa7('0xa7')][_0xcaa7('0x48')](_0x3b2df9['toString'](),_0x587525)[_0xcaa7('0x20')](function(_0x2ad108){var _0x3b204a=_['groupBy'](_0x2ad108,_0xcaa7('0xc0'));var _0x5c3394=[];_0x42d8ca['forEach'](function(_0x537b76){_0x5c3394[_0xcaa7('0x41')](updateChatInteraction(_0x537b76,_0x407c97,_0x3b204a));});return BPromise[_0xcaa7('0xc1')](_0x5c3394);});});})[_0xcaa7('0x20')](function(_0x3e4c78){_0x98beb1[_0xcaa7('0xc2')]=_0x3e4c78;return _0x98beb1;})[_0xcaa7('0x20')](respondWithFilteredResult(_0x26625f,_0x3d4e7d))['catch'](handleError(_0x26625f,null));};exports['show']=function(_0x2d9e18,_0x7f2fe6){var _0x26a871={'raw':![],'where':{'id':_0x2d9e18[_0xcaa7('0xc3')]['id']}},_0x5dfa3e={};_0x5dfa3e[_0xcaa7('0x47')]=_[_0xcaa7('0x49')](db['ChatInteraction'][_0xcaa7('0xc4')]);_0x5dfa3e[_0xcaa7('0x48')]=_[_0xcaa7('0x49')](_0x2d9e18['query']);_0x5dfa3e[_0xcaa7('0x4a')]=_[_0xcaa7('0x4b')](_0x5dfa3e[_0xcaa7('0x47')],_0x5dfa3e[_0xcaa7('0x48')]);_0x26a871[_0xcaa7('0x4c')]=_[_0xcaa7('0x4b')](_0x5dfa3e[_0xcaa7('0x47')],qs['fields'](_0x2d9e18[_0xcaa7('0x48')][_0xcaa7('0x4d')]));_0x26a871[_0xcaa7('0x4c')]=_0x26a871[_0xcaa7('0x4c')]['length']?_0x26a871[_0xcaa7('0x4c')]:_0x5dfa3e['model'];if(_0x2d9e18['query'][_0xcaa7('0xc5')]){_0x26a871[_0xcaa7('0xc6')]=[{'all':!![]}];}_0x26a871=_[_0xcaa7('0xab')]({},_0x26a871,_0x2d9e18[_0xcaa7('0xc7')]);return db[_0xcaa7('0x43')][_0xcaa7('0x75')](_0x26a871)['then'](handleEntityNotFound(_0x7f2fe6,null))[_0xcaa7('0x20')](respondWithResult(_0x7f2fe6,null))[_0xcaa7('0x2b')](handleError(_0x7f2fe6,null));};exports[_0xcaa7('0xc8')]=function(_0x3c87a6,_0x5b8daa){return db[_0xcaa7('0x43')]['create'](_0x3c87a6[_0xcaa7('0x82')],{})['then'](respondWithResult(_0x5b8daa,0xc9))[_0xcaa7('0x2b')](handleError(_0x5b8daa,null));};exports['update']=function(_0x256a81,_0x478610){if(_0x256a81[_0xcaa7('0x82')]['id']){delete _0x256a81[_0xcaa7('0x82')]['id'];}return db[_0xcaa7('0x43')][_0xcaa7('0x75')]({'where':{'id':_0x256a81['params']['id']}})[_0xcaa7('0x20')](handleEntityNotFound(_0x478610,null))['then'](saveUpdates(_0x256a81[_0xcaa7('0x82')],null))[_0xcaa7('0x20')](respondWithResult(_0x478610,null))['catch'](handleError(_0x478610,null));};exports['destroy']=function(_0x1755ea,_0x20293e){return db[_0xcaa7('0x43')][_0xcaa7('0x75')]({'where':{'id':_0x1755ea[_0xcaa7('0xc3')]['id']}})[_0xcaa7('0x20')](handleEntityNotFound(_0x20293e,null))[_0xcaa7('0x20')](removeEntity(_0x20293e,null))[_0xcaa7('0x2b')](handleError(_0x20293e,null));};exports['describe']=function(_0x510172,_0x363089){return db['ChatInteraction'][_0xcaa7('0xc9')]()[_0xcaa7('0x20')](respondWithResult(_0x363089,null))[_0xcaa7('0x2b')](handleError(_0x363089,null));};exports[_0xcaa7('0xca')]=function(_0x343de0,_0x4eae50){var _0x307f21=_0x343de0[_0xcaa7('0xc3')]['id'];var _0x1fde73;var _0xf15c75;var _0x3e8059;return db[_0xcaa7('0x43')]['findOne']({'where':{'id':_0x307f21}})[_0xcaa7('0x20')](function(_0x23f72d){_0x1fde73=_0x23f72d;return db[_0xcaa7('0xcb')][_0xcaa7('0xcc')]({'where':{'id':_0x23f72d['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0xcaa7('0xcd')],'raw':!![]});})['then'](function(_0x470bd6){if(_0x470bd6&&_0x470bd6[_0xcaa7('0xce')]&&_0x470bd6[_0xcaa7('0xcd')]){_0xf15c75=_0x470bd6;var _0x13c6b4={'rejectUnauthorized':![],'method':_0xcaa7('0xcf'),'uri':_0xcaa7('0xd0'),'headers':{'X-APIKEY':_0x470bd6[_0xcaa7('0xce')]},'body':{'name':'MotionCWB:'+_0x307f21},'redirect':_0xcaa7('0xd1'),'json':!![]};return rp(_0x13c6b4);}else{throw new db[(_0xcaa7('0x9a'))][(_0xcaa7('0xd2'))](_0xcaa7('0xd3'));}})[_0xcaa7('0x20')](function(_0x25bc27){_0x3e8059=_0x25bc27;if(_0x3e8059['id']){var _0x4a2c77={'body':_0x3e8059['join_url'],'ChatWebsiteId':_0xf15c75['id'],'ChatInteractionId':_0x1fde73['id'],'direction':_0xcaa7('0xd4'),'UserId':_0x343de0[_0xcaa7('0xa2')]['id']};return db[_0xcaa7('0xd5')][_0xcaa7('0xc8')](_0x4a2c77,{});}else{throw new db[(_0xcaa7('0x9a'))]['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xcaa7('0x20')](function(){return _0x1fde73[_0xcaa7('0xd6')]({'vidaooSessionId':_0x3e8059['id']});})['then'](respondWithResult(_0x4eae50,null))[_0xcaa7('0x2b')](handleError(_0x4eae50,null));};exports['customUpdate']=function(_0x103d7a,_0x7d66a3){if(_0x103d7a[_0xcaa7('0x82')]['id']){delete _0x103d7a[_0xcaa7('0x82')]['id'];}return db[_0xcaa7('0x43')]['find']({'where':{'id':_0x103d7a['params']['id']}})['then'](handleEntityNotFound(_0x7d66a3,null))[_0xcaa7('0x20')](saveUpdates(_0x103d7a[_0xcaa7('0x82')],null))[_0xcaa7('0x20')](respondWithResult(_0x7d66a3,null))['catch'](handleError(_0x7d66a3,null));};exports['abandon']=function(_0x2521e6,_0x375dcb,_0x13507b){if(_0x2521e6['body']['id']){delete _0x2521e6[_0xcaa7('0x82')]['id'];}return db[_0xcaa7('0x43')][_0xcaa7('0x75')]({'where':{'id':_0x2521e6[_0xcaa7('0xc3')]['id']}})['then'](function(_0x113474){if(!_0x113474){logger['error'](_0xcaa7('0xd7'),_0xcaa7('0xd8'),0x194,_0xcaa7('0xd9'));_0x375dcb[_0xcaa7('0x2c')](0x194);}else{if(_0x113474[_0xcaa7('0x80')]){throw new db[(_0xcaa7('0x9a'))][(_0xcaa7('0xd2'))](_0xcaa7('0xda'));}}return _0x113474;})[_0xcaa7('0x20')](function(_0x8a07ac){if(_0x8a07ac){return _0x8a07ac[_0xcaa7('0x37')]({'closed':_0x2521e6['body']['closed'],'disposition':_0x2521e6[_0xcaa7('0x82')]['disposition']})[_0xcaa7('0x20')](function(_0x18a8c8){return _0x18a8c8;});}})['then'](function(_0x49261b){return respondWithRpcPromise('AbandonInteraction',_0xcaa7('0xd8'),_0x2521e6[_0xcaa7('0x82')],client9004);})[_0xcaa7('0x20')](respondWithResult(_0x375dcb,null))[_0xcaa7('0x2b')](handleError(_0x375dcb,null));};exports[_0xcaa7('0xdb')]=function(_0x5050b2,_0x2ea384,_0x3ed730){_0x5050b2['body']['name']=_0x5050b2[_0xcaa7('0xdc')][_0xcaa7('0xdd')];_0x5050b2[_0xcaa7('0x82')][_0xcaa7('0xde')]=_0x5050b2[_0xcaa7('0xdc')][_0xcaa7('0xdf')];_0x5050b2['body'][_0xcaa7('0x45')]=_0x5050b2[_0xcaa7('0xdc')][_0xcaa7('0xe0')];return db[_0xcaa7('0xe1')][_0xcaa7('0xc8')](_0x5050b2[_0xcaa7('0x82')])['then'](respondWithResult(_0x2ea384,0xc9))[_0xcaa7('0x2b')](handleError(_0x2ea384,null));};exports['attachmentDownload']=function(_0x1244a8,_0x25edce,_0x501cdd){return db[_0xcaa7('0x43')][_0xcaa7('0xcc')]({'where':{'id':_0x1244a8[_0xcaa7('0xc3')]['id']},'raw':!![]})[_0xcaa7('0x20')](handleEntityNotFound(_0x25edce,null))[_0xcaa7('0x20')](function(_0x589e6e){if(_0x589e6e){if(_0x589e6e[_0xcaa7('0xe2')]){return _0x25edce['status'](0x193)[_0xcaa7('0x2f')]({'status':0x193,'message':_0xcaa7('0xe3')});}return db[_0xcaa7('0xe1')][_0xcaa7('0xcc')]({'where':{'id':_0x1244a8[_0xcaa7('0x48')][_0xcaa7('0xe4')]},'raw':!![]})[_0xcaa7('0x20')](handleEntityNotFound(_0x25edce,null));}})[_0xcaa7('0x20')](function(_0x4db065){if(_0x4db065){return _0x25edce['download'](path['join'](config[_0xcaa7('0xe5')],'server/files/attachments/',_0x4db065[_0xcaa7('0xde')]));}})['catch'](handleError(_0x25edce,null));};exports[_0xcaa7('0xe6')]=function(_0x9ff6a8,_0x1d2bdf){var _0x3bb7b8=null;var _0x4c3470=null;var _0x4926e6=null;var _0x3dbf9c=null;if(_0x9ff6a8[_0xcaa7('0x82')]['id']){delete _0x9ff6a8[_0xcaa7('0x82')]['id'];}if(_0x9ff6a8[_0xcaa7('0x82')][_0xcaa7('0xe7')]){_0x3dbf9c=path[_0xcaa7('0xe8')](config[_0xcaa7('0xe5')],_0xcaa7('0xe9'),util[_0xcaa7('0xea')](_0xcaa7('0xeb'),Date[_0xcaa7('0xec')]()));_0x9ff6a8[_0xcaa7('0x82')][_0xcaa7('0xed')]=_0x3dbf9c;}return db['ChatInteraction'][_0xcaa7('0x75')]({'where':{'id':_0x9ff6a8[_0xcaa7('0xc3')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xcaa7('0xee'),'include':[{'model':db['User'],'as':'User'}]}]})['then'](handleEntityNotFound(_0x1d2bdf,null))[_0xcaa7('0x20')](saveUpdates(_0x9ff6a8[_0xcaa7('0x82')],null))[_0xcaa7('0x20')](function(_0x3d320a){if(_0x3d320a){_0x3bb7b8=_0x3d320a;return db[_0xcaa7('0xcb')]['find']({'where':{'id':_0x3bb7b8[_0xcaa7('0x84')]}});}})[_0xcaa7('0x20')](function(_0x597698){if(_0x597698){_0x4926e6=_0x597698;return db['CmContact'][_0xcaa7('0x75')]({'where':{'id':_0x3bb7b8['ContactId']}});}})[_0xcaa7('0x20')](function(_0x1063ac){if(_0x1063ac){_0x4c3470=_0x1063ac;if(_0x3dbf9c){var _0x29e240=null;for(var _0x48eff5=0x1;_0x48eff5<_0x3bb7b8[_0xcaa7('0xee')][_0xcaa7('0x6c')];++_0x48eff5){_0x29e240=_0x3bb7b8[_0xcaa7('0xee')][_0x48eff5];var _0x5efc60=_0x29e240['UserId']?util[_0xcaa7('0xea')]('%s%d',_0x4926e6['agentAlias'],_0x29e240['UserId']):'System';var _0x1080ef=_0x9ff6a8['body']['customer']||util['format'](_0xcaa7('0xef'),_0xcaa7('0xf0'),_0x29e240[_0xcaa7('0x76')]);switch(_0x4926e6[_0xcaa7('0xf1')]){case'website_alias':_0x5efc60=_0x29e240[_0xcaa7('0x80')]?util[_0xcaa7('0xea')]('%s%d',_0x4926e6[_0xcaa7('0xf2')],_0x29e240[_0xcaa7('0x80')]):_0xcaa7('0xf3');break;case _0xcaa7('0xf4'):_0x5efc60=_0x29e240[_0xcaa7('0x80')]?_0x29e240['User'][_0xcaa7('0xf5')]||_0x29e240[_0xcaa7('0x7c')]['fullname']:_0xcaa7('0xf3');break;case _0xcaa7('0xf6'):_0x5efc60=_0x29e240[_0xcaa7('0x80')]?_0x29e240[_0xcaa7('0x7c')][_0xcaa7('0xf7')]:_0xcaa7('0xf3');break;default:_0x5efc60=_0x29e240[_0xcaa7('0x80')]?util[_0xcaa7('0xea')](_0xcaa7('0xef'),_0x4926e6[_0xcaa7('0xf2')],_0x29e240[_0xcaa7('0x80')]):_0xcaa7('0xf3');}var _0x49beff=util['format'](_0xcaa7('0xf8'),moment(_0x29e240['createdAt'])[_0xcaa7('0xea')](_0xcaa7('0xf9')),_0x29e240[_0xcaa7('0xfa')]==='in'?_0x1080ef:_0x5efc60,_0x29e240[_0xcaa7('0x82')]);if(!_0x29e240[_0xcaa7('0xfb')]){fs['appendFileSync'](_0x3dbf9c,_0x49beff);}}return db[_0xcaa7('0xfc')][_0xcaa7('0xcc')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xcaa7('0xfd'),'raw':!![]}]});}}})['then'](function(_0x21e924){if(_0x21e924&&_0x21e924[_0xcaa7('0xfd')]&&_0x9ff6a8['body']){var _0xfb3362={'tls':{'rejectUnauthorized':![]}};if(_0x21e924[_0xcaa7('0xfd')][_0xcaa7('0xfe')]){_0xfb3362[_0xcaa7('0xfe')]=_0x21e924['Smtp'][_0xcaa7('0xfe')];}else{_0xfb3362[_0xcaa7('0xff')]=_0x21e924[_0xcaa7('0xfd')][_0xcaa7('0xff')];_0xfb3362[_0xcaa7('0x100')]=_0x21e924[_0xcaa7('0xfd')][_0xcaa7('0x100')];_0xfb3362['secure']=_0x21e924['Smtp'][_0xcaa7('0x101')];}if(_0x21e924['Smtp'][_0xcaa7('0x102')]){_0xfb3362[_0xcaa7('0x103')]={'user':_0x21e924[_0xcaa7('0xfd')][_0xcaa7('0xa2')],'pass':_0x21e924['Smtp'][_0xcaa7('0x104')]};}return respondWithRpcPromise(_0xcaa7('0x105'),_0xcaa7('0x106'),{'account':_0xfb3362,'message':{'from':util[_0xcaa7('0xea')](_0xcaa7('0x107'),_0x21e924[_0xcaa7('0x3a')],_0x21e924[_0xcaa7('0x108')]||_0x21e924['Smtp'][_0xcaa7('0xa2')]),'to':_0x9ff6a8['body'][_0xcaa7('0xe7')],'subject':_0xcaa7('0x109'),'text':util[_0xcaa7('0xea')](_0xcaa7('0x10a'),_0x9ff6a8[_0xcaa7('0x82')][_0xcaa7('0xe7')]),'attachments':[{'path':_0x3dbf9c}]}})[_0xcaa7('0x20')](function(){return _0x3bb7b8;})[_0xcaa7('0x2b')](function(_0x5240a3){console[_0xcaa7('0x27')](_0x5240a3);});}else{return _0x3bb7b8;}})[_0xcaa7('0x20')](respondWithStatusCode(_0x1d2bdf,0xc8))[_0xcaa7('0x2b')](handleError(_0x1d2bdf,null));};exports[_0xcaa7('0x10b')]=function(_0x3d1a55,_0x47de25,_0xd69ce5){return db[_0xcaa7('0xd5')][_0xcaa7('0x75')]({'where':{'id':_0x3d1a55['params']['id']}})[_0xcaa7('0x20')](handleEntityNotFound(_0x47de25,null))[_0xcaa7('0x20')](function(_0x4b6666){if(_0x4b6666){return _0x4b6666[_0xcaa7('0x10b')](_0x3d1a55[_0xcaa7('0x82')][_0xcaa7('0x10c')],_[_0xcaa7('0x10d')](_0x3d1a55[_0xcaa7('0x82')],[_0xcaa7('0x10c'),'id'])||{});}})[_0xcaa7('0x20')](respondWithResult(_0x47de25,null))['catch'](handleError(_0x47de25,null));};exports['getMessages']=function(_0x2faee1,_0x2da7be,_0x1665e3){var _0x6452aa={'raw':![],'where':{}};var _0x13e945={};var _0x57be27={'count':0x0,'rows':[]};return db[_0xcaa7('0x43')]['findOne']({'where':{'id':_0x2faee1[_0xcaa7('0xc3')]['id']}})[_0xcaa7('0x20')](handleEntityNotFound(_0x2da7be,null))['then'](function(_0x466294){if(_0x466294){_0x13e945[_0xcaa7('0x47')]=_['keys'](db[_0xcaa7('0xd5')][_0xcaa7('0xc4')]);_0x13e945[_0xcaa7('0x48')]=_[_0xcaa7('0x49')](_0x2faee1[_0xcaa7('0x48')]);_0x13e945[_0xcaa7('0x4a')]=_[_0xcaa7('0x4b')](_0x13e945[_0xcaa7('0x47')],_0x13e945[_0xcaa7('0x48')]);_0x6452aa[_0xcaa7('0x4c')]=_[_0xcaa7('0x4b')](_0x13e945['model'],qs[_0xcaa7('0x4d')](_0x2faee1[_0xcaa7('0x48')][_0xcaa7('0x4d')]));_0x6452aa[_0xcaa7('0x4c')]=_0x6452aa[_0xcaa7('0x4c')][_0xcaa7('0x6c')]?_0x6452aa[_0xcaa7('0x4c')]:_0x13e945[_0xcaa7('0x47')];if(!_0x2faee1['query']['hasOwnProperty'](_0xcaa7('0x4e'))){_0x6452aa[_0xcaa7('0x31')]=qs[_0xcaa7('0x31')](_0x2faee1[_0xcaa7('0x48')][_0xcaa7('0x31')]);_0x6452aa[_0xcaa7('0x30')]=qs[_0xcaa7('0x30')](_0x2faee1[_0xcaa7('0x48')][_0xcaa7('0x30')]);}_0x6452aa[_0xcaa7('0x9d')]=qs[_0xcaa7('0x4f')](_0x2faee1[_0xcaa7('0x48')]['sort']);_0x6452aa[_0xcaa7('0x50')]=qs[_0xcaa7('0x4a')](_[_0xcaa7('0x51')](_0x2faee1[_0xcaa7('0x48')],_0x13e945[_0xcaa7('0x4a')]));_0x6452aa[_0xcaa7('0x50')][_0xcaa7('0xc0')]=_0x466294['id'];if(_0x2faee1[_0xcaa7('0x48')][_0xcaa7('0x93')]){_0x6452aa['where']=_[_0xcaa7('0xab')](_0x6452aa[_0xcaa7('0x50')],{'$or':_[_0xcaa7('0x3c')](_0x6452aa[_0xcaa7('0x4c')],function(_0x79cf8a){var _0x26aeb7={};_0x26aeb7[_0x79cf8a]={'$like':'%'+_0x2faee1[_0xcaa7('0x48')]['filter']+'%'};return _0x26aeb7;})});}if(_0x2faee1[_0xcaa7('0x48')][_0xcaa7('0x88')]){var _0xcceac4=_0x2faee1[_0xcaa7('0x48')][_0xcaa7('0x88')][_0xcaa7('0x3f')](',');var _0x504e23={};_0x504e23[_0xcceac4[0x0]]={'$gte':moment(_0xcceac4[0x1])[_0xcaa7('0xea')]('YYYY-MM-DD\x20HH:mm:ss')};_0x6452aa[_0xcaa7('0x50')]=_[_0xcaa7('0xab')](_0x6452aa['where'],_0x504e23);}_0x6452aa=_['merge']({},_0x6452aa,_0x2faee1['options']);return db['ChatMessage'][_0xcaa7('0xa9')]({'where':_0x6452aa[_0xcaa7('0x50')]})[_0xcaa7('0x20')](function(_0xc6657){_0x57be27[_0xcaa7('0xa9')]=_0xc6657;if(_0x2faee1[_0xcaa7('0x48')][_0xcaa7('0xc5')]){_0x6452aa[_0xcaa7('0xc6')]=[{'all':!![]}];}return db[_0xcaa7('0xd5')]['findAll'](_0x6452aa);})[_0xcaa7('0x20')](function(_0x23901b){_0x57be27[_0xcaa7('0xc2')]=_0x23901b;return _0x57be27;});}})[_0xcaa7('0x20')](respondWithFilteredResult(_0x2da7be,_0x6452aa))['catch'](handleError(_0x2da7be,null));};exports[_0xcaa7('0x10e')]=function(_0x306a34,_0x3e7062,_0x3ebece){var _0x180123={'where':{}},_0x51d06e={},_0x536dbf={'count':0x0,'rows':[]};return db[_0xcaa7('0x43')][_0xcaa7('0xcc')]({'where':{'id':_0x306a34[_0xcaa7('0xc3')]['id']}})[_0xcaa7('0x20')](handleEntityNotFound(_0x3e7062,null))[_0xcaa7('0x20')](function(_0x38722c){if(_0x38722c){_0x51d06e[_0xcaa7('0x47')]=_[_0xcaa7('0x49')](db[_0xcaa7('0xd5')]['rawAttributes']);_0x51d06e['query']=_[_0xcaa7('0x49')](_0x306a34[_0xcaa7('0x48')]);_0x51d06e[_0xcaa7('0x4a')]=_[_0xcaa7('0x4b')](_0x51d06e['model'],_0x51d06e[_0xcaa7('0x48')]);_0x180123[_0xcaa7('0x4c')]=_['intersection'](_0x51d06e[_0xcaa7('0x47')],qs[_0xcaa7('0x4d')](_0x306a34[_0xcaa7('0x48')][_0xcaa7('0x4d')]));_0x180123[_0xcaa7('0x4c')]=_0x180123['attributes'][_0xcaa7('0x6c')]?_0x180123[_0xcaa7('0x4c')]:_0x51d06e['model'];if(!_0x306a34[_0xcaa7('0x48')][_0xcaa7('0x10f')](_0xcaa7('0x4e'))){_0x180123[_0xcaa7('0x31')]=qs['limit'](_0x306a34[_0xcaa7('0x48')][_0xcaa7('0x31')]);_0x180123[_0xcaa7('0x30')]=qs[_0xcaa7('0x30')](_0x306a34[_0xcaa7('0x48')][_0xcaa7('0x30')]);}_0x180123['order']=qs[_0xcaa7('0x4f')](_0x306a34[_0xcaa7('0x48')][_0xcaa7('0x4f')]);_0x180123[_0xcaa7('0x50')]=qs[_0xcaa7('0x4a')](_[_0xcaa7('0x51')](_0x306a34['query'],_0x51d06e[_0xcaa7('0x4a')]));_0x180123[_0xcaa7('0x50')]['ChatInteractionId']=_0x38722c['id'];if(_0x306a34[_0xcaa7('0x48')][_0xcaa7('0x93')]){_0x180123[_0xcaa7('0x50')]=_['merge'](_0x180123['where'],{'$or':_[_0xcaa7('0x3c')](_0x180123[_0xcaa7('0x4c')],function(_0x30828f){var _0x254492={};_0x254492[_0x30828f]={'$like':'%'+_0x306a34[_0xcaa7('0x48')][_0xcaa7('0x93')]+'%'};return _0x254492;})});}_0x180123[_0xcaa7('0x50')][_0xcaa7('0xfb')]=![];if(_0x306a34['query']['id']){_0x180123['where']['id']={'$gt':_0x306a34[_0xcaa7('0x48')]['id']};}_0x180123=_[_0xcaa7('0xab')]({},_0x180123,_0x306a34['options']);return db[_0xcaa7('0xd5')][_0xcaa7('0xa9')]({'where':_0x180123[_0xcaa7('0x50')]})['then'](function(_0x53e1eb){_0x536dbf['count']=_0x53e1eb;_0x180123['include']=[];if(_0x306a34[_0xcaa7('0x48')][_0xcaa7('0x110')]){_0x180123[_0xcaa7('0xc6')]['push']({'model':db['User'],'as':_0xcaa7('0x7c'),'attributes':['id','fullname',_0xcaa7('0xf5')]});}if(_0x306a34['query'][_0xcaa7('0xc5')]){_0x180123[_0xcaa7('0xc6')]=[{'all':!![]}];}return db[_0xcaa7('0xd5')][_0xcaa7('0x111')](_0x180123);})[_0xcaa7('0x20')](function(_0x202fe8){_0x536dbf['rows']=_0x202fe8;return _0x536dbf;});}})[_0xcaa7('0x20')](respondWithFilteredResult(_0x3e7062,_0x180123))[_0xcaa7('0x2b')](handleError(_0x3e7062,null));};exports['addTags']=function(_0x1c64da,_0x1a8463,_0x593ca3){return db[_0xcaa7('0x43')][_0xcaa7('0x75')]({'where':{'id':_0x1c64da[_0xcaa7('0xc3')]['id']}})[_0xcaa7('0x20')](handleEntityNotFound(_0x1a8463,null))[_0xcaa7('0x20')](function(_0x1b3ba5){if(_0x1b3ba5){return _0x1b3ba5['setTags'](_0x1c64da['body'][_0xcaa7('0x10c')],_[_0xcaa7('0x10d')](_0x1c64da[_0xcaa7('0x82')],[_0xcaa7('0x10c'),'id'])||{})[_0xcaa7('0x112')](function(){return db[_0xcaa7('0x79')][_0xcaa7('0x111')]({'attributes':['id',_0xcaa7('0x3a'),'color'],'where':{'id':_0x1c64da[_0xcaa7('0x82')]['ids']}});})[_0xcaa7('0x20')](function(_0x4c5c69){socket[_0xcaa7('0x113')](_0xcaa7('0x114'),{'id':Number(_0x1c64da[_0xcaa7('0xc3')]['id']),'tags':_0x4c5c69||[]});return{'id':Number(_0x1c64da[_0xcaa7('0xc3')]['id']),'tags':_0x4c5c69||[]};});}})['then'](respondWithResult(_0x1a8463,null))['catch'](handleError(_0x1a8463,null));};exports['removeTags']=function(_0x13cfbd,_0xbc153f,_0x52c550){return db[_0xcaa7('0x43')][_0xcaa7('0x75')]({'where':{'id':_0x13cfbd['params']['id']}})[_0xcaa7('0x20')](handleEntityNotFound(_0xbc153f,null))[_0xcaa7('0x20')](function(_0x34f882){if(_0x34f882){return _0x34f882[_0xcaa7('0x115')](_0x13cfbd[_0xcaa7('0x48')][_0xcaa7('0x10c')]);}})[_0xcaa7('0x20')](respondWithStatusCode(_0xbc153f,null))[_0xcaa7('0x2b')](handleError(_0xbc153f,null));};exports[_0xcaa7('0x116')]=function(_0x3fb5ee,_0x50314e){var _0x4b0e0c=moment()['unix']()[_0xcaa7('0xa8')]();var _0x55b147=path[_0xcaa7('0xe8')](config[_0xcaa7('0xe5')],_0xcaa7('0x117'),_0xcaa7('0x118'),_0xcaa7('0x119'));var _0x535793=path[_0xcaa7('0xe8')](config['root'],_0xcaa7('0x117'),_0xcaa7('0x118'),_0xcaa7('0x11a'));var _0x5e4513=path['join'](_0x55b147,_0x4b0e0c);var _0x11fa56=util[_0xcaa7('0xea')](_0xcaa7('0x11b'),_0x3fb5ee[_0xcaa7('0xc3')]['id'],_0x4b0e0c);var _0x2cd366=path[_0xcaa7('0xe8')](_0x55b147,_0x11fa56);var _0x4da3d9=[];_0x4da3d9[_0xcaa7('0x41')]({'model':db[_0xcaa7('0x7c')],'as':'User','attributes':['id',_0xcaa7('0xf7')],'raw':!![]});_0x4da3d9[_0xcaa7('0x41')]({'model':db[_0xcaa7('0x11c')],'as':'Contact','attributes':['id',_0xcaa7('0x11d'),'lastName'],'raw':!![]});if(_0x3fb5ee[_0xcaa7('0x48')][_0xcaa7('0x11a')]){_0x4da3d9[_0xcaa7('0x41')]({'model':db[_0xcaa7('0xe1')],'as':'Attachment','raw':!![]});}var _0x9eefa7=[{'model':db[_0xcaa7('0xd5')],'as':'Messages','attributes':['id',_0xcaa7('0x82'),_0xcaa7('0x86'),_0xcaa7('0xfa'),'secret',_0xcaa7('0x8e')],'include':_0x4da3d9}];_0x9eefa7[_0xcaa7('0x41')]({'model':db[_0xcaa7('0xcb')],'as':'Account','attributes':['id',_0xcaa7('0x3a')]});_0x9eefa7[_0xcaa7('0x41')]({'model':db['User'],'as':_0xcaa7('0x11e'),'attributes':['id',_0xcaa7('0xf7')]});return db[_0xcaa7('0x43')][_0xcaa7('0x75')]({'where':{'id':_0x3fb5ee[_0xcaa7('0xc3')]['id']},'include':_0x9eefa7})[_0xcaa7('0x20')](handleEntityNotFound(_0x50314e,null))[_0xcaa7('0x20')](function(_0x2494f0){if(_0x2494f0){var _0x1961c3=_0x2494f0[_0xcaa7('0x11f')]({'plain':!![]});fs[_0xcaa7('0x120')](_0x5e4513);var _0x5c7b48={'format':'A4','border':'10px','header':{'height':_0xcaa7('0x121'),'contents':{'first':_0xcaa7('0x122')}},'footer':{'height':_0xcaa7('0x123'),'contents':{'default':util[_0xcaa7('0xea')]('\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[_0xcaa7('0xea')]('%s\x20#%d','Chat',_0x1961c3['id']),moment()[_0xcaa7('0xea')](_0xcaa7('0x124'))[_0xcaa7('0xa8')]())}}};var _0x459bc3={'channel':_0xcaa7('0x125'),'account':_0x1961c3[_0xcaa7('0x126')]['name'],'agent':_0x1961c3['Owner']?_0x1961c3[_0xcaa7('0x11e')][_0xcaa7('0xf7')]:_0xcaa7('0x127'),'createdAt':moment(_0x1961c3[_0xcaa7('0x86')])[_0xcaa7('0xea')]('YYYY-MM-DD\x20HH:mm:ss')[_0xcaa7('0xa8')](),'closedAt':_0x1961c3[_0xcaa7('0xe2')]?moment(_0x1961c3[_0xcaa7('0x128')])[_0xcaa7('0xea')](_0xcaa7('0x129'))[_0xcaa7('0xa8')]():'','disposition':_0x1961c3[_0xcaa7('0x12a')],'chatInfo':{'browser':_0x1961c3[_0xcaa7('0x12b')],'os':_0x1961c3[_0xcaa7('0x12c')],'referer':_0x1961c3[_0xcaa7('0x12d')],'customerIp':_0x1961c3['customerIp'],'customerPort':_0x1961c3['customerPort']?_0x1961c3['customerPort']:_0xcaa7('0x127')},'messages':_(_0x1961c3[_0xcaa7('0xee')])[_0xcaa7('0x12e')]()[_0xcaa7('0x93')]({'secret':![]})[_0xcaa7('0x3c')](function(_0x3e931a){if(_0x3e931a['Attachment']){var _0x512cf1=path[_0xcaa7('0xe8')](_0x535793,_0x3e931a[_0xcaa7('0xe1')][_0xcaa7('0xde')]);if(fs[_0xcaa7('0x12f')](_0x512cf1)){fs[_0xcaa7('0x130')](_0x512cf1)[_0xcaa7('0x131')](fs['createWriteStream'](path[_0xcaa7('0xe8')](_0x5e4513,_0x3e931a['Attachment'][_0xcaa7('0xde')])));}}return{'date':moment(_0x3e931a[_0xcaa7('0x86')])['format'](_0xcaa7('0x129'))[_0xcaa7('0xa8')](),'sender':_0x3e931a[_0xcaa7('0xfa')]===_0xcaa7('0xd4')?_0x3e931a[_0xcaa7('0x7c')]?_0x3e931a[_0xcaa7('0x7c')]['fullname']:_0xcaa7('0xf3'):_0x3e931a[_0xcaa7('0x132')][_0xcaa7('0x11d')]+(_0x3e931a[_0xcaa7('0x132')][_0xcaa7('0x133')]?'\x20'+_0x3e931a[_0xcaa7('0x132')][_0xcaa7('0x133')]:''),'body':_0x3e931a[_0xcaa7('0xe1')]?_0x3e931a[_0xcaa7('0xe1')][_0xcaa7('0xde')]:_0x3e931a[_0xcaa7('0x82')],'direction':_0x3e931a[_0xcaa7('0xfa')]===_0xcaa7('0xd4')?'A':'C','secret':_0x3e931a[_0xcaa7('0xfb')],'read':_0x3e931a[_0xcaa7('0x8e')],'attachment':_0x3e931a[_0xcaa7('0xe1')]};})[_0xcaa7('0x6e')]()};return ejs[_0xcaa7('0x134')](path['join'](config['root'],_0xcaa7('0x117'),_0xcaa7('0x135'),_0xcaa7('0x136')),{'interaction':_0x459bc3})['then'](function(_0x32981d){return new BPromise(function(_0xc9bc80,_0xedd6ec){pdf[_0xcaa7('0xc8')](_0x32981d,_0x5c7b48)['toFile'](path[_0xcaa7('0xe8')](_0x5e4513,_0xcaa7('0x137')+_0x1961c3['id']+'-'+_0x4b0e0c+_0xcaa7('0x138')),function(_0x5b590a,_0x42d06f){if(_0x5b590a)return _0xedd6ec(_0x5b590a);_0xc9bc80(_0x42d06f);});});})[_0xcaa7('0x20')](function(){return new BPromise(function(_0x183694,_0x28adec){zipdir(_0x5e4513,{'saveTo':_0x2cd366},function(_0x332577,_0x430de9){if(_0x332577)return _0x28adec(_0x332577);return _0x183694(_0x430de9);});})[_0xcaa7('0x20')](function(){return new BPromise(function(_0x41383b,_0x12b51d){rimraf(_0x5e4513,function(_0x238fb9){if(_0x238fb9)_0x12b51d(_0x238fb9);return _0x41383b();});});})[_0xcaa7('0x20')](function(){return _0x50314e[_0xcaa7('0x116')](_0x2cd366,_0x11fa56,function(_0x5871c3){if(_0x5871c3){console['log'](_0xcaa7('0x139'),_0x5871c3);}else{fs[_0xcaa7('0x13a')](_0x2cd366);}});});});}else{return _0x50314e[_0xcaa7('0x2c')](0xc8);}})[_0xcaa7('0x2b')](handleError(_0x50314e,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 9ab4565..fd2685f 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 _0xa2f9=['map','length','emit','catch','hook','exports','events','../../mysqldb','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x275a1f,_0x37cb10){var _0x163516=function(_0x2ea5c1){while(--_0x2ea5c1){_0x275a1f['push'](_0x275a1f['shift']());}};_0x163516(++_0x37cb10);}(_0xa2f9,0x132));var _0x9a2f=function(_0xe6fedd,_0x3c1278){_0xe6fedd=_0xe6fedd-0x0;var _0x3a6beb=_0xa2f9[_0xe6fedd];return _0x3a6beb;};'use strict';var EventEmitter=require(_0x9a2f('0x0'));var ChatInteraction=require(_0x9a2f('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x9a2f('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a2f('0x2'),'afterUpdate':_0x9a2f('0x3'),'afterDestroy':_0x9a2f('0x4')};function emitEvent(_0x2696e5){return function(_0x2745dd,_0x3da575,_0x45d24a){_0x2745dd[_0x9a2f('0x5')]({'attributes':['id'],'raw':!![]})[_0x9a2f('0x6')](function(_0x291609){_0x2745dd[_0x9a2f('0x7')](_0x9a2f('0x8'),_0x291609[_0x9a2f('0x9')](function(_0x2db83b){return{'id':_0x2db83b['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x2745dd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9a2f('0x6')](function(_0x496d13){_0x2745dd[_0x9a2f('0x7')]('unreadMessages',_0x496d13[_0x9a2f('0xa')]);ChatInteractionEvents[_0x9a2f('0xb')](_0x2696e5+':'+_0x2745dd['id'],_0x2745dd);ChatInteractionEvents[_0x9a2f('0xb')](_0x2696e5,_0x2745dd);_0x45d24a(null);})[_0x9a2f('0xc')](_0x45d24a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x9a2f('0xd')](e,emitEvent(event));}}module[_0x9a2f('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0x28e4=['length','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x28e4,0x146));var _0x428e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28e4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x428e('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x428e('0x1')];var ChatMessage=require(_0x428e('0x2'))['db'][_0x428e('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x428e('0x4')](0x0);var events={'afterCreate':_0x428e('0x5'),'afterUpdate':_0x428e('0x6'),'afterDestroy':_0x428e('0x7')};function emitEvent(_0x19c277){return function(_0x5e3f25,_0x18da1c,_0x458017){_0x5e3f25[_0x428e('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1ba591){_0x5e3f25[_0x428e('0x9')](_0x428e('0xa'),_0x1ba591[_0x428e('0xb')](function(_0x4b9d11){return{'id':_0x4b9d11['id']};}));return ChatMessage[_0x428e('0xc')]({'where':{'ChatInteractionId':_0x5e3f25['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x394dcb){_0x5e3f25[_0x428e('0x9')](_0x428e('0xd'),_0x394dcb[_0x428e('0xe')]);ChatInteractionEvents[_0x428e('0xf')](_0x19c277+':'+_0x5e3f25['id'],_0x5e3f25);ChatInteractionEvents['emit'](_0x19c277,_0x5e3f25);_0x458017(null);})[_0x428e('0x10')](_0x458017(null));};}for(var e in events){if(events[_0x428e('0x11')](e)){var event=events[e];ChatInteraction[_0x428e('0x12')](e,emitEvent(event));}}module[_0x428e('0x13')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 99febec..427ec49 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 _0xf66b=['path','../../config/environment','ChatInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1ebcbc,_0x3372b5){var _0x101372=function(_0x39411f){while(--_0x39411f){_0x1ebcbc['push'](_0x1ebcbc['shift']());}};_0x101372(++_0x3372b5);}(_0xf66b,0x162));var _0xbf66=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xf66b[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xbf66('0x0'));var util=require('util');var logger=require(_0xbf66('0x1'))(_0xbf66('0x2'));var moment=require(_0xbf66('0x3'));var BPromise=require(_0xbf66('0x4'));var rp=require(_0xbf66('0x5'));var fs=require('fs');var path=require(_0xbf66('0x6'));var rimraf=require('rimraf');var config=require(_0xbf66('0x7'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x2ea072,_0x1ffcb6){return _0x2ea072['define'](_0xbf66('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51e1c1,_0x499c74,_0x116439){if(_0x51e1c1[_0xbf66('0x9')]('closed')){_0x51e1c1[_0xbf66('0xa')]=moment()[_0xbf66('0xb')](_0xbf66('0xc'));}_0x116439(null,_0x51e1c1);}},'charset':_0xbf66('0xd'),'collate':_0xbf66('0xe')});}; \ No newline at end of file +var _0x654f=['../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','ChatInteraction','changed','closedAt','format','utf8mb4_unicode_ci'];(function(_0x3c0a08,_0x11e4c1){var _0x27fc42=function(_0x4b30fe){while(--_0x4b30fe){_0x3c0a08['push'](_0x3c0a08['shift']());}};_0x27fc42(++_0x11e4c1);}(_0x654f,0x12b));var _0xf654=function(_0x57bae7,_0x348173){_0x57bae7=_0x57bae7-0x0;var _0x51b1f1=_0x654f[_0x57bae7];return _0x51b1f1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf654('0x0'))(_0xf654('0x1'));var moment=require(_0xf654('0x2'));var BPromise=require(_0xf654('0x3'));var rp=require(_0xf654('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf654('0x5'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0xf654('0x6')]=function(_0x13e07d,_0x492900){return _0x13e07d[_0xf654('0x7')](_0xf654('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5db8d2,_0x5c00c8,_0x2176bc){if(_0x5db8d2[_0xf654('0x9')]('closed')){_0x5db8d2[_0xf654('0xa')]=moment()[_0xf654('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2176bc(null,_0x5db8d2);}},'charset':'utf8mb4','collate':_0xf654('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 310e035..f555394 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 _0x6799=['message','result','catch','options','attributes','limit','UpdateChatInteraction','stringify','find','where','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6799,0x1bb));var _0x9679=function(_0x27d9a7,_0x3ea47d){_0x27d9a7=_0x27d9a7-0x0;var _0x21c1fb=_0x6799[_0x27d9a7];return _0x21c1fb;};'use strict';var _=require(_0x9679('0x0'));var util=require(_0x9679('0x1'));var moment=require(_0x9679('0x2'));var BPromise=require(_0x9679('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9679('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9679('0x5'));var jayson=require(_0x9679('0x6'));var client=jayson[_0x9679('0x7')][_0x9679('0x8')]({'port':0x232a});config[_0x9679('0x9')]=_['defaults'](config[_0x9679('0x9')],{'host':_0x9679('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9679('0x9')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0xa58b69,_0x42502e,_0x56fdd0){return new BPromise(function(_0x1296ce,_0x53ff24){return client[_0x9679('0xb')](_0xa58b69,_0x56fdd0)[_0x9679('0xc')](function(_0x5cbc0e){logger[_0x9679('0xd')](_0x9679('0xe'),_0x42502e,_0x9679('0xf'));logger[_0x9679('0x10')](_0x9679('0x11'),_0x42502e,_0x9679('0xf'),JSON['stringify'](_0x5cbc0e));if(_0x5cbc0e[_0x9679('0x12')]){if(_0x5cbc0e[_0x9679('0x12')]['code']===0x1f4){logger[_0x9679('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x42502e,_0x5cbc0e['error']['message']);return _0x53ff24(_0x5cbc0e[_0x9679('0x12')][_0x9679('0x13')]);}logger[_0x9679('0x12')](_0x9679('0xe'),_0x42502e,_0x5cbc0e[_0x9679('0x12')][_0x9679('0x13')]);return _0x1296ce(_0x5cbc0e['error'][_0x9679('0x13')]);}else{logger[_0x9679('0xd')](_0x9679('0xe'),_0x42502e,_0x9679('0xf'));_0x1296ce(_0x5cbc0e[_0x9679('0x14')][_0x9679('0x13')]);}})[_0x9679('0x15')](function(_0x292213){logger['error'](_0x9679('0xe'),_0x42502e,_0x292213);_0x53ff24(_0x292213);});});}exports['UpdateChatInteraction']=function(_0x13853b){var _0x18ebcd=this;return new Promise(function(_0x5947ab,_0x4f92e7){return db['ChatInteraction']['update'](_0x13853b['body'],{'raw':_0x13853b['options']?_0x13853b[_0x9679('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13853b['options']?_0x13853b[_0x9679('0x16')]['where']||null:null,'attributes':_0x13853b[_0x9679('0x16')]?_0x13853b['options'][_0x9679('0x17')]||null:null,'limit':_0x13853b['options']?_0x13853b['options'][_0x9679('0x18')]||null:null})['then'](function(_0x48e5d1){logger[_0x9679('0xd')](_0x9679('0x19'),_0x13853b);logger[_0x9679('0x10')](_0x9679('0x19'),_0x13853b,JSON[_0x9679('0x1a')](_0x48e5d1));_0x5947ab(_0x48e5d1);})[_0x9679('0x15')](function(_0x52739a){logger[_0x9679('0x12')](_0x9679('0x19'),_0x52739a[_0x9679('0x13')],_0x13853b);_0x4f92e7(_0x18ebcd[_0x9679('0x12')](0x1f4,_0x52739a[_0x9679('0x13')]));});});};exports['AddTagsToChatInteraction']=function(_0x316fa0){return new Promise(function(_0x33d246,_0x32c7fb){return db['ChatInteraction'][_0x9679('0x1b')]({'where':_0x316fa0[_0x9679('0x16')]?_0x316fa0[_0x9679('0x16')][_0x9679('0x1c')]||null:null})[_0x9679('0xc')](function(_0x4f30e9){if(_0x4f30e9){return _0x4f30e9[_0x9679('0x1d')](_0x316fa0['body'][_0x9679('0x1e')],_['omit'](_0x316fa0['body'],[_0x9679('0x1e'),'id'])||{});}})[_0x9679('0x1f')](function(_0x41a8a3){logger['info']('AddTags',_0x316fa0);logger[_0x9679('0x10')](_0x9679('0x20'),_0x316fa0,JSON['stringify'](_0x41a8a3));_0x33d246(_0x41a8a3);})['catch'](function(_0x37c6a9){logger[_0x9679('0x12')](_0x9679('0x20'),_0x37c6a9[_0x9679('0x13')],_0x316fa0);_0x32c7fb(_this[_0x9679('0x12')](0x1f4,_0x37c6a9[_0x9679('0x13')]));});});}; \ No newline at end of file +var _0xefc2=['addTags','ids','omit','AddTags','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatInteraction','update','body','options','raw','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','where'];(function(_0x2297dd,_0x2abc1a){var _0x3fc351=function(_0x46192a){while(--_0x46192a){_0x2297dd['push'](_0x2297dd['shift']());}};_0x3fc351(++_0x2abc1a);}(_0xefc2,0x13c));var _0x2efc=function(_0x45ba0d,_0x54b310){_0x45ba0d=_0x45ba0d-0x0;var _0x53763f=_0xefc2[_0x45ba0d];return _0x53763f;};'use strict';var _=require(_0x2efc('0x0'));var util=require(_0x2efc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2efc('0x2'));var logger=require(_0x2efc('0x3'))(_0x2efc('0x4'));var config=require(_0x2efc('0x5'));var jayson=require(_0x2efc('0x6'));var client=jayson[_0x2efc('0x7')][_0x2efc('0x8')]({'port':0x232a});config[_0x2efc('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2efc('0xa'))(new Redis(config[_0x2efc('0x9')]));require(_0x2efc('0xb'))['register'](socket);function respondWithRpcPromise(_0x552765,_0xfeca0,_0xfbffb0){return new BPromise(function(_0x1dcf8e,_0x68b377){return client[_0x2efc('0xc')](_0x552765,_0xfbffb0)[_0x2efc('0xd')](function(_0x2e40fd){logger[_0x2efc('0xe')](_0x2efc('0xf'),_0xfeca0,_0x2efc('0x10'));logger[_0x2efc('0x11')](_0x2efc('0x12'),_0xfeca0,_0x2efc('0x10'),JSON[_0x2efc('0x13')](_0x2e40fd));if(_0x2e40fd[_0x2efc('0x14')]){if(_0x2e40fd[_0x2efc('0x14')][_0x2efc('0x15')]===0x1f4){logger[_0x2efc('0x14')](_0x2efc('0xf'),_0xfeca0,_0x2e40fd[_0x2efc('0x14')][_0x2efc('0x16')]);return _0x68b377(_0x2e40fd[_0x2efc('0x14')][_0x2efc('0x16')]);}logger[_0x2efc('0x14')](_0x2efc('0xf'),_0xfeca0,_0x2e40fd[_0x2efc('0x14')][_0x2efc('0x16')]);return _0x1dcf8e(_0x2e40fd['error'][_0x2efc('0x16')]);}else{logger[_0x2efc('0xe')](_0x2efc('0xf'),_0xfeca0,_0x2efc('0x10'));_0x1dcf8e(_0x2e40fd[_0x2efc('0x17')][_0x2efc('0x16')]);}})[_0x2efc('0x18')](function(_0x3110a8){logger[_0x2efc('0x14')](_0x2efc('0xf'),_0xfeca0,_0x3110a8);_0x68b377(_0x3110a8);});});}exports['UpdateChatInteraction']=function(_0x40528e){var _0x1fe301=this;return new Promise(function(_0x31b559,_0x3af3aa){return db[_0x2efc('0x19')][_0x2efc('0x1a')](_0x40528e[_0x2efc('0x1b')],{'raw':_0x40528e['options']?_0x40528e[_0x2efc('0x1c')][_0x2efc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40528e['options']?_0x40528e[_0x2efc('0x1c')]['where']||null:null,'attributes':_0x40528e['options']?_0x40528e[_0x2efc('0x1c')][_0x2efc('0x1e')]||null:null,'limit':_0x40528e[_0x2efc('0x1c')]?_0x40528e[_0x2efc('0x1c')][_0x2efc('0x1f')]||null:null})['then'](function(_0x16331b){logger['info'](_0x2efc('0x20'),_0x40528e);logger[_0x2efc('0x11')](_0x2efc('0x20'),_0x40528e,JSON[_0x2efc('0x13')](_0x16331b));_0x31b559(_0x16331b);})[_0x2efc('0x18')](function(_0x106f25){logger[_0x2efc('0x14')](_0x2efc('0x20'),_0x106f25[_0x2efc('0x16')],_0x40528e);_0x3af3aa(_0x1fe301[_0x2efc('0x14')](0x1f4,_0x106f25[_0x2efc('0x16')]));});});};exports[_0x2efc('0x21')]=function(_0x507eb3){return new Promise(function(_0x1a275e,_0xb1ee3d){return db['ChatInteraction']['find']({'where':_0x507eb3[_0x2efc('0x1c')]?_0x507eb3[_0x2efc('0x1c')][_0x2efc('0x22')]||null:null})[_0x2efc('0xd')](function(_0x2c32e6){if(_0x2c32e6){return _0x2c32e6[_0x2efc('0x23')](_0x507eb3['body'][_0x2efc('0x24')],_[_0x2efc('0x25')](_0x507eb3['body'],[_0x2efc('0x24'),'id'])||{});}})['spread'](function(_0x395898){logger[_0x2efc('0xe')](_0x2efc('0x26'),_0x507eb3);logger[_0x2efc('0x11')](_0x2efc('0x26'),_0x507eb3,JSON['stringify'](_0x395898));_0x1a275e(_0x395898);})['catch'](function(_0x3ba258){logger[_0x2efc('0x14')]('AddTags',_0x3ba258[_0x2efc('0x16')],_0x507eb3);_0xb1ee3d(_this[_0x2efc('0x14')](0x1f4,_0x3ba258[_0x2efc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 6a922ae..0fbb7fd 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 _0x9753=['length','./chatInteraction.events','save','update','removeListener','register'];(function(_0x4e64a,_0x398271){var _0x3b6ac7=function(_0x3ca3a3){while(--_0x3ca3a3){_0x4e64a['push'](_0x4e64a['shift']());}};_0x3b6ac7(++_0x398271);}(_0x9753,0x1bd));var _0x3975=function(_0x4f484c,_0x9bccb4){_0x4f484c=_0x4f484c-0x0;var _0x276e95=_0x9753[_0x4f484c];return _0x276e95;};'use strict';var ChatInteractionEvents=require(_0x3975('0x0'));var events=[_0x3975('0x1'),'remove',_0x3975('0x2')];function createListener(_0x5c26a3,_0x33d042){return function(_0x321824){_0x33d042['emit'](_0x5c26a3,_0x321824);};}function removeListener(_0x265305,_0x3b82b0){return function(){ChatInteractionEvents[_0x3975('0x3')](_0x265305,_0x3b82b0);};}exports[_0x3975('0x4')]=function(_0x458d3b){for(var _0x245901=0x0,_0xf63932=events[_0x3975('0x5')];_0x245901<_0xf63932;_0x245901++){var _0x35c780=events[_0x245901];var _0x2a8cbd=createListener('chatInteraction:'+_0x35c780,_0x458d3b);ChatInteractionEvents['on'](_0x35c780,_0x2a8cbd);}}; \ No newline at end of file +var _0x4298=['chatInteraction:','./chatInteraction.events','save','remove','update','removeListener','register','length'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4298,0x119));var _0x8429=function(_0x40c147,_0x4ec711){_0x40c147=_0x40c147-0x0;var _0x28e571=_0x4298[_0x40c147];return _0x28e571;};'use strict';var ChatInteractionEvents=require(_0x8429('0x0'));var events=[_0x8429('0x1'),_0x8429('0x2'),_0x8429('0x3')];function createListener(_0x441857,_0x36ce0a){return function(_0x3c693f){_0x36ce0a['emit'](_0x441857,_0x3c693f);};}function removeListener(_0x50d714,_0x190a38){return function(){ChatInteractionEvents[_0x8429('0x4')](_0x50d714,_0x190a38);};}exports[_0x8429('0x5')]=function(_0x5c6ff7){for(var _0x5a46dc=0x0,_0x2667e7=events[_0x8429('0x6')];_0x5a46dc<_0x2667e7;_0x5a46dc++){var _0x2359f8=events[_0x5a46dc];var _0x1493ef=createListener(_0x8429('0x7')+_0x2359f8,_0x5c6ff7);ChatInteractionEvents['on'](_0x2359f8,_0x1493ef);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index f653699..c1f399a 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 _0x269e=['delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','index','get','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','isAuthenticated','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','join','root','format','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','abandon','/:id/close','close'];(function(_0x5a6842,_0x12167a){var _0x2bba7d=function(_0x582d67){while(--_0x582d67){_0x5a6842['push'](_0x5a6842['shift']());}};_0x2bba7d(++_0x12167a);}(_0x269e,0x171));var _0xe269=function(_0xe6ee2,_0x3333cd){_0xe6ee2=_0xe6ee2-0x0;var _0x1dd92e=_0x269e[_0xe6ee2];return _0x1dd92e;};'use strict';var multer=require(_0xe269('0x0'));var util=require(_0xe269('0x1'));var path=require('path');var timeout=require(_0xe269('0x2'));var express=require(_0xe269('0x3'));var router=express['Router']();var auth=require(_0xe269('0x4'));var interaction=require(_0xe269('0x5'));var config=require(_0xe269('0x6'));var controller=require(_0xe269('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe269('0x8')]);router[_0xe269('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe269('0xa')]);router['get'](_0xe269('0xb'),auth[_0xe269('0xc')](),controller[_0xe269('0xd')]);router['get']('/:id/attachment_download',auth[_0xe269('0xc')](),controller[_0xe269('0xe')]);router[_0xe269('0x9')](_0xe269('0xf'),auth[_0xe269('0x10')](),controller[_0xe269('0x11')]);router['get'](_0xe269('0x12'),auth[_0xe269('0xc')](),controller[_0xe269('0x13')]);router[_0xe269('0x9')](_0xe269('0x14'),auth['isAuthenticated'](),controller[_0xe269('0x15')]);router['post']('/',auth[_0xe269('0x10')](),controller['create']);router[_0xe269('0x16')](_0xe269('0x17'),auth[_0xe269('0x10')](),controller[_0xe269('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x12869a,_0x2389e4,_0x3f5c33){_0x3f5c33(null,path[_0xe269('0x19')](config[_0xe269('0x1a')],'server/files/attachments/'));},'filename':function(_0x16a5eb,_0x42974d,_0x5f1d78){_0x5f1d78(null,util[_0xe269('0x1b')]('%s-%s',Date[_0xe269('0x1c')](),_0x42974d[_0xe269('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe269('0x16')](_0xe269('0x1e'),upload[_0xe269('0x1f')](_0xe269('0x20')),controller[_0xe269('0x21')]);router[_0xe269('0x16')](_0xe269('0xf'),auth[_0xe269('0xc')](),controller[_0xe269('0x22')]);router['post'](_0xe269('0x23'),auth[_0xe269('0x10')](),interaction[_0xe269('0x24')](_0xe269('0x25'),_0xe269('0x26')),controller[_0xe269('0x27')]);router[_0xe269('0x28')]('/:id',auth[_0xe269('0x10')](),interaction['tracked'](_0xe269('0x25'),_0xe269('0x29')),controller[_0xe269('0x2a')]);router[_0xe269('0x28')](_0xe269('0x2b'),controller['customUpdate']);router[_0xe269('0x28')]('/:id/abandon',auth[_0xe269('0xc')](),controller[_0xe269('0x2c')]);router[_0xe269('0x28')](_0xe269('0x2d'),controller[_0xe269('0x2e')]);router[_0xe269('0x2f')]('/:id',auth[_0xe269('0x10')](),interaction['tracked'](_0xe269('0x25'),_0xe269('0x30')),controller[_0xe269('0x31')]);router[_0xe269('0x2f')](_0xe269('0x23'),auth[_0xe269('0x10')](),controller[_0xe269('0x32')]);module[_0xe269('0x33')]=router; \ No newline at end of file +var _0xf161=['multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','diskStorage','join','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','tracked','chat','/:id','chatinteraction:update','update','put','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','exports'];(function(_0x3ef45e,_0xe84f33){var _0x69e7c=function(_0x43ba11){while(--_0x43ba11){_0x3ef45e['push'](_0x3ef45e['shift']());}};_0x69e7c(++_0xe84f33);}(_0xf161,0x8d));var _0x1f16=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xf161[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0x1f16('0x0'));var util=require(_0x1f16('0x1'));var path=require('path');var timeout=require(_0x1f16('0x2'));var express=require('express');var router=express[_0x1f16('0x3')]();var auth=require(_0x1f16('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1f16('0x5'));var controller=require('./chatInteraction.controller');router[_0x1f16('0x6')]('/',auth[_0x1f16('0x7')](),controller[_0x1f16('0x8')]);router[_0x1f16('0x6')]('/describe',auth[_0x1f16('0x7')](),controller[_0x1f16('0x9')]);router['get']('/:id',auth[_0x1f16('0xa')](),controller[_0x1f16('0xb')]);router[_0x1f16('0x6')](_0x1f16('0xc'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0x1f16('0x6')](_0x1f16('0xd'),auth[_0x1f16('0x7')](),controller[_0x1f16('0xe')]);router[_0x1f16('0x6')](_0x1f16('0xf'),auth[_0x1f16('0xa')](),controller['getMyMessages']);router[_0x1f16('0x6')](_0x1f16('0x10'),auth[_0x1f16('0x7')](),controller[_0x1f16('0x11')]);router[_0x1f16('0x12')]('/',auth[_0x1f16('0x7')](),controller[_0x1f16('0x13')]);router[_0x1f16('0x12')]('/:id/vidaoo',auth[_0x1f16('0x7')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x1f16('0x14')]({'destination':function(_0x3567ee,_0x1cb869,_0x2b76ac){_0x2b76ac(null,path[_0x1f16('0x15')](config['root'],_0x1f16('0x16')));},'filename':function(_0x480e79,_0x51c742,_0x5dd9a5){_0x5dd9a5(null,util[_0x1f16('0x17')](_0x1f16('0x18'),Date[_0x1f16('0x19')](),_0x51c742['originalname'][_0x1f16('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x1f16('0x12')](_0x1f16('0x1b'),upload[_0x1f16('0x1c')](_0x1f16('0x1d')),controller['attachmentUpload']);router[_0x1f16('0x12')](_0x1f16('0xd'),auth[_0x1f16('0xa')](),controller[_0x1f16('0x1e')]);router[_0x1f16('0x12')](_0x1f16('0x1f'),auth[_0x1f16('0x7')](),interaction[_0x1f16('0x20')](_0x1f16('0x21'),'chatinteraction:addtags'),controller['addTags']);router['put'](_0x1f16('0x22'),auth[_0x1f16('0x7')](),interaction[_0x1f16('0x20')](_0x1f16('0x21'),_0x1f16('0x23')),controller[_0x1f16('0x24')]);router[_0x1f16('0x25')](_0x1f16('0x26'),controller[_0x1f16('0x27')]);router[_0x1f16('0x25')](_0x1f16('0x28'),auth[_0x1f16('0xa')](),controller['abandon']);router[_0x1f16('0x25')](_0x1f16('0x29'),controller[_0x1f16('0x2a')]);router[_0x1f16('0x2b')](_0x1f16('0x22'),auth[_0x1f16('0x7')](),interaction[_0x1f16('0x20')](_0x1f16('0x21'),_0x1f16('0x2c')),controller['destroy']);router[_0x1f16('0x2b')]('/:id/tags',auth[_0x1f16('0x7')](),controller[_0x1f16('0x2d')]);module[_0x1f16('0x2e')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index eab30ab..c4c485b 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 _0x0b0e=['TEXT','BOOLEAN','INTEGER','sequelize'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2e2f84,_0x24e46f){_0x2e2f84=_0x2e2f84-0x0;var _0x448191=_0x0b0e[_0x2e2f84];return _0x448191;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe0b0('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe0b0('0x3')]}}; \ No newline at end of file +var _0x57ca=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x24ce6f,_0x5d94ea){var _0x56573a=function(_0x6d78de){while(--_0x6d78de){_0x24ce6f['push'](_0x24ce6f['shift']());}};_0x56573a(++_0x5d94ea);}(_0x57ca,0x108));var _0xa57c=function(_0x25110a,_0x3b3852){_0x25110a=_0x25110a-0x0;var _0xe42822=_0x57ca[_0x25110a];return _0xe42822;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'body':{'type':Sequelize[_0xa57c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa57c('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa57c('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 8330309..620fc25 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 _0xae99=['params','length','create','body','update','find','describe','messages','lastMessageAt','createdAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','user','fullname','userpic','internal','online','allowmessenger','showWebBar','sort','VoiceQueue','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','role','push','FromId','ToId','-createdAt','all','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','count','offset','set','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae99,0x172));var _0x9ae9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae99[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x9ae9('0x0'));var emlformat=require(_0x9ae9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9ae9('0x2'));var moment=require(_0x9ae9('0x3'));var BPromise=require(_0x9ae9('0x4'));var Mustache=require(_0x9ae9('0x5'));var util=require(_0x9ae9('0x6'));var path=require(_0x9ae9('0x7'));var sox=require(_0x9ae9('0x8'));var csv=require(_0x9ae9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9ae9('0xa'));var crypto=require('crypto');var jsforce=require(_0x9ae9('0xb'));var deskjs=require(_0x9ae9('0xc'));var toCsv=require(_0x9ae9('0x9'));var querystring=require('querystring');var Papa=require(_0x9ae9('0xd'));var Redis=require(_0x9ae9('0xe'));var authService=require(_0x9ae9('0xf'));var qs=require(_0x9ae9('0x10'));var as=require(_0x9ae9('0x11'));var hardwareService=require(_0x9ae9('0x12'));var logger=require(_0x9ae9('0x13'))(_0x9ae9('0x14'));var utils=require(_0x9ae9('0x15'));var config=require(_0x9ae9('0x16'));var licenseUtil=require(_0x9ae9('0x17'));var db=require(_0x9ae9('0x18'))['db'];config[_0x9ae9('0x19')]=_[_0x9ae9('0x1a')](config[_0x9ae9('0x19')],{'host':_0x9ae9('0x1b'),'port':0x18eb});var socket=require(_0x9ae9('0x1c'))(new Redis(config[_0x9ae9('0x19')]));require(_0x9ae9('0x1d'))[_0x9ae9('0x1e')](socket);function respondWithStatusCode(_0x273db3,_0x44fb18){_0x44fb18=_0x44fb18||0xcc;return function(_0x15a788){if(_0x15a788){return _0x273db3[_0x9ae9('0x1f')](_0x44fb18);}return _0x273db3[_0x9ae9('0x20')](_0x44fb18)['end']();};}function respondWithResult(_0x420271,_0x44418b){_0x44418b=_0x44418b||0xc8;return function(_0x3621d9){if(_0x3621d9){return _0x420271['status'](_0x44418b)[_0x9ae9('0x21')](_0x3621d9);}};}function respondWithFilteredResult(_0x4c816a,_0x30dee7){return function(_0x307650){if(_0x307650){var _0x240bf9=_0x307650[_0x9ae9('0x22')],_0x525ee0=_0x30dee7[_0x9ae9('0x23')],_0x415b90=_0x30dee7['offset']+_0x30dee7['limit'],_0x12c2f3;if(_0x415b90>=_0x240bf9){_0x415b90=_0x240bf9;_0x12c2f3=0xc8;}else{_0x12c2f3=0xce;}_0x4c816a[_0x9ae9('0x20')](_0x12c2f3);return _0x4c816a[_0x9ae9('0x24')]('Content-Range',_0x525ee0+'-'+_0x415b90+'/'+_0x240bf9)['json'](_0x307650);}return null;};}function patchUpdates(_0x181465){return function(_0xf3ae96){try{jsonpatch[_0x9ae9('0x25')](_0xf3ae96,_0x181465,!![]);}catch(_0x572890){return BPromise[_0x9ae9('0x26')](_0x572890);}return _0xf3ae96[_0x9ae9('0x27')]();};}function saveUpdates(_0x16595c,_0x37e53b){return function(_0x5f1c86){if(_0x5f1c86){return _0x5f1c86['update'](_0x16595c)[_0x9ae9('0x28')](function(_0x5b6755){return _0x5b6755;});}return null;};}function removeEntity(_0x49f7da,_0x81d6c){return function(_0x3411a3){if(_0x3411a3){return _0x3411a3[_0x9ae9('0x29')]()[_0x9ae9('0x28')](function(){_0x49f7da[_0x9ae9('0x20')](0xcc)[_0x9ae9('0x2a')]();});}};}function handleEntityNotFound(_0x6a688d,_0x4e9611){return function(_0x53cf8a){if(!_0x53cf8a){_0x6a688d[_0x9ae9('0x1f')](0x194);}return _0x53cf8a;};}function handleError(_0x5bd44e,_0x54cfc8){_0x54cfc8=_0x54cfc8||0x1f4;return function(_0x75d905){logger[_0x9ae9('0x2b')](_0x75d905[_0x9ae9('0x2c')]);if(_0x75d905[_0x9ae9('0x2d')]){delete _0x75d905[_0x9ae9('0x2d')];}_0x5bd44e[_0x9ae9('0x20')](_0x54cfc8)[_0x9ae9('0x2e')](_0x75d905);};}exports[_0x9ae9('0x2f')]=function(_0x3f806e,_0x56deb4){var _0x39fd86={},_0x45ac1f={},_0x5ef2af={'count':0x0,'rows':[]};var _0x868eea=_[_0x9ae9('0x30')](db[_0x9ae9('0x31')][_0x9ae9('0x32')],function(_0x1f31ed){return{'name':_0x1f31ed[_0x9ae9('0x33')],'type':_0x1f31ed[_0x9ae9('0x34')][_0x9ae9('0x35')]};});_0x45ac1f[_0x9ae9('0x36')]=_['map'](_0x868eea,'name');_0x45ac1f[_0x9ae9('0x37')]=_[_0x9ae9('0x38')](_0x3f806e[_0x9ae9('0x37')]);_0x45ac1f[_0x9ae9('0x39')]=_[_0x9ae9('0x3a')](_0x45ac1f[_0x9ae9('0x36')],_0x45ac1f[_0x9ae9('0x37')]);_0x39fd86['attributes']=_[_0x9ae9('0x3a')](_0x45ac1f[_0x9ae9('0x36')],qs['fields'](_0x3f806e[_0x9ae9('0x37')][_0x9ae9('0x3b')]));_0x39fd86[_0x9ae9('0x3c')]=_0x39fd86[_0x9ae9('0x3c')]['length']?_0x39fd86[_0x9ae9('0x3c')]:_0x45ac1f[_0x9ae9('0x36')];if(!_0x3f806e[_0x9ae9('0x37')][_0x9ae9('0x3d')](_0x9ae9('0x3e'))){_0x39fd86[_0x9ae9('0x3f')]=qs['limit'](_0x3f806e[_0x9ae9('0x37')][_0x9ae9('0x3f')]);_0x39fd86[_0x9ae9('0x23')]=qs[_0x9ae9('0x23')](_0x3f806e[_0x9ae9('0x37')][_0x9ae9('0x23')]);}_0x39fd86[_0x9ae9('0x40')]=qs['sort'](_0x3f806e[_0x9ae9('0x37')]['sort']);_0x39fd86[_0x9ae9('0x41')]=qs[_0x9ae9('0x39')](_[_0x9ae9('0x42')](_0x3f806e['query'],_0x45ac1f[_0x9ae9('0x39')]),_0x868eea);if(_0x3f806e['query']['filter']){_0x39fd86['where']=_[_0x9ae9('0x43')](_0x39fd86[_0x9ae9('0x41')],{'$or':_['map'](_0x868eea,function(_0x1bdb02){if(_0x1bdb02[_0x9ae9('0x34')]!==_0x9ae9('0x44')){var _0x27841c={};_0x27841c[_0x1bdb02[_0x9ae9('0x2d')]]={'$like':'%'+_0x3f806e['query'][_0x9ae9('0x45')]+'%'};return _0x27841c;}})});}_0x39fd86=_[_0x9ae9('0x43')]({},_0x39fd86,_0x3f806e['options']);var _0xfe39c1={'where':_0x39fd86[_0x9ae9('0x41')]};return db[_0x9ae9('0x31')]['count'](_0xfe39c1)[_0x9ae9('0x28')](function(_0x1f965c){_0x5ef2af[_0x9ae9('0x22')]=_0x1f965c;if(_0x3f806e[_0x9ae9('0x37')][_0x9ae9('0x46')]){_0x39fd86[_0x9ae9('0x47')]=[{'all':!![]}];}return db[_0x9ae9('0x31')]['findAll'](_0x39fd86);})[_0x9ae9('0x28')](function(_0x422227){_0x5ef2af[_0x9ae9('0x48')]=_0x422227;return _0x5ef2af;})['then'](respondWithFilteredResult(_0x56deb4,_0x39fd86))[_0x9ae9('0x49')](handleError(_0x56deb4,null));};exports['show']=function(_0x3f81f5,_0x47a75f){var _0x484f67={'raw':!![],'where':{'id':_0x3f81f5[_0x9ae9('0x4a')]['id']}},_0x5b6dc7={};_0x5b6dc7['model']=_['keys'](db[_0x9ae9('0x31')][_0x9ae9('0x32')]);_0x5b6dc7[_0x9ae9('0x37')]=_['keys'](_0x3f81f5[_0x9ae9('0x37')]);_0x5b6dc7[_0x9ae9('0x39')]=_[_0x9ae9('0x3a')](_0x5b6dc7[_0x9ae9('0x36')],_0x5b6dc7['query']);_0x484f67[_0x9ae9('0x3c')]=_['intersection'](_0x5b6dc7[_0x9ae9('0x36')],qs[_0x9ae9('0x3b')](_0x3f81f5[_0x9ae9('0x37')][_0x9ae9('0x3b')]));_0x484f67[_0x9ae9('0x3c')]=_0x484f67[_0x9ae9('0x3c')][_0x9ae9('0x4b')]?_0x484f67['attributes']:_0x5b6dc7[_0x9ae9('0x36')];if(_0x3f81f5[_0x9ae9('0x37')][_0x9ae9('0x46')]){_0x484f67['include']=[{'all':!![]}];}_0x484f67=_['merge']({},_0x484f67,_0x3f81f5['options']);return db[_0x9ae9('0x31')]['find'](_0x484f67)['then'](handleEntityNotFound(_0x47a75f,null))[_0x9ae9('0x28')](respondWithResult(_0x47a75f,null))[_0x9ae9('0x49')](handleError(_0x47a75f,null));};exports[_0x9ae9('0x4c')]=function(_0x2979b6,_0x2ab8a8){return db[_0x9ae9('0x31')]['create'](_0x2979b6[_0x9ae9('0x4d')],{})['then'](respondWithResult(_0x2ab8a8,0xc9))[_0x9ae9('0x49')](handleError(_0x2ab8a8,null));};exports[_0x9ae9('0x4e')]=function(_0x420577,_0x16237e){if(_0x420577[_0x9ae9('0x4d')]['id']){delete _0x420577[_0x9ae9('0x4d')]['id'];}return db[_0x9ae9('0x31')][_0x9ae9('0x4f')]({'where':{'id':_0x420577[_0x9ae9('0x4a')]['id']}})[_0x9ae9('0x28')](handleEntityNotFound(_0x16237e,null))[_0x9ae9('0x28')](saveUpdates(_0x420577[_0x9ae9('0x4d')],null))['then'](respondWithResult(_0x16237e,null))[_0x9ae9('0x49')](handleError(_0x16237e,null));};exports[_0x9ae9('0x29')]=function(_0x1f0c5e,_0x3e5d88){return db[_0x9ae9('0x31')]['find']({'where':{'id':_0x1f0c5e[_0x9ae9('0x4a')]['id']}})[_0x9ae9('0x28')](handleEntityNotFound(_0x3e5d88,null))[_0x9ae9('0x28')](removeEntity(_0x3e5d88,null))[_0x9ae9('0x49')](handleError(_0x3e5d88,null));};exports[_0x9ae9('0x50')]=function(_0x1db58b,_0xd9fae5){return db[_0x9ae9('0x31')][_0x9ae9('0x50')]()[_0x9ae9('0x28')](respondWithResult(_0xd9fae5,null))['catch'](handleError(_0xd9fae5,null));};function wrapUser(_0x516f79){return function(_0x210bb7){var _0x189e15=_0x516f79['get']({'plain':!![]});_0x189e15[_0x9ae9('0x51')]=[];if(_0x210bb7){_0x189e15[_0x9ae9('0x52')]=_0x210bb7[_0x9ae9('0x53')];_0x189e15['lastMessage']=_0x210bb7;}else{_0x189e15[_0x9ae9('0x52')]=moment(0x0)['format'](_0x9ae9('0x54'));_0x189e15['lastMessage']={};}return _0x189e15;};}exports[_0x9ae9('0x55')]=function(_0x2c53d9,_0x52bb6e,_0xddd5b){var _0x4cd45a=[];return db[_0x9ae9('0x56')][_0x9ae9('0x57')]({'where':{'role':[_0x9ae9('0x58'),'admin',_0x9ae9('0x59')]},'attributes':['id',_0x9ae9('0x5a'),_0x9ae9('0x2d'),'role',_0x9ae9('0x5b'),_0x9ae9('0x5c'),_0x9ae9('0x5d'),'lastLoginAt',_0x9ae9('0x5e'),_0x9ae9('0x5f')],'order':qs[_0x9ae9('0x60')]('-online'),'include':[{'model':db[_0x9ae9('0x61')],'as':'VoiceQueues','attributes':['id',_0x9ae9('0x2d'),_0x9ae9('0x34')],'through':{'attributes':[]}}]})['then'](function(_0x2795cf){if(_0x2795cf){var _0x3849ed=_0x2c53d9[_0x9ae9('0x59')][_0x9ae9('0x62')]({'plain':!![]});if(!_0x3849ed)throw new Error(_0x9ae9('0x63'));if(_0x3849ed['role']===_0x9ae9('0x59')){return db[_0x9ae9('0x64')]['find']({'where':{'name':_0x9ae9('0x65'),'userProfileId':_0x3849ed['userProfileId']},'raw':!![]})[_0x9ae9('0x28')](function(_0x1718a8){if(_0x1718a8){if(_0x1718a8[_0x9ae9('0x66')]===0x0){return db[_0x9ae9('0x67')][_0x9ae9('0x57')]({'where':{'sectionId':_0x1718a8['id']},'raw':!![]})['then'](function(_0x18d0c0){var _0x6f7e40=[];if(_[_0x9ae9('0x68')](_0x18d0c0)){_0x6f7e40=_[_0x9ae9('0x45')](_0x2795cf,function(_0x44cec7){if(_0x44cec7[_0x9ae9('0x69')]!==_0x9ae9('0x58')){return _0x44cec7;}});return _0x6f7e40;}else{for(var _0x34711e=0x0;_0x34711e<_0x2795cf[_0x9ae9('0x4b')];_0x34711e++){var _0x3720c1=_0x2795cf[_0x34711e];if(_0x3720c1[_0x9ae9('0x69')]===_0x9ae9('0x58')){var _0x10dee6=_[_0x9ae9('0x4f')](_0x18d0c0,function(_0xc6ffde){return _0xc6ffde['resourceId']===_0x3720c1['id'];});if(_0x10dee6)_0x6f7e40['push'](_0x3720c1);}else{_0x6f7e40[_0x9ae9('0x6a')](_0x3720c1);}}return _0x6f7e40;}});}else{return _0x2795cf;}}else{var _0x5f5aad=_['filter'](_0x2795cf,function(_0x362d77){if(_0x362d77['role']!=='agent'){return _0x362d77;}});return _0x5f5aad;}});}else{return _0x2795cf;}}})[_0x9ae9('0x28')](function(_0x5be81c){var _0x1f606b=[];if(_0x5be81c){_0x4cd45a=_0x5be81c;for(var _0x581557=0x0;_0x581557<_0x5be81c[_0x9ae9('0x4b')];_0x581557+=0x1){_0x4cd45a[_0x581557][_0x9ae9('0x51')]=[];_0x1f606b[_0x9ae9('0x6a')](db[_0x9ae9('0x31')]['find']({'where':{'FromId':[_0x2c53d9[_0x9ae9('0x59')]['id'],_0x5be81c[_0x581557]['id']],'ToId':[_0x2c53d9[_0x9ae9('0x59')]['id'],_0x5be81c[_0x581557]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x9ae9('0x6b'),_0x9ae9('0x6c'),'read',_0x9ae9('0x4d')],'order':qs[_0x9ae9('0x60')](_0x9ae9('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9ae9('0x28')](wrapUser(_0x5be81c[_0x581557])));}return BPromise[_0x9ae9('0x6e')](_0x1f606b);}return[];})[_0x9ae9('0x28')](function(_0x49bf99){return{'rows':_0x49bf99,'count':_0x49bf99[_0x9ae9('0x4b')]};})['then'](respondWithResult(_0x52bb6e,null))[_0x9ae9('0x49')](handleError(_0x52bb6e,null));}; \ No newline at end of file +var _0x94f4=['index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','update','body','describe','get','messages','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','user','role','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','push','createdAt','FromId','ToId','read','-createdAt','all','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','set','reject','then','destroy','error','name','send'];(function(_0x2ec688,_0x436cd5){var _0x1f9b88=function(_0x1e578e){while(--_0x1e578e){_0x2ec688['push'](_0x2ec688['shift']());}};_0x1f9b88(++_0x436cd5);}(_0x94f4,0x1e6));var _0x494f=function(_0x1da586,_0x476132){_0x1da586=_0x1da586-0x0;var _0x362c81=_0x94f4[_0x1da586];return _0x362c81;};'use strict';var pdf=require(_0x494f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x494f('0x1'));var zipdir=require(_0x494f('0x2'));var jsonpatch=require(_0x494f('0x3'));var rp=require(_0x494f('0x4'));var moment=require(_0x494f('0x5'));var BPromise=require(_0x494f('0x6'));var Mustache=require(_0x494f('0x7'));var util=require(_0x494f('0x8'));var path=require(_0x494f('0x9'));var sox=require(_0x494f('0xa'));var csv=require(_0x494f('0xb'));var ejs=require(_0x494f('0xc'));var fs=require('fs');var _=require(_0x494f('0xd'));var squel=require(_0x494f('0xe'));var crypto=require(_0x494f('0xf'));var jsforce=require(_0x494f('0x10'));var deskjs=require(_0x494f('0x11'));var toCsv=require(_0x494f('0xb'));var querystring=require(_0x494f('0x12'));var Papa=require('papaparse');var Redis=require(_0x494f('0x13'));var authService=require(_0x494f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x494f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x494f('0x16'))(_0x494f('0x17'));var utils=require(_0x494f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x494f('0x19'));var db=require(_0x494f('0x1a'))['db'];config[_0x494f('0x1b')]=_[_0x494f('0x1c')](config[_0x494f('0x1b')],{'host':_0x494f('0x1d'),'port':0x18eb});var socket=require(_0x494f('0x1e'))(new Redis(config[_0x494f('0x1b')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x3c4a34,_0x421680){_0x421680=_0x421680||0xcc;return function(_0x4ae1c9){if(_0x4ae1c9){return _0x3c4a34[_0x494f('0x1f')](_0x421680);}return _0x3c4a34[_0x494f('0x20')](_0x421680)[_0x494f('0x21')]();};}function respondWithResult(_0x2cca65,_0x4689ef){_0x4689ef=_0x4689ef||0xc8;return function(_0x12c154){if(_0x12c154){return _0x2cca65[_0x494f('0x20')](_0x4689ef)[_0x494f('0x22')](_0x12c154);}};}function respondWithFilteredResult(_0x5f0a23,_0x213086){return function(_0x293d32){if(_0x293d32){var _0x4d3b83=_0x293d32['count'],_0x75197f=_0x213086[_0x494f('0x23')],_0x12440e=_0x213086[_0x494f('0x23')]+_0x213086[_0x494f('0x24')],_0x5b2c6d;if(_0x12440e>=_0x4d3b83){_0x12440e=_0x4d3b83;_0x5b2c6d=0xc8;}else{_0x5b2c6d=0xce;}_0x5f0a23['status'](_0x5b2c6d);return _0x5f0a23[_0x494f('0x25')]('Content-Range',_0x75197f+'-'+_0x12440e+'/'+_0x4d3b83)[_0x494f('0x22')](_0x293d32);}return null;};}function patchUpdates(_0x6bcf45){return function(_0x106c73){try{jsonpatch['apply'](_0x106c73,_0x6bcf45,!![]);}catch(_0x20f642){return BPromise[_0x494f('0x26')](_0x20f642);}return _0x106c73['save']();};}function saveUpdates(_0x553e27,_0x4617d9){return function(_0x469b75){if(_0x469b75){return _0x469b75['update'](_0x553e27)[_0x494f('0x27')](function(_0x5f33f6){return _0x5f33f6;});}return null;};}function removeEntity(_0x24916f,_0x1edd84){return function(_0x594d51){if(_0x594d51){return _0x594d51[_0x494f('0x28')]()[_0x494f('0x27')](function(){_0x24916f['status'](0xcc)[_0x494f('0x21')]();});}};}function handleEntityNotFound(_0xb8226a,_0x4e91de){return function(_0x30dcd3){if(!_0x30dcd3){_0xb8226a[_0x494f('0x1f')](0x194);}return _0x30dcd3;};}function handleError(_0x125fcb,_0x56d370){_0x56d370=_0x56d370||0x1f4;return function(_0x4fe049){logger[_0x494f('0x29')](_0x4fe049['stack']);if(_0x4fe049[_0x494f('0x2a')]){delete _0x4fe049[_0x494f('0x2a')];}_0x125fcb['status'](_0x56d370)[_0x494f('0x2b')](_0x4fe049);};}exports[_0x494f('0x2c')]=function(_0x1aeb4e,_0x574c59){var _0x259112={},_0x24e6ba={},_0x1b1d21={'count':0x0,'rows':[]};var _0x3b3d9e=_['map'](db[_0x494f('0x2d')][_0x494f('0x2e')],function(_0x362187){return{'name':_0x362187[_0x494f('0x2f')],'type':_0x362187[_0x494f('0x30')][_0x494f('0x31')]};});_0x24e6ba[_0x494f('0x32')]=_[_0x494f('0x33')](_0x3b3d9e,_0x494f('0x2a'));_0x24e6ba[_0x494f('0x34')]=_[_0x494f('0x35')](_0x1aeb4e[_0x494f('0x34')]);_0x24e6ba[_0x494f('0x36')]=_[_0x494f('0x37')](_0x24e6ba[_0x494f('0x32')],_0x24e6ba[_0x494f('0x34')]);_0x259112[_0x494f('0x38')]=_[_0x494f('0x37')](_0x24e6ba['model'],qs[_0x494f('0x39')](_0x1aeb4e[_0x494f('0x34')][_0x494f('0x39')]));_0x259112[_0x494f('0x38')]=_0x259112[_0x494f('0x38')]['length']?_0x259112['attributes']:_0x24e6ba[_0x494f('0x32')];if(!_0x1aeb4e['query']['hasOwnProperty'](_0x494f('0x3a'))){_0x259112[_0x494f('0x24')]=qs['limit'](_0x1aeb4e[_0x494f('0x34')][_0x494f('0x24')]);_0x259112[_0x494f('0x23')]=qs[_0x494f('0x23')](_0x1aeb4e[_0x494f('0x34')]['offset']);}_0x259112[_0x494f('0x3b')]=qs[_0x494f('0x3c')](_0x1aeb4e[_0x494f('0x34')][_0x494f('0x3c')]);_0x259112[_0x494f('0x3d')]=qs[_0x494f('0x36')](_['pick'](_0x1aeb4e[_0x494f('0x34')],_0x24e6ba['filters']),_0x3b3d9e);if(_0x1aeb4e[_0x494f('0x34')][_0x494f('0x3e')]){_0x259112['where']=_[_0x494f('0x3f')](_0x259112[_0x494f('0x3d')],{'$or':_[_0x494f('0x33')](_0x3b3d9e,function(_0x114957){if(_0x114957[_0x494f('0x30')]!=='VIRTUAL'){var _0x5d13e9={};_0x5d13e9[_0x114957[_0x494f('0x2a')]]={'$like':'%'+_0x1aeb4e[_0x494f('0x34')]['filter']+'%'};return _0x5d13e9;}})});}_0x259112=_[_0x494f('0x3f')]({},_0x259112,_0x1aeb4e[_0x494f('0x40')]);var _0x1ec3ab={'where':_0x259112[_0x494f('0x3d')]};return db['ChatInternalMessage']['count'](_0x1ec3ab)[_0x494f('0x27')](function(_0x16cbbf){_0x1b1d21['count']=_0x16cbbf;if(_0x1aeb4e[_0x494f('0x34')][_0x494f('0x41')]){_0x259112[_0x494f('0x42')]=[{'all':!![]}];}return db[_0x494f('0x2d')][_0x494f('0x43')](_0x259112);})[_0x494f('0x27')](function(_0x1e3aae){_0x1b1d21[_0x494f('0x44')]=_0x1e3aae;return _0x1b1d21;})['then'](respondWithFilteredResult(_0x574c59,_0x259112))[_0x494f('0x45')](handleError(_0x574c59,null));};exports[_0x494f('0x46')]=function(_0x4145e2,_0x2aa595){var _0x5c1310={'raw':!![],'where':{'id':_0x4145e2[_0x494f('0x47')]['id']}},_0x5ebeda={};_0x5ebeda[_0x494f('0x32')]=_[_0x494f('0x35')](db[_0x494f('0x2d')][_0x494f('0x2e')]);_0x5ebeda[_0x494f('0x34')]=_['keys'](_0x4145e2['query']);_0x5ebeda[_0x494f('0x36')]=_[_0x494f('0x37')](_0x5ebeda['model'],_0x5ebeda[_0x494f('0x34')]);_0x5c1310[_0x494f('0x38')]=_[_0x494f('0x37')](_0x5ebeda[_0x494f('0x32')],qs[_0x494f('0x39')](_0x4145e2[_0x494f('0x34')][_0x494f('0x39')]));_0x5c1310[_0x494f('0x38')]=_0x5c1310[_0x494f('0x38')][_0x494f('0x48')]?_0x5c1310[_0x494f('0x38')]:_0x5ebeda[_0x494f('0x32')];if(_0x4145e2[_0x494f('0x34')][_0x494f('0x41')]){_0x5c1310[_0x494f('0x42')]=[{'all':!![]}];}_0x5c1310=_[_0x494f('0x3f')]({},_0x5c1310,_0x4145e2[_0x494f('0x40')]);return db[_0x494f('0x2d')][_0x494f('0x49')](_0x5c1310)[_0x494f('0x27')](handleEntityNotFound(_0x2aa595,null))[_0x494f('0x27')](respondWithResult(_0x2aa595,null))[_0x494f('0x45')](handleError(_0x2aa595,null));};exports['create']=function(_0x337bf2,_0x2e7d27){return db[_0x494f('0x2d')]['create'](_0x337bf2['body'],{})[_0x494f('0x27')](respondWithResult(_0x2e7d27,0xc9))[_0x494f('0x45')](handleError(_0x2e7d27,null));};exports[_0x494f('0x4a')]=function(_0x27c432,_0x2e50b3){if(_0x27c432['body']['id']){delete _0x27c432[_0x494f('0x4b')]['id'];}return db[_0x494f('0x2d')][_0x494f('0x49')]({'where':{'id':_0x27c432['params']['id']}})[_0x494f('0x27')](handleEntityNotFound(_0x2e50b3,null))[_0x494f('0x27')](saveUpdates(_0x27c432['body'],null))[_0x494f('0x27')](respondWithResult(_0x2e50b3,null))[_0x494f('0x45')](handleError(_0x2e50b3,null));};exports[_0x494f('0x28')]=function(_0x10d3cc,_0x4f12f8){return db['ChatInternalMessage'][_0x494f('0x49')]({'where':{'id':_0x10d3cc['params']['id']}})[_0x494f('0x27')](handleEntityNotFound(_0x4f12f8,null))[_0x494f('0x27')](removeEntity(_0x4f12f8,null))[_0x494f('0x45')](handleError(_0x4f12f8,null));};exports[_0x494f('0x4c')]=function(_0x5a22db,_0x30f922){return db[_0x494f('0x2d')][_0x494f('0x4c')]()[_0x494f('0x27')](respondWithResult(_0x30f922,null))[_0x494f('0x45')](handleError(_0x30f922,null));};function wrapUser(_0x5d75c6){return function(_0x162278){var _0x2f4a0d=_0x5d75c6[_0x494f('0x4d')]({'plain':!![]});_0x2f4a0d[_0x494f('0x4e')]=[];if(_0x162278){_0x2f4a0d[_0x494f('0x4f')]=_0x162278['createdAt'];_0x2f4a0d['lastMessage']=_0x162278;}else{_0x2f4a0d[_0x494f('0x4f')]=moment(0x0)['format'](_0x494f('0x50'));_0x2f4a0d[_0x494f('0x51')]={};}return _0x2f4a0d;};}exports[_0x494f('0x52')]=function(_0xe01b26,_0x1db2a6,_0xb93fb3){var _0x153d54=[];return db[_0x494f('0x53')][_0x494f('0x43')]({'where':{'role':[_0x494f('0x54'),'admin',_0x494f('0x55')]},'attributes':['id','fullname',_0x494f('0x2a'),_0x494f('0x56'),'userpic',_0x494f('0x57'),'online',_0x494f('0x58'),_0x494f('0x59'),_0x494f('0x5a')],'order':qs[_0x494f('0x3c')](_0x494f('0x5b')),'include':[{'model':db[_0x494f('0x5c')],'as':_0x494f('0x5d'),'attributes':['id',_0x494f('0x2a'),_0x494f('0x30')],'through':{'attributes':[]}}]})[_0x494f('0x27')](function(_0x55ce9e){if(_0x55ce9e){var _0x5ace64=_0xe01b26[_0x494f('0x55')][_0x494f('0x4d')]({'plain':!![]});if(!_0x5ace64)throw new Error(_0x494f('0x5e'));if(_0x5ace64['role']===_0x494f('0x55')){return db['UserProfileSection'][_0x494f('0x49')]({'where':{'name':_0x494f('0x5f'),'userProfileId':_0x5ace64[_0x494f('0x60')]},'raw':!![]})[_0x494f('0x27')](function(_0x1d04f9){if(_0x1d04f9){if(_0x1d04f9[_0x494f('0x61')]===0x0){return db[_0x494f('0x62')]['findAll']({'where':{'sectionId':_0x1d04f9['id']},'raw':!![]})[_0x494f('0x27')](function(_0x2bce12){var _0x17e2eb=[];if(_['isEmpty'](_0x2bce12)){_0x17e2eb=_[_0x494f('0x3e')](_0x55ce9e,function(_0x229cc9){if(_0x229cc9[_0x494f('0x56')]!==_0x494f('0x54')){return _0x229cc9;}});return _0x17e2eb;}else{for(var _0x52978c=0x0;_0x52978c<_0x55ce9e[_0x494f('0x48')];_0x52978c++){var _0x460011=_0x55ce9e[_0x52978c];if(_0x460011[_0x494f('0x56')]==='agent'){var _0x4a6092=_[_0x494f('0x49')](_0x2bce12,function(_0x58d325){return _0x58d325['resourceId']===_0x460011['id'];});if(_0x4a6092)_0x17e2eb[_0x494f('0x63')](_0x460011);}else{_0x17e2eb[_0x494f('0x63')](_0x460011);}}return _0x17e2eb;}});}else{return _0x55ce9e;}}else{var _0x3cb7e2=_[_0x494f('0x3e')](_0x55ce9e,function(_0x5c0fdf){if(_0x5c0fdf[_0x494f('0x56')]!=='agent'){return _0x5c0fdf;}});return _0x3cb7e2;}});}else{return _0x55ce9e;}}})['then'](function(_0x1f1356){var _0x5e2b71=[];if(_0x1f1356){_0x153d54=_0x1f1356;for(var _0x47010b=0x0;_0x47010b<_0x1f1356[_0x494f('0x48')];_0x47010b+=0x1){_0x153d54[_0x47010b][_0x494f('0x4e')]=[];_0x5e2b71[_0x494f('0x63')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0xe01b26[_0x494f('0x55')]['id'],_0x1f1356[_0x47010b]['id']],'ToId':[_0xe01b26[_0x494f('0x55')]['id'],_0x1f1356[_0x47010b]['id']],'ChatGroupId':null},'attributes':['id',_0x494f('0x64'),_0x494f('0x65'),_0x494f('0x66'),_0x494f('0x67'),_0x494f('0x4b')],'order':qs[_0x494f('0x3c')](_0x494f('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x1f1356[_0x47010b])));}return BPromise[_0x494f('0x69')](_0x5e2b71);}return[];})[_0x494f('0x27')](function(_0x4c92f5){return{'rows':_0x4c92f5,'count':_0x4c92f5['length']};})[_0x494f('0x27')](respondWithResult(_0x1db2a6,null))[_0x494f('0x45')](handleError(_0x1db2a6,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 0dab05e..76c16c1 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 _0x873a=['hasOwnProperty','exports','events','../../mysqldb','ChatInternalMessage','save','emit'];(function(_0xced98a,_0x5cb79a){var _0x2055db=function(_0x7c4807){while(--_0x7c4807){_0xced98a['push'](_0xced98a['shift']());}};_0x2055db(++_0x5cb79a);}(_0x873a,0x1c2));var _0xa873=function(_0x3d1d5c,_0xcf8251){_0x3d1d5c=_0x3d1d5c-0x0;var _0x472752=_0x873a[_0x3d1d5c];return _0x472752;};'use strict';var EventEmitter=require(_0xa873('0x0'));var ChatInternalMessage=require(_0xa873('0x1'))['db'][_0xa873('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa873('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x423a1a){return function(_0x46971d,_0x5a0d23,_0x3dc07e){ChatInternalMessageEvents[_0xa873('0x4')](_0x423a1a+':'+_0x46971d['id'],_0x46971d);ChatInternalMessageEvents['emit'](_0x423a1a,_0x46971d);_0x3dc07e(null);};}for(var e in events){if(events[_0xa873('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xa873('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x66cf=['hook','exports','events','ChatInternalMessage','setMaxListeners','update','remove','emit'];(function(_0x1e8994,_0xe673d4){var _0x4b6178=function(_0x535e6b){while(--_0x535e6b){_0x1e8994['push'](_0x1e8994['shift']());}};_0x4b6178(++_0xe673d4);}(_0x66cf,0x1a2));var _0xf66c=function(_0x19314b,_0x5e28dc){_0x19314b=_0x19314b-0x0;var _0x163fff=_0x66cf[_0x19314b];return _0x163fff;};'use strict';var EventEmitter=require(_0xf66c('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xf66c('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xf66c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf66c('0x3'),'afterDestroy':_0xf66c('0x4')};function emitEvent(_0x2c3dfc){return function(_0x206f93,_0x269433,_0x1a0af8){ChatInternalMessageEvents[_0xf66c('0x5')](_0x2c3dfc+':'+_0x206f93['id'],_0x206f93);ChatInternalMessageEvents['emit'](_0x2c3dfc,_0x206f93);_0x1a0af8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xf66c('0x6')](e,emitEvent(event));}}module[_0xf66c('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 16a3aa2..6ce2a95 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 _0xd8b0=['define','chat_internal_messages','utf8mb4','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x319d02,_0x3b1360){var _0x261946=function(_0x1acb1a){while(--_0x1acb1a){_0x319d02['push'](_0x319d02['shift']());}};_0x261946(++_0x3b1360);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatInternalMessage',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d8b('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4fc2=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1db8ef,_0x4c51a1){var _0x372d48=function(_0x2c1acf){while(--_0x2c1acf){_0x1db8ef['push'](_0x1db8ef['shift']());}};_0x372d48(++_0x4c51a1);}(_0x4fc2,0x111));var _0x24fc=function(_0x1909c7,_0x1f55b6){_0x1909c7=_0x1909c7-0x0;var _0x409d37=_0x4fc2[_0x1909c7];return _0x409d37;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x24fc('0xb'),'collate':_0x24fc('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index f2cfed9..68494e0 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 _0x5f88=['request\x20sent','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3b6093,_0x6a80a5){var _0x3d3d2c=function(_0x5ed37a){while(--_0x5ed37a){_0x3b6093['push'](_0x3b6093['shift']());}};_0x3d3d2c(++_0x6a80a5);}(_0x5f88,0x132));var _0x85f8=function(_0x55b66f,_0x7d4602){_0x55b66f=_0x55b66f-0x0;var _0x1036e2=_0x5f88[_0x55b66f];return _0x1036e2;};'use strict';var _=require(_0x85f8('0x0'));var util=require(_0x85f8('0x1'));var moment=require(_0x85f8('0x2'));var BPromise=require(_0x85f8('0x3'));var rs=require(_0x85f8('0x4'));var fs=require('fs');var Redis=require(_0x85f8('0x5'));var db=require(_0x85f8('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x85f8('0x7'));var jayson=require(_0x85f8('0x8'));var client=jayson['client'][_0x85f8('0x9')]({'port':0x232a});config['redis']=_[_0x85f8('0xa')](config[_0x85f8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x85f8('0xc'))(new Redis(config[_0x85f8('0xb')]));require(_0x85f8('0xd'))[_0x85f8('0xe')](socket);function respondWithRpcPromise(_0x547232,_0x452584,_0x46ea88){return new BPromise(function(_0x4cab95,_0x154652){return client[_0x85f8('0xf')](_0x547232,_0x46ea88)[_0x85f8('0x10')](function(_0x28a739){logger[_0x85f8('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x452584,'request\x20sent');logger['debug'](_0x85f8('0x12'),_0x452584,_0x85f8('0x13'),JSON[_0x85f8('0x14')](_0x28a739));if(_0x28a739[_0x85f8('0x15')]){if(_0x28a739['error']['code']===0x1f4){logger[_0x85f8('0x15')](_0x85f8('0x16'),_0x452584,_0x28a739[_0x85f8('0x15')]['message']);return _0x154652(_0x28a739[_0x85f8('0x15')][_0x85f8('0x17')]);}logger['error'](_0x85f8('0x16'),_0x452584,_0x28a739[_0x85f8('0x15')][_0x85f8('0x17')]);return _0x4cab95(_0x28a739[_0x85f8('0x15')]['message']);}else{logger[_0x85f8('0x11')](_0x85f8('0x16'),_0x452584,'request\x20sent');_0x4cab95(_0x28a739[_0x85f8('0x18')][_0x85f8('0x17')]);}})['catch'](function(_0x563270){logger['error'](_0x85f8('0x16'),_0x452584,_0x563270);_0x154652(_0x563270);});});} \ No newline at end of file +var _0xf61e=['localhost','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf61e,0xdf));var _0xef61=function(_0x445a9c,_0x51dbd9){_0x445a9c=_0x445a9c-0x0;var _0x28cf4f=_0xf61e[_0x445a9c];return _0x28cf4f;};'use strict';var _=require('lodash');var util=require(_0xef61('0x0'));var moment=require('moment');var BPromise=require(_0xef61('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef61('0x2'));var db=require(_0xef61('0x3'))['db'];var utils=require(_0xef61('0x4'));var logger=require('../../config/logger')(_0xef61('0x5'));var config=require(_0xef61('0x6'));var jayson=require(_0xef61('0x7'));var client=jayson[_0xef61('0x8')]['http']({'port':0x232a});config[_0xef61('0x9')]=_[_0xef61('0xa')](config['redis'],{'host':_0xef61('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef61('0x9')]));require(_0xef61('0xc'))[_0xef61('0xd')](socket);function respondWithRpcPromise(_0x4bf447,_0x322a74,_0x28ff8b){return new BPromise(function(_0x12858d,_0x575d26){return client[_0xef61('0xe')](_0x4bf447,_0x28ff8b)[_0xef61('0xf')](function(_0x54dfc4){logger['info'](_0xef61('0x10'),_0x322a74,_0xef61('0x11'));logger[_0xef61('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x322a74,'request\x20sent',JSON[_0xef61('0x13')](_0x54dfc4));if(_0x54dfc4[_0xef61('0x14')]){if(_0x54dfc4[_0xef61('0x14')][_0xef61('0x15')]===0x1f4){logger[_0xef61('0x14')](_0xef61('0x10'),_0x322a74,_0x54dfc4['error'][_0xef61('0x16')]);return _0x575d26(_0x54dfc4[_0xef61('0x14')][_0xef61('0x16')]);}logger[_0xef61('0x14')](_0xef61('0x10'),_0x322a74,_0x54dfc4['error'][_0xef61('0x16')]);return _0x12858d(_0x54dfc4[_0xef61('0x14')][_0xef61('0x16')]);}else{logger[_0xef61('0x17')](_0xef61('0x10'),_0x322a74,_0xef61('0x11'));_0x12858d(_0x54dfc4[_0xef61('0x18')][_0xef61('0x16')]);}})[_0xef61('0x19')](function(_0x16d28b){logger[_0xef61('0x14')](_0xef61('0x10'),_0x322a74,_0x16d28b);_0x575d26(_0x16d28b);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 8e64f14..7025b1e 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 _0x2285=['remove','update','emit','removeListener','register','length','chatInternalMessage:','save'];(function(_0x2db2aa,_0x32ce39){var _0x378415=function(_0x196bbc){while(--_0x196bbc){_0x2db2aa['push'](_0x2db2aa['shift']());}};_0x378415(++_0x32ce39);}(_0x2285,0x177));var _0x5228=function(_0x1dd7bf,_0x59a2b4){_0x1dd7bf=_0x1dd7bf-0x0;var _0x38bbca=_0x2285[_0x1dd7bf];return _0x38bbca;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x5228('0x0'),_0x5228('0x1'),_0x5228('0x2')];function createListener(_0x109405,_0x3d4b29){return function(_0x4f0eae){_0x3d4b29[_0x5228('0x3')](_0x109405,_0x4f0eae);};}function removeListener(_0x527cb3,_0x5bf024){return function(){ChatInternalMessageEvents[_0x5228('0x4')](_0x527cb3,_0x5bf024);};}exports[_0x5228('0x5')]=function(_0x322927){for(var _0x5ef1d3=0x0,_0x18b2db=events[_0x5228('0x6')];_0x5ef1d3<_0x18b2db;_0x5ef1d3++){var _0x192393=events[_0x5ef1d3];var _0x322b86=createListener(_0x5228('0x7')+_0x192393,_0x322927);ChatInternalMessageEvents['on'](_0x192393,_0x322b86);}}; \ No newline at end of file +var _0x9224=['update','removeListener','length','save','remove'];(function(_0x40453a,_0x1ff061){var _0x2da74d=function(_0x73e877){while(--_0x73e877){_0x40453a['push'](_0x40453a['shift']());}};_0x2da74d(++_0x1ff061);}(_0x9224,0xa3));var _0x4922=function(_0x5c7f64,_0x2352f5){_0x5c7f64=_0x5c7f64-0x0;var _0x36d391=_0x9224[_0x5c7f64];return _0x36d391;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x4922('0x0'),_0x4922('0x1'),_0x4922('0x2')];function createListener(_0x472129,_0x3517a1){return function(_0x3c8757){_0x3517a1['emit'](_0x472129,_0x3c8757);};}function removeListener(_0x582640,_0x572f8f){return function(){ChatInternalMessageEvents[_0x4922('0x3')](_0x582640,_0x572f8f);};}exports['register']=function(_0x12601a){for(var _0x1b7fc7=0x0,_0x4216c0=events[_0x4922('0x4')];_0x1b7fc7<_0x4216c0;_0x1b7fc7++){var _0x7a8bd1=events[_0x1b7fc7];var _0x245562=createListener('chatInternalMessage:'+_0x7a8bd1,_0x12601a);ChatInternalMessageEvents['on'](_0x7a8bd1,_0x245562);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 2814a30..4f8313f 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 _0xcb91=['isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x4ac8bc,_0x444013){var _0x3158a1=function(_0x450635){while(--_0x450635){_0x4ac8bc['push'](_0x4ac8bc['shift']());}};_0x3158a1(++_0x444013);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0xcb91[_0x231dda];return _0x3f88cb;};'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('./chatInternalMessage.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/users',auth[_0x1cb9('0x7')](),controller['getUsers']);router['get'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x7')](),controller['create']);router[_0x1cb9('0xd')](_0x1cb9('0xa'),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')](_0x1cb9('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=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(_0x55b714,_0x2a12a5){var _0x100ced=function(_0xb5b345){while(--_0xb5b345){_0x55b714['push'](_0x55b714['shift']());}};_0x100ced(++_0x2a12a5);}(_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 a1b2e7e..f285a70 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 _0xe1dc=['sequelize','exports','medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xe1dc,0x19e));var _0xce1d=function(_0x266eee,_0x3d2cca){_0x266eee=_0x266eee-0x0;var _0x10ac99=_0xe1dc[_0x266eee];return _0x10ac99;};'use strict';var Sequelize=require(_0xce1d('0x0'));module[_0xce1d('0x1')]={'body':{'type':Sequelize['TEXT'](_0xce1d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xce1d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xce1d('0x4')]('in',_0xce1d('0x5')),'defaultValue':_0xce1d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xce1d('0x6')]},'providerName':{'type':Sequelize[_0xce1d('0x7')]},'providerResponse':{'type':Sequelize[_0xce1d('0x8')]}}; \ No newline at end of file +var _0x7aca=['BOOLEAN','ENUM','out','DATE','STRING','TEXT','sequelize','exports','medium'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7aca,0x15c));var _0xa7ac=function(_0x376f01,_0x3dc90f){_0x376f01=_0x376f01-0x0;var _0x1b67eb=_0x7aca[_0x376f01];return _0x1b67eb;};'use strict';var Sequelize=require(_0xa7ac('0x0'));module[_0xa7ac('0x1')]={'body':{'type':Sequelize['TEXT'](_0xa7ac('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa7ac('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa7ac('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa7ac('0x4')]('in',_0xa7ac('0x5')),'defaultValue':_0xa7ac('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xa7ac('0x6')]},'providerName':{'type':Sequelize[_0xa7ac('0x7')]},'providerResponse':{'type':Sequelize[_0xa7ac('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 89f668f..5decbbc 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 _0x8497=['[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','parse','../../config/logger','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./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','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','destroy','name','map','rawAttributes','key','keys','model','intersection','fields','query','attributes','length','hasOwnProperty','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','ChatMessage','params','include','find','create','body','describe','chat-interactions','chat','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','update','isNil','read1stAt','format','interaction'];(function(_0x236ee4,_0x4e1a65){var _0x64e97f=function(_0x451976){while(--_0x451976){_0x236ee4['push'](_0x236ee4['shift']());}};_0x64e97f(++_0x4e1a65);}(_0x8497,0x157));var _0x7849=function(_0x15eba7,_0xe76fed){_0x15eba7=_0x15eba7-0x0;var _0x3c8522=_0x8497[_0x15eba7];return _0x3c8522;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7849('0x0'));var zipdir=require(_0x7849('0x1'));var jsonpatch=require(_0x7849('0x2'));var rp=require('request-promise');var moment=require(_0x7849('0x3'));var BPromise=require(_0x7849('0x4'));var Mustache=require(_0x7849('0x5'));var util=require('util');var path=require(_0x7849('0x6'));var sox=require(_0x7849('0x7'));var csv=require(_0x7849('0x8'));var ejs=require(_0x7849('0x9'));var fs=require('fs');var _=require(_0x7849('0xa'));var squel=require(_0x7849('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7849('0x8'));var querystring=require(_0x7849('0xc'));var Papa=require(_0x7849('0xd'));var Redis=require('ioredis');var authService=require(_0x7849('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7849('0xf'));var hardwareService=require(_0x7849('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7849('0x11'));var licenseUtil=require(_0x7849('0x12'));var db=require('../../mysqldb')['db'];config[_0x7849('0x13')]=_['defaults'](config['redis'],{'host':_0x7849('0x14'),'port':0x18eb});var socket=require(_0x7849('0x15'))(new Redis(config[_0x7849('0x13')]));require(_0x7849('0x16'))[_0x7849('0x17')](socket);var jayson=require(_0x7849('0x18'));var client=jayson[_0x7849('0x19')][_0x7849('0x1a')]({'port':0x232c});var client9002=jayson[_0x7849('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43ce8a,_0x55d2d0,_0x517a4e,_0x3a9860){return new BPromise(function(_0x18120c,_0x5b9439){var _0x5bfa89=_0x3a9860||client;return _0x5bfa89[_0x7849('0x1b')](_0x43ce8a,_0x517a4e)[_0x7849('0x1c')](function(_0x502e1e){logger[_0x7849('0x1d')](_0x7849('0x1e'),_0x55d2d0,'request\x20sent');logger[_0x7849('0x1f')](_0x7849('0x20'),_0x55d2d0,_0x7849('0x21'),JSON[_0x7849('0x22')](_0x502e1e));if(_0x502e1e[_0x7849('0x23')]){if(_0x502e1e[_0x7849('0x23')][_0x7849('0x24')]===0x1f4){logger[_0x7849('0x23')](_0x7849('0x1e'),_0x55d2d0,_0x502e1e['error'][_0x7849('0x25')]);return _0x5b9439(_0x502e1e[_0x7849('0x23')][_0x7849('0x25')]);}logger[_0x7849('0x23')](_0x7849('0x1e'),_0x55d2d0,_0x502e1e['error'][_0x7849('0x25')]);return _0x18120c(_0x502e1e[_0x7849('0x23')]['message']);}else{logger[_0x7849('0x1d')]('ChatMessage,\x20%s,\x20%s',_0x55d2d0,_0x7849('0x21'));_0x18120c(_0x502e1e[_0x7849('0x26')][_0x7849('0x25')]);}})[_0x7849('0x27')](function(_0x3ce345){logger['error'](_0x7849('0x1e'),_0x55d2d0,_0x3ce345);_0x5b9439(_0x3ce345);});});}function respondWithStatusCode(_0x57946a,_0x4d093d){_0x4d093d=_0x4d093d||0xcc;return function(_0x4e15b2){if(_0x4e15b2){return _0x57946a[_0x7849('0x28')](_0x4d093d);}return _0x57946a[_0x7849('0x29')](_0x4d093d)[_0x7849('0x2a')]();};}function respondWithResult(_0x3914a6,_0x2691a2){_0x2691a2=_0x2691a2||0xc8;return function(_0x5b4e62){if(_0x5b4e62){return _0x3914a6[_0x7849('0x29')](_0x2691a2)[_0x7849('0x2b')](_0x5b4e62);}};}function respondWithFilteredResult(_0xffd778,_0x19e30c){return function(_0x409cd0){if(_0x409cd0){var _0x4051ad=_0x409cd0[_0x7849('0x2c')],_0x39a1dd=_0x19e30c['offset'],_0x22ba09=_0x19e30c[_0x7849('0x2d')]+_0x19e30c[_0x7849('0x2e')],_0x24543b;if(_0x22ba09>=_0x4051ad){_0x22ba09=_0x4051ad;_0x24543b=0xc8;}else{_0x24543b=0xce;}_0xffd778[_0x7849('0x29')](_0x24543b);return _0xffd778['set'](_0x7849('0x2f'),_0x39a1dd+'-'+_0x22ba09+'/'+_0x4051ad)[_0x7849('0x2b')](_0x409cd0);}return null;};}function patchUpdates(_0x54c298){return function(_0x597f83){try{jsonpatch['apply'](_0x597f83,_0x54c298,!![]);}catch(_0x152429){return BPromise[_0x7849('0x30')](_0x152429);}return _0x597f83['save']();};}function saveUpdates(_0x56570a,_0x804afc){return function(_0x1ced62){if(_0x1ced62){return _0x1ced62['update'](_0x56570a)[_0x7849('0x1c')](function(_0x5bba2b){return _0x5bba2b;});}return null;};}function removeEntity(_0x36f697,_0x44f7e0){return function(_0x42c827){if(_0x42c827){return _0x42c827[_0x7849('0x31')]()[_0x7849('0x1c')](function(){_0x36f697[_0x7849('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ea3c1,_0x534ca9){return function(_0x56a6aa){if(!_0x56a6aa){_0x4ea3c1[_0x7849('0x28')](0x194);}return _0x56a6aa;};}function handleError(_0x433286,_0x257ec6){_0x257ec6=_0x257ec6||0x1f4;return function(_0x9a5f62){logger[_0x7849('0x23')](_0x9a5f62['stack']);if(_0x9a5f62[_0x7849('0x32')]){delete _0x9a5f62['name'];}_0x433286['status'](_0x257ec6)['send'](_0x9a5f62);};}exports['index']=function(_0x5b2380,_0x507bd6){var _0x20626c={},_0x47d876={},_0x2f3822={'count':0x0,'rows':[]};var _0x55a896=_[_0x7849('0x33')](db['ChatMessage'][_0x7849('0x34')],function(_0x88bc84){return{'name':_0x88bc84['fieldName'],'type':_0x88bc84['type'][_0x7849('0x35')]};});_0x47d876['model']=_[_0x7849('0x33')](_0x55a896,_0x7849('0x32'));_0x47d876['query']=_[_0x7849('0x36')](_0x5b2380['query']);_0x47d876['filters']=_['intersection'](_0x47d876[_0x7849('0x37')],_0x47d876['query']);_0x20626c['attributes']=_[_0x7849('0x38')](_0x47d876[_0x7849('0x37')],qs[_0x7849('0x39')](_0x5b2380[_0x7849('0x3a')][_0x7849('0x39')]));_0x20626c[_0x7849('0x3b')]=_0x20626c[_0x7849('0x3b')][_0x7849('0x3c')]?_0x20626c[_0x7849('0x3b')]:_0x47d876[_0x7849('0x37')];if(!_0x5b2380[_0x7849('0x3a')][_0x7849('0x3d')]('nolimit')){_0x20626c[_0x7849('0x2e')]=qs[_0x7849('0x2e')](_0x5b2380[_0x7849('0x3a')][_0x7849('0x2e')]);_0x20626c[_0x7849('0x2d')]=qs['offset'](_0x5b2380[_0x7849('0x3a')][_0x7849('0x2d')]);}_0x20626c['order']=qs[_0x7849('0x3e')](_0x5b2380[_0x7849('0x3a')]['sort']);_0x20626c[_0x7849('0x3f')]=qs[_0x7849('0x40')](_['pick'](_0x5b2380[_0x7849('0x3a')],_0x47d876[_0x7849('0x40')]),_0x55a896);if(_0x5b2380['query'][_0x7849('0x41')]){_0x20626c[_0x7849('0x3f')]=_[_0x7849('0x42')](_0x20626c['where'],{'$or':_['map'](_0x55a896,function(_0x5c98af){if(_0x5c98af[_0x7849('0x43')]!==_0x7849('0x44')){var _0x4671ea={};_0x4671ea[_0x5c98af[_0x7849('0x32')]]={'$like':'%'+_0x5b2380[_0x7849('0x3a')][_0x7849('0x41')]+'%'};return _0x4671ea;}})});}_0x20626c=_[_0x7849('0x42')]({},_0x20626c,_0x5b2380[_0x7849('0x45')]);var _0x3a99a6={'where':_0x20626c[_0x7849('0x3f')]};return db['ChatMessage'][_0x7849('0x2c')](_0x3a99a6)[_0x7849('0x1c')](function(_0x1b1971){_0x2f3822[_0x7849('0x2c')]=_0x1b1971;if(_0x5b2380[_0x7849('0x3a')][_0x7849('0x46')]){_0x20626c['include']=[{'all':!![]}];}return db[_0x7849('0x47')]['findAll'](_0x20626c);})[_0x7849('0x1c')](function(_0x476e49){_0x2f3822['rows']=_0x476e49;return _0x2f3822;})[_0x7849('0x1c')](respondWithFilteredResult(_0x507bd6,_0x20626c))[_0x7849('0x27')](handleError(_0x507bd6,null));};exports['show']=function(_0x959c0d,_0xa9d60d){var _0x3c08af={'raw':!![],'where':{'id':_0x959c0d[_0x7849('0x48')]['id']}},_0x16f69a={};_0x16f69a['model']=_[_0x7849('0x36')](db[_0x7849('0x47')][_0x7849('0x34')]);_0x16f69a[_0x7849('0x3a')]=_[_0x7849('0x36')](_0x959c0d['query']);_0x16f69a['filters']=_['intersection'](_0x16f69a[_0x7849('0x37')],_0x16f69a[_0x7849('0x3a')]);_0x3c08af[_0x7849('0x3b')]=_[_0x7849('0x38')](_0x16f69a[_0x7849('0x37')],qs[_0x7849('0x39')](_0x959c0d[_0x7849('0x3a')][_0x7849('0x39')]));_0x3c08af['attributes']=_0x3c08af[_0x7849('0x3b')][_0x7849('0x3c')]?_0x3c08af[_0x7849('0x3b')]:_0x16f69a[_0x7849('0x37')];if(_0x959c0d[_0x7849('0x3a')][_0x7849('0x46')]){_0x3c08af[_0x7849('0x49')]=[{'all':!![]}];}_0x3c08af=_[_0x7849('0x42')]({},_0x3c08af,_0x959c0d['options']);return db[_0x7849('0x47')][_0x7849('0x4a')](_0x3c08af)[_0x7849('0x1c')](handleEntityNotFound(_0xa9d60d,null))[_0x7849('0x1c')](respondWithResult(_0xa9d60d,null))['catch'](handleError(_0xa9d60d,null));};exports[_0x7849('0x4b')]=function(_0x32b9d4,_0x4be974){return db[_0x7849('0x47')][_0x7849('0x4b')](_0x32b9d4[_0x7849('0x4c')],{})[_0x7849('0x1c')](respondWithResult(_0x4be974,0xc9))[_0x7849('0x27')](handleError(_0x4be974,null));};exports['update']=function(_0x45ca00,_0x5664d1){if(_0x45ca00[_0x7849('0x4c')]['id']){delete _0x45ca00[_0x7849('0x4c')]['id'];}return db[_0x7849('0x47')][_0x7849('0x4a')]({'where':{'id':_0x45ca00['params']['id']}})[_0x7849('0x1c')](handleEntityNotFound(_0x5664d1,null))['then'](saveUpdates(_0x45ca00[_0x7849('0x4c')],null))[_0x7849('0x1c')](respondWithResult(_0x5664d1,null))[_0x7849('0x27')](handleError(_0x5664d1,null));};exports[_0x7849('0x31')]=function(_0x3ea141,_0xabcae5){return db[_0x7849('0x47')][_0x7849('0x4a')]({'where':{'id':_0x3ea141[_0x7849('0x48')]['id']}})[_0x7849('0x1c')](handleEntityNotFound(_0xabcae5,null))[_0x7849('0x1c')](removeEntity(_0xabcae5,null))[_0x7849('0x27')](handleError(_0xabcae5,null));};exports[_0x7849('0x4d')]=function(_0x14cab3,_0x429869){return db[_0x7849('0x47')][_0x7849('0x4d')]()[_0x7849('0x1c')](respondWithResult(_0x429869,null))[_0x7849('0x27')](handleError(_0x429869,null));};var interaction_log=require('../../config/logger')(_0x7849('0x4e'));exports['accept']=function(_0x270fd1,_0x422e5a,_0x4bd788){var _0x4f1f63={'channel':_0x7849('0x4f')};if(_0x270fd1[_0x7849('0x4c')]['id']){delete _0x270fd1[_0x7849('0x4c')]['id'];}_0x270fd1[_0x7849('0x4c')]['read']=!![];_0x270fd1['body'][_0x7849('0x50')]=moment()['format'](_0x7849('0x51'));_0x270fd1['body'][_0x7849('0x52')]=_0x270fd1[_0x7849('0x4c')]['UserId']||_0x270fd1[_0x7849('0x53')]['id'];return db[_0x7849('0x47')]['find']({'where':{'id':_0x270fd1[_0x7849('0x48')]['id'],'UserId':null},'include':[{'model':db[_0x7849('0x54')],'as':_0x7849('0x55')}]})[_0x7849('0x1c')](handleEntityNotFound(_0x422e5a,null))[_0x7849('0x1c')](saveUpdates(_0x270fd1['body'],null))['then'](function(_0x588569){if(_0x588569){_0x4f1f63[_0x7849('0x25')]=_0x588569[_0x7849('0x56')]({'plain':!![]});return db[_0x7849('0x57')][_0x7849('0x4a')]({'where':{'id':_0x588569['ChatInteractionId']}});}return null;})[_0x7849('0x1c')](handleEntityNotFound(_0x422e5a,null))[_0x7849('0x1c')](function(_0x345e0f){if(_0x345e0f){return _0x345e0f[_0x7849('0x58')]({'UserId':_0x270fd1[_0x7849('0x4c')][_0x7849('0x52')],'read1stAt':_[_0x7849('0x59')](_0x345e0f[_0x7849('0x5a')])?moment()[_0x7849('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x20290a){if(_0x20290a){_0x4f1f63[_0x7849('0x5c')]=_0x20290a[_0x7849('0x56')]({'plain':!![]});interaction_log[_0x7849('0x1d')](_0x7849('0x5d'),_0x270fd1[_0x7849('0x53')]['id'],_0x270fd1[_0x7849('0x53')][_0x7849('0x32')],_0x270fd1['user'][_0x7849('0x5e')],_0x4f1f63[_0x7849('0x5c')]['id'],_0x270fd1[_0x7849('0x4c')]?JSON[_0x7849('0x22')](_0x270fd1[_0x7849('0x4c')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x4f1f63);}return null;})['then'](function(_0x345002){if(_0x345002){if(_0x270fd1[_0x7849('0x4c')][_0x7849('0x5f')]){_0x4f1f63[_0x7849('0x25')][_0x7849('0x60')]=util[_0x7849('0x5b')](_0x7849('0x61'),_0x270fd1['user'][_0x7849('0x32')]);_0x4f1f63[_0x7849('0x25')][_0x7849('0x62')]=_0x4f1f63[_0x7849('0x62')];_0x4f1f63[_0x7849('0x25')][_0x7849('0x63')]=_0x7849('0x64');return respondWithRpcPromise(_0x7849('0x65'),_0x7849('0x65'),{'event':_0x7849('0x66'),'message':_[_0x7849('0x42')](_0x4f1f63[_0x7849('0x25')],JSON[_0x7849('0x67')](_0x4f1f63['interaction']['formData']))},client9002)[_0x7849('0x1c')](function(){return _0x4f1f63;});}return _0x4f1f63;}return null;})[_0x7849('0x1c')](respondWithResult(_0x422e5a,null))[_0x7849('0x27')](handleError(_0x422e5a,null));};var interaction_log=require(_0x7849('0x68'))(_0x7849('0x4e'));exports[_0x7849('0x30')]=function(_0x52306a,_0x437f42,_0x177043){var _0x22d338={'agent':{},'channel':'chat'};if(_0x52306a[_0x7849('0x4c')]['id']){delete _0x52306a[_0x7849('0x4c')]['id'];}_0x52306a[_0x7849('0x4c')][_0x7849('0x52')]=_0x52306a[_0x7849('0x4c')][_0x7849('0x52')]||_0x52306a[_0x7849('0x53')]['id'];_0x22d338['agent']['id']=_0x52306a[_0x7849('0x4c')]['UserId'];return db['ChatMessage']['find']({'where':{'id':_0x52306a[_0x7849('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x437f42,null))[_0x7849('0x1c')](function(_0x2e619f){if(_0x2e619f){_0x22d338[_0x7849('0x25')]=_0x2e619f['get']({'plain':!![]});return db[_0x7849('0x57')][_0x7849('0x4a')]({'where':{'id':_0x2e619f[_0x7849('0x69')]}});}return null;})[_0x7849('0x1c')](handleEntityNotFound(_0x437f42,null))['then'](function(_0x38d985){if(_0x38d985){_0x22d338[_0x7849('0x5c')]=_0x38d985[_0x7849('0x56')]({'plain':!![]});interaction_log[_0x7849('0x1d')](_0x7849('0x6a'),_0x52306a[_0x7849('0x53')]['id'],_0x52306a[_0x7849('0x53')]['name'],_0x52306a[_0x7849('0x53')]['role'],_0x22d338[_0x7849('0x5c')]['id'],_0x52306a[_0x7849('0x4c')]?JSON[_0x7849('0x22')](_0x52306a[_0x7849('0x4c')]):_0x7849('0x6b'));return respondWithRpcPromise('RejectMessage',_0x7849('0x6c'),_0x22d338);}return null;})[_0x7849('0x1c')](function(_0x24cf1f){if(_0x24cf1f){_0x24cf1f[_0x7849('0x25')][_0x7849('0x60')]=util[_0x7849('0x5b')](_0x7849('0x61'),_0x52306a[_0x7849('0x53')][_0x7849('0x32')]);_0x24cf1f[_0x7849('0x25')]['channel']=_0x22d338[_0x7849('0x62')];_0x24cf1f[_0x7849('0x25')][_0x7849('0x63')]='reject';respondWithRpcPromise(_0x7849('0x65'),'EventManager',{'event':'rejectmessage','message':_0x24cf1f[_0x7849('0x25')]},client9002);return _0x22d338;}return null;})['then'](respondWithResult(_0x437f42,null))['catch'](handleError(_0x437f42,null));}; \ No newline at end of file +var _0x7cc2=['create','body','describe','accept','chat','format','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','null','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','chat-interactions','reject','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','stack','name','index','map','ChatMessage','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','length','find'];(function(_0x2eb47c,_0x43bdf3){var _0x13097b=function(_0x1e6c94){while(--_0x1e6c94){_0x2eb47c['push'](_0x2eb47c['shift']());}};_0x13097b(++_0x43bdf3);}(_0x7cc2,0x18e));var _0x27cc=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x7cc2[_0x2080a3];return _0x8d7d17;};'use strict';var pdf=require(_0x27cc('0x0'));var emlformat=require(_0x27cc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x27cc('0x2'));var jsonpatch=require(_0x27cc('0x3'));var rp=require(_0x27cc('0x4'));var moment=require(_0x27cc('0x5'));var BPromise=require(_0x27cc('0x6'));var Mustache=require(_0x27cc('0x7'));var util=require(_0x27cc('0x8'));var path=require('path');var sox=require(_0x27cc('0x9'));var csv=require('to-csv');var ejs=require(_0x27cc('0xa'));var fs=require('fs');var _=require(_0x27cc('0xb'));var squel=require(_0x27cc('0xc'));var crypto=require('crypto');var jsforce=require(_0x27cc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x27cc('0xe'));var querystring=require(_0x27cc('0xf'));var Papa=require(_0x27cc('0x10'));var Redis=require(_0x27cc('0x11'));var authService=require(_0x27cc('0x12'));var qs=require(_0x27cc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27cc('0x14'));var logger=require(_0x27cc('0x15'))('api');var utils=require(_0x27cc('0x16'));var config=require(_0x27cc('0x17'));var licenseUtil=require(_0x27cc('0x18'));var db=require(_0x27cc('0x19'))['db'];config[_0x27cc('0x1a')]=_[_0x27cc('0x1b')](config[_0x27cc('0x1a')],{'host':_0x27cc('0x1c'),'port':0x18eb});var socket=require(_0x27cc('0x1d'))(new Redis(config[_0x27cc('0x1a')]));require(_0x27cc('0x1e'))[_0x27cc('0x1f')](socket);var jayson=require(_0x27cc('0x20'));var client=jayson[_0x27cc('0x21')]['http']({'port':0x232c});var client9002=jayson['client'][_0x27cc('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x404c06,_0x55f7d2,_0x26717d,_0x4d15fc){return new BPromise(function(_0x4c01f1,_0x5b14f3){var _0x46fdfe=_0x4d15fc||client;return _0x46fdfe[_0x27cc('0x23')](_0x404c06,_0x26717d)['then'](function(_0x22dbd6){logger[_0x27cc('0x24')](_0x27cc('0x25'),_0x55f7d2,_0x27cc('0x26'));logger[_0x27cc('0x27')](_0x27cc('0x28'),_0x55f7d2,'request\x20sent',JSON[_0x27cc('0x29')](_0x22dbd6));if(_0x22dbd6['error']){if(_0x22dbd6['error'][_0x27cc('0x2a')]===0x1f4){logger[_0x27cc('0x2b')](_0x27cc('0x25'),_0x55f7d2,_0x22dbd6[_0x27cc('0x2b')]['message']);return _0x5b14f3(_0x22dbd6['error']['message']);}logger[_0x27cc('0x2b')](_0x27cc('0x25'),_0x55f7d2,_0x22dbd6['error'][_0x27cc('0x2c')]);return _0x4c01f1(_0x22dbd6[_0x27cc('0x2b')]['message']);}else{logger['info'](_0x27cc('0x25'),_0x55f7d2,_0x27cc('0x26'));_0x4c01f1(_0x22dbd6[_0x27cc('0x2d')][_0x27cc('0x2c')]);}})[_0x27cc('0x2e')](function(_0x3282c5){logger[_0x27cc('0x2b')](_0x27cc('0x25'),_0x55f7d2,_0x3282c5);_0x5b14f3(_0x3282c5);});});}function respondWithStatusCode(_0x2ae7ce,_0x4efca1){_0x4efca1=_0x4efca1||0xcc;return function(_0x34dfa1){if(_0x34dfa1){return _0x2ae7ce['sendStatus'](_0x4efca1);}return _0x2ae7ce[_0x27cc('0x2f')](_0x4efca1)[_0x27cc('0x30')]();};}function respondWithResult(_0x162fab,_0x2ae2d2){_0x2ae2d2=_0x2ae2d2||0xc8;return function(_0x1d9bba){if(_0x1d9bba){return _0x162fab[_0x27cc('0x2f')](_0x2ae2d2)[_0x27cc('0x31')](_0x1d9bba);}};}function respondWithFilteredResult(_0x1d1c93,_0x2ed32f){return function(_0x158276){if(_0x158276){var _0x440361=_0x158276[_0x27cc('0x32')],_0x35b7b0=_0x2ed32f['offset'],_0x5e100e=_0x2ed32f[_0x27cc('0x33')]+_0x2ed32f[_0x27cc('0x34')],_0x5cd8c3;if(_0x5e100e>=_0x440361){_0x5e100e=_0x440361;_0x5cd8c3=0xc8;}else{_0x5cd8c3=0xce;}_0x1d1c93[_0x27cc('0x2f')](_0x5cd8c3);return _0x1d1c93[_0x27cc('0x35')](_0x27cc('0x36'),_0x35b7b0+'-'+_0x5e100e+'/'+_0x440361)[_0x27cc('0x31')](_0x158276);}return null;};}function patchUpdates(_0x49fe52){return function(_0x5257bb){try{jsonpatch[_0x27cc('0x37')](_0x5257bb,_0x49fe52,!![]);}catch(_0x47ac07){return BPromise['reject'](_0x47ac07);}return _0x5257bb['save']();};}function saveUpdates(_0x3ac7b0,_0x1cb58e){return function(_0x48f9e8){if(_0x48f9e8){return _0x48f9e8[_0x27cc('0x38')](_0x3ac7b0)[_0x27cc('0x39')](function(_0x17b402){return _0x17b402;});}return null;};}function removeEntity(_0x82abcc,_0x272550){return function(_0x45b483){if(_0x45b483){return _0x45b483[_0x27cc('0x3a')]()['then'](function(){_0x82abcc['status'](0xcc)[_0x27cc('0x30')]();});}};}function handleEntityNotFound(_0x563672,_0x3521a9){return function(_0x4e30bf){if(!_0x4e30bf){_0x563672['sendStatus'](0x194);}return _0x4e30bf;};}function handleError(_0x468cc3,_0x4f03db){_0x4f03db=_0x4f03db||0x1f4;return function(_0x202d76){logger['error'](_0x202d76[_0x27cc('0x3b')]);if(_0x202d76[_0x27cc('0x3c')]){delete _0x202d76[_0x27cc('0x3c')];}_0x468cc3[_0x27cc('0x2f')](_0x4f03db)['send'](_0x202d76);};}exports[_0x27cc('0x3d')]=function(_0x202893,_0x4bb675){var _0x45cdd0={},_0x3a8afb={},_0x16337f={'count':0x0,'rows':[]};var _0x23ad38=_[_0x27cc('0x3e')](db[_0x27cc('0x3f')]['rawAttributes'],function(_0x1110f8){return{'name':_0x1110f8[_0x27cc('0x40')],'type':_0x1110f8[_0x27cc('0x41')]['key']};});_0x3a8afb[_0x27cc('0x42')]=_[_0x27cc('0x3e')](_0x23ad38,'name');_0x3a8afb[_0x27cc('0x43')]=_['keys'](_0x202893[_0x27cc('0x43')]);_0x3a8afb[_0x27cc('0x44')]=_[_0x27cc('0x45')](_0x3a8afb[_0x27cc('0x42')],_0x3a8afb['query']);_0x45cdd0[_0x27cc('0x46')]=_['intersection'](_0x3a8afb['model'],qs[_0x27cc('0x47')](_0x202893[_0x27cc('0x43')][_0x27cc('0x47')]));_0x45cdd0[_0x27cc('0x46')]=_0x45cdd0[_0x27cc('0x46')]['length']?_0x45cdd0[_0x27cc('0x46')]:_0x3a8afb[_0x27cc('0x42')];if(!_0x202893[_0x27cc('0x43')][_0x27cc('0x48')]('nolimit')){_0x45cdd0[_0x27cc('0x34')]=qs['limit'](_0x202893['query']['limit']);_0x45cdd0['offset']=qs[_0x27cc('0x33')](_0x202893['query'][_0x27cc('0x33')]);}_0x45cdd0[_0x27cc('0x49')]=qs['sort'](_0x202893[_0x27cc('0x43')][_0x27cc('0x4a')]);_0x45cdd0[_0x27cc('0x4b')]=qs[_0x27cc('0x44')](_['pick'](_0x202893['query'],_0x3a8afb[_0x27cc('0x44')]),_0x23ad38);if(_0x202893[_0x27cc('0x43')]['filter']){_0x45cdd0[_0x27cc('0x4b')]=_[_0x27cc('0x4c')](_0x45cdd0[_0x27cc('0x4b')],{'$or':_[_0x27cc('0x3e')](_0x23ad38,function(_0x486aca){if(_0x486aca[_0x27cc('0x41')]!==_0x27cc('0x4d')){var _0x42a8ab={};_0x42a8ab[_0x486aca[_0x27cc('0x3c')]]={'$like':'%'+_0x202893[_0x27cc('0x43')][_0x27cc('0x4e')]+'%'};return _0x42a8ab;}})});}_0x45cdd0=_[_0x27cc('0x4c')]({},_0x45cdd0,_0x202893[_0x27cc('0x4f')]);var _0x418816={'where':_0x45cdd0['where']};return db[_0x27cc('0x3f')][_0x27cc('0x32')](_0x418816)['then'](function(_0x10ad94){_0x16337f['count']=_0x10ad94;if(_0x202893[_0x27cc('0x43')][_0x27cc('0x50')]){_0x45cdd0[_0x27cc('0x51')]=[{'all':!![]}];}return db[_0x27cc('0x3f')][_0x27cc('0x52')](_0x45cdd0);})[_0x27cc('0x39')](function(_0x395a48){_0x16337f[_0x27cc('0x53')]=_0x395a48;return _0x16337f;})[_0x27cc('0x39')](respondWithFilteredResult(_0x4bb675,_0x45cdd0))[_0x27cc('0x2e')](handleError(_0x4bb675,null));};exports[_0x27cc('0x54')]=function(_0x5a6f1c,_0x3b64c1){var _0x8e1f1f={'raw':!![],'where':{'id':_0x5a6f1c[_0x27cc('0x55')]['id']}},_0x5f367e={};_0x5f367e[_0x27cc('0x42')]=_[_0x27cc('0x56')](db[_0x27cc('0x3f')][_0x27cc('0x57')]);_0x5f367e[_0x27cc('0x43')]=_[_0x27cc('0x56')](_0x5a6f1c[_0x27cc('0x43')]);_0x5f367e[_0x27cc('0x44')]=_[_0x27cc('0x45')](_0x5f367e[_0x27cc('0x42')],_0x5f367e[_0x27cc('0x43')]);_0x8e1f1f['attributes']=_[_0x27cc('0x45')](_0x5f367e[_0x27cc('0x42')],qs[_0x27cc('0x47')](_0x5a6f1c[_0x27cc('0x43')][_0x27cc('0x47')]));_0x8e1f1f[_0x27cc('0x46')]=_0x8e1f1f[_0x27cc('0x46')][_0x27cc('0x58')]?_0x8e1f1f['attributes']:_0x5f367e[_0x27cc('0x42')];if(_0x5a6f1c[_0x27cc('0x43')][_0x27cc('0x50')]){_0x8e1f1f[_0x27cc('0x51')]=[{'all':!![]}];}_0x8e1f1f=_[_0x27cc('0x4c')]({},_0x8e1f1f,_0x5a6f1c[_0x27cc('0x4f')]);return db[_0x27cc('0x3f')][_0x27cc('0x59')](_0x8e1f1f)[_0x27cc('0x39')](handleEntityNotFound(_0x3b64c1,null))[_0x27cc('0x39')](respondWithResult(_0x3b64c1,null))['catch'](handleError(_0x3b64c1,null));};exports[_0x27cc('0x5a')]=function(_0x561fed,_0x40b48e){return db['ChatMessage'][_0x27cc('0x5a')](_0x561fed[_0x27cc('0x5b')],{})['then'](respondWithResult(_0x40b48e,0xc9))['catch'](handleError(_0x40b48e,null));};exports[_0x27cc('0x38')]=function(_0x1c7100,_0x2c4ca0){if(_0x1c7100[_0x27cc('0x5b')]['id']){delete _0x1c7100[_0x27cc('0x5b')]['id'];}return db[_0x27cc('0x3f')][_0x27cc('0x59')]({'where':{'id':_0x1c7100['params']['id']}})[_0x27cc('0x39')](handleEntityNotFound(_0x2c4ca0,null))['then'](saveUpdates(_0x1c7100['body'],null))[_0x27cc('0x39')](respondWithResult(_0x2c4ca0,null))[_0x27cc('0x2e')](handleError(_0x2c4ca0,null));};exports[_0x27cc('0x3a')]=function(_0x1e674b,_0x2f75a3){return db['ChatMessage'][_0x27cc('0x59')]({'where':{'id':_0x1e674b[_0x27cc('0x55')]['id']}})[_0x27cc('0x39')](handleEntityNotFound(_0x2f75a3,null))['then'](removeEntity(_0x2f75a3,null))['catch'](handleError(_0x2f75a3,null));};exports[_0x27cc('0x5c')]=function(_0x5b8434,_0x1a6b50){return db[_0x27cc('0x3f')]['describe']()[_0x27cc('0x39')](respondWithResult(_0x1a6b50,null))[_0x27cc('0x2e')](handleError(_0x1a6b50,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x27cc('0x5d')]=function(_0x3ab04d,_0x3ac1fc,_0x9e50e1){var _0x21dbd1={'channel':_0x27cc('0x5e')};if(_0x3ab04d[_0x27cc('0x5b')]['id']){delete _0x3ab04d[_0x27cc('0x5b')]['id'];}_0x3ab04d['body']['read']=!![];_0x3ab04d[_0x27cc('0x5b')]['readAt']=moment()[_0x27cc('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ab04d[_0x27cc('0x5b')][_0x27cc('0x60')]=_0x3ab04d[_0x27cc('0x5b')][_0x27cc('0x60')]||_0x3ab04d[_0x27cc('0x61')]['id'];return db[_0x27cc('0x3f')][_0x27cc('0x59')]({'where':{'id':_0x3ab04d[_0x27cc('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x27cc('0x62')],'as':_0x27cc('0x63')}]})['then'](handleEntityNotFound(_0x3ac1fc,null))[_0x27cc('0x39')](saveUpdates(_0x3ab04d[_0x27cc('0x5b')],null))[_0x27cc('0x39')](function(_0x3351c8){if(_0x3351c8){_0x21dbd1[_0x27cc('0x2c')]=_0x3351c8[_0x27cc('0x64')]({'plain':!![]});return db[_0x27cc('0x65')]['find']({'where':{'id':_0x3351c8[_0x27cc('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x3ac1fc,null))[_0x27cc('0x39')](function(_0x4b7d79){if(_0x4b7d79){return _0x4b7d79[_0x27cc('0x38')]({'UserId':_0x3ab04d['body']['UserId'],'read1stAt':_['isNil'](_0x4b7d79[_0x27cc('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x27cc('0x39')](function(_0x39db2a){if(_0x39db2a){_0x21dbd1[_0x27cc('0x68')]=_0x39db2a[_0x27cc('0x64')]({'plain':!![]});interaction_log[_0x27cc('0x24')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ab04d[_0x27cc('0x61')]['id'],_0x3ab04d[_0x27cc('0x61')][_0x27cc('0x3c')],_0x3ab04d[_0x27cc('0x61')]['role'],_0x21dbd1[_0x27cc('0x68')]['id'],_0x3ab04d['body']?JSON[_0x27cc('0x29')](_0x3ab04d[_0x27cc('0x5b')]):_0x27cc('0x69'));return respondWithRpcPromise('AcceptMessage',_0x27cc('0x6a'),_0x21dbd1);}return null;})[_0x27cc('0x39')](function(_0x390a66){if(_0x390a66){if(_0x3ab04d[_0x27cc('0x5b')][_0x27cc('0x6b')]){_0x21dbd1[_0x27cc('0x2c')][_0x27cc('0x6c')]=util[_0x27cc('0x5f')]('SIP/%s',_0x3ab04d[_0x27cc('0x61')][_0x27cc('0x3c')]);_0x21dbd1[_0x27cc('0x2c')][_0x27cc('0x6d')]=_0x21dbd1[_0x27cc('0x6d')];_0x21dbd1[_0x27cc('0x2c')][_0x27cc('0x6e')]=_0x27cc('0x5d');return respondWithRpcPromise(_0x27cc('0x6f'),_0x27cc('0x6f'),{'event':_0x27cc('0x70'),'message':_[_0x27cc('0x4c')](_0x21dbd1[_0x27cc('0x2c')],JSON['parse'](_0x21dbd1[_0x27cc('0x68')]['formData']))},client9002)[_0x27cc('0x39')](function(){return _0x21dbd1;});}return _0x21dbd1;}return null;})[_0x27cc('0x39')](respondWithResult(_0x3ac1fc,null))[_0x27cc('0x2e')](handleError(_0x3ac1fc,null));};var interaction_log=require(_0x27cc('0x15'))(_0x27cc('0x71'));exports[_0x27cc('0x72')]=function(_0x50e1b7,_0x47da31,_0x11247d){var _0x46683a={'agent':{},'channel':_0x27cc('0x5e')};if(_0x50e1b7[_0x27cc('0x5b')]['id']){delete _0x50e1b7[_0x27cc('0x5b')]['id'];}_0x50e1b7[_0x27cc('0x5b')][_0x27cc('0x60')]=_0x50e1b7[_0x27cc('0x5b')]['UserId']||_0x50e1b7[_0x27cc('0x61')]['id'];_0x46683a[_0x27cc('0x73')]['id']=_0x50e1b7['body'][_0x27cc('0x60')];return db[_0x27cc('0x3f')][_0x27cc('0x59')]({'where':{'id':_0x50e1b7[_0x27cc('0x55')]['id'],'UserId':null}})[_0x27cc('0x39')](handleEntityNotFound(_0x47da31,null))[_0x27cc('0x39')](function(_0xfd2df4){if(_0xfd2df4){_0x46683a[_0x27cc('0x2c')]=_0xfd2df4[_0x27cc('0x64')]({'plain':!![]});return db['ChatInteraction'][_0x27cc('0x59')]({'where':{'id':_0xfd2df4[_0x27cc('0x66')]}});}return null;})[_0x27cc('0x39')](handleEntityNotFound(_0x47da31,null))[_0x27cc('0x39')](function(_0x2a3d6b){if(_0x2a3d6b){_0x46683a[_0x27cc('0x68')]=_0x2a3d6b[_0x27cc('0x64')]({'plain':!![]});interaction_log[_0x27cc('0x24')](_0x27cc('0x74'),_0x50e1b7[_0x27cc('0x61')]['id'],_0x50e1b7['user'][_0x27cc('0x3c')],_0x50e1b7[_0x27cc('0x61')][_0x27cc('0x75')],_0x46683a[_0x27cc('0x68')]['id'],_0x50e1b7[_0x27cc('0x5b')]?JSON[_0x27cc('0x29')](_0x50e1b7[_0x27cc('0x5b')]):_0x27cc('0x69'));return respondWithRpcPromise(_0x27cc('0x76'),_0x27cc('0x77'),_0x46683a);}return null;})[_0x27cc('0x39')](function(_0x292284){if(_0x292284){_0x292284[_0x27cc('0x2c')][_0x27cc('0x6c')]=util[_0x27cc('0x5f')](_0x27cc('0x78'),_0x50e1b7[_0x27cc('0x61')][_0x27cc('0x3c')]);_0x292284[_0x27cc('0x2c')][_0x27cc('0x6d')]=_0x46683a[_0x27cc('0x6d')];_0x292284[_0x27cc('0x2c')][_0x27cc('0x6e')]=_0x27cc('0x72');respondWithRpcPromise(_0x27cc('0x6f'),_0x27cc('0x6f'),{'event':_0x27cc('0x79'),'message':_0x292284[_0x27cc('0x2c')]},client9002);return _0x46683a;}return null;})[_0x27cc('0x39')](respondWithResult(_0x47da31,null))['catch'](handleError(_0x47da31,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 7ed9b65..b304a7e 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 _0x5c87=['events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x550a61,_0x1c5d8c){var _0x248bfc=function(_0x38d79e){while(--_0x38d79e){_0x550a61['push'](_0x550a61['shift']());}};_0x248bfc(++_0x1c5d8c);}(_0x5c87,0x1ae));var _0x75c8=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x5c87[_0x334841];return _0x5beb4b;};'use strict';var EventEmitter=require(_0x75c8('0x0'));var ChatMessage=require(_0x75c8('0x1'))['db'][_0x75c8('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x75c8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x75c8('0x4'),'afterDestroy':_0x75c8('0x5')};function emitEvent(_0x53041e){return function(_0x38a1a5,_0x35bd14,_0x2ff63f){ChatMessageEvents[_0x75c8('0x6')](_0x53041e+':'+_0x38a1a5['id'],_0x38a1a5);ChatMessageEvents[_0x75c8('0x6')](_0x53041e,_0x38a1a5);_0x2ff63f(null);};}for(var e in events){if(events[_0x75c8('0x7')](e)){var event=events[e];ChatMessage[_0x75c8('0x8')](e,emitEvent(event));}}module[_0x75c8('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xfa7a=['emit','exports','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove'];(function(_0x33b640,_0x20e308){var _0x4b4a4f=function(_0x1789f6){while(--_0x1789f6){_0x33b640['push'](_0x33b640['shift']());}};_0x4b4a4f(++_0x20e308);}(_0xfa7a,0x132));var _0xafa7=function(_0x10eb15,_0x565eea){_0x10eb15=_0x10eb15-0x0;var _0x38a11a=_0xfa7a[_0x10eb15];return _0x38a11a;};'use strict';var EventEmitter=require(_0xafa7('0x0'));var ChatMessage=require(_0xafa7('0x1'))['db'][_0xafa7('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xafa7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xafa7('0x4'),'afterDestroy':_0xafa7('0x5')};function emitEvent(_0x5334e0){return function(_0x27b340,_0x4fef19,_0x8b2586){ChatMessageEvents[_0xafa7('0x6')](_0x5334e0+':'+_0x27b340['id'],_0x27b340);ChatMessageEvents[_0xafa7('0x6')](_0x5334e0,_0x27b340);_0x8b2586(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xafa7('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index fbaa2a0..ad471e3 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 _0x926a=['error','utf8mb4','utf8mb4_unicode_ci','lodash','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','body','get','direction','toLowerCase','secret','isNil','findOne','update','createdAt','catch'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0x926a,0x145));var _0xa926=function(_0x31f26e,_0xd520be){_0x31f26e=_0x31f26e-0x0;var _0x6a4a78=_0x926a[_0x31f26e];return _0x6a4a78;};'use strict';var _=require(_0xa926('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa926('0x1'));var BPromise=require('bluebird');var rp=require(_0xa926('0x2'));var fs=require('fs');var path=require(_0xa926('0x3'));var rimraf=require(_0xa926('0x4'));var config=require(_0xa926('0x5'));var attributes=require(_0xa926('0x6'));module['exports']=function(_0x47b3b8,_0x390fcf){return _0x47b3b8[_0xa926('0x7')]('ChatMessage',attributes,{'tableName':_0xa926('0x8'),'paranoid':![],'indexes':[{'name':_0xa926('0x9'),'fields':[_0xa926('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50773c,_0x1a7f38,_0x2b2742){var _0xb0b4fc=_0x47b3b8['models'];var _0x1cce01=_0x50773c[_0xa926('0xb')]({'plain':!![]});if(_0x1cce01[_0xa926('0xc')][_0xa926('0xd')]()==='in'||_0x1cce01[_0xa926('0xc')]['toLowerCase']()==='out'&&!_0x1cce01[_0xa926('0xe')]&&!_[_0xa926('0xf')](_0x1cce01['UserId'])){_0xb0b4fc['ChatInteraction'][_0xa926('0x10')]({'where':{'id':_0x1cce01['ChatInteractionId']}})['then'](function(_0xc0dedb){if(_0xc0dedb){_0xc0dedb[_0xa926('0x11')]({'lastMsgAt':_0x1cce01[_0xa926('0x12')],'lastMsgDirection':_0x1cce01[_0xa926('0xc')][_0xa926('0xd')]()});}})[_0xa926('0x13')](function(_0x44a188){console[_0xa926('0x14')](_0x44a188);});}_0x2b2742();}},'charset':_0xa926('0x15'),'collate':_0xa926('0x16')});}; \ No newline at end of file +var _0xb9f1=['toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','body','get','direction'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0xb9f1,0xb5));var _0x1b9f=function(_0x16a6f7,_0x4ba2d2){_0x16a6f7=_0x16a6f7-0x0;var _0x12d8bf=_0xb9f1[_0x16a6f7];return _0x12d8bf;};'use strict';var _=require(_0x1b9f('0x0'));var util=require(_0x1b9f('0x1'));var logger=require(_0x1b9f('0x2'))(_0x1b9f('0x3'));var moment=require(_0x1b9f('0x4'));var BPromise=require(_0x1b9f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b9f('0x6'));var rimraf=require('rimraf');var config=require(_0x1b9f('0x7'));var attributes=require(_0x1b9f('0x8'));module[_0x1b9f('0x9')]=function(_0x373ef6,_0x38a571){return _0x373ef6[_0x1b9f('0xa')]('ChatMessage',attributes,{'tableName':_0x1b9f('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x1b9f('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a63bd,_0x147734,_0x22d0cf){var _0x2fbbf9=_0x373ef6['models'];var _0x38d9ab=_0x5a63bd[_0x1b9f('0xd')]({'plain':!![]});if(_0x38d9ab[_0x1b9f('0xe')][_0x1b9f('0xf')]()==='in'||_0x38d9ab['direction'][_0x1b9f('0xf')]()===_0x1b9f('0x10')&&!_0x38d9ab[_0x1b9f('0x11')]&&!_[_0x1b9f('0x12')](_0x38d9ab[_0x1b9f('0x13')])){_0x2fbbf9[_0x1b9f('0x14')][_0x1b9f('0x15')]({'where':{'id':_0x38d9ab[_0x1b9f('0x16')]}})[_0x1b9f('0x17')](function(_0x4ef62f){if(_0x4ef62f){_0x4ef62f['update']({'lastMsgAt':_0x38d9ab['createdAt'],'lastMsgDirection':_0x38d9ab[_0x1b9f('0xe')][_0x1b9f('0xf')]()});}})[_0x1b9f('0x18')](function(_0x53e87e){console[_0x1b9f('0x19')](_0x53e87e);});}_0x22d0cf();}},'charset':_0x1b9f('0x1a'),'collate':_0x1b9f('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 1944053..b58155f 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 _0xb7a9=['stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','ChatMessage','create','options','CreateChatMessage','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x26a4bc,_0x4b9dfe){var _0x1f29dd=function(_0x19f318){while(--_0x19f318){_0x26a4bc['push'](_0x26a4bc['shift']());}};_0x1f29dd(++_0x4b9dfe);}(_0xb7a9,0x1a3));var _0x9b7a=function(_0x4121cf,_0x225336){_0x4121cf=_0x4121cf-0x0;var _0xb88e5f=_0xb7a9[_0x4121cf];return _0xb88e5f;};'use strict';var _=require(_0x9b7a('0x0'));var util=require(_0x9b7a('0x1'));var moment=require(_0x9b7a('0x2'));var BPromise=require(_0x9b7a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b7a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b7a('0x5'));var logger=require(_0x9b7a('0x6'))(_0x9b7a('0x7'));var config=require(_0x9b7a('0x8'));var jayson=require(_0x9b7a('0x9'));var client=jayson[_0x9b7a('0xa')][_0x9b7a('0xb')]({'port':0x232a});config[_0x9b7a('0xc')]=_[_0x9b7a('0xd')](config[_0x9b7a('0xc')],{'host':_0x9b7a('0xe'),'port':0x18eb});var socket=require(_0x9b7a('0xf'))(new Redis(config['redis']));require(_0x9b7a('0x10'))[_0x9b7a('0x11')](socket);function respondWithRpcPromise(_0x4500c4,_0x507d10,_0x31a7f6){return new BPromise(function(_0x16ad55,_0x5c1fe9){return client['request'](_0x4500c4,_0x31a7f6)[_0x9b7a('0x12')](function(_0x2f38db){logger[_0x9b7a('0x13')]('ChatMessage,\x20%s,\x20%s',_0x507d10,_0x9b7a('0x14'));logger[_0x9b7a('0x15')](_0x9b7a('0x16'),_0x507d10,_0x9b7a('0x14'),JSON[_0x9b7a('0x17')](_0x2f38db));if(_0x2f38db[_0x9b7a('0x18')]){if(_0x2f38db[_0x9b7a('0x18')][_0x9b7a('0x19')]===0x1f4){logger[_0x9b7a('0x18')](_0x9b7a('0x1a'),_0x507d10,_0x2f38db[_0x9b7a('0x18')][_0x9b7a('0x1b')]);return _0x5c1fe9(_0x2f38db[_0x9b7a('0x18')][_0x9b7a('0x1b')]);}logger[_0x9b7a('0x18')](_0x9b7a('0x1a'),_0x507d10,_0x2f38db[_0x9b7a('0x18')][_0x9b7a('0x1b')]);return _0x16ad55(_0x2f38db['error']['message']);}else{logger[_0x9b7a('0x13')](_0x9b7a('0x1a'),_0x507d10,'request\x20sent');_0x16ad55(_0x2f38db[_0x9b7a('0x1c')][_0x9b7a('0x1b')]);}})['catch'](function(_0x14f00d){logger[_0x9b7a('0x18')](_0x9b7a('0x1a'),_0x507d10,_0x14f00d);_0x5c1fe9(_0x14f00d);});});}exports['CreateChatMessage']=function(_0x57e8e7){var _0x1ddf81=this;return new Promise(function(_0x33c33a,_0x5d29b5){return db[_0x9b7a('0x1d')][_0x9b7a('0x1e')](_0x57e8e7['body'],{'raw':_0x57e8e7[_0x9b7a('0x1f')]?_0x57e8e7[_0x9b7a('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x9b7a('0x12')](function(_0x2c1a26){logger[_0x9b7a('0x13')](_0x9b7a('0x20'),_0x57e8e7);logger[_0x9b7a('0x15')]('CreateChatMessage',_0x57e8e7,JSON['stringify'](_0x2c1a26));_0x33c33a(_0x2c1a26);})[_0x9b7a('0x21')](function(_0x5646bb){logger[_0x9b7a('0x18')](_0x9b7a('0x20'),_0x5646bb[_0x9b7a('0x1b')],_0x57e8e7);_0x5d29b5(_0x1ddf81[_0x9b7a('0x18')](0x1f4,_0x5646bb[_0x9b7a('0x1b')]));});});}; \ No newline at end of file +var _0x701d=['../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','request\x20sent','debug','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','info','catch','create','options','raw','CreateChatMessage','util','moment','ioredis','../../mysqldb'];(function(_0x40beff,_0x4868ba){var _0x30c914=function(_0x2e4eeb){while(--_0x2e4eeb){_0x40beff['push'](_0x40beff['shift']());}};_0x30c914(++_0x4868ba);}(_0x701d,0x13b));var _0xd701=function(_0x2861c8,_0x226fea){_0x2861c8=_0x2861c8-0x0;var _0x491800=_0x701d[_0x2861c8];return _0x491800;};'use strict';var _=require('lodash');var util=require(_0xd701('0x0'));var moment=require(_0xd701('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd701('0x2'));var db=require(_0xd701('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd701('0x4'))(_0xd701('0x5'));var config=require(_0xd701('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd701('0x7')]({'port':0x232a});config[_0xd701('0x8')]=_[_0xd701('0x9')](config[_0xd701('0x8')],{'host':_0xd701('0xa'),'port':0x18eb});var socket=require(_0xd701('0xb'))(new Redis(config[_0xd701('0x8')]));require(_0xd701('0xc'))[_0xd701('0xd')](socket);function respondWithRpcPromise(_0x18863f,_0x300dd6,_0x4cba54){return new BPromise(function(_0x465b07,_0x1b06dd){return client[_0xd701('0xe')](_0x18863f,_0x4cba54)[_0xd701('0xf')](function(_0x53e65a){logger['info']('ChatMessage,\x20%s,\x20%s',_0x300dd6,_0xd701('0x10'));logger[_0xd701('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x300dd6,'request\x20sent',JSON[_0xd701('0x12')](_0x53e65a));if(_0x53e65a['error']){if(_0x53e65a[_0xd701('0x13')][_0xd701('0x14')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x300dd6,_0x53e65a[_0xd701('0x13')][_0xd701('0x15')]);return _0x1b06dd(_0x53e65a[_0xd701('0x13')][_0xd701('0x15')]);}logger[_0xd701('0x13')](_0xd701('0x16'),_0x300dd6,_0x53e65a[_0xd701('0x13')]['message']);return _0x465b07(_0x53e65a['error'][_0xd701('0x15')]);}else{logger[_0xd701('0x17')](_0xd701('0x16'),_0x300dd6,_0xd701('0x10'));_0x465b07(_0x53e65a['result'][_0xd701('0x15')]);}})[_0xd701('0x18')](function(_0x59b229){logger[_0xd701('0x13')](_0xd701('0x16'),_0x300dd6,_0x59b229);_0x1b06dd(_0x59b229);});});}exports['CreateChatMessage']=function(_0x464795){var _0x167c27=this;return new Promise(function(_0x1b479e,_0x4b25a8){return db['ChatMessage'][_0xd701('0x19')](_0x464795['body'],{'raw':_0x464795[_0xd701('0x1a')]?_0x464795['options'][_0xd701('0x1b')]===undefined?!![]:![]:!![]})[_0xd701('0xf')](function(_0x3e20da){logger[_0xd701('0x17')](_0xd701('0x1c'),_0x464795);logger[_0xd701('0x11')](_0xd701('0x1c'),_0x464795,JSON[_0xd701('0x12')](_0x3e20da));_0x1b479e(_0x3e20da);})[_0xd701('0x18')](function(_0x40203e){logger[_0xd701('0x13')](_0xd701('0x1c'),_0x40203e['message'],_0x464795);_0x4b25a8(_0x167c27[_0xd701('0x13')](0x1f4,_0x40203e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 7854fb8..50d49e2 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 _0x4c60=['chatMessage:','./chatMessage.events','save','remove','update','removeListener','register','length'];(function(_0xd33788,_0x317c5b){var _0x34d5b9=function(_0x5cc37b){while(--_0x5cc37b){_0xd33788['push'](_0xd33788['shift']());}};_0x34d5b9(++_0x317c5b);}(_0x4c60,0xc1));var _0x04c6=function(_0x4f2404,_0x50da08){_0x4f2404=_0x4f2404-0x0;var _0x262164=_0x4c60[_0x4f2404];return _0x262164;};'use strict';var ChatMessageEvents=require(_0x04c6('0x0'));var events=[_0x04c6('0x1'),_0x04c6('0x2'),_0x04c6('0x3')];function createListener(_0x5ba768,_0x2a1d36){return function(_0x5d9fa3){_0x2a1d36['emit'](_0x5ba768,_0x5d9fa3);};}function removeListener(_0x4ad4f1,_0x53ca7a){return function(){ChatMessageEvents[_0x04c6('0x4')](_0x4ad4f1,_0x53ca7a);};}exports[_0x04c6('0x5')]=function(_0x2054da){for(var _0x12bd5d=0x0,_0x2b9041=events[_0x04c6('0x6')];_0x12bd5d<_0x2b9041;_0x12bd5d++){var _0x8f9b13=events[_0x12bd5d];var _0x530a48=createListener(_0x04c6('0x7')+_0x8f9b13,_0x2054da);ChatMessageEvents['on'](_0x8f9b13,_0x530a48);}}; \ No newline at end of file +var _0xc4aa=['remove','update','removeListener','register','length','./chatMessage.events','save'];(function(_0x3da2ab,_0x281119){var _0x4537dd=function(_0x5b88c7){while(--_0x5b88c7){_0x3da2ab['push'](_0x3da2ab['shift']());}};_0x4537dd(++_0x281119);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc4aa[_0x273c39];return _0x46d6b5;};'use strict';var ChatMessageEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){ChatMessageEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('chatMessage:'+_0x10525b,_0x215f39);ChatMessageEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 364bab8..a9cf3a1 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 _0x30c9=['path','connect-timeout','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x345215,_0x1f9713){var _0x30cab1=function(_0x5795fa){while(--_0x5795fa){_0x345215['push'](_0x345215['shift']());}};_0x30cab1(++_0x1f9713);}(_0x30c9,0x151));var _0x930c=function(_0x199d29,_0x446de7){_0x199d29=_0x199d29-0x0;var _0x2225b5=_0x30c9[_0x199d29];return _0x2225b5;};'use strict';var multer=require(_0x930c('0x0'));var util=require('util');var path=require(_0x930c('0x1'));var timeout=require(_0x930c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x930c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x930c('0x4'));var controller=require(_0x930c('0x5'));router[_0x930c('0x6')]('/',auth[_0x930c('0x7')](),controller[_0x930c('0x8')]);router[_0x930c('0x6')](_0x930c('0x9'),auth['isAuthenticated'](),controller[_0x930c('0xa')]);router[_0x930c('0x6')](_0x930c('0xb'),auth['isAuthenticated'](),controller[_0x930c('0xc')]);router[_0x930c('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x930c('0xe'),_0x930c('0xf')),controller[_0x930c('0x10')]);router[_0x930c('0x11')](_0x930c('0xb'),controller[_0x930c('0x12')]);router['put'](_0x930c('0x13'),auth[_0x930c('0x7')](),controller[_0x930c('0x14')]);router['put'](_0x930c('0x15'),auth[_0x930c('0x7')](),controller[_0x930c('0x16')]);router[_0x930c('0x17')](_0x930c('0xb'),auth['isAuthenticated'](),controller[_0x930c('0x18')]);module[_0x930c('0x19')]=router; \ No newline at end of file +var _0x0756=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','post','chat','chatmessage:create','create','put','update','/:id/accept','/:id/reject','reject','destroy','multer','util','connect-timeout','express'];(function(_0x552c70,_0x3e42ed){var _0x14a5de=function(_0x9a4c2d){while(--_0x9a4c2d){_0x552c70['push'](_0x552c70['shift']());}};_0x14a5de(++_0x3e42ed);}(_0x0756,0x74));var _0x6075=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x0756[_0x5f0089];return _0x193892;};'use strict';var multer=require(_0x6075('0x0'));var util=require(_0x6075('0x1'));var path=require('path');var timeout=require(_0x6075('0x2'));var express=require(_0x6075('0x3'));var router=express['Router']();var auth=require(_0x6075('0x4'));var interaction=require(_0x6075('0x5'));var config=require(_0x6075('0x6'));var controller=require(_0x6075('0x7'));router[_0x6075('0x8')]('/',auth['isAuthenticated'](),controller[_0x6075('0x9')]);router[_0x6075('0x8')](_0x6075('0xa'),auth[_0x6075('0xb')](),controller[_0x6075('0xc')]);router[_0x6075('0x8')](_0x6075('0xd'),auth[_0x6075('0xb')](),controller['show']);router[_0x6075('0xe')]('/',auth[_0x6075('0xb')](),interaction['tracked'](_0x6075('0xf'),_0x6075('0x10')),controller[_0x6075('0x11')]);router[_0x6075('0x12')](_0x6075('0xd'),controller[_0x6075('0x13')]);router[_0x6075('0x12')](_0x6075('0x14'),auth['isAuthenticated'](),controller['accept']);router[_0x6075('0x12')](_0x6075('0x15'),auth[_0x6075('0xb')](),controller[_0x6075('0x16')]);router['delete'](_0x6075('0xd'),auth[_0x6075('0xb')](),controller[_0x6075('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 0d1eb43..677da54 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 _0xd3e2=['sequelize','exports','TEXT'];(function(_0x34b204,_0x175f04){var _0x321b29=function(_0x22fa4e){while(--_0x22fa4e){_0x34b204['push'](_0x34b204['shift']());}};_0x321b29(++_0x175f04);}(_0xd3e2,0xd2));var _0x2d3e=function(_0x5b54e3,_0xf0fac){_0x5b54e3=_0x5b54e3-0x0;var _0x72cd9b=_0xd3e2[_0x5b54e3];return _0x72cd9b;};'use strict';var Sequelize=require(_0x2d3e('0x0'));module[_0x2d3e('0x1')]={'body':{'type':Sequelize[_0x2d3e('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xac7c=['TEXT','medium','exports'];(function(_0x3290a2,_0xc3b7e0){var _0x168575=function(_0x155538){while(--_0x155538){_0x3290a2['push'](_0x3290a2['shift']());}};_0x168575(++_0xc3b7e0);}(_0xac7c,0x185));var _0xcac7=function(_0x1bb812,_0x23eacc){_0x1bb812=_0x1bb812-0x0;var _0x372adb=_0xac7c[_0x1bb812];return _0x372adb;};'use strict';var Sequelize=require('sequelize');module[_0xcac7('0x0')]={'body':{'type':Sequelize[_0xcac7('0x1')](_0xcac7('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index b7389fe..2e938e7 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 _0x4808=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','ChatOfflineMessage','includeAll','include','findAll','rows','show','fields','find','catch','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','then','destroy','stack','name','index','map','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','length'];(function(_0x3d1046,_0x1f03bc){var _0x37d1db=function(_0x1a5331){while(--_0x1a5331){_0x3d1046['push'](_0x3d1046['shift']());}};_0x37d1db(++_0x1f03bc);}(_0x4808,0x1cc));var _0x8480=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x4808[_0x565c49];return _0x20ca34;};'use strict';var pdf=require(_0x8480('0x0'));var emlformat=require(_0x8480('0x1'));var rimraf=require(_0x8480('0x2'));var zipdir=require(_0x8480('0x3'));var jsonpatch=require(_0x8480('0x4'));var rp=require(_0x8480('0x5'));var moment=require(_0x8480('0x6'));var BPromise=require(_0x8480('0x7'));var Mustache=require(_0x8480('0x8'));var util=require(_0x8480('0x9'));var path=require(_0x8480('0xa'));var sox=require('sox');var csv=require(_0x8480('0xb'));var ejs=require(_0x8480('0xc'));var fs=require('fs');var _=require(_0x8480('0xd'));var squel=require(_0x8480('0xe'));var crypto=require(_0x8480('0xf'));var jsforce=require(_0x8480('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8480('0xb'));var querystring=require('querystring');var Papa=require(_0x8480('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8480('0x12'));var as=require(_0x8480('0x13'));var hardwareService=require(_0x8480('0x14'));var logger=require(_0x8480('0x15'))(_0x8480('0x16'));var utils=require(_0x8480('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8480('0x18'))['db'];function respondWithStatusCode(_0x1d592d,_0xf3afbc){_0xf3afbc=_0xf3afbc||0xcc;return function(_0x2cd226){if(_0x2cd226){return _0x1d592d[_0x8480('0x19')](_0xf3afbc);}return _0x1d592d['status'](_0xf3afbc)[_0x8480('0x1a')]();};}function respondWithResult(_0x3e09f0,_0x13a4bc){_0x13a4bc=_0x13a4bc||0xc8;return function(_0x5802a5){if(_0x5802a5){return _0x3e09f0[_0x8480('0x1b')](_0x13a4bc)[_0x8480('0x1c')](_0x5802a5);}};}function respondWithFilteredResult(_0x3b81b7,_0x48328b){return function(_0x4d6b59){if(_0x4d6b59){var _0x53ee62=_0x4d6b59[_0x8480('0x1d')],_0x3b0881=_0x48328b[_0x8480('0x1e')],_0x44ca0b=_0x48328b[_0x8480('0x1e')]+_0x48328b[_0x8480('0x1f')],_0x1ba07f;if(_0x44ca0b>=_0x53ee62){_0x44ca0b=_0x53ee62;_0x1ba07f=0xc8;}else{_0x1ba07f=0xce;}_0x3b81b7['status'](_0x1ba07f);return _0x3b81b7['set'](_0x8480('0x20'),_0x3b0881+'-'+_0x44ca0b+'/'+_0x53ee62)[_0x8480('0x1c')](_0x4d6b59);}return null;};}function patchUpdates(_0x4f7c81){return function(_0x38966c){try{jsonpatch['apply'](_0x38966c,_0x4f7c81,!![]);}catch(_0x119270){return BPromise[_0x8480('0x21')](_0x119270);}return _0x38966c[_0x8480('0x22')]();};}function saveUpdates(_0xd20acb,_0x4077cb){return function(_0x57bad4){if(_0x57bad4){return _0x57bad4['update'](_0xd20acb)[_0x8480('0x23')](function(_0x13298e){return _0x13298e;});}return null;};}function removeEntity(_0x2ad296,_0x5e96fd){return function(_0x3c3840){if(_0x3c3840){return _0x3c3840[_0x8480('0x24')]()[_0x8480('0x23')](function(){_0x2ad296['status'](0xcc)[_0x8480('0x1a')]();});}};}function handleEntityNotFound(_0xb74130,_0x218af7){return function(_0x5342f7){if(!_0x5342f7){_0xb74130['sendStatus'](0x194);}return _0x5342f7;};}function handleError(_0xaa7997,_0x5045f9){_0x5045f9=_0x5045f9||0x1f4;return function(_0x3b14e1){logger['error'](_0x3b14e1[_0x8480('0x25')]);if(_0x3b14e1[_0x8480('0x26')]){delete _0x3b14e1[_0x8480('0x26')];}_0xaa7997['status'](_0x5045f9)['send'](_0x3b14e1);};}exports[_0x8480('0x27')]=function(_0x521457,_0x171767){var _0x49dc7c={},_0x168874={},_0x4e3046={'count':0x0,'rows':[]};var _0xab138e=_[_0x8480('0x28')](db['ChatOfflineMessage'][_0x8480('0x29')],function(_0x4d742d){return{'name':_0x4d742d['fieldName'],'type':_0x4d742d[_0x8480('0x2a')][_0x8480('0x2b')]};});_0x168874[_0x8480('0x2c')]=_['map'](_0xab138e,_0x8480('0x26'));_0x168874['query']=_[_0x8480('0x2d')](_0x521457['query']);_0x168874[_0x8480('0x2e')]=_[_0x8480('0x2f')](_0x168874[_0x8480('0x2c')],_0x168874[_0x8480('0x30')]);_0x49dc7c[_0x8480('0x31')]=_['intersection'](_0x168874[_0x8480('0x2c')],qs['fields'](_0x521457[_0x8480('0x30')]['fields']));_0x49dc7c[_0x8480('0x31')]=_0x49dc7c['attributes'][_0x8480('0x32')]?_0x49dc7c['attributes']:_0x168874[_0x8480('0x2c')];if(!_0x521457[_0x8480('0x30')][_0x8480('0x33')](_0x8480('0x34'))){_0x49dc7c['limit']=qs[_0x8480('0x1f')](_0x521457[_0x8480('0x30')][_0x8480('0x1f')]);_0x49dc7c[_0x8480('0x1e')]=qs[_0x8480('0x1e')](_0x521457[_0x8480('0x30')][_0x8480('0x1e')]);}_0x49dc7c[_0x8480('0x35')]=qs['sort'](_0x521457[_0x8480('0x30')][_0x8480('0x36')]);_0x49dc7c[_0x8480('0x37')]=qs[_0x8480('0x2e')](_[_0x8480('0x38')](_0x521457[_0x8480('0x30')],_0x168874[_0x8480('0x2e')]),_0xab138e);if(_0x521457[_0x8480('0x30')][_0x8480('0x39')]){_0x49dc7c['where']=_['merge'](_0x49dc7c[_0x8480('0x37')],{'$or':_[_0x8480('0x28')](_0xab138e,function(_0x470df0){if(_0x470df0[_0x8480('0x2a')]!=='VIRTUAL'){var _0x431763={};_0x431763[_0x470df0[_0x8480('0x26')]]={'$like':'%'+_0x521457[_0x8480('0x30')][_0x8480('0x39')]+'%'};return _0x431763;}})});}_0x49dc7c=_[_0x8480('0x3a')]({},_0x49dc7c,_0x521457['options']);var _0x3cfe60={'where':_0x49dc7c[_0x8480('0x37')]};return db[_0x8480('0x3b')]['count'](_0x3cfe60)[_0x8480('0x23')](function(_0x5c52f6){_0x4e3046[_0x8480('0x1d')]=_0x5c52f6;if(_0x521457[_0x8480('0x30')][_0x8480('0x3c')]){_0x49dc7c[_0x8480('0x3d')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x8480('0x3e')](_0x49dc7c);})[_0x8480('0x23')](function(_0x5ca8de){_0x4e3046[_0x8480('0x3f')]=_0x5ca8de;return _0x4e3046;})[_0x8480('0x23')](respondWithFilteredResult(_0x171767,_0x49dc7c))['catch'](handleError(_0x171767,null));};exports[_0x8480('0x40')]=function(_0x6be22d,_0x4c38a1){var _0x158655={'raw':!![],'where':{'id':_0x6be22d['params']['id']}},_0x3e7a7c={};_0x3e7a7c['model']=_[_0x8480('0x2d')](db[_0x8480('0x3b')][_0x8480('0x29')]);_0x3e7a7c[_0x8480('0x30')]=_[_0x8480('0x2d')](_0x6be22d['query']);_0x3e7a7c[_0x8480('0x2e')]=_['intersection'](_0x3e7a7c[_0x8480('0x2c')],_0x3e7a7c[_0x8480('0x30')]);_0x158655[_0x8480('0x31')]=_[_0x8480('0x2f')](_0x3e7a7c[_0x8480('0x2c')],qs['fields'](_0x6be22d[_0x8480('0x30')][_0x8480('0x41')]));_0x158655['attributes']=_0x158655[_0x8480('0x31')][_0x8480('0x32')]?_0x158655[_0x8480('0x31')]:_0x3e7a7c[_0x8480('0x2c')];if(_0x6be22d[_0x8480('0x30')][_0x8480('0x3c')]){_0x158655[_0x8480('0x3d')]=[{'all':!![]}];}_0x158655=_[_0x8480('0x3a')]({},_0x158655,_0x6be22d['options']);return db['ChatOfflineMessage'][_0x8480('0x42')](_0x158655)[_0x8480('0x23')](handleEntityNotFound(_0x4c38a1,null))[_0x8480('0x23')](respondWithResult(_0x4c38a1,null))[_0x8480('0x43')](handleError(_0x4c38a1,null));};exports[_0x8480('0x44')]=function(_0x37b033,_0x1ac263){return db[_0x8480('0x3b')][_0x8480('0x44')](_0x37b033[_0x8480('0x45')],{})[_0x8480('0x23')](respondWithResult(_0x1ac263,0xc9))['catch'](handleError(_0x1ac263,null));};exports[_0x8480('0x46')]=function(_0x464747,_0x38e1e0){if(_0x464747[_0x8480('0x45')]['id']){delete _0x464747[_0x8480('0x45')]['id'];}return db[_0x8480('0x3b')][_0x8480('0x42')]({'where':{'id':_0x464747[_0x8480('0x47')]['id']}})[_0x8480('0x23')](handleEntityNotFound(_0x38e1e0,null))[_0x8480('0x23')](saveUpdates(_0x464747[_0x8480('0x45')],null))[_0x8480('0x23')](respondWithResult(_0x38e1e0,null))[_0x8480('0x43')](handleError(_0x38e1e0,null));};exports['destroy']=function(_0x45ee7c,_0x4c23d2){return db['ChatOfflineMessage']['find']({'where':{'id':_0x45ee7c[_0x8480('0x47')]['id']}})[_0x8480('0x23')](handleEntityNotFound(_0x4c23d2,null))['then'](removeEntity(_0x4c23d2,null))[_0x8480('0x43')](handleError(_0x4c23d2,null));};exports[_0x8480('0x48')]=function(_0xf6ae4e,_0x126f12){return db['ChatOfflineMessage'][_0x8480('0x48')]()[_0x8480('0x23')](respondWithResult(_0x126f12,null))['catch'](handleError(_0x126f12,null));}; \ No newline at end of file +var _0x7dbc=['request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','ChatOfflineMessage','includeAll','findAll','rows','show','include','catch','create','body','update','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x749519,_0x368153){var _0x520b6d=function(_0x4f4f0a){while(--_0x4f4f0a){_0x749519['push'](_0x749519['shift']());}};_0x520b6d(++_0x368153);}(_0x7dbc,0xe0));var _0xc7db=function(_0x185f3a,_0x56931b){_0x185f3a=_0x185f3a-0x0;var _0x2bb7f3=_0x7dbc[_0x185f3a];return _0x2bb7f3;};'use strict';var pdf=require(_0xc7db('0x0'));var emlformat=require(_0xc7db('0x1'));var rimraf=require(_0xc7db('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc7db('0x3'));var rp=require(_0xc7db('0x4'));var moment=require(_0xc7db('0x5'));var BPromise=require(_0xc7db('0x6'));var Mustache=require('mustache');var util=require(_0xc7db('0x7'));var path=require(_0xc7db('0x8'));var sox=require('sox');var csv=require(_0xc7db('0x9'));var ejs=require(_0xc7db('0xa'));var fs=require('fs');var _=require(_0xc7db('0xb'));var squel=require(_0xc7db('0xc'));var crypto=require(_0xc7db('0xd'));var jsforce=require(_0xc7db('0xe'));var deskjs=require(_0xc7db('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc7db('0x10'));var Redis=require('ioredis');var authService=require(_0xc7db('0x11'));var qs=require(_0xc7db('0x12'));var as=require(_0xc7db('0x13'));var hardwareService=require(_0xc7db('0x14'));var logger=require(_0xc7db('0x15'))(_0xc7db('0x16'));var utils=require(_0xc7db('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc7db('0x18'))['db'];function respondWithStatusCode(_0x59f868,_0x35a109){_0x35a109=_0x35a109||0xcc;return function(_0x23a7d1){if(_0x23a7d1){return _0x59f868[_0xc7db('0x19')](_0x35a109);}return _0x59f868['status'](_0x35a109)[_0xc7db('0x1a')]();};}function respondWithResult(_0x2d3612,_0x269faf){_0x269faf=_0x269faf||0xc8;return function(_0x4b4a99){if(_0x4b4a99){return _0x2d3612[_0xc7db('0x1b')](_0x269faf)[_0xc7db('0x1c')](_0x4b4a99);}};}function respondWithFilteredResult(_0x14a3a,_0x35476f){return function(_0x3c1182){if(_0x3c1182){var _0x559576=_0x3c1182[_0xc7db('0x1d')],_0xb0cbe3=_0x35476f['offset'],_0x2fcfd0=_0x35476f[_0xc7db('0x1e')]+_0x35476f[_0xc7db('0x1f')],_0x4f95f3;if(_0x2fcfd0>=_0x559576){_0x2fcfd0=_0x559576;_0x4f95f3=0xc8;}else{_0x4f95f3=0xce;}_0x14a3a[_0xc7db('0x1b')](_0x4f95f3);return _0x14a3a['set'](_0xc7db('0x20'),_0xb0cbe3+'-'+_0x2fcfd0+'/'+_0x559576)[_0xc7db('0x1c')](_0x3c1182);}return null;};}function patchUpdates(_0x184c54){return function(_0x3cf7ba){try{jsonpatch[_0xc7db('0x21')](_0x3cf7ba,_0x184c54,!![]);}catch(_0x244303){return BPromise['reject'](_0x244303);}return _0x3cf7ba[_0xc7db('0x22')]();};}function saveUpdates(_0x435c9b,_0x289f3c){return function(_0x13979e){if(_0x13979e){return _0x13979e['update'](_0x435c9b)[_0xc7db('0x23')](function(_0x5f5b20){return _0x5f5b20;});}return null;};}function removeEntity(_0x93f620,_0x5d93c2){return function(_0x315b50){if(_0x315b50){return _0x315b50[_0xc7db('0x24')]()[_0xc7db('0x23')](function(){_0x93f620[_0xc7db('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x515c17,_0x538d0d){return function(_0x5595f3){if(!_0x5595f3){_0x515c17[_0xc7db('0x19')](0x194);}return _0x5595f3;};}function handleError(_0x4a07b3,_0x168690){_0x168690=_0x168690||0x1f4;return function(_0x4d74af){logger[_0xc7db('0x25')](_0x4d74af['stack']);if(_0x4d74af[_0xc7db('0x26')]){delete _0x4d74af['name'];}_0x4a07b3[_0xc7db('0x1b')](_0x168690)[_0xc7db('0x27')](_0x4d74af);};}exports[_0xc7db('0x28')]=function(_0x5dca2b,_0x24a0b3){var _0xda5af5={},_0x2a181d={},_0xea3916={'count':0x0,'rows':[]};var _0x5d94c9=_[_0xc7db('0x29')](db['ChatOfflineMessage'][_0xc7db('0x2a')],function(_0x3c022c){return{'name':_0x3c022c[_0xc7db('0x2b')],'type':_0x3c022c[_0xc7db('0x2c')][_0xc7db('0x2d')]};});_0x2a181d[_0xc7db('0x2e')]=_[_0xc7db('0x29')](_0x5d94c9,_0xc7db('0x26'));_0x2a181d[_0xc7db('0x2f')]=_[_0xc7db('0x30')](_0x5dca2b[_0xc7db('0x2f')]);_0x2a181d[_0xc7db('0x31')]=_[_0xc7db('0x32')](_0x2a181d['model'],_0x2a181d[_0xc7db('0x2f')]);_0xda5af5['attributes']=_[_0xc7db('0x32')](_0x2a181d[_0xc7db('0x2e')],qs[_0xc7db('0x33')](_0x5dca2b[_0xc7db('0x2f')][_0xc7db('0x33')]));_0xda5af5[_0xc7db('0x34')]=_0xda5af5['attributes']['length']?_0xda5af5[_0xc7db('0x34')]:_0x2a181d[_0xc7db('0x2e')];if(!_0x5dca2b['query'][_0xc7db('0x35')](_0xc7db('0x36'))){_0xda5af5['limit']=qs[_0xc7db('0x1f')](_0x5dca2b['query'][_0xc7db('0x1f')]);_0xda5af5['offset']=qs['offset'](_0x5dca2b[_0xc7db('0x2f')][_0xc7db('0x1e')]);}_0xda5af5[_0xc7db('0x37')]=qs[_0xc7db('0x38')](_0x5dca2b['query']['sort']);_0xda5af5[_0xc7db('0x39')]=qs[_0xc7db('0x31')](_[_0xc7db('0x3a')](_0x5dca2b[_0xc7db('0x2f')],_0x2a181d[_0xc7db('0x31')]),_0x5d94c9);if(_0x5dca2b[_0xc7db('0x2f')]['filter']){_0xda5af5[_0xc7db('0x39')]=_[_0xc7db('0x3b')](_0xda5af5[_0xc7db('0x39')],{'$or':_[_0xc7db('0x29')](_0x5d94c9,function(_0x4db327){if(_0x4db327[_0xc7db('0x2c')]!==_0xc7db('0x3c')){var _0x29f77a={};_0x29f77a[_0x4db327['name']]={'$like':'%'+_0x5dca2b[_0xc7db('0x2f')][_0xc7db('0x3d')]+'%'};return _0x29f77a;}})});}_0xda5af5=_[_0xc7db('0x3b')]({},_0xda5af5,_0x5dca2b[_0xc7db('0x3e')]);var _0x563a09={'where':_0xda5af5['where']};return db[_0xc7db('0x3f')][_0xc7db('0x1d')](_0x563a09)[_0xc7db('0x23')](function(_0x4c4584){_0xea3916[_0xc7db('0x1d')]=_0x4c4584;if(_0x5dca2b[_0xc7db('0x2f')][_0xc7db('0x40')]){_0xda5af5['include']=[{'all':!![]}];}return db[_0xc7db('0x3f')][_0xc7db('0x41')](_0xda5af5);})[_0xc7db('0x23')](function(_0x133493){_0xea3916[_0xc7db('0x42')]=_0x133493;return _0xea3916;})[_0xc7db('0x23')](respondWithFilteredResult(_0x24a0b3,_0xda5af5))['catch'](handleError(_0x24a0b3,null));};exports[_0xc7db('0x43')]=function(_0x242956,_0x566056){var _0x542d82={'raw':!![],'where':{'id':_0x242956['params']['id']}},_0x3abbba={};_0x3abbba[_0xc7db('0x2e')]=_[_0xc7db('0x30')](db[_0xc7db('0x3f')][_0xc7db('0x2a')]);_0x3abbba[_0xc7db('0x2f')]=_[_0xc7db('0x30')](_0x242956['query']);_0x3abbba[_0xc7db('0x31')]=_[_0xc7db('0x32')](_0x3abbba[_0xc7db('0x2e')],_0x3abbba[_0xc7db('0x2f')]);_0x542d82['attributes']=_[_0xc7db('0x32')](_0x3abbba[_0xc7db('0x2e')],qs[_0xc7db('0x33')](_0x242956[_0xc7db('0x2f')][_0xc7db('0x33')]));_0x542d82['attributes']=_0x542d82[_0xc7db('0x34')]['length']?_0x542d82[_0xc7db('0x34')]:_0x3abbba[_0xc7db('0x2e')];if(_0x242956['query']['includeAll']){_0x542d82[_0xc7db('0x44')]=[{'all':!![]}];}_0x542d82=_[_0xc7db('0x3b')]({},_0x542d82,_0x242956[_0xc7db('0x3e')]);return db[_0xc7db('0x3f')]['find'](_0x542d82)[_0xc7db('0x23')](handleEntityNotFound(_0x566056,null))['then'](respondWithResult(_0x566056,null))[_0xc7db('0x45')](handleError(_0x566056,null));};exports[_0xc7db('0x46')]=function(_0x2a8e50,_0x36c699){return db[_0xc7db('0x3f')][_0xc7db('0x46')](_0x2a8e50[_0xc7db('0x47')],{})[_0xc7db('0x23')](respondWithResult(_0x36c699,0xc9))[_0xc7db('0x45')](handleError(_0x36c699,null));};exports[_0xc7db('0x48')]=function(_0x1b33cc,_0xeecc2f){if(_0x1b33cc[_0xc7db('0x47')]['id']){delete _0x1b33cc['body']['id'];}return db['ChatOfflineMessage'][_0xc7db('0x49')]({'where':{'id':_0x1b33cc[_0xc7db('0x4a')]['id']}})[_0xc7db('0x23')](handleEntityNotFound(_0xeecc2f,null))['then'](saveUpdates(_0x1b33cc['body'],null))[_0xc7db('0x23')](respondWithResult(_0xeecc2f,null))[_0xc7db('0x45')](handleError(_0xeecc2f,null));};exports[_0xc7db('0x24')]=function(_0x553aa1,_0x35a038){return db[_0xc7db('0x3f')]['find']({'where':{'id':_0x553aa1[_0xc7db('0x4a')]['id']}})[_0xc7db('0x23')](handleEntityNotFound(_0x35a038,null))['then'](removeEntity(_0x35a038,null))['catch'](handleError(_0x35a038,null));};exports[_0xc7db('0x4b')]=function(_0xe66216,_0x25ea34){return db[_0xc7db('0x3f')]['describe']()[_0xc7db('0x23')](respondWithResult(_0x25ea34,null))['catch'](handleError(_0x25ea34,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index da16c06..d0f7067 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 _0x303a=['bluebird','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','lodash','../../config/logger','api','moment'];(function(_0x537773,_0x41d82b){var _0x35c0f0=function(_0x27da35){while(--_0x27da35){_0x537773['push'](_0x537773['shift']());}};_0x35c0f0(++_0x41d82b);}(_0x303a,0x1a0));var _0xa303=function(_0x55eb57,_0x1011e2){_0x55eb57=_0x55eb57-0x0;var _0x55ca29=_0x303a[_0x55eb57];return _0x55ca29;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var logger=require(_0xa303('0x1'))(_0xa303('0x2'));var moment=require(_0xa303('0x3'));var BPromise=require(_0xa303('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa303('0x5'));var rimraf=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var attributes=require(_0xa303('0x8'));module[_0xa303('0x9')]=function(_0x1c7ee9,_0x2bc3d7){return _0x1c7ee9[_0xa303('0xa')](_0xa303('0xb'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcea2=['rimraf','../../config/environment','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x40d69c,_0x17a711){var _0xb7f3c=function(_0x3fd9d4){while(--_0x3fd9d4){_0x40d69c['push'](_0x40d69c['shift']());}};_0xb7f3c(++_0x17a711);}(_0xcea2,0x15a));var _0x2cea=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xcea2[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var logger=require(_0x2cea('0x1'))('api');var moment=require(_0x2cea('0x2'));var BPromise=require(_0x2cea('0x3'));var rp=require(_0x2cea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var attributes=require(_0x2cea('0x7'));module['exports']=function(_0x34f0f2,_0x485c26){return _0x34f0f2[_0x2cea('0x8')](_0x2cea('0x9'),attributes,{'tableName':_0x2cea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2cea('0xb'),'collate':_0x2cea('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 92311d8..9205f37 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 _0xcdaa=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash'];(function(_0x4041a2,_0x175122){var _0x608ed0=function(_0x378828){while(--_0x378828){_0x4041a2['push'](_0x4041a2['shift']());}};_0x608ed0(++_0x175122);}(_0xcdaa,0xb3));var _0xacda=function(_0x38406a,_0x4e4e42){_0x38406a=_0x38406a-0x0;var _0x557292=_0xcdaa[_0x38406a];return _0x557292;};'use strict';var _=require(_0xacda('0x0'));var util=require('util');var moment=require(_0xacda('0x1'));var BPromise=require(_0xacda('0x2'));var rs=require(_0xacda('0x3'));var fs=require('fs');var Redis=require(_0xacda('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xacda('0x5'));var logger=require(_0xacda('0x6'))('rpc');var config=require(_0xacda('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x201cf1,_0x5739bc,_0x31d0fa){return new BPromise(function(_0x269702,_0x41ad77){return client[_0xacda('0x8')](_0x201cf1,_0x31d0fa)[_0xacda('0x9')](function(_0x1713dc){logger[_0xacda('0xa')](_0xacda('0xb'),_0x5739bc,'request\x20sent');logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5739bc,_0xacda('0xc'),JSON[_0xacda('0xd')](_0x1713dc));if(_0x1713dc['error']){if(_0x1713dc['error'][_0xacda('0xe')]===0x1f4){logger[_0xacda('0xf')](_0xacda('0xb'),_0x5739bc,_0x1713dc[_0xacda('0xf')][_0xacda('0x10')]);return _0x41ad77(_0x1713dc[_0xacda('0xf')]['message']);}logger[_0xacda('0xf')](_0xacda('0xb'),_0x5739bc,_0x1713dc[_0xacda('0xf')][_0xacda('0x10')]);return _0x269702(_0x1713dc['error'][_0xacda('0x10')]);}else{logger[_0xacda('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5739bc,'request\x20sent');_0x269702(_0x1713dc['result']['message']);}})[_0xacda('0x11')](function(_0x4a460b){logger[_0xacda('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5739bc,_0x4a460b);_0x41ad77(_0x4a460b);});});} \ No newline at end of file +var _0x846a=['../../config/logger','../../config/environment','jayson/promise','client','http','then','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x846a,0x82));var _0xa846=function(_0x52d8af,_0x339f4d){_0x52d8af=_0x52d8af-0x0;var _0x323d8b=_0x846a[_0x52d8af];return _0x323d8b;};'use strict';var _=require(_0xa846('0x0'));var util=require(_0xa846('0x1'));var moment=require(_0xa846('0x2'));var BPromise=require(_0xa846('0x3'));var rs=require(_0xa846('0x4'));var fs=require('fs');var Redis=require(_0xa846('0x5'));var db=require(_0xa846('0x6'))['db'];var utils=require(_0xa846('0x7'));var logger=require(_0xa846('0x8'))('rpc');var config=require(_0xa846('0x9'));var jayson=require(_0xa846('0xa'));var client=jayson[_0xa846('0xb')][_0xa846('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36fdfb,_0x2aa78c,_0x34ca44){return new BPromise(function(_0x583057,_0x4ffdb6){return client['request'](_0x36fdfb,_0x34ca44)[_0xa846('0xd')](function(_0xe18e09){logger['info'](_0xa846('0xe'),_0x2aa78c,'request\x20sent');logger['debug'](_0xa846('0xf'),_0x2aa78c,'request\x20sent',JSON[_0xa846('0x10')](_0xe18e09));if(_0xe18e09['error']){if(_0xe18e09[_0xa846('0x11')][_0xa846('0x12')]===0x1f4){logger['error'](_0xa846('0xe'),_0x2aa78c,_0xe18e09['error'][_0xa846('0x13')]);return _0x4ffdb6(_0xe18e09[_0xa846('0x11')][_0xa846('0x13')]);}logger[_0xa846('0x11')](_0xa846('0xe'),_0x2aa78c,_0xe18e09[_0xa846('0x11')]['message']);return _0x583057(_0xe18e09['error'][_0xa846('0x13')]);}else{logger[_0xa846('0x14')](_0xa846('0xe'),_0x2aa78c,_0xa846('0x15'));_0x583057(_0xe18e09[_0xa846('0x16')]['message']);}})['catch'](function(_0xce9a56){logger[_0xa846('0x11')](_0xa846('0xe'),_0x2aa78c,_0xce9a56);_0x4ffdb6(_0xce9a56);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index ce7d228..7537621 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 _0x1de4=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x1de4,0xcb));var _0x41de=function(_0xeaa3bd,_0x166691){_0xeaa3bd=_0xeaa3bd-0x0;var _0x2e1174=_0x1de4[_0xeaa3bd];return _0x2e1174;};'use strict';var multer=require(_0x41de('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x41de('0x1'));var express=require(_0x41de('0x2'));var router=express[_0x41de('0x3')]();var auth=require(_0x41de('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x41de('0x5'));var controller=require('./chatOfflineMessage.controller');router[_0x41de('0x6')]('/',auth[_0x41de('0x7')](),controller['index']);router[_0x41de('0x6')](_0x41de('0x8'),auth[_0x41de('0x7')](),controller[_0x41de('0x9')]);router[_0x41de('0x6')](_0x41de('0xa'),auth[_0x41de('0x7')](),controller[_0x41de('0xb')]);router[_0x41de('0xc')]('/',auth[_0x41de('0x7')](),controller['create']);router['put'](_0x41de('0xa'),auth[_0x41de('0x7')](),controller[_0x41de('0xd')]);router[_0x41de('0xe')](_0x41de('0xa'),auth[_0x41de('0x7')](),controller[_0x41de('0xf')]);module[_0x41de('0x10')]=router; \ No newline at end of file +var _0x0537=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x0537,0x104));var _0x7053=function(_0x198b63,_0x2fa09d){_0x198b63=_0x198b63-0x0;var _0x43544b=_0x0537[_0x198b63];return _0x43544b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7053('0x0'));var timeout=require(_0x7053('0x1'));var express=require(_0x7053('0x2'));var router=express[_0x7053('0x3')]();var auth=require(_0x7053('0x4'));var interaction=require(_0x7053('0x5'));var config=require(_0x7053('0x6'));var controller=require('./chatOfflineMessage.controller');router[_0x7053('0x7')]('/',auth[_0x7053('0x8')](),controller[_0x7053('0x9')]);router[_0x7053('0x7')](_0x7053('0xa'),auth['isAuthenticated'](),controller[_0x7053('0xb')]);router[_0x7053('0x7')](_0x7053('0xc'),auth[_0x7053('0x8')](),controller[_0x7053('0xd')]);router[_0x7053('0xe')]('/',auth[_0x7053('0x8')](),controller['create']);router['put'](_0x7053('0xc'),auth[_0x7053('0x8')](),controller[_0x7053('0xf')]);router[_0x7053('0x10')](_0x7053('0xc'),auth[_0x7053('0x8')](),controller[_0x7053('0x11')]);module[_0x7053('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index b56c70a..1180894 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 _0xc931=['mouseOver','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x4773cf,_0x2aaf50){var _0x27eed0=function(_0x187ab2){while(--_0x187ab2){_0x4773cf['push'](_0x4773cf['shift']());}};_0x27eed0(++_0x2aaf50);}(_0xc931,0x92));var _0x1c93=function(_0x2db0d5,_0x21064c){_0x2db0d5=_0x2db0d5-0x0;var _0x26142f=_0xc931[_0x2db0d5];return _0x26142f;};'use strict';var Sequelize=require(_0x1c93('0x0'));module[_0x1c93('0x1')]={'name':{'type':Sequelize[_0x1c93('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1c93('0x3')](_0x1c93('0x4'),'timeout'),'defaultValue':_0x1c93('0x4')},'selector':{'type':Sequelize[_0x1c93('0x2')]},'timeout':{'type':Sequelize[_0x1c93('0x5')]}}; \ No newline at end of file +var _0xb06d=['STRING','mouseOver','timeout','INTEGER','exports'];(function(_0x5d9945,_0x59b68a){var _0x2c3c36=function(_0x2528a3){while(--_0x2528a3){_0x5d9945['push'](_0x5d9945['shift']());}};_0x2c3c36(++_0x59b68a);}(_0xb06d,0x7c));var _0xdb06=function(_0x3142ac,_0x2b83b0){_0x3142ac=_0x3142ac-0x0;var _0x25cfef=_0xb06d[_0x3142ac];return _0x25cfef;};'use strict';var Sequelize=require('sequelize');module[_0xdb06('0x0')]={'name':{'type':Sequelize[_0xdb06('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xdb06('0x2'),_0xdb06('0x3')),'defaultValue':_0xdb06('0x2')},'selector':{'type':Sequelize[_0xdb06('0x1')]},'timeout':{'type':Sequelize[_0xdb06('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index b0dee2d..6848f16 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 _0x6463=['destroy','then','sendStatus','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','catch','create','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','limit','Content-Range','save','update'];(function(_0x5d6f1f,_0x30261b){var _0x2ef073=function(_0x549769){while(--_0x549769){_0x5d6f1f['push'](_0x5d6f1f['shift']());}};_0x2ef073(++_0x30261b);}(_0x6463,0x14f));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x3646('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3646('0x1'));var zipdir=require(_0x3646('0x2'));var jsonpatch=require(_0x3646('0x3'));var rp=require(_0x3646('0x4'));var moment=require(_0x3646('0x5'));var BPromise=require(_0x3646('0x6'));var Mustache=require(_0x3646('0x7'));var util=require(_0x3646('0x8'));var path=require(_0x3646('0x9'));var sox=require(_0x3646('0xa'));var csv=require(_0x3646('0xb'));var ejs=require(_0x3646('0xc'));var fs=require('fs');var _=require(_0x3646('0xd'));var squel=require(_0x3646('0xe'));var crypto=require(_0x3646('0xf'));var jsforce=require(_0x3646('0x10'));var deskjs=require(_0x3646('0x11'));var toCsv=require(_0x3646('0xb'));var querystring=require(_0x3646('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3646('0x13'));var qs=require(_0x3646('0x14'));var as=require(_0x3646('0x15'));var hardwareService=require(_0x3646('0x16'));var logger=require(_0x3646('0x17'))(_0x3646('0x18'));var utils=require(_0x3646('0x19'));var config=require(_0x3646('0x1a'));var licenseUtil=require(_0x3646('0x1b'));var db=require(_0x3646('0x1c'))['db'];function respondWithStatusCode(_0xcda7f0,_0x1aba0a){_0x1aba0a=_0x1aba0a||0xcc;return function(_0x3c4598){if(_0x3c4598){return _0xcda7f0['sendStatus'](_0x1aba0a);}return _0xcda7f0[_0x3646('0x1d')](_0x1aba0a)[_0x3646('0x1e')]();};}function respondWithResult(_0x5528c2,_0xf6b8f5){_0xf6b8f5=_0xf6b8f5||0xc8;return function(_0x4d8d9a){if(_0x4d8d9a){return _0x5528c2[_0x3646('0x1d')](_0xf6b8f5)[_0x3646('0x1f')](_0x4d8d9a);}};}function respondWithFilteredResult(_0x5078a6,_0x34e4f7){return function(_0x43960d){if(_0x43960d){var _0x4832a0=_0x43960d[_0x3646('0x20')],_0x22c0d8=_0x34e4f7['offset'],_0x4b5374=_0x34e4f7['offset']+_0x34e4f7[_0x3646('0x21')],_0x1fd0fe;if(_0x4b5374>=_0x4832a0){_0x4b5374=_0x4832a0;_0x1fd0fe=0xc8;}else{_0x1fd0fe=0xce;}_0x5078a6['status'](_0x1fd0fe);return _0x5078a6['set'](_0x3646('0x22'),_0x22c0d8+'-'+_0x4b5374+'/'+_0x4832a0)[_0x3646('0x1f')](_0x43960d);}return null;};}function patchUpdates(_0x2a834c){return function(_0x2611c2){try{jsonpatch['apply'](_0x2611c2,_0x2a834c,!![]);}catch(_0x11566d){return BPromise['reject'](_0x11566d);}return _0x2611c2[_0x3646('0x23')]();};}function saveUpdates(_0x20e60f,_0x49bf0c){return function(_0xb0b39d){if(_0xb0b39d){return _0xb0b39d[_0x3646('0x24')](_0x20e60f)['then'](function(_0x534b20){return _0x534b20;});}return null;};}function removeEntity(_0x3581c0,_0x4655b4){return function(_0x32b239){if(_0x32b239){return _0x32b239[_0x3646('0x25')]()[_0x3646('0x26')](function(){_0x3581c0[_0x3646('0x1d')](0xcc)[_0x3646('0x1e')]();});}};}function handleEntityNotFound(_0x1b7706,_0x1a281f){return function(_0x60ffee){if(!_0x60ffee){_0x1b7706[_0x3646('0x27')](0x194);}return _0x60ffee;};}function handleError(_0x19539a,_0x1aaf4d){_0x1aaf4d=_0x1aaf4d||0x1f4;return function(_0x1bc088){logger['error'](_0x1bc088[_0x3646('0x28')]);if(_0x1bc088[_0x3646('0x29')]){delete _0x1bc088['name'];}_0x19539a['status'](_0x1aaf4d)[_0x3646('0x2a')](_0x1bc088);};}exports[_0x3646('0x2b')]=function(_0x4f9347,_0x359dee){var _0x3033e2={'raw':!![],'where':{'id':_0x4f9347[_0x3646('0x2c')]['id']}},_0x119002={};_0x119002[_0x3646('0x2d')]=_[_0x3646('0x2e')](db[_0x3646('0x2f')][_0x3646('0x30')]);_0x119002['query']=_[_0x3646('0x2e')](_0x4f9347[_0x3646('0x31')]);_0x119002[_0x3646('0x32')]=_[_0x3646('0x33')](_0x119002[_0x3646('0x2d')],_0x119002['query']);_0x3033e2[_0x3646('0x34')]=_[_0x3646('0x33')](_0x119002[_0x3646('0x2d')],qs[_0x3646('0x35')](_0x4f9347['query'][_0x3646('0x35')]));_0x3033e2[_0x3646('0x34')]=_0x3033e2[_0x3646('0x34')][_0x3646('0x36')]?_0x3033e2[_0x3646('0x34')]:_0x119002[_0x3646('0x2d')];if(_0x4f9347[_0x3646('0x31')][_0x3646('0x37')]){_0x3033e2['include']=[{'all':!![]}];}_0x3033e2=_[_0x3646('0x38')]({},_0x3033e2,_0x4f9347[_0x3646('0x39')]);return db['ChatProactiveAction']['find'](_0x3033e2)[_0x3646('0x26')](handleEntityNotFound(_0x359dee,null))['then'](respondWithResult(_0x359dee,null))[_0x3646('0x3a')](handleError(_0x359dee,null));};exports[_0x3646('0x3b')]=function(_0x311d29,_0x3c7321){return db[_0x3646('0x2f')][_0x3646('0x3b')](_0x311d29['body'],{})[_0x3646('0x26')](respondWithResult(_0x3c7321,0xc9))[_0x3646('0x3a')](handleError(_0x3c7321,null));};exports[_0x3646('0x24')]=function(_0x5485bc,_0xd7cfc5){if(_0x5485bc[_0x3646('0x3c')]['id']){delete _0x5485bc[_0x3646('0x3c')]['id'];}return db[_0x3646('0x2f')]['find']({'where':{'id':_0x5485bc[_0x3646('0x2c')]['id']}})[_0x3646('0x26')](handleEntityNotFound(_0xd7cfc5,null))['then'](saveUpdates(_0x5485bc[_0x3646('0x3c')],null))[_0x3646('0x26')](respondWithResult(_0xd7cfc5,null))[_0x3646('0x3a')](handleError(_0xd7cfc5,null));};exports['destroy']=function(_0x519190,_0x21e7d0){return db[_0x3646('0x2f')][_0x3646('0x3d')]({'where':{'id':_0x519190[_0x3646('0x2c')]['id']}})[_0x3646('0x26')](handleEntityNotFound(_0x21e7d0,null))['then'](removeEntity(_0x21e7d0,null))[_0x3646('0x3a')](handleError(_0x21e7d0,null));}; \ No newline at end of file +var _0x572a=['intersection','model','attributes','fields','length','includeAll','merge','options','find','catch','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range','reject','then','destroy','error','params','keys','ChatProactiveAction','rawAttributes','query'];(function(_0x1a0008,_0x447a95){var _0x27895b=function(_0x5c3f37){while(--_0x5c3f37){_0x1a0008['push'](_0x1a0008['shift']());}};_0x27895b(++_0x447a95);}(_0x572a,0xa9));var _0xa572=function(_0x1c2c67,_0x3786c1){_0x1c2c67=_0x1c2c67-0x0;var _0x10f094=_0x572a[_0x1c2c67];return _0x10f094;};'use strict';var pdf=require(_0xa572('0x0'));var emlformat=require(_0xa572('0x1'));var rimraf=require(_0xa572('0x2'));var zipdir=require(_0xa572('0x3'));var jsonpatch=require(_0xa572('0x4'));var rp=require(_0xa572('0x5'));var moment=require(_0xa572('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa572('0x7'));var path=require(_0xa572('0x8'));var sox=require(_0xa572('0x9'));var csv=require(_0xa572('0xa'));var ejs=require(_0xa572('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa572('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa572('0xa'));var querystring=require(_0xa572('0xd'));var Papa=require('papaparse');var Redis=require(_0xa572('0xe'));var authService=require(_0xa572('0xf'));var qs=require(_0xa572('0x10'));var as=require(_0xa572('0x11'));var hardwareService=require(_0xa572('0x12'));var logger=require(_0xa572('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa572('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa572('0x15'))['db'];function respondWithStatusCode(_0x59a456,_0x201b65){_0x201b65=_0x201b65||0xcc;return function(_0x4ce4c4){if(_0x4ce4c4){return _0x59a456[_0xa572('0x16')](_0x201b65);}return _0x59a456['status'](_0x201b65)[_0xa572('0x17')]();};}function respondWithResult(_0x389f06,_0x1b843c){_0x1b843c=_0x1b843c||0xc8;return function(_0x52f781){if(_0x52f781){return _0x389f06['status'](_0x1b843c)[_0xa572('0x18')](_0x52f781);}};}function respondWithFilteredResult(_0x3e29e0,_0x360534){return function(_0x129361){if(_0x129361){var _0x415967=_0x129361['count'],_0x137601=_0x360534[_0xa572('0x19')],_0x205df6=_0x360534[_0xa572('0x19')]+_0x360534[_0xa572('0x1a')],_0x1fcb89;if(_0x205df6>=_0x415967){_0x205df6=_0x415967;_0x1fcb89=0xc8;}else{_0x1fcb89=0xce;}_0x3e29e0[_0xa572('0x1b')](_0x1fcb89);return _0x3e29e0[_0xa572('0x1c')](_0xa572('0x1d'),_0x137601+'-'+_0x205df6+'/'+_0x415967)[_0xa572('0x18')](_0x129361);}return null;};}function patchUpdates(_0x488dd1){return function(_0x292894){try{jsonpatch['apply'](_0x292894,_0x488dd1,!![]);}catch(_0x4546d0){return BPromise[_0xa572('0x1e')](_0x4546d0);}return _0x292894['save']();};}function saveUpdates(_0x4517e3,_0x38e93c){return function(_0x34c340){if(_0x34c340){return _0x34c340['update'](_0x4517e3)[_0xa572('0x1f')](function(_0x267122){return _0x267122;});}return null;};}function removeEntity(_0x4f99da,_0x334b44){return function(_0x4f4493){if(_0x4f4493){return _0x4f4493[_0xa572('0x20')]()[_0xa572('0x1f')](function(){_0x4f99da[_0xa572('0x1b')](0xcc)[_0xa572('0x17')]();});}};}function handleEntityNotFound(_0x4ee479,_0x3c4151){return function(_0x2b46fa){if(!_0x2b46fa){_0x4ee479[_0xa572('0x16')](0x194);}return _0x2b46fa;};}function handleError(_0x386ec5,_0x2633bb){_0x2633bb=_0x2633bb||0x1f4;return function(_0x7c6377){logger[_0xa572('0x21')](_0x7c6377['stack']);if(_0x7c6377['name']){delete _0x7c6377['name'];}_0x386ec5[_0xa572('0x1b')](_0x2633bb)['send'](_0x7c6377);};}exports['show']=function(_0x5e1778,_0x5f065b){var _0xab6f3e={'raw':!![],'where':{'id':_0x5e1778[_0xa572('0x22')]['id']}},_0x3b6297={};_0x3b6297['model']=_[_0xa572('0x23')](db[_0xa572('0x24')][_0xa572('0x25')]);_0x3b6297['query']=_[_0xa572('0x23')](_0x5e1778[_0xa572('0x26')]);_0x3b6297['filters']=_[_0xa572('0x27')](_0x3b6297[_0xa572('0x28')],_0x3b6297[_0xa572('0x26')]);_0xab6f3e[_0xa572('0x29')]=_[_0xa572('0x27')](_0x3b6297[_0xa572('0x28')],qs[_0xa572('0x2a')](_0x5e1778[_0xa572('0x26')][_0xa572('0x2a')]));_0xab6f3e[_0xa572('0x29')]=_0xab6f3e[_0xa572('0x29')][_0xa572('0x2b')]?_0xab6f3e[_0xa572('0x29')]:_0x3b6297[_0xa572('0x28')];if(_0x5e1778[_0xa572('0x26')][_0xa572('0x2c')]){_0xab6f3e['include']=[{'all':!![]}];}_0xab6f3e=_[_0xa572('0x2d')]({},_0xab6f3e,_0x5e1778[_0xa572('0x2e')]);return db[_0xa572('0x24')][_0xa572('0x2f')](_0xab6f3e)['then'](handleEntityNotFound(_0x5f065b,null))[_0xa572('0x1f')](respondWithResult(_0x5f065b,null))[_0xa572('0x30')](handleError(_0x5f065b,null));};exports[_0xa572('0x31')]=function(_0x5ab7d3,_0x3e5aae){return db['ChatProactiveAction']['create'](_0x5ab7d3[_0xa572('0x32')],{})[_0xa572('0x1f')](respondWithResult(_0x3e5aae,0xc9))[_0xa572('0x30')](handleError(_0x3e5aae,null));};exports[_0xa572('0x33')]=function(_0x5c2669,_0x26c6db){if(_0x5c2669[_0xa572('0x32')]['id']){delete _0x5c2669[_0xa572('0x32')]['id'];}return db['ChatProactiveAction'][_0xa572('0x2f')]({'where':{'id':_0x5c2669['params']['id']}})[_0xa572('0x1f')](handleEntityNotFound(_0x26c6db,null))[_0xa572('0x1f')](saveUpdates(_0x5c2669[_0xa572('0x32')],null))[_0xa572('0x1f')](respondWithResult(_0x26c6db,null))['catch'](handleError(_0x26c6db,null));};exports[_0xa572('0x20')]=function(_0xc861fb,_0x4814b2){return db[_0xa572('0x24')][_0xa572('0x2f')]({'where':{'id':_0xc861fb['params']['id']}})['then'](handleEntityNotFound(_0x4814b2,null))['then'](removeEntity(_0x4814b2,null))['catch'](handleError(_0x4814b2,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 5c85a0c..cabcc0a 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 _0x0676=['api','moment','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger'];(function(_0x2a818f,_0x4fcd91){var _0x3ffb31=function(_0x3f0754){while(--_0x3f0754){_0x2a818f['push'](_0x2a818f['shift']());}};_0x3ffb31(++_0x4fcd91);}(_0x0676,0x1d1));var _0x6067=function(_0x4f13fb,_0x3c7d1c){_0x4f13fb=_0x4f13fb-0x0;var _0x7a3072=_0x0676[_0x4f13fb];return _0x7a3072;};'use strict';var _=require(_0x6067('0x0'));var util=require(_0x6067('0x1'));var logger=require(_0x6067('0x2'))(_0x6067('0x3'));var moment=require(_0x6067('0x4'));var BPromise=require(_0x6067('0x5'));var rp=require(_0x6067('0x6'));var fs=require('fs');var path=require(_0x6067('0x7'));var rimraf=require(_0x6067('0x8'));var config=require('../../config/environment');var attributes=require(_0x6067('0x9'));module[_0x6067('0xa')]=function(_0x3b52c2,_0x7d9ca6){return _0x3b52c2[_0x6067('0xb')](_0x6067('0xc'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb534=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x55dc56,_0xd0fee9){var _0x5942cf=function(_0x5ed032){while(--_0x5ed032){_0x55dc56['push'](_0x55dc56['shift']());}};_0x5942cf(++_0xd0fee9);}(_0xb534,0x90));var _0x4b53=function(_0x524245,_0x4a7d6e){_0x524245=_0x524245-0x0;var _0x18984a=_0xb534[_0x524245];return _0x18984a;};'use strict';var _=require(_0x4b53('0x0'));var util=require(_0x4b53('0x1'));var logger=require(_0x4b53('0x2'))(_0x4b53('0x3'));var moment=require(_0x4b53('0x4'));var BPromise=require('bluebird');var rp=require(_0x4b53('0x5'));var fs=require('fs');var path=require(_0x4b53('0x6'));var rimraf=require(_0x4b53('0x7'));var config=require(_0x4b53('0x8'));var attributes=require(_0x4b53('0x9'));module[_0x4b53('0xa')]=function(_0x124b13,_0x59ecb9){return _0x124b13[_0x4b53('0xb')]('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','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 9af2a1f..92e0e13 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 _0x73be=['../../config/environment','jayson/promise','client','http','request','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x39610b,_0x1d20d4){var _0x413830=function(_0x5d1cac){while(--_0x5d1cac){_0x39610b['push'](_0x39610b['shift']());}};_0x413830(++_0x1d20d4);}(_0x73be,0x124));var _0xe73b=function(_0x377a1d,_0x20bb23){_0x377a1d=_0x377a1d-0x0;var _0x5bbf3f=_0x73be[_0x377a1d];return _0x5bbf3f;};'use strict';var _=require('lodash');var util=require(_0xe73b('0x0'));var moment=require(_0xe73b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe73b('0x2'));var db=require(_0xe73b('0x3'))['db'];var utils=require(_0xe73b('0x4'));var logger=require(_0xe73b('0x5'))(_0xe73b('0x6'));var config=require(_0xe73b('0x7'));var jayson=require(_0xe73b('0x8'));var client=jayson[_0xe73b('0x9')][_0xe73b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x372adb,_0x59619d,_0x19fca5){return new BPromise(function(_0x5b3a5c,_0x24459f){return client[_0xe73b('0xb')](_0x372adb,_0x19fca5)['then'](function(_0x90e43a){logger['info'](_0xe73b('0xc'),_0x59619d,_0xe73b('0xd'));logger[_0xe73b('0xe')](_0xe73b('0xf'),_0x59619d,_0xe73b('0xd'),JSON[_0xe73b('0x10')](_0x90e43a));if(_0x90e43a[_0xe73b('0x11')]){if(_0x90e43a[_0xe73b('0x11')][_0xe73b('0x12')]===0x1f4){logger['error'](_0xe73b('0xc'),_0x59619d,_0x90e43a[_0xe73b('0x11')]['message']);return _0x24459f(_0x90e43a[_0xe73b('0x11')][_0xe73b('0x13')]);}logger[_0xe73b('0x11')](_0xe73b('0xc'),_0x59619d,_0x90e43a[_0xe73b('0x11')][_0xe73b('0x13')]);return _0x5b3a5c(_0x90e43a[_0xe73b('0x11')][_0xe73b('0x13')]);}else{logger[_0xe73b('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x59619d,_0xe73b('0xd'));_0x5b3a5c(_0x90e43a[_0xe73b('0x15')][_0xe73b('0x13')]);}})[_0xe73b('0x16')](function(_0x3bc4d4){logger[_0xe73b('0x11')](_0xe73b('0xc'),_0x59619d,_0x3bc4d4);_0x24459f(_0x3bc4d4);});});} \ No newline at end of file +var _0xc6f5=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc6f5,0x175));var _0x5c6f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc6f5[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x5c6f('0x0'));var util=require(_0x5c6f('0x1'));var moment=require(_0x5c6f('0x2'));var BPromise=require(_0x5c6f('0x3'));var rs=require(_0x5c6f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c6f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c6f('0x6'))('rpc');var config=require(_0x5c6f('0x7'));var jayson=require(_0x5c6f('0x8'));var client=jayson['client'][_0x5c6f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4dd5bd,_0x1b807f,_0x5e6871){return new BPromise(function(_0x3b65fa,_0x2e6848){return client[_0x5c6f('0xa')](_0x4dd5bd,_0x5e6871)['then'](function(_0x51fd48){logger['info'](_0x5c6f('0xb'),_0x1b807f,_0x5c6f('0xc'));logger[_0x5c6f('0xd')](_0x5c6f('0xe'),_0x1b807f,_0x5c6f('0xc'),JSON[_0x5c6f('0xf')](_0x51fd48));if(_0x51fd48[_0x5c6f('0x10')]){if(_0x51fd48[_0x5c6f('0x10')]['code']===0x1f4){logger[_0x5c6f('0x10')](_0x5c6f('0xb'),_0x1b807f,_0x51fd48[_0x5c6f('0x10')][_0x5c6f('0x11')]);return _0x2e6848(_0x51fd48[_0x5c6f('0x10')][_0x5c6f('0x11')]);}logger[_0x5c6f('0x10')](_0x5c6f('0xb'),_0x1b807f,_0x51fd48[_0x5c6f('0x10')]['message']);return _0x3b65fa(_0x51fd48[_0x5c6f('0x10')][_0x5c6f('0x11')]);}else{logger[_0x5c6f('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x1b807f,_0x5c6f('0xc'));_0x3b65fa(_0x51fd48[_0x5c6f('0x13')][_0x5c6f('0x11')]);}})[_0x5c6f('0x14')](function(_0x57ae6a){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x1b807f,_0x57ae6a);_0x2e6848(_0x57ae6a);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 5631f68..c894271 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 _0x1c88=['show','post','create','put','delete','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1c88,0x1a9));var _0x81c8=function(_0x129c27,_0x333c44){_0x129c27=_0x129c27-0x0;var _0x5a8017=_0x1c88[_0x129c27];return _0x5a8017;};'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')](_0x81c8('0x8'),auth[_0x81c8('0x9')](),controller[_0x81c8('0xa')]);router[_0x81c8('0xb')]('/',auth[_0x81c8('0x9')](),controller[_0x81c8('0xc')]);router[_0x81c8('0xd')](_0x81c8('0x8'),auth[_0x81c8('0x9')](),controller['update']);router[_0x81c8('0xe')](_0x81c8('0x8'),auth[_0x81c8('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9ee5=['destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','update','delete'];(function(_0x20f293,_0x113663){var _0x108c07=function(_0x579db7){while(--_0x579db7){_0x20f293['push'](_0x20f293['shift']());}};_0x108c07(++_0x113663);}(_0x9ee5,0x123));var _0x59ee=function(_0x5bb17b,_0x131109){_0x5bb17b=_0x5bb17b-0x0;var _0x558f09=_0x9ee5[_0x5bb17b];return _0x558f09;};'use strict';var multer=require(_0x59ee('0x0'));var util=require(_0x59ee('0x1'));var path=require(_0x59ee('0x2'));var timeout=require(_0x59ee('0x3'));var express=require(_0x59ee('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x59ee('0x5'));var controller=require(_0x59ee('0x6'));router[_0x59ee('0x7')](_0x59ee('0x8'),auth[_0x59ee('0x9')](),controller[_0x59ee('0xa')]);router[_0x59ee('0xb')]('/',auth[_0x59ee('0x9')](),controller[_0x59ee('0xc')]);router['put'](_0x59ee('0x8'),auth['isAuthenticated'](),controller[_0x59ee('0xd')]);router[_0x59ee('0xe')](_0x59ee('0x8'),auth[_0x59ee('0x9')](),controller[_0x59ee('0xf')]);module[_0x59ee('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 3e1df85..46dc3f0 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 _0xac22=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x2e1af3,_0x2a077b){var _0x4150cd=function(_0x1e08f3){while(--_0x1e08f3){_0x2e1af3['push'](_0x2e1af3['shift']());}};_0x4150cd(++_0x2a077b);}(_0xac22,0x1da));var _0x2ac2=function(_0x2e65ad,_0x2c2d4b){_0x2e65ad=_0x2e65ad-0x0;var _0x4968ff=_0xac22[_0x2e65ad];return _0x4968ff;};'use strict';var Sequelize=require('sequelize');module[_0x2ac2('0x0')]={'name':{'type':Sequelize[_0x2ac2('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2ac2('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2ac2('0x3')](_0x2ac2('0x4'),_0x2ac2('0x5'),_0x2ac2('0x6'))}}; \ No newline at end of file +var _0x328f=['INTEGER','rrmemory','beepall','exports','STRING','name'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0x328f,0x9f));var _0xf328=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0x328f[_0x3e2fcf];return _0x497db7;};'use strict';var Sequelize=require('sequelize');module[_0xf328('0x0')]={'name':{'type':Sequelize[_0xf328('0x1')],'unique':_0xf328('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf328('0x1')]},'timeout':{'type':Sequelize[_0xf328('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf328('0x4'),_0xf328('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 900e2b5..4434c36 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 _0x4db5=['desk.js','querystring','papaparse','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','jayson/promise','client','http','request','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','ChatQueues','destroy','name','send','index','ChatQueue','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','rows','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','findAll','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','online','transaction','each','emit','userChatQueue:save','removeTeams','ids','Agents','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','pick','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x24e186,_0x4e3ae9){var _0x45fac2=function(_0x50ba29){while(--_0x50ba29){_0x24e186['push'](_0x24e186['shift']());}};_0x45fac2(++_0x4e3ae9);}(_0x4db5,0x86));var _0x54db=function(_0x28216b,_0x58d947){_0x28216b=_0x28216b-0x0;var _0x3b4c6=_0x4db5[_0x28216b];return _0x3b4c6;};'use strict';var pdf=require(_0x54db('0x0'));var emlformat=require(_0x54db('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x54db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x54db('0x3'));var moment=require(_0x54db('0x4'));var BPromise=require(_0x54db('0x5'));var Mustache=require('mustache');var util=require(_0x54db('0x6'));var path=require(_0x54db('0x7'));var sox=require(_0x54db('0x8'));var csv=require(_0x54db('0x9'));var ejs=require(_0x54db('0xa'));var fs=require('fs');var _=require(_0x54db('0xb'));var squel=require('squel');var crypto=require(_0x54db('0xc'));var jsforce=require(_0x54db('0xd'));var deskjs=require(_0x54db('0xe'));var toCsv=require('to-csv');var querystring=require(_0x54db('0xf'));var Papa=require(_0x54db('0x10'));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('../../config/license/hardware');var logger=require(_0x54db('0x11'))(_0x54db('0x12'));var utils=require('../../config/utils');var config=require(_0x54db('0x13'));var licenseUtil=require(_0x54db('0x14'));var db=require(_0x54db('0x15'))['db'];config[_0x54db('0x16')]=_[_0x54db('0x17')](config[_0x54db('0x16')],{'host':_0x54db('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x54db('0x19'))['register'](socket);var jayson=require(_0x54db('0x1a'));var client=jayson[_0x54db('0x1b')][_0x54db('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x32f2cb,_0x11f4df,_0x17948a,_0x26fa9e){return new BPromise(function(_0x393608,_0x29cf1f){var _0x172532=_0x26fa9e||client;return _0x172532[_0x54db('0x1d')](_0x32f2cb,_0x17948a)['then'](function(_0x29bc83){logger[_0x54db('0x1e')](_0x54db('0x1f'),_0x11f4df,'request\x20sent');logger['debug'](_0x54db('0x20'),_0x11f4df,_0x54db('0x21'),JSON[_0x54db('0x22')](_0x29bc83));if(_0x29bc83[_0x54db('0x23')]){if(_0x29bc83[_0x54db('0x23')]['code']===0x1f4){logger[_0x54db('0x23')](_0x54db('0x1f'),_0x11f4df,_0x29bc83[_0x54db('0x23')]['message']);return _0x29cf1f(_0x29bc83['error'][_0x54db('0x24')]);}logger[_0x54db('0x23')]('ChatQueue,\x20%s,\x20%s',_0x11f4df,_0x29bc83[_0x54db('0x23')][_0x54db('0x24')]);return _0x393608(_0x29bc83[_0x54db('0x23')]['message']);}else{logger[_0x54db('0x1e')](_0x54db('0x1f'),_0x11f4df,_0x54db('0x21'));_0x393608(_0x29bc83[_0x54db('0x25')][_0x54db('0x24')]);}})[_0x54db('0x26')](function(_0x19a0aa){logger['error'](_0x54db('0x1f'),_0x11f4df,_0x19a0aa);_0x29cf1f(_0x19a0aa);});});}function respondWithStatusCode(_0x3e16e1,_0x270c4){_0x270c4=_0x270c4||0xcc;return function(_0x1507c7){if(_0x1507c7){return _0x3e16e1[_0x54db('0x27')](_0x270c4);}return _0x3e16e1[_0x54db('0x28')](_0x270c4)[_0x54db('0x29')]();};}function respondWithResult(_0x58f89e,_0x10dad5){_0x10dad5=_0x10dad5||0xc8;return function(_0x4c045d){if(_0x4c045d){return _0x58f89e[_0x54db('0x28')](_0x10dad5)[_0x54db('0x2a')](_0x4c045d);}};}function respondWithFilteredResult(_0x58d59e,_0x5b79ab){return function(_0x516492){if(_0x516492){var _0x16b538=_0x516492[_0x54db('0x2b')],_0x4872ac=_0x5b79ab[_0x54db('0x2c')],_0x1ac9c5=_0x5b79ab[_0x54db('0x2c')]+_0x5b79ab[_0x54db('0x2d')],_0x266613;if(_0x1ac9c5>=_0x16b538){_0x1ac9c5=_0x16b538;_0x266613=0xc8;}else{_0x266613=0xce;}_0x58d59e[_0x54db('0x28')](_0x266613);return _0x58d59e[_0x54db('0x2e')](_0x54db('0x2f'),_0x4872ac+'-'+_0x1ac9c5+'/'+_0x16b538)[_0x54db('0x2a')](_0x516492);}return null;};}function patchUpdates(_0x35f801){return function(_0x55d97c){try{jsonpatch[_0x54db('0x30')](_0x55d97c,_0x35f801,!![]);}catch(_0x479209){return BPromise[_0x54db('0x31')](_0x479209);}return _0x55d97c[_0x54db('0x32')]();};}function saveUpdates(_0x51ff0f,_0x4f7663){return function(_0x1d97f2){if(_0x1d97f2){return _0x1d97f2[_0x54db('0x33')](_0x51ff0f)['then'](function(_0x5e9d27){return _0x5e9d27;});}return null;};}function removeEntity(_0x21247e,_0x2e0099){return function(_0x126782){if(_0x126782){return _0x126782['destroy']()[_0x54db('0x34')](function(){var _0x32016b=_0x126782[_0x54db('0x35')]({'plain':!![]});var _0x1f36cc=_0x54db('0x36');return db['UserProfileResource'][_0x54db('0x37')]({'where':{'type':_0x1f36cc,'resourceId':_0x32016b['id']}})['then'](function(){return _0x126782;});})['then'](function(){_0x21247e['status'](0xcc)[_0x54db('0x29')]();});}};}function handleEntityNotFound(_0x5d290d,_0x5aaccc){return function(_0x71e51b){if(!_0x71e51b){_0x5d290d[_0x54db('0x27')](0x194);}return _0x71e51b;};}function handleError(_0x1cbb65,_0x212c9a){_0x212c9a=_0x212c9a||0x1f4;return function(_0x155194){logger[_0x54db('0x23')](_0x155194['stack']);if(_0x155194[_0x54db('0x38')]){delete _0x155194[_0x54db('0x38')];}_0x1cbb65[_0x54db('0x28')](_0x212c9a)[_0x54db('0x39')](_0x155194);};}exports[_0x54db('0x3a')]=function(_0x6445b4,_0x370d1c){var _0x2263a2={},_0x17d2d7={},_0x519d3f={'count':0x0,'rows':[]};var _0xc961db=_['map'](db[_0x54db('0x3b')][_0x54db('0x3c')],function(_0x377507){return{'name':_0x377507[_0x54db('0x3d')],'type':_0x377507[_0x54db('0x3e')][_0x54db('0x3f')]};});_0x17d2d7['model']=_[_0x54db('0x40')](_0xc961db,_0x54db('0x38'));_0x17d2d7['query']=_[_0x54db('0x41')](_0x6445b4[_0x54db('0x42')]);_0x17d2d7[_0x54db('0x43')]=_[_0x54db('0x44')](_0x17d2d7['model'],_0x17d2d7[_0x54db('0x42')]);_0x2263a2[_0x54db('0x45')]=_['intersection'](_0x17d2d7['model'],qs[_0x54db('0x46')](_0x6445b4[_0x54db('0x42')][_0x54db('0x46')]));_0x2263a2[_0x54db('0x45')]=_0x2263a2[_0x54db('0x45')][_0x54db('0x47')]?_0x2263a2['attributes']:_0x17d2d7[_0x54db('0x48')];if(!_0x6445b4[_0x54db('0x42')][_0x54db('0x49')](_0x54db('0x4a'))){_0x2263a2[_0x54db('0x2d')]=qs[_0x54db('0x2d')](_0x6445b4[_0x54db('0x42')][_0x54db('0x2d')]);_0x2263a2[_0x54db('0x2c')]=qs[_0x54db('0x2c')](_0x6445b4[_0x54db('0x42')]['offset']);}_0x2263a2[_0x54db('0x4b')]=qs[_0x54db('0x4c')](_0x6445b4['query'][_0x54db('0x4c')]);_0x2263a2[_0x54db('0x4d')]=qs[_0x54db('0x43')](_['pick'](_0x6445b4[_0x54db('0x42')],_0x17d2d7[_0x54db('0x43')]),_0xc961db);if(_0x6445b4[_0x54db('0x42')][_0x54db('0x4e')]){_0x2263a2[_0x54db('0x4d')]=_[_0x54db('0x4f')](_0x2263a2[_0x54db('0x4d')],{'$or':_['map'](_0xc961db,function(_0x5a6b30){if(_0x5a6b30[_0x54db('0x3e')]!=='VIRTUAL'){var _0x14c335={};_0x14c335[_0x5a6b30[_0x54db('0x38')]]={'$like':'%'+_0x6445b4[_0x54db('0x42')][_0x54db('0x4e')]+'%'};return _0x14c335;}})});}_0x2263a2=_[_0x54db('0x4f')]({},_0x2263a2,_0x6445b4['options']);var _0x2159be={'where':_0x2263a2['where']};return db['ChatQueue'][_0x54db('0x2b')](_0x2159be)[_0x54db('0x34')](function(_0x14f12d){_0x519d3f[_0x54db('0x2b')]=_0x14f12d;if(_0x6445b4['query'][_0x54db('0x50')]){_0x2263a2[_0x54db('0x51')]=[{'all':!![]}];}return db[_0x54db('0x3b')]['findAll'](_0x2263a2);})[_0x54db('0x34')](function(_0x46aae4){_0x519d3f[_0x54db('0x52')]=_0x46aae4;return _0x519d3f;})[_0x54db('0x34')](respondWithFilteredResult(_0x370d1c,_0x2263a2))[_0x54db('0x26')](handleError(_0x370d1c,null));};exports[_0x54db('0x53')]=function(_0x1810db,_0x1e03a4){var _0x3459f9={'raw':!![],'where':{'id':_0x1810db[_0x54db('0x54')]['id']}},_0x21bd16={};_0x21bd16[_0x54db('0x48')]=_[_0x54db('0x41')](db[_0x54db('0x3b')][_0x54db('0x3c')]);_0x21bd16[_0x54db('0x42')]=_[_0x54db('0x41')](_0x1810db[_0x54db('0x42')]);_0x21bd16[_0x54db('0x43')]=_[_0x54db('0x44')](_0x21bd16['model'],_0x21bd16[_0x54db('0x42')]);_0x3459f9[_0x54db('0x45')]=_['intersection'](_0x21bd16['model'],qs[_0x54db('0x46')](_0x1810db[_0x54db('0x42')][_0x54db('0x46')]));_0x3459f9['attributes']=_0x3459f9['attributes'][_0x54db('0x47')]?_0x3459f9[_0x54db('0x45')]:_0x21bd16['model'];if(_0x1810db['query'][_0x54db('0x50')]){_0x3459f9[_0x54db('0x51')]=[{'all':!![]}];}_0x3459f9=_['merge']({},_0x3459f9,_0x1810db[_0x54db('0x55')]);return db[_0x54db('0x3b')][_0x54db('0x56')](_0x3459f9)[_0x54db('0x34')](handleEntityNotFound(_0x1e03a4,null))[_0x54db('0x34')](respondWithResult(_0x1e03a4,null))[_0x54db('0x26')](handleError(_0x1e03a4,null));};exports[_0x54db('0x57')]=function(_0x3933a0,_0x3a12ad){return db[_0x54db('0x3b')][_0x54db('0x57')](_0x3933a0[_0x54db('0x58')],{})[_0x54db('0x34')](function(_0x5ceee2){var _0x36117b=_0x3933a0[_0x54db('0x59')][_0x54db('0x35')]({'plain':!![]});if(!_0x36117b)throw new Error(_0x54db('0x5a'));if(_0x36117b[_0x54db('0x5b')]==='user'){var _0x55e0ab=_0x5ceee2['get']({'plain':!![]});var _0x1574e4='ChatQueues';return db['UserProfileSection'][_0x54db('0x56')]({'where':{'name':_0x1574e4,'userProfileId':_0x36117b['userProfileId']},'raw':!![]})[_0x54db('0x34')](function(_0xc9d8b8){if(_0xc9d8b8&&_0xc9d8b8[_0x54db('0x5c')]===0x0){return db[_0x54db('0x5d')][_0x54db('0x57')]({'name':_0x55e0ab[_0x54db('0x38')],'resourceId':_0x55e0ab['id'],'type':_0xc9d8b8[_0x54db('0x38')],'sectionId':_0xc9d8b8['id']},{})['then'](function(){return _0x5ceee2;});}else{return _0x5ceee2;}})[_0x54db('0x26')](function(_0x35fbca){logger[_0x54db('0x23')](_0x54db('0x5e'),_0x35fbca);throw _0x35fbca;});}return _0x5ceee2;})[_0x54db('0x34')](respondWithResult(_0x3a12ad,0xc9))[_0x54db('0x26')](handleError(_0x3a12ad,null));};exports[_0x54db('0x33')]=function(_0xd2f153,_0x15fa55){if(_0xd2f153['body']['id']){delete _0xd2f153[_0x54db('0x58')]['id'];}return db[_0x54db('0x3b')][_0x54db('0x56')]({'where':{'id':_0xd2f153['params']['id']}})['then'](handleEntityNotFound(_0x15fa55,null))[_0x54db('0x34')](saveUpdates(_0xd2f153[_0x54db('0x58')],null))['then'](respondWithResult(_0x15fa55,null))[_0x54db('0x26')](handleError(_0x15fa55,null));};exports[_0x54db('0x37')]=function(_0x556a2c,_0x171431){return db[_0x54db('0x3b')][_0x54db('0x56')]({'where':{'id':_0x556a2c[_0x54db('0x54')]['id']}})['then'](handleEntityNotFound(_0x171431,null))['then'](removeEntity(_0x171431,null))['catch'](handleError(_0x171431,null));};exports[_0x54db('0x5f')]=function(_0x1a929d,_0x479647){return db['ChatQueue'][_0x54db('0x5f')]()[_0x54db('0x34')](respondWithResult(_0x479647,null))[_0x54db('0x26')](handleError(_0x479647,null));};exports['getMembers']=function(_0x4fc8a9,_0x58a3aa,_0x2bde52){var _0x4a33aa={'raw':!![],'where':{}},_0x1d5547={},_0x5c9333;return db[_0x54db('0x3b')][_0x54db('0x60')]({'where':{'id':_0x4fc8a9['params']['id']}})['then'](handleEntityNotFound(_0x58a3aa,null))['then'](function(_0x2784f2){if(_0x2784f2){_0x5c9333=_0x2784f2[_0x54db('0x35')]({'plain':!![]});_0x1d5547[_0x54db('0x48')]=_[_0x54db('0x41')](db[_0x54db('0x61')][_0x54db('0x3c')]);_0x1d5547['query']=_['keys'](_0x4fc8a9[_0x54db('0x42')]);_0x1d5547[_0x54db('0x43')]=_[_0x54db('0x44')](_0x1d5547['model'],_0x1d5547[_0x54db('0x42')]);_0x4a33aa[_0x54db('0x45')]=_[_0x54db('0x44')](_0x1d5547[_0x54db('0x48')],qs['fields'](_0x4fc8a9[_0x54db('0x42')][_0x54db('0x46')]));_0x4a33aa[_0x54db('0x45')]=_0x4a33aa['attributes'][_0x54db('0x47')]?_0x4a33aa[_0x54db('0x45')]:_0x1d5547['model'];if(!_0x4fc8a9['query'][_0x54db('0x49')](_0x54db('0x4a'))){_0x4a33aa['limit']=qs[_0x54db('0x2d')](_0x4fc8a9[_0x54db('0x42')][_0x54db('0x2d')]);_0x4a33aa[_0x54db('0x2c')]=qs[_0x54db('0x2c')](_0x4fc8a9[_0x54db('0x42')]['offset']);}_0x4a33aa[_0x54db('0x4b')]=qs[_0x54db('0x4c')](_0x4fc8a9['query'][_0x54db('0x4c')]);_0x4a33aa[_0x54db('0x4d')]=qs[_0x54db('0x43')](_['pick'](_0x4fc8a9[_0x54db('0x42')],_0x1d5547['filters']));_0x4a33aa[_0x54db('0x4d')]['ChatQueueId']=_0x2784f2['id'];if(_0x4fc8a9['query']['filter']){_0x4a33aa[_0x54db('0x4d')]=_['merge'](_0x4a33aa[_0x54db('0x4d')],{'$or':_[_0x54db('0x40')](_0x4a33aa['attributes'],function(_0x301570){var _0x3e4ff8={};_0x3e4ff8[_0x301570]={'$like':'%'+_0x4fc8a9[_0x54db('0x42')][_0x54db('0x4e')]+'%'};return _0x3e4ff8;})});}_0x4a33aa=_[_0x54db('0x4f')]({},_0x4a33aa,_0x4fc8a9[_0x54db('0x55')]);return db[_0x54db('0x61')][_0x54db('0x62')](_0x4a33aa);}})['then'](function(_0x3805b0){if(_0x3805b0){return db[_0x54db('0x63')][_0x54db('0x64')]({'where':{'id':_[_0x54db('0x40')](_0x3805b0,'UserId'),'role':_0x54db('0x65')},'attributes':['id','name',_0x54db('0x66'),_0x54db('0x67'),_0x54db('0x68')]});}})[_0x54db('0x34')](function(_0x4478b2){if(_0x4478b2){return{'count':_0x4478b2[_0x54db('0x2b')],'rows':_[_0x54db('0x40')](_0x4478b2[_0x54db('0x52')],function(_0xfd7be0){return{'membername':_0xfd7be0[_0x54db('0x38')],'UserId':_0xfd7be0['id'],'queue_name':_0x5c9333[_0x54db('0x38')],'ChatQueueId':_0x5c9333['id'],'interface':util[_0x54db('0x69')](_0x54db('0x6a'),_0x54db('0x6b'),_0xfd7be0[_0x54db('0x38')]),'penalty':0x0,'paused':_0xfd7be0[_0x54db('0x66')],'createdAt':_0xfd7be0[_0x54db('0x68')],'updatedAt':_0xfd7be0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x54db('0x34')](respondWithFilteredResult(_0x58a3aa,_0x4a33aa))[_0x54db('0x26')](handleError(_0x58a3aa,null));};exports[_0x54db('0x6c')]=function(_0x578f78,_0x46fdce,_0x3d9ccb){var _0x3a8d6b={};var _0x176f5f={};var _0x9217ef;var _0x253dec;return db[_0x54db('0x3b')][_0x54db('0x60')]({'where':{'id':_0x578f78[_0x54db('0x54')]['id']}})['then'](handleEntityNotFound(_0x46fdce,null))[_0x54db('0x34')](function(_0x274ec9){if(_0x274ec9){_0x9217ef=_0x274ec9;_0x176f5f[_0x54db('0x48')]=_['keys'](db[_0x54db('0x6d')][_0x54db('0x3c')]);_0x176f5f[_0x54db('0x42')]=_['keys'](_0x578f78[_0x54db('0x42')]);_0x176f5f[_0x54db('0x43')]=_[_0x54db('0x44')](_0x176f5f[_0x54db('0x48')],_0x176f5f[_0x54db('0x42')]);_0x3a8d6b[_0x54db('0x45')]=_[_0x54db('0x44')](_0x176f5f[_0x54db('0x48')],qs[_0x54db('0x46')](_0x578f78[_0x54db('0x42')][_0x54db('0x46')]));_0x3a8d6b['attributes']=_0x3a8d6b[_0x54db('0x45')][_0x54db('0x47')]?_0x3a8d6b[_0x54db('0x45')]:_0x176f5f[_0x54db('0x48')];_0x3a8d6b[_0x54db('0x4b')]=qs[_0x54db('0x4c')](_0x578f78[_0x54db('0x42')][_0x54db('0x4c')]);_0x3a8d6b[_0x54db('0x4d')]=qs[_0x54db('0x43')](_['pick'](_0x578f78[_0x54db('0x42')],_0x176f5f[_0x54db('0x43')]));if(_0x578f78['query'][_0x54db('0x4e')]){_0x3a8d6b[_0x54db('0x4d')]=_[_0x54db('0x4f')](_0x3a8d6b['where'],{'$or':_['map'](_0x3a8d6b[_0x54db('0x45')],function(_0x2234e2){var _0xb2ac85={};_0xb2ac85[_0x2234e2]={'$like':'%'+_0x578f78[_0x54db('0x42')][_0x54db('0x4e')]+'%'};return _0xb2ac85;})});}_0x3a8d6b=_[_0x54db('0x4f')]({},_0x3a8d6b,_0x578f78[_0x54db('0x55')]);return _0x9217ef[_0x54db('0x6c')](_0x3a8d6b);}})[_0x54db('0x34')](function(_0x51dbce){if(_0x51dbce){_0x253dec=_0x51dbce[_0x54db('0x47')];if(!_0x578f78[_0x54db('0x42')][_0x54db('0x49')](_0x54db('0x4a'))){_0x3a8d6b[_0x54db('0x2d')]=qs[_0x54db('0x2d')](_0x578f78[_0x54db('0x42')]['limit']);_0x3a8d6b[_0x54db('0x2c')]=qs['offset'](_0x578f78[_0x54db('0x42')][_0x54db('0x2c')]);}return _0x9217ef['getTeams'](_0x3a8d6b);}})[_0x54db('0x34')](function(_0x5416b0){if(_0x5416b0){return _0x5416b0?{'count':_0x253dec,'rows':_0x5416b0}:null;}})['then'](respondWithResult(_0x46fdce,null))[_0x54db('0x26')](handleError(_0x46fdce,null));};exports[_0x54db('0x6e')]=function(_0x41703e,_0x4a3dae,_0x21609f){var _0x22a482=_0x41703e[_0x54db('0x58')]['ids'];return db[_0x54db('0x6d')][_0x54db('0x62')]({'where':{'id':_0x22a482},'attributes':['id'],'include':[{'model':db[_0x54db('0x63')],'as':'Agents','attributes':['id',_0x54db('0x38'),_0x54db('0x6f'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x25b601){if(_0x25b601){var _0x1edd0f=_['flatMap'](_0x25b601,function(_0x4d2eed){var _0x4cdc52=_0x4d2eed['get']({'plain':!![]});return _0x4cdc52['Agents'];});return db[_0x54db('0x3b')][_0x54db('0x56')]({'where':{'id':_0x41703e[_0x54db('0x54')]['id']}})[_0x54db('0x34')](function(_0x47ba98){return db['sequelize'][_0x54db('0x70')](function(_0x338762){return _0x47ba98[_0x54db('0x6e')](_0x22a482,{'transaction':_0x338762})[_0x54db('0x34')](function(){return BPromise[_0x54db('0x71')](_0x1edd0f,function(_0x4c7883){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x4c7883['id'],'ChatQueueId':_0x41703e[_0x54db('0x54')]['id']},'transaction':_0x338762});});})[_0x54db('0x34')](function(){_0x1edd0f['forEach'](function(_0x178520){socket[_0x54db('0x72')](_0x54db('0x73'),{'UserId':_0x178520['id'],'ChatQueueId':_0x47ba98['id']});});});});});}})['then'](respondWithStatusCode(_0x4a3dae,null))[_0x54db('0x26')](handleError(_0x4a3dae,null));};exports[_0x54db('0x74')]=function(_0x49e850,_0x446279,_0x422770){return db[_0x54db('0x6d')][_0x54db('0x62')]({'where':{'id':_0x49e850[_0x54db('0x42')][_0x54db('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x54db('0x76'),'attributes':['id'],'raw':!![]}]})[_0x54db('0x34')](handleEntityNotFound(_0x446279,null))['then'](function(_0x2471b9){var _0xadfa74=_[_0x54db('0x40')](_0x2471b9,'id');var _0x19018f=[];var _0x53da41=[];var _0x56cd55=squel['select']();_0x56cd55[_0x54db('0x77')](_0x54db('0x78'))['from'](_0x54db('0x79'),'tq')[_0x54db('0x7a')](_0x54db('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x54db('0x4d')](_0x54db('0x7c'),_0x49e850['params']['id']);for(var _0x2e1af3=0x0;_0x2e1af3<_0x2471b9['length'];_0x2e1af3+=0x1){let _0x337d7a=_0x2471b9[_0x2e1af3];for(var _0x331d5c=0x0;_0x331d5c<_0x337d7a['Agents'][_0x54db('0x47')];_0x331d5c+=0x1){let _0x19cde2=_0x337d7a[_0x54db('0x76')][_0x331d5c];var _0x470007=_0x56cd55['clone']();_0x470007[_0x54db('0x4d')](_0x54db('0x7d'),_0x19cde2['id']);_0x53da41[_0x54db('0x7e')](db[_0x54db('0x7f')][_0x54db('0x42')](_0x470007[_0x54db('0x80')](),{'type':db[_0x54db('0x7f')][_0x54db('0x81')][_0x54db('0x82')]})['then'](function(_0xcf23d9){if(_0xcf23d9['length']===0x1){return _0x19cde2['id'];}else{var _0xd1547b=_[_0x54db('0x83')](_[_0x54db('0x40')](_0xcf23d9,_0x54db('0x84')),function(_0x5d26a6){return _[_0x54db('0x85')](_0xadfa74,_0x5d26a6);});if(_0xd1547b){return _0x19cde2['id'];}}}));}}return BPromise[_0x54db('0x86')](_0x53da41)[_0x54db('0x34')](function(_0x48a0fa){_0x19018f=_(_0x19018f)[_0x54db('0x87')](_0x48a0fa)[_0x54db('0x88')]()[_0x54db('0x89')]();return db[_0x54db('0x3b')][_0x54db('0x56')]({'where':{'id':_0x49e850['params']['id']}})['then'](function(_0x2f0d6b){return db['sequelize'][_0x54db('0x70')](function(_0x55881c){return _0x2f0d6b[_0x54db('0x74')](_0x49e850[_0x54db('0x42')][_0x54db('0x75')],{'transaction':_0x55881c})[_0x54db('0x34')](function(){if(!_[_0x54db('0x8a')](_0x19018f)){return _0x2f0d6b[_0x54db('0x8b')](_0x19018f,{'transaction':_0x55881c});}})[_0x54db('0x34')](function(){_0x19018f[_0x54db('0x8c')](function(_0x259a34){socket[_0x54db('0x72')](_0x54db('0x8d'),{'UserId':_0x259a34,'ChatQueueId':_0x2f0d6b['id']});});});});});});})[_0x54db('0x34')](respondWithStatusCode(_0x446279,null))['catch'](handleError(_0x446279,null));};exports[_0x54db('0x8e')]=function(_0x598bb1,_0x1f68b6,_0x3a8aa7){return db['ChatQueue']['find']({'where':{'id':_0x598bb1[_0x54db('0x54')]['id']}})[_0x54db('0x34')](handleEntityNotFound(_0x1f68b6,null))['then'](function(_0x27fcce){if(_0x27fcce){return _0x27fcce['addAgents'](_0x598bb1[_0x54db('0x58')][_0x54db('0x75')],_[_0x54db('0x8f')](_0x598bb1[_0x54db('0x58')],['ids','id'])||{})[_0x54db('0x90')](function(_0x40a39d){for(var _0x4ee93a=0x0;_0x4ee93a<_0x598bb1['body'][_0x54db('0x75')][_0x54db('0x47')];_0x4ee93a+=0x1){socket[_0x54db('0x72')](_0x54db('0x73'),{'UserId':_0x598bb1[_0x54db('0x58')][_0x54db('0x75')][_0x4ee93a],'ChatQueueId':_0x598bb1['params']['id']});}return _0x40a39d;});}})['then'](respondWithResult(_0x1f68b6,null))[_0x54db('0x26')](handleError(_0x1f68b6,null));};exports[_0x54db('0x8b')]=function(_0x23b70f,_0x27b331,_0x1f6b44){return db[_0x54db('0x3b')][_0x54db('0x56')]({'where':{'id':_0x23b70f[_0x54db('0x54')]['id']}})['then'](handleEntityNotFound(_0x27b331,null))[_0x54db('0x34')](function(_0x1d818d){if(_0x1d818d){return _0x1d818d[_0x54db('0x8b')](_0x23b70f['query'][_0x54db('0x75')])[_0x54db('0x34')](function(){if(_[_0x54db('0x91')](_0x23b70f[_0x54db('0x42')]['ids'])){for(var _0x4c3a81=0x0;_0x4c3a81<_0x23b70f[_0x54db('0x42')][_0x54db('0x75')][_0x54db('0x47')];_0x4c3a81+=0x1){socket[_0x54db('0x72')](_0x54db('0x8d'),{'UserId':Number(_0x23b70f[_0x54db('0x42')][_0x54db('0x75')][_0x4c3a81]),'ChatQueueId':Number(_0x23b70f[_0x54db('0x54')]['id'])});}}else{socket['emit'](_0x54db('0x8d'),{'UserId':Number(_0x23b70f['query']['ids']),'ChatQueueId':Number(_0x23b70f['params']['id'])});}});}})[_0x54db('0x34')](respondWithStatusCode(_0x27b331,null))[_0x54db('0x26')](handleError(_0x27b331,null));};exports[_0x54db('0x92')]=function(_0x230f28,_0x1140a4,_0x92427e){var _0x173879={};var _0x762ec7={};var _0x221d32;var _0x539262;return db[_0x54db('0x3b')][_0x54db('0x60')]({'where':{'id':_0x230f28['params']['id']}})[_0x54db('0x34')](handleEntityNotFound(_0x1140a4,null))[_0x54db('0x34')](function(_0x5c443b){if(_0x5c443b){_0x221d32=_0x5c443b;_0x762ec7[_0x54db('0x48')]=_['keys'](db[_0x54db('0x63')][_0x54db('0x3c')]);_0x762ec7[_0x54db('0x42')]=_[_0x54db('0x41')](_0x230f28[_0x54db('0x42')]);_0x762ec7[_0x54db('0x43')]=_[_0x54db('0x44')](_0x762ec7[_0x54db('0x48')],_0x762ec7['query']);_0x173879[_0x54db('0x45')]=_[_0x54db('0x44')](_0x762ec7[_0x54db('0x48')],qs[_0x54db('0x46')](_0x230f28['query'][_0x54db('0x46')]));_0x173879[_0x54db('0x45')]=_0x173879[_0x54db('0x45')]['length']?_0x173879['attributes']:_0x762ec7[_0x54db('0x48')];_0x173879[_0x54db('0x4b')]=qs[_0x54db('0x4c')](_0x230f28['query'][_0x54db('0x4c')]);_0x173879[_0x54db('0x4d')]=qs[_0x54db('0x43')](_[_0x54db('0x93')](_0x230f28[_0x54db('0x42')],_0x762ec7[_0x54db('0x43')]));if(_0x230f28[_0x54db('0x42')][_0x54db('0x4e')]){_0x173879[_0x54db('0x4d')]=_[_0x54db('0x4f')](_0x173879['where'],{'$or':_[_0x54db('0x40')](_0x173879['attributes'],function(_0x50e5c7){var _0x4a789d={};_0x4a789d[_0x50e5c7]={'$like':'%'+_0x230f28[_0x54db('0x42')][_0x54db('0x4e')]+'%'};return _0x4a789d;})});}_0x173879=_['merge']({},_0x173879,_0x230f28['options']);return _0x221d32[_0x54db('0x92')](_0x173879);}})[_0x54db('0x34')](function(_0x4e4c69){if(_0x4e4c69){_0x539262=_0x4e4c69[_0x54db('0x47')];if(!_0x230f28['query'][_0x54db('0x49')](_0x54db('0x4a'))){_0x173879['limit']=qs[_0x54db('0x2d')](_0x230f28['query'][_0x54db('0x2d')]);_0x173879[_0x54db('0x2c')]=qs[_0x54db('0x2c')](_0x230f28['query']['offset']);}return _0x221d32['getAgents'](_0x173879);}})[_0x54db('0x34')](function(_0x42c752){if(_0x42c752){return _0x42c752?{'count':_0x539262,'rows':_0x42c752}:null;}})[_0x54db('0x34')](respondWithResult(_0x1140a4,null))['catch'](handleError(_0x1140a4,null));}; \ No newline at end of file +var _0x4d6d=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','client','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','type','include','findAll','rows','show','params','keys','length','includeAll','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','body','describe','getMembers','findOne','order','pick','filter','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','count','format','%s/%s','Team','getTeams','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','findOrCreate','forEach','emit','userChatQueue:save','ids','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','transaction','removeTeams','removeAgents','userChatQueue:remove','omit','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x4d6d,0x116));var _0xd4d6=function(_0x20f33c,_0x425487){_0x20f33c=_0x20f33c-0x0;var _0x59f640=_0x4d6d[_0x20f33c];return _0x59f640;};'use strict';var pdf=require(_0xd4d6('0x0'));var emlformat=require(_0xd4d6('0x1'));var rimraf=require(_0xd4d6('0x2'));var zipdir=require(_0xd4d6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd4d6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd4d6('0x5'));var path=require(_0xd4d6('0x6'));var sox=require(_0xd4d6('0x7'));var csv=require(_0xd4d6('0x8'));var ejs=require(_0xd4d6('0x9'));var fs=require('fs');var _=require(_0xd4d6('0xa'));var squel=require(_0xd4d6('0xb'));var crypto=require(_0xd4d6('0xc'));var jsforce=require(_0xd4d6('0xd'));var deskjs=require(_0xd4d6('0xe'));var toCsv=require(_0xd4d6('0x8'));var querystring=require('querystring');var Papa=require(_0xd4d6('0xf'));var Redis=require(_0xd4d6('0x10'));var authService=require(_0xd4d6('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4d6('0x12'));var logger=require(_0xd4d6('0x13'))(_0xd4d6('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd4d6('0x15'));var db=require(_0xd4d6('0x16'))['db'];config[_0xd4d6('0x17')]=_[_0xd4d6('0x18')](config[_0xd4d6('0x17')],{'host':_0xd4d6('0x19'),'port':0x18eb});var socket=require(_0xd4d6('0x1a'))(new Redis(config[_0xd4d6('0x17')]));require(_0xd4d6('0x1b'))[_0xd4d6('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd4d6('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc20cc2,_0x3eeff3,_0x24a9dc,_0x7cc077){return new BPromise(function(_0x322618,_0x818123){var _0x33b51b=_0x7cc077||client;return _0x33b51b[_0xd4d6('0x1e')](_0xc20cc2,_0x24a9dc)[_0xd4d6('0x1f')](function(_0x2dfda5){logger['info'](_0xd4d6('0x20'),_0x3eeff3,_0xd4d6('0x21'));logger[_0xd4d6('0x22')](_0xd4d6('0x23'),_0x3eeff3,_0xd4d6('0x21'),JSON[_0xd4d6('0x24')](_0x2dfda5));if(_0x2dfda5[_0xd4d6('0x25')]){if(_0x2dfda5[_0xd4d6('0x25')]['code']===0x1f4){logger['error'](_0xd4d6('0x20'),_0x3eeff3,_0x2dfda5[_0xd4d6('0x25')]['message']);return _0x818123(_0x2dfda5[_0xd4d6('0x25')][_0xd4d6('0x26')]);}logger[_0xd4d6('0x25')](_0xd4d6('0x20'),_0x3eeff3,_0x2dfda5[_0xd4d6('0x25')]['message']);return _0x322618(_0x2dfda5[_0xd4d6('0x25')][_0xd4d6('0x26')]);}else{logger['info'](_0xd4d6('0x20'),_0x3eeff3,'request\x20sent');_0x322618(_0x2dfda5[_0xd4d6('0x27')][_0xd4d6('0x26')]);}})['catch'](function(_0x6a0878){logger['error'](_0xd4d6('0x20'),_0x3eeff3,_0x6a0878);_0x818123(_0x6a0878);});});}function respondWithStatusCode(_0x30294d,_0x5eb247){_0x5eb247=_0x5eb247||0xcc;return function(_0x224186){if(_0x224186){return _0x30294d[_0xd4d6('0x28')](_0x5eb247);}return _0x30294d['status'](_0x5eb247)[_0xd4d6('0x29')]();};}function respondWithResult(_0x5935a8,_0x1f0bd6){_0x1f0bd6=_0x1f0bd6||0xc8;return function(_0x351f5e){if(_0x351f5e){return _0x5935a8[_0xd4d6('0x2a')](_0x1f0bd6)[_0xd4d6('0x2b')](_0x351f5e);}};}function respondWithFilteredResult(_0x5c69f8,_0x45f362){return function(_0x26e61a){if(_0x26e61a){var _0x307b47=_0x26e61a['count'],_0x4aedde=_0x45f362[_0xd4d6('0x2c')],_0x48c09e=_0x45f362['offset']+_0x45f362[_0xd4d6('0x2d')],_0x2047a6;if(_0x48c09e>=_0x307b47){_0x48c09e=_0x307b47;_0x2047a6=0xc8;}else{_0x2047a6=0xce;}_0x5c69f8[_0xd4d6('0x2a')](_0x2047a6);return _0x5c69f8['set'](_0xd4d6('0x2e'),_0x4aedde+'-'+_0x48c09e+'/'+_0x307b47)[_0xd4d6('0x2b')](_0x26e61a);}return null;};}function patchUpdates(_0x3ab3ee){return function(_0x3b2c08){try{jsonpatch[_0xd4d6('0x2f')](_0x3b2c08,_0x3ab3ee,!![]);}catch(_0x5d5c78){return BPromise[_0xd4d6('0x30')](_0x5d5c78);}return _0x3b2c08[_0xd4d6('0x31')]();};}function saveUpdates(_0x443c03,_0x4598d6){return function(_0x4a0ddb){if(_0x4a0ddb){return _0x4a0ddb[_0xd4d6('0x32')](_0x443c03)[_0xd4d6('0x1f')](function(_0x3e99a7){return _0x3e99a7;});}return null;};}function removeEntity(_0x5b3d7b,_0x914a83){return function(_0x425cea){if(_0x425cea){return _0x425cea[_0xd4d6('0x33')]()[_0xd4d6('0x1f')](function(){var _0x54a384=_0x425cea[_0xd4d6('0x34')]({'plain':!![]});var _0x163203='ChatQueues';return db[_0xd4d6('0x35')]['destroy']({'where':{'type':_0x163203,'resourceId':_0x54a384['id']}})[_0xd4d6('0x1f')](function(){return _0x425cea;});})[_0xd4d6('0x1f')](function(){_0x5b3d7b[_0xd4d6('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b511e,_0x329b73){return function(_0x4062ae){if(!_0x4062ae){_0x5b511e['sendStatus'](0x194);}return _0x4062ae;};}function handleError(_0x6bd3fc,_0x1e611d){_0x1e611d=_0x1e611d||0x1f4;return function(_0x4d5467){logger[_0xd4d6('0x25')](_0x4d5467[_0xd4d6('0x36')]);if(_0x4d5467['name']){delete _0x4d5467[_0xd4d6('0x37')];}_0x6bd3fc[_0xd4d6('0x2a')](_0x1e611d)[_0xd4d6('0x38')](_0x4d5467);};}exports[_0xd4d6('0x39')]=function(_0x449510,_0x3c2600){var _0x549833={},_0x515c00={},_0x3cb478={'count':0x0,'rows':[]};var _0x1ee7b7=_[_0xd4d6('0x3a')](db[_0xd4d6('0x3b')][_0xd4d6('0x3c')],function(_0x3e294a){return{'name':_0x3e294a[_0xd4d6('0x3d')],'type':_0x3e294a['type'][_0xd4d6('0x3e')]};});_0x515c00[_0xd4d6('0x3f')]=_[_0xd4d6('0x3a')](_0x1ee7b7,_0xd4d6('0x37'));_0x515c00[_0xd4d6('0x40')]=_['keys'](_0x449510[_0xd4d6('0x40')]);_0x515c00[_0xd4d6('0x41')]=_[_0xd4d6('0x42')](_0x515c00[_0xd4d6('0x3f')],_0x515c00[_0xd4d6('0x40')]);_0x549833[_0xd4d6('0x43')]=_[_0xd4d6('0x42')](_0x515c00[_0xd4d6('0x3f')],qs[_0xd4d6('0x44')](_0x449510[_0xd4d6('0x40')][_0xd4d6('0x44')]));_0x549833[_0xd4d6('0x43')]=_0x549833[_0xd4d6('0x43')]['length']?_0x549833[_0xd4d6('0x43')]:_0x515c00[_0xd4d6('0x3f')];if(!_0x449510[_0xd4d6('0x40')][_0xd4d6('0x45')](_0xd4d6('0x46'))){_0x549833[_0xd4d6('0x2d')]=qs[_0xd4d6('0x2d')](_0x449510[_0xd4d6('0x40')][_0xd4d6('0x2d')]);_0x549833[_0xd4d6('0x2c')]=qs[_0xd4d6('0x2c')](_0x449510[_0xd4d6('0x40')]['offset']);}_0x549833['order']=qs[_0xd4d6('0x47')](_0x449510[_0xd4d6('0x40')][_0xd4d6('0x47')]);_0x549833[_0xd4d6('0x48')]=qs[_0xd4d6('0x41')](_['pick'](_0x449510[_0xd4d6('0x40')],_0x515c00['filters']),_0x1ee7b7);if(_0x449510['query']['filter']){_0x549833[_0xd4d6('0x48')]=_[_0xd4d6('0x49')](_0x549833['where'],{'$or':_[_0xd4d6('0x3a')](_0x1ee7b7,function(_0xa91c00){if(_0xa91c00[_0xd4d6('0x4a')]!=='VIRTUAL'){var _0x62e39b={};_0x62e39b[_0xa91c00['name']]={'$like':'%'+_0x449510[_0xd4d6('0x40')]['filter']+'%'};return _0x62e39b;}})});}_0x549833=_[_0xd4d6('0x49')]({},_0x549833,_0x449510['options']);var _0x2a42b0={'where':_0x549833['where']};return db[_0xd4d6('0x3b')]['count'](_0x2a42b0)['then'](function(_0x3870b1){_0x3cb478['count']=_0x3870b1;if(_0x449510[_0xd4d6('0x40')]['includeAll']){_0x549833[_0xd4d6('0x4b')]=[{'all':!![]}];}return db[_0xd4d6('0x3b')][_0xd4d6('0x4c')](_0x549833);})['then'](function(_0x3a239c){_0x3cb478[_0xd4d6('0x4d')]=_0x3a239c;return _0x3cb478;})[_0xd4d6('0x1f')](respondWithFilteredResult(_0x3c2600,_0x549833))['catch'](handleError(_0x3c2600,null));};exports[_0xd4d6('0x4e')]=function(_0x5c561a,_0x416e6a){var _0x2337f4={'raw':!![],'where':{'id':_0x5c561a[_0xd4d6('0x4f')]['id']}},_0x5c4547={};_0x5c4547[_0xd4d6('0x3f')]=_['keys'](db['ChatQueue'][_0xd4d6('0x3c')]);_0x5c4547['query']=_[_0xd4d6('0x50')](_0x5c561a[_0xd4d6('0x40')]);_0x5c4547[_0xd4d6('0x41')]=_[_0xd4d6('0x42')](_0x5c4547[_0xd4d6('0x3f')],_0x5c4547['query']);_0x2337f4[_0xd4d6('0x43')]=_[_0xd4d6('0x42')](_0x5c4547[_0xd4d6('0x3f')],qs[_0xd4d6('0x44')](_0x5c561a['query'][_0xd4d6('0x44')]));_0x2337f4[_0xd4d6('0x43')]=_0x2337f4[_0xd4d6('0x43')][_0xd4d6('0x51')]?_0x2337f4[_0xd4d6('0x43')]:_0x5c4547[_0xd4d6('0x3f')];if(_0x5c561a[_0xd4d6('0x40')][_0xd4d6('0x52')]){_0x2337f4[_0xd4d6('0x4b')]=[{'all':!![]}];}_0x2337f4=_['merge']({},_0x2337f4,_0x5c561a[_0xd4d6('0x53')]);return db['ChatQueue'][_0xd4d6('0x54')](_0x2337f4)[_0xd4d6('0x1f')](handleEntityNotFound(_0x416e6a,null))[_0xd4d6('0x1f')](respondWithResult(_0x416e6a,null))[_0xd4d6('0x55')](handleError(_0x416e6a,null));};exports[_0xd4d6('0x56')]=function(_0x37c6f0,_0x417089){return db[_0xd4d6('0x3b')]['create'](_0x37c6f0['body'],{})['then'](function(_0x4a81e7){var _0x108c0c=_0x37c6f0[_0xd4d6('0x57')][_0xd4d6('0x34')]({'plain':!![]});if(!_0x108c0c)throw new Error(_0xd4d6('0x58'));if(_0x108c0c[_0xd4d6('0x59')]==='user'){var _0x4bb12e=_0x4a81e7[_0xd4d6('0x34')]({'plain':!![]});var _0x680e09=_0xd4d6('0x5a');return db[_0xd4d6('0x5b')][_0xd4d6('0x54')]({'where':{'name':_0x680e09,'userProfileId':_0x108c0c[_0xd4d6('0x5c')]},'raw':!![]})['then'](function(_0x3d30d3){if(_0x3d30d3&&_0x3d30d3[_0xd4d6('0x5d')]===0x0){return db[_0xd4d6('0x35')][_0xd4d6('0x56')]({'name':_0x4bb12e['name'],'resourceId':_0x4bb12e['id'],'type':_0x3d30d3['name'],'sectionId':_0x3d30d3['id']},{})['then'](function(){return _0x4a81e7;});}else{return _0x4a81e7;}})[_0xd4d6('0x55')](function(_0x3f0d0f){logger[_0xd4d6('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f0d0f);throw _0x3f0d0f;});}return _0x4a81e7;})[_0xd4d6('0x1f')](respondWithResult(_0x417089,0xc9))[_0xd4d6('0x55')](handleError(_0x417089,null));};exports[_0xd4d6('0x32')]=function(_0x231f19,_0x3f2943){if(_0x231f19[_0xd4d6('0x5e')]['id']){delete _0x231f19[_0xd4d6('0x5e')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x231f19[_0xd4d6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3f2943,null))[_0xd4d6('0x1f')](saveUpdates(_0x231f19['body'],null))[_0xd4d6('0x1f')](respondWithResult(_0x3f2943,null))[_0xd4d6('0x55')](handleError(_0x3f2943,null));};exports['destroy']=function(_0x2eaa21,_0x3b3634){return db['ChatQueue'][_0xd4d6('0x54')]({'where':{'id':_0x2eaa21[_0xd4d6('0x4f')]['id']}})[_0xd4d6('0x1f')](handleEntityNotFound(_0x3b3634,null))[_0xd4d6('0x1f')](removeEntity(_0x3b3634,null))[_0xd4d6('0x55')](handleError(_0x3b3634,null));};exports[_0xd4d6('0x5f')]=function(_0x1497b0,_0x4467d9){return db['ChatQueue'][_0xd4d6('0x5f')]()['then'](respondWithResult(_0x4467d9,null))['catch'](handleError(_0x4467d9,null));};exports[_0xd4d6('0x60')]=function(_0x306b1c,_0x1abba3,_0x4d0210){var _0x52400a={'raw':!![],'where':{}},_0x2abae1={},_0x29e35;return db[_0xd4d6('0x3b')][_0xd4d6('0x61')]({'where':{'id':_0x306b1c[_0xd4d6('0x4f')]['id']}})[_0xd4d6('0x1f')](handleEntityNotFound(_0x1abba3,null))[_0xd4d6('0x1f')](function(_0x1b01a9){if(_0x1b01a9){_0x29e35=_0x1b01a9[_0xd4d6('0x34')]({'plain':!![]});_0x2abae1[_0xd4d6('0x3f')]=_['keys'](db['UserChatQueue']['rawAttributes']);_0x2abae1[_0xd4d6('0x40')]=_['keys'](_0x306b1c[_0xd4d6('0x40')]);_0x2abae1[_0xd4d6('0x41')]=_[_0xd4d6('0x42')](_0x2abae1[_0xd4d6('0x3f')],_0x2abae1[_0xd4d6('0x40')]);_0x52400a[_0xd4d6('0x43')]=_[_0xd4d6('0x42')](_0x2abae1[_0xd4d6('0x3f')],qs[_0xd4d6('0x44')](_0x306b1c[_0xd4d6('0x40')][_0xd4d6('0x44')]));_0x52400a[_0xd4d6('0x43')]=_0x52400a[_0xd4d6('0x43')][_0xd4d6('0x51')]?_0x52400a['attributes']:_0x2abae1[_0xd4d6('0x3f')];if(!_0x306b1c[_0xd4d6('0x40')]['hasOwnProperty']('nolimit')){_0x52400a[_0xd4d6('0x2d')]=qs['limit'](_0x306b1c[_0xd4d6('0x40')]['limit']);_0x52400a[_0xd4d6('0x2c')]=qs[_0xd4d6('0x2c')](_0x306b1c[_0xd4d6('0x40')][_0xd4d6('0x2c')]);}_0x52400a[_0xd4d6('0x62')]=qs[_0xd4d6('0x47')](_0x306b1c[_0xd4d6('0x40')]['sort']);_0x52400a[_0xd4d6('0x48')]=qs[_0xd4d6('0x41')](_[_0xd4d6('0x63')](_0x306b1c[_0xd4d6('0x40')],_0x2abae1[_0xd4d6('0x41')]));_0x52400a[_0xd4d6('0x48')]['ChatQueueId']=_0x1b01a9['id'];if(_0x306b1c[_0xd4d6('0x40')][_0xd4d6('0x64')]){_0x52400a[_0xd4d6('0x48')]=_['merge'](_0x52400a[_0xd4d6('0x48')],{'$or':_[_0xd4d6('0x3a')](_0x52400a[_0xd4d6('0x43')],function(_0x27047f){var _0x1708a9={};_0x1708a9[_0x27047f]={'$like':'%'+_0x306b1c[_0xd4d6('0x40')][_0xd4d6('0x64')]+'%'};return _0x1708a9;})});}_0x52400a=_[_0xd4d6('0x49')]({},_0x52400a,_0x306b1c[_0xd4d6('0x53')]);return db[_0xd4d6('0x65')]['findAll'](_0x52400a);}})['then'](function(_0x5d64c5){if(_0x5d64c5){return db[_0xd4d6('0x66')][_0xd4d6('0x67')]({'where':{'id':_['map'](_0x5d64c5,_0xd4d6('0x68')),'role':_0xd4d6('0x69')},'attributes':['id',_0xd4d6('0x37'),_0xd4d6('0x6a'),_0xd4d6('0x6b'),_0xd4d6('0x6c')]});}})['then'](function(_0x358e94){if(_0x358e94){return{'count':_0x358e94[_0xd4d6('0x6d')],'rows':_[_0xd4d6('0x3a')](_0x358e94[_0xd4d6('0x4d')],function(_0x5a6c02){return{'membername':_0x5a6c02['name'],'UserId':_0x5a6c02['id'],'queue_name':_0x29e35['name'],'ChatQueueId':_0x29e35['id'],'interface':util[_0xd4d6('0x6e')](_0xd4d6('0x6f'),'SIP',_0x5a6c02['name']),'penalty':0x0,'paused':_0x5a6c02['chatPause'],'createdAt':_0x5a6c02[_0xd4d6('0x6c')],'updatedAt':_0x5a6c02[_0xd4d6('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd4d6('0x1f')](respondWithFilteredResult(_0x1abba3,_0x52400a))['catch'](handleError(_0x1abba3,null));};exports['getTeams']=function(_0x17c1a9,_0x1fed99,_0x4ddc98){var _0x10866b={};var _0x3824d4={};var _0x4563fe;var _0xbe8ed0;return db[_0xd4d6('0x3b')]['findOne']({'where':{'id':_0x17c1a9[_0xd4d6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1fed99,null))[_0xd4d6('0x1f')](function(_0x52660c){if(_0x52660c){_0x4563fe=_0x52660c;_0x3824d4[_0xd4d6('0x3f')]=_[_0xd4d6('0x50')](db[_0xd4d6('0x70')][_0xd4d6('0x3c')]);_0x3824d4[_0xd4d6('0x40')]=_[_0xd4d6('0x50')](_0x17c1a9['query']);_0x3824d4[_0xd4d6('0x41')]=_[_0xd4d6('0x42')](_0x3824d4[_0xd4d6('0x3f')],_0x3824d4['query']);_0x10866b[_0xd4d6('0x43')]=_[_0xd4d6('0x42')](_0x3824d4[_0xd4d6('0x3f')],qs[_0xd4d6('0x44')](_0x17c1a9[_0xd4d6('0x40')][_0xd4d6('0x44')]));_0x10866b[_0xd4d6('0x43')]=_0x10866b['attributes']['length']?_0x10866b['attributes']:_0x3824d4[_0xd4d6('0x3f')];_0x10866b[_0xd4d6('0x62')]=qs[_0xd4d6('0x47')](_0x17c1a9['query'][_0xd4d6('0x47')]);_0x10866b['where']=qs[_0xd4d6('0x41')](_['pick'](_0x17c1a9[_0xd4d6('0x40')],_0x3824d4['filters']));if(_0x17c1a9[_0xd4d6('0x40')][_0xd4d6('0x64')]){_0x10866b[_0xd4d6('0x48')]=_[_0xd4d6('0x49')](_0x10866b[_0xd4d6('0x48')],{'$or':_['map'](_0x10866b[_0xd4d6('0x43')],function(_0x15a071){var _0x240663={};_0x240663[_0x15a071]={'$like':'%'+_0x17c1a9['query']['filter']+'%'};return _0x240663;})});}_0x10866b=_[_0xd4d6('0x49')]({},_0x10866b,_0x17c1a9[_0xd4d6('0x53')]);return _0x4563fe['getTeams'](_0x10866b);}})[_0xd4d6('0x1f')](function(_0x1aac39){if(_0x1aac39){_0xbe8ed0=_0x1aac39['length'];if(!_0x17c1a9['query'][_0xd4d6('0x45')](_0xd4d6('0x46'))){_0x10866b[_0xd4d6('0x2d')]=qs[_0xd4d6('0x2d')](_0x17c1a9[_0xd4d6('0x40')][_0xd4d6('0x2d')]);_0x10866b[_0xd4d6('0x2c')]=qs['offset'](_0x17c1a9[_0xd4d6('0x40')][_0xd4d6('0x2c')]);}return _0x4563fe[_0xd4d6('0x71')](_0x10866b);}})[_0xd4d6('0x1f')](function(_0x57925b){if(_0x57925b){return _0x57925b?{'count':_0xbe8ed0,'rows':_0x57925b}:null;}})['then'](respondWithResult(_0x1fed99,null))['catch'](handleError(_0x1fed99,null));};exports['addTeams']=function(_0x83e432,_0x2b4276,_0x291277){var _0x5ad133=_0x83e432[_0xd4d6('0x5e')]['ids'];return db[_0xd4d6('0x70')][_0xd4d6('0x4c')]({'where':{'id':_0x5ad133},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd4d6('0x72'),'attributes':['id',_0xd4d6('0x37'),_0xd4d6('0x73'),_0xd4d6('0x74'),_0xd4d6('0x75')],'raw':!![]}]})[_0xd4d6('0x1f')](function(_0x9fd559){if(_0x9fd559){var _0xbdc4cb=_[_0xd4d6('0x76')](_0x9fd559,function(_0x546f80){var _0x2c7723=_0x546f80[_0xd4d6('0x34')]({'plain':!![]});return _0x2c7723[_0xd4d6('0x72')];});return db[_0xd4d6('0x3b')][_0xd4d6('0x54')]({'where':{'id':_0x83e432['params']['id']}})[_0xd4d6('0x1f')](function(_0xfdbd2d){return db[_0xd4d6('0x77')]['transaction'](function(_0x58c4e0){return _0xfdbd2d[_0xd4d6('0x78')](_0x5ad133,{'transaction':_0x58c4e0})['then'](function(){return BPromise['each'](_0xbdc4cb,function(_0x215d3b){return db[_0xd4d6('0x65')][_0xd4d6('0x79')]({'where':{'UserId':_0x215d3b['id'],'ChatQueueId':_0x83e432[_0xd4d6('0x4f')]['id']},'transaction':_0x58c4e0});});})[_0xd4d6('0x1f')](function(){_0xbdc4cb[_0xd4d6('0x7a')](function(_0x5d4d38){socket[_0xd4d6('0x7b')](_0xd4d6('0x7c'),{'UserId':_0x5d4d38['id'],'ChatQueueId':_0xfdbd2d['id']});});});});});}})[_0xd4d6('0x1f')](respondWithStatusCode(_0x2b4276,null))[_0xd4d6('0x55')](handleError(_0x2b4276,null));};exports['removeTeams']=function(_0x5e730a,_0x40d5b1,_0x3e4ae5){return db['Team']['findAll']({'where':{'id':_0x5e730a[_0xd4d6('0x40')][_0xd4d6('0x7d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd4d6('0x72'),'attributes':['id'],'raw':!![]}]})[_0xd4d6('0x1f')](handleEntityNotFound(_0x40d5b1,null))[_0xd4d6('0x1f')](function(_0x371749){var _0x55b4a5=_[_0xd4d6('0x3a')](_0x371749,'id');var _0x55cb46=[];var _0x84f400=[];var _0x2359bb=squel['select']();_0x2359bb[_0xd4d6('0x7e')](_0xd4d6('0x7f'))[_0xd4d6('0x80')](_0xd4d6('0x81'),'tq')[_0xd4d6('0x82')](_0xd4d6('0x83'),'ut',_0xd4d6('0x84'))[_0xd4d6('0x48')](_0xd4d6('0x85'),_0x5e730a[_0xd4d6('0x4f')]['id']);for(var _0x306391=0x0;_0x306391<_0x371749[_0xd4d6('0x51')];_0x306391+=0x1){let _0x120aa4=_0x371749[_0x306391];for(var _0x4940d3=0x0;_0x4940d3<_0x120aa4[_0xd4d6('0x72')][_0xd4d6('0x51')];_0x4940d3+=0x1){let _0x4305f4=_0x120aa4[_0xd4d6('0x72')][_0x4940d3];var _0x2d44f8=_0x2359bb[_0xd4d6('0x86')]();_0x2d44f8['where'](_0xd4d6('0x87'),_0x4305f4['id']);_0x84f400['push'](db[_0xd4d6('0x77')][_0xd4d6('0x40')](_0x2d44f8[_0xd4d6('0x88')](),{'type':db[_0xd4d6('0x77')][_0xd4d6('0x89')][_0xd4d6('0x8a')]})[_0xd4d6('0x1f')](function(_0x47885e){if(_0x47885e[_0xd4d6('0x51')]===0x1){return _0x4305f4['id'];}else{var _0x40387d=_[_0xd4d6('0x8b')](_[_0xd4d6('0x3a')](_0x47885e,_0xd4d6('0x8c')),function(_0x18e4b9){return _[_0xd4d6('0x8d')](_0x55b4a5,_0x18e4b9);});if(_0x40387d){return _0x4305f4['id'];}}}));}}return BPromise['all'](_0x84f400)['then'](function(_0x530e17){_0x55cb46=_(_0x55cb46)[_0xd4d6('0x8e')](_0x530e17)[_0xd4d6('0x8f')]()['value']();return db[_0xd4d6('0x3b')][_0xd4d6('0x54')]({'where':{'id':_0x5e730a[_0xd4d6('0x4f')]['id']}})[_0xd4d6('0x1f')](function(_0x294600){return db[_0xd4d6('0x77')][_0xd4d6('0x90')](function(_0x3ad046){return _0x294600[_0xd4d6('0x91')](_0x5e730a[_0xd4d6('0x40')][_0xd4d6('0x7d')],{'transaction':_0x3ad046})['then'](function(){if(!_['isEmpty'](_0x55cb46)){return _0x294600[_0xd4d6('0x92')](_0x55cb46,{'transaction':_0x3ad046});}})[_0xd4d6('0x1f')](function(){_0x55cb46[_0xd4d6('0x7a')](function(_0x252afd){socket['emit'](_0xd4d6('0x93'),{'UserId':_0x252afd,'ChatQueueId':_0x294600['id']});});});});});});})[_0xd4d6('0x1f')](respondWithStatusCode(_0x40d5b1,null))[_0xd4d6('0x55')](handleError(_0x40d5b1,null));};exports['addAgents']=function(_0x570367,_0x3e35d6,_0xa410d8){return db[_0xd4d6('0x3b')][_0xd4d6('0x54')]({'where':{'id':_0x570367['params']['id']}})[_0xd4d6('0x1f')](handleEntityNotFound(_0x3e35d6,null))[_0xd4d6('0x1f')](function(_0x4c214f){if(_0x4c214f){return _0x4c214f['addAgents'](_0x570367[_0xd4d6('0x5e')][_0xd4d6('0x7d')],_[_0xd4d6('0x94')](_0x570367[_0xd4d6('0x5e')],[_0xd4d6('0x7d'),'id'])||{})['spread'](function(_0x129a31){for(var _0x62fd72=0x0;_0x62fd72<_0x570367[_0xd4d6('0x5e')][_0xd4d6('0x7d')][_0xd4d6('0x51')];_0x62fd72+=0x1){socket['emit'](_0xd4d6('0x7c'),{'UserId':_0x570367['body']['ids'][_0x62fd72],'ChatQueueId':_0x570367['params']['id']});}return _0x129a31;});}})[_0xd4d6('0x1f')](respondWithResult(_0x3e35d6,null))[_0xd4d6('0x55')](handleError(_0x3e35d6,null));};exports[_0xd4d6('0x92')]=function(_0x578023,_0x22bc1e,_0x316024){return db[_0xd4d6('0x3b')][_0xd4d6('0x54')]({'where':{'id':_0x578023[_0xd4d6('0x4f')]['id']}})[_0xd4d6('0x1f')](handleEntityNotFound(_0x22bc1e,null))[_0xd4d6('0x1f')](function(_0x267a5b){if(_0x267a5b){return _0x267a5b[_0xd4d6('0x92')](_0x578023[_0xd4d6('0x40')][_0xd4d6('0x7d')])[_0xd4d6('0x1f')](function(){if(_['isArray'](_0x578023[_0xd4d6('0x40')]['ids'])){for(var _0x1ec2c5=0x0;_0x1ec2c5<_0x578023['query'][_0xd4d6('0x7d')][_0xd4d6('0x51')];_0x1ec2c5+=0x1){socket[_0xd4d6('0x7b')](_0xd4d6('0x93'),{'UserId':Number(_0x578023['query'][_0xd4d6('0x7d')][_0x1ec2c5]),'ChatQueueId':Number(_0x578023['params']['id'])});}}else{socket[_0xd4d6('0x7b')](_0xd4d6('0x93'),{'UserId':Number(_0x578023[_0xd4d6('0x40')][_0xd4d6('0x7d')]),'ChatQueueId':Number(_0x578023[_0xd4d6('0x4f')]['id'])});}});}})[_0xd4d6('0x1f')](respondWithStatusCode(_0x22bc1e,null))[_0xd4d6('0x55')](handleError(_0x22bc1e,null));};exports[_0xd4d6('0x95')]=function(_0x5d3559,_0x2dec35,_0x10a872){var _0x1c3868={};var _0x48bfd2={};var _0xe6003f;var _0x2be228;return db[_0xd4d6('0x3b')][_0xd4d6('0x61')]({'where':{'id':_0x5d3559[_0xd4d6('0x4f')]['id']}})[_0xd4d6('0x1f')](handleEntityNotFound(_0x2dec35,null))[_0xd4d6('0x1f')](function(_0x50461c){if(_0x50461c){_0xe6003f=_0x50461c;_0x48bfd2['model']=_[_0xd4d6('0x50')](db[_0xd4d6('0x66')][_0xd4d6('0x3c')]);_0x48bfd2[_0xd4d6('0x40')]=_[_0xd4d6('0x50')](_0x5d3559[_0xd4d6('0x40')]);_0x48bfd2[_0xd4d6('0x41')]=_[_0xd4d6('0x42')](_0x48bfd2[_0xd4d6('0x3f')],_0x48bfd2[_0xd4d6('0x40')]);_0x1c3868[_0xd4d6('0x43')]=_[_0xd4d6('0x42')](_0x48bfd2[_0xd4d6('0x3f')],qs[_0xd4d6('0x44')](_0x5d3559['query'][_0xd4d6('0x44')]));_0x1c3868[_0xd4d6('0x43')]=_0x1c3868[_0xd4d6('0x43')][_0xd4d6('0x51')]?_0x1c3868[_0xd4d6('0x43')]:_0x48bfd2[_0xd4d6('0x3f')];_0x1c3868['order']=qs['sort'](_0x5d3559[_0xd4d6('0x40')][_0xd4d6('0x47')]);_0x1c3868[_0xd4d6('0x48')]=qs['filters'](_[_0xd4d6('0x63')](_0x5d3559['query'],_0x48bfd2['filters']));if(_0x5d3559[_0xd4d6('0x40')]['filter']){_0x1c3868['where']=_[_0xd4d6('0x49')](_0x1c3868[_0xd4d6('0x48')],{'$or':_[_0xd4d6('0x3a')](_0x1c3868[_0xd4d6('0x43')],function(_0x237f39){var _0x1b500e={};_0x1b500e[_0x237f39]={'$like':'%'+_0x5d3559['query'][_0xd4d6('0x64')]+'%'};return _0x1b500e;})});}_0x1c3868=_['merge']({},_0x1c3868,_0x5d3559[_0xd4d6('0x53')]);return _0xe6003f[_0xd4d6('0x95')](_0x1c3868);}})[_0xd4d6('0x1f')](function(_0xab6bdd){if(_0xab6bdd){_0x2be228=_0xab6bdd[_0xd4d6('0x51')];if(!_0x5d3559[_0xd4d6('0x40')][_0xd4d6('0x45')](_0xd4d6('0x46'))){_0x1c3868[_0xd4d6('0x2d')]=qs[_0xd4d6('0x2d')](_0x5d3559[_0xd4d6('0x40')][_0xd4d6('0x2d')]);_0x1c3868[_0xd4d6('0x2c')]=qs['offset'](_0x5d3559[_0xd4d6('0x40')][_0xd4d6('0x2c')]);}return _0xe6003f[_0xd4d6('0x95')](_0x1c3868);}})['then'](function(_0x44b2e3){if(_0x44b2e3){return _0x44b2e3?{'count':_0x2be228,'rows':_0x44b2e3}:null;}})[_0xd4d6('0x1f')](respondWithResult(_0x2dec35,null))[_0xd4d6('0x55')](handleError(_0x2dec35,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 2073229..1d1bfde 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 _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x36f91b,_0x1b5731){var _0x2ea9d7=function(_0x5e1538){while(--_0x5e1538){_0x36f91b['push'](_0x36f91b['shift']());}};_0x2ea9d7(++_0x1b5731);}(_0xb10b,0x12a));var _0xbb10=function(_0x315216,_0x15d0cc){_0x315216=_0x315216-0x0;var _0x4dfb84=_0xb10b[_0x315216];return _0x4dfb84;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x59a9d1,_0x286878){var _0x43f3c1=function(_0x4fa90b){while(--_0x4fa90b){_0x59a9d1['push'](_0x59a9d1['shift']());}};_0x43f3c1(++_0x286878);}(_0xb10b,0x12a));var _0xbb10=function(_0x13c5a9,_0x95fb6a){_0x13c5a9=_0x13c5a9-0x0;var _0x393ee6=_0xb10b[_0x13c5a9];return _0x393ee6;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 37dedf9..63882ff 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 _0xc88d=['request-promise','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x5555fd,_0x31b11c){var _0x174889=function(_0x1afb16){while(--_0x1afb16){_0x5555fd['push'](_0x5555fd['shift']());}};_0x174889(++_0x31b11c);}(_0xc88d,0xd3));var _0xdc88=function(_0x3c2f96,_0x13b4c3){_0x3c2f96=_0x3c2f96-0x0;var _0x61929f=_0xc88d[_0x3c2f96];return _0x61929f;};'use strict';var _=require(_0xdc88('0x0'));var util=require(_0xdc88('0x1'));var logger=require(_0xdc88('0x2'))(_0xdc88('0x3'));var moment=require(_0xdc88('0x4'));var BPromise=require('bluebird');var rp=require(_0xdc88('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdc88('0x6'));var attributes=require(_0xdc88('0x7'));module[_0xdc88('0x8')]=function(_0xa2dc30,_0x2e0133){return _0xa2dc30[_0xdc88('0x9')](_0xdc88('0xa'),attributes,{'tableName':_0xdc88('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc450=['../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x50fe14,_0x2da10d){var _0x376354=function(_0x444b72){while(--_0x444b72){_0x50fe14['push'](_0x50fe14['shift']());}};_0x376354(++_0x2da10d);}(_0xc450,0xad));var _0x0c45=function(_0x2f5b50,_0x3d9da5){_0x2f5b50=_0x2f5b50-0x0;var _0x277e17=_0xc450[_0x2f5b50];return _0x277e17;};'use strict';var _=require(_0x0c45('0x0'));var util=require(_0x0c45('0x1'));var logger=require(_0x0c45('0x2'))(_0x0c45('0x3'));var moment=require('moment');var BPromise=require(_0x0c45('0x4'));var rp=require(_0x0c45('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c45('0x6'));var config=require(_0x0c45('0x7'));var attributes=require(_0x0c45('0x8'));module[_0x0c45('0x9')]=function(_0x5ed867,_0x506c8b){return _0x5ed867['define'](_0x0c45('0xa'),attributes,{'tableName':_0x0c45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 670b3ff..2c95ef4 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 _0x8185=['register','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','map','model','ShowChatQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x44c5a6,_0x56967e){var _0x209b67=function(_0x579797){while(--_0x579797){_0x44c5a6['push'](_0x44c5a6['shift']());}};_0x209b67(++_0x56967e);}(_0x8185,0xb8));var _0x5818=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8185[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x5818('0x0'));var util=require(_0x5818('0x1'));var moment=require(_0x5818('0x2'));var BPromise=require('bluebird');var rs=require(_0x5818('0x3'));var fs=require('fs');var Redis=require(_0x5818('0x4'));var db=require(_0x5818('0x5'))['db'];var utils=require(_0x5818('0x6'));var logger=require(_0x5818('0x7'))('rpc');var config=require(_0x5818('0x8'));var jayson=require(_0x5818('0x9'));var client=jayson[_0x5818('0xa')][_0x5818('0xb')]({'port':0x232a});config[_0x5818('0xc')]=_[_0x5818('0xd')](config[_0x5818('0xc')],{'host':_0x5818('0xe'),'port':0x18eb});var socket=require(_0x5818('0xf'))(new Redis(config[_0x5818('0xc')]));require('./chatQueue.socket')[_0x5818('0x10')](socket);function respondWithRpcPromise(_0x1196f7,_0x5ec895,_0x3f18d7){return new BPromise(function(_0x1154bc,_0x54f7f2){return client['request'](_0x1196f7,_0x3f18d7)[_0x5818('0x11')](function(_0x21df2b){logger['info'](_0x5818('0x12'),_0x5ec895,_0x5818('0x13'));logger[_0x5818('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x5ec895,_0x5818('0x13'),JSON[_0x5818('0x15')](_0x21df2b));if(_0x21df2b[_0x5818('0x16')]){if(_0x21df2b[_0x5818('0x16')][_0x5818('0x17')]===0x1f4){logger['error'](_0x5818('0x12'),_0x5ec895,_0x21df2b[_0x5818('0x16')][_0x5818('0x18')]);return _0x54f7f2(_0x21df2b[_0x5818('0x16')][_0x5818('0x18')]);}logger[_0x5818('0x16')](_0x5818('0x12'),_0x5ec895,_0x21df2b['error'][_0x5818('0x18')]);return _0x1154bc(_0x21df2b['error']['message']);}else{logger[_0x5818('0x19')]('ChatQueue,\x20%s,\x20%s',_0x5ec895,_0x5818('0x13'));_0x1154bc(_0x21df2b[_0x5818('0x1a')][_0x5818('0x18')]);}})[_0x5818('0x1b')](function(_0x4501dc){logger['error'](_0x5818('0x12'),_0x5ec895,_0x4501dc);_0x54f7f2(_0x4501dc);});});}exports[_0x5818('0x1c')]=function(_0x3e49ba){var _0x1d7873=this;return new Promise(function(_0xae2494,_0x381da6){return db[_0x5818('0x1d')][_0x5818('0x1e')]({'raw':_0x3e49ba[_0x5818('0x1f')]?_0x3e49ba[_0x5818('0x1f')][_0x5818('0x20')]===undefined?!![]:![]:!![],'where':_0x3e49ba[_0x5818('0x1f')]?_0x3e49ba['options'][_0x5818('0x21')]||null:null,'attributes':_0x3e49ba['options']?_0x3e49ba[_0x5818('0x1f')][_0x5818('0x22')]||null:null,'limit':_0x3e49ba[_0x5818('0x1f')]?_0x3e49ba[_0x5818('0x1f')]['limit']||null:null,'include':_0x3e49ba[_0x5818('0x1f')]?_0x3e49ba['options'][_0x5818('0x23')]?_[_0x5818('0x24')](_0x3e49ba[_0x5818('0x1f')][_0x5818('0x23')],function(_0x350fdf){return{'model':db[_0x350fdf['model']],'as':_0x350fdf['as'],'attributes':_0x350fdf[_0x5818('0x22')],'include':_0x350fdf[_0x5818('0x23')]?_[_0x5818('0x24')](_0x350fdf[_0x5818('0x23')],function(_0x504efd){return{'model':db[_0x504efd[_0x5818('0x25')]],'as':_0x504efd['as'],'attributes':_0x504efd[_0x5818('0x22')],'include':_0x504efd['include']?_[_0x5818('0x24')](_0x504efd[_0x5818('0x23')],function(_0x5e3a6f){return{'model':db[_0x5e3a6f['model']],'as':_0x5e3a6f['as'],'attributes':_0x5e3a6f[_0x5818('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5818('0x11')](function(_0x2ae9b7){logger['info'](_0x5818('0x1c'),_0x3e49ba);logger[_0x5818('0x14')]('GetChatQueue',_0x3e49ba,JSON[_0x5818('0x15')](_0x2ae9b7));_0xae2494(_0x2ae9b7);})['catch'](function(_0x2c110f){logger['error']('GetChatQueue',_0x2c110f['message'],_0x3e49ba);_0x381da6(_0x1d7873[_0x5818('0x16')](0x1f4,_0x2c110f[_0x5818('0x18')]));});});};exports[_0x5818('0x26')]=function(_0xf639fb){var _0x44c2ad=this;return new Promise(function(_0x28df75,_0x303901){return db[_0x5818('0x1d')][_0x5818('0x27')]({'raw':_0xf639fb[_0x5818('0x1f')]?_0xf639fb['options'][_0x5818('0x20')]===undefined?!![]:![]:!![],'where':_0xf639fb[_0x5818('0x1f')]?_0xf639fb[_0x5818('0x1f')][_0x5818('0x21')]||null:null,'attributes':_0xf639fb['options']?_0xf639fb['options']['attributes']||null:null,'include':_0xf639fb[_0x5818('0x1f')]?_0xf639fb[_0x5818('0x1f')]['include']?_[_0x5818('0x24')](_0xf639fb[_0x5818('0x1f')][_0x5818('0x23')],function(_0x5a8df1){return{'model':db[_0x5a8df1['model']],'as':_0x5a8df1['as'],'attributes':_0x5a8df1[_0x5818('0x22')],'include':_0x5a8df1[_0x5818('0x23')]?_[_0x5818('0x24')](_0x5a8df1['include'],function(_0x305987){return{'model':db[_0x305987[_0x5818('0x25')]],'as':_0x305987['as'],'attributes':_0x305987[_0x5818('0x22')],'include':_0x305987['include']?_[_0x5818('0x24')](_0x305987['include'],function(_0x3d54a0){return{'model':db[_0x3d54a0[_0x5818('0x25')]],'as':_0x3d54a0['as'],'attributes':_0x3d54a0[_0x5818('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ef890){logger[_0x5818('0x19')](_0x5818('0x26'),_0xf639fb);logger[_0x5818('0x14')](_0x5818('0x26'),_0xf639fb,JSON[_0x5818('0x15')](_0x1ef890));_0x28df75(_0x1ef890);})[_0x5818('0x1b')](function(_0xade866){logger['error'](_0x5818('0x26'),_0xade866[_0x5818('0x18')],_0xf639fb);_0x303901(_0x44c2ad[_0x5818('0x16')](0x1f4,_0xade866[_0x5818('0x18')]));});});}; \ No newline at end of file +var _0x980c=['options','raw','where','limit','include','model','attributes','map','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue'];(function(_0x16cfa0,_0x5b4da6){var _0x243bca=function(_0xa27c1f){while(--_0xa27c1f){_0x16cfa0['push'](_0x16cfa0['shift']());}};_0x243bca(++_0x5b4da6);}(_0x980c,0x100));var _0xc980=function(_0x3e5d67,_0x5137fd){_0x3e5d67=_0x3e5d67-0x0;var _0x45745f=_0x980c[_0x3e5d67];return _0x45745f;};'use strict';var _=require(_0xc980('0x0'));var util=require(_0xc980('0x1'));var moment=require(_0xc980('0x2'));var BPromise=require(_0xc980('0x3'));var rs=require(_0xc980('0x4'));var fs=require('fs');var Redis=require(_0xc980('0x5'));var db=require(_0xc980('0x6'))['db'];var utils=require(_0xc980('0x7'));var logger=require(_0xc980('0x8'))(_0xc980('0x9'));var config=require(_0xc980('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc980('0xb')][_0xc980('0xc')]({'port':0x232a});config[_0xc980('0xd')]=_[_0xc980('0xe')](config[_0xc980('0xd')],{'host':_0xc980('0xf'),'port':0x18eb});var socket=require(_0xc980('0x10'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x7c55a2,_0x49b5fb,_0x121671){return new BPromise(function(_0x199251,_0x1099ef){return client['request'](_0x7c55a2,_0x121671)[_0xc980('0x11')](function(_0x1b14ee){logger[_0xc980('0x12')]('ChatQueue,\x20%s,\x20%s',_0x49b5fb,_0xc980('0x13'));logger[_0xc980('0x14')](_0xc980('0x15'),_0x49b5fb,_0xc980('0x13'),JSON[_0xc980('0x16')](_0x1b14ee));if(_0x1b14ee[_0xc980('0x17')]){if(_0x1b14ee[_0xc980('0x17')][_0xc980('0x18')]===0x1f4){logger[_0xc980('0x17')](_0xc980('0x19'),_0x49b5fb,_0x1b14ee[_0xc980('0x17')][_0xc980('0x1a')]);return _0x1099ef(_0x1b14ee[_0xc980('0x17')]['message']);}logger['error'](_0xc980('0x19'),_0x49b5fb,_0x1b14ee['error']['message']);return _0x199251(_0x1b14ee[_0xc980('0x17')][_0xc980('0x1a')]);}else{logger[_0xc980('0x12')](_0xc980('0x19'),_0x49b5fb,_0xc980('0x13'));_0x199251(_0x1b14ee[_0xc980('0x1b')]['message']);}})[_0xc980('0x1c')](function(_0x4342e3){logger[_0xc980('0x17')]('ChatQueue,\x20%s,\x20%s',_0x49b5fb,_0x4342e3);_0x1099ef(_0x4342e3);});});}exports[_0xc980('0x1d')]=function(_0x365050){var _0x28eb61=this;return new Promise(function(_0x1b26a1,_0x3249db){return db[_0xc980('0x1e')]['findAll']({'raw':_0x365050[_0xc980('0x1f')]?_0x365050[_0xc980('0x1f')][_0xc980('0x20')]===undefined?!![]:![]:!![],'where':_0x365050[_0xc980('0x1f')]?_0x365050[_0xc980('0x1f')][_0xc980('0x21')]||null:null,'attributes':_0x365050[_0xc980('0x1f')]?_0x365050['options']['attributes']||null:null,'limit':_0x365050[_0xc980('0x1f')]?_0x365050[_0xc980('0x1f')][_0xc980('0x22')]||null:null,'include':_0x365050[_0xc980('0x1f')]?_0x365050[_0xc980('0x1f')][_0xc980('0x23')]?_['map'](_0x365050[_0xc980('0x1f')][_0xc980('0x23')],function(_0x8fcc7e){return{'model':db[_0x8fcc7e[_0xc980('0x24')]],'as':_0x8fcc7e['as'],'attributes':_0x8fcc7e[_0xc980('0x25')],'include':_0x8fcc7e[_0xc980('0x23')]?_[_0xc980('0x26')](_0x8fcc7e[_0xc980('0x23')],function(_0x141129){return{'model':db[_0x141129[_0xc980('0x24')]],'as':_0x141129['as'],'attributes':_0x141129[_0xc980('0x25')],'include':_0x141129[_0xc980('0x23')]?_[_0xc980('0x26')](_0x141129['include'],function(_0x4e08f2){return{'model':db[_0x4e08f2[_0xc980('0x24')]],'as':_0x4e08f2['as'],'attributes':_0x4e08f2[_0xc980('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ee9fa){logger['info'](_0xc980('0x1d'),_0x365050);logger[_0xc980('0x14')]('GetChatQueue',_0x365050,JSON[_0xc980('0x16')](_0x4ee9fa));_0x1b26a1(_0x4ee9fa);})['catch'](function(_0x24a485){logger['error'](_0xc980('0x1d'),_0x24a485[_0xc980('0x1a')],_0x365050);_0x3249db(_0x28eb61[_0xc980('0x17')](0x1f4,_0x24a485[_0xc980('0x1a')]));});});};exports[_0xc980('0x27')]=function(_0x1a9d5e){var _0x547ad6=this;return new Promise(function(_0x59b1c0,_0x28983f){return db[_0xc980('0x1e')][_0xc980('0x28')]({'raw':_0x1a9d5e[_0xc980('0x1f')]?_0x1a9d5e[_0xc980('0x1f')][_0xc980('0x20')]===undefined?!![]:![]:!![],'where':_0x1a9d5e[_0xc980('0x1f')]?_0x1a9d5e[_0xc980('0x1f')]['where']||null:null,'attributes':_0x1a9d5e[_0xc980('0x1f')]?_0x1a9d5e['options']['attributes']||null:null,'include':_0x1a9d5e[_0xc980('0x1f')]?_0x1a9d5e[_0xc980('0x1f')][_0xc980('0x23')]?_[_0xc980('0x26')](_0x1a9d5e[_0xc980('0x1f')][_0xc980('0x23')],function(_0x4a4d80){return{'model':db[_0x4a4d80[_0xc980('0x24')]],'as':_0x4a4d80['as'],'attributes':_0x4a4d80['attributes'],'include':_0x4a4d80[_0xc980('0x23')]?_[_0xc980('0x26')](_0x4a4d80[_0xc980('0x23')],function(_0x420faf){return{'model':db[_0x420faf['model']],'as':_0x420faf['as'],'attributes':_0x420faf[_0xc980('0x25')],'include':_0x420faf[_0xc980('0x23')]?_[_0xc980('0x26')](_0x420faf[_0xc980('0x23')],function(_0x1c94d6){return{'model':db[_0x1c94d6[_0xc980('0x24')]],'as':_0x1c94d6['as'],'attributes':_0x1c94d6[_0xc980('0x25')]};}):[]};}):[]};}):[]:[]})[_0xc980('0x11')](function(_0x14ac42){logger[_0xc980('0x12')](_0xc980('0x27'),_0x1a9d5e);logger[_0xc980('0x14')]('ShowChatQueue',_0x1a9d5e,JSON['stringify'](_0x14ac42));_0x59b1c0(_0x14ac42);})['catch'](function(_0x4b7dd8){logger[_0xc980('0x17')](_0xc980('0x27'),_0x4b7dd8[_0xc980('0x1a')],_0x1a9d5e);_0x28983f(_0x547ad6[_0xc980('0x17')](0x1f4,_0x4b7dd8['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 3b39c6b..ae6f678 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 _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x3b0cb8,_0x2016df){var _0x66d77c=function(_0xd04f0e){while(--_0xd04f0e){_0x3b0cb8['push'](_0x3b0cb8['shift']());}};_0x66d77c(++_0x2016df);}(_0x0b0e,0x187));var _0xe0b0=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x0b0e[_0x20589d];return _0x422de9;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x379444,_0x270dd4){var _0x2c798a=function(_0x363860){while(--_0x363860){_0x379444['push'](_0x379444['shift']());}};_0x2c798a(++_0x270dd4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x19409d,_0xf48905){_0x19409d=_0x19409d-0x0;var _0x5de146=_0x0b0e[_0x19409d];return _0x5de146;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index bf4d81e..e895178 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 _0xb488=['/:id','update','destroy','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','isAuthenticated','index','describe','get','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb488,0x11d));var _0x8b48=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb488[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x8b48('0x0'));var util=require(_0x8b48('0x1'));var path=require(_0x8b48('0x2'));var timeout=require(_0x8b48('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x8b48('0x4'));var interaction=require(_0x8b48('0x5'));var config=require(_0x8b48('0x6'));var controller=require(_0x8b48('0x7'));router['get']('/',auth[_0x8b48('0x8')](),controller[_0x8b48('0x9')]);router['get']('/describe',auth[_0x8b48('0x8')](),controller[_0x8b48('0xa')]);router[_0x8b48('0xb')]('/:id',auth[_0x8b48('0x8')](),controller[_0x8b48('0xc')]);router[_0x8b48('0xb')](_0x8b48('0xd'),auth[_0x8b48('0x8')](),controller[_0x8b48('0xe')]);router[_0x8b48('0xb')](_0x8b48('0xf'),auth[_0x8b48('0x8')](),controller[_0x8b48('0x10')]);router['get'](_0x8b48('0x11'),auth[_0x8b48('0x8')](),controller['getAgents']);router[_0x8b48('0x12')]('/',auth[_0x8b48('0x8')](),controller[_0x8b48('0x13')]);router[_0x8b48('0x12')](_0x8b48('0xf'),auth[_0x8b48('0x8')](),controller[_0x8b48('0x14')]);router['post']('/:id/users',auth[_0x8b48('0x8')](),controller[_0x8b48('0x15')]);router[_0x8b48('0x16')](_0x8b48('0x17'),auth[_0x8b48('0x8')](),controller[_0x8b48('0x18')]);router['delete'](_0x8b48('0x17'),auth['isAuthenticated'](),controller[_0x8b48('0x19')]);router[_0x8b48('0x1a')]('/:id/teams',auth[_0x8b48('0x8')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x8b48('0x8')](),controller['removeAgents']);module[_0x8b48('0x1b')]=router; \ No newline at end of file +var _0xc601=['/describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','isAuthenticated','index','get'];(function(_0x19a786,_0x115872){var _0x1682cb=function(_0x4936b1){while(--_0x4936b1){_0x19a786['push'](_0x19a786['shift']());}};_0x1682cb(++_0x115872);}(_0xc601,0x18a));var _0x1c60=function(_0xe083fa,_0x565537){_0xe083fa=_0xe083fa-0x0;var _0x3202d4=_0xc601[_0xe083fa];return _0x3202d4;};'use strict';var multer=require('multer');var util=require(_0x1c60('0x0'));var path=require(_0x1c60('0x1'));var timeout=require(_0x1c60('0x2'));var express=require('express');var router=express[_0x1c60('0x3')]();var auth=require(_0x1c60('0x4'));var interaction=require(_0x1c60('0x5'));var config=require(_0x1c60('0x6'));var controller=require(_0x1c60('0x7'));router['get']('/',auth[_0x1c60('0x8')](),controller[_0x1c60('0x9')]);router[_0x1c60('0xa')](_0x1c60('0xb'),auth[_0x1c60('0x8')](),controller['describe']);router[_0x1c60('0xa')](_0x1c60('0xc'),auth[_0x1c60('0x8')](),controller['show']);router[_0x1c60('0xa')]('/:id/members',auth[_0x1c60('0x8')](),controller[_0x1c60('0xd')]);router['get'](_0x1c60('0xe'),auth['isAuthenticated'](),controller[_0x1c60('0xf')]);router[_0x1c60('0xa')](_0x1c60('0x10'),auth[_0x1c60('0x8')](),controller['getAgents']);router[_0x1c60('0x11')]('/',auth['isAuthenticated'](),controller[_0x1c60('0x12')]);router['post'](_0x1c60('0xe'),auth['isAuthenticated'](),controller[_0x1c60('0x13')]);router[_0x1c60('0x11')](_0x1c60('0x10'),auth[_0x1c60('0x8')](),controller['addAgents']);router[_0x1c60('0x14')](_0x1c60('0xc'),auth['isAuthenticated'](),controller[_0x1c60('0x15')]);router[_0x1c60('0x16')]('/:id',auth[_0x1c60('0x8')](),controller[_0x1c60('0x17')]);router[_0x1c60('0x16')](_0x1c60('0xe'),auth[_0x1c60('0x8')](),controller[_0x1c60('0x18')]);router['delete'](_0x1c60('0x10'),auth[_0x1c60('0x8')](),controller[_0x1c60('0x19')]);module[_0x1c60('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 43fcab4..f641b67 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 _0x9de9=['STRING','DATE','moment','sequelize'];(function(_0x1e6aa5,_0x2723bb){var _0x4ed7c7=function(_0x1ed544){while(--_0x1ed544){_0x1e6aa5['push'](_0x1e6aa5['shift']());}};_0x4ed7c7(++_0x2723bb);}(_0x9de9,0x13e));var _0x99de=function(_0x540f05,_0x26ee7b){_0x540f05=_0x540f05-0x0;var _0x21f2d4=_0x9de9[_0x540f05];return _0x21f2d4;};'use strict';var moment=require(_0x99de('0x0'));var Sequelize=require(_0x99de('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x99de('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x99de('0x2')]},'joinAt':{'type':Sequelize[_0x99de('0x3')]},'leaveAt':{'type':Sequelize[_0x99de('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x99de('0x3')]},'reason':{'type':Sequelize[_0x99de('0x2')]}}; \ No newline at end of file +var _0x50f1=['DATE','moment','sequelize','STRING'];(function(_0x961e72,_0x523b5e){var _0x4992b2=function(_0x31cca4){while(--_0x31cca4){_0x961e72['push'](_0x961e72['shift']());}};_0x4992b2(++_0x523b5e);}(_0x50f1,0x1d1));var _0x150f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x50f1[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x150f('0x0'));var Sequelize=require(_0x150f('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x150f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x150f('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x150f('0x3')]},'acceptAt':{'type':Sequelize[_0x150f('0x3')]},'exitAt':{'type':Sequelize[_0x150f('0x3')]},'reason':{'type':Sequelize[_0x150f('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 3348126..d2208f7 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 _0xcfe9=['keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','create','body','describe','html-pdf','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','key','model','query'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xcfe9,0x99));var _0x9cfe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcfe9[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x9cfe('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9cfe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9cfe('0x2'));var moment=require('moment');var BPromise=require(_0x9cfe('0x3'));var Mustache=require(_0x9cfe('0x4'));var util=require(_0x9cfe('0x5'));var path=require(_0x9cfe('0x6'));var sox=require(_0x9cfe('0x7'));var csv=require(_0x9cfe('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9cfe('0x9'));var squel=require(_0x9cfe('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9cfe('0x8'));var querystring=require('querystring');var Papa=require(_0x9cfe('0xb'));var Redis=require('ioredis');var authService=require(_0x9cfe('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cfe('0xd'));var logger=require(_0x9cfe('0xe'))(_0x9cfe('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9cfe('0x10'))['db'];function respondWithStatusCode(_0x41f34c,_0x1024e4){_0x1024e4=_0x1024e4||0xcc;return function(_0x26aa88){if(_0x26aa88){return _0x41f34c[_0x9cfe('0x11')](_0x1024e4);}return _0x41f34c['status'](_0x1024e4)['end']();};}function respondWithResult(_0x48ee4c,_0x117d0c){_0x117d0c=_0x117d0c||0xc8;return function(_0x89ed22){if(_0x89ed22){return _0x48ee4c[_0x9cfe('0x12')](_0x117d0c)[_0x9cfe('0x13')](_0x89ed22);}};}function respondWithFilteredResult(_0xccc8fa,_0x2479ea){return function(_0x1b05dc){if(_0x1b05dc){var _0x5aff85=_0x1b05dc[_0x9cfe('0x14')],_0x1e39b9=_0x2479ea[_0x9cfe('0x15')],_0x480023=_0x2479ea['offset']+_0x2479ea[_0x9cfe('0x16')],_0x5f38e4;if(_0x480023>=_0x5aff85){_0x480023=_0x5aff85;_0x5f38e4=0xc8;}else{_0x5f38e4=0xce;}_0xccc8fa['status'](_0x5f38e4);return _0xccc8fa['set']('Content-Range',_0x1e39b9+'-'+_0x480023+'/'+_0x5aff85)[_0x9cfe('0x13')](_0x1b05dc);}return null;};}function patchUpdates(_0x230696){return function(_0x5bf674){try{jsonpatch[_0x9cfe('0x17')](_0x5bf674,_0x230696,!![]);}catch(_0x22d176){return BPromise[_0x9cfe('0x18')](_0x22d176);}return _0x5bf674['save']();};}function saveUpdates(_0x21d7c4,_0x5a9dc5){return function(_0x502cfa){if(_0x502cfa){return _0x502cfa[_0x9cfe('0x19')](_0x21d7c4)[_0x9cfe('0x1a')](function(_0x9b9abf){return _0x9b9abf;});}return null;};}function removeEntity(_0x363cb8,_0x584afc){return function(_0xdec8ed){if(_0xdec8ed){return _0xdec8ed[_0x9cfe('0x1b')]()[_0x9cfe('0x1a')](function(){_0x363cb8[_0x9cfe('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36eb18,_0x120404){return function(_0x389c71){if(!_0x389c71){_0x36eb18[_0x9cfe('0x11')](0x194);}return _0x389c71;};}function handleError(_0x58f488,_0x203db9){_0x203db9=_0x203db9||0x1f4;return function(_0x54815a){logger[_0x9cfe('0x1c')](_0x54815a[_0x9cfe('0x1d')]);if(_0x54815a['name']){delete _0x54815a[_0x9cfe('0x1e')];}_0x58f488[_0x9cfe('0x12')](_0x203db9)[_0x9cfe('0x1f')](_0x54815a);};}exports[_0x9cfe('0x20')]=function(_0x249026,_0x5e3f5a){var _0x1e2ac1={},_0x4811e6={},_0x3aa431={'count':0x0,'rows':[]};var _0x43360c=_[_0x9cfe('0x21')](db[_0x9cfe('0x22')][_0x9cfe('0x23')],function(_0x43ecac){return{'name':_0x43ecac['fieldName'],'type':_0x43ecac['type'][_0x9cfe('0x24')]};});_0x4811e6[_0x9cfe('0x25')]=_[_0x9cfe('0x21')](_0x43360c,_0x9cfe('0x1e'));_0x4811e6[_0x9cfe('0x26')]=_[_0x9cfe('0x27')](_0x249026[_0x9cfe('0x26')]);_0x4811e6[_0x9cfe('0x28')]=_[_0x9cfe('0x29')](_0x4811e6[_0x9cfe('0x25')],_0x4811e6[_0x9cfe('0x26')]);_0x1e2ac1[_0x9cfe('0x2a')]=_[_0x9cfe('0x29')](_0x4811e6[_0x9cfe('0x25')],qs['fields'](_0x249026[_0x9cfe('0x26')][_0x9cfe('0x2b')]));_0x1e2ac1[_0x9cfe('0x2a')]=_0x1e2ac1[_0x9cfe('0x2a')][_0x9cfe('0x2c')]?_0x1e2ac1['attributes']:_0x4811e6[_0x9cfe('0x25')];if(!_0x249026[_0x9cfe('0x26')]['hasOwnProperty']('nolimit')){_0x1e2ac1['limit']=qs['limit'](_0x249026[_0x9cfe('0x26')][_0x9cfe('0x16')]);_0x1e2ac1[_0x9cfe('0x15')]=qs[_0x9cfe('0x15')](_0x249026['query']['offset']);}_0x1e2ac1[_0x9cfe('0x2d')]=qs[_0x9cfe('0x2e')](_0x249026[_0x9cfe('0x26')]['sort']);_0x1e2ac1[_0x9cfe('0x2f')]=qs[_0x9cfe('0x28')](_[_0x9cfe('0x30')](_0x249026['query'],_0x4811e6[_0x9cfe('0x28')]),_0x43360c);if(_0x249026[_0x9cfe('0x26')][_0x9cfe('0x31')]){_0x1e2ac1[_0x9cfe('0x2f')]=_[_0x9cfe('0x32')](_0x1e2ac1[_0x9cfe('0x2f')],{'$or':_[_0x9cfe('0x21')](_0x43360c,function(_0x2e3e3c){if(_0x2e3e3c[_0x9cfe('0x33')]!==_0x9cfe('0x34')){var _0x1808a1={};_0x1808a1[_0x2e3e3c['name']]={'$like':'%'+_0x249026[_0x9cfe('0x26')]['filter']+'%'};return _0x1808a1;}})});}_0x1e2ac1=_[_0x9cfe('0x32')]({},_0x1e2ac1,_0x249026['options']);var _0x101602={'where':_0x1e2ac1[_0x9cfe('0x2f')]};return db[_0x9cfe('0x22')][_0x9cfe('0x14')](_0x101602)[_0x9cfe('0x1a')](function(_0x328289){_0x3aa431[_0x9cfe('0x14')]=_0x328289;if(_0x249026[_0x9cfe('0x26')]['includeAll']){_0x1e2ac1[_0x9cfe('0x35')]=[{'all':!![]}];}return db[_0x9cfe('0x22')][_0x9cfe('0x36')](_0x1e2ac1);})[_0x9cfe('0x1a')](function(_0x144aa9){_0x3aa431[_0x9cfe('0x37')]=_0x144aa9;return _0x3aa431;})['then'](respondWithFilteredResult(_0x5e3f5a,_0x1e2ac1))[_0x9cfe('0x38')](handleError(_0x5e3f5a,null));};exports[_0x9cfe('0x39')]=function(_0x1ef784,_0x223a55){var _0x1a97e8={'raw':!![],'where':{'id':_0x1ef784['params']['id']}},_0x63d10c={};_0x63d10c[_0x9cfe('0x25')]=_[_0x9cfe('0x27')](db[_0x9cfe('0x22')]['rawAttributes']);_0x63d10c[_0x9cfe('0x26')]=_['keys'](_0x1ef784[_0x9cfe('0x26')]);_0x63d10c[_0x9cfe('0x28')]=_[_0x9cfe('0x29')](_0x63d10c[_0x9cfe('0x25')],_0x63d10c['query']);_0x1a97e8['attributes']=_[_0x9cfe('0x29')](_0x63d10c[_0x9cfe('0x25')],qs[_0x9cfe('0x2b')](_0x1ef784[_0x9cfe('0x26')][_0x9cfe('0x2b')]));_0x1a97e8['attributes']=_0x1a97e8[_0x9cfe('0x2a')][_0x9cfe('0x2c')]?_0x1a97e8[_0x9cfe('0x2a')]:_0x63d10c[_0x9cfe('0x25')];if(_0x1ef784[_0x9cfe('0x26')][_0x9cfe('0x3a')]){_0x1a97e8[_0x9cfe('0x35')]=[{'all':!![]}];}_0x1a97e8=_[_0x9cfe('0x32')]({},_0x1a97e8,_0x1ef784[_0x9cfe('0x3b')]);return db[_0x9cfe('0x22')][_0x9cfe('0x3c')](_0x1a97e8)[_0x9cfe('0x1a')](handleEntityNotFound(_0x223a55,null))['then'](respondWithResult(_0x223a55,null))['catch'](handleError(_0x223a55,null));};exports[_0x9cfe('0x3d')]=function(_0x9fc875,_0x2ce9dc){return db[_0x9cfe('0x22')]['create'](_0x9fc875[_0x9cfe('0x3e')],{})['then'](respondWithResult(_0x2ce9dc,0xc9))[_0x9cfe('0x38')](handleError(_0x2ce9dc,null));};exports[_0x9cfe('0x19')]=function(_0x99bdfe,_0x300719){if(_0x99bdfe[_0x9cfe('0x3e')]['id']){delete _0x99bdfe['body']['id'];}return db[_0x9cfe('0x22')]['find']({'where':{'id':_0x99bdfe['params']['id']}})[_0x9cfe('0x1a')](handleEntityNotFound(_0x300719,null))[_0x9cfe('0x1a')](saveUpdates(_0x99bdfe[_0x9cfe('0x3e')],null))[_0x9cfe('0x1a')](respondWithResult(_0x300719,null))[_0x9cfe('0x38')](handleError(_0x300719,null));};exports[_0x9cfe('0x1b')]=function(_0x141a44,_0x2d9d07){return db[_0x9cfe('0x22')][_0x9cfe('0x3c')]({'where':{'id':_0x141a44['params']['id']}})['then'](handleEntityNotFound(_0x2d9d07,null))[_0x9cfe('0x1a')](removeEntity(_0x2d9d07,null))['catch'](handleError(_0x2d9d07,null));};exports[_0x9cfe('0x3f')]=function(_0x4a0f96,_0xca2e16){return db['ChatQueueReport'][_0x9cfe('0x3f')]()[_0x9cfe('0x1a')](respondWithResult(_0xca2e16,null))[_0x9cfe('0x38')](handleError(_0xca2e16,null));}; \ No newline at end of file +var _0x1baf=['filter','merge','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','describe','html-pdf','eml-format','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../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','reject','update','then','destroy','end','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1baf,0x12a));var _0xf1ba=function(_0x3e312a,_0x567c55){_0x3e312a=_0x3e312a-0x0;var _0x1fdb05=_0x1baf[_0x3e312a];return _0x1fdb05;};'use strict';var pdf=require(_0xf1ba('0x0'));var emlformat=require(_0xf1ba('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf1ba('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf1ba('0x3'));var path=require(_0xf1ba('0x4'));var sox=require(_0xf1ba('0x5'));var csv=require(_0xf1ba('0x6'));var ejs=require(_0xf1ba('0x7'));var fs=require('fs');var _=require(_0xf1ba('0x8'));var squel=require(_0xf1ba('0x9'));var crypto=require(_0xf1ba('0xa'));var jsforce=require(_0xf1ba('0xb'));var deskjs=require(_0xf1ba('0xc'));var toCsv=require(_0xf1ba('0x6'));var querystring=require(_0xf1ba('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf1ba('0xe'));var as=require(_0xf1ba('0xf'));var hardwareService=require(_0xf1ba('0x10'));var logger=require(_0xf1ba('0x11'))(_0xf1ba('0x12'));var utils=require(_0xf1ba('0x13'));var config=require(_0xf1ba('0x14'));var licenseUtil=require(_0xf1ba('0x15'));var db=require(_0xf1ba('0x16'))['db'];function respondWithStatusCode(_0x58da9e,_0x54c66d){_0x54c66d=_0x54c66d||0xcc;return function(_0x29e0ee){if(_0x29e0ee){return _0x58da9e[_0xf1ba('0x17')](_0x54c66d);}return _0x58da9e[_0xf1ba('0x18')](_0x54c66d)['end']();};}function respondWithResult(_0x50252,_0x4c2bfe){_0x4c2bfe=_0x4c2bfe||0xc8;return function(_0x2f17e3){if(_0x2f17e3){return _0x50252[_0xf1ba('0x18')](_0x4c2bfe)[_0xf1ba('0x19')](_0x2f17e3);}};}function respondWithFilteredResult(_0x542ac3,_0xbdcd10){return function(_0x1f3d09){if(_0x1f3d09){var _0x3445bf=_0x1f3d09[_0xf1ba('0x1a')],_0x2c7860=_0xbdcd10['offset'],_0x213cf9=_0xbdcd10[_0xf1ba('0x1b')]+_0xbdcd10['limit'],_0x36ef24;if(_0x213cf9>=_0x3445bf){_0x213cf9=_0x3445bf;_0x36ef24=0xc8;}else{_0x36ef24=0xce;}_0x542ac3[_0xf1ba('0x18')](_0x36ef24);return _0x542ac3['set']('Content-Range',_0x2c7860+'-'+_0x213cf9+'/'+_0x3445bf)[_0xf1ba('0x19')](_0x1f3d09);}return null;};}function patchUpdates(_0x1b0132){return function(_0xfda803){try{jsonpatch['apply'](_0xfda803,_0x1b0132,!![]);}catch(_0x5a03ca){return BPromise[_0xf1ba('0x1c')](_0x5a03ca);}return _0xfda803['save']();};}function saveUpdates(_0x5733ec,_0x317ec6){return function(_0x331bdd){if(_0x331bdd){return _0x331bdd[_0xf1ba('0x1d')](_0x5733ec)[_0xf1ba('0x1e')](function(_0x43050f){return _0x43050f;});}return null;};}function removeEntity(_0x39f303,_0xc1fe78){return function(_0x5430a0){if(_0x5430a0){return _0x5430a0[_0xf1ba('0x1f')]()[_0xf1ba('0x1e')](function(){_0x39f303['status'](0xcc)[_0xf1ba('0x20')]();});}};}function handleEntityNotFound(_0x946a3d,_0x56a36f){return function(_0x2d1928){if(!_0x2d1928){_0x946a3d[_0xf1ba('0x17')](0x194);}return _0x2d1928;};}function handleError(_0xa7bfc,_0x5240f4){_0x5240f4=_0x5240f4||0x1f4;return function(_0x5cd973){logger[_0xf1ba('0x21')](_0x5cd973['stack']);if(_0x5cd973[_0xf1ba('0x22')]){delete _0x5cd973['name'];}_0xa7bfc['status'](_0x5240f4)[_0xf1ba('0x23')](_0x5cd973);};}exports[_0xf1ba('0x24')]=function(_0x4684e1,_0x1273fb){var _0x25c1b9={},_0x517578={},_0x5d4109={'count':0x0,'rows':[]};var _0x1a8136=_[_0xf1ba('0x25')](db[_0xf1ba('0x26')][_0xf1ba('0x27')],function(_0x495d02){return{'name':_0x495d02[_0xf1ba('0x28')],'type':_0x495d02[_0xf1ba('0x29')]['key']};});_0x517578[_0xf1ba('0x2a')]=_[_0xf1ba('0x25')](_0x1a8136,'name');_0x517578[_0xf1ba('0x2b')]=_[_0xf1ba('0x2c')](_0x4684e1[_0xf1ba('0x2b')]);_0x517578['filters']=_[_0xf1ba('0x2d')](_0x517578[_0xf1ba('0x2a')],_0x517578[_0xf1ba('0x2b')]);_0x25c1b9[_0xf1ba('0x2e')]=_[_0xf1ba('0x2d')](_0x517578[_0xf1ba('0x2a')],qs[_0xf1ba('0x2f')](_0x4684e1[_0xf1ba('0x2b')][_0xf1ba('0x2f')]));_0x25c1b9[_0xf1ba('0x2e')]=_0x25c1b9[_0xf1ba('0x2e')][_0xf1ba('0x30')]?_0x25c1b9['attributes']:_0x517578[_0xf1ba('0x2a')];if(!_0x4684e1['query'][_0xf1ba('0x31')](_0xf1ba('0x32'))){_0x25c1b9[_0xf1ba('0x33')]=qs[_0xf1ba('0x33')](_0x4684e1[_0xf1ba('0x2b')][_0xf1ba('0x33')]);_0x25c1b9[_0xf1ba('0x1b')]=qs[_0xf1ba('0x1b')](_0x4684e1[_0xf1ba('0x2b')][_0xf1ba('0x1b')]);}_0x25c1b9[_0xf1ba('0x34')]=qs[_0xf1ba('0x35')](_0x4684e1[_0xf1ba('0x2b')]['sort']);_0x25c1b9[_0xf1ba('0x36')]=qs[_0xf1ba('0x37')](_[_0xf1ba('0x38')](_0x4684e1[_0xf1ba('0x2b')],_0x517578[_0xf1ba('0x37')]),_0x1a8136);if(_0x4684e1[_0xf1ba('0x2b')][_0xf1ba('0x39')]){_0x25c1b9[_0xf1ba('0x36')]=_[_0xf1ba('0x3a')](_0x25c1b9[_0xf1ba('0x36')],{'$or':_[_0xf1ba('0x25')](_0x1a8136,function(_0x1d7274){if(_0x1d7274[_0xf1ba('0x29')]!=='VIRTUAL'){var _0x48d53a={};_0x48d53a[_0x1d7274['name']]={'$like':'%'+_0x4684e1[_0xf1ba('0x2b')]['filter']+'%'};return _0x48d53a;}})});}_0x25c1b9=_[_0xf1ba('0x3a')]({},_0x25c1b9,_0x4684e1['options']);var _0x31e5d2={'where':_0x25c1b9[_0xf1ba('0x36')]};return db['ChatQueueReport'][_0xf1ba('0x1a')](_0x31e5d2)['then'](function(_0x155f4b){_0x5d4109['count']=_0x155f4b;if(_0x4684e1['query']['includeAll']){_0x25c1b9[_0xf1ba('0x3b')]=[{'all':!![]}];}return db[_0xf1ba('0x26')][_0xf1ba('0x3c')](_0x25c1b9);})[_0xf1ba('0x1e')](function(_0x5191eb){_0x5d4109[_0xf1ba('0x3d')]=_0x5191eb;return _0x5d4109;})[_0xf1ba('0x1e')](respondWithFilteredResult(_0x1273fb,_0x25c1b9))[_0xf1ba('0x3e')](handleError(_0x1273fb,null));};exports[_0xf1ba('0x3f')]=function(_0x27a140,_0xf5521c){var _0x289aab={'raw':!![],'where':{'id':_0x27a140['params']['id']}},_0x56a56d={};_0x56a56d[_0xf1ba('0x2a')]=_[_0xf1ba('0x2c')](db[_0xf1ba('0x26')]['rawAttributes']);_0x56a56d['query']=_[_0xf1ba('0x2c')](_0x27a140['query']);_0x56a56d[_0xf1ba('0x37')]=_[_0xf1ba('0x2d')](_0x56a56d[_0xf1ba('0x2a')],_0x56a56d['query']);_0x289aab[_0xf1ba('0x2e')]=_[_0xf1ba('0x2d')](_0x56a56d[_0xf1ba('0x2a')],qs[_0xf1ba('0x2f')](_0x27a140['query'][_0xf1ba('0x2f')]));_0x289aab['attributes']=_0x289aab[_0xf1ba('0x2e')][_0xf1ba('0x30')]?_0x289aab[_0xf1ba('0x2e')]:_0x56a56d[_0xf1ba('0x2a')];if(_0x27a140['query'][_0xf1ba('0x40')]){_0x289aab[_0xf1ba('0x3b')]=[{'all':!![]}];}_0x289aab=_[_0xf1ba('0x3a')]({},_0x289aab,_0x27a140[_0xf1ba('0x41')]);return db[_0xf1ba('0x26')][_0xf1ba('0x42')](_0x289aab)[_0xf1ba('0x1e')](handleEntityNotFound(_0xf5521c,null))[_0xf1ba('0x1e')](respondWithResult(_0xf5521c,null))[_0xf1ba('0x3e')](handleError(_0xf5521c,null));};exports[_0xf1ba('0x43')]=function(_0x581068,_0x2214e0){return db[_0xf1ba('0x26')]['create'](_0x581068[_0xf1ba('0x44')],{})[_0xf1ba('0x1e')](respondWithResult(_0x2214e0,0xc9))[_0xf1ba('0x3e')](handleError(_0x2214e0,null));};exports['update']=function(_0x17ff63,_0xcd9d34){if(_0x17ff63[_0xf1ba('0x44')]['id']){delete _0x17ff63[_0xf1ba('0x44')]['id'];}return db[_0xf1ba('0x26')][_0xf1ba('0x42')]({'where':{'id':_0x17ff63[_0xf1ba('0x45')]['id']}})[_0xf1ba('0x1e')](handleEntityNotFound(_0xcd9d34,null))['then'](saveUpdates(_0x17ff63[_0xf1ba('0x44')],null))['then'](respondWithResult(_0xcd9d34,null))['catch'](handleError(_0xcd9d34,null));};exports[_0xf1ba('0x1f')]=function(_0xddc776,_0x3b8c84){return db[_0xf1ba('0x26')][_0xf1ba('0x42')]({'where':{'id':_0xddc776[_0xf1ba('0x45')]['id']}})[_0xf1ba('0x1e')](handleEntityNotFound(_0x3b8c84,null))[_0xf1ba('0x1e')](removeEntity(_0x3b8c84,null))[_0xf1ba('0x3e')](handleError(_0x3b8c84,null));};exports['describe']=function(_0x1d45a7,_0x575db2){return db['ChatQueueReport'][_0xf1ba('0x46')]()[_0xf1ba('0x1e')](respondWithResult(_0x575db2,null))[_0xf1ba('0x3e')](handleError(_0x575db2,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 215c33b..8ea5c47 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 _0xb182=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid'];(function(_0x34e865,_0x38bc20){var _0x4eb49c=function(_0x567f02){while(--_0x567f02){_0x34e865['push'](_0x34e865['shift']());}};_0x4eb49c(++_0x38bc20);}(_0xb182,0x17a));var _0x2b18=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0xb182[_0x316c42];return _0x2b38f7;};'use strict';var _=require(_0x2b18('0x0'));var util=require(_0x2b18('0x1'));var logger=require(_0x2b18('0x2'))(_0x2b18('0x3'));var moment=require(_0x2b18('0x4'));var BPromise=require('bluebird');var rp=require(_0x2b18('0x5'));var fs=require('fs');var path=require(_0x2b18('0x6'));var rimraf=require(_0x2b18('0x7'));var config=require(_0x2b18('0x8'));var attributes=require(_0x2b18('0x9'));module[_0x2b18('0xa')]=function(_0x3fba45,_0x49b779){return _0x3fba45[_0x2b18('0xb')]('ChatQueueReport',attributes,{'tableName':_0x2b18('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2b18('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x038c=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatQueueReport.attributes','ChatQueueReport','report_chat_queue'];(function(_0x5664d7,_0x34789f){var _0x59e784=function(_0x5fbf88){while(--_0x5fbf88){_0x5664d7['push'](_0x5664d7['shift']());}};_0x59e784(++_0x34789f);}(_0x038c,0x146));var _0xc038=function(_0x3550e0,_0x4be816){_0x3550e0=_0x3550e0-0x0;var _0x65e3d5=_0x038c[_0x3550e0];return _0x65e3d5;};'use strict';var _=require(_0xc038('0x0'));var util=require(_0xc038('0x1'));var logger=require(_0xc038('0x2'))(_0xc038('0x3'));var moment=require(_0xc038('0x4'));var BPromise=require(_0xc038('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc038('0x6'));var rimraf=require(_0xc038('0x7'));var config=require(_0xc038('0x8'));var attributes=require(_0xc038('0x9'));module['exports']=function(_0x101daf,_0x199734){return _0x101daf['define'](_0xc038('0xa'),attributes,{'tableName':_0xc038('0xb'),'paranoid':![],'indexes':[{'name':_0xc038('0xc'),'fields':[_0xc038('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 c8af2bc..bde5f67 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 _0x3613=['then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ChatQueueReport','create','body','raw','CreateChatQueueReport','UpdateChatQueueReport','update','options','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x469ae2,_0x24cd30){var _0x5e33e4=function(_0x1aaeb1){while(--_0x1aaeb1){_0x469ae2['push'](_0x469ae2['shift']());}};_0x5e33e4(++_0x24cd30);}(_0x3613,0x13f));var _0x3361=function(_0x553e5b,_0x28bfaa){_0x553e5b=_0x553e5b-0x0;var _0x11f1db=_0x3613[_0x553e5b];return _0x11f1db;};'use strict';var _=require(_0x3361('0x0'));var util=require(_0x3361('0x1'));var moment=require('moment');var BPromise=require(_0x3361('0x2'));var rs=require(_0x3361('0x3'));var fs=require('fs');var Redis=require(_0x3361('0x4'));var db=require(_0x3361('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3361('0x6'))(_0x3361('0x7'));var config=require('../../config/environment');var jayson=require(_0x3361('0x8'));var client=jayson[_0x3361('0x9')][_0x3361('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1628d7,_0x50c581,_0x507969){return new BPromise(function(_0x2114b7,_0x52975){return client['request'](_0x1628d7,_0x507969)[_0x3361('0xb')](function(_0x1bc0a7){logger[_0x3361('0xc')](_0x3361('0xd'),_0x50c581,_0x3361('0xe'));logger[_0x3361('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x50c581,_0x3361('0xe'),JSON[_0x3361('0x10')](_0x1bc0a7));if(_0x1bc0a7['error']){if(_0x1bc0a7[_0x3361('0x11')][_0x3361('0x12')]===0x1f4){logger[_0x3361('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x50c581,_0x1bc0a7[_0x3361('0x11')][_0x3361('0x13')]);return _0x52975(_0x1bc0a7[_0x3361('0x11')]['message']);}logger[_0x3361('0x11')](_0x3361('0xd'),_0x50c581,_0x1bc0a7[_0x3361('0x11')][_0x3361('0x13')]);return _0x2114b7(_0x1bc0a7[_0x3361('0x11')][_0x3361('0x13')]);}else{logger['info'](_0x3361('0xd'),_0x50c581,'request\x20sent');_0x2114b7(_0x1bc0a7[_0x3361('0x14')][_0x3361('0x13')]);}})[_0x3361('0x15')](function(_0x4c0879){logger['error'](_0x3361('0xd'),_0x50c581,_0x4c0879);_0x52975(_0x4c0879);});});}exports['CreateChatQueueReport']=function(_0x582ac2){var _0x1c53c4=this;return new Promise(function(_0x592613,_0x63429c){return db[_0x3361('0x16')][_0x3361('0x17')](_0x582ac2[_0x3361('0x18')],{'raw':_0x582ac2['options']?_0x582ac2['options'][_0x3361('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5a7759){logger[_0x3361('0xc')](_0x3361('0x1a'),_0x582ac2);logger[_0x3361('0xf')](_0x3361('0x1a'),_0x582ac2,JSON[_0x3361('0x10')](_0x5a7759));_0x592613(_0x5a7759);})[_0x3361('0x15')](function(_0x16708e){logger[_0x3361('0x11')](_0x3361('0x1a'),_0x16708e[_0x3361('0x13')],_0x582ac2);_0x63429c(_0x1c53c4[_0x3361('0x11')](0x1f4,_0x16708e[_0x3361('0x13')]));});});};exports[_0x3361('0x1b')]=function(_0x162fee){var _0x453a31=this;return new Promise(function(_0x13f7dc,_0x4dae14){return db[_0x3361('0x16')][_0x3361('0x1c')](_0x162fee['body'],{'raw':_0x162fee[_0x3361('0x1d')]?_0x162fee[_0x3361('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x162fee[_0x3361('0x1d')]?_0x162fee['options'][_0x3361('0x1e')]||null:null,'attributes':_0x162fee['options']?_0x162fee['options'][_0x3361('0x1f')]||null:null,'limit':_0x162fee[_0x3361('0x1d')]?_0x162fee[_0x3361('0x1d')][_0x3361('0x20')]||null:null})[_0x3361('0xb')](function(_0x26dd7a){logger[_0x3361('0xc')](_0x3361('0x1b'),_0x162fee);logger[_0x3361('0xf')](_0x3361('0x1b'),_0x162fee,JSON[_0x3361('0x10')](_0x26dd7a));_0x13f7dc(_0x26dd7a);})[_0x3361('0x15')](function(_0xb56214){logger[_0x3361('0x11')]('UpdateChatQueueReport',_0xb56214[_0x3361('0x13')],_0x162fee);_0x4dae14(_0x453a31[_0x3361('0x11')](0x1f4,_0xb56214[_0x3361('0x13')]));});});}; \ No newline at end of file +var _0xa01d=['client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','body','options','CreateChatQueueReport','debug','UpdateChatQueueReport','ChatQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1b0946,_0x503fbc){var _0x286172=function(_0x2ee408){while(--_0x2ee408){_0x1b0946['push'](_0x1b0946['shift']());}};_0x286172(++_0x503fbc);}(_0xa01d,0x138));var _0xda01=function(_0x1aff48,_0x21edff){_0x1aff48=_0x1aff48-0x0;var _0x10a344=_0xa01d[_0x1aff48];return _0x10a344;};'use strict';var _=require(_0xda01('0x0'));var util=require(_0xda01('0x1'));var moment=require(_0xda01('0x2'));var BPromise=require(_0xda01('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda01('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xda01('0x5'))('rpc');var config=require(_0xda01('0x6'));var jayson=require(_0xda01('0x7'));var client=jayson[_0xda01('0x8')][_0xda01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b0223,_0x16fe8c,_0x54064a){return new BPromise(function(_0x36f20a,_0x2d0f47){return client[_0xda01('0xa')](_0x3b0223,_0x54064a)[_0xda01('0xb')](function(_0x2c1d4f){logger[_0xda01('0xc')](_0xda01('0xd'),_0x16fe8c,'request\x20sent');logger['debug'](_0xda01('0xe'),_0x16fe8c,_0xda01('0xf'),JSON[_0xda01('0x10')](_0x2c1d4f));if(_0x2c1d4f['error']){if(_0x2c1d4f[_0xda01('0x11')][_0xda01('0x12')]===0x1f4){logger[_0xda01('0x11')](_0xda01('0xd'),_0x16fe8c,_0x2c1d4f[_0xda01('0x11')][_0xda01('0x13')]);return _0x2d0f47(_0x2c1d4f['error'][_0xda01('0x13')]);}logger[_0xda01('0x11')](_0xda01('0xd'),_0x16fe8c,_0x2c1d4f[_0xda01('0x11')]['message']);return _0x36f20a(_0x2c1d4f['error'][_0xda01('0x13')]);}else{logger[_0xda01('0xc')](_0xda01('0xd'),_0x16fe8c,_0xda01('0xf'));_0x36f20a(_0x2c1d4f['result']['message']);}})[_0xda01('0x14')](function(_0x2d0189){logger[_0xda01('0x11')](_0xda01('0xd'),_0x16fe8c,_0x2d0189);_0x2d0f47(_0x2d0189);});});}exports['CreateChatQueueReport']=function(_0x19f806){var _0x9fe8da=this;return new Promise(function(_0x1488de,_0x5f1616){return db['ChatQueueReport']['create'](_0x19f806[_0xda01('0x15')],{'raw':_0x19f806[_0xda01('0x16')]?_0x19f806[_0xda01('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xda01('0xb')](function(_0x43d201){logger[_0xda01('0xc')](_0xda01('0x17'),_0x19f806);logger[_0xda01('0x18')](_0xda01('0x17'),_0x19f806,JSON['stringify'](_0x43d201));_0x1488de(_0x43d201);})[_0xda01('0x14')](function(_0x30e0c4){logger[_0xda01('0x11')](_0xda01('0x17'),_0x30e0c4[_0xda01('0x13')],_0x19f806);_0x5f1616(_0x9fe8da[_0xda01('0x11')](0x1f4,_0x30e0c4[_0xda01('0x13')]));});});};exports[_0xda01('0x19')]=function(_0x31d2ec){var _0x3d56a3=this;return new Promise(function(_0x31f961,_0x283482){return db[_0xda01('0x1a')][_0xda01('0x1b')](_0x31d2ec[_0xda01('0x15')],{'raw':_0x31d2ec[_0xda01('0x16')]?_0x31d2ec[_0xda01('0x16')][_0xda01('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31d2ec['options']?_0x31d2ec[_0xda01('0x16')][_0xda01('0x1d')]||null:null,'attributes':_0x31d2ec[_0xda01('0x16')]?_0x31d2ec[_0xda01('0x16')][_0xda01('0x1e')]||null:null,'limit':_0x31d2ec[_0xda01('0x16')]?_0x31d2ec['options'][_0xda01('0x1f')]||null:null})[_0xda01('0xb')](function(_0x4f1725){logger[_0xda01('0xc')](_0xda01('0x19'),_0x31d2ec);logger[_0xda01('0x18')](_0xda01('0x19'),_0x31d2ec,JSON['stringify'](_0x4f1725));_0x31f961(_0x4f1725);})['catch'](function(_0x38c5ae){logger['error'](_0xda01('0x19'),_0x38c5ae[_0xda01('0x13')],_0x31d2ec);_0x283482(_0x3d56a3[_0xda01('0x11')](0x1f4,_0x38c5ae[_0xda01('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 99147ab..f5a82d7 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 _0xe0b8=['get','isAuthenticated','index','describe','show','post','create','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller'];(function(_0x3f136a,_0x46c695){var _0xef9409=function(_0x431edc){while(--_0x431edc){_0x3f136a['push'](_0x3f136a['shift']());}};_0xef9409(++_0x46c695);}(_0xe0b8,0x14d));var _0x8e0b=function(_0x7a5fee,_0x303e77){_0x7a5fee=_0x7a5fee-0x0;var _0x16ac13=_0xe0b8[_0x7a5fee];return _0x16ac13;};'use strict';var multer=require(_0x8e0b('0x0'));var util=require(_0x8e0b('0x1'));var path=require(_0x8e0b('0x2'));var timeout=require(_0x8e0b('0x3'));var express=require(_0x8e0b('0x4'));var router=express[_0x8e0b('0x5')]();var auth=require(_0x8e0b('0x6'));var interaction=require(_0x8e0b('0x7'));var config=require('../../config/environment');var controller=require(_0x8e0b('0x8'));router[_0x8e0b('0x9')]('/',auth[_0x8e0b('0xa')](),controller[_0x8e0b('0xb')]);router[_0x8e0b('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x8e0b('0xc')]);router['get']('/:id',auth[_0x8e0b('0xa')](),controller[_0x8e0b('0xd')]);router[_0x8e0b('0xe')]('/',auth[_0x8e0b('0xa')](),controller[_0x8e0b('0xf')]);router['put'](_0x8e0b('0x10'),auth[_0x8e0b('0xa')](),controller['update']);router[_0x8e0b('0x11')](_0x8e0b('0x10'),auth[_0x8e0b('0xa')](),controller['destroy']);module[_0x8e0b('0x12')]=router; \ No newline at end of file +var _0x713e=['/describe','describe','create','update','delete','/:id','destroy','exports','connect-timeout','express','Router','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index'];(function(_0x38c981,_0x3950e4){var _0x3e00bf=function(_0x2088e9){while(--_0x2088e9){_0x38c981['push'](_0x38c981['shift']());}};_0x3e00bf(++_0x3950e4);}(_0x713e,0x108));var _0xe713=function(_0x28d225,_0x43be18){_0x28d225=_0x28d225-0x0;var _0x1f79e1=_0x713e[_0x28d225];return _0x1f79e1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe713('0x0'));var express=require(_0xe713('0x1'));var router=express[_0xe713('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe713('0x3'));var config=require('../../config/environment');var controller=require(_0xe713('0x4'));router[_0xe713('0x5')]('/',auth[_0xe713('0x6')](),controller[_0xe713('0x7')]);router[_0xe713('0x5')](_0xe713('0x8'),auth[_0xe713('0x6')](),controller[_0xe713('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe713('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe713('0xb')]);router[_0xe713('0xc')](_0xe713('0xd'),auth[_0xe713('0x6')](),controller[_0xe713('0xe')]);module[_0xe713('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index e0b17c3..f4a1f82 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 _0x8ee5=['queue','DATE','NOW','moment','exports','STRING','ENUM','account','agent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ee5,0x108));var _0x58ee=function(_0x4c6ff7,_0x26b6b9){_0x4c6ff7=_0x4c6ff7-0x0;var _0xd94a98=_0x8ee5[_0x4c6ff7];return _0xd94a98;};'use strict';var moment=require(_0x58ee('0x0'));var Sequelize=require('sequelize');module[_0x58ee('0x1')]={'uniqueid':{'type':Sequelize[_0x58ee('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x58ee('0x3')](_0x58ee('0x4'),_0x58ee('0x5'),_0x58ee('0x6')),'allowNull':![],'defaultValue':_0x58ee('0x6')},'transferredAt':{'type':Sequelize[_0x58ee('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x58ee('0x8')]}}; \ No newline at end of file +var _0xcdfc=['exports','STRING','ENUM','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xcdfc,0x139));var _0xccdf=function(_0x20484c,_0x20e9e5){_0x20484c=_0x20484c-0x0;var _0x55ceed=_0xcdfc[_0x20484c];return _0x55ceed;};'use strict';var moment=require(_0xccdf('0x0'));var Sequelize=require(_0xccdf('0x1'));module[_0xccdf('0x2')]={'uniqueid':{'type':Sequelize[_0xccdf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xccdf('0x4')]('account',_0xccdf('0x5'),_0xccdf('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xccdf('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xccdf('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index c3564c4..abdcb38 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 _0x45af=['findAll','rows','catch','show','find','create','body','params','destroy','describe','html-pdf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../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','Content-Range','apply','reject','update','then','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x10ef93,_0xe1aa93){var _0x4055cd=function(_0x322bde){while(--_0x322bde){_0x10ef93['push'](_0x10ef93['shift']());}};_0x4055cd(++_0xe1aa93);}(_0x45af,0xeb));var _0xf45a=function(_0x5adfb6,_0x599b71){_0x5adfb6=_0x5adfb6-0x0;var _0x484361=_0x45af[_0x5adfb6];return _0x484361;};'use strict';var pdf=require(_0xf45a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf45a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf45a('0x2'));var moment=require(_0xf45a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf45a('0x4'));var util=require(_0xf45a('0x5'));var path=require('path');var sox=require(_0xf45a('0x6'));var csv=require(_0xf45a('0x7'));var ejs=require(_0xf45a('0x8'));var fs=require('fs');var _=require(_0xf45a('0x9'));var squel=require(_0xf45a('0xa'));var crypto=require('crypto');var jsforce=require(_0xf45a('0xb'));var deskjs=require(_0xf45a('0xc'));var toCsv=require(_0xf45a('0x7'));var querystring=require(_0xf45a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf45a('0xe'));var qs=require(_0xf45a('0xf'));var as=require(_0xf45a('0x10'));var hardwareService=require(_0xf45a('0x11'));var logger=require(_0xf45a('0x12'))(_0xf45a('0x13'));var utils=require(_0xf45a('0x14'));var config=require(_0xf45a('0x15'));var licenseUtil=require(_0xf45a('0x16'));var db=require(_0xf45a('0x17'))['db'];function respondWithStatusCode(_0x1cb2e2,_0x4fec4f){_0x4fec4f=_0x4fec4f||0xcc;return function(_0x5356d8){if(_0x5356d8){return _0x1cb2e2[_0xf45a('0x18')](_0x4fec4f);}return _0x1cb2e2[_0xf45a('0x19')](_0x4fec4f)[_0xf45a('0x1a')]();};}function respondWithResult(_0x16d3c8,_0x1ae581){_0x1ae581=_0x1ae581||0xc8;return function(_0x41203e){if(_0x41203e){return _0x16d3c8[_0xf45a('0x19')](_0x1ae581)[_0xf45a('0x1b')](_0x41203e);}};}function respondWithFilteredResult(_0x6c03d5,_0x365d94){return function(_0x3cc99a){if(_0x3cc99a){var _0x532104=_0x3cc99a[_0xf45a('0x1c')],_0x208320=_0x365d94['offset'],_0x441b43=_0x365d94['offset']+_0x365d94['limit'],_0x5eb7de;if(_0x441b43>=_0x532104){_0x441b43=_0x532104;_0x5eb7de=0xc8;}else{_0x5eb7de=0xce;}_0x6c03d5[_0xf45a('0x19')](_0x5eb7de);return _0x6c03d5['set'](_0xf45a('0x1d'),_0x208320+'-'+_0x441b43+'/'+_0x532104)[_0xf45a('0x1b')](_0x3cc99a);}return null;};}function patchUpdates(_0x13ef2d){return function(_0x1156d7){try{jsonpatch[_0xf45a('0x1e')](_0x1156d7,_0x13ef2d,!![]);}catch(_0x5436f4){return BPromise[_0xf45a('0x1f')](_0x5436f4);}return _0x1156d7['save']();};}function saveUpdates(_0x4bcce8,_0x276c74){return function(_0x7d38da){if(_0x7d38da){return _0x7d38da[_0xf45a('0x20')](_0x4bcce8)[_0xf45a('0x21')](function(_0x593437){return _0x593437;});}return null;};}function removeEntity(_0x4b5422,_0x13be85){return function(_0x287fc3){if(_0x287fc3){return _0x287fc3['destroy']()[_0xf45a('0x21')](function(){_0x4b5422[_0xf45a('0x19')](0xcc)[_0xf45a('0x1a')]();});}};}function handleEntityNotFound(_0x4c8967,_0xe9ee35){return function(_0x49c119){if(!_0x49c119){_0x4c8967[_0xf45a('0x18')](0x194);}return _0x49c119;};}function handleError(_0x2e1b10,_0x3b35c0){_0x3b35c0=_0x3b35c0||0x1f4;return function(_0x4cc61b){logger[_0xf45a('0x22')](_0x4cc61b[_0xf45a('0x23')]);if(_0x4cc61b[_0xf45a('0x24')]){delete _0x4cc61b[_0xf45a('0x24')];}_0x2e1b10[_0xf45a('0x19')](_0x3b35c0)['send'](_0x4cc61b);};}exports[_0xf45a('0x25')]=function(_0x26cd36,_0x244db5){var _0xa19511={},_0x11c876={},_0x2830e3={'count':0x0,'rows':[]};var _0x5ede73=_[_0xf45a('0x26')](db[_0xf45a('0x27')][_0xf45a('0x28')],function(_0x5eaa44){return{'name':_0x5eaa44[_0xf45a('0x29')],'type':_0x5eaa44[_0xf45a('0x2a')][_0xf45a('0x2b')]};});_0x11c876[_0xf45a('0x2c')]=_[_0xf45a('0x26')](_0x5ede73,_0xf45a('0x24'));_0x11c876['query']=_[_0xf45a('0x2d')](_0x26cd36[_0xf45a('0x2e')]);_0x11c876[_0xf45a('0x2f')]=_[_0xf45a('0x30')](_0x11c876['model'],_0x11c876['query']);_0xa19511['attributes']=_['intersection'](_0x11c876['model'],qs[_0xf45a('0x31')](_0x26cd36['query']['fields']));_0xa19511['attributes']=_0xa19511[_0xf45a('0x32')][_0xf45a('0x33')]?_0xa19511[_0xf45a('0x32')]:_0x11c876[_0xf45a('0x2c')];if(!_0x26cd36[_0xf45a('0x2e')][_0xf45a('0x34')]('nolimit')){_0xa19511['limit']=qs[_0xf45a('0x35')](_0x26cd36[_0xf45a('0x2e')]['limit']);_0xa19511['offset']=qs[_0xf45a('0x36')](_0x26cd36[_0xf45a('0x2e')][_0xf45a('0x36')]);}_0xa19511[_0xf45a('0x37')]=qs[_0xf45a('0x38')](_0x26cd36[_0xf45a('0x2e')]['sort']);_0xa19511[_0xf45a('0x39')]=qs['filters'](_[_0xf45a('0x3a')](_0x26cd36[_0xf45a('0x2e')],_0x11c876[_0xf45a('0x2f')]),_0x5ede73);if(_0x26cd36[_0xf45a('0x2e')][_0xf45a('0x3b')]){_0xa19511[_0xf45a('0x39')]=_[_0xf45a('0x3c')](_0xa19511[_0xf45a('0x39')],{'$or':_['map'](_0x5ede73,function(_0x10cbe3){if(_0x10cbe3['type']!==_0xf45a('0x3d')){var _0x4ccfe7={};_0x4ccfe7[_0x10cbe3[_0xf45a('0x24')]]={'$like':'%'+_0x26cd36[_0xf45a('0x2e')]['filter']+'%'};return _0x4ccfe7;}})});}_0xa19511=_['merge']({},_0xa19511,_0x26cd36[_0xf45a('0x3e')]);var _0x5b8274={'where':_0xa19511[_0xf45a('0x39')]};return db[_0xf45a('0x27')][_0xf45a('0x1c')](_0x5b8274)[_0xf45a('0x21')](function(_0x20f0b0){_0x2830e3[_0xf45a('0x1c')]=_0x20f0b0;if(_0x26cd36[_0xf45a('0x2e')][_0xf45a('0x3f')]){_0xa19511[_0xf45a('0x40')]=[{'all':!![]}];}return db[_0xf45a('0x27')][_0xf45a('0x41')](_0xa19511);})[_0xf45a('0x21')](function(_0x47354c){_0x2830e3[_0xf45a('0x42')]=_0x47354c;return _0x2830e3;})[_0xf45a('0x21')](respondWithFilteredResult(_0x244db5,_0xa19511))[_0xf45a('0x43')](handleError(_0x244db5,null));};exports[_0xf45a('0x44')]=function(_0x528e0f,_0x4508f4){var _0x50bcd7={'raw':!![],'where':{'id':_0x528e0f['params']['id']}},_0x1e4792={};_0x1e4792[_0xf45a('0x2c')]=_[_0xf45a('0x2d')](db[_0xf45a('0x27')][_0xf45a('0x28')]);_0x1e4792[_0xf45a('0x2e')]=_[_0xf45a('0x2d')](_0x528e0f[_0xf45a('0x2e')]);_0x1e4792[_0xf45a('0x2f')]=_[_0xf45a('0x30')](_0x1e4792[_0xf45a('0x2c')],_0x1e4792['query']);_0x50bcd7[_0xf45a('0x32')]=_[_0xf45a('0x30')](_0x1e4792['model'],qs[_0xf45a('0x31')](_0x528e0f[_0xf45a('0x2e')]['fields']));_0x50bcd7['attributes']=_0x50bcd7[_0xf45a('0x32')]['length']?_0x50bcd7[_0xf45a('0x32')]:_0x1e4792['model'];if(_0x528e0f['query'][_0xf45a('0x3f')]){_0x50bcd7[_0xf45a('0x40')]=[{'all':!![]}];}_0x50bcd7=_[_0xf45a('0x3c')]({},_0x50bcd7,_0x528e0f[_0xf45a('0x3e')]);return db[_0xf45a('0x27')][_0xf45a('0x45')](_0x50bcd7)['then'](handleEntityNotFound(_0x4508f4,null))[_0xf45a('0x21')](respondWithResult(_0x4508f4,null))[_0xf45a('0x43')](handleError(_0x4508f4,null));};exports[_0xf45a('0x46')]=function(_0x920104,_0x584d8d){return db[_0xf45a('0x27')][_0xf45a('0x46')](_0x920104[_0xf45a('0x47')],{})['then'](respondWithResult(_0x584d8d,0xc9))[_0xf45a('0x43')](handleError(_0x584d8d,null));};exports[_0xf45a('0x20')]=function(_0x14928c,_0x42384e){if(_0x14928c[_0xf45a('0x47')]['id']){delete _0x14928c[_0xf45a('0x47')]['id'];}return db[_0xf45a('0x27')][_0xf45a('0x45')]({'where':{'id':_0x14928c[_0xf45a('0x48')]['id']}})[_0xf45a('0x21')](handleEntityNotFound(_0x42384e,null))[_0xf45a('0x21')](saveUpdates(_0x14928c[_0xf45a('0x47')],null))[_0xf45a('0x21')](respondWithResult(_0x42384e,null))[_0xf45a('0x43')](handleError(_0x42384e,null));};exports[_0xf45a('0x49')]=function(_0x1624cd,_0xfe04c2){return db[_0xf45a('0x27')][_0xf45a('0x45')]({'where':{'id':_0x1624cd[_0xf45a('0x48')]['id']}})[_0xf45a('0x21')](handleEntityNotFound(_0xfe04c2,null))[_0xf45a('0x21')](removeEntity(_0xfe04c2,null))[_0xf45a('0x43')](handleError(_0xfe04c2,null));};exports[_0xf45a('0x4a')]=function(_0x6ceb99,_0x41e2d7){return db['ChatTransferReport'][_0xf45a('0x4a')]()[_0xf45a('0x21')](respondWithResult(_0x41e2d7,null))[_0xf45a('0x43')](handleError(_0x41e2d7,null));}; \ No newline at end of file +var _0x5559=['querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','rows','catch','show','keys','include','options','find','create','body','params','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'];(function(_0xf5e0d7,_0x37fcb2){var _0x194e60=function(_0x499902){while(--_0x499902){_0xf5e0d7['push'](_0xf5e0d7['shift']());}};_0x194e60(++_0x37fcb2);}(_0x5559,0x1bc));var _0x9555=function(_0x561b89,_0x8eb770){_0x561b89=_0x561b89-0x0;var _0x41ccfb=_0x5559[_0x561b89];return _0x41ccfb;};'use strict';var pdf=require(_0x9555('0x0'));var emlformat=require(_0x9555('0x1'));var rimraf=require(_0x9555('0x2'));var zipdir=require(_0x9555('0x3'));var jsonpatch=require(_0x9555('0x4'));var rp=require(_0x9555('0x5'));var moment=require(_0x9555('0x6'));var BPromise=require(_0x9555('0x7'));var Mustache=require('mustache');var util=require(_0x9555('0x8'));var path=require(_0x9555('0x9'));var sox=require(_0x9555('0xa'));var csv=require(_0x9555('0xb'));var ejs=require(_0x9555('0xc'));var fs=require('fs');var _=require(_0x9555('0xd'));var squel=require(_0x9555('0xe'));var crypto=require(_0x9555('0xf'));var jsforce=require(_0x9555('0x10'));var deskjs=require(_0x9555('0x11'));var toCsv=require(_0x9555('0xb'));var querystring=require(_0x9555('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9555('0x13'));var as=require(_0x9555('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9555('0x15'))(_0x9555('0x16'));var utils=require(_0x9555('0x17'));var config=require(_0x9555('0x18'));var licenseUtil=require(_0x9555('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50f599,_0x580d4e){_0x580d4e=_0x580d4e||0xcc;return function(_0x577575){if(_0x577575){return _0x50f599[_0x9555('0x1a')](_0x580d4e);}return _0x50f599[_0x9555('0x1b')](_0x580d4e)[_0x9555('0x1c')]();};}function respondWithResult(_0x1d3b4a,_0x304a31){_0x304a31=_0x304a31||0xc8;return function(_0xf8981d){if(_0xf8981d){return _0x1d3b4a['status'](_0x304a31)[_0x9555('0x1d')](_0xf8981d);}};}function respondWithFilteredResult(_0x323fc8,_0x350a50){return function(_0x1c3f7b){if(_0x1c3f7b){var _0x403e1e=_0x1c3f7b[_0x9555('0x1e')],_0x20a68b=_0x350a50['offset'],_0x57225a=_0x350a50[_0x9555('0x1f')]+_0x350a50[_0x9555('0x20')],_0x2b64ad;if(_0x57225a>=_0x403e1e){_0x57225a=_0x403e1e;_0x2b64ad=0xc8;}else{_0x2b64ad=0xce;}_0x323fc8[_0x9555('0x1b')](_0x2b64ad);return _0x323fc8[_0x9555('0x21')](_0x9555('0x22'),_0x20a68b+'-'+_0x57225a+'/'+_0x403e1e)['json'](_0x1c3f7b);}return null;};}function patchUpdates(_0x4c4884){return function(_0x1afed5){try{jsonpatch[_0x9555('0x23')](_0x1afed5,_0x4c4884,!![]);}catch(_0x40db34){return BPromise[_0x9555('0x24')](_0x40db34);}return _0x1afed5[_0x9555('0x25')]();};}function saveUpdates(_0xa95026,_0x410f4b){return function(_0x2011d6){if(_0x2011d6){return _0x2011d6[_0x9555('0x26')](_0xa95026)['then'](function(_0x52e459){return _0x52e459;});}return null;};}function removeEntity(_0x5c8b5b,_0x15714c){return function(_0x55f84f){if(_0x55f84f){return _0x55f84f['destroy']()[_0x9555('0x27')](function(){_0x5c8b5b[_0x9555('0x1b')](0xcc)[_0x9555('0x1c')]();});}};}function handleEntityNotFound(_0x5a072c,_0x3cc01c){return function(_0x56bee2){if(!_0x56bee2){_0x5a072c[_0x9555('0x1a')](0x194);}return _0x56bee2;};}function handleError(_0x68b513,_0x491247){_0x491247=_0x491247||0x1f4;return function(_0x4b61e3){logger[_0x9555('0x28')](_0x4b61e3[_0x9555('0x29')]);if(_0x4b61e3[_0x9555('0x2a')]){delete _0x4b61e3[_0x9555('0x2a')];}_0x68b513[_0x9555('0x1b')](_0x491247)[_0x9555('0x2b')](_0x4b61e3);};}exports[_0x9555('0x2c')]=function(_0x2ae839,_0x468e74){var _0x383e3a={},_0x5c47ab={},_0x253620={'count':0x0,'rows':[]};var _0x573c57=_[_0x9555('0x2d')](db[_0x9555('0x2e')][_0x9555('0x2f')],function(_0x512375){return{'name':_0x512375[_0x9555('0x30')],'type':_0x512375[_0x9555('0x31')][_0x9555('0x32')]};});_0x5c47ab[_0x9555('0x33')]=_[_0x9555('0x2d')](_0x573c57,'name');_0x5c47ab[_0x9555('0x34')]=_['keys'](_0x2ae839[_0x9555('0x34')]);_0x5c47ab['filters']=_[_0x9555('0x35')](_0x5c47ab[_0x9555('0x33')],_0x5c47ab[_0x9555('0x34')]);_0x383e3a['attributes']=_[_0x9555('0x35')](_0x5c47ab[_0x9555('0x33')],qs[_0x9555('0x36')](_0x2ae839['query'][_0x9555('0x36')]));_0x383e3a[_0x9555('0x37')]=_0x383e3a[_0x9555('0x37')][_0x9555('0x38')]?_0x383e3a[_0x9555('0x37')]:_0x5c47ab[_0x9555('0x33')];if(!_0x2ae839[_0x9555('0x34')]['hasOwnProperty'](_0x9555('0x39'))){_0x383e3a[_0x9555('0x20')]=qs['limit'](_0x2ae839[_0x9555('0x34')][_0x9555('0x20')]);_0x383e3a[_0x9555('0x1f')]=qs[_0x9555('0x1f')](_0x2ae839['query']['offset']);}_0x383e3a[_0x9555('0x3a')]=qs[_0x9555('0x3b')](_0x2ae839[_0x9555('0x34')]['sort']);_0x383e3a[_0x9555('0x3c')]=qs[_0x9555('0x3d')](_['pick'](_0x2ae839[_0x9555('0x34')],_0x5c47ab[_0x9555('0x3d')]),_0x573c57);if(_0x2ae839['query'][_0x9555('0x3e')]){_0x383e3a[_0x9555('0x3c')]=_['merge'](_0x383e3a['where'],{'$or':_['map'](_0x573c57,function(_0x58302a){if(_0x58302a[_0x9555('0x31')]!==_0x9555('0x3f')){var _0x4cc6cc={};_0x4cc6cc[_0x58302a[_0x9555('0x2a')]]={'$like':'%'+_0x2ae839[_0x9555('0x34')][_0x9555('0x3e')]+'%'};return _0x4cc6cc;}})});}_0x383e3a=_[_0x9555('0x40')]({},_0x383e3a,_0x2ae839['options']);var _0x2b458d={'where':_0x383e3a[_0x9555('0x3c')]};return db[_0x9555('0x2e')][_0x9555('0x1e')](_0x2b458d)[_0x9555('0x27')](function(_0x5d548b){_0x253620[_0x9555('0x1e')]=_0x5d548b;if(_0x2ae839[_0x9555('0x34')][_0x9555('0x41')]){_0x383e3a['include']=[{'all':!![]}];}return db[_0x9555('0x2e')]['findAll'](_0x383e3a);})['then'](function(_0x418b22){_0x253620[_0x9555('0x42')]=_0x418b22;return _0x253620;})['then'](respondWithFilteredResult(_0x468e74,_0x383e3a))[_0x9555('0x43')](handleError(_0x468e74,null));};exports[_0x9555('0x44')]=function(_0x7af73a,_0x1d11eb){var _0x5e9301={'raw':!![],'where':{'id':_0x7af73a['params']['id']}},_0x4aedfc={};_0x4aedfc['model']=_['keys'](db[_0x9555('0x2e')]['rawAttributes']);_0x4aedfc['query']=_[_0x9555('0x45')](_0x7af73a[_0x9555('0x34')]);_0x4aedfc[_0x9555('0x3d')]=_[_0x9555('0x35')](_0x4aedfc['model'],_0x4aedfc[_0x9555('0x34')]);_0x5e9301['attributes']=_[_0x9555('0x35')](_0x4aedfc[_0x9555('0x33')],qs['fields'](_0x7af73a[_0x9555('0x34')][_0x9555('0x36')]));_0x5e9301[_0x9555('0x37')]=_0x5e9301[_0x9555('0x37')][_0x9555('0x38')]?_0x5e9301['attributes']:_0x4aedfc[_0x9555('0x33')];if(_0x7af73a[_0x9555('0x34')][_0x9555('0x41')]){_0x5e9301[_0x9555('0x46')]=[{'all':!![]}];}_0x5e9301=_[_0x9555('0x40')]({},_0x5e9301,_0x7af73a[_0x9555('0x47')]);return db[_0x9555('0x2e')][_0x9555('0x48')](_0x5e9301)[_0x9555('0x27')](handleEntityNotFound(_0x1d11eb,null))[_0x9555('0x27')](respondWithResult(_0x1d11eb,null))[_0x9555('0x43')](handleError(_0x1d11eb,null));};exports[_0x9555('0x49')]=function(_0x41826d,_0x32aa28){return db[_0x9555('0x2e')][_0x9555('0x49')](_0x41826d[_0x9555('0x4a')],{})[_0x9555('0x27')](respondWithResult(_0x32aa28,0xc9))[_0x9555('0x43')](handleError(_0x32aa28,null));};exports['update']=function(_0x51d799,_0x395a7b){if(_0x51d799['body']['id']){delete _0x51d799[_0x9555('0x4a')]['id'];}return db[_0x9555('0x2e')][_0x9555('0x48')]({'where':{'id':_0x51d799[_0x9555('0x4b')]['id']}})['then'](handleEntityNotFound(_0x395a7b,null))[_0x9555('0x27')](saveUpdates(_0x51d799[_0x9555('0x4a')],null))[_0x9555('0x27')](respondWithResult(_0x395a7b,null))['catch'](handleError(_0x395a7b,null));};exports['destroy']=function(_0x35271f,_0x316b3d){return db[_0x9555('0x2e')][_0x9555('0x48')]({'where':{'id':_0x35271f['params']['id']}})['then'](handleEntityNotFound(_0x316b3d,null))[_0x9555('0x27')](removeEntity(_0x316b3d,null))[_0x9555('0x43')](handleError(_0x316b3d,null));};exports['describe']=function(_0x56fcb5,_0xd7fa09){return db[_0x9555('0x2e')][_0x9555('0x4c')]()[_0x9555('0x27')](respondWithResult(_0xd7fa09,null))['catch'](handleError(_0xd7fa09,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index b8d1c70..a738cf4 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 _0xe555=['rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','request-promise','path'];(function(_0x5d72cb,_0x5613bf){var _0xd0a100=function(_0x78914a){while(--_0x78914a){_0x5d72cb['push'](_0x5d72cb['shift']());}};_0xd0a100(++_0x5613bf);}(_0xe555,0x158));var _0x5e55=function(_0x16051a,_0x5e4326){_0x16051a=_0x16051a-0x0;var _0x35d20d=_0xe555[_0x16051a];return _0x35d20d;};'use strict';var _=require(_0x5e55('0x0'));var util=require(_0x5e55('0x1'));var logger=require('../../config/logger')(_0x5e55('0x2'));var moment=require(_0x5e55('0x3'));var BPromise=require('bluebird');var rp=require(_0x5e55('0x4'));var fs=require('fs');var path=require(_0x5e55('0x5'));var rimraf=require(_0x5e55('0x6'));var config=require(_0x5e55('0x7'));var attributes=require(_0x5e55('0x8'));module[_0x5e55('0x9')]=function(_0x292965,_0x114bc5){return _0x292965[_0x5e55('0xa')](_0x5e55('0xb'),attributes,{'tableName':_0x5e55('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5e55('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4567=['bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x362b29,_0x23feb5){var _0x569bd1=function(_0x238faf){while(--_0x238faf){_0x362b29['push'](_0x362b29['shift']());}};_0x569bd1(++_0x23feb5);}(_0x4567,0x14e));var _0x7456=function(_0x19ba09,_0x5e69d1){_0x19ba09=_0x19ba09-0x0;var _0xf1ed78=_0x4567[_0x19ba09];return _0xf1ed78;};'use strict';var _=require(_0x7456('0x0'));var util=require(_0x7456('0x1'));var logger=require(_0x7456('0x2'))('api');var moment=require(_0x7456('0x3'));var BPromise=require(_0x7456('0x4'));var rp=require(_0x7456('0x5'));var fs=require('fs');var path=require(_0x7456('0x6'));var rimraf=require(_0x7456('0x7'));var config=require(_0x7456('0x8'));var attributes=require(_0x7456('0x9'));module['exports']=function(_0x75fcb1,_0x831554){return _0x75fcb1[_0x7456('0xa')]('ChatTransferReport',attributes,{'tableName':_0x7456('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7456('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index ff94a80..e198afa 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 _0x772d=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x414a33,_0x5bf179){var _0x1922bd=function(_0xa5ca9c){while(--_0xa5ca9c){_0x414a33['push'](_0x414a33['shift']());}};_0x1922bd(++_0x5bf179);}(_0x772d,0x1a6));var _0xd772=function(_0x58c531,_0x126bc6){_0x58c531=_0x58c531-0x0;var _0xddcc4a=_0x772d[_0x58c531];return _0xddcc4a;};'use strict';var _=require(_0xd772('0x0'));var util=require('util');var moment=require(_0xd772('0x1'));var BPromise=require(_0xd772('0x2'));var rs=require(_0xd772('0x3'));var fs=require('fs');var Redis=require(_0xd772('0x4'));var db=require(_0xd772('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd772('0x6'));var config=require(_0xd772('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd772('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c0fd0,_0xc320ff,_0x103036){return new BPromise(function(_0x4dd6ca,_0x4e4549){return client['request'](_0x5c0fd0,_0x103036)[_0xd772('0x9')](function(_0x2d0386){logger[_0xd772('0xa')](_0xd772('0xb'),_0xc320ff,_0xd772('0xc'));logger['debug'](_0xd772('0xd'),_0xc320ff,_0xd772('0xc'),JSON[_0xd772('0xe')](_0x2d0386));if(_0x2d0386['error']){if(_0x2d0386[_0xd772('0xf')]['code']===0x1f4){logger[_0xd772('0xf')](_0xd772('0xb'),_0xc320ff,_0x2d0386[_0xd772('0xf')]['message']);return _0x4e4549(_0x2d0386[_0xd772('0xf')][_0xd772('0x10')]);}logger[_0xd772('0xf')](_0xd772('0xb'),_0xc320ff,_0x2d0386[_0xd772('0xf')][_0xd772('0x10')]);return _0x4dd6ca(_0x2d0386[_0xd772('0xf')][_0xd772('0x10')]);}else{logger['info'](_0xd772('0xb'),_0xc320ff,_0xd772('0xc'));_0x4dd6ca(_0x2d0386[_0xd772('0x11')][_0xd772('0x10')]);}})[_0xd772('0x12')](function(_0x1732d3){logger['error'](_0xd772('0xb'),_0xc320ff,_0x1732d3);_0x4e4549(_0x1732d3);});});} \ No newline at end of file +var _0x1516=['request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4266b4,_0x4859ad){var _0x1442aa=function(_0x21f8c1){while(--_0x21f8c1){_0x4266b4['push'](_0x4266b4['shift']());}};_0x1442aa(++_0x4859ad);}(_0x1516,0x171));var _0x6151=function(_0x57dd83,_0x3d6715){_0x57dd83=_0x57dd83-0x0;var _0x432877=_0x1516[_0x57dd83];return _0x432877;};'use strict';var _=require('lodash');var util=require(_0x6151('0x0'));var moment=require(_0x6151('0x1'));var BPromise=require(_0x6151('0x2'));var rs=require(_0x6151('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6151('0x4'))['db'];var utils=require(_0x6151('0x5'));var logger=require(_0x6151('0x6'))('rpc');var config=require(_0x6151('0x7'));var jayson=require(_0x6151('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26ea4d,_0x559cbf,_0x4e2bd7){return new BPromise(function(_0x35998d,_0x22969f){return client[_0x6151('0x9')](_0x26ea4d,_0x4e2bd7)[_0x6151('0xa')](function(_0x45cbe9){logger[_0x6151('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x559cbf,_0x6151('0xc'));logger[_0x6151('0xd')](_0x6151('0xe'),_0x559cbf,_0x6151('0xc'),JSON[_0x6151('0xf')](_0x45cbe9));if(_0x45cbe9[_0x6151('0x10')]){if(_0x45cbe9[_0x6151('0x10')][_0x6151('0x11')]===0x1f4){logger[_0x6151('0x10')](_0x6151('0x12'),_0x559cbf,_0x45cbe9[_0x6151('0x10')]['message']);return _0x22969f(_0x45cbe9[_0x6151('0x10')][_0x6151('0x13')]);}logger[_0x6151('0x10')](_0x6151('0x12'),_0x559cbf,_0x45cbe9['error'][_0x6151('0x13')]);return _0x35998d(_0x45cbe9[_0x6151('0x10')]['message']);}else{logger[_0x6151('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x559cbf,_0x6151('0xc'));_0x35998d(_0x45cbe9['result'][_0x6151('0x13')]);}})[_0x6151('0x14')](function(_0x2b398e){logger['error'](_0x6151('0x12'),_0x559cbf,_0x2b398e);_0x22969f(_0x2b398e);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 8b4029d..6d38454 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 _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x263d7d,_0x4fe765){var _0x510b6d=function(_0x5e2f98){while(--_0x5e2f98){_0x263d7d['push'](_0x263d7d['shift']());}};_0x510b6d(++_0x4fe765);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xb7e7[_0x3ab9ee];return _0x82ee88;};'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('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file +var _0x2032=['describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x578b28,_0x1525f8){var _0x105756=function(_0x46b984){while(--_0x46b984){_0x578b28['push'](_0x578b28['shift']());}};_0x105756(++_0x1525f8);}(_0x2032,0xd9));var _0x2203=function(_0xde19b5,_0x3730ad){_0xde19b5=_0xde19b5-0x0;var _0x541ea6=_0x2032[_0xde19b5];return _0x541ea6;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0x7')](_0x2203('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller[_0x2203('0xe')]);router[_0x2203('0xf')](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router['delete'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);module[_0x2203('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index b91e05e..075e8b2 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 _0x4a25=['ENUM','star','thumb','TEXT','stringify','input','text','name','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x4a25,0x1d4));var _0x54a2=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x4a25[_0x81dcac];return _0xc7803b;};'use strict';var Sequelize=require(_0x54a2('0x0'));var rs=require('randomstring');module[_0x54a2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x54a2('0x2')],'allowNull':![],'unique':_0x54a2('0x3')},'description':{'type':Sequelize[_0x54a2('0x2')]},'mapKey':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x4')},'key':{'type':Sequelize[_0x54a2('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x54a2('0x2')],'allowNull':![],'defaultValue':_0x54a2('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x54a2('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x54a2('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x54a2('0x2')]},'animation':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x54a2('0x9'),_0x54a2('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x54a2('0xc')},'offline_chat_button':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0xd')},'header_offline':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0xe')},'download_transcript':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x54a2('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x12')},'noteTitle':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x13')},'placeholderMessage':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x14')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x54a2('0xd')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x15')},'ratingType':{'type':Sequelize[_0x54a2('0x16')](_0x54a2('0x17'),_0x54a2('0x18')),'defaultValue':_0x54a2('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x54a2('0x19')],'defaultValue':function(){return JSON[_0x54a2('0x1a')]({'items':[{'type':_0x54a2('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0x54a2('0x1c'),'required':!![]},'props':{'title':_0x54a2('0x1d'),'helpText':''}},{'type':'input','props':{'title':_0x54a2('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x54a2('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x54a2('0x1e')](_0x54a2('0x1f'))?JSON[_0x54a2('0x20')](this[_0x54a2('0x1e')](_0x54a2('0x1f'))):{};},'set':function(_0x3bedac){return this['setDataValue'](_0x54a2('0x1f'),JSON[_0x54a2('0x1a')](_0x3bedac));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x54a2('0x1a')]({'items':[{'type':_0x54a2('0x1b'),'props':{'title':_0x54a2('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x54a2('0x4'),'type':_0x54a2('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x54a2('0x21')},'props':{'title':_0x54a2('0x21'),'helpText':_0x54a2('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x54a2('0x1e')](_0x54a2('0x23'))?JSON[_0x54a2('0x20')](this[_0x54a2('0x1e')](_0x54a2('0x23'))):{};},'set':function(_0x17ba86){return this['setDataValue'](_0x54a2('0x23'),JSON['stringify'](_0x17ba86));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x54a2('0x24')]();}},'autoclose':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x54a2('0x2')]},'forwardOffline':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x54a2('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x54a2('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x26')},'offlineMessageBody':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x28')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x54a2('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x54a2('0x19')]},'showAgentAvatar':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x54a2('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x54a2('0x29');}},'notificationSound':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x54a2('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x54a2('0x2')]},'customerAvatar':{'type':Sequelize[_0x54a2('0x19')]},'showCustomerAvatar':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x54a2('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x54a2('0x2')],'allowNull':![],'defaultValue':_0x54a2('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x54a2('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x2c')},'systemAvatar':{'type':Sequelize[_0x54a2('0x19')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x54a2('0xf')],'comment':_0x54a2('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![],'comment':_0x54a2('0x2e'),'set':function(_0x39e4c8){if(!_0x39e4c8)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x54a2('0x2f')](_0x54a2('0x30'),_0x39e4c8);}},'vidaooEscalation':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0ab2=['Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','website_alias','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','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','Chat','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','TEXT','name','text','input','getDataValue','onlineForm','parse','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'];(function(_0x2c3fe0,_0x318d85){var _0x1c2f98=function(_0xb3e37){while(--_0xb3e37){_0x2c3fe0['push'](_0x2c3fe0['shift']());}};_0x1c2f98(++_0x318d85);}(_0x0ab2,0x9a));var _0x20ab=function(_0x4a002e,_0x14a5f6){_0x4a002e=_0x4a002e-0x0;var _0xb86ae3=_0x0ab2[_0x4a002e];return _0xb86ae3;};'use strict';var Sequelize=require(_0x20ab('0x0'));var rs=require(_0x20ab('0x1'));module[_0x20ab('0x2')]={'name':{'type':Sequelize[_0x20ab('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x20ab('0x3')],'allowNull':![],'unique':_0x20ab('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x20ab('0x5')},'mapKeyOffline':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x5')},'key':{'type':Sequelize[_0x20ab('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x6')},'customerAlias':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x20ab('0x3')],'allowNull':![],'defaultValue':_0x20ab('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x20ab('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x20ab('0x3')],'allowNull':![],'defaultValue':_0x20ab('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x20ab('0x3')]},'animation':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x20ab('0xa')](_0x20ab('0xb'),_0x20ab('0xc')),'defaultValue':_0x20ab('0xb')},'header_online':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x20ab('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x11')},'noteTitle':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x12')},'closingMessage':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x13')},'closingMessageButton':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x14')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x20ab('0x15')},'conditionAgreement':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x16')},'ratingType':{'type':Sequelize[_0x20ab('0xa')](_0x20ab('0x17'),_0x20ab('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x20ab('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x20ab('0x19')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x20ab('0x1a'),'type':_0x20ab('0x1b'),'required':!![]},'props':{'title':_0x20ab('0x1a'),'helpText':''}},{'type':_0x20ab('0x1c'),'props':{'title':_0x20ab('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x20ab('0x5'),'type':_0x20ab('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x20ab('0x1d')](_0x20ab('0x1e'))?JSON[_0x20ab('0x1f')](this[_0x20ab('0x1d')](_0x20ab('0x1e'))):{};},'set':function(_0x3f6ba8){return this[_0x20ab('0x20')](_0x20ab('0x1e'),JSON[_0x20ab('0x21')](_0x3f6ba8));}},'offlineForm':{'type':Sequelize[_0x20ab('0x19')],'defaultValue':function(){return JSON[_0x20ab('0x21')]({'items':[{'type':_0x20ab('0x1c'),'props':{'title':_0x20ab('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x20ab('0x5'),'type':_0x20ab('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':_0x20ab('0x22')},'props':{'title':_0x20ab('0x22'),'helpText':_0x20ab('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x20ab('0x1d')](_0x20ab('0x24'))?JSON[_0x20ab('0x1f')](this['getDataValue'](_0x20ab('0x24'))):{};},'set':function(_0x499142){return this[_0x20ab('0x20')](_0x20ab('0x24'),JSON['stringify'](_0x499142));}},'token':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x20ab('0x3')]},'forwardOffline':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x20ab('0x3')]},'waitingTitle':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x25')},'waitingMessage':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x27')},'offlineMessageBody':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x15')},'sendUnmanaged':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x14')},'enableCustomerAttachment':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x20ab('0x3')]},'notificationTemplate':{'type':Sequelize[_0x20ab('0x19')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x28')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x20ab('0xe')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x29')},'defaultTitle':{'type':Sequelize[_0x20ab('0x3')]},'customerAvatar':{'type':Sequelize[_0x20ab('0x19')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x20ab('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x20ab('0x3')],'allowNull':![],'defaultValue':_0x20ab('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x20ab('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':_0x20ab('0x2b')},'systemAvatar':{'type':Sequelize[_0x20ab('0x19')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x20ab('0xe')],'comment':_0x20ab('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':![],'comment':_0x20ab('0x2d'),'set':function(_0x275c9e){if(!_0x275c9e)this[_0x20ab('0x20')](_0x20ab('0x2e'),null);this['setDataValue'](_0x20ab('0x2f'),_0x275c9e);}},'vidaooEscalation':{'type':Sequelize[_0x20ab('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x20ab('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index d27ad4b..58295be 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 _0xac3a=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','ChatWebsiteId','Disposition','getDispositions','findOne','length','removeDispositions','ids','CannedAnswer','hasOwnProperty','pick','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','custom','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','updatedAt','difference','CompanyId','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','from','CmList','List','DESC','ChatApplication','Applications','applications','list','orderBy','asc','account','Contacts','contact','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','device','vendor','stringify','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','no\x20available\x20attributes','createdAt','ListId','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','MailAccount','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','getInteractions','Owner','fullname','internal','tag','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','getLicense','virtual','increment','chatLicenseExceeded','all','some','readFileSync','server/files/chat/iframe.js','utf8','remote','x-forwarded-for','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','color','textColor','bulkCreate','findAndCountAll','getApplications','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','html-pdf','eml-format','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','get','ChatWebsites','UserProfileResource','destroy','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','limit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac3a,0x1e0));var _0xaac3=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0xac3a[_0x1627ae];return _0x34b38f;};'use strict';var pdf=require(_0xaac3('0x0'));var emlformat=require(_0xaac3('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaac3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xaac3('0x3'));var util=require(_0xaac3('0x4'));var path=require(_0xaac3('0x5'));var sox=require('sox');var csv=require(_0xaac3('0x6'));var ejs=require(_0xaac3('0x7'));var fs=require('fs');var _=require(_0xaac3('0x8'));var squel=require(_0xaac3('0x9'));var crypto=require(_0xaac3('0xa'));var jsforce=require(_0xaac3('0xb'));var deskjs=require(_0xaac3('0xc'));var toCsv=require(_0xaac3('0x6'));var querystring=require(_0xaac3('0xd'));var Papa=require(_0xaac3('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac3('0xf'));var hardwareService=require(_0xaac3('0x10'));var logger=require(_0xaac3('0x11'))('api');var utils=require(_0xaac3('0x12'));var config=require(_0xaac3('0x13'));var licenseUtil=require(_0xaac3('0x14'));var db=require(_0xaac3('0x15'))['db'];config[_0xaac3('0x16')]=_[_0xaac3('0x17')](config[_0xaac3('0x16')],{'host':_0xaac3('0x18'),'port':0x18eb});var socket=require(_0xaac3('0x19'))(new Redis(config[_0xaac3('0x16')]));require(_0xaac3('0x1a'))[_0xaac3('0x1b')](socket);var jayson=require(_0xaac3('0x1c'));var client=jayson[_0xaac3('0x1d')][_0xaac3('0x1e')]({'port':0x232c});var client9002=jayson[_0xaac3('0x1d')][_0xaac3('0x1e')]({'port':0x232a});var client9003=jayson[_0xaac3('0x1d')][_0xaac3('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x22ea8c,_0x2d73cb,_0x17b70a,_0x276735){return new BPromise(function(_0x356f14,_0x1e0112){var _0x34fee4=_0x276735||client;return _0x34fee4['request'](_0x22ea8c,_0x17b70a)['then'](function(_0xf595ff){logger['info'](_0xaac3('0x1f'),_0x2d73cb,_0xaac3('0x20'));logger[_0xaac3('0x21')](_0xaac3('0x22'),_0x2d73cb,_0xaac3('0x20'),JSON['stringify'](_0xf595ff));if(_0xf595ff[_0xaac3('0x23')]){if(_0xf595ff['error'][_0xaac3('0x24')]===0x1f4){logger[_0xaac3('0x23')](_0xaac3('0x1f'),_0x2d73cb,_0xf595ff[_0xaac3('0x23')][_0xaac3('0x25')]);return _0x1e0112(_0xf595ff[_0xaac3('0x23')]['message']);}logger[_0xaac3('0x23')](_0xaac3('0x1f'),_0x2d73cb,_0xf595ff[_0xaac3('0x23')][_0xaac3('0x25')]);return _0x356f14(_0xf595ff[_0xaac3('0x23')]['message']);}else{logger[_0xaac3('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x2d73cb,'request\x20sent');_0x356f14(_0xf595ff[_0xaac3('0x27')]['message']);}})['catch'](function(_0x5ce187){logger[_0xaac3('0x23')](_0xaac3('0x1f'),_0x2d73cb,_0x5ce187);_0x1e0112(_0x5ce187);});});}function respondWithStatusCode(_0x372fa5,_0x84fca0){_0x84fca0=_0x84fca0||0xcc;return function(_0x20d22d){if(_0x20d22d){return _0x372fa5[_0xaac3('0x28')](_0x84fca0);}return _0x372fa5[_0xaac3('0x29')](_0x84fca0)[_0xaac3('0x2a')]();};}function respondWithResult(_0x232fa1,_0x50988c){_0x50988c=_0x50988c||0xc8;return function(_0x3fd7d0){if(_0x3fd7d0){return _0x232fa1[_0xaac3('0x29')](_0x50988c)[_0xaac3('0x2b')](_0x3fd7d0);}};}function respondWithFilteredResult(_0x381ca4,_0xe438c8){return function(_0x6d5646){if(_0x6d5646){var _0x217a12=_0x6d5646[_0xaac3('0x2c')],_0x54ac88=_0xe438c8['offset'],_0x24502a=_0xe438c8[_0xaac3('0x2d')]+_0xe438c8['limit'],_0x5ad10b;if(_0x24502a>=_0x217a12){_0x24502a=_0x217a12;_0x5ad10b=0xc8;}else{_0x5ad10b=0xce;}_0x381ca4[_0xaac3('0x29')](_0x5ad10b);return _0x381ca4[_0xaac3('0x2e')](_0xaac3('0x2f'),_0x54ac88+'-'+_0x24502a+'/'+_0x217a12)['json'](_0x6d5646);}return null;};}function patchUpdates(_0x3894d9){return function(_0x2a5b07){try{jsonpatch[_0xaac3('0x30')](_0x2a5b07,_0x3894d9,!![]);}catch(_0x31d1f5){return BPromise[_0xaac3('0x31')](_0x31d1f5);}return _0x2a5b07[_0xaac3('0x32')]();};}function saveUpdates(_0x593f1a,_0x2020d5){return function(_0xd50ed8){if(_0xd50ed8){return _0xd50ed8['update'](_0x593f1a)[_0xaac3('0x33')](function(_0x143388){return _0x143388;});}return null;};}function removeEntity(_0x3b2ac1,_0x2f4b33){return function(_0x5904a6){if(_0x5904a6){return _0x5904a6['destroy']()[_0xaac3('0x33')](function(){var _0x5dce26=_0x5904a6[_0xaac3('0x34')]({'plain':!![]});var _0xb42b5b=_0xaac3('0x35');return db[_0xaac3('0x36')][_0xaac3('0x37')]({'where':{'type':_0xb42b5b,'resourceId':_0x5dce26['id']}})[_0xaac3('0x33')](function(){return _0x5904a6;});})[_0xaac3('0x33')](function(){_0x3b2ac1[_0xaac3('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fcc4e,_0x36f0d8){return function(_0xa6de4f){if(!_0xa6de4f){_0x3fcc4e[_0xaac3('0x28')](0x194);}return _0xa6de4f;};}function handleError(_0x535434,_0x5cdfa9){_0x5cdfa9=_0x5cdfa9||0x1f4;return function(_0x402463){logger[_0xaac3('0x23')](_0x402463['stack']);if(_0x402463[_0xaac3('0x38')]){delete _0x402463[_0xaac3('0x38')];}_0x535434['status'](_0x5cdfa9)[_0xaac3('0x39')](_0x402463);};}exports[_0xaac3('0x3a')]=function(_0x3e5bcf,_0xbaa9f4){var _0x2cd260={'include':[{'model':db[_0xaac3('0x3b')],'as':_0xaac3('0x3c')}]},_0x9711de={},_0x5245f8={'count':0x0,'rows':[]};var _0x25fd67=_[_0xaac3('0x3d')](db[_0xaac3('0x3e')][_0xaac3('0x3f')],function(_0x188dd6){return{'name':_0x188dd6[_0xaac3('0x40')],'type':_0x188dd6[_0xaac3('0x41')][_0xaac3('0x42')]};});_0x9711de['model']=_['map'](_0x25fd67,'name');_0x9711de[_0xaac3('0x43')]=_[_0xaac3('0x44')](_0x3e5bcf[_0xaac3('0x43')]);_0x9711de[_0xaac3('0x45')]=_[_0xaac3('0x46')](_0x9711de[_0xaac3('0x47')],_0x9711de['query']);_0x2cd260['attributes']=_['intersection'](_0x9711de['model'],qs['fields'](_0x3e5bcf[_0xaac3('0x43')][_0xaac3('0x48')]));_0x2cd260[_0xaac3('0x49')]=_0x2cd260[_0xaac3('0x49')]['length']?_0x2cd260['attributes']:_0x9711de[_0xaac3('0x47')];if(!_0x3e5bcf['query']['hasOwnProperty'](_0xaac3('0x4a'))){_0x2cd260['limit']=qs[_0xaac3('0x4b')](_0x3e5bcf[_0xaac3('0x43')][_0xaac3('0x4b')]);_0x2cd260[_0xaac3('0x2d')]=qs[_0xaac3('0x2d')](_0x3e5bcf[_0xaac3('0x43')][_0xaac3('0x2d')]);}_0x2cd260[_0xaac3('0x4c')]=qs[_0xaac3('0x4d')](_0x3e5bcf[_0xaac3('0x43')][_0xaac3('0x4d')]);_0x2cd260['where']=qs[_0xaac3('0x45')](_['pick'](_0x3e5bcf[_0xaac3('0x43')],_0x9711de[_0xaac3('0x45')]),_0x25fd67);if(_0x3e5bcf[_0xaac3('0x43')][_0xaac3('0x4e')]){_0x2cd260[_0xaac3('0x4f')]=_[_0xaac3('0x50')](_0x2cd260[_0xaac3('0x4f')],{'$or':_[_0xaac3('0x3d')](_0x25fd67,function(_0x5cbb72){if(_0x5cbb72[_0xaac3('0x41')]!=='VIRTUAL'){var _0x443ec3={};_0x443ec3[_0x5cbb72[_0xaac3('0x38')]]={'$like':'%'+_0x3e5bcf[_0xaac3('0x43')][_0xaac3('0x4e')]+'%'};return _0x443ec3;}})});}_0x2cd260=_[_0xaac3('0x50')]({},_0x2cd260,_0x3e5bcf[_0xaac3('0x51')]);var _0x27b530={'where':_0x2cd260['where']};return db[_0xaac3('0x3e')][_0xaac3('0x2c')](_0x27b530)['then'](function(_0x203b32){_0x5245f8[_0xaac3('0x2c')]=_0x203b32;if(_0x3e5bcf['query'][_0xaac3('0x52')]){_0x2cd260[_0xaac3('0x53')]=[{'all':!![]}];}return db[_0xaac3('0x3e')][_0xaac3('0x54')](_0x2cd260);})[_0xaac3('0x33')](function(_0x29f481){_0x5245f8[_0xaac3('0x55')]=_0x29f481;return _0x5245f8;})[_0xaac3('0x33')](respondWithFilteredResult(_0xbaa9f4,_0x2cd260))['catch'](handleError(_0xbaa9f4,null));};exports[_0xaac3('0x56')]=function(_0x335f04,_0x47765c){var _0x224865={'raw':![],'where':{'id':_0x335f04[_0xaac3('0x57')]['id']},'include':[{'model':db[_0xaac3('0x3b')],'as':_0xaac3('0x3c')}]},_0x207b41={};_0x207b41[_0xaac3('0x47')]=_[_0xaac3('0x44')](db['ChatWebsite'][_0xaac3('0x3f')]);_0x207b41[_0xaac3('0x43')]=_[_0xaac3('0x44')](_0x335f04[_0xaac3('0x43')]);_0x207b41[_0xaac3('0x45')]=_['intersection'](_0x207b41[_0xaac3('0x47')],_0x207b41[_0xaac3('0x43')]);_0x224865[_0xaac3('0x49')]=_['intersection'](_0x207b41[_0xaac3('0x47')],qs[_0xaac3('0x48')](_0x335f04[_0xaac3('0x43')][_0xaac3('0x48')]));_0x224865[_0xaac3('0x49')]=_0x224865[_0xaac3('0x49')]['length']?_0x224865['attributes']:_0x207b41['model'];if(_0x335f04[_0xaac3('0x43')][_0xaac3('0x52')]){_0x224865[_0xaac3('0x53')]=[{'all':!![]}];}_0x224865=_[_0xaac3('0x50')]({},_0x224865,_0x335f04[_0xaac3('0x51')]);return db[_0xaac3('0x3e')][_0xaac3('0x58')](_0x224865)['then'](handleEntityNotFound(_0x47765c,null))[_0xaac3('0x33')](respondWithResult(_0x47765c,null))[_0xaac3('0x59')](handleError(_0x47765c,null));};exports[_0xaac3('0x5a')]=function(_0x49caef,_0xda323){return db[_0xaac3('0x3e')]['create'](_0x49caef['body'],{})[_0xaac3('0x33')](function(_0x2a7244){var _0x347db7=_0x49caef['user'][_0xaac3('0x34')]({'plain':!![]});if(!_0x347db7)throw new Error(_0xaac3('0x5b'));if(_0x347db7[_0xaac3('0x5c')]===_0xaac3('0x5d')){var _0x179a2d=_0x2a7244[_0xaac3('0x34')]({'plain':!![]});var _0x28e618=_0xaac3('0x35');return db[_0xaac3('0x5e')][_0xaac3('0x58')]({'where':{'name':_0x28e618,'userProfileId':_0x347db7['userProfileId']},'raw':!![]})[_0xaac3('0x33')](function(_0x42e43e){if(_0x42e43e&&_0x42e43e[_0xaac3('0x5f')]===0x0){return db[_0xaac3('0x36')][_0xaac3('0x5a')]({'name':_0x179a2d['name'],'resourceId':_0x179a2d['id'],'type':_0x42e43e[_0xaac3('0x38')],'sectionId':_0x42e43e['id']},{})[_0xaac3('0x33')](function(){return _0x2a7244;});}else{return _0x2a7244;}})[_0xaac3('0x59')](function(_0x5e7208){logger[_0xaac3('0x23')](_0xaac3('0x60'),_0x5e7208);throw _0x5e7208;});}return _0x2a7244;})[_0xaac3('0x33')](respondWithResult(_0xda323,0xc9))[_0xaac3('0x59')](handleError(_0xda323,null));};exports[_0xaac3('0x61')]=function(_0x523f04,_0xc712bd){if(_0x523f04['body']['id']){delete _0x523f04[_0xaac3('0x62')]['id'];}return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x523f04[_0xaac3('0x57')]['id']},'include':[{'model':db[_0xaac3('0x3b')],'as':_0xaac3('0x3c')}]})[_0xaac3('0x33')](handleEntityNotFound(_0xc712bd,null))['then'](saveUpdates(_0x523f04[_0xaac3('0x62')],null))[_0xaac3('0x33')](respondWithResult(_0xc712bd,null))[_0xaac3('0x59')](handleError(_0xc712bd,null));};exports[_0xaac3('0x37')]=function(_0x422aba,_0x2dd934){return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x422aba[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x2dd934,null))[_0xaac3('0x33')](removeEntity(_0x2dd934,null))[_0xaac3('0x59')](handleError(_0x2dd934,null));};exports[_0xaac3('0x63')]=function(_0x151ea5,_0x368cd4){return db[_0xaac3('0x3e')][_0xaac3('0x63')]()[_0xaac3('0x33')](respondWithResult(_0x368cd4,null))[_0xaac3('0x59')](handleError(_0x368cd4,null));};exports['addDisposition']=function(_0x40370c,_0x196f3d,_0x3a93c3){if(_0x40370c[_0xaac3('0x62')]['id']){delete _0x40370c[_0xaac3('0x62')]['id'];}return db['ChatWebsite'][_0xaac3('0x58')]({'where':{'id':_0x40370c[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x196f3d,null))[_0xaac3('0x33')](function(_0x23fdaf){if(_0x23fdaf){_0x40370c[_0xaac3('0x62')][_0xaac3('0x64')]=_0x23fdaf['id'];return db[_0xaac3('0x65')][_0xaac3('0x5a')](_0x40370c[_0xaac3('0x62')]);}})['then'](respondWithResult(_0x196f3d,null))[_0xaac3('0x59')](handleError(_0x196f3d,null));};exports[_0xaac3('0x66')]=function(_0x54ad73,_0x351157,_0x20ca1e){var _0x296e85={'raw':![],'where':{}};var _0x17714a={};var _0x57f72e={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xaac3('0x67')]({'where':{'id':_0x54ad73['params']['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x351157,null))['then'](function(_0x57f8a4){if(_0x57f8a4){_0x17714a[_0xaac3('0x47')]=_[_0xaac3('0x44')](db[_0xaac3('0x65')][_0xaac3('0x3f')]);_0x17714a['query']=_[_0xaac3('0x44')](_0x54ad73['query']);_0x17714a[_0xaac3('0x45')]=_['intersection'](_0x17714a[_0xaac3('0x47')],_0x17714a['query']);_0x296e85[_0xaac3('0x49')]=_[_0xaac3('0x46')](_0x17714a[_0xaac3('0x47')],qs[_0xaac3('0x48')](_0x54ad73['query'][_0xaac3('0x48')]));_0x296e85['attributes']=_0x296e85[_0xaac3('0x49')][_0xaac3('0x68')]?_0x296e85[_0xaac3('0x49')]:_0x17714a[_0xaac3('0x47')];if(!_0x54ad73[_0xaac3('0x43')]['hasOwnProperty'](_0xaac3('0x4a'))){_0x296e85[_0xaac3('0x4b')]=qs['limit'](_0x54ad73['query'][_0xaac3('0x4b')]);_0x296e85['offset']=qs['offset'](_0x54ad73[_0xaac3('0x43')][_0xaac3('0x2d')]);}_0x296e85['order']=qs['sort'](_0x54ad73[_0xaac3('0x43')][_0xaac3('0x4d')]);_0x296e85[_0xaac3('0x4f')]=qs[_0xaac3('0x45')](_['pick'](_0x54ad73['query'],_0x17714a[_0xaac3('0x45')]));_0x296e85[_0xaac3('0x4f')][_0xaac3('0x64')]=_0x57f8a4['id'];if(_0x54ad73['query']['filter']){_0x296e85[_0xaac3('0x4f')]=_[_0xaac3('0x50')](_0x296e85[_0xaac3('0x4f')],{'$or':_['map'](_0x296e85[_0xaac3('0x49')],function(_0x31af19){var _0x47d47e={};_0x47d47e[_0x31af19]={'$like':'%'+_0x54ad73[_0xaac3('0x43')][_0xaac3('0x4e')]+'%'};return _0x47d47e;})});}_0x296e85=_[_0xaac3('0x50')]({},_0x296e85,_0x54ad73['options']);return db[_0xaac3('0x65')][_0xaac3('0x2c')]({'where':_0x296e85['where']})['then'](function(_0x50f41e){_0x57f72e['count']=_0x50f41e;if(_0x54ad73[_0xaac3('0x43')][_0xaac3('0x52')]){_0x296e85['include']=[{'all':!![]}];}return db[_0xaac3('0x65')][_0xaac3('0x54')](_0x296e85);})[_0xaac3('0x33')](function(_0x1fb303){_0x57f72e[_0xaac3('0x55')]=_0x1fb303;return _0x57f72e;});}})['then'](respondWithFilteredResult(_0x351157,_0x296e85))[_0xaac3('0x59')](handleError(_0x351157,null));};exports[_0xaac3('0x69')]=function(_0x2eb1f8,_0x50731f,_0x59be20){return db[_0xaac3('0x3e')]['find']({'where':{'id':_0x2eb1f8['params']['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x50731f,null))['then'](function(_0x3163fd){if(_0x3163fd){return _0x3163fd['removeDispositions'](_0x2eb1f8[_0xaac3('0x43')][_0xaac3('0x6a')]);}})[_0xaac3('0x33')](respondWithStatusCode(_0x50731f,null))['catch'](handleError(_0x50731f,null));};exports['addAnswer']=function(_0xffb3be,_0x134bee,_0x1e0d7e){if(_0xffb3be[_0xaac3('0x62')]['id']){delete _0xffb3be[_0xaac3('0x62')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0xffb3be[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x134bee,null))[_0xaac3('0x33')](function(_0x4635d4){if(_0x4635d4){_0xffb3be[_0xaac3('0x62')][_0xaac3('0x64')]=_0x4635d4['id'];return db['CannedAnswer'][_0xaac3('0x5a')](_0xffb3be[_0xaac3('0x62')]);}})[_0xaac3('0x33')](respondWithResult(_0x134bee,null))[_0xaac3('0x59')](handleError(_0x134bee,null));};exports['getAnswers']=function(_0xe8e156,_0x2b85d3,_0x2b5f05){var _0x557c76={'raw':![],'where':{}};var _0x3621be={};var _0x5c4a31={'count':0x0,'rows':[]};return db[_0xaac3('0x3e')][_0xaac3('0x67')]({'where':{'id':_0xe8e156[_0xaac3('0x57')]['id']}})['then'](handleEntityNotFound(_0x2b85d3,null))[_0xaac3('0x33')](function(_0x15f147){if(_0x15f147){_0x3621be[_0xaac3('0x47')]=_[_0xaac3('0x44')](db[_0xaac3('0x6b')][_0xaac3('0x3f')]);_0x3621be[_0xaac3('0x43')]=_['keys'](_0xe8e156[_0xaac3('0x43')]);_0x3621be[_0xaac3('0x45')]=_[_0xaac3('0x46')](_0x3621be[_0xaac3('0x47')],_0x3621be['query']);_0x557c76[_0xaac3('0x49')]=_[_0xaac3('0x46')](_0x3621be[_0xaac3('0x47')],qs[_0xaac3('0x48')](_0xe8e156[_0xaac3('0x43')][_0xaac3('0x48')]));_0x557c76['attributes']=_0x557c76['attributes']['length']?_0x557c76[_0xaac3('0x49')]:_0x3621be[_0xaac3('0x47')];if(!_0xe8e156[_0xaac3('0x43')][_0xaac3('0x6c')](_0xaac3('0x4a'))){_0x557c76[_0xaac3('0x4b')]=qs['limit'](_0xe8e156[_0xaac3('0x43')][_0xaac3('0x4b')]);_0x557c76[_0xaac3('0x2d')]=qs[_0xaac3('0x2d')](_0xe8e156[_0xaac3('0x43')]['offset']);}_0x557c76[_0xaac3('0x4c')]=qs[_0xaac3('0x4d')](_0xe8e156[_0xaac3('0x43')][_0xaac3('0x4d')]);_0x557c76['where']=qs[_0xaac3('0x45')](_[_0xaac3('0x6d')](_0xe8e156[_0xaac3('0x43')],_0x3621be[_0xaac3('0x45')]));_0x557c76[_0xaac3('0x4f')]['ChatWebsiteId']=_0x15f147['id'];if(_0xe8e156['query'][_0xaac3('0x4e')]){_0x557c76[_0xaac3('0x4f')]=_['merge'](_0x557c76[_0xaac3('0x4f')],{'$or':_[_0xaac3('0x3d')](_0x557c76['attributes'],function(_0x1b9da6){var _0x5789e8={};_0x5789e8[_0x1b9da6]={'$like':'%'+_0xe8e156[_0xaac3('0x43')][_0xaac3('0x4e')]+'%'};return _0x5789e8;})});}_0x557c76=_[_0xaac3('0x50')]({},_0x557c76,_0xe8e156[_0xaac3('0x51')]);return db['CannedAnswer']['count']({'where':_0x557c76[_0xaac3('0x4f')]})[_0xaac3('0x33')](function(_0x545e82){_0x5c4a31[_0xaac3('0x2c')]=_0x545e82;if(_0xe8e156['query'][_0xaac3('0x52')]){_0x557c76['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xaac3('0x54')](_0x557c76);})['then'](function(_0xc5bb4){_0x5c4a31[_0xaac3('0x55')]=_0xc5bb4;return _0x5c4a31;});}})[_0xaac3('0x33')](respondWithFilteredResult(_0x2b85d3,_0x557c76))[_0xaac3('0x59')](handleError(_0x2b85d3,null));};exports['removeAnswers']=function(_0xf069f0,_0x508fde,_0x988ac0){return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0xf069f0[_0xaac3('0x57')]['id']}})['then'](handleEntityNotFound(_0x508fde,null))[_0xaac3('0x33')](function(_0x3f04e8){if(_0x3f04e8){return _0x3f04e8[_0xaac3('0x6e')](_0xf069f0[_0xaac3('0x43')][_0xaac3('0x6a')]);}})[_0xaac3('0x33')](respondWithStatusCode(_0x508fde,null))[_0xaac3('0x59')](handleError(_0x508fde,null));};exports[_0xaac3('0x6f')]=function(_0x36e987,_0x79fc06,_0x1b794a){_0x36e987['body'][_0xaac3('0x70')]=_0x36e987[_0xaac3('0x71')][_0xaac3('0x72')];return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x36e987[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x79fc06,null))[_0xaac3('0x33')](saveUpdates(_0x36e987[_0xaac3('0x62')],null))[_0xaac3('0x33')](respondWithResult(_0x79fc06,null))[_0xaac3('0x59')](handleError(_0x79fc06,null));};exports[_0xaac3('0x73')]=function(_0xc41e19,_0x103633,_0x15dedc){_0xc41e19['body'][_0xaac3('0x74')]=_0xc41e19['file'][_0xaac3('0x72')];return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0xc41e19['params']['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x103633,null))[_0xaac3('0x33')](saveUpdates(_0xc41e19[_0xaac3('0x62')],null))[_0xaac3('0x33')](respondWithResult(_0x103633,null))['catch'](handleError(_0x103633,null));};exports[_0xaac3('0x75')]=function(_0x418066,_0x3ffee1,_0x37d8f8){_0x418066[_0xaac3('0x62')]['customerAvatar']=_0x418066[_0xaac3('0x71')][_0xaac3('0x72')];return db[_0xaac3('0x3e')]['find']({'where':{'id':_0x418066['params']['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x3ffee1,null))[_0xaac3('0x33')](saveUpdates(_0x418066['body'],null))['then'](respondWithResult(_0x3ffee1,null))[_0xaac3('0x59')](handleError(_0x3ffee1,null));};exports[_0xaac3('0x76')]=function(_0x188ca6,_0x11889b,_0x5a239d){_0x188ca6[_0xaac3('0x62')][_0xaac3('0x77')]=_0x188ca6[_0xaac3('0x71')][_0xaac3('0x72')];return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x188ca6[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x11889b,null))[_0xaac3('0x33')](saveUpdates(_0x188ca6[_0xaac3('0x62')],null))[_0xaac3('0x33')](respondWithResult(_0x11889b,null))[_0xaac3('0x59')](handleError(_0x11889b,null));};exports[_0xaac3('0x78')]=function(_0x4e3527,_0x4143d9,_0x1d2a99){var _0x2ed74f=path[_0xaac3('0x79')](config[_0xaac3('0x7a')],'server/files/images/logos/default_logo.svg');var _0x1c84be={'where':{'id':_0x4e3527[_0xaac3('0x57')]['id']},'attributes':['id',_0xaac3('0x70')],'raw':!![]};var _0x2d26f8=![];return require(_0xaac3('0x14'))['getLicense']()[_0xaac3('0x33')](function(_0x4022b7){if(_0x4022b7){_0x2d26f8=_0x4022b7[_0xaac3('0x7b')];}})[_0xaac3('0x33')](function(){return db[_0xaac3('0x3e')]['find'](_0x1c84be);})[_0xaac3('0x33')](handleEntityNotFound(_0x4143d9,null))[_0xaac3('0x33')](function(_0x1d62d0){if(_0x1d62d0){if(!_['isNil'](_0x1d62d0[_0xaac3('0x70')])){if(fs[_0xaac3('0x7c')](path[_0xaac3('0x79')](config['root'],_0xaac3('0x7d'),_0x1d62d0[_0xaac3('0x70')]))&&_0x2d26f8){_0x2ed74f=path[_0xaac3('0x79')](config['root'],_0xaac3('0x7d'),_0x1d62d0[_0xaac3('0x70')]);}}return _0x4143d9['download'](_0x2ed74f);}})[_0xaac3('0x59')](handleError(_0x4143d9,null));};exports[_0xaac3('0x7e')]=function(_0x5293eb,_0x43b197,_0x6db209){var _0x1a0c3a=path[_0xaac3('0x79')](config[_0xaac3('0x7a')],_0xaac3('0x7f'));var _0x53136f={'where':{'id':_0x5293eb[_0xaac3('0x57')]['id']},'attributes':['id',_0xaac3('0x74')],'raw':!![]};return db[_0xaac3('0x3e')][_0xaac3('0x58')](_0x53136f)[_0xaac3('0x33')](handleEntityNotFound(_0x43b197,null))[_0xaac3('0x33')](function(_0x1b6f3d){if(_0x1b6f3d){if(!_[_0xaac3('0x80')](_0x1b6f3d['agentAvatar'])){if(fs[_0xaac3('0x7c')](path[_0xaac3('0x79')](config['root'],_0xaac3('0x81'),_0x1b6f3d[_0xaac3('0x74')]))){_0x1a0c3a=path[_0xaac3('0x79')](config[_0xaac3('0x7a')],_0xaac3('0x81'),_0x1b6f3d[_0xaac3('0x74')]);}}return _0x43b197['download'](_0x1a0c3a);}})[_0xaac3('0x59')](handleError(_0x43b197,null));};exports['getCustomerAvatar']=function(_0x3a04fa,_0x219aa3,_0x4a1c5c){var _0x21671a=path[_0xaac3('0x79')](config[_0xaac3('0x7a')],_0xaac3('0x82'));var _0x1d34f9={'where':{'id':_0x3a04fa[_0xaac3('0x57')]['id']},'attributes':['id',_0xaac3('0x83'),_0xaac3('0x84')],'raw':!![]};return db[_0xaac3('0x3e')][_0xaac3('0x58')](_0x1d34f9)['then'](handleEntityNotFound(_0x219aa3,null))['then'](function(_0x4fe484){if(_0x4fe484){if(!_['isNil'](_0x4fe484[_0xaac3('0x83')])){if(fs['existsSync'](path[_0xaac3('0x79')](config[_0xaac3('0x7a')],_0xaac3('0x81'),_0x4fe484['customerAvatar']))&&_0x4fe484['showCustomerAvatar']){_0x21671a=path[_0xaac3('0x79')](config[_0xaac3('0x7a')],_0xaac3('0x81'),_0x4fe484['customerAvatar']);}}return _0x219aa3[_0xaac3('0x85')](_0x21671a);}})[_0xaac3('0x59')](handleError(_0x219aa3,null));};exports[_0xaac3('0x86')]=function(_0x5d0337,_0x71fc00,_0x20a002){var _0x37e2d4=path[_0xaac3('0x79')](config['root'],_0xaac3('0x87'));var _0x52dea3={'where':{'id':_0x5d0337[_0xaac3('0x57')]['id']},'attributes':['id',_0xaac3('0x77')],'raw':!![]};return db['ChatWebsite'][_0xaac3('0x58')](_0x52dea3)[_0xaac3('0x33')](handleEntityNotFound(_0x71fc00,null))[_0xaac3('0x33')](function(_0x2f9de0){if(_0x2f9de0){if(!_['isNil'](_0x2f9de0['systemAvatar'])){if(fs['existsSync'](path['join'](config['root'],_0xaac3('0x81'),_0x2f9de0['systemAvatar']))){_0x37e2d4=path[_0xaac3('0x79')](config[_0xaac3('0x7a')],'server/files/images/avatars/',_0x2f9de0['systemAvatar']);}}return _0x71fc00['download'](_0x37e2d4);}})[_0xaac3('0x59')](handleError(_0x71fc00,null));};exports[_0xaac3('0x88')]=function(_0x3d446b,_0x163951,_0x336ff7){var _0xbd0447=require(_0xaac3('0x89'));var _0x51d645=new _0xbd0447();var _0x544c8b=_0x51d645[_0xaac3('0x8a')](_0x3d446b[_0xaac3('0x8b')][_0xaac3('0x8c')])[_0xaac3('0x8d')]();var _0x2dac1c={'body':_0x3d446b['body'],'channel':_0xaac3('0x8e')};var _0x5dc062=[];var _0x12c0a7=[];var _0x5ea77a={};var _0x1bdc7a=![];return db[_0xaac3('0x8f')]['describe']()['then'](function(_0x1e5d09){if(!_0x1e5d09){throw new db[(_0xaac3('0x90'))][(_0xaac3('0x91'))]('no\x20available\x20attributes');}_0x5dc062=_['difference'](_[_0xaac3('0x44')](_0x1e5d09),['createdAt',_0xaac3('0x92')]);_0x12c0a7=_[_0xaac3('0x93')](_['keys'](_0x1e5d09),['createdAt',_0xaac3('0x92'),_0xaac3('0x94'),'ListId']);if(_0x3d446b['body']['id']){delete _0x3d446b[_0xaac3('0x62')]['id'];}if(_[_0xaac3('0x80')](_0x3d446b[_0xaac3('0x62')]['from'])){throw new db['Sequelize']['ValidationError'](_0xaac3('0x95'));}if(_[_0xaac3('0x80')](_0x3d446b[_0xaac3('0x62')][_0xaac3('0x62')])||_0x3d446b[_0xaac3('0x62')][_0xaac3('0x62')]===''){throw new db[(_0xaac3('0x90'))][(_0xaac3('0x91'))](_0xaac3('0x96'));}if(_['isNil'](_0x3d446b['body'][_0xaac3('0x97')])){throw new db[(_0xaac3('0x90'))][(_0xaac3('0x91'))](_0xaac3('0x98')+_0x12c0a7);}if(!_[_0xaac3('0x99')](_0x12c0a7,_0x3d446b[_0xaac3('0x62')][_0xaac3('0x97')])){throw new db[(_0xaac3('0x90'))][(_0xaac3('0x91'))](_0xaac3('0x9a')+_0x12c0a7);}_0x5ea77a[_0x3d446b[_0xaac3('0x62')]['mapKey']]=_0x3d446b['body'][_0xaac3('0x9b')];})[_0xaac3('0x33')](function(){return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x3d446b[_0xaac3('0x57')]['id']},'include':[{'model':db[_0xaac3('0x9c')],'as':_0xaac3('0x9d'),'include':[{'model':db[_0xaac3('0x8f')],'as':'Contacts','where':_0x5ea77a,'limit':0x1,'order':[['updatedAt',_0xaac3('0x9e')]]}]},{'model':db[_0xaac3('0x9f')],'as':_0xaac3('0xa0')}]});})[_0xaac3('0x33')](handleEntityNotFound(_0x163951,null))['then'](function(_0x592063){if(_0x592063&&_0x592063[_0xaac3('0x9d')]){_0x2dac1c['account']=_0x592063;_0x2dac1c[_0xaac3('0xa1')]=_0x592063[_0xaac3('0xa0')];_0x2dac1c[_0xaac3('0xa2')]=_0x592063['List'];_0x2dac1c[_0xaac3('0xa1')]=_[_0xaac3('0xa3')](_0x2dac1c[_0xaac3('0xa1')],['priority'],[_0xaac3('0xa4')]);if(_0x2dac1c[_0xaac3('0xa5')][_0xaac3('0xa0')]){delete _0x2dac1c[_0xaac3('0xa5')][_0xaac3('0xa0')];}if(_0x2dac1c[_0xaac3('0xa5')][_0xaac3('0x9d')]&&_0x2dac1c['account'][_0xaac3('0x9d')][_0xaac3('0xa6')]['length']){return _0x2dac1c[_0xaac3('0xa5')][_0xaac3('0x9d')]['Contacts'][0x0];}var _0x37db57=_['defaults'](_0x3d446b[_0xaac3('0x62')],{'firstName':_0x3d446b[_0xaac3('0x62')][_0xaac3('0x9b')],'ListId':_0x592063['ListId']});_0x37db57[_0x3d446b[_0xaac3('0x62')]['mapKey']]=_0x3d446b[_0xaac3('0x62')][_0xaac3('0x9b')];return db[_0xaac3('0x8f')][_0xaac3('0x5a')](_0x37db57,{'fields':_0x5dc062,'raw':!![]});}})[_0xaac3('0x33')](handleEntityNotFound(_0x163951,null))[_0xaac3('0x33')](function(_0x24a84a){_0x2dac1c[_0xaac3('0xa7')]=_0x24a84a;var _0x8f4e95=_0x3d446b[_0xaac3('0x62')]['customerIp'];if(_0x3d446b[_0xaac3('0x8b')]['cf-connecting-ip']){_0x8f4e95=_0x3d446b[_0xaac3('0x8b')]['cf-connecting-ip'];}else if(_0x3d446b['headers']['x-forwarded-for']){_0x8f4e95=_['first'](_0x3d446b[_0xaac3('0x8b')]['x-forwarded-for'][_0xaac3('0xa8')](','));}if(_0x24a84a){var _0x1e54a5={'ContactId':_0x24a84a['id'],'ChatWebsiteId':_0x3d446b['params']['id'],'from':(_0x24a84a[_0xaac3('0xa9')]||'')+'\x20'+(_0x24a84a[_0xaac3('0xaa')]||''),'customerIp':_0x8f4e95,'customerPort':_0x3d446b[_0xaac3('0x8b')][_0xaac3('0xab')]?_0x3d446b[_0xaac3('0x8b')][_0xaac3('0xab')]:null,'referer':_0x3d446b['body'][_0xaac3('0xac')],'browserName':_0x544c8b[_0xaac3('0xad')]['name']&&_0x544c8b[_0xaac3('0xad')][_0xaac3('0xae')]?util[_0xaac3('0xaf')](_0xaac3('0xb0'),_0x544c8b[_0xaac3('0xad')]['name'],_0x544c8b[_0xaac3('0xad')][_0xaac3('0xae')]):'unknown','browserVersion':_0x544c8b[_0xaac3('0xad')][_0xaac3('0xae')]||'unknown','osName':util[_0xaac3('0xaf')](_0xaac3('0xb0'),_0x544c8b['os'][_0xaac3('0x38')],_0x544c8b['os'][_0xaac3('0xae')]),'osVersion':_0x544c8b['os'][_0xaac3('0xae')],'deviceModel':_0x544c8b['device'][_0xaac3('0x47')]&&_0x544c8b[_0xaac3('0xb1')][_0xaac3('0xb2')]?util[_0xaac3('0xaf')]('%s\x20%s\x20%s',_0x544c8b[_0xaac3('0xb1')]['model'],_0x544c8b[_0xaac3('0xb1')][_0xaac3('0xb2')],_0x544c8b[_0xaac3('0xb1')][_0xaac3('0x41')]):null,'deviceVendor':_0x544c8b[_0xaac3('0xb1')][_0xaac3('0xb2')],'deviceType':_0x544c8b[_0xaac3('0xb1')][_0xaac3('0x41')],'formData':JSON[_0xaac3('0xb3')](_0x3d446b['body'])};var _0x148a7f={'ChatWebsiteId':_0x3d446b[_0xaac3('0x57')]['id'],'closed':![]};if(_0x3d446b['body'][_0xaac3('0xb4')]){_0x148a7f[_0xaac3('0xb4')]=_0x3d446b['body'][_0xaac3('0xb4')];return db[_0xaac3('0xb5')][_0xaac3('0x58')]({'where':_0x148a7f})['then'](function(_0x224fef){if(_0x224fef){return[_0x224fef,![]];}_0x1e54a5[_0xaac3('0xb4')]=_0x3d446b['body'][_0xaac3('0xb4')];_0x1e54a5[_0xaac3('0xb6')]=_0x3d446b[_0xaac3('0x62')][_0xaac3('0xb6')];return db[_0xaac3('0xb5')][_0xaac3('0x5a')](_0x1e54a5)[_0xaac3('0x33')](function(_0x10e7ad){return[_0x10e7ad,!![]];});});}_0x148a7f['ContactId']=_0x24a84a['id'];if(_0x3d446b['body'][_0xaac3('0xb7')]&&_0x3d446b[_0xaac3('0x62')][_0xaac3('0xb7')]['id']){_0x148a7f['id']=_0x3d446b['body'][_0xaac3('0xb7')]['id'];return db[_0xaac3('0xb5')][_0xaac3('0x58')]({'where':_0x148a7f})[_0xaac3('0x33')](function(_0x452801){if(_0x452801){return[_0x452801,![]];}return db[_0xaac3('0xb5')]['create'](_0x1e54a5)[_0xaac3('0x33')](function(_0x185b5c){return[_0x185b5c,!![]];});});}return db[_0xaac3('0xb5')][_0xaac3('0x5a')](_0x1e54a5)[_0xaac3('0x33')](function(_0x48acf1){return[_0x48acf1,!![]];});}})[_0xaac3('0xb8')](function(_0x570c78,_0x4822f7){if(_0x570c78){_0x1bdc7a=_0x4822f7;if(!_0x4822f7){var _0xd5b5a={'from':(_0x2dac1c[_0xaac3('0xa7')][_0xaac3('0xa9')]||'')+'\x20'+(_0x2dac1c[_0xaac3('0xa7')]['lastName']||'')};if(_0x3d446b[_0xaac3('0x62')][_0xaac3('0xb4')]&&_0x3d446b['body'][_0xaac3('0xb9')]&&_0x3d446b[_0xaac3('0x62')][_0xaac3('0xb4')]!=_0x3d446b['body'][_0xaac3('0xb9')]){_0xd5b5a[_0xaac3('0xb4')]=_0x3d446b['body'][_0xaac3('0xb9')];}return _0x570c78['update'](_0xd5b5a);}else{return _0x570c78;}}})[_0xaac3('0x33')](function(_0x3a3ce8){_0x2dac1c[_0xaac3('0xb7')]=_0x3a3ce8['get']({'plain':!![]});_0x2dac1c['interaction'][_0xaac3('0xba')]=_0x1bdc7a;if(_0x2dac1c['interaction'][_0xaac3('0xba')]){if(_0x2dac1c[_0xaac3('0xa5')]['autoclose']){_0x2dac1c['applications'][_0xaac3('0xbb')]({'id':0x0,'priority':_0x2dac1c[_0xaac3('0xa1')][_0xaac3('0x68')]+0x1,'app':_0xaac3('0xbc'),'appdata':_0xaac3('0xbd'),'interval':_0xaac3('0xbe')});}}return db[_0xaac3('0xbf')][_0xaac3('0x5a')]({'body':_0x3d446b[_0xaac3('0x62')][_0xaac3('0x62')],'ChatWebsiteId':_0x3d446b[_0xaac3('0x57')]['id'],'ChatInteractionId':_0x3a3ce8['id'],'direction':'in','ContactId':_0x2dac1c[_0xaac3('0xa7')]['id'],'AttachmentId':_0x3d446b[_0xaac3('0x62')][_0xaac3('0xc0')]});})[_0xaac3('0x33')](function(_0x16ff69){_0x2dac1c[_0xaac3('0x25')]=_0x16ff69;if(_0x2dac1c['interaction'][_0xaac3('0xc1')]){return db[_0xaac3('0xc2')][_0xaac3('0x58')]({'attributes':['id',_0xaac3('0x38')],'where':{'id':_0x2dac1c[_0xaac3('0xb7')]['UserId']}})[_0xaac3('0x33')](function(_0x5963ef){if(_0x5963ef){_0x2dac1c[_0xaac3('0xa1')][_0xaac3('0xc3')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5963ef[_0xaac3('0x38')]+','+(_0x2dac1c[_0xaac3('0xa5')][_0xaac3('0xc4')]||0xa),'interval':_0xaac3('0xbe')});_0x2dac1c['forcedOwnership']=!![];}return respondWithRpcPromise(_0xaac3('0xc5'),_0xaac3('0xc6'),_0x2dac1c);});}return respondWithRpcPromise('Start',_0xaac3('0xc6'),_0x2dac1c);})[_0xaac3('0x33')](function(_0x23738b){respondWithRpcPromise(_0xaac3('0xc7'),_0xaac3('0xc7'),{'event':_0xaac3('0x88'),'message':_0x23738b},client9002);return _0x23738b;})['then'](respondWithResult(_0x163951,null))[_0xaac3('0x59')](handleError(_0x163951,null));};exports[_0xaac3('0xc8')]=function(_0x487b2a,_0x2f8f0b,_0x4bcd05){var _0x308b7a,_0x5256e7,_0xef623e;var _0x4e64fd=[];var _0x3c3d23=[];var _0x68eeff={};return db[_0xaac3('0x8f')][_0xaac3('0x63')]()['then'](function(_0x4f0076){if(!_0x4f0076){throw new db['Sequelize']['ValidationError'](_0xaac3('0xc9'));}_0x3c3d23=_[_0xaac3('0x93')](_[_0xaac3('0x44')](_0x4f0076),[_0xaac3('0xca'),_0xaac3('0x92')]);_0x4e64fd=_[_0xaac3('0x93')](_[_0xaac3('0x44')](_0x4f0076),[_0xaac3('0xca'),_0xaac3('0x92'),'CompanyId',_0xaac3('0xcb')]);if(_0x487b2a[_0xaac3('0x62')]['id']){delete _0x487b2a[_0xaac3('0x62')]['id'];}if(_[_0xaac3('0x80')](_0x487b2a['body'][_0xaac3('0x9b')])){throw _0x2f8f0b[_0xaac3('0x29')](0x1f4)[_0xaac3('0x39')](new db[(_0xaac3('0x90'))]['ValidationError'](_0xaac3('0x95')));}if(_[_0xaac3('0x80')](_0x487b2a[_0xaac3('0x62')]['body'])||_0x487b2a[_0xaac3('0x62')][_0xaac3('0x62')]===''){throw _0x2f8f0b['status'](0x1f4)[_0xaac3('0x39')](new db[(_0xaac3('0x90'))][(_0xaac3('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x487b2a[_0xaac3('0x62')]['mapKeyOffline'])){throw _0x2f8f0b[_0xaac3('0x29')](0x1f4)[_0xaac3('0x39')](new db['Sequelize']['ValidationError'](_0xaac3('0xcc')+_0x4e64fd));}if(!_[_0xaac3('0x99')](_0x4e64fd,_0x487b2a['body'][_0xaac3('0xcd')])){throw _0x2f8f0b[_0xaac3('0x29')](0x1f4)[_0xaac3('0x39')](new db[(_0xaac3('0x90'))]['ValidationError'](_0xaac3('0xce')+_0x4e64fd));}_0x68eeff[_0x487b2a[_0xaac3('0x62')]['mapKeyOffline']]=_0x487b2a['body'][_0xaac3('0x9b')];})['then'](function(){return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x487b2a[_0xaac3('0x57')]['id']},'include':[{'model':db[_0xaac3('0x9c')],'as':'List'}]});})['then'](handleEntityNotFound(_0x2f8f0b,null))[_0xaac3('0x33')](function(_0x1df3a9){if(_0x1df3a9&&_0x1df3a9[_0xaac3('0x9d')]){_0x5256e7=_0x1df3a9;var _0x5c0295=_[_0xaac3('0x17')](_0x487b2a[_0xaac3('0x62')],{'firstName':_0x487b2a[_0xaac3('0x62')][_0xaac3('0x9b')],'phone':_0x487b2a['body'][_0xaac3('0x9b')],'ListId':_0x1df3a9['ListId']});_0x5c0295[_0x487b2a[_0xaac3('0x62')][_0xaac3('0xcd')]]=_0x487b2a[_0xaac3('0x62')]['from'];return db[_0xaac3('0x8f')][_0xaac3('0xcf')]({'where':_0x68eeff,'defaults':_0x5c0295});}})[_0xaac3('0xb8')](function(_0x357d08){if(_0x357d08){_0xef623e=_0x357d08;var _0xa1b1d2=fs['readFileSync'](path[_0xaac3('0x79')](config[_0xaac3('0x7a')],_0xaac3('0xd0')),'utf8');var _0x50e467=ejs[_0xaac3('0xd1')](_0xa1b1d2,{'body':_[_0xaac3('0xd2')](_0x487b2a[_0xaac3('0x62')]['body']),'bodyTitle':_0x5256e7[_0xaac3('0xd3')]});return db['ChatOfflineMessage'][_0xaac3('0x5a')]({'body':_0x50e467,'ContactId':_0x357d08['id'],'ChatWebsiteId':_0x5256e7['id']});}})['then'](function(_0x4f7309){if(_0x4f7309){_0x308b7a=_0x4f7309;return db[_0xaac3('0xd4')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})['then'](function(_0x5cdcfb){if(_0x5cdcfb&&_0x5cdcfb[_0xaac3('0xd5')]&&_0x5256e7[_0xaac3('0xd6')]){var _0x1f959d={'tls':{'rejectUnauthorized':![]}};if(_0x5cdcfb[_0xaac3('0xd5')][_0xaac3('0xd7')]){_0x1f959d['service']=_0x5cdcfb[_0xaac3('0xd5')][_0xaac3('0xd7')];}else{_0x1f959d[_0xaac3('0xd8')]=_0x5cdcfb[_0xaac3('0xd5')][_0xaac3('0xd8')];_0x1f959d[_0xaac3('0xd9')]=_0x5cdcfb[_0xaac3('0xd5')]['port'];_0x1f959d[_0xaac3('0xda')]=_0x5cdcfb[_0xaac3('0xd5')][_0xaac3('0xda')];}if(_0x5cdcfb[_0xaac3('0xd5')][_0xaac3('0xdb')]){_0x1f959d[_0xaac3('0xdc')]={'user':_0x5cdcfb[_0xaac3('0xd5')][_0xaac3('0x5d')],'pass':_0x5cdcfb['Smtp'][_0xaac3('0xdd')]};}return respondWithRpcPromise('SendMail',_0xaac3('0xde'),{'account':_0x1f959d,'message':{'from':util[_0xaac3('0xaf')](_0xaac3('0xdf'),_0x5cdcfb[_0xaac3('0x38')],_0x5cdcfb[_0xaac3('0xe0')]||_0x5cdcfb[_0xaac3('0xd5')]['user']),'to':_0x5256e7['forwardOfflineAddress'],'subject':_0x5256e7[_0xaac3('0xe1')],'text':_0x308b7a[_0xaac3('0x62')]}},client9003)[_0xaac3('0x33')](function(){return _0x308b7a;})[_0xaac3('0x59')](function(_0x254bd6){console[_0xaac3('0x23')](_0x254bd6);});}})[_0xaac3('0x33')](function(){if(_0x308b7a){return _0x308b7a;}})[_0xaac3('0x33')](respondWithResult(_0x2f8f0b,null))[_0xaac3('0x59')](handleError(_0x2f8f0b,null));};exports[_0xaac3('0xe2')]=function(_0x53dbac,_0x26e18d,_0x5e14bf){return db[_0xaac3('0xb5')]['find']({'where':{'id':_0x53dbac[_0xaac3('0x57')]['id']}})['then'](handleEntityNotFound(_0x26e18d,null))['then'](function(_0x19e985){if(_0x19e985){return _0x19e985[_0xaac3('0xe2')](_0x53dbac[_0xaac3('0x62')][_0xaac3('0x6a')],_['omit'](_0x53dbac[_0xaac3('0x62')],[_0xaac3('0x6a'),'id'])||{});}})[_0xaac3('0x33')](respondWithResult(_0x26e18d,null))['catch'](handleError(_0x26e18d,null));};exports[_0xaac3('0xe3')]=function(_0x284b25,_0x48b9d1,_0x336fd0){var _0x1aed43={'raw':![],'where':{}};var _0x386918={};var _0x14804a={'count':0x0,'rows':[]};return db[_0xaac3('0x3e')]['findOne']({'where':{'id':_0x284b25[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x48b9d1,null))[_0xaac3('0x33')](function(_0x884796){if(_0x884796){_0x386918[_0xaac3('0x47')]=_[_0xaac3('0x44')](db[_0xaac3('0xb5')]['rawAttributes']);_0x386918['query']=_[_0xaac3('0x44')](_0x284b25['query']);_0x386918[_0xaac3('0x45')]=_['intersection'](_0x386918[_0xaac3('0x47')],_0x386918[_0xaac3('0x43')]);_0x1aed43['attributes']=_['intersection'](_0x386918[_0xaac3('0x47')],qs['fields'](_0x284b25[_0xaac3('0x43')]['fields']));_0x1aed43[_0xaac3('0x49')]=_0x1aed43[_0xaac3('0x49')]['length']?_0x1aed43[_0xaac3('0x49')]:_0x386918[_0xaac3('0x47')];if(!_0x284b25[_0xaac3('0x43')][_0xaac3('0x6c')](_0xaac3('0x4a'))){_0x1aed43['limit']=qs[_0xaac3('0x4b')](_0x284b25['query'][_0xaac3('0x4b')]);_0x1aed43['offset']=qs[_0xaac3('0x2d')](_0x284b25[_0xaac3('0x43')]['offset']);}_0x1aed43['order']=qs[_0xaac3('0x4d')](_0x284b25[_0xaac3('0x43')]['sort']);_0x1aed43['where']=qs[_0xaac3('0x45')](_['pick'](_0x284b25[_0xaac3('0x43')],_0x386918[_0xaac3('0x45')]));_0x1aed43[_0xaac3('0x4f')][_0xaac3('0x64')]=_0x884796['id'];if(_0x284b25[_0xaac3('0x43')][_0xaac3('0x4e')]){_0x1aed43[_0xaac3('0x4f')]=_[_0xaac3('0x50')](_0x1aed43['where'],{'$or':_['map'](_0x1aed43[_0xaac3('0x49')],function(_0x49f69e){var _0x358580={};_0x358580[_0x49f69e]={'$like':'%'+_0x284b25[_0xaac3('0x43')][_0xaac3('0x4e')]+'%'};return _0x358580;})});}_0x1aed43=_['merge']({},_0x1aed43,_0x284b25[_0xaac3('0x51')]);return db[_0xaac3('0xb5')][_0xaac3('0x2c')]({'where':_0x1aed43[_0xaac3('0x4f')]})[_0xaac3('0x33')](function(_0x4cb68d){_0x14804a[_0xaac3('0x2c')]=_0x4cb68d;if(_0x284b25[_0xaac3('0x43')][_0xaac3('0x52')]){_0x1aed43[_0xaac3('0x53')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xaac3('0xc2')],'as':_0xaac3('0xe4'),'attributes':['name',_0xaac3('0xe5'),_0xaac3('0xe6')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xaac3('0x38'),'color'],'where':_0x284b25['query'][_0xaac3('0xe7')]?{'id':_0x284b25[_0xaac3('0x43')][_0xaac3('0xe7')]}:undefined,'required':_0x284b25[_0xaac3('0x43')]['tag']?!![]:![]}];}return db[_0xaac3('0xb5')][_0xaac3('0x54')](_0x1aed43);})[_0xaac3('0x33')](function(_0x399849){_0x14804a[_0xaac3('0x55')]=_0x399849;return _0x14804a;});}})[_0xaac3('0x33')](respondWithFilteredResult(_0x48b9d1,_0x1aed43))[_0xaac3('0x59')](handleError(_0x48b9d1,null));};function iftimePromise(_0x2e9799,_0x59d444){return respondWithRpcPromise('Command',_0xaac3('0xe8'),{'command':_0x59d444[_0xaac3('0xe9')]?util[_0xaac3('0xaf')](_0xaac3('0xea'),_0x2e9799[_0xaac3('0xeb')],_0x59d444[_0xaac3('0xe9')]):util[_0xaac3('0xaf')]('iftime\x20%s',_0x2e9799[_0xaac3('0xeb')])},client9002)[_0xaac3('0x33')](function(_0x457da3){var _0x581c54=_0x457da3&&_0x457da3[_0xaac3('0xec')](_0xaac3('0xed'))>=0x0?!![]:![];logger[_0xaac3('0x26')](_0xaac3('0xee'),_0x59d444['id'],_0x2e9799['id'],_0x2e9799['interval'],_0x581c54?_0xaac3('0xef'):_0xaac3('0xf0'),_0x59d444[_0xaac3('0xe9')]?_0x59d444['timezone']:_0xaac3('0xf1'));return _0x581c54;})[_0xaac3('0x59')](function(_0x37521e){logger[_0xaac3('0x23')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x59d444['id'],_0x2e9799['id'],_0x2e9799[_0xaac3('0xeb')],util[_0xaac3('0xf2')](_0x37521e,{'showHidden':![],'depth':null}),_0x59d444[_0xaac3('0xe9')]?_0x59d444[_0xaac3('0xe9')]:_0xaac3('0xf1'));return![];});}exports['getSnippet']=function(_0x19d597,_0x2bb4e4,_0x52b6c3){var _0x444baa=0x0;var _0x54bada=0x0;var _0x2b72e8=![];var _0x540196;var _0x69b9b9;return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x19d597[_0xaac3('0x57')]['id']},'include':[{'model':db[_0xaac3('0xf3')],'as':_0xaac3('0xf3'),'include':[{'model':db[_0xaac3('0xf3')],'as':_0xaac3('0xf4'),'attributes':['id',_0xaac3('0xeb')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2bb4e4,null))['then'](function(_0x15e10b){if(_0x15e10b){_0x540196=_0x15e10b;return _0x15e10b[_0xaac3('0xf5')]({'raw':!![]});}})[_0xaac3('0x33')](function(_0x4517a9){if(_0x540196){if(_0x4517a9){_0x69b9b9=_0x4517a9;}}return require(_0xaac3('0x14'))[_0xaac3('0xf6')]();})[_0xaac3('0x33')](function(_0x524917){if(_0x524917){_0x54bada=_0x524917[_0xaac3('0xf7')];_0x2b72e8=_0x524917[_0xaac3('0x7b')];}})[_0xaac3('0x33')](function(){return db[_0xaac3('0xb5')][_0xaac3('0x2c')]({'where':{'closed':![]}});})[_0xaac3('0x33')](function(_0x5256db){_0x444baa=_0x5256db;if(_0x54bada&&_0x5256db>_0x54bada){return db['License']['findOne']({'where':{'id':0x1}})[_0xaac3('0x33')](function(_0x79bfb9){if(_0x79bfb9){_0x79bfb9[_0xaac3('0xf8')](_0xaac3('0xf9'));}});}})[_0xaac3('0x33')](function(){if(_0x540196[_0xaac3('0xf3')]&&_0x540196[_0xaac3('0xf3')][_0xaac3('0xf4')]){var _0x591f1c=[];for(var _0x53c74d=0x0;_0x53c74d<_0x540196[_0xaac3('0xf3')][_0xaac3('0xf4')][_0xaac3('0x68')];_0x53c74d++){var _0x4ab979=_0x540196[_0xaac3('0xf3')]['Intervals'][_0x53c74d]['get']({'plain':!![]});_0x591f1c[_0xaac3('0xbb')](iftimePromise(_0x4ab979,_0x540196));}return BPromise[_0xaac3('0xfa')](_0x591f1c)[_0xaac3('0x33')](function(_0x3a1119){return _[_0xaac3('0xfb')](_0x3a1119);});}else{return!![];}})[_0xaac3('0x33')](function(_0x120b71){var _0x1ec7a1=fs[_0xaac3('0xfc')](path[_0xaac3('0x79')](config[_0xaac3('0x7a')],_0xaac3('0xfd')),_0xaac3('0xfe'));var _0x38cf20={'remote':_0x540196[_0xaac3('0xff')],'query':querystring[_0xaac3('0xb3')](_[_0xaac3('0x50')](_0x540196[_0xaac3('0x34')]({'plain':!![]}),{'customerIp':_0x19d597['headers'][_0xaac3('0x100')]||_0x19d597[_0xaac3('0x8b')][_0xaac3('0x101')]||_0x19d597[_0xaac3('0x102')][_0xaac3('0x103')]||_0x19d597['ip'],'referer':_0x19d597[_0xaac3('0x8b')][_0xaac3('0xac')],'openedInteractions':_0x444baa,'maxInteractions':_0x54bada,'virtual':_0x2b72e8[_0xaac3('0xf7')],'online':_0x120b71,'custom':_0x2b72e8}))[_0xaac3('0x104')](/'/g,'\x5c\x27')};_0x2bb4e4['send'](ejs[_0xaac3('0xd1')](Mustache[_0xaac3('0xd1')](_0x1ec7a1,_0x38cf20),{'proactiveActions':_0x69b9b9,'alignment':_0x540196[_0xaac3('0x105')],'verticalAlignment':_0x540196[_0xaac3('0x106')],'div_color':_0x540196[_0xaac3('0x107')],'text_color':_0x540196[_0xaac3('0x108')]}));})[_0xaac3('0x59')](handleError(_0x2bb4e4,null));};exports['addApplications']=function(_0x3acbc9,_0x5e159a,_0x7a0020){return db[_0xaac3('0x3e')]['findOne']({'where':{'id':_0x3acbc9[_0xaac3('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e159a,null))[_0xaac3('0x33')](function(_0x1724b2){if(_0x1724b2){return db['sequelize']['transaction'](function(_0x464d8b){return db[_0xaac3('0x9f')][_0xaac3('0x37')]({'where':{'ChatWebsiteId':_0x3acbc9[_0xaac3('0x57')]['id']},'transaction':_0x464d8b})[_0xaac3('0x33')](function(_0xcf2172){var _0x2f0331=_[_0xaac3('0x3d')](_0x3acbc9[_0xaac3('0x62')],function(_0x27911c){_0x27911c[_0xaac3('0x64')]=_0x3acbc9['params']['id'];return _0x27911c;});return db[_0xaac3('0x9f')][_0xaac3('0x109')](_0x2f0331,{'transaction':_0x464d8b});});})[_0xaac3('0x33')](function(){return db['ChatApplication'][_0xaac3('0x10a')]({'where':{'ChatWebsiteId':_0x3acbc9['params']['id']},'order':'priority'});});}})[_0xaac3('0x33')](respondWithResult(_0x5e159a,null))[_0xaac3('0x59')](handleError(_0x5e159a,null));};exports[_0xaac3('0x10b')]=function(_0x4b297a,_0x56fb32,_0x550ad7){var _0x576529={};var _0x7a08b4={};var _0x5dfcf7;var _0x57e189;return db[_0xaac3('0x3e')][_0xaac3('0x67')]({'where':{'id':_0x4b297a[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x56fb32,null))[_0xaac3('0x33')](function(_0x1c4f24){if(_0x1c4f24){_0x5dfcf7=_0x1c4f24;_0x7a08b4[_0xaac3('0x47')]=_['keys'](db[_0xaac3('0x9f')]['rawAttributes']);_0x7a08b4[_0xaac3('0x43')]=_[_0xaac3('0x44')](_0x4b297a['query']);_0x7a08b4[_0xaac3('0x45')]=_[_0xaac3('0x46')](_0x7a08b4[_0xaac3('0x47')],_0x7a08b4['query']);_0x576529[_0xaac3('0x49')]=_[_0xaac3('0x46')](_0x7a08b4['model'],qs[_0xaac3('0x48')](_0x4b297a[_0xaac3('0x43')][_0xaac3('0x48')]));_0x576529[_0xaac3('0x49')]=_0x576529[_0xaac3('0x49')]['length']?_0x576529[_0xaac3('0x49')]:_0x7a08b4[_0xaac3('0x47')];_0x576529[_0xaac3('0x4c')]=qs[_0xaac3('0x4d')](_0x4b297a['query'][_0xaac3('0x4d')]);_0x576529[_0xaac3('0x4f')]=qs[_0xaac3('0x45')](_[_0xaac3('0x6d')](_0x4b297a[_0xaac3('0x43')],_0x7a08b4[_0xaac3('0x45')]));if(_0x4b297a[_0xaac3('0x43')][_0xaac3('0x4e')]){_0x576529[_0xaac3('0x4f')]=_[_0xaac3('0x50')](_0x576529[_0xaac3('0x4f')],{'$or':_[_0xaac3('0x3d')](_0x576529[_0xaac3('0x49')],function(_0x185204){var _0xca3ff9={};_0xca3ff9[_0x185204]={'$like':'%'+_0x4b297a['query']['filter']+'%'};return _0xca3ff9;})});}_0x576529=_[_0xaac3('0x50')]({},_0x576529,_0x4b297a[_0xaac3('0x51')]);return _0x5dfcf7[_0xaac3('0x10b')](_0x576529);}})[_0xaac3('0x33')](function(_0x3a448f){if(_0x3a448f){_0x57e189=_0x3a448f[_0xaac3('0x68')];if(!_0x4b297a[_0xaac3('0x43')][_0xaac3('0x6c')](_0xaac3('0x4a'))){_0x576529['limit']=qs[_0xaac3('0x4b')](_0x4b297a['query'][_0xaac3('0x4b')]);_0x576529[_0xaac3('0x2d')]=qs[_0xaac3('0x2d')](_0x4b297a[_0xaac3('0x43')][_0xaac3('0x2d')]);}return _0x5dfcf7[_0xaac3('0x10b')](_0x576529);}})[_0xaac3('0x33')](function(_0x43b0f8){if(_0x43b0f8){return _0x43b0f8?{'count':_0x57e189,'rows':_0x43b0f8}:null;}})[_0xaac3('0x33')](respondWithResult(_0x56fb32,null))[_0xaac3('0x59')](handleError(_0x56fb32,null));};exports['addProactiveActions']=function(_0x6b05cc,_0x426d96,_0x4a7ed0){return db[_0xaac3('0x10c')][_0xaac3('0x58')]({'where':{'id':_0x6b05cc['params']['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x426d96,null))['then'](function(_0x4ce68d){if(_0x4ce68d){return _0x4ce68d['addProactiveActions'](_0x6b05cc['body'][_0xaac3('0x6a')],_[_0xaac3('0x10d')](_0x6b05cc[_0xaac3('0x62')],['ids','id'])||{});}})['then'](respondWithResult(_0x426d96,null))[_0xaac3('0x59')](handleError(_0x426d96,null));};exports[_0xaac3('0xf5')]=function(_0x512a22,_0x287f14,_0x5f4306){var _0x54c1a2={};var _0x351390={};var _0x3578f9;var _0x58e306;return db['ChatWebsite'][_0xaac3('0x67')]({'where':{'id':_0x512a22[_0xaac3('0x57')]['id']}})['then'](handleEntityNotFound(_0x287f14,null))['then'](function(_0x2420a6){if(_0x2420a6){_0x3578f9=_0x2420a6;_0x351390[_0xaac3('0x47')]=_[_0xaac3('0x44')](db[_0xaac3('0x10e')]['rawAttributes']);_0x351390[_0xaac3('0x43')]=_[_0xaac3('0x44')](_0x512a22['query']);_0x351390[_0xaac3('0x45')]=_[_0xaac3('0x46')](_0x351390['model'],_0x351390[_0xaac3('0x43')]);_0x54c1a2['attributes']=_['intersection'](_0x351390[_0xaac3('0x47')],qs[_0xaac3('0x48')](_0x512a22[_0xaac3('0x43')][_0xaac3('0x48')]));_0x54c1a2[_0xaac3('0x49')]=_0x54c1a2[_0xaac3('0x49')][_0xaac3('0x68')]?_0x54c1a2[_0xaac3('0x49')]:_0x351390[_0xaac3('0x47')];_0x54c1a2[_0xaac3('0x4c')]=qs[_0xaac3('0x4d')](_0x512a22[_0xaac3('0x43')]['sort']);_0x54c1a2[_0xaac3('0x4f')]=qs[_0xaac3('0x45')](_[_0xaac3('0x6d')](_0x512a22[_0xaac3('0x43')],_0x351390[_0xaac3('0x45')]));if(_0x512a22['query'][_0xaac3('0x4e')]){_0x54c1a2[_0xaac3('0x4f')]=_[_0xaac3('0x50')](_0x54c1a2[_0xaac3('0x4f')],{'$or':_[_0xaac3('0x3d')](_0x54c1a2[_0xaac3('0x49')],function(_0x1801c4){var _0x127380={};_0x127380[_0x1801c4]={'$like':'%'+_0x512a22[_0xaac3('0x43')][_0xaac3('0x4e')]+'%'};return _0x127380;})});}_0x54c1a2=_['merge']({},_0x54c1a2,_0x512a22['options']);return _0x3578f9[_0xaac3('0xf5')](_0x54c1a2);}})[_0xaac3('0x33')](function(_0x1db78f){if(_0x1db78f){_0x58e306=_0x1db78f['length'];if(!_0x512a22['query']['hasOwnProperty'](_0xaac3('0x4a'))){_0x54c1a2[_0xaac3('0x4b')]=qs[_0xaac3('0x4b')](_0x512a22['query'][_0xaac3('0x4b')]);_0x54c1a2[_0xaac3('0x2d')]=qs[_0xaac3('0x2d')](_0x512a22[_0xaac3('0x43')][_0xaac3('0x2d')]);}return _0x3578f9['getProactiveActions'](_0x54c1a2);}})[_0xaac3('0x33')](function(_0x4108d3){if(_0x4108d3){return _0x4108d3?{'count':_0x58e306,'rows':_0x4108d3}:null;}})['then'](respondWithResult(_0x287f14,null))[_0xaac3('0x59')](handleError(_0x287f14,null));};exports[_0xaac3('0x10f')]=function(_0x5c26e6,_0x28b732,_0x5092ae){var _0x1bde76=_0x5c26e6[_0xaac3('0x43')][_0xaac3('0x110')]===_0xaac3('0x111')?_0xaac3('0x112'):_0xaac3('0x113');return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'attributes':['id',_0x1bde76],'where':{'id':_0x5c26e6[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x28b732,null))[_0xaac3('0x33')](function(_0x4a4068){if(_0x4a4068){var _0x3af2ad=_0x4a4068[_0x1bde76];var _0x57c843=_0x3af2ad&&_0x3af2ad[_0xaac3('0x114')]?_0x3af2ad['items']:[];_0x28b732[_0xaac3('0x39')]({'fromKey':_[_0xaac3('0x80')](_0x3af2ad[_0xaac3('0x115')])?undefined:_0x3af2ad[_0xaac3('0x115')],'count':_0x57c843[_0xaac3('0x68')],'rows':_0x57c843});}})[_0xaac3('0x59')](handleError(_0x28b732,null));};exports[_0xaac3('0x116')]=function(_0x1cae3d,_0x1957cb,_0x5284fd){var _0x173da8={'raw':![],'where':{}};var _0x40352f={};var _0x56c14e={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1cae3d['params']['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x1957cb,null))[_0xaac3('0x33')](function(_0xb9d16d){if(_0xb9d16d){_0x40352f[_0xaac3('0x47')]=_['keys'](db[_0xaac3('0x117')][_0xaac3('0x3f')]);_0x40352f[_0xaac3('0x43')]=_['keys'](_0x1cae3d[_0xaac3('0x43')]);_0x40352f[_0xaac3('0x45')]=_[_0xaac3('0x46')](_0x40352f[_0xaac3('0x47')],_0x40352f[_0xaac3('0x43')]);_0x173da8[_0xaac3('0x49')]=_['intersection'](_0x40352f[_0xaac3('0x47')],qs[_0xaac3('0x48')](_0x1cae3d[_0xaac3('0x43')]['fields']));_0x173da8[_0xaac3('0x49')]=_0x173da8[_0xaac3('0x49')]['length']?_0x173da8['attributes']:_0x40352f[_0xaac3('0x47')];if(!_0x1cae3d[_0xaac3('0x43')][_0xaac3('0x6c')]('nolimit')){_0x173da8['limit']=qs[_0xaac3('0x4b')](_0x1cae3d[_0xaac3('0x43')][_0xaac3('0x4b')]);_0x173da8[_0xaac3('0x2d')]=qs[_0xaac3('0x2d')](_0x1cae3d[_0xaac3('0x43')][_0xaac3('0x2d')]);}_0x173da8['order']=qs[_0xaac3('0x4d')](_0x1cae3d['query'][_0xaac3('0x4d')]);_0x173da8[_0xaac3('0x4f')]=qs[_0xaac3('0x45')](_[_0xaac3('0x6d')](_0x1cae3d['query'],_0x40352f[_0xaac3('0x45')]));_0x173da8[_0xaac3('0x4f')][_0xaac3('0x64')]=_0xb9d16d['id'];if(_0x1cae3d[_0xaac3('0x43')][_0xaac3('0x4e')]){_0x173da8[_0xaac3('0x4f')]=_[_0xaac3('0x50')](_0x173da8[_0xaac3('0x4f')],{'$or':_['map'](_0x173da8['attributes'],function(_0x4cb8c8){var _0x3674cf={};_0x3674cf[_0x4cb8c8]={'$like':'%'+_0x1cae3d['query']['filter']+'%'};return _0x3674cf;})});}_0x173da8=_[_0xaac3('0x50')]({},_0x173da8,_0x1cae3d[_0xaac3('0x51')]);return db[_0xaac3('0x117')]['count']({'where':_0x173da8['where']})['then'](function(_0x54e186){_0x56c14e[_0xaac3('0x2c')]=_0x54e186;if(_0x1cae3d[_0xaac3('0x43')][_0xaac3('0x52')]){_0x173da8[_0xaac3('0x53')]=[{'all':!![]}];}else{_0x173da8[_0xaac3('0x53')]=[{'model':db[_0xaac3('0x8f')],'as':_0xaac3('0x118'),'required':![]}];}return db[_0xaac3('0x117')]['findAll'](_0x173da8);})['then'](function(_0x91e30e){_0x56c14e['rows']=_0x91e30e;return _0x56c14e;});}})[_0xaac3('0x33')](respondWithFilteredResult(_0x1957cb,_0x173da8))[_0xaac3('0x59')](handleError(_0x1957cb,null));};exports['addAgents']=function(_0x49300f,_0x27eaff,_0x1f7aee){return db[_0xaac3('0x3e')]['find']({'where':{'id':_0x49300f['params']['id']}})['then'](handleEntityNotFound(_0x27eaff,null))[_0xaac3('0x33')](function(_0x327115){if(_0x327115){return _0x327115[_0xaac3('0x119')](_0x49300f[_0xaac3('0x62')][_0xaac3('0x6a')],_[_0xaac3('0x10d')](_0x49300f['body'],[_0xaac3('0x6a'),'id'])||{})[_0xaac3('0xb8')](function(_0x3182fc){for(var _0x584701=0x0;_0x584701<_0x49300f[_0xaac3('0x62')]['ids'][_0xaac3('0x68')];_0x584701+=0x1){socket['emit'](_0xaac3('0x11a'),{'UserId':_0x49300f[_0xaac3('0x62')][_0xaac3('0x6a')][_0x584701],'ChatWebsiteId':_0x49300f[_0xaac3('0x57')]['id']});}return _0x3182fc;});}})['then'](respondWithResult(_0x27eaff,null))['catch'](handleError(_0x27eaff,null));};exports[_0xaac3('0x11b')]=function(_0x49ca7c,_0x45c707,_0x269fb9){return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x49ca7c['params']['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x45c707,null))[_0xaac3('0x33')](function(_0x5d705a){if(_0x5d705a){return _0x5d705a[_0xaac3('0x11b')](_0x49ca7c['query']['ids'])[_0xaac3('0x33')](function(){if(_[_0xaac3('0x11c')](_0x49ca7c[_0xaac3('0x43')][_0xaac3('0x6a')])){for(var _0xf85909=0x0;_0xf85909<_0x49ca7c[_0xaac3('0x43')]['ids'][_0xaac3('0x68')];_0xf85909+=0x1){socket[_0xaac3('0x11d')](_0xaac3('0x11e'),{'UserId':Number(_0x49ca7c[_0xaac3('0x43')][_0xaac3('0x6a')][_0xf85909]),'ChatWebsiteId':Number(_0x49ca7c[_0xaac3('0x57')]['id'])});}}else{socket['emit'](_0xaac3('0x11e'),{'UserId':Number(_0x49ca7c['query'][_0xaac3('0x6a')]),'ChatWebsiteId':Number(_0x49ca7c[_0xaac3('0x57')]['id'])});}});}})[_0xaac3('0x33')](respondWithStatusCode(_0x45c707,null))[_0xaac3('0x59')](handleError(_0x45c707,null));};exports[_0xaac3('0x11f')]=function(_0x4d51a8,_0x5656ef,_0x321217){var _0x58fca8={};var _0x3d47f2={};var _0x4aab5c;var _0x53050c;return db[_0xaac3('0x3e')][_0xaac3('0x67')]({'where':{'id':_0x4d51a8[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x5656ef,null))['then'](function(_0x3c71d9){if(_0x3c71d9){_0x4aab5c=_0x3c71d9;_0x3d47f2[_0xaac3('0x47')]=_[_0xaac3('0x44')](db['User'][_0xaac3('0x3f')]);_0x3d47f2['query']=_[_0xaac3('0x44')](_0x4d51a8[_0xaac3('0x43')]);_0x3d47f2[_0xaac3('0x45')]=_['intersection'](_0x3d47f2[_0xaac3('0x47')],_0x3d47f2['query']);_0x58fca8[_0xaac3('0x49')]=_[_0xaac3('0x46')](_0x3d47f2[_0xaac3('0x47')],qs['fields'](_0x4d51a8[_0xaac3('0x43')]['fields']));_0x58fca8[_0xaac3('0x49')]=_0x58fca8[_0xaac3('0x49')]['length']?_0x58fca8['attributes']:_0x3d47f2[_0xaac3('0x47')];_0x58fca8['order']=qs[_0xaac3('0x4d')](_0x4d51a8[_0xaac3('0x43')][_0xaac3('0x4d')]);_0x58fca8[_0xaac3('0x4f')]=qs[_0xaac3('0x45')](_['pick'](_0x4d51a8[_0xaac3('0x43')],_0x3d47f2['filters']));if(_0x4d51a8[_0xaac3('0x43')][_0xaac3('0x4e')]){_0x58fca8[_0xaac3('0x4f')]=_['merge'](_0x58fca8[_0xaac3('0x4f')],{'$or':_['map'](_0x58fca8[_0xaac3('0x49')],function(_0x184814){var _0x192923={};_0x192923[_0x184814]={'$like':'%'+_0x4d51a8['query'][_0xaac3('0x4e')]+'%'};return _0x192923;})});}_0x58fca8=_[_0xaac3('0x50')]({},_0x58fca8,_0x4d51a8[_0xaac3('0x51')]);return _0x4aab5c['getAgents'](_0x58fca8);}})['then'](function(_0x365006){if(_0x365006){_0x53050c=_0x365006[_0xaac3('0x68')];if(!_0x4d51a8[_0xaac3('0x43')][_0xaac3('0x6c')](_0xaac3('0x4a'))){_0x58fca8[_0xaac3('0x4b')]=qs[_0xaac3('0x4b')](_0x4d51a8[_0xaac3('0x43')][_0xaac3('0x4b')]);_0x58fca8[_0xaac3('0x2d')]=qs[_0xaac3('0x2d')](_0x4d51a8[_0xaac3('0x43')][_0xaac3('0x2d')]);}return _0x4aab5c['getAgents'](_0x58fca8);}})[_0xaac3('0x33')](function(_0x4c7773){if(_0x4c7773){return _0x4c7773?{'count':_0x53050c,'rows':_0x4c7773}:null;}})['then'](respondWithResult(_0x5656ef,null))['catch'](handleError(_0x5656ef,null));}; \ No newline at end of file +var _0xe273=['custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','Applications','account','list','applications','orderBy','priority','asc','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','ContactId','interaction','spread','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','User','Owner','internal','Tags','color','tag','getSnippet','iftime\x20%s,%s','interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','No\x20timezone','inspect','Interval','Intervals','License','chatLicenseExceeded','all','some','server/files/chat/iframe.js','utf8','remote','x-real-ip','remoteAddress','virtual','alignment','textColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','chatProactiveAction','addProactiveActions','ChatProactiveAction','getProactiveActions','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./chatWebsite.socket','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','ChatWebsites','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','ChatWebsite','rows','show','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','pick','findAll','removeDispositions','CannedAnswer','findOne','removeAnswers','ids','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense'];(function(_0x53a167,_0x4bf6c7){var _0x150263=function(_0x422191){while(--_0x422191){_0x53a167['push'](_0x53a167['shift']());}};_0x150263(++_0x4bf6c7);}(_0xe273,0x1cd));var _0x3e27=function(_0x59eacf,_0x56ec4a){_0x59eacf=_0x59eacf-0x0;var _0x5d74f2=_0xe273[_0x59eacf];return _0x5d74f2;};'use strict';var pdf=require(_0x3e27('0x0'));var emlformat=require(_0x3e27('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3e27('0x2'));var jsonpatch=require(_0x3e27('0x3'));var rp=require('request-promise');var moment=require(_0x3e27('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3e27('0x5'));var util=require(_0x3e27('0x6'));var path=require(_0x3e27('0x7'));var sox=require(_0x3e27('0x8'));var csv=require(_0x3e27('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3e27('0xa'));var squel=require(_0x3e27('0xb'));var crypto=require('crypto');var jsforce=require(_0x3e27('0xc'));var deskjs=require(_0x3e27('0xd'));var toCsv=require(_0x3e27('0x9'));var querystring=require(_0x3e27('0xe'));var Papa=require(_0x3e27('0xf'));var Redis=require(_0x3e27('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e27('0x11'));var logger=require('../../config/logger')(_0x3e27('0x12'));var utils=require(_0x3e27('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3e27('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3e27('0x15')](config['redis'],{'host':_0x3e27('0x16'),'port':0x18eb});var socket=require(_0x3e27('0x17'))(new Redis(config[_0x3e27('0x18')]));require(_0x3e27('0x19'))['register'](socket);var jayson=require(_0x3e27('0x1a'));var client=jayson[_0x3e27('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x3e27('0x1b')][_0x3e27('0x1c')]({'port':0x232a});var client9003=jayson[_0x3e27('0x1b')][_0x3e27('0x1c')]({'port':0x232b});function respondWithRpcPromise(_0x22680f,_0x4fdda3,_0xbd7080,_0x3414e0){return new BPromise(function(_0x16ee20,_0x16c136){var _0x3264b7=_0x3414e0||client;return _0x3264b7[_0x3e27('0x1d')](_0x22680f,_0xbd7080)['then'](function(_0xcef1ec){logger[_0x3e27('0x1e')](_0x3e27('0x1f'),_0x4fdda3,'request\x20sent');logger[_0x3e27('0x20')](_0x3e27('0x21'),_0x4fdda3,_0x3e27('0x22'),JSON[_0x3e27('0x23')](_0xcef1ec));if(_0xcef1ec[_0x3e27('0x24')]){if(_0xcef1ec[_0x3e27('0x24')][_0x3e27('0x25')]===0x1f4){logger[_0x3e27('0x24')](_0x3e27('0x1f'),_0x4fdda3,_0xcef1ec[_0x3e27('0x24')][_0x3e27('0x26')]);return _0x16c136(_0xcef1ec[_0x3e27('0x24')][_0x3e27('0x26')]);}logger[_0x3e27('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x4fdda3,_0xcef1ec['error']['message']);return _0x16ee20(_0xcef1ec[_0x3e27('0x24')]['message']);}else{logger[_0x3e27('0x1e')](_0x3e27('0x1f'),_0x4fdda3,_0x3e27('0x22'));_0x16ee20(_0xcef1ec['result'][_0x3e27('0x26')]);}})[_0x3e27('0x27')](function(_0x1c0fe7){logger[_0x3e27('0x24')](_0x3e27('0x1f'),_0x4fdda3,_0x1c0fe7);_0x16c136(_0x1c0fe7);});});}function respondWithStatusCode(_0x3185d1,_0xba5eeb){_0xba5eeb=_0xba5eeb||0xcc;return function(_0x486d86){if(_0x486d86){return _0x3185d1['sendStatus'](_0xba5eeb);}return _0x3185d1[_0x3e27('0x28')](_0xba5eeb)[_0x3e27('0x29')]();};}function respondWithResult(_0x2057ed,_0x4badbf){_0x4badbf=_0x4badbf||0xc8;return function(_0x2345b0){if(_0x2345b0){return _0x2057ed[_0x3e27('0x28')](_0x4badbf)[_0x3e27('0x2a')](_0x2345b0);}};}function respondWithFilteredResult(_0x4db7e3,_0x4e15be){return function(_0x38dc0a){if(_0x38dc0a){var _0x1acdf2=_0x38dc0a['count'],_0x19b1a4=_0x4e15be[_0x3e27('0x2b')],_0x2adf66=_0x4e15be[_0x3e27('0x2b')]+_0x4e15be[_0x3e27('0x2c')],_0xd3d1f1;if(_0x2adf66>=_0x1acdf2){_0x2adf66=_0x1acdf2;_0xd3d1f1=0xc8;}else{_0xd3d1f1=0xce;}_0x4db7e3[_0x3e27('0x28')](_0xd3d1f1);return _0x4db7e3[_0x3e27('0x2d')](_0x3e27('0x2e'),_0x19b1a4+'-'+_0x2adf66+'/'+_0x1acdf2)[_0x3e27('0x2a')](_0x38dc0a);}return null;};}function patchUpdates(_0x4578ed){return function(_0x183cdc){try{jsonpatch[_0x3e27('0x2f')](_0x183cdc,_0x4578ed,!![]);}catch(_0x242027){return BPromise[_0x3e27('0x30')](_0x242027);}return _0x183cdc[_0x3e27('0x31')]();};}function saveUpdates(_0x1301d2,_0x5efd21){return function(_0x1b78bf){if(_0x1b78bf){return _0x1b78bf[_0x3e27('0x32')](_0x1301d2)[_0x3e27('0x33')](function(_0x27fb9d){return _0x27fb9d;});}return null;};}function removeEntity(_0x4fd79f,_0x12b4bb){return function(_0x2b073e){if(_0x2b073e){return _0x2b073e[_0x3e27('0x34')]()[_0x3e27('0x33')](function(){var _0x6dbde0=_0x2b073e['get']({'plain':!![]});var _0x31f59b=_0x3e27('0x35');return db[_0x3e27('0x36')][_0x3e27('0x34')]({'where':{'type':_0x31f59b,'resourceId':_0x6dbde0['id']}})[_0x3e27('0x33')](function(){return _0x2b073e;});})[_0x3e27('0x33')](function(){_0x4fd79f[_0x3e27('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcf4d25,_0x348d2e){return function(_0x4f5c6b){if(!_0x4f5c6b){_0xcf4d25[_0x3e27('0x37')](0x194);}return _0x4f5c6b;};}function handleError(_0xf37de6,_0x15dc63){_0x15dc63=_0x15dc63||0x1f4;return function(_0x498c44){logger[_0x3e27('0x24')](_0x498c44[_0x3e27('0x38')]);if(_0x498c44[_0x3e27('0x39')]){delete _0x498c44[_0x3e27('0x39')];}_0xf37de6[_0x3e27('0x28')](_0x15dc63)[_0x3e27('0x3a')](_0x498c44);};}exports[_0x3e27('0x3b')]=function(_0xf50b74,_0x219869){var _0x17b57a={'include':[{'model':db[_0x3e27('0x3c')],'as':_0x3e27('0x3d')}]},_0x154868={},_0x15b3c8={'count':0x0,'rows':[]};var _0x375e4f=_[_0x3e27('0x3e')](db['ChatWebsite'][_0x3e27('0x3f')],function(_0x151131){return{'name':_0x151131[_0x3e27('0x40')],'type':_0x151131[_0x3e27('0x41')][_0x3e27('0x42')]};});_0x154868[_0x3e27('0x43')]=_[_0x3e27('0x3e')](_0x375e4f,_0x3e27('0x39'));_0x154868[_0x3e27('0x44')]=_['keys'](_0xf50b74[_0x3e27('0x44')]);_0x154868[_0x3e27('0x45')]=_[_0x3e27('0x46')](_0x154868[_0x3e27('0x43')],_0x154868[_0x3e27('0x44')]);_0x17b57a[_0x3e27('0x47')]=_[_0x3e27('0x46')](_0x154868[_0x3e27('0x43')],qs[_0x3e27('0x48')](_0xf50b74[_0x3e27('0x44')][_0x3e27('0x48')]));_0x17b57a[_0x3e27('0x47')]=_0x17b57a[_0x3e27('0x47')][_0x3e27('0x49')]?_0x17b57a[_0x3e27('0x47')]:_0x154868['model'];if(!_0xf50b74['query'][_0x3e27('0x4a')](_0x3e27('0x4b'))){_0x17b57a[_0x3e27('0x2c')]=qs['limit'](_0xf50b74[_0x3e27('0x44')][_0x3e27('0x2c')]);_0x17b57a[_0x3e27('0x2b')]=qs[_0x3e27('0x2b')](_0xf50b74[_0x3e27('0x44')][_0x3e27('0x2b')]);}_0x17b57a[_0x3e27('0x4c')]=qs['sort'](_0xf50b74[_0x3e27('0x44')][_0x3e27('0x4d')]);_0x17b57a['where']=qs['filters'](_['pick'](_0xf50b74[_0x3e27('0x44')],_0x154868[_0x3e27('0x45')]),_0x375e4f);if(_0xf50b74[_0x3e27('0x44')]['filter']){_0x17b57a[_0x3e27('0x4e')]=_[_0x3e27('0x4f')](_0x17b57a[_0x3e27('0x4e')],{'$or':_[_0x3e27('0x3e')](_0x375e4f,function(_0x33f4ee){if(_0x33f4ee[_0x3e27('0x41')]!==_0x3e27('0x50')){var _0x721840={};_0x721840[_0x33f4ee[_0x3e27('0x39')]]={'$like':'%'+_0xf50b74[_0x3e27('0x44')][_0x3e27('0x51')]+'%'};return _0x721840;}})});}_0x17b57a=_[_0x3e27('0x4f')]({},_0x17b57a,_0xf50b74[_0x3e27('0x52')]);var _0x44d3e0={'where':_0x17b57a[_0x3e27('0x4e')]};return db['ChatWebsite'][_0x3e27('0x53')](_0x44d3e0)[_0x3e27('0x33')](function(_0x3592e9){_0x15b3c8['count']=_0x3592e9;if(_0xf50b74[_0x3e27('0x44')][_0x3e27('0x54')]){_0x17b57a[_0x3e27('0x55')]=[{'all':!![]}];}return db[_0x3e27('0x56')]['findAll'](_0x17b57a);})[_0x3e27('0x33')](function(_0x23f466){_0x15b3c8[_0x3e27('0x57')]=_0x23f466;return _0x15b3c8;})[_0x3e27('0x33')](respondWithFilteredResult(_0x219869,_0x17b57a))[_0x3e27('0x27')](handleError(_0x219869,null));};exports[_0x3e27('0x58')]=function(_0x304064,_0x2228a2){var _0x264832={'raw':![],'where':{'id':_0x304064[_0x3e27('0x59')]['id']},'include':[{'model':db[_0x3e27('0x3c')],'as':_0x3e27('0x3d')}]},_0x2fe09a={};_0x2fe09a[_0x3e27('0x43')]=_['keys'](db['ChatWebsite'][_0x3e27('0x3f')]);_0x2fe09a[_0x3e27('0x44')]=_[_0x3e27('0x5a')](_0x304064[_0x3e27('0x44')]);_0x2fe09a[_0x3e27('0x45')]=_[_0x3e27('0x46')](_0x2fe09a[_0x3e27('0x43')],_0x2fe09a['query']);_0x264832[_0x3e27('0x47')]=_[_0x3e27('0x46')](_0x2fe09a[_0x3e27('0x43')],qs['fields'](_0x304064['query'][_0x3e27('0x48')]));_0x264832['attributes']=_0x264832[_0x3e27('0x47')][_0x3e27('0x49')]?_0x264832['attributes']:_0x2fe09a['model'];if(_0x304064['query']['includeAll']){_0x264832['include']=[{'all':!![]}];}_0x264832=_[_0x3e27('0x4f')]({},_0x264832,_0x304064[_0x3e27('0x52')]);return db[_0x3e27('0x56')]['find'](_0x264832)[_0x3e27('0x33')](handleEntityNotFound(_0x2228a2,null))[_0x3e27('0x33')](respondWithResult(_0x2228a2,null))[_0x3e27('0x27')](handleError(_0x2228a2,null));};exports[_0x3e27('0x5b')]=function(_0x25c066,_0x524d02){return db[_0x3e27('0x56')]['create'](_0x25c066[_0x3e27('0x5c')],{})[_0x3e27('0x33')](function(_0x47ae86){var _0x16a983=_0x25c066[_0x3e27('0x5d')][_0x3e27('0x5e')]({'plain':!![]});if(!_0x16a983)throw new Error(_0x3e27('0x5f'));if(_0x16a983[_0x3e27('0x60')]==='user'){var _0x159cc3=_0x47ae86[_0x3e27('0x5e')]({'plain':!![]});var _0x3148b8=_0x3e27('0x35');return db['UserProfileSection'][_0x3e27('0x61')]({'where':{'name':_0x3148b8,'userProfileId':_0x16a983['userProfileId']},'raw':!![]})[_0x3e27('0x33')](function(_0x343c7a){if(_0x343c7a&&_0x343c7a[_0x3e27('0x62')]===0x0){return db[_0x3e27('0x36')]['create']({'name':_0x159cc3[_0x3e27('0x39')],'resourceId':_0x159cc3['id'],'type':_0x343c7a[_0x3e27('0x39')],'sectionId':_0x343c7a['id']},{})[_0x3e27('0x33')](function(){return _0x47ae86;});}else{return _0x47ae86;}})[_0x3e27('0x27')](function(_0x50fba1){logger[_0x3e27('0x24')](_0x3e27('0x63'),_0x50fba1);throw _0x50fba1;});}return _0x47ae86;})[_0x3e27('0x33')](respondWithResult(_0x524d02,0xc9))[_0x3e27('0x27')](handleError(_0x524d02,null));};exports[_0x3e27('0x32')]=function(_0x179464,_0x49bdab){if(_0x179464['body']['id']){delete _0x179464[_0x3e27('0x5c')]['id'];}return db['ChatWebsite'][_0x3e27('0x61')]({'where':{'id':_0x179464[_0x3e27('0x59')]['id']},'include':[{'model':db[_0x3e27('0x3c')],'as':_0x3e27('0x3d')}]})['then'](handleEntityNotFound(_0x49bdab,null))['then'](saveUpdates(_0x179464['body'],null))[_0x3e27('0x33')](respondWithResult(_0x49bdab,null))[_0x3e27('0x27')](handleError(_0x49bdab,null));};exports['destroy']=function(_0x48ff91,_0x431f43){return db[_0x3e27('0x56')][_0x3e27('0x61')]({'where':{'id':_0x48ff91[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x431f43,null))[_0x3e27('0x33')](removeEntity(_0x431f43,null))[_0x3e27('0x27')](handleError(_0x431f43,null));};exports[_0x3e27('0x64')]=function(_0x384814,_0x133a98){return db[_0x3e27('0x56')][_0x3e27('0x64')]()[_0x3e27('0x33')](respondWithResult(_0x133a98,null))[_0x3e27('0x27')](handleError(_0x133a98,null));};exports['addDisposition']=function(_0x506319,_0x1f5f52,_0x521529){if(_0x506319['body']['id']){delete _0x506319[_0x3e27('0x5c')]['id'];}return db[_0x3e27('0x56')][_0x3e27('0x61')]({'where':{'id':_0x506319[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x1f5f52,null))[_0x3e27('0x33')](function(_0x4abe5d){if(_0x4abe5d){_0x506319[_0x3e27('0x5c')][_0x3e27('0x65')]=_0x4abe5d['id'];return db[_0x3e27('0x66')]['create'](_0x506319['body']);}})[_0x3e27('0x33')](respondWithResult(_0x1f5f52,null))[_0x3e27('0x27')](handleError(_0x1f5f52,null));};exports[_0x3e27('0x67')]=function(_0x18f3cc,_0x375385,_0x4fb529){var _0x152199={'raw':![],'where':{}};var _0x1c9999={};var _0x2741b9={'count':0x0,'rows':[]};return db[_0x3e27('0x56')]['findOne']({'where':{'id':_0x18f3cc[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x375385,null))[_0x3e27('0x33')](function(_0x2ba5e7){if(_0x2ba5e7){_0x1c9999[_0x3e27('0x43')]=_['keys'](db[_0x3e27('0x66')][_0x3e27('0x3f')]);_0x1c9999[_0x3e27('0x44')]=_[_0x3e27('0x5a')](_0x18f3cc[_0x3e27('0x44')]);_0x1c9999[_0x3e27('0x45')]=_[_0x3e27('0x46')](_0x1c9999[_0x3e27('0x43')],_0x1c9999[_0x3e27('0x44')]);_0x152199[_0x3e27('0x47')]=_[_0x3e27('0x46')](_0x1c9999[_0x3e27('0x43')],qs[_0x3e27('0x48')](_0x18f3cc[_0x3e27('0x44')][_0x3e27('0x48')]));_0x152199[_0x3e27('0x47')]=_0x152199[_0x3e27('0x47')][_0x3e27('0x49')]?_0x152199[_0x3e27('0x47')]:_0x1c9999['model'];if(!_0x18f3cc[_0x3e27('0x44')][_0x3e27('0x4a')](_0x3e27('0x4b'))){_0x152199['limit']=qs[_0x3e27('0x2c')](_0x18f3cc[_0x3e27('0x44')][_0x3e27('0x2c')]);_0x152199[_0x3e27('0x2b')]=qs[_0x3e27('0x2b')](_0x18f3cc[_0x3e27('0x44')]['offset']);}_0x152199[_0x3e27('0x4c')]=qs[_0x3e27('0x4d')](_0x18f3cc[_0x3e27('0x44')][_0x3e27('0x4d')]);_0x152199['where']=qs['filters'](_[_0x3e27('0x68')](_0x18f3cc['query'],_0x1c9999['filters']));_0x152199[_0x3e27('0x4e')]['ChatWebsiteId']=_0x2ba5e7['id'];if(_0x18f3cc[_0x3e27('0x44')][_0x3e27('0x51')]){_0x152199['where']=_[_0x3e27('0x4f')](_0x152199['where'],{'$or':_[_0x3e27('0x3e')](_0x152199['attributes'],function(_0x5db98b){var _0x56a170={};_0x56a170[_0x5db98b]={'$like':'%'+_0x18f3cc['query']['filter']+'%'};return _0x56a170;})});}_0x152199=_['merge']({},_0x152199,_0x18f3cc['options']);return db[_0x3e27('0x66')]['count']({'where':_0x152199[_0x3e27('0x4e')]})[_0x3e27('0x33')](function(_0x4ab85f){_0x2741b9[_0x3e27('0x53')]=_0x4ab85f;if(_0x18f3cc[_0x3e27('0x44')][_0x3e27('0x54')]){_0x152199['include']=[{'all':!![]}];}return db[_0x3e27('0x66')][_0x3e27('0x69')](_0x152199);})[_0x3e27('0x33')](function(_0x5862fe){_0x2741b9[_0x3e27('0x57')]=_0x5862fe;return _0x2741b9;});}})[_0x3e27('0x33')](respondWithFilteredResult(_0x375385,_0x152199))[_0x3e27('0x27')](handleError(_0x375385,null));};exports[_0x3e27('0x6a')]=function(_0x47cfa5,_0x1f5bc3,_0x2b7b7e){return db[_0x3e27('0x56')][_0x3e27('0x61')]({'where':{'id':_0x47cfa5['params']['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x1f5bc3,null))[_0x3e27('0x33')](function(_0x19c9cf){if(_0x19c9cf){return _0x19c9cf['removeDispositions'](_0x47cfa5[_0x3e27('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x1f5bc3,null))[_0x3e27('0x27')](handleError(_0x1f5bc3,null));};exports['addAnswer']=function(_0x3324f1,_0x3d98a0,_0x7aa6c3){if(_0x3324f1['body']['id']){delete _0x3324f1[_0x3e27('0x5c')]['id'];}return db['ChatWebsite'][_0x3e27('0x61')]({'where':{'id':_0x3324f1[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x3d98a0,null))[_0x3e27('0x33')](function(_0x5b2550){if(_0x5b2550){_0x3324f1[_0x3e27('0x5c')][_0x3e27('0x65')]=_0x5b2550['id'];return db[_0x3e27('0x6b')]['create'](_0x3324f1[_0x3e27('0x5c')]);}})[_0x3e27('0x33')](respondWithResult(_0x3d98a0,null))[_0x3e27('0x27')](handleError(_0x3d98a0,null));};exports['getAnswers']=function(_0x433f9d,_0xd0f5be,_0x58725b){var _0x36712e={'raw':![],'where':{}};var _0x9c7bff={};var _0x10f25e={'count':0x0,'rows':[]};return db[_0x3e27('0x56')][_0x3e27('0x6c')]({'where':{'id':_0x433f9d['params']['id']}})['then'](handleEntityNotFound(_0xd0f5be,null))[_0x3e27('0x33')](function(_0x362d13){if(_0x362d13){_0x9c7bff[_0x3e27('0x43')]=_[_0x3e27('0x5a')](db[_0x3e27('0x6b')]['rawAttributes']);_0x9c7bff[_0x3e27('0x44')]=_['keys'](_0x433f9d[_0x3e27('0x44')]);_0x9c7bff['filters']=_[_0x3e27('0x46')](_0x9c7bff[_0x3e27('0x43')],_0x9c7bff[_0x3e27('0x44')]);_0x36712e[_0x3e27('0x47')]=_['intersection'](_0x9c7bff['model'],qs['fields'](_0x433f9d[_0x3e27('0x44')]['fields']));_0x36712e[_0x3e27('0x47')]=_0x36712e[_0x3e27('0x47')][_0x3e27('0x49')]?_0x36712e[_0x3e27('0x47')]:_0x9c7bff[_0x3e27('0x43')];if(!_0x433f9d[_0x3e27('0x44')]['hasOwnProperty']('nolimit')){_0x36712e[_0x3e27('0x2c')]=qs[_0x3e27('0x2c')](_0x433f9d['query'][_0x3e27('0x2c')]);_0x36712e[_0x3e27('0x2b')]=qs[_0x3e27('0x2b')](_0x433f9d[_0x3e27('0x44')]['offset']);}_0x36712e[_0x3e27('0x4c')]=qs['sort'](_0x433f9d['query'][_0x3e27('0x4d')]);_0x36712e[_0x3e27('0x4e')]=qs[_0x3e27('0x45')](_[_0x3e27('0x68')](_0x433f9d[_0x3e27('0x44')],_0x9c7bff[_0x3e27('0x45')]));_0x36712e['where']['ChatWebsiteId']=_0x362d13['id'];if(_0x433f9d[_0x3e27('0x44')]['filter']){_0x36712e[_0x3e27('0x4e')]=_[_0x3e27('0x4f')](_0x36712e[_0x3e27('0x4e')],{'$or':_['map'](_0x36712e['attributes'],function(_0x40e04b){var _0x4e48c8={};_0x4e48c8[_0x40e04b]={'$like':'%'+_0x433f9d[_0x3e27('0x44')][_0x3e27('0x51')]+'%'};return _0x4e48c8;})});}_0x36712e=_[_0x3e27('0x4f')]({},_0x36712e,_0x433f9d['options']);return db[_0x3e27('0x6b')][_0x3e27('0x53')]({'where':_0x36712e[_0x3e27('0x4e')]})[_0x3e27('0x33')](function(_0x51eb15){_0x10f25e[_0x3e27('0x53')]=_0x51eb15;if(_0x433f9d[_0x3e27('0x44')][_0x3e27('0x54')]){_0x36712e[_0x3e27('0x55')]=[{'all':!![]}];}return db[_0x3e27('0x6b')][_0x3e27('0x69')](_0x36712e);})[_0x3e27('0x33')](function(_0x3e31ef){_0x10f25e[_0x3e27('0x57')]=_0x3e31ef;return _0x10f25e;});}})[_0x3e27('0x33')](respondWithFilteredResult(_0xd0f5be,_0x36712e))[_0x3e27('0x27')](handleError(_0xd0f5be,null));};exports[_0x3e27('0x6d')]=function(_0x5b28f9,_0x59538c,_0x2553e0){return db['ChatWebsite'][_0x3e27('0x61')]({'where':{'id':_0x5b28f9[_0x3e27('0x59')]['id']}})['then'](handleEntityNotFound(_0x59538c,null))['then'](function(_0x2af9ae){if(_0x2af9ae){return _0x2af9ae[_0x3e27('0x6d')](_0x5b28f9[_0x3e27('0x44')][_0x3e27('0x6e')]);}})[_0x3e27('0x33')](respondWithStatusCode(_0x59538c,null))[_0x3e27('0x27')](handleError(_0x59538c,null));};exports['addLogo']=function(_0x53794b,_0x213d09,_0x36a207){_0x53794b[_0x3e27('0x5c')][_0x3e27('0x6f')]=_0x53794b[_0x3e27('0x70')][_0x3e27('0x71')];return db[_0x3e27('0x56')][_0x3e27('0x61')]({'where':{'id':_0x53794b[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x213d09,null))['then'](saveUpdates(_0x53794b[_0x3e27('0x5c')],null))[_0x3e27('0x33')](respondWithResult(_0x213d09,null))[_0x3e27('0x27')](handleError(_0x213d09,null));};exports[_0x3e27('0x72')]=function(_0x5991fe,_0x5165dc,_0x4f77f7){_0x5991fe['body']['agentAvatar']=_0x5991fe[_0x3e27('0x70')][_0x3e27('0x71')];return db[_0x3e27('0x56')][_0x3e27('0x61')]({'where':{'id':_0x5991fe[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x5165dc,null))['then'](saveUpdates(_0x5991fe[_0x3e27('0x5c')],null))[_0x3e27('0x33')](respondWithResult(_0x5165dc,null))[_0x3e27('0x27')](handleError(_0x5165dc,null));};exports[_0x3e27('0x73')]=function(_0x280ff5,_0x8d26e6,_0x954381){_0x280ff5[_0x3e27('0x5c')][_0x3e27('0x74')]=_0x280ff5[_0x3e27('0x70')][_0x3e27('0x71')];return db['ChatWebsite'][_0x3e27('0x61')]({'where':{'id':_0x280ff5[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x8d26e6,null))[_0x3e27('0x33')](saveUpdates(_0x280ff5['body'],null))['then'](respondWithResult(_0x8d26e6,null))['catch'](handleError(_0x8d26e6,null));};exports[_0x3e27('0x75')]=function(_0x557f5d,_0x378687,_0x5afba6){_0x557f5d[_0x3e27('0x5c')]['systemAvatar']=_0x557f5d[_0x3e27('0x70')][_0x3e27('0x71')];return db[_0x3e27('0x56')][_0x3e27('0x61')]({'where':{'id':_0x557f5d[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x378687,null))[_0x3e27('0x33')](saveUpdates(_0x557f5d[_0x3e27('0x5c')],null))['then'](respondWithResult(_0x378687,null))[_0x3e27('0x27')](handleError(_0x378687,null));};exports[_0x3e27('0x76')]=function(_0x57e62c,_0x48e0b6,_0x16a8ba){var _0x14a59d=path[_0x3e27('0x77')](config[_0x3e27('0x78')],_0x3e27('0x79'));var _0x52b1a4={'where':{'id':_0x57e62c['params']['id']},'attributes':['id',_0x3e27('0x6f')],'raw':!![]};var _0x126896=![];return require(_0x3e27('0x14'))[_0x3e27('0x7a')]()['then'](function(_0x48638c){if(_0x48638c){_0x126896=_0x48638c[_0x3e27('0x7b')];}})[_0x3e27('0x33')](function(){return db[_0x3e27('0x56')][_0x3e27('0x61')](_0x52b1a4);})[_0x3e27('0x33')](handleEntityNotFound(_0x48e0b6,null))['then'](function(_0x1f3b46){if(_0x1f3b46){if(!_[_0x3e27('0x7c')](_0x1f3b46[_0x3e27('0x6f')])){if(fs[_0x3e27('0x7d')](path[_0x3e27('0x77')](config['root'],_0x3e27('0x7e'),_0x1f3b46['sitepic']))&&_0x126896){_0x14a59d=path[_0x3e27('0x77')](config[_0x3e27('0x78')],_0x3e27('0x7e'),_0x1f3b46[_0x3e27('0x6f')]);}}return _0x48e0b6[_0x3e27('0x7f')](_0x14a59d);}})[_0x3e27('0x27')](handleError(_0x48e0b6,null));};exports['getAvatar']=function(_0x4b13fa,_0x4b6eae,_0x74dff3){var _0x4ea13b=path[_0x3e27('0x77')](config['root'],_0x3e27('0x80'));var _0x2523f4={'where':{'id':_0x4b13fa[_0x3e27('0x59')]['id']},'attributes':['id',_0x3e27('0x81')],'raw':!![]};return db['ChatWebsite'][_0x3e27('0x61')](_0x2523f4)[_0x3e27('0x33')](handleEntityNotFound(_0x4b6eae,null))[_0x3e27('0x33')](function(_0x5b2265){if(_0x5b2265){if(!_[_0x3e27('0x7c')](_0x5b2265[_0x3e27('0x81')])){if(fs['existsSync'](path[_0x3e27('0x77')](config[_0x3e27('0x78')],'server/files/images/avatars/',_0x5b2265[_0x3e27('0x81')]))){_0x4ea13b=path['join'](config['root'],_0x3e27('0x82'),_0x5b2265[_0x3e27('0x81')]);}}return _0x4b6eae[_0x3e27('0x7f')](_0x4ea13b);}})[_0x3e27('0x27')](handleError(_0x4b6eae,null));};exports[_0x3e27('0x83')]=function(_0x3afddd,_0xe67121,_0x3f8f89){var _0x3941c3=path[_0x3e27('0x77')](config[_0x3e27('0x78')],_0x3e27('0x84'));var _0x24ef0a={'where':{'id':_0x3afddd[_0x3e27('0x59')]['id']},'attributes':['id',_0x3e27('0x74'),'showCustomerAvatar'],'raw':!![]};return db[_0x3e27('0x56')][_0x3e27('0x61')](_0x24ef0a)[_0x3e27('0x33')](handleEntityNotFound(_0xe67121,null))[_0x3e27('0x33')](function(_0x202d3e){if(_0x202d3e){if(!_[_0x3e27('0x7c')](_0x202d3e[_0x3e27('0x74')])){if(fs[_0x3e27('0x7d')](path[_0x3e27('0x77')](config[_0x3e27('0x78')],'server/files/images/avatars/',_0x202d3e[_0x3e27('0x74')]))&&_0x202d3e[_0x3e27('0x85')]){_0x3941c3=path['join'](config[_0x3e27('0x78')],_0x3e27('0x82'),_0x202d3e[_0x3e27('0x74')]);}}return _0xe67121[_0x3e27('0x7f')](_0x3941c3);}})[_0x3e27('0x27')](handleError(_0xe67121,null));};exports[_0x3e27('0x86')]=function(_0x1f3d04,_0x5ad48a,_0x419039){var _0x374e07=path[_0x3e27('0x77')](config['root'],_0x3e27('0x87'));var _0x5afac2={'where':{'id':_0x1f3d04[_0x3e27('0x59')]['id']},'attributes':['id',_0x3e27('0x88')],'raw':!![]};return db[_0x3e27('0x56')]['find'](_0x5afac2)['then'](handleEntityNotFound(_0x5ad48a,null))[_0x3e27('0x33')](function(_0x11cecf){if(_0x11cecf){if(!_[_0x3e27('0x7c')](_0x11cecf[_0x3e27('0x88')])){if(fs[_0x3e27('0x7d')](path[_0x3e27('0x77')](config[_0x3e27('0x78')],'server/files/images/avatars/',_0x11cecf[_0x3e27('0x88')]))){_0x374e07=path[_0x3e27('0x77')](config[_0x3e27('0x78')],_0x3e27('0x82'),_0x11cecf[_0x3e27('0x88')]);}}return _0x5ad48a['download'](_0x374e07);}})[_0x3e27('0x27')](handleError(_0x5ad48a,null));};exports[_0x3e27('0x89')]=function(_0x2f36dc,_0x200fe2,_0x282466){var _0x5e40f8=require(_0x3e27('0x8a'));var _0x4afe83=new _0x5e40f8();var _0x44e6a6=_0x4afe83[_0x3e27('0x8b')](_0x2f36dc['headers'][_0x3e27('0x8c')])[_0x3e27('0x8d')]();var _0x5998d1={'body':_0x2f36dc[_0x3e27('0x5c')],'channel':_0x3e27('0x8e')};var _0x188948=[];var _0x1f68cb=[];var _0x27ccb9={};var _0x238ff2=![];return db[_0x3e27('0x8f')][_0x3e27('0x64')]()[_0x3e27('0x33')](function(_0x57e9c9){if(!_0x57e9c9){throw new db[(_0x3e27('0x90'))][(_0x3e27('0x91'))](_0x3e27('0x92'));}_0x188948=_[_0x3e27('0x93')](_[_0x3e27('0x5a')](_0x57e9c9),[_0x3e27('0x94'),_0x3e27('0x95')]);_0x1f68cb=_['difference'](_[_0x3e27('0x5a')](_0x57e9c9),[_0x3e27('0x94'),_0x3e27('0x95'),_0x3e27('0x96'),_0x3e27('0x97')]);if(_0x2f36dc[_0x3e27('0x5c')]['id']){delete _0x2f36dc[_0x3e27('0x5c')]['id'];}if(_[_0x3e27('0x7c')](_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0x98')])){throw new db[(_0x3e27('0x90'))][(_0x3e27('0x91'))](_0x3e27('0x99'));}if(_['isNil'](_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0x5c')])||_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0x5c')]===''){throw new db[(_0x3e27('0x90'))][(_0x3e27('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0x9a')])){throw new db[(_0x3e27('0x90'))]['ValidationError'](_0x3e27('0x9b')+_0x1f68cb);}if(!_[_0x3e27('0x9c')](_0x1f68cb,_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0x9a')])){throw new db['Sequelize'][(_0x3e27('0x91'))](_0x3e27('0x9d')+_0x1f68cb);}_0x27ccb9[_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0x9a')]]=_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0x98')];})[_0x3e27('0x33')](function(){return db[_0x3e27('0x56')][_0x3e27('0x61')]({'where':{'id':_0x2f36dc[_0x3e27('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x3e27('0x9e'),'include':[{'model':db[_0x3e27('0x8f')],'as':_0x3e27('0x9f'),'where':_0x27ccb9,'limit':0x1,'order':[['updatedAt',_0x3e27('0xa0')]]}]},{'model':db[_0x3e27('0xa1')],'as':_0x3e27('0xa2')}]});})[_0x3e27('0x33')](handleEntityNotFound(_0x200fe2,null))[_0x3e27('0x33')](function(_0x118c78){if(_0x118c78&&_0x118c78['List']){_0x5998d1[_0x3e27('0xa3')]=_0x118c78;_0x5998d1['applications']=_0x118c78[_0x3e27('0xa2')];_0x5998d1[_0x3e27('0xa4')]=_0x118c78[_0x3e27('0x9e')];_0x5998d1[_0x3e27('0xa5')]=_[_0x3e27('0xa6')](_0x5998d1['applications'],[_0x3e27('0xa7')],[_0x3e27('0xa8')]);if(_0x5998d1[_0x3e27('0xa3')]['Applications']){delete _0x5998d1[_0x3e27('0xa3')][_0x3e27('0xa2')];}if(_0x5998d1['account']['List']&&_0x5998d1[_0x3e27('0xa3')]['List'][_0x3e27('0x9f')][_0x3e27('0x49')]){return _0x5998d1['account']['List'][_0x3e27('0x9f')][0x0];}var _0x52f0f3=_[_0x3e27('0x15')](_0x2f36dc[_0x3e27('0x5c')],{'firstName':_0x2f36dc['body'][_0x3e27('0x98')],'ListId':_0x118c78[_0x3e27('0x97')]});_0x52f0f3[_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0x9a')]]=_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0x98')];return db['CmContact']['create'](_0x52f0f3,{'fields':_0x188948,'raw':!![]});}})[_0x3e27('0x33')](handleEntityNotFound(_0x200fe2,null))['then'](function(_0x2ed907){_0x5998d1['contact']=_0x2ed907;var _0x370fbc=_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0xa9')];if(_0x2f36dc['headers']['cf-connecting-ip']){_0x370fbc=_0x2f36dc[_0x3e27('0xaa')][_0x3e27('0xab')];}else if(_0x2f36dc[_0x3e27('0xaa')][_0x3e27('0xac')]){_0x370fbc=_[_0x3e27('0xad')](_0x2f36dc[_0x3e27('0xaa')]['x-forwarded-for'][_0x3e27('0xae')](','));}if(_0x2ed907){var _0x17fbd8={'ContactId':_0x2ed907['id'],'ChatWebsiteId':_0x2f36dc[_0x3e27('0x59')]['id'],'from':(_0x2ed907[_0x3e27('0xaf')]||'')+'\x20'+(_0x2ed907[_0x3e27('0xb0')]||''),'customerIp':_0x370fbc,'customerPort':_0x2f36dc['headers'][_0x3e27('0xb1')]?_0x2f36dc[_0x3e27('0xaa')][_0x3e27('0xb1')]:null,'referer':_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0xb2')],'browserName':_0x44e6a6[_0x3e27('0xb3')][_0x3e27('0x39')]&&_0x44e6a6[_0x3e27('0xb3')][_0x3e27('0xb4')]?util[_0x3e27('0xb5')](_0x3e27('0xb6'),_0x44e6a6['browser']['name'],_0x44e6a6[_0x3e27('0xb3')][_0x3e27('0xb4')]):_0x3e27('0xb7'),'browserVersion':_0x44e6a6['browser']['version']||_0x3e27('0xb7'),'osName':util[_0x3e27('0xb5')](_0x3e27('0xb6'),_0x44e6a6['os'][_0x3e27('0x39')],_0x44e6a6['os']['version']),'osVersion':_0x44e6a6['os'][_0x3e27('0xb4')],'deviceModel':_0x44e6a6[_0x3e27('0xb8')]['model']&&_0x44e6a6['device'][_0x3e27('0xb9')]?util[_0x3e27('0xb5')](_0x3e27('0xba'),_0x44e6a6[_0x3e27('0xb8')]['model'],_0x44e6a6[_0x3e27('0xb8')][_0x3e27('0xb9')],_0x44e6a6[_0x3e27('0xb8')][_0x3e27('0x41')]):null,'deviceVendor':_0x44e6a6[_0x3e27('0xb8')][_0x3e27('0xb9')],'deviceType':_0x44e6a6['device'][_0x3e27('0x41')],'formData':JSON['stringify'](_0x2f36dc[_0x3e27('0x5c')])};var _0x89091e={'ChatWebsiteId':_0x2f36dc['params']['id'],'closed':![]};if(_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0xbb')]){_0x89091e[_0x3e27('0xbb')]=_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0xbb')];return db[_0x3e27('0xbc')][_0x3e27('0x61')]({'where':_0x89091e})[_0x3e27('0x33')](function(_0x13cf67){if(_0x13cf67){return[_0x13cf67,![]];}_0x17fbd8[_0x3e27('0xbb')]=_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0xbb')];_0x17fbd8['externalUrl']=_0x2f36dc[_0x3e27('0x5c')]['externalUrl'];return db['ChatInteraction']['create'](_0x17fbd8)[_0x3e27('0x33')](function(_0x1d4209){return[_0x1d4209,!![]];});});}_0x89091e[_0x3e27('0xbd')]=_0x2ed907['id'];if(_0x2f36dc[_0x3e27('0x5c')]['interaction']&&_0x2f36dc['body'][_0x3e27('0xbe')]['id']){_0x89091e['id']=_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0xbe')]['id'];return db[_0x3e27('0xbc')][_0x3e27('0x61')]({'where':_0x89091e})[_0x3e27('0x33')](function(_0x589eaa){if(_0x589eaa){return[_0x589eaa,![]];}return db[_0x3e27('0xbc')][_0x3e27('0x5b')](_0x17fbd8)['then'](function(_0x18790d){return[_0x18790d,!![]];});});}return db['ChatInteraction']['create'](_0x17fbd8)[_0x3e27('0x33')](function(_0x5daeb6){return[_0x5daeb6,!![]];});}})[_0x3e27('0xbf')](function(_0x20fe7d,_0x5ecd6a){if(_0x20fe7d){_0x238ff2=_0x5ecd6a;if(!_0x5ecd6a){var _0x8a5d6f={'from':(_0x5998d1['contact'][_0x3e27('0xaf')]||'')+'\x20'+(_0x5998d1[_0x3e27('0xc0')][_0x3e27('0xb0')]||'')};if(_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0xbb')]&&_0x2f36dc['body'][_0x3e27('0xc1')]&&_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0xbb')]!=_0x2f36dc['body'][_0x3e27('0xc1')]){_0x8a5d6f[_0x3e27('0xbb')]=_0x2f36dc[_0x3e27('0x5c')]['messageId'];}return _0x20fe7d['update'](_0x8a5d6f);}else{return _0x20fe7d;}}})[_0x3e27('0x33')](function(_0x3c5e65){_0x5998d1[_0x3e27('0xbe')]=_0x3c5e65['get']({'plain':!![]});_0x5998d1[_0x3e27('0xbe')][_0x3e27('0xc2')]=_0x238ff2;if(_0x5998d1['interaction'][_0x3e27('0xc2')]){if(_0x5998d1['account'][_0x3e27('0xc3')]){_0x5998d1[_0x3e27('0xa5')][_0x3e27('0xc4')]({'id':0x0,'priority':_0x5998d1[_0x3e27('0xa5')][_0x3e27('0x49')]+0x1,'app':_0x3e27('0xc5'),'appdata':_0x3e27('0xc6'),'interval':_0x3e27('0xc7')});}}return db[_0x3e27('0xc8')][_0x3e27('0x5b')]({'body':_0x2f36dc['body'][_0x3e27('0x5c')],'ChatWebsiteId':_0x2f36dc[_0x3e27('0x59')]['id'],'ChatInteractionId':_0x3c5e65['id'],'direction':'in','ContactId':_0x5998d1[_0x3e27('0xc0')]['id'],'AttachmentId':_0x2f36dc[_0x3e27('0x5c')][_0x3e27('0xc9')]});})[_0x3e27('0x33')](function(_0x5952a0){_0x5998d1[_0x3e27('0x26')]=_0x5952a0;if(_0x5998d1[_0x3e27('0xbe')][_0x3e27('0xca')]){return db['User'][_0x3e27('0x61')]({'attributes':['id',_0x3e27('0x39')],'where':{'id':_0x5998d1[_0x3e27('0xbe')][_0x3e27('0xca')]}})[_0x3e27('0x33')](function(_0x69d744){if(_0x69d744){_0x5998d1[_0x3e27('0xa5')][_0x3e27('0xcb')]({'id':0x0,'priority':0x0,'app':_0x3e27('0xcc'),'appdata':_0x69d744[_0x3e27('0x39')]+','+(_0x5998d1[_0x3e27('0xa3')][_0x3e27('0xcd')]||0xa),'interval':_0x3e27('0xc7')});_0x5998d1['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0x3e27('0xce'),_0x5998d1);});}return respondWithRpcPromise(_0x3e27('0xcf'),_0x3e27('0xce'),_0x5998d1);})[_0x3e27('0x33')](function(_0x4c23de){respondWithRpcPromise(_0x3e27('0xd0'),_0x3e27('0xd0'),{'event':'notify','message':_0x4c23de},client9002);return _0x4c23de;})[_0x3e27('0x33')](respondWithResult(_0x200fe2,null))['catch'](handleError(_0x200fe2,null));};exports[_0x3e27('0xd1')]=function(_0x5a092b,_0x4ec6ed,_0x4f0f78){var _0x53504d,_0x4ca135,_0x31037f;var _0x19fafd=[];var _0x3b7177=[];var _0x2adf19={};return db['CmContact'][_0x3e27('0x64')]()['then'](function(_0x33c42c){if(!_0x33c42c){throw new db['Sequelize']['ValidationError'](_0x3e27('0x92'));}_0x3b7177=_[_0x3e27('0x93')](_[_0x3e27('0x5a')](_0x33c42c),['createdAt',_0x3e27('0x95')]);_0x19fafd=_['difference'](_['keys'](_0x33c42c),[_0x3e27('0x94'),_0x3e27('0x95'),_0x3e27('0x96'),_0x3e27('0x97')]);if(_0x5a092b[_0x3e27('0x5c')]['id']){delete _0x5a092b[_0x3e27('0x5c')]['id'];}if(_[_0x3e27('0x7c')](_0x5a092b[_0x3e27('0x5c')][_0x3e27('0x98')])){throw _0x4ec6ed[_0x3e27('0x28')](0x1f4)[_0x3e27('0x3a')](new db[(_0x3e27('0x90'))][(_0x3e27('0x91'))](_0x3e27('0x99')));}if(_['isNil'](_0x5a092b['body']['body'])||_0x5a092b[_0x3e27('0x5c')]['body']===''){throw _0x4ec6ed['status'](0x1f4)[_0x3e27('0x3a')](new db[(_0x3e27('0x90'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x5a092b[_0x3e27('0x5c')][_0x3e27('0xd2')])){throw _0x4ec6ed['status'](0x1f4)[_0x3e27('0x3a')](new db['Sequelize']['ValidationError'](_0x3e27('0xd3')+_0x19fafd));}if(!_[_0x3e27('0x9c')](_0x19fafd,_0x5a092b[_0x3e27('0x5c')][_0x3e27('0xd2')])){throw _0x4ec6ed[_0x3e27('0x28')](0x1f4)['send'](new db['Sequelize'][(_0x3e27('0x91'))](_0x3e27('0xd4')+_0x19fafd));}_0x2adf19[_0x5a092b[_0x3e27('0x5c')][_0x3e27('0xd2')]]=_0x5a092b[_0x3e27('0x5c')][_0x3e27('0x98')];})['then'](function(){return db[_0x3e27('0x56')][_0x3e27('0x61')]({'where':{'id':_0x5a092b['params']['id']},'include':[{'model':db[_0x3e27('0xd5')],'as':_0x3e27('0x9e')}]});})['then'](handleEntityNotFound(_0x4ec6ed,null))[_0x3e27('0x33')](function(_0x3eccdb){if(_0x3eccdb&&_0x3eccdb['List']){_0x4ca135=_0x3eccdb;var _0x4b0b9c=_[_0x3e27('0x15')](_0x5a092b['body'],{'firstName':_0x5a092b['body'][_0x3e27('0x98')],'phone':_0x5a092b['body'][_0x3e27('0x98')],'ListId':_0x3eccdb[_0x3e27('0x97')]});_0x4b0b9c[_0x5a092b[_0x3e27('0x5c')][_0x3e27('0xd2')]]=_0x5a092b[_0x3e27('0x5c')]['from'];return db[_0x3e27('0x8f')][_0x3e27('0xd6')]({'where':_0x2adf19,'defaults':_0x4b0b9c});}})[_0x3e27('0xbf')](function(_0x4f6857){if(_0x4f6857){_0x31037f=_0x4f6857;var _0x512323=fs[_0x3e27('0xd7')](path['join'](config['root'],_0x3e27('0xd8')),'utf8');var _0x56c996=ejs[_0x3e27('0xd9')](_0x512323,{'body':_[_0x3e27('0xda')](_0x5a092b[_0x3e27('0x5c')][_0x3e27('0x5c')]),'bodyTitle':_0x4ca135[_0x3e27('0xdb')]});return db[_0x3e27('0xdc')][_0x3e27('0x5b')]({'body':_0x56c996,'ContactId':_0x4f6857['id'],'ChatWebsiteId':_0x4ca135['id']});}})['then'](function(_0x1c5136){if(_0x1c5136){_0x53504d=_0x1c5136;return db[_0x3e27('0xdd')][_0x3e27('0x6c')]({'where':{'service':!![]},'include':[{'model':db[_0x3e27('0xde')],'as':_0x3e27('0xdf'),'raw':!![]}]});}})[_0x3e27('0x33')](function(_0x1c9748){if(_0x1c9748&&_0x1c9748[_0x3e27('0xdf')]&&_0x4ca135[_0x3e27('0xe0')]){var _0xa513c5={'tls':{'rejectUnauthorized':![]}};if(_0x1c9748[_0x3e27('0xdf')][_0x3e27('0xe1')]){_0xa513c5['service']=_0x1c9748[_0x3e27('0xdf')][_0x3e27('0xe1')];}else{_0xa513c5[_0x3e27('0xe2')]=_0x1c9748[_0x3e27('0xdf')][_0x3e27('0xe2')];_0xa513c5[_0x3e27('0xe3')]=_0x1c9748[_0x3e27('0xdf')][_0x3e27('0xe3')];_0xa513c5[_0x3e27('0xe4')]=_0x1c9748[_0x3e27('0xdf')]['secure'];}if(_0x1c9748[_0x3e27('0xdf')]['authentication']){_0xa513c5[_0x3e27('0xe5')]={'user':_0x1c9748['Smtp'][_0x3e27('0x5d')],'pass':_0x1c9748[_0x3e27('0xdf')]['pass']};}return respondWithRpcPromise(_0x3e27('0xe6'),_0x3e27('0xe7'),{'account':_0xa513c5,'message':{'from':util['format'](_0x3e27('0xe8'),_0x1c9748['name'],_0x1c9748[_0x3e27('0xe9')]||_0x1c9748[_0x3e27('0xdf')][_0x3e27('0x5d')]),'to':_0x4ca135[_0x3e27('0xe0')],'subject':_0x4ca135[_0x3e27('0xea')],'text':_0x53504d[_0x3e27('0x5c')]}},client9003)[_0x3e27('0x33')](function(){return _0x53504d;})[_0x3e27('0x27')](function(_0x13fc5c){console[_0x3e27('0x24')](_0x13fc5c);});}})[_0x3e27('0x33')](function(){if(_0x53504d){return _0x53504d;}})[_0x3e27('0x33')](respondWithResult(_0x4ec6ed,null))[_0x3e27('0x27')](handleError(_0x4ec6ed,null));};exports[_0x3e27('0xeb')]=function(_0x31c1a,_0x3e1415,_0xd51458){return db['ChatInteraction'][_0x3e27('0x61')]({'where':{'id':_0x31c1a['params']['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x3e1415,null))['then'](function(_0x13e34b){if(_0x13e34b){return _0x13e34b[_0x3e27('0xeb')](_0x31c1a[_0x3e27('0x5c')][_0x3e27('0x6e')],_[_0x3e27('0xec')](_0x31c1a[_0x3e27('0x5c')],['ids','id'])||{});}})[_0x3e27('0x33')](respondWithResult(_0x3e1415,null))[_0x3e27('0x27')](handleError(_0x3e1415,null));};exports[_0x3e27('0xed')]=function(_0x244946,_0x4d5e41,_0x35c985){var _0x550cc8={'raw':![],'where':{}};var _0x1db42f={};var _0x2d7e3b={'count':0x0,'rows':[]};return db[_0x3e27('0x56')]['findOne']({'where':{'id':_0x244946[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x4d5e41,null))[_0x3e27('0x33')](function(_0x235845){if(_0x235845){_0x1db42f[_0x3e27('0x43')]=_[_0x3e27('0x5a')](db[_0x3e27('0xbc')]['rawAttributes']);_0x1db42f[_0x3e27('0x44')]=_[_0x3e27('0x5a')](_0x244946['query']);_0x1db42f['filters']=_[_0x3e27('0x46')](_0x1db42f['model'],_0x1db42f[_0x3e27('0x44')]);_0x550cc8[_0x3e27('0x47')]=_[_0x3e27('0x46')](_0x1db42f[_0x3e27('0x43')],qs['fields'](_0x244946[_0x3e27('0x44')][_0x3e27('0x48')]));_0x550cc8[_0x3e27('0x47')]=_0x550cc8[_0x3e27('0x47')][_0x3e27('0x49')]?_0x550cc8[_0x3e27('0x47')]:_0x1db42f[_0x3e27('0x43')];if(!_0x244946[_0x3e27('0x44')][_0x3e27('0x4a')](_0x3e27('0x4b'))){_0x550cc8['limit']=qs[_0x3e27('0x2c')](_0x244946[_0x3e27('0x44')]['limit']);_0x550cc8[_0x3e27('0x2b')]=qs[_0x3e27('0x2b')](_0x244946[_0x3e27('0x44')]['offset']);}_0x550cc8[_0x3e27('0x4c')]=qs[_0x3e27('0x4d')](_0x244946[_0x3e27('0x44')]['sort']);_0x550cc8['where']=qs[_0x3e27('0x45')](_[_0x3e27('0x68')](_0x244946[_0x3e27('0x44')],_0x1db42f[_0x3e27('0x45')]));_0x550cc8[_0x3e27('0x4e')][_0x3e27('0x65')]=_0x235845['id'];if(_0x244946['query'][_0x3e27('0x51')]){_0x550cc8[_0x3e27('0x4e')]=_[_0x3e27('0x4f')](_0x550cc8[_0x3e27('0x4e')],{'$or':_[_0x3e27('0x3e')](_0x550cc8[_0x3e27('0x47')],function(_0x4cb873){var _0x314c5c={};_0x314c5c[_0x4cb873]={'$like':'%'+_0x244946[_0x3e27('0x44')][_0x3e27('0x51')]+'%'};return _0x314c5c;})});}_0x550cc8=_[_0x3e27('0x4f')]({},_0x550cc8,_0x244946[_0x3e27('0x52')]);return db['ChatInteraction'][_0x3e27('0x53')]({'where':_0x550cc8[_0x3e27('0x4e')]})[_0x3e27('0x33')](function(_0x11dd8f){_0x2d7e3b[_0x3e27('0x53')]=_0x11dd8f;if(_0x244946[_0x3e27('0x44')][_0x3e27('0x54')]){_0x550cc8[_0x3e27('0x55')]=[{'model':db[_0x3e27('0x8f')],'as':'Contact','required':![]},{'model':db[_0x3e27('0xee')],'as':_0x3e27('0xef'),'attributes':['name','fullname',_0x3e27('0xf0')],'required':![]},{'model':db['Tag'],'as':_0x3e27('0xf1'),'attributes':['id',_0x3e27('0x39'),_0x3e27('0xf2')],'where':_0x244946[_0x3e27('0x44')]['tag']?{'id':_0x244946['query'][_0x3e27('0xf3')]}:undefined,'required':_0x244946[_0x3e27('0x44')][_0x3e27('0xf3')]?!![]:![]}];}return db[_0x3e27('0xbc')]['findAll'](_0x550cc8);})[_0x3e27('0x33')](function(_0x2cded0){_0x2d7e3b[_0x3e27('0x57')]=_0x2cded0;return _0x2d7e3b;});}})['then'](respondWithFilteredResult(_0x4d5e41,_0x550cc8))[_0x3e27('0x27')](handleError(_0x4d5e41,null));};function iftimePromise(_0x30c4e9,_0x6b74ae){return respondWithRpcPromise('Command',_0x3e27('0xf4'),{'command':_0x6b74ae['timezone']?util[_0x3e27('0xb5')](_0x3e27('0xf5'),_0x30c4e9[_0x3e27('0xf6')],_0x6b74ae['timezone']):util['format']('iftime\x20%s',_0x30c4e9[_0x3e27('0xf6')])},client9002)['then'](function(_0x2a77e4){var _0x87d89c=_0x2a77e4&&_0x2a77e4[_0x3e27('0xf7')]('true')>=0x0?!![]:![];logger['info'](_0x3e27('0xf8'),_0x6b74ae['id'],_0x30c4e9['id'],_0x30c4e9[_0x3e27('0xf6')],_0x87d89c?_0x3e27('0xf9'):_0x3e27('0xfa'),_0x6b74ae[_0x3e27('0xfb')]?_0x6b74ae[_0x3e27('0xfb')]:_0x3e27('0xfc'));return _0x87d89c;})[_0x3e27('0x27')](function(_0x42a72f){logger['error'](_0x3e27('0xf8'),_0x6b74ae['id'],_0x30c4e9['id'],_0x30c4e9['interval'],util[_0x3e27('0xfd')](_0x42a72f,{'showHidden':![],'depth':null}),_0x6b74ae[_0x3e27('0xfb')]?_0x6b74ae['timezone']:_0x3e27('0xfc'));return![];});}exports[_0x3e27('0xf4')]=function(_0x417a6b,_0x1435ba,_0xd8cd55){var _0x5d694c=0x0;var _0x4fb461=0x0;var _0xf029e6=![];var _0xf8fa35;var _0x8d7d03;return db['ChatWebsite'][_0x3e27('0x61')]({'where':{'id':_0x417a6b[_0x3e27('0x59')]['id']},'include':[{'model':db[_0x3e27('0xfe')],'as':_0x3e27('0xfe'),'include':[{'model':db[_0x3e27('0xfe')],'as':_0x3e27('0xff'),'attributes':['id',_0x3e27('0xf6')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1435ba,null))[_0x3e27('0x33')](function(_0x11277b){if(_0x11277b){_0xf8fa35=_0x11277b;return _0x11277b['getProactiveActions']({'raw':!![]});}})[_0x3e27('0x33')](function(_0x17be62){if(_0xf8fa35){if(_0x17be62){_0x8d7d03=_0x17be62;}}return require(_0x3e27('0x14'))[_0x3e27('0x7a')]();})['then'](function(_0x3f8d29){if(_0x3f8d29){_0x4fb461=_0x3f8d29['virtual'];_0xf029e6=_0x3f8d29['custom'];}})[_0x3e27('0x33')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x3e27('0x33')](function(_0x5d01fd){_0x5d694c=_0x5d01fd;if(_0x4fb461&&_0x5d01fd>_0x4fb461){return db[_0x3e27('0x100')][_0x3e27('0x6c')]({'where':{'id':0x1}})['then'](function(_0x1e932f){if(_0x1e932f){_0x1e932f['increment'](_0x3e27('0x101'));}});}})[_0x3e27('0x33')](function(){if(_0xf8fa35[_0x3e27('0xfe')]&&_0xf8fa35[_0x3e27('0xfe')][_0x3e27('0xff')]){var _0x2a7c77=[];for(var _0x25f2e4=0x0;_0x25f2e4<_0xf8fa35[_0x3e27('0xfe')][_0x3e27('0xff')][_0x3e27('0x49')];_0x25f2e4++){var _0x26541b=_0xf8fa35[_0x3e27('0xfe')]['Intervals'][_0x25f2e4][_0x3e27('0x5e')]({'plain':!![]});_0x2a7c77['push'](iftimePromise(_0x26541b,_0xf8fa35));}return BPromise[_0x3e27('0x102')](_0x2a7c77)[_0x3e27('0x33')](function(_0x4ef7a7){return _[_0x3e27('0x103')](_0x4ef7a7);});}else{return!![];}})['then'](function(_0x156f85){var _0x27899a=fs[_0x3e27('0xd7')](path[_0x3e27('0x77')](config[_0x3e27('0x78')],_0x3e27('0x104')),_0x3e27('0x105'));var _0x24b8cd={'remote':_0xf8fa35[_0x3e27('0x106')],'query':querystring['stringify'](_[_0x3e27('0x4f')](_0xf8fa35[_0x3e27('0x5e')]({'plain':!![]}),{'customerIp':_0x417a6b[_0x3e27('0xaa')][_0x3e27('0xac')]||_0x417a6b['headers'][_0x3e27('0x107')]||_0x417a6b['connection'][_0x3e27('0x108')]||_0x417a6b['ip'],'referer':_0x417a6b['headers']['referer'],'openedInteractions':_0x5d694c,'maxInteractions':_0x4fb461,'virtual':_0xf029e6[_0x3e27('0x109')],'online':_0x156f85,'custom':_0xf029e6}))['replace'](/'/g,'\x5c\x27')};_0x1435ba[_0x3e27('0x3a')](ejs[_0x3e27('0xd9')](Mustache[_0x3e27('0xd9')](_0x27899a,_0x24b8cd),{'proactiveActions':_0x8d7d03,'alignment':_0xf8fa35[_0x3e27('0x10a')],'verticalAlignment':_0xf8fa35['verticalAlignment'],'div_color':_0xf8fa35[_0x3e27('0xf2')],'text_color':_0xf8fa35[_0x3e27('0x10b')]}));})['catch'](handleError(_0x1435ba,null));};exports[_0x3e27('0x10c')]=function(_0x49aa26,_0x256e55,_0xaedf5d){return db['ChatWebsite'][_0x3e27('0x6c')]({'where':{'id':_0x49aa26[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x256e55,null))[_0x3e27('0x33')](function(_0x5ef915){if(_0x5ef915){return db[_0x3e27('0x10d')][_0x3e27('0x10e')](function(_0x2c54d2){return db[_0x3e27('0xa1')]['destroy']({'where':{'ChatWebsiteId':_0x49aa26[_0x3e27('0x59')]['id']},'transaction':_0x2c54d2})[_0x3e27('0x33')](function(_0x53cc0b){var _0x4ec1a6=_[_0x3e27('0x3e')](_0x49aa26[_0x3e27('0x5c')],function(_0x1428fe){_0x1428fe[_0x3e27('0x65')]=_0x49aa26[_0x3e27('0x59')]['id'];return _0x1428fe;});return db[_0x3e27('0xa1')][_0x3e27('0x10f')](_0x4ec1a6,{'transaction':_0x2c54d2});});})[_0x3e27('0x33')](function(){return db[_0x3e27('0xa1')][_0x3e27('0x110')]({'where':{'ChatWebsiteId':_0x49aa26[_0x3e27('0x59')]['id']},'order':'priority'});});}})[_0x3e27('0x33')](respondWithResult(_0x256e55,null))['catch'](handleError(_0x256e55,null));};exports['getApplications']=function(_0x4dcf93,_0x339a11,_0x5ce812){var _0x10e6df={};var _0x56cebb={};var _0x25ddaf;var _0x4e2143;return db[_0x3e27('0x56')]['findOne']({'where':{'id':_0x4dcf93[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x339a11,null))[_0x3e27('0x33')](function(_0x4e106f){if(_0x4e106f){_0x25ddaf=_0x4e106f;_0x56cebb['model']=_['keys'](db['ChatApplication'][_0x3e27('0x3f')]);_0x56cebb['query']=_['keys'](_0x4dcf93[_0x3e27('0x44')]);_0x56cebb[_0x3e27('0x45')]=_[_0x3e27('0x46')](_0x56cebb[_0x3e27('0x43')],_0x56cebb[_0x3e27('0x44')]);_0x10e6df['attributes']=_[_0x3e27('0x46')](_0x56cebb[_0x3e27('0x43')],qs[_0x3e27('0x48')](_0x4dcf93[_0x3e27('0x44')][_0x3e27('0x48')]));_0x10e6df[_0x3e27('0x47')]=_0x10e6df[_0x3e27('0x47')]['length']?_0x10e6df['attributes']:_0x56cebb[_0x3e27('0x43')];_0x10e6df[_0x3e27('0x4c')]=qs[_0x3e27('0x4d')](_0x4dcf93[_0x3e27('0x44')][_0x3e27('0x4d')]);_0x10e6df[_0x3e27('0x4e')]=qs[_0x3e27('0x45')](_['pick'](_0x4dcf93[_0x3e27('0x44')],_0x56cebb[_0x3e27('0x45')]));if(_0x4dcf93[_0x3e27('0x44')][_0x3e27('0x51')]){_0x10e6df[_0x3e27('0x4e')]=_['merge'](_0x10e6df[_0x3e27('0x4e')],{'$or':_['map'](_0x10e6df[_0x3e27('0x47')],function(_0x565100){var _0x5e3527={};_0x5e3527[_0x565100]={'$like':'%'+_0x4dcf93[_0x3e27('0x44')][_0x3e27('0x51')]+'%'};return _0x5e3527;})});}_0x10e6df=_[_0x3e27('0x4f')]({},_0x10e6df,_0x4dcf93[_0x3e27('0x52')]);return _0x25ddaf['getApplications'](_0x10e6df);}})[_0x3e27('0x33')](function(_0x4d1c9c){if(_0x4d1c9c){_0x4e2143=_0x4d1c9c[_0x3e27('0x49')];if(!_0x4dcf93[_0x3e27('0x44')]['hasOwnProperty'](_0x3e27('0x4b'))){_0x10e6df[_0x3e27('0x2c')]=qs[_0x3e27('0x2c')](_0x4dcf93['query']['limit']);_0x10e6df[_0x3e27('0x2b')]=qs[_0x3e27('0x2b')](_0x4dcf93[_0x3e27('0x44')][_0x3e27('0x2b')]);}return _0x25ddaf['getApplications'](_0x10e6df);}})[_0x3e27('0x33')](function(_0x432943){if(_0x432943){return _0x432943?{'count':_0x4e2143,'rows':_0x432943}:null;}})[_0x3e27('0x33')](respondWithResult(_0x339a11,null))['catch'](handleError(_0x339a11,null));};exports['addProactiveActions']=function(_0x4a0c69,_0x5d3f3d,_0x75ea07){return db[_0x3e27('0x111')]['find']({'where':{'id':_0x4a0c69[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x5d3f3d,null))[_0x3e27('0x33')](function(_0x18ca39){if(_0x18ca39){return _0x18ca39[_0x3e27('0x112')](_0x4a0c69[_0x3e27('0x5c')][_0x3e27('0x6e')],_[_0x3e27('0xec')](_0x4a0c69[_0x3e27('0x5c')],[_0x3e27('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x5d3f3d,null))['catch'](handleError(_0x5d3f3d,null));};exports['getProactiveActions']=function(_0x389bb0,_0x44e07f,_0x1f9161){var _0x4272d0={};var _0x285d72={};var _0x255006;var _0x23988f;return db[_0x3e27('0x56')][_0x3e27('0x6c')]({'where':{'id':_0x389bb0[_0x3e27('0x59')]['id']}})['then'](handleEntityNotFound(_0x44e07f,null))['then'](function(_0x22475b){if(_0x22475b){_0x255006=_0x22475b;_0x285d72['model']=_[_0x3e27('0x5a')](db[_0x3e27('0x113')]['rawAttributes']);_0x285d72[_0x3e27('0x44')]=_[_0x3e27('0x5a')](_0x389bb0[_0x3e27('0x44')]);_0x285d72['filters']=_[_0x3e27('0x46')](_0x285d72[_0x3e27('0x43')],_0x285d72[_0x3e27('0x44')]);_0x4272d0['attributes']=_[_0x3e27('0x46')](_0x285d72[_0x3e27('0x43')],qs['fields'](_0x389bb0['query'][_0x3e27('0x48')]));_0x4272d0['attributes']=_0x4272d0[_0x3e27('0x47')][_0x3e27('0x49')]?_0x4272d0['attributes']:_0x285d72['model'];_0x4272d0[_0x3e27('0x4c')]=qs[_0x3e27('0x4d')](_0x389bb0[_0x3e27('0x44')][_0x3e27('0x4d')]);_0x4272d0[_0x3e27('0x4e')]=qs[_0x3e27('0x45')](_[_0x3e27('0x68')](_0x389bb0['query'],_0x285d72[_0x3e27('0x45')]));if(_0x389bb0[_0x3e27('0x44')][_0x3e27('0x51')]){_0x4272d0[_0x3e27('0x4e')]=_[_0x3e27('0x4f')](_0x4272d0[_0x3e27('0x4e')],{'$or':_[_0x3e27('0x3e')](_0x4272d0[_0x3e27('0x47')],function(_0x16a6fd){var _0x2bf2d5={};_0x2bf2d5[_0x16a6fd]={'$like':'%'+_0x389bb0['query'][_0x3e27('0x51')]+'%'};return _0x2bf2d5;})});}_0x4272d0=_[_0x3e27('0x4f')]({},_0x4272d0,_0x389bb0['options']);return _0x255006[_0x3e27('0x114')](_0x4272d0);}})[_0x3e27('0x33')](function(_0x5e4531){if(_0x5e4531){_0x23988f=_0x5e4531[_0x3e27('0x49')];if(!_0x389bb0['query'][_0x3e27('0x4a')]('nolimit')){_0x4272d0[_0x3e27('0x2c')]=qs['limit'](_0x389bb0[_0x3e27('0x44')]['limit']);_0x4272d0['offset']=qs[_0x3e27('0x2b')](_0x389bb0[_0x3e27('0x44')][_0x3e27('0x2b')]);}return _0x255006[_0x3e27('0x114')](_0x4272d0);}})[_0x3e27('0x33')](function(_0x57e251){if(_0x57e251){return _0x57e251?{'count':_0x23988f,'rows':_0x57e251}:null;}})[_0x3e27('0x33')](respondWithResult(_0x44e07f,null))[_0x3e27('0x27')](handleError(_0x44e07f,null));};exports[_0x3e27('0x115')]=function(_0x1c509b,_0x42050d,_0x1aed3a){var _0x1d5892=_0x1c509b[_0x3e27('0x44')]['online']===_0x3e27('0x116')?_0x3e27('0x117'):_0x3e27('0x118');return db[_0x3e27('0x56')]['find']({'attributes':['id',_0x1d5892],'where':{'id':_0x1c509b[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x42050d,null))[_0x3e27('0x33')](function(_0x558bb4){if(_0x558bb4){var _0x4aad6c=_0x558bb4[_0x1d5892];var _0x47ba3b=_0x4aad6c&&_0x4aad6c[_0x3e27('0x119')]?_0x4aad6c[_0x3e27('0x119')]:[];_0x42050d[_0x3e27('0x3a')]({'fromKey':_[_0x3e27('0x7c')](_0x4aad6c[_0x3e27('0x11a')])?undefined:_0x4aad6c[_0x3e27('0x11a')],'count':_0x47ba3b[_0x3e27('0x49')],'rows':_0x47ba3b});}})[_0x3e27('0x27')](handleError(_0x42050d,null));};exports[_0x3e27('0x11b')]=function(_0x2169d1,_0xcea333,_0x4753cb){var _0x57a31b={'raw':![],'where':{}};var _0x5a4b06={};var _0x4ae370={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x3e27('0x6c')]({'where':{'id':_0x2169d1[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0xcea333,null))[_0x3e27('0x33')](function(_0xf0ead9){if(_0xf0ead9){_0x5a4b06['model']=_[_0x3e27('0x5a')](db[_0x3e27('0xdc')]['rawAttributes']);_0x5a4b06[_0x3e27('0x44')]=_[_0x3e27('0x5a')](_0x2169d1[_0x3e27('0x44')]);_0x5a4b06[_0x3e27('0x45')]=_[_0x3e27('0x46')](_0x5a4b06[_0x3e27('0x43')],_0x5a4b06[_0x3e27('0x44')]);_0x57a31b['attributes']=_['intersection'](_0x5a4b06[_0x3e27('0x43')],qs[_0x3e27('0x48')](_0x2169d1[_0x3e27('0x44')][_0x3e27('0x48')]));_0x57a31b[_0x3e27('0x47')]=_0x57a31b[_0x3e27('0x47')][_0x3e27('0x49')]?_0x57a31b[_0x3e27('0x47')]:_0x5a4b06[_0x3e27('0x43')];if(!_0x2169d1[_0x3e27('0x44')]['hasOwnProperty'](_0x3e27('0x4b'))){_0x57a31b[_0x3e27('0x2c')]=qs[_0x3e27('0x2c')](_0x2169d1['query'][_0x3e27('0x2c')]);_0x57a31b[_0x3e27('0x2b')]=qs[_0x3e27('0x2b')](_0x2169d1[_0x3e27('0x44')][_0x3e27('0x2b')]);}_0x57a31b[_0x3e27('0x4c')]=qs[_0x3e27('0x4d')](_0x2169d1['query'][_0x3e27('0x4d')]);_0x57a31b['where']=qs[_0x3e27('0x45')](_[_0x3e27('0x68')](_0x2169d1[_0x3e27('0x44')],_0x5a4b06[_0x3e27('0x45')]));_0x57a31b['where']['ChatWebsiteId']=_0xf0ead9['id'];if(_0x2169d1['query'][_0x3e27('0x51')]){_0x57a31b[_0x3e27('0x4e')]=_[_0x3e27('0x4f')](_0x57a31b[_0x3e27('0x4e')],{'$or':_[_0x3e27('0x3e')](_0x57a31b[_0x3e27('0x47')],function(_0x220b07){var _0x2847cf={};_0x2847cf[_0x220b07]={'$like':'%'+_0x2169d1['query'][_0x3e27('0x51')]+'%'};return _0x2847cf;})});}_0x57a31b=_[_0x3e27('0x4f')]({},_0x57a31b,_0x2169d1[_0x3e27('0x52')]);return db[_0x3e27('0xdc')][_0x3e27('0x53')]({'where':_0x57a31b[_0x3e27('0x4e')]})['then'](function(_0xab4d25){_0x4ae370['count']=_0xab4d25;if(_0x2169d1[_0x3e27('0x44')][_0x3e27('0x54')]){_0x57a31b[_0x3e27('0x55')]=[{'all':!![]}];}else{_0x57a31b[_0x3e27('0x55')]=[{'model':db[_0x3e27('0x8f')],'as':_0x3e27('0x11c'),'required':![]}];}return db['ChatOfflineMessage'][_0x3e27('0x69')](_0x57a31b);})[_0x3e27('0x33')](function(_0x21da13){_0x4ae370[_0x3e27('0x57')]=_0x21da13;return _0x4ae370;});}})['then'](respondWithFilteredResult(_0xcea333,_0x57a31b))[_0x3e27('0x27')](handleError(_0xcea333,null));};exports['addAgents']=function(_0x268181,_0x215d83,_0x372618){return db[_0x3e27('0x56')][_0x3e27('0x61')]({'where':{'id':_0x268181[_0x3e27('0x59')]['id']}})['then'](handleEntityNotFound(_0x215d83,null))['then'](function(_0x41001f){if(_0x41001f){return _0x41001f[_0x3e27('0x11d')](_0x268181[_0x3e27('0x5c')][_0x3e27('0x6e')],_[_0x3e27('0xec')](_0x268181[_0x3e27('0x5c')],[_0x3e27('0x6e'),'id'])||{})[_0x3e27('0xbf')](function(_0x4a3c2a){for(var _0x66adcf=0x0;_0x66adcf<_0x268181[_0x3e27('0x5c')][_0x3e27('0x6e')][_0x3e27('0x49')];_0x66adcf+=0x1){socket['emit'](_0x3e27('0x11e'),{'UserId':_0x268181[_0x3e27('0x5c')]['ids'][_0x66adcf],'ChatWebsiteId':_0x268181['params']['id']});}return _0x4a3c2a;});}})['then'](respondWithResult(_0x215d83,null))['catch'](handleError(_0x215d83,null));};exports[_0x3e27('0x11f')]=function(_0x1bb431,_0x249eed,_0x250cdc){return db[_0x3e27('0x56')][_0x3e27('0x61')]({'where':{'id':_0x1bb431[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x249eed,null))[_0x3e27('0x33')](function(_0x497445){if(_0x497445){return _0x497445[_0x3e27('0x11f')](_0x1bb431[_0x3e27('0x44')][_0x3e27('0x6e')])[_0x3e27('0x33')](function(){if(_[_0x3e27('0x120')](_0x1bb431[_0x3e27('0x44')][_0x3e27('0x6e')])){for(var _0x4393aa=0x0;_0x4393aa<_0x1bb431[_0x3e27('0x44')][_0x3e27('0x6e')][_0x3e27('0x49')];_0x4393aa+=0x1){socket[_0x3e27('0x121')](_0x3e27('0x122'),{'UserId':Number(_0x1bb431[_0x3e27('0x44')][_0x3e27('0x6e')][_0x4393aa]),'ChatWebsiteId':Number(_0x1bb431[_0x3e27('0x59')]['id'])});}}else{socket[_0x3e27('0x121')](_0x3e27('0x122'),{'UserId':Number(_0x1bb431[_0x3e27('0x44')][_0x3e27('0x6e')]),'ChatWebsiteId':Number(_0x1bb431[_0x3e27('0x59')]['id'])});}});}})[_0x3e27('0x33')](respondWithStatusCode(_0x249eed,null))[_0x3e27('0x27')](handleError(_0x249eed,null));};exports[_0x3e27('0x123')]=function(_0x5935c4,_0x142d14,_0x31774e){var _0x5d5cd4={};var _0x3c13ca={};var _0x5da016;var _0xe0a296;return db[_0x3e27('0x56')][_0x3e27('0x6c')]({'where':{'id':_0x5935c4[_0x3e27('0x59')]['id']}})[_0x3e27('0x33')](handleEntityNotFound(_0x142d14,null))[_0x3e27('0x33')](function(_0x34449e){if(_0x34449e){_0x5da016=_0x34449e;_0x3c13ca[_0x3e27('0x43')]=_[_0x3e27('0x5a')](db[_0x3e27('0xee')][_0x3e27('0x3f')]);_0x3c13ca[_0x3e27('0x44')]=_[_0x3e27('0x5a')](_0x5935c4['query']);_0x3c13ca[_0x3e27('0x45')]=_[_0x3e27('0x46')](_0x3c13ca[_0x3e27('0x43')],_0x3c13ca[_0x3e27('0x44')]);_0x5d5cd4[_0x3e27('0x47')]=_['intersection'](_0x3c13ca[_0x3e27('0x43')],qs['fields'](_0x5935c4['query'][_0x3e27('0x48')]));_0x5d5cd4[_0x3e27('0x47')]=_0x5d5cd4[_0x3e27('0x47')]['length']?_0x5d5cd4[_0x3e27('0x47')]:_0x3c13ca[_0x3e27('0x43')];_0x5d5cd4[_0x3e27('0x4c')]=qs['sort'](_0x5935c4[_0x3e27('0x44')][_0x3e27('0x4d')]);_0x5d5cd4[_0x3e27('0x4e')]=qs[_0x3e27('0x45')](_['pick'](_0x5935c4['query'],_0x3c13ca[_0x3e27('0x45')]));if(_0x5935c4[_0x3e27('0x44')][_0x3e27('0x51')]){_0x5d5cd4[_0x3e27('0x4e')]=_[_0x3e27('0x4f')](_0x5d5cd4[_0x3e27('0x4e')],{'$or':_[_0x3e27('0x3e')](_0x5d5cd4[_0x3e27('0x47')],function(_0x553358){var _0x3804f7={};_0x3804f7[_0x553358]={'$like':'%'+_0x5935c4[_0x3e27('0x44')][_0x3e27('0x51')]+'%'};return _0x3804f7;})});}_0x5d5cd4=_[_0x3e27('0x4f')]({},_0x5d5cd4,_0x5935c4[_0x3e27('0x52')]);return _0x5da016['getAgents'](_0x5d5cd4);}})[_0x3e27('0x33')](function(_0x30f62b){if(_0x30f62b){_0xe0a296=_0x30f62b['length'];if(!_0x5935c4[_0x3e27('0x44')][_0x3e27('0x4a')](_0x3e27('0x4b'))){_0x5d5cd4[_0x3e27('0x2c')]=qs[_0x3e27('0x2c')](_0x5935c4[_0x3e27('0x44')][_0x3e27('0x2c')]);_0x5d5cd4['offset']=qs[_0x3e27('0x2b')](_0x5935c4[_0x3e27('0x44')][_0x3e27('0x2b')]);}return _0x5da016[_0x3e27('0x123')](_0x5d5cd4);}})[_0x3e27('0x33')](function(_0x7fca0){if(_0x7fca0){return _0x7fca0?{'count':_0xe0a296,'rows':_0x7fca0}:null;}})[_0x3e27('0x33')](respondWithResult(_0x142d14,null))[_0x3e27('0x27')](handleError(_0x142d14,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 38e7ef5..b7ea905 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 _0xbe22=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xbe22,0x1c1));var _0x2be2=function(_0x203c68,_0x7497d3){_0x203c68=_0x203c68-0x0;var _0x112d8f=_0xbe22[_0x203c68];return _0x112d8f;};'use strict';var EventEmitter=require(_0x2be2('0x0'));var ChatWebsite=require(_0x2be2('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2be2('0x2'),'afterUpdate':_0x2be2('0x3'),'afterDestroy':_0x2be2('0x4')};function emitEvent(_0x409a41){return function(_0x1729d7,_0x250c97,_0x3693e2){ChatWebsiteEvents[_0x2be2('0x5')](_0x409a41+':'+_0x1729d7['id'],_0x1729d7);ChatWebsiteEvents[_0x2be2('0x5')](_0x409a41,_0x1729d7);_0x3693e2(null);};}for(var e in events){if(events[_0x2be2('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x2be2('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x7764=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7764,0xa4));var _0x4776=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x7764[_0x3635ce];return _0x97ecd0;};'use strict';var EventEmitter=require(_0x4776('0x0'));var ChatWebsite=require(_0x4776('0x1'))['db'][_0x4776('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x4776('0x3')](0x0);var events={'afterCreate':_0x4776('0x4'),'afterUpdate':_0x4776('0x5'),'afterDestroy':_0x4776('0x6')};function emitEvent(_0x424a79){return function(_0x3b28ba,_0x1f5638,_0x5ab4c2){ChatWebsiteEvents['emit'](_0x424a79+':'+_0x3b28ba['id'],_0x3b28ba);ChatWebsiteEvents[_0x4776('0x7')](_0x424a79,_0x3b28ba);_0x5ab4c2(null);};}for(var e in events){if(events[_0x4776('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x4776('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index cc78240..c25365e 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 _0x9d9b=['rimraf','./chatWebsite.attributes','ChatWebsite','chat_websites','util','../../config/logger','moment','request-promise','path'];(function(_0x3fdb6b,_0x5891f9){var _0x1ad287=function(_0x476783){while(--_0x476783){_0x3fdb6b['push'](_0x3fdb6b['shift']());}};_0x1ad287(++_0x5891f9);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x952ea0,_0x4fd4a6){_0x952ea0=_0x952ea0-0x0;var _0x40555f=_0x9d9b[_0x952ea0];return _0x40555f;};'use strict';var _=require('lodash');var util=require(_0xb9d9('0x0'));var logger=require(_0xb9d9('0x1'))('api');var moment=require(_0xb9d9('0x2'));var BPromise=require('bluebird');var rp=require(_0xb9d9('0x3'));var fs=require('fs');var path=require(_0xb9d9('0x4'));var rimraf=require(_0xb9d9('0x5'));var config=require('../../config/environment');var attributes=require(_0xb9d9('0x6'));module['exports']=function(_0x1b1f3c,_0x32cf18){return _0x1b1f3c['define'](_0xb9d9('0x7'),attributes,{'tableName':_0xb9d9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x777d=['./chatWebsite.attributes','define','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3ea2e5,_0x1001dd){var _0x2d2e9e=function(_0xaf12e7){while(--_0xaf12e7){_0x3ea2e5['push'](_0x3ea2e5['shift']());}};_0x2d2e9e(++_0x1001dd);}(_0x777d,0xe9));var _0xd777=function(_0x22889a,_0x4b75f7){_0x22889a=_0x22889a-0x0;var _0x763d34=_0x777d[_0x22889a];return _0x763d34;};'use strict';var _=require('lodash');var util=require(_0xd777('0x0'));var logger=require(_0xd777('0x1'))(_0xd777('0x2'));var moment=require('moment');var BPromise=require(_0xd777('0x3'));var rp=require(_0xd777('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd777('0x5'));module['exports']=function(_0x253dc1,_0x51e918){return _0x253dc1[_0xd777('0x6')]('ChatWebsite',attributes,{'tableName':'chat_websites','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 54d591b..830549b 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 _0x5f66=['debug','request\x20sent','stringify','error','code','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','then','ChatWebsite,\x20%s,\x20%s'];(function(_0x129124,_0x13adc4){var _0x3dd47e=function(_0xb9deec){while(--_0xb9deec){_0x129124['push'](_0x129124['shift']());}};_0x3dd47e(++_0x13adc4);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});} \ No newline at end of file +var _0xafc4=['error','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x9a866d,_0x2cb40d){var _0x39c53c=function(_0xb77380){while(--_0xb77380){_0x9a866d['push'](_0x9a866d['shift']());}};_0x39c53c(++_0x2cb40d);}(_0xafc4,0x69));var _0x4afc=function(_0x22e22e,_0x54c6fc){_0x22e22e=_0x22e22e-0x0;var _0x10a02a=_0xafc4[_0x22e22e];return _0x10a02a;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});config[_0x4afc('0x9')]=_[_0x4afc('0xa')](config[_0x4afc('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4afc('0xb'))(new Redis(config[_0x4afc('0x9')]));require(_0x4afc('0xc'))[_0x4afc('0xd')](socket);function respondWithRpcPromise(_0x1b8981,_0x458fde,_0x5542ec){return new BPromise(function(_0x5c523b,_0x7f127f){return client['request'](_0x1b8981,_0x5542ec)[_0x4afc('0xe')](function(_0x225793){logger['info'](_0x4afc('0xf'),_0x458fde,_0x4afc('0x10'));logger[_0x4afc('0x11')](_0x4afc('0x12'),_0x458fde,_0x4afc('0x10'),JSON[_0x4afc('0x13')](_0x225793));if(_0x225793[_0x4afc('0x14')]){if(_0x225793[_0x4afc('0x14')]['code']===0x1f4){logger[_0x4afc('0x14')](_0x4afc('0xf'),_0x458fde,_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);return _0x7f127f(_0x225793['error']['message']);}logger[_0x4afc('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x458fde,_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);return _0x5c523b(_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);}else{logger[_0x4afc('0x16')](_0x4afc('0xf'),_0x458fde,_0x4afc('0x10'));_0x5c523b(_0x225793[_0x4afc('0x17')][_0x4afc('0x15')]);}})[_0x4afc('0x18')](function(_0x178229){logger['error'](_0x4afc('0xf'),_0x458fde,_0x178229);_0x7f127f(_0x178229);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 137e4cb..1323b52 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x4c5eaf,_0x8364ab){var _0x7cc2e5=function(_0x1b44c7){while(--_0x1b44c7){_0x4c5eaf['push'](_0x4c5eaf['shift']());}};_0x7cc2e5(++_0x8364ab);}(_0x7a54,0x106));var _0x47a5=function(_0x28dbee,_0x19e994){_0x28dbee=_0x28dbee-0x0;var _0xe14ac3=_0x7a54[_0x28dbee];return _0xe14ac3;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x126af7,_0x25fa06){var _0x25b500=function(_0x10ffe7){while(--_0x10ffe7){_0x126af7['push'](_0x126af7['shift']());}};_0x25b500(++_0x25fa06);}(_0xb10b,0x12a));var _0xbb10=function(_0x5906a5,_0x48af0a){_0x5906a5=_0x5906a5-0x0;var _0x1b9a31=_0xb10b[_0x5906a5];return _0x1b9a31;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 0e395fa..b122386 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 _0xb76a=['/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','express','Router','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','create','addDisposition','post','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addApplications','/:id/proactive_actions'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xb76a,0x1e4));var _0xab76=function(_0x306366,_0x3840bd){_0x306366=_0x306366-0x0;var _0x4cd167=_0xb76a[_0x306366];return _0x4cd167;};'use strict';var multer=require(_0xab76('0x0'));var util=require(_0xab76('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xab76('0x2'));var router=express[_0xab76('0x3')]();var auth=require(_0xab76('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xab76('0x5'));var controller=require(_0xab76('0x6'));router[_0xab76('0x7')]('/',auth[_0xab76('0x8')](),controller[_0xab76('0x9')]);router[_0xab76('0x7')](_0xab76('0xa'),auth[_0xab76('0x8')](),controller[_0xab76('0xb')]);router[_0xab76('0x7')](_0xab76('0xc'),auth[_0xab76('0x8')](),controller[_0xab76('0xd')]);router[_0xab76('0x7')](_0xab76('0xe'),auth[_0xab76('0x8')](),controller[_0xab76('0xf')]);router['get'](_0xab76('0x10'),auth['isAuthenticated'](),controller[_0xab76('0x11')]);router[_0xab76('0x7')](_0xab76('0x12'),controller[_0xab76('0x13')]);router[_0xab76('0x7')]('/:id/avatar',controller[_0xab76('0x14')]);router[_0xab76('0x7')](_0xab76('0x15'),controller[_0xab76('0x16')]);router['get'](_0xab76('0x17'),controller[_0xab76('0x18')]);router[_0xab76('0x7')](_0xab76('0x19'),auth[_0xab76('0x8')](),controller[_0xab76('0x1a')]);router[_0xab76('0x7')](_0xab76('0x1b'),controller[_0xab76('0x1c')]);router[_0xab76('0x7')](_0xab76('0x1d'),auth[_0xab76('0x8')](),controller[_0xab76('0x1e')]);router['get']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xab76('0x1f')]);router[_0xab76('0x7')](_0xab76('0x20'),controller[_0xab76('0x21')]);router[_0xab76('0x7')](_0xab76('0x22'),auth['isAuthenticated'](),controller[_0xab76('0x23')]);router['get']('/:id/users',auth[_0xab76('0x8')](),controller['getAgents']);router['post']('/',auth[_0xab76('0x8')](),controller[_0xab76('0x24')]);router['post'](_0xab76('0xe'),auth[_0xab76('0x8')](),controller[_0xab76('0x25')]);router[_0xab76('0x26')](_0xab76('0x10'),auth['isAuthenticated'](),controller[_0xab76('0x27')]);var upload=multer({'storage':multer[_0xab76('0x28')]({'destination':function(_0x28162d,_0xe3db99,_0xf9a25b){_0xf9a25b(null,path[_0xab76('0x29')](config[_0xab76('0x2a')],_0xab76('0x2b')));},'filename':function(_0x50e8c9,_0x11a1a5,_0x550ff3){_0x550ff3(null,util[_0xab76('0x2c')]('%s-%s',Date[_0xab76('0x2d')](),_0x11a1a5[_0xab76('0x2e')]));}})});router['post']('/:id/logo',upload[_0xab76('0x2f')](_0xab76('0x30')),controller[_0xab76('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ce7fc,_0x1547e4,_0x33900b){_0x33900b(null,path['join'](config['root'],_0xab76('0x32')));},'filename':function(_0x3ccb6f,_0x40bcd9,_0x2cc2bc){_0x2cc2bc(null,util[_0xab76('0x2c')]('%s-%s',Date[_0xab76('0x2d')](),_0x40bcd9[_0xab76('0x2e')]));}})});router[_0xab76('0x26')]('/:id/avatar',upload[_0xab76('0x2f')](_0xab76('0x30')),controller[_0xab76('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5309e9,_0x538e47,_0x284cbc){_0x284cbc(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x57e27b,_0x4a2836,_0x26af56){_0x26af56(null,util[_0xab76('0x2c')]('%s-%s',Date[_0xab76('0x2d')](),_0x4a2836['originalname']));}})});router['post'](_0xab76('0x15'),upload['single']('file'),controller[_0xab76('0x34')]);var upload=multer({'storage':multer[_0xab76('0x28')]({'destination':function(_0x3afb6b,_0x757549,_0x39e265){_0x39e265(null,path[_0xab76('0x29')](config['root'],_0xab76('0x32')));},'filename':function(_0x3fdaa7,_0x41f5d9,_0x2b5cd8){_0x2b5cd8(null,util[_0xab76('0x2c')]('%s-%s',Date[_0xab76('0x2d')](),_0x41f5d9[_0xab76('0x2e')]));}})});router[_0xab76('0x26')](_0xab76('0x17'),upload[_0xab76('0x2f')](_0xab76('0x30')),controller[_0xab76('0x35')]);router[_0xab76('0x26')](_0xab76('0x36'),controller[_0xab76('0x37')]);router[_0xab76('0x26')](_0xab76('0x38'),controller[_0xab76('0x39')]);router[_0xab76('0x26')](_0xab76('0x19'),auth[_0xab76('0x8')](),controller['addInteraction']);router[_0xab76('0x26')](_0xab76('0x1d'),auth['isAuthenticated'](),controller[_0xab76('0x3a')]);router[_0xab76('0x26')](_0xab76('0x3b'),auth[_0xab76('0x8')](),controller['addProactiveActions']);router[_0xab76('0x26')](_0xab76('0x3c'),auth[_0xab76('0x8')](),controller[_0xab76('0x3d')]);router[_0xab76('0x3e')](_0xab76('0xc'),auth['isAuthenticated'](),controller[_0xab76('0x3f')]);router[_0xab76('0x40')](_0xab76('0xc'),auth[_0xab76('0x8')](),controller['destroy']);router[_0xab76('0x40')](_0xab76('0xe'),auth[_0xab76('0x8')](),controller[_0xab76('0x41')]);router[_0xab76('0x40')]('/:id/canned_answers',auth[_0xab76('0x8')](),controller[_0xab76('0x42')]);router[_0xab76('0x40')](_0xab76('0x3c'),auth[_0xab76('0x8')](),controller[_0xab76('0x43')]);module['exports']=router; \ No newline at end of file +var _0xda18=['/:id/customer_avatar','addCustomerAvatar','originalname','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','/:id/offline','addInteraction','addApplications','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','root','format','%s-%s','single','file','join','server/files/images/avatars/','now','addAvatar'];(function(_0x554af3,_0x570447){var _0x3670ef=function(_0x438bb2){while(--_0x438bb2){_0x554af3['push'](_0x554af3['shift']());}};_0x3670ef(++_0x570447);}(_0xda18,0x95));var _0x8da1=function(_0x14cf91,_0x390144){_0x14cf91=_0x14cf91-0x0;var _0x36e2ab=_0xda18[_0x14cf91];return _0x36e2ab;};'use strict';var multer=require('multer');var util=require(_0x8da1('0x0'));var path=require('path');var timeout=require(_0x8da1('0x1'));var express=require(_0x8da1('0x2'));var router=express[_0x8da1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8da1('0x4'));var config=require(_0x8da1('0x5'));var controller=require(_0x8da1('0x6'));router[_0x8da1('0x7')]('/',auth[_0x8da1('0x8')](),controller['index']);router[_0x8da1('0x7')](_0x8da1('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x8da1('0x7')](_0x8da1('0xa'),auth[_0x8da1('0x8')](),controller[_0x8da1('0xb')]);router['get'](_0x8da1('0xc'),auth[_0x8da1('0x8')](),controller[_0x8da1('0xd')]);router[_0x8da1('0x7')](_0x8da1('0xe'),auth[_0x8da1('0x8')](),controller[_0x8da1('0xf')]);router[_0x8da1('0x7')](_0x8da1('0x10'),controller['getLogo']);router[_0x8da1('0x7')](_0x8da1('0x11'),controller[_0x8da1('0x12')]);router[_0x8da1('0x7')]('/:id/customer_avatar',controller[_0x8da1('0x13')]);router['get']('/:id/system_avatar',controller[_0x8da1('0x14')]);router[_0x8da1('0x7')](_0x8da1('0x15'),auth[_0x8da1('0x8')](),controller[_0x8da1('0x16')]);router['get'](_0x8da1('0x17'),controller[_0x8da1('0x18')]);router['get'](_0x8da1('0x19'),auth[_0x8da1('0x8')](),controller[_0x8da1('0x1a')]);router[_0x8da1('0x7')](_0x8da1('0x1b'),auth['isAuthenticated'](),controller['getProactiveActions']);router[_0x8da1('0x7')](_0x8da1('0x1c'),controller[_0x8da1('0x1d')]);router['get']('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x8da1('0x1e')]);router[_0x8da1('0x7')](_0x8da1('0x1f'),auth[_0x8da1('0x8')](),controller[_0x8da1('0x20')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8da1('0x21')](_0x8da1('0xc'),auth[_0x8da1('0x8')](),controller[_0x8da1('0x22')]);router['post'](_0x8da1('0xe'),auth[_0x8da1('0x8')](),controller[_0x8da1('0x23')]);var upload=multer({'storage':multer[_0x8da1('0x24')]({'destination':function(_0x582c21,_0x28daf1,_0x4cf21e){_0x4cf21e(null,path['join'](config[_0x8da1('0x25')],'server/files/images/logos/'));},'filename':function(_0x701591,_0x3e57c6,_0xcd3a05){_0xcd3a05(null,util[_0x8da1('0x26')](_0x8da1('0x27'),Date['now'](),_0x3e57c6['originalname']));}})});router[_0x8da1('0x21')](_0x8da1('0x10'),upload[_0x8da1('0x28')](_0x8da1('0x29')),controller['addLogo']);var upload=multer({'storage':multer[_0x8da1('0x24')]({'destination':function(_0x548b6b,_0x55cd6d,_0x317b03){_0x317b03(null,path[_0x8da1('0x2a')](config['root'],_0x8da1('0x2b')));},'filename':function(_0x16a229,_0xb6d926,_0xbfff70){_0xbfff70(null,util[_0x8da1('0x26')]('%s-%s',Date[_0x8da1('0x2c')](),_0xb6d926['originalname']));}})});router['post']('/:id/avatar',upload[_0x8da1('0x28')](_0x8da1('0x29')),controller[_0x8da1('0x2d')]);var upload=multer({'storage':multer[_0x8da1('0x24')]({'destination':function(_0x34938f,_0x11f118,_0x3d6893){_0x3d6893(null,path[_0x8da1('0x2a')](config[_0x8da1('0x25')],'server/files/images/avatars/'));},'filename':function(_0x570851,_0x521f4e,_0x4b861c){_0x4b861c(null,util[_0x8da1('0x26')](_0x8da1('0x27'),Date[_0x8da1('0x2c')](),_0x521f4e['originalname']));}})});router[_0x8da1('0x21')](_0x8da1('0x2e'),upload[_0x8da1('0x28')](_0x8da1('0x29')),controller[_0x8da1('0x2f')]);var upload=multer({'storage':multer[_0x8da1('0x24')]({'destination':function(_0xf84598,_0x5017c7,_0x2feba2){_0x2feba2(null,path[_0x8da1('0x2a')](config[_0x8da1('0x25')],_0x8da1('0x2b')));},'filename':function(_0x184e57,_0x3829df,_0x3ce03a){_0x3ce03a(null,util[_0x8da1('0x26')](_0x8da1('0x27'),Date[_0x8da1('0x2c')](),_0x3829df[_0x8da1('0x30')]));}})});router[_0x8da1('0x21')](_0x8da1('0x31'),upload[_0x8da1('0x28')](_0x8da1('0x29')),controller[_0x8da1('0x32')]);router[_0x8da1('0x21')](_0x8da1('0x33'),controller[_0x8da1('0x34')]);router[_0x8da1('0x21')](_0x8da1('0x35'),controller['offline']);router[_0x8da1('0x21')](_0x8da1('0x15'),auth[_0x8da1('0x8')](),controller[_0x8da1('0x36')]);router[_0x8da1('0x21')](_0x8da1('0x19'),auth[_0x8da1('0x8')](),controller[_0x8da1('0x37')]);router[_0x8da1('0x21')](_0x8da1('0x1b'),auth[_0x8da1('0x8')](),controller[_0x8da1('0x38')]);router['post'](_0x8da1('0x1f'),auth[_0x8da1('0x8')](),controller[_0x8da1('0x39')]);router['put'](_0x8da1('0xa'),auth[_0x8da1('0x8')](),controller[_0x8da1('0x3a')]);router[_0x8da1('0x3b')]('/:id',auth[_0x8da1('0x8')](),controller[_0x8da1('0x3c')]);router[_0x8da1('0x3b')](_0x8da1('0xc'),auth['isAuthenticated'](),controller[_0x8da1('0x3d')]);router[_0x8da1('0x3b')](_0x8da1('0xe'),auth[_0x8da1('0x8')](),controller[_0x8da1('0x3e')]);router[_0x8da1('0x3b')](_0x8da1('0x1f'),auth[_0x8da1('0x8')](),controller[_0x8da1('0x3f')]);module[_0x8da1('0x40')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 4918e7e..379f0e6 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 _0xf88f=['exports','STRING','ENUM','AmazonAWS','Google','sequelize'];(function(_0x8693d1,_0x2b3e74){var _0x537cb4=function(_0x3a7f19){while(--_0x3a7f19){_0x8693d1['push'](_0x8693d1['shift']());}};_0x537cb4(++_0x2b3e74);}(_0xf88f,0x1bb));var _0xff88=function(_0x2fc258,_0x342ab0){_0x2fc258=_0x2fc258-0x0;var _0x46b5f4=_0xf88f[_0x2fc258];return _0x46b5f4;};'use strict';var Sequelize=require(_0xff88('0x0'));module[_0xff88('0x1')]={'name':{'type':Sequelize[_0xff88('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xff88('0x3')](_0xff88('0x4'),_0xff88('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xff88('0x2')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7ae=['STRING','ENUM','AmazonAWS','sequelize','exports'];(function(_0x3e05b7,_0x3b5fc1){var _0xda665e=function(_0x349f00){while(--_0x349f00){_0x3e05b7['push'](_0x3e05b7['shift']());}};_0xda665e(++_0x3b5fc1);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x2c391a,_0x551059){_0x2c391a=_0x2c391a-0x0;var _0x56380e=_0xb7ae[_0x2c391a];return _0x56380e;};'use strict';var Sequelize=require(_0xeb7a('0x0'));module[_0xeb7a('0x1')]={'name':{'type':Sequelize[_0xeb7a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xeb7a('0x3')](_0xeb7a('0x4'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xeb7a('0x2')]},'data2':{'type':Sequelize[_0xeb7a('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 089f423..7a85df3 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 _0x8703=['html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','CloudProvider','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x8703,0x92));var _0x3870=function(_0x567f6d,_0xdd7051){_0x567f6d=_0x567f6d-0x0;var _0x312205=_0x8703[_0x567f6d];return _0x312205;};'use strict';var pdf=require(_0x3870('0x0'));var emlformat=require(_0x3870('0x1'));var rimraf=require(_0x3870('0x2'));var zipdir=require(_0x3870('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3870('0x4'));var moment=require('moment');var BPromise=require(_0x3870('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3870('0x6'));var sox=require(_0x3870('0x7'));var csv=require(_0x3870('0x8'));var ejs=require(_0x3870('0x9'));var fs=require('fs');var _=require(_0x3870('0xa'));var squel=require(_0x3870('0xb'));var crypto=require('crypto');var jsforce=require(_0x3870('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3870('0xd'));var Redis=require(_0x3870('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3870('0xf'));var as=require(_0x3870('0x10'));var hardwareService=require(_0x3870('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x3870('0x12'));var config=require(_0x3870('0x13'));var licenseUtil=require(_0x3870('0x14'));var db=require(_0x3870('0x15'))['db'];function respondWithStatusCode(_0x32fe51,_0x5b24e4){_0x5b24e4=_0x5b24e4||0xcc;return function(_0x1b9dce){if(_0x1b9dce){return _0x32fe51[_0x3870('0x16')](_0x5b24e4);}return _0x32fe51['status'](_0x5b24e4)['end']();};}function respondWithResult(_0x5e6091,_0x13fd34){_0x13fd34=_0x13fd34||0xc8;return function(_0x133f60){if(_0x133f60){return _0x5e6091[_0x3870('0x17')](_0x13fd34)[_0x3870('0x18')](_0x133f60);}};}function respondWithFilteredResult(_0x4581df,_0x4db130){return function(_0x32d53d){if(_0x32d53d){var _0xfbd263=_0x32d53d[_0x3870('0x19')],_0x5bbd3a=_0x4db130[_0x3870('0x1a')],_0x573321=_0x4db130[_0x3870('0x1a')]+_0x4db130[_0x3870('0x1b')],_0x201ef9;if(_0x573321>=_0xfbd263){_0x573321=_0xfbd263;_0x201ef9=0xc8;}else{_0x201ef9=0xce;}_0x4581df[_0x3870('0x17')](_0x201ef9);return _0x4581df[_0x3870('0x1c')]('Content-Range',_0x5bbd3a+'-'+_0x573321+'/'+_0xfbd263)[_0x3870('0x18')](_0x32d53d);}return null;};}function patchUpdates(_0x4cf1fd){return function(_0xb62fc3){try{jsonpatch[_0x3870('0x1d')](_0xb62fc3,_0x4cf1fd,!![]);}catch(_0x476533){return BPromise[_0x3870('0x1e')](_0x476533);}return _0xb62fc3['save']();};}function saveUpdates(_0x13a8f,_0x2f2e5c){return function(_0x4f342c){if(_0x4f342c){return _0x4f342c[_0x3870('0x1f')](_0x13a8f)['then'](function(_0x10d3b2){return _0x10d3b2;});}return null;};}function removeEntity(_0x42194c,_0x4d518e){return function(_0xa4c053){if(_0xa4c053){return _0xa4c053[_0x3870('0x20')]()[_0x3870('0x21')](function(){_0x42194c['status'](0xcc)[_0x3870('0x22')]();});}};}function handleEntityNotFound(_0x26b5bd,_0x2a77f7){return function(_0x5a156e){if(!_0x5a156e){_0x26b5bd[_0x3870('0x16')](0x194);}return _0x5a156e;};}function handleError(_0x1c6a6d,_0x500b34){_0x500b34=_0x500b34||0x1f4;return function(_0x34010e){logger[_0x3870('0x23')](_0x34010e[_0x3870('0x24')]);if(_0x34010e['name']){delete _0x34010e[_0x3870('0x25')];}_0x1c6a6d['status'](_0x500b34)[_0x3870('0x26')](_0x34010e);};}exports[_0x3870('0x27')]=function(_0x465bec,_0x5ccd55){var _0x3f7e51={},_0x572ae4={},_0x467bb4={'count':0x0,'rows':[]};var _0x4897c8=_[_0x3870('0x28')](db[_0x3870('0x29')][_0x3870('0x2a')],function(_0x313900){return{'name':_0x313900[_0x3870('0x2b')],'type':_0x313900[_0x3870('0x2c')]['key']};});_0x572ae4[_0x3870('0x2d')]=_[_0x3870('0x28')](_0x4897c8,'name');_0x572ae4[_0x3870('0x2e')]=_[_0x3870('0x2f')](_0x465bec[_0x3870('0x2e')]);_0x572ae4[_0x3870('0x30')]=_['intersection'](_0x572ae4[_0x3870('0x2d')],_0x572ae4[_0x3870('0x2e')]);_0x3f7e51[_0x3870('0x31')]=_[_0x3870('0x32')](_0x572ae4[_0x3870('0x2d')],qs[_0x3870('0x33')](_0x465bec['query'][_0x3870('0x33')]));_0x3f7e51[_0x3870('0x31')]=_0x3f7e51[_0x3870('0x31')][_0x3870('0x34')]?_0x3f7e51[_0x3870('0x31')]:_0x572ae4[_0x3870('0x2d')];if(!_0x465bec[_0x3870('0x2e')][_0x3870('0x35')](_0x3870('0x36'))){_0x3f7e51[_0x3870('0x1b')]=qs['limit'](_0x465bec[_0x3870('0x2e')]['limit']);_0x3f7e51[_0x3870('0x1a')]=qs[_0x3870('0x1a')](_0x465bec[_0x3870('0x2e')]['offset']);}_0x3f7e51[_0x3870('0x37')]=qs['sort'](_0x465bec[_0x3870('0x2e')][_0x3870('0x38')]);_0x3f7e51[_0x3870('0x39')]=qs['filters'](_[_0x3870('0x3a')](_0x465bec[_0x3870('0x2e')],_0x572ae4[_0x3870('0x30')]),_0x4897c8);if(_0x465bec[_0x3870('0x2e')]['filter']){_0x3f7e51[_0x3870('0x39')]=_[_0x3870('0x3b')](_0x3f7e51[_0x3870('0x39')],{'$or':_['map'](_0x4897c8,function(_0x3b8c2b){if(_0x3b8c2b[_0x3870('0x2c')]!==_0x3870('0x3c')){var _0x53511e={};_0x53511e[_0x3b8c2b['name']]={'$like':'%'+_0x465bec[_0x3870('0x2e')][_0x3870('0x3d')]+'%'};return _0x53511e;}})});}_0x3f7e51=_[_0x3870('0x3b')]({},_0x3f7e51,_0x465bec[_0x3870('0x3e')]);var _0x2dbfa6={'where':_0x3f7e51[_0x3870('0x39')]};return db[_0x3870('0x29')][_0x3870('0x19')](_0x2dbfa6)['then'](function(_0x3d68fd){_0x467bb4[_0x3870('0x19')]=_0x3d68fd;if(_0x465bec[_0x3870('0x2e')][_0x3870('0x3f')]){_0x3f7e51[_0x3870('0x40')]=[{'all':!![]}];}return db[_0x3870('0x29')][_0x3870('0x41')](_0x3f7e51);})[_0x3870('0x21')](function(_0xb749ff){_0x467bb4[_0x3870('0x42')]=_0xb749ff;return _0x467bb4;})[_0x3870('0x21')](respondWithFilteredResult(_0x5ccd55,_0x3f7e51))[_0x3870('0x43')](handleError(_0x5ccd55,null));};exports[_0x3870('0x44')]=function(_0xa38410,_0x49b7ff){var _0x3427e3={'raw':!![],'where':{'id':_0xa38410[_0x3870('0x45')]['id']}},_0x5ea01c={};_0x5ea01c[_0x3870('0x2d')]=_[_0x3870('0x2f')](db[_0x3870('0x29')][_0x3870('0x2a')]);_0x5ea01c['query']=_[_0x3870('0x2f')](_0xa38410['query']);_0x5ea01c[_0x3870('0x30')]=_[_0x3870('0x32')](_0x5ea01c[_0x3870('0x2d')],_0x5ea01c['query']);_0x3427e3[_0x3870('0x31')]=_['intersection'](_0x5ea01c[_0x3870('0x2d')],qs['fields'](_0xa38410[_0x3870('0x2e')][_0x3870('0x33')]));_0x3427e3['attributes']=_0x3427e3[_0x3870('0x31')][_0x3870('0x34')]?_0x3427e3['attributes']:_0x5ea01c[_0x3870('0x2d')];if(_0xa38410['query'][_0x3870('0x3f')]){_0x3427e3[_0x3870('0x40')]=[{'all':!![]}];}_0x3427e3=_[_0x3870('0x3b')]({},_0x3427e3,_0xa38410[_0x3870('0x3e')]);return db[_0x3870('0x29')][_0x3870('0x46')](_0x3427e3)[_0x3870('0x21')](handleEntityNotFound(_0x49b7ff,null))['then'](respondWithResult(_0x49b7ff,null))[_0x3870('0x43')](handleError(_0x49b7ff,null));};exports['create']=function(_0x288d6f,_0x382645){return db[_0x3870('0x29')][_0x3870('0x47')](_0x288d6f[_0x3870('0x48')],{})[_0x3870('0x21')](respondWithResult(_0x382645,0xc9))[_0x3870('0x43')](handleError(_0x382645,null));};exports[_0x3870('0x1f')]=function(_0x2c7ea9,_0x48b258){if(_0x2c7ea9[_0x3870('0x48')]['id']){delete _0x2c7ea9[_0x3870('0x48')]['id'];}return db[_0x3870('0x29')]['find']({'where':{'id':_0x2c7ea9[_0x3870('0x45')]['id']}})[_0x3870('0x21')](handleEntityNotFound(_0x48b258,null))[_0x3870('0x21')](saveUpdates(_0x2c7ea9[_0x3870('0x48')],null))[_0x3870('0x21')](respondWithResult(_0x48b258,null))[_0x3870('0x43')](handleError(_0x48b258,null));};exports[_0x3870('0x20')]=function(_0x277260,_0x3d6645){return db['CloudProvider'][_0x3870('0x46')]({'where':{'id':_0x277260[_0x3870('0x45')]['id']}})['then'](handleEntityNotFound(_0x3d6645,null))[_0x3870('0x21')](removeEntity(_0x3d6645,null))['catch'](handleError(_0x3d6645,null));}; \ No newline at end of file +var _0x0046=['fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','show','keys','rawAttributes','find','catch','create','body','params','destroy','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','Content-Range','apply','save','update','sendStatus','stack','send','map','CloudProvider','fieldName','type','key','name','query','filters','intersection','model','attributes'];(function(_0x4246a2,_0x56720c){var _0x1d143f=function(_0x254a57){while(--_0x254a57){_0x4246a2['push'](_0x4246a2['shift']());}};_0x1d143f(++_0x56720c);}(_0x0046,0x187));var _0x6004=function(_0x585a96,_0x324fe2){_0x585a96=_0x585a96-0x0;var _0x46ee9a=_0x0046[_0x585a96];return _0x46ee9a;};'use strict';var pdf=require(_0x6004('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6004('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6004('0x2'));var rp=require(_0x6004('0x3'));var moment=require('moment');var BPromise=require(_0x6004('0x4'));var Mustache=require(_0x6004('0x5'));var util=require(_0x6004('0x6'));var path=require(_0x6004('0x7'));var sox=require(_0x6004('0x8'));var csv=require(_0x6004('0x9'));var ejs=require(_0x6004('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6004('0xb'));var jsforce=require(_0x6004('0xc'));var deskjs=require(_0x6004('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6004('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6004('0xf'));var qs=require(_0x6004('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6004('0x11'));var logger=require(_0x6004('0x12'))(_0x6004('0x13'));var utils=require(_0x6004('0x14'));var config=require(_0x6004('0x15'));var licenseUtil=require(_0x6004('0x16'));var db=require(_0x6004('0x17'))['db'];function respondWithStatusCode(_0x4eaa9a,_0x12c349){_0x12c349=_0x12c349||0xcc;return function(_0x18d7e3){if(_0x18d7e3){return _0x4eaa9a['sendStatus'](_0x12c349);}return _0x4eaa9a['status'](_0x12c349)[_0x6004('0x18')]();};}function respondWithResult(_0x38d49d,_0x4cd691){_0x4cd691=_0x4cd691||0xc8;return function(_0x1bfe48){if(_0x1bfe48){return _0x38d49d[_0x6004('0x19')](_0x4cd691)[_0x6004('0x1a')](_0x1bfe48);}};}function respondWithFilteredResult(_0x1f6fcc,_0x209f82){return function(_0x5502a1){if(_0x5502a1){var _0x588269=_0x5502a1[_0x6004('0x1b')],_0x44c1c0=_0x209f82[_0x6004('0x1c')],_0x245b06=_0x209f82[_0x6004('0x1c')]+_0x209f82['limit'],_0x5eeb8f;if(_0x245b06>=_0x588269){_0x245b06=_0x588269;_0x5eeb8f=0xc8;}else{_0x5eeb8f=0xce;}_0x1f6fcc['status'](_0x5eeb8f);return _0x1f6fcc['set'](_0x6004('0x1d'),_0x44c1c0+'-'+_0x245b06+'/'+_0x588269)[_0x6004('0x1a')](_0x5502a1);}return null;};}function patchUpdates(_0x2f2847){return function(_0x553c43){try{jsonpatch[_0x6004('0x1e')](_0x553c43,_0x2f2847,!![]);}catch(_0x2598c6){return BPromise['reject'](_0x2598c6);}return _0x553c43[_0x6004('0x1f')]();};}function saveUpdates(_0x394773,_0x2f3162){return function(_0x39e734){if(_0x39e734){return _0x39e734[_0x6004('0x20')](_0x394773)['then'](function(_0x30c644){return _0x30c644;});}return null;};}function removeEntity(_0x517602,_0x2faa5c){return function(_0x5e4b56){if(_0x5e4b56){return _0x5e4b56['destroy']()['then'](function(){_0x517602[_0x6004('0x19')](0xcc)[_0x6004('0x18')]();});}};}function handleEntityNotFound(_0x5deec2,_0x5d88d4){return function(_0x5cf475){if(!_0x5cf475){_0x5deec2[_0x6004('0x21')](0x194);}return _0x5cf475;};}function handleError(_0x5ea97e,_0x1cff11){_0x1cff11=_0x1cff11||0x1f4;return function(_0x5333fb){logger['error'](_0x5333fb[_0x6004('0x22')]);if(_0x5333fb['name']){delete _0x5333fb['name'];}_0x5ea97e[_0x6004('0x19')](_0x1cff11)[_0x6004('0x23')](_0x5333fb);};}exports['index']=function(_0x4aa948,_0x102709){var _0xaad7fb={},_0x41017b={},_0x5252cb={'count':0x0,'rows':[]};var _0x3804b1=_[_0x6004('0x24')](db[_0x6004('0x25')]['rawAttributes'],function(_0x334715){return{'name':_0x334715[_0x6004('0x26')],'type':_0x334715[_0x6004('0x27')][_0x6004('0x28')]};});_0x41017b['model']=_[_0x6004('0x24')](_0x3804b1,_0x6004('0x29'));_0x41017b['query']=_['keys'](_0x4aa948[_0x6004('0x2a')]);_0x41017b[_0x6004('0x2b')]=_[_0x6004('0x2c')](_0x41017b[_0x6004('0x2d')],_0x41017b['query']);_0xaad7fb[_0x6004('0x2e')]=_[_0x6004('0x2c')](_0x41017b[_0x6004('0x2d')],qs['fields'](_0x4aa948[_0x6004('0x2a')][_0x6004('0x2f')]));_0xaad7fb['attributes']=_0xaad7fb[_0x6004('0x2e')][_0x6004('0x30')]?_0xaad7fb[_0x6004('0x2e')]:_0x41017b['model'];if(!_0x4aa948['query'][_0x6004('0x31')](_0x6004('0x32'))){_0xaad7fb[_0x6004('0x33')]=qs[_0x6004('0x33')](_0x4aa948[_0x6004('0x2a')][_0x6004('0x33')]);_0xaad7fb[_0x6004('0x1c')]=qs[_0x6004('0x1c')](_0x4aa948['query'][_0x6004('0x1c')]);}_0xaad7fb[_0x6004('0x34')]=qs[_0x6004('0x35')](_0x4aa948['query'][_0x6004('0x35')]);_0xaad7fb['where']=qs[_0x6004('0x2b')](_['pick'](_0x4aa948[_0x6004('0x2a')],_0x41017b[_0x6004('0x2b')]),_0x3804b1);if(_0x4aa948['query'][_0x6004('0x36')]){_0xaad7fb[_0x6004('0x37')]=_[_0x6004('0x38')](_0xaad7fb[_0x6004('0x37')],{'$or':_[_0x6004('0x24')](_0x3804b1,function(_0x6c675d){if(_0x6c675d[_0x6004('0x27')]!==_0x6004('0x39')){var _0x4579a0={};_0x4579a0[_0x6c675d['name']]={'$like':'%'+_0x4aa948[_0x6004('0x2a')]['filter']+'%'};return _0x4579a0;}})});}_0xaad7fb=_[_0x6004('0x38')]({},_0xaad7fb,_0x4aa948[_0x6004('0x3a')]);var _0x2da5c3={'where':_0xaad7fb[_0x6004('0x37')]};return db[_0x6004('0x25')][_0x6004('0x1b')](_0x2da5c3)[_0x6004('0x3b')](function(_0x1c37bb){_0x5252cb['count']=_0x1c37bb;if(_0x4aa948[_0x6004('0x2a')][_0x6004('0x3c')]){_0xaad7fb[_0x6004('0x3d')]=[{'all':!![]}];}return db[_0x6004('0x25')][_0x6004('0x3e')](_0xaad7fb);})['then'](function(_0x152ea1){_0x5252cb[_0x6004('0x3f')]=_0x152ea1;return _0x5252cb;})[_0x6004('0x3b')](respondWithFilteredResult(_0x102709,_0xaad7fb))['catch'](handleError(_0x102709,null));};exports[_0x6004('0x40')]=function(_0x3e2f8c,_0x2d26dc){var _0x7e675f={'raw':!![],'where':{'id':_0x3e2f8c['params']['id']}},_0x299055={};_0x299055[_0x6004('0x2d')]=_[_0x6004('0x41')](db[_0x6004('0x25')][_0x6004('0x42')]);_0x299055[_0x6004('0x2a')]=_[_0x6004('0x41')](_0x3e2f8c[_0x6004('0x2a')]);_0x299055[_0x6004('0x2b')]=_['intersection'](_0x299055[_0x6004('0x2d')],_0x299055[_0x6004('0x2a')]);_0x7e675f[_0x6004('0x2e')]=_[_0x6004('0x2c')](_0x299055['model'],qs[_0x6004('0x2f')](_0x3e2f8c[_0x6004('0x2a')][_0x6004('0x2f')]));_0x7e675f[_0x6004('0x2e')]=_0x7e675f[_0x6004('0x2e')][_0x6004('0x30')]?_0x7e675f['attributes']:_0x299055[_0x6004('0x2d')];if(_0x3e2f8c[_0x6004('0x2a')][_0x6004('0x3c')]){_0x7e675f['include']=[{'all':!![]}];}_0x7e675f=_['merge']({},_0x7e675f,_0x3e2f8c[_0x6004('0x3a')]);return db[_0x6004('0x25')][_0x6004('0x43')](_0x7e675f)[_0x6004('0x3b')](handleEntityNotFound(_0x2d26dc,null))[_0x6004('0x3b')](respondWithResult(_0x2d26dc,null))[_0x6004('0x44')](handleError(_0x2d26dc,null));};exports[_0x6004('0x45')]=function(_0x3d7728,_0x63aea5){return db['CloudProvider'][_0x6004('0x45')](_0x3d7728[_0x6004('0x46')],{})['then'](respondWithResult(_0x63aea5,0xc9))[_0x6004('0x44')](handleError(_0x63aea5,null));};exports[_0x6004('0x20')]=function(_0x241139,_0x4aec3d){if(_0x241139[_0x6004('0x46')]['id']){delete _0x241139[_0x6004('0x46')]['id'];}return db[_0x6004('0x25')]['find']({'where':{'id':_0x241139[_0x6004('0x47')]['id']}})[_0x6004('0x3b')](handleEntityNotFound(_0x4aec3d,null))['then'](saveUpdates(_0x241139['body'],null))[_0x6004('0x3b')](respondWithResult(_0x4aec3d,null))[_0x6004('0x44')](handleError(_0x4aec3d,null));};exports[_0x6004('0x48')]=function(_0x1c7a13,_0x1e7942){return db[_0x6004('0x25')]['find']({'where':{'id':_0x1c7a13['params']['id']}})[_0x6004('0x3b')](handleEntityNotFound(_0x1e7942,null))[_0x6004('0x3b')](removeEntity(_0x1e7942,null))[_0x6004('0x44')](handleError(_0x1e7942,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 0e75756..18a3064 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 _0x8aa0=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','CloudProvider','lodash','util','../../config/logger'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x8aa0,0x189));var _0x08aa=function(_0x2af7f0,_0x449088){_0x2af7f0=_0x2af7f0-0x0;var _0x31aea4=_0x8aa0[_0x2af7f0];return _0x31aea4;};'use strict';var _=require(_0x08aa('0x0'));var util=require(_0x08aa('0x1'));var logger=require(_0x08aa('0x2'))(_0x08aa('0x3'));var moment=require('moment');var BPromise=require(_0x08aa('0x4'));var rp=require(_0x08aa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x08aa('0x6'));var config=require(_0x08aa('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x08aa('0x8')]=function(_0x3ab0bf,_0x28ca71){return _0x3ab0bf[_0x08aa('0x9')](_0x08aa('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc732=['moment','bluebird','path','rimraf','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','util','../../config/logger','api'];(function(_0x2779ba,_0x29dfd3){var _0x5952ff=function(_0x9d0459){while(--_0x9d0459){_0x2779ba['push'](_0x2779ba['shift']());}};_0x5952ff(++_0x29dfd3);}(_0xc732,0x1ac));var _0x2c73=function(_0x11fe01,_0x219a67){_0x11fe01=_0x11fe01-0x0;var _0x3587bd=_0xc732[_0x11fe01];return _0x3587bd;};'use strict';var _=require(_0x2c73('0x0'));var util=require(_0x2c73('0x1'));var logger=require(_0x2c73('0x2'))(_0x2c73('0x3'));var moment=require(_0x2c73('0x4'));var BPromise=require(_0x2c73('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c73('0x6'));var rimraf=require(_0x2c73('0x7'));var config=require('../../config/environment');var attributes=require(_0x2c73('0x8'));module[_0x2c73('0x9')]=function(_0x1bd4ea,_0x386cd7){return _0x1bd4ea['define'](_0x2c73('0xa'),attributes,{'tableName':_0x2c73('0xb'),'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 c21354c..014405b 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 _0x7df4=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7df4,0x1a3));var _0x47df=function(_0x2995bf,_0x4e094d){_0x2995bf=_0x2995bf-0x0;var _0x290529=_0x7df4[_0x2995bf];return _0x290529;};'use strict';var _=require(_0x47df('0x0'));var util=require(_0x47df('0x1'));var moment=require(_0x47df('0x2'));var BPromise=require(_0x47df('0x3'));var rs=require(_0x47df('0x4'));var fs=require('fs');var Redis=require(_0x47df('0x5'));var db=require(_0x47df('0x6'))['db'];var utils=require(_0x47df('0x7'));var logger=require(_0x47df('0x8'))(_0x47df('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x47df('0xa')][_0x47df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x496ef0,_0x12be8d,_0x1ddb8e){return new BPromise(function(_0x51b107,_0xa2c5e1){return client['request'](_0x496ef0,_0x1ddb8e)[_0x47df('0xc')](function(_0x47ce38){logger[_0x47df('0xd')](_0x47df('0xe'),_0x12be8d,_0x47df('0xf'));logger[_0x47df('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x12be8d,_0x47df('0xf'),JSON[_0x47df('0x11')](_0x47ce38));if(_0x47ce38[_0x47df('0x12')]){if(_0x47ce38[_0x47df('0x12')]['code']===0x1f4){logger[_0x47df('0x12')](_0x47df('0xe'),_0x12be8d,_0x47ce38[_0x47df('0x12')]['message']);return _0xa2c5e1(_0x47ce38['error'][_0x47df('0x13')]);}logger['error'](_0x47df('0xe'),_0x12be8d,_0x47ce38[_0x47df('0x12')][_0x47df('0x13')]);return _0x51b107(_0x47ce38[_0x47df('0x12')]['message']);}else{logger['info'](_0x47df('0xe'),_0x12be8d,_0x47df('0xf'));_0x51b107(_0x47ce38[_0x47df('0x14')][_0x47df('0x13')]);}})[_0x47df('0x15')](function(_0x27056b){logger[_0x47df('0x12')](_0x47df('0xe'),_0x12be8d,_0x27056b);_0xa2c5e1(_0x27056b);});});} \ No newline at end of file +var _0xf348=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x4296b3,_0x58c241){var _0x146ad8=function(_0x2e5079){while(--_0x2e5079){_0x4296b3['push'](_0x4296b3['shift']());}};_0x146ad8(++_0x58c241);}(_0xf348,0xbe));var _0x8f34=function(_0x2b8f18,_0x889992){_0x2b8f18=_0x2b8f18-0x0;var _0x332a6a=_0xf348[_0x2b8f18];return _0x332a6a;};'use strict';var _=require(_0x8f34('0x0'));var util=require(_0x8f34('0x1'));var moment=require(_0x8f34('0x2'));var BPromise=require(_0x8f34('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f34('0x4'))['db'];var utils=require(_0x8f34('0x5'));var logger=require('../../config/logger')(_0x8f34('0x6'));var config=require(_0x8f34('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8f34('0x8')][_0x8f34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x354aca,_0x4e9c10,_0x1604af){return new BPromise(function(_0x1abc88,_0x58caa8){return client['request'](_0x354aca,_0x1604af)[_0x8f34('0xa')](function(_0x5138e1){logger['info'](_0x8f34('0xb'),_0x4e9c10,_0x8f34('0xc'));logger[_0x8f34('0xd')](_0x8f34('0xe'),_0x4e9c10,_0x8f34('0xc'),JSON[_0x8f34('0xf')](_0x5138e1));if(_0x5138e1[_0x8f34('0x10')]){if(_0x5138e1[_0x8f34('0x10')][_0x8f34('0x11')]===0x1f4){logger[_0x8f34('0x10')](_0x8f34('0xb'),_0x4e9c10,_0x5138e1[_0x8f34('0x10')][_0x8f34('0x12')]);return _0x58caa8(_0x5138e1[_0x8f34('0x10')][_0x8f34('0x12')]);}logger[_0x8f34('0x10')](_0x8f34('0xb'),_0x4e9c10,_0x5138e1[_0x8f34('0x10')][_0x8f34('0x12')]);return _0x1abc88(_0x5138e1[_0x8f34('0x10')][_0x8f34('0x12')]);}else{logger[_0x8f34('0x13')](_0x8f34('0xb'),_0x4e9c10,'request\x20sent');_0x1abc88(_0x5138e1['result'][_0x8f34('0x12')]);}})[_0x8f34('0x14')](function(_0xcdfae){logger[_0x8f34('0x10')](_0x8f34('0xb'),_0x4e9c10,_0xcdfae);_0x58caa8(_0xcdfae);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index a9eb823..9d3db0a 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 _0x5ada=['multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','delete','/:id','destroy','exports'];(function(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0x5ada,0xa2));var _0xa5ad=function(_0x459d30,_0x4e010e){_0x459d30=_0x459d30-0x0;var _0x49526c=_0x5ada[_0x459d30];return _0x49526c;};'use strict';var multer=require(_0xa5ad('0x0'));var util=require(_0xa5ad('0x1'));var path=require('path');var timeout=require(_0xa5ad('0x2'));var express=require(_0xa5ad('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa5ad('0x4'));var config=require(_0xa5ad('0x5'));var controller=require(_0xa5ad('0x6'));router[_0xa5ad('0x7')]('/',auth[_0xa5ad('0x8')](),controller[_0xa5ad('0x9')]);router[_0xa5ad('0x7')]('/:id',auth[_0xa5ad('0x8')](),controller[_0xa5ad('0xa')]);router[_0xa5ad('0xb')]('/',auth['isAuthenticated'](),controller[_0xa5ad('0xc')]);router[_0xa5ad('0xd')]('/:id',auth[_0xa5ad('0x8')](),controller['update']);router[_0xa5ad('0xe')](_0xa5ad('0xf'),auth[_0xa5ad('0x8')](),controller[_0xa5ad('0x10')]);module[_0xa5ad('0x11')]=router; \ No newline at end of file +var _0x9717=['../../components/auth/service','../../config/environment','./cloudProvider.controller','get','index','/:id','show','create','put','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x38a3d6,_0x52e305){var _0x3768d7=function(_0x1af8a9){while(--_0x1af8a9){_0x38a3d6['push'](_0x38a3d6['shift']());}};_0x3768d7(++_0x52e305);}(_0x9717,0x1c2));var _0x7971=function(_0x4a842e,_0x3e2bef){_0x4a842e=_0x4a842e-0x0;var _0x1dc048=_0x9717[_0x4a842e];return _0x1dc048;};'use strict';var multer=require(_0x7971('0x0'));var util=require(_0x7971('0x1'));var path=require(_0x7971('0x2'));var timeout=require(_0x7971('0x3'));var express=require(_0x7971('0x4'));var router=express[_0x7971('0x5')]();var auth=require(_0x7971('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7971('0x7'));var controller=require(_0x7971('0x8'));router[_0x7971('0x9')]('/',auth['isAuthenticated'](),controller[_0x7971('0xa')]);router[_0x7971('0x9')](_0x7971('0xb'),auth['isAuthenticated'](),controller[_0x7971('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7971('0xd')]);router[_0x7971('0xe')](_0x7971('0xb'),auth[_0x7971('0xf')](),controller[_0x7971('0x10')]);router[_0x7971('0x11')](_0x7971('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7971('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index e7a8a4b..47bee2f 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 _0x88b9=['exports','name','STRING'];(function(_0x533f98,_0x2e45f7){var _0x4d3ccc=function(_0x490ff7){while(--_0x490ff7){_0x533f98['push'](_0x533f98['shift']());}};_0x4d3ccc(++_0x2e45f7);}(_0x88b9,0x13e));var _0x988b=function(_0x1292fd,_0x2c45c1){_0x1292fd=_0x1292fd-0x0;var _0x57fdfd=_0x88b9[_0x1292fd];return _0x57fdfd;};'use strict';var Sequelize=require('sequelize');module[_0x988b('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x988b('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x988b('0x2')]},'companyId':{'type':Sequelize[_0x988b('0x2')]},'website':{'type':Sequelize[_0x988b('0x2')]},'phone':{'type':Sequelize[_0x988b('0x2')]},'fax':{'type':Sequelize[_0x988b('0x2')]},'type':{'type':Sequelize[_0x988b('0x2')]},'street':{'type':Sequelize[_0x988b('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x988b('0x2')]},'country':{'type':Sequelize[_0x988b('0x2')]},'email':{'type':Sequelize[_0x988b('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x988b('0x2')]},'sStreet':{'type':Sequelize[_0x988b('0x2')]},'sPostalCode':{'type':Sequelize[_0x988b('0x2')]},'sCity':{'type':Sequelize[_0x988b('0x2')]},'sCountry':{'type':Sequelize[_0x988b('0x2')]},'description':{'type':Sequelize[_0x988b('0x2')]}}; \ No newline at end of file +var _0x40b1=['STRING','sequelize','exports','name'];(function(_0x534c8f,_0x500079){var _0x5a57f5=function(_0x38ec0a){while(--_0x38ec0a){_0x534c8f['push'](_0x534c8f['shift']());}};_0x5a57f5(++_0x500079);}(_0x40b1,0x1dd));var _0x140b=function(_0x3c5ac9,_0x1546e7){_0x3c5ac9=_0x3c5ac9-0x0;var _0x3107eb=_0x40b1[_0x3c5ac9];return _0x3107eb;};'use strict';var Sequelize=require(_0x140b('0x0'));module[_0x140b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x140b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x140b('0x3')]},'website':{'type':Sequelize[_0x140b('0x3')]},'phone':{'type':Sequelize[_0x140b('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x140b('0x3')]},'street':{'type':Sequelize[_0x140b('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x140b('0x3')]},'country':{'type':Sequelize[_0x140b('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x140b('0x3')]},'sPostalCode':{'type':Sequelize[_0x140b('0x3')]},'sCity':{'type':Sequelize[_0x140b('0x3')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 2df175f..2d8b9da 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 _0xf983=['addContacts','CmContact','ids','omit','getContacts','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','stack','name','index','CmCompany','describe','model','query','keys','attributes','intersection','fields','length','order','sort','where','filters','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','get','role','Companies','UserProfileSection','userProfileId','UserProfileResource','error','update','params'];(function(_0x3c7c71,_0x421b97){var _0x516c12=function(_0x34b991){while(--_0x34b991){_0x3c7c71['push'](_0x3c7c71['shift']());}};_0x516c12(++_0x421b97);}(_0xf983,0x1b0));var _0x3f98=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0xf983[_0x19b84f];return _0x18067b;};'use strict';var pdf=require(_0x3f98('0x0'));var emlformat=require(_0x3f98('0x1'));var rimraf=require(_0x3f98('0x2'));var zipdir=require(_0x3f98('0x3'));var jsonpatch=require(_0x3f98('0x4'));var rp=require(_0x3f98('0x5'));var moment=require(_0x3f98('0x6'));var BPromise=require(_0x3f98('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3f98('0x8'));var sox=require(_0x3f98('0x9'));var csv=require(_0x3f98('0xa'));var ejs=require(_0x3f98('0xb'));var fs=require('fs');var _=require(_0x3f98('0xc'));var squel=require(_0x3f98('0xd'));var crypto=require(_0x3f98('0xe'));var jsforce=require(_0x3f98('0xf'));var deskjs=require(_0x3f98('0x10'));var toCsv=require(_0x3f98('0xa'));var querystring=require(_0x3f98('0x11'));var Papa=require('papaparse');var Redis=require(_0x3f98('0x12'));var authService=require(_0x3f98('0x13'));var qs=require(_0x3f98('0x14'));var as=require(_0x3f98('0x15'));var hardwareService=require(_0x3f98('0x16'));var logger=require('../../config/logger')(_0x3f98('0x17'));var utils=require(_0x3f98('0x18'));var config=require(_0x3f98('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2597b2,_0x1313a9){_0x1313a9=_0x1313a9||0xcc;return function(_0x26cd84){if(_0x26cd84){return _0x2597b2[_0x3f98('0x1a')](_0x1313a9);}return _0x2597b2[_0x3f98('0x1b')](_0x1313a9)[_0x3f98('0x1c')]();};}function respondWithResult(_0x376228,_0x1bb5c7){_0x1bb5c7=_0x1bb5c7||0xc8;return function(_0x59f5c5){if(_0x59f5c5){return _0x376228[_0x3f98('0x1b')](_0x1bb5c7)[_0x3f98('0x1d')](_0x59f5c5);}};}function respondWithFilteredResult(_0x4f19f1,_0x5454c8){return function(_0x52b3e0){if(_0x52b3e0){var _0x2edb3a=_0x52b3e0[_0x3f98('0x1e')],_0x2ec340=_0x5454c8[_0x3f98('0x1f')],_0x353149=_0x5454c8['offset']+_0x5454c8[_0x3f98('0x20')],_0x19a170;if(_0x353149>=_0x2edb3a){_0x353149=_0x2edb3a;_0x19a170=0xc8;}else{_0x19a170=0xce;}_0x4f19f1[_0x3f98('0x1b')](_0x19a170);return _0x4f19f1['set'](_0x3f98('0x21'),_0x2ec340+'-'+_0x353149+'/'+_0x2edb3a)[_0x3f98('0x1d')](_0x52b3e0);}return null;};}function patchUpdates(_0x243cc9){return function(_0x58865b){try{jsonpatch['apply'](_0x58865b,_0x243cc9,!![]);}catch(_0x21ff06){return BPromise[_0x3f98('0x22')](_0x21ff06);}return _0x58865b[_0x3f98('0x23')]();};}function saveUpdates(_0x492d52,_0xe4765e){return function(_0x30c8c5){if(_0x30c8c5){return _0x30c8c5['update'](_0x492d52)[_0x3f98('0x24')](function(_0x12a829){return _0x12a829;});}return null;};}function removeEntity(_0x58e57a,_0xbfd5e4){return function(_0x58a2d0){if(_0x58a2d0){return _0x58a2d0[_0x3f98('0x25')]()[_0x3f98('0x24')](function(){var _0x1f2155=_0x58a2d0['get']({'plain':!![]});var _0x20c172='Companies';return db['UserProfileResource']['destroy']({'where':{'type':_0x20c172,'resourceId':_0x1f2155['id']}})['then'](function(){return _0x58a2d0;});})[_0x3f98('0x24')](function(){_0x58e57a[_0x3f98('0x1b')](0xcc)[_0x3f98('0x1c')]();});}};}function handleEntityNotFound(_0x80d328,_0x2c7b61){return function(_0x12c58e){if(!_0x12c58e){_0x80d328['sendStatus'](0x194);}return _0x12c58e;};}function handleError(_0x1e50df,_0x49765d){_0x49765d=_0x49765d||0x1f4;return function(_0x3e01bf){logger['error'](_0x3e01bf[_0x3f98('0x26')]);if(_0x3e01bf[_0x3f98('0x27')]){delete _0x3e01bf[_0x3f98('0x27')];}_0x1e50df[_0x3f98('0x1b')](_0x49765d)['send'](_0x3e01bf);};}exports[_0x3f98('0x28')]=function(_0x54ae13,_0x27948d){var _0x33d594={},_0x4cab9a={},_0x527e23={'count':0x0,'rows':[]};return db[_0x3f98('0x29')][_0x3f98('0x2a')]()[_0x3f98('0x24')](function(_0x581788){_0x4cab9a[_0x3f98('0x2b')]=_['keys'](_0x581788);_0x4cab9a[_0x3f98('0x2c')]=_[_0x3f98('0x2d')](_0x54ae13['query']);_0x4cab9a['filters']=_['intersection'](_0x4cab9a[_0x3f98('0x2b')],_0x4cab9a[_0x3f98('0x2c')]);_0x33d594[_0x3f98('0x2e')]=_[_0x3f98('0x2f')](_0x4cab9a[_0x3f98('0x2b')],qs[_0x3f98('0x30')](_0x54ae13[_0x3f98('0x2c')][_0x3f98('0x30')]));_0x33d594['attributes']=_0x33d594[_0x3f98('0x2e')][_0x3f98('0x31')]?_0x33d594[_0x3f98('0x2e')]:_0x4cab9a[_0x3f98('0x2b')];if(!_0x54ae13[_0x3f98('0x2c')]['hasOwnProperty']('nolimit')){_0x33d594[_0x3f98('0x20')]=qs[_0x3f98('0x20')](_0x54ae13[_0x3f98('0x2c')][_0x3f98('0x20')]);_0x33d594[_0x3f98('0x1f')]=qs[_0x3f98('0x1f')](_0x54ae13['query'][_0x3f98('0x1f')]);}_0x33d594[_0x3f98('0x32')]=qs[_0x3f98('0x33')](_0x54ae13['query']['sort']);_0x33d594[_0x3f98('0x34')]=qs[_0x3f98('0x35')](_['pick'](_0x54ae13[_0x3f98('0x2c')],_0x4cab9a[_0x3f98('0x35')]),_0x581788);if(_0x54ae13['query'][_0x3f98('0x36')]){_0x33d594['where']=_[_0x3f98('0x37')](_0x33d594['where'],{'$or':_[_0x3f98('0x38')](_0x33d594[_0x3f98('0x2e')],function(_0x828adb){var _0x989d24={};_0x989d24[_0x828adb]={'$like':'%'+_0x54ae13[_0x3f98('0x2c')][_0x3f98('0x36')]+'%'};return _0x989d24;})});}_0x33d594=_[_0x3f98('0x37')]({},_0x33d594,_0x54ae13[_0x3f98('0x39')]);var _0x1a1672={'where':_0x33d594[_0x3f98('0x34')]};return db[_0x3f98('0x29')][_0x3f98('0x1e')](_0x1a1672)[_0x3f98('0x24')](function(_0x461c80){_0x527e23[_0x3f98('0x1e')]=_0x461c80;if(_0x54ae13['query'][_0x3f98('0x3a')]){_0x33d594[_0x3f98('0x3b')]=[{'all':!![]}];}return db['CmCompany'][_0x3f98('0x3c')](_0x33d594);})[_0x3f98('0x24')](function(_0x1276be){_0x527e23[_0x3f98('0x3d')]=_0x1276be;return _0x527e23;})[_0x3f98('0x24')](respondWithFilteredResult(_0x27948d,_0x33d594))['catch'](handleError(_0x27948d,null));})[_0x3f98('0x3e')](handleError(_0x27948d,null));};exports[_0x3f98('0x3f')]=function(_0x5dfb05,_0x414dab){var _0x256113={'raw':![],'where':{'id':_0x5dfb05['params']['id']}},_0xe68efc={};_0xe68efc[_0x3f98('0x2b')]=_[_0x3f98('0x2d')](db['CmCompany'][_0x3f98('0x40')]);_0xe68efc['query']=_['keys'](_0x5dfb05[_0x3f98('0x2c')]);_0xe68efc['filters']=_[_0x3f98('0x2f')](_0xe68efc[_0x3f98('0x2b')],_0xe68efc[_0x3f98('0x2c')]);_0x256113[_0x3f98('0x2e')]=_[_0x3f98('0x2f')](_0xe68efc[_0x3f98('0x2b')],qs[_0x3f98('0x30')](_0x5dfb05['query'][_0x3f98('0x30')]));_0x256113[_0x3f98('0x2e')]=_0x256113[_0x3f98('0x2e')]['length']?_0x256113[_0x3f98('0x2e')]:_0xe68efc[_0x3f98('0x2b')];if(_0x5dfb05['query'][_0x3f98('0x3a')]){_0x256113[_0x3f98('0x3b')]=[{'all':!![]}];}_0x256113=_[_0x3f98('0x37')]({},_0x256113,_0x5dfb05[_0x3f98('0x39')]);return db[_0x3f98('0x29')][_0x3f98('0x41')](_0x256113)[_0x3f98('0x24')](handleEntityNotFound(_0x414dab,null))[_0x3f98('0x24')](respondWithResult(_0x414dab,null))['catch'](handleError(_0x414dab,null));};exports['create']=function(_0x58d39e,_0x1259c0){return db[_0x3f98('0x29')][_0x3f98('0x42')](_0x58d39e[_0x3f98('0x43')],{})['then'](function(_0x406146){var _0x54589c=_0x58d39e[_0x3f98('0x44')][_0x3f98('0x45')]({'plain':!![]});if(!_0x54589c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54589c[_0x3f98('0x46')]==='user'){var _0x1cbf7c=_0x406146[_0x3f98('0x45')]({'plain':!![]});var _0x413ae6=_0x3f98('0x47');return db[_0x3f98('0x48')][_0x3f98('0x41')]({'where':{'name':_0x413ae6,'userProfileId':_0x54589c[_0x3f98('0x49')]},'raw':!![]})[_0x3f98('0x24')](function(_0x509b5d){if(_0x509b5d&&_0x509b5d['autoAssociation']===0x0){return db[_0x3f98('0x4a')][_0x3f98('0x42')]({'name':_0x1cbf7c[_0x3f98('0x27')],'resourceId':_0x1cbf7c['id'],'type':_0x509b5d[_0x3f98('0x27')],'sectionId':_0x509b5d['id']},{})[_0x3f98('0x24')](function(){return _0x406146;});}else{return _0x406146;}})[_0x3f98('0x3e')](function(_0x3d90b7){logger[_0x3f98('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d90b7);throw _0x3d90b7;});}return _0x406146;})[_0x3f98('0x24')](respondWithResult(_0x1259c0,0xc9))[_0x3f98('0x3e')](handleError(_0x1259c0,null));};exports[_0x3f98('0x4c')]=function(_0x2aaff4,_0x34ac95){if(_0x2aaff4[_0x3f98('0x43')]['id']){delete _0x2aaff4[_0x3f98('0x43')]['id'];}return db['CmCompany'][_0x3f98('0x41')]({'where':{'id':_0x2aaff4[_0x3f98('0x4d')]['id']}})['then'](handleEntityNotFound(_0x34ac95,null))['then'](saveUpdates(_0x2aaff4['body'],null))['then'](respondWithResult(_0x34ac95,null))['catch'](handleError(_0x34ac95,null));};exports[_0x3f98('0x25')]=function(_0x3f53f3,_0x55a32c){return db['CmCompany']['find']({'where':{'id':_0x3f53f3[_0x3f98('0x4d')]['id']}})['then'](handleEntityNotFound(_0x55a32c,null))[_0x3f98('0x24')](removeEntity(_0x55a32c,null))[_0x3f98('0x3e')](handleError(_0x55a32c,null));};exports[_0x3f98('0x2a')]=function(_0x38fa5c,_0x53ae2e){return db['CmCompany'][_0x3f98('0x2a')]()[_0x3f98('0x24')](respondWithResult(_0x53ae2e,null))[_0x3f98('0x3e')](handleError(_0x53ae2e,null));};exports[_0x3f98('0x4e')]=function(_0x3bf403,_0x34ed33,_0x43ba92){return db[_0x3f98('0x4f')][_0x3f98('0x41')]({'where':{'id':_0x3bf403[_0x3f98('0x4d')]['id']}})[_0x3f98('0x24')](handleEntityNotFound(_0x34ed33,null))[_0x3f98('0x24')](function(_0x74dd2d){if(_0x74dd2d){return _0x74dd2d[_0x3f98('0x4e')](_0x3bf403['body'][_0x3f98('0x50')],_[_0x3f98('0x51')](_0x3bf403[_0x3f98('0x43')],[_0x3f98('0x50'),'id'])||{});}})['then'](respondWithResult(_0x34ed33,null))['catch'](handleError(_0x34ed33,null));};exports[_0x3f98('0x52')]=function(_0x37237b,_0x24ed19,_0x121c11){var _0x1e0c78={};var _0x501132={};var _0x1c3437;var _0x3ec82e;return db[_0x3f98('0x29')]['findOne']({'where':{'id':_0x37237b[_0x3f98('0x4d')]['id']}})[_0x3f98('0x24')](handleEntityNotFound(_0x24ed19,null))['then'](function(_0x3669d7){if(_0x3669d7){_0x1c3437=_0x3669d7;_0x501132[_0x3f98('0x2b')]=_[_0x3f98('0x2d')](db[_0x3f98('0x4f')][_0x3f98('0x40')]);_0x501132[_0x3f98('0x2c')]=_[_0x3f98('0x2d')](_0x37237b[_0x3f98('0x2c')]);_0x501132['filters']=_['intersection'](_0x501132[_0x3f98('0x2b')],_0x501132['query']);_0x1e0c78['attributes']=_[_0x3f98('0x2f')](_0x501132[_0x3f98('0x2b')],qs[_0x3f98('0x30')](_0x37237b[_0x3f98('0x2c')]['fields']));_0x1e0c78[_0x3f98('0x2e')]=_0x1e0c78['attributes']['length']?_0x1e0c78['attributes']:_0x501132[_0x3f98('0x2b')];_0x1e0c78['order']=qs[_0x3f98('0x33')](_0x37237b[_0x3f98('0x2c')][_0x3f98('0x33')]);_0x1e0c78['where']=qs[_0x3f98('0x35')](_['pick'](_0x37237b['query'],_0x501132[_0x3f98('0x35')]));if(_0x37237b[_0x3f98('0x2c')][_0x3f98('0x36')]){_0x1e0c78[_0x3f98('0x34')]=_[_0x3f98('0x37')](_0x1e0c78[_0x3f98('0x34')],{'$or':_['map'](_0x1e0c78[_0x3f98('0x2e')],function(_0x2c8cd1){var _0x2f91f0={};_0x2f91f0[_0x2c8cd1]={'$like':'%'+_0x37237b[_0x3f98('0x2c')][_0x3f98('0x36')]+'%'};return _0x2f91f0;})});}_0x1e0c78=_['merge']({},_0x1e0c78,_0x37237b[_0x3f98('0x39')]);return _0x1c3437[_0x3f98('0x52')](_0x1e0c78);}})[_0x3f98('0x24')](function(_0x5cb2ef){if(_0x5cb2ef){_0x3ec82e=_0x5cb2ef['length'];if(!_0x37237b[_0x3f98('0x2c')][_0x3f98('0x53')](_0x3f98('0x54'))){_0x1e0c78[_0x3f98('0x20')]=qs[_0x3f98('0x20')](_0x37237b['query'][_0x3f98('0x20')]);_0x1e0c78['offset']=qs[_0x3f98('0x1f')](_0x37237b['query'][_0x3f98('0x1f')]);}return _0x1c3437[_0x3f98('0x52')](_0x1e0c78);}})[_0x3f98('0x24')](function(_0x192e6f){if(_0x192e6f){return _0x192e6f?{'count':_0x3ec82e,'rows':_0x192e6f}:null;}})['then'](respondWithResult(_0x24ed19,null))['catch'](handleError(_0x24ed19,null));}; \ No newline at end of file +var _0x38ed=['status','end','count','offset','set','json','apply','reject','then','Companies','destroy','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','options','includeAll','include','rows','catch','show','params','rawAttributes','fields','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','create','error','update','addContacts','CmContact','ids','omit','findOne','length','getContacts','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','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','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x38ed,0x92));var _0xd38e=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x38ed[_0x5f1391];return _0x50ebe3;};'use strict';var pdf=require(_0xd38e('0x0'));var emlformat=require(_0xd38e('0x1'));var rimraf=require(_0xd38e('0x2'));var zipdir=require(_0xd38e('0x3'));var jsonpatch=require(_0xd38e('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd38e('0x5'));var Mustache=require('mustache');var util=require(_0xd38e('0x6'));var path=require(_0xd38e('0x7'));var sox=require(_0xd38e('0x8'));var csv=require(_0xd38e('0x9'));var ejs=require(_0xd38e('0xa'));var fs=require('fs');var _=require(_0xd38e('0xb'));var squel=require('squel');var crypto=require(_0xd38e('0xc'));var jsforce=require(_0xd38e('0xd'));var deskjs=require(_0xd38e('0xe'));var toCsv=require(_0xd38e('0x9'));var querystring=require('querystring');var Papa=require(_0xd38e('0xf'));var Redis=require(_0xd38e('0x10'));var authService=require(_0xd38e('0x11'));var qs=require(_0xd38e('0x12'));var as=require(_0xd38e('0x13'));var hardwareService=require(_0xd38e('0x14'));var logger=require(_0xd38e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd38e('0x16'));var licenseUtil=require(_0xd38e('0x17'));var db=require(_0xd38e('0x18'))['db'];function respondWithStatusCode(_0x1f1113,_0xbe42be){_0xbe42be=_0xbe42be||0xcc;return function(_0x15ef01){if(_0x15ef01){return _0x1f1113[_0xd38e('0x19')](_0xbe42be);}return _0x1f1113[_0xd38e('0x1a')](_0xbe42be)[_0xd38e('0x1b')]();};}function respondWithResult(_0x284044,_0x33835b){_0x33835b=_0x33835b||0xc8;return function(_0x5519a1){if(_0x5519a1){return _0x284044[_0xd38e('0x1a')](_0x33835b)['json'](_0x5519a1);}};}function respondWithFilteredResult(_0xdb990a,_0x44382c){return function(_0x5d00f1){if(_0x5d00f1){var _0x1a270e=_0x5d00f1[_0xd38e('0x1c')],_0x867aae=_0x44382c[_0xd38e('0x1d')],_0x45e4db=_0x44382c[_0xd38e('0x1d')]+_0x44382c['limit'],_0xbaf10c;if(_0x45e4db>=_0x1a270e){_0x45e4db=_0x1a270e;_0xbaf10c=0xc8;}else{_0xbaf10c=0xce;}_0xdb990a[_0xd38e('0x1a')](_0xbaf10c);return _0xdb990a[_0xd38e('0x1e')]('Content-Range',_0x867aae+'-'+_0x45e4db+'/'+_0x1a270e)[_0xd38e('0x1f')](_0x5d00f1);}return null;};}function patchUpdates(_0x1de8be){return function(_0x41f17a){try{jsonpatch[_0xd38e('0x20')](_0x41f17a,_0x1de8be,!![]);}catch(_0x4e9925){return BPromise[_0xd38e('0x21')](_0x4e9925);}return _0x41f17a['save']();};}function saveUpdates(_0x47fa23,_0x23cf32){return function(_0x31acc9){if(_0x31acc9){return _0x31acc9['update'](_0x47fa23)[_0xd38e('0x22')](function(_0x5a06c9){return _0x5a06c9;});}return null;};}function removeEntity(_0x5a261d,_0x3c22d7){return function(_0x9e807b){if(_0x9e807b){return _0x9e807b['destroy']()['then'](function(){var _0x4b3afe=_0x9e807b['get']({'plain':!![]});var _0xc1f563=_0xd38e('0x23');return db['UserProfileResource'][_0xd38e('0x24')]({'where':{'type':_0xc1f563,'resourceId':_0x4b3afe['id']}})[_0xd38e('0x22')](function(){return _0x9e807b;});})[_0xd38e('0x22')](function(){_0x5a261d[_0xd38e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25b934,_0x20e8ff){return function(_0x271414){if(!_0x271414){_0x25b934[_0xd38e('0x19')](0x194);}return _0x271414;};}function handleError(_0x26847f,_0x86011){_0x86011=_0x86011||0x1f4;return function(_0x5767ba){logger['error'](_0x5767ba['stack']);if(_0x5767ba[_0xd38e('0x25')]){delete _0x5767ba['name'];}_0x26847f[_0xd38e('0x1a')](_0x86011)[_0xd38e('0x26')](_0x5767ba);};}exports[_0xd38e('0x27')]=function(_0x1e4156,_0x4d50f7){var _0x173b41={},_0x2780b0={},_0x165e53={'count':0x0,'rows':[]};return db[_0xd38e('0x28')][_0xd38e('0x29')]()['then'](function(_0xba9e1f){_0x2780b0[_0xd38e('0x2a')]=_[_0xd38e('0x2b')](_0xba9e1f);_0x2780b0[_0xd38e('0x2c')]=_[_0xd38e('0x2b')](_0x1e4156[_0xd38e('0x2c')]);_0x2780b0[_0xd38e('0x2d')]=_[_0xd38e('0x2e')](_0x2780b0['model'],_0x2780b0[_0xd38e('0x2c')]);_0x173b41[_0xd38e('0x2f')]=_[_0xd38e('0x2e')](_0x2780b0['model'],qs['fields'](_0x1e4156['query']['fields']));_0x173b41[_0xd38e('0x2f')]=_0x173b41[_0xd38e('0x2f')]['length']?_0x173b41[_0xd38e('0x2f')]:_0x2780b0[_0xd38e('0x2a')];if(!_0x1e4156[_0xd38e('0x2c')][_0xd38e('0x30')](_0xd38e('0x31'))){_0x173b41[_0xd38e('0x32')]=qs[_0xd38e('0x32')](_0x1e4156['query']['limit']);_0x173b41[_0xd38e('0x1d')]=qs['offset'](_0x1e4156[_0xd38e('0x2c')][_0xd38e('0x1d')]);}_0x173b41[_0xd38e('0x33')]=qs['sort'](_0x1e4156[_0xd38e('0x2c')][_0xd38e('0x34')]);_0x173b41['where']=qs[_0xd38e('0x2d')](_[_0xd38e('0x35')](_0x1e4156[_0xd38e('0x2c')],_0x2780b0['filters']),_0xba9e1f);if(_0x1e4156[_0xd38e('0x2c')][_0xd38e('0x36')]){_0x173b41[_0xd38e('0x37')]=_[_0xd38e('0x38')](_0x173b41['where'],{'$or':_[_0xd38e('0x39')](_0x173b41['attributes'],function(_0x45069e){var _0x3959b8={};_0x3959b8[_0x45069e]={'$like':'%'+_0x1e4156[_0xd38e('0x2c')][_0xd38e('0x36')]+'%'};return _0x3959b8;})});}_0x173b41=_[_0xd38e('0x38')]({},_0x173b41,_0x1e4156[_0xd38e('0x3a')]);var _0x1a4647={'where':_0x173b41[_0xd38e('0x37')]};return db[_0xd38e('0x28')]['count'](_0x1a4647)[_0xd38e('0x22')](function(_0x4aa8df){_0x165e53[_0xd38e('0x1c')]=_0x4aa8df;if(_0x1e4156['query'][_0xd38e('0x3b')]){_0x173b41[_0xd38e('0x3c')]=[{'all':!![]}];}return db[_0xd38e('0x28')]['findAll'](_0x173b41);})[_0xd38e('0x22')](function(_0x54cea4){_0x165e53[_0xd38e('0x3d')]=_0x54cea4;return _0x165e53;})[_0xd38e('0x22')](respondWithFilteredResult(_0x4d50f7,_0x173b41))[_0xd38e('0x3e')](handleError(_0x4d50f7,null));})['catch'](handleError(_0x4d50f7,null));};exports[_0xd38e('0x3f')]=function(_0x465129,_0xb5d456){var _0x46a7af={'raw':![],'where':{'id':_0x465129[_0xd38e('0x40')]['id']}},_0x4174d9={};_0x4174d9[_0xd38e('0x2a')]=_[_0xd38e('0x2b')](db[_0xd38e('0x28')][_0xd38e('0x41')]);_0x4174d9[_0xd38e('0x2c')]=_['keys'](_0x465129[_0xd38e('0x2c')]);_0x4174d9[_0xd38e('0x2d')]=_[_0xd38e('0x2e')](_0x4174d9['model'],_0x4174d9['query']);_0x46a7af[_0xd38e('0x2f')]=_[_0xd38e('0x2e')](_0x4174d9['model'],qs[_0xd38e('0x42')](_0x465129[_0xd38e('0x2c')][_0xd38e('0x42')]));_0x46a7af[_0xd38e('0x2f')]=_0x46a7af[_0xd38e('0x2f')]['length']?_0x46a7af[_0xd38e('0x2f')]:_0x4174d9[_0xd38e('0x2a')];if(_0x465129[_0xd38e('0x2c')]['includeAll']){_0x46a7af[_0xd38e('0x3c')]=[{'all':!![]}];}_0x46a7af=_['merge']({},_0x46a7af,_0x465129['options']);return db['CmCompany'][_0xd38e('0x43')](_0x46a7af)[_0xd38e('0x22')](handleEntityNotFound(_0xb5d456,null))['then'](respondWithResult(_0xb5d456,null))[_0xd38e('0x3e')](handleError(_0xb5d456,null));};exports['create']=function(_0x57d976,_0x1edc28){return db[_0xd38e('0x28')]['create'](_0x57d976[_0xd38e('0x44')],{})['then'](function(_0xb839b4){var _0x29032a=_0x57d976[_0xd38e('0x45')][_0xd38e('0x46')]({'plain':!![]});if(!_0x29032a)throw new Error(_0xd38e('0x47'));if(_0x29032a[_0xd38e('0x48')]==='user'){var _0x592d37=_0xb839b4[_0xd38e('0x46')]({'plain':!![]});var _0x186cec=_0xd38e('0x23');return db['UserProfileSection'][_0xd38e('0x43')]({'where':{'name':_0x186cec,'userProfileId':_0x29032a[_0xd38e('0x49')]},'raw':!![]})[_0xd38e('0x22')](function(_0x37c5a5){if(_0x37c5a5&&_0x37c5a5[_0xd38e('0x4a')]===0x0){return db[_0xd38e('0x4b')][_0xd38e('0x4c')]({'name':_0x592d37[_0xd38e('0x25')],'resourceId':_0x592d37['id'],'type':_0x37c5a5[_0xd38e('0x25')],'sectionId':_0x37c5a5['id']},{})[_0xd38e('0x22')](function(){return _0xb839b4;});}else{return _0xb839b4;}})[_0xd38e('0x3e')](function(_0xcb0e1d){logger[_0xd38e('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcb0e1d);throw _0xcb0e1d;});}return _0xb839b4;})['then'](respondWithResult(_0x1edc28,0xc9))[_0xd38e('0x3e')](handleError(_0x1edc28,null));};exports[_0xd38e('0x4e')]=function(_0x1bbee8,_0x2e4f94){if(_0x1bbee8[_0xd38e('0x44')]['id']){delete _0x1bbee8[_0xd38e('0x44')]['id'];}return db[_0xd38e('0x28')][_0xd38e('0x43')]({'where':{'id':_0x1bbee8[_0xd38e('0x40')]['id']}})['then'](handleEntityNotFound(_0x2e4f94,null))['then'](saveUpdates(_0x1bbee8[_0xd38e('0x44')],null))[_0xd38e('0x22')](respondWithResult(_0x2e4f94,null))[_0xd38e('0x3e')](handleError(_0x2e4f94,null));};exports[_0xd38e('0x24')]=function(_0x294229,_0x11efa5){return db['CmCompany'][_0xd38e('0x43')]({'where':{'id':_0x294229['params']['id']}})[_0xd38e('0x22')](handleEntityNotFound(_0x11efa5,null))[_0xd38e('0x22')](removeEntity(_0x11efa5,null))['catch'](handleError(_0x11efa5,null));};exports[_0xd38e('0x29')]=function(_0x445575,_0x4acfc9){return db[_0xd38e('0x28')][_0xd38e('0x29')]()[_0xd38e('0x22')](respondWithResult(_0x4acfc9,null))['catch'](handleError(_0x4acfc9,null));};exports[_0xd38e('0x4f')]=function(_0x217df4,_0xc7402,_0x44a6aa){return db[_0xd38e('0x50')][_0xd38e('0x43')]({'where':{'id':_0x217df4[_0xd38e('0x40')]['id']}})[_0xd38e('0x22')](handleEntityNotFound(_0xc7402,null))[_0xd38e('0x22')](function(_0x45d6fd){if(_0x45d6fd){return _0x45d6fd['addContacts'](_0x217df4[_0xd38e('0x44')][_0xd38e('0x51')],_[_0xd38e('0x52')](_0x217df4[_0xd38e('0x44')],['ids','id'])||{});}})[_0xd38e('0x22')](respondWithResult(_0xc7402,null))[_0xd38e('0x3e')](handleError(_0xc7402,null));};exports['getContacts']=function(_0x3b8589,_0x36c6aa,_0xadfca4){var _0x1cd56e={};var _0x2adf01={};var _0x574f52;var _0xbc421a;return db[_0xd38e('0x28')][_0xd38e('0x53')]({'where':{'id':_0x3b8589[_0xd38e('0x40')]['id']}})[_0xd38e('0x22')](handleEntityNotFound(_0x36c6aa,null))[_0xd38e('0x22')](function(_0x13bb91){if(_0x13bb91){_0x574f52=_0x13bb91;_0x2adf01[_0xd38e('0x2a')]=_[_0xd38e('0x2b')](db[_0xd38e('0x50')][_0xd38e('0x41')]);_0x2adf01[_0xd38e('0x2c')]=_[_0xd38e('0x2b')](_0x3b8589[_0xd38e('0x2c')]);_0x2adf01[_0xd38e('0x2d')]=_['intersection'](_0x2adf01[_0xd38e('0x2a')],_0x2adf01[_0xd38e('0x2c')]);_0x1cd56e[_0xd38e('0x2f')]=_[_0xd38e('0x2e')](_0x2adf01[_0xd38e('0x2a')],qs[_0xd38e('0x42')](_0x3b8589[_0xd38e('0x2c')][_0xd38e('0x42')]));_0x1cd56e[_0xd38e('0x2f')]=_0x1cd56e[_0xd38e('0x2f')][_0xd38e('0x54')]?_0x1cd56e[_0xd38e('0x2f')]:_0x2adf01[_0xd38e('0x2a')];_0x1cd56e['order']=qs[_0xd38e('0x34')](_0x3b8589[_0xd38e('0x2c')][_0xd38e('0x34')]);_0x1cd56e['where']=qs[_0xd38e('0x2d')](_[_0xd38e('0x35')](_0x3b8589[_0xd38e('0x2c')],_0x2adf01[_0xd38e('0x2d')]));if(_0x3b8589['query']['filter']){_0x1cd56e[_0xd38e('0x37')]=_[_0xd38e('0x38')](_0x1cd56e[_0xd38e('0x37')],{'$or':_[_0xd38e('0x39')](_0x1cd56e[_0xd38e('0x2f')],function(_0x2a6591){var _0x471390={};_0x471390[_0x2a6591]={'$like':'%'+_0x3b8589[_0xd38e('0x2c')][_0xd38e('0x36')]+'%'};return _0x471390;})});}_0x1cd56e=_[_0xd38e('0x38')]({},_0x1cd56e,_0x3b8589[_0xd38e('0x3a')]);return _0x574f52[_0xd38e('0x55')](_0x1cd56e);}})['then'](function(_0x55d25f){if(_0x55d25f){_0xbc421a=_0x55d25f[_0xd38e('0x54')];if(!_0x3b8589[_0xd38e('0x2c')][_0xd38e('0x30')](_0xd38e('0x31'))){_0x1cd56e['limit']=qs[_0xd38e('0x32')](_0x3b8589[_0xd38e('0x2c')][_0xd38e('0x32')]);_0x1cd56e[_0xd38e('0x1d')]=qs[_0xd38e('0x1d')](_0x3b8589[_0xd38e('0x2c')][_0xd38e('0x1d')]);}return _0x574f52['getContacts'](_0x1cd56e);}})[_0xd38e('0x22')](function(_0x201f0d){if(_0x201f0d){return _0x201f0d?{'count':_0xbc421a,'rows':_0x201f0d}:null;}})['then'](respondWithResult(_0x36c6aa,null))[_0xd38e('0x3e')](handleError(_0x36c6aa,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 6a8ee88..ce17305 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 _0x0dee=['../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x5eb072,_0x319fb3){var _0x4bddbb=function(_0x2fefc4){while(--_0x2fefc4){_0x5eb072['push'](_0x5eb072['shift']());}};_0x4bddbb(++_0x319fb3);}(_0x0dee,0xf7));var _0xe0de=function(_0x56d8bc,_0x112e9b){_0x56d8bc=_0x56d8bc-0x0;var _0x240932=_0x0dee[_0x56d8bc];return _0x240932;};'use strict';var _=require(_0xe0de('0x0'));var util=require(_0xe0de('0x1'));var logger=require('../../config/logger')(_0xe0de('0x2'));var moment=require('moment');var BPromise=require(_0xe0de('0x3'));var rp=require(_0xe0de('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0de('0x5'));var config=require(_0xe0de('0x6'));var attributes=require(_0xe0de('0x7'));module['exports']=function(_0x2fc94c,_0x4957d7){return _0x2fc94c[_0xe0de('0x8')](_0xe0de('0x9'),attributes,{'tableName':_0xe0de('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0ba=['cm_companies','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','CmCompany'];(function(_0x266257,_0x5f507e){var _0xd3923c=function(_0xb02782){while(--_0xb02782){_0x266257['push'](_0x266257['shift']());}};_0xd3923c(++_0x5f507e);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var logger=require(_0xaf0b('0x2'))(_0xaf0b('0x3'));var moment=require(_0xaf0b('0x4'));var BPromise=require('bluebird');var rp=require(_0xaf0b('0x5'));var fs=require('fs');var path=require(_0xaf0b('0x6'));var rimraf=require('rimraf');var config=require(_0xaf0b('0x7'));var attributes=require('./cmCompany.attributes');module[_0xaf0b('0x8')]=function(_0x4b3b85,_0x4d1479){return _0x4b3b85[_0xaf0b('0x9')](_0xaf0b('0xa'),attributes,{'tableName':_0xaf0b('0xb'),'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 0977944..c1af46f 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 _0x8faf=['debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x303064,_0x12f0c2){var _0x5a1d3d=function(_0x5b9d81){while(--_0x5b9d81){_0x303064['push'](_0x303064['shift']());}};_0x5a1d3d(++_0x12f0c2);}(_0x8faf,0x1a0));var _0xf8fa=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x8faf[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0xf8fa('0x0'));var util=require(_0xf8fa('0x1'));var moment=require(_0xf8fa('0x2'));var BPromise=require(_0xf8fa('0x3'));var rs=require(_0xf8fa('0x4'));var fs=require('fs');var Redis=require(_0xf8fa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8fa('0x6'));var logger=require(_0xf8fa('0x7'))(_0xf8fa('0x8'));var config=require('../../config/environment');var jayson=require(_0xf8fa('0x9'));var client=jayson[_0xf8fa('0xa')][_0xf8fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x104a1b,_0x4f1f47,_0x2db9a2){return new BPromise(function(_0x1d1a36,_0x368f44){return client[_0xf8fa('0xc')](_0x104a1b,_0x2db9a2)[_0xf8fa('0xd')](function(_0x47b96f){logger['info'](_0xf8fa('0xe'),_0x4f1f47,_0xf8fa('0xf'));logger[_0xf8fa('0x10')](_0xf8fa('0x11'),_0x4f1f47,'request\x20sent',JSON['stringify'](_0x47b96f));if(_0x47b96f[_0xf8fa('0x12')]){if(_0x47b96f['error'][_0xf8fa('0x13')]===0x1f4){logger[_0xf8fa('0x12')]('CmCompany,\x20%s,\x20%s',_0x4f1f47,_0x47b96f[_0xf8fa('0x12')][_0xf8fa('0x14')]);return _0x368f44(_0x47b96f['error'][_0xf8fa('0x14')]);}logger[_0xf8fa('0x12')](_0xf8fa('0xe'),_0x4f1f47,_0x47b96f[_0xf8fa('0x12')][_0xf8fa('0x14')]);return _0x1d1a36(_0x47b96f[_0xf8fa('0x12')][_0xf8fa('0x14')]);}else{logger[_0xf8fa('0x15')]('CmCompany,\x20%s,\x20%s',_0x4f1f47,_0xf8fa('0xf'));_0x1d1a36(_0x47b96f[_0xf8fa('0x16')][_0xf8fa('0x14')]);}})[_0xf8fa('0x17')](function(_0x3e1a0c){logger[_0xf8fa('0x12')](_0xf8fa('0xe'),_0x4f1f47,_0x3e1a0c);_0x368f44(_0x3e1a0c);});});} \ No newline at end of file +var _0xef68=['request','then','info','request\x20sent','debug','stringify','error','code','CmCompany,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x27ebc2,_0x5a63d3){var _0x5aba33=function(_0xa92499){while(--_0xa92499){_0x27ebc2['push'](_0x27ebc2['shift']());}};_0x5aba33(++_0x5a63d3);}(_0xef68,0x73));var _0x8ef6=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xef68[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x8ef6('0x0'));var util=require(_0x8ef6('0x1'));var moment=require(_0x8ef6('0x2'));var BPromise=require(_0x8ef6('0x3'));var rs=require(_0x8ef6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ef6('0x5'))['db'];var utils=require(_0x8ef6('0x6'));var logger=require(_0x8ef6('0x7'))('rpc');var config=require(_0x8ef6('0x8'));var jayson=require(_0x8ef6('0x9'));var client=jayson['client'][_0x8ef6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4381eb,_0x78d43e,_0x1f5f12){return new BPromise(function(_0x502d51,_0x310030){return client[_0x8ef6('0xb')](_0x4381eb,_0x1f5f12)[_0x8ef6('0xc')](function(_0x501a69){logger[_0x8ef6('0xd')]('CmCompany,\x20%s,\x20%s',_0x78d43e,_0x8ef6('0xe'));logger[_0x8ef6('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x78d43e,_0x8ef6('0xe'),JSON[_0x8ef6('0x10')](_0x501a69));if(_0x501a69[_0x8ef6('0x11')]){if(_0x501a69[_0x8ef6('0x11')][_0x8ef6('0x12')]===0x1f4){logger[_0x8ef6('0x11')](_0x8ef6('0x13'),_0x78d43e,_0x501a69[_0x8ef6('0x11')][_0x8ef6('0x14')]);return _0x310030(_0x501a69[_0x8ef6('0x11')]['message']);}logger[_0x8ef6('0x11')](_0x8ef6('0x13'),_0x78d43e,_0x501a69[_0x8ef6('0x11')][_0x8ef6('0x14')]);return _0x502d51(_0x501a69[_0x8ef6('0x11')][_0x8ef6('0x14')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x78d43e,_0x8ef6('0xe'));_0x502d51(_0x501a69['result'][_0x8ef6('0x14')]);}})['catch'](function(_0x279e83){logger[_0x8ef6('0x11')](_0x8ef6('0x13'),_0x78d43e,_0x279e83);_0x310030(_0x279e83);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index bd7e937..0b92d5f 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 _0x25e7=['get','/:id','show','/:id/contacts','getContacts','post','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','index','isAuthenticated','describe'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x25e7,0x1d6));var _0x725e=function(_0x295354,_0x2d43a8){_0x295354=_0x295354-0x0;var _0x371c48=_0x25e7[_0x295354];return _0x371c48;};'use strict';var multer=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var path=require(_0x725e('0x2'));var timeout=require(_0x725e('0x3'));var express=require(_0x725e('0x4'));var router=express[_0x725e('0x5')]();var auth=require(_0x725e('0x6'));var interaction=require(_0x725e('0x7'));var config=require(_0x725e('0x8'));var controller=require(_0x725e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x725e('0xa')]);router['get']('/describe',auth[_0x725e('0xb')](),controller[_0x725e('0xc')]);router[_0x725e('0xd')](_0x725e('0xe'),auth[_0x725e('0xb')](),controller[_0x725e('0xf')]);router[_0x725e('0xd')](_0x725e('0x10'),auth[_0x725e('0xb')](),controller[_0x725e('0x11')]);router[_0x725e('0x12')]('/',auth[_0x725e('0xb')](),controller['create']);router['post'](_0x725e('0x10'),auth[_0x725e('0xb')](),controller['addContacts']);router['put'](_0x725e('0xe'),auth[_0x725e('0xb')](),controller['update']);router[_0x725e('0x13')](_0x725e('0xe'),auth[_0x725e('0xb')](),controller['destroy']);module[_0x725e('0x14')]=router; \ No newline at end of file +var _0x6455=['post','addContacts','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','/:id/contacts','getContacts','create'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x6455,0x97));var _0x5645=function(_0x543fee,_0x3ec6f8){_0x543fee=_0x543fee-0x0;var _0x3ce63f=_0x6455[_0x543fee];return _0x3ce63f;};'use strict';var multer=require(_0x5645('0x0'));var util=require('util');var path=require(_0x5645('0x1'));var timeout=require(_0x5645('0x2'));var express=require(_0x5645('0x3'));var router=express[_0x5645('0x4')]();var auth=require(_0x5645('0x5'));var interaction=require(_0x5645('0x6'));var config=require('../../config/environment');var controller=require(_0x5645('0x7'));router[_0x5645('0x8')]('/',auth[_0x5645('0x9')](),controller[_0x5645('0xa')]);router[_0x5645('0x8')](_0x5645('0xb'),auth[_0x5645('0x9')](),controller[_0x5645('0xc')]);router['get']('/:id',auth[_0x5645('0x9')](),controller[_0x5645('0xd')]);router[_0x5645('0x8')](_0x5645('0xe'),auth[_0x5645('0x9')](),controller[_0x5645('0xf')]);router['post']('/',auth[_0x5645('0x9')](),controller[_0x5645('0x10')]);router[_0x5645('0x11')](_0x5645('0xe'),auth['isAuthenticated'](),controller[_0x5645('0x12')]);router['put'](_0x5645('0x13'),auth[_0x5645('0x9')](),controller[_0x5645('0x14')]);router[_0x5645('0x15')](_0x5645('0x13'),auth[_0x5645('0x9')](),controller[_0x5645('0x16')]);module[_0x5645('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 b970718..501d7b3 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 _0x591e=['DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x2f8000,_0x37c02b){var _0x25cfee=function(_0x56aca2){while(--_0x56aca2){_0x2f8000['push'](_0x2f8000['shift']());}};_0x25cfee(++_0x37c02b);}(_0x591e,0x1a0));var _0xe591=function(_0x4fe87e,_0x149993){_0x4fe87e=_0x4fe87e-0x0;var _0x2c3b88=_0x591e[_0x4fe87e];return _0x2c3b88;};'use strict';var _=require(_0xe591('0x0'));var Sequelize=require(_0xe591('0x1'));module[_0xe591('0x2')]={'firstName':{'type':Sequelize[_0xe591('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xe591('0x3')]},'city':{'type':Sequelize[_0xe591('0x3')]},'country':{'type':Sequelize[_0xe591('0x3')]},'dateOfBirth':{'type':Sequelize[_0xe591('0x3')]},'description':{'type':Sequelize[_0xe591('0x4')]},'phone':{'type':Sequelize[_0xe591('0x3')]},'mobile':{'type':Sequelize[_0xe591('0x3')]},'fax':{'type':Sequelize[_0xe591('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xe591('0x3')]},'facebook':{'type':Sequelize[_0xe591('0x3')]},'fb_data':{'type':Sequelize[_0xe591('0x3')]},'twitter':{'type':Sequelize[_0xe591('0x3')]},'skype':{'type':Sequelize[_0xe591('0x3')]},'teams':{'type':Sequelize[_0xe591('0x3')]},'viber':{'type':Sequelize[_0xe591('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xe591('0x3')]},'telegram':{'type':Sequelize[_0xe591('0x3')]},'UserId':{'type':Sequelize[_0xe591('0x5')]},'priority':{'type':Sequelize[_0xe591('0x5')](0x2)[_0xe591('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe591('0x7')],'defaultValue':Sequelize[_0xe591('0x8')]}}; \ No newline at end of file +var _0xf6e6=['INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','STRING','TEXT'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xf6e6,0x1ec));var _0x6f6e=function(_0x498322,_0x4cf4e4){_0x498322=_0x498322-0x0;var _0xde2bf7=_0xf6e6[_0x498322];return _0xde2bf7;};'use strict';var _=require(_0x6f6e('0x0'));var Sequelize=require(_0x6f6e('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x6f6e('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x6f6e('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x6f6e('0x2')]},'country':{'type':Sequelize[_0x6f6e('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6f6e('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x6f6e('0x2')]},'fax':{'type':Sequelize[_0x6f6e('0x2')]},'email':{'type':Sequelize[_0x6f6e('0x2')]},'url':{'type':Sequelize[_0x6f6e('0x2')]},'facebook':{'type':Sequelize[_0x6f6e('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x6f6e('0x2')]},'skype':{'type':Sequelize[_0x6f6e('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x6f6e('0x2')]},'line':{'type':Sequelize[_0x6f6e('0x2')]},'wechat':{'type':Sequelize[_0x6f6e('0x2')]},'telegram':{'type':Sequelize[_0x6f6e('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x6f6e('0x4')](0x2)[_0x6f6e('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6f6e('0x6')],'defaultValue':Sequelize[_0x6f6e('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 781880b..d14cedb 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 _0xeed7=['../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','CmContact','describe','keys','startsWith','cf_','push','all','length','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','castTo','DATE','buildExpression','text','value','filter','isNil','Contact','isEmpty','ListId','isArray','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.id','Sequelize','QueryTypes','SELECT','clone','having','t.id\x20IN\x20?','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','merge','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','find','tags','columnName','displayName','CmCustomField','findAll','alias','custom','values','body','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','create','each','duplicates','$or','findOrCreate','spread','show','Tag','omit','cf_%d','$and','pickBy','format','table','setFields','id\x20=\x20?','toParam','phone','CmHopper','getTags','findOne','params','rawAttributes','nolimit','setTags','ids','getHoppers','options','includeAll','include','CmHopperHistory','ContactId','rows','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','server/files/tmp','file','filename','0777','child_process','fork','../../components/import/cm/csv','json','pid','createReadStream','parse','import','No\x20ListId\x20specified','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','exit','error\x20child\x20process','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2c3a88,_0x48637e){var _0x4a7925=function(_0x15780f){while(--_0x15780f){_0x2c3a88['push'](_0x2c3a88['shift']());}};_0x4a7925(++_0x48637e);}(_0xeed7,0xdf));var _0x7eed=function(_0x2fbbc5,_0x5df1db){_0x2fbbc5=_0x2fbbc5-0x0;var _0x2a7d0e=_0xeed7[_0x2fbbc5];return _0x2a7d0e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7eed('0x0'));var zipdir=require(_0x7eed('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7eed('0x2'));var moment=require(_0x7eed('0x3'));var BPromise=require(_0x7eed('0x4'));var Mustache=require(_0x7eed('0x5'));var util=require('util');var path=require(_0x7eed('0x6'));var sox=require(_0x7eed('0x7'));var csv=require('to-csv');var ejs=require(_0x7eed('0x8'));var fs=require('fs');var _=require(_0x7eed('0x9'));var squel=require(_0x7eed('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7eed('0xb'));var toCsv=require(_0x7eed('0xc'));var querystring=require(_0x7eed('0xd'));var Papa=require('papaparse');var Redis=require(_0x7eed('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7eed('0xf'));var hardwareService=require(_0x7eed('0x10'));var logger=require(_0x7eed('0x11'))(_0x7eed('0x12'));var utils=require(_0x7eed('0x13'));var config=require(_0x7eed('0x14'));var licenseUtil=require(_0x7eed('0x15'));var db=require(_0x7eed('0x16'))['db'];config[_0x7eed('0x17')]=_['defaults'](config[_0x7eed('0x17')],{'host':_0x7eed('0x18'),'port':0x18eb});var socket=require(_0x7eed('0x19'))(new Redis(config['redis']));require('./cmContact.socket')[_0x7eed('0x1a')](socket);function respondWithStatusCode(_0x2255c8,_0xe64c1){_0xe64c1=_0xe64c1||0xcc;return function(_0xdcfc59){if(_0xdcfc59){return _0x2255c8[_0x7eed('0x1b')](_0xe64c1);}return _0x2255c8['status'](_0xe64c1)['end']();};}function respondWithResult(_0x598165,_0xdcfd1){_0xdcfd1=_0xdcfd1||0xc8;return function(_0x4f96c6){if(_0x4f96c6){return _0x598165['status'](_0xdcfd1)['json'](_0x4f96c6);}};}function respondWithFilteredResult(_0x2a2783,_0x2fe55f){return function(_0x5143db){if(_0x5143db){var _0x1b36bb=_0x5143db[_0x7eed('0x1c')],_0x3ab3e2=_0x2fe55f[_0x7eed('0x1d')],_0x13df98=_0x2fe55f[_0x7eed('0x1d')]+_0x2fe55f[_0x7eed('0x1e')],_0x222f33;if(_0x13df98>=_0x1b36bb){_0x13df98=_0x1b36bb;_0x222f33=0xc8;}else{_0x222f33=0xce;}_0x2a2783[_0x7eed('0x1f')](_0x222f33);return _0x2a2783[_0x7eed('0x20')](_0x7eed('0x21'),_0x3ab3e2+'-'+_0x13df98+'/'+_0x1b36bb)['json'](_0x5143db);}return null;};}function patchUpdates(_0x390012){return function(_0x5e9835){try{jsonpatch[_0x7eed('0x22')](_0x5e9835,_0x390012,!![]);}catch(_0x50f58c){return BPromise[_0x7eed('0x23')](_0x50f58c);}return _0x5e9835[_0x7eed('0x24')]();};}function saveUpdates(_0x578cf2,_0x51e60e){return function(_0x5201ca){if(_0x5201ca){return _0x5201ca[_0x7eed('0x25')](_0x578cf2)[_0x7eed('0x26')](function(_0x1a2736){return _0x1a2736;});}return null;};}function removeEntity(_0xf50d35,_0xfe3c86){return function(_0x811eeb){if(_0x811eeb){return _0x811eeb[_0x7eed('0x27')]()[_0x7eed('0x26')](function(){_0xf50d35[_0x7eed('0x1f')](0xcc)[_0x7eed('0x28')]();});}};}function handleEntityNotFound(_0x2fc47f,_0x20420f){return function(_0x291b7c){if(!_0x291b7c){_0x2fc47f[_0x7eed('0x1b')](0x194);}return _0x291b7c;};}function handleError(_0x19c47d,_0x79d72){_0x79d72=_0x79d72||0x1f4;return function(_0x10ac28){logger[_0x7eed('0x29')](_0x10ac28[_0x7eed('0x2a')]);if(_0x10ac28[_0x7eed('0x2b')]){delete _0x10ac28[_0x7eed('0x2b')];}_0x19c47d[_0x7eed('0x1f')](_0x79d72)[_0x7eed('0x2c')](_0x10ac28);};}exports[_0x7eed('0x2d')]=function(_0x38faff,_0x37ace1){var _0x4016ca={},_0x1a1a71={},_0x941863={'count':0x0,'rows':[]};return db[_0x7eed('0x2e')][_0x7eed('0x2f')]()[_0x7eed('0x26')](function(_0x6233d2){var _0xc3d47e=[];for(var _0x2c66a5=0x0;_0x2c66a50x1){_0x29df53['or'](_0x7eed('0x6b'),qs['getFullTextValue'](_0x5912c8),null);}else{if(qs[_0x7eed('0x6c')](_0x5912c8)){_0x29df53['or']('c.id\x20LIKE\x20?',_0x5912c8+'%');_0x29df53['or'](_0x7eed('0x6d'),_0x5912c8+'%');_0x29df53['or'](_0x7eed('0x6e'),_0x5912c8+'%');_0x29df53['or']('c.fax\x20LIKE\x20?',_0x5912c8+'%');}else if(qs[_0x7eed('0x6f')](_0x5912c8)){_0x29df53['or']('c.email\x20LIKE\x20?',_0x5912c8+'%');}else{_0x29df53['or'](_0x7eed('0x70'),'%'+_0x5912c8+'%');_0x29df53['or']('c.lastName\x20LIKE\x20?','%'+_0x5912c8+'%');_0x29df53['or']('c.email\x20LIKE\x20?','%'+_0x5912c8+'%');}}}}_0x2740e5[_0x7eed('0x41')](_0x29df53);_0x2740e5['group'](_0x7eed('0x71'));var _0x2bae8e={'type':db[_0x7eed('0x72')][_0x7eed('0x73')][_0x7eed('0x74')],'raw':!![]};var _0x3b64f1=_0x2740e5[_0x7eed('0x75')]()[_0x7eed('0x44')](_0x7eed('0x71'));if(_0x4016ca[_0x7eed('0x3f')]){_0x4016ca[_0x7eed('0x3f')]['forEach'](function(_0x4c7379){_0x2740e5[_0x7eed('0x3f')]('c.'+_0x4c7379[0x0],_0x4c7379[0x1]==='DESC'?![]:!![]);});}if(!_[_0x7eed('0x66')](_0x36ec51)){_0x2740e5[_0x7eed('0x76')](_0x3a1fd8);_0x3b64f1[_0x7eed('0x41')](_0x7eed('0x77'),_0x36ec51);}BPromise[_0x7eed('0x78')]()[_0x7eed('0x26')](function(){if(!_0x5a8ec1)return;if(_0x38faff[_0x7eed('0x79')][_0x7eed('0x7a')]!==_0x7eed('0x7b'))return;if(!_[_0x7eed('0x7c')](_0x5a8ec1[_0x7eed('0x54')],['field','User'])){return _0x38faff['user'][_0x7eed('0x7d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4d129d){if(_[_0x7eed('0x66')](_0x4d129d)){_0x3b64f1[_0x7eed('0x41')](_0x7eed('0x7e'));_0x2740e5['where'](_0x7eed('0x7e'));}else{_0x3b64f1[_0x7eed('0x41')](_0x7eed('0x7f'),_[_0x7eed('0x56')](_0x4d129d,'id'));_0x2740e5[_0x7eed('0x41')]('c.ListId\x20IN\x20?',_[_0x7eed('0x56')](_0x4d129d,'id'));}});}})['then'](function(){if(_0x38faff[_0x7eed('0x79')][_0x7eed('0x7a')]===_0x7eed('0x7b')&&!_0x5a8ec1&&!_0x38faff['query'][_0x7eed('0x67')])return[];return db[_0x7eed('0x80')][_0x7eed('0x39')](_0x3b64f1['toString'](),_0x2bae8e);})[_0x7eed('0x26')](function(_0x13c7c4){_0x941863[_0x7eed('0x1c')]=_0x13c7c4[_0x7eed('0x35')];if(_0x941863[_0x7eed('0x1c')]===0x0)return[];return db['sequelize'][_0x7eed('0x39')](_0x1ca060[_0x7eed('0x81')](),_0x2bae8e)[_0x7eed('0x26')](function(_0x1a8ef5){_0x5e8c17=_[_0x7eed('0x82')](_0x1a8ef5,'id');_0x2bae8e=_[_0x7eed('0x83')](_0x2bae8e,{'model':db[_0x7eed('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x38faff[_0x7eed('0x39')][_0x7eed('0x3d')]){_0x4016ca[_0x7eed('0x3c')][_0x7eed('0x57')](function(_0xa3f4a2){_0x2740e5[_0x7eed('0x44')]('c.'+_0xa3f4a2);});}else{_0x2740e5['field'](_0x7eed('0x71'));_0x2740e5[_0x7eed('0x44')]('c.firstName');_0x2740e5[_0x7eed('0x44')](_0x7eed('0x84'));_0x2740e5[_0x7eed('0x44')](_0x7eed('0x85'));_0x2740e5[_0x7eed('0x44')](_0x7eed('0x86'));_0x2740e5[_0x7eed('0x44')](_0x7eed('0x87'));_0x2740e5[_0x7eed('0x44')](_0x7eed('0x88'));_0x2740e5[_0x7eed('0x44')](_0x7eed('0x89'));_0x2740e5['field'](_0x7eed('0x8a'));_0x2740e5['field'](_0x7eed('0x8b'));_0x2740e5['field'](_0x7eed('0x8c'));_0x2740e5[_0x7eed('0x44')](_0x7eed('0x8d'),_0x7eed('0x8e'));}if(_0x4016ca[_0x7eed('0x1e')])_0x2740e5['limit'](_0x4016ca[_0x7eed('0x1e')]);if(_0x4016ca['offset'])_0x2740e5[_0x7eed('0x1d')](_0x4016ca[_0x7eed('0x1d')]);return db['sequelize'][_0x7eed('0x39')](_0x2740e5[_0x7eed('0x81')](),_0x2bae8e);});})['then'](function(_0x45a202){_0x45a202['forEach'](function(_0x2a2581){if(_0x2a2581[_0x7eed('0x8e')]){_0x2a2581[_0x7eed('0x8f')]=[];_0x2a2581[_0x7eed('0x8e')][_0x7eed('0x55')](',')[_0x7eed('0x57')](function(_0x4af05d){_0x2a2581['Tags'][_0x7eed('0x33')](_0x5e8c17[_0x4af05d]);});}delete _0x2a2581['TagIds'];});_0x941863['rows']=_0x45a202;return _0x941863;})[_0x7eed('0x26')](respondWithFilteredResult(_0x37ace1,_0x4016ca));})[_0x7eed('0x90')](handleError(_0x37ace1,null));};exports[_0x7eed('0x27')]=function(_0x2202c9,_0x5bd733){return db[_0x7eed('0x2e')][_0x7eed('0x91')]({'where':{'id':_0x2202c9['params']['id']}})[_0x7eed('0x26')](handleEntityNotFound(_0x5bd733,null))['then'](removeEntity(_0x5bd733,null))[_0x7eed('0x90')](handleError(_0x5bd733,null));};exports[_0x7eed('0x2f')]=function(_0x52fea8,_0x455d8c){return db['CmContact']['describe']()['then'](function(_0x16c920){delete _0x16c920[_0x7eed('0x92')];for(var _0x57cebf=0x0;_0x57cebf=_0x1817eb){_0x5cc195=_0x1817eb;_0x10712a=0xc8;}else{_0x10712a=0xce;}_0x41445a['status'](_0x10712a);return _0x41445a[_0xc1cf('0x1f')]('Content-Range',_0x2bf5f9+'-'+_0x5cc195+'/'+_0x1817eb)[_0xc1cf('0x20')](_0x229ab8);}return null;};}function patchUpdates(_0x2c91bb){return function(_0x1e37fc){try{jsonpatch[_0xc1cf('0x21')](_0x1e37fc,_0x2c91bb,!![]);}catch(_0xbfe869){return BPromise[_0xc1cf('0x22')](_0xbfe869);}return _0x1e37fc[_0xc1cf('0x23')]();};}function saveUpdates(_0xfe8a0e,_0x20ef6d){return function(_0x25adbd){if(_0x25adbd){return _0x25adbd[_0xc1cf('0x24')](_0xfe8a0e)['then'](function(_0x54d190){return _0x54d190;});}return null;};}function removeEntity(_0x132bdc,_0x1acf0c){return function(_0x526fa4){if(_0x526fa4){return _0x526fa4['destroy']()[_0xc1cf('0x25')](function(){_0x132bdc[_0xc1cf('0x1d')](0xcc)[_0xc1cf('0x26')]();});}};}function handleEntityNotFound(_0x46a99a,_0x279f07){return function(_0x2c3027){if(!_0x2c3027){_0x46a99a[_0xc1cf('0x1c')](0x194);}return _0x2c3027;};}function handleError(_0x30f247,_0x5012af){_0x5012af=_0x5012af||0x1f4;return function(_0x18825d){logger[_0xc1cf('0x27')](_0x18825d[_0xc1cf('0x28')]);if(_0x18825d[_0xc1cf('0x29')]){delete _0x18825d[_0xc1cf('0x29')];}_0x30f247[_0xc1cf('0x1d')](_0x5012af)[_0xc1cf('0x2a')](_0x18825d);};}exports['index']=function(_0x5bd81d,_0x396f8c){var _0xfec5d2={},_0x265422={},_0xab6099={'count':0x0,'rows':[]};return db['CmContact'][_0xc1cf('0x2b')]()[_0xc1cf('0x25')](function(_0x414cab){var _0x4c3884=[];for(var _0x8327e2=0x0;_0x8327e20x1){_0x4d3b9e['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc1cf('0x69')](_0x5b24e4),null);}else{if(qs['isNumeric'](_0x5b24e4)){_0x4d3b9e['or']('c.id\x20LIKE\x20?',_0x5b24e4+'%');_0x4d3b9e['or'](_0xc1cf('0x6a'),_0x5b24e4+'%');_0x4d3b9e['or']('c.mobile\x20LIKE\x20?',_0x5b24e4+'%');_0x4d3b9e['or'](_0xc1cf('0x6b'),_0x5b24e4+'%');}else if(qs['isEmail'](_0x5b24e4)){_0x4d3b9e['or'](_0xc1cf('0x6c'),_0x5b24e4+'%');}else{_0x4d3b9e['or'](_0xc1cf('0x6d'),'%'+_0x5b24e4+'%');_0x4d3b9e['or']('c.lastName\x20LIKE\x20?','%'+_0x5b24e4+'%');_0x4d3b9e['or'](_0xc1cf('0x6c'),'%'+_0x5b24e4+'%');}}}}_0x953d01[_0xc1cf('0x63')](_0x4d3b9e);_0x953d01[_0xc1cf('0x6e')](_0xc1cf('0x6f'));var _0x36574d={'type':db[_0xc1cf('0x70')][_0xc1cf('0x71')][_0xc1cf('0x72')],'raw':!![]};var _0x2cc3c4=_0x953d01[_0xc1cf('0x73')]()['field'](_0xc1cf('0x6f'));if(_0xfec5d2[_0xc1cf('0x3e')]){_0xfec5d2[_0xc1cf('0x3e')]['forEach'](function(_0x534011){_0x953d01['order']('c.'+_0x534011[0x0],_0x534011[0x1]===_0xc1cf('0x74')?![]:!![]);});}if(!_['isEmpty'](_0x1f48d1)){_0x953d01[_0xc1cf('0x75')](_0x56a1bb);_0x2cc3c4[_0xc1cf('0x63')](_0xc1cf('0x76'),_0x1f48d1);}BPromise[_0xc1cf('0x77')]()['then'](function(){if(!_0x375b4f)return;if(_0x5bd81d[_0xc1cf('0x78')][_0xc1cf('0x79')]!==_0xc1cf('0x7a'))return;if(!_[_0xc1cf('0x7b')](_0x375b4f[_0xc1cf('0x4f')],[_0xc1cf('0x40'),_0xc1cf('0x57')])){return _0x5bd81d[_0xc1cf('0x78')][_0xc1cf('0x7c')]({'attributes':['id'],'raw':!![]})[_0xc1cf('0x25')](function(_0x3b13a6){if(_[_0xc1cf('0x7d')](_0x3b13a6)){_0x2cc3c4[_0xc1cf('0x63')](_0xc1cf('0x7e'));_0x953d01[_0xc1cf('0x63')](_0xc1cf('0x7e'));}else{_0x2cc3c4['where'](_0xc1cf('0x64'),_[_0xc1cf('0x54')](_0x3b13a6,'id'));_0x953d01[_0xc1cf('0x63')]('c.ListId\x20IN\x20?',_[_0xc1cf('0x54')](_0x3b13a6,'id'));}});}})[_0xc1cf('0x25')](function(){if(_0x5bd81d[_0xc1cf('0x78')][_0xc1cf('0x79')]===_0xc1cf('0x7a')&&!_0x375b4f&&!_0x5bd81d[_0xc1cf('0x37')][_0xc1cf('0x62')])return[];return db[_0xc1cf('0x7f')][_0xc1cf('0x37')](_0x2cc3c4[_0xc1cf('0x80')](),_0x36574d);})[_0xc1cf('0x25')](function(_0x4bd952){_0xab6099[_0xc1cf('0x81')]=_0x4bd952[_0xc1cf('0x34')];if(_0xab6099[_0xc1cf('0x81')]===0x0)return[];return db['sequelize'][_0xc1cf('0x37')](_0x1d9f22[_0xc1cf('0x80')](),_0x36574d)[_0xc1cf('0x25')](function(_0x15dfe5){_0x537168=_[_0xc1cf('0x82')](_0x15dfe5,'id');_0x36574d=_[_0xc1cf('0x83')](_0x36574d,{'model':db[_0xc1cf('0x84')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5bd81d[_0xc1cf('0x37')][_0xc1cf('0x3b')]){_0xfec5d2['attributes'][_0xc1cf('0x55')](function(_0xb57ada){_0x953d01[_0xc1cf('0x40')]('c.'+_0xb57ada);});}else{_0x953d01['field'](_0xc1cf('0x6f'));_0x953d01[_0xc1cf('0x40')](_0xc1cf('0x85'));_0x953d01[_0xc1cf('0x40')]('c.lastName');_0x953d01[_0xc1cf('0x40')](_0xc1cf('0x86'));_0x953d01[_0xc1cf('0x40')](_0xc1cf('0x87'));_0x953d01['field']('c.fax');_0x953d01['field'](_0xc1cf('0x88'));_0x953d01[_0xc1cf('0x40')](_0xc1cf('0x89'));_0x953d01[_0xc1cf('0x40')](_0xc1cf('0x8a'));_0x953d01[_0xc1cf('0x40')](_0xc1cf('0x8b'));_0x953d01[_0xc1cf('0x40')](_0xc1cf('0x8c'));_0x953d01[_0xc1cf('0x40')](_0xc1cf('0x8d'),_0xc1cf('0x8e'));}if(_0xfec5d2[_0xc1cf('0x3d')])_0x953d01['limit'](_0xfec5d2[_0xc1cf('0x3d')]);if(_0xfec5d2[_0xc1cf('0x1e')])_0x953d01[_0xc1cf('0x1e')](_0xfec5d2[_0xc1cf('0x1e')]);return db[_0xc1cf('0x7f')][_0xc1cf('0x37')](_0x953d01[_0xc1cf('0x80')](),_0x36574d);});})[_0xc1cf('0x25')](function(_0x277afe){_0x277afe[_0xc1cf('0x55')](function(_0x15bcda){if(_0x15bcda[_0xc1cf('0x8e')]){_0x15bcda['Tags']=[];_0x15bcda[_0xc1cf('0x8e')][_0xc1cf('0x53')](',')[_0xc1cf('0x55')](function(_0x39d139){_0x15bcda[_0xc1cf('0x8f')]['push'](_0x537168[_0x39d139]);});}delete _0x15bcda[_0xc1cf('0x8e')];});_0xab6099[_0xc1cf('0x90')]=_0x277afe;return _0xab6099;})[_0xc1cf('0x25')](respondWithFilteredResult(_0x396f8c,_0xfec5d2));})[_0xc1cf('0x91')](handleError(_0x396f8c,null));};exports[_0xc1cf('0x92')]=function(_0x2cdf31,_0x30da33){return db[_0xc1cf('0x84')][_0xc1cf('0x50')]({'where':{'id':_0x2cdf31['params']['id']}})[_0xc1cf('0x25')](handleEntityNotFound(_0x30da33,null))['then'](removeEntity(_0x30da33,null))[_0xc1cf('0x91')](handleError(_0x30da33,null));};exports[_0xc1cf('0x2b')]=function(_0x56a918,_0x57881e){return db['CmContact'][_0xc1cf('0x2b')]()['then'](function(_0x32d08f){delete _0x32d08f[_0xc1cf('0x93')];for(var _0x406544=0x0;_0x406544{}\s\\|]/g,'-');_0x55e3df(null,util[_0x7b4c('0x24')](_0x7b4c('0x25'),path[_0x7b4c('0x26')](_0x3556d8[_0x7b4c('0x22')],path[_0x7b4c('0x27')](_0x3556d8[_0x7b4c('0x22')])),Date[_0x7b4c('0x28')](),path['extname'](_0x3556d8[_0x7b4c('0x22')])));}})});router[_0x7b4c('0x1a')](_0x7b4c('0x29'),upload[_0x7b4c('0x2a')](_0x7b4c('0x2b')),controller[_0x7b4c('0x2c')]);var upload=multer({'storage':multer[_0x7b4c('0x1e')]({'destination':function(_0x459eb4,_0x1f311e,_0x1a69db){_0x1a69db(null,path[_0x7b4c('0x1f')](config[_0x7b4c('0x20')],_0x7b4c('0x21')));},'filename':function(_0x501f75,_0x27f361,_0x3ab614){_0x27f361[_0x7b4c('0x22')]=_0x27f361[_0x7b4c('0x22')][_0x7b4c('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ab614(null,util[_0x7b4c('0x24')](_0x7b4c('0x25'),path[_0x7b4c('0x26')](_0x27f361[_0x7b4c('0x22')],path[_0x7b4c('0x27')](_0x27f361[_0x7b4c('0x22')])),Date[_0x7b4c('0x28')](),path[_0x7b4c('0x27')](_0x27f361[_0x7b4c('0x22')])));}})});router[_0x7b4c('0x1a')](_0x7b4c('0x2d'),upload[_0x7b4c('0x2a')](_0x7b4c('0x2b')),controller[_0x7b4c('0x2e')]);router['post']('/upload/:id',auth['isAuthenticated'](),controller[_0x7b4c('0x2f')]);router[_0x7b4c('0x30')](_0x7b4c('0x31'),auth[_0x7b4c('0xd')](),controller['update']);router[_0x7b4c('0x32')](_0x7b4c('0x31'),auth['isAuthenticated'](),controller[_0x7b4c('0x33')]);module['exports']=router; \ No newline at end of file +var _0x5075=['basename','extname','now','/csv','single','file','uploadCsv','/upload','/upload/:id','import','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmContact.controller','get','/describe','describe','/:id','/:id/tags','isAuthenticated','getTags','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','root','originalname','replace','%s-%s%s'];(function(_0x511cbb,_0x2e5ee5){var _0x14a6e4=function(_0x3b6083){while(--_0x3b6083){_0x511cbb['push'](_0x511cbb['shift']());}};_0x14a6e4(++_0x2e5ee5);}(_0x5075,0x73));var _0x5507=function(_0x5a91d9,_0x47cedb){_0x5a91d9=_0x5a91d9-0x0;var _0x5275e2=_0x5075[_0x5a91d9];return _0x5275e2;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var auth=require(_0x5507('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5507('0x7'));var controller=require(_0x5507('0x8'));router[_0x5507('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5507('0x9')](_0x5507('0xa'),auth['isAuthenticated'](),controller[_0x5507('0xb')]);router[_0x5507('0x9')](_0x5507('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5507('0x9')](_0x5507('0xd'),auth[_0x5507('0xe')](),controller[_0x5507('0xf')]);router['get'](_0x5507('0x10'),auth[_0x5507('0xe')](),controller['getHoppers']);router[_0x5507('0x9')](_0x5507('0x11'),auth['isAuthenticated'](),controller[_0x5507('0x12')]);router[_0x5507('0x9')](_0x5507('0x13'),auth[_0x5507('0xe')](),controller[_0x5507('0x14')]);router[_0x5507('0x9')]('/:id/jscripty_sessions',auth[_0x5507('0xe')](),controller[_0x5507('0x15')]);router[_0x5507('0x16')](_0x5507('0x17'),auth['isAuthenticated'](),controller[_0x5507('0x18')]);router[_0x5507('0x16')]('/',auth[_0x5507('0xe')](),controller[_0x5507('0x19')]);router[_0x5507('0x16')](_0x5507('0x1a'),auth[_0x5507('0xe')](),controller[_0x5507('0x1b')]);router[_0x5507('0x16')](_0x5507('0xd'),auth[_0x5507('0xe')](),controller[_0x5507('0x1c')]);var upload=multer({'storage':multer[_0x5507('0x1d')]({'destination':function(_0x5ad6d7,_0x14dab0,_0x276a81){_0x276a81(null,path[_0x5507('0x1e')](config[_0x5507('0x1f')],'server/files/tmp'));},'filename':function(_0x1dc53e,_0x1af06e,_0x1a54b0){_0x1af06e[_0x5507('0x20')]=_0x1af06e[_0x5507('0x20')][_0x5507('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1a54b0(null,util['format'](_0x5507('0x22'),path[_0x5507('0x23')](_0x1af06e[_0x5507('0x20')],path[_0x5507('0x24')](_0x1af06e[_0x5507('0x20')])),Date[_0x5507('0x25')](),path[_0x5507('0x24')](_0x1af06e[_0x5507('0x20')])));}})});router[_0x5507('0x16')](_0x5507('0x26'),upload[_0x5507('0x27')](_0x5507('0x28')),controller[_0x5507('0x29')]);var upload=multer({'storage':multer[_0x5507('0x1d')]({'destination':function(_0x1a2203,_0x4915ed,_0x4e8906){_0x4e8906(null,path['join'](config[_0x5507('0x1f')],'server/files/tmp'));},'filename':function(_0xa66a01,_0x24668b,_0x4beb0a){_0x24668b['originalname']=_0x24668b[_0x5507('0x20')][_0x5507('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4beb0a(null,util['format'](_0x5507('0x22'),path[_0x5507('0x23')](_0x24668b[_0x5507('0x20')],path[_0x5507('0x24')](_0x24668b[_0x5507('0x20')])),Date[_0x5507('0x25')](),path['extname'](_0x24668b[_0x5507('0x20')])));}})});router[_0x5507('0x16')](_0x5507('0x2a'),upload[_0x5507('0x27')](_0x5507('0x28')),controller['upload']);router['post'](_0x5507('0x2b'),auth[_0x5507('0xe')](),controller[_0x5507('0x2c')]);router[_0x5507('0x2d')]('/:id',auth[_0x5507('0xe')](),controller[_0x5507('0x2e')]);router[_0x5507('0x2f')](_0x5507('0xc'),auth[_0x5507('0xe')](),controller[_0x5507('0x30')]);module[_0x5507('0x31')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 17a9f2a..f522787 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 _0x8411=['PHONE','INTEGER','STRING'];(function(_0xccdad1,_0x235d5f){var _0xc73634=function(_0x4bb149){while(--_0x4bb149){_0xccdad1['push'](_0xccdad1['shift']());}};_0xc73634(++_0x235d5f);}(_0x8411,0x118));var _0x1841=function(_0xaf9a7e,_0x14e9cf){_0xaf9a7e=_0xaf9a7e-0x0;var _0x23d47c=_0x8411[_0xaf9a7e];return _0x23d47c;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0x1841('0x0')],'primaryKey':!![]},'item':{'type':Sequelize[_0x1841('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x1841('0x2')},'OrderBy':{'type':Sequelize[_0x1841('0x0')],'defaultValue':null}}; \ No newline at end of file +var _0xf693=['PHONE','exports','INTEGER','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf693,0x181));var _0x3f69=function(_0x24110e,_0x33c23a){_0x24110e=_0x24110e-0x0;var _0x59bcfa=_0xf693[_0x24110e];return _0x59bcfa;};'use strict';var Sequelize=require('sequelize');module[_0x3f69('0x0')]={'CmContactId':{'type':Sequelize[_0x3f69('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x3f69('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x3f69('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x3f69('0x2')],'defaultValue':_0x3f69('0x3')},'OrderBy':{'type':Sequelize[_0x3f69('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index adea20a..8793bf3 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 _0xcabe=['rows','catch','show','params','keys','find','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','CmContactHasItems','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x12fde3,_0x4800c6){var _0x521038=function(_0x2ea066){while(--_0x2ea066){_0x12fde3['push'](_0x12fde3['shift']());}};_0x521038(++_0x4800c6);}(_0xcabe,0x1ad));var _0xecab=function(_0x55dd53,_0x2cf521){_0x55dd53=_0x55dd53-0x0;var _0xb8a42b=_0xcabe[_0x55dd53];return _0xb8a42b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xecab('0x0'));var rimraf=require(_0xecab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xecab('0x2'));var rp=require('request-promise');var moment=require(_0xecab('0x3'));var BPromise=require(_0xecab('0x4'));var Mustache=require(_0xecab('0x5'));var util=require(_0xecab('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xecab('0x7'));var ejs=require(_0xecab('0x8'));var fs=require('fs');var _=require(_0xecab('0x9'));var squel=require(_0xecab('0xa'));var crypto=require(_0xecab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xecab('0xc'));var toCsv=require(_0xecab('0x7'));var querystring=require('querystring');var Papa=require(_0xecab('0xd'));var Redis=require(_0xecab('0xe'));var authService=require(_0xecab('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xecab('0x10'));var hardwareService=require(_0xecab('0x11'));var logger=require(_0xecab('0x12'))('api');var utils=require(_0xecab('0x13'));var config=require(_0xecab('0x14'));var licenseUtil=require(_0xecab('0x15'));var db=require(_0xecab('0x16'))['db'];function respondWithStatusCode(_0xcb4da4,_0x1fbc55){_0x1fbc55=_0x1fbc55||0xcc;return function(_0x32df44){if(_0x32df44){return _0xcb4da4[_0xecab('0x17')](_0x1fbc55);}return _0xcb4da4[_0xecab('0x18')](_0x1fbc55)[_0xecab('0x19')]();};}function respondWithResult(_0x5246cf,_0x49fbfd){_0x49fbfd=_0x49fbfd||0xc8;return function(_0x522e7b){if(_0x522e7b){return _0x5246cf['status'](_0x49fbfd)[_0xecab('0x1a')](_0x522e7b);}};}function respondWithFilteredResult(_0x4b9b35,_0x52378d){return function(_0x320567){if(_0x320567){var _0x1e2a57=_0x320567[_0xecab('0x1b')],_0x2b646c=_0x52378d[_0xecab('0x1c')],_0x1d2b34=_0x52378d[_0xecab('0x1c')]+_0x52378d[_0xecab('0x1d')],_0x5e9cab;if(_0x1d2b34>=_0x1e2a57){_0x1d2b34=_0x1e2a57;_0x5e9cab=0xc8;}else{_0x5e9cab=0xce;}_0x4b9b35[_0xecab('0x18')](_0x5e9cab);return _0x4b9b35['set'](_0xecab('0x1e'),_0x2b646c+'-'+_0x1d2b34+'/'+_0x1e2a57)[_0xecab('0x1a')](_0x320567);}return null;};}function patchUpdates(_0x157d8f){return function(_0x544fbf){try{jsonpatch[_0xecab('0x1f')](_0x544fbf,_0x157d8f,!![]);}catch(_0x4da1bf){return BPromise[_0xecab('0x20')](_0x4da1bf);}return _0x544fbf[_0xecab('0x21')]();};}function saveUpdates(_0x4bb615,_0x2e23e0){return function(_0x289729){if(_0x289729){return _0x289729[_0xecab('0x22')](_0x4bb615)['then'](function(_0x8ae825){return _0x8ae825;});}return null;};}function removeEntity(_0x29c826,_0x12a93e){return function(_0x752df0){if(_0x752df0){return _0x752df0[_0xecab('0x23')]()[_0xecab('0x24')](function(){var _0x38bc9e=_0x752df0[_0xecab('0x25')]({'plain':!![]});var _0x4e473e=_0xecab('0x26');return db['UserProfileResource'][_0xecab('0x23')]({'where':{'type':_0x4e473e,'resourceId':_0x38bc9e['id']}})[_0xecab('0x24')](function(){return _0x752df0;});})[_0xecab('0x24')](function(){_0x29c826[_0xecab('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e4939,_0x57fc3d){return function(_0x3305bc){if(!_0x3305bc){_0x4e4939['sendStatus'](0x194);}return _0x3305bc;};}function handleError(_0x516c46,_0x3d8d62){_0x3d8d62=_0x3d8d62||0x1f4;return function(_0xc9c3a4){logger[_0xecab('0x27')](_0xc9c3a4[_0xecab('0x28')]);if(_0xc9c3a4[_0xecab('0x29')]){delete _0xc9c3a4[_0xecab('0x29')];}_0x516c46[_0xecab('0x18')](_0x3d8d62)[_0xecab('0x2a')](_0xc9c3a4);};}exports[_0xecab('0x2b')]=function(_0x4cb031,_0x291dfe){var _0x4b3dfb={},_0x1e3b00={},_0x11208e={'count':0x0,'rows':[]};var _0x10d741=_[_0xecab('0x2c')](db[_0xecab('0x2d')][_0xecab('0x2e')],function(_0x506e05){return{'name':_0x506e05[_0xecab('0x2f')],'type':_0x506e05[_0xecab('0x30')][_0xecab('0x31')]};});_0x1e3b00[_0xecab('0x32')]=_[_0xecab('0x2c')](_0x10d741,_0xecab('0x29'));_0x1e3b00[_0xecab('0x33')]=_['keys'](_0x4cb031[_0xecab('0x33')]);_0x1e3b00['filters']=_[_0xecab('0x34')](_0x1e3b00[_0xecab('0x32')],_0x1e3b00[_0xecab('0x33')]);_0x4b3dfb[_0xecab('0x35')]=_[_0xecab('0x34')](_0x1e3b00[_0xecab('0x32')],qs[_0xecab('0x36')](_0x4cb031[_0xecab('0x33')][_0xecab('0x36')]));_0x4b3dfb[_0xecab('0x35')]=_0x4b3dfb[_0xecab('0x35')][_0xecab('0x37')]?_0x4b3dfb['attributes']:_0x1e3b00['model'];if(!_0x4cb031[_0xecab('0x33')][_0xecab('0x38')]('nolimit')){_0x4b3dfb[_0xecab('0x1d')]=qs[_0xecab('0x1d')](_0x4cb031[_0xecab('0x33')][_0xecab('0x1d')]);_0x4b3dfb[_0xecab('0x1c')]=qs['offset'](_0x4cb031[_0xecab('0x33')][_0xecab('0x1c')]);}_0x4b3dfb[_0xecab('0x39')]=qs[_0xecab('0x3a')](_0x4cb031[_0xecab('0x33')][_0xecab('0x3a')]);_0x4b3dfb[_0xecab('0x3b')]=qs[_0xecab('0x3c')](_[_0xecab('0x3d')](_0x4cb031[_0xecab('0x33')],_0x1e3b00[_0xecab('0x3c')]),_0x10d741);if(_0x4cb031[_0xecab('0x33')][_0xecab('0x3e')]){_0x4b3dfb[_0xecab('0x3b')]=_[_0xecab('0x3f')](_0x4b3dfb[_0xecab('0x3b')],{'$or':_[_0xecab('0x2c')](_0x10d741,function(_0x2ef3ec){if(_0x2ef3ec['type']!==_0xecab('0x40')){var _0x1b8e3e={};_0x1b8e3e[_0x2ef3ec[_0xecab('0x29')]]={'$like':'%'+_0x4cb031['query'][_0xecab('0x3e')]+'%'};return _0x1b8e3e;}})});}_0x4b3dfb=_[_0xecab('0x3f')]({},_0x4b3dfb,_0x4cb031[_0xecab('0x41')]);var _0x27a4b0={'where':_0x4b3dfb['where']};return db[_0xecab('0x2d')][_0xecab('0x1b')](_0x27a4b0)['then'](function(_0x217be9){_0x11208e[_0xecab('0x1b')]=_0x217be9;if(_0x4cb031[_0xecab('0x33')][_0xecab('0x42')]){_0x4b3dfb[_0xecab('0x43')]=[{'all':!![]}];}return db[_0xecab('0x2d')][_0xecab('0x44')](_0x4b3dfb);})['then'](function(_0x5e6c6b){_0x11208e[_0xecab('0x45')]=_0x5e6c6b;return _0x11208e;})['then'](respondWithFilteredResult(_0x291dfe,_0x4b3dfb))[_0xecab('0x46')](handleError(_0x291dfe,null));};exports[_0xecab('0x47')]=function(_0x4ab62c,_0x2c1391){var _0x3d4d5e={'raw':!![],'where':{'id':_0x4ab62c[_0xecab('0x48')]['id']}},_0x2dd6ef={};_0x2dd6ef[_0xecab('0x32')]=_[_0xecab('0x49')](db[_0xecab('0x2d')][_0xecab('0x2e')]);_0x2dd6ef[_0xecab('0x33')]=_[_0xecab('0x49')](_0x4ab62c[_0xecab('0x33')]);_0x2dd6ef[_0xecab('0x3c')]=_['intersection'](_0x2dd6ef['model'],_0x2dd6ef['query']);_0x3d4d5e[_0xecab('0x35')]=_['intersection'](_0x2dd6ef[_0xecab('0x32')],qs[_0xecab('0x36')](_0x4ab62c[_0xecab('0x33')][_0xecab('0x36')]));_0x3d4d5e['attributes']=_0x3d4d5e[_0xecab('0x35')][_0xecab('0x37')]?_0x3d4d5e['attributes']:_0x2dd6ef[_0xecab('0x32')];if(_0x4ab62c[_0xecab('0x33')][_0xecab('0x42')]){_0x3d4d5e[_0xecab('0x43')]=[{'all':!![]}];}_0x3d4d5e=_[_0xecab('0x3f')]({},_0x3d4d5e,_0x4ab62c[_0xecab('0x41')]);return db[_0xecab('0x2d')][_0xecab('0x4a')](_0x3d4d5e)[_0xecab('0x24')](handleEntityNotFound(_0x2c1391,null))[_0xecab('0x24')](respondWithResult(_0x2c1391,null))[_0xecab('0x46')](handleError(_0x2c1391,null));};exports['create']=function(_0x3228ce,_0x18c355){return db[_0xecab('0x2d')][_0xecab('0x4b')](_0x3228ce[_0xecab('0x4c')],{})[_0xecab('0x24')](function(_0x4ba5fa){var _0x204156=_0x3228ce[_0xecab('0x4d')][_0xecab('0x25')]({'plain':!![]});if(!_0x204156)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x204156[_0xecab('0x4e')]===_0xecab('0x4d')){var _0x2188b9=_0x4ba5fa[_0xecab('0x25')]({'plain':!![]});var _0x5b6b50=_0xecab('0x26');return db[_0xecab('0x4f')][_0xecab('0x4a')]({'where':{'name':_0x5b6b50,'userProfileId':_0x204156['userProfileId']},'raw':!![]})['then'](function(_0x25a785){if(_0x25a785&&_0x25a785[_0xecab('0x50')]===0x0){return db[_0xecab('0x51')][_0xecab('0x4b')]({'name':_0x2188b9[_0xecab('0x29')],'resourceId':_0x2188b9['id'],'type':_0x25a785[_0xecab('0x29')],'sectionId':_0x25a785['id']},{})[_0xecab('0x24')](function(){return _0x4ba5fa;});}else{return _0x4ba5fa;}})[_0xecab('0x46')](function(_0x28c5ee){logger['error'](_0xecab('0x52'),_0x28c5ee);throw _0x28c5ee;});}return _0x4ba5fa;})[_0xecab('0x24')](respondWithResult(_0x18c355,0xc9))[_0xecab('0x46')](handleError(_0x18c355,null));};exports['update']=function(_0x171245,_0x53ea05){if(_0x171245[_0xecab('0x4c')]['id']){delete _0x171245[_0xecab('0x4c')]['id'];}return db[_0xecab('0x2d')]['find']({'where':{'id':_0x171245[_0xecab('0x48')]['id']}})['then'](handleEntityNotFound(_0x53ea05,null))[_0xecab('0x24')](saveUpdates(_0x171245[_0xecab('0x4c')],null))['then'](respondWithResult(_0x53ea05,null))[_0xecab('0x46')](handleError(_0x53ea05,null));};exports[_0xecab('0x23')]=function(_0x3d8029,_0x26a955){return db['CmContactHasItem'][_0xecab('0x4a')]({'where':{'id':_0x3d8029[_0xecab('0x48')]['id']}})['then'](handleEntityNotFound(_0x26a955,null))['then'](removeEntity(_0x26a955,null))[_0xecab('0x46')](handleError(_0x26a955,null));}; \ No newline at end of file +var _0x59d5=['find','catch','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','get','CmContactHasItems','UserProfileResource','destroy','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include','params','length'];(function(_0xf2109d,_0x5b68e2){var _0x6d2176=function(_0x384b84){while(--_0x384b84){_0xf2109d['push'](_0xf2109d['shift']());}};_0x6d2176(++_0x5b68e2);}(_0x59d5,0x130));var _0x559d=function(_0x23ddcd,_0x1cdbad){_0x23ddcd=_0x23ddcd-0x0;var _0x58e43a=_0x59d5[_0x23ddcd];return _0x58e43a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x559d('0x0'));var rimraf=require(_0x559d('0x1'));var zipdir=require(_0x559d('0x2'));var jsonpatch=require(_0x559d('0x3'));var rp=require(_0x559d('0x4'));var moment=require(_0x559d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x559d('0x6'));var path=require(_0x559d('0x7'));var sox=require(_0x559d('0x8'));var csv=require(_0x559d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x559d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x559d('0xb'));var toCsv=require(_0x559d('0x9'));var querystring=require('querystring');var Papa=require(_0x559d('0xc'));var Redis=require(_0x559d('0xd'));var authService=require(_0x559d('0xe'));var qs=require(_0x559d('0xf'));var as=require(_0x559d('0x10'));var hardwareService=require(_0x559d('0x11'));var logger=require(_0x559d('0x12'))(_0x559d('0x13'));var utils=require('../../config/utils');var config=require(_0x559d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x559d('0x15'))['db'];function respondWithStatusCode(_0x1fd7a2,_0x3e11cc){_0x3e11cc=_0x3e11cc||0xcc;return function(_0x1145a9){if(_0x1145a9){return _0x1fd7a2[_0x559d('0x16')](_0x3e11cc);}return _0x1fd7a2[_0x559d('0x17')](_0x3e11cc)[_0x559d('0x18')]();};}function respondWithResult(_0x370dd2,_0x3d96aa){_0x3d96aa=_0x3d96aa||0xc8;return function(_0x19b51a){if(_0x19b51a){return _0x370dd2[_0x559d('0x17')](_0x3d96aa)[_0x559d('0x19')](_0x19b51a);}};}function respondWithFilteredResult(_0x48b3b4,_0x338caa){return function(_0x3326a9){if(_0x3326a9){var _0x4ae551=_0x3326a9[_0x559d('0x1a')],_0x4920d1=_0x338caa[_0x559d('0x1b')],_0x22f84b=_0x338caa[_0x559d('0x1b')]+_0x338caa['limit'],_0x5ca53b;if(_0x22f84b>=_0x4ae551){_0x22f84b=_0x4ae551;_0x5ca53b=0xc8;}else{_0x5ca53b=0xce;}_0x48b3b4['status'](_0x5ca53b);return _0x48b3b4[_0x559d('0x1c')](_0x559d('0x1d'),_0x4920d1+'-'+_0x22f84b+'/'+_0x4ae551)[_0x559d('0x19')](_0x3326a9);}return null;};}function patchUpdates(_0xacf3e8){return function(_0x453869){try{jsonpatch['apply'](_0x453869,_0xacf3e8,!![]);}catch(_0x556829){return BPromise['reject'](_0x556829);}return _0x453869[_0x559d('0x1e')]();};}function saveUpdates(_0x3ea3b5,_0xe4b1ca){return function(_0x9f7e0c){if(_0x9f7e0c){return _0x9f7e0c[_0x559d('0x1f')](_0x3ea3b5)[_0x559d('0x20')](function(_0x47efb3){return _0x47efb3;});}return null;};}function removeEntity(_0x291dee,_0x3f923d){return function(_0x18666e){if(_0x18666e){return _0x18666e['destroy']()[_0x559d('0x20')](function(){var _0x417b86=_0x18666e[_0x559d('0x21')]({'plain':!![]});var _0x38ffc4=_0x559d('0x22');return db[_0x559d('0x23')][_0x559d('0x24')]({'where':{'type':_0x38ffc4,'resourceId':_0x417b86['id']}})[_0x559d('0x20')](function(){return _0x18666e;});})[_0x559d('0x20')](function(){_0x291dee[_0x559d('0x17')](0xcc)[_0x559d('0x18')]();});}};}function handleEntityNotFound(_0x9b594f,_0x529219){return function(_0x1d8e98){if(!_0x1d8e98){_0x9b594f[_0x559d('0x16')](0x194);}return _0x1d8e98;};}function handleError(_0x4f759b,_0x5f5130){_0x5f5130=_0x5f5130||0x1f4;return function(_0x229679){logger[_0x559d('0x25')](_0x229679[_0x559d('0x26')]);if(_0x229679[_0x559d('0x27')]){delete _0x229679[_0x559d('0x27')];}_0x4f759b['status'](_0x5f5130)[_0x559d('0x28')](_0x229679);};}exports[_0x559d('0x29')]=function(_0x498024,_0x304724){var _0x3f6f5f={},_0x519cae={},_0x482990={'count':0x0,'rows':[]};var _0x50b584=_[_0x559d('0x2a')](db[_0x559d('0x2b')][_0x559d('0x2c')],function(_0x131afc){return{'name':_0x131afc['fieldName'],'type':_0x131afc[_0x559d('0x2d')][_0x559d('0x2e')]};});_0x519cae['model']=_['map'](_0x50b584,_0x559d('0x27'));_0x519cae[_0x559d('0x2f')]=_[_0x559d('0x30')](_0x498024['query']);_0x519cae[_0x559d('0x31')]=_[_0x559d('0x32')](_0x519cae[_0x559d('0x33')],_0x519cae['query']);_0x3f6f5f[_0x559d('0x34')]=_['intersection'](_0x519cae[_0x559d('0x33')],qs[_0x559d('0x35')](_0x498024[_0x559d('0x2f')][_0x559d('0x35')]));_0x3f6f5f[_0x559d('0x34')]=_0x3f6f5f[_0x559d('0x34')]['length']?_0x3f6f5f[_0x559d('0x34')]:_0x519cae['model'];if(!_0x498024[_0x559d('0x2f')]['hasOwnProperty'](_0x559d('0x36'))){_0x3f6f5f[_0x559d('0x37')]=qs[_0x559d('0x37')](_0x498024['query'][_0x559d('0x37')]);_0x3f6f5f['offset']=qs[_0x559d('0x1b')](_0x498024['query']['offset']);}_0x3f6f5f['order']=qs[_0x559d('0x38')](_0x498024[_0x559d('0x2f')][_0x559d('0x38')]);_0x3f6f5f[_0x559d('0x39')]=qs[_0x559d('0x31')](_[_0x559d('0x3a')](_0x498024['query'],_0x519cae[_0x559d('0x31')]),_0x50b584);if(_0x498024['query'][_0x559d('0x3b')]){_0x3f6f5f[_0x559d('0x39')]=_[_0x559d('0x3c')](_0x3f6f5f['where'],{'$or':_[_0x559d('0x2a')](_0x50b584,function(_0x39aa9d){if(_0x39aa9d[_0x559d('0x2d')]!=='VIRTUAL'){var _0x66af77={};_0x66af77[_0x39aa9d[_0x559d('0x27')]]={'$like':'%'+_0x498024[_0x559d('0x2f')][_0x559d('0x3b')]+'%'};return _0x66af77;}})});}_0x3f6f5f=_['merge']({},_0x3f6f5f,_0x498024[_0x559d('0x3d')]);var _0x480327={'where':_0x3f6f5f[_0x559d('0x39')]};return db[_0x559d('0x2b')][_0x559d('0x1a')](_0x480327)['then'](function(_0x4e2c6e){_0x482990[_0x559d('0x1a')]=_0x4e2c6e;if(_0x498024['query'][_0x559d('0x3e')]){_0x3f6f5f[_0x559d('0x3f')]=[{'all':!![]}];}return db[_0x559d('0x2b')]['findAll'](_0x3f6f5f);})[_0x559d('0x20')](function(_0x3cabb2){_0x482990['rows']=_0x3cabb2;return _0x482990;})[_0x559d('0x20')](respondWithFilteredResult(_0x304724,_0x3f6f5f))['catch'](handleError(_0x304724,null));};exports['show']=function(_0x2f1d32,_0x322c71){var _0x2b2de0={'raw':!![],'where':{'id':_0x2f1d32[_0x559d('0x40')]['id']}},_0x9b4b5d={};_0x9b4b5d[_0x559d('0x33')]=_[_0x559d('0x30')](db['CmContactHasItem'][_0x559d('0x2c')]);_0x9b4b5d[_0x559d('0x2f')]=_[_0x559d('0x30')](_0x2f1d32[_0x559d('0x2f')]);_0x9b4b5d[_0x559d('0x31')]=_[_0x559d('0x32')](_0x9b4b5d[_0x559d('0x33')],_0x9b4b5d[_0x559d('0x2f')]);_0x2b2de0['attributes']=_[_0x559d('0x32')](_0x9b4b5d[_0x559d('0x33')],qs[_0x559d('0x35')](_0x2f1d32[_0x559d('0x2f')]['fields']));_0x2b2de0[_0x559d('0x34')]=_0x2b2de0[_0x559d('0x34')][_0x559d('0x41')]?_0x2b2de0[_0x559d('0x34')]:_0x9b4b5d['model'];if(_0x2f1d32['query'][_0x559d('0x3e')]){_0x2b2de0[_0x559d('0x3f')]=[{'all':!![]}];}_0x2b2de0=_[_0x559d('0x3c')]({},_0x2b2de0,_0x2f1d32['options']);return db[_0x559d('0x2b')][_0x559d('0x42')](_0x2b2de0)[_0x559d('0x20')](handleEntityNotFound(_0x322c71,null))[_0x559d('0x20')](respondWithResult(_0x322c71,null))[_0x559d('0x43')](handleError(_0x322c71,null));};exports['create']=function(_0x56e2c5,_0x383623){return db['CmContactHasItem'][_0x559d('0x44')](_0x56e2c5[_0x559d('0x45')],{})[_0x559d('0x20')](function(_0x5aeaa9){var _0x462f5a=_0x56e2c5[_0x559d('0x46')][_0x559d('0x21')]({'plain':!![]});if(!_0x462f5a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x462f5a['role']===_0x559d('0x46')){var _0x3f23f7=_0x5aeaa9[_0x559d('0x21')]({'plain':!![]});var _0x12e8ad=_0x559d('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x12e8ad,'userProfileId':_0x462f5a[_0x559d('0x47')]},'raw':!![]})[_0x559d('0x20')](function(_0xab8028){if(_0xab8028&&_0xab8028[_0x559d('0x48')]===0x0){return db[_0x559d('0x23')][_0x559d('0x44')]({'name':_0x3f23f7[_0x559d('0x27')],'resourceId':_0x3f23f7['id'],'type':_0xab8028[_0x559d('0x27')],'sectionId':_0xab8028['id']},{})[_0x559d('0x20')](function(){return _0x5aeaa9;});}else{return _0x5aeaa9;}})[_0x559d('0x43')](function(_0x10d7f0){logger[_0x559d('0x25')](_0x559d('0x49'),_0x10d7f0);throw _0x10d7f0;});}return _0x5aeaa9;})['then'](respondWithResult(_0x383623,0xc9))[_0x559d('0x43')](handleError(_0x383623,null));};exports[_0x559d('0x1f')]=function(_0x518aae,_0x3b83f3){if(_0x518aae['body']['id']){delete _0x518aae[_0x559d('0x45')]['id'];}return db[_0x559d('0x2b')][_0x559d('0x42')]({'where':{'id':_0x518aae['params']['id']}})[_0x559d('0x20')](handleEntityNotFound(_0x3b83f3,null))[_0x559d('0x20')](saveUpdates(_0x518aae[_0x559d('0x45')],null))['then'](respondWithResult(_0x3b83f3,null))['catch'](handleError(_0x3b83f3,null));};exports[_0x559d('0x24')]=function(_0x67e13c,_0x1f6d5e){return db[_0x559d('0x2b')][_0x559d('0x42')]({'where':{'id':_0x67e13c['params']['id']}})[_0x559d('0x20')](handleEntityNotFound(_0x1f6d5e,null))['then'](removeEntity(_0x1f6d5e,null))['catch'](handleError(_0x1f6d5e,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 9d16131..b294a14 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 _0xef17=['./cmContactHasItem.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x37e845,_0x219f9f){var _0x59e55b=function(_0x5dc6c8){while(--_0x5dc6c8){_0x37e845['push'](_0x37e845['shift']());}};_0x59e55b(++_0x219f9f);}(_0xef17,0x136));var _0x7ef1=function(_0x3f00bd,_0x506dee){_0x3f00bd=_0x3f00bd-0x0;var _0x24d2ec=_0xef17[_0x3f00bd];return _0x24d2ec;};'use strict';var _=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var logger=require(_0x7ef1('0x2'))(_0x7ef1('0x3'));var moment=require(_0x7ef1('0x4'));var BPromise=require(_0x7ef1('0x5'));var rp=require(_0x7ef1('0x6'));var fs=require('fs');var path=require(_0x7ef1('0x7'));var rimraf=require(_0x7ef1('0x8'));var config=require('../../config/environment');var attributes=require(_0x7ef1('0x9'));module['exports']=function(_0x138ed1,_0x498596){return _0x138ed1[_0x7ef1('0xa')]('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d58=['request-promise','rimraf','../../config/environment','exports','define','cm_contact_has_items','bluebird'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0x5d58,0x187));var _0x85d5=function(_0x4de8a8,_0x2dc789){_0x4de8a8=_0x4de8a8-0x0;var _0x5f595c=_0x5d58[_0x4de8a8];return _0x5f595c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x85d5('0x0'));var rp=require(_0x85d5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var attributes=require('./cmContactHasItem.attributes');module[_0x85d5('0x4')]=function(_0x2d457a,_0x578fad){return _0x2d457a[_0x85d5('0x5')]('CmContactHasItem',attributes,{'tableName':_0x85d5('0x6'),'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 3110ba6..cc444fa 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 _0xd406=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s'];(function(_0x1a82b8,_0x23613a){var _0x4e53d6=function(_0x371c1b){while(--_0x371c1b){_0x1a82b8['push'](_0x1a82b8['shift']());}};_0x4e53d6(++_0x23613a);}(_0xd406,0x90));var _0x6d40=function(_0x5e77b0,_0x177c6e){_0x5e77b0=_0x5e77b0-0x0;var _0x8773d3=_0xd406[_0x5e77b0];return _0x8773d3;};'use strict';var _=require(_0x6d40('0x0'));var util=require(_0x6d40('0x1'));var moment=require(_0x6d40('0x2'));var BPromise=require('bluebird');var rs=require(_0x6d40('0x3'));var fs=require('fs');var Redis=require(_0x6d40('0x4'));var db=require(_0x6d40('0x5'))['db'];var utils=require(_0x6d40('0x6'));var logger=require(_0x6d40('0x7'))('rpc');var config=require(_0x6d40('0x8'));var jayson=require(_0x6d40('0x9'));var client=jayson[_0x6d40('0xa')][_0x6d40('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5aa973,_0x23f6fd,_0x598bc6){return new BPromise(function(_0x5bdeac,_0x5419d9){return client[_0x6d40('0xc')](_0x5aa973,_0x598bc6)['then'](function(_0x2929cc){logger[_0x6d40('0xd')](_0x6d40('0xe'),_0x23f6fd,_0x6d40('0xf'));logger['debug'](_0x6d40('0x10'),_0x23f6fd,_0x6d40('0xf'),JSON[_0x6d40('0x11')](_0x2929cc));if(_0x2929cc['error']){if(_0x2929cc[_0x6d40('0x12')][_0x6d40('0x13')]===0x1f4){logger[_0x6d40('0x12')](_0x6d40('0xe'),_0x23f6fd,_0x2929cc[_0x6d40('0x12')][_0x6d40('0x14')]);return _0x5419d9(_0x2929cc[_0x6d40('0x12')][_0x6d40('0x14')]);}logger['error'](_0x6d40('0xe'),_0x23f6fd,_0x2929cc['error']['message']);return _0x5bdeac(_0x2929cc[_0x6d40('0x12')][_0x6d40('0x14')]);}else{logger[_0x6d40('0xd')](_0x6d40('0xe'),_0x23f6fd,'request\x20sent');_0x5bdeac(_0x2929cc[_0x6d40('0x15')][_0x6d40('0x14')]);}})[_0x6d40('0x16')](function(_0x458c5c){logger[_0x6d40('0x12')](_0x6d40('0xe'),_0x23f6fd,_0x458c5c);_0x5419d9(_0x458c5c);});});} \ No newline at end of file +var _0xf51e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch'];(function(_0x7066d,_0x47a9b3){var _0x2811fc=function(_0x27b572){while(--_0x27b572){_0x7066d['push'](_0x7066d['shift']());}};_0x2811fc(++_0x47a9b3);}(_0xf51e,0x9a));var _0xef51=function(_0xc12d5a,_0x20fbd3){_0xc12d5a=_0xc12d5a-0x0;var _0x12933c=_0xf51e[_0xc12d5a];return _0x12933c;};'use strict';var _=require('lodash');var util=require(_0xef51('0x0'));var moment=require(_0xef51('0x1'));var BPromise=require(_0xef51('0x2'));var rs=require(_0xef51('0x3'));var fs=require('fs');var Redis=require(_0xef51('0x4'));var db=require(_0xef51('0x5'))['db'];var utils=require(_0xef51('0x6'));var logger=require('../../config/logger')(_0xef51('0x7'));var config=require(_0xef51('0x8'));var jayson=require(_0xef51('0x9'));var client=jayson[_0xef51('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0537,_0x18ec67,_0x5b7a60){return new BPromise(function(_0x32e28a,_0x3ffdc1){return client[_0xef51('0xb')](_0x2c0537,_0x5b7a60)[_0xef51('0xc')](function(_0x9b44d){logger['info'](_0xef51('0xd'),_0x18ec67,_0xef51('0xe'));logger[_0xef51('0xf')](_0xef51('0x10'),_0x18ec67,_0xef51('0xe'),JSON[_0xef51('0x11')](_0x9b44d));if(_0x9b44d['error']){if(_0x9b44d['error'][_0xef51('0x12')]===0x1f4){logger[_0xef51('0x13')](_0xef51('0xd'),_0x18ec67,_0x9b44d[_0xef51('0x13')][_0xef51('0x14')]);return _0x3ffdc1(_0x9b44d[_0xef51('0x13')][_0xef51('0x14')]);}logger[_0xef51('0x13')](_0xef51('0xd'),_0x18ec67,_0x9b44d[_0xef51('0x13')][_0xef51('0x14')]);return _0x32e28a(_0x9b44d[_0xef51('0x13')][_0xef51('0x14')]);}else{logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x18ec67,'request\x20sent');_0x32e28a(_0x9b44d['result'][_0xef51('0x14')]);}})[_0xef51('0x15')](function(_0x4d6d26){logger[_0xef51('0x13')](_0xef51('0xd'),_0x18ec67,_0x4d6d26);_0x3ffdc1(_0x4d6d26);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index cc4b986..ad52b2b 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 _0x773f=['exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x5a15b0,_0x536bb2){var _0x2b4e64=function(_0x59869e){while(--_0x59869e){_0x5a15b0['push'](_0x5a15b0['shift']());}};_0x2b4e64(++_0x536bb2);}(_0x773f,0xeb));var _0xf773=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0x773f[_0x4d7a61];return _0x186f73;};'use strict';var multer=require(_0xf773('0x0'));var util=require(_0xf773('0x1'));var path=require('path');var timeout=require(_0xf773('0x2'));var express=require(_0xf773('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf773('0x4'));var config=require(_0xf773('0x5'));var controller=require(_0xf773('0x6'));router[_0xf773('0x7')]('/',auth[_0xf773('0x8')](),controller['index']);router[_0xf773('0x7')](_0xf773('0x9'),auth[_0xf773('0x8')](),controller[_0xf773('0xa')]);router[_0xf773('0xb')]('/',auth['isAuthenticated'](),controller[_0xf773('0xc')]);router[_0xf773('0xd')](_0xf773('0x9'),auth[_0xf773('0x8')](),controller[_0xf773('0xe')]);router[_0xf773('0xf')](_0xf773('0x9'),auth[_0xf773('0x8')](),controller[_0xf773('0x10')]);module[_0xf773('0x11')]=router; \ No newline at end of file +var _0xa942=['create','put','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x1483b6,_0x4b1630){var _0x47ec42=function(_0x3e1a67){while(--_0x3e1a67){_0x1483b6['push'](_0x1483b6['shift']());}};_0x47ec42(++_0x4b1630);}(_0xa942,0x194));var _0x2a94=function(_0x2df9b2,_0x3b3b05){_0x2df9b2=_0x2df9b2-0x0;var _0x3fa494=_0xa942[_0x2df9b2];return _0x3fa494;};'use strict';var multer=require(_0x2a94('0x0'));var util=require('util');var path=require(_0x2a94('0x1'));var timeout=require(_0x2a94('0x2'));var express=require('express');var router=express[_0x2a94('0x3')]();var auth=require(_0x2a94('0x4'));var interaction=require(_0x2a94('0x5'));var config=require(_0x2a94('0x6'));var controller=require(_0x2a94('0x7'));router[_0x2a94('0x8')]('/',auth[_0x2a94('0x9')](),controller[_0x2a94('0xa')]);router['get'](_0x2a94('0xb'),auth[_0x2a94('0x9')](),controller[_0x2a94('0xc')]);router[_0x2a94('0xd')]('/',auth[_0x2a94('0x9')](),controller[_0x2a94('0xe')]);router[_0x2a94('0xf')](_0x2a94('0xb'),auth[_0x2a94('0x9')](),controller[_0x2a94('0x10')]);router['delete']('/:id',auth[_0x2a94('0x9')](),controller[_0x2a94('0x11')]);module[_0x2a94('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index d06c79e..4103aaa 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 _0xbc18=['sequelize','exports','INTEGER','STRING'];(function(_0x143620,_0x113d45){var _0x40341b=function(_0x608aa3){while(--_0x608aa3){_0x143620['push'](_0x143620['shift']());}};_0x40341b(++_0x113d45);}(_0xbc18,0x1cc));var _0x8bc1=function(_0x5947f8,_0x305779){_0x5947f8=_0x5947f8-0x0;var _0x43888e=_0xbc18[_0x5947f8];return _0x43888e;};'use strict';var Sequelize=require(_0x8bc1('0x0'));module[_0x8bc1('0x1')]={'CmContactId':{'type':Sequelize[_0x8bc1('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x8bc1('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xa3b8=['STRING','exports','INTEGER'];(function(_0x54ab6a,_0x5a88a5){var _0x23a825=function(_0x48c880){while(--_0x48c880){_0x54ab6a['push'](_0x54ab6a['shift']());}};_0x23a825(++_0x5a88a5);}(_0xa3b8,0xf7));var _0x8a3b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa3b8[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x8a3b('0x0')]={'CmContactId':{'type':Sequelize[_0x8a3b('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x8a3b('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 1794d58..bdbc848 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 _0xb911=['length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','CmContactHasPhones','end','error','stack','name','send','index','map','CmContactHasPhone','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes'];(function(_0x1d426f,_0x37e919){var _0x17f71a=function(_0x3bf60c){while(--_0x3bf60c){_0x1d426f['push'](_0x1d426f['shift']());}};_0x17f71a(++_0x37e919);}(_0xb911,0x1a4));var _0x1b91=function(_0x59b439,_0x4e16b6){_0x59b439=_0x59b439-0x0;var _0x74d02b=_0xb911[_0x59b439];return _0x74d02b;};'use strict';var pdf=require(_0x1b91('0x0'));var emlformat=require(_0x1b91('0x1'));var rimraf=require(_0x1b91('0x2'));var zipdir=require(_0x1b91('0x3'));var jsonpatch=require(_0x1b91('0x4'));var rp=require(_0x1b91('0x5'));var moment=require('moment');var BPromise=require(_0x1b91('0x6'));var Mustache=require(_0x1b91('0x7'));var util=require('util');var path=require(_0x1b91('0x8'));var sox=require(_0x1b91('0x9'));var csv=require(_0x1b91('0xa'));var ejs=require(_0x1b91('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1b91('0xc'));var crypto=require(_0x1b91('0xd'));var jsforce=require(_0x1b91('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1b91('0xa'));var querystring=require(_0x1b91('0xf'));var Papa=require(_0x1b91('0x10'));var Redis=require(_0x1b91('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1b91('0x12'));var as=require(_0x1b91('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1b91('0x14'));var config=require(_0x1b91('0x15'));var licenseUtil=require(_0x1b91('0x16'));var db=require(_0x1b91('0x17'))['db'];function respondWithStatusCode(_0x38b6e1,_0x462e9a){_0x462e9a=_0x462e9a||0xcc;return function(_0x3a2d47){if(_0x3a2d47){return _0x38b6e1[_0x1b91('0x18')](_0x462e9a);}return _0x38b6e1[_0x1b91('0x19')](_0x462e9a)['end']();};}function respondWithResult(_0x326318,_0x1641f8){_0x1641f8=_0x1641f8||0xc8;return function(_0x2cac1d){if(_0x2cac1d){return _0x326318[_0x1b91('0x19')](_0x1641f8)[_0x1b91('0x1a')](_0x2cac1d);}};}function respondWithFilteredResult(_0x2fd073,_0x148372){return function(_0x5b571c){if(_0x5b571c){var _0x5b6898=_0x5b571c[_0x1b91('0x1b')],_0x315268=_0x148372['offset'],_0x2fa998=_0x148372[_0x1b91('0x1c')]+_0x148372[_0x1b91('0x1d')],_0x5e5214;if(_0x2fa998>=_0x5b6898){_0x2fa998=_0x5b6898;_0x5e5214=0xc8;}else{_0x5e5214=0xce;}_0x2fd073[_0x1b91('0x19')](_0x5e5214);return _0x2fd073['set'](_0x1b91('0x1e'),_0x315268+'-'+_0x2fa998+'/'+_0x5b6898)[_0x1b91('0x1a')](_0x5b571c);}return null;};}function patchUpdates(_0x4d6570){return function(_0x3bdccb){try{jsonpatch[_0x1b91('0x1f')](_0x3bdccb,_0x4d6570,!![]);}catch(_0x1069d9){return BPromise[_0x1b91('0x20')](_0x1069d9);}return _0x3bdccb[_0x1b91('0x21')]();};}function saveUpdates(_0xe85452,_0x33a3e1){return function(_0x58c04e){if(_0x58c04e){return _0x58c04e['update'](_0xe85452)[_0x1b91('0x22')](function(_0x3ded5d){return _0x3ded5d;});}return null;};}function removeEntity(_0x4b6e08,_0x4e6989){return function(_0x10d3cd){if(_0x10d3cd){return _0x10d3cd['destroy']()[_0x1b91('0x22')](function(){var _0x3cc583=_0x10d3cd['get']({'plain':!![]});var _0x54e38f=_0x1b91('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x54e38f,'resourceId':_0x3cc583['id']}})[_0x1b91('0x22')](function(){return _0x10d3cd;});})['then'](function(){_0x4b6e08[_0x1b91('0x19')](0xcc)[_0x1b91('0x24')]();});}};}function handleEntityNotFound(_0x3e06c1,_0x53178a){return function(_0x2b8b79){if(!_0x2b8b79){_0x3e06c1[_0x1b91('0x18')](0x194);}return _0x2b8b79;};}function handleError(_0x553f28,_0x4aa7fa){_0x4aa7fa=_0x4aa7fa||0x1f4;return function(_0x43cdb4){logger[_0x1b91('0x25')](_0x43cdb4[_0x1b91('0x26')]);if(_0x43cdb4[_0x1b91('0x27')]){delete _0x43cdb4[_0x1b91('0x27')];}_0x553f28[_0x1b91('0x19')](_0x4aa7fa)[_0x1b91('0x28')](_0x43cdb4);};}exports[_0x1b91('0x29')]=function(_0x5150d0,_0x7fe5fb){var _0xa56229={},_0x5f1df0={},_0x2565ae={'count':0x0,'rows':[]};var _0x22e215=_[_0x1b91('0x2a')](db[_0x1b91('0x2b')][_0x1b91('0x2c')],function(_0x141257){return{'name':_0x141257[_0x1b91('0x2d')],'type':_0x141257[_0x1b91('0x2e')]['key']};});_0x5f1df0['model']=_[_0x1b91('0x2a')](_0x22e215,'name');_0x5f1df0[_0x1b91('0x2f')]=_[_0x1b91('0x30')](_0x5150d0['query']);_0x5f1df0[_0x1b91('0x31')]=_[_0x1b91('0x32')](_0x5f1df0['model'],_0x5f1df0[_0x1b91('0x2f')]);_0xa56229['attributes']=_['intersection'](_0x5f1df0[_0x1b91('0x33')],qs['fields'](_0x5150d0['query'][_0x1b91('0x34')]));_0xa56229[_0x1b91('0x35')]=_0xa56229[_0x1b91('0x35')][_0x1b91('0x36')]?_0xa56229['attributes']:_0x5f1df0[_0x1b91('0x33')];if(!_0x5150d0[_0x1b91('0x2f')][_0x1b91('0x37')]('nolimit')){_0xa56229[_0x1b91('0x1d')]=qs['limit'](_0x5150d0['query'][_0x1b91('0x1d')]);_0xa56229[_0x1b91('0x1c')]=qs[_0x1b91('0x1c')](_0x5150d0[_0x1b91('0x2f')][_0x1b91('0x1c')]);}_0xa56229['order']=qs[_0x1b91('0x38')](_0x5150d0['query'][_0x1b91('0x38')]);_0xa56229['where']=qs[_0x1b91('0x31')](_['pick'](_0x5150d0[_0x1b91('0x2f')],_0x5f1df0['filters']),_0x22e215);if(_0x5150d0[_0x1b91('0x2f')][_0x1b91('0x39')]){_0xa56229[_0x1b91('0x3a')]=_[_0x1b91('0x3b')](_0xa56229[_0x1b91('0x3a')],{'$or':_[_0x1b91('0x2a')](_0x22e215,function(_0x59cc1f){if(_0x59cc1f['type']!==_0x1b91('0x3c')){var _0x1dbc0b={};_0x1dbc0b[_0x59cc1f[_0x1b91('0x27')]]={'$like':'%'+_0x5150d0[_0x1b91('0x2f')][_0x1b91('0x39')]+'%'};return _0x1dbc0b;}})});}_0xa56229=_['merge']({},_0xa56229,_0x5150d0[_0x1b91('0x3d')]);var _0x1be855={'where':_0xa56229[_0x1b91('0x3a')]};return db['CmContactHasPhone'][_0x1b91('0x1b')](_0x1be855)['then'](function(_0x347426){_0x2565ae[_0x1b91('0x1b')]=_0x347426;if(_0x5150d0[_0x1b91('0x2f')]['includeAll']){_0xa56229[_0x1b91('0x3e')]=[{'all':!![]}];}return db[_0x1b91('0x2b')][_0x1b91('0x3f')](_0xa56229);})[_0x1b91('0x22')](function(_0x518a09){_0x2565ae['rows']=_0x518a09;return _0x2565ae;})['then'](respondWithFilteredResult(_0x7fe5fb,_0xa56229))[_0x1b91('0x40')](handleError(_0x7fe5fb,null));};exports[_0x1b91('0x41')]=function(_0x2b7a62,_0x24a798){var _0x5e8a38={'raw':!![],'where':{'id':_0x2b7a62[_0x1b91('0x42')]['id']}},_0x893fc2={};_0x893fc2['model']=_[_0x1b91('0x30')](db[_0x1b91('0x2b')][_0x1b91('0x2c')]);_0x893fc2['query']=_[_0x1b91('0x30')](_0x2b7a62[_0x1b91('0x2f')]);_0x893fc2[_0x1b91('0x31')]=_[_0x1b91('0x32')](_0x893fc2[_0x1b91('0x33')],_0x893fc2[_0x1b91('0x2f')]);_0x5e8a38['attributes']=_[_0x1b91('0x32')](_0x893fc2['model'],qs[_0x1b91('0x34')](_0x2b7a62['query'][_0x1b91('0x34')]));_0x5e8a38[_0x1b91('0x35')]=_0x5e8a38[_0x1b91('0x35')][_0x1b91('0x36')]?_0x5e8a38[_0x1b91('0x35')]:_0x893fc2[_0x1b91('0x33')];if(_0x2b7a62['query'][_0x1b91('0x43')]){_0x5e8a38[_0x1b91('0x3e')]=[{'all':!![]}];}_0x5e8a38=_[_0x1b91('0x3b')]({},_0x5e8a38,_0x2b7a62[_0x1b91('0x3d')]);return db[_0x1b91('0x2b')][_0x1b91('0x44')](_0x5e8a38)[_0x1b91('0x22')](handleEntityNotFound(_0x24a798,null))[_0x1b91('0x22')](respondWithResult(_0x24a798,null))[_0x1b91('0x40')](handleError(_0x24a798,null));};exports[_0x1b91('0x45')]=function(_0x58241d,_0x152982){return db[_0x1b91('0x2b')]['create'](_0x58241d[_0x1b91('0x46')],{})[_0x1b91('0x22')](function(_0x590155){var _0x156e46=_0x58241d[_0x1b91('0x47')][_0x1b91('0x48')]({'plain':!![]});if(!_0x156e46)throw new Error(_0x1b91('0x49'));if(_0x156e46['role']==='user'){var _0x968217=_0x590155[_0x1b91('0x48')]({'plain':!![]});var _0xf0a048=_0x1b91('0x23');return db[_0x1b91('0x4a')][_0x1b91('0x44')]({'where':{'name':_0xf0a048,'userProfileId':_0x156e46[_0x1b91('0x4b')]},'raw':!![]})['then'](function(_0x3e5bc0){if(_0x3e5bc0&&_0x3e5bc0['autoAssociation']===0x0){return db[_0x1b91('0x4c')]['create']({'name':_0x968217['name'],'resourceId':_0x968217['id'],'type':_0x3e5bc0[_0x1b91('0x27')],'sectionId':_0x3e5bc0['id']},{})[_0x1b91('0x22')](function(){return _0x590155;});}else{return _0x590155;}})[_0x1b91('0x40')](function(_0x2369bc){logger[_0x1b91('0x25')](_0x1b91('0x4d'),_0x2369bc);throw _0x2369bc;});}return _0x590155;})[_0x1b91('0x22')](respondWithResult(_0x152982,0xc9))['catch'](handleError(_0x152982,null));};exports['update']=function(_0x4b824e,_0x391021){if(_0x4b824e[_0x1b91('0x46')]['id']){delete _0x4b824e[_0x1b91('0x46')]['id'];}return db[_0x1b91('0x2b')]['find']({'where':{'id':_0x4b824e[_0x1b91('0x42')]['id']}})['then'](handleEntityNotFound(_0x391021,null))[_0x1b91('0x22')](saveUpdates(_0x4b824e[_0x1b91('0x46')],null))[_0x1b91('0x22')](respondWithResult(_0x391021,null))[_0x1b91('0x40')](handleError(_0x391021,null));};exports[_0x1b91('0x4e')]=function(_0x3216ba,_0x3bb26d){return db['CmContactHasPhone'][_0x1b91('0x44')]({'where':{'id':_0x3216ba['params']['id']}})[_0x1b91('0x22')](handleEntityNotFound(_0x3bb26d,null))[_0x1b91('0x22')](removeEntity(_0x3bb26d,null))[_0x1b91('0x40')](handleError(_0x3bb26d,null));}; \ No newline at end of file +var _0x96d2=['end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','CmContactHasPhones','error','stack','name','index','rawAttributes','fieldName','type','model','query','keys','filters','attributes','length','order','sort','where','pick','filter','map','VIRTUAL','merge','options','CmContactHasPhone','includeAll','include','rows','catch','show','intersection','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','params','html-pdf','eml-format','request-promise','bluebird','util','path','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x1c4b44,_0x2377de){var _0x10d72b=function(_0x2bd31e){while(--_0x2bd31e){_0x1c4b44['push'](_0x1c4b44['shift']());}};_0x10d72b(++_0x2377de);}(_0x96d2,0x119));var _0x296d=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x96d2[_0x5a3cf0];return _0x5a64ee;};'use strict';var pdf=require(_0x296d('0x0'));var emlformat=require(_0x296d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x296d('0x2'));var moment=require('moment');var BPromise=require(_0x296d('0x3'));var Mustache=require('mustache');var util=require(_0x296d('0x4'));var path=require(_0x296d('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x296d('0x6'));var squel=require(_0x296d('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x296d('0x8'));var toCsv=require('to-csv');var querystring=require(_0x296d('0x9'));var Papa=require(_0x296d('0xa'));var Redis=require(_0x296d('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x296d('0xc'));var as=require(_0x296d('0xd'));var hardwareService=require(_0x296d('0xe'));var logger=require(_0x296d('0xf'))(_0x296d('0x10'));var utils=require(_0x296d('0x11'));var config=require(_0x296d('0x12'));var licenseUtil=require(_0x296d('0x13'));var db=require(_0x296d('0x14'))['db'];function respondWithStatusCode(_0x2ebc16,_0x3d120f){_0x3d120f=_0x3d120f||0xcc;return function(_0xe83159){if(_0xe83159){return _0x2ebc16[_0x296d('0x15')](_0x3d120f);}return _0x2ebc16[_0x296d('0x16')](_0x3d120f)[_0x296d('0x17')]();};}function respondWithResult(_0x3d8b7a,_0x33646d){_0x33646d=_0x33646d||0xc8;return function(_0x75d2bb){if(_0x75d2bb){return _0x3d8b7a['status'](_0x33646d)[_0x296d('0x18')](_0x75d2bb);}};}function respondWithFilteredResult(_0x5886fd,_0x1b9a22){return function(_0x3e93ec){if(_0x3e93ec){var _0x37992d=_0x3e93ec[_0x296d('0x19')],_0x3d2eb0=_0x1b9a22[_0x296d('0x1a')],_0x4c0d72=_0x1b9a22['offset']+_0x1b9a22[_0x296d('0x1b')],_0x1b1c0c;if(_0x4c0d72>=_0x37992d){_0x4c0d72=_0x37992d;_0x1b1c0c=0xc8;}else{_0x1b1c0c=0xce;}_0x5886fd['status'](_0x1b1c0c);return _0x5886fd['set'](_0x296d('0x1c'),_0x3d2eb0+'-'+_0x4c0d72+'/'+_0x37992d)[_0x296d('0x18')](_0x3e93ec);}return null;};}function patchUpdates(_0x1f6a6f){return function(_0x29a7b9){try{jsonpatch[_0x296d('0x1d')](_0x29a7b9,_0x1f6a6f,!![]);}catch(_0xb32f39){return BPromise['reject'](_0xb32f39);}return _0x29a7b9[_0x296d('0x1e')]();};}function saveUpdates(_0x261e5c,_0x54648d){return function(_0x545733){if(_0x545733){return _0x545733[_0x296d('0x1f')](_0x261e5c)[_0x296d('0x20')](function(_0x392746){return _0x392746;});}return null;};}function removeEntity(_0x2f0748,_0xca9544){return function(_0x7a1edc){if(_0x7a1edc){return _0x7a1edc[_0x296d('0x21')]()[_0x296d('0x20')](function(){var _0x3c274a=_0x7a1edc[_0x296d('0x22')]({'plain':!![]});var _0x507e93=_0x296d('0x23');return db['UserProfileResource'][_0x296d('0x21')]({'where':{'type':_0x507e93,'resourceId':_0x3c274a['id']}})[_0x296d('0x20')](function(){return _0x7a1edc;});})[_0x296d('0x20')](function(){_0x2f0748[_0x296d('0x16')](0xcc)[_0x296d('0x17')]();});}};}function handleEntityNotFound(_0x168d84,_0x13a181){return function(_0x5e27bc){if(!_0x5e27bc){_0x168d84['sendStatus'](0x194);}return _0x5e27bc;};}function handleError(_0x485b9a,_0x1bb63c){_0x1bb63c=_0x1bb63c||0x1f4;return function(_0x5cbaa8){logger[_0x296d('0x24')](_0x5cbaa8[_0x296d('0x25')]);if(_0x5cbaa8['name']){delete _0x5cbaa8[_0x296d('0x26')];}_0x485b9a['status'](_0x1bb63c)['send'](_0x5cbaa8);};}exports[_0x296d('0x27')]=function(_0x124b57,_0xad862c){var _0x3cb7a9={},_0x2e7332={},_0x550c25={'count':0x0,'rows':[]};var _0x2bd131=_['map'](db['CmContactHasPhone'][_0x296d('0x28')],function(_0x44f3dc){return{'name':_0x44f3dc[_0x296d('0x29')],'type':_0x44f3dc[_0x296d('0x2a')]['key']};});_0x2e7332[_0x296d('0x2b')]=_['map'](_0x2bd131,_0x296d('0x26'));_0x2e7332[_0x296d('0x2c')]=_[_0x296d('0x2d')](_0x124b57[_0x296d('0x2c')]);_0x2e7332[_0x296d('0x2e')]=_['intersection'](_0x2e7332[_0x296d('0x2b')],_0x2e7332[_0x296d('0x2c')]);_0x3cb7a9[_0x296d('0x2f')]=_['intersection'](_0x2e7332['model'],qs['fields'](_0x124b57['query']['fields']));_0x3cb7a9[_0x296d('0x2f')]=_0x3cb7a9[_0x296d('0x2f')][_0x296d('0x30')]?_0x3cb7a9[_0x296d('0x2f')]:_0x2e7332[_0x296d('0x2b')];if(!_0x124b57[_0x296d('0x2c')]['hasOwnProperty']('nolimit')){_0x3cb7a9[_0x296d('0x1b')]=qs['limit'](_0x124b57[_0x296d('0x2c')]['limit']);_0x3cb7a9[_0x296d('0x1a')]=qs[_0x296d('0x1a')](_0x124b57['query'][_0x296d('0x1a')]);}_0x3cb7a9[_0x296d('0x31')]=qs[_0x296d('0x32')](_0x124b57[_0x296d('0x2c')][_0x296d('0x32')]);_0x3cb7a9[_0x296d('0x33')]=qs['filters'](_[_0x296d('0x34')](_0x124b57[_0x296d('0x2c')],_0x2e7332[_0x296d('0x2e')]),_0x2bd131);if(_0x124b57['query'][_0x296d('0x35')]){_0x3cb7a9[_0x296d('0x33')]=_['merge'](_0x3cb7a9['where'],{'$or':_[_0x296d('0x36')](_0x2bd131,function(_0x2ab79a){if(_0x2ab79a[_0x296d('0x2a')]!==_0x296d('0x37')){var _0x1d4e66={};_0x1d4e66[_0x2ab79a[_0x296d('0x26')]]={'$like':'%'+_0x124b57[_0x296d('0x2c')][_0x296d('0x35')]+'%'};return _0x1d4e66;}})});}_0x3cb7a9=_[_0x296d('0x38')]({},_0x3cb7a9,_0x124b57[_0x296d('0x39')]);var _0x56a802={'where':_0x3cb7a9['where']};return db[_0x296d('0x3a')][_0x296d('0x19')](_0x56a802)[_0x296d('0x20')](function(_0x2b8a1e){_0x550c25[_0x296d('0x19')]=_0x2b8a1e;if(_0x124b57[_0x296d('0x2c')][_0x296d('0x3b')]){_0x3cb7a9[_0x296d('0x3c')]=[{'all':!![]}];}return db['CmContactHasPhone']['findAll'](_0x3cb7a9);})['then'](function(_0x3e31b9){_0x550c25[_0x296d('0x3d')]=_0x3e31b9;return _0x550c25;})[_0x296d('0x20')](respondWithFilteredResult(_0xad862c,_0x3cb7a9))[_0x296d('0x3e')](handleError(_0xad862c,null));};exports[_0x296d('0x3f')]=function(_0x3599d7,_0x2f0618){var _0xda0c78={'raw':!![],'where':{'id':_0x3599d7['params']['id']}},_0x503a95={};_0x503a95[_0x296d('0x2b')]=_[_0x296d('0x2d')](db[_0x296d('0x3a')]['rawAttributes']);_0x503a95[_0x296d('0x2c')]=_[_0x296d('0x2d')](_0x3599d7[_0x296d('0x2c')]);_0x503a95[_0x296d('0x2e')]=_[_0x296d('0x40')](_0x503a95['model'],_0x503a95['query']);_0xda0c78[_0x296d('0x2f')]=_[_0x296d('0x40')](_0x503a95[_0x296d('0x2b')],qs[_0x296d('0x41')](_0x3599d7[_0x296d('0x2c')][_0x296d('0x41')]));_0xda0c78[_0x296d('0x2f')]=_0xda0c78[_0x296d('0x2f')][_0x296d('0x30')]?_0xda0c78[_0x296d('0x2f')]:_0x503a95[_0x296d('0x2b')];if(_0x3599d7[_0x296d('0x2c')][_0x296d('0x3b')]){_0xda0c78['include']=[{'all':!![]}];}_0xda0c78=_['merge']({},_0xda0c78,_0x3599d7[_0x296d('0x39')]);return db[_0x296d('0x3a')][_0x296d('0x42')](_0xda0c78)[_0x296d('0x20')](handleEntityNotFound(_0x2f0618,null))[_0x296d('0x20')](respondWithResult(_0x2f0618,null))[_0x296d('0x3e')](handleError(_0x2f0618,null));};exports[_0x296d('0x43')]=function(_0x39ca98,_0x5ae4c1){return db[_0x296d('0x3a')]['create'](_0x39ca98[_0x296d('0x44')],{})[_0x296d('0x20')](function(_0x1457cf){var _0x58f4ed=_0x39ca98[_0x296d('0x45')]['get']({'plain':!![]});if(!_0x58f4ed)throw new Error(_0x296d('0x46'));if(_0x58f4ed[_0x296d('0x47')]==='user'){var _0x15fbe1=_0x1457cf[_0x296d('0x22')]({'plain':!![]});var _0x42d9ec='CmContactHasPhones';return db['UserProfileSection'][_0x296d('0x42')]({'where':{'name':_0x42d9ec,'userProfileId':_0x58f4ed[_0x296d('0x48')]},'raw':!![]})[_0x296d('0x20')](function(_0x3f9d54){if(_0x3f9d54&&_0x3f9d54[_0x296d('0x49')]===0x0){return db[_0x296d('0x4a')][_0x296d('0x43')]({'name':_0x15fbe1['name'],'resourceId':_0x15fbe1['id'],'type':_0x3f9d54['name'],'sectionId':_0x3f9d54['id']},{})[_0x296d('0x20')](function(){return _0x1457cf;});}else{return _0x1457cf;}})[_0x296d('0x3e')](function(_0x1b581f){logger[_0x296d('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b581f);throw _0x1b581f;});}return _0x1457cf;})['then'](respondWithResult(_0x5ae4c1,0xc9))[_0x296d('0x3e')](handleError(_0x5ae4c1,null));};exports['update']=function(_0x85572b,_0x56a837){if(_0x85572b['body']['id']){delete _0x85572b[_0x296d('0x44')]['id'];}return db[_0x296d('0x3a')][_0x296d('0x42')]({'where':{'id':_0x85572b[_0x296d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x56a837,null))[_0x296d('0x20')](saveUpdates(_0x85572b[_0x296d('0x44')],null))[_0x296d('0x20')](respondWithResult(_0x56a837,null))['catch'](handleError(_0x56a837,null));};exports['destroy']=function(_0xf8cf44,_0xa02b8d){return db[_0x296d('0x3a')][_0x296d('0x42')]({'where':{'id':_0xf8cf44[_0x296d('0x4b')]['id']}})[_0x296d('0x20')](handleEntityNotFound(_0xa02b8d,null))[_0x296d('0x20')](removeEntity(_0xa02b8d,null))[_0x296d('0x3e')](handleError(_0xa02b8d,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 1a00bcf..5309b3f 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 _0x4534=['api','bluebird','request-promise','path','rimraf','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash','util','../../config/logger'];(function(_0x28efc5,_0x14d3e6){var _0x140266=function(_0xb702a7){while(--_0xb702a7){_0x28efc5['push'](_0x28efc5['shift']());}};_0x140266(++_0x14d3e6);}(_0x4534,0x141));var _0x4453=function(_0x40ff15,_0x5cb6b9){_0x40ff15=_0x40ff15-0x0;var _0x4fde1e=_0x4534[_0x40ff15];return _0x4fde1e;};'use strict';var _=require(_0x4453('0x0'));var util=require(_0x4453('0x1'));var logger=require(_0x4453('0x2'))(_0x4453('0x3'));var moment=require('moment');var BPromise=require(_0x4453('0x4'));var rp=require(_0x4453('0x5'));var fs=require('fs');var path=require(_0x4453('0x6'));var rimraf=require(_0x4453('0x7'));var config=require('../../config/environment');var attributes=require('./cmContactHasPhone.attributes');module[_0x4453('0x8')]=function(_0x456815,_0x25bf80){return _0x456815[_0x4453('0x9')](_0x4453('0xa'),attributes,{'tableName':_0x4453('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cf2=['path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x32146e,_0x2be230){var _0x375cc7=function(_0xdf3711){while(--_0xdf3711){_0x32146e['push'](_0x32146e['shift']());}};_0x375cc7(++_0x2be230);}(_0x6cf2,0x7c));var _0x26cf=function(_0x4b485c,_0x5ef24d){_0x4b485c=_0x4b485c-0x0;var _0x42865e=_0x6cf2[_0x4b485c];return _0x42865e;};'use strict';var _=require('lodash');var util=require(_0x26cf('0x0'));var logger=require(_0x26cf('0x1'))(_0x26cf('0x2'));var moment=require(_0x26cf('0x3'));var BPromise=require(_0x26cf('0x4'));var rp=require(_0x26cf('0x5'));var fs=require('fs');var path=require(_0x26cf('0x6'));var rimraf=require(_0x26cf('0x7'));var config=require(_0x26cf('0x8'));var attributes=require(_0x26cf('0x9'));module[_0x26cf('0xa')]=function(_0x3b5c2f,_0x2b519b){return _0x3b5c2f[_0x26cf('0xb')](_0x26cf('0xc'),attributes,{'tableName':'cm_contact_has_phones','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 8c8f78a..b3a8379 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 _0x80fa=['request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','CmContactHasPhone,\x20%s,\x20%s'];(function(_0x2b6665,_0x329301){var _0x2e1757=function(_0x114260){while(--_0x114260){_0x2b6665['push'](_0x2b6665['shift']());}};_0x2e1757(++_0x329301);}(_0x80fa,0xd9));var _0xa80f=function(_0x2b1ff8,_0x3736ac){_0x2b1ff8=_0x2b1ff8-0x0;var _0x10f83a=_0x80fa[_0x2b1ff8];return _0x10f83a;};'use strict';var _=require(_0xa80f('0x0'));var util=require('util');var moment=require(_0xa80f('0x1'));var BPromise=require(_0xa80f('0x2'));var rs=require(_0xa80f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa80f('0x4'))['db'];var utils=require(_0xa80f('0x5'));var logger=require('../../config/logger')(_0xa80f('0x6'));var config=require(_0xa80f('0x7'));var jayson=require(_0xa80f('0x8'));var client=jayson[_0xa80f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4826dc,_0x7a5c59,_0x1eb9ef){return new BPromise(function(_0x10fc96,_0x5b20a7){return client[_0xa80f('0xa')](_0x4826dc,_0x1eb9ef)[_0xa80f('0xb')](function(_0x41d8f7){logger[_0xa80f('0xc')](_0xa80f('0xd'),_0x7a5c59,_0xa80f('0xe'));logger[_0xa80f('0xf')]('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x7a5c59,'request\x20sent',JSON[_0xa80f('0x10')](_0x41d8f7));if(_0x41d8f7[_0xa80f('0x11')]){if(_0x41d8f7[_0xa80f('0x11')][_0xa80f('0x12')]===0x1f4){logger[_0xa80f('0x11')](_0xa80f('0xd'),_0x7a5c59,_0x41d8f7[_0xa80f('0x11')][_0xa80f('0x13')]);return _0x5b20a7(_0x41d8f7[_0xa80f('0x11')]['message']);}logger[_0xa80f('0x11')](_0xa80f('0xd'),_0x7a5c59,_0x41d8f7[_0xa80f('0x11')][_0xa80f('0x13')]);return _0x10fc96(_0x41d8f7[_0xa80f('0x11')]['message']);}else{logger[_0xa80f('0xc')](_0xa80f('0xd'),_0x7a5c59,_0xa80f('0xe'));_0x10fc96(_0x41d8f7['result'][_0xa80f('0x13')]);}})[_0xa80f('0x14')](function(_0x130ab7){logger['error'](_0xa80f('0xd'),_0x7a5c59,_0x130ab7);_0x5b20a7(_0x130ab7);});});} \ No newline at end of file +var _0xa997=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','CmContactHasPhone,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x305ce9,_0x1283a3){var _0x595054=function(_0x3a0335){while(--_0x3a0335){_0x305ce9['push'](_0x305ce9['shift']());}};_0x595054(++_0x1283a3);}(_0xa997,0x15e));var _0x7a99=function(_0x5e32f3,_0x3386c1){_0x5e32f3=_0x5e32f3-0x0;var _0x4d4e03=_0xa997[_0x5e32f3];return _0x4d4e03;};'use strict';var _=require(_0x7a99('0x0'));var util=require(_0x7a99('0x1'));var moment=require(_0x7a99('0x2'));var BPromise=require(_0x7a99('0x3'));var rs=require(_0x7a99('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7a99('0x5'));var logger=require('../../config/logger')(_0x7a99('0x6'));var config=require(_0x7a99('0x7'));var jayson=require(_0x7a99('0x8'));var client=jayson[_0x7a99('0x9')][_0x7a99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x139f5c,_0x346789,_0x5188ca){return new BPromise(function(_0x26cbd8,_0x39f4a5){return client[_0x7a99('0xb')](_0x139f5c,_0x5188ca)['then'](function(_0x5efc12){logger[_0x7a99('0xc')]('CmContactHasPhone,\x20%s,\x20%s',_0x346789,_0x7a99('0xd'));logger[_0x7a99('0xe')](_0x7a99('0xf'),_0x346789,_0x7a99('0xd'),JSON[_0x7a99('0x10')](_0x5efc12));if(_0x5efc12[_0x7a99('0x11')]){if(_0x5efc12[_0x7a99('0x11')]['code']===0x1f4){logger['error'](_0x7a99('0x12'),_0x346789,_0x5efc12['error']['message']);return _0x39f4a5(_0x5efc12[_0x7a99('0x11')][_0x7a99('0x13')]);}logger[_0x7a99('0x11')](_0x7a99('0x12'),_0x346789,_0x5efc12[_0x7a99('0x11')]['message']);return _0x26cbd8(_0x5efc12[_0x7a99('0x11')][_0x7a99('0x13')]);}else{logger[_0x7a99('0xc')](_0x7a99('0x12'),_0x346789,_0x7a99('0xd'));_0x26cbd8(_0x5efc12[_0x7a99('0x14')][_0x7a99('0x13')]);}})[_0x7a99('0x15')](function(_0x424b2b){logger[_0x7a99('0x11')]('CmContactHasPhone,\x20%s,\x20%s',_0x346789,_0x424b2b);_0x39f4a5(_0x424b2b);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 33d9cf3..4009ecb 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 _0x19de=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports'];(function(_0x39a26a,_0x5bf466){var _0x338c39=function(_0x4fcf66){while(--_0x4fcf66){_0x39a26a['push'](_0x39a26a['shift']());}};_0x338c39(++_0x5bf466);}(_0x19de,0x18f));var _0xe19d=function(_0x3c6723,_0x533039){_0x3c6723=_0x3c6723-0x0;var _0x4002fe=_0x19de[_0x3c6723];return _0x4002fe;};'use strict';var multer=require(_0xe19d('0x0'));var util=require(_0xe19d('0x1'));var path=require(_0xe19d('0x2'));var timeout=require('connect-timeout');var express=require(_0xe19d('0x3'));var router=express[_0xe19d('0x4')]();var auth=require(_0xe19d('0x5'));var interaction=require(_0xe19d('0x6'));var config=require(_0xe19d('0x7'));var controller=require('./cmContactHasPhone.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe19d('0x8')]);router[_0xe19d('0x9')](_0xe19d('0xa'),auth['isAuthenticated'](),controller[_0xe19d('0xb')]);router['post']('/',auth[_0xe19d('0xc')](),controller[_0xe19d('0xd')]);router[_0xe19d('0xe')]('/:id',auth[_0xe19d('0xc')](),controller[_0xe19d('0xf')]);router[_0xe19d('0x10')](_0xe19d('0xa'),auth[_0xe19d('0xc')](),controller[_0xe19d('0x11')]);module[_0xe19d('0x12')]=router; \ No newline at end of file +var _0x8992=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','../../components/interaction/service','./cmContactHasPhone.controller','get'];(function(_0x49d21f,_0x6e7f5){var _0x1b93f2=function(_0x1cd8e7){while(--_0x1cd8e7){_0x49d21f['push'](_0x49d21f['shift']());}};_0x1b93f2(++_0x6e7f5);}(_0x8992,0x16a));var _0x2899=function(_0xf2efae,_0x307737){_0xf2efae=_0xf2efae-0x0;var _0x241311=_0x8992[_0xf2efae];return _0x241311;};'use strict';var multer=require(_0x2899('0x0'));var util=require(_0x2899('0x1'));var path=require('path');var timeout=require(_0x2899('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2899('0x3'));var config=require('../../config/environment');var controller=require(_0x2899('0x4'));router[_0x2899('0x5')]('/',auth[_0x2899('0x6')](),controller[_0x2899('0x7')]);router['get'](_0x2899('0x8'),auth[_0x2899('0x6')](),controller[_0x2899('0x9')]);router[_0x2899('0xa')]('/',auth[_0x2899('0x6')](),controller['create']);router[_0x2899('0xb')](_0x2899('0x8'),auth[_0x2899('0x6')](),controller[_0x2899('0xc')]);router[_0x2899('0xd')](_0x2899('0x8'),auth[_0x2899('0x6')](),controller[_0x2899('0xe')]);module[_0x2899('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 0eae279..17bd754 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 _0xd8b1=['type','select','values','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','alias','STRING','setDataValue','long','getDataValue'];(function(_0x546039,_0xf8d1b6){var _0x3f82db=function(_0x137a68){while(--_0x137a68){_0x546039['push'](_0x546039['shift']());}};_0x3f82db(++_0xf8d1b6);}(_0xd8b1,0x105));var _0x1d8b=function(_0x5bca84,_0x109d41){_0x5bca84=_0x5bca84-0x0;var _0x45bc04=_0xd8b1[_0x5bca84];return _0x45bc04;};'use strict';var Sequelize=require(_0x1d8b('0x0'));var _=require(_0x1d8b('0x1'));module[_0x1d8b('0x2')]={'name':{'type':Sequelize[_0x1d8b('0x3')],'get':function(_0x20c6dd){return this['getDataValue'](_0x1d8b('0x4'));}},'alias':{'type':Sequelize[_0x1d8b('0x5')],'allowNull':![],'set':function(_0x531170){this[_0x1d8b('0x6')]('alias',_0x531170?_0x531170:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x1d8b('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x1d8b('0x7')),'get':function(){if(this[_0x1d8b('0x8')](_0x1d8b('0x9'))===_0x1d8b('0xa')){return JSON['parse'](this['getDataValue'](_0x1d8b('0xb')));}else{return this['getDataValue']('values');}},'set':function(_0x321de3){if(Array['isArray'](_0x321de3)){this[_0x1d8b('0x6')]('values',JSON[_0x1d8b('0xc')](_0x321de3));}else{this[_0x1d8b('0x6')](_0x1d8b('0xb'),_0x321de3);}}},'required':{'type':Sequelize[_0x1d8b('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1d8b('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1d8b('0xe')]('voice')}}; \ No newline at end of file +var _0xbcba=['getDataValue','alias','STRING','name','long','parse','values','setDataValue','stringify','BOOLEAN','ENUM','sequelize','lodash','VIRTUAL'];(function(_0x8ec1ab,_0x5cfd6e){var _0x14f15a=function(_0x3cbc57){while(--_0x3cbc57){_0x8ec1ab['push'](_0x8ec1ab['shift']());}};_0x14f15a(++_0x5cfd6e);}(_0xbcba,0x6d));var _0xabcb=function(_0x1a88b2,_0x5d7d43){_0x1a88b2=_0x1a88b2-0x0;var _0x23a2b6=_0xbcba[_0x1a88b2];return _0x23a2b6;};'use strict';var Sequelize=require(_0xabcb('0x0'));var _=require(_0xabcb('0x1'));module['exports']={'name':{'type':Sequelize[_0xabcb('0x2')],'get':function(_0x2c9ee7){return this[_0xabcb('0x3')](_0xabcb('0x4'));}},'alias':{'type':Sequelize[_0xabcb('0x5')],'allowNull':![],'set':function(_0x3e3b9b){this['setDataValue']('alias',_0x3e3b9b?_0x3e3b9b:this[_0xabcb('0x3')](_0xabcb('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xabcb('0x7')),'get':function(){if(this[_0xabcb('0x3')]('type')==='select'){return JSON[_0xabcb('0x8')](this['getDataValue'](_0xabcb('0x9')));}else{return this[_0xabcb('0x3')](_0xabcb('0x9'));}},'set':function(_0x2c16c3){if(Array['isArray'](_0x2c16c3)){this[_0xabcb('0xa')](_0xabcb('0x9'),JSON[_0xabcb('0xb')](_0x2c16c3));}else{this[_0xabcb('0xa')](_0xabcb('0x9'),_0x2c16c3);}}},'required':{'type':Sequelize[_0xabcb('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xabcb('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xabcb('0xd')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 21e7ab8..9347de8 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 _0x8f2d=['rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','cm_contacts','format','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../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','json','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8f2d,0xd5));var _0xd8f2=function(_0x19ba07,_0x4610e5){_0x19ba07=_0x19ba07-0x0;var _0x20504e=_0x8f2d[_0x19ba07];return _0x20504e;};'use strict';var pdf=require(_0xd8f2('0x0'));var emlformat=require(_0xd8f2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd8f2('0x2'));var jsonpatch=require(_0xd8f2('0x3'));var rp=require(_0xd8f2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd8f2('0x5'));var util=require(_0xd8f2('0x6'));var path=require(_0xd8f2('0x7'));var sox=require(_0xd8f2('0x8'));var csv=require(_0xd8f2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd8f2('0xa'));var squel=require(_0xd8f2('0xb'));var crypto=require(_0xd8f2('0xc'));var jsforce=require(_0xd8f2('0xd'));var deskjs=require(_0xd8f2('0xe'));var toCsv=require(_0xd8f2('0x9'));var querystring=require('querystring');var Papa=require(_0xd8f2('0xf'));var Redis=require(_0xd8f2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd8f2('0x11'));var as=require(_0xd8f2('0x12'));var hardwareService=require(_0xd8f2('0x13'));var logger=require(_0xd8f2('0x14'))(_0xd8f2('0x15'));var utils=require(_0xd8f2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd8f2('0x17'));var db=require(_0xd8f2('0x18'))['db'];function respondWithStatusCode(_0x4092b7,_0xf6fa79){_0xf6fa79=_0xf6fa79||0xcc;return function(_0x44a4b2){if(_0x44a4b2){return _0x4092b7[_0xd8f2('0x19')](_0xf6fa79);}return _0x4092b7['status'](_0xf6fa79)[_0xd8f2('0x1a')]();};}function respondWithResult(_0x30d8fd,_0x161e5f){_0x161e5f=_0x161e5f||0xc8;return function(_0x19257f){if(_0x19257f){return _0x30d8fd[_0xd8f2('0x1b')](_0x161e5f)['json'](_0x19257f);}};}function respondWithFilteredResult(_0x15525d,_0x37e347){return function(_0x495feb){if(_0x495feb){var _0x18847c=_0x495feb[_0xd8f2('0x1c')],_0x44f566=_0x37e347[_0xd8f2('0x1d')],_0x1dd9a0=_0x37e347[_0xd8f2('0x1d')]+_0x37e347['limit'],_0x25b4e2;if(_0x1dd9a0>=_0x18847c){_0x1dd9a0=_0x18847c;_0x25b4e2=0xc8;}else{_0x25b4e2=0xce;}_0x15525d[_0xd8f2('0x1b')](_0x25b4e2);return _0x15525d[_0xd8f2('0x1e')](_0xd8f2('0x1f'),_0x44f566+'-'+_0x1dd9a0+'/'+_0x18847c)[_0xd8f2('0x20')](_0x495feb);}return null;};}function patchUpdates(_0x105cc9){return function(_0x5686b0){try{jsonpatch['apply'](_0x5686b0,_0x105cc9,!![]);}catch(_0x4c28ae){return BPromise[_0xd8f2('0x21')](_0x4c28ae);}return _0x5686b0[_0xd8f2('0x22')]();};}function saveUpdates(_0x584852,_0x49ba82){return function(_0x36ce0a){if(_0x36ce0a){return _0x36ce0a[_0xd8f2('0x23')](_0x584852)[_0xd8f2('0x24')](function(_0x556890){return _0x556890;});}return null;};}function removeEntity(_0x56bef4,_0x366a9c){return function(_0xc8dc4f){if(_0xc8dc4f){return _0xc8dc4f[_0xd8f2('0x25')]()[_0xd8f2('0x24')](function(){_0x56bef4['status'](0xcc)[_0xd8f2('0x1a')]();});}};}function handleEntityNotFound(_0x5f5211,_0x3eeb92){return function(_0x1728d9){if(!_0x1728d9){_0x5f5211['sendStatus'](0x194);}return _0x1728d9;};}function handleError(_0x4104cd,_0xb76272){_0xb76272=_0xb76272||0x1f4;return function(_0x216cf2){logger[_0xd8f2('0x26')](_0x216cf2[_0xd8f2('0x27')]);if(_0x216cf2[_0xd8f2('0x28')]){delete _0x216cf2[_0xd8f2('0x28')];}_0x4104cd[_0xd8f2('0x1b')](_0xb76272)[_0xd8f2('0x29')](_0x216cf2);};}exports[_0xd8f2('0x2a')]=function(_0x517f7d,_0xbb33c6){var _0x346acc={},_0x1fb618={},_0x42eeac={'count':0x0,'rows':[]};var _0x3410ae=_[_0xd8f2('0x2b')](db[_0xd8f2('0x2c')][_0xd8f2('0x2d')],function(_0xf5ac2b){return{'name':_0xf5ac2b['fieldName'],'type':_0xf5ac2b[_0xd8f2('0x2e')][_0xd8f2('0x2f')]};});_0x1fb618['model']=_['differenceBy'](_[_0xd8f2('0x2b')](_0x3410ae,_0xd8f2('0x28')),[_0xd8f2('0x28')]);_0x1fb618[_0xd8f2('0x30')]=_[_0xd8f2('0x31')](_0x517f7d['query']);_0x1fb618[_0xd8f2('0x32')]=_[_0xd8f2('0x33')](_0x1fb618[_0xd8f2('0x34')],_0x1fb618[_0xd8f2('0x30')]);_0x346acc[_0xd8f2('0x35')]=_[_0xd8f2('0x33')](_0x1fb618[_0xd8f2('0x34')],qs[_0xd8f2('0x36')](_0x517f7d[_0xd8f2('0x30')][_0xd8f2('0x36')]));_0x346acc['attributes']=_0x346acc[_0xd8f2('0x35')][_0xd8f2('0x37')]?_0x346acc['attributes']:_0x1fb618[_0xd8f2('0x34')];if(!_0x517f7d[_0xd8f2('0x30')][_0xd8f2('0x38')](_0xd8f2('0x39'))){_0x346acc['limit']=qs['limit'](_0x517f7d[_0xd8f2('0x30')]['limit']);_0x346acc['offset']=qs[_0xd8f2('0x1d')](_0x517f7d['query'][_0xd8f2('0x1d')]);}_0x346acc['order']=qs[_0xd8f2('0x3a')](_0x517f7d[_0xd8f2('0x30')][_0xd8f2('0x3a')]);_0x346acc[_0xd8f2('0x3b')]=qs[_0xd8f2('0x32')](_[_0xd8f2('0x3c')](_0x517f7d['query'],_0x1fb618[_0xd8f2('0x32')]),_0x3410ae);if(_0x517f7d[_0xd8f2('0x30')][_0xd8f2('0x3d')]){_0x346acc[_0xd8f2('0x3b')]=_[_0xd8f2('0x3e')](_0x346acc[_0xd8f2('0x3b')],{'$or':_[_0xd8f2('0x2b')](_0x3410ae,function(_0x343637){if(_0x343637['type']!==_0xd8f2('0x3f')){var _0x57d462={};_0x57d462[_0x343637['name']]={'$like':'%'+_0x517f7d[_0xd8f2('0x30')][_0xd8f2('0x3d')]+'%'};return _0x57d462;}})});}_0x346acc=_[_0xd8f2('0x3e')]({},_0x346acc,_0x517f7d[_0xd8f2('0x40')]);var _0x2ec57c={'where':_0x346acc[_0xd8f2('0x3b')]};return db[_0xd8f2('0x2c')][_0xd8f2('0x1c')](_0x2ec57c)[_0xd8f2('0x24')](function(_0x2fd147){_0x42eeac[_0xd8f2('0x1c')]=_0x2fd147;if(_0x517f7d[_0xd8f2('0x30')][_0xd8f2('0x41')]){_0x346acc[_0xd8f2('0x42')]=[{'all':!![]}];}return db[_0xd8f2('0x2c')]['findAll'](_0x346acc);})[_0xd8f2('0x24')](function(_0x6482bf){_0x42eeac[_0xd8f2('0x43')]=_0x6482bf;return _0x42eeac;})[_0xd8f2('0x24')](respondWithFilteredResult(_0xbb33c6,_0x346acc))[_0xd8f2('0x44')](handleError(_0xbb33c6,null));};exports[_0xd8f2('0x45')]=function(_0x395cd7,_0x229517){var _0xeab58={'raw':!![],'where':{'id':_0x395cd7[_0xd8f2('0x46')]['id']}},_0x39a48c={};_0x39a48c[_0xd8f2('0x34')]=_['keys'](db[_0xd8f2('0x2c')][_0xd8f2('0x2d')]);_0x39a48c[_0xd8f2('0x30')]=_['keys'](_0x395cd7[_0xd8f2('0x30')]);_0x39a48c['filters']=_[_0xd8f2('0x33')](_0x39a48c[_0xd8f2('0x34')],_0x39a48c[_0xd8f2('0x30')]);_0xeab58[_0xd8f2('0x35')]=_[_0xd8f2('0x33')](_0x39a48c[_0xd8f2('0x34')],qs[_0xd8f2('0x36')](_0x395cd7['query'][_0xd8f2('0x36')]));_0xeab58['attributes']=_0xeab58[_0xd8f2('0x35')][_0xd8f2('0x37')]?_0xeab58[_0xd8f2('0x35')]:_0x39a48c[_0xd8f2('0x34')];if(_0x395cd7[_0xd8f2('0x30')][_0xd8f2('0x41')]){_0xeab58[_0xd8f2('0x42')]=[{'all':!![]}];}_0xeab58=_[_0xd8f2('0x3e')]({},_0xeab58,_0x395cd7['options']);return db[_0xd8f2('0x2c')][_0xd8f2('0x47')](_0xeab58)[_0xd8f2('0x24')](handleEntityNotFound(_0x229517,null))[_0xd8f2('0x24')](respondWithResult(_0x229517,null))[_0xd8f2('0x44')](handleError(_0x229517,null));};exports[_0xd8f2('0x23')]=function(_0x402070,_0x37f470){if(_0x402070[_0xd8f2('0x48')]['id']){delete _0x402070[_0xd8f2('0x48')]['id'];}return db['CmCustomField'][_0xd8f2('0x47')]({'where':{'id':_0x402070[_0xd8f2('0x46')]['id']}})[_0xd8f2('0x24')](handleEntityNotFound(_0x37f470,null))[_0xd8f2('0x24')](saveUpdates(_0x402070[_0xd8f2('0x48')],null))['then'](respondWithResult(_0x37f470,null))[_0xd8f2('0x44')](handleError(_0x37f470,null));};exports[_0xd8f2('0x25')]=function(_0x146111,_0x28bc2c){return db[_0xd8f2('0x2c')]['find']({'where':{'id':_0x146111[_0xd8f2('0x46')]['id']}})[_0xd8f2('0x24')](handleEntityNotFound(_0x28bc2c,null))[_0xd8f2('0x24')](removeEntity(_0x28bc2c,null))[_0xd8f2('0x44')](handleError(_0x28bc2c,null));};exports[_0xd8f2('0x49')]=function(_0xae3b0b,_0x1ef256){var _0x264cf7;return db[_0xd8f2('0x4a')][_0xd8f2('0x4b')](function(_0x4d7a77){return db[_0xd8f2('0x2c')]['create'](_0xae3b0b['body'],{'transaction':_0x4d7a77})['then'](function(_0xa44c09){_0x264cf7=_0xa44c09;var _0x10ec76={'type':db[_0xd8f2('0x4c')][_0xd8f2('0x4d')],'transaction':_0x4d7a77};switch(_0xae3b0b[_0xd8f2('0x48')][_0xd8f2('0x2e')]){case _0xd8f2('0x4e'):_0x10ec76[_0xd8f2('0x2e')]=db[_0xd8f2('0x4c')][_0xd8f2('0x4d')];break;case _0xd8f2('0x4f'):_0x10ec76[_0xd8f2('0x2e')]=db['Sequelize'][_0xd8f2('0x50')];break;case _0xd8f2('0x51'):_0x10ec76[_0xd8f2('0x2e')]=db[_0xd8f2('0x4c')]['BOOLEAN'];_0x10ec76[_0xd8f2('0x52')]=![];break;default:}return db['sequelize'][_0xd8f2('0x53')]['addColumn'](_0xd8f2('0x54'),util[_0xd8f2('0x55')]('cf_%d',_0x264cf7['id']),_0x10ec76);})[_0xd8f2('0x24')](function(){return _0x264cf7;});})[_0xd8f2('0x24')](respondWithResult(_0x1ef256,0xc9))['catch'](handleError(_0x1ef256,null));}; \ No newline at end of file +var _0xdb1b=['index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','body','transaction','create','Sequelize','TEXT','text','switch','BOOLEAN','defaultValue','sequelize','queryInterface','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','zip-dir','request-promise','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','name','send'];(function(_0x25022b,_0x4e3d2a){var _0x9dc9b1=function(_0x3aaff2){while(--_0x3aaff2){_0x25022b['push'](_0x25022b['shift']());}};_0x9dc9b1(++_0x4e3d2a);}(_0xdb1b,0x139));var _0xbdb1=function(_0x4a76da,_0x172f87){_0x4a76da=_0x4a76da-0x0;var _0x44f771=_0xdb1b[_0x4a76da];return _0x44f771;};'use strict';var pdf=require(_0xbdb1('0x0'));var emlformat=require(_0xbdb1('0x1'));var rimraf=require(_0xbdb1('0x2'));var zipdir=require(_0xbdb1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbdb1('0x4'));var moment=require(_0xbdb1('0x5'));var BPromise=require(_0xbdb1('0x6'));var Mustache=require(_0xbdb1('0x7'));var util=require(_0xbdb1('0x8'));var path=require(_0xbdb1('0x9'));var sox=require(_0xbdb1('0xa'));var csv=require(_0xbdb1('0xb'));var ejs=require(_0xbdb1('0xc'));var fs=require('fs');var _=require(_0xbdb1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbdb1('0xe'));var deskjs=require(_0xbdb1('0xf'));var toCsv=require(_0xbdb1('0xb'));var querystring=require(_0xbdb1('0x10'));var Papa=require(_0xbdb1('0x11'));var Redis=require(_0xbdb1('0x12'));var authService=require(_0xbdb1('0x13'));var qs=require(_0xbdb1('0x14'));var as=require(_0xbdb1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbdb1('0x16'))(_0xbdb1('0x17'));var utils=require(_0xbdb1('0x18'));var config=require(_0xbdb1('0x19'));var licenseUtil=require(_0xbdb1('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x480e85,_0x3f527d){_0x3f527d=_0x3f527d||0xcc;return function(_0x59a001){if(_0x59a001){return _0x480e85['sendStatus'](_0x3f527d);}return _0x480e85[_0xbdb1('0x1b')](_0x3f527d)[_0xbdb1('0x1c')]();};}function respondWithResult(_0x3bebeb,_0x5e1d35){_0x5e1d35=_0x5e1d35||0xc8;return function(_0x318827){if(_0x318827){return _0x3bebeb[_0xbdb1('0x1b')](_0x5e1d35)[_0xbdb1('0x1d')](_0x318827);}};}function respondWithFilteredResult(_0x355283,_0x58d8c5){return function(_0x569722){if(_0x569722){var _0x2bf5c7=_0x569722[_0xbdb1('0x1e')],_0x3d678e=_0x58d8c5[_0xbdb1('0x1f')],_0x224e8e=_0x58d8c5[_0xbdb1('0x1f')]+_0x58d8c5[_0xbdb1('0x20')],_0x316e71;if(_0x224e8e>=_0x2bf5c7){_0x224e8e=_0x2bf5c7;_0x316e71=0xc8;}else{_0x316e71=0xce;}_0x355283[_0xbdb1('0x1b')](_0x316e71);return _0x355283[_0xbdb1('0x21')]('Content-Range',_0x3d678e+'-'+_0x224e8e+'/'+_0x2bf5c7)['json'](_0x569722);}return null;};}function patchUpdates(_0x265996){return function(_0x2f8ae3){try{jsonpatch[_0xbdb1('0x22')](_0x2f8ae3,_0x265996,!![]);}catch(_0x36d8e8){return BPromise[_0xbdb1('0x23')](_0x36d8e8);}return _0x2f8ae3[_0xbdb1('0x24')]();};}function saveUpdates(_0x3df443,_0x18fbad){return function(_0x55a484){if(_0x55a484){return _0x55a484[_0xbdb1('0x25')](_0x3df443)[_0xbdb1('0x26')](function(_0x28976b){return _0x28976b;});}return null;};}function removeEntity(_0x4aa6d5,_0x257b35){return function(_0x6e9db6){if(_0x6e9db6){return _0x6e9db6[_0xbdb1('0x27')]()[_0xbdb1('0x26')](function(){_0x4aa6d5[_0xbdb1('0x1b')](0xcc)[_0xbdb1('0x1c')]();});}};}function handleEntityNotFound(_0x43b5ae,_0x49ee7e){return function(_0x15a10f){if(!_0x15a10f){_0x43b5ae[_0xbdb1('0x28')](0x194);}return _0x15a10f;};}function handleError(_0x35d083,_0x2a7e49){_0x2a7e49=_0x2a7e49||0x1f4;return function(_0x14e0b8){logger['error'](_0x14e0b8['stack']);if(_0x14e0b8['name']){delete _0x14e0b8[_0xbdb1('0x29')];}_0x35d083[_0xbdb1('0x1b')](_0x2a7e49)[_0xbdb1('0x2a')](_0x14e0b8);};}exports[_0xbdb1('0x2b')]=function(_0x41465c,_0x282384){var _0x14e3be={},_0x5cf2fb={},_0x5e88a6={'count':0x0,'rows':[]};var _0x4d4941=_[_0xbdb1('0x2c')](db[_0xbdb1('0x2d')][_0xbdb1('0x2e')],function(_0x3e4980){return{'name':_0x3e4980[_0xbdb1('0x2f')],'type':_0x3e4980[_0xbdb1('0x30')][_0xbdb1('0x31')]};});_0x5cf2fb[_0xbdb1('0x32')]=_[_0xbdb1('0x33')](_[_0xbdb1('0x2c')](_0x4d4941,'name'),[_0xbdb1('0x29')]);_0x5cf2fb[_0xbdb1('0x34')]=_[_0xbdb1('0x35')](_0x41465c[_0xbdb1('0x34')]);_0x5cf2fb[_0xbdb1('0x36')]=_[_0xbdb1('0x37')](_0x5cf2fb['model'],_0x5cf2fb[_0xbdb1('0x34')]);_0x14e3be[_0xbdb1('0x38')]=_[_0xbdb1('0x37')](_0x5cf2fb[_0xbdb1('0x32')],qs[_0xbdb1('0x39')](_0x41465c[_0xbdb1('0x34')][_0xbdb1('0x39')]));_0x14e3be[_0xbdb1('0x38')]=_0x14e3be['attributes'][_0xbdb1('0x3a')]?_0x14e3be[_0xbdb1('0x38')]:_0x5cf2fb['model'];if(!_0x41465c[_0xbdb1('0x34')][_0xbdb1('0x3b')](_0xbdb1('0x3c'))){_0x14e3be[_0xbdb1('0x20')]=qs[_0xbdb1('0x20')](_0x41465c[_0xbdb1('0x34')][_0xbdb1('0x20')]);_0x14e3be[_0xbdb1('0x1f')]=qs[_0xbdb1('0x1f')](_0x41465c[_0xbdb1('0x34')][_0xbdb1('0x1f')]);}_0x14e3be[_0xbdb1('0x3d')]=qs[_0xbdb1('0x3e')](_0x41465c[_0xbdb1('0x34')]['sort']);_0x14e3be[_0xbdb1('0x3f')]=qs[_0xbdb1('0x36')](_['pick'](_0x41465c[_0xbdb1('0x34')],_0x5cf2fb[_0xbdb1('0x36')]),_0x4d4941);if(_0x41465c[_0xbdb1('0x34')]['filter']){_0x14e3be[_0xbdb1('0x3f')]=_['merge'](_0x14e3be[_0xbdb1('0x3f')],{'$or':_[_0xbdb1('0x2c')](_0x4d4941,function(_0x933426){if(_0x933426[_0xbdb1('0x30')]!==_0xbdb1('0x40')){var _0x344a7a={};_0x344a7a[_0x933426[_0xbdb1('0x29')]]={'$like':'%'+_0x41465c[_0xbdb1('0x34')][_0xbdb1('0x41')]+'%'};return _0x344a7a;}})});}_0x14e3be=_[_0xbdb1('0x42')]({},_0x14e3be,_0x41465c[_0xbdb1('0x43')]);var _0x33a19c={'where':_0x14e3be['where']};return db['CmCustomField'][_0xbdb1('0x1e')](_0x33a19c)[_0xbdb1('0x26')](function(_0x9a5708){_0x5e88a6['count']=_0x9a5708;if(_0x41465c[_0xbdb1('0x34')][_0xbdb1('0x44')]){_0x14e3be[_0xbdb1('0x45')]=[{'all':!![]}];}return db[_0xbdb1('0x2d')][_0xbdb1('0x46')](_0x14e3be);})[_0xbdb1('0x26')](function(_0x253e43){_0x5e88a6[_0xbdb1('0x47')]=_0x253e43;return _0x5e88a6;})[_0xbdb1('0x26')](respondWithFilteredResult(_0x282384,_0x14e3be))[_0xbdb1('0x48')](handleError(_0x282384,null));};exports['show']=function(_0x40780c,_0x134237){var _0x19ab96={'raw':!![],'where':{'id':_0x40780c[_0xbdb1('0x49')]['id']}},_0x2e47f6={};_0x2e47f6[_0xbdb1('0x32')]=_[_0xbdb1('0x35')](db['CmCustomField'][_0xbdb1('0x2e')]);_0x2e47f6[_0xbdb1('0x34')]=_[_0xbdb1('0x35')](_0x40780c[_0xbdb1('0x34')]);_0x2e47f6[_0xbdb1('0x36')]=_[_0xbdb1('0x37')](_0x2e47f6[_0xbdb1('0x32')],_0x2e47f6[_0xbdb1('0x34')]);_0x19ab96[_0xbdb1('0x38')]=_[_0xbdb1('0x37')](_0x2e47f6[_0xbdb1('0x32')],qs[_0xbdb1('0x39')](_0x40780c[_0xbdb1('0x34')][_0xbdb1('0x39')]));_0x19ab96[_0xbdb1('0x38')]=_0x19ab96[_0xbdb1('0x38')][_0xbdb1('0x3a')]?_0x19ab96[_0xbdb1('0x38')]:_0x2e47f6[_0xbdb1('0x32')];if(_0x40780c[_0xbdb1('0x34')]['includeAll']){_0x19ab96[_0xbdb1('0x45')]=[{'all':!![]}];}_0x19ab96=_[_0xbdb1('0x42')]({},_0x19ab96,_0x40780c[_0xbdb1('0x43')]);return db[_0xbdb1('0x2d')][_0xbdb1('0x4a')](_0x19ab96)[_0xbdb1('0x26')](handleEntityNotFound(_0x134237,null))[_0xbdb1('0x26')](respondWithResult(_0x134237,null))['catch'](handleError(_0x134237,null));};exports[_0xbdb1('0x25')]=function(_0x462569,_0x26aeb8){if(_0x462569[_0xbdb1('0x4b')]['id']){delete _0x462569[_0xbdb1('0x4b')]['id'];}return db['CmCustomField'][_0xbdb1('0x4a')]({'where':{'id':_0x462569['params']['id']}})[_0xbdb1('0x26')](handleEntityNotFound(_0x26aeb8,null))[_0xbdb1('0x26')](saveUpdates(_0x462569[_0xbdb1('0x4b')],null))[_0xbdb1('0x26')](respondWithResult(_0x26aeb8,null))['catch'](handleError(_0x26aeb8,null));};exports[_0xbdb1('0x27')]=function(_0x2935e5,_0xf4914a){return db[_0xbdb1('0x2d')]['find']({'where':{'id':_0x2935e5[_0xbdb1('0x49')]['id']}})[_0xbdb1('0x26')](handleEntityNotFound(_0xf4914a,null))['then'](removeEntity(_0xf4914a,null))[_0xbdb1('0x48')](handleError(_0xf4914a,null));};exports['create']=function(_0x3db6d6,_0x269aad){var _0x161be4;return db['sequelize'][_0xbdb1('0x4c')](function(_0x50dbde){return db[_0xbdb1('0x2d')][_0xbdb1('0x4d')](_0x3db6d6['body'],{'transaction':_0x50dbde})[_0xbdb1('0x26')](function(_0x5c2576){_0x161be4=_0x5c2576;var _0xe397b5={'type':db[_0xbdb1('0x4e')][_0xbdb1('0x4f')],'transaction':_0x50dbde};switch(_0x3db6d6[_0xbdb1('0x4b')][_0xbdb1('0x30')]){case _0xbdb1('0x50'):_0xe397b5[_0xbdb1('0x30')]=db[_0xbdb1('0x4e')][_0xbdb1('0x4f')];break;case'number':_0xe397b5[_0xbdb1('0x30')]=db[_0xbdb1('0x4e')]['INTEGER'];break;case _0xbdb1('0x51'):_0xe397b5[_0xbdb1('0x30')]=db['Sequelize'][_0xbdb1('0x52')];_0xe397b5[_0xbdb1('0x53')]=![];break;default:}return db[_0xbdb1('0x54')][_0xbdb1('0x55')]['addColumn'](_0xbdb1('0x56'),util[_0xbdb1('0x57')](_0xbdb1('0x58'),_0x161be4['id']),_0xe397b5);})[_0xbdb1('0x26')](function(){return _0x161be4;});})[_0xbdb1('0x26')](respondWithResult(_0x269aad,0xc9))[_0xbdb1('0x48')](handleError(_0x269aad,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 79c2e8b..dfa3bcc 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 _0xf0b0=['lodash','util','api','moment','bluebird','path','rimraf','exports','define','CmCustomField','cm_custom_fields'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0xf0b0,0xd1));var _0x0f0b=function(_0x564e08,_0x401fb5){_0x564e08=_0x564e08-0x0;var _0x38ffcc=_0xf0b0[_0x564e08];return _0x38ffcc;};'use strict';var _=require(_0x0f0b('0x0'));var util=require(_0x0f0b('0x1'));var logger=require('../../config/logger')(_0x0f0b('0x2'));var moment=require(_0x0f0b('0x3'));var BPromise=require(_0x0f0b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f0b('0x5'));var rimraf=require(_0x0f0b('0x6'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0x0f0b('0x7')]=function(_0x20b774,_0x4f2a16){return _0x20b774[_0x0f0b('0x8')](_0x0f0b('0x9'),attributes,{'tableName':_0x0f0b('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24cd=['util','api','moment','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash'];(function(_0x5ed55e,_0x332aac){var _0x8cb4ef=function(_0x3919ab){while(--_0x3919ab){_0x5ed55e['push'](_0x5ed55e['shift']());}};_0x8cb4ef(++_0x332aac);}(_0x24cd,0x8f));var _0xd24c=function(_0x223d47,_0x19690c){_0x223d47=_0x223d47-0x0;var _0x2ffb74=_0x24cd[_0x223d47];return _0x2ffb74;};'use strict';var _=require(_0xd24c('0x0'));var util=require(_0xd24c('0x1'));var logger=require('../../config/logger')(_0xd24c('0x2'));var moment=require(_0xd24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xd24c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd24c('0x5'));var config=require(_0xd24c('0x6'));var attributes=require(_0xd24c('0x7'));module[_0xd24c('0x8')]=function(_0x49146b,_0xa83efc){return _0x49146b[_0xd24c('0x9')](_0xd24c('0xa'),attributes,{'tableName':_0xd24c('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 d7dabe9..2c2ab45 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 _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x44b5d9,_0xe28bb1){var _0x25d599=function(_0x33d5ed){while(--_0x33d5ed){_0x44b5d9['push'](_0x44b5d9['shift']());}};_0x25d599(++_0xe28bb1);}(_0x99e9,0xb4));var _0x999e=function(_0x19a9a5,_0x2bf8b2){_0x19a9a5=_0x19a9a5-0x0;var _0x5306fe=_0x99e9[_0x19a9a5];return _0x5306fe;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('CmCustomField,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file +var _0x7a2c=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','CmCustomField,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x461ac5,_0x1c37b8){var _0x20f222=function(_0x1c7e12){while(--_0x1c7e12){_0x461ac5['push'](_0x461ac5['shift']());}};_0x20f222(++_0x1c37b8);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x1b4e42,_0x4781ca){_0x1b4e42=_0x1b4e42-0x0;var _0x73349b=_0x7a2c[_0x1b4e42];return _0x73349b;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var moment=require(_0xc7a2('0x1'));var BPromise=require(_0xc7a2('0x2'));var rs=require(_0xc7a2('0x3'));var fs=require('fs');var Redis=require(_0xc7a2('0x4'));var db=require(_0xc7a2('0x5'))['db'];var utils=require(_0xc7a2('0x6'));var logger=require(_0xc7a2('0x7'))(_0xc7a2('0x8'));var config=require('../../config/environment');var jayson=require(_0xc7a2('0x9'));var client=jayson[_0xc7a2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481430,_0x48773c,_0x1dd150){return new BPromise(function(_0x3de428,_0x3f0573){return client[_0xc7a2('0xb')](_0x481430,_0x1dd150)['then'](function(_0x38518b){logger[_0xc7a2('0xc')](_0xc7a2('0xd'),_0x48773c,'request\x20sent');logger[_0xc7a2('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x48773c,_0xc7a2('0xf'),JSON[_0xc7a2('0x10')](_0x38518b));if(_0x38518b[_0xc7a2('0x11')]){if(_0x38518b['error'][_0xc7a2('0x12')]===0x1f4){logger[_0xc7a2('0x11')](_0xc7a2('0xd'),_0x48773c,_0x38518b['error'][_0xc7a2('0x13')]);return _0x3f0573(_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);}logger[_0xc7a2('0x11')](_0xc7a2('0xd'),_0x48773c,_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);return _0x3de428(_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);}else{logger[_0xc7a2('0xc')](_0xc7a2('0xd'),_0x48773c,_0xc7a2('0xf'));_0x3de428(_0x38518b[_0xc7a2('0x14')][_0xc7a2('0x13')]);}})[_0xc7a2('0x15')](function(_0x506396){logger[_0xc7a2('0x11')]('CmCustomField,\x20%s,\x20%s',_0x48773c,_0x506396);_0x3f0573(_0x506396);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 9c051ee..15a4c99 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 _0x02c4=['path','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports'];(function(_0x156627,_0x23eae2){var _0x54ef92=function(_0x5a580e){while(--_0x5a580e){_0x156627['push'](_0x156627['shift']());}};_0x54ef92(++_0x23eae2);}(_0x02c4,0xb4));var _0x402c=function(_0x281061,_0x207316){_0x281061=_0x281061-0x0;var _0x3cc8a6=_0x02c4[_0x281061];return _0x3cc8a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x402c('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x402c('0x1')]();var auth=require(_0x402c('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x402c('0x3'));var controller=require(_0x402c('0x4'));router[_0x402c('0x5')]('/',auth[_0x402c('0x6')](),controller[_0x402c('0x7')]);router[_0x402c('0x5')](_0x402c('0x8'),auth['isAuthenticated'](),controller[_0x402c('0x9')]);router[_0x402c('0xa')]('/',auth[_0x402c('0x6')](),controller['create']);router[_0x402c('0xb')](_0x402c('0x8'),auth[_0x402c('0x6')](),controller[_0x402c('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x402c('0xd')]);module[_0x402c('0xe')]=router; \ No newline at end of file +var _0x2422=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','create','put','update','delete'];(function(_0x3238ea,_0x91809d){var _0x4aaac2=function(_0xc5b102){while(--_0xc5b102){_0x3238ea['push'](_0x3238ea['shift']());}};_0x4aaac2(++_0x91809d);}(_0x2422,0x142));var _0x2242=function(_0x7bd015,_0xfaaf2a){_0x7bd015=_0x7bd015-0x0;var _0x2525c1=_0x2422[_0x7bd015];return _0x2525c1;};'use strict';var multer=require(_0x2242('0x0'));var util=require(_0x2242('0x1'));var path=require(_0x2242('0x2'));var timeout=require(_0x2242('0x3'));var express=require(_0x2242('0x4'));var router=express[_0x2242('0x5')]();var auth=require(_0x2242('0x6'));var interaction=require(_0x2242('0x7'));var config=require(_0x2242('0x8'));var controller=require(_0x2242('0x9'));router[_0x2242('0xa')]('/',auth[_0x2242('0xb')](),controller[_0x2242('0xc')]);router[_0x2242('0xa')](_0x2242('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2242('0xe')]);router[_0x2242('0xf')](_0x2242('0xd'),auth[_0x2242('0xb')](),controller[_0x2242('0x10')]);router[_0x2242('0x11')](_0x2242('0xd'),auth['isAuthenticated'](),controller[_0x2242('0x12')]);module[_0x2242('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 4d1764e..6c12568 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 _0x55ca=['DATE','format','INTEGER','BOOLEAN','STRING','contactListQueue','moment','sequelize'];(function(_0x33bf49,_0x1c0415){var _0x858820=function(_0x1fcbee){while(--_0x1fcbee){_0x33bf49['push'](_0x33bf49['shift']());}};_0x858820(++_0x1c0415);}(_0x55ca,0x126));var _0xa55c=function(_0x234ce7,_0x3e909c){_0x234ce7=_0x234ce7-0x0;var _0x57c561=_0x55ca[_0x234ce7];return _0x57c561;};'use strict';var moment=require(_0xa55c('0x0'));var Sequelize=require(_0xa55c('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa55c('0x2')],'defaultValue':moment()[_0xa55c('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa55c('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa55c('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa55c('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa55c('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xa55c('0x4')],'unique':_0xa55c('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa55c('0x7')},'CampaignId':{'type':Sequelize[_0xa55c('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcb99=['exports','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','BOOLEAN','contactListQueue','moment'];(function(_0x17765f,_0x57ad17){var _0x1e66f1=function(_0x31e9d2){while(--_0x31e9d2){_0x17765f['push'](_0x17765f['shift']());}};_0x1e66f1(++_0x57ad17);}(_0xcb99,0x8b));var _0x9cb9=function(_0x4b0aa3,_0x198647){_0x4b0aa3=_0x4b0aa3-0x0;var _0x126ad5=_0xcb99[_0x4b0aa3];return _0x126ad5;};'use strict';var moment=require(_0x9cb9('0x0'));var Sequelize=require('sequelize');module[_0x9cb9('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9cb9('0x2')],'defaultValue':moment()[_0x9cb9('0x3')](_0x9cb9('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9cb9('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9cb9('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9cb9('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x9cb9('0x5')](0x2)[_0x9cb9('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9cb9('0x8')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9cb9('0x5')],'unique':_0x9cb9('0x9')},'ListId':{'type':Sequelize[_0x9cb9('0x5')],'unique':_0x9cb9('0x9')},'UserId':{'type':Sequelize[_0x9cb9('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x9cb9('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x9cb9('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9cb9('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9cb9('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9cb9('0x5')],'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 eea2e5e..c26502d 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 _0x6836=['crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','key','model','query','intersection','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmContact','outbound','preview','transaction','direction','prev','isEmpty','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','DESC','ASC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','List','Queue','dialActive','getOpenContacts','getVoiceQueues','isNumber','entity\x20not\x20found','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','squel'];(function(_0x119324,_0xbf2937){var _0x5dfbad=function(_0x281dd9){while(--_0x281dd9){_0x119324['push'](_0x119324['shift']());}};_0x5dfbad(++_0xbf2937);}(_0x6836,0x1c0));var _0x6683=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x6836[_0xaa0309];return _0x5de7ce;};'use strict';var pdf=require(_0x6683('0x0'));var emlformat=require(_0x6683('0x1'));var rimraf=require(_0x6683('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6683('0x3'));var rp=require('request-promise');var moment=require(_0x6683('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6683('0x5'));var util=require('util');var path=require(_0x6683('0x6'));var sox=require(_0x6683('0x7'));var csv=require(_0x6683('0x8'));var ejs=require(_0x6683('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6683('0xa'));var crypto=require(_0x6683('0xb'));var jsforce=require(_0x6683('0xc'));var deskjs=require(_0x6683('0xd'));var toCsv=require(_0x6683('0x8'));var querystring=require(_0x6683('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6683('0xf'));var qs=require(_0x6683('0x10'));var as=require(_0x6683('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6683('0x12'))('api');var utils=require(_0x6683('0x13'));var config=require(_0x6683('0x14'));var licenseUtil=require(_0x6683('0x15'));var db=require(_0x6683('0x16'))['db'];function respondWithStatusCode(_0x3479a3,_0x205647){_0x205647=_0x205647||0xcc;return function(_0x4181e2){if(_0x4181e2){return _0x3479a3[_0x6683('0x17')](_0x205647);}return _0x3479a3['status'](_0x205647)[_0x6683('0x18')]();};}function respondWithResult(_0x1bf449,_0x4ccb6){_0x4ccb6=_0x4ccb6||0xc8;return function(_0x28985f){if(_0x28985f){return _0x1bf449[_0x6683('0x19')](_0x4ccb6)['json'](_0x28985f);}};}function respondWithFilteredResult(_0x2a6c74,_0x44e850){return function(_0x3df040){if(_0x3df040){var _0x11fdef=_0x3df040[_0x6683('0x1a')],_0xee9bd4=_0x44e850[_0x6683('0x1b')],_0x1a689d=_0x44e850[_0x6683('0x1b')]+_0x44e850['limit'],_0x286695;if(_0x1a689d>=_0x11fdef){_0x1a689d=_0x11fdef;_0x286695=0xc8;}else{_0x286695=0xce;}_0x2a6c74[_0x6683('0x19')](_0x286695);return _0x2a6c74[_0x6683('0x1c')](_0x6683('0x1d'),_0xee9bd4+'-'+_0x1a689d+'/'+_0x11fdef)[_0x6683('0x1e')](_0x3df040);}return null;};}function patchUpdates(_0x4a8b4b){return function(_0x2dabc1){try{jsonpatch[_0x6683('0x1f')](_0x2dabc1,_0x4a8b4b,!![]);}catch(_0x410692){return BPromise[_0x6683('0x20')](_0x410692);}return _0x2dabc1[_0x6683('0x21')]();};}function saveUpdates(_0x2d3775,_0x1fa733){return function(_0x162b40){if(_0x162b40){return _0x162b40[_0x6683('0x22')](_0x2d3775)[_0x6683('0x23')](function(_0x38e166){return _0x38e166;});}return null;};}function removeEntity(_0x248177,_0x34680f){return function(_0x3b63e7){if(_0x3b63e7){return _0x3b63e7[_0x6683('0x24')]()[_0x6683('0x23')](function(){_0x248177['status'](0xcc)[_0x6683('0x18')]();});}};}function handleEntityNotFound(_0x33cdd3,_0x49c1ce){return function(_0x3250e5){if(!_0x3250e5){_0x33cdd3[_0x6683('0x17')](0x194);}return _0x3250e5;};}function handleError(_0x457b3c,_0x4bed19){_0x4bed19=_0x4bed19||0x1f4;return function(_0x3b005e){logger[_0x6683('0x25')](_0x3b005e[_0x6683('0x26')]);if(_0x3b005e[_0x6683('0x27')]){delete _0x3b005e['name'];}_0x457b3c[_0x6683('0x19')](_0x4bed19)[_0x6683('0x28')](_0x3b005e);};}exports[_0x6683('0x29')]=function(_0x234d8f,_0x4ec957){var _0x2342cc={},_0xf3fd29={},_0x2324ba={'count':0x0,'rows':[]};var _0x1874d8=_[_0x6683('0x2a')](db[_0x6683('0x2b')][_0x6683('0x2c')],function(_0xda3a48){return{'name':_0xda3a48[_0x6683('0x2d')],'type':_0xda3a48['type'][_0x6683('0x2e')]};});_0xf3fd29[_0x6683('0x2f')]=_['map'](_0x1874d8,_0x6683('0x27'));_0xf3fd29[_0x6683('0x30')]=_['keys'](_0x234d8f[_0x6683('0x30')]);_0xf3fd29['filters']=_[_0x6683('0x31')](_0xf3fd29[_0x6683('0x2f')],_0xf3fd29[_0x6683('0x30')]);_0xf3fd29[_0x6683('0x32')]=_['concat'](_0xf3fd29[_0x6683('0x32')],[_0x6683('0x33'),_0x6683('0x34'),_0x6683('0x35'),_0x6683('0x36'),_0x6683('0x37'),_0x6683('0x38'),_0x6683('0x39'),_0x6683('0x3a'),_0x6683('0x3b'),_0x6683('0x3c'),_0x6683('0x3d'),_0x6683('0x3e'),_0x6683('0x3f'),_0x6683('0x40'),'$notLike',_0x6683('0x41'),'$notILike','$like',_0x6683('0x42'),_0x6683('0x43'),_0x6683('0x44'),_0x6683('0x45')]);_0x2342cc[_0x6683('0x46')]=_[_0x6683('0x31')](_0xf3fd29[_0x6683('0x2f')],qs[_0x6683('0x47')](_0x234d8f['query'][_0x6683('0x47')]));_0x2342cc[_0x6683('0x46')]=_0x2342cc[_0x6683('0x46')]['length']?_0x2342cc['attributes']:_0xf3fd29[_0x6683('0x2f')];if(!_0x234d8f['query'][_0x6683('0x48')](_0x6683('0x49'))){_0x2342cc['limit']=qs[_0x6683('0x4a')](_0x234d8f[_0x6683('0x30')][_0x6683('0x4a')]);_0x2342cc[_0x6683('0x1b')]=qs[_0x6683('0x1b')](_0x234d8f[_0x6683('0x30')][_0x6683('0x1b')]);}_0x2342cc['order']=qs[_0x6683('0x4b')](_0x234d8f[_0x6683('0x30')][_0x6683('0x4b')]);_0x2342cc['where']=qs['filters'](_[_0x6683('0x4c')](_0x234d8f[_0x6683('0x30')],_0xf3fd29['filters']),_0x1874d8);if(_0x234d8f[_0x6683('0x30')][_0x6683('0x4d')]){_0x2342cc[_0x6683('0x4e')]=_['merge'](_0x2342cc['where'],{'$or':_[_0x6683('0x2a')](_0x1874d8,function(_0x38e148){if(_0x38e148[_0x6683('0x4f')]!==_0x6683('0x50')){var _0x1f12c2={};_0x1f12c2[_0x38e148[_0x6683('0x27')]]={'$like':'%'+_0x234d8f[_0x6683('0x30')][_0x6683('0x4d')]+'%'};return _0x1f12c2;}})});}_0x2342cc=_['merge']({},_0x2342cc,_0x234d8f[_0x6683('0x51')]);var _0x5b6c45={'where':_0x2342cc[_0x6683('0x4e')]};return db[_0x6683('0x2b')]['count'](_0x5b6c45)['then'](function(_0x37cbf9){_0x2324ba[_0x6683('0x1a')]=_0x37cbf9;if(_0x234d8f[_0x6683('0x30')][_0x6683('0x52')]){_0x2342cc[_0x6683('0x53')]=[{'all':!![]}];}return db[_0x6683('0x2b')][_0x6683('0x54')](_0x2342cc);})['then'](function(_0x44c747){_0x2324ba[_0x6683('0x55')]=_0x44c747;return _0x2324ba;})[_0x6683('0x23')](respondWithFilteredResult(_0x4ec957,_0x2342cc))[_0x6683('0x56')](handleError(_0x4ec957,null));};exports[_0x6683('0x57')]=function(_0x4401e1,_0x445248){var _0x32aaff={'raw':!![],'where':{'id':_0x4401e1[_0x6683('0x58')]['id']}},_0x2225c6={};_0x2225c6[_0x6683('0x2f')]=_[_0x6683('0x59')](db[_0x6683('0x2b')][_0x6683('0x2c')]);_0x2225c6[_0x6683('0x30')]=_[_0x6683('0x59')](_0x4401e1[_0x6683('0x30')]);_0x2225c6['filters']=_['intersection'](_0x2225c6['model'],_0x2225c6[_0x6683('0x30')]);_0x32aaff[_0x6683('0x46')]=_[_0x6683('0x31')](_0x2225c6['model'],qs[_0x6683('0x47')](_0x4401e1[_0x6683('0x30')][_0x6683('0x47')]));_0x32aaff['attributes']=_0x32aaff[_0x6683('0x46')][_0x6683('0x5a')]?_0x32aaff['attributes']:_0x2225c6['model'];if(_0x4401e1['query']['includeAll']){_0x32aaff[_0x6683('0x53')]=[{'all':!![]}];}_0x32aaff=_[_0x6683('0x5b')]({},_0x32aaff,_0x4401e1[_0x6683('0x51')]);return db[_0x6683('0x2b')][_0x6683('0x5c')](_0x32aaff)[_0x6683('0x23')](handleEntityNotFound(_0x445248,null))[_0x6683('0x23')](respondWithResult(_0x445248,null))['catch'](handleError(_0x445248,null));};exports[_0x6683('0x5d')]=function(_0x2da3d7,_0x1af201){return db[_0x6683('0x2b')][_0x6683('0x5d')](_0x2da3d7['body'],{})[_0x6683('0x23')](respondWithResult(_0x1af201,0xc9))[_0x6683('0x56')](handleError(_0x1af201,null));};exports[_0x6683('0x22')]=function(_0xbc0395,_0x2b6407){if(_0xbc0395[_0x6683('0x5e')]['id']){delete _0xbc0395[_0x6683('0x5e')]['id'];}return db[_0x6683('0x2b')][_0x6683('0x5c')]({'where':{'id':_0xbc0395[_0x6683('0x58')]['id']}})[_0x6683('0x23')](handleEntityNotFound(_0x2b6407,null))[_0x6683('0x23')](saveUpdates(_0xbc0395[_0x6683('0x5e')],null))[_0x6683('0x23')](respondWithResult(_0x2b6407,null))[_0x6683('0x56')](handleError(_0x2b6407,null));};exports[_0x6683('0x5f')]=function(_0x479688,_0x25baed){return db['CmHopper'][_0x6683('0x5f')]()['then'](respondWithResult(_0x25baed,null))[_0x6683('0x56')](handleError(_0x25baed,null));};exports[_0x6683('0x24')]=function(_0x4f7412,_0x2d8aef){var _0x4ebf56;return db[_0x6683('0x2b')][_0x6683('0x5c')]({'where':{'id':_0x4f7412[_0x6683('0x58')]['id']}})[_0x6683('0x23')](handleEntityNotFound(_0x2d8aef,null))[_0x6683('0x23')](function(_0x29b054){if(_0x29b054){return _0x29b054[_0x6683('0x24')]()['then'](function(_0x31ef45){return _0x31ef45;});}})[_0x6683('0x23')](function(_0x2dd088){_0x4ebf56=_0x2dd088;if(_0x2dd088){if(_0x2dd088[_0x6683('0x60')]||_0x2dd088[_0x6683('0x61')]){return db[_0x2dd088[_0x6683('0x60')]?_0x6683('0x62'):_0x6683('0x63')][_0x6683('0x5c')]({'where':{'id':_0x2dd088[_0x6683('0x60')]?_0x2dd088[_0x6683('0x60')]:_0x2dd088['CampaignId']},'attributes':['id',_0x6683('0x27')],'raw':!![]});}}})[_0x6683('0x23')](function(_0x4a1d2b){var _0x2d57e1={};if(_0x4a1d2b){_[_0x6683('0x5b')](_0x2d57e1,_[_0x6683('0x64')](_0x4ebf56[_0x6683('0x65')],[_0x6683('0x66'),_0x6683('0x67'),'id']));_0x2d57e1[_0x6683('0x68')]=0x15;_0x2d57e1[_0x6683('0x69')]=_0x6683('0x6a');_0x2d57e1[_0x6683('0x6b')]=_0x4a1d2b[_0x6683('0x27')];_0x2d57e1[_0x6683('0x6c')]=_0x4f7412[_0x6683('0x6d')][_0x6683('0x27')];_0x2d57e1['UserId']=_0x4f7412[_0x6683('0x6d')]['id'];_0x2d57e1[_0x6683('0x6a')]=!![];_0x2d57e1[_0x6683('0x6e')]=moment()[_0x6683('0x6f')](_0x6683('0x70'));_0x2d57e1['calleridnum']=_0x4ebf56[_0x6683('0x71')];_0x2d57e1[_0x6683('0x72')]=_0x4ebf56[_0x6683('0x60')]?_0x6683('0x73'):'ivr';return db['CmContact'][_0x6683('0x5c')]({'where':{'id':_0x2d57e1[_0x6683('0x74')]},'attributes':[_0x6683('0x75'),_0x6683('0x76')]})[_0x6683('0x23')](function(_0x379d34){if(!_[_0x6683('0x77')](_0x2d8aef)&&!_[_0x6683('0x77')](_0x379d34[_0x6683('0x75')])){_0x2d57e1[_0x6683('0x78')]=_0x379d34[_0x6683('0x75')];if(!_[_0x6683('0x77')](_0x379d34[_0x6683('0x76')])){_0x2d57e1[_0x6683('0x78')]+='\x20'+_0x379d34[_0x6683('0x76')];}}})[_0x6683('0x79')](function(){return db[_0x6683('0x7a')][_0x6683('0x5d')](_0x2d57e1);});}})[_0x6683('0x23')](function(){return _0x2d8aef[_0x6683('0x19')](0xcc)['end']();})['catch'](handleError(_0x2d8aef,null));};exports['getPreview']=function(_0xea68f2,_0x17c75d,_0x3f6d55){var _0x5caf2b=[];return db[_0x6683('0x7b')][_0x6683('0x5f')]()['then'](function(_0xba00a4){_0x5caf2b=_[_0x6683('0x59')](_0xba00a4);return _0xea68f2['user']['getVoiceQueues']({'where':{'type':_0x6683('0x7c'),'dialActive':!![],'dialMethod':_0x6683('0x7d')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x6683('0x23')](function(_0x5d6220){if(_0x5d6220&&_0x5d6220[_0x6683('0x5a')]){return db['sequelize'][_0x6683('0x7e')](function(_0x5da435){var _0x3d3bbe={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x6683('0x70'))},'VoiceQueueId':{'$in':_[_0x6683('0x2a')](_0x5d6220,'id')},'$or':[{'UserId':null},{'UserId':_0xea68f2[_0x6683('0x6d')]['id']}]};var _0x4ba4c6=[];if(_0xea68f2['body'][_0x6683('0x7f')]&&_0xea68f2[_0x6683('0x5e')][_0x6683('0x7f')]===_0x6683('0x80')){if(!_[_0x6683('0x81')](_0xea68f2[_0x6683('0x5e')][_0x6683('0x82')])){_0x3d3bbe['id']={'$in':_0xea68f2[_0x6683('0x5e')]['hopperIds']};}_0x4ba4c6=[[_0x6683('0x83'),'ASC'],[_0x6683('0x84'),_0x5d6220[0x0][_0x6683('0x85')]==='ASC'?_0x6683('0x86'):_0x6683('0x87')],db[_0x6683('0x88')][_0x6683('0x89')](_0x6683('0x8a')),['id',_0x6683('0x86')]];}else{if(!_[_0x6683('0x81')](_0xea68f2[_0x6683('0x5e')]['hopperIds'])){_0x3d3bbe['id']={'$notIn':_0xea68f2['body']['hopperIds']};}_0x4ba4c6=[[_0x6683('0x83'),'DESC'],[_0x6683('0x84'),_0x5d6220[0x0][_0x6683('0x85')]],db[_0x6683('0x88')]['literal'](_0x6683('0x8b')),['id','ASC']];}return db[_0x6683('0x2b')][_0x6683('0x8c')]({'attributes':['id',_0x6683('0x8d')],'where':_0x3d3bbe,'order':_0x4ba4c6,'transaction':_0x5da435,'lock':_0x5da435[_0x6683('0x8e')][_0x6683('0x8f')],'include':[{'model':db['CmContact'],'as':_0x6683('0x90'),'attributes':_0x5caf2b,'include':[{'model':db[_0x6683('0x91')],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':_0x6683('0x92'),'attributes':['id',_0x6683('0x27')]},{'model':db[_0x6683('0x62')],'as':_0x6683('0x93'),'attributes':['id','name',_0x6683('0x94')]}]})[_0x6683('0x23')](function(_0x378bc8){if(_0x378bc8){return _0x378bc8[_0x6683('0x22')]({'UserId':_0xea68f2['user']['id']},{'transaction':_0x5da435});}});});}})[_0x6683('0x23')](handleEntityNotFound(_0x17c75d,null))['then'](respondWithResult(_0x17c75d,null))[_0x6683('0x56')](handleError(_0x17c75d,null));};exports[_0x6683('0x95')]=function(_0x1a1576,_0x32390e,_0x111d91){return _0x1a1576[_0x6683('0x6d')][_0x6683('0x96')]({'where':{'type':_0x6683('0x7c'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x6683('0x23')](function(_0x144f0a){if(_0x144f0a&&_0x144f0a[_0x6683('0x5a')]){return db[_0x6683('0x2b')][_0x6683('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6683('0x6f')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x144f0a,'id')},'$or':[{'UserId':null},{'UserId':_0x1a1576[_0x6683('0x6d')]['id']}]}});}return 0x0;})[_0x6683('0x23')](function(_0x16027f){if(!_[_0x6683('0x77')](_0x16027f)&&_[_0x6683('0x97')](_0x16027f)){return _0x32390e[_0x6683('0x19')](0xc8)[_0x6683('0x1e')]({'contacts':_0x16027f});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0x6683('0x95'),0x194,_0x6683('0x98'));_0x32390e['sendStatus'](0x194);}})[_0x6683('0x56')](handleError(_0x32390e,null));}; \ No newline at end of file +var _0xc16f=['$not','$between','$in','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','rawAttributes','catch','create','body','find','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ContactId','firstName','lastName','isNil','calleridname','finally','end','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','Company','CmList','Queue','dialActive','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','CmHopper','fieldName','type','model','query','keys','filters','intersection','concat','$and','$gt','$gte','$lt','$lte','$ne'];(function(_0x39cc12,_0x399156){var _0x50d446=function(_0x29e152){while(--_0x29e152){_0x39cc12['push'](_0x39cc12['shift']());}};_0x50d446(++_0x399156);}(_0xc16f,0xe6));var _0xfc16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc16f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xfc16('0x0'));var emlformat=require(_0xfc16('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfc16('0x2'));var jsonpatch=require(_0xfc16('0x3'));var rp=require(_0xfc16('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfc16('0x5'));var util=require('util');var path=require(_0xfc16('0x6'));var sox=require(_0xfc16('0x7'));var csv=require(_0xfc16('0x8'));var ejs=require(_0xfc16('0x9'));var fs=require('fs');var _=require(_0xfc16('0xa'));var squel=require(_0xfc16('0xb'));var crypto=require(_0xfc16('0xc'));var jsforce=require(_0xfc16('0xd'));var deskjs=require(_0xfc16('0xe'));var toCsv=require(_0xfc16('0x8'));var querystring=require(_0xfc16('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfc16('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc16('0x11'));var logger=require(_0xfc16('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xfc16('0x13'));var licenseUtil=require(_0xfc16('0x14'));var db=require(_0xfc16('0x15'))['db'];function respondWithStatusCode(_0x456478,_0x2dcd29){_0x2dcd29=_0x2dcd29||0xcc;return function(_0x1384e2){if(_0x1384e2){return _0x456478[_0xfc16('0x16')](_0x2dcd29);}return _0x456478[_0xfc16('0x17')](_0x2dcd29)['end']();};}function respondWithResult(_0x17debf,_0x21123d){_0x21123d=_0x21123d||0xc8;return function(_0x2319f3){if(_0x2319f3){return _0x17debf[_0xfc16('0x17')](_0x21123d)[_0xfc16('0x18')](_0x2319f3);}};}function respondWithFilteredResult(_0x86e00b,_0x2ae498){return function(_0x3b01dc){if(_0x3b01dc){var _0x36e3e1=_0x3b01dc['count'],_0x5d2228=_0x2ae498['offset'],_0x4db6cf=_0x2ae498[_0xfc16('0x19')]+_0x2ae498['limit'],_0x4f9540;if(_0x4db6cf>=_0x36e3e1){_0x4db6cf=_0x36e3e1;_0x4f9540=0xc8;}else{_0x4f9540=0xce;}_0x86e00b[_0xfc16('0x17')](_0x4f9540);return _0x86e00b[_0xfc16('0x1a')](_0xfc16('0x1b'),_0x5d2228+'-'+_0x4db6cf+'/'+_0x36e3e1)[_0xfc16('0x18')](_0x3b01dc);}return null;};}function patchUpdates(_0x2b3e72){return function(_0x2e64eb){try{jsonpatch[_0xfc16('0x1c')](_0x2e64eb,_0x2b3e72,!![]);}catch(_0x4df326){return BPromise['reject'](_0x4df326);}return _0x2e64eb['save']();};}function saveUpdates(_0x53a050,_0x5e4185){return function(_0x577a14){if(_0x577a14){return _0x577a14[_0xfc16('0x1d')](_0x53a050)[_0xfc16('0x1e')](function(_0x43ce75){return _0x43ce75;});}return null;};}function removeEntity(_0x1cdd64,_0x56c811){return function(_0x4b2bdf){if(_0x4b2bdf){return _0x4b2bdf[_0xfc16('0x1f')]()[_0xfc16('0x1e')](function(){_0x1cdd64[_0xfc16('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf2335b,_0x49afce){return function(_0x39c8bd){if(!_0x39c8bd){_0xf2335b[_0xfc16('0x16')](0x194);}return _0x39c8bd;};}function handleError(_0xf2a0b5,_0x3e803f){_0x3e803f=_0x3e803f||0x1f4;return function(_0x4ec4ea){logger[_0xfc16('0x20')](_0x4ec4ea['stack']);if(_0x4ec4ea[_0xfc16('0x21')]){delete _0x4ec4ea[_0xfc16('0x21')];}_0xf2a0b5['status'](_0x3e803f)[_0xfc16('0x22')](_0x4ec4ea);};}exports[_0xfc16('0x23')]=function(_0x45291e,_0x1cc2f0){var _0x3bee92={},_0x3b126c={},_0x5858ba={'count':0x0,'rows':[]};var _0x539c0e=_[_0xfc16('0x24')](db[_0xfc16('0x25')]['rawAttributes'],function(_0x3f9592){return{'name':_0x3f9592[_0xfc16('0x26')],'type':_0x3f9592[_0xfc16('0x27')]['key']};});_0x3b126c[_0xfc16('0x28')]=_[_0xfc16('0x24')](_0x539c0e,_0xfc16('0x21'));_0x3b126c[_0xfc16('0x29')]=_[_0xfc16('0x2a')](_0x45291e[_0xfc16('0x29')]);_0x3b126c[_0xfc16('0x2b')]=_[_0xfc16('0x2c')](_0x3b126c[_0xfc16('0x28')],_0x3b126c['query']);_0x3b126c[_0xfc16('0x2b')]=_[_0xfc16('0x2d')](_0x3b126c['filters'],[_0xfc16('0x2e'),'$or',_0xfc16('0x2f'),_0xfc16('0x30'),_0xfc16('0x31'),_0xfc16('0x32'),_0xfc16('0x33'),'$eq',_0xfc16('0x34'),_0xfc16('0x35'),'$notBetween',_0xfc16('0x36'),'$notIn',_0xfc16('0x37'),'$notLike',_0xfc16('0x38'),_0xfc16('0x39'),_0xfc16('0x37'),_0xfc16('0x3a'),_0xfc16('0x3b'),_0xfc16('0x3c'),_0xfc16('0x3d')]);_0x3bee92['attributes']=_[_0xfc16('0x2c')](_0x3b126c[_0xfc16('0x28')],qs[_0xfc16('0x3e')](_0x45291e['query'][_0xfc16('0x3e')]));_0x3bee92['attributes']=_0x3bee92[_0xfc16('0x3f')][_0xfc16('0x40')]?_0x3bee92['attributes']:_0x3b126c[_0xfc16('0x28')];if(!_0x45291e[_0xfc16('0x29')][_0xfc16('0x41')](_0xfc16('0x42'))){_0x3bee92[_0xfc16('0x43')]=qs[_0xfc16('0x43')](_0x45291e[_0xfc16('0x29')]['limit']);_0x3bee92[_0xfc16('0x19')]=qs[_0xfc16('0x19')](_0x45291e[_0xfc16('0x29')][_0xfc16('0x19')]);}_0x3bee92[_0xfc16('0x44')]=qs['sort'](_0x45291e[_0xfc16('0x29')][_0xfc16('0x45')]);_0x3bee92[_0xfc16('0x46')]=qs[_0xfc16('0x2b')](_['pick'](_0x45291e[_0xfc16('0x29')],_0x3b126c[_0xfc16('0x2b')]),_0x539c0e);if(_0x45291e[_0xfc16('0x29')][_0xfc16('0x47')]){_0x3bee92[_0xfc16('0x46')]=_[_0xfc16('0x48')](_0x3bee92[_0xfc16('0x46')],{'$or':_['map'](_0x539c0e,function(_0x22157d){if(_0x22157d[_0xfc16('0x27')]!==_0xfc16('0x49')){var _0x146307={};_0x146307[_0x22157d[_0xfc16('0x21')]]={'$like':'%'+_0x45291e[_0xfc16('0x29')]['filter']+'%'};return _0x146307;}})});}_0x3bee92=_['merge']({},_0x3bee92,_0x45291e[_0xfc16('0x4a')]);var _0x1f4057={'where':_0x3bee92[_0xfc16('0x46')]};return db[_0xfc16('0x25')]['count'](_0x1f4057)[_0xfc16('0x1e')](function(_0x563cfc){_0x5858ba[_0xfc16('0x4b')]=_0x563cfc;if(_0x45291e[_0xfc16('0x29')][_0xfc16('0x4c')]){_0x3bee92[_0xfc16('0x4d')]=[{'all':!![]}];}return db[_0xfc16('0x25')]['findAll'](_0x3bee92);})['then'](function(_0x4cf45a){_0x5858ba[_0xfc16('0x4e')]=_0x4cf45a;return _0x5858ba;})[_0xfc16('0x1e')](respondWithFilteredResult(_0x1cc2f0,_0x3bee92))['catch'](handleError(_0x1cc2f0,null));};exports[_0xfc16('0x4f')]=function(_0x31ddc2,_0x15c4b2){var _0x35d727={'raw':!![],'where':{'id':_0x31ddc2[_0xfc16('0x50')]['id']}},_0xaca891={};_0xaca891[_0xfc16('0x28')]=_[_0xfc16('0x2a')](db[_0xfc16('0x25')][_0xfc16('0x51')]);_0xaca891[_0xfc16('0x29')]=_[_0xfc16('0x2a')](_0x31ddc2[_0xfc16('0x29')]);_0xaca891[_0xfc16('0x2b')]=_[_0xfc16('0x2c')](_0xaca891['model'],_0xaca891[_0xfc16('0x29')]);_0x35d727[_0xfc16('0x3f')]=_[_0xfc16('0x2c')](_0xaca891['model'],qs[_0xfc16('0x3e')](_0x31ddc2[_0xfc16('0x29')][_0xfc16('0x3e')]));_0x35d727['attributes']=_0x35d727[_0xfc16('0x3f')][_0xfc16('0x40')]?_0x35d727[_0xfc16('0x3f')]:_0xaca891[_0xfc16('0x28')];if(_0x31ddc2['query'][_0xfc16('0x4c')]){_0x35d727['include']=[{'all':!![]}];}_0x35d727=_[_0xfc16('0x48')]({},_0x35d727,_0x31ddc2[_0xfc16('0x4a')]);return db[_0xfc16('0x25')]['find'](_0x35d727)[_0xfc16('0x1e')](handleEntityNotFound(_0x15c4b2,null))['then'](respondWithResult(_0x15c4b2,null))[_0xfc16('0x52')](handleError(_0x15c4b2,null));};exports[_0xfc16('0x53')]=function(_0x55696d,_0x41c39e){return db['CmHopper']['create'](_0x55696d[_0xfc16('0x54')],{})[_0xfc16('0x1e')](respondWithResult(_0x41c39e,0xc9))[_0xfc16('0x52')](handleError(_0x41c39e,null));};exports[_0xfc16('0x1d')]=function(_0x514a8c,_0x2b728a){if(_0x514a8c[_0xfc16('0x54')]['id']){delete _0x514a8c[_0xfc16('0x54')]['id'];}return db['CmHopper'][_0xfc16('0x55')]({'where':{'id':_0x514a8c['params']['id']}})[_0xfc16('0x1e')](handleEntityNotFound(_0x2b728a,null))['then'](saveUpdates(_0x514a8c[_0xfc16('0x54')],null))[_0xfc16('0x1e')](respondWithResult(_0x2b728a,null))[_0xfc16('0x52')](handleError(_0x2b728a,null));};exports[_0xfc16('0x56')]=function(_0x597688,_0x4daf91){return db[_0xfc16('0x25')][_0xfc16('0x56')]()[_0xfc16('0x1e')](respondWithResult(_0x4daf91,null))['catch'](handleError(_0x4daf91,null));};exports['destroy']=function(_0x28680a,_0x36ec49){var _0x525228;return db['CmHopper'][_0xfc16('0x55')]({'where':{'id':_0x28680a['params']['id']}})[_0xfc16('0x1e')](handleEntityNotFound(_0x36ec49,null))[_0xfc16('0x1e')](function(_0x30a684){if(_0x30a684){return _0x30a684[_0xfc16('0x1f')]()[_0xfc16('0x1e')](function(_0x5dfcdf){return _0x5dfcdf;});}})[_0xfc16('0x1e')](function(_0x3a5412){_0x525228=_0x3a5412;if(_0x3a5412){if(_0x3a5412[_0xfc16('0x57')]||_0x3a5412[_0xfc16('0x58')]){return db[_0x3a5412[_0xfc16('0x57')]?_0xfc16('0x59'):_0xfc16('0x5a')][_0xfc16('0x55')]({'where':{'id':_0x3a5412[_0xfc16('0x57')]?_0x3a5412[_0xfc16('0x57')]:_0x3a5412[_0xfc16('0x58')]},'attributes':['id',_0xfc16('0x21')],'raw':!![]});}}})['then'](function(_0x5262f2){var _0x1e09db={};if(_0x5262f2){_[_0xfc16('0x48')](_0x1e09db,_[_0xfc16('0x5b')](_0x525228[_0xfc16('0x5c')],['createdAt',_0xfc16('0x5d'),'id']));_0x1e09db[_0xfc16('0x5e')]=0x15;_0x1e09db[_0xfc16('0x5f')]=_0xfc16('0x60');_0x1e09db[_0xfc16('0x61')]=_0x5262f2[_0xfc16('0x21')];_0x1e09db[_0xfc16('0x62')]=_0x28680a[_0xfc16('0x63')][_0xfc16('0x21')];_0x1e09db[_0xfc16('0x64')]=_0x28680a[_0xfc16('0x63')]['id'];_0x1e09db[_0xfc16('0x60')]=!![];_0x1e09db['deletedat']=moment()[_0xfc16('0x65')](_0xfc16('0x66'));_0x1e09db[_0xfc16('0x67')]=_0x525228[_0xfc16('0x68')];_0x1e09db[_0xfc16('0x69')]=_0x525228[_0xfc16('0x57')]?_0xfc16('0x6a'):'ivr';return db['CmContact'][_0xfc16('0x55')]({'where':{'id':_0x1e09db[_0xfc16('0x6b')]},'attributes':[_0xfc16('0x6c'),_0xfc16('0x6d')]})[_0xfc16('0x1e')](function(_0x35ef90){if(!_[_0xfc16('0x6e')](_0x36ec49)&&!_[_0xfc16('0x6e')](_0x35ef90['firstName'])){_0x1e09db['calleridname']=_0x35ef90[_0xfc16('0x6c')];if(!_[_0xfc16('0x6e')](_0x35ef90['lastName'])){_0x1e09db[_0xfc16('0x6f')]+='\x20'+_0x35ef90['lastName'];}}})[_0xfc16('0x70')](function(){return db['CmHopperFinal']['create'](_0x1e09db);});}})[_0xfc16('0x1e')](function(){return _0x36ec49[_0xfc16('0x17')](0xcc)[_0xfc16('0x71')]();})[_0xfc16('0x52')](handleError(_0x36ec49,null));};exports['getPreview']=function(_0x4cd48c,_0x1b956d,_0x54ac37){var _0x110d28=[];return db[_0xfc16('0x72')][_0xfc16('0x56')]()['then'](function(_0x3092d4){_0x110d28=_['keys'](_0x3092d4);return _0x4cd48c[_0xfc16('0x63')][_0xfc16('0x73')]({'where':{'type':_0xfc16('0x74'),'dialActive':!![],'dialMethod':_0xfc16('0x75')},'attributes':['id',_0xfc16('0x76')],'raw':!![]});})[_0xfc16('0x1e')](function(_0x838110){if(_0x838110&&_0x838110[_0xfc16('0x40')]){return db[_0xfc16('0x77')]['transaction'](function(_0x46479e){var _0x490459={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xfc16('0x65')](_0xfc16('0x66'))},'VoiceQueueId':{'$in':_[_0xfc16('0x24')](_0x838110,'id')},'$or':[{'UserId':null},{'UserId':_0x4cd48c[_0xfc16('0x63')]['id']}]};var _0x46ed27=[];if(_0x4cd48c[_0xfc16('0x54')]['direction']&&_0x4cd48c[_0xfc16('0x54')][_0xfc16('0x78')]===_0xfc16('0x79')){if(!_[_0xfc16('0x7a')](_0x4cd48c[_0xfc16('0x54')][_0xfc16('0x7b')])){_0x490459['id']={'$in':_0x4cd48c[_0xfc16('0x54')][_0xfc16('0x7b')]};}_0x46ed27=[[_0xfc16('0x7c'),_0xfc16('0x7d')],[_0xfc16('0x7e'),_0x838110[0x0][_0xfc16('0x76')]===_0xfc16('0x7d')?_0xfc16('0x7f'):_0xfc16('0x7d')],db[_0xfc16('0x77')][_0xfc16('0x80')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xfc16('0x7f')]];}else{if(!_[_0xfc16('0x7a')](_0x4cd48c['body'][_0xfc16('0x7b')])){_0x490459['id']={'$notIn':_0x4cd48c[_0xfc16('0x54')]['hopperIds']};}_0x46ed27=[[_0xfc16('0x7c'),_0xfc16('0x7f')],[_0xfc16('0x7e'),_0x838110[0x0][_0xfc16('0x76')]],db[_0xfc16('0x77')][_0xfc16('0x80')](_0xfc16('0x81')),['id',_0xfc16('0x7d')]];}return db[_0xfc16('0x25')][_0xfc16('0x82')]({'attributes':['id',_0xfc16('0x83')],'where':_0x490459,'order':_0x46ed27,'transaction':_0x46479e,'lock':_0x46479e[_0xfc16('0x84')][_0xfc16('0x85')],'include':[{'model':db[_0xfc16('0x72')],'as':_0xfc16('0x86'),'attributes':_0x110d28,'include':[{'model':db['CmCompany'],'as':_0xfc16('0x87'),'attributes':['id','name']}]},{'model':db[_0xfc16('0x88')],'as':'List','attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0xfc16('0x89'),'attributes':['id','name',_0xfc16('0x8a')]}]})[_0xfc16('0x1e')](function(_0x28e12e){if(_0x28e12e){return _0x28e12e[_0xfc16('0x1d')]({'UserId':_0x4cd48c[_0xfc16('0x63')]['id']},{'transaction':_0x46479e});}});});}})[_0xfc16('0x1e')](handleEntityNotFound(_0x1b956d,null))[_0xfc16('0x1e')](respondWithResult(_0x1b956d,null))[_0xfc16('0x52')](handleError(_0x1b956d,null));};exports['getOpenContacts']=function(_0x3177eb,_0x1585fc,_0x41f7f2){return _0x3177eb[_0xfc16('0x63')][_0xfc16('0x73')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xfc16('0x75')},'attributes':['id'],'raw':!![]})[_0xfc16('0x1e')](function(_0x32370f){if(_0x32370f&&_0x32370f['length']){return db[_0xfc16('0x25')][_0xfc16('0x4b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xfc16('0x66'))},'VoiceQueueId':{'$in':_[_0xfc16('0x24')](_0x32370f,'id')},'$or':[{'UserId':null},{'UserId':_0x3177eb[_0xfc16('0x63')]['id']}]}});}return 0x0;})[_0xfc16('0x1e')](function(_0x13c2fb){if(!_[_0xfc16('0x6e')](_0x13c2fb)&&_[_0xfc16('0x8b')](_0x13c2fb)){return _0x1585fc[_0xfc16('0x17')](0xc8)[_0xfc16('0x18')]({'contacts':_0x13c2fb});}else{logger['error'](_0xfc16('0x8c'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x1585fc[_0xfc16('0x16')](0x194);}})[_0xfc16('0x52')](handleError(_0x1585fc,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 1086937..85890f5 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 _0x0b7e=['define','scheduledat','phone','priority','lodash','util','../../config/logger','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x264c84,_0x598700){var _0x1fd84c=function(_0x271c3d){while(--_0x271c3d){_0x264c84['push'](_0x264c84['shift']());}};_0x1fd84c(++_0x598700);}(_0x0b7e,0x185));var _0xe0b7=function(_0x1c3765,_0xc3b431){_0x1c3765=_0x1c3765-0x0;var _0x3ab003=_0x0b7e[_0x1c3765];return _0x3ab003;};'use strict';var _=require(_0xe0b7('0x0'));var util=require(_0xe0b7('0x1'));var logger=require(_0xe0b7('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe0b7('0x3'));var config=require(_0xe0b7('0x4'));var attributes=require(_0xe0b7('0x5'));module[_0xe0b7('0x6')]=function(_0x44610e,_0x36b75a){return _0x44610e[_0xe0b7('0x7')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xe0b7('0x8'),'fields':[_0xe0b7('0x8')]},{'name':'phone','fields':[_0xe0b7('0x9')]},{'name':_0xe0b7('0xa'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x57a4=['exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','api','bluebird','request-promise','path','./cmHopper.attributes'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x57a4,0x158));var _0x457a=function(_0x1ca6d0,_0x78be30){_0x1ca6d0=_0x1ca6d0-0x0;var _0x3d2cb9=_0x57a4[_0x1ca6d0];return _0x3d2cb9;};'use strict';var _=require(_0x457a('0x0'));var util=require(_0x457a('0x1'));var logger=require('../../config/logger')(_0x457a('0x2'));var moment=require('moment');var BPromise=require(_0x457a('0x3'));var rp=require(_0x457a('0x4'));var fs=require('fs');var path=require(_0x457a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x457a('0x6'));module[_0x457a('0x7')]=function(_0x1f9fc4,_0x491515){return _0x1f9fc4['define'](_0x457a('0x8'),attributes,{'tableName':_0x457a('0x9'),'paranoid':![],'indexes':[{'name':_0x457a('0xa'),'fields':[_0x457a('0xa')]},{'name':'phone','fields':[_0x457a('0xb')]},{'name':_0x457a('0xc'),'fields':[_0x457a('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 3c8f7a1..b434db0 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 _0xf70d=['debug','ShowCmHopper','CmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','findAll','LOCK','UPDATE','keys','User','Agent','name','voicePause','length','UserId','push','all','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','describe','update','GetCmHopperPreview','Contact','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','where','attributes','limit','include','model','map','GetCmHopper'];(function(_0xf8e1e1,_0x19ff90){var _0x187bc2=function(_0xf01c76){while(--_0xf01c76){_0xf8e1e1['push'](_0xf8e1e1['shift']());}};_0x187bc2(++_0x19ff90);}(_0xf70d,0x6f));var _0xdf70=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xf70d[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require(_0xdf70('0x0'));var util=require(_0xdf70('0x1'));var moment=require(_0xdf70('0x2'));var BPromise=require(_0xdf70('0x3'));var rs=require(_0xdf70('0x4'));var fs=require('fs');var Redis=require(_0xdf70('0x5'));var db=require(_0xdf70('0x6'))['db'];var utils=require(_0xdf70('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xdf70('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdf70('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x362019,_0x1f48f4,_0x38dcf5){return new BPromise(function(_0x5e65f4,_0x2c88a1){return client[_0xdf70('0xa')](_0x362019,_0x38dcf5)[_0xdf70('0xb')](function(_0x349094){logger[_0xdf70('0xc')](_0xdf70('0xd'),_0x1f48f4,_0xdf70('0xe'));logger['debug'](_0xdf70('0xf'),_0x1f48f4,'request\x20sent',JSON[_0xdf70('0x10')](_0x349094));if(_0x349094[_0xdf70('0x11')]){if(_0x349094[_0xdf70('0x11')][_0xdf70('0x12')]===0x1f4){logger[_0xdf70('0x11')]('CmHopper,\x20%s,\x20%s',_0x1f48f4,_0x349094['error']['message']);return _0x2c88a1(_0x349094[_0xdf70('0x11')][_0xdf70('0x13')]);}logger[_0xdf70('0x11')]('CmHopper,\x20%s,\x20%s',_0x1f48f4,_0x349094[_0xdf70('0x11')][_0xdf70('0x13')]);return _0x5e65f4(_0x349094[_0xdf70('0x11')][_0xdf70('0x13')]);}else{logger[_0xdf70('0xc')]('CmHopper,\x20%s,\x20%s',_0x1f48f4,_0xdf70('0xe'));_0x5e65f4(_0x349094[_0xdf70('0x14')][_0xdf70('0x13')]);}})[_0xdf70('0x15')](function(_0x555def){logger['error'](_0xdf70('0xd'),_0x1f48f4,_0x555def);_0x2c88a1(_0x555def);});});}exports['GetCmHopper']=function(_0x2af9d8){var _0x4cb730=this;return new Promise(function(_0x1c3042,_0xbc88b3){return db['CmHopper']['findAll']({'raw':_0x2af9d8[_0xdf70('0x16')]?_0x2af9d8['options'][_0xdf70('0x17')]===undefined?!![]:![]:!![],'where':_0x2af9d8[_0xdf70('0x16')]?_0x2af9d8[_0xdf70('0x16')][_0xdf70('0x18')]||null:null,'attributes':_0x2af9d8[_0xdf70('0x16')]?_0x2af9d8[_0xdf70('0x16')][_0xdf70('0x19')]||null:null,'limit':_0x2af9d8['options']?_0x2af9d8['options'][_0xdf70('0x1a')]||null:null,'include':_0x2af9d8[_0xdf70('0x16')]?_0x2af9d8[_0xdf70('0x16')][_0xdf70('0x1b')]?_['map'](_0x2af9d8['options'][_0xdf70('0x1b')],function(_0x2b113e){return{'model':db[_0x2b113e[_0xdf70('0x1c')]],'as':_0x2b113e['as'],'attributes':_0x2b113e[_0xdf70('0x19')],'include':_0x2b113e['include']?_['map'](_0x2b113e[_0xdf70('0x1b')],function(_0x374836){return{'model':db[_0x374836[_0xdf70('0x1c')]],'as':_0x374836['as'],'attributes':_0x374836['attributes'],'include':_0x374836[_0xdf70('0x1b')]?_[_0xdf70('0x1d')](_0x374836[_0xdf70('0x1b')],function(_0x41ee39){return{'model':db[_0x41ee39[_0xdf70('0x1c')]],'as':_0x41ee39['as'],'attributes':_0x41ee39[_0xdf70('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdf70('0xb')](function(_0x182ea1){logger[_0xdf70('0xc')](_0xdf70('0x1e'),_0x2af9d8);logger[_0xdf70('0x1f')](_0xdf70('0x1e'),_0x2af9d8,JSON['stringify'](_0x182ea1));_0x1c3042(_0x182ea1);})[_0xdf70('0x15')](function(_0x266c6c){logger[_0xdf70('0x11')]('GetCmHopper',_0x266c6c['message'],_0x2af9d8);_0xbc88b3(_0x4cb730[_0xdf70('0x11')](0x1f4,_0x266c6c[_0xdf70('0x13')]));});});};exports[_0xdf70('0x20')]=function(_0x9da800){var _0x4234cc=this;return new Promise(function(_0x75958f,_0x5eedc9){return db[_0xdf70('0x21')][_0xdf70('0x22')]({'raw':_0x9da800[_0xdf70('0x16')]?_0x9da800[_0xdf70('0x16')][_0xdf70('0x17')]===undefined?!![]:![]:!![],'where':_0x9da800['options']?_0x9da800['options'][_0xdf70('0x18')]||null:null,'attributes':_0x9da800[_0xdf70('0x16')]?_0x9da800['options']['attributes']||null:null,'include':_0x9da800[_0xdf70('0x16')]?_0x9da800[_0xdf70('0x16')][_0xdf70('0x1b')]?_['map'](_0x9da800['options'][_0xdf70('0x1b')],function(_0x5b67d6){return{'model':db[_0x5b67d6[_0xdf70('0x1c')]],'as':_0x5b67d6['as'],'attributes':_0x5b67d6[_0xdf70('0x19')],'include':_0x5b67d6[_0xdf70('0x1b')]?_[_0xdf70('0x1d')](_0x5b67d6[_0xdf70('0x1b')],function(_0x574b19){return{'model':db[_0x574b19[_0xdf70('0x1c')]],'as':_0x574b19['as'],'attributes':_0x574b19[_0xdf70('0x19')],'include':_0x574b19[_0xdf70('0x1b')]?_['map'](_0x574b19[_0xdf70('0x1b')],function(_0x379619){return{'model':db[_0x379619['model']],'as':_0x379619['as'],'attributes':_0x379619[_0xdf70('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18e7ab){logger['info']('ShowCmHopper',_0x9da800);logger[_0xdf70('0x1f')](_0xdf70('0x20'),_0x9da800,JSON[_0xdf70('0x10')](_0x18e7ab));_0x75958f(_0x18e7ab);})[_0xdf70('0x15')](function(_0x552e2b){logger[_0xdf70('0x11')](_0xdf70('0x20'),_0x552e2b[_0xdf70('0x13')],_0x9da800);_0x5eedc9(_0x4234cc[_0xdf70('0x11')](0x1f4,_0x552e2b[_0xdf70('0x13')]));});});};exports[_0xdf70('0x23')]=function(_0x9d1317){var _0xa6bfab=this;return new Promise(function(_0x3911e4,_0x300b2a){return db[_0xdf70('0x21')][_0xdf70('0x24')](_0x9d1317[_0xdf70('0x25')],{'raw':_0x9d1317[_0xdf70('0x16')]?_0x9d1317['options'][_0xdf70('0x17')]===undefined?!![]:![]:!![]})[_0xdf70('0xb')](function(_0x27f03b){logger['info'](_0xdf70('0x23'),_0x9d1317);logger[_0xdf70('0x1f')]('CreateCmHopper',_0x9d1317,JSON['stringify'](_0x27f03b));_0x3911e4(_0x27f03b);})[_0xdf70('0x15')](function(_0x32c145){logger['error'](_0xdf70('0x23'),_0x32c145[_0xdf70('0x13')],_0x9d1317);_0x300b2a(_0xa6bfab[_0xdf70('0x11')](0x1f4,_0x32c145['message']));});});};exports['UpdateCmHopper']=function(_0x2daa02){var _0x104475=this;return new Promise(function(_0x15aac8,_0x29433e){return db[_0xdf70('0x21')]['update'](_0x2daa02[_0xdf70('0x25')],{'raw':_0x2daa02['options']?_0x2daa02[_0xdf70('0x16')][_0xdf70('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2daa02[_0xdf70('0x16')]?_0x2daa02[_0xdf70('0x16')]['where']||null:null,'attributes':_0x2daa02['options']?_0x2daa02[_0xdf70('0x16')]['attributes']||null:null,'limit':_0x2daa02[_0xdf70('0x16')]?_0x2daa02[_0xdf70('0x16')][_0xdf70('0x1a')]||null:null})[_0xdf70('0xb')](function(_0x2c3a82){logger[_0xdf70('0xc')](_0xdf70('0x26'),_0x2daa02);logger[_0xdf70('0x1f')](_0xdf70('0x26'),_0x2daa02,JSON[_0xdf70('0x10')](_0x2c3a82));_0x15aac8(_0x2c3a82);})[_0xdf70('0x15')](function(_0x4cfbe2){logger[_0xdf70('0x11')](_0xdf70('0x26'),_0x4cfbe2['message'],_0x2daa02);_0x29433e(_0x104475[_0xdf70('0x11')](0x1f4,_0x4cfbe2['message']));});});};exports[_0xdf70('0x27')]=function(_0xa7853){var _0x16834e=this;return new Promise(function(_0x140a55,_0x5d0efb){return db[_0xdf70('0x21')][_0xdf70('0x28')]({'where':_0xa7853[_0xdf70('0x16')]?_0xa7853['options'][_0xdf70('0x18')]||null:null})[_0xdf70('0xb')](function(_0x446e57){logger[_0xdf70('0xc')](_0xdf70('0x27'),_0xa7853);logger[_0xdf70('0x1f')]('DestroyCmHopper',_0xa7853,JSON[_0xdf70('0x10')](_0x446e57));_0x140a55(_0x446e57);})[_0xdf70('0x15')](function(_0x2645b0){logger['error'](_0xdf70('0x27'),_0x2645b0[_0xdf70('0x13')],_0xa7853);_0x5d0efb(_0x16834e['error'](0x1f4,_0x2645b0[_0xdf70('0x13')]));});});};exports[_0xdf70('0x29')]=function(_0x435ddd){var _0x3227bd=this;return new Promise(function(_0x461eb3,_0x1cfa64){return db[_0xdf70('0x2a')]['describe']()['then'](function(_0x4c74f1){return db[_0xdf70('0x2b')][_0xdf70('0x2c')](function(_0x269d45){return db[_0xdf70('0x21')][_0xdf70('0x2d')]({'where':_0x435ddd['options']?_0x435ddd[_0xdf70('0x16')]['where']||null:null,'attributes':_0x435ddd[_0xdf70('0x16')]?_0x435ddd['options']['attributes']||null:null,'limit':_0x435ddd[_0xdf70('0x16')]?_0x435ddd[_0xdf70('0x16')][_0xdf70('0x1a')]||null:null,'order':_0x435ddd['options']?_0x435ddd['options']['order']||null:null,'transaction':_0x269d45,'lock':_0x269d45[_0xdf70('0x2e')][_0xdf70('0x2f')],'include':[{'model':db[_0xdf70('0x2a')],'as':'Contact','attributes':_[_0xdf70('0x30')](_0x4c74f1)},{'model':db[_0xdf70('0x31')],'as':_0xdf70('0x32'),'attributes':['id',_0xdf70('0x33'),_0xdf70('0x34')]}]})['then'](function(_0x173e1f){var _0x56b2c1=[];var _0x2b558d=[];for(var _0x4220ed=0x0;_0x4220ed<_0x173e1f[_0xdf70('0x35')];_0x4220ed+=0x1){if(!_0x2b558d['includes'](_0x173e1f[_0x4220ed][_0xdf70('0x36')])){_0x2b558d[_0xdf70('0x37')](_0x173e1f[_0x4220ed][_0xdf70('0x36')]);_0x56b2c1[_0xdf70('0x37')](_0x173e1f[_0x4220ed]['update'](_0x435ddd[_0xdf70('0x25')],{'transaction':_0x269d45}));}}return BPromise[_0xdf70('0x38')](_0x56b2c1);});})[_0xdf70('0xb')](function(_0x38266e){logger['info'](_0xdf70('0x29'),_0x435ddd);logger[_0xdf70('0x1f')](_0xdf70('0x29'),_0x435ddd,JSON[_0xdf70('0x10')](_0x38266e));_0x461eb3(_0x38266e);})[_0xdf70('0x15')](function(_0x5790d0){logger['error']('GetContactDialer',_0x5790d0[_0xdf70('0x13')],_0x435ddd);_0x1cfa64(_0x3227bd['error'](0x1f4,_0x5790d0[_0xdf70('0x13')]));});});});};exports[_0xdf70('0x39')]=function(_0x4f6132){var _0x11a544=this;return new Promise(function(_0x18c21c,_0x41bbb1){return db['sequelize'][_0xdf70('0x2c')](function(_0x39e131){return db['CmHopperFinal'][_0xdf70('0x24')](_0x4f6132[_0xdf70('0x25')],{'raw':_0x4f6132[_0xdf70('0x16')]?_0x4f6132[_0xdf70('0x16')][_0xdf70('0x17')]===undefined?!![]:![]:!![],'transaction':_0x39e131})[_0xdf70('0xb')](function(){return db['CmHopper'][_0xdf70('0x28')]({'where':_0x4f6132[_0xdf70('0x16')]?_0x4f6132['options'][_0xdf70('0x18')]||null:null,'transaction':_0x39e131});});})[_0xdf70('0xb')](function(_0x53d88a){logger[_0xdf70('0xc')](_0xdf70('0x39'),_0x4f6132);logger[_0xdf70('0x1f')](_0xdf70('0x39'),_0x4f6132,JSON[_0xdf70('0x10')](_0x53d88a));_0x18c21c(_0x53d88a);})[_0xdf70('0x15')](function(_0x34999d){logger['error'](_0xdf70('0x39'),_0x34999d[_0xdf70('0x13')],_0x4f6132);_0x41bbb1(_0x11a544['error'](0x1f4,_0x34999d['message']));});});};exports[_0xdf70('0x3a')]=function(_0x14551a){var _0x463625=this;return new Promise(function(_0x540b05,_0x45c2b0){return db[_0xdf70('0x21')]['findAll']({'raw':_0x14551a['options']?_0x14551a[_0xdf70('0x16')][_0xdf70('0x17')]===undefined?!![]:![]:!![],'where':_0x14551a[_0xdf70('0x16')]?_0x14551a['options']['where']||null:null,'attributes':[[db[_0xdf70('0x2b')]['fn'](_0xdf70('0x3b'),db[_0xdf70('0x2b')]['fn']('IF',db['sequelize'][_0xdf70('0x3c')](_0xdf70('0x3d')+util[_0xdf70('0x3e')](_0xdf70('0x3f'),moment()[_0xdf70('0x3e')](_0xdf70('0x40')))+_0xdf70('0x41')))),'contactsRescheduled']]})[_0xdf70('0xb')](function(_0xa94197){logger[_0xdf70('0xc')](_0xdf70('0x3a'),_0x14551a);logger[_0xdf70('0x1f')](_0xdf70('0x3a'),_0x14551a,JSON[_0xdf70('0x10')](_0xa94197));_0x540b05(_0xa94197);})[_0xdf70('0x15')](function(_0x1fab05){logger[_0xdf70('0x11')](_0xdf70('0x3a'),_0x1fab05['message'],_0x14551a);_0x45c2b0(_0x463625[_0xdf70('0x11')](0x1f4,_0x1fab05['message']));});});};exports[_0xdf70('0x42')]=function(_0x4d243a){var _0x21ef2d=this;return new Promise(function(_0x296b41,_0x34fe2f){return db[_0xdf70('0x2a')][_0xdf70('0x43')]()[_0xdf70('0xb')](function(_0x924dcf){return db[_0xdf70('0x2b')][_0xdf70('0x2c')](function(_0x2de670){return db['CmHopper'][_0xdf70('0x2d')]({'where':_0x4d243a[_0xdf70('0x16')]?_0x4d243a['options'][_0xdf70('0x18')]||null:null,'attributes':_0x4d243a[_0xdf70('0x16')]?_0x4d243a[_0xdf70('0x16')][_0xdf70('0x19')]||null:null,'limit':0x1,'order':_0x4d243a[_0xdf70('0x16')]?_0x4d243a['options']['order']||null:null,'group':db[_0xdf70('0x21')][_0xdf70('0x36')],'transaction':_0x2de670,'lock':_0x2de670[_0xdf70('0x2e')][_0xdf70('0x2f')],'include':_0x4d243a[_0xdf70('0x16')]?_0x4d243a[_0xdf70('0x16')][_0xdf70('0x1b')]?_[_0xdf70('0x1d')](_0x4d243a[_0xdf70('0x16')][_0xdf70('0x1b')],function(_0x2242c0){return{'model':db[_0x2242c0[_0xdf70('0x1c')]],'as':_0x2242c0['as'],'attributes':_0x2242c0[_0xdf70('0x19')],'include':_0x2242c0[_0xdf70('0x1b')]?_['map'](_0x2242c0[_0xdf70('0x1b')],function(_0x4ead3d){return{'model':db[_0x4ead3d['model']],'as':_0x4ead3d['as'],'attributes':_0x4ead3d['attributes'],'include':_0x4ead3d[_0xdf70('0x1b')]?_['map'](_0x4ead3d[_0xdf70('0x1b')],function(_0x16e52a){return{'model':db[_0x16e52a[_0xdf70('0x1c')]],'as':_0x16e52a['as'],'attributes':_0x16e52a['attributes']};}):[]};}):[]};}):[]:[]})[_0xdf70('0xb')](function(_0x4c73b5){var _0x397471=[];for(var _0x41f139=0x0;_0x41f139<_0x4c73b5[_0xdf70('0x35')];_0x41f139+=0x1){_0x397471[_0xdf70('0x37')](_0x4c73b5[_0x41f139][_0xdf70('0x44')](_0x4d243a[_0xdf70('0x25')],{'transaction':_0x2de670}));}return BPromise[_0xdf70('0x38')](_0x397471);});})[_0xdf70('0xb')](function(_0x1fec75){logger[_0xdf70('0xc')]('GetContactRecallMe',_0x4d243a);logger['debug'](_0xdf70('0x42'),_0x4d243a,JSON['stringify'](_0x1fec75));_0x296b41(_0x1fec75);})[_0xdf70('0x15')](function(_0x58716f){logger[_0xdf70('0x11')]('GetContactRecallMe',_0x58716f['message'],_0x4d243a);_0x34fe2f(_0x21ef2d[_0xdf70('0x11')](0x1f4,_0x58716f[_0xdf70('0x13')]));});});});};exports[_0xdf70('0x45')]=function(_0x327f55){var _0x1d8b4c=this;return new Promise(function(_0x3fced7,_0x554042){db[_0xdf70('0x2a')][_0xdf70('0x43')]()['then'](function(_0x379035){return db['CmHopper']['findAll']({'raw':_0x327f55[_0xdf70('0x16')]?_0x327f55[_0xdf70('0x16')][_0xdf70('0x17')]===undefined?!![]:![]:!![],'where':_0x327f55[_0xdf70('0x16')]?_0x327f55[_0xdf70('0x16')][_0xdf70('0x18')]||null:null,'attributes':_0x327f55[_0xdf70('0x16')]?_0x327f55[_0xdf70('0x16')][_0xdf70('0x19')]||null:null,'limit':_0x327f55[_0xdf70('0x16')]?_0x327f55[_0xdf70('0x16')]['limit']||null:null,'include':_0x327f55[_0xdf70('0x16')]?_0x327f55['options'][_0xdf70('0x1b')]?_[_0xdf70('0x1d')](_0x327f55[_0xdf70('0x16')][_0xdf70('0x1b')],function(_0x1c5ed7){return{'model':db[_0x1c5ed7['model']],'as':_0x1c5ed7['as'],'attributes':_0x1c5ed7['as']===_0xdf70('0x46')?_[_0xdf70('0x30')](_0x379035):_0x1c5ed7[_0xdf70('0x19')],'include':_0x1c5ed7[_0xdf70('0x1b')]?_[_0xdf70('0x1d')](_0x1c5ed7[_0xdf70('0x1b')],function(_0x122f7d){return{'model':db[_0x122f7d[_0xdf70('0x1c')]],'as':_0x122f7d['as'],'attributes':_0x122f7d[_0xdf70('0x19')],'include':_0x122f7d[_0xdf70('0x1b')]?_['map'](_0x122f7d[_0xdf70('0x1b')],function(_0x1a86c3){return{'model':db[_0x1a86c3[_0xdf70('0x1c')]],'as':_0x1a86c3['as'],'attributes':_0x1a86c3[_0xdf70('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdf70('0xb')](function(_0x164a05){logger[_0xdf70('0xc')]('GetCmHopper',_0x327f55);logger[_0xdf70('0x1f')](_0xdf70('0x1e'),_0x327f55,JSON[_0xdf70('0x10')](_0x164a05));_0x3fced7(_0x164a05);})[_0xdf70('0x15')](function(_0x3bf0ac){logger[_0xdf70('0x11')](_0xdf70('0x1e'),_0x3bf0ac[_0xdf70('0x13')],_0x327f55);_0x554042(_0x1d8b4c['error'](0x1f4,_0x3bf0ac[_0xdf70('0x13')]));});});});}; \ No newline at end of file +var _0x66e3=['UpdateCmHopper','update','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','order','LOCK','UPDATE','Contact','User','name','voicePause','length','includes','UserId','push','all','MoveContactManagedDialer','sequelize','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','keys','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','GetCmHopper','ShowCmHopper','find','create','body','CreateCmHopper'];(function(_0x2136b4,_0x4a3b75){var _0x479607=function(_0x4e1e0b){while(--_0x4e1e0b){_0x2136b4['push'](_0x2136b4['shift']());}};_0x479607(++_0x4a3b75);}(_0x66e3,0x183));var _0x366e=function(_0x397279,_0x18ae76){_0x397279=_0x397279-0x0;var _0x18fc9b=_0x66e3[_0x397279];return _0x18fc9b;};'use strict';var _=require(_0x366e('0x0'));var util=require(_0x366e('0x1'));var moment=require(_0x366e('0x2'));var BPromise=require('bluebird');var rs=require(_0x366e('0x3'));var fs=require('fs');var Redis=require(_0x366e('0x4'));var db=require(_0x366e('0x5'))['db'];var utils=require(_0x366e('0x6'));var logger=require(_0x366e('0x7'))(_0x366e('0x8'));var config=require(_0x366e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x366e('0xa')][_0x366e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x555af6,_0x4758e9,_0x5b39f9){return new BPromise(function(_0x314ca4,_0x1634c7){return client['request'](_0x555af6,_0x5b39f9)['then'](function(_0x45bc01){logger[_0x366e('0xc')](_0x366e('0xd'),_0x4758e9,_0x366e('0xe'));logger[_0x366e('0xf')](_0x366e('0x10'),_0x4758e9,_0x366e('0xe'),JSON[_0x366e('0x11')](_0x45bc01));if(_0x45bc01[_0x366e('0x12')]){if(_0x45bc01[_0x366e('0x12')]['code']===0x1f4){logger[_0x366e('0x12')](_0x366e('0xd'),_0x4758e9,_0x45bc01[_0x366e('0x12')][_0x366e('0x13')]);return _0x1634c7(_0x45bc01[_0x366e('0x12')][_0x366e('0x13')]);}logger[_0x366e('0x12')]('CmHopper,\x20%s,\x20%s',_0x4758e9,_0x45bc01['error'][_0x366e('0x13')]);return _0x314ca4(_0x45bc01[_0x366e('0x12')][_0x366e('0x13')]);}else{logger[_0x366e('0xc')](_0x366e('0xd'),_0x4758e9,_0x366e('0xe'));_0x314ca4(_0x45bc01[_0x366e('0x14')]['message']);}})[_0x366e('0x15')](function(_0x77c13){logger[_0x366e('0x12')](_0x366e('0xd'),_0x4758e9,_0x77c13);_0x1634c7(_0x77c13);});});}exports['GetCmHopper']=function(_0x2010c2){var _0x5dbd5f=this;return new Promise(function(_0x2426f4,_0x506351){return db[_0x366e('0x16')][_0x366e('0x17')]({'raw':_0x2010c2['options']?_0x2010c2[_0x366e('0x18')][_0x366e('0x19')]===undefined?!![]:![]:!![],'where':_0x2010c2[_0x366e('0x18')]?_0x2010c2[_0x366e('0x18')][_0x366e('0x1a')]||null:null,'attributes':_0x2010c2['options']?_0x2010c2['options'][_0x366e('0x1b')]||null:null,'limit':_0x2010c2['options']?_0x2010c2['options'][_0x366e('0x1c')]||null:null,'include':_0x2010c2['options']?_0x2010c2[_0x366e('0x18')][_0x366e('0x1d')]?_[_0x366e('0x1e')](_0x2010c2[_0x366e('0x18')][_0x366e('0x1d')],function(_0xb45ddf){return{'model':db[_0xb45ddf['model']],'as':_0xb45ddf['as'],'attributes':_0xb45ddf[_0x366e('0x1b')],'include':_0xb45ddf['include']?_[_0x366e('0x1e')](_0xb45ddf[_0x366e('0x1d')],function(_0x39ebb6){return{'model':db[_0x39ebb6[_0x366e('0x1f')]],'as':_0x39ebb6['as'],'attributes':_0x39ebb6['attributes'],'include':_0x39ebb6[_0x366e('0x1d')]?_['map'](_0x39ebb6['include'],function(_0x32cd60){return{'model':db[_0x32cd60['model']],'as':_0x32cd60['as'],'attributes':_0x32cd60[_0x366e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x366e('0x20')](function(_0x9c44e1){logger['info'](_0x366e('0x21'),_0x2010c2);logger['debug']('GetCmHopper',_0x2010c2,JSON[_0x366e('0x11')](_0x9c44e1));_0x2426f4(_0x9c44e1);})[_0x366e('0x15')](function(_0x45935d){logger['error']('GetCmHopper',_0x45935d[_0x366e('0x13')],_0x2010c2);_0x506351(_0x5dbd5f[_0x366e('0x12')](0x1f4,_0x45935d[_0x366e('0x13')]));});});};exports[_0x366e('0x22')]=function(_0x3a0aa2){var _0x1dbd3e=this;return new Promise(function(_0xc6a462,_0x23002a){return db[_0x366e('0x16')][_0x366e('0x23')]({'raw':_0x3a0aa2[_0x366e('0x18')]?_0x3a0aa2['options'][_0x366e('0x19')]===undefined?!![]:![]:!![],'where':_0x3a0aa2['options']?_0x3a0aa2[_0x366e('0x18')][_0x366e('0x1a')]||null:null,'attributes':_0x3a0aa2['options']?_0x3a0aa2['options']['attributes']||null:null,'include':_0x3a0aa2[_0x366e('0x18')]?_0x3a0aa2[_0x366e('0x18')][_0x366e('0x1d')]?_[_0x366e('0x1e')](_0x3a0aa2[_0x366e('0x18')][_0x366e('0x1d')],function(_0x34d8c3){return{'model':db[_0x34d8c3[_0x366e('0x1f')]],'as':_0x34d8c3['as'],'attributes':_0x34d8c3[_0x366e('0x1b')],'include':_0x34d8c3[_0x366e('0x1d')]?_['map'](_0x34d8c3[_0x366e('0x1d')],function(_0x7459f3){return{'model':db[_0x7459f3[_0x366e('0x1f')]],'as':_0x7459f3['as'],'attributes':_0x7459f3['attributes'],'include':_0x7459f3['include']?_[_0x366e('0x1e')](_0x7459f3[_0x366e('0x1d')],function(_0x369910){return{'model':db[_0x369910[_0x366e('0x1f')]],'as':_0x369910['as'],'attributes':_0x369910['attributes']};}):[]};}):[]};}):[]:[]})[_0x366e('0x20')](function(_0x17cf1a){logger[_0x366e('0xc')]('ShowCmHopper',_0x3a0aa2);logger[_0x366e('0xf')]('ShowCmHopper',_0x3a0aa2,JSON[_0x366e('0x11')](_0x17cf1a));_0xc6a462(_0x17cf1a);})[_0x366e('0x15')](function(_0x41514b){logger[_0x366e('0x12')](_0x366e('0x22'),_0x41514b[_0x366e('0x13')],_0x3a0aa2);_0x23002a(_0x1dbd3e[_0x366e('0x12')](0x1f4,_0x41514b[_0x366e('0x13')]));});});};exports['CreateCmHopper']=function(_0xd939d2){var _0x533326=this;return new Promise(function(_0x3462f7,_0x4a50c1){return db[_0x366e('0x16')][_0x366e('0x24')](_0xd939d2[_0x366e('0x25')],{'raw':_0xd939d2['options']?_0xd939d2[_0x366e('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x366e('0x20')](function(_0x33071f){logger[_0x366e('0xc')](_0x366e('0x26'),_0xd939d2);logger[_0x366e('0xf')](_0x366e('0x26'),_0xd939d2,JSON[_0x366e('0x11')](_0x33071f));_0x3462f7(_0x33071f);})[_0x366e('0x15')](function(_0x44e52c){logger['error'](_0x366e('0x26'),_0x44e52c[_0x366e('0x13')],_0xd939d2);_0x4a50c1(_0x533326[_0x366e('0x12')](0x1f4,_0x44e52c[_0x366e('0x13')]));});});};exports[_0x366e('0x27')]=function(_0x52aa83){var _0x2f61c9=this;return new Promise(function(_0x24f0e0,_0x21db06){return db[_0x366e('0x16')][_0x366e('0x28')](_0x52aa83['body'],{'raw':_0x52aa83[_0x366e('0x18')]?_0x52aa83[_0x366e('0x18')][_0x366e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52aa83[_0x366e('0x18')]?_0x52aa83[_0x366e('0x18')]['where']||null:null,'attributes':_0x52aa83[_0x366e('0x18')]?_0x52aa83[_0x366e('0x18')][_0x366e('0x1b')]||null:null,'limit':_0x52aa83[_0x366e('0x18')]?_0x52aa83[_0x366e('0x18')][_0x366e('0x1c')]||null:null})[_0x366e('0x20')](function(_0x451626){logger[_0x366e('0xc')](_0x366e('0x27'),_0x52aa83);logger[_0x366e('0xf')](_0x366e('0x27'),_0x52aa83,JSON['stringify'](_0x451626));_0x24f0e0(_0x451626);})[_0x366e('0x15')](function(_0x31ec2a){logger['error'](_0x366e('0x27'),_0x31ec2a[_0x366e('0x13')],_0x52aa83);_0x21db06(_0x2f61c9['error'](0x1f4,_0x31ec2a[_0x366e('0x13')]));});});};exports['DestroyCmHopper']=function(_0x32633a){var _0x3f41ec=this;return new Promise(function(_0x4defbb,_0x477b06){return db[_0x366e('0x16')][_0x366e('0x29')]({'where':_0x32633a[_0x366e('0x18')]?_0x32633a[_0x366e('0x18')]['where']||null:null})[_0x366e('0x20')](function(_0x416922){logger[_0x366e('0xc')](_0x366e('0x2a'),_0x32633a);logger[_0x366e('0xf')](_0x366e('0x2a'),_0x32633a,JSON[_0x366e('0x11')](_0x416922));_0x4defbb(_0x416922);})['catch'](function(_0x57dfdd){logger[_0x366e('0x12')](_0x366e('0x2a'),_0x57dfdd[_0x366e('0x13')],_0x32633a);_0x477b06(_0x3f41ec[_0x366e('0x12')](0x1f4,_0x57dfdd[_0x366e('0x13')]));});});};exports[_0x366e('0x2b')]=function(_0xd5ee73){var _0x165212=this;return new Promise(function(_0x60b02b,_0x4b17e8){return db[_0x366e('0x2c')][_0x366e('0x2d')]()[_0x366e('0x20')](function(_0xafd1be){return db['sequelize']['transaction'](function(_0x4e515d){return db[_0x366e('0x16')][_0x366e('0x17')]({'where':_0xd5ee73['options']?_0xd5ee73[_0x366e('0x18')][_0x366e('0x1a')]||null:null,'attributes':_0xd5ee73[_0x366e('0x18')]?_0xd5ee73[_0x366e('0x18')][_0x366e('0x1b')]||null:null,'limit':_0xd5ee73[_0x366e('0x18')]?_0xd5ee73[_0x366e('0x18')][_0x366e('0x1c')]||null:null,'order':_0xd5ee73[_0x366e('0x18')]?_0xd5ee73[_0x366e('0x18')][_0x366e('0x2e')]||null:null,'transaction':_0x4e515d,'lock':_0x4e515d[_0x366e('0x2f')][_0x366e('0x30')],'include':[{'model':db['CmContact'],'as':_0x366e('0x31'),'attributes':_['keys'](_0xafd1be)},{'model':db[_0x366e('0x32')],'as':'Agent','attributes':['id',_0x366e('0x33'),_0x366e('0x34')]}]})['then'](function(_0x16f373){var _0x17b8dc=[];var _0x1f1cf6=[];for(var _0x3d8f81=0x0;_0x3d8f81<_0x16f373[_0x366e('0x35')];_0x3d8f81+=0x1){if(!_0x1f1cf6[_0x366e('0x36')](_0x16f373[_0x3d8f81][_0x366e('0x37')])){_0x1f1cf6['push'](_0x16f373[_0x3d8f81][_0x366e('0x37')]);_0x17b8dc[_0x366e('0x38')](_0x16f373[_0x3d8f81][_0x366e('0x28')](_0xd5ee73[_0x366e('0x25')],{'transaction':_0x4e515d}));}}return BPromise[_0x366e('0x39')](_0x17b8dc);});})[_0x366e('0x20')](function(_0x4e27a4){logger['info'](_0x366e('0x2b'),_0xd5ee73);logger[_0x366e('0xf')](_0x366e('0x2b'),_0xd5ee73,JSON[_0x366e('0x11')](_0x4e27a4));_0x60b02b(_0x4e27a4);})['catch'](function(_0x43f32d){logger[_0x366e('0x12')](_0x366e('0x2b'),_0x43f32d['message'],_0xd5ee73);_0x4b17e8(_0x165212[_0x366e('0x12')](0x1f4,_0x43f32d[_0x366e('0x13')]));});});});};exports[_0x366e('0x3a')]=function(_0x542022){var _0x434659=this;return new Promise(function(_0x297d4e,_0x1e3d80){return db[_0x366e('0x3b')]['transaction'](function(_0x783465){return db['CmHopperFinal'][_0x366e('0x24')](_0x542022[_0x366e('0x25')],{'raw':_0x542022[_0x366e('0x18')]?_0x542022[_0x366e('0x18')]['raw']===undefined?!![]:![]:!![],'transaction':_0x783465})[_0x366e('0x20')](function(){return db[_0x366e('0x16')][_0x366e('0x29')]({'where':_0x542022[_0x366e('0x18')]?_0x542022[_0x366e('0x18')][_0x366e('0x1a')]||null:null,'transaction':_0x783465});});})[_0x366e('0x20')](function(_0x40602c){logger[_0x366e('0xc')](_0x366e('0x3a'),_0x542022);logger[_0x366e('0xf')]('MoveContactManagedDialer',_0x542022,JSON[_0x366e('0x11')](_0x40602c));_0x297d4e(_0x40602c);})[_0x366e('0x15')](function(_0x4bc75c){logger['error'](_0x366e('0x3a'),_0x4bc75c[_0x366e('0x13')],_0x542022);_0x1e3d80(_0x434659['error'](0x1f4,_0x4bc75c[_0x366e('0x13')]));});});};exports[_0x366e('0x3c')]=function(_0x1ab475){var _0x4cb691=this;return new Promise(function(_0x50dd2f,_0x135cd9){return db['CmHopper']['findAll']({'raw':_0x1ab475['options']?_0x1ab475[_0x366e('0x18')][_0x366e('0x19')]===undefined?!![]:![]:!![],'where':_0x1ab475[_0x366e('0x18')]?_0x1ab475['options'][_0x366e('0x1a')]||null:null,'attributes':[[db[_0x366e('0x3b')]['fn'](_0x366e('0x3d'),db[_0x366e('0x3b')]['fn']('IF',db[_0x366e('0x3b')][_0x366e('0x3e')](_0x366e('0x3f')+util[_0x366e('0x40')]('\x22%s\x22',moment()[_0x366e('0x40')](_0x366e('0x41')))+_0x366e('0x42')))),_0x366e('0x43')]]})[_0x366e('0x20')](function(_0x4ea4da){logger[_0x366e('0xc')](_0x366e('0x3c'),_0x1ab475);logger[_0x366e('0xf')]('CountReScheduled',_0x1ab475,JSON['stringify'](_0x4ea4da));_0x50dd2f(_0x4ea4da);})['catch'](function(_0xe14fb7){logger[_0x366e('0x12')](_0x366e('0x3c'),_0xe14fb7[_0x366e('0x13')],_0x1ab475);_0x135cd9(_0x4cb691['error'](0x1f4,_0xe14fb7['message']));});});};exports['GetContactRecallMe']=function(_0x582420){var _0x5d808d=this;return new Promise(function(_0x200c13,_0x17240f){return db[_0x366e('0x2c')][_0x366e('0x2d')]()['then'](function(_0x5df93b){return db['sequelize']['transaction'](function(_0x13f547){return db[_0x366e('0x16')][_0x366e('0x17')]({'where':_0x582420[_0x366e('0x18')]?_0x582420['options'][_0x366e('0x1a')]||null:null,'attributes':_0x582420[_0x366e('0x18')]?_0x582420['options'][_0x366e('0x1b')]||null:null,'limit':0x1,'order':_0x582420[_0x366e('0x18')]?_0x582420[_0x366e('0x18')]['order']||null:null,'group':db[_0x366e('0x16')][_0x366e('0x37')],'transaction':_0x13f547,'lock':_0x13f547[_0x366e('0x2f')]['UPDATE'],'include':_0x582420[_0x366e('0x18')]?_0x582420[_0x366e('0x18')]['include']?_['map'](_0x582420['options'][_0x366e('0x1d')],function(_0x6e2f3c){return{'model':db[_0x6e2f3c['model']],'as':_0x6e2f3c['as'],'attributes':_0x6e2f3c[_0x366e('0x1b')],'include':_0x6e2f3c[_0x366e('0x1d')]?_['map'](_0x6e2f3c[_0x366e('0x1d')],function(_0x4e75a5){return{'model':db[_0x4e75a5['model']],'as':_0x4e75a5['as'],'attributes':_0x4e75a5[_0x366e('0x1b')],'include':_0x4e75a5[_0x366e('0x1d')]?_[_0x366e('0x1e')](_0x4e75a5[_0x366e('0x1d')],function(_0x3d0b4b){return{'model':db[_0x3d0b4b['model']],'as':_0x3d0b4b['as'],'attributes':_0x3d0b4b[_0x366e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f957b){var _0x1a90c0=[];for(var _0x4b905d=0x0;_0x4b905d<_0x3f957b['length'];_0x4b905d+=0x1){_0x1a90c0[_0x366e('0x38')](_0x3f957b[_0x4b905d]['update'](_0x582420[_0x366e('0x25')],{'transaction':_0x13f547}));}return BPromise[_0x366e('0x39')](_0x1a90c0);});})[_0x366e('0x20')](function(_0xc38283){logger[_0x366e('0xc')]('GetContactRecallMe',_0x582420);logger['debug'](_0x366e('0x44'),_0x582420,JSON[_0x366e('0x11')](_0xc38283));_0x200c13(_0xc38283);})['catch'](function(_0x44f12f){logger[_0x366e('0x12')](_0x366e('0x44'),_0x44f12f[_0x366e('0x13')],_0x582420);_0x17240f(_0x5d808d[_0x366e('0x12')](0x1f4,_0x44f12f[_0x366e('0x13')]));});});});};exports[_0x366e('0x45')]=function(_0x435742){var _0x3971a9=this;return new Promise(function(_0x1314fa,_0x45a389){db[_0x366e('0x2c')][_0x366e('0x2d')]()['then'](function(_0xb7acd0){return db['CmHopper'][_0x366e('0x17')]({'raw':_0x435742[_0x366e('0x18')]?_0x435742[_0x366e('0x18')][_0x366e('0x19')]===undefined?!![]:![]:!![],'where':_0x435742['options']?_0x435742[_0x366e('0x18')]['where']||null:null,'attributes':_0x435742[_0x366e('0x18')]?_0x435742[_0x366e('0x18')][_0x366e('0x1b')]||null:null,'limit':_0x435742['options']?_0x435742[_0x366e('0x18')]['limit']||null:null,'include':_0x435742[_0x366e('0x18')]?_0x435742[_0x366e('0x18')][_0x366e('0x1d')]?_['map'](_0x435742[_0x366e('0x18')]['include'],function(_0x3cd83d){return{'model':db[_0x3cd83d[_0x366e('0x1f')]],'as':_0x3cd83d['as'],'attributes':_0x3cd83d['as']===_0x366e('0x31')?_[_0x366e('0x46')](_0xb7acd0):_0x3cd83d['attributes'],'include':_0x3cd83d[_0x366e('0x1d')]?_[_0x366e('0x1e')](_0x3cd83d['include'],function(_0xf9134f){return{'model':db[_0xf9134f[_0x366e('0x1f')]],'as':_0xf9134f['as'],'attributes':_0xf9134f[_0x366e('0x1b')],'include':_0xf9134f[_0x366e('0x1d')]?_[_0x366e('0x1e')](_0xf9134f[_0x366e('0x1d')],function(_0x3c9713){return{'model':db[_0x3c9713[_0x366e('0x1f')]],'as':_0x3c9713['as'],'attributes':_0x3c9713[_0x366e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f175f){logger[_0x366e('0xc')](_0x366e('0x21'),_0x435742);logger['debug'](_0x366e('0x21'),_0x435742,JSON[_0x366e('0x11')](_0x2f175f));_0x1314fa(_0x2f175f);})[_0x366e('0x15')](function(_0x11dbd7){logger['error'](_0x366e('0x21'),_0x11dbd7[_0x366e('0x13')],_0x435742);_0x45a389(_0x3971a9['error'](0x1f4,_0x11dbd7[_0x366e('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index deb0204..42e8766 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 _0x2deb=['isAuthenticated','getOpenContacts','show','post','/preview','getPreview','/:id','update','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','index','get','/describe','describe'];(function(_0x48c85d,_0x5c90b2){var _0x194214=function(_0x308964){while(--_0x308964){_0x48c85d['push'](_0x48c85d['shift']());}};_0x194214(++_0x5c90b2);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var path=require(_0xb2de('0x2'));var timeout=require(_0xb2de('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb2de('0x4'));var interaction=require(_0xb2de('0x5'));var config=require(_0xb2de('0x6'));var controller=require(_0xb2de('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb2de('0x8')]);router[_0xb2de('0x9')](_0xb2de('0xa'),auth['isAuthenticated'](),controller[_0xb2de('0xb')]);router[_0xb2de('0x9')]('/opencontacts',auth[_0xb2de('0xc')](),controller[_0xb2de('0xd')]);router[_0xb2de('0x9')]('/:id',auth[_0xb2de('0xc')](),controller[_0xb2de('0xe')]);router[_0xb2de('0xf')]('/',auth[_0xb2de('0xc')](),controller['create']);router['post'](_0xb2de('0x10'),auth[_0xb2de('0xc')](),controller[_0xb2de('0x11')]);router['put'](_0xb2de('0x12'),auth[_0xb2de('0xc')](),controller[_0xb2de('0x13')]);router['delete'](_0xb2de('0x12'),auth['isAuthenticated'](),controller[_0xb2de('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb8a0=['show','post','create','/preview','getPreview','update','delete','destroy','exports','path','connect-timeout','Router','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/:id'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x1d5565,_0x47410d){_0x1d5565=_0x1d5565-0x0;var _0x1c6ec3=_0xb8a0[_0x1d5565];return _0x1c6ec3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0b8a('0x0'));var timeout=require(_0x0b8a('0x1'));var express=require('express');var router=express[_0x0b8a('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopper.controller');router[_0x0b8a('0x3')]('/',auth[_0x0b8a('0x4')](),controller[_0x0b8a('0x5')]);router[_0x0b8a('0x3')](_0x0b8a('0x6'),auth[_0x0b8a('0x4')](),controller[_0x0b8a('0x7')]);router[_0x0b8a('0x3')](_0x0b8a('0x8'),auth[_0x0b8a('0x4')](),controller[_0x0b8a('0x9')]);router[_0x0b8a('0x3')](_0x0b8a('0xa'),auth[_0x0b8a('0x4')](),controller[_0x0b8a('0xb')]);router[_0x0b8a('0xc')]('/',auth[_0x0b8a('0x4')](),controller[_0x0b8a('0xd')]);router[_0x0b8a('0xc')](_0x0b8a('0xe'),auth[_0x0b8a('0x4')](),controller[_0x0b8a('0xf')]);router['put'](_0x0b8a('0xa'),auth[_0x0b8a('0x4')](),controller[_0x0b8a('0x10')]);router[_0x0b8a('0x11')](_0x0b8a('0xa'),auth[_0x0b8a('0x4')](),controller[_0x0b8a('0x12')]);module[_0x0b8a('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 722f085..8647e80 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 _0x96af=['INTEGER','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x4c81b4,_0x1931f){var _0x2e4fa6=function(_0x47d79e){while(--_0x47d79e){_0x4c81b4['push'](_0x4c81b4['shift']());}};_0x2e4fa6(++_0x1931f);}(_0x96af,0x76));var _0xf96a=function(_0x1fd5eb,_0x235203){_0x1fd5eb=_0x1fd5eb-0x0;var _0x102365=_0x96af[_0x1fd5eb];return _0x102365;};'use strict';var moment=require(_0xf96a('0x0'));var Sequelize=require(_0xf96a('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xf96a('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xf96a('0x3'))},'countbusyretry':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5f50=['exports','INTEGER','STRING','DATE','format','moment'];(function(_0xd296dc,_0x3625e9){var _0x1de270=function(_0x5dbfe9){while(--_0x5dbfe9){_0xd296dc['push'](_0xd296dc['shift']());}};_0x1de270(++_0x3625e9);}(_0x5f50,0xb3));var _0x05f5=function(_0x330335,_0x1038b0){_0x330335=_0x330335-0x0;var _0x2a4966=_0x5f50[_0x330335];return _0x2a4966;};'use strict';var moment=require(_0x05f5('0x0'));var Sequelize=require('sequelize');module[_0x05f5('0x1')]={'CmHopperId':{'type':Sequelize[_0x05f5('0x2')]},'phone':{'type':Sequelize[_0x05f5('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x05f5('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x05f5('0x4')],'defaultValue':moment()[_0x05f5('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x05f5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x05f5('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x05f5('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x05f5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x05f5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x05f5('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 5da82ba..c755446 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 _0x9aac=['ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','get','CmHopperAdditionalPhones','destroy','error','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','rows','show','params','includeAll','include','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x52e795,_0x49ffc4){var _0x4baca=function(_0x3b5bd5){while(--_0x3b5bd5){_0x52e795['push'](_0x52e795['shift']());}};_0x4baca(++_0x49ffc4);}(_0x9aac,0x135));var _0xc9aa=function(_0xfaf211,_0xa2b41a){_0xfaf211=_0xfaf211-0x0;var _0x31a98b=_0x9aac[_0xfaf211];return _0x31a98b;};'use strict';var pdf=require(_0xc9aa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc9aa('0x1'));var zipdir=require(_0xc9aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9aa('0x3'));var moment=require('moment');var BPromise=require(_0xc9aa('0x4'));var Mustache=require('mustache');var util=require(_0xc9aa('0x5'));var path=require(_0xc9aa('0x6'));var sox=require('sox');var csv=require(_0xc9aa('0x7'));var ejs=require(_0xc9aa('0x8'));var fs=require('fs');var _=require(_0xc9aa('0x9'));var squel=require('squel');var crypto=require(_0xc9aa('0xa'));var jsforce=require(_0xc9aa('0xb'));var deskjs=require(_0xc9aa('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc9aa('0xd'));var Papa=require(_0xc9aa('0xe'));var Redis=require(_0xc9aa('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc9aa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9aa('0x11'))(_0xc9aa('0x12'));var utils=require(_0xc9aa('0x13'));var config=require(_0xc9aa('0x14'));var licenseUtil=require(_0xc9aa('0x15'));var db=require(_0xc9aa('0x16'))['db'];function respondWithStatusCode(_0x21e9c3,_0x2b38da){_0x2b38da=_0x2b38da||0xcc;return function(_0xfc9acd){if(_0xfc9acd){return _0x21e9c3[_0xc9aa('0x17')](_0x2b38da);}return _0x21e9c3[_0xc9aa('0x18')](_0x2b38da)[_0xc9aa('0x19')]();};}function respondWithResult(_0x39331d,_0x406422){_0x406422=_0x406422||0xc8;return function(_0x2b5708){if(_0x2b5708){return _0x39331d[_0xc9aa('0x18')](_0x406422)[_0xc9aa('0x1a')](_0x2b5708);}};}function respondWithFilteredResult(_0x53834b,_0x129cc1){return function(_0x4ed0c1){if(_0x4ed0c1){var _0x5b351f=_0x4ed0c1[_0xc9aa('0x1b')],_0x477ca5=_0x129cc1['offset'],_0x553805=_0x129cc1[_0xc9aa('0x1c')]+_0x129cc1[_0xc9aa('0x1d')],_0x13ed6c;if(_0x553805>=_0x5b351f){_0x553805=_0x5b351f;_0x13ed6c=0xc8;}else{_0x13ed6c=0xce;}_0x53834b[_0xc9aa('0x18')](_0x13ed6c);return _0x53834b['set'](_0xc9aa('0x1e'),_0x477ca5+'-'+_0x553805+'/'+_0x5b351f)[_0xc9aa('0x1a')](_0x4ed0c1);}return null;};}function patchUpdates(_0x2f29e2){return function(_0x22ad7f){try{jsonpatch[_0xc9aa('0x1f')](_0x22ad7f,_0x2f29e2,!![]);}catch(_0x25be52){return BPromise['reject'](_0x25be52);}return _0x22ad7f[_0xc9aa('0x20')]();};}function saveUpdates(_0x55037f,_0x2c634a){return function(_0x5b5ffc){if(_0x5b5ffc){return _0x5b5ffc[_0xc9aa('0x21')](_0x55037f)['then'](function(_0x15da53){return _0x15da53;});}return null;};}function removeEntity(_0x3f8bfd,_0x214c09){return function(_0x465f52){if(_0x465f52){return _0x465f52['destroy']()[_0xc9aa('0x22')](function(){var _0x122d0c=_0x465f52[_0xc9aa('0x23')]({'plain':!![]});var _0x1b4246=_0xc9aa('0x24');return db['UserProfileResource'][_0xc9aa('0x25')]({'where':{'type':_0x1b4246,'resourceId':_0x122d0c['id']}})[_0xc9aa('0x22')](function(){return _0x465f52;});})[_0xc9aa('0x22')](function(){_0x3f8bfd[_0xc9aa('0x18')](0xcc)[_0xc9aa('0x19')]();});}};}function handleEntityNotFound(_0x13cb3f,_0xee06f1){return function(_0x4dab46){if(!_0x4dab46){_0x13cb3f[_0xc9aa('0x17')](0x194);}return _0x4dab46;};}function handleError(_0x40e628,_0x557b18){_0x557b18=_0x557b18||0x1f4;return function(_0x48c5df){logger[_0xc9aa('0x26')](_0x48c5df[_0xc9aa('0x27')]);if(_0x48c5df[_0xc9aa('0x28')]){delete _0x48c5df[_0xc9aa('0x28')];}_0x40e628[_0xc9aa('0x18')](_0x557b18)[_0xc9aa('0x29')](_0x48c5df);};}exports[_0xc9aa('0x2a')]=function(_0x5865b5,_0x1d1215){var _0x3446aa={},_0x25d3e5={},_0x1bfb09={'count':0x0,'rows':[]};var _0x2934be=_[_0xc9aa('0x2b')](db[_0xc9aa('0x2c')]['rawAttributes'],function(_0x16b293){return{'name':_0x16b293[_0xc9aa('0x2d')],'type':_0x16b293[_0xc9aa('0x2e')][_0xc9aa('0x2f')]};});_0x25d3e5[_0xc9aa('0x30')]=_[_0xc9aa('0x2b')](_0x2934be,_0xc9aa('0x28'));_0x25d3e5[_0xc9aa('0x31')]=_[_0xc9aa('0x32')](_0x5865b5[_0xc9aa('0x31')]);_0x25d3e5[_0xc9aa('0x33')]=_['intersection'](_0x25d3e5['model'],_0x25d3e5[_0xc9aa('0x31')]);_0x3446aa['attributes']=_[_0xc9aa('0x34')](_0x25d3e5[_0xc9aa('0x30')],qs[_0xc9aa('0x35')](_0x5865b5['query'][_0xc9aa('0x35')]));_0x3446aa[_0xc9aa('0x36')]=_0x3446aa['attributes'][_0xc9aa('0x37')]?_0x3446aa[_0xc9aa('0x36')]:_0x25d3e5['model'];if(!_0x5865b5[_0xc9aa('0x31')][_0xc9aa('0x38')](_0xc9aa('0x39'))){_0x3446aa[_0xc9aa('0x1d')]=qs['limit'](_0x5865b5[_0xc9aa('0x31')][_0xc9aa('0x1d')]);_0x3446aa['offset']=qs[_0xc9aa('0x1c')](_0x5865b5[_0xc9aa('0x31')][_0xc9aa('0x1c')]);}_0x3446aa[_0xc9aa('0x3a')]=qs[_0xc9aa('0x3b')](_0x5865b5[_0xc9aa('0x31')]['sort']);_0x3446aa['where']=qs[_0xc9aa('0x33')](_[_0xc9aa('0x3c')](_0x5865b5[_0xc9aa('0x31')],_0x25d3e5[_0xc9aa('0x33')]),_0x2934be);if(_0x5865b5[_0xc9aa('0x31')][_0xc9aa('0x3d')]){_0x3446aa[_0xc9aa('0x3e')]=_['merge'](_0x3446aa[_0xc9aa('0x3e')],{'$or':_[_0xc9aa('0x2b')](_0x2934be,function(_0x213e45){if(_0x213e45[_0xc9aa('0x2e')]!=='VIRTUAL'){var _0x5b91cf={};_0x5b91cf[_0x213e45['name']]={'$like':'%'+_0x5865b5[_0xc9aa('0x31')][_0xc9aa('0x3d')]+'%'};return _0x5b91cf;}})});}_0x3446aa=_[_0xc9aa('0x3f')]({},_0x3446aa,_0x5865b5[_0xc9aa('0x40')]);var _0x14f27e={'where':_0x3446aa[_0xc9aa('0x3e')]};return db[_0xc9aa('0x2c')]['count'](_0x14f27e)[_0xc9aa('0x22')](function(_0x2bf707){_0x1bfb09[_0xc9aa('0x1b')]=_0x2bf707;if(_0x5865b5[_0xc9aa('0x31')]['includeAll']){_0x3446aa['include']=[{'all':!![]}];}return db[_0xc9aa('0x2c')]['findAll'](_0x3446aa);})[_0xc9aa('0x22')](function(_0x3581ae){_0x1bfb09[_0xc9aa('0x41')]=_0x3581ae;return _0x1bfb09;})[_0xc9aa('0x22')](respondWithFilteredResult(_0x1d1215,_0x3446aa))['catch'](handleError(_0x1d1215,null));};exports[_0xc9aa('0x42')]=function(_0x59006b,_0x2990f0){var _0x4692e3={'raw':!![],'where':{'id':_0x59006b[_0xc9aa('0x43')]['id']}},_0x407d74={};_0x407d74[_0xc9aa('0x30')]=_['keys'](db[_0xc9aa('0x2c')]['rawAttributes']);_0x407d74[_0xc9aa('0x31')]=_[_0xc9aa('0x32')](_0x59006b[_0xc9aa('0x31')]);_0x407d74[_0xc9aa('0x33')]=_[_0xc9aa('0x34')](_0x407d74[_0xc9aa('0x30')],_0x407d74[_0xc9aa('0x31')]);_0x4692e3['attributes']=_['intersection'](_0x407d74[_0xc9aa('0x30')],qs['fields'](_0x59006b[_0xc9aa('0x31')]['fields']));_0x4692e3[_0xc9aa('0x36')]=_0x4692e3[_0xc9aa('0x36')][_0xc9aa('0x37')]?_0x4692e3[_0xc9aa('0x36')]:_0x407d74[_0xc9aa('0x30')];if(_0x59006b[_0xc9aa('0x31')][_0xc9aa('0x44')]){_0x4692e3[_0xc9aa('0x45')]=[{'all':!![]}];}_0x4692e3=_[_0xc9aa('0x3f')]({},_0x4692e3,_0x59006b[_0xc9aa('0x40')]);return db[_0xc9aa('0x2c')][_0xc9aa('0x46')](_0x4692e3)['then'](handleEntityNotFound(_0x2990f0,null))[_0xc9aa('0x22')](respondWithResult(_0x2990f0,null))[_0xc9aa('0x47')](handleError(_0x2990f0,null));};exports[_0xc9aa('0x48')]=function(_0x505f37,_0x503730){return db['CmHopperAdditionalPhone']['create'](_0x505f37['body'],{})['then'](function(_0x53f5f1){var _0x44c5db=_0x505f37[_0xc9aa('0x49')][_0xc9aa('0x23')]({'plain':!![]});if(!_0x44c5db)throw new Error(_0xc9aa('0x4a'));if(_0x44c5db[_0xc9aa('0x4b')]===_0xc9aa('0x49')){var _0x4324d2=_0x53f5f1[_0xc9aa('0x23')]({'plain':!![]});var _0x4b8173=_0xc9aa('0x24');return db[_0xc9aa('0x4c')][_0xc9aa('0x46')]({'where':{'name':_0x4b8173,'userProfileId':_0x44c5db['userProfileId']},'raw':!![]})[_0xc9aa('0x22')](function(_0x2965ae){if(_0x2965ae&&_0x2965ae[_0xc9aa('0x4d')]===0x0){return db[_0xc9aa('0x4e')]['create']({'name':_0x4324d2['name'],'resourceId':_0x4324d2['id'],'type':_0x2965ae[_0xc9aa('0x28')],'sectionId':_0x2965ae['id']},{})[_0xc9aa('0x22')](function(){return _0x53f5f1;});}else{return _0x53f5f1;}})[_0xc9aa('0x47')](function(_0x1c78cb){logger[_0xc9aa('0x26')](_0xc9aa('0x4f'),_0x1c78cb);throw _0x1c78cb;});}return _0x53f5f1;})[_0xc9aa('0x22')](respondWithResult(_0x503730,0xc9))['catch'](handleError(_0x503730,null));};exports['update']=function(_0x15f8ce,_0x4ed597){if(_0x15f8ce[_0xc9aa('0x50')]['id']){delete _0x15f8ce[_0xc9aa('0x50')]['id'];}return db[_0xc9aa('0x2c')][_0xc9aa('0x46')]({'where':{'id':_0x15f8ce['params']['id']}})['then'](handleEntityNotFound(_0x4ed597,null))[_0xc9aa('0x22')](saveUpdates(_0x15f8ce[_0xc9aa('0x50')],null))['then'](respondWithResult(_0x4ed597,null))[_0xc9aa('0x47')](handleError(_0x4ed597,null));};exports[_0xc9aa('0x25')]=function(_0x14170d,_0x3c995b){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x14170d[_0xc9aa('0x43')]['id']}})[_0xc9aa('0x22')](handleEntityNotFound(_0x3c995b,null))[_0xc9aa('0x22')](removeEntity(_0x3c995b,null))[_0xc9aa('0x47')](handleError(_0x3c995b,null));}; \ No newline at end of file +var _0x5a63=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','error','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','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','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','ejs','squel','jsforce','to-csv','querystring'];(function(_0x10f82c,_0x4f46a8){var _0x5abc62=function(_0x18d82a){while(--_0x18d82a){_0x10f82c['push'](_0x10f82c['shift']());}};_0x5abc62(++_0x4f46a8);}(_0x5a63,0xe3));var _0x35a6=function(_0x3b4cf1,_0x5399c2){_0x3b4cf1=_0x3b4cf1-0x0;var _0x5a5763=_0x5a63[_0x3b4cf1];return _0x5a5763;};'use strict';var pdf=require(_0x35a6('0x0'));var emlformat=require(_0x35a6('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x35a6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x35a6('0x3'));var Mustache=require(_0x35a6('0x4'));var util=require(_0x35a6('0x5'));var path=require(_0x35a6('0x6'));var sox=require(_0x35a6('0x7'));var csv=require('to-csv');var ejs=require(_0x35a6('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x35a6('0x9'));var crypto=require('crypto');var jsforce=require(_0x35a6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x35a6('0xb'));var querystring=require(_0x35a6('0xc'));var Papa=require(_0x35a6('0xd'));var Redis=require(_0x35a6('0xe'));var authService=require(_0x35a6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x35a6('0x10'));var hardwareService=require(_0x35a6('0x11'));var logger=require(_0x35a6('0x12'))('api');var utils=require(_0x35a6('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x35a6('0x14'));var db=require(_0x35a6('0x15'))['db'];function respondWithStatusCode(_0x2baa42,_0x20593b){_0x20593b=_0x20593b||0xcc;return function(_0x617ea0){if(_0x617ea0){return _0x2baa42['sendStatus'](_0x20593b);}return _0x2baa42[_0x35a6('0x16')](_0x20593b)[_0x35a6('0x17')]();};}function respondWithResult(_0x2e6d86,_0x21f7c1){_0x21f7c1=_0x21f7c1||0xc8;return function(_0x250c7){if(_0x250c7){return _0x2e6d86[_0x35a6('0x16')](_0x21f7c1)['json'](_0x250c7);}};}function respondWithFilteredResult(_0x32347a,_0x40c1be){return function(_0x313380){if(_0x313380){var _0x474e34=_0x313380[_0x35a6('0x18')],_0x167245=_0x40c1be[_0x35a6('0x19')],_0x3f0da7=_0x40c1be[_0x35a6('0x19')]+_0x40c1be[_0x35a6('0x1a')],_0x502b5e;if(_0x3f0da7>=_0x474e34){_0x3f0da7=_0x474e34;_0x502b5e=0xc8;}else{_0x502b5e=0xce;}_0x32347a[_0x35a6('0x16')](_0x502b5e);return _0x32347a[_0x35a6('0x1b')](_0x35a6('0x1c'),_0x167245+'-'+_0x3f0da7+'/'+_0x474e34)['json'](_0x313380);}return null;};}function patchUpdates(_0x155e92){return function(_0xbedcb7){try{jsonpatch[_0x35a6('0x1d')](_0xbedcb7,_0x155e92,!![]);}catch(_0x5d82c0){return BPromise[_0x35a6('0x1e')](_0x5d82c0);}return _0xbedcb7[_0x35a6('0x1f')]();};}function saveUpdates(_0x3183eb,_0x4a68b6){return function(_0x1e2203){if(_0x1e2203){return _0x1e2203[_0x35a6('0x20')](_0x3183eb)['then'](function(_0x381c3d){return _0x381c3d;});}return null;};}function removeEntity(_0x146eca,_0x4b3b00){return function(_0x492be8){if(_0x492be8){return _0x492be8[_0x35a6('0x21')]()[_0x35a6('0x22')](function(){var _0x3f1c73=_0x492be8[_0x35a6('0x23')]({'plain':!![]});var _0x643a2a=_0x35a6('0x24');return db[_0x35a6('0x25')][_0x35a6('0x21')]({'where':{'type':_0x643a2a,'resourceId':_0x3f1c73['id']}})[_0x35a6('0x22')](function(){return _0x492be8;});})[_0x35a6('0x22')](function(){_0x146eca[_0x35a6('0x16')](0xcc)[_0x35a6('0x17')]();});}};}function handleEntityNotFound(_0x5e9a69,_0x361e8b){return function(_0x3634f5){if(!_0x3634f5){_0x5e9a69['sendStatus'](0x194);}return _0x3634f5;};}function handleError(_0x55a867,_0x27703d){_0x27703d=_0x27703d||0x1f4;return function(_0x287c0b){logger[_0x35a6('0x26')](_0x287c0b['stack']);if(_0x287c0b[_0x35a6('0x27')]){delete _0x287c0b[_0x35a6('0x27')];}_0x55a867[_0x35a6('0x16')](_0x27703d)[_0x35a6('0x28')](_0x287c0b);};}exports['index']=function(_0x12f2ec,_0x386235){var _0x1bdbe2={},_0xc5d9fc={},_0x4bff73={'count':0x0,'rows':[]};var _0x5d5639=_[_0x35a6('0x29')](db[_0x35a6('0x2a')][_0x35a6('0x2b')],function(_0x2a0719){return{'name':_0x2a0719[_0x35a6('0x2c')],'type':_0x2a0719[_0x35a6('0x2d')][_0x35a6('0x2e')]};});_0xc5d9fc[_0x35a6('0x2f')]=_[_0x35a6('0x29')](_0x5d5639,'name');_0xc5d9fc[_0x35a6('0x30')]=_[_0x35a6('0x31')](_0x12f2ec[_0x35a6('0x30')]);_0xc5d9fc[_0x35a6('0x32')]=_[_0x35a6('0x33')](_0xc5d9fc['model'],_0xc5d9fc[_0x35a6('0x30')]);_0x1bdbe2[_0x35a6('0x34')]=_['intersection'](_0xc5d9fc[_0x35a6('0x2f')],qs[_0x35a6('0x35')](_0x12f2ec[_0x35a6('0x30')][_0x35a6('0x35')]));_0x1bdbe2[_0x35a6('0x34')]=_0x1bdbe2[_0x35a6('0x34')][_0x35a6('0x36')]?_0x1bdbe2[_0x35a6('0x34')]:_0xc5d9fc[_0x35a6('0x2f')];if(!_0x12f2ec[_0x35a6('0x30')][_0x35a6('0x37')](_0x35a6('0x38'))){_0x1bdbe2[_0x35a6('0x1a')]=qs[_0x35a6('0x1a')](_0x12f2ec['query']['limit']);_0x1bdbe2[_0x35a6('0x19')]=qs['offset'](_0x12f2ec[_0x35a6('0x30')][_0x35a6('0x19')]);}_0x1bdbe2[_0x35a6('0x39')]=qs['sort'](_0x12f2ec['query'][_0x35a6('0x3a')]);_0x1bdbe2[_0x35a6('0x3b')]=qs[_0x35a6('0x32')](_[_0x35a6('0x3c')](_0x12f2ec[_0x35a6('0x30')],_0xc5d9fc[_0x35a6('0x32')]),_0x5d5639);if(_0x12f2ec[_0x35a6('0x30')][_0x35a6('0x3d')]){_0x1bdbe2['where']=_[_0x35a6('0x3e')](_0x1bdbe2[_0x35a6('0x3b')],{'$or':_['map'](_0x5d5639,function(_0x5c431e){if(_0x5c431e[_0x35a6('0x2d')]!=='VIRTUAL'){var _0x3c3e7d={};_0x3c3e7d[_0x5c431e[_0x35a6('0x27')]]={'$like':'%'+_0x12f2ec[_0x35a6('0x30')]['filter']+'%'};return _0x3c3e7d;}})});}_0x1bdbe2=_[_0x35a6('0x3e')]({},_0x1bdbe2,_0x12f2ec[_0x35a6('0x3f')]);var _0xa582a0={'where':_0x1bdbe2[_0x35a6('0x3b')]};return db[_0x35a6('0x2a')]['count'](_0xa582a0)['then'](function(_0x47e819){_0x4bff73['count']=_0x47e819;if(_0x12f2ec['query'][_0x35a6('0x40')]){_0x1bdbe2[_0x35a6('0x41')]=[{'all':!![]}];}return db[_0x35a6('0x2a')][_0x35a6('0x42')](_0x1bdbe2);})[_0x35a6('0x22')](function(_0x57bcc2){_0x4bff73['rows']=_0x57bcc2;return _0x4bff73;})[_0x35a6('0x22')](respondWithFilteredResult(_0x386235,_0x1bdbe2))['catch'](handleError(_0x386235,null));};exports[_0x35a6('0x43')]=function(_0x1cbde5,_0x341520){var _0x3047a6={'raw':!![],'where':{'id':_0x1cbde5[_0x35a6('0x44')]['id']}},_0x57ee4a={};_0x57ee4a[_0x35a6('0x2f')]=_[_0x35a6('0x31')](db[_0x35a6('0x2a')]['rawAttributes']);_0x57ee4a[_0x35a6('0x30')]=_[_0x35a6('0x31')](_0x1cbde5[_0x35a6('0x30')]);_0x57ee4a[_0x35a6('0x32')]=_[_0x35a6('0x33')](_0x57ee4a[_0x35a6('0x2f')],_0x57ee4a[_0x35a6('0x30')]);_0x3047a6[_0x35a6('0x34')]=_[_0x35a6('0x33')](_0x57ee4a['model'],qs[_0x35a6('0x35')](_0x1cbde5[_0x35a6('0x30')][_0x35a6('0x35')]));_0x3047a6[_0x35a6('0x34')]=_0x3047a6[_0x35a6('0x34')][_0x35a6('0x36')]?_0x3047a6[_0x35a6('0x34')]:_0x57ee4a[_0x35a6('0x2f')];if(_0x1cbde5[_0x35a6('0x30')][_0x35a6('0x40')]){_0x3047a6[_0x35a6('0x41')]=[{'all':!![]}];}_0x3047a6=_[_0x35a6('0x3e')]({},_0x3047a6,_0x1cbde5[_0x35a6('0x3f')]);return db[_0x35a6('0x2a')][_0x35a6('0x45')](_0x3047a6)[_0x35a6('0x22')](handleEntityNotFound(_0x341520,null))[_0x35a6('0x22')](respondWithResult(_0x341520,null))[_0x35a6('0x46')](handleError(_0x341520,null));};exports[_0x35a6('0x47')]=function(_0x3c36da,_0x3d80c4){return db[_0x35a6('0x2a')]['create'](_0x3c36da[_0x35a6('0x48')],{})[_0x35a6('0x22')](function(_0x1ac050){var _0x29062e=_0x3c36da[_0x35a6('0x49')][_0x35a6('0x23')]({'plain':!![]});if(!_0x29062e)throw new Error(_0x35a6('0x4a'));if(_0x29062e[_0x35a6('0x4b')]===_0x35a6('0x49')){var _0x75ddbf=_0x1ac050[_0x35a6('0x23')]({'plain':!![]});var _0x31bbd7='CmHopperAdditionalPhones';return db[_0x35a6('0x4c')]['find']({'where':{'name':_0x31bbd7,'userProfileId':_0x29062e[_0x35a6('0x4d')]},'raw':!![]})[_0x35a6('0x22')](function(_0x3e8206){if(_0x3e8206&&_0x3e8206[_0x35a6('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x75ddbf['name'],'resourceId':_0x75ddbf['id'],'type':_0x3e8206[_0x35a6('0x27')],'sectionId':_0x3e8206['id']},{})['then'](function(){return _0x1ac050;});}else{return _0x1ac050;}})['catch'](function(_0x27cd76){logger[_0x35a6('0x26')](_0x35a6('0x4f'),_0x27cd76);throw _0x27cd76;});}return _0x1ac050;})['then'](respondWithResult(_0x3d80c4,0xc9))[_0x35a6('0x46')](handleError(_0x3d80c4,null));};exports[_0x35a6('0x20')]=function(_0x3573f5,_0x5b744b){if(_0x3573f5['body']['id']){delete _0x3573f5[_0x35a6('0x48')]['id'];}return db[_0x35a6('0x2a')][_0x35a6('0x45')]({'where':{'id':_0x3573f5[_0x35a6('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b744b,null))[_0x35a6('0x22')](saveUpdates(_0x3573f5[_0x35a6('0x48')],null))[_0x35a6('0x22')](respondWithResult(_0x5b744b,null))[_0x35a6('0x46')](handleError(_0x5b744b,null));};exports['destroy']=function(_0x2e8ea0,_0x494ea2){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x2e8ea0['params']['id']}})[_0x35a6('0x22')](handleEntityNotFound(_0x494ea2,null))[_0x35a6('0x22')](removeEntity(_0x494ea2,null))[_0x35a6('0x46')](handleError(_0x494ea2,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 17e547f..ab4caf2 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 _0xd54e=['./cmHopperAdditionalPhone.attributes','define','cm_hopper_additional_phones','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xd54e,0x161));var _0xed54=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd54e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xed54('0x0'));var util=require('util');var logger=require(_0xed54('0x1'))(_0xed54('0x2'));var moment=require(_0xed54('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xed54('0x4'));var rimraf=require(_0xed54('0x5'));var config=require(_0xed54('0x6'));var attributes=require(_0xed54('0x7'));module['exports']=function(_0x120a87,_0x45a4fe){return _0x120a87[_0xed54('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':_0xed54('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23d2=['CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define'];(function(_0x5c73a6,_0xcc427a){var _0x182979=function(_0x229700){while(--_0x229700){_0x5c73a6['push'](_0x5c73a6['shift']());}};_0x182979(++_0xcc427a);}(_0x23d2,0xd2));var _0x223d=function(_0x46f48a,_0x696cdf){_0x46f48a=_0x46f48a-0x0;var _0x4a3452=_0x23d2[_0x46f48a];return _0x4a3452;};'use strict';var _=require(_0x223d('0x0'));var util=require(_0x223d('0x1'));var logger=require(_0x223d('0x2'))('api');var moment=require(_0x223d('0x3'));var BPromise=require(_0x223d('0x4'));var rp=require(_0x223d('0x5'));var fs=require('fs');var path=require(_0x223d('0x6'));var rimraf=require(_0x223d('0x7'));var config=require(_0x223d('0x8'));var attributes=require(_0x223d('0x9'));module['exports']=function(_0x228919,_0x2caf2e){return _0x228919[_0x223d('0xa')](_0x223d('0xb'),attributes,{'tableName':_0x223d('0xc'),'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 760c526..a7e2c77 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 _0x49a8=['result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countmachineretry','countagentrejectretry','SwapAdditionalPhones','waitTime','add','minutes','scheduledat','phone','isNil','countdropretry','createdAt','hopperToAdd','additionalToHop','sequelize','transaction','update','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info'];(function(_0x28ba30,_0x12c005){var _0x281812=function(_0x12702e){while(--_0x12702e){_0x28ba30['push'](_0x28ba30['shift']());}};_0x281812(++_0x12c005);}(_0x49a8,0xfb));var _0x849a=function(_0x5a1ef6,_0x369ee4){_0x5a1ef6=_0x5a1ef6-0x0;var _0x2af4d9=_0x49a8[_0x5a1ef6];return _0x2af4d9;};'use strict';var _=require(_0x849a('0x0'));var util=require(_0x849a('0x1'));var moment=require('moment');var BPromise=require(_0x849a('0x2'));var rs=require(_0x849a('0x3'));var fs=require('fs');var Redis=require(_0x849a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x849a('0x5'));var logger=require(_0x849a('0x6'))('rpc');var config=require(_0x849a('0x7'));var jayson=require(_0x849a('0x8'));var client=jayson['client'][_0x849a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6be379,_0x2c3793,_0x559966){return new BPromise(function(_0x42082d,_0x48f972){return client[_0x849a('0xa')](_0x6be379,_0x559966)[_0x849a('0xb')](function(_0x4d3cc7){logger['info'](_0x849a('0xc'),_0x2c3793,_0x849a('0xd'));logger[_0x849a('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x2c3793,_0x849a('0xd'),JSON[_0x849a('0xf')](_0x4d3cc7));if(_0x4d3cc7[_0x849a('0x10')]){if(_0x4d3cc7[_0x849a('0x10')]['code']===0x1f4){logger['error'](_0x849a('0xc'),_0x2c3793,_0x4d3cc7['error'][_0x849a('0x11')]);return _0x48f972(_0x4d3cc7[_0x849a('0x10')][_0x849a('0x11')]);}logger[_0x849a('0x10')](_0x849a('0xc'),_0x2c3793,_0x4d3cc7['error'][_0x849a('0x11')]);return _0x42082d(_0x4d3cc7[_0x849a('0x10')][_0x849a('0x11')]);}else{logger[_0x849a('0x12')](_0x849a('0xc'),_0x2c3793,_0x849a('0xd'));_0x42082d(_0x4d3cc7[_0x849a('0x13')][_0x849a('0x11')]);}})[_0x849a('0x14')](function(_0x151a36){logger['error'](_0x849a('0xc'),_0x2c3793,_0x151a36);_0x48f972(_0x151a36);});});}exports[_0x849a('0x15')]=function(_0x2faf73){var _0x40d38a=this;return new Promise(function(_0x11d7c6,_0x5daf6d){return db[_0x849a('0x16')][_0x849a('0x17')]({'raw':!![],'where':{'ContactId':_0x2faf73[_0x849a('0x18')]['ContactId'],'ListId':_0x2faf73['body'][_0x849a('0x19')],'VoiceQueueId':_0x2faf73[_0x849a('0x18')][_0x849a('0x1a')]===undefined?null:_0x2faf73[_0x849a('0x18')][_0x849a('0x1a')],'CampaignId':_0x2faf73[_0x849a('0x18')][_0x849a('0x1b')]===undefined?null:_0x2faf73['body'][_0x849a('0x1b')]}})[_0x849a('0xb')](function(_0x7bdfe0){if(_0x7bdfe0!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x7bdfe0['id'],'OrderBy':{'$gt':_0x7bdfe0['OrderBy']}},'order':[[_0x849a('0x1c'),_0x849a('0x1d')]]})[_0x849a('0xb')](function(_0x13baa6){var _0x5ad702=0x0;if(_0x13baa6){if(_0x13baa6[_0x849a('0x1e')]+_0x13baa6[_0x849a('0x1f')]+_0x13baa6[_0x849a('0x20')]+_0x13baa6[_0x849a('0x21')]+_0x13baa6['countdropretry']+_0x13baa6[_0x849a('0x22')]+_0x13baa6['countmachineretry']+_0x13baa6['countagentrejectretry']<_0x2faf73[_0x849a('0x23')][_0x849a('0x24')])_0x5ad702=0x1;_0x11d7c6({'additional':_0x5ad702});}else{return db[_0x849a('0x25')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x7bdfe0['id']},'order':[[_0x849a('0x1c'),'ASC']]})[_0x849a('0xb')](function(_0x2de570){var _0x48c679=0x0;if(_0x2de570){if(_0x2de570[_0x849a('0x1e')]+_0x2de570[_0x849a('0x1f')]+_0x2de570['countnoanswerretry']+_0x2de570['countnosuchnumberretry']+_0x2de570['countdropretry']+_0x2de570[_0x849a('0x22')]+_0x2de570[_0x849a('0x26')]+_0x2de570[_0x849a('0x27')]<_0x2faf73['entity']['dialGlobalMaxRetry'])_0x48c679=0x1;_0x11d7c6({'additional':_0x48c679});}else{_0x11d7c6({'additional':0x0});}})['catch'](function(_0x1bcafe){logger[_0x849a('0x10')](_0x849a('0x15'),_0x1bcafe[_0x849a('0x11')],_0x2faf73);_0x5daf6d(_0x40d38a['error'](0x1f4,_0x1bcafe[_0x849a('0x11')]));});}})[_0x849a('0x14')](function(_0x4d099c){logger[_0x849a('0x10')]('VerifyAdditionalPhones',_0x4d099c['message'],_0x2faf73);_0x5daf6d(_0x40d38a[_0x849a('0x10')](0x1f4,_0x4d099c[_0x849a('0x11')]));});}else _0x11d7c6({'additional':0x0});});});};exports[_0x849a('0x28')]=function(_0x187cc4){var _0x54886a=this;return new Promise(function(_0x5196a3,_0x10f66b){return db[_0x849a('0x16')][_0x849a('0x17')]({'raw':!![],'where':{'ContactId':_0x187cc4['body']['ContactId'],'ListId':_0x187cc4['body'][_0x849a('0x19')],'VoiceQueueId':_0x187cc4[_0x849a('0x18')][_0x849a('0x1a')]===undefined?null:_0x187cc4['body'][_0x849a('0x1a')],'CampaignId':_0x187cc4['body']['CampaignId']===undefined?null:_0x187cc4['body'][_0x849a('0x1b')]}})['then'](function(_0x409ed9){if(_0x409ed9!=null){return db[_0x849a('0x25')][_0x849a('0x17')]({'raw':!![],'where':{'CmHopperId':_0x409ed9['id'],'OrderBy':{'$gt':_0x409ed9[_0x849a('0x1c')]}},'order':[['OrderBy',_0x849a('0x1d')]]})[_0x849a('0xb')](function(_0x191773){if(_0x191773)return activateAdditionalPhone(_0x409ed9,_0x187cc4[_0x849a('0x18')],_0x191773,_0x187cc4['duration'],_0x187cc4['waitTime'])[_0x849a('0xb')](function(_0x166be8){_0x5196a3(_0x166be8);});else{return db[_0x849a('0x25')][_0x849a('0x17')]({'raw':!![],'where':{'CmHopperId':_0x409ed9['id']},'order':[['OrderBy','ASC']]})[_0x849a('0xb')](function(_0x295d20){if(_0x295d20)return activateAdditionalPhone(_0x409ed9,_0x187cc4['body'],_0x295d20,_0x187cc4['duration'],_0x187cc4[_0x849a('0x29')])['then'](function(_0x421475){_0x5196a3(_0x421475);});else{_0x5196a3({'id':_0x409ed9['id'],'phone':''});}})['catch'](function(_0x351f4e){logger['error'](_0x849a('0x15'),_0x351f4e[_0x849a('0x11')],_0x187cc4);_0x10f66b(_0x54886a[_0x849a('0x10')](0x1f4,_0x351f4e[_0x849a('0x11')]));});}})[_0x849a('0x14')](function(_0x5e0d53){logger[_0x849a('0x10')]('VerifyAdditionalPhones',_0x5e0d53[_0x849a('0x11')],_0x187cc4);_0x10f66b(_0x54886a['error'](0x1f4,_0x5e0d53['message']));});}else _0x5196a3(0x1);});});};function activateAdditionalPhone(_0x6e69f1,_0x281839,_0x4ce9eb,_0x4767fd,_0x3c7e79){return new Promise(function(_0x560415,_0xd3837d){logger[_0x849a('0x12')](_0x849a('0x15'),_0x4ce9eb);var _0x24b066;if(moment()>moment(_0x4ce9eb['scheduledat'])){_0x24b066=moment()[_0x849a('0x2a')](_0x3c7e79||0x3,_0x849a('0x2b'));}else{if(_0x4ce9eb[_0x849a('0x1c')]==0x0){_0x24b066=moment(_0x4ce9eb[_0x849a('0x2c')]);}else{_0x24b066=moment()['add'](_0x3c7e79||0x3,_0x849a('0x2b'));}}var _0x10c431={'phone':_0x6e69f1[_0x849a('0x2d')],'active':0x0,'OrderBy':_[_0x849a('0x2e')](_0x6e69f1[_0x849a('0x1c')])?0x0:_0x6e69f1[_0x849a('0x1c')],'scheduledat':moment()[_0x849a('0x2a')](_0x4767fd||0x1,_0x849a('0x2b')),'countbusyretry':_0x281839[_0x849a('0x1e')],'countcongestionretry':_0x281839[_0x849a('0x1f')],'countnoanswerretry':_0x281839[_0x849a('0x20')],'countnosuchnumberretry':_0x281839[_0x849a('0x21')],'countdropretry':_0x281839[_0x849a('0x2f')],'countabandonedretry':_0x281839[_0x849a('0x22')],'countmachineretry':_0x281839[_0x849a('0x26')],'countagentrejectretry':_0x281839[_0x849a('0x27')],'createdAt':_0x281839['createdAt'],'updatedAt':_0x281839['updatedAt']};var _0x1016d5={'CmHopperId':_0x6e69f1['id'],'phone':_0x4ce9eb[_0x849a('0x2d')],'active':0x0,'OrderBy':_[_0x849a('0x2e')](_0x4ce9eb[_0x849a('0x1c')])?0x0:_0x4ce9eb[_0x849a('0x1c')],'scheduledat':_0x24b066,'countbusyretry':_0x4ce9eb[_0x849a('0x1e')],'countcongestionretry':_0x4ce9eb['countcongestionretry'],'countnoanswerretry':_0x4ce9eb[_0x849a('0x20')],'countnosuchnumberretry':_0x281839['countnosuchnumberretry'],'countdropretry':_0x281839[_0x849a('0x2f')],'countabandonedretry':_0x281839[_0x849a('0x22')],'countmachineretry':_0x281839[_0x849a('0x26')],'countagentrejectretry':_0x281839[_0x849a('0x27')],'createdAt':_0x4ce9eb[_0x849a('0x30')],'updatedAt':_0x4ce9eb['updatedAt']};logger[_0x849a('0x12')](_0x849a('0x31'),_0x10c431);logger[_0x849a('0x12')](_0x849a('0x32'),_0x1016d5);return db[_0x849a('0x33')][_0x849a('0x34')](function(_0x291d14){return db[_0x849a('0x25')][_0x849a('0x35')](_0x10c431,{'where':{'id':_0x4ce9eb['id']}},{'transaction':_0x291d14})[_0x849a('0xb')](function(){return db[_0x849a('0x16')][_0x849a('0x35')](_0x1016d5,{'where':{'id':_0x6e69f1['id']}},{'transaction':_0x291d14});});})[_0x849a('0xb')](function(_0x45c6af){_0x560415({'id':_0x6e69f1['id'],'phone':_0x4ce9eb['phone']});})[_0x849a('0x14')](function(_0x2aada8){logger[_0x849a('0x10')](_0x849a('0x15'),_0x2aada8[_0x849a('0x11')],req);_0xd3837d(_this['error'](0x1f4,_0x2aada8['message']));});});}exports['IncrementPreviewCounters']=function(_0x3e7e3c){var _0x5396e8=this;return new Promise(function(_0x4d2dd6,_0x1a1c27){return db[_0x849a('0x16')][_0x849a('0x35')](_0x3e7e3c['body']['field'],{'where':{'id':_0x3e7e3c['body']['id']}})[_0x849a('0xb')](function(_0x1354df){_0x4d2dd6(_0x1354df);})[_0x849a('0x14')](function(_0x5d1763){logger[_0x849a('0x10')]('IncrementPreviewCounters',_0x5d1763['message'],_0x3e7e3c);_0x1a1c27(_0x5396e8[_0x849a('0x10')](0x1f4,_0x5d1763[_0x849a('0x11')]));});});}; \ No newline at end of file +var _0xd1e8=['catch','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countnoanswerretry','countdropretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countcongestionretry','countnosuchnumberretry','countmachineretry','VerifyAdditionalPhones','SwapAdditionalPhones','ListId','duration','waitTime','scheduledat','add','minutes','isNil','countbusyretry','updatedAt','phone','createdAt','hopperToAdd','sequelize','transaction','update','IncrementPreviewCounters','field','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x597d9c,_0x42318c){var _0x1f8fd8=function(_0x5be894){while(--_0x5be894){_0x597d9c['push'](_0x597d9c['shift']());}};_0x1f8fd8(++_0x42318c);}(_0xd1e8,0x101));var _0x8d1e=function(_0x3b2421,_0xf30f91){_0x3b2421=_0x3b2421-0x0;var _0x288bde=_0xd1e8[_0x3b2421];return _0x288bde;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8d1e('0x0'));var BPromise=require(_0x8d1e('0x1'));var rs=require(_0x8d1e('0x2'));var fs=require('fs');var Redis=require(_0x8d1e('0x3'));var db=require(_0x8d1e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8d1e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8d1e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x242fd8,_0x3d6083,_0x58919c){return new BPromise(function(_0x50672f,_0x4384cd){return client[_0x8d1e('0x7')](_0x242fd8,_0x58919c)[_0x8d1e('0x8')](function(_0x44b2fc){logger['info'](_0x8d1e('0x9'),_0x3d6083,_0x8d1e('0xa'));logger[_0x8d1e('0xb')](_0x8d1e('0xc'),_0x3d6083,'request\x20sent',JSON[_0x8d1e('0xd')](_0x44b2fc));if(_0x44b2fc[_0x8d1e('0xe')]){if(_0x44b2fc[_0x8d1e('0xe')][_0x8d1e('0xf')]===0x1f4){logger[_0x8d1e('0xe')](_0x8d1e('0x9'),_0x3d6083,_0x44b2fc[_0x8d1e('0xe')][_0x8d1e('0x10')]);return _0x4384cd(_0x44b2fc[_0x8d1e('0xe')][_0x8d1e('0x10')]);}logger['error'](_0x8d1e('0x9'),_0x3d6083,_0x44b2fc[_0x8d1e('0xe')][_0x8d1e('0x10')]);return _0x50672f(_0x44b2fc[_0x8d1e('0xe')][_0x8d1e('0x10')]);}else{logger[_0x8d1e('0x11')](_0x8d1e('0x9'),_0x3d6083,_0x8d1e('0xa'));_0x50672f(_0x44b2fc['result'][_0x8d1e('0x10')]);}})[_0x8d1e('0x12')](function(_0x2f0de9){logger[_0x8d1e('0xe')](_0x8d1e('0x9'),_0x3d6083,_0x2f0de9);_0x4384cd(_0x2f0de9);});});}exports['VerifyAdditionalPhones']=function(_0x596ce4){var _0x3c6df6=this;return new Promise(function(_0x335048,_0x3bf896){return db[_0x8d1e('0x13')][_0x8d1e('0x14')]({'raw':!![],'where':{'ContactId':_0x596ce4[_0x8d1e('0x15')][_0x8d1e('0x16')],'ListId':_0x596ce4['body']['ListId'],'VoiceQueueId':_0x596ce4['body'][_0x8d1e('0x17')]===undefined?null:_0x596ce4[_0x8d1e('0x15')][_0x8d1e('0x17')],'CampaignId':_0x596ce4['body'][_0x8d1e('0x18')]===undefined?null:_0x596ce4[_0x8d1e('0x15')]['CampaignId']}})['then'](function(_0x405468){if(_0x405468!=null){return db[_0x8d1e('0x19')][_0x8d1e('0x14')]({'raw':!![],'where':{'CmHopperId':_0x405468['id'],'OrderBy':{'$gt':_0x405468[_0x8d1e('0x1a')]}},'order':[['OrderBy','ASC']]})['then'](function(_0x1288f0){var _0x489ba3=0x0;if(_0x1288f0){if(_0x1288f0['countbusyretry']+_0x1288f0['countcongestionretry']+_0x1288f0[_0x8d1e('0x1b')]+_0x1288f0['countnosuchnumberretry']+_0x1288f0[_0x8d1e('0x1c')]+_0x1288f0['countabandonedretry']+_0x1288f0['countmachineretry']+_0x1288f0[_0x8d1e('0x1d')]<_0x596ce4[_0x8d1e('0x1e')][_0x8d1e('0x1f')])_0x489ba3=0x1;_0x335048({'additional':_0x489ba3});}else{return db[_0x8d1e('0x19')][_0x8d1e('0x14')]({'raw':!![],'where':{'CmHopperId':_0x405468['id']},'order':[[_0x8d1e('0x1a'),_0x8d1e('0x20')]]})[_0x8d1e('0x8')](function(_0x4a30d6){var _0x38a8e4=0x0;if(_0x4a30d6){if(_0x4a30d6['countbusyretry']+_0x4a30d6[_0x8d1e('0x21')]+_0x4a30d6[_0x8d1e('0x1b')]+_0x4a30d6[_0x8d1e('0x22')]+_0x4a30d6[_0x8d1e('0x1c')]+_0x4a30d6['countabandonedretry']+_0x4a30d6[_0x8d1e('0x23')]+_0x4a30d6[_0x8d1e('0x1d')]<_0x596ce4[_0x8d1e('0x1e')][_0x8d1e('0x1f')])_0x38a8e4=0x1;_0x335048({'additional':_0x38a8e4});}else{_0x335048({'additional':0x0});}})[_0x8d1e('0x12')](function(_0x160242){logger[_0x8d1e('0xe')](_0x8d1e('0x24'),_0x160242[_0x8d1e('0x10')],_0x596ce4);_0x3bf896(_0x3c6df6['error'](0x1f4,_0x160242[_0x8d1e('0x10')]));});}})['catch'](function(_0x42b3a7){logger[_0x8d1e('0xe')](_0x8d1e('0x24'),_0x42b3a7['message'],_0x596ce4);_0x3bf896(_0x3c6df6['error'](0x1f4,_0x42b3a7['message']));});}else _0x335048({'additional':0x0});});});};exports[_0x8d1e('0x25')]=function(_0x4c5f66){var _0x59902a=this;return new Promise(function(_0x43ad95,_0x68688){return db[_0x8d1e('0x13')]['findOne']({'raw':!![],'where':{'ContactId':_0x4c5f66[_0x8d1e('0x15')][_0x8d1e('0x16')],'ListId':_0x4c5f66[_0x8d1e('0x15')][_0x8d1e('0x26')],'VoiceQueueId':_0x4c5f66[_0x8d1e('0x15')]['VoiceQueueId']===undefined?null:_0x4c5f66[_0x8d1e('0x15')]['VoiceQueueId'],'CampaignId':_0x4c5f66['body'][_0x8d1e('0x18')]===undefined?null:_0x4c5f66[_0x8d1e('0x15')]['CampaignId']}})['then'](function(_0x304d7a){if(_0x304d7a!=null){return db[_0x8d1e('0x19')][_0x8d1e('0x14')]({'raw':!![],'where':{'CmHopperId':_0x304d7a['id'],'OrderBy':{'$gt':_0x304d7a[_0x8d1e('0x1a')]}},'order':[[_0x8d1e('0x1a'),_0x8d1e('0x20')]]})[_0x8d1e('0x8')](function(_0x20f245){if(_0x20f245)return activateAdditionalPhone(_0x304d7a,_0x4c5f66[_0x8d1e('0x15')],_0x20f245,_0x4c5f66[_0x8d1e('0x27')],_0x4c5f66['waitTime'])[_0x8d1e('0x8')](function(_0x292365){_0x43ad95(_0x292365);});else{return db[_0x8d1e('0x19')][_0x8d1e('0x14')]({'raw':!![],'where':{'CmHopperId':_0x304d7a['id']},'order':[[_0x8d1e('0x1a'),_0x8d1e('0x20')]]})[_0x8d1e('0x8')](function(_0x2bc5d7){if(_0x2bc5d7)return activateAdditionalPhone(_0x304d7a,_0x4c5f66['body'],_0x2bc5d7,_0x4c5f66[_0x8d1e('0x27')],_0x4c5f66[_0x8d1e('0x28')])['then'](function(_0xffd2b4){_0x43ad95(_0xffd2b4);});else{_0x43ad95({'id':_0x304d7a['id'],'phone':''});}})[_0x8d1e('0x12')](function(_0x119ee0){logger[_0x8d1e('0xe')](_0x8d1e('0x24'),_0x119ee0[_0x8d1e('0x10')],_0x4c5f66);_0x68688(_0x59902a['error'](0x1f4,_0x119ee0[_0x8d1e('0x10')]));});}})['catch'](function(_0x3f19f8){logger['error'](_0x8d1e('0x24'),_0x3f19f8[_0x8d1e('0x10')],_0x4c5f66);_0x68688(_0x59902a[_0x8d1e('0xe')](0x1f4,_0x3f19f8[_0x8d1e('0x10')]));});}else _0x43ad95(0x1);});});};function activateAdditionalPhone(_0x3876c4,_0x3ee7ac,_0x457e19,_0x29d219,_0x374ec3){return new Promise(function(_0x4aa36c,_0x2e1094){logger[_0x8d1e('0x11')](_0x8d1e('0x24'),_0x457e19);var _0x20e554;if(moment()>moment(_0x457e19[_0x8d1e('0x29')])){_0x20e554=moment()[_0x8d1e('0x2a')](_0x374ec3||0x3,'minutes');}else{if(_0x457e19[_0x8d1e('0x1a')]==0x0){_0x20e554=moment(_0x457e19[_0x8d1e('0x29')]);}else{_0x20e554=moment()[_0x8d1e('0x2a')](_0x374ec3||0x3,_0x8d1e('0x2b'));}}var _0x3fc958={'phone':_0x3876c4['phone'],'active':0x0,'OrderBy':_[_0x8d1e('0x2c')](_0x3876c4[_0x8d1e('0x1a')])?0x0:_0x3876c4[_0x8d1e('0x1a')],'scheduledat':moment()[_0x8d1e('0x2a')](_0x29d219||0x1,_0x8d1e('0x2b')),'countbusyretry':_0x3ee7ac[_0x8d1e('0x2d')],'countcongestionretry':_0x3ee7ac[_0x8d1e('0x21')],'countnoanswerretry':_0x3ee7ac[_0x8d1e('0x1b')],'countnosuchnumberretry':_0x3ee7ac[_0x8d1e('0x22')],'countdropretry':_0x3ee7ac['countdropretry'],'countabandonedretry':_0x3ee7ac['countabandonedretry'],'countmachineretry':_0x3ee7ac[_0x8d1e('0x23')],'countagentrejectretry':_0x3ee7ac[_0x8d1e('0x1d')],'createdAt':_0x3ee7ac['createdAt'],'updatedAt':_0x3ee7ac[_0x8d1e('0x2e')]};var _0x58c305={'CmHopperId':_0x3876c4['id'],'phone':_0x457e19[_0x8d1e('0x2f')],'active':0x0,'OrderBy':_[_0x8d1e('0x2c')](_0x457e19[_0x8d1e('0x1a')])?0x0:_0x457e19['OrderBy'],'scheduledat':_0x20e554,'countbusyretry':_0x457e19[_0x8d1e('0x2d')],'countcongestionretry':_0x457e19['countcongestionretry'],'countnoanswerretry':_0x457e19[_0x8d1e('0x1b')],'countnosuchnumberretry':_0x3ee7ac[_0x8d1e('0x22')],'countdropretry':_0x3ee7ac[_0x8d1e('0x1c')],'countabandonedretry':_0x3ee7ac['countabandonedretry'],'countmachineretry':_0x3ee7ac[_0x8d1e('0x23')],'countagentrejectretry':_0x3ee7ac[_0x8d1e('0x1d')],'createdAt':_0x457e19[_0x8d1e('0x30')],'updatedAt':_0x457e19['updatedAt']};logger['info'](_0x8d1e('0x31'),_0x3fc958);logger['info']('additionalToHop',_0x58c305);return db[_0x8d1e('0x32')][_0x8d1e('0x33')](function(_0x11af3b){return db[_0x8d1e('0x19')][_0x8d1e('0x34')](_0x3fc958,{'where':{'id':_0x457e19['id']}},{'transaction':_0x11af3b})[_0x8d1e('0x8')](function(){return db['CmHopper'][_0x8d1e('0x34')](_0x58c305,{'where':{'id':_0x3876c4['id']}},{'transaction':_0x11af3b});});})[_0x8d1e('0x8')](function(_0x2469a8){_0x4aa36c({'id':_0x3876c4['id'],'phone':_0x457e19[_0x8d1e('0x2f')]});})[_0x8d1e('0x12')](function(_0x47df9e){logger[_0x8d1e('0xe')](_0x8d1e('0x24'),_0x47df9e[_0x8d1e('0x10')],req);_0x2e1094(_this[_0x8d1e('0xe')](0x1f4,_0x47df9e[_0x8d1e('0x10')]));});});}exports[_0x8d1e('0x35')]=function(_0x2350e9){var _0x4bf9e9=this;return new Promise(function(_0x333256,_0x546352){return db[_0x8d1e('0x13')][_0x8d1e('0x34')](_0x2350e9['body'][_0x8d1e('0x36')],{'where':{'id':_0x2350e9[_0x8d1e('0x15')]['id']}})[_0x8d1e('0x8')](function(_0x3c207c){_0x333256(_0x3c207c);})[_0x8d1e('0x12')](function(_0x41c6e3){logger[_0x8d1e('0xe')](_0x8d1e('0x35'),_0x41c6e3[_0x8d1e('0x10')],_0x2350e9);_0x546352(_0x4bf9e9[_0x8d1e('0xe')](0x1f4,_0x41c6e3[_0x8d1e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 7bcea24..dafacd2 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 _0xe4ce=['create','put','update','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','get','isAuthenticated','/:id','show','post'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xe4ce,0x131));var _0xee4c=function(_0x2c9a3e,_0x34f121){_0x2c9a3e=_0x2c9a3e-0x0;var _0x57a7d6=_0xe4ce[_0x2c9a3e];return _0x57a7d6;};'use strict';var multer=require('multer');var util=require(_0xee4c('0x0'));var path=require(_0xee4c('0x1'));var timeout=require(_0xee4c('0x2'));var express=require(_0xee4c('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xee4c('0x4'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0xee4c('0x5')]('/',auth[_0xee4c('0x6')](),controller['index']);router[_0xee4c('0x5')](_0xee4c('0x7'),auth[_0xee4c('0x6')](),controller[_0xee4c('0x8')]);router[_0xee4c('0x9')]('/',auth[_0xee4c('0x6')](),controller[_0xee4c('0xa')]);router[_0xee4c('0xb')](_0xee4c('0x7'),auth[_0xee4c('0x6')](),controller[_0xee4c('0xc')]);router['delete'](_0xee4c('0x7'),auth['isAuthenticated'](),controller[_0xee4c('0xd')]);module[_0xee4c('0xe')]=router; \ No newline at end of file +var _0xf0be=['connect-timeout','express','Router','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','post','create','update','delete','destroy','multer','path'];(function(_0x3e6354,_0x55f98c){var _0x3fe745=function(_0x3db4ab){while(--_0x3db4ab){_0x3e6354['push'](_0x3e6354['shift']());}};_0x3fe745(++_0x55f98c);}(_0xf0be,0x1cf));var _0xef0b=function(_0x27def3,_0x50b971){_0x27def3=_0x27def3-0x0;var _0x17de58=_0xf0be[_0x27def3];return _0x17de58;};'use strict';var multer=require(_0xef0b('0x0'));var util=require('util');var path=require(_0xef0b('0x1'));var timeout=require(_0xef0b('0x2'));var express=require(_0xef0b('0x3'));var router=express[_0xef0b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xef0b('0x5'));var config=require('../../config/environment');var controller=require(_0xef0b('0x6'));router[_0xef0b('0x7')]('/',auth[_0xef0b('0x8')](),controller['index']);router[_0xef0b('0x7')](_0xef0b('0x9'),auth[_0xef0b('0x8')](),controller['show']);router[_0xef0b('0xa')]('/',auth[_0xef0b('0x8')](),controller[_0xef0b('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xef0b('0xc')]);router[_0xef0b('0xd')](_0xef0b('0x9'),auth[_0xef0b('0x8')](),controller[_0xef0b('0xe')]);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 2401f03..6a8cc72 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 _0x15b3=['sequelize','exports','STRING','contactListQueue','INTEGER','moment'];(function(_0x46f2a2,_0x59b5a4){var _0x1ea996=function(_0x90ce2e){while(--_0x90ce2e){_0x46f2a2['push'](_0x46f2a2['shift']());}};_0x1ea996(++_0x59b5a4);}(_0x15b3,0x167));var _0x315b=function(_0x536dba,_0x60c16d){_0x536dba=_0x536dba-0x0;var _0x2f17cf=_0x15b3[_0x536dba];return _0x2f17cf;};'use strict';var moment=require(_0x315b('0x0'));var Sequelize=require(_0x315b('0x1'));module[_0x315b('0x2')]={'phone':{'type':Sequelize[_0x315b('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x315b('0x4')},'VoiceQueueId':{'type':Sequelize[_0x315b('0x5')],'unique':_0x315b('0x4')}}; \ No newline at end of file +var _0x7833=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x1b4ce6,_0x308474){var _0xfa6ed7=function(_0x44479f){while(--_0x44479f){_0x1b4ce6['push'](_0x1b4ce6['shift']());}};_0xfa6ed7(++_0x308474);}(_0x7833,0xbd));var _0x3783=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x7833[_0x504df1];return _0x1063b5;};'use strict';var moment=require(_0x3783('0x0'));var Sequelize=require('sequelize');module[_0x3783('0x1')]={'phone':{'type':Sequelize[_0x3783('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3783('0x3')],'unique':_0x3783('0x4')},'ListId':{'type':Sequelize[_0x3783('0x3')],'unique':_0x3783('0x4')},'VoiceQueueId':{'type':Sequelize[_0x3783('0x3')],'unique':_0x3783('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 5214920..7a90221 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 _0x8a79=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','body','find','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x8a79,0x174));var _0x98a7=function(_0x3586be,_0x162dd6){_0x3586be=_0x3586be-0x0;var _0x55b20b=_0x8a79[_0x3586be];return _0x55b20b;};'use strict';var pdf=require(_0x98a7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x98a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x98a7('0x2'));var rp=require(_0x98a7('0x3'));var moment=require(_0x98a7('0x4'));var BPromise=require(_0x98a7('0x5'));var Mustache=require(_0x98a7('0x6'));var util=require(_0x98a7('0x7'));var path=require('path');var sox=require(_0x98a7('0x8'));var csv=require(_0x98a7('0x9'));var ejs=require(_0x98a7('0xa'));var fs=require('fs');var _=require(_0x98a7('0xb'));var squel=require(_0x98a7('0xc'));var crypto=require('crypto');var jsforce=require(_0x98a7('0xd'));var deskjs=require(_0x98a7('0xe'));var toCsv=require(_0x98a7('0x9'));var querystring=require(_0x98a7('0xf'));var Papa=require(_0x98a7('0x10'));var Redis=require(_0x98a7('0x11'));var authService=require(_0x98a7('0x12'));var qs=require(_0x98a7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98a7('0x14'));var logger=require('../../config/logger')(_0x98a7('0x15'));var utils=require(_0x98a7('0x16'));var config=require(_0x98a7('0x17'));var licenseUtil=require(_0x98a7('0x18'));var db=require(_0x98a7('0x19'))['db'];function respondWithStatusCode(_0x4bcb18,_0x416221){_0x416221=_0x416221||0xcc;return function(_0x22a247){if(_0x22a247){return _0x4bcb18[_0x98a7('0x1a')](_0x416221);}return _0x4bcb18[_0x98a7('0x1b')](_0x416221)[_0x98a7('0x1c')]();};}function respondWithResult(_0xa80c49,_0x3eda2f){_0x3eda2f=_0x3eda2f||0xc8;return function(_0x13978b){if(_0x13978b){return _0xa80c49[_0x98a7('0x1b')](_0x3eda2f)['json'](_0x13978b);}};}function respondWithFilteredResult(_0x45cf52,_0x159f26){return function(_0x238f87){if(_0x238f87){var _0x40e763=_0x238f87['count'],_0x157d18=_0x159f26[_0x98a7('0x1d')],_0x53d8be=_0x159f26[_0x98a7('0x1d')]+_0x159f26[_0x98a7('0x1e')],_0x24f743;if(_0x53d8be>=_0x40e763){_0x53d8be=_0x40e763;_0x24f743=0xc8;}else{_0x24f743=0xce;}_0x45cf52[_0x98a7('0x1b')](_0x24f743);return _0x45cf52[_0x98a7('0x1f')](_0x98a7('0x20'),_0x157d18+'-'+_0x53d8be+'/'+_0x40e763)[_0x98a7('0x21')](_0x238f87);}return null;};}function patchUpdates(_0x4da8cb){return function(_0xdb73ee){try{jsonpatch[_0x98a7('0x22')](_0xdb73ee,_0x4da8cb,!![]);}catch(_0x442c13){return BPromise[_0x98a7('0x23')](_0x442c13);}return _0xdb73ee[_0x98a7('0x24')]();};}function saveUpdates(_0x5c6352,_0x369b5b){return function(_0x279e8b){if(_0x279e8b){return _0x279e8b[_0x98a7('0x25')](_0x5c6352)['then'](function(_0x287a58){return _0x287a58;});}return null;};}function removeEntity(_0x11b8bc,_0x1e50f0){return function(_0x308479){if(_0x308479){return _0x308479[_0x98a7('0x26')]()[_0x98a7('0x27')](function(){_0x11b8bc[_0x98a7('0x1b')](0xcc)[_0x98a7('0x1c')]();});}};}function handleEntityNotFound(_0x2bf330,_0x43b281){return function(_0x64cbb8){if(!_0x64cbb8){_0x2bf330['sendStatus'](0x194);}return _0x64cbb8;};}function handleError(_0x328446,_0x12b902){_0x12b902=_0x12b902||0x1f4;return function(_0x201541){logger[_0x98a7('0x28')](_0x201541[_0x98a7('0x29')]);if(_0x201541[_0x98a7('0x2a')]){delete _0x201541[_0x98a7('0x2a')];}_0x328446[_0x98a7('0x1b')](_0x12b902)[_0x98a7('0x2b')](_0x201541);};}exports[_0x98a7('0x2c')]=function(_0x3ad899,_0x14525c){var _0x257443={},_0x855f9b={},_0xafa305={'count':0x0,'rows':[]};var _0x374e90=_[_0x98a7('0x2d')](db[_0x98a7('0x2e')][_0x98a7('0x2f')],function(_0x2b9d5e){return{'name':_0x2b9d5e[_0x98a7('0x30')],'type':_0x2b9d5e[_0x98a7('0x31')]['key']};});_0x855f9b[_0x98a7('0x32')]=_[_0x98a7('0x2d')](_0x374e90,_0x98a7('0x2a'));_0x855f9b[_0x98a7('0x33')]=_[_0x98a7('0x34')](_0x3ad899[_0x98a7('0x33')]);_0x855f9b['filters']=_[_0x98a7('0x35')](_0x855f9b[_0x98a7('0x32')],_0x855f9b[_0x98a7('0x33')]);_0x257443[_0x98a7('0x36')]=_[_0x98a7('0x35')](_0x855f9b[_0x98a7('0x32')],qs[_0x98a7('0x37')](_0x3ad899['query'][_0x98a7('0x37')]));_0x257443[_0x98a7('0x36')]=_0x257443['attributes'][_0x98a7('0x38')]?_0x257443['attributes']:_0x855f9b[_0x98a7('0x32')];if(!_0x3ad899['query'][_0x98a7('0x39')](_0x98a7('0x3a'))){_0x257443[_0x98a7('0x1e')]=qs['limit'](_0x3ad899[_0x98a7('0x33')][_0x98a7('0x1e')]);_0x257443[_0x98a7('0x1d')]=qs['offset'](_0x3ad899['query']['offset']);}_0x257443[_0x98a7('0x3b')]=qs[_0x98a7('0x3c')](_0x3ad899[_0x98a7('0x33')][_0x98a7('0x3c')]);_0x257443[_0x98a7('0x3d')]=qs[_0x98a7('0x3e')](_['pick'](_0x3ad899[_0x98a7('0x33')],_0x855f9b['filters']),_0x374e90);if(_0x3ad899[_0x98a7('0x33')][_0x98a7('0x3f')]){_0x257443[_0x98a7('0x3d')]=_[_0x98a7('0x40')](_0x257443[_0x98a7('0x3d')],{'$or':_[_0x98a7('0x2d')](_0x374e90,function(_0x34c623){if(_0x34c623[_0x98a7('0x31')]!=='VIRTUAL'){var _0x4a0da9={};_0x4a0da9[_0x34c623[_0x98a7('0x2a')]]={'$like':'%'+_0x3ad899[_0x98a7('0x33')]['filter']+'%'};return _0x4a0da9;}})});}_0x257443=_[_0x98a7('0x40')]({},_0x257443,_0x3ad899[_0x98a7('0x41')]);var _0x2b95ad={'where':_0x257443['where']};return db[_0x98a7('0x2e')][_0x98a7('0x42')](_0x2b95ad)[_0x98a7('0x27')](function(_0xe26d5b){_0xafa305[_0x98a7('0x42')]=_0xe26d5b;if(_0x3ad899[_0x98a7('0x33')][_0x98a7('0x43')]){_0x257443[_0x98a7('0x44')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x98a7('0x45')](_0x257443);})[_0x98a7('0x27')](function(_0x5b4c54){_0xafa305[_0x98a7('0x46')]=_0x5b4c54;return _0xafa305;})[_0x98a7('0x27')](respondWithFilteredResult(_0x14525c,_0x257443))[_0x98a7('0x47')](handleError(_0x14525c,null));};exports[_0x98a7('0x48')]=function(_0x5b5390,_0x1433ff){var _0x6977a5={'raw':!![],'where':{'id':_0x5b5390[_0x98a7('0x49')]['id']}},_0x4dd0c2={};_0x4dd0c2['model']=_[_0x98a7('0x34')](db[_0x98a7('0x2e')][_0x98a7('0x2f')]);_0x4dd0c2[_0x98a7('0x33')]=_['keys'](_0x5b5390[_0x98a7('0x33')]);_0x4dd0c2[_0x98a7('0x3e')]=_[_0x98a7('0x35')](_0x4dd0c2[_0x98a7('0x32')],_0x4dd0c2['query']);_0x6977a5['attributes']=_[_0x98a7('0x35')](_0x4dd0c2['model'],qs[_0x98a7('0x37')](_0x5b5390['query']['fields']));_0x6977a5[_0x98a7('0x36')]=_0x6977a5[_0x98a7('0x36')][_0x98a7('0x38')]?_0x6977a5[_0x98a7('0x36')]:_0x4dd0c2[_0x98a7('0x32')];if(_0x5b5390[_0x98a7('0x33')][_0x98a7('0x43')]){_0x6977a5[_0x98a7('0x44')]=[{'all':!![]}];}_0x6977a5=_['merge']({},_0x6977a5,_0x5b5390[_0x98a7('0x41')]);return db[_0x98a7('0x2e')]['find'](_0x6977a5)[_0x98a7('0x27')](handleEntityNotFound(_0x1433ff,null))[_0x98a7('0x27')](respondWithResult(_0x1433ff,null))[_0x98a7('0x47')](handleError(_0x1433ff,null));};exports[_0x98a7('0x25')]=function(_0x3a6e1d,_0x157486){if(_0x3a6e1d[_0x98a7('0x4a')]['id']){delete _0x3a6e1d[_0x98a7('0x4a')]['id'];}return db[_0x98a7('0x2e')][_0x98a7('0x4b')]({'where':{'id':_0x3a6e1d[_0x98a7('0x49')]['id']}})['then'](handleEntityNotFound(_0x157486,null))[_0x98a7('0x27')](saveUpdates(_0x3a6e1d['body'],null))[_0x98a7('0x27')](respondWithResult(_0x157486,null))['catch'](handleError(_0x157486,null));};exports[_0x98a7('0x26')]=function(_0x22984a,_0x4f621e){return db[_0x98a7('0x2e')][_0x98a7('0x4b')]({'where':{'id':_0x22984a['params']['id']}})[_0x98a7('0x27')](handleEntityNotFound(_0x4f621e,null))[_0x98a7('0x27')](removeEntity(_0x4f621e,null))['catch'](handleError(_0x4f621e,null));};exports[_0x98a7('0x4c')]=function(_0x40d27a,_0x2fde82){return db[_0x98a7('0x2e')][_0x98a7('0x4c')]()['then'](respondWithResult(_0x2fde82,null))[_0x98a7('0x47')](handleError(_0x2fde82,null));}; \ No newline at end of file +var _0x44c5=['moment','util','path','sox','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','catch','show','params','keys','options','find','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x35ce92,_0x22e16d){var _0x2ce85d=function(_0x46f7c7){while(--_0x46f7c7){_0x35ce92['push'](_0x35ce92['shift']());}};_0x2ce85d(++_0x22e16d);}(_0x44c5,0x11b));var _0x544c=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x44c5[_0x1c8c28];return _0x1f59b4;};'use strict';var pdf=require(_0x544c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x544c('0x1'));var zipdir=require(_0x544c('0x2'));var jsonpatch=require(_0x544c('0x3'));var rp=require(_0x544c('0x4'));var moment=require(_0x544c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x544c('0x6'));var path=require(_0x544c('0x7'));var sox=require(_0x544c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x544c('0x9'));var squel=require('squel');var crypto=require(_0x544c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x544c('0xb'));var toCsv=require(_0x544c('0xc'));var querystring=require(_0x544c('0xd'));var Papa=require(_0x544c('0xe'));var Redis=require(_0x544c('0xf'));var authService=require(_0x544c('0x10'));var qs=require(_0x544c('0x11'));var as=require(_0x544c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x544c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x544c('0x14'));var db=require(_0x544c('0x15'))['db'];function respondWithStatusCode(_0x37b03e,_0x426b80){_0x426b80=_0x426b80||0xcc;return function(_0xdfd5f){if(_0xdfd5f){return _0x37b03e[_0x544c('0x16')](_0x426b80);}return _0x37b03e['status'](_0x426b80)['end']();};}function respondWithResult(_0xc4d026,_0x2b861b){_0x2b861b=_0x2b861b||0xc8;return function(_0x3351f5){if(_0x3351f5){return _0xc4d026[_0x544c('0x17')](_0x2b861b)[_0x544c('0x18')](_0x3351f5);}};}function respondWithFilteredResult(_0x58685f,_0x3d9dec){return function(_0xa9d491){if(_0xa9d491){var _0x44f86f=_0xa9d491[_0x544c('0x19')],_0x517114=_0x3d9dec[_0x544c('0x1a')],_0x3edf7f=_0x3d9dec['offset']+_0x3d9dec[_0x544c('0x1b')],_0x3fd7a8;if(_0x3edf7f>=_0x44f86f){_0x3edf7f=_0x44f86f;_0x3fd7a8=0xc8;}else{_0x3fd7a8=0xce;}_0x58685f[_0x544c('0x17')](_0x3fd7a8);return _0x58685f[_0x544c('0x1c')](_0x544c('0x1d'),_0x517114+'-'+_0x3edf7f+'/'+_0x44f86f)[_0x544c('0x18')](_0xa9d491);}return null;};}function patchUpdates(_0x2bd54a){return function(_0x2f1222){try{jsonpatch[_0x544c('0x1e')](_0x2f1222,_0x2bd54a,!![]);}catch(_0x464755){return BPromise[_0x544c('0x1f')](_0x464755);}return _0x2f1222[_0x544c('0x20')]();};}function saveUpdates(_0x4fd89a,_0x57969b){return function(_0x35c2ec){if(_0x35c2ec){return _0x35c2ec[_0x544c('0x21')](_0x4fd89a)[_0x544c('0x22')](function(_0x2c11fb){return _0x2c11fb;});}return null;};}function removeEntity(_0x32944d,_0x3b46bd){return function(_0x3c7369){if(_0x3c7369){return _0x3c7369[_0x544c('0x23')]()[_0x544c('0x22')](function(){_0x32944d['status'](0xcc)[_0x544c('0x24')]();});}};}function handleEntityNotFound(_0x5707fe,_0x5b44db){return function(_0x1defc4){if(!_0x1defc4){_0x5707fe[_0x544c('0x16')](0x194);}return _0x1defc4;};}function handleError(_0x19124d,_0x17bded){_0x17bded=_0x17bded||0x1f4;return function(_0x3146f6){logger[_0x544c('0x25')](_0x3146f6[_0x544c('0x26')]);if(_0x3146f6[_0x544c('0x27')]){delete _0x3146f6[_0x544c('0x27')];}_0x19124d[_0x544c('0x17')](_0x17bded)[_0x544c('0x28')](_0x3146f6);};}exports[_0x544c('0x29')]=function(_0x3c79c0,_0x39acc3){var _0x47c8e1={},_0x2b2961={},_0x117c21={'count':0x0,'rows':[]};var _0x486c4e=_[_0x544c('0x2a')](db[_0x544c('0x2b')][_0x544c('0x2c')],function(_0x29b4ae){return{'name':_0x29b4ae[_0x544c('0x2d')],'type':_0x29b4ae[_0x544c('0x2e')]['key']};});_0x2b2961['model']=_['map'](_0x486c4e,'name');_0x2b2961['query']=_['keys'](_0x3c79c0['query']);_0x2b2961[_0x544c('0x2f')]=_[_0x544c('0x30')](_0x2b2961[_0x544c('0x31')],_0x2b2961[_0x544c('0x32')]);_0x47c8e1['attributes']=_[_0x544c('0x30')](_0x2b2961['model'],qs[_0x544c('0x33')](_0x3c79c0[_0x544c('0x32')][_0x544c('0x33')]));_0x47c8e1[_0x544c('0x34')]=_0x47c8e1[_0x544c('0x34')][_0x544c('0x35')]?_0x47c8e1[_0x544c('0x34')]:_0x2b2961['model'];if(!_0x3c79c0[_0x544c('0x32')][_0x544c('0x36')](_0x544c('0x37'))){_0x47c8e1[_0x544c('0x1b')]=qs[_0x544c('0x1b')](_0x3c79c0['query'][_0x544c('0x1b')]);_0x47c8e1[_0x544c('0x1a')]=qs[_0x544c('0x1a')](_0x3c79c0[_0x544c('0x32')][_0x544c('0x1a')]);}_0x47c8e1[_0x544c('0x38')]=qs[_0x544c('0x39')](_0x3c79c0[_0x544c('0x32')]['sort']);_0x47c8e1['where']=qs['filters'](_[_0x544c('0x3a')](_0x3c79c0[_0x544c('0x32')],_0x2b2961[_0x544c('0x2f')]),_0x486c4e);if(_0x3c79c0[_0x544c('0x32')][_0x544c('0x3b')]){_0x47c8e1[_0x544c('0x3c')]=_[_0x544c('0x3d')](_0x47c8e1[_0x544c('0x3c')],{'$or':_[_0x544c('0x2a')](_0x486c4e,function(_0x4c3c02){if(_0x4c3c02['type']!=='VIRTUAL'){var _0x5dd63b={};_0x5dd63b[_0x4c3c02['name']]={'$like':'%'+_0x3c79c0[_0x544c('0x32')]['filter']+'%'};return _0x5dd63b;}})});}_0x47c8e1=_[_0x544c('0x3d')]({},_0x47c8e1,_0x3c79c0['options']);var _0x7af27e={'where':_0x47c8e1[_0x544c('0x3c')]};return db['CmHopperBlack']['count'](_0x7af27e)[_0x544c('0x22')](function(_0x484520){_0x117c21[_0x544c('0x19')]=_0x484520;if(_0x3c79c0[_0x544c('0x32')][_0x544c('0x3e')]){_0x47c8e1[_0x544c('0x3f')]=[{'all':!![]}];}return db[_0x544c('0x2b')]['findAll'](_0x47c8e1);})['then'](function(_0x5be9ce){_0x117c21['rows']=_0x5be9ce;return _0x117c21;})['then'](respondWithFilteredResult(_0x39acc3,_0x47c8e1))[_0x544c('0x40')](handleError(_0x39acc3,null));};exports[_0x544c('0x41')]=function(_0x42f86d,_0x407bd6){var _0x28c407={'raw':!![],'where':{'id':_0x42f86d[_0x544c('0x42')]['id']}},_0x5af5cf={};_0x5af5cf[_0x544c('0x31')]=_[_0x544c('0x43')](db[_0x544c('0x2b')][_0x544c('0x2c')]);_0x5af5cf[_0x544c('0x32')]=_[_0x544c('0x43')](_0x42f86d['query']);_0x5af5cf[_0x544c('0x2f')]=_[_0x544c('0x30')](_0x5af5cf[_0x544c('0x31')],_0x5af5cf['query']);_0x28c407[_0x544c('0x34')]=_[_0x544c('0x30')](_0x5af5cf[_0x544c('0x31')],qs[_0x544c('0x33')](_0x42f86d[_0x544c('0x32')][_0x544c('0x33')]));_0x28c407['attributes']=_0x28c407['attributes']['length']?_0x28c407[_0x544c('0x34')]:_0x5af5cf[_0x544c('0x31')];if(_0x42f86d[_0x544c('0x32')][_0x544c('0x3e')]){_0x28c407[_0x544c('0x3f')]=[{'all':!![]}];}_0x28c407=_[_0x544c('0x3d')]({},_0x28c407,_0x42f86d[_0x544c('0x44')]);return db[_0x544c('0x2b')][_0x544c('0x45')](_0x28c407)[_0x544c('0x22')](handleEntityNotFound(_0x407bd6,null))[_0x544c('0x22')](respondWithResult(_0x407bd6,null))[_0x544c('0x40')](handleError(_0x407bd6,null));};exports[_0x544c('0x21')]=function(_0x5da0aa,_0x5aa885){if(_0x5da0aa[_0x544c('0x46')]['id']){delete _0x5da0aa['body']['id'];}return db[_0x544c('0x2b')][_0x544c('0x45')]({'where':{'id':_0x5da0aa[_0x544c('0x42')]['id']}})[_0x544c('0x22')](handleEntityNotFound(_0x5aa885,null))[_0x544c('0x22')](saveUpdates(_0x5da0aa[_0x544c('0x46')],null))[_0x544c('0x22')](respondWithResult(_0x5aa885,null))[_0x544c('0x40')](handleError(_0x5aa885,null));};exports[_0x544c('0x23')]=function(_0x429085,_0x101ef1){return db['CmHopperBlack'][_0x544c('0x45')]({'where':{'id':_0x429085[_0x544c('0x42')]['id']}})[_0x544c('0x22')](handleEntityNotFound(_0x101ef1,null))[_0x544c('0x22')](removeEntity(_0x101ef1,null))[_0x544c('0x40')](handleError(_0x101ef1,null));};exports[_0x544c('0x47')]=function(_0x127a7c,_0x5e3cce){return db[_0x544c('0x2b')]['describe']()[_0x544c('0x22')](respondWithResult(_0x5e3cce,null))[_0x544c('0x40')](handleError(_0x5e3cce,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 23f1b53..94e72e3 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 _0x039e=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x039e,0x8f));var _0xe039=function(_0x393b6b,_0x21f9dd){_0x393b6b=_0x393b6b-0x0;var _0x47d112=_0x039e[_0x393b6b];return _0x47d112;};'use strict';var _=require(_0xe039('0x0'));var util=require('util');var logger=require(_0xe039('0x1'))(_0xe039('0x2'));var moment=require(_0xe039('0x3'));var BPromise=require(_0xe039('0x4'));var rp=require(_0xe039('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe039('0x6'));var config=require('../../config/environment');var attributes=require(_0xe039('0x7'));module[_0xe039('0x8')]=function(_0x976d73,_0x3761e9){return _0x976d73[_0xe039('0x9')](_0xe039('0xa'),attributes,{'tableName':_0xe039('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x946d=['cm_hopper_black','util','moment','request-promise','rimraf','exports'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x946d,0x175));var _0xd946=function(_0x21d055,_0x24ff71){_0x21d055=_0x21d055-0x0;var _0x47125d=_0x946d[_0x21d055];return _0x47125d;};'use strict';var _=require('lodash');var util=require(_0xd946('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd946('0x1'));var BPromise=require('bluebird');var rp=require(_0xd946('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd946('0x3'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0xd946('0x4')]=function(_0x1e197a,_0x401b53){return _0x1e197a['define']('CmHopperBlack',attributes,{'tableName':_0xd946('0x5'),'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 70b0ff3..9292d8f 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 _0xf160=['options','raw','where','attributes','limit','include','model','GetCmHopperBlack','catch','UpdateCmHopperBlack','CmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf160,0xab));var _0x0f16=function(_0x327209,_0x48a379){_0x327209=_0x327209-0x0;var _0x57f4b1=_0xf160[_0x327209];return _0x57f4b1;};'use strict';var _=require(_0x0f16('0x0'));var util=require(_0x0f16('0x1'));var moment=require(_0x0f16('0x2'));var BPromise=require(_0x0f16('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f16('0x4'));var db=require(_0x0f16('0x5'))['db'];var utils=require(_0x0f16('0x6'));var logger=require(_0x0f16('0x7'))(_0x0f16('0x8'));var config=require('../../config/environment');var jayson=require(_0x0f16('0x9'));var client=jayson[_0x0f16('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x70196,_0x242510,_0x3b98f5){return new BPromise(function(_0x4a9c65,_0x2c63e8){return client[_0x0f16('0xb')](_0x70196,_0x3b98f5)[_0x0f16('0xc')](function(_0x52a108){logger[_0x0f16('0xd')](_0x0f16('0xe'),_0x242510,_0x0f16('0xf'));logger[_0x0f16('0x10')](_0x0f16('0x11'),_0x242510,_0x0f16('0xf'),JSON[_0x0f16('0x12')](_0x52a108));if(_0x52a108[_0x0f16('0x13')]){if(_0x52a108[_0x0f16('0x13')][_0x0f16('0x14')]===0x1f4){logger[_0x0f16('0x13')](_0x0f16('0xe'),_0x242510,_0x52a108[_0x0f16('0x13')][_0x0f16('0x15')]);return _0x2c63e8(_0x52a108[_0x0f16('0x13')]['message']);}logger[_0x0f16('0x13')](_0x0f16('0xe'),_0x242510,_0x52a108[_0x0f16('0x13')][_0x0f16('0x15')]);return _0x4a9c65(_0x52a108['error'][_0x0f16('0x15')]);}else{logger[_0x0f16('0xd')](_0x0f16('0xe'),_0x242510,_0x0f16('0xf'));_0x4a9c65(_0x52a108[_0x0f16('0x16')][_0x0f16('0x15')]);}})['catch'](function(_0x439d4f){logger[_0x0f16('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x242510,_0x439d4f);_0x2c63e8(_0x439d4f);});});}exports['GetCmHopperBlack']=function(_0x9d08e1){var _0x5eeefe=this;return new Promise(function(_0x22c09d,_0x3efe4d){return db['CmHopperBlack'][_0x0f16('0x17')]({'raw':_0x9d08e1[_0x0f16('0x18')]?_0x9d08e1[_0x0f16('0x18')][_0x0f16('0x19')]===undefined?!![]:![]:!![],'where':_0x9d08e1[_0x0f16('0x18')]?_0x9d08e1[_0x0f16('0x18')][_0x0f16('0x1a')]||null:null,'attributes':_0x9d08e1['options']?_0x9d08e1['options'][_0x0f16('0x1b')]||null:null,'limit':_0x9d08e1[_0x0f16('0x18')]?_0x9d08e1['options'][_0x0f16('0x1c')]||null:null,'include':_0x9d08e1[_0x0f16('0x18')]?_0x9d08e1[_0x0f16('0x18')][_0x0f16('0x1d')]?_['map'](_0x9d08e1[_0x0f16('0x18')][_0x0f16('0x1d')],function(_0x4cf965){return{'model':db[_0x4cf965[_0x0f16('0x1e')]],'as':_0x4cf965['as'],'attributes':_0x4cf965[_0x0f16('0x1b')],'include':_0x4cf965[_0x0f16('0x1d')]?_['map'](_0x4cf965[_0x0f16('0x1d')],function(_0x1b8e1){return{'model':db[_0x1b8e1[_0x0f16('0x1e')]],'as':_0x1b8e1['as'],'attributes':_0x1b8e1[_0x0f16('0x1b')],'include':_0x1b8e1[_0x0f16('0x1d')]?_['map'](_0x1b8e1[_0x0f16('0x1d')],function(_0x550b6a){return{'model':db[_0x550b6a[_0x0f16('0x1e')]],'as':_0x550b6a['as'],'attributes':_0x550b6a[_0x0f16('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0f16('0xc')](function(_0x277284){logger[_0x0f16('0xd')](_0x0f16('0x1f'),_0x9d08e1);logger[_0x0f16('0x10')]('GetCmHopperBlack',_0x9d08e1,JSON[_0x0f16('0x12')](_0x277284));_0x22c09d(_0x277284);})[_0x0f16('0x20')](function(_0x8ca624){logger[_0x0f16('0x13')]('GetCmHopperBlack',_0x8ca624[_0x0f16('0x15')],_0x9d08e1);_0x3efe4d(_0x5eeefe[_0x0f16('0x13')](0x1f4,_0x8ca624[_0x0f16('0x15')]));});});};exports[_0x0f16('0x21')]=function(_0x94dccc){var _0x3769e5=this;return new Promise(function(_0x18659c,_0x3c3e48){return db[_0x0f16('0x22')][_0x0f16('0x23')](_0x94dccc[_0x0f16('0x24')],{'raw':_0x94dccc[_0x0f16('0x18')]?_0x94dccc['options'][_0x0f16('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x94dccc['options']?_0x94dccc['options'][_0x0f16('0x1a')]||null:null,'attributes':_0x94dccc[_0x0f16('0x18')]?_0x94dccc[_0x0f16('0x18')]['attributes']||null:null,'limit':_0x94dccc[_0x0f16('0x18')]?_0x94dccc[_0x0f16('0x18')][_0x0f16('0x1c')]||null:null})['then'](function(_0x4b2800){logger[_0x0f16('0xd')](_0x0f16('0x21'),_0x94dccc);logger['debug'](_0x0f16('0x21'),_0x94dccc,JSON['stringify'](_0x4b2800));_0x18659c(_0x4b2800);})[_0x0f16('0x20')](function(_0x5512f6){logger[_0x0f16('0x13')](_0x0f16('0x21'),_0x5512f6['message'],_0x94dccc);_0x3c3e48(_0x3769e5[_0x0f16('0x13')](0x1f4,_0x5512f6[_0x0f16('0x15')]));});});};exports[_0x0f16('0x25')]=function(_0x3a4304){var _0x20028b=this;return new Promise(function(_0x136199,_0x2255e7){return db['CmHopperBlack'][_0x0f16('0x26')]({'where':_0x3a4304[_0x0f16('0x18')]?_0x3a4304['options']['where']||null:null})[_0x0f16('0xc')](function(_0x3ec7f8){logger[_0x0f16('0xd')]('DestroyCmHopperBlack',_0x3a4304);logger[_0x0f16('0x10')]('DestroyCmHopperBlack',_0x3a4304,JSON[_0x0f16('0x12')](_0x3ec7f8));_0x136199(_0x3ec7f8);})[_0x0f16('0x20')](function(_0x427cc3){logger['error'](_0x0f16('0x25'),_0x427cc3['message'],_0x3a4304);_0x2255e7(_0x20028b[_0x0f16('0x13')](0x1f4,_0x427cc3['message']));});});}; \ No newline at end of file +var _0xcb71=['rpc','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','CmHopperBlack','findAll','options','raw','where','include','model','attributes','then','GetCmHopperBlack','catch','UpdateCmHopperBlack','update','body','limit','DestroyCmHopperBlack','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xcb71,0x19e));var _0x1cb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb71[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1cb7('0x0'));var moment=require('moment');var BPromise=require(_0x1cb7('0x1'));var rs=require(_0x1cb7('0x2'));var fs=require('fs');var Redis=require(_0x1cb7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb7('0x4'));var logger=require(_0x1cb7('0x5'))(_0x1cb7('0x6'));var config=require('../../config/environment');var jayson=require(_0x1cb7('0x7'));var client=jayson[_0x1cb7('0x8')][_0x1cb7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x377cb7,_0x2d3167,_0x5c4ce0){return new BPromise(function(_0x130259,_0x334076){return client[_0x1cb7('0xa')](_0x377cb7,_0x5c4ce0)['then'](function(_0x205e42){logger[_0x1cb7('0xb')](_0x1cb7('0xc'),_0x2d3167,_0x1cb7('0xd'));logger[_0x1cb7('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x2d3167,_0x1cb7('0xd'),JSON[_0x1cb7('0xf')](_0x205e42));if(_0x205e42[_0x1cb7('0x10')]){if(_0x205e42[_0x1cb7('0x10')][_0x1cb7('0x11')]===0x1f4){logger[_0x1cb7('0x10')](_0x1cb7('0xc'),_0x2d3167,_0x205e42['error']['message']);return _0x334076(_0x205e42[_0x1cb7('0x10')][_0x1cb7('0x12')]);}logger[_0x1cb7('0x10')](_0x1cb7('0xc'),_0x2d3167,_0x205e42['error'][_0x1cb7('0x12')]);return _0x130259(_0x205e42['error'][_0x1cb7('0x12')]);}else{logger[_0x1cb7('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x2d3167,'request\x20sent');_0x130259(_0x205e42['result'][_0x1cb7('0x12')]);}})['catch'](function(_0x4b2feb){logger['error'](_0x1cb7('0xc'),_0x2d3167,_0x4b2feb);_0x334076(_0x4b2feb);});});}exports['GetCmHopperBlack']=function(_0x52dec4){var _0x21c330=this;return new Promise(function(_0x11c462,_0x8d3c1b){return db[_0x1cb7('0x13')][_0x1cb7('0x14')]({'raw':_0x52dec4[_0x1cb7('0x15')]?_0x52dec4['options'][_0x1cb7('0x16')]===undefined?!![]:![]:!![],'where':_0x52dec4[_0x1cb7('0x15')]?_0x52dec4[_0x1cb7('0x15')][_0x1cb7('0x17')]||null:null,'attributes':_0x52dec4[_0x1cb7('0x15')]?_0x52dec4['options']['attributes']||null:null,'limit':_0x52dec4[_0x1cb7('0x15')]?_0x52dec4[_0x1cb7('0x15')]['limit']||null:null,'include':_0x52dec4[_0x1cb7('0x15')]?_0x52dec4['options'][_0x1cb7('0x18')]?_['map'](_0x52dec4[_0x1cb7('0x15')]['include'],function(_0x2546c1){return{'model':db[_0x2546c1[_0x1cb7('0x19')]],'as':_0x2546c1['as'],'attributes':_0x2546c1[_0x1cb7('0x1a')],'include':_0x2546c1[_0x1cb7('0x18')]?_['map'](_0x2546c1[_0x1cb7('0x18')],function(_0x1b5819){return{'model':db[_0x1b5819[_0x1cb7('0x19')]],'as':_0x1b5819['as'],'attributes':_0x1b5819['attributes'],'include':_0x1b5819[_0x1cb7('0x18')]?_['map'](_0x1b5819[_0x1cb7('0x18')],function(_0x839d0d){return{'model':db[_0x839d0d[_0x1cb7('0x19')]],'as':_0x839d0d['as'],'attributes':_0x839d0d[_0x1cb7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1cb7('0x1b')](function(_0x17fb7b){logger[_0x1cb7('0xb')](_0x1cb7('0x1c'),_0x52dec4);logger[_0x1cb7('0xe')](_0x1cb7('0x1c'),_0x52dec4,JSON[_0x1cb7('0xf')](_0x17fb7b));_0x11c462(_0x17fb7b);})[_0x1cb7('0x1d')](function(_0x179390){logger[_0x1cb7('0x10')]('GetCmHopperBlack',_0x179390['message'],_0x52dec4);_0x8d3c1b(_0x21c330[_0x1cb7('0x10')](0x1f4,_0x179390[_0x1cb7('0x12')]));});});};exports[_0x1cb7('0x1e')]=function(_0x5f45c0){var _0x4ca90c=this;return new Promise(function(_0x3f76b6,_0x155360){return db['CmHopperBlack'][_0x1cb7('0x1f')](_0x5f45c0[_0x1cb7('0x20')],{'raw':_0x5f45c0[_0x1cb7('0x15')]?_0x5f45c0[_0x1cb7('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f45c0['options']?_0x5f45c0[_0x1cb7('0x15')][_0x1cb7('0x17')]||null:null,'attributes':_0x5f45c0[_0x1cb7('0x15')]?_0x5f45c0[_0x1cb7('0x15')][_0x1cb7('0x1a')]||null:null,'limit':_0x5f45c0[_0x1cb7('0x15')]?_0x5f45c0[_0x1cb7('0x15')][_0x1cb7('0x21')]||null:null})['then'](function(_0x3d52b6){logger['info'](_0x1cb7('0x1e'),_0x5f45c0);logger['debug'](_0x1cb7('0x1e'),_0x5f45c0,JSON[_0x1cb7('0xf')](_0x3d52b6));_0x3f76b6(_0x3d52b6);})[_0x1cb7('0x1d')](function(_0x33eab2){logger[_0x1cb7('0x10')](_0x1cb7('0x1e'),_0x33eab2['message'],_0x5f45c0);_0x155360(_0x4ca90c[_0x1cb7('0x10')](0x1f4,_0x33eab2[_0x1cb7('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x4f25b8){var _0xf1a4e3=this;return new Promise(function(_0x58fb95,_0xebcc1c){return db['CmHopperBlack']['destroy']({'where':_0x4f25b8['options']?_0x4f25b8[_0x1cb7('0x15')][_0x1cb7('0x17')]||null:null})[_0x1cb7('0x1b')](function(_0x117342){logger['info'](_0x1cb7('0x22'),_0x4f25b8);logger[_0x1cb7('0xe')](_0x1cb7('0x22'),_0x4f25b8,JSON[_0x1cb7('0xf')](_0x117342));_0x58fb95(_0x117342);})[_0x1cb7('0x1d')](function(_0x4be75e){logger[_0x1cb7('0x10')](_0x1cb7('0x22'),_0x4be75e['message'],_0x4f25b8);_0xebcc1c(_0xf1a4e3['error'](0x1f4,_0x4be75e[_0x1cb7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 551f788..afbcb37 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 _0x24ca=['describe','/:id','show','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe'];(function(_0x3ebcc4,_0x42bc04){var _0x37ff23=function(_0x32e0fe){while(--_0x32e0fe){_0x3ebcc4['push'](_0x3ebcc4['shift']());}};_0x37ff23(++_0x42bc04);}(_0x24ca,0x1bc));var _0xa24c=function(_0xf2662b,_0x4d8f41){_0xf2662b=_0xf2662b-0x0;var _0x257dc7=_0x24ca[_0xf2662b];return _0x257dc7;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var auth=require(_0xa24c('0x4'));var interaction=require(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var controller=require(_0xa24c('0x7'));router[_0xa24c('0x8')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x8')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xc')]);router['get'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router['put'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x11')]);module[_0xa24c('0x12')]=router; \ No newline at end of file +var _0xb821=['/:id','show','put','update','delete','destroy','exports','util','path','Router','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe'];(function(_0x38198b,_0x123cf1){var _0x4fe214=function(_0x573441){while(--_0x573441){_0x38198b['push'](_0x38198b['shift']());}};_0x4fe214(++_0x123cf1);}(_0xb821,0xa7));var _0x1b82=function(_0x24b845,_0x5e73d3){_0x24b845=_0x24b845-0x0;var _0xa4f894=_0xb821[_0x24b845];return _0xa4f894;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b82('0x3'));var controller=require(_0x1b82('0x4'));router[_0x1b82('0x5')]('/',auth[_0x1b82('0x6')](),controller['index']);router[_0x1b82('0x5')](_0x1b82('0x7'),auth[_0x1b82('0x6')](),controller[_0x1b82('0x8')]);router[_0x1b82('0x5')](_0x1b82('0x9'),auth[_0x1b82('0x6')](),controller[_0x1b82('0xa')]);router[_0x1b82('0xb')]('/:id',auth[_0x1b82('0x6')](),controller[_0x1b82('0xc')]);router[_0x1b82('0xd')](_0x1b82('0x9'),auth[_0x1b82('0x6')](),controller[_0x1b82('0xe')]);module[_0x1b82('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 6410934..a75f9aa 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 _0x8fcd=['exports','INTEGER','STRING','DATE','getDataValue','endtime','diff','dispositionat','BOOLEAN','sequelize','moment'];(function(_0x53767b,_0x3aa30b){var _0x29f67b=function(_0xd1d3e8){while(--_0xd1d3e8){_0x53767b['push'](_0x53767b['shift']());}};_0x29f67b(++_0x3aa30b);}(_0x8fcd,0x13d));var _0xd8fc=function(_0x7e043a,_0x310c32){_0x7e043a=_0x7e043a-0x0;var _0x40ce67=_0x8fcd[_0x7e043a];return _0x40ce67;};'use strict';var Sequelize=require(_0xd8fc('0x0'));var moment=require(_0xd8fc('0x1'));module[_0xd8fc('0x2')]={'state':{'type':Sequelize[_0xd8fc('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xd8fc('0x4')]},'scheduledat':{'type':Sequelize[_0xd8fc('0x5')]},'countbusyretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd8fc('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xd8fc('0x4')]},'calleridnum':{'type':Sequelize[_0xd8fc('0x4')]},'calleridname':{'type':Sequelize[_0xd8fc('0x4')]},'starttime':{'type':Sequelize[_0xd8fc('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xd8fc('0x5')]},'endtime':{'type':Sequelize[_0xd8fc('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd8fc('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xd8fc('0x4')]},'membername':{'type':Sequelize[_0xd8fc('0x4')]},'reason':{'type':Sequelize[_0xd8fc('0x4')]},'disposition':{'type':Sequelize[_0xd8fc('0x4')]},'secondDisposition':{'type':Sequelize[_0xd8fc('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd8fc('0x4')]},'dispositionat':{'type':Sequelize[_0xd8fc('0x5')],'set':function(_0x39f60b){var _0x2d8bfe=this[_0xd8fc('0x6')](_0xd8fc('0x7'));if(_0x2d8bfe&&_0x39f60b){this['setDataValue']('followuptime',moment(_0x39f60b)[_0xd8fc('0x8')](moment(_0x2d8bfe),'seconds'));}return this['setDataValue'](_0xd8fc('0x9'),_0x39f60b);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xd8fc('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd8fc('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd8fc('0x5')]},'callback':{'type':Sequelize[_0xd8fc('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd8fc('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd8fc('0x5')]},'deleted':{'type':Sequelize[_0xd8fc('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd8fc('0x5')]},'recallme':{'type':Sequelize[_0xd8fc('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd8fc('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0076=['getDataValue','endtime','setDataValue','followuptime','diff','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x2ef43b,_0x5751ab){var _0x1f615f=function(_0x48f2b5){while(--_0x48f2b5){_0x2ef43b['push'](_0x2ef43b['shift']());}};_0x1f615f(++_0x5751ab);}(_0x0076,0x1b4));var _0x6007=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x0076[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require(_0x6007('0x0'));var moment=require(_0x6007('0x1'));module[_0x6007('0x2')]={'state':{'type':Sequelize[_0x6007('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x6007('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6007('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6007('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6007('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6007('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x6007('0x4')]},'originatecalleridname':{'type':Sequelize[_0x6007('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6007('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x6007('0x5')]},'answertime':{'type':Sequelize[_0x6007('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6007('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6007('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6007('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6007('0x4')]},'campaign':{'type':Sequelize[_0x6007('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6007('0x4')]},'reason':{'type':Sequelize[_0x6007('0x4')]},'disposition':{'type':Sequelize[_0x6007('0x4')]},'secondDisposition':{'type':Sequelize[_0x6007('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6007('0x4')]},'dispositionat':{'type':Sequelize[_0x6007('0x5')],'set':function(_0x4a534d){var _0x158c88=this[_0x6007('0x6')](_0x6007('0x7'));if(_0x158c88&&_0x4a534d){this[_0x6007('0x8')](_0x6007('0x9'),moment(_0x4a534d)[_0x6007('0xa')](moment(_0x158c88),'seconds'));}return this[_0x6007('0x8')](_0x6007('0xb'),_0x4a534d);}},'amd':{'type':Sequelize[_0x6007('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6007('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6007('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6007('0x5')]},'callback':{'type':Sequelize[_0x6007('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6007('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6007('0x5')]},'deleted':{'type':Sequelize[_0x6007('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6007('0x5')]},'recallme':{'type':Sequelize[_0x6007('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x6007('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6007('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6007('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6007('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 c85558c..baf4eb0 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 _0xda55=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','name','index','map','CmHopperFinal','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','params','keys','fields','find','catch','describe','body','uniqueid','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','answeringMachine','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','from','state\x20=\x204','moveContactsIvrCampaignHopperFinal','fromQuery','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0xf4b5ec,_0x558d12){var _0x38cbc0=function(_0x7d62c9){while(--_0x7d62c9){_0xf4b5ec['push'](_0xf4b5ec['shift']());}};_0x38cbc0(++_0x558d12);}(_0xda55,0x6d));var _0x5da5=function(_0x475bec,_0x21dd89){_0x475bec=_0x475bec-0x0;var _0x28636b=_0xda55[_0x475bec];return _0x28636b;};'use strict';var pdf=require(_0x5da5('0x0'));var emlformat=require(_0x5da5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5da5('0x2'));var rp=require(_0x5da5('0x3'));var moment=require(_0x5da5('0x4'));var BPromise=require(_0x5da5('0x5'));var Mustache=require(_0x5da5('0x6'));var util=require('util');var path=require(_0x5da5('0x7'));var sox=require('sox');var csv=require(_0x5da5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5da5('0x9'));var squel=require(_0x5da5('0xa'));var crypto=require(_0x5da5('0xb'));var jsforce=require(_0x5da5('0xc'));var deskjs=require(_0x5da5('0xd'));var toCsv=require(_0x5da5('0x8'));var querystring=require(_0x5da5('0xe'));var Papa=require(_0x5da5('0xf'));var Redis=require('ioredis');var authService=require(_0x5da5('0x10'));var qs=require(_0x5da5('0x11'));var as=require(_0x5da5('0x12'));var hardwareService=require(_0x5da5('0x13'));var logger=require(_0x5da5('0x14'))(_0x5da5('0x15'));var utils=require(_0x5da5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5da5('0x17'));var db=require(_0x5da5('0x18'))['db'];function respondWithStatusCode(_0x4f813b,_0x37aeb0){_0x37aeb0=_0x37aeb0||0xcc;return function(_0x31366e){if(_0x31366e){return _0x4f813b[_0x5da5('0x19')](_0x37aeb0);}return _0x4f813b[_0x5da5('0x1a')](_0x37aeb0)[_0x5da5('0x1b')]();};}function respondWithResult(_0x440b8f,_0x481562){_0x481562=_0x481562||0xc8;return function(_0x489b60){if(_0x489b60){return _0x440b8f['status'](_0x481562)[_0x5da5('0x1c')](_0x489b60);}};}function respondWithFilteredResult(_0x126fc8,_0x13c701){return function(_0x665ce8){if(_0x665ce8){var _0x11bd3=_0x665ce8[_0x5da5('0x1d')],_0x134afa=_0x13c701[_0x5da5('0x1e')],_0x3aff51=_0x13c701[_0x5da5('0x1e')]+_0x13c701[_0x5da5('0x1f')],_0x4a952a;if(_0x3aff51>=_0x11bd3){_0x3aff51=_0x11bd3;_0x4a952a=0xc8;}else{_0x4a952a=0xce;}_0x126fc8[_0x5da5('0x1a')](_0x4a952a);return _0x126fc8[_0x5da5('0x20')]('Content-Range',_0x134afa+'-'+_0x3aff51+'/'+_0x11bd3)[_0x5da5('0x1c')](_0x665ce8);}return null;};}function patchUpdates(_0x3766ee){return function(_0x3d3d26){try{jsonpatch[_0x5da5('0x21')](_0x3d3d26,_0x3766ee,!![]);}catch(_0xf023af){return BPromise['reject'](_0xf023af);}return _0x3d3d26[_0x5da5('0x22')]();};}function saveUpdates(_0x3372fc,_0x42a3cb){return function(_0x560ea7){if(_0x560ea7){return _0x560ea7[_0x5da5('0x23')](_0x3372fc)[_0x5da5('0x24')](function(_0x20c8a6){return _0x20c8a6;});}return null;};}function removeEntity(_0x2e68d5,_0xec69f2){return function(_0x436960){if(_0x436960){return _0x436960['destroy']()[_0x5da5('0x24')](function(){_0x2e68d5['status'](0xcc)[_0x5da5('0x1b')]();});}};}function handleEntityNotFound(_0x716ab7,_0x2dd138){return function(_0x5d983c){if(!_0x5d983c){_0x716ab7[_0x5da5('0x19')](0x194);}return _0x5d983c;};}function handleError(_0x236bf3,_0x39dd93){_0x39dd93=_0x39dd93||0x1f4;return function(_0x21e795){logger['error'](_0x21e795['stack']);if(_0x21e795['name']){delete _0x21e795[_0x5da5('0x25')];}_0x236bf3['status'](_0x39dd93)['send'](_0x21e795);};}exports[_0x5da5('0x26')]=function(_0x3974d8,_0x5740a7){var _0x1798ae={},_0x1ab83e={},_0x558b12={'count':0x0,'rows':[]};var _0x3b815e=_[_0x5da5('0x27')](db[_0x5da5('0x28')][_0x5da5('0x29')],function(_0x766ed9){return{'name':_0x766ed9['fieldName'],'type':_0x766ed9[_0x5da5('0x2a')][_0x5da5('0x2b')]};});_0x1ab83e[_0x5da5('0x2c')]=_[_0x5da5('0x27')](_0x3b815e,'name');_0x1ab83e['query']=_['keys'](_0x3974d8[_0x5da5('0x2d')]);_0x1ab83e[_0x5da5('0x2e')]=_[_0x5da5('0x2f')](_0x1ab83e[_0x5da5('0x2c')],_0x1ab83e['query']);_0x1798ae['attributes']=_[_0x5da5('0x2f')](_0x1ab83e['model'],qs['fields'](_0x3974d8[_0x5da5('0x2d')]['fields']));_0x1798ae[_0x5da5('0x30')]=_0x1798ae[_0x5da5('0x30')][_0x5da5('0x31')]?_0x1798ae[_0x5da5('0x30')]:_0x1ab83e[_0x5da5('0x2c')];if(!_0x3974d8[_0x5da5('0x2d')][_0x5da5('0x32')](_0x5da5('0x33'))){_0x1798ae['limit']=qs[_0x5da5('0x1f')](_0x3974d8['query'][_0x5da5('0x1f')]);_0x1798ae[_0x5da5('0x1e')]=qs[_0x5da5('0x1e')](_0x3974d8[_0x5da5('0x2d')][_0x5da5('0x1e')]);}_0x1798ae[_0x5da5('0x34')]=qs[_0x5da5('0x35')](_0x3974d8[_0x5da5('0x2d')][_0x5da5('0x35')]);_0x1798ae[_0x5da5('0x36')]=qs[_0x5da5('0x2e')](_[_0x5da5('0x37')](_0x3974d8[_0x5da5('0x2d')],_0x1ab83e['filters']),_0x3b815e);if(_0x3974d8[_0x5da5('0x2d')]['filter']){_0x1798ae[_0x5da5('0x36')]=_[_0x5da5('0x38')](_0x1798ae[_0x5da5('0x36')],{'$or':_[_0x5da5('0x27')](_0x3b815e,function(_0x59c92e){if(_0x59c92e[_0x5da5('0x2a')]!==_0x5da5('0x39')){var _0x22e26a={};_0x22e26a[_0x59c92e['name']]={'$like':'%'+_0x3974d8[_0x5da5('0x2d')][_0x5da5('0x3a')]+'%'};return _0x22e26a;}})});}_0x1798ae=_['merge']({},_0x1798ae,_0x3974d8[_0x5da5('0x3b')]);var _0xa90d5={'where':_0x1798ae[_0x5da5('0x36')]};return db[_0x5da5('0x28')][_0x5da5('0x1d')](_0xa90d5)[_0x5da5('0x24')](function(_0x52a902){_0x558b12[_0x5da5('0x1d')]=_0x52a902;if(_0x3974d8[_0x5da5('0x2d')][_0x5da5('0x3c')]){_0x1798ae[_0x5da5('0x3d')]=[{'all':!![]}];}return db[_0x5da5('0x28')]['findAll'](_0x1798ae);})[_0x5da5('0x24')](function(_0x21ffa1){_0x558b12['rows']=_0x21ffa1;return _0x558b12;})[_0x5da5('0x24')](respondWithFilteredResult(_0x5740a7,_0x1798ae))['catch'](handleError(_0x5740a7,null));};exports['show']=function(_0x1da9ef,_0x21c579){var _0x2f6026={'raw':!![],'where':{'id':_0x1da9ef[_0x5da5('0x3e')]['id']}},_0x29d9a7={};_0x29d9a7[_0x5da5('0x2c')]=_[_0x5da5('0x3f')](db[_0x5da5('0x28')][_0x5da5('0x29')]);_0x29d9a7[_0x5da5('0x2d')]=_[_0x5da5('0x3f')](_0x1da9ef[_0x5da5('0x2d')]);_0x29d9a7[_0x5da5('0x2e')]=_[_0x5da5('0x2f')](_0x29d9a7[_0x5da5('0x2c')],_0x29d9a7[_0x5da5('0x2d')]);_0x2f6026[_0x5da5('0x30')]=_[_0x5da5('0x2f')](_0x29d9a7[_0x5da5('0x2c')],qs[_0x5da5('0x40')](_0x1da9ef['query']['fields']));_0x2f6026[_0x5da5('0x30')]=_0x2f6026[_0x5da5('0x30')]['length']?_0x2f6026[_0x5da5('0x30')]:_0x29d9a7[_0x5da5('0x2c')];if(_0x1da9ef[_0x5da5('0x2d')][_0x5da5('0x3c')]){_0x2f6026[_0x5da5('0x3d')]=[{'all':!![]}];}_0x2f6026=_[_0x5da5('0x38')]({},_0x2f6026,_0x1da9ef[_0x5da5('0x3b')]);return db[_0x5da5('0x28')][_0x5da5('0x41')](_0x2f6026)[_0x5da5('0x24')](handleEntityNotFound(_0x21c579,null))['then'](respondWithResult(_0x21c579,null))[_0x5da5('0x42')](handleError(_0x21c579,null));};exports['describe']=function(_0x4c6bbf,_0x2a0fb6){return db[_0x5da5('0x28')][_0x5da5('0x43')]()[_0x5da5('0x24')](respondWithResult(_0x2a0fb6,null))[_0x5da5('0x42')](handleError(_0x2a0fb6,null));};exports[_0x5da5('0x23')]=function(_0x5aa561,_0x216d06){if(_0x5aa561['body']['uniqueid']){delete _0x5aa561[_0x5da5('0x44')][_0x5da5('0x45')];}return db['CmHopperFinal'][_0x5da5('0x41')]({'where':{'uniqueid':_0x5aa561[_0x5da5('0x3e')]['id']}})[_0x5da5('0x24')](handleEntityNotFound(_0x216d06,null))[_0x5da5('0x24')](saveUpdates(_0x5aa561[_0x5da5('0x44')],null))['then'](respondWithResult(_0x216d06,null))[_0x5da5('0x42')](handleError(_0x216d06,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x535b22,_0x361f5f,_0x57eca7){return db[_0x5da5('0x28')][_0x5da5('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x535b22[_0x5da5('0x3e')]['id']},'attributes':[[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db['sequelize']['literal'](_0x5da5('0x49')))),_0x5da5('0x4a')],[db['sequelize']['fn']('COUNT',db[_0x5da5('0x47')]['fn']('IF',db['sequelize'][_0x5da5('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')]['literal'](_0x5da5('0x4c')))),_0x5da5('0x4d')],[db[_0x5da5('0x47')]['fn']('COUNT',db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x4e')))),_0x5da5('0x4f')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x50')))),_0x5da5('0x51')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x52')))),_0x5da5('0x53')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db['sequelize']['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db['sequelize']['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x5da5('0x54')]]})[_0x5da5('0x24')](handleEntityNotFound(_0x361f5f,null))[_0x5da5('0x24')](respondWithResult(_0x361f5f,null))[_0x5da5('0x42')](handleError(_0x361f5f,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x2a4b26,_0x3eeff3,_0x34b4b0){return db['CmHopperFinal'][_0x5da5('0x46')]({'raw':![],'where':{'CampaignId':_0x2a4b26['params']['id']},'attributes':[[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x49')))),_0x5da5('0x4a')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x55')))),_0x5da5('0x56')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x4c')))),_0x5da5('0x4d')],[db['sequelize']['fn']('COUNT',db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x5da5('0x4f')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db['sequelize'][_0x5da5('0x4b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5da5('0x51')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x52')))),'abandonedContacts'],[db['sequelize']['fn']('COUNT',db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x57')))),_0x5da5('0x58')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db['sequelize'][_0x5da5('0x4b')](_0x5da5('0x59')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x3eeff3,null))[_0x5da5('0x24')](respondWithResult(_0x3eeff3,null))['catch'](handleError(_0x3eeff3,null));};exports[_0x5da5('0x5a')]=function(_0x4f7e64,_0x2adeab,_0x784515){return db[_0x5da5('0x5b')][_0x5da5('0x41')]({'where':{'id':_0x4f7e64[_0x5da5('0x3e')]['id']}})[_0x5da5('0x24')](handleEntityNotFound(_0x2adeab,null))[_0x5da5('0x24')](function(_0x1bffae){var _0x12ef38;if(_0x1bffae){_0x12ef38=squel[_0x5da5('0x5c')]()[_0x5da5('0x5d')](_0x5da5('0x5e'))['fromQuery'](['phone',_0x5da5('0x5f'),_0x5da5('0x60'),_0x5da5('0x61'),_0x5da5('0x62'),'createdAt','updatedAt'],squel['select']()[_0x5da5('0x63')](_0x5da5('0x64'),_0x5da5('0x65'))[_0x5da5('0x63')](_0x5da5('0x66'),_0x5da5('0x5f'))[_0x5da5('0x63')](_0x5da5('0x67'),_0x5da5('0x60'))[_0x5da5('0x63')](_0x5da5('0x68'),_0x5da5('0x61'))[_0x5da5('0x63')](_0x5da5('0x69'),_0x5da5('0x62'))[_0x5da5('0x63')](_0x5da5('0x66'),_0x5da5('0x6a'))[_0x5da5('0x63')](_0x5da5('0x66'),_0x5da5('0x6b'))['from'](_0x5da5('0x6c'))[_0x5da5('0x36')](_0x5da5('0x6d'),_0x4f7e64[_0x5da5('0x3e')]['id']['toString']())['where'](_0x5da5('0x6e'),_0x4f7e64['body'][_0x5da5('0x6f')][_0x5da5('0x70')]())[_0x5da5('0x36')](_0x5da5('0x71'))[_0x5da5('0x36')](_0x5da5('0x72'),squel[_0x5da5('0x73')]()[_0x5da5('0x63')](_0x5da5('0x65'))['from'](_0x5da5('0x5e'))['where'](_0x5da5('0x6d'),_0x4f7e64[_0x5da5('0x3e')]['id']['toString']()))[_0x5da5('0x36')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5da5('0x73')]()['field'](_0x5da5('0x74'))[_0x5da5('0x75')](_0x5da5('0x6c'))[_0x5da5('0x36')](_0x5da5('0x6d'),_0x4f7e64[_0x5da5('0x3e')]['id'][_0x5da5('0x70')]())[_0x5da5('0x36')](_0x5da5('0x76')))['group'](_0x5da5('0x60')))[_0x5da5('0x70')]();return db['sequelize']['query'](_0x12ef38);}return[];})[_0x5da5('0x24')](respondWithResult(_0x2adeab,null))[_0x5da5('0x42')](handleError(_0x2adeab,null));};exports[_0x5da5('0x77')]=function(_0xcc15e9,_0x4e9104,_0x1ba732){return db['Campaign'][_0x5da5('0x41')]({'where':{'id':_0xcc15e9['params']['id']}})['then'](handleEntityNotFound(_0x4e9104,null))[_0x5da5('0x24')](function(_0x5372f2){var _0x54ad39;if(_0x5372f2){_0x54ad39=squel[_0x5da5('0x5c')]()[_0x5da5('0x5d')](_0x5da5('0x5e'))[_0x5da5('0x78')]([_0x5da5('0x65'),_0x5da5('0x5f'),_0x5da5('0x60'),_0x5da5('0x61'),'CampaignId',_0x5da5('0x6a'),_0x5da5('0x6b')],squel[_0x5da5('0x73')]()[_0x5da5('0x63')](_0x5da5('0x64'),_0x5da5('0x65'))[_0x5da5('0x63')](_0x5da5('0x66'),_0x5da5('0x5f'))[_0x5da5('0x63')](_0x5da5('0x67'),_0x5da5('0x60'))[_0x5da5('0x63')](_0x5da5('0x68'),_0x5da5('0x61'))[_0x5da5('0x63')](_0x5da5('0x79'),_0x5da5('0x7a'))[_0x5da5('0x63')](_0x5da5('0x66'),_0x5da5('0x6a'))[_0x5da5('0x63')](_0x5da5('0x66'),_0x5da5('0x6b'))['from'](_0x5da5('0x6c'))[_0x5da5('0x36')]('CampaignId\x20=\x20?',_0xcc15e9[_0x5da5('0x3e')]['id']['toString']())[_0x5da5('0x36')](_0x5da5('0x6e'),_0xcc15e9[_0x5da5('0x44')][_0x5da5('0x6f')][_0x5da5('0x70')]())[_0x5da5('0x36')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x5da5('0x36')](_0x5da5('0x72'),squel['select']()[_0x5da5('0x63')](_0x5da5('0x65'))['from'](_0x5da5('0x5e'))[_0x5da5('0x36')](_0x5da5('0x7b'),_0xcc15e9[_0x5da5('0x3e')]['id'][_0x5da5('0x70')]()))[_0x5da5('0x36')](_0x5da5('0x72'),squel[_0x5da5('0x73')]()[_0x5da5('0x63')](_0x5da5('0x74'))['from'](_0x5da5('0x6c'))[_0x5da5('0x36')](_0x5da5('0x7b'),_0xcc15e9[_0x5da5('0x3e')]['id'][_0x5da5('0x70')]())[_0x5da5('0x36')](_0x5da5('0x76')))['group']('ContactId'))[_0x5da5('0x70')]();return db['sequelize']['query'](_0x54ad39);}return[];})[_0x5da5('0x24')](respondWithResult(_0x4e9104,null))['catch'](handleError(_0x4e9104,null));};exports[_0x5da5('0x7c')]=function(_0x59295f,_0xdc3a74,_0x2bb795){return db[_0x5da5('0x7d')][_0x5da5('0x7e')]({'where':{'VoiceQueueId':_0x59295f['body'][_0x5da5('0x62')],'CampaignId':_0x59295f[_0x5da5('0x44')][_0x5da5('0x7a')],'ContactId':_0x59295f[_0x5da5('0x44')][_0x5da5('0x60')]}})[_0x5da5('0x24')](handleEntityNotFound(_0xdc3a74,null))[_0x5da5('0x24')](function(_0x11bb6c){if(_0x11bb6c){return _0x11bb6c;}return null;})['then'](respondWithResult(_0xdc3a74,null))[_0x5da5('0x42')](handleError(_0xdc3a74,null));}; \ No newline at end of file +var _0x26c2=['COUNT','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','VoiceQueue','insert','cm_hopper','phone','scheduledAt','ListId','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','ContactId','moveContactsIvrCampaignHopperFinal','fromQuery','CampaignId','createdAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','CampaignId\x20=\x20?','checkContactHopper','findOne','VoiceQueueId','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','CmHopperFinal','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','describe','body','uniqueid','catch','countContactsQueueCampaignHopperFinal','findAll','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x26c2,0x130));var _0x226c=function(_0x4af93f,_0x13bdac){_0x4af93f=_0x4af93f-0x0;var _0x5f47fd=_0x26c2[_0x4af93f];return _0x5f47fd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x226c('0x0'));var jsonpatch=require(_0x226c('0x1'));var rp=require(_0x226c('0x2'));var moment=require(_0x226c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x226c('0x4'));var util=require(_0x226c('0x5'));var path=require('path');var sox=require(_0x226c('0x6'));var csv=require(_0x226c('0x7'));var ejs=require(_0x226c('0x8'));var fs=require('fs');var _=require(_0x226c('0x9'));var squel=require(_0x226c('0xa'));var crypto=require('crypto');var jsforce=require(_0x226c('0xb'));var deskjs=require(_0x226c('0xc'));var toCsv=require(_0x226c('0x7'));var querystring=require(_0x226c('0xd'));var Papa=require(_0x226c('0xe'));var Redis=require('ioredis');var authService=require(_0x226c('0xf'));var qs=require(_0x226c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x226c('0x11'))(_0x226c('0x12'));var utils=require(_0x226c('0x13'));var config=require(_0x226c('0x14'));var licenseUtil=require(_0x226c('0x15'));var db=require(_0x226c('0x16'))['db'];function respondWithStatusCode(_0x2964c2,_0x57dbc4){_0x57dbc4=_0x57dbc4||0xcc;return function(_0x481496){if(_0x481496){return _0x2964c2[_0x226c('0x17')](_0x57dbc4);}return _0x2964c2[_0x226c('0x18')](_0x57dbc4)[_0x226c('0x19')]();};}function respondWithResult(_0x36af55,_0x4eb557){_0x4eb557=_0x4eb557||0xc8;return function(_0x4bfd5c){if(_0x4bfd5c){return _0x36af55[_0x226c('0x18')](_0x4eb557)[_0x226c('0x1a')](_0x4bfd5c);}};}function respondWithFilteredResult(_0x15e13b,_0x55697c){return function(_0x5d6c21){if(_0x5d6c21){var _0x694eef=_0x5d6c21[_0x226c('0x1b')],_0x2e4a51=_0x55697c['offset'],_0x30755=_0x55697c['offset']+_0x55697c['limit'],_0x45a804;if(_0x30755>=_0x694eef){_0x30755=_0x694eef;_0x45a804=0xc8;}else{_0x45a804=0xce;}_0x15e13b[_0x226c('0x18')](_0x45a804);return _0x15e13b[_0x226c('0x1c')](_0x226c('0x1d'),_0x2e4a51+'-'+_0x30755+'/'+_0x694eef)[_0x226c('0x1a')](_0x5d6c21);}return null;};}function patchUpdates(_0x57c869){return function(_0x7fc168){try{jsonpatch[_0x226c('0x1e')](_0x7fc168,_0x57c869,!![]);}catch(_0xab9e6c){return BPromise[_0x226c('0x1f')](_0xab9e6c);}return _0x7fc168[_0x226c('0x20')]();};}function saveUpdates(_0x3d412a,_0x4dabf3){return function(_0x13bb6b){if(_0x13bb6b){return _0x13bb6b[_0x226c('0x21')](_0x3d412a)[_0x226c('0x22')](function(_0x269a8f){return _0x269a8f;});}return null;};}function removeEntity(_0x272f26,_0x57eb9f){return function(_0x575c7a){if(_0x575c7a){return _0x575c7a['destroy']()[_0x226c('0x22')](function(){_0x272f26[_0x226c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbaee21,_0x5b3919){return function(_0x3a862c){if(!_0x3a862c){_0xbaee21[_0x226c('0x17')](0x194);}return _0x3a862c;};}function handleError(_0x2a570a,_0x48341f){_0x48341f=_0x48341f||0x1f4;return function(_0x25165d){logger['error'](_0x25165d[_0x226c('0x23')]);if(_0x25165d['name']){delete _0x25165d[_0x226c('0x24')];}_0x2a570a[_0x226c('0x18')](_0x48341f)[_0x226c('0x25')](_0x25165d);};}exports['index']=function(_0x14c49b,_0x4a0b38){var _0xbe7c35={},_0x4f1b85={},_0x431875={'count':0x0,'rows':[]};var _0x539e59=_[_0x226c('0x26')](db[_0x226c('0x27')]['rawAttributes'],function(_0x54f175){return{'name':_0x54f175[_0x226c('0x28')],'type':_0x54f175[_0x226c('0x29')][_0x226c('0x2a')]};});_0x4f1b85[_0x226c('0x2b')]=_[_0x226c('0x26')](_0x539e59,_0x226c('0x24'));_0x4f1b85[_0x226c('0x2c')]=_[_0x226c('0x2d')](_0x14c49b[_0x226c('0x2c')]);_0x4f1b85[_0x226c('0x2e')]=_[_0x226c('0x2f')](_0x4f1b85[_0x226c('0x2b')],_0x4f1b85['query']);_0xbe7c35[_0x226c('0x30')]=_[_0x226c('0x2f')](_0x4f1b85[_0x226c('0x2b')],qs[_0x226c('0x31')](_0x14c49b[_0x226c('0x2c')]['fields']));_0xbe7c35[_0x226c('0x30')]=_0xbe7c35[_0x226c('0x30')][_0x226c('0x32')]?_0xbe7c35['attributes']:_0x4f1b85[_0x226c('0x2b')];if(!_0x14c49b['query'][_0x226c('0x33')](_0x226c('0x34'))){_0xbe7c35[_0x226c('0x35')]=qs[_0x226c('0x35')](_0x14c49b[_0x226c('0x2c')][_0x226c('0x35')]);_0xbe7c35[_0x226c('0x36')]=qs[_0x226c('0x36')](_0x14c49b[_0x226c('0x2c')][_0x226c('0x36')]);}_0xbe7c35[_0x226c('0x37')]=qs[_0x226c('0x38')](_0x14c49b[_0x226c('0x2c')][_0x226c('0x38')]);_0xbe7c35['where']=qs[_0x226c('0x2e')](_[_0x226c('0x39')](_0x14c49b[_0x226c('0x2c')],_0x4f1b85[_0x226c('0x2e')]),_0x539e59);if(_0x14c49b[_0x226c('0x2c')][_0x226c('0x3a')]){_0xbe7c35[_0x226c('0x3b')]=_[_0x226c('0x3c')](_0xbe7c35[_0x226c('0x3b')],{'$or':_['map'](_0x539e59,function(_0x5f517e){if(_0x5f517e[_0x226c('0x29')]!==_0x226c('0x3d')){var _0x312269={};_0x312269[_0x5f517e[_0x226c('0x24')]]={'$like':'%'+_0x14c49b[_0x226c('0x2c')][_0x226c('0x3a')]+'%'};return _0x312269;}})});}_0xbe7c35=_[_0x226c('0x3c')]({},_0xbe7c35,_0x14c49b[_0x226c('0x3e')]);var _0x182b01={'where':_0xbe7c35['where']};return db[_0x226c('0x27')]['count'](_0x182b01)[_0x226c('0x22')](function(_0x1a7d0d){_0x431875[_0x226c('0x1b')]=_0x1a7d0d;if(_0x14c49b['query']['includeAll']){_0xbe7c35[_0x226c('0x3f')]=[{'all':!![]}];}return db[_0x226c('0x27')]['findAll'](_0xbe7c35);})[_0x226c('0x22')](function(_0x11a16b){_0x431875[_0x226c('0x40')]=_0x11a16b;return _0x431875;})[_0x226c('0x22')](respondWithFilteredResult(_0x4a0b38,_0xbe7c35))['catch'](handleError(_0x4a0b38,null));};exports[_0x226c('0x41')]=function(_0x1e771d,_0x12f34d){var _0x54e3bc={'raw':!![],'where':{'id':_0x1e771d[_0x226c('0x42')]['id']}},_0x33e851={};_0x33e851[_0x226c('0x2b')]=_[_0x226c('0x2d')](db[_0x226c('0x27')]['rawAttributes']);_0x33e851['query']=_['keys'](_0x1e771d[_0x226c('0x2c')]);_0x33e851[_0x226c('0x2e')]=_[_0x226c('0x2f')](_0x33e851[_0x226c('0x2b')],_0x33e851[_0x226c('0x2c')]);_0x54e3bc[_0x226c('0x30')]=_[_0x226c('0x2f')](_0x33e851[_0x226c('0x2b')],qs[_0x226c('0x31')](_0x1e771d['query']['fields']));_0x54e3bc[_0x226c('0x30')]=_0x54e3bc[_0x226c('0x30')]['length']?_0x54e3bc[_0x226c('0x30')]:_0x33e851['model'];if(_0x1e771d['query'][_0x226c('0x43')]){_0x54e3bc['include']=[{'all':!![]}];}_0x54e3bc=_[_0x226c('0x3c')]({},_0x54e3bc,_0x1e771d[_0x226c('0x3e')]);return db[_0x226c('0x27')][_0x226c('0x44')](_0x54e3bc)[_0x226c('0x22')](handleEntityNotFound(_0x12f34d,null))[_0x226c('0x22')](respondWithResult(_0x12f34d,null))['catch'](handleError(_0x12f34d,null));};exports[_0x226c('0x45')]=function(_0x5699c2,_0x269d5a){return db[_0x226c('0x27')][_0x226c('0x45')]()[_0x226c('0x22')](respondWithResult(_0x269d5a,null))['catch'](handleError(_0x269d5a,null));};exports[_0x226c('0x21')]=function(_0x524088,_0x3fc603){if(_0x524088[_0x226c('0x46')][_0x226c('0x47')]){delete _0x524088[_0x226c('0x46')][_0x226c('0x47')];}return db[_0x226c('0x27')]['find']({'where':{'uniqueid':_0x524088[_0x226c('0x42')]['id']}})[_0x226c('0x22')](handleEntityNotFound(_0x3fc603,null))[_0x226c('0x22')](saveUpdates(_0x524088[_0x226c('0x46')],null))[_0x226c('0x22')](respondWithResult(_0x3fc603,null))[_0x226c('0x48')](handleError(_0x3fc603,null));};exports[_0x226c('0x49')]=function(_0x12f3f3,_0x3a9c77,_0xffb8d5){return db[_0x226c('0x27')][_0x226c('0x4a')]({'raw':![],'where':{'VoiceQueueId':_0x12f3f3['params']['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x226c('0x4b')]['fn']('IF',db[_0x226c('0x4b')][_0x226c('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),_0x226c('0x4d')],[db[_0x226c('0x4b')]['fn']('COUNT',db[_0x226c('0x4b')]['fn']('IF',db[_0x226c('0x4b')][_0x226c('0x4c')](_0x226c('0x4e')))),_0x226c('0x4f')],[db[_0x226c('0x4b')]['fn'](_0x226c('0x50'),db[_0x226c('0x4b')]['fn']('IF',db['sequelize'][_0x226c('0x4c')](_0x226c('0x51')))),'busyContacts'],[db[_0x226c('0x4b')]['fn'](_0x226c('0x50'),db[_0x226c('0x4b')]['fn']('IF',db[_0x226c('0x4b')][_0x226c('0x4c')](_0x226c('0x52')))),'congestionContacts'],[db[_0x226c('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x226c('0x4b')][_0x226c('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x226c('0x53')],[db[_0x226c('0x4b')]['fn'](_0x226c('0x50'),db['sequelize']['fn']('IF',db[_0x226c('0x4b')][_0x226c('0x4c')](_0x226c('0x54')))),_0x226c('0x55')],[db[_0x226c('0x4b')]['fn']('COUNT',db[_0x226c('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x226c('0x56')))),_0x226c('0x57')],[db[_0x226c('0x4b')]['fn']('COUNT',db[_0x226c('0x4b')]['fn']('IF',db[_0x226c('0x4b')]['literal'](_0x226c('0x58')))),_0x226c('0x59')]]})[_0x226c('0x22')](handleEntityNotFound(_0x3a9c77,null))['then'](respondWithResult(_0x3a9c77,null))['catch'](handleError(_0x3a9c77,null));};exports[_0x226c('0x5a')]=function(_0x55db16,_0x29d34c,_0xfb8c4b){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x55db16[_0x226c('0x42')]['id']},'attributes':[[db[_0x226c('0x4b')]['fn'](_0x226c('0x50'),db[_0x226c('0x4b')]['fn']('IF',db['sequelize'][_0x226c('0x4c')](_0x226c('0x5b')))),_0x226c('0x4d')],[db['sequelize']['fn'](_0x226c('0x50'),db['sequelize']['fn']('IF',db[_0x226c('0x4b')][_0x226c('0x4c')](_0x226c('0x4e')))),_0x226c('0x4f')],[db[_0x226c('0x4b')]['fn'](_0x226c('0x50'),db[_0x226c('0x4b')]['fn']('IF',db[_0x226c('0x4b')][_0x226c('0x4c')](_0x226c('0x51')))),_0x226c('0x5c')],[db[_0x226c('0x4b')]['fn']('COUNT',db[_0x226c('0x4b')]['fn']('IF',db[_0x226c('0x4b')][_0x226c('0x4c')](_0x226c('0x52')))),_0x226c('0x5d')],[db[_0x226c('0x4b')]['fn'](_0x226c('0x50'),db['sequelize']['fn']('IF',db[_0x226c('0x4b')]['literal'](_0x226c('0x5e')))),'dropContacts'],[db[_0x226c('0x4b')]['fn'](_0x226c('0x50'),db[_0x226c('0x4b')]['fn']('IF',db[_0x226c('0x4b')][_0x226c('0x4c')](_0x226c('0x54')))),_0x226c('0x55')],[db[_0x226c('0x4b')]['fn']('COUNT',db[_0x226c('0x4b')]['fn']('IF',db[_0x226c('0x4b')][_0x226c('0x4c')](_0x226c('0x56')))),_0x226c('0x57')],[db['sequelize']['fn'](_0x226c('0x50'),db['sequelize']['fn']('IF',db[_0x226c('0x4b')][_0x226c('0x4c')](_0x226c('0x58')))),_0x226c('0x59')]]})['then'](handleEntityNotFound(_0x29d34c,null))[_0x226c('0x22')](respondWithResult(_0x29d34c,null))[_0x226c('0x48')](handleError(_0x29d34c,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x19d927,_0x3fc153,_0x1016f1){return db[_0x226c('0x5f')][_0x226c('0x44')]({'where':{'id':_0x19d927[_0x226c('0x42')]['id']}})['then'](handleEntityNotFound(_0x3fc153,null))[_0x226c('0x22')](function(_0x8ba1f7){var _0x289fd7;if(_0x8ba1f7){_0x289fd7=squel[_0x226c('0x60')]()['into'](_0x226c('0x61'))['fromQuery']([_0x226c('0x62'),_0x226c('0x63'),'ContactId',_0x226c('0x64'),'VoiceQueueId','createdAt',_0x226c('0x65')],squel[_0x226c('0x66')]()[_0x226c('0x67')](_0x226c('0x68'),_0x226c('0x62'))['field'](_0x226c('0x69'),_0x226c('0x63'))[_0x226c('0x67')]('ANY_VALUE(ContactId)','ContactId')[_0x226c('0x67')]('ANY_VALUE(ListId)',_0x226c('0x64'))['field']('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0x226c('0x67')](_0x226c('0x69'),'createdAt')['field']('NOW()','updatedAt')[_0x226c('0x6a')]('cm_hopper_final')[_0x226c('0x3b')](_0x226c('0x6b'),_0x19d927[_0x226c('0x42')]['id'][_0x226c('0x6c')]())[_0x226c('0x3b')](_0x226c('0x6d'),_0x19d927[_0x226c('0x46')][_0x226c('0x6e')]['toString']())[_0x226c('0x3b')](_0x226c('0x6f'))[_0x226c('0x3b')](_0x226c('0x70'),squel[_0x226c('0x66')]()[_0x226c('0x67')](_0x226c('0x62'))[_0x226c('0x6a')]('cm_hopper')[_0x226c('0x3b')](_0x226c('0x6b'),_0x19d927[_0x226c('0x42')]['id'][_0x226c('0x6c')]()))[_0x226c('0x3b')](_0x226c('0x70'),squel[_0x226c('0x66')]()['field'](_0x226c('0x71'))[_0x226c('0x6a')](_0x226c('0x72'))[_0x226c('0x3b')](_0x226c('0x6b'),_0x19d927[_0x226c('0x42')]['id']['toString']())[_0x226c('0x3b')](_0x226c('0x73')))[_0x226c('0x74')](_0x226c('0x75')))[_0x226c('0x6c')]();return db[_0x226c('0x4b')][_0x226c('0x2c')](_0x289fd7);}return[];})['then'](respondWithResult(_0x3fc153,null))['catch'](handleError(_0x3fc153,null));};exports[_0x226c('0x76')]=function(_0x44d128,_0x4bdecf,_0xbd31d7){return db['Campaign']['find']({'where':{'id':_0x44d128[_0x226c('0x42')]['id']}})[_0x226c('0x22')](handleEntityNotFound(_0x4bdecf,null))[_0x226c('0x22')](function(_0x5ca16e){var _0x6ef63d;if(_0x5ca16e){_0x6ef63d=squel[_0x226c('0x60')]()['into'](_0x226c('0x61'))[_0x226c('0x77')](['phone',_0x226c('0x63'),_0x226c('0x75'),_0x226c('0x64'),_0x226c('0x78'),_0x226c('0x79'),_0x226c('0x65')],squel[_0x226c('0x66')]()[_0x226c('0x67')](_0x226c('0x68'),_0x226c('0x62'))[_0x226c('0x67')](_0x226c('0x69'),_0x226c('0x63'))[_0x226c('0x67')](_0x226c('0x7a'),'ContactId')['field'](_0x226c('0x7b'),'ListId')[_0x226c('0x67')]('ANY_VALUE(CampaignId)',_0x226c('0x78'))[_0x226c('0x67')](_0x226c('0x69'),_0x226c('0x79'))[_0x226c('0x67')](_0x226c('0x69'),_0x226c('0x65'))['from']('cm_hopper_final')[_0x226c('0x3b')]('CampaignId\x20=\x20?',_0x44d128[_0x226c('0x42')]['id'][_0x226c('0x6c')]())['where']('state\x20=\x20?',_0x44d128[_0x226c('0x46')][_0x226c('0x6e')][_0x226c('0x6c')]())['where'](_0x226c('0x6f'))[_0x226c('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x226c('0x66')]()[_0x226c('0x67')]('phone')[_0x226c('0x6a')]('cm_hopper')[_0x226c('0x3b')]('CampaignId\x20=\x20?',_0x44d128['params']['id'][_0x226c('0x6c')]()))[_0x226c('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x226c('0x66')]()['field'](_0x226c('0x71'))['from']('cm_hopper_final')[_0x226c('0x3b')](_0x226c('0x7c'),_0x44d128['params']['id'][_0x226c('0x6c')]())['where'](_0x226c('0x73')))[_0x226c('0x74')](_0x226c('0x75')))['toString']();return db[_0x226c('0x4b')][_0x226c('0x2c')](_0x6ef63d);}return[];})[_0x226c('0x22')](respondWithResult(_0x4bdecf,null))[_0x226c('0x48')](handleError(_0x4bdecf,null));};exports[_0x226c('0x7d')]=function(_0x404cfc,_0x5d6886,_0x1c5270){return db['CmHopper'][_0x226c('0x7e')]({'where':{'VoiceQueueId':_0x404cfc[_0x226c('0x46')][_0x226c('0x7f')],'CampaignId':_0x404cfc[_0x226c('0x46')][_0x226c('0x78')],'ContactId':_0x404cfc[_0x226c('0x46')][_0x226c('0x75')]}})[_0x226c('0x22')](handleEntityNotFound(_0x5d6886,null))[_0x226c('0x22')](function(_0x383326){if(_0x383326){return _0x383326;}return null;})[_0x226c('0x22')](respondWithResult(_0x5d6886,null))[_0x226c('0x48')](handleError(_0x5d6886,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2720130..7542ae4 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 _0x3fd4=['rimraf','../../config/environment','CmHopperFinal','cm_hopper_final','calleridnum','util','bluebird'];(function(_0x14c4f2,_0x4df4b1){var _0x255998=function(_0xb6209b){while(--_0xb6209b){_0x14c4f2['push'](_0x14c4f2['shift']());}};_0x255998(++_0x4df4b1);}(_0x3fd4,0x14e));var _0x43fd=function(_0x4d5cc4,_0x1ebc39){_0x4d5cc4=_0x4d5cc4-0x0;var _0x246885=_0x3fd4[_0x4d5cc4];return _0x246885;};'use strict';var _=require('lodash');var util=require(_0x43fd('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x43fd('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x43fd('0x2'));var config=require(_0x43fd('0x3'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x5cb247,_0x5c19e6){return _0x5cb247['define'](_0x43fd('0x4'),attributes,{'tableName':_0x43fd('0x5'),'paranoid':![],'indexes':[{'name':_0x43fd('0x6'),'fields':['calleridnum']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4dc4=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x37d967,_0x179fb7){var _0x13cf91=function(_0x5024f7){while(--_0x5024f7){_0x37d967['push'](_0x37d967['shift']());}};_0x13cf91(++_0x179fb7);}(_0x4dc4,0xa3));var _0x44dc=function(_0x5935c6,_0xb6e02){_0x5935c6=_0x5935c6-0x0;var _0xca64d7=_0x4dc4[_0x5935c6];return _0xca64d7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x44dc('0x0'))(_0x44dc('0x1'));var moment=require(_0x44dc('0x2'));var BPromise=require(_0x44dc('0x3'));var rp=require(_0x44dc('0x4'));var fs=require('fs');var path=require(_0x44dc('0x5'));var rimraf=require(_0x44dc('0x6'));var config=require(_0x44dc('0x7'));var attributes=require(_0x44dc('0x8'));module[_0x44dc('0x9')]=function(_0x32e59c,_0x598e05){return _0x32e59c[_0x44dc('0xa')]('CmHopperFinal',attributes,{'tableName':_0x44dc('0xb'),'paranoid':![],'indexes':[{'name':_0x44dc('0xc'),'fields':[_0x44dc('0xc')]},{'name':_0x44dc('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index c6f21ce..089e6eb 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 _0xa055=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal'];(function(_0x4e7703,_0x4473a1){var _0x552e03=function(_0x14f7f0){while(--_0x14f7f0){_0x4e7703['push'](_0x4e7703['shift']());}};_0x552e03(++_0x4473a1);}(_0xa055,0xd2));var _0x5a05=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xa055[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x5a05('0x0'));var util=require('util');var moment=require(_0x5a05('0x1'));var BPromise=require(_0x5a05('0x2'));var rs=require(_0x5a05('0x3'));var fs=require('fs');var Redis=require(_0x5a05('0x4'));var db=require(_0x5a05('0x5'))['db'];var utils=require(_0x5a05('0x6'));var logger=require(_0x5a05('0x7'))(_0x5a05('0x8'));var config=require('../../config/environment');var jayson=require(_0x5a05('0x9'));var client=jayson[_0x5a05('0xa')][_0x5a05('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x230991,_0x25d438,_0x1af462){return new BPromise(function(_0x5976ce,_0x5cacc3){return client[_0x5a05('0xc')](_0x230991,_0x1af462)[_0x5a05('0xd')](function(_0x5917ad){logger[_0x5a05('0xe')](_0x5a05('0xf'),_0x25d438,_0x5a05('0x10'));logger[_0x5a05('0x11')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x25d438,_0x5a05('0x10'),JSON[_0x5a05('0x12')](_0x5917ad));if(_0x5917ad[_0x5a05('0x13')]){if(_0x5917ad[_0x5a05('0x13')][_0x5a05('0x14')]===0x1f4){logger['error'](_0x5a05('0xf'),_0x25d438,_0x5917ad['error'][_0x5a05('0x15')]);return _0x5cacc3(_0x5917ad[_0x5a05('0x13')][_0x5a05('0x15')]);}logger[_0x5a05('0x13')](_0x5a05('0xf'),_0x25d438,_0x5917ad['error'][_0x5a05('0x15')]);return _0x5976ce(_0x5917ad[_0x5a05('0x13')][_0x5a05('0x15')]);}else{logger[_0x5a05('0xe')](_0x5a05('0xf'),_0x25d438,_0x5a05('0x10'));_0x5976ce(_0x5917ad[_0x5a05('0x16')][_0x5a05('0x15')]);}})[_0x5a05('0x17')](function(_0x5be547){logger['error'](_0x5a05('0xf'),_0x25d438,_0x5be547);_0x5cacc3(_0x5be547);});});}exports['CreateCmHopperFinal']=function(_0x5a72b5){var _0x377964=this;return new Promise(function(_0x5639fc,_0x2eaf9c){return db[_0x5a05('0x18')][_0x5a05('0x19')](_0x5a72b5[_0x5a05('0x1a')],{'raw':_0x5a72b5[_0x5a05('0x1b')]?_0x5a72b5['options'][_0x5a05('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x244d17){logger['info'](_0x5a05('0x1d'),_0x5a72b5);logger['debug'](_0x5a05('0x1d'),_0x5a72b5,JSON['stringify'](_0x244d17));_0x5639fc(_0x244d17);})['catch'](function(_0x1db0d1){logger[_0x5a05('0x13')](_0x5a05('0x1d'),_0x1db0d1[_0x5a05('0x15')],_0x5a72b5);_0x2eaf9c(_0x377964[_0x5a05('0x13')](0x1f4,_0x1db0d1['message']));});});}; \ No newline at end of file +var _0xf082=['lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','CmHopperFinal,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','info','debug'];(function(_0x4be51a,_0x1519da){var _0xaca7e5=function(_0x254b84){while(--_0x254b84){_0x4be51a['push'](_0x4be51a['shift']());}};_0xaca7e5(++_0x1519da);}(_0xf082,0x1a9));var _0x2f08=function(_0xfaa605,_0x2f02dd){_0xfaa605=_0xfaa605-0x0;var _0x108c8b=_0xf082[_0xfaa605];return _0x108c8b;};'use strict';var _=require(_0x2f08('0x0'));var util=require('util');var moment=require(_0x2f08('0x1'));var BPromise=require('bluebird');var rs=require(_0x2f08('0x2'));var fs=require('fs');var Redis=require(_0x2f08('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f08('0x4'));var logger=require(_0x2f08('0x5'))(_0x2f08('0x6'));var config=require(_0x2f08('0x7'));var jayson=require(_0x2f08('0x8'));var client=jayson[_0x2f08('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3695b3,_0x5e91f1,_0x5f33f3){return new BPromise(function(_0x53fff4,_0x53b64a){return client[_0x2f08('0xa')](_0x3695b3,_0x5f33f3)['then'](function(_0x24abe7){logger['info'](_0x2f08('0xb'),_0x5e91f1,_0x2f08('0xc'));logger['debug']('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x5e91f1,'request\x20sent',JSON['stringify'](_0x24abe7));if(_0x24abe7['error']){if(_0x24abe7[_0x2f08('0xd')][_0x2f08('0xe')]===0x1f4){logger[_0x2f08('0xd')]('CmHopperFinal,\x20%s,\x20%s',_0x5e91f1,_0x24abe7[_0x2f08('0xd')]['message']);return _0x53b64a(_0x24abe7[_0x2f08('0xd')]['message']);}logger['error'](_0x2f08('0xb'),_0x5e91f1,_0x24abe7[_0x2f08('0xd')][_0x2f08('0xf')]);return _0x53fff4(_0x24abe7[_0x2f08('0xd')][_0x2f08('0xf')]);}else{logger['info'](_0x2f08('0xb'),_0x5e91f1,_0x2f08('0xc'));_0x53fff4(_0x24abe7[_0x2f08('0x10')][_0x2f08('0xf')]);}})[_0x2f08('0x11')](function(_0x1c73da){logger[_0x2f08('0xd')](_0x2f08('0xb'),_0x5e91f1,_0x1c73da);_0x53b64a(_0x1c73da);});});}exports[_0x2f08('0x12')]=function(_0x55d09e){var _0x19cc40=this;return new Promise(function(_0x144e83,_0x4def61){return db[_0x2f08('0x13')][_0x2f08('0x14')](_0x55d09e[_0x2f08('0x15')],{'raw':_0x55d09e[_0x2f08('0x16')]?_0x55d09e[_0x2f08('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x114483){logger[_0x2f08('0x17')](_0x2f08('0x12'),_0x55d09e);logger[_0x2f08('0x18')](_0x2f08('0x12'),_0x55d09e,JSON['stringify'](_0x114483));_0x144e83(_0x114483);})[_0x2f08('0x11')](function(_0x58ca47){logger[_0x2f08('0xd')](_0x2f08('0x12'),_0x58ca47[_0x2f08('0xf')],_0x55d09e);_0x4def61(_0x19cc40[_0x2f08('0xd')](0x1f4,_0x58ca47[_0x2f08('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 660e38f..3017093 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 _0x1dff=['/:id','show','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0x1dff,0xed));var _0xf1df=function(_0x2fdaca,_0x1333a7){_0x2fdaca=_0x2fdaca-0x0;var _0x3028a6=_0x1dff[_0x2fdaca];return _0x3028a6;};'use strict';var multer=require('multer');var util=require(_0xf1df('0x0'));var path=require('path');var timeout=require(_0xf1df('0x1'));var express=require(_0xf1df('0x2'));var router=express[_0xf1df('0x3')]();var auth=require(_0xf1df('0x4'));var interaction=require(_0xf1df('0x5'));var config=require(_0xf1df('0x6'));var controller=require(_0xf1df('0x7'));router['get']('/',auth[_0xf1df('0x8')](),controller[_0xf1df('0x9')]);router[_0xf1df('0xa')](_0xf1df('0xb'),auth[_0xf1df('0x8')](),controller[_0xf1df('0xc')]);router[_0xf1df('0xa')](_0xf1df('0xd'),auth[_0xf1df('0x8')](),controller[_0xf1df('0xe')]);router[_0xf1df('0xa')]('/voice/queue/countAttributes/:id',auth[_0xf1df('0x8')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xf1df('0xa')]('/campaign/countAttributes/:id',auth[_0xf1df('0x8')](),controller[_0xf1df('0xf')]);router['post'](_0xf1df('0x10'),auth[_0xf1df('0x8')](),controller[_0xf1df('0x11')]);router[_0xf1df('0x12')](_0xf1df('0x13'),auth[_0xf1df('0x8')](),controller[_0xf1df('0x14')]);router[_0xf1df('0x12')](_0xf1df('0x15'),auth['isAuthenticated'](),controller[_0xf1df('0x16')]);router[_0xf1df('0x17')](_0xf1df('0xd'),auth[_0xf1df('0x8')](),controller['update']);module[_0xf1df('0x18')]=router; \ No newline at end of file +var _0x2ab8=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','update','exports','multer','util','Router','../../components/auth/service'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2ab8,0x1c4));var _0x82ab=function(_0x201ae8,_0x163522){_0x201ae8=_0x201ae8-0x0;var _0x1fce4c=_0x2ab8[_0x201ae8];return _0x1fce4c;};'use strict';var multer=require(_0x82ab('0x0'));var util=require(_0x82ab('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x82ab('0x2')]();var auth=require(_0x82ab('0x3'));var interaction=require(_0x82ab('0x4'));var config=require(_0x82ab('0x5'));var controller=require(_0x82ab('0x6'));router[_0x82ab('0x7')]('/',auth[_0x82ab('0x8')](),controller[_0x82ab('0x9')]);router[_0x82ab('0x7')](_0x82ab('0xa'),auth[_0x82ab('0x8')](),controller[_0x82ab('0xb')]);router[_0x82ab('0x7')](_0x82ab('0xc'),auth[_0x82ab('0x8')](),controller['show']);router['get'](_0x82ab('0xd'),auth['isAuthenticated'](),controller[_0x82ab('0xe')]);router[_0x82ab('0x7')](_0x82ab('0xf'),auth[_0x82ab('0x8')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x82ab('0x10')](_0x82ab('0x11'),auth[_0x82ab('0x8')](),controller[_0x82ab('0x12')]);router[_0x82ab('0x10')](_0x82ab('0x13'),auth['isAuthenticated'](),controller[_0x82ab('0x14')]);router['post'](_0x82ab('0x15'),auth['isAuthenticated'](),controller['checkContactHopper']);router['put'](_0x82ab('0xc'),auth['isAuthenticated'](),controller[_0x82ab('0x16')]);module[_0x82ab('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 170bb56..a094de3 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 _0x72e8=['exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x32336b,_0x4a7dae){var _0x449eaa=function(_0x2af318){while(--_0x2af318){_0x32336b['push'](_0x32336b['shift']());}};_0x449eaa(++_0x4a7dae);}(_0x72e8,0x113));var _0x872e=function(_0x5405b2,_0x3b9314){_0x5405b2=_0x5405b2-0x0;var _0x56e99e=_0x72e8[_0x5405b2];return _0x56e99e;};'use strict';var Sequelize=require('sequelize');module[_0x872e('0x0')]={'state':{'type':Sequelize[_0x872e('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x872e('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x872e('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x872e('0x2')]},'calleridname':{'type':Sequelize[_0x872e('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x872e('0x3')]},'answertime':{'type':Sequelize[_0x872e('0x3')]},'droptime':{'type':Sequelize[_0x872e('0x3')]},'endtime':{'type':Sequelize[_0x872e('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x872e('0x2')]},'campaign':{'type':Sequelize[_0x872e('0x2')]},'campaigntype':{'type':Sequelize[_0x872e('0x2')]},'membername':{'type':Sequelize[_0x872e('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x872e('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x872e('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x872e('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x872e('0x3')]},'recallme':{'type':Sequelize[_0x872e('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x872e('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0603=['exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x3c89f7,_0x138186){var _0x33db1b=function(_0x365fe4){while(--_0x365fe4){_0x3c89f7['push'](_0x3c89f7['shift']());}};_0x33db1b(++_0x138186);}(_0x0603,0x118));var _0x3060=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x0603[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require('sequelize');module[_0x3060('0x0')]={'state':{'type':Sequelize[_0x3060('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x3060('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x3060('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3060('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3060('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x3060('0x2')]},'originatecalleridname':{'type':Sequelize[_0x3060('0x2')]},'calleridnum':{'type':Sequelize[_0x3060('0x2')]},'calleridname':{'type':Sequelize[_0x3060('0x2')]},'starttime':{'type':Sequelize[_0x3060('0x3')]},'responsetime':{'type':Sequelize[_0x3060('0x3')]},'answertime':{'type':Sequelize[_0x3060('0x3')]},'droptime':{'type':Sequelize[_0x3060('0x3')]},'endtime':{'type':Sequelize[_0x3060('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3060('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3060('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x3060('0x2')]},'campaigntype':{'type':Sequelize[_0x3060('0x2')]},'membername':{'type':Sequelize[_0x3060('0x2')]},'reason':{'type':Sequelize[_0x3060('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x3060('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x3060('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3060('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x3060('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x3060('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3060('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3060('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 2f43849..b1ca587 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 _0x721d=['filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','describe','uniqueid','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','save','then','destroy','error','name','index','map','CmHopperHistory','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x721d,0x1ce));var _0xd721=function(_0x184118,_0xfa5f7){_0x184118=_0x184118-0x0;var _0x2582bf=_0x721d[_0x184118];return _0x2582bf;};'use strict';var pdf=require(_0xd721('0x0'));var emlformat=require(_0xd721('0x1'));var rimraf=require(_0xd721('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd721('0x3'));var rp=require(_0xd721('0x4'));var moment=require('moment');var BPromise=require(_0xd721('0x5'));var Mustache=require(_0xd721('0x6'));var util=require(_0xd721('0x7'));var path=require('path');var sox=require(_0xd721('0x8'));var csv=require('to-csv');var ejs=require(_0xd721('0x9'));var fs=require('fs');var _=require(_0xd721('0xa'));var squel=require(_0xd721('0xb'));var crypto=require(_0xd721('0xc'));var jsforce=require(_0xd721('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd721('0xe'));var querystring=require(_0xd721('0xf'));var Papa=require(_0xd721('0x10'));var Redis=require(_0xd721('0x11'));var authService=require(_0xd721('0x12'));var qs=require(_0xd721('0x13'));var as=require(_0xd721('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd721('0x15'))(_0xd721('0x16'));var utils=require(_0xd721('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd721('0x18'));var db=require(_0xd721('0x19'))['db'];function respondWithStatusCode(_0x5e85b7,_0x4f8293){_0x4f8293=_0x4f8293||0xcc;return function(_0x218f95){if(_0x218f95){return _0x5e85b7[_0xd721('0x1a')](_0x4f8293);}return _0x5e85b7[_0xd721('0x1b')](_0x4f8293)['end']();};}function respondWithResult(_0x10638e,_0x434059){_0x434059=_0x434059||0xc8;return function(_0x4d79e4){if(_0x4d79e4){return _0x10638e['status'](_0x434059)[_0xd721('0x1c')](_0x4d79e4);}};}function respondWithFilteredResult(_0x113954,_0x180d53){return function(_0xf2c7f6){if(_0xf2c7f6){var _0x5f3775=_0xf2c7f6[_0xd721('0x1d')],_0x42e85c=_0x180d53[_0xd721('0x1e')],_0xf527c4=_0x180d53['offset']+_0x180d53['limit'],_0x3e1273;if(_0xf527c4>=_0x5f3775){_0xf527c4=_0x5f3775;_0x3e1273=0xc8;}else{_0x3e1273=0xce;}_0x113954['status'](_0x3e1273);return _0x113954['set'](_0xd721('0x1f'),_0x42e85c+'-'+_0xf527c4+'/'+_0x5f3775)[_0xd721('0x1c')](_0xf2c7f6);}return null;};}function patchUpdates(_0x20674c){return function(_0x384ce0){try{jsonpatch[_0xd721('0x20')](_0x384ce0,_0x20674c,!![]);}catch(_0x2213a3){return BPromise['reject'](_0x2213a3);}return _0x384ce0[_0xd721('0x21')]();};}function saveUpdates(_0x2f0302,_0x198789){return function(_0x4fa791){if(_0x4fa791){return _0x4fa791['update'](_0x2f0302)[_0xd721('0x22')](function(_0x39ddda){return _0x39ddda;});}return null;};}function removeEntity(_0x13f4d3,_0x1f313f){return function(_0x2b0ff7){if(_0x2b0ff7){return _0x2b0ff7[_0xd721('0x23')]()[_0xd721('0x22')](function(){_0x13f4d3[_0xd721('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ba94e,_0x5d80eb){return function(_0x4b2fa1){if(!_0x4b2fa1){_0x4ba94e['sendStatus'](0x194);}return _0x4b2fa1;};}function handleError(_0x38c725,_0x5b3ce4){_0x5b3ce4=_0x5b3ce4||0x1f4;return function(_0x88d3e3){logger[_0xd721('0x24')](_0x88d3e3['stack']);if(_0x88d3e3[_0xd721('0x25')]){delete _0x88d3e3[_0xd721('0x25')];}_0x38c725[_0xd721('0x1b')](_0x5b3ce4)['send'](_0x88d3e3);};}exports[_0xd721('0x26')]=function(_0x1e492e,_0x4c6fdf){var _0x74ce87={},_0x429a41={},_0x9f4e49={'count':0x0,'rows':[]};var _0x335b3f=_[_0xd721('0x27')](db[_0xd721('0x28')]['rawAttributes'],function(_0x2f09cb){return{'name':_0x2f09cb[_0xd721('0x29')],'type':_0x2f09cb['type'][_0xd721('0x2a')]};});_0x429a41[_0xd721('0x2b')]=_[_0xd721('0x27')](_0x335b3f,'name');_0x429a41[_0xd721('0x2c')]=_[_0xd721('0x2d')](_0x1e492e[_0xd721('0x2c')]);_0x429a41[_0xd721('0x2e')]=_[_0xd721('0x2f')](_0x429a41[_0xd721('0x2b')],_0x429a41['query']);_0x74ce87['attributes']=_[_0xd721('0x2f')](_0x429a41[_0xd721('0x2b')],qs[_0xd721('0x30')](_0x1e492e[_0xd721('0x2c')][_0xd721('0x30')]));_0x74ce87['attributes']=_0x74ce87[_0xd721('0x31')][_0xd721('0x32')]?_0x74ce87[_0xd721('0x31')]:_0x429a41[_0xd721('0x2b')];if(!_0x1e492e[_0xd721('0x2c')][_0xd721('0x33')](_0xd721('0x34'))){_0x74ce87[_0xd721('0x35')]=qs[_0xd721('0x35')](_0x1e492e[_0xd721('0x2c')][_0xd721('0x35')]);_0x74ce87[_0xd721('0x1e')]=qs[_0xd721('0x1e')](_0x1e492e[_0xd721('0x2c')]['offset']);}_0x74ce87['order']=qs['sort'](_0x1e492e['query'][_0xd721('0x36')]);_0x74ce87[_0xd721('0x37')]=qs[_0xd721('0x2e')](_['pick'](_0x1e492e[_0xd721('0x2c')],_0x429a41['filters']),_0x335b3f);if(_0x1e492e[_0xd721('0x2c')][_0xd721('0x38')]){_0x74ce87[_0xd721('0x37')]=_[_0xd721('0x39')](_0x74ce87[_0xd721('0x37')],{'$or':_[_0xd721('0x27')](_0x335b3f,function(_0x5a51db){if(_0x5a51db[_0xd721('0x3a')]!==_0xd721('0x3b')){var _0xefd951={};_0xefd951[_0x5a51db['name']]={'$like':'%'+_0x1e492e[_0xd721('0x2c')][_0xd721('0x38')]+'%'};return _0xefd951;}})});}_0x74ce87=_[_0xd721('0x39')]({},_0x74ce87,_0x1e492e[_0xd721('0x3c')]);var _0x596390={'where':_0x74ce87[_0xd721('0x37')]};return db[_0xd721('0x28')][_0xd721('0x1d')](_0x596390)[_0xd721('0x22')](function(_0x2aa68b){_0x9f4e49[_0xd721('0x1d')]=_0x2aa68b;if(_0x1e492e[_0xd721('0x2c')][_0xd721('0x3d')]){_0x74ce87[_0xd721('0x3e')]=[{'all':!![]}];}return db[_0xd721('0x28')][_0xd721('0x3f')](_0x74ce87);})[_0xd721('0x22')](function(_0x703264){_0x9f4e49[_0xd721('0x40')]=_0x703264;return _0x9f4e49;})[_0xd721('0x22')](respondWithFilteredResult(_0x4c6fdf,_0x74ce87))[_0xd721('0x41')](handleError(_0x4c6fdf,null));};exports[_0xd721('0x42')]=function(_0x1b1e7f,_0x192207){var _0x36d274={'raw':!![],'where':{'id':_0x1b1e7f[_0xd721('0x43')]['id']}},_0x1d1a3f={};_0x1d1a3f[_0xd721('0x2b')]=_[_0xd721('0x2d')](db[_0xd721('0x28')][_0xd721('0x44')]);_0x1d1a3f[_0xd721('0x2c')]=_['keys'](_0x1b1e7f[_0xd721('0x2c')]);_0x1d1a3f['filters']=_[_0xd721('0x2f')](_0x1d1a3f[_0xd721('0x2b')],_0x1d1a3f[_0xd721('0x2c')]);_0x36d274[_0xd721('0x31')]=_['intersection'](_0x1d1a3f['model'],qs[_0xd721('0x30')](_0x1b1e7f[_0xd721('0x2c')][_0xd721('0x30')]));_0x36d274[_0xd721('0x31')]=_0x36d274['attributes'][_0xd721('0x32')]?_0x36d274['attributes']:_0x1d1a3f['model'];if(_0x1b1e7f[_0xd721('0x2c')][_0xd721('0x3d')]){_0x36d274[_0xd721('0x3e')]=[{'all':!![]}];}_0x36d274=_[_0xd721('0x39')]({},_0x36d274,_0x1b1e7f['options']);return db['CmHopperHistory']['find'](_0x36d274)[_0xd721('0x22')](handleEntityNotFound(_0x192207,null))[_0xd721('0x22')](respondWithResult(_0x192207,null))[_0xd721('0x41')](handleError(_0x192207,null));};exports[_0xd721('0x45')]=function(_0x58c09e,_0x4475f2){return db[_0xd721('0x28')][_0xd721('0x45')](_0x58c09e[_0xd721('0x46')],{})[_0xd721('0x22')](respondWithResult(_0x4475f2,0xc9))[_0xd721('0x41')](handleError(_0x4475f2,null));};exports[_0xd721('0x47')]=function(_0x554e42,_0x266eef){return db[_0xd721('0x28')][_0xd721('0x47')]()[_0xd721('0x22')](respondWithResult(_0x266eef,null))['catch'](handleError(_0x266eef,null));};exports['update']=function(_0x171d7a,_0x25d0dd){if(_0x171d7a[_0xd721('0x46')][_0xd721('0x48')]){delete _0x171d7a['body']['uniqueid'];}return db[_0xd721('0x28')][_0xd721('0x49')]({'where':{'uniqueid':_0x171d7a[_0xd721('0x43')]['id']}})[_0xd721('0x22')](handleEntityNotFound(_0x25d0dd,null))[_0xd721('0x22')](saveUpdates(_0x171d7a['body'],null))[_0xd721('0x22')](respondWithResult(_0x25d0dd,null))['catch'](handleError(_0x25d0dd,null));}; \ No newline at end of file +var _0x74cd=['show','catch','create','describe','update','uniqueid','find','params','eml-format','rimraf','fast-json-patch','moment','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','destroy','then','error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows'];(function(_0x337f92,_0x3723fe){var _0x4df750=function(_0xc6fd0e){while(--_0xc6fd0e){_0x337f92['push'](_0x337f92['shift']());}};_0x4df750(++_0x3723fe);}(_0x74cd,0x175));var _0xd74c=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x74cd[_0x238671];return _0x474844;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd74c('0x0'));var rimraf=require(_0xd74c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd74c('0x2'));var rp=require('request-promise');var moment=require(_0xd74c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd74c('0x4'));var sox=require(_0xd74c('0x5'));var csv=require('to-csv');var ejs=require(_0xd74c('0x6'));var fs=require('fs');var _=require(_0xd74c('0x7'));var squel=require(_0xd74c('0x8'));var crypto=require(_0xd74c('0x9'));var jsforce=require(_0xd74c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd74c('0xb'));var querystring=require(_0xd74c('0xc'));var Papa=require('papaparse');var Redis=require(_0xd74c('0xd'));var authService=require(_0xd74c('0xe'));var qs=require(_0xd74c('0xf'));var as=require(_0xd74c('0x10'));var hardwareService=require(_0xd74c('0x11'));var logger=require(_0xd74c('0x12'))(_0xd74c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd74c('0x14'));var db=require(_0xd74c('0x15'))['db'];function respondWithStatusCode(_0x4fb6d6,_0x5d6b21){_0x5d6b21=_0x5d6b21||0xcc;return function(_0x534bdb){if(_0x534bdb){return _0x4fb6d6[_0xd74c('0x16')](_0x5d6b21);}return _0x4fb6d6[_0xd74c('0x17')](_0x5d6b21)[_0xd74c('0x18')]();};}function respondWithResult(_0x20d20d,_0x549813){_0x549813=_0x549813||0xc8;return function(_0x483ad1){if(_0x483ad1){return _0x20d20d[_0xd74c('0x17')](_0x549813)[_0xd74c('0x19')](_0x483ad1);}};}function respondWithFilteredResult(_0x3b4bff,_0x1e8fb9){return function(_0x283349){if(_0x283349){var _0x218d9e=_0x283349[_0xd74c('0x1a')],_0x2afe28=_0x1e8fb9['offset'],_0x7b358f=_0x1e8fb9[_0xd74c('0x1b')]+_0x1e8fb9[_0xd74c('0x1c')],_0x525ec6;if(_0x7b358f>=_0x218d9e){_0x7b358f=_0x218d9e;_0x525ec6=0xc8;}else{_0x525ec6=0xce;}_0x3b4bff[_0xd74c('0x17')](_0x525ec6);return _0x3b4bff[_0xd74c('0x1d')](_0xd74c('0x1e'),_0x2afe28+'-'+_0x7b358f+'/'+_0x218d9e)['json'](_0x283349);}return null;};}function patchUpdates(_0x1c01ec){return function(_0x592ee9){try{jsonpatch[_0xd74c('0x1f')](_0x592ee9,_0x1c01ec,!![]);}catch(_0x4722a6){return BPromise['reject'](_0x4722a6);}return _0x592ee9['save']();};}function saveUpdates(_0x36971e,_0x3ce5ab){return function(_0x2e90c6){if(_0x2e90c6){return _0x2e90c6['update'](_0x36971e)['then'](function(_0x1dd098){return _0x1dd098;});}return null;};}function removeEntity(_0xe1a43a,_0x198881){return function(_0x51fa18){if(_0x51fa18){return _0x51fa18[_0xd74c('0x20')]()[_0xd74c('0x21')](function(){_0xe1a43a[_0xd74c('0x17')](0xcc)[_0xd74c('0x18')]();});}};}function handleEntityNotFound(_0x40871e,_0x26ba5d){return function(_0x16f432){if(!_0x16f432){_0x40871e['sendStatus'](0x194);}return _0x16f432;};}function handleError(_0x3e2209,_0x9b5036){_0x9b5036=_0x9b5036||0x1f4;return function(_0x4a087b){logger[_0xd74c('0x22')](_0x4a087b[_0xd74c('0x23')]);if(_0x4a087b[_0xd74c('0x24')]){delete _0x4a087b['name'];}_0x3e2209['status'](_0x9b5036)[_0xd74c('0x25')](_0x4a087b);};}exports[_0xd74c('0x26')]=function(_0xdcf351,_0x4daa8b){var _0x13879d={},_0x5b5a5e={},_0x45a646={'count':0x0,'rows':[]};var _0x3f7283=_['map'](db[_0xd74c('0x27')][_0xd74c('0x28')],function(_0x56f30a){return{'name':_0x56f30a[_0xd74c('0x29')],'type':_0x56f30a[_0xd74c('0x2a')][_0xd74c('0x2b')]};});_0x5b5a5e[_0xd74c('0x2c')]=_[_0xd74c('0x2d')](_0x3f7283,_0xd74c('0x24'));_0x5b5a5e[_0xd74c('0x2e')]=_[_0xd74c('0x2f')](_0xdcf351[_0xd74c('0x2e')]);_0x5b5a5e[_0xd74c('0x30')]=_['intersection'](_0x5b5a5e[_0xd74c('0x2c')],_0x5b5a5e[_0xd74c('0x2e')]);_0x13879d['attributes']=_[_0xd74c('0x31')](_0x5b5a5e[_0xd74c('0x2c')],qs[_0xd74c('0x32')](_0xdcf351['query']['fields']));_0x13879d[_0xd74c('0x33')]=_0x13879d[_0xd74c('0x33')][_0xd74c('0x34')]?_0x13879d[_0xd74c('0x33')]:_0x5b5a5e[_0xd74c('0x2c')];if(!_0xdcf351[_0xd74c('0x2e')][_0xd74c('0x35')](_0xd74c('0x36'))){_0x13879d[_0xd74c('0x1c')]=qs[_0xd74c('0x1c')](_0xdcf351[_0xd74c('0x2e')]['limit']);_0x13879d[_0xd74c('0x1b')]=qs[_0xd74c('0x1b')](_0xdcf351['query']['offset']);}_0x13879d[_0xd74c('0x37')]=qs['sort'](_0xdcf351[_0xd74c('0x2e')]['sort']);_0x13879d['where']=qs[_0xd74c('0x30')](_[_0xd74c('0x38')](_0xdcf351['query'],_0x5b5a5e[_0xd74c('0x30')]),_0x3f7283);if(_0xdcf351['query'][_0xd74c('0x39')]){_0x13879d['where']=_[_0xd74c('0x3a')](_0x13879d[_0xd74c('0x3b')],{'$or':_[_0xd74c('0x2d')](_0x3f7283,function(_0x3f3e9a){if(_0x3f3e9a['type']!==_0xd74c('0x3c')){var _0x39dfa9={};_0x39dfa9[_0x3f3e9a[_0xd74c('0x24')]]={'$like':'%'+_0xdcf351[_0xd74c('0x2e')][_0xd74c('0x39')]+'%'};return _0x39dfa9;}})});}_0x13879d=_[_0xd74c('0x3a')]({},_0x13879d,_0xdcf351[_0xd74c('0x3d')]);var _0x5bedde={'where':_0x13879d[_0xd74c('0x3b')]};return db['CmHopperHistory'][_0xd74c('0x1a')](_0x5bedde)[_0xd74c('0x21')](function(_0x10917b){_0x45a646[_0xd74c('0x1a')]=_0x10917b;if(_0xdcf351['query'][_0xd74c('0x3e')]){_0x13879d[_0xd74c('0x3f')]=[{'all':!![]}];}return db[_0xd74c('0x27')]['findAll'](_0x13879d);})[_0xd74c('0x21')](function(_0x3d7f84){_0x45a646[_0xd74c('0x40')]=_0x3d7f84;return _0x45a646;})[_0xd74c('0x21')](respondWithFilteredResult(_0x4daa8b,_0x13879d))['catch'](handleError(_0x4daa8b,null));};exports[_0xd74c('0x41')]=function(_0x4960fd,_0x453417){var _0x5138d5={'raw':!![],'where':{'id':_0x4960fd['params']['id']}},_0x50a864={};_0x50a864['model']=_[_0xd74c('0x2f')](db['CmHopperHistory'][_0xd74c('0x28')]);_0x50a864[_0xd74c('0x2e')]=_[_0xd74c('0x2f')](_0x4960fd[_0xd74c('0x2e')]);_0x50a864[_0xd74c('0x30')]=_[_0xd74c('0x31')](_0x50a864[_0xd74c('0x2c')],_0x50a864[_0xd74c('0x2e')]);_0x5138d5[_0xd74c('0x33')]=_['intersection'](_0x50a864[_0xd74c('0x2c')],qs['fields'](_0x4960fd[_0xd74c('0x2e')]['fields']));_0x5138d5[_0xd74c('0x33')]=_0x5138d5['attributes']['length']?_0x5138d5[_0xd74c('0x33')]:_0x50a864['model'];if(_0x4960fd[_0xd74c('0x2e')][_0xd74c('0x3e')]){_0x5138d5[_0xd74c('0x3f')]=[{'all':!![]}];}_0x5138d5=_[_0xd74c('0x3a')]({},_0x5138d5,_0x4960fd[_0xd74c('0x3d')]);return db['CmHopperHistory']['find'](_0x5138d5)[_0xd74c('0x21')](handleEntityNotFound(_0x453417,null))[_0xd74c('0x21')](respondWithResult(_0x453417,null))[_0xd74c('0x42')](handleError(_0x453417,null));};exports[_0xd74c('0x43')]=function(_0x5a4021,_0x48ae8f){return db[_0xd74c('0x27')][_0xd74c('0x43')](_0x5a4021['body'],{})['then'](respondWithResult(_0x48ae8f,0xc9))[_0xd74c('0x42')](handleError(_0x48ae8f,null));};exports[_0xd74c('0x44')]=function(_0x598e6c,_0x2f6dca){return db[_0xd74c('0x27')][_0xd74c('0x44')]()[_0xd74c('0x21')](respondWithResult(_0x2f6dca,null))[_0xd74c('0x42')](handleError(_0x2f6dca,null));};exports[_0xd74c('0x45')]=function(_0x4f678d,_0x25fa00){if(_0x4f678d['body'][_0xd74c('0x46')]){delete _0x4f678d['body'][_0xd74c('0x46')];}return db[_0xd74c('0x27')][_0xd74c('0x47')]({'where':{'uniqueid':_0x4f678d[_0xd74c('0x48')]['id']}})[_0xd74c('0x21')](handleEntityNotFound(_0x25fa00,null))['then'](saveUpdates(_0x4f678d['body'],null))[_0xd74c('0x21')](respondWithResult(_0x25fa00,null))[_0xd74c('0x42')](handleError(_0x25fa00,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index e45bf87..c19936f 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 _0xb287=['define','cm_hopper_history','endtime','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','exports'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xb287,0xd4));var _0x7b28=function(_0x47fc45,_0x408b58){_0x47fc45=_0x47fc45-0x0;var _0x12a96b=_0xb287[_0x47fc45];return _0x12a96b;};'use strict';var _=require('lodash');var util=require(_0x7b28('0x0'));var logger=require(_0x7b28('0x1'))('api');var moment=require(_0x7b28('0x2'));var BPromise=require(_0x7b28('0x3'));var rp=require(_0x7b28('0x4'));var fs=require('fs');var path=require(_0x7b28('0x5'));var rimraf=require(_0x7b28('0x6'));var config=require('../../config/environment');var attributes=require(_0x7b28('0x7'));module[_0x7b28('0x8')]=function(_0x5986e8,_0x41dc4e){return _0x5986e8[_0x7b28('0x9')]('CmHopperHistory',attributes,{'tableName':_0x7b28('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x7b28('0xb')]},{'name':_0x7b28('0xc'),'fields':[_0x7b28('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb69=['request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','endtime','uniqueid','util','api','moment','bluebird'];(function(_0x51b781,_0x4fe31f){var _0x21a205=function(_0x233379){while(--_0x233379){_0x51b781['push'](_0x51b781['shift']());}};_0x21a205(++_0x4fe31f);}(_0xdb69,0x14c));var _0x9db6=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdb69[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x9db6('0x0'));var logger=require('../../config/logger')(_0x9db6('0x1'));var moment=require(_0x9db6('0x2'));var BPromise=require(_0x9db6('0x3'));var rp=require(_0x9db6('0x4'));var fs=require('fs');var path=require(_0x9db6('0x5'));var rimraf=require(_0x9db6('0x6'));var config=require(_0x9db6('0x7'));var attributes=require(_0x9db6('0x8'));module[_0x9db6('0x9')]=function(_0x3540ab,_0x6d3194){return _0x3540ab['define']('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x9db6('0xa'),'fields':[_0x9db6('0xa')]},{'name':_0x9db6('0xb'),'fields':[_0x9db6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 586b5e1..598a38f 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 _0xc375=['result','CmHopperHistory','body','options','raw','CreateCmHopperHistory','debug','catch','AvgHandleTime','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','findAll','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmHopperHistory,\x20%s,\x20%s','message'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xc375,0xb9));var _0x5c37=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0xc375[_0x128450];return _0x4d80ed;};'use strict';var _=require(_0x5c37('0x0'));var util=require(_0x5c37('0x1'));var moment=require(_0x5c37('0x2'));var BPromise=require(_0x5c37('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c37('0x4'));var db=require(_0x5c37('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5c37('0x6'));var config=require(_0x5c37('0x7'));var jayson=require(_0x5c37('0x8'));var client=jayson[_0x5c37('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35ac84,_0x2e00e3,_0x401a7e){return new BPromise(function(_0x3474e4,_0x4c53f4){return client[_0x5c37('0xa')](_0x35ac84,_0x401a7e)[_0x5c37('0xb')](function(_0x851610){logger[_0x5c37('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x2e00e3,'request\x20sent');logger['debug'](_0x5c37('0xd'),_0x2e00e3,_0x5c37('0xe'),JSON[_0x5c37('0xf')](_0x851610));if(_0x851610[_0x5c37('0x10')]){if(_0x851610[_0x5c37('0x10')]['code']===0x1f4){logger[_0x5c37('0x10')](_0x5c37('0x11'),_0x2e00e3,_0x851610[_0x5c37('0x10')]['message']);return _0x4c53f4(_0x851610['error'][_0x5c37('0x12')]);}logger[_0x5c37('0x10')](_0x5c37('0x11'),_0x2e00e3,_0x851610[_0x5c37('0x10')][_0x5c37('0x12')]);return _0x3474e4(_0x851610[_0x5c37('0x10')]['message']);}else{logger[_0x5c37('0xc')](_0x5c37('0x11'),_0x2e00e3,'request\x20sent');_0x3474e4(_0x851610[_0x5c37('0x13')][_0x5c37('0x12')]);}})['catch'](function(_0x35af58){logger[_0x5c37('0x10')](_0x5c37('0x11'),_0x2e00e3,_0x35af58);_0x4c53f4(_0x35af58);});});}exports['CreateCmHopperHistory']=function(_0x373b88){var _0x22b3e8=this;return new Promise(function(_0x1394f1,_0x2c2a3a){return db[_0x5c37('0x14')]['create'](_0x373b88[_0x5c37('0x15')],{'raw':_0x373b88[_0x5c37('0x16')]?_0x373b88[_0x5c37('0x16')][_0x5c37('0x17')]===undefined?!![]:![]:!![]})[_0x5c37('0xb')](function(_0xb6c374){logger[_0x5c37('0xc')](_0x5c37('0x18'),_0x373b88);logger[_0x5c37('0x19')]('CreateCmHopperHistory',_0x373b88,JSON[_0x5c37('0xf')](_0xb6c374));_0x1394f1(_0xb6c374);})[_0x5c37('0x1a')](function(_0x4cfa54){logger[_0x5c37('0x10')](_0x5c37('0x18'),_0x4cfa54['message'],_0x373b88);_0x2c2a3a(_0x22b3e8[_0x5c37('0x10')](0x1f4,_0x4cfa54[_0x5c37('0x12')]));});});};exports[_0x5c37('0x1b')]=function(_0x2323d0){var _0xa0895a=this;return new Promise(function(_0x1f6b1e,_0x1281d5){return db['CmHopperHistory']['findAll']({'raw':_0x2323d0[_0x5c37('0x16')]?_0x2323d0[_0x5c37('0x16')][_0x5c37('0x17')]===undefined?!![]:![]:!![],'where':_0x2323d0['options']?_0x2323d0[_0x5c37('0x16')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')][_0x5c37('0x1e')]('id')),_0x5c37('0x1f')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x5c37('0x21')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')]['literal'](_0x5c37('0x22')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn']('COUNT',db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x23')))),_0x5c37('0x24')],[db['sequelize']['fn']('AVG',db['sequelize']['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x5c37('0x25')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x26'),db['sequelize']['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x27')))),_0x5c37('0x28')]]})[_0x5c37('0xb')](function(_0x187238){logger['info'](_0x5c37('0x1b'),_0x2323d0);logger[_0x5c37('0x19')](_0x5c37('0x1b'),_0x2323d0,JSON[_0x5c37('0xf')](_0x187238));_0x1f6b1e(_0x187238);})[_0x5c37('0x1a')](function(_0x2572f6){logger[_0x5c37('0x10')](_0x5c37('0x1b'),_0x2572f6['message'],_0x2323d0);_0x1281d5(_0xa0895a['error'](0x1f4,_0x2572f6[_0x5c37('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4627d0){var _0x364fb6=this;return new Promise(function(_0x415e4e,_0x175ef5){return db[_0x5c37('0x14')][_0x5c37('0x29')]({'raw':_0x4627d0['options']?_0x4627d0['options'][_0x5c37('0x17')]===undefined?!![]:![]:!![],'where':_0x4627d0[_0x5c37('0x16')]?_0x4627d0['options'][_0x5c37('0x2a')]||null:null,'attributes':[[_0x5c37('0x2b'),_0x5c37('0x2c')],[db['sequelize']['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x2d')))),_0x5c37('0x2e')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x5c37('0x2f')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x30')))),_0x5c37('0x31')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db['sequelize'][_0x5c37('0x20')](_0x5c37('0x32')))),_0x5c37('0x33')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db['sequelize']['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x34')))),_0x5c37('0x35')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')]['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0x5c37('0x36')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')]('`state`\x20=\x2013,\x201,\x20null'))),_0x5c37('0x37')],[db[_0x5c37('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x38')))),_0x5c37('0x39')],[db['sequelize']['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')]['literal'](_0x5c37('0x3a')))),_0x5c37('0x3b')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x3c')))),'outboundAnswerAgiCallsDay'],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x3d')))),_0x5c37('0x3b')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x5c37('0x3e')))),_0x5c37('0x3f')]],'group':[_0x5c37('0x2b')]})[_0x5c37('0xb')](function(_0x478279){logger['info'](_0x5c37('0x40'),_0x4627d0);logger[_0x5c37('0x19')](_0x5c37('0x40'),_0x4627d0,JSON[_0x5c37('0xf')](_0x478279));_0x415e4e(_0x478279);})[_0x5c37('0x1a')](function(_0x4c209b){logger[_0x5c37('0x10')](_0x5c37('0x40'),_0x4c209b['message'],_0x4627d0);_0x175ef5(_0x364fb6[_0x5c37('0x10')](0x1f4,_0x4c209b[_0x5c37('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x12190e){var _0x35aced=this;return new Promise(function(_0x2c6f58,_0x272073){return db[_0x5c37('0x14')][_0x5c37('0x29')]({'raw':_0x12190e['options']?_0x12190e[_0x5c37('0x16')][_0x5c37('0x17')]===undefined?!![]:![]:!![],'where':_0x12190e['options']?_0x12190e['options']['where']||null:null,'attributes':[['campaign',_0x5c37('0x2c')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['col']('id')),'ivrTotalCallsDays'],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x5c37('0x41')))),_0x5c37('0x42')]],'group':[_0x5c37('0x2b')]})['then'](function(_0x3999f7){logger[_0x5c37('0xc')]('GetCampaignHopperHistory',_0x12190e);logger[_0x5c37('0x19')]('GetCampaignHopperHistory',_0x12190e,JSON[_0x5c37('0xf')](_0x3999f7));_0x2c6f58(_0x3999f7);})['catch'](function(_0xc03d04){logger[_0x5c37('0x10')](_0x5c37('0x43'),_0xc03d04['message'],_0x12190e);_0x272073(_0x35aced[_0x5c37('0x10')](0x1f4,_0xc03d04[_0x5c37('0x12')]));});});}; \ No newline at end of file +var _0xc10c=['`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','findAll','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','AvgHandleTime','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay'];(function(_0x237bf7,_0xb851fc){var _0x5928ba=function(_0x14c0d0){while(--_0x14c0d0){_0x237bf7['push'](_0x237bf7['shift']());}};_0x5928ba(++_0xb851fc);}(_0xc10c,0x8f));var _0xcc10=function(_0x5902dd,_0xcf5af){_0x5902dd=_0x5902dd-0x0;var _0x52ada1=_0xc10c[_0x5902dd];return _0x52ada1;};'use strict';var _=require(_0xcc10('0x0'));var util=require(_0xcc10('0x1'));var moment=require(_0xcc10('0x2'));var BPromise=require(_0xcc10('0x3'));var rs=require(_0xcc10('0x4'));var fs=require('fs');var Redis=require(_0xcc10('0x5'));var db=require(_0xcc10('0x6'))['db'];var utils=require(_0xcc10('0x7'));var logger=require(_0xcc10('0x8'))(_0xcc10('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xcc10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1152a6,_0x44e37c,_0x3fc9ce){return new BPromise(function(_0x1e91b5,_0x11dc9b){return client[_0xcc10('0xb')](_0x1152a6,_0x3fc9ce)[_0xcc10('0xc')](function(_0x44e16e){logger[_0xcc10('0xd')](_0xcc10('0xe'),_0x44e37c,_0xcc10('0xf'));logger[_0xcc10('0x10')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x44e37c,_0xcc10('0xf'),JSON[_0xcc10('0x11')](_0x44e16e));if(_0x44e16e[_0xcc10('0x12')]){if(_0x44e16e[_0xcc10('0x12')][_0xcc10('0x13')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x44e37c,_0x44e16e[_0xcc10('0x12')][_0xcc10('0x14')]);return _0x11dc9b(_0x44e16e[_0xcc10('0x12')][_0xcc10('0x14')]);}logger[_0xcc10('0x12')](_0xcc10('0xe'),_0x44e37c,_0x44e16e[_0xcc10('0x12')]['message']);return _0x1e91b5(_0x44e16e[_0xcc10('0x12')][_0xcc10('0x14')]);}else{logger[_0xcc10('0xd')](_0xcc10('0xe'),_0x44e37c,_0xcc10('0xf'));_0x1e91b5(_0x44e16e[_0xcc10('0x15')][_0xcc10('0x14')]);}})[_0xcc10('0x16')](function(_0x26f6a5){logger[_0xcc10('0x12')](_0xcc10('0xe'),_0x44e37c,_0x26f6a5);_0x11dc9b(_0x26f6a5);});});}exports[_0xcc10('0x17')]=function(_0x1998c9){var _0x17bcc5=this;return new Promise(function(_0x1cbf67,_0x1e38e1){return db[_0xcc10('0x18')]['create'](_0x1998c9[_0xcc10('0x19')],{'raw':_0x1998c9[_0xcc10('0x1a')]?_0x1998c9[_0xcc10('0x1a')][_0xcc10('0x1b')]===undefined?!![]:![]:!![]})[_0xcc10('0xc')](function(_0x5133a5){logger[_0xcc10('0xd')](_0xcc10('0x17'),_0x1998c9);logger[_0xcc10('0x10')](_0xcc10('0x17'),_0x1998c9,JSON[_0xcc10('0x11')](_0x5133a5));_0x1cbf67(_0x5133a5);})[_0xcc10('0x16')](function(_0x2576ae){logger[_0xcc10('0x12')](_0xcc10('0x17'),_0x2576ae['message'],_0x1998c9);_0x1e38e1(_0x17bcc5[_0xcc10('0x12')](0x1f4,_0x2576ae[_0xcc10('0x14')]));});});};exports[_0xcc10('0x1c')]=function(_0x117a65){var _0x387a95=this;return new Promise(function(_0x57b722,_0x32d516){return db[_0xcc10('0x18')]['findAll']({'raw':_0x117a65[_0xcc10('0x1a')]?_0x117a65[_0xcc10('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x117a65[_0xcc10('0x1a')]?_0x117a65[_0xcc10('0x1a')]['where']||null:null,'attributes':[[db[_0xcc10('0x1d')]['fn']('COUNT',db[_0xcc10('0x1d')][_0xcc10('0x1e')]('id')),_0xcc10('0x1f')],[db[_0xcc10('0x1d')]['fn'](_0xcc10('0x20'),db[_0xcc10('0x1d')]['fn']('IF',db[_0xcc10('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0xcc10('0x1d')]['fn'](_0xcc10('0x20'),db[_0xcc10('0x1d')]['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')](_0xcc10('0x22')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xcc10('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xcc10('0x21')](_0xcc10('0x23')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xcc10('0x1d')]['fn'](_0xcc10('0x24'),db[_0xcc10('0x1d')]['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')](_0xcc10('0x25')))),_0xcc10('0x26')],[db[_0xcc10('0x1d')]['fn'](_0xcc10('0x24'),db[_0xcc10('0x1d')]['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')](_0xcc10('0x27')))),_0xcc10('0x28')]]})[_0xcc10('0xc')](function(_0x572962){logger[_0xcc10('0xd')]('AvgHandleTime',_0x117a65);logger['debug'](_0xcc10('0x1c'),_0x117a65,JSON[_0xcc10('0x11')](_0x572962));_0x57b722(_0x572962);})[_0xcc10('0x16')](function(_0x17e3e2){logger[_0xcc10('0x12')](_0xcc10('0x1c'),_0x17e3e2[_0xcc10('0x14')],_0x117a65);_0x32d516(_0x387a95[_0xcc10('0x12')](0x1f4,_0x17e3e2[_0xcc10('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0xf5b8e5){var _0x34b551=this;return new Promise(function(_0x25b2d2,_0x384aa9){return db[_0xcc10('0x18')]['findAll']({'raw':_0xf5b8e5['options']?_0xf5b8e5[_0xcc10('0x1a')][_0xcc10('0x1b')]===undefined?!![]:![]:!![],'where':_0xf5b8e5[_0xcc10('0x1a')]?_0xf5b8e5[_0xcc10('0x1a')][_0xcc10('0x29')]||null:null,'attributes':[[_0xcc10('0x2a'),_0xcc10('0x2b')],[db[_0xcc10('0x1d')]['fn']('COUNT',db[_0xcc10('0x1d')]['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')](_0xcc10('0x2c')))),_0xcc10('0x2d')],[db[_0xcc10('0x1d')]['fn'](_0xcc10('0x20'),db['sequelize']['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')](_0xcc10('0x2e')))),_0xcc10('0x2f')],[db[_0xcc10('0x1d')]['fn'](_0xcc10('0x20'),db[_0xcc10('0x1d')]['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')](_0xcc10('0x30')))),_0xcc10('0x31')],[db[_0xcc10('0x1d')]['fn'](_0xcc10('0x20'),db[_0xcc10('0x1d')]['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')]('`state`\x20=\x205,\x201,\x20null'))),_0xcc10('0x32')],[db['sequelize']['fn'](_0xcc10('0x20'),db[_0xcc10('0x1d')]['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')](_0xcc10('0x33')))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0xcc10('0x20'),db[_0xcc10('0x1d')]['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')](_0xcc10('0x34')))),_0xcc10('0x35')],[db[_0xcc10('0x1d')]['fn'](_0xcc10('0x20'),db[_0xcc10('0x1d')]['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xcc10('0x36')],[db[_0xcc10('0x1d')]['fn'](_0xcc10('0x20'),db[_0xcc10('0x1d')]['fn']('IF',db[_0xcc10('0x1d')]['literal'](_0xcc10('0x37')))),_0xcc10('0x38')],[db[_0xcc10('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')](_0xcc10('0x39')))),_0xcc10('0x3a')],[db[_0xcc10('0x1d')]['fn'](_0xcc10('0x20'),db[_0xcc10('0x1d')]['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xcc10('0x1d')]['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')]('`state`\x20=\x2018,\x201,\x20null'))),_0xcc10('0x3b')],[db[_0xcc10('0x1d')]['fn'](_0xcc10('0x20'),db['sequelize']['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),_0xcc10('0x3c')],[db['sequelize']['fn'](_0xcc10('0x20'),db[_0xcc10('0x1d')]['fn']('IF',db[_0xcc10('0x1d')]['literal'](_0xcc10('0x3d')))),_0xcc10('0x3b')],[db[_0xcc10('0x1d')]['fn'](_0xcc10('0x20'),db[_0xcc10('0x1d')]['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')](_0xcc10('0x3e')))),_0xcc10('0x3f')]],'group':[_0xcc10('0x2a')]})['then'](function(_0x5934b3){logger[_0xcc10('0xd')](_0xcc10('0x40'),_0xf5b8e5);logger[_0xcc10('0x10')]('GetVoiceQueueHopperHistory',_0xf5b8e5,JSON[_0xcc10('0x11')](_0x5934b3));_0x25b2d2(_0x5934b3);})[_0xcc10('0x16')](function(_0x99becf){logger['error'](_0xcc10('0x40'),_0x99becf['message'],_0xf5b8e5);_0x384aa9(_0x34b551[_0xcc10('0x12')](0x1f4,_0x99becf[_0xcc10('0x14')]));});});};exports[_0xcc10('0x41')]=function(_0x31c644){var _0x14e991=this;return new Promise(function(_0x4e1dcb,_0x8af22a){return db[_0xcc10('0x18')][_0xcc10('0x42')]({'raw':_0x31c644['options']?_0x31c644['options'][_0xcc10('0x1b')]===undefined?!![]:![]:!![],'where':_0x31c644[_0xcc10('0x1a')]?_0x31c644[_0xcc10('0x1a')][_0xcc10('0x29')]||null:null,'attributes':[[_0xcc10('0x2a'),'name'],[db[_0xcc10('0x1d')]['fn']('COUNT',db[_0xcc10('0x1d')][_0xcc10('0x1e')]('id')),'ivrTotalCallsDays'],[db[_0xcc10('0x1d')]['fn'](_0xcc10('0x20'),db['sequelize']['fn']('IF',db[_0xcc10('0x1d')][_0xcc10('0x21')](_0xcc10('0x30')))),_0xcc10('0x43')]],'group':[_0xcc10('0x2a')]})['then'](function(_0x27a2d5){logger[_0xcc10('0xd')]('GetCampaignHopperHistory',_0x31c644);logger[_0xcc10('0x10')](_0xcc10('0x41'),_0x31c644,JSON[_0xcc10('0x11')](_0x27a2d5));_0x4e1dcb(_0x27a2d5);})[_0xcc10('0x16')](function(_0xc923d7){logger[_0xcc10('0x12')](_0xcc10('0x41'),_0xc923d7['message'],_0x31c644);_0x8af22a(_0x14e991[_0xcc10('0x12')](0x1f4,_0xc923d7['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index ad7259b..729c56c 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 _0xea7e=['path','express','Router','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','exports','util'];(function(_0x549f1b,_0x41108a){var _0x2acb5c=function(_0x268130){while(--_0x268130){_0x549f1b['push'](_0x549f1b['shift']());}};_0x2acb5c(++_0x41108a);}(_0xea7e,0x143));var _0xeea7=function(_0x428518,_0x565c03){_0x428518=_0x428518-0x0;var _0x1d0328=_0xea7e[_0x428518];return _0x1d0328;};'use strict';var multer=require('multer');var util=require(_0xeea7('0x0'));var path=require(_0xeea7('0x1'));var timeout=require('connect-timeout');var express=require(_0xeea7('0x2'));var router=express[_0xeea7('0x3')]();var auth=require(_0xeea7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xeea7('0x5'));var controller=require(_0xeea7('0x6'));router[_0xeea7('0x7')]('/',auth[_0xeea7('0x8')](),controller[_0xeea7('0x9')]);router[_0xeea7('0x7')](_0xeea7('0xa'),auth[_0xeea7('0x8')](),controller[_0xeea7('0xb')]);router[_0xeea7('0x7')](_0xeea7('0xc'),auth['isAuthenticated'](),controller[_0xeea7('0xd')]);router[_0xeea7('0xe')]('/',auth[_0xeea7('0x8')](),controller['create']);router[_0xeea7('0xf')](_0xeea7('0xc'),auth['isAuthenticated'](),controller[_0xeea7('0x10')]);module[_0xeea7('0x11')]=router; \ No newline at end of file +var _0xa33c=['/:id','show','post','put','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x791504,_0x35a3aa){var _0x5835e7=function(_0x5b8aed){while(--_0x5b8aed){_0x791504['push'](_0x791504['shift']());}};_0x5835e7(++_0x35a3aa);}(_0xa33c,0x64));var _0xca33=function(_0x576abd,_0x3bac48){_0x576abd=_0x576abd-0x0;var _0x3d54ab=_0xa33c[_0x576abd];return _0x3d54ab;};'use strict';var multer=require(_0xca33('0x0'));var util=require('util');var path=require(_0xca33('0x1'));var timeout=require(_0xca33('0x2'));var express=require(_0xca33('0x3'));var router=express[_0xca33('0x4')]();var auth=require(_0xca33('0x5'));var interaction=require(_0xca33('0x6'));var config=require(_0xca33('0x7'));var controller=require(_0xca33('0x8'));router[_0xca33('0x9')]('/',auth[_0xca33('0xa')](),controller[_0xca33('0xb')]);router[_0xca33('0x9')](_0xca33('0xc'),auth['isAuthenticated'](),controller[_0xca33('0xd')]);router[_0xca33('0x9')](_0xca33('0xe'),auth[_0xca33('0xa')](),controller[_0xca33('0xf')]);router[_0xca33('0x10')]('/',auth[_0xca33('0xa')](),controller['create']);router[_0xca33('0x11')]('/:id',auth[_0xca33('0xa')](),controller['update']);module[_0xca33('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index afca050..7c30e41 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 _0x5872=['exports','STRING','sequelize'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0x5872,0x1a0));var _0x2587=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0x5872[_0x5d30b4];return _0x1acfb8;};'use strict';var Sequelize=require(_0x2587('0x0'));module[_0x2587('0x1')]={'name':{'type':Sequelize[_0x2587('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2587('0x2')]},'dialPrefix':{'type':Sequelize[_0x2587('0x2')]}}; \ No newline at end of file +var _0x32c3=['exports','STRING','name','sequelize'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x32c3,0x1e3));var _0x332c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x32c3[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x332c('0x0'));module[_0x332c('0x1')]={'name':{'type':Sequelize[_0x332c('0x2')],'unique':_0x332c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x332c('0x2')]},'dialPrefix':{'type':Sequelize[_0x332c('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 2cc5af2..4d32799 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 _0xea31=['pick','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','order','removeDispositions','ids','CmContact','tags','isArray','length','join','each','omit','push','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','cf_%d','raw','getContactsCsv','CmCustomField','isEmpty','now','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','sendStatus','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','defaultValue','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','nolimit','limit','sort','where'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xea31,0x17f));var _0x1ea3=function(_0x20208d,_0x1bde33){_0x20208d=_0x20208d-0x0;var _0x4f7367=_0xea31[_0x20208d];return _0x4f7367;};'use strict';var pdf=require(_0x1ea3('0x0'));var emlformat=require(_0x1ea3('0x1'));var rimraf=require(_0x1ea3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ea3('0x3'));var rp=require(_0x1ea3('0x4'));var moment=require(_0x1ea3('0x5'));var BPromise=require(_0x1ea3('0x6'));var Mustache=require('mustache');var util=require(_0x1ea3('0x7'));var path=require(_0x1ea3('0x8'));var sox=require(_0x1ea3('0x9'));var csv=require(_0x1ea3('0xa'));var ejs=require(_0x1ea3('0xb'));var fs=require('fs');var _=require(_0x1ea3('0xc'));var squel=require('squel');var crypto=require(_0x1ea3('0xd'));var jsforce=require(_0x1ea3('0xe'));var deskjs=require(_0x1ea3('0xf'));var toCsv=require(_0x1ea3('0xa'));var querystring=require(_0x1ea3('0x10'));var Papa=require(_0x1ea3('0x11'));var Redis=require(_0x1ea3('0x12'));var authService=require(_0x1ea3('0x13'));var qs=require(_0x1ea3('0x14'));var as=require(_0x1ea3('0x15'));var hardwareService=require(_0x1ea3('0x16'));var logger=require('../../config/logger')(_0x1ea3('0x17'));var utils=require(_0x1ea3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1ea3('0x19'));var db=require('../../mysqldb')['db'];config[_0x1ea3('0x1a')]=_[_0x1ea3('0x1b')](config['redis'],{'host':_0x1ea3('0x1c'),'port':0x18eb});var socket=require(_0x1ea3('0x1d'))(new Redis(config[_0x1ea3('0x1a')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x4bce10,_0x51e47f){_0x51e47f=_0x51e47f||0xcc;return function(_0x41cfb5){if(_0x41cfb5){return _0x4bce10['sendStatus'](_0x51e47f);}return _0x4bce10[_0x1ea3('0x1e')](_0x51e47f)[_0x1ea3('0x1f')]();};}function respondWithResult(_0x22ac8c,_0x4d6af9){_0x4d6af9=_0x4d6af9||0xc8;return function(_0x19a7ae){if(_0x19a7ae){return _0x22ac8c['status'](_0x4d6af9)[_0x1ea3('0x20')](_0x19a7ae);}};}function respondWithFilteredResult(_0x5a6961,_0x5a89ec){return function(_0x315144){if(_0x315144){var _0x5f00cf=_0x315144[_0x1ea3('0x21')],_0x4354dd=_0x5a89ec[_0x1ea3('0x22')],_0x431d6a=_0x5a89ec[_0x1ea3('0x22')]+_0x5a89ec['limit'],_0x320d28;if(_0x431d6a>=_0x5f00cf){_0x431d6a=_0x5f00cf;_0x320d28=0xc8;}else{_0x320d28=0xce;}_0x5a6961[_0x1ea3('0x1e')](_0x320d28);return _0x5a6961[_0x1ea3('0x23')](_0x1ea3('0x24'),_0x4354dd+'-'+_0x431d6a+'/'+_0x5f00cf)['json'](_0x315144);}return null;};}function patchUpdates(_0x3b7582){return function(_0x5e59ba){try{jsonpatch[_0x1ea3('0x25')](_0x5e59ba,_0x3b7582,!![]);}catch(_0x2dbf0a){return BPromise['reject'](_0x2dbf0a);}return _0x5e59ba[_0x1ea3('0x26')]();};}function saveUpdates(_0x52f3f7,_0x12dcc8){return function(_0x4c5561){if(_0x4c5561){return _0x4c5561[_0x1ea3('0x27')](_0x52f3f7)['then'](function(_0x100d11){return _0x100d11;});}return null;};}function removeEntity(_0xfd39ea,_0x126fd1){return function(_0x1496ee){if(_0x1496ee){return _0x1496ee[_0x1ea3('0x28')]()[_0x1ea3('0x29')](function(){var _0x466381=_0x1496ee[_0x1ea3('0x2a')]({'plain':!![]});var _0x2a3c8c='Lists';return db[_0x1ea3('0x2b')][_0x1ea3('0x28')]({'where':{'type':_0x2a3c8c,'resourceId':_0x466381['id']}})[_0x1ea3('0x29')](function(){return _0x1496ee;});})[_0x1ea3('0x29')](function(){_0xfd39ea[_0x1ea3('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x257f39,_0x535fd0){return function(_0x368a10){if(!_0x368a10){_0x257f39['sendStatus'](0x194);}return _0x368a10;};}function handleError(_0x49379c,_0x3e9ade){_0x3e9ade=_0x3e9ade||0x1f4;return function(_0x135347){logger[_0x1ea3('0x2c')](_0x135347[_0x1ea3('0x2d')]);if(_0x135347[_0x1ea3('0x2e')]){delete _0x135347[_0x1ea3('0x2e')];}_0x49379c[_0x1ea3('0x1e')](_0x3e9ade)[_0x1ea3('0x2f')](_0x135347);};}exports[_0x1ea3('0x30')]=function(_0x581729,_0x2d44d6){var _0x3694a6={},_0x5ad487={},_0x991781={'count':0x0,'rows':[]};var _0x59efa3=_[_0x1ea3('0x31')](db[_0x1ea3('0x32')][_0x1ea3('0x33')],function(_0x13da46){return{'name':_0x13da46['fieldName'],'type':_0x13da46[_0x1ea3('0x34')][_0x1ea3('0x35')]};});_0x5ad487[_0x1ea3('0x36')]=_[_0x1ea3('0x31')](_0x59efa3,'name');_0x5ad487['query']=_[_0x1ea3('0x37')](_0x581729[_0x1ea3('0x38')]);_0x5ad487['filters']=_['intersection'](_0x5ad487[_0x1ea3('0x36')],_0x5ad487['query']);_0x3694a6[_0x1ea3('0x39')]=_[_0x1ea3('0x3a')](_0x5ad487['model'],qs[_0x1ea3('0x3b')](_0x581729[_0x1ea3('0x38')]['fields']));_0x3694a6['attributes']=_0x3694a6[_0x1ea3('0x39')]['length']?_0x3694a6[_0x1ea3('0x39')]:_0x5ad487[_0x1ea3('0x36')];if(!_0x581729[_0x1ea3('0x38')]['hasOwnProperty'](_0x1ea3('0x3c'))){_0x3694a6[_0x1ea3('0x3d')]=qs[_0x1ea3('0x3d')](_0x581729[_0x1ea3('0x38')]['limit']);_0x3694a6['offset']=qs['offset'](_0x581729[_0x1ea3('0x38')]['offset']);}_0x3694a6['order']=qs[_0x1ea3('0x3e')](_0x581729[_0x1ea3('0x38')][_0x1ea3('0x3e')]);_0x3694a6[_0x1ea3('0x3f')]=qs['filters'](_[_0x1ea3('0x40')](_0x581729['query'],_0x5ad487[_0x1ea3('0x41')]),_0x59efa3);if(_0x581729[_0x1ea3('0x38')][_0x1ea3('0x42')]){_0x3694a6[_0x1ea3('0x3f')]=_['merge'](_0x3694a6[_0x1ea3('0x3f')],{'$or':_[_0x1ea3('0x31')](_0x59efa3,function(_0x2bfb45){if(_0x2bfb45[_0x1ea3('0x34')]!==_0x1ea3('0x43')){var _0x1e4b25={};_0x1e4b25[_0x2bfb45[_0x1ea3('0x2e')]]={'$like':'%'+_0x581729['query'][_0x1ea3('0x42')]+'%'};return _0x1e4b25;}})});}_0x3694a6=_[_0x1ea3('0x44')]({},_0x3694a6,_0x581729[_0x1ea3('0x45')]);var _0xedd0d2={'where':_0x3694a6[_0x1ea3('0x3f')]};return db['CmList'][_0x1ea3('0x21')](_0xedd0d2)[_0x1ea3('0x29')](function(_0x1fe3be){_0x991781[_0x1ea3('0x21')]=_0x1fe3be;if(_0x581729[_0x1ea3('0x38')][_0x1ea3('0x46')]){_0x3694a6['include']=[{'all':!![]}];}return db['CmList'][_0x1ea3('0x47')](_0x3694a6);})['then'](function(_0x6224f6){_0x991781[_0x1ea3('0x48')]=_0x6224f6;return _0x991781;})[_0x1ea3('0x29')](respondWithFilteredResult(_0x2d44d6,_0x3694a6))[_0x1ea3('0x49')](handleError(_0x2d44d6,null));};exports[_0x1ea3('0x4a')]=function(_0x590464,_0x35fd46){var _0x124e8b={'raw':![],'where':{'id':_0x590464[_0x1ea3('0x4b')]['id']}},_0x445855={};_0x445855[_0x1ea3('0x36')]=_[_0x1ea3('0x37')](db[_0x1ea3('0x32')][_0x1ea3('0x33')]);_0x445855[_0x1ea3('0x38')]=_[_0x1ea3('0x37')](_0x590464['query']);_0x445855[_0x1ea3('0x41')]=_['intersection'](_0x445855[_0x1ea3('0x36')],_0x445855[_0x1ea3('0x38')]);_0x124e8b[_0x1ea3('0x39')]=_[_0x1ea3('0x3a')](_0x445855[_0x1ea3('0x36')],qs['fields'](_0x590464[_0x1ea3('0x38')]['fields']));_0x124e8b[_0x1ea3('0x39')]=_0x124e8b['attributes']['length']?_0x124e8b[_0x1ea3('0x39')]:_0x445855['model'];if(_0x590464[_0x1ea3('0x38')][_0x1ea3('0x46')]){_0x124e8b[_0x1ea3('0x4c')]=[{'all':!![]}];}_0x124e8b=_[_0x1ea3('0x44')]({},_0x124e8b,_0x590464[_0x1ea3('0x45')]);return db[_0x1ea3('0x32')][_0x1ea3('0x4d')](_0x124e8b)[_0x1ea3('0x29')](handleEntityNotFound(_0x35fd46,null))[_0x1ea3('0x29')](respondWithResult(_0x35fd46,null))[_0x1ea3('0x49')](handleError(_0x35fd46,null));};exports['create']=function(_0x4a7673,_0x4af2d1){return db['CmList']['create'](_0x4a7673[_0x1ea3('0x4e')],{})[_0x1ea3('0x29')](function(_0x516e49){var _0x5f596d=_0x4a7673[_0x1ea3('0x4f')]['get']({'plain':!![]});if(!_0x5f596d)throw new Error(_0x1ea3('0x50'));if(_0x5f596d[_0x1ea3('0x51')]===_0x1ea3('0x4f')){var _0x142c71=_0x516e49['get']({'plain':!![]});var _0x5e05ca=_0x1ea3('0x52');return db[_0x1ea3('0x53')][_0x1ea3('0x4d')]({'where':{'name':_0x5e05ca,'userProfileId':_0x5f596d[_0x1ea3('0x54')]},'raw':!![]})[_0x1ea3('0x29')](function(_0x4acdea){if(_0x4acdea&&_0x4acdea[_0x1ea3('0x55')]===0x0){return db[_0x1ea3('0x2b')][_0x1ea3('0x56')]({'name':_0x142c71[_0x1ea3('0x2e')],'resourceId':_0x142c71['id'],'type':_0x4acdea['name'],'sectionId':_0x4acdea['id']},{})[_0x1ea3('0x29')](function(){return _0x516e49;});}else{return _0x516e49;}})[_0x1ea3('0x49')](function(_0x16d58c){logger['error'](_0x1ea3('0x57'),_0x16d58c);throw _0x16d58c;});}return _0x516e49;})[_0x1ea3('0x29')](respondWithResult(_0x4af2d1,0xc9))[_0x1ea3('0x49')](handleError(_0x4af2d1,null));};exports['update']=function(_0x59170c,_0x2f3f41){if(_0x59170c['body']['id']){delete _0x59170c[_0x1ea3('0x4e')]['id'];}return db[_0x1ea3('0x32')]['find']({'where':{'id':_0x59170c[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x2f3f41,null))[_0x1ea3('0x29')](saveUpdates(_0x59170c[_0x1ea3('0x4e')],null))['then'](respondWithResult(_0x2f3f41,null))['catch'](handleError(_0x2f3f41,null));};exports[_0x1ea3('0x28')]=function(_0x32dcd6,_0x433027){return db['CmList'][_0x1ea3('0x4d')]({'where':{'id':_0x32dcd6[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x433027,null))[_0x1ea3('0x29')](removeEntity(_0x433027,null))['catch'](handleError(_0x433027,null));};exports[_0x1ea3('0x58')]=function(_0x108721,_0x2a6d18){return db[_0x1ea3('0x32')]['describe']()['then'](respondWithResult(_0x2a6d18,null))[_0x1ea3('0x49')](handleError(_0x2a6d18,null));};exports[_0x1ea3('0x59')]=function(_0x1a47f8,_0x1b6a6f,_0x2f0fd6){if(_0x1a47f8[_0x1ea3('0x4e')]['id']){delete _0x1a47f8[_0x1ea3('0x4e')]['id'];}return db[_0x1ea3('0x32')][_0x1ea3('0x4d')]({'where':{'id':_0x1a47f8[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x1b6a6f,null))['then'](function(_0x5e108e){if(_0x5e108e){_0x1a47f8[_0x1ea3('0x4e')][_0x1ea3('0x5a')]=_0x5e108e['id'];return db[_0x1ea3('0x5b')][_0x1ea3('0x56')](_0x1a47f8[_0x1ea3('0x4e')]);}})[_0x1ea3('0x29')](respondWithResult(_0x1b6a6f,null))[_0x1ea3('0x49')](handleError(_0x1b6a6f,null));};exports[_0x1ea3('0x5c')]=function(_0x1b9cc4,_0x3d4811,_0x3e7811){var _0x1b42ae={'raw':![],'where':{}};var _0x2e053f={};var _0x4a5b74={'count':0x0,'rows':[]};return db[_0x1ea3('0x32')][_0x1ea3('0x5d')]({'where':{'id':_0x1b9cc4[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x3d4811,null))['then'](function(_0x57eeea){if(_0x57eeea){_0x2e053f['model']=_[_0x1ea3('0x37')](db[_0x1ea3('0x5b')][_0x1ea3('0x33')]);_0x2e053f[_0x1ea3('0x38')]=_[_0x1ea3('0x37')](_0x1b9cc4[_0x1ea3('0x38')]);_0x2e053f[_0x1ea3('0x41')]=_['intersection'](_0x2e053f[_0x1ea3('0x36')],_0x2e053f['query']);_0x1b42ae[_0x1ea3('0x39')]=_[_0x1ea3('0x3a')](_0x2e053f[_0x1ea3('0x36')],qs[_0x1ea3('0x3b')](_0x1b9cc4[_0x1ea3('0x38')][_0x1ea3('0x3b')]));_0x1b42ae['attributes']=_0x1b42ae[_0x1ea3('0x39')]['length']?_0x1b42ae[_0x1ea3('0x39')]:_0x2e053f[_0x1ea3('0x36')];if(!_0x1b9cc4[_0x1ea3('0x38')][_0x1ea3('0x5e')](_0x1ea3('0x3c'))){_0x1b42ae['limit']=qs[_0x1ea3('0x3d')](_0x1b9cc4[_0x1ea3('0x38')][_0x1ea3('0x3d')]);_0x1b42ae[_0x1ea3('0x22')]=qs[_0x1ea3('0x22')](_0x1b9cc4[_0x1ea3('0x38')][_0x1ea3('0x22')]);}_0x1b42ae[_0x1ea3('0x5f')]=qs[_0x1ea3('0x3e')](_0x1b9cc4[_0x1ea3('0x38')][_0x1ea3('0x3e')]);_0x1b42ae['where']=qs[_0x1ea3('0x41')](_['pick'](_0x1b9cc4[_0x1ea3('0x38')],_0x2e053f[_0x1ea3('0x41')]));_0x1b42ae[_0x1ea3('0x3f')][_0x1ea3('0x5a')]=_0x57eeea['id'];if(_0x1b9cc4['query'][_0x1ea3('0x42')]){_0x1b42ae[_0x1ea3('0x3f')]=_[_0x1ea3('0x44')](_0x1b42ae['where'],{'$or':_['map'](_0x1b42ae[_0x1ea3('0x39')],function(_0x1493c6){var _0x405a8b={};_0x405a8b[_0x1493c6]={'$like':'%'+_0x1b9cc4[_0x1ea3('0x38')][_0x1ea3('0x42')]+'%'};return _0x405a8b;})});}_0x1b42ae=_[_0x1ea3('0x44')]({},_0x1b42ae,_0x1b9cc4[_0x1ea3('0x45')]);return db[_0x1ea3('0x5b')]['count']({'where':_0x1b42ae[_0x1ea3('0x3f')]})[_0x1ea3('0x29')](function(_0x1090d9){_0x4a5b74[_0x1ea3('0x21')]=_0x1090d9;if(_0x1b9cc4[_0x1ea3('0x38')]['includeAll']){_0x1b42ae[_0x1ea3('0x4c')]=[{'all':!![]}];}return db[_0x1ea3('0x5b')]['findAll'](_0x1b42ae);})[_0x1ea3('0x29')](function(_0x4e8443){_0x4a5b74[_0x1ea3('0x48')]=_0x4e8443;return _0x4a5b74;});}})[_0x1ea3('0x29')](respondWithFilteredResult(_0x3d4811,_0x1b42ae))[_0x1ea3('0x49')](handleError(_0x3d4811,null));};exports['removeDispositions']=function(_0x2e2d84,_0x2990bc,_0x34e720){return db['CmList'][_0x1ea3('0x4d')]({'where':{'id':_0x2e2d84[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x2990bc,null))[_0x1ea3('0x29')](function(_0x45a2dc){if(_0x45a2dc){return _0x45a2dc[_0x1ea3('0x60')](_0x2e2d84[_0x1ea3('0x38')][_0x1ea3('0x61')]);}})[_0x1ea3('0x29')](respondWithStatusCode(_0x2990bc,null))[_0x1ea3('0x49')](handleError(_0x2990bc,null));};exports['addContacts']=function(_0x289b44,_0x382846,_0x55303d){return db[_0x1ea3('0x32')][_0x1ea3('0x4d')]({'where':{'id':_0x289b44[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x382846,null))[_0x1ea3('0x29')](function(_0x439589){if(_0x439589){var _0x5455b9=[];var _0x50f512={'success':[],'errors':[]};return db[_0x1ea3('0x62')][_0x1ea3('0x58')]()[_0x1ea3('0x29')](function(_0x203aa3){if(_0x289b44[_0x1ea3('0x4e')][_0x1ea3('0x63')]&&_[_0x1ea3('0x64')](_0x289b44[_0x1ea3('0x4e')][_0x1ea3('0x63')])){if(_0x289b44[_0x1ea3('0x4e')][_0x1ea3('0x63')][_0x1ea3('0x65')]){_0x289b44[_0x1ea3('0x4e')][_0x1ea3('0x63')]=_0x289b44[_0x1ea3('0x4e')]['tags'][_0x1ea3('0x66')](';')+';';}else{_0x289b44['body'][_0x1ea3('0x63')]=null;}}else{_0x289b44['body'][_0x1ea3('0x63')]=null;}if(_0x289b44[_0x1ea3('0x4e')]&&_[_0x1ea3('0x64')](_0x289b44[_0x1ea3('0x4e')])){for(var _0x4854c2=0x0;_0x4854c2<_0x289b44[_0x1ea3('0x4e')][_0x1ea3('0x65')];_0x4854c2+=0x1){_0x289b44[_0x1ea3('0x4e')][_0x4854c2][_0x1ea3('0x5a')]=_0x289b44[_0x1ea3('0x4b')]['id'];_0x5455b9['push'](_0x289b44[_0x1ea3('0x4e')][_0x4854c2]);}return BPromise[_0x1ea3('0x67')](_0x5455b9,function(_0x57baaf){return db[_0x1ea3('0x62')][_0x1ea3('0x56')](_[_0x1ea3('0x68')](_0x57baaf,[_0x1ea3('0x61'),'id'])||{},{'fields':_[_0x1ea3('0x37')](_0x203aa3),'raw':!![]})['then'](function(_0x3d0f02){_0x50f512['success'][_0x1ea3('0x69')](_0x3d0f02[_0x1ea3('0x6a')]);})['catch'](function(_0x142c01){_0x50f512['errors'][_0x1ea3('0x69')]({'data':_0x57baaf,'error':_0x142c01[_0x1ea3('0x6b')]});});})['then'](function(_0x311f5d){return _0x50f512;})['catch'](function(_0xeafec6){return _0xeafec6;});}else{_0x382846[_0x1ea3('0x1e')](0x190)[_0x1ea3('0x20')]({'message':_0x1ea3('0x6c')});}});}})[_0x1ea3('0x29')](respondWithResult(_0x382846,null))[_0x1ea3('0x49')](handleError(_0x382846,null));};exports[_0x1ea3('0x6d')]=function(_0x16f934,_0x9d028d,_0x149a17){var _0x43119b;return db[_0x1ea3('0x32')]['find']({'where':{'id':_0x16f934['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x1ea3('0x6e')}]})['then'](handleEntityNotFound(_0x9d028d,null))['then'](function(_0x53d892){if(_0x53d892){_0x43119b=_0x53d892;return db[_0x1ea3('0x62')][_0x1ea3('0x33')];}})[_0x1ea3('0x29')](function(_0x26145e){if(_0x26145e){var _0x1fd293={};var _0x38c6ca={};_0x38c6ca[_0x1ea3('0x36')]=_[_0x1ea3('0x6f')](_[_0x1ea3('0x37')](_0x26145e),_[_0x1ea3('0x31')](_0x43119b['CustomFields'],function(_0x2e736d){return util['format'](_0x1ea3('0x70'),_0x2e736d['id']);}));_0x38c6ca[_0x1ea3('0x38')]=_['keys'](_0x16f934[_0x1ea3('0x38')]);_0x38c6ca[_0x1ea3('0x41')]=_[_0x1ea3('0x3a')](_0x38c6ca[_0x1ea3('0x36')],_0x38c6ca[_0x1ea3('0x38')]);_0x1fd293[_0x1ea3('0x39')]=_[_0x1ea3('0x3a')](_0x38c6ca[_0x1ea3('0x36')],qs['fields'](_0x16f934['query'][_0x1ea3('0x3b')]));_0x1fd293[_0x1ea3('0x39')]=_0x1fd293['attributes'][_0x1ea3('0x65')]?_0x1fd293['attributes']:_0x38c6ca['model'];if(!_0x16f934[_0x1ea3('0x38')][_0x1ea3('0x5e')]('nolimit')){_0x1fd293[_0x1ea3('0x3d')]=qs['limit'](_0x16f934[_0x1ea3('0x38')]['limit']);_0x1fd293['offset']=qs[_0x1ea3('0x22')](_0x16f934[_0x1ea3('0x38')]['offset']);}_0x1fd293[_0x1ea3('0x5f')]=qs[_0x1ea3('0x3e')](_0x16f934[_0x1ea3('0x38')][_0x1ea3('0x3e')]);_0x1fd293[_0x1ea3('0x3f')]=qs[_0x1ea3('0x41')](_['pick'](_0x16f934['query'],_0x38c6ca['filters']));_0x1fd293[_0x1ea3('0x71')]=!![];if(_0x16f934[_0x1ea3('0x38')][_0x1ea3('0x42')]){_0x1fd293[_0x1ea3('0x3f')]=_['merge'](_0x1fd293[_0x1ea3('0x3f')],{'$or':_['map'](_0x1fd293['attributes'],function(_0x173327){var _0x3ebdfb={};_0x3ebdfb[_0x173327]={'$like':'%'+_0x16f934['query'][_0x1ea3('0x42')]+'%'};return _0x3ebdfb;})});}_0x1fd293=_[_0x1ea3('0x44')]({},_0x1fd293,_0x16f934[_0x1ea3('0x45')]);return _0x43119b[_0x1ea3('0x6d')](_0x1fd293);}})[_0x1ea3('0x29')](respondWithResult(_0x9d028d,null))[_0x1ea3('0x49')](handleError(_0x9d028d,null));};exports[_0x1ea3('0x72')]=function(_0x4ba07e,_0x5c4367,_0xf63ba1){var _0x1dcaeb;return db[_0x1ea3('0x32')]['find']({'where':{'id':_0x4ba07e[_0x1ea3('0x4b')]['id']},'include':[{'model':db[_0x1ea3('0x73')],'as':_0x1ea3('0x6e')}]})[_0x1ea3('0x29')](handleEntityNotFound(_0x5c4367,null))['then'](function(_0x139b7a){if(_0x139b7a){_0x1dcaeb=_0x139b7a;return db['CmContact'][_0x1ea3('0x33')];}})[_0x1ea3('0x29')](function(_0x47e1ca){if(_0x47e1ca){var _0x4c93a8={};var _0x3e78c3={};_0x3e78c3[_0x1ea3('0x36')]=_['concat'](_[_0x1ea3('0x37')](_0x47e1ca),_['map'](_0x1dcaeb[_0x1ea3('0x6e')],function(_0x46605a){return util['format'](_0x1ea3('0x70'),_0x46605a['id']);}));_0x3e78c3[_0x1ea3('0x38')]=_[_0x1ea3('0x37')](_0x4ba07e['query']);_0x3e78c3[_0x1ea3('0x41')]=_[_0x1ea3('0x3a')](_0x3e78c3['model'],_0x3e78c3[_0x1ea3('0x38')]);_0x4c93a8[_0x1ea3('0x39')]=_['intersection'](_0x3e78c3[_0x1ea3('0x36')],qs[_0x1ea3('0x3b')](_0x4ba07e['query'][_0x1ea3('0x3b')]));_0x4c93a8[_0x1ea3('0x39')]=_0x4c93a8[_0x1ea3('0x39')]['length']?_0x4c93a8['attributes']:_0x3e78c3[_0x1ea3('0x36')];if(!_0x4ba07e[_0x1ea3('0x38')]['hasOwnProperty'](_0x1ea3('0x3c'))){_0x4c93a8['limit']=qs[_0x1ea3('0x3d')](_0x4ba07e['query'][_0x1ea3('0x3d')]);_0x4c93a8[_0x1ea3('0x22')]=qs[_0x1ea3('0x22')](_0x4ba07e['query'][_0x1ea3('0x22')]);}_0x4c93a8[_0x1ea3('0x5f')]=qs['sort'](_0x4ba07e[_0x1ea3('0x38')]['sort']);_0x4c93a8['where']=qs[_0x1ea3('0x41')](_[_0x1ea3('0x40')](_0x4ba07e[_0x1ea3('0x38')],_0x3e78c3['filters']));_0x4c93a8[_0x1ea3('0x71')]=!![];if(_0x4ba07e[_0x1ea3('0x38')][_0x1ea3('0x42')]){_0x4c93a8[_0x1ea3('0x3f')]=_[_0x1ea3('0x44')](_0x4c93a8['where'],{'$or':_[_0x1ea3('0x31')](_0x4c93a8[_0x1ea3('0x39')],function(_0x3c463b){var _0x3c155b={};_0x3c155b[_0x3c463b]={'$like':'%'+_0x4ba07e[_0x1ea3('0x38')][_0x1ea3('0x42')]+'%'};return _0x3c155b;})});}_0x4c93a8=_['merge']({},_0x4c93a8,_0x4ba07e[_0x1ea3('0x45')]);return _0x1dcaeb[_0x1ea3('0x6d')](_0x4c93a8);}})['then'](function(_0x5188f5){if(!_[_0x1ea3('0x74')](_0x5188f5)){var _0x31f1f4=toCsv(_0x5188f5);var _0xc1178=Date[_0x1ea3('0x75')]();fs['writeFileSync'](util[_0x1ea3('0x76')](_0x1ea3('0x77'),_0x1dcaeb['id'],_0xc1178),_0x31f1f4);_0x5c4367[_0x1ea3('0x78')](_0x1ea3('0x79'),_0x1ea3('0x7a')+util[_0x1ea3('0x76')]('list_%d_%s.csv',_0x1dcaeb['id'],_0xc1178));_0x5c4367[_0x1ea3('0x78')](_0x1ea3('0x7b'),_0x1ea3('0x7c'));return _0x5c4367[_0x1ea3('0x7d')](util[_0x1ea3('0x76')](_0x1ea3('0x77'),_0x1dcaeb['id'],_0xc1178));}else{return _0x5c4367[_0x1ea3('0x7e')](0xcc);}})[_0x1ea3('0x49')](handleError(_0x5c4367,null));};exports[_0x1ea3('0x7f')]=function(_0x240374,_0x117c19,_0x354352){var _0x23b1ea;delete _0x240374['body']['id'];return db[_0x1ea3('0x32')][_0x1ea3('0x5d')]({'where':{'id':_0x240374['params']['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x117c19,null))[_0x1ea3('0x29')](function(_0x4010ee){if(_0x4010ee){return db[_0x1ea3('0x80')][_0x1ea3('0x81')](function(_0x200c8a){return db[_0x1ea3('0x73')][_0x1ea3('0x56')](_0x240374['body'],{'transaction':_0x200c8a})[_0x1ea3('0x29')](function(_0x52a626){_0x23b1ea=_0x52a626;return _0x4010ee[_0x1ea3('0x82')](_0x52a626,{'transaction':_0x200c8a});})[_0x1ea3('0x29')](function(){var _0x16324b={'type':db[_0x1ea3('0x83')][_0x1ea3('0x84')],'transaction':_0x200c8a};switch(_0x240374[_0x1ea3('0x4e')][_0x1ea3('0x34')]){case _0x1ea3('0x85'):_0x16324b[_0x1ea3('0x34')]=db[_0x1ea3('0x83')][_0x1ea3('0x84')];break;case _0x1ea3('0x86'):_0x16324b[_0x1ea3('0x34')]=db[_0x1ea3('0x83')][_0x1ea3('0x87')];break;case'switch':_0x16324b[_0x1ea3('0x34')]=db[_0x1ea3('0x83')]['BOOLEAN'];_0x16324b[_0x1ea3('0x88')]=![];break;default:}return db[_0x1ea3('0x80')]['queryInterface'][_0x1ea3('0x89')](_0x1ea3('0x8a'),util['format'](_0x1ea3('0x8b'),_0x23b1ea['id']),_0x16324b);})['then'](function(){return _0x23b1ea;});});}})[_0x1ea3('0x29')](respondWithResult(_0x117c19,null))['catch'](handleError(_0x117c19,null));};exports[_0x1ea3('0x8c')]=function(_0x5905eb,_0x1f5eb9,_0x1a4c9a){var _0x4cf8fa={};var _0xbc082={};var _0x1cea1c;var _0x1eaee0;return db[_0x1ea3('0x32')][_0x1ea3('0x5d')]({'where':{'id':_0x5905eb[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x1f5eb9,null))[_0x1ea3('0x29')](function(_0xa67dc8){if(_0xa67dc8){_0x1cea1c=_0xa67dc8;_0xbc082[_0x1ea3('0x36')]=_[_0x1ea3('0x37')](db[_0x1ea3('0x73')][_0x1ea3('0x33')]);_0xbc082[_0x1ea3('0x38')]=_['keys'](_0x5905eb[_0x1ea3('0x38')]);_0xbc082[_0x1ea3('0x41')]=_['intersection'](_0xbc082[_0x1ea3('0x36')],_0xbc082[_0x1ea3('0x38')]);_0x4cf8fa[_0x1ea3('0x39')]=_['intersection'](_0xbc082[_0x1ea3('0x36')],qs[_0x1ea3('0x3b')](_0x5905eb['query'][_0x1ea3('0x3b')]));_0x4cf8fa[_0x1ea3('0x39')]=_0x4cf8fa[_0x1ea3('0x39')][_0x1ea3('0x65')]?_0x4cf8fa[_0x1ea3('0x39')]:_0xbc082['model'];_0x4cf8fa[_0x1ea3('0x5f')]=qs[_0x1ea3('0x3e')](_0x5905eb[_0x1ea3('0x38')]['sort']);_0x4cf8fa[_0x1ea3('0x3f')]=qs[_0x1ea3('0x41')](_[_0x1ea3('0x40')](_0x5905eb['query'],_0xbc082[_0x1ea3('0x41')]));_0x4cf8fa[_0x1ea3('0x3f')]=_[_0x1ea3('0x44')](_0x4cf8fa[_0x1ea3('0x3f')],{'$or':[{'ListId':_0xa67dc8['id']},{'ListId':null}]});if(_0x5905eb[_0x1ea3('0x38')]['filter']){_0x4cf8fa['where']=_[_0x1ea3('0x44')](_0x4cf8fa['where'],{'$or':_[_0x1ea3('0x31')](_0x4cf8fa[_0x1ea3('0x39')],function(_0x2a8623){var _0x3f8210={};_0x3f8210[_0x2a8623]={'$like':'%'+_0x5905eb[_0x1ea3('0x38')][_0x1ea3('0x42')]+'%'};return _0x3f8210;})});}_0x4cf8fa=_[_0x1ea3('0x44')]({},_0x4cf8fa,_0x5905eb[_0x1ea3('0x45')]);return db[_0x1ea3('0x73')]['findAndCountAll'](_0x4cf8fa);}})[_0x1ea3('0x29')](respondWithResult(_0x1f5eb9,null))[_0x1ea3('0x49')](handleError(_0x1f5eb9,null));};exports[_0x1ea3('0x8d')]=function(_0x2f975f,_0x2afb6b,_0x519588){return db[_0x1ea3('0x32')][_0x1ea3('0x4d')]({'where':{'id':_0x2f975f[_0x1ea3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2afb6b,null))[_0x1ea3('0x29')](function(_0x2234e3){if(_0x2234e3){return _0x2234e3[_0x1ea3('0x8d')](_0x2f975f[_0x1ea3('0x4e')]['ids'],_['omit'](_0x2f975f[_0x1ea3('0x4e')],[_0x1ea3('0x61'),'id'])||{})[_0x1ea3('0x8e')](function(_0x17f8cc){for(var _0x3460db=0x0;_0x3460db<_0x2f975f[_0x1ea3('0x4e')][_0x1ea3('0x61')][_0x1ea3('0x65')];_0x3460db+=0x1){socket['emit'](_0x1ea3('0x8f'),{'UserId':_0x2f975f[_0x1ea3('0x4e')][_0x1ea3('0x61')][_0x3460db],'CmListId':_0x2f975f[_0x1ea3('0x4b')]['id']});}return _0x17f8cc;});}})[_0x1ea3('0x29')](respondWithResult(_0x2afb6b,null))[_0x1ea3('0x49')](handleError(_0x2afb6b,null));};exports[_0x1ea3('0x90')]=function(_0x31a733,_0x5f2044,_0x1728ed){return db['CmList'][_0x1ea3('0x4d')]({'where':{'id':_0x31a733[_0x1ea3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5f2044,null))[_0x1ea3('0x29')](function(_0x37e3bf){if(_0x37e3bf){return _0x37e3bf[_0x1ea3('0x90')](_0x31a733[_0x1ea3('0x38')][_0x1ea3('0x61')])['then'](function(){if(_[_0x1ea3('0x64')](_0x31a733['query'][_0x1ea3('0x61')])){for(var _0xea05b8=0x0;_0xea05b8<_0x31a733['query'][_0x1ea3('0x61')][_0x1ea3('0x65')];_0xea05b8+=0x1){socket[_0x1ea3('0x91')](_0x1ea3('0x92'),{'UserId':Number(_0x31a733[_0x1ea3('0x38')][_0x1ea3('0x61')][_0xea05b8]),'CmListId':Number(_0x31a733[_0x1ea3('0x4b')]['id'])});}}else{socket[_0x1ea3('0x91')](_0x1ea3('0x92'),{'UserId':Number(_0x31a733[_0x1ea3('0x38')][_0x1ea3('0x61')]),'CmListId':Number(_0x31a733['params']['id'])});}});}})[_0x1ea3('0x29')](respondWithStatusCode(_0x5f2044,null))['catch'](handleError(_0x5f2044,null));};exports[_0x1ea3('0x93')]=function(_0x4388dd,_0x58de04,_0x5e2b47){var _0x411950={};var _0x1f0b53={};var _0x1dcea7;var _0x50cf09;return db['CmList'][_0x1ea3('0x5d')]({'where':{'id':_0x4388dd[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x58de04,null))['then'](function(_0x27bee3){if(_0x27bee3){_0x1dcea7=_0x27bee3;_0x1f0b53[_0x1ea3('0x36')]=_[_0x1ea3('0x37')](db[_0x1ea3('0x94')][_0x1ea3('0x33')]);_0x1f0b53[_0x1ea3('0x38')]=_[_0x1ea3('0x37')](_0x4388dd[_0x1ea3('0x38')]);_0x1f0b53[_0x1ea3('0x41')]=_['intersection'](_0x1f0b53[_0x1ea3('0x36')],_0x1f0b53['query']);_0x411950[_0x1ea3('0x39')]=_[_0x1ea3('0x3a')](_0x1f0b53[_0x1ea3('0x36')],qs[_0x1ea3('0x3b')](_0x4388dd[_0x1ea3('0x38')]['fields']));_0x411950[_0x1ea3('0x39')]=_0x411950['attributes'][_0x1ea3('0x65')]?_0x411950[_0x1ea3('0x39')]:_0x1f0b53[_0x1ea3('0x36')];_0x411950['order']=qs[_0x1ea3('0x3e')](_0x4388dd[_0x1ea3('0x38')]['sort']);_0x411950[_0x1ea3('0x3f')]=qs[_0x1ea3('0x41')](_[_0x1ea3('0x40')](_0x4388dd[_0x1ea3('0x38')],_0x1f0b53[_0x1ea3('0x41')]));if(_0x4388dd['query']['filter']){_0x411950[_0x1ea3('0x3f')]=_[_0x1ea3('0x44')](_0x411950['where'],{'$or':_['map'](_0x411950[_0x1ea3('0x39')],function(_0x2d8154){var _0xac4eef={};_0xac4eef[_0x2d8154]={'$like':'%'+_0x4388dd[_0x1ea3('0x38')]['filter']+'%'};return _0xac4eef;})});}_0x411950=_[_0x1ea3('0x44')]({},_0x411950,_0x4388dd[_0x1ea3('0x45')]);return _0x1dcea7[_0x1ea3('0x93')](_0x411950);}})['then'](function(_0x13824d){if(_0x13824d){_0x50cf09=_0x13824d['length'];if(!_0x4388dd[_0x1ea3('0x38')][_0x1ea3('0x5e')](_0x1ea3('0x3c'))){_0x411950[_0x1ea3('0x3d')]=qs[_0x1ea3('0x3d')](_0x4388dd['query']['limit']);_0x411950['offset']=qs[_0x1ea3('0x22')](_0x4388dd['query']['offset']);}return _0x1dcea7['getAgents'](_0x411950);}})[_0x1ea3('0x29')](function(_0x3849df){if(_0x3849df){return _0x3849df?{'count':_0x50cf09,'rows':_0x3849df}:null;}})['then'](respondWithResult(_0x58de04,null))[_0x1ea3('0x49')](handleError(_0x58de04,null));}; \ No newline at end of file +var _0x29e5=['spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','html-pdf','eml-format','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','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','json','count','offset','set','Content-Range','apply','reject','save','then','get','Lists','status','error','stack','name','map','CmList','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','addDisposition','ListId','Disposition','getDispositions','findOne','rawAttributes','nolimit','removeDispositions','CmContact','tags','join','isArray','push','omit','ids','success','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','cf_%d','order','getContactsCsv','format','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction','Sequelize','TEXT','text','number','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents'];(function(_0x231a02,_0x2a9e36){var _0x3ae533=function(_0xba726e){while(--_0xba726e){_0x231a02['push'](_0x231a02['shift']());}};_0x3ae533(++_0x2a9e36);}(_0x29e5,0x128));var _0x529e=function(_0x4ba639,_0x198541){_0x4ba639=_0x4ba639-0x0;var _0x7b6980=_0x29e5[_0x4ba639];return _0x7b6980;};'use strict';var pdf=require(_0x529e('0x0'));var emlformat=require(_0x529e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x529e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x529e('0x3'));var moment=require(_0x529e('0x4'));var BPromise=require(_0x529e('0x5'));var Mustache=require(_0x529e('0x6'));var util=require(_0x529e('0x7'));var path=require(_0x529e('0x8'));var sox=require(_0x529e('0x9'));var csv=require(_0x529e('0xa'));var ejs=require(_0x529e('0xb'));var fs=require('fs');var _=require(_0x529e('0xc'));var squel=require('squel');var crypto=require(_0x529e('0xd'));var jsforce=require(_0x529e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x529e('0xa'));var querystring=require(_0x529e('0xf'));var Papa=require(_0x529e('0x10'));var Redis=require('ioredis');var authService=require(_0x529e('0x11'));var qs=require(_0x529e('0x12'));var as=require(_0x529e('0x13'));var hardwareService=require(_0x529e('0x14'));var logger=require('../../config/logger')(_0x529e('0x15'));var utils=require(_0x529e('0x16'));var config=require(_0x529e('0x17'));var licenseUtil=require(_0x529e('0x18'));var db=require(_0x529e('0x19'))['db'];config[_0x529e('0x1a')]=_['defaults'](config['redis'],{'host':_0x529e('0x1b'),'port':0x18eb});var socket=require(_0x529e('0x1c'))(new Redis(config[_0x529e('0x1a')]));require(_0x529e('0x1d'))[_0x529e('0x1e')](socket);function respondWithStatusCode(_0x30887c,_0xd03afe){_0xd03afe=_0xd03afe||0xcc;return function(_0x17275e){if(_0x17275e){return _0x30887c[_0x529e('0x1f')](_0xd03afe);}return _0x30887c['status'](_0xd03afe)[_0x529e('0x20')]();};}function respondWithResult(_0x4ee768,_0x5e2eaa){_0x5e2eaa=_0x5e2eaa||0xc8;return function(_0x71cb2b){if(_0x71cb2b){return _0x4ee768['status'](_0x5e2eaa)[_0x529e('0x21')](_0x71cb2b);}};}function respondWithFilteredResult(_0x3ee26e,_0x483156){return function(_0x236594){if(_0x236594){var _0x30f0af=_0x236594[_0x529e('0x22')],_0x3764f5=_0x483156['offset'],_0x4addca=_0x483156[_0x529e('0x23')]+_0x483156['limit'],_0x49a6ba;if(_0x4addca>=_0x30f0af){_0x4addca=_0x30f0af;_0x49a6ba=0xc8;}else{_0x49a6ba=0xce;}_0x3ee26e['status'](_0x49a6ba);return _0x3ee26e[_0x529e('0x24')](_0x529e('0x25'),_0x3764f5+'-'+_0x4addca+'/'+_0x30f0af)[_0x529e('0x21')](_0x236594);}return null;};}function patchUpdates(_0xc46442){return function(_0x2f991d){try{jsonpatch[_0x529e('0x26')](_0x2f991d,_0xc46442,!![]);}catch(_0x32be22){return BPromise[_0x529e('0x27')](_0x32be22);}return _0x2f991d[_0x529e('0x28')]();};}function saveUpdates(_0x2d308d,_0x1a633e){return function(_0x102236){if(_0x102236){return _0x102236['update'](_0x2d308d)[_0x529e('0x29')](function(_0x115a28){return _0x115a28;});}return null;};}function removeEntity(_0x41d038,_0x1d1b4d){return function(_0x172b48){if(_0x172b48){return _0x172b48['destroy']()['then'](function(){var _0x9ca43c=_0x172b48[_0x529e('0x2a')]({'plain':!![]});var _0x1ead53=_0x529e('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x1ead53,'resourceId':_0x9ca43c['id']}})[_0x529e('0x29')](function(){return _0x172b48;});})['then'](function(){_0x41d038[_0x529e('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46cd6d,_0x130190){return function(_0x6c4e3e){if(!_0x6c4e3e){_0x46cd6d['sendStatus'](0x194);}return _0x6c4e3e;};}function handleError(_0x5c5e20,_0xd8fb17){_0xd8fb17=_0xd8fb17||0x1f4;return function(_0x533cd4){logger[_0x529e('0x2d')](_0x533cd4[_0x529e('0x2e')]);if(_0x533cd4[_0x529e('0x2f')]){delete _0x533cd4[_0x529e('0x2f')];}_0x5c5e20['status'](_0xd8fb17)['send'](_0x533cd4);};}exports['index']=function(_0x41a2e8,_0x2a925f){var _0x20d9c4={},_0x17ee44={},_0x143d96={'count':0x0,'rows':[]};var _0x3f5728=_[_0x529e('0x30')](db[_0x529e('0x31')]['rawAttributes'],function(_0x289ac0){return{'name':_0x289ac0[_0x529e('0x32')],'type':_0x289ac0[_0x529e('0x33')][_0x529e('0x34')]};});_0x17ee44['model']=_[_0x529e('0x30')](_0x3f5728,'name');_0x17ee44[_0x529e('0x35')]=_[_0x529e('0x36')](_0x41a2e8['query']);_0x17ee44[_0x529e('0x37')]=_[_0x529e('0x38')](_0x17ee44[_0x529e('0x39')],_0x17ee44[_0x529e('0x35')]);_0x20d9c4[_0x529e('0x3a')]=_['intersection'](_0x17ee44['model'],qs[_0x529e('0x3b')](_0x41a2e8[_0x529e('0x35')]['fields']));_0x20d9c4[_0x529e('0x3a')]=_0x20d9c4['attributes'][_0x529e('0x3c')]?_0x20d9c4['attributes']:_0x17ee44[_0x529e('0x39')];if(!_0x41a2e8[_0x529e('0x35')][_0x529e('0x3d')]('nolimit')){_0x20d9c4[_0x529e('0x3e')]=qs[_0x529e('0x3e')](_0x41a2e8[_0x529e('0x35')][_0x529e('0x3e')]);_0x20d9c4[_0x529e('0x23')]=qs['offset'](_0x41a2e8['query'][_0x529e('0x23')]);}_0x20d9c4['order']=qs[_0x529e('0x3f')](_0x41a2e8[_0x529e('0x35')][_0x529e('0x3f')]);_0x20d9c4['where']=qs[_0x529e('0x37')](_[_0x529e('0x40')](_0x41a2e8[_0x529e('0x35')],_0x17ee44[_0x529e('0x37')]),_0x3f5728);if(_0x41a2e8[_0x529e('0x35')][_0x529e('0x41')]){_0x20d9c4[_0x529e('0x42')]=_[_0x529e('0x43')](_0x20d9c4['where'],{'$or':_[_0x529e('0x30')](_0x3f5728,function(_0x16257f){if(_0x16257f[_0x529e('0x33')]!==_0x529e('0x44')){var _0x2b0520={};_0x2b0520[_0x16257f[_0x529e('0x2f')]]={'$like':'%'+_0x41a2e8['query']['filter']+'%'};return _0x2b0520;}})});}_0x20d9c4=_[_0x529e('0x43')]({},_0x20d9c4,_0x41a2e8[_0x529e('0x45')]);var _0x12dedb={'where':_0x20d9c4[_0x529e('0x42')]};return db[_0x529e('0x31')]['count'](_0x12dedb)['then'](function(_0x27f4d1){_0x143d96[_0x529e('0x22')]=_0x27f4d1;if(_0x41a2e8[_0x529e('0x35')][_0x529e('0x46')]){_0x20d9c4['include']=[{'all':!![]}];}return db[_0x529e('0x31')][_0x529e('0x47')](_0x20d9c4);})['then'](function(_0x273b93){_0x143d96[_0x529e('0x48')]=_0x273b93;return _0x143d96;})[_0x529e('0x29')](respondWithFilteredResult(_0x2a925f,_0x20d9c4))[_0x529e('0x49')](handleError(_0x2a925f,null));};exports[_0x529e('0x4a')]=function(_0x316a2a,_0x59b875){var _0x893a89={'raw':![],'where':{'id':_0x316a2a[_0x529e('0x4b')]['id']}},_0x31bb1a={};_0x31bb1a[_0x529e('0x39')]=_[_0x529e('0x36')](db[_0x529e('0x31')]['rawAttributes']);_0x31bb1a[_0x529e('0x35')]=_[_0x529e('0x36')](_0x316a2a['query']);_0x31bb1a[_0x529e('0x37')]=_['intersection'](_0x31bb1a[_0x529e('0x39')],_0x31bb1a[_0x529e('0x35')]);_0x893a89[_0x529e('0x3a')]=_['intersection'](_0x31bb1a['model'],qs[_0x529e('0x3b')](_0x316a2a[_0x529e('0x35')]['fields']));_0x893a89['attributes']=_0x893a89[_0x529e('0x3a')]['length']?_0x893a89['attributes']:_0x31bb1a[_0x529e('0x39')];if(_0x316a2a[_0x529e('0x35')]['includeAll']){_0x893a89[_0x529e('0x4c')]=[{'all':!![]}];}_0x893a89=_[_0x529e('0x43')]({},_0x893a89,_0x316a2a[_0x529e('0x45')]);return db[_0x529e('0x31')][_0x529e('0x4d')](_0x893a89)[_0x529e('0x29')](handleEntityNotFound(_0x59b875,null))[_0x529e('0x29')](respondWithResult(_0x59b875,null))[_0x529e('0x49')](handleError(_0x59b875,null));};exports['create']=function(_0x463685,_0x4f5b85){return db['CmList'][_0x529e('0x4e')](_0x463685['body'],{})[_0x529e('0x29')](function(_0x2986ff){var _0x1c73e9=_0x463685[_0x529e('0x4f')][_0x529e('0x2a')]({'plain':!![]});if(!_0x1c73e9)throw new Error(_0x529e('0x50'));if(_0x1c73e9[_0x529e('0x51')]===_0x529e('0x4f')){var _0xc84ddf=_0x2986ff[_0x529e('0x2a')]({'plain':!![]});var _0x4626ea='Lists';return db[_0x529e('0x52')][_0x529e('0x4d')]({'where':{'name':_0x4626ea,'userProfileId':_0x1c73e9[_0x529e('0x53')]},'raw':!![]})[_0x529e('0x29')](function(_0x13239a){if(_0x13239a&&_0x13239a['autoAssociation']===0x0){return db['UserProfileResource'][_0x529e('0x4e')]({'name':_0xc84ddf[_0x529e('0x2f')],'resourceId':_0xc84ddf['id'],'type':_0x13239a['name'],'sectionId':_0x13239a['id']},{})[_0x529e('0x29')](function(){return _0x2986ff;});}else{return _0x2986ff;}})[_0x529e('0x49')](function(_0x6da6c8){logger['error'](_0x529e('0x54'),_0x6da6c8);throw _0x6da6c8;});}return _0x2986ff;})[_0x529e('0x29')](respondWithResult(_0x4f5b85,0xc9))[_0x529e('0x49')](handleError(_0x4f5b85,null));};exports[_0x529e('0x55')]=function(_0x13038b,_0x31f3ae){if(_0x13038b[_0x529e('0x56')]['id']){delete _0x13038b['body']['id'];}return db[_0x529e('0x31')]['find']({'where':{'id':_0x13038b[_0x529e('0x4b')]['id']}})[_0x529e('0x29')](handleEntityNotFound(_0x31f3ae,null))[_0x529e('0x29')](saveUpdates(_0x13038b[_0x529e('0x56')],null))[_0x529e('0x29')](respondWithResult(_0x31f3ae,null))[_0x529e('0x49')](handleError(_0x31f3ae,null));};exports[_0x529e('0x57')]=function(_0x145c49,_0x38f77d){return db[_0x529e('0x31')][_0x529e('0x4d')]({'where':{'id':_0x145c49[_0x529e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x38f77d,null))[_0x529e('0x29')](removeEntity(_0x38f77d,null))[_0x529e('0x49')](handleError(_0x38f77d,null));};exports[_0x529e('0x58')]=function(_0x40f401,_0x429c1e){return db[_0x529e('0x31')]['describe']()[_0x529e('0x29')](respondWithResult(_0x429c1e,null))[_0x529e('0x49')](handleError(_0x429c1e,null));};exports[_0x529e('0x59')]=function(_0x326e5b,_0x52a6d9,_0x280a5){if(_0x326e5b[_0x529e('0x56')]['id']){delete _0x326e5b['body']['id'];}return db[_0x529e('0x31')]['find']({'where':{'id':_0x326e5b[_0x529e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x52a6d9,null))[_0x529e('0x29')](function(_0x430762){if(_0x430762){_0x326e5b[_0x529e('0x56')][_0x529e('0x5a')]=_0x430762['id'];return db[_0x529e('0x5b')][_0x529e('0x4e')](_0x326e5b['body']);}})[_0x529e('0x29')](respondWithResult(_0x52a6d9,null))[_0x529e('0x49')](handleError(_0x52a6d9,null));};exports[_0x529e('0x5c')]=function(_0x11f2d6,_0x409067,_0x42938e){var _0x27ccd0={'raw':![],'where':{}};var _0x1373a5={};var _0x316b62={'count':0x0,'rows':[]};return db[_0x529e('0x31')][_0x529e('0x5d')]({'where':{'id':_0x11f2d6[_0x529e('0x4b')]['id']}})[_0x529e('0x29')](handleEntityNotFound(_0x409067,null))[_0x529e('0x29')](function(_0x15098d){if(_0x15098d){_0x1373a5[_0x529e('0x39')]=_[_0x529e('0x36')](db[_0x529e('0x5b')][_0x529e('0x5e')]);_0x1373a5[_0x529e('0x35')]=_[_0x529e('0x36')](_0x11f2d6[_0x529e('0x35')]);_0x1373a5[_0x529e('0x37')]=_[_0x529e('0x38')](_0x1373a5[_0x529e('0x39')],_0x1373a5[_0x529e('0x35')]);_0x27ccd0[_0x529e('0x3a')]=_[_0x529e('0x38')](_0x1373a5[_0x529e('0x39')],qs['fields'](_0x11f2d6[_0x529e('0x35')][_0x529e('0x3b')]));_0x27ccd0[_0x529e('0x3a')]=_0x27ccd0[_0x529e('0x3a')][_0x529e('0x3c')]?_0x27ccd0[_0x529e('0x3a')]:_0x1373a5[_0x529e('0x39')];if(!_0x11f2d6[_0x529e('0x35')]['hasOwnProperty'](_0x529e('0x5f'))){_0x27ccd0[_0x529e('0x3e')]=qs[_0x529e('0x3e')](_0x11f2d6[_0x529e('0x35')][_0x529e('0x3e')]);_0x27ccd0[_0x529e('0x23')]=qs['offset'](_0x11f2d6[_0x529e('0x35')][_0x529e('0x23')]);}_0x27ccd0['order']=qs[_0x529e('0x3f')](_0x11f2d6['query'][_0x529e('0x3f')]);_0x27ccd0[_0x529e('0x42')]=qs[_0x529e('0x37')](_[_0x529e('0x40')](_0x11f2d6['query'],_0x1373a5[_0x529e('0x37')]));_0x27ccd0[_0x529e('0x42')][_0x529e('0x5a')]=_0x15098d['id'];if(_0x11f2d6[_0x529e('0x35')][_0x529e('0x41')]){_0x27ccd0[_0x529e('0x42')]=_['merge'](_0x27ccd0['where'],{'$or':_['map'](_0x27ccd0[_0x529e('0x3a')],function(_0xfa83f8){var _0x45a0c0={};_0x45a0c0[_0xfa83f8]={'$like':'%'+_0x11f2d6[_0x529e('0x35')]['filter']+'%'};return _0x45a0c0;})});}_0x27ccd0=_[_0x529e('0x43')]({},_0x27ccd0,_0x11f2d6[_0x529e('0x45')]);return db['Disposition'][_0x529e('0x22')]({'where':_0x27ccd0[_0x529e('0x42')]})[_0x529e('0x29')](function(_0x2ae6db){_0x316b62[_0x529e('0x22')]=_0x2ae6db;if(_0x11f2d6[_0x529e('0x35')][_0x529e('0x46')]){_0x27ccd0[_0x529e('0x4c')]=[{'all':!![]}];}return db['Disposition'][_0x529e('0x47')](_0x27ccd0);})[_0x529e('0x29')](function(_0x482268){_0x316b62[_0x529e('0x48')]=_0x482268;return _0x316b62;});}})[_0x529e('0x29')](respondWithFilteredResult(_0x409067,_0x27ccd0))[_0x529e('0x49')](handleError(_0x409067,null));};exports[_0x529e('0x60')]=function(_0x4c342b,_0x717cc3,_0x2425cc){return db[_0x529e('0x31')][_0x529e('0x4d')]({'where':{'id':_0x4c342b[_0x529e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x717cc3,null))[_0x529e('0x29')](function(_0x22b3d3){if(_0x22b3d3){return _0x22b3d3[_0x529e('0x60')](_0x4c342b[_0x529e('0x35')]['ids']);}})[_0x529e('0x29')](respondWithStatusCode(_0x717cc3,null))[_0x529e('0x49')](handleError(_0x717cc3,null));};exports['addContacts']=function(_0x38c484,_0x1bff06,_0x35203f){return db[_0x529e('0x31')][_0x529e('0x4d')]({'where':{'id':_0x38c484[_0x529e('0x4b')]['id']}})[_0x529e('0x29')](handleEntityNotFound(_0x1bff06,null))['then'](function(_0x2acdf5){if(_0x2acdf5){var _0x37d9a3=[];var _0x314c15={'success':[],'errors':[]};return db[_0x529e('0x61')][_0x529e('0x58')]()[_0x529e('0x29')](function(_0x1d0d62){if(_0x38c484[_0x529e('0x56')]['tags']&&_['isArray'](_0x38c484[_0x529e('0x56')]['tags'])){if(_0x38c484[_0x529e('0x56')][_0x529e('0x62')][_0x529e('0x3c')]){_0x38c484[_0x529e('0x56')][_0x529e('0x62')]=_0x38c484[_0x529e('0x56')][_0x529e('0x62')][_0x529e('0x63')](';')+';';}else{_0x38c484['body'][_0x529e('0x62')]=null;}}else{_0x38c484['body'][_0x529e('0x62')]=null;}if(_0x38c484[_0x529e('0x56')]&&_[_0x529e('0x64')](_0x38c484['body'])){for(var _0x162203=0x0;_0x162203<_0x38c484[_0x529e('0x56')][_0x529e('0x3c')];_0x162203+=0x1){_0x38c484['body'][_0x162203][_0x529e('0x5a')]=_0x38c484[_0x529e('0x4b')]['id'];_0x37d9a3[_0x529e('0x65')](_0x38c484[_0x529e('0x56')][_0x162203]);}return BPromise['each'](_0x37d9a3,function(_0x5a7c31){return db[_0x529e('0x61')][_0x529e('0x4e')](_[_0x529e('0x66')](_0x5a7c31,[_0x529e('0x67'),'id'])||{},{'fields':_[_0x529e('0x36')](_0x1d0d62),'raw':!![]})[_0x529e('0x29')](function(_0x18ac41){_0x314c15[_0x529e('0x68')][_0x529e('0x65')](_0x18ac41['dataValues']);})[_0x529e('0x49')](function(_0x29d775){_0x314c15['errors'][_0x529e('0x65')]({'data':_0x5a7c31,'error':_0x29d775[_0x529e('0x69')]});});})[_0x529e('0x29')](function(_0x4b1f31){return _0x314c15;})['catch'](function(_0x13bae1){return _0x13bae1;});}else{_0x1bff06[_0x529e('0x2c')](0x190)['json']({'message':_0x529e('0x6a')});}});}})[_0x529e('0x29')](respondWithResult(_0x1bff06,null))[_0x529e('0x49')](handleError(_0x1bff06,null));};exports[_0x529e('0x6b')]=function(_0x242812,_0x238997,_0x2792ae){var _0x338a0d;return db['CmList'][_0x529e('0x4d')]({'where':{'id':_0x242812['params']['id']},'include':[{'model':db[_0x529e('0x6c')],'as':'CustomFields'}]})[_0x529e('0x29')](handleEntityNotFound(_0x238997,null))[_0x529e('0x29')](function(_0x208edf){if(_0x208edf){_0x338a0d=_0x208edf;return db[_0x529e('0x61')][_0x529e('0x5e')];}})[_0x529e('0x29')](function(_0xc940c0){if(_0xc940c0){var _0x2501a1={};var _0x2abcc8={};_0x2abcc8['model']=_['concat'](_[_0x529e('0x36')](_0xc940c0),_[_0x529e('0x30')](_0x338a0d[_0x529e('0x6d')],function(_0x6881af){return util['format'](_0x529e('0x6e'),_0x6881af['id']);}));_0x2abcc8[_0x529e('0x35')]=_['keys'](_0x242812[_0x529e('0x35')]);_0x2abcc8[_0x529e('0x37')]=_[_0x529e('0x38')](_0x2abcc8[_0x529e('0x39')],_0x2abcc8['query']);_0x2501a1[_0x529e('0x3a')]=_['intersection'](_0x2abcc8[_0x529e('0x39')],qs[_0x529e('0x3b')](_0x242812['query'][_0x529e('0x3b')]));_0x2501a1[_0x529e('0x3a')]=_0x2501a1[_0x529e('0x3a')][_0x529e('0x3c')]?_0x2501a1['attributes']:_0x2abcc8[_0x529e('0x39')];if(!_0x242812[_0x529e('0x35')][_0x529e('0x3d')](_0x529e('0x5f'))){_0x2501a1[_0x529e('0x3e')]=qs[_0x529e('0x3e')](_0x242812[_0x529e('0x35')]['limit']);_0x2501a1[_0x529e('0x23')]=qs[_0x529e('0x23')](_0x242812[_0x529e('0x35')][_0x529e('0x23')]);}_0x2501a1[_0x529e('0x6f')]=qs['sort'](_0x242812[_0x529e('0x35')][_0x529e('0x3f')]);_0x2501a1[_0x529e('0x42')]=qs['filters'](_[_0x529e('0x40')](_0x242812[_0x529e('0x35')],_0x2abcc8[_0x529e('0x37')]));_0x2501a1['raw']=!![];if(_0x242812[_0x529e('0x35')][_0x529e('0x41')]){_0x2501a1[_0x529e('0x42')]=_['merge'](_0x2501a1['where'],{'$or':_[_0x529e('0x30')](_0x2501a1[_0x529e('0x3a')],function(_0x547a41){var _0x5bf418={};_0x5bf418[_0x547a41]={'$like':'%'+_0x242812[_0x529e('0x35')][_0x529e('0x41')]+'%'};return _0x5bf418;})});}_0x2501a1=_[_0x529e('0x43')]({},_0x2501a1,_0x242812[_0x529e('0x45')]);return _0x338a0d['getContacts'](_0x2501a1);}})[_0x529e('0x29')](respondWithResult(_0x238997,null))['catch'](handleError(_0x238997,null));};exports[_0x529e('0x70')]=function(_0x2e9059,_0x3f81b9,_0x13086e){var _0x97cac;return db[_0x529e('0x31')][_0x529e('0x4d')]({'where':{'id':_0x2e9059[_0x529e('0x4b')]['id']},'include':[{'model':db[_0x529e('0x6c')],'as':_0x529e('0x6d')}]})[_0x529e('0x29')](handleEntityNotFound(_0x3f81b9,null))[_0x529e('0x29')](function(_0x2093e2){if(_0x2093e2){_0x97cac=_0x2093e2;return db[_0x529e('0x61')][_0x529e('0x5e')];}})[_0x529e('0x29')](function(_0x103f3b){if(_0x103f3b){var _0x123acf={};var _0x3d344c={};_0x3d344c[_0x529e('0x39')]=_['concat'](_[_0x529e('0x36')](_0x103f3b),_[_0x529e('0x30')](_0x97cac[_0x529e('0x6d')],function(_0x5a25dd){return util[_0x529e('0x71')]('cf_%d',_0x5a25dd['id']);}));_0x3d344c[_0x529e('0x35')]=_['keys'](_0x2e9059[_0x529e('0x35')]);_0x3d344c['filters']=_[_0x529e('0x38')](_0x3d344c[_0x529e('0x39')],_0x3d344c[_0x529e('0x35')]);_0x123acf[_0x529e('0x3a')]=_['intersection'](_0x3d344c[_0x529e('0x39')],qs[_0x529e('0x3b')](_0x2e9059[_0x529e('0x35')]['fields']));_0x123acf[_0x529e('0x3a')]=_0x123acf[_0x529e('0x3a')]['length']?_0x123acf[_0x529e('0x3a')]:_0x3d344c[_0x529e('0x39')];if(!_0x2e9059[_0x529e('0x35')][_0x529e('0x3d')]('nolimit')){_0x123acf[_0x529e('0x3e')]=qs[_0x529e('0x3e')](_0x2e9059[_0x529e('0x35')][_0x529e('0x3e')]);_0x123acf[_0x529e('0x23')]=qs[_0x529e('0x23')](_0x2e9059['query'][_0x529e('0x23')]);}_0x123acf['order']=qs['sort'](_0x2e9059['query'][_0x529e('0x3f')]);_0x123acf[_0x529e('0x42')]=qs[_0x529e('0x37')](_[_0x529e('0x40')](_0x2e9059[_0x529e('0x35')],_0x3d344c['filters']));_0x123acf[_0x529e('0x72')]=!![];if(_0x2e9059[_0x529e('0x35')][_0x529e('0x41')]){_0x123acf[_0x529e('0x42')]=_['merge'](_0x123acf[_0x529e('0x42')],{'$or':_[_0x529e('0x30')](_0x123acf[_0x529e('0x3a')],function(_0x6bbfc){var _0x9747b0={};_0x9747b0[_0x6bbfc]={'$like':'%'+_0x2e9059[_0x529e('0x35')][_0x529e('0x41')]+'%'};return _0x9747b0;})});}_0x123acf=_[_0x529e('0x43')]({},_0x123acf,_0x2e9059['options']);return _0x97cac[_0x529e('0x6b')](_0x123acf);}})['then'](function(_0x34e0fc){if(!_[_0x529e('0x73')](_0x34e0fc)){var _0x57cc16=toCsv(_0x34e0fc);var _0xd8b4e8=Date[_0x529e('0x74')]();fs[_0x529e('0x75')](util[_0x529e('0x71')](_0x529e('0x76'),_0x97cac['id'],_0xd8b4e8),_0x57cc16);_0x3f81b9[_0x529e('0x77')]('Content-disposition','attachment;\x20filename='+util[_0x529e('0x71')](_0x529e('0x78'),_0x97cac['id'],_0xd8b4e8));_0x3f81b9[_0x529e('0x77')](_0x529e('0x79'),_0x529e('0x7a'));return _0x3f81b9[_0x529e('0x7b')](util[_0x529e('0x71')](_0x529e('0x76'),_0x97cac['id'],_0xd8b4e8));}else{return _0x3f81b9['sendStatus'](0xcc);}})[_0x529e('0x49')](handleError(_0x3f81b9,null));};exports['addCustomField']=function(_0x110fd3,_0x278e55,_0x5aaa29){var _0xc9a848;delete _0x110fd3[_0x529e('0x56')]['id'];return db[_0x529e('0x31')][_0x529e('0x5d')]({'where':{'id':_0x110fd3[_0x529e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x278e55,null))['then'](function(_0x36563c){if(_0x36563c){return db[_0x529e('0x7c')][_0x529e('0x7d')](function(_0x5725f2){return db[_0x529e('0x6c')]['create'](_0x110fd3['body'],{'transaction':_0x5725f2})['then'](function(_0x918de3){_0xc9a848=_0x918de3;return _0x36563c['addCustomFields'](_0x918de3,{'transaction':_0x5725f2});})[_0x529e('0x29')](function(){var _0x46cb3d={'type':db[_0x529e('0x7e')][_0x529e('0x7f')],'transaction':_0x5725f2};switch(_0x110fd3[_0x529e('0x56')][_0x529e('0x33')]){case _0x529e('0x80'):_0x46cb3d['type']=db[_0x529e('0x7e')]['TEXT'];break;case _0x529e('0x81'):_0x46cb3d[_0x529e('0x33')]=db['Sequelize']['INTEGER'];break;case'switch':_0x46cb3d[_0x529e('0x33')]=db[_0x529e('0x7e')][_0x529e('0x82')];_0x46cb3d[_0x529e('0x83')]=![];break;default:}return db[_0x529e('0x7c')][_0x529e('0x84')][_0x529e('0x85')](_0x529e('0x86'),util[_0x529e('0x71')](_0x529e('0x87'),_0xc9a848['id']),_0x46cb3d);})[_0x529e('0x29')](function(){return _0xc9a848;});});}})[_0x529e('0x29')](respondWithResult(_0x278e55,null))[_0x529e('0x49')](handleError(_0x278e55,null));};exports[_0x529e('0x88')]=function(_0x299852,_0x2aaa56,_0x575845){var _0x2aa75a={};var _0x5a80bb={};var _0x350938;var _0x42a944;return db[_0x529e('0x31')][_0x529e('0x5d')]({'where':{'id':_0x299852['params']['id']}})['then'](handleEntityNotFound(_0x2aaa56,null))['then'](function(_0x19abe4){if(_0x19abe4){_0x350938=_0x19abe4;_0x5a80bb['model']=_[_0x529e('0x36')](db['CmCustomField'][_0x529e('0x5e')]);_0x5a80bb['query']=_[_0x529e('0x36')](_0x299852[_0x529e('0x35')]);_0x5a80bb[_0x529e('0x37')]=_[_0x529e('0x38')](_0x5a80bb[_0x529e('0x39')],_0x5a80bb[_0x529e('0x35')]);_0x2aa75a['attributes']=_[_0x529e('0x38')](_0x5a80bb['model'],qs[_0x529e('0x3b')](_0x299852[_0x529e('0x35')][_0x529e('0x3b')]));_0x2aa75a['attributes']=_0x2aa75a[_0x529e('0x3a')]['length']?_0x2aa75a[_0x529e('0x3a')]:_0x5a80bb['model'];_0x2aa75a[_0x529e('0x6f')]=qs[_0x529e('0x3f')](_0x299852[_0x529e('0x35')][_0x529e('0x3f')]);_0x2aa75a[_0x529e('0x42')]=qs[_0x529e('0x37')](_[_0x529e('0x40')](_0x299852[_0x529e('0x35')],_0x5a80bb[_0x529e('0x37')]));_0x2aa75a[_0x529e('0x42')]=_['merge'](_0x2aa75a[_0x529e('0x42')],{'$or':[{'ListId':_0x19abe4['id']},{'ListId':null}]});if(_0x299852[_0x529e('0x35')][_0x529e('0x41')]){_0x2aa75a[_0x529e('0x42')]=_['merge'](_0x2aa75a['where'],{'$or':_[_0x529e('0x30')](_0x2aa75a['attributes'],function(_0x5da6fd){var _0x4d92ae={};_0x4d92ae[_0x5da6fd]={'$like':'%'+_0x299852[_0x529e('0x35')][_0x529e('0x41')]+'%'};return _0x4d92ae;})});}_0x2aa75a=_[_0x529e('0x43')]({},_0x2aa75a,_0x299852['options']);return db[_0x529e('0x6c')][_0x529e('0x89')](_0x2aa75a);}})['then'](respondWithResult(_0x2aaa56,null))['catch'](handleError(_0x2aaa56,null));};exports[_0x529e('0x8a')]=function(_0x1b9005,_0x406a2b,_0x4dce52){return db['CmList'][_0x529e('0x4d')]({'where':{'id':_0x1b9005[_0x529e('0x4b')]['id']}})[_0x529e('0x29')](handleEntityNotFound(_0x406a2b,null))[_0x529e('0x29')](function(_0x55af3e){if(_0x55af3e){return _0x55af3e[_0x529e('0x8a')](_0x1b9005['body'][_0x529e('0x67')],_['omit'](_0x1b9005[_0x529e('0x56')],[_0x529e('0x67'),'id'])||{})[_0x529e('0x8b')](function(_0x289688){for(var _0x5c749a=0x0;_0x5c749a<_0x1b9005[_0x529e('0x56')][_0x529e('0x67')][_0x529e('0x3c')];_0x5c749a+=0x1){socket['emit'](_0x529e('0x8c'),{'UserId':_0x1b9005[_0x529e('0x56')][_0x529e('0x67')][_0x5c749a],'CmListId':_0x1b9005[_0x529e('0x4b')]['id']});}return _0x289688;});}})[_0x529e('0x29')](respondWithResult(_0x406a2b,null))[_0x529e('0x49')](handleError(_0x406a2b,null));};exports['removeAgents']=function(_0x32e9a6,_0x40641b,_0x15a4ca){return db['CmList'][_0x529e('0x4d')]({'where':{'id':_0x32e9a6[_0x529e('0x4b')]['id']}})[_0x529e('0x29')](handleEntityNotFound(_0x40641b,null))[_0x529e('0x29')](function(_0x29207d){if(_0x29207d){return _0x29207d[_0x529e('0x8d')](_0x32e9a6['query']['ids'])[_0x529e('0x29')](function(){if(_['isArray'](_0x32e9a6[_0x529e('0x35')][_0x529e('0x67')])){for(var _0x52bca4=0x0;_0x52bca4<_0x32e9a6['query'][_0x529e('0x67')][_0x529e('0x3c')];_0x52bca4+=0x1){socket[_0x529e('0x8e')](_0x529e('0x8f'),{'UserId':Number(_0x32e9a6['query']['ids'][_0x52bca4]),'CmListId':Number(_0x32e9a6['params']['id'])});}}else{socket[_0x529e('0x8e')](_0x529e('0x8f'),{'UserId':Number(_0x32e9a6['query']['ids']),'CmListId':Number(_0x32e9a6[_0x529e('0x4b')]['id'])});}});}})[_0x529e('0x29')](respondWithStatusCode(_0x40641b,null))[_0x529e('0x49')](handleError(_0x40641b,null));};exports['getAgents']=function(_0x3bd227,_0x5d30b6,_0x141587){var _0x2262ca={};var _0x380b88={};var _0x511d5d;var _0x443114;return db[_0x529e('0x31')][_0x529e('0x5d')]({'where':{'id':_0x3bd227['params']['id']}})['then'](handleEntityNotFound(_0x5d30b6,null))[_0x529e('0x29')](function(_0x2d1aa8){if(_0x2d1aa8){_0x511d5d=_0x2d1aa8;_0x380b88[_0x529e('0x39')]=_['keys'](db['User'][_0x529e('0x5e')]);_0x380b88['query']=_[_0x529e('0x36')](_0x3bd227['query']);_0x380b88[_0x529e('0x37')]=_['intersection'](_0x380b88[_0x529e('0x39')],_0x380b88['query']);_0x2262ca['attributes']=_['intersection'](_0x380b88[_0x529e('0x39')],qs[_0x529e('0x3b')](_0x3bd227[_0x529e('0x35')][_0x529e('0x3b')]));_0x2262ca[_0x529e('0x3a')]=_0x2262ca[_0x529e('0x3a')][_0x529e('0x3c')]?_0x2262ca[_0x529e('0x3a')]:_0x380b88['model'];_0x2262ca[_0x529e('0x6f')]=qs['sort'](_0x3bd227[_0x529e('0x35')][_0x529e('0x3f')]);_0x2262ca[_0x529e('0x42')]=qs['filters'](_[_0x529e('0x40')](_0x3bd227[_0x529e('0x35')],_0x380b88[_0x529e('0x37')]));if(_0x3bd227['query'][_0x529e('0x41')]){_0x2262ca['where']=_['merge'](_0x2262ca['where'],{'$or':_[_0x529e('0x30')](_0x2262ca[_0x529e('0x3a')],function(_0x2aa6d5){var _0x5a59b5={};_0x5a59b5[_0x2aa6d5]={'$like':'%'+_0x3bd227['query']['filter']+'%'};return _0x5a59b5;})});}_0x2262ca=_[_0x529e('0x43')]({},_0x2262ca,_0x3bd227['options']);return _0x511d5d[_0x529e('0x90')](_0x2262ca);}})[_0x529e('0x29')](function(_0x244b94){if(_0x244b94){_0x443114=_0x244b94['length'];if(!_0x3bd227[_0x529e('0x35')][_0x529e('0x3d')](_0x529e('0x5f'))){_0x2262ca['limit']=qs[_0x529e('0x3e')](_0x3bd227[_0x529e('0x35')][_0x529e('0x3e')]);_0x2262ca[_0x529e('0x23')]=qs['offset'](_0x3bd227['query'][_0x529e('0x23')]);}return _0x511d5d[_0x529e('0x90')](_0x2262ca);}})['then'](function(_0x3b37b8){if(_0x3b37b8){return _0x3b37b8?{'count':_0x443114,'rows':_0x3b37b8}:null;}})[_0x529e('0x29')](respondWithResult(_0x5d30b6,null))[_0x529e('0x49')](handleError(_0x5d30b6,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index a4fb711..a295f43 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 _0x3d8f=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2df0bf,_0x13990c){var _0x5c46a3=function(_0x5716ea){while(--_0x5716ea){_0x2df0bf['push'](_0x2df0bf['shift']());}};_0x5c46a3(++_0x13990c);}(_0x3d8f,0x168));var _0xf3d8=function(_0x270b95,_0x5df63b){_0x270b95=_0x270b95-0x0;var _0x2fc44f=_0x3d8f[_0x270b95];return _0x2fc44f;};'use strict';var EventEmitter=require(_0xf3d8('0x0'));var CmList=require(_0xf3d8('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf3d8('0x2'),'afterUpdate':_0xf3d8('0x3'),'afterDestroy':_0xf3d8('0x4')};function emitEvent(_0x2fc617){return function(_0x46a60d,_0xd20f3d,_0x3308d3){CmListEvents[_0xf3d8('0x5')](_0x2fc617+':'+_0x46a60d['id'],_0x46a60d);CmListEvents[_0xf3d8('0x5')](_0x2fc617,_0x46a60d);_0x3308d3(null);};}for(var e in events){if(events[_0xf3d8('0x6')](e)){var event=events[e];CmList[_0xf3d8('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x3f43=['exports','events','../../mysqldb','CmList','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x242cbb,_0x22e98f){var _0x147ee6=function(_0x5ff58c){while(--_0x5ff58c){_0x242cbb['push'](_0x242cbb['shift']());}};_0x147ee6(++_0x22e98f);}(_0x3f43,0x16c));var _0x33f4=function(_0x53dd24,_0x30fef7){_0x53dd24=_0x53dd24-0x0;var _0x4cb5a6=_0x3f43[_0x53dd24];return _0x4cb5a6;};'use strict';var EventEmitter=require(_0x33f4('0x0'));var CmList=require(_0x33f4('0x1'))['db'][_0x33f4('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x33f4('0x3')](0x0);var events={'afterCreate':_0x33f4('0x4'),'afterUpdate':_0x33f4('0x5'),'afterDestroy':_0x33f4('0x6')};function emitEvent(_0x2bee9a){return function(_0x3cb73a,_0x4f6d31,_0x49d5ee){CmListEvents[_0x33f4('0x7')](_0x2bee9a+':'+_0x3cb73a['id'],_0x3cb73a);CmListEvents['emit'](_0x2bee9a,_0x3cb73a);_0x49d5ee(null);};}for(var e in events){if(events[_0x33f4('0x8')](e)){var event=events[e];CmList[_0x33f4('0x9')](e,emitEvent(event));}}module[_0x33f4('0xa')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 3adc395..d591da1 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 _0x679d=['exports','define','CmList','cm_lists','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x13f33c,_0x1abe88){var _0x14ce90=function(_0x3471ce){while(--_0x3471ce){_0x13f33c['push'](_0x13f33c['shift']());}};_0x14ce90(++_0x1abe88);}(_0x679d,0x126));var _0xd679=function(_0x54c3e9,_0x29c5d8){_0x54c3e9=_0x54c3e9-0x0;var _0x3e987d=_0x679d[_0x54c3e9];return _0x3e987d;};'use strict';var _=require('lodash');var util=require(_0xd679('0x0'));var logger=require(_0xd679('0x1'))('api');var moment=require(_0xd679('0x2'));var BPromise=require(_0xd679('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd679('0x4'));var config=require(_0xd679('0x5'));var attributes=require('./cmList.attributes');module[_0xd679('0x6')]=function(_0x1dce01,_0x8debbb){return _0x1dce01[_0xd679('0x7')](_0xd679('0x8'),attributes,{'tableName':_0xd679('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5e2=['bluebird','request-promise','./cmList.attributes','exports','define','CmList','cm_lists','lodash','../../config/logger','api','moment'];(function(_0x47e083,_0x3dcc9a){var _0x353ba6=function(_0x320ced){while(--_0x320ced){_0x47e083['push'](_0x47e083['shift']());}};_0x353ba6(++_0x3dcc9a);}(_0xa5e2,0xe3));var _0x2a5e=function(_0x1cdcb3,_0x16b7f8){_0x1cdcb3=_0x1cdcb3-0x0;var _0x2a115f=_0xa5e2[_0x1cdcb3];return _0x2a115f;};'use strict';var _=require(_0x2a5e('0x0'));var util=require('util');var logger=require(_0x2a5e('0x1'))(_0x2a5e('0x2'));var moment=require(_0x2a5e('0x3'));var BPromise=require(_0x2a5e('0x4'));var rp=require(_0x2a5e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2a5e('0x6'));module[_0x2a5e('0x7')]=function(_0x1003f5,_0x12dd32){return _0x1003f5[_0x2a5e('0x8')](_0x2a5e('0x9'),attributes,{'tableName':_0x2a5e('0xa'),'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 7ab420a..4be67c9 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 _0x5a0b=['client','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise'];(function(_0x4c264c,_0x2e1a49){var _0x1fe579=function(_0xbaf12){while(--_0xbaf12){_0x4c264c['push'](_0x4c264c['shift']());}};_0x1fe579(++_0x2e1a49);}(_0x5a0b,0x178));var _0xb5a0=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x5a0b[_0x42bc91];return _0x3f5507;};'use strict';var _=require(_0xb5a0('0x0'));var util=require('util');var moment=require(_0xb5a0('0x1'));var BPromise=require(_0xb5a0('0x2'));var rs=require(_0xb5a0('0x3'));var fs=require('fs');var Redis=require(_0xb5a0('0x4'));var db=require(_0xb5a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb5a0('0x6'));var config=require('../../config/environment');var jayson=require(_0xb5a0('0x7'));var client=jayson[_0xb5a0('0x8')]['http']({'port':0x232a});config['redis']=_[_0xb5a0('0x9')](config[_0xb5a0('0xa')],{'host':_0xb5a0('0xb'),'port':0x18eb});var socket=require(_0xb5a0('0xc'))(new Redis(config[_0xb5a0('0xa')]));require(_0xb5a0('0xd'))[_0xb5a0('0xe')](socket);function respondWithRpcPromise(_0x352db6,_0xdb3406,_0x201e34){return new BPromise(function(_0x3fb1d4,_0xab921d){return client[_0xb5a0('0xf')](_0x352db6,_0x201e34)['then'](function(_0x4f704a){logger[_0xb5a0('0x10')](_0xb5a0('0x11'),_0xdb3406,_0xb5a0('0x12'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0xdb3406,'request\x20sent',JSON['stringify'](_0x4f704a));if(_0x4f704a['error']){if(_0x4f704a[_0xb5a0('0x13')][_0xb5a0('0x14')]===0x1f4){logger[_0xb5a0('0x13')]('CmList,\x20%s,\x20%s',_0xdb3406,_0x4f704a[_0xb5a0('0x13')][_0xb5a0('0x15')]);return _0xab921d(_0x4f704a[_0xb5a0('0x13')][_0xb5a0('0x15')]);}logger['error'](_0xb5a0('0x11'),_0xdb3406,_0x4f704a['error'][_0xb5a0('0x15')]);return _0x3fb1d4(_0x4f704a[_0xb5a0('0x13')][_0xb5a0('0x15')]);}else{logger[_0xb5a0('0x10')](_0xb5a0('0x11'),_0xdb3406,_0xb5a0('0x12'));_0x3fb1d4(_0x4f704a[_0xb5a0('0x16')][_0xb5a0('0x15')]);}})[_0xb5a0('0x17')](function(_0x79e3f5){logger[_0xb5a0('0x13')](_0xb5a0('0x11'),_0xdb3406,_0x79e3f5);_0xab921d(_0x79e3f5);});});} \ No newline at end of file +var _0xc766=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x177332,_0x94795b){var _0xf99808=function(_0x5c9d17){while(--_0x5c9d17){_0x177332['push'](_0x177332['shift']());}};_0xf99808(++_0x94795b);}(_0xc766,0x113));var _0x6c76=function(_0x1750bb,_0x387d0a){_0x1750bb=_0x1750bb-0x0;var _0x571ed9=_0xc766[_0x1750bb];return _0x571ed9;};'use strict';var _=require(_0x6c76('0x0'));var util=require(_0x6c76('0x1'));var moment=require(_0x6c76('0x2'));var BPromise=require(_0x6c76('0x3'));var rs=require(_0x6c76('0x4'));var fs=require('fs');var Redis=require(_0x6c76('0x5'));var db=require(_0x6c76('0x6'))['db'];var utils=require(_0x6c76('0x7'));var logger=require(_0x6c76('0x8'))(_0x6c76('0x9'));var config=require('../../config/environment');var jayson=require(_0x6c76('0xa'));var client=jayson[_0x6c76('0xb')]['http']({'port':0x232a});config['redis']=_[_0x6c76('0xc')](config[_0x6c76('0xd')],{'host':_0x6c76('0xe'),'port':0x18eb});var socket=require(_0x6c76('0xf'))(new Redis(config['redis']));require(_0x6c76('0x10'))[_0x6c76('0x11')](socket);function respondWithRpcPromise(_0x1e04bc,_0x4992d9,_0x3a6d77){return new BPromise(function(_0x2b52fd,_0x2d1b1e){return client[_0x6c76('0x12')](_0x1e04bc,_0x3a6d77)[_0x6c76('0x13')](function(_0x185fca){logger[_0x6c76('0x14')](_0x6c76('0x15'),_0x4992d9,_0x6c76('0x16'));logger['debug'](_0x6c76('0x17'),_0x4992d9,_0x6c76('0x16'),JSON['stringify'](_0x185fca));if(_0x185fca[_0x6c76('0x18')]){if(_0x185fca[_0x6c76('0x18')][_0x6c76('0x19')]===0x1f4){logger['error'](_0x6c76('0x15'),_0x4992d9,_0x185fca['error']['message']);return _0x2d1b1e(_0x185fca[_0x6c76('0x18')]['message']);}logger[_0x6c76('0x18')]('CmList,\x20%s,\x20%s',_0x4992d9,_0x185fca['error'][_0x6c76('0x1a')]);return _0x2b52fd(_0x185fca[_0x6c76('0x18')][_0x6c76('0x1a')]);}else{logger[_0x6c76('0x14')](_0x6c76('0x15'),_0x4992d9,_0x6c76('0x16'));_0x2b52fd(_0x185fca[_0x6c76('0x1b')][_0x6c76('0x1a')]);}})['catch'](function(_0x4f8739){logger[_0x6c76('0x18')](_0x6c76('0x15'),_0x4992d9,_0x4f8739);_0x2d1b1e(_0x4f8739);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index c64d8f1..303a91b 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 _0x0960=['update','emit','removeListener','register','cmList:','./cmList.events','save'];(function(_0x6ace36,_0x2baad7){var _0x170e54=function(_0x5ba594){while(--_0x5ba594){_0x6ace36['push'](_0x6ace36['shift']());}};_0x170e54(++_0x2baad7);}(_0x0960,0xc2));var _0x0096=function(_0x2914c4,_0x3ff3e3){_0x2914c4=_0x2914c4-0x0;var _0x72ed2e=_0x0960[_0x2914c4];return _0x72ed2e;};'use strict';var CmListEvents=require(_0x0096('0x0'));var events=[_0x0096('0x1'),'remove',_0x0096('0x2')];function createListener(_0x1078f3,_0x41a86e){return function(_0x136f7a){_0x41a86e[_0x0096('0x3')](_0x1078f3,_0x136f7a);};}function removeListener(_0xd0d4c6,_0x3ee9fb){return function(){CmListEvents[_0x0096('0x4')](_0xd0d4c6,_0x3ee9fb);};}exports[_0x0096('0x5')]=function(_0x6ea572){for(var _0x59b3cc=0x0,_0x81cc41=events['length'];_0x59b3cc<_0x81cc41;_0x59b3cc++){var _0x1d35f1=events[_0x59b3cc];var _0x44e168=createListener(_0x0096('0x6')+_0x1d35f1,_0x6ea572);CmListEvents['on'](_0x1d35f1,_0x44e168);}}; \ No newline at end of file +var _0xd9c8=['./cmList.events','save','update','emit','length','cmList:'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd9c8[_0x2c91e9];return _0x13f0ff;};'use strict';var CmListEvents=require(_0x8d9c('0x0'));var events=[_0x8d9c('0x1'),'remove',_0x8d9c('0x2')];function createListener(_0x240e64,_0x2140c9){return function(_0xaecd58){_0x2140c9[_0x8d9c('0x3')](_0x240e64,_0xaecd58);};}function removeListener(_0x376ce5,_0xa7b017){return function(){CmListEvents['removeListener'](_0x376ce5,_0xa7b017);};}exports['register']=function(_0x53567f){for(var _0x2c083c=0x0,_0x1ebb5a=events[_0x8d9c('0x4')];_0x2c083c<_0x1ebb5a;_0x2c083c++){var _0x49c96f=events[_0x2c083c];var _0x3790f6=createListener(_0x8d9c('0x5')+_0x49c96f,_0x53567f);CmListEvents['on'](_0x49c96f,_0x3790f6);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index a7bf8bc..d1064e9 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 cd0e34b..58b946e 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(_0x5ea4cb,_0x44bce8){var _0xea2224=function(_0x1f1e99){while(--_0x1f1e99){_0x5ea4cb['push'](_0x5ea4cb['shift']());}};_0xea2224(++_0x44bce8);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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(_0x495fd3,_0x3408dc){var _0x54825d=function(_0x2bc4a6){while(--_0x2bc4a6){_0x495fd3['push'](_0x495fd3['shift']());}};_0x54825d(++_0x3408dc);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 956291f..efd0ee2 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 _0x1dfa=['sox','to-csv','ejs','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','body','Condition','params','catch','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x511cd1,_0x29148e){var _0x44a79a=function(_0x5dbe1d){while(--_0x5dbe1d){_0x511cd1['push'](_0x511cd1['shift']());}};_0x44a79a(++_0x29148e);}(_0x1dfa,0xba));var _0xa1df=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x1dfa[_0x187ee1];return _0x388160;};'use strict';var pdf=require(_0xa1df('0x0'));var emlformat=require(_0xa1df('0x1'));var rimraf=require(_0xa1df('0x2'));var zipdir=require(_0xa1df('0x3'));var jsonpatch=require(_0xa1df('0x4'));var rp=require(_0xa1df('0x5'));var moment=require(_0xa1df('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa1df('0x7'));var util=require(_0xa1df('0x8'));var path=require(_0xa1df('0x9'));var sox=require(_0xa1df('0xa'));var csv=require(_0xa1df('0xb'));var ejs=require(_0xa1df('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa1df('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa1df('0xe'));var toCsv=require(_0xa1df('0xb'));var querystring=require('querystring');var Papa=require(_0xa1df('0xf'));var Redis=require('ioredis');var authService=require(_0xa1df('0x10'));var qs=require(_0xa1df('0x11'));var as=require(_0xa1df('0x12'));var hardwareService=require(_0xa1df('0x13'));var logger=require(_0xa1df('0x14'))(_0xa1df('0x15'));var utils=require(_0xa1df('0x16'));var config=require(_0xa1df('0x17'));var licenseUtil=require(_0xa1df('0x18'));var db=require(_0xa1df('0x19'))['db'];function respondWithStatusCode(_0x55a544,_0x1cfa33){_0x1cfa33=_0x1cfa33||0xcc;return function(_0x3b059d){if(_0x3b059d){return _0x55a544[_0xa1df('0x1a')](_0x1cfa33);}return _0x55a544['status'](_0x1cfa33)[_0xa1df('0x1b')]();};}function respondWithResult(_0x27fbe3,_0x22b666){_0x22b666=_0x22b666||0xc8;return function(_0x617f26){if(_0x617f26){return _0x27fbe3[_0xa1df('0x1c')](_0x22b666)[_0xa1df('0x1d')](_0x617f26);}};}function respondWithFilteredResult(_0xee8aab,_0x4901bc){return function(_0x5a9e64){if(_0x5a9e64){var _0x40836c=_0x5a9e64[_0xa1df('0x1e')],_0x217eac=_0x4901bc[_0xa1df('0x1f')],_0x598273=_0x4901bc[_0xa1df('0x1f')]+_0x4901bc['limit'],_0x744e15;if(_0x598273>=_0x40836c){_0x598273=_0x40836c;_0x744e15=0xc8;}else{_0x744e15=0xce;}_0xee8aab[_0xa1df('0x1c')](_0x744e15);return _0xee8aab[_0xa1df('0x20')](_0xa1df('0x21'),_0x217eac+'-'+_0x598273+'/'+_0x40836c)[_0xa1df('0x1d')](_0x5a9e64);}return null;};}function patchUpdates(_0xf26bb6){return function(_0x20a266){try{jsonpatch[_0xa1df('0x22')](_0x20a266,_0xf26bb6,!![]);}catch(_0x148104){return BPromise[_0xa1df('0x23')](_0x148104);}return _0x20a266[_0xa1df('0x24')]();};}function saveUpdates(_0x3377cb,_0x12ccec){return function(_0x4f6292){if(_0x4f6292){return _0x4f6292[_0xa1df('0x25')](_0x3377cb)['then'](function(_0x380ceb){return _0x380ceb;});}return null;};}function removeEntity(_0x29083d,_0xd8d435){return function(_0x3906b6){if(_0x3906b6){return _0x3906b6[_0xa1df('0x26')]()[_0xa1df('0x27')](function(){_0x29083d['status'](0xcc)[_0xa1df('0x1b')]();});}};}function handleEntityNotFound(_0x1f2049,_0x4a4c4b){return function(_0x3cd8bd){if(!_0x3cd8bd){_0x1f2049['sendStatus'](0x194);}return _0x3cd8bd;};}function handleError(_0x3f7594,_0x325727){_0x325727=_0x325727||0x1f4;return function(_0x57d407){logger[_0xa1df('0x28')](_0x57d407[_0xa1df('0x29')]);if(_0x57d407[_0xa1df('0x2a')]){delete _0x57d407[_0xa1df('0x2a')];}_0x3f7594['status'](_0x325727)[_0xa1df('0x2b')](_0x57d407);};}exports['update']=function(_0x42eddd,_0x5e730e){if(_0x42eddd[_0xa1df('0x2c')]['id']){delete _0x42eddd['body']['id'];}return db[_0xa1df('0x2d')]['find']({'where':{'id':_0x42eddd[_0xa1df('0x2e')]['id']}})['then'](handleEntityNotFound(_0x5e730e,null))[_0xa1df('0x27')](saveUpdates(_0x42eddd[_0xa1df('0x2c')],null))[_0xa1df('0x27')](respondWithResult(_0x5e730e,null))[_0xa1df('0x2f')](handleError(_0x5e730e,null));};exports[_0xa1df('0x26')]=function(_0xd3e1cb,_0x4ecb01){return db[_0xa1df('0x2d')][_0xa1df('0x30')]({'where':{'id':_0xd3e1cb[_0xa1df('0x2e')]['id']}})[_0xa1df('0x27')](handleEntityNotFound(_0x4ecb01,null))['then'](removeEntity(_0x4ecb01,null))[_0xa1df('0x2f')](handleError(_0x4ecb01,null));}; \ No newline at end of file +var _0xea6b=['sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','status','count','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','update','body','params','catch','Condition','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x3f4f85,_0x4333eb){var _0x2f190d=function(_0x1bb264){while(--_0x1bb264){_0x3f4f85['push'](_0x3f4f85['shift']());}};_0x2f190d(++_0x4333eb);}(_0xea6b,0x159));var _0xbea6=function(_0x3d6149,_0x211668){_0x3d6149=_0x3d6149-0x0;var _0x72e034=_0xea6b[_0x3d6149];return _0x72e034;};'use strict';var pdf=require(_0xbea6('0x0'));var emlformat=require(_0xbea6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbea6('0x2'));var jsonpatch=require(_0xbea6('0x3'));var rp=require('request-promise');var moment=require(_0xbea6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbea6('0x5'));var util=require(_0xbea6('0x6'));var path=require('path');var sox=require(_0xbea6('0x7'));var csv=require(_0xbea6('0x8'));var ejs=require(_0xbea6('0x9'));var fs=require('fs');var _=require(_0xbea6('0xa'));var squel=require('squel');var crypto=require(_0xbea6('0xb'));var jsforce=require(_0xbea6('0xc'));var deskjs=require(_0xbea6('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbea6('0xe'));var Papa=require(_0xbea6('0xf'));var Redis=require(_0xbea6('0x10'));var authService=require(_0xbea6('0x11'));var qs=require(_0xbea6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbea6('0x13'));var logger=require(_0xbea6('0x14'))('api');var utils=require(_0xbea6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbea6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29af93,_0x3694dd){_0x3694dd=_0x3694dd||0xcc;return function(_0x181d61){if(_0x181d61){return _0x29af93[_0xbea6('0x17')](_0x3694dd);}return _0x29af93['status'](_0x3694dd)[_0xbea6('0x18')]();};}function respondWithResult(_0x49bfe3,_0xa9a6c7){_0xa9a6c7=_0xa9a6c7||0xc8;return function(_0x259bf2){if(_0x259bf2){return _0x49bfe3[_0xbea6('0x19')](_0xa9a6c7)['json'](_0x259bf2);}};}function respondWithFilteredResult(_0x5dc4ab,_0x268593){return function(_0x4909ff){if(_0x4909ff){var _0xa69c1=_0x4909ff[_0xbea6('0x1a')],_0x294fdd=_0x268593[_0xbea6('0x1b')],_0x23ed6c=_0x268593[_0xbea6('0x1b')]+_0x268593[_0xbea6('0x1c')],_0x2761b6;if(_0x23ed6c>=_0xa69c1){_0x23ed6c=_0xa69c1;_0x2761b6=0xc8;}else{_0x2761b6=0xce;}_0x5dc4ab[_0xbea6('0x19')](_0x2761b6);return _0x5dc4ab[_0xbea6('0x1d')]('Content-Range',_0x294fdd+'-'+_0x23ed6c+'/'+_0xa69c1)[_0xbea6('0x1e')](_0x4909ff);}return null;};}function patchUpdates(_0x42bde6){return function(_0x31f781){try{jsonpatch[_0xbea6('0x1f')](_0x31f781,_0x42bde6,!![]);}catch(_0x55da00){return BPromise[_0xbea6('0x20')](_0x55da00);}return _0x31f781[_0xbea6('0x21')]();};}function saveUpdates(_0x3b4827,_0x309e6e){return function(_0x487831){if(_0x487831){return _0x487831['update'](_0x3b4827)[_0xbea6('0x22')](function(_0x409281){return _0x409281;});}return null;};}function removeEntity(_0x123c7c,_0x4bb907){return function(_0x6c4e54){if(_0x6c4e54){return _0x6c4e54[_0xbea6('0x23')]()['then'](function(){_0x123c7c[_0xbea6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47f57f,_0x43db40){return function(_0x2c4dc3){if(!_0x2c4dc3){_0x47f57f[_0xbea6('0x17')](0x194);}return _0x2c4dc3;};}function handleError(_0x1e9983,_0x53ff21){_0x53ff21=_0x53ff21||0x1f4;return function(_0x2a4fbc){logger[_0xbea6('0x24')](_0x2a4fbc[_0xbea6('0x25')]);if(_0x2a4fbc[_0xbea6('0x26')]){delete _0x2a4fbc[_0xbea6('0x26')];}_0x1e9983[_0xbea6('0x19')](_0x53ff21)['send'](_0x2a4fbc);};}exports[_0xbea6('0x27')]=function(_0x66cde1,_0x337148){if(_0x66cde1['body']['id']){delete _0x66cde1[_0xbea6('0x28')]['id'];}return db['Condition']['find']({'where':{'id':_0x66cde1[_0xbea6('0x29')]['id']}})[_0xbea6('0x22')](handleEntityNotFound(_0x337148,null))[_0xbea6('0x22')](saveUpdates(_0x66cde1[_0xbea6('0x28')],null))[_0xbea6('0x22')](respondWithResult(_0x337148,null))[_0xbea6('0x2a')](handleError(_0x337148,null));};exports[_0xbea6('0x23')]=function(_0x432eff,_0xa6f904){return db[_0xbea6('0x2b')]['find']({'where':{'id':_0x432eff[_0xbea6('0x29')]['id']}})[_0xbea6('0x22')](handleEntityNotFound(_0xa6f904,null))[_0xbea6('0x22')](removeEntity(_0xa6f904,null))[_0xbea6('0x2a')](handleError(_0xa6f904,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index f535593..1af07e0 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 _0x99b0=['exports','define','Condition','tools_conditions','../../config/logger','api','moment','bluebird','request-promise','path','./condition.attributes'];(function(_0x55bae0,_0x2140ec){var _0x2ef9e6=function(_0x1a1b51){while(--_0x1a1b51){_0x55bae0['push'](_0x55bae0['shift']());}};_0x2ef9e6(++_0x2140ec);}(_0x99b0,0x101));var _0x099b=function(_0x4faee0,_0x1301c8){_0x4faee0=_0x4faee0-0x0;var _0x297989=_0x99b0[_0x4faee0];return _0x297989;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x099b('0x0'))(_0x099b('0x1'));var moment=require(_0x099b('0x2'));var BPromise=require(_0x099b('0x3'));var rp=require(_0x099b('0x4'));var fs=require('fs');var path=require(_0x099b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x099b('0x6'));module[_0x099b('0x7')]=function(_0x16aed1,_0x2d878c){return _0x16aed1[_0x099b('0x8')](_0x099b('0x9'),attributes,{'tableName':_0x099b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb5e=['define','Condition','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x28cb58,_0x228f7a){var _0x1263fc=function(_0x25fb38){while(--_0x25fb38){_0x28cb58['push'](_0x28cb58['shift']());}};_0x1263fc(++_0x228f7a);}(_0xbb5e,0x18e));var _0xebb5=function(_0x5be6ff,_0x7867f7){_0x5be6ff=_0x5be6ff-0x0;var _0x87e82a=_0xbb5e[_0x5be6ff];return _0x87e82a;};'use strict';var _=require(_0xebb5('0x0'));var util=require(_0xebb5('0x1'));var logger=require(_0xebb5('0x2'))(_0xebb5('0x3'));var moment=require('moment');var BPromise=require(_0xebb5('0x4'));var rp=require(_0xebb5('0x5'));var fs=require('fs');var path=require(_0xebb5('0x6'));var rimraf=require(_0xebb5('0x7'));var config=require(_0xebb5('0x8'));var attributes=require('./condition.attributes');module[_0xebb5('0x9')]=function(_0x201980,_0x2837e6){return _0x201980[_0xebb5('0xa')](_0xebb5('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 6eb6fd6..dd161d3 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 _0x9e1d=['Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x208ffe,_0x1e391e){var _0x5e3d8d=function(_0x3c0e69){while(--_0x3c0e69){_0x208ffe['push'](_0x208ffe['shift']());}};_0x5e3d8d(++_0x1e391e);}(_0x9e1d,0x1d1));var _0xd9e1=function(_0x28a9e6,_0x9ef07d){_0x28a9e6=_0x28a9e6-0x0;var _0x58f9e2=_0x9e1d[_0x28a9e6];return _0x58f9e2;};'use strict';var _=require('lodash');var util=require(_0xd9e1('0x0'));var moment=require(_0xd9e1('0x1'));var BPromise=require('bluebird');var rs=require(_0xd9e1('0x2'));var fs=require('fs');var Redis=require(_0xd9e1('0x3'));var db=require(_0xd9e1('0x4'))['db'];var utils=require(_0xd9e1('0x5'));var logger=require(_0xd9e1('0x6'))('rpc');var config=require(_0xd9e1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd9e1('0x8')][_0xd9e1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20fea4,_0xe5ca14,_0x411e9f){return new BPromise(function(_0x372072,_0x4d344c){return client['request'](_0x20fea4,_0x411e9f)[_0xd9e1('0xa')](function(_0x5c3000){logger[_0xd9e1('0xb')](_0xd9e1('0xc'),_0xe5ca14,_0xd9e1('0xd'));logger[_0xd9e1('0xe')](_0xd9e1('0xf'),_0xe5ca14,_0xd9e1('0xd'),JSON['stringify'](_0x5c3000));if(_0x5c3000[_0xd9e1('0x10')]){if(_0x5c3000[_0xd9e1('0x10')][_0xd9e1('0x11')]===0x1f4){logger[_0xd9e1('0x10')](_0xd9e1('0xc'),_0xe5ca14,_0x5c3000[_0xd9e1('0x10')]['message']);return _0x4d344c(_0x5c3000[_0xd9e1('0x10')][_0xd9e1('0x12')]);}logger[_0xd9e1('0x10')]('Condition,\x20%s,\x20%s',_0xe5ca14,_0x5c3000[_0xd9e1('0x10')]['message']);return _0x372072(_0x5c3000[_0xd9e1('0x10')][_0xd9e1('0x12')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0xe5ca14,_0xd9e1('0xd'));_0x372072(_0x5c3000[_0xd9e1('0x13')][_0xd9e1('0x12')]);}})['catch'](function(_0x43345c){logger[_0xd9e1('0x10')](_0xd9e1('0xc'),_0xe5ca14,_0x43345c);_0x4d344c(_0x43345c);});});} \ No newline at end of file +var _0x7080=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1a4f58,_0x53c8c6){var _0x408f2c=function(_0x3b428){while(--_0x3b428){_0x1a4f58['push'](_0x1a4f58['shift']());}};_0x408f2c(++_0x53c8c6);}(_0x7080,0xa3));var _0x0708=function(_0x119e6d,_0xe3377d){_0x119e6d=_0x119e6d-0x0;var _0x56b2d5=_0x7080[_0x119e6d];return _0x56b2d5;};'use strict';var _=require('lodash');var util=require(_0x0708('0x0'));var moment=require(_0x0708('0x1'));var BPromise=require(_0x0708('0x2'));var rs=require(_0x0708('0x3'));var fs=require('fs');var Redis=require(_0x0708('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0708('0x5'));var logger=require(_0x0708('0x6'))('rpc');var config=require(_0x0708('0x7'));var jayson=require(_0x0708('0x8'));var client=jayson[_0x0708('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f768e,_0x5a0759,_0x46550a){return new BPromise(function(_0x17d0b1,_0x15bb41){return client['request'](_0x4f768e,_0x46550a)['then'](function(_0x115ad2){logger[_0x0708('0xa')](_0x0708('0xb'),_0x5a0759,_0x0708('0xc'));logger[_0x0708('0xd')](_0x0708('0xe'),_0x5a0759,_0x0708('0xc'),JSON['stringify'](_0x115ad2));if(_0x115ad2[_0x0708('0xf')]){if(_0x115ad2[_0x0708('0xf')][_0x0708('0x10')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x5a0759,_0x115ad2[_0x0708('0xf')][_0x0708('0x11')]);return _0x15bb41(_0x115ad2['error']['message']);}logger[_0x0708('0xf')]('Condition,\x20%s,\x20%s',_0x5a0759,_0x115ad2[_0x0708('0xf')][_0x0708('0x11')]);return _0x17d0b1(_0x115ad2[_0x0708('0xf')][_0x0708('0x11')]);}else{logger[_0x0708('0xa')](_0x0708('0xb'),_0x5a0759,_0x0708('0xc'));_0x17d0b1(_0x115ad2[_0x0708('0x12')][_0x0708('0x11')]);}})[_0x0708('0x13')](function(_0x48273c){logger[_0x0708('0xf')]('Condition,\x20%s,\x20%s',_0x5a0759,_0x48273c);_0x15bb41(_0x48273c);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index d32e953..c89368a 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 _0x82ab=['util','path','express','Router','../../components/interaction/service','../../config/environment','./condition.controller','/:id','delete','isAuthenticated','destroy','exports'];(function(_0x102261,_0x35e5ef){var _0x12c351=function(_0x481253){while(--_0x481253){_0x102261['push'](_0x102261['shift']());}};_0x12c351(++_0x35e5ef);}(_0x82ab,0x84));var _0xb82a=function(_0x588783,_0x550af0){_0x588783=_0x588783-0x0;var _0x146ed6=_0x82ab[_0x588783];return _0x146ed6;};'use strict';var multer=require('multer');var util=require(_0xb82a('0x0'));var path=require(_0xb82a('0x1'));var timeout=require('connect-timeout');var express=require(_0xb82a('0x2'));var router=express[_0xb82a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb82a('0x4'));var config=require(_0xb82a('0x5'));var controller=require(_0xb82a('0x6'));router['put'](_0xb82a('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xb82a('0x8')](_0xb82a('0x7'),auth[_0xb82a('0x9')](),controller[_0xb82a('0xa')]);module[_0xb82a('0xb')]=router; \ No newline at end of file +var _0x862d=['/:id','isAuthenticated','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../config/environment','./condition.controller','put'];(function(_0x4cfd78,_0x52355e){var _0xf4a95a=function(_0x5c2d5b){while(--_0x5c2d5b){_0x4cfd78['push'](_0x4cfd78['shift']());}};_0xf4a95a(++_0x52355e);}(_0x862d,0xbc));var _0xd862=function(_0x325501,_0x26ba7a){_0x325501=_0x325501-0x0;var _0x382566=_0x862d[_0x325501];return _0x382566;};'use strict';var multer=require(_0xd862('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd862('0x1'));var express=require(_0xd862('0x2'));var router=express[_0xd862('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd862('0x4'));var controller=require(_0xd862('0x5'));router[_0xd862('0x6')](_0xd862('0x7'),auth[_0xd862('0x8')](),controller[_0xd862('0x9')]);router[_0xd862('0xa')]('/:id',auth[_0xd862('0x8')](),controller[_0xd862('0xb')]);module[_0xd862('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 0a8d1ba..8ebd009 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 _0x949d=['STRING','name','sequelize','exports'];(function(_0x5e86cb,_0x388c1b){var _0x41e845=function(_0x1c3a26){while(--_0x1c3a26){_0x5e86cb['push'](_0x5e86cb['shift']());}};_0x41e845(++_0x388c1b);}(_0x949d,0x162));var _0xd949=function(_0x342322,_0x139b36){_0x342322=_0x342322-0x0;var _0x3cee3b=_0x949d[_0x342322];return _0x3cee3b;};'use strict';var Sequelize=require(_0xd949('0x0'));module[_0xd949('0x1')]={'name':{'type':Sequelize[_0xd949('0x2')],'allowNull':![],'unique':_0xd949('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x1280=['INTEGER','sequelize','exports','STRING','name'];(function(_0x448b31,_0x3680f8){var _0x49798b=function(_0x1a46ef){while(--_0x1a46ef){_0x448b31['push'](_0x448b31['shift']());}};_0x49798b(++_0x3680f8);}(_0x1280,0xba));var _0x0128=function(_0x219fa0,_0x18b239){_0x219fa0=_0x219fa0-0x0;var _0xc603fb=_0x1280[_0x219fa0];return _0xc603fb;};'use strict';var Sequelize=require(_0x0128('0x0'));module[_0x0128('0x1')]={'name':{'type':Sequelize[_0x0128('0x2')],'allowNull':![],'unique':_0x0128('0x3')},'OrderBy':{'type':Sequelize[_0x0128('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0128('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 38e3992..ae08551 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 _0x3714=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','send','map','ContactItemType','rawAttributes','fieldName','type','model','name','query','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x3714,0x95));var _0x4371=function(_0x514bc7,_0xcf329e){_0x514bc7=_0x514bc7-0x0;var _0x1c5236=_0x3714[_0x514bc7];return _0x1c5236;};'use strict';var pdf=require(_0x4371('0x0'));var emlformat=require(_0x4371('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4371('0x2'));var jsonpatch=require(_0x4371('0x3'));var rp=require(_0x4371('0x4'));var moment=require('moment');var BPromise=require(_0x4371('0x5'));var Mustache=require(_0x4371('0x6'));var util=require(_0x4371('0x7'));var path=require('path');var sox=require(_0x4371('0x8'));var csv=require('to-csv');var ejs=require(_0x4371('0x9'));var fs=require('fs');var _=require(_0x4371('0xa'));var squel=require('squel');var crypto=require(_0x4371('0xb'));var jsforce=require(_0x4371('0xc'));var deskjs=require(_0x4371('0xd'));var toCsv=require(_0x4371('0xe'));var querystring=require('querystring');var Papa=require(_0x4371('0xf'));var Redis=require('ioredis');var authService=require(_0x4371('0x10'));var qs=require(_0x4371('0x11'));var as=require(_0x4371('0x12'));var hardwareService=require(_0x4371('0x13'));var logger=require('../../config/logger')(_0x4371('0x14'));var utils=require(_0x4371('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4371('0x16'));var db=require(_0x4371('0x17'))['db'];function respondWithStatusCode(_0x1d5806,_0x293b9c){_0x293b9c=_0x293b9c||0xcc;return function(_0x55972){if(_0x55972){return _0x1d5806[_0x4371('0x18')](_0x293b9c);}return _0x1d5806[_0x4371('0x19')](_0x293b9c)[_0x4371('0x1a')]();};}function respondWithResult(_0x3decc7,_0x1d19ea){_0x1d19ea=_0x1d19ea||0xc8;return function(_0xf2c4e0){if(_0xf2c4e0){return _0x3decc7['status'](_0x1d19ea)[_0x4371('0x1b')](_0xf2c4e0);}};}function respondWithFilteredResult(_0x112f26,_0x41447c){return function(_0x482082){if(_0x482082){var _0x1adca6=_0x482082[_0x4371('0x1c')],_0xe404d9=_0x41447c[_0x4371('0x1d')],_0x27f864=_0x41447c[_0x4371('0x1d')]+_0x41447c[_0x4371('0x1e')],_0xa229c4;if(_0x27f864>=_0x1adca6){_0x27f864=_0x1adca6;_0xa229c4=0xc8;}else{_0xa229c4=0xce;}_0x112f26[_0x4371('0x19')](_0xa229c4);return _0x112f26[_0x4371('0x1f')](_0x4371('0x20'),_0xe404d9+'-'+_0x27f864+'/'+_0x1adca6)[_0x4371('0x1b')](_0x482082);}return null;};}function patchUpdates(_0x322fa5){return function(_0x5c7c42){try{jsonpatch[_0x4371('0x21')](_0x5c7c42,_0x322fa5,!![]);}catch(_0x2f3ba7){return BPromise[_0x4371('0x22')](_0x2f3ba7);}return _0x5c7c42[_0x4371('0x23')]();};}function saveUpdates(_0x2ad3cf,_0x4c40fe){return function(_0x592700){if(_0x592700){return _0x592700['update'](_0x2ad3cf)[_0x4371('0x24')](function(_0x5bdfbc){return _0x5bdfbc;});}return null;};}function removeEntity(_0x9d8623,_0x17dde7){return function(_0x3b89a8){if(_0x3b89a8){return _0x3b89a8[_0x4371('0x25')]()[_0x4371('0x24')](function(){var _0x344a3d=_0x3b89a8[_0x4371('0x26')]({'plain':!![]});var _0x345d87=_0x4371('0x27');return db[_0x4371('0x28')][_0x4371('0x25')]({'where':{'type':_0x345d87,'resourceId':_0x344a3d['id']}})[_0x4371('0x24')](function(){return _0x3b89a8;});})[_0x4371('0x24')](function(){_0x9d8623[_0x4371('0x19')](0xcc)[_0x4371('0x1a')]();});}};}function handleEntityNotFound(_0x4f40a0,_0x1c6dca){return function(_0x54647d){if(!_0x54647d){_0x4f40a0[_0x4371('0x18')](0x194);}return _0x54647d;};}function handleError(_0x2ab6c8,_0x3e9586){_0x3e9586=_0x3e9586||0x1f4;return function(_0x179045){logger[_0x4371('0x29')](_0x179045[_0x4371('0x2a')]);if(_0x179045['name']){delete _0x179045['name'];}_0x2ab6c8[_0x4371('0x19')](_0x3e9586)[_0x4371('0x2b')](_0x179045);};}exports['index']=function(_0x108945,_0x3fad2c){var _0x2e7cd7={},_0x3acddd={},_0x2c22e4={'count':0x0,'rows':[]};var _0x3ab621=_[_0x4371('0x2c')](db[_0x4371('0x2d')][_0x4371('0x2e')],function(_0x1e2563){return{'name':_0x1e2563[_0x4371('0x2f')],'type':_0x1e2563[_0x4371('0x30')]['key']};});_0x3acddd[_0x4371('0x31')]=_[_0x4371('0x2c')](_0x3ab621,_0x4371('0x32'));_0x3acddd['query']=_['keys'](_0x108945[_0x4371('0x33')]);_0x3acddd['filters']=_[_0x4371('0x34')](_0x3acddd[_0x4371('0x31')],_0x3acddd[_0x4371('0x33')]);_0x2e7cd7[_0x4371('0x35')]=_[_0x4371('0x34')](_0x3acddd[_0x4371('0x31')],qs[_0x4371('0x36')](_0x108945[_0x4371('0x33')]['fields']));_0x2e7cd7[_0x4371('0x35')]=_0x2e7cd7[_0x4371('0x35')][_0x4371('0x37')]?_0x2e7cd7[_0x4371('0x35')]:_0x3acddd['model'];if(!_0x108945[_0x4371('0x33')]['hasOwnProperty'](_0x4371('0x38'))){_0x2e7cd7[_0x4371('0x1e')]=qs[_0x4371('0x1e')](_0x108945['query'][_0x4371('0x1e')]);_0x2e7cd7['offset']=qs['offset'](_0x108945['query'][_0x4371('0x1d')]);}_0x2e7cd7[_0x4371('0x39')]=qs['sort'](_0x108945[_0x4371('0x33')][_0x4371('0x3a')]);_0x2e7cd7['where']=qs[_0x4371('0x3b')](_['pick'](_0x108945[_0x4371('0x33')],_0x3acddd[_0x4371('0x3b')]),_0x3ab621);if(_0x108945['query'][_0x4371('0x3c')]){_0x2e7cd7[_0x4371('0x3d')]=_[_0x4371('0x3e')](_0x2e7cd7[_0x4371('0x3d')],{'$or':_[_0x4371('0x2c')](_0x3ab621,function(_0x1ce699){if(_0x1ce699['type']!==_0x4371('0x3f')){var _0x2521dd={};_0x2521dd[_0x1ce699[_0x4371('0x32')]]={'$like':'%'+_0x108945[_0x4371('0x33')][_0x4371('0x3c')]+'%'};return _0x2521dd;}})});}_0x2e7cd7=_[_0x4371('0x3e')]({},_0x2e7cd7,_0x108945['options']);var _0x4664e9={'where':_0x2e7cd7[_0x4371('0x3d')]};return db[_0x4371('0x2d')][_0x4371('0x1c')](_0x4664e9)[_0x4371('0x24')](function(_0x41f4f1){_0x2c22e4[_0x4371('0x1c')]=_0x41f4f1;if(_0x108945[_0x4371('0x33')][_0x4371('0x40')]){_0x2e7cd7[_0x4371('0x41')]=[{'all':!![]}];}return db[_0x4371('0x2d')][_0x4371('0x42')](_0x2e7cd7);})['then'](function(_0x2f9ca1){_0x2c22e4[_0x4371('0x43')]=_0x2f9ca1;return _0x2c22e4;})[_0x4371('0x24')](respondWithFilteredResult(_0x3fad2c,_0x2e7cd7))[_0x4371('0x44')](handleError(_0x3fad2c,null));};exports['show']=function(_0x3d80be,_0x176daf){var _0x629b81={'raw':!![],'where':{'id':_0x3d80be[_0x4371('0x45')]['id']}},_0x187b6f={};_0x187b6f[_0x4371('0x31')]=_[_0x4371('0x46')](db['ContactItemType'][_0x4371('0x2e')]);_0x187b6f[_0x4371('0x33')]=_[_0x4371('0x46')](_0x3d80be[_0x4371('0x33')]);_0x187b6f[_0x4371('0x3b')]=_['intersection'](_0x187b6f[_0x4371('0x31')],_0x187b6f[_0x4371('0x33')]);_0x629b81[_0x4371('0x35')]=_[_0x4371('0x34')](_0x187b6f[_0x4371('0x31')],qs[_0x4371('0x36')](_0x3d80be['query'][_0x4371('0x36')]));_0x629b81[_0x4371('0x35')]=_0x629b81['attributes'][_0x4371('0x37')]?_0x629b81[_0x4371('0x35')]:_0x187b6f[_0x4371('0x31')];if(_0x3d80be[_0x4371('0x33')][_0x4371('0x40')]){_0x629b81['include']=[{'all':!![]}];}_0x629b81=_[_0x4371('0x3e')]({},_0x629b81,_0x3d80be[_0x4371('0x47')]);return db[_0x4371('0x2d')][_0x4371('0x48')](_0x629b81)[_0x4371('0x24')](handleEntityNotFound(_0x176daf,null))['then'](respondWithResult(_0x176daf,null))[_0x4371('0x44')](handleError(_0x176daf,null));};exports[_0x4371('0x49')]=function(_0x489490,_0x2aa000){return db[_0x4371('0x2d')]['create'](_0x489490[_0x4371('0x4a')],{})[_0x4371('0x24')](function(_0x4868e5){var _0x10f8eb=_0x489490[_0x4371('0x4b')][_0x4371('0x26')]({'plain':!![]});if(!_0x10f8eb)throw new Error(_0x4371('0x4c'));if(_0x10f8eb[_0x4371('0x4d')]==='user'){var _0x13d8d9=_0x4868e5['get']({'plain':!![]});var _0x1c52b6='ContactItemTypes';return db[_0x4371('0x4e')][_0x4371('0x48')]({'where':{'name':_0x1c52b6,'userProfileId':_0x10f8eb['userProfileId']},'raw':!![]})[_0x4371('0x24')](function(_0x3d9b7c){if(_0x3d9b7c&&_0x3d9b7c[_0x4371('0x4f')]===0x0){return db[_0x4371('0x28')][_0x4371('0x49')]({'name':_0x13d8d9[_0x4371('0x32')],'resourceId':_0x13d8d9['id'],'type':_0x3d9b7c['name'],'sectionId':_0x3d9b7c['id']},{})[_0x4371('0x24')](function(){return _0x4868e5;});}else{return _0x4868e5;}})['catch'](function(_0x89ad72){logger[_0x4371('0x29')](_0x4371('0x50'),_0x89ad72);throw _0x89ad72;});}return _0x4868e5;})['then'](respondWithResult(_0x2aa000,0xc9))['catch'](handleError(_0x2aa000,null));};exports[_0x4371('0x51')]=function(_0xa8f474,_0x575cc5){if(_0xa8f474[_0x4371('0x4a')]['id']){delete _0xa8f474[_0x4371('0x4a')]['id'];}return db[_0x4371('0x2d')][_0x4371('0x48')]({'where':{'id':_0xa8f474['params']['id']}})[_0x4371('0x24')](handleEntityNotFound(_0x575cc5,null))[_0x4371('0x24')](saveUpdates(_0xa8f474[_0x4371('0x4a')],null))[_0x4371('0x24')](respondWithResult(_0x575cc5,null))[_0x4371('0x44')](handleError(_0x575cc5,null));};exports[_0x4371('0x25')]=function(_0x5c2b93,_0x4827de){return db[_0x4371('0x2d')]['find']({'where':{'id':_0x5c2b93['params']['id']}})[_0x4371('0x24')](handleEntityNotFound(_0x4827de,null))[_0x4371('0x24')](removeEntity(_0x4827de,null))[_0x4371('0x44')](handleError(_0x4827de,null));}; \ No newline at end of file +var _0xdbfa=['reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','ContactItemType','include','findAll','rows','catch','show','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','zip-dir','request-promise','moment','mustache','util','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','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x343816,_0x1eb1b8){var _0x47af8f=function(_0x11db3c){while(--_0x11db3c){_0x343816['push'](_0x343816['shift']());}};_0x47af8f(++_0x1eb1b8);}(_0xdbfa,0x128));var _0xadbf=function(_0x2df209,_0x4046b8){_0x2df209=_0x2df209-0x0;var _0x17f204=_0xdbfa[_0x2df209];return _0x17f204;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xadbf('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xadbf('0x1'));var moment=require(_0xadbf('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xadbf('0x3'));var util=require(_0xadbf('0x4'));var path=require(_0xadbf('0x5'));var sox=require(_0xadbf('0x6'));var csv=require(_0xadbf('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xadbf('0x8'));var squel=require(_0xadbf('0x9'));var crypto=require(_0xadbf('0xa'));var jsforce=require(_0xadbf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xadbf('0x7'));var querystring=require(_0xadbf('0xc'));var Papa=require(_0xadbf('0xd'));var Redis=require('ioredis');var authService=require(_0xadbf('0xe'));var qs=require(_0xadbf('0xf'));var as=require(_0xadbf('0x10'));var hardwareService=require(_0xadbf('0x11'));var logger=require(_0xadbf('0x12'))(_0xadbf('0x13'));var utils=require(_0xadbf('0x14'));var config=require(_0xadbf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xadbf('0x16'))['db'];function respondWithStatusCode(_0x174f2e,_0x4855e5){_0x4855e5=_0x4855e5||0xcc;return function(_0x1bfce4){if(_0x1bfce4){return _0x174f2e[_0xadbf('0x17')](_0x4855e5);}return _0x174f2e['status'](_0x4855e5)['end']();};}function respondWithResult(_0x1ec136,_0x58fa1b){_0x58fa1b=_0x58fa1b||0xc8;return function(_0x2ff34c){if(_0x2ff34c){return _0x1ec136[_0xadbf('0x18')](_0x58fa1b)[_0xadbf('0x19')](_0x2ff34c);}};}function respondWithFilteredResult(_0x44b187,_0x109788){return function(_0x3c4899){if(_0x3c4899){var _0x1008e5=_0x3c4899[_0xadbf('0x1a')],_0x11b73f=_0x109788[_0xadbf('0x1b')],_0x21ee0f=_0x109788['offset']+_0x109788[_0xadbf('0x1c')],_0x59712;if(_0x21ee0f>=_0x1008e5){_0x21ee0f=_0x1008e5;_0x59712=0xc8;}else{_0x59712=0xce;}_0x44b187[_0xadbf('0x18')](_0x59712);return _0x44b187[_0xadbf('0x1d')](_0xadbf('0x1e'),_0x11b73f+'-'+_0x21ee0f+'/'+_0x1008e5)[_0xadbf('0x19')](_0x3c4899);}return null;};}function patchUpdates(_0x28ccf6){return function(_0x5dfbdf){try{jsonpatch[_0xadbf('0x1f')](_0x5dfbdf,_0x28ccf6,!![]);}catch(_0x2c7d20){return BPromise[_0xadbf('0x20')](_0x2c7d20);}return _0x5dfbdf[_0xadbf('0x21')]();};}function saveUpdates(_0x38a7e4,_0x12536e){return function(_0x1b0fd7){if(_0x1b0fd7){return _0x1b0fd7[_0xadbf('0x22')](_0x38a7e4)[_0xadbf('0x23')](function(_0x5d90f6){return _0x5d90f6;});}return null;};}function removeEntity(_0x349f1e,_0x252d51){return function(_0x1c871f){if(_0x1c871f){return _0x1c871f[_0xadbf('0x24')]()['then'](function(){var _0x333b57=_0x1c871f[_0xadbf('0x25')]({'plain':!![]});var _0x1d49c6=_0xadbf('0x26');return db[_0xadbf('0x27')]['destroy']({'where':{'type':_0x1d49c6,'resourceId':_0x333b57['id']}})['then'](function(){return _0x1c871f;});})['then'](function(){_0x349f1e[_0xadbf('0x18')](0xcc)[_0xadbf('0x28')]();});}};}function handleEntityNotFound(_0x9dbbd8,_0x428735){return function(_0x3c6946){if(!_0x3c6946){_0x9dbbd8[_0xadbf('0x17')](0x194);}return _0x3c6946;};}function handleError(_0x5a17e7,_0x29e09b){_0x29e09b=_0x29e09b||0x1f4;return function(_0x67e6e7){logger[_0xadbf('0x29')](_0x67e6e7['stack']);if(_0x67e6e7[_0xadbf('0x2a')]){delete _0x67e6e7[_0xadbf('0x2a')];}_0x5a17e7[_0xadbf('0x18')](_0x29e09b)[_0xadbf('0x2b')](_0x67e6e7);};}exports[_0xadbf('0x2c')]=function(_0x10a0bc,_0x35d8ba){var _0x56e624={},_0x4d1015={},_0x252780={'count':0x0,'rows':[]};var _0x2a51c0=_[_0xadbf('0x2d')](db['ContactItemType'][_0xadbf('0x2e')],function(_0x41fdb6){return{'name':_0x41fdb6[_0xadbf('0x2f')],'type':_0x41fdb6['type'][_0xadbf('0x30')]};});_0x4d1015[_0xadbf('0x31')]=_['map'](_0x2a51c0,_0xadbf('0x2a'));_0x4d1015[_0xadbf('0x32')]=_[_0xadbf('0x33')](_0x10a0bc[_0xadbf('0x32')]);_0x4d1015[_0xadbf('0x34')]=_[_0xadbf('0x35')](_0x4d1015[_0xadbf('0x31')],_0x4d1015[_0xadbf('0x32')]);_0x56e624[_0xadbf('0x36')]=_[_0xadbf('0x35')](_0x4d1015[_0xadbf('0x31')],qs[_0xadbf('0x37')](_0x10a0bc[_0xadbf('0x32')]['fields']));_0x56e624[_0xadbf('0x36')]=_0x56e624['attributes'][_0xadbf('0x38')]?_0x56e624[_0xadbf('0x36')]:_0x4d1015[_0xadbf('0x31')];if(!_0x10a0bc[_0xadbf('0x32')][_0xadbf('0x39')](_0xadbf('0x3a'))){_0x56e624[_0xadbf('0x1c')]=qs[_0xadbf('0x1c')](_0x10a0bc[_0xadbf('0x32')][_0xadbf('0x1c')]);_0x56e624[_0xadbf('0x1b')]=qs[_0xadbf('0x1b')](_0x10a0bc['query'][_0xadbf('0x1b')]);}_0x56e624[_0xadbf('0x3b')]=qs[_0xadbf('0x3c')](_0x10a0bc[_0xadbf('0x32')][_0xadbf('0x3c')]);_0x56e624['where']=qs[_0xadbf('0x34')](_[_0xadbf('0x3d')](_0x10a0bc[_0xadbf('0x32')],_0x4d1015[_0xadbf('0x34')]),_0x2a51c0);if(_0x10a0bc[_0xadbf('0x32')][_0xadbf('0x3e')]){_0x56e624[_0xadbf('0x3f')]=_[_0xadbf('0x40')](_0x56e624[_0xadbf('0x3f')],{'$or':_[_0xadbf('0x2d')](_0x2a51c0,function(_0x4c400b){if(_0x4c400b['type']!=='VIRTUAL'){var _0x4fc271={};_0x4fc271[_0x4c400b[_0xadbf('0x2a')]]={'$like':'%'+_0x10a0bc['query']['filter']+'%'};return _0x4fc271;}})});}_0x56e624=_['merge']({},_0x56e624,_0x10a0bc[_0xadbf('0x41')]);var _0x560719={'where':_0x56e624[_0xadbf('0x3f')]};return db[_0xadbf('0x42')][_0xadbf('0x1a')](_0x560719)['then'](function(_0x56a11d){_0x252780[_0xadbf('0x1a')]=_0x56a11d;if(_0x10a0bc['query']['includeAll']){_0x56e624[_0xadbf('0x43')]=[{'all':!![]}];}return db[_0xadbf('0x42')][_0xadbf('0x44')](_0x56e624);})[_0xadbf('0x23')](function(_0x7bda46){_0x252780[_0xadbf('0x45')]=_0x7bda46;return _0x252780;})[_0xadbf('0x23')](respondWithFilteredResult(_0x35d8ba,_0x56e624))[_0xadbf('0x46')](handleError(_0x35d8ba,null));};exports[_0xadbf('0x47')]=function(_0x3fec4d,_0x269bd3){var _0x3537a4={'raw':!![],'where':{'id':_0x3fec4d['params']['id']}},_0x1ee697={};_0x1ee697[_0xadbf('0x31')]=_[_0xadbf('0x33')](db[_0xadbf('0x42')][_0xadbf('0x2e')]);_0x1ee697[_0xadbf('0x32')]=_[_0xadbf('0x33')](_0x3fec4d[_0xadbf('0x32')]);_0x1ee697[_0xadbf('0x34')]=_[_0xadbf('0x35')](_0x1ee697[_0xadbf('0x31')],_0x1ee697[_0xadbf('0x32')]);_0x3537a4[_0xadbf('0x36')]=_['intersection'](_0x1ee697[_0xadbf('0x31')],qs[_0xadbf('0x37')](_0x3fec4d[_0xadbf('0x32')]['fields']));_0x3537a4[_0xadbf('0x36')]=_0x3537a4[_0xadbf('0x36')][_0xadbf('0x38')]?_0x3537a4[_0xadbf('0x36')]:_0x1ee697[_0xadbf('0x31')];if(_0x3fec4d[_0xadbf('0x32')]['includeAll']){_0x3537a4[_0xadbf('0x43')]=[{'all':!![]}];}_0x3537a4=_[_0xadbf('0x40')]({},_0x3537a4,_0x3fec4d[_0xadbf('0x41')]);return db[_0xadbf('0x42')][_0xadbf('0x48')](_0x3537a4)[_0xadbf('0x23')](handleEntityNotFound(_0x269bd3,null))[_0xadbf('0x23')](respondWithResult(_0x269bd3,null))['catch'](handleError(_0x269bd3,null));};exports[_0xadbf('0x49')]=function(_0x744063,_0x20c25a){return db[_0xadbf('0x42')]['create'](_0x744063['body'],{})[_0xadbf('0x23')](function(_0x449ce2){var _0x4270b1=_0x744063['user'][_0xadbf('0x25')]({'plain':!![]});if(!_0x4270b1)throw new Error(_0xadbf('0x4a'));if(_0x4270b1[_0xadbf('0x4b')]===_0xadbf('0x4c')){var _0x31b641=_0x449ce2[_0xadbf('0x25')]({'plain':!![]});var _0x3e49dd=_0xadbf('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x3e49dd,'userProfileId':_0x4270b1[_0xadbf('0x4d')]},'raw':!![]})[_0xadbf('0x23')](function(_0x346a71){if(_0x346a71&&_0x346a71[_0xadbf('0x4e')]===0x0){return db[_0xadbf('0x27')][_0xadbf('0x49')]({'name':_0x31b641['name'],'resourceId':_0x31b641['id'],'type':_0x346a71['name'],'sectionId':_0x346a71['id']},{})[_0xadbf('0x23')](function(){return _0x449ce2;});}else{return _0x449ce2;}})[_0xadbf('0x46')](function(_0x3a98fa){logger[_0xadbf('0x29')](_0xadbf('0x4f'),_0x3a98fa);throw _0x3a98fa;});}return _0x449ce2;})['then'](respondWithResult(_0x20c25a,0xc9))['catch'](handleError(_0x20c25a,null));};exports['update']=function(_0x52bf9b,_0x804665){if(_0x52bf9b['body']['id']){delete _0x52bf9b[_0xadbf('0x50')]['id'];}return db[_0xadbf('0x42')][_0xadbf('0x48')]({'where':{'id':_0x52bf9b[_0xadbf('0x51')]['id']}})[_0xadbf('0x23')](handleEntityNotFound(_0x804665,null))[_0xadbf('0x23')](saveUpdates(_0x52bf9b[_0xadbf('0x50')],null))['then'](respondWithResult(_0x804665,null))[_0xadbf('0x46')](handleError(_0x804665,null));};exports['destroy']=function(_0x4ffdaa,_0x424484){return db[_0xadbf('0x42')]['find']({'where':{'id':_0x4ffdaa[_0xadbf('0x51')]['id']}})['then'](handleEntityNotFound(_0x424484,null))[_0xadbf('0x23')](removeEntity(_0x424484,null))[_0xadbf('0x46')](handleError(_0x424484,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 3664aba..cbeef9b 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 _0x6f7b=['moment','bluebird','request-promise','path','../../config/environment','exports','define','tools_contact_item_types','util','../../config/logger','api'];(function(_0x8559d4,_0x4d4346){var _0x54c7d5=function(_0x439e2f){while(--_0x439e2f){_0x8559d4['push'](_0x8559d4['shift']());}};_0x54c7d5(++_0x4d4346);}(_0x6f7b,0x168));var _0xb6f7=function(_0x9d0c17,_0x26ec54){_0x9d0c17=_0x9d0c17-0x0;var _0x41b13c=_0x6f7b[_0x9d0c17];return _0x41b13c;};'use strict';var _=require('lodash');var util=require(_0xb6f7('0x0'));var logger=require(_0xb6f7('0x1'))(_0xb6f7('0x2'));var moment=require(_0xb6f7('0x3'));var BPromise=require(_0xb6f7('0x4'));var rp=require(_0xb6f7('0x5'));var fs=require('fs');var path=require(_0xb6f7('0x6'));var rimraf=require('rimraf');var config=require(_0xb6f7('0x7'));var attributes=require('./contactItemType.attributes');module[_0xb6f7('0x8')]=function(_0x25cec3,_0x59b2d9){return _0x25cec3[_0xb6f7('0x9')]('ContactItemType',attributes,{'tableName':_0xb6f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x029b=['define','tools_contact_item_types','lodash','util','api','moment','request-promise','path','./contactItemType.attributes','exports'];(function(_0x50a448,_0x3d1a4d){var _0x5da8c6=function(_0x3310a6){while(--_0x3310a6){_0x50a448['push'](_0x50a448['shift']());}};_0x5da8c6(++_0x3d1a4d);}(_0x029b,0x66));var _0xb029=function(_0x3656af,_0xee08e6){_0x3656af=_0x3656af-0x0;var _0x2b818c=_0x029b[_0x3656af];return _0x2b818c;};'use strict';var _=require(_0xb029('0x0'));var util=require(_0xb029('0x1'));var logger=require('../../config/logger')(_0xb029('0x2'));var moment=require(_0xb029('0x3'));var BPromise=require('bluebird');var rp=require(_0xb029('0x4'));var fs=require('fs');var path=require(_0xb029('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb029('0x6'));module[_0xb029('0x7')]=function(_0x7836f0,_0x448fc5){return _0x7836f0[_0xb029('0x8')]('ContactItemType',attributes,{'tableName':_0xb029('0x9'),'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 b87a712..624f14c 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 _0x180f=['result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5bff30,_0x2cf912){var _0x2b420e=function(_0x5e96a4){while(--_0x5e96a4){_0x5bff30['push'](_0x5bff30['shift']());}};_0x2b420e(++_0x2cf912);}(_0x180f,0xf3));var _0xf180=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0x180f[_0x121b1a];return _0x2d89a6;};'use strict';var _=require(_0xf180('0x0'));var util=require(_0xf180('0x1'));var moment=require('moment');var BPromise=require(_0xf180('0x2'));var rs=require(_0xf180('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf180('0x4'))['db'];var utils=require(_0xf180('0x5'));var logger=require(_0xf180('0x6'))(_0xf180('0x7'));var config=require(_0xf180('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf180('0x9')][_0xf180('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x513113,_0x47d87b,_0x1d6ca7){return new BPromise(function(_0x303412,_0x342a02){return client[_0xf180('0xb')](_0x513113,_0x1d6ca7)[_0xf180('0xc')](function(_0x4390be){logger[_0xf180('0xd')](_0xf180('0xe'),_0x47d87b,_0xf180('0xf'));logger['debug'](_0xf180('0x10'),_0x47d87b,_0xf180('0xf'),JSON[_0xf180('0x11')](_0x4390be));if(_0x4390be[_0xf180('0x12')]){if(_0x4390be[_0xf180('0x12')][_0xf180('0x13')]===0x1f4){logger[_0xf180('0x12')](_0xf180('0xe'),_0x47d87b,_0x4390be[_0xf180('0x12')][_0xf180('0x14')]);return _0x342a02(_0x4390be[_0xf180('0x12')]['message']);}logger[_0xf180('0x12')](_0xf180('0xe'),_0x47d87b,_0x4390be[_0xf180('0x12')][_0xf180('0x14')]);return _0x303412(_0x4390be['error'][_0xf180('0x14')]);}else{logger[_0xf180('0xd')](_0xf180('0xe'),_0x47d87b,'request\x20sent');_0x303412(_0x4390be[_0xf180('0x15')][_0xf180('0x14')]);}})['catch'](function(_0x115b86){logger[_0xf180('0x12')]('ContactItemType,\x20%s,\x20%s',_0x47d87b,_0x115b86);_0x342a02(_0x115b86);});});} \ No newline at end of file +var _0xb58b=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird'];(function(_0x41b197,_0x5a087d){var _0x1066c4=function(_0x3e1200){while(--_0x3e1200){_0x41b197['push'](_0x41b197['shift']());}};_0x1066c4(++_0x5a087d);}(_0xb58b,0x1f1));var _0xbb58=function(_0x309269,_0xf0edf8){_0x309269=_0x309269-0x0;var _0x133f1c=_0xb58b[_0x309269];return _0x133f1c;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('ContactItemType,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index b62eadd..6126e8b 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 _0xbac4=['put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','post','create'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xbac4,0x104));var _0x4bac=function(_0x1634bd,_0x287910){_0x1634bd=_0x1634bd-0x0;var _0x4b27bf=_0xbac4[_0x1634bd];return _0x4b27bf;};'use strict';var multer=require(_0x4bac('0x0'));var util=require('util');var path=require(_0x4bac('0x1'));var timeout=require(_0x4bac('0x2'));var express=require('express');var router=express[_0x4bac('0x3')]();var auth=require(_0x4bac('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4bac('0x5'));var controller=require(_0x4bac('0x6'));router[_0x4bac('0x7')]('/',auth[_0x4bac('0x8')](),controller['index']);router[_0x4bac('0x7')](_0x4bac('0x9'),auth[_0x4bac('0x8')](),controller['show']);router[_0x4bac('0xa')]('/',auth['isAuthenticated'](),controller[_0x4bac('0xb')]);router[_0x4bac('0xc')](_0x4bac('0x9'),auth[_0x4bac('0x8')](),controller[_0x4bac('0xd')]);router[_0x4bac('0xe')](_0x4bac('0x9'),auth[_0x4bac('0x8')](),controller[_0x4bac('0xf')]);module[_0x4bac('0x10')]=router; \ No newline at end of file +var _0x9ffc=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x1ca9b8,_0x1d05f7){var _0x4dbd8d=function(_0x222bc9){while(--_0x222bc9){_0x1ca9b8['push'](_0x1ca9b8['shift']());}};_0x4dbd8d(++_0x1d05f7);}(_0x9ffc,0x1de));var _0xc9ff=function(_0x4c825d,_0x10ec2b){_0x4c825d=_0x4c825d-0x0;var _0x43de87=_0x9ffc[_0x4c825d];return _0x43de87;};'use strict';var multer=require(_0xc9ff('0x0'));var util=require(_0xc9ff('0x1'));var path=require('path');var timeout=require(_0xc9ff('0x2'));var express=require(_0xc9ff('0x3'));var router=express[_0xc9ff('0x4')]();var auth=require(_0xc9ff('0x5'));var interaction=require(_0xc9ff('0x6'));var config=require(_0xc9ff('0x7'));var controller=require(_0xc9ff('0x8'));router['get']('/',auth[_0xc9ff('0x9')](),controller[_0xc9ff('0xa')]);router[_0xc9ff('0xb')](_0xc9ff('0xc'),auth[_0xc9ff('0x9')](),controller[_0xc9ff('0xd')]);router[_0xc9ff('0xe')]('/',auth['isAuthenticated'](),controller[_0xc9ff('0xf')]);router[_0xc9ff('0x10')](_0xc9ff('0xc'),auth[_0xc9ff('0x9')](),controller[_0xc9ff('0x11')]);router[_0xc9ff('0x12')](_0xc9ff('0xc'),auth[_0xc9ff('0x9')](),controller['destroy']);module[_0xc9ff('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 deb8480..29b2c8c 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 _0x66da=['exports','STRING','name','sequelize'];(function(_0x479ceb,_0x42f840){var _0x555976=function(_0x218d13){while(--_0x218d13){_0x479ceb['push'](_0x479ceb['shift']());}};_0x555976(++_0x42f840);}(_0x66da,0x16f));var _0xa66d=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x66da[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0xa66d('0x0'));module[_0xa66d('0x1')]={'name':{'type':Sequelize[_0xa66d('0x2')],'allowNull':![],'unique':_0xa66d('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf693=['name','exports','STRING'];(function(_0x3df4f,_0x58a3a5){var _0x5ed362=function(_0x4c1088){while(--_0x4c1088){_0x3df4f['push'](_0x3df4f['shift']());}};_0x5ed362(++_0x58a3a5);}(_0xf693,0x181));var _0x3f69=function(_0x1cda10,_0x34da16){_0x1cda10=_0x1cda10-0x0;var _0x22fe94=_0xf693[_0x1cda10];return _0x22fe94;};'use strict';var Sequelize=require('sequelize');module[_0x3f69('0x0')]={'name':{'type':Sequelize[_0x3f69('0x1')],'allowNull':![],'unique':_0x3f69('0x2')},'description':{'type':Sequelize[_0x3f69('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 0430d6c..e7d764c 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 _0x31c3=['VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','userProfileId','autoAssociation','UserProfileResource','clone','omit','updatedAt','createdAt','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/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','register','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','end','sendStatus','error','name','send','index','map','Dashboard','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x2f24f0,_0x119ae1){var _0x553d71=function(_0x4da78b){while(--_0x4da78b){_0x2f24f0['push'](_0x2f24f0['shift']());}};_0x553d71(++_0x119ae1);}(_0x31c3,0xb6));var _0x331c=function(_0xea217b,_0xdf2b4f){_0xea217b=_0xea217b-0x0;var _0x5b8c40=_0x31c3[_0xea217b];return _0x5b8c40;};'use strict';var pdf=require(_0x331c('0x0'));var emlformat=require(_0x331c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x331c('0x2'));var jsonpatch=require(_0x331c('0x3'));var rp=require(_0x331c('0x4'));var moment=require(_0x331c('0x5'));var BPromise=require(_0x331c('0x6'));var Mustache=require(_0x331c('0x7'));var util=require(_0x331c('0x8'));var path=require(_0x331c('0x9'));var sox=require(_0x331c('0xa'));var csv=require(_0x331c('0xb'));var ejs=require(_0x331c('0xc'));var fs=require('fs');var _=require(_0x331c('0xd'));var squel=require(_0x331c('0xe'));var crypto=require(_0x331c('0xf'));var jsforce=require(_0x331c('0x10'));var deskjs=require(_0x331c('0x11'));var toCsv=require(_0x331c('0xb'));var querystring=require(_0x331c('0x12'));var Papa=require('papaparse');var Redis=require(_0x331c('0x13'));var authService=require(_0x331c('0x14'));var qs=require(_0x331c('0x15'));var as=require(_0x331c('0x16'));var hardwareService=require(_0x331c('0x17'));var logger=require('../../config/logger')(_0x331c('0x18'));var utils=require(_0x331c('0x19'));var config=require(_0x331c('0x1a'));var licenseUtil=require(_0x331c('0x1b'));var db=require(_0x331c('0x1c'))['db'];config[_0x331c('0x1d')]=_[_0x331c('0x1e')](config[_0x331c('0x1d')],{'host':_0x331c('0x1f'),'port':0x18eb});var socket=require(_0x331c('0x20'))(new Redis(config['redis']));require('./dashboard.socket')[_0x331c('0x21')](socket);function respondWithStatusCode(_0x34b3a1,_0x4c25f2){_0x4c25f2=_0x4c25f2||0xcc;return function(_0x5220d9){if(_0x5220d9){return _0x34b3a1['sendStatus'](_0x4c25f2);}return _0x34b3a1[_0x331c('0x22')](_0x4c25f2)['end']();};}function respondWithResult(_0x1a4842,_0x4c6a2b){_0x4c6a2b=_0x4c6a2b||0xc8;return function(_0x117916){if(_0x117916){return _0x1a4842['status'](_0x4c6a2b)[_0x331c('0x23')](_0x117916);}};}function respondWithFilteredResult(_0xc186d4,_0x1b1bed){return function(_0x3dfabb){if(_0x3dfabb){var _0x19e2cb=_0x3dfabb[_0x331c('0x24')],_0x8b8319=_0x1b1bed[_0x331c('0x25')],_0x23c314=_0x1b1bed[_0x331c('0x25')]+_0x1b1bed[_0x331c('0x26')],_0x30a840;if(_0x23c314>=_0x19e2cb){_0x23c314=_0x19e2cb;_0x30a840=0xc8;}else{_0x30a840=0xce;}_0xc186d4['status'](_0x30a840);return _0xc186d4['set'](_0x331c('0x27'),_0x8b8319+'-'+_0x23c314+'/'+_0x19e2cb)[_0x331c('0x23')](_0x3dfabb);}return null;};}function patchUpdates(_0x58e1c3){return function(_0x29296b){try{jsonpatch[_0x331c('0x28')](_0x29296b,_0x58e1c3,!![]);}catch(_0x3dd538){return BPromise[_0x331c('0x29')](_0x3dd538);}return _0x29296b['save']();};}function saveUpdates(_0x2a480f,_0x382241){return function(_0x1f96cf){if(_0x1f96cf){return _0x1f96cf[_0x331c('0x2a')](_0x2a480f)[_0x331c('0x2b')](function(_0x4f13ee){return _0x4f13ee;});}return null;};}function removeEntity(_0x37287f,_0x6288de){return function(_0x4acdea){if(_0x4acdea){return _0x4acdea[_0x331c('0x2c')]()[_0x331c('0x2b')](function(){var _0x177cf8=_0x4acdea[_0x331c('0x2d')]({'plain':!![]});var _0x46003e='CustomDashboards';return db['UserProfileResource'][_0x331c('0x2c')]({'where':{'type':_0x46003e,'resourceId':_0x177cf8['id']}})[_0x331c('0x2b')](function(){return _0x4acdea;});})['then'](function(){_0x37287f[_0x331c('0x22')](0xcc)[_0x331c('0x2e')]();});}};}function handleEntityNotFound(_0x3eae2c,_0x20b0b8){return function(_0x1549e9){if(!_0x1549e9){_0x3eae2c[_0x331c('0x2f')](0x194);}return _0x1549e9;};}function handleError(_0x5ad70f,_0x175d43){_0x175d43=_0x175d43||0x1f4;return function(_0x4154b7){logger[_0x331c('0x30')](_0x4154b7['stack']);if(_0x4154b7[_0x331c('0x31')]){delete _0x4154b7[_0x331c('0x31')];}_0x5ad70f[_0x331c('0x22')](_0x175d43)[_0x331c('0x32')](_0x4154b7);};}exports[_0x331c('0x33')]=function(_0x4686bb,_0x4a36ee){var _0x4830bd={},_0x471758={},_0x522736={'count':0x0,'rows':[]};var _0x11006e=_[_0x331c('0x34')](db[_0x331c('0x35')]['rawAttributes'],function(_0x2701d0){return{'name':_0x2701d0[_0x331c('0x36')],'type':_0x2701d0[_0x331c('0x37')][_0x331c('0x38')]};});_0x471758['model']=_[_0x331c('0x34')](_0x11006e,_0x331c('0x31'));_0x471758[_0x331c('0x39')]=_['keys'](_0x4686bb[_0x331c('0x39')]);_0x471758[_0x331c('0x3a')]=_[_0x331c('0x3b')](_0x471758[_0x331c('0x3c')],_0x471758['query']);_0x4830bd['attributes']=_[_0x331c('0x3b')](_0x471758[_0x331c('0x3c')],qs[_0x331c('0x3d')](_0x4686bb[_0x331c('0x39')][_0x331c('0x3d')]));_0x4830bd[_0x331c('0x3e')]=_0x4830bd[_0x331c('0x3e')][_0x331c('0x3f')]?_0x4830bd[_0x331c('0x3e')]:_0x471758[_0x331c('0x3c')];if(!_0x4686bb['query'][_0x331c('0x40')](_0x331c('0x41'))){_0x4830bd[_0x331c('0x26')]=qs['limit'](_0x4686bb[_0x331c('0x39')][_0x331c('0x26')]);_0x4830bd[_0x331c('0x25')]=qs[_0x331c('0x25')](_0x4686bb[_0x331c('0x39')][_0x331c('0x25')]);}_0x4830bd[_0x331c('0x42')]=qs[_0x331c('0x43')](_0x4686bb[_0x331c('0x39')][_0x331c('0x43')]);_0x4830bd[_0x331c('0x44')]=qs[_0x331c('0x3a')](_[_0x331c('0x45')](_0x4686bb[_0x331c('0x39')],_0x471758['filters']),_0x11006e);if(_0x4686bb[_0x331c('0x39')][_0x331c('0x46')]){_0x4830bd['where']=_[_0x331c('0x47')](_0x4830bd[_0x331c('0x44')],{'$or':_[_0x331c('0x34')](_0x11006e,function(_0x118a40){if(_0x118a40[_0x331c('0x37')]!==_0x331c('0x48')){var _0x182a72={};_0x182a72[_0x118a40[_0x331c('0x31')]]={'$like':'%'+_0x4686bb[_0x331c('0x39')]['filter']+'%'};return _0x182a72;}})});}_0x4830bd=_['merge']({},_0x4830bd,_0x4686bb[_0x331c('0x49')]);var _0x401f6c={'where':_0x4830bd[_0x331c('0x44')]};return db[_0x331c('0x35')]['count'](_0x401f6c)[_0x331c('0x2b')](function(_0xfeed19){_0x522736[_0x331c('0x24')]=_0xfeed19;if(_0x4686bb[_0x331c('0x39')][_0x331c('0x4a')]){_0x4830bd[_0x331c('0x4b')]=[{'all':!![]}];}return db[_0x331c('0x35')][_0x331c('0x4c')](_0x4830bd);})[_0x331c('0x2b')](function(_0x2b4e3f){_0x522736[_0x331c('0x4d')]=_0x2b4e3f;return _0x522736;})[_0x331c('0x2b')](respondWithFilteredResult(_0x4a36ee,_0x4830bd))['catch'](handleError(_0x4a36ee,null));};exports[_0x331c('0x4e')]=function(_0x132796,_0x151dfc){var _0x1ca26a={'raw':![],'where':{'id':_0x132796[_0x331c('0x4f')]['id']}},_0x16b979={};_0x16b979[_0x331c('0x3c')]=_[_0x331c('0x50')](db[_0x331c('0x35')][_0x331c('0x51')]);_0x16b979['query']=_[_0x331c('0x50')](_0x132796['query']);_0x16b979[_0x331c('0x3a')]=_['intersection'](_0x16b979[_0x331c('0x3c')],_0x16b979['query']);_0x1ca26a[_0x331c('0x3e')]=_[_0x331c('0x3b')](_0x16b979[_0x331c('0x3c')],qs[_0x331c('0x3d')](_0x132796['query'][_0x331c('0x3d')]));_0x1ca26a[_0x331c('0x3e')]=_0x1ca26a[_0x331c('0x3e')][_0x331c('0x3f')]?_0x1ca26a[_0x331c('0x3e')]:_0x16b979[_0x331c('0x3c')];if(_0x132796[_0x331c('0x39')]['includeAll']){_0x1ca26a['include']=[{'all':!![]}];}_0x1ca26a=_['merge']({},_0x1ca26a,_0x132796[_0x331c('0x49')]);return db[_0x331c('0x35')][_0x331c('0x52')](_0x1ca26a)[_0x331c('0x2b')](handleEntityNotFound(_0x151dfc,null))[_0x331c('0x2b')](respondWithResult(_0x151dfc,null))[_0x331c('0x53')](handleError(_0x151dfc,null));};exports['create']=function(_0x323833,_0x224ab3){return db[_0x331c('0x35')][_0x331c('0x54')](_0x323833[_0x331c('0x55')],{})[_0x331c('0x2b')](function(_0x3e1f81){var _0x31674d=_0x323833['user'][_0x331c('0x2d')]({'plain':!![]});if(!_0x31674d)throw new Error(_0x331c('0x56'));if(_0x31674d[_0x331c('0x57')]==='user'){var _0x2e5842=_0x3e1f81[_0x331c('0x2d')]({'plain':!![]});var _0x3ec427=_0x331c('0x58');return db['UserProfileSection'][_0x331c('0x52')]({'where':{'name':_0x3ec427,'userProfileId':_0x31674d[_0x331c('0x59')]},'raw':!![]})['then'](function(_0x1f5e89){if(_0x1f5e89&&_0x1f5e89[_0x331c('0x5a')]===0x0){return db[_0x331c('0x5b')][_0x331c('0x54')]({'name':_0x2e5842[_0x331c('0x31')],'resourceId':_0x2e5842['id'],'type':_0x1f5e89[_0x331c('0x31')],'sectionId':_0x1f5e89['id']},{})['then'](function(){return _0x3e1f81;});}else{return _0x3e1f81;}})[_0x331c('0x53')](function(_0x55fed0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55fed0);throw _0x55fed0;});}return _0x3e1f81;})[_0x331c('0x2b')](respondWithResult(_0x224ab3,0xc9))[_0x331c('0x53')](handleError(_0x224ab3,null));};exports[_0x331c('0x5c')]=function(_0x285eec,_0x1aa3fa){var _0x38ea3f={'where':{'id':_0x285eec[_0x331c('0x4f')]['id']}},_0x472a1b={};_0x472a1b[_0x331c('0x3c')]=_[_0x331c('0x50')](db[_0x331c('0x35')]['rawAttributes']);_0x38ea3f[_0x331c('0x3e')]=_[_0x331c('0x3b')](_0x472a1b[_0x331c('0x3c')],qs[_0x331c('0x3d')](_0x285eec['query']['fields']));_0x38ea3f[_0x331c('0x3e')]=_0x38ea3f[_0x331c('0x3e')][_0x331c('0x3f')]?_0x38ea3f[_0x331c('0x3e')]:_0x472a1b[_0x331c('0x3c')];if(_0x285eec['query']['includeAll']){_0x38ea3f['include']=[{'all':!![]}];}_0x38ea3f=_[_0x331c('0x47')]({},_0x38ea3f,_0x285eec['options']);return db[_0x331c('0x35')][_0x331c('0x52')](_0x38ea3f)[_0x331c('0x2b')](handleEntityNotFound(_0x1aa3fa,null))['then'](function(_0x1ac2c5){if(_0x1ac2c5){var _0x27d23c=_0x1ac2c5[_0x331c('0x2d')]({'plain':!![]});_0x27d23c=qs[_0x331c('0x5d')](_0x27d23c,['id','createdAt',_0x331c('0x5e')]);_0x285eec['body']=_[_0x331c('0x5d')](_0x285eec[_0x331c('0x55')],['id',_0x331c('0x5f'),_0x331c('0x5e')]);return db[_0x331c('0x35')][_0x331c('0x54')](_[_0x331c('0x47')](_0x27d23c,_0x285eec[_0x331c('0x55')]),{'include':_0x285eec[_0x331c('0x39')][_0x331c('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x190693){var _0x649094=_0x285eec[_0x331c('0x60')][_0x331c('0x2d')]({'plain':!![]});if(!_0x649094)throw new Error(_0x331c('0x56'));if(_0x649094[_0x331c('0x57')]==='user'){var _0x3522c6=_0x190693['get']({'plain':!![]});var _0x43a300='CustomDashboards';return db[_0x331c('0x61')][_0x331c('0x52')]({'where':{'name':_0x43a300,'userProfileId':_0x649094[_0x331c('0x59')]},'raw':!![]})[_0x331c('0x2b')](function(_0x4ad2c2){if(_0x4ad2c2&&_0x4ad2c2[_0x331c('0x5a')]===0x0){return db[_0x331c('0x5b')][_0x331c('0x54')]({'name':_0x3522c6[_0x331c('0x31')],'resourceId':_0x3522c6['id'],'type':_0x4ad2c2[_0x331c('0x31')],'sectionId':_0x4ad2c2['id']},{})['then'](function(){return _0x190693;});}else{return _0x190693;}})[_0x331c('0x53')](function(_0x4ee58d){logger[_0x331c('0x30')](_0x331c('0x62'),_0x4ee58d);throw _0x4ee58d;});}return _0x190693;});}})[_0x331c('0x2b')](respondWithResult(_0x1aa3fa,0xc9))[_0x331c('0x53')](handleError(_0x1aa3fa,null));};exports[_0x331c('0x2a')]=function(_0x2c9895,_0xc0a130){if(_0x2c9895[_0x331c('0x55')]['id']){delete _0x2c9895['body']['id'];}return db['Dashboard'][_0x331c('0x52')]({'where':{'id':_0x2c9895[_0x331c('0x4f')]['id']}})[_0x331c('0x2b')](handleEntityNotFound(_0xc0a130,null))[_0x331c('0x2b')](saveUpdates(_0x2c9895['body'],null))[_0x331c('0x2b')](respondWithResult(_0xc0a130,null))['catch'](handleError(_0xc0a130,null));};exports[_0x331c('0x2c')]=function(_0x1b47f0,_0x33263c){return db[_0x331c('0x35')][_0x331c('0x52')]({'where':{'id':_0x1b47f0['params']['id']}})['then'](handleEntityNotFound(_0x33263c,null))['then'](removeEntity(_0x33263c,null))[_0x331c('0x53')](handleError(_0x33263c,null));};function widgetAttributes(_0x11db7b){try{switch(_0x11db7b['type']){case _0x331c('0x63'):return[{'name':_0x331c('0x64'),'value':_0x11db7b['attrUrl']||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b['attrs'][0x0]?_0x11db7b[_0x331c('0x65')][0x0][_0x331c('0x66')]:undefined)||_0x331c('0x67')}];case'custom':return[{'name':'attrPath','value':_0x11db7b['attrPath']||(_0x11db7b['attrs']&&_0x11db7b['attrs'][0x0]?_0x11db7b[_0x331c('0x65')][0x0][_0x331c('0x66')]:undefined)||''}];case _0x331c('0x68'):return[{'name':_0x331c('0x69'),'value':_0x11db7b['attrHourFormat']||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b['attrs'][0x0]?_0x11db7b['attrs'][0x0][_0x331c('0x66')]:undefined)||_0x331c('0x6a')},{'name':_0x331c('0x6b'),'value':_0x11db7b[_0x331c('0x6b')]||(_0x11db7b['attrs']&&_0x11db7b[_0x331c('0x65')][0x1]?_0x11db7b[_0x331c('0x65')][0x1][_0x331c('0x66')]:undefined)||_0x331c('0x6c')},{'name':_0x331c('0x6d'),'value':_0x11db7b[_0x331c('0x6d')]||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b['attrs'][0x2]?_0x11db7b[_0x331c('0x65')][0x2][_0x331c('0x66')]:undefined)||0xc}];case'counter':return[{'name':_0x331c('0x6e'),'value':_0x11db7b['attrMetric']||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b[_0x331c('0x65')][0x0]?_0x11db7b['attrs'][0x0]['value']:undefined)||_0x331c('0x6f')},{'name':_0x331c('0x70'),'value':_0x11db7b['attrVoiceQueues']||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b['attrs'][0x1]?_0x11db7b['attrs'][0x1][_0x331c('0x66')]:undefined)||[]},{'name':'attrFontSize','value':_0x11db7b['attrFontSize']||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b['attrs'][0x2]?_0x11db7b['attrs'][0x2][_0x331c('0x66')]:undefined)||0x14}];case _0x331c('0x71'):case _0x331c('0x72'):return[{'name':_0x331c('0x73'),'value':_0x11db7b[_0x331c('0x73')]||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b[_0x331c('0x65')][0x0]?_0x11db7b[_0x331c('0x65')][0x0]['value']:undefined)||_0x331c('0x6f')},{'name':_0x331c('0x74'),'value':_0x11db7b[_0x331c('0x74')]||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b[_0x331c('0x65')][0x1]?_0x11db7b['attrs'][0x1]['value']:undefined)||null},{'name':_0x331c('0x75'),'value':_0x11db7b[_0x331c('0x75')]||(_0x11db7b['attrs']&&_0x11db7b[_0x331c('0x65')][0x2]?_0x11db7b[_0x331c('0x65')][0x2]['value']:undefined)||null},{'name':_0x331c('0x70'),'value':_0x11db7b['attrVoiceQueues']||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b['attrs'][0x3]?_0x11db7b[_0x331c('0x65')][0x3][_0x331c('0x66')]:undefined)||[]}];case'web-report':return[{'name':_0x331c('0x76'),'type':_0x11db7b[_0x331c('0x77')]||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b[_0x331c('0x65')][0x0]?_0x11db7b[_0x331c('0x65')][0x0][_0x331c('0x37')]:undefined)||null,'value':_0x11db7b[_0x331c('0x76')]||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b[_0x331c('0x65')][0x0]?_0x11db7b[_0x331c('0x65')][0x0][_0x331c('0x66')]:undefined)||null},{'name':_0x331c('0x78'),'value':_0x11db7b['attrRefresh']||(_0x11db7b['attrs']&&_0x11db7b[_0x331c('0x65')][0x1]?_0x11db7b[_0x331c('0x65')][0x1][_0x331c('0x66')]:undefined)||0x0}];default:return[];}}catch(_0x374031){logger[_0x331c('0x30')](_0x331c('0x79'),JSON[_0x331c('0x7a')](_0x374031));return[];}}exports['addItem']=function(_0x32bf27,_0x2b956f,_0x370c46){if(_0x32bf27[_0x331c('0x55')]['id']){delete _0x32bf27[_0x331c('0x55')]['id'];}return db[_0x331c('0x35')][_0x331c('0x52')]({'where':{'id':_0x32bf27['params']['id']}})['then'](handleEntityNotFound(_0x2b956f,null))[_0x331c('0x2b')](function(_0x16b274){if(_0x16b274){_0x32bf27[_0x331c('0x55')][_0x331c('0x7b')]=_0x16b274['id'];_0x32bf27[_0x331c('0x55')][_0x331c('0x65')]=widgetAttributes(_0x32bf27['body']);return db[_0x331c('0x7c')]['create'](_0x32bf27[_0x331c('0x55')]);}})['then'](respondWithResult(_0x2b956f,null))[_0x331c('0x53')](handleError(_0x2b956f,null));};exports[_0x331c('0x7d')]=function(_0x181c1d,_0x3cfebd,_0x3deac0){var _0x598c05={};var _0x5b68bb={};var _0x2cb80e;var _0x4c7547;return db[_0x331c('0x35')][_0x331c('0x7e')]({'where':{'id':_0x181c1d[_0x331c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3cfebd,null))['then'](function(_0x1c9a9a){if(_0x1c9a9a){_0x2cb80e=_0x1c9a9a;_0x5b68bb[_0x331c('0x3c')]=_['keys'](db[_0x331c('0x7c')]['rawAttributes']);_0x5b68bb[_0x331c('0x39')]=_[_0x331c('0x50')](_0x181c1d[_0x331c('0x39')]);_0x5b68bb[_0x331c('0x3a')]=_[_0x331c('0x3b')](_0x5b68bb['model'],_0x5b68bb[_0x331c('0x39')]);_0x598c05[_0x331c('0x3e')]=_['intersection'](_0x5b68bb[_0x331c('0x3c')],qs[_0x331c('0x3d')](_0x181c1d['query'][_0x331c('0x3d')]));_0x598c05[_0x331c('0x3e')]=_0x598c05[_0x331c('0x3e')]['length']?_0x598c05['attributes']:_0x5b68bb[_0x331c('0x3c')];_0x598c05[_0x331c('0x42')]=qs[_0x331c('0x43')](_0x181c1d[_0x331c('0x39')][_0x331c('0x43')]);_0x598c05[_0x331c('0x44')]=qs['filters'](_[_0x331c('0x45')](_0x181c1d['query'],_0x5b68bb['filters']));if(_0x181c1d[_0x331c('0x39')]['filter']){_0x598c05[_0x331c('0x44')]=_[_0x331c('0x47')](_0x598c05[_0x331c('0x44')],{'$or':_[_0x331c('0x34')](_0x598c05['attributes'],function(_0x377250){var _0x390ca8={};_0x390ca8[_0x377250]={'$like':'%'+_0x181c1d[_0x331c('0x39')][_0x331c('0x46')]+'%'};return _0x390ca8;})});}_0x598c05=_['merge']({},_0x598c05,_0x181c1d['options']);return _0x2cb80e['getItems'](_0x598c05);}})[_0x331c('0x2b')](function(_0x56494e){if(_0x56494e){_0x4c7547=_0x56494e[_0x331c('0x3f')];if(!_0x181c1d['query']['hasOwnProperty'](_0x331c('0x41'))){_0x598c05[_0x331c('0x26')]=qs[_0x331c('0x26')](_0x181c1d[_0x331c('0x39')][_0x331c('0x26')]);_0x598c05[_0x331c('0x25')]=qs[_0x331c('0x25')](_0x181c1d[_0x331c('0x39')][_0x331c('0x25')]);}return _0x2cb80e[_0x331c('0x7d')](_0x598c05);}})[_0x331c('0x2b')](function(_0x56852c){if(_0x56852c){return _0x56852c?{'count':_0x4c7547,'rows':_0x56852c}:null;}})[_0x331c('0x2b')](respondWithResult(_0x3cfebd,null))[_0x331c('0x53')](handleError(_0x3cfebd,null));}; \ No newline at end of file +var _0xae03=['params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','clone','fields','omit','createdAt','updatedAt','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','findOne','filter','getItems','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','end','json','offset','limit','set','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','map','Dashboard','rawAttributes','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','merge','options','count','include','findAll','catch','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae03,0x192));var _0x3ae0=function(_0x2127ad,_0x4bbd7c){_0x2127ad=_0x2127ad-0x0;var _0xbf0f5d=_0xae03[_0x2127ad];return _0xbf0f5d;};'use strict';var pdf=require(_0x3ae0('0x0'));var emlformat=require(_0x3ae0('0x1'));var rimraf=require(_0x3ae0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ae0('0x3'));var rp=require(_0x3ae0('0x4'));var moment=require(_0x3ae0('0x5'));var BPromise=require(_0x3ae0('0x6'));var Mustache=require('mustache');var util=require(_0x3ae0('0x7'));var path=require(_0x3ae0('0x8'));var sox=require('sox');var csv=require(_0x3ae0('0x9'));var ejs=require(_0x3ae0('0xa'));var fs=require('fs');var _=require(_0x3ae0('0xb'));var squel=require(_0x3ae0('0xc'));var crypto=require(_0x3ae0('0xd'));var jsforce=require(_0x3ae0('0xe'));var deskjs=require(_0x3ae0('0xf'));var toCsv=require(_0x3ae0('0x9'));var querystring=require('querystring');var Papa=require(_0x3ae0('0x10'));var Redis=require(_0x3ae0('0x11'));var authService=require(_0x3ae0('0x12'));var qs=require(_0x3ae0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ae0('0x14'))(_0x3ae0('0x15'));var utils=require(_0x3ae0('0x16'));var config=require(_0x3ae0('0x17'));var licenseUtil=require(_0x3ae0('0x18'));var db=require(_0x3ae0('0x19'))['db'];config[_0x3ae0('0x1a')]=_['defaults'](config[_0x3ae0('0x1a')],{'host':_0x3ae0('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ae0('0x1a')]));require('./dashboard.socket')[_0x3ae0('0x1c')](socket);function respondWithStatusCode(_0x95295e,_0x78f33b){_0x78f33b=_0x78f33b||0xcc;return function(_0x326a4b){if(_0x326a4b){return _0x95295e[_0x3ae0('0x1d')](_0x78f33b);}return _0x95295e[_0x3ae0('0x1e')](_0x78f33b)[_0x3ae0('0x1f')]();};}function respondWithResult(_0x18cc2a,_0x3dda9b){_0x3dda9b=_0x3dda9b||0xc8;return function(_0x9d2de){if(_0x9d2de){return _0x18cc2a['status'](_0x3dda9b)[_0x3ae0('0x20')](_0x9d2de);}};}function respondWithFilteredResult(_0x20d192,_0x34d495){return function(_0x21db35){if(_0x21db35){var _0xdfcc15=_0x21db35['count'],_0x304043=_0x34d495[_0x3ae0('0x21')],_0x7eceab=_0x34d495[_0x3ae0('0x21')]+_0x34d495[_0x3ae0('0x22')],_0x40882a;if(_0x7eceab>=_0xdfcc15){_0x7eceab=_0xdfcc15;_0x40882a=0xc8;}else{_0x40882a=0xce;}_0x20d192[_0x3ae0('0x1e')](_0x40882a);return _0x20d192[_0x3ae0('0x23')]('Content-Range',_0x304043+'-'+_0x7eceab+'/'+_0xdfcc15)[_0x3ae0('0x20')](_0x21db35);}return null;};}function patchUpdates(_0x31407b){return function(_0x1623db){try{jsonpatch['apply'](_0x1623db,_0x31407b,!![]);}catch(_0x5a7500){return BPromise[_0x3ae0('0x24')](_0x5a7500);}return _0x1623db[_0x3ae0('0x25')]();};}function saveUpdates(_0x2ee579,_0x1823ff){return function(_0x2738a7){if(_0x2738a7){return _0x2738a7[_0x3ae0('0x26')](_0x2ee579)[_0x3ae0('0x27')](function(_0x20d1f0){return _0x20d1f0;});}return null;};}function removeEntity(_0x2e0db3,_0x5e8a05){return function(_0x3d1dee){if(_0x3d1dee){return _0x3d1dee[_0x3ae0('0x28')]()[_0x3ae0('0x27')](function(){var _0x2163a2=_0x3d1dee[_0x3ae0('0x29')]({'plain':!![]});var _0x46f4f0=_0x3ae0('0x2a');return db[_0x3ae0('0x2b')][_0x3ae0('0x28')]({'where':{'type':_0x46f4f0,'resourceId':_0x2163a2['id']}})['then'](function(){return _0x3d1dee;});})[_0x3ae0('0x27')](function(){_0x2e0db3[_0x3ae0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28b357,_0x2df63d){return function(_0x5803b6){if(!_0x5803b6){_0x28b357[_0x3ae0('0x1d')](0x194);}return _0x5803b6;};}function handleError(_0x408b07,_0x36006f){_0x36006f=_0x36006f||0x1f4;return function(_0x1f44ef){logger[_0x3ae0('0x2c')](_0x1f44ef[_0x3ae0('0x2d')]);if(_0x1f44ef[_0x3ae0('0x2e')]){delete _0x1f44ef[_0x3ae0('0x2e')];}_0x408b07[_0x3ae0('0x1e')](_0x36006f)['send'](_0x1f44ef);};}exports['index']=function(_0x16ae35,_0x4527c6){var _0x5edd0b={},_0x2d4d5f={},_0x22cc8c={'count':0x0,'rows':[]};var _0x41a40f=_[_0x3ae0('0x2f')](db[_0x3ae0('0x30')][_0x3ae0('0x31')],function(_0x47538c){return{'name':_0x47538c['fieldName'],'type':_0x47538c[_0x3ae0('0x32')]['key']};});_0x2d4d5f[_0x3ae0('0x33')]=_['map'](_0x41a40f,'name');_0x2d4d5f[_0x3ae0('0x34')]=_[_0x3ae0('0x35')](_0x16ae35[_0x3ae0('0x34')]);_0x2d4d5f[_0x3ae0('0x36')]=_[_0x3ae0('0x37')](_0x2d4d5f['model'],_0x2d4d5f[_0x3ae0('0x34')]);_0x5edd0b[_0x3ae0('0x38')]=_[_0x3ae0('0x37')](_0x2d4d5f[_0x3ae0('0x33')],qs['fields'](_0x16ae35[_0x3ae0('0x34')]['fields']));_0x5edd0b['attributes']=_0x5edd0b[_0x3ae0('0x38')][_0x3ae0('0x39')]?_0x5edd0b[_0x3ae0('0x38')]:_0x2d4d5f[_0x3ae0('0x33')];if(!_0x16ae35[_0x3ae0('0x34')][_0x3ae0('0x3a')]('nolimit')){_0x5edd0b[_0x3ae0('0x22')]=qs[_0x3ae0('0x22')](_0x16ae35[_0x3ae0('0x34')][_0x3ae0('0x22')]);_0x5edd0b[_0x3ae0('0x21')]=qs['offset'](_0x16ae35['query'][_0x3ae0('0x21')]);}_0x5edd0b[_0x3ae0('0x3b')]=qs[_0x3ae0('0x3c')](_0x16ae35[_0x3ae0('0x34')][_0x3ae0('0x3c')]);_0x5edd0b[_0x3ae0('0x3d')]=qs[_0x3ae0('0x36')](_[_0x3ae0('0x3e')](_0x16ae35[_0x3ae0('0x34')],_0x2d4d5f['filters']),_0x41a40f);if(_0x16ae35[_0x3ae0('0x34')]['filter']){_0x5edd0b[_0x3ae0('0x3d')]=_[_0x3ae0('0x3f')](_0x5edd0b[_0x3ae0('0x3d')],{'$or':_[_0x3ae0('0x2f')](_0x41a40f,function(_0xad8673){if(_0xad8673[_0x3ae0('0x32')]!=='VIRTUAL'){var _0x1d31bc={};_0x1d31bc[_0xad8673[_0x3ae0('0x2e')]]={'$like':'%'+_0x16ae35[_0x3ae0('0x34')]['filter']+'%'};return _0x1d31bc;}})});}_0x5edd0b=_[_0x3ae0('0x3f')]({},_0x5edd0b,_0x16ae35[_0x3ae0('0x40')]);var _0x1d3e18={'where':_0x5edd0b[_0x3ae0('0x3d')]};return db[_0x3ae0('0x30')][_0x3ae0('0x41')](_0x1d3e18)['then'](function(_0x4b7494){_0x22cc8c[_0x3ae0('0x41')]=_0x4b7494;if(_0x16ae35[_0x3ae0('0x34')]['includeAll']){_0x5edd0b[_0x3ae0('0x42')]=[{'all':!![]}];}return db['Dashboard'][_0x3ae0('0x43')](_0x5edd0b);})[_0x3ae0('0x27')](function(_0x580aa6){_0x22cc8c['rows']=_0x580aa6;return _0x22cc8c;})['then'](respondWithFilteredResult(_0x4527c6,_0x5edd0b))[_0x3ae0('0x44')](handleError(_0x4527c6,null));};exports[_0x3ae0('0x45')]=function(_0x38284d,_0x295373){var _0x1386d9={'raw':![],'where':{'id':_0x38284d[_0x3ae0('0x46')]['id']}},_0x13e66f={};_0x13e66f[_0x3ae0('0x33')]=_['keys'](db['Dashboard'][_0x3ae0('0x31')]);_0x13e66f[_0x3ae0('0x34')]=_[_0x3ae0('0x35')](_0x38284d[_0x3ae0('0x34')]);_0x13e66f[_0x3ae0('0x36')]=_[_0x3ae0('0x37')](_0x13e66f[_0x3ae0('0x33')],_0x13e66f['query']);_0x1386d9['attributes']=_[_0x3ae0('0x37')](_0x13e66f['model'],qs['fields'](_0x38284d[_0x3ae0('0x34')]['fields']));_0x1386d9[_0x3ae0('0x38')]=_0x1386d9[_0x3ae0('0x38')][_0x3ae0('0x39')]?_0x1386d9[_0x3ae0('0x38')]:_0x13e66f[_0x3ae0('0x33')];if(_0x38284d['query'][_0x3ae0('0x47')]){_0x1386d9[_0x3ae0('0x42')]=[{'all':!![]}];}_0x1386d9=_[_0x3ae0('0x3f')]({},_0x1386d9,_0x38284d['options']);return db[_0x3ae0('0x30')][_0x3ae0('0x48')](_0x1386d9)[_0x3ae0('0x27')](handleEntityNotFound(_0x295373,null))[_0x3ae0('0x27')](respondWithResult(_0x295373,null))[_0x3ae0('0x44')](handleError(_0x295373,null));};exports[_0x3ae0('0x49')]=function(_0x5f0257,_0x469ef7){return db[_0x3ae0('0x30')][_0x3ae0('0x49')](_0x5f0257[_0x3ae0('0x4a')],{})[_0x3ae0('0x27')](function(_0x55742c){var _0x17e8d9=_0x5f0257[_0x3ae0('0x4b')][_0x3ae0('0x29')]({'plain':!![]});if(!_0x17e8d9)throw new Error(_0x3ae0('0x4c'));if(_0x17e8d9['role']===_0x3ae0('0x4b')){var _0x5e82d0=_0x55742c['get']({'plain':!![]});var _0x379d9c=_0x3ae0('0x2a');return db[_0x3ae0('0x4d')][_0x3ae0('0x48')]({'where':{'name':_0x379d9c,'userProfileId':_0x17e8d9[_0x3ae0('0x4e')]},'raw':!![]})[_0x3ae0('0x27')](function(_0x2221b1){if(_0x2221b1&&_0x2221b1['autoAssociation']===0x0){return db[_0x3ae0('0x2b')][_0x3ae0('0x49')]({'name':_0x5e82d0[_0x3ae0('0x2e')],'resourceId':_0x5e82d0['id'],'type':_0x2221b1['name'],'sectionId':_0x2221b1['id']},{})['then'](function(){return _0x55742c;});}else{return _0x55742c;}})['catch'](function(_0x1b79f6){logger[_0x3ae0('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b79f6);throw _0x1b79f6;});}return _0x55742c;})[_0x3ae0('0x27')](respondWithResult(_0x469ef7,0xc9))[_0x3ae0('0x44')](handleError(_0x469ef7,null));};exports[_0x3ae0('0x4f')]=function(_0xd90709,_0x13b4b3){var _0x52b70e={'where':{'id':_0xd90709[_0x3ae0('0x46')]['id']}},_0x5b0702={};_0x5b0702[_0x3ae0('0x33')]=_[_0x3ae0('0x35')](db[_0x3ae0('0x30')]['rawAttributes']);_0x52b70e['attributes']=_[_0x3ae0('0x37')](_0x5b0702[_0x3ae0('0x33')],qs[_0x3ae0('0x50')](_0xd90709[_0x3ae0('0x34')][_0x3ae0('0x50')]));_0x52b70e['attributes']=_0x52b70e['attributes']['length']?_0x52b70e[_0x3ae0('0x38')]:_0x5b0702[_0x3ae0('0x33')];if(_0xd90709[_0x3ae0('0x34')][_0x3ae0('0x47')]){_0x52b70e[_0x3ae0('0x42')]=[{'all':!![]}];}_0x52b70e=_[_0x3ae0('0x3f')]({},_0x52b70e,_0xd90709[_0x3ae0('0x40')]);return db[_0x3ae0('0x30')]['find'](_0x52b70e)[_0x3ae0('0x27')](handleEntityNotFound(_0x13b4b3,null))[_0x3ae0('0x27')](function(_0x1a81ad){if(_0x1a81ad){var _0x268a63=_0x1a81ad[_0x3ae0('0x29')]({'plain':!![]});_0x268a63=qs[_0x3ae0('0x51')](_0x268a63,['id',_0x3ae0('0x52'),_0x3ae0('0x53')]);_0xd90709[_0x3ae0('0x4a')]=_[_0x3ae0('0x51')](_0xd90709[_0x3ae0('0x4a')],['id',_0x3ae0('0x52'),'updatedAt']);return db[_0x3ae0('0x30')][_0x3ae0('0x49')](_[_0x3ae0('0x3f')](_0x268a63,_0xd90709['body']),{'include':_0xd90709[_0x3ae0('0x34')][_0x3ae0('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x4cacda){var _0x54eb68=_0xd90709['user'][_0x3ae0('0x29')]({'plain':!![]});if(!_0x54eb68)throw new Error(_0x3ae0('0x4c'));if(_0x54eb68['role']===_0x3ae0('0x4b')){var _0x200fb1=_0x4cacda['get']({'plain':!![]});var _0x1b9a3d='CustomDashboards';return db['UserProfileSection'][_0x3ae0('0x48')]({'where':{'name':_0x1b9a3d,'userProfileId':_0x54eb68[_0x3ae0('0x4e')]},'raw':!![]})[_0x3ae0('0x27')](function(_0x3f16a4){if(_0x3f16a4&&_0x3f16a4[_0x3ae0('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x200fb1[_0x3ae0('0x2e')],'resourceId':_0x200fb1['id'],'type':_0x3f16a4[_0x3ae0('0x2e')],'sectionId':_0x3f16a4['id']},{})['then'](function(){return _0x4cacda;});}else{return _0x4cacda;}})[_0x3ae0('0x44')](function(_0x557e3d){logger['error'](_0x3ae0('0x55'),_0x557e3d);throw _0x557e3d;});}return _0x4cacda;});}})[_0x3ae0('0x27')](respondWithResult(_0x13b4b3,0xc9))[_0x3ae0('0x44')](handleError(_0x13b4b3,null));};exports['update']=function(_0x1fbbfc,_0x5ab1b1){if(_0x1fbbfc['body']['id']){delete _0x1fbbfc[_0x3ae0('0x4a')]['id'];}return db[_0x3ae0('0x30')][_0x3ae0('0x48')]({'where':{'id':_0x1fbbfc['params']['id']}})[_0x3ae0('0x27')](handleEntityNotFound(_0x5ab1b1,null))['then'](saveUpdates(_0x1fbbfc[_0x3ae0('0x4a')],null))[_0x3ae0('0x27')](respondWithResult(_0x5ab1b1,null))[_0x3ae0('0x44')](handleError(_0x5ab1b1,null));};exports[_0x3ae0('0x28')]=function(_0x5a5362,_0x1efc1d){return db[_0x3ae0('0x30')]['find']({'where':{'id':_0x5a5362[_0x3ae0('0x46')]['id']}})['then'](handleEntityNotFound(_0x1efc1d,null))[_0x3ae0('0x27')](removeEntity(_0x1efc1d,null))[_0x3ae0('0x44')](handleError(_0x1efc1d,null));};function widgetAttributes(_0x4c8667){try{switch(_0x4c8667[_0x3ae0('0x32')]){case _0x3ae0('0x56'):return[{'name':_0x3ae0('0x57'),'value':_0x4c8667[_0x3ae0('0x57')]||(_0x4c8667[_0x3ae0('0x58')]&&_0x4c8667['attrs'][0x0]?_0x4c8667[_0x3ae0('0x58')][0x0][_0x3ae0('0x59')]:undefined)||'https://'}];case _0x3ae0('0x5a'):return[{'name':_0x3ae0('0x5b'),'value':_0x4c8667[_0x3ae0('0x5b')]||(_0x4c8667['attrs']&&_0x4c8667[_0x3ae0('0x58')][0x0]?_0x4c8667[_0x3ae0('0x58')][0x0][_0x3ae0('0x59')]:undefined)||''}];case _0x3ae0('0x5c'):return[{'name':_0x3ae0('0x5d'),'value':_0x4c8667[_0x3ae0('0x5d')]||(_0x4c8667[_0x3ae0('0x58')]&&_0x4c8667[_0x3ae0('0x58')][0x0]?_0x4c8667[_0x3ae0('0x58')][0x0][_0x3ae0('0x59')]:undefined)||_0x3ae0('0x5e')},{'name':_0x3ae0('0x5f'),'value':_0x4c8667[_0x3ae0('0x5f')]||(_0x4c8667[_0x3ae0('0x58')]&&_0x4c8667[_0x3ae0('0x58')][0x1]?_0x4c8667['attrs'][0x1][_0x3ae0('0x59')]:undefined)||_0x3ae0('0x60')},{'name':_0x3ae0('0x61'),'value':_0x4c8667[_0x3ae0('0x61')]||(_0x4c8667[_0x3ae0('0x58')]&&_0x4c8667[_0x3ae0('0x58')][0x2]?_0x4c8667[_0x3ae0('0x58')][0x2][_0x3ae0('0x59')]:undefined)||0xc}];case _0x3ae0('0x62'):return[{'name':_0x3ae0('0x63'),'value':_0x4c8667[_0x3ae0('0x63')]||(_0x4c8667[_0x3ae0('0x58')]&&_0x4c8667['attrs'][0x0]?_0x4c8667['attrs'][0x0][_0x3ae0('0x59')]:undefined)||_0x3ae0('0x64')},{'name':_0x3ae0('0x65'),'value':_0x4c8667['attrVoiceQueues']||(_0x4c8667[_0x3ae0('0x58')]&&_0x4c8667[_0x3ae0('0x58')][0x1]?_0x4c8667[_0x3ae0('0x58')][0x1][_0x3ae0('0x59')]:undefined)||[]},{'name':_0x3ae0('0x61'),'value':_0x4c8667['attrFontSize']||(_0x4c8667[_0x3ae0('0x58')]&&_0x4c8667['attrs'][0x2]?_0x4c8667[_0x3ae0('0x58')][0x2]['value']:undefined)||0x14}];case _0x3ae0('0x66'):case _0x3ae0('0x67'):return[{'name':_0x3ae0('0x68'),'value':_0x4c8667[_0x3ae0('0x68')]||(_0x4c8667[_0x3ae0('0x58')]&&_0x4c8667[_0x3ae0('0x58')][0x0]?_0x4c8667['attrs'][0x0]['value']:undefined)||_0x3ae0('0x64')},{'name':_0x3ae0('0x69'),'value':_0x4c8667[_0x3ae0('0x69')]||(_0x4c8667['attrs']&&_0x4c8667[_0x3ae0('0x58')][0x1]?_0x4c8667[_0x3ae0('0x58')][0x1][_0x3ae0('0x59')]:undefined)||null},{'name':_0x3ae0('0x6a'),'value':_0x4c8667[_0x3ae0('0x6a')]||(_0x4c8667[_0x3ae0('0x58')]&&_0x4c8667[_0x3ae0('0x58')][0x2]?_0x4c8667[_0x3ae0('0x58')][0x2][_0x3ae0('0x59')]:undefined)||null},{'name':_0x3ae0('0x65'),'value':_0x4c8667[_0x3ae0('0x65')]||(_0x4c8667[_0x3ae0('0x58')]&&_0x4c8667[_0x3ae0('0x58')][0x3]?_0x4c8667['attrs'][0x3]['value']:undefined)||[]}];case _0x3ae0('0x6b'):return[{'name':'attrReport','type':_0x4c8667[_0x3ae0('0x6c')]||(_0x4c8667[_0x3ae0('0x58')]&&_0x4c8667[_0x3ae0('0x58')][0x0]?_0x4c8667[_0x3ae0('0x58')][0x0][_0x3ae0('0x32')]:undefined)||null,'value':_0x4c8667[_0x3ae0('0x6d')]||(_0x4c8667[_0x3ae0('0x58')]&&_0x4c8667[_0x3ae0('0x58')][0x0]?_0x4c8667[_0x3ae0('0x58')][0x0][_0x3ae0('0x59')]:undefined)||null},{'name':_0x3ae0('0x6e'),'value':_0x4c8667[_0x3ae0('0x6e')]||(_0x4c8667[_0x3ae0('0x58')]&&_0x4c8667[_0x3ae0('0x58')][0x1]?_0x4c8667[_0x3ae0('0x58')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x302ca9){logger[_0x3ae0('0x2c')](_0x3ae0('0x6f'),JSON[_0x3ae0('0x70')](_0x302ca9));return[];}}exports[_0x3ae0('0x71')]=function(_0x32f367,_0x538f75,_0x52604a){if(_0x32f367['body']['id']){delete _0x32f367[_0x3ae0('0x4a')]['id'];}return db[_0x3ae0('0x30')][_0x3ae0('0x48')]({'where':{'id':_0x32f367[_0x3ae0('0x46')]['id']}})[_0x3ae0('0x27')](handleEntityNotFound(_0x538f75,null))[_0x3ae0('0x27')](function(_0x2ffbdc){if(_0x2ffbdc){_0x32f367[_0x3ae0('0x4a')][_0x3ae0('0x72')]=_0x2ffbdc['id'];_0x32f367['body'][_0x3ae0('0x58')]=widgetAttributes(_0x32f367[_0x3ae0('0x4a')]);return db['DashboardItem'][_0x3ae0('0x49')](_0x32f367[_0x3ae0('0x4a')]);}})[_0x3ae0('0x27')](respondWithResult(_0x538f75,null))[_0x3ae0('0x44')](handleError(_0x538f75,null));};exports['getItems']=function(_0x164f49,_0x2bc5eb,_0x2b385e){var _0x10222f={};var _0x5070ad={};var _0x3a80b0;var _0x1e3d60;return db[_0x3ae0('0x30')][_0x3ae0('0x73')]({'where':{'id':_0x164f49['params']['id']}})[_0x3ae0('0x27')](handleEntityNotFound(_0x2bc5eb,null))[_0x3ae0('0x27')](function(_0x450c18){if(_0x450c18){_0x3a80b0=_0x450c18;_0x5070ad[_0x3ae0('0x33')]=_[_0x3ae0('0x35')](db['DashboardItem'][_0x3ae0('0x31')]);_0x5070ad['query']=_[_0x3ae0('0x35')](_0x164f49[_0x3ae0('0x34')]);_0x5070ad[_0x3ae0('0x36')]=_[_0x3ae0('0x37')](_0x5070ad[_0x3ae0('0x33')],_0x5070ad[_0x3ae0('0x34')]);_0x10222f[_0x3ae0('0x38')]=_[_0x3ae0('0x37')](_0x5070ad[_0x3ae0('0x33')],qs[_0x3ae0('0x50')](_0x164f49['query'][_0x3ae0('0x50')]));_0x10222f[_0x3ae0('0x38')]=_0x10222f['attributes'][_0x3ae0('0x39')]?_0x10222f[_0x3ae0('0x38')]:_0x5070ad[_0x3ae0('0x33')];_0x10222f[_0x3ae0('0x3b')]=qs[_0x3ae0('0x3c')](_0x164f49[_0x3ae0('0x34')]['sort']);_0x10222f[_0x3ae0('0x3d')]=qs[_0x3ae0('0x36')](_['pick'](_0x164f49['query'],_0x5070ad[_0x3ae0('0x36')]));if(_0x164f49['query'][_0x3ae0('0x74')]){_0x10222f[_0x3ae0('0x3d')]=_['merge'](_0x10222f[_0x3ae0('0x3d')],{'$or':_[_0x3ae0('0x2f')](_0x10222f[_0x3ae0('0x38')],function(_0x467a0f){var _0x4df816={};_0x4df816[_0x467a0f]={'$like':'%'+_0x164f49[_0x3ae0('0x34')][_0x3ae0('0x74')]+'%'};return _0x4df816;})});}_0x10222f=_[_0x3ae0('0x3f')]({},_0x10222f,_0x164f49['options']);return _0x3a80b0[_0x3ae0('0x75')](_0x10222f);}})[_0x3ae0('0x27')](function(_0x5c83b9){if(_0x5c83b9){_0x1e3d60=_0x5c83b9[_0x3ae0('0x39')];if(!_0x164f49[_0x3ae0('0x34')][_0x3ae0('0x3a')]('nolimit')){_0x10222f[_0x3ae0('0x22')]=qs[_0x3ae0('0x22')](_0x164f49['query'][_0x3ae0('0x22')]);_0x10222f[_0x3ae0('0x21')]=qs[_0x3ae0('0x21')](_0x164f49[_0x3ae0('0x34')][_0x3ae0('0x21')]);}return _0x3a80b0[_0x3ae0('0x75')](_0x10222f);}})['then'](function(_0x41322e){if(_0x41322e){return _0x41322e?{'count':_0x1e3d60,'rows':_0x41322e}:null;}})[_0x3ae0('0x27')](respondWithResult(_0x2bc5eb,null))['catch'](handleError(_0x2bc5eb,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 111b774..1914fe4 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 _0x7218=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x8edf84,_0x416b35){var _0x2fc32c=function(_0x4b62dc){while(--_0x4b62dc){_0x8edf84['push'](_0x8edf84['shift']());}};_0x2fc32c(++_0x416b35);}(_0x7218,0x14f));var _0x8721=function(_0x555201,_0x4e7d9e){_0x555201=_0x555201-0x0;var _0x359681=_0x7218[_0x555201];return _0x359681;};'use strict';var EventEmitter=require(_0x8721('0x0'));var Dashboard=require(_0x8721('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8721('0x2')](0x0);var events={'afterCreate':_0x8721('0x3'),'afterUpdate':_0x8721('0x4'),'afterDestroy':_0x8721('0x5')};function emitEvent(_0x37dd05){return function(_0x361c4d,_0x278fc6,_0x5b82a0){DashboardEvents['emit'](_0x37dd05+':'+_0x361c4d['id'],_0x361c4d);DashboardEvents[_0x8721('0x6')](_0x37dd05,_0x361c4d);_0x5b82a0(null);};}for(var e in events){if(events[_0x8721('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x8721('0x8')]=DashboardEvents; \ No newline at end of file +var _0x3238=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x38f6ee,_0xf06a6c){var _0x49aeef=function(_0x1f1262){while(--_0x1f1262){_0x38f6ee['push'](_0x38f6ee['shift']());}};_0x49aeef(++_0xf06a6c);}(_0x3238,0x1d2));var _0x8323=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3238[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x8323('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8323('0x1')](0x0);var events={'afterCreate':_0x8323('0x2'),'afterUpdate':_0x8323('0x3'),'afterDestroy':_0x8323('0x4')};function emitEvent(_0xc74f47){return function(_0x24571c,_0x19bdbb,_0x591e74){DashboardEvents[_0x8323('0x5')](_0xc74f47+':'+_0x24571c['id'],_0x24571c);DashboardEvents[_0x8323('0x5')](_0xc74f47,_0x24571c);_0x591e74(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x8323('0x6')](e,emitEvent(event));}}module[_0x8323('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 1b9e577..cf6d238 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 _0x2304=['exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x4f3409,_0x47f818){var _0x39383c=function(_0x3fdf6b){while(--_0x3fdf6b){_0x4f3409['push'](_0x4f3409['shift']());}};_0x39383c(++_0x47f818);}(_0x2304,0xe1));var _0x4230=function(_0x2523ca,_0xd01aec){_0x2523ca=_0x2523ca-0x0;var _0x478dd7=_0x2304[_0x2523ca];return _0x478dd7;};'use strict';var _=require(_0x4230('0x0'));var util=require(_0x4230('0x1'));var logger=require(_0x4230('0x2'))(_0x4230('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4230('0x4'));var fs=require('fs');var path=require(_0x4230('0x5'));var rimraf=require(_0x4230('0x6'));var config=require(_0x4230('0x7'));var attributes=require(_0x4230('0x8'));module[_0x4230('0x9')]=function(_0x517636,_0x50bba2){return _0x517636[_0x4230('0xa')](_0x4230('0xb'),attributes,{'tableName':_0x4230('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1316=['./dashboard.attributes','exports','define','Dashboard','dashboards','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5c71ab,_0x3cf515){var _0x21f970=function(_0x4e8a9c){while(--_0x4e8a9c){_0x5c71ab['push'](_0x5c71ab['shift']());}};_0x21f970(++_0x3cf515);}(_0x1316,0x89));var _0x6131=function(_0x32eed6,_0x202b37){_0x32eed6=_0x32eed6-0x0;var _0x3fe691=_0x1316[_0x32eed6];return _0x3fe691;};'use strict';var _=require('lodash');var util=require(_0x6131('0x0'));var logger=require(_0x6131('0x1'))('api');var moment=require(_0x6131('0x2'));var BPromise=require('bluebird');var rp=require(_0x6131('0x3'));var fs=require('fs');var path=require(_0x6131('0x4'));var rimraf=require(_0x6131('0x5'));var config=require(_0x6131('0x6'));var attributes=require(_0x6131('0x7'));module[_0x6131('0x8')]=function(_0x3b2ef4,_0x533c4e){return _0x3b2ef4[_0x6131('0x9')](_0x6131('0xa'),attributes,{'tableName':_0x6131('0xb'),'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 346d35c..cd5425e 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 _0x345e=['http','redis','localhost','socket.io-emitter','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x28be72,_0x2b83af){var _0x46c5da=function(_0x312911){while(--_0x312911){_0x28be72['push'](_0x28be72['shift']());}};_0x46c5da(++_0x2b83af);}(_0x345e,0x12e));var _0xe345=function(_0x2e92c2,_0x381855){_0x2e92c2=_0x2e92c2-0x0;var _0x37105f=_0x345e[_0x2e92c2];return _0x37105f;};'use strict';var _=require(_0xe345('0x0'));var util=require(_0xe345('0x1'));var moment=require(_0xe345('0x2'));var BPromise=require(_0xe345('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe345('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe345('0x5'))(_0xe345('0x6'));var config=require(_0xe345('0x7'));var jayson=require(_0xe345('0x8'));var client=jayson[_0xe345('0x9')][_0xe345('0xa')]({'port':0x232a});config[_0xe345('0xb')]=_['defaults'](config['redis'],{'host':_0xe345('0xc'),'port':0x18eb});var socket=require(_0xe345('0xd'))(new Redis(config[_0xe345('0xb')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x24f463,_0x12ef58,_0x5b2526){return new BPromise(function(_0x438411,_0x4a59ee){return client[_0xe345('0xe')](_0x24f463,_0x5b2526)[_0xe345('0xf')](function(_0x2e0fc5){logger[_0xe345('0x10')](_0xe345('0x11'),_0x12ef58,_0xe345('0x12'));logger[_0xe345('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x12ef58,_0xe345('0x12'),JSON[_0xe345('0x14')](_0x2e0fc5));if(_0x2e0fc5['error']){if(_0x2e0fc5[_0xe345('0x15')][_0xe345('0x16')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x12ef58,_0x2e0fc5[_0xe345('0x15')]['message']);return _0x4a59ee(_0x2e0fc5[_0xe345('0x15')]['message']);}logger[_0xe345('0x15')](_0xe345('0x11'),_0x12ef58,_0x2e0fc5[_0xe345('0x15')][_0xe345('0x17')]);return _0x438411(_0x2e0fc5[_0xe345('0x15')]['message']);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x12ef58,_0xe345('0x12'));_0x438411(_0x2e0fc5[_0xe345('0x18')][_0xe345('0x17')]);}})[_0xe345('0x19')](function(_0x3485b0){logger['error'](_0xe345('0x11'),_0x12ef58,_0x3485b0);_0x4a59ee(_0x3485b0);});});} \ No newline at end of file +var _0xdcd6=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','../../mysqldb'];(function(_0x5aedc6,_0x3c6ff7){var _0x3b1261=function(_0x39af11){while(--_0x39af11){_0x5aedc6['push'](_0x5aedc6['shift']());}};_0x3b1261(++_0x3c6ff7);}(_0xdcd6,0x92));var _0x6dcd=function(_0x21ee11,_0x172225){_0x21ee11=_0x21ee11-0x0;var _0xb4c64e=_0xdcd6[_0x21ee11];return _0xb4c64e;};'use strict';var _=require(_0x6dcd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6dcd('0x1'));var rs=require(_0x6dcd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6dcd('0x3'))['db'];var utils=require(_0x6dcd('0x4'));var logger=require(_0x6dcd('0x5'))(_0x6dcd('0x6'));var config=require(_0x6dcd('0x7'));var jayson=require(_0x6dcd('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x6dcd('0x9')]=_['defaults'](config['redis'],{'host':_0x6dcd('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6dcd('0x9')]));require(_0x6dcd('0xb'))[_0x6dcd('0xc')](socket);function respondWithRpcPromise(_0x580840,_0x14bb01,_0x2c5a07){return new BPromise(function(_0x455eb7,_0x623b98){return client[_0x6dcd('0xd')](_0x580840,_0x2c5a07)[_0x6dcd('0xe')](function(_0x3a70f3){logger[_0x6dcd('0xf')](_0x6dcd('0x10'),_0x14bb01,_0x6dcd('0x11'));logger[_0x6dcd('0x12')](_0x6dcd('0x13'),_0x14bb01,_0x6dcd('0x11'),JSON[_0x6dcd('0x14')](_0x3a70f3));if(_0x3a70f3[_0x6dcd('0x15')]){if(_0x3a70f3['error']['code']===0x1f4){logger[_0x6dcd('0x15')]('Dashboard,\x20%s,\x20%s',_0x14bb01,_0x3a70f3[_0x6dcd('0x15')][_0x6dcd('0x16')]);return _0x623b98(_0x3a70f3['error']['message']);}logger[_0x6dcd('0x15')](_0x6dcd('0x10'),_0x14bb01,_0x3a70f3[_0x6dcd('0x15')]['message']);return _0x455eb7(_0x3a70f3[_0x6dcd('0x15')][_0x6dcd('0x16')]);}else{logger[_0x6dcd('0xf')]('Dashboard,\x20%s,\x20%s',_0x14bb01,_0x6dcd('0x11'));_0x455eb7(_0x3a70f3[_0x6dcd('0x17')][_0x6dcd('0x16')]);}})[_0x6dcd('0x18')](function(_0x1d9af7){logger[_0x6dcd('0x15')](_0x6dcd('0x10'),_0x14bb01,_0x1d9af7);_0x623b98(_0x1d9af7);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 63e674e..d84366d 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 _0x0d69=['emit','removeListener','length','dashboard:','./dashboard.events','update'];(function(_0x37d8ae,_0x17e484){var _0x4de500=function(_0x538a36){while(--_0x538a36){_0x37d8ae['push'](_0x37d8ae['shift']());}};_0x4de500(++_0x17e484);}(_0x0d69,0x1c6));var _0x90d6=function(_0x1d2ec9,_0x4228ee){_0x1d2ec9=_0x1d2ec9-0x0;var _0x38345d=_0x0d69[_0x1d2ec9];return _0x38345d;};'use strict';var DashboardEvents=require(_0x90d6('0x0'));var events=['save','remove',_0x90d6('0x1')];function createListener(_0x3ef486,_0x48a1fe){return function(_0x29ec0c){_0x48a1fe[_0x90d6('0x2')](_0x3ef486,_0x29ec0c);};}function removeListener(_0x5aadff,_0x390a23){return function(){DashboardEvents[_0x90d6('0x3')](_0x5aadff,_0x390a23);};}exports['register']=function(_0x4d22cf){for(var _0x1c6409=0x0,_0x297d4d=events[_0x90d6('0x4')];_0x1c6409<_0x297d4d;_0x1c6409++){var _0x3c5dea=events[_0x1c6409];var _0x4e27c5=createListener(_0x90d6('0x5')+_0x3c5dea,_0x4d22cf);DashboardEvents['on'](_0x3c5dea,_0x4e27c5);}}; \ No newline at end of file +var _0xf6b1=['save','emit','removeListener','register','length','dashboard:','./dashboard.events'];(function(_0x2bddf9,_0x22c873){var _0x3f3ae9=function(_0x2d91ac){while(--_0x2d91ac){_0x2bddf9['push'](_0x2bddf9['shift']());}};_0x3f3ae9(++_0x22c873);}(_0xf6b1,0x16b));var _0x1f6b=function(_0x2176db,_0x296abb){_0x2176db=_0x2176db-0x0;var _0x1c75ef=_0xf6b1[_0x2176db];return _0x1c75ef;};'use strict';var DashboardEvents=require(_0x1f6b('0x0'));var events=[_0x1f6b('0x1'),'remove','update'];function createListener(_0x2e16ae,_0x1dcd38){return function(_0x4618e7){_0x1dcd38[_0x1f6b('0x2')](_0x2e16ae,_0x4618e7);};}function removeListener(_0x3c1008,_0x469884){return function(){DashboardEvents[_0x1f6b('0x3')](_0x3c1008,_0x469884);};}exports[_0x1f6b('0x4')]=function(_0x3df977){for(var _0x292aa1=0x0,_0x5b0aa4=events[_0x1f6b('0x5')];_0x292aa1<_0x5b0aa4;_0x292aa1++){var _0x3f0740=events[_0x292aa1];var _0x51e80d=createListener(_0x1f6b('0x6')+_0x3f0740,_0x3df977);DashboardEvents['on'](_0x3f0740,_0x51e80d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index b382e71..b793232 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 _0xb7e7=['addItem','put','update','delete','multer','path','express','../../components/auth/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x1196b0,_0x36c47a){var _0x111c52=function(_0x5604c7){while(--_0x5604c7){_0x1196b0['push'](_0x1196b0['shift']());}};_0x111c52(++_0x36c47a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xb7e7[_0x5f0089];return _0x193892;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['post'](_0x7b7e('0xd'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xe')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0x7'),auth['isAuthenticated'](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/:id',auth[_0x7b7e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa9e0=['/:id','/:id/items','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0x47414a,_0x5b9e20){var _0x3a879b=function(_0xde7fee){while(--_0xde7fee){_0x47414a['push'](_0x47414a['shift']());}};_0x3a879b(++_0x5b9e20);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getItems']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xb')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['clone']);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index cd0927c..bde64b4 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 _0x6e12=['#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff'];(function(_0x22773a,_0x585053){var _0x210bf0=function(_0x32e91b){while(--_0x32e91b){_0x22773a['push'](_0x22773a['shift']());}};_0x210bf0(++_0x585053);}(_0x6e12,0x10b));var _0x26e1=function(_0x5442a,_0x58be09){_0x5442a=_0x5442a-0x0;var _0x10b231=_0x6e12[_0x5442a];return _0x10b231;};'use strict';var Sequelize=require(_0x26e1('0x0'));var squel=require(_0x26e1('0x1'));var _=require(_0x26e1('0x2'));module[_0x26e1('0x3')]={'title':{'type':Sequelize[_0x26e1('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x26e1('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x26e1('0x5')]('long'),'get':function(){try{return JSON[_0x26e1('0x6')](this[_0x26e1('0x7')](_0x26e1('0x8')));}catch(_0x3848a6){return[];}},'set':function(_0x1e97f1){try{this['setDataValue'](_0x26e1('0x8'),JSON[_0x26e1('0x9')](_0x1e97f1));}catch(_0x4e7558){this[_0x26e1('0xa')](_0x26e1('0x8'),JSON[_0x26e1('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x26e1('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x26e1('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x26e1('0xb')]},'col':{'type':Sequelize[_0x26e1('0xb')]},'background':{'type':Sequelize[_0x26e1('0x4')],'allowNull':![],'defaultValue':_0x26e1('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x26e1('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd507=['attrs','INTEGER','#ffffff','#2196f3','sequelize','lodash','STRING','TEXT','parse','getDataValue','setDataValue','stringify'];(function(_0x512f81,_0x4a7986){var _0xa15099=function(_0x1f7371){while(--_0x1f7371){_0x512f81['push'](_0x512f81['shift']());}};_0xa15099(++_0x4a7986);}(_0xd507,0x1d8));var _0x7d50=function(_0x5e86a8,_0x4fe508){_0x5e86a8=_0x5e86a8-0x0;var _0x4785a1=_0xd507[_0x5e86a8];return _0x4785a1;};'use strict';var Sequelize=require(_0x7d50('0x0'));var squel=require('squel');var _=require(_0x7d50('0x1'));module['exports']={'title':{'type':Sequelize[_0x7d50('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7d50('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7d50('0x3')]('long'),'get':function(){try{return JSON[_0x7d50('0x4')](this[_0x7d50('0x5')]('attrs'));}catch(_0x5cb262){return[];}},'set':function(_0x5074a1){try{this[_0x7d50('0x6')]('attrs',JSON[_0x7d50('0x7')](_0x5074a1));}catch(_0x26691a){this[_0x7d50('0x6')](_0x7d50('0x8'),JSON[_0x7d50('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x7d50('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7d50('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x7d50('0x9')]},'background':{'type':Sequelize[_0x7d50('0x2')],'allowNull':![],'defaultValue':_0x7d50('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7d50('0x2')],'allowNull':![],'defaultValue':_0x7d50('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7d50('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 735818e..19e2128 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 _0x29f8=['./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','show','params','DashboardItem','query','keys','filters','intersection','model','fields','attributes','length','include','merge','options','catch','find','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','create','body','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x29f8,0x140));var _0x829f=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x29f8[_0x47a7d0];return _0xb9bd08;};'use strict';var pdf=require(_0x829f('0x0'));var emlformat=require(_0x829f('0x1'));var rimraf=require(_0x829f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x829f('0x3'));var BPromise=require(_0x829f('0x4'));var Mustache=require(_0x829f('0x5'));var util=require(_0x829f('0x6'));var path=require('path');var sox=require(_0x829f('0x7'));var csv=require(_0x829f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x829f('0x9'));var crypto=require(_0x829f('0xa'));var jsforce=require(_0x829f('0xb'));var deskjs=require(_0x829f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x829f('0xd'));var Papa=require('papaparse');var Redis=require(_0x829f('0xe'));var authService=require(_0x829f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x829f('0x10'))(_0x829f('0x11'));var utils=require('../../config/utils');var config=require(_0x829f('0x12'));var licenseUtil=require(_0x829f('0x13'));var db=require('../../mysqldb')['db'];config[_0x829f('0x14')]=_[_0x829f('0x15')](config[_0x829f('0x14')],{'host':_0x829f('0x16'),'port':0x18eb});var socket=require(_0x829f('0x17'))(new Redis(config[_0x829f('0x14')]));require(_0x829f('0x18'))[_0x829f('0x19')](socket);function respondWithStatusCode(_0x2509d8,_0x58cb57){_0x58cb57=_0x58cb57||0xcc;return function(_0x3a910c){if(_0x3a910c){return _0x2509d8[_0x829f('0x1a')](_0x58cb57);}return _0x2509d8[_0x829f('0x1b')](_0x58cb57)[_0x829f('0x1c')]();};}function respondWithResult(_0xe84373,_0x3f39e0){_0x3f39e0=_0x3f39e0||0xc8;return function(_0x3f3ab5){if(_0x3f3ab5){return _0xe84373[_0x829f('0x1b')](_0x3f39e0)[_0x829f('0x1d')](_0x3f3ab5);}};}function respondWithFilteredResult(_0x26385e,_0x2d1caa){return function(_0xa26225){if(_0xa26225){var _0x477ca1=_0xa26225['count'],_0x396aa4=_0x2d1caa['offset'],_0x2f3486=_0x2d1caa[_0x829f('0x1e')]+_0x2d1caa[_0x829f('0x1f')],_0x5e2710;if(_0x2f3486>=_0x477ca1){_0x2f3486=_0x477ca1;_0x5e2710=0xc8;}else{_0x5e2710=0xce;}_0x26385e['status'](_0x5e2710);return _0x26385e[_0x829f('0x20')](_0x829f('0x21'),_0x396aa4+'-'+_0x2f3486+'/'+_0x477ca1)[_0x829f('0x1d')](_0xa26225);}return null;};}function patchUpdates(_0x26b430){return function(_0x48dd96){try{jsonpatch[_0x829f('0x22')](_0x48dd96,_0x26b430,!![]);}catch(_0x217786){return BPromise[_0x829f('0x23')](_0x217786);}return _0x48dd96[_0x829f('0x24')]();};}function saveUpdates(_0x17d4d0,_0xd429a0){return function(_0x2eb913){if(_0x2eb913){return _0x2eb913[_0x829f('0x25')](_0x17d4d0)[_0x829f('0x26')](function(_0x5cb36a){return _0x5cb36a;});}return null;};}function removeEntity(_0x134c71,_0x3310b3){return function(_0x11d976){if(_0x11d976){return _0x11d976[_0x829f('0x27')]()[_0x829f('0x26')](function(){_0x134c71[_0x829f('0x1b')](0xcc)[_0x829f('0x1c')]();});}};}function handleEntityNotFound(_0x107b0c,_0x30d79f){return function(_0x4a1995){if(!_0x4a1995){_0x107b0c[_0x829f('0x1a')](0x194);}return _0x4a1995;};}function handleError(_0xee9e41,_0x584b48){_0x584b48=_0x584b48||0x1f4;return function(_0x3dc39c){logger[_0x829f('0x28')](_0x3dc39c['stack']);if(_0x3dc39c[_0x829f('0x29')]){delete _0x3dc39c[_0x829f('0x29')];}_0xee9e41['status'](_0x584b48)[_0x829f('0x2a')](_0x3dc39c);};}exports[_0x829f('0x2b')]=function(_0x224241,_0x54bf45){var _0x510342={'raw':![],'where':{'id':_0x224241[_0x829f('0x2c')]['id']}},_0x5b032a={};_0x5b032a['model']=_['keys'](db[_0x829f('0x2d')]['rawAttributes']);_0x5b032a[_0x829f('0x2e')]=_[_0x829f('0x2f')](_0x224241['query']);_0x5b032a[_0x829f('0x30')]=_[_0x829f('0x31')](_0x5b032a[_0x829f('0x32')],_0x5b032a['query']);_0x510342['attributes']=_[_0x829f('0x31')](_0x5b032a[_0x829f('0x32')],qs[_0x829f('0x33')](_0x224241['query']['fields']));_0x510342['attributes']=_0x510342[_0x829f('0x34')][_0x829f('0x35')]?_0x510342[_0x829f('0x34')]:_0x5b032a[_0x829f('0x32')];if(_0x224241[_0x829f('0x2e')]['includeAll']){_0x510342[_0x829f('0x36')]=[{'all':!![]}];}_0x510342=_[_0x829f('0x37')]({},_0x510342,_0x224241[_0x829f('0x38')]);return db['DashboardItem']['find'](_0x510342)['then'](handleEntityNotFound(_0x54bf45,null))[_0x829f('0x26')](respondWithResult(_0x54bf45,null))[_0x829f('0x39')](handleError(_0x54bf45,null));};exports['destroy']=function(_0x44fc84,_0x3c3b5a){return db['DashboardItem'][_0x829f('0x3a')]({'where':{'id':_0x44fc84[_0x829f('0x2c')]['id']}})[_0x829f('0x26')](handleEntityNotFound(_0x3c3b5a,null))[_0x829f('0x26')](removeEntity(_0x3c3b5a,null))['catch'](handleError(_0x3c3b5a,null));};function widgetAttributes(_0x5a2298){try{switch(_0x5a2298[_0x829f('0x3b')]){case _0x829f('0x3c'):return[{'name':_0x829f('0x3d'),'value':_0x5a2298[_0x829f('0x3d')]||(_0x5a2298['attrs']&&_0x5a2298[_0x829f('0x3e')][0x0]?_0x5a2298['attrs'][0x0][_0x829f('0x3f')]:undefined)||'https://'}];case _0x829f('0x40'):return[{'name':_0x829f('0x41'),'value':_0x5a2298[_0x829f('0x41')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298[_0x829f('0x3e')][0x0]?_0x5a2298[_0x829f('0x3e')][0x0][_0x829f('0x3f')]:undefined)||''}];case _0x829f('0x42'):return[{'name':_0x829f('0x43'),'value':_0x5a2298['attrHourFormat']||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298[_0x829f('0x3e')][0x0]?_0x5a2298['attrs'][0x0]['value']:undefined)||_0x829f('0x44')},{'name':_0x829f('0x45'),'value':_0x5a2298['attrTimezone']||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298['attrs'][0x1]?_0x5a2298['attrs'][0x1][_0x829f('0x3f')]:undefined)||_0x829f('0x46')},{'name':_0x829f('0x47'),'value':_0x5a2298['attrFontSize']||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298[_0x829f('0x3e')][0x2]?_0x5a2298[_0x829f('0x3e')][0x2][_0x829f('0x3f')]:undefined)||0xc}];case'counter':return[{'name':_0x829f('0x48'),'value':_0x5a2298[_0x829f('0x48')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298[_0x829f('0x3e')][0x0]?_0x5a2298[_0x829f('0x3e')][0x0][_0x829f('0x3f')]:undefined)||_0x829f('0x49')},{'name':_0x829f('0x4a'),'value':_0x5a2298['attrVoiceQueues']||(_0x5a2298['attrs']&&_0x5a2298[_0x829f('0x3e')][0x1]?_0x5a2298['attrs'][0x1][_0x829f('0x3f')]:undefined)||[]},{'name':_0x829f('0x47'),'value':_0x5a2298[_0x829f('0x47')]||(_0x5a2298['attrs']&&_0x5a2298['attrs'][0x2]?_0x5a2298[_0x829f('0x3e')][0x2][_0x829f('0x3f')]:undefined)||0x14}];case _0x829f('0x4b'):case _0x829f('0x4c'):return[{'name':_0x829f('0x4d'),'value':_0x5a2298[_0x829f('0x4d')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298['attrs'][0x0]?_0x5a2298[_0x829f('0x3e')][0x0][_0x829f('0x3f')]:undefined)||_0x829f('0x49')},{'name':_0x829f('0x4e'),'value':_0x5a2298[_0x829f('0x4e')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298['attrs'][0x1]?_0x5a2298[_0x829f('0x3e')][0x1][_0x829f('0x3f')]:undefined)||null},{'name':_0x829f('0x4f'),'value':_0x5a2298[_0x829f('0x4f')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298[_0x829f('0x3e')][0x2]?_0x5a2298[_0x829f('0x3e')][0x2][_0x829f('0x3f')]:undefined)||null},{'name':_0x829f('0x4a'),'value':_0x5a2298[_0x829f('0x4a')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298['attrs'][0x3]?_0x5a2298[_0x829f('0x3e')][0x3][_0x829f('0x3f')]:undefined)||[]}];case'web-report':return[{'name':_0x829f('0x50'),'type':_0x5a2298[_0x829f('0x51')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298['attrs'][0x0]?_0x5a2298[_0x829f('0x3e')][0x0][_0x829f('0x3b')]:undefined)||null,'value':_0x5a2298[_0x829f('0x50')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298[_0x829f('0x3e')][0x0]?_0x5a2298[_0x829f('0x3e')][0x0]['value']:undefined)||null},{'name':_0x829f('0x52'),'value':_0x5a2298[_0x829f('0x52')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298[_0x829f('0x3e')][0x1]?_0x5a2298[_0x829f('0x3e')][0x1][_0x829f('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x597c46){logger['error']('widgetAttributes:\x20%s',JSON[_0x829f('0x53')](_0x597c46));return[];}}exports[_0x829f('0x54')]=function(_0x3fcd4c,_0x4144d0){if(_0x3fcd4c[_0x829f('0x55')]){_0x3fcd4c['body']['attrs']=widgetAttributes(_0x3fcd4c[_0x829f('0x55')]);}return db[_0x829f('0x2d')]['create'](_0x3fcd4c['body'],{})[_0x829f('0x26')](respondWithResult(_0x4144d0,0xc9))[_0x829f('0x39')](handleError(_0x4144d0,null));};exports['update']=function(_0x348678,_0x573528){if(_0x348678[_0x829f('0x55')]['id']){delete _0x348678[_0x829f('0x55')]['id'];}_0x348678['body'][_0x829f('0x3e')]=widgetAttributes(_0x348678[_0x829f('0x55')]);return db['DashboardItem'][_0x829f('0x3a')]({'where':{'id':_0x348678[_0x829f('0x2c')]['id']}})[_0x829f('0x26')](handleEntityNotFound(_0x573528,null))[_0x829f('0x26')](saveUpdates(_0x348678[_0x829f('0x55')],null))[_0x829f('0x26')](respondWithResult(_0x573528,null))[_0x829f('0x39')](handleError(_0x573528,null));}; \ No newline at end of file +var _0xf248=['attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','html-pdf','rimraf','zip-dir','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/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','keys','query','filters','model','attributes','intersection','fields','length','includeAll','merge','options','DashboardItem','find','catch','destroy','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','total','attrVoiceQueues','multibar-chart','pie-chart'];(function(_0x420d85,_0xec6ca2){var _0x4f1ac6=function(_0x15abe9){while(--_0x15abe9){_0x420d85['push'](_0x420d85['shift']());}};_0x4f1ac6(++_0xec6ca2);}(_0xf248,0x65));var _0x8f24=function(_0x5b9685,_0x499016){_0x5b9685=_0x5b9685-0x0;var _0x3b4f3b=_0xf248[_0x5b9685];return _0x3b4f3b;};'use strict';var pdf=require(_0x8f24('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8f24('0x1'));var zipdir=require(_0x8f24('0x2'));var jsonpatch=require(_0x8f24('0x3'));var rp=require(_0x8f24('0x4'));var moment=require('moment');var BPromise=require(_0x8f24('0x5'));var Mustache=require('mustache');var util=require(_0x8f24('0x6'));var path=require(_0x8f24('0x7'));var sox=require(_0x8f24('0x8'));var csv=require(_0x8f24('0x9'));var ejs=require(_0x8f24('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8f24('0xb'));var crypto=require(_0x8f24('0xc'));var jsforce=require(_0x8f24('0xd'));var deskjs=require(_0x8f24('0xe'));var toCsv=require(_0x8f24('0x9'));var querystring=require(_0x8f24('0xf'));var Papa=require(_0x8f24('0x10'));var Redis=require(_0x8f24('0x11'));var authService=require(_0x8f24('0x12'));var qs=require(_0x8f24('0x13'));var as=require(_0x8f24('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8f24('0x15'));var config=require(_0x8f24('0x16'));var licenseUtil=require(_0x8f24('0x17'));var db=require(_0x8f24('0x18'))['db'];config['redis']=_[_0x8f24('0x19')](config[_0x8f24('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x8f24('0x1b'))(new Redis(config['redis']));require(_0x8f24('0x1c'))[_0x8f24('0x1d')](socket);function respondWithStatusCode(_0x1e2638,_0xf4dd57){_0xf4dd57=_0xf4dd57||0xcc;return function(_0x5ef5f0){if(_0x5ef5f0){return _0x1e2638[_0x8f24('0x1e')](_0xf4dd57);}return _0x1e2638[_0x8f24('0x1f')](_0xf4dd57)[_0x8f24('0x20')]();};}function respondWithResult(_0x280b55,_0x5f42ff){_0x5f42ff=_0x5f42ff||0xc8;return function(_0x3b0ccb){if(_0x3b0ccb){return _0x280b55[_0x8f24('0x1f')](_0x5f42ff)[_0x8f24('0x21')](_0x3b0ccb);}};}function respondWithFilteredResult(_0x58563c,_0x4e3400){return function(_0x3595dc){if(_0x3595dc){var _0x4ebfb4=_0x3595dc[_0x8f24('0x22')],_0x540d61=_0x4e3400['offset'],_0x12947b=_0x4e3400['offset']+_0x4e3400[_0x8f24('0x23')],_0x55d2d4;if(_0x12947b>=_0x4ebfb4){_0x12947b=_0x4ebfb4;_0x55d2d4=0xc8;}else{_0x55d2d4=0xce;}_0x58563c[_0x8f24('0x1f')](_0x55d2d4);return _0x58563c[_0x8f24('0x24')](_0x8f24('0x25'),_0x540d61+'-'+_0x12947b+'/'+_0x4ebfb4)[_0x8f24('0x21')](_0x3595dc);}return null;};}function patchUpdates(_0x5331fa){return function(_0xe3b2e3){try{jsonpatch[_0x8f24('0x26')](_0xe3b2e3,_0x5331fa,!![]);}catch(_0x45ad44){return BPromise[_0x8f24('0x27')](_0x45ad44);}return _0xe3b2e3[_0x8f24('0x28')]();};}function saveUpdates(_0x23eba3,_0x1c98ee){return function(_0x327098){if(_0x327098){return _0x327098[_0x8f24('0x29')](_0x23eba3)[_0x8f24('0x2a')](function(_0x1c35d1){return _0x1c35d1;});}return null;};}function removeEntity(_0x359929,_0x5b367a){return function(_0x3d4369){if(_0x3d4369){return _0x3d4369['destroy']()[_0x8f24('0x2a')](function(){_0x359929[_0x8f24('0x1f')](0xcc)[_0x8f24('0x20')]();});}};}function handleEntityNotFound(_0x39e19a,_0x5c9e63){return function(_0x3408f4){if(!_0x3408f4){_0x39e19a[_0x8f24('0x1e')](0x194);}return _0x3408f4;};}function handleError(_0x46116f,_0x12ca6){_0x12ca6=_0x12ca6||0x1f4;return function(_0x426d9b){logger[_0x8f24('0x2b')](_0x426d9b[_0x8f24('0x2c')]);if(_0x426d9b[_0x8f24('0x2d')]){delete _0x426d9b[_0x8f24('0x2d')];}_0x46116f[_0x8f24('0x1f')](_0x12ca6)[_0x8f24('0x2e')](_0x426d9b);};}exports[_0x8f24('0x2f')]=function(_0x122d91,_0x32b25f){var _0x1bb950={'raw':![],'where':{'id':_0x122d91[_0x8f24('0x30')]['id']}},_0x4a87b5={};_0x4a87b5['model']=_['keys'](db['DashboardItem']['rawAttributes']);_0x4a87b5['query']=_[_0x8f24('0x31')](_0x122d91[_0x8f24('0x32')]);_0x4a87b5[_0x8f24('0x33')]=_['intersection'](_0x4a87b5[_0x8f24('0x34')],_0x4a87b5[_0x8f24('0x32')]);_0x1bb950[_0x8f24('0x35')]=_[_0x8f24('0x36')](_0x4a87b5['model'],qs[_0x8f24('0x37')](_0x122d91['query'][_0x8f24('0x37')]));_0x1bb950[_0x8f24('0x35')]=_0x1bb950['attributes'][_0x8f24('0x38')]?_0x1bb950[_0x8f24('0x35')]:_0x4a87b5[_0x8f24('0x34')];if(_0x122d91[_0x8f24('0x32')][_0x8f24('0x39')]){_0x1bb950['include']=[{'all':!![]}];}_0x1bb950=_[_0x8f24('0x3a')]({},_0x1bb950,_0x122d91[_0x8f24('0x3b')]);return db[_0x8f24('0x3c')][_0x8f24('0x3d')](_0x1bb950)[_0x8f24('0x2a')](handleEntityNotFound(_0x32b25f,null))[_0x8f24('0x2a')](respondWithResult(_0x32b25f,null))[_0x8f24('0x3e')](handleError(_0x32b25f,null));};exports[_0x8f24('0x3f')]=function(_0x44f10e,_0x5ace50){return db['DashboardItem']['find']({'where':{'id':_0x44f10e[_0x8f24('0x30')]['id']}})[_0x8f24('0x2a')](handleEntityNotFound(_0x5ace50,null))['then'](removeEntity(_0x5ace50,null))[_0x8f24('0x3e')](handleError(_0x5ace50,null));};function widgetAttributes(_0x5ad65b){try{switch(_0x5ad65b[_0x8f24('0x40')]){case _0x8f24('0x41'):return[{'name':_0x8f24('0x42'),'value':_0x5ad65b[_0x8f24('0x42')]||(_0x5ad65b['attrs']&&_0x5ad65b[_0x8f24('0x43')][0x0]?_0x5ad65b['attrs'][0x0][_0x8f24('0x44')]:undefined)||_0x8f24('0x45')}];case'custom':return[{'name':'attrPath','value':_0x5ad65b[_0x8f24('0x46')]||(_0x5ad65b[_0x8f24('0x43')]&&_0x5ad65b[_0x8f24('0x43')][0x0]?_0x5ad65b[_0x8f24('0x43')][0x0][_0x8f24('0x44')]:undefined)||''}];case _0x8f24('0x47'):return[{'name':_0x8f24('0x48'),'value':_0x5ad65b[_0x8f24('0x48')]||(_0x5ad65b[_0x8f24('0x43')]&&_0x5ad65b[_0x8f24('0x43')][0x0]?_0x5ad65b[_0x8f24('0x43')][0x0][_0x8f24('0x44')]:undefined)||_0x8f24('0x49')},{'name':_0x8f24('0x4a'),'value':_0x5ad65b[_0x8f24('0x4a')]||(_0x5ad65b[_0x8f24('0x43')]&&_0x5ad65b[_0x8f24('0x43')][0x1]?_0x5ad65b[_0x8f24('0x43')][0x1]['value']:undefined)||_0x8f24('0x4b')},{'name':'attrFontSize','value':_0x5ad65b['attrFontSize']||(_0x5ad65b['attrs']&&_0x5ad65b[_0x8f24('0x43')][0x2]?_0x5ad65b[_0x8f24('0x43')][0x2][_0x8f24('0x44')]:undefined)||0xc}];case _0x8f24('0x4c'):return[{'name':'attrMetric','value':_0x5ad65b['attrMetric']||(_0x5ad65b[_0x8f24('0x43')]&&_0x5ad65b['attrs'][0x0]?_0x5ad65b[_0x8f24('0x43')][0x0]['value']:undefined)||_0x8f24('0x4d')},{'name':_0x8f24('0x4e'),'value':_0x5ad65b[_0x8f24('0x4e')]||(_0x5ad65b[_0x8f24('0x43')]&&_0x5ad65b[_0x8f24('0x43')][0x1]?_0x5ad65b['attrs'][0x1][_0x8f24('0x44')]:undefined)||[]},{'name':'attrFontSize','value':_0x5ad65b['attrFontSize']||(_0x5ad65b[_0x8f24('0x43')]&&_0x5ad65b[_0x8f24('0x43')][0x2]?_0x5ad65b[_0x8f24('0x43')][0x2][_0x8f24('0x44')]:undefined)||0x14}];case _0x8f24('0x4f'):case _0x8f24('0x50'):return[{'name':_0x8f24('0x51'),'value':_0x5ad65b[_0x8f24('0x51')]||(_0x5ad65b[_0x8f24('0x43')]&&_0x5ad65b[_0x8f24('0x43')][0x0]?_0x5ad65b[_0x8f24('0x43')][0x0][_0x8f24('0x44')]:undefined)||_0x8f24('0x4d')},{'name':_0x8f24('0x52'),'value':_0x5ad65b['attrSerie2']||(_0x5ad65b['attrs']&&_0x5ad65b['attrs'][0x1]?_0x5ad65b[_0x8f24('0x43')][0x1][_0x8f24('0x44')]:undefined)||null},{'name':_0x8f24('0x53'),'value':_0x5ad65b[_0x8f24('0x53')]||(_0x5ad65b[_0x8f24('0x43')]&&_0x5ad65b[_0x8f24('0x43')][0x2]?_0x5ad65b[_0x8f24('0x43')][0x2]['value']:undefined)||null},{'name':_0x8f24('0x4e'),'value':_0x5ad65b[_0x8f24('0x4e')]||(_0x5ad65b['attrs']&&_0x5ad65b[_0x8f24('0x43')][0x3]?_0x5ad65b[_0x8f24('0x43')][0x3]['value']:undefined)||[]}];case _0x8f24('0x54'):return[{'name':_0x8f24('0x55'),'type':_0x5ad65b[_0x8f24('0x56')]||(_0x5ad65b['attrs']&&_0x5ad65b[_0x8f24('0x43')][0x0]?_0x5ad65b[_0x8f24('0x43')][0x0][_0x8f24('0x40')]:undefined)||null,'value':_0x5ad65b[_0x8f24('0x55')]||(_0x5ad65b[_0x8f24('0x43')]&&_0x5ad65b['attrs'][0x0]?_0x5ad65b[_0x8f24('0x43')][0x0][_0x8f24('0x44')]:undefined)||null},{'name':_0x8f24('0x57'),'value':_0x5ad65b['attrRefresh']||(_0x5ad65b['attrs']&&_0x5ad65b['attrs'][0x1]?_0x5ad65b[_0x8f24('0x43')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4d29b7){logger[_0x8f24('0x2b')]('widgetAttributes:\x20%s',JSON[_0x8f24('0x58')](_0x4d29b7));return[];}}exports[_0x8f24('0x59')]=function(_0x49f6b0,_0xa66f7d){if(_0x49f6b0[_0x8f24('0x5a')]){_0x49f6b0['body']['attrs']=widgetAttributes(_0x49f6b0[_0x8f24('0x5a')]);}return db[_0x8f24('0x3c')][_0x8f24('0x59')](_0x49f6b0[_0x8f24('0x5a')],{})[_0x8f24('0x2a')](respondWithResult(_0xa66f7d,0xc9))[_0x8f24('0x3e')](handleError(_0xa66f7d,null));};exports['update']=function(_0x304923,_0x4c4433){if(_0x304923['body']['id']){delete _0x304923[_0x8f24('0x5a')]['id'];}_0x304923[_0x8f24('0x5a')][_0x8f24('0x43')]=widgetAttributes(_0x304923['body']);return db[_0x8f24('0x3c')][_0x8f24('0x3d')]({'where':{'id':_0x304923[_0x8f24('0x30')]['id']}})[_0x8f24('0x2a')](handleEntityNotFound(_0x4c4433,null))[_0x8f24('0x2a')](saveUpdates(_0x304923[_0x8f24('0x5a')],null))[_0x8f24('0x2a')](respondWithResult(_0x4c4433,null))[_0x8f24('0x3e')](handleError(_0x4c4433,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index eeba44b..3d45518 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 _0xaa2c=['exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0xaa2c,0x1a3));var _0xcaa2=function(_0x5a7e61,_0x1d66ae){_0x5a7e61=_0x5a7e61-0x0;var _0x5a7b41=_0xaa2c[_0x5a7e61];return _0x5a7b41;};'use strict';var EventEmitter=require(_0xcaa2('0x0'));var DashboardItem=require(_0xcaa2('0x1'))['db'][_0xcaa2('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xcaa2('0x3')](0x0);var events={'afterCreate':_0xcaa2('0x4'),'afterUpdate':_0xcaa2('0x5'),'afterDestroy':_0xcaa2('0x6')};function emitEvent(_0x2c1c0a){return function(_0x576982,_0x440e5c,_0x5a113c){DashboardItemEvents['emit'](_0x2c1c0a+':'+_0x576982['id'],_0x576982);DashboardItemEvents[_0xcaa2('0x7')](_0x2c1c0a,_0x576982);_0x5a113c(null);};}for(var e in events){if(events[_0xcaa2('0x8')](e)){var event=events[e];DashboardItem[_0xcaa2('0x9')](e,emitEvent(event));}}module[_0xcaa2('0xa')]=DashboardItemEvents; \ No newline at end of file +var _0x41ee=['events','../../mysqldb','DashboardItem','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x32839b,_0x426127){var _0x12fdb6=function(_0x51a893){while(--_0x51a893){_0x32839b['push'](_0x32839b['shift']());}};_0x12fdb6(++_0x426127);}(_0x41ee,0x117));var _0xe41e=function(_0x5e29c7,_0xc2f44e){_0x5e29c7=_0x5e29c7-0x0;var _0x5ba897=_0x41ee[_0x5e29c7];return _0x5ba897;};'use strict';var EventEmitter=require(_0xe41e('0x0'));var DashboardItem=require(_0xe41e('0x1'))['db'][_0xe41e('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe41e('0x3')](0x0);var events={'afterCreate':_0xe41e('0x4'),'afterUpdate':_0xe41e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2477ea){return function(_0x433b3d,_0x34ba58,_0x208ec9){DashboardItemEvents[_0xe41e('0x6')](_0x2477ea+':'+_0x433b3d['id'],_0x433b3d);DashboardItemEvents['emit'](_0x2477ea,_0x433b3d);_0x208ec9(null);};}for(var e in events){if(events[_0xe41e('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xe41e('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 8cbae75..c43677c 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 _0xec43=['DashboardItem','dashboard_items','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','define'];(function(_0x2630b8,_0x31bc27){var _0x1e222c=function(_0x28102f){while(--_0x28102f){_0x2630b8['push'](_0x2630b8['shift']());}};_0x1e222c(++_0x31bc27);}(_0xec43,0xc2));var _0x3ec4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xec43[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x3ec4('0x0'));var logger=require(_0x3ec4('0x1'))(_0x3ec4('0x2'));var moment=require('moment');var BPromise=require(_0x3ec4('0x3'));var rp=require(_0x3ec4('0x4'));var fs=require('fs');var path=require(_0x3ec4('0x5'));var rimraf=require(_0x3ec4('0x6'));var config=require('../../config/environment');var attributes=require(_0x3ec4('0x7'));module[_0x3ec4('0x8')]=function(_0x32ec9d,_0x548daa){return _0x32ec9d[_0x3ec4('0x9')](_0x3ec4('0xa'),attributes,{'tableName':_0x3ec4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe191=['../../config/environment','./dashboardItem.attributes','exports','dashboard_items','lodash','util','api','bluebird','rimraf'];(function(_0x8858b8,_0x260f71){var _0x15a8c3=function(_0x312523){while(--_0x312523){_0x8858b8['push'](_0x8858b8['shift']());}};_0x15a8c3(++_0x260f71);}(_0xe191,0x82));var _0x1e19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe191[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1e19('0x0'));var util=require(_0x1e19('0x1'));var logger=require('../../config/logger')(_0x1e19('0x2'));var moment=require('moment');var BPromise=require(_0x1e19('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1e19('0x4'));var config=require(_0x1e19('0x5'));var attributes=require(_0x1e19('0x6'));module[_0x1e19('0x7')]=function(_0x54aa29,_0x49109d){return _0x54aa29['define']('DashboardItem',attributes,{'tableName':_0x1e19('0x8'),'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 1b1f3fd..3a5b5c6 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 _0x4a25=['redis','socket.io-emitter','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','defaults'];(function(_0x5516c7,_0x3d46e4){var _0x314076=function(_0x3e3b38){while(--_0x3e3b38){_0x5516c7['push'](_0x5516c7['shift']());}};_0x314076(++_0x3d46e4);}(_0x4a25,0x1f3));var _0x54a2=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0x4a25[_0x52684f];return _0x4a55f0;};'use strict';var _=require(_0x54a2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x54a2('0x1'));var fs=require('fs');var Redis=require(_0x54a2('0x2'));var db=require(_0x54a2('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x54a2('0x4'));var config=require('../../config/environment');var jayson=require(_0x54a2('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x54a2('0x6')](config[_0x54a2('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x54a2('0x8'))(new Redis(config['redis']));require(_0x54a2('0x9'))[_0x54a2('0xa')](socket);function respondWithRpcPromise(_0x1f9428,_0x364d11,_0x15ccb4){return new BPromise(function(_0x119c9d,_0x48cda6){return client[_0x54a2('0xb')](_0x1f9428,_0x15ccb4)['then'](function(_0x1c9a2f){logger[_0x54a2('0xc')](_0x54a2('0xd'),_0x364d11,_0x54a2('0xe'));logger['debug'](_0x54a2('0xf'),_0x364d11,_0x54a2('0xe'),JSON[_0x54a2('0x10')](_0x1c9a2f));if(_0x1c9a2f[_0x54a2('0x11')]){if(_0x1c9a2f[_0x54a2('0x11')][_0x54a2('0x12')]===0x1f4){logger['error'](_0x54a2('0xd'),_0x364d11,_0x1c9a2f[_0x54a2('0x11')][_0x54a2('0x13')]);return _0x48cda6(_0x1c9a2f[_0x54a2('0x11')][_0x54a2('0x13')]);}logger['error'](_0x54a2('0xd'),_0x364d11,_0x1c9a2f[_0x54a2('0x11')]['message']);return _0x119c9d(_0x1c9a2f[_0x54a2('0x11')][_0x54a2('0x13')]);}else{logger[_0x54a2('0xc')](_0x54a2('0xd'),_0x364d11,_0x54a2('0xe'));_0x119c9d(_0x1c9a2f[_0x54a2('0x14')][_0x54a2('0x13')]);}})[_0x54a2('0x15')](function(_0x13c172){logger[_0x54a2('0x11')](_0x54a2('0xd'),_0x364d11,_0x13c172);_0x48cda6(_0x13c172);});});} \ No newline at end of file +var _0xf0b6=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent'];(function(_0x22123d,_0x113d87){var _0x45a117=function(_0x361182){while(--_0x361182){_0x22123d['push'](_0x22123d['shift']());}};_0x45a117(++_0x113d87);}(_0xf0b6,0x15d));var _0x6f0b=function(_0x25e913,_0x2c3e24){_0x25e913=_0x25e913-0x0;var _0x11fb09=_0xf0b6[_0x25e913];return _0x11fb09;};'use strict';var _=require(_0x6f0b('0x0'));var util=require(_0x6f0b('0x1'));var moment=require(_0x6f0b('0x2'));var BPromise=require(_0x6f0b('0x3'));var rs=require(_0x6f0b('0x4'));var fs=require('fs');var Redis=require(_0x6f0b('0x5'));var db=require(_0x6f0b('0x6'))['db'];var utils=require(_0x6f0b('0x7'));var logger=require(_0x6f0b('0x8'))(_0x6f0b('0x9'));var config=require(_0x6f0b('0xa'));var jayson=require(_0x6f0b('0xb'));var client=jayson['client'][_0x6f0b('0xc')]({'port':0x232a});config[_0x6f0b('0xd')]=_[_0x6f0b('0xe')](config[_0x6f0b('0xd')],{'host':_0x6f0b('0xf'),'port':0x18eb});var socket=require(_0x6f0b('0x10'))(new Redis(config[_0x6f0b('0xd')]));require('./dashboardItem.socket')[_0x6f0b('0x11')](socket);function respondWithRpcPromise(_0x1bb8bb,_0x2d70d8,_0x27444f){return new BPromise(function(_0x19076c,_0x26f734){return client[_0x6f0b('0x12')](_0x1bb8bb,_0x27444f)[_0x6f0b('0x13')](function(_0x132e39){logger[_0x6f0b('0x14')](_0x6f0b('0x15'),_0x2d70d8,_0x6f0b('0x16'));logger[_0x6f0b('0x17')](_0x6f0b('0x18'),_0x2d70d8,_0x6f0b('0x16'),JSON[_0x6f0b('0x19')](_0x132e39));if(_0x132e39[_0x6f0b('0x1a')]){if(_0x132e39['error'][_0x6f0b('0x1b')]===0x1f4){logger[_0x6f0b('0x1a')](_0x6f0b('0x15'),_0x2d70d8,_0x132e39[_0x6f0b('0x1a')][_0x6f0b('0x1c')]);return _0x26f734(_0x132e39[_0x6f0b('0x1a')][_0x6f0b('0x1c')]);}logger[_0x6f0b('0x1a')](_0x6f0b('0x15'),_0x2d70d8,_0x132e39[_0x6f0b('0x1a')][_0x6f0b('0x1c')]);return _0x19076c(_0x132e39[_0x6f0b('0x1a')][_0x6f0b('0x1c')]);}else{logger[_0x6f0b('0x14')](_0x6f0b('0x15'),_0x2d70d8,'request\x20sent');_0x19076c(_0x132e39[_0x6f0b('0x1d')][_0x6f0b('0x1c')]);}})[_0x6f0b('0x1e')](function(_0x94dc9){logger[_0x6f0b('0x1a')](_0x6f0b('0x15'),_0x2d70d8,_0x94dc9);_0x26f734(_0x94dc9);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index cc7b5c9..8421235 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 _0x47df=['length','./dashboardItem.events','remove','emit','removeListener','register'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x47df,0xfd));var _0xf47d=function(_0x572344,_0x42143d){_0x572344=_0x572344-0x0;var _0x2e71e6=_0x47df[_0x572344];return _0x2e71e6;};'use strict';var DashboardItemEvents=require(_0xf47d('0x0'));var events=['save',_0xf47d('0x1'),'update'];function createListener(_0x760380,_0x1414f3){return function(_0x1a78c7){_0x1414f3[_0xf47d('0x2')](_0x760380,_0x1a78c7);};}function removeListener(_0x199d2,_0x527334){return function(){DashboardItemEvents[_0xf47d('0x3')](_0x199d2,_0x527334);};}exports[_0xf47d('0x4')]=function(_0x23ec63){for(var _0x40da6c=0x0,_0x1a974a=events[_0xf47d('0x5')];_0x40da6c<_0x1a974a;_0x40da6c++){var _0x45af04=events[_0x40da6c];var _0xfa2264=createListener('dashboardItem:'+_0x45af04,_0x23ec63);DashboardItemEvents['on'](_0x45af04,_0xfa2264);}}; \ No newline at end of file +var _0xf43e=['register','dashboardItem:','update','emit'];(function(_0x360956,_0x5b007f){var _0x1f4d5a=function(_0x5e9c1e){while(--_0x5e9c1e){_0x360956['push'](_0x360956['shift']());}};_0x1f4d5a(++_0x5b007f);}(_0xf43e,0x11a));var _0xef43=function(_0x1f1e89,_0x1b054a){_0x1f1e89=_0x1f1e89-0x0;var _0x3e1c99=_0xf43e[_0x1f1e89];return _0x3e1c99;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save','remove',_0xef43('0x0')];function createListener(_0x181b19,_0x750c2){return function(_0x531005){_0x750c2[_0xef43('0x1')](_0x181b19,_0x531005);};}function removeListener(_0x1a419d,_0x37c638){return function(){DashboardItemEvents['removeListener'](_0x1a419d,_0x37c638);};}exports[_0xef43('0x2')]=function(_0x4d91e9){for(var _0x925fbe=0x0,_0x3eb9e9=events['length'];_0x925fbe<_0x3eb9e9;_0x925fbe++){var _0xf64d46=events[_0x925fbe];var _0x2a6b73=createListener(_0xef43('0x3')+_0xf64d46,_0x4d91e9);DashboardItemEvents['on'](_0xf64d46,_0x2a6b73);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1ae1415..446d0a5 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 _0x1cb9=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','path'];(function(_0x40669e,_0x50ffc4){var _0x4becf3=function(_0x4f7799){while(--_0x4f7799){_0x40669e['push'](_0x40669e['shift']());}};_0x4becf3(++_0x50ffc4);}(_0x1cb9,0x14e));var _0x91cb=function(_0x50b3de,_0x2adc80){_0x50b3de=_0x50b3de-0x0;var _0x299940=_0x1cb9[_0x50b3de];return _0x299940;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x91cb('0x5'));var config=require(_0x91cb('0x6'));var controller=require('./dashboardItem.controller');router[_0x91cb('0x7')](_0x91cb('0x8'),auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0xb')]('/',auth[_0x91cb('0x9')](),controller['create']);router[_0x91cb('0xc')]('/:id',auth[_0x91cb('0x9')](),controller['update']);router[_0x91cb('0xd')](_0x91cb('0x8'),auth[_0x91cb('0x9')](),controller[_0x91cb('0xe')]);module[_0x91cb('0xf')]=router; \ No newline at end of file +var _0x7fbe=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','exports','path'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0x7fbe[_0x18a436];return _0x5c2cf8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')](_0xe7fb('0x9'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0xc')]('/',auth[_0xe7fb('0xa')](),controller['create']);router[_0xe7fb('0xd')](_0xe7fb('0x9'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xe')]);router['delete']('/:id',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);module[_0xe7fb('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 f681422..5fcb64a 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 _0xd288=['third','ENUM','first','second'];(function(_0x3f9e9a,_0x251c42){var _0x171f3e=function(_0x2f423c){while(--_0x2f423c){_0x3f9e9a['push'](_0x3f9e9a['shift']());}};_0x171f3e(++_0x251c42);}(_0xd288,0xa1));var _0x8d28=function(_0x19c4b4,_0x496d39){_0x19c4b4=_0x19c4b4-0x0;var _0xd175bc=_0xd288[_0x19c4b4];return _0xd175bc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x8d28('0x0')](_0x8d28('0x1'),_0x8d28('0x2'),_0x8d28('0x3')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4490=['first','second','sequelize','exports','STRING'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x4490,0x1d8));var _0x0449=function(_0x2dd9e2,_0xb30745){_0x2dd9e2=_0x2dd9e2-0x0;var _0x5b86d5=_0x4490[_0x2dd9e2];return _0x5b86d5;};'use strict';var Sequelize=require(_0x0449('0x0'));module[_0x0449('0x1')]={'name':{'type':Sequelize[_0x0449('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x0449('0x3'),_0x0449('0x4'),'third'),'allowNull':![],'defaultValue':_0x0449('0x3')},'description':{'type':Sequelize[_0x0449('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index bd23216..2f92e98 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 _0xdab8=['error','stack','name','send','index','map','Disposition','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','Dispositions'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xdab8,0x126));var _0x8dab=function(_0x282429,_0x155c34){_0x282429=_0x282429-0x0;var _0x6784e0=_0xdab8[_0x282429];return _0x6784e0;};'use strict';var pdf=require(_0x8dab('0x0'));var emlformat=require(_0x8dab('0x1'));var rimraf=require(_0x8dab('0x2'));var zipdir=require(_0x8dab('0x3'));var jsonpatch=require(_0x8dab('0x4'));var rp=require('request-promise');var moment=require(_0x8dab('0x5'));var BPromise=require(_0x8dab('0x6'));var Mustache=require('mustache');var util=require(_0x8dab('0x7'));var path=require(_0x8dab('0x8'));var sox=require('sox');var csv=require(_0x8dab('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8dab('0xa'));var crypto=require(_0x8dab('0xb'));var jsforce=require(_0x8dab('0xc'));var deskjs=require(_0x8dab('0xd'));var toCsv=require(_0x8dab('0x9'));var querystring=require(_0x8dab('0xe'));var Papa=require('papaparse');var Redis=require(_0x8dab('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8dab('0x10'));var hardwareService=require(_0x8dab('0x11'));var logger=require(_0x8dab('0x12'))(_0x8dab('0x13'));var utils=require(_0x8dab('0x14'));var config=require(_0x8dab('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8dab('0x16'))['db'];function respondWithStatusCode(_0x155286,_0x2515dd){_0x2515dd=_0x2515dd||0xcc;return function(_0x10e471){if(_0x10e471){return _0x155286['sendStatus'](_0x2515dd);}return _0x155286['status'](_0x2515dd)[_0x8dab('0x17')]();};}function respondWithResult(_0x4eb86f,_0x586bc1){_0x586bc1=_0x586bc1||0xc8;return function(_0x3215cf){if(_0x3215cf){return _0x4eb86f[_0x8dab('0x18')](_0x586bc1)['json'](_0x3215cf);}};}function respondWithFilteredResult(_0x4167ca,_0x463ebd){return function(_0x15453d){if(_0x15453d){var _0xfc62a7=_0x15453d[_0x8dab('0x19')],_0x25ff72=_0x463ebd[_0x8dab('0x1a')],_0x3364af=_0x463ebd[_0x8dab('0x1a')]+_0x463ebd[_0x8dab('0x1b')],_0x26bfb7;if(_0x3364af>=_0xfc62a7){_0x3364af=_0xfc62a7;_0x26bfb7=0xc8;}else{_0x26bfb7=0xce;}_0x4167ca[_0x8dab('0x18')](_0x26bfb7);return _0x4167ca[_0x8dab('0x1c')](_0x8dab('0x1d'),_0x25ff72+'-'+_0x3364af+'/'+_0xfc62a7)[_0x8dab('0x1e')](_0x15453d);}return null;};}function patchUpdates(_0x3f8521){return function(_0x248e43){try{jsonpatch[_0x8dab('0x1f')](_0x248e43,_0x3f8521,!![]);}catch(_0x1234fb){return BPromise[_0x8dab('0x20')](_0x1234fb);}return _0x248e43[_0x8dab('0x21')]();};}function saveUpdates(_0x4b07cf,_0xc8695e){return function(_0x1a15c6){if(_0x1a15c6){return _0x1a15c6[_0x8dab('0x22')](_0x4b07cf)[_0x8dab('0x23')](function(_0x39f61b){return _0x39f61b;});}return null;};}function removeEntity(_0x584762,_0x1fde0d){return function(_0x2c71af){if(_0x2c71af){return _0x2c71af[_0x8dab('0x24')]()['then'](function(){var _0x418764=_0x2c71af['get']({'plain':!![]});var _0x7ff0ce=_0x8dab('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x7ff0ce,'resourceId':_0x418764['id']}})[_0x8dab('0x23')](function(){return _0x2c71af;});})['then'](function(){_0x584762[_0x8dab('0x18')](0xcc)[_0x8dab('0x17')]();});}};}function handleEntityNotFound(_0x11c5d3,_0x324cde){return function(_0x8db300){if(!_0x8db300){_0x11c5d3['sendStatus'](0x194);}return _0x8db300;};}function handleError(_0xc044e8,_0x2b0cea){_0x2b0cea=_0x2b0cea||0x1f4;return function(_0x5839ea){logger[_0x8dab('0x26')](_0x5839ea[_0x8dab('0x27')]);if(_0x5839ea[_0x8dab('0x28')]){delete _0x5839ea['name'];}_0xc044e8[_0x8dab('0x18')](_0x2b0cea)[_0x8dab('0x29')](_0x5839ea);};}exports[_0x8dab('0x2a')]=function(_0x355e54,_0x31c314){var _0x4c2ff4={},_0x2f90a9={},_0x1d9519={'count':0x0,'rows':[]};var _0x5ceaea=_[_0x8dab('0x2b')](db[_0x8dab('0x2c')][_0x8dab('0x2d')],function(_0x102b41){return{'name':_0x102b41['fieldName'],'type':_0x102b41[_0x8dab('0x2e')][_0x8dab('0x2f')]};});_0x2f90a9[_0x8dab('0x30')]=_[_0x8dab('0x2b')](_0x5ceaea,'name');_0x2f90a9['query']=_[_0x8dab('0x31')](_0x355e54['query']);_0x2f90a9[_0x8dab('0x32')]=_[_0x8dab('0x33')](_0x2f90a9['model'],_0x2f90a9[_0x8dab('0x34')]);_0x4c2ff4['attributes']=_['intersection'](_0x2f90a9[_0x8dab('0x30')],qs['fields'](_0x355e54[_0x8dab('0x34')][_0x8dab('0x35')]));_0x4c2ff4['attributes']=_0x4c2ff4[_0x8dab('0x36')][_0x8dab('0x37')]?_0x4c2ff4[_0x8dab('0x36')]:_0x2f90a9['model'];if(!_0x355e54[_0x8dab('0x34')][_0x8dab('0x38')](_0x8dab('0x39'))){_0x4c2ff4[_0x8dab('0x1b')]=qs['limit'](_0x355e54[_0x8dab('0x34')][_0x8dab('0x1b')]);_0x4c2ff4[_0x8dab('0x1a')]=qs[_0x8dab('0x1a')](_0x355e54[_0x8dab('0x34')][_0x8dab('0x1a')]);}_0x4c2ff4[_0x8dab('0x3a')]=qs[_0x8dab('0x3b')](_0x355e54['query'][_0x8dab('0x3b')]);_0x4c2ff4['where']=qs['filters'](_[_0x8dab('0x3c')](_0x355e54['query'],_0x2f90a9[_0x8dab('0x32')]),_0x5ceaea);if(_0x355e54['query'][_0x8dab('0x3d')]){_0x4c2ff4[_0x8dab('0x3e')]=_[_0x8dab('0x3f')](_0x4c2ff4[_0x8dab('0x3e')],{'$or':_[_0x8dab('0x2b')](_0x5ceaea,function(_0x2d7681){if(_0x2d7681[_0x8dab('0x2e')]!==_0x8dab('0x40')){var _0x4f74bd={};_0x4f74bd[_0x2d7681['name']]={'$like':'%'+_0x355e54['query'][_0x8dab('0x3d')]+'%'};return _0x4f74bd;}})});}_0x4c2ff4=_['merge']({},_0x4c2ff4,_0x355e54[_0x8dab('0x41')]);var _0x5d6f3f={'where':_0x4c2ff4[_0x8dab('0x3e')]};return db[_0x8dab('0x2c')]['count'](_0x5d6f3f)[_0x8dab('0x23')](function(_0x3aff6e){_0x1d9519[_0x8dab('0x19')]=_0x3aff6e;if(_0x355e54[_0x8dab('0x34')][_0x8dab('0x42')]){_0x4c2ff4[_0x8dab('0x43')]=[{'all':!![]}];}return db['Disposition'][_0x8dab('0x44')](_0x4c2ff4);})[_0x8dab('0x23')](function(_0x36d8c5){_0x1d9519[_0x8dab('0x45')]=_0x36d8c5;return _0x1d9519;})[_0x8dab('0x23')](respondWithFilteredResult(_0x31c314,_0x4c2ff4))[_0x8dab('0x46')](handleError(_0x31c314,null));};exports[_0x8dab('0x47')]=function(_0x3c2a7c,_0x184292){var _0x587a06={'raw':!![],'where':{'id':_0x3c2a7c['params']['id']}},_0xaaf629={};_0xaaf629[_0x8dab('0x30')]=_['keys'](db[_0x8dab('0x2c')][_0x8dab('0x2d')]);_0xaaf629[_0x8dab('0x34')]=_[_0x8dab('0x31')](_0x3c2a7c[_0x8dab('0x34')]);_0xaaf629['filters']=_[_0x8dab('0x33')](_0xaaf629['model'],_0xaaf629['query']);_0x587a06[_0x8dab('0x36')]=_[_0x8dab('0x33')](_0xaaf629[_0x8dab('0x30')],qs[_0x8dab('0x35')](_0x3c2a7c[_0x8dab('0x34')][_0x8dab('0x35')]));_0x587a06[_0x8dab('0x36')]=_0x587a06[_0x8dab('0x36')][_0x8dab('0x37')]?_0x587a06['attributes']:_0xaaf629[_0x8dab('0x30')];if(_0x3c2a7c[_0x8dab('0x34')]['includeAll']){_0x587a06['include']=[{'all':!![]}];}_0x587a06=_[_0x8dab('0x3f')]({},_0x587a06,_0x3c2a7c['options']);return db[_0x8dab('0x2c')][_0x8dab('0x48')](_0x587a06)[_0x8dab('0x23')](handleEntityNotFound(_0x184292,null))[_0x8dab('0x23')](respondWithResult(_0x184292,null))[_0x8dab('0x46')](handleError(_0x184292,null));};exports[_0x8dab('0x49')]=function(_0x208d40,_0x16d1ac){return db['Disposition'][_0x8dab('0x49')](_0x208d40[_0x8dab('0x4a')],{})[_0x8dab('0x23')](function(_0x5d98e0){var _0x177233=_0x208d40[_0x8dab('0x4b')][_0x8dab('0x4c')]({'plain':!![]});if(!_0x177233)throw new Error(_0x8dab('0x4d'));if(_0x177233['role']===_0x8dab('0x4b')){var _0x50724c=_0x5d98e0[_0x8dab('0x4c')]({'plain':!![]});var _0x430d8c=_0x8dab('0x25');return db['UserProfileSection'][_0x8dab('0x48')]({'where':{'name':_0x430d8c,'userProfileId':_0x177233[_0x8dab('0x4e')]},'raw':!![]})[_0x8dab('0x23')](function(_0x2af28a){if(_0x2af28a&&_0x2af28a[_0x8dab('0x4f')]===0x0){return db[_0x8dab('0x50')][_0x8dab('0x49')]({'name':_0x50724c['name'],'resourceId':_0x50724c['id'],'type':_0x2af28a[_0x8dab('0x28')],'sectionId':_0x2af28a['id']},{})[_0x8dab('0x23')](function(){return _0x5d98e0;});}else{return _0x5d98e0;}})[_0x8dab('0x46')](function(_0x5dadbe){logger[_0x8dab('0x26')](_0x8dab('0x51'),_0x5dadbe);throw _0x5dadbe;});}return _0x5d98e0;})[_0x8dab('0x23')](respondWithResult(_0x16d1ac,0xc9))[_0x8dab('0x46')](handleError(_0x16d1ac,null));};exports[_0x8dab('0x22')]=function(_0x139505,_0x4f0924){if(_0x139505[_0x8dab('0x4a')]['id']){delete _0x139505[_0x8dab('0x4a')]['id'];}return db[_0x8dab('0x2c')][_0x8dab('0x48')]({'where':{'id':_0x139505[_0x8dab('0x52')]['id']}})[_0x8dab('0x23')](handleEntityNotFound(_0x4f0924,null))['then'](saveUpdates(_0x139505[_0x8dab('0x4a')],null))[_0x8dab('0x23')](respondWithResult(_0x4f0924,null))[_0x8dab('0x46')](handleError(_0x4f0924,null));};exports['destroy']=function(_0x20145e,_0x5d62bb){return db['Disposition']['find']({'where':{'id':_0x20145e[_0x8dab('0x52')]['id']}})[_0x8dab('0x23')](handleEntityNotFound(_0x5d62bb,null))[_0x8dab('0x23')](removeEntity(_0x5d62bb,null))[_0x8dab('0x46')](handleError(_0x5d62bb,null));}; \ No newline at end of file +var _0xfb51=['length','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','params','rimraf','request-promise','moment','mustache','util','path','ejs','squel','crypto','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','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','end','sendStatus','stack','name','send','index','Disposition','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show'];(function(_0x2cc968,_0x57f0f4){var _0x45c10b=function(_0x4dfd2d){while(--_0x4dfd2d){_0x2cc968['push'](_0x2cc968['shift']());}};_0x45c10b(++_0x57f0f4);}(_0xfb51,0xff));var _0x1fb5=function(_0x306646,_0xdc2e1b){_0x306646=_0x306646-0x0;var _0x40bd8d=_0xfb51[_0x306646];return _0x40bd8d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1fb5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1fb5('0x1'));var moment=require(_0x1fb5('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1fb5('0x3'));var util=require(_0x1fb5('0x4'));var path=require(_0x1fb5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1fb5('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1fb5('0x7'));var crypto=require(_0x1fb5('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x1fb5('0x9'));var toCsv=require(_0x1fb5('0xa'));var querystring=require(_0x1fb5('0xb'));var Papa=require(_0x1fb5('0xc'));var Redis=require(_0x1fb5('0xd'));var authService=require(_0x1fb5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1fb5('0xf'));var hardwareService=require(_0x1fb5('0x10'));var logger=require(_0x1fb5('0x11'))(_0x1fb5('0x12'));var utils=require(_0x1fb5('0x13'));var config=require(_0x1fb5('0x14'));var licenseUtil=require(_0x1fb5('0x15'));var db=require(_0x1fb5('0x16'))['db'];function respondWithStatusCode(_0xe5a9f8,_0x3f5875){_0x3f5875=_0x3f5875||0xcc;return function(_0x30fe84){if(_0x30fe84){return _0xe5a9f8['sendStatus'](_0x3f5875);}return _0xe5a9f8[_0x1fb5('0x17')](_0x3f5875)['end']();};}function respondWithResult(_0x5860e0,_0x575e73){_0x575e73=_0x575e73||0xc8;return function(_0x12e512){if(_0x12e512){return _0x5860e0[_0x1fb5('0x17')](_0x575e73)[_0x1fb5('0x18')](_0x12e512);}};}function respondWithFilteredResult(_0x4fc4d3,_0x40c841){return function(_0x50d657){if(_0x50d657){var _0x19ac85=_0x50d657[_0x1fb5('0x19')],_0x35034c=_0x40c841[_0x1fb5('0x1a')],_0x286f2e=_0x40c841[_0x1fb5('0x1a')]+_0x40c841[_0x1fb5('0x1b')],_0x419f81;if(_0x286f2e>=_0x19ac85){_0x286f2e=_0x19ac85;_0x419f81=0xc8;}else{_0x419f81=0xce;}_0x4fc4d3[_0x1fb5('0x17')](_0x419f81);return _0x4fc4d3[_0x1fb5('0x1c')]('Content-Range',_0x35034c+'-'+_0x286f2e+'/'+_0x19ac85)[_0x1fb5('0x18')](_0x50d657);}return null;};}function patchUpdates(_0x26dfae){return function(_0x51e760){try{jsonpatch[_0x1fb5('0x1d')](_0x51e760,_0x26dfae,!![]);}catch(_0x3a37f0){return BPromise[_0x1fb5('0x1e')](_0x3a37f0);}return _0x51e760[_0x1fb5('0x1f')]();};}function saveUpdates(_0x2e9d5,_0x4f8424){return function(_0x2bea70){if(_0x2bea70){return _0x2bea70[_0x1fb5('0x20')](_0x2e9d5)[_0x1fb5('0x21')](function(_0x33e2be){return _0x33e2be;});}return null;};}function removeEntity(_0x54ef19,_0x3720aa){return function(_0x12226e){if(_0x12226e){return _0x12226e[_0x1fb5('0x22')]()[_0x1fb5('0x21')](function(){var _0x24c705=_0x12226e[_0x1fb5('0x23')]({'plain':!![]});var _0x4e8931=_0x1fb5('0x24');return db[_0x1fb5('0x25')][_0x1fb5('0x22')]({'where':{'type':_0x4e8931,'resourceId':_0x24c705['id']}})['then'](function(){return _0x12226e;});})['then'](function(){_0x54ef19['status'](0xcc)[_0x1fb5('0x26')]();});}};}function handleEntityNotFound(_0x2fb32e,_0x3dd5cc){return function(_0x1cb496){if(!_0x1cb496){_0x2fb32e[_0x1fb5('0x27')](0x194);}return _0x1cb496;};}function handleError(_0x46d519,_0x52c3e5){_0x52c3e5=_0x52c3e5||0x1f4;return function(_0x258f5d){logger['error'](_0x258f5d[_0x1fb5('0x28')]);if(_0x258f5d[_0x1fb5('0x29')]){delete _0x258f5d['name'];}_0x46d519[_0x1fb5('0x17')](_0x52c3e5)[_0x1fb5('0x2a')](_0x258f5d);};}exports[_0x1fb5('0x2b')]=function(_0x1aa292,_0x5ee03e){var _0x301386={},_0x2ad577={},_0x20bc88={'count':0x0,'rows':[]};var _0x3516b1=_['map'](db[_0x1fb5('0x2c')][_0x1fb5('0x2d')],function(_0x178769){return{'name':_0x178769['fieldName'],'type':_0x178769[_0x1fb5('0x2e')]['key']};});_0x2ad577[_0x1fb5('0x2f')]=_[_0x1fb5('0x30')](_0x3516b1,_0x1fb5('0x29'));_0x2ad577['query']=_[_0x1fb5('0x31')](_0x1aa292[_0x1fb5('0x32')]);_0x2ad577[_0x1fb5('0x33')]=_[_0x1fb5('0x34')](_0x2ad577[_0x1fb5('0x2f')],_0x2ad577[_0x1fb5('0x32')]);_0x301386[_0x1fb5('0x35')]=_['intersection'](_0x2ad577[_0x1fb5('0x2f')],qs[_0x1fb5('0x36')](_0x1aa292['query'][_0x1fb5('0x36')]));_0x301386['attributes']=_0x301386['attributes']['length']?_0x301386[_0x1fb5('0x35')]:_0x2ad577['model'];if(!_0x1aa292[_0x1fb5('0x32')][_0x1fb5('0x37')](_0x1fb5('0x38'))){_0x301386['limit']=qs[_0x1fb5('0x1b')](_0x1aa292['query'][_0x1fb5('0x1b')]);_0x301386[_0x1fb5('0x1a')]=qs['offset'](_0x1aa292['query'][_0x1fb5('0x1a')]);}_0x301386[_0x1fb5('0x39')]=qs[_0x1fb5('0x3a')](_0x1aa292[_0x1fb5('0x32')]['sort']);_0x301386[_0x1fb5('0x3b')]=qs[_0x1fb5('0x33')](_[_0x1fb5('0x3c')](_0x1aa292[_0x1fb5('0x32')],_0x2ad577[_0x1fb5('0x33')]),_0x3516b1);if(_0x1aa292[_0x1fb5('0x32')][_0x1fb5('0x3d')]){_0x301386[_0x1fb5('0x3b')]=_['merge'](_0x301386[_0x1fb5('0x3b')],{'$or':_[_0x1fb5('0x30')](_0x3516b1,function(_0x98c895){if(_0x98c895['type']!==_0x1fb5('0x3e')){var _0x320261={};_0x320261[_0x98c895[_0x1fb5('0x29')]]={'$like':'%'+_0x1aa292['query']['filter']+'%'};return _0x320261;}})});}_0x301386=_[_0x1fb5('0x3f')]({},_0x301386,_0x1aa292[_0x1fb5('0x40')]);var _0xdbe7ba={'where':_0x301386['where']};return db[_0x1fb5('0x2c')][_0x1fb5('0x19')](_0xdbe7ba)[_0x1fb5('0x21')](function(_0x1f3a35){_0x20bc88[_0x1fb5('0x19')]=_0x1f3a35;if(_0x1aa292['query'][_0x1fb5('0x41')]){_0x301386['include']=[{'all':!![]}];}return db[_0x1fb5('0x2c')][_0x1fb5('0x42')](_0x301386);})[_0x1fb5('0x21')](function(_0x4acf04){_0x20bc88[_0x1fb5('0x43')]=_0x4acf04;return _0x20bc88;})['then'](respondWithFilteredResult(_0x5ee03e,_0x301386))['catch'](handleError(_0x5ee03e,null));};exports[_0x1fb5('0x44')]=function(_0x22c3b8,_0x3adb1b){var _0x26f5ad={'raw':!![],'where':{'id':_0x22c3b8['params']['id']}},_0x284e49={};_0x284e49[_0x1fb5('0x2f')]=_[_0x1fb5('0x31')](db[_0x1fb5('0x2c')][_0x1fb5('0x2d')]);_0x284e49['query']=_[_0x1fb5('0x31')](_0x22c3b8['query']);_0x284e49[_0x1fb5('0x33')]=_[_0x1fb5('0x34')](_0x284e49['model'],_0x284e49[_0x1fb5('0x32')]);_0x26f5ad[_0x1fb5('0x35')]=_[_0x1fb5('0x34')](_0x284e49[_0x1fb5('0x2f')],qs['fields'](_0x22c3b8['query'][_0x1fb5('0x36')]));_0x26f5ad[_0x1fb5('0x35')]=_0x26f5ad[_0x1fb5('0x35')][_0x1fb5('0x45')]?_0x26f5ad[_0x1fb5('0x35')]:_0x284e49[_0x1fb5('0x2f')];if(_0x22c3b8['query'][_0x1fb5('0x41')]){_0x26f5ad[_0x1fb5('0x46')]=[{'all':!![]}];}_0x26f5ad=_[_0x1fb5('0x3f')]({},_0x26f5ad,_0x22c3b8[_0x1fb5('0x40')]);return db[_0x1fb5('0x2c')]['find'](_0x26f5ad)[_0x1fb5('0x21')](handleEntityNotFound(_0x3adb1b,null))[_0x1fb5('0x21')](respondWithResult(_0x3adb1b,null))[_0x1fb5('0x47')](handleError(_0x3adb1b,null));};exports['create']=function(_0x28590d,_0x4c54c3){return db[_0x1fb5('0x2c')][_0x1fb5('0x48')](_0x28590d[_0x1fb5('0x49')],{})[_0x1fb5('0x21')](function(_0xe4bb43){var _0xb7e106=_0x28590d[_0x1fb5('0x4a')][_0x1fb5('0x23')]({'plain':!![]});if(!_0xb7e106)throw new Error(_0x1fb5('0x4b'));if(_0xb7e106['role']==='user'){var _0x8b39e=_0xe4bb43['get']({'plain':!![]});var _0x292228='Dispositions';return db[_0x1fb5('0x4c')][_0x1fb5('0x4d')]({'where':{'name':_0x292228,'userProfileId':_0xb7e106[_0x1fb5('0x4e')]},'raw':!![]})['then'](function(_0x3e7773){if(_0x3e7773&&_0x3e7773[_0x1fb5('0x4f')]===0x0){return db[_0x1fb5('0x25')][_0x1fb5('0x48')]({'name':_0x8b39e['name'],'resourceId':_0x8b39e['id'],'type':_0x3e7773[_0x1fb5('0x29')],'sectionId':_0x3e7773['id']},{})[_0x1fb5('0x21')](function(){return _0xe4bb43;});}else{return _0xe4bb43;}})[_0x1fb5('0x47')](function(_0x235493){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x235493);throw _0x235493;});}return _0xe4bb43;})[_0x1fb5('0x21')](respondWithResult(_0x4c54c3,0xc9))[_0x1fb5('0x47')](handleError(_0x4c54c3,null));};exports[_0x1fb5('0x20')]=function(_0x28b52d,_0x16c614){if(_0x28b52d[_0x1fb5('0x49')]['id']){delete _0x28b52d[_0x1fb5('0x49')]['id'];}return db[_0x1fb5('0x2c')][_0x1fb5('0x4d')]({'where':{'id':_0x28b52d[_0x1fb5('0x50')]['id']}})[_0x1fb5('0x21')](handleEntityNotFound(_0x16c614,null))['then'](saveUpdates(_0x28b52d[_0x1fb5('0x49')],null))['then'](respondWithResult(_0x16c614,null))[_0x1fb5('0x47')](handleError(_0x16c614,null));};exports[_0x1fb5('0x22')]=function(_0x2e3972,_0x444a0d){return db['Disposition']['find']({'where':{'id':_0x2e3972[_0x1fb5('0x50')]['id']}})[_0x1fb5('0x21')](handleEntityNotFound(_0x444a0d,null))[_0x1fb5('0x21')](removeEntity(_0x444a0d,null))['catch'](handleError(_0x444a0d,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index f98e3f6..fb6b62a 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 _0xd43e=['bluebird','rimraf','../../config/environment','./disposition.attributes','exports','define','name','ListId','name_chat','ChatWebsiteId','MailAccountId','SmsAccountId','name_fax','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0xd43e,0x88));var _0xed43=function(_0x1edb0c,_0x58602b){_0x1edb0c=_0x1edb0c-0x0;var _0x4de44a=_0xd43e[_0x1edb0c];return _0x4de44a;};'use strict';var _=require(_0xed43('0x0'));var util=require('util');var logger=require(_0xed43('0x1'))(_0xed43('0x2'));var moment=require(_0xed43('0x3'));var BPromise=require(_0xed43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xed43('0x5'));var config=require(_0xed43('0x6'));var attributes=require(_0xed43('0x7'));module[_0xed43('0x8')]=function(_0x52425d,_0x1d4276){return _0x52425d[_0xed43('0x9')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xed43('0xa'),_0xed43('0xb')]},{'unique':!![],'name':_0xed43('0xc'),'fields':[_0xed43('0xa'),_0xed43('0xd')]},{'unique':!![],'name':'name_mail','fields':[_0xed43('0xa'),_0xed43('0xe')]},{'unique':!![],'name':'name_sms','fields':[_0xed43('0xa'),_0xed43('0xf')]},{'unique':!![],'name':_0xed43('0x10'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0xed43('0x11'),'fields':[_0xed43('0xa'),'OpenchannelAccountId']},{'unique':!![],'name':_0xed43('0x12'),'fields':[_0xed43('0xa'),_0xed43('0x13')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x212b=['api','moment','bluebird','path','rimraf','../../config/environment','exports','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger'];(function(_0x5aac38,_0x18ce94){var _0x26c2e3=function(_0x318d16){while(--_0x318d16){_0x5aac38['push'](_0x5aac38['shift']());}};_0x26c2e3(++_0x18ce94);}(_0x212b,0x148));var _0xb212=function(_0x36c016,_0x5ca55d){_0x36c016=_0x36c016-0x0;var _0x4bb377=_0x212b[_0x36c016];return _0x4bb377;};'use strict';var _=require(_0xb212('0x0'));var util=require('util');var logger=require(_0xb212('0x1'))(_0xb212('0x2'));var moment=require(_0xb212('0x3'));var BPromise=require(_0xb212('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb212('0x5'));var rimraf=require(_0xb212('0x6'));var config=require(_0xb212('0x7'));var attributes=require('./disposition.attributes');module[_0xb212('0x8')]=function(_0x49a13c,_0x21825a){return _0x49a13c['define'](_0xb212('0x9'),attributes,{'tableName':_0xb212('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xb212('0xb'),_0xb212('0xc')]},{'unique':!![],'name':_0xb212('0xd'),'fields':['name',_0xb212('0xe')]},{'unique':!![],'name':_0xb212('0xf'),'fields':['name','MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0xb212('0xb'),'SmsAccountId']},{'unique':!![],'name':_0xb212('0x10'),'fields':[_0xb212('0xb'),_0xb212('0x11')]},{'unique':!![],'name':_0xb212('0x12'),'fields':[_0xb212('0xb'),_0xb212('0x13')]},{'unique':!![],'name':_0xb212('0x14'),'fields':[_0xb212('0xb'),_0xb212('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 4be0491..6acb0fd 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 _0x4a94=['../../mysqldb','../../config/environment','jayson/promise','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x255da2,_0x2a1988){var _0xbce46c=function(_0x19b8df){while(--_0x19b8df){_0x255da2['push'](_0x255da2['shift']());}};_0xbce46c(++_0x2a1988);}(_0x4a94,0x175));var _0x44a9=function(_0x52ac40,_0x299d1b){_0x52ac40=_0x52ac40-0x0;var _0x37a06d=_0x4a94[_0x52ac40];return _0x37a06d;};'use strict';var _=require(_0x44a9('0x0'));var util=require(_0x44a9('0x1'));var moment=require(_0x44a9('0x2'));var BPromise=require(_0x44a9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x44a9('0x4'));var db=require(_0x44a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x44a9('0x6'));var jayson=require(_0x44a9('0x7'));var client=jayson['client'][_0x44a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x420b67,_0x1a6266,_0x43c64e){return new BPromise(function(_0x5ae14d,_0x2e190f){return client[_0x44a9('0x9')](_0x420b67,_0x43c64e)[_0x44a9('0xa')](function(_0x5877ee){logger['info'](_0x44a9('0xb'),_0x1a6266,_0x44a9('0xc'));logger[_0x44a9('0xd')](_0x44a9('0xe'),_0x1a6266,_0x44a9('0xc'),JSON[_0x44a9('0xf')](_0x5877ee));if(_0x5877ee[_0x44a9('0x10')]){if(_0x5877ee[_0x44a9('0x10')][_0x44a9('0x11')]===0x1f4){logger[_0x44a9('0x10')](_0x44a9('0xb'),_0x1a6266,_0x5877ee[_0x44a9('0x10')][_0x44a9('0x12')]);return _0x2e190f(_0x5877ee['error'][_0x44a9('0x12')]);}logger[_0x44a9('0x10')](_0x44a9('0xb'),_0x1a6266,_0x5877ee[_0x44a9('0x10')]['message']);return _0x5ae14d(_0x5877ee[_0x44a9('0x10')][_0x44a9('0x12')]);}else{logger['info'](_0x44a9('0xb'),_0x1a6266,_0x44a9('0xc'));_0x5ae14d(_0x5877ee[_0x44a9('0x13')]['message']);}})[_0x44a9('0x14')](function(_0x24c32c){logger[_0x44a9('0x10')](_0x44a9('0xb'),_0x1a6266,_0x24c32c);_0x2e190f(_0x24c32c);});});} \ No newline at end of file +var _0xf69b=['lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch'];(function(_0x571bda,_0x20029a){var _0x5bafbc=function(_0x4f44b6){while(--_0x4f44b6){_0x571bda['push'](_0x571bda['shift']());}};_0x5bafbc(++_0x20029a);}(_0xf69b,0x126));var _0xbf69=function(_0x3e2317,_0x527321){_0x3e2317=_0x3e2317-0x0;var _0x26ab4d=_0xf69b[_0x3e2317];return _0x26ab4d;};'use strict';var _=require(_0xbf69('0x0'));var util=require(_0xbf69('0x1'));var moment=require(_0xbf69('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf69('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbf69('0x4'));var logger=require('../../config/logger')(_0xbf69('0x5'));var config=require(_0xbf69('0x6'));var jayson=require(_0xbf69('0x7'));var client=jayson[_0xbf69('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x502ad7,_0x3277b5,_0x1e5d61){return new BPromise(function(_0x23d6cf,_0xe058d1){return client[_0xbf69('0x9')](_0x502ad7,_0x1e5d61)[_0xbf69('0xa')](function(_0x5267a4){logger['info'](_0xbf69('0xb'),_0x3277b5,_0xbf69('0xc'));logger[_0xbf69('0xd')](_0xbf69('0xe'),_0x3277b5,_0xbf69('0xc'),JSON[_0xbf69('0xf')](_0x5267a4));if(_0x5267a4['error']){if(_0x5267a4['error'][_0xbf69('0x10')]===0x1f4){logger[_0xbf69('0x11')](_0xbf69('0xb'),_0x3277b5,_0x5267a4[_0xbf69('0x11')][_0xbf69('0x12')]);return _0xe058d1(_0x5267a4[_0xbf69('0x11')]['message']);}logger[_0xbf69('0x11')](_0xbf69('0xb'),_0x3277b5,_0x5267a4[_0xbf69('0x11')]['message']);return _0x23d6cf(_0x5267a4[_0xbf69('0x11')][_0xbf69('0x12')]);}else{logger[_0xbf69('0x13')]('Disposition,\x20%s,\x20%s',_0x3277b5,_0xbf69('0xc'));_0x23d6cf(_0x5267a4['result']['message']);}})[_0xbf69('0x14')](function(_0x1f67c3){logger[_0xbf69('0x11')]('Disposition,\x20%s,\x20%s',_0x3277b5,_0x1f67c3);_0xe058d1(_0x1f67c3);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 2d6ed10..10125c2 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 _0xce65=['../../config/environment','./disposition.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x247909,_0x2a8478){var _0x394343=function(_0x26e70f){while(--_0x26e70f){_0x247909['push'](_0x247909['shift']());}};_0x394343(++_0x2a8478);}(_0xce65,0x71));var _0x5ce6=function(_0x2e0f64,_0x17743b){_0x2e0f64=_0x2e0f64-0x0;var _0x40ec93=_0xce65[_0x2e0f64];return _0x40ec93;};'use strict';var multer=require('multer');var util=require(_0x5ce6('0x0'));var path=require(_0x5ce6('0x1'));var timeout=require(_0x5ce6('0x2'));var express=require(_0x5ce6('0x3'));var router=express[_0x5ce6('0x4')]();var auth=require(_0x5ce6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5ce6('0x6'));var controller=require(_0x5ce6('0x7'));router['get']('/',auth[_0x5ce6('0x8')](),controller[_0x5ce6('0x9')]);router['get'](_0x5ce6('0xa'),auth[_0x5ce6('0x8')](),controller[_0x5ce6('0xb')]);router[_0x5ce6('0xc')]('/',auth[_0x5ce6('0x8')](),controller[_0x5ce6('0xd')]);router[_0x5ce6('0xe')]('/:id',auth[_0x5ce6('0x8')](),controller[_0x5ce6('0xf')]);router[_0x5ce6('0x10')](_0x5ce6('0xa'),auth[_0x5ce6('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7a42=['show','post','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0xc3a974,_0x38d373){var _0x1be507=function(_0xefeefb){while(--_0xefeefb){_0xc3a974['push'](_0xc3a974['shift']());}};_0x1be507(++_0x38d373);}(_0x7a42,0x129));var _0x27a4=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0x7a42[_0xdd0313];return _0x2bd7e8;};'use strict';var multer=require(_0x27a4('0x0'));var util=require('util');var path=require(_0x27a4('0x1'));var timeout=require(_0x27a4('0x2'));var express=require(_0x27a4('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x27a4('0x4'));var config=require(_0x27a4('0x5'));var controller=require('./disposition.controller');router[_0x27a4('0x6')]('/',auth['isAuthenticated'](),controller[_0x27a4('0x7')]);router[_0x27a4('0x6')]('/:id',auth[_0x27a4('0x8')](),controller[_0x27a4('0x9')]);router[_0x27a4('0xa')]('/',auth[_0x27a4('0x8')](),controller[_0x27a4('0xb')]);router[_0x27a4('0xc')](_0x27a4('0xd'),auth[_0x27a4('0x8')](),controller[_0x27a4('0xe')]);router[_0x27a4('0xf')](_0x27a4('0xd'),auth[_0x27a4('0x8')](),controller[_0x27a4('0x10')]);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 aeb21c1..e5c18ed 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 _0x6de1=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','4800','9600','12000','14400','2400','7200','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x56e111,_0x5927c0){var _0x321326=function(_0x558684){while(--_0x558684){_0x56e111['push'](_0x56e111['shift']());}};_0x321326(++_0x5927c0);}(_0x6de1,0x182));var _0x16de=function(_0x26a4ea,_0xa72fb8){_0x26a4ea=_0x26a4ea-0x0;var _0x1b669e=_0x6de1[_0x26a4ea];return _0x1b669e;};'use strict';var Sequelize=require(_0x16de('0x0'));module[_0x16de('0x1')]={'name':{'type':Sequelize[_0x16de('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x16de('0x2')]},'ecm':{'type':Sequelize[_0x16de('0x3')](_0x16de('0x4'),'no'),'defaultValue':_0x16de('0x4')},'headerinfo':{'type':Sequelize[_0x16de('0x2')],'defaultValue':_0x16de('0x5')},'localstationid':{'type':Sequelize[_0x16de('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x16de('0x3')]('2400',_0x16de('0x6'),'7200',_0x16de('0x7'),_0x16de('0x8'),_0x16de('0x9')),'defaultValue':_0x16de('0x6')},'maxrate':{'type':Sequelize[_0x16de('0x3')](_0x16de('0xa'),_0x16de('0x6'),_0x16de('0xb'),_0x16de('0x7'),_0x16de('0x8'),_0x16de('0x9')),'defaultValue':_0x16de('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x16de('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x16de('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x16de('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x16de('0x3')](_0x16de('0xd'),_0x16de('0xe'),_0x16de('0xf'),_0x16de('0x10')),'defaultValue':_0x16de('0xd')},'key':{'type':Sequelize[_0x16de('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x16de('0x11');}},'notificationSound':{'type':Sequelize[_0x16de('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x16de('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x16de('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x16de('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x16de('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x16de('0x14'),'set':function(_0xc91018){if(!_0xc91018)this[_0x16de('0x15')](_0x16de('0x16'),null);this[_0x16de('0x15')](_0x16de('0x17'),_0xc91018);}}}; \ No newline at end of file +var _0x2da3=['mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','7200','12000','14400','4800','9600','v17,v27,v29','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x16add9,_0x24f9b7){var _0x551673=function(_0xca0934){while(--_0xca0934){_0x16add9['push'](_0x16add9['shift']());}};_0x551673(++_0x24f9b7);}(_0x2da3,0x109));var _0x32da=function(_0x8d9150,_0x200b7c){_0x8d9150=_0x8d9150-0x0;var _0x243d26=_0x2da3[_0x8d9150];return _0x243d26;};'use strict';var Sequelize=require(_0x32da('0x0'));module[_0x32da('0x1')]={'name':{'type':Sequelize[_0x32da('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x32da('0x3')](_0x32da('0x4'),'no'),'defaultValue':_0x32da('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x32da('0x5')},'localstationid':{'type':Sequelize[_0x32da('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x32da('0x3')](_0x32da('0x6'),'4800',_0x32da('0x7'),'9600',_0x32da('0x8'),_0x32da('0x9')),'defaultValue':_0x32da('0xa')},'maxrate':{'type':Sequelize['ENUM'](_0x32da('0x6'),_0x32da('0xa'),_0x32da('0x7'),_0x32da('0xb'),_0x32da('0x8'),_0x32da('0x9')),'defaultValue':_0x32da('0x9')},'modem':{'type':Sequelize[_0x32da('0x2')],'defaultValue':_0x32da('0xc')},'gateway':{'type':Sequelize[_0x32da('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x32da('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x32da('0x3')](_0x32da('0xd'),_0x32da('0xe'),'DADHI',_0x32da('0xf')),'defaultValue':_0x32da('0xd')},'key':{'type':Sequelize[_0x32da('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x32da('0x10')],'defaultValue':function(){return _0x32da('0x11');}},'notificationSound':{'type':Sequelize[_0x32da('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x32da('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x32da('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x32da('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x32da('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x32da('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x32da('0x13')],'allowNull':!![],'defaultValue':null,'comment':_0x32da('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x32da('0x12')],'defaultValue':![],'comment':_0x32da('0x15'),'set':function(_0x194817){if(!_0x194817)this[_0x32da('0x16')](_0x32da('0x17'),null);this['setDataValue']('mandatoryDisposition',_0x194817);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 27c91a3..8f4e092 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 _0xcba7=['updatedAt','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','List\x20not\x20found','out','filename','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','emit','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../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','./faxAccount.socket','register','http','client','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','keys','query','filters','attributes','model','fields','length','nolimit','pick','filter','where','merge','options','count','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','sort','removeDispositions','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','getInteractions','Contact','User','Owner','Tags','color','tag','addApplications','FaxApplication','findAndCountAll','getApplications','from-voip-provider','localstationid','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','modem','FAXOPT(','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','sequelize','transaction','VoiceExtension','bulkCreate','updateAccountApplications','omit','tech','key','createdAt'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xcba7,0x199));var _0x7cba=function(_0x20b1a7,_0x2f2ece){_0x20b1a7=_0x20b1a7-0x0;var _0x4d3a1a=_0xcba7[_0x20b1a7];return _0x4d3a1a;};'use strict';var pdf=require(_0x7cba('0x0'));var emlformat=require(_0x7cba('0x1'));var rimraf=require(_0x7cba('0x2'));var zipdir=require(_0x7cba('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7cba('0x4'));var moment=require(_0x7cba('0x5'));var BPromise=require(_0x7cba('0x6'));var Mustache=require('mustache');var util=require(_0x7cba('0x7'));var path=require(_0x7cba('0x8'));var sox=require(_0x7cba('0x9'));var csv=require(_0x7cba('0xa'));var ejs=require(_0x7cba('0xb'));var fs=require('fs');var _=require(_0x7cba('0xc'));var squel=require(_0x7cba('0xd'));var crypto=require(_0x7cba('0xe'));var jsforce=require(_0x7cba('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7cba('0xa'));var querystring=require(_0x7cba('0x10'));var Papa=require(_0x7cba('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7cba('0x12'));var as=require(_0x7cba('0x13'));var hardwareService=require(_0x7cba('0x14'));var logger=require(_0x7cba('0x15'))('api');var utils=require(_0x7cba('0x16'));var config=require(_0x7cba('0x17'));var licenseUtil=require(_0x7cba('0x18'));var db=require(_0x7cba('0x19'))['db'];config[_0x7cba('0x1a')]=_[_0x7cba('0x1b')](config[_0x7cba('0x1a')],{'host':_0x7cba('0x1c'),'port':0x18eb});var socket=require(_0x7cba('0x1d'))(new Redis(config[_0x7cba('0x1a')]));require(_0x7cba('0x1e'))[_0x7cba('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7cba('0x20')]({'port':0x232c});var client9002=jayson[_0x7cba('0x21')][_0x7cba('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2b52a4,_0x38b935,_0x28dfd1,_0x384768){return new BPromise(function(_0x40c869,_0xa64089){var _0x39761b=_0x384768||client;return _0x39761b['request'](_0x2b52a4,_0x28dfd1)[_0x7cba('0x22')](function(_0x587c41){logger['info'](_0x7cba('0x23'),_0x38b935,_0x7cba('0x24'));logger[_0x7cba('0x25')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x38b935,_0x7cba('0x24'),JSON['stringify'](_0x587c41));if(_0x587c41[_0x7cba('0x26')]){if(_0x587c41['error']['code']===0x1f4){logger[_0x7cba('0x26')](_0x7cba('0x23'),_0x38b935,_0x587c41[_0x7cba('0x26')][_0x7cba('0x27')]);return _0xa64089(_0x587c41[_0x7cba('0x26')]['message']);}logger[_0x7cba('0x26')]('FaxAccount,\x20%s,\x20%s',_0x38b935,_0x587c41[_0x7cba('0x26')][_0x7cba('0x27')]);return _0x40c869(_0x587c41[_0x7cba('0x26')][_0x7cba('0x27')]);}else{logger[_0x7cba('0x28')](_0x7cba('0x23'),_0x38b935,_0x7cba('0x24'));_0x40c869(_0x587c41[_0x7cba('0x29')][_0x7cba('0x27')]);}})['catch'](function(_0x4e5974){logger[_0x7cba('0x26')]('FaxAccount,\x20%s,\x20%s',_0x38b935,_0x4e5974);_0xa64089(_0x4e5974);});});}function respondWithStatusCode(_0x4af3ab,_0x3c9dc0){_0x3c9dc0=_0x3c9dc0||0xcc;return function(_0x369b14){if(_0x369b14){return _0x4af3ab[_0x7cba('0x2a')](_0x3c9dc0);}return _0x4af3ab[_0x7cba('0x2b')](_0x3c9dc0)['end']();};}function respondWithResult(_0x35a10b,_0x5bdc3f){_0x5bdc3f=_0x5bdc3f||0xc8;return function(_0x5d9ce3){if(_0x5d9ce3){return _0x35a10b[_0x7cba('0x2b')](_0x5bdc3f)[_0x7cba('0x2c')](_0x5d9ce3);}};}function respondWithFilteredResult(_0x34a121,_0x336dcb){return function(_0x2f4f15){if(_0x2f4f15){var _0x213f3a=_0x2f4f15['count'],_0x296196=_0x336dcb[_0x7cba('0x2d')],_0x334a86=_0x336dcb['offset']+_0x336dcb[_0x7cba('0x2e')],_0x2d7d3c;if(_0x334a86>=_0x213f3a){_0x334a86=_0x213f3a;_0x2d7d3c=0xc8;}else{_0x2d7d3c=0xce;}_0x34a121[_0x7cba('0x2b')](_0x2d7d3c);return _0x34a121[_0x7cba('0x2f')](_0x7cba('0x30'),_0x296196+'-'+_0x334a86+'/'+_0x213f3a)[_0x7cba('0x2c')](_0x2f4f15);}return null;};}function patchUpdates(_0xdcfb3f){return function(_0x442c25){try{jsonpatch[_0x7cba('0x31')](_0x442c25,_0xdcfb3f,!![]);}catch(_0x4e9e93){return BPromise[_0x7cba('0x32')](_0x4e9e93);}return _0x442c25['save']();};}function saveUpdates(_0x2bad82,_0x13fdbd){return function(_0x3d29d1){if(_0x3d29d1){return _0x3d29d1[_0x7cba('0x33')](_0x2bad82)[_0x7cba('0x22')](function(_0x41661f){return _0x41661f;});}return null;};}function removeEntity(_0x59783f,_0x52866e){return function(_0x33bfd2){if(_0x33bfd2){return _0x33bfd2[_0x7cba('0x34')]()[_0x7cba('0x22')](function(){var _0x51061b=_0x33bfd2['get']({'plain':!![]});var _0x15da45='FaxAccounts';return db[_0x7cba('0x35')][_0x7cba('0x34')]({'where':{'type':_0x15da45,'resourceId':_0x51061b['id']}})[_0x7cba('0x22')](function(){return _0x33bfd2;});})[_0x7cba('0x22')](function(){_0x59783f[_0x7cba('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xddcdc0,_0x2d964f){return function(_0x4687ac){if(!_0x4687ac){_0xddcdc0['sendStatus'](0x194);}return _0x4687ac;};}function handleError(_0x4c91af,_0x1dc306){_0x1dc306=_0x1dc306||0x1f4;return function(_0x5c4558){logger[_0x7cba('0x26')](_0x5c4558[_0x7cba('0x36')]);if(_0x5c4558['name']){delete _0x5c4558[_0x7cba('0x37')];}_0x4c91af[_0x7cba('0x2b')](_0x1dc306)[_0x7cba('0x38')](_0x5c4558);};}exports[_0x7cba('0x39')]=function(_0x45b688,_0x18f4c7){var _0x2b91c7={'include':[{'model':db[_0x7cba('0x3a')],'as':_0x7cba('0x3b')}]},_0x113e01={},_0x5a1b00={'count':0x0,'rows':[]};var _0x3937f0=_[_0x7cba('0x3c')](db[_0x7cba('0x3d')][_0x7cba('0x3e')],function(_0x29d901){return{'name':_0x29d901[_0x7cba('0x3f')],'type':_0x29d901[_0x7cba('0x40')]['key']};});_0x113e01['model']=_['map'](_0x3937f0,'name');_0x113e01['query']=_[_0x7cba('0x41')](_0x45b688[_0x7cba('0x42')]);_0x113e01[_0x7cba('0x43')]=_['intersection'](_0x113e01['model'],_0x113e01[_0x7cba('0x42')]);_0x2b91c7[_0x7cba('0x44')]=_['intersection'](_0x113e01[_0x7cba('0x45')],qs[_0x7cba('0x46')](_0x45b688[_0x7cba('0x42')][_0x7cba('0x46')]));_0x2b91c7[_0x7cba('0x44')]=_0x2b91c7['attributes'][_0x7cba('0x47')]?_0x2b91c7[_0x7cba('0x44')]:_0x113e01[_0x7cba('0x45')];if(!_0x45b688[_0x7cba('0x42')]['hasOwnProperty'](_0x7cba('0x48'))){_0x2b91c7['limit']=qs[_0x7cba('0x2e')](_0x45b688[_0x7cba('0x42')][_0x7cba('0x2e')]);_0x2b91c7[_0x7cba('0x2d')]=qs[_0x7cba('0x2d')](_0x45b688[_0x7cba('0x42')][_0x7cba('0x2d')]);}_0x2b91c7['order']=qs['sort'](_0x45b688[_0x7cba('0x42')]['sort']);_0x2b91c7['where']=qs[_0x7cba('0x43')](_[_0x7cba('0x49')](_0x45b688[_0x7cba('0x42')],_0x113e01[_0x7cba('0x43')]),_0x3937f0);if(_0x45b688[_0x7cba('0x42')][_0x7cba('0x4a')]){_0x2b91c7[_0x7cba('0x4b')]=_[_0x7cba('0x4c')](_0x2b91c7[_0x7cba('0x4b')],{'$or':_[_0x7cba('0x3c')](_0x3937f0,function(_0x371443){if(_0x371443['type']!=='VIRTUAL'){var _0x5239be={};_0x5239be[_0x371443[_0x7cba('0x37')]]={'$like':'%'+_0x45b688['query'][_0x7cba('0x4a')]+'%'};return _0x5239be;}})});}_0x2b91c7=_[_0x7cba('0x4c')]({},_0x2b91c7,_0x45b688[_0x7cba('0x4d')]);var _0x2545dd={'where':_0x2b91c7[_0x7cba('0x4b')]};return db['FaxAccount'][_0x7cba('0x4e')](_0x2545dd)[_0x7cba('0x22')](function(_0x5b077f){_0x5a1b00[_0x7cba('0x4e')]=_0x5b077f;if(_0x45b688[_0x7cba('0x42')][_0x7cba('0x4f')]){_0x2b91c7['include']=[{'all':!![]}];}return db['FaxAccount'][_0x7cba('0x50')](_0x2b91c7);})[_0x7cba('0x22')](function(_0xa43d7d){_0x5a1b00[_0x7cba('0x51')]=_0xa43d7d;return _0x5a1b00;})['then'](respondWithFilteredResult(_0x18f4c7,_0x2b91c7))[_0x7cba('0x52')](handleError(_0x18f4c7,null));};exports[_0x7cba('0x53')]=function(_0x2cbdd7,_0x250ee9){var _0x318865={'raw':![],'where':{'id':_0x2cbdd7[_0x7cba('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x7cba('0x3b')}]},_0x4aa094={};_0x4aa094[_0x7cba('0x45')]=_[_0x7cba('0x41')](db['FaxAccount'][_0x7cba('0x3e')]);_0x4aa094[_0x7cba('0x42')]=_[_0x7cba('0x41')](_0x2cbdd7['query']);_0x4aa094[_0x7cba('0x43')]=_[_0x7cba('0x55')](_0x4aa094[_0x7cba('0x45')],_0x4aa094['query']);_0x318865[_0x7cba('0x44')]=_['intersection'](_0x4aa094['model'],qs[_0x7cba('0x46')](_0x2cbdd7[_0x7cba('0x42')][_0x7cba('0x46')]));_0x318865['attributes']=_0x318865[_0x7cba('0x44')][_0x7cba('0x47')]?_0x318865[_0x7cba('0x44')]:_0x4aa094['model'];if(_0x2cbdd7['query']['includeAll']){_0x318865[_0x7cba('0x56')]=[{'all':!![]}];}_0x318865=_[_0x7cba('0x4c')]({},_0x318865,_0x2cbdd7['options']);return db['FaxAccount'][_0x7cba('0x57')](_0x318865)[_0x7cba('0x22')](handleEntityNotFound(_0x250ee9,null))['then'](respondWithResult(_0x250ee9,null))[_0x7cba('0x52')](handleError(_0x250ee9,null));};exports[_0x7cba('0x58')]=function(_0x105993,_0x45b0ab){return db[_0x7cba('0x3d')][_0x7cba('0x58')](_0x105993[_0x7cba('0x59')],{})[_0x7cba('0x22')](function(_0x274982){var _0x2c1e2f=_0x105993[_0x7cba('0x5a')]['get']({'plain':!![]});if(!_0x2c1e2f)throw new Error(_0x7cba('0x5b'));if(_0x2c1e2f[_0x7cba('0x5c')]==='user'){var _0x45847e=_0x274982[_0x7cba('0x5d')]({'plain':!![]});var _0x2b7704='FaxAccounts';return db[_0x7cba('0x5e')]['find']({'where':{'name':_0x2b7704,'userProfileId':_0x2c1e2f[_0x7cba('0x5f')]},'raw':!![]})['then'](function(_0x3d21a2){if(_0x3d21a2&&_0x3d21a2[_0x7cba('0x60')]===0x0){return db[_0x7cba('0x35')][_0x7cba('0x58')]({'name':_0x45847e[_0x7cba('0x37')],'resourceId':_0x45847e['id'],'type':_0x3d21a2[_0x7cba('0x37')],'sectionId':_0x3d21a2['id']},{})[_0x7cba('0x22')](function(){return _0x274982;});}else{return _0x274982;}})['catch'](function(_0x297d10){logger[_0x7cba('0x26')](_0x7cba('0x61'),_0x297d10);throw _0x297d10;});}return _0x274982;})[_0x7cba('0x22')](respondWithResult(_0x45b0ab,0xc9))[_0x7cba('0x52')](handleError(_0x45b0ab,null));};exports['update']=function(_0x5d7eeb,_0x10a90a){if(_0x5d7eeb[_0x7cba('0x59')]['id']){delete _0x5d7eeb[_0x7cba('0x59')]['id'];}return db[_0x7cba('0x3d')][_0x7cba('0x57')]({'where':{'id':_0x5d7eeb[_0x7cba('0x54')]['id']},'include':[{'model':db[_0x7cba('0x3a')],'as':_0x7cba('0x3b')}]})[_0x7cba('0x22')](handleEntityNotFound(_0x10a90a,null))[_0x7cba('0x22')](saveUpdates(_0x5d7eeb[_0x7cba('0x59')],null))[_0x7cba('0x22')](respondWithResult(_0x10a90a,null))[_0x7cba('0x52')](handleError(_0x10a90a,null));};exports[_0x7cba('0x34')]=function(_0x41d7b9,_0x1969cc){return db[_0x7cba('0x3d')][_0x7cba('0x57')]({'where':{'id':_0x41d7b9['params']['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x1969cc,null))[_0x7cba('0x22')](removeEntity(_0x1969cc,null))['catch'](handleError(_0x1969cc,null));};exports[_0x7cba('0x62')]=function(_0xa7db5e,_0x79d95d){return db[_0x7cba('0x3d')]['describe']()[_0x7cba('0x22')](respondWithResult(_0x79d95d,null))[_0x7cba('0x52')](handleError(_0x79d95d,null));};exports[_0x7cba('0x63')]=function(_0x2649f6,_0x30fac5,_0x38064d){if(_0x2649f6['body']['id']){delete _0x2649f6[_0x7cba('0x59')]['id'];}return db[_0x7cba('0x3d')][_0x7cba('0x57')]({'where':{'id':_0x2649f6[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x30fac5,null))[_0x7cba('0x22')](function(_0x38ce3d){if(_0x38ce3d){_0x2649f6[_0x7cba('0x59')][_0x7cba('0x64')]=_0x38ce3d['id'];return db[_0x7cba('0x65')][_0x7cba('0x58')](_0x2649f6[_0x7cba('0x59')]);}})[_0x7cba('0x22')](respondWithResult(_0x30fac5,null))[_0x7cba('0x52')](handleError(_0x30fac5,null));};exports[_0x7cba('0x66')]=function(_0x31489d,_0x389a56,_0x43559e){var _0x56108c={'raw':![],'where':{}};var _0x24cac9={};var _0x23f680={'count':0x0,'rows':[]};return db[_0x7cba('0x3d')][_0x7cba('0x67')]({'where':{'id':_0x31489d[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x389a56,null))['then'](function(_0x280cf2){if(_0x280cf2){_0x24cac9[_0x7cba('0x45')]=_[_0x7cba('0x41')](db[_0x7cba('0x65')][_0x7cba('0x3e')]);_0x24cac9[_0x7cba('0x42')]=_['keys'](_0x31489d['query']);_0x24cac9[_0x7cba('0x43')]=_[_0x7cba('0x55')](_0x24cac9[_0x7cba('0x45')],_0x24cac9[_0x7cba('0x42')]);_0x56108c[_0x7cba('0x44')]=_[_0x7cba('0x55')](_0x24cac9[_0x7cba('0x45')],qs[_0x7cba('0x46')](_0x31489d[_0x7cba('0x42')][_0x7cba('0x46')]));_0x56108c[_0x7cba('0x44')]=_0x56108c['attributes']['length']?_0x56108c[_0x7cba('0x44')]:_0x24cac9[_0x7cba('0x45')];if(!_0x31489d[_0x7cba('0x42')][_0x7cba('0x68')](_0x7cba('0x48'))){_0x56108c[_0x7cba('0x2e')]=qs[_0x7cba('0x2e')](_0x31489d['query'][_0x7cba('0x2e')]);_0x56108c[_0x7cba('0x2d')]=qs[_0x7cba('0x2d')](_0x31489d[_0x7cba('0x42')][_0x7cba('0x2d')]);}_0x56108c[_0x7cba('0x69')]=qs[_0x7cba('0x6a')](_0x31489d[_0x7cba('0x42')]['sort']);_0x56108c[_0x7cba('0x4b')]=qs[_0x7cba('0x43')](_[_0x7cba('0x49')](_0x31489d[_0x7cba('0x42')],_0x24cac9[_0x7cba('0x43')]));_0x56108c[_0x7cba('0x4b')][_0x7cba('0x64')]=_0x280cf2['id'];if(_0x31489d[_0x7cba('0x42')][_0x7cba('0x4a')]){_0x56108c[_0x7cba('0x4b')]=_[_0x7cba('0x4c')](_0x56108c['where'],{'$or':_[_0x7cba('0x3c')](_0x56108c[_0x7cba('0x44')],function(_0x34b225){var _0x47f6a1={};_0x47f6a1[_0x34b225]={'$like':'%'+_0x31489d[_0x7cba('0x42')][_0x7cba('0x4a')]+'%'};return _0x47f6a1;})});}_0x56108c=_[_0x7cba('0x4c')]({},_0x56108c,_0x31489d[_0x7cba('0x4d')]);return db[_0x7cba('0x65')]['count']({'where':_0x56108c[_0x7cba('0x4b')]})[_0x7cba('0x22')](function(_0x2289c2){_0x23f680[_0x7cba('0x4e')]=_0x2289c2;if(_0x31489d[_0x7cba('0x42')][_0x7cba('0x4f')]){_0x56108c['include']=[{'all':!![]}];}return db[_0x7cba('0x65')][_0x7cba('0x50')](_0x56108c);})['then'](function(_0x30ab3e){_0x23f680[_0x7cba('0x51')]=_0x30ab3e;return _0x23f680;});}})[_0x7cba('0x22')](respondWithFilteredResult(_0x389a56,_0x56108c))[_0x7cba('0x52')](handleError(_0x389a56,null));};exports[_0x7cba('0x6b')]=function(_0x799ef1,_0x53731d,_0x426cb6){return db['FaxAccount']['find']({'where':{'id':_0x799ef1[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x53731d,null))['then'](function(_0x1b9341){if(_0x1b9341){return _0x1b9341[_0x7cba('0x6b')](_0x799ef1[_0x7cba('0x42')]['ids']);}})[_0x7cba('0x22')](respondWithStatusCode(_0x53731d,null))[_0x7cba('0x52')](handleError(_0x53731d,null));};exports['addAnswer']=function(_0x14eedb,_0x58e5bb,_0x3e0edf){if(_0x14eedb[_0x7cba('0x59')]['id']){delete _0x14eedb[_0x7cba('0x59')]['id'];}return db[_0x7cba('0x3d')]['find']({'where':{'id':_0x14eedb[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x58e5bb,null))[_0x7cba('0x22')](function(_0x43a3ea){if(_0x43a3ea){_0x14eedb[_0x7cba('0x59')][_0x7cba('0x64')]=_0x43a3ea['id'];return db[_0x7cba('0x6c')][_0x7cba('0x58')](_0x14eedb['body']);}})[_0x7cba('0x22')](respondWithResult(_0x58e5bb,null))['catch'](handleError(_0x58e5bb,null));};exports['getAnswers']=function(_0x5bd2a2,_0x566015,_0x25375b){var _0x47c618={'raw':![],'where':{}};var _0xe7acf9={};var _0x2d5ee0={'count':0x0,'rows':[]};return db['FaxAccount'][_0x7cba('0x67')]({'where':{'id':_0x5bd2a2['params']['id']}})['then'](handleEntityNotFound(_0x566015,null))[_0x7cba('0x22')](function(_0x385ee3){if(_0x385ee3){_0xe7acf9['model']=_['keys'](db['CannedAnswer'][_0x7cba('0x3e')]);_0xe7acf9[_0x7cba('0x42')]=_[_0x7cba('0x41')](_0x5bd2a2[_0x7cba('0x42')]);_0xe7acf9[_0x7cba('0x43')]=_[_0x7cba('0x55')](_0xe7acf9[_0x7cba('0x45')],_0xe7acf9[_0x7cba('0x42')]);_0x47c618[_0x7cba('0x44')]=_[_0x7cba('0x55')](_0xe7acf9[_0x7cba('0x45')],qs['fields'](_0x5bd2a2[_0x7cba('0x42')]['fields']));_0x47c618[_0x7cba('0x44')]=_0x47c618[_0x7cba('0x44')][_0x7cba('0x47')]?_0x47c618[_0x7cba('0x44')]:_0xe7acf9[_0x7cba('0x45')];if(!_0x5bd2a2[_0x7cba('0x42')][_0x7cba('0x68')](_0x7cba('0x48'))){_0x47c618[_0x7cba('0x2e')]=qs[_0x7cba('0x2e')](_0x5bd2a2['query'][_0x7cba('0x2e')]);_0x47c618[_0x7cba('0x2d')]=qs[_0x7cba('0x2d')](_0x5bd2a2['query'][_0x7cba('0x2d')]);}_0x47c618[_0x7cba('0x69')]=qs[_0x7cba('0x6a')](_0x5bd2a2['query']['sort']);_0x47c618[_0x7cba('0x4b')]=qs[_0x7cba('0x43')](_['pick'](_0x5bd2a2[_0x7cba('0x42')],_0xe7acf9['filters']));_0x47c618[_0x7cba('0x4b')]['FaxAccountId']=_0x385ee3['id'];if(_0x5bd2a2[_0x7cba('0x42')][_0x7cba('0x4a')]){_0x47c618[_0x7cba('0x4b')]=_[_0x7cba('0x4c')](_0x47c618['where'],{'$or':_[_0x7cba('0x3c')](_0x47c618[_0x7cba('0x44')],function(_0x16b58d){var _0x5c8e5a={};_0x5c8e5a[_0x16b58d]={'$like':'%'+_0x5bd2a2['query']['filter']+'%'};return _0x5c8e5a;})});}_0x47c618=_[_0x7cba('0x4c')]({},_0x47c618,_0x5bd2a2[_0x7cba('0x4d')]);return db[_0x7cba('0x6c')][_0x7cba('0x4e')]({'where':_0x47c618[_0x7cba('0x4b')]})[_0x7cba('0x22')](function(_0x3be288){_0x2d5ee0[_0x7cba('0x4e')]=_0x3be288;if(_0x5bd2a2[_0x7cba('0x42')][_0x7cba('0x4f')]){_0x47c618[_0x7cba('0x56')]=[{'all':!![]}];}return db[_0x7cba('0x6c')][_0x7cba('0x50')](_0x47c618);})[_0x7cba('0x22')](function(_0x4453bb){_0x2d5ee0['rows']=_0x4453bb;return _0x2d5ee0;});}})[_0x7cba('0x22')](respondWithFilteredResult(_0x566015,_0x47c618))[_0x7cba('0x52')](handleError(_0x566015,null));};exports[_0x7cba('0x6d')]=function(_0xf73b4c,_0x5af350,_0x33f456){return db[_0x7cba('0x3d')]['find']({'where':{'id':_0xf73b4c[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x5af350,null))[_0x7cba('0x22')](function(_0x40e1a0){if(_0x40e1a0){return _0x40e1a0[_0x7cba('0x6d')](_0xf73b4c[_0x7cba('0x42')][_0x7cba('0x6e')]);}})[_0x7cba('0x22')](respondWithStatusCode(_0x5af350,null))['catch'](handleError(_0x5af350,null));};exports[_0x7cba('0x6f')]=function(_0x361e4e,_0x15c8f6,_0x5243b8){return db[_0x7cba('0x70')][_0x7cba('0x57')]({'where':{'id':_0x361e4e[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x15c8f6,null))[_0x7cba('0x22')](function(_0x5b0f87){if(_0x5b0f87){return _0x5b0f87['addInteraction'](_0x361e4e[_0x7cba('0x59')][_0x7cba('0x6e')],_['omit'](_0x361e4e[_0x7cba('0x59')],['ids','id'])||{});}})[_0x7cba('0x22')](respondWithResult(_0x15c8f6,null))[_0x7cba('0x52')](handleError(_0x15c8f6,null));};exports[_0x7cba('0x71')]=function(_0x14046d,_0x3efb71,_0x7e7ec3){var _0x2fcf0e={'raw':![],'where':{}};var _0x4dc337={};var _0x2ca57f={'count':0x0,'rows':[]};return db[_0x7cba('0x3d')][_0x7cba('0x67')]({'where':{'id':_0x14046d[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x3efb71,null))[_0x7cba('0x22')](function(_0x1b04f8){if(_0x1b04f8){_0x4dc337['model']=_['keys'](db[_0x7cba('0x70')][_0x7cba('0x3e')]);_0x4dc337[_0x7cba('0x42')]=_['keys'](_0x14046d[_0x7cba('0x42')]);_0x4dc337['filters']=_['intersection'](_0x4dc337[_0x7cba('0x45')],_0x4dc337[_0x7cba('0x42')]);_0x2fcf0e[_0x7cba('0x44')]=_[_0x7cba('0x55')](_0x4dc337['model'],qs[_0x7cba('0x46')](_0x14046d['query'][_0x7cba('0x46')]));_0x2fcf0e[_0x7cba('0x44')]=_0x2fcf0e[_0x7cba('0x44')][_0x7cba('0x47')]?_0x2fcf0e['attributes']:_0x4dc337[_0x7cba('0x45')];if(!_0x14046d['query'][_0x7cba('0x68')](_0x7cba('0x48'))){_0x2fcf0e[_0x7cba('0x2e')]=qs['limit'](_0x14046d[_0x7cba('0x42')]['limit']);_0x2fcf0e[_0x7cba('0x2d')]=qs[_0x7cba('0x2d')](_0x14046d[_0x7cba('0x42')][_0x7cba('0x2d')]);}_0x2fcf0e[_0x7cba('0x69')]=qs['sort'](_0x14046d[_0x7cba('0x42')]['sort']);_0x2fcf0e[_0x7cba('0x4b')]=qs[_0x7cba('0x43')](_['pick'](_0x14046d[_0x7cba('0x42')],_0x4dc337[_0x7cba('0x43')]));_0x2fcf0e[_0x7cba('0x4b')][_0x7cba('0x64')]=_0x1b04f8['id'];if(_0x14046d[_0x7cba('0x42')][_0x7cba('0x4a')]){_0x2fcf0e['where']=_[_0x7cba('0x4c')](_0x2fcf0e['where'],{'$or':_['map'](_0x2fcf0e[_0x7cba('0x44')],function(_0x16872){var _0x5a3940={};_0x5a3940[_0x16872]={'$like':'%'+_0x14046d[_0x7cba('0x42')][_0x7cba('0x4a')]+'%'};return _0x5a3940;})});}_0x2fcf0e=_[_0x7cba('0x4c')]({},_0x2fcf0e,_0x14046d[_0x7cba('0x4d')]);return db[_0x7cba('0x70')]['count']({'where':_0x2fcf0e[_0x7cba('0x4b')]})['then'](function(_0x5597d1){_0x2ca57f[_0x7cba('0x4e')]=_0x5597d1;if(_0x14046d[_0x7cba('0x42')][_0x7cba('0x4f')]){_0x2fcf0e[_0x7cba('0x56')]=[{'model':db['CmContact'],'as':_0x7cba('0x72'),'required':![]},{'model':db[_0x7cba('0x73')],'as':_0x7cba('0x74'),'attributes':[_0x7cba('0x37'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x7cba('0x75'),'attributes':['id',_0x7cba('0x37'),_0x7cba('0x76')],'where':_0x14046d['query'][_0x7cba('0x77')]?{'id':_0x14046d['query'][_0x7cba('0x77')]}:undefined,'required':_0x14046d[_0x7cba('0x42')][_0x7cba('0x77')]?!![]:![]}];}return db[_0x7cba('0x70')][_0x7cba('0x50')](_0x2fcf0e);})[_0x7cba('0x22')](function(_0x440b53){_0x2ca57f[_0x7cba('0x51')]=_0x440b53;return _0x2ca57f;});}})[_0x7cba('0x22')](respondWithFilteredResult(_0x3efb71,_0x2fcf0e))[_0x7cba('0x52')](handleError(_0x3efb71,null));};exports[_0x7cba('0x78')]=function(_0x179160,_0x226368,_0x409378){return db['FaxAccount'][_0x7cba('0x67')]({'where':{'id':_0x179160[_0x7cba('0x54')]['id']}})['then'](handleEntityNotFound(_0x226368,null))[_0x7cba('0x22')](function(_0x3724f1){if(_0x3724f1){return db['sequelize']['transaction'](function(_0x230e06){return db[_0x7cba('0x79')][_0x7cba('0x34')]({'where':{'FaxAccountId':_0x179160[_0x7cba('0x54')]['id']},'transaction':_0x230e06})[_0x7cba('0x22')](function(_0x55e054){var _0x2e1ff8=_[_0x7cba('0x3c')](_0x179160['body'],function(_0x228b59){_0x228b59[_0x7cba('0x64')]=_0x179160[_0x7cba('0x54')]['id'];return _0x228b59;});return db['FaxApplication']['bulkCreate'](_0x2e1ff8,{'transaction':_0x230e06});});})[_0x7cba('0x22')](function(){return db[_0x7cba('0x79')][_0x7cba('0x7a')]({'where':{'FaxAccountId':_0x179160['params']['id']},'order':'priority'});});}})[_0x7cba('0x22')](respondWithResult(_0x226368,null))[_0x7cba('0x52')](handleError(_0x226368,null));};exports[_0x7cba('0x7b')]=function(_0x241a68,_0x45bd00,_0x2a19d5){var _0x57d0f6={};var _0x4e8a71={};var _0x428a86;var _0x56df50;return db[_0x7cba('0x3d')]['findOne']({'where':{'id':_0x241a68[_0x7cba('0x54')]['id']}})['then'](handleEntityNotFound(_0x45bd00,null))['then'](function(_0x3dabe4){if(_0x3dabe4){_0x428a86=_0x3dabe4;_0x4e8a71['model']=_[_0x7cba('0x41')](db[_0x7cba('0x79')][_0x7cba('0x3e')]);_0x4e8a71[_0x7cba('0x42')]=_[_0x7cba('0x41')](_0x241a68['query']);_0x4e8a71['filters']=_[_0x7cba('0x55')](_0x4e8a71[_0x7cba('0x45')],_0x4e8a71['query']);_0x57d0f6[_0x7cba('0x44')]=_[_0x7cba('0x55')](_0x4e8a71[_0x7cba('0x45')],qs[_0x7cba('0x46')](_0x241a68[_0x7cba('0x42')][_0x7cba('0x46')]));_0x57d0f6['attributes']=_0x57d0f6[_0x7cba('0x44')]['length']?_0x57d0f6[_0x7cba('0x44')]:_0x4e8a71['model'];_0x57d0f6[_0x7cba('0x69')]=qs[_0x7cba('0x6a')](_0x241a68[_0x7cba('0x42')][_0x7cba('0x6a')]);_0x57d0f6[_0x7cba('0x4b')]=qs[_0x7cba('0x43')](_['pick'](_0x241a68[_0x7cba('0x42')],_0x4e8a71[_0x7cba('0x43')]));if(_0x241a68[_0x7cba('0x42')]['filter']){_0x57d0f6[_0x7cba('0x4b')]=_[_0x7cba('0x4c')](_0x57d0f6['where'],{'$or':_['map'](_0x57d0f6[_0x7cba('0x44')],function(_0x23880f){var _0x3ae95f={};_0x3ae95f[_0x23880f]={'$like':'%'+_0x241a68[_0x7cba('0x42')]['filter']+'%'};return _0x3ae95f;})});}_0x57d0f6=_[_0x7cba('0x4c')]({},_0x57d0f6,_0x241a68[_0x7cba('0x4d')]);return _0x428a86[_0x7cba('0x7b')](_0x57d0f6);}})[_0x7cba('0x22')](function(_0x44af9d){if(_0x44af9d){_0x56df50=_0x44af9d[_0x7cba('0x47')];if(!_0x241a68['query'][_0x7cba('0x68')](_0x7cba('0x48'))){_0x57d0f6['limit']=qs[_0x7cba('0x2e')](_0x241a68[_0x7cba('0x42')]['limit']);_0x57d0f6[_0x7cba('0x2d')]=qs['offset'](_0x241a68[_0x7cba('0x42')][_0x7cba('0x2d')]);}return _0x428a86[_0x7cba('0x7b')](_0x57d0f6);}})[_0x7cba('0x22')](function(_0x3c36f5){if(_0x3c36f5){return _0x3c36f5?{'count':_0x56df50,'rows':_0x3c36f5}:null;}})[_0x7cba('0x22')](respondWithResult(_0x45bd00,null))[_0x7cba('0x52')](handleError(_0x45bd00,null));};function Extension(_0x13a166,_0x5c6784,_0x594294,_0x336292){this['context']=_0x7cba('0x7c');this['exten']=_0x13a166[_0x7cba('0x7d')];this['app']=_0x336292;this[_0x7cba('0x40')]=_0x7cba('0x7e');this[_0x7cba('0x7f')]=_0x7cba('0x80');this['FaxAccountId']=_0x13a166['id'];this['priority']=_0x5c6784;this[_0x7cba('0x81')]=_0x594294;}function createExtensionsReciveFax(_0x3d5e0f){var _0x1e1f33=0x1;var _0x5e1318=[];_0x5e1318[_0x7cba('0x82')](new Extension(_0x3d5e0f,_0x1e1f33,'','Answer'));_0x1e1f33+=0x1;_0x5e1318[_0x7cba('0x82')](new Extension(_0x3d5e0f,_0x1e1f33,_0x7cba('0x83'),_0x7cba('0x84')));_0x1e1f33+=0x1;for(var _0x5e5f9c in _0x3d5e0f){if(_0x3d5e0f['hasOwnProperty'](_0x5e5f9c)&&(_0x5e5f9c===_0x7cba('0x85')||_0x5e5f9c===_0x7cba('0x7d')||_0x5e5f9c===_0x7cba('0x86')||_0x5e5f9c===_0x7cba('0x87')||_0x5e5f9c===_0x7cba('0x88')||_0x5e5f9c==='maxrate'||_0x5e5f9c===_0x7cba('0x89')||_0x5e5f9c===_0x7cba('0x8a')||_0x5e5f9c==='t38timeout')){_0x5e1318['push'](new Extension(_0x3d5e0f,_0x1e1f33,_0x7cba('0x8b')+_0x5e5f9c+')='+_0x3d5e0f[_0x5e5f9c],_0x7cba('0x84')));_0x1e1f33+=0x1;}}_0x5e1318[_0x7cba('0x82')](new Extension(_0x3d5e0f,_0x1e1f33,'6',_0x7cba('0x8c')));_0x1e1f33+=0x1;_0x5e1318['push'](new Extension(_0x3d5e0f,_0x1e1f33,_0x7cba('0x8d'),_0x7cba('0x8e')));_0x1e1f33=0x0;return _0x5e1318;}exports['addAccountApplications']=function(_0x3a33f6,_0x37224d,_0x35a9a6){var _0x2085e5;return db[_0x7cba('0x8f')][_0x7cba('0x90')](function(_0x52b8be){return db[_0x7cba('0x3d')]['create'](_0x3a33f6[_0x7cba('0x59')],{'transaction':_0x52b8be})['then'](function(_0x390f7a){_0x2085e5=_0x390f7a['get']({'plain':!![]});return db[_0x7cba('0x91')][_0x7cba('0x92')](createExtensionsReciveFax(_0x2085e5),{'transaction':_0x52b8be});});})['then'](function(){return _0x2085e5;})['then'](respondWithResult(_0x37224d,null))[_0x7cba('0x52')](handleError(_0x37224d,null));};exports[_0x7cba('0x93')]=function(_0x52a489,_0x34aef3,_0x5147ff){var _0x3882f1;return db[_0x7cba('0x8f')][_0x7cba('0x90')](function(_0x26832c){return db[_0x7cba('0x3d')][_0x7cba('0x33')](_0x52a489[_0x7cba('0x59')],{'where':{'id':_0x52a489['body']['id']},'transaction':_0x26832c})[_0x7cba('0x22')](function(_0x3a7906){return db[_0x7cba('0x91')]['destroy']({'where':{'FaxAccountId':_0x52a489[_0x7cba('0x59')]['id']},'transaction':_0x26832c})['then'](function(_0xf60ff3){return db[_0x7cba('0x91')][_0x7cba('0x92')](createExtensionsReciveFax(_[_0x7cba('0x94')](_0x52a489['body'],[_0x7cba('0x95'),_0x7cba('0x96'),_0x7cba('0x97'),_0x7cba('0x98'),'TrunkId','ListId'])),{'transaction':_0x26832c});});});})[_0x7cba('0x22')](function(){return db['FaxAccount'][_0x7cba('0x99')](_0x52a489[_0x7cba('0x59')]['id']);})['then'](respondWithResult(_0x34aef3,null))[_0x7cba('0x52')](handleError(_0x34aef3,null));};exports[_0x7cba('0x9a')]=function(_0xb8466c,_0x42450e,_0x3c17eb){var _0x50a910={'raw':!![],'where':{}};var _0x53755c={};var _0x45ada2={'count':0x0,'rows':[]};return db[_0x7cba('0x3d')][_0x7cba('0x67')]({'where':{'id':_0xb8466c[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x42450e,null))[_0x7cba('0x22')](function(_0x278563){if(_0x278563){_0x53755c['model']=_[_0x7cba('0x41')](db[_0x7cba('0x9b')][_0x7cba('0x3e')]);_0x53755c[_0x7cba('0x42')]=_[_0x7cba('0x41')](_0xb8466c[_0x7cba('0x42')]);_0x53755c['filters']=_[_0x7cba('0x55')](_0x53755c['model'],_0x53755c[_0x7cba('0x42')]);_0x50a910['attributes']=_['intersection'](_0x53755c[_0x7cba('0x45')],qs[_0x7cba('0x46')](_0xb8466c['query'][_0x7cba('0x46')]));_0x50a910['attributes']=_0x50a910['attributes'][_0x7cba('0x47')]?_0x50a910[_0x7cba('0x44')]:_0x53755c[_0x7cba('0x45')];if(!_0xb8466c[_0x7cba('0x42')][_0x7cba('0x68')](_0x7cba('0x48'))){_0x50a910[_0x7cba('0x2e')]=qs[_0x7cba('0x2e')](_0xb8466c[_0x7cba('0x42')]['limit']);_0x50a910[_0x7cba('0x2d')]=qs['offset'](_0xb8466c['query'][_0x7cba('0x2d')]);}_0x50a910[_0x7cba('0x69')]=qs[_0x7cba('0x6a')](_0xb8466c[_0x7cba('0x42')][_0x7cba('0x6a')]);_0x50a910['where']=qs[_0x7cba('0x43')](_[_0x7cba('0x49')](_0xb8466c[_0x7cba('0x42')],_0x53755c['filters']));_0x50a910[_0x7cba('0x4b')][_0x7cba('0x64')]=_0x278563['id'];if(_0xb8466c[_0x7cba('0x42')][_0x7cba('0x4a')]){_0x50a910[_0x7cba('0x4b')]=_[_0x7cba('0x4c')](_0x50a910[_0x7cba('0x4b')],{'$or':_['map'](_0x50a910[_0x7cba('0x44')],function(_0x4d5b25){var _0x141bac={};_0x141bac[_0x4d5b25]={'$like':'%'+_0xb8466c[_0x7cba('0x42')][_0x7cba('0x4a')]+'%'};return _0x141bac;})});}if(_0xb8466c[_0x7cba('0x42')][_0x7cba('0x9c')]){var _0x42590a=_0xb8466c[_0x7cba('0x42')]['$gte'][_0x7cba('0x9d')](',');var _0x247755={};_0x247755[_0x42590a[0x0]]={'$gte':moment(_0x42590a[0x1])['format'](_0x7cba('0x9e'))};_0x50a910[_0x7cba('0x4b')]=_[_0x7cba('0x4c')](_0x50a910[_0x7cba('0x4b')],_0x247755);}_0x50a910=_['merge']({},_0x50a910,_0xb8466c[_0x7cba('0x4d')]);return db[_0x7cba('0x9b')][_0x7cba('0x4e')]({'where':_0x50a910[_0x7cba('0x4b')]})[_0x7cba('0x22')](function(_0x47537f){_0x45ada2['count']=_0x47537f;if(_0xb8466c['query']['includeAll']){_0x50a910[_0x7cba('0x56')]=[{'all':!![]}];}return db[_0x7cba('0x9b')][_0x7cba('0x50')](_0x50a910);})['then'](function(_0x4b4760){_0x45ada2[_0x7cba('0x51')]=_0x4b4760;return _0x45ada2;});}})[_0x7cba('0x22')](respondWithFilteredResult(_0x42450e,_0x50a910))[_0x7cba('0x52')](handleError(_0x42450e,null));};exports[_0x7cba('0x38')]=function(_0x30bf1e,_0x5a5fa5,_0x48862c){var _0x2a2db6,_0x2e0445={},_0x2dbbaf;if(_0x30bf1e[_0x7cba('0x59')]['to']){_0x2dbbaf=_0x30bf1e[_0x7cba('0x59')]['to'][0x0];}return db['FaxAccount'][_0x7cba('0x57')]({'where':{'id':_0x30bf1e[_0x7cba('0x54')]['id']},'include':[{'model':db[_0x7cba('0x9f')],'as':_0x7cba('0xa0'),'include':[{'model':db[_0x7cba('0xa1')],'as':'Contacts','where':{'fax':_0x2dbbaf},'limit':0x1,'order':[[_0x7cba('0x98'),_0x7cba('0xa2')]]}]}]})['then'](handleEntityNotFound(_0x5a5fa5,null))[_0x7cba('0x22')](function(_0xae351a){_0x2a2db6=_0xae351a;if(_0x30bf1e['body'][_0x7cba('0xa3')]&&_0x30bf1e[_0x7cba('0x59')]['attachments'][_0x7cba('0x47')]){for(var _0x2a6b67=0x0;_0x2a6b67<_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][_0x7cba('0x47')];_0x2a6b67+=0x1){_0x30bf1e[_0x7cba('0x59')]['attachments'][_0x2a6b67]={'filename':_0x30bf1e['body'][_0x7cba('0xa3')][_0x2a6b67][_0x7cba('0x37')],'id':_0x30bf1e['body'][_0x7cba('0xa3')][_0x2a6b67]['id'],'path':path[_0x7cba('0xa4')](config[_0x7cba('0xa5')],_0x7cba('0xa6'),_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][_0x2a6b67][_0x7cba('0xa7')])};}}return respondWithRpcPromise(_0x7cba('0xa8'),_0x7cba('0xa8'),{'FaxAccountId':_['isNil'](_0x30bf1e[_0x7cba('0x54')]['id'])?undefined:_0x30bf1e[_0x7cba('0x54')]['id'],'path':_[_0x7cba('0xa9')](_0x30bf1e['body'][_0x7cba('0xa3')][0x0]['path'])?undefined:_0x30bf1e[_0x7cba('0x59')]['attachments'][0x0]['path'],'fax':_[_0x7cba('0xa9')](_0x30bf1e[_0x7cba('0x59')]['to'][0x0])?undefined:_0x30bf1e[_0x7cba('0x59')]['to'][0x0]},client9002);})[_0x7cba('0x22')](function(){if(_0x2a2db6){if(_[_0x7cba('0xa9')](_0x30bf1e['body'][_0x7cba('0xaa')])){_0x30bf1e['body'][_0x7cba('0xaa')]=util[_0x7cba('0xab')](_0x7cba('0xac'),_0x2a2db6[_0x7cba('0x37')],_0x2a2db6['fax']);}if(_0x2a2db6[_0x7cba('0xa0')]){if(_0x2a2db6[_0x7cba('0xa0')]['Contacts'][_0x7cba('0x47')]){return _0x2a2db6[_0x7cba('0xa0')]['Contacts'][0x0];}else{return db['CmContact'][_0x7cba('0x58')](_[_0x7cba('0x1b')](_0x30bf1e[_0x7cba('0x59')],{'firstName':_0x30bf1e[_0x7cba('0x59')]['to'][0x0],'phone':_0x30bf1e[_0x7cba('0x59')]['to'][0x0],'fax':_0x30bf1e[_0x7cba('0x59')]['to'][0x0],'ListId':_0x2a2db6['ListId']}));}}else{throw new Error(_0x7cba('0xad'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x7cba('0x22')](function(_0x337f6c){if(_0x337f6c){return db[_0x7cba('0x70')][_0x7cba('0x57')]({'where':{'ContactId':_0x337f6c['id'],'closed':![],'FaxAccountId':_0x2a2db6['id']}})['then'](function(_0xcca374){if(_0xcca374){return[_0xcca374,![]];}return db[_0x7cba('0x70')][_0x7cba('0x58')]({'UserId':_0x30bf1e['user']['id'],'ContactId':_0x337f6c['id'],'FaxAccountId':_0x2a2db6['id'],'fax':_0x30bf1e[_0x7cba('0x59')]['to'][0x0],'firstMsgDirection':_0x7cba('0xae'),'Messages':[_['merge'](_0x30bf1e[_0x7cba('0x59')],{'read':![],'body':_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][0x0][_0x7cba('0xaf')],'FaxAccountId':_0x2a2db6['id'],'UserId':_0x30bf1e[_0x7cba('0x5a')]['id'],'ContactId':_0x337f6c['id'],'AttachmentId':_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][0x0]['id']})]},{'include':[{'model':db[_0x7cba('0x9b')],'as':'Messages'}]})[_0x7cba('0x22')](function(_0x115e08){return[_0x115e08,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x7cba('0xb0')](function(_0x73e441,_0x68d14b){if(_0x68d14b){return _0x73e441;}return db[_0x7cba('0x9b')][_0x7cba('0x58')]({'direction':_0x7cba('0xae'),'read':![],'body':_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][0x0][_0x7cba('0xaf')],'FaxAccountId':_0x2a2db6['id'],'FaxInteractionId':_0x73e441['id'],'UserId':_0x30bf1e[_0x7cba('0x5a')]['id'],'ContactId':_0x73e441[_0x7cba('0xb1')],'AttachmentId':_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][0x0]['id']})[_0x7cba('0x22')](function(_0x8b5a36){_0x73e441[_0x7cba('0xb2')][_0x7cba('0xb3')]=[];_0x73e441[_0x7cba('0xb2')][_0x7cba('0xb3')][_0x7cba('0x82')](_0x8b5a36[_0x7cba('0xb2')]);return _0x73e441;});})[_0x7cba('0x22')](function(_0x36b43a){respondWithRpcPromise(_0x7cba('0xb4'),_0x7cba('0xb4'),{'FaxAccountId':_[_0x7cba('0xa9')](_0x30bf1e[_0x7cba('0x54')]['id'])?undefined:_0x30bf1e[_0x7cba('0x54')]['id'],'path':_[_0x7cba('0xa9')](_0x30bf1e['body'][_0x7cba('0xa3')][0x0][_0x7cba('0x8')])?undefined:_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][0x0]['path'],'fax':_[_0x7cba('0xa9')](_0x30bf1e[_0x7cba('0x59')]['to'][0x0])?undefined:_0x30bf1e['body']['to'][0x0],'AttachmentId':_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][0x0]['id']},client9002)[_0x7cba('0x22')](function(_0x360ea9){logger[_0x7cba('0x28')](_0x7cba('0xb5'),_0x360ea9);})[_0x7cba('0x52')](function(_0x1cb9bc){logger[_0x7cba('0x28')](_0x7cba('0xb5'),_0x1cb9bc);});return _0x36b43a;})[_0x7cba('0x22')](respondWithResult(_0x5a5fa5,null))[_0x7cba('0x52')](handleError(_0x5a5fa5,null));};exports['addAgents']=function(_0x40d60c,_0x5e44d2,_0x550972){return db['FaxAccount']['find']({'where':{'id':_0x40d60c[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x5e44d2,null))[_0x7cba('0x22')](function(_0x36b83f){if(_0x36b83f){return _0x36b83f[_0x7cba('0xb6')](_0x40d60c['body']['ids'],_[_0x7cba('0x94')](_0x40d60c[_0x7cba('0x59')],['ids','id'])||{})[_0x7cba('0xb0')](function(_0x7d7449){for(var _0x59bff7=0x0;_0x59bff7<_0x40d60c[_0x7cba('0x59')][_0x7cba('0x6e')][_0x7cba('0x47')];_0x59bff7+=0x1){socket['emit']('userFaxAccount:save',{'UserId':_0x40d60c[_0x7cba('0x59')][_0x7cba('0x6e')][_0x59bff7],'FaxAccountId':_0x40d60c['params']['id']});}return _0x7d7449;});}})[_0x7cba('0x22')](respondWithResult(_0x5e44d2,null))['catch'](handleError(_0x5e44d2,null));};exports[_0x7cba('0xb7')]=function(_0x6d61c,_0x12e1ff,_0x3b11e1){return db[_0x7cba('0x3d')][_0x7cba('0x57')]({'where':{'id':_0x6d61c[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x12e1ff,null))['then'](function(_0x3cd4d4){if(_0x3cd4d4){return _0x3cd4d4[_0x7cba('0xb7')](_0x6d61c['query']['ids'])[_0x7cba('0x22')](function(){if(_['isArray'](_0x6d61c[_0x7cba('0x42')][_0x7cba('0x6e')])){for(var _0x3bf606=0x0;_0x3bf606<_0x6d61c[_0x7cba('0x42')]['ids'][_0x7cba('0x47')];_0x3bf606+=0x1){socket[_0x7cba('0xb8')](_0x7cba('0xb9'),{'UserId':Number(_0x6d61c[_0x7cba('0x42')][_0x7cba('0x6e')][_0x3bf606]),'FaxAccountId':Number(_0x6d61c[_0x7cba('0x54')]['id'])});}}else{socket[_0x7cba('0xb8')](_0x7cba('0xb9'),{'UserId':Number(_0x6d61c[_0x7cba('0x42')][_0x7cba('0x6e')]),'FaxAccountId':Number(_0x6d61c[_0x7cba('0x54')]['id'])});}});}})[_0x7cba('0x22')](respondWithStatusCode(_0x12e1ff,null))[_0x7cba('0x52')](handleError(_0x12e1ff,null));};exports['getAgents']=function(_0x24f90f,_0x5e93d9,_0x575436){var _0x38ce78={};var _0x41f6b2={};var _0x205d5b;var _0x419c99;return db[_0x7cba('0x3d')][_0x7cba('0x67')]({'where':{'id':_0x24f90f[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x5e93d9,null))[_0x7cba('0x22')](function(_0x5d18c7){if(_0x5d18c7){_0x205d5b=_0x5d18c7;_0x41f6b2[_0x7cba('0x45')]=_[_0x7cba('0x41')](db[_0x7cba('0x73')][_0x7cba('0x3e')]);_0x41f6b2[_0x7cba('0x42')]=_[_0x7cba('0x41')](_0x24f90f[_0x7cba('0x42')]);_0x41f6b2[_0x7cba('0x43')]=_[_0x7cba('0x55')](_0x41f6b2[_0x7cba('0x45')],_0x41f6b2['query']);_0x38ce78[_0x7cba('0x44')]=_['intersection'](_0x41f6b2[_0x7cba('0x45')],qs['fields'](_0x24f90f[_0x7cba('0x42')][_0x7cba('0x46')]));_0x38ce78[_0x7cba('0x44')]=_0x38ce78[_0x7cba('0x44')][_0x7cba('0x47')]?_0x38ce78[_0x7cba('0x44')]:_0x41f6b2[_0x7cba('0x45')];_0x38ce78[_0x7cba('0x69')]=qs['sort'](_0x24f90f[_0x7cba('0x42')]['sort']);_0x38ce78['where']=qs[_0x7cba('0x43')](_['pick'](_0x24f90f['query'],_0x41f6b2[_0x7cba('0x43')]));if(_0x24f90f['query'][_0x7cba('0x4a')]){_0x38ce78[_0x7cba('0x4b')]=_[_0x7cba('0x4c')](_0x38ce78[_0x7cba('0x4b')],{'$or':_[_0x7cba('0x3c')](_0x38ce78[_0x7cba('0x44')],function(_0x5e02f2){var _0x23512b={};_0x23512b[_0x5e02f2]={'$like':'%'+_0x24f90f[_0x7cba('0x42')][_0x7cba('0x4a')]+'%'};return _0x23512b;})});}_0x38ce78=_['merge']({},_0x38ce78,_0x24f90f[_0x7cba('0x4d')]);return _0x205d5b[_0x7cba('0xba')](_0x38ce78);}})[_0x7cba('0x22')](function(_0x55e2f3){if(_0x55e2f3){_0x419c99=_0x55e2f3[_0x7cba('0x47')];if(!_0x24f90f[_0x7cba('0x42')][_0x7cba('0x68')](_0x7cba('0x48'))){_0x38ce78[_0x7cba('0x2e')]=qs['limit'](_0x24f90f[_0x7cba('0x42')]['limit']);_0x38ce78[_0x7cba('0x2d')]=qs['offset'](_0x24f90f['query'][_0x7cba('0x2d')]);}return _0x205d5b[_0x7cba('0xba')](_0x38ce78);}})[_0x7cba('0x22')](function(_0x352b1e){if(_0x352b1e){return _0x352b1e?{'count':_0x419c99,'rows':_0x352b1e}:null;}})[_0x7cba('0x22')](respondWithResult(_0x5e93d9,null))[_0x7cba('0x52')](handleError(_0x5e93d9,null));}; \ No newline at end of file +var _0x5692=['limit','status','set','Content-Range','reject','save','update','destroy','get','name','send','index','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','Pause','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','getDispositions','findOne','FaxAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','exten','localstationid','app','system','description','appdata','push','Set','faxdetect','headerinfo','minrate','modem','t38timeout','FAXOPT(','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','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','fax','out','filename','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','debug','stringify','error','message','FaxAccount,\x20%s,\x20%s','request\x20sent','catch','end','json','count','offset'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5692,0x14a));var _0x2569=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5692[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x2569('0x0'));var emlformat=require(_0x2569('0x1'));var rimraf=require(_0x2569('0x2'));var zipdir=require(_0x2569('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2569('0x4'));var moment=require(_0x2569('0x5'));var BPromise=require(_0x2569('0x6'));var Mustache=require(_0x2569('0x7'));var util=require(_0x2569('0x8'));var path=require(_0x2569('0x9'));var sox=require('sox');var csv=require(_0x2569('0xa'));var ejs=require(_0x2569('0xb'));var fs=require('fs');var _=require(_0x2569('0xc'));var squel=require(_0x2569('0xd'));var crypto=require(_0x2569('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2569('0xf'));var toCsv=require(_0x2569('0xa'));var querystring=require('querystring');var Papa=require(_0x2569('0x10'));var Redis=require(_0x2569('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2569('0x12'));var as=require(_0x2569('0x13'));var hardwareService=require(_0x2569('0x14'));var logger=require(_0x2569('0x15'))(_0x2569('0x16'));var utils=require(_0x2569('0x17'));var config=require(_0x2569('0x18'));var licenseUtil=require(_0x2569('0x19'));var db=require('../../mysqldb')['db'];config[_0x2569('0x1a')]=_[_0x2569('0x1b')](config[_0x2569('0x1a')],{'host':_0x2569('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2569('0x1d'))[_0x2569('0x1e')](socket);var jayson=require(_0x2569('0x1f'));var client=jayson[_0x2569('0x20')][_0x2569('0x21')]({'port':0x232c});var client9002=jayson[_0x2569('0x20')][_0x2569('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x47f097,_0x110076,_0x5f0698,_0x8dfaf2){return new BPromise(function(_0x11de09,_0x4fe3fc){var _0x1decc4=_0x8dfaf2||client;return _0x1decc4[_0x2569('0x22')](_0x47f097,_0x5f0698)[_0x2569('0x23')](function(_0x1bf543){logger[_0x2569('0x24')]('FaxAccount,\x20%s,\x20%s',_0x110076,'request\x20sent');logger[_0x2569('0x25')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x110076,'request\x20sent',JSON[_0x2569('0x26')](_0x1bf543));if(_0x1bf543[_0x2569('0x27')]){if(_0x1bf543[_0x2569('0x27')]['code']===0x1f4){logger[_0x2569('0x27')]('FaxAccount,\x20%s,\x20%s',_0x110076,_0x1bf543['error'][_0x2569('0x28')]);return _0x4fe3fc(_0x1bf543[_0x2569('0x27')][_0x2569('0x28')]);}logger[_0x2569('0x27')](_0x2569('0x29'),_0x110076,_0x1bf543[_0x2569('0x27')][_0x2569('0x28')]);return _0x11de09(_0x1bf543[_0x2569('0x27')][_0x2569('0x28')]);}else{logger[_0x2569('0x24')]('FaxAccount,\x20%s,\x20%s',_0x110076,_0x2569('0x2a'));_0x11de09(_0x1bf543['result'][_0x2569('0x28')]);}})[_0x2569('0x2b')](function(_0x18ca8d){logger[_0x2569('0x27')](_0x2569('0x29'),_0x110076,_0x18ca8d);_0x4fe3fc(_0x18ca8d);});});}function respondWithStatusCode(_0x424757,_0x53b31f){_0x53b31f=_0x53b31f||0xcc;return function(_0x11985b){if(_0x11985b){return _0x424757['sendStatus'](_0x53b31f);}return _0x424757['status'](_0x53b31f)[_0x2569('0x2c')]();};}function respondWithResult(_0xdfe96b,_0x18ebbe){_0x18ebbe=_0x18ebbe||0xc8;return function(_0x40262c){if(_0x40262c){return _0xdfe96b['status'](_0x18ebbe)[_0x2569('0x2d')](_0x40262c);}};}function respondWithFilteredResult(_0x40fab0,_0x236672){return function(_0x12150f){if(_0x12150f){var _0x44a7b7=_0x12150f[_0x2569('0x2e')],_0x3ddb37=_0x236672[_0x2569('0x2f')],_0xd3faea=_0x236672[_0x2569('0x2f')]+_0x236672[_0x2569('0x30')],_0x214b6d;if(_0xd3faea>=_0x44a7b7){_0xd3faea=_0x44a7b7;_0x214b6d=0xc8;}else{_0x214b6d=0xce;}_0x40fab0[_0x2569('0x31')](_0x214b6d);return _0x40fab0[_0x2569('0x32')](_0x2569('0x33'),_0x3ddb37+'-'+_0xd3faea+'/'+_0x44a7b7)[_0x2569('0x2d')](_0x12150f);}return null;};}function patchUpdates(_0x33fba1){return function(_0x28e700){try{jsonpatch['apply'](_0x28e700,_0x33fba1,!![]);}catch(_0x45cad0){return BPromise[_0x2569('0x34')](_0x45cad0);}return _0x28e700[_0x2569('0x35')]();};}function saveUpdates(_0x322555,_0x2a1a05){return function(_0x39efca){if(_0x39efca){return _0x39efca[_0x2569('0x36')](_0x322555)['then'](function(_0x1cb5cb){return _0x1cb5cb;});}return null;};}function removeEntity(_0x462d00,_0x30252d){return function(_0x71820e){if(_0x71820e){return _0x71820e[_0x2569('0x37')]()[_0x2569('0x23')](function(){var _0x4154d4=_0x71820e[_0x2569('0x38')]({'plain':!![]});var _0x1608b7='FaxAccounts';return db['UserProfileResource'][_0x2569('0x37')]({'where':{'type':_0x1608b7,'resourceId':_0x4154d4['id']}})[_0x2569('0x23')](function(){return _0x71820e;});})[_0x2569('0x23')](function(){_0x462d00['status'](0xcc)[_0x2569('0x2c')]();});}};}function handleEntityNotFound(_0x115898,_0x9554af){return function(_0x3e5c2c){if(!_0x3e5c2c){_0x115898['sendStatus'](0x194);}return _0x3e5c2c;};}function handleError(_0x47ddec,_0x60c036){_0x60c036=_0x60c036||0x1f4;return function(_0x1365e4){logger[_0x2569('0x27')](_0x1365e4['stack']);if(_0x1365e4[_0x2569('0x39')]){delete _0x1365e4[_0x2569('0x39')];}_0x47ddec[_0x2569('0x31')](_0x60c036)[_0x2569('0x3a')](_0x1365e4);};}exports[_0x2569('0x3b')]=function(_0x73cf6d,_0x3a60df){var _0x3893f3={'include':[{'model':db['Pause'],'as':_0x2569('0x3c')}]},_0x2f9fcb={},_0x2ac7fb={'count':0x0,'rows':[]};var _0x3c577f=_['map'](db[_0x2569('0x3d')][_0x2569('0x3e')],function(_0xa5b59f){return{'name':_0xa5b59f[_0x2569('0x3f')],'type':_0xa5b59f[_0x2569('0x40')][_0x2569('0x41')]};});_0x2f9fcb[_0x2569('0x42')]=_[_0x2569('0x43')](_0x3c577f,_0x2569('0x39'));_0x2f9fcb[_0x2569('0x44')]=_[_0x2569('0x45')](_0x73cf6d[_0x2569('0x44')]);_0x2f9fcb[_0x2569('0x46')]=_[_0x2569('0x47')](_0x2f9fcb[_0x2569('0x42')],_0x2f9fcb[_0x2569('0x44')]);_0x3893f3[_0x2569('0x48')]=_['intersection'](_0x2f9fcb[_0x2569('0x42')],qs[_0x2569('0x49')](_0x73cf6d[_0x2569('0x44')][_0x2569('0x49')]));_0x3893f3[_0x2569('0x48')]=_0x3893f3[_0x2569('0x48')][_0x2569('0x4a')]?_0x3893f3[_0x2569('0x48')]:_0x2f9fcb[_0x2569('0x42')];if(!_0x73cf6d[_0x2569('0x44')][_0x2569('0x4b')](_0x2569('0x4c'))){_0x3893f3[_0x2569('0x30')]=qs['limit'](_0x73cf6d[_0x2569('0x44')]['limit']);_0x3893f3[_0x2569('0x2f')]=qs[_0x2569('0x2f')](_0x73cf6d[_0x2569('0x44')][_0x2569('0x2f')]);}_0x3893f3[_0x2569('0x4d')]=qs[_0x2569('0x4e')](_0x73cf6d['query']['sort']);_0x3893f3[_0x2569('0x4f')]=qs[_0x2569('0x46')](_[_0x2569('0x50')](_0x73cf6d[_0x2569('0x44')],_0x2f9fcb[_0x2569('0x46')]),_0x3c577f);if(_0x73cf6d[_0x2569('0x44')][_0x2569('0x51')]){_0x3893f3[_0x2569('0x4f')]=_[_0x2569('0x52')](_0x3893f3['where'],{'$or':_[_0x2569('0x43')](_0x3c577f,function(_0x1c3508){if(_0x1c3508[_0x2569('0x40')]!==_0x2569('0x53')){var _0x4a6e7f={};_0x4a6e7f[_0x1c3508[_0x2569('0x39')]]={'$like':'%'+_0x73cf6d[_0x2569('0x44')]['filter']+'%'};return _0x4a6e7f;}})});}_0x3893f3=_[_0x2569('0x52')]({},_0x3893f3,_0x73cf6d[_0x2569('0x54')]);var _0x3bb440={'where':_0x3893f3['where']};return db['FaxAccount'][_0x2569('0x2e')](_0x3bb440)['then'](function(_0x477753){_0x2ac7fb[_0x2569('0x2e')]=_0x477753;if(_0x73cf6d['query'][_0x2569('0x55')]){_0x3893f3[_0x2569('0x56')]=[{'all':!![]}];}return db[_0x2569('0x3d')][_0x2569('0x57')](_0x3893f3);})[_0x2569('0x23')](function(_0x2da8d4){_0x2ac7fb[_0x2569('0x58')]=_0x2da8d4;return _0x2ac7fb;})[_0x2569('0x23')](respondWithFilteredResult(_0x3a60df,_0x3893f3))[_0x2569('0x2b')](handleError(_0x3a60df,null));};exports[_0x2569('0x59')]=function(_0x38b4b4,_0x3f3fc6){var _0x55084f={'raw':![],'where':{'id':_0x38b4b4['params']['id']},'include':[{'model':db[_0x2569('0x5a')],'as':'mandatoryDispositionPause'}]},_0x51d862={};_0x51d862[_0x2569('0x42')]=_[_0x2569('0x45')](db[_0x2569('0x3d')][_0x2569('0x3e')]);_0x51d862['query']=_[_0x2569('0x45')](_0x38b4b4[_0x2569('0x44')]);_0x51d862[_0x2569('0x46')]=_[_0x2569('0x47')](_0x51d862[_0x2569('0x42')],_0x51d862[_0x2569('0x44')]);_0x55084f[_0x2569('0x48')]=_[_0x2569('0x47')](_0x51d862['model'],qs[_0x2569('0x49')](_0x38b4b4['query'][_0x2569('0x49')]));_0x55084f[_0x2569('0x48')]=_0x55084f[_0x2569('0x48')]['length']?_0x55084f[_0x2569('0x48')]:_0x51d862[_0x2569('0x42')];if(_0x38b4b4[_0x2569('0x44')][_0x2569('0x55')]){_0x55084f[_0x2569('0x56')]=[{'all':!![]}];}_0x55084f=_['merge']({},_0x55084f,_0x38b4b4[_0x2569('0x54')]);return db[_0x2569('0x3d')]['find'](_0x55084f)[_0x2569('0x23')](handleEntityNotFound(_0x3f3fc6,null))['then'](respondWithResult(_0x3f3fc6,null))['catch'](handleError(_0x3f3fc6,null));};exports['create']=function(_0x4debfe,_0x185cb6){return db[_0x2569('0x3d')]['create'](_0x4debfe[_0x2569('0x5b')],{})[_0x2569('0x23')](function(_0x3780d5){var _0x49cde5=_0x4debfe[_0x2569('0x5c')]['get']({'plain':!![]});if(!_0x49cde5)throw new Error(_0x2569('0x5d'));if(_0x49cde5[_0x2569('0x5e')]===_0x2569('0x5c')){var _0x47e25d=_0x3780d5[_0x2569('0x38')]({'plain':!![]});var _0x4305d1=_0x2569('0x5f');return db[_0x2569('0x60')][_0x2569('0x61')]({'where':{'name':_0x4305d1,'userProfileId':_0x49cde5[_0x2569('0x62')]},'raw':!![]})[_0x2569('0x23')](function(_0x5ba2f3){if(_0x5ba2f3&&_0x5ba2f3[_0x2569('0x63')]===0x0){return db['UserProfileResource'][_0x2569('0x64')]({'name':_0x47e25d[_0x2569('0x39')],'resourceId':_0x47e25d['id'],'type':_0x5ba2f3['name'],'sectionId':_0x5ba2f3['id']},{})[_0x2569('0x23')](function(){return _0x3780d5;});}else{return _0x3780d5;}})[_0x2569('0x2b')](function(_0x1f118d){logger[_0x2569('0x27')](_0x2569('0x65'),_0x1f118d);throw _0x1f118d;});}return _0x3780d5;})[_0x2569('0x23')](respondWithResult(_0x185cb6,0xc9))[_0x2569('0x2b')](handleError(_0x185cb6,null));};exports['update']=function(_0x38516d,_0x52c00f){if(_0x38516d[_0x2569('0x5b')]['id']){delete _0x38516d[_0x2569('0x5b')]['id'];}return db['FaxAccount'][_0x2569('0x61')]({'where':{'id':_0x38516d[_0x2569('0x66')]['id']},'include':[{'model':db['Pause'],'as':_0x2569('0x3c')}]})['then'](handleEntityNotFound(_0x52c00f,null))[_0x2569('0x23')](saveUpdates(_0x38516d[_0x2569('0x5b')],null))[_0x2569('0x23')](respondWithResult(_0x52c00f,null))['catch'](handleError(_0x52c00f,null));};exports['destroy']=function(_0x46a464,_0x404e59){return db[_0x2569('0x3d')][_0x2569('0x61')]({'where':{'id':_0x46a464['params']['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x404e59,null))['then'](removeEntity(_0x404e59,null))[_0x2569('0x2b')](handleError(_0x404e59,null));};exports[_0x2569('0x67')]=function(_0x349022,_0x1363a3){return db['FaxAccount'][_0x2569('0x67')]()[_0x2569('0x23')](respondWithResult(_0x1363a3,null))[_0x2569('0x2b')](handleError(_0x1363a3,null));};exports['addDisposition']=function(_0x5a42ba,_0x41612e,_0x30d003){if(_0x5a42ba[_0x2569('0x5b')]['id']){delete _0x5a42ba[_0x2569('0x5b')]['id'];}return db['FaxAccount'][_0x2569('0x61')]({'where':{'id':_0x5a42ba['params']['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x41612e,null))[_0x2569('0x23')](function(_0x3810e8){if(_0x3810e8){_0x5a42ba[_0x2569('0x5b')]['FaxAccountId']=_0x3810e8['id'];return db[_0x2569('0x68')][_0x2569('0x64')](_0x5a42ba[_0x2569('0x5b')]);}})[_0x2569('0x23')](respondWithResult(_0x41612e,null))[_0x2569('0x2b')](handleError(_0x41612e,null));};exports[_0x2569('0x69')]=function(_0x3b54f8,_0x56db3,_0x390299){var _0x54f737={'raw':![],'where':{}};var _0x1c8369={};var _0x5cb993={'count':0x0,'rows':[]};return db[_0x2569('0x3d')][_0x2569('0x6a')]({'where':{'id':_0x3b54f8[_0x2569('0x66')]['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x56db3,null))[_0x2569('0x23')](function(_0x43b98d){if(_0x43b98d){_0x1c8369[_0x2569('0x42')]=_[_0x2569('0x45')](db[_0x2569('0x68')]['rawAttributes']);_0x1c8369['query']=_[_0x2569('0x45')](_0x3b54f8[_0x2569('0x44')]);_0x1c8369[_0x2569('0x46')]=_['intersection'](_0x1c8369[_0x2569('0x42')],_0x1c8369[_0x2569('0x44')]);_0x54f737['attributes']=_[_0x2569('0x47')](_0x1c8369[_0x2569('0x42')],qs[_0x2569('0x49')](_0x3b54f8['query']['fields']));_0x54f737['attributes']=_0x54f737[_0x2569('0x48')][_0x2569('0x4a')]?_0x54f737[_0x2569('0x48')]:_0x1c8369[_0x2569('0x42')];if(!_0x3b54f8[_0x2569('0x44')]['hasOwnProperty']('nolimit')){_0x54f737[_0x2569('0x30')]=qs[_0x2569('0x30')](_0x3b54f8[_0x2569('0x44')][_0x2569('0x30')]);_0x54f737[_0x2569('0x2f')]=qs['offset'](_0x3b54f8[_0x2569('0x44')][_0x2569('0x2f')]);}_0x54f737['order']=qs[_0x2569('0x4e')](_0x3b54f8[_0x2569('0x44')][_0x2569('0x4e')]);_0x54f737[_0x2569('0x4f')]=qs[_0x2569('0x46')](_[_0x2569('0x50')](_0x3b54f8[_0x2569('0x44')],_0x1c8369[_0x2569('0x46')]));_0x54f737[_0x2569('0x4f')][_0x2569('0x6b')]=_0x43b98d['id'];if(_0x3b54f8['query']['filter']){_0x54f737[_0x2569('0x4f')]=_['merge'](_0x54f737[_0x2569('0x4f')],{'$or':_[_0x2569('0x43')](_0x54f737[_0x2569('0x48')],function(_0x4d3c30){var _0x49b71b={};_0x49b71b[_0x4d3c30]={'$like':'%'+_0x3b54f8[_0x2569('0x44')][_0x2569('0x51')]+'%'};return _0x49b71b;})});}_0x54f737=_[_0x2569('0x52')]({},_0x54f737,_0x3b54f8[_0x2569('0x54')]);return db[_0x2569('0x68')]['count']({'where':_0x54f737[_0x2569('0x4f')]})[_0x2569('0x23')](function(_0x44333a){_0x5cb993[_0x2569('0x2e')]=_0x44333a;if(_0x3b54f8['query'][_0x2569('0x55')]){_0x54f737[_0x2569('0x56')]=[{'all':!![]}];}return db[_0x2569('0x68')][_0x2569('0x57')](_0x54f737);})['then'](function(_0x20ab0f){_0x5cb993['rows']=_0x20ab0f;return _0x5cb993;});}})[_0x2569('0x23')](respondWithFilteredResult(_0x56db3,_0x54f737))[_0x2569('0x2b')](handleError(_0x56db3,null));};exports[_0x2569('0x6c')]=function(_0x55234b,_0x929c7,_0x1947cc){return db['FaxAccount'][_0x2569('0x61')]({'where':{'id':_0x55234b[_0x2569('0x66')]['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x929c7,null))[_0x2569('0x23')](function(_0x5222ee){if(_0x5222ee){return _0x5222ee[_0x2569('0x6c')](_0x55234b['query'][_0x2569('0x6d')]);}})[_0x2569('0x23')](respondWithStatusCode(_0x929c7,null))[_0x2569('0x2b')](handleError(_0x929c7,null));};exports[_0x2569('0x6e')]=function(_0x2c3b65,_0x3c2644,_0x473b63){if(_0x2c3b65[_0x2569('0x5b')]['id']){delete _0x2c3b65[_0x2569('0x5b')]['id'];}return db[_0x2569('0x3d')][_0x2569('0x61')]({'where':{'id':_0x2c3b65[_0x2569('0x66')]['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x3c2644,null))[_0x2569('0x23')](function(_0x820884){if(_0x820884){_0x2c3b65[_0x2569('0x5b')][_0x2569('0x6b')]=_0x820884['id'];return db[_0x2569('0x6f')][_0x2569('0x64')](_0x2c3b65['body']);}})[_0x2569('0x23')](respondWithResult(_0x3c2644,null))[_0x2569('0x2b')](handleError(_0x3c2644,null));};exports[_0x2569('0x70')]=function(_0x96754c,_0x26edc9,_0x19f757){var _0xad6621={'raw':![],'where':{}};var _0x5c45a3={};var _0x2f4975={'count':0x0,'rows':[]};return db[_0x2569('0x3d')][_0x2569('0x6a')]({'where':{'id':_0x96754c[_0x2569('0x66')]['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x26edc9,null))['then'](function(_0x659447){if(_0x659447){_0x5c45a3['model']=_['keys'](db[_0x2569('0x6f')][_0x2569('0x3e')]);_0x5c45a3[_0x2569('0x44')]=_[_0x2569('0x45')](_0x96754c[_0x2569('0x44')]);_0x5c45a3[_0x2569('0x46')]=_[_0x2569('0x47')](_0x5c45a3[_0x2569('0x42')],_0x5c45a3[_0x2569('0x44')]);_0xad6621['attributes']=_[_0x2569('0x47')](_0x5c45a3['model'],qs[_0x2569('0x49')](_0x96754c[_0x2569('0x44')][_0x2569('0x49')]));_0xad6621['attributes']=_0xad6621['attributes'][_0x2569('0x4a')]?_0xad6621['attributes']:_0x5c45a3[_0x2569('0x42')];if(!_0x96754c[_0x2569('0x44')][_0x2569('0x4b')](_0x2569('0x4c'))){_0xad6621['limit']=qs[_0x2569('0x30')](_0x96754c['query'][_0x2569('0x30')]);_0xad6621['offset']=qs['offset'](_0x96754c[_0x2569('0x44')][_0x2569('0x2f')]);}_0xad6621[_0x2569('0x4d')]=qs['sort'](_0x96754c['query'][_0x2569('0x4e')]);_0xad6621['where']=qs['filters'](_[_0x2569('0x50')](_0x96754c['query'],_0x5c45a3[_0x2569('0x46')]));_0xad6621[_0x2569('0x4f')][_0x2569('0x6b')]=_0x659447['id'];if(_0x96754c[_0x2569('0x44')]['filter']){_0xad6621[_0x2569('0x4f')]=_[_0x2569('0x52')](_0xad6621[_0x2569('0x4f')],{'$or':_[_0x2569('0x43')](_0xad6621[_0x2569('0x48')],function(_0x5acdeb){var _0x20464d={};_0x20464d[_0x5acdeb]={'$like':'%'+_0x96754c[_0x2569('0x44')]['filter']+'%'};return _0x20464d;})});}_0xad6621=_[_0x2569('0x52')]({},_0xad6621,_0x96754c['options']);return db[_0x2569('0x6f')]['count']({'where':_0xad6621[_0x2569('0x4f')]})[_0x2569('0x23')](function(_0x2c1ea6){_0x2f4975[_0x2569('0x2e')]=_0x2c1ea6;if(_0x96754c['query'][_0x2569('0x55')]){_0xad6621[_0x2569('0x56')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0xad6621);})[_0x2569('0x23')](function(_0x179551){_0x2f4975[_0x2569('0x58')]=_0x179551;return _0x2f4975;});}})[_0x2569('0x23')](respondWithFilteredResult(_0x26edc9,_0xad6621))[_0x2569('0x2b')](handleError(_0x26edc9,null));};exports[_0x2569('0x71')]=function(_0x23a1c4,_0x50032b,_0x4e7ea0){return db[_0x2569('0x3d')]['find']({'where':{'id':_0x23a1c4['params']['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x50032b,null))[_0x2569('0x23')](function(_0x2aabfe){if(_0x2aabfe){return _0x2aabfe[_0x2569('0x71')](_0x23a1c4[_0x2569('0x44')][_0x2569('0x6d')]);}})[_0x2569('0x23')](respondWithStatusCode(_0x50032b,null))[_0x2569('0x2b')](handleError(_0x50032b,null));};exports['addInteraction']=function(_0x350282,_0x122947,_0x44b409){return db[_0x2569('0x72')][_0x2569('0x61')]({'where':{'id':_0x350282[_0x2569('0x66')]['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x122947,null))[_0x2569('0x23')](function(_0x35e47d){if(_0x35e47d){return _0x35e47d[_0x2569('0x73')](_0x350282[_0x2569('0x5b')][_0x2569('0x6d')],_[_0x2569('0x74')](_0x350282['body'],[_0x2569('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x122947,null))['catch'](handleError(_0x122947,null));};exports['getInteractions']=function(_0x4cfbd6,_0x159ee2,_0x13fb03){var _0x18ce24={'raw':![],'where':{}};var _0x309282={};var _0x1cb9fe={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x4cfbd6[_0x2569('0x66')]['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x159ee2,null))[_0x2569('0x23')](function(_0x28a98b){if(_0x28a98b){_0x309282[_0x2569('0x42')]=_[_0x2569('0x45')](db['FaxInteraction'][_0x2569('0x3e')]);_0x309282['query']=_['keys'](_0x4cfbd6[_0x2569('0x44')]);_0x309282[_0x2569('0x46')]=_['intersection'](_0x309282[_0x2569('0x42')],_0x309282[_0x2569('0x44')]);_0x18ce24['attributes']=_[_0x2569('0x47')](_0x309282['model'],qs[_0x2569('0x49')](_0x4cfbd6[_0x2569('0x44')][_0x2569('0x49')]));_0x18ce24['attributes']=_0x18ce24[_0x2569('0x48')][_0x2569('0x4a')]?_0x18ce24[_0x2569('0x48')]:_0x309282[_0x2569('0x42')];if(!_0x4cfbd6[_0x2569('0x44')][_0x2569('0x4b')](_0x2569('0x4c'))){_0x18ce24[_0x2569('0x30')]=qs['limit'](_0x4cfbd6[_0x2569('0x44')][_0x2569('0x30')]);_0x18ce24[_0x2569('0x2f')]=qs[_0x2569('0x2f')](_0x4cfbd6['query']['offset']);}_0x18ce24[_0x2569('0x4d')]=qs[_0x2569('0x4e')](_0x4cfbd6[_0x2569('0x44')][_0x2569('0x4e')]);_0x18ce24[_0x2569('0x4f')]=qs[_0x2569('0x46')](_[_0x2569('0x50')](_0x4cfbd6[_0x2569('0x44')],_0x309282[_0x2569('0x46')]));_0x18ce24[_0x2569('0x4f')][_0x2569('0x6b')]=_0x28a98b['id'];if(_0x4cfbd6[_0x2569('0x44')][_0x2569('0x51')]){_0x18ce24[_0x2569('0x4f')]=_[_0x2569('0x52')](_0x18ce24[_0x2569('0x4f')],{'$or':_['map'](_0x18ce24[_0x2569('0x48')],function(_0x229f2c){var _0x1a8f80={};_0x1a8f80[_0x229f2c]={'$like':'%'+_0x4cfbd6['query'][_0x2569('0x51')]+'%'};return _0x1a8f80;})});}_0x18ce24=_['merge']({},_0x18ce24,_0x4cfbd6[_0x2569('0x54')]);return db[_0x2569('0x72')][_0x2569('0x2e')]({'where':_0x18ce24['where']})[_0x2569('0x23')](function(_0x47cea7){_0x1cb9fe[_0x2569('0x2e')]=_0x47cea7;if(_0x4cfbd6[_0x2569('0x44')][_0x2569('0x55')]){_0x18ce24[_0x2569('0x56')]=[{'model':db[_0x2569('0x75')],'as':_0x2569('0x76'),'required':![]},{'model':db[_0x2569('0x77')],'as':_0x2569('0x78'),'attributes':[_0x2569('0x39'),_0x2569('0x79'),_0x2569('0x7a')],'required':![]},{'model':db[_0x2569('0x7b')],'as':_0x2569('0x7c'),'attributes':['id',_0x2569('0x39'),_0x2569('0x7d')],'where':_0x4cfbd6['query'][_0x2569('0x7e')]?{'id':_0x4cfbd6[_0x2569('0x44')][_0x2569('0x7e')]}:undefined,'required':_0x4cfbd6[_0x2569('0x44')][_0x2569('0x7e')]?!![]:![]}];}return db[_0x2569('0x72')][_0x2569('0x57')](_0x18ce24);})[_0x2569('0x23')](function(_0x3f7a90){_0x1cb9fe[_0x2569('0x58')]=_0x3f7a90;return _0x1cb9fe;});}})['then'](respondWithFilteredResult(_0x159ee2,_0x18ce24))[_0x2569('0x2b')](handleError(_0x159ee2,null));};exports[_0x2569('0x7f')]=function(_0x526dbb,_0x24e43e,_0x50ad82){return db[_0x2569('0x3d')][_0x2569('0x6a')]({'where':{'id':_0x526dbb[_0x2569('0x66')]['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x24e43e,null))[_0x2569('0x23')](function(_0x3f3850){if(_0x3f3850){return db[_0x2569('0x80')][_0x2569('0x81')](function(_0x2ffe28){return db[_0x2569('0x82')][_0x2569('0x37')]({'where':{'FaxAccountId':_0x526dbb[_0x2569('0x66')]['id']},'transaction':_0x2ffe28})[_0x2569('0x23')](function(_0xd87254){var _0x355a8e=_[_0x2569('0x43')](_0x526dbb['body'],function(_0x46d9cc){_0x46d9cc['FaxAccountId']=_0x526dbb['params']['id'];return _0x46d9cc;});return db[_0x2569('0x82')][_0x2569('0x83')](_0x355a8e,{'transaction':_0x2ffe28});});})['then'](function(){return db[_0x2569('0x82')][_0x2569('0x84')]({'where':{'FaxAccountId':_0x526dbb[_0x2569('0x66')]['id']},'order':_0x2569('0x85')});});}})['then'](respondWithResult(_0x24e43e,null))['catch'](handleError(_0x24e43e,null));};exports[_0x2569('0x86')]=function(_0x32af08,_0x489508,_0x3deb58){var _0x57351a={};var _0x290bfd={};var _0x3c5a5d;var _0x283eaa;return db[_0x2569('0x3d')]['findOne']({'where':{'id':_0x32af08[_0x2569('0x66')]['id']}})['then'](handleEntityNotFound(_0x489508,null))[_0x2569('0x23')](function(_0x7f8b02){if(_0x7f8b02){_0x3c5a5d=_0x7f8b02;_0x290bfd[_0x2569('0x42')]=_[_0x2569('0x45')](db['FaxApplication'][_0x2569('0x3e')]);_0x290bfd[_0x2569('0x44')]=_[_0x2569('0x45')](_0x32af08['query']);_0x290bfd[_0x2569('0x46')]=_[_0x2569('0x47')](_0x290bfd[_0x2569('0x42')],_0x290bfd[_0x2569('0x44')]);_0x57351a[_0x2569('0x48')]=_[_0x2569('0x47')](_0x290bfd['model'],qs['fields'](_0x32af08[_0x2569('0x44')][_0x2569('0x49')]));_0x57351a[_0x2569('0x48')]=_0x57351a['attributes']['length']?_0x57351a['attributes']:_0x290bfd[_0x2569('0x42')];_0x57351a['order']=qs['sort'](_0x32af08[_0x2569('0x44')]['sort']);_0x57351a[_0x2569('0x4f')]=qs[_0x2569('0x46')](_[_0x2569('0x50')](_0x32af08[_0x2569('0x44')],_0x290bfd[_0x2569('0x46')]));if(_0x32af08['query']['filter']){_0x57351a[_0x2569('0x4f')]=_[_0x2569('0x52')](_0x57351a[_0x2569('0x4f')],{'$or':_[_0x2569('0x43')](_0x57351a[_0x2569('0x48')],function(_0x5d9285){var _0x251054={};_0x251054[_0x5d9285]={'$like':'%'+_0x32af08[_0x2569('0x44')][_0x2569('0x51')]+'%'};return _0x251054;})});}_0x57351a=_[_0x2569('0x52')]({},_0x57351a,_0x32af08[_0x2569('0x54')]);return _0x3c5a5d['getApplications'](_0x57351a);}})[_0x2569('0x23')](function(_0x58531d){if(_0x58531d){_0x283eaa=_0x58531d[_0x2569('0x4a')];if(!_0x32af08[_0x2569('0x44')][_0x2569('0x4b')](_0x2569('0x4c'))){_0x57351a[_0x2569('0x30')]=qs[_0x2569('0x30')](_0x32af08[_0x2569('0x44')][_0x2569('0x30')]);_0x57351a[_0x2569('0x2f')]=qs[_0x2569('0x2f')](_0x32af08[_0x2569('0x44')][_0x2569('0x2f')]);}return _0x3c5a5d[_0x2569('0x86')](_0x57351a);}})[_0x2569('0x23')](function(_0x43a1cb){if(_0x43a1cb){return _0x43a1cb?{'count':_0x283eaa,'rows':_0x43a1cb}:null;}})[_0x2569('0x23')](respondWithResult(_0x489508,null))[_0x2569('0x2b')](handleError(_0x489508,null));};function Extension(_0x504504,_0x2d213f,_0x18d529,_0x3cee86){this[_0x2569('0x87')]='from-voip-provider';this[_0x2569('0x88')]=_0x504504[_0x2569('0x89')];this[_0x2569('0x8a')]=_0x3cee86;this[_0x2569('0x40')]=_0x2569('0x8b');this[_0x2569('0x8c')]='Fax\x20Extension';this[_0x2569('0x6b')]=_0x504504['id'];this[_0x2569('0x85')]=_0x2d213f;this[_0x2569('0x8d')]=_0x18d529;}function createExtensionsReciveFax(_0x1dd4db){var _0x4d4ff1=0x1;var _0x8a48c0=[];_0x8a48c0[_0x2569('0x8e')](new Extension(_0x1dd4db,_0x4d4ff1,'','Answer'));_0x4d4ff1+=0x1;_0x8a48c0['push'](new Extension(_0x1dd4db,_0x4d4ff1,'CDR(type)=inbound-fax',_0x2569('0x8f')));_0x4d4ff1+=0x1;for(var _0x1a72a7 in _0x1dd4db){if(_0x1dd4db[_0x2569('0x4b')](_0x1a72a7)&&(_0x1a72a7==='ecm'||_0x1a72a7==='localstationid'||_0x1a72a7==='gateway'||_0x1a72a7===_0x2569('0x90')||_0x1a72a7===_0x2569('0x91')||_0x1a72a7==='maxrate'||_0x1a72a7===_0x2569('0x92')||_0x1a72a7===_0x2569('0x93')||_0x1a72a7===_0x2569('0x94'))){_0x8a48c0[_0x2569('0x8e')](new Extension(_0x1dd4db,_0x4d4ff1,_0x2569('0x95')+_0x1a72a7+')='+_0x1dd4db[_0x1a72a7],'Set'));_0x4d4ff1+=0x1;}}_0x8a48c0['push'](new Extension(_0x1dd4db,_0x4d4ff1,'6',_0x2569('0x96')));_0x4d4ff1+=0x1;_0x8a48c0[_0x2569('0x8e')](new Extension(_0x1dd4db,_0x4d4ff1,_0x2569('0x97'),_0x2569('0x98')));_0x4d4ff1=0x0;return _0x8a48c0;}exports[_0x2569('0x99')]=function(_0x3f7335,_0x509092,_0x3650c9){var _0x23d9f4;return db[_0x2569('0x80')][_0x2569('0x81')](function(_0x11ff9b){return db[_0x2569('0x3d')]['create'](_0x3f7335[_0x2569('0x5b')],{'transaction':_0x11ff9b})[_0x2569('0x23')](function(_0x17f7c3){_0x23d9f4=_0x17f7c3[_0x2569('0x38')]({'plain':!![]});return db['VoiceExtension'][_0x2569('0x83')](createExtensionsReciveFax(_0x23d9f4),{'transaction':_0x11ff9b});});})[_0x2569('0x23')](function(){return _0x23d9f4;})['then'](respondWithResult(_0x509092,null))[_0x2569('0x2b')](handleError(_0x509092,null));};exports['updateAccountApplications']=function(_0x504be9,_0x2a6f9,_0x465cde){var _0x2fd80a;return db[_0x2569('0x80')][_0x2569('0x81')](function(_0x4de754){return db[_0x2569('0x3d')]['update'](_0x504be9[_0x2569('0x5b')],{'where':{'id':_0x504be9['body']['id']},'transaction':_0x4de754})[_0x2569('0x23')](function(_0x50a0de){return db[_0x2569('0x9a')]['destroy']({'where':{'FaxAccountId':_0x504be9[_0x2569('0x5b')]['id']},'transaction':_0x4de754})[_0x2569('0x23')](function(_0x405080){return db[_0x2569('0x9a')]['bulkCreate'](createExtensionsReciveFax(_[_0x2569('0x74')](_0x504be9['body'],['tech','key',_0x2569('0x9b'),'updatedAt',_0x2569('0x9c'),_0x2569('0x9d')])),{'transaction':_0x4de754});});});})[_0x2569('0x23')](function(){return db['FaxAccount'][_0x2569('0x9e')](_0x504be9[_0x2569('0x5b')]['id']);})['then'](respondWithResult(_0x2a6f9,null))[_0x2569('0x2b')](handleError(_0x2a6f9,null));};exports[_0x2569('0x9f')]=function(_0x5a2e1d,_0x2e755c,_0x350428){var _0x4799ca={'raw':!![],'where':{}};var _0x29ccb5={};var _0x351096={'count':0x0,'rows':[]};return db[_0x2569('0x3d')]['findOne']({'where':{'id':_0x5a2e1d[_0x2569('0x66')]['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x2e755c,null))[_0x2569('0x23')](function(_0x34512c){if(_0x34512c){_0x29ccb5[_0x2569('0x42')]=_['keys'](db[_0x2569('0xa0')][_0x2569('0x3e')]);_0x29ccb5[_0x2569('0x44')]=_[_0x2569('0x45')](_0x5a2e1d[_0x2569('0x44')]);_0x29ccb5[_0x2569('0x46')]=_['intersection'](_0x29ccb5[_0x2569('0x42')],_0x29ccb5[_0x2569('0x44')]);_0x4799ca[_0x2569('0x48')]=_['intersection'](_0x29ccb5['model'],qs[_0x2569('0x49')](_0x5a2e1d[_0x2569('0x44')][_0x2569('0x49')]));_0x4799ca[_0x2569('0x48')]=_0x4799ca[_0x2569('0x48')][_0x2569('0x4a')]?_0x4799ca['attributes']:_0x29ccb5[_0x2569('0x42')];if(!_0x5a2e1d['query'][_0x2569('0x4b')](_0x2569('0x4c'))){_0x4799ca[_0x2569('0x30')]=qs[_0x2569('0x30')](_0x5a2e1d['query'][_0x2569('0x30')]);_0x4799ca[_0x2569('0x2f')]=qs[_0x2569('0x2f')](_0x5a2e1d[_0x2569('0x44')][_0x2569('0x2f')]);}_0x4799ca['order']=qs[_0x2569('0x4e')](_0x5a2e1d[_0x2569('0x44')][_0x2569('0x4e')]);_0x4799ca[_0x2569('0x4f')]=qs[_0x2569('0x46')](_[_0x2569('0x50')](_0x5a2e1d['query'],_0x29ccb5[_0x2569('0x46')]));_0x4799ca[_0x2569('0x4f')][_0x2569('0x6b')]=_0x34512c['id'];if(_0x5a2e1d['query'][_0x2569('0x51')]){_0x4799ca['where']=_[_0x2569('0x52')](_0x4799ca['where'],{'$or':_[_0x2569('0x43')](_0x4799ca['attributes'],function(_0xd0b16b){var _0x56c144={};_0x56c144[_0xd0b16b]={'$like':'%'+_0x5a2e1d['query'][_0x2569('0x51')]+'%'};return _0x56c144;})});}if(_0x5a2e1d[_0x2569('0x44')][_0x2569('0xa1')]){var _0x515167=_0x5a2e1d[_0x2569('0x44')][_0x2569('0xa1')][_0x2569('0xa2')](',');var _0x354326={};_0x354326[_0x515167[0x0]]={'$gte':moment(_0x515167[0x1])[_0x2569('0xa3')](_0x2569('0xa4'))};_0x4799ca[_0x2569('0x4f')]=_[_0x2569('0x52')](_0x4799ca[_0x2569('0x4f')],_0x354326);}_0x4799ca=_['merge']({},_0x4799ca,_0x5a2e1d[_0x2569('0x54')]);return db['FaxMessage'][_0x2569('0x2e')]({'where':_0x4799ca[_0x2569('0x4f')]})[_0x2569('0x23')](function(_0x19bd2a){_0x351096[_0x2569('0x2e')]=_0x19bd2a;if(_0x5a2e1d['query'][_0x2569('0x55')]){_0x4799ca[_0x2569('0x56')]=[{'all':!![]}];}return db[_0x2569('0xa0')][_0x2569('0x57')](_0x4799ca);})[_0x2569('0x23')](function(_0x34de6e){_0x351096['rows']=_0x34de6e;return _0x351096;});}})[_0x2569('0x23')](respondWithFilteredResult(_0x2e755c,_0x4799ca))[_0x2569('0x2b')](handleError(_0x2e755c,null));};exports[_0x2569('0x3a')]=function(_0x334e23,_0x1783d2,_0x209770){var _0x4d2d4e,_0x719d7d={},_0x2a6107;if(_0x334e23[_0x2569('0x5b')]['to']){_0x2a6107=_0x334e23[_0x2569('0x5b')]['to'][0x0];}return db[_0x2569('0x3d')]['find']({'where':{'id':_0x334e23[_0x2569('0x66')]['id']},'include':[{'model':db[_0x2569('0xa5')],'as':_0x2569('0xa6'),'include':[{'model':db[_0x2569('0x75')],'as':_0x2569('0xa7'),'where':{'fax':_0x2a6107},'limit':0x1,'order':[[_0x2569('0xa8'),_0x2569('0xa9')]]}]}]})[_0x2569('0x23')](handleEntityNotFound(_0x1783d2,null))[_0x2569('0x23')](function(_0x49d70b){_0x4d2d4e=_0x49d70b;if(_0x334e23['body'][_0x2569('0xaa')]&&_0x334e23[_0x2569('0x5b')][_0x2569('0xaa')][_0x2569('0x4a')]){for(var _0x51a175=0x0;_0x51a175<_0x334e23[_0x2569('0x5b')][_0x2569('0xaa')][_0x2569('0x4a')];_0x51a175+=0x1){_0x334e23[_0x2569('0x5b')][_0x2569('0xaa')][_0x51a175]={'filename':_0x334e23['body']['attachments'][_0x51a175][_0x2569('0x39')],'id':_0x334e23[_0x2569('0x5b')][_0x2569('0xaa')][_0x51a175]['id'],'path':path[_0x2569('0xab')](config['root'],_0x2569('0xac'),_0x334e23[_0x2569('0x5b')]['attachments'][_0x51a175]['basename'])};}}return respondWithRpcPromise(_0x2569('0xad'),_0x2569('0xad'),{'FaxAccountId':_[_0x2569('0xae')](_0x334e23['params']['id'])?undefined:_0x334e23['params']['id'],'path':_[_0x2569('0xae')](_0x334e23['body'][_0x2569('0xaa')][0x0][_0x2569('0x9')])?undefined:_0x334e23[_0x2569('0x5b')][_0x2569('0xaa')][0x0]['path'],'fax':_[_0x2569('0xae')](_0x334e23[_0x2569('0x5b')]['to'][0x0])?undefined:_0x334e23[_0x2569('0x5b')]['to'][0x0]},client9002);})[_0x2569('0x23')](function(){if(_0x4d2d4e){if(_[_0x2569('0xae')](_0x334e23[_0x2569('0x5b')][_0x2569('0xaf')])){_0x334e23[_0x2569('0x5b')][_0x2569('0xaf')]=util[_0x2569('0xa3')]('\x22%s\x22\x20<%s>',_0x4d2d4e[_0x2569('0x39')],_0x4d2d4e[_0x2569('0xb0')]);}if(_0x4d2d4e[_0x2569('0xa6')]){if(_0x4d2d4e[_0x2569('0xa6')][_0x2569('0xa7')][_0x2569('0x4a')]){return _0x4d2d4e[_0x2569('0xa6')][_0x2569('0xa7')][0x0];}else{return db[_0x2569('0x75')]['create'](_[_0x2569('0x1b')](_0x334e23['body'],{'firstName':_0x334e23[_0x2569('0x5b')]['to'][0x0],'phone':_0x334e23['body']['to'][0x0],'fax':_0x334e23[_0x2569('0x5b')]['to'][0x0],'ListId':_0x4d2d4e[_0x2569('0x9d')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x2569('0x23')](function(_0x1eed56){if(_0x1eed56){return db[_0x2569('0x72')][_0x2569('0x61')]({'where':{'ContactId':_0x1eed56['id'],'closed':![],'FaxAccountId':_0x4d2d4e['id']}})[_0x2569('0x23')](function(_0x48b1b6){if(_0x48b1b6){return[_0x48b1b6,![]];}return db[_0x2569('0x72')][_0x2569('0x64')]({'UserId':_0x334e23[_0x2569('0x5c')]['id'],'ContactId':_0x1eed56['id'],'FaxAccountId':_0x4d2d4e['id'],'fax':_0x334e23[_0x2569('0x5b')]['to'][0x0],'firstMsgDirection':_0x2569('0xb1'),'Messages':[_[_0x2569('0x52')](_0x334e23[_0x2569('0x5b')],{'read':![],'body':_0x334e23[_0x2569('0x5b')][_0x2569('0xaa')][0x0][_0x2569('0xb2')],'FaxAccountId':_0x4d2d4e['id'],'UserId':_0x334e23[_0x2569('0x5c')]['id'],'ContactId':_0x1eed56['id'],'AttachmentId':_0x334e23[_0x2569('0x5b')][_0x2569('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x2569('0xa0')],'as':'Messages'}]})['then'](function(_0x5ed7ae){return[_0x5ed7ae,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x48c9b6,_0x4dec57){if(_0x4dec57){return _0x48c9b6;}return db[_0x2569('0xa0')][_0x2569('0x64')]({'direction':_0x2569('0xb1'),'read':![],'body':_0x334e23[_0x2569('0x5b')][_0x2569('0xaa')][0x0][_0x2569('0xb2')],'FaxAccountId':_0x4d2d4e['id'],'FaxInteractionId':_0x48c9b6['id'],'UserId':_0x334e23['user']['id'],'ContactId':_0x48c9b6['ContactId'],'AttachmentId':_0x334e23[_0x2569('0x5b')][_0x2569('0xaa')][0x0]['id']})[_0x2569('0x23')](function(_0x3a5ab0){_0x48c9b6['dataValues']['Messages']=[];_0x48c9b6[_0x2569('0xb3')][_0x2569('0xb4')][_0x2569('0x8e')](_0x3a5ab0[_0x2569('0xb3')]);return _0x48c9b6;});})[_0x2569('0x23')](function(_0x564de3){respondWithRpcPromise(_0x2569('0xb5'),_0x2569('0xb5'),{'FaxAccountId':_['isNil'](_0x334e23[_0x2569('0x66')]['id'])?undefined:_0x334e23[_0x2569('0x66')]['id'],'path':_[_0x2569('0xae')](_0x334e23['body'][_0x2569('0xaa')][0x0][_0x2569('0x9')])?undefined:_0x334e23[_0x2569('0x5b')][_0x2569('0xaa')][0x0][_0x2569('0x9')],'fax':_[_0x2569('0xae')](_0x334e23[_0x2569('0x5b')]['to'][0x0])?undefined:_0x334e23[_0x2569('0x5b')]['to'][0x0],'AttachmentId':_0x334e23[_0x2569('0x5b')]['attachments'][0x0]['id']},client9002)['then'](function(_0x592831){logger[_0x2569('0x24')](_0x2569('0xb6'),_0x592831);})[_0x2569('0x2b')](function(_0x165fc7){logger[_0x2569('0x24')](_0x2569('0xb6'),_0x165fc7);});return _0x564de3;})[_0x2569('0x23')](respondWithResult(_0x1783d2,null))['catch'](handleError(_0x1783d2,null));};exports['addAgents']=function(_0x323b5c,_0x2be70f,_0x224591){return db[_0x2569('0x3d')][_0x2569('0x61')]({'where':{'id':_0x323b5c[_0x2569('0x66')]['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x2be70f,null))[_0x2569('0x23')](function(_0x77f90d){if(_0x77f90d){return _0x77f90d[_0x2569('0xb7')](_0x323b5c[_0x2569('0x5b')][_0x2569('0x6d')],_[_0x2569('0x74')](_0x323b5c['body'],[_0x2569('0x6d'),'id'])||{})['spread'](function(_0x22d553){for(var _0x12d06a=0x0;_0x12d06a<_0x323b5c[_0x2569('0x5b')][_0x2569('0x6d')][_0x2569('0x4a')];_0x12d06a+=0x1){socket['emit'](_0x2569('0xb8'),{'UserId':_0x323b5c[_0x2569('0x5b')][_0x2569('0x6d')][_0x12d06a],'FaxAccountId':_0x323b5c[_0x2569('0x66')]['id']});}return _0x22d553;});}})['then'](respondWithResult(_0x2be70f,null))[_0x2569('0x2b')](handleError(_0x2be70f,null));};exports[_0x2569('0xb9')]=function(_0xcabd99,_0x3a59f6,_0x3c163a){return db['FaxAccount'][_0x2569('0x61')]({'where':{'id':_0xcabd99['params']['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x3a59f6,null))[_0x2569('0x23')](function(_0x3b1308){if(_0x3b1308){return _0x3b1308[_0x2569('0xb9')](_0xcabd99[_0x2569('0x44')][_0x2569('0x6d')])[_0x2569('0x23')](function(){if(_[_0x2569('0xba')](_0xcabd99['query'][_0x2569('0x6d')])){for(var _0xd816ff=0x0;_0xd816ff<_0xcabd99[_0x2569('0x44')][_0x2569('0x6d')]['length'];_0xd816ff+=0x1){socket[_0x2569('0xbb')](_0x2569('0xbc'),{'UserId':Number(_0xcabd99[_0x2569('0x44')][_0x2569('0x6d')][_0xd816ff]),'FaxAccountId':Number(_0xcabd99[_0x2569('0x66')]['id'])});}}else{socket[_0x2569('0xbb')](_0x2569('0xbc'),{'UserId':Number(_0xcabd99['query']['ids']),'FaxAccountId':Number(_0xcabd99['params']['id'])});}});}})[_0x2569('0x23')](respondWithStatusCode(_0x3a59f6,null))[_0x2569('0x2b')](handleError(_0x3a59f6,null));};exports['getAgents']=function(_0x26d78e,_0x3b0530,_0x55b566){var _0x1409ac={};var _0x3bfced={};var _0x294425;var _0x4a1f81;return db[_0x2569('0x3d')]['findOne']({'where':{'id':_0x26d78e[_0x2569('0x66')]['id']}})[_0x2569('0x23')](handleEntityNotFound(_0x3b0530,null))[_0x2569('0x23')](function(_0xf90de8){if(_0xf90de8){_0x294425=_0xf90de8;_0x3bfced[_0x2569('0x42')]=_[_0x2569('0x45')](db[_0x2569('0x77')]['rawAttributes']);_0x3bfced[_0x2569('0x44')]=_[_0x2569('0x45')](_0x26d78e[_0x2569('0x44')]);_0x3bfced['filters']=_['intersection'](_0x3bfced['model'],_0x3bfced[_0x2569('0x44')]);_0x1409ac[_0x2569('0x48')]=_[_0x2569('0x47')](_0x3bfced['model'],qs['fields'](_0x26d78e[_0x2569('0x44')][_0x2569('0x49')]));_0x1409ac[_0x2569('0x48')]=_0x1409ac[_0x2569('0x48')][_0x2569('0x4a')]?_0x1409ac[_0x2569('0x48')]:_0x3bfced[_0x2569('0x42')];_0x1409ac['order']=qs['sort'](_0x26d78e[_0x2569('0x44')][_0x2569('0x4e')]);_0x1409ac[_0x2569('0x4f')]=qs[_0x2569('0x46')](_['pick'](_0x26d78e[_0x2569('0x44')],_0x3bfced[_0x2569('0x46')]));if(_0x26d78e[_0x2569('0x44')][_0x2569('0x51')]){_0x1409ac[_0x2569('0x4f')]=_['merge'](_0x1409ac[_0x2569('0x4f')],{'$or':_[_0x2569('0x43')](_0x1409ac[_0x2569('0x48')],function(_0x34908b){var _0x4353ac={};_0x4353ac[_0x34908b]={'$like':'%'+_0x26d78e['query'][_0x2569('0x51')]+'%'};return _0x4353ac;})});}_0x1409ac=_[_0x2569('0x52')]({},_0x1409ac,_0x26d78e[_0x2569('0x54')]);return _0x294425['getAgents'](_0x1409ac);}})[_0x2569('0x23')](function(_0x503a3b){if(_0x503a3b){_0x4a1f81=_0x503a3b[_0x2569('0x4a')];if(!_0x26d78e[_0x2569('0x44')]['hasOwnProperty']('nolimit')){_0x1409ac[_0x2569('0x30')]=qs[_0x2569('0x30')](_0x26d78e[_0x2569('0x44')][_0x2569('0x30')]);_0x1409ac['offset']=qs['offset'](_0x26d78e[_0x2569('0x44')][_0x2569('0x2f')]);}return _0x294425['getAgents'](_0x1409ac);}})[_0x2569('0x23')](function(_0x5478eb){if(_0x5478eb){return _0x5478eb?{'count':_0x4a1f81,'rows':_0x5478eb}:null;}})[_0x2569('0x23')](respondWithResult(_0x3b0530,null))[_0x2569('0x2b')](handleError(_0x3b0530,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index f21fbbb..2609a5a 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 _0x42a3=['hook','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x580869,_0x540760){var _0x3bfc5d=function(_0x1ee282){while(--_0x1ee282){_0x580869['push'](_0x580869['shift']());}};_0x3bfc5d(++_0x540760);}(_0x42a3,0x18d));var _0x342a=function(_0x28f03f,_0x2f4363){_0x28f03f=_0x28f03f-0x0;var _0x434899=_0x42a3[_0x28f03f];return _0x434899;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x342a('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x342a('0x1')](0x0);var events={'afterCreate':_0x342a('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3725e1){return function(_0x507ea2,_0xa8989c,_0x90522e){FaxAccountEvents['emit'](_0x3725e1+':'+_0x507ea2['id'],_0x507ea2);FaxAccountEvents[_0x342a('0x3')](_0x3725e1,_0x507ea2);_0x90522e(null);};}for(var e in events){if(events[_0x342a('0x4')](e)){var event=events[e];FaxAccount[_0x342a('0x5')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xf12c=['events','FaxAccount','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x49dfa6,_0x41c2dc){var _0x1b1c72=function(_0x4e69de){while(--_0x4e69de){_0x49dfa6['push'](_0x49dfa6['shift']());}};_0x1b1c72(++_0x41c2dc);}(_0xf12c,0x13b));var _0xcf12=function(_0x25e1a2,_0x8d3307){_0x25e1a2=_0x25e1a2-0x0;var _0x40a473=_0xf12c[_0x25e1a2];return _0x40a473;};'use strict';var EventEmitter=require(_0xcf12('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xcf12('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xcf12('0x2')](0x0);var events={'afterCreate':_0xcf12('0x3'),'afterUpdate':_0xcf12('0x4'),'afterDestroy':_0xcf12('0x5')};function emitEvent(_0x132d83){return function(_0x583523,_0x1910c6,_0x307fd8){FaxAccountEvents[_0xcf12('0x6')](_0x132d83+':'+_0x583523['id'],_0x583523);FaxAccountEvents[_0xcf12('0x6')](_0x132d83,_0x583523);_0x307fd8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xcf12('0x7')](e,emitEvent(event));}}module[_0xcf12('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index e2051a0..71fd34d 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 _0x888f=['exports','define','FaxAccount','fax_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0x4de226,_0xf589ec){var _0x2fb276=function(_0x3f99ed){while(--_0x3f99ed){_0x4de226['push'](_0x4de226['shift']());}};_0x2fb276(++_0xf589ec);}(_0x888f,0x17e));var _0xf888=function(_0x4aaa7b,_0x4f368a){_0x4aaa7b=_0x4aaa7b-0x0;var _0x458deb=_0x888f[_0x4aaa7b];return _0x458deb;};'use strict';var _=require(_0xf888('0x0'));var util=require('util');var logger=require(_0xf888('0x1'))(_0xf888('0x2'));var moment=require(_0xf888('0x3'));var BPromise=require(_0xf888('0x4'));var rp=require(_0xf888('0x5'));var fs=require('fs');var path=require(_0xf888('0x6'));var rimraf=require(_0xf888('0x7'));var config=require(_0xf888('0x8'));var attributes=require(_0xf888('0x9'));module[_0xf888('0xa')]=function(_0x284915,_0x3ec591){return _0x284915[_0xf888('0xb')](_0xf888('0xc'),attributes,{'tableName':_0xf888('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f2d=['./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x6f114,_0x2ac0f9){var _0x40546b=function(_0x3902ac){while(--_0x3902ac){_0x6f114['push'](_0x6f114['shift']());}};_0x40546b(++_0x2ac0f9);}(_0x7f2d,0x87));var _0xd7f2=function(_0x234ab7,_0x4e8666){_0x234ab7=_0x234ab7-0x0;var _0x1093ff=_0x7f2d[_0x234ab7];return _0x1093ff;};'use strict';var _=require(_0xd7f2('0x0'));var util=require('util');var logger=require(_0xd7f2('0x1'))(_0xd7f2('0x2'));var moment=require(_0xd7f2('0x3'));var BPromise=require('bluebird');var rp=require(_0xd7f2('0x4'));var fs=require('fs');var path=require(_0xd7f2('0x5'));var rimraf=require(_0xd7f2('0x6'));var config=require(_0xd7f2('0x7'));var attributes=require(_0xd7f2('0x8'));module[_0xd7f2('0x9')]=function(_0x4ddf05,_0x52cd36){return _0x4ddf05[_0xd7f2('0xa')](_0xd7f2('0xb'),attributes,{'tableName':_0xd7f2('0xc'),'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 06d458f..4b54fb1 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 _0x9182=['map','include','attributes','model','info','debug','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','createdAt','updatedAt','keys','CompanyId','ListId','body','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','Applications','get','applications','orderBy','priority','length','Contacts','from','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetFaxAccount','FaxAccount','findAll','options','raw','limit'];(function(_0x82487b,_0x343602){var _0x29037f=function(_0x4fff15){while(--_0x4fff15){_0x82487b['push'](_0x82487b['shift']());}};_0x29037f(++_0x343602);}(_0x9182,0xe1));var _0x2918=function(_0x3bc864,_0x324957){_0x3bc864=_0x3bc864-0x0;var _0x1d0dd2=_0x9182[_0x3bc864];return _0x1d0dd2;};'use strict';var _=require(_0x2918('0x0'));var util=require(_0x2918('0x1'));var moment=require(_0x2918('0x2'));var BPromise=require(_0x2918('0x3'));var rs=require(_0x2918('0x4'));var fs=require('fs');var Redis=require(_0x2918('0x5'));var db=require(_0x2918('0x6'))['db'];var utils=require(_0x2918('0x7'));var logger=require(_0x2918('0x8'))('rpc');var config=require(_0x2918('0x9'));var jayson=require(_0x2918('0xa'));var client=jayson['client'][_0x2918('0xb')]({'port':0x232c});config['redis']=_['defaults'](config[_0x2918('0xc')],{'host':_0x2918('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2918('0xc')]));require('./faxAccount.socket')[_0x2918('0xe')](socket);function respondWithRpcPromise(_0x2c8100,_0x397cd2,_0x4c69cd){return new BPromise(function(_0x5df10b,_0x29b637){return client[_0x2918('0xf')](_0x2c8100,_0x4c69cd)[_0x2918('0x10')](function(_0x417923){logger['info'](_0x2918('0x11'),_0x397cd2,_0x2918('0x12'));logger['debug'](_0x2918('0x13'),_0x397cd2,_0x2918('0x12'),JSON[_0x2918('0x14')](_0x417923));if(_0x417923['error']){if(_0x417923[_0x2918('0x15')][_0x2918('0x16')]===0x1f4){logger['error'](_0x2918('0x11'),_0x397cd2,_0x417923['error'][_0x2918('0x17')]);return _0x29b637(_0x417923['error'][_0x2918('0x17')]);}logger[_0x2918('0x15')]('FaxAccount,\x20%s,\x20%s',_0x397cd2,_0x417923[_0x2918('0x15')][_0x2918('0x17')]);return _0x5df10b(_0x417923['error'][_0x2918('0x17')]);}else{logger['info'](_0x2918('0x11'),_0x397cd2,_0x2918('0x12'));_0x5df10b(_0x417923['result'][_0x2918('0x17')]);}})['catch'](function(_0x80ded2){logger[_0x2918('0x15')](_0x2918('0x11'),_0x397cd2,_0x80ded2);_0x29b637(_0x80ded2);});});}exports[_0x2918('0x18')]=function(_0x2cd399){var _0xfb960=this;return new Promise(function(_0x1ace42,_0x39c690){return db[_0x2918('0x19')][_0x2918('0x1a')]({'raw':_0x2cd399[_0x2918('0x1b')]?_0x2cd399[_0x2918('0x1b')][_0x2918('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cd399['options']?_0x2cd399['options']['where']||null:null,'attributes':_0x2cd399['options']?_0x2cd399[_0x2918('0x1b')]['attributes']||null:null,'limit':_0x2cd399[_0x2918('0x1b')]?_0x2cd399[_0x2918('0x1b')][_0x2918('0x1d')]||null:null,'include':_0x2cd399['options']?_0x2cd399[_0x2918('0x1b')]['include']?_[_0x2918('0x1e')](_0x2cd399['options'][_0x2918('0x1f')],function(_0x3d827d){return{'model':db[_0x3d827d['model']],'as':_0x3d827d['as'],'attributes':_0x3d827d[_0x2918('0x20')],'include':_0x3d827d['include']?_['map'](_0x3d827d[_0x2918('0x1f')],function(_0x59b9d1){return{'model':db[_0x59b9d1[_0x2918('0x21')]],'as':_0x59b9d1['as'],'attributes':_0x59b9d1['attributes'],'include':_0x59b9d1['include']?_['map'](_0x59b9d1[_0x2918('0x1f')],function(_0x36ccf8){return{'model':db[_0x36ccf8['model']],'as':_0x36ccf8['as'],'attributes':_0x36ccf8['attributes']};}):[]};}):[]};}):[]:[]})[_0x2918('0x10')](function(_0x4ba408){logger[_0x2918('0x22')]('GetFaxAccount',_0x2cd399);logger[_0x2918('0x23')](_0x2918('0x18'),_0x2cd399,JSON[_0x2918('0x14')](_0x4ba408));_0x1ace42(_0x4ba408);})['catch'](function(_0x2e8a8b){logger[_0x2918('0x15')](_0x2918('0x18'),_0x2e8a8b['message'],_0x2cd399);_0x39c690(_0xfb960['error'](0x1f4,_0x2e8a8b['message']));});});};exports[_0x2918('0x24')]=function(_0x48f4bb,_0x3ccec2,_0x6445d4){var _0x5df82e=this;return new Promise(function(_0x46007b,_0x38c68f){var _0x308d1e={'body':_0x48f4bb['body'],'channel':_0x2918('0x25')};var _0x1b5e46=[];var _0x55c63c=[];var _0x5c1308={};return db[_0x2918('0x26')][_0x2918('0x27')]()[_0x2918('0x10')](function(_0x2d816b){if(!_0x2d816b){throw new db[(_0x2918('0x28'))][(_0x2918('0x29'))]('no\x20available\x20attributes');}_0x1b5e46=_['difference'](_['keys'](_0x2d816b),[_0x2918('0x2a'),_0x2918('0x2b')]);_0x55c63c=_['difference'](_[_0x2918('0x2c')](_0x2d816b),['createdAt','updatedAt',_0x2918('0x2d'),_0x2918('0x2e')]);if(_0x48f4bb['body']['id']){delete _0x48f4bb[_0x2918('0x2f')]['id'];}if(_[_0x2918('0x30')](_0x48f4bb[_0x2918('0x2f')]['from'])){throw new db[(_0x2918('0x28'))][(_0x2918('0x29'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x48f4bb[_0x2918('0x2f')]['body'])||_0x48f4bb[_0x2918('0x2f')][_0x2918('0x2f')]===''){throw new db[(_0x2918('0x28'))][(_0x2918('0x29'))](_0x2918('0x31'));}if(_[_0x2918('0x30')](_0x48f4bb[_0x2918('0x2f')][_0x2918('0x32')])){throw new db[(_0x2918('0x28'))][(_0x2918('0x29'))](_0x2918('0x33')+_0x55c63c);}if(!_['includes'](_0x55c63c,_0x48f4bb[_0x2918('0x2f')][_0x2918('0x32')])){throw new db[(_0x2918('0x28'))][(_0x2918('0x29'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x55c63c);}_0x5c1308[_0x48f4bb['body'][_0x2918('0x32')]]=_0x48f4bb[_0x2918('0x2f')]['from'];})['then'](function(){return db[_0x2918('0x19')]['find']({'where':{'id':_0x48f4bb[_0x2918('0x34')]['id']},'include':[{'model':db[_0x2918('0x35')],'as':_0x2918('0x36'),'include':[{'model':db[_0x2918('0x26')],'as':'Contacts','where':_0x5c1308,'limit':0x1,'order':[[_0x2918('0x2b'),_0x2918('0x37')]]}]},{'model':db['FaxApplication'],'as':_0x2918('0x38')}]});})['then'](function(_0x2cc8ff){if(_0x2cc8ff&&_0x2cc8ff[_0x2918('0x36')]){var _0xb109eb=_0x2cc8ff[_0x2918('0x39')]({'plain':!![]});_0x308d1e[_0x2918('0x34')]=_0xb109eb;_0x308d1e[_0x2918('0x3a')]=_0xb109eb[_0x2918('0x38')];_0x308d1e['list']=_0xb109eb['List'];_0x308d1e[_0x2918('0x3a')]=_[_0x2918('0x3b')](_0x308d1e[_0x2918('0x3a')],[_0x2918('0x3c')],['asc']);if(_0x308d1e[_0x2918('0x34')]['Applications']){delete _0x308d1e[_0x2918('0x34')]['Applications'];}if(_0x308d1e[_0x2918('0x34')][_0x2918('0x36')]&&_0x308d1e[_0x2918('0x34')][_0x2918('0x36')]['Contacts'][_0x2918('0x3d')]){return _0x308d1e['account']['List'][_0x2918('0x3e')][0x0];}var _0x5e7bd0=_['defaults'](_0x48f4bb[_0x2918('0x2f')],{'firstName':_0x48f4bb['body'][_0x2918('0x3f')],'ListId':_0xb109eb[_0x2918('0x2e')]});_0x5e7bd0[_0x48f4bb['body'][_0x2918('0x32')]]=_0x48f4bb[_0x2918('0x2f')][_0x2918('0x3f')];return db[_0x2918('0x26')][_0x2918('0x40')](_0x5e7bd0,{'fields':_0x1b5e46,'raw':!![]});}})[_0x2918('0x10')](function(_0x2fd56e){_0x308d1e[_0x2918('0x41')]=_0x2fd56e;if(_0x2fd56e){var _0x426abc={'ContactId':_0x2fd56e['id'],'FaxAccountId':_0x48f4bb[_0x2918('0x34')]['id'],'fax':_0x2fd56e[_0x2918('0x25')]};return db[_0x2918('0x42')][_0x2918('0x43')]({'where':{'ContactId':_0x2fd56e['id'],'closed':![],'FaxAccountId':_0x48f4bb['account']['id']}})[_0x2918('0x10')](function(_0x34f3d9){if(_0x34f3d9){return[_0x34f3d9,![]];}return db[_0x2918('0x42')][_0x2918('0x40')](_0x426abc)[_0x2918('0x10')](function(_0x4aabad){return[_0x4aabad,!![]];});});}else{throw new Error(_0x2918('0x44'));}})[_0x2918('0x45')](function(_0x577b1a,_0x52333c){var _0x4df366=_0x577b1a[_0x2918('0x39')]({'plain':!![]});if(_0x52333c){if(_0x308d1e[_0x2918('0x34')][_0x2918('0x46')]){_0x308d1e[_0x2918('0x3a')]['push']({'id':0x0,'priority':_0x308d1e['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x2918('0x47')});}_0x4df366['created']=!![];}else{_0x4df366[_0x2918('0x48')]=![];}_0x308d1e[_0x2918('0x49')]=_0x4df366;return db[_0x2918('0x4a')][_0x2918('0x40')]({'body':_0x48f4bb['body'][_0x2918('0x2f')],'FaxAccountId':_0x48f4bb[_0x2918('0x34')]['id'],'FaxInteractionId':_0x577b1a['id'],'direction':'in','ContactId':_0x577b1a[_0x2918('0x4b')],'AttachmentId':_0x48f4bb[_0x2918('0x2f')][_0x2918('0x4c')]});})[_0x2918('0x10')](function(_0x31fd05){_0x308d1e[_0x2918('0x17')]=_0x31fd05;if(_0x308d1e[_0x2918('0x49')]['UserId']){return db[_0x2918('0x4d')][_0x2918('0x43')]({'attributes':['id',_0x2918('0x4e')],'where':{'id':_0x308d1e['interaction'][_0x2918('0x4f')]}})[_0x2918('0x10')](function(_0x35f9ea){if(_0x35f9ea){_0x308d1e['applications'][_0x2918('0x50')]({'id':0x0,'priority':0x0,'app':_0x2918('0x51'),'appdata':_0x35f9ea[_0x2918('0x4e')]+','+(_0x308d1e[_0x2918('0x34')][_0x2918('0x52')]||0xa),'interval':_0x2918('0x47')});}return respondWithRpcPromise(_0x2918('0x53'),_0x2918('0x54'),_0x308d1e);});}return respondWithRpcPromise(_0x2918('0x53'),_0x2918('0x54'),_0x308d1e);})['then'](function(_0x5f2a61){_0x46007b(_0x5f2a61);})['catch'](function(_0x90526e){_0x38c68f(_0x5df82e[_0x2918('0x15')](0x1f4,_0x90526e[_0x2918('0x17')]));});});}; \ No newline at end of file +var _0x82e1=['map','include','model','catch','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','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','find','List','Contacts','DESC','FaxApplication','Applications','account','applications','list','orderBy','asc','length','create','contact','Contact\x20not\x20found','spread','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','UserId','User','name','interaction','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes'];(function(_0x210a15,_0x285ad6){var _0x1d9495=function(_0x3af4cf){while(--_0x3af4cf){_0x210a15['push'](_0x210a15['shift']());}};_0x1d9495(++_0x285ad6);}(_0x82e1,0x14f));var _0x182e=function(_0x177346,_0x5e4024){_0x177346=_0x177346-0x0;var _0x155669=_0x82e1[_0x177346];return _0x155669;};'use strict';var _=require(_0x182e('0x0'));var util=require(_0x182e('0x1'));var moment=require(_0x182e('0x2'));var BPromise=require(_0x182e('0x3'));var rs=require(_0x182e('0x4'));var fs=require('fs');var Redis=require(_0x182e('0x5'));var db=require(_0x182e('0x6'))['db'];var utils=require(_0x182e('0x7'));var logger=require(_0x182e('0x8'))('rpc');var config=require(_0x182e('0x9'));var jayson=require(_0x182e('0xa'));var client=jayson[_0x182e('0xb')][_0x182e('0xc')]({'port':0x232c});config[_0x182e('0xd')]=_[_0x182e('0xe')](config[_0x182e('0xd')],{'host':_0x182e('0xf'),'port':0x18eb});var socket=require(_0x182e('0x10'))(new Redis(config[_0x182e('0xd')]));require('./faxAccount.socket')[_0x182e('0x11')](socket);function respondWithRpcPromise(_0x104770,_0x4a5ce9,_0x40bb55){return new BPromise(function(_0x2dc2a0,_0x41f02f){return client[_0x182e('0x12')](_0x104770,_0x40bb55)[_0x182e('0x13')](function(_0x2ac6f4){logger[_0x182e('0x14')](_0x182e('0x15'),_0x4a5ce9,_0x182e('0x16'));logger[_0x182e('0x17')](_0x182e('0x18'),_0x4a5ce9,_0x182e('0x16'),JSON[_0x182e('0x19')](_0x2ac6f4));if(_0x2ac6f4['error']){if(_0x2ac6f4[_0x182e('0x1a')][_0x182e('0x1b')]===0x1f4){logger[_0x182e('0x1a')](_0x182e('0x15'),_0x4a5ce9,_0x2ac6f4[_0x182e('0x1a')][_0x182e('0x1c')]);return _0x41f02f(_0x2ac6f4[_0x182e('0x1a')][_0x182e('0x1c')]);}logger[_0x182e('0x1a')](_0x182e('0x15'),_0x4a5ce9,_0x2ac6f4[_0x182e('0x1a')][_0x182e('0x1c')]);return _0x2dc2a0(_0x2ac6f4['error'][_0x182e('0x1c')]);}else{logger['info'](_0x182e('0x15'),_0x4a5ce9,'request\x20sent');_0x2dc2a0(_0x2ac6f4[_0x182e('0x1d')][_0x182e('0x1c')]);}})['catch'](function(_0x20d7fa){logger[_0x182e('0x1a')]('FaxAccount,\x20%s,\x20%s',_0x4a5ce9,_0x20d7fa);_0x41f02f(_0x20d7fa);});});}exports[_0x182e('0x1e')]=function(_0x328cf2){var _0x307de5=this;return new Promise(function(_0x45a982,_0x3f034e){return db[_0x182e('0x1f')][_0x182e('0x20')]({'raw':_0x328cf2[_0x182e('0x21')]?_0x328cf2[_0x182e('0x21')][_0x182e('0x22')]===undefined?!![]:![]:!![],'where':_0x328cf2[_0x182e('0x21')]?_0x328cf2[_0x182e('0x21')][_0x182e('0x23')]||null:null,'attributes':_0x328cf2[_0x182e('0x21')]?_0x328cf2[_0x182e('0x21')][_0x182e('0x24')]||null:null,'limit':_0x328cf2[_0x182e('0x21')]?_0x328cf2[_0x182e('0x21')]['limit']||null:null,'include':_0x328cf2[_0x182e('0x21')]?_0x328cf2['options']['include']?_[_0x182e('0x25')](_0x328cf2[_0x182e('0x21')][_0x182e('0x26')],function(_0x1b7c76){return{'model':db[_0x1b7c76[_0x182e('0x27')]],'as':_0x1b7c76['as'],'attributes':_0x1b7c76[_0x182e('0x24')],'include':_0x1b7c76[_0x182e('0x26')]?_['map'](_0x1b7c76[_0x182e('0x26')],function(_0x3be1a6){return{'model':db[_0x3be1a6[_0x182e('0x27')]],'as':_0x3be1a6['as'],'attributes':_0x3be1a6[_0x182e('0x24')],'include':_0x3be1a6[_0x182e('0x26')]?_['map'](_0x3be1a6[_0x182e('0x26')],function(_0x289a60){return{'model':db[_0x289a60[_0x182e('0x27')]],'as':_0x289a60['as'],'attributes':_0x289a60[_0x182e('0x24')]};}):[]};}):[]};}):[]:[]})[_0x182e('0x13')](function(_0x3b83fc){logger[_0x182e('0x14')](_0x182e('0x1e'),_0x328cf2);logger[_0x182e('0x17')](_0x182e('0x1e'),_0x328cf2,JSON[_0x182e('0x19')](_0x3b83fc));_0x45a982(_0x3b83fc);})[_0x182e('0x28')](function(_0x3be8a2){logger[_0x182e('0x1a')](_0x182e('0x1e'),_0x3be8a2[_0x182e('0x1c')],_0x328cf2);_0x3f034e(_0x307de5[_0x182e('0x1a')](0x1f4,_0x3be8a2[_0x182e('0x1c')]));});});};exports[_0x182e('0x29')]=function(_0x557b0b,_0x3e64da,_0x1f1908){var _0x21f42e=this;return new Promise(function(_0x2794dd,_0x2aee55){var _0x45d690={'body':_0x557b0b['body'],'channel':_0x182e('0x2a')};var _0x5ba573=[];var _0x283db3=[];var _0x5a82a3={};return db[_0x182e('0x2b')][_0x182e('0x2c')]()[_0x182e('0x13')](function(_0x26677f){if(!_0x26677f){throw new db[(_0x182e('0x2d'))][(_0x182e('0x2e'))](_0x182e('0x2f'));}_0x5ba573=_[_0x182e('0x30')](_[_0x182e('0x31')](_0x26677f),[_0x182e('0x32'),_0x182e('0x33')]);_0x283db3=_[_0x182e('0x30')](_[_0x182e('0x31')](_0x26677f),[_0x182e('0x32'),_0x182e('0x33'),_0x182e('0x34'),_0x182e('0x35')]);if(_0x557b0b[_0x182e('0x36')]['id']){delete _0x557b0b[_0x182e('0x36')]['id'];}if(_[_0x182e('0x37')](_0x557b0b['body'][_0x182e('0x38')])){throw new db['Sequelize']['ValidationError'](_0x182e('0x39'));}if(_[_0x182e('0x37')](_0x557b0b[_0x182e('0x36')][_0x182e('0x36')])||_0x557b0b['body'][_0x182e('0x36')]===''){throw new db[(_0x182e('0x2d'))]['ValidationError'](_0x182e('0x3a'));}if(_['isNil'](_0x557b0b['body'][_0x182e('0x3b')])){throw new db[(_0x182e('0x2d'))]['ValidationError'](_0x182e('0x3c')+_0x283db3);}if(!_[_0x182e('0x3d')](_0x283db3,_0x557b0b['body']['mapKey'])){throw new db[(_0x182e('0x2d'))][(_0x182e('0x2e'))](_0x182e('0x3e')+_0x283db3);}_0x5a82a3[_0x557b0b[_0x182e('0x36')][_0x182e('0x3b')]]=_0x557b0b[_0x182e('0x36')][_0x182e('0x38')];})[_0x182e('0x13')](function(){return db[_0x182e('0x1f')][_0x182e('0x3f')]({'where':{'id':_0x557b0b['account']['id']},'include':[{'model':db['CmList'],'as':_0x182e('0x40'),'include':[{'model':db[_0x182e('0x2b')],'as':_0x182e('0x41'),'where':_0x5a82a3,'limit':0x1,'order':[[_0x182e('0x33'),_0x182e('0x42')]]}]},{'model':db[_0x182e('0x43')],'as':_0x182e('0x44')}]});})[_0x182e('0x13')](function(_0x3ab34f){if(_0x3ab34f&&_0x3ab34f[_0x182e('0x40')]){var _0x294c48=_0x3ab34f['get']({'plain':!![]});_0x45d690[_0x182e('0x45')]=_0x294c48;_0x45d690[_0x182e('0x46')]=_0x294c48['Applications'];_0x45d690[_0x182e('0x47')]=_0x294c48['List'];_0x45d690[_0x182e('0x46')]=_[_0x182e('0x48')](_0x45d690[_0x182e('0x46')],['priority'],[_0x182e('0x49')]);if(_0x45d690[_0x182e('0x45')]['Applications']){delete _0x45d690[_0x182e('0x45')]['Applications'];}if(_0x45d690[_0x182e('0x45')][_0x182e('0x40')]&&_0x45d690[_0x182e('0x45')][_0x182e('0x40')][_0x182e('0x41')][_0x182e('0x4a')]){return _0x45d690['account'][_0x182e('0x40')][_0x182e('0x41')][0x0];}var _0x896cef=_[_0x182e('0xe')](_0x557b0b[_0x182e('0x36')],{'firstName':_0x557b0b[_0x182e('0x36')][_0x182e('0x38')],'ListId':_0x294c48['ListId']});_0x896cef[_0x557b0b[_0x182e('0x36')]['mapKey']]=_0x557b0b['body']['from'];return db[_0x182e('0x2b')][_0x182e('0x4b')](_0x896cef,{'fields':_0x5ba573,'raw':!![]});}})['then'](function(_0x3c86ba){_0x45d690[_0x182e('0x4c')]=_0x3c86ba;if(_0x3c86ba){var _0x37c0f0={'ContactId':_0x3c86ba['id'],'FaxAccountId':_0x557b0b[_0x182e('0x45')]['id'],'fax':_0x3c86ba[_0x182e('0x2a')]};return db['FaxInteraction'][_0x182e('0x3f')]({'where':{'ContactId':_0x3c86ba['id'],'closed':![],'FaxAccountId':_0x557b0b['account']['id']}})[_0x182e('0x13')](function(_0x44e7f3){if(_0x44e7f3){return[_0x44e7f3,![]];}return db['FaxInteraction'][_0x182e('0x4b')](_0x37c0f0)[_0x182e('0x13')](function(_0x53853){return[_0x53853,!![]];});});}else{throw new Error(_0x182e('0x4d'));}})[_0x182e('0x4e')](function(_0x5819f6,_0x2358b0){var _0xeae6c0=_0x5819f6['get']({'plain':!![]});if(_0x2358b0){if(_0x45d690[_0x182e('0x45')]['autoclose']){_0x45d690['applications'][_0x182e('0x4f')]({'id':0x0,'priority':_0x45d690[_0x182e('0x46')][_0x182e('0x4a')]+0x1,'app':_0x182e('0x50'),'appdata':_0x182e('0x51'),'interval':_0x182e('0x52')});}_0xeae6c0[_0x182e('0x53')]=!![];}else{_0xeae6c0[_0x182e('0x53')]=![];}_0x45d690['interaction']=_0xeae6c0;return db[_0x182e('0x54')]['create']({'body':_0x557b0b[_0x182e('0x36')]['body'],'FaxAccountId':_0x557b0b['account']['id'],'FaxInteractionId':_0x5819f6['id'],'direction':'in','ContactId':_0x5819f6[_0x182e('0x55')],'AttachmentId':_0x557b0b[_0x182e('0x36')][_0x182e('0x56')]});})[_0x182e('0x13')](function(_0x3a52fc){_0x45d690[_0x182e('0x1c')]=_0x3a52fc;if(_0x45d690['interaction'][_0x182e('0x57')]){return db[_0x182e('0x58')]['find']({'attributes':['id',_0x182e('0x59')],'where':{'id':_0x45d690[_0x182e('0x5a')][_0x182e('0x57')]}})[_0x182e('0x13')](function(_0x5dc4c1){if(_0x5dc4c1){_0x45d690['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5dc4c1['name']+','+(_0x45d690['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x182e('0x5b'),_0x45d690);});}return respondWithRpcPromise(_0x182e('0x5c'),_0x182e('0x5b'),_0x45d690);})[_0x182e('0x13')](function(_0x26779c){_0x2794dd(_0x26779c);})[_0x182e('0x28')](function(_0x54cf80){_0x2aee55(_0x21f42e[_0x182e('0x1a')](0x1f4,_0x54cf80[_0x182e('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 03133cf..7a02dda 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 _0xf61e=['faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x2641e5,_0x165b4b){var _0x3831f2=function(_0x50a8c6){while(--_0x50a8c6){_0x2641e5['push'](_0x2641e5['shift']());}};_0x3831f2(++_0x165b4b);}(_0xf61e,0x191));var _0xef61=function(_0x4d7e98,_0x26cb62){_0x4d7e98=_0x4d7e98-0x0;var _0xe06c8a=_0xf61e[_0x4d7e98];return _0xe06c8a;};'use strict';var FaxAccountEvents=require(_0xef61('0x0'));var events=[_0xef61('0x1'),_0xef61('0x2'),_0xef61('0x3')];function createListener(_0x205269,_0xeccd26){return function(_0x3613e6){_0xeccd26[_0xef61('0x4')](_0x205269,_0x3613e6);};}function removeListener(_0x2bd1d0,_0x14122a){return function(){FaxAccountEvents[_0xef61('0x5')](_0x2bd1d0,_0x14122a);};}exports[_0xef61('0x6')]=function(_0x5b00b2){for(var _0x9e17f4=0x0,_0x3e2f79=events['length'];_0x9e17f4<_0x3e2f79;_0x9e17f4++){var _0x2242a7=events[_0x9e17f4];var _0x277fa1=createListener(_0xef61('0x7')+_0x2242a7,_0x5b00b2);FaxAccountEvents['on'](_0x2242a7,_0x277fa1);}}; \ No newline at end of file +var _0x3d04=['remove','update','emit','removeListener','register','faxAccount:','./faxAccount.events','save'];(function(_0x40e79e,_0x632443){var _0x4ee3d7=function(_0x4c7bf2){while(--_0x4c7bf2){_0x40e79e['push'](_0x40e79e['shift']());}};_0x4ee3d7(++_0x632443);}(_0x3d04,0xbe));var _0x43d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d04[_0x2dafbe];return _0x58a45a;};'use strict';var FaxAccountEvents=require(_0x43d0('0x0'));var events=[_0x43d0('0x1'),_0x43d0('0x2'),_0x43d0('0x3')];function createListener(_0x191de5,_0x143fea){return function(_0x3d6e62){_0x143fea[_0x43d0('0x4')](_0x191de5,_0x3d6e62);};}function removeListener(_0x5a9e1d,_0x2a4d4c){return function(){FaxAccountEvents[_0x43d0('0x5')](_0x5a9e1d,_0x2a4d4c);};}exports[_0x43d0('0x6')]=function(_0x617bf){for(var _0x5e284f=0x0,_0x484271=events['length'];_0x5e284f<_0x484271;_0x5e284f++){var _0x5efb95=events[_0x5e284f];var _0x457550=createListener(_0x43d0('0x7')+_0x5efb95,_0x617bf);FaxAccountEvents['on'](_0x5efb95,_0x457550);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index f654236..dfb89c7 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 _0x0a22=['/:id/users','getAgents','post','create','addDisposition','addAnswer','addApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','delete','destroy','removeDispositions','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages'];(function(_0x2f5128,_0x39e88a){var _0x1e367a=function(_0x5d141b){while(--_0x5d141b){_0x2f5128['push'](_0x2f5128['shift']());}};_0x1e367a(++_0x39e88a);}(_0x0a22,0x108));var _0x20a2=function(_0x5b3e63,_0x53686e){_0x5b3e63=_0x5b3e63-0x0;var _0x2e8e4d=_0x0a22[_0x5b3e63];return _0x2e8e4d;};'use strict';var multer=require('multer');var util=require(_0x20a2('0x0'));var path=require('path');var timeout=require(_0x20a2('0x1'));var express=require(_0x20a2('0x2'));var router=express[_0x20a2('0x3')]();var auth=require(_0x20a2('0x4'));var interaction=require(_0x20a2('0x5'));var config=require(_0x20a2('0x6'));var controller=require(_0x20a2('0x7'));router[_0x20a2('0x8')]('/',auth[_0x20a2('0x9')](),controller[_0x20a2('0xa')]);router[_0x20a2('0x8')](_0x20a2('0xb'),auth[_0x20a2('0x9')](),controller[_0x20a2('0xc')]);router[_0x20a2('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x20a2('0x8')](_0x20a2('0xd'),auth['isAuthenticated'](),controller[_0x20a2('0xe')]);router['get'](_0x20a2('0xf'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x10')]);router[_0x20a2('0x8')](_0x20a2('0x11'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x12')]);router['get'](_0x20a2('0x13'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x14')]);router[_0x20a2('0x8')](_0x20a2('0x15'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x16')]);router[_0x20a2('0x8')](_0x20a2('0x17'),auth['isAuthenticated'](),controller[_0x20a2('0x18')]);router[_0x20a2('0x19')]('/',auth[_0x20a2('0x9')](),controller[_0x20a2('0x1a')]);router[_0x20a2('0x19')](_0x20a2('0xd'),auth['isAuthenticated'](),controller[_0x20a2('0x1b')]);router['post'](_0x20a2('0xf'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x1c')]);router[_0x20a2('0x19')](_0x20a2('0x11'),auth['isAuthenticated'](),controller['addInteraction']);router['post'](_0x20a2('0x13'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x1d')]);router[_0x20a2('0x19')]('/addaccountapplications',auth[_0x20a2('0x9')](),controller['addAccountApplications']);router[_0x20a2('0x19')](_0x20a2('0x1e'),auth[_0x20a2('0x9')](),controller['updateAccountApplications']);router[_0x20a2('0x19')](_0x20a2('0x1f'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x20')]);router['post']('/:id/users',auth[_0x20a2('0x9')](),controller[_0x20a2('0x21')]);router[_0x20a2('0x22')](_0x20a2('0x23'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x24')]);router[_0x20a2('0x25')](_0x20a2('0x23'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x26')]);router[_0x20a2('0x25')](_0x20a2('0xd'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x27')]);router[_0x20a2('0x25')](_0x20a2('0xf'),auth[_0x20a2('0x9')](),controller['removeAnswers']);router['delete'](_0x20a2('0x17'),auth[_0x20a2('0x9')](),controller['removeAgents']);module[_0x20a2('0x28')]=router; \ No newline at end of file +var _0xffb3=['removeAgents','exports','util','connect-timeout','express','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getAnswers','getInteractions','getApplications','/:id/messages','getMessages','/:id/users','getAgents','addDisposition','post','/:id/canned_answers','addInteraction','/:id/applications','/addaccountapplications','addAccountApplications','/:id/send','send','addAgents','/:id','update','delete','destroy','removeDispositions'];(function(_0xfbc6e6,_0x3efaea){var _0x4884af=function(_0x4de6e3){while(--_0x4de6e3){_0xfbc6e6['push'](_0xfbc6e6['shift']());}};_0x4884af(++_0x3efaea);}(_0xffb3,0xf7));var _0x3ffb=function(_0x3503e5,_0x490a96){_0x3503e5=_0x3503e5-0x0;var _0x2059fa=_0xffb3[_0x3503e5];return _0x2059fa;};'use strict';var multer=require('multer');var util=require(_0x3ffb('0x0'));var path=require('path');var timeout=require(_0x3ffb('0x1'));var express=require(_0x3ffb('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3ffb('0x3'));var controller=require('./faxAccount.controller');router[_0x3ffb('0x4')]('/',auth[_0x3ffb('0x5')](),controller[_0x3ffb('0x6')]);router[_0x3ffb('0x4')](_0x3ffb('0x7'),auth[_0x3ffb('0x5')](),controller[_0x3ffb('0x8')]);router['get']('/:id',auth[_0x3ffb('0x5')](),controller[_0x3ffb('0x9')]);router['get'](_0x3ffb('0xa'),auth[_0x3ffb('0x5')](),controller['getDispositions']);router[_0x3ffb('0x4')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3ffb('0xb')]);router[_0x3ffb('0x4')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x3ffb('0xc')]);router[_0x3ffb('0x4')]('/:id/applications',auth[_0x3ffb('0x5')](),controller[_0x3ffb('0xd')]);router['get'](_0x3ffb('0xe'),auth[_0x3ffb('0x5')](),controller[_0x3ffb('0xf')]);router[_0x3ffb('0x4')](_0x3ffb('0x10'),auth[_0x3ffb('0x5')](),controller[_0x3ffb('0x11')]);router['post']('/',auth[_0x3ffb('0x5')](),controller['create']);router['post'](_0x3ffb('0xa'),auth[_0x3ffb('0x5')](),controller[_0x3ffb('0x12')]);router[_0x3ffb('0x13')](_0x3ffb('0x14'),auth[_0x3ffb('0x5')](),controller['addAnswer']);router[_0x3ffb('0x13')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x3ffb('0x15')]);router[_0x3ffb('0x13')](_0x3ffb('0x16'),auth['isAuthenticated'](),controller['addApplications']);router[_0x3ffb('0x13')](_0x3ffb('0x17'),auth[_0x3ffb('0x5')](),controller[_0x3ffb('0x18')]);router[_0x3ffb('0x13')]('/updateaccountapplications',auth[_0x3ffb('0x5')](),controller['updateAccountApplications']);router[_0x3ffb('0x13')](_0x3ffb('0x19'),auth[_0x3ffb('0x5')](),controller[_0x3ffb('0x1a')]);router[_0x3ffb('0x13')](_0x3ffb('0x10'),auth['isAuthenticated'](),controller[_0x3ffb('0x1b')]);router['put'](_0x3ffb('0x1c'),auth['isAuthenticated'](),controller[_0x3ffb('0x1d')]);router[_0x3ffb('0x1e')](_0x3ffb('0x1c'),auth[_0x3ffb('0x5')](),controller[_0x3ffb('0x1f')]);router[_0x3ffb('0x1e')](_0x3ffb('0xa'),auth[_0x3ffb('0x5')](),controller[_0x3ffb('0x20')]);router[_0x3ffb('0x1e')](_0x3ffb('0x14'),auth[_0x3ffb('0x5')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0x3ffb('0x5')](),controller[_0x3ffb('0x21')]);module[_0x3ffb('0x22')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 510d6ac..891bc55 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 _0x1c77=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x31263b,_0x651893){var _0x56005e=function(_0x3b78a1){while(--_0x3b78a1){_0x31263b['push'](_0x31263b['shift']());}};_0x56005e(++_0x651893);}(_0x1c77,0xed));var _0x71c7=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0x1c77[_0x18e52b];return _0x3d3062;};'use strict';var Sequelize=require('sequelize');module[_0x71c7('0x0')]={'priority':{'type':Sequelize[_0x71c7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x71c7('0x2')],'allowNull':![],'defaultValue':_0x71c7('0x3')},'appdata':{'type':Sequelize[_0x71c7('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x71c7('0x2')],'defaultValue':_0x71c7('0x5')}}; \ No newline at end of file +var _0x3588=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x473b7b,_0x1b017a){var _0x4d18b9=function(_0x569253){while(--_0x569253){_0x473b7b['push'](_0x473b7b['shift']());}};_0x4d18b9(++_0x1b017a);}(_0x3588,0x82));var _0x8358=function(_0xf1f2e0,_0x37c415){_0xf1f2e0=_0xf1f2e0-0x0;var _0x991373=_0x3588[_0xf1f2e0];return _0x991373;};'use strict';var Sequelize=require(_0x8358('0x0'));module[_0x8358('0x1')]={'priority':{'type':Sequelize[_0x8358('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8358('0x3')],'allowNull':![],'defaultValue':_0x8358('0x4')},'appdata':{'type':Sequelize[_0x8358('0x5')]()},'description':{'type':Sequelize[_0x8358('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8358('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 8b13e73..5214ee4 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 _0x77e5=['FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','set','reject','save','update','destroy','then','error','stack','name','index','map'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x77e5,0x1b8));var _0x577e=function(_0x4a9001,_0xb56957){_0x4a9001=_0x4a9001-0x0;var _0x436053=_0x77e5[_0x4a9001];return _0x436053;};'use strict';var pdf=require(_0x577e('0x0'));var emlformat=require(_0x577e('0x1'));var rimraf=require(_0x577e('0x2'));var zipdir=require(_0x577e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x577e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x577e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x577e('0x6'));var ejs=require(_0x577e('0x7'));var fs=require('fs');var _=require(_0x577e('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x577e('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x577e('0x6'));var querystring=require(_0x577e('0xa'));var Papa=require(_0x577e('0xb'));var Redis=require('ioredis');var authService=require(_0x577e('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x577e('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x577e('0xe'))(_0x577e('0xf'));var utils=require(_0x577e('0x10'));var config=require(_0x577e('0x11'));var licenseUtil=require(_0x577e('0x12'));var db=require(_0x577e('0x13'))['db'];function respondWithStatusCode(_0x5187df,_0x417dca){_0x417dca=_0x417dca||0xcc;return function(_0x52123d){if(_0x52123d){return _0x5187df[_0x577e('0x14')](_0x417dca);}return _0x5187df['status'](_0x417dca)[_0x577e('0x15')]();};}function respondWithResult(_0x4c636e,_0x265176){_0x265176=_0x265176||0xc8;return function(_0x300c53){if(_0x300c53){return _0x4c636e[_0x577e('0x16')](_0x265176)['json'](_0x300c53);}};}function respondWithFilteredResult(_0x5ca069,_0x404062){return function(_0x277f74){if(_0x277f74){var _0x28edc7=_0x277f74[_0x577e('0x17')],_0x2dfa20=_0x404062[_0x577e('0x18')],_0x53111a=_0x404062[_0x577e('0x18')]+_0x404062['limit'],_0xce3937;if(_0x53111a>=_0x28edc7){_0x53111a=_0x28edc7;_0xce3937=0xc8;}else{_0xce3937=0xce;}_0x5ca069[_0x577e('0x16')](_0xce3937);return _0x5ca069[_0x577e('0x19')]('Content-Range',_0x2dfa20+'-'+_0x53111a+'/'+_0x28edc7)['json'](_0x277f74);}return null;};}function patchUpdates(_0x12db90){return function(_0x4d31cc){try{jsonpatch['apply'](_0x4d31cc,_0x12db90,!![]);}catch(_0x477eb5){return BPromise[_0x577e('0x1a')](_0x477eb5);}return _0x4d31cc[_0x577e('0x1b')]();};}function saveUpdates(_0x16dcd7,_0x4aff16){return function(_0x62ecbf){if(_0x62ecbf){return _0x62ecbf[_0x577e('0x1c')](_0x16dcd7)['then'](function(_0x28886b){return _0x28886b;});}return null;};}function removeEntity(_0x257f22,_0x2cb29d){return function(_0x2edd4a){if(_0x2edd4a){return _0x2edd4a[_0x577e('0x1d')]()[_0x577e('0x1e')](function(){_0x257f22['status'](0xcc)[_0x577e('0x15')]();});}};}function handleEntityNotFound(_0x452cb6,_0x3bd614){return function(_0x4ff634){if(!_0x4ff634){_0x452cb6[_0x577e('0x14')](0x194);}return _0x4ff634;};}function handleError(_0xc46eba,_0x30557d){_0x30557d=_0x30557d||0x1f4;return function(_0x2d3dfa){logger[_0x577e('0x1f')](_0x2d3dfa[_0x577e('0x20')]);if(_0x2d3dfa[_0x577e('0x21')]){delete _0x2d3dfa[_0x577e('0x21')];}_0xc46eba[_0x577e('0x16')](_0x30557d)['send'](_0x2d3dfa);};}exports[_0x577e('0x22')]=function(_0x3f73f0,_0xedad02){var _0xd74582={},_0x55392c={},_0x1888fa={'count':0x0,'rows':[]};var _0x44f988=_[_0x577e('0x23')](db[_0x577e('0x24')][_0x577e('0x25')],function(_0x52cd6b){return{'name':_0x52cd6b[_0x577e('0x26')],'type':_0x52cd6b[_0x577e('0x27')][_0x577e('0x28')]};});_0x55392c[_0x577e('0x29')]=_[_0x577e('0x23')](_0x44f988,_0x577e('0x21'));_0x55392c[_0x577e('0x2a')]=_[_0x577e('0x2b')](_0x3f73f0['query']);_0x55392c['filters']=_['intersection'](_0x55392c[_0x577e('0x29')],_0x55392c['query']);_0xd74582[_0x577e('0x2c')]=_['intersection'](_0x55392c['model'],qs[_0x577e('0x2d')](_0x3f73f0[_0x577e('0x2a')][_0x577e('0x2d')]));_0xd74582[_0x577e('0x2c')]=_0xd74582[_0x577e('0x2c')][_0x577e('0x2e')]?_0xd74582[_0x577e('0x2c')]:_0x55392c[_0x577e('0x29')];if(!_0x3f73f0[_0x577e('0x2a')][_0x577e('0x2f')](_0x577e('0x30'))){_0xd74582[_0x577e('0x31')]=qs['limit'](_0x3f73f0[_0x577e('0x2a')][_0x577e('0x31')]);_0xd74582[_0x577e('0x18')]=qs[_0x577e('0x18')](_0x3f73f0['query']['offset']);}_0xd74582[_0x577e('0x32')]=qs[_0x577e('0x33')](_0x3f73f0[_0x577e('0x2a')][_0x577e('0x33')]);_0xd74582[_0x577e('0x34')]=qs[_0x577e('0x35')](_[_0x577e('0x36')](_0x3f73f0[_0x577e('0x2a')],_0x55392c[_0x577e('0x35')]),_0x44f988);if(_0x3f73f0[_0x577e('0x2a')]['filter']){_0xd74582[_0x577e('0x34')]=_[_0x577e('0x37')](_0xd74582[_0x577e('0x34')],{'$or':_['map'](_0x44f988,function(_0xb4d27){if(_0xb4d27[_0x577e('0x27')]!==_0x577e('0x38')){var _0x3d6e2e={};_0x3d6e2e[_0xb4d27['name']]={'$like':'%'+_0x3f73f0[_0x577e('0x2a')][_0x577e('0x39')]+'%'};return _0x3d6e2e;}})});}_0xd74582=_[_0x577e('0x37')]({},_0xd74582,_0x3f73f0[_0x577e('0x3a')]);var _0x5142fa={'where':_0xd74582['where']};return db[_0x577e('0x24')][_0x577e('0x17')](_0x5142fa)[_0x577e('0x1e')](function(_0x2dd470){_0x1888fa[_0x577e('0x17')]=_0x2dd470;if(_0x3f73f0[_0x577e('0x2a')][_0x577e('0x3b')]){_0xd74582[_0x577e('0x3c')]=[{'all':!![]}];}return db['FaxApplication'][_0x577e('0x3d')](_0xd74582);})[_0x577e('0x1e')](function(_0x16e8a6){_0x1888fa[_0x577e('0x3e')]=_0x16e8a6;return _0x1888fa;})[_0x577e('0x1e')](respondWithFilteredResult(_0xedad02,_0xd74582))[_0x577e('0x3f')](handleError(_0xedad02,null));};exports[_0x577e('0x40')]=function(_0x370023,_0x480a7b){var _0x441e6f={'raw':!![],'where':{'id':_0x370023['params']['id']}},_0x3c0183={};_0x3c0183[_0x577e('0x29')]=_[_0x577e('0x2b')](db[_0x577e('0x24')][_0x577e('0x25')]);_0x3c0183[_0x577e('0x2a')]=_[_0x577e('0x2b')](_0x370023[_0x577e('0x2a')]);_0x3c0183['filters']=_['intersection'](_0x3c0183[_0x577e('0x29')],_0x3c0183[_0x577e('0x2a')]);_0x441e6f[_0x577e('0x2c')]=_['intersection'](_0x3c0183[_0x577e('0x29')],qs[_0x577e('0x2d')](_0x370023['query']['fields']));_0x441e6f[_0x577e('0x2c')]=_0x441e6f[_0x577e('0x2c')]['length']?_0x441e6f[_0x577e('0x2c')]:_0x3c0183[_0x577e('0x29')];if(_0x370023[_0x577e('0x2a')][_0x577e('0x3b')]){_0x441e6f[_0x577e('0x3c')]=[{'all':!![]}];}_0x441e6f=_[_0x577e('0x37')]({},_0x441e6f,_0x370023[_0x577e('0x3a')]);return db[_0x577e('0x24')][_0x577e('0x41')](_0x441e6f)[_0x577e('0x1e')](handleEntityNotFound(_0x480a7b,null))['then'](respondWithResult(_0x480a7b,null))[_0x577e('0x3f')](handleError(_0x480a7b,null));};exports['create']=function(_0x2d1791,_0x18ef0f){return db['FaxApplication']['create'](_0x2d1791['body'],{})[_0x577e('0x1e')](respondWithResult(_0x18ef0f,0xc9))[_0x577e('0x3f')](handleError(_0x18ef0f,null));};exports[_0x577e('0x1c')]=function(_0x24b5b9,_0x3079b4){if(_0x24b5b9['body']['id']){delete _0x24b5b9[_0x577e('0x42')]['id'];}return db['FaxApplication'][_0x577e('0x41')]({'where':{'id':_0x24b5b9[_0x577e('0x43')]['id']}})['then'](handleEntityNotFound(_0x3079b4,null))['then'](saveUpdates(_0x24b5b9['body'],null))['then'](respondWithResult(_0x3079b4,null))[_0x577e('0x3f')](handleError(_0x3079b4,null));};exports[_0x577e('0x1d')]=function(_0x3b0680,_0x9dae91){return db['FaxApplication'][_0x577e('0x41')]({'where':{'id':_0x3b0680[_0x577e('0x43')]['id']}})[_0x577e('0x1e')](handleEntityNotFound(_0x9dae91,null))[_0x577e('0x1e')](removeEntity(_0x9dae91,null))[_0x577e('0x3f')](handleError(_0x9dae91,null));}; \ No newline at end of file +var _0xf4f3=['index','map','FaxApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','then','includeAll','include','findAll','rows','catch','find','create','body','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','apply','reject','save','update','destroy','sendStatus','error','stack','name','send'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xf4f3,0x1c4));var _0x3f4f=function(_0x345b26,_0x3cbb86){_0x345b26=_0x345b26-0x0;var _0x1e9b57=_0xf4f3[_0x345b26];return _0x1e9b57;};'use strict';var pdf=require(_0x3f4f('0x0'));var emlformat=require(_0x3f4f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3f4f('0x2'));var rp=require(_0x3f4f('0x3'));var moment=require(_0x3f4f('0x4'));var BPromise=require(_0x3f4f('0x5'));var Mustache=require(_0x3f4f('0x6'));var util=require(_0x3f4f('0x7'));var path=require(_0x3f4f('0x8'));var sox=require('sox');var csv=require(_0x3f4f('0x9'));var ejs=require(_0x3f4f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3f4f('0xb'));var crypto=require(_0x3f4f('0xc'));var jsforce=require(_0x3f4f('0xd'));var deskjs=require(_0x3f4f('0xe'));var toCsv=require(_0x3f4f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3f4f('0xf'));var authService=require(_0x3f4f('0x10'));var qs=require(_0x3f4f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f4f('0x12'));var logger=require(_0x3f4f('0x13'))(_0x3f4f('0x14'));var utils=require(_0x3f4f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3f4f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422de2,_0x349fe0){_0x349fe0=_0x349fe0||0xcc;return function(_0x41aa98){if(_0x41aa98){return _0x422de2['sendStatus'](_0x349fe0);}return _0x422de2[_0x3f4f('0x17')](_0x349fe0)[_0x3f4f('0x18')]();};}function respondWithResult(_0x30bba6,_0x1843f4){_0x1843f4=_0x1843f4||0xc8;return function(_0x6479fd){if(_0x6479fd){return _0x30bba6[_0x3f4f('0x17')](_0x1843f4)[_0x3f4f('0x19')](_0x6479fd);}};}function respondWithFilteredResult(_0x2ed578,_0x30b356){return function(_0x435b92){if(_0x435b92){var _0x201abb=_0x435b92['count'],_0x34f184=_0x30b356[_0x3f4f('0x1a')],_0x47cd0a=_0x30b356[_0x3f4f('0x1a')]+_0x30b356[_0x3f4f('0x1b')],_0x13f78e;if(_0x47cd0a>=_0x201abb){_0x47cd0a=_0x201abb;_0x13f78e=0xc8;}else{_0x13f78e=0xce;}_0x2ed578[_0x3f4f('0x17')](_0x13f78e);return _0x2ed578['set']('Content-Range',_0x34f184+'-'+_0x47cd0a+'/'+_0x201abb)[_0x3f4f('0x19')](_0x435b92);}return null;};}function patchUpdates(_0x1f8a83){return function(_0x268135){try{jsonpatch[_0x3f4f('0x1c')](_0x268135,_0x1f8a83,!![]);}catch(_0xf74d45){return BPromise[_0x3f4f('0x1d')](_0xf74d45);}return _0x268135[_0x3f4f('0x1e')]();};}function saveUpdates(_0x1e9f95,_0x39dfc9){return function(_0x2ad6f0){if(_0x2ad6f0){return _0x2ad6f0[_0x3f4f('0x1f')](_0x1e9f95)['then'](function(_0x4e1ab2){return _0x4e1ab2;});}return null;};}function removeEntity(_0x2ad1f8,_0x1736eb){return function(_0x2d2355){if(_0x2d2355){return _0x2d2355[_0x3f4f('0x20')]()['then'](function(){_0x2ad1f8[_0x3f4f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x368145,_0x3c4948){return function(_0x2e0675){if(!_0x2e0675){_0x368145[_0x3f4f('0x21')](0x194);}return _0x2e0675;};}function handleError(_0x28e14e,_0x49b48b){_0x49b48b=_0x49b48b||0x1f4;return function(_0x16b2d4){logger[_0x3f4f('0x22')](_0x16b2d4[_0x3f4f('0x23')]);if(_0x16b2d4['name']){delete _0x16b2d4[_0x3f4f('0x24')];}_0x28e14e[_0x3f4f('0x17')](_0x49b48b)[_0x3f4f('0x25')](_0x16b2d4);};}exports[_0x3f4f('0x26')]=function(_0x412da7,_0x39a331){var _0x969a78={},_0xc2e386={},_0x67ab4a={'count':0x0,'rows':[]};var _0x4e6afb=_[_0x3f4f('0x27')](db[_0x3f4f('0x28')][_0x3f4f('0x29')],function(_0x2ff811){return{'name':_0x2ff811[_0x3f4f('0x2a')],'type':_0x2ff811[_0x3f4f('0x2b')]['key']};});_0xc2e386[_0x3f4f('0x2c')]=_['map'](_0x4e6afb,'name');_0xc2e386[_0x3f4f('0x2d')]=_[_0x3f4f('0x2e')](_0x412da7[_0x3f4f('0x2d')]);_0xc2e386[_0x3f4f('0x2f')]=_[_0x3f4f('0x30')](_0xc2e386[_0x3f4f('0x2c')],_0xc2e386[_0x3f4f('0x2d')]);_0x969a78[_0x3f4f('0x31')]=_[_0x3f4f('0x30')](_0xc2e386[_0x3f4f('0x2c')],qs['fields'](_0x412da7['query'][_0x3f4f('0x32')]));_0x969a78[_0x3f4f('0x31')]=_0x969a78['attributes'][_0x3f4f('0x33')]?_0x969a78[_0x3f4f('0x31')]:_0xc2e386[_0x3f4f('0x2c')];if(!_0x412da7['query'][_0x3f4f('0x34')](_0x3f4f('0x35'))){_0x969a78['limit']=qs[_0x3f4f('0x1b')](_0x412da7['query'][_0x3f4f('0x1b')]);_0x969a78[_0x3f4f('0x1a')]=qs['offset'](_0x412da7['query']['offset']);}_0x969a78['order']=qs[_0x3f4f('0x36')](_0x412da7[_0x3f4f('0x2d')][_0x3f4f('0x36')]);_0x969a78[_0x3f4f('0x37')]=qs['filters'](_[_0x3f4f('0x38')](_0x412da7['query'],_0xc2e386[_0x3f4f('0x2f')]),_0x4e6afb);if(_0x412da7['query'][_0x3f4f('0x39')]){_0x969a78[_0x3f4f('0x37')]=_['merge'](_0x969a78[_0x3f4f('0x37')],{'$or':_[_0x3f4f('0x27')](_0x4e6afb,function(_0x41a4e5){if(_0x41a4e5[_0x3f4f('0x2b')]!=='VIRTUAL'){var _0x4c0a52={};_0x4c0a52[_0x41a4e5['name']]={'$like':'%'+_0x412da7[_0x3f4f('0x2d')]['filter']+'%'};return _0x4c0a52;}})});}_0x969a78=_[_0x3f4f('0x3a')]({},_0x969a78,_0x412da7[_0x3f4f('0x3b')]);var _0x1e2907={'where':_0x969a78[_0x3f4f('0x37')]};return db['FaxApplication'][_0x3f4f('0x3c')](_0x1e2907)[_0x3f4f('0x3d')](function(_0x3ac8a4){_0x67ab4a['count']=_0x3ac8a4;if(_0x412da7[_0x3f4f('0x2d')][_0x3f4f('0x3e')]){_0x969a78[_0x3f4f('0x3f')]=[{'all':!![]}];}return db[_0x3f4f('0x28')][_0x3f4f('0x40')](_0x969a78);})[_0x3f4f('0x3d')](function(_0xfcfa54){_0x67ab4a[_0x3f4f('0x41')]=_0xfcfa54;return _0x67ab4a;})[_0x3f4f('0x3d')](respondWithFilteredResult(_0x39a331,_0x969a78))[_0x3f4f('0x42')](handleError(_0x39a331,null));};exports['show']=function(_0x799646,_0x5dba3a){var _0x234bd0={'raw':!![],'where':{'id':_0x799646['params']['id']}},_0x5b2985={};_0x5b2985[_0x3f4f('0x2c')]=_[_0x3f4f('0x2e')](db['FaxApplication'][_0x3f4f('0x29')]);_0x5b2985[_0x3f4f('0x2d')]=_[_0x3f4f('0x2e')](_0x799646['query']);_0x5b2985[_0x3f4f('0x2f')]=_[_0x3f4f('0x30')](_0x5b2985[_0x3f4f('0x2c')],_0x5b2985[_0x3f4f('0x2d')]);_0x234bd0[_0x3f4f('0x31')]=_[_0x3f4f('0x30')](_0x5b2985[_0x3f4f('0x2c')],qs[_0x3f4f('0x32')](_0x799646[_0x3f4f('0x2d')][_0x3f4f('0x32')]));_0x234bd0[_0x3f4f('0x31')]=_0x234bd0[_0x3f4f('0x31')][_0x3f4f('0x33')]?_0x234bd0[_0x3f4f('0x31')]:_0x5b2985[_0x3f4f('0x2c')];if(_0x799646['query']['includeAll']){_0x234bd0[_0x3f4f('0x3f')]=[{'all':!![]}];}_0x234bd0=_[_0x3f4f('0x3a')]({},_0x234bd0,_0x799646[_0x3f4f('0x3b')]);return db[_0x3f4f('0x28')][_0x3f4f('0x43')](_0x234bd0)[_0x3f4f('0x3d')](handleEntityNotFound(_0x5dba3a,null))[_0x3f4f('0x3d')](respondWithResult(_0x5dba3a,null))[_0x3f4f('0x42')](handleError(_0x5dba3a,null));};exports[_0x3f4f('0x44')]=function(_0x309547,_0x298503){return db['FaxApplication']['create'](_0x309547['body'],{})[_0x3f4f('0x3d')](respondWithResult(_0x298503,0xc9))[_0x3f4f('0x42')](handleError(_0x298503,null));};exports[_0x3f4f('0x1f')]=function(_0x50b2a6,_0x5f4b8d){if(_0x50b2a6[_0x3f4f('0x45')]['id']){delete _0x50b2a6[_0x3f4f('0x45')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x50b2a6['params']['id']}})[_0x3f4f('0x3d')](handleEntityNotFound(_0x5f4b8d,null))[_0x3f4f('0x3d')](saveUpdates(_0x50b2a6[_0x3f4f('0x45')],null))['then'](respondWithResult(_0x5f4b8d,null))[_0x3f4f('0x42')](handleError(_0x5f4b8d,null));};exports[_0x3f4f('0x20')]=function(_0x5c605c,_0x289e03){return db[_0x3f4f('0x28')][_0x3f4f('0x43')]({'where':{'id':_0x5c605c['params']['id']}})[_0x3f4f('0x3d')](handleEntityNotFound(_0x289e03,null))['then'](removeEntity(_0x289e03,null))[_0x3f4f('0x42')](handleError(_0x289e03,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 4e471c9..a0bd054 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 _0x6e80=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','utf8mb4','lodash','util','../../config/logger'];(function(_0x360705,_0x4d9ac0){var _0x192d04=function(_0x17ec8d){while(--_0x17ec8d){_0x360705['push'](_0x360705['shift']());}};_0x192d04(++_0x4d9ac0);}(_0x6e80,0xb8));var _0x06e8=function(_0x14d9de,_0x374859){_0x14d9de=_0x14d9de-0x0;var _0x23dd45=_0x6e80[_0x14d9de];return _0x23dd45;};'use strict';var _=require(_0x06e8('0x0'));var util=require(_0x06e8('0x1'));var logger=require(_0x06e8('0x2'))(_0x06e8('0x3'));var moment=require(_0x06e8('0x4'));var BPromise=require(_0x06e8('0x5'));var rp=require(_0x06e8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06e8('0x7'));var config=require(_0x06e8('0x8'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x288892,_0x4207be){return _0x288892[_0x06e8('0x9')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x06e8('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4d34=['rimraf','../../config/environment','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x1d5388,_0x322020){var _0x4b3349=function(_0x132668){while(--_0x132668){_0x1d5388['push'](_0x1d5388['shift']());}};_0x4b3349(++_0x322020);}(_0x4d34,0x16e));var _0x44d3=function(_0x2cd73d,_0x513411){_0x2cd73d=_0x2cd73d-0x0;var _0x460bbb=_0x4d34[_0x2cd73d];return _0x460bbb;};'use strict';var _=require(_0x44d3('0x0'));var util=require(_0x44d3('0x1'));var logger=require(_0x44d3('0x2'))('api');var moment=require(_0x44d3('0x3'));var BPromise=require('bluebird');var rp=require(_0x44d3('0x4'));var fs=require('fs');var path=require(_0x44d3('0x5'));var rimraf=require(_0x44d3('0x6'));var config=require(_0x44d3('0x7'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x5d61b9,_0x41c02b){return _0x5d61b9[_0x44d3('0x8')](_0x44d3('0x9'),attributes,{'tableName':_0x44d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x44d3('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 262ba21..ce0af48 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 _0x2b47=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','body','options','raw','where','attributes','limit','lodash','util'];(function(_0x36241f,_0xe539cd){var _0x1bbe6d=function(_0x536bac){while(--_0x536bac){_0x36241f['push'](_0x36241f['shift']());}};_0x1bbe6d(++_0xe539cd);}(_0x2b47,0x99));var _0x72b4=function(_0x133498,_0x502216){_0x133498=_0x133498-0x0;var _0x10f5c5=_0x2b47[_0x133498];return _0x10f5c5;};'use strict';var _=require(_0x72b4('0x0'));var util=require(_0x72b4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x72b4('0x2'));var fs=require('fs');var Redis=require(_0x72b4('0x3'));var db=require(_0x72b4('0x4'))['db'];var utils=require(_0x72b4('0x5'));var logger=require(_0x72b4('0x6'))(_0x72b4('0x7'));var config=require(_0x72b4('0x8'));var jayson=require(_0x72b4('0x9'));var client=jayson[_0x72b4('0xa')][_0x72b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2304cd,_0x4d1f45,_0x25895f){return new BPromise(function(_0x5d70e6,_0x112782){return client[_0x72b4('0xc')](_0x2304cd,_0x25895f)[_0x72b4('0xd')](function(_0x46b5e1){logger[_0x72b4('0xe')](_0x72b4('0xf'),_0x4d1f45,_0x72b4('0x10'));logger[_0x72b4('0x11')](_0x72b4('0x12'),_0x4d1f45,_0x72b4('0x10'),JSON[_0x72b4('0x13')](_0x46b5e1));if(_0x46b5e1[_0x72b4('0x14')]){if(_0x46b5e1['error']['code']===0x1f4){logger[_0x72b4('0x14')](_0x72b4('0xf'),_0x4d1f45,_0x46b5e1[_0x72b4('0x14')]['message']);return _0x112782(_0x46b5e1[_0x72b4('0x14')][_0x72b4('0x15')]);}logger[_0x72b4('0x14')](_0x72b4('0xf'),_0x4d1f45,_0x46b5e1[_0x72b4('0x14')]['message']);return _0x5d70e6(_0x46b5e1['error'][_0x72b4('0x15')]);}else{logger[_0x72b4('0xe')](_0x72b4('0xf'),_0x4d1f45,_0x72b4('0x10'));_0x5d70e6(_0x46b5e1[_0x72b4('0x16')][_0x72b4('0x15')]);}})[_0x72b4('0x17')](function(_0x1de88b){logger[_0x72b4('0x14')]('FaxApplication,\x20%s,\x20%s',_0x4d1f45,_0x1de88b);_0x112782(_0x1de88b);});});}exports[_0x72b4('0x18')]=function(_0x2df1d1){var _0x3afd94=this;return new Promise(function(_0x2d155b,_0x141539){return db['FaxApplication']['update'](_0x2df1d1[_0x72b4('0x19')],{'raw':_0x2df1d1[_0x72b4('0x1a')]?_0x2df1d1[_0x72b4('0x1a')][_0x72b4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2df1d1[_0x72b4('0x1a')]?_0x2df1d1[_0x72b4('0x1a')][_0x72b4('0x1c')]||null:null,'attributes':_0x2df1d1[_0x72b4('0x1a')]?_0x2df1d1[_0x72b4('0x1a')][_0x72b4('0x1d')]||null:null,'limit':_0x2df1d1[_0x72b4('0x1a')]?_0x2df1d1['options'][_0x72b4('0x1e')]||null:null})['then'](function(_0x2ed0d6){logger['info'](_0x72b4('0x18'),_0x2df1d1);logger[_0x72b4('0x11')]('UpdateFaxApplication',_0x2df1d1,JSON[_0x72b4('0x13')](_0x2ed0d6));_0x2d155b(_0x2ed0d6);})['catch'](function(_0x1f4d70){logger[_0x72b4('0x14')]('UpdateFaxApplication',_0x1f4d70[_0x72b4('0x15')],_0x2df1d1);_0x141539(_0x3afd94[_0x72b4('0x14')](0x1f4,_0x1f4d70[_0x72b4('0x15')]));});});}; \ No newline at end of file +var _0x5ba5=['request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','where','attributes','limit','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','FaxApplication,\x20%s,\x20%s'];(function(_0x3bb4a0,_0x438ab7){var _0x51f745=function(_0x4e43f4){while(--_0x4e43f4){_0x3bb4a0['push'](_0x3bb4a0['shift']());}};_0x51f745(++_0x438ab7);}(_0x5ba5,0xa7));var _0x55ba=function(_0x3bb63a,_0x15af8f){_0x3bb63a=_0x3bb63a-0x0;var _0x3b822a=_0x5ba5[_0x3bb63a];return _0x3b822a;};'use strict';var _=require(_0x55ba('0x0'));var util=require(_0x55ba('0x1'));var moment=require(_0x55ba('0x2'));var BPromise=require('bluebird');var rs=require(_0x55ba('0x3'));var fs=require('fs');var Redis=require(_0x55ba('0x4'));var db=require(_0x55ba('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x55ba('0x6'))('rpc');var config=require(_0x55ba('0x7'));var jayson=require(_0x55ba('0x8'));var client=jayson[_0x55ba('0x9')][_0x55ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x408a89,_0x1c7a67,_0x256d6e){return new BPromise(function(_0x191473,_0x3be5b5){return client['request'](_0x408a89,_0x256d6e)['then'](function(_0x5a7d9e){logger[_0x55ba('0xb')](_0x55ba('0xc'),_0x1c7a67,_0x55ba('0xd'));logger[_0x55ba('0xe')](_0x55ba('0xf'),_0x1c7a67,_0x55ba('0xd'),JSON[_0x55ba('0x10')](_0x5a7d9e));if(_0x5a7d9e[_0x55ba('0x11')]){if(_0x5a7d9e[_0x55ba('0x11')][_0x55ba('0x12')]===0x1f4){logger[_0x55ba('0x11')](_0x55ba('0xc'),_0x1c7a67,_0x5a7d9e['error'][_0x55ba('0x13')]);return _0x3be5b5(_0x5a7d9e[_0x55ba('0x11')]['message']);}logger[_0x55ba('0x11')]('FaxApplication,\x20%s,\x20%s',_0x1c7a67,_0x5a7d9e[_0x55ba('0x11')]['message']);return _0x191473(_0x5a7d9e[_0x55ba('0x11')][_0x55ba('0x13')]);}else{logger[_0x55ba('0xb')]('FaxApplication,\x20%s,\x20%s',_0x1c7a67,_0x55ba('0xd'));_0x191473(_0x5a7d9e[_0x55ba('0x14')]['message']);}})[_0x55ba('0x15')](function(_0x28df58){logger[_0x55ba('0x11')](_0x55ba('0xc'),_0x1c7a67,_0x28df58);_0x3be5b5(_0x28df58);});});}exports[_0x55ba('0x16')]=function(_0x19e57f){var _0xc20a3e=this;return new Promise(function(_0x16da94,_0x40a210){return db[_0x55ba('0x17')]['update'](_0x19e57f[_0x55ba('0x18')],{'raw':_0x19e57f[_0x55ba('0x19')]?_0x19e57f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19e57f[_0x55ba('0x19')]?_0x19e57f['options'][_0x55ba('0x1a')]||null:null,'attributes':_0x19e57f[_0x55ba('0x19')]?_0x19e57f[_0x55ba('0x19')][_0x55ba('0x1b')]||null:null,'limit':_0x19e57f[_0x55ba('0x19')]?_0x19e57f[_0x55ba('0x19')][_0x55ba('0x1c')]||null:null})[_0x55ba('0x1d')](function(_0x346c4d){logger[_0x55ba('0xb')]('UpdateFaxApplication',_0x19e57f);logger[_0x55ba('0xe')](_0x55ba('0x16'),_0x19e57f,JSON[_0x55ba('0x10')](_0x346c4d));_0x16da94(_0x346c4d);})['catch'](function(_0x1d46d1){logger['error'](_0x55ba('0x16'),_0x1d46d1[_0x55ba('0x13')],_0x19e57f);_0x40a210(_0xc20a3e[_0x55ba('0x11')](0x1f4,_0x1d46d1[_0x55ba('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 998c21f..a32e736 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 _0x7fbe=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout'];(function(_0x3d0fb4,_0x4e5464){var _0xea699f=function(_0x3f863d){while(--_0x3f863d){_0x3d0fb4['push'](_0x3d0fb4['shift']());}};_0xea699f(++_0x4e5464);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3c4856,_0x98f049){_0x3c4856=_0x3c4856-0x0;var _0xba2cac=_0x7fbe[_0x3c4856];return _0xba2cac;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xa')]);router[_0xe7fb('0x8')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller['show']);router[_0xe7fb('0xc')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x11')]);module[_0xe7fb('0x12')]=router; \ No newline at end of file +var _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x687b,0x14a));var _0xb687=function(_0x1a4748,_0x40c46e){_0x1a4748=_0x1a4748-0x0;var _0x28ca99=_0x687b[_0x1a4748];return _0x28ca99;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0xc')]('/',auth[_0xb687('0x9')](),controller['create']);router[_0xb687('0xd')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index ea75609..0839536 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 _0x12e9=['ENUM','out','BOOLEAN','STRING','DATE'];(function(_0x386e27,_0x1124fc){var _0x1539b6=function(_0x5427a5){while(--_0x5427a5){_0x386e27['push'](_0x386e27['shift']());}};_0x1539b6(++_0x1124fc);}(_0x12e9,0x66));var _0x912e=function(_0x297adf,_0x4c1375){_0x297adf=_0x297adf-0x0;var _0x148a7b=_0x12e9[_0x297adf];return _0x148a7b;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x912e('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x912e('0x1')]},'secondDisposition':{'type':Sequelize[_0x912e('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x912e('0x1')]},'read1stAt':{'type':Sequelize[_0x912e('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x912e('0x3')]('in',_0x912e('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x912e('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x912e('0x3')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xee24=['out','DATE','exports','BOOLEAN','STRING','ENUM'];(function(_0x257017,_0x330627){var _0x38536d=function(_0xdf92e){while(--_0xdf92e){_0x257017['push'](_0x257017['shift']());}};_0x38536d(++_0x330627);}(_0xee24,0x1a6));var _0x4ee2=function(_0x519854,_0x4f0240){_0x519854=_0x519854-0x0;var _0x3ea3e6=_0xee24[_0x519854];return _0x3ea3e6;};'use strict';var Sequelize=require('sequelize');module[_0x4ee2('0x0')]={'closed':{'type':Sequelize[_0x4ee2('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x4ee2('0x2')]},'secondDisposition':{'type':Sequelize[_0x4ee2('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4ee2('0x2')]},'note':{'type':Sequelize[_0x4ee2('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x4ee2('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x4ee2('0x3')]('in',_0x4ee2('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4ee2('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4ee2('0x4')),'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 fd04604..b1cd458 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 _0xf3cd=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','fields','includeAll','include','options','create','update','params','describe','addMessage','omit','ids','findOne','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','spread','color','faxInteractionTags:save','removeTags','unix','root','server','files','tmp','join','transcript-%d-%s.zip','push','Attachment','Messages','basename','createReadStream','createWriteStream','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','map','TagIds','Tags','split','catch','FaxInteraction','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','field','from','tools_tags','select','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','contactName','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname'];(function(_0x2b2b3f,_0x3944ed){var _0x5803fe=function(_0x225585){while(--_0x225585){_0x2b2b3f['push'](_0x2b2b3f['shift']());}};_0x5803fe(++_0x3944ed);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0xf3cd[_0x46a38b];return _0x346e75;};'use strict';var pdf=require(_0xdf3c('0x0'));var emlformat=require(_0xdf3c('0x1'));var rimraf=require(_0xdf3c('0x2'));var zipdir=require(_0xdf3c('0x3'));var jsonpatch=require(_0xdf3c('0x4'));var rp=require(_0xdf3c('0x5'));var moment=require('moment');var BPromise=require(_0xdf3c('0x6'));var Mustache=require(_0xdf3c('0x7'));var util=require(_0xdf3c('0x8'));var path=require('path');var sox=require(_0xdf3c('0x9'));var csv=require(_0xdf3c('0xa'));var ejs=require(_0xdf3c('0xb'));var fs=require('fs');var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var licenseUtil=require(_0xdf3c('0x19'));var db=require('../../mysqldb')['db'];config[_0xdf3c('0x1a')]=_[_0xdf3c('0x1b')](config[_0xdf3c('0x1a')],{'host':_0xdf3c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdf3c('0x1a')]));require(_0xdf3c('0x1d'))[_0xdf3c('0x1e')](socket);function respondWithStatusCode(_0x5e0047,_0x18aafa){_0x18aafa=_0x18aafa||0xcc;return function(_0x38b01d){if(_0x38b01d){return _0x5e0047[_0xdf3c('0x1f')](_0x18aafa);}return _0x5e0047[_0xdf3c('0x20')](_0x18aafa)[_0xdf3c('0x21')]();};}function respondWithResult(_0x1a7a5a,_0x305ea5){_0x305ea5=_0x305ea5||0xc8;return function(_0x92008b){if(_0x92008b){return _0x1a7a5a[_0xdf3c('0x20')](_0x305ea5)[_0xdf3c('0x22')](_0x92008b);}};}function respondWithFilteredResult(_0x54cdd4,_0x13b0e6){return function(_0x465e7d){if(_0x465e7d){var _0xf1da1f=_0x465e7d[_0xdf3c('0x23')],_0x18d4ec=_0x13b0e6[_0xdf3c('0x24')],_0x1e2690=_0x13b0e6[_0xdf3c('0x24')]+_0x13b0e6[_0xdf3c('0x25')],_0x113b56;if(_0x1e2690>=_0xf1da1f){_0x1e2690=_0xf1da1f;_0x113b56=0xc8;}else{_0x113b56=0xce;}_0x54cdd4[_0xdf3c('0x20')](_0x113b56);return _0x54cdd4[_0xdf3c('0x26')](_0xdf3c('0x27'),_0x18d4ec+'-'+_0x1e2690+'/'+_0xf1da1f)['json'](_0x465e7d);}return null;};}function patchUpdates(_0x4d620f){return function(_0x3aa254){try{jsonpatch['apply'](_0x3aa254,_0x4d620f,!![]);}catch(_0x15776c){return BPromise[_0xdf3c('0x28')](_0x15776c);}return _0x3aa254[_0xdf3c('0x29')]();};}function saveUpdates(_0x38b319,_0x33652f){return function(_0x36ba1c){if(_0x36ba1c){return _0x36ba1c['update'](_0x38b319)[_0xdf3c('0x2a')](function(_0x213d75){return _0x213d75;});}return null;};}function removeEntity(_0x13e3ca,_0x24754a){return function(_0x40032a){if(_0x40032a){return _0x40032a[_0xdf3c('0x2b')]()[_0xdf3c('0x2a')](function(){_0x13e3ca[_0xdf3c('0x20')](0xcc)[_0xdf3c('0x21')]();});}};}function handleEntityNotFound(_0x1adee4,_0x4c076c){return function(_0xd284d7){if(!_0xd284d7){_0x1adee4[_0xdf3c('0x1f')](0x194);}return _0xd284d7;};}function handleError(_0x4b57a4,_0xdc8962){_0xdc8962=_0xdc8962||0x1f4;return function(_0x59659e){logger['error'](_0x59659e['stack']);if(_0x59659e[_0xdf3c('0x2c')]){delete _0x59659e[_0xdf3c('0x2c')];}_0x4b57a4['status'](_0xdc8962)['send'](_0x59659e);};}function getInteractionUsers(_0x37ecfd,_0x1f2ce4){return new BPromise(function(_0xd3cfcb,_0x1ccdd4){try{if(_0x1f2ce4[_0x37ecfd['id']]){_0x37ecfd['Users']=_[_0xdf3c('0x2d')](_0x1f2ce4[_0x37ecfd['id']],function(_0x2a2d94){return{'id':_0x2a2d94['id'],'fullname':_0x2a2d94['fullname']};});}}catch(_0x51e0a4){_0x1ccdd4(_0x51e0a4);}_0xd3cfcb(_0x37ecfd);});}function getInteractionTags(_0x1f1d8a,_0x46f0e3){return new BPromise(function(_0x36937e,_0x540f3a){try{if(_0x1f1d8a[_0xdf3c('0x2e')]){_0x1f1d8a[_0xdf3c('0x2f')]=[];_0x1f1d8a[_0xdf3c('0x2e')][_0xdf3c('0x30')](',')['forEach'](function(_0xda0de0){_0x1f1d8a[_0xdf3c('0x2f')]['push'](_0x46f0e3[_0xda0de0]);});}delete _0x1f1d8a[_0xdf3c('0x2e')];}catch(_0x3daeda){_0x540f3a(_0x3daeda);}_0x36937e(_0x1f1d8a);});}function updateFaxInteraction(_0x217a65,_0x2287f,_0x5d705d){return new BPromise(function(_0x33632f,_0x360d5c){return getInteractionUsers(_0x217a65,_0x5d705d)[_0xdf3c('0x2a')](function(_0x3b9ce8){return getInteractionTags(_0x3b9ce8,_0x2287f);})['then'](function(_0x474564){_0x33632f(_0x474564);})[_0xdf3c('0x31')](function(_0x5ddd21){_0x360d5c(_0x5ddd21);});});}exports['index']=function(_0x12cc19,_0x588d02){var _0x216115={},_0x5e8130={},_0x57faba={'count':0x0,'rows':[]};var _0x52f0c3=_[_0xdf3c('0x2d')](db[_0xdf3c('0x32')][_0xdf3c('0x33')],function(_0x29b5b7){return{'name':_0x29b5b7['fieldName'],'type':_0x29b5b7['type'][_0xdf3c('0x34')]};});_0x5e8130['model']=_[_0xdf3c('0x2d')](_0x52f0c3,_0xdf3c('0x2c'));_0x5e8130[_0xdf3c('0x35')]=_[_0xdf3c('0x36')](_0x12cc19[_0xdf3c('0x35')]);_0x5e8130[_0xdf3c('0x37')]=_[_0xdf3c('0x38')](_0x5e8130[_0xdf3c('0x39')],_0x5e8130[_0xdf3c('0x35')]);_0x216115['attributes']=_[_0xdf3c('0x38')](_0x5e8130['model'],qs['fields'](_0x12cc19[_0xdf3c('0x35')]['fields']));_0x216115[_0xdf3c('0x3a')]=_0x216115['attributes'][_0xdf3c('0x3b')]?_0x216115[_0xdf3c('0x3a')]:_0x5e8130[_0xdf3c('0x39')];if(!_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x3c')](_0xdf3c('0x3d'))){_0x216115[_0xdf3c('0x25')]=qs[_0xdf3c('0x25')](_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x25')]);_0x216115[_0xdf3c('0x24')]=qs[_0xdf3c('0x24')](_0x12cc19['query']['offset']);}_0x216115[_0xdf3c('0x3e')]=qs['sort'](_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x3f')]);_0x216115[_0xdf3c('0x40')]=qs[_0xdf3c('0x37')](_['pick'](_0x12cc19['query'],_0x5e8130[_0xdf3c('0x37')]),_0x52f0c3);var _0x33edab=[];var _0x106975=squel['select']()[_0xdf3c('0x41')]('id')[_0xdf3c('0x41')](_0xdf3c('0x2c'))[_0xdf3c('0x41')]('color')[_0xdf3c('0x42')](_0xdf3c('0x43'));var _0xe0e167=squel[_0xdf3c('0x44')]()[_0xdf3c('0x41')]('u.id')[_0xdf3c('0x41')](_0xdf3c('0x45'))[_0xdf3c('0x41')](_0xdf3c('0x46'))[_0xdf3c('0x42')](_0xdf3c('0x47'),'ui')['left_join']('users','u',_0xdf3c('0x48'));var _0x2be86d=squel['select']()['from'](_0xdf3c('0x49'),'i')[_0xdf3c('0x4a')](_0xdf3c('0x4b'),'c',_0xdf3c('0x4c'))[_0xdf3c('0x4a')](_0xdf3c('0x4d'),'o',_0xdf3c('0x4e'))[_0xdf3c('0x4a')](_0xdf3c('0x4f'),'a','a.id\x20=\x20i.FaxAccountId')[_0xdf3c('0x4a')](_0xdf3c('0x50'),'me',_0xdf3c('0x51'))[_0xdf3c('0x4a')](_0xdf3c('0x52'),'it',_0xdf3c('0x53'))[_0xdf3c('0x4a')]('tools_tags','t',_0xdf3c('0x54'));var _0x5c1dca=squel[_0xdf3c('0x55')]();var _0x47b101=[];var _0x41b78c=squel[_0xdf3c('0x55')]();var _0x2ec575;if(_0x12cc19[_0xdf3c('0x35')]['search']){_0x2ec575=as['parseSearch'](_0x12cc19['query'][_0xdf3c('0x56')]);var _0x5f5726=_0x2ec575[_0xdf3c('0x57')];for(var _0x3b92d6=0x0;_0x3b92d6<_0x2ec575[_0xdf3c('0x58')][_0xdf3c('0x3b')];_0x3b92d6++){var _0x3b17d9=_0x2ec575['conditions'][_0x3b92d6];var _0x4e7250='i';var _0x2371aa=_[_0xdf3c('0x59')](_0x52f0c3,['name',_0x3b17d9[_0xdf3c('0x41')]]);if(!_0x2371aa){switch(_0x3b17d9[_0xdf3c('0x41')]){case _0xdf3c('0x5a'):if(_0x3b17d9[_0xdf3c('0x5b')]==0x1){_0x2be86d[_0xdf3c('0x5c')]('`'+_0x3b17d9[_0xdf3c('0x41')]+_0xdf3c('0x5d'));}else{_0x2be86d['having']('`'+_0x3b17d9['field']+_0xdf3c('0x5e'));}break;case _0xdf3c('0x5f'):if(_0x3b17d9[_0xdf3c('0x60')]===_0xdf3c('0x61')){if(_0x3b17d9[_0xdf3c('0x5b')][_0xdf3c('0x30')]('\x20')[_0xdf3c('0x3b')]>0x1){_0x5c1dca[_0x5f5726](_0xdf3c('0x62'),qs[_0xdf3c('0x63')](_0x3b17d9[_0xdf3c('0x5b')]),null);}else{var _0x393ad2='%'+_0x3b17d9['value']+'%';_0x5c1dca[_0x5f5726](_0xdf3c('0x64'),_0x393ad2,_0x393ad2,_0x393ad2);}}else{_0x2371aa=_['find'](_0x52f0c3,['name','ContactId']);_0x3b17d9['field']='ContactId';_0x283be2=as[_0xdf3c('0x65')](_0x4e7250,_0x2371aa[_0xdf3c('0x66')],_0x3b17d9);_0x5c1dca[_0x5f5726](_0x283be2['text'],_0x283be2[_0xdf3c('0x5b')][_0xdf3c('0x67')],_0x283be2['value'][_0xdf3c('0x21')]);}break;case _0xdf3c('0x68'):var _0x10e9d5=_0x3b17d9[_0xdf3c('0x5b')][_0xdf3c('0x30')](',')[_0xdf3c('0x2d')](function(_0xb54629){return Number(_0xb54629);});_0x10e9d5[_0xdf3c('0x69')](function(_0x42efa2){_0x41b78c['or'](_0xdf3c('0x6a'),'%,'+_0x42efa2+',%');});_0x47b101=_[_0xdf3c('0x6b')](_0x47b101,_0x10e9d5);break;case'User':if(_0x3b17d9[_0xdf3c('0x60')]===_0xdf3c('0x61')){_0x5c1dca[_0x5f5726](_0xdf3c('0x6c'),'%'+_0x3b17d9['value']+'%',null);}else{_0x2371aa=_[_0xdf3c('0x59')](_0x52f0c3,[_0xdf3c('0x2c'),_0xdf3c('0x6d')]);_0x3b17d9['field']=_0xdf3c('0x6d');_0x283be2=as[_0xdf3c('0x65')](_0x4e7250,_0x2371aa['type'],_0x3b17d9);_0x5c1dca[_0x5f5726](_0x283be2[_0xdf3c('0x6e')],_0x283be2['value'][_0xdf3c('0x67')],_0x283be2[_0xdf3c('0x5b')][_0xdf3c('0x21')]);}break;case _0xdf3c('0x6f'):_0x283be2=as[_0xdf3c('0x65')]('me',null,_0x3b17d9);_0x5c1dca[_0x5f5726](_0x283be2[_0xdf3c('0x6e')],_0x283be2[_0xdf3c('0x5b')][_0xdf3c('0x67')],_0x283be2[_0xdf3c('0x5b')][_0xdf3c('0x21')]);break;}}else{var _0x283be2=as[_0xdf3c('0x65')](_0x4e7250,_0x2371aa[_0xdf3c('0x66')],_0x3b17d9);_0x5c1dca[_0x5f5726](_0x283be2[_0xdf3c('0x6e')],_0x283be2[_0xdf3c('0x5b')][_0xdf3c('0x67')],_0x283be2[_0xdf3c('0x5b')]['end']);}}}else{var _0x4dade5=_(_0x12cc19[_0xdf3c('0x35')])[_0xdf3c('0x36')]()[_0xdf3c('0x2d')](function(_0x596282){return _[_0xdf3c('0x70')](_0x52f0c3,['name',_0x596282])?_0x596282:undefined;})['compact']()[_0xdf3c('0x5b')]();if(!_[_0xdf3c('0x71')](_0x4dade5)){_0x4dade5[_0xdf3c('0x69')](function(_0x373a3e){if(_0x373a3e===_0xdf3c('0x72')){_0x2be86d[_0xdf3c('0x40')](_0xdf3c('0x73'),[][_0xdf3c('0x74')](_0x12cc19[_0xdf3c('0x35')][_0x373a3e]));}else if(_0x373a3e===_0xdf3c('0x75')){var _0x1cce9a=JSON[_0xdf3c('0x76')](_0x12cc19[_0xdf3c('0x35')][_0x373a3e])['$gte'];var _0x3febac=JSON[_0xdf3c('0x76')](_0x12cc19[_0xdf3c('0x35')][_0x373a3e])[_0xdf3c('0x77')];_0x2be86d[_0xdf3c('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1cce9a,_0x3febac);}else{if(_0x12cc19[_0xdf3c('0x35')][_0x373a3e]===_0xdf3c('0x78')){_0x2be86d[_0xdf3c('0x40')]('i.'+_0x373a3e+_0xdf3c('0x79'));}else{_0x2be86d[_0xdf3c('0x40')]('i.'+_0x373a3e+_0xdf3c('0x7a'),_0x12cc19[_0xdf3c('0x35')][_0x373a3e]);}}});}if(_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x7b')]){if(_0x12cc19[_0xdf3c('0x35')]['read']==0x1){_0x2be86d[_0xdf3c('0x5c')](_0xdf3c('0x7c'));}else{_0x2be86d[_0xdf3c('0x5c')](_0xdf3c('0x7d'));}}if(_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x7e')]){_0x47b101=_[_0xdf3c('0x7f')](_0x12cc19['query'][_0xdf3c('0x7e')])?_0x12cc19[_0xdf3c('0x35')]['tag']:new Array(_0x12cc19['query'][_0xdf3c('0x7e')]);_0x47b101[_0xdf3c('0x69')](function(_0x3064de){_0x41b78c['or'](_0xdf3c('0x6a'),'%,'+_0x3064de+',%');});}if(_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x80')]){var _0x207720=_0x12cc19[_0xdf3c('0x35')]['filter'][_0xdf3c('0x81')]('\x5c','\x5c\x5c')[_0xdf3c('0x81')](/'/g,'\x27\x27');if(qs[_0xdf3c('0x82')](_0x207720)){_0x5c1dca['or']('i.id\x20LIKE\x20?',_0x207720+'%')['or'](_0xdf3c('0x83'),_0x207720+'%');}_0x5c1dca['or'](_0xdf3c('0x84'),_0x207720+'%');}}_0x2be86d[_0xdf3c('0x40')](_0x5c1dca);_0x2be86d['group'](_0xdf3c('0x85'));var _0xa42441={'type':db[_0xdf3c('0x86')][_0xdf3c('0x87')][_0xdf3c('0x88')],'raw':!![]};var _0x12f737=_0x2be86d['clone']();_0x12f737['field']('i.id');_0x12f737['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xdf3c('0x5a'));if(_0x216115[_0xdf3c('0x3e')]){_0x216115[_0xdf3c('0x3e')]['forEach'](function(_0x522613){var _0x28528e=_0x522613[0x0]===_0xdf3c('0x89')?_0x522613[0x0]:'i.'+_0x522613[0x0];_0x2be86d['order'](_0x28528e,_0x522613[0x1]==='DESC'?![]:!![]);});}if(!_[_0xdf3c('0x71')](_0x47b101)){_0x2be86d['having'](_0x41b78c);_0x12f737[_0xdf3c('0x40')]('t.id\x20IN\x20?',_0x47b101);}BPromise[_0xdf3c('0x8a')]()[_0xdf3c('0x2a')](function(){if(!_0x2ec575){if(_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x72')]||_0x12cc19['query']['journey'])return;_0x12f737[_0xdf3c('0x40')](_0xdf3c('0x8b'));_0x2be86d[_0xdf3c('0x40')](_0xdf3c('0x8b'));return;}if(_0x12cc19[_0xdf3c('0x8c')][_0xdf3c('0x8d')]!=='agent')return;return _0x12cc19[_0xdf3c('0x8c')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xdf3c('0x2a')](function(_0x9c761a){if(_[_0xdf3c('0x71')](_0x9c761a)){_0x12f737[_0xdf3c('0x40')](_0xdf3c('0x8e'));_0x2be86d['where'](_0xdf3c('0x8e'));}else{_0x12f737[_0xdf3c('0x40')](_0xdf3c('0x73'),_['map'](_0x9c761a,'id'));_0x2be86d['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x9c761a,'id'));}});})[_0xdf3c('0x2a')](function(){if(_0x12cc19[_0xdf3c('0x8c')][_0xdf3c('0x8d')]===_0xdf3c('0x8f')&&!_0x2ec575&&!_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x72')])return[];return db['sequelize'][_0xdf3c('0x35')](_0x12f737['toString'](),_0xa42441);})[_0xdf3c('0x2a')](function(_0x389708){_0x57faba[_0xdf3c('0x23')]=_0x389708[_0xdf3c('0x3b')];if(_0x57faba[_0xdf3c('0x23')]===0x0)return[];return db[_0xdf3c('0x90')][_0xdf3c('0x35')](_0x106975[_0xdf3c('0x91')](),_0xa42441)[_0xdf3c('0x2a')](function(_0x3674e9){_0x33edab=_[_0xdf3c('0x92')](_0x3674e9,'id');_0xa42441=_[_0xdf3c('0x93')](_0xa42441,{'model':db[_0xdf3c('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x12cc19[_0xdf3c('0x35')]['fields']){_0x216115[_0xdf3c('0x3a')][_0xdf3c('0x69')](function(_0x1e2982){_0x2be86d[_0xdf3c('0x41')]('i.'+_0x1e2982);});}else{_0x2be86d['field'](_0xdf3c('0x94'),_0xdf3c('0x5a'));_0x2be86d['field']('a.key',_0xdf3c('0x95'));_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0x96'),_0xdf3c('0x97'));_0x2be86d[_0xdf3c('0x41')]('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',_0xdf3c('0x89'));_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0x98'));_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0x99'),_0xdf3c('0x9a'));_0x2be86d['field'](_0xdf3c('0x9b'),_0xdf3c('0x9c'));_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0x9d'),_0xdf3c('0x9e'));_0x2be86d['field']('c.phone','Contact.phone');_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0x9f'),_0xdf3c('0xa0'));_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0xa1'),_0xdf3c('0xa2'));_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0xa3'),'Owner.fullname');_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0xa4'),_0xdf3c('0xa5'));_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0xa6'),_0xdf3c('0x2e'));}if(_0x216115['limit'])_0x2be86d[_0xdf3c('0x25')](_0x216115[_0xdf3c('0x25')]);if(_0x216115['offset'])_0x2be86d['offset'](_0x216115[_0xdf3c('0x24')]);return db['sequelize'][_0xdf3c('0x35')](_0x2be86d[_0xdf3c('0x91')](),_0xa42441);})['then'](function(_0x2b4084){_0xe0e167[_0xdf3c('0x40')](_0xdf3c('0xa7'),_[_0xdf3c('0x2d')](_0x2b4084,'id'));return db[_0xdf3c('0x90')][_0xdf3c('0x35')](_0xe0e167['toString'](),_0xa42441)[_0xdf3c('0x2a')](function(_0x8d8394){var _0x32eade=_[_0xdf3c('0xa8')](_0x8d8394,_0xdf3c('0xa9'));var _0x3a1eda=[];_0x2b4084[_0xdf3c('0x69')](function(_0x48b892){_0x3a1eda['push'](updateFaxInteraction(_0x48b892,_0x33edab,_0x32eade));});return BPromise[_0xdf3c('0xaa')](_0x3a1eda);});});})[_0xdf3c('0x2a')](function(_0x1f6f9b){_0x57faba['rows']=_0x1f6f9b;return _0x57faba;})[_0xdf3c('0x2a')](respondWithFilteredResult(_0x588d02,_0x216115))['catch'](handleError(_0x588d02,null));};exports['show']=function(_0x205b45,_0x17fb53){var _0x57b01a={'raw':![],'where':{'id':_0x205b45['params']['id']}},_0x2b851b={};_0x2b851b[_0xdf3c('0x39')]=_['keys'](db[_0xdf3c('0x32')][_0xdf3c('0x33')]);_0x2b851b[_0xdf3c('0x35')]=_[_0xdf3c('0x36')](_0x205b45[_0xdf3c('0x35')]);_0x2b851b[_0xdf3c('0x37')]=_[_0xdf3c('0x38')](_0x2b851b[_0xdf3c('0x39')],_0x2b851b[_0xdf3c('0x35')]);_0x57b01a[_0xdf3c('0x3a')]=_[_0xdf3c('0x38')](_0x2b851b[_0xdf3c('0x39')],qs[_0xdf3c('0xab')](_0x205b45[_0xdf3c('0x35')]['fields']));_0x57b01a[_0xdf3c('0x3a')]=_0x57b01a[_0xdf3c('0x3a')][_0xdf3c('0x3b')]?_0x57b01a['attributes']:_0x2b851b[_0xdf3c('0x39')];if(_0x205b45[_0xdf3c('0x35')][_0xdf3c('0xac')]){_0x57b01a[_0xdf3c('0xad')]=[{'all':!![]}];}_0x57b01a=_[_0xdf3c('0x93')]({},_0x57b01a,_0x205b45[_0xdf3c('0xae')]);return db[_0xdf3c('0x32')][_0xdf3c('0x59')](_0x57b01a)[_0xdf3c('0x2a')](handleEntityNotFound(_0x17fb53,null))[_0xdf3c('0x2a')](respondWithResult(_0x17fb53,null))[_0xdf3c('0x31')](handleError(_0x17fb53,null));};exports['create']=function(_0x3bc3c9,_0x85ec3e){return db[_0xdf3c('0x32')][_0xdf3c('0xaf')](_0x3bc3c9[_0xdf3c('0x6f')],{})[_0xdf3c('0x2a')](respondWithResult(_0x85ec3e,0xc9))[_0xdf3c('0x31')](handleError(_0x85ec3e,null));};exports[_0xdf3c('0xb0')]=function(_0x467ffd,_0x260c63){if(_0x467ffd[_0xdf3c('0x6f')]['id']){delete _0x467ffd[_0xdf3c('0x6f')]['id'];}return db['FaxInteraction'][_0xdf3c('0x59')]({'where':{'id':_0x467ffd[_0xdf3c('0xb1')]['id']}})[_0xdf3c('0x2a')](handleEntityNotFound(_0x260c63,null))[_0xdf3c('0x2a')](saveUpdates(_0x467ffd[_0xdf3c('0x6f')],null))[_0xdf3c('0x2a')](respondWithResult(_0x260c63,null))[_0xdf3c('0x31')](handleError(_0x260c63,null));};exports['destroy']=function(_0x396b19,_0x87c93a){return db[_0xdf3c('0x32')][_0xdf3c('0x59')]({'where':{'id':_0x396b19['params']['id']}})[_0xdf3c('0x2a')](handleEntityNotFound(_0x87c93a,null))[_0xdf3c('0x2a')](removeEntity(_0x87c93a,null))['catch'](handleError(_0x87c93a,null));};exports[_0xdf3c('0xb2')]=function(_0x4a1bc4,_0x418021){return db[_0xdf3c('0x32')]['describe']()[_0xdf3c('0x2a')](respondWithResult(_0x418021,null))[_0xdf3c('0x31')](handleError(_0x418021,null));};exports[_0xdf3c('0xb3')]=function(_0x4c0742,_0x4ffd52,_0x243ad5){return db['FaxMessage'][_0xdf3c('0x59')]({'where':{'id':_0x4c0742[_0xdf3c('0xb1')]['id']}})[_0xdf3c('0x2a')](handleEntityNotFound(_0x4ffd52,null))[_0xdf3c('0x2a')](function(_0x5047ab){if(_0x5047ab){return _0x5047ab[_0xdf3c('0xb3')](_0x4c0742[_0xdf3c('0x6f')]['ids'],_[_0xdf3c('0xb4')](_0x4c0742['body'],[_0xdf3c('0xb5'),'id'])||{});}})[_0xdf3c('0x2a')](respondWithResult(_0x4ffd52,null))['catch'](handleError(_0x4ffd52,null));};exports['getMessages']=function(_0x243fbf,_0x4e01ca,_0x37ed69){var _0x306930={'raw':![],'where':{}};var _0x987666={};var _0x34234c={'count':0x0,'rows':[]};return db[_0xdf3c('0x32')][_0xdf3c('0xb6')]({'where':{'id':_0x243fbf[_0xdf3c('0xb1')]['id']}})[_0xdf3c('0x2a')](handleEntityNotFound(_0x4e01ca,null))[_0xdf3c('0x2a')](function(_0x3d8ff0){if(_0x3d8ff0){_0x987666[_0xdf3c('0x39')]=_['keys'](db[_0xdf3c('0xb7')][_0xdf3c('0x33')]);_0x987666['query']=_[_0xdf3c('0x36')](_0x243fbf[_0xdf3c('0x35')]);_0x987666[_0xdf3c('0x37')]=_[_0xdf3c('0x38')](_0x987666[_0xdf3c('0x39')],_0x987666[_0xdf3c('0x35')]);_0x306930['attributes']=_[_0xdf3c('0x38')](_0x987666['model'],qs[_0xdf3c('0xab')](_0x243fbf[_0xdf3c('0x35')][_0xdf3c('0xab')]));_0x306930[_0xdf3c('0x3a')]=_0x306930[_0xdf3c('0x3a')][_0xdf3c('0x3b')]?_0x306930['attributes']:_0x987666[_0xdf3c('0x39')];if(!_0x243fbf[_0xdf3c('0x35')]['hasOwnProperty'](_0xdf3c('0x3d'))){_0x306930[_0xdf3c('0x25')]=qs[_0xdf3c('0x25')](_0x243fbf[_0xdf3c('0x35')][_0xdf3c('0x25')]);_0x306930[_0xdf3c('0x24')]=qs[_0xdf3c('0x24')](_0x243fbf[_0xdf3c('0x35')]['offset']);}_0x306930['order']=qs[_0xdf3c('0x3f')](_0x243fbf[_0xdf3c('0x35')][_0xdf3c('0x3f')]);_0x306930[_0xdf3c('0x40')]=qs['filters'](_['pick'](_0x243fbf[_0xdf3c('0x35')],_0x987666['filters']));_0x306930[_0xdf3c('0x40')]['FaxInteractionId']=_0x3d8ff0['id'];if(_0x243fbf[_0xdf3c('0x35')][_0xdf3c('0x80')]){_0x306930[_0xdf3c('0x40')]=_['merge'](_0x306930[_0xdf3c('0x40')],{'$or':_[_0xdf3c('0x2d')](_0x306930['attributes'],function(_0x50a21b){var _0x45114b={};_0x45114b[_0x50a21b]={'$like':'%'+_0x243fbf[_0xdf3c('0x35')][_0xdf3c('0x80')]+'%'};return _0x45114b;})});}if(_0x243fbf[_0xdf3c('0x35')][_0xdf3c('0xb8')]){var _0x294682=_0x243fbf[_0xdf3c('0x35')]['$gte']['split'](',');var _0xb47a73={};_0xb47a73[_0x294682[0x0]]={'$gte':moment(_0x294682[0x1])[_0xdf3c('0xb9')](_0xdf3c('0xba'))};_0x306930[_0xdf3c('0x40')]=_[_0xdf3c('0x93')](_0x306930[_0xdf3c('0x40')],_0xb47a73);}_0x306930=_[_0xdf3c('0x93')]({},_0x306930,_0x243fbf[_0xdf3c('0xae')]);return db[_0xdf3c('0xb7')][_0xdf3c('0x23')]({'where':_0x306930[_0xdf3c('0x40')]})[_0xdf3c('0x2a')](function(_0x10f2bf){_0x34234c[_0xdf3c('0x23')]=_0x10f2bf;if(_0x243fbf[_0xdf3c('0x35')][_0xdf3c('0xac')]){_0x306930[_0xdf3c('0xad')]=[{'all':!![]}];}return db[_0xdf3c('0xb7')][_0xdf3c('0xbb')](_0x306930);})['then'](function(_0x4c6615){_0x34234c[_0xdf3c('0xbc')]=_0x4c6615;return _0x34234c;});}})['then'](respondWithFilteredResult(_0x4e01ca,_0x306930))['catch'](handleError(_0x4e01ca,null));};exports[_0xdf3c('0xbd')]=function(_0x5b3f84,_0x38895b,_0x3cef21){return db['FaxInteraction']['find']({'where':{'id':_0x5b3f84['params']['id']}})[_0xdf3c('0x2a')](handleEntityNotFound(_0x38895b,null))[_0xdf3c('0x2a')](function(_0x11de00){if(_0x11de00){return _0x11de00['setTags'](_0x5b3f84[_0xdf3c('0x6f')]['ids'],_[_0xdf3c('0xb4')](_0x5b3f84['body'],['ids','id'])||{})[_0xdf3c('0xbe')](function(){return db[_0xdf3c('0x68')][_0xdf3c('0xbb')]({'attributes':['id',_0xdf3c('0x2c'),_0xdf3c('0xbf')],'where':{'id':_0x5b3f84[_0xdf3c('0x6f')]['ids']}});})['then'](function(_0x128a4e){socket['emit'](_0xdf3c('0xc0'),{'id':Number(_0x5b3f84[_0xdf3c('0xb1')]['id']),'tags':_0x128a4e||[]});return{'id':Number(_0x5b3f84[_0xdf3c('0xb1')]['id']),'tags':_0x128a4e||[]};});}})[_0xdf3c('0x2a')](respondWithResult(_0x38895b,null))[_0xdf3c('0x31')](handleError(_0x38895b,null));};exports[_0xdf3c('0xc1')]=function(_0x7b3f53,_0x5a52a0,_0x4f35c8){return db[_0xdf3c('0x32')][_0xdf3c('0x59')]({'where':{'id':_0x7b3f53[_0xdf3c('0xb1')]['id']}})[_0xdf3c('0x2a')](handleEntityNotFound(_0x5a52a0,null))['then'](function(_0xe14463){if(_0xe14463){return _0xe14463[_0xdf3c('0xc1')](_0x7b3f53[_0xdf3c('0x35')][_0xdf3c('0xb5')]);}})[_0xdf3c('0x2a')](respondWithStatusCode(_0x5a52a0,null))[_0xdf3c('0x31')](handleError(_0x5a52a0,null));};exports['download']=function(_0x38ed5d,_0x4545ce){var _0x52cd34=moment()[_0xdf3c('0xc2')]()[_0xdf3c('0x91')]();var _0xe5f939=path['join'](config[_0xdf3c('0xc3')],_0xdf3c('0xc4'),_0xdf3c('0xc5'),_0xdf3c('0xc6'));var _0x3100fa=path[_0xdf3c('0xc7')](config[_0xdf3c('0xc3')],_0xdf3c('0xc4'),_0xdf3c('0xc5'),'attachments');var _0xbb75c2=path['join'](_0xe5f939,_0x52cd34);var _0x24dd51=util[_0xdf3c('0xb9')](_0xdf3c('0xc8'),_0x38ed5d[_0xdf3c('0xb1')]['id'],_0x52cd34);var _0x90c66=path[_0xdf3c('0xc7')](_0xe5f939,_0x24dd51);var _0x1e2f88=[];_0x1e2f88[_0xdf3c('0xc9')]({'model':db[_0xdf3c('0xca')],'as':_0xdf3c('0xca'),'raw':!![]});var _0x3a90f4=[{'model':db['FaxMessage'],'as':_0xdf3c('0xcb'),'attributes':['id',_0xdf3c('0x6f'),'createdAt'],'include':_0x1e2f88}];return db[_0xdf3c('0x32')][_0xdf3c('0x59')]({'where':{'id':_0x38ed5d[_0xdf3c('0xb1')]['id']},'include':_0x3a90f4})[_0xdf3c('0x2a')](handleEntityNotFound(_0x4545ce,null))['then'](function(_0x2670ef){if(_0x2670ef&&_0x2670ef[_0xdf3c('0xcb')]){var _0xd2cdb=_0x2670ef['get']({'plain':!![]});fs['mkdirSync'](_0xbb75c2);for(var _0x5af92b=0x0;_0x5af92b<_0xd2cdb[_0xdf3c('0xcb')][_0xdf3c('0x3b')];_0x5af92b++){var _0x403ac5=_0xd2cdb[_0xdf3c('0xcb')][_0x5af92b][_0xdf3c('0xca')];if(_0x403ac5){var _0x33132b=path[_0xdf3c('0xc7')](_0x3100fa,_0x403ac5[_0xdf3c('0xcc')]);if(fs['existsSync'](_0x33132b)){fs[_0xdf3c('0xcd')](_0x33132b)['pipe'](fs[_0xdf3c('0xce')](path[_0xdf3c('0xc7')](_0xbb75c2,_0x403ac5[_0xdf3c('0xcc')])));}}}return BPromise[_0xdf3c('0x8a')]()[_0xdf3c('0x2a')](function(){return new BPromise(function(_0x440c7c,_0x4e5569){zipdir(_0xbb75c2,{'saveTo':_0x90c66},function(_0xbe2280,_0x116ac9){if(_0xbe2280)return _0x4e5569(_0xbe2280);return _0x440c7c(_0x116ac9);});})['then'](function(){return new BPromise(function(_0x28337a,_0x270353){rimraf(_0xbb75c2,function(_0x5926b6){if(_0x5926b6)_0x270353(_0x5926b6);return _0x28337a();});});})[_0xdf3c('0x2a')](function(){return _0x4545ce['download'](_0x90c66,_0x24dd51,function(_0x32adba){if(_0x32adba){console['log'](_0xdf3c('0xcf'),_0x32adba);}else{fs[_0xdf3c('0xd0')](_0x90c66);}});});});}else{return _0x4545ce[_0xdf3c('0x1f')](0xc8);}})[_0xdf3c('0x31')](handleError(_0x4545ce,null));}; \ No newline at end of file +var _0x6c76=['TagIds','Tags','split','forEach','push','index','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.fullname','ui.FaxInteractionId','left_join','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','$substring','length','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','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.fax\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','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','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','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','catch','params','include','create','describe','addMessage','FaxMessage','ids','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','emit','faxInteractionTags:save','removeTags','download','unix','root','files','join','server','attachments','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','save','update','then','stack','name','send','Users','map'];(function(_0x5af318,_0x46fe9b){var _0x432609=function(_0x143e71){while(--_0x143e71){_0x5af318['push'](_0x5af318['shift']());}};_0x432609(++_0x46fe9b);}(_0x6c76,0x184));var _0x66c7=function(_0x59c4a4,_0x2759e9){_0x59c4a4=_0x59c4a4-0x0;var _0x45b0a5=_0x6c76[_0x59c4a4];return _0x45b0a5;};'use strict';var pdf=require(_0x66c7('0x0'));var emlformat=require(_0x66c7('0x1'));var rimraf=require(_0x66c7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66c7('0x3'));var rp=require(_0x66c7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x66c7('0x5'));var util=require(_0x66c7('0x6'));var path=require('path');var sox=require(_0x66c7('0x7'));var csv=require(_0x66c7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x66c7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c7('0xa'));var deskjs=require(_0x66c7('0xb'));var toCsv=require(_0x66c7('0x8'));var querystring=require('querystring');var Papa=require(_0x66c7('0xc'));var Redis=require(_0x66c7('0xd'));var authService=require(_0x66c7('0xe'));var qs=require(_0x66c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c7('0x10'));var logger=require(_0x66c7('0x11'))(_0x66c7('0x12'));var utils=require(_0x66c7('0x13'));var config=require(_0x66c7('0x14'));var licenseUtil=require(_0x66c7('0x15'));var db=require(_0x66c7('0x16'))['db'];config['redis']=_[_0x66c7('0x17')](config[_0x66c7('0x18')],{'host':_0x66c7('0x19'),'port':0x18eb});var socket=require(_0x66c7('0x1a'))(new Redis(config[_0x66c7('0x18')]));require(_0x66c7('0x1b'))[_0x66c7('0x1c')](socket);function respondWithStatusCode(_0xf3b04,_0x6400fe){_0x6400fe=_0x6400fe||0xcc;return function(_0x5d44e1){if(_0x5d44e1){return _0xf3b04[_0x66c7('0x1d')](_0x6400fe);}return _0xf3b04['status'](_0x6400fe)[_0x66c7('0x1e')]();};}function respondWithResult(_0x39f951,_0x3c81c0){_0x3c81c0=_0x3c81c0||0xc8;return function(_0x42e930){if(_0x42e930){return _0x39f951[_0x66c7('0x1f')](_0x3c81c0)['json'](_0x42e930);}};}function respondWithFilteredResult(_0x5cf913,_0x53fb36){return function(_0x5129f6){if(_0x5129f6){var _0x8ad572=_0x5129f6[_0x66c7('0x20')],_0x19f29d=_0x53fb36[_0x66c7('0x21')],_0x47a299=_0x53fb36[_0x66c7('0x21')]+_0x53fb36[_0x66c7('0x22')],_0x524e87;if(_0x47a299>=_0x8ad572){_0x47a299=_0x8ad572;_0x524e87=0xc8;}else{_0x524e87=0xce;}_0x5cf913['status'](_0x524e87);return _0x5cf913['set'](_0x66c7('0x23'),_0x19f29d+'-'+_0x47a299+'/'+_0x8ad572)[_0x66c7('0x24')](_0x5129f6);}return null;};}function patchUpdates(_0xf30f9){return function(_0x1c43c4){try{jsonpatch[_0x66c7('0x25')](_0x1c43c4,_0xf30f9,!![]);}catch(_0x75f118){return BPromise['reject'](_0x75f118);}return _0x1c43c4[_0x66c7('0x26')]();};}function saveUpdates(_0x366e9b,_0x4a2b90){return function(_0x7462f1){if(_0x7462f1){return _0x7462f1[_0x66c7('0x27')](_0x366e9b)[_0x66c7('0x28')](function(_0x1fc9d3){return _0x1fc9d3;});}return null;};}function removeEntity(_0x5bfaf6,_0x2736df){return function(_0x42ca37){if(_0x42ca37){return _0x42ca37['destroy']()[_0x66c7('0x28')](function(){_0x5bfaf6[_0x66c7('0x1f')](0xcc)[_0x66c7('0x1e')]();});}};}function handleEntityNotFound(_0x2ef6a2,_0x2af0a3){return function(_0x54d45d){if(!_0x54d45d){_0x2ef6a2['sendStatus'](0x194);}return _0x54d45d;};}function handleError(_0x4e514a,_0x2dd131){_0x2dd131=_0x2dd131||0x1f4;return function(_0x542ff1){logger['error'](_0x542ff1[_0x66c7('0x29')]);if(_0x542ff1[_0x66c7('0x2a')]){delete _0x542ff1[_0x66c7('0x2a')];}_0x4e514a[_0x66c7('0x1f')](_0x2dd131)[_0x66c7('0x2b')](_0x542ff1);};}function getInteractionUsers(_0x27be81,_0x570f0d){return new BPromise(function(_0xccefb2,_0x2e2560){try{if(_0x570f0d[_0x27be81['id']]){_0x27be81[_0x66c7('0x2c')]=_[_0x66c7('0x2d')](_0x570f0d[_0x27be81['id']],function(_0x2042ea){return{'id':_0x2042ea['id'],'fullname':_0x2042ea['fullname']};});}}catch(_0x263b48){_0x2e2560(_0x263b48);}_0xccefb2(_0x27be81);});}function getInteractionTags(_0x4f1a34,_0xfbd97){return new BPromise(function(_0x543fbf,_0x296875){try{if(_0x4f1a34[_0x66c7('0x2e')]){_0x4f1a34[_0x66c7('0x2f')]=[];_0x4f1a34[_0x66c7('0x2e')][_0x66c7('0x30')](',')[_0x66c7('0x31')](function(_0x559ab9){_0x4f1a34['Tags'][_0x66c7('0x32')](_0xfbd97[_0x559ab9]);});}delete _0x4f1a34[_0x66c7('0x2e')];}catch(_0x827cbc){_0x296875(_0x827cbc);}_0x543fbf(_0x4f1a34);});}function updateFaxInteraction(_0x3f657e,_0x344345,_0x131f24){return new BPromise(function(_0x44dcde,_0x255ac3){return getInteractionUsers(_0x3f657e,_0x131f24)[_0x66c7('0x28')](function(_0x301495){return getInteractionTags(_0x301495,_0x344345);})[_0x66c7('0x28')](function(_0x2ba9c4){_0x44dcde(_0x2ba9c4);})['catch'](function(_0x562283){_0x255ac3(_0x562283);});});}exports[_0x66c7('0x33')]=function(_0x13e7a2,_0x367ad5){var _0x1b2849={},_0x45050c={},_0x2bf7c2={'count':0x0,'rows':[]};var _0x21d0d3=_['map'](db[_0x66c7('0x34')][_0x66c7('0x35')],function(_0x2484d3){return{'name':_0x2484d3[_0x66c7('0x36')],'type':_0x2484d3[_0x66c7('0x37')][_0x66c7('0x38')]};});_0x45050c[_0x66c7('0x39')]=_[_0x66c7('0x2d')](_0x21d0d3,_0x66c7('0x2a'));_0x45050c[_0x66c7('0x3a')]=_[_0x66c7('0x3b')](_0x13e7a2['query']);_0x45050c['filters']=_[_0x66c7('0x3c')](_0x45050c[_0x66c7('0x39')],_0x45050c[_0x66c7('0x3a')]);_0x1b2849['attributes']=_['intersection'](_0x45050c[_0x66c7('0x39')],qs[_0x66c7('0x3d')](_0x13e7a2['query'][_0x66c7('0x3d')]));_0x1b2849[_0x66c7('0x3e')]=_0x1b2849[_0x66c7('0x3e')]['length']?_0x1b2849[_0x66c7('0x3e')]:_0x45050c[_0x66c7('0x39')];if(!_0x13e7a2[_0x66c7('0x3a')][_0x66c7('0x3f')](_0x66c7('0x40'))){_0x1b2849[_0x66c7('0x22')]=qs[_0x66c7('0x22')](_0x13e7a2[_0x66c7('0x3a')][_0x66c7('0x22')]);_0x1b2849['offset']=qs[_0x66c7('0x21')](_0x13e7a2[_0x66c7('0x3a')][_0x66c7('0x21')]);}_0x1b2849[_0x66c7('0x41')]=qs[_0x66c7('0x42')](_0x13e7a2[_0x66c7('0x3a')][_0x66c7('0x42')]);_0x1b2849[_0x66c7('0x43')]=qs[_0x66c7('0x44')](_[_0x66c7('0x45')](_0x13e7a2['query'],_0x45050c['filters']),_0x21d0d3);var _0x528f5c=[];var _0x209f58=squel[_0x66c7('0x46')]()['field']('id')['field'](_0x66c7('0x2a'))[_0x66c7('0x47')](_0x66c7('0x48'))[_0x66c7('0x49')](_0x66c7('0x4a'));var _0x48eae9=squel[_0x66c7('0x46')]()['field']('u.id')[_0x66c7('0x47')](_0x66c7('0x4b'))[_0x66c7('0x47')](_0x66c7('0x4c'))['from']('user_has_fax_interactions','ui')[_0x66c7('0x4d')]('users','u','u.id\x20=\x20ui.UserId');var _0x1ec272=squel[_0x66c7('0x46')]()[_0x66c7('0x49')](_0x66c7('0x4e'),'i')['left_join'](_0x66c7('0x4f'),'c',_0x66c7('0x50'))[_0x66c7('0x4d')]('users','o',_0x66c7('0x51'))[_0x66c7('0x4d')](_0x66c7('0x52'),'a',_0x66c7('0x53'))[_0x66c7('0x4d')](_0x66c7('0x54'),'me',_0x66c7('0x55'))[_0x66c7('0x4d')]('fax_interaction_has_tags','it',_0x66c7('0x56'))[_0x66c7('0x4d')](_0x66c7('0x4a'),'t',_0x66c7('0x57'));var _0x208a15=squel[_0x66c7('0x58')]();var _0x2cd0c6=[];var _0x12d063=squel[_0x66c7('0x58')]();var _0x2d8eeb;if(_0x13e7a2[_0x66c7('0x3a')][_0x66c7('0x59')]){_0x2d8eeb=as[_0x66c7('0x5a')](_0x13e7a2[_0x66c7('0x3a')]['search']);var _0x43d4db=_0x2d8eeb[_0x66c7('0x5b')];for(var _0x27070b=0x0;_0x27070b<_0x2d8eeb[_0x66c7('0x5c')]['length'];_0x27070b++){var _0x3d3448=_0x2d8eeb[_0x66c7('0x5c')][_0x27070b];var _0x55e026='i';var _0x275a20=_[_0x66c7('0x5d')](_0x21d0d3,[_0x66c7('0x2a'),_0x3d3448[_0x66c7('0x47')]]);if(!_0x275a20){switch(_0x3d3448[_0x66c7('0x47')]){case _0x66c7('0x5e'):if(_0x3d3448[_0x66c7('0x5f')]==0x1){_0x1ec272['having']('`'+_0x3d3448[_0x66c7('0x47')]+_0x66c7('0x60'));}else{_0x1ec272['having']('`'+_0x3d3448[_0x66c7('0x47')]+_0x66c7('0x61'));}break;case _0x66c7('0x62'):if(_0x3d3448['operator']===_0x66c7('0x63')){if(_0x3d3448[_0x66c7('0x5f')][_0x66c7('0x30')]('\x20')[_0x66c7('0x64')]>0x1){_0x208a15[_0x43d4db](_0x66c7('0x65'),qs[_0x66c7('0x66')](_0x3d3448[_0x66c7('0x5f')]),null);}else{var _0x21b298='%'+_0x3d3448['value']+'%';_0x208a15[_0x43d4db](_0x66c7('0x67'),_0x21b298,_0x21b298,_0x21b298);}}else{_0x275a20=_[_0x66c7('0x5d')](_0x21d0d3,['name',_0x66c7('0x68')]);_0x3d3448[_0x66c7('0x47')]=_0x66c7('0x68');_0x229f45=as['buildExpression'](_0x55e026,_0x275a20['type'],_0x3d3448);_0x208a15[_0x43d4db](_0x229f45[_0x66c7('0x69')],_0x229f45['value'][_0x66c7('0x6a')],_0x229f45[_0x66c7('0x5f')][_0x66c7('0x1e')]);}break;case _0x66c7('0x6b'):var _0xebff6b=_0x3d3448[_0x66c7('0x5f')]['split'](',')['map'](function(_0x477e46){return Number(_0x477e46);});_0xebff6b[_0x66c7('0x31')](function(_0x5e6e32){_0x12d063['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5e6e32+',%');});_0x2cd0c6=_[_0x66c7('0x6c')](_0x2cd0c6,_0xebff6b);break;case'User':if(_0x3d3448[_0x66c7('0x6d')]===_0x66c7('0x63')){_0x208a15[_0x43d4db](_0x66c7('0x6e'),'%'+_0x3d3448[_0x66c7('0x5f')]+'%',null);}else{_0x275a20=_['find'](_0x21d0d3,[_0x66c7('0x2a'),_0x66c7('0x6f')]);_0x3d3448[_0x66c7('0x47')]=_0x66c7('0x6f');_0x229f45=as[_0x66c7('0x70')](_0x55e026,_0x275a20[_0x66c7('0x37')],_0x3d3448);_0x208a15[_0x43d4db](_0x229f45['text'],_0x229f45[_0x66c7('0x5f')][_0x66c7('0x6a')],_0x229f45[_0x66c7('0x5f')]['end']);}break;case _0x66c7('0x71'):_0x229f45=as['buildExpression']('me',null,_0x3d3448);_0x208a15[_0x43d4db](_0x229f45[_0x66c7('0x69')],_0x229f45[_0x66c7('0x5f')][_0x66c7('0x6a')],_0x229f45[_0x66c7('0x5f')][_0x66c7('0x1e')]);break;}}else{var _0x229f45=as['buildExpression'](_0x55e026,_0x275a20[_0x66c7('0x37')],_0x3d3448);_0x208a15[_0x43d4db](_0x229f45[_0x66c7('0x69')],_0x229f45[_0x66c7('0x5f')][_0x66c7('0x6a')],_0x229f45[_0x66c7('0x5f')]['end']);}}}else{var _0x463c15=_(_0x13e7a2[_0x66c7('0x3a')])[_0x66c7('0x3b')]()[_0x66c7('0x2d')](function(_0x433fb5){return _[_0x66c7('0x72')](_0x21d0d3,[_0x66c7('0x2a'),_0x433fb5])?_0x433fb5:undefined;})[_0x66c7('0x73')]()[_0x66c7('0x5f')]();if(!_[_0x66c7('0x74')](_0x463c15)){_0x463c15[_0x66c7('0x31')](function(_0x43b582){if(_0x43b582==='FaxAccountId'){_0x1ec272[_0x66c7('0x43')](_0x66c7('0x75'),[][_0x66c7('0x76')](_0x13e7a2[_0x66c7('0x3a')][_0x43b582]));}else if(_0x43b582===_0x66c7('0x77')){var _0x419b49=JSON[_0x66c7('0x78')](_0x13e7a2['query'][_0x43b582])[_0x66c7('0x79')];var _0x2943f3=JSON[_0x66c7('0x78')](_0x13e7a2[_0x66c7('0x3a')][_0x43b582])[_0x66c7('0x7a')];_0x1ec272[_0x66c7('0x43')](_0x66c7('0x7b'),_0x419b49,_0x2943f3);}else{if(_0x13e7a2[_0x66c7('0x3a')][_0x43b582]===_0x66c7('0x7c')){_0x1ec272[_0x66c7('0x43')]('i.'+_0x43b582+_0x66c7('0x7d'));}else{_0x1ec272[_0x66c7('0x43')]('i.'+_0x43b582+_0x66c7('0x7e'),_0x13e7a2[_0x66c7('0x3a')][_0x43b582]);}}});}if(_0x13e7a2[_0x66c7('0x3a')][_0x66c7('0x7f')]){if(_0x13e7a2['query'][_0x66c7('0x7f')]==0x1){_0x1ec272[_0x66c7('0x80')](_0x66c7('0x81'));}else{_0x1ec272[_0x66c7('0x80')](_0x66c7('0x82'));}}if(_0x13e7a2[_0x66c7('0x3a')][_0x66c7('0x83')]){_0x2cd0c6=_[_0x66c7('0x84')](_0x13e7a2[_0x66c7('0x3a')][_0x66c7('0x83')])?_0x13e7a2[_0x66c7('0x3a')][_0x66c7('0x83')]:new Array(_0x13e7a2[_0x66c7('0x3a')][_0x66c7('0x83')]);_0x2cd0c6[_0x66c7('0x31')](function(_0x414e09){_0x12d063['or'](_0x66c7('0x85'),'%,'+_0x414e09+',%');});}if(_0x13e7a2['query'][_0x66c7('0x86')]){var _0x44bbaf=_0x13e7a2[_0x66c7('0x3a')][_0x66c7('0x86')][_0x66c7('0x87')]('\x5c','\x5c\x5c')[_0x66c7('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x44bbaf)){_0x208a15['or']('i.id\x20LIKE\x20?',_0x44bbaf+'%')['or'](_0x66c7('0x88'),_0x44bbaf+'%');}_0x208a15['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x44bbaf+'%');}}_0x1ec272[_0x66c7('0x43')](_0x208a15);_0x1ec272[_0x66c7('0x89')](_0x66c7('0x8a'));var _0x139529={'type':db[_0x66c7('0x8b')][_0x66c7('0x8c')][_0x66c7('0x8d')],'raw':!![]};var _0x3498bb=_0x1ec272[_0x66c7('0x8e')]();_0x3498bb[_0x66c7('0x47')](_0x66c7('0x8a'));_0x3498bb[_0x66c7('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x66c7('0x5e'));if(_0x1b2849[_0x66c7('0x41')]){_0x1b2849[_0x66c7('0x41')][_0x66c7('0x31')](function(_0x51fb54){var _0x1c5ffc=_0x51fb54[0x0]===_0x66c7('0x8f')?_0x51fb54[0x0]:'i.'+_0x51fb54[0x0];_0x1ec272['order'](_0x1c5ffc,_0x51fb54[0x1]===_0x66c7('0x90')?![]:!![]);});}if(!_[_0x66c7('0x74')](_0x2cd0c6)){_0x1ec272[_0x66c7('0x80')](_0x12d063);_0x3498bb[_0x66c7('0x43')](_0x66c7('0x91'),_0x2cd0c6);}BPromise[_0x66c7('0x92')]()['then'](function(){if(!_0x2d8eeb){if(_0x13e7a2['query'][_0x66c7('0x93')]||_0x13e7a2['query']['journey'])return;_0x3498bb[_0x66c7('0x43')](_0x66c7('0x94'));_0x1ec272[_0x66c7('0x43')](_0x66c7('0x94'));return;}if(_0x13e7a2[_0x66c7('0x95')][_0x66c7('0x96')]!==_0x66c7('0x97'))return;return _0x13e7a2[_0x66c7('0x95')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x66c7('0x28')](function(_0x508e2c){if(_[_0x66c7('0x74')](_0x508e2c)){_0x3498bb[_0x66c7('0x43')](_0x66c7('0x98'));_0x1ec272[_0x66c7('0x43')](_0x66c7('0x98'));}else{_0x3498bb[_0x66c7('0x43')](_0x66c7('0x75'),_[_0x66c7('0x2d')](_0x508e2c,'id'));_0x1ec272[_0x66c7('0x43')](_0x66c7('0x75'),_[_0x66c7('0x2d')](_0x508e2c,'id'));}});})[_0x66c7('0x28')](function(){if(_0x13e7a2[_0x66c7('0x95')][_0x66c7('0x96')]===_0x66c7('0x97')&&!_0x2d8eeb&&!_0x13e7a2[_0x66c7('0x3a')][_0x66c7('0x93')])return[];return db[_0x66c7('0x99')][_0x66c7('0x3a')](_0x3498bb[_0x66c7('0x9a')](),_0x139529);})[_0x66c7('0x28')](function(_0x300ff4){_0x2bf7c2[_0x66c7('0x20')]=_0x300ff4[_0x66c7('0x64')];if(_0x2bf7c2[_0x66c7('0x20')]===0x0)return[];return db['sequelize'][_0x66c7('0x3a')](_0x209f58[_0x66c7('0x9a')](),_0x139529)[_0x66c7('0x28')](function(_0x5a163c){_0x528f5c=_[_0x66c7('0x9b')](_0x5a163c,'id');_0x139529=_[_0x66c7('0x9c')](_0x139529,{'model':db[_0x66c7('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x13e7a2['query'][_0x66c7('0x3d')]){_0x1b2849[_0x66c7('0x3e')][_0x66c7('0x31')](function(_0x550dfc){_0x1ec272[_0x66c7('0x47')]('i.'+_0x550dfc);});}else{_0x1ec272[_0x66c7('0x47')](_0x66c7('0x9d'),_0x66c7('0x5e'));_0x1ec272['field'](_0x66c7('0x9e'),_0x66c7('0x9f'));_0x1ec272[_0x66c7('0x47')](_0x66c7('0xa0'),'Account.mandatoryDisposition');_0x1ec272['field'](_0x66c7('0xa1'),_0x66c7('0x8f'));_0x1ec272[_0x66c7('0x47')](_0x66c7('0xa2'));_0x1ec272[_0x66c7('0x47')]('c.firstName',_0x66c7('0xa3'));_0x1ec272[_0x66c7('0x47')](_0x66c7('0xa4'),_0x66c7('0xa5'));_0x1ec272[_0x66c7('0x47')]('c.email',_0x66c7('0xa6'));_0x1ec272[_0x66c7('0x47')](_0x66c7('0xa7'),_0x66c7('0xa8'));_0x1ec272[_0x66c7('0x47')](_0x66c7('0xa9'),_0x66c7('0xaa'));_0x1ec272[_0x66c7('0x47')]('c.fax',_0x66c7('0xab'));_0x1ec272[_0x66c7('0x47')](_0x66c7('0xac'),'Owner.fullname');_0x1ec272[_0x66c7('0x47')](_0x66c7('0xad'),_0x66c7('0xae'));_0x1ec272[_0x66c7('0x47')](_0x66c7('0xaf'),_0x66c7('0x2e'));}if(_0x1b2849[_0x66c7('0x22')])_0x1ec272[_0x66c7('0x22')](_0x1b2849['limit']);if(_0x1b2849[_0x66c7('0x21')])_0x1ec272[_0x66c7('0x21')](_0x1b2849[_0x66c7('0x21')]);return db[_0x66c7('0x99')][_0x66c7('0x3a')](_0x1ec272[_0x66c7('0x9a')](),_0x139529);})['then'](function(_0x475272){_0x48eae9[_0x66c7('0x43')](_0x66c7('0xb0'),_[_0x66c7('0x2d')](_0x475272,'id'));return db[_0x66c7('0x99')][_0x66c7('0x3a')](_0x48eae9[_0x66c7('0x9a')](),_0x139529)[_0x66c7('0x28')](function(_0x5c3e71){var _0x151636=_[_0x66c7('0xb1')](_0x5c3e71,_0x66c7('0xb2'));var _0x54cb09=[];_0x475272[_0x66c7('0x31')](function(_0x2f0bf0){_0x54cb09[_0x66c7('0x32')](updateFaxInteraction(_0x2f0bf0,_0x528f5c,_0x151636));});return BPromise[_0x66c7('0xb3')](_0x54cb09);});});})[_0x66c7('0x28')](function(_0x437f11){_0x2bf7c2[_0x66c7('0xb4')]=_0x437f11;return _0x2bf7c2;})['then'](respondWithFilteredResult(_0x367ad5,_0x1b2849))[_0x66c7('0xb5')](handleError(_0x367ad5,null));};exports['show']=function(_0x5eaa50,_0x4ab8e3){var _0x4aadc3={'raw':![],'where':{'id':_0x5eaa50[_0x66c7('0xb6')]['id']}},_0x306c8b={};_0x306c8b['model']=_['keys'](db[_0x66c7('0x34')][_0x66c7('0x35')]);_0x306c8b['query']=_['keys'](_0x5eaa50[_0x66c7('0x3a')]);_0x306c8b['filters']=_['intersection'](_0x306c8b[_0x66c7('0x39')],_0x306c8b[_0x66c7('0x3a')]);_0x4aadc3['attributes']=_[_0x66c7('0x3c')](_0x306c8b[_0x66c7('0x39')],qs[_0x66c7('0x3d')](_0x5eaa50[_0x66c7('0x3a')][_0x66c7('0x3d')]));_0x4aadc3[_0x66c7('0x3e')]=_0x4aadc3[_0x66c7('0x3e')][_0x66c7('0x64')]?_0x4aadc3[_0x66c7('0x3e')]:_0x306c8b['model'];if(_0x5eaa50[_0x66c7('0x3a')]['includeAll']){_0x4aadc3[_0x66c7('0xb7')]=[{'all':!![]}];}_0x4aadc3=_[_0x66c7('0x9c')]({},_0x4aadc3,_0x5eaa50['options']);return db[_0x66c7('0x34')][_0x66c7('0x5d')](_0x4aadc3)[_0x66c7('0x28')](handleEntityNotFound(_0x4ab8e3,null))[_0x66c7('0x28')](respondWithResult(_0x4ab8e3,null))[_0x66c7('0xb5')](handleError(_0x4ab8e3,null));};exports['create']=function(_0x3897c7,_0x5c463c){return db[_0x66c7('0x34')][_0x66c7('0xb8')](_0x3897c7[_0x66c7('0x71')],{})[_0x66c7('0x28')](respondWithResult(_0x5c463c,0xc9))[_0x66c7('0xb5')](handleError(_0x5c463c,null));};exports[_0x66c7('0x27')]=function(_0x8aabd7,_0x53ac96){if(_0x8aabd7['body']['id']){delete _0x8aabd7[_0x66c7('0x71')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x8aabd7['params']['id']}})[_0x66c7('0x28')](handleEntityNotFound(_0x53ac96,null))['then'](saveUpdates(_0x8aabd7[_0x66c7('0x71')],null))[_0x66c7('0x28')](respondWithResult(_0x53ac96,null))[_0x66c7('0xb5')](handleError(_0x53ac96,null));};exports['destroy']=function(_0x4201b7,_0x5376d7){return db[_0x66c7('0x34')]['find']({'where':{'id':_0x4201b7[_0x66c7('0xb6')]['id']}})[_0x66c7('0x28')](handleEntityNotFound(_0x5376d7,null))[_0x66c7('0x28')](removeEntity(_0x5376d7,null))[_0x66c7('0xb5')](handleError(_0x5376d7,null));};exports[_0x66c7('0xb9')]=function(_0x18f46f,_0x1912a6){return db['FaxInteraction'][_0x66c7('0xb9')]()['then'](respondWithResult(_0x1912a6,null))['catch'](handleError(_0x1912a6,null));};exports[_0x66c7('0xba')]=function(_0xa18dfb,_0x12ee9f,_0x44bbf2){return db[_0x66c7('0xbb')][_0x66c7('0x5d')]({'where':{'id':_0xa18dfb[_0x66c7('0xb6')]['id']}})[_0x66c7('0x28')](handleEntityNotFound(_0x12ee9f,null))[_0x66c7('0x28')](function(_0x73399){if(_0x73399){return _0x73399[_0x66c7('0xba')](_0xa18dfb[_0x66c7('0x71')][_0x66c7('0xbc')],_['omit'](_0xa18dfb[_0x66c7('0x71')],['ids','id'])||{});}})[_0x66c7('0x28')](respondWithResult(_0x12ee9f,null))[_0x66c7('0xb5')](handleError(_0x12ee9f,null));};exports[_0x66c7('0xbd')]=function(_0x3826e4,_0x21fe7d,_0x1cd457){var _0x4f2f3d={'raw':![],'where':{}};var _0x5c97e2={};var _0x5dd5dc={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x3826e4[_0x66c7('0xb6')]['id']}})[_0x66c7('0x28')](handleEntityNotFound(_0x21fe7d,null))[_0x66c7('0x28')](function(_0x315891){if(_0x315891){_0x5c97e2['model']=_['keys'](db[_0x66c7('0xbb')][_0x66c7('0x35')]);_0x5c97e2['query']=_[_0x66c7('0x3b')](_0x3826e4[_0x66c7('0x3a')]);_0x5c97e2['filters']=_[_0x66c7('0x3c')](_0x5c97e2[_0x66c7('0x39')],_0x5c97e2[_0x66c7('0x3a')]);_0x4f2f3d[_0x66c7('0x3e')]=_['intersection'](_0x5c97e2['model'],qs[_0x66c7('0x3d')](_0x3826e4[_0x66c7('0x3a')][_0x66c7('0x3d')]));_0x4f2f3d[_0x66c7('0x3e')]=_0x4f2f3d[_0x66c7('0x3e')][_0x66c7('0x64')]?_0x4f2f3d[_0x66c7('0x3e')]:_0x5c97e2[_0x66c7('0x39')];if(!_0x3826e4[_0x66c7('0x3a')][_0x66c7('0x3f')]('nolimit')){_0x4f2f3d[_0x66c7('0x22')]=qs[_0x66c7('0x22')](_0x3826e4[_0x66c7('0x3a')][_0x66c7('0x22')]);_0x4f2f3d[_0x66c7('0x21')]=qs[_0x66c7('0x21')](_0x3826e4[_0x66c7('0x3a')][_0x66c7('0x21')]);}_0x4f2f3d[_0x66c7('0x41')]=qs[_0x66c7('0x42')](_0x3826e4['query'][_0x66c7('0x42')]);_0x4f2f3d[_0x66c7('0x43')]=qs[_0x66c7('0x44')](_[_0x66c7('0x45')](_0x3826e4[_0x66c7('0x3a')],_0x5c97e2[_0x66c7('0x44')]));_0x4f2f3d[_0x66c7('0x43')][_0x66c7('0xb2')]=_0x315891['id'];if(_0x3826e4['query'][_0x66c7('0x86')]){_0x4f2f3d[_0x66c7('0x43')]=_[_0x66c7('0x9c')](_0x4f2f3d[_0x66c7('0x43')],{'$or':_[_0x66c7('0x2d')](_0x4f2f3d[_0x66c7('0x3e')],function(_0x1caa25){var _0x38e628={};_0x38e628[_0x1caa25]={'$like':'%'+_0x3826e4[_0x66c7('0x3a')][_0x66c7('0x86')]+'%'};return _0x38e628;})});}if(_0x3826e4[_0x66c7('0x3a')][_0x66c7('0x79')]){var _0x4b2110=_0x3826e4['query'][_0x66c7('0x79')][_0x66c7('0x30')](',');var _0x38a770={};_0x38a770[_0x4b2110[0x0]]={'$gte':moment(_0x4b2110[0x1])[_0x66c7('0xbe')](_0x66c7('0xbf'))};_0x4f2f3d[_0x66c7('0x43')]=_[_0x66c7('0x9c')](_0x4f2f3d[_0x66c7('0x43')],_0x38a770);}_0x4f2f3d=_['merge']({},_0x4f2f3d,_0x3826e4[_0x66c7('0xc0')]);return db[_0x66c7('0xbb')]['count']({'where':_0x4f2f3d[_0x66c7('0x43')]})[_0x66c7('0x28')](function(_0x428b30){_0x5dd5dc[_0x66c7('0x20')]=_0x428b30;if(_0x3826e4['query'][_0x66c7('0xc1')]){_0x4f2f3d[_0x66c7('0xb7')]=[{'all':!![]}];}return db[_0x66c7('0xbb')][_0x66c7('0xc2')](_0x4f2f3d);})['then'](function(_0x5149f5){_0x5dd5dc[_0x66c7('0xb4')]=_0x5149f5;return _0x5dd5dc;});}})[_0x66c7('0x28')](respondWithFilteredResult(_0x21fe7d,_0x4f2f3d))[_0x66c7('0xb5')](handleError(_0x21fe7d,null));};exports[_0x66c7('0xc3')]=function(_0x333c5f,_0x433aaf,_0x485a6d){return db[_0x66c7('0x34')][_0x66c7('0x5d')]({'where':{'id':_0x333c5f[_0x66c7('0xb6')]['id']}})[_0x66c7('0x28')](handleEntityNotFound(_0x433aaf,null))['then'](function(_0x233f72){if(_0x233f72){return _0x233f72['setTags'](_0x333c5f[_0x66c7('0x71')]['ids'],_['omit'](_0x333c5f[_0x66c7('0x71')],[_0x66c7('0xbc'),'id'])||{})['spread'](function(){return db['Tag'][_0x66c7('0xc2')]({'attributes':['id','name',_0x66c7('0x48')],'where':{'id':_0x333c5f[_0x66c7('0x71')][_0x66c7('0xbc')]}});})[_0x66c7('0x28')](function(_0x5321ae){socket[_0x66c7('0xc4')](_0x66c7('0xc5'),{'id':Number(_0x333c5f[_0x66c7('0xb6')]['id']),'tags':_0x5321ae||[]});return{'id':Number(_0x333c5f[_0x66c7('0xb6')]['id']),'tags':_0x5321ae||[]};});}})[_0x66c7('0x28')](respondWithResult(_0x433aaf,null))['catch'](handleError(_0x433aaf,null));};exports['removeTags']=function(_0x100338,_0x5ab855,_0x1971bb){return db[_0x66c7('0x34')][_0x66c7('0x5d')]({'where':{'id':_0x100338['params']['id']}})[_0x66c7('0x28')](handleEntityNotFound(_0x5ab855,null))[_0x66c7('0x28')](function(_0x405cfc){if(_0x405cfc){return _0x405cfc[_0x66c7('0xc6')](_0x100338[_0x66c7('0x3a')]['ids']);}})['then'](respondWithStatusCode(_0x5ab855,null))[_0x66c7('0xb5')](handleError(_0x5ab855,null));};exports[_0x66c7('0xc7')]=function(_0x4e683b,_0x6ce329){var _0x48c355=moment()[_0x66c7('0xc8')]()[_0x66c7('0x9a')]();var _0x38afc7=path['join'](config[_0x66c7('0xc9')],'server',_0x66c7('0xca'),'tmp');var _0x37bf63=path[_0x66c7('0xcb')](config[_0x66c7('0xc9')],_0x66c7('0xcc'),'files',_0x66c7('0xcd'));var _0x46ac20=path['join'](_0x38afc7,_0x48c355);var _0x2591ff=util[_0x66c7('0xbe')]('transcript-%d-%s.zip',_0x4e683b[_0x66c7('0xb6')]['id'],_0x48c355);var _0x24d790=path[_0x66c7('0xcb')](_0x38afc7,_0x2591ff);var _0x40644d=[];_0x40644d['push']({'model':db['Attachment'],'as':_0x66c7('0xce'),'raw':!![]});var _0x5e0b8b=[{'model':db[_0x66c7('0xbb')],'as':_0x66c7('0xcf'),'attributes':['id','body',_0x66c7('0x77')],'include':_0x40644d}];return db['FaxInteraction'][_0x66c7('0x5d')]({'where':{'id':_0x4e683b[_0x66c7('0xb6')]['id']},'include':_0x5e0b8b})[_0x66c7('0x28')](handleEntityNotFound(_0x6ce329,null))[_0x66c7('0x28')](function(_0x54759e){if(_0x54759e&&_0x54759e[_0x66c7('0xcf')]){var _0x2f0bd8=_0x54759e['get']({'plain':!![]});fs[_0x66c7('0xd0')](_0x46ac20);for(var _0x31a5a9=0x0;_0x31a5a9<_0x2f0bd8[_0x66c7('0xcf')][_0x66c7('0x64')];_0x31a5a9++){var _0x105536=_0x2f0bd8[_0x66c7('0xcf')][_0x31a5a9][_0x66c7('0xce')];if(_0x105536){var _0x441817=path[_0x66c7('0xcb')](_0x37bf63,_0x105536[_0x66c7('0xd1')]);if(fs[_0x66c7('0xd2')](_0x441817)){fs[_0x66c7('0xd3')](_0x441817)[_0x66c7('0xd4')](fs[_0x66c7('0xd5')](path[_0x66c7('0xcb')](_0x46ac20,_0x105536[_0x66c7('0xd1')])));}}}return BPromise['resolve']()[_0x66c7('0x28')](function(){return new BPromise(function(_0x57b3eb,_0x4b44a3){zipdir(_0x46ac20,{'saveTo':_0x24d790},function(_0x15be63,_0xe5cd1f){if(_0x15be63)return _0x4b44a3(_0x15be63);return _0x57b3eb(_0xe5cd1f);});})['then'](function(){return new BPromise(function(_0x1ad31b,_0x26457c){rimraf(_0x46ac20,function(_0x40ba86){if(_0x40ba86)_0x26457c(_0x40ba86);return _0x1ad31b();});});})[_0x66c7('0x28')](function(){return _0x6ce329[_0x66c7('0xc7')](_0x24d790,_0x2591ff,function(_0x4d0509){if(_0x4d0509){console[_0x66c7('0xd6')](_0x66c7('0xd7'),_0x4d0509);}else{fs[_0x66c7('0xd8')](_0x24d790);}});});});}else{return _0x6ce329[_0x66c7('0x1d')](0xc8);}})[_0x66c7('0xb5')](handleError(_0x6ce329,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 5e007a9..4ec0776 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 _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=FaxInteractionEvents; \ No newline at end of file +var _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0xcfe8e6,_0x7a29fc){var _0x2fb6f1=function(_0x14cf74){while(--_0x14cf74){_0xcfe8e6['push'](_0xcfe8e6['shift']());}};_0x2fb6f1(++_0x7a29fc);}(_0x7a54,0x106));var _0x47a5=function(_0x298d6c,_0x23953d){_0x298d6c=_0x298d6c-0x0;var _0x102ee3=_0x7a54[_0x298d6c];return _0x102ee3;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var FaxInteraction=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x47a5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x47a5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47a5('0x5'),'afterDestroy':_0x47a5('0x6')};function emitEvent(_0x2a1a7e){return function(_0x3717e1,_0xfdf934,_0x545a97){_0x3717e1[_0x47a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x343372){_0x3717e1[_0x47a5('0x8')]('Users',_0x343372[_0x47a5('0x9')](function(_0x5077f3){return{'id':_0x5077f3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3717e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a0e98){_0x3717e1[_0x47a5('0x8')]('unreadMessages',_0x2a0e98[_0x47a5('0xa')]);FaxInteractionEvents['emit'](_0x2a1a7e+':'+_0x3717e1['id'],_0x3717e1);FaxInteractionEvents['emit'](_0x2a1a7e,_0x3717e1);_0x545a97(null);})[_0x47a5('0xb')](_0x545a97(null));};}for(var e in events){if(events[_0x47a5('0xc')](e)){var event=events[e];FaxInteraction[_0x47a5('0xd')](e,emitEvent(event));}}module[_0x47a5('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 71e06bb..5cb6a07 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 _0xd43e=['format','bluebird','request-promise','rimraf','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt'];(function(_0x584268,_0x316063){var _0xe262a8=function(_0x190a3c){while(--_0x190a3c){_0x584268['push'](_0x584268['shift']());}};_0xe262a8(++_0x316063);}(_0xd43e,0xc7));var _0xed43=function(_0x472276,_0xa37f3b){_0x472276=_0x472276-0x0;var _0xdd2b80=_0xd43e[_0x472276];return _0xdd2b80;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xed43('0x0'));var rp=require(_0xed43('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed43('0x2'));var config=require('../../config/environment');var attributes=require(_0xed43('0x3'));module['exports']=function(_0x5bcea,_0xc0e3b6){return _0x5bcea[_0xed43('0x4')](_0xed43('0x5'),attributes,{'tableName':_0xed43('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3173a3,_0x31afff,_0x208e8f){if(_0x3173a3[_0xed43('0x7')](_0xed43('0x8'))){_0x3173a3[_0xed43('0x9')]=moment()[_0xed43('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x208e8f(null,_0x3173a3);}}});}; \ No newline at end of file +var _0xc383=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./faxInteraction.attributes','exports','define','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x462c9e,_0x1c3255){var _0xca0647=function(_0x3d58ca){while(--_0x3d58ca){_0x462c9e['push'](_0x462c9e['shift']());}};_0xca0647(++_0x1c3255);}(_0xc383,0x80));var _0x3c38=function(_0x52c31d,_0x16b31d){_0x52c31d=_0x52c31d-0x0;var _0x2ccdcb=_0xc383[_0x52c31d];return _0x2ccdcb;};'use strict';var _=require(_0x3c38('0x0'));var util=require('util');var logger=require(_0x3c38('0x1'))(_0x3c38('0x2'));var moment=require(_0x3c38('0x3'));var BPromise=require(_0x3c38('0x4'));var rp=require(_0x3c38('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c38('0x6'));var config=require('../../config/environment');var attributes=require(_0x3c38('0x7'));module[_0x3c38('0x8')]=function(_0x667838,_0x3ce63f){return _0x667838[_0x3c38('0x9')]('FaxInteraction',attributes,{'tableName':_0x3c38('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2c8aed,_0x270dff,_0x21c23a){if(_0x2c8aed[_0x3c38('0xb')](_0x3c38('0xc'))){_0x2c8aed[_0x3c38('0xd')]=moment()[_0x3c38('0xe')](_0x3c38('0xf'));}_0x21c23a(null,_0x2c8aed);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 48b3eb1..be90422 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 _0x169f=['redis','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','debug','AddTagsToFaxInteraction','find','omit','spread','AddTags','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter'];(function(_0x516fa6,_0x4ebdd5){var _0x2d4aa5=function(_0x566903){while(--_0x566903){_0x516fa6['push'](_0x516fa6['shift']());}};_0x2d4aa5(++_0x4ebdd5);}(_0x169f,0x152));var _0xf169=function(_0x46a529,_0x11018a){_0x46a529=_0x46a529-0x0;var _0x1b169e=_0x169f[_0x46a529];return _0x1b169e;};'use strict';var _=require(_0xf169('0x0'));var util=require('util');var moment=require(_0xf169('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf169('0x2'));var db=require(_0xf169('0x3'))['db'];var utils=require(_0xf169('0x4'));var logger=require(_0xf169('0x5'))(_0xf169('0x6'));var config=require(_0xf169('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf169('0x8')][_0xf169('0x9')]({'port':0x232a});config['redis']=_[_0xf169('0xa')](config['redis'],{'host':_0xf169('0xb'),'port':0x18eb});var socket=require(_0xf169('0xc'))(new Redis(config[_0xf169('0xd')]));require(_0xf169('0xe'))[_0xf169('0xf')](socket);function respondWithRpcPromise(_0x52f7bc,_0x3c8c10,_0x1036f9){return new BPromise(function(_0x2087b1,_0x1e7d04){return client['request'](_0x52f7bc,_0x1036f9)[_0xf169('0x10')](function(_0x1a0596){logger[_0xf169('0x11')](_0xf169('0x12'),_0x3c8c10,_0xf169('0x13'));logger['debug'](_0xf169('0x14'),_0x3c8c10,'request\x20sent',JSON[_0xf169('0x15')](_0x1a0596));if(_0x1a0596['error']){if(_0x1a0596[_0xf169('0x16')][_0xf169('0x17')]===0x1f4){logger[_0xf169('0x16')](_0xf169('0x12'),_0x3c8c10,_0x1a0596[_0xf169('0x16')][_0xf169('0x18')]);return _0x1e7d04(_0x1a0596[_0xf169('0x16')]['message']);}logger[_0xf169('0x16')](_0xf169('0x12'),_0x3c8c10,_0x1a0596[_0xf169('0x16')]['message']);return _0x2087b1(_0x1a0596[_0xf169('0x16')][_0xf169('0x18')]);}else{logger[_0xf169('0x11')](_0xf169('0x12'),_0x3c8c10,_0xf169('0x13'));_0x2087b1(_0x1a0596[_0xf169('0x19')][_0xf169('0x18')]);}})[_0xf169('0x1a')](function(_0x22acc7){logger[_0xf169('0x16')](_0xf169('0x12'),_0x3c8c10,_0x22acc7);_0x1e7d04(_0x22acc7);});});}exports[_0xf169('0x1b')]=function(_0x3bade3){var _0x56bb2f=this;return new Promise(function(_0x2e10a1,_0x5f4dfb){return db[_0xf169('0x1c')]['update'](_0x3bade3[_0xf169('0x1d')],{'raw':_0x3bade3[_0xf169('0x1e')]?_0x3bade3['options'][_0xf169('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bade3['options']?_0x3bade3[_0xf169('0x1e')][_0xf169('0x20')]||null:null,'attributes':_0x3bade3[_0xf169('0x1e')]?_0x3bade3['options']['attributes']||null:null,'limit':_0x3bade3[_0xf169('0x1e')]?_0x3bade3[_0xf169('0x1e')]['limit']||null:null})[_0xf169('0x10')](function(_0x4b35df){logger[_0xf169('0x11')](_0xf169('0x1b'),_0x3bade3);logger[_0xf169('0x21')](_0xf169('0x1b'),_0x3bade3,JSON[_0xf169('0x15')](_0x4b35df));_0x2e10a1(_0x4b35df);})[_0xf169('0x1a')](function(_0x1867d7){logger[_0xf169('0x16')](_0xf169('0x1b'),_0x1867d7[_0xf169('0x18')],_0x3bade3);_0x5f4dfb(_0x56bb2f[_0xf169('0x16')](0x1f4,_0x1867d7[_0xf169('0x18')]));});});};exports[_0xf169('0x22')]=function(_0x6809f9){return new Promise(function(_0x38069b,_0x2124a7){return db['FaxInteraction'][_0xf169('0x23')]({'where':_0x6809f9[_0xf169('0x1e')]?_0x6809f9[_0xf169('0x1e')][_0xf169('0x20')]||null:null})['then'](function(_0x2f2669){if(_0x2f2669){return _0x2f2669['addTags'](_0x6809f9['body']['ids'],_[_0xf169('0x24')](_0x6809f9['body'],['ids','id'])||{});}})[_0xf169('0x25')](function(_0x28278a){logger['info'](_0xf169('0x26'),_0x6809f9);logger[_0xf169('0x21')](_0xf169('0x26'),_0x6809f9,JSON['stringify'](_0x28278a));_0x38069b(_0x28278a);})[_0xf169('0x1a')](function(_0x38864b){logger[_0xf169('0x16')](_0xf169('0x26'),_0x38864b[_0xf169('0x18')],_0x6809f9);_0x2124a7(_this[_0xf169('0x16')](0x1f4,_0x38864b[_0xf169('0x18')]));});});}; \ No newline at end of file +var _0xf70f=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','AddTagsToFaxInteraction','find','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis'];(function(_0x5c77b4,_0x51d21e){var _0x59f9cf=function(_0x2e6fb0){while(--_0x2e6fb0){_0x5c77b4['push'](_0x5c77b4['shift']());}};_0x59f9cf(++_0x51d21e);}(_0xf70f,0xd2));var _0xff70=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0xf70f[_0x5ce15c];return _0x36e4f5;};'use strict';var _=require(_0xff70('0x0'));var util=require(_0xff70('0x1'));var moment=require(_0xff70('0x2'));var BPromise=require('bluebird');var rs=require(_0xff70('0x3'));var fs=require('fs');var Redis=require(_0xff70('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xff70('0x5'));var logger=require('../../config/logger')(_0xff70('0x6'));var config=require(_0xff70('0x7'));var jayson=require(_0xff70('0x8'));var client=jayson[_0xff70('0x9')][_0xff70('0xa')]({'port':0x232a});config[_0xff70('0xb')]=_[_0xff70('0xc')](config[_0xff70('0xb')],{'host':_0xff70('0xd'),'port':0x18eb});var socket=require(_0xff70('0xe'))(new Redis(config['redis']));require(_0xff70('0xf'))[_0xff70('0x10')](socket);function respondWithRpcPromise(_0x10ad26,_0x274899,_0x20dc04){return new BPromise(function(_0x233b8c,_0x5cca5b){return client[_0xff70('0x11')](_0x10ad26,_0x20dc04)[_0xff70('0x12')](function(_0x23239e){logger[_0xff70('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x274899,_0xff70('0x14'));logger[_0xff70('0x15')](_0xff70('0x16'),_0x274899,_0xff70('0x14'),JSON[_0xff70('0x17')](_0x23239e));if(_0x23239e[_0xff70('0x18')]){if(_0x23239e[_0xff70('0x18')][_0xff70('0x19')]===0x1f4){logger['error'](_0xff70('0x1a'),_0x274899,_0x23239e[_0xff70('0x18')][_0xff70('0x1b')]);return _0x5cca5b(_0x23239e[_0xff70('0x18')][_0xff70('0x1b')]);}logger[_0xff70('0x18')](_0xff70('0x1a'),_0x274899,_0x23239e[_0xff70('0x18')]['message']);return _0x233b8c(_0x23239e[_0xff70('0x18')][_0xff70('0x1b')]);}else{logger[_0xff70('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x274899,'request\x20sent');_0x233b8c(_0x23239e[_0xff70('0x1c')][_0xff70('0x1b')]);}})[_0xff70('0x1d')](function(_0x146dc9){logger[_0xff70('0x18')](_0xff70('0x1a'),_0x274899,_0x146dc9);_0x5cca5b(_0x146dc9);});});}exports[_0xff70('0x1e')]=function(_0x3f4202){var _0x12f880=this;return new Promise(function(_0x75951b,_0x19c220){return db[_0xff70('0x1f')][_0xff70('0x20')](_0x3f4202[_0xff70('0x21')],{'raw':_0x3f4202[_0xff70('0x22')]?_0x3f4202[_0xff70('0x22')][_0xff70('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f4202[_0xff70('0x22')]?_0x3f4202[_0xff70('0x22')][_0xff70('0x24')]||null:null,'attributes':_0x3f4202[_0xff70('0x22')]?_0x3f4202[_0xff70('0x22')][_0xff70('0x25')]||null:null,'limit':_0x3f4202[_0xff70('0x22')]?_0x3f4202[_0xff70('0x22')]['limit']||null:null})[_0xff70('0x12')](function(_0xf1d1c0){logger[_0xff70('0x13')](_0xff70('0x1e'),_0x3f4202);logger[_0xff70('0x15')](_0xff70('0x1e'),_0x3f4202,JSON[_0xff70('0x17')](_0xf1d1c0));_0x75951b(_0xf1d1c0);})[_0xff70('0x1d')](function(_0x479cc9){logger['error'](_0xff70('0x1e'),_0x479cc9[_0xff70('0x1b')],_0x3f4202);_0x19c220(_0x12f880[_0xff70('0x18')](0x1f4,_0x479cc9['message']));});});};exports[_0xff70('0x26')]=function(_0x5a26c0){return new Promise(function(_0x4107ee,_0x1f7b62){return db[_0xff70('0x1f')][_0xff70('0x27')]({'where':_0x5a26c0[_0xff70('0x22')]?_0x5a26c0[_0xff70('0x22')][_0xff70('0x24')]||null:null})['then'](function(_0x1dc040){if(_0x1dc040){return _0x1dc040['addTags'](_0x5a26c0[_0xff70('0x21')][_0xff70('0x28')],_[_0xff70('0x29')](_0x5a26c0[_0xff70('0x21')],[_0xff70('0x28'),'id'])||{});}})['spread'](function(_0x4018b6){logger[_0xff70('0x13')](_0xff70('0x2a'),_0x5a26c0);logger[_0xff70('0x15')]('AddTags',_0x5a26c0,JSON[_0xff70('0x17')](_0x4018b6));_0x4107ee(_0x4018b6);})[_0xff70('0x1d')](function(_0x3771eb){logger[_0xff70('0x18')](_0xff70('0x2a'),_0x3771eb['message'],_0x5a26c0);_0x1f7b62(_this[_0xff70('0x18')](0x1f4,_0x3771eb[_0xff70('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 27f183f..c86c4f4 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 _0xcf62=['emit','register','length','./faxInteraction.events','save'];(function(_0xb9bf98,_0x5cb609){var _0x35e5ac=function(_0x594349){while(--_0x594349){_0xb9bf98['push'](_0xb9bf98['shift']());}};_0x35e5ac(++_0x5cb609);}(_0xcf62,0x102));var _0x2cf6=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xcf62[_0x599f41];return _0x2e4d58;};'use strict';var FaxInteractionEvents=require(_0x2cf6('0x0'));var events=[_0x2cf6('0x1'),'remove','update'];function createListener(_0x361e69,_0x2c01bd){return function(_0x47d9e0){_0x2c01bd[_0x2cf6('0x2')](_0x361e69,_0x47d9e0);};}function removeListener(_0x1c8a96,_0x54495e){return function(){FaxInteractionEvents['removeListener'](_0x1c8a96,_0x54495e);};}exports[_0x2cf6('0x3')]=function(_0x1d924a){for(var _0x3a047a=0x0,_0x3b6743=events[_0x2cf6('0x4')];_0x3a047a<_0x3b6743;_0x3a047a++){var _0x435a75=events[_0x3a047a];var _0x1b935f=createListener('faxInteraction:'+_0x435a75,_0x1d924a);FaxInteractionEvents['on'](_0x435a75,_0x1b935f);}}; \ No newline at end of file +var _0xbac3=['removeListener','register','faxInteraction:','./faxInteraction.events','save','emit'];(function(_0x532c49,_0x5af3f1){var _0x485a4e=function(_0x547f2a){while(--_0x547f2a){_0x532c49['push'](_0x532c49['shift']());}};_0x485a4e(++_0x5af3f1);}(_0xbac3,0x69));var _0x3bac=function(_0x52598d,_0x10fb73){_0x52598d=_0x52598d-0x0;var _0x170309=_0xbac3[_0x52598d];return _0x170309;};'use strict';var FaxInteractionEvents=require(_0x3bac('0x0'));var events=[_0x3bac('0x1'),'remove','update'];function createListener(_0x1492b7,_0x20e2f4){return function(_0x106136){_0x20e2f4[_0x3bac('0x2')](_0x1492b7,_0x106136);};}function removeListener(_0x2e22f9,_0x32884b){return function(){FaxInteractionEvents[_0x3bac('0x3')](_0x2e22f9,_0x32884b);};}exports[_0x3bac('0x4')]=function(_0x249a1b){for(var _0x1eaa9b=0x0,_0x15016a=events['length'];_0x1eaa9b<_0x15016a;_0x1eaa9b++){var _0x5d9e78=events[_0x1eaa9b];var _0x4ee649=createListener(_0x3bac('0x5')+_0x5d9e78,_0x249a1b);FaxInteractionEvents['on'](_0x5d9e78,_0x4ee649);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index a45d99c..19a9fbd 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 _0xbaf0=['removeTags','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','tracked','faxinteraction:destroy','destroy','/:id/tags'];(function(_0x2cc7b1,_0x3ba41c){var _0x106ac2=function(_0x1e06ed){while(--_0x1e06ed){_0x2cc7b1['push'](_0x2cc7b1['shift']());}};_0x106ac2(++_0x3ba41c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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('0x13')]('/',auth[_0x0baf('0x9')](),controller['create']);router['post'](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x14')]);router[_0x0baf('0x13')]('/:id/tags',auth[_0x0baf('0x9')](),interaction['tracked'](_0x0baf('0x15'),_0x0baf('0x16')),controller[_0x0baf('0x17')]);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),interaction['tracked']('fax',_0x0baf('0x19')),controller[_0x0baf('0x1a')]);router[_0x0baf('0x1b')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),interaction[_0x0baf('0x1c')]('fax',_0x0baf('0x1d')),controller[_0x0baf('0x1e')]);router[_0x0baf('0x1b')](_0x0baf('0x1f'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x20')]);module['exports']=router; \ No newline at end of file +var _0xaa88=['show','/:id/messages','getMessages','/:id/download','post','/:id/tags','fax','put','tracked','faxinteraction:update','update','delete','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe','/:id'];(function(_0x321a89,_0x3fd287){var _0x28b986=function(_0x5e8b5c){while(--_0x5e8b5c){_0x321a89['push'](_0x321a89['shift']());}};_0x28b986(++_0x3fd287);}(_0xaa88,0x137));var _0x8aa8=function(_0x5b5eb4,_0x117c87){_0x5b5eb4=_0x5b5eb4-0x0;var _0x42af53=_0xaa88[_0x5b5eb4];return _0x42af53;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var auth=require(_0x8aa8('0x5'));var interaction=require(_0x8aa8('0x6'));var config=require(_0x8aa8('0x7'));var controller=require(_0x8aa8('0x8'));router[_0x8aa8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8aa8('0x9')]('/describe',auth[_0x8aa8('0xa')](),controller[_0x8aa8('0xb')]);router[_0x8aa8('0x9')](_0x8aa8('0xc'),auth['isAuthenticated'](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0x9')](_0x8aa8('0xe'),auth['isAuthenticated'](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0x9')](_0x8aa8('0x10'),auth[_0x8aa8('0xa')](),controller['download']);router[_0x8aa8('0x11')]('/',auth[_0x8aa8('0xa')](),controller['create']);router[_0x8aa8('0x11')](_0x8aa8('0xe'),auth[_0x8aa8('0xa')](),controller['addMessage']);router[_0x8aa8('0x11')](_0x8aa8('0x12'),auth[_0x8aa8('0xa')](),interaction['tracked'](_0x8aa8('0x13'),'faxinteraction:addtags'),controller['addTags']);router[_0x8aa8('0x14')](_0x8aa8('0xc'),auth[_0x8aa8('0xa')](),interaction[_0x8aa8('0x15')](_0x8aa8('0x13'),_0x8aa8('0x16')),controller[_0x8aa8('0x17')]);router[_0x8aa8('0x18')](_0x8aa8('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x8aa8('0x13'),'faxinteraction:destroy'),controller['destroy']);router[_0x8aa8('0x18')]('/:id/tags',auth[_0x8aa8('0xa')](),controller[_0x8aa8('0x19')]);module[_0x8aa8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 014c1b1..3b5de06 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 _0xf0a9=['TEXT','medium','DATE','sequelize','exports'];(function(_0xe8d150,_0x460e8){var _0x413143=function(_0xd3aec1){while(--_0xd3aec1){_0xe8d150['push'](_0xe8d150['shift']());}};_0x413143(++_0x460e8);}(_0xf0a9,0x6c));var _0x9f0a=function(_0x3080ff,_0x50e859){_0x3080ff=_0x3080ff-0x0;var _0x4f75cc=_0xf0a9[_0x3080ff];return _0x4f75cc;};'use strict';var Sequelize=require(_0x9f0a('0x0'));module[_0x9f0a('0x1')]={'body':{'type':Sequelize[_0x9f0a('0x2')](_0x9f0a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x9f0a('0x4')]}}; \ No newline at end of file +var _0xb1b1=['out','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x12f6ba,_0xdad761){var _0x4252f7=function(_0xf8c670){while(--_0xf8c670){_0x12f6ba['push'](_0x12f6ba['shift']());}};_0x4252f7(++_0xdad761);}(_0xb1b1,0xb7));var _0x1b1b=function(_0x17eb98,_0x1bb51a){_0x17eb98=_0x17eb98-0x0;var _0x580afd=_0xb1b1[_0x17eb98];return _0x580afd;};'use strict';var Sequelize=require(_0x1b1b('0x0'));module[_0x1b1b('0x1')]={'body':{'type':Sequelize[_0x1b1b('0x2')](_0x1b1b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1b1b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1b1b('0x5')]('in',_0x1b1b('0x6')),'defaultValue':_0x1b1b('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x1b1b('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index c963ab4..327ae11 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 _0xc44b=['[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','create','CmContact','findOne','ContactId','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','server','files','attachments','download','html-pdf','rimraf','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxMessage','includeAll','include','findAll','rows','show','params','intersection','find','describe','fax-interactions','accept','fax','body','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','FaxInteraction','FaxInteractionId','isNil','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent'];(function(_0x2fd914,_0x1d0801){var _0x5c53eb=function(_0x247386){while(--_0x247386){_0x2fd914['push'](_0x2fd914['shift']());}};_0x5c53eb(++_0x1d0801);}(_0xc44b,0x9a));var _0xbc44=function(_0x10a904,_0x2bf292){_0x10a904=_0x10a904-0x0;var _0x53815a=_0xc44b[_0x10a904];return _0x53815a;};'use strict';var pdf=require(_0xbc44('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbc44('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbc44('0x2'));var moment=require('moment');var BPromise=require(_0xbc44('0x3'));var Mustache=require(_0xbc44('0x4'));var util=require('util');var path=require(_0xbc44('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbc44('0x6'));var fs=require('fs');var _=require(_0xbc44('0x7'));var squel=require(_0xbc44('0x8'));var crypto=require(_0xbc44('0x9'));var jsforce=require(_0xbc44('0xa'));var deskjs=require(_0xbc44('0xb'));var toCsv=require(_0xbc44('0xc'));var querystring=require(_0xbc44('0xd'));var Papa=require(_0xbc44('0xe'));var Redis=require(_0xbc44('0xf'));var authService=require(_0xbc44('0x10'));var qs=require(_0xbc44('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc44('0x12'));var logger=require(_0xbc44('0x13'))(_0xbc44('0x14'));var utils=require(_0xbc44('0x15'));var config=require(_0xbc44('0x16'));var licenseUtil=require(_0xbc44('0x17'));var db=require(_0xbc44('0x18'))['db'];config[_0xbc44('0x19')]=_['defaults'](config[_0xbc44('0x19')],{'host':_0xbc44('0x1a'),'port':0x18eb});var socket=require(_0xbc44('0x1b'))(new Redis(config[_0xbc44('0x19')]));require(_0xbc44('0x1c'))[_0xbc44('0x1d')](socket);var jayson=require(_0xbc44('0x1e'));var client=jayson[_0xbc44('0x1f')][_0xbc44('0x20')]({'port':0x232c});var client9002=jayson[_0xbc44('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4825b2,_0x5a6aaa,_0x33e46d,_0x40dba2){return new BPromise(function(_0x40eae7,_0x3b60e9){var _0x4c6f65=_0x40dba2||client;return _0x4c6f65[_0xbc44('0x21')](_0x4825b2,_0x33e46d)[_0xbc44('0x22')](function(_0xc53a1a){logger['info'](_0xbc44('0x23'),_0x5a6aaa,_0xbc44('0x24'));logger['debug'](_0xbc44('0x25'),_0x5a6aaa,_0xbc44('0x24'),JSON[_0xbc44('0x26')](_0xc53a1a));if(_0xc53a1a[_0xbc44('0x27')]){if(_0xc53a1a['error']['code']===0x1f4){logger[_0xbc44('0x27')](_0xbc44('0x23'),_0x5a6aaa,_0xc53a1a[_0xbc44('0x27')][_0xbc44('0x28')]);return _0x3b60e9(_0xc53a1a['error']['message']);}logger[_0xbc44('0x27')](_0xbc44('0x23'),_0x5a6aaa,_0xc53a1a['error'][_0xbc44('0x28')]);return _0x40eae7(_0xc53a1a[_0xbc44('0x27')][_0xbc44('0x28')]);}else{logger[_0xbc44('0x29')](_0xbc44('0x23'),_0x5a6aaa,_0xbc44('0x24'));_0x40eae7(_0xc53a1a['result'][_0xbc44('0x28')]);}})[_0xbc44('0x2a')](function(_0x38b46f){logger['error'](_0xbc44('0x23'),_0x5a6aaa,_0x38b46f);_0x3b60e9(_0x38b46f);});});}function respondWithStatusCode(_0x313225,_0x41a918){_0x41a918=_0x41a918||0xcc;return function(_0x34ec88){if(_0x34ec88){return _0x313225[_0xbc44('0x2b')](_0x41a918);}return _0x313225[_0xbc44('0x2c')](_0x41a918)['end']();};}function respondWithResult(_0x4c687a,_0x294104){_0x294104=_0x294104||0xc8;return function(_0x4e52ba){if(_0x4e52ba){return _0x4c687a[_0xbc44('0x2c')](_0x294104)[_0xbc44('0x2d')](_0x4e52ba);}};}function respondWithFilteredResult(_0x1c3750,_0x4a6d8f){return function(_0x4db891){if(_0x4db891){var _0x6f859e=_0x4db891[_0xbc44('0x2e')],_0x1101fc=_0x4a6d8f[_0xbc44('0x2f')],_0x3fb2f1=_0x4a6d8f[_0xbc44('0x2f')]+_0x4a6d8f[_0xbc44('0x30')],_0x1cd9d2;if(_0x3fb2f1>=_0x6f859e){_0x3fb2f1=_0x6f859e;_0x1cd9d2=0xc8;}else{_0x1cd9d2=0xce;}_0x1c3750[_0xbc44('0x2c')](_0x1cd9d2);return _0x1c3750[_0xbc44('0x31')](_0xbc44('0x32'),_0x1101fc+'-'+_0x3fb2f1+'/'+_0x6f859e)['json'](_0x4db891);}return null;};}function patchUpdates(_0x562bc5){return function(_0x10c5d2){try{jsonpatch[_0xbc44('0x33')](_0x10c5d2,_0x562bc5,!![]);}catch(_0x2cec34){return BPromise[_0xbc44('0x34')](_0x2cec34);}return _0x10c5d2[_0xbc44('0x35')]();};}function saveUpdates(_0x47b8f0,_0x462721){return function(_0x2aefc7){if(_0x2aefc7){return _0x2aefc7[_0xbc44('0x36')](_0x47b8f0)[_0xbc44('0x22')](function(_0x15088d){return _0x15088d;});}return null;};}function removeEntity(_0x320dd7,_0x1e6a8a){return function(_0x327b16){if(_0x327b16){return _0x327b16[_0xbc44('0x37')]()[_0xbc44('0x22')](function(){_0x320dd7['status'](0xcc)[_0xbc44('0x38')]();});}};}function handleEntityNotFound(_0x55fc78,_0x347f4c){return function(_0xa2380b){if(!_0xa2380b){_0x55fc78['sendStatus'](0x194);}return _0xa2380b;};}function handleError(_0x1be02d,_0x5de4){_0x5de4=_0x5de4||0x1f4;return function(_0x1942e3){logger[_0xbc44('0x27')](_0x1942e3[_0xbc44('0x39')]);if(_0x1942e3[_0xbc44('0x3a')]){delete _0x1942e3['name'];}_0x1be02d[_0xbc44('0x2c')](_0x5de4)[_0xbc44('0x3b')](_0x1942e3);};}exports[_0xbc44('0x3c')]=function(_0x16faba,_0x44bc18){var _0x2d6ad1={},_0x56704b={},_0x5717db={'count':0x0,'rows':[]};var _0x5a1a55=_['map'](db['FaxMessage'][_0xbc44('0x3d')],function(_0x44cf65){return{'name':_0x44cf65[_0xbc44('0x3e')],'type':_0x44cf65[_0xbc44('0x3f')][_0xbc44('0x40')]};});_0x56704b[_0xbc44('0x41')]=_[_0xbc44('0x42')](_0x5a1a55,_0xbc44('0x3a'));_0x56704b[_0xbc44('0x43')]=_[_0xbc44('0x44')](_0x16faba[_0xbc44('0x43')]);_0x56704b[_0xbc44('0x45')]=_['intersection'](_0x56704b['model'],_0x56704b[_0xbc44('0x43')]);_0x2d6ad1['attributes']=_['intersection'](_0x56704b[_0xbc44('0x41')],qs[_0xbc44('0x46')](_0x16faba[_0xbc44('0x43')]['fields']));_0x2d6ad1[_0xbc44('0x47')]=_0x2d6ad1[_0xbc44('0x47')][_0xbc44('0x48')]?_0x2d6ad1[_0xbc44('0x47')]:_0x56704b[_0xbc44('0x41')];if(!_0x16faba['query'][_0xbc44('0x49')](_0xbc44('0x4a'))){_0x2d6ad1[_0xbc44('0x30')]=qs[_0xbc44('0x30')](_0x16faba[_0xbc44('0x43')]['limit']);_0x2d6ad1[_0xbc44('0x2f')]=qs[_0xbc44('0x2f')](_0x16faba[_0xbc44('0x43')][_0xbc44('0x2f')]);}_0x2d6ad1[_0xbc44('0x4b')]=qs[_0xbc44('0x4c')](_0x16faba[_0xbc44('0x43')][_0xbc44('0x4c')]);_0x2d6ad1[_0xbc44('0x4d')]=qs[_0xbc44('0x45')](_[_0xbc44('0x4e')](_0x16faba[_0xbc44('0x43')],_0x56704b[_0xbc44('0x45')]),_0x5a1a55);if(_0x16faba[_0xbc44('0x43')][_0xbc44('0x4f')]){_0x2d6ad1[_0xbc44('0x4d')]=_[_0xbc44('0x50')](_0x2d6ad1[_0xbc44('0x4d')],{'$or':_[_0xbc44('0x42')](_0x5a1a55,function(_0x7d592d){if(_0x7d592d['type']!==_0xbc44('0x51')){var _0x3e8199={};_0x3e8199[_0x7d592d[_0xbc44('0x3a')]]={'$like':'%'+_0x16faba['query'][_0xbc44('0x4f')]+'%'};return _0x3e8199;}})});}_0x2d6ad1=_['merge']({},_0x2d6ad1,_0x16faba[_0xbc44('0x52')]);var _0x3dc6fd={'where':_0x2d6ad1[_0xbc44('0x4d')]};return db[_0xbc44('0x53')][_0xbc44('0x2e')](_0x3dc6fd)[_0xbc44('0x22')](function(_0x1f8e7d){_0x5717db[_0xbc44('0x2e')]=_0x1f8e7d;if(_0x16faba[_0xbc44('0x43')][_0xbc44('0x54')]){_0x2d6ad1[_0xbc44('0x55')]=[{'all':!![]}];}return db[_0xbc44('0x53')][_0xbc44('0x56')](_0x2d6ad1);})[_0xbc44('0x22')](function(_0x323a35){_0x5717db[_0xbc44('0x57')]=_0x323a35;return _0x5717db;})[_0xbc44('0x22')](respondWithFilteredResult(_0x44bc18,_0x2d6ad1))[_0xbc44('0x2a')](handleError(_0x44bc18,null));};exports[_0xbc44('0x58')]=function(_0x2782b1,_0x27d4ac){var _0x14d1a9={'raw':!![],'where':{'id':_0x2782b1[_0xbc44('0x59')]['id']}},_0x2ee72a={};_0x2ee72a['model']=_['keys'](db[_0xbc44('0x53')]['rawAttributes']);_0x2ee72a[_0xbc44('0x43')]=_['keys'](_0x2782b1['query']);_0x2ee72a[_0xbc44('0x45')]=_[_0xbc44('0x5a')](_0x2ee72a[_0xbc44('0x41')],_0x2ee72a[_0xbc44('0x43')]);_0x14d1a9[_0xbc44('0x47')]=_[_0xbc44('0x5a')](_0x2ee72a[_0xbc44('0x41')],qs[_0xbc44('0x46')](_0x2782b1[_0xbc44('0x43')][_0xbc44('0x46')]));_0x14d1a9[_0xbc44('0x47')]=_0x14d1a9['attributes']['length']?_0x14d1a9[_0xbc44('0x47')]:_0x2ee72a['model'];if(_0x2782b1[_0xbc44('0x43')][_0xbc44('0x54')]){_0x14d1a9['include']=[{'all':!![]}];}_0x14d1a9=_[_0xbc44('0x50')]({},_0x14d1a9,_0x2782b1[_0xbc44('0x52')]);return db['FaxMessage'][_0xbc44('0x5b')](_0x14d1a9)[_0xbc44('0x22')](handleEntityNotFound(_0x27d4ac,null))[_0xbc44('0x22')](respondWithResult(_0x27d4ac,null))[_0xbc44('0x2a')](handleError(_0x27d4ac,null));};exports[_0xbc44('0x36')]=function(_0x46d720,_0x45e8ae){if(_0x46d720['body']['id']){delete _0x46d720['body']['id'];}return db[_0xbc44('0x53')][_0xbc44('0x5b')]({'where':{'id':_0x46d720[_0xbc44('0x59')]['id']}})['then'](handleEntityNotFound(_0x45e8ae,null))[_0xbc44('0x22')](saveUpdates(_0x46d720['body'],null))[_0xbc44('0x22')](respondWithResult(_0x45e8ae,null))['catch'](handleError(_0x45e8ae,null));};exports['destroy']=function(_0x4ac09d,_0x847e37){return db[_0xbc44('0x53')][_0xbc44('0x5b')]({'where':{'id':_0x4ac09d[_0xbc44('0x59')]['id']}})['then'](handleEntityNotFound(_0x847e37,null))['then'](removeEntity(_0x847e37,null))[_0xbc44('0x2a')](handleError(_0x847e37,null));};exports[_0xbc44('0x5c')]=function(_0x33c15e,_0x2e6701){return db[_0xbc44('0x53')]['describe']()[_0xbc44('0x22')](respondWithResult(_0x2e6701,null))[_0xbc44('0x2a')](handleError(_0x2e6701,null));};var interaction_log=require(_0xbc44('0x13'))(_0xbc44('0x5d'));exports[_0xbc44('0x5e')]=function(_0x1bf7c7,_0x2bb6e3,_0x51c3ac){var _0x442a8f={'channel':_0xbc44('0x5f')};if(_0x1bf7c7[_0xbc44('0x60')]['id']){delete _0x1bf7c7[_0xbc44('0x60')]['id'];}_0x1bf7c7[_0xbc44('0x60')][_0xbc44('0x61')]=!![];_0x1bf7c7[_0xbc44('0x60')][_0xbc44('0x62')]=moment()[_0xbc44('0x63')](_0xbc44('0x64'));_0x1bf7c7[_0xbc44('0x60')][_0xbc44('0x65')]=_0x1bf7c7[_0xbc44('0x60')][_0xbc44('0x65')]||_0x1bf7c7[_0xbc44('0x66')]['id'];return db[_0xbc44('0x53')][_0xbc44('0x5b')]({'where':{'id':_0x1bf7c7[_0xbc44('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xbc44('0x22')](handleEntityNotFound(_0x2bb6e3,null))[_0xbc44('0x22')](saveUpdates(_0x1bf7c7['body'],null))[_0xbc44('0x22')](function(_0x19020c){if(_0x19020c){_0x442a8f[_0xbc44('0x28')]=_0x19020c['get']({'plain':!![]});return db[_0xbc44('0x67')]['find']({'where':{'id':_0x19020c[_0xbc44('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x2bb6e3,null))['then'](function(_0x62a89e){if(_0x62a89e){return _0x62a89e[_0xbc44('0x36')]({'UserId':_0x1bf7c7[_0xbc44('0x60')][_0xbc44('0x65')],'read1stAt':_[_0xbc44('0x69')](_0x62a89e['read1stAt'])?moment()[_0xbc44('0x63')](_0xbc44('0x64')):undefined});}return null;})['then'](function(_0x14b9f7){if(_0x14b9f7){_0x442a8f['interaction']=_0x14b9f7[_0xbc44('0x6a')]({'plain':!![]});interaction_log[_0xbc44('0x29')](_0xbc44('0x6b'),_0x1bf7c7[_0xbc44('0x66')]['id'],_0x1bf7c7[_0xbc44('0x66')][_0xbc44('0x3a')],_0x1bf7c7[_0xbc44('0x66')][_0xbc44('0x6c')],_0x442a8f[_0xbc44('0x6d')]['id'],_0x1bf7c7['body']?JSON[_0xbc44('0x26')](_0x1bf7c7[_0xbc44('0x60')]):'null');return respondWithRpcPromise(_0xbc44('0x6e'),_0xbc44('0x6f'),_0x442a8f);}return null;})[_0xbc44('0x22')](function(_0x19433a){if(_0x19433a){if(_0x1bf7c7[_0xbc44('0x60')][_0xbc44('0x70')]){_0x442a8f[_0xbc44('0x28')][_0xbc44('0x71')]=util[_0xbc44('0x63')](_0xbc44('0x72'),_0x1bf7c7[_0xbc44('0x66')][_0xbc44('0x3a')]);_0x442a8f[_0xbc44('0x28')][_0xbc44('0x73')]=_0x442a8f['channel'];_0x442a8f[_0xbc44('0x28')][_0xbc44('0x74')]=_0xbc44('0x5e');return respondWithRpcPromise('EventManager',_0xbc44('0x75'),{'event':_0xbc44('0x76'),'message':_0x442a8f[_0xbc44('0x28')]},client9002)['then'](function(){return _0x442a8f;});}return _0x442a8f;}return null;})[_0xbc44('0x22')](respondWithResult(_0x2bb6e3,null))[_0xbc44('0x2a')](handleError(_0x2bb6e3,null));};var interaction_log=require(_0xbc44('0x13'))('fax-interactions');exports[_0xbc44('0x34')]=function(_0x203bd3,_0x2280a8,_0x293981){var _0x1c58f8={'agent':{},'channel':_0xbc44('0x5f')};if(_0x203bd3[_0xbc44('0x60')]['id']){delete _0x203bd3[_0xbc44('0x60')]['id'];}_0x203bd3['body'][_0xbc44('0x65')]=_0x203bd3[_0xbc44('0x60')][_0xbc44('0x65')]||_0x203bd3[_0xbc44('0x66')]['id'];_0x1c58f8[_0xbc44('0x77')]['id']=_0x203bd3['body']['UserId'];return db['FaxMessage']['find']({'where':{'id':_0x203bd3['params']['id'],'UserId':null}})[_0xbc44('0x22')](handleEntityNotFound(_0x2280a8,null))[_0xbc44('0x22')](function(_0x18c97b){if(_0x18c97b){_0x1c58f8['message']=_0x18c97b[_0xbc44('0x6a')]({'plain':!![]});return db['FaxInteraction'][_0xbc44('0x5b')]({'where':{'id':_0x18c97b[_0xbc44('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x2280a8,null))[_0xbc44('0x22')](function(_0x211175){if(_0x211175){_0x1c58f8[_0xbc44('0x6d')]=_0x211175[_0xbc44('0x6a')]({'plain':!![]});interaction_log[_0xbc44('0x29')](_0xbc44('0x78'),_0x203bd3[_0xbc44('0x66')]['id'],_0x203bd3['user'][_0xbc44('0x3a')],_0x203bd3[_0xbc44('0x66')][_0xbc44('0x6c')],_0x1c58f8['interaction']['id'],_0x203bd3['body']?JSON[_0xbc44('0x26')](_0x203bd3[_0xbc44('0x60')]):_0xbc44('0x79'));return respondWithRpcPromise('RejectMessage',_0xbc44('0x7a'),_0x1c58f8);}return null;})[_0xbc44('0x22')](function(_0x4ace4f){if(_0x4ace4f){_0x4ace4f['message']['interface']=util[_0xbc44('0x63')](_0xbc44('0x72'),_0x203bd3[_0xbc44('0x66')][_0xbc44('0x3a')]);_0x4ace4f[_0xbc44('0x28')][_0xbc44('0x73')]=_0x1c58f8[_0xbc44('0x73')];_0x4ace4f['message'][_0xbc44('0x74')]=_0xbc44('0x34');respondWithRpcPromise(_0xbc44('0x75'),_0xbc44('0x75'),{'event':'rejectmessage','message':_0x4ace4f[_0xbc44('0x28')]},client9002);return _0x1c58f8;}return null;})[_0xbc44('0x22')](respondWithResult(_0x2280a8,null))[_0xbc44('0x2a')](handleError(_0x2280a8,null));};exports[_0xbc44('0x7b')]=function(_0x48af6b,_0x26cafd){var _0x408f05;return db[_0xbc44('0x53')][_0xbc44('0x7b')](_0x48af6b['body'],{})[_0xbc44('0x22')](function(_0x42c9cf){_0x408f05=_0x42c9cf;return db[_0xbc44('0x7c')][_0xbc44('0x7d')]({'where':{'id':_0x408f05[_0xbc44('0x7e')]}});})['then'](function(_0x2af020){if(_[_0xbc44('0x69')](_0x2af020)){return;}else{_0x408f05[_0xbc44('0x5f')]=_0x2af020[_0xbc44('0x5f')];return db[_0xbc44('0x7f')][_0xbc44('0x7d')]({'where':{'id':_0x408f05[_0xbc44('0x80')]}});}})[_0xbc44('0x22')](function(_0x3499bb){return respondWithRpcPromise(_0xbc44('0x81'),'SendFax',{'FaxAccountId':_[_0xbc44('0x69')](_0x48af6b[_0xbc44('0x60')])?undefined:_0x48af6b['body']['FaxAccountId'],'path':_[_0xbc44('0x69')](_0x3499bb)?undefined:util[_0xbc44('0x63')](_0xbc44('0x82'),_0x3499bb[_0xbc44('0x83')]),'fax':_['isNil'](_0x408f05[_0xbc44('0x5f')])?undefined:_0x408f05['fax'],'AttachmentId':_0x408f05[_0xbc44('0x80')]},client9002);})[_0xbc44('0x22')](respondWithResult(_0x26cafd,0xc9))[_0xbc44('0x2a')](handleError(_0x26cafd,null));};exports['download']=function(_0x475e3d,_0x308391){var _0x172f3f=path[_0xbc44('0x84')](config['root'],_0xbc44('0x85'),_0xbc44('0x86'),_0xbc44('0x87'));return db[_0xbc44('0x53')][_0xbc44('0x5b')]({'where':{'id':_0x475e3d[_0xbc44('0x59')]['id']},'include':[{'model':db[_0xbc44('0x7f')],'as':_0xbc44('0x7f')}]})[_0xbc44('0x22')](handleEntityNotFound(_0x308391,null))[_0xbc44('0x22')](function(_0x424bc1){if(_0x424bc1){return _0x308391[_0xbc44('0x88')](path[_0xbc44('0x84')](_0x172f3f,_0x424bc1[_0xbc44('0x7f')][_0xbc44('0x83')]));}})[_0xbc44('0x2a')](handleError(_0x308391,null));}; \ No newline at end of file +var _0xe3f5=['RejectMessage','rejectMessage','rejectmessage','create','CmContact','findOne','isNil','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','then','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','options','FaxMessage','includeAll','findAll','show','params','rawAttributes','length','include','find','body','describe','../../config/logger','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteractionId','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','format','channel','event','accept','EventManager','acceptmessage','reject','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x550ef9,_0x520ea8){var _0xf0bea=function(_0xe9d6dd){while(--_0xe9d6dd){_0x550ef9['push'](_0x550ef9['shift']());}};_0xf0bea(++_0x520ea8);}(_0xe3f5,0x118));var _0x5e3f=function(_0x410b7e,_0x39041c){_0x410b7e=_0x410b7e-0x0;var _0x4cc0b3=_0xe3f5[_0x410b7e];return _0x4cc0b3;};'use strict';var pdf=require(_0x5e3f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5e3f('0x1'));var zipdir=require(_0x5e3f('0x2'));var jsonpatch=require(_0x5e3f('0x3'));var rp=require(_0x5e3f('0x4'));var moment=require(_0x5e3f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5e3f('0x6'));var util=require('util');var path=require(_0x5e3f('0x7'));var sox=require(_0x5e3f('0x8'));var csv=require('to-csv');var ejs=require(_0x5e3f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5e3f('0xa'));var crypto=require(_0x5e3f('0xb'));var jsforce=require(_0x5e3f('0xc'));var deskjs=require(_0x5e3f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5e3f('0xe'));var Papa=require(_0x5e3f('0xf'));var Redis=require('ioredis');var authService=require(_0x5e3f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5e3f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5e3f('0x12'));var utils=require(_0x5e3f('0x13'));var config=require(_0x5e3f('0x14'));var licenseUtil=require(_0x5e3f('0x15'));var db=require(_0x5e3f('0x16'))['db'];config[_0x5e3f('0x17')]=_[_0x5e3f('0x18')](config[_0x5e3f('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e3f('0x19'))(new Redis(config[_0x5e3f('0x17')]));require(_0x5e3f('0x1a'))[_0x5e3f('0x1b')](socket);var jayson=require(_0x5e3f('0x1c'));var client=jayson[_0x5e3f('0x1d')][_0x5e3f('0x1e')]({'port':0x232c});var client9002=jayson[_0x5e3f('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e15e2,_0x1e4be0,_0x174af6,_0x47f657){return new BPromise(function(_0x14f830,_0x2a32a4){var _0x24f18f=_0x47f657||client;return _0x24f18f[_0x5e3f('0x1f')](_0x3e15e2,_0x174af6)['then'](function(_0x244c5a){logger[_0x5e3f('0x20')](_0x5e3f('0x21'),_0x1e4be0,_0x5e3f('0x22'));logger[_0x5e3f('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x1e4be0,'request\x20sent',JSON[_0x5e3f('0x24')](_0x244c5a));if(_0x244c5a[_0x5e3f('0x25')]){if(_0x244c5a[_0x5e3f('0x25')][_0x5e3f('0x26')]===0x1f4){logger[_0x5e3f('0x25')](_0x5e3f('0x21'),_0x1e4be0,_0x244c5a[_0x5e3f('0x25')][_0x5e3f('0x27')]);return _0x2a32a4(_0x244c5a['error'][_0x5e3f('0x27')]);}logger[_0x5e3f('0x25')](_0x5e3f('0x21'),_0x1e4be0,_0x244c5a['error'][_0x5e3f('0x27')]);return _0x14f830(_0x244c5a['error'][_0x5e3f('0x27')]);}else{logger[_0x5e3f('0x20')](_0x5e3f('0x21'),_0x1e4be0,_0x5e3f('0x22'));_0x14f830(_0x244c5a[_0x5e3f('0x28')][_0x5e3f('0x27')]);}})[_0x5e3f('0x29')](function(_0x2f45b0){logger['error'](_0x5e3f('0x21'),_0x1e4be0,_0x2f45b0);_0x2a32a4(_0x2f45b0);});});}function respondWithStatusCode(_0x57aa09,_0x2fd995){_0x2fd995=_0x2fd995||0xcc;return function(_0x3f6531){if(_0x3f6531){return _0x57aa09[_0x5e3f('0x2a')](_0x2fd995);}return _0x57aa09[_0x5e3f('0x2b')](_0x2fd995)[_0x5e3f('0x2c')]();};}function respondWithResult(_0x2c2243,_0xfc94e3){_0xfc94e3=_0xfc94e3||0xc8;return function(_0x5ae014){if(_0x5ae014){return _0x2c2243[_0x5e3f('0x2b')](_0xfc94e3)[_0x5e3f('0x2d')](_0x5ae014);}};}function respondWithFilteredResult(_0x1ae6fe,_0x371425){return function(_0x48b798){if(_0x48b798){var _0x3c6c77=_0x48b798[_0x5e3f('0x2e')],_0xa19925=_0x371425[_0x5e3f('0x2f')],_0x278229=_0x371425[_0x5e3f('0x2f')]+_0x371425[_0x5e3f('0x30')],_0x17c8f6;if(_0x278229>=_0x3c6c77){_0x278229=_0x3c6c77;_0x17c8f6=0xc8;}else{_0x17c8f6=0xce;}_0x1ae6fe[_0x5e3f('0x2b')](_0x17c8f6);return _0x1ae6fe[_0x5e3f('0x31')](_0x5e3f('0x32'),_0xa19925+'-'+_0x278229+'/'+_0x3c6c77)[_0x5e3f('0x2d')](_0x48b798);}return null;};}function patchUpdates(_0x4bfd25){return function(_0x53119f){try{jsonpatch['apply'](_0x53119f,_0x4bfd25,!![]);}catch(_0x19b64f){return BPromise['reject'](_0x19b64f);}return _0x53119f['save']();};}function saveUpdates(_0x1691e5,_0x2b0db0){return function(_0x1ad016){if(_0x1ad016){return _0x1ad016[_0x5e3f('0x33')](_0x1691e5)[_0x5e3f('0x34')](function(_0x142972){return _0x142972;});}return null;};}function removeEntity(_0x59ddca,_0x46668a){return function(_0x1be86c){if(_0x1be86c){return _0x1be86c['destroy']()['then'](function(){_0x59ddca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x165ca1,_0x42a56a){return function(_0x248cf7){if(!_0x248cf7){_0x165ca1[_0x5e3f('0x2a')](0x194);}return _0x248cf7;};}function handleError(_0x5236f2,_0x4ae9ca){_0x4ae9ca=_0x4ae9ca||0x1f4;return function(_0x5917c7){logger[_0x5e3f('0x25')](_0x5917c7[_0x5e3f('0x35')]);if(_0x5917c7[_0x5e3f('0x36')]){delete _0x5917c7[_0x5e3f('0x36')];}_0x5236f2['status'](_0x4ae9ca)[_0x5e3f('0x37')](_0x5917c7);};}exports[_0x5e3f('0x38')]=function(_0x5a6c6b,_0x3b3e0){var _0x223bf4={},_0x224c2c={},_0x2572b6={'count':0x0,'rows':[]};var _0x36c832=_[_0x5e3f('0x39')](db['FaxMessage']['rawAttributes'],function(_0x3d09a8){return{'name':_0x3d09a8[_0x5e3f('0x3a')],'type':_0x3d09a8[_0x5e3f('0x3b')][_0x5e3f('0x3c')]};});_0x224c2c[_0x5e3f('0x3d')]=_[_0x5e3f('0x39')](_0x36c832,'name');_0x224c2c[_0x5e3f('0x3e')]=_[_0x5e3f('0x3f')](_0x5a6c6b['query']);_0x224c2c[_0x5e3f('0x40')]=_[_0x5e3f('0x41')](_0x224c2c['model'],_0x224c2c[_0x5e3f('0x3e')]);_0x223bf4['attributes']=_[_0x5e3f('0x41')](_0x224c2c[_0x5e3f('0x3d')],qs[_0x5e3f('0x42')](_0x5a6c6b[_0x5e3f('0x3e')][_0x5e3f('0x42')]));_0x223bf4[_0x5e3f('0x43')]=_0x223bf4[_0x5e3f('0x43')]['length']?_0x223bf4[_0x5e3f('0x43')]:_0x224c2c[_0x5e3f('0x3d')];if(!_0x5a6c6b['query'][_0x5e3f('0x44')](_0x5e3f('0x45'))){_0x223bf4[_0x5e3f('0x30')]=qs[_0x5e3f('0x30')](_0x5a6c6b[_0x5e3f('0x3e')][_0x5e3f('0x30')]);_0x223bf4[_0x5e3f('0x2f')]=qs[_0x5e3f('0x2f')](_0x5a6c6b[_0x5e3f('0x3e')][_0x5e3f('0x2f')]);}_0x223bf4['order']=qs[_0x5e3f('0x46')](_0x5a6c6b[_0x5e3f('0x3e')][_0x5e3f('0x46')]);_0x223bf4['where']=qs[_0x5e3f('0x40')](_[_0x5e3f('0x47')](_0x5a6c6b[_0x5e3f('0x3e')],_0x224c2c['filters']),_0x36c832);if(_0x5a6c6b[_0x5e3f('0x3e')]['filter']){_0x223bf4['where']=_[_0x5e3f('0x48')](_0x223bf4[_0x5e3f('0x49')],{'$or':_[_0x5e3f('0x39')](_0x36c832,function(_0xb6e788){if(_0xb6e788['type']!==_0x5e3f('0x4a')){var _0x45b81f={};_0x45b81f[_0xb6e788[_0x5e3f('0x36')]]={'$like':'%'+_0x5a6c6b[_0x5e3f('0x3e')][_0x5e3f('0x4b')]+'%'};return _0x45b81f;}})});}_0x223bf4=_[_0x5e3f('0x48')]({},_0x223bf4,_0x5a6c6b[_0x5e3f('0x4c')]);var _0x1b68f5={'where':_0x223bf4[_0x5e3f('0x49')]};return db[_0x5e3f('0x4d')][_0x5e3f('0x2e')](_0x1b68f5)[_0x5e3f('0x34')](function(_0x1080bf){_0x2572b6[_0x5e3f('0x2e')]=_0x1080bf;if(_0x5a6c6b[_0x5e3f('0x3e')][_0x5e3f('0x4e')]){_0x223bf4['include']=[{'all':!![]}];}return db['FaxMessage'][_0x5e3f('0x4f')](_0x223bf4);})[_0x5e3f('0x34')](function(_0x2b1158){_0x2572b6['rows']=_0x2b1158;return _0x2572b6;})['then'](respondWithFilteredResult(_0x3b3e0,_0x223bf4))[_0x5e3f('0x29')](handleError(_0x3b3e0,null));};exports[_0x5e3f('0x50')]=function(_0x5136f3,_0x32d18c){var _0x49d55a={'raw':!![],'where':{'id':_0x5136f3[_0x5e3f('0x51')]['id']}},_0x5a52a7={};_0x5a52a7[_0x5e3f('0x3d')]=_[_0x5e3f('0x3f')](db[_0x5e3f('0x4d')][_0x5e3f('0x52')]);_0x5a52a7[_0x5e3f('0x3e')]=_[_0x5e3f('0x3f')](_0x5136f3[_0x5e3f('0x3e')]);_0x5a52a7['filters']=_[_0x5e3f('0x41')](_0x5a52a7[_0x5e3f('0x3d')],_0x5a52a7[_0x5e3f('0x3e')]);_0x49d55a[_0x5e3f('0x43')]=_[_0x5e3f('0x41')](_0x5a52a7[_0x5e3f('0x3d')],qs[_0x5e3f('0x42')](_0x5136f3[_0x5e3f('0x3e')][_0x5e3f('0x42')]));_0x49d55a[_0x5e3f('0x43')]=_0x49d55a['attributes'][_0x5e3f('0x53')]?_0x49d55a[_0x5e3f('0x43')]:_0x5a52a7[_0x5e3f('0x3d')];if(_0x5136f3[_0x5e3f('0x3e')]['includeAll']){_0x49d55a[_0x5e3f('0x54')]=[{'all':!![]}];}_0x49d55a=_[_0x5e3f('0x48')]({},_0x49d55a,_0x5136f3[_0x5e3f('0x4c')]);return db[_0x5e3f('0x4d')][_0x5e3f('0x55')](_0x49d55a)[_0x5e3f('0x34')](handleEntityNotFound(_0x32d18c,null))['then'](respondWithResult(_0x32d18c,null))['catch'](handleError(_0x32d18c,null));};exports['update']=function(_0x26e4df,_0x25d5e9){if(_0x26e4df[_0x5e3f('0x56')]['id']){delete _0x26e4df[_0x5e3f('0x56')]['id'];}return db[_0x5e3f('0x4d')][_0x5e3f('0x55')]({'where':{'id':_0x26e4df[_0x5e3f('0x51')]['id']}})[_0x5e3f('0x34')](handleEntityNotFound(_0x25d5e9,null))[_0x5e3f('0x34')](saveUpdates(_0x26e4df[_0x5e3f('0x56')],null))[_0x5e3f('0x34')](respondWithResult(_0x25d5e9,null))[_0x5e3f('0x29')](handleError(_0x25d5e9,null));};exports['destroy']=function(_0x51744c,_0x14c9c5){return db[_0x5e3f('0x4d')]['find']({'where':{'id':_0x51744c[_0x5e3f('0x51')]['id']}})['then'](handleEntityNotFound(_0x14c9c5,null))[_0x5e3f('0x34')](removeEntity(_0x14c9c5,null))[_0x5e3f('0x29')](handleError(_0x14c9c5,null));};exports[_0x5e3f('0x57')]=function(_0x2aedf2,_0x1457e4){return db[_0x5e3f('0x4d')][_0x5e3f('0x57')]()[_0x5e3f('0x34')](respondWithResult(_0x1457e4,null))[_0x5e3f('0x29')](handleError(_0x1457e4,null));};var interaction_log=require(_0x5e3f('0x58'))('fax-interactions');exports['accept']=function(_0x30e94a,_0x286e39,_0x20e980){var _0xdbcff8={'channel':_0x5e3f('0x59')};if(_0x30e94a[_0x5e3f('0x56')]['id']){delete _0x30e94a[_0x5e3f('0x56')]['id'];}_0x30e94a['body']['read']=!![];_0x30e94a[_0x5e3f('0x56')][_0x5e3f('0x5a')]=moment()['format'](_0x5e3f('0x5b'));_0x30e94a[_0x5e3f('0x56')][_0x5e3f('0x5c')]=_0x30e94a[_0x5e3f('0x56')][_0x5e3f('0x5c')]||_0x30e94a[_0x5e3f('0x5d')]['id'];return db[_0x5e3f('0x4d')]['find']({'where':{'id':_0x30e94a[_0x5e3f('0x51')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0x286e39,null))[_0x5e3f('0x34')](saveUpdates(_0x30e94a[_0x5e3f('0x56')],null))[_0x5e3f('0x34')](function(_0x40c80c){if(_0x40c80c){_0xdbcff8[_0x5e3f('0x27')]=_0x40c80c[_0x5e3f('0x5e')]({'plain':!![]});return db['FaxInteraction'][_0x5e3f('0x55')]({'where':{'id':_0x40c80c[_0x5e3f('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x286e39,null))[_0x5e3f('0x34')](function(_0x4288b5){if(_0x4288b5){return _0x4288b5[_0x5e3f('0x33')]({'UserId':_0x30e94a['body']['UserId'],'read1stAt':_['isNil'](_0x4288b5[_0x5e3f('0x60')])?moment()['format'](_0x5e3f('0x5b')):undefined});}return null;})[_0x5e3f('0x34')](function(_0x589d7b){if(_0x589d7b){_0xdbcff8[_0x5e3f('0x61')]=_0x589d7b['get']({'plain':!![]});interaction_log[_0x5e3f('0x20')](_0x5e3f('0x62'),_0x30e94a[_0x5e3f('0x5d')]['id'],_0x30e94a['user'][_0x5e3f('0x36')],_0x30e94a['user']['role'],_0xdbcff8[_0x5e3f('0x61')]['id'],_0x30e94a['body']?JSON['stringify'](_0x30e94a[_0x5e3f('0x56')]):_0x5e3f('0x63'));return respondWithRpcPromise(_0x5e3f('0x64'),_0x5e3f('0x65'),_0xdbcff8);}return null;})[_0x5e3f('0x34')](function(_0x2914fe){if(_0x2914fe){if(_0x30e94a[_0x5e3f('0x56')][_0x5e3f('0x66')]){_0xdbcff8['message'][_0x5e3f('0x67')]=util[_0x5e3f('0x68')]('SIP/%s',_0x30e94a[_0x5e3f('0x5d')][_0x5e3f('0x36')]);_0xdbcff8[_0x5e3f('0x27')]['channel']=_0xdbcff8[_0x5e3f('0x69')];_0xdbcff8[_0x5e3f('0x27')][_0x5e3f('0x6a')]=_0x5e3f('0x6b');return respondWithRpcPromise(_0x5e3f('0x6c'),_0x5e3f('0x6c'),{'event':_0x5e3f('0x6d'),'message':_0xdbcff8[_0x5e3f('0x27')]},client9002)[_0x5e3f('0x34')](function(){return _0xdbcff8;});}return _0xdbcff8;}return null;})['then'](respondWithResult(_0x286e39,null))[_0x5e3f('0x29')](handleError(_0x286e39,null));};var interaction_log=require(_0x5e3f('0x58'))('fax-interactions');exports[_0x5e3f('0x6e')]=function(_0x203540,_0x38620d,_0xf15281){var _0x5dbe93={'agent':{},'channel':_0x5e3f('0x59')};if(_0x203540[_0x5e3f('0x56')]['id']){delete _0x203540[_0x5e3f('0x56')]['id'];}_0x203540[_0x5e3f('0x56')][_0x5e3f('0x5c')]=_0x203540[_0x5e3f('0x56')][_0x5e3f('0x5c')]||_0x203540['user']['id'];_0x5dbe93[_0x5e3f('0x6f')]['id']=_0x203540[_0x5e3f('0x56')]['UserId'];return db[_0x5e3f('0x4d')][_0x5e3f('0x55')]({'where':{'id':_0x203540['params']['id'],'UserId':null}})[_0x5e3f('0x34')](handleEntityNotFound(_0x38620d,null))['then'](function(_0x5370a3){if(_0x5370a3){_0x5dbe93['message']=_0x5370a3[_0x5e3f('0x5e')]({'plain':!![]});return db['FaxInteraction'][_0x5e3f('0x55')]({'where':{'id':_0x5370a3['FaxInteractionId']}});}return null;})[_0x5e3f('0x34')](handleEntityNotFound(_0x38620d,null))[_0x5e3f('0x34')](function(_0x501476){if(_0x501476){_0x5dbe93['interaction']=_0x501476[_0x5e3f('0x5e')]({'plain':!![]});interaction_log[_0x5e3f('0x20')](_0x5e3f('0x70'),_0x203540['user']['id'],_0x203540[_0x5e3f('0x5d')][_0x5e3f('0x36')],_0x203540[_0x5e3f('0x5d')]['role'],_0x5dbe93['interaction']['id'],_0x203540[_0x5e3f('0x56')]?JSON[_0x5e3f('0x24')](_0x203540['body']):_0x5e3f('0x63'));return respondWithRpcPromise(_0x5e3f('0x71'),_0x5e3f('0x72'),_0x5dbe93);}return null;})[_0x5e3f('0x34')](function(_0x172bd7){if(_0x172bd7){_0x172bd7[_0x5e3f('0x27')][_0x5e3f('0x67')]=util['format']('SIP/%s',_0x203540[_0x5e3f('0x5d')]['name']);_0x172bd7['message']['channel']=_0x5dbe93[_0x5e3f('0x69')];_0x172bd7[_0x5e3f('0x27')][_0x5e3f('0x6a')]=_0x5e3f('0x6e');respondWithRpcPromise(_0x5e3f('0x6c'),_0x5e3f('0x6c'),{'event':_0x5e3f('0x73'),'message':_0x172bd7[_0x5e3f('0x27')]},client9002);return _0x5dbe93;}return null;})[_0x5e3f('0x34')](respondWithResult(_0x38620d,null))[_0x5e3f('0x29')](handleError(_0x38620d,null));};exports[_0x5e3f('0x74')]=function(_0x1eb6a9,_0x6e80b7){var _0x40f75a;return db['FaxMessage'][_0x5e3f('0x74')](_0x1eb6a9[_0x5e3f('0x56')],{})[_0x5e3f('0x34')](function(_0x209157){_0x40f75a=_0x209157;return db[_0x5e3f('0x75')][_0x5e3f('0x76')]({'where':{'id':_0x40f75a['ContactId']}});})[_0x5e3f('0x34')](function(_0x5d20f6){if(_[_0x5e3f('0x77')](_0x5d20f6)){return;}else{_0x40f75a[_0x5e3f('0x59')]=_0x5d20f6[_0x5e3f('0x59')];return db[_0x5e3f('0x78')][_0x5e3f('0x76')]({'where':{'id':_0x40f75a['AttachmentId']}});}})[_0x5e3f('0x34')](function(_0x1a7c5d){return respondWithRpcPromise('SendFax',_0x5e3f('0x79'),{'FaxAccountId':_['isNil'](_0x1eb6a9[_0x5e3f('0x56')])?undefined:_0x1eb6a9[_0x5e3f('0x56')][_0x5e3f('0x7a')],'path':_[_0x5e3f('0x77')](_0x1a7c5d)?undefined:util[_0x5e3f('0x68')](_0x5e3f('0x7b'),_0x1a7c5d[_0x5e3f('0x7c')]),'fax':_[_0x5e3f('0x77')](_0x40f75a[_0x5e3f('0x59')])?undefined:_0x40f75a[_0x5e3f('0x59')],'AttachmentId':_0x40f75a['AttachmentId']},client9002);})['then'](respondWithResult(_0x6e80b7,0xc9))['catch'](handleError(_0x6e80b7,null));};exports[_0x5e3f('0x7d')]=function(_0x5c1344,_0x2d08fe){var _0x5acace=path[_0x5e3f('0x7e')](config[_0x5e3f('0x7f')],_0x5e3f('0x80'),_0x5e3f('0x81'),_0x5e3f('0x82'));return db['FaxMessage']['find']({'where':{'id':_0x5c1344[_0x5e3f('0x51')]['id']},'include':[{'model':db['Attachment'],'as':_0x5e3f('0x78')}]})[_0x5e3f('0x34')](handleEntityNotFound(_0x2d08fe,null))['then'](function(_0x5203ef){if(_0x5203ef){return _0x2d08fe[_0x5e3f('0x7d')](path[_0x5e3f('0x7e')](_0x5acace,_0x5203ef[_0x5e3f('0x78')][_0x5e3f('0x7c')]));}})[_0x5e3f('0x29')](handleError(_0x2d08fe,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 7f763d6..0303d5f 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x2f2fd0,_0x3c980d){var _0x44f94f=function(_0x1fb033){while(--_0x1fb033){_0x2f2fd0['push'](_0x2f2fd0['shift']());}};_0x44f94f(++_0x3c980d);}(_0x7217,0x19e));var _0x7721=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x7217[_0x138f59];return _0x3d114d;};'use strict';var EventEmitter=require(_0x7721('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7721('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){FaxMessageEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);FaxMessageEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];FaxMessage[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x55ca,0x126));var _0xa55c=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0x55ca[_0x2134b7];return _0x6c5914;};'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 9de7c5c..6bd71f8 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 _0xcfa3=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','findOne','FaxInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xcfa3,0x10a));var _0x3cfa=function(_0x42de63,_0x246b7f){_0x42de63=_0x42de63-0x0;var _0x3cb936=_0xcfa3[_0x42de63];return _0x3cb936;};'use strict';var _=require(_0x3cfa('0x0'));var util=require(_0x3cfa('0x1'));var logger=require(_0x3cfa('0x2'))(_0x3cfa('0x3'));var moment=require(_0x3cfa('0x4'));var BPromise=require(_0x3cfa('0x5'));var rp=require(_0x3cfa('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3cfa('0x7'));var config=require(_0x3cfa('0x8'));var attributes=require('./faxMessage.attributes');module[_0x3cfa('0x9')]=function(_0x6ae714,_0x425c94){return _0x6ae714['define']('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x3cfa('0xa'),'fields':['body'],'type':_0x3cfa('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1bf79c,_0x57c6fd,_0x5584c4){var _0x36f38c=_0x6ae714[_0x3cfa('0xc')];var _0x504998=_0x1bf79c[_0x3cfa('0xd')]({'plain':!![]});if(_0x504998[_0x3cfa('0xe')][_0x3cfa('0xf')]()==='in'||_0x504998['direction'][_0x3cfa('0xf')]()===_0x3cfa('0x10')&&!_0x504998['secret']&&!_[_0x3cfa('0x11')](_0x504998[_0x3cfa('0x12')])){_0x36f38c['FaxInteraction'][_0x3cfa('0x13')]({'where':{'id':_0x504998[_0x3cfa('0x14')]}})[_0x3cfa('0x15')](function(_0x4c9a74){if(_0x4c9a74){_0x4c9a74[_0x3cfa('0x16')]({'lastMsgAt':_0x504998[_0x3cfa('0x17')],'lastMsgDirection':_0x504998['direction']['toLowerCase']()});}})['catch'](function(_0x4c4b80){console[_0x3cfa('0x18')](_0x4c4b80);});}_0x5584c4();}},'charset':_0x3cfa('0x19'),'collate':_0x3cfa('0x1a')});}; \ No newline at end of file +var _0xd8b6=['update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','./faxMessage.attributes','define','FaxMessage','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','then'];(function(_0x3916f9,_0x26a73f){var _0x5adda8=function(_0x4501d2){while(--_0x4501d2){_0x3916f9['push'](_0x3916f9['shift']());}};_0x5adda8(++_0x26a73f);}(_0xd8b6,0xdd));var _0x6d8b=function(_0x4b55e0,_0x15027e){_0x4b55e0=_0x4b55e0-0x0;var _0x1b64ae=_0xd8b6[_0x4b55e0];return _0x1b64ae;};'use strict';var _=require(_0x6d8b('0x0'));var util=require(_0x6d8b('0x1'));var logger=require(_0x6d8b('0x2'))(_0x6d8b('0x3'));var moment=require(_0x6d8b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d8b('0x5'));var rimraf=require(_0x6d8b('0x6'));var config=require('../../config/environment');var attributes=require(_0x6d8b('0x7'));module['exports']=function(_0x3ef6b9,_0x1aea26){return _0x3ef6b9[_0x6d8b('0x8')](_0x6d8b('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x6d8b('0xa'),'fields':['body'],'type':_0x6d8b('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1fbbfe,_0x150f8e,_0xeba7b3){var _0x39b85c=_0x3ef6b9[_0x6d8b('0xc')];var _0x1d0c09=_0x1fbbfe[_0x6d8b('0xd')]({'plain':!![]});if(_0x1d0c09['direction']['toLowerCase']()==='in'||_0x1d0c09[_0x6d8b('0xe')][_0x6d8b('0xf')]()===_0x6d8b('0x10')&&!_0x1d0c09[_0x6d8b('0x11')]&&!_['isNil'](_0x1d0c09[_0x6d8b('0x12')])){_0x39b85c[_0x6d8b('0x13')][_0x6d8b('0x14')]({'where':{'id':_0x1d0c09['FaxInteractionId']}})[_0x6d8b('0x15')](function(_0xf5f6e7){if(_0xf5f6e7){_0xf5f6e7[_0x6d8b('0x16')]({'lastMsgAt':_0x1d0c09[_0x6d8b('0x17')],'lastMsgDirection':_0x1d0c09[_0x6d8b('0xe')]['toLowerCase']()});}})['catch'](function(_0x4bf339){console[_0x6d8b('0x18')](_0x4bf339);});}_0xeba7b3();}},'charset':_0x6d8b('0x19'),'collate':_0x6d8b('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 14eae76..64d5ab0 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 _0x6ea0=['debug','UpdateFaxMessage','FaxMessage','update','where','attributes','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','then','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','create','body','options','raw','CreateFaxMessage'];(function(_0x564352,_0x4d23ad){var _0x5d7f4b=function(_0x169e4c){while(--_0x169e4c){_0x564352['push'](_0x564352['shift']());}};_0x5d7f4b(++_0x4d23ad);}(_0x6ea0,0x1e7));var _0x06ea=function(_0x1429a9,_0x48bca8){_0x1429a9=_0x1429a9-0x0;var _0x2aac84=_0x6ea0[_0x1429a9];return _0x2aac84;};'use strict';var _=require(_0x06ea('0x0'));var util=require(_0x06ea('0x1'));var moment=require('moment');var BPromise=require(_0x06ea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06ea('0x3'));var db=require(_0x06ea('0x4'))['db'];var utils=require(_0x06ea('0x5'));var logger=require(_0x06ea('0x6'))(_0x06ea('0x7'));var config=require(_0x06ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x06ea('0x9')][_0x06ea('0xa')]({'port':0x232a});config['redis']=_[_0x06ea('0xb')](config[_0x06ea('0xc')],{'host':_0x06ea('0xd'),'port':0x18eb});var socket=require(_0x06ea('0xe'))(new Redis(config[_0x06ea('0xc')]));require('./faxMessage.socket')[_0x06ea('0xf')](socket);function respondWithRpcPromise(_0x44fb60,_0x25f09a,_0x22948e){return new BPromise(function(_0x479f4f,_0x2322ad){return client['request'](_0x44fb60,_0x22948e)[_0x06ea('0x10')](function(_0x52e300){logger['info'](_0x06ea('0x11'),_0x25f09a,'request\x20sent');logger['debug'](_0x06ea('0x12'),_0x25f09a,_0x06ea('0x13'),JSON[_0x06ea('0x14')](_0x52e300));if(_0x52e300[_0x06ea('0x15')]){if(_0x52e300[_0x06ea('0x15')][_0x06ea('0x16')]===0x1f4){logger[_0x06ea('0x15')](_0x06ea('0x11'),_0x25f09a,_0x52e300[_0x06ea('0x15')]['message']);return _0x2322ad(_0x52e300[_0x06ea('0x15')]['message']);}logger[_0x06ea('0x15')](_0x06ea('0x11'),_0x25f09a,_0x52e300['error'][_0x06ea('0x17')]);return _0x479f4f(_0x52e300[_0x06ea('0x15')]['message']);}else{logger[_0x06ea('0x18')]('FaxMessage,\x20%s,\x20%s',_0x25f09a,_0x06ea('0x13'));_0x479f4f(_0x52e300['result']['message']);}})[_0x06ea('0x19')](function(_0x3b7727){logger[_0x06ea('0x15')](_0x06ea('0x11'),_0x25f09a,_0x3b7727);_0x2322ad(_0x3b7727);});});}exports['CreateFaxMessage']=function(_0x238708){var _0x1f3acd=this;return new Promise(function(_0x43a39a,_0x3b73ed){return db['FaxMessage'][_0x06ea('0x1a')](_0x238708[_0x06ea('0x1b')],{'raw':_0x238708[_0x06ea('0x1c')]?_0x238708[_0x06ea('0x1c')][_0x06ea('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x359bbf){logger[_0x06ea('0x18')](_0x06ea('0x1e'),_0x238708);logger[_0x06ea('0x1f')](_0x06ea('0x1e'),_0x238708,JSON[_0x06ea('0x14')](_0x359bbf));_0x43a39a(_0x359bbf);})[_0x06ea('0x19')](function(_0x49a477){logger[_0x06ea('0x15')](_0x06ea('0x1e'),_0x49a477['message'],_0x238708);_0x3b73ed(_0x1f3acd[_0x06ea('0x15')](0x1f4,_0x49a477[_0x06ea('0x17')]));});});};exports[_0x06ea('0x20')]=function(_0x22f02f){var _0x3e4219=this;return new Promise(function(_0x1adb1e,_0x4fec06){return db[_0x06ea('0x21')][_0x06ea('0x22')](_0x22f02f[_0x06ea('0x1b')],{'raw':_0x22f02f[_0x06ea('0x1c')]?_0x22f02f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22f02f['options']?_0x22f02f['options'][_0x06ea('0x23')]||null:null,'attributes':_0x22f02f[_0x06ea('0x1c')]?_0x22f02f[_0x06ea('0x1c')][_0x06ea('0x24')]||null:null,'limit':_0x22f02f['options']?_0x22f02f[_0x06ea('0x1c')]['limit']||null:null})[_0x06ea('0x10')](function(_0xbc5165){logger[_0x06ea('0x18')](_0x06ea('0x20'),_0x22f02f);logger[_0x06ea('0x1f')](_0x06ea('0x20'),_0x22f02f,JSON[_0x06ea('0x14')](_0xbc5165));_0x1adb1e(_0xbc5165);})['catch'](function(_0x5432ef){logger[_0x06ea('0x15')](_0x06ea('0x20'),_0x5432ef[_0x06ea('0x17')],_0x22f02f);_0x4fec06(_0x3e4219[_0x06ea('0x15')](0x1f4,_0x5432ef['message']));});});}; \ No newline at end of file +var _0x4ecf=['code','message','info','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xdcb46f,_0x8f628e){var _0x1382d8=function(_0x381441){while(--_0x381441){_0xdcb46f['push'](_0xdcb46f['shift']());}};_0x1382d8(++_0x8f628e);}(_0x4ecf,0x1a5));var _0xf4ec=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4ecf[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf4ec('0x0'));var util=require(_0xf4ec('0x1'));var moment=require(_0xf4ec('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4ec('0x3'));var fs=require('fs');var Redis=require(_0xf4ec('0x4'));var db=require(_0xf4ec('0x5'))['db'];var utils=require(_0xf4ec('0x6'));var logger=require('../../config/logger')(_0xf4ec('0x7'));var config=require(_0xf4ec('0x8'));var jayson=require(_0xf4ec('0x9'));var client=jayson[_0xf4ec('0xa')][_0xf4ec('0xb')]({'port':0x232a});config[_0xf4ec('0xc')]=_['defaults'](config[_0xf4ec('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf4ec('0xd'))(new Redis(config['redis']));require(_0xf4ec('0xe'))[_0xf4ec('0xf')](socket);function respondWithRpcPromise(_0x2090a1,_0x241406,_0xca336a){return new BPromise(function(_0x1b1c2f,_0x42c573){return client[_0xf4ec('0x10')](_0x2090a1,_0xca336a)[_0xf4ec('0x11')](function(_0x2c3429){logger['info'](_0xf4ec('0x12'),_0x241406,_0xf4ec('0x13'));logger[_0xf4ec('0x14')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x241406,'request\x20sent',JSON[_0xf4ec('0x15')](_0x2c3429));if(_0x2c3429['error']){if(_0x2c3429[_0xf4ec('0x16')][_0xf4ec('0x17')]===0x1f4){logger[_0xf4ec('0x16')](_0xf4ec('0x12'),_0x241406,_0x2c3429['error'][_0xf4ec('0x18')]);return _0x42c573(_0x2c3429['error'][_0xf4ec('0x18')]);}logger[_0xf4ec('0x16')](_0xf4ec('0x12'),_0x241406,_0x2c3429[_0xf4ec('0x16')][_0xf4ec('0x18')]);return _0x1b1c2f(_0x2c3429[_0xf4ec('0x16')][_0xf4ec('0x18')]);}else{logger[_0xf4ec('0x19')](_0xf4ec('0x12'),_0x241406,_0xf4ec('0x13'));_0x1b1c2f(_0x2c3429[_0xf4ec('0x1a')]['message']);}})[_0xf4ec('0x1b')](function(_0xbb171){logger[_0xf4ec('0x16')](_0xf4ec('0x12'),_0x241406,_0xbb171);_0x42c573(_0xbb171);});});}exports['CreateFaxMessage']=function(_0x149093){var _0x335f42=this;return new Promise(function(_0x3cfe68,_0x1db09c){return db[_0xf4ec('0x1c')][_0xf4ec('0x1d')](_0x149093[_0xf4ec('0x1e')],{'raw':_0x149093['options']?_0x149093[_0xf4ec('0x1f')][_0xf4ec('0x20')]===undefined?!![]:![]:!![]})[_0xf4ec('0x11')](function(_0x4917ed){logger['info']('CreateFaxMessage',_0x149093);logger[_0xf4ec('0x14')](_0xf4ec('0x21'),_0x149093,JSON['stringify'](_0x4917ed));_0x3cfe68(_0x4917ed);})[_0xf4ec('0x1b')](function(_0x54a635){logger[_0xf4ec('0x16')](_0xf4ec('0x21'),_0x54a635['message'],_0x149093);_0x1db09c(_0x335f42['error'](0x1f4,_0x54a635[_0xf4ec('0x18')]));});});};exports[_0xf4ec('0x22')]=function(_0x951f3a){var _0x2e484a=this;return new Promise(function(_0xde8d21,_0x38745a){return db['FaxMessage']['update'](_0x951f3a[_0xf4ec('0x1e')],{'raw':_0x951f3a[_0xf4ec('0x1f')]?_0x951f3a[_0xf4ec('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x951f3a[_0xf4ec('0x1f')]?_0x951f3a[_0xf4ec('0x1f')]['where']||null:null,'attributes':_0x951f3a[_0xf4ec('0x1f')]?_0x951f3a['options'][_0xf4ec('0x23')]||null:null,'limit':_0x951f3a[_0xf4ec('0x1f')]?_0x951f3a['options'][_0xf4ec('0x24')]||null:null})['then'](function(_0x2a29c1){logger[_0xf4ec('0x19')](_0xf4ec('0x22'),_0x951f3a);logger[_0xf4ec('0x14')]('UpdateFaxMessage',_0x951f3a,JSON['stringify'](_0x2a29c1));_0xde8d21(_0x2a29c1);})[_0xf4ec('0x1b')](function(_0x53bd7e){logger[_0xf4ec('0x16')](_0xf4ec('0x22'),_0x53bd7e[_0xf4ec('0x18')],_0x951f3a);_0x38745a(_0x2e484a['error'](0x1f4,_0x53bd7e[_0xf4ec('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index aba3b84..670e140 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 _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 087d705..53419a3 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 _0xd5fe=['destroy','exports','multer','util','connect-timeout','Router','../../config/environment','./faxMessage.controller','index','get','/describe','isAuthenticated','describe','download','tracked','fax','faxmessage:create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x4f192b,_0xc909cf){var _0x2d5f3e=function(_0x177708){while(--_0x177708){_0x4f192b['push'](_0x4f192b['shift']());}};_0x2d5f3e(++_0xc909cf);}(_0xd5fe,0x1ab));var _0xed5f=function(_0x4360c4,_0x2f8209){_0x4360c4=_0x4360c4-0x0;var _0x3168c8=_0xd5fe[_0x4360c4];return _0x3168c8;};'use strict';var multer=require(_0xed5f('0x0'));var util=require(_0xed5f('0x1'));var path=require('path');var timeout=require(_0xed5f('0x2'));var express=require('express');var router=express[_0xed5f('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xed5f('0x4'));var controller=require(_0xed5f('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xed5f('0x6')]);router[_0xed5f('0x7')](_0xed5f('0x8'),auth[_0xed5f('0x9')](),controller[_0xed5f('0xa')]);router[_0xed5f('0x7')]('/:id',auth[_0xed5f('0x9')](),controller['show']);router[_0xed5f('0x7')]('/:id/download',auth[_0xed5f('0x9')](),controller[_0xed5f('0xb')]);router['post']('/',auth[_0xed5f('0x9')](),interaction[_0xed5f('0xc')](_0xed5f('0xd'),_0xed5f('0xe')),controller['create']);router[_0xed5f('0xf')](_0xed5f('0x10'),auth[_0xed5f('0x9')](),controller[_0xed5f('0x11')]);router['put'](_0xed5f('0x12'),auth[_0xed5f('0x9')](),controller[_0xed5f('0x13')]);router[_0xed5f('0xf')](_0xed5f('0x14'),auth[_0xed5f('0x9')](),controller[_0xed5f('0x15')]);router[_0xed5f('0x16')](_0xed5f('0x10'),auth[_0xed5f('0x9')](),controller[_0xed5f('0x17')]);module[_0xed5f('0x18')]=router; \ No newline at end of file +var _0x36d6=['update','/:id/accept','accept','/:id/reject','reject','delete','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','faxmessage:create','create','put'];(function(_0xdf1781,_0x1b9c28){var _0x8d9809=function(_0x19c34f){while(--_0x19c34f){_0xdf1781['push'](_0xdf1781['shift']());}};_0x8d9809(++_0x1b9c28);}(_0x36d6,0x18d));var _0x636d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36d6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x636d('0x0'));var timeout=require(_0x636d('0x1'));var express=require(_0x636d('0x2'));var router=express['Router']();var auth=require(_0x636d('0x3'));var interaction=require(_0x636d('0x4'));var config=require(_0x636d('0x5'));var controller=require(_0x636d('0x6'));router[_0x636d('0x7')]('/',auth[_0x636d('0x8')](),controller[_0x636d('0x9')]);router[_0x636d('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x636d('0xa')]);router[_0x636d('0x7')](_0x636d('0xb'),auth['isAuthenticated'](),controller[_0x636d('0xc')]);router[_0x636d('0x7')](_0x636d('0xd'),auth[_0x636d('0x8')](),controller[_0x636d('0xe')]);router[_0x636d('0xf')]('/',auth['isAuthenticated'](),interaction['tracked']('fax',_0x636d('0x10')),controller[_0x636d('0x11')]);router[_0x636d('0x12')]('/:id',auth[_0x636d('0x8')](),controller[_0x636d('0x13')]);router['put'](_0x636d('0x14'),auth['isAuthenticated'](),controller[_0x636d('0x15')]);router[_0x636d('0x12')](_0x636d('0x16'),auth['isAuthenticated'](),controller[_0x636d('0x17')]);router[_0x636d('0x18')](_0x636d('0xb'),auth[_0x636d('0x8')](),controller['destroy']);module[_0x636d('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a8fc4ba..2b6b93f 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 _0xebb1=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0xebb1,0x1d8));var _0x1ebb=function(_0x2e577e,_0x4e117a){_0x2e577e=_0x2e577e-0x0;var _0x3be25c=_0xebb1[_0x2e577e];return _0x3be25c;};'use strict';var Sequelize=require(_0x1ebb('0x0'));module[_0x1ebb('0x1')]={'name':{'type':Sequelize[_0x1ebb('0x2')],'unique':_0x1ebb('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1ebb('0x4')](_0x1ebb('0x5'),'beepall',_0x1ebb('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x83da=['sequelize','INTEGER','rrmemory','roundrobin'];(function(_0x5c7e62,_0x27a461){var _0x4ce2af=function(_0x112cf4){while(--_0x112cf4){_0x5c7e62['push'](_0x5c7e62['shift']());}};_0x4ce2af(++_0x27a461);}(_0x83da,0xac));var _0xa83d=function(_0x7ddd2d,_0x362cd5){_0x7ddd2d=_0x7ddd2d-0x0;var _0x39e3f9=_0x83da[_0x7ddd2d];return _0x39e3f9;};'use strict';var Sequelize=require(_0xa83d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xa83d('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa83d('0x2'),'beepall',_0xa83d('0x3')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa83d('0x1')],'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 b21f677..c2782de 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 _0x75fb=['find','user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','getMembers','findOne','UserFaxQueue','order','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','SIP','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','userFaxQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','forEach','emit','addAgents','spread','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','status','end','json','count','limit','Content-Range','apply','reject','save','destroy','then','get','FaxQueues','UserProfileResource','sendStatus','error','stack','name','send','index','FaxQueue','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','rawAttributes','options'];(function(_0x1bd411,_0x2b2ca2){var _0x5dcc9f=function(_0x12d987){while(--_0x12d987){_0x1bd411['push'](_0x1bd411['shift']());}};_0x5dcc9f(++_0x2b2ca2);}(_0x75fb,0x162));var _0xb75f=function(_0x1f0ad7,_0x93ceb8){_0x1f0ad7=_0x1f0ad7-0x0;var _0x50a1ef=_0x75fb[_0x1f0ad7];return _0x50a1ef;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb75f('0x0'));var rimraf=require(_0xb75f('0x1'));var zipdir=require(_0xb75f('0x2'));var jsonpatch=require(_0xb75f('0x3'));var rp=require('request-promise');var moment=require(_0xb75f('0x4'));var BPromise=require(_0xb75f('0x5'));var Mustache=require(_0xb75f('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb75f('0x7'));var csv=require(_0xb75f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb75f('0x9'));var squel=require(_0xb75f('0xa'));var crypto=require(_0xb75f('0xb'));var jsforce=require(_0xb75f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb75f('0x8'));var querystring=require(_0xb75f('0xd'));var Papa=require(_0xb75f('0xe'));var Redis=require(_0xb75f('0xf'));var authService=require(_0xb75f('0x10'));var qs=require(_0xb75f('0x11'));var as=require(_0xb75f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb75f('0x13'))(_0xb75f('0x14'));var utils=require(_0xb75f('0x15'));var config=require(_0xb75f('0x16'));var licenseUtil=require(_0xb75f('0x17'));var db=require(_0xb75f('0x18'))['db'];config[_0xb75f('0x19')]=_[_0xb75f('0x1a')](config[_0xb75f('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb75f('0x1b'))(new Redis(config[_0xb75f('0x19')]));require(_0xb75f('0x1c'))[_0xb75f('0x1d')](socket);function respondWithStatusCode(_0x1e0ea1,_0x267f93){_0x267f93=_0x267f93||0xcc;return function(_0x45aa59){if(_0x45aa59){return _0x1e0ea1['sendStatus'](_0x267f93);}return _0x1e0ea1[_0xb75f('0x1e')](_0x267f93)[_0xb75f('0x1f')]();};}function respondWithResult(_0x4e255b,_0x193124){_0x193124=_0x193124||0xc8;return function(_0x4ba187){if(_0x4ba187){return _0x4e255b[_0xb75f('0x1e')](_0x193124)[_0xb75f('0x20')](_0x4ba187);}};}function respondWithFilteredResult(_0x2e2ad2,_0xf9c3e1){return function(_0x4d7cba){if(_0x4d7cba){var _0x509902=_0x4d7cba[_0xb75f('0x21')],_0x3f84cc=_0xf9c3e1['offset'],_0x299a48=_0xf9c3e1['offset']+_0xf9c3e1[_0xb75f('0x22')],_0x3420e7;if(_0x299a48>=_0x509902){_0x299a48=_0x509902;_0x3420e7=0xc8;}else{_0x3420e7=0xce;}_0x2e2ad2[_0xb75f('0x1e')](_0x3420e7);return _0x2e2ad2['set'](_0xb75f('0x23'),_0x3f84cc+'-'+_0x299a48+'/'+_0x509902)[_0xb75f('0x20')](_0x4d7cba);}return null;};}function patchUpdates(_0x15d79f){return function(_0x584e94){try{jsonpatch[_0xb75f('0x24')](_0x584e94,_0x15d79f,!![]);}catch(_0x17b077){return BPromise[_0xb75f('0x25')](_0x17b077);}return _0x584e94[_0xb75f('0x26')]();};}function saveUpdates(_0x1fb513,_0x20ce2f){return function(_0x5b4412){if(_0x5b4412){return _0x5b4412['update'](_0x1fb513)['then'](function(_0x99fa11){return _0x99fa11;});}return null;};}function removeEntity(_0x241880,_0x4e8f0a){return function(_0x5eda92){if(_0x5eda92){return _0x5eda92[_0xb75f('0x27')]()[_0xb75f('0x28')](function(){var _0x405fa1=_0x5eda92[_0xb75f('0x29')]({'plain':!![]});var _0x4dfea7=_0xb75f('0x2a');return db[_0xb75f('0x2b')][_0xb75f('0x27')]({'where':{'type':_0x4dfea7,'resourceId':_0x405fa1['id']}})[_0xb75f('0x28')](function(){return _0x5eda92;});})['then'](function(){_0x241880[_0xb75f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc85ac3,_0x560716){return function(_0x2c94d6){if(!_0x2c94d6){_0xc85ac3[_0xb75f('0x2c')](0x194);}return _0x2c94d6;};}function handleError(_0x31e19b,_0x182c3b){_0x182c3b=_0x182c3b||0x1f4;return function(_0xa03b0e){logger[_0xb75f('0x2d')](_0xa03b0e[_0xb75f('0x2e')]);if(_0xa03b0e[_0xb75f('0x2f')]){delete _0xa03b0e[_0xb75f('0x2f')];}_0x31e19b[_0xb75f('0x1e')](_0x182c3b)[_0xb75f('0x30')](_0xa03b0e);};}exports[_0xb75f('0x31')]=function(_0xf61c32,_0x2565f8){var _0x5171cd={},_0x59a882={},_0x48ba68={'count':0x0,'rows':[]};var _0x3282c9=_['map'](db[_0xb75f('0x32')]['rawAttributes'],function(_0x4bdbc6){return{'name':_0x4bdbc6['fieldName'],'type':_0x4bdbc6['type'][_0xb75f('0x33')]};});_0x59a882[_0xb75f('0x34')]=_[_0xb75f('0x35')](_0x3282c9,_0xb75f('0x2f'));_0x59a882[_0xb75f('0x36')]=_[_0xb75f('0x37')](_0xf61c32[_0xb75f('0x36')]);_0x59a882[_0xb75f('0x38')]=_[_0xb75f('0x39')](_0x59a882[_0xb75f('0x34')],_0x59a882[_0xb75f('0x36')]);_0x5171cd['attributes']=_[_0xb75f('0x39')](_0x59a882[_0xb75f('0x34')],qs[_0xb75f('0x3a')](_0xf61c32[_0xb75f('0x36')][_0xb75f('0x3a')]));_0x5171cd['attributes']=_0x5171cd[_0xb75f('0x3b')][_0xb75f('0x3c')]?_0x5171cd[_0xb75f('0x3b')]:_0x59a882[_0xb75f('0x34')];if(!_0xf61c32[_0xb75f('0x36')][_0xb75f('0x3d')](_0xb75f('0x3e'))){_0x5171cd['limit']=qs[_0xb75f('0x22')](_0xf61c32['query'][_0xb75f('0x22')]);_0x5171cd[_0xb75f('0x3f')]=qs['offset'](_0xf61c32[_0xb75f('0x36')][_0xb75f('0x3f')]);}_0x5171cd['order']=qs[_0xb75f('0x40')](_0xf61c32['query'][_0xb75f('0x40')]);_0x5171cd[_0xb75f('0x41')]=qs['filters'](_[_0xb75f('0x42')](_0xf61c32['query'],_0x59a882[_0xb75f('0x38')]),_0x3282c9);if(_0xf61c32[_0xb75f('0x36')][_0xb75f('0x43')]){_0x5171cd[_0xb75f('0x41')]=_[_0xb75f('0x44')](_0x5171cd[_0xb75f('0x41')],{'$or':_['map'](_0x3282c9,function(_0x3b90da){if(_0x3b90da[_0xb75f('0x45')]!=='VIRTUAL'){var _0x497240={};_0x497240[_0x3b90da[_0xb75f('0x2f')]]={'$like':'%'+_0xf61c32[_0xb75f('0x36')][_0xb75f('0x43')]+'%'};return _0x497240;}})});}_0x5171cd=_[_0xb75f('0x44')]({},_0x5171cd,_0xf61c32['options']);var _0x5f4f16={'where':_0x5171cd[_0xb75f('0x41')]};return db[_0xb75f('0x32')]['count'](_0x5f4f16)[_0xb75f('0x28')](function(_0x54b472){_0x48ba68[_0xb75f('0x21')]=_0x54b472;if(_0xf61c32[_0xb75f('0x36')][_0xb75f('0x46')]){_0x5171cd[_0xb75f('0x47')]=[{'all':!![]}];}return db[_0xb75f('0x32')][_0xb75f('0x48')](_0x5171cd);})[_0xb75f('0x28')](function(_0x31a401){_0x48ba68[_0xb75f('0x49')]=_0x31a401;return _0x48ba68;})[_0xb75f('0x28')](respondWithFilteredResult(_0x2565f8,_0x5171cd))[_0xb75f('0x4a')](handleError(_0x2565f8,null));};exports[_0xb75f('0x4b')]=function(_0x3e8d27,_0x288867){var _0x5f3e91={'raw':!![],'where':{'id':_0x3e8d27['params']['id']}},_0x4615fd={};_0x4615fd[_0xb75f('0x34')]=_[_0xb75f('0x37')](db[_0xb75f('0x32')][_0xb75f('0x4c')]);_0x4615fd[_0xb75f('0x36')]=_[_0xb75f('0x37')](_0x3e8d27[_0xb75f('0x36')]);_0x4615fd['filters']=_['intersection'](_0x4615fd['model'],_0x4615fd['query']);_0x5f3e91[_0xb75f('0x3b')]=_[_0xb75f('0x39')](_0x4615fd['model'],qs[_0xb75f('0x3a')](_0x3e8d27[_0xb75f('0x36')][_0xb75f('0x3a')]));_0x5f3e91[_0xb75f('0x3b')]=_0x5f3e91[_0xb75f('0x3b')][_0xb75f('0x3c')]?_0x5f3e91[_0xb75f('0x3b')]:_0x4615fd[_0xb75f('0x34')];if(_0x3e8d27[_0xb75f('0x36')][_0xb75f('0x46')]){_0x5f3e91[_0xb75f('0x47')]=[{'all':!![]}];}_0x5f3e91=_['merge']({},_0x5f3e91,_0x3e8d27[_0xb75f('0x4d')]);return db[_0xb75f('0x32')][_0xb75f('0x4e')](_0x5f3e91)[_0xb75f('0x28')](handleEntityNotFound(_0x288867,null))['then'](respondWithResult(_0x288867,null))[_0xb75f('0x4a')](handleError(_0x288867,null));};exports['create']=function(_0x1e9b6c,_0x7b9907){return db[_0xb75f('0x32')]['create'](_0x1e9b6c['body'],{})[_0xb75f('0x28')](function(_0x25aba7){var _0x2a66f1=_0x1e9b6c[_0xb75f('0x4f')][_0xb75f('0x29')]({'plain':!![]});if(!_0x2a66f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a66f1['role']===_0xb75f('0x4f')){var _0x391cce=_0x25aba7[_0xb75f('0x29')]({'plain':!![]});var _0x4bae9d=_0xb75f('0x2a');return db['UserProfileSection'][_0xb75f('0x4e')]({'where':{'name':_0x4bae9d,'userProfileId':_0x2a66f1[_0xb75f('0x50')]},'raw':!![]})[_0xb75f('0x28')](function(_0x1e7cbf){if(_0x1e7cbf&&_0x1e7cbf[_0xb75f('0x51')]===0x0){return db[_0xb75f('0x2b')][_0xb75f('0x52')]({'name':_0x391cce[_0xb75f('0x2f')],'resourceId':_0x391cce['id'],'type':_0x1e7cbf[_0xb75f('0x2f')],'sectionId':_0x1e7cbf['id']},{})['then'](function(){return _0x25aba7;});}else{return _0x25aba7;}})[_0xb75f('0x4a')](function(_0x19aba3){logger[_0xb75f('0x2d')](_0xb75f('0x53'),_0x19aba3);throw _0x19aba3;});}return _0x25aba7;})[_0xb75f('0x28')](respondWithResult(_0x7b9907,0xc9))[_0xb75f('0x4a')](handleError(_0x7b9907,null));};exports[_0xb75f('0x54')]=function(_0x2ce823,_0x31eb8a){if(_0x2ce823['body']['id']){delete _0x2ce823[_0xb75f('0x55')]['id'];}return db[_0xb75f('0x32')][_0xb75f('0x4e')]({'where':{'id':_0x2ce823[_0xb75f('0x56')]['id']}})[_0xb75f('0x28')](handleEntityNotFound(_0x31eb8a,null))[_0xb75f('0x28')](saveUpdates(_0x2ce823['body'],null))[_0xb75f('0x28')](respondWithResult(_0x31eb8a,null))['catch'](handleError(_0x31eb8a,null));};exports[_0xb75f('0x27')]=function(_0x39bdc1,_0x44d59e){return db[_0xb75f('0x32')][_0xb75f('0x4e')]({'where':{'id':_0x39bdc1['params']['id']}})[_0xb75f('0x28')](handleEntityNotFound(_0x44d59e,null))['then'](removeEntity(_0x44d59e,null))['catch'](handleError(_0x44d59e,null));};exports[_0xb75f('0x57')]=function(_0x19d4c5,_0x4138fa){return db['FaxQueue'][_0xb75f('0x57')]()[_0xb75f('0x28')](respondWithResult(_0x4138fa,null))['catch'](handleError(_0x4138fa,null));};exports[_0xb75f('0x58')]=function(_0x5cf577,_0x4982ee,_0x2330b4){var _0x1ea06c={'raw':!![],'where':{}},_0x38ef02={},_0x11d019;return db[_0xb75f('0x32')][_0xb75f('0x59')]({'where':{'id':_0x5cf577[_0xb75f('0x56')]['id']}})[_0xb75f('0x28')](handleEntityNotFound(_0x4982ee,null))[_0xb75f('0x28')](function(_0x5a7185){if(_0x5a7185){_0x11d019=_0x5a7185[_0xb75f('0x29')]({'plain':!![]});_0x38ef02[_0xb75f('0x34')]=_[_0xb75f('0x37')](db[_0xb75f('0x5a')][_0xb75f('0x4c')]);_0x38ef02[_0xb75f('0x36')]=_[_0xb75f('0x37')](_0x5cf577[_0xb75f('0x36')]);_0x38ef02[_0xb75f('0x38')]=_[_0xb75f('0x39')](_0x38ef02['model'],_0x38ef02['query']);_0x1ea06c[_0xb75f('0x3b')]=_['intersection'](_0x38ef02[_0xb75f('0x34')],qs[_0xb75f('0x3a')](_0x5cf577['query'][_0xb75f('0x3a')]));_0x1ea06c[_0xb75f('0x3b')]=_0x1ea06c[_0xb75f('0x3b')][_0xb75f('0x3c')]?_0x1ea06c[_0xb75f('0x3b')]:_0x38ef02[_0xb75f('0x34')];if(!_0x5cf577[_0xb75f('0x36')]['hasOwnProperty']('nolimit')){_0x1ea06c[_0xb75f('0x22')]=qs[_0xb75f('0x22')](_0x5cf577[_0xb75f('0x36')]['limit']);_0x1ea06c[_0xb75f('0x3f')]=qs[_0xb75f('0x3f')](_0x5cf577[_0xb75f('0x36')][_0xb75f('0x3f')]);}_0x1ea06c[_0xb75f('0x5b')]=qs[_0xb75f('0x40')](_0x5cf577[_0xb75f('0x36')][_0xb75f('0x40')]);_0x1ea06c['where']=qs['filters'](_[_0xb75f('0x42')](_0x5cf577[_0xb75f('0x36')],_0x38ef02[_0xb75f('0x38')]));_0x1ea06c[_0xb75f('0x41')][_0xb75f('0x5c')]=_0x5a7185['id'];if(_0x5cf577['query'][_0xb75f('0x43')]){_0x1ea06c[_0xb75f('0x41')]=_['merge'](_0x1ea06c['where'],{'$or':_['map'](_0x1ea06c[_0xb75f('0x3b')],function(_0x23843e){var _0x9f8d4d={};_0x9f8d4d[_0x23843e]={'$like':'%'+_0x5cf577['query'][_0xb75f('0x43')]+'%'};return _0x9f8d4d;})});}_0x1ea06c=_[_0xb75f('0x44')]({},_0x1ea06c,_0x5cf577[_0xb75f('0x4d')]);return db[_0xb75f('0x5a')][_0xb75f('0x48')](_0x1ea06c);}})[_0xb75f('0x28')](function(_0x29da7e){if(_0x29da7e){return db[_0xb75f('0x5d')][_0xb75f('0x5e')]({'where':{'id':_[_0xb75f('0x35')](_0x29da7e,_0xb75f('0x5f')),'role':_0xb75f('0x60')},'attributes':['id',_0xb75f('0x2f'),_0xb75f('0x61'),_0xb75f('0x62'),_0xb75f('0x63')]});}})[_0xb75f('0x28')](function(_0xef327b){if(_0xef327b){return{'count':_0xef327b[_0xb75f('0x21')],'rows':_['map'](_0xef327b[_0xb75f('0x49')],function(_0x81f4fc){return{'membername':_0x81f4fc['name'],'UserId':_0x81f4fc['id'],'queue_name':_0x11d019[_0xb75f('0x2f')],'FaxQueueId':_0x11d019['id'],'interface':util['format']('%s/%s',_0xb75f('0x64'),_0x81f4fc[_0xb75f('0x2f')]),'penalty':0x0,'paused':_0x81f4fc[_0xb75f('0x61')],'createdAt':_0x81f4fc[_0xb75f('0x63')],'updatedAt':_0x81f4fc[_0xb75f('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb75f('0x28')](respondWithFilteredResult(_0x4982ee,_0x1ea06c))['catch'](handleError(_0x4982ee,null));};exports[_0xb75f('0x65')]=function(_0x315ddf,_0x322535,_0x4453ea){var _0x5803d1={};var _0x329057={};var _0x16f1ad;var _0x585cd9;return db[_0xb75f('0x32')][_0xb75f('0x59')]({'where':{'id':_0x315ddf[_0xb75f('0x56')]['id']}})[_0xb75f('0x28')](handleEntityNotFound(_0x322535,null))[_0xb75f('0x28')](function(_0x4cbade){if(_0x4cbade){_0x16f1ad=_0x4cbade;_0x329057[_0xb75f('0x34')]=_[_0xb75f('0x37')](db[_0xb75f('0x66')]['rawAttributes']);_0x329057['query']=_[_0xb75f('0x37')](_0x315ddf[_0xb75f('0x36')]);_0x329057[_0xb75f('0x38')]=_[_0xb75f('0x39')](_0x329057[_0xb75f('0x34')],_0x329057['query']);_0x5803d1[_0xb75f('0x3b')]=_['intersection'](_0x329057[_0xb75f('0x34')],qs['fields'](_0x315ddf['query']['fields']));_0x5803d1[_0xb75f('0x3b')]=_0x5803d1[_0xb75f('0x3b')]['length']?_0x5803d1[_0xb75f('0x3b')]:_0x329057[_0xb75f('0x34')];_0x5803d1['order']=qs[_0xb75f('0x40')](_0x315ddf[_0xb75f('0x36')][_0xb75f('0x40')]);_0x5803d1[_0xb75f('0x41')]=qs[_0xb75f('0x38')](_['pick'](_0x315ddf['query'],_0x329057[_0xb75f('0x38')]));if(_0x315ddf[_0xb75f('0x36')]['filter']){_0x5803d1[_0xb75f('0x41')]=_[_0xb75f('0x44')](_0x5803d1[_0xb75f('0x41')],{'$or':_[_0xb75f('0x35')](_0x5803d1[_0xb75f('0x3b')],function(_0x39b66b){var _0x3226fb={};_0x3226fb[_0x39b66b]={'$like':'%'+_0x315ddf['query'][_0xb75f('0x43')]+'%'};return _0x3226fb;})});}_0x5803d1=_[_0xb75f('0x44')]({},_0x5803d1,_0x315ddf[_0xb75f('0x4d')]);return _0x16f1ad[_0xb75f('0x65')](_0x5803d1);}})[_0xb75f('0x28')](function(_0x140f6e){if(_0x140f6e){_0x585cd9=_0x140f6e[_0xb75f('0x3c')];if(!_0x315ddf['query'][_0xb75f('0x3d')]('nolimit')){_0x5803d1[_0xb75f('0x22')]=qs[_0xb75f('0x22')](_0x315ddf['query'][_0xb75f('0x22')]);_0x5803d1[_0xb75f('0x3f')]=qs['offset'](_0x315ddf[_0xb75f('0x36')]['offset']);}return _0x16f1ad[_0xb75f('0x65')](_0x5803d1);}})['then'](function(_0x500606){if(_0x500606){return _0x500606?{'count':_0x585cd9,'rows':_0x500606}:null;}})[_0xb75f('0x28')](respondWithResult(_0x322535,null))[_0xb75f('0x4a')](handleError(_0x322535,null));};exports['addTeams']=function(_0x49bd25,_0x229588,_0x1d1482){var _0x8642b=_0x49bd25[_0xb75f('0x55')]['ids'];return db[_0xb75f('0x66')][_0xb75f('0x48')]({'where':{'id':_0x8642b},'attributes':['id'],'include':[{'model':db[_0xb75f('0x5d')],'as':_0xb75f('0x67'),'attributes':['id',_0xb75f('0x2f'),_0xb75f('0x68'),_0xb75f('0x69'),_0xb75f('0x6a')],'raw':!![]}]})[_0xb75f('0x28')](function(_0x82d5d){if(_0x82d5d){var _0x37a9db=_[_0xb75f('0x6b')](_0x82d5d,function(_0x4ada70){var _0x40d728=_0x4ada70[_0xb75f('0x29')]({'plain':!![]});return _0x40d728['Agents'];});return db[_0xb75f('0x32')]['find']({'where':{'id':_0x49bd25[_0xb75f('0x56')]['id']}})[_0xb75f('0x28')](function(_0x501da8){return db[_0xb75f('0x6c')][_0xb75f('0x6d')](function(_0x34a0e0){return _0x501da8[_0xb75f('0x6e')](_0x8642b,{'transaction':_0x34a0e0})[_0xb75f('0x28')](function(){return BPromise['each'](_0x37a9db,function(_0xc2b3e9){return db[_0xb75f('0x5a')][_0xb75f('0x6f')]({'where':{'UserId':_0xc2b3e9['id'],'FaxQueueId':_0x49bd25[_0xb75f('0x56')]['id']},'transaction':_0x34a0e0});});})[_0xb75f('0x28')](function(){_0x37a9db['forEach'](function(_0x31ef62){socket['emit'](_0xb75f('0x70'),{'UserId':_0x31ef62['id'],'FaxQueueId':_0x501da8['id']});});});});});}})['then'](respondWithStatusCode(_0x229588,null))['catch'](handleError(_0x229588,null));};exports[_0xb75f('0x71')]=function(_0x3a0e97,_0x254f6d,_0x50ed45){return db[_0xb75f('0x66')]['findAll']({'where':{'id':_0x3a0e97[_0xb75f('0x36')][_0xb75f('0x72')]},'attributes':['id'],'include':[{'model':db[_0xb75f('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x254f6d,null))[_0xb75f('0x28')](function(_0x96fa3d){var _0x4aa428=_[_0xb75f('0x35')](_0x96fa3d,'id');var _0xec5b6d=[];var _0x35d2df=[];var _0x257998=squel[_0xb75f('0x73')]();_0x257998['field'](_0xb75f('0x74'))[_0xb75f('0x75')](_0xb75f('0x76'),'tq')[_0xb75f('0x77')](_0xb75f('0x78'),'ut',_0xb75f('0x79'))['where'](_0xb75f('0x7a'),_0x3a0e97['params']['id']);for(var _0x2ca3e5=0x0;_0x2ca3e5<_0x96fa3d[_0xb75f('0x3c')];_0x2ca3e5+=0x1){let _0x45ae68=_0x96fa3d[_0x2ca3e5];for(var _0x2cce55=0x0;_0x2cce55<_0x45ae68[_0xb75f('0x67')][_0xb75f('0x3c')];_0x2cce55+=0x1){let _0x81e439=_0x45ae68[_0xb75f('0x67')][_0x2cce55];var _0x2799c7=_0x257998[_0xb75f('0x7b')]();_0x2799c7[_0xb75f('0x41')](_0xb75f('0x7c'),_0x81e439['id']);_0x35d2df[_0xb75f('0x7d')](db[_0xb75f('0x6c')]['query'](_0x2799c7[_0xb75f('0x7e')](),{'type':db['sequelize'][_0xb75f('0x7f')][_0xb75f('0x80')]})[_0xb75f('0x28')](function(_0x4b1d04){if(_0x4b1d04['length']===0x1){return _0x81e439['id'];}else{var _0x5179b2=_[_0xb75f('0x81')](_['map'](_0x4b1d04,_0xb75f('0x82')),function(_0x4a1689){return _[_0xb75f('0x83')](_0x4aa428,_0x4a1689);});if(_0x5179b2){return _0x81e439['id'];}}}));}}return BPromise[_0xb75f('0x84')](_0x35d2df)[_0xb75f('0x28')](function(_0x50de8b){_0xec5b6d=_(_0xec5b6d)[_0xb75f('0x85')](_0x50de8b)[_0xb75f('0x86')]()[_0xb75f('0x87')]();return db[_0xb75f('0x32')]['find']({'where':{'id':_0x3a0e97[_0xb75f('0x56')]['id']}})[_0xb75f('0x28')](function(_0x43cae3){return db[_0xb75f('0x6c')][_0xb75f('0x6d')](function(_0x3acddf){return _0x43cae3[_0xb75f('0x71')](_0x3a0e97[_0xb75f('0x36')][_0xb75f('0x72')],{'transaction':_0x3acddf})[_0xb75f('0x28')](function(){if(!_['isEmpty'](_0xec5b6d)){return _0x43cae3[_0xb75f('0x88')](_0xec5b6d,{'transaction':_0x3acddf});}})[_0xb75f('0x28')](function(){_0xec5b6d[_0xb75f('0x89')](function(_0x4706d8){socket[_0xb75f('0x8a')]('userFaxQueue:remove',{'UserId':_0x4706d8,'FaxQueueId':_0x43cae3['id']});});});});});});})[_0xb75f('0x28')](respondWithStatusCode(_0x254f6d,null))[_0xb75f('0x4a')](handleError(_0x254f6d,null));};exports['addAgents']=function(_0x112d1d,_0x329ec3,_0x5480ce){return db[_0xb75f('0x32')][_0xb75f('0x4e')]({'where':{'id':_0x112d1d[_0xb75f('0x56')]['id']}})[_0xb75f('0x28')](handleEntityNotFound(_0x329ec3,null))[_0xb75f('0x28')](function(_0x578203){if(_0x578203){return _0x578203[_0xb75f('0x8b')](_0x112d1d[_0xb75f('0x55')][_0xb75f('0x72')],_['omit'](_0x112d1d[_0xb75f('0x55')],['ids','id'])||{})[_0xb75f('0x8c')](function(_0x927449){for(var _0x22cdda=0x0;_0x22cdda<_0x112d1d[_0xb75f('0x55')][_0xb75f('0x72')][_0xb75f('0x3c')];_0x22cdda+=0x1){socket[_0xb75f('0x8a')]('userFaxQueue:save',{'UserId':_0x112d1d[_0xb75f('0x55')]['ids'][_0x22cdda],'FaxQueueId':_0x112d1d[_0xb75f('0x56')]['id']});}return _0x927449;});}})[_0xb75f('0x28')](respondWithResult(_0x329ec3,null))[_0xb75f('0x4a')](handleError(_0x329ec3,null));};exports['removeAgents']=function(_0x5a6189,_0x3746b8,_0x2078f2){return db['FaxQueue']['find']({'where':{'id':_0x5a6189[_0xb75f('0x56')]['id']}})['then'](handleEntityNotFound(_0x3746b8,null))['then'](function(_0x3f6528){if(_0x3f6528){return _0x3f6528[_0xb75f('0x88')](_0x5a6189['query'][_0xb75f('0x72')])['then'](function(){if(_[_0xb75f('0x8d')](_0x5a6189['query'][_0xb75f('0x72')])){for(var _0x1ca91b=0x0;_0x1ca91b<_0x5a6189[_0xb75f('0x36')][_0xb75f('0x72')][_0xb75f('0x3c')];_0x1ca91b+=0x1){socket[_0xb75f('0x8a')](_0xb75f('0x8e'),{'UserId':Number(_0x5a6189[_0xb75f('0x36')][_0xb75f('0x72')][_0x1ca91b]),'FaxQueueId':Number(_0x5a6189[_0xb75f('0x56')]['id'])});}}else{socket['emit'](_0xb75f('0x8e'),{'UserId':Number(_0x5a6189[_0xb75f('0x36')][_0xb75f('0x72')]),'FaxQueueId':Number(_0x5a6189[_0xb75f('0x56')]['id'])});}});}})[_0xb75f('0x28')](respondWithStatusCode(_0x3746b8,null))[_0xb75f('0x4a')](handleError(_0x3746b8,null));};exports[_0xb75f('0x8f')]=function(_0x130030,_0x2e356d,_0x1ef094){var _0x4ed25e={};var _0xb3707={};var _0x361988;var _0x220649;return db[_0xb75f('0x32')][_0xb75f('0x59')]({'where':{'id':_0x130030[_0xb75f('0x56')]['id']}})[_0xb75f('0x28')](handleEntityNotFound(_0x2e356d,null))['then'](function(_0x48d672){if(_0x48d672){_0x361988=_0x48d672;_0xb3707[_0xb75f('0x34')]=_[_0xb75f('0x37')](db[_0xb75f('0x5d')][_0xb75f('0x4c')]);_0xb3707[_0xb75f('0x36')]=_[_0xb75f('0x37')](_0x130030[_0xb75f('0x36')]);_0xb3707[_0xb75f('0x38')]=_['intersection'](_0xb3707[_0xb75f('0x34')],_0xb3707['query']);_0x4ed25e['attributes']=_['intersection'](_0xb3707['model'],qs[_0xb75f('0x3a')](_0x130030['query'][_0xb75f('0x3a')]));_0x4ed25e[_0xb75f('0x3b')]=_0x4ed25e[_0xb75f('0x3b')]['length']?_0x4ed25e[_0xb75f('0x3b')]:_0xb3707['model'];_0x4ed25e[_0xb75f('0x5b')]=qs[_0xb75f('0x40')](_0x130030[_0xb75f('0x36')]['sort']);_0x4ed25e[_0xb75f('0x41')]=qs[_0xb75f('0x38')](_[_0xb75f('0x42')](_0x130030[_0xb75f('0x36')],_0xb3707[_0xb75f('0x38')]));if(_0x130030['query']['filter']){_0x4ed25e['where']=_['merge'](_0x4ed25e[_0xb75f('0x41')],{'$or':_[_0xb75f('0x35')](_0x4ed25e[_0xb75f('0x3b')],function(_0x26269e){var _0x45cc4f={};_0x45cc4f[_0x26269e]={'$like':'%'+_0x130030['query'][_0xb75f('0x43')]+'%'};return _0x45cc4f;})});}_0x4ed25e=_[_0xb75f('0x44')]({},_0x4ed25e,_0x130030['options']);return _0x361988[_0xb75f('0x8f')](_0x4ed25e);}})[_0xb75f('0x28')](function(_0x24b35e){if(_0x24b35e){_0x220649=_0x24b35e[_0xb75f('0x3c')];if(!_0x130030['query'][_0xb75f('0x3d')](_0xb75f('0x3e'))){_0x4ed25e['limit']=qs[_0xb75f('0x22')](_0x130030[_0xb75f('0x36')][_0xb75f('0x22')]);_0x4ed25e[_0xb75f('0x3f')]=qs[_0xb75f('0x3f')](_0x130030['query'][_0xb75f('0x3f')]);}return _0x361988[_0xb75f('0x8f')](_0x4ed25e);}})[_0xb75f('0x28')](function(_0x5b9555){if(_0x5b9555){return _0x5b9555?{'count':_0x220649,'rows':_0x5b9555}:null;}})[_0xb75f('0x28')](respondWithResult(_0x2e356d,null))[_0xb75f('0x4a')](handleError(_0x2e356d,null));}; \ No newline at end of file +var _0x24a6=['updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','Team','addTeams','ids','User','Agents','online','interface','sequelize','transaction','forEach','emit','userFaxQueue:save','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','localhost','redis','./faxQueue.socket','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','FaxQueues','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FaxQueue','findAll','rows','catch','show','includeAll','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','params','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','findAndCountAll','UserId','agent'];(function(_0x72e95f,_0x5c3838){var _0x137443=function(_0x37df2a){while(--_0x37df2a){_0x72e95f['push'](_0x72e95f['shift']());}};_0x137443(++_0x5c3838);}(_0x24a6,0x14f));var _0x624a=function(_0x4f120a,_0xe64a9b){_0x4f120a=_0x4f120a-0x0;var _0x2d11fb=_0x24a6[_0x4f120a];return _0x2d11fb;};'use strict';var pdf=require(_0x624a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x624a('0x1'));var zipdir=require(_0x624a('0x2'));var jsonpatch=require(_0x624a('0x3'));var rp=require(_0x624a('0x4'));var moment=require(_0x624a('0x5'));var BPromise=require(_0x624a('0x6'));var Mustache=require(_0x624a('0x7'));var util=require(_0x624a('0x8'));var path=require(_0x624a('0x9'));var sox=require(_0x624a('0xa'));var csv=require(_0x624a('0xb'));var ejs=require(_0x624a('0xc'));var fs=require('fs');var _=require(_0x624a('0xd'));var squel=require(_0x624a('0xe'));var crypto=require(_0x624a('0xf'));var jsforce=require(_0x624a('0x10'));var deskjs=require(_0x624a('0x11'));var toCsv=require(_0x624a('0xb'));var querystring=require(_0x624a('0x12'));var Papa=require(_0x624a('0x13'));var Redis=require(_0x624a('0x14'));var authService=require(_0x624a('0x15'));var qs=require(_0x624a('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x624a('0x17'))(_0x624a('0x18'));var utils=require(_0x624a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x624a('0x1a'));var db=require(_0x624a('0x1b'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x624a('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x624a('0x1d')]));require(_0x624a('0x1e'))[_0x624a('0x1f')](socket);function respondWithStatusCode(_0x1e6ffd,_0x547e4f){_0x547e4f=_0x547e4f||0xcc;return function(_0x300cec){if(_0x300cec){return _0x1e6ffd['sendStatus'](_0x547e4f);}return _0x1e6ffd[_0x624a('0x20')](_0x547e4f)[_0x624a('0x21')]();};}function respondWithResult(_0x53005e,_0x201751){_0x201751=_0x201751||0xc8;return function(_0x6f690c){if(_0x6f690c){return _0x53005e[_0x624a('0x20')](_0x201751)[_0x624a('0x22')](_0x6f690c);}};}function respondWithFilteredResult(_0xce9cd5,_0x158b72){return function(_0x364867){if(_0x364867){var _0x32d6a0=_0x364867[_0x624a('0x23')],_0x35342c=_0x158b72['offset'],_0x4721ac=_0x158b72[_0x624a('0x24')]+_0x158b72['limit'],_0x52356a;if(_0x4721ac>=_0x32d6a0){_0x4721ac=_0x32d6a0;_0x52356a=0xc8;}else{_0x52356a=0xce;}_0xce9cd5[_0x624a('0x20')](_0x52356a);return _0xce9cd5[_0x624a('0x25')](_0x624a('0x26'),_0x35342c+'-'+_0x4721ac+'/'+_0x32d6a0)[_0x624a('0x22')](_0x364867);}return null;};}function patchUpdates(_0x1c6f64){return function(_0x54e669){try{jsonpatch[_0x624a('0x27')](_0x54e669,_0x1c6f64,!![]);}catch(_0xc2e637){return BPromise[_0x624a('0x28')](_0xc2e637);}return _0x54e669[_0x624a('0x29')]();};}function saveUpdates(_0x5dfeec,_0x1a673b){return function(_0x1357e8){if(_0x1357e8){return _0x1357e8[_0x624a('0x2a')](_0x5dfeec)['then'](function(_0x4aee03){return _0x4aee03;});}return null;};}function removeEntity(_0x56834b,_0x29257b){return function(_0x4493bb){if(_0x4493bb){return _0x4493bb[_0x624a('0x2b')]()[_0x624a('0x2c')](function(){var _0x51a817=_0x4493bb['get']({'plain':!![]});var _0x2234dc=_0x624a('0x2d');return db['UserProfileResource'][_0x624a('0x2b')]({'where':{'type':_0x2234dc,'resourceId':_0x51a817['id']}})[_0x624a('0x2c')](function(){return _0x4493bb;});})['then'](function(){_0x56834b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41993c,_0x86e555){return function(_0x49ae13){if(!_0x49ae13){_0x41993c['sendStatus'](0x194);}return _0x49ae13;};}function handleError(_0x59917f,_0x422c20){_0x422c20=_0x422c20||0x1f4;return function(_0x35c8d0){logger[_0x624a('0x2e')](_0x35c8d0['stack']);if(_0x35c8d0[_0x624a('0x2f')]){delete _0x35c8d0[_0x624a('0x2f')];}_0x59917f['status'](_0x422c20)[_0x624a('0x30')](_0x35c8d0);};}exports['index']=function(_0x209ca5,_0x1e775b){var _0x22140a={},_0x4619a8={},_0x47c6f5={'count':0x0,'rows':[]};var _0x28b434=_[_0x624a('0x31')](db['FaxQueue'][_0x624a('0x32')],function(_0x11dcf4){return{'name':_0x11dcf4[_0x624a('0x33')],'type':_0x11dcf4[_0x624a('0x34')][_0x624a('0x35')]};});_0x4619a8[_0x624a('0x36')]=_['map'](_0x28b434,'name');_0x4619a8[_0x624a('0x37')]=_[_0x624a('0x38')](_0x209ca5[_0x624a('0x37')]);_0x4619a8['filters']=_[_0x624a('0x39')](_0x4619a8['model'],_0x4619a8['query']);_0x22140a['attributes']=_[_0x624a('0x39')](_0x4619a8['model'],qs[_0x624a('0x3a')](_0x209ca5['query'][_0x624a('0x3a')]));_0x22140a['attributes']=_0x22140a['attributes'][_0x624a('0x3b')]?_0x22140a[_0x624a('0x3c')]:_0x4619a8[_0x624a('0x36')];if(!_0x209ca5[_0x624a('0x37')][_0x624a('0x3d')](_0x624a('0x3e'))){_0x22140a[_0x624a('0x3f')]=qs[_0x624a('0x3f')](_0x209ca5[_0x624a('0x37')][_0x624a('0x3f')]);_0x22140a['offset']=qs[_0x624a('0x24')](_0x209ca5[_0x624a('0x37')][_0x624a('0x24')]);}_0x22140a[_0x624a('0x40')]=qs[_0x624a('0x41')](_0x209ca5['query'][_0x624a('0x41')]);_0x22140a[_0x624a('0x42')]=qs[_0x624a('0x43')](_[_0x624a('0x44')](_0x209ca5[_0x624a('0x37')],_0x4619a8[_0x624a('0x43')]),_0x28b434);if(_0x209ca5['query'][_0x624a('0x45')]){_0x22140a[_0x624a('0x42')]=_[_0x624a('0x46')](_0x22140a['where'],{'$or':_[_0x624a('0x31')](_0x28b434,function(_0x561c1e){if(_0x561c1e['type']!==_0x624a('0x47')){var _0x368e63={};_0x368e63[_0x561c1e[_0x624a('0x2f')]]={'$like':'%'+_0x209ca5['query']['filter']+'%'};return _0x368e63;}})});}_0x22140a=_[_0x624a('0x46')]({},_0x22140a,_0x209ca5[_0x624a('0x48')]);var _0x515a07={'where':_0x22140a[_0x624a('0x42')]};return db[_0x624a('0x49')]['count'](_0x515a07)[_0x624a('0x2c')](function(_0x1527b7){_0x47c6f5[_0x624a('0x23')]=_0x1527b7;if(_0x209ca5[_0x624a('0x37')]['includeAll']){_0x22140a['include']=[{'all':!![]}];}return db['FaxQueue'][_0x624a('0x4a')](_0x22140a);})[_0x624a('0x2c')](function(_0x35520c){_0x47c6f5[_0x624a('0x4b')]=_0x35520c;return _0x47c6f5;})[_0x624a('0x2c')](respondWithFilteredResult(_0x1e775b,_0x22140a))[_0x624a('0x4c')](handleError(_0x1e775b,null));};exports[_0x624a('0x4d')]=function(_0x5f28aa,_0x2193fb){var _0x464359={'raw':!![],'where':{'id':_0x5f28aa['params']['id']}},_0x5d5565={};_0x5d5565[_0x624a('0x36')]=_['keys'](db[_0x624a('0x49')][_0x624a('0x32')]);_0x5d5565[_0x624a('0x37')]=_['keys'](_0x5f28aa[_0x624a('0x37')]);_0x5d5565[_0x624a('0x43')]=_[_0x624a('0x39')](_0x5d5565[_0x624a('0x36')],_0x5d5565[_0x624a('0x37')]);_0x464359['attributes']=_[_0x624a('0x39')](_0x5d5565[_0x624a('0x36')],qs[_0x624a('0x3a')](_0x5f28aa['query'][_0x624a('0x3a')]));_0x464359[_0x624a('0x3c')]=_0x464359[_0x624a('0x3c')][_0x624a('0x3b')]?_0x464359[_0x624a('0x3c')]:_0x5d5565[_0x624a('0x36')];if(_0x5f28aa['query'][_0x624a('0x4e')]){_0x464359['include']=[{'all':!![]}];}_0x464359=_['merge']({},_0x464359,_0x5f28aa['options']);return db[_0x624a('0x49')][_0x624a('0x4f')](_0x464359)[_0x624a('0x2c')](handleEntityNotFound(_0x2193fb,null))[_0x624a('0x2c')](respondWithResult(_0x2193fb,null))['catch'](handleError(_0x2193fb,null));};exports[_0x624a('0x50')]=function(_0x4283ff,_0x6528a0){return db['FaxQueue']['create'](_0x4283ff[_0x624a('0x51')],{})[_0x624a('0x2c')](function(_0x149697){var _0x39fbd8=_0x4283ff[_0x624a('0x52')][_0x624a('0x53')]({'plain':!![]});if(!_0x39fbd8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39fbd8[_0x624a('0x54')]===_0x624a('0x52')){var _0x4ca80b=_0x149697[_0x624a('0x53')]({'plain':!![]});var _0x447eb2=_0x624a('0x2d');return db[_0x624a('0x55')][_0x624a('0x4f')]({'where':{'name':_0x447eb2,'userProfileId':_0x39fbd8[_0x624a('0x56')]},'raw':!![]})['then'](function(_0x8cb341){if(_0x8cb341&&_0x8cb341[_0x624a('0x57')]===0x0){return db['UserProfileResource'][_0x624a('0x50')]({'name':_0x4ca80b[_0x624a('0x2f')],'resourceId':_0x4ca80b['id'],'type':_0x8cb341[_0x624a('0x2f')],'sectionId':_0x8cb341['id']},{})['then'](function(){return _0x149697;});}else{return _0x149697;}})[_0x624a('0x4c')](function(_0x3dbc64){logger[_0x624a('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbc64);throw _0x3dbc64;});}return _0x149697;})['then'](respondWithResult(_0x6528a0,0xc9))['catch'](handleError(_0x6528a0,null));};exports[_0x624a('0x2a')]=function(_0x36ebf0,_0x208a9d){if(_0x36ebf0[_0x624a('0x51')]['id']){delete _0x36ebf0[_0x624a('0x51')]['id'];}return db['FaxQueue'][_0x624a('0x4f')]({'where':{'id':_0x36ebf0[_0x624a('0x58')]['id']}})[_0x624a('0x2c')](handleEntityNotFound(_0x208a9d,null))[_0x624a('0x2c')](saveUpdates(_0x36ebf0['body'],null))['then'](respondWithResult(_0x208a9d,null))[_0x624a('0x4c')](handleError(_0x208a9d,null));};exports[_0x624a('0x2b')]=function(_0x507e14,_0x524874){return db[_0x624a('0x49')][_0x624a('0x4f')]({'where':{'id':_0x507e14[_0x624a('0x58')]['id']}})['then'](handleEntityNotFound(_0x524874,null))['then'](removeEntity(_0x524874,null))[_0x624a('0x4c')](handleError(_0x524874,null));};exports['describe']=function(_0x386486,_0x367fc9){return db[_0x624a('0x49')][_0x624a('0x59')]()['then'](respondWithResult(_0x367fc9,null))[_0x624a('0x4c')](handleError(_0x367fc9,null));};exports[_0x624a('0x5a')]=function(_0x2e65fd,_0x6a2d37,_0x1908f0){var _0x54ff9a={'raw':!![],'where':{}},_0x466df6={},_0x23cf77;return db[_0x624a('0x49')][_0x624a('0x5b')]({'where':{'id':_0x2e65fd[_0x624a('0x58')]['id']}})['then'](handleEntityNotFound(_0x6a2d37,null))[_0x624a('0x2c')](function(_0x490632){if(_0x490632){_0x23cf77=_0x490632[_0x624a('0x53')]({'plain':!![]});_0x466df6[_0x624a('0x36')]=_[_0x624a('0x38')](db[_0x624a('0x5c')][_0x624a('0x32')]);_0x466df6[_0x624a('0x37')]=_[_0x624a('0x38')](_0x2e65fd[_0x624a('0x37')]);_0x466df6[_0x624a('0x43')]=_['intersection'](_0x466df6[_0x624a('0x36')],_0x466df6[_0x624a('0x37')]);_0x54ff9a[_0x624a('0x3c')]=_[_0x624a('0x39')](_0x466df6[_0x624a('0x36')],qs['fields'](_0x2e65fd['query']['fields']));_0x54ff9a[_0x624a('0x3c')]=_0x54ff9a['attributes'][_0x624a('0x3b')]?_0x54ff9a['attributes']:_0x466df6['model'];if(!_0x2e65fd[_0x624a('0x37')][_0x624a('0x3d')](_0x624a('0x3e'))){_0x54ff9a['limit']=qs[_0x624a('0x3f')](_0x2e65fd[_0x624a('0x37')]['limit']);_0x54ff9a['offset']=qs[_0x624a('0x24')](_0x2e65fd[_0x624a('0x37')][_0x624a('0x24')]);}_0x54ff9a[_0x624a('0x40')]=qs['sort'](_0x2e65fd[_0x624a('0x37')][_0x624a('0x41')]);_0x54ff9a[_0x624a('0x42')]=qs['filters'](_[_0x624a('0x44')](_0x2e65fd[_0x624a('0x37')],_0x466df6[_0x624a('0x43')]));_0x54ff9a[_0x624a('0x42')][_0x624a('0x5d')]=_0x490632['id'];if(_0x2e65fd['query'][_0x624a('0x45')]){_0x54ff9a[_0x624a('0x42')]=_[_0x624a('0x46')](_0x54ff9a[_0x624a('0x42')],{'$or':_[_0x624a('0x31')](_0x54ff9a[_0x624a('0x3c')],function(_0x45cf4d){var _0x528833={};_0x528833[_0x45cf4d]={'$like':'%'+_0x2e65fd[_0x624a('0x37')][_0x624a('0x45')]+'%'};return _0x528833;})});}_0x54ff9a=_[_0x624a('0x46')]({},_0x54ff9a,_0x2e65fd[_0x624a('0x48')]);return db[_0x624a('0x5c')][_0x624a('0x4a')](_0x54ff9a);}})[_0x624a('0x2c')](function(_0x3f98aa){if(_0x3f98aa){return db['User'][_0x624a('0x5e')]({'where':{'id':_[_0x624a('0x31')](_0x3f98aa,_0x624a('0x5f')),'role':_0x624a('0x60')},'attributes':['id','name','faxPause',_0x624a('0x61'),_0x624a('0x62')]});}})['then'](function(_0x3e32b9){if(_0x3e32b9){return{'count':_0x3e32b9[_0x624a('0x23')],'rows':_[_0x624a('0x31')](_0x3e32b9[_0x624a('0x4b')],function(_0x177619){return{'membername':_0x177619[_0x624a('0x2f')],'UserId':_0x177619['id'],'queue_name':_0x23cf77[_0x624a('0x2f')],'FaxQueueId':_0x23cf77['id'],'interface':util[_0x624a('0x63')](_0x624a('0x64'),_0x624a('0x65'),_0x177619[_0x624a('0x2f')]),'penalty':0x0,'paused':_0x177619[_0x624a('0x66')],'createdAt':_0x177619[_0x624a('0x62')],'updatedAt':_0x177619['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x6a2d37,_0x54ff9a))[_0x624a('0x4c')](handleError(_0x6a2d37,null));};exports[_0x624a('0x67')]=function(_0x4e76c6,_0x202465,_0x408e23){var _0x10d2a7={};var _0x35f311={};var _0x47b788;var _0x4f4cdb;return db[_0x624a('0x49')]['findOne']({'where':{'id':_0x4e76c6[_0x624a('0x58')]['id']}})['then'](handleEntityNotFound(_0x202465,null))[_0x624a('0x2c')](function(_0x479783){if(_0x479783){_0x47b788=_0x479783;_0x35f311[_0x624a('0x36')]=_[_0x624a('0x38')](db[_0x624a('0x68')][_0x624a('0x32')]);_0x35f311[_0x624a('0x37')]=_[_0x624a('0x38')](_0x4e76c6[_0x624a('0x37')]);_0x35f311[_0x624a('0x43')]=_[_0x624a('0x39')](_0x35f311[_0x624a('0x36')],_0x35f311['query']);_0x10d2a7[_0x624a('0x3c')]=_[_0x624a('0x39')](_0x35f311[_0x624a('0x36')],qs[_0x624a('0x3a')](_0x4e76c6[_0x624a('0x37')][_0x624a('0x3a')]));_0x10d2a7['attributes']=_0x10d2a7['attributes'][_0x624a('0x3b')]?_0x10d2a7[_0x624a('0x3c')]:_0x35f311[_0x624a('0x36')];_0x10d2a7[_0x624a('0x40')]=qs[_0x624a('0x41')](_0x4e76c6['query'][_0x624a('0x41')]);_0x10d2a7['where']=qs['filters'](_[_0x624a('0x44')](_0x4e76c6[_0x624a('0x37')],_0x35f311[_0x624a('0x43')]));if(_0x4e76c6[_0x624a('0x37')][_0x624a('0x45')]){_0x10d2a7[_0x624a('0x42')]=_[_0x624a('0x46')](_0x10d2a7[_0x624a('0x42')],{'$or':_[_0x624a('0x31')](_0x10d2a7[_0x624a('0x3c')],function(_0x2f1505){var _0x149df5={};_0x149df5[_0x2f1505]={'$like':'%'+_0x4e76c6[_0x624a('0x37')][_0x624a('0x45')]+'%'};return _0x149df5;})});}_0x10d2a7=_[_0x624a('0x46')]({},_0x10d2a7,_0x4e76c6[_0x624a('0x48')]);return _0x47b788['getTeams'](_0x10d2a7);}})['then'](function(_0x3755a7){if(_0x3755a7){_0x4f4cdb=_0x3755a7[_0x624a('0x3b')];if(!_0x4e76c6[_0x624a('0x37')]['hasOwnProperty'](_0x624a('0x3e'))){_0x10d2a7[_0x624a('0x3f')]=qs['limit'](_0x4e76c6[_0x624a('0x37')]['limit']);_0x10d2a7[_0x624a('0x24')]=qs[_0x624a('0x24')](_0x4e76c6[_0x624a('0x37')][_0x624a('0x24')]);}return _0x47b788[_0x624a('0x67')](_0x10d2a7);}})[_0x624a('0x2c')](function(_0x87078a){if(_0x87078a){return _0x87078a?{'count':_0x4f4cdb,'rows':_0x87078a}:null;}})[_0x624a('0x2c')](respondWithResult(_0x202465,null))[_0x624a('0x4c')](handleError(_0x202465,null));};exports[_0x624a('0x69')]=function(_0x3c558c,_0x2a6318,_0x5750e8){var _0x4d0f53=_0x3c558c['body'][_0x624a('0x6a')];return db[_0x624a('0x68')][_0x624a('0x4a')]({'where':{'id':_0x4d0f53},'attributes':['id'],'include':[{'model':db[_0x624a('0x6b')],'as':_0x624a('0x6c'),'attributes':['id',_0x624a('0x2f'),_0x624a('0x6d'),'voicePause',_0x624a('0x6e')],'raw':!![]}]})['then'](function(_0x30da98){if(_0x30da98){var _0x31df3f=_['flatMap'](_0x30da98,function(_0x54bd4a){var _0x2143dc=_0x54bd4a[_0x624a('0x53')]({'plain':!![]});return _0x2143dc[_0x624a('0x6c')];});return db[_0x624a('0x49')][_0x624a('0x4f')]({'where':{'id':_0x3c558c['params']['id']}})[_0x624a('0x2c')](function(_0x3d43c9){return db[_0x624a('0x6f')][_0x624a('0x70')](function(_0x44afe2){return _0x3d43c9['addTeams'](_0x4d0f53,{'transaction':_0x44afe2})['then'](function(){return BPromise['each'](_0x31df3f,function(_0x375f19){return db[_0x624a('0x5c')]['findOrCreate']({'where':{'UserId':_0x375f19['id'],'FaxQueueId':_0x3c558c[_0x624a('0x58')]['id']},'transaction':_0x44afe2});});})[_0x624a('0x2c')](function(){_0x31df3f[_0x624a('0x71')](function(_0x536ac8){socket[_0x624a('0x72')](_0x624a('0x73'),{'UserId':_0x536ac8['id'],'FaxQueueId':_0x3d43c9['id']});});});});});}})[_0x624a('0x2c')](respondWithStatusCode(_0x2a6318,null))[_0x624a('0x4c')](handleError(_0x2a6318,null));};exports['removeTeams']=function(_0x577f9a,_0x4f4d31,_0x2d64f7){return db[_0x624a('0x68')][_0x624a('0x4a')]({'where':{'id':_0x577f9a[_0x624a('0x37')][_0x624a('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x624a('0x6b')],'as':_0x624a('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x624a('0x2c')](handleEntityNotFound(_0x4f4d31,null))[_0x624a('0x2c')](function(_0x9181b4){var _0x2301ae=_[_0x624a('0x31')](_0x9181b4,'id');var _0x83669b=[];var _0x54cc95=[];var _0x171b16=squel[_0x624a('0x74')]();_0x171b16['field'](_0x624a('0x75'))[_0x624a('0x76')](_0x624a('0x77'),'tq')[_0x624a('0x78')](_0x624a('0x79'),'ut',_0x624a('0x7a'))['where'](_0x624a('0x7b'),_0x577f9a[_0x624a('0x58')]['id']);for(var _0x305d97=0x0;_0x305d97<_0x9181b4[_0x624a('0x3b')];_0x305d97+=0x1){let _0x4d837c=_0x9181b4[_0x305d97];for(var _0x3b3600=0x0;_0x3b3600<_0x4d837c[_0x624a('0x6c')][_0x624a('0x3b')];_0x3b3600+=0x1){let _0x5b1230=_0x4d837c[_0x624a('0x6c')][_0x3b3600];var _0x5f3de4=_0x171b16[_0x624a('0x7c')]();_0x5f3de4[_0x624a('0x42')](_0x624a('0x7d'),_0x5b1230['id']);_0x54cc95[_0x624a('0x7e')](db[_0x624a('0x6f')]['query'](_0x5f3de4[_0x624a('0x7f')](),{'type':db[_0x624a('0x6f')][_0x624a('0x80')][_0x624a('0x81')]})[_0x624a('0x2c')](function(_0x51fa38){if(_0x51fa38['length']===0x1){return _0x5b1230['id'];}else{var _0x25a61f=_[_0x624a('0x82')](_[_0x624a('0x31')](_0x51fa38,_0x624a('0x83')),function(_0x4ae90f){return _['includes'](_0x2301ae,_0x4ae90f);});if(_0x25a61f){return _0x5b1230['id'];}}}));}}return BPromise[_0x624a('0x84')](_0x54cc95)[_0x624a('0x2c')](function(_0x5750df){_0x83669b=_(_0x83669b)[_0x624a('0x85')](_0x5750df)[_0x624a('0x86')]()[_0x624a('0x87')]();return db[_0x624a('0x49')]['find']({'where':{'id':_0x577f9a[_0x624a('0x58')]['id']}})[_0x624a('0x2c')](function(_0x44c050){return db[_0x624a('0x6f')][_0x624a('0x70')](function(_0x57f4b8){return _0x44c050[_0x624a('0x88')](_0x577f9a[_0x624a('0x37')][_0x624a('0x6a')],{'transaction':_0x57f4b8})[_0x624a('0x2c')](function(){if(!_[_0x624a('0x89')](_0x83669b)){return _0x44c050[_0x624a('0x8a')](_0x83669b,{'transaction':_0x57f4b8});}})['then'](function(){_0x83669b[_0x624a('0x71')](function(_0x288881){socket[_0x624a('0x72')](_0x624a('0x8b'),{'UserId':_0x288881,'FaxQueueId':_0x44c050['id']});});});});});});})['then'](respondWithStatusCode(_0x4f4d31,null))[_0x624a('0x4c')](handleError(_0x4f4d31,null));};exports[_0x624a('0x8c')]=function(_0x2e74dc,_0x3a53af,_0x30a716){return db[_0x624a('0x49')][_0x624a('0x4f')]({'where':{'id':_0x2e74dc[_0x624a('0x58')]['id']}})[_0x624a('0x2c')](handleEntityNotFound(_0x3a53af,null))[_0x624a('0x2c')](function(_0x418413){if(_0x418413){return _0x418413[_0x624a('0x8c')](_0x2e74dc[_0x624a('0x51')][_0x624a('0x6a')],_['omit'](_0x2e74dc['body'],['ids','id'])||{})[_0x624a('0x8d')](function(_0x36b328){for(var _0x492c7a=0x0;_0x492c7a<_0x2e74dc['body'][_0x624a('0x6a')][_0x624a('0x3b')];_0x492c7a+=0x1){socket['emit'](_0x624a('0x73'),{'UserId':_0x2e74dc[_0x624a('0x51')][_0x624a('0x6a')][_0x492c7a],'FaxQueueId':_0x2e74dc[_0x624a('0x58')]['id']});}return _0x36b328;});}})[_0x624a('0x2c')](respondWithResult(_0x3a53af,null))[_0x624a('0x4c')](handleError(_0x3a53af,null));};exports[_0x624a('0x8a')]=function(_0x1f30a9,_0x586ecd,_0x1c4f9b){return db[_0x624a('0x49')][_0x624a('0x4f')]({'where':{'id':_0x1f30a9[_0x624a('0x58')]['id']}})['then'](handleEntityNotFound(_0x586ecd,null))[_0x624a('0x2c')](function(_0x330815){if(_0x330815){return _0x330815[_0x624a('0x8a')](_0x1f30a9[_0x624a('0x37')][_0x624a('0x6a')])['then'](function(){if(_[_0x624a('0x8e')](_0x1f30a9[_0x624a('0x37')][_0x624a('0x6a')])){for(var _0x41a886=0x0;_0x41a886<_0x1f30a9[_0x624a('0x37')][_0x624a('0x6a')][_0x624a('0x3b')];_0x41a886+=0x1){socket['emit'](_0x624a('0x8b'),{'UserId':Number(_0x1f30a9[_0x624a('0x37')]['ids'][_0x41a886]),'FaxQueueId':Number(_0x1f30a9[_0x624a('0x58')]['id'])});}}else{socket['emit'](_0x624a('0x8b'),{'UserId':Number(_0x1f30a9[_0x624a('0x37')][_0x624a('0x6a')]),'FaxQueueId':Number(_0x1f30a9['params']['id'])});}});}})[_0x624a('0x2c')](respondWithStatusCode(_0x586ecd,null))['catch'](handleError(_0x586ecd,null));};exports[_0x624a('0x8f')]=function(_0x225068,_0x19dff9,_0x2c0cde){var _0x32095c={};var _0x35d003={};var _0x11a880;var _0x52724a;return db[_0x624a('0x49')][_0x624a('0x5b')]({'where':{'id':_0x225068[_0x624a('0x58')]['id']}})['then'](handleEntityNotFound(_0x19dff9,null))['then'](function(_0x1d7e63){if(_0x1d7e63){_0x11a880=_0x1d7e63;_0x35d003['model']=_[_0x624a('0x38')](db[_0x624a('0x6b')][_0x624a('0x32')]);_0x35d003[_0x624a('0x37')]=_[_0x624a('0x38')](_0x225068['query']);_0x35d003[_0x624a('0x43')]=_['intersection'](_0x35d003['model'],_0x35d003[_0x624a('0x37')]);_0x32095c[_0x624a('0x3c')]=_['intersection'](_0x35d003['model'],qs[_0x624a('0x3a')](_0x225068[_0x624a('0x37')]['fields']));_0x32095c[_0x624a('0x3c')]=_0x32095c[_0x624a('0x3c')][_0x624a('0x3b')]?_0x32095c['attributes']:_0x35d003[_0x624a('0x36')];_0x32095c[_0x624a('0x40')]=qs[_0x624a('0x41')](_0x225068[_0x624a('0x37')][_0x624a('0x41')]);_0x32095c['where']=qs[_0x624a('0x43')](_[_0x624a('0x44')](_0x225068[_0x624a('0x37')],_0x35d003['filters']));if(_0x225068[_0x624a('0x37')][_0x624a('0x45')]){_0x32095c['where']=_[_0x624a('0x46')](_0x32095c['where'],{'$or':_[_0x624a('0x31')](_0x32095c['attributes'],function(_0x1f27b0){var _0x553b4e={};_0x553b4e[_0x1f27b0]={'$like':'%'+_0x225068[_0x624a('0x37')][_0x624a('0x45')]+'%'};return _0x553b4e;})});}_0x32095c=_[_0x624a('0x46')]({},_0x32095c,_0x225068['options']);return _0x11a880[_0x624a('0x8f')](_0x32095c);}})[_0x624a('0x2c')](function(_0x450a8b){if(_0x450a8b){_0x52724a=_0x450a8b[_0x624a('0x3b')];if(!_0x225068[_0x624a('0x37')][_0x624a('0x3d')](_0x624a('0x3e'))){_0x32095c['limit']=qs['limit'](_0x225068[_0x624a('0x37')][_0x624a('0x3f')]);_0x32095c[_0x624a('0x24')]=qs['offset'](_0x225068[_0x624a('0x37')][_0x624a('0x24')]);}return _0x11a880[_0x624a('0x8f')](_0x32095c);}})['then'](function(_0x5c4222){if(_0x5c4222){return _0x5c4222?{'count':_0x52724a,'rows':_0x5c4222}:null;}})[_0x624a('0x2c')](respondWithResult(_0x19dff9,null))[_0x624a('0x4c')](handleError(_0x19dff9,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 4c3842a..a3881f4 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 _0x8453=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','FaxQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8453,0x19c));var _0x3845=function(_0x5d317f,_0x543f51){_0x5d317f=_0x5d317f-0x0;var _0x5d5e13=_0x8453[_0x5d317f];return _0x5d5e13;};'use strict';var EventEmitter=require(_0x3845('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x3845('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x3845('0x2')](0x0);var events={'afterCreate':_0x3845('0x3'),'afterUpdate':_0x3845('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4d8f90){return function(_0x1ab25e,_0x4353bb,_0x34bb4e){FaxQueueEvents[_0x3845('0x5')](_0x4d8f90+':'+_0x1ab25e['id'],_0x1ab25e);FaxQueueEvents['emit'](_0x4d8f90,_0x1ab25e);_0x34bb4e(null);};}for(var e in events){if(events[_0x3845('0x6')](e)){var event=events[e];FaxQueue[_0x3845('0x7')](e,emitEvent(event));}}module[_0x3845('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xbdeb=['update','remove','emit','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x33c98e,_0x4eb3d0){var _0x39a756=function(_0x3cfded){while(--_0x3cfded){_0x33c98e['push'](_0x33c98e['shift']());}};_0x39a756(++_0x4eb3d0);}(_0xbdeb,0x8d));var _0xbbde=function(_0x11d626,_0x4a1805){_0x11d626=_0x11d626-0x0;var _0x11c15c=_0xbdeb[_0x11d626];return _0x11c15c;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xbbde('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xbbde('0x1')](0x0);var events={'afterCreate':_0xbbde('0x2'),'afterUpdate':_0xbbde('0x3'),'afterDestroy':_0xbbde('0x4')};function emitEvent(_0x4c8967){return function(_0x18e587,_0xc6be1d,_0xff323b){FaxQueueEvents['emit'](_0x4c8967+':'+_0x18e587['id'],_0x18e587);FaxQueueEvents[_0xbbde('0x5')](_0x4c8967,_0x18e587);_0xff323b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xbbde('0x6')](e,emitEvent(event));}}module[_0xbbde('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 75456f2..aceb07d 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 _0x1f3e=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','FaxQueue','fax_queues'];(function(_0x21203d,_0x284bde){var _0x575987=function(_0x41fbc3){while(--_0x41fbc3){_0x21203d['push'](_0x21203d['shift']());}};_0x575987(++_0x284bde);}(_0x1f3e,0x12c));var _0xe1f3=function(_0x179c3a,_0x14b012){_0x179c3a=_0x179c3a-0x0;var _0x1af0a0=_0x1f3e[_0x179c3a];return _0x1af0a0;};'use strict';var _=require('lodash');var util=require(_0xe1f3('0x0'));var logger=require(_0xe1f3('0x1'))('api');var moment=require(_0xe1f3('0x2'));var BPromise=require(_0xe1f3('0x3'));var rp=require(_0xe1f3('0x4'));var fs=require('fs');var path=require(_0xe1f3('0x5'));var rimraf=require(_0xe1f3('0x6'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xe1f3('0x7')]=function(_0x242eba,_0x516191){return _0x242eba['define'](_0xe1f3('0x8'),attributes,{'tableName':_0xe1f3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda83=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueue.attributes','define','FaxQueue','lodash'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0xda83,0xe3));var _0x3da8=function(_0x2c0fc4,_0x2c4e79){_0x2c0fc4=_0x2c0fc4-0x0;var _0x17d0b4=_0xda83[_0x2c0fc4];return _0x17d0b4;};'use strict';var _=require(_0x3da8('0x0'));var util=require(_0x3da8('0x1'));var logger=require(_0x3da8('0x2'))(_0x3da8('0x3'));var moment=require(_0x3da8('0x4'));var BPromise=require(_0x3da8('0x5'));var rp=require(_0x3da8('0x6'));var fs=require('fs');var path=require(_0x3da8('0x7'));var rimraf=require('rimraf');var config=require(_0x3da8('0x8'));var attributes=require(_0x3da8('0x9'));module['exports']=function(_0x2001ec,_0x1688d9){return _0x2001ec[_0x3da8('0xa')](_0x3da8('0xb'),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 35ab514..6fc7eb2 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 _0x1ed8=['find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','include','model','attributes','map','then','debug','ShowFaxQueue'];(function(_0xcd38d3,_0x3731b4){var _0x42d5b1=function(_0x480260){while(--_0x480260){_0xcd38d3['push'](_0xcd38d3['shift']());}};_0x42d5b1(++_0x3731b4);}(_0x1ed8,0xc9));var _0x81ed=function(_0x40970d,_0x2bb0ab){_0x40970d=_0x40970d-0x0;var _0x23b827=_0x1ed8[_0x40970d];return _0x23b827;};'use strict';var _=require('lodash');var util=require(_0x81ed('0x0'));var moment=require(_0x81ed('0x1'));var BPromise=require(_0x81ed('0x2'));var rs=require(_0x81ed('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81ed('0x4'))['db'];var utils=require(_0x81ed('0x5'));var logger=require('../../config/logger')(_0x81ed('0x6'));var config=require(_0x81ed('0x7'));var jayson=require(_0x81ed('0x8'));var client=jayson['client'][_0x81ed('0x9')]({'port':0x232a});config[_0x81ed('0xa')]=_[_0x81ed('0xb')](config[_0x81ed('0xa')],{'host':_0x81ed('0xc'),'port':0x18eb});var socket=require(_0x81ed('0xd'))(new Redis(config['redis']));require(_0x81ed('0xe'))[_0x81ed('0xf')](socket);function respondWithRpcPromise(_0x17f5a4,_0x313bf6,_0x1e3131){return new BPromise(function(_0x5510eb,_0x1a2066){return client[_0x81ed('0x10')](_0x17f5a4,_0x1e3131)['then'](function(_0x15a53a){logger[_0x81ed('0x11')](_0x81ed('0x12'),_0x313bf6,_0x81ed('0x13'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x313bf6,_0x81ed('0x13'),JSON[_0x81ed('0x14')](_0x15a53a));if(_0x15a53a[_0x81ed('0x15')]){if(_0x15a53a['error'][_0x81ed('0x16')]===0x1f4){logger[_0x81ed('0x15')](_0x81ed('0x12'),_0x313bf6,_0x15a53a[_0x81ed('0x15')][_0x81ed('0x17')]);return _0x1a2066(_0x15a53a[_0x81ed('0x15')][_0x81ed('0x17')]);}logger[_0x81ed('0x15')]('FaxQueue,\x20%s,\x20%s',_0x313bf6,_0x15a53a[_0x81ed('0x15')][_0x81ed('0x17')]);return _0x5510eb(_0x15a53a[_0x81ed('0x15')][_0x81ed('0x17')]);}else{logger[_0x81ed('0x11')](_0x81ed('0x12'),_0x313bf6,_0x81ed('0x13'));_0x5510eb(_0x15a53a[_0x81ed('0x18')]['message']);}})[_0x81ed('0x19')](function(_0x2e9606){logger['error']('FaxQueue,\x20%s,\x20%s',_0x313bf6,_0x2e9606);_0x1a2066(_0x2e9606);});});}exports[_0x81ed('0x1a')]=function(_0x5caa89){var _0x40d51d=this;return new Promise(function(_0x209352,_0x3956c7){return db[_0x81ed('0x1b')][_0x81ed('0x1c')]({'raw':_0x5caa89[_0x81ed('0x1d')]?_0x5caa89[_0x81ed('0x1d')][_0x81ed('0x1e')]===undefined?!![]:![]:!![],'where':_0x5caa89[_0x81ed('0x1d')]?_0x5caa89[_0x81ed('0x1d')][_0x81ed('0x1f')]||null:null,'attributes':_0x5caa89[_0x81ed('0x1d')]?_0x5caa89[_0x81ed('0x1d')]['attributes']||null:null,'limit':_0x5caa89[_0x81ed('0x1d')]?_0x5caa89[_0x81ed('0x1d')]['limit']||null:null,'include':_0x5caa89[_0x81ed('0x1d')]?_0x5caa89[_0x81ed('0x1d')]['include']?_['map'](_0x5caa89['options'][_0x81ed('0x20')],function(_0x454107){return{'model':db[_0x454107[_0x81ed('0x21')]],'as':_0x454107['as'],'attributes':_0x454107[_0x81ed('0x22')],'include':_0x454107[_0x81ed('0x20')]?_[_0x81ed('0x23')](_0x454107['include'],function(_0x37527f){return{'model':db[_0x37527f[_0x81ed('0x21')]],'as':_0x37527f['as'],'attributes':_0x37527f['attributes'],'include':_0x37527f['include']?_[_0x81ed('0x23')](_0x37527f[_0x81ed('0x20')],function(_0x3740d3){return{'model':db[_0x3740d3[_0x81ed('0x21')]],'as':_0x3740d3['as'],'attributes':_0x3740d3[_0x81ed('0x22')]};}):[]};}):[]};}):[]:[]})[_0x81ed('0x24')](function(_0x367452){logger[_0x81ed('0x11')](_0x81ed('0x1a'),_0x5caa89);logger[_0x81ed('0x25')](_0x81ed('0x1a'),_0x5caa89,JSON['stringify'](_0x367452));_0x209352(_0x367452);})[_0x81ed('0x19')](function(_0xfa8a82){logger[_0x81ed('0x15')](_0x81ed('0x1a'),_0xfa8a82['message'],_0x5caa89);_0x3956c7(_0x40d51d[_0x81ed('0x15')](0x1f4,_0xfa8a82['message']));});});};exports[_0x81ed('0x26')]=function(_0x2d9cc0){var _0x476e81=this;return new Promise(function(_0x56093a,_0x26a1ce){return db['FaxQueue'][_0x81ed('0x27')]({'raw':_0x2d9cc0['options']?_0x2d9cc0[_0x81ed('0x1d')][_0x81ed('0x1e')]===undefined?!![]:![]:!![],'where':_0x2d9cc0['options']?_0x2d9cc0['options']['where']||null:null,'attributes':_0x2d9cc0['options']?_0x2d9cc0[_0x81ed('0x1d')][_0x81ed('0x22')]||null:null,'include':_0x2d9cc0[_0x81ed('0x1d')]?_0x2d9cc0[_0x81ed('0x1d')][_0x81ed('0x20')]?_[_0x81ed('0x23')](_0x2d9cc0[_0x81ed('0x1d')]['include'],function(_0x1d74f8){return{'model':db[_0x1d74f8['model']],'as':_0x1d74f8['as'],'attributes':_0x1d74f8[_0x81ed('0x22')],'include':_0x1d74f8[_0x81ed('0x20')]?_[_0x81ed('0x23')](_0x1d74f8['include'],function(_0x169dd5){return{'model':db[_0x169dd5['model']],'as':_0x169dd5['as'],'attributes':_0x169dd5['attributes'],'include':_0x169dd5[_0x81ed('0x20')]?_['map'](_0x169dd5[_0x81ed('0x20')],function(_0x41eb85){return{'model':db[_0x41eb85[_0x81ed('0x21')]],'as':_0x41eb85['as'],'attributes':_0x41eb85[_0x81ed('0x22')]};}):[]};}):[]};}):[]:[]})[_0x81ed('0x24')](function(_0x450f7b){logger[_0x81ed('0x11')]('ShowFaxQueue',_0x2d9cc0);logger['debug'](_0x81ed('0x26'),_0x2d9cc0,JSON[_0x81ed('0x14')](_0x450f7b));_0x56093a(_0x450f7b);})[_0x81ed('0x19')](function(_0x5e49e5){logger[_0x81ed('0x15')]('ShowFaxQueue',_0x5e49e5['message'],_0x2d9cc0);_0x26a1ce(_0x476e81[_0x81ed('0x15')](0x1f4,_0x5e49e5[_0x81ed('0x17')]));});});}; \ No newline at end of file +var _0x01a1=['FaxQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','raw','options','attributes','limit','include','map','model','stringify','where','ShowFaxQueue','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x13de53,_0x5cbc31){var _0x13c459=function(_0x2270ca){while(--_0x2270ca){_0x13de53['push'](_0x13de53['shift']());}};_0x13c459(++_0x5cbc31);}(_0x01a1,0x15f));var _0x101a=function(_0x7fc00,_0x4e59d4){_0x7fc00=_0x7fc00-0x0;var _0x31ad13=_0x01a1[_0x7fc00];return _0x31ad13;};'use strict';var _=require(_0x101a('0x0'));var util=require(_0x101a('0x1'));var moment=require(_0x101a('0x2'));var BPromise=require('bluebird');var rs=require(_0x101a('0x3'));var fs=require('fs');var Redis=require(_0x101a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x101a('0x5'));var logger=require('../../config/logger')(_0x101a('0x6'));var config=require(_0x101a('0x7'));var jayson=require(_0x101a('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x101a('0x9')](config[_0x101a('0xa')],{'host':_0x101a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x101a('0xc'))['register'](socket);function respondWithRpcPromise(_0x1fea74,_0x59d65d,_0x4d2aac){return new BPromise(function(_0x4175a7,_0x2a9147){return client[_0x101a('0xd')](_0x1fea74,_0x4d2aac)[_0x101a('0xe')](function(_0x399702){logger[_0x101a('0xf')](_0x101a('0x10'),_0x59d65d,_0x101a('0x11'));logger[_0x101a('0x12')](_0x101a('0x13'),_0x59d65d,_0x101a('0x11'),JSON['stringify'](_0x399702));if(_0x399702['error']){if(_0x399702[_0x101a('0x14')]['code']===0x1f4){logger[_0x101a('0x14')]('FaxQueue,\x20%s,\x20%s',_0x59d65d,_0x399702[_0x101a('0x14')][_0x101a('0x15')]);return _0x2a9147(_0x399702['error'][_0x101a('0x15')]);}logger[_0x101a('0x14')](_0x101a('0x10'),_0x59d65d,_0x399702[_0x101a('0x14')][_0x101a('0x15')]);return _0x4175a7(_0x399702['error']['message']);}else{logger[_0x101a('0xf')](_0x101a('0x10'),_0x59d65d,_0x101a('0x11'));_0x4175a7(_0x399702[_0x101a('0x16')]['message']);}})[_0x101a('0x17')](function(_0x28eb2a){logger[_0x101a('0x14')]('FaxQueue,\x20%s,\x20%s',_0x59d65d,_0x28eb2a);_0x2a9147(_0x28eb2a);});});}exports[_0x101a('0x18')]=function(_0x227a9c){var _0x345841=this;return new Promise(function(_0x3234cc,_0x554d1c){return db[_0x101a('0x19')][_0x101a('0x1a')]({'raw':_0x227a9c['options']?_0x227a9c['options'][_0x101a('0x1b')]===undefined?!![]:![]:!![],'where':_0x227a9c[_0x101a('0x1c')]?_0x227a9c[_0x101a('0x1c')]['where']||null:null,'attributes':_0x227a9c[_0x101a('0x1c')]?_0x227a9c[_0x101a('0x1c')][_0x101a('0x1d')]||null:null,'limit':_0x227a9c[_0x101a('0x1c')]?_0x227a9c['options'][_0x101a('0x1e')]||null:null,'include':_0x227a9c[_0x101a('0x1c')]?_0x227a9c[_0x101a('0x1c')][_0x101a('0x1f')]?_['map'](_0x227a9c[_0x101a('0x1c')][_0x101a('0x1f')],function(_0x4587a2){return{'model':db[_0x4587a2['model']],'as':_0x4587a2['as'],'attributes':_0x4587a2[_0x101a('0x1d')],'include':_0x4587a2[_0x101a('0x1f')]?_[_0x101a('0x20')](_0x4587a2[_0x101a('0x1f')],function(_0x4978b9){return{'model':db[_0x4978b9[_0x101a('0x21')]],'as':_0x4978b9['as'],'attributes':_0x4978b9[_0x101a('0x1d')],'include':_0x4978b9[_0x101a('0x1f')]?_['map'](_0x4978b9[_0x101a('0x1f')],function(_0x113e5d){return{'model':db[_0x113e5d[_0x101a('0x21')]],'as':_0x113e5d['as'],'attributes':_0x113e5d['attributes']};}):[]};}):[]};}):[]:[]})[_0x101a('0xe')](function(_0x313288){logger[_0x101a('0xf')](_0x101a('0x18'),_0x227a9c);logger['debug']('GetFaxQueue',_0x227a9c,JSON[_0x101a('0x22')](_0x313288));_0x3234cc(_0x313288);})[_0x101a('0x17')](function(_0x488717){logger['error']('GetFaxQueue',_0x488717[_0x101a('0x15')],_0x227a9c);_0x554d1c(_0x345841['error'](0x1f4,_0x488717[_0x101a('0x15')]));});});};exports['ShowFaxQueue']=function(_0x10b601){var _0x24442e=this;return new Promise(function(_0x8b5eb5,_0x1f3ca6){return db['FaxQueue']['find']({'raw':_0x10b601[_0x101a('0x1c')]?_0x10b601[_0x101a('0x1c')][_0x101a('0x1b')]===undefined?!![]:![]:!![],'where':_0x10b601[_0x101a('0x1c')]?_0x10b601[_0x101a('0x1c')][_0x101a('0x23')]||null:null,'attributes':_0x10b601[_0x101a('0x1c')]?_0x10b601['options'][_0x101a('0x1d')]||null:null,'include':_0x10b601[_0x101a('0x1c')]?_0x10b601['options']['include']?_[_0x101a('0x20')](_0x10b601['options'][_0x101a('0x1f')],function(_0x33eb0f){return{'model':db[_0x33eb0f[_0x101a('0x21')]],'as':_0x33eb0f['as'],'attributes':_0x33eb0f['attributes'],'include':_0x33eb0f['include']?_['map'](_0x33eb0f['include'],function(_0x4ad79a){return{'model':db[_0x4ad79a['model']],'as':_0x4ad79a['as'],'attributes':_0x4ad79a[_0x101a('0x1d')],'include':_0x4ad79a[_0x101a('0x1f')]?_['map'](_0x4ad79a[_0x101a('0x1f')],function(_0x2ebee6){return{'model':db[_0x2ebee6[_0x101a('0x21')]],'as':_0x2ebee6['as'],'attributes':_0x2ebee6[_0x101a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x101a('0xe')](function(_0x2fd77c){logger[_0x101a('0xf')](_0x101a('0x24'),_0x10b601);logger['debug'](_0x101a('0x24'),_0x10b601,JSON[_0x101a('0x22')](_0x2fd77c));_0x8b5eb5(_0x2fd77c);})['catch'](function(_0x1a8f1b){logger['error']('ShowFaxQueue',_0x1a8f1b['message'],_0x10b601);_0x1f3ca6(_0x24442e[_0x101a('0x14')](0x1f4,_0x1a8f1b[_0x101a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 8769c71..587cf34 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 _0xed37=['removeListener','register','length','faxQueue:','save','remove','update'];(function(_0x12fa10,_0x5e9810){var _0x14ce72=function(_0x1828ac){while(--_0x1828ac){_0x12fa10['push'](_0x12fa10['shift']());}};_0x14ce72(++_0x5e9810);}(_0xed37,0x66));var _0x7ed3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xed37[_0x3ab51d];return _0x29a04e;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x7ed3('0x0'),_0x7ed3('0x1'),_0x7ed3('0x2')];function createListener(_0x365ffa,_0x35c03a){return function(_0x96f176){_0x35c03a['emit'](_0x365ffa,_0x96f176);};}function removeListener(_0x10b4a4,_0x64b818){return function(){FaxQueueEvents[_0x7ed3('0x3')](_0x10b4a4,_0x64b818);};}exports[_0x7ed3('0x4')]=function(_0x1c8d9d){for(var _0x38acf3=0x0,_0x881a8e=events[_0x7ed3('0x5')];_0x38acf3<_0x881a8e;_0x38acf3++){var _0x3f7b83=events[_0x38acf3];var _0x4a58e5=createListener(_0x7ed3('0x6')+_0x3f7b83,_0x1c8d9d);FaxQueueEvents['on'](_0x3f7b83,_0x4a58e5);}}; \ No newline at end of file +var _0x95d0=['faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener','length'];(function(_0x99219c,_0x53409e){var _0x48fb26=function(_0x4e52b6){while(--_0x4e52b6){_0x99219c['push'](_0x99219c['shift']());}};_0x48fb26(++_0x53409e);}(_0x95d0,0xf1));var _0x095d=function(_0x3531f2,_0x16f8d4){_0x3531f2=_0x3531f2-0x0;var _0x45fc8f=_0x95d0[_0x3531f2];return _0x45fc8f;};'use strict';var FaxQueueEvents=require(_0x095d('0x0'));var events=[_0x095d('0x1'),_0x095d('0x2'),_0x095d('0x3')];function createListener(_0xad3a63,_0x123ca4){return function(_0x55805a){_0x123ca4[_0x095d('0x4')](_0xad3a63,_0x55805a);};}function removeListener(_0x25ad23,_0x5bd0c2){return function(){FaxQueueEvents[_0x095d('0x5')](_0x25ad23,_0x5bd0c2);};}exports['register']=function(_0x2c628f){for(var _0x2f04b0=0x0,_0x28f700=events[_0x095d('0x6')];_0x2f04b0<_0x28f700;_0x2f04b0++){var _0x50c898=events[_0x2f04b0];var _0x1a57c1=createListener(_0x095d('0x7')+_0x50c898,_0x2c628f);FaxQueueEvents['on'](_0x50c898,_0x1a57c1);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 9dec0c6..e8647ed 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(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0xb10b,0x12a));var _0xbb10=function(_0x207abf,_0x33cf2e){_0x207abf=_0x207abf-0x0;var _0x481744=_0xb10b[_0x207abf];return _0x481744;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xb10b,0x12a));var _0xbb10=function(_0x557bf4,_0x1f8dad){_0x557bf4=_0x557bf4-0x0;var _0x2916e2=_0xb10b[_0x557bf4];return _0x2916e2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index edf8750..a05762a 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 _0x8b33=['exports','STRING','DATE','sequelize'];(function(_0x139983,_0x484503){var _0x404b84=function(_0x255da4){while(--_0x255da4){_0x139983['push'](_0x139983['shift']());}};_0x404b84(++_0x484503);}(_0x8b33,0xf3));var _0x38b3=function(_0x492eae,_0x4917f0){_0x492eae=_0x492eae-0x0;var _0x30de1c=_0x8b33[_0x492eae];return _0x30de1c;};'use strict';var moment=require('moment');var Sequelize=require(_0x38b3('0x0'));module[_0x38b3('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x38b3('0x2')]},'joinAt':{'type':Sequelize[_0x38b3('0x3')]},'leaveAt':{'type':Sequelize[_0x38b3('0x3')]},'acceptAt':{'type':Sequelize[_0x38b3('0x3')]},'exitAt':{'type':Sequelize[_0x38b3('0x3')]},'reason':{'type':Sequelize[_0x38b3('0x2')]}}; \ No newline at end of file +var _0xd255=['exports','DATE','moment','sequelize'];(function(_0x3c7201,_0x1e26f3){var _0xaeff37=function(_0x1856bd){while(--_0x1856bd){_0x3c7201['push'](_0x3c7201['shift']());}};_0xaeff37(++_0x1e26f3);}(_0xd255,0x166));var _0x5d25=function(_0x150950,_0x57174f){_0x150950=_0x150950-0x0;var _0x3acd49=_0xd255[_0x150950];return _0x3acd49;};'use strict';var moment=require(_0x5d25('0x0'));var Sequelize=require(_0x5d25('0x1'));module[_0x5d25('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x5d25('0x3')]},'leaveAt':{'type':Sequelize[_0x5d25('0x3')]},'acceptAt':{'type':Sequelize[_0x5d25('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 0e50db0..bdd9aeb 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 _0x0476=['reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','FaxQueueReport','includeAll','include','rows','catch','params','keys','length','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x5288f7,_0x10b7ed){var _0x841e7e=function(_0xd95c29){while(--_0xd95c29){_0x5288f7['push'](_0x5288f7['shift']());}};_0x841e7e(++_0x10b7ed);}(_0x0476,0x1e3));var _0x6047=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0x0476[_0x350343];return _0x9afc1c;};'use strict';var pdf=require(_0x6047('0x0'));var emlformat=require(_0x6047('0x1'));var rimraf=require(_0x6047('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6047('0x3'));var rp=require(_0x6047('0x4'));var moment=require(_0x6047('0x5'));var BPromise=require(_0x6047('0x6'));var Mustache=require(_0x6047('0x7'));var util=require(_0x6047('0x8'));var path=require(_0x6047('0x9'));var sox=require(_0x6047('0xa'));var csv=require(_0x6047('0xb'));var ejs=require(_0x6047('0xc'));var fs=require('fs');var _=require(_0x6047('0xd'));var squel=require(_0x6047('0xe'));var crypto=require(_0x6047('0xf'));var jsforce=require(_0x6047('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x6047('0xb'));var querystring=require(_0x6047('0x11'));var Papa=require('papaparse');var Redis=require(_0x6047('0x12'));var authService=require(_0x6047('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6047('0x14'));var logger=require(_0x6047('0x15'))(_0x6047('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6047('0x17'));var db=require(_0x6047('0x18'))['db'];function respondWithStatusCode(_0x3a883e,_0x5dcabb){_0x5dcabb=_0x5dcabb||0xcc;return function(_0x129008){if(_0x129008){return _0x3a883e[_0x6047('0x19')](_0x5dcabb);}return _0x3a883e[_0x6047('0x1a')](_0x5dcabb)[_0x6047('0x1b')]();};}function respondWithResult(_0x2c979c,_0x41f704){_0x41f704=_0x41f704||0xc8;return function(_0x393fea){if(_0x393fea){return _0x2c979c[_0x6047('0x1a')](_0x41f704)[_0x6047('0x1c')](_0x393fea);}};}function respondWithFilteredResult(_0x1638ad,_0x3456f7){return function(_0x2a639d){if(_0x2a639d){var _0x405cb8=_0x2a639d[_0x6047('0x1d')],_0x5d6073=_0x3456f7[_0x6047('0x1e')],_0x5e88e7=_0x3456f7[_0x6047('0x1e')]+_0x3456f7[_0x6047('0x1f')],_0x11d9bf;if(_0x5e88e7>=_0x405cb8){_0x5e88e7=_0x405cb8;_0x11d9bf=0xc8;}else{_0x11d9bf=0xce;}_0x1638ad[_0x6047('0x1a')](_0x11d9bf);return _0x1638ad[_0x6047('0x20')](_0x6047('0x21'),_0x5d6073+'-'+_0x5e88e7+'/'+_0x405cb8)[_0x6047('0x1c')](_0x2a639d);}return null;};}function patchUpdates(_0x3fb253){return function(_0x4595ee){try{jsonpatch[_0x6047('0x22')](_0x4595ee,_0x3fb253,!![]);}catch(_0x4c9d43){return BPromise[_0x6047('0x23')](_0x4c9d43);}return _0x4595ee[_0x6047('0x24')]();};}function saveUpdates(_0x55ee16,_0x45b1d1){return function(_0x195893){if(_0x195893){return _0x195893[_0x6047('0x25')](_0x55ee16)[_0x6047('0x26')](function(_0x1999dc){return _0x1999dc;});}return null;};}function removeEntity(_0x1e02eb,_0x86178f){return function(_0xf51d97){if(_0xf51d97){return _0xf51d97['destroy']()[_0x6047('0x26')](function(){_0x1e02eb[_0x6047('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x476449,_0x26ddca){return function(_0x3d2190){if(!_0x3d2190){_0x476449[_0x6047('0x19')](0x194);}return _0x3d2190;};}function handleError(_0x5ed390,_0x4d95da){_0x4d95da=_0x4d95da||0x1f4;return function(_0x52bfe2){logger[_0x6047('0x27')](_0x52bfe2[_0x6047('0x28')]);if(_0x52bfe2[_0x6047('0x29')]){delete _0x52bfe2['name'];}_0x5ed390[_0x6047('0x1a')](_0x4d95da)['send'](_0x52bfe2);};}exports[_0x6047('0x2a')]=function(_0x4341b2,_0x13ab38){var _0x38f5c0={},_0x53d52e={},_0x46a994={'count':0x0,'rows':[]};var _0x317c70=_[_0x6047('0x2b')](db['FaxQueueReport'][_0x6047('0x2c')],function(_0xdd1e73){return{'name':_0xdd1e73[_0x6047('0x2d')],'type':_0xdd1e73[_0x6047('0x2e')][_0x6047('0x2f')]};});_0x53d52e['model']=_[_0x6047('0x2b')](_0x317c70,_0x6047('0x29'));_0x53d52e[_0x6047('0x30')]=_['keys'](_0x4341b2[_0x6047('0x30')]);_0x53d52e[_0x6047('0x31')]=_[_0x6047('0x32')](_0x53d52e[_0x6047('0x33')],_0x53d52e[_0x6047('0x30')]);_0x38f5c0['attributes']=_[_0x6047('0x32')](_0x53d52e['model'],qs[_0x6047('0x34')](_0x4341b2[_0x6047('0x30')]['fields']));_0x38f5c0[_0x6047('0x35')]=_0x38f5c0['attributes']['length']?_0x38f5c0[_0x6047('0x35')]:_0x53d52e[_0x6047('0x33')];if(!_0x4341b2[_0x6047('0x30')][_0x6047('0x36')]('nolimit')){_0x38f5c0[_0x6047('0x1f')]=qs[_0x6047('0x1f')](_0x4341b2[_0x6047('0x30')][_0x6047('0x1f')]);_0x38f5c0[_0x6047('0x1e')]=qs[_0x6047('0x1e')](_0x4341b2[_0x6047('0x30')][_0x6047('0x1e')]);}_0x38f5c0['order']=qs[_0x6047('0x37')](_0x4341b2['query'][_0x6047('0x37')]);_0x38f5c0[_0x6047('0x38')]=qs[_0x6047('0x31')](_[_0x6047('0x39')](_0x4341b2[_0x6047('0x30')],_0x53d52e[_0x6047('0x31')]),_0x317c70);if(_0x4341b2[_0x6047('0x30')][_0x6047('0x3a')]){_0x38f5c0[_0x6047('0x38')]=_['merge'](_0x38f5c0[_0x6047('0x38')],{'$or':_[_0x6047('0x2b')](_0x317c70,function(_0x3abddb){if(_0x3abddb[_0x6047('0x2e')]!=='VIRTUAL'){var _0x2e1464={};_0x2e1464[_0x3abddb[_0x6047('0x29')]]={'$like':'%'+_0x4341b2[_0x6047('0x30')]['filter']+'%'};return _0x2e1464;}})});}_0x38f5c0=_[_0x6047('0x3b')]({},_0x38f5c0,_0x4341b2['options']);var _0x4f0603={'where':_0x38f5c0['where']};return db[_0x6047('0x3c')][_0x6047('0x1d')](_0x4f0603)['then'](function(_0x7e187f){_0x46a994['count']=_0x7e187f;if(_0x4341b2[_0x6047('0x30')][_0x6047('0x3d')]){_0x38f5c0[_0x6047('0x3e')]=[{'all':!![]}];}return db[_0x6047('0x3c')]['findAll'](_0x38f5c0);})[_0x6047('0x26')](function(_0x3aa801){_0x46a994[_0x6047('0x3f')]=_0x3aa801;return _0x46a994;})[_0x6047('0x26')](respondWithFilteredResult(_0x13ab38,_0x38f5c0))[_0x6047('0x40')](handleError(_0x13ab38,null));};exports['show']=function(_0x25ad1a,_0x5a7f4c){var _0x222ac5={'raw':!![],'where':{'id':_0x25ad1a[_0x6047('0x41')]['id']}},_0x47fbc3={};_0x47fbc3[_0x6047('0x33')]=_[_0x6047('0x42')](db[_0x6047('0x3c')]['rawAttributes']);_0x47fbc3[_0x6047('0x30')]=_[_0x6047('0x42')](_0x25ad1a['query']);_0x47fbc3[_0x6047('0x31')]=_['intersection'](_0x47fbc3[_0x6047('0x33')],_0x47fbc3[_0x6047('0x30')]);_0x222ac5[_0x6047('0x35')]=_[_0x6047('0x32')](_0x47fbc3['model'],qs[_0x6047('0x34')](_0x25ad1a[_0x6047('0x30')][_0x6047('0x34')]));_0x222ac5[_0x6047('0x35')]=_0x222ac5[_0x6047('0x35')][_0x6047('0x43')]?_0x222ac5[_0x6047('0x35')]:_0x47fbc3['model'];if(_0x25ad1a[_0x6047('0x30')][_0x6047('0x3d')]){_0x222ac5[_0x6047('0x3e')]=[{'all':!![]}];}_0x222ac5=_[_0x6047('0x3b')]({},_0x222ac5,_0x25ad1a[_0x6047('0x44')]);return db[_0x6047('0x3c')][_0x6047('0x45')](_0x222ac5)[_0x6047('0x26')](handleEntityNotFound(_0x5a7f4c,null))['then'](respondWithResult(_0x5a7f4c,null))[_0x6047('0x40')](handleError(_0x5a7f4c,null));};exports[_0x6047('0x46')]=function(_0xf5d68e,_0x48c591){return db['FaxQueueReport'][_0x6047('0x46')](_0xf5d68e[_0x6047('0x47')],{})[_0x6047('0x26')](respondWithResult(_0x48c591,0xc9))[_0x6047('0x40')](handleError(_0x48c591,null));};exports[_0x6047('0x25')]=function(_0x27d524,_0xfc1e63){if(_0x27d524[_0x6047('0x47')]['id']){delete _0x27d524[_0x6047('0x47')]['id'];}return db[_0x6047('0x3c')][_0x6047('0x45')]({'where':{'id':_0x27d524[_0x6047('0x41')]['id']}})[_0x6047('0x26')](handleEntityNotFound(_0xfc1e63,null))['then'](saveUpdates(_0x27d524[_0x6047('0x47')],null))[_0x6047('0x26')](respondWithResult(_0xfc1e63,null))[_0x6047('0x40')](handleError(_0xfc1e63,null));};exports[_0x6047('0x48')]=function(_0x2a5824,_0x48b9ed){return db[_0x6047('0x3c')]['find']({'where':{'id':_0x2a5824[_0x6047('0x41')]['id']}})['then'](handleEntityNotFound(_0x48b9ed,null))[_0x6047('0x26')](removeEntity(_0x48b9ed,null))[_0x6047('0x40')](handleError(_0x48b9ed,null));};exports['describe']=function(_0x182999,_0x325419){return db['FaxQueueReport'][_0x6047('0x49')]()[_0x6047('0x26')](respondWithResult(_0x325419,null))[_0x6047('0x40')](handleError(_0x325419,null));}; \ No newline at end of file +var _0xc6af=['util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','findAll','rows','params','include','catch','create','body','find','destroy','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x28e8ec,_0x1aa77b){var _0x561f2f=function(_0x31db27){while(--_0x31db27){_0x28e8ec['push'](_0x28e8ec['shift']());}};_0x561f2f(++_0x1aa77b);}(_0xc6af,0x131));var _0xfc6a=function(_0x2a16f4,_0x5a9b4f){_0x2a16f4=_0x2a16f4-0x0;var _0x593f72=_0xc6af[_0x2a16f4];return _0x593f72;};'use strict';var pdf=require(_0xfc6a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfc6a('0x1'));var zipdir=require(_0xfc6a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfc6a('0x3'));var moment=require(_0xfc6a('0x4'));var BPromise=require(_0xfc6a('0x5'));var Mustache=require(_0xfc6a('0x6'));var util=require(_0xfc6a('0x7'));var path=require(_0xfc6a('0x8'));var sox=require(_0xfc6a('0x9'));var csv=require(_0xfc6a('0xa'));var ejs=require(_0xfc6a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfc6a('0xc'));var jsforce=require(_0xfc6a('0xd'));var deskjs=require(_0xfc6a('0xe'));var toCsv=require(_0xfc6a('0xa'));var querystring=require(_0xfc6a('0xf'));var Papa=require(_0xfc6a('0x10'));var Redis=require(_0xfc6a('0x11'));var authService=require(_0xfc6a('0x12'));var qs=require(_0xfc6a('0x13'));var as=require(_0xfc6a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc6a('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xfc6a('0x16'));var licenseUtil=require(_0xfc6a('0x17'));var db=require(_0xfc6a('0x18'))['db'];function respondWithStatusCode(_0x4e83e0,_0x1056d4){_0x1056d4=_0x1056d4||0xcc;return function(_0x1d70c0){if(_0x1d70c0){return _0x4e83e0[_0xfc6a('0x19')](_0x1056d4);}return _0x4e83e0['status'](_0x1056d4)[_0xfc6a('0x1a')]();};}function respondWithResult(_0xc92471,_0x28495d){_0x28495d=_0x28495d||0xc8;return function(_0x59d080){if(_0x59d080){return _0xc92471[_0xfc6a('0x1b')](_0x28495d)[_0xfc6a('0x1c')](_0x59d080);}};}function respondWithFilteredResult(_0x5b1b29,_0x3906a5){return function(_0x379938){if(_0x379938){var _0xa9301b=_0x379938[_0xfc6a('0x1d')],_0x45ca37=_0x3906a5[_0xfc6a('0x1e')],_0x199cc0=_0x3906a5['offset']+_0x3906a5[_0xfc6a('0x1f')],_0xa1cc67;if(_0x199cc0>=_0xa9301b){_0x199cc0=_0xa9301b;_0xa1cc67=0xc8;}else{_0xa1cc67=0xce;}_0x5b1b29[_0xfc6a('0x1b')](_0xa1cc67);return _0x5b1b29[_0xfc6a('0x20')](_0xfc6a('0x21'),_0x45ca37+'-'+_0x199cc0+'/'+_0xa9301b)[_0xfc6a('0x1c')](_0x379938);}return null;};}function patchUpdates(_0x38394c){return function(_0x520b18){try{jsonpatch[_0xfc6a('0x22')](_0x520b18,_0x38394c,!![]);}catch(_0x4fa1c9){return BPromise[_0xfc6a('0x23')](_0x4fa1c9);}return _0x520b18[_0xfc6a('0x24')]();};}function saveUpdates(_0x4555a0,_0xe1330b){return function(_0xe2ad79){if(_0xe2ad79){return _0xe2ad79[_0xfc6a('0x25')](_0x4555a0)[_0xfc6a('0x26')](function(_0x3c9aca){return _0x3c9aca;});}return null;};}function removeEntity(_0x4d48be,_0x5e1f2d){return function(_0x9350e4){if(_0x9350e4){return _0x9350e4['destroy']()[_0xfc6a('0x26')](function(){_0x4d48be[_0xfc6a('0x1b')](0xcc)[_0xfc6a('0x1a')]();});}};}function handleEntityNotFound(_0x4fb0e8,_0x4e3dd7){return function(_0x1019ed){if(!_0x1019ed){_0x4fb0e8[_0xfc6a('0x19')](0x194);}return _0x1019ed;};}function handleError(_0x116ba2,_0x1e1b2){_0x1e1b2=_0x1e1b2||0x1f4;return function(_0x5d3e73){logger[_0xfc6a('0x27')](_0x5d3e73[_0xfc6a('0x28')]);if(_0x5d3e73['name']){delete _0x5d3e73['name'];}_0x116ba2[_0xfc6a('0x1b')](_0x1e1b2)[_0xfc6a('0x29')](_0x5d3e73);};}exports['index']=function(_0x29b467,_0x2f1cdb){var _0x226ee2={},_0x56be91={},_0x3fb331={'count':0x0,'rows':[]};var _0x3608fc=_[_0xfc6a('0x2a')](db[_0xfc6a('0x2b')][_0xfc6a('0x2c')],function(_0x2b7770){return{'name':_0x2b7770[_0xfc6a('0x2d')],'type':_0x2b7770[_0xfc6a('0x2e')][_0xfc6a('0x2f')]};});_0x56be91[_0xfc6a('0x30')]=_[_0xfc6a('0x2a')](_0x3608fc,'name');_0x56be91[_0xfc6a('0x31')]=_[_0xfc6a('0x32')](_0x29b467[_0xfc6a('0x31')]);_0x56be91[_0xfc6a('0x33')]=_[_0xfc6a('0x34')](_0x56be91['model'],_0x56be91[_0xfc6a('0x31')]);_0x226ee2[_0xfc6a('0x35')]=_[_0xfc6a('0x34')](_0x56be91[_0xfc6a('0x30')],qs[_0xfc6a('0x36')](_0x29b467[_0xfc6a('0x31')][_0xfc6a('0x36')]));_0x226ee2[_0xfc6a('0x35')]=_0x226ee2[_0xfc6a('0x35')][_0xfc6a('0x37')]?_0x226ee2[_0xfc6a('0x35')]:_0x56be91[_0xfc6a('0x30')];if(!_0x29b467['query'][_0xfc6a('0x38')](_0xfc6a('0x39'))){_0x226ee2['limit']=qs['limit'](_0x29b467[_0xfc6a('0x31')]['limit']);_0x226ee2[_0xfc6a('0x1e')]=qs[_0xfc6a('0x1e')](_0x29b467[_0xfc6a('0x31')]['offset']);}_0x226ee2[_0xfc6a('0x3a')]=qs[_0xfc6a('0x3b')](_0x29b467[_0xfc6a('0x31')][_0xfc6a('0x3b')]);_0x226ee2[_0xfc6a('0x3c')]=qs[_0xfc6a('0x33')](_[_0xfc6a('0x3d')](_0x29b467[_0xfc6a('0x31')],_0x56be91['filters']),_0x3608fc);if(_0x29b467['query'][_0xfc6a('0x3e')]){_0x226ee2[_0xfc6a('0x3c')]=_[_0xfc6a('0x3f')](_0x226ee2[_0xfc6a('0x3c')],{'$or':_[_0xfc6a('0x2a')](_0x3608fc,function(_0x3f0330){if(_0x3f0330['type']!==_0xfc6a('0x40')){var _0x5898fb={};_0x5898fb[_0x3f0330[_0xfc6a('0x41')]]={'$like':'%'+_0x29b467[_0xfc6a('0x31')]['filter']+'%'};return _0x5898fb;}})});}_0x226ee2=_[_0xfc6a('0x3f')]({},_0x226ee2,_0x29b467[_0xfc6a('0x42')]);var _0x1f7341={'where':_0x226ee2[_0xfc6a('0x3c')]};return db[_0xfc6a('0x2b')][_0xfc6a('0x1d')](_0x1f7341)[_0xfc6a('0x26')](function(_0x449183){_0x3fb331[_0xfc6a('0x1d')]=_0x449183;if(_0x29b467['query'][_0xfc6a('0x43')]){_0x226ee2['include']=[{'all':!![]}];}return db[_0xfc6a('0x2b')][_0xfc6a('0x44')](_0x226ee2);})[_0xfc6a('0x26')](function(_0x5bf07a){_0x3fb331[_0xfc6a('0x45')]=_0x5bf07a;return _0x3fb331;})[_0xfc6a('0x26')](respondWithFilteredResult(_0x2f1cdb,_0x226ee2))['catch'](handleError(_0x2f1cdb,null));};exports['show']=function(_0x41b3b2,_0x30fe34){var _0x316e66={'raw':!![],'where':{'id':_0x41b3b2[_0xfc6a('0x46')]['id']}},_0x25a018={};_0x25a018[_0xfc6a('0x30')]=_[_0xfc6a('0x32')](db[_0xfc6a('0x2b')]['rawAttributes']);_0x25a018[_0xfc6a('0x31')]=_[_0xfc6a('0x32')](_0x41b3b2[_0xfc6a('0x31')]);_0x25a018['filters']=_[_0xfc6a('0x34')](_0x25a018[_0xfc6a('0x30')],_0x25a018[_0xfc6a('0x31')]);_0x316e66['attributes']=_[_0xfc6a('0x34')](_0x25a018[_0xfc6a('0x30')],qs['fields'](_0x41b3b2[_0xfc6a('0x31')][_0xfc6a('0x36')]));_0x316e66[_0xfc6a('0x35')]=_0x316e66[_0xfc6a('0x35')][_0xfc6a('0x37')]?_0x316e66[_0xfc6a('0x35')]:_0x25a018[_0xfc6a('0x30')];if(_0x41b3b2[_0xfc6a('0x31')][_0xfc6a('0x43')]){_0x316e66[_0xfc6a('0x47')]=[{'all':!![]}];}_0x316e66=_[_0xfc6a('0x3f')]({},_0x316e66,_0x41b3b2[_0xfc6a('0x42')]);return db[_0xfc6a('0x2b')]['find'](_0x316e66)[_0xfc6a('0x26')](handleEntityNotFound(_0x30fe34,null))[_0xfc6a('0x26')](respondWithResult(_0x30fe34,null))[_0xfc6a('0x48')](handleError(_0x30fe34,null));};exports[_0xfc6a('0x49')]=function(_0x4dfce8,_0x2a3428){return db[_0xfc6a('0x2b')][_0xfc6a('0x49')](_0x4dfce8[_0xfc6a('0x4a')],{})['then'](respondWithResult(_0x2a3428,0xc9))['catch'](handleError(_0x2a3428,null));};exports[_0xfc6a('0x25')]=function(_0x49dc5f,_0x2f17d9){if(_0x49dc5f[_0xfc6a('0x4a')]['id']){delete _0x49dc5f['body']['id'];}return db['FaxQueueReport'][_0xfc6a('0x4b')]({'where':{'id':_0x49dc5f[_0xfc6a('0x46')]['id']}})['then'](handleEntityNotFound(_0x2f17d9,null))[_0xfc6a('0x26')](saveUpdates(_0x49dc5f[_0xfc6a('0x4a')],null))[_0xfc6a('0x26')](respondWithResult(_0x2f17d9,null))[_0xfc6a('0x48')](handleError(_0x2f17d9,null));};exports[_0xfc6a('0x4c')]=function(_0x2b0155,_0x4d0f72){return db['FaxQueueReport']['find']({'where':{'id':_0x2b0155[_0xfc6a('0x46')]['id']}})['then'](handleEntityNotFound(_0x4d0f72,null))['then'](removeEntity(_0x4d0f72,null))['catch'](handleError(_0x4d0f72,null));};exports[_0xfc6a('0x4d')]=function(_0x3b7ec7,_0x34ceb4){return db[_0xfc6a('0x2b')][_0xfc6a('0x4d')]()['then'](respondWithResult(_0x34ceb4,null))['catch'](handleError(_0x34ceb4,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 3ede153..dc7f866 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 _0x3035=['rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','util','api','moment','path'];(function(_0x3ac7b9,_0x87900c){var _0x44f569=function(_0x28f8e4){while(--_0x28f8e4){_0x3ac7b9['push'](_0x3ac7b9['shift']());}};_0x44f569(++_0x87900c);}(_0x3035,0x16e));var _0x5303=function(_0x14f0aa,_0x381620){_0x14f0aa=_0x14f0aa-0x0;var _0x5006f0=_0x3035[_0x14f0aa];return _0x5006f0;};'use strict';var _=require('lodash');var util=require(_0x5303('0x0'));var logger=require('../../config/logger')(_0x5303('0x1'));var moment=require(_0x5303('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5303('0x3'));var rimraf=require(_0x5303('0x4'));var config=require('../../config/environment');var attributes=require(_0x5303('0x5'));module[_0x5303('0x6')]=function(_0x6d26a5,_0x4a766b){return _0x6d26a5[_0x5303('0x7')](_0x5303('0x8'),attributes,{'tableName':_0x5303('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x59e3=['./faxQueueReport.attributes','define','FaxQueueReport','report_fax_queue','uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x59e3,0xd5));var _0x359e=function(_0x17c56d,_0x1f6089){_0x17c56d=_0x17c56d-0x0;var _0x3e90fc=_0x59e3[_0x17c56d];return _0x3e90fc;};'use strict';var _=require('lodash');var util=require(_0x359e('0x0'));var logger=require(_0x359e('0x1'))(_0x359e('0x2'));var moment=require(_0x359e('0x3'));var BPromise=require('bluebird');var rp=require(_0x359e('0x4'));var fs=require('fs');var path=require(_0x359e('0x5'));var rimraf=require(_0x359e('0x6'));var config=require(_0x359e('0x7'));var attributes=require(_0x359e('0x8'));module['exports']=function(_0x127291,_0x3036c4){return _0x127291[_0x359e('0x9')](_0x359e('0xa'),attributes,{'tableName':_0x359e('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x359e('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 01c1386..aec2e00 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 _0x9a1b=['update','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','debug','stringify','UpdateFaxQueueReport'];(function(_0x1477fd,_0x331b40){var _0x770335=function(_0x1fb278){while(--_0x1fb278){_0x1477fd['push'](_0x1477fd['shift']());}};_0x770335(++_0x331b40);}(_0x9a1b,0xf9));var _0xb9a1=function(_0x388fba,_0x2da98c){_0x388fba=_0x388fba-0x0;var _0x134d03=_0x9a1b[_0x388fba];return _0x134d03;};'use strict';var _=require(_0xb9a1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb9a1('0x1'));var rs=require(_0xb9a1('0x2'));var fs=require('fs');var Redis=require(_0xb9a1('0x3'));var db=require(_0xb9a1('0x4'))['db'];var utils=require(_0xb9a1('0x5'));var logger=require(_0xb9a1('0x6'))('rpc');var config=require(_0xb9a1('0x7'));var jayson=require(_0xb9a1('0x8'));var client=jayson[_0xb9a1('0x9')][_0xb9a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57d2be,_0x567bb5,_0x4b1b29){return new BPromise(function(_0x18d40d,_0x573ac5){return client['request'](_0x57d2be,_0x4b1b29)[_0xb9a1('0xb')](function(_0x3eb6fa){logger[_0xb9a1('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x567bb5,_0xb9a1('0xd'));logger['debug'](_0xb9a1('0xe'),_0x567bb5,'request\x20sent',JSON['stringify'](_0x3eb6fa));if(_0x3eb6fa['error']){if(_0x3eb6fa[_0xb9a1('0xf')][_0xb9a1('0x10')]===0x1f4){logger[_0xb9a1('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x567bb5,_0x3eb6fa[_0xb9a1('0xf')][_0xb9a1('0x11')]);return _0x573ac5(_0x3eb6fa[_0xb9a1('0xf')][_0xb9a1('0x11')]);}logger['error'](_0xb9a1('0x12'),_0x567bb5,_0x3eb6fa[_0xb9a1('0xf')][_0xb9a1('0x11')]);return _0x18d40d(_0x3eb6fa['error']['message']);}else{logger[_0xb9a1('0xc')](_0xb9a1('0x12'),_0x567bb5,'request\x20sent');_0x18d40d(_0x3eb6fa[_0xb9a1('0x13')][_0xb9a1('0x11')]);}})[_0xb9a1('0x14')](function(_0x336c62){logger[_0xb9a1('0xf')](_0xb9a1('0x12'),_0x567bb5,_0x336c62);_0x573ac5(_0x336c62);});});}exports['CreateFaxQueueReport']=function(_0x5e39c5){var _0xd189a1=this;return new Promise(function(_0x3e20df,_0x4fd92d){return db[_0xb9a1('0x15')][_0xb9a1('0x16')](_0x5e39c5[_0xb9a1('0x17')],{'raw':_0x5e39c5[_0xb9a1('0x18')]?_0x5e39c5[_0xb9a1('0x18')][_0xb9a1('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1305f2){logger[_0xb9a1('0xc')](_0xb9a1('0x1a'),_0x5e39c5);logger[_0xb9a1('0x1b')](_0xb9a1('0x1a'),_0x5e39c5,JSON[_0xb9a1('0x1c')](_0x1305f2));_0x3e20df(_0x1305f2);})[_0xb9a1('0x14')](function(_0x404bd7){logger[_0xb9a1('0xf')](_0xb9a1('0x1a'),_0x404bd7[_0xb9a1('0x11')],_0x5e39c5);_0x4fd92d(_0xd189a1[_0xb9a1('0xf')](0x1f4,_0x404bd7['message']));});});};exports[_0xb9a1('0x1d')]=function(_0x48e0da){var _0x560e80=this;return new Promise(function(_0x25723d,_0x761374){return db[_0xb9a1('0x15')][_0xb9a1('0x1e')](_0x48e0da['body'],{'raw':_0x48e0da['options']?_0x48e0da[_0xb9a1('0x18')][_0xb9a1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48e0da[_0xb9a1('0x18')]?_0x48e0da[_0xb9a1('0x18')]['where']||null:null,'attributes':_0x48e0da[_0xb9a1('0x18')]?_0x48e0da['options']['attributes']||null:null,'limit':_0x48e0da[_0xb9a1('0x18')]?_0x48e0da[_0xb9a1('0x18')]['limit']||null:null})['then'](function(_0x446f68){logger[_0xb9a1('0xc')](_0xb9a1('0x1d'),_0x48e0da);logger[_0xb9a1('0x1b')](_0xb9a1('0x1d'),_0x48e0da,JSON[_0xb9a1('0x1c')](_0x446f68));_0x25723d(_0x446f68);})[_0xb9a1('0x14')](function(_0x4d978b){logger[_0xb9a1('0xf')](_0xb9a1('0x1d'),_0x4d978b[_0xb9a1('0x11')],_0x48e0da);_0x761374(_0x560e80[_0xb9a1('0xf')](0x1f4,_0x4d978b['message']));});});}; \ No newline at end of file +var _0x2165=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','where','limit','then','lodash'];(function(_0x25adc9,_0x1cb630){var _0x5d3ea6=function(_0x354862){while(--_0x354862){_0x25adc9['push'](_0x25adc9['shift']());}};_0x5d3ea6(++_0x1cb630);}(_0x2165,0x1ac));var _0x5216=function(_0x554de9,_0x4b1bd2){_0x554de9=_0x554de9-0x0;var _0x2bcb4f=_0x2165[_0x554de9];return _0x2bcb4f;};'use strict';var _=require(_0x5216('0x0'));var util=require(_0x5216('0x1'));var moment=require(_0x5216('0x2'));var BPromise=require(_0x5216('0x3'));var rs=require(_0x5216('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5216('0x5'))['db'];var utils=require(_0x5216('0x6'));var logger=require(_0x5216('0x7'))('rpc');var config=require(_0x5216('0x8'));var jayson=require(_0x5216('0x9'));var client=jayson[_0x5216('0xa')][_0x5216('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c6a2a,_0x2e9d3a,_0x46aeae){return new BPromise(function(_0xc5df82,_0xd111e2){return client[_0x5216('0xc')](_0x2c6a2a,_0x46aeae)['then'](function(_0x5e025a){logger[_0x5216('0xd')](_0x5216('0xe'),_0x2e9d3a,'request\x20sent');logger[_0x5216('0xf')](_0x5216('0x10'),_0x2e9d3a,_0x5216('0x11'),JSON[_0x5216('0x12')](_0x5e025a));if(_0x5e025a[_0x5216('0x13')]){if(_0x5e025a[_0x5216('0x13')]['code']===0x1f4){logger['error'](_0x5216('0xe'),_0x2e9d3a,_0x5e025a['error'][_0x5216('0x14')]);return _0xd111e2(_0x5e025a[_0x5216('0x13')][_0x5216('0x14')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x2e9d3a,_0x5e025a[_0x5216('0x13')][_0x5216('0x14')]);return _0xc5df82(_0x5e025a[_0x5216('0x13')][_0x5216('0x14')]);}else{logger[_0x5216('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x2e9d3a,_0x5216('0x11'));_0xc5df82(_0x5e025a['result']['message']);}})[_0x5216('0x15')](function(_0x20d206){logger[_0x5216('0x13')](_0x5216('0xe'),_0x2e9d3a,_0x20d206);_0xd111e2(_0x20d206);});});}exports[_0x5216('0x16')]=function(_0xd0d10d){var _0x410179=this;return new Promise(function(_0x362b23,_0x5d03af){return db[_0x5216('0x17')][_0x5216('0x18')](_0xd0d10d[_0x5216('0x19')],{'raw':_0xd0d10d[_0x5216('0x1a')]?_0xd0d10d['options'][_0x5216('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x12906e){logger['info'](_0x5216('0x16'),_0xd0d10d);logger[_0x5216('0xf')]('CreateFaxQueueReport',_0xd0d10d,JSON['stringify'](_0x12906e));_0x362b23(_0x12906e);})[_0x5216('0x15')](function(_0x3a7fe2){logger[_0x5216('0x13')]('CreateFaxQueueReport',_0x3a7fe2['message'],_0xd0d10d);_0x5d03af(_0x410179['error'](0x1f4,_0x3a7fe2[_0x5216('0x14')]));});});};exports[_0x5216('0x1c')]=function(_0x4edac0){var _0x33d103=this;return new Promise(function(_0x299f77,_0x45b430){return db[_0x5216('0x17')][_0x5216('0x1d')](_0x4edac0[_0x5216('0x19')],{'raw':_0x4edac0[_0x5216('0x1a')]?_0x4edac0[_0x5216('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4edac0['options']?_0x4edac0[_0x5216('0x1a')][_0x5216('0x1e')]||null:null,'attributes':_0x4edac0[_0x5216('0x1a')]?_0x4edac0[_0x5216('0x1a')]['attributes']||null:null,'limit':_0x4edac0['options']?_0x4edac0[_0x5216('0x1a')][_0x5216('0x1f')]||null:null})[_0x5216('0x20')](function(_0x2ae989){logger[_0x5216('0xd')](_0x5216('0x1c'),_0x4edac0);logger['debug'](_0x5216('0x1c'),_0x4edac0,JSON['stringify'](_0x2ae989));_0x299f77(_0x2ae989);})[_0x5216('0x15')](function(_0x31bb8b){logger[_0x5216('0x13')](_0x5216('0x1c'),_0x31bb8b['message'],_0x4edac0);_0x45b430(_0x33d103[_0x5216('0x13')](0x1f4,_0x31bb8b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index e8996d8..13d9565 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 _0x0711=['/:id','show','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./faxQueueReport.controller','get','/describe','isAuthenticated','describe'];(function(_0x30f3da,_0x43498d){var _0x474453=function(_0x489c40){while(--_0x489c40){_0x30f3da['push'](_0x30f3da['shift']());}};_0x474453(++_0x43498d);}(_0x0711,0x124));var _0x1071=function(_0xab949f,_0x13de04){_0xab949f=_0xab949f-0x0;var _0x28ae21=_0x0711[_0xab949f];return _0x28ae21;};'use strict';var multer=require(_0x1071('0x0'));var util=require(_0x1071('0x1'));var path=require(_0x1071('0x2'));var timeout=require(_0x1071('0x3'));var express=require(_0x1071('0x4'));var router=express[_0x1071('0x5')]();var auth=require(_0x1071('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1071('0x7'));router[_0x1071('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1071('0x8')](_0x1071('0x9'),auth[_0x1071('0xa')](),controller[_0x1071('0xb')]);router[_0x1071('0x8')](_0x1071('0xc'),auth['isAuthenticated'](),controller[_0x1071('0xd')]);router['post']('/',auth[_0x1071('0xa')](),controller['create']);router['put'](_0x1071('0xc'),auth['isAuthenticated'](),controller[_0x1071('0xe')]);router['delete'](_0x1071('0xc'),auth[_0x1071('0xa')](),controller[_0x1071('0xf')]);module['exports']=router; \ No newline at end of file +var _0x8aa9=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8aa9,0xca));var _0x98aa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8aa9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x98aa('0x0'));var path=require(_0x98aa('0x1'));var timeout=require(_0x98aa('0x2'));var express=require(_0x98aa('0x3'));var router=express[_0x98aa('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x98aa('0x5'));var controller=require(_0x98aa('0x6'));router[_0x98aa('0x7')]('/',auth[_0x98aa('0x8')](),controller[_0x98aa('0x9')]);router[_0x98aa('0x7')](_0x98aa('0xa'),auth[_0x98aa('0x8')](),controller[_0x98aa('0xb')]);router['get'](_0x98aa('0xc'),auth[_0x98aa('0x8')](),controller['show']);router[_0x98aa('0xd')]('/',auth[_0x98aa('0x8')](),controller['create']);router['put'](_0x98aa('0xc'),auth['isAuthenticated'](),controller[_0x98aa('0xe')]);router[_0x98aa('0xf')](_0x98aa('0xc'),auth[_0x98aa('0x8')](),controller[_0x98aa('0x10')]);module[_0x98aa('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 7831a0b..895044b 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 _0x647b=['ENUM','account','queue','NOW','moment','STRING'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x647b,0x8e));var _0xb647=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x647b[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0xb647('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xb647('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb647('0x2')](_0xb647('0x3'),'agent',_0xb647('0x4')),'allowNull':![],'defaultValue':_0xb647('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xb647('0x5')]}}; \ No newline at end of file +var _0xe060=['ENUM','queue','DATE','NOW','moment','STRING'];(function(_0x542199,_0x5c9c87){var _0x12ffef=function(_0xf13b48){while(--_0xf13b48){_0x542199['push'](_0x542199['shift']());}};_0x12ffef(++_0x5c9c87);}(_0xe060,0x1cc));var _0x0e06=function(_0x4d78e3,_0x231342){_0x4d78e3=_0x4d78e3-0x0;var _0x3b0ee4=_0xe060[_0x4d78e3];return _0x3b0ee4;};'use strict';var moment=require(_0x0e06('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0e06('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0e06('0x2')]('account','agent',_0x0e06('0x3')),'allowNull':![],'defaultValue':_0x0e06('0x3')},'transferredAt':{'type':Sequelize[_0x0e06('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x0e06('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index daaba83..bfce96f 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 _0xa23f=['json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','status','sendStatus','error','stack','name','send','map','FaxTransferReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa23f,0x7c));var _0xfa23=function(_0x4cdac7,_0x4110a6){_0x4cdac7=_0x4cdac7-0x0;var _0x217b1d=_0xa23f[_0x4cdac7];return _0x217b1d;};'use strict';var pdf=require(_0xfa23('0x0'));var emlformat=require(_0xfa23('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfa23('0x2'));var rp=require(_0xfa23('0x3'));var moment=require(_0xfa23('0x4'));var BPromise=require(_0xfa23('0x5'));var Mustache=require('mustache');var util=require(_0xfa23('0x6'));var path=require('path');var sox=require(_0xfa23('0x7'));var csv=require(_0xfa23('0x8'));var ejs=require(_0xfa23('0x9'));var fs=require('fs');var _=require(_0xfa23('0xa'));var squel=require('squel');var crypto=require(_0xfa23('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfa23('0xc'));var toCsv=require(_0xfa23('0x8'));var querystring=require(_0xfa23('0xd'));var Papa=require(_0xfa23('0xe'));var Redis=require(_0xfa23('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa23('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa23('0x11'))('api');var utils=require(_0xfa23('0x12'));var config=require(_0xfa23('0x13'));var licenseUtil=require(_0xfa23('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e5ffe,_0x42380){_0x42380=_0x42380||0xcc;return function(_0x46f991){if(_0x46f991){return _0x1e5ffe['sendStatus'](_0x42380);}return _0x1e5ffe['status'](_0x42380)[_0xfa23('0x15')]();};}function respondWithResult(_0x23712b,_0x3f50f0){_0x3f50f0=_0x3f50f0||0xc8;return function(_0x36252c){if(_0x36252c){return _0x23712b['status'](_0x3f50f0)[_0xfa23('0x16')](_0x36252c);}};}function respondWithFilteredResult(_0xb7d11a,_0x2095a5){return function(_0x9611e0){if(_0x9611e0){var _0x542d9a=_0x9611e0[_0xfa23('0x17')],_0x1c4882=_0x2095a5[_0xfa23('0x18')],_0x39729e=_0x2095a5['offset']+_0x2095a5['limit'],_0x3ca6be;if(_0x39729e>=_0x542d9a){_0x39729e=_0x542d9a;_0x3ca6be=0xc8;}else{_0x3ca6be=0xce;}_0xb7d11a['status'](_0x3ca6be);return _0xb7d11a[_0xfa23('0x19')](_0xfa23('0x1a'),_0x1c4882+'-'+_0x39729e+'/'+_0x542d9a)['json'](_0x9611e0);}return null;};}function patchUpdates(_0x9effe6){return function(_0x2c456b){try{jsonpatch[_0xfa23('0x1b')](_0x2c456b,_0x9effe6,!![]);}catch(_0x54bb04){return BPromise[_0xfa23('0x1c')](_0x54bb04);}return _0x2c456b[_0xfa23('0x1d')]();};}function saveUpdates(_0x47c323,_0x16e4f9){return function(_0x2a900c){if(_0x2a900c){return _0x2a900c[_0xfa23('0x1e')](_0x47c323)[_0xfa23('0x1f')](function(_0x2ce89a){return _0x2ce89a;});}return null;};}function removeEntity(_0x10ef95,_0x31eedb){return function(_0x485838){if(_0x485838){return _0x485838[_0xfa23('0x20')]()[_0xfa23('0x1f')](function(){_0x10ef95[_0xfa23('0x21')](0xcc)[_0xfa23('0x15')]();});}};}function handleEntityNotFound(_0x542cde,_0x4500a2){return function(_0x511a93){if(!_0x511a93){_0x542cde[_0xfa23('0x22')](0x194);}return _0x511a93;};}function handleError(_0x1abb42,_0x2481e9){_0x2481e9=_0x2481e9||0x1f4;return function(_0x26bdce){logger[_0xfa23('0x23')](_0x26bdce[_0xfa23('0x24')]);if(_0x26bdce[_0xfa23('0x25')]){delete _0x26bdce[_0xfa23('0x25')];}_0x1abb42['status'](_0x2481e9)[_0xfa23('0x26')](_0x26bdce);};}exports['index']=function(_0x1ae38a,_0x5de208){var _0x4ea972={},_0x35b493={},_0x1a9a90={'count':0x0,'rows':[]};var _0xbf9d19=_[_0xfa23('0x27')](db[_0xfa23('0x28')][_0xfa23('0x29')],function(_0x3c9d9d){return{'name':_0x3c9d9d['fieldName'],'type':_0x3c9d9d[_0xfa23('0x2a')]['key']};});_0x35b493[_0xfa23('0x2b')]=_[_0xfa23('0x27')](_0xbf9d19,'name');_0x35b493[_0xfa23('0x2c')]=_[_0xfa23('0x2d')](_0x1ae38a[_0xfa23('0x2c')]);_0x35b493[_0xfa23('0x2e')]=_[_0xfa23('0x2f')](_0x35b493[_0xfa23('0x2b')],_0x35b493[_0xfa23('0x2c')]);_0x4ea972[_0xfa23('0x30')]=_[_0xfa23('0x2f')](_0x35b493['model'],qs[_0xfa23('0x31')](_0x1ae38a['query'][_0xfa23('0x31')]));_0x4ea972[_0xfa23('0x30')]=_0x4ea972[_0xfa23('0x30')][_0xfa23('0x32')]?_0x4ea972[_0xfa23('0x30')]:_0x35b493[_0xfa23('0x2b')];if(!_0x1ae38a[_0xfa23('0x2c')][_0xfa23('0x33')](_0xfa23('0x34'))){_0x4ea972['limit']=qs[_0xfa23('0x35')](_0x1ae38a['query'][_0xfa23('0x35')]);_0x4ea972[_0xfa23('0x18')]=qs[_0xfa23('0x18')](_0x1ae38a[_0xfa23('0x2c')][_0xfa23('0x18')]);}_0x4ea972[_0xfa23('0x36')]=qs[_0xfa23('0x37')](_0x1ae38a['query'][_0xfa23('0x37')]);_0x4ea972[_0xfa23('0x38')]=qs[_0xfa23('0x2e')](_[_0xfa23('0x39')](_0x1ae38a['query'],_0x35b493['filters']),_0xbf9d19);if(_0x1ae38a['query'][_0xfa23('0x3a')]){_0x4ea972[_0xfa23('0x38')]=_['merge'](_0x4ea972[_0xfa23('0x38')],{'$or':_[_0xfa23('0x27')](_0xbf9d19,function(_0x9d0ca0){if(_0x9d0ca0['type']!==_0xfa23('0x3b')){var _0x59361e={};_0x59361e[_0x9d0ca0[_0xfa23('0x25')]]={'$like':'%'+_0x1ae38a[_0xfa23('0x2c')][_0xfa23('0x3a')]+'%'};return _0x59361e;}})});}_0x4ea972=_[_0xfa23('0x3c')]({},_0x4ea972,_0x1ae38a[_0xfa23('0x3d')]);var _0x80827f={'where':_0x4ea972['where']};return db[_0xfa23('0x28')][_0xfa23('0x17')](_0x80827f)[_0xfa23('0x1f')](function(_0x245f49){_0x1a9a90['count']=_0x245f49;if(_0x1ae38a[_0xfa23('0x2c')][_0xfa23('0x3e')]){_0x4ea972[_0xfa23('0x3f')]=[{'all':!![]}];}return db[_0xfa23('0x28')][_0xfa23('0x40')](_0x4ea972);})[_0xfa23('0x1f')](function(_0x493d36){_0x1a9a90[_0xfa23('0x41')]=_0x493d36;return _0x1a9a90;})['then'](respondWithFilteredResult(_0x5de208,_0x4ea972))['catch'](handleError(_0x5de208,null));};exports[_0xfa23('0x42')]=function(_0x1117ef,_0x5937e0){var _0x603fd9={'raw':!![],'where':{'id':_0x1117ef[_0xfa23('0x43')]['id']}},_0x20c88c={};_0x20c88c['model']=_[_0xfa23('0x2d')](db[_0xfa23('0x28')][_0xfa23('0x29')]);_0x20c88c['query']=_['keys'](_0x1117ef[_0xfa23('0x2c')]);_0x20c88c['filters']=_[_0xfa23('0x2f')](_0x20c88c[_0xfa23('0x2b')],_0x20c88c[_0xfa23('0x2c')]);_0x603fd9['attributes']=_[_0xfa23('0x2f')](_0x20c88c[_0xfa23('0x2b')],qs[_0xfa23('0x31')](_0x1117ef[_0xfa23('0x2c')]['fields']));_0x603fd9[_0xfa23('0x30')]=_0x603fd9[_0xfa23('0x30')][_0xfa23('0x32')]?_0x603fd9['attributes']:_0x20c88c['model'];if(_0x1117ef[_0xfa23('0x2c')]['includeAll']){_0x603fd9[_0xfa23('0x3f')]=[{'all':!![]}];}_0x603fd9=_[_0xfa23('0x3c')]({},_0x603fd9,_0x1117ef[_0xfa23('0x3d')]);return db[_0xfa23('0x28')][_0xfa23('0x44')](_0x603fd9)[_0xfa23('0x1f')](handleEntityNotFound(_0x5937e0,null))['then'](respondWithResult(_0x5937e0,null))[_0xfa23('0x45')](handleError(_0x5937e0,null));};exports[_0xfa23('0x46')]=function(_0x36a795,_0x714255){return db[_0xfa23('0x28')][_0xfa23('0x46')](_0x36a795['body'],{})[_0xfa23('0x1f')](respondWithResult(_0x714255,0xc9))[_0xfa23('0x45')](handleError(_0x714255,null));};exports[_0xfa23('0x1e')]=function(_0x2f6a37,_0x107d27){if(_0x2f6a37['body']['id']){delete _0x2f6a37[_0xfa23('0x47')]['id'];}return db[_0xfa23('0x28')][_0xfa23('0x44')]({'where':{'id':_0x2f6a37['params']['id']}})[_0xfa23('0x1f')](handleEntityNotFound(_0x107d27,null))[_0xfa23('0x1f')](saveUpdates(_0x2f6a37[_0xfa23('0x47')],null))[_0xfa23('0x1f')](respondWithResult(_0x107d27,null))[_0xfa23('0x45')](handleError(_0x107d27,null));};exports[_0xfa23('0x20')]=function(_0x709755,_0x50bae3){return db[_0xfa23('0x28')]['find']({'where':{'id':_0x709755[_0xfa23('0x43')]['id']}})[_0xfa23('0x1f')](handleEntityNotFound(_0x50bae3,null))[_0xfa23('0x1f')](removeEntity(_0x50bae3,null))[_0xfa23('0x45')](handleError(_0x50bae3,null));};exports[_0xfa23('0x48')]=function(_0x1eb83b,_0x4c6962){return db[_0xfa23('0x28')][_0xfa23('0x48')]()[_0xfa23('0x1f')](respondWithResult(_0x4c6962,null))[_0xfa23('0x45')](handleError(_0x4c6962,null));}; \ No newline at end of file +var _0xf693=['filters','filter','merge','VIRTUAL','count','include','rows','keys','includeAll','catch','create','body','find','params','describe','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','limit','apply','reject','save','update','then','destroy','status','error','name','send','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick'];(function(_0x786d5b,_0x54c7d6){var _0x20755a=function(_0x525742){while(--_0x525742){_0x786d5b['push'](_0x786d5b['shift']());}};_0x20755a(++_0x54c7d6);}(_0xf693,0x181));var _0x3f69=function(_0x4c3a6e,_0x331b41){_0x4c3a6e=_0x4c3a6e-0x0;var _0x923fb8=_0xf693[_0x4c3a6e];return _0x923fb8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3f69('0x0'));var rimraf=require(_0x3f69('0x1'));var zipdir=require(_0x3f69('0x2'));var jsonpatch=require(_0x3f69('0x3'));var rp=require(_0x3f69('0x4'));var moment=require(_0x3f69('0x5'));var BPromise=require(_0x3f69('0x6'));var Mustache=require('mustache');var util=require(_0x3f69('0x7'));var path=require(_0x3f69('0x8'));var sox=require(_0x3f69('0x9'));var csv=require(_0x3f69('0xa'));var ejs=require(_0x3f69('0xb'));var fs=require('fs');var _=require(_0x3f69('0xc'));var squel=require(_0x3f69('0xd'));var crypto=require(_0x3f69('0xe'));var jsforce=require(_0x3f69('0xf'));var deskjs=require(_0x3f69('0x10'));var toCsv=require(_0x3f69('0xa'));var querystring=require(_0x3f69('0x11'));var Papa=require(_0x3f69('0x12'));var Redis=require(_0x3f69('0x13'));var authService=require(_0x3f69('0x14'));var qs=require(_0x3f69('0x15'));var as=require(_0x3f69('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f69('0x17'))(_0x3f69('0x18'));var utils=require(_0x3f69('0x19'));var config=require(_0x3f69('0x1a'));var licenseUtil=require(_0x3f69('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37f1e5,_0x17a969){_0x17a969=_0x17a969||0xcc;return function(_0x5db35d){if(_0x5db35d){return _0x37f1e5[_0x3f69('0x1c')](_0x17a969);}return _0x37f1e5['status'](_0x17a969)['end']();};}function respondWithResult(_0x346b05,_0xfea064){_0xfea064=_0xfea064||0xc8;return function(_0x353520){if(_0x353520){return _0x346b05['status'](_0xfea064)[_0x3f69('0x1d')](_0x353520);}};}function respondWithFilteredResult(_0x36c945,_0x596f47){return function(_0x37fe06){if(_0x37fe06){var _0x26cce7=_0x37fe06['count'],_0x2adfd4=_0x596f47['offset'],_0x44ae7b=_0x596f47['offset']+_0x596f47[_0x3f69('0x1e')],_0x18f60a;if(_0x44ae7b>=_0x26cce7){_0x44ae7b=_0x26cce7;_0x18f60a=0xc8;}else{_0x18f60a=0xce;}_0x36c945['status'](_0x18f60a);return _0x36c945['set']('Content-Range',_0x2adfd4+'-'+_0x44ae7b+'/'+_0x26cce7)[_0x3f69('0x1d')](_0x37fe06);}return null;};}function patchUpdates(_0x4c43d3){return function(_0x278d26){try{jsonpatch[_0x3f69('0x1f')](_0x278d26,_0x4c43d3,!![]);}catch(_0x1684f7){return BPromise[_0x3f69('0x20')](_0x1684f7);}return _0x278d26[_0x3f69('0x21')]();};}function saveUpdates(_0x1b3e7f,_0x123431){return function(_0x5d868c){if(_0x5d868c){return _0x5d868c[_0x3f69('0x22')](_0x1b3e7f)[_0x3f69('0x23')](function(_0x1e99eb){return _0x1e99eb;});}return null;};}function removeEntity(_0x461aa9,_0x35dae8){return function(_0xf86e31){if(_0xf86e31){return _0xf86e31[_0x3f69('0x24')]()['then'](function(){_0x461aa9[_0x3f69('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a7d58,_0x4ee5fd){return function(_0x3e0946){if(!_0x3e0946){_0x3a7d58['sendStatus'](0x194);}return _0x3e0946;};}function handleError(_0x437fd8,_0x4d5fbd){_0x4d5fbd=_0x4d5fbd||0x1f4;return function(_0x3bd034){logger[_0x3f69('0x26')](_0x3bd034['stack']);if(_0x3bd034[_0x3f69('0x27')]){delete _0x3bd034[_0x3f69('0x27')];}_0x437fd8['status'](_0x4d5fbd)[_0x3f69('0x28')](_0x3bd034);};}exports['index']=function(_0x42c056,_0x3c1d3d){var _0x39dcee={},_0x41d6f0={},_0x30c65a={'count':0x0,'rows':[]};var _0x2c9dc4=_[_0x3f69('0x29')](db[_0x3f69('0x2a')][_0x3f69('0x2b')],function(_0x16860e){return{'name':_0x16860e[_0x3f69('0x2c')],'type':_0x16860e[_0x3f69('0x2d')][_0x3f69('0x2e')]};});_0x41d6f0[_0x3f69('0x2f')]=_[_0x3f69('0x29')](_0x2c9dc4,'name');_0x41d6f0['query']=_['keys'](_0x42c056[_0x3f69('0x30')]);_0x41d6f0['filters']=_[_0x3f69('0x31')](_0x41d6f0[_0x3f69('0x2f')],_0x41d6f0[_0x3f69('0x30')]);_0x39dcee[_0x3f69('0x32')]=_[_0x3f69('0x31')](_0x41d6f0[_0x3f69('0x2f')],qs[_0x3f69('0x33')](_0x42c056[_0x3f69('0x30')][_0x3f69('0x33')]));_0x39dcee[_0x3f69('0x32')]=_0x39dcee['attributes'][_0x3f69('0x34')]?_0x39dcee[_0x3f69('0x32')]:_0x41d6f0['model'];if(!_0x42c056[_0x3f69('0x30')][_0x3f69('0x35')](_0x3f69('0x36'))){_0x39dcee[_0x3f69('0x1e')]=qs[_0x3f69('0x1e')](_0x42c056[_0x3f69('0x30')]['limit']);_0x39dcee['offset']=qs[_0x3f69('0x37')](_0x42c056[_0x3f69('0x30')][_0x3f69('0x37')]);}_0x39dcee['order']=qs[_0x3f69('0x38')](_0x42c056[_0x3f69('0x30')][_0x3f69('0x38')]);_0x39dcee[_0x3f69('0x39')]=qs['filters'](_[_0x3f69('0x3a')](_0x42c056[_0x3f69('0x30')],_0x41d6f0[_0x3f69('0x3b')]),_0x2c9dc4);if(_0x42c056['query'][_0x3f69('0x3c')]){_0x39dcee[_0x3f69('0x39')]=_[_0x3f69('0x3d')](_0x39dcee[_0x3f69('0x39')],{'$or':_[_0x3f69('0x29')](_0x2c9dc4,function(_0x95658a){if(_0x95658a[_0x3f69('0x2d')]!==_0x3f69('0x3e')){var _0x2e243d={};_0x2e243d[_0x95658a[_0x3f69('0x27')]]={'$like':'%'+_0x42c056[_0x3f69('0x30')][_0x3f69('0x3c')]+'%'};return _0x2e243d;}})});}_0x39dcee=_[_0x3f69('0x3d')]({},_0x39dcee,_0x42c056['options']);var _0x494b69={'where':_0x39dcee[_0x3f69('0x39')]};return db[_0x3f69('0x2a')]['count'](_0x494b69)[_0x3f69('0x23')](function(_0x43aeed){_0x30c65a[_0x3f69('0x3f')]=_0x43aeed;if(_0x42c056[_0x3f69('0x30')]['includeAll']){_0x39dcee[_0x3f69('0x40')]=[{'all':!![]}];}return db[_0x3f69('0x2a')]['findAll'](_0x39dcee);})[_0x3f69('0x23')](function(_0x54bb87){_0x30c65a[_0x3f69('0x41')]=_0x54bb87;return _0x30c65a;})[_0x3f69('0x23')](respondWithFilteredResult(_0x3c1d3d,_0x39dcee))['catch'](handleError(_0x3c1d3d,null));};exports['show']=function(_0x21b592,_0x4a12c1){var _0x274c6e={'raw':!![],'where':{'id':_0x21b592['params']['id']}},_0x234c21={};_0x234c21['model']=_[_0x3f69('0x42')](db[_0x3f69('0x2a')]['rawAttributes']);_0x234c21['query']=_[_0x3f69('0x42')](_0x21b592[_0x3f69('0x30')]);_0x234c21[_0x3f69('0x3b')]=_[_0x3f69('0x31')](_0x234c21[_0x3f69('0x2f')],_0x234c21[_0x3f69('0x30')]);_0x274c6e[_0x3f69('0x32')]=_[_0x3f69('0x31')](_0x234c21['model'],qs['fields'](_0x21b592[_0x3f69('0x30')][_0x3f69('0x33')]));_0x274c6e[_0x3f69('0x32')]=_0x274c6e['attributes'][_0x3f69('0x34')]?_0x274c6e['attributes']:_0x234c21[_0x3f69('0x2f')];if(_0x21b592['query'][_0x3f69('0x43')]){_0x274c6e['include']=[{'all':!![]}];}_0x274c6e=_[_0x3f69('0x3d')]({},_0x274c6e,_0x21b592['options']);return db['FaxTransferReport']['find'](_0x274c6e)[_0x3f69('0x23')](handleEntityNotFound(_0x4a12c1,null))[_0x3f69('0x23')](respondWithResult(_0x4a12c1,null))[_0x3f69('0x44')](handleError(_0x4a12c1,null));};exports[_0x3f69('0x45')]=function(_0x35c25d,_0x1c1415){return db[_0x3f69('0x2a')][_0x3f69('0x45')](_0x35c25d[_0x3f69('0x46')],{})[_0x3f69('0x23')](respondWithResult(_0x1c1415,0xc9))[_0x3f69('0x44')](handleError(_0x1c1415,null));};exports[_0x3f69('0x22')]=function(_0x110074,_0x37e7f4){if(_0x110074[_0x3f69('0x46')]['id']){delete _0x110074[_0x3f69('0x46')]['id'];}return db[_0x3f69('0x2a')][_0x3f69('0x47')]({'where':{'id':_0x110074['params']['id']}})['then'](handleEntityNotFound(_0x37e7f4,null))[_0x3f69('0x23')](saveUpdates(_0x110074[_0x3f69('0x46')],null))[_0x3f69('0x23')](respondWithResult(_0x37e7f4,null))[_0x3f69('0x44')](handleError(_0x37e7f4,null));};exports['destroy']=function(_0x5de5d9,_0x304afa){return db[_0x3f69('0x2a')][_0x3f69('0x47')]({'where':{'id':_0x5de5d9[_0x3f69('0x48')]['id']}})[_0x3f69('0x23')](handleEntityNotFound(_0x304afa,null))['then'](removeEntity(_0x304afa,null))['catch'](handleError(_0x304afa,null));};exports[_0x3f69('0x49')]=function(_0x4cae4e,_0x4e6246){return db[_0x3f69('0x2a')]['describe']()[_0x3f69('0x23')](respondWithResult(_0x4e6246,null))[_0x3f69('0x44')](handleError(_0x4e6246,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 7e34395..2afb068 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 _0xbc62=['../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4e96a4,_0x36117c){var _0x3623d7=function(_0x27b790){while(--_0x27b790){_0x4e96a4['push'](_0x4e96a4['shift']());}};_0x3623d7(++_0x36117c);}(_0xbc62,0x125));var _0x2bc6=function(_0x3cacb2,_0x195f34){_0x3cacb2=_0x3cacb2-0x0;var _0xe7c64b=_0xbc62[_0x3cacb2];return _0xe7c64b;};'use strict';var _=require('lodash');var util=require(_0x2bc6('0x0'));var logger=require(_0x2bc6('0x1'))(_0x2bc6('0x2'));var moment=require(_0x2bc6('0x3'));var BPromise=require(_0x2bc6('0x4'));var rp=require(_0x2bc6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2bc6('0x6'));var config=require(_0x2bc6('0x7'));var attributes=require(_0x2bc6('0x8'));module[_0x2bc6('0x9')]=function(_0x275905,_0x5d689c){return _0x275905['define'](_0x2bc6('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x2bc6('0xb'),'fields':[_0x2bc6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd2d7=['uniqueid','lodash','util','bluebird','request-promise','path','rimraf','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0xe1d2a9,_0x5b2d76){var _0x44bd38=function(_0x5ad0cf){while(--_0x5ad0cf){_0xe1d2a9['push'](_0xe1d2a9['shift']());}};_0x44bd38(++_0x5b2d76);}(_0xd2d7,0x1f0));var _0x7d2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d2d('0x0'));var util=require(_0x7d2d('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7d2d('0x2'));var rp=require(_0x7d2d('0x3'));var fs=require('fs');var path=require(_0x7d2d('0x4'));var rimraf=require(_0x7d2d('0x5'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0x7d2d('0x6')]=function(_0x3546b0,_0x4b77ea){return _0x3546b0[_0x7d2d('0x7')](_0x7d2d('0x8'),attributes,{'tableName':_0x7d2d('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7d2d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index cc15b52..4161755 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 _0x0c91=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x340f94,_0x102081){var _0x2967fa=function(_0x2bbcb1){while(--_0x2bbcb1){_0x340f94['push'](_0x340f94['shift']());}};_0x2967fa(++_0x102081);}(_0x0c91,0xbe));var _0x10c9=function(_0x4ce816,_0x2db941){_0x4ce816=_0x4ce816-0x0;var _0x46a499=_0x0c91[_0x4ce816];return _0x46a499;};'use strict';var _=require(_0x10c9('0x0'));var util=require(_0x10c9('0x1'));var moment=require(_0x10c9('0x2'));var BPromise=require(_0x10c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10c9('0x4'));var db=require(_0x10c9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x10c9('0x6'));var config=require('../../config/environment');var jayson=require(_0x10c9('0x7'));var client=jayson[_0x10c9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13efc0,_0x48368b,_0x5afb28){return new BPromise(function(_0x28924e,_0x5c7280){return client[_0x10c9('0x9')](_0x13efc0,_0x5afb28)[_0x10c9('0xa')](function(_0x4a6975){logger[_0x10c9('0xb')](_0x10c9('0xc'),_0x48368b,'request\x20sent');logger['debug'](_0x10c9('0xd'),_0x48368b,_0x10c9('0xe'),JSON[_0x10c9('0xf')](_0x4a6975));if(_0x4a6975['error']){if(_0x4a6975[_0x10c9('0x10')][_0x10c9('0x11')]===0x1f4){logger[_0x10c9('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x48368b,_0x4a6975[_0x10c9('0x10')][_0x10c9('0x12')]);return _0x5c7280(_0x4a6975[_0x10c9('0x10')][_0x10c9('0x12')]);}logger['error'](_0x10c9('0xc'),_0x48368b,_0x4a6975[_0x10c9('0x10')]['message']);return _0x28924e(_0x4a6975[_0x10c9('0x10')][_0x10c9('0x12')]);}else{logger[_0x10c9('0xb')](_0x10c9('0xc'),_0x48368b,_0x10c9('0xe'));_0x28924e(_0x4a6975[_0x10c9('0x13')]['message']);}})[_0x10c9('0x14')](function(_0x3cb2f4){logger['error'](_0x10c9('0xc'),_0x48368b,_0x3cb2f4);_0x5c7280(_0x3cb2f4);});});} \ No newline at end of file +var _0xea26=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4f9971,_0x4a1f33){var _0x1a2798=function(_0x104765){while(--_0x104765){_0x4f9971['push'](_0x4f9971['shift']());}};_0x1a2798(++_0x4a1f33);}(_0xea26,0xb5));var _0x6ea2=function(_0x57f80d,_0x52b525){_0x57f80d=_0x57f80d-0x0;var _0x402e68=_0xea26[_0x57f80d];return _0x402e68;};'use strict';var _=require(_0x6ea2('0x0'));var util=require(_0x6ea2('0x1'));var moment=require(_0x6ea2('0x2'));var BPromise=require(_0x6ea2('0x3'));var rs=require(_0x6ea2('0x4'));var fs=require('fs');var Redis=require(_0x6ea2('0x5'));var db=require(_0x6ea2('0x6'))['db'];var utils=require(_0x6ea2('0x7'));var logger=require(_0x6ea2('0x8'))(_0x6ea2('0x9'));var config=require('../../config/environment');var jayson=require(_0x6ea2('0xa'));var client=jayson[_0x6ea2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e203,_0xdc864c,_0x59bdb2){return new BPromise(function(_0x122ecb,_0x12a62d){return client[_0x6ea2('0xc')](_0x56e203,_0x59bdb2)[_0x6ea2('0xd')](function(_0x103c56){logger[_0x6ea2('0xe')](_0x6ea2('0xf'),_0xdc864c,'request\x20sent');logger[_0x6ea2('0x10')](_0x6ea2('0x11'),_0xdc864c,_0x6ea2('0x12'),JSON[_0x6ea2('0x13')](_0x103c56));if(_0x103c56[_0x6ea2('0x14')]){if(_0x103c56[_0x6ea2('0x14')][_0x6ea2('0x15')]===0x1f4){logger[_0x6ea2('0x14')](_0x6ea2('0xf'),_0xdc864c,_0x103c56['error']['message']);return _0x12a62d(_0x103c56[_0x6ea2('0x14')][_0x6ea2('0x16')]);}logger['error'](_0x6ea2('0xf'),_0xdc864c,_0x103c56['error'][_0x6ea2('0x16')]);return _0x122ecb(_0x103c56[_0x6ea2('0x14')]['message']);}else{logger[_0x6ea2('0xe')](_0x6ea2('0xf'),_0xdc864c,_0x6ea2('0x12'));_0x122ecb(_0x103c56[_0x6ea2('0x17')]['message']);}})[_0x6ea2('0x18')](function(_0x36646e){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0xdc864c,_0x36646e);_0x12a62d(_0x36646e);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 2752436..74db2e2 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 _0x82f4=['post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x51dc83,_0x5226f0){var _0x1b1389=function(_0x15f51a){while(--_0x15f51a){_0x51dc83['push'](_0x51dc83['shift']());}};_0x1b1389(++_0x5226f0);}(_0x82f4,0x84));var _0x482f=function(_0x4fce3a,_0x31dd65){_0x4fce3a=_0x4fce3a-0x0;var _0xab350c=_0x82f4[_0x4fce3a];return _0xab350c;};'use strict';var multer=require(_0x482f('0x0'));var util=require('util');var path=require(_0x482f('0x1'));var timeout=require(_0x482f('0x2'));var express=require(_0x482f('0x3'));var router=express[_0x482f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x482f('0x5'));var config=require(_0x482f('0x6'));var controller=require(_0x482f('0x7'));router[_0x482f('0x8')]('/',auth[_0x482f('0x9')](),controller[_0x482f('0xa')]);router[_0x482f('0x8')](_0x482f('0xb'),auth[_0x482f('0x9')](),controller[_0x482f('0xc')]);router[_0x482f('0x8')](_0x482f('0xd'),auth[_0x482f('0x9')](),controller[_0x482f('0xe')]);router[_0x482f('0xf')]('/',auth[_0x482f('0x9')](),controller['create']);router[_0x482f('0x10')](_0x482f('0xd'),auth[_0x482f('0x9')](),controller[_0x482f('0x11')]);router[_0x482f('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x482f('0x13')]);module[_0x482f('0x14')]=router; \ No newline at end of file +var _0x99b4=['./faxTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x574ab5,_0xf7a253){var _0x279c5f=function(_0x1e1494){while(--_0x1e1494){_0x574ab5['push'](_0x574ab5['shift']());}};_0x279c5f(++_0xf7a253);}(_0x99b4,0xc1));var _0x499b=function(_0x1bee7,_0x4219d6){_0x1bee7=_0x1bee7-0x0;var _0x14271e=_0x99b4[_0x1bee7];return _0x14271e;};'use strict';var multer=require('multer');var util=require(_0x499b('0x0'));var path=require(_0x499b('0x1'));var timeout=require(_0x499b('0x2'));var express=require('express');var router=express[_0x499b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x499b('0x4'));var config=require('../../config/environment');var controller=require(_0x499b('0x5'));router[_0x499b('0x6')]('/',auth[_0x499b('0x7')](),controller[_0x499b('0x8')]);router[_0x499b('0x6')](_0x499b('0x9'),auth[_0x499b('0x7')](),controller['describe']);router['get']('/:id',auth[_0x499b('0x7')](),controller[_0x499b('0xa')]);router[_0x499b('0xb')]('/',auth['isAuthenticated'](),controller[_0x499b('0xc')]);router[_0x499b('0xd')](_0x499b('0xe'),auth[_0x499b('0x7')](),controller[_0x499b('0xf')]);router[_0x499b('0x10')](_0x499b('0xe'),auth[_0x499b('0x7')](),controller[_0x499b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 22c552b..aca50e7 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 _0xd718=['isAuthenticated','index','/:id','show','getFields','create','post','addConfiguration','put','delete','multer','util','express','Router','../../components/interaction/service','./intDeskAccount.controller','get'];(function(_0x1a3013,_0x2fdfc0){var _0x5918f4=function(_0x3f2e92){while(--_0x3f2e92){_0x1a3013['push'](_0x1a3013['shift']());}};_0x5918f4(++_0x2fdfc0);}(_0xd718,0x16f));var _0x8d71=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0xd718[_0x1fd675];return _0x16b554;};'use strict';var multer=require(_0x8d71('0x0'));var util=require(_0x8d71('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8d71('0x2'));var router=express[_0x8d71('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8d71('0x4'));var config=require('../../config/environment');var controller=require(_0x8d71('0x5'));router[_0x8d71('0x6')]('/',auth[_0x8d71('0x7')](),controller[_0x8d71('0x8')]);router[_0x8d71('0x6')](_0x8d71('0x9'),auth[_0x8d71('0x7')](),controller[_0x8d71('0xa')]);router['get']('/:id/configurations',auth[_0x8d71('0x7')](),controller['getConfigurations']);router[_0x8d71('0x6')]('/:id/fields',auth[_0x8d71('0x7')](),controller[_0x8d71('0xb')]);router['post']('/',auth[_0x8d71('0x7')](),controller[_0x8d71('0xc')]);router[_0x8d71('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8d71('0xe')]);router[_0x8d71('0xf')]('/:id',auth[_0x8d71('0x7')](),controller['update']);router[_0x8d71('0x10')](_0x8d71('0x9'),auth[_0x8d71('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa008=['../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x51e1d2,_0x3c87a3){var _0x363f28=function(_0x56059f){while(--_0x56059f){_0x51e1d2['push'](_0x51e1d2['shift']());}};_0x363f28(++_0x3c87a3);}(_0xa008,0xdf));var _0x8a00=function(_0x3c0701,_0x432fc5){_0x3c0701=_0x3c0701-0x0;var _0x11b91c=_0xa008[_0x3c0701];return _0x11b91c;};'use strict';var multer=require(_0x8a00('0x0'));var util=require(_0x8a00('0x1'));var path=require(_0x8a00('0x2'));var timeout=require(_0x8a00('0x3'));var express=require(_0x8a00('0x4'));var router=express['Router']();var auth=require(_0x8a00('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8a00('0x6'));var controller=require('./intDeskAccount.controller');router[_0x8a00('0x7')]('/',auth['isAuthenticated'](),controller[_0x8a00('0x8')]);router[_0x8a00('0x7')](_0x8a00('0x9'),auth[_0x8a00('0xa')](),controller[_0x8a00('0xb')]);router['get'](_0x8a00('0xc'),auth['isAuthenticated'](),controller[_0x8a00('0xd')]);router[_0x8a00('0x7')](_0x8a00('0xe'),auth[_0x8a00('0xa')](),controller['getFields']);router[_0x8a00('0xf')]('/',auth[_0x8a00('0xa')](),controller['create']);router[_0x8a00('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8a00('0x10')]);router['put'](_0x8a00('0x9'),auth[_0x8a00('0xa')](),controller['update']);router[_0x8a00('0x11')](_0x8a00('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x8a00('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 06729cd..872888d 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 _0x0c8d=['newTab','exports','STRING','integrationTab'];(function(_0x2b8162,_0x1355d8){var _0x4c08db=function(_0x1e2432){while(--_0x1e2432){_0x2b8162['push'](_0x2b8162['shift']());}};_0x4c08db(++_0x1355d8);}(_0x0c8d,0x79));var _0xd0c8=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x0c8d[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require('sequelize');module[_0xd0c8('0x0')]={'name':{'type':Sequelize[_0xd0c8('0x1')]},'description':{'type':Sequelize[_0xd0c8('0x1')]},'username':{'type':Sequelize[_0xd0c8('0x1')]},'remoteUri':{'type':Sequelize[_0xd0c8('0x1')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xd0c8('0x1')]},'consumerSecret':{'type':Sequelize[_0xd0c8('0x1')]},'token':{'type':Sequelize[_0xd0c8('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xd0c8('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd0c8('0x2'),_0xd0c8('0x3')),'defaultValue':_0xd0c8('0x2')}}; \ No newline at end of file +var _0xb5fb=['STRING','ENUM','basic','integrationTab','sequelize','exports'];(function(_0x5218c0,_0x2591df){var _0xc5dba=function(_0x54f32d){while(--_0x54f32d){_0x5218c0['push'](_0x5218c0['shift']());}};_0xc5dba(++_0x2591df);}(_0xb5fb,0x172));var _0xbb5f=function(_0x7fd4eb,_0x3a3d90){_0x7fd4eb=_0x7fd4eb-0x0;var _0x42e5e3=_0xb5fb[_0x7fd4eb];return _0x42e5e3;};'use strict';var Sequelize=require(_0xbb5f('0x0'));module[_0xbb5f('0x1')]={'name':{'type':Sequelize[_0xbb5f('0x2')]},'description':{'type':Sequelize[_0xbb5f('0x2')]},'username':{'type':Sequelize[_0xbb5f('0x2')]},'remoteUri':{'type':Sequelize[_0xbb5f('0x2')]},'authType':{'type':Sequelize[_0xbb5f('0x3')](_0xbb5f('0x4')),'defaultValue':_0xbb5f('0x4')},'password':{'type':Sequelize[_0xbb5f('0x2')]},'consumerKey':{'type':Sequelize[_0xbb5f('0x2')]},'consumerSecret':{'type':Sequelize[_0xbb5f('0x2')]},'token':{'type':Sequelize[_0xbb5f('0x2')]},'tokenSecret':{'type':Sequelize[_0xbb5f('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbb5f('0x5'),'newTab'),'defaultValue':_0xbb5f('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 02df4e2..f32d572 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 _0xf42f=['%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','password','toString','concat','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','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','jayson/promise','client','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','show','params','keys','length','create','body','find','findOne','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','format'];(function(_0x1afc08,_0x2a8b3f){var _0x367e12=function(_0x55f719){while(--_0x55f719){_0x1afc08['push'](_0x1afc08['shift']());}};_0x367e12(++_0x2a8b3f);}(_0xf42f,0x8d));var _0xff42=function(_0x45ee3b,_0x2f868e){_0x45ee3b=_0x45ee3b-0x0;var _0x523ba6=_0xf42f[_0x45ee3b];return _0x523ba6;};'use strict';var pdf=require(_0xff42('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xff42('0x1'));var zipdir=require(_0xff42('0x2'));var jsonpatch=require(_0xff42('0x3'));var rp=require(_0xff42('0x4'));var moment=require(_0xff42('0x5'));var BPromise=require(_0xff42('0x6'));var Mustache=require(_0xff42('0x7'));var util=require(_0xff42('0x8'));var path=require('path');var sox=require(_0xff42('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xff42('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xff42('0xb'));var Papa=require(_0xff42('0xc'));var Redis=require('ioredis');var authService=require(_0xff42('0xd'));var qs=require(_0xff42('0xe'));var as=require(_0xff42('0xf'));var hardwareService=require(_0xff42('0x10'));var logger=require(_0xff42('0x11'))(_0xff42('0x12'));var utils=require(_0xff42('0x13'));var config=require(_0xff42('0x14'));var licenseUtil=require(_0xff42('0x15'));var db=require(_0xff42('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xff42('0x17'));var client=jayson[_0xff42('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25c0ed,_0x1679ad,_0x354065,_0x2f38c9){return new BPromise(function(_0x58dd7d,_0x144bf1){var _0x310faa=_0x2f38c9||client;return _0x310faa[_0xff42('0x19')](_0x25c0ed,_0x354065)['then'](function(_0x571861){logger[_0xff42('0x1a')](_0xff42('0x1b'),_0x1679ad,_0xff42('0x1c'));logger['debug'](_0xff42('0x1d'),_0x1679ad,_0xff42('0x1c'),JSON['stringify'](_0x571861));if(_0x571861[_0xff42('0x1e')]){if(_0x571861['error'][_0xff42('0x1f')]===0x1f4){logger['error'](_0xff42('0x1b'),_0x1679ad,_0x571861[_0xff42('0x1e')][_0xff42('0x20')]);return _0x144bf1(_0x571861['error'][_0xff42('0x20')]);}logger[_0xff42('0x1e')](_0xff42('0x1b'),_0x1679ad,_0x571861['error'][_0xff42('0x20')]);return _0x58dd7d(_0x571861[_0xff42('0x1e')][_0xff42('0x20')]);}else{logger[_0xff42('0x1a')](_0xff42('0x1b'),_0x1679ad,_0xff42('0x1c'));_0x58dd7d(_0x571861['result']['message']);}})[_0xff42('0x21')](function(_0x37635f){logger[_0xff42('0x1e')](_0xff42('0x1b'),_0x1679ad,_0x37635f);_0x144bf1(_0x37635f);});});}function respondWithStatusCode(_0x513734,_0x16556f){_0x16556f=_0x16556f||0xcc;return function(_0x1c8a60){if(_0x1c8a60){return _0x513734[_0xff42('0x22')](_0x16556f);}return _0x513734['status'](_0x16556f)[_0xff42('0x23')]();};}function respondWithResult(_0x22f85d,_0x5668b1){_0x5668b1=_0x5668b1||0xc8;return function(_0x50ad03){if(_0x50ad03){return _0x22f85d[_0xff42('0x24')](_0x5668b1)[_0xff42('0x25')](_0x50ad03);}};}function respondWithFilteredResult(_0x7c0efa,_0x387282){return function(_0x4e0ced){if(_0x4e0ced){var _0x4a6408=_0x4e0ced['count'],_0x4cee70=_0x387282[_0xff42('0x26')],_0x45e18a=_0x387282[_0xff42('0x26')]+_0x387282[_0xff42('0x27')],_0x4d63ba;if(_0x45e18a>=_0x4a6408){_0x45e18a=_0x4a6408;_0x4d63ba=0xc8;}else{_0x4d63ba=0xce;}_0x7c0efa[_0xff42('0x24')](_0x4d63ba);return _0x7c0efa[_0xff42('0x28')](_0xff42('0x29'),_0x4cee70+'-'+_0x45e18a+'/'+_0x4a6408)[_0xff42('0x25')](_0x4e0ced);}return null;};}function patchUpdates(_0x5b08ce){return function(_0x1a7081){try{jsonpatch['apply'](_0x1a7081,_0x5b08ce,!![]);}catch(_0x1ed108){return BPromise[_0xff42('0x2a')](_0x1ed108);}return _0x1a7081[_0xff42('0x2b')]();};}function saveUpdates(_0x5ce640,_0x4e97ac){return function(_0xad73b6){if(_0xad73b6){return _0xad73b6[_0xff42('0x2c')](_0x5ce640)[_0xff42('0x2d')](function(_0x40bf48){return _0x40bf48;});}return null;};}function removeEntity(_0x5d179d,_0x3c0138){return function(_0x500efb){if(_0x500efb){return _0x500efb[_0xff42('0x2e')]()[_0xff42('0x2d')](function(){_0x5d179d[_0xff42('0x24')](0xcc)[_0xff42('0x23')]();});}};}function handleEntityNotFound(_0x50e7d0,_0xe9dc0f){return function(_0x3a2112){if(!_0x3a2112){_0x50e7d0['sendStatus'](0x194);}return _0x3a2112;};}function handleError(_0xe5ebf0,_0x29b019){_0x29b019=_0x29b019||0x1f4;return function(_0x25e96d){logger[_0xff42('0x1e')](_0x25e96d[_0xff42('0x2f')]);if(_0x25e96d[_0xff42('0x30')]){delete _0x25e96d[_0xff42('0x30')];}_0xe5ebf0['status'](_0x29b019)[_0xff42('0x31')](_0x25e96d);};}exports[_0xff42('0x32')]=function(_0x480a49,_0x321661){var _0x32d8dc={},_0x34280b={},_0x21b5c0={'count':0x0,'rows':[]};var _0x347573=_[_0xff42('0x33')](db[_0xff42('0x34')][_0xff42('0x35')],function(_0x168287){return{'name':_0x168287[_0xff42('0x36')],'type':_0x168287[_0xff42('0x37')][_0xff42('0x38')]};});_0x34280b[_0xff42('0x39')]=_[_0xff42('0x33')](_0x347573,'name');_0x34280b[_0xff42('0x3a')]=_['keys'](_0x480a49[_0xff42('0x3a')]);_0x34280b[_0xff42('0x3b')]=_[_0xff42('0x3c')](_0x34280b['model'],_0x34280b['query']);_0x32d8dc[_0xff42('0x3d')]=_['intersection'](_0x34280b[_0xff42('0x39')],qs[_0xff42('0x3e')](_0x480a49[_0xff42('0x3a')][_0xff42('0x3e')]));_0x32d8dc[_0xff42('0x3d')]=_0x32d8dc[_0xff42('0x3d')]['length']?_0x32d8dc[_0xff42('0x3d')]:_0x34280b[_0xff42('0x39')];if(!_0x480a49[_0xff42('0x3a')][_0xff42('0x3f')]('nolimit')){_0x32d8dc[_0xff42('0x27')]=qs[_0xff42('0x27')](_0x480a49[_0xff42('0x3a')][_0xff42('0x27')]);_0x32d8dc[_0xff42('0x26')]=qs[_0xff42('0x26')](_0x480a49[_0xff42('0x3a')][_0xff42('0x26')]);}_0x32d8dc[_0xff42('0x40')]=qs[_0xff42('0x41')](_0x480a49[_0xff42('0x3a')][_0xff42('0x41')]);_0x32d8dc[_0xff42('0x42')]=qs[_0xff42('0x3b')](_[_0xff42('0x43')](_0x480a49[_0xff42('0x3a')],_0x34280b[_0xff42('0x3b')]),_0x347573);if(_0x480a49[_0xff42('0x3a')]['filter']){_0x32d8dc[_0xff42('0x42')]=_[_0xff42('0x44')](_0x32d8dc[_0xff42('0x42')],{'$or':_['map'](_0x347573,function(_0x5123be){if(_0x5123be[_0xff42('0x37')]!==_0xff42('0x45')){var _0x61840e={};_0x61840e[_0x5123be[_0xff42('0x30')]]={'$like':'%'+_0x480a49[_0xff42('0x3a')][_0xff42('0x46')]+'%'};return _0x61840e;}})});}_0x32d8dc=_[_0xff42('0x44')]({},_0x32d8dc,_0x480a49[_0xff42('0x47')]);var _0x53b723={'where':_0x32d8dc[_0xff42('0x42')]};return db['DeskAccount'][_0xff42('0x48')](_0x53b723)[_0xff42('0x2d')](function(_0x3335e1){_0x21b5c0[_0xff42('0x48')]=_0x3335e1;if(_0x480a49[_0xff42('0x3a')][_0xff42('0x49')]){_0x32d8dc[_0xff42('0x4a')]=[{'all':!![]}];}return db[_0xff42('0x34')]['findAll'](_0x32d8dc);})[_0xff42('0x2d')](function(_0x72f4b8){_0x21b5c0['rows']=_0x72f4b8;return _0x21b5c0;})[_0xff42('0x2d')](respondWithFilteredResult(_0x321661,_0x32d8dc))[_0xff42('0x21')](handleError(_0x321661,null));};exports[_0xff42('0x4b')]=function(_0x40dcf0,_0x868b10){var _0x4f98ec={'raw':![],'where':{'id':_0x40dcf0[_0xff42('0x4c')]['id']}},_0x483732={};_0x483732[_0xff42('0x39')]=_['keys'](db[_0xff42('0x34')][_0xff42('0x35')]);_0x483732[_0xff42('0x3a')]=_[_0xff42('0x4d')](_0x40dcf0[_0xff42('0x3a')]);_0x483732[_0xff42('0x3b')]=_[_0xff42('0x3c')](_0x483732[_0xff42('0x39')],_0x483732[_0xff42('0x3a')]);_0x4f98ec[_0xff42('0x3d')]=_[_0xff42('0x3c')](_0x483732[_0xff42('0x39')],qs['fields'](_0x40dcf0[_0xff42('0x3a')][_0xff42('0x3e')]));_0x4f98ec[_0xff42('0x3d')]=_0x4f98ec['attributes'][_0xff42('0x4e')]?_0x4f98ec[_0xff42('0x3d')]:_0x483732['model'];if(_0x40dcf0[_0xff42('0x3a')][_0xff42('0x49')]){_0x4f98ec['include']=[{'all':!![]}];}_0x4f98ec=_[_0xff42('0x44')]({},_0x4f98ec,_0x40dcf0[_0xff42('0x47')]);return db[_0xff42('0x34')]['find'](_0x4f98ec)[_0xff42('0x2d')](handleEntityNotFound(_0x868b10,null))[_0xff42('0x2d')](respondWithResult(_0x868b10,null))[_0xff42('0x21')](handleError(_0x868b10,null));};exports[_0xff42('0x4f')]=function(_0x48f67e,_0x201633){return db[_0xff42('0x34')]['create'](_0x48f67e[_0xff42('0x50')],{})[_0xff42('0x2d')](respondWithResult(_0x201633,0xc9))[_0xff42('0x21')](handleError(_0x201633,null));};exports[_0xff42('0x2c')]=function(_0x58ce0a,_0x1d1fb1){if(_0x58ce0a[_0xff42('0x50')]['id']){delete _0x58ce0a[_0xff42('0x50')]['id'];}return db[_0xff42('0x34')][_0xff42('0x51')]({'where':{'id':_0x58ce0a[_0xff42('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1d1fb1,null))[_0xff42('0x2d')](saveUpdates(_0x58ce0a[_0xff42('0x50')],null))[_0xff42('0x2d')](respondWithResult(_0x1d1fb1,null))[_0xff42('0x21')](handleError(_0x1d1fb1,null));};exports[_0xff42('0x2e')]=function(_0x4ce485,_0x18d886){return db[_0xff42('0x34')][_0xff42('0x51')]({'where':{'id':_0x4ce485[_0xff42('0x4c')]['id']}})[_0xff42('0x2d')](handleEntityNotFound(_0x18d886,null))[_0xff42('0x2d')](removeEntity(_0x18d886,null))['catch'](handleError(_0x18d886,null));};exports['getConfigurations']=function(_0x1e70a4,_0x3ed968,_0x30af05){var _0x52617d={};var _0x599969={};var _0x1376d0;var _0x3aa700;return db[_0xff42('0x34')][_0xff42('0x52')]({'where':{'id':_0x1e70a4[_0xff42('0x4c')]['id']}})[_0xff42('0x2d')](handleEntityNotFound(_0x3ed968,null))[_0xff42('0x2d')](function(_0xc73f0c){if(_0xc73f0c){_0x1376d0=_0xc73f0c;_0x599969[_0xff42('0x39')]=_[_0xff42('0x4d')](db['DeskConfiguration']['rawAttributes']);_0x599969[_0xff42('0x3a')]=_['keys'](_0x1e70a4[_0xff42('0x3a')]);_0x599969['filters']=_[_0xff42('0x3c')](_0x599969[_0xff42('0x39')],_0x599969[_0xff42('0x3a')]);_0x52617d[_0xff42('0x3d')]=_['intersection'](_0x599969['model'],qs[_0xff42('0x3e')](_0x1e70a4[_0xff42('0x3a')][_0xff42('0x3e')]));_0x52617d['attributes']=_0x52617d[_0xff42('0x3d')]['length']?_0x52617d[_0xff42('0x3d')]:_0x599969['model'];_0x52617d[_0xff42('0x40')]=qs['sort'](_0x1e70a4['query'][_0xff42('0x41')]);_0x52617d['where']=qs[_0xff42('0x3b')](_[_0xff42('0x43')](_0x1e70a4[_0xff42('0x3a')],_0x599969[_0xff42('0x3b')]));if(_0x1e70a4['query'][_0xff42('0x46')]){_0x52617d[_0xff42('0x42')]=_[_0xff42('0x44')](_0x52617d[_0xff42('0x42')],{'$or':_[_0xff42('0x33')](_0x52617d[_0xff42('0x3d')],function(_0x3be1d9){var _0x2a9d3c={};_0x2a9d3c[_0x3be1d9]={'$like':'%'+_0x1e70a4[_0xff42('0x3a')]['filter']+'%'};return _0x2a9d3c;})});}_0x52617d=_[_0xff42('0x44')]({},_0x52617d,_0x1e70a4[_0xff42('0x47')]);return _0x1376d0['getConfigurations'](_0x52617d);}})[_0xff42('0x2d')](function(_0x1399d5){if(_0x1399d5){_0x3aa700=_0x1399d5[_0xff42('0x4e')];if(!_0x1e70a4['query'][_0xff42('0x3f')](_0xff42('0x53'))){_0x52617d['limit']=qs['limit'](_0x1e70a4[_0xff42('0x3a')][_0xff42('0x27')]);_0x52617d[_0xff42('0x26')]=qs[_0xff42('0x26')](_0x1e70a4[_0xff42('0x3a')]['offset']);}return _0x1376d0['getConfigurations'](_0x52617d);}})[_0xff42('0x2d')](function(_0x541d8e){if(_0x541d8e){return _0x541d8e?{'count':_0x3aa700,'rows':_0x541d8e}:null;}})[_0xff42('0x2d')](respondWithResult(_0x3ed968,null))['catch'](handleError(_0x3ed968,null));};exports[_0xff42('0x54')]=function(_0x434a9e,_0x1bbf4e,_0x2d6e27){if(_0x434a9e[_0xff42('0x50')]['id']){delete _0x434a9e[_0xff42('0x50')]['id'];}return db[_0xff42('0x34')][_0xff42('0x52')]({'where':{'id':_0x434a9e[_0xff42('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1bbf4e,null))[_0xff42('0x2d')](function(_0x52af96){if(_0x52af96){_0x434a9e[_0xff42('0x50')]['AccountId']=_0x52af96['id'];_0x434a9e[_0xff42('0x50')][_0xff42('0x55')]=integrations[_0xff42('0x56')](_0x434a9e['body'][_0xff42('0x57')],_0x434a9e[_0xff42('0x50')][_0xff42('0x37')]);_0x434a9e[_0xff42('0x50')][_0xff42('0x58')]=integrations[_0xff42('0x59')](_0x434a9e['body']['channel'],_0x434a9e[_0xff42('0x50')]['type']);return db[_0xff42('0x5a')][_0xff42('0x4f')](_0x434a9e[_0xff42('0x50')],{'include':[{'model':db[_0xff42('0x5b')],'as':'Subjects'},{'model':db[_0xff42('0x5b')],'as':_0xff42('0x58')}]});}return null;})['then'](respondWithResult(_0x1bbf4e,null))['catch'](handleError(_0x1bbf4e,null));};exports[_0xff42('0x5c')]=function(_0x1ed366,_0x4d2fd0,_0x477030){var _0x33c07e=[{'name':_0xff42('0x5d'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0xa68446='';return db[_0xff42('0x34')]['findOne']({'where':{'id':_0x1ed366[_0xff42('0x4c')]['id']},'attributes':['id',_0xff42('0x5e'),_0xff42('0x5f'),_0xff42('0x60'),'password',_0xff42('0x61'),'consumerSecret',_0xff42('0x62'),_0xff42('0x63')]})[_0xff42('0x2d')](handleEntityNotFound(_0x4d2fd0,null))[_0xff42('0x2d')](function(_0x4f8f16){if(_0x4f8f16){_0xa68446=_0x4f8f16[_0xff42('0x5e')];var _0x245e4f=_0xa68446[_0xff42('0x64')](-0x1);if(_0x245e4f==='/'){_0xa68446=_0xa68446[_0xff42('0x65')](0x0,_0xa68446[_0xff42('0x66')](_0x245e4f));}var _0x59239c={'method':_0xff42('0x67'),'uri':util[_0xff42('0x68')](_0xff42('0x69'),_0xa68446),'headers':{'Content-Type':_0xff42('0x6a'),'Accept':_0xff42('0x6a')},'json':!![]};if(_0x4f8f16[_0xff42('0x5f')]===_0xff42('0x6b')){_0x59239c[_0xff42('0x6c')][_0xff42('0x6d')]=util['format'](_0xff42('0x6e'),new Buffer(util['format'](_0xff42('0x6f'),_0x4f8f16[_0xff42('0x60')],_0x4f8f16[_0xff42('0x70')]))[_0xff42('0x71')]('base64'));}return rp(_0x59239c)[_0xff42('0x2d')](function(_0x198dbb){return _0x33c07e[_0xff42('0x72')](_['map'](_0x198dbb[_0xff42('0x73')][_0xff42('0x74')],function(_0x53257e){return{'id':_0x53257e[_0xff42('0x30')],'name':_0x53257e[_0xff42('0x30')],'type':_0x53257e[_0xff42('0x37')],'active':_0x53257e[_0xff42('0x75')],'label':_0x53257e['label'],'custom':!![]};}));});}})['then'](function(_0x8da052){return{'count':_0x8da052[_0xff42('0x4e')],'rows':_0x8da052};})[_0xff42('0x2d')](respondWithResult(_0x4d2fd0,null))[_0xff42('0x21')](function(_0x25871c){var _0x1fed0d=_0x1ed366[_0xff42('0x3a')][_0xff42('0x76')]?0x1f4:_0x25871c[_0xff42('0x77')]||0x1f4;logger[_0xff42('0x1e')](_0xff42('0x78'),_0xff42('0x5c'),_0x1fed0d,JSON[_0xff42('0x79')](_0x25871c));delete _0x25871c[_0xff42('0x30')];if(_0x1fed0d===0x191){_0x1fed0d=0x190;}_0x4d2fd0[_0xff42('0x24')](_0x1fed0d)[_0xff42('0x31')](_0x1ed366[_0xff42('0x3a')]['test']?{'message':_0xff42('0x7a'),'statusCode':_0x25871c[_0xff42('0x77')]}:_0x25871c);});}; \ No newline at end of file +var _0xfe15=['filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','sort','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','DeskConfiguration','DeskField','Subjects','getFields','priority','authType','username','consumerKey','token','tokenSecret','remoteUri','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','toString','concat','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../components/integrations/configuration','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','end','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick'];(function(_0x474c00,_0x2f143a){var _0x40538c=function(_0x1edfef){while(--_0x1edfef){_0x474c00['push'](_0x474c00['shift']());}};_0x40538c(++_0x2f143a);}(_0xfe15,0x19b));var _0x5fe1=function(_0x17e5bf,_0x513beb){_0x17e5bf=_0x17e5bf-0x0;var _0x2b7ae6=_0xfe15[_0x17e5bf];return _0x2b7ae6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5fe1('0x0'));var rimraf=require(_0x5fe1('0x1'));var zipdir=require(_0x5fe1('0x2'));var jsonpatch=require(_0x5fe1('0x3'));var rp=require('request-promise');var moment=require(_0x5fe1('0x4'));var BPromise=require(_0x5fe1('0x5'));var Mustache=require('mustache');var util=require(_0x5fe1('0x6'));var path=require(_0x5fe1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5fe1('0x8'));var fs=require('fs');var _=require(_0x5fe1('0x9'));var squel=require('squel');var crypto=require(_0x5fe1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5fe1('0xb'));var toCsv=require(_0x5fe1('0xc'));var querystring=require(_0x5fe1('0xd'));var Papa=require(_0x5fe1('0xe'));var Redis=require(_0x5fe1('0xf'));var authService=require(_0x5fe1('0x10'));var qs=require(_0x5fe1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5fe1('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x5fe1('0x13'));var jayson=require(_0x5fe1('0x14'));var client=jayson[_0x5fe1('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14deb3,_0x456927,_0xb02cbc,_0x5eb46b){return new BPromise(function(_0x441033,_0x1b782f){var _0x2d2f2c=_0x5eb46b||client;return _0x2d2f2c[_0x5fe1('0x16')](_0x14deb3,_0xb02cbc)[_0x5fe1('0x17')](function(_0x2dc831){logger[_0x5fe1('0x18')](_0x5fe1('0x19'),_0x456927,_0x5fe1('0x1a'));logger[_0x5fe1('0x1b')](_0x5fe1('0x1c'),_0x456927,_0x5fe1('0x1a'),JSON[_0x5fe1('0x1d')](_0x2dc831));if(_0x2dc831[_0x5fe1('0x1e')]){if(_0x2dc831['error'][_0x5fe1('0x1f')]===0x1f4){logger[_0x5fe1('0x1e')](_0x5fe1('0x19'),_0x456927,_0x2dc831[_0x5fe1('0x1e')][_0x5fe1('0x20')]);return _0x1b782f(_0x2dc831[_0x5fe1('0x1e')][_0x5fe1('0x20')]);}logger[_0x5fe1('0x1e')](_0x5fe1('0x19'),_0x456927,_0x2dc831[_0x5fe1('0x1e')][_0x5fe1('0x20')]);return _0x441033(_0x2dc831['error'][_0x5fe1('0x20')]);}else{logger['info'](_0x5fe1('0x19'),_0x456927,_0x5fe1('0x1a'));_0x441033(_0x2dc831[_0x5fe1('0x21')][_0x5fe1('0x20')]);}})[_0x5fe1('0x22')](function(_0x309c0e){logger[_0x5fe1('0x1e')](_0x5fe1('0x19'),_0x456927,_0x309c0e);_0x1b782f(_0x309c0e);});});}function respondWithStatusCode(_0xe6907d,_0x35d37c){_0x35d37c=_0x35d37c||0xcc;return function(_0x235ba6){if(_0x235ba6){return _0xe6907d[_0x5fe1('0x23')](_0x35d37c);}return _0xe6907d[_0x5fe1('0x24')](_0x35d37c)['end']();};}function respondWithResult(_0x48b83,_0x4685a4){_0x4685a4=_0x4685a4||0xc8;return function(_0x2b6ae1){if(_0x2b6ae1){return _0x48b83[_0x5fe1('0x24')](_0x4685a4)[_0x5fe1('0x25')](_0x2b6ae1);}};}function respondWithFilteredResult(_0x53a62e,_0x202280){return function(_0x1decc7){if(_0x1decc7){var _0x35e6f0=_0x1decc7['count'],_0x51ed6e=_0x202280[_0x5fe1('0x26')],_0x3b7ec0=_0x202280[_0x5fe1('0x26')]+_0x202280[_0x5fe1('0x27')],_0x5562eb;if(_0x3b7ec0>=_0x35e6f0){_0x3b7ec0=_0x35e6f0;_0x5562eb=0xc8;}else{_0x5562eb=0xce;}_0x53a62e[_0x5fe1('0x24')](_0x5562eb);return _0x53a62e[_0x5fe1('0x28')](_0x5fe1('0x29'),_0x51ed6e+'-'+_0x3b7ec0+'/'+_0x35e6f0)['json'](_0x1decc7);}return null;};}function patchUpdates(_0x26834e){return function(_0x14cc1f){try{jsonpatch[_0x5fe1('0x2a')](_0x14cc1f,_0x26834e,!![]);}catch(_0x543c90){return BPromise['reject'](_0x543c90);}return _0x14cc1f[_0x5fe1('0x2b')]();};}function saveUpdates(_0x3946c6,_0x745d04){return function(_0x438c73){if(_0x438c73){return _0x438c73[_0x5fe1('0x2c')](_0x3946c6)['then'](function(_0x404441){return _0x404441;});}return null;};}function removeEntity(_0xc67a7e,_0x325f04){return function(_0x1f2bd5){if(_0x1f2bd5){return _0x1f2bd5[_0x5fe1('0x2d')]()[_0x5fe1('0x17')](function(){_0xc67a7e[_0x5fe1('0x24')](0xcc)[_0x5fe1('0x2e')]();});}};}function handleEntityNotFound(_0x546ece,_0x57b345){return function(_0x4bb4b8){if(!_0x4bb4b8){_0x546ece[_0x5fe1('0x23')](0x194);}return _0x4bb4b8;};}function handleError(_0x112639,_0x4e66dd){_0x4e66dd=_0x4e66dd||0x1f4;return function(_0x5d0ce5){logger[_0x5fe1('0x1e')](_0x5d0ce5[_0x5fe1('0x2f')]);if(_0x5d0ce5[_0x5fe1('0x30')]){delete _0x5d0ce5['name'];}_0x112639[_0x5fe1('0x24')](_0x4e66dd)[_0x5fe1('0x31')](_0x5d0ce5);};}exports[_0x5fe1('0x32')]=function(_0x3540f5,_0x4d3abf){var _0x50d983={},_0x271369={},_0x36592f={'count':0x0,'rows':[]};var _0x309176=_[_0x5fe1('0x33')](db[_0x5fe1('0x34')][_0x5fe1('0x35')],function(_0x5ccff0){return{'name':_0x5ccff0[_0x5fe1('0x36')],'type':_0x5ccff0[_0x5fe1('0x37')][_0x5fe1('0x38')]};});_0x271369[_0x5fe1('0x39')]=_[_0x5fe1('0x33')](_0x309176,'name');_0x271369[_0x5fe1('0x3a')]=_[_0x5fe1('0x3b')](_0x3540f5['query']);_0x271369['filters']=_[_0x5fe1('0x3c')](_0x271369[_0x5fe1('0x39')],_0x271369[_0x5fe1('0x3a')]);_0x50d983[_0x5fe1('0x3d')]=_[_0x5fe1('0x3c')](_0x271369[_0x5fe1('0x39')],qs[_0x5fe1('0x3e')](_0x3540f5[_0x5fe1('0x3a')][_0x5fe1('0x3e')]));_0x50d983[_0x5fe1('0x3d')]=_0x50d983['attributes'][_0x5fe1('0x3f')]?_0x50d983[_0x5fe1('0x3d')]:_0x271369['model'];if(!_0x3540f5[_0x5fe1('0x3a')]['hasOwnProperty'](_0x5fe1('0x40'))){_0x50d983[_0x5fe1('0x27')]=qs['limit'](_0x3540f5[_0x5fe1('0x3a')][_0x5fe1('0x27')]);_0x50d983[_0x5fe1('0x26')]=qs[_0x5fe1('0x26')](_0x3540f5[_0x5fe1('0x3a')][_0x5fe1('0x26')]);}_0x50d983[_0x5fe1('0x41')]=qs['sort'](_0x3540f5['query']['sort']);_0x50d983[_0x5fe1('0x42')]=qs[_0x5fe1('0x43')](_[_0x5fe1('0x44')](_0x3540f5['query'],_0x271369['filters']),_0x309176);if(_0x3540f5[_0x5fe1('0x3a')][_0x5fe1('0x45')]){_0x50d983['where']=_['merge'](_0x50d983[_0x5fe1('0x42')],{'$or':_[_0x5fe1('0x33')](_0x309176,function(_0x19534d){if(_0x19534d[_0x5fe1('0x37')]!=='VIRTUAL'){var _0x34387b={};_0x34387b[_0x19534d[_0x5fe1('0x30')]]={'$like':'%'+_0x3540f5[_0x5fe1('0x3a')][_0x5fe1('0x45')]+'%'};return _0x34387b;}})});}_0x50d983=_[_0x5fe1('0x46')]({},_0x50d983,_0x3540f5[_0x5fe1('0x47')]);var _0x2d96b3={'where':_0x50d983[_0x5fe1('0x42')]};return db[_0x5fe1('0x34')]['count'](_0x2d96b3)['then'](function(_0xc65d8f){_0x36592f['count']=_0xc65d8f;if(_0x3540f5[_0x5fe1('0x3a')][_0x5fe1('0x48')]){_0x50d983[_0x5fe1('0x49')]=[{'all':!![]}];}return db[_0x5fe1('0x34')][_0x5fe1('0x4a')](_0x50d983);})['then'](function(_0x254aa3){_0x36592f[_0x5fe1('0x4b')]=_0x254aa3;return _0x36592f;})[_0x5fe1('0x17')](respondWithFilteredResult(_0x4d3abf,_0x50d983))[_0x5fe1('0x22')](handleError(_0x4d3abf,null));};exports[_0x5fe1('0x4c')]=function(_0x236b81,_0x2f9f86){var _0x5e8670={'raw':![],'where':{'id':_0x236b81[_0x5fe1('0x4d')]['id']}},_0x445935={};_0x445935[_0x5fe1('0x39')]=_[_0x5fe1('0x3b')](db[_0x5fe1('0x34')][_0x5fe1('0x35')]);_0x445935[_0x5fe1('0x3a')]=_[_0x5fe1('0x3b')](_0x236b81['query']);_0x445935[_0x5fe1('0x43')]=_['intersection'](_0x445935['model'],_0x445935[_0x5fe1('0x3a')]);_0x5e8670[_0x5fe1('0x3d')]=_[_0x5fe1('0x3c')](_0x445935[_0x5fe1('0x39')],qs['fields'](_0x236b81[_0x5fe1('0x3a')][_0x5fe1('0x3e')]));_0x5e8670['attributes']=_0x5e8670[_0x5fe1('0x3d')][_0x5fe1('0x3f')]?_0x5e8670[_0x5fe1('0x3d')]:_0x445935[_0x5fe1('0x39')];if(_0x236b81['query'][_0x5fe1('0x48')]){_0x5e8670['include']=[{'all':!![]}];}_0x5e8670=_['merge']({},_0x5e8670,_0x236b81['options']);return db[_0x5fe1('0x34')][_0x5fe1('0x4e')](_0x5e8670)[_0x5fe1('0x17')](handleEntityNotFound(_0x2f9f86,null))[_0x5fe1('0x17')](respondWithResult(_0x2f9f86,null))['catch'](handleError(_0x2f9f86,null));};exports[_0x5fe1('0x4f')]=function(_0xd16148,_0x312c4b){return db['DeskAccount'][_0x5fe1('0x4f')](_0xd16148[_0x5fe1('0x50')],{})['then'](respondWithResult(_0x312c4b,0xc9))[_0x5fe1('0x22')](handleError(_0x312c4b,null));};exports[_0x5fe1('0x2c')]=function(_0x25d801,_0xd0362b){if(_0x25d801['body']['id']){delete _0x25d801[_0x5fe1('0x50')]['id'];}return db['DeskAccount'][_0x5fe1('0x4e')]({'where':{'id':_0x25d801[_0x5fe1('0x4d')]['id']}})['then'](handleEntityNotFound(_0xd0362b,null))[_0x5fe1('0x17')](saveUpdates(_0x25d801['body'],null))[_0x5fe1('0x17')](respondWithResult(_0xd0362b,null))[_0x5fe1('0x22')](handleError(_0xd0362b,null));};exports[_0x5fe1('0x2d')]=function(_0x16622b,_0x20676b){return db[_0x5fe1('0x34')]['find']({'where':{'id':_0x16622b[_0x5fe1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x20676b,null))[_0x5fe1('0x17')](removeEntity(_0x20676b,null))['catch'](handleError(_0x20676b,null));};exports[_0x5fe1('0x51')]=function(_0x83a4d,_0x105c94,_0x5c758f){var _0x260970={};var _0x5ed596={};var _0x8131a8;var _0x4e407a;return db[_0x5fe1('0x34')][_0x5fe1('0x52')]({'where':{'id':_0x83a4d['params']['id']}})[_0x5fe1('0x17')](handleEntityNotFound(_0x105c94,null))[_0x5fe1('0x17')](function(_0x2037c5){if(_0x2037c5){_0x8131a8=_0x2037c5;_0x5ed596[_0x5fe1('0x39')]=_['keys'](db['DeskConfiguration'][_0x5fe1('0x35')]);_0x5ed596['query']=_[_0x5fe1('0x3b')](_0x83a4d[_0x5fe1('0x3a')]);_0x5ed596[_0x5fe1('0x43')]=_['intersection'](_0x5ed596[_0x5fe1('0x39')],_0x5ed596[_0x5fe1('0x3a')]);_0x260970['attributes']=_[_0x5fe1('0x3c')](_0x5ed596['model'],qs[_0x5fe1('0x3e')](_0x83a4d[_0x5fe1('0x3a')]['fields']));_0x260970[_0x5fe1('0x3d')]=_0x260970[_0x5fe1('0x3d')][_0x5fe1('0x3f')]?_0x260970['attributes']:_0x5ed596[_0x5fe1('0x39')];_0x260970[_0x5fe1('0x41')]=qs[_0x5fe1('0x53')](_0x83a4d[_0x5fe1('0x3a')]['sort']);_0x260970[_0x5fe1('0x42')]=qs[_0x5fe1('0x43')](_[_0x5fe1('0x44')](_0x83a4d['query'],_0x5ed596['filters']));if(_0x83a4d[_0x5fe1('0x3a')][_0x5fe1('0x45')]){_0x260970[_0x5fe1('0x42')]=_['merge'](_0x260970[_0x5fe1('0x42')],{'$or':_[_0x5fe1('0x33')](_0x260970[_0x5fe1('0x3d')],function(_0xff9fae){var _0x382865={};_0x382865[_0xff9fae]={'$like':'%'+_0x83a4d[_0x5fe1('0x3a')][_0x5fe1('0x45')]+'%'};return _0x382865;})});}_0x260970=_[_0x5fe1('0x46')]({},_0x260970,_0x83a4d[_0x5fe1('0x47')]);return _0x8131a8['getConfigurations'](_0x260970);}})[_0x5fe1('0x17')](function(_0x5e1074){if(_0x5e1074){_0x4e407a=_0x5e1074[_0x5fe1('0x3f')];if(!_0x83a4d['query'][_0x5fe1('0x54')](_0x5fe1('0x40'))){_0x260970[_0x5fe1('0x27')]=qs[_0x5fe1('0x27')](_0x83a4d[_0x5fe1('0x3a')]['limit']);_0x260970[_0x5fe1('0x26')]=qs[_0x5fe1('0x26')](_0x83a4d[_0x5fe1('0x3a')][_0x5fe1('0x26')]);}return _0x8131a8[_0x5fe1('0x51')](_0x260970);}})[_0x5fe1('0x17')](function(_0x417a8c){if(_0x417a8c){return _0x417a8c?{'count':_0x4e407a,'rows':_0x417a8c}:null;}})[_0x5fe1('0x17')](respondWithResult(_0x105c94,null))[_0x5fe1('0x22')](handleError(_0x105c94,null));};exports[_0x5fe1('0x55')]=function(_0x4f0e32,_0x2b1ed8,_0x30fbbd){if(_0x4f0e32['body']['id']){delete _0x4f0e32[_0x5fe1('0x50')]['id'];}return db[_0x5fe1('0x34')][_0x5fe1('0x52')]({'where':{'id':_0x4f0e32[_0x5fe1('0x4d')]['id']}})[_0x5fe1('0x17')](handleEntityNotFound(_0x2b1ed8,null))[_0x5fe1('0x17')](function(_0x135161){if(_0x135161){_0x4f0e32[_0x5fe1('0x50')][_0x5fe1('0x56')]=_0x135161['id'];_0x4f0e32[_0x5fe1('0x50')]['Subjects']=integrations[_0x5fe1('0x57')](_0x4f0e32['body'][_0x5fe1('0x58')],_0x4f0e32['body'][_0x5fe1('0x37')]);_0x4f0e32[_0x5fe1('0x50')][_0x5fe1('0x59')]=integrations['getDescriptions'](_0x4f0e32['body'][_0x5fe1('0x58')],_0x4f0e32[_0x5fe1('0x50')][_0x5fe1('0x37')]);return db[_0x5fe1('0x5a')][_0x5fe1('0x4f')](_0x4f0e32[_0x5fe1('0x50')],{'include':[{'model':db[_0x5fe1('0x5b')],'as':_0x5fe1('0x5c')},{'model':db[_0x5fe1('0x5b')],'as':_0x5fe1('0x59')}]});}return null;})[_0x5fe1('0x17')](respondWithResult(_0x2b1ed8,null))['catch'](handleError(_0x2b1ed8,null));};exports[_0x5fe1('0x5d')]=function(_0x4ea78e,_0x5a764b,_0x4970a9){var _0xc7e4f5=[{'name':_0x5fe1('0x5e'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5af57e='';return db[_0x5fe1('0x34')][_0x5fe1('0x52')]({'where':{'id':_0x4ea78e['params']['id']},'attributes':['id','remoteUri',_0x5fe1('0x5f'),_0x5fe1('0x60'),'password',_0x5fe1('0x61'),'consumerSecret',_0x5fe1('0x62'),_0x5fe1('0x63')]})['then'](handleEntityNotFound(_0x5a764b,null))[_0x5fe1('0x17')](function(_0x20ce6c){if(_0x20ce6c){_0x5af57e=_0x20ce6c[_0x5fe1('0x64')];var _0x7277d6=_0x5af57e[_0x5fe1('0x65')](-0x1);if(_0x7277d6==='/'){_0x5af57e=_0x5af57e[_0x5fe1('0x66')](0x0,_0x5af57e['lastIndexOf'](_0x7277d6));}var _0x158656={'method':_0x5fe1('0x67'),'uri':util[_0x5fe1('0x68')](_0x5fe1('0x69'),_0x5af57e),'headers':{'Content-Type':_0x5fe1('0x6a'),'Accept':_0x5fe1('0x6a')},'json':!![]};if(_0x20ce6c[_0x5fe1('0x5f')]===_0x5fe1('0x6b')){_0x158656[_0x5fe1('0x6c')][_0x5fe1('0x6d')]=util[_0x5fe1('0x68')]('Basic\x20%s',new Buffer(util[_0x5fe1('0x68')](_0x5fe1('0x6e'),_0x20ce6c[_0x5fe1('0x60')],_0x20ce6c['password']))[_0x5fe1('0x6f')]('base64'));}return rp(_0x158656)[_0x5fe1('0x17')](function(_0x38c191){return _0xc7e4f5[_0x5fe1('0x70')](_['map'](_0x38c191[_0x5fe1('0x71')][_0x5fe1('0x72')],function(_0x402c03){return{'id':_0x402c03[_0x5fe1('0x30')],'name':_0x402c03[_0x5fe1('0x30')],'type':_0x402c03[_0x5fe1('0x37')],'active':_0x402c03[_0x5fe1('0x73')],'label':_0x402c03[_0x5fe1('0x74')],'custom':!![]};}));});}})[_0x5fe1('0x17')](function(_0x31cfdb){return{'count':_0x31cfdb[_0x5fe1('0x3f')],'rows':_0x31cfdb};})[_0x5fe1('0x17')](respondWithResult(_0x5a764b,null))[_0x5fe1('0x22')](function(_0x89e8ae){var _0x45aeb9=_0x4ea78e[_0x5fe1('0x3a')][_0x5fe1('0x75')]?0x1f4:_0x89e8ae['statusCode']||0x1f4;logger['error'](_0x5fe1('0x76'),'getFields',_0x45aeb9,JSON['stringify'](_0x89e8ae));delete _0x89e8ae[_0x5fe1('0x30')];if(_0x45aeb9===0x191){_0x45aeb9=0x190;}_0x5a764b['status'](_0x45aeb9)[_0x5fe1('0x31')](_0x4ea78e[_0x5fe1('0x3a')][_0x5fe1('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x89e8ae[_0x5fe1('0x77')]}:_0x89e8ae);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 8229cfe..4ceefcb 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 _0xf7f9=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x13167f,_0x323f1a){var _0x4a55b4=function(_0x1fc773){while(--_0x1fc773){_0x13167f['push'](_0x13167f['shift']());}};_0x4a55b4(++_0x323f1a);}(_0xf7f9,0x1aa));var _0x9f7f=function(_0x508af7,_0x3341cd){_0x508af7=_0x508af7-0x0;var _0x5733e8=_0xf7f9[_0x508af7];return _0x5733e8;};'use strict';var _=require(_0x9f7f('0x0'));var util=require('util');var logger=require(_0x9f7f('0x1'))(_0x9f7f('0x2'));var moment=require('moment');var BPromise=require(_0x9f7f('0x3'));var rp=require(_0x9f7f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f7f('0x5'));var config=require(_0x9f7f('0x6'));var attributes=require(_0x9f7f('0x7'));var integrations=require(_0x9f7f('0x8'));module['exports']=function(_0x193dc3,_0x315437){return _0x193dc3[_0x9f7f('0x9')](_0x9f7f('0xa'),attributes,{'tableName':_0x9f7f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x064c=['../../config/environment','./intDeskAccount.attributes','util','../../config/logger','api','moment','bluebird'];(function(_0x262b56,_0x489281){var _0x106c6e=function(_0x42dd25){while(--_0x42dd25){_0x262b56['push'](_0x262b56['shift']());}};_0x106c6e(++_0x489281);}(_0x064c,0x14b));var _0xc064=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x064c[_0x4bd950];return _0x5dc59a;};'use strict';var _=require('lodash');var util=require(_0xc064('0x0'));var logger=require(_0xc064('0x1'))(_0xc064('0x2'));var moment=require(_0xc064('0x3'));var BPromise=require(_0xc064('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc064('0x5'));var attributes=require(_0xc064('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x266ac6,_0x4d648a){return _0x266ac6['define']('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 2d3ed2e..444c31d 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 _0x32f2=['code','DeskAccount,\x20%s,\x20%s','message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','http','request','then','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4004da,_0x346a26){var _0x44cab5=function(_0x3483cf){while(--_0x3483cf){_0x4004da['push'](_0x4004da['shift']());}};_0x44cab5(++_0x346a26);}(_0x32f2,0x1b7));var _0x232f=function(_0x536c6b,_0x59a85c){_0x536c6b=_0x536c6b-0x0;var _0x43499d=_0x32f2[_0x536c6b];return _0x43499d;};'use strict';var _=require(_0x232f('0x0'));var util=require(_0x232f('0x1'));var moment=require(_0x232f('0x2'));var BPromise=require(_0x232f('0x3'));var rs=require(_0x232f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x232f('0x5'));var logger=require('../../config/logger')(_0x232f('0x6'));var config=require('../../config/environment');var jayson=require(_0x232f('0x7'));var client=jayson['client'][_0x232f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x546c98,_0x15f71d,_0x5b0040){return new BPromise(function(_0x4b04fd,_0x5c2b4e){return client[_0x232f('0x9')](_0x546c98,_0x5b0040)[_0x232f('0xa')](function(_0x58d278){logger['info']('DeskAccount,\x20%s,\x20%s',_0x15f71d,'request\x20sent');logger[_0x232f('0xb')](_0x232f('0xc'),_0x15f71d,_0x232f('0xd'),JSON[_0x232f('0xe')](_0x58d278));if(_0x58d278[_0x232f('0xf')]){if(_0x58d278['error'][_0x232f('0x10')]===0x1f4){logger[_0x232f('0xf')](_0x232f('0x11'),_0x15f71d,_0x58d278['error'][_0x232f('0x12')]);return _0x5c2b4e(_0x58d278[_0x232f('0xf')][_0x232f('0x12')]);}logger[_0x232f('0xf')]('DeskAccount,\x20%s,\x20%s',_0x15f71d,_0x58d278['error'][_0x232f('0x12')]);return _0x4b04fd(_0x58d278[_0x232f('0xf')]['message']);}else{logger[_0x232f('0x13')]('DeskAccount,\x20%s,\x20%s',_0x15f71d,_0x232f('0xd'));_0x4b04fd(_0x58d278[_0x232f('0x14')][_0x232f('0x12')]);}})[_0x232f('0x15')](function(_0x296238){logger[_0x232f('0xf')](_0x232f('0x11'),_0x15f71d,_0x296238);_0x5c2b4e(_0x296238);});});}exports[_0x232f('0x16')]=function(_0x502344){var _0x30107d=this;return new Promise(function(_0x16188e,_0xfd72f2){return db[_0x232f('0x17')][_0x232f('0x18')]({'raw':_0x502344[_0x232f('0x19')]?_0x502344[_0x232f('0x19')][_0x232f('0x1a')]===undefined?!![]:![]:!![],'where':_0x502344['options']?_0x502344[_0x232f('0x19')][_0x232f('0x1b')]||null:null,'attributes':_0x502344['options']?_0x502344['options'][_0x232f('0x1c')]||null:null,'limit':_0x502344[_0x232f('0x19')]?_0x502344['options'][_0x232f('0x1d')]||null:null,'include':_0x502344['options']?_0x502344[_0x232f('0x19')]['include']?_['map'](_0x502344['options'][_0x232f('0x1e')],function(_0x227ac7){return{'model':db[_0x227ac7[_0x232f('0x1f')]],'as':_0x227ac7['as'],'attributes':_0x227ac7[_0x232f('0x1c')],'include':_0x227ac7['include']?_[_0x232f('0x20')](_0x227ac7['include'],function(_0x362be7){return{'model':db[_0x362be7['model']],'as':_0x362be7['as'],'attributes':_0x362be7[_0x232f('0x1c')],'include':_0x362be7[_0x232f('0x1e')]?_[_0x232f('0x20')](_0x362be7[_0x232f('0x1e')],function(_0x2acfd9){return{'model':db[_0x2acfd9[_0x232f('0x1f')]],'as':_0x2acfd9['as'],'attributes':_0x2acfd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x232f('0xa')](function(_0x1ba6c7){logger['info'](_0x232f('0x16'),_0x502344);logger[_0x232f('0xb')](_0x232f('0x16'),_0x502344,JSON['stringify'](_0x1ba6c7));_0x16188e(_0x1ba6c7);})[_0x232f('0x15')](function(_0x3753e3){logger[_0x232f('0xf')](_0x232f('0x16'),_0x3753e3[_0x232f('0x12')],_0x502344);_0xfd72f2(_0x30107d[_0x232f('0xf')](0x1f4,_0x3753e3['message']));});});};exports[_0x232f('0x21')]=function(_0x56f29d){var _0x39db7c=this;return new Promise(function(_0x5d0c72,_0x36bacd){return db[_0x232f('0x17')][_0x232f('0x22')]({'raw':_0x56f29d[_0x232f('0x19')]?_0x56f29d[_0x232f('0x19')][_0x232f('0x1a')]===undefined?!![]:![]:!![],'where':_0x56f29d['options']?_0x56f29d[_0x232f('0x19')]['where']||null:null,'attributes':_0x56f29d['options']?_0x56f29d[_0x232f('0x19')][_0x232f('0x1c')]||null:null,'include':_0x56f29d[_0x232f('0x19')]?_0x56f29d[_0x232f('0x19')][_0x232f('0x1e')]?_[_0x232f('0x20')](_0x56f29d[_0x232f('0x19')][_0x232f('0x1e')],function(_0x40e704){return{'model':db[_0x40e704[_0x232f('0x1f')]],'as':_0x40e704['as'],'attributes':_0x40e704[_0x232f('0x1c')],'include':_0x40e704[_0x232f('0x1e')]?_[_0x232f('0x20')](_0x40e704[_0x232f('0x1e')],function(_0x3a3614){return{'model':db[_0x3a3614[_0x232f('0x1f')]],'as':_0x3a3614['as'],'attributes':_0x3a3614[_0x232f('0x1c')],'include':_0x3a3614[_0x232f('0x1e')]?_[_0x232f('0x20')](_0x3a3614['include'],function(_0x2925d8){return{'model':db[_0x2925d8[_0x232f('0x1f')]],'as':_0x2925d8['as'],'attributes':_0x2925d8[_0x232f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x232f('0xa')](function(_0xd1e83){logger[_0x232f('0x13')](_0x232f('0x21'),_0x56f29d);logger[_0x232f('0xb')](_0x232f('0x21'),_0x56f29d,JSON['stringify'](_0xd1e83));_0x5d0c72(_0xd1e83);})[_0x232f('0x15')](function(_0x311b6b){logger[_0x232f('0xf')]('ShowDeskAccount',_0x311b6b['message'],_0x56f29d);_0x36bacd(_0x39db7c[_0x232f('0xf')](0x1f4,_0x311b6b[_0x232f('0x12')]));});});}; \ No newline at end of file +var _0x3ddb=['http','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','DeskAccount','findAll','raw','options','where','attributes','include','map','model','then','GetDeskAccount','ShowDeskAccount','find','lodash','bluebird','../../mysqldb','../../config/logger','rpc','client'];(function(_0x5bc24f,_0x1ff138){var _0x23e1fe=function(_0xb2a957){while(--_0xb2a957){_0x5bc24f['push'](_0x5bc24f['shift']());}};_0x23e1fe(++_0x1ff138);}(_0x3ddb,0x8b));var _0xb3dd=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x3ddb[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0xb3dd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb3dd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3dd('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb3dd('0x3'))(_0xb3dd('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb3dd('0x5')][_0xb3dd('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x133514,_0x7fe908,_0x11fa6a){return new BPromise(function(_0x27d13e,_0x17718e){return client['request'](_0x133514,_0x11fa6a)['then'](function(_0x4d2271){logger[_0xb3dd('0x7')](_0xb3dd('0x8'),_0x7fe908,_0xb3dd('0x9'));logger['debug'](_0xb3dd('0xa'),_0x7fe908,'request\x20sent',JSON[_0xb3dd('0xb')](_0x4d2271));if(_0x4d2271[_0xb3dd('0xc')]){if(_0x4d2271[_0xb3dd('0xc')][_0xb3dd('0xd')]===0x1f4){logger[_0xb3dd('0xc')]('DeskAccount,\x20%s,\x20%s',_0x7fe908,_0x4d2271[_0xb3dd('0xc')][_0xb3dd('0xe')]);return _0x17718e(_0x4d2271[_0xb3dd('0xc')][_0xb3dd('0xe')]);}logger['error'](_0xb3dd('0x8'),_0x7fe908,_0x4d2271[_0xb3dd('0xc')]['message']);return _0x27d13e(_0x4d2271['error'][_0xb3dd('0xe')]);}else{logger[_0xb3dd('0x7')](_0xb3dd('0x8'),_0x7fe908,_0xb3dd('0x9'));_0x27d13e(_0x4d2271['result'][_0xb3dd('0xe')]);}})[_0xb3dd('0xf')](function(_0x196516){logger[_0xb3dd('0xc')]('DeskAccount,\x20%s,\x20%s',_0x7fe908,_0x196516);_0x17718e(_0x196516);});});}exports['GetDeskAccount']=function(_0xae32f3){var _0x4a2570=this;return new Promise(function(_0x168b86,_0x2f0378){return db[_0xb3dd('0x10')][_0xb3dd('0x11')]({'raw':_0xae32f3['options']?_0xae32f3['options'][_0xb3dd('0x12')]===undefined?!![]:![]:!![],'where':_0xae32f3['options']?_0xae32f3[_0xb3dd('0x13')][_0xb3dd('0x14')]||null:null,'attributes':_0xae32f3['options']?_0xae32f3[_0xb3dd('0x13')][_0xb3dd('0x15')]||null:null,'limit':_0xae32f3[_0xb3dd('0x13')]?_0xae32f3[_0xb3dd('0x13')]['limit']||null:null,'include':_0xae32f3[_0xb3dd('0x13')]?_0xae32f3[_0xb3dd('0x13')][_0xb3dd('0x16')]?_[_0xb3dd('0x17')](_0xae32f3[_0xb3dd('0x13')][_0xb3dd('0x16')],function(_0x3c496f){return{'model':db[_0x3c496f[_0xb3dd('0x18')]],'as':_0x3c496f['as'],'attributes':_0x3c496f[_0xb3dd('0x15')],'include':_0x3c496f[_0xb3dd('0x16')]?_[_0xb3dd('0x17')](_0x3c496f['include'],function(_0x5161a1){return{'model':db[_0x5161a1['model']],'as':_0x5161a1['as'],'attributes':_0x5161a1[_0xb3dd('0x15')],'include':_0x5161a1['include']?_['map'](_0x5161a1[_0xb3dd('0x16')],function(_0x3f8651){return{'model':db[_0x3f8651[_0xb3dd('0x18')]],'as':_0x3f8651['as'],'attributes':_0x3f8651['attributes']};}):[]};}):[]};}):[]:[]})[_0xb3dd('0x19')](function(_0x59e977){logger[_0xb3dd('0x7')](_0xb3dd('0x1a'),_0xae32f3);logger['debug'](_0xb3dd('0x1a'),_0xae32f3,JSON[_0xb3dd('0xb')](_0x59e977));_0x168b86(_0x59e977);})[_0xb3dd('0xf')](function(_0x51560c){logger[_0xb3dd('0xc')](_0xb3dd('0x1a'),_0x51560c[_0xb3dd('0xe')],_0xae32f3);_0x2f0378(_0x4a2570['error'](0x1f4,_0x51560c[_0xb3dd('0xe')]));});});};exports[_0xb3dd('0x1b')]=function(_0x74782a){var _0x43bc7f=this;return new Promise(function(_0x246618,_0x401ed7){return db[_0xb3dd('0x10')][_0xb3dd('0x1c')]({'raw':_0x74782a[_0xb3dd('0x13')]?_0x74782a[_0xb3dd('0x13')][_0xb3dd('0x12')]===undefined?!![]:![]:!![],'where':_0x74782a[_0xb3dd('0x13')]?_0x74782a[_0xb3dd('0x13')]['where']||null:null,'attributes':_0x74782a[_0xb3dd('0x13')]?_0x74782a[_0xb3dd('0x13')][_0xb3dd('0x15')]||null:null,'include':_0x74782a[_0xb3dd('0x13')]?_0x74782a['options']['include']?_[_0xb3dd('0x17')](_0x74782a[_0xb3dd('0x13')][_0xb3dd('0x16')],function(_0xffcd9e){return{'model':db[_0xffcd9e[_0xb3dd('0x18')]],'as':_0xffcd9e['as'],'attributes':_0xffcd9e[_0xb3dd('0x15')],'include':_0xffcd9e[_0xb3dd('0x16')]?_[_0xb3dd('0x17')](_0xffcd9e[_0xb3dd('0x16')],function(_0x1e772a){return{'model':db[_0x1e772a[_0xb3dd('0x18')]],'as':_0x1e772a['as'],'attributes':_0x1e772a[_0xb3dd('0x15')],'include':_0x1e772a[_0xb3dd('0x16')]?_[_0xb3dd('0x17')](_0x1e772a['include'],function(_0x5d684e){return{'model':db[_0x5d684e['model']],'as':_0x5d684e['as'],'attributes':_0x5d684e[_0xb3dd('0x15')]};}):[]};}):[]};}):[]:[]})[_0xb3dd('0x19')](function(_0x535004){logger['info'](_0xb3dd('0x1b'),_0x74782a);logger['debug'](_0xb3dd('0x1b'),_0x74782a,JSON[_0xb3dd('0xb')](_0x535004));_0x246618(_0x535004);})[_0xb3dd('0xf')](function(_0x481db0){logger[_0xb3dd('0xc')](_0xb3dd('0x1b'),_0x481db0[_0xb3dd('0xe')],_0x74782a);_0x401ed7(_0x43bc7f[_0xb3dd('0xc')](0x1f4,_0x481db0[_0xb3dd('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 6a18981..e8a98fa 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 _0x0a6b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','delete','destroy','exports','multer','express'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x10f1eb,_0x35d3b5){_0x10f1eb=_0x10f1eb-0x0;var _0x322079=_0x0a6b[_0x10f1eb];return _0x322079;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var auth=require(_0xb0a6('0x2'));var interaction=require(_0xb0a6('0x3'));var config=require(_0xb0a6('0x4'));var controller=require('./intDeskConfiguration.controller');router[_0xb0a6('0x5')]('/',auth['isAuthenticated'](),controller[_0xb0a6('0x6')]);router[_0xb0a6('0x5')]('/:id',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0x8')]);router[_0xb0a6('0x5')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xb0a6('0x5')](_0xb0a6('0x9'),auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xa')]);router['get'](_0xb0a6('0xb'),auth[_0xb0a6('0x7')](),controller['getDescriptions']);router[_0xb0a6('0x5')](_0xb0a6('0xc'),auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xd')]);router[_0xb0a6('0xe')]('/',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xf')]);router[_0xb0a6('0xe')](_0xb0a6('0xc'),auth[_0xb0a6('0x7')](),controller['setTags']);router[_0xb0a6('0x10')]('/:id',auth[_0xb0a6('0x7')](),controller['update']);router[_0xb0a6('0x11')]('/:id',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0x12')]);module[_0xb0a6('0x13')]=router; \ No newline at end of file +var _0xf9ac=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x4525c8,_0x3b2ab0){var _0x493a5a=function(_0x30b1d4){while(--_0x30b1d4){_0x4525c8['push'](_0x4525c8['shift']());}};_0x493a5a(++_0x3b2ab0);}(_0xf9ac,0x87));var _0xcf9a=function(_0x1d6777,_0xf4e0e){_0x1d6777=_0x1d6777-0x0;var _0xea1fc6=_0xf9ac[_0x1d6777];return _0xea1fc6;};'use strict';var multer=require(_0xcf9a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcf9a('0x1'));var express=require(_0xcf9a('0x2'));var router=express['Router']();var auth=require(_0xcf9a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcf9a('0x4'));var controller=require('./intDeskConfiguration.controller');router['get']('/',auth[_0xcf9a('0x5')](),controller[_0xcf9a('0x6')]);router[_0xcf9a('0x7')](_0xcf9a('0x8'),auth['isAuthenticated'](),controller[_0xcf9a('0x9')]);router[_0xcf9a('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0xcf9a('0xa')]);router['get'](_0xcf9a('0xb'),auth['isAuthenticated'](),controller[_0xcf9a('0xc')]);router['get'](_0xcf9a('0xd'),auth[_0xcf9a('0x5')](),controller[_0xcf9a('0xe')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0xcf9a('0xf')]);router[_0xcf9a('0x10')]('/',auth['isAuthenticated'](),controller[_0xcf9a('0x11')]);router[_0xcf9a('0x10')](_0xcf9a('0x12'),auth['isAuthenticated'](),controller[_0xcf9a('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xcf9a('0x14')](_0xcf9a('0x8'),auth[_0xcf9a('0x5')](),controller[_0xcf9a('0x15')]);module[_0xcf9a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f7054fe..b9eafef 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 _0xf1da=['STRING'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xf1da,0x1a7));var _0xaf1d=function(_0x3c2a24,_0x5c67a0){_0x3c2a24=_0x3c2a24-0x0;var _0x1b29e1=_0xf1da[_0x3c2a24];return _0x1b29e1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaf1d('0x0')]},'description':{'type':Sequelize[_0xaf1d('0x0')]}}; \ No newline at end of file +var _0x3b4c=['STRING','sequelize'];(function(_0x185414,_0x5561bc){var _0x37d3f9=function(_0x555b9e){while(--_0x555b9e){_0x185414['push'](_0x185414['shift']());}};_0x37d3f9(++_0x5561bc);}(_0x3b4c,0xcd));var _0xc3b4=function(_0x365be9,_0x5e8083){_0x365be9=_0x365be9-0x0;var _0x2775be=_0x3b4c[_0x365be9];return _0x2775be;};'use strict';var Sequelize=require(_0xc3b4('0x0'));module['exports']={'name':{'type':Sequelize[_0xc3b4('0x1')]},'description':{'type':Sequelize[_0xc3b4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 201bcc0..14a2b27 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 _0x0027=['save','update','destroy','end','stack','name','map','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','filter','where','type','VIRTUAL','merge','options','count','include','findAll','rows','params','includeAll','create','body','find','findOne','DeskField','pick','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','ids','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','status','json','offset','set','apply','reject'];(function(_0x22a15e,_0x25fbc4){var _0x3e459f=function(_0x28a114){while(--_0x28a114){_0x22a15e['push'](_0x22a15e['shift']());}};_0x3e459f(++_0x25fbc4);}(_0x0027,0x190));var _0x7002=function(_0x33da0b,_0x5cbe95){_0x33da0b=_0x33da0b-0x0;var _0x3ecfef=_0x0027[_0x33da0b];return _0x3ecfef;};'use strict';var pdf=require(_0x7002('0x0'));var emlformat=require(_0x7002('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7002('0x2'));var rp=require(_0x7002('0x3'));var moment=require(_0x7002('0x4'));var BPromise=require(_0x7002('0x5'));var Mustache=require(_0x7002('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7002('0x7'));var csv=require(_0x7002('0x8'));var ejs=require(_0x7002('0x9'));var fs=require('fs');var _=require(_0x7002('0xa'));var squel=require(_0x7002('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7002('0xc'));var toCsv=require(_0x7002('0x8'));var querystring=require(_0x7002('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7002('0xe'));var hardwareService=require(_0x7002('0xf'));var logger=require(_0x7002('0x10'))('api');var utils=require(_0x7002('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x7002('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7002('0x13'));var client=jayson[_0x7002('0x14')][_0x7002('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x2247f5,_0x3c33c8,_0x1ff8eb,_0x1d7d38){return new BPromise(function(_0x354f4b,_0x3a50a0){var _0x37ac64=_0x1d7d38||client;return _0x37ac64[_0x7002('0x16')](_0x2247f5,_0x1ff8eb)[_0x7002('0x17')](function(_0x55837c){logger['info'](_0x7002('0x18'),_0x3c33c8,'request\x20sent');logger[_0x7002('0x19')](_0x7002('0x1a'),_0x3c33c8,_0x7002('0x1b'),JSON['stringify'](_0x55837c));if(_0x55837c['error']){if(_0x55837c[_0x7002('0x1c')][_0x7002('0x1d')]===0x1f4){logger[_0x7002('0x1c')](_0x7002('0x18'),_0x3c33c8,_0x55837c[_0x7002('0x1c')][_0x7002('0x1e')]);return _0x3a50a0(_0x55837c[_0x7002('0x1c')][_0x7002('0x1e')]);}logger[_0x7002('0x1c')](_0x7002('0x18'),_0x3c33c8,_0x55837c[_0x7002('0x1c')][_0x7002('0x1e')]);return _0x354f4b(_0x55837c[_0x7002('0x1c')][_0x7002('0x1e')]);}else{logger[_0x7002('0x1f')](_0x7002('0x18'),_0x3c33c8,_0x7002('0x1b'));_0x354f4b(_0x55837c[_0x7002('0x20')][_0x7002('0x1e')]);}})[_0x7002('0x21')](function(_0x4fc4ea){logger[_0x7002('0x1c')](_0x7002('0x18'),_0x3c33c8,_0x4fc4ea);_0x3a50a0(_0x4fc4ea);});});}function respondWithStatusCode(_0x2e0faf,_0x39c2ff){_0x39c2ff=_0x39c2ff||0xcc;return function(_0xa9c7b0){if(_0xa9c7b0){return _0x2e0faf['sendStatus'](_0x39c2ff);}return _0x2e0faf[_0x7002('0x22')](_0x39c2ff)['end']();};}function respondWithResult(_0x235f69,_0x17a617){_0x17a617=_0x17a617||0xc8;return function(_0x1ac5d6){if(_0x1ac5d6){return _0x235f69['status'](_0x17a617)[_0x7002('0x23')](_0x1ac5d6);}};}function respondWithFilteredResult(_0x5d7b4e,_0x2f5b45){return function(_0x14a8ba){if(_0x14a8ba){var _0x211180=_0x14a8ba['count'],_0x55ec83=_0x2f5b45[_0x7002('0x24')],_0x12c3a6=_0x2f5b45[_0x7002('0x24')]+_0x2f5b45['limit'],_0x5d3d7c;if(_0x12c3a6>=_0x211180){_0x12c3a6=_0x211180;_0x5d3d7c=0xc8;}else{_0x5d3d7c=0xce;}_0x5d7b4e[_0x7002('0x22')](_0x5d3d7c);return _0x5d7b4e[_0x7002('0x25')]('Content-Range',_0x55ec83+'-'+_0x12c3a6+'/'+_0x211180)['json'](_0x14a8ba);}return null;};}function patchUpdates(_0x53ccf5){return function(_0x6732f6){try{jsonpatch[_0x7002('0x26')](_0x6732f6,_0x53ccf5,!![]);}catch(_0x7ef746){return BPromise[_0x7002('0x27')](_0x7ef746);}return _0x6732f6[_0x7002('0x28')]();};}function saveUpdates(_0x16bfd0,_0x13dfd6){return function(_0x9ceb56){if(_0x9ceb56){return _0x9ceb56[_0x7002('0x29')](_0x16bfd0)['then'](function(_0x40ab4b){return _0x40ab4b;});}return null;};}function removeEntity(_0x13a072,_0x33e432){return function(_0x393ba1){if(_0x393ba1){return _0x393ba1[_0x7002('0x2a')]()[_0x7002('0x17')](function(){_0x13a072[_0x7002('0x22')](0xcc)[_0x7002('0x2b')]();});}};}function handleEntityNotFound(_0x2966cd,_0x4c01d8){return function(_0x35af4b){if(!_0x35af4b){_0x2966cd['sendStatus'](0x194);}return _0x35af4b;};}function handleError(_0x3ce897,_0x330eda){_0x330eda=_0x330eda||0x1f4;return function(_0x53ccea){logger[_0x7002('0x1c')](_0x53ccea[_0x7002('0x2c')]);if(_0x53ccea[_0x7002('0x2d')]){delete _0x53ccea['name'];}_0x3ce897[_0x7002('0x22')](_0x330eda)['send'](_0x53ccea);};}exports['index']=function(_0x5b9406,_0x29bf53){var _0x2b7f05={},_0x52df95={},_0x1f1659={'count':0x0,'rows':[]};var _0x1aa968=_[_0x7002('0x2e')](db[_0x7002('0x2f')][_0x7002('0x30')],function(_0x495cd1){return{'name':_0x495cd1[_0x7002('0x31')],'type':_0x495cd1['type'][_0x7002('0x32')]};});_0x52df95[_0x7002('0x33')]=_[_0x7002('0x2e')](_0x1aa968,_0x7002('0x2d'));_0x52df95[_0x7002('0x34')]=_[_0x7002('0x35')](_0x5b9406[_0x7002('0x34')]);_0x52df95[_0x7002('0x36')]=_[_0x7002('0x37')](_0x52df95[_0x7002('0x33')],_0x52df95[_0x7002('0x34')]);_0x2b7f05['attributes']=_[_0x7002('0x37')](_0x52df95['model'],qs['fields'](_0x5b9406[_0x7002('0x34')][_0x7002('0x38')]));_0x2b7f05[_0x7002('0x39')]=_0x2b7f05[_0x7002('0x39')][_0x7002('0x3a')]?_0x2b7f05[_0x7002('0x39')]:_0x52df95['model'];if(!_0x5b9406[_0x7002('0x34')]['hasOwnProperty'](_0x7002('0x3b'))){_0x2b7f05[_0x7002('0x3c')]=qs[_0x7002('0x3c')](_0x5b9406[_0x7002('0x34')][_0x7002('0x3c')]);_0x2b7f05['offset']=qs[_0x7002('0x24')](_0x5b9406[_0x7002('0x34')][_0x7002('0x24')]);}_0x2b7f05[_0x7002('0x3d')]=qs[_0x7002('0x3e')](_0x5b9406['query'][_0x7002('0x3e')]);_0x2b7f05['where']=qs[_0x7002('0x36')](_['pick'](_0x5b9406['query'],_0x52df95[_0x7002('0x36')]),_0x1aa968);if(_0x5b9406['query'][_0x7002('0x3f')]){_0x2b7f05['where']=_['merge'](_0x2b7f05[_0x7002('0x40')],{'$or':_[_0x7002('0x2e')](_0x1aa968,function(_0x504a01){if(_0x504a01[_0x7002('0x41')]!==_0x7002('0x42')){var _0x47a900={};_0x47a900[_0x504a01[_0x7002('0x2d')]]={'$like':'%'+_0x5b9406[_0x7002('0x34')][_0x7002('0x3f')]+'%'};return _0x47a900;}})});}_0x2b7f05=_[_0x7002('0x43')]({},_0x2b7f05,_0x5b9406[_0x7002('0x44')]);var _0x4d71ec={'where':_0x2b7f05[_0x7002('0x40')]};return db[_0x7002('0x2f')][_0x7002('0x45')](_0x4d71ec)[_0x7002('0x17')](function(_0x4b9292){_0x1f1659[_0x7002('0x45')]=_0x4b9292;if(_0x5b9406[_0x7002('0x34')]['includeAll']){_0x2b7f05[_0x7002('0x46')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x7002('0x47')](_0x2b7f05);})[_0x7002('0x17')](function(_0x44c159){_0x1f1659[_0x7002('0x48')]=_0x44c159;return _0x1f1659;})['then'](respondWithFilteredResult(_0x29bf53,_0x2b7f05))[_0x7002('0x21')](handleError(_0x29bf53,null));};exports['show']=function(_0x5d4d8d,_0x20c0bc){var _0x47fd20={'raw':![],'where':{'id':_0x5d4d8d[_0x7002('0x49')]['id']}},_0x995f08={};_0x995f08['model']=_[_0x7002('0x35')](db['DeskConfiguration'][_0x7002('0x30')]);_0x995f08[_0x7002('0x34')]=_['keys'](_0x5d4d8d[_0x7002('0x34')]);_0x995f08['filters']=_[_0x7002('0x37')](_0x995f08[_0x7002('0x33')],_0x995f08['query']);_0x47fd20[_0x7002('0x39')]=_['intersection'](_0x995f08[_0x7002('0x33')],qs[_0x7002('0x38')](_0x5d4d8d[_0x7002('0x34')]['fields']));_0x47fd20[_0x7002('0x39')]=_0x47fd20['attributes'][_0x7002('0x3a')]?_0x47fd20[_0x7002('0x39')]:_0x995f08['model'];if(_0x5d4d8d[_0x7002('0x34')][_0x7002('0x4a')]){_0x47fd20[_0x7002('0x46')]=[{'all':!![]}];}_0x47fd20=_[_0x7002('0x43')]({},_0x47fd20,_0x5d4d8d[_0x7002('0x44')]);return db[_0x7002('0x2f')]['find'](_0x47fd20)[_0x7002('0x17')](handleEntityNotFound(_0x20c0bc,null))['then'](respondWithResult(_0x20c0bc,null))[_0x7002('0x21')](handleError(_0x20c0bc,null));};exports[_0x7002('0x4b')]=function(_0x258000,_0x5b377f){return db[_0x7002('0x2f')][_0x7002('0x4b')](_0x258000[_0x7002('0x4c')],{})[_0x7002('0x17')](respondWithResult(_0x5b377f,0xc9))[_0x7002('0x21')](handleError(_0x5b377f,null));};exports[_0x7002('0x29')]=function(_0x3282a9,_0x5a406d){if(_0x3282a9[_0x7002('0x4c')]['id']){delete _0x3282a9[_0x7002('0x4c')]['id'];}return db[_0x7002('0x2f')]['find']({'where':{'id':_0x3282a9[_0x7002('0x49')]['id']}})[_0x7002('0x17')](handleEntityNotFound(_0x5a406d,null))[_0x7002('0x17')](saveUpdates(_0x3282a9[_0x7002('0x4c')],null))[_0x7002('0x17')](respondWithResult(_0x5a406d,null))['catch'](handleError(_0x5a406d,null));};exports[_0x7002('0x2a')]=function(_0x365c9a,_0x3edc79){return db[_0x7002('0x2f')][_0x7002('0x4d')]({'where':{'id':_0x365c9a['params']['id']}})[_0x7002('0x17')](handleEntityNotFound(_0x3edc79,null))[_0x7002('0x17')](removeEntity(_0x3edc79,null))['catch'](handleError(_0x3edc79,null));};exports['getFields']=function(_0x18e476,_0x869896,_0x5cda75){var _0x5def3f={};var _0x4060f1={};var _0x32b12c;var _0x28a8a9;return db[_0x7002('0x2f')][_0x7002('0x4e')]({'where':{'id':_0x18e476['params']['id']}})[_0x7002('0x17')](handleEntityNotFound(_0x869896,null))[_0x7002('0x17')](function(_0x2a3cc5){if(_0x2a3cc5){_0x32b12c=_0x2a3cc5;_0x4060f1[_0x7002('0x33')]=_[_0x7002('0x35')](db[_0x7002('0x4f')][_0x7002('0x30')]);_0x4060f1['query']=_[_0x7002('0x35')](_0x18e476['query']);_0x4060f1['filters']=_[_0x7002('0x37')](_0x4060f1[_0x7002('0x33')],_0x4060f1[_0x7002('0x34')]);_0x5def3f[_0x7002('0x39')]=_[_0x7002('0x37')](_0x4060f1[_0x7002('0x33')],qs['fields'](_0x18e476[_0x7002('0x34')][_0x7002('0x38')]));_0x5def3f['attributes']=_0x5def3f[_0x7002('0x39')][_0x7002('0x3a')]?_0x5def3f[_0x7002('0x39')]:_0x4060f1[_0x7002('0x33')];_0x5def3f['order']=qs['sort'](_0x18e476['query'][_0x7002('0x3e')]);_0x5def3f['where']=qs[_0x7002('0x36')](_[_0x7002('0x50')](_0x18e476[_0x7002('0x34')],_0x4060f1[_0x7002('0x36')]));if(_0x18e476[_0x7002('0x34')][_0x7002('0x3f')]){_0x5def3f[_0x7002('0x40')]=_['merge'](_0x5def3f['where'],{'$or':_[_0x7002('0x2e')](_0x5def3f[_0x7002('0x39')],function(_0x588dff){var _0x417c92={};_0x417c92[_0x588dff]={'$like':'%'+_0x18e476[_0x7002('0x34')][_0x7002('0x3f')]+'%'};return _0x417c92;})});}_0x5def3f=_[_0x7002('0x43')]({},_0x5def3f,_0x18e476[_0x7002('0x44')]);return _0x32b12c[_0x7002('0x51')](_0x5def3f);}})[_0x7002('0x17')](function(_0x3f38a1){if(_0x3f38a1){_0x28a8a9=_0x3f38a1[_0x7002('0x3a')];if(!_0x18e476['query'][_0x7002('0x52')]('nolimit')){_0x5def3f[_0x7002('0x3c')]=qs['limit'](_0x18e476[_0x7002('0x34')]['limit']);_0x5def3f[_0x7002('0x24')]=qs[_0x7002('0x24')](_0x18e476['query'][_0x7002('0x24')]);}return _0x32b12c[_0x7002('0x51')](_0x5def3f);}})[_0x7002('0x17')](function(_0x3bac8d){if(_0x3bac8d){return _0x3bac8d?{'count':_0x28a8a9,'rows':_0x3bac8d}:null;}})[_0x7002('0x17')](respondWithResult(_0x869896,null))[_0x7002('0x21')](handleError(_0x869896,null));};exports[_0x7002('0x53')]=function(_0x35134c,_0x24955f,_0x1dae87){var _0x5ecdbc={};var _0x197aae={};var _0x3f683c;var _0x2dfbd0;return db[_0x7002('0x2f')][_0x7002('0x4e')]({'where':{'id':_0x35134c['params']['id']}})[_0x7002('0x17')](handleEntityNotFound(_0x24955f,null))[_0x7002('0x17')](function(_0x50ace0){if(_0x50ace0){_0x3f683c=_0x50ace0;_0x197aae[_0x7002('0x33')]=_[_0x7002('0x35')](db[_0x7002('0x4f')]['rawAttributes']);_0x197aae[_0x7002('0x34')]=_[_0x7002('0x35')](_0x35134c[_0x7002('0x34')]);_0x197aae[_0x7002('0x36')]=_[_0x7002('0x37')](_0x197aae[_0x7002('0x33')],_0x197aae[_0x7002('0x34')]);_0x5ecdbc[_0x7002('0x39')]=_['intersection'](_0x197aae[_0x7002('0x33')],qs['fields'](_0x35134c['query'][_0x7002('0x38')]));_0x5ecdbc['attributes']=_0x5ecdbc[_0x7002('0x39')]['length']?_0x5ecdbc[_0x7002('0x39')]:_0x197aae[_0x7002('0x33')];_0x5ecdbc[_0x7002('0x3d')]=qs[_0x7002('0x3e')](_0x35134c['query'][_0x7002('0x3e')]);_0x5ecdbc[_0x7002('0x40')]=qs[_0x7002('0x36')](_['pick'](_0x35134c[_0x7002('0x34')],_0x197aae[_0x7002('0x36')]));if(_0x35134c[_0x7002('0x34')][_0x7002('0x3f')]){_0x5ecdbc[_0x7002('0x40')]=_['merge'](_0x5ecdbc['where'],{'$or':_[_0x7002('0x2e')](_0x5ecdbc[_0x7002('0x39')],function(_0x4ba0fd){var _0x252eaf={};_0x252eaf[_0x4ba0fd]={'$like':'%'+_0x35134c[_0x7002('0x34')][_0x7002('0x3f')]+'%'};return _0x252eaf;})});}_0x5ecdbc=_[_0x7002('0x43')]({},_0x5ecdbc,_0x35134c[_0x7002('0x44')]);return _0x3f683c[_0x7002('0x53')](_0x5ecdbc);}})[_0x7002('0x17')](function(_0x21bce1){if(_0x21bce1){_0x2dfbd0=_0x21bce1[_0x7002('0x3a')];if(!_0x35134c[_0x7002('0x34')][_0x7002('0x52')](_0x7002('0x3b'))){_0x5ecdbc['limit']=qs[_0x7002('0x3c')](_0x35134c['query'][_0x7002('0x3c')]);_0x5ecdbc[_0x7002('0x24')]=qs[_0x7002('0x24')](_0x35134c[_0x7002('0x34')]['offset']);}return _0x3f683c[_0x7002('0x53')](_0x5ecdbc);}})[_0x7002('0x17')](function(_0x3f1ea9){if(_0x3f1ea9){return _0x3f1ea9?{'count':_0x2dfbd0,'rows':_0x3f1ea9}:null;}})['then'](respondWithResult(_0x24955f,null))[_0x7002('0x21')](handleError(_0x24955f,null));};exports[_0x7002('0x54')]=function(_0x547516,_0x33e73a,_0x46662b){var _0xeed4e={};var _0x54ed52={};var _0x288402;var _0x26021b;return db[_0x7002('0x2f')]['findOne']({'where':{'id':_0x547516[_0x7002('0x49')]['id']}})[_0x7002('0x17')](handleEntityNotFound(_0x33e73a,null))[_0x7002('0x17')](function(_0x2ad6f9){if(_0x2ad6f9){_0x288402=_0x2ad6f9;_0x54ed52[_0x7002('0x33')]=_['keys'](db['DeskField'][_0x7002('0x30')]);_0x54ed52[_0x7002('0x34')]=_[_0x7002('0x35')](_0x547516['query']);_0x54ed52[_0x7002('0x36')]=_[_0x7002('0x37')](_0x54ed52[_0x7002('0x33')],_0x54ed52[_0x7002('0x34')]);_0xeed4e[_0x7002('0x39')]=_[_0x7002('0x37')](_0x54ed52[_0x7002('0x33')],qs[_0x7002('0x38')](_0x547516[_0x7002('0x34')][_0x7002('0x38')]));_0xeed4e['attributes']=_0xeed4e['attributes'][_0x7002('0x3a')]?_0xeed4e[_0x7002('0x39')]:_0x54ed52[_0x7002('0x33')];_0xeed4e[_0x7002('0x3d')]=qs[_0x7002('0x3e')](_0x547516['query']['sort']);_0xeed4e[_0x7002('0x40')]=qs['filters'](_[_0x7002('0x50')](_0x547516[_0x7002('0x34')],_0x54ed52[_0x7002('0x36')]));if(_0x547516[_0x7002('0x34')][_0x7002('0x3f')]){_0xeed4e[_0x7002('0x40')]=_[_0x7002('0x43')](_0xeed4e[_0x7002('0x40')],{'$or':_[_0x7002('0x2e')](_0xeed4e[_0x7002('0x39')],function(_0x4cc7c4){var _0x4e5489={};_0x4e5489[_0x4cc7c4]={'$like':'%'+_0x547516['query'][_0x7002('0x3f')]+'%'};return _0x4e5489;})});}_0xeed4e=_[_0x7002('0x43')]({},_0xeed4e,_0x547516[_0x7002('0x44')]);return _0x288402[_0x7002('0x54')](_0xeed4e);}})[_0x7002('0x17')](function(_0x21c67e){if(_0x21c67e){_0x26021b=_0x21c67e['length'];if(!_0x547516['query'][_0x7002('0x52')](_0x7002('0x3b'))){_0xeed4e[_0x7002('0x3c')]=qs[_0x7002('0x3c')](_0x547516['query'][_0x7002('0x3c')]);_0xeed4e[_0x7002('0x24')]=qs[_0x7002('0x24')](_0x547516['query'][_0x7002('0x24')]);}return _0x288402['getDescriptions'](_0xeed4e);}})[_0x7002('0x17')](function(_0x2ff092){if(_0x2ff092){return _0x2ff092?{'count':_0x26021b,'rows':_0x2ff092}:null;}})[_0x7002('0x17')](respondWithResult(_0x33e73a,null))[_0x7002('0x21')](handleError(_0x33e73a,null));};exports[_0x7002('0x55')]=function(_0x13edb7,_0x569347,_0x5ddbd3){var _0x416050={};var _0x53fda4={};var _0x33d459;var _0x2f61db;return db[_0x7002('0x2f')][_0x7002('0x4e')]({'where':{'id':_0x13edb7['params']['id']}})[_0x7002('0x17')](handleEntityNotFound(_0x569347,null))[_0x7002('0x17')](function(_0x380e1e){if(_0x380e1e){_0x33d459=_0x380e1e;_0x53fda4['model']=_[_0x7002('0x35')](db[_0x7002('0x56')]['rawAttributes']);_0x53fda4[_0x7002('0x34')]=_['keys'](_0x13edb7[_0x7002('0x34')]);_0x53fda4['filters']=_[_0x7002('0x37')](_0x53fda4[_0x7002('0x33')],_0x53fda4[_0x7002('0x34')]);_0x416050[_0x7002('0x39')]=_['intersection'](_0x53fda4['model'],qs[_0x7002('0x38')](_0x13edb7[_0x7002('0x34')][_0x7002('0x38')]));_0x416050[_0x7002('0x39')]=_0x416050['attributes'][_0x7002('0x3a')]?_0x416050[_0x7002('0x39')]:_0x53fda4[_0x7002('0x33')];_0x416050['order']=qs[_0x7002('0x3e')](_0x13edb7[_0x7002('0x34')]['sort']);_0x416050[_0x7002('0x40')]=qs[_0x7002('0x36')](_[_0x7002('0x50')](_0x13edb7[_0x7002('0x34')],_0x53fda4[_0x7002('0x36')]));if(_0x13edb7[_0x7002('0x34')][_0x7002('0x3f')]){_0x416050[_0x7002('0x40')]=_[_0x7002('0x43')](_0x416050[_0x7002('0x40')],{'$or':_[_0x7002('0x2e')](_0x416050[_0x7002('0x39')],function(_0x422e6){var _0x1498e7={};_0x1498e7[_0x422e6]={'$like':'%'+_0x13edb7[_0x7002('0x34')][_0x7002('0x3f')]+'%'};return _0x1498e7;})});}_0x416050=_['merge']({},_0x416050,_0x13edb7[_0x7002('0x44')]);return _0x33d459[_0x7002('0x55')](_0x416050);}})['then'](function(_0x4b226b){if(_0x4b226b){_0x2f61db=_0x4b226b[_0x7002('0x3a')];if(!_0x13edb7['query'][_0x7002('0x52')](_0x7002('0x3b'))){_0x416050['limit']=qs[_0x7002('0x3c')](_0x13edb7[_0x7002('0x34')][_0x7002('0x3c')]);_0x416050[_0x7002('0x24')]=qs[_0x7002('0x24')](_0x13edb7[_0x7002('0x34')][_0x7002('0x24')]);}return _0x33d459[_0x7002('0x55')](_0x416050);}})[_0x7002('0x17')](function(_0x3d12d7){if(_0x3d12d7){return _0x3d12d7?{'count':_0x2f61db,'rows':_0x3d12d7}:null;}})[_0x7002('0x17')](respondWithResult(_0x569347,null))[_0x7002('0x21')](handleError(_0x569347,null));};exports['setTags']=function(_0x58c081,_0x455bbd,_0x4dbda1){if(_0x58c081[_0x7002('0x4c')]['id']){delete _0x58c081[_0x7002('0x4c')]['id'];}return db[_0x7002('0x2f')][_0x7002('0x4e')]({'where':{'id':_0x58c081[_0x7002('0x49')]['id']}})[_0x7002('0x17')](handleEntityNotFound(_0x455bbd,null))[_0x7002('0x17')](function(_0x5526ba){if(_0x5526ba){return _0x5526ba['setTags'](_0x58c081[_0x7002('0x4c')][_0x7002('0x57')]||[]);}return null;})['then'](respondWithResult(_0x455bbd,null))[_0x7002('0x21')](handleError(_0x455bbd,null));}; \ No newline at end of file +var _0x9711=['getDescriptions','getTags','setTags','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','reject','save','update','destroy','send','index','rawAttributes','type','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','params','find','create','body','getFields','findOne','DeskField','getSubjects'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9711,0x163));var _0x1971=function(_0x563486,_0x572455){_0x563486=_0x563486-0x0;var _0x2403b1=_0x9711[_0x563486];return _0x2403b1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1971('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1971('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1971('0x2'));var moment=require('moment');var BPromise=require(_0x1971('0x3'));var Mustache=require(_0x1971('0x4'));var util=require(_0x1971('0x5'));var path=require(_0x1971('0x6'));var sox=require(_0x1971('0x7'));var csv=require(_0x1971('0x8'));var ejs=require(_0x1971('0x9'));var fs=require('fs');var _=require(_0x1971('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1971('0xb'));var deskjs=require(_0x1971('0xc'));var toCsv=require(_0x1971('0x8'));var querystring=require(_0x1971('0xd'));var Papa=require(_0x1971('0xe'));var Redis=require(_0x1971('0xf'));var authService=require(_0x1971('0x10'));var qs=require(_0x1971('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1971('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x1971('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1971('0x14'));var db=require(_0x1971('0x15'))['db'];var jayson=require(_0x1971('0x16'));var client=jayson[_0x1971('0x17')][_0x1971('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4fd7c5,_0x3b1663,_0x5f06fc,_0x3e87f8){return new BPromise(function(_0x512b62,_0x3366d5){var _0x628b50=_0x3e87f8||client;return _0x628b50[_0x1971('0x19')](_0x4fd7c5,_0x5f06fc)[_0x1971('0x1a')](function(_0x29083d){logger[_0x1971('0x1b')](_0x1971('0x1c'),_0x3b1663,_0x1971('0x1d'));logger[_0x1971('0x1e')](_0x1971('0x1f'),_0x3b1663,_0x1971('0x1d'),JSON[_0x1971('0x20')](_0x29083d));if(_0x29083d[_0x1971('0x21')]){if(_0x29083d[_0x1971('0x21')]['code']===0x1f4){logger[_0x1971('0x21')](_0x1971('0x1c'),_0x3b1663,_0x29083d[_0x1971('0x21')][_0x1971('0x22')]);return _0x3366d5(_0x29083d[_0x1971('0x21')][_0x1971('0x22')]);}logger[_0x1971('0x21')]('DeskConfiguration,\x20%s,\x20%s',_0x3b1663,_0x29083d[_0x1971('0x21')]['message']);return _0x512b62(_0x29083d[_0x1971('0x21')]['message']);}else{logger['info'](_0x1971('0x1c'),_0x3b1663,'request\x20sent');_0x512b62(_0x29083d[_0x1971('0x23')][_0x1971('0x22')]);}})[_0x1971('0x24')](function(_0x3aa92a){logger[_0x1971('0x21')](_0x1971('0x1c'),_0x3b1663,_0x3aa92a);_0x3366d5(_0x3aa92a);});});}function respondWithStatusCode(_0x26eacc,_0x1ec0aa){_0x1ec0aa=_0x1ec0aa||0xcc;return function(_0x216b3c){if(_0x216b3c){return _0x26eacc[_0x1971('0x25')](_0x1ec0aa);}return _0x26eacc[_0x1971('0x26')](_0x1ec0aa)[_0x1971('0x27')]();};}function respondWithResult(_0x1106b3,_0x56ccc5){_0x56ccc5=_0x56ccc5||0xc8;return function(_0x9f0ed0){if(_0x9f0ed0){return _0x1106b3[_0x1971('0x26')](_0x56ccc5)['json'](_0x9f0ed0);}};}function respondWithFilteredResult(_0x7484c1,_0x496965){return function(_0x2e769c){if(_0x2e769c){var _0x37f570=_0x2e769c[_0x1971('0x28')],_0x551915=_0x496965[_0x1971('0x29')],_0x5365d3=_0x496965[_0x1971('0x29')]+_0x496965[_0x1971('0x2a')],_0x475999;if(_0x5365d3>=_0x37f570){_0x5365d3=_0x37f570;_0x475999=0xc8;}else{_0x475999=0xce;}_0x7484c1[_0x1971('0x26')](_0x475999);return _0x7484c1['set'](_0x1971('0x2b'),_0x551915+'-'+_0x5365d3+'/'+_0x37f570)['json'](_0x2e769c);}return null;};}function patchUpdates(_0x57d26f){return function(_0x21299d){try{jsonpatch['apply'](_0x21299d,_0x57d26f,!![]);}catch(_0x32f3fc){return BPromise[_0x1971('0x2c')](_0x32f3fc);}return _0x21299d[_0x1971('0x2d')]();};}function saveUpdates(_0x222b55,_0x34d021){return function(_0x321a65){if(_0x321a65){return _0x321a65[_0x1971('0x2e')](_0x222b55)[_0x1971('0x1a')](function(_0x171773){return _0x171773;});}return null;};}function removeEntity(_0x3ea4e5,_0x175868){return function(_0x2ee89e){if(_0x2ee89e){return _0x2ee89e[_0x1971('0x2f')]()[_0x1971('0x1a')](function(){_0x3ea4e5[_0x1971('0x26')](0xcc)[_0x1971('0x27')]();});}};}function handleEntityNotFound(_0x574e08,_0x4b0f85){return function(_0xd0e3e0){if(!_0xd0e3e0){_0x574e08[_0x1971('0x25')](0x194);}return _0xd0e3e0;};}function handleError(_0x264b80,_0x2461ab){_0x2461ab=_0x2461ab||0x1f4;return function(_0x539ba4){logger[_0x1971('0x21')](_0x539ba4['stack']);if(_0x539ba4['name']){delete _0x539ba4['name'];}_0x264b80[_0x1971('0x26')](_0x2461ab)[_0x1971('0x30')](_0x539ba4);};}exports[_0x1971('0x31')]=function(_0xbb312,_0x2ed2b8){var _0x78d695={},_0x2a2894={},_0x349658={'count':0x0,'rows':[]};var _0x3f346e=_['map'](db['DeskConfiguration'][_0x1971('0x32')],function(_0x440508){return{'name':_0x440508['fieldName'],'type':_0x440508[_0x1971('0x33')]['key']};});_0x2a2894[_0x1971('0x34')]=_[_0x1971('0x35')](_0x3f346e,_0x1971('0x36'));_0x2a2894[_0x1971('0x37')]=_[_0x1971('0x38')](_0xbb312[_0x1971('0x37')]);_0x2a2894[_0x1971('0x39')]=_[_0x1971('0x3a')](_0x2a2894[_0x1971('0x34')],_0x2a2894[_0x1971('0x37')]);_0x78d695['attributes']=_[_0x1971('0x3a')](_0x2a2894[_0x1971('0x34')],qs[_0x1971('0x3b')](_0xbb312[_0x1971('0x37')][_0x1971('0x3b')]));_0x78d695[_0x1971('0x3c')]=_0x78d695[_0x1971('0x3c')][_0x1971('0x3d')]?_0x78d695['attributes']:_0x2a2894['model'];if(!_0xbb312[_0x1971('0x37')][_0x1971('0x3e')](_0x1971('0x3f'))){_0x78d695['limit']=qs[_0x1971('0x2a')](_0xbb312[_0x1971('0x37')][_0x1971('0x2a')]);_0x78d695[_0x1971('0x29')]=qs[_0x1971('0x29')](_0xbb312[_0x1971('0x37')][_0x1971('0x29')]);}_0x78d695[_0x1971('0x40')]=qs[_0x1971('0x41')](_0xbb312[_0x1971('0x37')][_0x1971('0x41')]);_0x78d695[_0x1971('0x42')]=qs[_0x1971('0x39')](_[_0x1971('0x43')](_0xbb312['query'],_0x2a2894[_0x1971('0x39')]),_0x3f346e);if(_0xbb312['query'][_0x1971('0x44')]){_0x78d695[_0x1971('0x42')]=_[_0x1971('0x45')](_0x78d695['where'],{'$or':_[_0x1971('0x35')](_0x3f346e,function(_0x419d3d){if(_0x419d3d[_0x1971('0x33')]!==_0x1971('0x46')){var _0xcd7010={};_0xcd7010[_0x419d3d[_0x1971('0x36')]]={'$like':'%'+_0xbb312[_0x1971('0x37')][_0x1971('0x44')]+'%'};return _0xcd7010;}})});}_0x78d695=_[_0x1971('0x45')]({},_0x78d695,_0xbb312[_0x1971('0x47')]);var _0x5ac344={'where':_0x78d695[_0x1971('0x42')]};return db[_0x1971('0x48')][_0x1971('0x28')](_0x5ac344)['then'](function(_0xa95f66){_0x349658['count']=_0xa95f66;if(_0xbb312[_0x1971('0x37')][_0x1971('0x49')]){_0x78d695[_0x1971('0x4a')]=[{'all':!![]}];}return db[_0x1971('0x48')][_0x1971('0x4b')](_0x78d695);})[_0x1971('0x1a')](function(_0x3fc107){_0x349658[_0x1971('0x4c')]=_0x3fc107;return _0x349658;})[_0x1971('0x1a')](respondWithFilteredResult(_0x2ed2b8,_0x78d695))[_0x1971('0x24')](handleError(_0x2ed2b8,null));};exports['show']=function(_0x14705e,_0x4a72d2){var _0x522c46={'raw':![],'where':{'id':_0x14705e[_0x1971('0x4d')]['id']}},_0x252b68={};_0x252b68[_0x1971('0x34')]=_[_0x1971('0x38')](db[_0x1971('0x48')][_0x1971('0x32')]);_0x252b68[_0x1971('0x37')]=_[_0x1971('0x38')](_0x14705e[_0x1971('0x37')]);_0x252b68[_0x1971('0x39')]=_[_0x1971('0x3a')](_0x252b68[_0x1971('0x34')],_0x252b68[_0x1971('0x37')]);_0x522c46[_0x1971('0x3c')]=_[_0x1971('0x3a')](_0x252b68[_0x1971('0x34')],qs[_0x1971('0x3b')](_0x14705e['query'][_0x1971('0x3b')]));_0x522c46['attributes']=_0x522c46['attributes'][_0x1971('0x3d')]?_0x522c46[_0x1971('0x3c')]:_0x252b68[_0x1971('0x34')];if(_0x14705e[_0x1971('0x37')][_0x1971('0x49')]){_0x522c46[_0x1971('0x4a')]=[{'all':!![]}];}_0x522c46=_[_0x1971('0x45')]({},_0x522c46,_0x14705e['options']);return db[_0x1971('0x48')][_0x1971('0x4e')](_0x522c46)[_0x1971('0x1a')](handleEntityNotFound(_0x4a72d2,null))[_0x1971('0x1a')](respondWithResult(_0x4a72d2,null))[_0x1971('0x24')](handleError(_0x4a72d2,null));};exports['create']=function(_0x2d83a1,_0x1e0471){return db[_0x1971('0x48')][_0x1971('0x4f')](_0x2d83a1[_0x1971('0x50')],{})['then'](respondWithResult(_0x1e0471,0xc9))[_0x1971('0x24')](handleError(_0x1e0471,null));};exports[_0x1971('0x2e')]=function(_0x434666,_0x76ad6c){if(_0x434666[_0x1971('0x50')]['id']){delete _0x434666[_0x1971('0x50')]['id'];}return db[_0x1971('0x48')][_0x1971('0x4e')]({'where':{'id':_0x434666[_0x1971('0x4d')]['id']}})[_0x1971('0x1a')](handleEntityNotFound(_0x76ad6c,null))[_0x1971('0x1a')](saveUpdates(_0x434666[_0x1971('0x50')],null))['then'](respondWithResult(_0x76ad6c,null))['catch'](handleError(_0x76ad6c,null));};exports[_0x1971('0x2f')]=function(_0x2f9da0,_0x4fcf76){return db[_0x1971('0x48')][_0x1971('0x4e')]({'where':{'id':_0x2f9da0[_0x1971('0x4d')]['id']}})[_0x1971('0x1a')](handleEntityNotFound(_0x4fcf76,null))[_0x1971('0x1a')](removeEntity(_0x4fcf76,null))['catch'](handleError(_0x4fcf76,null));};exports[_0x1971('0x51')]=function(_0x4691e9,_0x47d879,_0x130a3b){var _0x383c9f={};var _0x218c2d={};var _0x330b8c;var _0x4ede0e;return db[_0x1971('0x48')][_0x1971('0x52')]({'where':{'id':_0x4691e9['params']['id']}})[_0x1971('0x1a')](handleEntityNotFound(_0x47d879,null))[_0x1971('0x1a')](function(_0x5cdafc){if(_0x5cdafc){_0x330b8c=_0x5cdafc;_0x218c2d[_0x1971('0x34')]=_[_0x1971('0x38')](db[_0x1971('0x53')][_0x1971('0x32')]);_0x218c2d[_0x1971('0x37')]=_[_0x1971('0x38')](_0x4691e9[_0x1971('0x37')]);_0x218c2d[_0x1971('0x39')]=_[_0x1971('0x3a')](_0x218c2d[_0x1971('0x34')],_0x218c2d[_0x1971('0x37')]);_0x383c9f[_0x1971('0x3c')]=_[_0x1971('0x3a')](_0x218c2d[_0x1971('0x34')],qs[_0x1971('0x3b')](_0x4691e9['query']['fields']));_0x383c9f[_0x1971('0x3c')]=_0x383c9f[_0x1971('0x3c')]['length']?_0x383c9f['attributes']:_0x218c2d[_0x1971('0x34')];_0x383c9f[_0x1971('0x40')]=qs['sort'](_0x4691e9[_0x1971('0x37')][_0x1971('0x41')]);_0x383c9f[_0x1971('0x42')]=qs['filters'](_[_0x1971('0x43')](_0x4691e9['query'],_0x218c2d[_0x1971('0x39')]));if(_0x4691e9['query'][_0x1971('0x44')]){_0x383c9f[_0x1971('0x42')]=_['merge'](_0x383c9f[_0x1971('0x42')],{'$or':_[_0x1971('0x35')](_0x383c9f[_0x1971('0x3c')],function(_0x40ab27){var _0x521778={};_0x521778[_0x40ab27]={'$like':'%'+_0x4691e9[_0x1971('0x37')]['filter']+'%'};return _0x521778;})});}_0x383c9f=_[_0x1971('0x45')]({},_0x383c9f,_0x4691e9['options']);return _0x330b8c[_0x1971('0x51')](_0x383c9f);}})[_0x1971('0x1a')](function(_0x544adc){if(_0x544adc){_0x4ede0e=_0x544adc[_0x1971('0x3d')];if(!_0x4691e9[_0x1971('0x37')][_0x1971('0x3e')](_0x1971('0x3f'))){_0x383c9f[_0x1971('0x2a')]=qs['limit'](_0x4691e9['query']['limit']);_0x383c9f[_0x1971('0x29')]=qs[_0x1971('0x29')](_0x4691e9[_0x1971('0x37')][_0x1971('0x29')]);}return _0x330b8c[_0x1971('0x51')](_0x383c9f);}})[_0x1971('0x1a')](function(_0x44d0de){if(_0x44d0de){return _0x44d0de?{'count':_0x4ede0e,'rows':_0x44d0de}:null;}})['then'](respondWithResult(_0x47d879,null))[_0x1971('0x24')](handleError(_0x47d879,null));};exports[_0x1971('0x54')]=function(_0x44deec,_0x54f339,_0x640971){var _0xe34398={};var _0x56d4f6={};var _0x575ba3;var _0x37791c;return db[_0x1971('0x48')][_0x1971('0x52')]({'where':{'id':_0x44deec[_0x1971('0x4d')]['id']}})[_0x1971('0x1a')](handleEntityNotFound(_0x54f339,null))[_0x1971('0x1a')](function(_0x10bea2){if(_0x10bea2){_0x575ba3=_0x10bea2;_0x56d4f6[_0x1971('0x34')]=_[_0x1971('0x38')](db[_0x1971('0x53')][_0x1971('0x32')]);_0x56d4f6[_0x1971('0x37')]=_[_0x1971('0x38')](_0x44deec[_0x1971('0x37')]);_0x56d4f6['filters']=_['intersection'](_0x56d4f6[_0x1971('0x34')],_0x56d4f6[_0x1971('0x37')]);_0xe34398[_0x1971('0x3c')]=_[_0x1971('0x3a')](_0x56d4f6[_0x1971('0x34')],qs[_0x1971('0x3b')](_0x44deec['query'][_0x1971('0x3b')]));_0xe34398[_0x1971('0x3c')]=_0xe34398['attributes'][_0x1971('0x3d')]?_0xe34398['attributes']:_0x56d4f6[_0x1971('0x34')];_0xe34398[_0x1971('0x40')]=qs[_0x1971('0x41')](_0x44deec[_0x1971('0x37')][_0x1971('0x41')]);_0xe34398[_0x1971('0x42')]=qs[_0x1971('0x39')](_[_0x1971('0x43')](_0x44deec[_0x1971('0x37')],_0x56d4f6[_0x1971('0x39')]));if(_0x44deec['query'][_0x1971('0x44')]){_0xe34398[_0x1971('0x42')]=_[_0x1971('0x45')](_0xe34398[_0x1971('0x42')],{'$or':_['map'](_0xe34398['attributes'],function(_0x437015){var _0x413960={};_0x413960[_0x437015]={'$like':'%'+_0x44deec[_0x1971('0x37')]['filter']+'%'};return _0x413960;})});}_0xe34398=_['merge']({},_0xe34398,_0x44deec['options']);return _0x575ba3[_0x1971('0x54')](_0xe34398);}})['then'](function(_0x1789cd){if(_0x1789cd){_0x37791c=_0x1789cd[_0x1971('0x3d')];if(!_0x44deec[_0x1971('0x37')][_0x1971('0x3e')](_0x1971('0x3f'))){_0xe34398[_0x1971('0x2a')]=qs[_0x1971('0x2a')](_0x44deec['query'][_0x1971('0x2a')]);_0xe34398[_0x1971('0x29')]=qs[_0x1971('0x29')](_0x44deec[_0x1971('0x37')][_0x1971('0x29')]);}return _0x575ba3[_0x1971('0x54')](_0xe34398);}})[_0x1971('0x1a')](function(_0x34b82f){if(_0x34b82f){return _0x34b82f?{'count':_0x37791c,'rows':_0x34b82f}:null;}})[_0x1971('0x1a')](respondWithResult(_0x54f339,null))[_0x1971('0x24')](handleError(_0x54f339,null));};exports[_0x1971('0x55')]=function(_0x29dd9f,_0x41085a,_0x220750){var _0x52c4db={};var _0x364f34={};var _0x5934a7;var _0x55be8f;return db[_0x1971('0x48')][_0x1971('0x52')]({'where':{'id':_0x29dd9f['params']['id']}})[_0x1971('0x1a')](handleEntityNotFound(_0x41085a,null))[_0x1971('0x1a')](function(_0x3e8116){if(_0x3e8116){_0x5934a7=_0x3e8116;_0x364f34[_0x1971('0x34')]=_[_0x1971('0x38')](db[_0x1971('0x53')][_0x1971('0x32')]);_0x364f34['query']=_['keys'](_0x29dd9f['query']);_0x364f34[_0x1971('0x39')]=_[_0x1971('0x3a')](_0x364f34[_0x1971('0x34')],_0x364f34[_0x1971('0x37')]);_0x52c4db['attributes']=_['intersection'](_0x364f34[_0x1971('0x34')],qs[_0x1971('0x3b')](_0x29dd9f[_0x1971('0x37')][_0x1971('0x3b')]));_0x52c4db['attributes']=_0x52c4db[_0x1971('0x3c')][_0x1971('0x3d')]?_0x52c4db[_0x1971('0x3c')]:_0x364f34['model'];_0x52c4db[_0x1971('0x40')]=qs[_0x1971('0x41')](_0x29dd9f[_0x1971('0x37')][_0x1971('0x41')]);_0x52c4db[_0x1971('0x42')]=qs[_0x1971('0x39')](_[_0x1971('0x43')](_0x29dd9f[_0x1971('0x37')],_0x364f34[_0x1971('0x39')]));if(_0x29dd9f[_0x1971('0x37')][_0x1971('0x44')]){_0x52c4db[_0x1971('0x42')]=_['merge'](_0x52c4db[_0x1971('0x42')],{'$or':_[_0x1971('0x35')](_0x52c4db[_0x1971('0x3c')],function(_0x95f313){var _0x3a7305={};_0x3a7305[_0x95f313]={'$like':'%'+_0x29dd9f[_0x1971('0x37')]['filter']+'%'};return _0x3a7305;})});}_0x52c4db=_[_0x1971('0x45')]({},_0x52c4db,_0x29dd9f['options']);return _0x5934a7[_0x1971('0x55')](_0x52c4db);}})[_0x1971('0x1a')](function(_0x2a3852){if(_0x2a3852){_0x55be8f=_0x2a3852[_0x1971('0x3d')];if(!_0x29dd9f['query'][_0x1971('0x3e')](_0x1971('0x3f'))){_0x52c4db['limit']=qs[_0x1971('0x2a')](_0x29dd9f[_0x1971('0x37')]['limit']);_0x52c4db['offset']=qs[_0x1971('0x29')](_0x29dd9f[_0x1971('0x37')][_0x1971('0x29')]);}return _0x5934a7[_0x1971('0x55')](_0x52c4db);}})['then'](function(_0x3babcc){if(_0x3babcc){return _0x3babcc?{'count':_0x55be8f,'rows':_0x3babcc}:null;}})[_0x1971('0x1a')](respondWithResult(_0x41085a,null))[_0x1971('0x24')](handleError(_0x41085a,null));};exports[_0x1971('0x56')]=function(_0x1970eb,_0x3fef04,_0x3933da){var _0x4eced2={};var _0x3be8cb={};var _0x416758;var _0x2e29df;return db[_0x1971('0x48')][_0x1971('0x52')]({'where':{'id':_0x1970eb['params']['id']}})['then'](handleEntityNotFound(_0x3fef04,null))[_0x1971('0x1a')](function(_0x1935d3){if(_0x1935d3){_0x416758=_0x1935d3;_0x3be8cb[_0x1971('0x34')]=_[_0x1971('0x38')](db['Tag'][_0x1971('0x32')]);_0x3be8cb['query']=_['keys'](_0x1970eb[_0x1971('0x37')]);_0x3be8cb[_0x1971('0x39')]=_['intersection'](_0x3be8cb[_0x1971('0x34')],_0x3be8cb[_0x1971('0x37')]);_0x4eced2[_0x1971('0x3c')]=_[_0x1971('0x3a')](_0x3be8cb['model'],qs['fields'](_0x1970eb[_0x1971('0x37')][_0x1971('0x3b')]));_0x4eced2[_0x1971('0x3c')]=_0x4eced2['attributes'][_0x1971('0x3d')]?_0x4eced2['attributes']:_0x3be8cb[_0x1971('0x34')];_0x4eced2[_0x1971('0x40')]=qs[_0x1971('0x41')](_0x1970eb[_0x1971('0x37')][_0x1971('0x41')]);_0x4eced2[_0x1971('0x42')]=qs['filters'](_[_0x1971('0x43')](_0x1970eb[_0x1971('0x37')],_0x3be8cb['filters']));if(_0x1970eb[_0x1971('0x37')]['filter']){_0x4eced2[_0x1971('0x42')]=_[_0x1971('0x45')](_0x4eced2['where'],{'$or':_[_0x1971('0x35')](_0x4eced2[_0x1971('0x3c')],function(_0x2ddff2){var _0x558dd4={};_0x558dd4[_0x2ddff2]={'$like':'%'+_0x1970eb[_0x1971('0x37')][_0x1971('0x44')]+'%'};return _0x558dd4;})});}_0x4eced2=_[_0x1971('0x45')]({},_0x4eced2,_0x1970eb[_0x1971('0x47')]);return _0x416758[_0x1971('0x56')](_0x4eced2);}})['then'](function(_0x131fbd){if(_0x131fbd){_0x2e29df=_0x131fbd['length'];if(!_0x1970eb[_0x1971('0x37')][_0x1971('0x3e')]('nolimit')){_0x4eced2[_0x1971('0x2a')]=qs['limit'](_0x1970eb[_0x1971('0x37')]['limit']);_0x4eced2['offset']=qs[_0x1971('0x29')](_0x1970eb[_0x1971('0x37')]['offset']);}return _0x416758[_0x1971('0x56')](_0x4eced2);}})['then'](function(_0x4d5f44){if(_0x4d5f44){return _0x4d5f44?{'count':_0x2e29df,'rows':_0x4d5f44}:null;}})['then'](respondWithResult(_0x3fef04,null))['catch'](handleError(_0x3fef04,null));};exports['setTags']=function(_0xc63139,_0xca9b8,_0x57d85d){if(_0xc63139['body']['id']){delete _0xc63139[_0x1971('0x50')]['id'];}return db[_0x1971('0x48')][_0x1971('0x52')]({'where':{'id':_0xc63139[_0x1971('0x4d')]['id']}})[_0x1971('0x1a')](handleEntityNotFound(_0xca9b8,null))[_0x1971('0x1a')](function(_0xcf35d6){if(_0xcf35d6){return _0xcf35d6[_0x1971('0x57')](_0xc63139[_0x1971('0x50')]['ids']||[]);}return null;})['then'](respondWithResult(_0xca9b8,null))['catch'](handleError(_0xca9b8,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 7f55440..a6f68f2 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 _0xb0ef=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','util'];(function(_0x2324f0,_0x17b511){var _0x468e66=function(_0x6f42ee){while(--_0x6f42ee){_0x2324f0['push'](_0x2324f0['shift']());}};_0x468e66(++_0x17b511);}(_0xb0ef,0xbf));var _0xfb0e=function(_0x198ecb,_0x41412e){_0x198ecb=_0x198ecb-0x0;var _0x2e3893=_0xb0ef[_0x198ecb];return _0x2e3893;};'use strict';var _=require('lodash');var util=require(_0xfb0e('0x0'));var logger=require(_0xfb0e('0x1'))(_0xfb0e('0x2'));var moment=require(_0xfb0e('0x3'));var BPromise=require(_0xfb0e('0x4'));var rp=require(_0xfb0e('0x5'));var fs=require('fs');var path=require(_0xfb0e('0x6'));var rimraf=require(_0xfb0e('0x7'));var config=require('../../config/environment');var attributes=require(_0xfb0e('0x8'));module[_0xfb0e('0x9')]=function(_0x4877b8,_0x5a703d){return _0x4877b8['define'](_0xfb0e('0xa'),attributes,{'tableName':_0xfb0e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fe8=['define','DeskConfiguration','int_desk_configurations','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x25e35c,_0x2f09b8){var _0x27dcc4=function(_0x47d47c){while(--_0x47d47c){_0x25e35c['push'](_0x25e35c['shift']());}};_0x27dcc4(++_0x2f09b8);}(_0x6fe8,0x9f));var _0x86fe=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0x6fe8[_0x420513];return _0x1b44ec;};'use strict';var _=require('lodash');var util=require(_0x86fe('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x86fe('0x1'));var BPromise=require(_0x86fe('0x2'));var rp=require(_0x86fe('0x3'));var fs=require('fs');var path=require(_0x86fe('0x4'));var rimraf=require(_0x86fe('0x5'));var config=require(_0x86fe('0x6'));var attributes=require(_0x86fe('0x7'));module[_0x86fe('0x8')]=function(_0x317ae4,_0x4eeeca){return _0x317ae4[_0x86fe('0x9')](_0x86fe('0xa'),attributes,{'tableName':_0x86fe('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 5fabac4..f77e89f 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 _0x96cc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x376620,_0x520359){var _0x574e88=function(_0x13d858){while(--_0x13d858){_0x376620['push'](_0x376620['shift']());}};_0x574e88(++_0x520359);}(_0x96cc,0x16c));var _0xc96c=function(_0x20d916,_0x4bfa65){_0x20d916=_0x20d916-0x0;var _0x366417=_0x96cc[_0x20d916];return _0x366417;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});} \ No newline at end of file +var _0x25b5=['info','request\x20sent','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then'];(function(_0x40ac03,_0x2f7590){var _0x12fca6=function(_0x603aa8){while(--_0x603aa8){_0x40ac03['push'](_0x40ac03['shift']());}};_0x12fca6(++_0x2f7590);}(_0x25b5,0x198));var _0x525b=function(_0x1d590f,_0x484663){_0x1d590f=_0x1d590f-0x0;var _0x223cc9=_0x25b5[_0x1d590f];return _0x223cc9;};'use strict';var _=require(_0x525b('0x0'));var util=require(_0x525b('0x1'));var moment=require(_0x525b('0x2'));var BPromise=require(_0x525b('0x3'));var rs=require(_0x525b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x525b('0x5'))['db'];var utils=require(_0x525b('0x6'));var logger=require(_0x525b('0x7'))(_0x525b('0x8'));var config=require(_0x525b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x525b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x511ef5,_0x4d6f5b,_0x17b475){return new BPromise(function(_0x3ef6f1,_0x1656ac){return client['request'](_0x511ef5,_0x17b475)[_0x525b('0xb')](function(_0x1b2d14){logger[_0x525b('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x4d6f5b,'request\x20sent');logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4d6f5b,_0x525b('0xd'),JSON[_0x525b('0xe')](_0x1b2d14));if(_0x1b2d14['error']){if(_0x1b2d14[_0x525b('0xf')][_0x525b('0x10')]===0x1f4){logger[_0x525b('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x4d6f5b,_0x1b2d14['error'][_0x525b('0x11')]);return _0x1656ac(_0x1b2d14[_0x525b('0xf')][_0x525b('0x11')]);}logger[_0x525b('0xf')](_0x525b('0x12'),_0x4d6f5b,_0x1b2d14[_0x525b('0xf')][_0x525b('0x11')]);return _0x3ef6f1(_0x1b2d14[_0x525b('0xf')][_0x525b('0x11')]);}else{logger[_0x525b('0xc')](_0x525b('0x12'),_0x4d6f5b,'request\x20sent');_0x3ef6f1(_0x1b2d14[_0x525b('0x13')][_0x525b('0x11')]);}})[_0x525b('0x14')](function(_0x4d523f){logger['error'](_0x525b('0x12'),_0x4d6f5b,_0x4d523f);_0x1656ac(_0x4d523f);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index b07a568..be56809 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 _0x0152=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskField.controller','get','/:id','isAuthenticated','show','post','create','put','update','destroy','multer'];(function(_0x3bb761,_0x4cb8ce){var _0x453e3f=function(_0x4cb828){while(--_0x4cb828){_0x3bb761['push'](_0x3bb761['shift']());}};_0x453e3f(++_0x4cb8ce);}(_0x0152,0x186));var _0x2015=function(_0x494b71,_0x4125c0){_0x494b71=_0x494b71-0x0;var _0x43acf0=_0x0152[_0x494b71];return _0x43acf0;};'use strict';var multer=require(_0x2015('0x0'));var util=require(_0x2015('0x1'));var path=require(_0x2015('0x2'));var timeout=require(_0x2015('0x3'));var express=require(_0x2015('0x4'));var router=express['Router']();var auth=require(_0x2015('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2015('0x6'));var controller=require(_0x2015('0x7'));router[_0x2015('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2015('0x9'),auth[_0x2015('0xa')](),controller[_0x2015('0xb')]);router[_0x2015('0xc')]('/',auth['isAuthenticated'](),controller[_0x2015('0xd')]);router[_0x2015('0xe')](_0x2015('0x9'),auth[_0x2015('0xa')](),controller[_0x2015('0xf')]);router['delete'](_0x2015('0x9'),auth[_0x2015('0xa')](),controller[_0x2015('0x10')]);module['exports']=router; \ No newline at end of file +var _0x56d2=['index','isAuthenticated','show','post','put','delete','/:id','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','get'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x56d2,0x18f));var _0x256d=function(_0x6d8672,_0x117429){_0x6d8672=_0x6d8672-0x0;var _0x494f51=_0x56d2[_0x6d8672];return _0x494f51;};'use strict';var multer=require('multer');var util=require(_0x256d('0x0'));var path=require(_0x256d('0x1'));var timeout=require(_0x256d('0x2'));var express=require(_0x256d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x256d('0x4'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0x256d('0x5')]('/',auth['isAuthenticated'](),controller[_0x256d('0x6')]);router[_0x256d('0x5')]('/:id',auth[_0x256d('0x7')](),controller[_0x256d('0x8')]);router[_0x256d('0x9')]('/',auth[_0x256d('0x7')](),controller['create']);router[_0x256d('0xa')]('/:id',auth[_0x256d('0x7')](),controller['update']);router[_0x256d('0xb')](_0x256d('0xc'),auth[_0x256d('0x7')](),controller[_0x256d('0xd')]);module[_0x256d('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index f3e6652..a73c757 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 _0xa092=['string','customVariable','keyValue','STRING','BOOLEAN','ENUM'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xa092,0x1d9));var _0x2a09=function(_0x55c947,_0x5e20a8){_0x55c947=_0x55c947-0x0;var _0x2556b3=_0xa092[_0x55c947];return _0x2556b3;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x2a09('0x0')](_0x2a09('0x1'),'variable',_0x2a09('0x2'),_0x2a09('0x3')),'defaultValue':_0x2a09('0x1')},'content':{'type':Sequelize[_0x2a09('0x4')]},'key':{'type':Sequelize[_0x2a09('0x4')]},'keyType':{'type':Sequelize[_0x2a09('0x0')](_0x2a09('0x1'),'variable',_0x2a09('0x2'))},'keyContent':{'type':Sequelize[_0x2a09('0x4')]},'idField':{'type':Sequelize[_0x2a09('0x4')]},'nameField':{'type':Sequelize[_0x2a09('0x4')]},'customField':{'type':Sequelize[_0x2a09('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a09('0x4')]}}; \ No newline at end of file +var _0x152e=['sequelize','customVariable','keyValue','string','STRING','ENUM','variable','BOOLEAN'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x152e,0x150));var _0xe152=function(_0x1df784,_0x131771){_0x1df784=_0x1df784-0x0;var _0x7abef0=_0x152e[_0x1df784];return _0x7abef0;};'use strict';var Sequelize=require(_0xe152('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0xe152('0x1'),_0xe152('0x2')),'defaultValue':_0xe152('0x3')},'content':{'type':Sequelize[_0xe152('0x4')]},'key':{'type':Sequelize[_0xe152('0x4')]},'keyType':{'type':Sequelize[_0xe152('0x5')]('string',_0xe152('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xe152('0x4')]},'idField':{'type':Sequelize[_0xe152('0x4')]},'nameField':{'type':Sequelize[_0xe152('0x4')]},'customField':{'type':Sequelize[_0xe152('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 7352e14..b1f0323 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 _0x0310=['../../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','update','destroy','then','error','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','DeskField','findAll','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3f569c,_0x1ba524){var _0x55adb8=function(_0x1de13f){while(--_0x1de13f){_0x3f569c['push'](_0x3f569c['shift']());}};_0x55adb8(++_0x1ba524);}(_0x0310,0x115));var _0x0031=function(_0x107eae,_0xc0012c){_0x107eae=_0x107eae-0x0;var _0x4ee4b3=_0x0310[_0x107eae];return _0x4ee4b3;};'use strict';var pdf=require(_0x0031('0x0'));var emlformat=require(_0x0031('0x1'));var rimraf=require(_0x0031('0x2'));var zipdir=require(_0x0031('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0031('0x4'));var moment=require('moment');var BPromise=require(_0x0031('0x5'));var Mustache=require('mustache');var util=require(_0x0031('0x6'));var path=require('path');var sox=require(_0x0031('0x7'));var csv=require('to-csv');var ejs=require(_0x0031('0x8'));var fs=require('fs');var _=require(_0x0031('0x9'));var squel=require(_0x0031('0xa'));var crypto=require(_0x0031('0xb'));var jsforce=require(_0x0031('0xc'));var deskjs=require(_0x0031('0xd'));var toCsv=require(_0x0031('0xe'));var querystring=require(_0x0031('0xf'));var Papa=require(_0x0031('0x10'));var Redis=require(_0x0031('0x11'));var authService=require(_0x0031('0x12'));var qs=require(_0x0031('0x13'));var as=require(_0x0031('0x14'));var hardwareService=require(_0x0031('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x0031('0x16'));var config=require(_0x0031('0x17'));var licenseUtil=require(_0x0031('0x18'));var db=require(_0x0031('0x19'))['db'];function respondWithStatusCode(_0x48fe40,_0x16014b){_0x16014b=_0x16014b||0xcc;return function(_0x324cfb){if(_0x324cfb){return _0x48fe40[_0x0031('0x1a')](_0x16014b);}return _0x48fe40[_0x0031('0x1b')](_0x16014b)[_0x0031('0x1c')]();};}function respondWithResult(_0x168e46,_0x489ab6){_0x489ab6=_0x489ab6||0xc8;return function(_0x4ca6a5){if(_0x4ca6a5){return _0x168e46[_0x0031('0x1b')](_0x489ab6)[_0x0031('0x1d')](_0x4ca6a5);}};}function respondWithFilteredResult(_0x27e7bb,_0x1ab90a){return function(_0x3c7ee4){if(_0x3c7ee4){var _0x543b0d=_0x3c7ee4[_0x0031('0x1e')],_0x1ac1bb=_0x1ab90a[_0x0031('0x1f')],_0x35b73d=_0x1ab90a[_0x0031('0x1f')]+_0x1ab90a[_0x0031('0x20')],_0x3e21e9;if(_0x35b73d>=_0x543b0d){_0x35b73d=_0x543b0d;_0x3e21e9=0xc8;}else{_0x3e21e9=0xce;}_0x27e7bb[_0x0031('0x1b')](_0x3e21e9);return _0x27e7bb[_0x0031('0x21')](_0x0031('0x22'),_0x1ac1bb+'-'+_0x35b73d+'/'+_0x543b0d)['json'](_0x3c7ee4);}return null;};}function patchUpdates(_0xc75d1a){return function(_0x4c145a){try{jsonpatch['apply'](_0x4c145a,_0xc75d1a,!![]);}catch(_0x3fb6a7){return BPromise[_0x0031('0x23')](_0x3fb6a7);}return _0x4c145a['save']();};}function saveUpdates(_0x5a0cd8,_0xd7b89d){return function(_0x33c9e0){if(_0x33c9e0){return _0x33c9e0[_0x0031('0x24')](_0x5a0cd8)['then'](function(_0x2612eb){return _0x2612eb;});}return null;};}function removeEntity(_0x4a8fc3,_0x3533de){return function(_0x25d2ba){if(_0x25d2ba){return _0x25d2ba[_0x0031('0x25')]()[_0x0031('0x26')](function(){_0x4a8fc3[_0x0031('0x1b')](0xcc)[_0x0031('0x1c')]();});}};}function handleEntityNotFound(_0xcd0369,_0x369604){return function(_0x5b58fc){if(!_0x5b58fc){_0xcd0369[_0x0031('0x1a')](0x194);}return _0x5b58fc;};}function handleError(_0x323078,_0x13dff3){_0x13dff3=_0x13dff3||0x1f4;return function(_0x23e84c){logger[_0x0031('0x27')](_0x23e84c['stack']);if(_0x23e84c[_0x0031('0x28')]){delete _0x23e84c['name'];}_0x323078[_0x0031('0x1b')](_0x13dff3)['send'](_0x23e84c);};}exports[_0x0031('0x29')]=function(_0x47a1e9,_0x5a6cc3){var _0x5c1951={},_0x512f25={},_0x253221={'count':0x0,'rows':[]};var _0x4c1d2e=_[_0x0031('0x2a')](db['DeskField'][_0x0031('0x2b')],function(_0x289282){return{'name':_0x289282[_0x0031('0x2c')],'type':_0x289282[_0x0031('0x2d')][_0x0031('0x2e')]};});_0x512f25['model']=_['map'](_0x4c1d2e,'name');_0x512f25['query']=_[_0x0031('0x2f')](_0x47a1e9[_0x0031('0x30')]);_0x512f25[_0x0031('0x31')]=_[_0x0031('0x32')](_0x512f25[_0x0031('0x33')],_0x512f25[_0x0031('0x30')]);_0x5c1951[_0x0031('0x34')]=_['intersection'](_0x512f25[_0x0031('0x33')],qs['fields'](_0x47a1e9[_0x0031('0x30')][_0x0031('0x35')]));_0x5c1951[_0x0031('0x34')]=_0x5c1951['attributes']['length']?_0x5c1951['attributes']:_0x512f25[_0x0031('0x33')];if(!_0x47a1e9[_0x0031('0x30')][_0x0031('0x36')](_0x0031('0x37'))){_0x5c1951[_0x0031('0x20')]=qs[_0x0031('0x20')](_0x47a1e9['query'][_0x0031('0x20')]);_0x5c1951['offset']=qs[_0x0031('0x1f')](_0x47a1e9[_0x0031('0x30')][_0x0031('0x1f')]);}_0x5c1951[_0x0031('0x38')]=qs['sort'](_0x47a1e9[_0x0031('0x30')][_0x0031('0x39')]);_0x5c1951[_0x0031('0x3a')]=qs[_0x0031('0x31')](_['pick'](_0x47a1e9[_0x0031('0x30')],_0x512f25[_0x0031('0x31')]),_0x4c1d2e);if(_0x47a1e9['query'][_0x0031('0x3b')]){_0x5c1951['where']=_['merge'](_0x5c1951[_0x0031('0x3a')],{'$or':_[_0x0031('0x2a')](_0x4c1d2e,function(_0x1722b6){if(_0x1722b6[_0x0031('0x2d')]!==_0x0031('0x3c')){var _0x25698d={};_0x25698d[_0x1722b6[_0x0031('0x28')]]={'$like':'%'+_0x47a1e9[_0x0031('0x30')][_0x0031('0x3b')]+'%'};return _0x25698d;}})});}_0x5c1951=_[_0x0031('0x3d')]({},_0x5c1951,_0x47a1e9[_0x0031('0x3e')]);var _0x456faf={'where':_0x5c1951[_0x0031('0x3a')]};return db['DeskField'][_0x0031('0x1e')](_0x456faf)[_0x0031('0x26')](function(_0x426329){_0x253221[_0x0031('0x1e')]=_0x426329;if(_0x47a1e9[_0x0031('0x30')][_0x0031('0x3f')]){_0x5c1951['include']=[{'all':!![]}];}return db[_0x0031('0x40')][_0x0031('0x41')](_0x5c1951);})['then'](function(_0x32e0f9){_0x253221[_0x0031('0x42')]=_0x32e0f9;return _0x253221;})['then'](respondWithFilteredResult(_0x5a6cc3,_0x5c1951))[_0x0031('0x43')](handleError(_0x5a6cc3,null));};exports[_0x0031('0x44')]=function(_0x24f867,_0x4e7826){var _0x432775={'raw':!![],'where':{'id':_0x24f867[_0x0031('0x45')]['id']}},_0x1231f6={};_0x1231f6[_0x0031('0x33')]=_[_0x0031('0x2f')](db['DeskField'][_0x0031('0x2b')]);_0x1231f6[_0x0031('0x30')]=_[_0x0031('0x2f')](_0x24f867['query']);_0x1231f6[_0x0031('0x31')]=_[_0x0031('0x32')](_0x1231f6[_0x0031('0x33')],_0x1231f6[_0x0031('0x30')]);_0x432775[_0x0031('0x34')]=_['intersection'](_0x1231f6['model'],qs['fields'](_0x24f867[_0x0031('0x30')]['fields']));_0x432775[_0x0031('0x34')]=_0x432775[_0x0031('0x34')]['length']?_0x432775[_0x0031('0x34')]:_0x1231f6[_0x0031('0x33')];if(_0x24f867[_0x0031('0x30')][_0x0031('0x3f')]){_0x432775[_0x0031('0x46')]=[{'all':!![]}];}_0x432775=_[_0x0031('0x3d')]({},_0x432775,_0x24f867['options']);return db[_0x0031('0x40')][_0x0031('0x47')](_0x432775)[_0x0031('0x26')](handleEntityNotFound(_0x4e7826,null))['then'](respondWithResult(_0x4e7826,null))[_0x0031('0x43')](handleError(_0x4e7826,null));};exports['create']=function(_0x21dd9e,_0x42c444){return db[_0x0031('0x40')][_0x0031('0x48')](_0x21dd9e['body'],{})[_0x0031('0x26')](respondWithResult(_0x42c444,0xc9))[_0x0031('0x43')](handleError(_0x42c444,null));};exports[_0x0031('0x24')]=function(_0x4acd69,_0x261a13){if(_0x4acd69[_0x0031('0x49')]['id']){delete _0x4acd69[_0x0031('0x49')]['id'];}return db[_0x0031('0x40')][_0x0031('0x47')]({'where':{'id':_0x4acd69[_0x0031('0x45')]['id']}})[_0x0031('0x26')](handleEntityNotFound(_0x261a13,null))[_0x0031('0x26')](saveUpdates(_0x4acd69['body'],null))['then'](respondWithResult(_0x261a13,null))[_0x0031('0x43')](handleError(_0x261a13,null));};exports[_0x0031('0x25')]=function(_0x34ee2f,_0x3b715b){return db['DeskField']['find']({'where':{'id':_0x34ee2f[_0x0031('0x45')]['id']}})[_0x0031('0x26')](handleEntityNotFound(_0x3b715b,null))[_0x0031('0x26')](removeEntity(_0x3b715b,null))[_0x0031('0x43')](handleError(_0x3b715b,null));}; \ No newline at end of file +var _0xf5a0=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','send','index','map','DeskField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xf5a0,0xa4));var _0x0f5a=function(_0x18d50f,_0x124aff){_0x18d50f=_0x18d50f-0x0;var _0x8ce385=_0xf5a0[_0x18d50f];return _0x8ce385;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0f5a('0x0'));var rimraf=require(_0x0f5a('0x1'));var zipdir=require(_0x0f5a('0x2'));var jsonpatch=require(_0x0f5a('0x3'));var rp=require(_0x0f5a('0x4'));var moment=require('moment');var BPromise=require(_0x0f5a('0x5'));var Mustache=require(_0x0f5a('0x6'));var util=require(_0x0f5a('0x7'));var path=require('path');var sox=require(_0x0f5a('0x8'));var csv=require(_0x0f5a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0f5a('0xa'));var squel=require(_0x0f5a('0xb'));var crypto=require(_0x0f5a('0xc'));var jsforce=require(_0x0f5a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0f5a('0x9'));var querystring=require(_0x0f5a('0xe'));var Papa=require(_0x0f5a('0xf'));var Redis=require(_0x0f5a('0x10'));var authService=require(_0x0f5a('0x11'));var qs=require(_0x0f5a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f5a('0x13'));var logger=require(_0x0f5a('0x14'))(_0x0f5a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0f5a('0x16'));var db=require(_0x0f5a('0x17'))['db'];function respondWithStatusCode(_0x1423ce,_0x174de2){_0x174de2=_0x174de2||0xcc;return function(_0x35c209){if(_0x35c209){return _0x1423ce[_0x0f5a('0x18')](_0x174de2);}return _0x1423ce[_0x0f5a('0x19')](_0x174de2)['end']();};}function respondWithResult(_0x25a70b,_0x182409){_0x182409=_0x182409||0xc8;return function(_0x3697d6){if(_0x3697d6){return _0x25a70b[_0x0f5a('0x19')](_0x182409)['json'](_0x3697d6);}};}function respondWithFilteredResult(_0x199ca0,_0x3dedce){return function(_0x56e44e){if(_0x56e44e){var _0x18fdb8=_0x56e44e[_0x0f5a('0x1a')],_0x464b50=_0x3dedce[_0x0f5a('0x1b')],_0x40d9f9=_0x3dedce['offset']+_0x3dedce[_0x0f5a('0x1c')],_0x268b41;if(_0x40d9f9>=_0x18fdb8){_0x40d9f9=_0x18fdb8;_0x268b41=0xc8;}else{_0x268b41=0xce;}_0x199ca0[_0x0f5a('0x19')](_0x268b41);return _0x199ca0[_0x0f5a('0x1d')](_0x0f5a('0x1e'),_0x464b50+'-'+_0x40d9f9+'/'+_0x18fdb8)[_0x0f5a('0x1f')](_0x56e44e);}return null;};}function patchUpdates(_0x17c9c7){return function(_0x416669){try{jsonpatch[_0x0f5a('0x20')](_0x416669,_0x17c9c7,!![]);}catch(_0x205c11){return BPromise[_0x0f5a('0x21')](_0x205c11);}return _0x416669[_0x0f5a('0x22')]();};}function saveUpdates(_0x1f84be,_0x9d8df9){return function(_0x86fc00){if(_0x86fc00){return _0x86fc00[_0x0f5a('0x23')](_0x1f84be)['then'](function(_0x2f4a11){return _0x2f4a11;});}return null;};}function removeEntity(_0x114a5e,_0x2ec98e){return function(_0x32257a){if(_0x32257a){return _0x32257a[_0x0f5a('0x24')]()[_0x0f5a('0x25')](function(){_0x114a5e[_0x0f5a('0x19')](0xcc)[_0x0f5a('0x26')]();});}};}function handleEntityNotFound(_0x2f4f40,_0x169f06){return function(_0xb5bcb9){if(!_0xb5bcb9){_0x2f4f40[_0x0f5a('0x18')](0x194);}return _0xb5bcb9;};}function handleError(_0x5c9975,_0x3c8c84){_0x3c8c84=_0x3c8c84||0x1f4;return function(_0x56ea77){logger[_0x0f5a('0x27')](_0x56ea77['stack']);if(_0x56ea77['name']){delete _0x56ea77['name'];}_0x5c9975[_0x0f5a('0x19')](_0x3c8c84)[_0x0f5a('0x28')](_0x56ea77);};}exports[_0x0f5a('0x29')]=function(_0x481f2b,_0x5ef051){var _0x260c67={},_0x475668={},_0x12898b={'count':0x0,'rows':[]};var _0x1589f1=_[_0x0f5a('0x2a')](db[_0x0f5a('0x2b')][_0x0f5a('0x2c')],function(_0x2f0325){return{'name':_0x2f0325['fieldName'],'type':_0x2f0325[_0x0f5a('0x2d')][_0x0f5a('0x2e')]};});_0x475668[_0x0f5a('0x2f')]=_[_0x0f5a('0x2a')](_0x1589f1,'name');_0x475668[_0x0f5a('0x30')]=_[_0x0f5a('0x31')](_0x481f2b[_0x0f5a('0x30')]);_0x475668[_0x0f5a('0x32')]=_[_0x0f5a('0x33')](_0x475668[_0x0f5a('0x2f')],_0x475668[_0x0f5a('0x30')]);_0x260c67['attributes']=_[_0x0f5a('0x33')](_0x475668[_0x0f5a('0x2f')],qs[_0x0f5a('0x34')](_0x481f2b['query'][_0x0f5a('0x34')]));_0x260c67['attributes']=_0x260c67[_0x0f5a('0x35')][_0x0f5a('0x36')]?_0x260c67[_0x0f5a('0x35')]:_0x475668[_0x0f5a('0x2f')];if(!_0x481f2b[_0x0f5a('0x30')]['hasOwnProperty'](_0x0f5a('0x37'))){_0x260c67[_0x0f5a('0x1c')]=qs[_0x0f5a('0x1c')](_0x481f2b[_0x0f5a('0x30')][_0x0f5a('0x1c')]);_0x260c67[_0x0f5a('0x1b')]=qs[_0x0f5a('0x1b')](_0x481f2b[_0x0f5a('0x30')][_0x0f5a('0x1b')]);}_0x260c67[_0x0f5a('0x38')]=qs[_0x0f5a('0x39')](_0x481f2b[_0x0f5a('0x30')][_0x0f5a('0x39')]);_0x260c67[_0x0f5a('0x3a')]=qs[_0x0f5a('0x32')](_[_0x0f5a('0x3b')](_0x481f2b[_0x0f5a('0x30')],_0x475668[_0x0f5a('0x32')]),_0x1589f1);if(_0x481f2b[_0x0f5a('0x30')][_0x0f5a('0x3c')]){_0x260c67[_0x0f5a('0x3a')]=_[_0x0f5a('0x3d')](_0x260c67['where'],{'$or':_[_0x0f5a('0x2a')](_0x1589f1,function(_0xd72011){if(_0xd72011[_0x0f5a('0x2d')]!==_0x0f5a('0x3e')){var _0x3374e={};_0x3374e[_0xd72011['name']]={'$like':'%'+_0x481f2b[_0x0f5a('0x30')][_0x0f5a('0x3c')]+'%'};return _0x3374e;}})});}_0x260c67=_['merge']({},_0x260c67,_0x481f2b[_0x0f5a('0x3f')]);var _0x15b7f7={'where':_0x260c67[_0x0f5a('0x3a')]};return db[_0x0f5a('0x2b')]['count'](_0x15b7f7)[_0x0f5a('0x25')](function(_0x3a8dd4){_0x12898b[_0x0f5a('0x1a')]=_0x3a8dd4;if(_0x481f2b[_0x0f5a('0x30')]['includeAll']){_0x260c67[_0x0f5a('0x40')]=[{'all':!![]}];}return db[_0x0f5a('0x2b')][_0x0f5a('0x41')](_0x260c67);})[_0x0f5a('0x25')](function(_0x3dabd5){_0x12898b[_0x0f5a('0x42')]=_0x3dabd5;return _0x12898b;})['then'](respondWithFilteredResult(_0x5ef051,_0x260c67))['catch'](handleError(_0x5ef051,null));};exports[_0x0f5a('0x43')]=function(_0x1d39b8,_0x4e73ba){var _0x483ef1={'raw':!![],'where':{'id':_0x1d39b8['params']['id']}},_0x4f8a7a={};_0x4f8a7a[_0x0f5a('0x2f')]=_[_0x0f5a('0x31')](db['DeskField'][_0x0f5a('0x2c')]);_0x4f8a7a[_0x0f5a('0x30')]=_[_0x0f5a('0x31')](_0x1d39b8[_0x0f5a('0x30')]);_0x4f8a7a['filters']=_[_0x0f5a('0x33')](_0x4f8a7a[_0x0f5a('0x2f')],_0x4f8a7a[_0x0f5a('0x30')]);_0x483ef1[_0x0f5a('0x35')]=_['intersection'](_0x4f8a7a[_0x0f5a('0x2f')],qs[_0x0f5a('0x34')](_0x1d39b8[_0x0f5a('0x30')][_0x0f5a('0x34')]));_0x483ef1['attributes']=_0x483ef1[_0x0f5a('0x35')][_0x0f5a('0x36')]?_0x483ef1[_0x0f5a('0x35')]:_0x4f8a7a[_0x0f5a('0x2f')];if(_0x1d39b8[_0x0f5a('0x30')]['includeAll']){_0x483ef1[_0x0f5a('0x40')]=[{'all':!![]}];}_0x483ef1=_[_0x0f5a('0x3d')]({},_0x483ef1,_0x1d39b8[_0x0f5a('0x3f')]);return db[_0x0f5a('0x2b')][_0x0f5a('0x44')](_0x483ef1)['then'](handleEntityNotFound(_0x4e73ba,null))[_0x0f5a('0x25')](respondWithResult(_0x4e73ba,null))[_0x0f5a('0x45')](handleError(_0x4e73ba,null));};exports[_0x0f5a('0x46')]=function(_0x2b686a,_0x4ffc95){return db[_0x0f5a('0x2b')]['create'](_0x2b686a[_0x0f5a('0x47')],{})[_0x0f5a('0x25')](respondWithResult(_0x4ffc95,0xc9))[_0x0f5a('0x45')](handleError(_0x4ffc95,null));};exports[_0x0f5a('0x23')]=function(_0x2eece3,_0x401426){if(_0x2eece3['body']['id']){delete _0x2eece3[_0x0f5a('0x47')]['id'];}return db[_0x0f5a('0x2b')][_0x0f5a('0x44')]({'where':{'id':_0x2eece3[_0x0f5a('0x48')]['id']}})[_0x0f5a('0x25')](handleEntityNotFound(_0x401426,null))['then'](saveUpdates(_0x2eece3[_0x0f5a('0x47')],null))['then'](respondWithResult(_0x401426,null))[_0x0f5a('0x45')](handleError(_0x401426,null));};exports[_0x0f5a('0x24')]=function(_0xe005b6,_0x3b8eeb){return db[_0x0f5a('0x2b')][_0x0f5a('0x44')]({'where':{'id':_0xe005b6[_0x0f5a('0x48')]['id']}})[_0x0f5a('0x25')](handleEntityNotFound(_0x3b8eeb,null))[_0x0f5a('0x25')](removeEntity(_0x3b8eeb,null))['catch'](handleError(_0x3b8eeb,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index cf4e1e9..27887bd 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 _0x8496=['util','moment','bluebird','../../config/environment','define','DeskField','int_desk_fields','idField','FieldId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8496,0x168));var _0x6849=function(_0x40f034,_0x1c2974){_0x40f034=_0x40f034-0x0;var _0x2fd246=_0x8496[_0x40f034];return _0x2fd246;};'use strict';var _=require('lodash');var util=require(_0x6849('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6849('0x1'));var BPromise=require(_0x6849('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6849('0x3'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x57dc32,_0x1c95ba){return _0x57dc32[_0x6849('0x4')](_0x6849('0x5'),attributes,{'tableName':_0x6849('0x6'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x6849('0x7'),_0x6849('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe58e=['define','int_desk_fields','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intDeskField.attributes'];(function(_0x9fdaeb,_0x19eeb0){var _0x36d8e6=function(_0x1cef80){while(--_0x1cef80){_0x9fdaeb['push'](_0x9fdaeb['shift']());}};_0x36d8e6(++_0x19eeb0);}(_0xe58e,0x13b));var _0xee58=function(_0x2563cd,_0x5b438d){_0x2563cd=_0x2563cd-0x0;var _0x3d1eef=_0xe58e[_0x2563cd];return _0x3d1eef;};'use strict';var _=require(_0xee58('0x0'));var util=require(_0xee58('0x1'));var logger=require(_0xee58('0x2'))(_0xee58('0x3'));var moment=require(_0xee58('0x4'));var BPromise=require(_0xee58('0x5'));var rp=require(_0xee58('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xee58('0x7'));var attributes=require(_0xee58('0x8'));module['exports']=function(_0x2b1d10,_0x2e65ab){return _0x2b1d10[_0xee58('0x9')]('DeskField',attributes,{'tableName':_0xee58('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xee58('0xb'),'FieldId'],'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 ebe2294..47f49fb 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 _0xaec2=['../../config/environment','jayson/promise','client','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','rpc'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xaec2,0xd7));var _0x2aec=function(_0x5f76e3,_0x977880){_0x5f76e3=_0x5f76e3-0x0;var _0x4a5558=_0xaec2[_0x5f76e3];return _0x4a5558;};'use strict';var _=require('lodash');var util=require(_0x2aec('0x0'));var moment=require(_0x2aec('0x1'));var BPromise=require('bluebird');var rs=require(_0x2aec('0x2'));var fs=require('fs');var Redis=require(_0x2aec('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2aec('0x4'));var config=require(_0x2aec('0x5'));var jayson=require(_0x2aec('0x6'));var client=jayson[_0x2aec('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x587245,_0x3f59ea,_0x225a34){return new BPromise(function(_0x423c30,_0x1a7d94){return client[_0x2aec('0x8')](_0x587245,_0x225a34)['then'](function(_0x2b89e2){logger[_0x2aec('0x9')](_0x2aec('0xa'),_0x3f59ea,_0x2aec('0xb'));logger[_0x2aec('0xc')](_0x2aec('0xd'),_0x3f59ea,'request\x20sent',JSON[_0x2aec('0xe')](_0x2b89e2));if(_0x2b89e2[_0x2aec('0xf')]){if(_0x2b89e2[_0x2aec('0xf')][_0x2aec('0x10')]===0x1f4){logger[_0x2aec('0xf')]('DeskField,\x20%s,\x20%s',_0x3f59ea,_0x2b89e2[_0x2aec('0xf')][_0x2aec('0x11')]);return _0x1a7d94(_0x2b89e2['error'][_0x2aec('0x11')]);}logger[_0x2aec('0xf')](_0x2aec('0xa'),_0x3f59ea,_0x2b89e2[_0x2aec('0xf')][_0x2aec('0x11')]);return _0x423c30(_0x2b89e2['error'][_0x2aec('0x11')]);}else{logger[_0x2aec('0x9')](_0x2aec('0xa'),_0x3f59ea,_0x2aec('0xb'));_0x423c30(_0x2b89e2[_0x2aec('0x12')][_0x2aec('0x11')]);}})[_0x2aec('0x13')](function(_0x48cece){logger[_0x2aec('0xf')](_0x2aec('0xa'),_0x3f59ea,_0x48cece);_0x1a7d94(_0x48cece);});});} \ No newline at end of file +var _0x3e7e=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x23cfb2,_0x20e5fc){var _0x3ec6ce=function(_0x5767d2){while(--_0x5767d2){_0x23cfb2['push'](_0x23cfb2['shift']());}};_0x3ec6ce(++_0x20e5fc);}(_0x3e7e,0x109));var _0xe3e7=function(_0x4fd8d3,_0x3ad1bb){_0x4fd8d3=_0x4fd8d3-0x0;var _0x1405cc=_0x3e7e[_0x4fd8d3];return _0x1405cc;};'use strict';var _=require('lodash');var util=require(_0xe3e7('0x0'));var moment=require(_0xe3e7('0x1'));var BPromise=require(_0xe3e7('0x2'));var rs=require(_0xe3e7('0x3'));var fs=require('fs');var Redis=require(_0xe3e7('0x4'));var db=require(_0xe3e7('0x5'))['db'];var utils=require(_0xe3e7('0x6'));var logger=require(_0xe3e7('0x7'))(_0xe3e7('0x8'));var config=require(_0xe3e7('0x9'));var jayson=require(_0xe3e7('0xa'));var client=jayson[_0xe3e7('0xb')][_0xe3e7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58cbb5,_0x7f2873,_0x4eec2f){return new BPromise(function(_0x448bbb,_0x130ae3){return client['request'](_0x58cbb5,_0x4eec2f)[_0xe3e7('0xd')](function(_0x35f1fb){logger[_0xe3e7('0xe')](_0xe3e7('0xf'),_0x7f2873,_0xe3e7('0x10'));logger[_0xe3e7('0x11')](_0xe3e7('0x12'),_0x7f2873,_0xe3e7('0x10'),JSON[_0xe3e7('0x13')](_0x35f1fb));if(_0x35f1fb['error']){if(_0x35f1fb[_0xe3e7('0x14')][_0xe3e7('0x15')]===0x1f4){logger[_0xe3e7('0x14')](_0xe3e7('0xf'),_0x7f2873,_0x35f1fb[_0xe3e7('0x14')][_0xe3e7('0x16')]);return _0x130ae3(_0x35f1fb[_0xe3e7('0x14')][_0xe3e7('0x16')]);}logger[_0xe3e7('0x14')](_0xe3e7('0xf'),_0x7f2873,_0x35f1fb['error']['message']);return _0x448bbb(_0x35f1fb[_0xe3e7('0x14')]['message']);}else{logger[_0xe3e7('0xe')](_0xe3e7('0xf'),_0x7f2873,_0xe3e7('0x10'));_0x448bbb(_0x35f1fb['result'][_0xe3e7('0x16')]);}})[_0xe3e7('0x17')](function(_0x4381e0){logger[_0xe3e7('0x14')](_0xe3e7('0xf'),_0x7f2873,_0x4381e0);_0x130ae3(_0x4381e0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 9d64f59..2af8b28 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 _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(_0x370f27,_0x27ed48){var _0x1e5000=function(_0x3f02dd){while(--_0x3f02dd){_0x370f27['push'](_0x370f27['shift']());}};_0x1e5000(++_0x27ed48);}(_0x4fc2,0x111));var _0x24fc=function(_0x1ea888,_0x187788){_0x1ea888=_0x1ea888-0x0;var _0x46f41f=_0x4fc2[_0x1ea888];return _0x46f41f;};'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 +var _0xb10b=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x2285eb,_0x548286){var _0x4f4bff=function(_0x5af955){while(--_0x5af955){_0x2285eb['push'](_0x2285eb['shift']());}};_0x4f4bff(++_0x548286);}(_0xb10b,0x12a));var _0xbb10=function(_0xee95aa,_0x56bc39){_0xee95aa=_0xee95aa-0x0;var _0x301db2=_0xb10b[_0xee95aa];return _0x301db2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getFields']);router['post']('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router[_0xbb10('0x10')]('/:id/configurations',auth[_0xbb10('0x9')](),controller['addConfiguration']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 4eae8a4..342e653 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 _0x507c=['STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x507c,0x111));var _0xc507=function(_0x466ea0,_0x39edf9){_0x466ea0=_0x466ea0-0x0;var _0x40b1d1=_0x507c[_0x466ea0];return _0x40b1d1;};'use strict';var Sequelize=require(_0xc507('0x0'));module['exports']={'name':{'type':Sequelize[_0xc507('0x1')]},'username':{'type':Sequelize[_0xc507('0x1')]},'password':{'type':Sequelize[_0xc507('0x1')]},'remoteUri':{'type':Sequelize[_0xc507('0x1')]},'tenantId':{'type':Sequelize[_0xc507('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xc507('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf1b7=['sequelize','STRING'];(function(_0x4a8f7d,_0x217dc8){var _0xb48f74=function(_0x105a68){while(--_0x105a68){_0x4a8f7d['push'](_0x4a8f7d['shift']());}};_0xb48f74(++_0x217dc8);}(_0xf1b7,0x13c));var _0x7f1b=function(_0x279fbf,_0x3f2e19){_0x279fbf=_0x279fbf-0x0;var _0x13622f=_0xf1b7[_0x279fbf];return _0x13622f;};'use strict';var Sequelize=require(_0x7f1b('0x0'));module['exports']={'name':{'type':Sequelize[_0x7f1b('0x1')]},'username':{'type':Sequelize[_0x7f1b('0x1')]},'password':{'type':Sequelize[_0x7f1b('0x1')]},'remoteUri':{'type':Sequelize[_0x7f1b('0x1')]},'tenantId':{'type':Sequelize[_0x7f1b('0x1')]},'clientId':{'type':Sequelize[_0x7f1b('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 603fdb9..50d8ffa 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 _0xafc4=['contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','statecode','ticketnumber','traversedpath','versionnumber','concat','username','remoteUri','tenantId','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','/oauth2/token','clientId','password','clientSecret','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','GET','EntityDefinitions(','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack','Wrong\x20credentials','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true',')/Attributes(',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','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','../../components/integrations/configuration','jayson/promise','client','http','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','map','type','options','where','Dynamics365Account','include','findAll','rows','show','params','includeAll','find','create','body','getConfigurations','findOne','Dynamics365Configuration','length','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','Subjects','ticketType','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits'];(function(_0x1bfadd,_0x316162){var _0x24ca92=function(_0x2bad3e){while(--_0x2bad3e){_0x1bfadd['push'](_0x1bfadd['shift']());}};_0x24ca92(++_0x316162);}(_0xafc4,0x69));var _0x4afc=function(_0x4d6daf,_0xfa4335){_0x4d6daf=_0x4d6daf-0x0;var _0xe65459=_0xafc4[_0x4d6daf];return _0xe65459;};'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'];var integrations=require(_0x4afc('0x16'));var jayson=require(_0x4afc('0x17'));var client=jayson[_0x4afc('0x18')][_0x4afc('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1ad8fd,_0x23b03e,_0x5effb4,_0x26f3f1){return new BPromise(function(_0x429fd8,_0x2c636b){var _0x1e2c31=_0x26f3f1||client;return _0x1e2c31['request'](_0x1ad8fd,_0x5effb4)['then'](function(_0x2452ae){logger['info'](_0x4afc('0x1a'),_0x23b03e,_0x4afc('0x1b'));logger[_0x4afc('0x1c')](_0x4afc('0x1d'),_0x23b03e,_0x4afc('0x1b'),JSON[_0x4afc('0x1e')](_0x2452ae));if(_0x2452ae[_0x4afc('0x1f')]){if(_0x2452ae[_0x4afc('0x1f')][_0x4afc('0x20')]===0x1f4){logger[_0x4afc('0x1f')](_0x4afc('0x1a'),_0x23b03e,_0x2452ae['error'][_0x4afc('0x21')]);return _0x2c636b(_0x2452ae[_0x4afc('0x1f')][_0x4afc('0x21')]);}logger[_0x4afc('0x1f')]('Dynamics365Account,\x20%s,\x20%s',_0x23b03e,_0x2452ae[_0x4afc('0x1f')][_0x4afc('0x21')]);return _0x429fd8(_0x2452ae[_0x4afc('0x1f')][_0x4afc('0x21')]);}else{logger[_0x4afc('0x22')](_0x4afc('0x1a'),_0x23b03e,_0x4afc('0x1b'));_0x429fd8(_0x2452ae['result'][_0x4afc('0x21')]);}})[_0x4afc('0x23')](function(_0x57f37c){logger[_0x4afc('0x1f')]('Dynamics365Account,\x20%s,\x20%s',_0x23b03e,_0x57f37c);_0x2c636b(_0x57f37c);});});}function respondWithStatusCode(_0x1aa676,_0x2a0314){_0x2a0314=_0x2a0314||0xcc;return function(_0x1e454e){if(_0x1e454e){return _0x1aa676[_0x4afc('0x24')](_0x2a0314);}return _0x1aa676[_0x4afc('0x25')](_0x2a0314)[_0x4afc('0x26')]();};}function respondWithResult(_0x40a0db,_0x383a71){_0x383a71=_0x383a71||0xc8;return function(_0x2bb837){if(_0x2bb837){return _0x40a0db[_0x4afc('0x25')](_0x383a71)[_0x4afc('0x27')](_0x2bb837);}};}function respondWithFilteredResult(_0x359c07,_0x35f5b3){return function(_0x55842c){if(_0x55842c){var _0xc3952e=_0x55842c['count'],_0x244f6c=_0x35f5b3['offset'],_0x2d6112=_0x35f5b3[_0x4afc('0x28')]+_0x35f5b3[_0x4afc('0x29')],_0x4e254d;if(_0x2d6112>=_0xc3952e){_0x2d6112=_0xc3952e;_0x4e254d=0xc8;}else{_0x4e254d=0xce;}_0x359c07['status'](_0x4e254d);return _0x359c07[_0x4afc('0x2a')](_0x4afc('0x2b'),_0x244f6c+'-'+_0x2d6112+'/'+_0xc3952e)['json'](_0x55842c);}return null;};}function patchUpdates(_0x514278){return function(_0x52e3dd){try{jsonpatch[_0x4afc('0x2c')](_0x52e3dd,_0x514278,!![]);}catch(_0x34434a){return BPromise[_0x4afc('0x2d')](_0x34434a);}return _0x52e3dd[_0x4afc('0x2e')]();};}function saveUpdates(_0xc1d91,_0x28cd3e){return function(_0x566389){if(_0x566389){return _0x566389[_0x4afc('0x2f')](_0xc1d91)[_0x4afc('0x30')](function(_0x1ba6b5){return _0x1ba6b5;});}return null;};}function removeEntity(_0x2f178c,_0x2b115d){return function(_0xf95893){if(_0xf95893){return _0xf95893[_0x4afc('0x31')]()[_0x4afc('0x30')](function(){_0x2f178c['status'](0xcc)[_0x4afc('0x26')]();});}};}function handleEntityNotFound(_0x51660d,_0x539b61){return function(_0x324a12){if(!_0x324a12){_0x51660d[_0x4afc('0x24')](0x194);}return _0x324a12;};}function handleError(_0x266f7f,_0x3d4ab5){_0x3d4ab5=_0x3d4ab5||0x1f4;return function(_0x3ec6fa){logger[_0x4afc('0x1f')](_0x3ec6fa['stack']);if(_0x3ec6fa[_0x4afc('0x32')]){delete _0x3ec6fa[_0x4afc('0x32')];}_0x266f7f[_0x4afc('0x25')](_0x3d4ab5)[_0x4afc('0x33')](_0x3ec6fa);};}exports[_0x4afc('0x34')]=function(_0x2f9d1c,_0x48f0c6){var _0x22eea2={},_0x2ddce1={},_0x91565d={'count':0x0,'rows':[]};var _0x283bc2=_['map'](db['Dynamics365Account'][_0x4afc('0x35')],function(_0x22bd75){return{'name':_0x22bd75[_0x4afc('0x36')],'type':_0x22bd75['type']['key']};});_0x2ddce1[_0x4afc('0x37')]=_['map'](_0x283bc2,'name');_0x2ddce1[_0x4afc('0x38')]=_[_0x4afc('0x39')](_0x2f9d1c[_0x4afc('0x38')]);_0x2ddce1[_0x4afc('0x3a')]=_[_0x4afc('0x3b')](_0x2ddce1[_0x4afc('0x37')],_0x2ddce1[_0x4afc('0x38')]);_0x22eea2[_0x4afc('0x3c')]=_[_0x4afc('0x3b')](_0x2ddce1[_0x4afc('0x37')],qs[_0x4afc('0x3d')](_0x2f9d1c[_0x4afc('0x38')][_0x4afc('0x3d')]));_0x22eea2[_0x4afc('0x3c')]=_0x22eea2[_0x4afc('0x3c')]['length']?_0x22eea2[_0x4afc('0x3c')]:_0x2ddce1[_0x4afc('0x37')];if(!_0x2f9d1c[_0x4afc('0x38')][_0x4afc('0x3e')](_0x4afc('0x3f'))){_0x22eea2[_0x4afc('0x29')]=qs[_0x4afc('0x29')](_0x2f9d1c['query']['limit']);_0x22eea2['offset']=qs[_0x4afc('0x28')](_0x2f9d1c[_0x4afc('0x38')]['offset']);}_0x22eea2[_0x4afc('0x40')]=qs[_0x4afc('0x41')](_0x2f9d1c[_0x4afc('0x38')][_0x4afc('0x41')]);_0x22eea2['where']=qs[_0x4afc('0x3a')](_[_0x4afc('0x42')](_0x2f9d1c[_0x4afc('0x38')],_0x2ddce1[_0x4afc('0x3a')]),_0x283bc2);if(_0x2f9d1c[_0x4afc('0x38')][_0x4afc('0x43')]){_0x22eea2['where']=_[_0x4afc('0x44')](_0x22eea2['where'],{'$or':_[_0x4afc('0x45')](_0x283bc2,function(_0x33117f){if(_0x33117f[_0x4afc('0x46')]!=='VIRTUAL'){var _0x57acad={};_0x57acad[_0x33117f[_0x4afc('0x32')]]={'$like':'%'+_0x2f9d1c[_0x4afc('0x38')][_0x4afc('0x43')]+'%'};return _0x57acad;}})});}_0x22eea2=_[_0x4afc('0x44')]({},_0x22eea2,_0x2f9d1c[_0x4afc('0x47')]);var _0x3970ba={'where':_0x22eea2[_0x4afc('0x48')]};return db[_0x4afc('0x49')]['count'](_0x3970ba)[_0x4afc('0x30')](function(_0xb1e91e){_0x91565d['count']=_0xb1e91e;if(_0x2f9d1c[_0x4afc('0x38')]['includeAll']){_0x22eea2[_0x4afc('0x4a')]=[{'all':!![]}];}return db[_0x4afc('0x49')][_0x4afc('0x4b')](_0x22eea2);})['then'](function(_0xd0f517){_0x91565d[_0x4afc('0x4c')]=_0xd0f517;return _0x91565d;})[_0x4afc('0x30')](respondWithFilteredResult(_0x48f0c6,_0x22eea2))[_0x4afc('0x23')](handleError(_0x48f0c6,null));};exports[_0x4afc('0x4d')]=function(_0x19a0ac,_0x5d9d90){var _0x4e470d={'raw':![],'where':{'id':_0x19a0ac[_0x4afc('0x4e')]['id']}},_0x4f4e46={};_0x4f4e46[_0x4afc('0x37')]=_[_0x4afc('0x39')](db[_0x4afc('0x49')][_0x4afc('0x35')]);_0x4f4e46[_0x4afc('0x38')]=_[_0x4afc('0x39')](_0x19a0ac[_0x4afc('0x38')]);_0x4f4e46[_0x4afc('0x3a')]=_[_0x4afc('0x3b')](_0x4f4e46['model'],_0x4f4e46[_0x4afc('0x38')]);_0x4e470d['attributes']=_['intersection'](_0x4f4e46[_0x4afc('0x37')],qs['fields'](_0x19a0ac[_0x4afc('0x38')][_0x4afc('0x3d')]));_0x4e470d[_0x4afc('0x3c')]=_0x4e470d[_0x4afc('0x3c')]['length']?_0x4e470d[_0x4afc('0x3c')]:_0x4f4e46['model'];if(_0x19a0ac[_0x4afc('0x38')][_0x4afc('0x4f')]){_0x4e470d[_0x4afc('0x4a')]=[{'all':!![]}];}_0x4e470d=_[_0x4afc('0x44')]({},_0x4e470d,_0x19a0ac[_0x4afc('0x47')]);return db[_0x4afc('0x49')][_0x4afc('0x50')](_0x4e470d)[_0x4afc('0x30')](handleEntityNotFound(_0x5d9d90,null))[_0x4afc('0x30')](respondWithResult(_0x5d9d90,null))[_0x4afc('0x23')](handleError(_0x5d9d90,null));};exports[_0x4afc('0x51')]=function(_0x3915d5,_0x507bfc){return db[_0x4afc('0x49')][_0x4afc('0x51')](_0x3915d5[_0x4afc('0x52')],{})[_0x4afc('0x30')](respondWithResult(_0x507bfc,0xc9))[_0x4afc('0x23')](handleError(_0x507bfc,null));};exports[_0x4afc('0x2f')]=function(_0x2fd538,_0x10c254){if(_0x2fd538[_0x4afc('0x52')]['id']){delete _0x2fd538[_0x4afc('0x52')]['id'];}return db[_0x4afc('0x49')][_0x4afc('0x50')]({'where':{'id':_0x2fd538[_0x4afc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x10c254,null))[_0x4afc('0x30')](saveUpdates(_0x2fd538['body'],null))[_0x4afc('0x30')](respondWithResult(_0x10c254,null))[_0x4afc('0x23')](handleError(_0x10c254,null));};exports[_0x4afc('0x31')]=function(_0x2d9f3d,_0x518d6f){return db['Dynamics365Account'][_0x4afc('0x50')]({'where':{'id':_0x2d9f3d[_0x4afc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x518d6f,null))[_0x4afc('0x30')](removeEntity(_0x518d6f,null))[_0x4afc('0x23')](handleError(_0x518d6f,null));};exports[_0x4afc('0x53')]=function(_0x2ac06a,_0x329550,_0x13e825){var _0x154797={};var _0x13891d={};var _0x24e1d3;var _0x3369a8;return db[_0x4afc('0x49')][_0x4afc('0x54')]({'where':{'id':_0x2ac06a[_0x4afc('0x4e')]['id']}})[_0x4afc('0x30')](handleEntityNotFound(_0x329550,null))['then'](function(_0x42c65e){if(_0x42c65e){_0x24e1d3=_0x42c65e;_0x13891d[_0x4afc('0x37')]=_[_0x4afc('0x39')](db[_0x4afc('0x55')][_0x4afc('0x35')]);_0x13891d[_0x4afc('0x38')]=_[_0x4afc('0x39')](_0x2ac06a['query']);_0x13891d[_0x4afc('0x3a')]=_[_0x4afc('0x3b')](_0x13891d['model'],_0x13891d['query']);_0x154797[_0x4afc('0x3c')]=_[_0x4afc('0x3b')](_0x13891d[_0x4afc('0x37')],qs[_0x4afc('0x3d')](_0x2ac06a[_0x4afc('0x38')][_0x4afc('0x3d')]));_0x154797[_0x4afc('0x3c')]=_0x154797[_0x4afc('0x3c')][_0x4afc('0x56')]?_0x154797[_0x4afc('0x3c')]:_0x13891d['model'];_0x154797['order']=qs[_0x4afc('0x41')](_0x2ac06a[_0x4afc('0x38')]['sort']);_0x154797[_0x4afc('0x48')]=qs[_0x4afc('0x3a')](_['pick'](_0x2ac06a['query'],_0x13891d[_0x4afc('0x3a')]));if(_0x2ac06a[_0x4afc('0x38')][_0x4afc('0x43')]){_0x154797['where']=_[_0x4afc('0x44')](_0x154797['where'],{'$or':_['map'](_0x154797[_0x4afc('0x3c')],function(_0x37b5aa){var _0x53f9ca={};_0x53f9ca[_0x37b5aa]={'$like':'%'+_0x2ac06a[_0x4afc('0x38')][_0x4afc('0x43')]+'%'};return _0x53f9ca;})});}_0x154797=_[_0x4afc('0x44')]({},_0x154797,_0x2ac06a[_0x4afc('0x47')]);return _0x24e1d3[_0x4afc('0x53')](_0x154797);}})[_0x4afc('0x30')](function(_0x4a616e){if(_0x4a616e){_0x3369a8=_0x4a616e[_0x4afc('0x56')];if(!_0x2ac06a[_0x4afc('0x38')][_0x4afc('0x3e')]('nolimit')){_0x154797['limit']=qs['limit'](_0x2ac06a[_0x4afc('0x38')][_0x4afc('0x29')]);_0x154797[_0x4afc('0x28')]=qs['offset'](_0x2ac06a[_0x4afc('0x38')]['offset']);}return _0x24e1d3['getConfigurations'](_0x154797);}})['then'](function(_0x299849){if(_0x299849){return _0x299849?{'count':_0x3369a8,'rows':_0x299849}:null;}})[_0x4afc('0x30')](respondWithResult(_0x329550,null))[_0x4afc('0x23')](handleError(_0x329550,null));};exports['addConfiguration']=function(_0x1e56b7,_0x45cfea,_0x18ab12){if(_0x1e56b7['body']['id']){delete _0x1e56b7[_0x4afc('0x52')]['id'];}return db[_0x4afc('0x49')][_0x4afc('0x54')]({'where':{'id':_0x1e56b7[_0x4afc('0x4e')]['id']}})[_0x4afc('0x30')](handleEntityNotFound(_0x45cfea,null))['then'](function(_0x549e31){if(_0x549e31){_0x1e56b7[_0x4afc('0x52')][_0x4afc('0x57')]=_0x549e31['id'];_0x1e56b7[_0x4afc('0x52')]['Subjects']=integrations[_0x4afc('0x58')](_0x1e56b7[_0x4afc('0x52')][_0x4afc('0x59')],_0x1e56b7[_0x4afc('0x52')][_0x4afc('0x46')]);_0x1e56b7['body'][_0x4afc('0x5a')]=integrations[_0x4afc('0x5b')](_0x1e56b7['body'][_0x4afc('0x59')],_0x1e56b7[_0x4afc('0x52')][_0x4afc('0x46')]);return db['Dynamics365Configuration'][_0x4afc('0x51')](_0x1e56b7[_0x4afc('0x52')],{'include':[{'model':db[_0x4afc('0x5c')],'as':_0x4afc('0x5d')},{'model':db[_0x4afc('0x5c')],'as':_0x4afc('0x5a')}]});}return null;})[_0x4afc('0x30')](respondWithResult(_0x45cfea,null))[_0x4afc('0x23')](handleError(_0x45cfea,null));};exports['getFields']=function(_0x457b2c,_0x5e3290,_0x5a0a78){var _0x2e0f15=_0x457b2c[_0x4afc('0x38')][_0x4afc('0x5e')];var _0x5908f0=_0x2e0f15==='incident'?_0x4afc('0x5f'):_0x4afc('0x60');var _0xa3f8b7='';var _0xb34abf='';var _0x15fb26='';var _0x264f65='';var _0x4701ca='';var _0x198ec9='';var _0x5fd3e1='';var _0x396cb5='';var _0x3e846f=[_0x4afc('0x61'),_0x4afc('0x62'),_0x4afc('0x63'),_0x4afc('0x64'),_0x4afc('0x65'),'subject',_0x4afc('0x66'),_0x4afc('0x67'),_0x4afc('0x68'),_0x4afc('0x69')];var _0x19c06a=[_0x4afc('0x6a'),_0x4afc('0x6b'),_0x4afc('0x6c'),_0x4afc('0x6d'),'contactidname',_0x4afc('0x6e'),_0x4afc('0x6f'),_0x4afc('0x70'),_0x4afc('0x71'),'createdbyexternalpartyyominame',_0x4afc('0x72'),_0x4afc('0x73'),_0x4afc('0x74'),_0x4afc('0x75'),_0x4afc('0x76'),_0x4afc('0x77'),_0x4afc('0x78'),_0x4afc('0x79'),_0x4afc('0x7a'),_0x4afc('0x7b'),'entityimage_timestamp',_0x4afc('0x7c'),_0x4afc('0x7d'),'exchangerate',_0x4afc('0x7e'),_0x4afc('0x7f'),_0x4afc('0x80'),'influencescore',_0x4afc('0x81'),_0x4afc('0x82'),_0x4afc('0x83'),_0x4afc('0x84'),'modifiedbyexternalpartyyominame',_0x4afc('0x85'),_0x4afc('0x86'),'modifiedon',_0x4afc('0x87'),_0x4afc('0x88'),_0x4afc('0x89'),'msdyn_iotalertname','numberofchildincidents',_0x4afc('0x8a'),_0x4afc('0x8b'),_0x4afc('0x8c'),_0x4afc('0x8d'),_0x4afc('0x8e'),_0x4afc('0x8f'),_0x4afc('0x90'),_0x4afc('0x91'),_0x4afc('0x92'),_0x4afc('0x93'),_0x4afc('0x94'),_0x4afc('0x95'),_0x4afc('0x96'),_0x4afc('0x97'),_0x4afc('0x98'),_0x4afc('0x99'),'sentimentvalue',_0x4afc('0x9a'),_0x4afc('0x9b'),'socialprofileidname',_0x4afc('0x9c'),'statuscode','subjectidname',_0x4afc('0x9d'),'timezoneruleversionnumber','transactioncurrencyidname',_0x4afc('0x9e'),'utcconversiontimezonecode',_0x4afc('0x9f')];var _0x492301=_0x3e846f[_0x4afc('0xa0')](_0x19c06a);return db[_0x4afc('0x49')][_0x4afc('0x54')]({'where':{'id':_0x457b2c[_0x4afc('0x4e')]['id']},'attributes':['id',_0x4afc('0xa1'),'password',_0x4afc('0xa2'),_0x4afc('0xa3'),'clientId','clientSecret']})[_0x4afc('0x30')](handleEntityNotFound(_0x5e3290,null))[_0x4afc('0x30')](function(_0x373e9c){if(_0x373e9c){_0x396cb5=_0x373e9c[_0x4afc('0xa2')];var _0x4596ed=_0x396cb5['slice'](-0x1);if(_0x4596ed==='/'){_0x396cb5=_0x396cb5[_0x4afc('0xa4')](0x0,_0x396cb5[_0x4afc('0xa5')](_0x4596ed));}_0x5fd3e1=util[_0x4afc('0xa6')](_0x4afc('0xa7'),_0x396cb5);var _0x58fe0d={'method':_0x4afc('0xa8'),'uri':'https://login.microsoftonline.com/'+_0x373e9c[_0x4afc('0xa3')]+_0x4afc('0xa9'),'form':{'client_id':_0x373e9c[_0x4afc('0xaa')],'resource':_0x396cb5,'username':_0x373e9c[_0x4afc('0xa1')],'password':_0x373e9c[_0x4afc('0xab')],'grant_type':_0x4afc('0xab'),'client_secret':_0x373e9c[_0x4afc('0xac')]},'json':!![]};return rp(_0x58fe0d);}})[_0x4afc('0x30')](function(_0x34473d){_0x198ec9=_0x34473d[_0x4afc('0xad')];var _0x27dd60={'method':'GET','uri':encodeURI(_0x5fd3e1+_0x4afc('0xae')+_0x5908f0+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x198ec9,'If-None-Match':null,'OData-Version':_0x4afc('0xaf')},'json':!![]};return rp(_0x27dd60);})['then'](function(_0x50198d){var _0x681c5e=_0x50198d['value'][0x0];var _0x512f92=_0x681c5e[_0x4afc('0xb0')];var _0x489c9d={'method':_0x4afc('0xb1'),'uri':_0x5fd3e1+_0x4afc('0xb2')+_0x512f92+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x4afc('0xb3')+_0x198ec9,'If-None-Match':null,'OData-Version':_0x4afc('0xaf')},'json':!![]};return rp(_0x489c9d);})['then'](function(_0x3a9836){_0xa3f8b7=_0x3a9836;_0xb34abf=_0xa3f8b7[_0x4afc('0xb4')];_0xb34abf=_[_0x4afc('0xb5')](_0xb34abf,function(_0x4c900a){return!_0x492301[_0x4afc('0xb6')](_0x4c900a[_0x4afc('0xb7')]);});var _0x40c7c8=[];var _0x16eb6d=[];_0xb34abf[_0x4afc('0xb8')](function(_0xbdeb7d){if(_0xbdeb7d['@odata.type']){var _0x4daf24=_0xbdeb7d[_0x4afc('0xb9')][_0x4afc('0xa4')](_0xbdeb7d['@odata.type'][_0x4afc('0xa5')]('.')+0x1);if(_0x4daf24===_0x4afc('0xba')){_0x40c7c8['push'](getSelectList(_0x5fd3e1,_0x2e0f15,_0x16eb6d,_0xa3f8b7[_0x4afc('0xb0')],_0xbdeb7d[_0x4afc('0xb0')],_0x198ec9));}}});return Promise[_0x4afc('0xbb')](_0x40c7c8);})[_0x4afc('0x30')](function(_0x2585b3){_0x15fb26=_0x2585b3[0x0];var _0x4b1bbc=[];var _0x413579=[];_0xb34abf[_0x4afc('0xb8')](function(_0x213a30){if(!_[_0x4afc('0xbc')](_0x213a30[_0x4afc('0xb9')])){var _0x492dac=_0x213a30[_0x4afc('0xb9')][_0x4afc('0xa4')](_0x213a30[_0x4afc('0xb9')]['lastIndexOf']('.')+0x1);if(_0x492dac===_0x4afc('0xbd')){_0x4b1bbc[_0x4afc('0xbe')](getBooleanList(_0x5fd3e1,_0x2e0f15,_0x413579,_0xa3f8b7['MetadataId'],_0x213a30['MetadataId'],_0x198ec9));}}});return Promise['all'](_0x4b1bbc);})[_0x4afc('0x30')](function(_0xbd4a65){_0x264f65=_0xbd4a65[0x0];var _0x4c81c1=[];var _0x271311=[];_0xb34abf[_0x4afc('0xb8')](function(_0x53b3df){if(_0x53b3df[_0x4afc('0xb9')]){var _0x37a056=_0x53b3df[_0x4afc('0xb9')][_0x4afc('0xa4')](_0x53b3df[_0x4afc('0xb9')][_0x4afc('0xa5')]('.')+0x1);if(_0x37a056===_0x4afc('0xbf')||_0x37a056===_0x4afc('0xc0')||_0x37a056===_0x4afc('0xc1')||_0x37a056==='IntegerAttributeMetadata'||_0x37a056===_0x4afc('0xc2')||_0x37a056===_0x4afc('0xc3')||_0x37a056===_0x4afc('0xc4')||_0x37a056===_0x4afc('0xc5')||_0x37a056==='StateAttributeMetadata'||_0x37a056===_0x4afc('0xc6')){_0x4c81c1[_0x4afc('0xbe')](getInputList(_0x5fd3e1,_0x2e0f15,_0x37a056,_0x271311,_0xa3f8b7['MetadataId'],_0x53b3df['MetadataId'],_0x198ec9));}}});return Promise['all'](_0x4c81c1);})[_0x4afc('0x30')](function(_0x3a6d98){_0x4701ca=_0x3a6d98[0x0];var _0x429040=_0x15fb26['concat'](_0x264f65)[_0x4afc('0xa0')](_0x4701ca);var _0x1015f3={'count':_0x429040[_0x4afc('0x56')],'rows':_0x429040};return _0x1015f3;})['then'](respondWithResult(_0x5e3290,null))[_0x4afc('0x23')](function(_0x54c4e2){var _0x58dbd0=_0x457b2c[_0x4afc('0x38')][_0x4afc('0xc7')]?0x1f4:_0x54c4e2[_0x4afc('0xc8')]||0x1f4;logger['error'](_0x54c4e2[_0x4afc('0xc9')]);delete _0x54c4e2[_0x4afc('0x32')];if(_0x58dbd0===0x191){_0x58dbd0=0x190;}_0x5e3290[_0x4afc('0x25')](_0x58dbd0)[_0x4afc('0x33')](_0x457b2c[_0x4afc('0x38')][_0x4afc('0xc7')]?{'message':_0x4afc('0xca'),'statusCode':_0x54c4e2[_0x4afc('0xc8')]}:_0x54c4e2);});};function getSelectList(_0x44a404,_0x4b4267,_0x497f33,_0x35aac1,_0x13f446,_0x9748d5){var _0x2b3bbb={'method':'GET','uri':_0x44a404+_0x4afc('0xb2')+_0x35aac1+')/Attributes('+_0x13f446+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x4afc('0xb3')+_0x9748d5,'If-None-Match':null,'OData-Version':_0x4afc('0xaf')},'json':!![]};return rp(_0x2b3bbb)[_0x4afc('0x30')](function(_0x3e26e9){var _0x3e523b=[];var _0x20eb80=_0x3e26e9[_0x4afc('0xcb')][_0x4afc('0xcc')];_0x20eb80[_0x4afc('0xb8')](function(_0x2d4960){_0x3e523b[_0x4afc('0xbe')]({'name':_0x2d4960[_0x4afc('0xcd')][_0x4afc('0xce')]['Label'],'value':String(_0x2d4960[_0x4afc('0xcf')])});});var _0x2a0a47={'id':_0x4b4267+'_'+_0x3e26e9[_0x4afc('0xb7')],'name':_0x3e26e9[_0x4afc('0xd0')]['UserLocalizedLabel'][_0x4afc('0xcd')],'custom':![],'options':_0x3e523b};_0x497f33[_0x4afc('0xbe')](_0x2a0a47);return _0x497f33;});}function getBooleanList(_0x503621,_0x3cab80,_0x287099,_0x44b48a,_0x46f5c1,_0x504eae){var _0x42f066={'method':_0x4afc('0xb1'),'uri':_0x503621+_0x4afc('0xb2')+_0x44b48a+')/Attributes('+_0x46f5c1+_0x4afc('0xd1'),'headers':{'Authorization':_0x4afc('0xb3')+_0x504eae,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x42f066)[_0x4afc('0x30')](function(_0x5bff57){var _0x626769=[];_0x626769[_0x4afc('0xbe')]({'name':_0x5bff57[_0x4afc('0xcb')][_0x4afc('0xd2')][_0x4afc('0xcd')][_0x4afc('0xce')][_0x4afc('0xcd')],'value':_0x4afc('0xd3')},{'name':_0x5bff57['OptionSet']['FalseOption'][_0x4afc('0xcd')][_0x4afc('0xce')][_0x4afc('0xcd')],'value':'false'});var _0xd283a7={'id':_0x3cab80+'_'+_0x5bff57[_0x4afc('0xb7')],'name':_0x5bff57['DisplayName'][_0x4afc('0xce')][_0x4afc('0xcd')],'custom':![],'options':_0x626769};_0x287099[_0x4afc('0xbe')](_0xd283a7);return _0x287099;});}function getInputList(_0x5ca9fe,_0x150da,_0x43a30c,_0x24dbd2,_0x53d197,_0x10f93a,_0x3a5ddc){var _0x2e09f7={'method':_0x4afc('0xb1'),'uri':_0x5ca9fe+_0x4afc('0xb2')+_0x53d197+_0x4afc('0xd4')+_0x10f93a+_0x4afc('0xd5')+_0x43a30c+_0x4afc('0xd6'),'headers':{'Authorization':_0x4afc('0xb3')+_0x3a5ddc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2e09f7)[_0x4afc('0x30')](function(_0x3af1ce){var _0x33638a={'id':_0x150da+'_'+_0x3af1ce['LogicalName'],'name':_0x3af1ce['DisplayName'][_0x4afc('0xce')]?_0x3af1ce[_0x4afc('0xd0')][_0x4afc('0xce')][_0x4afc('0xcd')]:_0x3af1ce[_0x4afc('0xb7')],'custom':![],'options':[]};_0x24dbd2[_0x4afc('0xbe')](_0x33638a);return _0x24dbd2;});} \ No newline at end of file +var _0x9536=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','show','params','find','body','findOne','Dynamics365Configuration','options','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','incident','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','username','remoteUri','tenantId','clientSecret','slice','substring','lastIndexOf','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','clientId','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','stack','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','offset','limit','set','reject','update','destroy','name','send','index','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x44fc5a,_0x2f2b17){var _0x278736=function(_0x4a6d31){while(--_0x4a6d31){_0x44fc5a['push'](_0x44fc5a['shift']());}};_0x278736(++_0x2f2b17);}(_0x9536,0x179));var _0x6953=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0x9536[_0x3a6e4b];return _0x36572d;};'use strict';var pdf=require(_0x6953('0x0'));var emlformat=require(_0x6953('0x1'));var rimraf=require(_0x6953('0x2'));var zipdir=require(_0x6953('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6953('0x4'));var moment=require('moment');var BPromise=require(_0x6953('0x5'));var Mustache=require(_0x6953('0x6'));var util=require(_0x6953('0x7'));var path=require(_0x6953('0x8'));var sox=require(_0x6953('0x9'));var csv=require('to-csv');var ejs=require(_0x6953('0xa'));var fs=require('fs');var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0xf'));var querystring=require(_0x6953('0x10'));var Papa=require(_0x6953('0x11'));var Redis=require('ioredis');var authService=require(_0x6953('0x12'));var qs=require(_0x6953('0x13'));var as=require(_0x6953('0x14'));var hardwareService=require(_0x6953('0x15'));var logger=require(_0x6953('0x16'))(_0x6953('0x17'));var utils=require(_0x6953('0x18'));var config=require(_0x6953('0x19'));var licenseUtil=require(_0x6953('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6953('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0x6953('0x1c')][_0x6953('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3e83d5,_0xe35f08,_0x1b5221,_0x244713){return new BPromise(function(_0x175fa9,_0x27a57c){var _0x28433e=_0x244713||client;return _0x28433e[_0x6953('0x1e')](_0x3e83d5,_0x1b5221)[_0x6953('0x1f')](function(_0x548473){logger['info'](_0x6953('0x20'),_0xe35f08,_0x6953('0x21'));logger[_0x6953('0x22')](_0x6953('0x23'),_0xe35f08,'request\x20sent',JSON[_0x6953('0x24')](_0x548473));if(_0x548473[_0x6953('0x25')]){if(_0x548473['error'][_0x6953('0x26')]===0x1f4){logger[_0x6953('0x25')](_0x6953('0x20'),_0xe35f08,_0x548473[_0x6953('0x25')][_0x6953('0x27')]);return _0x27a57c(_0x548473['error'][_0x6953('0x27')]);}logger[_0x6953('0x25')](_0x6953('0x20'),_0xe35f08,_0x548473[_0x6953('0x25')][_0x6953('0x27')]);return _0x175fa9(_0x548473['error'][_0x6953('0x27')]);}else{logger[_0x6953('0x28')]('Dynamics365Account,\x20%s,\x20%s',_0xe35f08,_0x6953('0x21'));_0x175fa9(_0x548473[_0x6953('0x29')][_0x6953('0x27')]);}})[_0x6953('0x2a')](function(_0x53640a){logger[_0x6953('0x25')](_0x6953('0x20'),_0xe35f08,_0x53640a);_0x27a57c(_0x53640a);});});}function respondWithStatusCode(_0x2a7f6a,_0x508ea7){_0x508ea7=_0x508ea7||0xcc;return function(_0x495ebd){if(_0x495ebd){return _0x2a7f6a['sendStatus'](_0x508ea7);}return _0x2a7f6a[_0x6953('0x2b')](_0x508ea7)[_0x6953('0x2c')]();};}function respondWithResult(_0x550be4,_0x1a32f4){_0x1a32f4=_0x1a32f4||0xc8;return function(_0x587df0){if(_0x587df0){return _0x550be4[_0x6953('0x2b')](_0x1a32f4)[_0x6953('0x2d')](_0x587df0);}};}function respondWithFilteredResult(_0xcdbce8,_0x2cc01e){return function(_0x191d80){if(_0x191d80){var _0x1497e3=_0x191d80['count'],_0x53d3dc=_0x2cc01e[_0x6953('0x2e')],_0x3dd890=_0x2cc01e['offset']+_0x2cc01e[_0x6953('0x2f')],_0x3c1075;if(_0x3dd890>=_0x1497e3){_0x3dd890=_0x1497e3;_0x3c1075=0xc8;}else{_0x3c1075=0xce;}_0xcdbce8[_0x6953('0x2b')](_0x3c1075);return _0xcdbce8[_0x6953('0x30')]('Content-Range',_0x53d3dc+'-'+_0x3dd890+'/'+_0x1497e3)[_0x6953('0x2d')](_0x191d80);}return null;};}function patchUpdates(_0x3d7b04){return function(_0xf78141){try{jsonpatch['apply'](_0xf78141,_0x3d7b04,!![]);}catch(_0x4c49fc){return BPromise[_0x6953('0x31')](_0x4c49fc);}return _0xf78141['save']();};}function saveUpdates(_0x4d856d,_0xd80e42){return function(_0x44389b){if(_0x44389b){return _0x44389b[_0x6953('0x32')](_0x4d856d)[_0x6953('0x1f')](function(_0x544593){return _0x544593;});}return null;};}function removeEntity(_0x56ce8e,_0x402842){return function(_0x561025){if(_0x561025){return _0x561025[_0x6953('0x33')]()[_0x6953('0x1f')](function(){_0x56ce8e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f77a6,_0x1ad003){return function(_0x34d10b){if(!_0x34d10b){_0x1f77a6['sendStatus'](0x194);}return _0x34d10b;};}function handleError(_0x28cb92,_0x5e01d2){_0x5e01d2=_0x5e01d2||0x1f4;return function(_0x4e95f1){logger['error'](_0x4e95f1['stack']);if(_0x4e95f1[_0x6953('0x34')]){delete _0x4e95f1[_0x6953('0x34')];}_0x28cb92[_0x6953('0x2b')](_0x5e01d2)[_0x6953('0x35')](_0x4e95f1);};}exports[_0x6953('0x36')]=function(_0x2ce31f,_0x4f6e06){var _0x2b76a5={},_0x5a8197={},_0x199c67={'count':0x0,'rows':[]};var _0x5c9a4e=_[_0x6953('0x37')](db[_0x6953('0x38')][_0x6953('0x39')],function(_0x248fe7){return{'name':_0x248fe7['fieldName'],'type':_0x248fe7[_0x6953('0x3a')][_0x6953('0x3b')]};});_0x5a8197[_0x6953('0x3c')]=_[_0x6953('0x37')](_0x5c9a4e,_0x6953('0x34'));_0x5a8197[_0x6953('0x3d')]=_[_0x6953('0x3e')](_0x2ce31f[_0x6953('0x3d')]);_0x5a8197[_0x6953('0x3f')]=_[_0x6953('0x40')](_0x5a8197[_0x6953('0x3c')],_0x5a8197['query']);_0x2b76a5[_0x6953('0x41')]=_[_0x6953('0x40')](_0x5a8197[_0x6953('0x3c')],qs['fields'](_0x2ce31f['query'][_0x6953('0x42')]));_0x2b76a5['attributes']=_0x2b76a5['attributes'][_0x6953('0x43')]?_0x2b76a5[_0x6953('0x41')]:_0x5a8197['model'];if(!_0x2ce31f[_0x6953('0x3d')][_0x6953('0x44')](_0x6953('0x45'))){_0x2b76a5[_0x6953('0x2f')]=qs[_0x6953('0x2f')](_0x2ce31f[_0x6953('0x3d')]['limit']);_0x2b76a5[_0x6953('0x2e')]=qs[_0x6953('0x2e')](_0x2ce31f[_0x6953('0x3d')][_0x6953('0x2e')]);}_0x2b76a5[_0x6953('0x46')]=qs[_0x6953('0x47')](_0x2ce31f['query']['sort']);_0x2b76a5[_0x6953('0x48')]=qs['filters'](_['pick'](_0x2ce31f[_0x6953('0x3d')],_0x5a8197[_0x6953('0x3f')]),_0x5c9a4e);if(_0x2ce31f[_0x6953('0x3d')][_0x6953('0x49')]){_0x2b76a5[_0x6953('0x48')]=_['merge'](_0x2b76a5['where'],{'$or':_[_0x6953('0x37')](_0x5c9a4e,function(_0x452b69){if(_0x452b69['type']!==_0x6953('0x4a')){var _0x5d3bf4={};_0x5d3bf4[_0x452b69[_0x6953('0x34')]]={'$like':'%'+_0x2ce31f[_0x6953('0x3d')][_0x6953('0x49')]+'%'};return _0x5d3bf4;}})});}_0x2b76a5=_[_0x6953('0x4b')]({},_0x2b76a5,_0x2ce31f['options']);var _0x8861={'where':_0x2b76a5[_0x6953('0x48')]};return db['Dynamics365Account'][_0x6953('0x4c')](_0x8861)[_0x6953('0x1f')](function(_0x1b4377){_0x199c67[_0x6953('0x4c')]=_0x1b4377;if(_0x2ce31f[_0x6953('0x3d')][_0x6953('0x4d')]){_0x2b76a5[_0x6953('0x4e')]=[{'all':!![]}];}return db[_0x6953('0x38')][_0x6953('0x4f')](_0x2b76a5);})[_0x6953('0x1f')](function(_0x367f30){_0x199c67['rows']=_0x367f30;return _0x199c67;})[_0x6953('0x1f')](respondWithFilteredResult(_0x4f6e06,_0x2b76a5))['catch'](handleError(_0x4f6e06,null));};exports[_0x6953('0x50')]=function(_0x1d5979,_0x382332){var _0x4c4954={'raw':![],'where':{'id':_0x1d5979[_0x6953('0x51')]['id']}},_0xfb9613={};_0xfb9613['model']=_['keys'](db[_0x6953('0x38')][_0x6953('0x39')]);_0xfb9613[_0x6953('0x3d')]=_[_0x6953('0x3e')](_0x1d5979[_0x6953('0x3d')]);_0xfb9613[_0x6953('0x3f')]=_[_0x6953('0x40')](_0xfb9613[_0x6953('0x3c')],_0xfb9613[_0x6953('0x3d')]);_0x4c4954[_0x6953('0x41')]=_[_0x6953('0x40')](_0xfb9613['model'],qs['fields'](_0x1d5979[_0x6953('0x3d')][_0x6953('0x42')]));_0x4c4954[_0x6953('0x41')]=_0x4c4954[_0x6953('0x41')][_0x6953('0x43')]?_0x4c4954[_0x6953('0x41')]:_0xfb9613[_0x6953('0x3c')];if(_0x1d5979[_0x6953('0x3d')][_0x6953('0x4d')]){_0x4c4954['include']=[{'all':!![]}];}_0x4c4954=_['merge']({},_0x4c4954,_0x1d5979['options']);return db['Dynamics365Account'][_0x6953('0x52')](_0x4c4954)[_0x6953('0x1f')](handleEntityNotFound(_0x382332,null))[_0x6953('0x1f')](respondWithResult(_0x382332,null))['catch'](handleError(_0x382332,null));};exports['create']=function(_0x22a7dc,_0x1e707c){return db[_0x6953('0x38')]['create'](_0x22a7dc['body'],{})[_0x6953('0x1f')](respondWithResult(_0x1e707c,0xc9))[_0x6953('0x2a')](handleError(_0x1e707c,null));};exports['update']=function(_0x58fcb3,_0x29937b){if(_0x58fcb3[_0x6953('0x53')]['id']){delete _0x58fcb3[_0x6953('0x53')]['id'];}return db[_0x6953('0x38')][_0x6953('0x52')]({'where':{'id':_0x58fcb3['params']['id']}})[_0x6953('0x1f')](handleEntityNotFound(_0x29937b,null))[_0x6953('0x1f')](saveUpdates(_0x58fcb3['body'],null))[_0x6953('0x1f')](respondWithResult(_0x29937b,null))['catch'](handleError(_0x29937b,null));};exports[_0x6953('0x33')]=function(_0x3fb7a4,_0x33732d){return db[_0x6953('0x38')]['find']({'where':{'id':_0x3fb7a4[_0x6953('0x51')]['id']}})[_0x6953('0x1f')](handleEntityNotFound(_0x33732d,null))[_0x6953('0x1f')](removeEntity(_0x33732d,null))['catch'](handleError(_0x33732d,null));};exports['getConfigurations']=function(_0x29936f,_0x224ce6,_0x2d0abd){var _0x482f3b={};var _0x4c6180={};var _0x44a01;var _0x2b90f7;return db['Dynamics365Account'][_0x6953('0x54')]({'where':{'id':_0x29936f[_0x6953('0x51')]['id']}})['then'](handleEntityNotFound(_0x224ce6,null))[_0x6953('0x1f')](function(_0x1e824a){if(_0x1e824a){_0x44a01=_0x1e824a;_0x4c6180[_0x6953('0x3c')]=_[_0x6953('0x3e')](db[_0x6953('0x55')]['rawAttributes']);_0x4c6180[_0x6953('0x3d')]=_[_0x6953('0x3e')](_0x29936f[_0x6953('0x3d')]);_0x4c6180['filters']=_['intersection'](_0x4c6180[_0x6953('0x3c')],_0x4c6180[_0x6953('0x3d')]);_0x482f3b[_0x6953('0x41')]=_[_0x6953('0x40')](_0x4c6180[_0x6953('0x3c')],qs['fields'](_0x29936f[_0x6953('0x3d')][_0x6953('0x42')]));_0x482f3b[_0x6953('0x41')]=_0x482f3b[_0x6953('0x41')][_0x6953('0x43')]?_0x482f3b[_0x6953('0x41')]:_0x4c6180[_0x6953('0x3c')];_0x482f3b[_0x6953('0x46')]=qs[_0x6953('0x47')](_0x29936f[_0x6953('0x3d')][_0x6953('0x47')]);_0x482f3b[_0x6953('0x48')]=qs[_0x6953('0x3f')](_['pick'](_0x29936f[_0x6953('0x3d')],_0x4c6180[_0x6953('0x3f')]));if(_0x29936f[_0x6953('0x3d')][_0x6953('0x49')]){_0x482f3b[_0x6953('0x48')]=_['merge'](_0x482f3b['where'],{'$or':_[_0x6953('0x37')](_0x482f3b['attributes'],function(_0x471872){var _0x2b5de2={};_0x2b5de2[_0x471872]={'$like':'%'+_0x29936f[_0x6953('0x3d')][_0x6953('0x49')]+'%'};return _0x2b5de2;})});}_0x482f3b=_['merge']({},_0x482f3b,_0x29936f[_0x6953('0x56')]);return _0x44a01[_0x6953('0x57')](_0x482f3b);}})[_0x6953('0x1f')](function(_0x4504c7){if(_0x4504c7){_0x2b90f7=_0x4504c7[_0x6953('0x43')];if(!_0x29936f[_0x6953('0x3d')][_0x6953('0x44')](_0x6953('0x45'))){_0x482f3b[_0x6953('0x2f')]=qs[_0x6953('0x2f')](_0x29936f[_0x6953('0x3d')][_0x6953('0x2f')]);_0x482f3b[_0x6953('0x2e')]=qs[_0x6953('0x2e')](_0x29936f[_0x6953('0x3d')]['offset']);}return _0x44a01[_0x6953('0x57')](_0x482f3b);}})[_0x6953('0x1f')](function(_0x2c6c23){if(_0x2c6c23){return _0x2c6c23?{'count':_0x2b90f7,'rows':_0x2c6c23}:null;}})[_0x6953('0x1f')](respondWithResult(_0x224ce6,null))[_0x6953('0x2a')](handleError(_0x224ce6,null));};exports[_0x6953('0x58')]=function(_0x3e19f1,_0x52d5d4,_0x3bb873){if(_0x3e19f1[_0x6953('0x53')]['id']){delete _0x3e19f1['body']['id'];}return db[_0x6953('0x38')][_0x6953('0x54')]({'where':{'id':_0x3e19f1[_0x6953('0x51')]['id']}})['then'](handleEntityNotFound(_0x52d5d4,null))['then'](function(_0x1ea573){if(_0x1ea573){_0x3e19f1[_0x6953('0x53')][_0x6953('0x59')]=_0x1ea573['id'];_0x3e19f1[_0x6953('0x53')][_0x6953('0x5a')]=integrations[_0x6953('0x5b')](_0x3e19f1[_0x6953('0x53')][_0x6953('0x5c')],_0x3e19f1[_0x6953('0x53')]['type']);_0x3e19f1[_0x6953('0x53')][_0x6953('0x5d')]=integrations[_0x6953('0x5e')](_0x3e19f1[_0x6953('0x53')]['channel'],_0x3e19f1[_0x6953('0x53')][_0x6953('0x3a')]);return db[_0x6953('0x55')]['create'](_0x3e19f1[_0x6953('0x53')],{'include':[{'model':db[_0x6953('0x5f')],'as':_0x6953('0x5a')},{'model':db[_0x6953('0x5f')],'as':'Descriptions'}]});}return null;})[_0x6953('0x1f')](respondWithResult(_0x52d5d4,null))[_0x6953('0x2a')](handleError(_0x52d5d4,null));};exports[_0x6953('0x60')]=function(_0x2dcef9,_0x52c2a0,_0x4eaebb){var _0x513495=_0x2dcef9[_0x6953('0x3d')]['ticketType'];var _0x5a7607=_0x513495===_0x6953('0x61')?_0x6953('0x62'):_0x6953('0x63');var _0x1e09b1='';var _0x52040c='';var _0x34d9ec='';var _0xcf407c='';var _0x574606='';var _0x2bf18c='';var _0xd2aae9='';var _0x491bae='';var _0x4adcfc=['title',_0x6953('0x64'),_0x6953('0x65'),_0x6953('0x66'),_0x6953('0x67'),_0x6953('0x68'),_0x6953('0x69'),_0x6953('0x6a'),_0x6953('0x6b'),'phonecall_activity_parties'];var _0x3e74e0=[_0x6953('0x6c'),_0x6953('0x6d'),_0x6953('0x6e'),_0x6953('0x6f'),_0x6953('0x70'),'contactidyominame',_0x6953('0x71'),'contractidname',_0x6953('0x72'),'createdbyexternalpartyyominame',_0x6953('0x73'),_0x6953('0x74'),_0x6953('0x75'),'createdonbehalfbyname',_0x6953('0x76'),_0x6953('0x77'),_0x6953('0x78'),_0x6953('0x79'),_0x6953('0x7a'),_0x6953('0x7b'),'entityimage_timestamp',_0x6953('0x7c'),_0x6953('0x7d'),_0x6953('0x7e'),_0x6953('0x7f'),_0x6953('0x80'),_0x6953('0x81'),_0x6953('0x82'),_0x6953('0x83'),_0x6953('0x84'),_0x6953('0x85'),_0x6953('0x86'),'modifiedbyexternalpartyyominame',_0x6953('0x87'),_0x6953('0x88'),_0x6953('0x89'),_0x6953('0x8a'),_0x6953('0x8b'),_0x6953('0x8c'),_0x6953('0x8d'),_0x6953('0x8e'),_0x6953('0x8f'),_0x6953('0x90'),_0x6953('0x91'),'owneridtype',_0x6953('0x92'),_0x6953('0x93'),_0x6953('0x94'),'primarycontactidyominame',_0x6953('0x95'),'productidname','productserialnumber',_0x6953('0x96'),_0x6953('0x97'),_0x6953('0x98'),_0x6953('0x99'),_0x6953('0x9a'),_0x6953('0x9b'),_0x6953('0x9c'),'slaname',_0x6953('0x9d'),_0x6953('0x9e'),_0x6953('0x9f'),'subjectidname',_0x6953('0xa0'),_0x6953('0xa1'),'transactioncurrencyidname',_0x6953('0xa2'),'utcconversiontimezonecode','versionnumber'];var _0x471ece=_0x4adcfc['concat'](_0x3e74e0);return db['Dynamics365Account'][_0x6953('0x54')]({'where':{'id':_0x2dcef9[_0x6953('0x51')]['id']},'attributes':['id',_0x6953('0xa3'),'password',_0x6953('0xa4'),_0x6953('0xa5'),'clientId',_0x6953('0xa6')]})[_0x6953('0x1f')](handleEntityNotFound(_0x52c2a0,null))[_0x6953('0x1f')](function(_0x200599){if(_0x200599){_0x491bae=_0x200599[_0x6953('0xa4')];var _0x31d847=_0x491bae[_0x6953('0xa7')](-0x1);if(_0x31d847==='/'){_0x491bae=_0x491bae[_0x6953('0xa8')](0x0,_0x491bae[_0x6953('0xa9')](_0x31d847));}_0xd2aae9=util['format'](_0x6953('0xaa'),_0x491bae);var _0x36b15b={'method':'POST','uri':_0x6953('0xab')+_0x200599[_0x6953('0xa5')]+_0x6953('0xac'),'form':{'client_id':_0x200599[_0x6953('0xad')],'resource':_0x491bae,'username':_0x200599[_0x6953('0xa3')],'password':_0x200599[_0x6953('0xae')],'grant_type':_0x6953('0xae'),'client_secret':_0x200599['clientSecret']},'json':!![]};return rp(_0x36b15b);}})[_0x6953('0x1f')](function(_0x3c7644){_0x2bf18c=_0x3c7644[_0x6953('0xaf')];var _0x12e2ec={'method':_0x6953('0xb0'),'uri':encodeURI(_0xd2aae9+_0x6953('0xb1')+_0x5a7607+'\x27'),'headers':{'Authorization':_0x6953('0xb2')+_0x2bf18c,'If-None-Match':null,'OData-Version':_0x6953('0xb3')},'json':!![]};return rp(_0x12e2ec);})[_0x6953('0x1f')](function(_0x56ed7b){var _0xa69154=_0x56ed7b['value'][0x0];var _0x476893=_0xa69154['MetadataId'];var _0x2c8907={'method':_0x6953('0xb0'),'uri':_0xd2aae9+_0x6953('0xb4')+_0x476893+_0x6953('0xb5'),'headers':{'Authorization':_0x6953('0xb2')+_0x2bf18c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2c8907);})[_0x6953('0x1f')](function(_0x5dedbf){_0x1e09b1=_0x5dedbf;_0x52040c=_0x1e09b1[_0x6953('0xb6')];_0x52040c=_[_0x6953('0xb7')](_0x52040c,function(_0x2907b9){return!_0x471ece[_0x6953('0xb8')](_0x2907b9['LogicalName']);});var _0x467a2f=[];var _0x50f019=[];_0x52040c[_0x6953('0xb9')](function(_0x2e5191){if(_0x2e5191[_0x6953('0xba')]){var _0x1b3658=_0x2e5191[_0x6953('0xba')]['substring'](_0x2e5191[_0x6953('0xba')][_0x6953('0xa9')]('.')+0x1);if(_0x1b3658===_0x6953('0xbb')){_0x467a2f[_0x6953('0xbc')](getSelectList(_0xd2aae9,_0x513495,_0x50f019,_0x1e09b1[_0x6953('0xbd')],_0x2e5191['MetadataId'],_0x2bf18c));}}});return Promise['all'](_0x467a2f);})['then'](function(_0x20e315){_0x34d9ec=_0x20e315[0x0];var _0xe578d4=[];var _0x2b4e50=[];_0x52040c['forEach'](function(_0x41e194){if(!_['isNil'](_0x41e194[_0x6953('0xba')])){var _0x2d4eeb=_0x41e194['@odata.type'][_0x6953('0xa8')](_0x41e194['@odata.type'][_0x6953('0xa9')]('.')+0x1);if(_0x2d4eeb==='BooleanAttributeMetadata'){_0xe578d4['push'](getBooleanList(_0xd2aae9,_0x513495,_0x2b4e50,_0x1e09b1[_0x6953('0xbd')],_0x41e194[_0x6953('0xbd')],_0x2bf18c));}}});return Promise[_0x6953('0xbe')](_0xe578d4);})[_0x6953('0x1f')](function(_0x31622e){_0xcf407c=_0x31622e[0x0];var _0x82389=[];var _0x20ac28=[];_0x52040c[_0x6953('0xb9')](function(_0x5665c9){if(_0x5665c9['@odata.type']){var _0x49fefc=_0x5665c9[_0x6953('0xba')][_0x6953('0xa8')](_0x5665c9[_0x6953('0xba')][_0x6953('0xa9')]('.')+0x1);if(_0x49fefc===_0x6953('0xbf')||_0x49fefc==='DoubleAttributeMetadata'||_0x49fefc===_0x6953('0xc0')||_0x49fefc===_0x6953('0xc1')||_0x49fefc===_0x6953('0xc2')||_0x49fefc===_0x6953('0xc3')||_0x49fefc===_0x6953('0xc4')||_0x49fefc===_0x6953('0xc5')||_0x49fefc===_0x6953('0xc6')||_0x49fefc===_0x6953('0xc7')){_0x82389['push'](getInputList(_0xd2aae9,_0x513495,_0x49fefc,_0x20ac28,_0x1e09b1[_0x6953('0xbd')],_0x5665c9['MetadataId'],_0x2bf18c));}}});return Promise[_0x6953('0xbe')](_0x82389);})[_0x6953('0x1f')](function(_0x26a607){_0x574606=_0x26a607[0x0];var _0x265a0c=_0x34d9ec[_0x6953('0xc8')](_0xcf407c)[_0x6953('0xc8')](_0x574606);var _0x562a8e={'count':_0x265a0c[_0x6953('0x43')],'rows':_0x265a0c};return _0x562a8e;})['then'](respondWithResult(_0x52c2a0,null))[_0x6953('0x2a')](function(_0x19a383){var _0x3f4e63=_0x2dcef9[_0x6953('0x3d')][_0x6953('0xc9')]?0x1f4:_0x19a383[_0x6953('0xca')]||0x1f4;logger[_0x6953('0x25')](_0x19a383[_0x6953('0xcb')]);delete _0x19a383[_0x6953('0x34')];if(_0x3f4e63===0x191){_0x3f4e63=0x190;}_0x52c2a0[_0x6953('0x2b')](_0x3f4e63)[_0x6953('0x35')](_0x2dcef9[_0x6953('0x3d')][_0x6953('0xc9')]?{'message':_0x6953('0xcc'),'statusCode':_0x19a383['statusCode']}:_0x19a383);});};function getSelectList(_0x2f036f,_0x58d25b,_0x4af90f,_0x482b6a,_0x31da83,_0x3c1e72){var _0x17cd4b={'method':_0x6953('0xb0'),'uri':_0x2f036f+_0x6953('0xb4')+_0x482b6a+_0x6953('0xcd')+_0x31da83+_0x6953('0xce')+_0x6953('0xcf'),'headers':{'Authorization':_0x6953('0xb2')+_0x3c1e72,'If-None-Match':null,'OData-Version':_0x6953('0xb3')},'json':!![]};return rp(_0x17cd4b)[_0x6953('0x1f')](function(_0x1eee6b){var _0x105671=[];var _0x597b7a=_0x1eee6b[_0x6953('0xd0')][_0x6953('0xd1')];_0x597b7a[_0x6953('0xb9')](function(_0x83d785){_0x105671['push']({'name':_0x83d785[_0x6953('0xd2')][_0x6953('0xd3')]['Label'],'value':String(_0x83d785[_0x6953('0xd4')])});});var _0x2358e8={'id':_0x58d25b+'_'+_0x1eee6b[_0x6953('0xd5')],'name':_0x1eee6b[_0x6953('0xd6')][_0x6953('0xd3')]['Label'],'custom':![],'options':_0x105671};_0x4af90f[_0x6953('0xbc')](_0x2358e8);return _0x4af90f;});}function getBooleanList(_0x395cca,_0x2b43be,_0x388d85,_0x207e61,_0x4769f9,_0xedf35d){var _0x37aa51={'method':_0x6953('0xb0'),'uri':_0x395cca+_0x6953('0xb4')+_0x207e61+_0x6953('0xcd')+_0x4769f9+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0xedf35d,'If-None-Match':null,'OData-Version':_0x6953('0xb3')},'json':!![]};return rp(_0x37aa51)[_0x6953('0x1f')](function(_0x1715a4){var _0x3cafd8=[];_0x3cafd8[_0x6953('0xbc')]({'name':_0x1715a4[_0x6953('0xd0')][_0x6953('0xd7')][_0x6953('0xd2')]['UserLocalizedLabel']['Label'],'value':_0x6953('0xd8')},{'name':_0x1715a4['OptionSet'][_0x6953('0xd9')][_0x6953('0xd2')]['UserLocalizedLabel'][_0x6953('0xd2')],'value':_0x6953('0xda')});var _0x24f23e={'id':_0x2b43be+'_'+_0x1715a4[_0x6953('0xd5')],'name':_0x1715a4[_0x6953('0xd6')]['UserLocalizedLabel'][_0x6953('0xd2')],'custom':![],'options':_0x3cafd8};_0x388d85['push'](_0x24f23e);return _0x388d85;});}function getInputList(_0x4eeecf,_0x247b13,_0x59bb21,_0x1a6c15,_0x355497,_0x5dea33,_0x1e67b5){var _0x439f79={'method':_0x6953('0xb0'),'uri':_0x4eeecf+_0x6953('0xb4')+_0x355497+_0x6953('0xcd')+_0x5dea33+_0x6953('0xdb')+_0x59bb21+_0x6953('0xdc'),'headers':{'Authorization':_0x6953('0xb2')+_0x1e67b5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x439f79)[_0x6953('0x1f')](function(_0x3dfb72){var _0x3f4569={'id':_0x247b13+'_'+_0x3dfb72[_0x6953('0xd5')],'name':_0x3dfb72[_0x6953('0xd6')][_0x6953('0xd3')]?_0x3dfb72[_0x6953('0xd6')][_0x6953('0xd3')]['Label']:_0x3dfb72[_0x6953('0xd5')],'custom':![],'options':[]};_0x1a6c15[_0x6953('0xbc')](_0x3f4569);return _0x1a6c15;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 6d9dafe..4c2548d 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 _0xa3ae=['../../components/integrations/configuration','define','int_dynamics365_accounts','util','../../config/logger','moment','bluebird','path','rimraf','./intDynamics365Account.attributes'];(function(_0xdfcfd,_0x40fcb0){var _0x395eaa=function(_0x451c69){while(--_0x451c69){_0xdfcfd['push'](_0xdfcfd['shift']());}};_0x395eaa(++_0x40fcb0);}(_0xa3ae,0x125));var _0xea3a=function(_0x40798d,_0x3d4bbb){_0x40798d=_0x40798d-0x0;var _0x6a942=_0xa3ae[_0x40798d];return _0x6a942;};'use strict';var _=require('lodash');var util=require(_0xea3a('0x0'));var logger=require(_0xea3a('0x1'))('api');var moment=require(_0xea3a('0x2'));var BPromise=require(_0xea3a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea3a('0x4'));var rimraf=require(_0xea3a('0x5'));var config=require('../../config/environment');var attributes=require(_0xea3a('0x6'));var integrations=require(_0xea3a('0x7'));module['exports']=function(_0x56eaf3,_0xa40fc){return _0x56eaf3[_0xea3a('0x8')]('Dynamics365Account',attributes,{'tableName':_0xea3a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['lodash','../../config/logger','moment','path','rimraf','../../config/environment','./intDynamics365Account.attributes','exports','Dynamics365Account','int_dynamics365_accounts'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xc1c6,0x104));var _0x6c1c=function(_0x137613,_0x42bbaa){_0x137613=_0x137613-0x0;var _0x2d69c1=_0xc1c6[_0x137613];return _0x2d69c1;};'use strict';var _=require(_0x6c1c('0x0'));var util=require('util');var logger=require(_0x6c1c('0x1'))('api');var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c1c('0x3'));var rimraf=require(_0x6c1c('0x4'));var config=require(_0x6c1c('0x5'));var attributes=require(_0x6c1c('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x6c1c('0x7')]=function(_0xadb3ba,_0x497e2b){return _0xadb3ba['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'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 d6fc1d2..d0edfec 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 _0xb7ac=['info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','limit','include','map','model','debug','catch','ShowDynamics365Account','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x441847,_0x21da34){var _0x5b109c=function(_0x1ec126){while(--_0x1ec126){_0x441847['push'](_0x441847['shift']());}};_0x5b109c(++_0x21da34);}(_0xb7ac,0x18a));var _0xcb7a=function(_0x106da7,_0x57ec80){_0x106da7=_0x106da7-0x0;var _0x3da9e3=_0xb7ac[_0x106da7];return _0x3da9e3;};'use strict';var _=require(_0xcb7a('0x0'));var util=require(_0xcb7a('0x1'));var moment=require(_0xcb7a('0x2'));var BPromise=require(_0xcb7a('0x3'));var rs=require(_0xcb7a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb7a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb7a('0x6'))(_0xcb7a('0x7'));var config=require('../../config/environment');var jayson=require(_0xcb7a('0x8'));var client=jayson[_0xcb7a('0x9')][_0xcb7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fe4a9,_0x5c31b1,_0x2fb36a){return new BPromise(function(_0x170859,_0x555ea7){return client[_0xcb7a('0xb')](_0x4fe4a9,_0x2fb36a)[_0xcb7a('0xc')](function(_0x41ad34){logger[_0xcb7a('0xd')](_0xcb7a('0xe'),_0x5c31b1,_0xcb7a('0xf'));logger['debug'](_0xcb7a('0x10'),_0x5c31b1,_0xcb7a('0xf'),JSON[_0xcb7a('0x11')](_0x41ad34));if(_0x41ad34['error']){if(_0x41ad34[_0xcb7a('0x12')][_0xcb7a('0x13')]===0x1f4){logger['error'](_0xcb7a('0xe'),_0x5c31b1,_0x41ad34[_0xcb7a('0x12')][_0xcb7a('0x14')]);return _0x555ea7(_0x41ad34[_0xcb7a('0x12')][_0xcb7a('0x14')]);}logger[_0xcb7a('0x12')](_0xcb7a('0xe'),_0x5c31b1,_0x41ad34[_0xcb7a('0x12')][_0xcb7a('0x14')]);return _0x170859(_0x41ad34['error'][_0xcb7a('0x14')]);}else{logger['info'](_0xcb7a('0xe'),_0x5c31b1,_0xcb7a('0xf'));_0x170859(_0x41ad34[_0xcb7a('0x15')][_0xcb7a('0x14')]);}})['catch'](function(_0x2bb2e9){logger[_0xcb7a('0x12')](_0xcb7a('0xe'),_0x5c31b1,_0x2bb2e9);_0x555ea7(_0x2bb2e9);});});}exports[_0xcb7a('0x16')]=function(_0x118dde){var _0x28be52=this;return new Promise(function(_0x119bb2,_0x5a83b9){return db[_0xcb7a('0x17')][_0xcb7a('0x18')]({'raw':_0x118dde[_0xcb7a('0x19')]?_0x118dde[_0xcb7a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x118dde['options']?_0x118dde['options'][_0xcb7a('0x1a')]||null:null,'attributes':_0x118dde['options']?_0x118dde[_0xcb7a('0x19')][_0xcb7a('0x1b')]||null:null,'limit':_0x118dde[_0xcb7a('0x19')]?_0x118dde[_0xcb7a('0x19')][_0xcb7a('0x1c')]||null:null,'include':_0x118dde[_0xcb7a('0x19')]?_0x118dde[_0xcb7a('0x19')][_0xcb7a('0x1d')]?_[_0xcb7a('0x1e')](_0x118dde[_0xcb7a('0x19')][_0xcb7a('0x1d')],function(_0x5a29a7){return{'model':db[_0x5a29a7['model']],'as':_0x5a29a7['as'],'attributes':_0x5a29a7['attributes'],'include':_0x5a29a7[_0xcb7a('0x1d')]?_[_0xcb7a('0x1e')](_0x5a29a7[_0xcb7a('0x1d')],function(_0x28682a){return{'model':db[_0x28682a['model']],'as':_0x28682a['as'],'attributes':_0x28682a[_0xcb7a('0x1b')],'include':_0x28682a[_0xcb7a('0x1d')]?_[_0xcb7a('0x1e')](_0x28682a[_0xcb7a('0x1d')],function(_0x558c42){return{'model':db[_0x558c42[_0xcb7a('0x1f')]],'as':_0x558c42['as'],'attributes':_0x558c42[_0xcb7a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b7fc8){logger[_0xcb7a('0xd')](_0xcb7a('0x16'),_0x118dde);logger[_0xcb7a('0x20')](_0xcb7a('0x16'),_0x118dde,JSON['stringify'](_0x3b7fc8));_0x119bb2(_0x3b7fc8);})[_0xcb7a('0x21')](function(_0x59c56a){logger[_0xcb7a('0x12')]('GetDynamics365Account',_0x59c56a['message'],_0x118dde);_0x5a83b9(_0x28be52[_0xcb7a('0x12')](0x1f4,_0x59c56a[_0xcb7a('0x14')]));});});};exports[_0xcb7a('0x22')]=function(_0x1303d9){var _0x32b861=this;return new Promise(function(_0x55e6a4,_0x2ded00){return db[_0xcb7a('0x17')][_0xcb7a('0x23')]({'raw':_0x1303d9[_0xcb7a('0x19')]?_0x1303d9[_0xcb7a('0x19')][_0xcb7a('0x24')]===undefined?!![]:![]:!![],'where':_0x1303d9[_0xcb7a('0x19')]?_0x1303d9[_0xcb7a('0x19')][_0xcb7a('0x1a')]||null:null,'attributes':_0x1303d9[_0xcb7a('0x19')]?_0x1303d9[_0xcb7a('0x19')][_0xcb7a('0x1b')]||null:null,'include':_0x1303d9[_0xcb7a('0x19')]?_0x1303d9['options'][_0xcb7a('0x1d')]?_['map'](_0x1303d9[_0xcb7a('0x19')][_0xcb7a('0x1d')],function(_0x1d3e24){return{'model':db[_0x1d3e24[_0xcb7a('0x1f')]],'as':_0x1d3e24['as'],'attributes':_0x1d3e24['attributes'],'include':_0x1d3e24[_0xcb7a('0x1d')]?_['map'](_0x1d3e24[_0xcb7a('0x1d')],function(_0x3c333f){return{'model':db[_0x3c333f[_0xcb7a('0x1f')]],'as':_0x3c333f['as'],'attributes':_0x3c333f['attributes'],'include':_0x3c333f[_0xcb7a('0x1d')]?_[_0xcb7a('0x1e')](_0x3c333f['include'],function(_0x2ede2f){return{'model':db[_0x2ede2f[_0xcb7a('0x1f')]],'as':_0x2ede2f['as'],'attributes':_0x2ede2f[_0xcb7a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcb7a('0xc')](function(_0x48bcf8){logger[_0xcb7a('0xd')](_0xcb7a('0x22'),_0x1303d9);logger[_0xcb7a('0x20')]('ShowDynamics365Account',_0x1303d9,JSON[_0xcb7a('0x11')](_0x48bcf8));_0x55e6a4(_0x48bcf8);})[_0xcb7a('0x21')](function(_0x4636d7){logger[_0xcb7a('0x12')](_0xcb7a('0x22'),_0x4636d7[_0xcb7a('0x14')],_0x1303d9);_0x2ded00(_0x32b861['error'](0x1f4,_0x4636d7[_0xcb7a('0x14')]));});});}; \ No newline at end of file +var _0x4cc7=['where','attributes','limit','include','map','model','ShowDynamics365Account','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw'];(function(_0xa1f5c4,_0x247496){var _0x3f2f74=function(_0x3dae53){while(--_0x3dae53){_0xa1f5c4['push'](_0xa1f5c4['shift']());}};_0x3f2f74(++_0x247496);}(_0x4cc7,0x1b6));var _0x74cc=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0x4cc7[_0x47a40b];return _0x19610c;};'use strict';var _=require(_0x74cc('0x0'));var util=require(_0x74cc('0x1'));var moment=require(_0x74cc('0x2'));var BPromise=require(_0x74cc('0x3'));var rs=require(_0x74cc('0x4'));var fs=require('fs');var Redis=require(_0x74cc('0x5'));var db=require(_0x74cc('0x6'))['db'];var utils=require(_0x74cc('0x7'));var logger=require('../../config/logger')(_0x74cc('0x8'));var config=require(_0x74cc('0x9'));var jayson=require(_0x74cc('0xa'));var client=jayson[_0x74cc('0xb')][_0x74cc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d2678,_0x3704b8,_0x2b104a){return new BPromise(function(_0x3deb8d,_0x3d13eb){return client[_0x74cc('0xd')](_0x1d2678,_0x2b104a)[_0x74cc('0xe')](function(_0x200c3c){logger['info'](_0x74cc('0xf'),_0x3704b8,_0x74cc('0x10'));logger[_0x74cc('0x11')](_0x74cc('0x12'),_0x3704b8,_0x74cc('0x10'),JSON[_0x74cc('0x13')](_0x200c3c));if(_0x200c3c[_0x74cc('0x14')]){if(_0x200c3c[_0x74cc('0x14')][_0x74cc('0x15')]===0x1f4){logger[_0x74cc('0x14')](_0x74cc('0xf'),_0x3704b8,_0x200c3c[_0x74cc('0x14')]['message']);return _0x3d13eb(_0x200c3c[_0x74cc('0x14')][_0x74cc('0x16')]);}logger[_0x74cc('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x3704b8,_0x200c3c[_0x74cc('0x14')][_0x74cc('0x16')]);return _0x3deb8d(_0x200c3c[_0x74cc('0x14')][_0x74cc('0x16')]);}else{logger[_0x74cc('0x17')](_0x74cc('0xf'),_0x3704b8,_0x74cc('0x10'));_0x3deb8d(_0x200c3c[_0x74cc('0x18')][_0x74cc('0x16')]);}})['catch'](function(_0x5c6ae3){logger[_0x74cc('0x14')](_0x74cc('0xf'),_0x3704b8,_0x5c6ae3);_0x3d13eb(_0x5c6ae3);});});}exports[_0x74cc('0x19')]=function(_0x1fb365){var _0x321995=this;return new Promise(function(_0x4efb24,_0x1f4224){return db[_0x74cc('0x1a')][_0x74cc('0x1b')]({'raw':_0x1fb365[_0x74cc('0x1c')]?_0x1fb365[_0x74cc('0x1c')][_0x74cc('0x1d')]===undefined?!![]:![]:!![],'where':_0x1fb365[_0x74cc('0x1c')]?_0x1fb365[_0x74cc('0x1c')][_0x74cc('0x1e')]||null:null,'attributes':_0x1fb365[_0x74cc('0x1c')]?_0x1fb365['options'][_0x74cc('0x1f')]||null:null,'limit':_0x1fb365[_0x74cc('0x1c')]?_0x1fb365[_0x74cc('0x1c')][_0x74cc('0x20')]||null:null,'include':_0x1fb365[_0x74cc('0x1c')]?_0x1fb365[_0x74cc('0x1c')][_0x74cc('0x21')]?_[_0x74cc('0x22')](_0x1fb365[_0x74cc('0x1c')]['include'],function(_0x2dfdf4){return{'model':db[_0x2dfdf4[_0x74cc('0x23')]],'as':_0x2dfdf4['as'],'attributes':_0x2dfdf4['attributes'],'include':_0x2dfdf4[_0x74cc('0x21')]?_[_0x74cc('0x22')](_0x2dfdf4[_0x74cc('0x21')],function(_0x26aa57){return{'model':db[_0x26aa57[_0x74cc('0x23')]],'as':_0x26aa57['as'],'attributes':_0x26aa57['attributes'],'include':_0x26aa57[_0x74cc('0x21')]?_[_0x74cc('0x22')](_0x26aa57['include'],function(_0x1456d3){return{'model':db[_0x1456d3[_0x74cc('0x23')]],'as':_0x1456d3['as'],'attributes':_0x1456d3[_0x74cc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x74cc('0xe')](function(_0x31daaa){logger[_0x74cc('0x17')]('GetDynamics365Account',_0x1fb365);logger[_0x74cc('0x11')](_0x74cc('0x19'),_0x1fb365,JSON['stringify'](_0x31daaa));_0x4efb24(_0x31daaa);})['catch'](function(_0x206c7a){logger[_0x74cc('0x14')](_0x74cc('0x19'),_0x206c7a[_0x74cc('0x16')],_0x1fb365);_0x1f4224(_0x321995[_0x74cc('0x14')](0x1f4,_0x206c7a[_0x74cc('0x16')]));});});};exports[_0x74cc('0x24')]=function(_0x4ddc7e){var _0x3ffe94=this;return new Promise(function(_0x1ec52b,_0x1b4945){return db['Dynamics365Account'][_0x74cc('0x25')]({'raw':_0x4ddc7e[_0x74cc('0x1c')]?_0x4ddc7e[_0x74cc('0x1c')][_0x74cc('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ddc7e[_0x74cc('0x1c')]?_0x4ddc7e[_0x74cc('0x1c')][_0x74cc('0x1e')]||null:null,'attributes':_0x4ddc7e[_0x74cc('0x1c')]?_0x4ddc7e[_0x74cc('0x1c')][_0x74cc('0x1f')]||null:null,'include':_0x4ddc7e[_0x74cc('0x1c')]?_0x4ddc7e[_0x74cc('0x1c')][_0x74cc('0x21')]?_[_0x74cc('0x22')](_0x4ddc7e[_0x74cc('0x1c')][_0x74cc('0x21')],function(_0x140d2a){return{'model':db[_0x140d2a['model']],'as':_0x140d2a['as'],'attributes':_0x140d2a['attributes'],'include':_0x140d2a[_0x74cc('0x21')]?_[_0x74cc('0x22')](_0x140d2a[_0x74cc('0x21')],function(_0x2752a4){return{'model':db[_0x2752a4[_0x74cc('0x23')]],'as':_0x2752a4['as'],'attributes':_0x2752a4[_0x74cc('0x1f')],'include':_0x2752a4[_0x74cc('0x21')]?_[_0x74cc('0x22')](_0x2752a4[_0x74cc('0x21')],function(_0x2c18b9){return{'model':db[_0x2c18b9[_0x74cc('0x23')]],'as':_0x2c18b9['as'],'attributes':_0x2c18b9[_0x74cc('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x573353){logger[_0x74cc('0x17')](_0x74cc('0x24'),_0x4ddc7e);logger[_0x74cc('0x11')](_0x74cc('0x24'),_0x4ddc7e,JSON[_0x74cc('0x13')](_0x573353));_0x1ec52b(_0x573353);})[_0x74cc('0x26')](function(_0x38d4e2){logger[_0x74cc('0x14')](_0x74cc('0x24'),_0x38d4e2[_0x74cc('0x16')],_0x4ddc7e);_0x1b4945(_0x3ffe94[_0x74cc('0x14')](0x1f4,_0x38d4e2[_0x74cc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 3490175..7d82c22 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 _0xaa01=['./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa01,0x10d));var _0x1aa0=function(_0x44dfe5,_0x47dea7){_0x44dfe5=_0x44dfe5-0x0;var _0x49de7d=_0xaa01[_0x44dfe5];return _0x49de7d;};'use strict';var multer=require(_0x1aa0('0x0'));var util=require(_0x1aa0('0x1'));var path=require(_0x1aa0('0x2'));var timeout=require(_0x1aa0('0x3'));var express=require(_0x1aa0('0x4'));var router=express[_0x1aa0('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1aa0('0x6'));var controller=require(_0x1aa0('0x7'));router[_0x1aa0('0x8')]('/',auth[_0x1aa0('0x9')](),controller[_0x1aa0('0xa')]);router[_0x1aa0('0x8')](_0x1aa0('0xb'),auth[_0x1aa0('0x9')](),controller[_0x1aa0('0xc')]);router[_0x1aa0('0x8')](_0x1aa0('0xd'),auth[_0x1aa0('0x9')](),controller['getFields']);router[_0x1aa0('0x8')](_0x1aa0('0xe'),auth['isAuthenticated'](),controller[_0x1aa0('0xf')]);router[_0x1aa0('0x8')](_0x1aa0('0x10'),auth[_0x1aa0('0x9')](),controller['getDescriptions']);router[_0x1aa0('0x11')]('/',auth['isAuthenticated'](),controller[_0x1aa0('0x12')]);router[_0x1aa0('0x13')](_0x1aa0('0xb'),auth[_0x1aa0('0x9')](),controller[_0x1aa0('0x14')]);router['delete']('/:id',auth[_0x1aa0('0x9')](),controller[_0x1aa0('0x15')]);module[_0x1aa0('0x16')]=router; \ No newline at end of file +var _0xc70e=['get','isAuthenticated','show','getFields','/:id/descriptions','getDescriptions','/:id','update','delete','destroy','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x15416b,_0x21d096){var _0x3a384f=function(_0x343b01){while(--_0x343b01){_0x15416b['push'](_0x15416b['shift']());}};_0x3a384f(++_0x21d096);}(_0xc70e,0x11a));var _0xec70=function(_0x462fc9,_0x355e35){_0x462fc9=_0x462fc9-0x0;var _0x240ef1=_0xc70e[_0x462fc9];return _0x240ef1;};'use strict';var multer=require(_0xec70('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec70('0x1'));var express=require(_0xec70('0x2'));var router=express['Router']();var auth=require(_0xec70('0x3'));var interaction=require(_0xec70('0x4'));var config=require(_0xec70('0x5'));var controller=require(_0xec70('0x6'));router[_0xec70('0x7')]('/',auth[_0xec70('0x8')](),controller['index']);router['get']('/:id',auth[_0xec70('0x8')](),controller[_0xec70('0x9')]);router[_0xec70('0x7')]('/:id/fields',auth[_0xec70('0x8')](),controller[_0xec70('0xa')]);router[_0xec70('0x7')]('/:id/subjects',auth[_0xec70('0x8')](),controller['getSubjects']);router[_0xec70('0x7')](_0xec70('0xb'),auth[_0xec70('0x8')](),controller[_0xec70('0xc')]);router['post']('/',auth[_0xec70('0x8')](),controller['create']);router['put'](_0xec70('0xd'),auth[_0xec70('0x8')](),controller[_0xec70('0xe')]);router[_0xec70('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xec70('0x10')]);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 79e7935..6b89b8e 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 _0x6250=['incident','phonecall','sequelize','STRING','ENUM'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x6250,0x1dd));var _0x0625=function(_0x333ae8,_0xf0464b){_0x333ae8=_0x333ae8-0x0;var _0xcc0696=_0x6250[_0x333ae8];return _0xcc0696;};'use strict';var Sequelize=require(_0x0625('0x0'));module['exports']={'name':{'type':Sequelize[_0x0625('0x1')]},'description':{'type':Sequelize[_0x0625('0x1')]},'ticketType':{'type':Sequelize[_0x0625('0x2')](_0x0625('0x3'),_0x0625('0x4')),'defaultValue':'incident'}}; \ No newline at end of file +var _0x4859=['sequelize','exports','STRING','ENUM','incident','phonecall'];(function(_0x5a73d3,_0x351c75){var _0x1c5dc0=function(_0x1f4ecc){while(--_0x1f4ecc){_0x5a73d3['push'](_0x5a73d3['shift']());}};_0x1c5dc0(++_0x351c75);}(_0x4859,0x8a));var _0x9485=function(_0x57a753,_0x1e1c54){_0x57a753=_0x57a753-0x0;var _0x12a1ac=_0x4859[_0x57a753];return _0x12a1ac;};'use strict';var Sequelize=require(_0x9485('0x0'));module[_0x9485('0x1')]={'name':{'type':Sequelize[_0x9485('0x2')]},'description':{'type':Sequelize[_0x9485('0x2')]},'ticketType':{'type':Sequelize[_0x9485('0x3')](_0x9485('0x4'),_0x9485('0x5')),'defaultValue':_0x9485('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index c0914e4..a940652 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 _0x4c8c=['path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','include','findAll','rows','params','keys','includeAll','options','create','body','update','find','findOne','Dynamics365Field','getFields','getSubjects','getDescriptions','html-pdf','eml-format','request-promise','mustache'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0x4c8c,0x1f4));var _0xc4c8=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x4c8c[_0x673722];return _0x21249c;};'use strict';var pdf=require(_0xc4c8('0x0'));var emlformat=require(_0xc4c8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc4c8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc4c8('0x3'));var util=require('util');var path=require(_0xc4c8('0x4'));var sox=require(_0xc4c8('0x5'));var csv=require(_0xc4c8('0x6'));var ejs=require(_0xc4c8('0x7'));var fs=require('fs');var _=require(_0xc4c8('0x8'));var squel=require('squel');var crypto=require(_0xc4c8('0x9'));var jsforce=require(_0xc4c8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc4c8('0x6'));var querystring=require(_0xc4c8('0xb'));var Papa=require(_0xc4c8('0xc'));var Redis=require(_0xc4c8('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc4c8('0xe'));var as=require(_0xc4c8('0xf'));var hardwareService=require(_0xc4c8('0x10'));var logger=require(_0xc4c8('0x11'))(_0xc4c8('0x12'));var utils=require(_0xc4c8('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc4c8('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc4c8('0x15')][_0xc4c8('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x1278e0,_0x3427b5,_0x466a16,_0x3a4451){return new BPromise(function(_0x48ec57,_0x1e49ed){var _0x579fb0=_0x3a4451||client;return _0x579fb0[_0xc4c8('0x17')](_0x1278e0,_0x466a16)[_0xc4c8('0x18')](function(_0x4d61b0){logger[_0xc4c8('0x19')](_0xc4c8('0x1a'),_0x3427b5,'request\x20sent');logger[_0xc4c8('0x1b')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3427b5,_0xc4c8('0x1c'),JSON['stringify'](_0x4d61b0));if(_0x4d61b0[_0xc4c8('0x1d')]){if(_0x4d61b0[_0xc4c8('0x1d')][_0xc4c8('0x1e')]===0x1f4){logger['error'](_0xc4c8('0x1a'),_0x3427b5,_0x4d61b0['error'][_0xc4c8('0x1f')]);return _0x1e49ed(_0x4d61b0[_0xc4c8('0x1d')]['message']);}logger[_0xc4c8('0x1d')](_0xc4c8('0x1a'),_0x3427b5,_0x4d61b0['error'][_0xc4c8('0x1f')]);return _0x48ec57(_0x4d61b0[_0xc4c8('0x1d')][_0xc4c8('0x1f')]);}else{logger[_0xc4c8('0x19')](_0xc4c8('0x1a'),_0x3427b5,_0xc4c8('0x1c'));_0x48ec57(_0x4d61b0['result'][_0xc4c8('0x1f')]);}})[_0xc4c8('0x20')](function(_0x4c2678){logger[_0xc4c8('0x1d')](_0xc4c8('0x1a'),_0x3427b5,_0x4c2678);_0x1e49ed(_0x4c2678);});});}function respondWithStatusCode(_0x1ffff3,_0x1f48e2){_0x1f48e2=_0x1f48e2||0xcc;return function(_0xd6f8eb){if(_0xd6f8eb){return _0x1ffff3['sendStatus'](_0x1f48e2);}return _0x1ffff3[_0xc4c8('0x21')](_0x1f48e2)[_0xc4c8('0x22')]();};}function respondWithResult(_0x1f5e36,_0x22c22b){_0x22c22b=_0x22c22b||0xc8;return function(_0x39b42c){if(_0x39b42c){return _0x1f5e36[_0xc4c8('0x21')](_0x22c22b)[_0xc4c8('0x23')](_0x39b42c);}};}function respondWithFilteredResult(_0x5a5b33,_0x3d9851){return function(_0x2ca4ab){if(_0x2ca4ab){var _0x220131=_0x2ca4ab[_0xc4c8('0x24')],_0xa28304=_0x3d9851[_0xc4c8('0x25')],_0x31eb61=_0x3d9851[_0xc4c8('0x25')]+_0x3d9851[_0xc4c8('0x26')],_0x474785;if(_0x31eb61>=_0x220131){_0x31eb61=_0x220131;_0x474785=0xc8;}else{_0x474785=0xce;}_0x5a5b33[_0xc4c8('0x21')](_0x474785);return _0x5a5b33[_0xc4c8('0x27')](_0xc4c8('0x28'),_0xa28304+'-'+_0x31eb61+'/'+_0x220131)[_0xc4c8('0x23')](_0x2ca4ab);}return null;};}function patchUpdates(_0x216e22){return function(_0x22839b){try{jsonpatch[_0xc4c8('0x29')](_0x22839b,_0x216e22,!![]);}catch(_0x466f42){return BPromise[_0xc4c8('0x2a')](_0x466f42);}return _0x22839b[_0xc4c8('0x2b')]();};}function saveUpdates(_0x5067b4,_0x346ad9){return function(_0x13749e){if(_0x13749e){return _0x13749e['update'](_0x5067b4)[_0xc4c8('0x18')](function(_0xeae8d3){return _0xeae8d3;});}return null;};}function removeEntity(_0xf759f3,_0x46c17c){return function(_0xf5f7a5){if(_0xf5f7a5){return _0xf5f7a5[_0xc4c8('0x2c')]()[_0xc4c8('0x18')](function(){_0xf759f3[_0xc4c8('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5648e8,_0x288a13){return function(_0x2e1516){if(!_0x2e1516){_0x5648e8['sendStatus'](0x194);}return _0x2e1516;};}function handleError(_0x555805,_0x1cb70c){_0x1cb70c=_0x1cb70c||0x1f4;return function(_0xcb815f){logger[_0xc4c8('0x1d')](_0xcb815f[_0xc4c8('0x2d')]);if(_0xcb815f[_0xc4c8('0x2e')]){delete _0xcb815f[_0xc4c8('0x2e')];}_0x555805[_0xc4c8('0x21')](_0x1cb70c)[_0xc4c8('0x2f')](_0xcb815f);};}exports[_0xc4c8('0x30')]=function(_0x13039c,_0xcbd6d6){var _0x2fa9ab={},_0x47c363={},_0x45c7de={'count':0x0,'rows':[]};var _0x26b08a=_[_0xc4c8('0x31')](db[_0xc4c8('0x32')][_0xc4c8('0x33')],function(_0x1b6919){return{'name':_0x1b6919['fieldName'],'type':_0x1b6919['type']['key']};});_0x47c363[_0xc4c8('0x34')]=_[_0xc4c8('0x31')](_0x26b08a,_0xc4c8('0x2e'));_0x47c363[_0xc4c8('0x35')]=_['keys'](_0x13039c[_0xc4c8('0x35')]);_0x47c363[_0xc4c8('0x36')]=_[_0xc4c8('0x37')](_0x47c363[_0xc4c8('0x34')],_0x47c363['query']);_0x2fa9ab[_0xc4c8('0x38')]=_[_0xc4c8('0x37')](_0x47c363[_0xc4c8('0x34')],qs['fields'](_0x13039c[_0xc4c8('0x35')][_0xc4c8('0x39')]));_0x2fa9ab['attributes']=_0x2fa9ab[_0xc4c8('0x38')][_0xc4c8('0x3a')]?_0x2fa9ab[_0xc4c8('0x38')]:_0x47c363[_0xc4c8('0x34')];if(!_0x13039c[_0xc4c8('0x35')][_0xc4c8('0x3b')](_0xc4c8('0x3c'))){_0x2fa9ab['limit']=qs['limit'](_0x13039c[_0xc4c8('0x35')][_0xc4c8('0x26')]);_0x2fa9ab['offset']=qs[_0xc4c8('0x25')](_0x13039c[_0xc4c8('0x35')][_0xc4c8('0x25')]);}_0x2fa9ab[_0xc4c8('0x3d')]=qs[_0xc4c8('0x3e')](_0x13039c[_0xc4c8('0x35')][_0xc4c8('0x3e')]);_0x2fa9ab[_0xc4c8('0x3f')]=qs[_0xc4c8('0x36')](_[_0xc4c8('0x40')](_0x13039c[_0xc4c8('0x35')],_0x47c363['filters']),_0x26b08a);if(_0x13039c['query'][_0xc4c8('0x41')]){_0x2fa9ab[_0xc4c8('0x3f')]=_[_0xc4c8('0x42')](_0x2fa9ab[_0xc4c8('0x3f')],{'$or':_[_0xc4c8('0x31')](_0x26b08a,function(_0x1886f6){if(_0x1886f6[_0xc4c8('0x43')]!=='VIRTUAL'){var _0x5b6ff2={};_0x5b6ff2[_0x1886f6[_0xc4c8('0x2e')]]={'$like':'%'+_0x13039c[_0xc4c8('0x35')]['filter']+'%'};return _0x5b6ff2;}})});}_0x2fa9ab=_[_0xc4c8('0x42')]({},_0x2fa9ab,_0x13039c['options']);var _0x2ba25a={'where':_0x2fa9ab[_0xc4c8('0x3f')]};return db['Dynamics365Configuration'][_0xc4c8('0x24')](_0x2ba25a)[_0xc4c8('0x18')](function(_0xe6bea3){_0x45c7de[_0xc4c8('0x24')]=_0xe6bea3;if(_0x13039c['query']['includeAll']){_0x2fa9ab[_0xc4c8('0x44')]=[{'all':!![]}];}return db[_0xc4c8('0x32')][_0xc4c8('0x45')](_0x2fa9ab);})[_0xc4c8('0x18')](function(_0x284b2f){_0x45c7de[_0xc4c8('0x46')]=_0x284b2f;return _0x45c7de;})[_0xc4c8('0x18')](respondWithFilteredResult(_0xcbd6d6,_0x2fa9ab))[_0xc4c8('0x20')](handleError(_0xcbd6d6,null));};exports['show']=function(_0x1310f0,_0x17cd0c){var _0x2a986e={'raw':![],'where':{'id':_0x1310f0[_0xc4c8('0x47')]['id']}},_0x1c3afa={};_0x1c3afa[_0xc4c8('0x34')]=_[_0xc4c8('0x48')](db['Dynamics365Configuration']['rawAttributes']);_0x1c3afa[_0xc4c8('0x35')]=_['keys'](_0x1310f0[_0xc4c8('0x35')]);_0x1c3afa[_0xc4c8('0x36')]=_[_0xc4c8('0x37')](_0x1c3afa[_0xc4c8('0x34')],_0x1c3afa['query']);_0x2a986e['attributes']=_[_0xc4c8('0x37')](_0x1c3afa[_0xc4c8('0x34')],qs['fields'](_0x1310f0[_0xc4c8('0x35')][_0xc4c8('0x39')]));_0x2a986e[_0xc4c8('0x38')]=_0x2a986e[_0xc4c8('0x38')][_0xc4c8('0x3a')]?_0x2a986e[_0xc4c8('0x38')]:_0x1c3afa['model'];if(_0x1310f0[_0xc4c8('0x35')][_0xc4c8('0x49')]){_0x2a986e[_0xc4c8('0x44')]=[{'all':!![]}];}_0x2a986e=_[_0xc4c8('0x42')]({},_0x2a986e,_0x1310f0[_0xc4c8('0x4a')]);return db[_0xc4c8('0x32')]['find'](_0x2a986e)[_0xc4c8('0x18')](handleEntityNotFound(_0x17cd0c,null))[_0xc4c8('0x18')](respondWithResult(_0x17cd0c,null))[_0xc4c8('0x20')](handleError(_0x17cd0c,null));};exports[_0xc4c8('0x4b')]=function(_0x388e6c,_0x25cee6){return db[_0xc4c8('0x32')]['create'](_0x388e6c[_0xc4c8('0x4c')],{})[_0xc4c8('0x18')](respondWithResult(_0x25cee6,0xc9))['catch'](handleError(_0x25cee6,null));};exports[_0xc4c8('0x4d')]=function(_0x9fc971,_0x3ec4a1){if(_0x9fc971[_0xc4c8('0x4c')]['id']){delete _0x9fc971[_0xc4c8('0x4c')]['id'];}return db[_0xc4c8('0x32')][_0xc4c8('0x4e')]({'where':{'id':_0x9fc971['params']['id']}})[_0xc4c8('0x18')](handleEntityNotFound(_0x3ec4a1,null))[_0xc4c8('0x18')](saveUpdates(_0x9fc971[_0xc4c8('0x4c')],null))['then'](respondWithResult(_0x3ec4a1,null))[_0xc4c8('0x20')](handleError(_0x3ec4a1,null));};exports[_0xc4c8('0x2c')]=function(_0x52bb31,_0x14da25){return db[_0xc4c8('0x32')]['find']({'where':{'id':_0x52bb31[_0xc4c8('0x47')]['id']}})[_0xc4c8('0x18')](handleEntityNotFound(_0x14da25,null))['then'](removeEntity(_0x14da25,null))[_0xc4c8('0x20')](handleError(_0x14da25,null));};exports['getFields']=function(_0x2eaced,_0x4abec8,_0xd069dc){var _0x2faefd={};var _0x26cfb6={};var _0x11b40c;var _0x5acb17;return db[_0xc4c8('0x32')][_0xc4c8('0x4f')]({'where':{'id':_0x2eaced[_0xc4c8('0x47')]['id']}})['then'](handleEntityNotFound(_0x4abec8,null))['then'](function(_0x3bebb2){if(_0x3bebb2){_0x11b40c=_0x3bebb2;_0x26cfb6['model']=_[_0xc4c8('0x48')](db[_0xc4c8('0x50')]['rawAttributes']);_0x26cfb6['query']=_[_0xc4c8('0x48')](_0x2eaced[_0xc4c8('0x35')]);_0x26cfb6['filters']=_['intersection'](_0x26cfb6['model'],_0x26cfb6[_0xc4c8('0x35')]);_0x2faefd['attributes']=_[_0xc4c8('0x37')](_0x26cfb6[_0xc4c8('0x34')],qs[_0xc4c8('0x39')](_0x2eaced[_0xc4c8('0x35')]['fields']));_0x2faefd['attributes']=_0x2faefd[_0xc4c8('0x38')][_0xc4c8('0x3a')]?_0x2faefd[_0xc4c8('0x38')]:_0x26cfb6[_0xc4c8('0x34')];_0x2faefd['order']=qs['sort'](_0x2eaced[_0xc4c8('0x35')][_0xc4c8('0x3e')]);_0x2faefd[_0xc4c8('0x3f')]=qs['filters'](_[_0xc4c8('0x40')](_0x2eaced[_0xc4c8('0x35')],_0x26cfb6[_0xc4c8('0x36')]));if(_0x2eaced[_0xc4c8('0x35')][_0xc4c8('0x41')]){_0x2faefd[_0xc4c8('0x3f')]=_[_0xc4c8('0x42')](_0x2faefd[_0xc4c8('0x3f')],{'$or':_[_0xc4c8('0x31')](_0x2faefd[_0xc4c8('0x38')],function(_0x3b8271){var _0x30e0e5={};_0x30e0e5[_0x3b8271]={'$like':'%'+_0x2eaced[_0xc4c8('0x35')]['filter']+'%'};return _0x30e0e5;})});}_0x2faefd=_[_0xc4c8('0x42')]({},_0x2faefd,_0x2eaced['options']);return _0x11b40c['getFields'](_0x2faefd);}})[_0xc4c8('0x18')](function(_0x229abb){if(_0x229abb){_0x5acb17=_0x229abb[_0xc4c8('0x3a')];if(!_0x2eaced[_0xc4c8('0x35')][_0xc4c8('0x3b')](_0xc4c8('0x3c'))){_0x2faefd['limit']=qs[_0xc4c8('0x26')](_0x2eaced['query'][_0xc4c8('0x26')]);_0x2faefd[_0xc4c8('0x25')]=qs[_0xc4c8('0x25')](_0x2eaced[_0xc4c8('0x35')]['offset']);}return _0x11b40c[_0xc4c8('0x51')](_0x2faefd);}})[_0xc4c8('0x18')](function(_0x561158){if(_0x561158){return _0x561158?{'count':_0x5acb17,'rows':_0x561158}:null;}})['then'](respondWithResult(_0x4abec8,null))[_0xc4c8('0x20')](handleError(_0x4abec8,null));};exports[_0xc4c8('0x52')]=function(_0x36950a,_0x47ac8a,_0x270689){var _0x3c7e15={};var _0xf6e1ef={};var _0x1cf764;var _0x2a9a1d;return db[_0xc4c8('0x32')][_0xc4c8('0x4f')]({'where':{'id':_0x36950a[_0xc4c8('0x47')]['id']}})[_0xc4c8('0x18')](handleEntityNotFound(_0x47ac8a,null))[_0xc4c8('0x18')](function(_0x5278fb){if(_0x5278fb){_0x1cf764=_0x5278fb;_0xf6e1ef[_0xc4c8('0x34')]=_[_0xc4c8('0x48')](db[_0xc4c8('0x50')][_0xc4c8('0x33')]);_0xf6e1ef[_0xc4c8('0x35')]=_['keys'](_0x36950a[_0xc4c8('0x35')]);_0xf6e1ef[_0xc4c8('0x36')]=_[_0xc4c8('0x37')](_0xf6e1ef['model'],_0xf6e1ef[_0xc4c8('0x35')]);_0x3c7e15[_0xc4c8('0x38')]=_['intersection'](_0xf6e1ef['model'],qs[_0xc4c8('0x39')](_0x36950a['query'][_0xc4c8('0x39')]));_0x3c7e15[_0xc4c8('0x38')]=_0x3c7e15[_0xc4c8('0x38')]['length']?_0x3c7e15['attributes']:_0xf6e1ef[_0xc4c8('0x34')];_0x3c7e15[_0xc4c8('0x3d')]=qs[_0xc4c8('0x3e')](_0x36950a[_0xc4c8('0x35')][_0xc4c8('0x3e')]);_0x3c7e15[_0xc4c8('0x3f')]=qs[_0xc4c8('0x36')](_[_0xc4c8('0x40')](_0x36950a[_0xc4c8('0x35')],_0xf6e1ef[_0xc4c8('0x36')]));if(_0x36950a[_0xc4c8('0x35')]['filter']){_0x3c7e15['where']=_[_0xc4c8('0x42')](_0x3c7e15[_0xc4c8('0x3f')],{'$or':_[_0xc4c8('0x31')](_0x3c7e15[_0xc4c8('0x38')],function(_0x5e70ce){var _0x51f9b4={};_0x51f9b4[_0x5e70ce]={'$like':'%'+_0x36950a[_0xc4c8('0x35')][_0xc4c8('0x41')]+'%'};return _0x51f9b4;})});}_0x3c7e15=_[_0xc4c8('0x42')]({},_0x3c7e15,_0x36950a[_0xc4c8('0x4a')]);return _0x1cf764[_0xc4c8('0x52')](_0x3c7e15);}})[_0xc4c8('0x18')](function(_0x3e33cd){if(_0x3e33cd){_0x2a9a1d=_0x3e33cd['length'];if(!_0x36950a[_0xc4c8('0x35')][_0xc4c8('0x3b')](_0xc4c8('0x3c'))){_0x3c7e15[_0xc4c8('0x26')]=qs[_0xc4c8('0x26')](_0x36950a['query']['limit']);_0x3c7e15['offset']=qs['offset'](_0x36950a[_0xc4c8('0x35')][_0xc4c8('0x25')]);}return _0x1cf764[_0xc4c8('0x52')](_0x3c7e15);}})[_0xc4c8('0x18')](function(_0x28dfb0){if(_0x28dfb0){return _0x28dfb0?{'count':_0x2a9a1d,'rows':_0x28dfb0}:null;}})['then'](respondWithResult(_0x47ac8a,null))[_0xc4c8('0x20')](handleError(_0x47ac8a,null));};exports['getDescriptions']=function(_0x3fb7e7,_0xfbed02,_0x2fe931){var _0x1a5505={};var _0x2c9961={};var _0x27d651;var _0x3d41db;return db[_0xc4c8('0x32')][_0xc4c8('0x4f')]({'where':{'id':_0x3fb7e7[_0xc4c8('0x47')]['id']}})[_0xc4c8('0x18')](handleEntityNotFound(_0xfbed02,null))[_0xc4c8('0x18')](function(_0x3023cf){if(_0x3023cf){_0x27d651=_0x3023cf;_0x2c9961[_0xc4c8('0x34')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x2c9961[_0xc4c8('0x35')]=_[_0xc4c8('0x48')](_0x3fb7e7[_0xc4c8('0x35')]);_0x2c9961[_0xc4c8('0x36')]=_[_0xc4c8('0x37')](_0x2c9961[_0xc4c8('0x34')],_0x2c9961[_0xc4c8('0x35')]);_0x1a5505[_0xc4c8('0x38')]=_[_0xc4c8('0x37')](_0x2c9961['model'],qs['fields'](_0x3fb7e7[_0xc4c8('0x35')][_0xc4c8('0x39')]));_0x1a5505[_0xc4c8('0x38')]=_0x1a5505['attributes'][_0xc4c8('0x3a')]?_0x1a5505['attributes']:_0x2c9961[_0xc4c8('0x34')];_0x1a5505[_0xc4c8('0x3d')]=qs['sort'](_0x3fb7e7[_0xc4c8('0x35')][_0xc4c8('0x3e')]);_0x1a5505[_0xc4c8('0x3f')]=qs[_0xc4c8('0x36')](_[_0xc4c8('0x40')](_0x3fb7e7[_0xc4c8('0x35')],_0x2c9961[_0xc4c8('0x36')]));if(_0x3fb7e7['query'][_0xc4c8('0x41')]){_0x1a5505[_0xc4c8('0x3f')]=_['merge'](_0x1a5505['where'],{'$or':_[_0xc4c8('0x31')](_0x1a5505[_0xc4c8('0x38')],function(_0x387198){var _0x5e0a06={};_0x5e0a06[_0x387198]={'$like':'%'+_0x3fb7e7[_0xc4c8('0x35')][_0xc4c8('0x41')]+'%'};return _0x5e0a06;})});}_0x1a5505=_['merge']({},_0x1a5505,_0x3fb7e7[_0xc4c8('0x4a')]);return _0x27d651[_0xc4c8('0x53')](_0x1a5505);}})[_0xc4c8('0x18')](function(_0x2d36bd){if(_0x2d36bd){_0x3d41db=_0x2d36bd[_0xc4c8('0x3a')];if(!_0x3fb7e7[_0xc4c8('0x35')][_0xc4c8('0x3b')](_0xc4c8('0x3c'))){_0x1a5505[_0xc4c8('0x26')]=qs[_0xc4c8('0x26')](_0x3fb7e7['query'][_0xc4c8('0x26')]);_0x1a5505[_0xc4c8('0x25')]=qs[_0xc4c8('0x25')](_0x3fb7e7[_0xc4c8('0x35')]['offset']);}return _0x27d651[_0xc4c8('0x53')](_0x1a5505);}})[_0xc4c8('0x18')](function(_0x440e0c){if(_0x440e0c){return _0x440e0c?{'count':_0x3d41db,'rows':_0x440e0c}:null;}})[_0xc4c8('0x18')](respondWithResult(_0xfbed02,null))[_0xc4c8('0x20')](handleError(_0xfbed02,null));}; \ No newline at end of file +var _0x1e4b=['offset','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','keys','rawAttributes','include','find','create','body','update','params','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','set','apply','reject','save','destroy','end','stack','name','send','map','Dynamics365Configuration','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit'];(function(_0xfd05cf,_0x43dde5){var _0x10b644=function(_0x25a685){while(--_0x25a685){_0xfd05cf['push'](_0xfd05cf['shift']());}};_0x10b644(++_0x43dde5);}(_0x1e4b,0x115));var _0xb1e4=function(_0x22fe39,_0x22170f){_0x22fe39=_0x22fe39-0x0;var _0x3315d6=_0x1e4b[_0x22fe39];return _0x3315d6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb1e4('0x0'));var rimraf=require(_0xb1e4('0x1'));var zipdir=require(_0xb1e4('0x2'));var jsonpatch=require(_0xb1e4('0x3'));var rp=require(_0xb1e4('0x4'));var moment=require('moment');var BPromise=require(_0xb1e4('0x5'));var Mustache=require(_0xb1e4('0x6'));var util=require('util');var path=require(_0xb1e4('0x7'));var sox=require(_0xb1e4('0x8'));var csv=require(_0xb1e4('0x9'));var ejs=require(_0xb1e4('0xa'));var fs=require('fs');var _=require(_0xb1e4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb1e4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb1e4('0x9'));var querystring=require(_0xb1e4('0xd'));var Papa=require(_0xb1e4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb1e4('0xf'));var hardwareService=require(_0xb1e4('0x10'));var logger=require('../../config/logger')(_0xb1e4('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb1e4('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb1e4('0x13'));var client=jayson[_0xb1e4('0x14')][_0xb1e4('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1fcdb7,_0x14b166,_0x71f73f,_0x49811e){return new BPromise(function(_0x40c95d,_0x5a5431){var _0x53c7da=_0x49811e||client;return _0x53c7da['request'](_0x1fcdb7,_0x71f73f)[_0xb1e4('0x16')](function(_0xe5fb10){logger[_0xb1e4('0x17')](_0xb1e4('0x18'),_0x14b166,_0xb1e4('0x19'));logger[_0xb1e4('0x1a')](_0xb1e4('0x1b'),_0x14b166,_0xb1e4('0x19'),JSON['stringify'](_0xe5fb10));if(_0xe5fb10[_0xb1e4('0x1c')]){if(_0xe5fb10[_0xb1e4('0x1c')]['code']===0x1f4){logger[_0xb1e4('0x1c')](_0xb1e4('0x18'),_0x14b166,_0xe5fb10[_0xb1e4('0x1c')]['message']);return _0x5a5431(_0xe5fb10[_0xb1e4('0x1c')]['message']);}logger[_0xb1e4('0x1c')](_0xb1e4('0x18'),_0x14b166,_0xe5fb10[_0xb1e4('0x1c')]['message']);return _0x40c95d(_0xe5fb10[_0xb1e4('0x1c')][_0xb1e4('0x1d')]);}else{logger[_0xb1e4('0x17')](_0xb1e4('0x18'),_0x14b166,'request\x20sent');_0x40c95d(_0xe5fb10[_0xb1e4('0x1e')]['message']);}})[_0xb1e4('0x1f')](function(_0x238548){logger[_0xb1e4('0x1c')](_0xb1e4('0x18'),_0x14b166,_0x238548);_0x5a5431(_0x238548);});});}function respondWithStatusCode(_0x4fe064,_0x39af36){_0x39af36=_0x39af36||0xcc;return function(_0x4af4e9){if(_0x4af4e9){return _0x4fe064[_0xb1e4('0x20')](_0x39af36);}return _0x4fe064['status'](_0x39af36)['end']();};}function respondWithResult(_0x110540,_0x491a22){_0x491a22=_0x491a22||0xc8;return function(_0x160bfc){if(_0x160bfc){return _0x110540[_0xb1e4('0x21')](_0x491a22)[_0xb1e4('0x22')](_0x160bfc);}};}function respondWithFilteredResult(_0x525f05,_0x46394c){return function(_0x2273b0){if(_0x2273b0){var _0xf82d75=_0x2273b0['count'],_0x3293ad=_0x46394c['offset'],_0x5ea52c=_0x46394c['offset']+_0x46394c['limit'],_0x1c4b81;if(_0x5ea52c>=_0xf82d75){_0x5ea52c=_0xf82d75;_0x1c4b81=0xc8;}else{_0x1c4b81=0xce;}_0x525f05['status'](_0x1c4b81);return _0x525f05[_0xb1e4('0x23')]('Content-Range',_0x3293ad+'-'+_0x5ea52c+'/'+_0xf82d75)[_0xb1e4('0x22')](_0x2273b0);}return null;};}function patchUpdates(_0x3ef460){return function(_0x44ab1d){try{jsonpatch[_0xb1e4('0x24')](_0x44ab1d,_0x3ef460,!![]);}catch(_0x55fe5b){return BPromise[_0xb1e4('0x25')](_0x55fe5b);}return _0x44ab1d[_0xb1e4('0x26')]();};}function saveUpdates(_0xee9be8,_0x383f2a){return function(_0x49d2b5){if(_0x49d2b5){return _0x49d2b5['update'](_0xee9be8)[_0xb1e4('0x16')](function(_0x480e87){return _0x480e87;});}return null;};}function removeEntity(_0x1c5769,_0x4f8c4a){return function(_0x54cb03){if(_0x54cb03){return _0x54cb03[_0xb1e4('0x27')]()[_0xb1e4('0x16')](function(){_0x1c5769[_0xb1e4('0x21')](0xcc)[_0xb1e4('0x28')]();});}};}function handleEntityNotFound(_0x44bef1,_0x46343f){return function(_0x2e6964){if(!_0x2e6964){_0x44bef1[_0xb1e4('0x20')](0x194);}return _0x2e6964;};}function handleError(_0x4e4ef4,_0x431175){_0x431175=_0x431175||0x1f4;return function(_0x250761){logger['error'](_0x250761[_0xb1e4('0x29')]);if(_0x250761[_0xb1e4('0x2a')]){delete _0x250761[_0xb1e4('0x2a')];}_0x4e4ef4['status'](_0x431175)[_0xb1e4('0x2b')](_0x250761);};}exports['index']=function(_0x259aca,_0x2b0c62){var _0x3cd5a4={},_0x58e0b8={},_0x462a5e={'count':0x0,'rows':[]};var _0x477039=_[_0xb1e4('0x2c')](db[_0xb1e4('0x2d')]['rawAttributes'],function(_0x314328){return{'name':_0x314328[_0xb1e4('0x2e')],'type':_0x314328[_0xb1e4('0x2f')][_0xb1e4('0x30')]};});_0x58e0b8['model']=_[_0xb1e4('0x2c')](_0x477039,'name');_0x58e0b8[_0xb1e4('0x31')]=_['keys'](_0x259aca[_0xb1e4('0x31')]);_0x58e0b8[_0xb1e4('0x32')]=_[_0xb1e4('0x33')](_0x58e0b8['model'],_0x58e0b8[_0xb1e4('0x31')]);_0x3cd5a4[_0xb1e4('0x34')]=_[_0xb1e4('0x33')](_0x58e0b8[_0xb1e4('0x35')],qs[_0xb1e4('0x36')](_0x259aca['query']['fields']));_0x3cd5a4[_0xb1e4('0x34')]=_0x3cd5a4[_0xb1e4('0x34')][_0xb1e4('0x37')]?_0x3cd5a4[_0xb1e4('0x34')]:_0x58e0b8[_0xb1e4('0x35')];if(!_0x259aca[_0xb1e4('0x31')][_0xb1e4('0x38')](_0xb1e4('0x39'))){_0x3cd5a4[_0xb1e4('0x3a')]=qs[_0xb1e4('0x3a')](_0x259aca[_0xb1e4('0x31')]['limit']);_0x3cd5a4[_0xb1e4('0x3b')]=qs[_0xb1e4('0x3b')](_0x259aca[_0xb1e4('0x31')][_0xb1e4('0x3b')]);}_0x3cd5a4[_0xb1e4('0x3c')]=qs[_0xb1e4('0x3d')](_0x259aca[_0xb1e4('0x31')][_0xb1e4('0x3d')]);_0x3cd5a4[_0xb1e4('0x3e')]=qs[_0xb1e4('0x32')](_[_0xb1e4('0x3f')](_0x259aca['query'],_0x58e0b8[_0xb1e4('0x32')]),_0x477039);if(_0x259aca[_0xb1e4('0x31')][_0xb1e4('0x40')]){_0x3cd5a4['where']=_[_0xb1e4('0x41')](_0x3cd5a4[_0xb1e4('0x3e')],{'$or':_[_0xb1e4('0x2c')](_0x477039,function(_0x3ae484){if(_0x3ae484['type']!=='VIRTUAL'){var _0x5a6028={};_0x5a6028[_0x3ae484[_0xb1e4('0x2a')]]={'$like':'%'+_0x259aca[_0xb1e4('0x31')][_0xb1e4('0x40')]+'%'};return _0x5a6028;}})});}_0x3cd5a4=_[_0xb1e4('0x41')]({},_0x3cd5a4,_0x259aca[_0xb1e4('0x42')]);var _0x5ca408={'where':_0x3cd5a4[_0xb1e4('0x3e')]};return db[_0xb1e4('0x2d')][_0xb1e4('0x43')](_0x5ca408)[_0xb1e4('0x16')](function(_0x12aeb7){_0x462a5e['count']=_0x12aeb7;if(_0x259aca['query'][_0xb1e4('0x44')]){_0x3cd5a4['include']=[{'all':!![]}];}return db[_0xb1e4('0x2d')][_0xb1e4('0x45')](_0x3cd5a4);})['then'](function(_0x6a97bb){_0x462a5e[_0xb1e4('0x46')]=_0x6a97bb;return _0x462a5e;})[_0xb1e4('0x16')](respondWithFilteredResult(_0x2b0c62,_0x3cd5a4))['catch'](handleError(_0x2b0c62,null));};exports['show']=function(_0x350ff4,_0x427b74){var _0x3e18cf={'raw':![],'where':{'id':_0x350ff4['params']['id']}},_0x15248a={};_0x15248a['model']=_[_0xb1e4('0x47')](db[_0xb1e4('0x2d')][_0xb1e4('0x48')]);_0x15248a['query']=_[_0xb1e4('0x47')](_0x350ff4['query']);_0x15248a[_0xb1e4('0x32')]=_[_0xb1e4('0x33')](_0x15248a['model'],_0x15248a[_0xb1e4('0x31')]);_0x3e18cf['attributes']=_['intersection'](_0x15248a[_0xb1e4('0x35')],qs[_0xb1e4('0x36')](_0x350ff4[_0xb1e4('0x31')][_0xb1e4('0x36')]));_0x3e18cf[_0xb1e4('0x34')]=_0x3e18cf[_0xb1e4('0x34')][_0xb1e4('0x37')]?_0x3e18cf[_0xb1e4('0x34')]:_0x15248a['model'];if(_0x350ff4['query'][_0xb1e4('0x44')]){_0x3e18cf[_0xb1e4('0x49')]=[{'all':!![]}];}_0x3e18cf=_[_0xb1e4('0x41')]({},_0x3e18cf,_0x350ff4['options']);return db[_0xb1e4('0x2d')][_0xb1e4('0x4a')](_0x3e18cf)[_0xb1e4('0x16')](handleEntityNotFound(_0x427b74,null))[_0xb1e4('0x16')](respondWithResult(_0x427b74,null))[_0xb1e4('0x1f')](handleError(_0x427b74,null));};exports[_0xb1e4('0x4b')]=function(_0x4b25f5,_0x1e2503){return db['Dynamics365Configuration']['create'](_0x4b25f5[_0xb1e4('0x4c')],{})['then'](respondWithResult(_0x1e2503,0xc9))[_0xb1e4('0x1f')](handleError(_0x1e2503,null));};exports[_0xb1e4('0x4d')]=function(_0x33c835,_0x42dc79){if(_0x33c835['body']['id']){delete _0x33c835['body']['id'];}return db[_0xb1e4('0x2d')]['find']({'where':{'id':_0x33c835[_0xb1e4('0x4e')]['id']}})[_0xb1e4('0x16')](handleEntityNotFound(_0x42dc79,null))['then'](saveUpdates(_0x33c835['body'],null))[_0xb1e4('0x16')](respondWithResult(_0x42dc79,null))[_0xb1e4('0x1f')](handleError(_0x42dc79,null));};exports[_0xb1e4('0x27')]=function(_0x420f96,_0xf59bb6){return db[_0xb1e4('0x2d')][_0xb1e4('0x4a')]({'where':{'id':_0x420f96['params']['id']}})[_0xb1e4('0x16')](handleEntityNotFound(_0xf59bb6,null))[_0xb1e4('0x16')](removeEntity(_0xf59bb6,null))[_0xb1e4('0x1f')](handleError(_0xf59bb6,null));};exports[_0xb1e4('0x4f')]=function(_0x166421,_0x1a00a5,_0x551ac4){var _0x378b25={};var _0x4c48e8={};var _0x4064d0;var _0x3c6c8e;return db[_0xb1e4('0x2d')][_0xb1e4('0x50')]({'where':{'id':_0x166421[_0xb1e4('0x4e')]['id']}})[_0xb1e4('0x16')](handleEntityNotFound(_0x1a00a5,null))[_0xb1e4('0x16')](function(_0x91cc30){if(_0x91cc30){_0x4064d0=_0x91cc30;_0x4c48e8[_0xb1e4('0x35')]=_['keys'](db[_0xb1e4('0x51')][_0xb1e4('0x48')]);_0x4c48e8[_0xb1e4('0x31')]=_[_0xb1e4('0x47')](_0x166421[_0xb1e4('0x31')]);_0x4c48e8[_0xb1e4('0x32')]=_[_0xb1e4('0x33')](_0x4c48e8['model'],_0x4c48e8[_0xb1e4('0x31')]);_0x378b25[_0xb1e4('0x34')]=_[_0xb1e4('0x33')](_0x4c48e8[_0xb1e4('0x35')],qs[_0xb1e4('0x36')](_0x166421[_0xb1e4('0x31')][_0xb1e4('0x36')]));_0x378b25[_0xb1e4('0x34')]=_0x378b25[_0xb1e4('0x34')]['length']?_0x378b25[_0xb1e4('0x34')]:_0x4c48e8['model'];_0x378b25['order']=qs[_0xb1e4('0x3d')](_0x166421[_0xb1e4('0x31')][_0xb1e4('0x3d')]);_0x378b25[_0xb1e4('0x3e')]=qs[_0xb1e4('0x32')](_[_0xb1e4('0x3f')](_0x166421['query'],_0x4c48e8[_0xb1e4('0x32')]));if(_0x166421[_0xb1e4('0x31')][_0xb1e4('0x40')]){_0x378b25[_0xb1e4('0x3e')]=_[_0xb1e4('0x41')](_0x378b25['where'],{'$or':_[_0xb1e4('0x2c')](_0x378b25[_0xb1e4('0x34')],function(_0x56c0eb){var _0x52bb58={};_0x52bb58[_0x56c0eb]={'$like':'%'+_0x166421[_0xb1e4('0x31')][_0xb1e4('0x40')]+'%'};return _0x52bb58;})});}_0x378b25=_[_0xb1e4('0x41')]({},_0x378b25,_0x166421[_0xb1e4('0x42')]);return _0x4064d0[_0xb1e4('0x4f')](_0x378b25);}})[_0xb1e4('0x16')](function(_0x5b3816){if(_0x5b3816){_0x3c6c8e=_0x5b3816[_0xb1e4('0x37')];if(!_0x166421[_0xb1e4('0x31')][_0xb1e4('0x38')](_0xb1e4('0x39'))){_0x378b25['limit']=qs[_0xb1e4('0x3a')](_0x166421[_0xb1e4('0x31')][_0xb1e4('0x3a')]);_0x378b25[_0xb1e4('0x3b')]=qs[_0xb1e4('0x3b')](_0x166421[_0xb1e4('0x31')][_0xb1e4('0x3b')]);}return _0x4064d0['getFields'](_0x378b25);}})['then'](function(_0x3d926c){if(_0x3d926c){return _0x3d926c?{'count':_0x3c6c8e,'rows':_0x3d926c}:null;}})['then'](respondWithResult(_0x1a00a5,null))[_0xb1e4('0x1f')](handleError(_0x1a00a5,null));};exports[_0xb1e4('0x52')]=function(_0xac6683,_0x56eab3,_0x533133){var _0x9891c3={};var _0x212053={};var _0x32ad0f;var _0x13313b;return db[_0xb1e4('0x2d')][_0xb1e4('0x50')]({'where':{'id':_0xac6683[_0xb1e4('0x4e')]['id']}})[_0xb1e4('0x16')](handleEntityNotFound(_0x56eab3,null))[_0xb1e4('0x16')](function(_0x1835f9){if(_0x1835f9){_0x32ad0f=_0x1835f9;_0x212053[_0xb1e4('0x35')]=_['keys'](db[_0xb1e4('0x51')][_0xb1e4('0x48')]);_0x212053[_0xb1e4('0x31')]=_['keys'](_0xac6683[_0xb1e4('0x31')]);_0x212053[_0xb1e4('0x32')]=_[_0xb1e4('0x33')](_0x212053['model'],_0x212053[_0xb1e4('0x31')]);_0x9891c3[_0xb1e4('0x34')]=_[_0xb1e4('0x33')](_0x212053[_0xb1e4('0x35')],qs[_0xb1e4('0x36')](_0xac6683[_0xb1e4('0x31')]['fields']));_0x9891c3[_0xb1e4('0x34')]=_0x9891c3[_0xb1e4('0x34')][_0xb1e4('0x37')]?_0x9891c3[_0xb1e4('0x34')]:_0x212053[_0xb1e4('0x35')];_0x9891c3[_0xb1e4('0x3c')]=qs[_0xb1e4('0x3d')](_0xac6683[_0xb1e4('0x31')][_0xb1e4('0x3d')]);_0x9891c3[_0xb1e4('0x3e')]=qs[_0xb1e4('0x32')](_[_0xb1e4('0x3f')](_0xac6683[_0xb1e4('0x31')],_0x212053[_0xb1e4('0x32')]));if(_0xac6683[_0xb1e4('0x31')][_0xb1e4('0x40')]){_0x9891c3['where']=_[_0xb1e4('0x41')](_0x9891c3[_0xb1e4('0x3e')],{'$or':_[_0xb1e4('0x2c')](_0x9891c3['attributes'],function(_0x33ea44){var _0x382523={};_0x382523[_0x33ea44]={'$like':'%'+_0xac6683[_0xb1e4('0x31')][_0xb1e4('0x40')]+'%'};return _0x382523;})});}_0x9891c3=_[_0xb1e4('0x41')]({},_0x9891c3,_0xac6683['options']);return _0x32ad0f['getSubjects'](_0x9891c3);}})['then'](function(_0x32fc5f){if(_0x32fc5f){_0x13313b=_0x32fc5f[_0xb1e4('0x37')];if(!_0xac6683[_0xb1e4('0x31')][_0xb1e4('0x38')](_0xb1e4('0x39'))){_0x9891c3[_0xb1e4('0x3a')]=qs[_0xb1e4('0x3a')](_0xac6683[_0xb1e4('0x31')]['limit']);_0x9891c3[_0xb1e4('0x3b')]=qs[_0xb1e4('0x3b')](_0xac6683[_0xb1e4('0x31')]['offset']);}return _0x32ad0f[_0xb1e4('0x52')](_0x9891c3);}})[_0xb1e4('0x16')](function(_0x1d6d98){if(_0x1d6d98){return _0x1d6d98?{'count':_0x13313b,'rows':_0x1d6d98}:null;}})[_0xb1e4('0x16')](respondWithResult(_0x56eab3,null))[_0xb1e4('0x1f')](handleError(_0x56eab3,null));};exports[_0xb1e4('0x53')]=function(_0x1a1bb2,_0x365c08,_0x468ec9){var _0x2669d6={};var _0x2b9170={};var _0x3b19ab;var _0x44b7e4;return db['Dynamics365Configuration'][_0xb1e4('0x50')]({'where':{'id':_0x1a1bb2[_0xb1e4('0x4e')]['id']}})[_0xb1e4('0x16')](handleEntityNotFound(_0x365c08,null))[_0xb1e4('0x16')](function(_0x537a96){if(_0x537a96){_0x3b19ab=_0x537a96;_0x2b9170[_0xb1e4('0x35')]=_[_0xb1e4('0x47')](db['Dynamics365Field'][_0xb1e4('0x48')]);_0x2b9170[_0xb1e4('0x31')]=_[_0xb1e4('0x47')](_0x1a1bb2['query']);_0x2b9170[_0xb1e4('0x32')]=_[_0xb1e4('0x33')](_0x2b9170['model'],_0x2b9170[_0xb1e4('0x31')]);_0x2669d6['attributes']=_[_0xb1e4('0x33')](_0x2b9170[_0xb1e4('0x35')],qs[_0xb1e4('0x36')](_0x1a1bb2[_0xb1e4('0x31')][_0xb1e4('0x36')]));_0x2669d6[_0xb1e4('0x34')]=_0x2669d6[_0xb1e4('0x34')][_0xb1e4('0x37')]?_0x2669d6[_0xb1e4('0x34')]:_0x2b9170[_0xb1e4('0x35')];_0x2669d6[_0xb1e4('0x3c')]=qs[_0xb1e4('0x3d')](_0x1a1bb2[_0xb1e4('0x31')][_0xb1e4('0x3d')]);_0x2669d6[_0xb1e4('0x3e')]=qs[_0xb1e4('0x32')](_[_0xb1e4('0x3f')](_0x1a1bb2['query'],_0x2b9170[_0xb1e4('0x32')]));if(_0x1a1bb2[_0xb1e4('0x31')][_0xb1e4('0x40')]){_0x2669d6[_0xb1e4('0x3e')]=_['merge'](_0x2669d6[_0xb1e4('0x3e')],{'$or':_[_0xb1e4('0x2c')](_0x2669d6[_0xb1e4('0x34')],function(_0x280610){var _0x3929d2={};_0x3929d2[_0x280610]={'$like':'%'+_0x1a1bb2[_0xb1e4('0x31')][_0xb1e4('0x40')]+'%'};return _0x3929d2;})});}_0x2669d6=_['merge']({},_0x2669d6,_0x1a1bb2['options']);return _0x3b19ab[_0xb1e4('0x53')](_0x2669d6);}})[_0xb1e4('0x16')](function(_0x4611b4){if(_0x4611b4){_0x44b7e4=_0x4611b4[_0xb1e4('0x37')];if(!_0x1a1bb2[_0xb1e4('0x31')]['hasOwnProperty']('nolimit')){_0x2669d6[_0xb1e4('0x3a')]=qs[_0xb1e4('0x3a')](_0x1a1bb2[_0xb1e4('0x31')][_0xb1e4('0x3a')]);_0x2669d6[_0xb1e4('0x3b')]=qs[_0xb1e4('0x3b')](_0x1a1bb2[_0xb1e4('0x31')][_0xb1e4('0x3b')]);}return _0x3b19ab['getDescriptions'](_0x2669d6);}})[_0xb1e4('0x16')](function(_0x203c38){if(_0x203c38){return _0x203c38?{'count':_0x44b7e4,'rows':_0x203c38}:null;}})[_0xb1e4('0x16')](respondWithResult(_0x365c08,null))[_0xb1e4('0x1f')](handleError(_0x365c08,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index dc3b6ab..5eade04 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 _0xc411=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x41a804,_0xcde371){var _0x26870d=function(_0x46fb2a){while(--_0x46fb2a){_0x41a804['push'](_0x41a804['shift']());}};_0x26870d(++_0xcde371);}(_0xc411,0xca));var _0x1c41=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0xc411[_0x2132a3];return _0x21890c;};'use strict';var _=require(_0x1c41('0x0'));var util=require(_0x1c41('0x1'));var logger=require(_0x1c41('0x2'))(_0x1c41('0x3'));var moment=require(_0x1c41('0x4'));var BPromise=require(_0x1c41('0x5'));var rp=require(_0x1c41('0x6'));var fs=require('fs');var path=require(_0x1c41('0x7'));var rimraf=require(_0x1c41('0x8'));var config=require(_0x1c41('0x9'));var attributes=require(_0x1c41('0xa'));module['exports']=function(_0x404972,_0x8a65f0){return _0x404972[_0x1c41('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0x1c41('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cdc=['moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','lodash','util','../../config/logger','api'];(function(_0x532899,_0x162fbf){var _0x4e4751=function(_0x444103){while(--_0x444103){_0x532899['push'](_0x532899['shift']());}};_0x4e4751(++_0x162fbf);}(_0x1cdc,0x68));var _0xc1cd=function(_0x13df51,_0x1cc2d4){_0x13df51=_0x13df51-0x0;var _0x26f55c=_0x1cdc[_0x13df51];return _0x26f55c;};'use strict';var _=require(_0xc1cd('0x0'));var util=require(_0xc1cd('0x1'));var logger=require(_0xc1cd('0x2'))(_0xc1cd('0x3'));var moment=require(_0xc1cd('0x4'));var BPromise=require(_0xc1cd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc1cd('0x6'));var config=require(_0xc1cd('0x7'));var attributes=require(_0xc1cd('0x8'));module[_0xc1cd('0x9')]=function(_0x1be019,_0x263b42){return _0x1be019[_0xc1cd('0xa')]('Dynamics365Configuration',attributes,{'tableName':_0xc1cd('0xb'),'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 cc9ecfd..055d7ea 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 _0x1ffb=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xd547cd,_0x3ad91f){var _0x1e3cff=function(_0x313e02){while(--_0x313e02){_0xd547cd['push'](_0xd547cd['shift']());}};_0x1e3cff(++_0x3ad91f);}(_0x1ffb,0x116));var _0xb1ff=function(_0x136171,_0x5b3018){_0x136171=_0x136171-0x0;var _0x5f5a32=_0x1ffb[_0x136171];return _0x5f5a32;};'use strict';var _=require(_0xb1ff('0x0'));var util=require(_0xb1ff('0x1'));var moment=require(_0xb1ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1ff('0x3'));var fs=require('fs');var Redis=require(_0xb1ff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1ff('0x5'));var logger=require(_0xb1ff('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb1ff('0x7'));var client=jayson['client'][_0xb1ff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x331a00,_0x16e04d,_0x4693c7){return new BPromise(function(_0x123757,_0x4b51c5){return client[_0xb1ff('0x9')](_0x331a00,_0x4693c7)['then'](function(_0x41ffbf){logger[_0xb1ff('0xa')](_0xb1ff('0xb'),_0x16e04d,_0xb1ff('0xc'));logger[_0xb1ff('0xd')](_0xb1ff('0xe'),_0x16e04d,_0xb1ff('0xc'),JSON[_0xb1ff('0xf')](_0x41ffbf));if(_0x41ffbf['error']){if(_0x41ffbf[_0xb1ff('0x10')][_0xb1ff('0x11')]===0x1f4){logger[_0xb1ff('0x10')](_0xb1ff('0xb'),_0x16e04d,_0x41ffbf[_0xb1ff('0x10')][_0xb1ff('0x12')]);return _0x4b51c5(_0x41ffbf['error']['message']);}logger[_0xb1ff('0x10')](_0xb1ff('0xb'),_0x16e04d,_0x41ffbf[_0xb1ff('0x10')]['message']);return _0x123757(_0x41ffbf[_0xb1ff('0x10')][_0xb1ff('0x12')]);}else{logger[_0xb1ff('0xa')](_0xb1ff('0xb'),_0x16e04d,'request\x20sent');_0x123757(_0x41ffbf[_0xb1ff('0x13')][_0xb1ff('0x12')]);}})[_0xb1ff('0x14')](function(_0x1a25df){logger[_0xb1ff('0x10')](_0xb1ff('0xb'),_0x16e04d,_0x1a25df);_0x4b51c5(_0x1a25df);});});} \ No newline at end of file +var _0xa3e1=['error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x5b33b0,_0x4451e2){var _0x56952b=function(_0x343f54){while(--_0x343f54){_0x5b33b0['push'](_0x5b33b0['shift']());}};_0x56952b(++_0x4451e2);}(_0xa3e1,0xad));var _0x1a3e=function(_0x53c248,_0x1eaef2){_0x53c248=_0x53c248-0x0;var _0x26e604=_0xa3e1[_0x53c248];return _0x26e604;};'use strict';var _=require(_0x1a3e('0x0'));var util=require('util');var moment=require(_0x1a3e('0x1'));var BPromise=require(_0x1a3e('0x2'));var rs=require(_0x1a3e('0x3'));var fs=require('fs');var Redis=require(_0x1a3e('0x4'));var db=require(_0x1a3e('0x5'))['db'];var utils=require(_0x1a3e('0x6'));var logger=require(_0x1a3e('0x7'))(_0x1a3e('0x8'));var config=require(_0x1a3e('0x9'));var jayson=require(_0x1a3e('0xa'));var client=jayson[_0x1a3e('0xb')][_0x1a3e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xdb3a50,_0x58d2fb,_0x4d298b){return new BPromise(function(_0x3e1553,_0xb3218d){return client[_0x1a3e('0xd')](_0xdb3a50,_0x4d298b)[_0x1a3e('0xe')](function(_0xe94d69){logger[_0x1a3e('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x58d2fb,_0x1a3e('0x10'));logger[_0x1a3e('0x11')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x58d2fb,_0x1a3e('0x10'),JSON[_0x1a3e('0x12')](_0xe94d69));if(_0xe94d69[_0x1a3e('0x13')]){if(_0xe94d69[_0x1a3e('0x13')]['code']===0x1f4){logger[_0x1a3e('0x13')](_0x1a3e('0x14'),_0x58d2fb,_0xe94d69[_0x1a3e('0x13')][_0x1a3e('0x15')]);return _0xb3218d(_0xe94d69[_0x1a3e('0x13')]['message']);}logger[_0x1a3e('0x13')](_0x1a3e('0x14'),_0x58d2fb,_0xe94d69[_0x1a3e('0x13')][_0x1a3e('0x15')]);return _0x3e1553(_0xe94d69[_0x1a3e('0x13')]['message']);}else{logger[_0x1a3e('0xf')](_0x1a3e('0x14'),_0x58d2fb,'request\x20sent');_0x3e1553(_0xe94d69[_0x1a3e('0x16')][_0x1a3e('0x15')]);}})[_0x1a3e('0x17')](function(_0x5559c4){logger[_0x1a3e('0x13')](_0x1a3e('0x14'),_0x58d2fb,_0x5559c4);_0xb3218d(_0x5559c4);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 328c2bd..63c81c4 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 _0xac55=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x2b4357,_0x46dc10){var _0xa37053=function(_0x584355){while(--_0x584355){_0x2b4357['push'](_0x2b4357['shift']());}};_0xa37053(++_0x46dc10);}(_0xac55,0x1c8));var _0x5ac5=function(_0x2bfb9a,_0x3af255){_0x2bfb9a=_0x2bfb9a-0x0;var _0x39b027=_0xac55[_0x2bfb9a];return _0x39b027;};'use strict';var multer=require(_0x5ac5('0x0'));var util=require(_0x5ac5('0x1'));var path=require(_0x5ac5('0x2'));var timeout=require(_0x5ac5('0x3'));var express=require('express');var router=express[_0x5ac5('0x4')]();var auth=require(_0x5ac5('0x5'));var interaction=require(_0x5ac5('0x6'));var config=require(_0x5ac5('0x7'));var controller=require(_0x5ac5('0x8'));router[_0x5ac5('0x9')]('/',auth[_0x5ac5('0xa')](),controller['index']);router['get'](_0x5ac5('0xb'),auth[_0x5ac5('0xa')](),controller[_0x5ac5('0xc')]);router[_0x5ac5('0xd')]('/',auth[_0x5ac5('0xa')](),controller[_0x5ac5('0xe')]);router[_0x5ac5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5ac5('0x10')]);router[_0x5ac5('0x11')]('/:id',auth[_0x5ac5('0xa')](),controller[_0x5ac5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7794=['put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','/:id','show','post','isAuthenticated','create'];(function(_0x53f6e2,_0x37bfd1){var _0x515842=function(_0x2ac258){while(--_0x2ac258){_0x53f6e2['push'](_0x53f6e2['shift']());}};_0x515842(++_0x37bfd1);}(_0x7794,0x7b));var _0x4779=function(_0x53a11c,_0x393441){_0x53a11c=_0x53a11c-0x0;var _0x2680d5=_0x7794[_0x53a11c];return _0x2680d5;};'use strict';var multer=require('multer');var util=require(_0x4779('0x0'));var path=require(_0x4779('0x1'));var timeout=require(_0x4779('0x2'));var express=require(_0x4779('0x3'));var router=express['Router']();var auth=require(_0x4779('0x4'));var interaction=require(_0x4779('0x5'));var config=require('../../config/environment');var controller=require(_0x4779('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4779('0x7')](_0x4779('0x8'),auth['isAuthenticated'](),controller[_0x4779('0x9')]);router[_0x4779('0xa')]('/',auth[_0x4779('0xb')](),controller[_0x4779('0xc')]);router[_0x4779('0xd')](_0x4779('0x8'),auth[_0x4779('0xb')](),controller['update']);router[_0x4779('0xe')](_0x4779('0x8'),auth[_0x4779('0xb')](),controller[_0x4779('0xf')]);module[_0x4779('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 170e469..6f21638 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 _0x7314=['variable','customVariable','STRING','BOOLEAN','sequelize','exports','string'];(function(_0x52942e,_0x274744){var _0x2c18ba=function(_0x1cd3f1){while(--_0x1cd3f1){_0x52942e['push'](_0x52942e['shift']());}};_0x2c18ba(++_0x274744);}(_0x7314,0x100));var _0x4731=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7314[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4731('0x0'));module[_0x4731('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4731('0x2'),_0x4731('0x3'),_0x4731('0x4'),'keyValue'),'defaultValue':_0x4731('0x2')},'content':{'type':Sequelize[_0x4731('0x5')]},'key':{'type':Sequelize[_0x4731('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x4731('0x2'),_0x4731('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x4731('0x5')]},'idField':{'type':Sequelize[_0x4731('0x5')]},'nameField':{'type':Sequelize[_0x4731('0x5')]},'customField':{'type':Sequelize[_0x4731('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x272e=['variable','customVariable','keyValue','STRING','ENUM','sequelize','exports','string'];(function(_0x2925a4,_0xa37c82){var _0x150eb3=function(_0x133f64){while(--_0x133f64){_0x2925a4['push'](_0x2925a4['shift']());}};_0x150eb3(++_0xa37c82);}(_0x272e,0xb5));var _0xe272=function(_0x3e1973,_0x4f56b2){_0x3e1973=_0x3e1973-0x0;var _0x1b9e1d=_0x272e[_0x3e1973];return _0x1b9e1d;};'use strict';var Sequelize=require(_0xe272('0x0'));module[_0xe272('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe272('0x2'),_0xe272('0x3'),_0xe272('0x4'),_0xe272('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe272('0x6')]},'key':{'type':Sequelize[_0xe272('0x6')]},'keyType':{'type':Sequelize[_0xe272('0x7')](_0xe272('0x2'),_0xe272('0x3'),_0xe272('0x4'))},'keyContent':{'type':Sequelize[_0xe272('0x6')]},'idField':{'type':Sequelize[_0xe272('0x6')]},'nameField':{'type':Sequelize[_0xe272('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe272('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 711545c..76f4db8 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 _0xa8f0=['show','params','rawAttributes','length','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','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','reject','save','update','destroy','error','stack','send','type','key','name','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','options','Dynamics365Field','then','includeAll','include','catch'];(function(_0x2f32ef,_0x33e644){var _0x40a218=function(_0x49e1ff){while(--_0x49e1ff){_0x2f32ef['push'](_0x2f32ef['shift']());}};_0x40a218(++_0x33e644);}(_0xa8f0,0x123));var _0x0a8f=function(_0x1510c5,_0xde9022){_0x1510c5=_0x1510c5-0x0;var _0x433a86=_0xa8f0[_0x1510c5];return _0x433a86;};'use strict';var pdf=require(_0x0a8f('0x0'));var emlformat=require(_0x0a8f('0x1'));var rimraf=require(_0x0a8f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a8f('0x3'));var rp=require(_0x0a8f('0x4'));var moment=require(_0x0a8f('0x5'));var BPromise=require(_0x0a8f('0x6'));var Mustache=require(_0x0a8f('0x7'));var util=require(_0x0a8f('0x8'));var path=require(_0x0a8f('0x9'));var sox=require(_0x0a8f('0xa'));var csv=require(_0x0a8f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0a8f('0xc'));var squel=require('squel');var crypto=require(_0x0a8f('0xd'));var jsforce=require(_0x0a8f('0xe'));var deskjs=require(_0x0a8f('0xf'));var toCsv=require(_0x0a8f('0xb'));var querystring=require(_0x0a8f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0a8f('0x11'));var qs=require(_0x0a8f('0x12'));var as=require(_0x0a8f('0x13'));var hardwareService=require(_0x0a8f('0x14'));var logger=require(_0x0a8f('0x15'))('api');var utils=require(_0x0a8f('0x16'));var config=require(_0x0a8f('0x17'));var licenseUtil=require(_0x0a8f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ba5da,_0x197ca3){_0x197ca3=_0x197ca3||0xcc;return function(_0x323b78){if(_0x323b78){return _0x4ba5da[_0x0a8f('0x19')](_0x197ca3);}return _0x4ba5da[_0x0a8f('0x1a')](_0x197ca3)[_0x0a8f('0x1b')]();};}function respondWithResult(_0x39fcff,_0x260910){_0x260910=_0x260910||0xc8;return function(_0x180a70){if(_0x180a70){return _0x39fcff[_0x0a8f('0x1a')](_0x260910)['json'](_0x180a70);}};}function respondWithFilteredResult(_0x29c6fb,_0x195f48){return function(_0x73e614){if(_0x73e614){var _0xdcdc72=_0x73e614[_0x0a8f('0x1c')],_0x24e8c9=_0x195f48['offset'],_0xfe1492=_0x195f48[_0x0a8f('0x1d')]+_0x195f48[_0x0a8f('0x1e')],_0x445828;if(_0xfe1492>=_0xdcdc72){_0xfe1492=_0xdcdc72;_0x445828=0xc8;}else{_0x445828=0xce;}_0x29c6fb[_0x0a8f('0x1a')](_0x445828);return _0x29c6fb[_0x0a8f('0x1f')]('Content-Range',_0x24e8c9+'-'+_0xfe1492+'/'+_0xdcdc72)['json'](_0x73e614);}return null;};}function patchUpdates(_0x4e4c0a){return function(_0x582cf8){try{jsonpatch['apply'](_0x582cf8,_0x4e4c0a,!![]);}catch(_0x165b02){return BPromise[_0x0a8f('0x20')](_0x165b02);}return _0x582cf8[_0x0a8f('0x21')]();};}function saveUpdates(_0x4b23d0,_0x3a98b0){return function(_0x1d1e33){if(_0x1d1e33){return _0x1d1e33[_0x0a8f('0x22')](_0x4b23d0)['then'](function(_0x29b278){return _0x29b278;});}return null;};}function removeEntity(_0x2695e1,_0x5c530f){return function(_0x55c3d8){if(_0x55c3d8){return _0x55c3d8[_0x0a8f('0x23')]()['then'](function(){_0x2695e1[_0x0a8f('0x1a')](0xcc)[_0x0a8f('0x1b')]();});}};}function handleEntityNotFound(_0x46e786,_0x442b34){return function(_0x58f8a0){if(!_0x58f8a0){_0x46e786['sendStatus'](0x194);}return _0x58f8a0;};}function handleError(_0x3e421a,_0x150e77){_0x150e77=_0x150e77||0x1f4;return function(_0x507981){logger[_0x0a8f('0x24')](_0x507981[_0x0a8f('0x25')]);if(_0x507981['name']){delete _0x507981['name'];}_0x3e421a[_0x0a8f('0x1a')](_0x150e77)[_0x0a8f('0x26')](_0x507981);};}exports['index']=function(_0x55cf7a,_0xa6cebf){var _0x1b8b61={},_0x2f413e={},_0x202f92={'count':0x0,'rows':[]};var _0x3ae2bb=_['map'](db['Dynamics365Field']['rawAttributes'],function(_0x49f39f){return{'name':_0x49f39f['fieldName'],'type':_0x49f39f[_0x0a8f('0x27')][_0x0a8f('0x28')]};});_0x2f413e['model']=_['map'](_0x3ae2bb,_0x0a8f('0x29'));_0x2f413e[_0x0a8f('0x2a')]=_[_0x0a8f('0x2b')](_0x55cf7a[_0x0a8f('0x2a')]);_0x2f413e[_0x0a8f('0x2c')]=_[_0x0a8f('0x2d')](_0x2f413e[_0x0a8f('0x2e')],_0x2f413e[_0x0a8f('0x2a')]);_0x1b8b61['attributes']=_[_0x0a8f('0x2d')](_0x2f413e[_0x0a8f('0x2e')],qs[_0x0a8f('0x2f')](_0x55cf7a[_0x0a8f('0x2a')]['fields']));_0x1b8b61[_0x0a8f('0x30')]=_0x1b8b61['attributes']['length']?_0x1b8b61[_0x0a8f('0x30')]:_0x2f413e[_0x0a8f('0x2e')];if(!_0x55cf7a[_0x0a8f('0x2a')][_0x0a8f('0x31')](_0x0a8f('0x32'))){_0x1b8b61[_0x0a8f('0x1e')]=qs['limit'](_0x55cf7a[_0x0a8f('0x2a')][_0x0a8f('0x1e')]);_0x1b8b61[_0x0a8f('0x1d')]=qs[_0x0a8f('0x1d')](_0x55cf7a[_0x0a8f('0x2a')][_0x0a8f('0x1d')]);}_0x1b8b61['order']=qs[_0x0a8f('0x33')](_0x55cf7a['query']['sort']);_0x1b8b61['where']=qs[_0x0a8f('0x2c')](_[_0x0a8f('0x34')](_0x55cf7a[_0x0a8f('0x2a')],_0x2f413e['filters']),_0x3ae2bb);if(_0x55cf7a[_0x0a8f('0x2a')][_0x0a8f('0x35')]){_0x1b8b61[_0x0a8f('0x36')]=_[_0x0a8f('0x37')](_0x1b8b61['where'],{'$or':_[_0x0a8f('0x38')](_0x3ae2bb,function(_0x13eefd){if(_0x13eefd[_0x0a8f('0x27')]!==_0x0a8f('0x39')){var _0x3792ed={};_0x3792ed[_0x13eefd[_0x0a8f('0x29')]]={'$like':'%'+_0x55cf7a[_0x0a8f('0x2a')][_0x0a8f('0x35')]+'%'};return _0x3792ed;}})});}_0x1b8b61=_['merge']({},_0x1b8b61,_0x55cf7a[_0x0a8f('0x3a')]);var _0x1a29ca={'where':_0x1b8b61[_0x0a8f('0x36')]};return db[_0x0a8f('0x3b')][_0x0a8f('0x1c')](_0x1a29ca)[_0x0a8f('0x3c')](function(_0x5d844e){_0x202f92[_0x0a8f('0x1c')]=_0x5d844e;if(_0x55cf7a[_0x0a8f('0x2a')][_0x0a8f('0x3d')]){_0x1b8b61[_0x0a8f('0x3e')]=[{'all':!![]}];}return db[_0x0a8f('0x3b')]['findAll'](_0x1b8b61);})[_0x0a8f('0x3c')](function(_0x351241){_0x202f92['rows']=_0x351241;return _0x202f92;})[_0x0a8f('0x3c')](respondWithFilteredResult(_0xa6cebf,_0x1b8b61))[_0x0a8f('0x3f')](handleError(_0xa6cebf,null));};exports[_0x0a8f('0x40')]=function(_0x2be45c,_0x4c1cb8){var _0x1790b2={'raw':!![],'where':{'id':_0x2be45c[_0x0a8f('0x41')]['id']}},_0xfe67cb={};_0xfe67cb[_0x0a8f('0x2e')]=_[_0x0a8f('0x2b')](db[_0x0a8f('0x3b')][_0x0a8f('0x42')]);_0xfe67cb[_0x0a8f('0x2a')]=_[_0x0a8f('0x2b')](_0x2be45c[_0x0a8f('0x2a')]);_0xfe67cb[_0x0a8f('0x2c')]=_[_0x0a8f('0x2d')](_0xfe67cb[_0x0a8f('0x2e')],_0xfe67cb[_0x0a8f('0x2a')]);_0x1790b2[_0x0a8f('0x30')]=_[_0x0a8f('0x2d')](_0xfe67cb[_0x0a8f('0x2e')],qs[_0x0a8f('0x2f')](_0x2be45c[_0x0a8f('0x2a')][_0x0a8f('0x2f')]));_0x1790b2['attributes']=_0x1790b2[_0x0a8f('0x30')][_0x0a8f('0x43')]?_0x1790b2[_0x0a8f('0x30')]:_0xfe67cb[_0x0a8f('0x2e')];if(_0x2be45c[_0x0a8f('0x2a')][_0x0a8f('0x3d')]){_0x1790b2['include']=[{'all':!![]}];}_0x1790b2=_[_0x0a8f('0x37')]({},_0x1790b2,_0x2be45c[_0x0a8f('0x3a')]);return db[_0x0a8f('0x3b')][_0x0a8f('0x44')](_0x1790b2)['then'](handleEntityNotFound(_0x4c1cb8,null))['then'](respondWithResult(_0x4c1cb8,null))['catch'](handleError(_0x4c1cb8,null));};exports[_0x0a8f('0x45')]=function(_0x14ba79,_0x143829){return db['Dynamics365Field']['create'](_0x14ba79[_0x0a8f('0x46')],{})[_0x0a8f('0x3c')](respondWithResult(_0x143829,0xc9))[_0x0a8f('0x3f')](handleError(_0x143829,null));};exports['update']=function(_0x53fe2b,_0xb6e247){if(_0x53fe2b[_0x0a8f('0x46')]['id']){delete _0x53fe2b[_0x0a8f('0x46')]['id'];}return db[_0x0a8f('0x3b')]['find']({'where':{'id':_0x53fe2b['params']['id']}})[_0x0a8f('0x3c')](handleEntityNotFound(_0xb6e247,null))[_0x0a8f('0x3c')](saveUpdates(_0x53fe2b[_0x0a8f('0x46')],null))[_0x0a8f('0x3c')](respondWithResult(_0xb6e247,null))[_0x0a8f('0x3f')](handleError(_0xb6e247,null));};exports['destroy']=function(_0xc86c0a,_0x4a211c){return db[_0x0a8f('0x3b')]['find']({'where':{'id':_0xc86c0a[_0x0a8f('0x41')]['id']}})[_0x0a8f('0x3c')](handleEntityNotFound(_0x4a211c,null))[_0x0a8f('0x3c')](removeEntity(_0x4a211c,null))[_0x0a8f('0x3f')](handleError(_0x4a211c,null));}; \ No newline at end of file +var _0x83ed=['index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','sort','where','pick','filter','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','reject','save','update','then','error','stack','name','send'];(function(_0x5281d5,_0x34d0dc){var _0x10eb73=function(_0x3a2d9e){while(--_0x3a2d9e){_0x5281d5['push'](_0x5281d5['shift']());}};_0x10eb73(++_0x34d0dc);}(_0x83ed,0xb7));var _0xd83e=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x83ed[_0x20c9b2];return _0x2c6030;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd83e('0x0'));var rimraf=require(_0xd83e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd83e('0x2'));var rp=require(_0xd83e('0x3'));var moment=require(_0xd83e('0x4'));var BPromise=require(_0xd83e('0x5'));var Mustache=require(_0xd83e('0x6'));var util=require(_0xd83e('0x7'));var path=require(_0xd83e('0x8'));var sox=require('sox');var csv=require(_0xd83e('0x9'));var ejs=require(_0xd83e('0xa'));var fs=require('fs');var _=require(_0xd83e('0xb'));var squel=require(_0xd83e('0xc'));var crypto=require('crypto');var jsforce=require(_0xd83e('0xd'));var deskjs=require(_0xd83e('0xe'));var toCsv=require(_0xd83e('0x9'));var querystring=require(_0xd83e('0xf'));var Papa=require(_0xd83e('0x10'));var Redis=require(_0xd83e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd83e('0x12'));var as=require(_0xd83e('0x13'));var hardwareService=require(_0xd83e('0x14'));var logger=require(_0xd83e('0x15'))(_0xd83e('0x16'));var utils=require('../../config/utils');var config=require(_0xd83e('0x17'));var licenseUtil=require(_0xd83e('0x18'));var db=require(_0xd83e('0x19'))['db'];function respondWithStatusCode(_0x5b1979,_0x581c51){_0x581c51=_0x581c51||0xcc;return function(_0x23a62d){if(_0x23a62d){return _0x5b1979[_0xd83e('0x1a')](_0x581c51);}return _0x5b1979[_0xd83e('0x1b')](_0x581c51)[_0xd83e('0x1c')]();};}function respondWithResult(_0x55ea99,_0x153e7f){_0x153e7f=_0x153e7f||0xc8;return function(_0x7cd7ed){if(_0x7cd7ed){return _0x55ea99[_0xd83e('0x1b')](_0x153e7f)['json'](_0x7cd7ed);}};}function respondWithFilteredResult(_0x53367a,_0xd7ff84){return function(_0x2f9ab6){if(_0x2f9ab6){var _0xc6105b=_0x2f9ab6['count'],_0x5f411f=_0xd7ff84[_0xd83e('0x1d')],_0x412e8e=_0xd7ff84[_0xd83e('0x1d')]+_0xd7ff84[_0xd83e('0x1e')],_0x53a3aa;if(_0x412e8e>=_0xc6105b){_0x412e8e=_0xc6105b;_0x53a3aa=0xc8;}else{_0x53a3aa=0xce;}_0x53367a[_0xd83e('0x1b')](_0x53a3aa);return _0x53367a[_0xd83e('0x1f')]('Content-Range',_0x5f411f+'-'+_0x412e8e+'/'+_0xc6105b)[_0xd83e('0x20')](_0x2f9ab6);}return null;};}function patchUpdates(_0x4db5b4){return function(_0x141189){try{jsonpatch[_0xd83e('0x21')](_0x141189,_0x4db5b4,!![]);}catch(_0x384145){return BPromise[_0xd83e('0x22')](_0x384145);}return _0x141189[_0xd83e('0x23')]();};}function saveUpdates(_0x4b75c4,_0x5b4862){return function(_0x5d2bae){if(_0x5d2bae){return _0x5d2bae[_0xd83e('0x24')](_0x4b75c4)[_0xd83e('0x25')](function(_0x32851d){return _0x32851d;});}return null;};}function removeEntity(_0x166622,_0x20d403){return function(_0x1aa900){if(_0x1aa900){return _0x1aa900['destroy']()[_0xd83e('0x25')](function(){_0x166622['status'](0xcc)[_0xd83e('0x1c')]();});}};}function handleEntityNotFound(_0xce439,_0x144c22){return function(_0xc31c49){if(!_0xc31c49){_0xce439[_0xd83e('0x1a')](0x194);}return _0xc31c49;};}function handleError(_0x211160,_0xf2b907){_0xf2b907=_0xf2b907||0x1f4;return function(_0xe396e5){logger[_0xd83e('0x26')](_0xe396e5[_0xd83e('0x27')]);if(_0xe396e5['name']){delete _0xe396e5[_0xd83e('0x28')];}_0x211160['status'](_0xf2b907)[_0xd83e('0x29')](_0xe396e5);};}exports[_0xd83e('0x2a')]=function(_0x40b289,_0x49d60c){var _0x121ca5={},_0x1c7704={},_0x3d7e41={'count':0x0,'rows':[]};var _0x1576ac=_[_0xd83e('0x2b')](db[_0xd83e('0x2c')][_0xd83e('0x2d')],function(_0x4045c7){return{'name':_0x4045c7[_0xd83e('0x2e')],'type':_0x4045c7[_0xd83e('0x2f')][_0xd83e('0x30')]};});_0x1c7704[_0xd83e('0x31')]=_[_0xd83e('0x2b')](_0x1576ac,_0xd83e('0x28'));_0x1c7704['query']=_[_0xd83e('0x32')](_0x40b289[_0xd83e('0x33')]);_0x1c7704[_0xd83e('0x34')]=_[_0xd83e('0x35')](_0x1c7704[_0xd83e('0x31')],_0x1c7704[_0xd83e('0x33')]);_0x121ca5[_0xd83e('0x36')]=_[_0xd83e('0x35')](_0x1c7704[_0xd83e('0x31')],qs[_0xd83e('0x37')](_0x40b289['query'][_0xd83e('0x37')]));_0x121ca5[_0xd83e('0x36')]=_0x121ca5[_0xd83e('0x36')]['length']?_0x121ca5['attributes']:_0x1c7704[_0xd83e('0x31')];if(!_0x40b289[_0xd83e('0x33')]['hasOwnProperty']('nolimit')){_0x121ca5[_0xd83e('0x1e')]=qs[_0xd83e('0x1e')](_0x40b289[_0xd83e('0x33')][_0xd83e('0x1e')]);_0x121ca5[_0xd83e('0x1d')]=qs[_0xd83e('0x1d')](_0x40b289['query'][_0xd83e('0x1d')]);}_0x121ca5['order']=qs[_0xd83e('0x38')](_0x40b289[_0xd83e('0x33')][_0xd83e('0x38')]);_0x121ca5[_0xd83e('0x39')]=qs[_0xd83e('0x34')](_[_0xd83e('0x3a')](_0x40b289[_0xd83e('0x33')],_0x1c7704[_0xd83e('0x34')]),_0x1576ac);if(_0x40b289[_0xd83e('0x33')][_0xd83e('0x3b')]){_0x121ca5[_0xd83e('0x39')]=_['merge'](_0x121ca5[_0xd83e('0x39')],{'$or':_['map'](_0x1576ac,function(_0x4fc1ee){if(_0x4fc1ee[_0xd83e('0x2f')]!==_0xd83e('0x3c')){var _0x4182bc={};_0x4182bc[_0x4fc1ee['name']]={'$like':'%'+_0x40b289['query'][_0xd83e('0x3b')]+'%'};return _0x4182bc;}})});}_0x121ca5=_['merge']({},_0x121ca5,_0x40b289['options']);var _0x5b3ad1={'where':_0x121ca5[_0xd83e('0x39')]};return db[_0xd83e('0x2c')][_0xd83e('0x3d')](_0x5b3ad1)[_0xd83e('0x25')](function(_0x1e5cec){_0x3d7e41[_0xd83e('0x3d')]=_0x1e5cec;if(_0x40b289[_0xd83e('0x33')][_0xd83e('0x3e')]){_0x121ca5[_0xd83e('0x3f')]=[{'all':!![]}];}return db['Dynamics365Field'][_0xd83e('0x40')](_0x121ca5);})[_0xd83e('0x25')](function(_0x205adf){_0x3d7e41[_0xd83e('0x41')]=_0x205adf;return _0x3d7e41;})[_0xd83e('0x25')](respondWithFilteredResult(_0x49d60c,_0x121ca5))[_0xd83e('0x42')](handleError(_0x49d60c,null));};exports[_0xd83e('0x43')]=function(_0x2e9190,_0x353356){var _0x203965={'raw':!![],'where':{'id':_0x2e9190[_0xd83e('0x44')]['id']}},_0x26b02e={};_0x26b02e[_0xd83e('0x31')]=_[_0xd83e('0x32')](db[_0xd83e('0x2c')]['rawAttributes']);_0x26b02e['query']=_[_0xd83e('0x32')](_0x2e9190[_0xd83e('0x33')]);_0x26b02e['filters']=_['intersection'](_0x26b02e[_0xd83e('0x31')],_0x26b02e[_0xd83e('0x33')]);_0x203965['attributes']=_[_0xd83e('0x35')](_0x26b02e['model'],qs[_0xd83e('0x37')](_0x2e9190[_0xd83e('0x33')]['fields']));_0x203965[_0xd83e('0x36')]=_0x203965[_0xd83e('0x36')][_0xd83e('0x45')]?_0x203965[_0xd83e('0x36')]:_0x26b02e['model'];if(_0x2e9190[_0xd83e('0x33')]['includeAll']){_0x203965['include']=[{'all':!![]}];}_0x203965=_['merge']({},_0x203965,_0x2e9190[_0xd83e('0x46')]);return db['Dynamics365Field']['find'](_0x203965)[_0xd83e('0x25')](handleEntityNotFound(_0x353356,null))[_0xd83e('0x25')](respondWithResult(_0x353356,null))[_0xd83e('0x42')](handleError(_0x353356,null));};exports[_0xd83e('0x47')]=function(_0x5cbcc3,_0x3d87b3){return db[_0xd83e('0x2c')][_0xd83e('0x47')](_0x5cbcc3[_0xd83e('0x48')],{})[_0xd83e('0x25')](respondWithResult(_0x3d87b3,0xc9))[_0xd83e('0x42')](handleError(_0x3d87b3,null));};exports[_0xd83e('0x24')]=function(_0x5d85e8,_0x113b23){if(_0x5d85e8[_0xd83e('0x48')]['id']){delete _0x5d85e8[_0xd83e('0x48')]['id'];}return db[_0xd83e('0x2c')][_0xd83e('0x49')]({'where':{'id':_0x5d85e8[_0xd83e('0x44')]['id']}})[_0xd83e('0x25')](handleEntityNotFound(_0x113b23,null))['then'](saveUpdates(_0x5d85e8[_0xd83e('0x48')],null))[_0xd83e('0x25')](respondWithResult(_0x113b23,null))[_0xd83e('0x42')](handleError(_0x113b23,null));};exports[_0xd83e('0x4a')]=function(_0x3036b6,_0x2d2661){return db[_0xd83e('0x2c')]['find']({'where':{'id':_0x3036b6[_0xd83e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2d2661,null))[_0xd83e('0x25')](removeEntity(_0x2d2661,null))[_0xd83e('0x42')](handleError(_0x2d2661,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index b37108e..fd9ce6b 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 _0x9aed=['idField','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x9aed,0x79));var _0xd9ae=function(_0x484ed3,_0xe74b3e){_0x484ed3=_0x484ed3-0x0;var _0x4c6a7a=_0x9aed[_0x484ed3];return _0x4c6a7a;};'use strict';var _=require(_0xd9ae('0x0'));var util=require(_0xd9ae('0x1'));var logger=require('../../config/logger')(_0xd9ae('0x2'));var moment=require(_0xd9ae('0x3'));var BPromise=require('bluebird');var rp=require(_0xd9ae('0x4'));var fs=require('fs');var path=require(_0xd9ae('0x5'));var rimraf=require(_0xd9ae('0x6'));var config=require(_0xd9ae('0x7'));var attributes=require(_0xd9ae('0x8'));module['exports']=function(_0x18746d,_0x29abe5){return _0x18746d[_0xd9ae('0x9')](_0xd9ae('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xd9ae('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x96d2=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','idField','lodash','util','../../config/logger','api','moment'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0x96d2,0x1cc));var _0x296d=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0x96d2[_0x20cf8a];return _0x54e165;};'use strict';var _=require(_0x296d('0x0'));var util=require(_0x296d('0x1'));var logger=require(_0x296d('0x2'))(_0x296d('0x3'));var moment=require(_0x296d('0x4'));var BPromise=require(_0x296d('0x5'));var rp=require(_0x296d('0x6'));var fs=require('fs');var path=require(_0x296d('0x7'));var rimraf=require(_0x296d('0x8'));var config=require(_0x296d('0x9'));var attributes=require('./intDynamics365Field.attributes');module[_0x296d('0xa')]=function(_0x55a109,_0x3f9226){return _0x55a109[_0x296d('0xb')](_0x296d('0xc'),attributes,{'tableName':_0x296d('0xd'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x296d('0xe'),'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 ec01412..ee1e47e 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 _0xfd2e=['error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xfd2e,0x6e));var _0xefd2=function(_0x5f0644,_0x217385){_0x5f0644=_0x5f0644-0x0;var _0x29e6eb=_0xfd2e[_0x5f0644];return _0x29e6eb;};'use strict';var _=require(_0xefd2('0x0'));var util=require('util');var moment=require(_0xefd2('0x1'));var BPromise=require('bluebird');var rs=require(_0xefd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefd2('0x3'))['db'];var utils=require(_0xefd2('0x4'));var logger=require(_0xefd2('0x5'))(_0xefd2('0x6'));var config=require(_0xefd2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xefd2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x516aab,_0x51fab0,_0x43d90b){return new BPromise(function(_0x50dd63,_0x440d11){return client[_0xefd2('0x9')](_0x516aab,_0x43d90b)[_0xefd2('0xa')](function(_0xded765){logger[_0xefd2('0xb')](_0xefd2('0xc'),_0x51fab0,_0xefd2('0xd'));logger['debug'](_0xefd2('0xe'),_0x51fab0,_0xefd2('0xd'),JSON[_0xefd2('0xf')](_0xded765));if(_0xded765[_0xefd2('0x10')]){if(_0xded765[_0xefd2('0x10')][_0xefd2('0x11')]===0x1f4){logger[_0xefd2('0x10')](_0xefd2('0xc'),_0x51fab0,_0xded765['error']['message']);return _0x440d11(_0xded765[_0xefd2('0x10')]['message']);}logger['error'](_0xefd2('0xc'),_0x51fab0,_0xded765[_0xefd2('0x10')][_0xefd2('0x12')]);return _0x50dd63(_0xded765[_0xefd2('0x10')][_0xefd2('0x12')]);}else{logger['info'](_0xefd2('0xc'),_0x51fab0,_0xefd2('0xd'));_0x50dd63(_0xded765[_0xefd2('0x13')][_0xefd2('0x12')]);}})[_0xefd2('0x14')](function(_0x471e3b){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x51fab0,_0x471e3b);_0x440d11(_0x471e3b);});});} \ No newline at end of file +var _0x8af6=['Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info'];(function(_0x4b530f,_0x44bad1){var _0x2b5dbf=function(_0xef64b){while(--_0xef64b){_0x4b530f['push'](_0x4b530f['shift']());}};_0x2b5dbf(++_0x44bad1);}(_0x8af6,0x76));var _0x68af=function(_0x3e2189,_0x3ae4bb){_0x3e2189=_0x3e2189-0x0;var _0xb20dcd=_0x8af6[_0x3e2189];return _0xb20dcd;};'use strict';var _=require(_0x68af('0x0'));var util=require(_0x68af('0x1'));var moment=require(_0x68af('0x2'));var BPromise=require(_0x68af('0x3'));var rs=require(_0x68af('0x4'));var fs=require('fs');var Redis=require(_0x68af('0x5'));var db=require(_0x68af('0x6'))['db'];var utils=require(_0x68af('0x7'));var logger=require(_0x68af('0x8'))(_0x68af('0x9'));var config=require('../../config/environment');var jayson=require(_0x68af('0xa'));var client=jayson['client'][_0x68af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2be0c1,_0x89146f,_0x1e77b0){return new BPromise(function(_0x3c6018,_0x20d61c){return client[_0x68af('0xc')](_0x2be0c1,_0x1e77b0)['then'](function(_0x56bc37){logger[_0x68af('0xd')](_0x68af('0xe'),_0x89146f,'request\x20sent');logger[_0x68af('0xf')](_0x68af('0x10'),_0x89146f,_0x68af('0x11'),JSON[_0x68af('0x12')](_0x56bc37));if(_0x56bc37[_0x68af('0x13')]){if(_0x56bc37[_0x68af('0x13')]['code']===0x1f4){logger['error'](_0x68af('0xe'),_0x89146f,_0x56bc37['error']['message']);return _0x20d61c(_0x56bc37[_0x68af('0x13')][_0x68af('0x14')]);}logger[_0x68af('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x89146f,_0x56bc37[_0x68af('0x13')]['message']);return _0x3c6018(_0x56bc37[_0x68af('0x13')][_0x68af('0x14')]);}else{logger[_0x68af('0xd')](_0x68af('0xe'),_0x89146f,_0x68af('0x11'));_0x3c6018(_0x56bc37['result'][_0x68af('0x14')]);}})[_0x68af('0x15')](function(_0x326b12){logger[_0x68af('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x89146f,_0x326b12);_0x20d61c(_0x326b12);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index d5f3a2c..310aa3d 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 _0x44a9=['update','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','post','create','/:id/configurations','put'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0x44a9,0x1dc));var _0x944a=function(_0x458ce4,_0x260c18){_0x458ce4=_0x458ce4-0x0;var _0x500527=_0x44a9[_0x458ce4];return _0x500527;};'use strict';var multer=require(_0x944a('0x0'));var util=require('util');var path=require(_0x944a('0x1'));var timeout=require(_0x944a('0x2'));var express=require('express');var router=express[_0x944a('0x3')]();var auth=require(_0x944a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x944a('0x5'));var controller=require(_0x944a('0x6'));router['get']('/',auth[_0x944a('0x7')](),controller[_0x944a('0x8')]);router[_0x944a('0x9')](_0x944a('0xa'),auth[_0x944a('0x7')](),controller[_0x944a('0xb')]);router[_0x944a('0x9')]('/:id/configurations',auth[_0x944a('0x7')](),controller[_0x944a('0xc')]);router[_0x944a('0x9')](_0x944a('0xd'),auth[_0x944a('0x7')](),controller['getFields']);router[_0x944a('0xe')]('/',auth[_0x944a('0x7')](),controller[_0x944a('0xf')]);router[_0x944a('0xe')](_0x944a('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x944a('0x11')](_0x944a('0xa'),auth[_0x944a('0x7')](),controller[_0x944a('0x12')]);router['delete'](_0x944a('0xa'),auth[_0x944a('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd42b=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update'];(function(_0x2acc3d,_0xb4c944){var _0x23d7a7=function(_0x37de78){while(--_0x37de78){_0x2acc3d['push'](_0x2acc3d['shift']());}};_0x23d7a7(++_0xb4c944);}(_0xd42b,0xca));var _0xbd42=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0xd42b[_0x3a6e4b];return _0x36572d;};'use strict';var multer=require(_0xbd42('0x0'));var util=require(_0xbd42('0x1'));var path=require(_0xbd42('0x2'));var timeout=require(_0xbd42('0x3'));var express=require(_0xbd42('0x4'));var router=express[_0xbd42('0x5')]();var auth=require(_0xbd42('0x6'));var interaction=require(_0xbd42('0x7'));var config=require(_0xbd42('0x8'));var controller=require(_0xbd42('0x9'));router[_0xbd42('0xa')]('/',auth[_0xbd42('0xb')](),controller[_0xbd42('0xc')]);router[_0xbd42('0xa')](_0xbd42('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xbd42('0xa')](_0xbd42('0xe'),auth['isAuthenticated'](),controller[_0xbd42('0xf')]);router[_0xbd42('0xa')](_0xbd42('0x10'),auth[_0xbd42('0xb')](),controller[_0xbd42('0x11')]);router['post']('/',auth[_0xbd42('0xb')](),controller[_0xbd42('0x12')]);router[_0xbd42('0x13')](_0xbd42('0xe'),auth[_0xbd42('0xb')](),controller[_0xbd42('0x14')]);router[_0xbd42('0x15')]('/:id',auth[_0xbd42('0xb')](),controller[_0xbd42('0x16')]);router[_0xbd42('0x17')](_0xbd42('0xd'),auth[_0xbd42('0xb')](),controller[_0xbd42('0x18')]);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 626c7e9..f398370 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 _0x73b9=['remoteUri','sequelize','exports','STRING','username'];(function(_0x126a77,_0x253795){var _0x4a73ea=function(_0x1cec18){while(--_0x1cec18){_0x126a77['push'](_0x126a77['shift']());}};_0x4a73ea(++_0x253795);}(_0x73b9,0xc4));var _0x973b=function(_0x2835ae,_0x112c51){_0x2835ae=_0x2835ae-0x0;var _0x47d350=_0x73b9[_0x2835ae];return _0x47d350;};'use strict';var Sequelize=require(_0x973b('0x0'));module[_0x973b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x973b('0x2')]},'username':{'type':Sequelize[_0x973b('0x2')],'unique':_0x973b('0x3')},'apiKey':{'type':Sequelize[_0x973b('0x2')]},'remoteUri':{'type':Sequelize[_0x973b('0x2')],'unique':_0x973b('0x4')},'serverUrl':{'type':Sequelize[_0x973b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xc5ff=['STRING','username','remoteUri','sequelize'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xc5ff,0x15f));var _0xfc5f=function(_0x3caed2,_0xe9ae23){_0x3caed2=_0x3caed2-0x0;var _0x3c3e6c=_0xc5ff[_0x3caed2];return _0x3c3e6c;};'use strict';var Sequelize=require(_0xfc5f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfc5f('0x1')]},'username':{'type':Sequelize[_0xfc5f('0x1')],'unique':_0xfc5f('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfc5f('0x1')],'unique':_0xfc5f('0x3')},'serverUrl':{'type':Sequelize[_0xfc5f('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index d7a1518..3f20c8f 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 _0x78a0=['FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','map','VIRTUAL','filter','merge','options','findAll','rows','show','params','include','find','catch','create','body','findOne','FreshdeskConfiguration','pick','getConfigurations','addConfiguration','AccountId','channel','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','%s/%s','format','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','ticket_type','group','company','remove','default','custom_dropdown','choices','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','request','then','info'];(function(_0x5222e9,_0x146f5a){var _0x3e4bfc=function(_0x5d03d3){while(--_0x5d03d3){_0x5222e9['push'](_0x5222e9['shift']());}};_0x3e4bfc(++_0x146f5a);}(_0x78a0,0x1d1));var _0x078a=function(_0x3e9b06,_0x417393){_0x3e9b06=_0x3e9b06-0x0;var _0x442af8=_0x78a0[_0x3e9b06];return _0x442af8;};'use strict';var pdf=require(_0x078a('0x0'));var emlformat=require(_0x078a('0x1'));var rimraf=require(_0x078a('0x2'));var zipdir=require(_0x078a('0x3'));var jsonpatch=require(_0x078a('0x4'));var rp=require(_0x078a('0x5'));var moment=require(_0x078a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x078a('0x7'));var util=require(_0x078a('0x8'));var path=require('path');var sox=require(_0x078a('0x9'));var csv=require(_0x078a('0xa'));var ejs=require(_0x078a('0xb'));var fs=require('fs');var _=require(_0x078a('0xc'));var squel=require(_0x078a('0xd'));var crypto=require(_0x078a('0xe'));var jsforce=require(_0x078a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x078a('0xa'));var querystring=require(_0x078a('0x10'));var Papa=require(_0x078a('0x11'));var Redis=require(_0x078a('0x12'));var authService=require(_0x078a('0x13'));var qs=require(_0x078a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x078a('0x15'));var logger=require(_0x078a('0x16'))(_0x078a('0x17'));var utils=require('../../config/utils');var config=require(_0x078a('0x18'));var licenseUtil=require(_0x078a('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x078a('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0x078a('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x268e3d,_0xbfdf8d,_0x3a8df3,_0xeeab60){return new BPromise(function(_0x4f9a93,_0x1f6007){var _0x3b83fc=_0xeeab60||client;return _0x3b83fc[_0x078a('0x1c')](_0x268e3d,_0x3a8df3)[_0x078a('0x1d')](function(_0x468ec8){logger[_0x078a('0x1e')](_0x078a('0x1f'),_0xbfdf8d,_0x078a('0x20'));logger[_0x078a('0x21')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xbfdf8d,_0x078a('0x20'),JSON[_0x078a('0x22')](_0x468ec8));if(_0x468ec8[_0x078a('0x23')]){if(_0x468ec8[_0x078a('0x23')][_0x078a('0x24')]===0x1f4){logger[_0x078a('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0xbfdf8d,_0x468ec8['error'][_0x078a('0x25')]);return _0x1f6007(_0x468ec8[_0x078a('0x23')][_0x078a('0x25')]);}logger[_0x078a('0x23')](_0x078a('0x1f'),_0xbfdf8d,_0x468ec8[_0x078a('0x23')][_0x078a('0x25')]);return _0x4f9a93(_0x468ec8[_0x078a('0x23')][_0x078a('0x25')]);}else{logger['info'](_0x078a('0x1f'),_0xbfdf8d,_0x078a('0x20'));_0x4f9a93(_0x468ec8[_0x078a('0x26')][_0x078a('0x25')]);}})['catch'](function(_0x2899a8){logger[_0x078a('0x23')](_0x078a('0x1f'),_0xbfdf8d,_0x2899a8);_0x1f6007(_0x2899a8);});});}function respondWithStatusCode(_0x2bb024,_0x548db3){_0x548db3=_0x548db3||0xcc;return function(_0x1330bb){if(_0x1330bb){return _0x2bb024[_0x078a('0x27')](_0x548db3);}return _0x2bb024['status'](_0x548db3)[_0x078a('0x28')]();};}function respondWithResult(_0x16f45a,_0x2618dd){_0x2618dd=_0x2618dd||0xc8;return function(_0x340195){if(_0x340195){return _0x16f45a[_0x078a('0x29')](_0x2618dd)['json'](_0x340195);}};}function respondWithFilteredResult(_0x4007be,_0x419449){return function(_0xf9398c){if(_0xf9398c){var _0x45519b=_0xf9398c[_0x078a('0x2a')],_0xbdef6b=_0x419449[_0x078a('0x2b')],_0x48fab1=_0x419449[_0x078a('0x2b')]+_0x419449[_0x078a('0x2c')],_0x28b372;if(_0x48fab1>=_0x45519b){_0x48fab1=_0x45519b;_0x28b372=0xc8;}else{_0x28b372=0xce;}_0x4007be[_0x078a('0x29')](_0x28b372);return _0x4007be[_0x078a('0x2d')](_0x078a('0x2e'),_0xbdef6b+'-'+_0x48fab1+'/'+_0x45519b)['json'](_0xf9398c);}return null;};}function patchUpdates(_0x1b7c03){return function(_0x287ce9){try{jsonpatch[_0x078a('0x2f')](_0x287ce9,_0x1b7c03,!![]);}catch(_0x404ba5){return BPromise[_0x078a('0x30')](_0x404ba5);}return _0x287ce9[_0x078a('0x31')]();};}function saveUpdates(_0x846518,_0x4b7adc){return function(_0x43aa03){if(_0x43aa03){return _0x43aa03[_0x078a('0x32')](_0x846518)['then'](function(_0x469815){return _0x469815;});}return null;};}function removeEntity(_0x540ee4,_0xb96219){return function(_0x1244b5){if(_0x1244b5){return _0x1244b5[_0x078a('0x33')]()['then'](function(){_0x540ee4[_0x078a('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41442a,_0x58172c){return function(_0x3fca75){if(!_0x3fca75){_0x41442a[_0x078a('0x27')](0x194);}return _0x3fca75;};}function handleError(_0x23ff8c,_0x174553){_0x174553=_0x174553||0x1f4;return function(_0x4ceac8){logger[_0x078a('0x23')](_0x4ceac8[_0x078a('0x34')]);if(_0x4ceac8[_0x078a('0x35')]){delete _0x4ceac8[_0x078a('0x35')];}_0x23ff8c[_0x078a('0x29')](_0x174553)['send'](_0x4ceac8);};}exports[_0x078a('0x36')]=function(_0x2ec592,_0x421dc7){var _0x30c68a={},_0x463e3c={},_0x17970b={'count':0x0,'rows':[]};var _0x46efab=_['map'](db[_0x078a('0x37')][_0x078a('0x38')],function(_0x2b2e5f){return{'name':_0x2b2e5f[_0x078a('0x39')],'type':_0x2b2e5f[_0x078a('0x3a')][_0x078a('0x3b')]};});_0x463e3c[_0x078a('0x3c')]=_['map'](_0x46efab,_0x078a('0x35'));_0x463e3c[_0x078a('0x3d')]=_[_0x078a('0x3e')](_0x2ec592[_0x078a('0x3d')]);_0x463e3c[_0x078a('0x3f')]=_['intersection'](_0x463e3c[_0x078a('0x3c')],_0x463e3c['query']);_0x30c68a[_0x078a('0x40')]=_[_0x078a('0x41')](_0x463e3c[_0x078a('0x3c')],qs[_0x078a('0x42')](_0x2ec592[_0x078a('0x3d')][_0x078a('0x42')]));_0x30c68a[_0x078a('0x40')]=_0x30c68a[_0x078a('0x40')][_0x078a('0x43')]?_0x30c68a[_0x078a('0x40')]:_0x463e3c[_0x078a('0x3c')];if(!_0x2ec592['query'][_0x078a('0x44')](_0x078a('0x45'))){_0x30c68a[_0x078a('0x2c')]=qs['limit'](_0x2ec592[_0x078a('0x3d')][_0x078a('0x2c')]);_0x30c68a[_0x078a('0x2b')]=qs[_0x078a('0x2b')](_0x2ec592[_0x078a('0x3d')][_0x078a('0x2b')]);}_0x30c68a[_0x078a('0x46')]=qs[_0x078a('0x47')](_0x2ec592[_0x078a('0x3d')][_0x078a('0x47')]);_0x30c68a[_0x078a('0x48')]=qs[_0x078a('0x3f')](_['pick'](_0x2ec592['query'],_0x463e3c[_0x078a('0x3f')]),_0x46efab);if(_0x2ec592[_0x078a('0x3d')]['filter']){_0x30c68a['where']=_['merge'](_0x30c68a[_0x078a('0x48')],{'$or':_[_0x078a('0x49')](_0x46efab,function(_0x2b4964){if(_0x2b4964[_0x078a('0x3a')]!==_0x078a('0x4a')){var _0x26e63b={};_0x26e63b[_0x2b4964[_0x078a('0x35')]]={'$like':'%'+_0x2ec592[_0x078a('0x3d')][_0x078a('0x4b')]+'%'};return _0x26e63b;}})});}_0x30c68a=_[_0x078a('0x4c')]({},_0x30c68a,_0x2ec592[_0x078a('0x4d')]);var _0x29d471={'where':_0x30c68a[_0x078a('0x48')]};return db[_0x078a('0x37')][_0x078a('0x2a')](_0x29d471)[_0x078a('0x1d')](function(_0x3ae446){_0x17970b[_0x078a('0x2a')]=_0x3ae446;if(_0x2ec592[_0x078a('0x3d')]['includeAll']){_0x30c68a['include']=[{'all':!![]}];}return db[_0x078a('0x37')][_0x078a('0x4e')](_0x30c68a);})['then'](function(_0xa56a6e){_0x17970b[_0x078a('0x4f')]=_0xa56a6e;return _0x17970b;})['then'](respondWithFilteredResult(_0x421dc7,_0x30c68a))['catch'](handleError(_0x421dc7,null));};exports[_0x078a('0x50')]=function(_0x555aa1,_0x223d5e){var _0x48ad86={'raw':![],'where':{'id':_0x555aa1[_0x078a('0x51')]['id']}},_0x36e871={};_0x36e871['model']=_[_0x078a('0x3e')](db[_0x078a('0x37')]['rawAttributes']);_0x36e871['query']=_['keys'](_0x555aa1[_0x078a('0x3d')]);_0x36e871[_0x078a('0x3f')]=_[_0x078a('0x41')](_0x36e871[_0x078a('0x3c')],_0x36e871[_0x078a('0x3d')]);_0x48ad86[_0x078a('0x40')]=_[_0x078a('0x41')](_0x36e871[_0x078a('0x3c')],qs[_0x078a('0x42')](_0x555aa1[_0x078a('0x3d')][_0x078a('0x42')]));_0x48ad86['attributes']=_0x48ad86[_0x078a('0x40')][_0x078a('0x43')]?_0x48ad86[_0x078a('0x40')]:_0x36e871[_0x078a('0x3c')];if(_0x555aa1[_0x078a('0x3d')]['includeAll']){_0x48ad86[_0x078a('0x52')]=[{'all':!![]}];}_0x48ad86=_['merge']({},_0x48ad86,_0x555aa1[_0x078a('0x4d')]);return db[_0x078a('0x37')][_0x078a('0x53')](_0x48ad86)[_0x078a('0x1d')](handleEntityNotFound(_0x223d5e,null))['then'](respondWithResult(_0x223d5e,null))[_0x078a('0x54')](handleError(_0x223d5e,null));};exports[_0x078a('0x55')]=function(_0x49de7a,_0x1da1e2){return db[_0x078a('0x37')][_0x078a('0x55')](_0x49de7a['body'],{})['then'](respondWithResult(_0x1da1e2,0xc9))[_0x078a('0x54')](handleError(_0x1da1e2,null));};exports['update']=function(_0x5e852d,_0x5e0a6c){if(_0x5e852d[_0x078a('0x56')]['id']){delete _0x5e852d[_0x078a('0x56')]['id'];}return db[_0x078a('0x37')][_0x078a('0x53')]({'where':{'id':_0x5e852d[_0x078a('0x51')]['id']}})[_0x078a('0x1d')](handleEntityNotFound(_0x5e0a6c,null))[_0x078a('0x1d')](saveUpdates(_0x5e852d[_0x078a('0x56')],null))[_0x078a('0x1d')](respondWithResult(_0x5e0a6c,null))['catch'](handleError(_0x5e0a6c,null));};exports[_0x078a('0x33')]=function(_0x412301,_0x1791e8){return db[_0x078a('0x37')][_0x078a('0x53')]({'where':{'id':_0x412301['params']['id']}})[_0x078a('0x1d')](handleEntityNotFound(_0x1791e8,null))[_0x078a('0x1d')](removeEntity(_0x1791e8,null))[_0x078a('0x54')](handleError(_0x1791e8,null));};exports['getConfigurations']=function(_0x4d206a,_0x27f04c,_0x3a7d0f){var _0x77584={};var _0x19a9e2={};var _0xb05ea7;var _0x5a7a37;return db[_0x078a('0x37')][_0x078a('0x57')]({'where':{'id':_0x4d206a[_0x078a('0x51')]['id']}})[_0x078a('0x1d')](handleEntityNotFound(_0x27f04c,null))[_0x078a('0x1d')](function(_0x404eab){if(_0x404eab){_0xb05ea7=_0x404eab;_0x19a9e2[_0x078a('0x3c')]=_[_0x078a('0x3e')](db[_0x078a('0x58')]['rawAttributes']);_0x19a9e2[_0x078a('0x3d')]=_[_0x078a('0x3e')](_0x4d206a[_0x078a('0x3d')]);_0x19a9e2['filters']=_[_0x078a('0x41')](_0x19a9e2[_0x078a('0x3c')],_0x19a9e2['query']);_0x77584['attributes']=_[_0x078a('0x41')](_0x19a9e2[_0x078a('0x3c')],qs['fields'](_0x4d206a[_0x078a('0x3d')][_0x078a('0x42')]));_0x77584[_0x078a('0x40')]=_0x77584['attributes'][_0x078a('0x43')]?_0x77584[_0x078a('0x40')]:_0x19a9e2[_0x078a('0x3c')];_0x77584[_0x078a('0x46')]=qs['sort'](_0x4d206a[_0x078a('0x3d')][_0x078a('0x47')]);_0x77584[_0x078a('0x48')]=qs[_0x078a('0x3f')](_[_0x078a('0x59')](_0x4d206a[_0x078a('0x3d')],_0x19a9e2[_0x078a('0x3f')]));if(_0x4d206a['query']['filter']){_0x77584[_0x078a('0x48')]=_[_0x078a('0x4c')](_0x77584[_0x078a('0x48')],{'$or':_[_0x078a('0x49')](_0x77584[_0x078a('0x40')],function(_0xbd8904){var _0x49b6a7={};_0x49b6a7[_0xbd8904]={'$like':'%'+_0x4d206a[_0x078a('0x3d')]['filter']+'%'};return _0x49b6a7;})});}_0x77584=_['merge']({},_0x77584,_0x4d206a[_0x078a('0x4d')]);return _0xb05ea7[_0x078a('0x5a')](_0x77584);}})[_0x078a('0x1d')](function(_0x442444){if(_0x442444){_0x5a7a37=_0x442444[_0x078a('0x43')];if(!_0x4d206a[_0x078a('0x3d')][_0x078a('0x44')]('nolimit')){_0x77584[_0x078a('0x2c')]=qs['limit'](_0x4d206a[_0x078a('0x3d')]['limit']);_0x77584[_0x078a('0x2b')]=qs[_0x078a('0x2b')](_0x4d206a[_0x078a('0x3d')]['offset']);}return _0xb05ea7['getConfigurations'](_0x77584);}})[_0x078a('0x1d')](function(_0x195b4f){if(_0x195b4f){return _0x195b4f?{'count':_0x5a7a37,'rows':_0x195b4f}:null;}})[_0x078a('0x1d')](respondWithResult(_0x27f04c,null))[_0x078a('0x54')](handleError(_0x27f04c,null));};exports[_0x078a('0x5b')]=function(_0x939b50,_0x4a7d2b,_0x40cf9e){if(_0x939b50[_0x078a('0x56')]['id']){delete _0x939b50[_0x078a('0x56')]['id'];}return db['FreshdeskAccount'][_0x078a('0x57')]({'where':{'id':_0x939b50[_0x078a('0x51')]['id']}})['then'](handleEntityNotFound(_0x4a7d2b,null))['then'](function(_0x510ae5){if(_0x510ae5){_0x939b50['body'][_0x078a('0x5c')]=_0x510ae5['id'];_0x939b50[_0x078a('0x56')]['Subjects']=integrations['getSubjects'](_0x939b50[_0x078a('0x56')][_0x078a('0x5d')],_0x939b50[_0x078a('0x56')][_0x078a('0x3a')]);_0x939b50[_0x078a('0x56')]['Descriptions']=integrations['getDescriptions'](_0x939b50[_0x078a('0x56')]['channel'],_0x939b50['body'][_0x078a('0x3a')]);return db[_0x078a('0x58')]['create'](_0x939b50[_0x078a('0x56')],{'include':[{'model':db[_0x078a('0x5e')],'as':_0x078a('0x5f')},{'model':db[_0x078a('0x5e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4a7d2b,null))[_0x078a('0x54')](handleError(_0x4a7d2b,null));};exports[_0x078a('0x60')]=function(_0x3e1ab0,_0x10ec0b,_0x53c963){var _0x80bdf7='';return db[_0x078a('0x37')][_0x078a('0x57')]({'where':{'id':_0x3e1ab0[_0x078a('0x51')]['id']},'attributes':['id',_0x078a('0x61'),_0x078a('0x62')]})['then'](handleEntityNotFound(_0x10ec0b,null))[_0x078a('0x1d')](function(_0xb302d1){if(_0xb302d1){_0x80bdf7=_0xb302d1['remoteUri'];var _0x16a111=_0x80bdf7[_0x078a('0x63')](-0x1);if(_0x16a111==='/'){_0x80bdf7=_0x80bdf7[_0x078a('0x64')](0x0,_0x80bdf7[_0x078a('0x65')](_0x16a111));}return rp({'method':'GET','uri':util['format'](_0x078a('0x66'),_0x80bdf7,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x078a('0x67')](_0x078a('0x68'),new Buffer(util['format'](_0x078a('0x69'),_0xb302d1[_0x078a('0x62')]))[_0x078a('0x6a')](_0x078a('0x6b')))},'json':!![]});}})[_0x078a('0x1d')](function(_0x79b2bb){if(_0x79b2bb){var _0x2d71f3=[_0x078a('0x6c'),_0x078a('0x6d'),_0x078a('0x6e'),_0x078a('0x6f'),'status',_0x078a('0x70'),'group','source',_0x078a('0x71'),_0x078a('0x72'),_0x078a('0x73')];_[_0x078a('0x74')](_0x79b2bb,function(_0xd49d40){return _0x2d71f3['includes'](_0xd49d40[_0x078a('0x35')])||!_0xd49d40[_0x078a('0x75')]&&_0xd49d40['type']!=='custom_text'&&_0xd49d40[_0x078a('0x3a')]!==_0x078a('0x76');});return{'count':_0x79b2bb[_0x078a('0x43')],'rows':_[_0x078a('0x49')](_0x79b2bb,function(_0x527f71){return{'id':_0x527f71[_0x078a('0x35')],'name':_0x527f71['label'],'custom':!_0x527f71[_0x078a('0x75')],'options':_0x527f71[_0x078a('0x77')]?_[_0x078a('0x49')](_0x527f71['choices'],function(_0x405091){return{'name':_['capitalize'](_0x405091),'value':_0x405091};}):[]};})};}})['then'](respondWithResult(_0x10ec0b,null))[_0x078a('0x54')](function(_0x1921eb){var _0x319738=_0x3e1ab0[_0x078a('0x3d')]['test']?0x1f4:_0x1921eb['statusCode']||0x1f4;logger[_0x078a('0x23')](_0x078a('0x78'),_0x078a('0x60'),_0x319738,JSON[_0x078a('0x22')](_0x1921eb));delete _0x1921eb[_0x078a('0x35')];if(_0x319738===0x191){_0x319738=0x190;}_0x10ec0b[_0x078a('0x29')](_0x319738)[_0x078a('0x79')](_0x3e1ab0['query']['test']?{'message':_0x078a('0x7a'),'statusCode':_0x1921eb[_0x078a('0x7b')]}:_0x1921eb);});}; \ No newline at end of file +var _0x1bb3=['jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','stack','index','map','FreshdeskAccount','rawAttributes','type','name','query','keys','filters','intersection','attributes','model','fields','length','nolimit','limit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','FreshdeskConfiguration','order','hasOwnProperty','getConfigurations','addConfiguration','AccountId','Subjects','Descriptions','FreshdeskField','getFields','findOne','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','description','group','source','ticket_type','remove','includes','custom_text','custom_dropdown','default','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','lodash'];(function(_0x34f0fb,_0x3323b2){var _0x9b7b2b=function(_0x3cca84){while(--_0x3cca84){_0x34f0fb['push'](_0x34f0fb['shift']());}};_0x9b7b2b(++_0x3323b2);}(_0x1bb3,0x1c0));var _0x31bb=function(_0x145d72,_0x455bd3){_0x145d72=_0x145d72-0x0;var _0x2b11e0=_0x1bb3[_0x145d72];return _0x2b11e0;};'use strict';var pdf=require(_0x31bb('0x0'));var emlformat=require(_0x31bb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x31bb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x31bb('0x3'));var moment=require('moment');var BPromise=require(_0x31bb('0x4'));var Mustache=require(_0x31bb('0x5'));var util=require(_0x31bb('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x31bb('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x31bb('0x8'));var deskjs=require(_0x31bb('0x9'));var toCsv=require(_0x31bb('0xa'));var querystring=require(_0x31bb('0xb'));var Papa=require(_0x31bb('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x31bb('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31bb('0xe'));var logger=require('../../config/logger')(_0x31bb('0xf'));var utils=require(_0x31bb('0x10'));var config=require(_0x31bb('0x11'));var licenseUtil=require(_0x31bb('0x12'));var db=require(_0x31bb('0x13'))['db'];var integrations=require(_0x31bb('0x14'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18c187,_0x635f92,_0x1b45a1,_0x24c797){return new BPromise(function(_0x2dbe04,_0x47f2e1){var _0x970e37=_0x24c797||client;return _0x970e37['request'](_0x18c187,_0x1b45a1)['then'](function(_0x48072a){logger['info'](_0x31bb('0x15'),_0x635f92,_0x31bb('0x16'));logger[_0x31bb('0x17')](_0x31bb('0x18'),_0x635f92,'request\x20sent',JSON[_0x31bb('0x19')](_0x48072a));if(_0x48072a[_0x31bb('0x1a')]){if(_0x48072a[_0x31bb('0x1a')]['code']===0x1f4){logger['error'](_0x31bb('0x15'),_0x635f92,_0x48072a[_0x31bb('0x1a')][_0x31bb('0x1b')]);return _0x47f2e1(_0x48072a[_0x31bb('0x1a')][_0x31bb('0x1b')]);}logger[_0x31bb('0x1a')](_0x31bb('0x15'),_0x635f92,_0x48072a[_0x31bb('0x1a')][_0x31bb('0x1b')]);return _0x2dbe04(_0x48072a[_0x31bb('0x1a')]['message']);}else{logger[_0x31bb('0x1c')](_0x31bb('0x15'),_0x635f92,_0x31bb('0x16'));_0x2dbe04(_0x48072a[_0x31bb('0x1d')][_0x31bb('0x1b')]);}})['catch'](function(_0x2fc4a3){logger[_0x31bb('0x1a')]('FreshdeskAccount,\x20%s,\x20%s',_0x635f92,_0x2fc4a3);_0x47f2e1(_0x2fc4a3);});});}function respondWithStatusCode(_0x30aee9,_0x10b361){_0x10b361=_0x10b361||0xcc;return function(_0x52f9f0){if(_0x52f9f0){return _0x30aee9[_0x31bb('0x1e')](_0x10b361);}return _0x30aee9[_0x31bb('0x1f')](_0x10b361)[_0x31bb('0x20')]();};}function respondWithResult(_0x33516a,_0x4cf0af){_0x4cf0af=_0x4cf0af||0xc8;return function(_0x262320){if(_0x262320){return _0x33516a[_0x31bb('0x1f')](_0x4cf0af)[_0x31bb('0x21')](_0x262320);}};}function respondWithFilteredResult(_0x3f7f03,_0x121bbc){return function(_0x3bd68c){if(_0x3bd68c){var _0x5807c0=_0x3bd68c[_0x31bb('0x22')],_0x393708=_0x121bbc[_0x31bb('0x23')],_0x5673c9=_0x121bbc[_0x31bb('0x23')]+_0x121bbc['limit'],_0x271a23;if(_0x5673c9>=_0x5807c0){_0x5673c9=_0x5807c0;_0x271a23=0xc8;}else{_0x271a23=0xce;}_0x3f7f03[_0x31bb('0x1f')](_0x271a23);return _0x3f7f03[_0x31bb('0x24')]('Content-Range',_0x393708+'-'+_0x5673c9+'/'+_0x5807c0)[_0x31bb('0x21')](_0x3bd68c);}return null;};}function patchUpdates(_0x16079){return function(_0x245699){try{jsonpatch[_0x31bb('0x25')](_0x245699,_0x16079,!![]);}catch(_0x59f096){return BPromise[_0x31bb('0x26')](_0x59f096);}return _0x245699[_0x31bb('0x27')]();};}function saveUpdates(_0x19eb6d,_0x1301ea){return function(_0x2c097a){if(_0x2c097a){return _0x2c097a[_0x31bb('0x28')](_0x19eb6d)[_0x31bb('0x29')](function(_0x10500d){return _0x10500d;});}return null;};}function removeEntity(_0x1a60e4,_0x394c18){return function(_0x1dc97d){if(_0x1dc97d){return _0x1dc97d[_0x31bb('0x2a')]()[_0x31bb('0x29')](function(){_0x1a60e4[_0x31bb('0x1f')](0xcc)[_0x31bb('0x20')]();});}};}function handleEntityNotFound(_0x31e1ec,_0x3abd66){return function(_0x74230d){if(!_0x74230d){_0x31e1ec['sendStatus'](0x194);}return _0x74230d;};}function handleError(_0x192143,_0x409f39){_0x409f39=_0x409f39||0x1f4;return function(_0x1a1971){logger[_0x31bb('0x1a')](_0x1a1971[_0x31bb('0x2b')]);if(_0x1a1971['name']){delete _0x1a1971['name'];}_0x192143['status'](_0x409f39)['send'](_0x1a1971);};}exports[_0x31bb('0x2c')]=function(_0x272ecc,_0x5b9848){var _0x524e1a={},_0x14b199={},_0x682319={'count':0x0,'rows':[]};var _0x38810b=_[_0x31bb('0x2d')](db[_0x31bb('0x2e')][_0x31bb('0x2f')],function(_0x5cd64a){return{'name':_0x5cd64a['fieldName'],'type':_0x5cd64a[_0x31bb('0x30')]['key']};});_0x14b199['model']=_[_0x31bb('0x2d')](_0x38810b,_0x31bb('0x31'));_0x14b199[_0x31bb('0x32')]=_[_0x31bb('0x33')](_0x272ecc['query']);_0x14b199[_0x31bb('0x34')]=_[_0x31bb('0x35')](_0x14b199['model'],_0x14b199['query']);_0x524e1a[_0x31bb('0x36')]=_[_0x31bb('0x35')](_0x14b199[_0x31bb('0x37')],qs[_0x31bb('0x38')](_0x272ecc[_0x31bb('0x32')][_0x31bb('0x38')]));_0x524e1a[_0x31bb('0x36')]=_0x524e1a['attributes'][_0x31bb('0x39')]?_0x524e1a['attributes']:_0x14b199[_0x31bb('0x37')];if(!_0x272ecc[_0x31bb('0x32')]['hasOwnProperty'](_0x31bb('0x3a'))){_0x524e1a[_0x31bb('0x3b')]=qs[_0x31bb('0x3b')](_0x272ecc['query'][_0x31bb('0x3b')]);_0x524e1a['offset']=qs[_0x31bb('0x23')](_0x272ecc[_0x31bb('0x32')]['offset']);}_0x524e1a['order']=qs[_0x31bb('0x3c')](_0x272ecc[_0x31bb('0x32')]['sort']);_0x524e1a['where']=qs['filters'](_[_0x31bb('0x3d')](_0x272ecc[_0x31bb('0x32')],_0x14b199[_0x31bb('0x34')]),_0x38810b);if(_0x272ecc[_0x31bb('0x32')][_0x31bb('0x3e')]){_0x524e1a[_0x31bb('0x3f')]=_[_0x31bb('0x40')](_0x524e1a[_0x31bb('0x3f')],{'$or':_[_0x31bb('0x2d')](_0x38810b,function(_0x1944ac){if(_0x1944ac[_0x31bb('0x30')]!=='VIRTUAL'){var _0xa99158={};_0xa99158[_0x1944ac[_0x31bb('0x31')]]={'$like':'%'+_0x272ecc['query']['filter']+'%'};return _0xa99158;}})});}_0x524e1a=_[_0x31bb('0x40')]({},_0x524e1a,_0x272ecc[_0x31bb('0x41')]);var _0x216567={'where':_0x524e1a['where']};return db[_0x31bb('0x2e')][_0x31bb('0x22')](_0x216567)[_0x31bb('0x29')](function(_0x39a58c){_0x682319[_0x31bb('0x22')]=_0x39a58c;if(_0x272ecc[_0x31bb('0x32')][_0x31bb('0x42')]){_0x524e1a[_0x31bb('0x43')]=[{'all':!![]}];}return db[_0x31bb('0x2e')][_0x31bb('0x44')](_0x524e1a);})[_0x31bb('0x29')](function(_0x54be58){_0x682319[_0x31bb('0x45')]=_0x54be58;return _0x682319;})[_0x31bb('0x29')](respondWithFilteredResult(_0x5b9848,_0x524e1a))[_0x31bb('0x46')](handleError(_0x5b9848,null));};exports['show']=function(_0x1e8b51,_0x31ed3a){var _0x54418e={'raw':![],'where':{'id':_0x1e8b51[_0x31bb('0x47')]['id']}},_0x1c90a5={};_0x1c90a5['model']=_[_0x31bb('0x33')](db[_0x31bb('0x2e')][_0x31bb('0x2f')]);_0x1c90a5[_0x31bb('0x32')]=_[_0x31bb('0x33')](_0x1e8b51[_0x31bb('0x32')]);_0x1c90a5[_0x31bb('0x34')]=_[_0x31bb('0x35')](_0x1c90a5[_0x31bb('0x37')],_0x1c90a5['query']);_0x54418e[_0x31bb('0x36')]=_[_0x31bb('0x35')](_0x1c90a5['model'],qs[_0x31bb('0x38')](_0x1e8b51[_0x31bb('0x32')][_0x31bb('0x38')]));_0x54418e['attributes']=_0x54418e[_0x31bb('0x36')][_0x31bb('0x39')]?_0x54418e[_0x31bb('0x36')]:_0x1c90a5[_0x31bb('0x37')];if(_0x1e8b51[_0x31bb('0x32')][_0x31bb('0x42')]){_0x54418e[_0x31bb('0x43')]=[{'all':!![]}];}_0x54418e=_[_0x31bb('0x40')]({},_0x54418e,_0x1e8b51[_0x31bb('0x41')]);return db['FreshdeskAccount'][_0x31bb('0x48')](_0x54418e)[_0x31bb('0x29')](handleEntityNotFound(_0x31ed3a,null))[_0x31bb('0x29')](respondWithResult(_0x31ed3a,null))[_0x31bb('0x46')](handleError(_0x31ed3a,null));};exports[_0x31bb('0x49')]=function(_0x27b9c3,_0x369017){return db[_0x31bb('0x2e')]['create'](_0x27b9c3[_0x31bb('0x4a')],{})['then'](respondWithResult(_0x369017,0xc9))['catch'](handleError(_0x369017,null));};exports[_0x31bb('0x28')]=function(_0xbbacd,_0x36a477){if(_0xbbacd[_0x31bb('0x4a')]['id']){delete _0xbbacd[_0x31bb('0x4a')]['id'];}return db[_0x31bb('0x2e')][_0x31bb('0x48')]({'where':{'id':_0xbbacd[_0x31bb('0x47')]['id']}})['then'](handleEntityNotFound(_0x36a477,null))[_0x31bb('0x29')](saveUpdates(_0xbbacd[_0x31bb('0x4a')],null))[_0x31bb('0x29')](respondWithResult(_0x36a477,null))[_0x31bb('0x46')](handleError(_0x36a477,null));};exports['destroy']=function(_0x4c6018,_0x39767c){return db[_0x31bb('0x2e')][_0x31bb('0x48')]({'where':{'id':_0x4c6018[_0x31bb('0x47')]['id']}})['then'](handleEntityNotFound(_0x39767c,null))[_0x31bb('0x29')](removeEntity(_0x39767c,null))[_0x31bb('0x46')](handleError(_0x39767c,null));};exports['getConfigurations']=function(_0x2e0172,_0x5b1ddc,_0x9ee4c6){var _0x1ceee9={};var _0x269bdf={};var _0x56094d;var _0xeabcfe;return db[_0x31bb('0x2e')]['findOne']({'where':{'id':_0x2e0172[_0x31bb('0x47')]['id']}})[_0x31bb('0x29')](handleEntityNotFound(_0x5b1ddc,null))[_0x31bb('0x29')](function(_0x3cda37){if(_0x3cda37){_0x56094d=_0x3cda37;_0x269bdf[_0x31bb('0x37')]=_[_0x31bb('0x33')](db[_0x31bb('0x4b')]['rawAttributes']);_0x269bdf['query']=_['keys'](_0x2e0172[_0x31bb('0x32')]);_0x269bdf['filters']=_[_0x31bb('0x35')](_0x269bdf[_0x31bb('0x37')],_0x269bdf['query']);_0x1ceee9[_0x31bb('0x36')]=_[_0x31bb('0x35')](_0x269bdf[_0x31bb('0x37')],qs[_0x31bb('0x38')](_0x2e0172[_0x31bb('0x32')][_0x31bb('0x38')]));_0x1ceee9['attributes']=_0x1ceee9['attributes'][_0x31bb('0x39')]?_0x1ceee9[_0x31bb('0x36')]:_0x269bdf[_0x31bb('0x37')];_0x1ceee9[_0x31bb('0x4c')]=qs[_0x31bb('0x3c')](_0x2e0172['query'][_0x31bb('0x3c')]);_0x1ceee9[_0x31bb('0x3f')]=qs['filters'](_[_0x31bb('0x3d')](_0x2e0172[_0x31bb('0x32')],_0x269bdf['filters']));if(_0x2e0172[_0x31bb('0x32')][_0x31bb('0x3e')]){_0x1ceee9[_0x31bb('0x3f')]=_[_0x31bb('0x40')](_0x1ceee9[_0x31bb('0x3f')],{'$or':_['map'](_0x1ceee9[_0x31bb('0x36')],function(_0x2bb73c){var _0x4154a3={};_0x4154a3[_0x2bb73c]={'$like':'%'+_0x2e0172[_0x31bb('0x32')][_0x31bb('0x3e')]+'%'};return _0x4154a3;})});}_0x1ceee9=_[_0x31bb('0x40')]({},_0x1ceee9,_0x2e0172[_0x31bb('0x41')]);return _0x56094d['getConfigurations'](_0x1ceee9);}})[_0x31bb('0x29')](function(_0x5c024a){if(_0x5c024a){_0xeabcfe=_0x5c024a['length'];if(!_0x2e0172[_0x31bb('0x32')][_0x31bb('0x4d')](_0x31bb('0x3a'))){_0x1ceee9['limit']=qs['limit'](_0x2e0172[_0x31bb('0x32')][_0x31bb('0x3b')]);_0x1ceee9[_0x31bb('0x23')]=qs['offset'](_0x2e0172['query']['offset']);}return _0x56094d[_0x31bb('0x4e')](_0x1ceee9);}})[_0x31bb('0x29')](function(_0x52c474){if(_0x52c474){return _0x52c474?{'count':_0xeabcfe,'rows':_0x52c474}:null;}})[_0x31bb('0x29')](respondWithResult(_0x5b1ddc,null))[_0x31bb('0x46')](handleError(_0x5b1ddc,null));};exports[_0x31bb('0x4f')]=function(_0x55bba8,_0x42381b,_0x4232e3){if(_0x55bba8['body']['id']){delete _0x55bba8[_0x31bb('0x4a')]['id'];}return db[_0x31bb('0x2e')]['findOne']({'where':{'id':_0x55bba8[_0x31bb('0x47')]['id']}})[_0x31bb('0x29')](handleEntityNotFound(_0x42381b,null))[_0x31bb('0x29')](function(_0x5f08b4){if(_0x5f08b4){_0x55bba8['body'][_0x31bb('0x50')]=_0x5f08b4['id'];_0x55bba8['body'][_0x31bb('0x51')]=integrations['getSubjects'](_0x55bba8['body']['channel'],_0x55bba8['body'][_0x31bb('0x30')]);_0x55bba8['body'][_0x31bb('0x52')]=integrations['getDescriptions'](_0x55bba8[_0x31bb('0x4a')]['channel'],_0x55bba8[_0x31bb('0x4a')][_0x31bb('0x30')]);return db[_0x31bb('0x4b')][_0x31bb('0x49')](_0x55bba8['body'],{'include':[{'model':db[_0x31bb('0x53')],'as':'Subjects'},{'model':db[_0x31bb('0x53')],'as':_0x31bb('0x52')}]});}return null;})['then'](respondWithResult(_0x42381b,null))[_0x31bb('0x46')](handleError(_0x42381b,null));};exports[_0x31bb('0x54')]=function(_0x261cc5,_0x411634,_0xfc03e6){var _0x5528e7='';return db['FreshdeskAccount'][_0x31bb('0x55')]({'where':{'id':_0x261cc5[_0x31bb('0x47')]['id']},'attributes':['id',_0x31bb('0x56'),_0x31bb('0x57')]})['then'](handleEntityNotFound(_0x411634,null))[_0x31bb('0x29')](function(_0x308ed9){if(_0x308ed9){_0x5528e7=_0x308ed9[_0x31bb('0x56')];var _0x96e585=_0x5528e7[_0x31bb('0x58')](-0x1);if(_0x96e585==='/'){_0x5528e7=_0x5528e7[_0x31bb('0x59')](0x0,_0x5528e7[_0x31bb('0x5a')](_0x96e585));}return rp({'method':'GET','uri':util[_0x31bb('0x5b')](_0x31bb('0x5c'),_0x5528e7,_0x31bb('0x5d')),'headers':{'Authorization':util[_0x31bb('0x5b')](_0x31bb('0x5e'),new Buffer(util['format'](_0x31bb('0x5f'),_0x308ed9[_0x31bb('0x57')]))['toString'](_0x31bb('0x60')))},'json':!![]});}})[_0x31bb('0x29')](function(_0xf397ef){if(_0xf397ef){var _0x118936=[_0x31bb('0x61'),_0x31bb('0x62'),_0x31bb('0x63'),_0x31bb('0x64'),'status','priority',_0x31bb('0x65'),_0x31bb('0x66'),_0x31bb('0x67'),_0x31bb('0x65'),'company'];_[_0x31bb('0x68')](_0xf397ef,function(_0x6c3537){return _0x118936[_0x31bb('0x69')](_0x6c3537[_0x31bb('0x31')])||!_0x6c3537['default']&&_0x6c3537[_0x31bb('0x30')]!==_0x31bb('0x6a')&&_0x6c3537[_0x31bb('0x30')]!==_0x31bb('0x6b');});return{'count':_0xf397ef[_0x31bb('0x39')],'rows':_[_0x31bb('0x2d')](_0xf397ef,function(_0xa028b0){return{'id':_0xa028b0[_0x31bb('0x31')],'name':_0xa028b0['label'],'custom':!_0xa028b0[_0x31bb('0x6c')],'options':_0xa028b0['choices']?_[_0x31bb('0x2d')](_0xa028b0[_0x31bb('0x6d')],function(_0x4a1c1d){return{'name':_['capitalize'](_0x4a1c1d),'value':_0x4a1c1d};}):[]};})};}})['then'](respondWithResult(_0x411634,null))['catch'](function(_0x44f224){var _0x480e6f=_0x261cc5['query'][_0x31bb('0x6e')]?0x1f4:_0x44f224[_0x31bb('0x6f')]||0x1f4;logger['error'](_0x31bb('0x70'),_0x31bb('0x54'),_0x480e6f,JSON[_0x31bb('0x19')](_0x44f224));delete _0x44f224[_0x31bb('0x31')];if(_0x480e6f===0x191){_0x480e6f=0x190;}_0x411634[_0x31bb('0x1f')](_0x480e6f)['send'](_0x261cc5[_0x31bb('0x32')][_0x31bb('0x6e')]?{'message':_0x31bb('0x71'),'statusCode':_0x44f224[_0x31bb('0x6f')]}:_0x44f224);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 068a3a8..b60eba6 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 _0xb332=['../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x4bbfd5,_0x5a63ea){var _0x3d1b55=function(_0x206715){while(--_0x206715){_0x4bbfd5['push'](_0x4bbfd5['shift']());}};_0x3d1b55(++_0x5a63ea);}(_0xb332,0x1ef));var _0x2b33=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0xb332[_0x25efdf];return _0x22c495;};'use strict';var _=require(_0x2b33('0x0'));var util=require(_0x2b33('0x1'));var logger=require(_0x2b33('0x2'))(_0x2b33('0x3'));var moment=require('moment');var BPromise=require(_0x2b33('0x4'));var rp=require(_0x2b33('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b33('0x6'));var config=require(_0x2b33('0x7'));var attributes=require(_0x2b33('0x8'));var integrations=require(_0x2b33('0x9'));module[_0x2b33('0xa')]=function(_0x51b866,_0x58b48e){return _0x51b866[_0x2b33('0xb')](_0x2b33('0xc'),attributes,{'tableName':_0x2b33('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78a0=['exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x517a91,_0x7d5227){var _0x4f4597=function(_0x9b9448){while(--_0x9b9448){_0x517a91['push'](_0x517a91['shift']());}};_0x4f4597(++_0x7d5227);}(_0x78a0,0x149));var _0x078a=function(_0x2dd22e,_0xec41fe){_0x2dd22e=_0x2dd22e-0x0;var _0x257b01=_0x78a0[_0x2dd22e];return _0x257b01;};'use strict';var _=require(_0x078a('0x0'));var util=require(_0x078a('0x1'));var logger=require(_0x078a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x078a('0x3'));var rp=require(_0x078a('0x4'));var fs=require('fs');var path=require(_0x078a('0x5'));var rimraf=require(_0x078a('0x6'));var config=require('../../config/environment');var attributes=require(_0x078a('0x7'));var integrations=require(_0x078a('0x8'));module[_0x078a('0x9')]=function(_0x53d543,_0xdd83ab){return _0x53d543[_0x078a('0xa')](_0x078a('0xb'),attributes,{'tableName':_0x078a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index dd9a8b6..ff5cc8b 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 _0xa17e=['jayson/promise','client','http','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','raw','where','limit','include','map','attributes','model','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount','find','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4d4325,_0x39df8c){var _0x31bb2f=function(_0x1f24e0){while(--_0x1f24e0){_0x4d4325['push'](_0x4d4325['shift']());}};_0x31bb2f(++_0x39df8c);}(_0xa17e,0x8a));var _0xea17=function(_0x51cf44,_0x33ffcd){_0x51cf44=_0x51cf44-0x0;var _0x4f14d6=_0xa17e[_0x51cf44];return _0x4f14d6;};'use strict';var _=require(_0xea17('0x0'));var util=require(_0xea17('0x1'));var moment=require(_0xea17('0x2'));var BPromise=require(_0xea17('0x3'));var rs=require(_0xea17('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea17('0x5'))['db'];var utils=require(_0xea17('0x6'));var logger=require(_0xea17('0x7'))(_0xea17('0x8'));var config=require(_0xea17('0x9'));var jayson=require(_0xea17('0xa'));var client=jayson[_0xea17('0xb')][_0xea17('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x84cd52,_0x350899,_0x3ce7ac){return new BPromise(function(_0x567e6c,_0x520fdf){return client['request'](_0x84cd52,_0x3ce7ac)[_0xea17('0xd')](function(_0x24484e){logger['info'](_0xea17('0xe'),_0x350899,_0xea17('0xf'));logger[_0xea17('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x350899,'request\x20sent',JSON[_0xea17('0x11')](_0x24484e));if(_0x24484e[_0xea17('0x12')]){if(_0x24484e[_0xea17('0x12')][_0xea17('0x13')]===0x1f4){logger[_0xea17('0x12')](_0xea17('0xe'),_0x350899,_0x24484e[_0xea17('0x12')][_0xea17('0x14')]);return _0x520fdf(_0x24484e[_0xea17('0x12')][_0xea17('0x14')]);}logger[_0xea17('0x12')](_0xea17('0xe'),_0x350899,_0x24484e[_0xea17('0x12')][_0xea17('0x14')]);return _0x567e6c(_0x24484e[_0xea17('0x12')]['message']);}else{logger['info'](_0xea17('0xe'),_0x350899,_0xea17('0xf'));_0x567e6c(_0x24484e[_0xea17('0x15')]['message']);}})[_0xea17('0x16')](function(_0x122766){logger[_0xea17('0x12')](_0xea17('0xe'),_0x350899,_0x122766);_0x520fdf(_0x122766);});});}exports['GetFreshdeskAccount']=function(_0x4938a4){var _0x4c84bf=this;return new Promise(function(_0x2acb4d,_0x5783a4){return db['FreshdeskAccount'][_0xea17('0x17')]({'raw':_0x4938a4['options']?_0x4938a4[_0xea17('0x18')][_0xea17('0x19')]===undefined?!![]:![]:!![],'where':_0x4938a4[_0xea17('0x18')]?_0x4938a4['options'][_0xea17('0x1a')]||null:null,'attributes':_0x4938a4['options']?_0x4938a4['options']['attributes']||null:null,'limit':_0x4938a4[_0xea17('0x18')]?_0x4938a4[_0xea17('0x18')][_0xea17('0x1b')]||null:null,'include':_0x4938a4['options']?_0x4938a4[_0xea17('0x18')][_0xea17('0x1c')]?_[_0xea17('0x1d')](_0x4938a4['options'][_0xea17('0x1c')],function(_0x50a2b7){return{'model':db[_0x50a2b7['model']],'as':_0x50a2b7['as'],'attributes':_0x50a2b7[_0xea17('0x1e')],'include':_0x50a2b7[_0xea17('0x1c')]?_[_0xea17('0x1d')](_0x50a2b7[_0xea17('0x1c')],function(_0x459c41){return{'model':db[_0x459c41[_0xea17('0x1f')]],'as':_0x459c41['as'],'attributes':_0x459c41[_0xea17('0x1e')],'include':_0x459c41[_0xea17('0x1c')]?_[_0xea17('0x1d')](_0x459c41[_0xea17('0x1c')],function(_0x5f22dd){return{'model':db[_0x5f22dd[_0xea17('0x1f')]],'as':_0x5f22dd['as'],'attributes':_0x5f22dd[_0xea17('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xea17('0xd')](function(_0x316602){logger['info'](_0xea17('0x20'),_0x4938a4);logger['debug'](_0xea17('0x20'),_0x4938a4,JSON['stringify'](_0x316602));_0x2acb4d(_0x316602);})['catch'](function(_0x35fd8a){logger[_0xea17('0x12')]('GetFreshdeskAccount',_0x35fd8a[_0xea17('0x14')],_0x4938a4);_0x5783a4(_0x4c84bf['error'](0x1f4,_0x35fd8a[_0xea17('0x14')]));});});};exports[_0xea17('0x21')]=function(_0x42d2a6){var _0x3dbaac=this;return new Promise(function(_0x59c3f7,_0x379826){return db[_0xea17('0x22')][_0xea17('0x23')]({'raw':_0x42d2a6['options']?_0x42d2a6[_0xea17('0x18')][_0xea17('0x19')]===undefined?!![]:![]:!![],'where':_0x42d2a6[_0xea17('0x18')]?_0x42d2a6[_0xea17('0x18')][_0xea17('0x1a')]||null:null,'attributes':_0x42d2a6[_0xea17('0x18')]?_0x42d2a6[_0xea17('0x18')]['attributes']||null:null,'include':_0x42d2a6[_0xea17('0x18')]?_0x42d2a6[_0xea17('0x18')][_0xea17('0x1c')]?_[_0xea17('0x1d')](_0x42d2a6['options'][_0xea17('0x1c')],function(_0x5ee366){return{'model':db[_0x5ee366[_0xea17('0x1f')]],'as':_0x5ee366['as'],'attributes':_0x5ee366[_0xea17('0x1e')],'include':_0x5ee366['include']?_[_0xea17('0x1d')](_0x5ee366[_0xea17('0x1c')],function(_0x169226){return{'model':db[_0x169226[_0xea17('0x1f')]],'as':_0x169226['as'],'attributes':_0x169226[_0xea17('0x1e')],'include':_0x169226['include']?_[_0xea17('0x1d')](_0x169226[_0xea17('0x1c')],function(_0x6877ff){return{'model':db[_0x6877ff['model']],'as':_0x6877ff['as'],'attributes':_0x6877ff['attributes']};}):[]};}):[]};}):[]:[]})[_0xea17('0xd')](function(_0x43f8c4){logger[_0xea17('0x24')]('ShowFreshdeskAccount',_0x42d2a6);logger[_0xea17('0x10')](_0xea17('0x21'),_0x42d2a6,JSON[_0xea17('0x11')](_0x43f8c4));_0x59c3f7(_0x43f8c4);})['catch'](function(_0x2dbf37){logger['error']('ShowFreshdeskAccount',_0x2dbf37[_0xea17('0x14')],_0x42d2a6);_0x379826(_0x3dbaac[_0xea17('0x12')](0x1f4,_0x2dbf37[_0xea17('0x14')]));});});}; \ No newline at end of file +var _0x3ee5=['bluebird','randomstring','../../mysqldb','../../config/logger','client','http','request','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','util'];(function(_0x5ed65a,_0x25bac5){var _0x100216=function(_0x5643b1){while(--_0x5643b1){_0x5ed65a['push'](_0x5ed65a['shift']());}};_0x100216(++_0x25bac5);}(_0x3ee5,0xd1));var _0x53ee=function(_0x2b71e2,_0x153c69){_0x2b71e2=_0x2b71e2-0x0;var _0x472005=_0x3ee5[_0x2b71e2];return _0x472005;};'use strict';var _=require('lodash');var util=require(_0x53ee('0x0'));var moment=require('moment');var BPromise=require(_0x53ee('0x1'));var rs=require(_0x53ee('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x53ee('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x53ee('0x5')][_0x53ee('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x41a147,_0x35db84,_0x561242){return new BPromise(function(_0x320297,_0x17f825){return client[_0x53ee('0x7')](_0x41a147,_0x561242)['then'](function(_0x2994ee){logger[_0x53ee('0x8')]('FreshdeskAccount,\x20%s,\x20%s',_0x35db84,_0x53ee('0x9'));logger['debug'](_0x53ee('0xa'),_0x35db84,_0x53ee('0x9'),JSON[_0x53ee('0xb')](_0x2994ee));if(_0x2994ee['error']){if(_0x2994ee[_0x53ee('0xc')][_0x53ee('0xd')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x35db84,_0x2994ee[_0x53ee('0xc')][_0x53ee('0xe')]);return _0x17f825(_0x2994ee[_0x53ee('0xc')][_0x53ee('0xe')]);}logger[_0x53ee('0xc')](_0x53ee('0xf'),_0x35db84,_0x2994ee[_0x53ee('0xc')][_0x53ee('0xe')]);return _0x320297(_0x2994ee['error'][_0x53ee('0xe')]);}else{logger[_0x53ee('0x8')](_0x53ee('0xf'),_0x35db84,_0x53ee('0x9'));_0x320297(_0x2994ee['result']['message']);}})[_0x53ee('0x10')](function(_0x46f48e){logger[_0x53ee('0xc')](_0x53ee('0xf'),_0x35db84,_0x46f48e);_0x17f825(_0x46f48e);});});}exports[_0x53ee('0x11')]=function(_0x3e1249){var _0x36e389=this;return new Promise(function(_0x110bb7,_0x178b89){return db[_0x53ee('0x12')][_0x53ee('0x13')]({'raw':_0x3e1249[_0x53ee('0x14')]?_0x3e1249[_0x53ee('0x14')][_0x53ee('0x15')]===undefined?!![]:![]:!![],'where':_0x3e1249[_0x53ee('0x14')]?_0x3e1249[_0x53ee('0x14')][_0x53ee('0x16')]||null:null,'attributes':_0x3e1249[_0x53ee('0x14')]?_0x3e1249['options'][_0x53ee('0x17')]||null:null,'limit':_0x3e1249[_0x53ee('0x14')]?_0x3e1249['options'][_0x53ee('0x18')]||null:null,'include':_0x3e1249['options']?_0x3e1249[_0x53ee('0x14')][_0x53ee('0x19')]?_[_0x53ee('0x1a')](_0x3e1249['options'][_0x53ee('0x19')],function(_0x3c91f8){return{'model':db[_0x3c91f8['model']],'as':_0x3c91f8['as'],'attributes':_0x3c91f8[_0x53ee('0x17')],'include':_0x3c91f8['include']?_[_0x53ee('0x1a')](_0x3c91f8[_0x53ee('0x19')],function(_0x17579e){return{'model':db[_0x17579e[_0x53ee('0x1b')]],'as':_0x17579e['as'],'attributes':_0x17579e[_0x53ee('0x17')],'include':_0x17579e[_0x53ee('0x19')]?_[_0x53ee('0x1a')](_0x17579e[_0x53ee('0x19')],function(_0x29865b){return{'model':db[_0x29865b[_0x53ee('0x1b')]],'as':_0x29865b['as'],'attributes':_0x29865b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x35db22){logger[_0x53ee('0x8')](_0x53ee('0x11'),_0x3e1249);logger['debug'](_0x53ee('0x11'),_0x3e1249,JSON[_0x53ee('0xb')](_0x35db22));_0x110bb7(_0x35db22);})['catch'](function(_0x3e08d2){logger[_0x53ee('0xc')]('GetFreshdeskAccount',_0x3e08d2[_0x53ee('0xe')],_0x3e1249);_0x178b89(_0x36e389[_0x53ee('0xc')](0x1f4,_0x3e08d2[_0x53ee('0xe')]));});});};exports[_0x53ee('0x1c')]=function(_0xac651b){var _0xe2eb62=this;return new Promise(function(_0x2ffdcf,_0x1a230b){return db['FreshdeskAccount'][_0x53ee('0x1d')]({'raw':_0xac651b[_0x53ee('0x14')]?_0xac651b[_0x53ee('0x14')][_0x53ee('0x15')]===undefined?!![]:![]:!![],'where':_0xac651b['options']?_0xac651b['options']['where']||null:null,'attributes':_0xac651b[_0x53ee('0x14')]?_0xac651b[_0x53ee('0x14')]['attributes']||null:null,'include':_0xac651b[_0x53ee('0x14')]?_0xac651b[_0x53ee('0x14')][_0x53ee('0x19')]?_[_0x53ee('0x1a')](_0xac651b[_0x53ee('0x14')]['include'],function(_0x4e0bf3){return{'model':db[_0x4e0bf3[_0x53ee('0x1b')]],'as':_0x4e0bf3['as'],'attributes':_0x4e0bf3[_0x53ee('0x17')],'include':_0x4e0bf3['include']?_[_0x53ee('0x1a')](_0x4e0bf3[_0x53ee('0x19')],function(_0x292c43){return{'model':db[_0x292c43[_0x53ee('0x1b')]],'as':_0x292c43['as'],'attributes':_0x292c43[_0x53ee('0x17')],'include':_0x292c43[_0x53ee('0x19')]?_[_0x53ee('0x1a')](_0x292c43[_0x53ee('0x19')],function(_0x367ccc){return{'model':db[_0x367ccc[_0x53ee('0x1b')]],'as':_0x367ccc['as'],'attributes':_0x367ccc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x13187a){logger[_0x53ee('0x8')](_0x53ee('0x1c'),_0xac651b);logger['debug'](_0x53ee('0x1c'),_0xac651b,JSON[_0x53ee('0xb')](_0x13187a));_0x2ffdcf(_0x13187a);})['catch'](function(_0x47ec52){logger[_0x53ee('0xc')](_0x53ee('0x1c'),_0x47ec52['message'],_0xac651b);_0x1a230b(_0xe2eb62[_0x53ee('0xc')](0x1f4,_0x47ec52[_0x53ee('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 22a94ae..62d0cce 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 _0xacb1=['put','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getSubjects','/:id/descriptions','getTags','post','create'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xacb1,0x9a));var _0x1acb=function(_0x34bda4,_0x25daa5){_0x34bda4=_0x34bda4-0x0;var _0xbefec8=_0xacb1[_0x34bda4];return _0xbefec8;};'use strict';var multer=require(_0x1acb('0x0'));var util=require(_0x1acb('0x1'));var path=require('path');var timeout=require(_0x1acb('0x2'));var express=require('express');var router=express[_0x1acb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1acb('0x4'));var config=require(_0x1acb('0x5'));var controller=require(_0x1acb('0x6'));router[_0x1acb('0x7')]('/',auth[_0x1acb('0x8')](),controller[_0x1acb('0x9')]);router['get'](_0x1acb('0xa'),auth[_0x1acb('0x8')](),controller['show']);router[_0x1acb('0x7')](_0x1acb('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x1acb('0x7')]('/:id/subjects',auth[_0x1acb('0x8')](),controller[_0x1acb('0xc')]);router[_0x1acb('0x7')](_0x1acb('0xd'),auth[_0x1acb('0x8')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x1acb('0xe')]);router[_0x1acb('0xf')]('/',auth['isAuthenticated'](),controller[_0x1acb('0x10')]);router[_0x1acb('0xf')]('/:id/tags',auth[_0x1acb('0x8')](),controller['setTags']);router[_0x1acb('0x11')](_0x1acb('0xa'),auth[_0x1acb('0x8')](),controller['update']);router['delete'](_0x1acb('0xa'),auth[_0x1acb('0x8')](),controller['destroy']);module[_0x1acb('0x12')]=router; \ No newline at end of file +var _0x4d69=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated'];(function(_0x1c156e,_0x3263a6){var _0x58fc22=function(_0x42f1eb){while(--_0x42f1eb){_0x1c156e['push'](_0x1c156e['shift']());}};_0x58fc22(++_0x3263a6);}(_0x4d69,0xc7));var _0x94d6=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x4d69[_0x59d89e];return _0x554e93;};'use strict';var multer=require('multer');var util=require(_0x94d6('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x94d6('0x1'));var router=express[_0x94d6('0x2')]();var auth=require(_0x94d6('0x3'));var interaction=require(_0x94d6('0x4'));var config=require(_0x94d6('0x5'));var controller=require(_0x94d6('0x6'));router[_0x94d6('0x7')]('/',auth[_0x94d6('0x8')](),controller['index']);router[_0x94d6('0x7')](_0x94d6('0x9'),auth[_0x94d6('0x8')](),controller[_0x94d6('0xa')]);router[_0x94d6('0x7')](_0x94d6('0xb'),auth['isAuthenticated'](),controller[_0x94d6('0xc')]);router[_0x94d6('0x7')](_0x94d6('0xd'),auth[_0x94d6('0x8')](),controller[_0x94d6('0xe')]);router['get'](_0x94d6('0xf'),auth['isAuthenticated'](),controller[_0x94d6('0x10')]);router[_0x94d6('0x7')](_0x94d6('0x11'),auth[_0x94d6('0x8')](),controller[_0x94d6('0x12')]);router['post']('/',auth[_0x94d6('0x8')](),controller[_0x94d6('0x13')]);router[_0x94d6('0x14')]('/:id/tags',auth[_0x94d6('0x8')](),controller[_0x94d6('0x15')]);router[_0x94d6('0x16')]('/:id',auth[_0x94d6('0x8')](),controller[_0x94d6('0x17')]);router['delete']('/:id',auth[_0x94d6('0x8')](),controller[_0x94d6('0x18')]);module[_0x94d6('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 5a263c2..301b03f 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 _0x5e9c=['sequelize','STRING'];(function(_0x1e937a,_0x332c6b){var _0x55c2e9=function(_0xb13833){while(--_0xb13833){_0x1e937a['push'](_0x1e937a['shift']());}};_0x55c2e9(++_0x332c6b);}(_0x5e9c,0x116));var _0xc5e9=function(_0x52fd54,_0x3b834d){_0x52fd54=_0x52fd54-0x0;var _0x4229ce=_0x5e9c[_0x52fd54];return _0x4229ce;};'use strict';var Sequelize=require(_0xc5e9('0x0'));module['exports']={'name':{'type':Sequelize[_0xc5e9('0x1')]},'description':{'type':Sequelize[_0xc5e9('0x1')]}}; \ No newline at end of file +var _0xd2cc=['sequelize','exports','STRING'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xd2cc,0x120));var _0xcd2c=function(_0x51a8c1,_0x50dd34){_0x51a8c1=_0x51a8c1-0x0;var _0x238000=_0xd2cc[_0x51a8c1];return _0x238000;};'use strict';var Sequelize=require(_0xcd2c('0x0'));module[_0xcd2c('0x1')]={'name':{'type':Sequelize[_0xcd2c('0x2')]},'description':{'type':Sequelize[_0xcd2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 10d6777..59f247b 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 _0xe3b0=['find','create','update','body','getFields','FreshdeskField','order','getSubjects','findOne','getDescriptions','Tag','getTags','setTags','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\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','destroy','name','index','map','FreshdeskConfiguration','type','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes'];(function(_0x441033,_0x28eefb){var _0x1283f4=function(_0x5863ad){while(--_0x5863ad){_0x441033['push'](_0x441033['shift']());}};_0x1283f4(++_0x28eefb);}(_0xe3b0,0x133));var _0x0e3b=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0xe3b0[_0x4017b0];return _0x5ed4f7;};'use strict';var pdf=require(_0x0e3b('0x0'));var emlformat=require(_0x0e3b('0x1'));var rimraf=require(_0x0e3b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e3b('0x3'));var rp=require(_0x0e3b('0x4'));var moment=require(_0x0e3b('0x5'));var BPromise=require(_0x0e3b('0x6'));var Mustache=require('mustache');var util=require(_0x0e3b('0x7'));var path=require(_0x0e3b('0x8'));var sox=require(_0x0e3b('0x9'));var csv=require(_0x0e3b('0xa'));var ejs=require(_0x0e3b('0xb'));var fs=require('fs');var _=require(_0x0e3b('0xc'));var squel=require(_0x0e3b('0xd'));var crypto=require(_0x0e3b('0xe'));var jsforce=require(_0x0e3b('0xf'));var deskjs=require(_0x0e3b('0x10'));var toCsv=require(_0x0e3b('0xa'));var querystring=require(_0x0e3b('0x11'));var Papa=require('papaparse');var Redis=require(_0x0e3b('0x12'));var authService=require(_0x0e3b('0x13'));var qs=require(_0x0e3b('0x14'));var as=require(_0x0e3b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e3b('0x16'))(_0x0e3b('0x17'));var utils=require(_0x0e3b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0e3b('0x19'));var db=require(_0x0e3b('0x1a'))['db'];var jayson=require(_0x0e3b('0x1b'));var client=jayson[_0x0e3b('0x1c')][_0x0e3b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5747c2,_0x1d7854,_0x4bf704,_0x55c634){return new BPromise(function(_0x4aa81f,_0x68a7ac){var _0x12088b=_0x55c634||client;return _0x12088b[_0x0e3b('0x1e')](_0x5747c2,_0x4bf704)[_0x0e3b('0x1f')](function(_0x424e3e){logger[_0x0e3b('0x20')](_0x0e3b('0x21'),_0x1d7854,_0x0e3b('0x22'));logger[_0x0e3b('0x23')](_0x0e3b('0x24'),_0x1d7854,_0x0e3b('0x22'),JSON[_0x0e3b('0x25')](_0x424e3e));if(_0x424e3e[_0x0e3b('0x26')]){if(_0x424e3e[_0x0e3b('0x26')][_0x0e3b('0x27')]===0x1f4){logger['error'](_0x0e3b('0x21'),_0x1d7854,_0x424e3e['error'][_0x0e3b('0x28')]);return _0x68a7ac(_0x424e3e['error'][_0x0e3b('0x28')]);}logger[_0x0e3b('0x26')](_0x0e3b('0x21'),_0x1d7854,_0x424e3e['error'][_0x0e3b('0x28')]);return _0x4aa81f(_0x424e3e['error']['message']);}else{logger[_0x0e3b('0x20')](_0x0e3b('0x21'),_0x1d7854,'request\x20sent');_0x4aa81f(_0x424e3e[_0x0e3b('0x29')][_0x0e3b('0x28')]);}})[_0x0e3b('0x2a')](function(_0x25ccb3){logger[_0x0e3b('0x26')](_0x0e3b('0x21'),_0x1d7854,_0x25ccb3);_0x68a7ac(_0x25ccb3);});});}function respondWithStatusCode(_0x125ba2,_0x458785){_0x458785=_0x458785||0xcc;return function(_0x3c72f2){if(_0x3c72f2){return _0x125ba2[_0x0e3b('0x2b')](_0x458785);}return _0x125ba2[_0x0e3b('0x2c')](_0x458785)[_0x0e3b('0x2d')]();};}function respondWithResult(_0x5d0620,_0xad8ae5){_0xad8ae5=_0xad8ae5||0xc8;return function(_0x35e528){if(_0x35e528){return _0x5d0620['status'](_0xad8ae5)[_0x0e3b('0x2e')](_0x35e528);}};}function respondWithFilteredResult(_0x599320,_0x570cde){return function(_0x4d3a27){if(_0x4d3a27){var _0x154f28=_0x4d3a27[_0x0e3b('0x2f')],_0x51aecf=_0x570cde[_0x0e3b('0x30')],_0x2a3221=_0x570cde[_0x0e3b('0x30')]+_0x570cde[_0x0e3b('0x31')],_0x4ebbe;if(_0x2a3221>=_0x154f28){_0x2a3221=_0x154f28;_0x4ebbe=0xc8;}else{_0x4ebbe=0xce;}_0x599320[_0x0e3b('0x2c')](_0x4ebbe);return _0x599320[_0x0e3b('0x32')](_0x0e3b('0x33'),_0x51aecf+'-'+_0x2a3221+'/'+_0x154f28)[_0x0e3b('0x2e')](_0x4d3a27);}return null;};}function patchUpdates(_0x3b0c58){return function(_0x331921){try{jsonpatch[_0x0e3b('0x34')](_0x331921,_0x3b0c58,!![]);}catch(_0x5532f0){return BPromise[_0x0e3b('0x35')](_0x5532f0);}return _0x331921[_0x0e3b('0x36')]();};}function saveUpdates(_0x3340c3,_0x521252){return function(_0x5a25e8){if(_0x5a25e8){return _0x5a25e8['update'](_0x3340c3)[_0x0e3b('0x1f')](function(_0x4249b1){return _0x4249b1;});}return null;};}function removeEntity(_0x26615e,_0x58bed5){return function(_0x1e0ce1){if(_0x1e0ce1){return _0x1e0ce1[_0x0e3b('0x37')]()[_0x0e3b('0x1f')](function(){_0x26615e[_0x0e3b('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1492fd,_0x1c0674){return function(_0x11972f){if(!_0x11972f){_0x1492fd['sendStatus'](0x194);}return _0x11972f;};}function handleError(_0xea07ec,_0x2a0743){_0x2a0743=_0x2a0743||0x1f4;return function(_0x576253){logger['error'](_0x576253['stack']);if(_0x576253[_0x0e3b('0x38')]){delete _0x576253['name'];}_0xea07ec['status'](_0x2a0743)['send'](_0x576253);};}exports[_0x0e3b('0x39')]=function(_0x2d8165,_0x3b2a4c){var _0x4b831d={},_0x43073d={},_0x22f92f={'count':0x0,'rows':[]};var _0x290141=_[_0x0e3b('0x3a')](db[_0x0e3b('0x3b')]['rawAttributes'],function(_0x260110){return{'name':_0x260110['fieldName'],'type':_0x260110[_0x0e3b('0x3c')]['key']};});_0x43073d['model']=_[_0x0e3b('0x3a')](_0x290141,'name');_0x43073d[_0x0e3b('0x3d')]=_[_0x0e3b('0x3e')](_0x2d8165[_0x0e3b('0x3d')]);_0x43073d[_0x0e3b('0x3f')]=_[_0x0e3b('0x40')](_0x43073d['model'],_0x43073d['query']);_0x4b831d[_0x0e3b('0x41')]=_['intersection'](_0x43073d['model'],qs[_0x0e3b('0x42')](_0x2d8165[_0x0e3b('0x3d')]['fields']));_0x4b831d[_0x0e3b('0x41')]=_0x4b831d['attributes'][_0x0e3b('0x43')]?_0x4b831d[_0x0e3b('0x41')]:_0x43073d[_0x0e3b('0x44')];if(!_0x2d8165[_0x0e3b('0x3d')][_0x0e3b('0x45')](_0x0e3b('0x46'))){_0x4b831d[_0x0e3b('0x31')]=qs[_0x0e3b('0x31')](_0x2d8165[_0x0e3b('0x3d')]['limit']);_0x4b831d[_0x0e3b('0x30')]=qs[_0x0e3b('0x30')](_0x2d8165[_0x0e3b('0x3d')][_0x0e3b('0x30')]);}_0x4b831d['order']=qs[_0x0e3b('0x47')](_0x2d8165[_0x0e3b('0x3d')][_0x0e3b('0x47')]);_0x4b831d[_0x0e3b('0x48')]=qs[_0x0e3b('0x3f')](_[_0x0e3b('0x49')](_0x2d8165[_0x0e3b('0x3d')],_0x43073d[_0x0e3b('0x3f')]),_0x290141);if(_0x2d8165[_0x0e3b('0x3d')][_0x0e3b('0x4a')]){_0x4b831d['where']=_[_0x0e3b('0x4b')](_0x4b831d[_0x0e3b('0x48')],{'$or':_[_0x0e3b('0x3a')](_0x290141,function(_0x4a38a2){if(_0x4a38a2[_0x0e3b('0x3c')]!==_0x0e3b('0x4c')){var _0x3f77a4={};_0x3f77a4[_0x4a38a2[_0x0e3b('0x38')]]={'$like':'%'+_0x2d8165[_0x0e3b('0x3d')][_0x0e3b('0x4a')]+'%'};return _0x3f77a4;}})});}_0x4b831d=_[_0x0e3b('0x4b')]({},_0x4b831d,_0x2d8165[_0x0e3b('0x4d')]);var _0x57b506={'where':_0x4b831d[_0x0e3b('0x48')]};return db[_0x0e3b('0x3b')][_0x0e3b('0x2f')](_0x57b506)[_0x0e3b('0x1f')](function(_0x13647a){_0x22f92f[_0x0e3b('0x2f')]=_0x13647a;if(_0x2d8165['query'][_0x0e3b('0x4e')]){_0x4b831d[_0x0e3b('0x4f')]=[{'all':!![]}];}return db[_0x0e3b('0x3b')][_0x0e3b('0x50')](_0x4b831d);})[_0x0e3b('0x1f')](function(_0x252765){_0x22f92f[_0x0e3b('0x51')]=_0x252765;return _0x22f92f;})[_0x0e3b('0x1f')](respondWithFilteredResult(_0x3b2a4c,_0x4b831d))[_0x0e3b('0x2a')](handleError(_0x3b2a4c,null));};exports[_0x0e3b('0x52')]=function(_0x5c0c9a,_0x313440){var _0x14a22d={'raw':![],'where':{'id':_0x5c0c9a[_0x0e3b('0x53')]['id']}},_0x426297={};_0x426297[_0x0e3b('0x44')]=_[_0x0e3b('0x3e')](db[_0x0e3b('0x3b')][_0x0e3b('0x54')]);_0x426297[_0x0e3b('0x3d')]=_['keys'](_0x5c0c9a[_0x0e3b('0x3d')]);_0x426297['filters']=_['intersection'](_0x426297[_0x0e3b('0x44')],_0x426297[_0x0e3b('0x3d')]);_0x14a22d['attributes']=_[_0x0e3b('0x40')](_0x426297['model'],qs[_0x0e3b('0x42')](_0x5c0c9a[_0x0e3b('0x3d')][_0x0e3b('0x42')]));_0x14a22d[_0x0e3b('0x41')]=_0x14a22d[_0x0e3b('0x41')][_0x0e3b('0x43')]?_0x14a22d[_0x0e3b('0x41')]:_0x426297[_0x0e3b('0x44')];if(_0x5c0c9a['query'][_0x0e3b('0x4e')]){_0x14a22d[_0x0e3b('0x4f')]=[{'all':!![]}];}_0x14a22d=_['merge']({},_0x14a22d,_0x5c0c9a[_0x0e3b('0x4d')]);return db[_0x0e3b('0x3b')][_0x0e3b('0x55')](_0x14a22d)[_0x0e3b('0x1f')](handleEntityNotFound(_0x313440,null))['then'](respondWithResult(_0x313440,null))['catch'](handleError(_0x313440,null));};exports[_0x0e3b('0x56')]=function(_0x9dfef,_0x342b5f){return db[_0x0e3b('0x3b')]['create'](_0x9dfef['body'],{})[_0x0e3b('0x1f')](respondWithResult(_0x342b5f,0xc9))[_0x0e3b('0x2a')](handleError(_0x342b5f,null));};exports[_0x0e3b('0x57')]=function(_0x11961e,_0x12ddb2){if(_0x11961e[_0x0e3b('0x58')]['id']){delete _0x11961e[_0x0e3b('0x58')]['id'];}return db['FreshdeskConfiguration'][_0x0e3b('0x55')]({'where':{'id':_0x11961e[_0x0e3b('0x53')]['id']}})[_0x0e3b('0x1f')](handleEntityNotFound(_0x12ddb2,null))[_0x0e3b('0x1f')](saveUpdates(_0x11961e['body'],null))['then'](respondWithResult(_0x12ddb2,null))['catch'](handleError(_0x12ddb2,null));};exports[_0x0e3b('0x37')]=function(_0x1e13f5,_0x4ae405){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x1e13f5[_0x0e3b('0x53')]['id']}})[_0x0e3b('0x1f')](handleEntityNotFound(_0x4ae405,null))['then'](removeEntity(_0x4ae405,null))[_0x0e3b('0x2a')](handleError(_0x4ae405,null));};exports[_0x0e3b('0x59')]=function(_0x4655c6,_0x3252cc,_0x19be15){var _0x38c5ae={};var _0x333855={};var _0x2a5102;var _0x559014;return db[_0x0e3b('0x3b')]['findOne']({'where':{'id':_0x4655c6[_0x0e3b('0x53')]['id']}})[_0x0e3b('0x1f')](handleEntityNotFound(_0x3252cc,null))[_0x0e3b('0x1f')](function(_0x138f7a){if(_0x138f7a){_0x2a5102=_0x138f7a;_0x333855[_0x0e3b('0x44')]=_[_0x0e3b('0x3e')](db[_0x0e3b('0x5a')][_0x0e3b('0x54')]);_0x333855['query']=_[_0x0e3b('0x3e')](_0x4655c6[_0x0e3b('0x3d')]);_0x333855['filters']=_['intersection'](_0x333855[_0x0e3b('0x44')],_0x333855['query']);_0x38c5ae[_0x0e3b('0x41')]=_[_0x0e3b('0x40')](_0x333855[_0x0e3b('0x44')],qs[_0x0e3b('0x42')](_0x4655c6[_0x0e3b('0x3d')]['fields']));_0x38c5ae[_0x0e3b('0x41')]=_0x38c5ae['attributes']['length']?_0x38c5ae['attributes']:_0x333855[_0x0e3b('0x44')];_0x38c5ae[_0x0e3b('0x5b')]=qs['sort'](_0x4655c6[_0x0e3b('0x3d')][_0x0e3b('0x47')]);_0x38c5ae[_0x0e3b('0x48')]=qs[_0x0e3b('0x3f')](_['pick'](_0x4655c6['query'],_0x333855[_0x0e3b('0x3f')]));if(_0x4655c6[_0x0e3b('0x3d')][_0x0e3b('0x4a')]){_0x38c5ae[_0x0e3b('0x48')]=_['merge'](_0x38c5ae['where'],{'$or':_[_0x0e3b('0x3a')](_0x38c5ae[_0x0e3b('0x41')],function(_0x5513a2){var _0x5f6919={};_0x5f6919[_0x5513a2]={'$like':'%'+_0x4655c6[_0x0e3b('0x3d')][_0x0e3b('0x4a')]+'%'};return _0x5f6919;})});}_0x38c5ae=_[_0x0e3b('0x4b')]({},_0x38c5ae,_0x4655c6[_0x0e3b('0x4d')]);return _0x2a5102[_0x0e3b('0x59')](_0x38c5ae);}})['then'](function(_0xeaf9c0){if(_0xeaf9c0){_0x559014=_0xeaf9c0[_0x0e3b('0x43')];if(!_0x4655c6['query'][_0x0e3b('0x45')](_0x0e3b('0x46'))){_0x38c5ae['limit']=qs['limit'](_0x4655c6[_0x0e3b('0x3d')][_0x0e3b('0x31')]);_0x38c5ae['offset']=qs[_0x0e3b('0x30')](_0x4655c6[_0x0e3b('0x3d')][_0x0e3b('0x30')]);}return _0x2a5102[_0x0e3b('0x59')](_0x38c5ae);}})[_0x0e3b('0x1f')](function(_0x16ea24){if(_0x16ea24){return _0x16ea24?{'count':_0x559014,'rows':_0x16ea24}:null;}})['then'](respondWithResult(_0x3252cc,null))[_0x0e3b('0x2a')](handleError(_0x3252cc,null));};exports[_0x0e3b('0x5c')]=function(_0x2e7ade,_0x19868c,_0x314b38){var _0x3be4e3={};var _0x382361={};var _0xd6d6e4;var _0x3b76e3;return db[_0x0e3b('0x3b')][_0x0e3b('0x5d')]({'where':{'id':_0x2e7ade[_0x0e3b('0x53')]['id']}})[_0x0e3b('0x1f')](handleEntityNotFound(_0x19868c,null))[_0x0e3b('0x1f')](function(_0x405260){if(_0x405260){_0xd6d6e4=_0x405260;_0x382361[_0x0e3b('0x44')]=_[_0x0e3b('0x3e')](db['FreshdeskField'][_0x0e3b('0x54')]);_0x382361[_0x0e3b('0x3d')]=_['keys'](_0x2e7ade[_0x0e3b('0x3d')]);_0x382361[_0x0e3b('0x3f')]=_[_0x0e3b('0x40')](_0x382361[_0x0e3b('0x44')],_0x382361[_0x0e3b('0x3d')]);_0x3be4e3[_0x0e3b('0x41')]=_['intersection'](_0x382361[_0x0e3b('0x44')],qs[_0x0e3b('0x42')](_0x2e7ade[_0x0e3b('0x3d')][_0x0e3b('0x42')]));_0x3be4e3[_0x0e3b('0x41')]=_0x3be4e3[_0x0e3b('0x41')][_0x0e3b('0x43')]?_0x3be4e3[_0x0e3b('0x41')]:_0x382361[_0x0e3b('0x44')];_0x3be4e3[_0x0e3b('0x5b')]=qs[_0x0e3b('0x47')](_0x2e7ade[_0x0e3b('0x3d')][_0x0e3b('0x47')]);_0x3be4e3[_0x0e3b('0x48')]=qs[_0x0e3b('0x3f')](_[_0x0e3b('0x49')](_0x2e7ade['query'],_0x382361[_0x0e3b('0x3f')]));if(_0x2e7ade[_0x0e3b('0x3d')][_0x0e3b('0x4a')]){_0x3be4e3[_0x0e3b('0x48')]=_[_0x0e3b('0x4b')](_0x3be4e3[_0x0e3b('0x48')],{'$or':_[_0x0e3b('0x3a')](_0x3be4e3[_0x0e3b('0x41')],function(_0x28aff9){var _0x55a849={};_0x55a849[_0x28aff9]={'$like':'%'+_0x2e7ade[_0x0e3b('0x3d')][_0x0e3b('0x4a')]+'%'};return _0x55a849;})});}_0x3be4e3=_[_0x0e3b('0x4b')]({},_0x3be4e3,_0x2e7ade[_0x0e3b('0x4d')]);return _0xd6d6e4[_0x0e3b('0x5c')](_0x3be4e3);}})['then'](function(_0x518fc2){if(_0x518fc2){_0x3b76e3=_0x518fc2[_0x0e3b('0x43')];if(!_0x2e7ade[_0x0e3b('0x3d')][_0x0e3b('0x45')](_0x0e3b('0x46'))){_0x3be4e3['limit']=qs[_0x0e3b('0x31')](_0x2e7ade['query']['limit']);_0x3be4e3[_0x0e3b('0x30')]=qs[_0x0e3b('0x30')](_0x2e7ade['query']['offset']);}return _0xd6d6e4[_0x0e3b('0x5c')](_0x3be4e3);}})[_0x0e3b('0x1f')](function(_0x114017){if(_0x114017){return _0x114017?{'count':_0x3b76e3,'rows':_0x114017}:null;}})['then'](respondWithResult(_0x19868c,null))[_0x0e3b('0x2a')](handleError(_0x19868c,null));};exports[_0x0e3b('0x5e')]=function(_0x5bcb5c,_0x283e18,_0x477bb2){var _0x3da1a6={};var _0x1c88bc={};var _0x4ec30b;var _0x81cde6;return db[_0x0e3b('0x3b')][_0x0e3b('0x5d')]({'where':{'id':_0x5bcb5c[_0x0e3b('0x53')]['id']}})['then'](handleEntityNotFound(_0x283e18,null))[_0x0e3b('0x1f')](function(_0x2d219e){if(_0x2d219e){_0x4ec30b=_0x2d219e;_0x1c88bc['model']=_[_0x0e3b('0x3e')](db[_0x0e3b('0x5a')][_0x0e3b('0x54')]);_0x1c88bc[_0x0e3b('0x3d')]=_[_0x0e3b('0x3e')](_0x5bcb5c['query']);_0x1c88bc[_0x0e3b('0x3f')]=_[_0x0e3b('0x40')](_0x1c88bc['model'],_0x1c88bc[_0x0e3b('0x3d')]);_0x3da1a6[_0x0e3b('0x41')]=_[_0x0e3b('0x40')](_0x1c88bc['model'],qs[_0x0e3b('0x42')](_0x5bcb5c[_0x0e3b('0x3d')]['fields']));_0x3da1a6['attributes']=_0x3da1a6[_0x0e3b('0x41')][_0x0e3b('0x43')]?_0x3da1a6[_0x0e3b('0x41')]:_0x1c88bc['model'];_0x3da1a6[_0x0e3b('0x5b')]=qs['sort'](_0x5bcb5c['query']['sort']);_0x3da1a6[_0x0e3b('0x48')]=qs[_0x0e3b('0x3f')](_['pick'](_0x5bcb5c[_0x0e3b('0x3d')],_0x1c88bc[_0x0e3b('0x3f')]));if(_0x5bcb5c['query'][_0x0e3b('0x4a')]){_0x3da1a6[_0x0e3b('0x48')]=_['merge'](_0x3da1a6[_0x0e3b('0x48')],{'$or':_[_0x0e3b('0x3a')](_0x3da1a6['attributes'],function(_0x20e8d4){var _0x341fb9={};_0x341fb9[_0x20e8d4]={'$like':'%'+_0x5bcb5c[_0x0e3b('0x3d')][_0x0e3b('0x4a')]+'%'};return _0x341fb9;})});}_0x3da1a6=_['merge']({},_0x3da1a6,_0x5bcb5c[_0x0e3b('0x4d')]);return _0x4ec30b[_0x0e3b('0x5e')](_0x3da1a6);}})['then'](function(_0xa91cab){if(_0xa91cab){_0x81cde6=_0xa91cab[_0x0e3b('0x43')];if(!_0x5bcb5c[_0x0e3b('0x3d')][_0x0e3b('0x45')](_0x0e3b('0x46'))){_0x3da1a6[_0x0e3b('0x31')]=qs['limit'](_0x5bcb5c[_0x0e3b('0x3d')][_0x0e3b('0x31')]);_0x3da1a6['offset']=qs['offset'](_0x5bcb5c['query'][_0x0e3b('0x30')]);}return _0x4ec30b[_0x0e3b('0x5e')](_0x3da1a6);}})['then'](function(_0x1eb82e){if(_0x1eb82e){return _0x1eb82e?{'count':_0x81cde6,'rows':_0x1eb82e}:null;}})[_0x0e3b('0x1f')](respondWithResult(_0x283e18,null))['catch'](handleError(_0x283e18,null));};exports['getTags']=function(_0x20d569,_0x731aeb,_0x11192d){var _0x45c218={};var _0x5ee208={};var _0xb5d25d;var _0x2362cd;return db['FreshdeskConfiguration'][_0x0e3b('0x5d')]({'where':{'id':_0x20d569['params']['id']}})[_0x0e3b('0x1f')](handleEntityNotFound(_0x731aeb,null))[_0x0e3b('0x1f')](function(_0x1c23e1){if(_0x1c23e1){_0xb5d25d=_0x1c23e1;_0x5ee208[_0x0e3b('0x44')]=_['keys'](db[_0x0e3b('0x5f')][_0x0e3b('0x54')]);_0x5ee208['query']=_[_0x0e3b('0x3e')](_0x20d569[_0x0e3b('0x3d')]);_0x5ee208[_0x0e3b('0x3f')]=_[_0x0e3b('0x40')](_0x5ee208['model'],_0x5ee208[_0x0e3b('0x3d')]);_0x45c218['attributes']=_[_0x0e3b('0x40')](_0x5ee208[_0x0e3b('0x44')],qs[_0x0e3b('0x42')](_0x20d569['query'][_0x0e3b('0x42')]));_0x45c218[_0x0e3b('0x41')]=_0x45c218['attributes'][_0x0e3b('0x43')]?_0x45c218['attributes']:_0x5ee208[_0x0e3b('0x44')];_0x45c218[_0x0e3b('0x5b')]=qs[_0x0e3b('0x47')](_0x20d569[_0x0e3b('0x3d')][_0x0e3b('0x47')]);_0x45c218[_0x0e3b('0x48')]=qs[_0x0e3b('0x3f')](_[_0x0e3b('0x49')](_0x20d569['query'],_0x5ee208[_0x0e3b('0x3f')]));if(_0x20d569['query'][_0x0e3b('0x4a')]){_0x45c218[_0x0e3b('0x48')]=_[_0x0e3b('0x4b')](_0x45c218[_0x0e3b('0x48')],{'$or':_[_0x0e3b('0x3a')](_0x45c218[_0x0e3b('0x41')],function(_0x5afe62){var _0x521d08={};_0x521d08[_0x5afe62]={'$like':'%'+_0x20d569[_0x0e3b('0x3d')][_0x0e3b('0x4a')]+'%'};return _0x521d08;})});}_0x45c218=_[_0x0e3b('0x4b')]({},_0x45c218,_0x20d569[_0x0e3b('0x4d')]);return _0xb5d25d[_0x0e3b('0x60')](_0x45c218);}})['then'](function(_0x462966){if(_0x462966){_0x2362cd=_0x462966[_0x0e3b('0x43')];if(!_0x20d569[_0x0e3b('0x3d')][_0x0e3b('0x45')](_0x0e3b('0x46'))){_0x45c218[_0x0e3b('0x31')]=qs[_0x0e3b('0x31')](_0x20d569[_0x0e3b('0x3d')][_0x0e3b('0x31')]);_0x45c218[_0x0e3b('0x30')]=qs[_0x0e3b('0x30')](_0x20d569[_0x0e3b('0x3d')][_0x0e3b('0x30')]);}return _0xb5d25d[_0x0e3b('0x60')](_0x45c218);}})['then'](function(_0x33ac19){if(_0x33ac19){return _0x33ac19?{'count':_0x2362cd,'rows':_0x33ac19}:null;}})[_0x0e3b('0x1f')](respondWithResult(_0x731aeb,null))[_0x0e3b('0x2a')](handleError(_0x731aeb,null));};exports[_0x0e3b('0x61')]=function(_0x9493f5,_0x284907,_0xc2ec37){if(_0x9493f5[_0x0e3b('0x58')]['id']){delete _0x9493f5['body']['id'];}return db[_0x0e3b('0x3b')]['findOne']({'where':{'id':_0x9493f5[_0x0e3b('0x53')]['id']}})[_0x0e3b('0x1f')](handleEntityNotFound(_0x284907,null))['then'](function(_0x1146b9){if(_0x1146b9){return _0x1146b9[_0x0e3b('0x61')](_0x9493f5[_0x0e3b('0x58')]['ids']||[]);}return null;})['then'](respondWithResult(_0x284907,null))[_0x0e3b('0x2a')](handleError(_0x284907,null));}; \ No newline at end of file +var _0x2aa2=['order','sort','filter','where','merge','type','VIRTUAL','findAll','rows','params','rawAttributes','includeAll','options','create','body','find','destroy','getFields','findOne','pick','hasOwnProperty','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','FreshdeskConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x2b44d4,_0x28df70){var _0x44fdaf=function(_0x50c772){while(--_0x50c772){_0x2b44d4['push'](_0x2b44d4['shift']());}};_0x44fdaf(++_0x28df70);}(_0x2aa2,0xcf));var _0x22aa=function(_0x568eca,_0x549174){_0x568eca=_0x568eca-0x0;var _0x767192=_0x2aa2[_0x568eca];return _0x767192;};'use strict';var pdf=require(_0x22aa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x22aa('0x1'));var zipdir=require(_0x22aa('0x2'));var jsonpatch=require(_0x22aa('0x3'));var rp=require(_0x22aa('0x4'));var moment=require('moment');var BPromise=require(_0x22aa('0x5'));var Mustache=require(_0x22aa('0x6'));var util=require(_0x22aa('0x7'));var path=require(_0x22aa('0x8'));var sox=require(_0x22aa('0x9'));var csv=require('to-csv');var ejs=require(_0x22aa('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x22aa('0xb'));var jsforce=require(_0x22aa('0xc'));var deskjs=require(_0x22aa('0xd'));var toCsv=require(_0x22aa('0xe'));var querystring=require(_0x22aa('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x22aa('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x22aa('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x22aa('0x12'))('api');var utils=require(_0x22aa('0x13'));var config=require(_0x22aa('0x14'));var licenseUtil=require(_0x22aa('0x15'));var db=require(_0x22aa('0x16'))['db'];var jayson=require(_0x22aa('0x17'));var client=jayson['client'][_0x22aa('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3452a6,_0x3cf531,_0x49aea5,_0x1df4bb){return new BPromise(function(_0x4f2b75,_0x982acb){var _0x907979=_0x1df4bb||client;return _0x907979['request'](_0x3452a6,_0x49aea5)['then'](function(_0x247a84){logger[_0x22aa('0x19')](_0x22aa('0x1a'),_0x3cf531,'request\x20sent');logger[_0x22aa('0x1b')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3cf531,_0x22aa('0x1c'),JSON['stringify'](_0x247a84));if(_0x247a84[_0x22aa('0x1d')]){if(_0x247a84[_0x22aa('0x1d')][_0x22aa('0x1e')]===0x1f4){logger['error'](_0x22aa('0x1a'),_0x3cf531,_0x247a84['error'][_0x22aa('0x1f')]);return _0x982acb(_0x247a84[_0x22aa('0x1d')]['message']);}logger['error'](_0x22aa('0x1a'),_0x3cf531,_0x247a84['error'][_0x22aa('0x1f')]);return _0x4f2b75(_0x247a84['error'][_0x22aa('0x1f')]);}else{logger[_0x22aa('0x19')](_0x22aa('0x1a'),_0x3cf531,'request\x20sent');_0x4f2b75(_0x247a84[_0x22aa('0x20')][_0x22aa('0x1f')]);}})[_0x22aa('0x21')](function(_0x40791f){logger[_0x22aa('0x1d')](_0x22aa('0x1a'),_0x3cf531,_0x40791f);_0x982acb(_0x40791f);});});}function respondWithStatusCode(_0x5684b3,_0x4f6d93){_0x4f6d93=_0x4f6d93||0xcc;return function(_0x42149f){if(_0x42149f){return _0x5684b3[_0x22aa('0x22')](_0x4f6d93);}return _0x5684b3[_0x22aa('0x23')](_0x4f6d93)[_0x22aa('0x24')]();};}function respondWithResult(_0x24d8b1,_0x43f73d){_0x43f73d=_0x43f73d||0xc8;return function(_0x17b148){if(_0x17b148){return _0x24d8b1[_0x22aa('0x23')](_0x43f73d)['json'](_0x17b148);}};}function respondWithFilteredResult(_0x117bf0,_0x83a92d){return function(_0x53c336){if(_0x53c336){var _0x4277e5=_0x53c336[_0x22aa('0x25')],_0x44a6d9=_0x83a92d[_0x22aa('0x26')],_0x1b80a8=_0x83a92d[_0x22aa('0x26')]+_0x83a92d[_0x22aa('0x27')],_0x2861b3;if(_0x1b80a8>=_0x4277e5){_0x1b80a8=_0x4277e5;_0x2861b3=0xc8;}else{_0x2861b3=0xce;}_0x117bf0['status'](_0x2861b3);return _0x117bf0['set'](_0x22aa('0x28'),_0x44a6d9+'-'+_0x1b80a8+'/'+_0x4277e5)['json'](_0x53c336);}return null;};}function patchUpdates(_0x116282){return function(_0x427de6){try{jsonpatch[_0x22aa('0x29')](_0x427de6,_0x116282,!![]);}catch(_0x556cbd){return BPromise[_0x22aa('0x2a')](_0x556cbd);}return _0x427de6[_0x22aa('0x2b')]();};}function saveUpdates(_0x74842b,_0x2fa2d3){return function(_0x530518){if(_0x530518){return _0x530518[_0x22aa('0x2c')](_0x74842b)[_0x22aa('0x2d')](function(_0x552123){return _0x552123;});}return null;};}function removeEntity(_0x9359f8,_0x3bd423){return function(_0x505d33){if(_0x505d33){return _0x505d33['destroy']()[_0x22aa('0x2d')](function(){_0x9359f8['status'](0xcc)[_0x22aa('0x24')]();});}};}function handleEntityNotFound(_0x10bed3,_0x5440d4){return function(_0x659683){if(!_0x659683){_0x10bed3['sendStatus'](0x194);}return _0x659683;};}function handleError(_0x3df540,_0x5dcee2){_0x5dcee2=_0x5dcee2||0x1f4;return function(_0x30cbc7){logger[_0x22aa('0x1d')](_0x30cbc7[_0x22aa('0x2e')]);if(_0x30cbc7[_0x22aa('0x2f')]){delete _0x30cbc7[_0x22aa('0x2f')];}_0x3df540['status'](_0x5dcee2)[_0x22aa('0x30')](_0x30cbc7);};}exports[_0x22aa('0x31')]=function(_0xdd4b61,_0x3458c9){var _0x36149f={},_0x32a6fb={},_0x3df9a6={'count':0x0,'rows':[]};var _0x2ff8f7=_[_0x22aa('0x32')](db[_0x22aa('0x33')]['rawAttributes'],function(_0x494c86){return{'name':_0x494c86[_0x22aa('0x34')],'type':_0x494c86['type'][_0x22aa('0x35')]};});_0x32a6fb[_0x22aa('0x36')]=_[_0x22aa('0x32')](_0x2ff8f7,'name');_0x32a6fb[_0x22aa('0x37')]=_[_0x22aa('0x38')](_0xdd4b61[_0x22aa('0x37')]);_0x32a6fb[_0x22aa('0x39')]=_[_0x22aa('0x3a')](_0x32a6fb['model'],_0x32a6fb[_0x22aa('0x37')]);_0x36149f[_0x22aa('0x3b')]=_[_0x22aa('0x3a')](_0x32a6fb['model'],qs[_0x22aa('0x3c')](_0xdd4b61[_0x22aa('0x37')][_0x22aa('0x3c')]));_0x36149f[_0x22aa('0x3b')]=_0x36149f['attributes'][_0x22aa('0x3d')]?_0x36149f[_0x22aa('0x3b')]:_0x32a6fb['model'];if(!_0xdd4b61['query']['hasOwnProperty'](_0x22aa('0x3e'))){_0x36149f['limit']=qs[_0x22aa('0x27')](_0xdd4b61[_0x22aa('0x37')]['limit']);_0x36149f[_0x22aa('0x26')]=qs[_0x22aa('0x26')](_0xdd4b61[_0x22aa('0x37')][_0x22aa('0x26')]);}_0x36149f[_0x22aa('0x3f')]=qs[_0x22aa('0x40')](_0xdd4b61[_0x22aa('0x37')][_0x22aa('0x40')]);_0x36149f['where']=qs[_0x22aa('0x39')](_['pick'](_0xdd4b61['query'],_0x32a6fb[_0x22aa('0x39')]),_0x2ff8f7);if(_0xdd4b61['query'][_0x22aa('0x41')]){_0x36149f[_0x22aa('0x42')]=_[_0x22aa('0x43')](_0x36149f[_0x22aa('0x42')],{'$or':_[_0x22aa('0x32')](_0x2ff8f7,function(_0x682064){if(_0x682064[_0x22aa('0x44')]!==_0x22aa('0x45')){var _0x294804={};_0x294804[_0x682064[_0x22aa('0x2f')]]={'$like':'%'+_0xdd4b61[_0x22aa('0x37')][_0x22aa('0x41')]+'%'};return _0x294804;}})});}_0x36149f=_[_0x22aa('0x43')]({},_0x36149f,_0xdd4b61['options']);var _0x1adc85={'where':_0x36149f['where']};return db[_0x22aa('0x33')][_0x22aa('0x25')](_0x1adc85)[_0x22aa('0x2d')](function(_0x35e70c){_0x3df9a6[_0x22aa('0x25')]=_0x35e70c;if(_0xdd4b61[_0x22aa('0x37')]['includeAll']){_0x36149f['include']=[{'all':!![]}];}return db[_0x22aa('0x33')][_0x22aa('0x46')](_0x36149f);})[_0x22aa('0x2d')](function(_0x5cb264){_0x3df9a6[_0x22aa('0x47')]=_0x5cb264;return _0x3df9a6;})[_0x22aa('0x2d')](respondWithFilteredResult(_0x3458c9,_0x36149f))['catch'](handleError(_0x3458c9,null));};exports['show']=function(_0x22c9d8,_0x2a92c4){var _0x2b2c91={'raw':![],'where':{'id':_0x22c9d8[_0x22aa('0x48')]['id']}},_0x2a491e={};_0x2a491e['model']=_[_0x22aa('0x38')](db[_0x22aa('0x33')][_0x22aa('0x49')]);_0x2a491e[_0x22aa('0x37')]=_[_0x22aa('0x38')](_0x22c9d8['query']);_0x2a491e[_0x22aa('0x39')]=_[_0x22aa('0x3a')](_0x2a491e[_0x22aa('0x36')],_0x2a491e[_0x22aa('0x37')]);_0x2b2c91[_0x22aa('0x3b')]=_[_0x22aa('0x3a')](_0x2a491e[_0x22aa('0x36')],qs['fields'](_0x22c9d8[_0x22aa('0x37')][_0x22aa('0x3c')]));_0x2b2c91[_0x22aa('0x3b')]=_0x2b2c91[_0x22aa('0x3b')][_0x22aa('0x3d')]?_0x2b2c91[_0x22aa('0x3b')]:_0x2a491e[_0x22aa('0x36')];if(_0x22c9d8[_0x22aa('0x37')][_0x22aa('0x4a')]){_0x2b2c91['include']=[{'all':!![]}];}_0x2b2c91=_[_0x22aa('0x43')]({},_0x2b2c91,_0x22c9d8[_0x22aa('0x4b')]);return db[_0x22aa('0x33')]['find'](_0x2b2c91)['then'](handleEntityNotFound(_0x2a92c4,null))['then'](respondWithResult(_0x2a92c4,null))['catch'](handleError(_0x2a92c4,null));};exports[_0x22aa('0x4c')]=function(_0x4d0c56,_0x48fe44){return db['FreshdeskConfiguration']['create'](_0x4d0c56['body'],{})[_0x22aa('0x2d')](respondWithResult(_0x48fe44,0xc9))['catch'](handleError(_0x48fe44,null));};exports[_0x22aa('0x2c')]=function(_0x220c90,_0x2fcd56){if(_0x220c90[_0x22aa('0x4d')]['id']){delete _0x220c90[_0x22aa('0x4d')]['id'];}return db['FreshdeskConfiguration'][_0x22aa('0x4e')]({'where':{'id':_0x220c90[_0x22aa('0x48')]['id']}})[_0x22aa('0x2d')](handleEntityNotFound(_0x2fcd56,null))[_0x22aa('0x2d')](saveUpdates(_0x220c90['body'],null))[_0x22aa('0x2d')](respondWithResult(_0x2fcd56,null))['catch'](handleError(_0x2fcd56,null));};exports[_0x22aa('0x4f')]=function(_0x524865,_0x490606){return db[_0x22aa('0x33')][_0x22aa('0x4e')]({'where':{'id':_0x524865['params']['id']}})['then'](handleEntityNotFound(_0x490606,null))[_0x22aa('0x2d')](removeEntity(_0x490606,null))[_0x22aa('0x21')](handleError(_0x490606,null));};exports[_0x22aa('0x50')]=function(_0x1fb703,_0x3e7059,_0x1139a8){var _0x3a296e={};var _0x531ae1={};var _0x1cfcb0;var _0x4ca27b;return db[_0x22aa('0x33')][_0x22aa('0x51')]({'where':{'id':_0x1fb703['params']['id']}})[_0x22aa('0x2d')](handleEntityNotFound(_0x3e7059,null))[_0x22aa('0x2d')](function(_0x49bb5c){if(_0x49bb5c){_0x1cfcb0=_0x49bb5c;_0x531ae1[_0x22aa('0x36')]=_['keys'](db['FreshdeskField'][_0x22aa('0x49')]);_0x531ae1[_0x22aa('0x37')]=_[_0x22aa('0x38')](_0x1fb703[_0x22aa('0x37')]);_0x531ae1[_0x22aa('0x39')]=_[_0x22aa('0x3a')](_0x531ae1[_0x22aa('0x36')],_0x531ae1[_0x22aa('0x37')]);_0x3a296e[_0x22aa('0x3b')]=_[_0x22aa('0x3a')](_0x531ae1[_0x22aa('0x36')],qs[_0x22aa('0x3c')](_0x1fb703['query'][_0x22aa('0x3c')]));_0x3a296e['attributes']=_0x3a296e['attributes'][_0x22aa('0x3d')]?_0x3a296e[_0x22aa('0x3b')]:_0x531ae1[_0x22aa('0x36')];_0x3a296e['order']=qs[_0x22aa('0x40')](_0x1fb703['query'][_0x22aa('0x40')]);_0x3a296e[_0x22aa('0x42')]=qs[_0x22aa('0x39')](_[_0x22aa('0x52')](_0x1fb703['query'],_0x531ae1[_0x22aa('0x39')]));if(_0x1fb703[_0x22aa('0x37')]['filter']){_0x3a296e[_0x22aa('0x42')]=_['merge'](_0x3a296e[_0x22aa('0x42')],{'$or':_[_0x22aa('0x32')](_0x3a296e[_0x22aa('0x3b')],function(_0x42a947){var _0x4f6fa9={};_0x4f6fa9[_0x42a947]={'$like':'%'+_0x1fb703[_0x22aa('0x37')][_0x22aa('0x41')]+'%'};return _0x4f6fa9;})});}_0x3a296e=_['merge']({},_0x3a296e,_0x1fb703['options']);return _0x1cfcb0[_0x22aa('0x50')](_0x3a296e);}})[_0x22aa('0x2d')](function(_0x5ce0e2){if(_0x5ce0e2){_0x4ca27b=_0x5ce0e2['length'];if(!_0x1fb703['query'][_0x22aa('0x53')](_0x22aa('0x3e'))){_0x3a296e[_0x22aa('0x27')]=qs['limit'](_0x1fb703[_0x22aa('0x37')]['limit']);_0x3a296e[_0x22aa('0x26')]=qs[_0x22aa('0x26')](_0x1fb703['query'][_0x22aa('0x26')]);}return _0x1cfcb0['getFields'](_0x3a296e);}})['then'](function(_0x17d64f){if(_0x17d64f){return _0x17d64f?{'count':_0x4ca27b,'rows':_0x17d64f}:null;}})['then'](respondWithResult(_0x3e7059,null))[_0x22aa('0x21')](handleError(_0x3e7059,null));};exports[_0x22aa('0x54')]=function(_0x3b9c98,_0x57299a,_0x32dd04){var _0x39d8db={};var _0x48b295={};var _0x2dd921;var _0x4d7aa6;return db[_0x22aa('0x33')][_0x22aa('0x51')]({'where':{'id':_0x3b9c98[_0x22aa('0x48')]['id']}})[_0x22aa('0x2d')](handleEntityNotFound(_0x57299a,null))[_0x22aa('0x2d')](function(_0x17c50e){if(_0x17c50e){_0x2dd921=_0x17c50e;_0x48b295[_0x22aa('0x36')]=_[_0x22aa('0x38')](db[_0x22aa('0x55')][_0x22aa('0x49')]);_0x48b295[_0x22aa('0x37')]=_[_0x22aa('0x38')](_0x3b9c98['query']);_0x48b295[_0x22aa('0x39')]=_['intersection'](_0x48b295[_0x22aa('0x36')],_0x48b295[_0x22aa('0x37')]);_0x39d8db['attributes']=_[_0x22aa('0x3a')](_0x48b295[_0x22aa('0x36')],qs['fields'](_0x3b9c98[_0x22aa('0x37')][_0x22aa('0x3c')]));_0x39d8db[_0x22aa('0x3b')]=_0x39d8db[_0x22aa('0x3b')][_0x22aa('0x3d')]?_0x39d8db['attributes']:_0x48b295[_0x22aa('0x36')];_0x39d8db[_0x22aa('0x3f')]=qs[_0x22aa('0x40')](_0x3b9c98[_0x22aa('0x37')][_0x22aa('0x40')]);_0x39d8db[_0x22aa('0x42')]=qs[_0x22aa('0x39')](_[_0x22aa('0x52')](_0x3b9c98[_0x22aa('0x37')],_0x48b295[_0x22aa('0x39')]));if(_0x3b9c98['query'][_0x22aa('0x41')]){_0x39d8db[_0x22aa('0x42')]=_[_0x22aa('0x43')](_0x39d8db[_0x22aa('0x42')],{'$or':_[_0x22aa('0x32')](_0x39d8db['attributes'],function(_0x45c174){var _0x51af3f={};_0x51af3f[_0x45c174]={'$like':'%'+_0x3b9c98[_0x22aa('0x37')][_0x22aa('0x41')]+'%'};return _0x51af3f;})});}_0x39d8db=_[_0x22aa('0x43')]({},_0x39d8db,_0x3b9c98['options']);return _0x2dd921[_0x22aa('0x54')](_0x39d8db);}})['then'](function(_0x3906f6){if(_0x3906f6){_0x4d7aa6=_0x3906f6[_0x22aa('0x3d')];if(!_0x3b9c98[_0x22aa('0x37')]['hasOwnProperty'](_0x22aa('0x3e'))){_0x39d8db[_0x22aa('0x27')]=qs[_0x22aa('0x27')](_0x3b9c98[_0x22aa('0x37')][_0x22aa('0x27')]);_0x39d8db[_0x22aa('0x26')]=qs['offset'](_0x3b9c98[_0x22aa('0x37')][_0x22aa('0x26')]);}return _0x2dd921[_0x22aa('0x54')](_0x39d8db);}})[_0x22aa('0x2d')](function(_0x5d63da){if(_0x5d63da){return _0x5d63da?{'count':_0x4d7aa6,'rows':_0x5d63da}:null;}})[_0x22aa('0x2d')](respondWithResult(_0x57299a,null))[_0x22aa('0x21')](handleError(_0x57299a,null));};exports[_0x22aa('0x56')]=function(_0x55f1d1,_0x5b54a9,_0x4738ed){var _0x5cb9ab={};var _0x37e011={};var _0x5bbe9a;var _0x34025e;return db[_0x22aa('0x33')][_0x22aa('0x51')]({'where':{'id':_0x55f1d1[_0x22aa('0x48')]['id']}})[_0x22aa('0x2d')](handleEntityNotFound(_0x5b54a9,null))['then'](function(_0x51da64){if(_0x51da64){_0x5bbe9a=_0x51da64;_0x37e011[_0x22aa('0x36')]=_['keys'](db['FreshdeskField'][_0x22aa('0x49')]);_0x37e011[_0x22aa('0x37')]=_[_0x22aa('0x38')](_0x55f1d1['query']);_0x37e011[_0x22aa('0x39')]=_[_0x22aa('0x3a')](_0x37e011[_0x22aa('0x36')],_0x37e011[_0x22aa('0x37')]);_0x5cb9ab['attributes']=_[_0x22aa('0x3a')](_0x37e011['model'],qs[_0x22aa('0x3c')](_0x55f1d1[_0x22aa('0x37')][_0x22aa('0x3c')]));_0x5cb9ab[_0x22aa('0x3b')]=_0x5cb9ab[_0x22aa('0x3b')][_0x22aa('0x3d')]?_0x5cb9ab[_0x22aa('0x3b')]:_0x37e011[_0x22aa('0x36')];_0x5cb9ab['order']=qs[_0x22aa('0x40')](_0x55f1d1[_0x22aa('0x37')]['sort']);_0x5cb9ab['where']=qs[_0x22aa('0x39')](_[_0x22aa('0x52')](_0x55f1d1[_0x22aa('0x37')],_0x37e011['filters']));if(_0x55f1d1[_0x22aa('0x37')][_0x22aa('0x41')]){_0x5cb9ab[_0x22aa('0x42')]=_[_0x22aa('0x43')](_0x5cb9ab[_0x22aa('0x42')],{'$or':_[_0x22aa('0x32')](_0x5cb9ab[_0x22aa('0x3b')],function(_0x448e58){var _0x211a94={};_0x211a94[_0x448e58]={'$like':'%'+_0x55f1d1[_0x22aa('0x37')]['filter']+'%'};return _0x211a94;})});}_0x5cb9ab=_['merge']({},_0x5cb9ab,_0x55f1d1[_0x22aa('0x4b')]);return _0x5bbe9a[_0x22aa('0x56')](_0x5cb9ab);}})['then'](function(_0x31228e){if(_0x31228e){_0x34025e=_0x31228e[_0x22aa('0x3d')];if(!_0x55f1d1[_0x22aa('0x37')][_0x22aa('0x53')](_0x22aa('0x3e'))){_0x5cb9ab[_0x22aa('0x27')]=qs[_0x22aa('0x27')](_0x55f1d1[_0x22aa('0x37')][_0x22aa('0x27')]);_0x5cb9ab[_0x22aa('0x26')]=qs[_0x22aa('0x26')](_0x55f1d1[_0x22aa('0x37')][_0x22aa('0x26')]);}return _0x5bbe9a[_0x22aa('0x56')](_0x5cb9ab);}})['then'](function(_0x5baacf){if(_0x5baacf){return _0x5baacf?{'count':_0x34025e,'rows':_0x5baacf}:null;}})[_0x22aa('0x2d')](respondWithResult(_0x5b54a9,null))['catch'](handleError(_0x5b54a9,null));};exports[_0x22aa('0x57')]=function(_0x1f55f4,_0x825946,_0x18b25d){var _0x2a5f7f={};var _0xa2574c={};var _0x268cf5;var _0x4f3611;return db[_0x22aa('0x33')]['findOne']({'where':{'id':_0x1f55f4['params']['id']}})[_0x22aa('0x2d')](handleEntityNotFound(_0x825946,null))[_0x22aa('0x2d')](function(_0xecf2cb){if(_0xecf2cb){_0x268cf5=_0xecf2cb;_0xa2574c[_0x22aa('0x36')]=_[_0x22aa('0x38')](db[_0x22aa('0x58')]['rawAttributes']);_0xa2574c[_0x22aa('0x37')]=_[_0x22aa('0x38')](_0x1f55f4[_0x22aa('0x37')]);_0xa2574c[_0x22aa('0x39')]=_[_0x22aa('0x3a')](_0xa2574c['model'],_0xa2574c[_0x22aa('0x37')]);_0x2a5f7f['attributes']=_[_0x22aa('0x3a')](_0xa2574c['model'],qs['fields'](_0x1f55f4[_0x22aa('0x37')][_0x22aa('0x3c')]));_0x2a5f7f[_0x22aa('0x3b')]=_0x2a5f7f[_0x22aa('0x3b')][_0x22aa('0x3d')]?_0x2a5f7f[_0x22aa('0x3b')]:_0xa2574c[_0x22aa('0x36')];_0x2a5f7f[_0x22aa('0x3f')]=qs[_0x22aa('0x40')](_0x1f55f4[_0x22aa('0x37')][_0x22aa('0x40')]);_0x2a5f7f[_0x22aa('0x42')]=qs[_0x22aa('0x39')](_[_0x22aa('0x52')](_0x1f55f4[_0x22aa('0x37')],_0xa2574c[_0x22aa('0x39')]));if(_0x1f55f4[_0x22aa('0x37')]['filter']){_0x2a5f7f['where']=_[_0x22aa('0x43')](_0x2a5f7f[_0x22aa('0x42')],{'$or':_[_0x22aa('0x32')](_0x2a5f7f[_0x22aa('0x3b')],function(_0x2fa4b9){var _0x18afb0={};_0x18afb0[_0x2fa4b9]={'$like':'%'+_0x1f55f4['query']['filter']+'%'};return _0x18afb0;})});}_0x2a5f7f=_[_0x22aa('0x43')]({},_0x2a5f7f,_0x1f55f4[_0x22aa('0x4b')]);return _0x268cf5['getTags'](_0x2a5f7f);}})[_0x22aa('0x2d')](function(_0x25a924){if(_0x25a924){_0x4f3611=_0x25a924[_0x22aa('0x3d')];if(!_0x1f55f4[_0x22aa('0x37')][_0x22aa('0x53')]('nolimit')){_0x2a5f7f[_0x22aa('0x27')]=qs[_0x22aa('0x27')](_0x1f55f4[_0x22aa('0x37')]['limit']);_0x2a5f7f['offset']=qs[_0x22aa('0x26')](_0x1f55f4[_0x22aa('0x37')][_0x22aa('0x26')]);}return _0x268cf5['getTags'](_0x2a5f7f);}})[_0x22aa('0x2d')](function(_0x180463){if(_0x180463){return _0x180463?{'count':_0x4f3611,'rows':_0x180463}:null;}})[_0x22aa('0x2d')](respondWithResult(_0x825946,null))['catch'](handleError(_0x825946,null));};exports[_0x22aa('0x59')]=function(_0x4a04ed,_0x1ab784,_0x42e933){if(_0x4a04ed[_0x22aa('0x4d')]['id']){delete _0x4a04ed['body']['id'];}return db[_0x22aa('0x33')][_0x22aa('0x51')]({'where':{'id':_0x4a04ed['params']['id']}})[_0x22aa('0x2d')](handleEntityNotFound(_0x1ab784,null))[_0x22aa('0x2d')](function(_0x29a818){if(_0x29a818){return _0x29a818['setTags'](_0x4a04ed[_0x22aa('0x4d')]['ids']||[]);}return null;})['then'](respondWithResult(_0x1ab784,null))[_0x22aa('0x21')](handleError(_0x1ab784,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 8503c26..2b15e92 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 _0x2138=['FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x506821,_0x21393b){var _0x188741=function(_0x3dc88c){while(--_0x3dc88c){_0x506821['push'](_0x506821['shift']());}};_0x188741(++_0x21393b);}(_0x2138,0xe6));var _0x8213=function(_0x265a38,_0x26f553){_0x265a38=_0x265a38-0x0;var _0x510102=_0x2138[_0x265a38];return _0x510102;};'use strict';var _=require('lodash');var util=require(_0x8213('0x0'));var logger=require(_0x8213('0x1'))(_0x8213('0x2'));var moment=require(_0x8213('0x3'));var BPromise=require('bluebird');var rp=require(_0x8213('0x4'));var fs=require('fs');var path=require(_0x8213('0x5'));var rimraf=require(_0x8213('0x6'));var config=require('../../config/environment');var attributes=require(_0x8213('0x7'));module[_0x8213('0x8')]=function(_0x7daabb,_0x4671fb){return _0x7daabb[_0x8213('0x9')](_0x8213('0xa'),attributes,{'tableName':_0x8213('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36a7=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations'];(function(_0x449ec3,_0x5062cb){var _0x2f4fcc=function(_0x55c96c){while(--_0x55c96c){_0x449ec3['push'](_0x449ec3['shift']());}};_0x2f4fcc(++_0x5062cb);}(_0x36a7,0x6e));var _0x736a=function(_0xf1409e,_0x3d24bc){_0xf1409e=_0xf1409e-0x0;var _0x1a46c5=_0x36a7[_0xf1409e];return _0x1a46c5;};'use strict';var _=require('lodash');var util=require(_0x736a('0x0'));var logger=require(_0x736a('0x1'))(_0x736a('0x2'));var moment=require('moment');var BPromise=require(_0x736a('0x3'));var rp=require(_0x736a('0x4'));var fs=require('fs');var path=require(_0x736a('0x5'));var rimraf=require('rimraf');var config=require(_0x736a('0x6'));var attributes=require(_0x736a('0x7'));module[_0x736a('0x8')]=function(_0x34839d,_0x1ef6c1){return _0x34839d[_0x736a('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x736a('0xa'),'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 48ea362..0905d14 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 _0xf574=['info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0xf574,0x173));var _0x4f57=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf574[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4f57('0x0'));var util=require('util');var moment=require(_0x4f57('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f57('0x2'))['db'];var utils=require(_0x4f57('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x4f57('0x4'));var jayson=require(_0x4f57('0x5'));var client=jayson['client'][_0x4f57('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xdf7859,_0x237a5f,_0x5ed61b){return new BPromise(function(_0xdf5e80,_0x46b820){return client[_0x4f57('0x7')](_0xdf7859,_0x5ed61b)[_0x4f57('0x8')](function(_0x238869){logger[_0x4f57('0x9')](_0x4f57('0xa'),_0x237a5f,'request\x20sent');logger[_0x4f57('0xb')](_0x4f57('0xc'),_0x237a5f,'request\x20sent',JSON[_0x4f57('0xd')](_0x238869));if(_0x238869['error']){if(_0x238869[_0x4f57('0xe')][_0x4f57('0xf')]===0x1f4){logger['error'](_0x4f57('0xa'),_0x237a5f,_0x238869[_0x4f57('0xe')][_0x4f57('0x10')]);return _0x46b820(_0x238869[_0x4f57('0xe')][_0x4f57('0x10')]);}logger['error'](_0x4f57('0xa'),_0x237a5f,_0x238869['error'][_0x4f57('0x10')]);return _0xdf5e80(_0x238869['error']['message']);}else{logger[_0x4f57('0x9')](_0x4f57('0xa'),_0x237a5f,_0x4f57('0x11'));_0xdf5e80(_0x238869[_0x4f57('0x12')]['message']);}})[_0x4f57('0x13')](function(_0x3e033b){logger[_0x4f57('0xe')](_0x4f57('0xa'),_0x237a5f,_0x3e033b);_0x46b820(_0x3e033b);});});} \ No newline at end of file +var _0xb3b9=['request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb3b9,0xbe));var _0x9b3b=function(_0x54088e,_0x95261e){_0x54088e=_0x54088e-0x0;var _0x4b9234=_0xb3b9[_0x54088e];return _0x4b9234;};'use strict';var _=require('lodash');var util=require(_0x9b3b('0x0'));var moment=require(_0x9b3b('0x1'));var BPromise=require(_0x9b3b('0x2'));var rs=require(_0x9b3b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9b3b('0x4'));var logger=require(_0x9b3b('0x5'))(_0x9b3b('0x6'));var config=require(_0x9b3b('0x7'));var jayson=require(_0x9b3b('0x8'));var client=jayson[_0x9b3b('0x9')][_0x9b3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9da8,_0x2c2eb0,_0x2cc40f){return new BPromise(function(_0x591954,_0x12faa1){return client[_0x9b3b('0xb')](_0x3b9da8,_0x2cc40f)[_0x9b3b('0xc')](function(_0x551a7f){logger[_0x9b3b('0xd')](_0x9b3b('0xe'),_0x2c2eb0,'request\x20sent');logger[_0x9b3b('0xf')](_0x9b3b('0x10'),_0x2c2eb0,_0x9b3b('0x11'),JSON[_0x9b3b('0x12')](_0x551a7f));if(_0x551a7f[_0x9b3b('0x13')]){if(_0x551a7f[_0x9b3b('0x13')][_0x9b3b('0x14')]===0x1f4){logger[_0x9b3b('0x13')](_0x9b3b('0xe'),_0x2c2eb0,_0x551a7f[_0x9b3b('0x13')][_0x9b3b('0x15')]);return _0x12faa1(_0x551a7f['error'][_0x9b3b('0x15')]);}logger[_0x9b3b('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2c2eb0,_0x551a7f[_0x9b3b('0x13')][_0x9b3b('0x15')]);return _0x591954(_0x551a7f[_0x9b3b('0x13')][_0x9b3b('0x15')]);}else{logger[_0x9b3b('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2c2eb0,_0x9b3b('0x11'));_0x591954(_0x551a7f[_0x9b3b('0x16')][_0x9b3b('0x15')]);}})['catch'](function(_0x36d253){logger[_0x9b3b('0x13')](_0x9b3b('0xe'),_0x2c2eb0,_0x36d253);_0x12faa1(_0x36d253);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index a2931a6..a367823 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 _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x2f454b,_0x4f0132){var _0x3077ab=function(_0x4cd985){while(--_0x4cd985){_0x2f454b['push'](_0x2f454b['shift']());}};_0x3077ab(++_0x4f0132);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'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('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file +var _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3dfeb9,_0x1cc6e4){_0x3dfeb9=_0x3dfeb9-0x0;var _0x412314=_0xcb91[_0x3dfeb9];return _0x412314;};'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 diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index bb1dd13..85b6329 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 _0x0ef0=['sequelize','exports','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x1a9772,_0x54a384){var _0x346e7e=function(_0x5cae0c){while(--_0x5cae0c){_0x1a9772['push'](_0x1a9772['shift']());}};_0x346e7e(++_0x54a384);}(_0x0ef0,0x80));var _0x00ef=function(_0x1fbf82,_0x5a47f3){_0x1fbf82=_0x1fbf82-0x0;var _0x2374a5=_0x0ef0[_0x1fbf82];return _0x2374a5;};'use strict';var Sequelize=require(_0x00ef('0x0'));module[_0x00ef('0x1')]={'type':{'type':Sequelize['ENUM'](_0x00ef('0x2'),_0x00ef('0x3'),_0x00ef('0x4'),_0x00ef('0x5')),'defaultValue':_0x00ef('0x2')},'content':{'type':Sequelize[_0x00ef('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x00ef('0x2'),_0x00ef('0x3'),_0x00ef('0x4'))},'keyContent':{'type':Sequelize[_0x00ef('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x00ef('0x6')]},'customField':{'type':Sequelize[_0x00ef('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x00ef('0x6')]}}; \ No newline at end of file +var _0x8b04=['string','customVariable','keyValue','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x335ff3,_0x4c710c){var _0x170b41=function(_0x28b1a5){while(--_0x28b1a5){_0x335ff3['push'](_0x335ff3['shift']());}};_0x170b41(++_0x4c710c);}(_0x8b04,0x130));var _0x48b0=function(_0x223c1e,_0x4da8d3){_0x223c1e=_0x223c1e-0x0;var _0xbeaf50=_0x8b04[_0x223c1e];return _0xbeaf50;};'use strict';var Sequelize=require(_0x48b0('0x0'));module[_0x48b0('0x1')]={'type':{'type':Sequelize['ENUM'](_0x48b0('0x2'),'variable',_0x48b0('0x3'),_0x48b0('0x4')),'defaultValue':_0x48b0('0x2')},'content':{'type':Sequelize[_0x48b0('0x5')]},'key':{'type':Sequelize[_0x48b0('0x5')]},'keyType':{'type':Sequelize[_0x48b0('0x6')](_0x48b0('0x2'),_0x48b0('0x7'),_0x48b0('0x3'))},'keyContent':{'type':Sequelize[_0x48b0('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x48b0('0x5')]},'customField':{'type':Sequelize[_0x48b0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x48b0('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 40fd67a..19d4b8d 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 _0x8a91=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','params','keys','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0x8a91,0x125));var _0x18a9=function(_0x2fde9a,_0x3a8404){_0x2fde9a=_0x2fde9a-0x0;var _0xf6dba1=_0x8a91[_0x2fde9a];return _0xf6dba1;};'use strict';var pdf=require(_0x18a9('0x0'));var emlformat=require(_0x18a9('0x1'));var rimraf=require(_0x18a9('0x2'));var zipdir=require(_0x18a9('0x3'));var jsonpatch=require(_0x18a9('0x4'));var rp=require(_0x18a9('0x5'));var moment=require(_0x18a9('0x6'));var BPromise=require(_0x18a9('0x7'));var Mustache=require(_0x18a9('0x8'));var util=require(_0x18a9('0x9'));var path=require(_0x18a9('0xa'));var sox=require(_0x18a9('0xb'));var csv=require(_0x18a9('0xc'));var ejs=require(_0x18a9('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x18a9('0xe'));var crypto=require('crypto');var jsforce=require(_0x18a9('0xf'));var deskjs=require(_0x18a9('0x10'));var toCsv=require(_0x18a9('0xc'));var querystring=require('querystring');var Papa=require(_0x18a9('0x11'));var Redis=require(_0x18a9('0x12'));var authService=require(_0x18a9('0x13'));var qs=require(_0x18a9('0x14'));var as=require(_0x18a9('0x15'));var hardwareService=require(_0x18a9('0x16'));var logger=require(_0x18a9('0x17'))(_0x18a9('0x18'));var utils=require(_0x18a9('0x19'));var config=require(_0x18a9('0x1a'));var licenseUtil=require(_0x18a9('0x1b'));var db=require(_0x18a9('0x1c'))['db'];function respondWithStatusCode(_0x2d29e4,_0x3c7fce){_0x3c7fce=_0x3c7fce||0xcc;return function(_0x2992a3){if(_0x2992a3){return _0x2d29e4['sendStatus'](_0x3c7fce);}return _0x2d29e4['status'](_0x3c7fce)['end']();};}function respondWithResult(_0x374cbe,_0xfc7083){_0xfc7083=_0xfc7083||0xc8;return function(_0x1f9281){if(_0x1f9281){return _0x374cbe[_0x18a9('0x1d')](_0xfc7083)[_0x18a9('0x1e')](_0x1f9281);}};}function respondWithFilteredResult(_0x2d0c62,_0x3c355e){return function(_0xe71734){if(_0xe71734){var _0x1ea861=_0xe71734[_0x18a9('0x1f')],_0x3cb277=_0x3c355e['offset'],_0x4cd1b2=_0x3c355e['offset']+_0x3c355e[_0x18a9('0x20')],_0x14d921;if(_0x4cd1b2>=_0x1ea861){_0x4cd1b2=_0x1ea861;_0x14d921=0xc8;}else{_0x14d921=0xce;}_0x2d0c62[_0x18a9('0x1d')](_0x14d921);return _0x2d0c62[_0x18a9('0x21')](_0x18a9('0x22'),_0x3cb277+'-'+_0x4cd1b2+'/'+_0x1ea861)['json'](_0xe71734);}return null;};}function patchUpdates(_0x2e3ce4){return function(_0x35a145){try{jsonpatch[_0x18a9('0x23')](_0x35a145,_0x2e3ce4,!![]);}catch(_0x11e8e7){return BPromise[_0x18a9('0x24')](_0x11e8e7);}return _0x35a145[_0x18a9('0x25')]();};}function saveUpdates(_0x13cd00,_0x4df8d2){return function(_0x267167){if(_0x267167){return _0x267167[_0x18a9('0x26')](_0x13cd00)[_0x18a9('0x27')](function(_0x2c9829){return _0x2c9829;});}return null;};}function removeEntity(_0xd47ea9,_0x48d98c){return function(_0x43b39b){if(_0x43b39b){return _0x43b39b[_0x18a9('0x28')]()[_0x18a9('0x27')](function(){_0xd47ea9[_0x18a9('0x1d')](0xcc)[_0x18a9('0x29')]();});}};}function handleEntityNotFound(_0x27dc8f,_0x30afe0){return function(_0xe07fd6){if(!_0xe07fd6){_0x27dc8f[_0x18a9('0x2a')](0x194);}return _0xe07fd6;};}function handleError(_0x2c8316,_0x2adaa8){_0x2adaa8=_0x2adaa8||0x1f4;return function(_0x5a6df6){logger[_0x18a9('0x2b')](_0x5a6df6[_0x18a9('0x2c')]);if(_0x5a6df6[_0x18a9('0x2d')]){delete _0x5a6df6['name'];}_0x2c8316['status'](_0x2adaa8)[_0x18a9('0x2e')](_0x5a6df6);};}exports[_0x18a9('0x2f')]=function(_0x4d49c5,_0xbf02f4){var _0x4da733={},_0x38028b={},_0xdead9e={'count':0x0,'rows':[]};var _0x428a4e=_[_0x18a9('0x30')](db[_0x18a9('0x31')][_0x18a9('0x32')],function(_0x5888a7){return{'name':_0x5888a7[_0x18a9('0x33')],'type':_0x5888a7[_0x18a9('0x34')]['key']};});_0x38028b[_0x18a9('0x35')]=_[_0x18a9('0x30')](_0x428a4e,'name');_0x38028b[_0x18a9('0x36')]=_['keys'](_0x4d49c5[_0x18a9('0x36')]);_0x38028b['filters']=_[_0x18a9('0x37')](_0x38028b['model'],_0x38028b[_0x18a9('0x36')]);_0x4da733[_0x18a9('0x38')]=_[_0x18a9('0x37')](_0x38028b['model'],qs['fields'](_0x4d49c5[_0x18a9('0x36')][_0x18a9('0x39')]));_0x4da733[_0x18a9('0x38')]=_0x4da733[_0x18a9('0x38')][_0x18a9('0x3a')]?_0x4da733[_0x18a9('0x38')]:_0x38028b[_0x18a9('0x35')];if(!_0x4d49c5[_0x18a9('0x36')][_0x18a9('0x3b')](_0x18a9('0x3c'))){_0x4da733[_0x18a9('0x20')]=qs['limit'](_0x4d49c5['query'][_0x18a9('0x20')]);_0x4da733[_0x18a9('0x3d')]=qs['offset'](_0x4d49c5[_0x18a9('0x36')][_0x18a9('0x3d')]);}_0x4da733[_0x18a9('0x3e')]=qs[_0x18a9('0x3f')](_0x4d49c5['query'][_0x18a9('0x3f')]);_0x4da733['where']=qs[_0x18a9('0x40')](_[_0x18a9('0x41')](_0x4d49c5[_0x18a9('0x36')],_0x38028b[_0x18a9('0x40')]),_0x428a4e);if(_0x4d49c5['query'][_0x18a9('0x42')]){_0x4da733[_0x18a9('0x43')]=_[_0x18a9('0x44')](_0x4da733['where'],{'$or':_[_0x18a9('0x30')](_0x428a4e,function(_0x56d208){if(_0x56d208[_0x18a9('0x34')]!==_0x18a9('0x45')){var _0x1538b8={};_0x1538b8[_0x56d208[_0x18a9('0x2d')]]={'$like':'%'+_0x4d49c5[_0x18a9('0x36')][_0x18a9('0x42')]+'%'};return _0x1538b8;}})});}_0x4da733=_[_0x18a9('0x44')]({},_0x4da733,_0x4d49c5['options']);var _0x2a04fa={'where':_0x4da733[_0x18a9('0x43')]};return db[_0x18a9('0x31')][_0x18a9('0x1f')](_0x2a04fa)['then'](function(_0x249f2d){_0xdead9e['count']=_0x249f2d;if(_0x4d49c5[_0x18a9('0x36')][_0x18a9('0x46')]){_0x4da733['include']=[{'all':!![]}];}return db[_0x18a9('0x31')][_0x18a9('0x47')](_0x4da733);})[_0x18a9('0x27')](function(_0x17884b){_0xdead9e['rows']=_0x17884b;return _0xdead9e;})[_0x18a9('0x27')](respondWithFilteredResult(_0xbf02f4,_0x4da733))[_0x18a9('0x48')](handleError(_0xbf02f4,null));};exports['show']=function(_0x46b95d,_0x28869e){var _0x2b3be2={'raw':!![],'where':{'id':_0x46b95d[_0x18a9('0x49')]['id']}},_0x3792df={};_0x3792df[_0x18a9('0x35')]=_[_0x18a9('0x4a')](db[_0x18a9('0x31')][_0x18a9('0x32')]);_0x3792df['query']=_[_0x18a9('0x4a')](_0x46b95d[_0x18a9('0x36')]);_0x3792df[_0x18a9('0x40')]=_[_0x18a9('0x37')](_0x3792df[_0x18a9('0x35')],_0x3792df[_0x18a9('0x36')]);_0x2b3be2[_0x18a9('0x38')]=_['intersection'](_0x3792df[_0x18a9('0x35')],qs[_0x18a9('0x39')](_0x46b95d['query'][_0x18a9('0x39')]));_0x2b3be2['attributes']=_0x2b3be2[_0x18a9('0x38')]['length']?_0x2b3be2['attributes']:_0x3792df[_0x18a9('0x35')];if(_0x46b95d[_0x18a9('0x36')][_0x18a9('0x46')]){_0x2b3be2['include']=[{'all':!![]}];}_0x2b3be2=_['merge']({},_0x2b3be2,_0x46b95d[_0x18a9('0x4b')]);return db[_0x18a9('0x31')][_0x18a9('0x4c')](_0x2b3be2)[_0x18a9('0x27')](handleEntityNotFound(_0x28869e,null))['then'](respondWithResult(_0x28869e,null))[_0x18a9('0x48')](handleError(_0x28869e,null));};exports[_0x18a9('0x4d')]=function(_0x30bccc,_0x4c3f38){return db[_0x18a9('0x31')]['create'](_0x30bccc['body'],{})[_0x18a9('0x27')](respondWithResult(_0x4c3f38,0xc9))[_0x18a9('0x48')](handleError(_0x4c3f38,null));};exports[_0x18a9('0x26')]=function(_0x234bcd,_0xf993ed){if(_0x234bcd[_0x18a9('0x4e')]['id']){delete _0x234bcd[_0x18a9('0x4e')]['id'];}return db[_0x18a9('0x31')][_0x18a9('0x4c')]({'where':{'id':_0x234bcd['params']['id']}})[_0x18a9('0x27')](handleEntityNotFound(_0xf993ed,null))[_0x18a9('0x27')](saveUpdates(_0x234bcd[_0x18a9('0x4e')],null))['then'](respondWithResult(_0xf993ed,null))[_0x18a9('0x48')](handleError(_0xf993ed,null));};exports[_0x18a9('0x28')]=function(_0x18a071,_0x578e8b){return db[_0x18a9('0x31')][_0x18a9('0x4c')]({'where':{'id':_0x18a071[_0x18a9('0x49')]['id']}})[_0x18a9('0x27')](handleEntityNotFound(_0x578e8b,null))['then'](removeEntity(_0x578e8b,null))['catch'](handleError(_0x578e8b,null));}; \ No newline at end of file +var _0x984b=['model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshdeskField','fieldName','type','key','query','keys','filters','intersection'];(function(_0x34ed48,_0x2cc995){var _0x37da5c=function(_0x5b6e16){while(--_0x5b6e16){_0x34ed48['push'](_0x34ed48['shift']());}};_0x37da5c(++_0x2cc995);}(_0x984b,0xee));var _0xb984=function(_0x1fe64c,_0x3e9fd1){_0x1fe64c=_0x1fe64c-0x0;var _0x1016d5=_0x984b[_0x1fe64c];return _0x1016d5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb984('0x0'));var jsonpatch=require(_0xb984('0x1'));var rp=require(_0xb984('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb984('0x3'));var util=require(_0xb984('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xb984('0x5'));var ejs=require(_0xb984('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb984('0x7'));var crypto=require(_0xb984('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xb984('0x9'));var toCsv=require('to-csv');var querystring=require(_0xb984('0xa'));var Papa=require(_0xb984('0xb'));var Redis=require(_0xb984('0xc'));var authService=require(_0xb984('0xd'));var qs=require(_0xb984('0xe'));var as=require(_0xb984('0xf'));var hardwareService=require(_0xb984('0x10'));var logger=require(_0xb984('0x11'))(_0xb984('0x12'));var utils=require(_0xb984('0x13'));var config=require(_0xb984('0x14'));var licenseUtil=require(_0xb984('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b922b,_0x4b9c75){_0x4b9c75=_0x4b9c75||0xcc;return function(_0x61432f){if(_0x61432f){return _0x1b922b[_0xb984('0x16')](_0x4b9c75);}return _0x1b922b['status'](_0x4b9c75)[_0xb984('0x17')]();};}function respondWithResult(_0x2e7986,_0x564d24){_0x564d24=_0x564d24||0xc8;return function(_0x203dba){if(_0x203dba){return _0x2e7986[_0xb984('0x18')](_0x564d24)['json'](_0x203dba);}};}function respondWithFilteredResult(_0xede12d,_0x4073cb){return function(_0x57365c){if(_0x57365c){var _0x6fae41=_0x57365c[_0xb984('0x19')],_0x5cd1aa=_0x4073cb[_0xb984('0x1a')],_0x3b8241=_0x4073cb['offset']+_0x4073cb[_0xb984('0x1b')],_0x1dc4df;if(_0x3b8241>=_0x6fae41){_0x3b8241=_0x6fae41;_0x1dc4df=0xc8;}else{_0x1dc4df=0xce;}_0xede12d[_0xb984('0x18')](_0x1dc4df);return _0xede12d[_0xb984('0x1c')](_0xb984('0x1d'),_0x5cd1aa+'-'+_0x3b8241+'/'+_0x6fae41)[_0xb984('0x1e')](_0x57365c);}return null;};}function patchUpdates(_0x4374d0){return function(_0x5c2e25){try{jsonpatch[_0xb984('0x1f')](_0x5c2e25,_0x4374d0,!![]);}catch(_0x2f6d70){return BPromise[_0xb984('0x20')](_0x2f6d70);}return _0x5c2e25[_0xb984('0x21')]();};}function saveUpdates(_0x32831b,_0xcf9365){return function(_0x54dd81){if(_0x54dd81){return _0x54dd81[_0xb984('0x22')](_0x32831b)[_0xb984('0x23')](function(_0x551ad4){return _0x551ad4;});}return null;};}function removeEntity(_0x44b570,_0x97af5c){return function(_0x14734a){if(_0x14734a){return _0x14734a[_0xb984('0x24')]()[_0xb984('0x23')](function(){_0x44b570[_0xb984('0x18')](0xcc)[_0xb984('0x17')]();});}};}function handleEntityNotFound(_0x52c581,_0x391a1e){return function(_0x25de23){if(!_0x25de23){_0x52c581[_0xb984('0x16')](0x194);}return _0x25de23;};}function handleError(_0x5d4d38,_0x2da621){_0x2da621=_0x2da621||0x1f4;return function(_0x2e806e){logger[_0xb984('0x25')](_0x2e806e[_0xb984('0x26')]);if(_0x2e806e[_0xb984('0x27')]){delete _0x2e806e[_0xb984('0x27')];}_0x5d4d38[_0xb984('0x18')](_0x2da621)[_0xb984('0x28')](_0x2e806e);};}exports['index']=function(_0x249d47,_0x469af6){var _0x3e254b={},_0x2bd0f2={},_0x4fb896={'count':0x0,'rows':[]};var _0xa44895=_[_0xb984('0x29')](db[_0xb984('0x2a')]['rawAttributes'],function(_0x363e33){return{'name':_0x363e33[_0xb984('0x2b')],'type':_0x363e33[_0xb984('0x2c')][_0xb984('0x2d')]};});_0x2bd0f2['model']=_['map'](_0xa44895,'name');_0x2bd0f2[_0xb984('0x2e')]=_[_0xb984('0x2f')](_0x249d47['query']);_0x2bd0f2[_0xb984('0x30')]=_[_0xb984('0x31')](_0x2bd0f2[_0xb984('0x32')],_0x2bd0f2[_0xb984('0x2e')]);_0x3e254b['attributes']=_['intersection'](_0x2bd0f2[_0xb984('0x32')],qs[_0xb984('0x33')](_0x249d47[_0xb984('0x2e')][_0xb984('0x33')]));_0x3e254b['attributes']=_0x3e254b[_0xb984('0x34')][_0xb984('0x35')]?_0x3e254b[_0xb984('0x34')]:_0x2bd0f2[_0xb984('0x32')];if(!_0x249d47[_0xb984('0x2e')][_0xb984('0x36')]('nolimit')){_0x3e254b[_0xb984('0x1b')]=qs[_0xb984('0x1b')](_0x249d47[_0xb984('0x2e')][_0xb984('0x1b')]);_0x3e254b[_0xb984('0x1a')]=qs[_0xb984('0x1a')](_0x249d47['query'][_0xb984('0x1a')]);}_0x3e254b[_0xb984('0x37')]=qs['sort'](_0x249d47['query'][_0xb984('0x38')]);_0x3e254b['where']=qs[_0xb984('0x30')](_[_0xb984('0x39')](_0x249d47['query'],_0x2bd0f2[_0xb984('0x30')]),_0xa44895);if(_0x249d47['query'][_0xb984('0x3a')]){_0x3e254b['where']=_[_0xb984('0x3b')](_0x3e254b['where'],{'$or':_['map'](_0xa44895,function(_0xf6d925){if(_0xf6d925[_0xb984('0x2c')]!=='VIRTUAL'){var _0x26b36c={};_0x26b36c[_0xf6d925[_0xb984('0x27')]]={'$like':'%'+_0x249d47['query'][_0xb984('0x3a')]+'%'};return _0x26b36c;}})});}_0x3e254b=_[_0xb984('0x3b')]({},_0x3e254b,_0x249d47[_0xb984('0x3c')]);var _0x35f2c1={'where':_0x3e254b['where']};return db[_0xb984('0x2a')][_0xb984('0x19')](_0x35f2c1)[_0xb984('0x23')](function(_0x474fbd){_0x4fb896[_0xb984('0x19')]=_0x474fbd;if(_0x249d47[_0xb984('0x2e')][_0xb984('0x3d')]){_0x3e254b[_0xb984('0x3e')]=[{'all':!![]}];}return db[_0xb984('0x2a')][_0xb984('0x3f')](_0x3e254b);})['then'](function(_0x134ba5){_0x4fb896[_0xb984('0x40')]=_0x134ba5;return _0x4fb896;})[_0xb984('0x23')](respondWithFilteredResult(_0x469af6,_0x3e254b))[_0xb984('0x41')](handleError(_0x469af6,null));};exports[_0xb984('0x42')]=function(_0x1e06aa,_0x1e8323){var _0xce2f71={'raw':!![],'where':{'id':_0x1e06aa['params']['id']}},_0x52181e={};_0x52181e[_0xb984('0x32')]=_['keys'](db[_0xb984('0x2a')][_0xb984('0x43')]);_0x52181e[_0xb984('0x2e')]=_[_0xb984('0x2f')](_0x1e06aa['query']);_0x52181e[_0xb984('0x30')]=_[_0xb984('0x31')](_0x52181e['model'],_0x52181e[_0xb984('0x2e')]);_0xce2f71[_0xb984('0x34')]=_[_0xb984('0x31')](_0x52181e[_0xb984('0x32')],qs[_0xb984('0x33')](_0x1e06aa[_0xb984('0x2e')][_0xb984('0x33')]));_0xce2f71['attributes']=_0xce2f71[_0xb984('0x34')][_0xb984('0x35')]?_0xce2f71['attributes']:_0x52181e['model'];if(_0x1e06aa[_0xb984('0x2e')][_0xb984('0x3d')]){_0xce2f71[_0xb984('0x3e')]=[{'all':!![]}];}_0xce2f71=_[_0xb984('0x3b')]({},_0xce2f71,_0x1e06aa[_0xb984('0x3c')]);return db['FreshdeskField'][_0xb984('0x44')](_0xce2f71)[_0xb984('0x23')](handleEntityNotFound(_0x1e8323,null))[_0xb984('0x23')](respondWithResult(_0x1e8323,null))[_0xb984('0x41')](handleError(_0x1e8323,null));};exports[_0xb984('0x45')]=function(_0x44865b,_0x2097e6){return db[_0xb984('0x2a')][_0xb984('0x45')](_0x44865b[_0xb984('0x46')],{})['then'](respondWithResult(_0x2097e6,0xc9))[_0xb984('0x41')](handleError(_0x2097e6,null));};exports[_0xb984('0x22')]=function(_0x4bd4db,_0x1ba546){if(_0x4bd4db[_0xb984('0x46')]['id']){delete _0x4bd4db[_0xb984('0x46')]['id'];}return db[_0xb984('0x2a')][_0xb984('0x44')]({'where':{'id':_0x4bd4db[_0xb984('0x47')]['id']}})[_0xb984('0x23')](handleEntityNotFound(_0x1ba546,null))[_0xb984('0x23')](saveUpdates(_0x4bd4db[_0xb984('0x46')],null))[_0xb984('0x23')](respondWithResult(_0x1ba546,null))['catch'](handleError(_0x1ba546,null));};exports[_0xb984('0x24')]=function(_0x303280,_0x262898){return db[_0xb984('0x2a')][_0xb984('0x44')]({'where':{'id':_0x303280[_0xb984('0x47')]['id']}})[_0xb984('0x23')](handleEntityNotFound(_0x262898,null))[_0xb984('0x23')](removeEntity(_0x262898,null))[_0xb984('0x41')](handleError(_0x262898,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index dc66f41..fcddd82 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 _0x6a1f=['api','moment','request-promise','path','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','util','../../config/logger'];(function(_0x54b080,_0x52b431){var _0x59406d=function(_0x16e99b){while(--_0x16e99b){_0x54b080['push'](_0x54b080['shift']());}};_0x59406d(++_0x52b431);}(_0x6a1f,0x11c));var _0xf6a1=function(_0x1fe850,_0x31a1a0){_0x1fe850=_0x1fe850-0x0;var _0x244af3=_0x6a1f[_0x1fe850];return _0x244af3;};'use strict';var _=require('lodash');var util=require(_0xf6a1('0x0'));var logger=require(_0xf6a1('0x1'))(_0xf6a1('0x2'));var moment=require(_0xf6a1('0x3'));var BPromise=require('bluebird');var rp=require(_0xf6a1('0x4'));var fs=require('fs');var path=require(_0xf6a1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf6a1('0x6'));module[_0xf6a1('0x7')]=function(_0x353267,_0x4f7670){return _0x353267[_0xf6a1('0x8')](_0xf6a1('0x9'),attributes,{'tableName':_0xf6a1('0xa'),'paranoid':![],'indexes':[{'name':_0xf6a1('0xb'),'fields':['idField',_0xf6a1('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x71a0=['idField','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71a0,0xf1));var _0x071a=function(_0x336110,_0xa4a98){_0x336110=_0x336110-0x0;var _0x55413e=_0x71a0[_0x336110];return _0x55413e;};'use strict';var _=require(_0x071a('0x0'));var util=require(_0x071a('0x1'));var logger=require(_0x071a('0x2'))(_0x071a('0x3'));var moment=require(_0x071a('0x4'));var BPromise=require(_0x071a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x071a('0x6'));var rimraf=require(_0x071a('0x7'));var config=require(_0x071a('0x8'));var attributes=require(_0x071a('0x9'));module[_0x071a('0xa')]=function(_0x766142,_0x5c24bc){return _0x766142[_0x071a('0xb')](_0x071a('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x071a('0xd'),'fields':[_0x071a('0xe'),'FieldId'],'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 bed32f0..d4070de 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 _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x500c8e,_0x359cc9){_0x500c8e=_0x500c8e-0x0;var _0x516713=_0x7a54[_0x500c8e];return _0x516713;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +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(_0x3468aa,_0xa87f20){var _0x643df0=function(_0x3aeaad){while(--_0x3aeaad){_0x3468aa['push'](_0x3468aa['shift']());}};_0x643df0(++_0xa87f20);}(_0xb10b,0x12a));var _0xbb10=function(_0x329a5d,_0x4a886d){_0x329a5d=_0x329a5d-0x0;var _0x56d83d=_0xb10b[_0x329a5d];return _0x56d83d;};'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 db59bbf..d815f91 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 _0x09a2=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update'];(function(_0x1e8581,_0x246c10){var _0x4b0e9e=function(_0x482c15){while(--_0x482c15){_0x1e8581['push'](_0x1e8581['shift']());}};_0x4b0e9e(++_0x246c10);}(_0x09a2,0xfd));var _0x209a=function(_0x1ed807,_0x953de3){_0x1ed807=_0x1ed807-0x0;var _0x52e8fb=_0x09a2[_0x1ed807];return _0x52e8fb;};'use strict';var multer=require(_0x209a('0x0'));var util=require(_0x209a('0x1'));var path=require(_0x209a('0x2'));var timeout=require(_0x209a('0x3'));var express=require(_0x209a('0x4'));var router=express[_0x209a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x209a('0x6'));var controller=require(_0x209a('0x7'));router[_0x209a('0x8')]('/',auth[_0x209a('0x9')](),controller[_0x209a('0xa')]);router[_0x209a('0x8')]('/:id',auth[_0x209a('0x9')](),controller[_0x209a('0xb')]);router[_0x209a('0x8')](_0x209a('0xc'),auth['isAuthenticated'](),controller[_0x209a('0xd')]);router[_0x209a('0x8')](_0x209a('0xe'),auth['isAuthenticated'](),controller[_0x209a('0xf')]);router[_0x209a('0x10')]('/',auth[_0x209a('0x9')](),controller[_0x209a('0x11')]);router['post'](_0x209a('0xc'),auth[_0x209a('0x9')](),controller[_0x209a('0x12')]);router[_0x209a('0x13')](_0x209a('0x14'),auth['isAuthenticated'](),controller[_0x209a('0x15')]);router[_0x209a('0x16')](_0x209a('0x14'),auth[_0x209a('0x9')](),controller[_0x209a('0x17')]);module[_0x209a('0x18')]=router; \ No newline at end of file +var _0x922a=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update'];(function(_0x5f13f1,_0x37fe95){var _0x24b3b9=function(_0x2745ce){while(--_0x2745ce){_0x5f13f1['push'](_0x5f13f1['shift']());}};_0x24b3b9(++_0x37fe95);}(_0x922a,0x137));var _0xa922=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x922a[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xa922('0x0'));var util=require('util');var path=require(_0xa922('0x1'));var timeout=require(_0xa922('0x2'));var express=require(_0xa922('0x3'));var router=express[_0xa922('0x4')]();var auth=require(_0xa922('0x5'));var interaction=require(_0xa922('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa922('0x7')]);router[_0xa922('0x8')](_0xa922('0x9'),auth[_0xa922('0xa')](),controller['show']);router[_0xa922('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xa922('0x8')](_0xa922('0xb'),auth[_0xa922('0xa')](),controller[_0xa922('0xc')]);router[_0xa922('0xd')]('/',auth['isAuthenticated'](),controller[_0xa922('0xe')]);router[_0xa922('0xd')](_0xa922('0xf'),auth[_0xa922('0xa')](),controller[_0xa922('0x10')]);router[_0xa922('0x11')](_0xa922('0x9'),auth[_0xa922('0xa')](),controller[_0xa922('0x12')]);router[_0xa922('0x13')](_0xa922('0x9'),auth['isAuthenticated'](),controller[_0xa922('0x14')]);module[_0xa922('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 2b4348d..b526aef 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 _0xeebe=['username','exports','STRING'];(function(_0x7c1ad2,_0x1f1784){var _0x188eb=function(_0x1ca798){while(--_0x1ca798){_0x7c1ad2['push'](_0x7c1ad2['shift']());}};_0x188eb(++_0x1f1784);}(_0xeebe,0x1de));var _0xeeeb=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xeebe[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require('sequelize');module[_0xeeeb('0x0')]={'name':{'type':Sequelize[_0xeeeb('0x1')]},'description':{'type':Sequelize[_0xeeeb('0x1')]},'username':{'type':Sequelize[_0xeeeb('0x1')],'unique':_0xeeeb('0x2')},'apiKey':{'type':Sequelize[_0xeeeb('0x1')]},'remoteUri':{'type':Sequelize[_0xeeeb('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xeeeb('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xdb46=['sequelize','exports','STRING','username','remoteUri'];(function(_0x305b12,_0x5ecd09){var _0x4141de=function(_0x3e7044){while(--_0x3e7044){_0x305b12['push'](_0x305b12['shift']());}};_0x4141de(++_0x5ecd09);}(_0xdb46,0xbe));var _0x6db4=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xdb46[_0x3c8e9a];return _0x2d4c57;};'use strict';var Sequelize=require(_0x6db4('0x0'));module[_0x6db4('0x1')]={'name':{'type':Sequelize[_0x6db4('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x6db4('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6db4('0x2')],'unique':_0x6db4('0x4')},'serverUrl':{'type':Sequelize[_0x6db4('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 8b9cb8d..92fa23d 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 _0x9bde=['getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','sendStatus','status','end','json','count','offset','set','apply','update','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','map','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','body','params','destroy','getConfigurations','FreshsalesConfiguration','order','findOne','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test'];(function(_0x67d2b,_0xc3be07){var _0x23e7c1=function(_0x290c5e){while(--_0x290c5e){_0x67d2b['push'](_0x67d2b['shift']());}};_0x23e7c1(++_0xc3be07);}(_0x9bde,0xe1));var _0xe9bd=function(_0x31cc9c,_0x5effee){_0x31cc9c=_0x31cc9c-0x0;var _0x2f8c76=_0x9bde[_0x31cc9c];return _0x2f8c76;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9bd('0x2'));var moment=require(_0xe9bd('0x3'));var BPromise=require(_0xe9bd('0x4'));var Mustache=require(_0xe9bd('0x5'));var util=require(_0xe9bd('0x6'));var path=require(_0xe9bd('0x7'));var sox=require(_0xe9bd('0x8'));var csv=require('to-csv');var ejs=require(_0xe9bd('0x9'));var fs=require('fs');var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0xf'));var querystring=require(_0xe9bd('0x10'));var Papa=require(_0xe9bd('0x11'));var Redis=require(_0xe9bd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x13'));var hardwareService=require(_0xe9bd('0x14'));var logger=require(_0xe9bd('0x15'))('api');var utils=require(_0xe9bd('0x16'));var config=require(_0xe9bd('0x17'));var licenseUtil=require(_0xe9bd('0x18'));var db=require(_0xe9bd('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xe9bd('0x1a'));var client=jayson['client'][_0xe9bd('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x429e88,_0x3435b4,_0x51109f,_0x47ba5e){return new BPromise(function(_0x46a95e,_0x248818){var _0x3a9e5f=_0x47ba5e||client;return _0x3a9e5f[_0xe9bd('0x1c')](_0x429e88,_0x51109f)[_0xe9bd('0x1d')](function(_0x389e7b){logger[_0xe9bd('0x1e')]('FreshsalesAccount,\x20%s,\x20%s',_0x3435b4,_0xe9bd('0x1f'));logger[_0xe9bd('0x20')](_0xe9bd('0x21'),_0x3435b4,'request\x20sent',JSON[_0xe9bd('0x22')](_0x389e7b));if(_0x389e7b[_0xe9bd('0x23')]){if(_0x389e7b[_0xe9bd('0x23')][_0xe9bd('0x24')]===0x1f4){logger['error'](_0xe9bd('0x25'),_0x3435b4,_0x389e7b['error'][_0xe9bd('0x26')]);return _0x248818(_0x389e7b['error'][_0xe9bd('0x26')]);}logger[_0xe9bd('0x23')](_0xe9bd('0x25'),_0x3435b4,_0x389e7b[_0xe9bd('0x23')][_0xe9bd('0x26')]);return _0x46a95e(_0x389e7b[_0xe9bd('0x23')][_0xe9bd('0x26')]);}else{logger['info'](_0xe9bd('0x25'),_0x3435b4,_0xe9bd('0x1f'));_0x46a95e(_0x389e7b['result'][_0xe9bd('0x26')]);}})['catch'](function(_0x238ab1){logger[_0xe9bd('0x23')](_0xe9bd('0x25'),_0x3435b4,_0x238ab1);_0x248818(_0x238ab1);});});}function respondWithStatusCode(_0xf02209,_0x5bc4bf){_0x5bc4bf=_0x5bc4bf||0xcc;return function(_0x24cf25){if(_0x24cf25){return _0xf02209[_0xe9bd('0x27')](_0x5bc4bf);}return _0xf02209[_0xe9bd('0x28')](_0x5bc4bf)[_0xe9bd('0x29')]();};}function respondWithResult(_0x2641be,_0xb52d45){_0xb52d45=_0xb52d45||0xc8;return function(_0x399f3c){if(_0x399f3c){return _0x2641be[_0xe9bd('0x28')](_0xb52d45)[_0xe9bd('0x2a')](_0x399f3c);}};}function respondWithFilteredResult(_0x5987af,_0x3c211a){return function(_0x38fdfa){if(_0x38fdfa){var _0x5ba1d6=_0x38fdfa[_0xe9bd('0x2b')],_0x3b13b7=_0x3c211a[_0xe9bd('0x2c')],_0xc25248=_0x3c211a[_0xe9bd('0x2c')]+_0x3c211a['limit'],_0x119672;if(_0xc25248>=_0x5ba1d6){_0xc25248=_0x5ba1d6;_0x119672=0xc8;}else{_0x119672=0xce;}_0x5987af['status'](_0x119672);return _0x5987af[_0xe9bd('0x2d')]('Content-Range',_0x3b13b7+'-'+_0xc25248+'/'+_0x5ba1d6)[_0xe9bd('0x2a')](_0x38fdfa);}return null;};}function patchUpdates(_0x1f2c0e){return function(_0x27f80c){try{jsonpatch[_0xe9bd('0x2e')](_0x27f80c,_0x1f2c0e,!![]);}catch(_0x4057df){return BPromise['reject'](_0x4057df);}return _0x27f80c['save']();};}function saveUpdates(_0x7f2c5,_0x3b6682){return function(_0x3f96a0){if(_0x3f96a0){return _0x3f96a0[_0xe9bd('0x2f')](_0x7f2c5)[_0xe9bd('0x1d')](function(_0x1f0f9e){return _0x1f0f9e;});}return null;};}function removeEntity(_0x3c31ee,_0x66213a){return function(_0x45703e){if(_0x45703e){return _0x45703e['destroy']()[_0xe9bd('0x1d')](function(){_0x3c31ee[_0xe9bd('0x28')](0xcc)[_0xe9bd('0x29')]();});}};}function handleEntityNotFound(_0x5117bc,_0x524e08){return function(_0x25eeab){if(!_0x25eeab){_0x5117bc[_0xe9bd('0x27')](0x194);}return _0x25eeab;};}function handleError(_0x601649,_0x3ed60a){_0x3ed60a=_0x3ed60a||0x1f4;return function(_0x1dda43){logger[_0xe9bd('0x23')](_0x1dda43[_0xe9bd('0x30')]);if(_0x1dda43[_0xe9bd('0x31')]){delete _0x1dda43[_0xe9bd('0x31')];}_0x601649[_0xe9bd('0x28')](_0x3ed60a)[_0xe9bd('0x32')](_0x1dda43);};}exports[_0xe9bd('0x33')]=function(_0x2ad46e,_0x199477){var _0xc50476={},_0x8ff624={},_0x264ba0={'count':0x0,'rows':[]};var _0x147da5=_['map'](db[_0xe9bd('0x34')][_0xe9bd('0x35')],function(_0x56b4a5){return{'name':_0x56b4a5[_0xe9bd('0x36')],'type':_0x56b4a5[_0xe9bd('0x37')]['key']};});_0x8ff624['model']=_[_0xe9bd('0x38')](_0x147da5,_0xe9bd('0x31'));_0x8ff624['query']=_[_0xe9bd('0x39')](_0x2ad46e[_0xe9bd('0x3a')]);_0x8ff624[_0xe9bd('0x3b')]=_['intersection'](_0x8ff624[_0xe9bd('0x3c')],_0x8ff624['query']);_0xc50476[_0xe9bd('0x3d')]=_[_0xe9bd('0x3e')](_0x8ff624[_0xe9bd('0x3c')],qs[_0xe9bd('0x3f')](_0x2ad46e['query'][_0xe9bd('0x3f')]));_0xc50476[_0xe9bd('0x3d')]=_0xc50476[_0xe9bd('0x3d')][_0xe9bd('0x40')]?_0xc50476[_0xe9bd('0x3d')]:_0x8ff624[_0xe9bd('0x3c')];if(!_0x2ad46e[_0xe9bd('0x3a')][_0xe9bd('0x41')](_0xe9bd('0x42'))){_0xc50476[_0xe9bd('0x43')]=qs['limit'](_0x2ad46e['query'][_0xe9bd('0x43')]);_0xc50476['offset']=qs[_0xe9bd('0x2c')](_0x2ad46e[_0xe9bd('0x3a')][_0xe9bd('0x2c')]);}_0xc50476['order']=qs[_0xe9bd('0x44')](_0x2ad46e[_0xe9bd('0x3a')][_0xe9bd('0x44')]);_0xc50476['where']=qs[_0xe9bd('0x3b')](_[_0xe9bd('0x45')](_0x2ad46e[_0xe9bd('0x3a')],_0x8ff624[_0xe9bd('0x3b')]),_0x147da5);if(_0x2ad46e[_0xe9bd('0x3a')][_0xe9bd('0x46')]){_0xc50476[_0xe9bd('0x47')]=_[_0xe9bd('0x48')](_0xc50476[_0xe9bd('0x47')],{'$or':_[_0xe9bd('0x38')](_0x147da5,function(_0x3817ab){if(_0x3817ab[_0xe9bd('0x37')]!==_0xe9bd('0x49')){var _0x2a9e09={};_0x2a9e09[_0x3817ab[_0xe9bd('0x31')]]={'$like':'%'+_0x2ad46e['query']['filter']+'%'};return _0x2a9e09;}})});}_0xc50476=_[_0xe9bd('0x48')]({},_0xc50476,_0x2ad46e[_0xe9bd('0x4a')]);var _0x1fe93a={'where':_0xc50476['where']};return db['FreshsalesAccount'][_0xe9bd('0x2b')](_0x1fe93a)[_0xe9bd('0x1d')](function(_0x165942){_0x264ba0[_0xe9bd('0x2b')]=_0x165942;if(_0x2ad46e[_0xe9bd('0x3a')][_0xe9bd('0x4b')]){_0xc50476[_0xe9bd('0x4c')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xe9bd('0x4d')](_0xc50476);})['then'](function(_0x36726e){_0x264ba0[_0xe9bd('0x4e')]=_0x36726e;return _0x264ba0;})[_0xe9bd('0x1d')](respondWithFilteredResult(_0x199477,_0xc50476))[_0xe9bd('0x4f')](handleError(_0x199477,null));};exports[_0xe9bd('0x50')]=function(_0x4b7b67,_0x3317d6){var _0x3e5d44={'raw':![],'where':{'id':_0x4b7b67['params']['id']}},_0xe14fa4={};_0xe14fa4[_0xe9bd('0x3c')]=_[_0xe9bd('0x39')](db[_0xe9bd('0x34')]['rawAttributes']);_0xe14fa4[_0xe9bd('0x3a')]=_[_0xe9bd('0x39')](_0x4b7b67[_0xe9bd('0x3a')]);_0xe14fa4[_0xe9bd('0x3b')]=_[_0xe9bd('0x3e')](_0xe14fa4['model'],_0xe14fa4[_0xe9bd('0x3a')]);_0x3e5d44['attributes']=_[_0xe9bd('0x3e')](_0xe14fa4[_0xe9bd('0x3c')],qs[_0xe9bd('0x3f')](_0x4b7b67[_0xe9bd('0x3a')][_0xe9bd('0x3f')]));_0x3e5d44['attributes']=_0x3e5d44[_0xe9bd('0x3d')]['length']?_0x3e5d44[_0xe9bd('0x3d')]:_0xe14fa4[_0xe9bd('0x3c')];if(_0x4b7b67['query']['includeAll']){_0x3e5d44[_0xe9bd('0x4c')]=[{'all':!![]}];}_0x3e5d44=_['merge']({},_0x3e5d44,_0x4b7b67[_0xe9bd('0x4a')]);return db['FreshsalesAccount'][_0xe9bd('0x51')](_0x3e5d44)[_0xe9bd('0x1d')](handleEntityNotFound(_0x3317d6,null))['then'](respondWithResult(_0x3317d6,null))[_0xe9bd('0x4f')](handleError(_0x3317d6,null));};exports['create']=function(_0x3aeda2,_0x2d9a94){return db[_0xe9bd('0x34')]['create'](_0x3aeda2[_0xe9bd('0x52')],{})[_0xe9bd('0x1d')](respondWithResult(_0x2d9a94,0xc9))[_0xe9bd('0x4f')](handleError(_0x2d9a94,null));};exports[_0xe9bd('0x2f')]=function(_0x56b777,_0x56362e){if(_0x56b777[_0xe9bd('0x52')]['id']){delete _0x56b777['body']['id'];}return db[_0xe9bd('0x34')][_0xe9bd('0x51')]({'where':{'id':_0x56b777[_0xe9bd('0x53')]['id']}})[_0xe9bd('0x1d')](handleEntityNotFound(_0x56362e,null))[_0xe9bd('0x1d')](saveUpdates(_0x56b777[_0xe9bd('0x52')],null))[_0xe9bd('0x1d')](respondWithResult(_0x56362e,null))[_0xe9bd('0x4f')](handleError(_0x56362e,null));};exports[_0xe9bd('0x54')]=function(_0x3be526,_0x1fd5bf){return db[_0xe9bd('0x34')]['find']({'where':{'id':_0x3be526['params']['id']}})['then'](handleEntityNotFound(_0x1fd5bf,null))[_0xe9bd('0x1d')](removeEntity(_0x1fd5bf,null))['catch'](handleError(_0x1fd5bf,null));};exports[_0xe9bd('0x55')]=function(_0xdd1301,_0x90db01,_0x6232e5){var _0x1c9328={};var _0xaf6ffd={};var _0x3bb2ba;var _0x46797c;return db[_0xe9bd('0x34')]['findOne']({'where':{'id':_0xdd1301[_0xe9bd('0x53')]['id']}})[_0xe9bd('0x1d')](handleEntityNotFound(_0x90db01,null))[_0xe9bd('0x1d')](function(_0x3f848d){if(_0x3f848d){_0x3bb2ba=_0x3f848d;_0xaf6ffd['model']=_[_0xe9bd('0x39')](db[_0xe9bd('0x56')][_0xe9bd('0x35')]);_0xaf6ffd['query']=_[_0xe9bd('0x39')](_0xdd1301[_0xe9bd('0x3a')]);_0xaf6ffd[_0xe9bd('0x3b')]=_[_0xe9bd('0x3e')](_0xaf6ffd['model'],_0xaf6ffd['query']);_0x1c9328[_0xe9bd('0x3d')]=_[_0xe9bd('0x3e')](_0xaf6ffd[_0xe9bd('0x3c')],qs[_0xe9bd('0x3f')](_0xdd1301['query']['fields']));_0x1c9328[_0xe9bd('0x3d')]=_0x1c9328[_0xe9bd('0x3d')][_0xe9bd('0x40')]?_0x1c9328[_0xe9bd('0x3d')]:_0xaf6ffd[_0xe9bd('0x3c')];_0x1c9328[_0xe9bd('0x57')]=qs['sort'](_0xdd1301[_0xe9bd('0x3a')]['sort']);_0x1c9328[_0xe9bd('0x47')]=qs[_0xe9bd('0x3b')](_[_0xe9bd('0x45')](_0xdd1301[_0xe9bd('0x3a')],_0xaf6ffd['filters']));if(_0xdd1301[_0xe9bd('0x3a')][_0xe9bd('0x46')]){_0x1c9328[_0xe9bd('0x47')]=_['merge'](_0x1c9328[_0xe9bd('0x47')],{'$or':_[_0xe9bd('0x38')](_0x1c9328[_0xe9bd('0x3d')],function(_0x3e3e05){var _0x43dabe={};_0x43dabe[_0x3e3e05]={'$like':'%'+_0xdd1301[_0xe9bd('0x3a')][_0xe9bd('0x46')]+'%'};return _0x43dabe;})});}_0x1c9328=_[_0xe9bd('0x48')]({},_0x1c9328,_0xdd1301[_0xe9bd('0x4a')]);return _0x3bb2ba[_0xe9bd('0x55')](_0x1c9328);}})[_0xe9bd('0x1d')](function(_0x37d07a){if(_0x37d07a){_0x46797c=_0x37d07a['length'];if(!_0xdd1301[_0xe9bd('0x3a')][_0xe9bd('0x41')]('nolimit')){_0x1c9328[_0xe9bd('0x43')]=qs[_0xe9bd('0x43')](_0xdd1301['query']['limit']);_0x1c9328[_0xe9bd('0x2c')]=qs[_0xe9bd('0x2c')](_0xdd1301['query']['offset']);}return _0x3bb2ba['getConfigurations'](_0x1c9328);}})[_0xe9bd('0x1d')](function(_0x55cb4b){if(_0x55cb4b){return _0x55cb4b?{'count':_0x46797c,'rows':_0x55cb4b}:null;}})['then'](respondWithResult(_0x90db01,null))['catch'](handleError(_0x90db01,null));};exports['addConfiguration']=function(_0x1fc88d,_0x46da33,_0x2ed5f2){if(_0x1fc88d['body']['id']){delete _0x1fc88d[_0xe9bd('0x52')]['id'];}return db[_0xe9bd('0x34')][_0xe9bd('0x58')]({'where':{'id':_0x1fc88d[_0xe9bd('0x53')]['id']}})['then'](handleEntityNotFound(_0x46da33,null))[_0xe9bd('0x1d')](function(_0x10ef2b){if(_0x10ef2b){_0x1fc88d[_0xe9bd('0x52')]['AccountId']=_0x10ef2b['id'];_0x1fc88d['body'][_0xe9bd('0x59')]=integrations[_0xe9bd('0x5a')](_0x1fc88d[_0xe9bd('0x52')][_0xe9bd('0x5b')],_0x1fc88d[_0xe9bd('0x52')][_0xe9bd('0x37')]);_0x1fc88d[_0xe9bd('0x52')][_0xe9bd('0x5c')]=integrations['getDescriptions'](_0x1fc88d[_0xe9bd('0x52')][_0xe9bd('0x5b')],_0x1fc88d[_0xe9bd('0x52')][_0xe9bd('0x37')]);return db[_0xe9bd('0x56')]['create'](_0x1fc88d[_0xe9bd('0x52')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0xe9bd('0x5d')],'as':_0xe9bd('0x5c')}]});}return null;})['then'](respondWithResult(_0x46da33,null))[_0xe9bd('0x4f')](handleError(_0x46da33,null));};exports[_0xe9bd('0x5e')]=function(_0x1c6644,_0x292faf,_0x582cf3){var _0x3c1ab9='';var _0x41fb41='';return db['FreshsalesAccount'][_0xe9bd('0x58')]({'where':{'id':_0x1c6644[_0xe9bd('0x53')]['id']},'attributes':['id',_0xe9bd('0x5f'),_0xe9bd('0x60'),_0xe9bd('0x61')]})[_0xe9bd('0x1d')](handleEntityNotFound(_0x292faf,null))[_0xe9bd('0x1d')](function(_0x5e127b){if(_0x5e127b){_0x41fb41=_0x5e127b[_0xe9bd('0x5f')];_0x3c1ab9=_0x5e127b[_0xe9bd('0x60')];var _0x178574=_0x5e127b[_0xe9bd('0x60')][_0xe9bd('0x62')](-0x1);if(_0x178574==='/'){_0x3c1ab9=_0x3c1ab9[_0xe9bd('0x63')](0x0,_0x3c1ab9[_0xe9bd('0x64')](_0x178574));}return rp({'method':_0xe9bd('0x65'),'uri':util[_0xe9bd('0x66')]('%s%s',_0x3c1ab9,_0xe9bd('0x67')),'headers':{'Authorization':_0xe9bd('0x68')+_0x5e127b[_0xe9bd('0x61')]},'json':!![]});}})[_0xe9bd('0x1d')](function(_0x383e0c){if(_0x383e0c){var _0x7354df=_0x383e0c[_0xe9bd('0x69')];var _0x4b9c08=![];var _0x18519d=null;for(_0x18519d=0x0;_0x18519d<_0x7354df[_0xe9bd('0x40')];_0x18519d++){if(_0x7354df[_0x18519d]['email']===_0x41fb41){_0x4b9c08=!![];}}if(_0x4b9c08){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xe9bd('0x6a')});}}})[_0xe9bd('0x1d')](respondWithResult(_0x292faf,null))[_0xe9bd('0x4f')](function(_0x2083c4){var _0x242110=_0x1c6644[_0xe9bd('0x3a')][_0xe9bd('0x6b')]?0x1f4:_0x2083c4['statusCode']||0x1f4;logger['error'](_0xe9bd('0x6c'),_0xe9bd('0x5e'),_0x242110,JSON[_0xe9bd('0x22')](_0x2083c4));delete _0x2083c4[_0xe9bd('0x31')];if(_0x242110===0x191){_0x242110=0x190;}_0x292faf[_0xe9bd('0x28')](_0x242110)[_0xe9bd('0x32')](_0x1c6644[_0xe9bd('0x3a')]['test']?{'message':_0xe9bd('0x6d'),'statusCode':_0x2083c4[_0xe9bd('0x6e')]}:_0x2083c4);});}; \ No newline at end of file +var _0x6c76=['filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','intersection','include','find','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','end','status','count','offset','limit','set','Content-Range','json','save','update','then','destroy','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x15865b,_0x212ac1){var _0x326583=function(_0x16fe4e){while(--_0x16fe4e){_0x15865b['push'](_0x15865b['shift']());}};_0x326583(++_0x212ac1);}(_0x6c76,0x184));var _0x66c7=function(_0xf94360,_0x39740d){_0xf94360=_0xf94360-0x0;var _0x4054fc=_0x6c76[_0xf94360];return _0x4054fc;};'use strict';var pdf=require(_0x66c7('0x0'));var emlformat=require(_0x66c7('0x1'));var rimraf=require(_0x66c7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66c7('0x3'));var rp=require(_0x66c7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x66c7('0x5'));var util=require(_0x66c7('0x6'));var path=require('path');var sox=require(_0x66c7('0x7'));var csv=require(_0x66c7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x66c7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c7('0xa'));var deskjs=require(_0x66c7('0xb'));var toCsv=require(_0x66c7('0x8'));var querystring=require('querystring');var Papa=require(_0x66c7('0xc'));var Redis=require(_0x66c7('0xd'));var authService=require(_0x66c7('0xe'));var qs=require(_0x66c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c7('0x10'));var logger=require(_0x66c7('0x11'))(_0x66c7('0x12'));var utils=require(_0x66c7('0x13'));var config=require(_0x66c7('0x14'));var licenseUtil=require(_0x66c7('0x15'));var db=require(_0x66c7('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x66c7('0x17'));var client=jayson[_0x66c7('0x18')][_0x66c7('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xea3f56,_0x4f6c91,_0x1e91d1,_0x618bd7){return new BPromise(function(_0xf3b04,_0x6400fe){var _0x5d44e1=_0x618bd7||client;return _0x5d44e1[_0x66c7('0x1a')](_0xea3f56,_0x1e91d1)['then'](function(_0x208010){logger[_0x66c7('0x1b')](_0x66c7('0x1c'),_0x4f6c91,_0x66c7('0x1d'));logger[_0x66c7('0x1e')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4f6c91,'request\x20sent',JSON['stringify'](_0x208010));if(_0x208010['error']){if(_0x208010[_0x66c7('0x1f')][_0x66c7('0x20')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x4f6c91,_0x208010[_0x66c7('0x1f')][_0x66c7('0x21')]);return _0x6400fe(_0x208010[_0x66c7('0x1f')][_0x66c7('0x21')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x4f6c91,_0x208010[_0x66c7('0x1f')][_0x66c7('0x21')]);return _0xf3b04(_0x208010[_0x66c7('0x1f')][_0x66c7('0x21')]);}else{logger[_0x66c7('0x1b')](_0x66c7('0x1c'),_0x4f6c91,'request\x20sent');_0xf3b04(_0x208010[_0x66c7('0x22')][_0x66c7('0x21')]);}})['catch'](function(_0x7462f1){logger[_0x66c7('0x1f')](_0x66c7('0x1c'),_0x4f6c91,_0x7462f1);_0x6400fe(_0x7462f1);});});}function respondWithStatusCode(_0x1fc9d3,_0x5bfaf6){_0x5bfaf6=_0x5bfaf6||0xcc;return function(_0x2736df){if(_0x2736df){return _0x1fc9d3[_0x66c7('0x23')](_0x5bfaf6);}return _0x1fc9d3['status'](_0x5bfaf6)[_0x66c7('0x24')]();};}function respondWithResult(_0x11a6b9,_0x2bb86d){_0x2bb86d=_0x2bb86d||0xc8;return function(_0x2ef6a2){if(_0x2ef6a2){return _0x11a6b9[_0x66c7('0x25')](_0x2bb86d)['json'](_0x2ef6a2);}};}function respondWithFilteredResult(_0x5bc4e6,_0x4e514a){return function(_0x2dd131){if(_0x2dd131){var _0x542ff1=_0x2dd131[_0x66c7('0x26')],_0x5c5e42=_0x4e514a[_0x66c7('0x27')],_0x9afd50=_0x4e514a[_0x66c7('0x27')]+_0x4e514a[_0x66c7('0x28')],_0x3e979d;if(_0x9afd50>=_0x542ff1){_0x9afd50=_0x542ff1;_0x3e979d=0xc8;}else{_0x3e979d=0xce;}_0x5bc4e6['status'](_0x3e979d);return _0x5bc4e6[_0x66c7('0x29')](_0x66c7('0x2a'),_0x5c5e42+'-'+_0x9afd50+'/'+_0x542ff1)[_0x66c7('0x2b')](_0x2dd131);}return null;};}function patchUpdates(_0x33be23){return function(_0x2042ea){try{jsonpatch['apply'](_0x2042ea,_0x33be23,!![]);}catch(_0x263b48){return BPromise['reject'](_0x263b48);}return _0x2042ea[_0x66c7('0x2c')]();};}function saveUpdates(_0x543fbf,_0x296875){return function(_0x45619c){if(_0x45619c){return _0x45619c[_0x66c7('0x2d')](_0x543fbf)[_0x66c7('0x2e')](function(_0xb26028){return _0xb26028;});}return null;};}function removeEntity(_0x24e776,_0x559ab9){return function(_0x520bd2){if(_0x520bd2){return _0x520bd2[_0x66c7('0x2f')]()[_0x66c7('0x2e')](function(){_0x24e776[_0x66c7('0x25')](0xcc)[_0x66c7('0x24')]();});}};}function handleEntityNotFound(_0x344345,_0x131f24){return function(_0x44dcde){if(!_0x44dcde){_0x344345[_0x66c7('0x23')](0x194);}return _0x44dcde;};}function handleError(_0x15edc8,_0x301495){_0x301495=_0x301495||0x1f4;return function(_0x1fd460){logger[_0x66c7('0x1f')](_0x1fd460['stack']);if(_0x1fd460['name']){delete _0x1fd460[_0x66c7('0x30')];}_0x15edc8[_0x66c7('0x25')](_0x301495)[_0x66c7('0x31')](_0x1fd460);};}exports[_0x66c7('0x32')]=function(_0x45050c,_0x2bf7c2){var _0x21d0d3={},_0x5503c3={},_0x30b90f={'count':0x0,'rows':[]};var _0x33b7ff=_[_0x66c7('0x33')](db[_0x66c7('0x34')][_0x66c7('0x35')],function(_0x324696){return{'name':_0x324696[_0x66c7('0x36')],'type':_0x324696[_0x66c7('0x37')][_0x66c7('0x38')]};});_0x5503c3[_0x66c7('0x39')]=_[_0x66c7('0x33')](_0x33b7ff,'name');_0x5503c3['query']=_[_0x66c7('0x3a')](_0x45050c[_0x66c7('0x3b')]);_0x5503c3[_0x66c7('0x3c')]=_['intersection'](_0x5503c3['model'],_0x5503c3[_0x66c7('0x3b')]);_0x21d0d3[_0x66c7('0x3d')]=_['intersection'](_0x5503c3[_0x66c7('0x39')],qs[_0x66c7('0x3e')](_0x45050c[_0x66c7('0x3b')]['fields']));_0x21d0d3[_0x66c7('0x3d')]=_0x21d0d3[_0x66c7('0x3d')][_0x66c7('0x3f')]?_0x21d0d3[_0x66c7('0x3d')]:_0x5503c3[_0x66c7('0x39')];if(!_0x45050c[_0x66c7('0x3b')][_0x66c7('0x40')](_0x66c7('0x41'))){_0x21d0d3[_0x66c7('0x28')]=qs['limit'](_0x45050c[_0x66c7('0x3b')][_0x66c7('0x28')]);_0x21d0d3[_0x66c7('0x27')]=qs[_0x66c7('0x27')](_0x45050c[_0x66c7('0x3b')][_0x66c7('0x27')]);}_0x21d0d3[_0x66c7('0x42')]=qs[_0x66c7('0x43')](_0x45050c[_0x66c7('0x3b')][_0x66c7('0x43')]);_0x21d0d3['where']=qs['filters'](_['pick'](_0x45050c[_0x66c7('0x3b')],_0x5503c3[_0x66c7('0x3c')]),_0x33b7ff);if(_0x45050c['query']['filter']){_0x21d0d3[_0x66c7('0x44')]=_[_0x66c7('0x45')](_0x21d0d3[_0x66c7('0x44')],{'$or':_[_0x66c7('0x33')](_0x33b7ff,function(_0x2c5269){if(_0x2c5269['type']!==_0x66c7('0x46')){var _0x4b05d8={};_0x4b05d8[_0x2c5269['name']]={'$like':'%'+_0x45050c[_0x66c7('0x3b')][_0x66c7('0x47')]+'%'};return _0x4b05d8;}})});}_0x21d0d3=_[_0x66c7('0x45')]({},_0x21d0d3,_0x45050c[_0x66c7('0x48')]);var _0x519f10={'where':_0x21d0d3['where']};return db[_0x66c7('0x34')]['count'](_0x519f10)['then'](function(_0x1ec272){_0x30b90f[_0x66c7('0x26')]=_0x1ec272;if(_0x45050c[_0x66c7('0x3b')][_0x66c7('0x49')]){_0x21d0d3['include']=[{'all':!![]}];}return db[_0x66c7('0x34')][_0x66c7('0x4a')](_0x21d0d3);})[_0x66c7('0x2e')](function(_0x4f4590){_0x30b90f[_0x66c7('0x4b')]=_0x4f4590;return _0x30b90f;})[_0x66c7('0x2e')](respondWithFilteredResult(_0x2bf7c2,_0x21d0d3))[_0x66c7('0x4c')](handleError(_0x2bf7c2,null));};exports[_0x66c7('0x4d')]=function(_0x1b78a6,_0x3b4f34){var _0x2e3f06={'raw':![],'where':{'id':_0x1b78a6['params']['id']}},_0x465a3d={};_0x465a3d[_0x66c7('0x39')]=_[_0x66c7('0x3a')](db[_0x66c7('0x34')][_0x66c7('0x35')]);_0x465a3d[_0x66c7('0x3b')]=_[_0x66c7('0x3a')](_0x1b78a6[_0x66c7('0x3b')]);_0x465a3d[_0x66c7('0x3c')]=_[_0x66c7('0x4e')](_0x465a3d[_0x66c7('0x39')],_0x465a3d[_0x66c7('0x3b')]);_0x2e3f06[_0x66c7('0x3d')]=_[_0x66c7('0x4e')](_0x465a3d[_0x66c7('0x39')],qs['fields'](_0x1b78a6[_0x66c7('0x3b')][_0x66c7('0x3e')]));_0x2e3f06[_0x66c7('0x3d')]=_0x2e3f06[_0x66c7('0x3d')]['length']?_0x2e3f06[_0x66c7('0x3d')]:_0x465a3d[_0x66c7('0x39')];if(_0x1b78a6['query'][_0x66c7('0x49')]){_0x2e3f06[_0x66c7('0x4f')]=[{'all':!![]}];}_0x2e3f06=_[_0x66c7('0x45')]({},_0x2e3f06,_0x1b78a6[_0x66c7('0x48')]);return db[_0x66c7('0x34')][_0x66c7('0x50')](_0x2e3f06)[_0x66c7('0x2e')](handleEntityNotFound(_0x3b4f34,null))['then'](respondWithResult(_0x3b4f34,null))[_0x66c7('0x4c')](handleError(_0x3b4f34,null));};exports[_0x66c7('0x51')]=function(_0x4a619d,_0x127dfe){return db[_0x66c7('0x34')][_0x66c7('0x51')](_0x4a619d['body'],{})[_0x66c7('0x2e')](respondWithResult(_0x127dfe,0xc9))[_0x66c7('0x4c')](handleError(_0x127dfe,null));};exports[_0x66c7('0x2d')]=function(_0x187623,_0x35f5a0){if(_0x187623[_0x66c7('0x52')]['id']){delete _0x187623[_0x66c7('0x52')]['id'];}return db[_0x66c7('0x34')]['find']({'where':{'id':_0x187623[_0x66c7('0x53')]['id']}})[_0x66c7('0x2e')](handleEntityNotFound(_0x35f5a0,null))['then'](saveUpdates(_0x187623[_0x66c7('0x52')],null))[_0x66c7('0x2e')](respondWithResult(_0x35f5a0,null))[_0x66c7('0x4c')](handleError(_0x35f5a0,null));};exports['destroy']=function(_0x572b91,_0x1f2695){return db['FreshsalesAccount'][_0x66c7('0x50')]({'where':{'id':_0x572b91[_0x66c7('0x53')]['id']}})[_0x66c7('0x2e')](handleEntityNotFound(_0x1f2695,null))[_0x66c7('0x2e')](removeEntity(_0x1f2695,null))[_0x66c7('0x4c')](handleError(_0x1f2695,null));};exports[_0x66c7('0x54')]=function(_0x5b35cf,_0x58f938,_0x477e46){var _0x3c3c63={};var _0x5e6e32={};var _0x5a4908;var _0x157369;return db['FreshsalesAccount'][_0x66c7('0x55')]({'where':{'id':_0x5b35cf[_0x66c7('0x53')]['id']}})[_0x66c7('0x2e')](handleEntityNotFound(_0x58f938,null))[_0x66c7('0x2e')](function(_0x5c3717){if(_0x5c3717){_0x5a4908=_0x5c3717;_0x5e6e32[_0x66c7('0x39')]=_[_0x66c7('0x3a')](db[_0x66c7('0x56')][_0x66c7('0x35')]);_0x5e6e32[_0x66c7('0x3b')]=_[_0x66c7('0x3a')](_0x5b35cf['query']);_0x5e6e32[_0x66c7('0x3c')]=_[_0x66c7('0x4e')](_0x5e6e32[_0x66c7('0x39')],_0x5e6e32['query']);_0x3c3c63[_0x66c7('0x3d')]=_['intersection'](_0x5e6e32[_0x66c7('0x39')],qs[_0x66c7('0x3e')](_0x5b35cf[_0x66c7('0x3b')][_0x66c7('0x3e')]));_0x3c3c63[_0x66c7('0x3d')]=_0x3c3c63[_0x66c7('0x3d')]['length']?_0x3c3c63[_0x66c7('0x3d')]:_0x5e6e32[_0x66c7('0x39')];_0x3c3c63[_0x66c7('0x42')]=qs[_0x66c7('0x43')](_0x5b35cf[_0x66c7('0x3b')]['sort']);_0x3c3c63[_0x66c7('0x44')]=qs[_0x66c7('0x3c')](_[_0x66c7('0x57')](_0x5b35cf[_0x66c7('0x3b')],_0x5e6e32[_0x66c7('0x3c')]));if(_0x5b35cf[_0x66c7('0x3b')][_0x66c7('0x47')]){_0x3c3c63[_0x66c7('0x44')]=_[_0x66c7('0x45')](_0x3c3c63[_0x66c7('0x44')],{'$or':_[_0x66c7('0x33')](_0x3c3c63[_0x66c7('0x3d')],function(_0x50f72d){var _0x15fd0e={};_0x15fd0e[_0x50f72d]={'$like':'%'+_0x5b35cf[_0x66c7('0x3b')][_0x66c7('0x47')]+'%'};return _0x15fd0e;})});}_0x3c3c63=_[_0x66c7('0x45')]({},_0x3c3c63,_0x5b35cf[_0x66c7('0x48')]);return _0x5a4908[_0x66c7('0x54')](_0x3c3c63);}})[_0x66c7('0x2e')](function(_0x50be12){if(_0x50be12){_0x157369=_0x50be12[_0x66c7('0x3f')];if(!_0x5b35cf[_0x66c7('0x3b')][_0x66c7('0x40')](_0x66c7('0x41'))){_0x3c3c63[_0x66c7('0x28')]=qs[_0x66c7('0x28')](_0x5b35cf[_0x66c7('0x3b')][_0x66c7('0x28')]);_0x3c3c63[_0x66c7('0x27')]=qs[_0x66c7('0x27')](_0x5b35cf[_0x66c7('0x3b')][_0x66c7('0x27')]);}return _0x5a4908[_0x66c7('0x54')](_0x3c3c63);}})[_0x66c7('0x2e')](function(_0x2b25e7){if(_0x2b25e7){return _0x2b25e7?{'count':_0x157369,'rows':_0x2b25e7}:null;}})[_0x66c7('0x2e')](respondWithResult(_0x58f938,null))['catch'](handleError(_0x58f938,null));};exports[_0x66c7('0x58')]=function(_0x31bc19,_0x43a623,_0x153714){if(_0x31bc19[_0x66c7('0x52')]['id']){delete _0x31bc19[_0x66c7('0x52')]['id'];}return db[_0x66c7('0x34')][_0x66c7('0x55')]({'where':{'id':_0x31bc19[_0x66c7('0x53')]['id']}})[_0x66c7('0x2e')](handleEntityNotFound(_0x43a623,null))[_0x66c7('0x2e')](function(_0x326a6c){if(_0x326a6c){_0x31bc19[_0x66c7('0x52')][_0x66c7('0x59')]=_0x326a6c['id'];_0x31bc19[_0x66c7('0x52')][_0x66c7('0x5a')]=integrations[_0x66c7('0x5b')](_0x31bc19['body'][_0x66c7('0x5c')],_0x31bc19[_0x66c7('0x52')][_0x66c7('0x37')]);_0x31bc19[_0x66c7('0x52')][_0x66c7('0x5d')]=integrations[_0x66c7('0x5e')](_0x31bc19['body']['channel'],_0x31bc19[_0x66c7('0x52')]['type']);return db[_0x66c7('0x56')][_0x66c7('0x51')](_0x31bc19[_0x66c7('0x52')],{'include':[{'model':db[_0x66c7('0x5f')],'as':_0x66c7('0x5a')},{'model':db[_0x66c7('0x5f')],'as':_0x66c7('0x5d')}]});}return null;})[_0x66c7('0x2e')](respondWithResult(_0x43a623,null))[_0x66c7('0x4c')](handleError(_0x43a623,null));};exports[_0x66c7('0x60')]=function(_0x3b8a45,_0x11cc81,_0x552e67){var _0x25f193='';var _0x2b4f98='';return db[_0x66c7('0x34')][_0x66c7('0x55')]({'where':{'id':_0x3b8a45['params']['id']},'attributes':['id',_0x66c7('0x61'),_0x66c7('0x62'),'apiKey']})[_0x66c7('0x2e')](handleEntityNotFound(_0x11cc81,null))[_0x66c7('0x2e')](function(_0x3f25c0){if(_0x3f25c0){_0x2b4f98=_0x3f25c0[_0x66c7('0x61')];_0x25f193=_0x3f25c0[_0x66c7('0x62')];var _0x375c97=_0x3f25c0['remoteUri']['slice'](-0x1);if(_0x375c97==='/'){_0x25f193=_0x25f193[_0x66c7('0x63')](0x0,_0x25f193['lastIndexOf'](_0x375c97));}return rp({'method':'GET','uri':util[_0x66c7('0x64')](_0x66c7('0x65'),_0x25f193,_0x66c7('0x66')),'headers':{'Authorization':_0x66c7('0x67')+_0x3f25c0[_0x66c7('0x68')]},'json':!![]});}})[_0x66c7('0x2e')](function(_0x11de69){if(_0x11de69){var _0x41b4f0=_0x11de69['users'];var _0x3a216e=![];var _0x508e2c=null;for(_0x508e2c=0x0;_0x508e2c<_0x41b4f0[_0x66c7('0x3f')];_0x508e2c++){if(_0x41b4f0[_0x508e2c][_0x66c7('0x69')]===_0x2b4f98){_0x3a216e=!![];}}if(_0x3a216e){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x66c7('0x6a')});}}})[_0x66c7('0x2e')](respondWithResult(_0x11cc81,null))[_0x66c7('0x4c')](function(_0x44a672){var _0x46b54f=_0x3b8a45[_0x66c7('0x3b')][_0x66c7('0x6b')]?0x1f4:_0x44a672[_0x66c7('0x6c')]||0x1f4;logger[_0x66c7('0x1f')](_0x66c7('0x6d'),_0x66c7('0x60'),_0x46b54f,JSON[_0x66c7('0x6e')](_0x44a672));delete _0x44a672[_0x66c7('0x30')];if(_0x46b54f===0x191){_0x46b54f=0x190;}_0x11cc81[_0x66c7('0x25')](_0x46b54f)[_0x66c7('0x31')](_0x3b8a45[_0x66c7('0x3b')][_0x66c7('0x6b')]?{'message':_0x66c7('0x6f'),'statusCode':_0x44a672[_0x66c7('0x6c')]}:_0x44a672);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index b8bf003..b4f7583 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 _0x7764=['FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x5b567e,_0x146470){var _0x4ba29f=function(_0x503f66){while(--_0x503f66){_0x5b567e['push'](_0x5b567e['shift']());}};_0x4ba29f(++_0x146470);}(_0x7764,0x120));var _0x4776=function(_0xb7b878,_0x5c3b92){_0xb7b878=_0xb7b878-0x0;var _0x3c84b9=_0x7764[_0xb7b878];return _0x3c84b9;};'use strict';var _=require(_0x4776('0x0'));var util=require(_0x4776('0x1'));var logger=require(_0x4776('0x2'))(_0x4776('0x3'));var moment=require(_0x4776('0x4'));var BPromise=require(_0x4776('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4776('0x6'));var rimraf=require('rimraf');var config=require(_0x4776('0x7'));var attributes=require(_0x4776('0x8'));var integrations=require(_0x4776('0x9'));module[_0x4776('0xa')]=function(_0x1a1413,_0x3e2d79){return _0x1a1413['define'](_0x4776('0xb'),attributes,{'tableName':_0x4776('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46a7=['FreshsalesAccount','int_freshsales_accounts','../../config/logger','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','exports'];(function(_0x32814c,_0x2a68f5){var _0x394c8d=function(_0x10d48e){while(--_0x10d48e){_0x32814c['push'](_0x32814c['shift']());}};_0x394c8d(++_0x2a68f5);}(_0x46a7,0x92));var _0x746a=function(_0x484235,_0x40bacf){_0x484235=_0x484235-0x0;var _0x569990=_0x46a7[_0x484235];return _0x569990;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x746a('0x0'))('api');var moment=require('moment');var BPromise=require(_0x746a('0x1'));var rp=require(_0x746a('0x2'));var fs=require('fs');var path=require(_0x746a('0x3'));var rimraf=require('rimraf');var config=require(_0x746a('0x4'));var attributes=require(_0x746a('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x746a('0x6')]=function(_0xbb31d7,_0xd81ec0){return _0xbb31d7['define'](_0x746a('0x7'),attributes,{'tableName':_0x746a('0x8'),'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 d6c9508..0a733bc 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 _0x1893=['request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','catch','ShowFreshsalesAccount','find','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x45bf96,_0x56010f){var _0x1f86f4=function(_0x2f87c4){while(--_0x2f87c4){_0x45bf96['push'](_0x45bf96['shift']());}};_0x1f86f4(++_0x56010f);}(_0x1893,0xa2));var _0x3189=function(_0x3882e4,_0x2cd2cd){_0x3882e4=_0x3882e4-0x0;var _0x359fea=_0x1893[_0x3882e4];return _0x359fea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x77c566,_0x118970,_0x14d84b){return new BPromise(function(_0x1f6764,_0x5312a3){return client[_0x3189('0xb')](_0x77c566,_0x14d84b)['then'](function(_0x127449){logger['info'](_0x3189('0xc'),_0x118970,_0x3189('0xd'));logger[_0x3189('0xe')](_0x3189('0xf'),_0x118970,'request\x20sent',JSON[_0x3189('0x10')](_0x127449));if(_0x127449[_0x3189('0x11')]){if(_0x127449[_0x3189('0x11')][_0x3189('0x12')]===0x1f4){logger[_0x3189('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x5312a3(_0x127449[_0x3189('0x11')][_0x3189('0x13')]);}logger[_0x3189('0x11')](_0x3189('0xc'),_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x1f6764(_0x127449['error'][_0x3189('0x13')]);}else{logger[_0x3189('0x14')](_0x3189('0xc'),_0x118970,_0x3189('0xd'));_0x1f6764(_0x127449['result'][_0x3189('0x13')]);}})['catch'](function(_0x55f432){logger[_0x3189('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x118970,_0x55f432);_0x5312a3(_0x55f432);});});}exports[_0x3189('0x15')]=function(_0xf8aed7){var _0x22c7ba=this;return new Promise(function(_0x9905c4,_0x4c4d9b){return db[_0x3189('0x16')][_0x3189('0x17')]({'raw':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7['options'][_0x3189('0x19')]===undefined?!![]:![]:!![],'where':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7[_0x3189('0x18')][_0x3189('0x1a')]||null:null,'attributes':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7['options'][_0x3189('0x1b')]||null:null,'limit':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7[_0x3189('0x18')]['limit']||null:null,'include':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7['options'][_0x3189('0x1c')]?_[_0x3189('0x1d')](_0xf8aed7[_0x3189('0x18')][_0x3189('0x1c')],function(_0x1cbe33){return{'model':db[_0x1cbe33[_0x3189('0x1e')]],'as':_0x1cbe33['as'],'attributes':_0x1cbe33['attributes'],'include':_0x1cbe33['include']?_[_0x3189('0x1d')](_0x1cbe33[_0x3189('0x1c')],function(_0x1dc1c8){return{'model':db[_0x1dc1c8[_0x3189('0x1e')]],'as':_0x1dc1c8['as'],'attributes':_0x1dc1c8[_0x3189('0x1b')],'include':_0x1dc1c8[_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x1dc1c8[_0x3189('0x1c')],function(_0x17b540){return{'model':db[_0x17b540[_0x3189('0x1e')]],'as':_0x17b540['as'],'attributes':_0x17b540['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5aa34a){logger[_0x3189('0x14')](_0x3189('0x15'),_0xf8aed7);logger[_0x3189('0xe')](_0x3189('0x15'),_0xf8aed7,JSON[_0x3189('0x10')](_0x5aa34a));_0x9905c4(_0x5aa34a);})[_0x3189('0x1f')](function(_0x4d453a){logger[_0x3189('0x11')](_0x3189('0x15'),_0x4d453a['message'],_0xf8aed7);_0x4c4d9b(_0x22c7ba[_0x3189('0x11')](0x1f4,_0x4d453a[_0x3189('0x13')]));});});};exports[_0x3189('0x20')]=function(_0x5c7a36){var _0x168dc2=this;return new Promise(function(_0x32bba1,_0x23798e){return db['FreshsalesAccount'][_0x3189('0x21')]({'raw':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36['options'][_0x3189('0x19')]===undefined?!![]:![]:!![],'where':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36[_0x3189('0x18')][_0x3189('0x1a')]||null:null,'attributes':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36['options']['attributes']||null:null,'include':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36['options'][_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x5c7a36[_0x3189('0x18')][_0x3189('0x1c')],function(_0x231d72){return{'model':db[_0x231d72[_0x3189('0x1e')]],'as':_0x231d72['as'],'attributes':_0x231d72[_0x3189('0x1b')],'include':_0x231d72[_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x231d72['include'],function(_0x453e4b){return{'model':db[_0x453e4b[_0x3189('0x1e')]],'as':_0x453e4b['as'],'attributes':_0x453e4b[_0x3189('0x1b')],'include':_0x453e4b[_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x453e4b[_0x3189('0x1c')],function(_0xd1ee0){return{'model':db[_0xd1ee0['model']],'as':_0xd1ee0['as'],'attributes':_0xd1ee0['attributes']};}):[]};}):[]};}):[]:[]})[_0x3189('0x22')](function(_0x580064){logger[_0x3189('0x14')](_0x3189('0x20'),_0x5c7a36);logger['debug'](_0x3189('0x20'),_0x5c7a36,JSON[_0x3189('0x10')](_0x580064));_0x32bba1(_0x580064);})[_0x3189('0x1f')](function(_0x254135){logger['error'](_0x3189('0x20'),_0x254135['message'],_0x5c7a36);_0x23798e(_0x168dc2['error'](0x1f4,_0x254135[_0x3189('0x13')]));});});}; \ No newline at end of file +var _0x6ac2=['find','raw','ShowFreshsalesAccount','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFreshsalesAccount','FreshsalesAccount','options','attributes','limit','include','model','map','then'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6ac2,0x184));var _0x26ac=function(_0x43d050,_0x170448){_0x43d050=_0x43d050-0x0;var _0x157b31=_0x6ac2[_0x43d050];return _0x157b31;};'use strict';var _=require(_0x26ac('0x0'));var util=require('util');var moment=require(_0x26ac('0x1'));var BPromise=require(_0x26ac('0x2'));var rs=require(_0x26ac('0x3'));var fs=require('fs');var Redis=require(_0x26ac('0x4'));var db=require(_0x26ac('0x5'))['db'];var utils=require(_0x26ac('0x6'));var logger=require('../../config/logger')(_0x26ac('0x7'));var config=require('../../config/environment');var jayson=require(_0x26ac('0x8'));var client=jayson[_0x26ac('0x9')][_0x26ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x159ba6,_0x36389c,_0x444ca1){return new BPromise(function(_0x1906d0,_0xd8b1e5){return client['request'](_0x159ba6,_0x444ca1)['then'](function(_0x27ff15){logger[_0x26ac('0xb')](_0x26ac('0xc'),_0x36389c,_0x26ac('0xd'));logger['debug'](_0x26ac('0xe'),_0x36389c,_0x26ac('0xd'),JSON[_0x26ac('0xf')](_0x27ff15));if(_0x27ff15[_0x26ac('0x10')]){if(_0x27ff15['error']['code']===0x1f4){logger[_0x26ac('0x10')](_0x26ac('0xc'),_0x36389c,_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);return _0xd8b1e5(_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);}logger[_0x26ac('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x36389c,_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);return _0x1906d0(_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);}else{logger['info'](_0x26ac('0xc'),_0x36389c,_0x26ac('0xd'));_0x1906d0(_0x27ff15['result'][_0x26ac('0x11')]);}})[_0x26ac('0x12')](function(_0x3b7c5d){logger[_0x26ac('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x36389c,_0x3b7c5d);_0xd8b1e5(_0x3b7c5d);});});}exports[_0x26ac('0x13')]=function(_0xb03bbc){var _0x5cd737=this;return new Promise(function(_0x539eda,_0x111613){return db[_0x26ac('0x14')]['findAll']({'raw':_0xb03bbc[_0x26ac('0x15')]?_0xb03bbc['options']['raw']===undefined?!![]:![]:!![],'where':_0xb03bbc['options']?_0xb03bbc[_0x26ac('0x15')]['where']||null:null,'attributes':_0xb03bbc[_0x26ac('0x15')]?_0xb03bbc[_0x26ac('0x15')][_0x26ac('0x16')]||null:null,'limit':_0xb03bbc[_0x26ac('0x15')]?_0xb03bbc[_0x26ac('0x15')][_0x26ac('0x17')]||null:null,'include':_0xb03bbc[_0x26ac('0x15')]?_0xb03bbc[_0x26ac('0x15')][_0x26ac('0x18')]?_['map'](_0xb03bbc[_0x26ac('0x15')][_0x26ac('0x18')],function(_0x2b8299){return{'model':db[_0x2b8299[_0x26ac('0x19')]],'as':_0x2b8299['as'],'attributes':_0x2b8299[_0x26ac('0x16')],'include':_0x2b8299[_0x26ac('0x18')]?_[_0x26ac('0x1a')](_0x2b8299[_0x26ac('0x18')],function(_0x4172c2){return{'model':db[_0x4172c2[_0x26ac('0x19')]],'as':_0x4172c2['as'],'attributes':_0x4172c2['attributes'],'include':_0x4172c2['include']?_[_0x26ac('0x1a')](_0x4172c2['include'],function(_0x185296){return{'model':db[_0x185296[_0x26ac('0x19')]],'as':_0x185296['as'],'attributes':_0x185296[_0x26ac('0x16')]};}):[]};}):[]};}):[]:[]})[_0x26ac('0x1b')](function(_0x31cb17){logger[_0x26ac('0xb')]('GetFreshsalesAccount',_0xb03bbc);logger['debug'](_0x26ac('0x13'),_0xb03bbc,JSON[_0x26ac('0xf')](_0x31cb17));_0x539eda(_0x31cb17);})[_0x26ac('0x12')](function(_0x4d873e){logger['error'](_0x26ac('0x13'),_0x4d873e[_0x26ac('0x11')],_0xb03bbc);_0x111613(_0x5cd737[_0x26ac('0x10')](0x1f4,_0x4d873e[_0x26ac('0x11')]));});});};exports['ShowFreshsalesAccount']=function(_0x5e1cbc){var _0x3ea2f0=this;return new Promise(function(_0x3e2148,_0x17691a){return db[_0x26ac('0x14')][_0x26ac('0x1c')]({'raw':_0x5e1cbc[_0x26ac('0x15')]?_0x5e1cbc[_0x26ac('0x15')][_0x26ac('0x1d')]===undefined?!![]:![]:!![],'where':_0x5e1cbc[_0x26ac('0x15')]?_0x5e1cbc[_0x26ac('0x15')]['where']||null:null,'attributes':_0x5e1cbc[_0x26ac('0x15')]?_0x5e1cbc[_0x26ac('0x15')]['attributes']||null:null,'include':_0x5e1cbc[_0x26ac('0x15')]?_0x5e1cbc[_0x26ac('0x15')][_0x26ac('0x18')]?_[_0x26ac('0x1a')](_0x5e1cbc[_0x26ac('0x15')][_0x26ac('0x18')],function(_0x375f83){return{'model':db[_0x375f83[_0x26ac('0x19')]],'as':_0x375f83['as'],'attributes':_0x375f83[_0x26ac('0x16')],'include':_0x375f83[_0x26ac('0x18')]?_[_0x26ac('0x1a')](_0x375f83[_0x26ac('0x18')],function(_0x583109){return{'model':db[_0x583109[_0x26ac('0x19')]],'as':_0x583109['as'],'attributes':_0x583109[_0x26ac('0x16')],'include':_0x583109[_0x26ac('0x18')]?_['map'](_0x583109[_0x26ac('0x18')],function(_0x4a842a){return{'model':db[_0x4a842a[_0x26ac('0x19')]],'as':_0x4a842a['as'],'attributes':_0x4a842a[_0x26ac('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x66dc0c){logger[_0x26ac('0xb')](_0x26ac('0x1e'),_0x5e1cbc);logger[_0x26ac('0x1f')](_0x26ac('0x1e'),_0x5e1cbc,JSON[_0x26ac('0xf')](_0x66dc0c));_0x3e2148(_0x66dc0c);})['catch'](function(_0x76f6c4){logger['error'](_0x26ac('0x1e'),_0x76f6c4['message'],_0x5e1cbc);_0x17691a(_0x3ea2f0[_0x26ac('0x10')](0x1f4,_0x76f6c4['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 86d05fc..6563bd5 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 _0x3940=['update','delete','multer','util','path','express','Router','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x4bf2eb,_0x1a03d){var _0x3b11bd=function(_0x5de53f){while(--_0x5de53f){_0x4bf2eb['push'](_0x4bf2eb['shift']());}};_0x3b11bd(++_0x1a03d);}(_0x3940,0x1bc));var _0x0394=function(_0x2d5ddf,_0x5313db){_0x2d5ddf=_0x2d5ddf-0x0;var _0x5f9c70=_0x3940[_0x2d5ddf];return _0x5f9c70;};'use strict';var multer=require(_0x0394('0x0'));var util=require(_0x0394('0x1'));var path=require(_0x0394('0x2'));var timeout=require('connect-timeout');var express=require(_0x0394('0x3'));var router=express[_0x0394('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0394('0x5'));var config=require('../../config/environment');var controller=require(_0x0394('0x6'));router[_0x0394('0x7')]('/',auth[_0x0394('0x8')](),controller['index']);router[_0x0394('0x7')](_0x0394('0x9'),auth[_0x0394('0x8')](),controller[_0x0394('0xa')]);router[_0x0394('0x7')](_0x0394('0xb'),auth[_0x0394('0x8')](),controller[_0x0394('0xc')]);router[_0x0394('0x7')](_0x0394('0xd'),auth[_0x0394('0x8')](),controller[_0x0394('0xe')]);router[_0x0394('0x7')]('/:id/fields',auth[_0x0394('0x8')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0394('0x9'),auth[_0x0394('0x8')](),controller[_0x0394('0xf')]);router[_0x0394('0x10')](_0x0394('0x9'),auth[_0x0394('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa2f4=['/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xa2f4,0xa7));var _0x4a2f=function(_0x46969b,_0x20c7e8){_0x46969b=_0x46969b-0x0;var _0x4cabb6=_0xa2f4[_0x46969b];return _0x4cabb6;};'use strict';var multer=require('multer');var util=require(_0x4a2f('0x0'));var path=require('path');var timeout=require(_0x4a2f('0x1'));var express=require(_0x4a2f('0x2'));var router=express[_0x4a2f('0x3')]();var auth=require(_0x4a2f('0x4'));var interaction=require(_0x4a2f('0x5'));var config=require(_0x4a2f('0x6'));var controller=require(_0x4a2f('0x7'));router[_0x4a2f('0x8')]('/',auth[_0x4a2f('0x9')](),controller[_0x4a2f('0xa')]);router[_0x4a2f('0x8')](_0x4a2f('0xb'),auth[_0x4a2f('0x9')](),controller[_0x4a2f('0xc')]);router['get'](_0x4a2f('0xd'),auth[_0x4a2f('0x9')](),controller[_0x4a2f('0xe')]);router['get'](_0x4a2f('0xf'),auth[_0x4a2f('0x9')](),controller[_0x4a2f('0x10')]);router[_0x4a2f('0x8')](_0x4a2f('0x11'),auth['isAuthenticated'](),controller[_0x4a2f('0x12')]);router[_0x4a2f('0x13')]('/',auth[_0x4a2f('0x9')](),controller[_0x4a2f('0x14')]);router[_0x4a2f('0x15')]('/:id',auth[_0x4a2f('0x9')](),controller[_0x4a2f('0x16')]);router[_0x4a2f('0x17')](_0x4a2f('0xb'),auth[_0x4a2f('0x9')](),controller[_0x4a2f('0x18')]);module[_0x4a2f('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 1a1a128..e8641cd 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 _0xa23f=['exports','STRING','sequelize'];(function(_0xf683b7,_0x11cebf){var _0x286d96=function(_0x44972e){while(--_0x44972e){_0xf683b7['push'](_0xf683b7['shift']());}};_0x286d96(++_0x11cebf);}(_0xa23f,0x92));var _0xfa23=function(_0x3e2bc4,_0xfbef5e){_0x3e2bc4=_0x3e2bc4-0x0;var _0x15f557=_0xa23f[_0x3e2bc4];return _0x15f557;};'use strict';var Sequelize=require(_0xfa23('0x0'));module[_0xfa23('0x1')]={'name':{'type':Sequelize[_0xfa23('0x2')]},'description':{'type':Sequelize[_0xfa23('0x2')]}}; \ No newline at end of file +var _0x8ffe=['exports','STRING','sequelize'];(function(_0x1a69ab,_0x4abe2f){var _0x1c9c17=function(_0x1bcdfc){while(--_0x1bcdfc){_0x1a69ab['push'](_0x1a69ab['shift']());}};_0x1c9c17(++_0x4abe2f);}(_0x8ffe,0x18e));var _0xe8ff=function(_0x525b3,_0x27ea21){_0x525b3=_0x525b3-0x0;var _0x14d6bc=_0x8ffe[_0x525b3];return _0x14d6bc;};'use strict';var Sequelize=require(_0xe8ff('0x0'));module[_0xe8ff('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe8ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index a8d9252..e7b335b 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','order','sort','filters','pick','where','type','VIRTUAL','filter','FreshsalesConfiguration','count','includeAll','include','rows','catch','show','length','options','find','create','body','params','getSubjects','FreshsalesField','merge','hasOwnProperty','nolimit','getDescriptions','findOne','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','end','status','json','offset','limit','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map'];(function(_0x4617bc,_0x5d5300){var _0x1c3ea5=function(_0x54ca55){while(--_0x54ca55){_0x4617bc['push'](_0x4617bc['shift']());}};_0x1c3ea5(++_0x5d5300);}(_0x53ec,0x192));var _0xc53e=function(_0x510912,_0x91f943){_0x510912=_0x510912-0x0;var _0x23f357=_0x53ec[_0x510912];return _0x23f357;};'use strict';var pdf=require(_0xc53e('0x0'));var emlformat=require(_0xc53e('0x1'));var rimraf=require(_0xc53e('0x2'));var zipdir=require(_0xc53e('0x3'));var jsonpatch=require(_0xc53e('0x4'));var rp=require(_0xc53e('0x5'));var moment=require('moment');var BPromise=require(_0xc53e('0x6'));var Mustache=require('mustache');var util=require(_0xc53e('0x7'));var path=require(_0xc53e('0x8'));var sox=require('sox');var csv=require(_0xc53e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0x9'));var querystring=require(_0xc53e('0xe'));var Papa=require(_0xc53e('0xf'));var Redis=require(_0xc53e('0x10'));var authService=require(_0xc53e('0x11'));var qs=require(_0xc53e('0x12'));var as=require(_0xc53e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x15'));var db=require(_0xc53e('0x16'))['db'];var jayson=require(_0xc53e('0x17'));var client=jayson[_0xc53e('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e74c9,_0x1c06cd,_0x19a772,_0x7cd798){return new BPromise(function(_0x3d2e17,_0x358ef3){var _0x382e87=_0x7cd798||client;return _0x382e87[_0xc53e('0x19')](_0x4e74c9,_0x19a772)[_0xc53e('0x1a')](function(_0x455e4d){logger[_0xc53e('0x1b')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c06cd,_0xc53e('0x1c'));logger[_0xc53e('0x1d')](_0xc53e('0x1e'),_0x1c06cd,_0xc53e('0x1c'),JSON[_0xc53e('0x1f')](_0x455e4d));if(_0x455e4d[_0xc53e('0x20')]){if(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x21')]===0x1f4){logger[_0xc53e('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c06cd,_0x455e4d['error'][_0xc53e('0x22')]);return _0x358ef3(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);}logger[_0xc53e('0x20')](_0xc53e('0x23'),_0x1c06cd,_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);return _0x3d2e17(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);}else{logger[_0xc53e('0x1b')](_0xc53e('0x23'),_0x1c06cd,_0xc53e('0x1c'));_0x3d2e17(_0x455e4d[_0xc53e('0x24')]['message']);}})['catch'](function(_0x531ede){logger[_0xc53e('0x20')](_0xc53e('0x23'),_0x1c06cd,_0x531ede);_0x358ef3(_0x531ede);});});}function respondWithStatusCode(_0x7591c1,_0x4015c8){_0x4015c8=_0x4015c8||0xcc;return function(_0x180811){if(_0x180811){return _0x7591c1['sendStatus'](_0x4015c8);}return _0x7591c1['status'](_0x4015c8)[_0xc53e('0x25')]();};}function respondWithResult(_0x496167,_0x1ae55e){_0x1ae55e=_0x1ae55e||0xc8;return function(_0x3a5ce8){if(_0x3a5ce8){return _0x496167[_0xc53e('0x26')](_0x1ae55e)[_0xc53e('0x27')](_0x3a5ce8);}};}function respondWithFilteredResult(_0x63c5dc,_0x4df8cf){return function(_0x398e7a){if(_0x398e7a){var _0x4b9f6a=_0x398e7a['count'],_0x4d9a68=_0x4df8cf[_0xc53e('0x28')],_0x5c65d3=_0x4df8cf['offset']+_0x4df8cf[_0xc53e('0x29')],_0x3c5056;if(_0x5c65d3>=_0x4b9f6a){_0x5c65d3=_0x4b9f6a;_0x3c5056=0xc8;}else{_0x3c5056=0xce;}_0x63c5dc['status'](_0x3c5056);return _0x63c5dc['set'](_0xc53e('0x2a'),_0x4d9a68+'-'+_0x5c65d3+'/'+_0x4b9f6a)[_0xc53e('0x27')](_0x398e7a);}return null;};}function patchUpdates(_0x42dec1){return function(_0x2fa20b){try{jsonpatch[_0xc53e('0x2b')](_0x2fa20b,_0x42dec1,!![]);}catch(_0xf97d78){return BPromise[_0xc53e('0x2c')](_0xf97d78);}return _0x2fa20b[_0xc53e('0x2d')]();};}function saveUpdates(_0x4ace0b,_0x437893){return function(_0x311835){if(_0x311835){return _0x311835[_0xc53e('0x2e')](_0x4ace0b)['then'](function(_0x4057f9){return _0x4057f9;});}return null;};}function removeEntity(_0x495756,_0x4572e){return function(_0x2467f4){if(_0x2467f4){return _0x2467f4['destroy']()['then'](function(){_0x495756[_0xc53e('0x26')](0xcc)[_0xc53e('0x25')]();});}};}function handleEntityNotFound(_0x3f4547,_0x30d037){return function(_0x1b95c2){if(!_0x1b95c2){_0x3f4547[_0xc53e('0x2f')](0x194);}return _0x1b95c2;};}function handleError(_0x40a8db,_0x168d25){_0x168d25=_0x168d25||0x1f4;return function(_0x4ffddc){logger[_0xc53e('0x20')](_0x4ffddc[_0xc53e('0x30')]);if(_0x4ffddc[_0xc53e('0x31')]){delete _0x4ffddc[_0xc53e('0x31')];}_0x40a8db[_0xc53e('0x26')](_0x168d25)[_0xc53e('0x32')](_0x4ffddc);};}exports[_0xc53e('0x33')]=function(_0x16942c,_0x215abe){var _0x595efb={},_0x3e395c={},_0x48d7d0={'count':0x0,'rows':[]};var _0x1059f3=_[_0xc53e('0x34')](db['FreshsalesConfiguration'][_0xc53e('0x35')],function(_0x154f8b){return{'name':_0x154f8b[_0xc53e('0x36')],'type':_0x154f8b['type'][_0xc53e('0x37')]};});_0x3e395c[_0xc53e('0x38')]=_[_0xc53e('0x34')](_0x1059f3,_0xc53e('0x31'));_0x3e395c[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x16942c[_0xc53e('0x39')]);_0x3e395c['filters']=_[_0xc53e('0x3b')](_0x3e395c[_0xc53e('0x38')],_0x3e395c[_0xc53e('0x39')]);_0x595efb['attributes']=_[_0xc53e('0x3b')](_0x3e395c['model'],qs[_0xc53e('0x3c')](_0x16942c[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x595efb[_0xc53e('0x3d')]=_0x595efb[_0xc53e('0x3d')]['length']?_0x595efb[_0xc53e('0x3d')]:_0x3e395c[_0xc53e('0x38')];if(!_0x16942c['query']['hasOwnProperty']('nolimit')){_0x595efb['limit']=qs[_0xc53e('0x29')](_0x16942c[_0xc53e('0x39')]['limit']);_0x595efb[_0xc53e('0x28')]=qs['offset'](_0x16942c['query']['offset']);}_0x595efb[_0xc53e('0x3e')]=qs['sort'](_0x16942c['query'][_0xc53e('0x3f')]);_0x595efb['where']=qs[_0xc53e('0x40')](_[_0xc53e('0x41')](_0x16942c['query'],_0x3e395c[_0xc53e('0x40')]),_0x1059f3);if(_0x16942c[_0xc53e('0x39')]['filter']){_0x595efb[_0xc53e('0x42')]=_['merge'](_0x595efb['where'],{'$or':_['map'](_0x1059f3,function(_0x4efee5){if(_0x4efee5[_0xc53e('0x43')]!==_0xc53e('0x44')){var _0x3b2834={};_0x3b2834[_0x4efee5['name']]={'$like':'%'+_0x16942c[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x3b2834;}})});}_0x595efb=_['merge']({},_0x595efb,_0x16942c['options']);var _0x3ea11a={'where':_0x595efb[_0xc53e('0x42')]};return db[_0xc53e('0x46')]['count'](_0x3ea11a)[_0xc53e('0x1a')](function(_0x1fb82c){_0x48d7d0[_0xc53e('0x47')]=_0x1fb82c;if(_0x16942c[_0xc53e('0x39')][_0xc53e('0x48')]){_0x595efb[_0xc53e('0x49')]=[{'all':!![]}];}return db[_0xc53e('0x46')]['findAll'](_0x595efb);})[_0xc53e('0x1a')](function(_0x39c467){_0x48d7d0[_0xc53e('0x4a')]=_0x39c467;return _0x48d7d0;})['then'](respondWithFilteredResult(_0x215abe,_0x595efb))[_0xc53e('0x4b')](handleError(_0x215abe,null));};exports[_0xc53e('0x4c')]=function(_0x4458c8,_0x15e744){var _0xa7d256={'raw':![],'where':{'id':_0x4458c8['params']['id']}},_0x17cea5={};_0x17cea5[_0xc53e('0x38')]=_[_0xc53e('0x3a')](db[_0xc53e('0x46')]['rawAttributes']);_0x17cea5[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x4458c8[_0xc53e('0x39')]);_0x17cea5[_0xc53e('0x40')]=_[_0xc53e('0x3b')](_0x17cea5[_0xc53e('0x38')],_0x17cea5[_0xc53e('0x39')]);_0xa7d256[_0xc53e('0x3d')]=_[_0xc53e('0x3b')](_0x17cea5[_0xc53e('0x38')],qs['fields'](_0x4458c8[_0xc53e('0x39')][_0xc53e('0x3c')]));_0xa7d256[_0xc53e('0x3d')]=_0xa7d256[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0xa7d256['attributes']:_0x17cea5['model'];if(_0x4458c8[_0xc53e('0x39')]['includeAll']){_0xa7d256[_0xc53e('0x49')]=[{'all':!![]}];}_0xa7d256=_['merge']({},_0xa7d256,_0x4458c8[_0xc53e('0x4e')]);return db[_0xc53e('0x46')][_0xc53e('0x4f')](_0xa7d256)['then'](handleEntityNotFound(_0x15e744,null))[_0xc53e('0x1a')](respondWithResult(_0x15e744,null))[_0xc53e('0x4b')](handleError(_0x15e744,null));};exports[_0xc53e('0x50')]=function(_0x4843ce,_0x2f7df2){return db['FreshsalesConfiguration'][_0xc53e('0x50')](_0x4843ce[_0xc53e('0x51')],{})['then'](respondWithResult(_0x2f7df2,0xc9))[_0xc53e('0x4b')](handleError(_0x2f7df2,null));};exports[_0xc53e('0x2e')]=function(_0x5bba72,_0x44f7cc){if(_0x5bba72[_0xc53e('0x51')]['id']){delete _0x5bba72[_0xc53e('0x51')]['id'];}return db[_0xc53e('0x46')][_0xc53e('0x4f')]({'where':{'id':_0x5bba72[_0xc53e('0x52')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x44f7cc,null))[_0xc53e('0x1a')](saveUpdates(_0x5bba72[_0xc53e('0x51')],null))[_0xc53e('0x1a')](respondWithResult(_0x44f7cc,null))[_0xc53e('0x4b')](handleError(_0x44f7cc,null));};exports['destroy']=function(_0x8364f6,_0x4a2543){return db[_0xc53e('0x46')]['find']({'where':{'id':_0x8364f6[_0xc53e('0x52')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x4a2543,null))['then'](removeEntity(_0x4a2543,null))[_0xc53e('0x4b')](handleError(_0x4a2543,null));};exports[_0xc53e('0x53')]=function(_0x9c0112,_0x432a91,_0x53083b){var _0x41c46c={};var _0x335427={};var _0x4ae0d4;var _0x5ea1da;return db[_0xc53e('0x46')]['findOne']({'where':{'id':_0x9c0112['params']['id']}})['then'](handleEntityNotFound(_0x432a91,null))[_0xc53e('0x1a')](function(_0x5f5dad){if(_0x5f5dad){_0x4ae0d4=_0x5f5dad;_0x335427[_0xc53e('0x38')]=_['keys'](db[_0xc53e('0x54')][_0xc53e('0x35')]);_0x335427[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x9c0112[_0xc53e('0x39')]);_0x335427['filters']=_['intersection'](_0x335427[_0xc53e('0x38')],_0x335427[_0xc53e('0x39')]);_0x41c46c[_0xc53e('0x3d')]=_[_0xc53e('0x3b')](_0x335427[_0xc53e('0x38')],qs[_0xc53e('0x3c')](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x41c46c[_0xc53e('0x3d')]=_0x41c46c[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x41c46c[_0xc53e('0x3d')]:_0x335427[_0xc53e('0x38')];_0x41c46c['order']=qs[_0xc53e('0x3f')](_0x9c0112['query'][_0xc53e('0x3f')]);_0x41c46c[_0xc53e('0x42')]=qs[_0xc53e('0x40')](_[_0xc53e('0x41')](_0x9c0112[_0xc53e('0x39')],_0x335427[_0xc53e('0x40')]));if(_0x9c0112[_0xc53e('0x39')][_0xc53e('0x45')]){_0x41c46c['where']=_['merge'](_0x41c46c['where'],{'$or':_[_0xc53e('0x34')](_0x41c46c[_0xc53e('0x3d')],function(_0x37ac78){var _0x25e4b6={};_0x25e4b6[_0x37ac78]={'$like':'%'+_0x9c0112[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x25e4b6;})});}_0x41c46c=_[_0xc53e('0x55')]({},_0x41c46c,_0x9c0112['options']);return _0x4ae0d4['getSubjects'](_0x41c46c);}})['then'](function(_0x40c8ba){if(_0x40c8ba){_0x5ea1da=_0x40c8ba[_0xc53e('0x4d')];if(!_0x9c0112['query'][_0xc53e('0x56')](_0xc53e('0x57'))){_0x41c46c[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x29')]);_0x41c46c['offset']=qs['offset'](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x28')]);}return _0x4ae0d4[_0xc53e('0x53')](_0x41c46c);}})[_0xc53e('0x1a')](function(_0x29ee08){if(_0x29ee08){return _0x29ee08?{'count':_0x5ea1da,'rows':_0x29ee08}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x432a91,null))['catch'](handleError(_0x432a91,null));};exports[_0xc53e('0x58')]=function(_0x15f6cb,_0x1c15a3,_0x3f3dc2){var _0x4d2609={};var _0xdd851e={};var _0xef9095;var _0x26e3ba;return db[_0xc53e('0x46')][_0xc53e('0x59')]({'where':{'id':_0x15f6cb[_0xc53e('0x52')]['id']}})['then'](handleEntityNotFound(_0x1c15a3,null))[_0xc53e('0x1a')](function(_0x134018){if(_0x134018){_0xef9095=_0x134018;_0xdd851e[_0xc53e('0x38')]=_[_0xc53e('0x3a')](db['FreshsalesField']['rawAttributes']);_0xdd851e[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x15f6cb[_0xc53e('0x39')]);_0xdd851e[_0xc53e('0x40')]=_['intersection'](_0xdd851e[_0xc53e('0x38')],_0xdd851e['query']);_0x4d2609[_0xc53e('0x3d')]=_['intersection'](_0xdd851e[_0xc53e('0x38')],qs['fields'](_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x4d2609['attributes']=_0x4d2609[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x4d2609['attributes']:_0xdd851e['model'];_0x4d2609[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x15f6cb['query']['sort']);_0x4d2609[_0xc53e('0x42')]=qs['filters'](_[_0xc53e('0x41')](_0x15f6cb['query'],_0xdd851e[_0xc53e('0x40')]));if(_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x45')]){_0x4d2609[_0xc53e('0x42')]=_[_0xc53e('0x55')](_0x4d2609[_0xc53e('0x42')],{'$or':_[_0xc53e('0x34')](_0x4d2609[_0xc53e('0x3d')],function(_0x258be8){var _0x2cd553={};_0x2cd553[_0x258be8]={'$like':'%'+_0x15f6cb['query'][_0xc53e('0x45')]+'%'};return _0x2cd553;})});}_0x4d2609=_['merge']({},_0x4d2609,_0x15f6cb[_0xc53e('0x4e')]);return _0xef9095[_0xc53e('0x58')](_0x4d2609);}})[_0xc53e('0x1a')](function(_0x2c027c){if(_0x2c027c){_0x26e3ba=_0x2c027c[_0xc53e('0x4d')];if(!_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x56')](_0xc53e('0x57'))){_0x4d2609[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x15f6cb['query'][_0xc53e('0x29')]);_0x4d2609['offset']=qs[_0xc53e('0x28')](_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x28')]);}return _0xef9095['getDescriptions'](_0x4d2609);}})[_0xc53e('0x1a')](function(_0x340db2){if(_0x340db2){return _0x340db2?{'count':_0x26e3ba,'rows':_0x340db2}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x1c15a3,null))[_0xc53e('0x4b')](handleError(_0x1c15a3,null));};exports[_0xc53e('0x5a')]=function(_0x508671,_0x2601ba,_0x48e337){var _0x56c66f={};var _0x42b53b={};var _0xe1a82c;var _0x25469e;return db['FreshsalesConfiguration'][_0xc53e('0x59')]({'where':{'id':_0x508671[_0xc53e('0x52')]['id']}})['then'](handleEntityNotFound(_0x2601ba,null))[_0xc53e('0x1a')](function(_0x4699b7){if(_0x4699b7){_0xe1a82c=_0x4699b7;_0x42b53b['model']=_['keys'](db[_0xc53e('0x54')]['rawAttributes']);_0x42b53b[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x508671[_0xc53e('0x39')]);_0x42b53b['filters']=_[_0xc53e('0x3b')](_0x42b53b[_0xc53e('0x38')],_0x42b53b[_0xc53e('0x39')]);_0x56c66f['attributes']=_[_0xc53e('0x3b')](_0x42b53b[_0xc53e('0x38')],qs[_0xc53e('0x3c')](_0x508671[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x56c66f['attributes']=_0x56c66f[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x56c66f[_0xc53e('0x3d')]:_0x42b53b[_0xc53e('0x38')];_0x56c66f[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x508671[_0xc53e('0x39')][_0xc53e('0x3f')]);_0x56c66f[_0xc53e('0x42')]=qs['filters'](_[_0xc53e('0x41')](_0x508671[_0xc53e('0x39')],_0x42b53b[_0xc53e('0x40')]));if(_0x508671[_0xc53e('0x39')][_0xc53e('0x45')]){_0x56c66f[_0xc53e('0x42')]=_[_0xc53e('0x55')](_0x56c66f[_0xc53e('0x42')],{'$or':_[_0xc53e('0x34')](_0x56c66f['attributes'],function(_0x3a54ef){var _0x190509={};_0x190509[_0x3a54ef]={'$like':'%'+_0x508671[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x190509;})});}_0x56c66f=_['merge']({},_0x56c66f,_0x508671[_0xc53e('0x4e')]);return _0xe1a82c[_0xc53e('0x5a')](_0x56c66f);}})[_0xc53e('0x1a')](function(_0x92c9bc){if(_0x92c9bc){_0x25469e=_0x92c9bc['length'];if(!_0x508671[_0xc53e('0x39')][_0xc53e('0x56')](_0xc53e('0x57'))){_0x56c66f[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x508671[_0xc53e('0x39')][_0xc53e('0x29')]);_0x56c66f['offset']=qs[_0xc53e('0x28')](_0x508671['query'][_0xc53e('0x28')]);}return _0xe1a82c[_0xc53e('0x5a')](_0x56c66f);}})[_0xc53e('0x1a')](function(_0x4c6ddc){if(_0x4c6ddc){return _0x4c6ddc?{'count':_0x25469e,'rows':_0x4c6ddc}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x2601ba,null))[_0xc53e('0x4b')](handleError(_0x2601ba,null));}; \ No newline at end of file +var _0x326f=['destroy','end','stack','name','index','FreshsalesConfiguration','type','key','model','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','merge','map','filter','options','includeAll','include','rows','show','params','keys','rawAttributes','length','find','create','body','FreshsalesField','getSubjects','getDescriptions','findOne','hasOwnProperty','getFields','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','jayson/promise','client','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','catch','sendStatus','status','json','offset','set','Content-Range','reject','save','update'];(function(_0x4b33c0,_0x17fb55){var _0x43c889=function(_0x410c0d){while(--_0x410c0d){_0x4b33c0['push'](_0x4b33c0['shift']());}};_0x43c889(++_0x17fb55);}(_0x326f,0xd1));var _0xf326=function(_0x4394d3,_0x992ae4){_0x4394d3=_0x4394d3-0x0;var _0x109159=_0x326f[_0x4394d3];return _0x109159;};'use strict';var pdf=require(_0xf326('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf326('0x1'));var jsonpatch=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var moment=require(_0xf326('0x4'));var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require(_0xf326('0x7'));var path=require(_0xf326('0x8'));var sox=require(_0xf326('0x9'));var csv=require(_0xf326('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf326('0x17'));var client=jayson[_0xf326('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x342fe5,_0x472632,_0x3504eb,_0x17a098){return new BPromise(function(_0x5c8483,_0x45c1b6){var _0x5204ee=_0x17a098||client;return _0x5204ee['request'](_0x342fe5,_0x3504eb)[_0xf326('0x19')](function(_0x11f6d2){logger[_0xf326('0x1a')](_0xf326('0x1b'),_0x472632,_0xf326('0x1c'));logger[_0xf326('0x1d')](_0xf326('0x1e'),_0x472632,_0xf326('0x1c'),JSON['stringify'](_0x11f6d2));if(_0x11f6d2[_0xf326('0x1f')]){if(_0x11f6d2[_0xf326('0x1f')][_0xf326('0x20')]===0x1f4){logger[_0xf326('0x1f')](_0xf326('0x1b'),_0x472632,_0x11f6d2[_0xf326('0x1f')]['message']);return _0x45c1b6(_0x11f6d2['error']['message']);}logger[_0xf326('0x1f')](_0xf326('0x1b'),_0x472632,_0x11f6d2['error']['message']);return _0x5c8483(_0x11f6d2[_0xf326('0x1f')]['message']);}else{logger['info'](_0xf326('0x1b'),_0x472632,_0xf326('0x1c'));_0x5c8483(_0x11f6d2['result']['message']);}})[_0xf326('0x21')](function(_0xb1efcf){logger['error'](_0xf326('0x1b'),_0x472632,_0xb1efcf);_0x45c1b6(_0xb1efcf);});});}function respondWithStatusCode(_0x1b9039,_0x43c53e){_0x43c53e=_0x43c53e||0xcc;return function(_0x295752){if(_0x295752){return _0x1b9039[_0xf326('0x22')](_0x43c53e);}return _0x1b9039[_0xf326('0x23')](_0x43c53e)['end']();};}function respondWithResult(_0x55b9f4,_0x4f31f6){_0x4f31f6=_0x4f31f6||0xc8;return function(_0x520d85){if(_0x520d85){return _0x55b9f4[_0xf326('0x23')](_0x4f31f6)[_0xf326('0x24')](_0x520d85);}};}function respondWithFilteredResult(_0x1ff2b5,_0x148953){return function(_0x410237){if(_0x410237){var _0x5217d4=_0x410237['count'],_0x201d28=_0x148953[_0xf326('0x25')],_0xa3c0b=_0x148953['offset']+_0x148953['limit'],_0x212d5d;if(_0xa3c0b>=_0x5217d4){_0xa3c0b=_0x5217d4;_0x212d5d=0xc8;}else{_0x212d5d=0xce;}_0x1ff2b5[_0xf326('0x23')](_0x212d5d);return _0x1ff2b5[_0xf326('0x26')](_0xf326('0x27'),_0x201d28+'-'+_0xa3c0b+'/'+_0x5217d4)['json'](_0x410237);}return null;};}function patchUpdates(_0xc115d9){return function(_0x292500){try{jsonpatch['apply'](_0x292500,_0xc115d9,!![]);}catch(_0x225776){return BPromise[_0xf326('0x28')](_0x225776);}return _0x292500[_0xf326('0x29')]();};}function saveUpdates(_0x18d110,_0xa80156){return function(_0x269be9){if(_0x269be9){return _0x269be9[_0xf326('0x2a')](_0x18d110)[_0xf326('0x19')](function(_0x43b951){return _0x43b951;});}return null;};}function removeEntity(_0x349a03,_0x4b52f2){return function(_0x1035ed){if(_0x1035ed){return _0x1035ed[_0xf326('0x2b')]()[_0xf326('0x19')](function(){_0x349a03['status'](0xcc)[_0xf326('0x2c')]();});}};}function handleEntityNotFound(_0x1721fd,_0x303dc6){return function(_0x4df451){if(!_0x4df451){_0x1721fd['sendStatus'](0x194);}return _0x4df451;};}function handleError(_0x2b8b31,_0x46d75e){_0x46d75e=_0x46d75e||0x1f4;return function(_0x9c3039){logger[_0xf326('0x1f')](_0x9c3039[_0xf326('0x2d')]);if(_0x9c3039[_0xf326('0x2e')]){delete _0x9c3039[_0xf326('0x2e')];}_0x2b8b31[_0xf326('0x23')](_0x46d75e)['send'](_0x9c3039);};}exports[_0xf326('0x2f')]=function(_0x1981bc,_0x51207a){var _0x4083a2={},_0x4e5d7c={},_0xce1cbb={'count':0x0,'rows':[]};var _0x481b64=_['map'](db[_0xf326('0x30')]['rawAttributes'],function(_0x40dcb4){return{'name':_0x40dcb4['fieldName'],'type':_0x40dcb4[_0xf326('0x31')][_0xf326('0x32')]};});_0x4e5d7c[_0xf326('0x33')]=_['map'](_0x481b64,_0xf326('0x2e'));_0x4e5d7c[_0xf326('0x34')]=_['keys'](_0x1981bc[_0xf326('0x34')]);_0x4e5d7c[_0xf326('0x35')]=_[_0xf326('0x36')](_0x4e5d7c[_0xf326('0x33')],_0x4e5d7c['query']);_0x4083a2[_0xf326('0x37')]=_[_0xf326('0x36')](_0x4e5d7c[_0xf326('0x33')],qs[_0xf326('0x38')](_0x1981bc[_0xf326('0x34')]['fields']));_0x4083a2[_0xf326('0x37')]=_0x4083a2[_0xf326('0x37')]['length']?_0x4083a2['attributes']:_0x4e5d7c[_0xf326('0x33')];if(!_0x1981bc['query']['hasOwnProperty'](_0xf326('0x39'))){_0x4083a2['limit']=qs[_0xf326('0x3a')](_0x1981bc[_0xf326('0x34')][_0xf326('0x3a')]);_0x4083a2[_0xf326('0x25')]=qs['offset'](_0x1981bc[_0xf326('0x34')][_0xf326('0x25')]);}_0x4083a2[_0xf326('0x3b')]=qs[_0xf326('0x3c')](_0x1981bc[_0xf326('0x34')][_0xf326('0x3c')]);_0x4083a2[_0xf326('0x3d')]=qs[_0xf326('0x35')](_[_0xf326('0x3e')](_0x1981bc[_0xf326('0x34')],_0x4e5d7c[_0xf326('0x35')]),_0x481b64);if(_0x1981bc[_0xf326('0x34')]['filter']){_0x4083a2[_0xf326('0x3d')]=_[_0xf326('0x3f')](_0x4083a2[_0xf326('0x3d')],{'$or':_[_0xf326('0x40')](_0x481b64,function(_0x1dd262){if(_0x1dd262[_0xf326('0x31')]!=='VIRTUAL'){var _0x28e2d3={};_0x28e2d3[_0x1dd262[_0xf326('0x2e')]]={'$like':'%'+_0x1981bc['query'][_0xf326('0x41')]+'%'};return _0x28e2d3;}})});}_0x4083a2=_[_0xf326('0x3f')]({},_0x4083a2,_0x1981bc[_0xf326('0x42')]);var _0x305863={'where':_0x4083a2[_0xf326('0x3d')]};return db['FreshsalesConfiguration']['count'](_0x305863)[_0xf326('0x19')](function(_0x44e101){_0xce1cbb['count']=_0x44e101;if(_0x1981bc['query'][_0xf326('0x43')]){_0x4083a2[_0xf326('0x44')]=[{'all':!![]}];}return db[_0xf326('0x30')]['findAll'](_0x4083a2);})[_0xf326('0x19')](function(_0xe96e1e){_0xce1cbb[_0xf326('0x45')]=_0xe96e1e;return _0xce1cbb;})[_0xf326('0x19')](respondWithFilteredResult(_0x51207a,_0x4083a2))[_0xf326('0x21')](handleError(_0x51207a,null));};exports[_0xf326('0x46')]=function(_0x12792c,_0x3b90dc){var _0x3df9a8={'raw':![],'where':{'id':_0x12792c[_0xf326('0x47')]['id']}},_0x27ced1={};_0x27ced1[_0xf326('0x33')]=_[_0xf326('0x48')](db[_0xf326('0x30')][_0xf326('0x49')]);_0x27ced1['query']=_[_0xf326('0x48')](_0x12792c[_0xf326('0x34')]);_0x27ced1[_0xf326('0x35')]=_[_0xf326('0x36')](_0x27ced1['model'],_0x27ced1[_0xf326('0x34')]);_0x3df9a8[_0xf326('0x37')]=_[_0xf326('0x36')](_0x27ced1[_0xf326('0x33')],qs['fields'](_0x12792c[_0xf326('0x34')][_0xf326('0x38')]));_0x3df9a8[_0xf326('0x37')]=_0x3df9a8[_0xf326('0x37')][_0xf326('0x4a')]?_0x3df9a8['attributes']:_0x27ced1['model'];if(_0x12792c[_0xf326('0x34')][_0xf326('0x43')]){_0x3df9a8[_0xf326('0x44')]=[{'all':!![]}];}_0x3df9a8=_['merge']({},_0x3df9a8,_0x12792c[_0xf326('0x42')]);return db[_0xf326('0x30')][_0xf326('0x4b')](_0x3df9a8)['then'](handleEntityNotFound(_0x3b90dc,null))['then'](respondWithResult(_0x3b90dc,null))[_0xf326('0x21')](handleError(_0x3b90dc,null));};exports['create']=function(_0x1cf58f,_0x554277){return db[_0xf326('0x30')][_0xf326('0x4c')](_0x1cf58f[_0xf326('0x4d')],{})[_0xf326('0x19')](respondWithResult(_0x554277,0xc9))[_0xf326('0x21')](handleError(_0x554277,null));};exports[_0xf326('0x2a')]=function(_0x7f7ece,_0x495a16){if(_0x7f7ece[_0xf326('0x4d')]['id']){delete _0x7f7ece[_0xf326('0x4d')]['id'];}return db[_0xf326('0x30')]['find']({'where':{'id':_0x7f7ece[_0xf326('0x47')]['id']}})[_0xf326('0x19')](handleEntityNotFound(_0x495a16,null))[_0xf326('0x19')](saveUpdates(_0x7f7ece[_0xf326('0x4d')],null))[_0xf326('0x19')](respondWithResult(_0x495a16,null))['catch'](handleError(_0x495a16,null));};exports[_0xf326('0x2b')]=function(_0x21eac7,_0x287a97){return db[_0xf326('0x30')]['find']({'where':{'id':_0x21eac7[_0xf326('0x47')]['id']}})[_0xf326('0x19')](handleEntityNotFound(_0x287a97,null))[_0xf326('0x19')](removeEntity(_0x287a97,null))[_0xf326('0x21')](handleError(_0x287a97,null));};exports['getSubjects']=function(_0x5be2b1,_0x18b46e,_0x44d2ed){var _0x55ca96={};var _0x3cf6fa={};var _0x29de71;var _0x316609;return db[_0xf326('0x30')]['findOne']({'where':{'id':_0x5be2b1[_0xf326('0x47')]['id']}})['then'](handleEntityNotFound(_0x18b46e,null))['then'](function(_0x9d84c3){if(_0x9d84c3){_0x29de71=_0x9d84c3;_0x3cf6fa['model']=_[_0xf326('0x48')](db[_0xf326('0x4e')][_0xf326('0x49')]);_0x3cf6fa['query']=_['keys'](_0x5be2b1[_0xf326('0x34')]);_0x3cf6fa[_0xf326('0x35')]=_[_0xf326('0x36')](_0x3cf6fa['model'],_0x3cf6fa[_0xf326('0x34')]);_0x55ca96['attributes']=_[_0xf326('0x36')](_0x3cf6fa[_0xf326('0x33')],qs[_0xf326('0x38')](_0x5be2b1[_0xf326('0x34')][_0xf326('0x38')]));_0x55ca96[_0xf326('0x37')]=_0x55ca96[_0xf326('0x37')][_0xf326('0x4a')]?_0x55ca96[_0xf326('0x37')]:_0x3cf6fa[_0xf326('0x33')];_0x55ca96[_0xf326('0x3b')]=qs[_0xf326('0x3c')](_0x5be2b1[_0xf326('0x34')]['sort']);_0x55ca96[_0xf326('0x3d')]=qs['filters'](_[_0xf326('0x3e')](_0x5be2b1[_0xf326('0x34')],_0x3cf6fa['filters']));if(_0x5be2b1[_0xf326('0x34')]['filter']){_0x55ca96[_0xf326('0x3d')]=_[_0xf326('0x3f')](_0x55ca96[_0xf326('0x3d')],{'$or':_[_0xf326('0x40')](_0x55ca96[_0xf326('0x37')],function(_0x51ff5e){var _0x4ec099={};_0x4ec099[_0x51ff5e]={'$like':'%'+_0x5be2b1[_0xf326('0x34')][_0xf326('0x41')]+'%'};return _0x4ec099;})});}_0x55ca96=_[_0xf326('0x3f')]({},_0x55ca96,_0x5be2b1[_0xf326('0x42')]);return _0x29de71[_0xf326('0x4f')](_0x55ca96);}})['then'](function(_0x28c4f2){if(_0x28c4f2){_0x316609=_0x28c4f2[_0xf326('0x4a')];if(!_0x5be2b1['query']['hasOwnProperty']('nolimit')){_0x55ca96[_0xf326('0x3a')]=qs[_0xf326('0x3a')](_0x5be2b1[_0xf326('0x34')][_0xf326('0x3a')]);_0x55ca96[_0xf326('0x25')]=qs[_0xf326('0x25')](_0x5be2b1[_0xf326('0x34')]['offset']);}return _0x29de71[_0xf326('0x4f')](_0x55ca96);}})[_0xf326('0x19')](function(_0x3c3379){if(_0x3c3379){return _0x3c3379?{'count':_0x316609,'rows':_0x3c3379}:null;}})[_0xf326('0x19')](respondWithResult(_0x18b46e,null))['catch'](handleError(_0x18b46e,null));};exports[_0xf326('0x50')]=function(_0x5eebe8,_0x499b59,_0x2dd9e4){var _0x540fa0={};var _0x78ba34={};var _0x3411a4;var _0x461059;return db[_0xf326('0x30')][_0xf326('0x51')]({'where':{'id':_0x5eebe8['params']['id']}})['then'](handleEntityNotFound(_0x499b59,null))['then'](function(_0xeeea57){if(_0xeeea57){_0x3411a4=_0xeeea57;_0x78ba34[_0xf326('0x33')]=_[_0xf326('0x48')](db[_0xf326('0x4e')][_0xf326('0x49')]);_0x78ba34['query']=_[_0xf326('0x48')](_0x5eebe8[_0xf326('0x34')]);_0x78ba34[_0xf326('0x35')]=_['intersection'](_0x78ba34['model'],_0x78ba34[_0xf326('0x34')]);_0x540fa0[_0xf326('0x37')]=_['intersection'](_0x78ba34['model'],qs[_0xf326('0x38')](_0x5eebe8['query'][_0xf326('0x38')]));_0x540fa0['attributes']=_0x540fa0['attributes']['length']?_0x540fa0[_0xf326('0x37')]:_0x78ba34[_0xf326('0x33')];_0x540fa0[_0xf326('0x3b')]=qs['sort'](_0x5eebe8[_0xf326('0x34')][_0xf326('0x3c')]);_0x540fa0[_0xf326('0x3d')]=qs[_0xf326('0x35')](_[_0xf326('0x3e')](_0x5eebe8[_0xf326('0x34')],_0x78ba34[_0xf326('0x35')]));if(_0x5eebe8[_0xf326('0x34')][_0xf326('0x41')]){_0x540fa0['where']=_[_0xf326('0x3f')](_0x540fa0['where'],{'$or':_[_0xf326('0x40')](_0x540fa0[_0xf326('0x37')],function(_0x40ee66){var _0x4ba982={};_0x4ba982[_0x40ee66]={'$like':'%'+_0x5eebe8[_0xf326('0x34')][_0xf326('0x41')]+'%'};return _0x4ba982;})});}_0x540fa0=_[_0xf326('0x3f')]({},_0x540fa0,_0x5eebe8['options']);return _0x3411a4[_0xf326('0x50')](_0x540fa0);}})[_0xf326('0x19')](function(_0x3bbe4c){if(_0x3bbe4c){_0x461059=_0x3bbe4c[_0xf326('0x4a')];if(!_0x5eebe8['query'][_0xf326('0x52')]('nolimit')){_0x540fa0['limit']=qs[_0xf326('0x3a')](_0x5eebe8[_0xf326('0x34')]['limit']);_0x540fa0['offset']=qs['offset'](_0x5eebe8[_0xf326('0x34')]['offset']);}return _0x3411a4[_0xf326('0x50')](_0x540fa0);}})[_0xf326('0x19')](function(_0x3434b2){if(_0x3434b2){return _0x3434b2?{'count':_0x461059,'rows':_0x3434b2}:null;}})[_0xf326('0x19')](respondWithResult(_0x499b59,null))[_0xf326('0x21')](handleError(_0x499b59,null));};exports[_0xf326('0x53')]=function(_0x5d23f0,_0x39edf8,_0x323926){var _0x5f1724={};var _0x497ada={};var _0x14eecc;var _0x537afc;return db[_0xf326('0x30')][_0xf326('0x51')]({'where':{'id':_0x5d23f0[_0xf326('0x47')]['id']}})[_0xf326('0x19')](handleEntityNotFound(_0x39edf8,null))[_0xf326('0x19')](function(_0x6e662){if(_0x6e662){_0x14eecc=_0x6e662;_0x497ada[_0xf326('0x33')]=_[_0xf326('0x48')](db[_0xf326('0x4e')]['rawAttributes']);_0x497ada[_0xf326('0x34')]=_[_0xf326('0x48')](_0x5d23f0['query']);_0x497ada[_0xf326('0x35')]=_['intersection'](_0x497ada[_0xf326('0x33')],_0x497ada[_0xf326('0x34')]);_0x5f1724[_0xf326('0x37')]=_['intersection'](_0x497ada[_0xf326('0x33')],qs[_0xf326('0x38')](_0x5d23f0[_0xf326('0x34')][_0xf326('0x38')]));_0x5f1724[_0xf326('0x37')]=_0x5f1724[_0xf326('0x37')][_0xf326('0x4a')]?_0x5f1724[_0xf326('0x37')]:_0x497ada[_0xf326('0x33')];_0x5f1724[_0xf326('0x3b')]=qs[_0xf326('0x3c')](_0x5d23f0[_0xf326('0x34')][_0xf326('0x3c')]);_0x5f1724[_0xf326('0x3d')]=qs[_0xf326('0x35')](_['pick'](_0x5d23f0[_0xf326('0x34')],_0x497ada[_0xf326('0x35')]));if(_0x5d23f0['query'][_0xf326('0x41')]){_0x5f1724[_0xf326('0x3d')]=_['merge'](_0x5f1724[_0xf326('0x3d')],{'$or':_[_0xf326('0x40')](_0x5f1724[_0xf326('0x37')],function(_0x8dbd96){var _0x2ab607={};_0x2ab607[_0x8dbd96]={'$like':'%'+_0x5d23f0[_0xf326('0x34')][_0xf326('0x41')]+'%'};return _0x2ab607;})});}_0x5f1724=_['merge']({},_0x5f1724,_0x5d23f0[_0xf326('0x42')]);return _0x14eecc[_0xf326('0x53')](_0x5f1724);}})[_0xf326('0x19')](function(_0x3c33d1){if(_0x3c33d1){_0x537afc=_0x3c33d1[_0xf326('0x4a')];if(!_0x5d23f0[_0xf326('0x34')][_0xf326('0x52')](_0xf326('0x39'))){_0x5f1724['limit']=qs[_0xf326('0x3a')](_0x5d23f0[_0xf326('0x34')]['limit']);_0x5f1724[_0xf326('0x25')]=qs['offset'](_0x5d23f0[_0xf326('0x34')][_0xf326('0x25')]);}return _0x14eecc[_0xf326('0x53')](_0x5f1724);}})[_0xf326('0x19')](function(_0x405a52){if(_0x405a52){return _0x405a52?{'count':_0x537afc,'rows':_0x405a52}:null;}})[_0xf326('0x19')](respondWithResult(_0x39edf8,null))[_0xf326('0x21')](handleError(_0x39edf8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index d837fc5..0b068f2 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 _0x2bdb=['bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','../../config/logger','moment'];(function(_0x2b7913,_0x56ca38){var _0x5e07f6=function(_0x99eba4){while(--_0x99eba4){_0x2b7913['push'](_0x2b7913['shift']());}};_0x5e07f6(++_0x56ca38);}(_0x2bdb,0x105));var _0xb2bd=function(_0x4ee075,_0x1eb092){_0x4ee075=_0x4ee075-0x0;var _0x4dfb79=_0x2bdb[_0x4ee075];return _0x4dfb79;};'use strict';var _=require(_0xb2bd('0x0'));var util=require('util');var logger=require(_0xb2bd('0x1'))('api');var moment=require(_0xb2bd('0x2'));var BPromise=require(_0xb2bd('0x3'));var rp=require(_0xb2bd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2bd('0x5'));var config=require(_0xb2bd('0x6'));var attributes=require(_0xb2bd('0x7'));module[_0xb2bd('0x8')]=function(_0x461137,_0x2ef40b){return _0x461137[_0xb2bd('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0xb2bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4898=['path','rimraf','./intFreshsalesConfiguration.attributes','exports','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x390dfa,_0x560075){var _0x5479ec=function(_0x16f333){while(--_0x16f333){_0x390dfa['push'](_0x390dfa['shift']());}};_0x5479ec(++_0x560075);}(_0x4898,0x163));var _0x8489=function(_0x4962a2,_0x12cb4e){_0x4962a2=_0x4962a2-0x0;var _0x4e97f6=_0x4898[_0x4962a2];return _0x4e97f6;};'use strict';var _=require('lodash');var util=require(_0x8489('0x0'));var logger=require(_0x8489('0x1'))('api');var moment=require(_0x8489('0x2'));var BPromise=require(_0x8489('0x3'));var rp=require(_0x8489('0x4'));var fs=require('fs');var path=require(_0x8489('0x5'));var rimraf=require(_0x8489('0x6'));var config=require('../../config/environment');var attributes=require(_0x8489('0x7'));module[_0x8489('0x8')]=function(_0x3378d8,_0xc94007){return _0x3378d8['define']('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 6bce4e8..c7884b1 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 _0xffda=['code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3ac919,_0x3b0588){var _0x425be6=function(_0x533915){while(--_0x533915){_0x3ac919['push'](_0x3ac919['shift']());}};_0x425be6(++_0x3b0588);}(_0xffda,0x73));var _0xaffd=function(_0x2c968a,_0x91d0d){_0x2c968a=_0x2c968a-0x0;var _0x4430d0=_0xffda[_0x2c968a];return _0x4430d0;};'use strict';var _=require(_0xaffd('0x0'));var util=require(_0xaffd('0x1'));var moment=require(_0xaffd('0x2'));var BPromise=require(_0xaffd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaffd('0x4'));var db=require(_0xaffd('0x5'))['db'];var utils=require(_0xaffd('0x6'));var logger=require('../../config/logger')(_0xaffd('0x7'));var config=require('../../config/environment');var jayson=require(_0xaffd('0x8'));var client=jayson[_0xaffd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ca99e,_0x39b2e5,_0x12865c){return new BPromise(function(_0x3647e1,_0x514b76){return client[_0xaffd('0xa')](_0x4ca99e,_0x12865c)[_0xaffd('0xb')](function(_0x505908){logger['info'](_0xaffd('0xc'),_0x39b2e5,_0xaffd('0xd'));logger[_0xaffd('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x39b2e5,_0xaffd('0xd'),JSON[_0xaffd('0xf')](_0x505908));if(_0x505908['error']){if(_0x505908[_0xaffd('0x10')][_0xaffd('0x11')]===0x1f4){logger[_0xaffd('0x10')](_0xaffd('0xc'),_0x39b2e5,_0x505908[_0xaffd('0x10')]['message']);return _0x514b76(_0x505908[_0xaffd('0x10')]['message']);}logger['error'](_0xaffd('0xc'),_0x39b2e5,_0x505908[_0xaffd('0x10')][_0xaffd('0x12')]);return _0x3647e1(_0x505908['error'][_0xaffd('0x12')]);}else{logger[_0xaffd('0x13')](_0xaffd('0xc'),_0x39b2e5,_0xaffd('0xd'));_0x3647e1(_0x505908[_0xaffd('0x14')][_0xaffd('0x12')]);}})[_0xaffd('0x15')](function(_0x3ddf0c){logger['error'](_0xaffd('0xc'),_0x39b2e5,_0x3ddf0c);_0x514b76(_0x3ddf0c);});});} \ No newline at end of file +var _0x81a5=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result'];(function(_0x547cd8,_0x1e7abb){var _0x1ef472=function(_0x2ae97d){while(--_0x2ae97d){_0x547cd8['push'](_0x547cd8['shift']());}};_0x1ef472(++_0x1e7abb);}(_0x81a5,0x1c8));var _0x581a=function(_0x435388,_0x26907c){_0x435388=_0x435388-0x0;var _0x3be6c9=_0x81a5[_0x435388];return _0x3be6c9;};'use strict';var _=require(_0x581a('0x0'));var util=require(_0x581a('0x1'));var moment=require(_0x581a('0x2'));var BPromise=require(_0x581a('0x3'));var rs=require(_0x581a('0x4'));var fs=require('fs');var Redis=require(_0x581a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x581a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x581a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdcb7c0,_0x3bcfe6,_0x148bc7){return new BPromise(function(_0x18dec1,_0x23ba13){return client[_0x581a('0x8')](_0xdcb7c0,_0x148bc7)[_0x581a('0x9')](function(_0x31b3ac){logger['info'](_0x581a('0xa'),_0x3bcfe6,'request\x20sent');logger[_0x581a('0xb')](_0x581a('0xc'),_0x3bcfe6,_0x581a('0xd'),JSON[_0x581a('0xe')](_0x31b3ac));if(_0x31b3ac['error']){if(_0x31b3ac[_0x581a('0xf')]['code']===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3bcfe6,_0x31b3ac['error'][_0x581a('0x10')]);return _0x23ba13(_0x31b3ac[_0x581a('0xf')]['message']);}logger[_0x581a('0xf')](_0x581a('0xa'),_0x3bcfe6,_0x31b3ac[_0x581a('0xf')][_0x581a('0x10')]);return _0x18dec1(_0x31b3ac[_0x581a('0xf')][_0x581a('0x10')]);}else{logger[_0x581a('0x11')](_0x581a('0xa'),_0x3bcfe6,'request\x20sent');_0x18dec1(_0x31b3ac[_0x581a('0x12')][_0x581a('0x10')]);}})['catch'](function(_0x12cab1){logger[_0x581a('0xf')](_0x581a('0xa'),_0x3bcfe6,_0x12cab1);_0x23ba13(_0x12cab1);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index ec34df7..180fefb 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 _0x724a=['isAuthenticated','show','post','put','update','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x51ccb3,_0x53d1c0){var _0x33a19c=function(_0x2782b3){while(--_0x2782b3){_0x51ccb3['push'](_0x51ccb3['shift']());}};_0x33a19c(++_0x53d1c0);}(_0x724a,0x177));var _0xa724=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x724a[_0x3cae69];return _0x3128eb;};'use strict';var multer=require(_0xa724('0x0'));var util=require(_0xa724('0x1'));var path=require(_0xa724('0x2'));var timeout=require('connect-timeout');var express=require(_0xa724('0x3'));var router=express['Router']();var auth=require(_0xa724('0x4'));var interaction=require(_0xa724('0x5'));var config=require(_0xa724('0x6'));var controller=require('./intFreshsalesField.controller');router[_0xa724('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa724('0x7')](_0xa724('0x8'),auth[_0xa724('0x9')](),controller[_0xa724('0xa')]);router[_0xa724('0xb')]('/',auth[_0xa724('0x9')](),controller['create']);router[_0xa724('0xc')](_0xa724('0x8'),auth[_0xa724('0x9')](),controller[_0xa724('0xd')]);router[_0xa724('0xe')](_0xa724('0x8'),auth[_0xa724('0x9')](),controller[_0xa724('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9e05=['index','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated'];(function(_0xd2752,_0x3800e9){var _0x3b93b0=function(_0x3d1d8c){while(--_0x3d1d8c){_0xd2752['push'](_0xd2752['shift']());}};_0x3b93b0(++_0x3800e9);}(_0x9e05,0xa2));var _0x59e0=function(_0x493111,_0x306433){_0x493111=_0x493111-0x0;var _0x373e29=_0x9e05[_0x493111];return _0x373e29;};'use strict';var multer=require(_0x59e0('0x0'));var util=require(_0x59e0('0x1'));var path=require('path');var timeout=require(_0x59e0('0x2'));var express=require(_0x59e0('0x3'));var router=express[_0x59e0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x59e0('0x5'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0x59e0('0x6')]('/',auth[_0x59e0('0x7')](),controller[_0x59e0('0x8')]);router['get'](_0x59e0('0x9'),auth[_0x59e0('0x7')](),controller[_0x59e0('0xa')]);router[_0x59e0('0xb')]('/',auth[_0x59e0('0x7')](),controller['create']);router[_0x59e0('0xc')]('/:id',auth[_0x59e0('0x7')](),controller[_0x59e0('0xd')]);router[_0x59e0('0xe')](_0x59e0('0x9'),auth[_0x59e0('0x7')](),controller[_0x59e0('0xf')]);module[_0x59e0('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index ff769c4..684a05a 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 _0xde78=['ENUM','variable','customVariable','string','STRING','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde78,0x166));var _0x8de7=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0xde78[_0x54defc];return _0x1955d3;};'use strict';var Sequelize=require(_0x8de7('0x0'));module[_0x8de7('0x1')]={'type':{'type':Sequelize[_0x8de7('0x2')]('string',_0x8de7('0x3'),_0x8de7('0x4'),'keyValue'),'defaultValue':_0x8de7('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8de7('0x6')]},'keyType':{'type':Sequelize[_0x8de7('0x2')](_0x8de7('0x5'),_0x8de7('0x3'),_0x8de7('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8de7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8de7('0x6')]}}; \ No newline at end of file +var _0x86b6=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x5f12a9,_0x2d0bd9){var _0x18022c=function(_0x4bb1a4){while(--_0x4bb1a4){_0x5f12a9['push'](_0x5f12a9['shift']());}};_0x18022c(++_0x2d0bd9);}(_0x86b6,0x157));var _0x686b=function(_0x3734bc,_0xf0ad5f){_0x3734bc=_0x3734bc-0x0;var _0x5d965c=_0x86b6[_0x3734bc];return _0x5d965c;};'use strict';var Sequelize=require(_0x686b('0x0'));module[_0x686b('0x1')]={'type':{'type':Sequelize[_0x686b('0x2')](_0x686b('0x3'),'variable',_0x686b('0x4'),_0x686b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x686b('0x6')]},'key':{'type':Sequelize[_0x686b('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x686b('0x3'),_0x686b('0x7'),_0x686b('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x686b('0x6')]},'customField':{'type':Sequelize[_0x686b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x686b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 73225b0..a724d2e 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 _0x7c51=['end','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','FreshsalesField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','rows','catch','show','keys','include','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status'];(function(_0x5e6f01,_0x555e50){var _0x26635c=function(_0x3a2dd3){while(--_0x3a2dd3){_0x5e6f01['push'](_0x5e6f01['shift']());}};_0x26635c(++_0x555e50);}(_0x7c51,0x1ae));var _0x17c5=function(_0x433848,_0x1fe400){_0x433848=_0x433848-0x0;var _0x3cb88a=_0x7c51[_0x433848];return _0x3cb88a;};'use strict';var pdf=require(_0x17c5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x17c5('0x1'));var zipdir=require(_0x17c5('0x2'));var jsonpatch=require(_0x17c5('0x3'));var rp=require(_0x17c5('0x4'));var moment=require(_0x17c5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x17c5('0x6'));var path=require(_0x17c5('0x7'));var sox=require(_0x17c5('0x8'));var csv=require(_0x17c5('0x9'));var ejs=require(_0x17c5('0xa'));var fs=require('fs');var _=require(_0x17c5('0xb'));var squel=require(_0x17c5('0xc'));var crypto=require(_0x17c5('0xd'));var jsforce=require(_0x17c5('0xe'));var deskjs=require(_0x17c5('0xf'));var toCsv=require(_0x17c5('0x9'));var querystring=require(_0x17c5('0x10'));var Papa=require('papaparse');var Redis=require(_0x17c5('0x11'));var authService=require(_0x17c5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x17c5('0x13'));var hardwareService=require(_0x17c5('0x14'));var logger=require('../../config/logger')(_0x17c5('0x15'));var utils=require(_0x17c5('0x16'));var config=require(_0x17c5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x17c5('0x18'))['db'];function respondWithStatusCode(_0x10ef5b,_0x208354){_0x208354=_0x208354||0xcc;return function(_0x2f54a1){if(_0x2f54a1){return _0x10ef5b['sendStatus'](_0x208354);}return _0x10ef5b[_0x17c5('0x19')](_0x208354)[_0x17c5('0x1a')]();};}function respondWithResult(_0x486993,_0x512dc8){_0x512dc8=_0x512dc8||0xc8;return function(_0x3fbf9d){if(_0x3fbf9d){return _0x486993[_0x17c5('0x19')](_0x512dc8)['json'](_0x3fbf9d);}};}function respondWithFilteredResult(_0x39b568,_0x2eb9bd){return function(_0x383d29){if(_0x383d29){var _0x17d4fe=_0x383d29[_0x17c5('0x1b')],_0x3e3feb=_0x2eb9bd['offset'],_0x1c0eac=_0x2eb9bd[_0x17c5('0x1c')]+_0x2eb9bd[_0x17c5('0x1d')],_0x52794f;if(_0x1c0eac>=_0x17d4fe){_0x1c0eac=_0x17d4fe;_0x52794f=0xc8;}else{_0x52794f=0xce;}_0x39b568[_0x17c5('0x19')](_0x52794f);return _0x39b568[_0x17c5('0x1e')](_0x17c5('0x1f'),_0x3e3feb+'-'+_0x1c0eac+'/'+_0x17d4fe)['json'](_0x383d29);}return null;};}function patchUpdates(_0x166394){return function(_0xf436f3){try{jsonpatch['apply'](_0xf436f3,_0x166394,!![]);}catch(_0x4ad64a){return BPromise[_0x17c5('0x20')](_0x4ad64a);}return _0xf436f3[_0x17c5('0x21')]();};}function saveUpdates(_0x1e3f69,_0x4cdc9b){return function(_0x897ec5){if(_0x897ec5){return _0x897ec5[_0x17c5('0x22')](_0x1e3f69)[_0x17c5('0x23')](function(_0x2d99e1){return _0x2d99e1;});}return null;};}function removeEntity(_0x36beb8,_0x160f90){return function(_0x1c7f74){if(_0x1c7f74){return _0x1c7f74[_0x17c5('0x24')]()['then'](function(){_0x36beb8[_0x17c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2211d3,_0x334ec9){return function(_0x238c96){if(!_0x238c96){_0x2211d3[_0x17c5('0x25')](0x194);}return _0x238c96;};}function handleError(_0x39ca33,_0x26adeb){_0x26adeb=_0x26adeb||0x1f4;return function(_0x3c5034){logger[_0x17c5('0x26')](_0x3c5034[_0x17c5('0x27')]);if(_0x3c5034['name']){delete _0x3c5034[_0x17c5('0x28')];}_0x39ca33['status'](_0x26adeb)[_0x17c5('0x29')](_0x3c5034);};}exports[_0x17c5('0x2a')]=function(_0x5e1b16,_0x97f322){var _0x490057={},_0x48b05e={},_0x50fa78={'count':0x0,'rows':[]};var _0x5ee439=_['map'](db[_0x17c5('0x2b')][_0x17c5('0x2c')],function(_0x59ce76){return{'name':_0x59ce76[_0x17c5('0x2d')],'type':_0x59ce76[_0x17c5('0x2e')][_0x17c5('0x2f')]};});_0x48b05e[_0x17c5('0x30')]=_['map'](_0x5ee439,_0x17c5('0x28'));_0x48b05e[_0x17c5('0x31')]=_['keys'](_0x5e1b16[_0x17c5('0x31')]);_0x48b05e[_0x17c5('0x32')]=_[_0x17c5('0x33')](_0x48b05e[_0x17c5('0x30')],_0x48b05e[_0x17c5('0x31')]);_0x490057[_0x17c5('0x34')]=_[_0x17c5('0x33')](_0x48b05e[_0x17c5('0x30')],qs['fields'](_0x5e1b16[_0x17c5('0x31')][_0x17c5('0x35')]));_0x490057[_0x17c5('0x34')]=_0x490057[_0x17c5('0x34')][_0x17c5('0x36')]?_0x490057[_0x17c5('0x34')]:_0x48b05e[_0x17c5('0x30')];if(!_0x5e1b16[_0x17c5('0x31')][_0x17c5('0x37')](_0x17c5('0x38'))){_0x490057[_0x17c5('0x1d')]=qs[_0x17c5('0x1d')](_0x5e1b16[_0x17c5('0x31')][_0x17c5('0x1d')]);_0x490057[_0x17c5('0x1c')]=qs[_0x17c5('0x1c')](_0x5e1b16[_0x17c5('0x31')]['offset']);}_0x490057[_0x17c5('0x39')]=qs[_0x17c5('0x3a')](_0x5e1b16['query'][_0x17c5('0x3a')]);_0x490057[_0x17c5('0x3b')]=qs['filters'](_[_0x17c5('0x3c')](_0x5e1b16[_0x17c5('0x31')],_0x48b05e[_0x17c5('0x32')]),_0x5ee439);if(_0x5e1b16[_0x17c5('0x31')][_0x17c5('0x3d')]){_0x490057['where']=_['merge'](_0x490057[_0x17c5('0x3b')],{'$or':_[_0x17c5('0x3e')](_0x5ee439,function(_0x4a56e0){if(_0x4a56e0[_0x17c5('0x2e')]!==_0x17c5('0x3f')){var _0x251fb0={};_0x251fb0[_0x4a56e0[_0x17c5('0x28')]]={'$like':'%'+_0x5e1b16[_0x17c5('0x31')][_0x17c5('0x3d')]+'%'};return _0x251fb0;}})});}_0x490057=_[_0x17c5('0x40')]({},_0x490057,_0x5e1b16[_0x17c5('0x41')]);var _0x49e03b={'where':_0x490057[_0x17c5('0x3b')]};return db[_0x17c5('0x2b')][_0x17c5('0x1b')](_0x49e03b)[_0x17c5('0x23')](function(_0x1aad4b){_0x50fa78[_0x17c5('0x1b')]=_0x1aad4b;if(_0x5e1b16[_0x17c5('0x31')][_0x17c5('0x42')]){_0x490057['include']=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x490057);})[_0x17c5('0x23')](function(_0x50c4e3){_0x50fa78[_0x17c5('0x43')]=_0x50c4e3;return _0x50fa78;})[_0x17c5('0x23')](respondWithFilteredResult(_0x97f322,_0x490057))[_0x17c5('0x44')](handleError(_0x97f322,null));};exports[_0x17c5('0x45')]=function(_0x2ae59c,_0x15d8c7){var _0x59b2a2={'raw':!![],'where':{'id':_0x2ae59c['params']['id']}},_0x276cc8={};_0x276cc8[_0x17c5('0x30')]=_['keys'](db[_0x17c5('0x2b')]['rawAttributes']);_0x276cc8[_0x17c5('0x31')]=_[_0x17c5('0x46')](_0x2ae59c[_0x17c5('0x31')]);_0x276cc8[_0x17c5('0x32')]=_[_0x17c5('0x33')](_0x276cc8['model'],_0x276cc8[_0x17c5('0x31')]);_0x59b2a2[_0x17c5('0x34')]=_[_0x17c5('0x33')](_0x276cc8[_0x17c5('0x30')],qs[_0x17c5('0x35')](_0x2ae59c['query'][_0x17c5('0x35')]));_0x59b2a2[_0x17c5('0x34')]=_0x59b2a2['attributes'][_0x17c5('0x36')]?_0x59b2a2[_0x17c5('0x34')]:_0x276cc8['model'];if(_0x2ae59c[_0x17c5('0x31')][_0x17c5('0x42')]){_0x59b2a2[_0x17c5('0x47')]=[{'all':!![]}];}_0x59b2a2=_['merge']({},_0x59b2a2,_0x2ae59c[_0x17c5('0x41')]);return db[_0x17c5('0x2b')][_0x17c5('0x48')](_0x59b2a2)[_0x17c5('0x23')](handleEntityNotFound(_0x15d8c7,null))[_0x17c5('0x23')](respondWithResult(_0x15d8c7,null))[_0x17c5('0x44')](handleError(_0x15d8c7,null));};exports[_0x17c5('0x49')]=function(_0x1eb147,_0x29c988){return db['FreshsalesField'][_0x17c5('0x49')](_0x1eb147[_0x17c5('0x4a')],{})[_0x17c5('0x23')](respondWithResult(_0x29c988,0xc9))[_0x17c5('0x44')](handleError(_0x29c988,null));};exports['update']=function(_0xb0043b,_0x247f97){if(_0xb0043b['body']['id']){delete _0xb0043b[_0x17c5('0x4a')]['id'];}return db[_0x17c5('0x2b')][_0x17c5('0x48')]({'where':{'id':_0xb0043b[_0x17c5('0x4b')]['id']}})[_0x17c5('0x23')](handleEntityNotFound(_0x247f97,null))['then'](saveUpdates(_0xb0043b['body'],null))[_0x17c5('0x23')](respondWithResult(_0x247f97,null))[_0x17c5('0x44')](handleError(_0x247f97,null));};exports[_0x17c5('0x24')]=function(_0x4d5fc7,_0x88f00f){return db['FreshsalesField'][_0x17c5('0x48')]({'where':{'id':_0x4d5fc7[_0x17c5('0x4b')]['id']}})[_0x17c5('0x23')](handleEntityNotFound(_0x88f00f,null))[_0x17c5('0x23')](removeEntity(_0x88f00f,null))[_0x17c5('0x44')](handleError(_0x88f00f,null));}; \ No newline at end of file +var _0xff26=['filters','intersection','attributes','fields','query','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','rimraf','zip-dir','fast-json-patch','moment','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/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','FreshsalesField','rawAttributes','type','key','model','keys'];(function(_0x29e7fb,_0x5b2ff3){var _0x171dad=function(_0x3ddce4){while(--_0x3ddce4){_0x29e7fb['push'](_0x29e7fb['shift']());}};_0x171dad(++_0x5b2ff3);}(_0xff26,0xfb));var _0x6ff2=function(_0x2c7061,_0x324fa7){_0x2c7061=_0x2c7061-0x0;var _0x576748=_0xff26[_0x2c7061];return _0x576748;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6ff2('0x0'));var zipdir=require(_0x6ff2('0x1'));var jsonpatch=require(_0x6ff2('0x2'));var rp=require('request-promise');var moment=require(_0x6ff2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ff2('0x4'));var util=require(_0x6ff2('0x5'));var path=require(_0x6ff2('0x6'));var sox=require(_0x6ff2('0x7'));var csv=require(_0x6ff2('0x8'));var ejs=require(_0x6ff2('0x9'));var fs=require('fs');var _=require(_0x6ff2('0xa'));var squel=require(_0x6ff2('0xb'));var crypto=require(_0x6ff2('0xc'));var jsforce=require(_0x6ff2('0xd'));var deskjs=require(_0x6ff2('0xe'));var toCsv=require(_0x6ff2('0x8'));var querystring=require(_0x6ff2('0xf'));var Papa=require(_0x6ff2('0x10'));var Redis=require(_0x6ff2('0x11'));var authService=require(_0x6ff2('0x12'));var qs=require(_0x6ff2('0x13'));var as=require(_0x6ff2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ff2('0x15'))(_0x6ff2('0x16'));var utils=require(_0x6ff2('0x17'));var config=require(_0x6ff2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf87f6c,_0xf8f605){_0xf8f605=_0xf8f605||0xcc;return function(_0x331a0e){if(_0x331a0e){return _0xf87f6c[_0x6ff2('0x19')](_0xf8f605);}return _0xf87f6c[_0x6ff2('0x1a')](_0xf8f605)['end']();};}function respondWithResult(_0x7f7f8,_0x2b460b){_0x2b460b=_0x2b460b||0xc8;return function(_0x61586f){if(_0x61586f){return _0x7f7f8[_0x6ff2('0x1a')](_0x2b460b)[_0x6ff2('0x1b')](_0x61586f);}};}function respondWithFilteredResult(_0x3dee0c,_0x437b9a){return function(_0x534dc6){if(_0x534dc6){var _0xdd694a=_0x534dc6['count'],_0x50a368=_0x437b9a[_0x6ff2('0x1c')],_0x1d4bd9=_0x437b9a[_0x6ff2('0x1c')]+_0x437b9a['limit'],_0x31a3c1;if(_0x1d4bd9>=_0xdd694a){_0x1d4bd9=_0xdd694a;_0x31a3c1=0xc8;}else{_0x31a3c1=0xce;}_0x3dee0c['status'](_0x31a3c1);return _0x3dee0c[_0x6ff2('0x1d')](_0x6ff2('0x1e'),_0x50a368+'-'+_0x1d4bd9+'/'+_0xdd694a)['json'](_0x534dc6);}return null;};}function patchUpdates(_0x31651e){return function(_0x50427a){try{jsonpatch[_0x6ff2('0x1f')](_0x50427a,_0x31651e,!![]);}catch(_0x5cd4dd){return BPromise[_0x6ff2('0x20')](_0x5cd4dd);}return _0x50427a[_0x6ff2('0x21')]();};}function saveUpdates(_0x76cacb,_0x5852eb){return function(_0x40a706){if(_0x40a706){return _0x40a706[_0x6ff2('0x22')](_0x76cacb)[_0x6ff2('0x23')](function(_0x1b86ab){return _0x1b86ab;});}return null;};}function removeEntity(_0x1798c7,_0xb13285){return function(_0xf0c0bb){if(_0xf0c0bb){return _0xf0c0bb[_0x6ff2('0x24')]()['then'](function(){_0x1798c7[_0x6ff2('0x1a')](0xcc)[_0x6ff2('0x25')]();});}};}function handleEntityNotFound(_0x3a8234,_0x584080){return function(_0x714763){if(!_0x714763){_0x3a8234[_0x6ff2('0x19')](0x194);}return _0x714763;};}function handleError(_0x315f61,_0x2ec19d){_0x2ec19d=_0x2ec19d||0x1f4;return function(_0xde7534){logger[_0x6ff2('0x26')](_0xde7534[_0x6ff2('0x27')]);if(_0xde7534['name']){delete _0xde7534[_0x6ff2('0x28')];}_0x315f61[_0x6ff2('0x1a')](_0x2ec19d)['send'](_0xde7534);};}exports[_0x6ff2('0x29')]=function(_0x4bad82,_0x395dbe){var _0x13af5b={},_0x45286b={},_0x15e771={'count':0x0,'rows':[]};var _0xdfc5e8=_[_0x6ff2('0x2a')](db[_0x6ff2('0x2b')][_0x6ff2('0x2c')],function(_0x5eadf0){return{'name':_0x5eadf0['fieldName'],'type':_0x5eadf0[_0x6ff2('0x2d')][_0x6ff2('0x2e')]};});_0x45286b[_0x6ff2('0x2f')]=_['map'](_0xdfc5e8,_0x6ff2('0x28'));_0x45286b['query']=_[_0x6ff2('0x30')](_0x4bad82['query']);_0x45286b[_0x6ff2('0x31')]=_[_0x6ff2('0x32')](_0x45286b['model'],_0x45286b['query']);_0x13af5b[_0x6ff2('0x33')]=_[_0x6ff2('0x32')](_0x45286b[_0x6ff2('0x2f')],qs[_0x6ff2('0x34')](_0x4bad82['query']['fields']));_0x13af5b['attributes']=_0x13af5b['attributes']['length']?_0x13af5b['attributes']:_0x45286b[_0x6ff2('0x2f')];if(!_0x4bad82[_0x6ff2('0x35')]['hasOwnProperty'](_0x6ff2('0x36'))){_0x13af5b[_0x6ff2('0x37')]=qs[_0x6ff2('0x37')](_0x4bad82[_0x6ff2('0x35')][_0x6ff2('0x37')]);_0x13af5b['offset']=qs[_0x6ff2('0x1c')](_0x4bad82[_0x6ff2('0x35')][_0x6ff2('0x1c')]);}_0x13af5b[_0x6ff2('0x38')]=qs[_0x6ff2('0x39')](_0x4bad82[_0x6ff2('0x35')][_0x6ff2('0x39')]);_0x13af5b[_0x6ff2('0x3a')]=qs[_0x6ff2('0x31')](_[_0x6ff2('0x3b')](_0x4bad82[_0x6ff2('0x35')],_0x45286b[_0x6ff2('0x31')]),_0xdfc5e8);if(_0x4bad82['query'][_0x6ff2('0x3c')]){_0x13af5b[_0x6ff2('0x3a')]=_[_0x6ff2('0x3d')](_0x13af5b[_0x6ff2('0x3a')],{'$or':_['map'](_0xdfc5e8,function(_0x4f3536){if(_0x4f3536[_0x6ff2('0x2d')]!==_0x6ff2('0x3e')){var _0x46fa36={};_0x46fa36[_0x4f3536[_0x6ff2('0x28')]]={'$like':'%'+_0x4bad82[_0x6ff2('0x35')][_0x6ff2('0x3c')]+'%'};return _0x46fa36;}})});}_0x13af5b=_['merge']({},_0x13af5b,_0x4bad82['options']);var _0x368962={'where':_0x13af5b[_0x6ff2('0x3a')]};return db[_0x6ff2('0x2b')][_0x6ff2('0x3f')](_0x368962)['then'](function(_0x2bdfad){_0x15e771[_0x6ff2('0x3f')]=_0x2bdfad;if(_0x4bad82[_0x6ff2('0x35')][_0x6ff2('0x40')]){_0x13af5b[_0x6ff2('0x41')]=[{'all':!![]}];}return db[_0x6ff2('0x2b')][_0x6ff2('0x42')](_0x13af5b);})['then'](function(_0x2cb06b){_0x15e771[_0x6ff2('0x43')]=_0x2cb06b;return _0x15e771;})[_0x6ff2('0x23')](respondWithFilteredResult(_0x395dbe,_0x13af5b))[_0x6ff2('0x44')](handleError(_0x395dbe,null));};exports[_0x6ff2('0x45')]=function(_0x2c00b8,_0x170381){var _0x849c66={'raw':!![],'where':{'id':_0x2c00b8[_0x6ff2('0x46')]['id']}},_0x20a8ab={};_0x20a8ab[_0x6ff2('0x2f')]=_[_0x6ff2('0x30')](db[_0x6ff2('0x2b')][_0x6ff2('0x2c')]);_0x20a8ab['query']=_[_0x6ff2('0x30')](_0x2c00b8[_0x6ff2('0x35')]);_0x20a8ab[_0x6ff2('0x31')]=_[_0x6ff2('0x32')](_0x20a8ab['model'],_0x20a8ab['query']);_0x849c66[_0x6ff2('0x33')]=_[_0x6ff2('0x32')](_0x20a8ab['model'],qs[_0x6ff2('0x34')](_0x2c00b8['query'][_0x6ff2('0x34')]));_0x849c66['attributes']=_0x849c66['attributes']['length']?_0x849c66[_0x6ff2('0x33')]:_0x20a8ab[_0x6ff2('0x2f')];if(_0x2c00b8[_0x6ff2('0x35')]['includeAll']){_0x849c66['include']=[{'all':!![]}];}_0x849c66=_[_0x6ff2('0x3d')]({},_0x849c66,_0x2c00b8[_0x6ff2('0x47')]);return db[_0x6ff2('0x2b')][_0x6ff2('0x48')](_0x849c66)['then'](handleEntityNotFound(_0x170381,null))[_0x6ff2('0x23')](respondWithResult(_0x170381,null))[_0x6ff2('0x44')](handleError(_0x170381,null));};exports[_0x6ff2('0x49')]=function(_0x16e907,_0x3e362a){return db[_0x6ff2('0x2b')][_0x6ff2('0x49')](_0x16e907[_0x6ff2('0x4a')],{})['then'](respondWithResult(_0x3e362a,0xc9))[_0x6ff2('0x44')](handleError(_0x3e362a,null));};exports[_0x6ff2('0x22')]=function(_0x4d183c,_0x5b6f5e){if(_0x4d183c[_0x6ff2('0x4a')]['id']){delete _0x4d183c[_0x6ff2('0x4a')]['id'];}return db[_0x6ff2('0x2b')][_0x6ff2('0x48')]({'where':{'id':_0x4d183c['params']['id']}})[_0x6ff2('0x23')](handleEntityNotFound(_0x5b6f5e,null))[_0x6ff2('0x23')](saveUpdates(_0x4d183c[_0x6ff2('0x4a')],null))[_0x6ff2('0x23')](respondWithResult(_0x5b6f5e,null))['catch'](handleError(_0x5b6f5e,null));};exports['destroy']=function(_0x36ec7f,_0x5946ac){return db['FreshsalesField'][_0x6ff2('0x48')]({'where':{'id':_0x36ec7f['params']['id']}})[_0x6ff2('0x23')](handleEntityNotFound(_0x5946ac,null))[_0x6ff2('0x23')](removeEntity(_0x5946ac,null))['catch'](handleError(_0x5946ac,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index f7d54ba..a9dc265 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 _0xf3cb=['bluebird','request-promise','path','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0xd34ef3,_0x10bc8c){var _0x991cba=function(_0x11d952){while(--_0x11d952){_0xd34ef3['push'](_0xd34ef3['shift']());}};_0x991cba(++_0x10bc8c);}(_0xf3cb,0x175));var _0xbf3c=function(_0x226402,_0x36aac7){_0x226402=_0x226402-0x0;var _0x260b25=_0xf3cb[_0x226402];return _0x260b25;};'use strict';var _=require(_0xbf3c('0x0'));var util=require('util');var logger=require(_0xbf3c('0x1'))(_0xbf3c('0x2'));var moment=require(_0xbf3c('0x3'));var BPromise=require(_0xbf3c('0x4'));var rp=require(_0xbf3c('0x5'));var fs=require('fs');var path=require(_0xbf3c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0xbf3c('0x7')]=function(_0x250fbb,_0x489cb0){return _0x250fbb[_0xbf3c('0x8')](_0xbf3c('0x9'),attributes,{'tableName':_0xbf3c('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xbf3c('0xb'),_0xbf3c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd201=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xc649dd,_0x5cb5b2){var _0x428569=function(_0x11d646){while(--_0x11d646){_0xc649dd['push'](_0xc649dd['shift']());}};_0x428569(++_0x5cb5b2);}(_0xd201,0x17a));var _0x1d20=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0xd201[_0x3e3bee];return _0x3ae14c;};'use strict';var _=require('lodash');var util=require(_0x1d20('0x0'));var logger=require(_0x1d20('0x1'))('api');var moment=require(_0x1d20('0x2'));var BPromise=require(_0x1d20('0x3'));var rp=require(_0x1d20('0x4'));var fs=require('fs');var path=require(_0x1d20('0x5'));var rimraf=require(_0x1d20('0x6'));var config=require(_0x1d20('0x7'));var attributes=require(_0x1d20('0x8'));module[_0x1d20('0x9')]=function(_0x4e6705,_0x1b81ec){return _0x4e6705[_0x1d20('0xa')](_0x1d20('0xb'),attributes,{'tableName':_0x1d20('0xc'),'paranoid':![],'indexes':[{'name':_0x1d20('0xd'),'fields':[_0x1d20('0xe'),_0x1d20('0xf')],'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 1986377..fca4d62 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 _0x76c5=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0x76c5,0x1df));var _0x576c=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0x76c5[_0x454e6d];return _0x4bc294;};'use strict';var _=require(_0x576c('0x0'));var util=require('util');var moment=require(_0x576c('0x1'));var BPromise=require(_0x576c('0x2'));var rs=require(_0x576c('0x3'));var fs=require('fs');var Redis=require(_0x576c('0x4'));var db=require(_0x576c('0x5'))['db'];var utils=require(_0x576c('0x6'));var logger=require('../../config/logger')(_0x576c('0x7'));var config=require(_0x576c('0x8'));var jayson=require(_0x576c('0x9'));var client=jayson[_0x576c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9595a6,_0x327612,_0x2ac1b9){return new BPromise(function(_0x487a2c,_0x54d082){return client[_0x576c('0xb')](_0x9595a6,_0x2ac1b9)[_0x576c('0xc')](function(_0x2ee0ad){logger[_0x576c('0xd')](_0x576c('0xe'),_0x327612,_0x576c('0xf'));logger[_0x576c('0x10')](_0x576c('0x11'),_0x327612,_0x576c('0xf'),JSON[_0x576c('0x12')](_0x2ee0ad));if(_0x2ee0ad[_0x576c('0x13')]){if(_0x2ee0ad[_0x576c('0x13')][_0x576c('0x14')]===0x1f4){logger[_0x576c('0x13')](_0x576c('0xe'),_0x327612,_0x2ee0ad[_0x576c('0x13')][_0x576c('0x15')]);return _0x54d082(_0x2ee0ad[_0x576c('0x13')][_0x576c('0x15')]);}logger[_0x576c('0x13')](_0x576c('0xe'),_0x327612,_0x2ee0ad[_0x576c('0x13')][_0x576c('0x15')]);return _0x487a2c(_0x2ee0ad[_0x576c('0x13')][_0x576c('0x15')]);}else{logger[_0x576c('0xd')](_0x576c('0xe'),_0x327612,_0x576c('0xf'));_0x487a2c(_0x2ee0ad[_0x576c('0x16')][_0x576c('0x15')]);}})['catch'](function(_0x322f96){logger[_0x576c('0x13')](_0x576c('0xe'),_0x327612,_0x322f96);_0x54d082(_0x322f96);});});} \ No newline at end of file +var _0xea2d=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x54daf5,_0x528643){var _0xf70158=function(_0x4902d6){while(--_0x4902d6){_0x54daf5['push'](_0x54daf5['shift']());}};_0xf70158(++_0x528643);}(_0xea2d,0xfb));var _0xdea2=function(_0x2aaf4e,_0x13256b){_0x2aaf4e=_0x2aaf4e-0x0;var _0x1736af=_0xea2d[_0x2aaf4e];return _0x1736af;};'use strict';var _=require('lodash');var util=require(_0xdea2('0x0'));var moment=require(_0xdea2('0x1'));var BPromise=require(_0xdea2('0x2'));var rs=require(_0xdea2('0x3'));var fs=require('fs');var Redis=require(_0xdea2('0x4'));var db=require(_0xdea2('0x5'))['db'];var utils=require(_0xdea2('0x6'));var logger=require(_0xdea2('0x7'))(_0xdea2('0x8'));var config=require(_0xdea2('0x9'));var jayson=require(_0xdea2('0xa'));var client=jayson[_0xdea2('0xb')][_0xdea2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f1aff,_0x1a5e12,_0x4eaca5){return new BPromise(function(_0x36a81f,_0x58cd21){return client[_0xdea2('0xd')](_0x1f1aff,_0x4eaca5)[_0xdea2('0xe')](function(_0x9d8062){logger[_0xdea2('0xf')](_0xdea2('0x10'),_0x1a5e12,'request\x20sent');logger[_0xdea2('0x11')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1a5e12,_0xdea2('0x12'),JSON[_0xdea2('0x13')](_0x9d8062));if(_0x9d8062[_0xdea2('0x14')]){if(_0x9d8062[_0xdea2('0x14')][_0xdea2('0x15')]===0x1f4){logger['error'](_0xdea2('0x10'),_0x1a5e12,_0x9d8062[_0xdea2('0x14')][_0xdea2('0x16')]);return _0x58cd21(_0x9d8062['error']['message']);}logger[_0xdea2('0x14')](_0xdea2('0x10'),_0x1a5e12,_0x9d8062[_0xdea2('0x14')][_0xdea2('0x16')]);return _0x36a81f(_0x9d8062[_0xdea2('0x14')][_0xdea2('0x16')]);}else{logger[_0xdea2('0xf')](_0xdea2('0x10'),_0x1a5e12,_0xdea2('0x12'));_0x36a81f(_0x9d8062[_0xdea2('0x17')]['message']);}})[_0xdea2('0x18')](function(_0x46a0cd){logger[_0xdea2('0x14')](_0xdea2('0x10'),_0x1a5e12,_0x46a0cd);_0x58cd21(_0x46a0cd);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 70d28a1..2a4bd82 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 _0x8d02=['/:id','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','index','isAuthenticated','show','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete'];(function(_0x3a6562,_0x20f6af){var _0x3a3094=function(_0x4c6d8a){while(--_0x4c6d8a){_0x3a6562['push'](_0x3a6562['shift']());}};_0x3a3094(++_0x20f6af);}(_0x8d02,0x191));var _0x28d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8d02[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x28d0('0x0'));var util=require(_0x28d0('0x1'));var path=require('path');var timeout=require(_0x28d0('0x2'));var express=require('express');var router=express[_0x28d0('0x3')]();var auth=require(_0x28d0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x28d0('0x5'));var controller=require(_0x28d0('0x6'));router[_0x28d0('0x7')]('/',auth['isAuthenticated'](),controller[_0x28d0('0x8')]);router[_0x28d0('0x7')]('/:id',auth[_0x28d0('0x9')](),controller[_0x28d0('0xa')]);router['get']('/:id/configurations',auth[_0x28d0('0x9')](),controller['getConfigurations']);router[_0x28d0('0x7')]('/:id/fields',auth[_0x28d0('0x9')](),controller[_0x28d0('0xb')]);router[_0x28d0('0xc')]('/',auth[_0x28d0('0x9')](),controller[_0x28d0('0xd')]);router[_0x28d0('0xc')](_0x28d0('0xe'),auth[_0x28d0('0x9')](),controller[_0x28d0('0xf')]);router[_0x28d0('0x10')]('/:id',auth[_0x28d0('0x9')](),controller[_0x28d0('0x11')]);router[_0x28d0('0x12')](_0x28d0('0x13'),auth[_0x28d0('0x9')](),controller[_0x28d0('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6c13=['/:id/configurations','addConfiguration','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','index','get','show','getConfigurations','/:id/fields','getFields','post'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x6c13,0xbf));var _0x36c1=function(_0x845505,_0x19e5f3){_0x845505=_0x845505-0x0;var _0x2513b9=_0x6c13[_0x845505];return _0x2513b9;};'use strict';var multer=require(_0x36c1('0x0'));var util=require('util');var path=require(_0x36c1('0x1'));var timeout=require(_0x36c1('0x2'));var express=require(_0x36c1('0x3'));var router=express[_0x36c1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x36c1('0x5'));var config=require(_0x36c1('0x6'));var controller=require(_0x36c1('0x7'));router['get']('/',auth[_0x36c1('0x8')](),controller[_0x36c1('0x9')]);router[_0x36c1('0xa')]('/:id',auth[_0x36c1('0x8')](),controller[_0x36c1('0xb')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x36c1('0xc')]);router[_0x36c1('0xa')](_0x36c1('0xd'),auth[_0x36c1('0x8')](),controller[_0x36c1('0xe')]);router['post']('/',auth[_0x36c1('0x8')](),controller['create']);router[_0x36c1('0xf')](_0x36c1('0x10'),auth[_0x36c1('0x8')](),controller[_0x36c1('0x11')]);router[_0x36c1('0x12')](_0x36c1('0x13'),auth[_0x36c1('0x8')](),controller[_0x36c1('0x14')]);router['delete'](_0x36c1('0x13'),auth[_0x36c1('0x8')](),controller[_0x36c1('0x15')]);module[_0x36c1('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 2380543..f264873 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 _0x28b0=['integrationTab','sequelize','exports','STRING','username','ENUM'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x28b0,0x1db));var _0x028b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28b0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x028b('0x0'));module[_0x028b('0x1')]={'name':{'type':Sequelize[_0x028b('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x028b('0x2')],'unique':_0x028b('0x3')},'remoteUri':{'type':Sequelize[_0x028b('0x2')]},'password':{'type':Sequelize[_0x028b('0x2')]},'clientId':{'type':Sequelize[_0x028b('0x2')]},'clientSecret':{'type':Sequelize[_0x028b('0x2')]},'securityToken':{'type':Sequelize[_0x028b('0x2')]},'serverUrl':{'type':Sequelize[_0x028b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x028b('0x4')](_0x028b('0x5'),'newTab'),'defaultValue':_0x028b('0x5')}}; \ No newline at end of file +var _0x10ca=['STRING','integrationTab','newTab','sequelize','exports'];(function(_0x3e1aa4,_0xad60db){var _0x1a8d69=function(_0x27871b){while(--_0x27871b){_0x3e1aa4['push'](_0x3e1aa4['shift']());}};_0x1a8d69(++_0xad60db);}(_0x10ca,0x1a7));var _0xa10c=function(_0xb07acf,_0x3e2bf4){_0xb07acf=_0xb07acf-0x0;var _0x362264=_0x10ca[_0xb07acf];return _0x362264;};'use strict';var Sequelize=require(_0xa10c('0x0'));module[_0xa10c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa10c('0x2')]},'username':{'type':Sequelize[_0xa10c('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xa10c('0x2')]},'password':{'type':Sequelize[_0xa10c('0x2')]},'clientId':{'type':Sequelize[_0xa10c('0x2')]},'clientSecret':{'type':Sequelize[_0xa10c('0x2')]},'securityToken':{'type':Sequelize[_0xa10c('0x2')]},'serverUrl':{'type':Sequelize[_0xa10c('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa10c('0x3'),_0xa10c('0x4')),'defaultValue':_0xa10c('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 5dbaf10..1163155 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 _0xb62e=['keys','intersection','attributes','model','fields','length','order','where','filters','pick','filter','merge','VIRTUAL','options','catch','show','includeAll','include','find','create','body','params','destroy','getConfigurations','findOne','SalesforceConfiguration','sort','hasOwnProperty','nolimit','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','Case','Origin','Reason','SuppliedName','SuppliedCompany','includes','label','custom','picklistValues','boolean','true','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','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','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','count','offset','limit','Content-Range','apply','save','update','then','sendStatus','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query'];(function(_0x57e00e,_0x36e79a){var _0x415e60=function(_0x5cd7fa){while(--_0x5cd7fa){_0x57e00e['push'](_0x57e00e['shift']());}};_0x415e60(++_0x36e79a);}(_0xb62e,0x1de));var _0xeb62=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb62e[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0xeb62('0x0'));var emlformat=require(_0xeb62('0x1'));var rimraf=require(_0xeb62('0x2'));var zipdir=require(_0xeb62('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb62('0x4'));var moment=require(_0xeb62('0x5'));var BPromise=require(_0xeb62('0x6'));var Mustache=require(_0xeb62('0x7'));var util=require(_0xeb62('0x8'));var path=require(_0xeb62('0x9'));var sox=require('sox');var csv=require(_0xeb62('0xa'));var ejs=require(_0xeb62('0xb'));var fs=require('fs');var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x10'));var authService=require(_0xeb62('0x11'));var qs=require(_0xeb62('0x12'));var as=require(_0xeb62('0x13'));var hardwareService=require(_0xeb62('0x14'));var logger=require(_0xeb62('0x15'))(_0xeb62('0x16'));var utils=require(_0xeb62('0x17'));var config=require(_0xeb62('0x18'));var licenseUtil=require(_0xeb62('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb62('0x1a'));var jayson=require(_0xeb62('0x1b'));var client=jayson[_0xeb62('0x1c')][_0xeb62('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x55a629,_0x333126,_0x2fbad2,_0x23fb15){return new BPromise(function(_0x4da178,_0x26c3fd){var _0x195837=_0x23fb15||client;return _0x195837[_0xeb62('0x1e')](_0x55a629,_0x2fbad2)['then'](function(_0x1f6a1f){logger[_0xeb62('0x1f')](_0xeb62('0x20'),_0x333126,_0xeb62('0x21'));logger[_0xeb62('0x22')](_0xeb62('0x23'),_0x333126,_0xeb62('0x21'),JSON[_0xeb62('0x24')](_0x1f6a1f));if(_0x1f6a1f[_0xeb62('0x25')]){if(_0x1f6a1f[_0xeb62('0x25')][_0xeb62('0x26')]===0x1f4){logger[_0xeb62('0x25')](_0xeb62('0x20'),_0x333126,_0x1f6a1f['error'][_0xeb62('0x27')]);return _0x26c3fd(_0x1f6a1f[_0xeb62('0x25')][_0xeb62('0x27')]);}logger[_0xeb62('0x25')](_0xeb62('0x20'),_0x333126,_0x1f6a1f[_0xeb62('0x25')][_0xeb62('0x27')]);return _0x4da178(_0x1f6a1f['error']['message']);}else{logger[_0xeb62('0x1f')](_0xeb62('0x20'),_0x333126,_0xeb62('0x21'));_0x4da178(_0x1f6a1f[_0xeb62('0x28')][_0xeb62('0x27')]);}})['catch'](function(_0x5e7aee){logger[_0xeb62('0x25')](_0xeb62('0x20'),_0x333126,_0x5e7aee);_0x26c3fd(_0x5e7aee);});});}function respondWithStatusCode(_0x182781,_0x395b70){_0x395b70=_0x395b70||0xcc;return function(_0x55a169){if(_0x55a169){return _0x182781['sendStatus'](_0x395b70);}return _0x182781[_0xeb62('0x29')](_0x395b70)['end']();};}function respondWithResult(_0x448327,_0x4b0f46){_0x4b0f46=_0x4b0f46||0xc8;return function(_0xfe3e16){if(_0xfe3e16){return _0x448327['status'](_0x4b0f46)[_0xeb62('0x2a')](_0xfe3e16);}};}function respondWithFilteredResult(_0x6bfbbc,_0x46d1bb){return function(_0x4e4268){if(_0x4e4268){var _0x3ef784=_0x4e4268[_0xeb62('0x2b')],_0x3ae031=_0x46d1bb[_0xeb62('0x2c')],_0x5222f4=_0x46d1bb['offset']+_0x46d1bb[_0xeb62('0x2d')],_0xe8872c;if(_0x5222f4>=_0x3ef784){_0x5222f4=_0x3ef784;_0xe8872c=0xc8;}else{_0xe8872c=0xce;}_0x6bfbbc[_0xeb62('0x29')](_0xe8872c);return _0x6bfbbc['set'](_0xeb62('0x2e'),_0x3ae031+'-'+_0x5222f4+'/'+_0x3ef784)[_0xeb62('0x2a')](_0x4e4268);}return null;};}function patchUpdates(_0x2c967c){return function(_0x2c308c){try{jsonpatch[_0xeb62('0x2f')](_0x2c308c,_0x2c967c,!![]);}catch(_0x5195bf){return BPromise['reject'](_0x5195bf);}return _0x2c308c[_0xeb62('0x30')]();};}function saveUpdates(_0x357cf4,_0x1607ef){return function(_0x3f89ed){if(_0x3f89ed){return _0x3f89ed[_0xeb62('0x31')](_0x357cf4)[_0xeb62('0x32')](function(_0x1ae51e){return _0x1ae51e;});}return null;};}function removeEntity(_0x4be25d,_0x411062){return function(_0x47a94b){if(_0x47a94b){return _0x47a94b['destroy']()[_0xeb62('0x32')](function(){_0x4be25d[_0xeb62('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ade38,_0x4bcfce){return function(_0x1c2195){if(!_0x1c2195){_0x1ade38[_0xeb62('0x33')](0x194);}return _0x1c2195;};}function handleError(_0x530587,_0x2c23c6){_0x2c23c6=_0x2c23c6||0x1f4;return function(_0xe2589){logger['error'](_0xe2589[_0xeb62('0x34')]);if(_0xe2589[_0xeb62('0x35')]){delete _0xe2589[_0xeb62('0x35')];}_0x530587[_0xeb62('0x29')](_0x2c23c6)['send'](_0xe2589);};}exports[_0xeb62('0x36')]=function(_0x43685b,_0x4cf6b0){var _0x4acc96={},_0x112cd7={},_0x117d8c={'count':0x0,'rows':[]};var _0x4e29a7=_[_0xeb62('0x37')](db[_0xeb62('0x38')][_0xeb62('0x39')],function(_0x1f839a){return{'name':_0x1f839a[_0xeb62('0x3a')],'type':_0x1f839a[_0xeb62('0x3b')][_0xeb62('0x3c')]};});_0x112cd7['model']=_['map'](_0x4e29a7,_0xeb62('0x35'));_0x112cd7[_0xeb62('0x3d')]=_[_0xeb62('0x3e')](_0x43685b[_0xeb62('0x3d')]);_0x112cd7['filters']=_[_0xeb62('0x3f')](_0x112cd7['model'],_0x112cd7[_0xeb62('0x3d')]);_0x4acc96[_0xeb62('0x40')]=_[_0xeb62('0x3f')](_0x112cd7[_0xeb62('0x41')],qs[_0xeb62('0x42')](_0x43685b[_0xeb62('0x3d')][_0xeb62('0x42')]));_0x4acc96[_0xeb62('0x40')]=_0x4acc96['attributes'][_0xeb62('0x43')]?_0x4acc96[_0xeb62('0x40')]:_0x112cd7[_0xeb62('0x41')];if(!_0x43685b[_0xeb62('0x3d')]['hasOwnProperty']('nolimit')){_0x4acc96[_0xeb62('0x2d')]=qs[_0xeb62('0x2d')](_0x43685b['query'][_0xeb62('0x2d')]);_0x4acc96[_0xeb62('0x2c')]=qs['offset'](_0x43685b[_0xeb62('0x3d')]['offset']);}_0x4acc96[_0xeb62('0x44')]=qs['sort'](_0x43685b[_0xeb62('0x3d')]['sort']);_0x4acc96[_0xeb62('0x45')]=qs[_0xeb62('0x46')](_[_0xeb62('0x47')](_0x43685b['query'],_0x112cd7['filters']),_0x4e29a7);if(_0x43685b[_0xeb62('0x3d')][_0xeb62('0x48')]){_0x4acc96[_0xeb62('0x45')]=_[_0xeb62('0x49')](_0x4acc96[_0xeb62('0x45')],{'$or':_['map'](_0x4e29a7,function(_0x29fdb8){if(_0x29fdb8['type']!==_0xeb62('0x4a')){var _0x4a34ce={};_0x4a34ce[_0x29fdb8[_0xeb62('0x35')]]={'$like':'%'+_0x43685b['query'][_0xeb62('0x48')]+'%'};return _0x4a34ce;}})});}_0x4acc96=_['merge']({},_0x4acc96,_0x43685b[_0xeb62('0x4b')]);var _0x4624e7={'where':_0x4acc96[_0xeb62('0x45')]};return db[_0xeb62('0x38')][_0xeb62('0x2b')](_0x4624e7)[_0xeb62('0x32')](function(_0x4e62eb){_0x117d8c[_0xeb62('0x2b')]=_0x4e62eb;if(_0x43685b[_0xeb62('0x3d')]['includeAll']){_0x4acc96['include']=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x4acc96);})[_0xeb62('0x32')](function(_0x12562f){_0x117d8c['rows']=_0x12562f;return _0x117d8c;})[_0xeb62('0x32')](respondWithFilteredResult(_0x4cf6b0,_0x4acc96))[_0xeb62('0x4c')](handleError(_0x4cf6b0,null));};exports[_0xeb62('0x4d')]=function(_0x16e262,_0x39595c){var _0x555812={'raw':![],'where':{'id':_0x16e262['params']['id']}},_0xfb8cc7={};_0xfb8cc7[_0xeb62('0x41')]=_[_0xeb62('0x3e')](db[_0xeb62('0x38')][_0xeb62('0x39')]);_0xfb8cc7[_0xeb62('0x3d')]=_[_0xeb62('0x3e')](_0x16e262[_0xeb62('0x3d')]);_0xfb8cc7[_0xeb62('0x46')]=_[_0xeb62('0x3f')](_0xfb8cc7[_0xeb62('0x41')],_0xfb8cc7[_0xeb62('0x3d')]);_0x555812[_0xeb62('0x40')]=_['intersection'](_0xfb8cc7[_0xeb62('0x41')],qs['fields'](_0x16e262['query'][_0xeb62('0x42')]));_0x555812[_0xeb62('0x40')]=_0x555812['attributes'][_0xeb62('0x43')]?_0x555812[_0xeb62('0x40')]:_0xfb8cc7['model'];if(_0x16e262[_0xeb62('0x3d')][_0xeb62('0x4e')]){_0x555812[_0xeb62('0x4f')]=[{'all':!![]}];}_0x555812=_[_0xeb62('0x49')]({},_0x555812,_0x16e262[_0xeb62('0x4b')]);return db[_0xeb62('0x38')][_0xeb62('0x50')](_0x555812)[_0xeb62('0x32')](handleEntityNotFound(_0x39595c,null))['then'](respondWithResult(_0x39595c,null))[_0xeb62('0x4c')](handleError(_0x39595c,null));};exports['create']=function(_0x35a2d6,_0x39f88d){return db[_0xeb62('0x38')][_0xeb62('0x51')](_0x35a2d6[_0xeb62('0x52')],{})[_0xeb62('0x32')](respondWithResult(_0x39f88d,0xc9))[_0xeb62('0x4c')](handleError(_0x39f88d,null));};exports[_0xeb62('0x31')]=function(_0x595d58,_0x4d31a1){if(_0x595d58['body']['id']){delete _0x595d58['body']['id'];}return db[_0xeb62('0x38')]['find']({'where':{'id':_0x595d58[_0xeb62('0x53')]['id']}})['then'](handleEntityNotFound(_0x4d31a1,null))[_0xeb62('0x32')](saveUpdates(_0x595d58[_0xeb62('0x52')],null))[_0xeb62('0x32')](respondWithResult(_0x4d31a1,null))['catch'](handleError(_0x4d31a1,null));};exports[_0xeb62('0x54')]=function(_0x1486a6,_0x518dd4){return db[_0xeb62('0x38')][_0xeb62('0x50')]({'where':{'id':_0x1486a6[_0xeb62('0x53')]['id']}})[_0xeb62('0x32')](handleEntityNotFound(_0x518dd4,null))['then'](removeEntity(_0x518dd4,null))[_0xeb62('0x4c')](handleError(_0x518dd4,null));};exports[_0xeb62('0x55')]=function(_0x4cd99f,_0x2eba52,_0x5d1415){var _0x10b1ef={};var _0x466c3c={};var _0x3a450b;var _0x46da69;return db[_0xeb62('0x38')][_0xeb62('0x56')]({'where':{'id':_0x4cd99f[_0xeb62('0x53')]['id']}})[_0xeb62('0x32')](handleEntityNotFound(_0x2eba52,null))[_0xeb62('0x32')](function(_0x15c93f){if(_0x15c93f){_0x3a450b=_0x15c93f;_0x466c3c[_0xeb62('0x41')]=_[_0xeb62('0x3e')](db[_0xeb62('0x57')][_0xeb62('0x39')]);_0x466c3c['query']=_['keys'](_0x4cd99f['query']);_0x466c3c['filters']=_[_0xeb62('0x3f')](_0x466c3c['model'],_0x466c3c[_0xeb62('0x3d')]);_0x10b1ef[_0xeb62('0x40')]=_[_0xeb62('0x3f')](_0x466c3c[_0xeb62('0x41')],qs[_0xeb62('0x42')](_0x4cd99f[_0xeb62('0x3d')][_0xeb62('0x42')]));_0x10b1ef[_0xeb62('0x40')]=_0x10b1ef[_0xeb62('0x40')][_0xeb62('0x43')]?_0x10b1ef['attributes']:_0x466c3c[_0xeb62('0x41')];_0x10b1ef[_0xeb62('0x44')]=qs[_0xeb62('0x58')](_0x4cd99f[_0xeb62('0x3d')]['sort']);_0x10b1ef[_0xeb62('0x45')]=qs[_0xeb62('0x46')](_[_0xeb62('0x47')](_0x4cd99f[_0xeb62('0x3d')],_0x466c3c[_0xeb62('0x46')]));if(_0x4cd99f[_0xeb62('0x3d')][_0xeb62('0x48')]){_0x10b1ef[_0xeb62('0x45')]=_[_0xeb62('0x49')](_0x10b1ef[_0xeb62('0x45')],{'$or':_[_0xeb62('0x37')](_0x10b1ef['attributes'],function(_0x110224){var _0x33419f={};_0x33419f[_0x110224]={'$like':'%'+_0x4cd99f[_0xeb62('0x3d')][_0xeb62('0x48')]+'%'};return _0x33419f;})});}_0x10b1ef=_[_0xeb62('0x49')]({},_0x10b1ef,_0x4cd99f[_0xeb62('0x4b')]);return _0x3a450b[_0xeb62('0x55')](_0x10b1ef);}})[_0xeb62('0x32')](function(_0x1183f4){if(_0x1183f4){_0x46da69=_0x1183f4[_0xeb62('0x43')];if(!_0x4cd99f['query'][_0xeb62('0x59')](_0xeb62('0x5a'))){_0x10b1ef[_0xeb62('0x2d')]=qs[_0xeb62('0x2d')](_0x4cd99f['query'][_0xeb62('0x2d')]);_0x10b1ef[_0xeb62('0x2c')]=qs[_0xeb62('0x2c')](_0x4cd99f[_0xeb62('0x3d')][_0xeb62('0x2c')]);}return _0x3a450b[_0xeb62('0x55')](_0x10b1ef);}})['then'](function(_0x18a348){if(_0x18a348){return _0x18a348?{'count':_0x46da69,'rows':_0x18a348}:null;}})[_0xeb62('0x32')](respondWithResult(_0x2eba52,null))[_0xeb62('0x4c')](handleError(_0x2eba52,null));};exports[_0xeb62('0x5b')]=function(_0x351acf,_0x28d0ff,_0x2e4502){if(_0x351acf[_0xeb62('0x52')]['id']){delete _0x351acf[_0xeb62('0x52')]['id'];}return db[_0xeb62('0x38')][_0xeb62('0x56')]({'where':{'id':_0x351acf[_0xeb62('0x53')]['id']}})[_0xeb62('0x32')](handleEntityNotFound(_0x28d0ff,null))[_0xeb62('0x32')](function(_0xddc862){if(_0xddc862){_0x351acf[_0xeb62('0x52')]['AccountId']=_0xddc862['id'];_0x351acf[_0xeb62('0x52')]['Subjects']=integrations[_0xeb62('0x5c')](_0x351acf[_0xeb62('0x52')]['channel'],_0x351acf[_0xeb62('0x52')][_0xeb62('0x3b')]);_0x351acf[_0xeb62('0x52')][_0xeb62('0x5d')]=integrations[_0xeb62('0x5e')](_0x351acf[_0xeb62('0x52')][_0xeb62('0x5f')],_0x351acf[_0xeb62('0x52')][_0xeb62('0x3b')]);return db[_0xeb62('0x57')][_0xeb62('0x51')](_0x351acf[_0xeb62('0x52')],{'include':[{'model':db[_0xeb62('0x60')],'as':'Subjects'},{'model':db[_0xeb62('0x60')],'as':_0xeb62('0x5d')}]});}return null;})['then'](respondWithResult(_0x28d0ff,null))[_0xeb62('0x4c')](handleError(_0x28d0ff,null));};exports['getFields']=function(_0x32679a,_0x13678d,_0x34e2d1){var _0x10dee9;var _0x44f90e='';var _0x33fbda='Task';return db[_0xeb62('0x38')]['findOne']({'where':{'id':_0x32679a[_0xeb62('0x53')]['id']},'attributes':['id',_0xeb62('0x61'),_0xeb62('0x62'),_0xeb62('0x63'),_0xeb62('0x64'),'password',_0xeb62('0x65')]})[_0xeb62('0x32')](handleEntityNotFound(_0x13678d,null))[_0xeb62('0x32')](function(_0x51c237){if(_0x51c237){_0x44f90e=_0x51c237[_0xeb62('0x61')];var _0x3ad496=_0x44f90e[_0xeb62('0x66')](-0x1);if(_0x3ad496==='/'){_0x44f90e=_0x44f90e[_0xeb62('0x67')](0x0,_0x44f90e[_0xeb62('0x68')](_0x3ad496));}_0x10dee9=new jsforce[(_0xeb62('0x69'))]({'oauth2':{'loginUrl':_0x44f90e,'clientId':_0x51c237['clientId'],'clientSecret':_0x51c237['clientSecret']}});return _0x10dee9['login'](_0x51c237['username'],_0x51c237['password'][_0xeb62('0x6a')](_0x51c237[_0xeb62('0x65')]));}})[_0xeb62('0x32')](function(_0x18ebb6){if(_0x18ebb6){if(!_[_0xeb62('0x6b')](_0x32679a[_0xeb62('0x3d')][_0xeb62('0x6c')])){_0x33fbda=_0x32679a[_0xeb62('0x3d')][_0xeb62('0x6c')];}return _0x10dee9[_0xeb62('0x6d')](_0x33fbda)[_0xeb62('0x6e')]();}})[_0xeb62('0x32')](function(_0x491d2d){var _0x71c47b=[_0xeb62('0x6f'),_0xeb62('0x70'),_0xeb62('0x71'),_0xeb62('0x72'),_0xeb62('0x73'),_0xeb62('0x74'),_0xeb62('0x75'),_0xeb62('0x76')];if(!_[_0xeb62('0x6b')](_0x32679a[_0xeb62('0x3d')][_0xeb62('0x6c')])&&_0x32679a[_0xeb62('0x3d')][_0xeb62('0x6c')]===_0xeb62('0x77')){_0x71c47b=[_0xeb62('0x76'),_0xeb62('0x78'),_0xeb62('0x79'),'Status',_0xeb62('0x74'),'IsEscalated',_0xeb62('0x7a'),_0xeb62('0x7b')];}if(_0x491d2d){_['remove'](_0x491d2d[_0xeb62('0x42')],function(_0x4e3c6c){return _0x4e3c6c['custom']===![]&&!_0x71c47b[_0xeb62('0x7c')](_0x4e3c6c[_0xeb62('0x35')]);});return{'count':_0x491d2d[_0xeb62('0x42')][_0xeb62('0x43')],'rows':_['map'](_0x491d2d[_0xeb62('0x42')],function(_0x252410){return{'id':_0x252410['name'],'name':_0x252410[_0xeb62('0x7d')],'custom':_0x252410[_0xeb62('0x7e')],'options':_0x252410[_0xeb62('0x7f')][_0xeb62('0x43')]>0x0?_[_0xeb62('0x37')](_0x252410[_0xeb62('0x7f')],function(_0x119f9c){return{'name':_0x119f9c[_0xeb62('0x7d')],'value':_0x119f9c['value']};}):_0x252410[_0xeb62('0x3b')]==_0xeb62('0x80')?[{'name':'True','value':_0xeb62('0x81')},{'name':'False','value':'false'}]:[]};})};}})[_0xeb62('0x32')](respondWithResult(_0x13678d,null))[_0xeb62('0x4c')](function(_0x45a1d2){var _0x43b4f3=_0x32679a[_0xeb62('0x3d')]['test']?0x1f4:_0x45a1d2[_0xeb62('0x82')]||0x1f4;logger[_0xeb62('0x25')](_0xeb62('0x83'),_0xeb62('0x84'),_0x43b4f3,JSON[_0xeb62('0x24')](_0x45a1d2));delete _0x45a1d2[_0xeb62('0x35')];if(_0x43b4f3===0x191){_0x43b4f3=0x190;}_0x13678d[_0xeb62('0x29')](_0x43b4f3)[_0xeb62('0x85')](_0x32679a['query']['test']?{'message':_0xeb62('0x86'),'statusCode':_0x45a1d2[_0xeb62('0x82')]}:_0x45a1d2);});}; \ No newline at end of file +var _0x6cb4=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','sendStatus','stack','name','send','map','SalesforceAccount','rawAttributes','fieldName','query','keys','filters','model','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','options','include','findAll','rows','params','fields','includeAll','create','body','find','getConfigurations','order','filter','merge','addConfiguration','findOne','AccountId','getSubjects','channel','SalesforceConfiguration','SalesforceField','Subjects','Descriptions','getFields','Task','remoteUri','clientId','securityToken','slice','substring','Connection','clientSecret','login','concat','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallObject','CallType','Priority','Status','Type','Origin','Reason','SuppliedName','custom','includes','label','value','boolean','true','False','false','test','statusCode','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf'];(function(_0x281cf7,_0x64c7be){var _0x7cf6=function(_0x35a05b){while(--_0x35a05b){_0x281cf7['push'](_0x281cf7['shift']());}};_0x7cf6(++_0x64c7be);}(_0x6cb4,0xff));var _0x46cb=function(_0x5acb3c,_0x49c1bc){_0x5acb3c=_0x5acb3c-0x0;var _0x5c472f=_0x6cb4[_0x5acb3c];return _0x5c472f;};'use strict';var pdf=require(_0x46cb('0x0'));var emlformat=require(_0x46cb('0x1'));var rimraf=require(_0x46cb('0x2'));var zipdir=require(_0x46cb('0x3'));var jsonpatch=require(_0x46cb('0x4'));var rp=require(_0x46cb('0x5'));var moment=require(_0x46cb('0x6'));var BPromise=require(_0x46cb('0x7'));var Mustache=require(_0x46cb('0x8'));var util=require('util');var path=require(_0x46cb('0x9'));var sox=require('sox');var csv=require(_0x46cb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x46cb('0xb'));var squel=require(_0x46cb('0xc'));var crypto=require(_0x46cb('0xd'));var jsforce=require(_0x46cb('0xe'));var deskjs=require(_0x46cb('0xf'));var toCsv=require(_0x46cb('0xa'));var querystring=require('querystring');var Papa=require(_0x46cb('0x10'));var Redis=require(_0x46cb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x46cb('0x12'));var as=require(_0x46cb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46cb('0x14'))(_0x46cb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x46cb('0x16'))['db'];var integrations=require(_0x46cb('0x17'));var jayson=require(_0x46cb('0x18'));var client=jayson[_0x46cb('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8497cd,_0x2ad351,_0x2a1f9d,_0x3c0071){return new BPromise(function(_0x1f7150,_0x32201f){var _0x3d2557=_0x3c0071||client;return _0x3d2557[_0x46cb('0x1a')](_0x8497cd,_0x2a1f9d)[_0x46cb('0x1b')](function(_0x41e398){logger[_0x46cb('0x1c')]('SalesforceAccount,\x20%s,\x20%s',_0x2ad351,_0x46cb('0x1d'));logger['debug'](_0x46cb('0x1e'),_0x2ad351,'request\x20sent',JSON['stringify'](_0x41e398));if(_0x41e398['error']){if(_0x41e398[_0x46cb('0x1f')][_0x46cb('0x20')]===0x1f4){logger[_0x46cb('0x1f')](_0x46cb('0x21'),_0x2ad351,_0x41e398[_0x46cb('0x1f')][_0x46cb('0x22')]);return _0x32201f(_0x41e398[_0x46cb('0x1f')][_0x46cb('0x22')]);}logger[_0x46cb('0x1f')](_0x46cb('0x21'),_0x2ad351,_0x41e398[_0x46cb('0x1f')][_0x46cb('0x22')]);return _0x1f7150(_0x41e398[_0x46cb('0x1f')][_0x46cb('0x22')]);}else{logger[_0x46cb('0x1c')](_0x46cb('0x21'),_0x2ad351,_0x46cb('0x1d'));_0x1f7150(_0x41e398[_0x46cb('0x23')][_0x46cb('0x22')]);}})[_0x46cb('0x24')](function(_0x32a59b){logger[_0x46cb('0x1f')](_0x46cb('0x21'),_0x2ad351,_0x32a59b);_0x32201f(_0x32a59b);});});}function respondWithStatusCode(_0xadcad6,_0x40e0e5){_0x40e0e5=_0x40e0e5||0xcc;return function(_0x5a1338){if(_0x5a1338){return _0xadcad6['sendStatus'](_0x40e0e5);}return _0xadcad6[_0x46cb('0x25')](_0x40e0e5)[_0x46cb('0x26')]();};}function respondWithResult(_0x2711ac,_0xe078a8){_0xe078a8=_0xe078a8||0xc8;return function(_0x6e6d9){if(_0x6e6d9){return _0x2711ac['status'](_0xe078a8)[_0x46cb('0x27')](_0x6e6d9);}};}function respondWithFilteredResult(_0x578ffd,_0x495886){return function(_0x544465){if(_0x544465){var _0x180ce1=_0x544465[_0x46cb('0x28')],_0x119bf6=_0x495886[_0x46cb('0x29')],_0x2242e7=_0x495886[_0x46cb('0x29')]+_0x495886[_0x46cb('0x2a')],_0xc1efd3;if(_0x2242e7>=_0x180ce1){_0x2242e7=_0x180ce1;_0xc1efd3=0xc8;}else{_0xc1efd3=0xce;}_0x578ffd[_0x46cb('0x25')](_0xc1efd3);return _0x578ffd[_0x46cb('0x2b')](_0x46cb('0x2c'),_0x119bf6+'-'+_0x2242e7+'/'+_0x180ce1)['json'](_0x544465);}return null;};}function patchUpdates(_0x1ce88f){return function(_0xf3d376){try{jsonpatch['apply'](_0xf3d376,_0x1ce88f,!![]);}catch(_0x49e0bc){return BPromise[_0x46cb('0x2d')](_0x49e0bc);}return _0xf3d376['save']();};}function saveUpdates(_0x27c22d,_0x6f7953){return function(_0xe7c112){if(_0xe7c112){return _0xe7c112[_0x46cb('0x2e')](_0x27c22d)[_0x46cb('0x1b')](function(_0x33c248){return _0x33c248;});}return null;};}function removeEntity(_0x5dc551,_0x2e2d36){return function(_0x49ffc5){if(_0x49ffc5){return _0x49ffc5[_0x46cb('0x2f')]()[_0x46cb('0x1b')](function(){_0x5dc551['status'](0xcc)[_0x46cb('0x26')]();});}};}function handleEntityNotFound(_0x3f0eb4,_0x2cc99d){return function(_0xabf97c){if(!_0xabf97c){_0x3f0eb4[_0x46cb('0x30')](0x194);}return _0xabf97c;};}function handleError(_0x570144,_0x430fa3){_0x430fa3=_0x430fa3||0x1f4;return function(_0x49f80a){logger[_0x46cb('0x1f')](_0x49f80a[_0x46cb('0x31')]);if(_0x49f80a[_0x46cb('0x32')]){delete _0x49f80a['name'];}_0x570144[_0x46cb('0x25')](_0x430fa3)[_0x46cb('0x33')](_0x49f80a);};}exports['index']=function(_0x19421c,_0xf8be9){var _0x3ba467={},_0x2e0375={},_0x25be2d={'count':0x0,'rows':[]};var _0x11077c=_[_0x46cb('0x34')](db[_0x46cb('0x35')][_0x46cb('0x36')],function(_0xe4504e){return{'name':_0xe4504e[_0x46cb('0x37')],'type':_0xe4504e['type']['key']};});_0x2e0375['model']=_[_0x46cb('0x34')](_0x11077c,_0x46cb('0x32'));_0x2e0375[_0x46cb('0x38')]=_[_0x46cb('0x39')](_0x19421c[_0x46cb('0x38')]);_0x2e0375[_0x46cb('0x3a')]=_['intersection'](_0x2e0375[_0x46cb('0x3b')],_0x2e0375['query']);_0x3ba467['attributes']=_[_0x46cb('0x3c')](_0x2e0375['model'],qs['fields'](_0x19421c[_0x46cb('0x38')]['fields']));_0x3ba467['attributes']=_0x3ba467[_0x46cb('0x3d')][_0x46cb('0x3e')]?_0x3ba467[_0x46cb('0x3d')]:_0x2e0375[_0x46cb('0x3b')];if(!_0x19421c[_0x46cb('0x38')][_0x46cb('0x3f')](_0x46cb('0x40'))){_0x3ba467['limit']=qs[_0x46cb('0x2a')](_0x19421c['query'][_0x46cb('0x2a')]);_0x3ba467['offset']=qs[_0x46cb('0x29')](_0x19421c[_0x46cb('0x38')][_0x46cb('0x29')]);}_0x3ba467['order']=qs[_0x46cb('0x41')](_0x19421c[_0x46cb('0x38')]['sort']);_0x3ba467[_0x46cb('0x42')]=qs[_0x46cb('0x3a')](_[_0x46cb('0x43')](_0x19421c[_0x46cb('0x38')],_0x2e0375[_0x46cb('0x3a')]),_0x11077c);if(_0x19421c['query']['filter']){_0x3ba467[_0x46cb('0x42')]=_['merge'](_0x3ba467[_0x46cb('0x42')],{'$or':_[_0x46cb('0x34')](_0x11077c,function(_0x563e9b){if(_0x563e9b[_0x46cb('0x44')]!==_0x46cb('0x45')){var _0x46ca86={};_0x46ca86[_0x563e9b['name']]={'$like':'%'+_0x19421c['query']['filter']+'%'};return _0x46ca86;}})});}_0x3ba467=_['merge']({},_0x3ba467,_0x19421c[_0x46cb('0x46')]);var _0x23dd2e={'where':_0x3ba467[_0x46cb('0x42')]};return db[_0x46cb('0x35')][_0x46cb('0x28')](_0x23dd2e)['then'](function(_0x4becfa){_0x25be2d[_0x46cb('0x28')]=_0x4becfa;if(_0x19421c[_0x46cb('0x38')]['includeAll']){_0x3ba467[_0x46cb('0x47')]=[{'all':!![]}];}return db[_0x46cb('0x35')][_0x46cb('0x48')](_0x3ba467);})[_0x46cb('0x1b')](function(_0x189809){_0x25be2d[_0x46cb('0x49')]=_0x189809;return _0x25be2d;})[_0x46cb('0x1b')](respondWithFilteredResult(_0xf8be9,_0x3ba467))['catch'](handleError(_0xf8be9,null));};exports['show']=function(_0x449593,_0x52ed52){var _0x2c4ecb={'raw':![],'where':{'id':_0x449593[_0x46cb('0x4a')]['id']}},_0x44989a={};_0x44989a['model']=_[_0x46cb('0x39')](db['SalesforceAccount']['rawAttributes']);_0x44989a[_0x46cb('0x38')]=_[_0x46cb('0x39')](_0x449593[_0x46cb('0x38')]);_0x44989a[_0x46cb('0x3a')]=_[_0x46cb('0x3c')](_0x44989a[_0x46cb('0x3b')],_0x44989a[_0x46cb('0x38')]);_0x2c4ecb['attributes']=_['intersection'](_0x44989a[_0x46cb('0x3b')],qs[_0x46cb('0x4b')](_0x449593['query'][_0x46cb('0x4b')]));_0x2c4ecb[_0x46cb('0x3d')]=_0x2c4ecb[_0x46cb('0x3d')][_0x46cb('0x3e')]?_0x2c4ecb[_0x46cb('0x3d')]:_0x44989a['model'];if(_0x449593[_0x46cb('0x38')][_0x46cb('0x4c')]){_0x2c4ecb[_0x46cb('0x47')]=[{'all':!![]}];}_0x2c4ecb=_['merge']({},_0x2c4ecb,_0x449593[_0x46cb('0x46')]);return db['SalesforceAccount']['find'](_0x2c4ecb)[_0x46cb('0x1b')](handleEntityNotFound(_0x52ed52,null))[_0x46cb('0x1b')](respondWithResult(_0x52ed52,null))[_0x46cb('0x24')](handleError(_0x52ed52,null));};exports[_0x46cb('0x4d')]=function(_0x2848b8,_0x4d2a39){return db[_0x46cb('0x35')][_0x46cb('0x4d')](_0x2848b8['body'],{})['then'](respondWithResult(_0x4d2a39,0xc9))[_0x46cb('0x24')](handleError(_0x4d2a39,null));};exports[_0x46cb('0x2e')]=function(_0x108e57,_0x5c2190){if(_0x108e57[_0x46cb('0x4e')]['id']){delete _0x108e57[_0x46cb('0x4e')]['id'];}return db[_0x46cb('0x35')][_0x46cb('0x4f')]({'where':{'id':_0x108e57[_0x46cb('0x4a')]['id']}})[_0x46cb('0x1b')](handleEntityNotFound(_0x5c2190,null))[_0x46cb('0x1b')](saveUpdates(_0x108e57[_0x46cb('0x4e')],null))[_0x46cb('0x1b')](respondWithResult(_0x5c2190,null))['catch'](handleError(_0x5c2190,null));};exports[_0x46cb('0x2f')]=function(_0x5470b0,_0xc8894f){return db[_0x46cb('0x35')][_0x46cb('0x4f')]({'where':{'id':_0x5470b0[_0x46cb('0x4a')]['id']}})['then'](handleEntityNotFound(_0xc8894f,null))[_0x46cb('0x1b')](removeEntity(_0xc8894f,null))[_0x46cb('0x24')](handleError(_0xc8894f,null));};exports[_0x46cb('0x50')]=function(_0x27b215,_0x2ab8e5,_0x28ebe2){var _0x2b0799={};var _0x2e55f4={};var _0x57c29b;var _0x4a0606;return db['SalesforceAccount']['findOne']({'where':{'id':_0x27b215[_0x46cb('0x4a')]['id']}})[_0x46cb('0x1b')](handleEntityNotFound(_0x2ab8e5,null))['then'](function(_0x429b39){if(_0x429b39){_0x57c29b=_0x429b39;_0x2e55f4[_0x46cb('0x3b')]=_[_0x46cb('0x39')](db['SalesforceConfiguration']['rawAttributes']);_0x2e55f4[_0x46cb('0x38')]=_['keys'](_0x27b215[_0x46cb('0x38')]);_0x2e55f4[_0x46cb('0x3a')]=_[_0x46cb('0x3c')](_0x2e55f4[_0x46cb('0x3b')],_0x2e55f4[_0x46cb('0x38')]);_0x2b0799[_0x46cb('0x3d')]=_[_0x46cb('0x3c')](_0x2e55f4[_0x46cb('0x3b')],qs[_0x46cb('0x4b')](_0x27b215[_0x46cb('0x38')][_0x46cb('0x4b')]));_0x2b0799[_0x46cb('0x3d')]=_0x2b0799[_0x46cb('0x3d')]['length']?_0x2b0799[_0x46cb('0x3d')]:_0x2e55f4['model'];_0x2b0799[_0x46cb('0x51')]=qs[_0x46cb('0x41')](_0x27b215[_0x46cb('0x38')][_0x46cb('0x41')]);_0x2b0799[_0x46cb('0x42')]=qs[_0x46cb('0x3a')](_[_0x46cb('0x43')](_0x27b215['query'],_0x2e55f4[_0x46cb('0x3a')]));if(_0x27b215[_0x46cb('0x38')][_0x46cb('0x52')]){_0x2b0799[_0x46cb('0x42')]=_['merge'](_0x2b0799[_0x46cb('0x42')],{'$or':_[_0x46cb('0x34')](_0x2b0799[_0x46cb('0x3d')],function(_0x1b810a){var _0x442243={};_0x442243[_0x1b810a]={'$like':'%'+_0x27b215['query'][_0x46cb('0x52')]+'%'};return _0x442243;})});}_0x2b0799=_[_0x46cb('0x53')]({},_0x2b0799,_0x27b215[_0x46cb('0x46')]);return _0x57c29b[_0x46cb('0x50')](_0x2b0799);}})[_0x46cb('0x1b')](function(_0x1938e6){if(_0x1938e6){_0x4a0606=_0x1938e6[_0x46cb('0x3e')];if(!_0x27b215[_0x46cb('0x38')]['hasOwnProperty']('nolimit')){_0x2b0799['limit']=qs[_0x46cb('0x2a')](_0x27b215[_0x46cb('0x38')][_0x46cb('0x2a')]);_0x2b0799[_0x46cb('0x29')]=qs[_0x46cb('0x29')](_0x27b215[_0x46cb('0x38')][_0x46cb('0x29')]);}return _0x57c29b[_0x46cb('0x50')](_0x2b0799);}})[_0x46cb('0x1b')](function(_0x408f2a){if(_0x408f2a){return _0x408f2a?{'count':_0x4a0606,'rows':_0x408f2a}:null;}})[_0x46cb('0x1b')](respondWithResult(_0x2ab8e5,null))[_0x46cb('0x24')](handleError(_0x2ab8e5,null));};exports[_0x46cb('0x54')]=function(_0x2ea5d0,_0x5c9f3c,_0x2e23e4){if(_0x2ea5d0['body']['id']){delete _0x2ea5d0[_0x46cb('0x4e')]['id'];}return db['SalesforceAccount'][_0x46cb('0x55')]({'where':{'id':_0x2ea5d0[_0x46cb('0x4a')]['id']}})[_0x46cb('0x1b')](handleEntityNotFound(_0x5c9f3c,null))[_0x46cb('0x1b')](function(_0x585e10){if(_0x585e10){_0x2ea5d0[_0x46cb('0x4e')][_0x46cb('0x56')]=_0x585e10['id'];_0x2ea5d0['body']['Subjects']=integrations[_0x46cb('0x57')](_0x2ea5d0[_0x46cb('0x4e')][_0x46cb('0x58')],_0x2ea5d0[_0x46cb('0x4e')][_0x46cb('0x44')]);_0x2ea5d0['body']['Descriptions']=integrations['getDescriptions'](_0x2ea5d0[_0x46cb('0x4e')][_0x46cb('0x58')],_0x2ea5d0[_0x46cb('0x4e')][_0x46cb('0x44')]);return db[_0x46cb('0x59')][_0x46cb('0x4d')](_0x2ea5d0[_0x46cb('0x4e')],{'include':[{'model':db[_0x46cb('0x5a')],'as':_0x46cb('0x5b')},{'model':db[_0x46cb('0x5a')],'as':_0x46cb('0x5c')}]});}return null;})['then'](respondWithResult(_0x5c9f3c,null))[_0x46cb('0x24')](handleError(_0x5c9f3c,null));};exports[_0x46cb('0x5d')]=function(_0x84534,_0x386956,_0x5a7f64){var _0xc159ff;var _0x4406e1='';var _0x2d5006=_0x46cb('0x5e');return db['SalesforceAccount'][_0x46cb('0x55')]({'where':{'id':_0x84534[_0x46cb('0x4a')]['id']},'attributes':['id',_0x46cb('0x5f'),_0x46cb('0x60'),'clientSecret','username','password',_0x46cb('0x61')]})['then'](handleEntityNotFound(_0x386956,null))[_0x46cb('0x1b')](function(_0x5e20e1){if(_0x5e20e1){_0x4406e1=_0x5e20e1[_0x46cb('0x5f')];var _0x36a82b=_0x4406e1[_0x46cb('0x62')](-0x1);if(_0x36a82b==='/'){_0x4406e1=_0x4406e1[_0x46cb('0x63')](0x0,_0x4406e1['lastIndexOf'](_0x36a82b));}_0xc159ff=new jsforce[(_0x46cb('0x64'))]({'oauth2':{'loginUrl':_0x4406e1,'clientId':_0x5e20e1[_0x46cb('0x60')],'clientSecret':_0x5e20e1[_0x46cb('0x65')]}});return _0xc159ff[_0x46cb('0x66')](_0x5e20e1['username'],_0x5e20e1['password'][_0x46cb('0x67')](_0x5e20e1[_0x46cb('0x61')]));}})[_0x46cb('0x1b')](function(_0x3cf616){if(_0x3cf616){if(!_[_0x46cb('0x68')](_0x84534[_0x46cb('0x38')]['ticketType'])){_0x2d5006=_0x84534['query'][_0x46cb('0x69')];}return _0xc159ff[_0x46cb('0x6a')](_0x2d5006)['describe']();}})[_0x46cb('0x1b')](function(_0x355041){var _0x20c41d=[_0x46cb('0x6b'),_0x46cb('0x6c'),_0x46cb('0x6d'),_0x46cb('0x6e'),'IsArchived',_0x46cb('0x6f'),_0x46cb('0x70'),_0x46cb('0x71')];if(!_[_0x46cb('0x68')](_0x84534[_0x46cb('0x38')][_0x46cb('0x69')])&&_0x84534[_0x46cb('0x38')][_0x46cb('0x69')]==='Case'){_0x20c41d=['Type',_0x46cb('0x72'),_0x46cb('0x73'),_0x46cb('0x70'),_0x46cb('0x6f'),'IsEscalated',_0x46cb('0x74'),'SuppliedCompany'];}if(_0x355041){_['remove'](_0x355041[_0x46cb('0x4b')],function(_0x3bef5a){return _0x3bef5a[_0x46cb('0x75')]===![]&&!_0x20c41d[_0x46cb('0x76')](_0x3bef5a['name']);});return{'count':_0x355041[_0x46cb('0x4b')]['length'],'rows':_[_0x46cb('0x34')](_0x355041[_0x46cb('0x4b')],function(_0x12054f){return{'id':_0x12054f[_0x46cb('0x32')],'name':_0x12054f[_0x46cb('0x77')],'custom':_0x12054f[_0x46cb('0x75')],'options':_0x12054f['picklistValues']['length']>0x0?_[_0x46cb('0x34')](_0x12054f['picklistValues'],function(_0x29a5da){return{'name':_0x29a5da['label'],'value':_0x29a5da[_0x46cb('0x78')]};}):_0x12054f[_0x46cb('0x44')]==_0x46cb('0x79')?[{'name':'True','value':_0x46cb('0x7a')},{'name':_0x46cb('0x7b'),'value':_0x46cb('0x7c')}]:[]};})};}})[_0x46cb('0x1b')](respondWithResult(_0x386956,null))[_0x46cb('0x24')](function(_0x3968f7){var _0x22b10d=_0x84534[_0x46cb('0x38')][_0x46cb('0x7d')]?0x1f4:_0x3968f7[_0x46cb('0x7e')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x46cb('0x5d'),_0x22b10d,JSON[_0x46cb('0x7f')](_0x3968f7));delete _0x3968f7['name'];if(_0x22b10d===0x191){_0x22b10d=0x190;}_0x386956[_0x46cb('0x25')](_0x22b10d)['send'](_0x84534['query'][_0x46cb('0x7d')]?{'message':_0x46cb('0x80'),'statusCode':_0x3968f7['statusCode']}:_0x3968f7);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 98f5aad..1b6b1f5 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 _0x1fc5=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0x523f32,_0x42594a){var _0x183aba=function(_0x1ae751){while(--_0x1ae751){_0x523f32['push'](_0x523f32['shift']());}};_0x183aba(++_0x42594a);}(_0x1fc5,0x189));var _0x51fc=function(_0x359099,_0x3f911d){_0x359099=_0x359099-0x0;var _0xf3478=_0x1fc5[_0x359099];return _0xf3478;};'use strict';var _=require(_0x51fc('0x0'));var util=require(_0x51fc('0x1'));var logger=require(_0x51fc('0x2'))(_0x51fc('0x3'));var moment=require('moment');var BPromise=require(_0x51fc('0x4'));var rp=require(_0x51fc('0x5'));var fs=require('fs');var path=require(_0x51fc('0x6'));var rimraf=require(_0x51fc('0x7'));var config=require(_0x51fc('0x8'));var attributes=require(_0x51fc('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3e6693,_0xc2c4e7){return _0x3e6693['define'](_0x51fc('0xa'),attributes,{'tableName':_0x51fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f61=['../../config/logger','api','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util'];(function(_0x4a5d4f,_0x1fbaf6){var _0x18f13c=function(_0x3c2ec9){while(--_0x3c2ec9){_0x4a5d4f['push'](_0x4a5d4f['shift']());}};_0x18f13c(++_0x1fbaf6);}(_0x7f61,0x73));var _0x17f6=function(_0x1f8993,_0x37d8ae){_0x1f8993=_0x1f8993-0x0;var _0x455c7f=_0x7f61[_0x1f8993];return _0x455c7f;};'use strict';var _=require(_0x17f6('0x0'));var util=require(_0x17f6('0x1'));var logger=require(_0x17f6('0x2'))(_0x17f6('0x3'));var moment=require('moment');var BPromise=require(_0x17f6('0x4'));var rp=require(_0x17f6('0x5'));var fs=require('fs');var path=require(_0x17f6('0x6'));var rimraf=require(_0x17f6('0x7'));var config=require('../../config/environment');var attributes=require(_0x17f6('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x17f6('0x9')]=function(_0x143fe5,_0x44b332){return _0x143fe5[_0x17f6('0xa')](_0x17f6('0xb'),attributes,{'tableName':_0x17f6('0xc'),'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 b499e65..f9ad8a0 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 _0x222f=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','include','map','model','debug','find','where','ShowSalesforceAccount'];(function(_0x260ce2,_0x2e22b8){var _0x16b105=function(_0x260a06){while(--_0x260a06){_0x260ce2['push'](_0x260ce2['shift']());}};_0x16b105(++_0x2e22b8);}(_0x222f,0x1a4));var _0xf222=function(_0x9b14ee,_0x574340){_0x9b14ee=_0x9b14ee-0x0;var _0xc3fa3c=_0x222f[_0x9b14ee];return _0xc3fa3c;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var moment=require(_0xf222('0x2'));var BPromise=require(_0xf222('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf222('0x4'))['db'];var utils=require(_0xf222('0x5'));var logger=require(_0xf222('0x6'))(_0xf222('0x7'));var config=require('../../config/environment');var jayson=require(_0xf222('0x8'));var client=jayson['client'][_0xf222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f129,_0x518ebb,_0xf5a105){return new BPromise(function(_0x302d7a,_0x4aceb4){return client[_0xf222('0xa')](_0x26f129,_0xf5a105)[_0xf222('0xb')](function(_0x878804){logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));logger['debug'](_0xf222('0xf'),_0x518ebb,_0xf222('0xe'),JSON[_0xf222('0x10')](_0x878804));if(_0x878804[_0xf222('0x11')]){if(_0x878804['error'][_0xf222('0x12')]===0x1f4){logger[_0xf222('0x11')](_0xf222('0xd'),_0x518ebb,_0x878804[_0xf222('0x11')][_0xf222('0x13')]);return _0x4aceb4(_0x878804[_0xf222('0x11')][_0xf222('0x13')]);}logger[_0xf222('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x518ebb,_0x878804['error'][_0xf222('0x13')]);return _0x302d7a(_0x878804[_0xf222('0x11')]['message']);}else{logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));_0x302d7a(_0x878804[_0xf222('0x14')][_0xf222('0x13')]);}})[_0xf222('0x15')](function(_0x30b646){logger['error'](_0xf222('0xd'),_0x518ebb,_0x30b646);_0x4aceb4(_0x30b646);});});}exports[_0xf222('0x16')]=function(_0x8783ab){var _0xfb4ddf=this;return new Promise(function(_0x12a2e4,_0x1e57ee){return db[_0xf222('0x17')]['findAll']({'raw':_0x8783ab[_0xf222('0x18')]?_0x8783ab[_0xf222('0x18')][_0xf222('0x19')]===undefined?!![]:![]:!![],'where':_0x8783ab[_0xf222('0x18')]?_0x8783ab['options']['where']||null:null,'attributes':_0x8783ab[_0xf222('0x18')]?_0x8783ab[_0xf222('0x18')][_0xf222('0x1a')]||null:null,'limit':_0x8783ab[_0xf222('0x18')]?_0x8783ab[_0xf222('0x18')][_0xf222('0x1b')]||null:null,'include':_0x8783ab['options']?_0x8783ab[_0xf222('0x18')][_0xf222('0x1c')]?_[_0xf222('0x1d')](_0x8783ab[_0xf222('0x18')][_0xf222('0x1c')],function(_0x2d18ab){return{'model':db[_0x2d18ab[_0xf222('0x1e')]],'as':_0x2d18ab['as'],'attributes':_0x2d18ab[_0xf222('0x1a')],'include':_0x2d18ab['include']?_[_0xf222('0x1d')](_0x2d18ab[_0xf222('0x1c')],function(_0x1883c1){return{'model':db[_0x1883c1[_0xf222('0x1e')]],'as':_0x1883c1['as'],'attributes':_0x1883c1[_0xf222('0x1a')],'include':_0x1883c1[_0xf222('0x1c')]?_[_0xf222('0x1d')](_0x1883c1[_0xf222('0x1c')],function(_0x15bf4e){return{'model':db[_0x15bf4e[_0xf222('0x1e')]],'as':_0x15bf4e['as'],'attributes':_0x15bf4e[_0xf222('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14b2b1){logger[_0xf222('0xc')](_0xf222('0x16'),_0x8783ab);logger[_0xf222('0x1f')](_0xf222('0x16'),_0x8783ab,JSON[_0xf222('0x10')](_0x14b2b1));_0x12a2e4(_0x14b2b1);})[_0xf222('0x15')](function(_0x1b928b){logger[_0xf222('0x11')]('GetSalesforceAccount',_0x1b928b[_0xf222('0x13')],_0x8783ab);_0x1e57ee(_0xfb4ddf[_0xf222('0x11')](0x1f4,_0x1b928b[_0xf222('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x3ccc9e){var _0x5d5963=this;return new Promise(function(_0x40c7e7,_0x27a8cc){return db[_0xf222('0x17')][_0xf222('0x20')]({'raw':_0x3ccc9e[_0xf222('0x18')]?_0x3ccc9e[_0xf222('0x18')][_0xf222('0x19')]===undefined?!![]:![]:!![],'where':_0x3ccc9e['options']?_0x3ccc9e['options'][_0xf222('0x21')]||null:null,'attributes':_0x3ccc9e[_0xf222('0x18')]?_0x3ccc9e[_0xf222('0x18')][_0xf222('0x1a')]||null:null,'include':_0x3ccc9e[_0xf222('0x18')]?_0x3ccc9e[_0xf222('0x18')]['include']?_[_0xf222('0x1d')](_0x3ccc9e[_0xf222('0x18')][_0xf222('0x1c')],function(_0x57c862){return{'model':db[_0x57c862[_0xf222('0x1e')]],'as':_0x57c862['as'],'attributes':_0x57c862[_0xf222('0x1a')],'include':_0x57c862[_0xf222('0x1c')]?_['map'](_0x57c862[_0xf222('0x1c')],function(_0x21e20a){return{'model':db[_0x21e20a[_0xf222('0x1e')]],'as':_0x21e20a['as'],'attributes':_0x21e20a['attributes'],'include':_0x21e20a[_0xf222('0x1c')]?_[_0xf222('0x1d')](_0x21e20a[_0xf222('0x1c')],function(_0x2b838c){return{'model':db[_0x2b838c[_0xf222('0x1e')]],'as':_0x2b838c['as'],'attributes':_0x2b838c['attributes']};}):[]};}):[]};}):[]:[]})[_0xf222('0xb')](function(_0x542123){logger[_0xf222('0xc')](_0xf222('0x22'),_0x3ccc9e);logger[_0xf222('0x1f')]('ShowSalesforceAccount',_0x3ccc9e,JSON[_0xf222('0x10')](_0x542123));_0x40c7e7(_0x542123);})[_0xf222('0x15')](function(_0x54a10d){logger[_0xf222('0x11')]('ShowSalesforceAccount',_0x54a10d[_0xf222('0x13')],_0x3ccc9e);_0x27a8cc(_0x5d5963[_0xf222('0x11')](0x1f4,_0x54a10d[_0xf222('0x13')]));});});}; \ No newline at end of file +var _0xd64b=['include','map','model','then','ShowSalesforceAccount','find','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','where','attributes'];(function(_0x4ecbba,_0x3c366f){var _0x569384=function(_0x38a8a5){while(--_0x38a8a5){_0x4ecbba['push'](_0x4ecbba['shift']());}};_0x569384(++_0x3c366f);}(_0xd64b,0xc1));var _0xbd64=function(_0x574e54,_0x2c5784){_0x574e54=_0x574e54-0x0;var _0x581fc5=_0xd64b[_0x574e54];return _0x581fc5;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var moment=require(_0xbd64('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd64('0x2'));var fs=require('fs');var Redis=require(_0xbd64('0x3'));var db=require(_0xbd64('0x4'))['db'];var utils=require(_0xbd64('0x5'));var logger=require(_0xbd64('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbd64('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x32995f,_0x3e700e,_0x38204e){return new BPromise(function(_0x3f1f17,_0x2b8543){return client[_0xbd64('0x8')](_0x32995f,_0x38204e)['then'](function(_0x5ae70c){logger[_0xbd64('0x9')](_0xbd64('0xa'),_0x3e700e,_0xbd64('0xb'));logger['debug'](_0xbd64('0xc'),_0x3e700e,_0xbd64('0xb'),JSON[_0xbd64('0xd')](_0x5ae70c));if(_0x5ae70c[_0xbd64('0xe')]){if(_0x5ae70c['error'][_0xbd64('0xf')]===0x1f4){logger['error'](_0xbd64('0xa'),_0x3e700e,_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);return _0x2b8543(_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);}logger[_0xbd64('0xe')](_0xbd64('0xa'),_0x3e700e,_0x5ae70c[_0xbd64('0xe')][_0xbd64('0x10')]);return _0x3f1f17(_0x5ae70c['error'][_0xbd64('0x10')]);}else{logger[_0xbd64('0x9')](_0xbd64('0xa'),_0x3e700e,_0xbd64('0xb'));_0x3f1f17(_0x5ae70c[_0xbd64('0x11')]['message']);}})[_0xbd64('0x12')](function(_0x5332e0){logger[_0xbd64('0xe')](_0xbd64('0xa'),_0x3e700e,_0x5332e0);_0x2b8543(_0x5332e0);});});}exports[_0xbd64('0x13')]=function(_0x1d7a14){var _0x17d015=this;return new Promise(function(_0x2f4554,_0xa5491d){return db[_0xbd64('0x14')]['findAll']({'raw':_0x1d7a14[_0xbd64('0x15')]?_0x1d7a14[_0xbd64('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1d7a14['options']?_0x1d7a14[_0xbd64('0x15')][_0xbd64('0x16')]||null:null,'attributes':_0x1d7a14[_0xbd64('0x15')]?_0x1d7a14[_0xbd64('0x15')][_0xbd64('0x17')]||null:null,'limit':_0x1d7a14[_0xbd64('0x15')]?_0x1d7a14['options']['limit']||null:null,'include':_0x1d7a14[_0xbd64('0x15')]?_0x1d7a14[_0xbd64('0x15')][_0xbd64('0x18')]?_[_0xbd64('0x19')](_0x1d7a14['options']['include'],function(_0x28497c){return{'model':db[_0x28497c['model']],'as':_0x28497c['as'],'attributes':_0x28497c[_0xbd64('0x17')],'include':_0x28497c['include']?_[_0xbd64('0x19')](_0x28497c[_0xbd64('0x18')],function(_0x3d12a0){return{'model':db[_0x3d12a0[_0xbd64('0x1a')]],'as':_0x3d12a0['as'],'attributes':_0x3d12a0['attributes'],'include':_0x3d12a0[_0xbd64('0x18')]?_[_0xbd64('0x19')](_0x3d12a0[_0xbd64('0x18')],function(_0x2a44d0){return{'model':db[_0x2a44d0['model']],'as':_0x2a44d0['as'],'attributes':_0x2a44d0['attributes']};}):[]};}):[]};}):[]:[]})[_0xbd64('0x1b')](function(_0x49eac5){logger['info'](_0xbd64('0x13'),_0x1d7a14);logger['debug'](_0xbd64('0x13'),_0x1d7a14,JSON['stringify'](_0x49eac5));_0x2f4554(_0x49eac5);})[_0xbd64('0x12')](function(_0x5d8c35){logger[_0xbd64('0xe')](_0xbd64('0x13'),_0x5d8c35[_0xbd64('0x10')],_0x1d7a14);_0xa5491d(_0x17d015[_0xbd64('0xe')](0x1f4,_0x5d8c35[_0xbd64('0x10')]));});});};exports[_0xbd64('0x1c')]=function(_0x4ed44a){var _0x35bdd5=this;return new Promise(function(_0xe876c9,_0xc44280){return db[_0xbd64('0x14')][_0xbd64('0x1d')]({'raw':_0x4ed44a[_0xbd64('0x15')]?_0x4ed44a['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ed44a[_0xbd64('0x15')]?_0x4ed44a['options'][_0xbd64('0x16')]||null:null,'attributes':_0x4ed44a[_0xbd64('0x15')]?_0x4ed44a['options']['attributes']||null:null,'include':_0x4ed44a[_0xbd64('0x15')]?_0x4ed44a['options']['include']?_[_0xbd64('0x19')](_0x4ed44a[_0xbd64('0x15')][_0xbd64('0x18')],function(_0x50c58e){return{'model':db[_0x50c58e[_0xbd64('0x1a')]],'as':_0x50c58e['as'],'attributes':_0x50c58e['attributes'],'include':_0x50c58e[_0xbd64('0x18')]?_[_0xbd64('0x19')](_0x50c58e[_0xbd64('0x18')],function(_0x243588){return{'model':db[_0x243588[_0xbd64('0x1a')]],'as':_0x243588['as'],'attributes':_0x243588[_0xbd64('0x17')],'include':_0x243588['include']?_['map'](_0x243588[_0xbd64('0x18')],function(_0x2be110){return{'model':db[_0x2be110[_0xbd64('0x1a')]],'as':_0x2be110['as'],'attributes':_0x2be110[_0xbd64('0x17')]};}):[]};}):[]};}):[]:[]})[_0xbd64('0x1b')](function(_0x3b245e){logger['info']('ShowSalesforceAccount',_0x4ed44a);logger[_0xbd64('0x1e')](_0xbd64('0x1c'),_0x4ed44a,JSON[_0xbd64('0xd')](_0x3b245e));_0xe876c9(_0x3b245e);})['catch'](function(_0x5afe9b){logger[_0xbd64('0xe')]('ShowSalesforceAccount',_0x5afe9b[_0xbd64('0x10')],_0x4ed44a);_0xc44280(_0x35bdd5['error'](0x1f4,_0x5afe9b[_0xbd64('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 8ed8ec6..5fae125 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 _0x0d4f=['getDescriptions','create','put','update','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x18d7fc,_0x5c9ab1){var _0x58214b=function(_0x42e5b1){while(--_0x42e5b1){_0x18d7fc['push'](_0x18d7fc['shift']());}};_0x58214b(++_0x5c9ab1);}(_0x0d4f,0x150));var _0xf0d4=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x0d4f[_0x521929];return _0x632436;};'use strict';var multer=require(_0xf0d4('0x0'));var util=require(_0xf0d4('0x1'));var path=require(_0xf0d4('0x2'));var timeout=require(_0xf0d4('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xf0d4('0x4'));var interaction=require(_0xf0d4('0x5'));var config=require('../../config/environment');var controller=require(_0xf0d4('0x6'));router['get']('/',auth[_0xf0d4('0x7')](),controller['index']);router[_0xf0d4('0x8')](_0xf0d4('0x9'),auth[_0xf0d4('0x7')](),controller[_0xf0d4('0xa')]);router[_0xf0d4('0x8')](_0xf0d4('0xb'),auth[_0xf0d4('0x7')](),controller[_0xf0d4('0xc')]);router[_0xf0d4('0x8')](_0xf0d4('0xd'),auth[_0xf0d4('0x7')](),controller[_0xf0d4('0xe')]);router[_0xf0d4('0x8')](_0xf0d4('0xf'),auth[_0xf0d4('0x7')](),controller[_0xf0d4('0x10')]);router['post']('/',auth[_0xf0d4('0x7')](),controller[_0xf0d4('0x11')]);router[_0xf0d4('0x12')](_0xf0d4('0x9'),auth[_0xf0d4('0x7')](),controller[_0xf0d4('0x13')]);router[_0xf0d4('0x14')](_0xf0d4('0x9'),auth['isAuthenticated'](),controller[_0xf0d4('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb071=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','/:id','update','destroy','exports','multer','util'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0xb071,0xda));var _0x1b07=function(_0x5f1456,_0x3f70da){_0x5f1456=_0x5f1456-0x0;var _0x4b6fd5=_0xb071[_0x5f1456];return _0x4b6fd5;};'use strict';var multer=require(_0x1b07('0x0'));var util=require(_0x1b07('0x1'));var path=require('path');var timeout=require(_0x1b07('0x2'));var express=require(_0x1b07('0x3'));var router=express[_0x1b07('0x4')]();var auth=require(_0x1b07('0x5'));var interaction=require(_0x1b07('0x6'));var config=require('../../config/environment');var controller=require('./intSalesforceConfiguration.controller');router[_0x1b07('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1b07('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x1b07('0x8')]);router[_0x1b07('0x7')](_0x1b07('0x9'),auth[_0x1b07('0xa')](),controller[_0x1b07('0xb')]);router[_0x1b07('0x7')](_0x1b07('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x1b07('0x7')](_0x1b07('0xd'),auth[_0x1b07('0xa')](),controller[_0x1b07('0xe')]);router['post']('/',auth[_0x1b07('0xa')](),controller['create']);router[_0x1b07('0xf')](_0x1b07('0x10'),auth[_0x1b07('0xa')](),controller[_0x1b07('0x11')]);router['delete'](_0x1b07('0x10'),auth['isAuthenticated'](),controller[_0x1b07('0x12')]);module[_0x1b07('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 645b44f..eeaa0c8 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 _0x38b8=['ENUM','Task','Case','contact_lead','contact','lead','sequelize','exports','STRING'];(function(_0x2880d8,_0x284ded){var _0x51f5a9=function(_0xafd747){while(--_0xafd747){_0x2880d8['push'](_0x2880d8['shift']());}};_0x51f5a9(++_0x284ded);}(_0x38b8,0x1d1));var _0x838b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38b8[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x838b('0x0'));module[_0x838b('0x1')]={'name':{'type':Sequelize[_0x838b('0x2')]},'description':{'type':Sequelize[_0x838b('0x2')]},'ticketType':{'type':Sequelize[_0x838b('0x3')](_0x838b('0x4'),_0x838b('0x5')),'defaultValue':_0x838b('0x4')},'moduleSearch':{'type':Sequelize[_0x838b('0x3')](_0x838b('0x6'),_0x838b('0x7'),_0x838b('0x8')),'defaultValue':_0x838b('0x6')},'moduleCreate':{'type':Sequelize[_0x838b('0x3')]('nothing','contact',_0x838b('0x8')),'defaultValue':_0x838b('0x8')}}; \ No newline at end of file +var _0x7429=['Task','ENUM','contact_lead','contact','nothing','lead','sequelize','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7429,0xde));var _0x9742=function(_0x35278a,_0x2d34bf){_0x35278a=_0x35278a-0x0;var _0x3a3b8b=_0x7429[_0x35278a];return _0x3a3b8b;};'use strict';var Sequelize=require(_0x9742('0x0'));module['exports']={'name':{'type':Sequelize[_0x9742('0x1')]},'description':{'type':Sequelize[_0x9742('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x9742('0x2'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x9742('0x3')](_0x9742('0x4'),_0x9742('0x5'),'lead'),'defaultValue':_0x9742('0x4')},'moduleCreate':{'type':Sequelize[_0x9742('0x3')](_0x9742('0x6'),_0x9742('0x5'),_0x9742('0x7')),'defaultValue':_0x9742('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 863591a..84bdb10 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 _0xeef0=['findOne','SalesforceField','getSubjects','order','hasOwnProperty','nolimit','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','set','update','destroy','stack','name','rawAttributes','type','key','model','map','query','intersection','fields','attributes','limit','sort','where','filters','pick','filter','VIRTUAL','merge','options','SalesforceConfiguration','count','include','findAll','show','params','keys','length','includeAll','find','create','body','getFields'];(function(_0x3358cb,_0x3d549a){var _0x9c97af=function(_0x3b3aeb){while(--_0x3b3aeb){_0x3358cb['push'](_0x3358cb['shift']());}};_0x9c97af(++_0x3d549a);}(_0xeef0,0x14f));var _0x0eef=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xeef0[_0x1cc8fe];return _0x230054;};'use strict';var pdf=require(_0x0eef('0x0'));var emlformat=require(_0x0eef('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0eef('0x2'));var jsonpatch=require(_0x0eef('0x3'));var rp=require(_0x0eef('0x4'));var moment=require(_0x0eef('0x5'));var BPromise=require(_0x0eef('0x6'));var Mustache=require(_0x0eef('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0eef('0x8'));var csv=require(_0x0eef('0x9'));var ejs=require(_0x0eef('0xa'));var fs=require('fs');var _=require(_0x0eef('0xb'));var squel=require('squel');var crypto=require(_0x0eef('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0eef('0x9'));var querystring=require('querystring');var Papa=require(_0x0eef('0xd'));var Redis=require(_0x0eef('0xe'));var authService=require(_0x0eef('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0eef('0x10'));var hardwareService=require(_0x0eef('0x11'));var logger=require(_0x0eef('0x12'))(_0x0eef('0x13'));var utils=require(_0x0eef('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0eef('0x15'))['db'];var jayson=require(_0x0eef('0x16'));var client=jayson[_0x0eef('0x17')][_0x0eef('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x490617,_0x1dbba2,_0x3254a1,_0x2b2b30){return new BPromise(function(_0x3a4d76,_0x4ed3c8){var _0x31f641=_0x2b2b30||client;return _0x31f641['request'](_0x490617,_0x3254a1)[_0x0eef('0x19')](function(_0x55a8bf){logger['info'](_0x0eef('0x1a'),_0x1dbba2,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1dbba2,_0x0eef('0x1b'),JSON[_0x0eef('0x1c')](_0x55a8bf));if(_0x55a8bf['error']){if(_0x55a8bf[_0x0eef('0x1d')][_0x0eef('0x1e')]===0x1f4){logger['error'](_0x0eef('0x1a'),_0x1dbba2,_0x55a8bf[_0x0eef('0x1d')][_0x0eef('0x1f')]);return _0x4ed3c8(_0x55a8bf[_0x0eef('0x1d')]['message']);}logger[_0x0eef('0x1d')](_0x0eef('0x1a'),_0x1dbba2,_0x55a8bf[_0x0eef('0x1d')][_0x0eef('0x1f')]);return _0x3a4d76(_0x55a8bf[_0x0eef('0x1d')][_0x0eef('0x1f')]);}else{logger[_0x0eef('0x20')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1dbba2,_0x0eef('0x1b'));_0x3a4d76(_0x55a8bf[_0x0eef('0x21')][_0x0eef('0x1f')]);}})[_0x0eef('0x22')](function(_0x27e9f8){logger['error'](_0x0eef('0x1a'),_0x1dbba2,_0x27e9f8);_0x4ed3c8(_0x27e9f8);});});}function respondWithStatusCode(_0x40fc70,_0x29ef68){_0x29ef68=_0x29ef68||0xcc;return function(_0x43f2ca){if(_0x43f2ca){return _0x40fc70[_0x0eef('0x23')](_0x29ef68);}return _0x40fc70[_0x0eef('0x24')](_0x29ef68)[_0x0eef('0x25')]();};}function respondWithResult(_0x1e8472,_0x4417af){_0x4417af=_0x4417af||0xc8;return function(_0x519a14){if(_0x519a14){return _0x1e8472[_0x0eef('0x24')](_0x4417af)['json'](_0x519a14);}};}function respondWithFilteredResult(_0x49866b,_0x3ca2ef){return function(_0x2bc6e2){if(_0x2bc6e2){var _0x3adddc=_0x2bc6e2['count'],_0x5855dc=_0x3ca2ef[_0x0eef('0x26')],_0x4e4cc2=_0x3ca2ef[_0x0eef('0x26')]+_0x3ca2ef['limit'],_0x4c28e4;if(_0x4e4cc2>=_0x3adddc){_0x4e4cc2=_0x3adddc;_0x4c28e4=0xc8;}else{_0x4c28e4=0xce;}_0x49866b[_0x0eef('0x24')](_0x4c28e4);return _0x49866b[_0x0eef('0x27')]('Content-Range',_0x5855dc+'-'+_0x4e4cc2+'/'+_0x3adddc)['json'](_0x2bc6e2);}return null;};}function patchUpdates(_0x2dff3c){return function(_0x2f1659){try{jsonpatch['apply'](_0x2f1659,_0x2dff3c,!![]);}catch(_0x5511f9){return BPromise['reject'](_0x5511f9);}return _0x2f1659['save']();};}function saveUpdates(_0x81e955,_0xea75c4){return function(_0x44ecaa){if(_0x44ecaa){return _0x44ecaa[_0x0eef('0x28')](_0x81e955)['then'](function(_0x1fe27c){return _0x1fe27c;});}return null;};}function removeEntity(_0x147ae9,_0x419074){return function(_0x32aff0){if(_0x32aff0){return _0x32aff0[_0x0eef('0x29')]()[_0x0eef('0x19')](function(){_0x147ae9[_0x0eef('0x24')](0xcc)[_0x0eef('0x25')]();});}};}function handleEntityNotFound(_0x5c824c,_0x7c91e){return function(_0x58d568){if(!_0x58d568){_0x5c824c[_0x0eef('0x23')](0x194);}return _0x58d568;};}function handleError(_0x3836db,_0x3e5781){_0x3e5781=_0x3e5781||0x1f4;return function(_0x40743a){logger['error'](_0x40743a[_0x0eef('0x2a')]);if(_0x40743a[_0x0eef('0x2b')]){delete _0x40743a[_0x0eef('0x2b')];}_0x3836db['status'](_0x3e5781)['send'](_0x40743a);};}exports['index']=function(_0x5a6364,_0x3892e1){var _0x291176={},_0x2e19e5={},_0x1f31db={'count':0x0,'rows':[]};var _0x3a9982=_['map'](db['SalesforceConfiguration'][_0x0eef('0x2c')],function(_0x2aff5f){return{'name':_0x2aff5f['fieldName'],'type':_0x2aff5f[_0x0eef('0x2d')][_0x0eef('0x2e')]};});_0x2e19e5[_0x0eef('0x2f')]=_[_0x0eef('0x30')](_0x3a9982,_0x0eef('0x2b'));_0x2e19e5[_0x0eef('0x31')]=_['keys'](_0x5a6364['query']);_0x2e19e5['filters']=_[_0x0eef('0x32')](_0x2e19e5['model'],_0x2e19e5[_0x0eef('0x31')]);_0x291176['attributes']=_[_0x0eef('0x32')](_0x2e19e5['model'],qs[_0x0eef('0x33')](_0x5a6364['query']['fields']));_0x291176[_0x0eef('0x34')]=_0x291176['attributes']['length']?_0x291176['attributes']:_0x2e19e5[_0x0eef('0x2f')];if(!_0x5a6364[_0x0eef('0x31')]['hasOwnProperty']('nolimit')){_0x291176[_0x0eef('0x35')]=qs[_0x0eef('0x35')](_0x5a6364['query'][_0x0eef('0x35')]);_0x291176[_0x0eef('0x26')]=qs['offset'](_0x5a6364[_0x0eef('0x31')][_0x0eef('0x26')]);}_0x291176['order']=qs['sort'](_0x5a6364['query'][_0x0eef('0x36')]);_0x291176[_0x0eef('0x37')]=qs[_0x0eef('0x38')](_[_0x0eef('0x39')](_0x5a6364[_0x0eef('0x31')],_0x2e19e5['filters']),_0x3a9982);if(_0x5a6364[_0x0eef('0x31')][_0x0eef('0x3a')]){_0x291176[_0x0eef('0x37')]=_['merge'](_0x291176[_0x0eef('0x37')],{'$or':_[_0x0eef('0x30')](_0x3a9982,function(_0x300ce7){if(_0x300ce7[_0x0eef('0x2d')]!==_0x0eef('0x3b')){var _0x172b41={};_0x172b41[_0x300ce7[_0x0eef('0x2b')]]={'$like':'%'+_0x5a6364['query']['filter']+'%'};return _0x172b41;}})});}_0x291176=_[_0x0eef('0x3c')]({},_0x291176,_0x5a6364[_0x0eef('0x3d')]);var _0x43dd23={'where':_0x291176[_0x0eef('0x37')]};return db[_0x0eef('0x3e')][_0x0eef('0x3f')](_0x43dd23)[_0x0eef('0x19')](function(_0x5eda8c){_0x1f31db[_0x0eef('0x3f')]=_0x5eda8c;if(_0x5a6364[_0x0eef('0x31')]['includeAll']){_0x291176[_0x0eef('0x40')]=[{'all':!![]}];}return db[_0x0eef('0x3e')][_0x0eef('0x41')](_0x291176);})['then'](function(_0x46a398){_0x1f31db['rows']=_0x46a398;return _0x1f31db;})[_0x0eef('0x19')](respondWithFilteredResult(_0x3892e1,_0x291176))[_0x0eef('0x22')](handleError(_0x3892e1,null));};exports[_0x0eef('0x42')]=function(_0x2d0c35,_0x4e2072){var _0x5b4e65={'raw':![],'where':{'id':_0x2d0c35[_0x0eef('0x43')]['id']}},_0x14e8c0={};_0x14e8c0[_0x0eef('0x2f')]=_['keys'](db[_0x0eef('0x3e')][_0x0eef('0x2c')]);_0x14e8c0[_0x0eef('0x31')]=_[_0x0eef('0x44')](_0x2d0c35[_0x0eef('0x31')]);_0x14e8c0[_0x0eef('0x38')]=_['intersection'](_0x14e8c0['model'],_0x14e8c0[_0x0eef('0x31')]);_0x5b4e65[_0x0eef('0x34')]=_[_0x0eef('0x32')](_0x14e8c0[_0x0eef('0x2f')],qs[_0x0eef('0x33')](_0x2d0c35[_0x0eef('0x31')][_0x0eef('0x33')]));_0x5b4e65[_0x0eef('0x34')]=_0x5b4e65[_0x0eef('0x34')][_0x0eef('0x45')]?_0x5b4e65['attributes']:_0x14e8c0[_0x0eef('0x2f')];if(_0x2d0c35[_0x0eef('0x31')][_0x0eef('0x46')]){_0x5b4e65[_0x0eef('0x40')]=[{'all':!![]}];}_0x5b4e65=_[_0x0eef('0x3c')]({},_0x5b4e65,_0x2d0c35[_0x0eef('0x3d')]);return db['SalesforceConfiguration'][_0x0eef('0x47')](_0x5b4e65)[_0x0eef('0x19')](handleEntityNotFound(_0x4e2072,null))[_0x0eef('0x19')](respondWithResult(_0x4e2072,null))[_0x0eef('0x22')](handleError(_0x4e2072,null));};exports[_0x0eef('0x48')]=function(_0x4f3002,_0x48ce14){return db[_0x0eef('0x3e')][_0x0eef('0x48')](_0x4f3002['body'],{})[_0x0eef('0x19')](respondWithResult(_0x48ce14,0xc9))[_0x0eef('0x22')](handleError(_0x48ce14,null));};exports[_0x0eef('0x28')]=function(_0x24112c,_0x2ba174){if(_0x24112c[_0x0eef('0x49')]['id']){delete _0x24112c[_0x0eef('0x49')]['id'];}return db[_0x0eef('0x3e')][_0x0eef('0x47')]({'where':{'id':_0x24112c[_0x0eef('0x43')]['id']}})[_0x0eef('0x19')](handleEntityNotFound(_0x2ba174,null))['then'](saveUpdates(_0x24112c[_0x0eef('0x49')],null))['then'](respondWithResult(_0x2ba174,null))['catch'](handleError(_0x2ba174,null));};exports['destroy']=function(_0x9a17a7,_0x1b59a7){return db['SalesforceConfiguration'][_0x0eef('0x47')]({'where':{'id':_0x9a17a7[_0x0eef('0x43')]['id']}})[_0x0eef('0x19')](handleEntityNotFound(_0x1b59a7,null))['then'](removeEntity(_0x1b59a7,null))[_0x0eef('0x22')](handleError(_0x1b59a7,null));};exports[_0x0eef('0x4a')]=function(_0x2efd07,_0x2be681,_0x1cca12){var _0x39be72={};var _0x4032bd={};var _0x45c28c;var _0x16a3bb;return db[_0x0eef('0x3e')][_0x0eef('0x4b')]({'where':{'id':_0x2efd07['params']['id']}})[_0x0eef('0x19')](handleEntityNotFound(_0x2be681,null))[_0x0eef('0x19')](function(_0x44dc25){if(_0x44dc25){_0x45c28c=_0x44dc25;_0x4032bd[_0x0eef('0x2f')]=_['keys'](db[_0x0eef('0x4c')]['rawAttributes']);_0x4032bd[_0x0eef('0x31')]=_[_0x0eef('0x44')](_0x2efd07[_0x0eef('0x31')]);_0x4032bd['filters']=_[_0x0eef('0x32')](_0x4032bd['model'],_0x4032bd[_0x0eef('0x31')]);_0x39be72[_0x0eef('0x34')]=_[_0x0eef('0x32')](_0x4032bd['model'],qs[_0x0eef('0x33')](_0x2efd07[_0x0eef('0x31')][_0x0eef('0x33')]));_0x39be72[_0x0eef('0x34')]=_0x39be72[_0x0eef('0x34')]['length']?_0x39be72['attributes']:_0x4032bd[_0x0eef('0x2f')];_0x39be72['order']=qs[_0x0eef('0x36')](_0x2efd07[_0x0eef('0x31')]['sort']);_0x39be72[_0x0eef('0x37')]=qs[_0x0eef('0x38')](_['pick'](_0x2efd07[_0x0eef('0x31')],_0x4032bd['filters']));if(_0x2efd07[_0x0eef('0x31')][_0x0eef('0x3a')]){_0x39be72['where']=_[_0x0eef('0x3c')](_0x39be72[_0x0eef('0x37')],{'$or':_[_0x0eef('0x30')](_0x39be72[_0x0eef('0x34')],function(_0xff26d1){var _0x631c99={};_0x631c99[_0xff26d1]={'$like':'%'+_0x2efd07[_0x0eef('0x31')][_0x0eef('0x3a')]+'%'};return _0x631c99;})});}_0x39be72=_['merge']({},_0x39be72,_0x2efd07[_0x0eef('0x3d')]);return _0x45c28c['getFields'](_0x39be72);}})[_0x0eef('0x19')](function(_0x40bcc3){if(_0x40bcc3){_0x16a3bb=_0x40bcc3['length'];if(!_0x2efd07[_0x0eef('0x31')]['hasOwnProperty']('nolimit')){_0x39be72[_0x0eef('0x35')]=qs[_0x0eef('0x35')](_0x2efd07[_0x0eef('0x31')]['limit']);_0x39be72['offset']=qs[_0x0eef('0x26')](_0x2efd07[_0x0eef('0x31')][_0x0eef('0x26')]);}return _0x45c28c[_0x0eef('0x4a')](_0x39be72);}})[_0x0eef('0x19')](function(_0x3461ce){if(_0x3461ce){return _0x3461ce?{'count':_0x16a3bb,'rows':_0x3461ce}:null;}})['then'](respondWithResult(_0x2be681,null))[_0x0eef('0x22')](handleError(_0x2be681,null));};exports[_0x0eef('0x4d')]=function(_0x4f9221,_0x3b2546,_0x4ad050){var _0x49b573={};var _0x28b996={};var _0xdc640b;var _0x259d57;return db[_0x0eef('0x3e')][_0x0eef('0x4b')]({'where':{'id':_0x4f9221[_0x0eef('0x43')]['id']}})[_0x0eef('0x19')](handleEntityNotFound(_0x3b2546,null))[_0x0eef('0x19')](function(_0x1a2028){if(_0x1a2028){_0xdc640b=_0x1a2028;_0x28b996[_0x0eef('0x2f')]=_[_0x0eef('0x44')](db[_0x0eef('0x4c')][_0x0eef('0x2c')]);_0x28b996[_0x0eef('0x31')]=_['keys'](_0x4f9221[_0x0eef('0x31')]);_0x28b996[_0x0eef('0x38')]=_[_0x0eef('0x32')](_0x28b996[_0x0eef('0x2f')],_0x28b996[_0x0eef('0x31')]);_0x49b573[_0x0eef('0x34')]=_[_0x0eef('0x32')](_0x28b996[_0x0eef('0x2f')],qs[_0x0eef('0x33')](_0x4f9221['query'][_0x0eef('0x33')]));_0x49b573[_0x0eef('0x34')]=_0x49b573[_0x0eef('0x34')][_0x0eef('0x45')]?_0x49b573['attributes']:_0x28b996['model'];_0x49b573[_0x0eef('0x4e')]=qs[_0x0eef('0x36')](_0x4f9221[_0x0eef('0x31')]['sort']);_0x49b573[_0x0eef('0x37')]=qs[_0x0eef('0x38')](_[_0x0eef('0x39')](_0x4f9221['query'],_0x28b996['filters']));if(_0x4f9221[_0x0eef('0x31')][_0x0eef('0x3a')]){_0x49b573[_0x0eef('0x37')]=_[_0x0eef('0x3c')](_0x49b573[_0x0eef('0x37')],{'$or':_[_0x0eef('0x30')](_0x49b573[_0x0eef('0x34')],function(_0x1d80df){var _0x504e13={};_0x504e13[_0x1d80df]={'$like':'%'+_0x4f9221['query'][_0x0eef('0x3a')]+'%'};return _0x504e13;})});}_0x49b573=_['merge']({},_0x49b573,_0x4f9221[_0x0eef('0x3d')]);return _0xdc640b[_0x0eef('0x4d')](_0x49b573);}})[_0x0eef('0x19')](function(_0x364815){if(_0x364815){_0x259d57=_0x364815[_0x0eef('0x45')];if(!_0x4f9221[_0x0eef('0x31')][_0x0eef('0x4f')](_0x0eef('0x50'))){_0x49b573[_0x0eef('0x35')]=qs['limit'](_0x4f9221[_0x0eef('0x31')][_0x0eef('0x35')]);_0x49b573[_0x0eef('0x26')]=qs[_0x0eef('0x26')](_0x4f9221[_0x0eef('0x31')][_0x0eef('0x26')]);}return _0xdc640b[_0x0eef('0x4d')](_0x49b573);}})['then'](function(_0x3bd2f6){if(_0x3bd2f6){return _0x3bd2f6?{'count':_0x259d57,'rows':_0x3bd2f6}:null;}})[_0x0eef('0x19')](respondWithResult(_0x3b2546,null))[_0x0eef('0x22')](handleError(_0x3b2546,null));};exports['getDescriptions']=function(_0x5db5b6,_0x15776c,_0x10e079){var _0x50ff28={};var _0x163598={};var _0x44882a;var _0x14876a;return db['SalesforceConfiguration'][_0x0eef('0x4b')]({'where':{'id':_0x5db5b6[_0x0eef('0x43')]['id']}})['then'](handleEntityNotFound(_0x15776c,null))[_0x0eef('0x19')](function(_0x8394e7){if(_0x8394e7){_0x44882a=_0x8394e7;_0x163598[_0x0eef('0x2f')]=_[_0x0eef('0x44')](db[_0x0eef('0x4c')][_0x0eef('0x2c')]);_0x163598[_0x0eef('0x31')]=_[_0x0eef('0x44')](_0x5db5b6[_0x0eef('0x31')]);_0x163598['filters']=_[_0x0eef('0x32')](_0x163598[_0x0eef('0x2f')],_0x163598['query']);_0x50ff28['attributes']=_[_0x0eef('0x32')](_0x163598[_0x0eef('0x2f')],qs[_0x0eef('0x33')](_0x5db5b6['query']['fields']));_0x50ff28['attributes']=_0x50ff28[_0x0eef('0x34')][_0x0eef('0x45')]?_0x50ff28[_0x0eef('0x34')]:_0x163598['model'];_0x50ff28[_0x0eef('0x4e')]=qs[_0x0eef('0x36')](_0x5db5b6['query'][_0x0eef('0x36')]);_0x50ff28[_0x0eef('0x37')]=qs['filters'](_[_0x0eef('0x39')](_0x5db5b6['query'],_0x163598[_0x0eef('0x38')]));if(_0x5db5b6[_0x0eef('0x31')][_0x0eef('0x3a')]){_0x50ff28[_0x0eef('0x37')]=_['merge'](_0x50ff28[_0x0eef('0x37')],{'$or':_[_0x0eef('0x30')](_0x50ff28[_0x0eef('0x34')],function(_0x1b0555){var _0x1c7885={};_0x1c7885[_0x1b0555]={'$like':'%'+_0x5db5b6[_0x0eef('0x31')][_0x0eef('0x3a')]+'%'};return _0x1c7885;})});}_0x50ff28=_[_0x0eef('0x3c')]({},_0x50ff28,_0x5db5b6['options']);return _0x44882a[_0x0eef('0x51')](_0x50ff28);}})[_0x0eef('0x19')](function(_0x1b7444){if(_0x1b7444){_0x14876a=_0x1b7444[_0x0eef('0x45')];if(!_0x5db5b6[_0x0eef('0x31')][_0x0eef('0x4f')]('nolimit')){_0x50ff28[_0x0eef('0x35')]=qs[_0x0eef('0x35')](_0x5db5b6[_0x0eef('0x31')][_0x0eef('0x35')]);_0x50ff28[_0x0eef('0x26')]=qs[_0x0eef('0x26')](_0x5db5b6[_0x0eef('0x31')][_0x0eef('0x26')]);}return _0x44882a['getDescriptions'](_0x50ff28);}})['then'](function(_0x37d35c){if(_0x37d35c){return _0x37d35c?{'count':_0x14876a,'rows':_0x37d35c}:null;}})['then'](respondWithResult(_0x15776c,null))[_0x0eef('0x22')](handleError(_0x15776c,null));}; \ No newline at end of file +var _0xb707=['show','params','find','create','body','update','getFields','findOne','SalesforceField','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','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','../../mysqldb','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','limit','set','Content-Range','json','apply','reject','save','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SalesforceConfiguration','count','includeAll','include','findAll','then','rows'];(function(_0x5c3a4e,_0x2a798f){var _0x5992e0=function(_0x198dbd){while(--_0x198dbd){_0x5c3a4e['push'](_0x5c3a4e['shift']());}};_0x5992e0(++_0x2a798f);}(_0xb707,0x125));var _0x7b70=function(_0x4f5ce2,_0x897b85){_0x4f5ce2=_0x4f5ce2-0x0;var _0x44d7c4=_0xb707[_0x4f5ce2];return _0x44d7c4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7b70('0x0'));var zipdir=require(_0x7b70('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b70('0x2'));var moment=require('moment');var BPromise=require(_0x7b70('0x3'));var Mustache=require('mustache');var util=require(_0x7b70('0x4'));var path=require(_0x7b70('0x5'));var sox=require('sox');var csv=require(_0x7b70('0x6'));var ejs=require(_0x7b70('0x7'));var fs=require('fs');var _=require(_0x7b70('0x8'));var squel=require(_0x7b70('0x9'));var crypto=require(_0x7b70('0xa'));var jsforce=require(_0x7b70('0xb'));var deskjs=require(_0x7b70('0xc'));var toCsv=require(_0x7b70('0x6'));var querystring=require(_0x7b70('0xd'));var Papa=require(_0x7b70('0xe'));var Redis=require(_0x7b70('0xf'));var authService=require(_0x7b70('0x10'));var qs=require(_0x7b70('0x11'));var as=require(_0x7b70('0x12'));var hardwareService=require(_0x7b70('0x13'));var logger=require(_0x7b70('0x14'))(_0x7b70('0x15'));var utils=require(_0x7b70('0x16'));var config=require(_0x7b70('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7b70('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7b70('0x19')][_0x7b70('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xf3f68a,_0x2fc7c6,_0x27aa0a,_0x222ddb){return new BPromise(function(_0x31c783,_0x13d4f5){var _0x293282=_0x222ddb||client;return _0x293282[_0x7b70('0x1b')](_0xf3f68a,_0x27aa0a)['then'](function(_0x36ac13){logger[_0x7b70('0x1c')](_0x7b70('0x1d'),_0x2fc7c6,_0x7b70('0x1e'));logger[_0x7b70('0x1f')](_0x7b70('0x20'),_0x2fc7c6,_0x7b70('0x1e'),JSON[_0x7b70('0x21')](_0x36ac13));if(_0x36ac13[_0x7b70('0x22')]){if(_0x36ac13['error']['code']===0x1f4){logger['error'](_0x7b70('0x1d'),_0x2fc7c6,_0x36ac13['error'][_0x7b70('0x23')]);return _0x13d4f5(_0x36ac13['error'][_0x7b70('0x23')]);}logger[_0x7b70('0x22')](_0x7b70('0x1d'),_0x2fc7c6,_0x36ac13[_0x7b70('0x22')][_0x7b70('0x23')]);return _0x31c783(_0x36ac13[_0x7b70('0x22')][_0x7b70('0x23')]);}else{logger[_0x7b70('0x1c')](_0x7b70('0x1d'),_0x2fc7c6,'request\x20sent');_0x31c783(_0x36ac13[_0x7b70('0x24')][_0x7b70('0x23')]);}})[_0x7b70('0x25')](function(_0x260641){logger[_0x7b70('0x22')](_0x7b70('0x1d'),_0x2fc7c6,_0x260641);_0x13d4f5(_0x260641);});});}function respondWithStatusCode(_0x111452,_0x765096){_0x765096=_0x765096||0xcc;return function(_0x146437){if(_0x146437){return _0x111452[_0x7b70('0x26')](_0x765096);}return _0x111452[_0x7b70('0x27')](_0x765096)[_0x7b70('0x28')]();};}function respondWithResult(_0x58debe,_0x233869){_0x233869=_0x233869||0xc8;return function(_0x2a8190){if(_0x2a8190){return _0x58debe[_0x7b70('0x27')](_0x233869)['json'](_0x2a8190);}};}function respondWithFilteredResult(_0x2e0ae5,_0x3e4418){return function(_0x1722ea){if(_0x1722ea){var _0x14496e=_0x1722ea['count'],_0x54cf81=_0x3e4418['offset'],_0x32882f=_0x3e4418['offset']+_0x3e4418[_0x7b70('0x29')],_0x1a36d2;if(_0x32882f>=_0x14496e){_0x32882f=_0x14496e;_0x1a36d2=0xc8;}else{_0x1a36d2=0xce;}_0x2e0ae5[_0x7b70('0x27')](_0x1a36d2);return _0x2e0ae5[_0x7b70('0x2a')](_0x7b70('0x2b'),_0x54cf81+'-'+_0x32882f+'/'+_0x14496e)[_0x7b70('0x2c')](_0x1722ea);}return null;};}function patchUpdates(_0x2d7894){return function(_0x7aa54){try{jsonpatch[_0x7b70('0x2d')](_0x7aa54,_0x2d7894,!![]);}catch(_0x1a0c10){return BPromise[_0x7b70('0x2e')](_0x1a0c10);}return _0x7aa54[_0x7b70('0x2f')]();};}function saveUpdates(_0x57398f,_0x22325a){return function(_0x9d58f){if(_0x9d58f){return _0x9d58f['update'](_0x57398f)['then'](function(_0x9f4987){return _0x9f4987;});}return null;};}function removeEntity(_0x48b7ca,_0x487491){return function(_0x2f476e){if(_0x2f476e){return _0x2f476e[_0x7b70('0x30')]()['then'](function(){_0x48b7ca[_0x7b70('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x63cbc5,_0x93a0c0){return function(_0x34ef91){if(!_0x34ef91){_0x63cbc5['sendStatus'](0x194);}return _0x34ef91;};}function handleError(_0x4544f2,_0x592ef6){_0x592ef6=_0x592ef6||0x1f4;return function(_0xdffde4){logger[_0x7b70('0x22')](_0xdffde4[_0x7b70('0x31')]);if(_0xdffde4['name']){delete _0xdffde4[_0x7b70('0x32')];}_0x4544f2[_0x7b70('0x27')](_0x592ef6)['send'](_0xdffde4);};}exports[_0x7b70('0x33')]=function(_0x1c05e9,_0x5ebeca){var _0x621cb9={},_0x13062f={},_0x3494ad={'count':0x0,'rows':[]};var _0x2297ac=_[_0x7b70('0x34')](db['SalesforceConfiguration'][_0x7b70('0x35')],function(_0x3c1b83){return{'name':_0x3c1b83[_0x7b70('0x36')],'type':_0x3c1b83[_0x7b70('0x37')][_0x7b70('0x38')]};});_0x13062f[_0x7b70('0x39')]=_[_0x7b70('0x34')](_0x2297ac,_0x7b70('0x32'));_0x13062f[_0x7b70('0x3a')]=_[_0x7b70('0x3b')](_0x1c05e9[_0x7b70('0x3a')]);_0x13062f['filters']=_[_0x7b70('0x3c')](_0x13062f[_0x7b70('0x39')],_0x13062f[_0x7b70('0x3a')]);_0x621cb9[_0x7b70('0x3d')]=_['intersection'](_0x13062f[_0x7b70('0x39')],qs[_0x7b70('0x3e')](_0x1c05e9[_0x7b70('0x3a')][_0x7b70('0x3e')]));_0x621cb9[_0x7b70('0x3d')]=_0x621cb9[_0x7b70('0x3d')][_0x7b70('0x3f')]?_0x621cb9[_0x7b70('0x3d')]:_0x13062f[_0x7b70('0x39')];if(!_0x1c05e9[_0x7b70('0x3a')][_0x7b70('0x40')](_0x7b70('0x41'))){_0x621cb9[_0x7b70('0x29')]=qs['limit'](_0x1c05e9['query'][_0x7b70('0x29')]);_0x621cb9[_0x7b70('0x42')]=qs[_0x7b70('0x42')](_0x1c05e9[_0x7b70('0x3a')][_0x7b70('0x42')]);}_0x621cb9[_0x7b70('0x43')]=qs['sort'](_0x1c05e9['query'][_0x7b70('0x44')]);_0x621cb9[_0x7b70('0x45')]=qs[_0x7b70('0x46')](_[_0x7b70('0x47')](_0x1c05e9[_0x7b70('0x3a')],_0x13062f['filters']),_0x2297ac);if(_0x1c05e9['query'][_0x7b70('0x48')]){_0x621cb9[_0x7b70('0x45')]=_[_0x7b70('0x49')](_0x621cb9[_0x7b70('0x45')],{'$or':_[_0x7b70('0x34')](_0x2297ac,function(_0x3175ff){if(_0x3175ff[_0x7b70('0x37')]!==_0x7b70('0x4a')){var _0x26e7c9={};_0x26e7c9[_0x3175ff[_0x7b70('0x32')]]={'$like':'%'+_0x1c05e9[_0x7b70('0x3a')][_0x7b70('0x48')]+'%'};return _0x26e7c9;}})});}_0x621cb9=_[_0x7b70('0x49')]({},_0x621cb9,_0x1c05e9[_0x7b70('0x4b')]);var _0x556a6d={'where':_0x621cb9[_0x7b70('0x45')]};return db[_0x7b70('0x4c')][_0x7b70('0x4d')](_0x556a6d)['then'](function(_0x368744){_0x3494ad[_0x7b70('0x4d')]=_0x368744;if(_0x1c05e9[_0x7b70('0x3a')][_0x7b70('0x4e')]){_0x621cb9[_0x7b70('0x4f')]=[{'all':!![]}];}return db[_0x7b70('0x4c')][_0x7b70('0x50')](_0x621cb9);})[_0x7b70('0x51')](function(_0x2c1e2d){_0x3494ad[_0x7b70('0x52')]=_0x2c1e2d;return _0x3494ad;})[_0x7b70('0x51')](respondWithFilteredResult(_0x5ebeca,_0x621cb9))[_0x7b70('0x25')](handleError(_0x5ebeca,null));};exports[_0x7b70('0x53')]=function(_0x2663bc,_0x121018){var _0x88e127={'raw':![],'where':{'id':_0x2663bc[_0x7b70('0x54')]['id']}},_0x4435c3={};_0x4435c3[_0x7b70('0x39')]=_[_0x7b70('0x3b')](db[_0x7b70('0x4c')]['rawAttributes']);_0x4435c3[_0x7b70('0x3a')]=_[_0x7b70('0x3b')](_0x2663bc[_0x7b70('0x3a')]);_0x4435c3[_0x7b70('0x46')]=_[_0x7b70('0x3c')](_0x4435c3[_0x7b70('0x39')],_0x4435c3[_0x7b70('0x3a')]);_0x88e127['attributes']=_[_0x7b70('0x3c')](_0x4435c3[_0x7b70('0x39')],qs[_0x7b70('0x3e')](_0x2663bc['query'][_0x7b70('0x3e')]));_0x88e127[_0x7b70('0x3d')]=_0x88e127[_0x7b70('0x3d')][_0x7b70('0x3f')]?_0x88e127[_0x7b70('0x3d')]:_0x4435c3['model'];if(_0x2663bc['query'][_0x7b70('0x4e')]){_0x88e127[_0x7b70('0x4f')]=[{'all':!![]}];}_0x88e127=_[_0x7b70('0x49')]({},_0x88e127,_0x2663bc[_0x7b70('0x4b')]);return db[_0x7b70('0x4c')][_0x7b70('0x55')](_0x88e127)[_0x7b70('0x51')](handleEntityNotFound(_0x121018,null))['then'](respondWithResult(_0x121018,null))[_0x7b70('0x25')](handleError(_0x121018,null));};exports[_0x7b70('0x56')]=function(_0x563c60,_0x2a7719){return db[_0x7b70('0x4c')]['create'](_0x563c60[_0x7b70('0x57')],{})['then'](respondWithResult(_0x2a7719,0xc9))[_0x7b70('0x25')](handleError(_0x2a7719,null));};exports[_0x7b70('0x58')]=function(_0x2ca316,_0x1b3f99){if(_0x2ca316['body']['id']){delete _0x2ca316[_0x7b70('0x57')]['id'];}return db[_0x7b70('0x4c')][_0x7b70('0x55')]({'where':{'id':_0x2ca316['params']['id']}})[_0x7b70('0x51')](handleEntityNotFound(_0x1b3f99,null))['then'](saveUpdates(_0x2ca316['body'],null))[_0x7b70('0x51')](respondWithResult(_0x1b3f99,null))['catch'](handleError(_0x1b3f99,null));};exports['destroy']=function(_0x5f56a5,_0x185884){return db[_0x7b70('0x4c')][_0x7b70('0x55')]({'where':{'id':_0x5f56a5[_0x7b70('0x54')]['id']}})['then'](handleEntityNotFound(_0x185884,null))[_0x7b70('0x51')](removeEntity(_0x185884,null))[_0x7b70('0x25')](handleError(_0x185884,null));};exports[_0x7b70('0x59')]=function(_0x1b4dae,_0x5edc86,_0x36fe3c){var _0x462ebe={};var _0x4b62b3={};var _0x4bc0df;var _0xe0fe8c;return db['SalesforceConfiguration'][_0x7b70('0x5a')]({'where':{'id':_0x1b4dae[_0x7b70('0x54')]['id']}})[_0x7b70('0x51')](handleEntityNotFound(_0x5edc86,null))[_0x7b70('0x51')](function(_0x55ebec){if(_0x55ebec){_0x4bc0df=_0x55ebec;_0x4b62b3[_0x7b70('0x39')]=_[_0x7b70('0x3b')](db[_0x7b70('0x5b')]['rawAttributes']);_0x4b62b3[_0x7b70('0x3a')]=_['keys'](_0x1b4dae['query']);_0x4b62b3[_0x7b70('0x46')]=_['intersection'](_0x4b62b3['model'],_0x4b62b3['query']);_0x462ebe[_0x7b70('0x3d')]=_[_0x7b70('0x3c')](_0x4b62b3[_0x7b70('0x39')],qs['fields'](_0x1b4dae[_0x7b70('0x3a')][_0x7b70('0x3e')]));_0x462ebe['attributes']=_0x462ebe['attributes'][_0x7b70('0x3f')]?_0x462ebe['attributes']:_0x4b62b3[_0x7b70('0x39')];_0x462ebe[_0x7b70('0x43')]=qs[_0x7b70('0x44')](_0x1b4dae[_0x7b70('0x3a')][_0x7b70('0x44')]);_0x462ebe['where']=qs['filters'](_[_0x7b70('0x47')](_0x1b4dae[_0x7b70('0x3a')],_0x4b62b3['filters']));if(_0x1b4dae['query'][_0x7b70('0x48')]){_0x462ebe[_0x7b70('0x45')]=_[_0x7b70('0x49')](_0x462ebe[_0x7b70('0x45')],{'$or':_[_0x7b70('0x34')](_0x462ebe[_0x7b70('0x3d')],function(_0x3193a1){var _0x2a2467={};_0x2a2467[_0x3193a1]={'$like':'%'+_0x1b4dae[_0x7b70('0x3a')][_0x7b70('0x48')]+'%'};return _0x2a2467;})});}_0x462ebe=_[_0x7b70('0x49')]({},_0x462ebe,_0x1b4dae['options']);return _0x4bc0df[_0x7b70('0x59')](_0x462ebe);}})['then'](function(_0x35e5e8){if(_0x35e5e8){_0xe0fe8c=_0x35e5e8['length'];if(!_0x1b4dae['query'][_0x7b70('0x40')]('nolimit')){_0x462ebe['limit']=qs['limit'](_0x1b4dae[_0x7b70('0x3a')][_0x7b70('0x29')]);_0x462ebe[_0x7b70('0x42')]=qs[_0x7b70('0x42')](_0x1b4dae[_0x7b70('0x3a')][_0x7b70('0x42')]);}return _0x4bc0df[_0x7b70('0x59')](_0x462ebe);}})[_0x7b70('0x51')](function(_0x2f8f5b){if(_0x2f8f5b){return _0x2f8f5b?{'count':_0xe0fe8c,'rows':_0x2f8f5b}:null;}})[_0x7b70('0x51')](respondWithResult(_0x5edc86,null))[_0x7b70('0x25')](handleError(_0x5edc86,null));};exports[_0x7b70('0x5c')]=function(_0x5a001b,_0x4cd515,_0x1c0bea){var _0x106c71={};var _0x3fd2d8={};var _0x491d90;var _0x521b7d;return db[_0x7b70('0x4c')]['findOne']({'where':{'id':_0x5a001b[_0x7b70('0x54')]['id']}})['then'](handleEntityNotFound(_0x4cd515,null))[_0x7b70('0x51')](function(_0x14e7d3){if(_0x14e7d3){_0x491d90=_0x14e7d3;_0x3fd2d8['model']=_[_0x7b70('0x3b')](db[_0x7b70('0x5b')][_0x7b70('0x35')]);_0x3fd2d8[_0x7b70('0x3a')]=_[_0x7b70('0x3b')](_0x5a001b[_0x7b70('0x3a')]);_0x3fd2d8[_0x7b70('0x46')]=_[_0x7b70('0x3c')](_0x3fd2d8['model'],_0x3fd2d8[_0x7b70('0x3a')]);_0x106c71[_0x7b70('0x3d')]=_[_0x7b70('0x3c')](_0x3fd2d8['model'],qs[_0x7b70('0x3e')](_0x5a001b['query'][_0x7b70('0x3e')]));_0x106c71[_0x7b70('0x3d')]=_0x106c71[_0x7b70('0x3d')][_0x7b70('0x3f')]?_0x106c71[_0x7b70('0x3d')]:_0x3fd2d8[_0x7b70('0x39')];_0x106c71[_0x7b70('0x43')]=qs[_0x7b70('0x44')](_0x5a001b[_0x7b70('0x3a')][_0x7b70('0x44')]);_0x106c71[_0x7b70('0x45')]=qs[_0x7b70('0x46')](_[_0x7b70('0x47')](_0x5a001b[_0x7b70('0x3a')],_0x3fd2d8[_0x7b70('0x46')]));if(_0x5a001b[_0x7b70('0x3a')][_0x7b70('0x48')]){_0x106c71['where']=_[_0x7b70('0x49')](_0x106c71['where'],{'$or':_[_0x7b70('0x34')](_0x106c71[_0x7b70('0x3d')],function(_0x268339){var _0x4dcce3={};_0x4dcce3[_0x268339]={'$like':'%'+_0x5a001b[_0x7b70('0x3a')][_0x7b70('0x48')]+'%'};return _0x4dcce3;})});}_0x106c71=_[_0x7b70('0x49')]({},_0x106c71,_0x5a001b[_0x7b70('0x4b')]);return _0x491d90['getSubjects'](_0x106c71);}})[_0x7b70('0x51')](function(_0x586fe8){if(_0x586fe8){_0x521b7d=_0x586fe8[_0x7b70('0x3f')];if(!_0x5a001b['query'][_0x7b70('0x40')]('nolimit')){_0x106c71['limit']=qs['limit'](_0x5a001b['query'][_0x7b70('0x29')]);_0x106c71[_0x7b70('0x42')]=qs[_0x7b70('0x42')](_0x5a001b[_0x7b70('0x3a')][_0x7b70('0x42')]);}return _0x491d90[_0x7b70('0x5c')](_0x106c71);}})[_0x7b70('0x51')](function(_0x50e550){if(_0x50e550){return _0x50e550?{'count':_0x521b7d,'rows':_0x50e550}:null;}})['then'](respondWithResult(_0x4cd515,null))[_0x7b70('0x25')](handleError(_0x4cd515,null));};exports[_0x7b70('0x5d')]=function(_0x1e860b,_0x3c3809,_0xdde566){var _0x78f363={};var _0x117b76={};var _0x575426;var _0x34400b;return db['SalesforceConfiguration'][_0x7b70('0x5a')]({'where':{'id':_0x1e860b[_0x7b70('0x54')]['id']}})['then'](handleEntityNotFound(_0x3c3809,null))['then'](function(_0x5631b8){if(_0x5631b8){_0x575426=_0x5631b8;_0x117b76[_0x7b70('0x39')]=_[_0x7b70('0x3b')](db[_0x7b70('0x5b')][_0x7b70('0x35')]);_0x117b76['query']=_['keys'](_0x1e860b[_0x7b70('0x3a')]);_0x117b76[_0x7b70('0x46')]=_[_0x7b70('0x3c')](_0x117b76['model'],_0x117b76['query']);_0x78f363[_0x7b70('0x3d')]=_[_0x7b70('0x3c')](_0x117b76[_0x7b70('0x39')],qs[_0x7b70('0x3e')](_0x1e860b[_0x7b70('0x3a')][_0x7b70('0x3e')]));_0x78f363[_0x7b70('0x3d')]=_0x78f363[_0x7b70('0x3d')][_0x7b70('0x3f')]?_0x78f363[_0x7b70('0x3d')]:_0x117b76['model'];_0x78f363[_0x7b70('0x43')]=qs['sort'](_0x1e860b[_0x7b70('0x3a')][_0x7b70('0x44')]);_0x78f363[_0x7b70('0x45')]=qs['filters'](_[_0x7b70('0x47')](_0x1e860b[_0x7b70('0x3a')],_0x117b76['filters']));if(_0x1e860b[_0x7b70('0x3a')][_0x7b70('0x48')]){_0x78f363[_0x7b70('0x45')]=_[_0x7b70('0x49')](_0x78f363[_0x7b70('0x45')],{'$or':_[_0x7b70('0x34')](_0x78f363[_0x7b70('0x3d')],function(_0x12f620){var _0x2c9bea={};_0x2c9bea[_0x12f620]={'$like':'%'+_0x1e860b['query'][_0x7b70('0x48')]+'%'};return _0x2c9bea;})});}_0x78f363=_['merge']({},_0x78f363,_0x1e860b['options']);return _0x575426[_0x7b70('0x5d')](_0x78f363);}})[_0x7b70('0x51')](function(_0x4d775b){if(_0x4d775b){_0x34400b=_0x4d775b[_0x7b70('0x3f')];if(!_0x1e860b[_0x7b70('0x3a')][_0x7b70('0x40')](_0x7b70('0x41'))){_0x78f363[_0x7b70('0x29')]=qs[_0x7b70('0x29')](_0x1e860b[_0x7b70('0x3a')][_0x7b70('0x29')]);_0x78f363[_0x7b70('0x42')]=qs['offset'](_0x1e860b[_0x7b70('0x3a')][_0x7b70('0x42')]);}return _0x575426['getDescriptions'](_0x78f363);}})['then'](function(_0x16d16c){if(_0x16d16c){return _0x16d16c?{'count':_0x34400b,'rows':_0x16d16c}:null;}})[_0x7b70('0x51')](respondWithResult(_0x3c3809,null))[_0x7b70('0x25')](handleError(_0x3c3809,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index affd79b..cfbcbfa 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 _0x5a6d=['int_salesforce_configurations','../../config/logger','moment','bluebird','request-promise','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5a6d,0xa3));var _0xd5a6=function(_0xe61be9,_0x4bc4a8){_0xe61be9=_0xe61be9-0x0;var _0x1c72ae=_0x5a6d[_0xe61be9];return _0x1c72ae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd5a6('0x0'))('api');var moment=require(_0xd5a6('0x1'));var BPromise=require(_0xd5a6('0x2'));var rp=require(_0xd5a6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd5a6('0x4'));var attributes=require(_0xd5a6('0x5'));module['exports']=function(_0x325703,_0x42b756){return _0x325703[_0xd5a6('0x6')](_0xd5a6('0x7'),attributes,{'tableName':_0xd5a6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2510=['define','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes'];(function(_0x3dc16c,_0x47b2a3){var _0x58de67=function(_0x472981){while(--_0x472981){_0x3dc16c['push'](_0x3dc16c['shift']());}};_0x58de67(++_0x47b2a3);}(_0x2510,0x12b));var _0x0251=function(_0x19a92f,_0x45cde1){_0x19a92f=_0x19a92f-0x0;var _0x15d71b=_0x2510[_0x19a92f];return _0x15d71b;};'use strict';var _=require('lodash');var util=require(_0x0251('0x0'));var logger=require(_0x0251('0x1'))(_0x0251('0x2'));var moment=require(_0x0251('0x3'));var BPromise=require(_0x0251('0x4'));var rp=require(_0x0251('0x5'));var fs=require('fs');var path=require(_0x0251('0x6'));var rimraf=require(_0x0251('0x7'));var config=require('../../config/environment');var attributes=require(_0x0251('0x8'));module['exports']=function(_0x547ab0,_0x2577ca){return _0x547ab0[_0x0251('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0x0251('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index e7cb1ab..3798b06 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 _0xeed4=['info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','debug','request\x20sent','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message'];(function(_0x5f477a,_0x41cfd1){var _0x37a42a=function(_0x37630e){while(--_0x37630e){_0x5f477a['push'](_0x5f477a['shift']());}};_0x37a42a(++_0x41cfd1);}(_0xeed4,0xf4));var _0x4eed=function(_0x4e13b0,_0x1ca561){_0x4e13b0=_0x4e13b0-0x0;var _0x5c2a63=_0xeed4[_0x4e13b0];return _0x5c2a63;};'use strict';var _=require('lodash');var util=require(_0x4eed('0x0'));var moment=require(_0x4eed('0x1'));var BPromise=require(_0x4eed('0x2'));var rs=require(_0x4eed('0x3'));var fs=require('fs');var Redis=require(_0x4eed('0x4'));var db=require(_0x4eed('0x5'))['db'];var utils=require(_0x4eed('0x6'));var logger=require(_0x4eed('0x7'))('rpc');var config=require(_0x4eed('0x8'));var jayson=require(_0x4eed('0x9'));var client=jayson[_0x4eed('0xa')][_0x4eed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28fa41,_0x3db9b5,_0x1c6d6a){return new BPromise(function(_0x4fd745,_0x48b59e){return client[_0x4eed('0xc')](_0x28fa41,_0x1c6d6a)['then'](function(_0x28d0e3){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x3db9b5,'request\x20sent');logger[_0x4eed('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3db9b5,_0x4eed('0xe'),JSON[_0x4eed('0xf')](_0x28d0e3));if(_0x28d0e3[_0x4eed('0x10')]){if(_0x28d0e3[_0x4eed('0x10')][_0x4eed('0x11')]===0x1f4){logger[_0x4eed('0x10')](_0x4eed('0x12'),_0x3db9b5,_0x28d0e3[_0x4eed('0x10')][_0x4eed('0x13')]);return _0x48b59e(_0x28d0e3['error'][_0x4eed('0x13')]);}logger[_0x4eed('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3db9b5,_0x28d0e3[_0x4eed('0x10')][_0x4eed('0x13')]);return _0x4fd745(_0x28d0e3['error'][_0x4eed('0x13')]);}else{logger[_0x4eed('0x14')](_0x4eed('0x12'),_0x3db9b5,_0x4eed('0xe'));_0x4fd745(_0x28d0e3['result']['message']);}})[_0x4eed('0x15')](function(_0x1d885a){logger[_0x4eed('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3db9b5,_0x1d885a);_0x48b59e(_0x1d885a);});});} \ No newline at end of file +var _0xcfe3=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x35c200,_0xaa1421){var _0x2097ac=function(_0x2b6655){while(--_0x2b6655){_0x35c200['push'](_0x35c200['shift']());}};_0x2097ac(++_0xaa1421);}(_0xcfe3,0x1a0));var _0x3cfe=function(_0x462999,_0x1cc51c){_0x462999=_0x462999-0x0;var _0x374c1c=_0xcfe3[_0x462999];return _0x374c1c;};'use strict';var _=require(_0x3cfe('0x0'));var util=require(_0x3cfe('0x1'));var moment=require(_0x3cfe('0x2'));var BPromise=require(_0x3cfe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3cfe('0x4'));var db=require(_0x3cfe('0x5'))['db'];var utils=require(_0x3cfe('0x6'));var logger=require(_0x3cfe('0x7'))(_0x3cfe('0x8'));var config=require('../../config/environment');var jayson=require(_0x3cfe('0x9'));var client=jayson[_0x3cfe('0xa')][_0x3cfe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xad1acf,_0x521c58,_0x3512a5){return new BPromise(function(_0x3bb6bd,_0x1085b8){return client['request'](_0xad1acf,_0x3512a5)['then'](function(_0x384bda){logger[_0x3cfe('0xc')](_0x3cfe('0xd'),_0x521c58,_0x3cfe('0xe'));logger[_0x3cfe('0xf')](_0x3cfe('0x10'),_0x521c58,_0x3cfe('0xe'),JSON[_0x3cfe('0x11')](_0x384bda));if(_0x384bda['error']){if(_0x384bda[_0x3cfe('0x12')][_0x3cfe('0x13')]===0x1f4){logger[_0x3cfe('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x521c58,_0x384bda[_0x3cfe('0x12')][_0x3cfe('0x14')]);return _0x1085b8(_0x384bda[_0x3cfe('0x12')][_0x3cfe('0x14')]);}logger[_0x3cfe('0x12')](_0x3cfe('0xd'),_0x521c58,_0x384bda[_0x3cfe('0x12')][_0x3cfe('0x14')]);return _0x3bb6bd(_0x384bda[_0x3cfe('0x12')][_0x3cfe('0x14')]);}else{logger[_0x3cfe('0xc')](_0x3cfe('0xd'),_0x521c58,_0x3cfe('0xe'));_0x3bb6bd(_0x384bda[_0x3cfe('0x15')][_0x3cfe('0x14')]);}})[_0x3cfe('0x16')](function(_0x48dc28){logger[_0x3cfe('0x12')](_0x3cfe('0xd'),_0x521c58,_0x48dc28);_0x1085b8(_0x48dc28);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index a00e0f9..0566f02 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 _0x6b8f=['util','connect-timeout','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','/:id','show','create','update','delete'];(function(_0x1a227d,_0x11093d){var _0x11f7fe=function(_0x5f0aa7){while(--_0x5f0aa7){_0x1a227d['push'](_0x1a227d['shift']());}};_0x11f7fe(++_0x11093d);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x3c5028,_0x2f019e){_0x3c5028=_0x3c5028-0x0;var _0x5d9151=_0x6b8f[_0x3c5028];return _0x5d9151;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xf6b8('0x2'));var interaction=require(_0xf6b8('0x3'));var config=require('../../config/environment');var controller=require(_0xf6b8('0x4'));router[_0xf6b8('0x5')]('/',auth[_0xf6b8('0x6')](),controller['index']);router[_0xf6b8('0x5')](_0xf6b8('0x7'),auth[_0xf6b8('0x6')](),controller[_0xf6b8('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf6b8('0x9')]);router['put'](_0xf6b8('0x7'),auth[_0xf6b8('0x6')](),controller[_0xf6b8('0xa')]);router[_0xf6b8('0xb')](_0xf6b8('0x7'),auth[_0xf6b8('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x33af=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','update','delete','exports','util','connect-timeout','express','Router'];(function(_0x50ef1e,_0x3f88be){var _0x350854=function(_0x5207f7){while(--_0x5207f7){_0x50ef1e['push'](_0x50ef1e['shift']());}};_0x350854(++_0x3f88be);}(_0x33af,0xec));var _0xf33a=function(_0x3a5648,_0x58054e){_0x3a5648=_0x3a5648-0x0;var _0x34126d=_0x33af[_0x3a5648];return _0x34126d;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var auth=require(_0xf33a('0x4'));var interaction=require(_0xf33a('0x5'));var config=require(_0xf33a('0x6'));var controller=require('./intSalesforceField.controller');router[_0xf33a('0x7')]('/',auth[_0xf33a('0x8')](),controller['index']);router[_0xf33a('0x7')](_0xf33a('0x9'),auth[_0xf33a('0x8')](),controller[_0xf33a('0xa')]);router[_0xf33a('0xb')]('/',auth[_0xf33a('0x8')](),controller['create']);router[_0xf33a('0xc')](_0xf33a('0x9'),auth[_0xf33a('0x8')](),controller[_0xf33a('0xd')]);router[_0xf33a('0xe')](_0xf33a('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xf33a('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 44d48d1..d5c126b 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 _0x4fa6=['string','variable','STRING','ENUM','customVariable','sequelize'];(function(_0x515391,_0x1dccad){var _0x4ccc61=function(_0x1a5fef){while(--_0x1a5fef){_0x515391['push'](_0x515391['shift']());}};_0x4ccc61(++_0x1dccad);}(_0x4fa6,0x14f));var _0x64fa=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4fa6[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0x64fa('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x64fa('0x1'),_0x64fa('0x2'),'customVariable','keyValue'),'defaultValue':_0x64fa('0x1')},'content':{'type':Sequelize[_0x64fa('0x3')]},'key':{'type':Sequelize[_0x64fa('0x3')]},'keyType':{'type':Sequelize[_0x64fa('0x4')](_0x64fa('0x1'),_0x64fa('0x2'),_0x64fa('0x5'))},'keyContent':{'type':Sequelize[_0x64fa('0x3')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x64fa('0x3')]}}; \ No newline at end of file +var _0x30b2=['variable','exports','ENUM','string','customVariable','keyValue','STRING'];(function(_0x510bd8,_0x46c1e6){var _0xcd6e09=function(_0x4adabe){while(--_0x4adabe){_0x510bd8['push'](_0x510bd8['shift']());}};_0xcd6e09(++_0x46c1e6);}(_0x30b2,0x1cf));var _0x230b=function(_0x189a26,_0x26361b){_0x189a26=_0x189a26-0x0;var _0x569167=_0x30b2[_0x189a26];return _0x569167;};'use strict';var Sequelize=require('sequelize');module[_0x230b('0x0')]={'type':{'type':Sequelize[_0x230b('0x1')](_0x230b('0x2'),'variable',_0x230b('0x3'),_0x230b('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x230b('0x5')]},'key':{'type':Sequelize[_0x230b('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x230b('0x2'),_0x230b('0x6'),_0x230b('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x230b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index be842cd..c41c9c3 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 _0x89ff=['index','map','SalesforceField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name'];(function(_0x3838bf,_0x39f6da){var _0x58e5af=function(_0x16086){while(--_0x16086){_0x3838bf['push'](_0x3838bf['shift']());}};_0x58e5af(++_0x39f6da);}(_0x89ff,0xb4));var _0xf89f=function(_0x732d54,_0x5708f4){_0x732d54=_0x732d54-0x0;var _0x55e766=_0x89ff[_0x732d54];return _0x55e766;};'use strict';var pdf=require(_0xf89f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf89f('0x1'));var jsonpatch=require(_0xf89f('0x2'));var rp=require(_0xf89f('0x3'));var moment=require(_0xf89f('0x4'));var BPromise=require(_0xf89f('0x5'));var Mustache=require('mustache');var util=require(_0xf89f('0x6'));var path=require(_0xf89f('0x7'));var sox=require('sox');var csv=require(_0xf89f('0x8'));var ejs=require(_0xf89f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf89f('0xa'));var crypto=require(_0xf89f('0xb'));var jsforce=require(_0xf89f('0xc'));var deskjs=require(_0xf89f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf89f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf89f('0xf'));var as=require(_0xf89f('0x10'));var hardwareService=require(_0xf89f('0x11'));var logger=require(_0xf89f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf89f('0x13'));var licenseUtil=require(_0xf89f('0x14'));var db=require(_0xf89f('0x15'))['db'];function respondWithStatusCode(_0x344adb,_0x5c391e){_0x5c391e=_0x5c391e||0xcc;return function(_0x1e656e){if(_0x1e656e){return _0x344adb['sendStatus'](_0x5c391e);}return _0x344adb[_0xf89f('0x16')](_0x5c391e)[_0xf89f('0x17')]();};}function respondWithResult(_0x534951,_0x29ceb2){_0x29ceb2=_0x29ceb2||0xc8;return function(_0x1bbdd0){if(_0x1bbdd0){return _0x534951[_0xf89f('0x16')](_0x29ceb2)['json'](_0x1bbdd0);}};}function respondWithFilteredResult(_0x3ac433,_0x3f5317){return function(_0x9efe8d){if(_0x9efe8d){var _0x47fd1b=_0x9efe8d[_0xf89f('0x18')],_0x2dd39c=_0x3f5317['offset'],_0x1bd92b=_0x3f5317[_0xf89f('0x19')]+_0x3f5317[_0xf89f('0x1a')],_0x51be86;if(_0x1bd92b>=_0x47fd1b){_0x1bd92b=_0x47fd1b;_0x51be86=0xc8;}else{_0x51be86=0xce;}_0x3ac433[_0xf89f('0x16')](_0x51be86);return _0x3ac433[_0xf89f('0x1b')](_0xf89f('0x1c'),_0x2dd39c+'-'+_0x1bd92b+'/'+_0x47fd1b)[_0xf89f('0x1d')](_0x9efe8d);}return null;};}function patchUpdates(_0xd5de1a){return function(_0x5d985d){try{jsonpatch[_0xf89f('0x1e')](_0x5d985d,_0xd5de1a,!![]);}catch(_0x34d7a6){return BPromise[_0xf89f('0x1f')](_0x34d7a6);}return _0x5d985d[_0xf89f('0x20')]();};}function saveUpdates(_0x5f321d,_0x4698f1){return function(_0x2dc3b8){if(_0x2dc3b8){return _0x2dc3b8[_0xf89f('0x21')](_0x5f321d)[_0xf89f('0x22')](function(_0x5a1f53){return _0x5a1f53;});}return null;};}function removeEntity(_0x216862,_0x25fdaf){return function(_0x4ad8c1){if(_0x4ad8c1){return _0x4ad8c1[_0xf89f('0x23')]()[_0xf89f('0x22')](function(){_0x216862[_0xf89f('0x16')](0xcc)[_0xf89f('0x17')]();});}};}function handleEntityNotFound(_0x36de82,_0x1ed868){return function(_0x41033d){if(!_0x41033d){_0x36de82[_0xf89f('0x24')](0x194);}return _0x41033d;};}function handleError(_0x31cdca,_0x5bf4fa){_0x5bf4fa=_0x5bf4fa||0x1f4;return function(_0x54af1c){logger['error'](_0x54af1c[_0xf89f('0x25')]);if(_0x54af1c[_0xf89f('0x26')]){delete _0x54af1c['name'];}_0x31cdca[_0xf89f('0x16')](_0x5bf4fa)['send'](_0x54af1c);};}exports[_0xf89f('0x27')]=function(_0x42880d,_0x349495){var _0xab5659={},_0x55f483={},_0x1b2c9c={'count':0x0,'rows':[]};var _0x2fabfd=_[_0xf89f('0x28')](db[_0xf89f('0x29')][_0xf89f('0x2a')],function(_0x989620){return{'name':_0x989620[_0xf89f('0x2b')],'type':_0x989620[_0xf89f('0x2c')][_0xf89f('0x2d')]};});_0x55f483[_0xf89f('0x2e')]=_['map'](_0x2fabfd,'name');_0x55f483['query']=_[_0xf89f('0x2f')](_0x42880d[_0xf89f('0x30')]);_0x55f483[_0xf89f('0x31')]=_[_0xf89f('0x32')](_0x55f483[_0xf89f('0x2e')],_0x55f483[_0xf89f('0x30')]);_0xab5659[_0xf89f('0x33')]=_['intersection'](_0x55f483[_0xf89f('0x2e')],qs[_0xf89f('0x34')](_0x42880d['query'][_0xf89f('0x34')]));_0xab5659[_0xf89f('0x33')]=_0xab5659[_0xf89f('0x33')][_0xf89f('0x35')]?_0xab5659[_0xf89f('0x33')]:_0x55f483[_0xf89f('0x2e')];if(!_0x42880d[_0xf89f('0x30')][_0xf89f('0x36')](_0xf89f('0x37'))){_0xab5659['limit']=qs[_0xf89f('0x1a')](_0x42880d['query']['limit']);_0xab5659[_0xf89f('0x19')]=qs[_0xf89f('0x19')](_0x42880d[_0xf89f('0x30')]['offset']);}_0xab5659[_0xf89f('0x38')]=qs[_0xf89f('0x39')](_0x42880d[_0xf89f('0x30')][_0xf89f('0x39')]);_0xab5659[_0xf89f('0x3a')]=qs[_0xf89f('0x31')](_[_0xf89f('0x3b')](_0x42880d['query'],_0x55f483[_0xf89f('0x31')]),_0x2fabfd);if(_0x42880d[_0xf89f('0x30')][_0xf89f('0x3c')]){_0xab5659['where']=_[_0xf89f('0x3d')](_0xab5659[_0xf89f('0x3a')],{'$or':_[_0xf89f('0x28')](_0x2fabfd,function(_0x4f1058){if(_0x4f1058[_0xf89f('0x2c')]!==_0xf89f('0x3e')){var _0x320c53={};_0x320c53[_0x4f1058[_0xf89f('0x26')]]={'$like':'%'+_0x42880d[_0xf89f('0x30')][_0xf89f('0x3c')]+'%'};return _0x320c53;}})});}_0xab5659=_[_0xf89f('0x3d')]({},_0xab5659,_0x42880d[_0xf89f('0x3f')]);var _0xce1512={'where':_0xab5659[_0xf89f('0x3a')]};return db['SalesforceField'][_0xf89f('0x18')](_0xce1512)[_0xf89f('0x22')](function(_0x35d482){_0x1b2c9c['count']=_0x35d482;if(_0x42880d['query'][_0xf89f('0x40')]){_0xab5659['include']=[{'all':!![]}];}return db[_0xf89f('0x29')][_0xf89f('0x41')](_0xab5659);})['then'](function(_0x4552be){_0x1b2c9c[_0xf89f('0x42')]=_0x4552be;return _0x1b2c9c;})[_0xf89f('0x22')](respondWithFilteredResult(_0x349495,_0xab5659))[_0xf89f('0x43')](handleError(_0x349495,null));};exports['show']=function(_0x71a1b8,_0x1897ff){var _0x1b43c9={'raw':!![],'where':{'id':_0x71a1b8[_0xf89f('0x44')]['id']}},_0x26041c={};_0x26041c[_0xf89f('0x2e')]=_['keys'](db[_0xf89f('0x29')][_0xf89f('0x2a')]);_0x26041c[_0xf89f('0x30')]=_['keys'](_0x71a1b8[_0xf89f('0x30')]);_0x26041c['filters']=_[_0xf89f('0x32')](_0x26041c[_0xf89f('0x2e')],_0x26041c['query']);_0x1b43c9[_0xf89f('0x33')]=_['intersection'](_0x26041c[_0xf89f('0x2e')],qs[_0xf89f('0x34')](_0x71a1b8[_0xf89f('0x30')][_0xf89f('0x34')]));_0x1b43c9[_0xf89f('0x33')]=_0x1b43c9['attributes'][_0xf89f('0x35')]?_0x1b43c9[_0xf89f('0x33')]:_0x26041c[_0xf89f('0x2e')];if(_0x71a1b8[_0xf89f('0x30')][_0xf89f('0x40')]){_0x1b43c9[_0xf89f('0x45')]=[{'all':!![]}];}_0x1b43c9=_[_0xf89f('0x3d')]({},_0x1b43c9,_0x71a1b8[_0xf89f('0x3f')]);return db[_0xf89f('0x29')][_0xf89f('0x46')](_0x1b43c9)[_0xf89f('0x22')](handleEntityNotFound(_0x1897ff,null))[_0xf89f('0x22')](respondWithResult(_0x1897ff,null))['catch'](handleError(_0x1897ff,null));};exports[_0xf89f('0x47')]=function(_0x391e0e,_0x2de88a){return db['SalesforceField'][_0xf89f('0x47')](_0x391e0e[_0xf89f('0x48')],{})['then'](respondWithResult(_0x2de88a,0xc9))[_0xf89f('0x43')](handleError(_0x2de88a,null));};exports[_0xf89f('0x21')]=function(_0x4e451e,_0x5434a1){if(_0x4e451e[_0xf89f('0x48')]['id']){delete _0x4e451e['body']['id'];}return db[_0xf89f('0x29')]['find']({'where':{'id':_0x4e451e['params']['id']}})[_0xf89f('0x22')](handleEntityNotFound(_0x5434a1,null))[_0xf89f('0x22')](saveUpdates(_0x4e451e['body'],null))['then'](respondWithResult(_0x5434a1,null))[_0xf89f('0x43')](handleError(_0x5434a1,null));};exports[_0xf89f('0x23')]=function(_0x25c329,_0x1b11bc){return db[_0xf89f('0x29')][_0xf89f('0x46')]({'where':{'id':_0x25c329[_0xf89f('0x44')]['id']}})[_0xf89f('0x22')](handleEntityNotFound(_0x1b11bc,null))['then'](removeEntity(_0x1b11bc,null))[_0xf89f('0x43')](handleError(_0x1b11bc,null));}; \ No newline at end of file +var _0x3990=['sox','to-csv','ejs','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','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','error','stack','name','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x3990,0x12e));var _0x0399=function(_0x469852,_0x532e8c){_0x469852=_0x469852-0x0;var _0xa844b9=_0x3990[_0x469852];return _0xa844b9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0399('0x0'));var rimraf=require(_0x0399('0x1'));var zipdir=require(_0x0399('0x2'));var jsonpatch=require(_0x0399('0x3'));var rp=require(_0x0399('0x4'));var moment=require(_0x0399('0x5'));var BPromise=require(_0x0399('0x6'));var Mustache=require(_0x0399('0x7'));var util=require(_0x0399('0x8'));var path=require(_0x0399('0x9'));var sox=require(_0x0399('0xa'));var csv=require(_0x0399('0xb'));var ejs=require(_0x0399('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0399('0xd'));var jsforce=require(_0x0399('0xe'));var deskjs=require(_0x0399('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0399('0x10'));var Papa=require('papaparse');var Redis=require(_0x0399('0x11'));var authService=require(_0x0399('0x12'));var qs=require(_0x0399('0x13'));var as=require(_0x0399('0x14'));var hardwareService=require(_0x0399('0x15'));var logger=require(_0x0399('0x16'))(_0x0399('0x17'));var utils=require(_0x0399('0x18'));var config=require(_0x0399('0x19'));var licenseUtil=require(_0x0399('0x1a'));var db=require(_0x0399('0x1b'))['db'];function respondWithStatusCode(_0x28c744,_0x2d9df2){_0x2d9df2=_0x2d9df2||0xcc;return function(_0x2d4cc2){if(_0x2d4cc2){return _0x28c744[_0x0399('0x1c')](_0x2d9df2);}return _0x28c744[_0x0399('0x1d')](_0x2d9df2)[_0x0399('0x1e')]();};}function respondWithResult(_0x5bfd2b,_0x104477){_0x104477=_0x104477||0xc8;return function(_0x4cb5cf){if(_0x4cb5cf){return _0x5bfd2b['status'](_0x104477)[_0x0399('0x1f')](_0x4cb5cf);}};}function respondWithFilteredResult(_0x4240a8,_0x59e8fa){return function(_0x36ee5e){if(_0x36ee5e){var _0x1cb7cd=_0x36ee5e[_0x0399('0x20')],_0x371184=_0x59e8fa[_0x0399('0x21')],_0x1eb81f=_0x59e8fa[_0x0399('0x21')]+_0x59e8fa[_0x0399('0x22')],_0x6bb6f9;if(_0x1eb81f>=_0x1cb7cd){_0x1eb81f=_0x1cb7cd;_0x6bb6f9=0xc8;}else{_0x6bb6f9=0xce;}_0x4240a8[_0x0399('0x1d')](_0x6bb6f9);return _0x4240a8[_0x0399('0x23')]('Content-Range',_0x371184+'-'+_0x1eb81f+'/'+_0x1cb7cd)[_0x0399('0x1f')](_0x36ee5e);}return null;};}function patchUpdates(_0x1d8433){return function(_0x5d0b49){try{jsonpatch[_0x0399('0x24')](_0x5d0b49,_0x1d8433,!![]);}catch(_0x5ebbab){return BPromise[_0x0399('0x25')](_0x5ebbab);}return _0x5d0b49['save']();};}function saveUpdates(_0x1e6c5a,_0x290f9f){return function(_0x62060b){if(_0x62060b){return _0x62060b[_0x0399('0x26')](_0x1e6c5a)[_0x0399('0x27')](function(_0x5a5416){return _0x5a5416;});}return null;};}function removeEntity(_0x4830b5,_0x347a15){return function(_0x3a4908){if(_0x3a4908){return _0x3a4908['destroy']()['then'](function(){_0x4830b5[_0x0399('0x1d')](0xcc)[_0x0399('0x1e')]();});}};}function handleEntityNotFound(_0x2b731b,_0x54ae64){return function(_0x1dce85){if(!_0x1dce85){_0x2b731b[_0x0399('0x1c')](0x194);}return _0x1dce85;};}function handleError(_0x4c5fe4,_0x166f46){_0x166f46=_0x166f46||0x1f4;return function(_0x29d8d2){logger[_0x0399('0x28')](_0x29d8d2[_0x0399('0x29')]);if(_0x29d8d2[_0x0399('0x2a')]){delete _0x29d8d2[_0x0399('0x2a')];}_0x4c5fe4[_0x0399('0x1d')](_0x166f46)['send'](_0x29d8d2);};}exports[_0x0399('0x2b')]=function(_0x22eb4e,_0x3b3925){var _0x1ea651={},_0x347d7c={},_0x3bbfee={'count':0x0,'rows':[]};var _0x163491=_[_0x0399('0x2c')](db[_0x0399('0x2d')][_0x0399('0x2e')],function(_0x44b158){return{'name':_0x44b158[_0x0399('0x2f')],'type':_0x44b158[_0x0399('0x30')][_0x0399('0x31')]};});_0x347d7c[_0x0399('0x32')]=_[_0x0399('0x2c')](_0x163491,_0x0399('0x2a'));_0x347d7c[_0x0399('0x33')]=_[_0x0399('0x34')](_0x22eb4e['query']);_0x347d7c['filters']=_[_0x0399('0x35')](_0x347d7c[_0x0399('0x32')],_0x347d7c[_0x0399('0x33')]);_0x1ea651[_0x0399('0x36')]=_[_0x0399('0x35')](_0x347d7c[_0x0399('0x32')],qs[_0x0399('0x37')](_0x22eb4e[_0x0399('0x33')][_0x0399('0x37')]));_0x1ea651[_0x0399('0x36')]=_0x1ea651[_0x0399('0x36')]['length']?_0x1ea651[_0x0399('0x36')]:_0x347d7c[_0x0399('0x32')];if(!_0x22eb4e[_0x0399('0x33')][_0x0399('0x38')](_0x0399('0x39'))){_0x1ea651[_0x0399('0x22')]=qs[_0x0399('0x22')](_0x22eb4e['query']['limit']);_0x1ea651[_0x0399('0x21')]=qs['offset'](_0x22eb4e[_0x0399('0x33')][_0x0399('0x21')]);}_0x1ea651[_0x0399('0x3a')]=qs['sort'](_0x22eb4e[_0x0399('0x33')][_0x0399('0x3b')]);_0x1ea651[_0x0399('0x3c')]=qs[_0x0399('0x3d')](_[_0x0399('0x3e')](_0x22eb4e[_0x0399('0x33')],_0x347d7c[_0x0399('0x3d')]),_0x163491);if(_0x22eb4e['query'][_0x0399('0x3f')]){_0x1ea651[_0x0399('0x3c')]=_[_0x0399('0x40')](_0x1ea651['where'],{'$or':_['map'](_0x163491,function(_0x16e950){if(_0x16e950[_0x0399('0x30')]!=='VIRTUAL'){var _0x27c0d0={};_0x27c0d0[_0x16e950[_0x0399('0x2a')]]={'$like':'%'+_0x22eb4e[_0x0399('0x33')][_0x0399('0x3f')]+'%'};return _0x27c0d0;}})});}_0x1ea651=_[_0x0399('0x40')]({},_0x1ea651,_0x22eb4e[_0x0399('0x41')]);var _0xce78b1={'where':_0x1ea651[_0x0399('0x3c')]};return db['SalesforceField']['count'](_0xce78b1)[_0x0399('0x27')](function(_0x49358a){_0x3bbfee[_0x0399('0x20')]=_0x49358a;if(_0x22eb4e[_0x0399('0x33')][_0x0399('0x42')]){_0x1ea651[_0x0399('0x43')]=[{'all':!![]}];}return db[_0x0399('0x2d')][_0x0399('0x44')](_0x1ea651);})['then'](function(_0x21997c){_0x3bbfee[_0x0399('0x45')]=_0x21997c;return _0x3bbfee;})[_0x0399('0x27')](respondWithFilteredResult(_0x3b3925,_0x1ea651))[_0x0399('0x46')](handleError(_0x3b3925,null));};exports[_0x0399('0x47')]=function(_0x494c66,_0x690b03){var _0x148406={'raw':!![],'where':{'id':_0x494c66['params']['id']}},_0x397fe4={};_0x397fe4[_0x0399('0x32')]=_[_0x0399('0x34')](db[_0x0399('0x2d')][_0x0399('0x2e')]);_0x397fe4[_0x0399('0x33')]=_[_0x0399('0x34')](_0x494c66[_0x0399('0x33')]);_0x397fe4[_0x0399('0x3d')]=_[_0x0399('0x35')](_0x397fe4[_0x0399('0x32')],_0x397fe4[_0x0399('0x33')]);_0x148406['attributes']=_[_0x0399('0x35')](_0x397fe4[_0x0399('0x32')],qs[_0x0399('0x37')](_0x494c66[_0x0399('0x33')][_0x0399('0x37')]));_0x148406[_0x0399('0x36')]=_0x148406[_0x0399('0x36')][_0x0399('0x48')]?_0x148406[_0x0399('0x36')]:_0x397fe4['model'];if(_0x494c66[_0x0399('0x33')]['includeAll']){_0x148406['include']=[{'all':!![]}];}_0x148406=_['merge']({},_0x148406,_0x494c66[_0x0399('0x41')]);return db[_0x0399('0x2d')][_0x0399('0x49')](_0x148406)[_0x0399('0x27')](handleEntityNotFound(_0x690b03,null))[_0x0399('0x27')](respondWithResult(_0x690b03,null))[_0x0399('0x46')](handleError(_0x690b03,null));};exports[_0x0399('0x4a')]=function(_0x2c63a9,_0x2248f3){return db[_0x0399('0x2d')]['create'](_0x2c63a9[_0x0399('0x4b')],{})[_0x0399('0x27')](respondWithResult(_0x2248f3,0xc9))['catch'](handleError(_0x2248f3,null));};exports[_0x0399('0x26')]=function(_0x1a0509,_0x230463){if(_0x1a0509['body']['id']){delete _0x1a0509[_0x0399('0x4b')]['id'];}return db[_0x0399('0x2d')][_0x0399('0x49')]({'where':{'id':_0x1a0509[_0x0399('0x4c')]['id']}})[_0x0399('0x27')](handleEntityNotFound(_0x230463,null))[_0x0399('0x27')](saveUpdates(_0x1a0509[_0x0399('0x4b')],null))['then'](respondWithResult(_0x230463,null))[_0x0399('0x46')](handleError(_0x230463,null));};exports[_0x0399('0x4d')]=function(_0x27218d,_0x1feeb1){return db[_0x0399('0x2d')][_0x0399('0x49')]({'where':{'id':_0x27218d[_0x0399('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1feeb1,null))[_0x0399('0x27')](removeEntity(_0x1feeb1,null))[_0x0399('0x46')](handleError(_0x1feeb1,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 886604e..f323c59 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 _0xc69c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x4e2b73,_0x5dfde9){var _0xa03b99=function(_0x2a3c39){while(--_0x2a3c39){_0x4e2b73['push'](_0x4e2b73['shift']());}};_0xa03b99(++_0x5dfde9);}(_0xc69c,0x1ee));var _0xcc69=function(_0x26cd05,_0x1f7d74){_0x26cd05=_0x26cd05-0x0;var _0x3e13b9=_0xc69c[_0x26cd05];return _0x3e13b9;};'use strict';var _=require(_0xcc69('0x0'));var util=require('util');var logger=require(_0xcc69('0x1'))(_0xcc69('0x2'));var moment=require(_0xcc69('0x3'));var BPromise=require(_0xcc69('0x4'));var rp=require(_0xcc69('0x5'));var fs=require('fs');var path=require(_0xcc69('0x6'));var rimraf=require(_0xcc69('0x7'));var config=require(_0xcc69('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0xcc69('0x9')]=function(_0x3182cc,_0x56fde8){return _0x3182cc[_0xcc69('0xa')](_0xcc69('0xb'),attributes,{'tableName':_0xcc69('0xc'),'paranoid':![],'indexes':[{'name':_0xcc69('0xd'),'fields':[_0xcc69('0xe'),_0xcc69('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7877=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x24d57f,_0x54819e){var _0x533df4=function(_0x2d4afa){while(--_0x2d4afa){_0x24d57f['push'](_0x24d57f['shift']());}};_0x533df4(++_0x54819e);}(_0x7877,0xb2));var _0x7787=function(_0x5c63bc,_0x51c676){_0x5c63bc=_0x5c63bc-0x0;var _0x62604=_0x7877[_0x5c63bc];return _0x62604;};'use strict';var _=require('lodash');var util=require(_0x7787('0x0'));var logger=require(_0x7787('0x1'))(_0x7787('0x2'));var moment=require(_0x7787('0x3'));var BPromise=require(_0x7787('0x4'));var rp=require(_0x7787('0x5'));var fs=require('fs');var path=require(_0x7787('0x6'));var rimraf=require(_0x7787('0x7'));var config=require(_0x7787('0x8'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x121cd1,_0x144d87){return _0x121cd1[_0x7787('0x9')](_0x7787('0xa'),attributes,{'tableName':_0x7787('0xb'),'paranoid':![],'indexes':[{'name':_0x7787('0xc'),'fields':[_0x7787('0xd'),_0x7787('0xe')],'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 05956a5..210f802 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 _0xe5b5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xe5b5,0x12b));var _0x5e5b=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0xe5b5[_0xdbe2de];return _0x2facd7;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('SalesforceField,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('SalesforceField,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('SalesforceField,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});} \ No newline at end of file +var _0x750a=['error','code','SalesforceField,\x20%s,\x20%s','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify'];(function(_0x43701b,_0x11185d){var _0x4d0e3b=function(_0x2ea23c){while(--_0x2ea23c){_0x43701b['push'](_0x43701b['shift']());}};_0x4d0e3b(++_0x11185d);}(_0x750a,0x140));var _0xa750=function(_0x1996ec,_0x4fe1df){_0x1996ec=_0x1996ec-0x0;var _0x4905e8=_0x750a[_0x1996ec];return _0x4905e8;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('SalesforceField,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index f42269f..21b5691 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 _0xf5da=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','/:id','isAuthenticated','get','/:id/configurations','getConfigurations','getFields','post','create','update','delete'];(function(_0x26c169,_0x45cc97){var _0x544051=function(_0x577093){while(--_0x577093){_0x26c169['push'](_0x26c169['shift']());}};_0x544051(++_0x45cc97);}(_0xf5da,0x1a6));var _0xaf5d=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0xf5da[_0x3df9dd];return _0x4f11e4;};'use strict';var multer=require(_0xaf5d('0x0'));var util=require(_0xaf5d('0x1'));var path=require(_0xaf5d('0x2'));var timeout=require(_0xaf5d('0x3'));var express=require(_0xaf5d('0x4'));var router=express[_0xaf5d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xaf5d('0x6'));var config=require(_0xaf5d('0x7'));var controller=require(_0xaf5d('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xaf5d('0x9'),auth[_0xaf5d('0xa')](),controller['show']);router[_0xaf5d('0xb')](_0xaf5d('0xc'),auth[_0xaf5d('0xa')](),controller[_0xaf5d('0xd')]);router[_0xaf5d('0xb')]('/:id/fields',auth[_0xaf5d('0xa')](),controller[_0xaf5d('0xe')]);router[_0xaf5d('0xf')]('/',auth['isAuthenticated'](),controller[_0xaf5d('0x10')]);router[_0xaf5d('0xf')](_0xaf5d('0xc'),auth[_0xaf5d('0xa')](),controller['addConfiguration']);router['put'](_0xaf5d('0x9'),auth[_0xaf5d('0xa')](),controller[_0xaf5d('0x11')]);router[_0xaf5d('0x12')]('/:id',auth[_0xaf5d('0xa')](),controller[_0xaf5d('0x13')]);module[_0xaf5d('0x14')]=router; \ No newline at end of file +var _0xe4bb=['put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','post','create'];(function(_0x359eca,_0x2dff28){var _0x3c1c4c=function(_0x37fe62){while(--_0x37fe62){_0x359eca['push'](_0x359eca['shift']());}};_0x3c1c4c(++_0x2dff28);}(_0xe4bb,0x154));var _0xbe4b=function(_0x3a59a8,_0x42012c){_0x3a59a8=_0x3a59a8-0x0;var _0x4d21ba=_0xe4bb[_0x3a59a8];return _0x4d21ba;};'use strict';var multer=require(_0xbe4b('0x0'));var util=require(_0xbe4b('0x1'));var path=require(_0xbe4b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbe4b('0x3')]();var auth=require(_0xbe4b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbe4b('0x5'));var controller=require(_0xbe4b('0x6'));router[_0xbe4b('0x7')]('/',auth['isAuthenticated'](),controller[_0xbe4b('0x8')]);router[_0xbe4b('0x7')](_0xbe4b('0x9'),auth['isAuthenticated'](),controller[_0xbe4b('0xa')]);router[_0xbe4b('0x7')](_0xbe4b('0xb'),auth[_0xbe4b('0xc')](),controller[_0xbe4b('0xd')]);router[_0xbe4b('0x7')](_0xbe4b('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xbe4b('0xf')]('/',auth[_0xbe4b('0xc')](),controller[_0xbe4b('0x10')]);router[_0xbe4b('0xf')](_0xbe4b('0xb'),auth[_0xbe4b('0xc')](),controller['addConfiguration']);router[_0xbe4b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xbe4b('0x12')]);router['delete'](_0xbe4b('0x9'),auth[_0xbe4b('0xc')](),controller[_0xbe4b('0x13')]);module[_0xbe4b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 4bb17cf..41c7788 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 _0xf44e=['remoteUri','sequelize','STRING','username'];(function(_0x2ecd72,_0xb6f7d4){var _0x586778=function(_0x580c4e){while(--_0x580c4e){_0x2ecd72['push'](_0x2ecd72['shift']());}};_0x586778(++_0xb6f7d4);}(_0xf44e,0x1cd));var _0xef44=function(_0x2808a9,_0x1e82e3){_0x2808a9=_0x2808a9-0x0;var _0x2385dd=_0xf44e[_0x2808a9];return _0x2385dd;};'use strict';var Sequelize=require(_0xef44('0x0'));module['exports']={'name':{'type':Sequelize[_0xef44('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xef44('0x1')],'unique':_0xef44('0x2')},'password':{'type':Sequelize[_0xef44('0x1')]},'email':{'type':Sequelize[_0xef44('0x1')]},'remoteUri':{'type':Sequelize[_0xef44('0x1')],'unique':_0xef44('0x3')},'serverUrl':{'type':Sequelize[_0xef44('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x29aa=['STRING','username','remoteUri','exports'];(function(_0x79b521,_0x4e77ff){var _0x325e81=function(_0x1d2c62){while(--_0x1d2c62){_0x79b521['push'](_0x79b521['shift']());}};_0x325e81(++_0x4e77ff);}(_0x29aa,0x1ab));var _0xa29a=function(_0xa7f09b,_0x30f8a0){_0xa7f09b=_0xa7f09b-0x0;var _0x1735fc=_0x29aa[_0xa7f09b];return _0x1735fc;};'use strict';var Sequelize=require('sequelize');module[_0xa29a('0x0')]={'name':{'type':Sequelize[_0xa29a('0x1')]},'description':{'type':Sequelize[_0xa29a('0x1')]},'username':{'type':Sequelize[_0xa29a('0x1')],'unique':_0xa29a('0x2')},'password':{'type':Sequelize[_0xa29a('0x1')]},'email':{'type':Sequelize[_0xa29a('0x1')]},'remoteUri':{'type':Sequelize[_0xa29a('0x1')],'unique':_0xa29a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 5bce748..16b3faf 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 _0x1881=['incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','internalType','push','all','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','statusCode','test','Wrong\x20credentials','boolean','True','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','limit','set','Content-Range','save','destroy','end','name','send','index','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','ServicenowAccount','findAll','show','params','rawAttributes','find','create','body','update','getConfigurations','ServicenowConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','close_code','notify','incident_state','category','parent','watch_list','child_incidents','approval_history','number','opened_by','user_input','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','sys_domain_path','rfc','expected_start','business_duration','group_list','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','closed_by','parent_incident','sys_id','contact_type','problem_id','company','reassignment_count','activity_due','severity','comments','comments_and_work_notes','sys_mod_count','sys_tags','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/'];(function(_0x4a568c,_0xecea09){var _0x9c55e0=function(_0x22cf58){while(--_0x22cf58){_0x4a568c['push'](_0x4a568c['shift']());}};_0x9c55e0(++_0xecea09);}(_0x1881,0x18b));var _0x1188=function(_0x4a2ff1,_0x13de3b){_0x4a2ff1=_0x4a2ff1-0x0;var _0x106aa7=_0x1881[_0x4a2ff1];return _0x106aa7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1188('0x0'));var zipdir=require(_0x1188('0x1'));var jsonpatch=require(_0x1188('0x2'));var rp=require(_0x1188('0x3'));var moment=require(_0x1188('0x4'));var BPromise=require(_0x1188('0x5'));var Mustache=require(_0x1188('0x6'));var util=require(_0x1188('0x7'));var path=require(_0x1188('0x8'));var sox=require('sox');var csv=require(_0x1188('0x9'));var ejs=require(_0x1188('0xa'));var fs=require('fs');var _=require(_0x1188('0xb'));var squel=require(_0x1188('0xc'));var crypto=require('crypto');var jsforce=require(_0x1188('0xd'));var deskjs=require(_0x1188('0xe'));var toCsv=require(_0x1188('0x9'));var querystring=require('querystring');var Papa=require(_0x1188('0xf'));var Redis=require(_0x1188('0x10'));var authService=require(_0x1188('0x11'));var qs=require(_0x1188('0x12'));var as=require(_0x1188('0x13'));var hardwareService=require(_0x1188('0x14'));var logger=require(_0x1188('0x15'))(_0x1188('0x16'));var utils=require(_0x1188('0x17'));var config=require(_0x1188('0x18'));var licenseUtil=require(_0x1188('0x19'));var db=require(_0x1188('0x1a'))['db'];var integrations=require(_0x1188('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0x1188('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5049f1,_0x47fe7d,_0x392be7,_0x311543){return new BPromise(function(_0x23dcaa,_0x558164){var _0x33cc77=_0x311543||client;return _0x33cc77[_0x1188('0x1d')](_0x5049f1,_0x392be7)[_0x1188('0x1e')](function(_0x41690c){logger[_0x1188('0x1f')](_0x1188('0x20'),_0x47fe7d,_0x1188('0x21'));logger[_0x1188('0x22')](_0x1188('0x23'),_0x47fe7d,'request\x20sent',JSON['stringify'](_0x41690c));if(_0x41690c[_0x1188('0x24')]){if(_0x41690c['error'][_0x1188('0x25')]===0x1f4){logger[_0x1188('0x24')](_0x1188('0x20'),_0x47fe7d,_0x41690c[_0x1188('0x24')][_0x1188('0x26')]);return _0x558164(_0x41690c['error']['message']);}logger[_0x1188('0x24')](_0x1188('0x20'),_0x47fe7d,_0x41690c[_0x1188('0x24')][_0x1188('0x26')]);return _0x23dcaa(_0x41690c[_0x1188('0x24')][_0x1188('0x26')]);}else{logger[_0x1188('0x1f')](_0x1188('0x20'),_0x47fe7d,'request\x20sent');_0x23dcaa(_0x41690c[_0x1188('0x27')][_0x1188('0x26')]);}})[_0x1188('0x28')](function(_0x157278){logger[_0x1188('0x24')](_0x1188('0x20'),_0x47fe7d,_0x157278);_0x558164(_0x157278);});});}function respondWithStatusCode(_0x3b9e0b,_0x29bb61){_0x29bb61=_0x29bb61||0xcc;return function(_0x50fa62){if(_0x50fa62){return _0x3b9e0b[_0x1188('0x29')](_0x29bb61);}return _0x3b9e0b[_0x1188('0x2a')](_0x29bb61)['end']();};}function respondWithResult(_0x48c70f,_0x46ad89){_0x46ad89=_0x46ad89||0xc8;return function(_0x3e322f){if(_0x3e322f){return _0x48c70f[_0x1188('0x2a')](_0x46ad89)[_0x1188('0x2b')](_0x3e322f);}};}function respondWithFilteredResult(_0x451076,_0x40c159){return function(_0x1f09cd){if(_0x1f09cd){var _0x9ea40d=_0x1f09cd[_0x1188('0x2c')],_0x4b8e4f=_0x40c159['offset'],_0x512a13=_0x40c159['offset']+_0x40c159[_0x1188('0x2d')],_0x3d2fbc;if(_0x512a13>=_0x9ea40d){_0x512a13=_0x9ea40d;_0x3d2fbc=0xc8;}else{_0x3d2fbc=0xce;}_0x451076[_0x1188('0x2a')](_0x3d2fbc);return _0x451076[_0x1188('0x2e')](_0x1188('0x2f'),_0x4b8e4f+'-'+_0x512a13+'/'+_0x9ea40d)[_0x1188('0x2b')](_0x1f09cd);}return null;};}function patchUpdates(_0x11a9f8){return function(_0x32137a){try{jsonpatch['apply'](_0x32137a,_0x11a9f8,!![]);}catch(_0x4bf422){return BPromise['reject'](_0x4bf422);}return _0x32137a[_0x1188('0x30')]();};}function saveUpdates(_0x22cf8a,_0x3f232e){return function(_0x1c2d22){if(_0x1c2d22){return _0x1c2d22['update'](_0x22cf8a)['then'](function(_0xb76be8){return _0xb76be8;});}return null;};}function removeEntity(_0x530ca4,_0x2d7f8a){return function(_0x25348a){if(_0x25348a){return _0x25348a[_0x1188('0x31')]()[_0x1188('0x1e')](function(){_0x530ca4[_0x1188('0x2a')](0xcc)[_0x1188('0x32')]();});}};}function handleEntityNotFound(_0x27a840,_0x2d9ed9){return function(_0x396e8e){if(!_0x396e8e){_0x27a840[_0x1188('0x29')](0x194);}return _0x396e8e;};}function handleError(_0x1163b3,_0x3bf9d7){_0x3bf9d7=_0x3bf9d7||0x1f4;return function(_0x5a3aab){logger['error'](_0x5a3aab['stack']);if(_0x5a3aab[_0x1188('0x33')]){delete _0x5a3aab['name'];}_0x1163b3[_0x1188('0x2a')](_0x3bf9d7)[_0x1188('0x34')](_0x5a3aab);};}exports[_0x1188('0x35')]=function(_0x1e33ee,_0x386b12){var _0x431e9b={},_0x350f97={},_0xb09581={'count':0x0,'rows':[]};var _0x37b632=_['map'](db['ServicenowAccount']['rawAttributes'],function(_0x38f71d){return{'name':_0x38f71d['fieldName'],'type':_0x38f71d[_0x1188('0x36')]['key']};});_0x350f97['model']=_[_0x1188('0x37')](_0x37b632,'name');_0x350f97[_0x1188('0x38')]=_[_0x1188('0x39')](_0x1e33ee[_0x1188('0x38')]);_0x350f97[_0x1188('0x3a')]=_['intersection'](_0x350f97[_0x1188('0x3b')],_0x350f97['query']);_0x431e9b[_0x1188('0x3c')]=_[_0x1188('0x3d')](_0x350f97['model'],qs[_0x1188('0x3e')](_0x1e33ee[_0x1188('0x38')][_0x1188('0x3e')]));_0x431e9b[_0x1188('0x3c')]=_0x431e9b[_0x1188('0x3c')][_0x1188('0x3f')]?_0x431e9b['attributes']:_0x350f97[_0x1188('0x3b')];if(!_0x1e33ee[_0x1188('0x38')][_0x1188('0x40')](_0x1188('0x41'))){_0x431e9b[_0x1188('0x2d')]=qs[_0x1188('0x2d')](_0x1e33ee[_0x1188('0x38')]['limit']);_0x431e9b[_0x1188('0x42')]=qs[_0x1188('0x42')](_0x1e33ee[_0x1188('0x38')][_0x1188('0x42')]);}_0x431e9b[_0x1188('0x43')]=qs['sort'](_0x1e33ee[_0x1188('0x38')][_0x1188('0x44')]);_0x431e9b['where']=qs['filters'](_[_0x1188('0x45')](_0x1e33ee[_0x1188('0x38')],_0x350f97[_0x1188('0x3a')]),_0x37b632);if(_0x1e33ee[_0x1188('0x38')][_0x1188('0x46')]){_0x431e9b[_0x1188('0x47')]=_[_0x1188('0x48')](_0x431e9b[_0x1188('0x47')],{'$or':_[_0x1188('0x37')](_0x37b632,function(_0x5d715f){if(_0x5d715f['type']!==_0x1188('0x49')){var _0x3890ae={};_0x3890ae[_0x5d715f[_0x1188('0x33')]]={'$like':'%'+_0x1e33ee['query']['filter']+'%'};return _0x3890ae;}})});}_0x431e9b=_['merge']({},_0x431e9b,_0x1e33ee[_0x1188('0x4a')]);var _0x2fe21a={'where':_0x431e9b[_0x1188('0x47')]};return db['ServicenowAccount'][_0x1188('0x2c')](_0x2fe21a)['then'](function(_0x3559e9){_0xb09581[_0x1188('0x2c')]=_0x3559e9;if(_0x1e33ee[_0x1188('0x38')][_0x1188('0x4b')]){_0x431e9b[_0x1188('0x4c')]=[{'all':!![]}];}return db[_0x1188('0x4d')][_0x1188('0x4e')](_0x431e9b);})[_0x1188('0x1e')](function(_0x26d07f){_0xb09581['rows']=_0x26d07f;return _0xb09581;})[_0x1188('0x1e')](respondWithFilteredResult(_0x386b12,_0x431e9b))['catch'](handleError(_0x386b12,null));};exports[_0x1188('0x4f')]=function(_0x573c40,_0x5b17b6){var _0x3486be={'raw':![],'where':{'id':_0x573c40[_0x1188('0x50')]['id']}},_0x4e34c5={};_0x4e34c5[_0x1188('0x3b')]=_[_0x1188('0x39')](db[_0x1188('0x4d')][_0x1188('0x51')]);_0x4e34c5[_0x1188('0x38')]=_[_0x1188('0x39')](_0x573c40[_0x1188('0x38')]);_0x4e34c5[_0x1188('0x3a')]=_[_0x1188('0x3d')](_0x4e34c5['model'],_0x4e34c5['query']);_0x3486be['attributes']=_['intersection'](_0x4e34c5['model'],qs['fields'](_0x573c40[_0x1188('0x38')][_0x1188('0x3e')]));_0x3486be[_0x1188('0x3c')]=_0x3486be[_0x1188('0x3c')][_0x1188('0x3f')]?_0x3486be[_0x1188('0x3c')]:_0x4e34c5[_0x1188('0x3b')];if(_0x573c40['query']['includeAll']){_0x3486be[_0x1188('0x4c')]=[{'all':!![]}];}_0x3486be=_[_0x1188('0x48')]({},_0x3486be,_0x573c40['options']);return db[_0x1188('0x4d')][_0x1188('0x52')](_0x3486be)['then'](handleEntityNotFound(_0x5b17b6,null))[_0x1188('0x1e')](respondWithResult(_0x5b17b6,null))[_0x1188('0x28')](handleError(_0x5b17b6,null));};exports[_0x1188('0x53')]=function(_0x1269f2,_0x1b63de){return db[_0x1188('0x4d')][_0x1188('0x53')](_0x1269f2[_0x1188('0x54')],{})[_0x1188('0x1e')](respondWithResult(_0x1b63de,0xc9))[_0x1188('0x28')](handleError(_0x1b63de,null));};exports[_0x1188('0x55')]=function(_0x127599,_0x124020){if(_0x127599[_0x1188('0x54')]['id']){delete _0x127599['body']['id'];}return db['ServicenowAccount'][_0x1188('0x52')]({'where':{'id':_0x127599[_0x1188('0x50')]['id']}})[_0x1188('0x1e')](handleEntityNotFound(_0x124020,null))[_0x1188('0x1e')](saveUpdates(_0x127599[_0x1188('0x54')],null))['then'](respondWithResult(_0x124020,null))[_0x1188('0x28')](handleError(_0x124020,null));};exports[_0x1188('0x31')]=function(_0x15ffd5,_0x92c2c0){return db[_0x1188('0x4d')][_0x1188('0x52')]({'where':{'id':_0x15ffd5['params']['id']}})[_0x1188('0x1e')](handleEntityNotFound(_0x92c2c0,null))[_0x1188('0x1e')](removeEntity(_0x92c2c0,null))[_0x1188('0x28')](handleError(_0x92c2c0,null));};exports[_0x1188('0x56')]=function(_0x50240b,_0x28d160,_0x2c51b6){var _0x8629aa={};var _0x44b731={};var _0x8503cf;var _0x507af5;return db['ServicenowAccount']['findOne']({'where':{'id':_0x50240b[_0x1188('0x50')]['id']}})[_0x1188('0x1e')](handleEntityNotFound(_0x28d160,null))['then'](function(_0x22fe53){if(_0x22fe53){_0x8503cf=_0x22fe53;_0x44b731['model']=_[_0x1188('0x39')](db[_0x1188('0x57')][_0x1188('0x51')]);_0x44b731[_0x1188('0x38')]=_['keys'](_0x50240b[_0x1188('0x38')]);_0x44b731[_0x1188('0x3a')]=_[_0x1188('0x3d')](_0x44b731[_0x1188('0x3b')],_0x44b731[_0x1188('0x38')]);_0x8629aa[_0x1188('0x3c')]=_[_0x1188('0x3d')](_0x44b731[_0x1188('0x3b')],qs[_0x1188('0x3e')](_0x50240b['query'][_0x1188('0x3e')]));_0x8629aa[_0x1188('0x3c')]=_0x8629aa[_0x1188('0x3c')][_0x1188('0x3f')]?_0x8629aa['attributes']:_0x44b731[_0x1188('0x3b')];_0x8629aa[_0x1188('0x43')]=qs[_0x1188('0x44')](_0x50240b[_0x1188('0x38')][_0x1188('0x44')]);_0x8629aa[_0x1188('0x47')]=qs['filters'](_[_0x1188('0x45')](_0x50240b[_0x1188('0x38')],_0x44b731[_0x1188('0x3a')]));if(_0x50240b[_0x1188('0x38')][_0x1188('0x46')]){_0x8629aa[_0x1188('0x47')]=_['merge'](_0x8629aa['where'],{'$or':_['map'](_0x8629aa['attributes'],function(_0x307bb5){var _0x2117f7={};_0x2117f7[_0x307bb5]={'$like':'%'+_0x50240b[_0x1188('0x38')]['filter']+'%'};return _0x2117f7;})});}_0x8629aa=_[_0x1188('0x48')]({},_0x8629aa,_0x50240b[_0x1188('0x4a')]);return _0x8503cf[_0x1188('0x56')](_0x8629aa);}})[_0x1188('0x1e')](function(_0x4fe003){if(_0x4fe003){_0x507af5=_0x4fe003[_0x1188('0x3f')];if(!_0x50240b[_0x1188('0x38')]['hasOwnProperty'](_0x1188('0x41'))){_0x8629aa[_0x1188('0x2d')]=qs[_0x1188('0x2d')](_0x50240b[_0x1188('0x38')][_0x1188('0x2d')]);_0x8629aa['offset']=qs[_0x1188('0x42')](_0x50240b[_0x1188('0x38')]['offset']);}return _0x8503cf['getConfigurations'](_0x8629aa);}})[_0x1188('0x1e')](function(_0x3c275c){if(_0x3c275c){return _0x3c275c?{'count':_0x507af5,'rows':_0x3c275c}:null;}})['then'](respondWithResult(_0x28d160,null))[_0x1188('0x28')](handleError(_0x28d160,null));};exports[_0x1188('0x58')]=function(_0x18b41a,_0x549595,_0x1178d3){if(_0x18b41a['body']['id']){delete _0x18b41a[_0x1188('0x54')]['id'];}return db[_0x1188('0x4d')][_0x1188('0x59')]({'where':{'id':_0x18b41a['params']['id']}})[_0x1188('0x1e')](handleEntityNotFound(_0x549595,null))[_0x1188('0x1e')](function(_0x14aa09){if(_0x14aa09){_0x18b41a['body'][_0x1188('0x5a')]=_0x14aa09['id'];_0x18b41a[_0x1188('0x54')][_0x1188('0x5b')]=integrations[_0x1188('0x5c')](_0x18b41a[_0x1188('0x54')][_0x1188('0x5d')],_0x18b41a['body'][_0x1188('0x36')]);_0x18b41a[_0x1188('0x54')]['Descriptions']=integrations[_0x1188('0x5e')](_0x18b41a[_0x1188('0x54')][_0x1188('0x5d')],_0x18b41a[_0x1188('0x54')][_0x1188('0x36')]);return db['ServicenowConfiguration'][_0x1188('0x53')](_0x18b41a[_0x1188('0x54')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0x1188('0x5f')],'as':_0x1188('0x60')}]});}return null;})[_0x1188('0x1e')](respondWithResult(_0x549595,null))['catch'](handleError(_0x549595,null));};exports[_0x1188('0x61')]=function(_0x4dee3b,_0x349a07,_0x525101){var _0x1457e0=[_0x1188('0x62'),_0x1188('0x63'),_0x1188('0x64'),'subcategory',_0x1188('0x65'),_0x1188('0x66'),_0x1188('0x67'),'severity',_0x1188('0x68')];var _0x326135=[_0x1188('0x69'),_0x1188('0x62'),'caused_by',_0x1188('0x6a'),'upon_reject','sys_updated_on',_0x1188('0x6b'),_0x1188('0x63'),_0x1188('0x6c'),_0x1188('0x6d'),'resolved_by','sys_updated_by',_0x1188('0x6e'),_0x1188('0x6f'),'sys_created_on','sys_domain',_0x1188('0x70'),_0x1188('0x71'),_0x1188('0x64'),'order',_0x1188('0x72'),'closed_at',_0x1188('0x73'),_0x1188('0x74'),_0x1188('0x75'),'active',_0x1188('0x76'),_0x1188('0x77'),'priority',_0x1188('0x78'),_0x1188('0x79'),'time_worked',_0x1188('0x7a'),'opened_at',_0x1188('0x7b'),_0x1188('0x7c'),'work_end','reopened_time','resolved_at',_0x1188('0x7d'),_0x1188('0x7e'),'subcategory','work_notes',_0x1188('0x7f'),'close_code',_0x1188('0x80'),_0x1188('0x81'),_0x1188('0x82'),_0x1188('0x83'),'business_stc',_0x1188('0x84'),_0x1188('0x85'),'calendar_duration',_0x1188('0x66'),'sys_class_name','close_notes',_0x1188('0x86'),'follow_up',_0x1188('0x87'),_0x1188('0x88'),_0x1188('0x89'),'reopened_by','incident_state','urgency',_0x1188('0x8a'),_0x1188('0x8b'),_0x1188('0x8c'),_0x1188('0x8d'),'assigned_to',_0x1188('0x8e'),_0x1188('0x8f'),'sla_due','approval',_0x1188('0x90'),'due_date',_0x1188('0x91'),'reopen_count',_0x1188('0x92'),'escalation',_0x1188('0x93'),_0x1188('0x94'),_0x1188('0x95'),'category'];var _0x3e6332='';var _0x4b3bab='';var _0x4cd75d=[];var _0x191436='';var _0x4db53f='';var _0x2fac4c=[];var _0x55f86c='';var _0x2f8ddd='';var _0x5d73ab={};var _0x50d2b1='';return db['ServicenowAccount'][_0x1188('0x59')]({'where':{'id':_0x4dee3b['params']['id']},'attributes':['id',_0x1188('0x96'),_0x1188('0x97'),_0x1188('0x98'),_0x1188('0x99'),_0x1188('0x9a')]})[_0x1188('0x1e')](handleEntityNotFound(_0x349a07,null))['then'](function(_0x3c56d2){if(_0x3c56d2){_0x50d2b1=_0x3c56d2['remoteUri'];var _0x2b498f=_0x50d2b1[_0x1188('0x9b')](-0x1);if(_0x2b498f==='/'){_0x50d2b1=_0x50d2b1['substring'](0x0,_0x50d2b1[_0x1188('0x9c')](_0x2b498f));}_0x2f8ddd=util[_0x1188('0x9d')](_0x1188('0x9e'),_0x50d2b1);_0x55f86c=util['format'](_0x1188('0x9f'),_0x50d2b1);_0x5d73ab={'user':_0x3c56d2[_0x1188('0x96')],'pass':_0x3c56d2['password']};var _0x559da9={'method':'GET','uri':_0x2f8ddd+_0x1188('0xa0'),'auth':_0x5d73ab,'json':!![]};return rp(_0x559da9);}})[_0x1188('0x1e')](function(_0x546e32){if(_0x546e32[_0x1188('0x27')]['length']>0x0){_0x3e6332=_0x546e32[_0x1188('0x27')];}console[_0x1188('0xa1')](_0x1188('0xa2'),_0x3e6332);_0x2fac4c=[];_0x4b3bab=Object[_0x1188('0xa3')]([],_0x3e6332);_[_0x1188('0xa4')](_0x4b3bab,function(_0x3d9d89){return!_0x1457e0['includes'](_0x3d9d89[_0x1188('0x33')]);});_0x4b3bab[_0x1188('0xa5')](function(_0x4189ca){var _0x33311f=createFieldObject(_0x55f86c,_0x5d73ab,_0x4189ca[_0x1188('0xa6')],_0x4189ca[_0x1188('0x33')],_0x4189ca['label'],![]);_0x2fac4c[_0x1188('0xa7')](_0x33311f);});return Promise[_0x1188('0xa8')](_0x2fac4c);})[_0x1188('0x1e')](function(_0x3e802a){_0x4cd75d=_0x3e802a;_0x191436=Object[_0x1188('0xa3')]([],_0x3e6332);console['log']('TCL:\x20_object',_0x3e6332);_['remove'](_0x191436,function(_0x256efc){return _0x326135[_0x1188('0xa9')](_0x256efc[_0x1188('0x33')]);});console[_0x1188('0xa1')](_0x1188('0xaa'),_0x191436);_0x2fac4c=[];_0x191436['forEach'](function(_0xadfbba){var _0x2696e3=createFieldObject(_0x55f86c,_0x5d73ab,_0xadfbba[_0x1188('0xa6')],_0xadfbba[_0x1188('0x33')],_0xadfbba[_0x1188('0xab')],!![]);_0x2fac4c[_0x1188('0xa7')](_0x2696e3);});return Promise['all'](_0x2fac4c);})[_0x1188('0x1e')](function(_0x289240){_0x4db53f=_0x289240;var _0x133c6c=_0x4cd75d[_0x1188('0xac')](_0x4db53f);return{'count':_0x133c6c[_0x1188('0x3f')],'rows':_0x133c6c};})[_0x1188('0x1e')](respondWithResult(_0x349a07,null))['catch'](function(_0x375de8){console[_0x1188('0xa1')]('ServiceNow\x20error:\x20'+_0x375de8);var _0x6f2d56=_0x4dee3b[_0x1188('0x38')]['test']?0x1f4:_0x375de8[_0x1188('0xad')]||0x1f4;logger[_0x1188('0x24')](_0x375de8['stack']);delete _0x375de8['name'];if(_0x6f2d56===0x191){_0x6f2d56=0x190;}_0x349a07['status'](_0x6f2d56)[_0x1188('0x34')](_0x4dee3b[_0x1188('0x38')][_0x1188('0xae')]?{'message':_0x1188('0xaf'),'statusCode':_0x375de8[_0x1188('0xad')]}:_0x375de8);});};function createFieldObject(_0x72bec,_0x10df5a,_0x282c1b,_0x366e36,_0x47a735,_0x2ba8aa){return new Promise(function(_0x5336e4,_0x203d54){var _0x53526f={'id':_0x366e36,'name':_0x47a735,'custom':_0x2ba8aa};if(_0x282c1b===_0x1188('0xb0')){_0x53526f[_0x1188('0x4a')]=[{'name':_0x1188('0xb1'),'value':_0x1188('0xb2')},{'name':_0x1188('0xb3'),'value':_0x1188('0xb4')}];_0x5336e4(_0x53526f);}else{var _0x2f6e03={'method':_0x1188('0xb5'),'uri':_0x72bec+_0x1188('0xb6')+_0x366e36,'auth':_0x10df5a,'json':!![]};return rp(_0x2f6e03)['then'](function(_0x341454){var _0x388b2f=[];if(_0x341454[_0x1188('0x27')][_0x1188('0x3f')]>0x0){_0x341454[_0x1188('0x27')]['forEach'](function(_0x149eb1){if(_0x149eb1[_0x1188('0xb7')]===_0x1188('0xb4')){var _0x2731f3={'name':_0x149eb1[_0x1188('0xab')],'value':_0x149eb1[_0x1188('0xb8')]};_0x388b2f[_0x1188('0xa7')](_0x2731f3);}});}_0x53526f[_0x1188('0x4a')]=_0x388b2f;if(_0x53526f['options'][_0x1188('0x3f')]>0x0){_0x5336e4(_0x53526f);}else{if(_0x2ba8aa==![]){_0x5336e4();}else{_0x5336e4(_0x53526f);}}});}});} \ No newline at end of file +var _0x7a0b=['info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','map','ServicenowAccount','rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','length','filter','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','priority','sys_domain_path','time_worked','opened_at','group_list','reopened_time','resolved_at','subcategory','work_notes','correlation_display','work_start','assignment_group','additional_assignee_list','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','sla_due','due_date','reopen_count','escalation','upon_approval','username','password','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','statusCode','send','Wrong\x20credentials','boolean','True','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','rimraf','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then'];(function(_0xe3c9fe,_0x53a50e){var _0x390dce=function(_0x56c04c){while(--_0x56c04c){_0xe3c9fe['push'](_0xe3c9fe['shift']());}};_0x390dce(++_0x53a50e);}(_0x7a0b,0x159));var _0xb7a0=function(_0x32becb,_0x5511ac){_0x32becb=_0x32becb-0x0;var _0x20431a=_0x7a0b[_0x32becb];return _0x20431a;};'use strict';var pdf=require(_0xb7a0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb7a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7a0('0x2'));var rp=require(_0xb7a0('0x3'));var moment=require(_0xb7a0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb7a0('0x5'));var util=require(_0xb7a0('0x6'));var path=require(_0xb7a0('0x7'));var sox=require(_0xb7a0('0x8'));var csv=require(_0xb7a0('0x9'));var ejs=require(_0xb7a0('0xa'));var fs=require('fs');var _=require(_0xb7a0('0xb'));var squel=require('squel');var crypto=require(_0xb7a0('0xc'));var jsforce=require(_0xb7a0('0xd'));var deskjs=require(_0xb7a0('0xe'));var toCsv=require(_0xb7a0('0x9'));var querystring=require(_0xb7a0('0xf'));var Papa=require(_0xb7a0('0x10'));var Redis=require('ioredis');var authService=require(_0xb7a0('0x11'));var qs=require(_0xb7a0('0x12'));var as=require(_0xb7a0('0x13'));var hardwareService=require(_0xb7a0('0x14'));var logger=require('../../config/logger')(_0xb7a0('0x15'));var utils=require(_0xb7a0('0x16'));var config=require(_0xb7a0('0x17'));var licenseUtil=require(_0xb7a0('0x18'));var db=require(_0xb7a0('0x19'))['db'];var integrations=require(_0xb7a0('0x1a'));var jayson=require(_0xb7a0('0x1b'));var client=jayson[_0xb7a0('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x222648,_0x3b3129,_0x2c6a20,_0x5be11e){return new BPromise(function(_0x5f2601,_0x2e4d8f){var _0x348a54=_0x5be11e||client;return _0x348a54[_0xb7a0('0x1d')](_0x222648,_0x2c6a20)[_0xb7a0('0x1e')](function(_0x293bc1){logger[_0xb7a0('0x1f')](_0xb7a0('0x20'),_0x3b3129,_0xb7a0('0x21'));logger[_0xb7a0('0x22')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3b3129,_0xb7a0('0x21'),JSON[_0xb7a0('0x23')](_0x293bc1));if(_0x293bc1['error']){if(_0x293bc1['error'][_0xb7a0('0x24')]===0x1f4){logger[_0xb7a0('0x25')]('ServicenowAccount,\x20%s,\x20%s',_0x3b3129,_0x293bc1[_0xb7a0('0x25')]['message']);return _0x2e4d8f(_0x293bc1['error'][_0xb7a0('0x26')]);}logger['error'](_0xb7a0('0x20'),_0x3b3129,_0x293bc1[_0xb7a0('0x25')][_0xb7a0('0x26')]);return _0x5f2601(_0x293bc1[_0xb7a0('0x25')][_0xb7a0('0x26')]);}else{logger[_0xb7a0('0x1f')](_0xb7a0('0x20'),_0x3b3129,'request\x20sent');_0x5f2601(_0x293bc1['result'][_0xb7a0('0x26')]);}})['catch'](function(_0x3bf957){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x3b3129,_0x3bf957);_0x2e4d8f(_0x3bf957);});});}function respondWithStatusCode(_0xcf7367,_0x46d19){_0x46d19=_0x46d19||0xcc;return function(_0x10f268){if(_0x10f268){return _0xcf7367[_0xb7a0('0x27')](_0x46d19);}return _0xcf7367[_0xb7a0('0x28')](_0x46d19)[_0xb7a0('0x29')]();};}function respondWithResult(_0x5e4b23,_0x349ea6){_0x349ea6=_0x349ea6||0xc8;return function(_0x5e3312){if(_0x5e3312){return _0x5e4b23[_0xb7a0('0x28')](_0x349ea6)[_0xb7a0('0x2a')](_0x5e3312);}};}function respondWithFilteredResult(_0x5b6fe2,_0x1b66ed){return function(_0xfafd85){if(_0xfafd85){var _0x533cc1=_0xfafd85[_0xb7a0('0x2b')],_0x152e6f=_0x1b66ed['offset'],_0x1f58bc=_0x1b66ed[_0xb7a0('0x2c')]+_0x1b66ed[_0xb7a0('0x2d')],_0x366bed;if(_0x1f58bc>=_0x533cc1){_0x1f58bc=_0x533cc1;_0x366bed=0xc8;}else{_0x366bed=0xce;}_0x5b6fe2['status'](_0x366bed);return _0x5b6fe2[_0xb7a0('0x2e')]('Content-Range',_0x152e6f+'-'+_0x1f58bc+'/'+_0x533cc1)[_0xb7a0('0x2a')](_0xfafd85);}return null;};}function patchUpdates(_0x15504c){return function(_0xcfa72b){try{jsonpatch[_0xb7a0('0x2f')](_0xcfa72b,_0x15504c,!![]);}catch(_0x2e6d0b){return BPromise[_0xb7a0('0x30')](_0x2e6d0b);}return _0xcfa72b[_0xb7a0('0x31')]();};}function saveUpdates(_0x3ce356,_0x47dfdb){return function(_0x5636bd){if(_0x5636bd){return _0x5636bd[_0xb7a0('0x32')](_0x3ce356)[_0xb7a0('0x1e')](function(_0x3652d1){return _0x3652d1;});}return null;};}function removeEntity(_0x309111,_0x5b974b){return function(_0x57994f){if(_0x57994f){return _0x57994f[_0xb7a0('0x33')]()['then'](function(){_0x309111[_0xb7a0('0x28')](0xcc)[_0xb7a0('0x29')]();});}};}function handleEntityNotFound(_0x523274,_0x3264ee){return function(_0x1b12c9){if(!_0x1b12c9){_0x523274[_0xb7a0('0x27')](0x194);}return _0x1b12c9;};}function handleError(_0x44a6cc,_0x43e1de){_0x43e1de=_0x43e1de||0x1f4;return function(_0x1b1dbd){logger['error'](_0x1b1dbd[_0xb7a0('0x34')]);if(_0x1b1dbd['name']){delete _0x1b1dbd['name'];}_0x44a6cc['status'](_0x43e1de)['send'](_0x1b1dbd);};}exports['index']=function(_0x40a75d,_0x463e5e){var _0x13451f={},_0x32c6e7={},_0x47c623={'count':0x0,'rows':[]};var _0x1503c9=_[_0xb7a0('0x35')](db[_0xb7a0('0x36')][_0xb7a0('0x37')],function(_0x356763){return{'name':_0x356763[_0xb7a0('0x38')],'type':_0x356763[_0xb7a0('0x39')]['key']};});_0x32c6e7['model']=_['map'](_0x1503c9,_0xb7a0('0x3a'));_0x32c6e7[_0xb7a0('0x3b')]=_[_0xb7a0('0x3c')](_0x40a75d[_0xb7a0('0x3b')]);_0x32c6e7[_0xb7a0('0x3d')]=_[_0xb7a0('0x3e')](_0x32c6e7[_0xb7a0('0x3f')],_0x32c6e7['query']);_0x13451f[_0xb7a0('0x40')]=_[_0xb7a0('0x3e')](_0x32c6e7['model'],qs['fields'](_0x40a75d[_0xb7a0('0x3b')][_0xb7a0('0x41')]));_0x13451f[_0xb7a0('0x40')]=_0x13451f['attributes']['length']?_0x13451f[_0xb7a0('0x40')]:_0x32c6e7['model'];if(!_0x40a75d['query']['hasOwnProperty'](_0xb7a0('0x42'))){_0x13451f[_0xb7a0('0x2d')]=qs['limit'](_0x40a75d[_0xb7a0('0x3b')][_0xb7a0('0x2d')]);_0x13451f['offset']=qs['offset'](_0x40a75d['query'][_0xb7a0('0x2c')]);}_0x13451f[_0xb7a0('0x43')]=qs[_0xb7a0('0x44')](_0x40a75d[_0xb7a0('0x3b')][_0xb7a0('0x44')]);_0x13451f[_0xb7a0('0x45')]=qs[_0xb7a0('0x3d')](_[_0xb7a0('0x46')](_0x40a75d[_0xb7a0('0x3b')],_0x32c6e7[_0xb7a0('0x3d')]),_0x1503c9);if(_0x40a75d[_0xb7a0('0x3b')]['filter']){_0x13451f['where']=_[_0xb7a0('0x47')](_0x13451f[_0xb7a0('0x45')],{'$or':_[_0xb7a0('0x35')](_0x1503c9,function(_0x4c1da2){if(_0x4c1da2[_0xb7a0('0x39')]!==_0xb7a0('0x48')){var _0x52f0b0={};_0x52f0b0[_0x4c1da2[_0xb7a0('0x3a')]]={'$like':'%'+_0x40a75d['query']['filter']+'%'};return _0x52f0b0;}})});}_0x13451f=_['merge']({},_0x13451f,_0x40a75d[_0xb7a0('0x49')]);var _0x4028ce={'where':_0x13451f[_0xb7a0('0x45')]};return db[_0xb7a0('0x36')][_0xb7a0('0x2b')](_0x4028ce)[_0xb7a0('0x1e')](function(_0x347589){_0x47c623['count']=_0x347589;if(_0x40a75d[_0xb7a0('0x3b')]['includeAll']){_0x13451f[_0xb7a0('0x4a')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xb7a0('0x4b')](_0x13451f);})['then'](function(_0xb92b61){_0x47c623[_0xb7a0('0x4c')]=_0xb92b61;return _0x47c623;})[_0xb7a0('0x1e')](respondWithFilteredResult(_0x463e5e,_0x13451f))[_0xb7a0('0x4d')](handleError(_0x463e5e,null));};exports[_0xb7a0('0x4e')]=function(_0x368a3c,_0x4ae87c){var _0x4ad35d={'raw':![],'where':{'id':_0x368a3c[_0xb7a0('0x4f')]['id']}},_0x84874c={};_0x84874c[_0xb7a0('0x3f')]=_[_0xb7a0('0x3c')](db[_0xb7a0('0x36')]['rawAttributes']);_0x84874c[_0xb7a0('0x3b')]=_[_0xb7a0('0x3c')](_0x368a3c['query']);_0x84874c[_0xb7a0('0x3d')]=_[_0xb7a0('0x3e')](_0x84874c[_0xb7a0('0x3f')],_0x84874c[_0xb7a0('0x3b')]);_0x4ad35d[_0xb7a0('0x40')]=_['intersection'](_0x84874c[_0xb7a0('0x3f')],qs[_0xb7a0('0x41')](_0x368a3c[_0xb7a0('0x3b')][_0xb7a0('0x41')]));_0x4ad35d[_0xb7a0('0x40')]=_0x4ad35d[_0xb7a0('0x40')]['length']?_0x4ad35d[_0xb7a0('0x40')]:_0x84874c['model'];if(_0x368a3c[_0xb7a0('0x3b')][_0xb7a0('0x50')]){_0x4ad35d[_0xb7a0('0x4a')]=[{'all':!![]}];}_0x4ad35d=_[_0xb7a0('0x47')]({},_0x4ad35d,_0x368a3c[_0xb7a0('0x49')]);return db[_0xb7a0('0x36')][_0xb7a0('0x51')](_0x4ad35d)['then'](handleEntityNotFound(_0x4ae87c,null))[_0xb7a0('0x1e')](respondWithResult(_0x4ae87c,null))[_0xb7a0('0x4d')](handleError(_0x4ae87c,null));};exports[_0xb7a0('0x52')]=function(_0x333a3a,_0x1b9b99){return db[_0xb7a0('0x36')][_0xb7a0('0x52')](_0x333a3a[_0xb7a0('0x53')],{})[_0xb7a0('0x1e')](respondWithResult(_0x1b9b99,0xc9))[_0xb7a0('0x4d')](handleError(_0x1b9b99,null));};exports[_0xb7a0('0x32')]=function(_0x56c77b,_0x39d283){if(_0x56c77b[_0xb7a0('0x53')]['id']){delete _0x56c77b[_0xb7a0('0x53')]['id'];}return db[_0xb7a0('0x36')][_0xb7a0('0x51')]({'where':{'id':_0x56c77b['params']['id']}})[_0xb7a0('0x1e')](handleEntityNotFound(_0x39d283,null))[_0xb7a0('0x1e')](saveUpdates(_0x56c77b[_0xb7a0('0x53')],null))[_0xb7a0('0x1e')](respondWithResult(_0x39d283,null))[_0xb7a0('0x4d')](handleError(_0x39d283,null));};exports[_0xb7a0('0x33')]=function(_0x5c3e8f,_0x441354){return db['ServicenowAccount']['find']({'where':{'id':_0x5c3e8f[_0xb7a0('0x4f')]['id']}})[_0xb7a0('0x1e')](handleEntityNotFound(_0x441354,null))[_0xb7a0('0x1e')](removeEntity(_0x441354,null))[_0xb7a0('0x4d')](handleError(_0x441354,null));};exports[_0xb7a0('0x54')]=function(_0x2a20b5,_0x2c1b04,_0x97a520){var _0x372ef0={};var _0xc69474={};var _0x3029a7;var _0x36e93e;return db[_0xb7a0('0x36')][_0xb7a0('0x55')]({'where':{'id':_0x2a20b5[_0xb7a0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2c1b04,null))[_0xb7a0('0x1e')](function(_0x3da50e){if(_0x3da50e){_0x3029a7=_0x3da50e;_0xc69474['model']=_[_0xb7a0('0x3c')](db['ServicenowConfiguration'][_0xb7a0('0x37')]);_0xc69474[_0xb7a0('0x3b')]=_['keys'](_0x2a20b5[_0xb7a0('0x3b')]);_0xc69474[_0xb7a0('0x3d')]=_[_0xb7a0('0x3e')](_0xc69474['model'],_0xc69474[_0xb7a0('0x3b')]);_0x372ef0[_0xb7a0('0x40')]=_[_0xb7a0('0x3e')](_0xc69474[_0xb7a0('0x3f')],qs['fields'](_0x2a20b5[_0xb7a0('0x3b')][_0xb7a0('0x41')]));_0x372ef0[_0xb7a0('0x40')]=_0x372ef0[_0xb7a0('0x40')][_0xb7a0('0x56')]?_0x372ef0[_0xb7a0('0x40')]:_0xc69474[_0xb7a0('0x3f')];_0x372ef0[_0xb7a0('0x43')]=qs['sort'](_0x2a20b5['query'][_0xb7a0('0x44')]);_0x372ef0[_0xb7a0('0x45')]=qs[_0xb7a0('0x3d')](_[_0xb7a0('0x46')](_0x2a20b5['query'],_0xc69474[_0xb7a0('0x3d')]));if(_0x2a20b5[_0xb7a0('0x3b')][_0xb7a0('0x57')]){_0x372ef0[_0xb7a0('0x45')]=_['merge'](_0x372ef0['where'],{'$or':_['map'](_0x372ef0[_0xb7a0('0x40')],function(_0x41fd48){var _0x50f552={};_0x50f552[_0x41fd48]={'$like':'%'+_0x2a20b5[_0xb7a0('0x3b')]['filter']+'%'};return _0x50f552;})});}_0x372ef0=_[_0xb7a0('0x47')]({},_0x372ef0,_0x2a20b5[_0xb7a0('0x49')]);return _0x3029a7[_0xb7a0('0x54')](_0x372ef0);}})['then'](function(_0xce5ffa){if(_0xce5ffa){_0x36e93e=_0xce5ffa[_0xb7a0('0x56')];if(!_0x2a20b5[_0xb7a0('0x3b')][_0xb7a0('0x58')](_0xb7a0('0x42'))){_0x372ef0[_0xb7a0('0x2d')]=qs[_0xb7a0('0x2d')](_0x2a20b5[_0xb7a0('0x3b')][_0xb7a0('0x2d')]);_0x372ef0[_0xb7a0('0x2c')]=qs[_0xb7a0('0x2c')](_0x2a20b5[_0xb7a0('0x3b')][_0xb7a0('0x2c')]);}return _0x3029a7[_0xb7a0('0x54')](_0x372ef0);}})[_0xb7a0('0x1e')](function(_0x39c893){if(_0x39c893){return _0x39c893?{'count':_0x36e93e,'rows':_0x39c893}:null;}})[_0xb7a0('0x1e')](respondWithResult(_0x2c1b04,null))['catch'](handleError(_0x2c1b04,null));};exports[_0xb7a0('0x59')]=function(_0x4db3f5,_0xb37643,_0x5f3af3){if(_0x4db3f5['body']['id']){delete _0x4db3f5['body']['id'];}return db[_0xb7a0('0x36')][_0xb7a0('0x55')]({'where':{'id':_0x4db3f5[_0xb7a0('0x4f')]['id']}})[_0xb7a0('0x1e')](handleEntityNotFound(_0xb37643,null))[_0xb7a0('0x1e')](function(_0x276c2e){if(_0x276c2e){_0x4db3f5[_0xb7a0('0x53')][_0xb7a0('0x5a')]=_0x276c2e['id'];_0x4db3f5[_0xb7a0('0x53')][_0xb7a0('0x5b')]=integrations[_0xb7a0('0x5c')](_0x4db3f5[_0xb7a0('0x53')][_0xb7a0('0x5d')],_0x4db3f5[_0xb7a0('0x53')][_0xb7a0('0x39')]);_0x4db3f5[_0xb7a0('0x53')][_0xb7a0('0x5e')]=integrations['getDescriptions'](_0x4db3f5['body'][_0xb7a0('0x5d')],_0x4db3f5['body'][_0xb7a0('0x39')]);return db['ServicenowConfiguration'][_0xb7a0('0x52')](_0x4db3f5[_0xb7a0('0x53')],{'include':[{'model':db[_0xb7a0('0x5f')],'as':_0xb7a0('0x5b')},{'model':db['ServicenowField'],'as':_0xb7a0('0x5e')}]});}return null;})[_0xb7a0('0x1e')](respondWithResult(_0xb37643,null))[_0xb7a0('0x4d')](handleError(_0xb37643,null));};exports[_0xb7a0('0x60')]=function(_0x29b5e4,_0x2e4b57,_0x293d39){var _0x24a92f=[_0xb7a0('0x61'),_0xb7a0('0x62'),_0xb7a0('0x63'),'subcategory','close_code',_0xb7a0('0x64'),_0xb7a0('0x65'),'severity',_0xb7a0('0x66')];var _0x3adb87=[_0xb7a0('0x67'),'made_sla',_0xb7a0('0x68'),_0xb7a0('0x69'),_0xb7a0('0x6a'),_0xb7a0('0x6b'),_0xb7a0('0x6c'),_0xb7a0('0x62'),_0xb7a0('0x6d'),'number',_0xb7a0('0x6e'),_0xb7a0('0x6f'),_0xb7a0('0x70'),'user_input',_0xb7a0('0x71'),_0xb7a0('0x72'),'state',_0xb7a0('0x73'),'knowledge',_0xb7a0('0x43'),_0xb7a0('0x74'),_0xb7a0('0x75'),'cmdb_ci',_0xb7a0('0x76'),_0xb7a0('0x77'),_0xb7a0('0x78'),'work_notes_list','business_service',_0xb7a0('0x79'),_0xb7a0('0x7a'),'rfc',_0xb7a0('0x7b'),'expected_start',_0xb7a0('0x7c'),'business_duration',_0xb7a0('0x7d'),'work_end',_0xb7a0('0x7e'),_0xb7a0('0x7f'),'caller_id','approval_set',_0xb7a0('0x80'),_0xb7a0('0x81'),'short_description','close_code',_0xb7a0('0x82'),'delivery_task',_0xb7a0('0x83'),_0xb7a0('0x84'),'business_stc',_0xb7a0('0x85'),'description',_0xb7a0('0x86'),_0xb7a0('0x64'),_0xb7a0('0x87'),_0xb7a0('0x88'),'closed_by',_0xb7a0('0x89'),_0xb7a0('0x8a'),_0xb7a0('0x8b'),'contact_type',_0xb7a0('0x8c'),_0xb7a0('0x65'),_0xb7a0('0x8d'),_0xb7a0('0x8e'),_0xb7a0('0x8f'),_0xb7a0('0x90'),_0xb7a0('0x91'),'assigned_to','severity','comments',_0xb7a0('0x92'),'approval','comments_and_work_notes',_0xb7a0('0x93'),'sys_mod_count',_0xb7a0('0x94'),'sys_tags',_0xb7a0('0x95'),_0xb7a0('0x96'),'correlation_id','location',_0xb7a0('0x66')];var _0x26469a='';var _0x242b14='';var _0x3c5af5=[];var _0x588f6d='';var _0x240272='';var _0x4f8e61=[];var _0x2fc9ac='';var _0x1ba904='';var _0x203323={};var _0x12ef86='';return db[_0xb7a0('0x36')][_0xb7a0('0x55')]({'where':{'id':_0x29b5e4[_0xb7a0('0x4f')]['id']},'attributes':['id',_0xb7a0('0x97'),_0xb7a0('0x98'),'email',_0xb7a0('0x99'),'serverUrl']})[_0xb7a0('0x1e')](handleEntityNotFound(_0x2e4b57,null))[_0xb7a0('0x1e')](function(_0x182eff){if(_0x182eff){_0x12ef86=_0x182eff[_0xb7a0('0x99')];var _0x21de9c=_0x12ef86[_0xb7a0('0x9a')](-0x1);if(_0x21de9c==='/'){_0x12ef86=_0x12ef86[_0xb7a0('0x9b')](0x0,_0x12ef86[_0xb7a0('0x9c')](_0x21de9c));}_0x1ba904=util[_0xb7a0('0x9d')](_0xb7a0('0x9e'),_0x12ef86);_0x2fc9ac=util['format']('%s/api/now/table/',_0x12ef86);_0x203323={'user':_0x182eff['username'],'pass':_0x182eff[_0xb7a0('0x98')]};var _0x3a1fd0={'method':'GET','uri':_0x1ba904+_0xb7a0('0x9f'),'auth':_0x203323,'json':!![]};return rp(_0x3a1fd0);}})[_0xb7a0('0x1e')](function(_0x26e588){if(_0x26e588[_0xb7a0('0xa0')][_0xb7a0('0x56')]>0x0){_0x26469a=_0x26e588[_0xb7a0('0xa0')];}console[_0xb7a0('0xa1')](_0xb7a0('0xa2'),_0x26469a);_0x4f8e61=[];_0x242b14=Object[_0xb7a0('0xa3')]([],_0x26469a);_[_0xb7a0('0xa4')](_0x242b14,function(_0x57d303){return!_0x24a92f[_0xb7a0('0xa5')](_0x57d303['name']);});_0x242b14[_0xb7a0('0xa6')](function(_0x45ded4){var _0x3ae74a=createFieldObject(_0x2fc9ac,_0x203323,_0x45ded4[_0xb7a0('0xa7')],_0x45ded4[_0xb7a0('0x3a')],_0x45ded4[_0xb7a0('0xa8')],![]);_0x4f8e61['push'](_0x3ae74a);});return Promise[_0xb7a0('0xa9')](_0x4f8e61);})[_0xb7a0('0x1e')](function(_0x4fe3f4){_0x3c5af5=_0x4fe3f4;_0x588f6d=Object[_0xb7a0('0xa3')]([],_0x26469a);console[_0xb7a0('0xa1')](_0xb7a0('0xaa'),_0x26469a);_[_0xb7a0('0xa4')](_0x588f6d,function(_0x28a054){return _0x3adb87[_0xb7a0('0xa5')](_0x28a054[_0xb7a0('0x3a')]);});console[_0xb7a0('0xa1')](_0xb7a0('0xab'),_0x588f6d);_0x4f8e61=[];_0x588f6d[_0xb7a0('0xa6')](function(_0x5cc912){var _0x137eb3=createFieldObject(_0x2fc9ac,_0x203323,_0x5cc912[_0xb7a0('0xa7')],_0x5cc912[_0xb7a0('0x3a')],_0x5cc912[_0xb7a0('0xa8')],!![]);_0x4f8e61[_0xb7a0('0xac')](_0x137eb3);});return Promise[_0xb7a0('0xa9')](_0x4f8e61);})[_0xb7a0('0x1e')](function(_0x1fbca0){_0x240272=_0x1fbca0;var _0x392472=_0x3c5af5[_0xb7a0('0xad')](_0x240272);return{'count':_0x392472['length'],'rows':_0x392472};})[_0xb7a0('0x1e')](respondWithResult(_0x2e4b57,null))['catch'](function(_0x3e3a56){console['log'](_0xb7a0('0xae')+_0x3e3a56);var _0x47ccb8=_0x29b5e4[_0xb7a0('0x3b')][_0xb7a0('0xaf')]?0x1f4:_0x3e3a56[_0xb7a0('0xb0')]||0x1f4;logger[_0xb7a0('0x25')](_0x3e3a56[_0xb7a0('0x34')]);delete _0x3e3a56['name'];if(_0x47ccb8===0x191){_0x47ccb8=0x190;}_0x2e4b57[_0xb7a0('0x28')](_0x47ccb8)[_0xb7a0('0xb1')](_0x29b5e4[_0xb7a0('0x3b')]['test']?{'message':_0xb7a0('0xb2'),'statusCode':_0x3e3a56['statusCode']}:_0x3e3a56);});};function createFieldObject(_0x3f8a42,_0x32f990,_0x35f401,_0xd027aa,_0xc821e4,_0x102f87){return new Promise(function(_0x6bfb2,_0x459a5f){var _0x38569a={'id':_0xd027aa,'name':_0xc821e4,'custom':_0x102f87};if(_0x35f401===_0xb7a0('0xb3')){_0x38569a['options']=[{'name':_0xb7a0('0xb4'),'value':_0xb7a0('0xb5')},{'name':_0xb7a0('0xb6'),'value':_0xb7a0('0xb7')}];_0x6bfb2(_0x38569a);}else{var _0x4a0449={'method':_0xb7a0('0xb8'),'uri':_0x3f8a42+_0xb7a0('0xb9')+_0xd027aa,'auth':_0x32f990,'json':!![]};return rp(_0x4a0449)[_0xb7a0('0x1e')](function(_0x5b0a30){var _0x4266ff=[];if(_0x5b0a30[_0xb7a0('0xa0')]['length']>0x0){_0x5b0a30[_0xb7a0('0xa0')][_0xb7a0('0xa6')](function(_0x800dbc){if(_0x800dbc[_0xb7a0('0xba')]===_0xb7a0('0xb7')){var _0x6bae18={'name':_0x800dbc['label'],'value':_0x800dbc[_0xb7a0('0xbb')]};_0x4266ff['push'](_0x6bae18);}});}_0x38569a[_0xb7a0('0x49')]=_0x4266ff;if(_0x38569a[_0xb7a0('0x49')][_0xb7a0('0x56')]>0x0){_0x6bfb2(_0x38569a);}else{if(_0x102f87==![]){_0x6bfb2();}else{_0x6bfb2(_0x38569a);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 961a546..5744f47 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 _0x425d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash'];(function(_0xf532eb,_0x32a0be){var _0x2375aa=function(_0x7d4d7c){while(--_0x7d4d7c){_0xf532eb['push'](_0xf532eb['shift']());}};_0x2375aa(++_0x32a0be);}(_0x425d,0x1e0));var _0xd425=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0x425d[_0x323430];return _0x9eecd1;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var logger=require(_0xd425('0x1'))(_0xd425('0x2'));var moment=require(_0xd425('0x3'));var BPromise=require(_0xd425('0x4'));var rp=require(_0xd425('0x5'));var fs=require('fs');var path=require(_0xd425('0x6'));var rimraf=require(_0xd425('0x7'));var config=require('../../config/environment');var attributes=require(_0xd425('0x8'));var integrations=require(_0xd425('0x9'));module[_0xd425('0xa')]=function(_0x36866e,_0x1d97d9){return _0x36866e[_0xd425('0xb')]('ServicenowAccount',attributes,{'tableName':_0xd425('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72b1=['define','int_servicenow_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x1dc69c,_0x524817){var _0x523093=function(_0x5ab424){while(--_0x5ab424){_0x1dc69c['push'](_0x1dc69c['shift']());}};_0x523093(++_0x524817);}(_0x72b1,0x16e));var _0x172b=function(_0x49e2ca,_0x3ccd77){_0x49e2ca=_0x49e2ca-0x0;var _0x320127=_0x72b1[_0x49e2ca];return _0x320127;};'use strict';var _=require(_0x172b('0x0'));var util=require('util');var logger=require(_0x172b('0x1'))(_0x172b('0x2'));var moment=require(_0x172b('0x3'));var BPromise=require(_0x172b('0x4'));var rp=require(_0x172b('0x5'));var fs=require('fs');var path=require(_0x172b('0x6'));var rimraf=require(_0x172b('0x7'));var config=require('../../config/environment');var attributes=require(_0x172b('0x8'));var integrations=require(_0x172b('0x9'));module[_0x172b('0xa')]=function(_0x222624,_0x571994){return _0x222624[_0x172b('0xb')]('ServicenowAccount',attributes,{'tableName':_0x172b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 75379a8..531e139 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 _0x3584=['model','attributes','GetServicenowAccount','stringify','ShowServicenowAccount','find','info','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','ServicenowAccount','findAll','options','raw','where','limit','include','map'];(function(_0x10a8d8,_0x28f292){var _0x3b2b79=function(_0x55a3fe){while(--_0x55a3fe){_0x10a8d8['push'](_0x10a8d8['shift']());}};_0x3b2b79(++_0x28f292);}(_0x3584,0x1cf));var _0x4358=function(_0x134035,_0x189313){_0x134035=_0x134035-0x0;var _0x2b10fd=_0x3584[_0x134035];return _0x2b10fd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4358('0x0'));var BPromise=require(_0x4358('0x1'));var rs=require(_0x4358('0x2'));var fs=require('fs');var Redis=require(_0x4358('0x3'));var db=require(_0x4358('0x4'))['db'];var utils=require(_0x4358('0x5'));var logger=require(_0x4358('0x6'))(_0x4358('0x7'));var config=require(_0x4358('0x8'));var jayson=require(_0x4358('0x9'));var client=jayson[_0x4358('0xa')][_0x4358('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ef8b,_0x17bbad,_0x2c700c){return new BPromise(function(_0x509c60,_0x50f1a0){return client[_0x4358('0xc')](_0x47ef8b,_0x2c700c)[_0x4358('0xd')](function(_0x235d7a){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x17bbad,_0x4358('0xe'));logger[_0x4358('0xf')](_0x4358('0x10'),_0x17bbad,_0x4358('0xe'),JSON['stringify'](_0x235d7a));if(_0x235d7a[_0x4358('0x11')]){if(_0x235d7a['error'][_0x4358('0x12')]===0x1f4){logger[_0x4358('0x11')](_0x4358('0x13'),_0x17bbad,_0x235d7a[_0x4358('0x11')][_0x4358('0x14')]);return _0x50f1a0(_0x235d7a[_0x4358('0x11')][_0x4358('0x14')]);}logger[_0x4358('0x11')](_0x4358('0x13'),_0x17bbad,_0x235d7a[_0x4358('0x11')][_0x4358('0x14')]);return _0x509c60(_0x235d7a['error'][_0x4358('0x14')]);}else{logger['info'](_0x4358('0x13'),_0x17bbad,_0x4358('0xe'));_0x509c60(_0x235d7a[_0x4358('0x15')][_0x4358('0x14')]);}})[_0x4358('0x16')](function(_0x8ce263){logger[_0x4358('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x17bbad,_0x8ce263);_0x50f1a0(_0x8ce263);});});}exports['GetServicenowAccount']=function(_0x311c4f){var _0x11e095=this;return new Promise(function(_0xf2ebe,_0x5a06ad){return db[_0x4358('0x17')][_0x4358('0x18')]({'raw':_0x311c4f[_0x4358('0x19')]?_0x311c4f['options'][_0x4358('0x1a')]===undefined?!![]:![]:!![],'where':_0x311c4f[_0x4358('0x19')]?_0x311c4f[_0x4358('0x19')][_0x4358('0x1b')]||null:null,'attributes':_0x311c4f['options']?_0x311c4f['options']['attributes']||null:null,'limit':_0x311c4f[_0x4358('0x19')]?_0x311c4f[_0x4358('0x19')][_0x4358('0x1c')]||null:null,'include':_0x311c4f[_0x4358('0x19')]?_0x311c4f['options'][_0x4358('0x1d')]?_[_0x4358('0x1e')](_0x311c4f[_0x4358('0x19')][_0x4358('0x1d')],function(_0x40fcc2){return{'model':db[_0x40fcc2[_0x4358('0x1f')]],'as':_0x40fcc2['as'],'attributes':_0x40fcc2['attributes'],'include':_0x40fcc2[_0x4358('0x1d')]?_[_0x4358('0x1e')](_0x40fcc2[_0x4358('0x1d')],function(_0x6d8484){return{'model':db[_0x6d8484[_0x4358('0x1f')]],'as':_0x6d8484['as'],'attributes':_0x6d8484[_0x4358('0x20')],'include':_0x6d8484['include']?_[_0x4358('0x1e')](_0x6d8484['include'],function(_0x5394df){return{'model':db[_0x5394df[_0x4358('0x1f')]],'as':_0x5394df['as'],'attributes':_0x5394df['attributes']};}):[]};}):[]};}):[]:[]})[_0x4358('0xd')](function(_0x91e4ed){logger['info'](_0x4358('0x21'),_0x311c4f);logger[_0x4358('0xf')](_0x4358('0x21'),_0x311c4f,JSON[_0x4358('0x22')](_0x91e4ed));_0xf2ebe(_0x91e4ed);})['catch'](function(_0x431885){logger[_0x4358('0x11')](_0x4358('0x21'),_0x431885[_0x4358('0x14')],_0x311c4f);_0x5a06ad(_0x11e095[_0x4358('0x11')](0x1f4,_0x431885[_0x4358('0x14')]));});});};exports[_0x4358('0x23')]=function(_0x28d410){var _0x259f86=this;return new Promise(function(_0x492863,_0x32038d){return db[_0x4358('0x17')][_0x4358('0x24')]({'raw':_0x28d410[_0x4358('0x19')]?_0x28d410[_0x4358('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x28d410[_0x4358('0x19')]?_0x28d410[_0x4358('0x19')][_0x4358('0x1b')]||null:null,'attributes':_0x28d410[_0x4358('0x19')]?_0x28d410[_0x4358('0x19')][_0x4358('0x20')]||null:null,'include':_0x28d410[_0x4358('0x19')]?_0x28d410[_0x4358('0x19')][_0x4358('0x1d')]?_[_0x4358('0x1e')](_0x28d410[_0x4358('0x19')][_0x4358('0x1d')],function(_0x1cc8de){return{'model':db[_0x1cc8de[_0x4358('0x1f')]],'as':_0x1cc8de['as'],'attributes':_0x1cc8de[_0x4358('0x20')],'include':_0x1cc8de[_0x4358('0x1d')]?_[_0x4358('0x1e')](_0x1cc8de['include'],function(_0x1ec5a1){return{'model':db[_0x1ec5a1['model']],'as':_0x1ec5a1['as'],'attributes':_0x1ec5a1[_0x4358('0x20')],'include':_0x1ec5a1[_0x4358('0x1d')]?_[_0x4358('0x1e')](_0x1ec5a1[_0x4358('0x1d')],function(_0xd5a0fe){return{'model':db[_0xd5a0fe[_0x4358('0x1f')]],'as':_0xd5a0fe['as'],'attributes':_0xd5a0fe['attributes']};}):[]};}):[]};}):[]:[]})[_0x4358('0xd')](function(_0x28a302){logger[_0x4358('0x25')](_0x4358('0x23'),_0x28d410);logger['debug'](_0x4358('0x23'),_0x28d410,JSON[_0x4358('0x22')](_0x28a302));_0x492863(_0x28a302);})[_0x4358('0x16')](function(_0x16a40b){logger[_0x4358('0x11')]('ShowServicenowAccount',_0x16a40b[_0x4358('0x14')],_0x28d410);_0x32038d(_0x259f86['error'](0x1f4,_0x16a40b[_0x4358('0x14')]));});});}; \ No newline at end of file +var _0x6ce6=['message','catch','GetServicenowAccount','findAll','options','raw','limit','include','map','model','attributes','then','find','where','ShowServicenowAccount','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ServicenowAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0xe7380f,_0x35e1c1){var _0x3c94f9=function(_0x33d884){while(--_0x33d884){_0xe7380f['push'](_0xe7380f['shift']());}};_0x3c94f9(++_0x35e1c1);}(_0x6ce6,0x18f));var _0x66ce=function(_0x2d53be,_0x489ef4){_0x2d53be=_0x2d53be-0x0;var _0x4bf21a=_0x6ce6[_0x2d53be];return _0x4bf21a;};'use strict';var _=require(_0x66ce('0x0'));var util=require(_0x66ce('0x1'));var moment=require(_0x66ce('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66ce('0x3'))['db'];var utils=require(_0x66ce('0x4'));var logger=require(_0x66ce('0x5'))(_0x66ce('0x6'));var config=require(_0x66ce('0x7'));var jayson=require(_0x66ce('0x8'));var client=jayson['client'][_0x66ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c1654,_0x458aa2,_0x38cf72){return new BPromise(function(_0xdd85db,_0x47b3db){return client['request'](_0x4c1654,_0x38cf72)['then'](function(_0x574385){logger[_0x66ce('0xa')](_0x66ce('0xb'),_0x458aa2,'request\x20sent');logger[_0x66ce('0xc')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x458aa2,_0x66ce('0xd'),JSON[_0x66ce('0xe')](_0x574385));if(_0x574385['error']){if(_0x574385[_0x66ce('0xf')][_0x66ce('0x10')]===0x1f4){logger[_0x66ce('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x458aa2,_0x574385[_0x66ce('0xf')][_0x66ce('0x11')]);return _0x47b3db(_0x574385[_0x66ce('0xf')][_0x66ce('0x11')]);}logger[_0x66ce('0xf')](_0x66ce('0xb'),_0x458aa2,_0x574385['error']['message']);return _0xdd85db(_0x574385[_0x66ce('0xf')][_0x66ce('0x11')]);}else{logger[_0x66ce('0xa')](_0x66ce('0xb'),_0x458aa2,_0x66ce('0xd'));_0xdd85db(_0x574385['result'][_0x66ce('0x11')]);}})[_0x66ce('0x12')](function(_0xaae397){logger[_0x66ce('0xf')](_0x66ce('0xb'),_0x458aa2,_0xaae397);_0x47b3db(_0xaae397);});});}exports[_0x66ce('0x13')]=function(_0x4c9792){var _0x33a945=this;return new Promise(function(_0x5cdc43,_0x4e94a1){return db['ServicenowAccount'][_0x66ce('0x14')]({'raw':_0x4c9792[_0x66ce('0x15')]?_0x4c9792['options'][_0x66ce('0x16')]===undefined?!![]:![]:!![],'where':_0x4c9792[_0x66ce('0x15')]?_0x4c9792[_0x66ce('0x15')]['where']||null:null,'attributes':_0x4c9792['options']?_0x4c9792[_0x66ce('0x15')]['attributes']||null:null,'limit':_0x4c9792[_0x66ce('0x15')]?_0x4c9792[_0x66ce('0x15')][_0x66ce('0x17')]||null:null,'include':_0x4c9792[_0x66ce('0x15')]?_0x4c9792[_0x66ce('0x15')][_0x66ce('0x18')]?_[_0x66ce('0x19')](_0x4c9792[_0x66ce('0x15')]['include'],function(_0xc31278){return{'model':db[_0xc31278[_0x66ce('0x1a')]],'as':_0xc31278['as'],'attributes':_0xc31278[_0x66ce('0x1b')],'include':_0xc31278[_0x66ce('0x18')]?_[_0x66ce('0x19')](_0xc31278[_0x66ce('0x18')],function(_0x47615e){return{'model':db[_0x47615e['model']],'as':_0x47615e['as'],'attributes':_0x47615e[_0x66ce('0x1b')],'include':_0x47615e['include']?_[_0x66ce('0x19')](_0x47615e[_0x66ce('0x18')],function(_0x2b0911){return{'model':db[_0x2b0911['model']],'as':_0x2b0911['as'],'attributes':_0x2b0911[_0x66ce('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x66ce('0x1c')](function(_0x53887c){logger[_0x66ce('0xa')](_0x66ce('0x13'),_0x4c9792);logger[_0x66ce('0xc')](_0x66ce('0x13'),_0x4c9792,JSON[_0x66ce('0xe')](_0x53887c));_0x5cdc43(_0x53887c);})['catch'](function(_0x1edf94){logger[_0x66ce('0xf')](_0x66ce('0x13'),_0x1edf94[_0x66ce('0x11')],_0x4c9792);_0x4e94a1(_0x33a945[_0x66ce('0xf')](0x1f4,_0x1edf94['message']));});});};exports['ShowServicenowAccount']=function(_0x570625){var _0x3b8705=this;return new Promise(function(_0x1ee82,_0x1edbec){return db['ServicenowAccount'][_0x66ce('0x1d')]({'raw':_0x570625[_0x66ce('0x15')]?_0x570625[_0x66ce('0x15')][_0x66ce('0x16')]===undefined?!![]:![]:!![],'where':_0x570625[_0x66ce('0x15')]?_0x570625[_0x66ce('0x15')][_0x66ce('0x1e')]||null:null,'attributes':_0x570625['options']?_0x570625['options'][_0x66ce('0x1b')]||null:null,'include':_0x570625[_0x66ce('0x15')]?_0x570625[_0x66ce('0x15')][_0x66ce('0x18')]?_['map'](_0x570625[_0x66ce('0x15')][_0x66ce('0x18')],function(_0x1ec416){return{'model':db[_0x1ec416['model']],'as':_0x1ec416['as'],'attributes':_0x1ec416[_0x66ce('0x1b')],'include':_0x1ec416[_0x66ce('0x18')]?_[_0x66ce('0x19')](_0x1ec416[_0x66ce('0x18')],function(_0x109553){return{'model':db[_0x109553[_0x66ce('0x1a')]],'as':_0x109553['as'],'attributes':_0x109553[_0x66ce('0x1b')],'include':_0x109553[_0x66ce('0x18')]?_[_0x66ce('0x19')](_0x109553[_0x66ce('0x18')],function(_0x5676ff){return{'model':db[_0x5676ff[_0x66ce('0x1a')]],'as':_0x5676ff['as'],'attributes':_0x5676ff['attributes']};}):[]};}):[]};}):[]:[]})[_0x66ce('0x1c')](function(_0x1c5834){logger[_0x66ce('0xa')](_0x66ce('0x1f'),_0x570625);logger['debug'](_0x66ce('0x1f'),_0x570625,JSON[_0x66ce('0xe')](_0x1c5834));_0x1ee82(_0x1c5834);})[_0x66ce('0x12')](function(_0x4762a8){logger[_0x66ce('0xf')](_0x66ce('0x1f'),_0x4762a8[_0x66ce('0x11')],_0x570625);_0x1edbec(_0x3b8705[_0x66ce('0xf')](0x1f4,_0x4762a8[_0x66ce('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index a745316..33f4e3c 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 _0x1330=['Router','../../components/auth/service','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1330,0x1b4));var _0x0133=function(_0x390b37,_0x23ed18){_0x390b37=_0x390b37-0x0;var _0x265e6e=_0x1330[_0x390b37];return _0x265e6e;};'use strict';var multer=require('multer');var util=require(_0x0133('0x0'));var path=require(_0x0133('0x1'));var timeout=require(_0x0133('0x2'));var express=require(_0x0133('0x3'));var router=express[_0x0133('0x4')]();var auth=require(_0x0133('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0133('0x6'));router[_0x0133('0x7')]('/',auth[_0x0133('0x8')](),controller['index']);router['get'](_0x0133('0x9'),auth['isAuthenticated'](),controller[_0x0133('0xa')]);router[_0x0133('0x7')](_0x0133('0xb'),auth['isAuthenticated'](),controller[_0x0133('0xc')]);router[_0x0133('0x7')](_0x0133('0xd'),auth['isAuthenticated'](),controller[_0x0133('0xe')]);router['get'](_0x0133('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x0133('0x10')]('/',auth[_0x0133('0x8')](),controller[_0x0133('0x11')]);router[_0x0133('0x12')](_0x0133('0x9'),auth[_0x0133('0x8')](),controller[_0x0133('0x13')]);router['delete']('/:id',auth[_0x0133('0x8')](),controller[_0x0133('0x14')]);module[_0x0133('0x15')]=router; \ No newline at end of file +var _0x8eab=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post'];(function(_0x110f2a,_0x28e5a4){var _0x447730=function(_0x188ec0){while(--_0x188ec0){_0x110f2a['push'](_0x110f2a['shift']());}};_0x447730(++_0x28e5a4);}(_0x8eab,0x155));var _0xb8ea=function(_0x87c5da,_0xea2f0b){_0x87c5da=_0x87c5da-0x0;var _0x3c9e3f=_0x8eab[_0x87c5da];return _0x3c9e3f;};'use strict';var multer=require(_0xb8ea('0x0'));var util=require('util');var path=require(_0xb8ea('0x1'));var timeout=require(_0xb8ea('0x2'));var express=require(_0xb8ea('0x3'));var router=express[_0xb8ea('0x4')]();var auth=require(_0xb8ea('0x5'));var interaction=require(_0xb8ea('0x6'));var config=require(_0xb8ea('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0xb8ea('0x8')]('/',auth[_0xb8ea('0x9')](),controller['index']);router[_0xb8ea('0x8')](_0xb8ea('0xa'),auth[_0xb8ea('0x9')](),controller['show']);router[_0xb8ea('0x8')](_0xb8ea('0xb'),auth[_0xb8ea('0x9')](),controller['getFields']);router[_0xb8ea('0x8')](_0xb8ea('0xc'),auth[_0xb8ea('0x9')](),controller['getSubjects']);router[_0xb8ea('0x8')](_0xb8ea('0xd'),auth[_0xb8ea('0x9')](),controller[_0xb8ea('0xe')]);router[_0xb8ea('0xf')]('/',auth[_0xb8ea('0x9')](),controller['create']);router[_0xb8ea('0x10')](_0xb8ea('0xa'),auth[_0xb8ea('0x9')](),controller[_0xb8ea('0x11')]);router[_0xb8ea('0x12')](_0xb8ea('0xa'),auth[_0xb8ea('0x9')](),controller[_0xb8ea('0x13')]);module[_0xb8ea('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 1f517cd..bf18559 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 _0x45ac=['exports','STRING'];(function(_0x387ec1,_0xa73770){var _0x4ca6fe=function(_0xa1a849){while(--_0xa1a849){_0x387ec1['push'](_0x387ec1['shift']());}};_0x4ca6fe(++_0xa73770);}(_0x45ac,0xf2));var _0xc45a=function(_0x58fc2b,_0x368286){_0x58fc2b=_0x58fc2b-0x0;var _0x3937ce=_0x45ac[_0x58fc2b];return _0x3937ce;};'use strict';var Sequelize=require('sequelize');module[_0xc45a('0x0')]={'name':{'type':Sequelize[_0xc45a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb288=['STRING','sequelize','exports'];(function(_0x890d60,_0x65e7c5){var _0xe64e18=function(_0x49bb73){while(--_0x49bb73){_0x890d60['push'](_0x890d60['shift']());}};_0xe64e18(++_0x65e7c5);}(_0xb288,0x160));var _0x8b28=function(_0x5600e8,_0x135b24){_0x5600e8=_0x5600e8-0x0;var _0x16b41c=_0xb288[_0x5600e8];return _0x16b41c;};'use strict';var Sequelize=require(_0x8b28('0x0'));module[_0x8b28('0x1')]={'name':{'type':Sequelize[_0x8b28('0x2')]},'description':{'type':Sequelize[_0x8b28('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 8af88b9..6659ea8 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 _0xbc99=['nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','findAll','rows','show','params','includeAll','include','find','create','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','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','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','update','destroy','then','stack','name','send','index','ServicenowConfiguration','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x22123d,_0x45ae06){var _0xeabce1=function(_0x239cae){while(--_0x239cae){_0x22123d['push'](_0x22123d['shift']());}};_0xeabce1(++_0x45ae06);}(_0xbc99,0x12b));var _0x9bc9=function(_0x5c9785,_0x22a1c9){_0x5c9785=_0x5c9785-0x0;var _0x186834=_0xbc99[_0x5c9785];return _0x186834;};'use strict';var pdf=require(_0x9bc9('0x0'));var emlformat=require(_0x9bc9('0x1'));var rimraf=require(_0x9bc9('0x2'));var zipdir=require(_0x9bc9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9bc9('0x4'));var moment=require(_0x9bc9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9bc9('0x6'));var util=require(_0x9bc9('0x7'));var path=require(_0x9bc9('0x8'));var sox=require(_0x9bc9('0x9'));var csv=require(_0x9bc9('0xa'));var ejs=require(_0x9bc9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9bc9('0xc'));var jsforce=require(_0x9bc9('0xd'));var deskjs=require(_0x9bc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9bc9('0xf'));var Papa=require(_0x9bc9('0x10'));var Redis=require(_0x9bc9('0x11'));var authService=require(_0x9bc9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9bc9('0x13'));var hardwareService=require(_0x9bc9('0x14'));var logger=require('../../config/logger')(_0x9bc9('0x15'));var utils=require(_0x9bc9('0x16'));var config=require(_0x9bc9('0x17'));var licenseUtil=require(_0x9bc9('0x18'));var db=require(_0x9bc9('0x19'))['db'];var jayson=require(_0x9bc9('0x1a'));var client=jayson[_0x9bc9('0x1b')][_0x9bc9('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x293050,_0x307edf,_0xc5f278,_0x1766c1){return new BPromise(function(_0x4e03eb,_0x5081d0){var _0x1f90a8=_0x1766c1||client;return _0x1f90a8[_0x9bc9('0x1d')](_0x293050,_0xc5f278)['then'](function(_0x1ffdfd){logger[_0x9bc9('0x1e')](_0x9bc9('0x1f'),_0x307edf,_0x9bc9('0x20'));logger[_0x9bc9('0x21')](_0x9bc9('0x22'),_0x307edf,'request\x20sent',JSON['stringify'](_0x1ffdfd));if(_0x1ffdfd[_0x9bc9('0x23')]){if(_0x1ffdfd[_0x9bc9('0x23')][_0x9bc9('0x24')]===0x1f4){logger['error'](_0x9bc9('0x1f'),_0x307edf,_0x1ffdfd[_0x9bc9('0x23')][_0x9bc9('0x25')]);return _0x5081d0(_0x1ffdfd[_0x9bc9('0x23')]['message']);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x307edf,_0x1ffdfd[_0x9bc9('0x23')]['message']);return _0x4e03eb(_0x1ffdfd['error']['message']);}else{logger[_0x9bc9('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s',_0x307edf,_0x9bc9('0x20'));_0x4e03eb(_0x1ffdfd[_0x9bc9('0x26')][_0x9bc9('0x25')]);}})[_0x9bc9('0x27')](function(_0x51bb1a){logger[_0x9bc9('0x23')]('ServicenowConfiguration,\x20%s,\x20%s',_0x307edf,_0x51bb1a);_0x5081d0(_0x51bb1a);});});}function respondWithStatusCode(_0x1b6cfa,_0x16ec08){_0x16ec08=_0x16ec08||0xcc;return function(_0x2d02e3){if(_0x2d02e3){return _0x1b6cfa[_0x9bc9('0x28')](_0x16ec08);}return _0x1b6cfa[_0x9bc9('0x29')](_0x16ec08)[_0x9bc9('0x2a')]();};}function respondWithResult(_0x4aeabc,_0x2b083b){_0x2b083b=_0x2b083b||0xc8;return function(_0x2d3f1b){if(_0x2d3f1b){return _0x4aeabc['status'](_0x2b083b)['json'](_0x2d3f1b);}};}function respondWithFilteredResult(_0x451c72,_0x24919a){return function(_0xbef83f){if(_0xbef83f){var _0x1d16b0=_0xbef83f[_0x9bc9('0x2b')],_0x45d964=_0x24919a[_0x9bc9('0x2c')],_0x585f32=_0x24919a[_0x9bc9('0x2c')]+_0x24919a[_0x9bc9('0x2d')],_0x23f640;if(_0x585f32>=_0x1d16b0){_0x585f32=_0x1d16b0;_0x23f640=0xc8;}else{_0x23f640=0xce;}_0x451c72[_0x9bc9('0x29')](_0x23f640);return _0x451c72[_0x9bc9('0x2e')]('Content-Range',_0x45d964+'-'+_0x585f32+'/'+_0x1d16b0)[_0x9bc9('0x2f')](_0xbef83f);}return null;};}function patchUpdates(_0x173e2d){return function(_0x403cc7){try{jsonpatch[_0x9bc9('0x30')](_0x403cc7,_0x173e2d,!![]);}catch(_0x13b41a){return BPromise['reject'](_0x13b41a);}return _0x403cc7['save']();};}function saveUpdates(_0x4c2747,_0x1e3f3e){return function(_0x17d14a){if(_0x17d14a){return _0x17d14a[_0x9bc9('0x31')](_0x4c2747)['then'](function(_0x4c4a9e){return _0x4c4a9e;});}return null;};}function removeEntity(_0x1f5af2,_0x11f835){return function(_0x314158){if(_0x314158){return _0x314158[_0x9bc9('0x32')]()[_0x9bc9('0x33')](function(){_0x1f5af2[_0x9bc9('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x171d77,_0x941afc){return function(_0x1b36d5){if(!_0x1b36d5){_0x171d77[_0x9bc9('0x28')](0x194);}return _0x1b36d5;};}function handleError(_0x470ca3,_0x22beb7){_0x22beb7=_0x22beb7||0x1f4;return function(_0x279bf3){logger[_0x9bc9('0x23')](_0x279bf3[_0x9bc9('0x34')]);if(_0x279bf3[_0x9bc9('0x35')]){delete _0x279bf3[_0x9bc9('0x35')];}_0x470ca3[_0x9bc9('0x29')](_0x22beb7)[_0x9bc9('0x36')](_0x279bf3);};}exports[_0x9bc9('0x37')]=function(_0x44b16e,_0x16a333){var _0x2c2b2b={},_0x1fd0e1={},_0x59e8f7={'count':0x0,'rows':[]};var _0x313e97=_['map'](db[_0x9bc9('0x38')][_0x9bc9('0x39')],function(_0x21d0f6){return{'name':_0x21d0f6['fieldName'],'type':_0x21d0f6['type'][_0x9bc9('0x3a')]};});_0x1fd0e1[_0x9bc9('0x3b')]=_[_0x9bc9('0x3c')](_0x313e97,_0x9bc9('0x35'));_0x1fd0e1[_0x9bc9('0x3d')]=_[_0x9bc9('0x3e')](_0x44b16e['query']);_0x1fd0e1[_0x9bc9('0x3f')]=_[_0x9bc9('0x40')](_0x1fd0e1[_0x9bc9('0x3b')],_0x1fd0e1[_0x9bc9('0x3d')]);_0x2c2b2b[_0x9bc9('0x41')]=_['intersection'](_0x1fd0e1[_0x9bc9('0x3b')],qs['fields'](_0x44b16e['query'][_0x9bc9('0x42')]));_0x2c2b2b['attributes']=_0x2c2b2b['attributes'][_0x9bc9('0x43')]?_0x2c2b2b[_0x9bc9('0x41')]:_0x1fd0e1[_0x9bc9('0x3b')];if(!_0x44b16e[_0x9bc9('0x3d')][_0x9bc9('0x44')](_0x9bc9('0x45'))){_0x2c2b2b['limit']=qs[_0x9bc9('0x2d')](_0x44b16e[_0x9bc9('0x3d')][_0x9bc9('0x2d')]);_0x2c2b2b[_0x9bc9('0x2c')]=qs['offset'](_0x44b16e['query'][_0x9bc9('0x2c')]);}_0x2c2b2b[_0x9bc9('0x46')]=qs[_0x9bc9('0x47')](_0x44b16e['query'][_0x9bc9('0x47')]);_0x2c2b2b['where']=qs['filters'](_[_0x9bc9('0x48')](_0x44b16e[_0x9bc9('0x3d')],_0x1fd0e1['filters']),_0x313e97);if(_0x44b16e['query']['filter']){_0x2c2b2b[_0x9bc9('0x49')]=_[_0x9bc9('0x4a')](_0x2c2b2b[_0x9bc9('0x49')],{'$or':_[_0x9bc9('0x3c')](_0x313e97,function(_0x12aa50){if(_0x12aa50['type']!==_0x9bc9('0x4b')){var _0x3e8019={};_0x3e8019[_0x12aa50['name']]={'$like':'%'+_0x44b16e[_0x9bc9('0x3d')][_0x9bc9('0x4c')]+'%'};return _0x3e8019;}})});}_0x2c2b2b=_[_0x9bc9('0x4a')]({},_0x2c2b2b,_0x44b16e[_0x9bc9('0x4d')]);var _0x5e0fcf={'where':_0x2c2b2b[_0x9bc9('0x49')]};return db[_0x9bc9('0x38')]['count'](_0x5e0fcf)[_0x9bc9('0x33')](function(_0x78f3d1){_0x59e8f7[_0x9bc9('0x2b')]=_0x78f3d1;if(_0x44b16e['query']['includeAll']){_0x2c2b2b['include']=[{'all':!![]}];}return db[_0x9bc9('0x38')][_0x9bc9('0x4e')](_0x2c2b2b);})[_0x9bc9('0x33')](function(_0x19309a){_0x59e8f7[_0x9bc9('0x4f')]=_0x19309a;return _0x59e8f7;})[_0x9bc9('0x33')](respondWithFilteredResult(_0x16a333,_0x2c2b2b))[_0x9bc9('0x27')](handleError(_0x16a333,null));};exports[_0x9bc9('0x50')]=function(_0x36f389,_0x376978){var _0x2b01a0={'raw':![],'where':{'id':_0x36f389[_0x9bc9('0x51')]['id']}},_0x48540f={};_0x48540f[_0x9bc9('0x3b')]=_[_0x9bc9('0x3e')](db['ServicenowConfiguration'][_0x9bc9('0x39')]);_0x48540f[_0x9bc9('0x3d')]=_[_0x9bc9('0x3e')](_0x36f389[_0x9bc9('0x3d')]);_0x48540f[_0x9bc9('0x3f')]=_['intersection'](_0x48540f[_0x9bc9('0x3b')],_0x48540f[_0x9bc9('0x3d')]);_0x2b01a0[_0x9bc9('0x41')]=_[_0x9bc9('0x40')](_0x48540f['model'],qs['fields'](_0x36f389['query'][_0x9bc9('0x42')]));_0x2b01a0[_0x9bc9('0x41')]=_0x2b01a0[_0x9bc9('0x41')]['length']?_0x2b01a0['attributes']:_0x48540f[_0x9bc9('0x3b')];if(_0x36f389[_0x9bc9('0x3d')][_0x9bc9('0x52')]){_0x2b01a0[_0x9bc9('0x53')]=[{'all':!![]}];}_0x2b01a0=_[_0x9bc9('0x4a')]({},_0x2b01a0,_0x36f389[_0x9bc9('0x4d')]);return db[_0x9bc9('0x38')][_0x9bc9('0x54')](_0x2b01a0)['then'](handleEntityNotFound(_0x376978,null))[_0x9bc9('0x33')](respondWithResult(_0x376978,null))[_0x9bc9('0x27')](handleError(_0x376978,null));};exports['create']=function(_0x42500a,_0x3e7756){return db[_0x9bc9('0x38')][_0x9bc9('0x55')](_0x42500a['body'],{})[_0x9bc9('0x33')](respondWithResult(_0x3e7756,0xc9))[_0x9bc9('0x27')](handleError(_0x3e7756,null));};exports['update']=function(_0x45b6fc,_0x35ba82){if(_0x45b6fc[_0x9bc9('0x56')]['id']){delete _0x45b6fc[_0x9bc9('0x56')]['id'];}return db[_0x9bc9('0x38')]['find']({'where':{'id':_0x45b6fc[_0x9bc9('0x51')]['id']}})[_0x9bc9('0x33')](handleEntityNotFound(_0x35ba82,null))[_0x9bc9('0x33')](saveUpdates(_0x45b6fc[_0x9bc9('0x56')],null))['then'](respondWithResult(_0x35ba82,null))[_0x9bc9('0x27')](handleError(_0x35ba82,null));};exports[_0x9bc9('0x32')]=function(_0x286683,_0x187975){return db[_0x9bc9('0x38')][_0x9bc9('0x54')]({'where':{'id':_0x286683[_0x9bc9('0x51')]['id']}})[_0x9bc9('0x33')](handleEntityNotFound(_0x187975,null))[_0x9bc9('0x33')](removeEntity(_0x187975,null))[_0x9bc9('0x27')](handleError(_0x187975,null));};exports[_0x9bc9('0x57')]=function(_0x166cd1,_0x6521c,_0x20c817){var _0x47ac08={};var _0x60b40b={};var _0x521c47;var _0x4ea4db;return db[_0x9bc9('0x38')][_0x9bc9('0x58')]({'where':{'id':_0x166cd1[_0x9bc9('0x51')]['id']}})['then'](handleEntityNotFound(_0x6521c,null))['then'](function(_0x595093){if(_0x595093){_0x521c47=_0x595093;_0x60b40b['model']=_[_0x9bc9('0x3e')](db[_0x9bc9('0x59')][_0x9bc9('0x39')]);_0x60b40b[_0x9bc9('0x3d')]=_['keys'](_0x166cd1[_0x9bc9('0x3d')]);_0x60b40b[_0x9bc9('0x3f')]=_['intersection'](_0x60b40b[_0x9bc9('0x3b')],_0x60b40b[_0x9bc9('0x3d')]);_0x47ac08[_0x9bc9('0x41')]=_['intersection'](_0x60b40b[_0x9bc9('0x3b')],qs['fields'](_0x166cd1[_0x9bc9('0x3d')][_0x9bc9('0x42')]));_0x47ac08[_0x9bc9('0x41')]=_0x47ac08[_0x9bc9('0x41')][_0x9bc9('0x43')]?_0x47ac08[_0x9bc9('0x41')]:_0x60b40b[_0x9bc9('0x3b')];_0x47ac08['order']=qs[_0x9bc9('0x47')](_0x166cd1[_0x9bc9('0x3d')][_0x9bc9('0x47')]);_0x47ac08[_0x9bc9('0x49')]=qs[_0x9bc9('0x3f')](_[_0x9bc9('0x48')](_0x166cd1[_0x9bc9('0x3d')],_0x60b40b[_0x9bc9('0x3f')]));if(_0x166cd1[_0x9bc9('0x3d')][_0x9bc9('0x4c')]){_0x47ac08[_0x9bc9('0x49')]=_[_0x9bc9('0x4a')](_0x47ac08[_0x9bc9('0x49')],{'$or':_[_0x9bc9('0x3c')](_0x47ac08[_0x9bc9('0x41')],function(_0x48fd5c){var _0x2d8edf={};_0x2d8edf[_0x48fd5c]={'$like':'%'+_0x166cd1[_0x9bc9('0x3d')][_0x9bc9('0x4c')]+'%'};return _0x2d8edf;})});}_0x47ac08=_[_0x9bc9('0x4a')]({},_0x47ac08,_0x166cd1[_0x9bc9('0x4d')]);return _0x521c47[_0x9bc9('0x57')](_0x47ac08);}})[_0x9bc9('0x33')](function(_0x229ddd){if(_0x229ddd){_0x4ea4db=_0x229ddd[_0x9bc9('0x43')];if(!_0x166cd1[_0x9bc9('0x3d')][_0x9bc9('0x44')]('nolimit')){_0x47ac08[_0x9bc9('0x2d')]=qs[_0x9bc9('0x2d')](_0x166cd1[_0x9bc9('0x3d')][_0x9bc9('0x2d')]);_0x47ac08[_0x9bc9('0x2c')]=qs['offset'](_0x166cd1['query']['offset']);}return _0x521c47[_0x9bc9('0x57')](_0x47ac08);}})[_0x9bc9('0x33')](function(_0x20a2d8){if(_0x20a2d8){return _0x20a2d8?{'count':_0x4ea4db,'rows':_0x20a2d8}:null;}})['then'](respondWithResult(_0x6521c,null))[_0x9bc9('0x27')](handleError(_0x6521c,null));};exports[_0x9bc9('0x5a')]=function(_0x57a5bf,_0x10f20f,_0x2a5a8f){var _0x583e51={};var _0x43fefd={};var _0x2666dd;var _0x1a8845;return db['ServicenowConfiguration'][_0x9bc9('0x58')]({'where':{'id':_0x57a5bf['params']['id']}})['then'](handleEntityNotFound(_0x10f20f,null))[_0x9bc9('0x33')](function(_0x56164b){if(_0x56164b){_0x2666dd=_0x56164b;_0x43fefd[_0x9bc9('0x3b')]=_[_0x9bc9('0x3e')](db[_0x9bc9('0x59')][_0x9bc9('0x39')]);_0x43fefd[_0x9bc9('0x3d')]=_['keys'](_0x57a5bf[_0x9bc9('0x3d')]);_0x43fefd['filters']=_['intersection'](_0x43fefd['model'],_0x43fefd[_0x9bc9('0x3d')]);_0x583e51[_0x9bc9('0x41')]=_[_0x9bc9('0x40')](_0x43fefd[_0x9bc9('0x3b')],qs[_0x9bc9('0x42')](_0x57a5bf[_0x9bc9('0x3d')]['fields']));_0x583e51[_0x9bc9('0x41')]=_0x583e51[_0x9bc9('0x41')][_0x9bc9('0x43')]?_0x583e51[_0x9bc9('0x41')]:_0x43fefd[_0x9bc9('0x3b')];_0x583e51[_0x9bc9('0x46')]=qs['sort'](_0x57a5bf[_0x9bc9('0x3d')]['sort']);_0x583e51['where']=qs[_0x9bc9('0x3f')](_['pick'](_0x57a5bf[_0x9bc9('0x3d')],_0x43fefd['filters']));if(_0x57a5bf[_0x9bc9('0x3d')][_0x9bc9('0x4c')]){_0x583e51[_0x9bc9('0x49')]=_['merge'](_0x583e51[_0x9bc9('0x49')],{'$or':_[_0x9bc9('0x3c')](_0x583e51[_0x9bc9('0x41')],function(_0x26f1bf){var _0x274c0a={};_0x274c0a[_0x26f1bf]={'$like':'%'+_0x57a5bf[_0x9bc9('0x3d')][_0x9bc9('0x4c')]+'%'};return _0x274c0a;})});}_0x583e51=_[_0x9bc9('0x4a')]({},_0x583e51,_0x57a5bf[_0x9bc9('0x4d')]);return _0x2666dd['getSubjects'](_0x583e51);}})['then'](function(_0x3296bc){if(_0x3296bc){_0x1a8845=_0x3296bc[_0x9bc9('0x43')];if(!_0x57a5bf[_0x9bc9('0x3d')]['hasOwnProperty']('nolimit')){_0x583e51[_0x9bc9('0x2d')]=qs['limit'](_0x57a5bf[_0x9bc9('0x3d')][_0x9bc9('0x2d')]);_0x583e51['offset']=qs[_0x9bc9('0x2c')](_0x57a5bf['query'][_0x9bc9('0x2c')]);}return _0x2666dd['getSubjects'](_0x583e51);}})[_0x9bc9('0x33')](function(_0x5347fa){if(_0x5347fa){return _0x5347fa?{'count':_0x1a8845,'rows':_0x5347fa}:null;}})[_0x9bc9('0x33')](respondWithResult(_0x10f20f,null))['catch'](handleError(_0x10f20f,null));};exports[_0x9bc9('0x5b')]=function(_0x2922fc,_0x55f33e,_0x52ef8c){var _0x1ca4fa={};var _0x36973e={};var _0x494c26;var _0xb74df5;return db[_0x9bc9('0x38')]['findOne']({'where':{'id':_0x2922fc[_0x9bc9('0x51')]['id']}})[_0x9bc9('0x33')](handleEntityNotFound(_0x55f33e,null))['then'](function(_0x198722){if(_0x198722){_0x494c26=_0x198722;_0x36973e[_0x9bc9('0x3b')]=_[_0x9bc9('0x3e')](db[_0x9bc9('0x59')]['rawAttributes']);_0x36973e[_0x9bc9('0x3d')]=_[_0x9bc9('0x3e')](_0x2922fc[_0x9bc9('0x3d')]);_0x36973e['filters']=_[_0x9bc9('0x40')](_0x36973e[_0x9bc9('0x3b')],_0x36973e[_0x9bc9('0x3d')]);_0x1ca4fa[_0x9bc9('0x41')]=_[_0x9bc9('0x40')](_0x36973e['model'],qs[_0x9bc9('0x42')](_0x2922fc['query'][_0x9bc9('0x42')]));_0x1ca4fa[_0x9bc9('0x41')]=_0x1ca4fa[_0x9bc9('0x41')][_0x9bc9('0x43')]?_0x1ca4fa['attributes']:_0x36973e[_0x9bc9('0x3b')];_0x1ca4fa[_0x9bc9('0x46')]=qs['sort'](_0x2922fc[_0x9bc9('0x3d')][_0x9bc9('0x47')]);_0x1ca4fa[_0x9bc9('0x49')]=qs[_0x9bc9('0x3f')](_[_0x9bc9('0x48')](_0x2922fc['query'],_0x36973e['filters']));if(_0x2922fc[_0x9bc9('0x3d')][_0x9bc9('0x4c')]){_0x1ca4fa['where']=_[_0x9bc9('0x4a')](_0x1ca4fa[_0x9bc9('0x49')],{'$or':_['map'](_0x1ca4fa[_0x9bc9('0x41')],function(_0x2d9ca1){var _0x3966af={};_0x3966af[_0x2d9ca1]={'$like':'%'+_0x2922fc[_0x9bc9('0x3d')][_0x9bc9('0x4c')]+'%'};return _0x3966af;})});}_0x1ca4fa=_[_0x9bc9('0x4a')]({},_0x1ca4fa,_0x2922fc['options']);return _0x494c26['getDescriptions'](_0x1ca4fa);}})['then'](function(_0x35098a){if(_0x35098a){_0xb74df5=_0x35098a[_0x9bc9('0x43')];if(!_0x2922fc[_0x9bc9('0x3d')][_0x9bc9('0x44')]('nolimit')){_0x1ca4fa[_0x9bc9('0x2d')]=qs[_0x9bc9('0x2d')](_0x2922fc[_0x9bc9('0x3d')]['limit']);_0x1ca4fa[_0x9bc9('0x2c')]=qs[_0x9bc9('0x2c')](_0x2922fc[_0x9bc9('0x3d')][_0x9bc9('0x2c')]);}return _0x494c26['getDescriptions'](_0x1ca4fa);}})[_0x9bc9('0x33')](function(_0x32153d){if(_0x32153d){return _0x32153d?{'count':_0xb74df5,'rows':_0x32153d}:null;}})[_0x9bc9('0x33')](respondWithResult(_0x55f33e,null))['catch'](handleError(_0x55f33e,null));}; \ No newline at end of file +var _0x8321=['where','merge','VIRTUAL','filter','options','findAll','rows','show','params','rawAttributes','includeAll','include','find','catch','create','body','pick','getFields','getSubjects','findOne','ServicenowField','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','ServicenowConfiguration','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x270ad6,_0x3bf7d0){var _0x160cc2=function(_0x32725f){while(--_0x32725f){_0x270ad6['push'](_0x270ad6['shift']());}};_0x160cc2(++_0x3bf7d0);}(_0x8321,0x1a2));var _0x1832=function(_0x14cfa2,_0x12330b){_0x14cfa2=_0x14cfa2-0x0;var _0x3874df=_0x8321[_0x14cfa2];return _0x3874df;};'use strict';var pdf=require(_0x1832('0x0'));var emlformat=require(_0x1832('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1832('0x2'));var jsonpatch=require(_0x1832('0x3'));var rp=require(_0x1832('0x4'));var moment=require(_0x1832('0x5'));var BPromise=require(_0x1832('0x6'));var Mustache=require(_0x1832('0x7'));var util=require(_0x1832('0x8'));var path=require(_0x1832('0x9'));var sox=require(_0x1832('0xa'));var csv=require(_0x1832('0xb'));var ejs=require(_0x1832('0xc'));var fs=require('fs');var _=require(_0x1832('0xd'));var squel=require(_0x1832('0xe'));var crypto=require(_0x1832('0xf'));var jsforce=require(_0x1832('0x10'));var deskjs=require(_0x1832('0x11'));var toCsv=require(_0x1832('0xb'));var querystring=require(_0x1832('0x12'));var Papa=require(_0x1832('0x13'));var Redis=require('ioredis');var authService=require(_0x1832('0x14'));var qs=require(_0x1832('0x15'));var as=require(_0x1832('0x16'));var hardwareService=require(_0x1832('0x17'));var logger=require(_0x1832('0x18'))(_0x1832('0x19'));var utils=require(_0x1832('0x1a'));var config=require(_0x1832('0x1b'));var licenseUtil=require(_0x1832('0x1c'));var db=require(_0x1832('0x1d'))['db'];var jayson=require(_0x1832('0x1e'));var client=jayson[_0x1832('0x1f')][_0x1832('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5ddcf7,_0x3ea3d7,_0x171509,_0x4888e3){return new BPromise(function(_0x29f13b,_0x394b88){var _0x3cb58f=_0x4888e3||client;return _0x3cb58f[_0x1832('0x21')](_0x5ddcf7,_0x171509)[_0x1832('0x22')](function(_0x257732){logger[_0x1832('0x23')](_0x1832('0x24'),_0x3ea3d7,_0x1832('0x25'));logger[_0x1832('0x26')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x3ea3d7,_0x1832('0x25'),JSON[_0x1832('0x27')](_0x257732));if(_0x257732[_0x1832('0x28')]){if(_0x257732['error'][_0x1832('0x29')]===0x1f4){logger['error'](_0x1832('0x24'),_0x3ea3d7,_0x257732[_0x1832('0x28')]['message']);return _0x394b88(_0x257732['error'][_0x1832('0x2a')]);}logger[_0x1832('0x28')](_0x1832('0x24'),_0x3ea3d7,_0x257732[_0x1832('0x28')][_0x1832('0x2a')]);return _0x29f13b(_0x257732[_0x1832('0x28')][_0x1832('0x2a')]);}else{logger[_0x1832('0x23')](_0x1832('0x24'),_0x3ea3d7,_0x1832('0x25'));_0x29f13b(_0x257732['result'][_0x1832('0x2a')]);}})['catch'](function(_0x4ce0ba){logger[_0x1832('0x28')](_0x1832('0x24'),_0x3ea3d7,_0x4ce0ba);_0x394b88(_0x4ce0ba);});});}function respondWithStatusCode(_0x44ff98,_0xcd4ee0){_0xcd4ee0=_0xcd4ee0||0xcc;return function(_0x2eca35){if(_0x2eca35){return _0x44ff98[_0x1832('0x2b')](_0xcd4ee0);}return _0x44ff98[_0x1832('0x2c')](_0xcd4ee0)[_0x1832('0x2d')]();};}function respondWithResult(_0x20e2e4,_0x46ad98){_0x46ad98=_0x46ad98||0xc8;return function(_0x1c719f){if(_0x1c719f){return _0x20e2e4['status'](_0x46ad98)[_0x1832('0x2e')](_0x1c719f);}};}function respondWithFilteredResult(_0x35a25f,_0x2c495c){return function(_0x5c845a){if(_0x5c845a){var _0x45efce=_0x5c845a[_0x1832('0x2f')],_0x464814=_0x2c495c[_0x1832('0x30')],_0xa6ec3d=_0x2c495c[_0x1832('0x30')]+_0x2c495c[_0x1832('0x31')],_0x344af2;if(_0xa6ec3d>=_0x45efce){_0xa6ec3d=_0x45efce;_0x344af2=0xc8;}else{_0x344af2=0xce;}_0x35a25f[_0x1832('0x2c')](_0x344af2);return _0x35a25f[_0x1832('0x32')](_0x1832('0x33'),_0x464814+'-'+_0xa6ec3d+'/'+_0x45efce)[_0x1832('0x2e')](_0x5c845a);}return null;};}function patchUpdates(_0x4e2794){return function(_0x3bedf5){try{jsonpatch[_0x1832('0x34')](_0x3bedf5,_0x4e2794,!![]);}catch(_0x456600){return BPromise[_0x1832('0x35')](_0x456600);}return _0x3bedf5[_0x1832('0x36')]();};}function saveUpdates(_0x23863f,_0x4f3d3c){return function(_0x247403){if(_0x247403){return _0x247403[_0x1832('0x37')](_0x23863f)['then'](function(_0x5768e0){return _0x5768e0;});}return null;};}function removeEntity(_0x375471,_0x4f52d1){return function(_0x3e8cd0){if(_0x3e8cd0){return _0x3e8cd0[_0x1832('0x38')]()[_0x1832('0x22')](function(){_0x375471[_0x1832('0x2c')](0xcc)[_0x1832('0x2d')]();});}};}function handleEntityNotFound(_0x2b5d89,_0x4658eb){return function(_0x52f4fd){if(!_0x52f4fd){_0x2b5d89[_0x1832('0x2b')](0x194);}return _0x52f4fd;};}function handleError(_0x19462d,_0x750eee){_0x750eee=_0x750eee||0x1f4;return function(_0x3a7c99){logger[_0x1832('0x28')](_0x3a7c99['stack']);if(_0x3a7c99[_0x1832('0x39')]){delete _0x3a7c99[_0x1832('0x39')];}_0x19462d[_0x1832('0x2c')](_0x750eee)[_0x1832('0x3a')](_0x3a7c99);};}exports[_0x1832('0x3b')]=function(_0x2fcaf4,_0x2717c2){var _0x533a05={},_0xc225e0={},_0x4fe39b={'count':0x0,'rows':[]};var _0x2d5cb5=_['map'](db[_0x1832('0x3c')]['rawAttributes'],function(_0x5aaff8){return{'name':_0x5aaff8[_0x1832('0x3d')],'type':_0x5aaff8[_0x1832('0x3e')][_0x1832('0x3f')]};});_0xc225e0[_0x1832('0x40')]=_[_0x1832('0x41')](_0x2d5cb5,_0x1832('0x39'));_0xc225e0[_0x1832('0x42')]=_[_0x1832('0x43')](_0x2fcaf4['query']);_0xc225e0[_0x1832('0x44')]=_[_0x1832('0x45')](_0xc225e0['model'],_0xc225e0[_0x1832('0x42')]);_0x533a05['attributes']=_[_0x1832('0x45')](_0xc225e0[_0x1832('0x40')],qs['fields'](_0x2fcaf4[_0x1832('0x42')][_0x1832('0x46')]));_0x533a05[_0x1832('0x47')]=_0x533a05['attributes'][_0x1832('0x48')]?_0x533a05[_0x1832('0x47')]:_0xc225e0[_0x1832('0x40')];if(!_0x2fcaf4[_0x1832('0x42')][_0x1832('0x49')](_0x1832('0x4a'))){_0x533a05[_0x1832('0x31')]=qs[_0x1832('0x31')](_0x2fcaf4[_0x1832('0x42')][_0x1832('0x31')]);_0x533a05[_0x1832('0x30')]=qs['offset'](_0x2fcaf4[_0x1832('0x42')][_0x1832('0x30')]);}_0x533a05[_0x1832('0x4b')]=qs[_0x1832('0x4c')](_0x2fcaf4[_0x1832('0x42')][_0x1832('0x4c')]);_0x533a05[_0x1832('0x4d')]=qs[_0x1832('0x44')](_['pick'](_0x2fcaf4[_0x1832('0x42')],_0xc225e0[_0x1832('0x44')]),_0x2d5cb5);if(_0x2fcaf4[_0x1832('0x42')]['filter']){_0x533a05[_0x1832('0x4d')]=_[_0x1832('0x4e')](_0x533a05['where'],{'$or':_['map'](_0x2d5cb5,function(_0xec5ffa){if(_0xec5ffa['type']!==_0x1832('0x4f')){var _0x488a1c={};_0x488a1c[_0xec5ffa[_0x1832('0x39')]]={'$like':'%'+_0x2fcaf4[_0x1832('0x42')][_0x1832('0x50')]+'%'};return _0x488a1c;}})});}_0x533a05=_[_0x1832('0x4e')]({},_0x533a05,_0x2fcaf4[_0x1832('0x51')]);var _0x3c16cd={'where':_0x533a05[_0x1832('0x4d')]};return db['ServicenowConfiguration'][_0x1832('0x2f')](_0x3c16cd)['then'](function(_0x3067cd){_0x4fe39b[_0x1832('0x2f')]=_0x3067cd;if(_0x2fcaf4[_0x1832('0x42')]['includeAll']){_0x533a05['include']=[{'all':!![]}];}return db[_0x1832('0x3c')][_0x1832('0x52')](_0x533a05);})['then'](function(_0x3660fa){_0x4fe39b[_0x1832('0x53')]=_0x3660fa;return _0x4fe39b;})['then'](respondWithFilteredResult(_0x2717c2,_0x533a05))['catch'](handleError(_0x2717c2,null));};exports[_0x1832('0x54')]=function(_0x2a34bb,_0x457d1f){var _0x2ca4de={'raw':![],'where':{'id':_0x2a34bb[_0x1832('0x55')]['id']}},_0xac9b0a={};_0xac9b0a[_0x1832('0x40')]=_[_0x1832('0x43')](db[_0x1832('0x3c')][_0x1832('0x56')]);_0xac9b0a[_0x1832('0x42')]=_['keys'](_0x2a34bb[_0x1832('0x42')]);_0xac9b0a[_0x1832('0x44')]=_[_0x1832('0x45')](_0xac9b0a[_0x1832('0x40')],_0xac9b0a['query']);_0x2ca4de[_0x1832('0x47')]=_[_0x1832('0x45')](_0xac9b0a[_0x1832('0x40')],qs[_0x1832('0x46')](_0x2a34bb[_0x1832('0x42')][_0x1832('0x46')]));_0x2ca4de[_0x1832('0x47')]=_0x2ca4de[_0x1832('0x47')][_0x1832('0x48')]?_0x2ca4de[_0x1832('0x47')]:_0xac9b0a['model'];if(_0x2a34bb['query'][_0x1832('0x57')]){_0x2ca4de[_0x1832('0x58')]=[{'all':!![]}];}_0x2ca4de=_[_0x1832('0x4e')]({},_0x2ca4de,_0x2a34bb[_0x1832('0x51')]);return db[_0x1832('0x3c')][_0x1832('0x59')](_0x2ca4de)[_0x1832('0x22')](handleEntityNotFound(_0x457d1f,null))[_0x1832('0x22')](respondWithResult(_0x457d1f,null))[_0x1832('0x5a')](handleError(_0x457d1f,null));};exports[_0x1832('0x5b')]=function(_0x2aa742,_0x2419d9){return db[_0x1832('0x3c')][_0x1832('0x5b')](_0x2aa742[_0x1832('0x5c')],{})[_0x1832('0x22')](respondWithResult(_0x2419d9,0xc9))[_0x1832('0x5a')](handleError(_0x2419d9,null));};exports['update']=function(_0x264918,_0x6f7b66){if(_0x264918[_0x1832('0x5c')]['id']){delete _0x264918['body']['id'];}return db[_0x1832('0x3c')][_0x1832('0x59')]({'where':{'id':_0x264918[_0x1832('0x55')]['id']}})[_0x1832('0x22')](handleEntityNotFound(_0x6f7b66,null))['then'](saveUpdates(_0x264918[_0x1832('0x5c')],null))[_0x1832('0x22')](respondWithResult(_0x6f7b66,null))[_0x1832('0x5a')](handleError(_0x6f7b66,null));};exports['destroy']=function(_0x15091c,_0x33f5d9){return db['ServicenowConfiguration'][_0x1832('0x59')]({'where':{'id':_0x15091c[_0x1832('0x55')]['id']}})['then'](handleEntityNotFound(_0x33f5d9,null))[_0x1832('0x22')](removeEntity(_0x33f5d9,null))[_0x1832('0x5a')](handleError(_0x33f5d9,null));};exports['getFields']=function(_0x3ffb62,_0x376f68,_0x354793){var _0xb41be0={};var _0x2925a2={};var _0x433a5d;var _0x3a066a;return db[_0x1832('0x3c')]['findOne']({'where':{'id':_0x3ffb62[_0x1832('0x55')]['id']}})[_0x1832('0x22')](handleEntityNotFound(_0x376f68,null))[_0x1832('0x22')](function(_0x106163){if(_0x106163){_0x433a5d=_0x106163;_0x2925a2[_0x1832('0x40')]=_['keys'](db['ServicenowField'][_0x1832('0x56')]);_0x2925a2[_0x1832('0x42')]=_['keys'](_0x3ffb62[_0x1832('0x42')]);_0x2925a2['filters']=_[_0x1832('0x45')](_0x2925a2['model'],_0x2925a2[_0x1832('0x42')]);_0xb41be0['attributes']=_[_0x1832('0x45')](_0x2925a2['model'],qs[_0x1832('0x46')](_0x3ffb62['query'][_0x1832('0x46')]));_0xb41be0['attributes']=_0xb41be0['attributes'][_0x1832('0x48')]?_0xb41be0['attributes']:_0x2925a2[_0x1832('0x40')];_0xb41be0['order']=qs[_0x1832('0x4c')](_0x3ffb62[_0x1832('0x42')]['sort']);_0xb41be0[_0x1832('0x4d')]=qs[_0x1832('0x44')](_[_0x1832('0x5d')](_0x3ffb62[_0x1832('0x42')],_0x2925a2[_0x1832('0x44')]));if(_0x3ffb62['query']['filter']){_0xb41be0[_0x1832('0x4d')]=_[_0x1832('0x4e')](_0xb41be0['where'],{'$or':_[_0x1832('0x41')](_0xb41be0['attributes'],function(_0x57ef34){var _0x2e9a9a={};_0x2e9a9a[_0x57ef34]={'$like':'%'+_0x3ffb62[_0x1832('0x42')][_0x1832('0x50')]+'%'};return _0x2e9a9a;})});}_0xb41be0=_[_0x1832('0x4e')]({},_0xb41be0,_0x3ffb62[_0x1832('0x51')]);return _0x433a5d[_0x1832('0x5e')](_0xb41be0);}})['then'](function(_0x1a479f){if(_0x1a479f){_0x3a066a=_0x1a479f[_0x1832('0x48')];if(!_0x3ffb62['query'][_0x1832('0x49')](_0x1832('0x4a'))){_0xb41be0[_0x1832('0x31')]=qs[_0x1832('0x31')](_0x3ffb62['query'][_0x1832('0x31')]);_0xb41be0['offset']=qs['offset'](_0x3ffb62[_0x1832('0x42')][_0x1832('0x30')]);}return _0x433a5d[_0x1832('0x5e')](_0xb41be0);}})['then'](function(_0x324405){if(_0x324405){return _0x324405?{'count':_0x3a066a,'rows':_0x324405}:null;}})[_0x1832('0x22')](respondWithResult(_0x376f68,null))[_0x1832('0x5a')](handleError(_0x376f68,null));};exports[_0x1832('0x5f')]=function(_0x3a815a,_0x29a4c6,_0x49c51b){var _0x4817c1={};var _0x546595={};var _0x3bcfd2;var _0x3486fd;return db['ServicenowConfiguration'][_0x1832('0x60')]({'where':{'id':_0x3a815a[_0x1832('0x55')]['id']}})[_0x1832('0x22')](handleEntityNotFound(_0x29a4c6,null))['then'](function(_0x3239d0){if(_0x3239d0){_0x3bcfd2=_0x3239d0;_0x546595[_0x1832('0x40')]=_[_0x1832('0x43')](db[_0x1832('0x61')][_0x1832('0x56')]);_0x546595[_0x1832('0x42')]=_[_0x1832('0x43')](_0x3a815a[_0x1832('0x42')]);_0x546595[_0x1832('0x44')]=_[_0x1832('0x45')](_0x546595['model'],_0x546595[_0x1832('0x42')]);_0x4817c1[_0x1832('0x47')]=_[_0x1832('0x45')](_0x546595[_0x1832('0x40')],qs[_0x1832('0x46')](_0x3a815a[_0x1832('0x42')][_0x1832('0x46')]));_0x4817c1['attributes']=_0x4817c1[_0x1832('0x47')][_0x1832('0x48')]?_0x4817c1[_0x1832('0x47')]:_0x546595[_0x1832('0x40')];_0x4817c1[_0x1832('0x4b')]=qs[_0x1832('0x4c')](_0x3a815a['query'][_0x1832('0x4c')]);_0x4817c1[_0x1832('0x4d')]=qs[_0x1832('0x44')](_['pick'](_0x3a815a[_0x1832('0x42')],_0x546595[_0x1832('0x44')]));if(_0x3a815a['query'][_0x1832('0x50')]){_0x4817c1[_0x1832('0x4d')]=_[_0x1832('0x4e')](_0x4817c1[_0x1832('0x4d')],{'$or':_['map'](_0x4817c1[_0x1832('0x47')],function(_0x1e12ef){var _0x131b9c={};_0x131b9c[_0x1e12ef]={'$like':'%'+_0x3a815a['query'][_0x1832('0x50')]+'%'};return _0x131b9c;})});}_0x4817c1=_[_0x1832('0x4e')]({},_0x4817c1,_0x3a815a['options']);return _0x3bcfd2[_0x1832('0x5f')](_0x4817c1);}})[_0x1832('0x22')](function(_0x5bec07){if(_0x5bec07){_0x3486fd=_0x5bec07[_0x1832('0x48')];if(!_0x3a815a[_0x1832('0x42')]['hasOwnProperty'](_0x1832('0x4a'))){_0x4817c1[_0x1832('0x31')]=qs[_0x1832('0x31')](_0x3a815a[_0x1832('0x42')][_0x1832('0x31')]);_0x4817c1['offset']=qs['offset'](_0x3a815a[_0x1832('0x42')]['offset']);}return _0x3bcfd2[_0x1832('0x5f')](_0x4817c1);}})['then'](function(_0x2c61f3){if(_0x2c61f3){return _0x2c61f3?{'count':_0x3486fd,'rows':_0x2c61f3}:null;}})[_0x1832('0x22')](respondWithResult(_0x29a4c6,null))[_0x1832('0x5a')](handleError(_0x29a4c6,null));};exports[_0x1832('0x62')]=function(_0x2a8d1c,_0x453579,_0x4e37ca){var _0x188cab={};var _0x34f902={};var _0x1e1241;var _0x45d146;return db['ServicenowConfiguration'][_0x1832('0x60')]({'where':{'id':_0x2a8d1c[_0x1832('0x55')]['id']}})['then'](handleEntityNotFound(_0x453579,null))['then'](function(_0x4839b5){if(_0x4839b5){_0x1e1241=_0x4839b5;_0x34f902[_0x1832('0x40')]=_['keys'](db[_0x1832('0x61')][_0x1832('0x56')]);_0x34f902['query']=_[_0x1832('0x43')](_0x2a8d1c[_0x1832('0x42')]);_0x34f902[_0x1832('0x44')]=_[_0x1832('0x45')](_0x34f902['model'],_0x34f902[_0x1832('0x42')]);_0x188cab[_0x1832('0x47')]=_[_0x1832('0x45')](_0x34f902[_0x1832('0x40')],qs['fields'](_0x2a8d1c[_0x1832('0x42')][_0x1832('0x46')]));_0x188cab[_0x1832('0x47')]=_0x188cab[_0x1832('0x47')][_0x1832('0x48')]?_0x188cab['attributes']:_0x34f902['model'];_0x188cab[_0x1832('0x4b')]=qs[_0x1832('0x4c')](_0x2a8d1c['query'][_0x1832('0x4c')]);_0x188cab[_0x1832('0x4d')]=qs['filters'](_['pick'](_0x2a8d1c['query'],_0x34f902[_0x1832('0x44')]));if(_0x2a8d1c['query'][_0x1832('0x50')]){_0x188cab[_0x1832('0x4d')]=_[_0x1832('0x4e')](_0x188cab[_0x1832('0x4d')],{'$or':_[_0x1832('0x41')](_0x188cab['attributes'],function(_0x4967c0){var _0x3f035b={};_0x3f035b[_0x4967c0]={'$like':'%'+_0x2a8d1c[_0x1832('0x42')][_0x1832('0x50')]+'%'};return _0x3f035b;})});}_0x188cab=_['merge']({},_0x188cab,_0x2a8d1c['options']);return _0x1e1241['getDescriptions'](_0x188cab);}})[_0x1832('0x22')](function(_0xa7f09){if(_0xa7f09){_0x45d146=_0xa7f09[_0x1832('0x48')];if(!_0x2a8d1c[_0x1832('0x42')]['hasOwnProperty']('nolimit')){_0x188cab[_0x1832('0x31')]=qs[_0x1832('0x31')](_0x2a8d1c[_0x1832('0x42')][_0x1832('0x31')]);_0x188cab[_0x1832('0x30')]=qs['offset'](_0x2a8d1c['query'][_0x1832('0x30')]);}return _0x1e1241[_0x1832('0x62')](_0x188cab);}})['then'](function(_0x15aa7f){if(_0x15aa7f){return _0x15aa7f?{'count':_0x45d146,'rows':_0x15aa7f}:null;}})['then'](respondWithResult(_0x453579,null))[_0x1832('0x5a')](handleError(_0x453579,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index db8087b..c1d2776 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 _0x2e09=['ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define'];(function(_0x4332f3,_0x1c667f){var _0x371d18=function(_0x1d36e6){while(--_0x1d36e6){_0x4332f3['push'](_0x4332f3['shift']());}};_0x371d18(++_0x1c667f);}(_0x2e09,0xc6));var _0x92e0=function(_0x4e9f45,_0x5d1bcd){_0x4e9f45=_0x4e9f45-0x0;var _0x2ccec3=_0x2e09[_0x4e9f45];return _0x2ccec3;};'use strict';var _=require(_0x92e0('0x0'));var util=require('util');var logger=require(_0x92e0('0x1'))(_0x92e0('0x2'));var moment=require(_0x92e0('0x3'));var BPromise=require(_0x92e0('0x4'));var rp=require(_0x92e0('0x5'));var fs=require('fs');var path=require(_0x92e0('0x6'));var rimraf=require(_0x92e0('0x7'));var config=require(_0x92e0('0x8'));var attributes=require(_0x92e0('0x9'));module[_0x92e0('0xa')]=function(_0xf5c84b,_0x47bbe7){return _0xf5c84b[_0x92e0('0xb')](_0x92e0('0xc'),attributes,{'tableName':_0x92e0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5826=['../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5826,0x1ea));var _0x6582=function(_0x4a4028,_0x1fdbd7){_0x4a4028=_0x4a4028-0x0;var _0x12985d=_0x5826[_0x4a4028];return _0x12985d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6582('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6582('0x1'));var rp=require(_0x6582('0x2'));var fs=require('fs');var path=require(_0x6582('0x3'));var rimraf=require(_0x6582('0x4'));var config=require(_0x6582('0x5'));var attributes=require(_0x6582('0x6'));module[_0x6582('0x7')]=function(_0x401271,_0x3d0ce3){return _0x401271[_0x6582('0x8')](_0x6582('0x9'),attributes,{'tableName':_0x6582('0xa'),'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 3673863..bdc5ae6 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 _0x4e9f=['jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1680a9,_0x40651d){var _0x1e456a=function(_0x95654){while(--_0x95654){_0x1680a9['push'](_0x1680a9['shift']());}};_0x1e456a(++_0x40651d);}(_0x4e9f,0x122));var _0xf4e9=function(_0xf7b39e,_0x371b92){_0xf7b39e=_0xf7b39e-0x0;var _0x322d06=_0x4e9f[_0xf7b39e];return _0x322d06;};'use strict';var _=require(_0xf4e9('0x0'));var util=require(_0xf4e9('0x1'));var moment=require(_0xf4e9('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4e9('0x3'));var fs=require('fs');var Redis=require(_0xf4e9('0x4'));var db=require(_0xf4e9('0x5'))['db'];var utils=require(_0xf4e9('0x6'));var logger=require(_0xf4e9('0x7'))(_0xf4e9('0x8'));var config=require(_0xf4e9('0x9'));var jayson=require(_0xf4e9('0xa'));var client=jayson[_0xf4e9('0xb')][_0xf4e9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32cf09,_0x572a68,_0x44ce60){return new BPromise(function(_0x306159,_0x5c77a5){return client['request'](_0x32cf09,_0x44ce60)[_0xf4e9('0xd')](function(_0x151b7a){logger[_0xf4e9('0xe')](_0xf4e9('0xf'),_0x572a68,_0xf4e9('0x10'));logger[_0xf4e9('0x11')](_0xf4e9('0x12'),_0x572a68,'request\x20sent',JSON[_0xf4e9('0x13')](_0x151b7a));if(_0x151b7a[_0xf4e9('0x14')]){if(_0x151b7a[_0xf4e9('0x14')][_0xf4e9('0x15')]===0x1f4){logger[_0xf4e9('0x14')](_0xf4e9('0xf'),_0x572a68,_0x151b7a[_0xf4e9('0x14')][_0xf4e9('0x16')]);return _0x5c77a5(_0x151b7a[_0xf4e9('0x14')][_0xf4e9('0x16')]);}logger[_0xf4e9('0x14')](_0xf4e9('0xf'),_0x572a68,_0x151b7a[_0xf4e9('0x14')][_0xf4e9('0x16')]);return _0x306159(_0x151b7a[_0xf4e9('0x14')][_0xf4e9('0x16')]);}else{logger[_0xf4e9('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x572a68,_0xf4e9('0x10'));_0x306159(_0x151b7a[_0xf4e9('0x17')][_0xf4e9('0x16')]);}})[_0xf4e9('0x18')](function(_0x46e9c5){logger[_0xf4e9('0x14')](_0xf4e9('0xf'),_0x572a68,_0x46e9c5);_0x5c77a5(_0x46e9c5);});});} \ No newline at end of file +var _0x178f=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x16a55d,_0x56fedd){var _0x1e2d84=function(_0x43150b){while(--_0x43150b){_0x16a55d['push'](_0x16a55d['shift']());}};_0x1e2d84(++_0x56fedd);}(_0x178f,0x1b7));var _0xf178=function(_0x3ffa69,_0x1f220b){_0x3ffa69=_0x3ffa69-0x0;var _0x5b10a2=_0x178f[_0x3ffa69];return _0x5b10a2;};'use strict';var _=require(_0xf178('0x0'));var util=require(_0xf178('0x1'));var moment=require('moment');var BPromise=require(_0xf178('0x2'));var rs=require(_0xf178('0x3'));var fs=require('fs');var Redis=require(_0xf178('0x4'));var db=require(_0xf178('0x5'))['db'];var utils=require(_0xf178('0x6'));var logger=require(_0xf178('0x7'))(_0xf178('0x8'));var config=require('../../config/environment');var jayson=require(_0xf178('0x9'));var client=jayson[_0xf178('0xa')][_0xf178('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2316fe,_0x28f827,_0x59ce81){return new BPromise(function(_0x5ef9f5,_0x155ac2){return client[_0xf178('0xc')](_0x2316fe,_0x59ce81)['then'](function(_0x43fb3a){logger[_0xf178('0xd')](_0xf178('0xe'),_0x28f827,_0xf178('0xf'));logger[_0xf178('0x10')](_0xf178('0x11'),_0x28f827,_0xf178('0xf'),JSON['stringify'](_0x43fb3a));if(_0x43fb3a[_0xf178('0x12')]){if(_0x43fb3a[_0xf178('0x12')][_0xf178('0x13')]===0x1f4){logger[_0xf178('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x28f827,_0x43fb3a['error']['message']);return _0x155ac2(_0x43fb3a['error'][_0xf178('0x14')]);}logger['error'](_0xf178('0xe'),_0x28f827,_0x43fb3a['error'][_0xf178('0x14')]);return _0x5ef9f5(_0x43fb3a[_0xf178('0x12')][_0xf178('0x14')]);}else{logger[_0xf178('0xd')](_0xf178('0xe'),_0x28f827,'request\x20sent');_0x5ef9f5(_0x43fb3a[_0xf178('0x15')][_0xf178('0x14')]);}})[_0xf178('0x16')](function(_0x54daea){logger[_0xf178('0x12')](_0xf178('0xe'),_0x28f827,_0x54daea);_0x155ac2(_0x54daea);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 784d847..553d171 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 _0x32ca=['express','Router','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3d8c81,_0xac262d){var _0x251bc8=function(_0x3b2ecc){while(--_0x3b2ecc){_0x3d8c81['push'](_0x3d8c81['shift']());}};_0x251bc8(++_0xac262d);}(_0x32ca,0x1d1));var _0xa32c=function(_0x28bf5d,_0x4d2cfb){_0x28bf5d=_0x28bf5d-0x0;var _0x39a35c=_0x32ca[_0x28bf5d];return _0x39a35c;};'use strict';var multer=require(_0xa32c('0x0'));var util=require(_0xa32c('0x1'));var path=require(_0xa32c('0x2'));var timeout=require('connect-timeout');var express=require(_0xa32c('0x3'));var router=express[_0xa32c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa32c('0x5'));var config=require('../../config/environment');var controller=require(_0xa32c('0x6'));router[_0xa32c('0x7')]('/',auth[_0xa32c('0x8')](),controller[_0xa32c('0x9')]);router[_0xa32c('0x7')](_0xa32c('0xa'),auth['isAuthenticated'](),controller[_0xa32c('0xb')]);router[_0xa32c('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa32c('0xd')](_0xa32c('0xa'),auth[_0xa32c('0x8')](),controller[_0xa32c('0xe')]);router[_0xa32c('0xf')](_0xa32c('0xa'),auth[_0xa32c('0x8')](),controller[_0xa32c('0x10')]);module[_0xa32c('0x11')]=router; \ No newline at end of file +var _0x3959=['../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x449e3e,_0x3e113e){var _0x6cc58a=function(_0x4d8c4d){while(--_0x4d8c4d){_0x449e3e['push'](_0x449e3e['shift']());}};_0x6cc58a(++_0x3e113e);}(_0x3959,0x129));var _0x9395=function(_0x2db588,_0x4b5828){_0x2db588=_0x2db588-0x0;var _0xf72e3d=_0x3959[_0x2db588];return _0xf72e3d;};'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[_0x9395('0x4')]();var auth=require(_0x9395('0x5'));var interaction=require(_0x9395('0x6'));var config=require(_0x9395('0x7'));var controller=require('./intServicenowField.controller');router[_0x9395('0x8')]('/',auth[_0x9395('0x9')](),controller[_0x9395('0xa')]);router[_0x9395('0x8')](_0x9395('0xb'),auth[_0x9395('0x9')](),controller[_0x9395('0xc')]);router['post']('/',auth[_0x9395('0x9')](),controller[_0x9395('0xd')]);router[_0x9395('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x9395('0xf')]);router[_0x9395('0x10')](_0x9395('0xb'),auth[_0x9395('0x9')](),controller[_0x9395('0x11')]);module[_0x9395('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 31f8a18..9add2e1 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 _0xc418=['keyValue','STRING','customVariable','BOOLEAN','exports','ENUM','string','variable'];(function(_0x553ac2,_0x156cf0){var _0x2182d8=function(_0x594e0f){while(--_0x594e0f){_0x553ac2['push'](_0x553ac2['shift']());}};_0x2182d8(++_0x156cf0);}(_0xc418,0x1cc));var _0x8c41=function(_0x88dc75,_0x526f60){_0x88dc75=_0x88dc75-0x0;var _0x5b8282=_0xc418[_0x88dc75];return _0x5b8282;};'use strict';var Sequelize=require('sequelize');module[_0x8c41('0x0')]={'type':{'type':Sequelize[_0x8c41('0x1')](_0x8c41('0x2'),_0x8c41('0x3'),'customVariable',_0x8c41('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8c41('0x5')]},'key':{'type':Sequelize[_0x8c41('0x5')]},'keyType':{'type':Sequelize[_0x8c41('0x1')](_0x8c41('0x2'),'variable',_0x8c41('0x6'))},'keyContent':{'type':Sequelize[_0x8c41('0x5')]},'idField':{'type':Sequelize[_0x8c41('0x5')]},'nameField':{'type':Sequelize[_0x8c41('0x5')]},'customField':{'type':Sequelize[_0x8c41('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8c41('0x5')]}}; \ No newline at end of file +var _0x96c1=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x27ff1f,_0x421161){var _0x30a674=function(_0x35a843){while(--_0x35a843){_0x27ff1f['push'](_0x27ff1f['shift']());}};_0x30a674(++_0x421161);}(_0x96c1,0x1bd));var _0x196c=function(_0x6f7ea9,_0x45bfd3){_0x6f7ea9=_0x6f7ea9-0x0;var _0x347e8c=_0x96c1[_0x6f7ea9];return _0x347e8c;};'use strict';var Sequelize=require(_0x196c('0x0'));module[_0x196c('0x1')]={'type':{'type':Sequelize[_0x196c('0x2')](_0x196c('0x3'),_0x196c('0x4'),_0x196c('0x5'),_0x196c('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x196c('0x7')]},'key':{'type':Sequelize[_0x196c('0x7')]},'keyType':{'type':Sequelize[_0x196c('0x2')](_0x196c('0x3'),_0x196c('0x4'),_0x196c('0x5'))},'keyContent':{'type':Sequelize[_0x196c('0x7')]},'idField':{'type':Sequelize[_0x196c('0x7')]},'nameField':{'type':Sequelize[_0x196c('0x7')]},'customField':{'type':Sequelize[_0x196c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x196c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 637ae37..66a03f1 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 _0xa88f=['error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','params','fields','length','merge','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','reject','update','then','destroy'];(function(_0x704ab3,_0x4c65a2){var _0xf235b0=function(_0xd7a871){while(--_0xd7a871){_0x704ab3['push'](_0x704ab3['shift']());}};_0xf235b0(++_0x4c65a2);}(_0xa88f,0x182));var _0xfa88=function(_0x2ca8af,_0x50514a){_0x2ca8af=_0x2ca8af-0x0;var _0x142dd7=_0xa88f[_0x2ca8af];return _0x142dd7;};'use strict';var pdf=require(_0xfa88('0x0'));var emlformat=require(_0xfa88('0x1'));var rimraf=require(_0xfa88('0x2'));var zipdir=require(_0xfa88('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa88('0x4'));var BPromise=require(_0xfa88('0x5'));var Mustache=require('mustache');var util=require(_0xfa88('0x6'));var path=require(_0xfa88('0x7'));var sox=require(_0xfa88('0x8'));var csv=require(_0xfa88('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfa88('0xa'));var jsforce=require(_0xfa88('0xb'));var deskjs=require(_0xfa88('0xc'));var toCsv=require(_0xfa88('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfa88('0xd'));var authService=require(_0xfa88('0xe'));var qs=require(_0xfa88('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa88('0x10'));var logger=require(_0xfa88('0x11'))('api');var utils=require(_0xfa88('0x12'));var config=require(_0xfa88('0x13'));var licenseUtil=require(_0xfa88('0x14'));var db=require(_0xfa88('0x15'))['db'];function respondWithStatusCode(_0x1f5142,_0x1be999){_0x1be999=_0x1be999||0xcc;return function(_0x5232e4){if(_0x5232e4){return _0x1f5142[_0xfa88('0x16')](_0x1be999);}return _0x1f5142['status'](_0x1be999)[_0xfa88('0x17')]();};}function respondWithResult(_0x57bde2,_0x39f7b2){_0x39f7b2=_0x39f7b2||0xc8;return function(_0x3448a5){if(_0x3448a5){return _0x57bde2['status'](_0x39f7b2)[_0xfa88('0x18')](_0x3448a5);}};}function respondWithFilteredResult(_0x1a74bd,_0x49a3a9){return function(_0xffbc0a){if(_0xffbc0a){var _0x39e9c5=_0xffbc0a[_0xfa88('0x19')],_0x40daca=_0x49a3a9[_0xfa88('0x1a')],_0x18380a=_0x49a3a9[_0xfa88('0x1a')]+_0x49a3a9[_0xfa88('0x1b')],_0x506f6f;if(_0x18380a>=_0x39e9c5){_0x18380a=_0x39e9c5;_0x506f6f=0xc8;}else{_0x506f6f=0xce;}_0x1a74bd[_0xfa88('0x1c')](_0x506f6f);return _0x1a74bd[_0xfa88('0x1d')]('Content-Range',_0x40daca+'-'+_0x18380a+'/'+_0x39e9c5)[_0xfa88('0x18')](_0xffbc0a);}return null;};}function patchUpdates(_0xa7fe06){return function(_0x1bfe4f){try{jsonpatch['apply'](_0x1bfe4f,_0xa7fe06,!![]);}catch(_0x182246){return BPromise[_0xfa88('0x1e')](_0x182246);}return _0x1bfe4f['save']();};}function saveUpdates(_0x1e6897,_0x15c286){return function(_0x48c827){if(_0x48c827){return _0x48c827[_0xfa88('0x1f')](_0x1e6897)[_0xfa88('0x20')](function(_0x1b0808){return _0x1b0808;});}return null;};}function removeEntity(_0x57f3b5,_0x5191af){return function(_0x394b93){if(_0x394b93){return _0x394b93[_0xfa88('0x21')]()[_0xfa88('0x20')](function(){_0x57f3b5['status'](0xcc)[_0xfa88('0x17')]();});}};}function handleEntityNotFound(_0x33e5c4,_0x49d00e){return function(_0x5eb8d1){if(!_0x5eb8d1){_0x33e5c4['sendStatus'](0x194);}return _0x5eb8d1;};}function handleError(_0x52bf05,_0x4f0d16){_0x4f0d16=_0x4f0d16||0x1f4;return function(_0x5a4d05){logger[_0xfa88('0x22')](_0x5a4d05[_0xfa88('0x23')]);if(_0x5a4d05['name']){delete _0x5a4d05[_0xfa88('0x24')];}_0x52bf05[_0xfa88('0x1c')](_0x4f0d16)['send'](_0x5a4d05);};}exports[_0xfa88('0x25')]=function(_0x3114a8,_0xcb683e){var _0x531986={},_0x25023f={},_0x193580={'count':0x0,'rows':[]};var _0x586b99=_[_0xfa88('0x26')](db[_0xfa88('0x27')][_0xfa88('0x28')],function(_0x584e7b){return{'name':_0x584e7b[_0xfa88('0x29')],'type':_0x584e7b[_0xfa88('0x2a')][_0xfa88('0x2b')]};});_0x25023f[_0xfa88('0x2c')]=_[_0xfa88('0x26')](_0x586b99,_0xfa88('0x24'));_0x25023f[_0xfa88('0x2d')]=_[_0xfa88('0x2e')](_0x3114a8[_0xfa88('0x2d')]);_0x25023f[_0xfa88('0x2f')]=_['intersection'](_0x25023f[_0xfa88('0x2c')],_0x25023f[_0xfa88('0x2d')]);_0x531986[_0xfa88('0x30')]=_[_0xfa88('0x31')](_0x25023f[_0xfa88('0x2c')],qs['fields'](_0x3114a8[_0xfa88('0x2d')]['fields']));_0x531986[_0xfa88('0x30')]=_0x531986[_0xfa88('0x30')]['length']?_0x531986[_0xfa88('0x30')]:_0x25023f[_0xfa88('0x2c')];if(!_0x3114a8['query'][_0xfa88('0x32')](_0xfa88('0x33'))){_0x531986[_0xfa88('0x1b')]=qs[_0xfa88('0x1b')](_0x3114a8[_0xfa88('0x2d')]['limit']);_0x531986[_0xfa88('0x1a')]=qs[_0xfa88('0x1a')](_0x3114a8[_0xfa88('0x2d')]['offset']);}_0x531986[_0xfa88('0x34')]=qs[_0xfa88('0x35')](_0x3114a8[_0xfa88('0x2d')][_0xfa88('0x35')]);_0x531986[_0xfa88('0x36')]=qs['filters'](_[_0xfa88('0x37')](_0x3114a8[_0xfa88('0x2d')],_0x25023f['filters']),_0x586b99);if(_0x3114a8['query'][_0xfa88('0x38')]){_0x531986[_0xfa88('0x36')]=_['merge'](_0x531986[_0xfa88('0x36')],{'$or':_['map'](_0x586b99,function(_0x354ccc){if(_0x354ccc[_0xfa88('0x2a')]!=='VIRTUAL'){var _0x2fc3c9={};_0x2fc3c9[_0x354ccc[_0xfa88('0x24')]]={'$like':'%'+_0x3114a8[_0xfa88('0x2d')][_0xfa88('0x38')]+'%'};return _0x2fc3c9;}})});}_0x531986=_['merge']({},_0x531986,_0x3114a8[_0xfa88('0x39')]);var _0xce117a={'where':_0x531986[_0xfa88('0x36')]};return db['ServicenowField'][_0xfa88('0x19')](_0xce117a)[_0xfa88('0x20')](function(_0x3a7afc){_0x193580[_0xfa88('0x19')]=_0x3a7afc;if(_0x3114a8[_0xfa88('0x2d')][_0xfa88('0x3a')]){_0x531986[_0xfa88('0x3b')]=[{'all':!![]}];}return db[_0xfa88('0x27')][_0xfa88('0x3c')](_0x531986);})[_0xfa88('0x20')](function(_0x107768){_0x193580[_0xfa88('0x3d')]=_0x107768;return _0x193580;})[_0xfa88('0x20')](respondWithFilteredResult(_0xcb683e,_0x531986))['catch'](handleError(_0xcb683e,null));};exports['show']=function(_0x1fbb29,_0x506c0e){var _0x479f4a={'raw':!![],'where':{'id':_0x1fbb29[_0xfa88('0x3e')]['id']}},_0x2c2dde={};_0x2c2dde[_0xfa88('0x2c')]=_[_0xfa88('0x2e')](db['ServicenowField'][_0xfa88('0x28')]);_0x2c2dde[_0xfa88('0x2d')]=_[_0xfa88('0x2e')](_0x1fbb29[_0xfa88('0x2d')]);_0x2c2dde[_0xfa88('0x2f')]=_[_0xfa88('0x31')](_0x2c2dde[_0xfa88('0x2c')],_0x2c2dde[_0xfa88('0x2d')]);_0x479f4a[_0xfa88('0x30')]=_[_0xfa88('0x31')](_0x2c2dde[_0xfa88('0x2c')],qs['fields'](_0x1fbb29[_0xfa88('0x2d')][_0xfa88('0x3f')]));_0x479f4a[_0xfa88('0x30')]=_0x479f4a['attributes'][_0xfa88('0x40')]?_0x479f4a[_0xfa88('0x30')]:_0x2c2dde[_0xfa88('0x2c')];if(_0x1fbb29[_0xfa88('0x2d')]['includeAll']){_0x479f4a[_0xfa88('0x3b')]=[{'all':!![]}];}_0x479f4a=_[_0xfa88('0x41')]({},_0x479f4a,_0x1fbb29[_0xfa88('0x39')]);return db[_0xfa88('0x27')][_0xfa88('0x42')](_0x479f4a)[_0xfa88('0x20')](handleEntityNotFound(_0x506c0e,null))[_0xfa88('0x20')](respondWithResult(_0x506c0e,null))[_0xfa88('0x43')](handleError(_0x506c0e,null));};exports[_0xfa88('0x44')]=function(_0xda3c88,_0x23f2a3){return db[_0xfa88('0x27')]['create'](_0xda3c88[_0xfa88('0x45')],{})[_0xfa88('0x20')](respondWithResult(_0x23f2a3,0xc9))[_0xfa88('0x43')](handleError(_0x23f2a3,null));};exports[_0xfa88('0x1f')]=function(_0x2a48b7,_0x5f33a5){if(_0x2a48b7[_0xfa88('0x45')]['id']){delete _0x2a48b7[_0xfa88('0x45')]['id'];}return db[_0xfa88('0x27')][_0xfa88('0x42')]({'where':{'id':_0x2a48b7[_0xfa88('0x3e')]['id']}})[_0xfa88('0x20')](handleEntityNotFound(_0x5f33a5,null))[_0xfa88('0x20')](saveUpdates(_0x2a48b7[_0xfa88('0x45')],null))[_0xfa88('0x20')](respondWithResult(_0x5f33a5,null))[_0xfa88('0x43')](handleError(_0x5f33a5,null));};exports[_0xfa88('0x21')]=function(_0x55bce8,_0x5db9ad){return db[_0xfa88('0x27')][_0xfa88('0x42')]({'where':{'id':_0x55bce8['params']['id']}})[_0xfa88('0x20')](handleEntityNotFound(_0x5db9ad,null))[_0xfa88('0x20')](removeEntity(_0x5db9ad,null))[_0xfa88('0x43')](handleError(_0x5db9ad,null));}; \ No newline at end of file +var _0xae24=['find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','options'];(function(_0x3241f3,_0x537340){var _0x29ac16=function(_0x1847a3){while(--_0x1847a3){_0x3241f3['push'](_0x3241f3['shift']());}};_0x29ac16(++_0x537340);}(_0xae24,0x180));var _0x4ae2=function(_0x42b2f0,_0x162154){_0x42b2f0=_0x42b2f0-0x0;var _0x45ea1a=_0xae24[_0x42b2f0];return _0x45ea1a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4ae2('0x0'));var zipdir=require(_0x4ae2('0x1'));var jsonpatch=require(_0x4ae2('0x2'));var rp=require(_0x4ae2('0x3'));var moment=require(_0x4ae2('0x4'));var BPromise=require(_0x4ae2('0x5'));var Mustache=require(_0x4ae2('0x6'));var util=require(_0x4ae2('0x7'));var path=require(_0x4ae2('0x8'));var sox=require(_0x4ae2('0x9'));var csv=require('to-csv');var ejs=require(_0x4ae2('0xa'));var fs=require('fs');var _=require(_0x4ae2('0xb'));var squel=require(_0x4ae2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xd'));var toCsv=require(_0x4ae2('0xe'));var querystring=require(_0x4ae2('0xf'));var Papa=require(_0x4ae2('0x10'));var Redis=require(_0x4ae2('0x11'));var authService=require(_0x4ae2('0x12'));var qs=require(_0x4ae2('0x13'));var as=require(_0x4ae2('0x14'));var hardwareService=require(_0x4ae2('0x15'));var logger=require('../../config/logger')(_0x4ae2('0x16'));var utils=require(_0x4ae2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ae2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19ac8c,_0x31d4ac){_0x31d4ac=_0x31d4ac||0xcc;return function(_0x56d071){if(_0x56d071){return _0x19ac8c[_0x4ae2('0x19')](_0x31d4ac);}return _0x19ac8c['status'](_0x31d4ac)[_0x4ae2('0x1a')]();};}function respondWithResult(_0x65b027,_0x4e8a83){_0x4e8a83=_0x4e8a83||0xc8;return function(_0x31d465){if(_0x31d465){return _0x65b027[_0x4ae2('0x1b')](_0x4e8a83)[_0x4ae2('0x1c')](_0x31d465);}};}function respondWithFilteredResult(_0x2765aa,_0x3b8a9f){return function(_0x21dbde){if(_0x21dbde){var _0x4939dd=_0x21dbde[_0x4ae2('0x1d')],_0x2d356e=_0x3b8a9f['offset'],_0x311af9=_0x3b8a9f[_0x4ae2('0x1e')]+_0x3b8a9f[_0x4ae2('0x1f')],_0x154df2;if(_0x311af9>=_0x4939dd){_0x311af9=_0x4939dd;_0x154df2=0xc8;}else{_0x154df2=0xce;}_0x2765aa[_0x4ae2('0x1b')](_0x154df2);return _0x2765aa['set'](_0x4ae2('0x20'),_0x2d356e+'-'+_0x311af9+'/'+_0x4939dd)['json'](_0x21dbde);}return null;};}function patchUpdates(_0x1104a0){return function(_0x3ac904){try{jsonpatch[_0x4ae2('0x21')](_0x3ac904,_0x1104a0,!![]);}catch(_0x5cc1ee){return BPromise[_0x4ae2('0x22')](_0x5cc1ee);}return _0x3ac904[_0x4ae2('0x23')]();};}function saveUpdates(_0x1b702c,_0x127267){return function(_0x234b31){if(_0x234b31){return _0x234b31[_0x4ae2('0x24')](_0x1b702c)[_0x4ae2('0x25')](function(_0x4ed053){return _0x4ed053;});}return null;};}function removeEntity(_0x32d601,_0x496936){return function(_0x1eae9a){if(_0x1eae9a){return _0x1eae9a['destroy']()[_0x4ae2('0x25')](function(){_0x32d601[_0x4ae2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2002ae,_0x1ce070){return function(_0x5d909d){if(!_0x5d909d){_0x2002ae[_0x4ae2('0x19')](0x194);}return _0x5d909d;};}function handleError(_0x5d8989,_0x39b5aa){_0x39b5aa=_0x39b5aa||0x1f4;return function(_0x47c965){logger[_0x4ae2('0x26')](_0x47c965[_0x4ae2('0x27')]);if(_0x47c965[_0x4ae2('0x28')]){delete _0x47c965[_0x4ae2('0x28')];}_0x5d8989[_0x4ae2('0x1b')](_0x39b5aa)[_0x4ae2('0x29')](_0x47c965);};}exports['index']=function(_0xb43d99,_0x3a47f8){var _0x27620d={},_0x275c21={},_0x4e3a16={'count':0x0,'rows':[]};var _0x16b624=_[_0x4ae2('0x2a')](db[_0x4ae2('0x2b')][_0x4ae2('0x2c')],function(_0x548d38){return{'name':_0x548d38[_0x4ae2('0x2d')],'type':_0x548d38[_0x4ae2('0x2e')][_0x4ae2('0x2f')]};});_0x275c21[_0x4ae2('0x30')]=_[_0x4ae2('0x2a')](_0x16b624,_0x4ae2('0x28'));_0x275c21[_0x4ae2('0x31')]=_[_0x4ae2('0x32')](_0xb43d99['query']);_0x275c21['filters']=_['intersection'](_0x275c21['model'],_0x275c21[_0x4ae2('0x31')]);_0x27620d[_0x4ae2('0x33')]=_[_0x4ae2('0x34')](_0x275c21[_0x4ae2('0x30')],qs['fields'](_0xb43d99[_0x4ae2('0x31')][_0x4ae2('0x35')]));_0x27620d[_0x4ae2('0x33')]=_0x27620d['attributes'][_0x4ae2('0x36')]?_0x27620d[_0x4ae2('0x33')]:_0x275c21[_0x4ae2('0x30')];if(!_0xb43d99[_0x4ae2('0x31')][_0x4ae2('0x37')](_0x4ae2('0x38'))){_0x27620d[_0x4ae2('0x1f')]=qs[_0x4ae2('0x1f')](_0xb43d99[_0x4ae2('0x31')]['limit']);_0x27620d['offset']=qs['offset'](_0xb43d99[_0x4ae2('0x31')][_0x4ae2('0x1e')]);}_0x27620d[_0x4ae2('0x39')]=qs[_0x4ae2('0x3a')](_0xb43d99['query'][_0x4ae2('0x3a')]);_0x27620d['where']=qs[_0x4ae2('0x3b')](_[_0x4ae2('0x3c')](_0xb43d99['query'],_0x275c21[_0x4ae2('0x3b')]),_0x16b624);if(_0xb43d99[_0x4ae2('0x31')][_0x4ae2('0x3d')]){_0x27620d[_0x4ae2('0x3e')]=_[_0x4ae2('0x3f')](_0x27620d[_0x4ae2('0x3e')],{'$or':_[_0x4ae2('0x2a')](_0x16b624,function(_0x189509){if(_0x189509[_0x4ae2('0x2e')]!=='VIRTUAL'){var _0x32f3a0={};_0x32f3a0[_0x189509[_0x4ae2('0x28')]]={'$like':'%'+_0xb43d99[_0x4ae2('0x31')][_0x4ae2('0x3d')]+'%'};return _0x32f3a0;}})});}_0x27620d=_[_0x4ae2('0x3f')]({},_0x27620d,_0xb43d99['options']);var _0x447ff9={'where':_0x27620d[_0x4ae2('0x3e')]};return db[_0x4ae2('0x2b')][_0x4ae2('0x1d')](_0x447ff9)['then'](function(_0x1bc35f){_0x4e3a16[_0x4ae2('0x1d')]=_0x1bc35f;if(_0xb43d99['query'][_0x4ae2('0x40')]){_0x27620d[_0x4ae2('0x41')]=[{'all':!![]}];}return db['ServicenowField'][_0x4ae2('0x42')](_0x27620d);})[_0x4ae2('0x25')](function(_0x25020d){_0x4e3a16[_0x4ae2('0x43')]=_0x25020d;return _0x4e3a16;})[_0x4ae2('0x25')](respondWithFilteredResult(_0x3a47f8,_0x27620d))[_0x4ae2('0x44')](handleError(_0x3a47f8,null));};exports[_0x4ae2('0x45')]=function(_0x28c5b7,_0x5874e3){var _0x5446f4={'raw':!![],'where':{'id':_0x28c5b7[_0x4ae2('0x46')]['id']}},_0x3a69ce={};_0x3a69ce[_0x4ae2('0x30')]=_[_0x4ae2('0x32')](db[_0x4ae2('0x2b')][_0x4ae2('0x2c')]);_0x3a69ce['query']=_[_0x4ae2('0x32')](_0x28c5b7['query']);_0x3a69ce[_0x4ae2('0x3b')]=_[_0x4ae2('0x34')](_0x3a69ce['model'],_0x3a69ce['query']);_0x5446f4[_0x4ae2('0x33')]=_[_0x4ae2('0x34')](_0x3a69ce[_0x4ae2('0x30')],qs[_0x4ae2('0x35')](_0x28c5b7[_0x4ae2('0x31')][_0x4ae2('0x35')]));_0x5446f4[_0x4ae2('0x33')]=_0x5446f4['attributes'][_0x4ae2('0x36')]?_0x5446f4[_0x4ae2('0x33')]:_0x3a69ce[_0x4ae2('0x30')];if(_0x28c5b7['query'][_0x4ae2('0x40')]){_0x5446f4[_0x4ae2('0x41')]=[{'all':!![]}];}_0x5446f4=_[_0x4ae2('0x3f')]({},_0x5446f4,_0x28c5b7[_0x4ae2('0x47')]);return db['ServicenowField'][_0x4ae2('0x48')](_0x5446f4)[_0x4ae2('0x25')](handleEntityNotFound(_0x5874e3,null))[_0x4ae2('0x25')](respondWithResult(_0x5874e3,null))[_0x4ae2('0x44')](handleError(_0x5874e3,null));};exports[_0x4ae2('0x49')]=function(_0x58d9fe,_0x109af0){return db[_0x4ae2('0x2b')][_0x4ae2('0x49')](_0x58d9fe[_0x4ae2('0x4a')],{})[_0x4ae2('0x25')](respondWithResult(_0x109af0,0xc9))['catch'](handleError(_0x109af0,null));};exports[_0x4ae2('0x24')]=function(_0x57d401,_0x3080d1){if(_0x57d401['body']['id']){delete _0x57d401[_0x4ae2('0x4a')]['id'];}return db[_0x4ae2('0x2b')][_0x4ae2('0x48')]({'where':{'id':_0x57d401['params']['id']}})[_0x4ae2('0x25')](handleEntityNotFound(_0x3080d1,null))[_0x4ae2('0x25')](saveUpdates(_0x57d401[_0x4ae2('0x4a')],null))['then'](respondWithResult(_0x3080d1,null))[_0x4ae2('0x44')](handleError(_0x3080d1,null));};exports[_0x4ae2('0x4b')]=function(_0x1934dd,_0x2d0174){return db[_0x4ae2('0x2b')]['find']({'where':{'id':_0x1934dd[_0x4ae2('0x46')]['id']}})[_0x4ae2('0x25')](handleEntityNotFound(_0x2d0174,null))[_0x4ae2('0x25')](removeEntity(_0x2d0174,null))[_0x4ae2('0x44')](handleError(_0x2d0174,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index ed26d4e..9f681cb 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 _0xc8d8=['servicenow_unique_index','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0xc8d8,0xfd));var _0x8c8d=function(_0x1aaa52,_0x442418){_0x1aaa52=_0x1aaa52-0x0;var _0x1a3b6a=_0xc8d8[_0x1aaa52];return _0x1a3b6a;};'use strict';var _=require(_0x8c8d('0x0'));var util=require(_0x8c8d('0x1'));var logger=require(_0x8c8d('0x2'))(_0x8c8d('0x3'));var moment=require(_0x8c8d('0x4'));var BPromise=require(_0x8c8d('0x5'));var rp=require(_0x8c8d('0x6'));var fs=require('fs');var path=require(_0x8c8d('0x7'));var rimraf=require(_0x8c8d('0x8'));var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module[_0x8c8d('0x9')]=function(_0x29b45b,_0x12420d){return _0x29b45b[_0x8c8d('0xa')](_0x8c8d('0xb'),attributes,{'tableName':_0x8c8d('0xc'),'paranoid':![],'indexes':[{'name':_0x8c8d('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc68e=['servicenow_unique_index','idField','FieldId','lodash','util','api','moment','request-promise','path','rimraf','./intServicenowField.attributes','define','ServicenowField'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc68e,0x1e4));var _0xec68=function(_0x24cc8a,_0x19dd8f){_0x24cc8a=_0x24cc8a-0x0;var _0x28c75f=_0xc68e[_0x24cc8a];return _0x28c75f;};'use strict';var _=require(_0xec68('0x0'));var util=require(_0xec68('0x1'));var logger=require('../../config/logger')(_0xec68('0x2'));var moment=require(_0xec68('0x3'));var BPromise=require('bluebird');var rp=require(_0xec68('0x4'));var fs=require('fs');var path=require(_0xec68('0x5'));var rimraf=require(_0xec68('0x6'));var config=require('../../config/environment');var attributes=require(_0xec68('0x7'));module['exports']=function(_0x2f9fda,_0x33ced2){return _0x2f9fda[_0xec68('0x8')](_0xec68('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xec68('0xa'),'fields':[_0xec68('0xb'),_0xec68('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 125e122..8b50041 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 _0xf9b3=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0xf9b3,0x162));var _0x3f9b=function(_0x5e4356,_0x3034e3){_0x5e4356=_0x5e4356-0x0;var _0x4fc097=_0xf9b3[_0x5e4356];return _0x4fc097;};'use strict';var _=require(_0x3f9b('0x0'));var util=require(_0x3f9b('0x1'));var moment=require(_0x3f9b('0x2'));var BPromise=require(_0x3f9b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f9b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f9b('0x5'));var logger=require('../../config/logger')(_0x3f9b('0x6'));var config=require(_0x3f9b('0x7'));var jayson=require(_0x3f9b('0x8'));var client=jayson[_0x3f9b('0x9')][_0x3f9b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3151a5,_0x26314d,_0x24f776){return new BPromise(function(_0x2b8536,_0x26a834){return client[_0x3f9b('0xb')](_0x3151a5,_0x24f776)[_0x3f9b('0xc')](function(_0x389e22){logger[_0x3f9b('0xd')](_0x3f9b('0xe'),_0x26314d,_0x3f9b('0xf'));logger[_0x3f9b('0x10')](_0x3f9b('0x11'),_0x26314d,'request\x20sent',JSON[_0x3f9b('0x12')](_0x389e22));if(_0x389e22['error']){if(_0x389e22[_0x3f9b('0x13')]['code']===0x1f4){logger[_0x3f9b('0x13')](_0x3f9b('0xe'),_0x26314d,_0x389e22['error'][_0x3f9b('0x14')]);return _0x26a834(_0x389e22[_0x3f9b('0x13')][_0x3f9b('0x14')]);}logger[_0x3f9b('0x13')](_0x3f9b('0xe'),_0x26314d,_0x389e22[_0x3f9b('0x13')][_0x3f9b('0x14')]);return _0x2b8536(_0x389e22[_0x3f9b('0x13')][_0x3f9b('0x14')]);}else{logger[_0x3f9b('0xd')](_0x3f9b('0xe'),_0x26314d,_0x3f9b('0xf'));_0x2b8536(_0x389e22[_0x3f9b('0x15')][_0x3f9b('0x14')]);}})[_0x3f9b('0x16')](function(_0x1dd8b1){logger[_0x3f9b('0x13')](_0x3f9b('0xe'),_0x26314d,_0x1dd8b1);_0x26a834(_0x1dd8b1);});});} \ No newline at end of file +var _0x9e4e=['ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowField,\x20%s,\x20%s','message','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','request\x20sent'];(function(_0x2b2e73,_0x38b3c9){var _0x4cd529=function(_0x39289d){while(--_0x39289d){_0x2b2e73['push'](_0x2b2e73['shift']());}};_0x4cd529(++_0x38b3c9);}(_0x9e4e,0x1ce));var _0xe9e4=function(_0x5c69d4,_0x907519){_0x5c69d4=_0x5c69d4-0x0;var _0x59778e=_0x9e4e[_0x5c69d4];return _0x59778e;};'use strict';var _=require(_0xe9e4('0x0'));var util=require('util');var moment=require(_0xe9e4('0x1'));var BPromise=require('bluebird');var rs=require(_0xe9e4('0x2'));var fs=require('fs');var Redis=require(_0xe9e4('0x3'));var db=require(_0xe9e4('0x4'))['db'];var utils=require(_0xe9e4('0x5'));var logger=require(_0xe9e4('0x6'))(_0xe9e4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe9e4('0x8')][_0xe9e4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x131042,_0x5cc94b,_0x1edda6){return new BPromise(function(_0x5b4469,_0x33e2c9){return client[_0xe9e4('0xa')](_0x131042,_0x1edda6)['then'](function(_0x436c67){logger[_0xe9e4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5cc94b,_0xe9e4('0xc'));logger['debug'](_0xe9e4('0xd'),_0x5cc94b,_0xe9e4('0xc'),JSON[_0xe9e4('0xe')](_0x436c67));if(_0x436c67[_0xe9e4('0xf')]){if(_0x436c67[_0xe9e4('0xf')][_0xe9e4('0x10')]===0x1f4){logger['error'](_0xe9e4('0x11'),_0x5cc94b,_0x436c67[_0xe9e4('0xf')][_0xe9e4('0x12')]);return _0x33e2c9(_0x436c67[_0xe9e4('0xf')][_0xe9e4('0x12')]);}logger['error'](_0xe9e4('0x11'),_0x5cc94b,_0x436c67[_0xe9e4('0xf')]['message']);return _0x5b4469(_0x436c67[_0xe9e4('0xf')]['message']);}else{logger[_0xe9e4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5cc94b,_0xe9e4('0xc'));_0x5b4469(_0x436c67['result'][_0xe9e4('0x12')]);}})['catch'](function(_0x56d174){logger[_0xe9e4('0xf')]('ServicenowField,\x20%s,\x20%s',_0x5cc94b,_0x56d174);_0x33e2c9(_0x56d174);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index ff27aeb..2acb571 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 _0x7866=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get'];(function(_0xf3120,_0x80a54c){var _0x5aa549=function(_0x17ba5b){while(--_0x17ba5b){_0xf3120['push'](_0xf3120['shift']());}};_0x5aa549(++_0x80a54c);}(_0x7866,0x114));var _0x6786=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x7866[_0x1deb03];return _0x189fe7;};'use strict';var multer=require(_0x6786('0x0'));var util=require(_0x6786('0x1'));var path=require('path');var timeout=require(_0x6786('0x2'));var express=require(_0x6786('0x3'));var router=express[_0x6786('0x4')]();var auth=require(_0x6786('0x5'));var interaction=require(_0x6786('0x6'));var config=require(_0x6786('0x7'));var controller=require(_0x6786('0x8'));router[_0x6786('0x9')]('/',auth[_0x6786('0xa')](),controller[_0x6786('0xb')]);router[_0x6786('0x9')](_0x6786('0xc'),auth[_0x6786('0xa')](),controller[_0x6786('0xd')]);router['get'](_0x6786('0xe'),auth[_0x6786('0xa')](),controller[_0x6786('0xf')]);router[_0x6786('0x9')](_0x6786('0x10'),auth[_0x6786('0xa')](),controller[_0x6786('0x11')]);router[_0x6786('0x12')]('/',auth[_0x6786('0xa')](),controller[_0x6786('0x13')]);router[_0x6786('0x12')]('/:id/configurations',auth[_0x6786('0xa')](),controller[_0x6786('0x14')]);router[_0x6786('0x15')](_0x6786('0xc'),auth['isAuthenticated'](),controller[_0x6786('0x16')]);router[_0x6786('0x17')]('/:id',auth[_0x6786('0xa')](),controller[_0x6786('0x18')]);module[_0x6786('0x19')]=router; \ No newline at end of file +var _0x23c5=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x151a45,_0x179af6){var _0x2f17d5=function(_0x484748){while(--_0x484748){_0x151a45['push'](_0x151a45['shift']());}};_0x2f17d5(++_0x179af6);}(_0x23c5,0x128));var _0x523c=function(_0x4defa9,_0x267ca5){_0x4defa9=_0x4defa9-0x0;var _0x267605=_0x23c5[_0x4defa9];return _0x267605;};'use strict';var multer=require(_0x523c('0x0'));var util=require(_0x523c('0x1'));var path=require(_0x523c('0x2'));var timeout=require('connect-timeout');var express=require(_0x523c('0x3'));var router=express[_0x523c('0x4')]();var auth=require(_0x523c('0x5'));var interaction=require(_0x523c('0x6'));var config=require(_0x523c('0x7'));var controller=require(_0x523c('0x8'));router[_0x523c('0x9')]('/',auth[_0x523c('0xa')](),controller['index']);router[_0x523c('0x9')](_0x523c('0xb'),auth[_0x523c('0xa')](),controller[_0x523c('0xc')]);router[_0x523c('0x9')](_0x523c('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x523c('0x9')](_0x523c('0xe'),auth[_0x523c('0xa')](),controller[_0x523c('0xf')]);router['post']('/',auth[_0x523c('0xa')](),controller[_0x523c('0x10')]);router['post'](_0x523c('0xd'),auth[_0x523c('0xa')](),controller[_0x523c('0x11')]);router[_0x523c('0x12')](_0x523c('0xb'),auth[_0x523c('0xa')](),controller[_0x523c('0x13')]);router[_0x523c('0x14')](_0x523c('0xb'),auth[_0x523c('0xa')](),controller[_0x523c('0x15')]);module[_0x523c('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 2227d5d..d8b390d 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 _0x7ac4=['STRING','username','remoteUri','sequelize','exports'];(function(_0x50d825,_0x8c86bf){var _0x5c27b5=function(_0x152fed){while(--_0x152fed){_0x50d825['push'](_0x50d825['shift']());}};_0x5c27b5(++_0x8c86bf);}(_0x7ac4,0x6c));var _0x47ac=function(_0x1a52f7,_0x32f669){_0x1a52f7=_0x1a52f7-0x0;var _0x151b11=_0x7ac4[_0x1a52f7];return _0x151b11;};'use strict';var Sequelize=require(_0x47ac('0x0'));module[_0x47ac('0x1')]={'name':{'type':Sequelize[_0x47ac('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x47ac('0x2')],'unique':_0x47ac('0x3')},'password':{'type':Sequelize[_0x47ac('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x47ac('0x4')},'serverUrl':{'type':Sequelize[_0x47ac('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x807d=['username','remoteUri','exports','STRING'];(function(_0x3546cf,_0x3f9c95){var _0xc9e46b=function(_0x2d4552){while(--_0x2d4552){_0x3546cf['push'](_0x3546cf['shift']());}};_0xc9e46b(++_0x3f9c95);}(_0x807d,0x182));var _0xd807=function(_0x520194,_0x2feb35){_0x520194=_0x520194-0x0;var _0x2630c6=_0x807d[_0x520194];return _0x2630c6;};'use strict';var Sequelize=require('sequelize');module[_0xd807('0x0')]={'name':{'type':Sequelize[_0xd807('0x1')]},'description':{'type':Sequelize[_0xd807('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xd807('0x2')},'password':{'type':Sequelize[_0xd807('0x1')]},'remoteUri':{'type':Sequelize[_0xd807('0x1')],'unique':_0xd807('0x3')},'serverUrl':{'type':Sequelize[_0xd807('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 dc3eb3b..11886ca 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 _0x8927=['util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','sendStatus','stack','name','send','SugarcrmAccount','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','username','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','includes','label','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x448970,_0x44b9b4){var _0x2fa420=function(_0x10a754){while(--_0x10a754){_0x448970['push'](_0x448970['shift']());}};_0x2fa420(++_0x44b9b4);}(_0x8927,0x7b));var _0x7892=function(_0x2e31b0,_0x52a170){_0x2e31b0=_0x2e31b0-0x0;var _0x57b64e=_0x8927[_0x2e31b0];return _0x57b64e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7892('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7892('0x1'));var jsonpatch=require(_0x7892('0x2'));var rp=require('request-promise');var moment=require(_0x7892('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7892('0x4'));var path=require(_0x7892('0x5'));var sox=require(_0x7892('0x6'));var csv=require(_0x7892('0x7'));var ejs=require(_0x7892('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7892('0x9'));var deskjs=require(_0x7892('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7892('0xb'));var Papa=require(_0x7892('0xc'));var Redis=require(_0x7892('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7892('0xe'));var hardwareService=require(_0x7892('0xf'));var logger=require(_0x7892('0x10'))(_0x7892('0x11'));var utils=require('../../config/utils');var config=require(_0x7892('0x12'));var licenseUtil=require(_0x7892('0x13'));var db=require(_0x7892('0x14'))['db'];var integrations=require(_0x7892('0x15'));var jayson=require(_0x7892('0x16'));var client=jayson[_0x7892('0x17')][_0x7892('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576330,_0x4ee21a,_0x5b64b4,_0x31d53e){return new BPromise(function(_0x57c298,_0x51156a){var _0x563dde=_0x31d53e||client;return _0x563dde['request'](_0x576330,_0x5b64b4)[_0x7892('0x19')](function(_0x32dfc8){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x4ee21a,_0x7892('0x1a'));logger[_0x7892('0x1b')](_0x7892('0x1c'),_0x4ee21a,_0x7892('0x1a'),JSON[_0x7892('0x1d')](_0x32dfc8));if(_0x32dfc8[_0x7892('0x1e')]){if(_0x32dfc8[_0x7892('0x1e')][_0x7892('0x1f')]===0x1f4){logger[_0x7892('0x1e')](_0x7892('0x20'),_0x4ee21a,_0x32dfc8[_0x7892('0x1e')][_0x7892('0x21')]);return _0x51156a(_0x32dfc8[_0x7892('0x1e')][_0x7892('0x21')]);}logger[_0x7892('0x1e')](_0x7892('0x20'),_0x4ee21a,_0x32dfc8[_0x7892('0x1e')][_0x7892('0x21')]);return _0x57c298(_0x32dfc8[_0x7892('0x1e')][_0x7892('0x21')]);}else{logger[_0x7892('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0x4ee21a,'request\x20sent');_0x57c298(_0x32dfc8[_0x7892('0x23')][_0x7892('0x21')]);}})['catch'](function(_0x131759){logger[_0x7892('0x1e')](_0x7892('0x20'),_0x4ee21a,_0x131759);_0x51156a(_0x131759);});});}function respondWithStatusCode(_0x1930a3,_0x29776a){_0x29776a=_0x29776a||0xcc;return function(_0x5255bc){if(_0x5255bc){return _0x1930a3['sendStatus'](_0x29776a);}return _0x1930a3[_0x7892('0x24')](_0x29776a)[_0x7892('0x25')]();};}function respondWithResult(_0x1060ed,_0x324377){_0x324377=_0x324377||0xc8;return function(_0x58f4f4){if(_0x58f4f4){return _0x1060ed[_0x7892('0x24')](_0x324377)[_0x7892('0x26')](_0x58f4f4);}};}function respondWithFilteredResult(_0x9c8dc3,_0x21215f){return function(_0x5c7e0f){if(_0x5c7e0f){var _0x52945a=_0x5c7e0f[_0x7892('0x27')],_0x67a87b=_0x21215f[_0x7892('0x28')],_0x79e147=_0x21215f['offset']+_0x21215f[_0x7892('0x29')],_0x1bb7fb;if(_0x79e147>=_0x52945a){_0x79e147=_0x52945a;_0x1bb7fb=0xc8;}else{_0x1bb7fb=0xce;}_0x9c8dc3['status'](_0x1bb7fb);return _0x9c8dc3[_0x7892('0x2a')]('Content-Range',_0x67a87b+'-'+_0x79e147+'/'+_0x52945a)['json'](_0x5c7e0f);}return null;};}function patchUpdates(_0x2d38f6){return function(_0xe55b4){try{jsonpatch[_0x7892('0x2b')](_0xe55b4,_0x2d38f6,!![]);}catch(_0xbaf7ca){return BPromise[_0x7892('0x2c')](_0xbaf7ca);}return _0xe55b4[_0x7892('0x2d')]();};}function saveUpdates(_0x42707f,_0x17f7da){return function(_0x1d7417){if(_0x1d7417){return _0x1d7417[_0x7892('0x2e')](_0x42707f)[_0x7892('0x19')](function(_0x119025){return _0x119025;});}return null;};}function removeEntity(_0xb7dea2,_0x23be74){return function(_0x38d625){if(_0x38d625){return _0x38d625[_0x7892('0x2f')]()[_0x7892('0x19')](function(){_0xb7dea2[_0x7892('0x24')](0xcc)[_0x7892('0x25')]();});}};}function handleEntityNotFound(_0x23a25f,_0x2d1e55){return function(_0x11bc5c){if(!_0x11bc5c){_0x23a25f[_0x7892('0x30')](0x194);}return _0x11bc5c;};}function handleError(_0x202919,_0x253fbf){_0x253fbf=_0x253fbf||0x1f4;return function(_0xac0d7f){logger['error'](_0xac0d7f[_0x7892('0x31')]);if(_0xac0d7f[_0x7892('0x32')]){delete _0xac0d7f[_0x7892('0x32')];}_0x202919[_0x7892('0x24')](_0x253fbf)[_0x7892('0x33')](_0xac0d7f);};}exports['index']=function(_0x26d296,_0x4a2c01){var _0x35e492={},_0x23f78e={},_0x293d4b={'count':0x0,'rows':[]};var _0x43f510=_['map'](db[_0x7892('0x34')][_0x7892('0x35')],function(_0x317c60){return{'name':_0x317c60['fieldName'],'type':_0x317c60[_0x7892('0x36')][_0x7892('0x37')]};});_0x23f78e['model']=_[_0x7892('0x38')](_0x43f510,_0x7892('0x32'));_0x23f78e[_0x7892('0x39')]=_[_0x7892('0x3a')](_0x26d296[_0x7892('0x39')]);_0x23f78e[_0x7892('0x3b')]=_[_0x7892('0x3c')](_0x23f78e[_0x7892('0x3d')],_0x23f78e[_0x7892('0x39')]);_0x35e492[_0x7892('0x3e')]=_[_0x7892('0x3c')](_0x23f78e[_0x7892('0x3d')],qs[_0x7892('0x3f')](_0x26d296[_0x7892('0x39')]['fields']));_0x35e492[_0x7892('0x3e')]=_0x35e492[_0x7892('0x3e')][_0x7892('0x40')]?_0x35e492[_0x7892('0x3e')]:_0x23f78e['model'];if(!_0x26d296[_0x7892('0x39')][_0x7892('0x41')](_0x7892('0x42'))){_0x35e492[_0x7892('0x29')]=qs[_0x7892('0x29')](_0x26d296[_0x7892('0x39')][_0x7892('0x29')]);_0x35e492[_0x7892('0x28')]=qs[_0x7892('0x28')](_0x26d296[_0x7892('0x39')][_0x7892('0x28')]);}_0x35e492[_0x7892('0x43')]=qs['sort'](_0x26d296[_0x7892('0x39')][_0x7892('0x44')]);_0x35e492[_0x7892('0x45')]=qs[_0x7892('0x3b')](_[_0x7892('0x46')](_0x26d296['query'],_0x23f78e[_0x7892('0x3b')]),_0x43f510);if(_0x26d296[_0x7892('0x39')]['filter']){_0x35e492['where']=_[_0x7892('0x47')](_0x35e492[_0x7892('0x45')],{'$or':_[_0x7892('0x38')](_0x43f510,function(_0x28fd4b){if(_0x28fd4b[_0x7892('0x36')]!==_0x7892('0x48')){var _0xcaa5b={};_0xcaa5b[_0x28fd4b['name']]={'$like':'%'+_0x26d296[_0x7892('0x39')][_0x7892('0x49')]+'%'};return _0xcaa5b;}})});}_0x35e492=_[_0x7892('0x47')]({},_0x35e492,_0x26d296[_0x7892('0x4a')]);var _0x151018={'where':_0x35e492[_0x7892('0x45')]};return db[_0x7892('0x34')][_0x7892('0x27')](_0x151018)[_0x7892('0x19')](function(_0x355c9f){_0x293d4b[_0x7892('0x27')]=_0x355c9f;if(_0x26d296[_0x7892('0x39')][_0x7892('0x4b')]){_0x35e492[_0x7892('0x4c')]=[{'all':!![]}];}return db[_0x7892('0x34')][_0x7892('0x4d')](_0x35e492);})[_0x7892('0x19')](function(_0x1e485e){_0x293d4b['rows']=_0x1e485e;return _0x293d4b;})[_0x7892('0x19')](respondWithFilteredResult(_0x4a2c01,_0x35e492))[_0x7892('0x4e')](handleError(_0x4a2c01,null));};exports['show']=function(_0x11faf0,_0x271ac3){var _0x11699d={'raw':![],'where':{'id':_0x11faf0[_0x7892('0x4f')]['id']}},_0x43fd17={};_0x43fd17[_0x7892('0x3d')]=_[_0x7892('0x3a')](db[_0x7892('0x34')]['rawAttributes']);_0x43fd17[_0x7892('0x39')]=_[_0x7892('0x3a')](_0x11faf0['query']);_0x43fd17[_0x7892('0x3b')]=_[_0x7892('0x3c')](_0x43fd17[_0x7892('0x3d')],_0x43fd17[_0x7892('0x39')]);_0x11699d['attributes']=_[_0x7892('0x3c')](_0x43fd17[_0x7892('0x3d')],qs[_0x7892('0x3f')](_0x11faf0[_0x7892('0x39')]['fields']));_0x11699d[_0x7892('0x3e')]=_0x11699d[_0x7892('0x3e')][_0x7892('0x40')]?_0x11699d[_0x7892('0x3e')]:_0x43fd17['model'];if(_0x11faf0[_0x7892('0x39')][_0x7892('0x4b')]){_0x11699d[_0x7892('0x4c')]=[{'all':!![]}];}_0x11699d=_[_0x7892('0x47')]({},_0x11699d,_0x11faf0[_0x7892('0x4a')]);return db[_0x7892('0x34')][_0x7892('0x50')](_0x11699d)[_0x7892('0x19')](handleEntityNotFound(_0x271ac3,null))[_0x7892('0x19')](respondWithResult(_0x271ac3,null))[_0x7892('0x4e')](handleError(_0x271ac3,null));};exports['create']=function(_0x22c9c9,_0x52186d){return db[_0x7892('0x34')][_0x7892('0x51')](_0x22c9c9[_0x7892('0x52')],{})[_0x7892('0x19')](respondWithResult(_0x52186d,0xc9))['catch'](handleError(_0x52186d,null));};exports[_0x7892('0x2e')]=function(_0x50fcdc,_0x17511d){if(_0x50fcdc['body']['id']){delete _0x50fcdc[_0x7892('0x52')]['id'];}return db[_0x7892('0x34')][_0x7892('0x50')]({'where':{'id':_0x50fcdc[_0x7892('0x4f')]['id']}})[_0x7892('0x19')](handleEntityNotFound(_0x17511d,null))[_0x7892('0x19')](saveUpdates(_0x50fcdc['body'],null))[_0x7892('0x19')](respondWithResult(_0x17511d,null))[_0x7892('0x4e')](handleError(_0x17511d,null));};exports['destroy']=function(_0x328e3b,_0x48c1c2){return db[_0x7892('0x34')][_0x7892('0x50')]({'where':{'id':_0x328e3b[_0x7892('0x4f')]['id']}})['then'](handleEntityNotFound(_0x48c1c2,null))[_0x7892('0x19')](removeEntity(_0x48c1c2,null))['catch'](handleError(_0x48c1c2,null));};exports[_0x7892('0x53')]=function(_0x17c096,_0x32800c,_0x7334e6){var _0x6d4d82={};var _0x5999ef={};var _0x48fd98;var _0x548b05;return db[_0x7892('0x34')][_0x7892('0x54')]({'where':{'id':_0x17c096[_0x7892('0x4f')]['id']}})['then'](handleEntityNotFound(_0x32800c,null))['then'](function(_0x418391){if(_0x418391){_0x48fd98=_0x418391;_0x5999ef[_0x7892('0x3d')]=_[_0x7892('0x3a')](db[_0x7892('0x55')]['rawAttributes']);_0x5999ef[_0x7892('0x39')]=_[_0x7892('0x3a')](_0x17c096[_0x7892('0x39')]);_0x5999ef[_0x7892('0x3b')]=_[_0x7892('0x3c')](_0x5999ef[_0x7892('0x3d')],_0x5999ef[_0x7892('0x39')]);_0x6d4d82[_0x7892('0x3e')]=_[_0x7892('0x3c')](_0x5999ef['model'],qs[_0x7892('0x3f')](_0x17c096[_0x7892('0x39')][_0x7892('0x3f')]));_0x6d4d82[_0x7892('0x3e')]=_0x6d4d82[_0x7892('0x3e')][_0x7892('0x40')]?_0x6d4d82[_0x7892('0x3e')]:_0x5999ef[_0x7892('0x3d')];_0x6d4d82[_0x7892('0x43')]=qs['sort'](_0x17c096[_0x7892('0x39')]['sort']);_0x6d4d82[_0x7892('0x45')]=qs['filters'](_[_0x7892('0x46')](_0x17c096['query'],_0x5999ef[_0x7892('0x3b')]));if(_0x17c096[_0x7892('0x39')]['filter']){_0x6d4d82['where']=_[_0x7892('0x47')](_0x6d4d82[_0x7892('0x45')],{'$or':_[_0x7892('0x38')](_0x6d4d82['attributes'],function(_0x60aa3b){var _0xb8ec3a={};_0xb8ec3a[_0x60aa3b]={'$like':'%'+_0x17c096[_0x7892('0x39')][_0x7892('0x49')]+'%'};return _0xb8ec3a;})});}_0x6d4d82=_[_0x7892('0x47')]({},_0x6d4d82,_0x17c096['options']);return _0x48fd98[_0x7892('0x53')](_0x6d4d82);}})[_0x7892('0x19')](function(_0x2a3b08){if(_0x2a3b08){_0x548b05=_0x2a3b08[_0x7892('0x40')];if(!_0x17c096['query'][_0x7892('0x41')](_0x7892('0x42'))){_0x6d4d82[_0x7892('0x29')]=qs[_0x7892('0x29')](_0x17c096[_0x7892('0x39')]['limit']);_0x6d4d82[_0x7892('0x28')]=qs[_0x7892('0x28')](_0x17c096[_0x7892('0x39')][_0x7892('0x28')]);}return _0x48fd98[_0x7892('0x53')](_0x6d4d82);}})[_0x7892('0x19')](function(_0x12da06){if(_0x12da06){return _0x12da06?{'count':_0x548b05,'rows':_0x12da06}:null;}})[_0x7892('0x19')](respondWithResult(_0x32800c,null))['catch'](handleError(_0x32800c,null));};exports[_0x7892('0x56')]=function(_0x921e09,_0x1f25d9,_0x1f4ddd){if(_0x921e09[_0x7892('0x52')]['id']){delete _0x921e09['body']['id'];}return db['SugarcrmAccount'][_0x7892('0x54')]({'where':{'id':_0x921e09['params']['id']}})[_0x7892('0x19')](handleEntityNotFound(_0x1f25d9,null))[_0x7892('0x19')](function(_0x438c63){if(_0x438c63){_0x921e09['body'][_0x7892('0x57')]=_0x438c63['id'];_0x921e09[_0x7892('0x52')][_0x7892('0x58')]=integrations['getSubjects'](_0x921e09[_0x7892('0x52')][_0x7892('0x59')],_0x921e09[_0x7892('0x52')]['type']);_0x921e09[_0x7892('0x52')][_0x7892('0x5a')]=integrations[_0x7892('0x5b')](_0x921e09[_0x7892('0x52')]['channel'],_0x921e09[_0x7892('0x52')][_0x7892('0x36')]);return db[_0x7892('0x55')][_0x7892('0x51')](_0x921e09[_0x7892('0x52')],{'include':[{'model':db[_0x7892('0x5c')],'as':_0x7892('0x58')},{'model':db[_0x7892('0x5c')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1f25d9,null))[_0x7892('0x4e')](handleError(_0x1f25d9,null));};exports[_0x7892('0x5d')]=function(_0x5c23a5,_0x6907a3,_0x57021b){var _0x2f105b='';var _0x53c79b=['id',_0x7892('0x32'),_0x7892('0x5e'),_0x7892('0x5f'),_0x7892('0x60'),_0x7892('0x61'),_0x7892('0x62'),_0x7892('0x63'),_0x7892('0x64'),'parent_type',_0x7892('0x65'),_0x7892('0x66')];return db[_0x7892('0x34')][_0x7892('0x54')]({'where':{'id':_0x5c23a5[_0x7892('0x4f')]['id']},'attributes':['id',_0x7892('0x67'),'password','remoteUri']})[_0x7892('0x19')](handleEntityNotFound(_0x6907a3,null))['then'](function(_0xbcd5c2){if(_0xbcd5c2){_0x2f105b=_0xbcd5c2[_0x7892('0x68')];var _0x40d55f=_0x2f105b[_0x7892('0x69')](-0x1);if(_0x40d55f==='/'){_0x2f105b=_0x2f105b[_0x7892('0x6a')](0x0,_0x2f105b['lastIndexOf'](_0x40d55f));}return rp({'method':_0x7892('0x6b'),'uri':util[_0x7892('0x6c')](_0x7892('0x6d'),_0x2f105b,_0x7892('0x6e')),'json':!![],'form':{'method':_0x7892('0x6f'),'input_type':_0x7892('0x70'),'response_type':_0x7892('0x70'),'rest_data':JSON[_0x7892('0x1d')]({'user_auth':{'user_name':_0xbcd5c2[_0x7892('0x67')],'password':_0xbcd5c2[_0x7892('0x71')],'encryption':_0x7892('0x72')},'application':_0x7892('0x73')})}});}})[_0x7892('0x19')](function(_0x2c39d4){if(_0x2c39d4&&_0x2c39d4[_0x7892('0x32')]!==_0x7892('0x74')&&_0x2c39d4[_0x7892('0x32')]!==_0x7892('0x75')){return rp({'method':'POST','uri':util[_0x7892('0x6c')]('%s%s',_0x2f105b,_0x7892('0x6e')),'json':!![],'form':{'method':_0x7892('0x76'),'input_type':_0x7892('0x70'),'response_type':_0x7892('0x70'),'rest_data':JSON[_0x7892('0x1d')]({'session':_0x2c39d4['id'],'module_name':_0x7892('0x77')})}})[_0x7892('0x19')](function(_0x518b76){if(_0x518b76){var _0xe52104=_[_0x7892('0x78')](_0x518b76[_0x7892('0x79')]);_['remove'](_0xe52104,function(_0x436c60){return _0x53c79b[_0x7892('0x7a')](_0x436c60[_0x7892('0x32')]);});return{'count':_0xe52104[_0x7892('0x40')],'rows':_['map'](_0xe52104,function(_0x430bba){return{'id':_0x430bba[_0x7892('0x32')],'name':_0x430bba[_0x7892('0x7b')],'custom':_['endsWith'](_0x430bba['name'],'_c')?!![]:![],'options':_0x430bba['options']?_['map'](_['values'](_0x430bba[_0x7892('0x4a')]),function(_0x54e84b){return{'name':_0x54e84b['value'],'value':_0x54e84b['name']};}):[]};})};}})[_0x7892('0x19')](respondWithResult(_0x6907a3,null))[_0x7892('0x4e')](function(_0x3b75f0){var _0x5726d6=_0x5c23a5[_0x7892('0x39')][_0x7892('0x7c')]?0x1f4:_0x3b75f0['statusCode']||0x1f4;logger[_0x7892('0x1e')](_0x7892('0x7d'),_0x7892('0x5d'),_0x5726d6,JSON['stringify'](_0x3b75f0));delete _0x3b75f0[_0x7892('0x32')];if(_0x5726d6===0x191){_0x5726d6=0x190;}_0x6907a3[_0x7892('0x24')](_0x5726d6)[_0x7892('0x33')](_0x5c23a5[_0x7892('0x39')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3b75f0['statusCode']}:_0x3b75f0);});}else{var _0x156397=0x1f4;_0x6907a3['status'](_0x156397)[_0x7892('0x33')]({'message':_0x7892('0x7e'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x475a=['getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','format','%s%s','login','JSON','password','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','/service/v4_1/rest.php','get_module_fields','Calls','module_fields','includes','endsWith','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\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','SugarcrmAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','findAll','rows','params','includeAll','include','find','create','body','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x475a,0xaa));var _0xa475=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x475a[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0xa475('0x0'));var emlformat=require(_0xa475('0x1'));var rimraf=require(_0xa475('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa475('0x3'));var rp=require(_0xa475('0x4'));var moment=require(_0xa475('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa475('0x6'));var util=require('util');var path=require(_0xa475('0x7'));var sox=require(_0xa475('0x8'));var csv=require(_0xa475('0x9'));var ejs=require(_0xa475('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa475('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa475('0x9'));var querystring=require(_0xa475('0xc'));var Papa=require(_0xa475('0xd'));var Redis=require('ioredis');var authService=require(_0xa475('0xe'));var qs=require(_0xa475('0xf'));var as=require(_0xa475('0x10'));var hardwareService=require(_0xa475('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xa475('0x12'));var config=require(_0xa475('0x13'));var licenseUtil=require(_0xa475('0x14'));var db=require(_0xa475('0x15'))['db'];var integrations=require(_0xa475('0x16'));var jayson=require(_0xa475('0x17'));var client=jayson[_0xa475('0x18')][_0xa475('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x225764,_0x3891aa,_0x7efb13,_0x2d36c4){return new BPromise(function(_0x4d9afc,_0x44db8c){var _0x453519=_0x2d36c4||client;return _0x453519[_0xa475('0x1a')](_0x225764,_0x7efb13)[_0xa475('0x1b')](function(_0x256ced){logger[_0xa475('0x1c')](_0xa475('0x1d'),_0x3891aa,_0xa475('0x1e'));logger['debug'](_0xa475('0x1f'),_0x3891aa,_0xa475('0x1e'),JSON[_0xa475('0x20')](_0x256ced));if(_0x256ced[_0xa475('0x21')]){if(_0x256ced[_0xa475('0x21')][_0xa475('0x22')]===0x1f4){logger['error'](_0xa475('0x1d'),_0x3891aa,_0x256ced['error'][_0xa475('0x23')]);return _0x44db8c(_0x256ced[_0xa475('0x21')][_0xa475('0x23')]);}logger[_0xa475('0x21')](_0xa475('0x1d'),_0x3891aa,_0x256ced[_0xa475('0x21')]['message']);return _0x4d9afc(_0x256ced['error'][_0xa475('0x23')]);}else{logger[_0xa475('0x1c')]('SugarcrmAccount,\x20%s,\x20%s',_0x3891aa,_0xa475('0x1e'));_0x4d9afc(_0x256ced[_0xa475('0x24')][_0xa475('0x23')]);}})[_0xa475('0x25')](function(_0x2f3f62){logger['error'](_0xa475('0x1d'),_0x3891aa,_0x2f3f62);_0x44db8c(_0x2f3f62);});});}function respondWithStatusCode(_0x1cb4cd,_0x4b9762){_0x4b9762=_0x4b9762||0xcc;return function(_0x2c3e96){if(_0x2c3e96){return _0x1cb4cd[_0xa475('0x26')](_0x4b9762);}return _0x1cb4cd[_0xa475('0x27')](_0x4b9762)[_0xa475('0x28')]();};}function respondWithResult(_0x5f4bac,_0x5df8eb){_0x5df8eb=_0x5df8eb||0xc8;return function(_0x517192){if(_0x517192){return _0x5f4bac[_0xa475('0x27')](_0x5df8eb)[_0xa475('0x29')](_0x517192);}};}function respondWithFilteredResult(_0x273532,_0x1abc2c){return function(_0x4952f9){if(_0x4952f9){var _0x2ee75a=_0x4952f9[_0xa475('0x2a')],_0x11b7c3=_0x1abc2c['offset'],_0x2d1562=_0x1abc2c[_0xa475('0x2b')]+_0x1abc2c[_0xa475('0x2c')],_0x1bc1bc;if(_0x2d1562>=_0x2ee75a){_0x2d1562=_0x2ee75a;_0x1bc1bc=0xc8;}else{_0x1bc1bc=0xce;}_0x273532[_0xa475('0x27')](_0x1bc1bc);return _0x273532[_0xa475('0x2d')](_0xa475('0x2e'),_0x11b7c3+'-'+_0x2d1562+'/'+_0x2ee75a)['json'](_0x4952f9);}return null;};}function patchUpdates(_0x55e340){return function(_0x415bb8){try{jsonpatch[_0xa475('0x2f')](_0x415bb8,_0x55e340,!![]);}catch(_0x5550a3){return BPromise[_0xa475('0x30')](_0x5550a3);}return _0x415bb8[_0xa475('0x31')]();};}function saveUpdates(_0x59f893,_0x1a971f){return function(_0xa64aed){if(_0xa64aed){return _0xa64aed[_0xa475('0x32')](_0x59f893)[_0xa475('0x1b')](function(_0x311f1f){return _0x311f1f;});}return null;};}function removeEntity(_0x5e7165,_0x158b22){return function(_0x376783){if(_0x376783){return _0x376783[_0xa475('0x33')]()['then'](function(){_0x5e7165[_0xa475('0x27')](0xcc)[_0xa475('0x28')]();});}};}function handleEntityNotFound(_0x39507c,_0x5380e1){return function(_0xa4b3a0){if(!_0xa4b3a0){_0x39507c[_0xa475('0x26')](0x194);}return _0xa4b3a0;};}function handleError(_0xeeefcf,_0x517a9f){_0x517a9f=_0x517a9f||0x1f4;return function(_0x460b80){logger[_0xa475('0x21')](_0x460b80[_0xa475('0x34')]);if(_0x460b80[_0xa475('0x35')]){delete _0x460b80[_0xa475('0x35')];}_0xeeefcf[_0xa475('0x27')](_0x517a9f)[_0xa475('0x36')](_0x460b80);};}exports[_0xa475('0x37')]=function(_0xfbccf3,_0x4ba83d){var _0x36c182={},_0x2a9afd={},_0x2a59bc={'count':0x0,'rows':[]};var _0x1215ef=_[_0xa475('0x38')](db[_0xa475('0x39')][_0xa475('0x3a')],function(_0xb2c838){return{'name':_0xb2c838['fieldName'],'type':_0xb2c838[_0xa475('0x3b')]['key']};});_0x2a9afd[_0xa475('0x3c')]=_['map'](_0x1215ef,_0xa475('0x35'));_0x2a9afd[_0xa475('0x3d')]=_[_0xa475('0x3e')](_0xfbccf3[_0xa475('0x3d')]);_0x2a9afd[_0xa475('0x3f')]=_[_0xa475('0x40')](_0x2a9afd[_0xa475('0x3c')],_0x2a9afd['query']);_0x36c182[_0xa475('0x41')]=_[_0xa475('0x40')](_0x2a9afd[_0xa475('0x3c')],qs[_0xa475('0x42')](_0xfbccf3[_0xa475('0x3d')][_0xa475('0x42')]));_0x36c182[_0xa475('0x41')]=_0x36c182[_0xa475('0x41')][_0xa475('0x43')]?_0x36c182[_0xa475('0x41')]:_0x2a9afd[_0xa475('0x3c')];if(!_0xfbccf3[_0xa475('0x3d')][_0xa475('0x44')](_0xa475('0x45'))){_0x36c182[_0xa475('0x2c')]=qs[_0xa475('0x2c')](_0xfbccf3[_0xa475('0x3d')]['limit']);_0x36c182[_0xa475('0x2b')]=qs[_0xa475('0x2b')](_0xfbccf3[_0xa475('0x3d')][_0xa475('0x2b')]);}_0x36c182[_0xa475('0x46')]=qs[_0xa475('0x47')](_0xfbccf3['query'][_0xa475('0x47')]);_0x36c182['where']=qs[_0xa475('0x3f')](_[_0xa475('0x48')](_0xfbccf3[_0xa475('0x3d')],_0x2a9afd[_0xa475('0x3f')]),_0x1215ef);if(_0xfbccf3[_0xa475('0x3d')][_0xa475('0x49')]){_0x36c182[_0xa475('0x4a')]=_[_0xa475('0x4b')](_0x36c182[_0xa475('0x4a')],{'$or':_[_0xa475('0x38')](_0x1215ef,function(_0x15047a){if(_0x15047a['type']!=='VIRTUAL'){var _0x38f18f={};_0x38f18f[_0x15047a['name']]={'$like':'%'+_0xfbccf3[_0xa475('0x3d')][_0xa475('0x49')]+'%'};return _0x38f18f;}})});}_0x36c182=_[_0xa475('0x4b')]({},_0x36c182,_0xfbccf3[_0xa475('0x4c')]);var _0x349946={'where':_0x36c182[_0xa475('0x4a')]};return db[_0xa475('0x39')][_0xa475('0x2a')](_0x349946)[_0xa475('0x1b')](function(_0x1c0351){_0x2a59bc[_0xa475('0x2a')]=_0x1c0351;if(_0xfbccf3[_0xa475('0x3d')]['includeAll']){_0x36c182['include']=[{'all':!![]}];}return db[_0xa475('0x39')][_0xa475('0x4d')](_0x36c182);})[_0xa475('0x1b')](function(_0x2ba090){_0x2a59bc[_0xa475('0x4e')]=_0x2ba090;return _0x2a59bc;})[_0xa475('0x1b')](respondWithFilteredResult(_0x4ba83d,_0x36c182))[_0xa475('0x25')](handleError(_0x4ba83d,null));};exports['show']=function(_0x305401,_0x26c397){var _0x1935b7={'raw':![],'where':{'id':_0x305401[_0xa475('0x4f')]['id']}},_0x40ccaa={};_0x40ccaa[_0xa475('0x3c')]=_[_0xa475('0x3e')](db[_0xa475('0x39')][_0xa475('0x3a')]);_0x40ccaa['query']=_[_0xa475('0x3e')](_0x305401[_0xa475('0x3d')]);_0x40ccaa[_0xa475('0x3f')]=_[_0xa475('0x40')](_0x40ccaa['model'],_0x40ccaa[_0xa475('0x3d')]);_0x1935b7[_0xa475('0x41')]=_[_0xa475('0x40')](_0x40ccaa[_0xa475('0x3c')],qs['fields'](_0x305401['query'][_0xa475('0x42')]));_0x1935b7['attributes']=_0x1935b7[_0xa475('0x41')]['length']?_0x1935b7[_0xa475('0x41')]:_0x40ccaa['model'];if(_0x305401[_0xa475('0x3d')][_0xa475('0x50')]){_0x1935b7[_0xa475('0x51')]=[{'all':!![]}];}_0x1935b7=_[_0xa475('0x4b')]({},_0x1935b7,_0x305401[_0xa475('0x4c')]);return db[_0xa475('0x39')][_0xa475('0x52')](_0x1935b7)[_0xa475('0x1b')](handleEntityNotFound(_0x26c397,null))[_0xa475('0x1b')](respondWithResult(_0x26c397,null))[_0xa475('0x25')](handleError(_0x26c397,null));};exports[_0xa475('0x53')]=function(_0x99a990,_0x5c59e5){return db[_0xa475('0x39')][_0xa475('0x53')](_0x99a990[_0xa475('0x54')],{})['then'](respondWithResult(_0x5c59e5,0xc9))[_0xa475('0x25')](handleError(_0x5c59e5,null));};exports[_0xa475('0x32')]=function(_0x1eee4e,_0x201ca0){if(_0x1eee4e[_0xa475('0x54')]['id']){delete _0x1eee4e[_0xa475('0x54')]['id'];}return db['SugarcrmAccount'][_0xa475('0x52')]({'where':{'id':_0x1eee4e[_0xa475('0x4f')]['id']}})['then'](handleEntityNotFound(_0x201ca0,null))[_0xa475('0x1b')](saveUpdates(_0x1eee4e[_0xa475('0x54')],null))['then'](respondWithResult(_0x201ca0,null))[_0xa475('0x25')](handleError(_0x201ca0,null));};exports[_0xa475('0x33')]=function(_0x589af6,_0xe3133c){return db['SugarcrmAccount'][_0xa475('0x52')]({'where':{'id':_0x589af6['params']['id']}})[_0xa475('0x1b')](handleEntityNotFound(_0xe3133c,null))[_0xa475('0x1b')](removeEntity(_0xe3133c,null))[_0xa475('0x25')](handleError(_0xe3133c,null));};exports['getConfigurations']=function(_0xcd39e7,_0x1ba665,_0x1ff06f){var _0x2bf5ee={};var _0x429f0b={};var _0x302f13;var _0x3b82b8;return db['SugarcrmAccount'][_0xa475('0x55')]({'where':{'id':_0xcd39e7['params']['id']}})[_0xa475('0x1b')](handleEntityNotFound(_0x1ba665,null))[_0xa475('0x1b')](function(_0x4a2acf){if(_0x4a2acf){_0x302f13=_0x4a2acf;_0x429f0b[_0xa475('0x3c')]=_[_0xa475('0x3e')](db[_0xa475('0x56')][_0xa475('0x3a')]);_0x429f0b[_0xa475('0x3d')]=_[_0xa475('0x3e')](_0xcd39e7[_0xa475('0x3d')]);_0x429f0b[_0xa475('0x3f')]=_['intersection'](_0x429f0b[_0xa475('0x3c')],_0x429f0b['query']);_0x2bf5ee[_0xa475('0x41')]=_[_0xa475('0x40')](_0x429f0b[_0xa475('0x3c')],qs[_0xa475('0x42')](_0xcd39e7[_0xa475('0x3d')][_0xa475('0x42')]));_0x2bf5ee['attributes']=_0x2bf5ee[_0xa475('0x41')]['length']?_0x2bf5ee['attributes']:_0x429f0b[_0xa475('0x3c')];_0x2bf5ee['order']=qs[_0xa475('0x47')](_0xcd39e7[_0xa475('0x3d')][_0xa475('0x47')]);_0x2bf5ee[_0xa475('0x4a')]=qs[_0xa475('0x3f')](_[_0xa475('0x48')](_0xcd39e7[_0xa475('0x3d')],_0x429f0b[_0xa475('0x3f')]));if(_0xcd39e7[_0xa475('0x3d')][_0xa475('0x49')]){_0x2bf5ee[_0xa475('0x4a')]=_[_0xa475('0x4b')](_0x2bf5ee[_0xa475('0x4a')],{'$or':_[_0xa475('0x38')](_0x2bf5ee[_0xa475('0x41')],function(_0xf33fe4){var _0x48ce4b={};_0x48ce4b[_0xf33fe4]={'$like':'%'+_0xcd39e7['query'][_0xa475('0x49')]+'%'};return _0x48ce4b;})});}_0x2bf5ee=_['merge']({},_0x2bf5ee,_0xcd39e7[_0xa475('0x4c')]);return _0x302f13[_0xa475('0x57')](_0x2bf5ee);}})[_0xa475('0x1b')](function(_0x271e9e){if(_0x271e9e){_0x3b82b8=_0x271e9e[_0xa475('0x43')];if(!_0xcd39e7['query'][_0xa475('0x44')](_0xa475('0x45'))){_0x2bf5ee[_0xa475('0x2c')]=qs[_0xa475('0x2c')](_0xcd39e7[_0xa475('0x3d')][_0xa475('0x2c')]);_0x2bf5ee['offset']=qs[_0xa475('0x2b')](_0xcd39e7['query']['offset']);}return _0x302f13['getConfigurations'](_0x2bf5ee);}})[_0xa475('0x1b')](function(_0x581cc5){if(_0x581cc5){return _0x581cc5?{'count':_0x3b82b8,'rows':_0x581cc5}:null;}})[_0xa475('0x1b')](respondWithResult(_0x1ba665,null))[_0xa475('0x25')](handleError(_0x1ba665,null));};exports[_0xa475('0x58')]=function(_0x5e40dd,_0x3bd844,_0x31c0e5){if(_0x5e40dd[_0xa475('0x54')]['id']){delete _0x5e40dd['body']['id'];}return db[_0xa475('0x39')]['findOne']({'where':{'id':_0x5e40dd[_0xa475('0x4f')]['id']}})[_0xa475('0x1b')](handleEntityNotFound(_0x3bd844,null))[_0xa475('0x1b')](function(_0x362a44){if(_0x362a44){_0x5e40dd['body'][_0xa475('0x59')]=_0x362a44['id'];_0x5e40dd[_0xa475('0x54')][_0xa475('0x5a')]=integrations[_0xa475('0x5b')](_0x5e40dd['body'][_0xa475('0x5c')],_0x5e40dd[_0xa475('0x54')][_0xa475('0x3b')]);_0x5e40dd[_0xa475('0x54')][_0xa475('0x5d')]=integrations[_0xa475('0x5e')](_0x5e40dd[_0xa475('0x54')][_0xa475('0x5c')],_0x5e40dd[_0xa475('0x54')]['type']);return db[_0xa475('0x56')]['create'](_0x5e40dd['body'],{'include':[{'model':db[_0xa475('0x5f')],'as':'Subjects'},{'model':db[_0xa475('0x5f')],'as':_0xa475('0x5d')}]});}return null;})[_0xa475('0x1b')](respondWithResult(_0x3bd844,null))['catch'](handleError(_0x3bd844,null));};exports[_0xa475('0x60')]=function(_0x1b0325,_0x4c4e6f,_0x25b861){var _0x56df30='';var _0x58db63=['id',_0xa475('0x35'),_0xa475('0x61'),_0xa475('0x62'),'description',_0xa475('0x63'),_0xa475('0x64'),_0xa475('0x65'),_0xa475('0x66'),_0xa475('0x67'),_0xa475('0x68'),_0xa475('0x69')];return db['SugarcrmAccount'][_0xa475('0x55')]({'where':{'id':_0x1b0325['params']['id']},'attributes':['id',_0xa475('0x6a'),'password',_0xa475('0x6b')]})[_0xa475('0x1b')](handleEntityNotFound(_0x4c4e6f,null))[_0xa475('0x1b')](function(_0x1ca6c7){if(_0x1ca6c7){_0x56df30=_0x1ca6c7['remoteUri'];var _0xa28695=_0x56df30[_0xa475('0x6c')](-0x1);if(_0xa28695==='/'){_0x56df30=_0x56df30[_0xa475('0x6d')](0x0,_0x56df30[_0xa475('0x6e')](_0xa28695));}return rp({'method':'POST','uri':util[_0xa475('0x6f')](_0xa475('0x70'),_0x56df30,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xa475('0x71'),'input_type':_0xa475('0x72'),'response_type':_0xa475('0x72'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1ca6c7[_0xa475('0x6a')],'password':_0x1ca6c7[_0xa475('0x73')],'encryption':'PLAIN'},'application':_0xa475('0x74')})}});}})[_0xa475('0x1b')](function(_0x1a2020){if(_0x1a2020&&_0x1a2020['name']!==_0xa475('0x75')&&_0x1a2020[_0xa475('0x35')]!==_0xa475('0x76')){return rp({'method':_0xa475('0x77'),'uri':util[_0xa475('0x6f')](_0xa475('0x70'),_0x56df30,_0xa475('0x78')),'json':!![],'form':{'method':_0xa475('0x79'),'input_type':_0xa475('0x72'),'response_type':_0xa475('0x72'),'rest_data':JSON['stringify']({'session':_0x1a2020['id'],'module_name':_0xa475('0x7a')})}})[_0xa475('0x1b')](function(_0x1e6520){if(_0x1e6520){var _0x14e8e6=_['values'](_0x1e6520[_0xa475('0x7b')]);_['remove'](_0x14e8e6,function(_0x47b6cb){return _0x58db63[_0xa475('0x7c')](_0x47b6cb[_0xa475('0x35')]);});return{'count':_0x14e8e6[_0xa475('0x43')],'rows':_[_0xa475('0x38')](_0x14e8e6,function(_0x2e8624){return{'id':_0x2e8624['name'],'name':_0x2e8624['label'],'custom':_[_0xa475('0x7d')](_0x2e8624[_0xa475('0x35')],'_c')?!![]:![],'options':_0x2e8624[_0xa475('0x4c')]?_[_0xa475('0x38')](_[_0xa475('0x7e')](_0x2e8624['options']),function(_0x4616d2){return{'name':_0x4616d2[_0xa475('0x7f')],'value':_0x4616d2['name']};}):[]};})};}})['then'](respondWithResult(_0x4c4e6f,null))['catch'](function(_0x49b550){var _0x3d84ca=_0x1b0325[_0xa475('0x3d')][_0xa475('0x80')]?0x1f4:_0x49b550[_0xa475('0x81')]||0x1f4;logger[_0xa475('0x21')](_0xa475('0x82'),_0xa475('0x60'),_0x3d84ca,JSON[_0xa475('0x20')](_0x49b550));delete _0x49b550['name'];if(_0x3d84ca===0x191){_0x3d84ca=0x190;}_0x4c4e6f[_0xa475('0x27')](_0x3d84ca)['send'](_0x1b0325['query'][_0xa475('0x80')]?{'message':_0xa475('0x83'),'statusCode':_0x49b550[_0xa475('0x81')]}:_0x49b550);});}else{var _0x22f75e=0x1f4;_0x4c4e6f[_0xa475('0x27')](_0x22f75e)[_0xa475('0x36')]({'message':_0xa475('0x83'),'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 941248a..bfdfd41 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 _0x0ed8=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x4bc5fd,_0x32f2a5){var _0x42e4df=function(_0x170f58){while(--_0x170f58){_0x4bc5fd['push'](_0x4bc5fd['shift']());}};_0x42e4df(++_0x32f2a5);}(_0x0ed8,0x11a));var _0x80ed=function(_0x316b48,_0x11246b){_0x316b48=_0x316b48-0x0;var _0x573b7c=_0x0ed8[_0x316b48];return _0x573b7c;};'use strict';var _=require('lodash');var util=require(_0x80ed('0x0'));var logger=require(_0x80ed('0x1'))(_0x80ed('0x2'));var moment=require('moment');var BPromise=require(_0x80ed('0x3'));var rp=require(_0x80ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x80ed('0x5'));var config=require(_0x80ed('0x6'));var attributes=require(_0x80ed('0x7'));var integrations=require(_0x80ed('0x8'));module[_0x80ed('0x9')]=function(_0x156e1a,_0x249da7){return _0x156e1a[_0x80ed('0xa')](_0x80ed('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ebc=['../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x6ebc,0x79));var _0xc6eb=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x6ebc[_0x4653f7];return _0x5454da;};'use strict';var _=require(_0xc6eb('0x0'));var util=require(_0xc6eb('0x1'));var logger=require('../../config/logger')(_0xc6eb('0x2'));var moment=require('moment');var BPromise=require(_0xc6eb('0x3'));var rp=require(_0xc6eb('0x4'));var fs=require('fs');var path=require(_0xc6eb('0x5'));var rimraf=require(_0xc6eb('0x6'));var config=require(_0xc6eb('0x7'));var attributes=require(_0xc6eb('0x8'));var integrations=require(_0xc6eb('0x9'));module[_0xc6eb('0xa')]=function(_0x5d81ef,_0x57ad35){return _0x5d81ef[_0xc6eb('0xb')]('SugarcrmAccount',attributes,{'tableName':_0xc6eb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index bd44862..0067102 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 _0x0cff=['../../config/logger','jayson/promise','http','then','info','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowSugarcrmAccount','find','lodash','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x456e8c,_0x20ad52){var _0xb007de=function(_0x362631){while(--_0x362631){_0x456e8c['push'](_0x456e8c['shift']());}};_0xb007de(++_0x20ad52);}(_0x0cff,0x13b));var _0xf0cf=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0x0cff[_0x28394f];return _0x2618d2;};'use strict';var _=require(_0xf0cf('0x0'));var util=require('util');var moment=require(_0xf0cf('0x1'));var BPromise=require(_0xf0cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0cf('0x3'))['db'];var utils=require(_0xf0cf('0x4'));var logger=require(_0xf0cf('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf0cf('0x6'));var client=jayson['client'][_0xf0cf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2c60bf,_0x4c8cf0,_0x21d057){return new BPromise(function(_0x49a54f,_0x4ed23a){return client['request'](_0x2c60bf,_0x21d057)[_0xf0cf('0x8')](function(_0x2c83d7){logger[_0xf0cf('0x9')]('SugarcrmAccount,\x20%s,\x20%s',_0x4c8cf0,_0xf0cf('0xa'));logger['debug'](_0xf0cf('0xb'),_0x4c8cf0,_0xf0cf('0xa'),JSON[_0xf0cf('0xc')](_0x2c83d7));if(_0x2c83d7[_0xf0cf('0xd')]){if(_0x2c83d7[_0xf0cf('0xd')][_0xf0cf('0xe')]===0x1f4){logger[_0xf0cf('0xd')](_0xf0cf('0xf'),_0x4c8cf0,_0x2c83d7['error']['message']);return _0x4ed23a(_0x2c83d7[_0xf0cf('0xd')][_0xf0cf('0x10')]);}logger[_0xf0cf('0xd')](_0xf0cf('0xf'),_0x4c8cf0,_0x2c83d7[_0xf0cf('0xd')][_0xf0cf('0x10')]);return _0x49a54f(_0x2c83d7[_0xf0cf('0xd')][_0xf0cf('0x10')]);}else{logger['info'](_0xf0cf('0xf'),_0x4c8cf0,'request\x20sent');_0x49a54f(_0x2c83d7['result']['message']);}})[_0xf0cf('0x11')](function(_0x25f546){logger[_0xf0cf('0xd')](_0xf0cf('0xf'),_0x4c8cf0,_0x25f546);_0x4ed23a(_0x25f546);});});}exports[_0xf0cf('0x12')]=function(_0x14eb8a){var _0x4cdd49=this;return new Promise(function(_0x2e6065,_0x57c4f7){return db[_0xf0cf('0x13')][_0xf0cf('0x14')]({'raw':_0x14eb8a[_0xf0cf('0x15')]?_0x14eb8a['options'][_0xf0cf('0x16')]===undefined?!![]:![]:!![],'where':_0x14eb8a[_0xf0cf('0x15')]?_0x14eb8a[_0xf0cf('0x15')][_0xf0cf('0x17')]||null:null,'attributes':_0x14eb8a[_0xf0cf('0x15')]?_0x14eb8a[_0xf0cf('0x15')]['attributes']||null:null,'limit':_0x14eb8a[_0xf0cf('0x15')]?_0x14eb8a['options'][_0xf0cf('0x18')]||null:null,'include':_0x14eb8a[_0xf0cf('0x15')]?_0x14eb8a[_0xf0cf('0x15')][_0xf0cf('0x19')]?_[_0xf0cf('0x1a')](_0x14eb8a['options'][_0xf0cf('0x19')],function(_0x1bd879){return{'model':db[_0x1bd879[_0xf0cf('0x1b')]],'as':_0x1bd879['as'],'attributes':_0x1bd879[_0xf0cf('0x1c')],'include':_0x1bd879['include']?_[_0xf0cf('0x1a')](_0x1bd879['include'],function(_0x295001){return{'model':db[_0x295001[_0xf0cf('0x1b')]],'as':_0x295001['as'],'attributes':_0x295001['attributes'],'include':_0x295001[_0xf0cf('0x19')]?_['map'](_0x295001['include'],function(_0x277643){return{'model':db[_0x277643['model']],'as':_0x277643['as'],'attributes':_0x277643[_0xf0cf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf0cf('0x8')](function(_0x511743){logger[_0xf0cf('0x9')](_0xf0cf('0x12'),_0x14eb8a);logger[_0xf0cf('0x1d')](_0xf0cf('0x12'),_0x14eb8a,JSON[_0xf0cf('0xc')](_0x511743));_0x2e6065(_0x511743);})[_0xf0cf('0x11')](function(_0x349b4e){logger[_0xf0cf('0xd')](_0xf0cf('0x12'),_0x349b4e[_0xf0cf('0x10')],_0x14eb8a);_0x57c4f7(_0x4cdd49[_0xf0cf('0xd')](0x1f4,_0x349b4e[_0xf0cf('0x10')]));});});};exports[_0xf0cf('0x1e')]=function(_0x23cf1c){var _0x34f2d7=this;return new Promise(function(_0x5a2da4,_0x1a7fa9){return db[_0xf0cf('0x13')][_0xf0cf('0x1f')]({'raw':_0x23cf1c[_0xf0cf('0x15')]?_0x23cf1c[_0xf0cf('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x23cf1c[_0xf0cf('0x15')]?_0x23cf1c['options']['where']||null:null,'attributes':_0x23cf1c[_0xf0cf('0x15')]?_0x23cf1c[_0xf0cf('0x15')][_0xf0cf('0x1c')]||null:null,'include':_0x23cf1c[_0xf0cf('0x15')]?_0x23cf1c[_0xf0cf('0x15')]['include']?_['map'](_0x23cf1c[_0xf0cf('0x15')][_0xf0cf('0x19')],function(_0x233672){return{'model':db[_0x233672[_0xf0cf('0x1b')]],'as':_0x233672['as'],'attributes':_0x233672[_0xf0cf('0x1c')],'include':_0x233672[_0xf0cf('0x19')]?_[_0xf0cf('0x1a')](_0x233672['include'],function(_0x220849){return{'model':db[_0x220849['model']],'as':_0x220849['as'],'attributes':_0x220849[_0xf0cf('0x1c')],'include':_0x220849[_0xf0cf('0x19')]?_['map'](_0x220849['include'],function(_0x4a7b19){return{'model':db[_0x4a7b19[_0xf0cf('0x1b')]],'as':_0x4a7b19['as'],'attributes':_0x4a7b19['attributes']};}):[]};}):[]};}):[]:[]})[_0xf0cf('0x8')](function(_0x4e3a9a){logger[_0xf0cf('0x9')](_0xf0cf('0x1e'),_0x23cf1c);logger[_0xf0cf('0x1d')]('ShowSugarcrmAccount',_0x23cf1c,JSON[_0xf0cf('0xc')](_0x4e3a9a));_0x5a2da4(_0x4e3a9a);})[_0xf0cf('0x11')](function(_0x579233){logger[_0xf0cf('0xd')]('ShowSugarcrmAccount',_0x579233[_0xf0cf('0x10')],_0x23cf1c);_0x1a7fa9(_0x34f2d7[_0xf0cf('0xd')](0x1f4,_0x579233[_0xf0cf('0x10')]));});});}; \ No newline at end of file +var _0x56fc=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','request\x20sent','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','include','map','model','ShowSugarcrmAccount','find','util','bluebird','../../mysqldb'];(function(_0x134804,_0x6f47b1){var _0x284b8d=function(_0x5bf290){while(--_0x5bf290){_0x134804['push'](_0x134804['shift']());}};_0x284b8d(++_0x6f47b1);}(_0x56fc,0x189));var _0xc56f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56fc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc56f('0x0'));var moment=require('moment');var BPromise=require(_0xc56f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc56f('0x2'))['db'];var utils=require(_0xc56f('0x3'));var logger=require(_0xc56f('0x4'))(_0xc56f('0x5'));var config=require(_0xc56f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc56f('0x7')][_0xc56f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd0e293,_0x5b536b,_0x3a3fb6){return new BPromise(function(_0x2df1da,_0x126d72){return client[_0xc56f('0x9')](_0xd0e293,_0x3a3fb6)[_0xc56f('0xa')](function(_0x108e8b){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x5b536b,'request\x20sent');logger[_0xc56f('0xb')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x5b536b,_0xc56f('0xc'),JSON[_0xc56f('0xd')](_0x108e8b));if(_0x108e8b[_0xc56f('0xe')]){if(_0x108e8b[_0xc56f('0xe')][_0xc56f('0xf')]===0x1f4){logger[_0xc56f('0xe')](_0xc56f('0x10'),_0x5b536b,_0x108e8b[_0xc56f('0xe')][_0xc56f('0x11')]);return _0x126d72(_0x108e8b[_0xc56f('0xe')]['message']);}logger['error'](_0xc56f('0x10'),_0x5b536b,_0x108e8b[_0xc56f('0xe')]['message']);return _0x2df1da(_0x108e8b[_0xc56f('0xe')][_0xc56f('0x11')]);}else{logger[_0xc56f('0x12')](_0xc56f('0x10'),_0x5b536b,_0xc56f('0xc'));_0x2df1da(_0x108e8b[_0xc56f('0x13')]['message']);}})[_0xc56f('0x14')](function(_0x10645a){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x5b536b,_0x10645a);_0x126d72(_0x10645a);});});}exports[_0xc56f('0x15')]=function(_0x1316b9){var _0x20cd98=this;return new Promise(function(_0x3a5df0,_0x34c7fe){return db[_0xc56f('0x16')][_0xc56f('0x17')]({'raw':_0x1316b9[_0xc56f('0x18')]?_0x1316b9[_0xc56f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1316b9['options']?_0x1316b9[_0xc56f('0x18')][_0xc56f('0x19')]||null:null,'attributes':_0x1316b9[_0xc56f('0x18')]?_0x1316b9[_0xc56f('0x18')][_0xc56f('0x1a')]||null:null,'limit':_0x1316b9[_0xc56f('0x18')]?_0x1316b9['options'][_0xc56f('0x1b')]||null:null,'include':_0x1316b9[_0xc56f('0x18')]?_0x1316b9[_0xc56f('0x18')][_0xc56f('0x1c')]?_[_0xc56f('0x1d')](_0x1316b9[_0xc56f('0x18')]['include'],function(_0x1591b2){return{'model':db[_0x1591b2[_0xc56f('0x1e')]],'as':_0x1591b2['as'],'attributes':_0x1591b2['attributes'],'include':_0x1591b2['include']?_['map'](_0x1591b2['include'],function(_0x21a371){return{'model':db[_0x21a371[_0xc56f('0x1e')]],'as':_0x21a371['as'],'attributes':_0x21a371[_0xc56f('0x1a')],'include':_0x21a371[_0xc56f('0x1c')]?_[_0xc56f('0x1d')](_0x21a371['include'],function(_0x19d89f){return{'model':db[_0x19d89f[_0xc56f('0x1e')]],'as':_0x19d89f['as'],'attributes':_0x19d89f['attributes']};}):[]};}):[]};}):[]:[]})[_0xc56f('0xa')](function(_0x4bd87a){logger[_0xc56f('0x12')]('GetSugarcrmAccount',_0x1316b9);logger['debug'](_0xc56f('0x15'),_0x1316b9,JSON[_0xc56f('0xd')](_0x4bd87a));_0x3a5df0(_0x4bd87a);})[_0xc56f('0x14')](function(_0x34ae74){logger[_0xc56f('0xe')](_0xc56f('0x15'),_0x34ae74['message'],_0x1316b9);_0x34c7fe(_0x20cd98[_0xc56f('0xe')](0x1f4,_0x34ae74[_0xc56f('0x11')]));});});};exports[_0xc56f('0x1f')]=function(_0x300989){var _0xbc6c3d=this;return new Promise(function(_0x383fd3,_0x18fc1a){return db[_0xc56f('0x16')][_0xc56f('0x20')]({'raw':_0x300989[_0xc56f('0x18')]?_0x300989['options']['raw']===undefined?!![]:![]:!![],'where':_0x300989[_0xc56f('0x18')]?_0x300989[_0xc56f('0x18')]['where']||null:null,'attributes':_0x300989[_0xc56f('0x18')]?_0x300989[_0xc56f('0x18')][_0xc56f('0x1a')]||null:null,'include':_0x300989[_0xc56f('0x18')]?_0x300989[_0xc56f('0x18')]['include']?_[_0xc56f('0x1d')](_0x300989[_0xc56f('0x18')][_0xc56f('0x1c')],function(_0x35e875){return{'model':db[_0x35e875[_0xc56f('0x1e')]],'as':_0x35e875['as'],'attributes':_0x35e875['attributes'],'include':_0x35e875[_0xc56f('0x1c')]?_[_0xc56f('0x1d')](_0x35e875[_0xc56f('0x1c')],function(_0x59dea6){return{'model':db[_0x59dea6[_0xc56f('0x1e')]],'as':_0x59dea6['as'],'attributes':_0x59dea6['attributes'],'include':_0x59dea6[_0xc56f('0x1c')]?_[_0xc56f('0x1d')](_0x59dea6['include'],function(_0x26907b){return{'model':db[_0x26907b[_0xc56f('0x1e')]],'as':_0x26907b['as'],'attributes':_0x26907b['attributes']};}):[]};}):[]};}):[]:[]})[_0xc56f('0xa')](function(_0x73e348){logger[_0xc56f('0x12')]('ShowSugarcrmAccount',_0x300989);logger[_0xc56f('0xb')](_0xc56f('0x1f'),_0x300989,JSON[_0xc56f('0xd')](_0x73e348));_0x383fd3(_0x73e348);})['catch'](function(_0x4aac75){logger[_0xc56f('0xe')]('ShowSugarcrmAccount',_0x4aac75['message'],_0x300989);_0x18fc1a(_0xbc6c3d[_0xc56f('0xe')](0x1f4,_0x4aac75[_0xc56f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index d13d1c1..6bc24c5 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 _0x0e99=['../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','/:id','get','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x267eaf,_0x56dfad){var _0x418ed5=function(_0x3bf5ed){while(--_0x3bf5ed){_0x267eaf['push'](_0x267eaf['shift']());}};_0x418ed5(++_0x56dfad);}(_0x0e99,0x153));var _0x90e9=function(_0x1d5fb9,_0x43aa73){_0x1d5fb9=_0x1d5fb9-0x0;var _0xd72009=_0x0e99[_0x1d5fb9];return _0xd72009;};'use strict';var multer=require('multer');var util=require(_0x90e9('0x0'));var path=require(_0x90e9('0x1'));var timeout=require(_0x90e9('0x2'));var express=require(_0x90e9('0x3'));var router=express[_0x90e9('0x4')]();var auth=require(_0x90e9('0x5'));var interaction=require(_0x90e9('0x6'));var config=require(_0x90e9('0x7'));var controller=require(_0x90e9('0x8'));router['get']('/',auth[_0x90e9('0x9')](),controller[_0x90e9('0xa')]);router['get'](_0x90e9('0xb'),auth[_0x90e9('0x9')](),controller['show']);router[_0x90e9('0xc')](_0x90e9('0xd'),auth['isAuthenticated'](),controller[_0x90e9('0xe')]);router[_0x90e9('0xc')]('/:id/subjects',auth[_0x90e9('0x9')](),controller['getSubjects']);router[_0x90e9('0xc')](_0x90e9('0xf'),auth['isAuthenticated'](),controller[_0x90e9('0x10')]);router[_0x90e9('0x11')]('/',auth['isAuthenticated'](),controller[_0x90e9('0x12')]);router[_0x90e9('0x13')](_0x90e9('0xb'),auth[_0x90e9('0x9')](),controller[_0x90e9('0x14')]);router[_0x90e9('0x15')](_0x90e9('0xb'),auth[_0x90e9('0x9')](),controller[_0x90e9('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb56c=['../../config/environment','get','isAuthenticated','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb56c,0x162));var _0xcb56=function(_0x2c5340,_0x5c86e5){_0x2c5340=_0x2c5340-0x0;var _0x3c505e=_0xb56c[_0x2c5340];return _0x3c505e;};'use strict';var multer=require(_0xcb56('0x0'));var util=require(_0xcb56('0x1'));var path=require(_0xcb56('0x2'));var timeout=require(_0xcb56('0x3'));var express=require(_0xcb56('0x4'));var router=express['Router']();var auth=require(_0xcb56('0x5'));var interaction=require(_0xcb56('0x6'));var config=require(_0xcb56('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xcb56('0x8')]('/',auth[_0xcb56('0x9')](),controller['index']);router[_0xcb56('0x8')](_0xcb56('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xcb56('0x8')](_0xcb56('0xb'),auth[_0xcb56('0x9')](),controller[_0xcb56('0xc')]);router[_0xcb56('0x8')]('/:id/subjects',auth[_0xcb56('0x9')](),controller[_0xcb56('0xd')]);router['get'](_0xcb56('0xe'),auth[_0xcb56('0x9')](),controller['getDescriptions']);router[_0xcb56('0xf')]('/',auth[_0xcb56('0x9')](),controller[_0xcb56('0x10')]);router[_0xcb56('0x11')]('/:id',auth[_0xcb56('0x9')](),controller[_0xcb56('0x12')]);router['delete'](_0xcb56('0xa'),auth[_0xcb56('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 1d2f116..3af0f32 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 _0x40a7=['STRING','sequelize'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0x40a7,0x141));var _0x740a=function(_0x475f91,_0x499f97){_0x475f91=_0x475f91-0x0;var _0x1bf7d4=_0x40a7[_0x475f91];return _0x1bf7d4;};'use strict';var Sequelize=require(_0x740a('0x0'));module['exports']={'name':{'type':Sequelize[_0x740a('0x1')]},'description':{'type':Sequelize[_0x740a('0x1')]}}; \ No newline at end of file +var _0xc134=['sequelize','exports'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0xc134,0xac));var _0x4c13=function(_0x55f31a,_0x2a64ac){_0x55f31a=_0x55f31a-0x0;var _0x2250be=_0xc134[_0x55f31a];return _0x2250be;};'use strict';var Sequelize=require(_0x4c13('0x0'));module[_0x4c13('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 5bd8b7f..2ea1fe9 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 _0xb181=['options','includeAll','include','findAll','rows','show','params','length','find','catch','body','getFields','fields','order','findOne','getSubjects','getDescriptions','html-pdf','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','result','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','destroy','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xb181,0xc1));var _0x1b18=function(_0x3cbee0,_0x352a0a){_0x3cbee0=_0x3cbee0-0x0;var _0x2ed094=_0xb181[_0x3cbee0];return _0x2ed094;};'use strict';var pdf=require(_0x1b18('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b18('0x1'));var BPromise=require(_0x1b18('0x2'));var Mustache=require(_0x1b18('0x3'));var util=require(_0x1b18('0x4'));var path=require('path');var sox=require(_0x1b18('0x5'));var csv=require(_0x1b18('0x6'));var ejs=require(_0x1b18('0x7'));var fs=require('fs');var _=require(_0x1b18('0x8'));var squel=require(_0x1b18('0x9'));var crypto=require(_0x1b18('0xa'));var jsforce=require(_0x1b18('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1b18('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1b18('0xc'));var authService=require(_0x1b18('0xd'));var qs=require(_0x1b18('0xe'));var as=require(_0x1b18('0xf'));var hardwareService=require(_0x1b18('0x10'));var logger=require(_0x1b18('0x11'))(_0x1b18('0x12'));var utils=require(_0x1b18('0x13'));var config=require(_0x1b18('0x14'));var licenseUtil=require(_0x1b18('0x15'));var db=require(_0x1b18('0x16'))['db'];var jayson=require(_0x1b18('0x17'));var client=jayson[_0x1b18('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4efa2d,_0x122139,_0x3f1b3d,_0x4d067f){return new BPromise(function(_0x118223,_0x221a30){var _0x22d1d4=_0x4d067f||client;return _0x22d1d4[_0x1b18('0x19')](_0x4efa2d,_0x3f1b3d)[_0x1b18('0x1a')](function(_0x51cad3){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x122139,_0x1b18('0x1b'));logger[_0x1b18('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x122139,_0x1b18('0x1b'),JSON[_0x1b18('0x1d')](_0x51cad3));if(_0x51cad3['error']){if(_0x51cad3[_0x1b18('0x1e')][_0x1b18('0x1f')]===0x1f4){logger['error'](_0x1b18('0x20'),_0x122139,_0x51cad3[_0x1b18('0x1e')]['message']);return _0x221a30(_0x51cad3['error']['message']);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x122139,_0x51cad3[_0x1b18('0x1e')][_0x1b18('0x21')]);return _0x118223(_0x51cad3[_0x1b18('0x1e')][_0x1b18('0x21')]);}else{logger[_0x1b18('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x122139,_0x1b18('0x1b'));_0x118223(_0x51cad3[_0x1b18('0x23')][_0x1b18('0x21')]);}})['catch'](function(_0x45696c){logger['error'](_0x1b18('0x20'),_0x122139,_0x45696c);_0x221a30(_0x45696c);});});}function respondWithStatusCode(_0x3cd9cf,_0x4d53c9){_0x4d53c9=_0x4d53c9||0xcc;return function(_0x5b0625){if(_0x5b0625){return _0x3cd9cf[_0x1b18('0x24')](_0x4d53c9);}return _0x3cd9cf['status'](_0x4d53c9)[_0x1b18('0x25')]();};}function respondWithResult(_0x30d490,_0x2a93b5){_0x2a93b5=_0x2a93b5||0xc8;return function(_0xb201fd){if(_0xb201fd){return _0x30d490['status'](_0x2a93b5)[_0x1b18('0x26')](_0xb201fd);}};}function respondWithFilteredResult(_0xe752c5,_0x2f7fb0){return function(_0x1f444){if(_0x1f444){var _0x13d90f=_0x1f444[_0x1b18('0x27')],_0x30d367=_0x2f7fb0[_0x1b18('0x28')],_0x1ad6c8=_0x2f7fb0[_0x1b18('0x28')]+_0x2f7fb0[_0x1b18('0x29')],_0x567636;if(_0x1ad6c8>=_0x13d90f){_0x1ad6c8=_0x13d90f;_0x567636=0xc8;}else{_0x567636=0xce;}_0xe752c5[_0x1b18('0x2a')](_0x567636);return _0xe752c5['set'](_0x1b18('0x2b'),_0x30d367+'-'+_0x1ad6c8+'/'+_0x13d90f)[_0x1b18('0x26')](_0x1f444);}return null;};}function patchUpdates(_0x4ef74c){return function(_0x50e928){try{jsonpatch[_0x1b18('0x2c')](_0x50e928,_0x4ef74c,!![]);}catch(_0x1c19bc){return BPromise[_0x1b18('0x2d')](_0x1c19bc);}return _0x50e928[_0x1b18('0x2e')]();};}function saveUpdates(_0x1f34e5,_0x356408){return function(_0x25171b){if(_0x25171b){return _0x25171b[_0x1b18('0x2f')](_0x1f34e5)[_0x1b18('0x1a')](function(_0x79be02){return _0x79be02;});}return null;};}function removeEntity(_0x6d0f5d,_0xb126f0){return function(_0x55df7e){if(_0x55df7e){return _0x55df7e[_0x1b18('0x30')]()[_0x1b18('0x1a')](function(){_0x6d0f5d['status'](0xcc)[_0x1b18('0x25')]();});}};}function handleEntityNotFound(_0x505e4f,_0x145652){return function(_0x201886){if(!_0x201886){_0x505e4f['sendStatus'](0x194);}return _0x201886;};}function handleError(_0x1599c2,_0x4fcb01){_0x4fcb01=_0x4fcb01||0x1f4;return function(_0x4fb418){logger['error'](_0x4fb418['stack']);if(_0x4fb418[_0x1b18('0x31')]){delete _0x4fb418['name'];}_0x1599c2[_0x1b18('0x2a')](_0x4fcb01)[_0x1b18('0x32')](_0x4fb418);};}exports['index']=function(_0x18ec63,_0x5383b7){var _0x3fa789={},_0x503298={},_0x3e9326={'count':0x0,'rows':[]};var _0x338657=_[_0x1b18('0x33')](db[_0x1b18('0x34')][_0x1b18('0x35')],function(_0x31534c){return{'name':_0x31534c[_0x1b18('0x36')],'type':_0x31534c[_0x1b18('0x37')][_0x1b18('0x38')]};});_0x503298['model']=_[_0x1b18('0x33')](_0x338657,_0x1b18('0x31'));_0x503298[_0x1b18('0x39')]=_[_0x1b18('0x3a')](_0x18ec63['query']);_0x503298[_0x1b18('0x3b')]=_['intersection'](_0x503298[_0x1b18('0x3c')],_0x503298[_0x1b18('0x39')]);_0x3fa789['attributes']=_[_0x1b18('0x3d')](_0x503298['model'],qs['fields'](_0x18ec63[_0x1b18('0x39')]['fields']));_0x3fa789['attributes']=_0x3fa789[_0x1b18('0x3e')]['length']?_0x3fa789['attributes']:_0x503298[_0x1b18('0x3c')];if(!_0x18ec63[_0x1b18('0x39')][_0x1b18('0x3f')](_0x1b18('0x40'))){_0x3fa789[_0x1b18('0x29')]=qs['limit'](_0x18ec63['query']['limit']);_0x3fa789['offset']=qs[_0x1b18('0x28')](_0x18ec63[_0x1b18('0x39')][_0x1b18('0x28')]);}_0x3fa789['order']=qs['sort'](_0x18ec63['query'][_0x1b18('0x41')]);_0x3fa789['where']=qs[_0x1b18('0x3b')](_[_0x1b18('0x42')](_0x18ec63[_0x1b18('0x39')],_0x503298['filters']),_0x338657);if(_0x18ec63[_0x1b18('0x39')][_0x1b18('0x43')]){_0x3fa789[_0x1b18('0x44')]=_[_0x1b18('0x45')](_0x3fa789['where'],{'$or':_[_0x1b18('0x33')](_0x338657,function(_0x58cf00){if(_0x58cf00[_0x1b18('0x37')]!==_0x1b18('0x46')){var _0x809f6b={};_0x809f6b[_0x58cf00[_0x1b18('0x31')]]={'$like':'%'+_0x18ec63[_0x1b18('0x39')][_0x1b18('0x43')]+'%'};return _0x809f6b;}})});}_0x3fa789=_[_0x1b18('0x45')]({},_0x3fa789,_0x18ec63[_0x1b18('0x47')]);var _0x23163d={'where':_0x3fa789[_0x1b18('0x44')]};return db['SugarcrmConfiguration'][_0x1b18('0x27')](_0x23163d)['then'](function(_0x16a40e){_0x3e9326['count']=_0x16a40e;if(_0x18ec63[_0x1b18('0x39')][_0x1b18('0x48')]){_0x3fa789[_0x1b18('0x49')]=[{'all':!![]}];}return db[_0x1b18('0x34')][_0x1b18('0x4a')](_0x3fa789);})[_0x1b18('0x1a')](function(_0x2b755f){_0x3e9326[_0x1b18('0x4b')]=_0x2b755f;return _0x3e9326;})['then'](respondWithFilteredResult(_0x5383b7,_0x3fa789))['catch'](handleError(_0x5383b7,null));};exports[_0x1b18('0x4c')]=function(_0x476ffc,_0xda10ef){var _0x55305a={'raw':![],'where':{'id':_0x476ffc[_0x1b18('0x4d')]['id']}},_0x22b2c5={};_0x22b2c5[_0x1b18('0x3c')]=_[_0x1b18('0x3a')](db[_0x1b18('0x34')]['rawAttributes']);_0x22b2c5[_0x1b18('0x39')]=_[_0x1b18('0x3a')](_0x476ffc[_0x1b18('0x39')]);_0x22b2c5[_0x1b18('0x3b')]=_[_0x1b18('0x3d')](_0x22b2c5[_0x1b18('0x3c')],_0x22b2c5[_0x1b18('0x39')]);_0x55305a['attributes']=_['intersection'](_0x22b2c5['model'],qs['fields'](_0x476ffc[_0x1b18('0x39')]['fields']));_0x55305a['attributes']=_0x55305a[_0x1b18('0x3e')][_0x1b18('0x4e')]?_0x55305a[_0x1b18('0x3e')]:_0x22b2c5[_0x1b18('0x3c')];if(_0x476ffc['query']['includeAll']){_0x55305a['include']=[{'all':!![]}];}_0x55305a=_[_0x1b18('0x45')]({},_0x55305a,_0x476ffc[_0x1b18('0x47')]);return db[_0x1b18('0x34')][_0x1b18('0x4f')](_0x55305a)[_0x1b18('0x1a')](handleEntityNotFound(_0xda10ef,null))[_0x1b18('0x1a')](respondWithResult(_0xda10ef,null))[_0x1b18('0x50')](handleError(_0xda10ef,null));};exports['create']=function(_0x240177,_0x521c27){return db[_0x1b18('0x34')]['create'](_0x240177[_0x1b18('0x51')],{})[_0x1b18('0x1a')](respondWithResult(_0x521c27,0xc9))[_0x1b18('0x50')](handleError(_0x521c27,null));};exports[_0x1b18('0x2f')]=function(_0x513630,_0x2c6bf2){if(_0x513630[_0x1b18('0x51')]['id']){delete _0x513630[_0x1b18('0x51')]['id'];}return db[_0x1b18('0x34')][_0x1b18('0x4f')]({'where':{'id':_0x513630[_0x1b18('0x4d')]['id']}})[_0x1b18('0x1a')](handleEntityNotFound(_0x2c6bf2,null))[_0x1b18('0x1a')](saveUpdates(_0x513630[_0x1b18('0x51')],null))['then'](respondWithResult(_0x2c6bf2,null))['catch'](handleError(_0x2c6bf2,null));};exports['destroy']=function(_0x3b9df9,_0x4e94b1){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x3b9df9[_0x1b18('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4e94b1,null))['then'](removeEntity(_0x4e94b1,null))['catch'](handleError(_0x4e94b1,null));};exports[_0x1b18('0x52')]=function(_0x1b7f5d,_0x2c5afd,_0x1493a5){var _0x12f8f6={};var _0x3d9285={};var _0x3efa83;var _0x5369dd;return db[_0x1b18('0x34')]['findOne']({'where':{'id':_0x1b7f5d[_0x1b18('0x4d')]['id']}})[_0x1b18('0x1a')](handleEntityNotFound(_0x2c5afd,null))['then'](function(_0x53d199){if(_0x53d199){_0x3efa83=_0x53d199;_0x3d9285['model']=_[_0x1b18('0x3a')](db['SugarcrmField']['rawAttributes']);_0x3d9285[_0x1b18('0x39')]=_['keys'](_0x1b7f5d[_0x1b18('0x39')]);_0x3d9285[_0x1b18('0x3b')]=_[_0x1b18('0x3d')](_0x3d9285['model'],_0x3d9285['query']);_0x12f8f6[_0x1b18('0x3e')]=_['intersection'](_0x3d9285['model'],qs[_0x1b18('0x53')](_0x1b7f5d[_0x1b18('0x39')][_0x1b18('0x53')]));_0x12f8f6['attributes']=_0x12f8f6[_0x1b18('0x3e')][_0x1b18('0x4e')]?_0x12f8f6['attributes']:_0x3d9285[_0x1b18('0x3c')];_0x12f8f6[_0x1b18('0x54')]=qs[_0x1b18('0x41')](_0x1b7f5d[_0x1b18('0x39')][_0x1b18('0x41')]);_0x12f8f6[_0x1b18('0x44')]=qs[_0x1b18('0x3b')](_['pick'](_0x1b7f5d[_0x1b18('0x39')],_0x3d9285[_0x1b18('0x3b')]));if(_0x1b7f5d[_0x1b18('0x39')][_0x1b18('0x43')]){_0x12f8f6[_0x1b18('0x44')]=_[_0x1b18('0x45')](_0x12f8f6[_0x1b18('0x44')],{'$or':_[_0x1b18('0x33')](_0x12f8f6['attributes'],function(_0x32d61e){var _0x5349eb={};_0x5349eb[_0x32d61e]={'$like':'%'+_0x1b7f5d[_0x1b18('0x39')][_0x1b18('0x43')]+'%'};return _0x5349eb;})});}_0x12f8f6=_[_0x1b18('0x45')]({},_0x12f8f6,_0x1b7f5d['options']);return _0x3efa83['getFields'](_0x12f8f6);}})[_0x1b18('0x1a')](function(_0x34ead6){if(_0x34ead6){_0x5369dd=_0x34ead6[_0x1b18('0x4e')];if(!_0x1b7f5d[_0x1b18('0x39')][_0x1b18('0x3f')]('nolimit')){_0x12f8f6[_0x1b18('0x29')]=qs[_0x1b18('0x29')](_0x1b7f5d[_0x1b18('0x39')][_0x1b18('0x29')]);_0x12f8f6[_0x1b18('0x28')]=qs[_0x1b18('0x28')](_0x1b7f5d[_0x1b18('0x39')][_0x1b18('0x28')]);}return _0x3efa83[_0x1b18('0x52')](_0x12f8f6);}})[_0x1b18('0x1a')](function(_0x52bcbc){if(_0x52bcbc){return _0x52bcbc?{'count':_0x5369dd,'rows':_0x52bcbc}:null;}})['then'](respondWithResult(_0x2c5afd,null))['catch'](handleError(_0x2c5afd,null));};exports['getSubjects']=function(_0x4caee7,_0x3c0202,_0x30d948){var _0x4dd226={};var _0x1606c0={};var _0x4f0363;var _0x3e8b54;return db[_0x1b18('0x34')][_0x1b18('0x55')]({'where':{'id':_0x4caee7[_0x1b18('0x4d')]['id']}})[_0x1b18('0x1a')](handleEntityNotFound(_0x3c0202,null))[_0x1b18('0x1a')](function(_0x1d3b85){if(_0x1d3b85){_0x4f0363=_0x1d3b85;_0x1606c0[_0x1b18('0x3c')]=_[_0x1b18('0x3a')](db['SugarcrmField']['rawAttributes']);_0x1606c0[_0x1b18('0x39')]=_[_0x1b18('0x3a')](_0x4caee7[_0x1b18('0x39')]);_0x1606c0['filters']=_['intersection'](_0x1606c0[_0x1b18('0x3c')],_0x1606c0[_0x1b18('0x39')]);_0x4dd226[_0x1b18('0x3e')]=_[_0x1b18('0x3d')](_0x1606c0[_0x1b18('0x3c')],qs[_0x1b18('0x53')](_0x4caee7[_0x1b18('0x39')]['fields']));_0x4dd226[_0x1b18('0x3e')]=_0x4dd226['attributes'][_0x1b18('0x4e')]?_0x4dd226['attributes']:_0x1606c0[_0x1b18('0x3c')];_0x4dd226[_0x1b18('0x54')]=qs[_0x1b18('0x41')](_0x4caee7[_0x1b18('0x39')][_0x1b18('0x41')]);_0x4dd226['where']=qs[_0x1b18('0x3b')](_['pick'](_0x4caee7['query'],_0x1606c0[_0x1b18('0x3b')]));if(_0x4caee7[_0x1b18('0x39')]['filter']){_0x4dd226[_0x1b18('0x44')]=_['merge'](_0x4dd226['where'],{'$or':_[_0x1b18('0x33')](_0x4dd226[_0x1b18('0x3e')],function(_0x2c1ddd){var _0x3c90b6={};_0x3c90b6[_0x2c1ddd]={'$like':'%'+_0x4caee7[_0x1b18('0x39')][_0x1b18('0x43')]+'%'};return _0x3c90b6;})});}_0x4dd226=_[_0x1b18('0x45')]({},_0x4dd226,_0x4caee7[_0x1b18('0x47')]);return _0x4f0363[_0x1b18('0x56')](_0x4dd226);}})[_0x1b18('0x1a')](function(_0x46e7b8){if(_0x46e7b8){_0x3e8b54=_0x46e7b8[_0x1b18('0x4e')];if(!_0x4caee7[_0x1b18('0x39')][_0x1b18('0x3f')](_0x1b18('0x40'))){_0x4dd226[_0x1b18('0x29')]=qs['limit'](_0x4caee7[_0x1b18('0x39')][_0x1b18('0x29')]);_0x4dd226[_0x1b18('0x28')]=qs[_0x1b18('0x28')](_0x4caee7['query'][_0x1b18('0x28')]);}return _0x4f0363[_0x1b18('0x56')](_0x4dd226);}})[_0x1b18('0x1a')](function(_0x53508e){if(_0x53508e){return _0x53508e?{'count':_0x3e8b54,'rows':_0x53508e}:null;}})[_0x1b18('0x1a')](respondWithResult(_0x3c0202,null))['catch'](handleError(_0x3c0202,null));};exports[_0x1b18('0x57')]=function(_0x29a4a0,_0x178ed8,_0xea54e9){var _0x3a5ebf={};var _0x4ab693={};var _0x1a5bcc;var _0x750f86;return db[_0x1b18('0x34')]['findOne']({'where':{'id':_0x29a4a0[_0x1b18('0x4d')]['id']}})[_0x1b18('0x1a')](handleEntityNotFound(_0x178ed8,null))[_0x1b18('0x1a')](function(_0x3458c7){if(_0x3458c7){_0x1a5bcc=_0x3458c7;_0x4ab693['model']=_[_0x1b18('0x3a')](db['SugarcrmField'][_0x1b18('0x35')]);_0x4ab693['query']=_[_0x1b18('0x3a')](_0x29a4a0[_0x1b18('0x39')]);_0x4ab693[_0x1b18('0x3b')]=_[_0x1b18('0x3d')](_0x4ab693['model'],_0x4ab693[_0x1b18('0x39')]);_0x3a5ebf[_0x1b18('0x3e')]=_[_0x1b18('0x3d')](_0x4ab693[_0x1b18('0x3c')],qs[_0x1b18('0x53')](_0x29a4a0[_0x1b18('0x39')][_0x1b18('0x53')]));_0x3a5ebf['attributes']=_0x3a5ebf[_0x1b18('0x3e')]['length']?_0x3a5ebf[_0x1b18('0x3e')]:_0x4ab693[_0x1b18('0x3c')];_0x3a5ebf[_0x1b18('0x54')]=qs[_0x1b18('0x41')](_0x29a4a0[_0x1b18('0x39')][_0x1b18('0x41')]);_0x3a5ebf[_0x1b18('0x44')]=qs[_0x1b18('0x3b')](_[_0x1b18('0x42')](_0x29a4a0[_0x1b18('0x39')],_0x4ab693['filters']));if(_0x29a4a0[_0x1b18('0x39')][_0x1b18('0x43')]){_0x3a5ebf['where']=_[_0x1b18('0x45')](_0x3a5ebf[_0x1b18('0x44')],{'$or':_[_0x1b18('0x33')](_0x3a5ebf[_0x1b18('0x3e')],function(_0x2bf77e){var _0x17c7cf={};_0x17c7cf[_0x2bf77e]={'$like':'%'+_0x29a4a0['query'][_0x1b18('0x43')]+'%'};return _0x17c7cf;})});}_0x3a5ebf=_[_0x1b18('0x45')]({},_0x3a5ebf,_0x29a4a0[_0x1b18('0x47')]);return _0x1a5bcc[_0x1b18('0x57')](_0x3a5ebf);}})[_0x1b18('0x1a')](function(_0x579cea){if(_0x579cea){_0x750f86=_0x579cea[_0x1b18('0x4e')];if(!_0x29a4a0[_0x1b18('0x39')][_0x1b18('0x3f')](_0x1b18('0x40'))){_0x3a5ebf['limit']=qs[_0x1b18('0x29')](_0x29a4a0[_0x1b18('0x39')]['limit']);_0x3a5ebf[_0x1b18('0x28')]=qs[_0x1b18('0x28')](_0x29a4a0['query'][_0x1b18('0x28')]);}return _0x1a5bcc['getDescriptions'](_0x3a5ebf);}})[_0x1b18('0x1a')](function(_0x551ac7){if(_0x551ac7){return _0x551ac7?{'count':_0x750f86,'rows':_0x551ac7}:null;}})[_0x1b18('0x1a')](respondWithResult(_0x178ed8,null))[_0x1b18('0x50')](handleError(_0x178ed8,null));}; \ No newline at end of file +var _0x5dc8=['sendStatus','name','send','index','map','SugarcrmConfiguration','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','offset','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','getFields','hasOwnProperty','nolimit','getSubjects','findOne','SugarcrmField','getDescriptions','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','client','http','request','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','status','end','json','count','limit','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x57d874,_0x489e99){var _0x63b5a8=function(_0x276b69){while(--_0x276b69){_0x57d874['push'](_0x57d874['shift']());}};_0x63b5a8(++_0x489e99);}(_0x5dc8,0x84));var _0x85dc=function(_0x55c8e3,_0x4addd4){_0x55c8e3=_0x55c8e3-0x0;var _0x7e6c2c=_0x5dc8[_0x55c8e3];return _0x7e6c2c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x85dc('0x0'));var rimraf=require(_0x85dc('0x1'));var zipdir=require(_0x85dc('0x2'));var jsonpatch=require(_0x85dc('0x3'));var rp=require(_0x85dc('0x4'));var moment=require('moment');var BPromise=require(_0x85dc('0x5'));var Mustache=require(_0x85dc('0x6'));var util=require(_0x85dc('0x7'));var path=require(_0x85dc('0x8'));var sox=require(_0x85dc('0x9'));var csv=require('to-csv');var ejs=require(_0x85dc('0xa'));var fs=require('fs');var _=require(_0x85dc('0xb'));var squel=require('squel');var crypto=require(_0x85dc('0xc'));var jsforce=require(_0x85dc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x85dc('0xe'));var querystring=require(_0x85dc('0xf'));var Papa=require(_0x85dc('0x10'));var Redis=require(_0x85dc('0x11'));var authService=require(_0x85dc('0x12'));var qs=require(_0x85dc('0x13'));var as=require(_0x85dc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x85dc('0x15'))('api');var utils=require(_0x85dc('0x16'));var config=require(_0x85dc('0x17'));var licenseUtil=require(_0x85dc('0x18'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x85dc('0x19')][_0x85dc('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1f9a22,_0x89f957,_0x34ec33,_0x477e48){return new BPromise(function(_0x1fa88e,_0xca684b){var _0x47b9f7=_0x477e48||client;return _0x47b9f7[_0x85dc('0x1b')](_0x1f9a22,_0x34ec33)['then'](function(_0xd1b684){logger[_0x85dc('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x89f957,'request\x20sent');logger[_0x85dc('0x1d')](_0x85dc('0x1e'),_0x89f957,'request\x20sent',JSON[_0x85dc('0x1f')](_0xd1b684));if(_0xd1b684[_0x85dc('0x20')]){if(_0xd1b684['error'][_0x85dc('0x21')]===0x1f4){logger['error'](_0x85dc('0x22'),_0x89f957,_0xd1b684[_0x85dc('0x20')]['message']);return _0xca684b(_0xd1b684[_0x85dc('0x20')][_0x85dc('0x23')]);}logger[_0x85dc('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x89f957,_0xd1b684[_0x85dc('0x20')][_0x85dc('0x23')]);return _0x1fa88e(_0xd1b684[_0x85dc('0x20')]['message']);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x89f957,'request\x20sent');_0x1fa88e(_0xd1b684['result'][_0x85dc('0x23')]);}})['catch'](function(_0x447c90){logger[_0x85dc('0x20')](_0x85dc('0x22'),_0x89f957,_0x447c90);_0xca684b(_0x447c90);});});}function respondWithStatusCode(_0x277f8e,_0x3731ff){_0x3731ff=_0x3731ff||0xcc;return function(_0x532d27){if(_0x532d27){return _0x277f8e['sendStatus'](_0x3731ff);}return _0x277f8e[_0x85dc('0x24')](_0x3731ff)[_0x85dc('0x25')]();};}function respondWithResult(_0xc484ba,_0x2b8c73){_0x2b8c73=_0x2b8c73||0xc8;return function(_0x5a763f){if(_0x5a763f){return _0xc484ba[_0x85dc('0x24')](_0x2b8c73)[_0x85dc('0x26')](_0x5a763f);}};}function respondWithFilteredResult(_0x25e527,_0x14d4c8){return function(_0x1c3e04){if(_0x1c3e04){var _0x53808a=_0x1c3e04[_0x85dc('0x27')],_0x506910=_0x14d4c8['offset'],_0x1f92e7=_0x14d4c8['offset']+_0x14d4c8[_0x85dc('0x28')],_0x3145b3;if(_0x1f92e7>=_0x53808a){_0x1f92e7=_0x53808a;_0x3145b3=0xc8;}else{_0x3145b3=0xce;}_0x25e527[_0x85dc('0x24')](_0x3145b3);return _0x25e527['set'](_0x85dc('0x29'),_0x506910+'-'+_0x1f92e7+'/'+_0x53808a)['json'](_0x1c3e04);}return null;};}function patchUpdates(_0x3341cf){return function(_0x103e70){try{jsonpatch[_0x85dc('0x2a')](_0x103e70,_0x3341cf,!![]);}catch(_0x177e76){return BPromise[_0x85dc('0x2b')](_0x177e76);}return _0x103e70[_0x85dc('0x2c')]();};}function saveUpdates(_0x16755f,_0x292546){return function(_0x197ba8){if(_0x197ba8){return _0x197ba8[_0x85dc('0x2d')](_0x16755f)['then'](function(_0x29090c){return _0x29090c;});}return null;};}function removeEntity(_0x1bfc97,_0x5ef4f3){return function(_0x1b3c0a){if(_0x1b3c0a){return _0x1b3c0a[_0x85dc('0x2e')]()[_0x85dc('0x2f')](function(){_0x1bfc97[_0x85dc('0x24')](0xcc)[_0x85dc('0x25')]();});}};}function handleEntityNotFound(_0x549bb5,_0x3d0bf8){return function(_0x292cec){if(!_0x292cec){_0x549bb5[_0x85dc('0x30')](0x194);}return _0x292cec;};}function handleError(_0x56bfb9,_0x3c73c2){_0x3c73c2=_0x3c73c2||0x1f4;return function(_0x4d2e3c){logger[_0x85dc('0x20')](_0x4d2e3c['stack']);if(_0x4d2e3c[_0x85dc('0x31')]){delete _0x4d2e3c[_0x85dc('0x31')];}_0x56bfb9['status'](_0x3c73c2)[_0x85dc('0x32')](_0x4d2e3c);};}exports[_0x85dc('0x33')]=function(_0x4bbf1e,_0x48eddc){var _0x226a53={},_0x2a8899={},_0x1b273c={'count':0x0,'rows':[]};var _0x5177b9=_[_0x85dc('0x34')](db[_0x85dc('0x35')][_0x85dc('0x36')],function(_0xe46826){return{'name':_0xe46826['fieldName'],'type':_0xe46826[_0x85dc('0x37')][_0x85dc('0x38')]};});_0x2a8899[_0x85dc('0x39')]=_[_0x85dc('0x34')](_0x5177b9,_0x85dc('0x31'));_0x2a8899[_0x85dc('0x3a')]=_[_0x85dc('0x3b')](_0x4bbf1e[_0x85dc('0x3a')]);_0x2a8899['filters']=_[_0x85dc('0x3c')](_0x2a8899[_0x85dc('0x39')],_0x2a8899[_0x85dc('0x3a')]);_0x226a53[_0x85dc('0x3d')]=_[_0x85dc('0x3c')](_0x2a8899['model'],qs[_0x85dc('0x3e')](_0x4bbf1e[_0x85dc('0x3a')][_0x85dc('0x3e')]));_0x226a53[_0x85dc('0x3d')]=_0x226a53[_0x85dc('0x3d')][_0x85dc('0x3f')]?_0x226a53['attributes']:_0x2a8899[_0x85dc('0x39')];if(!_0x4bbf1e['query']['hasOwnProperty']('nolimit')){_0x226a53[_0x85dc('0x28')]=qs[_0x85dc('0x28')](_0x4bbf1e[_0x85dc('0x3a')][_0x85dc('0x28')]);_0x226a53[_0x85dc('0x40')]=qs[_0x85dc('0x40')](_0x4bbf1e['query'][_0x85dc('0x40')]);}_0x226a53['order']=qs['sort'](_0x4bbf1e['query'][_0x85dc('0x41')]);_0x226a53[_0x85dc('0x42')]=qs[_0x85dc('0x43')](_[_0x85dc('0x44')](_0x4bbf1e[_0x85dc('0x3a')],_0x2a8899[_0x85dc('0x43')]),_0x5177b9);if(_0x4bbf1e[_0x85dc('0x3a')][_0x85dc('0x45')]){_0x226a53[_0x85dc('0x42')]=_[_0x85dc('0x46')](_0x226a53[_0x85dc('0x42')],{'$or':_[_0x85dc('0x34')](_0x5177b9,function(_0x5bcde6){if(_0x5bcde6[_0x85dc('0x37')]!==_0x85dc('0x47')){var _0x226885={};_0x226885[_0x5bcde6[_0x85dc('0x31')]]={'$like':'%'+_0x4bbf1e[_0x85dc('0x3a')][_0x85dc('0x45')]+'%'};return _0x226885;}})});}_0x226a53=_[_0x85dc('0x46')]({},_0x226a53,_0x4bbf1e[_0x85dc('0x48')]);var _0x142572={'where':_0x226a53['where']};return db[_0x85dc('0x35')][_0x85dc('0x27')](_0x142572)['then'](function(_0x35a2e3){_0x1b273c['count']=_0x35a2e3;if(_0x4bbf1e['query'][_0x85dc('0x49')]){_0x226a53[_0x85dc('0x4a')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x85dc('0x4b')](_0x226a53);})[_0x85dc('0x2f')](function(_0x2dadb4){_0x1b273c['rows']=_0x2dadb4;return _0x1b273c;})[_0x85dc('0x2f')](respondWithFilteredResult(_0x48eddc,_0x226a53))[_0x85dc('0x4c')](handleError(_0x48eddc,null));};exports[_0x85dc('0x4d')]=function(_0x20a961,_0x1d4dab){var _0x1e32b7={'raw':![],'where':{'id':_0x20a961[_0x85dc('0x4e')]['id']}},_0x4d7b84={};_0x4d7b84[_0x85dc('0x39')]=_[_0x85dc('0x3b')](db['SugarcrmConfiguration']['rawAttributes']);_0x4d7b84['query']=_['keys'](_0x20a961[_0x85dc('0x3a')]);_0x4d7b84[_0x85dc('0x43')]=_[_0x85dc('0x3c')](_0x4d7b84[_0x85dc('0x39')],_0x4d7b84[_0x85dc('0x3a')]);_0x1e32b7[_0x85dc('0x3d')]=_[_0x85dc('0x3c')](_0x4d7b84[_0x85dc('0x39')],qs[_0x85dc('0x3e')](_0x20a961['query'][_0x85dc('0x3e')]));_0x1e32b7['attributes']=_0x1e32b7[_0x85dc('0x3d')][_0x85dc('0x3f')]?_0x1e32b7['attributes']:_0x4d7b84[_0x85dc('0x39')];if(_0x20a961[_0x85dc('0x3a')][_0x85dc('0x49')]){_0x1e32b7[_0x85dc('0x4a')]=[{'all':!![]}];}_0x1e32b7=_['merge']({},_0x1e32b7,_0x20a961['options']);return db[_0x85dc('0x35')][_0x85dc('0x4f')](_0x1e32b7)['then'](handleEntityNotFound(_0x1d4dab,null))[_0x85dc('0x2f')](respondWithResult(_0x1d4dab,null))[_0x85dc('0x4c')](handleError(_0x1d4dab,null));};exports[_0x85dc('0x50')]=function(_0x28769e,_0x28857e){return db[_0x85dc('0x35')]['create'](_0x28769e['body'],{})['then'](respondWithResult(_0x28857e,0xc9))[_0x85dc('0x4c')](handleError(_0x28857e,null));};exports[_0x85dc('0x2d')]=function(_0x5aedee,_0xd57000){if(_0x5aedee[_0x85dc('0x51')]['id']){delete _0x5aedee[_0x85dc('0x51')]['id'];}return db[_0x85dc('0x35')][_0x85dc('0x4f')]({'where':{'id':_0x5aedee[_0x85dc('0x4e')]['id']}})[_0x85dc('0x2f')](handleEntityNotFound(_0xd57000,null))['then'](saveUpdates(_0x5aedee[_0x85dc('0x51')],null))[_0x85dc('0x2f')](respondWithResult(_0xd57000,null))['catch'](handleError(_0xd57000,null));};exports[_0x85dc('0x2e')]=function(_0x3e774c,_0x53b4e0){return db['SugarcrmConfiguration'][_0x85dc('0x4f')]({'where':{'id':_0x3e774c[_0x85dc('0x4e')]['id']}})[_0x85dc('0x2f')](handleEntityNotFound(_0x53b4e0,null))['then'](removeEntity(_0x53b4e0,null))[_0x85dc('0x4c')](handleError(_0x53b4e0,null));};exports[_0x85dc('0x52')]=function(_0x3ff006,_0x207054,_0x3e79b6){var _0x2b4cdd={};var _0x345182={};var _0x5e3920;var _0x364fe8;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x3ff006[_0x85dc('0x4e')]['id']}})[_0x85dc('0x2f')](handleEntityNotFound(_0x207054,null))[_0x85dc('0x2f')](function(_0x3c998d){if(_0x3c998d){_0x5e3920=_0x3c998d;_0x345182[_0x85dc('0x39')]=_[_0x85dc('0x3b')](db['SugarcrmField']['rawAttributes']);_0x345182[_0x85dc('0x3a')]=_[_0x85dc('0x3b')](_0x3ff006[_0x85dc('0x3a')]);_0x345182[_0x85dc('0x43')]=_[_0x85dc('0x3c')](_0x345182['model'],_0x345182[_0x85dc('0x3a')]);_0x2b4cdd[_0x85dc('0x3d')]=_[_0x85dc('0x3c')](_0x345182[_0x85dc('0x39')],qs[_0x85dc('0x3e')](_0x3ff006[_0x85dc('0x3a')]['fields']));_0x2b4cdd[_0x85dc('0x3d')]=_0x2b4cdd[_0x85dc('0x3d')][_0x85dc('0x3f')]?_0x2b4cdd[_0x85dc('0x3d')]:_0x345182[_0x85dc('0x39')];_0x2b4cdd['order']=qs[_0x85dc('0x41')](_0x3ff006[_0x85dc('0x3a')][_0x85dc('0x41')]);_0x2b4cdd[_0x85dc('0x42')]=qs[_0x85dc('0x43')](_[_0x85dc('0x44')](_0x3ff006[_0x85dc('0x3a')],_0x345182[_0x85dc('0x43')]));if(_0x3ff006[_0x85dc('0x3a')][_0x85dc('0x45')]){_0x2b4cdd['where']=_[_0x85dc('0x46')](_0x2b4cdd[_0x85dc('0x42')],{'$or':_[_0x85dc('0x34')](_0x2b4cdd['attributes'],function(_0x3226a){var _0x575aa3={};_0x575aa3[_0x3226a]={'$like':'%'+_0x3ff006['query']['filter']+'%'};return _0x575aa3;})});}_0x2b4cdd=_[_0x85dc('0x46')]({},_0x2b4cdd,_0x3ff006[_0x85dc('0x48')]);return _0x5e3920[_0x85dc('0x52')](_0x2b4cdd);}})[_0x85dc('0x2f')](function(_0x1aacb8){if(_0x1aacb8){_0x364fe8=_0x1aacb8[_0x85dc('0x3f')];if(!_0x3ff006['query'][_0x85dc('0x53')](_0x85dc('0x54'))){_0x2b4cdd[_0x85dc('0x28')]=qs[_0x85dc('0x28')](_0x3ff006[_0x85dc('0x3a')][_0x85dc('0x28')]);_0x2b4cdd['offset']=qs[_0x85dc('0x40')](_0x3ff006[_0x85dc('0x3a')][_0x85dc('0x40')]);}return _0x5e3920[_0x85dc('0x52')](_0x2b4cdd);}})[_0x85dc('0x2f')](function(_0x2e7e0e){if(_0x2e7e0e){return _0x2e7e0e?{'count':_0x364fe8,'rows':_0x2e7e0e}:null;}})[_0x85dc('0x2f')](respondWithResult(_0x207054,null))[_0x85dc('0x4c')](handleError(_0x207054,null));};exports[_0x85dc('0x55')]=function(_0x30b891,_0x53055b,_0x389158){var _0x1dc1aa={};var _0x4cfa85={};var _0x529a07;var _0x48f7eb;return db[_0x85dc('0x35')][_0x85dc('0x56')]({'where':{'id':_0x30b891[_0x85dc('0x4e')]['id']}})[_0x85dc('0x2f')](handleEntityNotFound(_0x53055b,null))[_0x85dc('0x2f')](function(_0x128edf){if(_0x128edf){_0x529a07=_0x128edf;_0x4cfa85[_0x85dc('0x39')]=_[_0x85dc('0x3b')](db[_0x85dc('0x57')][_0x85dc('0x36')]);_0x4cfa85[_0x85dc('0x3a')]=_[_0x85dc('0x3b')](_0x30b891[_0x85dc('0x3a')]);_0x4cfa85[_0x85dc('0x43')]=_[_0x85dc('0x3c')](_0x4cfa85[_0x85dc('0x39')],_0x4cfa85[_0x85dc('0x3a')]);_0x1dc1aa[_0x85dc('0x3d')]=_[_0x85dc('0x3c')](_0x4cfa85[_0x85dc('0x39')],qs[_0x85dc('0x3e')](_0x30b891[_0x85dc('0x3a')]['fields']));_0x1dc1aa[_0x85dc('0x3d')]=_0x1dc1aa[_0x85dc('0x3d')]['length']?_0x1dc1aa[_0x85dc('0x3d')]:_0x4cfa85[_0x85dc('0x39')];_0x1dc1aa['order']=qs[_0x85dc('0x41')](_0x30b891[_0x85dc('0x3a')]['sort']);_0x1dc1aa[_0x85dc('0x42')]=qs[_0x85dc('0x43')](_[_0x85dc('0x44')](_0x30b891[_0x85dc('0x3a')],_0x4cfa85[_0x85dc('0x43')]));if(_0x30b891[_0x85dc('0x3a')]['filter']){_0x1dc1aa[_0x85dc('0x42')]=_[_0x85dc('0x46')](_0x1dc1aa['where'],{'$or':_[_0x85dc('0x34')](_0x1dc1aa[_0x85dc('0x3d')],function(_0x456918){var _0x2cf8ca={};_0x2cf8ca[_0x456918]={'$like':'%'+_0x30b891[_0x85dc('0x3a')][_0x85dc('0x45')]+'%'};return _0x2cf8ca;})});}_0x1dc1aa=_[_0x85dc('0x46')]({},_0x1dc1aa,_0x30b891['options']);return _0x529a07[_0x85dc('0x55')](_0x1dc1aa);}})[_0x85dc('0x2f')](function(_0x29f5e7){if(_0x29f5e7){_0x48f7eb=_0x29f5e7['length'];if(!_0x30b891[_0x85dc('0x3a')][_0x85dc('0x53')](_0x85dc('0x54'))){_0x1dc1aa['limit']=qs[_0x85dc('0x28')](_0x30b891[_0x85dc('0x3a')][_0x85dc('0x28')]);_0x1dc1aa[_0x85dc('0x40')]=qs[_0x85dc('0x40')](_0x30b891['query'][_0x85dc('0x40')]);}return _0x529a07['getSubjects'](_0x1dc1aa);}})[_0x85dc('0x2f')](function(_0x20428a){if(_0x20428a){return _0x20428a?{'count':_0x48f7eb,'rows':_0x20428a}:null;}})[_0x85dc('0x2f')](respondWithResult(_0x53055b,null))[_0x85dc('0x4c')](handleError(_0x53055b,null));};exports[_0x85dc('0x58')]=function(_0xd758dd,_0x162514,_0x306d5c){var _0x9c7612={};var _0x1bbcb0={};var _0x43ccd3;var _0x2325de;return db[_0x85dc('0x35')][_0x85dc('0x56')]({'where':{'id':_0xd758dd['params']['id']}})['then'](handleEntityNotFound(_0x162514,null))[_0x85dc('0x2f')](function(_0x171182){if(_0x171182){_0x43ccd3=_0x171182;_0x1bbcb0[_0x85dc('0x39')]=_[_0x85dc('0x3b')](db[_0x85dc('0x57')][_0x85dc('0x36')]);_0x1bbcb0[_0x85dc('0x3a')]=_[_0x85dc('0x3b')](_0xd758dd[_0x85dc('0x3a')]);_0x1bbcb0[_0x85dc('0x43')]=_[_0x85dc('0x3c')](_0x1bbcb0[_0x85dc('0x39')],_0x1bbcb0[_0x85dc('0x3a')]);_0x9c7612[_0x85dc('0x3d')]=_['intersection'](_0x1bbcb0[_0x85dc('0x39')],qs[_0x85dc('0x3e')](_0xd758dd[_0x85dc('0x3a')][_0x85dc('0x3e')]));_0x9c7612[_0x85dc('0x3d')]=_0x9c7612[_0x85dc('0x3d')][_0x85dc('0x3f')]?_0x9c7612[_0x85dc('0x3d')]:_0x1bbcb0[_0x85dc('0x39')];_0x9c7612[_0x85dc('0x59')]=qs[_0x85dc('0x41')](_0xd758dd[_0x85dc('0x3a')][_0x85dc('0x41')]);_0x9c7612['where']=qs[_0x85dc('0x43')](_['pick'](_0xd758dd[_0x85dc('0x3a')],_0x1bbcb0[_0x85dc('0x43')]));if(_0xd758dd[_0x85dc('0x3a')][_0x85dc('0x45')]){_0x9c7612[_0x85dc('0x42')]=_[_0x85dc('0x46')](_0x9c7612['where'],{'$or':_[_0x85dc('0x34')](_0x9c7612[_0x85dc('0x3d')],function(_0x4f44c9){var _0x4dd33a={};_0x4dd33a[_0x4f44c9]={'$like':'%'+_0xd758dd['query'][_0x85dc('0x45')]+'%'};return _0x4dd33a;})});}_0x9c7612=_[_0x85dc('0x46')]({},_0x9c7612,_0xd758dd[_0x85dc('0x48')]);return _0x43ccd3['getDescriptions'](_0x9c7612);}})[_0x85dc('0x2f')](function(_0x2400f7){if(_0x2400f7){_0x2325de=_0x2400f7[_0x85dc('0x3f')];if(!_0xd758dd[_0x85dc('0x3a')][_0x85dc('0x53')]('nolimit')){_0x9c7612['limit']=qs[_0x85dc('0x28')](_0xd758dd[_0x85dc('0x3a')][_0x85dc('0x28')]);_0x9c7612[_0x85dc('0x40')]=qs['offset'](_0xd758dd[_0x85dc('0x3a')][_0x85dc('0x40')]);}return _0x43ccd3[_0x85dc('0x58')](_0x9c7612);}})[_0x85dc('0x2f')](function(_0x3f31cf){if(_0x3f31cf){return _0x3f31cf?{'count':_0x2325de,'rows':_0x3f31cf}:null;}})['then'](respondWithResult(_0x162514,null))[_0x85dc('0x4c')](handleError(_0x162514,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 89339c1..00c94f6 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 _0xffd2=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x3e0ffc,_0xac5165){var _0x16dde3=function(_0x11a859){while(--_0x11a859){_0x3e0ffc['push'](_0x3e0ffc['shift']());}};_0x16dde3(++_0xac5165);}(_0xffd2,0x68));var _0x2ffd=function(_0x2e53e1,_0x12aed1){_0x2e53e1=_0x2e53e1-0x0;var _0x3a23de=_0xffd2[_0x2e53e1];return _0x3a23de;};'use strict';var _=require(_0x2ffd('0x0'));var util=require(_0x2ffd('0x1'));var logger=require(_0x2ffd('0x2'))(_0x2ffd('0x3'));var moment=require(_0x2ffd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2ffd('0x5'));var config=require(_0x2ffd('0x6'));var attributes=require(_0x2ffd('0x7'));module[_0x2ffd('0x8')]=function(_0x27b9c3,_0x1d6f2f){return _0x27b9c3[_0x2ffd('0x9')](_0x2ffd('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x806f=['bluebird','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x46fd06,_0x3146cf){var _0x32f8f7=function(_0x365e53){while(--_0x365e53){_0x46fd06['push'](_0x46fd06['shift']());}};_0x32f8f7(++_0x3146cf);}(_0x806f,0xb1));var _0xf806=function(_0x506ecf,_0x1f80a1){_0x506ecf=_0x506ecf-0x0;var _0x2975ed=_0x806f[_0x506ecf];return _0x2975ed;};'use strict';var _=require(_0xf806('0x0'));var util=require(_0xf806('0x1'));var logger=require(_0xf806('0x2'))(_0xf806('0x3'));var moment=require(_0xf806('0x4'));var BPromise=require(_0xf806('0x5'));var rp=require(_0xf806('0x6'));var fs=require('fs');var path=require(_0xf806('0x7'));var rimraf=require('rimraf');var config=require(_0xf806('0x8'));var attributes=require(_0xf806('0x9'));module[_0xf806('0xa')]=function(_0x5490e7,_0x5cf507){return _0x5490e7[_0xf806('0xb')](_0xf806('0xc'),attributes,{'tableName':_0xf806('0xd'),'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 e31e544..e840da5 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 _0xf58e=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xf58e,0xea));var _0xef58=function(_0x512953,_0xc51958){_0x512953=_0x512953-0x0;var _0x3f06e8=_0xf58e[_0x512953];return _0x3f06e8;};'use strict';var _=require(_0xef58('0x0'));var util=require(_0xef58('0x1'));var moment=require(_0xef58('0x2'));var BPromise=require('bluebird');var rs=require(_0xef58('0x3'));var fs=require('fs');var Redis=require(_0xef58('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xef58('0x5'));var logger=require('../../config/logger')(_0xef58('0x6'));var config=require('../../config/environment');var jayson=require(_0xef58('0x7'));var client=jayson[_0xef58('0x8')][_0xef58('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x517f2c,_0x5e5a8b,_0x7d78cf){return new BPromise(function(_0x580dbd,_0x2fc2a5){return client[_0xef58('0xa')](_0x517f2c,_0x7d78cf)[_0xef58('0xb')](function(_0x191c80){logger[_0xef58('0xc')](_0xef58('0xd'),_0x5e5a8b,_0xef58('0xe'));logger['debug'](_0xef58('0xf'),_0x5e5a8b,_0xef58('0xe'),JSON[_0xef58('0x10')](_0x191c80));if(_0x191c80[_0xef58('0x11')]){if(_0x191c80[_0xef58('0x11')]['code']===0x1f4){logger[_0xef58('0x11')](_0xef58('0xd'),_0x5e5a8b,_0x191c80[_0xef58('0x11')]['message']);return _0x2fc2a5(_0x191c80[_0xef58('0x11')]['message']);}logger[_0xef58('0x11')](_0xef58('0xd'),_0x5e5a8b,_0x191c80['error'][_0xef58('0x12')]);return _0x580dbd(_0x191c80[_0xef58('0x11')][_0xef58('0x12')]);}else{logger['info'](_0xef58('0xd'),_0x5e5a8b,_0xef58('0xe'));_0x580dbd(_0x191c80['result'][_0xef58('0x12')]);}})['catch'](function(_0x13066e){logger[_0xef58('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5e5a8b,_0x13066e);_0x2fc2a5(_0x13066e);});});} \ No newline at end of file +var _0x2137=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','moment'];(function(_0x261097,_0x3d0713){var _0x52831c=function(_0x1c1b25){while(--_0x1c1b25){_0x261097['push'](_0x261097['shift']());}};_0x52831c(++_0x3d0713);}(_0x2137,0x12f));var _0x7213=function(_0x1ba0e9,_0x33b418){_0x1ba0e9=_0x1ba0e9-0x0;var _0x72ae57=_0x2137[_0x1ba0e9];return _0x72ae57;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7213('0x0'));var BPromise=require(_0x7213('0x1'));var rs=require(_0x7213('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7213('0x3'))['db'];var utils=require(_0x7213('0x4'));var logger=require('../../config/logger')(_0x7213('0x5'));var config=require(_0x7213('0x6'));var jayson=require(_0x7213('0x7'));var client=jayson[_0x7213('0x8')][_0x7213('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e1d38,_0x288054,_0x327b9b){return new BPromise(function(_0x4916a4,_0x978ba6){return client['request'](_0x2e1d38,_0x327b9b)[_0x7213('0xa')](function(_0x2e4e20){logger['info'](_0x7213('0xb'),_0x288054,'request\x20sent');logger[_0x7213('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x288054,_0x7213('0xd'),JSON[_0x7213('0xe')](_0x2e4e20));if(_0x2e4e20[_0x7213('0xf')]){if(_0x2e4e20[_0x7213('0xf')][_0x7213('0x10')]===0x1f4){logger['error'](_0x7213('0xb'),_0x288054,_0x2e4e20[_0x7213('0xf')][_0x7213('0x11')]);return _0x978ba6(_0x2e4e20['error'][_0x7213('0x11')]);}logger[_0x7213('0xf')](_0x7213('0xb'),_0x288054,_0x2e4e20[_0x7213('0xf')][_0x7213('0x11')]);return _0x4916a4(_0x2e4e20['error'][_0x7213('0x11')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x288054,_0x7213('0xd'));_0x4916a4(_0x2e4e20['result'][_0x7213('0x11')]);}})[_0x7213('0x12')](function(_0x366420){logger[_0x7213('0xf')](_0x7213('0xb'),_0x288054,_0x366420);_0x978ba6(_0x366420);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 5cc9b01..c16b02f 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 _0x1907=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','create','put','delete','destroy'];(function(_0x118dab,_0x3413c9){var _0x4e30ba=function(_0x2c00f3){while(--_0x2c00f3){_0x118dab['push'](_0x118dab['shift']());}};_0x4e30ba(++_0x3413c9);}(_0x1907,0x1aa));var _0x7190=function(_0x428942,_0xab65b4){_0x428942=_0x428942-0x0;var _0x447c2d=_0x1907[_0x428942];return _0x447c2d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7190('0x0'));var timeout=require(_0x7190('0x1'));var express=require(_0x7190('0x2'));var router=express[_0x7190('0x3')]();var auth=require(_0x7190('0x4'));var interaction=require(_0x7190('0x5'));var config=require(_0x7190('0x6'));var controller=require(_0x7190('0x7'));router[_0x7190('0x8')]('/',auth['isAuthenticated'](),controller[_0x7190('0x9')]);router['get'](_0x7190('0xa'),auth[_0x7190('0xb')](),controller['show']);router['post']('/',auth[_0x7190('0xb')](),controller[_0x7190('0xc')]);router[_0x7190('0xd')](_0x7190('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x7190('0xe')](_0x7190('0xa'),auth['isAuthenticated'](),controller[_0x7190('0xf')]);module[_0x7190('0x10')]=router; \ No newline at end of file +var _0x7841=['index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0xf77280,_0x4622dd){var _0xf9cd93=function(_0x10ac4a){while(--_0x10ac4a){_0xf77280['push'](_0xf77280['shift']());}};_0xf9cd93(++_0x4622dd);}(_0x7841,0x145));var _0x1784=function(_0x58175c,_0x2d9373){_0x58175c=_0x58175c-0x0;var _0x55b88f=_0x7841[_0x58175c];return _0x55b88f;};'use strict';var multer=require(_0x1784('0x0'));var util=require(_0x1784('0x1'));var path=require(_0x1784('0x2'));var timeout=require(_0x1784('0x3'));var express=require(_0x1784('0x4'));var router=express['Router']();var auth=require(_0x1784('0x5'));var interaction=require(_0x1784('0x6'));var config=require(_0x1784('0x7'));var controller=require(_0x1784('0x8'));router[_0x1784('0x9')]('/',auth[_0x1784('0xa')](),controller[_0x1784('0xb')]);router['get']('/:id',auth[_0x1784('0xa')](),controller[_0x1784('0xc')]);router[_0x1784('0xd')]('/',auth[_0x1784('0xa')](),controller[_0x1784('0xe')]);router[_0x1784('0xf')](_0x1784('0x10'),auth[_0x1784('0xa')](),controller[_0x1784('0x11')]);router[_0x1784('0x12')](_0x1784('0x10'),auth['isAuthenticated'](),controller[_0x1784('0x13')]);module[_0x1784('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index d7e190a..5c059b7 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 _0x5da1=['variable','customVariable','STRING','ENUM','BOOLEAN','string'];(function(_0x39004e,_0x57831d){var _0x266b61=function(_0x55bc74){while(--_0x55bc74){_0x39004e['push'](_0x39004e['shift']());}};_0x266b61(++_0x57831d);}(_0x5da1,0xbf));var _0x15da=function(_0x479e9c,_0x136802){_0x479e9c=_0x479e9c-0x0;var _0x5c3f1c=_0x5da1[_0x479e9c];return _0x5c3f1c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x15da('0x0'),_0x15da('0x1'),_0x15da('0x2'),'keyValue'),'defaultValue':_0x15da('0x0')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x15da('0x3')]},'keyType':{'type':Sequelize[_0x15da('0x4')]('string',_0x15da('0x1'),_0x15da('0x2'))},'keyContent':{'type':Sequelize[_0x15da('0x3')]},'idField':{'type':Sequelize[_0x15da('0x3')]},'nameField':{'type':Sequelize[_0x15da('0x3')]},'customField':{'type':Sequelize[_0x15da('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x15da('0x3')]}}; \ No newline at end of file +var _0x6113=['variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x6113,0x1c8));var _0x3611=function(_0x21dce8,_0x14adba){_0x21dce8=_0x21dce8-0x0;var _0x34a5c9=_0x6113[_0x21dce8];return _0x34a5c9;};'use strict';var Sequelize=require(_0x3611('0x0'));module[_0x3611('0x1')]={'type':{'type':Sequelize[_0x3611('0x2')]('string',_0x3611('0x3'),_0x3611('0x4'),_0x3611('0x5')),'defaultValue':_0x3611('0x6')},'content':{'type':Sequelize[_0x3611('0x7')]},'key':{'type':Sequelize[_0x3611('0x7')]},'keyType':{'type':Sequelize[_0x3611('0x2')]('string',_0x3611('0x3'),_0x3611('0x4'))},'keyContent':{'type':Sequelize[_0x3611('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3611('0x7')]},'customField':{'type':Sequelize[_0x3611('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3611('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 94ca97d..ce5a02b 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 _0x25fa=['sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','name','index','SugarcrmField','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','update','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x1fbde3,_0x59da39){var _0x2b092f=function(_0x18bd24){while(--_0x18bd24){_0x1fbde3['push'](_0x1fbde3['shift']());}};_0x2b092f(++_0x59da39);}(_0x25fa,0x109));var _0xa25f=function(_0x56dd26,_0x8e37a4){_0x56dd26=_0x56dd26-0x0;var _0x5d77f4=_0x25fa[_0x56dd26];return _0x5d77f4;};'use strict';var pdf=require(_0xa25f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa25f('0x1'));var zipdir=require(_0xa25f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa25f('0x3'));var moment=require(_0xa25f('0x4'));var BPromise=require(_0xa25f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa25f('0x6'));var sox=require('sox');var csv=require(_0xa25f('0x7'));var ejs=require(_0xa25f('0x8'));var fs=require('fs');var _=require(_0xa25f('0x9'));var squel=require(_0xa25f('0xa'));var crypto=require(_0xa25f('0xb'));var jsforce=require(_0xa25f('0xc'));var deskjs=require(_0xa25f('0xd'));var toCsv=require(_0xa25f('0x7'));var querystring=require(_0xa25f('0xe'));var Papa=require('papaparse');var Redis=require(_0xa25f('0xf'));var authService=require(_0xa25f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa25f('0x11'));var hardwareService=require(_0xa25f('0x12'));var logger=require(_0xa25f('0x13'))(_0xa25f('0x14'));var utils=require('../../config/utils');var config=require(_0xa25f('0x15'));var licenseUtil=require(_0xa25f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e970c,_0x465e41){_0x465e41=_0x465e41||0xcc;return function(_0x50bb78){if(_0x50bb78){return _0x3e970c[_0xa25f('0x17')](_0x465e41);}return _0x3e970c[_0xa25f('0x18')](_0x465e41)[_0xa25f('0x19')]();};}function respondWithResult(_0x4b3792,_0x199e18){_0x199e18=_0x199e18||0xc8;return function(_0x2a627f){if(_0x2a627f){return _0x4b3792[_0xa25f('0x18')](_0x199e18)[_0xa25f('0x1a')](_0x2a627f);}};}function respondWithFilteredResult(_0x465809,_0x2d2417){return function(_0x1e5836){if(_0x1e5836){var _0x1859ba=_0x1e5836[_0xa25f('0x1b')],_0x57ada6=_0x2d2417[_0xa25f('0x1c')],_0x2d4f0f=_0x2d2417[_0xa25f('0x1c')]+_0x2d2417[_0xa25f('0x1d')],_0x471679;if(_0x2d4f0f>=_0x1859ba){_0x2d4f0f=_0x1859ba;_0x471679=0xc8;}else{_0x471679=0xce;}_0x465809['status'](_0x471679);return _0x465809[_0xa25f('0x1e')]('Content-Range',_0x57ada6+'-'+_0x2d4f0f+'/'+_0x1859ba)[_0xa25f('0x1a')](_0x1e5836);}return null;};}function patchUpdates(_0x562573){return function(_0x559c89){try{jsonpatch[_0xa25f('0x1f')](_0x559c89,_0x562573,!![]);}catch(_0x489c83){return BPromise[_0xa25f('0x20')](_0x489c83);}return _0x559c89[_0xa25f('0x21')]();};}function saveUpdates(_0x2aaf3a,_0x3c2665){return function(_0x21d035){if(_0x21d035){return _0x21d035['update'](_0x2aaf3a)[_0xa25f('0x22')](function(_0x3c1e3b){return _0x3c1e3b;});}return null;};}function removeEntity(_0x371716,_0x14b7f6){return function(_0x5d2803){if(_0x5d2803){return _0x5d2803[_0xa25f('0x23')]()[_0xa25f('0x22')](function(){_0x371716[_0xa25f('0x18')](0xcc)[_0xa25f('0x19')]();});}};}function handleEntityNotFound(_0x4c6f4d,_0x2b710f){return function(_0x906388){if(!_0x906388){_0x4c6f4d[_0xa25f('0x17')](0x194);}return _0x906388;};}function handleError(_0x317f0c,_0x5d93a9){_0x5d93a9=_0x5d93a9||0x1f4;return function(_0x2812d7){logger[_0xa25f('0x24')](_0x2812d7['stack']);if(_0x2812d7[_0xa25f('0x25')]){delete _0x2812d7['name'];}_0x317f0c[_0xa25f('0x18')](_0x5d93a9)['send'](_0x2812d7);};}exports[_0xa25f('0x26')]=function(_0x2448f4,_0x493de0){var _0xf6c928={},_0x1412b6={},_0x54d98c={'count':0x0,'rows':[]};var _0x471e7c=_['map'](db[_0xa25f('0x27')][_0xa25f('0x28')],function(_0x472114){return{'name':_0x472114[_0xa25f('0x29')],'type':_0x472114[_0xa25f('0x2a')]['key']};});_0x1412b6[_0xa25f('0x2b')]=_[_0xa25f('0x2c')](_0x471e7c,_0xa25f('0x25'));_0x1412b6[_0xa25f('0x2d')]=_[_0xa25f('0x2e')](_0x2448f4['query']);_0x1412b6[_0xa25f('0x2f')]=_[_0xa25f('0x30')](_0x1412b6[_0xa25f('0x2b')],_0x1412b6[_0xa25f('0x2d')]);_0xf6c928[_0xa25f('0x31')]=_[_0xa25f('0x30')](_0x1412b6[_0xa25f('0x2b')],qs[_0xa25f('0x32')](_0x2448f4[_0xa25f('0x2d')]['fields']));_0xf6c928['attributes']=_0xf6c928['attributes'][_0xa25f('0x33')]?_0xf6c928[_0xa25f('0x31')]:_0x1412b6[_0xa25f('0x2b')];if(!_0x2448f4[_0xa25f('0x2d')][_0xa25f('0x34')](_0xa25f('0x35'))){_0xf6c928[_0xa25f('0x1d')]=qs[_0xa25f('0x1d')](_0x2448f4[_0xa25f('0x2d')][_0xa25f('0x1d')]);_0xf6c928[_0xa25f('0x1c')]=qs['offset'](_0x2448f4['query'][_0xa25f('0x1c')]);}_0xf6c928[_0xa25f('0x36')]=qs[_0xa25f('0x37')](_0x2448f4['query']['sort']);_0xf6c928['where']=qs[_0xa25f('0x2f')](_[_0xa25f('0x38')](_0x2448f4[_0xa25f('0x2d')],_0x1412b6['filters']),_0x471e7c);if(_0x2448f4['query'][_0xa25f('0x39')]){_0xf6c928[_0xa25f('0x3a')]=_['merge'](_0xf6c928['where'],{'$or':_[_0xa25f('0x2c')](_0x471e7c,function(_0x33ad7a){if(_0x33ad7a[_0xa25f('0x2a')]!=='VIRTUAL'){var _0x151c4b={};_0x151c4b[_0x33ad7a[_0xa25f('0x25')]]={'$like':'%'+_0x2448f4[_0xa25f('0x2d')]['filter']+'%'};return _0x151c4b;}})});}_0xf6c928=_['merge']({},_0xf6c928,_0x2448f4[_0xa25f('0x3b')]);var _0x44c9c8={'where':_0xf6c928[_0xa25f('0x3a')]};return db[_0xa25f('0x27')][_0xa25f('0x1b')](_0x44c9c8)[_0xa25f('0x22')](function(_0x276fa6){_0x54d98c[_0xa25f('0x1b')]=_0x276fa6;if(_0x2448f4['query'][_0xa25f('0x3c')]){_0xf6c928[_0xa25f('0x3d')]=[{'all':!![]}];}return db[_0xa25f('0x27')][_0xa25f('0x3e')](_0xf6c928);})[_0xa25f('0x22')](function(_0xd285eb){_0x54d98c[_0xa25f('0x3f')]=_0xd285eb;return _0x54d98c;})[_0xa25f('0x22')](respondWithFilteredResult(_0x493de0,_0xf6c928))[_0xa25f('0x40')](handleError(_0x493de0,null));};exports[_0xa25f('0x41')]=function(_0xd91854,_0x3267a0){var _0x82ddbf={'raw':!![],'where':{'id':_0xd91854[_0xa25f('0x42')]['id']}},_0x593cee={};_0x593cee['model']=_[_0xa25f('0x2e')](db[_0xa25f('0x27')][_0xa25f('0x28')]);_0x593cee['query']=_[_0xa25f('0x2e')](_0xd91854[_0xa25f('0x2d')]);_0x593cee[_0xa25f('0x2f')]=_[_0xa25f('0x30')](_0x593cee['model'],_0x593cee[_0xa25f('0x2d')]);_0x82ddbf[_0xa25f('0x31')]=_[_0xa25f('0x30')](_0x593cee[_0xa25f('0x2b')],qs[_0xa25f('0x32')](_0xd91854[_0xa25f('0x2d')]['fields']));_0x82ddbf[_0xa25f('0x31')]=_0x82ddbf[_0xa25f('0x31')]['length']?_0x82ddbf[_0xa25f('0x31')]:_0x593cee[_0xa25f('0x2b')];if(_0xd91854[_0xa25f('0x2d')][_0xa25f('0x3c')]){_0x82ddbf[_0xa25f('0x3d')]=[{'all':!![]}];}_0x82ddbf=_[_0xa25f('0x43')]({},_0x82ddbf,_0xd91854[_0xa25f('0x3b')]);return db[_0xa25f('0x27')][_0xa25f('0x44')](_0x82ddbf)[_0xa25f('0x22')](handleEntityNotFound(_0x3267a0,null))[_0xa25f('0x22')](respondWithResult(_0x3267a0,null))[_0xa25f('0x40')](handleError(_0x3267a0,null));};exports[_0xa25f('0x45')]=function(_0x53a92a,_0x356a95){return db[_0xa25f('0x27')][_0xa25f('0x45')](_0x53a92a[_0xa25f('0x46')],{})['then'](respondWithResult(_0x356a95,0xc9))[_0xa25f('0x40')](handleError(_0x356a95,null));};exports[_0xa25f('0x47')]=function(_0x93cee1,_0x59e964){if(_0x93cee1[_0xa25f('0x46')]['id']){delete _0x93cee1[_0xa25f('0x46')]['id'];}return db[_0xa25f('0x27')][_0xa25f('0x44')]({'where':{'id':_0x93cee1[_0xa25f('0x42')]['id']}})[_0xa25f('0x22')](handleEntityNotFound(_0x59e964,null))[_0xa25f('0x22')](saveUpdates(_0x93cee1[_0xa25f('0x46')],null))['then'](respondWithResult(_0x59e964,null))[_0xa25f('0x40')](handleError(_0x59e964,null));};exports[_0xa25f('0x23')]=function(_0x3245e3,_0x16ae1c){return db[_0xa25f('0x27')][_0xa25f('0x44')]({'where':{'id':_0x3245e3[_0xa25f('0x42')]['id']}})[_0xa25f('0x22')](handleEntityNotFound(_0x16ae1c,null))[_0xa25f('0x22')](removeEntity(_0x16ae1c,null))[_0xa25f('0x40')](handleError(_0x16ae1c,null));}; \ No newline at end of file +var _0x27a0=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','Content-Range','json','apply','reject','update','then','destroy','error','name','send','index','rawAttributes','type','model','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','options','SugarcrmField','count','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x50ebd7,_0x4e2450){var _0x4bacee=function(_0x5a6a50){while(--_0x5a6a50){_0x50ebd7['push'](_0x50ebd7['shift']());}};_0x4bacee(++_0x4e2450);}(_0x27a0,0xbf));var _0x027a=function(_0x32d4c1,_0x307ac4){_0x32d4c1=_0x32d4c1-0x0;var _0x3939e1=_0x27a0[_0x32d4c1];return _0x3939e1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x027a('0x0'));var rimraf=require(_0x027a('0x1'));var zipdir=require(_0x027a('0x2'));var jsonpatch=require(_0x027a('0x3'));var rp=require(_0x027a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x027a('0x5'));var sox=require(_0x027a('0x6'));var csv=require(_0x027a('0x7'));var ejs=require(_0x027a('0x8'));var fs=require('fs');var _=require(_0x027a('0x9'));var squel=require(_0x027a('0xa'));var crypto=require('crypto');var jsforce=require(_0x027a('0xb'));var deskjs=require(_0x027a('0xc'));var toCsv=require(_0x027a('0x7'));var querystring=require('querystring');var Papa=require(_0x027a('0xd'));var Redis=require(_0x027a('0xe'));var authService=require(_0x027a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x027a('0x10'));var hardwareService=require(_0x027a('0x11'));var logger=require(_0x027a('0x12'))(_0x027a('0x13'));var utils=require(_0x027a('0x14'));var config=require(_0x027a('0x15'));var licenseUtil=require(_0x027a('0x16'));var db=require(_0x027a('0x17'))['db'];function respondWithStatusCode(_0x351d7e,_0x3e0c1e){_0x3e0c1e=_0x3e0c1e||0xcc;return function(_0x96a5c3){if(_0x96a5c3){return _0x351d7e['sendStatus'](_0x3e0c1e);}return _0x351d7e[_0x027a('0x18')](_0x3e0c1e)[_0x027a('0x19')]();};}function respondWithResult(_0x2d27f8,_0x21da53){_0x21da53=_0x21da53||0xc8;return function(_0x40fec0){if(_0x40fec0){return _0x2d27f8['status'](_0x21da53)['json'](_0x40fec0);}};}function respondWithFilteredResult(_0x1d680d,_0x5cfc6d){return function(_0x2b3870){if(_0x2b3870){var _0x559d13=_0x2b3870['count'],_0x432007=_0x5cfc6d[_0x027a('0x1a')],_0x5a1224=_0x5cfc6d[_0x027a('0x1a')]+_0x5cfc6d[_0x027a('0x1b')],_0x4dc3ab;if(_0x5a1224>=_0x559d13){_0x5a1224=_0x559d13;_0x4dc3ab=0xc8;}else{_0x4dc3ab=0xce;}_0x1d680d[_0x027a('0x18')](_0x4dc3ab);return _0x1d680d['set'](_0x027a('0x1c'),_0x432007+'-'+_0x5a1224+'/'+_0x559d13)[_0x027a('0x1d')](_0x2b3870);}return null;};}function patchUpdates(_0x4ad813){return function(_0x4f8c3d){try{jsonpatch[_0x027a('0x1e')](_0x4f8c3d,_0x4ad813,!![]);}catch(_0x57cf67){return BPromise[_0x027a('0x1f')](_0x57cf67);}return _0x4f8c3d['save']();};}function saveUpdates(_0x59511c,_0x58b129){return function(_0x4b4f90){if(_0x4b4f90){return _0x4b4f90[_0x027a('0x20')](_0x59511c)[_0x027a('0x21')](function(_0x266c9e){return _0x266c9e;});}return null;};}function removeEntity(_0xdf8756,_0x51b870){return function(_0x2fb1d0){if(_0x2fb1d0){return _0x2fb1d0[_0x027a('0x22')]()[_0x027a('0x21')](function(){_0xdf8756[_0x027a('0x18')](0xcc)[_0x027a('0x19')]();});}};}function handleEntityNotFound(_0x3bbd46,_0x595f0e){return function(_0x27741f){if(!_0x27741f){_0x3bbd46['sendStatus'](0x194);}return _0x27741f;};}function handleError(_0x3dd7ad,_0x2e97c5){_0x2e97c5=_0x2e97c5||0x1f4;return function(_0x1b1a13){logger[_0x027a('0x23')](_0x1b1a13['stack']);if(_0x1b1a13['name']){delete _0x1b1a13[_0x027a('0x24')];}_0x3dd7ad[_0x027a('0x18')](_0x2e97c5)[_0x027a('0x25')](_0x1b1a13);};}exports[_0x027a('0x26')]=function(_0x511c7a,_0x1b5325){var _0x55a8cd={},_0x953887={},_0x488920={'count':0x0,'rows':[]};var _0x2be389=_['map'](db['SugarcrmField'][_0x027a('0x27')],function(_0x5782ac){return{'name':_0x5782ac['fieldName'],'type':_0x5782ac[_0x027a('0x28')]['key']};});_0x953887[_0x027a('0x29')]=_['map'](_0x2be389,_0x027a('0x24'));_0x953887[_0x027a('0x2a')]=_['keys'](_0x511c7a[_0x027a('0x2a')]);_0x953887['filters']=_[_0x027a('0x2b')](_0x953887[_0x027a('0x29')],_0x953887[_0x027a('0x2a')]);_0x55a8cd[_0x027a('0x2c')]=_[_0x027a('0x2b')](_0x953887[_0x027a('0x29')],qs['fields'](_0x511c7a[_0x027a('0x2a')]['fields']));_0x55a8cd[_0x027a('0x2c')]=_0x55a8cd['attributes'][_0x027a('0x2d')]?_0x55a8cd[_0x027a('0x2c')]:_0x953887[_0x027a('0x29')];if(!_0x511c7a[_0x027a('0x2a')][_0x027a('0x2e')]('nolimit')){_0x55a8cd[_0x027a('0x1b')]=qs[_0x027a('0x1b')](_0x511c7a[_0x027a('0x2a')][_0x027a('0x1b')]);_0x55a8cd[_0x027a('0x1a')]=qs[_0x027a('0x1a')](_0x511c7a[_0x027a('0x2a')][_0x027a('0x1a')]);}_0x55a8cd[_0x027a('0x2f')]=qs[_0x027a('0x30')](_0x511c7a[_0x027a('0x2a')]['sort']);_0x55a8cd[_0x027a('0x31')]=qs[_0x027a('0x32')](_[_0x027a('0x33')](_0x511c7a[_0x027a('0x2a')],_0x953887[_0x027a('0x32')]),_0x2be389);if(_0x511c7a[_0x027a('0x2a')][_0x027a('0x34')]){_0x55a8cd['where']=_[_0x027a('0x35')](_0x55a8cd[_0x027a('0x31')],{'$or':_[_0x027a('0x36')](_0x2be389,function(_0x5e9130){if(_0x5e9130[_0x027a('0x28')]!=='VIRTUAL'){var _0x38469a={};_0x38469a[_0x5e9130[_0x027a('0x24')]]={'$like':'%'+_0x511c7a[_0x027a('0x2a')]['filter']+'%'};return _0x38469a;}})});}_0x55a8cd=_['merge']({},_0x55a8cd,_0x511c7a[_0x027a('0x37')]);var _0x2eea3b={'where':_0x55a8cd['where']};return db[_0x027a('0x38')][_0x027a('0x39')](_0x2eea3b)[_0x027a('0x21')](function(_0x1b173e){_0x488920[_0x027a('0x39')]=_0x1b173e;if(_0x511c7a[_0x027a('0x2a')][_0x027a('0x3a')]){_0x55a8cd[_0x027a('0x3b')]=[{'all':!![]}];}return db[_0x027a('0x38')][_0x027a('0x3c')](_0x55a8cd);})[_0x027a('0x21')](function(_0x12b20f){_0x488920[_0x027a('0x3d')]=_0x12b20f;return _0x488920;})[_0x027a('0x21')](respondWithFilteredResult(_0x1b5325,_0x55a8cd))[_0x027a('0x3e')](handleError(_0x1b5325,null));};exports[_0x027a('0x3f')]=function(_0x46685e,_0x5a3dee){var _0x275692={'raw':!![],'where':{'id':_0x46685e[_0x027a('0x40')]['id']}},_0x2c1d88={};_0x2c1d88[_0x027a('0x29')]=_[_0x027a('0x41')](db[_0x027a('0x38')]['rawAttributes']);_0x2c1d88[_0x027a('0x2a')]=_[_0x027a('0x41')](_0x46685e['query']);_0x2c1d88[_0x027a('0x32')]=_['intersection'](_0x2c1d88['model'],_0x2c1d88[_0x027a('0x2a')]);_0x275692['attributes']=_[_0x027a('0x2b')](_0x2c1d88[_0x027a('0x29')],qs[_0x027a('0x42')](_0x46685e[_0x027a('0x2a')][_0x027a('0x42')]));_0x275692['attributes']=_0x275692[_0x027a('0x2c')][_0x027a('0x2d')]?_0x275692[_0x027a('0x2c')]:_0x2c1d88['model'];if(_0x46685e['query']['includeAll']){_0x275692['include']=[{'all':!![]}];}_0x275692=_[_0x027a('0x35')]({},_0x275692,_0x46685e[_0x027a('0x37')]);return db[_0x027a('0x38')][_0x027a('0x43')](_0x275692)[_0x027a('0x21')](handleEntityNotFound(_0x5a3dee,null))[_0x027a('0x21')](respondWithResult(_0x5a3dee,null))['catch'](handleError(_0x5a3dee,null));};exports['create']=function(_0x2a9f24,_0x20eae6){return db[_0x027a('0x38')][_0x027a('0x44')](_0x2a9f24[_0x027a('0x45')],{})[_0x027a('0x21')](respondWithResult(_0x20eae6,0xc9))[_0x027a('0x3e')](handleError(_0x20eae6,null));};exports[_0x027a('0x20')]=function(_0x1fb7ee,_0x53b025){if(_0x1fb7ee[_0x027a('0x45')]['id']){delete _0x1fb7ee[_0x027a('0x45')]['id'];}return db[_0x027a('0x38')][_0x027a('0x43')]({'where':{'id':_0x1fb7ee[_0x027a('0x40')]['id']}})[_0x027a('0x21')](handleEntityNotFound(_0x53b025,null))[_0x027a('0x21')](saveUpdates(_0x1fb7ee[_0x027a('0x45')],null))['then'](respondWithResult(_0x53b025,null))[_0x027a('0x3e')](handleError(_0x53b025,null));};exports[_0x027a('0x22')]=function(_0x556b2b,_0x2a93c9){return db[_0x027a('0x38')]['find']({'where':{'id':_0x556b2b['params']['id']}})['then'](handleEntityNotFound(_0x2a93c9,null))[_0x027a('0x21')](removeEntity(_0x2a93c9,null))['catch'](handleError(_0x2a93c9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index a97c8d3..891d46f 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 _0xbf3d=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','idField','lodash','../../config/logger'];(function(_0x1be7f7,_0x8cc363){var _0x573179=function(_0x1e8044){while(--_0x1e8044){_0x1be7f7['push'](_0x1be7f7['shift']());}};_0x573179(++_0x8cc363);}(_0xbf3d,0xd6));var _0xdbf3=function(_0x1736e8,_0x386016){_0x1736e8=_0x1736e8-0x0;var _0x5d37ad=_0xbf3d[_0x1736e8];return _0x5d37ad;};'use strict';var _=require(_0xdbf3('0x0'));var util=require('util');var logger=require(_0xdbf3('0x1'))(_0xdbf3('0x2'));var moment=require(_0xdbf3('0x3'));var BPromise=require(_0xdbf3('0x4'));var rp=require(_0xdbf3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbf3('0x6'));var config=require(_0xdbf3('0x7'));var attributes=require(_0xdbf3('0x8'));module[_0xdbf3('0x9')]=function(_0x558af6,_0x32e328){return _0x558af6['define'](_0xdbf3('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xdbf3('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3f0=['api','path','rimraf','../../config/environment','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','util','../../config/logger'];(function(_0x14f132,_0x4cf31e){var _0x24bf39=function(_0x10ddad){while(--_0x10ddad){_0x14f132['push'](_0x14f132['shift']());}};_0x24bf39(++_0x4cf31e);}(_0xf3f0,0x127));var _0x0f3f=function(_0x1fd2d7,_0x29abdf){_0x1fd2d7=_0x1fd2d7-0x0;var _0x7d920=_0xf3f0[_0x1fd2d7];return _0x7d920;};'use strict';var _=require('lodash');var util=require(_0x0f3f('0x0'));var logger=require(_0x0f3f('0x1'))(_0x0f3f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f3f('0x3'));var rimraf=require(_0x0f3f('0x4'));var config=require(_0x0f3f('0x5'));var attributes=require('./intSugarcrmField.attributes');module[_0x0f3f('0x6')]=function(_0x29c284,_0x5d64d4){return _0x29c284[_0x0f3f('0x7')]('SugarcrmField',attributes,{'tableName':_0x0f3f('0x8'),'paranoid':![],'indexes':[{'name':_0x0f3f('0x9'),'fields':[_0x0f3f('0xa'),'FieldId'],'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 5a170f6..56f74c5 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x8c87a9,_0x448198){var _0x592e51=function(_0x4235fa){while(--_0x4235fa){_0x8c87a9['push'](_0x8c87a9['shift']());}};_0x592e51(++_0x448198);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x50fb86,_0x37dd39){var _0x10352a=function(_0x368dab){while(--_0x368dab){_0x50fb86['push'](_0x50fb86['shift']());}};_0x10352a(++_0x37dd39);}(_0x5f2f,0x73));var _0xf5f2=function(_0x397d80,_0x3c5761){_0x397d80=_0x397d80-0x0;var _0x423e5d=_0x5f2f[_0x397d80];return _0x423e5d;};'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')]('SugarcrmField,\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 diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 4984a92..2286ff7 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 _0xc3c5=['delete','exports','multer','util','path','express','Router','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update'];(function(_0x3e2c08,_0x5265ca){var _0x37e838=function(_0xb322ea){while(--_0xb322ea){_0x3e2c08['push'](_0x3e2c08['shift']());}};_0x37e838(++_0x5265ca);}(_0xc3c5,0x189));var _0x5c3c=function(_0x341980,_0x41ff49){_0x341980=_0x341980-0x0;var _0x568d59=_0xc3c5[_0x341980];return _0x568d59;};'use strict';var multer=require(_0x5c3c('0x0'));var util=require(_0x5c3c('0x1'));var path=require(_0x5c3c('0x2'));var timeout=require('connect-timeout');var express=require(_0x5c3c('0x3'));var router=express[_0x5c3c('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5c3c('0x5'));var controller=require(_0x5c3c('0x6'));router[_0x5c3c('0x7')]('/',auth[_0x5c3c('0x8')](),controller[_0x5c3c('0x9')]);router['get']('/:id',auth[_0x5c3c('0x8')](),controller[_0x5c3c('0xa')]);router[_0x5c3c('0x7')](_0x5c3c('0xb'),auth[_0x5c3c('0x8')](),controller[_0x5c3c('0xc')]);router[_0x5c3c('0x7')](_0x5c3c('0xd'),auth[_0x5c3c('0x8')](),controller[_0x5c3c('0xe')]);router[_0x5c3c('0xf')]('/',auth[_0x5c3c('0x8')](),controller[_0x5c3c('0x10')]);router[_0x5c3c('0xf')]('/:id/configurations',auth[_0x5c3c('0x8')](),controller[_0x5c3c('0x11')]);router[_0x5c3c('0x12')](_0x5c3c('0x13'),auth[_0x5c3c('0x8')](),controller[_0x5c3c('0x14')]);router[_0x5c3c('0x15')](_0x5c3c('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x5c3c('0x16')]=router; \ No newline at end of file +var _0x8cae=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','destroy','exports','multer','util'];(function(_0x305efe,_0x330908){var _0x9d93d=function(_0x26a38f){while(--_0x26a38f){_0x305efe['push'](_0x305efe['shift']());}};_0x9d93d(++_0x330908);}(_0x8cae,0x143));var _0xe8ca=function(_0x5a372a,_0x228f71){_0x5a372a=_0x5a372a-0x0;var _0x26b021=_0x8cae[_0x5a372a];return _0x26b021;};'use strict';var multer=require(_0xe8ca('0x0'));var util=require(_0xe8ca('0x1'));var path=require(_0xe8ca('0x2'));var timeout=require(_0xe8ca('0x3'));var express=require(_0xe8ca('0x4'));var router=express[_0xe8ca('0x5')]();var auth=require(_0xe8ca('0x6'));var interaction=require(_0xe8ca('0x7'));var config=require('../../config/environment');var controller=require(_0xe8ca('0x8'));router['get']('/',auth[_0xe8ca('0x9')](),controller[_0xe8ca('0xa')]);router[_0xe8ca('0xb')](_0xe8ca('0xc'),auth['isAuthenticated'](),controller[_0xe8ca('0xd')]);router['get']('/:id/configurations',auth[_0xe8ca('0x9')](),controller[_0xe8ca('0xe')]);router['get'](_0xe8ca('0xf'),auth['isAuthenticated'](),controller[_0xe8ca('0x10')]);router[_0xe8ca('0x11')]('/',auth['isAuthenticated'](),controller[_0xe8ca('0x12')]);router[_0xe8ca('0x11')](_0xe8ca('0x13'),auth[_0xe8ca('0x9')](),controller[_0xe8ca('0x14')]);router[_0xe8ca('0x15')](_0xe8ca('0xc'),auth[_0xe8ca('0x9')](),controller[_0xe8ca('0x16')]);router['delete'](_0xe8ca('0xc'),auth[_0xe8ca('0x9')](),controller[_0xe8ca('0x17')]);module[_0xe8ca('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 02cba68..c030f41 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 _0x6657=['STRING','sequelize'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x6657,0x17f));var _0x7665=function(_0x4c76ad,_0x24bdab){_0x4c76ad=_0x4c76ad-0x0;var _0xde0a18=_0x6657[_0x4c76ad];return _0xde0a18;};'use strict';var Sequelize=require(_0x7665('0x0'));module['exports']={'name':{'type':Sequelize[_0x7665('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7665('0x1')]},'username':{'type':Sequelize[_0x7665('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7665('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x7665('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7665('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7665('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7fef=['STRING','HelpDesk','sequelize'];(function(_0x236770,_0x8553){var _0x521ffd=function(_0x17867f){while(--_0x17867f){_0x236770['push'](_0x236770['shift']());}};_0x521ffd(++_0x8553);}(_0x7fef,0x110));var _0xf7fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7fef[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf7fe('0x0'));module['exports']={'name':{'type':Sequelize[_0xf7fe('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf7fe('0x2')},'remoteUri':{'type':Sequelize[_0xf7fe('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xf7fe('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 03f57d3..a22407c 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 _0xe02c=['getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','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','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','destroy','getConfigurations','findOne','order','options','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerConfiguration','VtigerField','Descriptions','md5','description','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','getchallenge','success','POST','login','token','describe','sessionName','autogenerated','reference','owner','remove','editable','label','picklist','picklistValues','log','vTiger\x20error:\x20','test'];(function(_0x327f15,_0x81c005){var _0x305edd=function(_0x546dcd){while(--_0x546dcd){_0x327f15['push'](_0x327f15['shift']());}};_0x305edd(++_0x81c005);}(_0xe02c,0x81));var _0xce02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe02c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xce02('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xce02('0x1'));var rp=require(_0xce02('0x2'));var moment=require(_0xce02('0x3'));var BPromise=require(_0xce02('0x4'));var Mustache=require(_0xce02('0x5'));var util=require(_0xce02('0x6'));var path=require(_0xce02('0x7'));var sox=require(_0xce02('0x8'));var csv=require('to-csv');var ejs=require(_0xce02('0x9'));var fs=require('fs');var _=require(_0xce02('0xa'));var squel=require(_0xce02('0xb'));var crypto=require(_0xce02('0xc'));var jsforce=require(_0xce02('0xd'));var deskjs=require(_0xce02('0xe'));var toCsv=require(_0xce02('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xce02('0x10'));var authService=require(_0xce02('0x11'));var qs=require(_0xce02('0x12'));var as=require(_0xce02('0x13'));var hardwareService=require(_0xce02('0x14'));var logger=require(_0xce02('0x15'))('api');var utils=require(_0xce02('0x16'));var config=require(_0xce02('0x17'));var licenseUtil=require(_0xce02('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xce02('0x19'));var jayson=require(_0xce02('0x1a'));var client=jayson[_0xce02('0x1b')][_0xce02('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x17a6e3,_0x2ae50c,_0x5c9d19,_0x140c15){return new BPromise(function(_0x462762,_0x2a9403){var _0x335d8d=_0x140c15||client;return _0x335d8d['request'](_0x17a6e3,_0x5c9d19)[_0xce02('0x1d')](function(_0x4544f5){logger[_0xce02('0x1e')](_0xce02('0x1f'),_0x2ae50c,_0xce02('0x20'));logger[_0xce02('0x21')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x2ae50c,'request\x20sent',JSON[_0xce02('0x22')](_0x4544f5));if(_0x4544f5[_0xce02('0x23')]){if(_0x4544f5[_0xce02('0x23')]['code']===0x1f4){logger['error'](_0xce02('0x1f'),_0x2ae50c,_0x4544f5[_0xce02('0x23')]['message']);return _0x2a9403(_0x4544f5[_0xce02('0x23')][_0xce02('0x24')]);}logger[_0xce02('0x23')]('VtigerAccount,\x20%s,\x20%s',_0x2ae50c,_0x4544f5[_0xce02('0x23')][_0xce02('0x24')]);return _0x462762(_0x4544f5[_0xce02('0x23')][_0xce02('0x24')]);}else{logger[_0xce02('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0x2ae50c,'request\x20sent');_0x462762(_0x4544f5[_0xce02('0x25')][_0xce02('0x24')]);}})['catch'](function(_0x838409){logger['error'](_0xce02('0x1f'),_0x2ae50c,_0x838409);_0x2a9403(_0x838409);});});}function respondWithStatusCode(_0x6f7c78,_0x2f30f1){_0x2f30f1=_0x2f30f1||0xcc;return function(_0x4efa13){if(_0x4efa13){return _0x6f7c78[_0xce02('0x26')](_0x2f30f1);}return _0x6f7c78['status'](_0x2f30f1)[_0xce02('0x27')]();};}function respondWithResult(_0x255a18,_0x46db1d){_0x46db1d=_0x46db1d||0xc8;return function(_0x29de8a){if(_0x29de8a){return _0x255a18[_0xce02('0x28')](_0x46db1d)[_0xce02('0x29')](_0x29de8a);}};}function respondWithFilteredResult(_0x2ce794,_0x1e099b){return function(_0x1f9c99){if(_0x1f9c99){var _0x5e70d7=_0x1f9c99['count'],_0x41591b=_0x1e099b[_0xce02('0x2a')],_0x37e6ac=_0x1e099b[_0xce02('0x2a')]+_0x1e099b[_0xce02('0x2b')],_0x3cbbec;if(_0x37e6ac>=_0x5e70d7){_0x37e6ac=_0x5e70d7;_0x3cbbec=0xc8;}else{_0x3cbbec=0xce;}_0x2ce794['status'](_0x3cbbec);return _0x2ce794['set'](_0xce02('0x2c'),_0x41591b+'-'+_0x37e6ac+'/'+_0x5e70d7)[_0xce02('0x29')](_0x1f9c99);}return null;};}function patchUpdates(_0x37f395){return function(_0xc8b041){try{jsonpatch[_0xce02('0x2d')](_0xc8b041,_0x37f395,!![]);}catch(_0x5a92d1){return BPromise[_0xce02('0x2e')](_0x5a92d1);}return _0xc8b041[_0xce02('0x2f')]();};}function saveUpdates(_0x2f0dad,_0x3fa8ae){return function(_0x1e9920){if(_0x1e9920){return _0x1e9920['update'](_0x2f0dad)[_0xce02('0x1d')](function(_0x1e3623){return _0x1e3623;});}return null;};}function removeEntity(_0x294f43,_0x268402){return function(_0x3da607){if(_0x3da607){return _0x3da607['destroy']()[_0xce02('0x1d')](function(){_0x294f43[_0xce02('0x28')](0xcc)[_0xce02('0x27')]();});}};}function handleEntityNotFound(_0x546444,_0x174c08){return function(_0x525692){if(!_0x525692){_0x546444[_0xce02('0x26')](0x194);}return _0x525692;};}function handleError(_0x3e700e,_0x52ff44){_0x52ff44=_0x52ff44||0x1f4;return function(_0x7b8aa7){logger[_0xce02('0x23')](_0x7b8aa7[_0xce02('0x30')]);if(_0x7b8aa7[_0xce02('0x31')]){delete _0x7b8aa7['name'];}_0x3e700e[_0xce02('0x28')](_0x52ff44)[_0xce02('0x32')](_0x7b8aa7);};}exports[_0xce02('0x33')]=function(_0x55869b,_0x50be6f){var _0x52548d={},_0x167bda={},_0x2e0376={'count':0x0,'rows':[]};var _0xfdd65e=_[_0xce02('0x34')](db[_0xce02('0x35')][_0xce02('0x36')],function(_0x2b5f80){return{'name':_0x2b5f80[_0xce02('0x37')],'type':_0x2b5f80['type'][_0xce02('0x38')]};});_0x167bda['model']=_['map'](_0xfdd65e,_0xce02('0x31'));_0x167bda[_0xce02('0x39')]=_[_0xce02('0x3a')](_0x55869b[_0xce02('0x39')]);_0x167bda['filters']=_[_0xce02('0x3b')](_0x167bda['model'],_0x167bda[_0xce02('0x39')]);_0x52548d[_0xce02('0x3c')]=_[_0xce02('0x3b')](_0x167bda[_0xce02('0x3d')],qs[_0xce02('0x3e')](_0x55869b[_0xce02('0x39')][_0xce02('0x3e')]));_0x52548d[_0xce02('0x3c')]=_0x52548d['attributes']['length']?_0x52548d[_0xce02('0x3c')]:_0x167bda[_0xce02('0x3d')];if(!_0x55869b[_0xce02('0x39')][_0xce02('0x3f')]('nolimit')){_0x52548d[_0xce02('0x2b')]=qs['limit'](_0x55869b[_0xce02('0x39')][_0xce02('0x2b')]);_0x52548d[_0xce02('0x2a')]=qs[_0xce02('0x2a')](_0x55869b[_0xce02('0x39')]['offset']);}_0x52548d['order']=qs['sort'](_0x55869b[_0xce02('0x39')][_0xce02('0x40')]);_0x52548d[_0xce02('0x41')]=qs[_0xce02('0x42')](_[_0xce02('0x43')](_0x55869b[_0xce02('0x39')],_0x167bda[_0xce02('0x42')]),_0xfdd65e);if(_0x55869b[_0xce02('0x39')][_0xce02('0x44')]){_0x52548d['where']=_[_0xce02('0x45')](_0x52548d[_0xce02('0x41')],{'$or':_['map'](_0xfdd65e,function(_0x5e8acf){if(_0x5e8acf[_0xce02('0x46')]!=='VIRTUAL'){var _0xde83a={};_0xde83a[_0x5e8acf[_0xce02('0x31')]]={'$like':'%'+_0x55869b[_0xce02('0x39')][_0xce02('0x44')]+'%'};return _0xde83a;}})});}_0x52548d=_[_0xce02('0x45')]({},_0x52548d,_0x55869b['options']);var _0x4a06ca={'where':_0x52548d['where']};return db[_0xce02('0x35')]['count'](_0x4a06ca)[_0xce02('0x1d')](function(_0x5dc178){_0x2e0376['count']=_0x5dc178;if(_0x55869b['query'][_0xce02('0x47')]){_0x52548d[_0xce02('0x48')]=[{'all':!![]}];}return db['VtigerAccount'][_0xce02('0x49')](_0x52548d);})['then'](function(_0x1c84d4){_0x2e0376[_0xce02('0x4a')]=_0x1c84d4;return _0x2e0376;})[_0xce02('0x1d')](respondWithFilteredResult(_0x50be6f,_0x52548d))[_0xce02('0x4b')](handleError(_0x50be6f,null));};exports[_0xce02('0x4c')]=function(_0xf80cf3,_0x1aa67){var _0x53094e={'raw':![],'where':{'id':_0xf80cf3[_0xce02('0x4d')]['id']}},_0x4dcdd7={};_0x4dcdd7[_0xce02('0x3d')]=_['keys'](db['VtigerAccount'][_0xce02('0x36')]);_0x4dcdd7[_0xce02('0x39')]=_[_0xce02('0x3a')](_0xf80cf3[_0xce02('0x39')]);_0x4dcdd7[_0xce02('0x42')]=_[_0xce02('0x3b')](_0x4dcdd7['model'],_0x4dcdd7[_0xce02('0x39')]);_0x53094e[_0xce02('0x3c')]=_[_0xce02('0x3b')](_0x4dcdd7[_0xce02('0x3d')],qs[_0xce02('0x3e')](_0xf80cf3[_0xce02('0x39')][_0xce02('0x3e')]));_0x53094e[_0xce02('0x3c')]=_0x53094e['attributes'][_0xce02('0x4e')]?_0x53094e['attributes']:_0x4dcdd7[_0xce02('0x3d')];if(_0xf80cf3['query']['includeAll']){_0x53094e[_0xce02('0x48')]=[{'all':!![]}];}_0x53094e=_['merge']({},_0x53094e,_0xf80cf3['options']);return db[_0xce02('0x35')][_0xce02('0x4f')](_0x53094e)[_0xce02('0x1d')](handleEntityNotFound(_0x1aa67,null))[_0xce02('0x1d')](respondWithResult(_0x1aa67,null))[_0xce02('0x4b')](handleError(_0x1aa67,null));};exports['create']=function(_0xfacc26,_0x466a24){return db[_0xce02('0x35')][_0xce02('0x50')](_0xfacc26[_0xce02('0x51')],{})[_0xce02('0x1d')](respondWithResult(_0x466a24,0xc9))[_0xce02('0x4b')](handleError(_0x466a24,null));};exports[_0xce02('0x52')]=function(_0x2ae7e2,_0x16ec1f){if(_0x2ae7e2[_0xce02('0x51')]['id']){delete _0x2ae7e2['body']['id'];}return db[_0xce02('0x35')][_0xce02('0x4f')]({'where':{'id':_0x2ae7e2[_0xce02('0x4d')]['id']}})[_0xce02('0x1d')](handleEntityNotFound(_0x16ec1f,null))[_0xce02('0x1d')](saveUpdates(_0x2ae7e2['body'],null))[_0xce02('0x1d')](respondWithResult(_0x16ec1f,null))[_0xce02('0x4b')](handleError(_0x16ec1f,null));};exports[_0xce02('0x53')]=function(_0x59cf68,_0x1f10d6){return db[_0xce02('0x35')]['find']({'where':{'id':_0x59cf68[_0xce02('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1f10d6,null))[_0xce02('0x1d')](removeEntity(_0x1f10d6,null))[_0xce02('0x4b')](handleError(_0x1f10d6,null));};exports[_0xce02('0x54')]=function(_0x43d500,_0x2d72cf,_0x2b62f9){var _0x23b39a={};var _0x4e6935={};var _0x153f7e;var _0x58660a;return db[_0xce02('0x35')][_0xce02('0x55')]({'where':{'id':_0x43d500['params']['id']}})['then'](handleEntityNotFound(_0x2d72cf,null))[_0xce02('0x1d')](function(_0x15aa63){if(_0x15aa63){_0x153f7e=_0x15aa63;_0x4e6935[_0xce02('0x3d')]=_[_0xce02('0x3a')](db['VtigerConfiguration'][_0xce02('0x36')]);_0x4e6935['query']=_['keys'](_0x43d500[_0xce02('0x39')]);_0x4e6935[_0xce02('0x42')]=_[_0xce02('0x3b')](_0x4e6935['model'],_0x4e6935['query']);_0x23b39a[_0xce02('0x3c')]=_[_0xce02('0x3b')](_0x4e6935['model'],qs[_0xce02('0x3e')](_0x43d500['query']['fields']));_0x23b39a[_0xce02('0x3c')]=_0x23b39a[_0xce02('0x3c')][_0xce02('0x4e')]?_0x23b39a['attributes']:_0x4e6935[_0xce02('0x3d')];_0x23b39a[_0xce02('0x56')]=qs[_0xce02('0x40')](_0x43d500['query'][_0xce02('0x40')]);_0x23b39a[_0xce02('0x41')]=qs[_0xce02('0x42')](_[_0xce02('0x43')](_0x43d500[_0xce02('0x39')],_0x4e6935[_0xce02('0x42')]));if(_0x43d500['query']['filter']){_0x23b39a[_0xce02('0x41')]=_[_0xce02('0x45')](_0x23b39a['where'],{'$or':_[_0xce02('0x34')](_0x23b39a[_0xce02('0x3c')],function(_0x48f2a1){var _0x203171={};_0x203171[_0x48f2a1]={'$like':'%'+_0x43d500[_0xce02('0x39')][_0xce02('0x44')]+'%'};return _0x203171;})});}_0x23b39a=_[_0xce02('0x45')]({},_0x23b39a,_0x43d500[_0xce02('0x57')]);return _0x153f7e['getConfigurations'](_0x23b39a);}})['then'](function(_0x2935b8){if(_0x2935b8){_0x58660a=_0x2935b8['length'];if(!_0x43d500[_0xce02('0x39')][_0xce02('0x3f')]('nolimit')){_0x23b39a[_0xce02('0x2b')]=qs[_0xce02('0x2b')](_0x43d500['query']['limit']);_0x23b39a[_0xce02('0x2a')]=qs['offset'](_0x43d500['query'][_0xce02('0x2a')]);}return _0x153f7e['getConfigurations'](_0x23b39a);}})[_0xce02('0x1d')](function(_0x3b8e3f){if(_0x3b8e3f){return _0x3b8e3f?{'count':_0x58660a,'rows':_0x3b8e3f}:null;}})[_0xce02('0x1d')](respondWithResult(_0x2d72cf,null))[_0xce02('0x4b')](handleError(_0x2d72cf,null));};exports[_0xce02('0x58')]=function(_0x57b400,_0x2227be,_0x2dfdc8){if(_0x57b400[_0xce02('0x51')]['id']){delete _0x57b400[_0xce02('0x51')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x57b400[_0xce02('0x4d')]['id']}})[_0xce02('0x1d')](handleEntityNotFound(_0x2227be,null))[_0xce02('0x1d')](function(_0xf51df3){if(_0xf51df3){_0x57b400[_0xce02('0x51')][_0xce02('0x59')]=_0xf51df3['id'];_0x57b400['body'][_0xce02('0x5a')]=integrations[_0xce02('0x5b')](_0x57b400['body'][_0xce02('0x5c')],_0x57b400[_0xce02('0x51')][_0xce02('0x46')]);_0x57b400['body']['Descriptions']=integrations[_0xce02('0x5d')](_0x57b400[_0xce02('0x51')][_0xce02('0x5c')],_0x57b400[_0xce02('0x51')][_0xce02('0x46')]);return db[_0xce02('0x5e')][_0xce02('0x50')](_0x57b400[_0xce02('0x51')],{'include':[{'model':db['VtigerField'],'as':_0xce02('0x5a')},{'model':db[_0xce02('0x5f')],'as':_0xce02('0x60')}]});}return null;})[_0xce02('0x1d')](respondWithResult(_0x2227be,null))[_0xce02('0x4b')](handleError(_0x2227be,null));};var md5=require(_0xce02('0x61'));exports['getFields']=function(_0x55e54d,_0xf3cd58,_0x2dbc62){var _0x415be3=null;var _0x3948c8=null;var _0x583b37=null;var _0x5e137d=null;var _0x2ab307='';return db[_0xce02('0x35')][_0xce02('0x55')]({'where':{'id':_0x55e54d[_0xce02('0x4d')]['id']},'attributes':['id','name','username',_0xce02('0x62'),'moduleName',_0xce02('0x63'),_0xce02('0x64'),_0xce02('0x65')]})[_0xce02('0x1d')](handleEntityNotFound(_0xf3cd58,null))[_0xce02('0x1d')](function(_0x542990){if(_0x542990){_0x415be3=_0x542990[_0xce02('0x66')];_0x3948c8=_0x542990['accessKey'];_0x583b37=_0x542990['moduleName'];_0x2ab307=_0x542990[_0xce02('0x63')];var _0x12ff6a=_0x2ab307[_0xce02('0x67')](-0x1);if(_0x12ff6a==='/'){_0x2ab307=_0x2ab307[_0xce02('0x68')](0x0,_0x2ab307[_0xce02('0x69')](_0x12ff6a));}_0x5e137d=util[_0xce02('0x6a')]('%s/webservice.php',_0x2ab307);var _0x120934={'method':'GET','uri':_0x5e137d,'qs':{'operation':_0xce02('0x6b'),'username':_0x542990[_0xce02('0x66')]},'json':!![]};return rp(_0x120934);}})[_0xce02('0x1d')](function(_0x1bbb12){if(_0x1bbb12[_0xce02('0x6c')]){var _0x5ee7a4={'method':_0xce02('0x6d'),'uri':_0x5e137d,'form':{'operation':_0xce02('0x6e'),'username':_0x415be3,'accessKey':md5(_0x1bbb12[_0xce02('0x25')][_0xce02('0x6f')]+_0x3948c8)},'json':!![]};return rp(_0x5ee7a4);}})[_0xce02('0x1d')](function(_0x2b60d9){if(_0x2b60d9['success']){var _0x3251c0={'method':'GET','uri':_0x5e137d,'qs':{'operation':_0xce02('0x70'),'username':_0x415be3,'sessionName':_0x2b60d9[_0xce02('0x25')][_0xce02('0x71')],'elementType':_0x583b37},'json':!![]};return rp(_0x3251c0);}})[_0xce02('0x1d')](function(_0x371d7e){if(_0x371d7e[_0xce02('0x6c')]){var _0x283edb=[_0xce02('0x72'),_0xce02('0x73'),_0xce02('0x74')];_['remove'](_0x371d7e['result'][_0xce02('0x3e')],function(_0x9c8d31){return _0x283edb['includes'](_0x9c8d31[_0xce02('0x46')]['name']);});_[_0xce02('0x75')](_0x371d7e[_0xce02('0x25')][_0xce02('0x3e')],function(_0x5a0a0d){return _0x5a0a0d[_0xce02('0x76')]==='false';});return{'count':_0x371d7e[_0xce02('0x25')][_0xce02('0x3e')][_0xce02('0x4e')],'rows':_[_0xce02('0x34')](_0x371d7e[_0xce02('0x25')]['fields'],function(_0x149ff6){return{'id':_0x149ff6[_0xce02('0x31')],'name':_0x149ff6[_0xce02('0x77')],'custom':_['startsWith'](_0x149ff6[_0xce02('0x31')],'cf_')?!![]:![],'options':_0x149ff6[_0xce02('0x46')][_0xce02('0x31')]===_0xce02('0x78')&&_0x149ff6['type'][_0xce02('0x79')][_0xce02('0x4e')]>0x0?_['map'](_0x149ff6[_0xce02('0x46')][_0xce02('0x79')],function(_0x27ed26){return{'name':_0x27ed26[_0xce02('0x77')],'value':_0x27ed26['value']};}):[]};})};}})[_0xce02('0x1d')](respondWithResult(_0xf3cd58,null))['catch'](function(_0xc617c7){console[_0xce02('0x7a')](_0xce02('0x7b')+_0xc617c7);var _0x4761d1=_0x55e54d[_0xce02('0x39')][_0xce02('0x7c')]?0x1f4:_0xc617c7['statusCode']||0x1f4;logger[_0xce02('0x23')](_0xce02('0x7d'),'getFields',_0x4761d1,JSON[_0xce02('0x22')](_0xc617c7));delete _0xc617c7['name'];if(_0x4761d1===0x191){_0x4761d1=0x190;}_0xf3cd58[_0xce02('0x28')](_0x4761d1)[_0xce02('0x32')](_0x55e54d[_0xce02('0x39')][_0xce02('0x7c')]?{'message':_0xce02('0x7e'),'statusCode':_0xc617c7['statusCode']}:_0xc617c7);});}; \ No newline at end of file +var _0xe647=['papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','client','http','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','map','VtigerAccount','rawAttributes','fieldName','type','key','query','keys','filters','fields','attributes','length','model','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','findOne','VtigerConfiguration','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','VtigerField','md5','username','description','moduleName','remoteUri','accessKey','slice','lastIndexOf','%s/webservice.php','POST','login','success','describe','sessionName','autogenerated','reference','remove','includes','editable','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields','stringify','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x520e49,_0x4c4d70){var _0x549d48=function(_0x32fd25){while(--_0x32fd25){_0x520e49['push'](_0x520e49['shift']());}};_0x549d48(++_0x4c4d70);}(_0xe647,0x16d));var _0x7e64=function(_0x493146,_0x3a2ba){_0x493146=_0x493146-0x0;var _0x4cedb6=_0xe647[_0x493146];return _0x4cedb6;};'use strict';var pdf=require(_0x7e64('0x0'));var emlformat=require(_0x7e64('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7e64('0x2'));var jsonpatch=require(_0x7e64('0x3'));var rp=require(_0x7e64('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7e64('0x5'));var util=require(_0x7e64('0x6'));var path=require(_0x7e64('0x7'));var sox=require(_0x7e64('0x8'));var csv=require(_0x7e64('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7e64('0xa'));var squel=require(_0x7e64('0xb'));var crypto=require(_0x7e64('0xc'));var jsforce=require(_0x7e64('0xd'));var deskjs=require(_0x7e64('0xe'));var toCsv=require(_0x7e64('0x9'));var querystring=require(_0x7e64('0xf'));var Papa=require(_0x7e64('0x10'));var Redis=require(_0x7e64('0x11'));var authService=require(_0x7e64('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e64('0x13'))(_0x7e64('0x14'));var utils=require(_0x7e64('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7e64('0x16'));var db=require(_0x7e64('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x7e64('0x18')][_0x7e64('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2b223c,_0x46284e,_0x5a24f0,_0x4af048){return new BPromise(function(_0x26d64b,_0x2e0e7f){var _0x47e201=_0x4af048||client;return _0x47e201[_0x7e64('0x1a')](_0x2b223c,_0x5a24f0)[_0x7e64('0x1b')](function(_0x30de16){logger['info'](_0x7e64('0x1c'),_0x46284e,'request\x20sent');logger[_0x7e64('0x1d')](_0x7e64('0x1e'),_0x46284e,_0x7e64('0x1f'),JSON['stringify'](_0x30de16));if(_0x30de16['error']){if(_0x30de16[_0x7e64('0x20')][_0x7e64('0x21')]===0x1f4){logger[_0x7e64('0x20')](_0x7e64('0x1c'),_0x46284e,_0x30de16['error'][_0x7e64('0x22')]);return _0x2e0e7f(_0x30de16['error'][_0x7e64('0x22')]);}logger[_0x7e64('0x20')](_0x7e64('0x1c'),_0x46284e,_0x30de16[_0x7e64('0x20')][_0x7e64('0x22')]);return _0x26d64b(_0x30de16[_0x7e64('0x20')][_0x7e64('0x22')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x46284e,_0x7e64('0x1f'));_0x26d64b(_0x30de16[_0x7e64('0x23')][_0x7e64('0x22')]);}})['catch'](function(_0x27b9ab){logger[_0x7e64('0x20')]('VtigerAccount,\x20%s,\x20%s',_0x46284e,_0x27b9ab);_0x2e0e7f(_0x27b9ab);});});}function respondWithStatusCode(_0x525f72,_0x292b5c){_0x292b5c=_0x292b5c||0xcc;return function(_0x4b2b1e){if(_0x4b2b1e){return _0x525f72['sendStatus'](_0x292b5c);}return _0x525f72[_0x7e64('0x24')](_0x292b5c)[_0x7e64('0x25')]();};}function respondWithResult(_0x5d16ad,_0x46a53c){_0x46a53c=_0x46a53c||0xc8;return function(_0xabf947){if(_0xabf947){return _0x5d16ad[_0x7e64('0x24')](_0x46a53c)[_0x7e64('0x26')](_0xabf947);}};}function respondWithFilteredResult(_0x2c1be6,_0x8a743e){return function(_0x1e0e52){if(_0x1e0e52){var _0x5324e0=_0x1e0e52[_0x7e64('0x27')],_0x42d6dc=_0x8a743e[_0x7e64('0x28')],_0x5e0fe1=_0x8a743e[_0x7e64('0x28')]+_0x8a743e['limit'],_0x5de7c7;if(_0x5e0fe1>=_0x5324e0){_0x5e0fe1=_0x5324e0;_0x5de7c7=0xc8;}else{_0x5de7c7=0xce;}_0x2c1be6['status'](_0x5de7c7);return _0x2c1be6[_0x7e64('0x29')](_0x7e64('0x2a'),_0x42d6dc+'-'+_0x5e0fe1+'/'+_0x5324e0)[_0x7e64('0x26')](_0x1e0e52);}return null;};}function patchUpdates(_0x232a3c){return function(_0x1d9f75){try{jsonpatch[_0x7e64('0x2b')](_0x1d9f75,_0x232a3c,!![]);}catch(_0x12c6ac){return BPromise[_0x7e64('0x2c')](_0x12c6ac);}return _0x1d9f75[_0x7e64('0x2d')]();};}function saveUpdates(_0x4d6abf,_0x5022c8){return function(_0x31ca59){if(_0x31ca59){return _0x31ca59[_0x7e64('0x2e')](_0x4d6abf)[_0x7e64('0x1b')](function(_0x13946a){return _0x13946a;});}return null;};}function removeEntity(_0x2abe47,_0x79df0e){return function(_0x150360){if(_0x150360){return _0x150360[_0x7e64('0x2f')]()[_0x7e64('0x1b')](function(){_0x2abe47['status'](0xcc)[_0x7e64('0x25')]();});}};}function handleEntityNotFound(_0x2ee768,_0x31c9a3){return function(_0x2e0a78){if(!_0x2e0a78){_0x2ee768[_0x7e64('0x30')](0x194);}return _0x2e0a78;};}function handleError(_0x257a2c,_0x54d43a){_0x54d43a=_0x54d43a||0x1f4;return function(_0x48d803){logger[_0x7e64('0x20')](_0x48d803['stack']);if(_0x48d803[_0x7e64('0x31')]){delete _0x48d803[_0x7e64('0x31')];}_0x257a2c[_0x7e64('0x24')](_0x54d43a)[_0x7e64('0x32')](_0x48d803);};}exports['index']=function(_0xa1761e,_0x5b8793){var _0x25dab6={},_0x381e06={},_0x1f8abc={'count':0x0,'rows':[]};var _0x4f90f2=_[_0x7e64('0x33')](db[_0x7e64('0x34')][_0x7e64('0x35')],function(_0x4a8d2e){return{'name':_0x4a8d2e[_0x7e64('0x36')],'type':_0x4a8d2e[_0x7e64('0x37')][_0x7e64('0x38')]};});_0x381e06['model']=_[_0x7e64('0x33')](_0x4f90f2,'name');_0x381e06[_0x7e64('0x39')]=_[_0x7e64('0x3a')](_0xa1761e[_0x7e64('0x39')]);_0x381e06[_0x7e64('0x3b')]=_['intersection'](_0x381e06['model'],_0x381e06[_0x7e64('0x39')]);_0x25dab6['attributes']=_['intersection'](_0x381e06['model'],qs[_0x7e64('0x3c')](_0xa1761e[_0x7e64('0x39')][_0x7e64('0x3c')]));_0x25dab6[_0x7e64('0x3d')]=_0x25dab6[_0x7e64('0x3d')][_0x7e64('0x3e')]?_0x25dab6['attributes']:_0x381e06[_0x7e64('0x3f')];if(!_0xa1761e[_0x7e64('0x39')][_0x7e64('0x40')](_0x7e64('0x41'))){_0x25dab6[_0x7e64('0x42')]=qs[_0x7e64('0x42')](_0xa1761e['query'][_0x7e64('0x42')]);_0x25dab6[_0x7e64('0x28')]=qs[_0x7e64('0x28')](_0xa1761e[_0x7e64('0x39')][_0x7e64('0x28')]);}_0x25dab6[_0x7e64('0x43')]=qs[_0x7e64('0x44')](_0xa1761e[_0x7e64('0x39')][_0x7e64('0x44')]);_0x25dab6['where']=qs[_0x7e64('0x3b')](_['pick'](_0xa1761e['query'],_0x381e06['filters']),_0x4f90f2);if(_0xa1761e['query'][_0x7e64('0x45')]){_0x25dab6[_0x7e64('0x46')]=_[_0x7e64('0x47')](_0x25dab6[_0x7e64('0x46')],{'$or':_['map'](_0x4f90f2,function(_0x4fe029){if(_0x4fe029[_0x7e64('0x37')]!=='VIRTUAL'){var _0x2f1450={};_0x2f1450[_0x4fe029[_0x7e64('0x31')]]={'$like':'%'+_0xa1761e[_0x7e64('0x39')][_0x7e64('0x45')]+'%'};return _0x2f1450;}})});}_0x25dab6=_['merge']({},_0x25dab6,_0xa1761e[_0x7e64('0x48')]);var _0x11f2c4={'where':_0x25dab6['where']};return db[_0x7e64('0x34')][_0x7e64('0x27')](_0x11f2c4)[_0x7e64('0x1b')](function(_0x57aa01){_0x1f8abc['count']=_0x57aa01;if(_0xa1761e[_0x7e64('0x39')][_0x7e64('0x49')]){_0x25dab6[_0x7e64('0x4a')]=[{'all':!![]}];}return db[_0x7e64('0x34')][_0x7e64('0x4b')](_0x25dab6);})['then'](function(_0x55d72b){_0x1f8abc[_0x7e64('0x4c')]=_0x55d72b;return _0x1f8abc;})[_0x7e64('0x1b')](respondWithFilteredResult(_0x5b8793,_0x25dab6))[_0x7e64('0x4d')](handleError(_0x5b8793,null));};exports[_0x7e64('0x4e')]=function(_0x3ee444,_0x3625e2){var _0x77e3ac={'raw':![],'where':{'id':_0x3ee444[_0x7e64('0x4f')]['id']}},_0x1c6d02={};_0x1c6d02['model']=_[_0x7e64('0x3a')](db[_0x7e64('0x34')]['rawAttributes']);_0x1c6d02['query']=_[_0x7e64('0x3a')](_0x3ee444[_0x7e64('0x39')]);_0x1c6d02[_0x7e64('0x3b')]=_[_0x7e64('0x50')](_0x1c6d02[_0x7e64('0x3f')],_0x1c6d02[_0x7e64('0x39')]);_0x77e3ac[_0x7e64('0x3d')]=_[_0x7e64('0x50')](_0x1c6d02[_0x7e64('0x3f')],qs[_0x7e64('0x3c')](_0x3ee444[_0x7e64('0x39')][_0x7e64('0x3c')]));_0x77e3ac[_0x7e64('0x3d')]=_0x77e3ac[_0x7e64('0x3d')][_0x7e64('0x3e')]?_0x77e3ac[_0x7e64('0x3d')]:_0x1c6d02[_0x7e64('0x3f')];if(_0x3ee444['query'][_0x7e64('0x49')]){_0x77e3ac[_0x7e64('0x4a')]=[{'all':!![]}];}_0x77e3ac=_[_0x7e64('0x47')]({},_0x77e3ac,_0x3ee444[_0x7e64('0x48')]);return db[_0x7e64('0x34')][_0x7e64('0x51')](_0x77e3ac)[_0x7e64('0x1b')](handleEntityNotFound(_0x3625e2,null))['then'](respondWithResult(_0x3625e2,null))[_0x7e64('0x4d')](handleError(_0x3625e2,null));};exports[_0x7e64('0x52')]=function(_0x5e1fea,_0x68228e){return db[_0x7e64('0x34')][_0x7e64('0x52')](_0x5e1fea[_0x7e64('0x53')],{})['then'](respondWithResult(_0x68228e,0xc9))['catch'](handleError(_0x68228e,null));};exports['update']=function(_0x4501a7,_0x2cdafb){if(_0x4501a7['body']['id']){delete _0x4501a7[_0x7e64('0x53')]['id'];}return db[_0x7e64('0x34')][_0x7e64('0x51')]({'where':{'id':_0x4501a7['params']['id']}})['then'](handleEntityNotFound(_0x2cdafb,null))[_0x7e64('0x1b')](saveUpdates(_0x4501a7[_0x7e64('0x53')],null))[_0x7e64('0x1b')](respondWithResult(_0x2cdafb,null))[_0x7e64('0x4d')](handleError(_0x2cdafb,null));};exports[_0x7e64('0x2f')]=function(_0x48509e,_0x3fa430){return db[_0x7e64('0x34')]['find']({'where':{'id':_0x48509e[_0x7e64('0x4f')]['id']}})[_0x7e64('0x1b')](handleEntityNotFound(_0x3fa430,null))['then'](removeEntity(_0x3fa430,null))[_0x7e64('0x4d')](handleError(_0x3fa430,null));};exports['getConfigurations']=function(_0x1ee59b,_0x536d3f,_0x573f6a){var _0x1f822d={};var _0x43d0cd={};var _0x2dbe4d;var _0x225093;return db[_0x7e64('0x34')][_0x7e64('0x54')]({'where':{'id':_0x1ee59b[_0x7e64('0x4f')]['id']}})['then'](handleEntityNotFound(_0x536d3f,null))[_0x7e64('0x1b')](function(_0x3d65b5){if(_0x3d65b5){_0x2dbe4d=_0x3d65b5;_0x43d0cd[_0x7e64('0x3f')]=_['keys'](db[_0x7e64('0x55')][_0x7e64('0x35')]);_0x43d0cd[_0x7e64('0x39')]=_['keys'](_0x1ee59b['query']);_0x43d0cd['filters']=_[_0x7e64('0x50')](_0x43d0cd[_0x7e64('0x3f')],_0x43d0cd['query']);_0x1f822d[_0x7e64('0x3d')]=_[_0x7e64('0x50')](_0x43d0cd[_0x7e64('0x3f')],qs[_0x7e64('0x3c')](_0x1ee59b[_0x7e64('0x39')]['fields']));_0x1f822d[_0x7e64('0x3d')]=_0x1f822d[_0x7e64('0x3d')]['length']?_0x1f822d['attributes']:_0x43d0cd['model'];_0x1f822d[_0x7e64('0x43')]=qs[_0x7e64('0x44')](_0x1ee59b[_0x7e64('0x39')][_0x7e64('0x44')]);_0x1f822d[_0x7e64('0x46')]=qs[_0x7e64('0x3b')](_[_0x7e64('0x56')](_0x1ee59b[_0x7e64('0x39')],_0x43d0cd[_0x7e64('0x3b')]));if(_0x1ee59b['query'][_0x7e64('0x45')]){_0x1f822d[_0x7e64('0x46')]=_[_0x7e64('0x47')](_0x1f822d['where'],{'$or':_[_0x7e64('0x33')](_0x1f822d['attributes'],function(_0x26576f){var _0x51220f={};_0x51220f[_0x26576f]={'$like':'%'+_0x1ee59b[_0x7e64('0x39')][_0x7e64('0x45')]+'%'};return _0x51220f;})});}_0x1f822d=_[_0x7e64('0x47')]({},_0x1f822d,_0x1ee59b['options']);return _0x2dbe4d['getConfigurations'](_0x1f822d);}})[_0x7e64('0x1b')](function(_0x1a53a3){if(_0x1a53a3){_0x225093=_0x1a53a3[_0x7e64('0x3e')];if(!_0x1ee59b[_0x7e64('0x39')][_0x7e64('0x40')](_0x7e64('0x41'))){_0x1f822d[_0x7e64('0x42')]=qs[_0x7e64('0x42')](_0x1ee59b['query'][_0x7e64('0x42')]);_0x1f822d[_0x7e64('0x28')]=qs['offset'](_0x1ee59b[_0x7e64('0x39')][_0x7e64('0x28')]);}return _0x2dbe4d[_0x7e64('0x57')](_0x1f822d);}})[_0x7e64('0x1b')](function(_0x3c282a){if(_0x3c282a){return _0x3c282a?{'count':_0x225093,'rows':_0x3c282a}:null;}})[_0x7e64('0x1b')](respondWithResult(_0x536d3f,null))[_0x7e64('0x4d')](handleError(_0x536d3f,null));};exports[_0x7e64('0x58')]=function(_0xc144ff,_0x2bf94e,_0x27c259){if(_0xc144ff[_0x7e64('0x53')]['id']){delete _0xc144ff[_0x7e64('0x53')]['id'];}return db[_0x7e64('0x34')][_0x7e64('0x54')]({'where':{'id':_0xc144ff[_0x7e64('0x4f')]['id']}})[_0x7e64('0x1b')](handleEntityNotFound(_0x2bf94e,null))[_0x7e64('0x1b')](function(_0x5825a0){if(_0x5825a0){_0xc144ff['body'][_0x7e64('0x59')]=_0x5825a0['id'];_0xc144ff[_0x7e64('0x53')][_0x7e64('0x5a')]=integrations[_0x7e64('0x5b')](_0xc144ff[_0x7e64('0x53')]['channel'],_0xc144ff[_0x7e64('0x53')][_0x7e64('0x37')]);_0xc144ff[_0x7e64('0x53')][_0x7e64('0x5c')]=integrations[_0x7e64('0x5d')](_0xc144ff[_0x7e64('0x53')]['channel'],_0xc144ff['body'][_0x7e64('0x37')]);return db['VtigerConfiguration'][_0x7e64('0x52')](_0xc144ff[_0x7e64('0x53')],{'include':[{'model':db[_0x7e64('0x5e')],'as':'Subjects'},{'model':db[_0x7e64('0x5e')],'as':'Descriptions'}]});}return null;})[_0x7e64('0x1b')](respondWithResult(_0x2bf94e,null))[_0x7e64('0x4d')](handleError(_0x2bf94e,null));};var md5=require(_0x7e64('0x5f'));exports['getFields']=function(_0x5e5a24,_0x4b2378,_0x2a2468){var _0x43d538=null;var _0x178f9b=null;var _0x4a6743=null;var _0x330f5f=null;var _0x2cde18='';return db[_0x7e64('0x34')][_0x7e64('0x54')]({'where':{'id':_0x5e5a24['params']['id']},'attributes':['id','name',_0x7e64('0x60'),_0x7e64('0x61'),_0x7e64('0x62'),_0x7e64('0x63'),'serverUrl',_0x7e64('0x64')]})[_0x7e64('0x1b')](handleEntityNotFound(_0x4b2378,null))[_0x7e64('0x1b')](function(_0x32e8f6){if(_0x32e8f6){_0x43d538=_0x32e8f6[_0x7e64('0x60')];_0x178f9b=_0x32e8f6[_0x7e64('0x64')];_0x4a6743=_0x32e8f6['moduleName'];_0x2cde18=_0x32e8f6[_0x7e64('0x63')];var _0x145351=_0x2cde18[_0x7e64('0x65')](-0x1);if(_0x145351==='/'){_0x2cde18=_0x2cde18['substring'](0x0,_0x2cde18[_0x7e64('0x66')](_0x145351));}_0x330f5f=util['format'](_0x7e64('0x67'),_0x2cde18);var _0x3615c9={'method':'GET','uri':_0x330f5f,'qs':{'operation':'getchallenge','username':_0x32e8f6[_0x7e64('0x60')]},'json':!![]};return rp(_0x3615c9);}})[_0x7e64('0x1b')](function(_0x92bcee){if(_0x92bcee['success']){var _0x8f02cb={'method':_0x7e64('0x68'),'uri':_0x330f5f,'form':{'operation':_0x7e64('0x69'),'username':_0x43d538,'accessKey':md5(_0x92bcee[_0x7e64('0x23')]['token']+_0x178f9b)},'json':!![]};return rp(_0x8f02cb);}})[_0x7e64('0x1b')](function(_0x14a616){if(_0x14a616[_0x7e64('0x6a')]){var _0x3f8665={'method':'GET','uri':_0x330f5f,'qs':{'operation':_0x7e64('0x6b'),'username':_0x43d538,'sessionName':_0x14a616[_0x7e64('0x23')][_0x7e64('0x6c')],'elementType':_0x4a6743},'json':!![]};return rp(_0x3f8665);}})[_0x7e64('0x1b')](function(_0x1b3c67){if(_0x1b3c67[_0x7e64('0x6a')]){var _0x2f3a2c=[_0x7e64('0x6d'),_0x7e64('0x6e'),'owner'];_[_0x7e64('0x6f')](_0x1b3c67[_0x7e64('0x23')][_0x7e64('0x3c')],function(_0xb9baa6){return _0x2f3a2c[_0x7e64('0x70')](_0xb9baa6[_0x7e64('0x37')][_0x7e64('0x31')]);});_[_0x7e64('0x6f')](_0x1b3c67[_0x7e64('0x23')][_0x7e64('0x3c')],function(_0x2b6479){return _0x2b6479[_0x7e64('0x71')]===_0x7e64('0x72');});return{'count':_0x1b3c67[_0x7e64('0x23')]['fields'][_0x7e64('0x3e')],'rows':_['map'](_0x1b3c67[_0x7e64('0x23')][_0x7e64('0x3c')],function(_0xc87737){return{'id':_0xc87737[_0x7e64('0x31')],'name':_0xc87737[_0x7e64('0x73')],'custom':_['startsWith'](_0xc87737[_0x7e64('0x31')],_0x7e64('0x74'))?!![]:![],'options':_0xc87737['type'][_0x7e64('0x31')]===_0x7e64('0x75')&&_0xc87737['type'][_0x7e64('0x76')]['length']>0x0?_['map'](_0xc87737[_0x7e64('0x37')][_0x7e64('0x76')],function(_0x48825f){return{'name':_0x48825f[_0x7e64('0x73')],'value':_0x48825f[_0x7e64('0x77')]};}):[]};})};}})['then'](respondWithResult(_0x4b2378,null))[_0x7e64('0x4d')](function(_0x121b32){console[_0x7e64('0x78')](_0x7e64('0x79')+_0x121b32);var _0x4296bd=_0x5e5a24[_0x7e64('0x39')][_0x7e64('0x7a')]?0x1f4:_0x121b32[_0x7e64('0x7b')]||0x1f4;logger[_0x7e64('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0x7e64('0x7c'),_0x4296bd,JSON[_0x7e64('0x7d')](_0x121b32));delete _0x121b32[_0x7e64('0x31')];if(_0x4296bd===0x191){_0x4296bd=0x190;}_0x4b2378[_0x7e64('0x24')](_0x4296bd)[_0x7e64('0x32')](_0x5e5a24[_0x7e64('0x39')]['test']?{'message':_0x7e64('0x7e'),'statusCode':_0x121b32['statusCode']}:_0x121b32);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 18169af..ded0b93 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 _0xc5d4=['../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x9118c8,_0x43ef27){var _0x5f124d=function(_0x1237aa){while(--_0x1237aa){_0x9118c8['push'](_0x9118c8['shift']());}};_0x5f124d(++_0x43ef27);}(_0xc5d4,0x154));var _0x4c5d=function(_0x238310,_0x548829){_0x238310=_0x238310-0x0;var _0x44fd18=_0xc5d4[_0x238310];return _0x44fd18;};'use strict';var _=require(_0x4c5d('0x0'));var util=require(_0x4c5d('0x1'));var logger=require('../../config/logger')(_0x4c5d('0x2'));var moment=require(_0x4c5d('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c5d('0x4'));var fs=require('fs');var path=require(_0x4c5d('0x5'));var rimraf=require(_0x4c5d('0x6'));var config=require(_0x4c5d('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x4c5d('0x8'));module[_0x4c5d('0x9')]=function(_0x4cec5b,_0x4d206e){return _0x4cec5b['define'](_0x4c5d('0xa'),attributes,{'tableName':_0x4c5d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad36=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x1bed42,_0x282de2){var _0xb5d53e=function(_0x1d35a8){while(--_0x1d35a8){_0x1bed42['push'](_0x1bed42['shift']());}};_0xb5d53e(++_0x282de2);}(_0xad36,0xb0));var _0x6ad3=function(_0xa8b5f2,_0x326cb8){_0xa8b5f2=_0xa8b5f2-0x0;var _0x33608=_0xad36[_0xa8b5f2];return _0x33608;};'use strict';var _=require(_0x6ad3('0x0'));var util=require(_0x6ad3('0x1'));var logger=require(_0x6ad3('0x2'))('api');var moment=require(_0x6ad3('0x3'));var BPromise=require('bluebird');var rp=require(_0x6ad3('0x4'));var fs=require('fs');var path=require(_0x6ad3('0x5'));var rimraf=require(_0x6ad3('0x6'));var config=require(_0x6ad3('0x7'));var attributes=require(_0x6ad3('0x8'));var integrations=require(_0x6ad3('0x9'));module[_0x6ad3('0xa')]=function(_0x285621,_0x3f1ecf){return _0x285621[_0x6ad3('0xb')]('VtigerAccount',attributes,{'tableName':_0x6ad3('0xc'),'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 77bacbd..ea6db34 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 _0x4756=['GetVtigerAccount','VtigerAccount','findAll','options','raw','limit','include','map','model','attributes','stringify','ShowVtigerAccount','find','where','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x2b2792,_0x5d3200){var _0x4c9f42=function(_0x1d7d4d){while(--_0x1d7d4d){_0x2b2792['push'](_0x2b2792['shift']());}};_0x4c9f42(++_0x5d3200);}(_0x4756,0xc8));var _0x6475=function(_0x1b173f,_0x6bec20){_0x1b173f=_0x1b173f-0x0;var _0x271705=_0x4756[_0x1b173f];return _0x271705;};'use strict';var _=require(_0x6475('0x0'));var util=require(_0x6475('0x1'));var moment=require(_0x6475('0x2'));var BPromise=require(_0x6475('0x3'));var rs=require(_0x6475('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6475('0x5'));var logger=require(_0x6475('0x6'))(_0x6475('0x7'));var config=require(_0x6475('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6475('0x9')][_0x6475('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x240c38,_0x326405,_0x422f2e){return new BPromise(function(_0x3f72e8,_0x3f96d7){return client[_0x6475('0xb')](_0x240c38,_0x422f2e)[_0x6475('0xc')](function(_0x184927){logger['info'](_0x6475('0xd'),_0x326405,_0x6475('0xe'));logger[_0x6475('0xf')](_0x6475('0x10'),_0x326405,'request\x20sent',JSON['stringify'](_0x184927));if(_0x184927[_0x6475('0x11')]){if(_0x184927[_0x6475('0x11')][_0x6475('0x12')]===0x1f4){logger[_0x6475('0x11')](_0x6475('0xd'),_0x326405,_0x184927[_0x6475('0x11')][_0x6475('0x13')]);return _0x3f96d7(_0x184927[_0x6475('0x11')]['message']);}logger[_0x6475('0x11')](_0x6475('0xd'),_0x326405,_0x184927[_0x6475('0x11')][_0x6475('0x13')]);return _0x3f72e8(_0x184927[_0x6475('0x11')]['message']);}else{logger[_0x6475('0x14')](_0x6475('0xd'),_0x326405,_0x6475('0xe'));_0x3f72e8(_0x184927[_0x6475('0x15')]['message']);}})['catch'](function(_0x269ccf){logger[_0x6475('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x326405,_0x269ccf);_0x3f96d7(_0x269ccf);});});}exports[_0x6475('0x16')]=function(_0x33b0e1){var _0x1bcd76=this;return new Promise(function(_0x137042,_0x26dfdf){return db[_0x6475('0x17')][_0x6475('0x18')]({'raw':_0x33b0e1[_0x6475('0x19')]?_0x33b0e1['options'][_0x6475('0x1a')]===undefined?!![]:![]:!![],'where':_0x33b0e1[_0x6475('0x19')]?_0x33b0e1[_0x6475('0x19')]['where']||null:null,'attributes':_0x33b0e1[_0x6475('0x19')]?_0x33b0e1['options']['attributes']||null:null,'limit':_0x33b0e1['options']?_0x33b0e1['options'][_0x6475('0x1b')]||null:null,'include':_0x33b0e1[_0x6475('0x19')]?_0x33b0e1['options'][_0x6475('0x1c')]?_[_0x6475('0x1d')](_0x33b0e1[_0x6475('0x19')][_0x6475('0x1c')],function(_0x4ef512){return{'model':db[_0x4ef512[_0x6475('0x1e')]],'as':_0x4ef512['as'],'attributes':_0x4ef512['attributes'],'include':_0x4ef512['include']?_[_0x6475('0x1d')](_0x4ef512['include'],function(_0x2527c7){return{'model':db[_0x2527c7[_0x6475('0x1e')]],'as':_0x2527c7['as'],'attributes':_0x2527c7[_0x6475('0x1f')],'include':_0x2527c7['include']?_[_0x6475('0x1d')](_0x2527c7[_0x6475('0x1c')],function(_0xce9692){return{'model':db[_0xce9692['model']],'as':_0xce9692['as'],'attributes':_0xce9692[_0x6475('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6475('0xc')](function(_0x20450e){logger[_0x6475('0x14')](_0x6475('0x16'),_0x33b0e1);logger[_0x6475('0xf')]('GetVtigerAccount',_0x33b0e1,JSON[_0x6475('0x20')](_0x20450e));_0x137042(_0x20450e);})['catch'](function(_0x1a707d){logger[_0x6475('0x11')]('GetVtigerAccount',_0x1a707d[_0x6475('0x13')],_0x33b0e1);_0x26dfdf(_0x1bcd76['error'](0x1f4,_0x1a707d[_0x6475('0x13')]));});});};exports[_0x6475('0x21')]=function(_0x202ea8){var _0x2a5af3=this;return new Promise(function(_0x5f4be5,_0x229ea6){return db[_0x6475('0x17')][_0x6475('0x22')]({'raw':_0x202ea8[_0x6475('0x19')]?_0x202ea8[_0x6475('0x19')][_0x6475('0x1a')]===undefined?!![]:![]:!![],'where':_0x202ea8[_0x6475('0x19')]?_0x202ea8[_0x6475('0x19')][_0x6475('0x23')]||null:null,'attributes':_0x202ea8[_0x6475('0x19')]?_0x202ea8['options'][_0x6475('0x1f')]||null:null,'include':_0x202ea8[_0x6475('0x19')]?_0x202ea8[_0x6475('0x19')][_0x6475('0x1c')]?_[_0x6475('0x1d')](_0x202ea8['options'][_0x6475('0x1c')],function(_0x393acf){return{'model':db[_0x393acf[_0x6475('0x1e')]],'as':_0x393acf['as'],'attributes':_0x393acf[_0x6475('0x1f')],'include':_0x393acf[_0x6475('0x1c')]?_[_0x6475('0x1d')](_0x393acf[_0x6475('0x1c')],function(_0x2394f3){return{'model':db[_0x2394f3[_0x6475('0x1e')]],'as':_0x2394f3['as'],'attributes':_0x2394f3[_0x6475('0x1f')],'include':_0x2394f3[_0x6475('0x1c')]?_[_0x6475('0x1d')](_0x2394f3[_0x6475('0x1c')],function(_0x4291c4){return{'model':db[_0x4291c4[_0x6475('0x1e')]],'as':_0x4291c4['as'],'attributes':_0x4291c4['attributes']};}):[]};}):[]};}):[]:[]})[_0x6475('0xc')](function(_0x4c0c22){logger[_0x6475('0x14')]('ShowVtigerAccount',_0x202ea8);logger[_0x6475('0xf')](_0x6475('0x21'),_0x202ea8,JSON[_0x6475('0x20')](_0x4c0c22));_0x5f4be5(_0x4c0c22);})[_0x6475('0x24')](function(_0x262504){logger[_0x6475('0x11')](_0x6475('0x21'),_0x262504[_0x6475('0x13')],_0x202ea8);_0x229ea6(_0x2a5af3[_0x6475('0x11')](0x1f4,_0x262504[_0x6475('0x13')]));});});}; \ No newline at end of file +var _0xe86f=['rpc','../../config/environment','jayson/promise','http','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','info','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','then','ShowVtigerAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5411f7,_0x5b0970){var _0x451592=function(_0x3cd342){while(--_0x3cd342){_0x5411f7['push'](_0x5411f7['shift']());}};_0x451592(++_0x5b0970);}(_0xe86f,0x1c0));var _0xfe86=function(_0x588375,_0xa0c226){_0x588375=_0x588375-0x0;var _0x46c100=_0xe86f[_0x588375];return _0x46c100;};'use strict';var _=require('lodash');var util=require(_0xfe86('0x0'));var moment=require(_0xfe86('0x1'));var BPromise=require(_0xfe86('0x2'));var rs=require(_0xfe86('0x3'));var fs=require('fs');var Redis=require(_0xfe86('0x4'));var db=require(_0xfe86('0x5'))['db'];var utils=require(_0xfe86('0x6'));var logger=require('../../config/logger')(_0xfe86('0x7'));var config=require(_0xfe86('0x8'));var jayson=require(_0xfe86('0x9'));var client=jayson['client'][_0xfe86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1985e7,_0x8d724b,_0x1042c1){return new BPromise(function(_0x138706,_0x1d2ecf){return client['request'](_0x1985e7,_0x1042c1)['then'](function(_0x4ceade){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x8d724b,'request\x20sent');logger[_0xfe86('0xb')](_0xfe86('0xc'),_0x8d724b,_0xfe86('0xd'),JSON[_0xfe86('0xe')](_0x4ceade));if(_0x4ceade[_0xfe86('0xf')]){if(_0x4ceade['error'][_0xfe86('0x10')]===0x1f4){logger['error'](_0xfe86('0x11'),_0x8d724b,_0x4ceade[_0xfe86('0xf')][_0xfe86('0x12')]);return _0x1d2ecf(_0x4ceade[_0xfe86('0xf')][_0xfe86('0x12')]);}logger[_0xfe86('0xf')](_0xfe86('0x11'),_0x8d724b,_0x4ceade[_0xfe86('0xf')][_0xfe86('0x12')]);return _0x138706(_0x4ceade[_0xfe86('0xf')][_0xfe86('0x12')]);}else{logger[_0xfe86('0x13')](_0xfe86('0x11'),_0x8d724b,_0xfe86('0xd'));_0x138706(_0x4ceade['result'][_0xfe86('0x12')]);}})[_0xfe86('0x14')](function(_0x3c0e95){logger[_0xfe86('0xf')](_0xfe86('0x11'),_0x8d724b,_0x3c0e95);_0x1d2ecf(_0x3c0e95);});});}exports[_0xfe86('0x15')]=function(_0x38ed81){var _0x34ab76=this;return new Promise(function(_0x46d01a,_0x4551f6){return db[_0xfe86('0x16')][_0xfe86('0x17')]({'raw':_0x38ed81[_0xfe86('0x18')]?_0x38ed81[_0xfe86('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x38ed81[_0xfe86('0x18')]?_0x38ed81[_0xfe86('0x18')][_0xfe86('0x19')]||null:null,'attributes':_0x38ed81[_0xfe86('0x18')]?_0x38ed81[_0xfe86('0x18')][_0xfe86('0x1a')]||null:null,'limit':_0x38ed81[_0xfe86('0x18')]?_0x38ed81['options'][_0xfe86('0x1b')]||null:null,'include':_0x38ed81[_0xfe86('0x18')]?_0x38ed81[_0xfe86('0x18')][_0xfe86('0x1c')]?_[_0xfe86('0x1d')](_0x38ed81['options'][_0xfe86('0x1c')],function(_0x1f432b){return{'model':db[_0x1f432b[_0xfe86('0x1e')]],'as':_0x1f432b['as'],'attributes':_0x1f432b[_0xfe86('0x1a')],'include':_0x1f432b[_0xfe86('0x1c')]?_[_0xfe86('0x1d')](_0x1f432b[_0xfe86('0x1c')],function(_0x2fbe65){return{'model':db[_0x2fbe65['model']],'as':_0x2fbe65['as'],'attributes':_0x2fbe65[_0xfe86('0x1a')],'include':_0x2fbe65[_0xfe86('0x1c')]?_[_0xfe86('0x1d')](_0x2fbe65['include'],function(_0x3faa51){return{'model':db[_0x3faa51[_0xfe86('0x1e')]],'as':_0x3faa51['as'],'attributes':_0x3faa51[_0xfe86('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfe86('0x1f')](function(_0x184317){logger[_0xfe86('0x13')]('GetVtigerAccount',_0x38ed81);logger['debug'](_0xfe86('0x15'),_0x38ed81,JSON[_0xfe86('0xe')](_0x184317));_0x46d01a(_0x184317);})[_0xfe86('0x14')](function(_0x4e2288){logger[_0xfe86('0xf')](_0xfe86('0x15'),_0x4e2288[_0xfe86('0x12')],_0x38ed81);_0x4551f6(_0x34ab76['error'](0x1f4,_0x4e2288['message']));});});};exports[_0xfe86('0x20')]=function(_0x147e67){var _0x1308aa=this;return new Promise(function(_0x46d1dd,_0x43d6f2){return db[_0xfe86('0x16')][_0xfe86('0x21')]({'raw':_0x147e67[_0xfe86('0x18')]?_0x147e67[_0xfe86('0x18')][_0xfe86('0x22')]===undefined?!![]:![]:!![],'where':_0x147e67['options']?_0x147e67[_0xfe86('0x18')][_0xfe86('0x19')]||null:null,'attributes':_0x147e67[_0xfe86('0x18')]?_0x147e67[_0xfe86('0x18')][_0xfe86('0x1a')]||null:null,'include':_0x147e67[_0xfe86('0x18')]?_0x147e67[_0xfe86('0x18')][_0xfe86('0x1c')]?_['map'](_0x147e67[_0xfe86('0x18')][_0xfe86('0x1c')],function(_0x2ccc3b){return{'model':db[_0x2ccc3b[_0xfe86('0x1e')]],'as':_0x2ccc3b['as'],'attributes':_0x2ccc3b[_0xfe86('0x1a')],'include':_0x2ccc3b[_0xfe86('0x1c')]?_[_0xfe86('0x1d')](_0x2ccc3b[_0xfe86('0x1c')],function(_0x3e0f58){return{'model':db[_0x3e0f58[_0xfe86('0x1e')]],'as':_0x3e0f58['as'],'attributes':_0x3e0f58[_0xfe86('0x1a')],'include':_0x3e0f58[_0xfe86('0x1c')]?_[_0xfe86('0x1d')](_0x3e0f58['include'],function(_0x4f0c40){return{'model':db[_0x4f0c40[_0xfe86('0x1e')]],'as':_0x4f0c40['as'],'attributes':_0x4f0c40[_0xfe86('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x513770){logger[_0xfe86('0x13')]('ShowVtigerAccount',_0x147e67);logger[_0xfe86('0xb')](_0xfe86('0x20'),_0x147e67,JSON[_0xfe86('0xe')](_0x513770));_0x46d1dd(_0x513770);})['catch'](function(_0x5aa60a){logger[_0xfe86('0xf')]('ShowVtigerAccount',_0x5aa60a[_0xfe86('0x12')],_0x147e67);_0x43d6f2(_0x1308aa['error'](0x1f4,_0x5aa60a[_0xfe86('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 134c994..be058eb 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(_0x4f1560,_0x18c6e4){var _0x14b3ae=function(_0x9ed837){while(--_0x9ed837){_0x4f1560['push'](_0x4f1560['shift']());}};_0x14b3ae(++_0x18c6e4);}(_0xb10b,0x12a));var _0xbb10=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0xb10b[_0x15876a];return _0xbd900f;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x4147e6,_0x57174e){var _0x3305ba=function(_0x30199e){while(--_0x30199e){_0x4147e6['push'](_0x4147e6['shift']());}};_0x3305ba(++_0x57174e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 38a4ff6..6156985 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 _0x5bce=['sequelize','exports','STRING'];(function(_0x1149d6,_0x491eeb){var _0x4c17f5=function(_0x1b544c){while(--_0x1b544c){_0x1149d6['push'](_0x1149d6['shift']());}};_0x4c17f5(++_0x491eeb);}(_0x5bce,0x7b));var _0xe5bc=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0x5bce[_0x22ee1e];return _0x49a5c9;};'use strict';var Sequelize=require(_0xe5bc('0x0'));module[_0xe5bc('0x1')]={'name':{'type':Sequelize[_0xe5bc('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1298=['exports','STRING'];(function(_0x2705f2,_0x32c04b){var _0x53b7c2=function(_0x3364e4){while(--_0x3364e4){_0x2705f2['push'](_0x2705f2['shift']());}};_0x53b7c2(++_0x32c04b);}(_0x1298,0x190));var _0x8129=function(_0x25a635,_0x3a9018){_0x25a635=_0x25a635-0x0;var _0xf7447c=_0x1298[_0x25a635];return _0xf7447c;};'use strict';var Sequelize=require('sequelize');module[_0x8129('0x0')]={'name':{'type':Sequelize[_0x8129('0x1')]},'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 a94a01d..631f264 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 _0xab26=['querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','name','send','map','VtigerConfiguration','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','sort','filter','where','merge','VIRTUAL','count','include','show','params','includeAll','options','find','create','body','findOne','VtigerField','pick','getFields','hasOwnProperty','nolimit','order','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel'];(function(_0x57a8f,_0x490836){var _0x3d67aa=function(_0x113a40){while(--_0x113a40){_0x57a8f['push'](_0x57a8f['shift']());}};_0x3d67aa(++_0x490836);}(_0xab26,0x196));var _0x6ab2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab26[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require(_0x6ab2('0x0'));var emlformat=require(_0x6ab2('0x1'));var rimraf=require(_0x6ab2('0x2'));var zipdir=require(_0x6ab2('0x3'));var jsonpatch=require(_0x6ab2('0x4'));var rp=require('request-promise');var moment=require(_0x6ab2('0x5'));var BPromise=require(_0x6ab2('0x6'));var Mustache=require(_0x6ab2('0x7'));var util=require(_0x6ab2('0x8'));var path=require(_0x6ab2('0x9'));var sox=require(_0x6ab2('0xa'));var csv=require(_0x6ab2('0xb'));var ejs=require(_0x6ab2('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6ab2('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6ab2('0xb'));var querystring=require(_0x6ab2('0xe'));var Papa=require(_0x6ab2('0xf'));var Redis=require(_0x6ab2('0x10'));var authService=require(_0x6ab2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ab2('0x12'));var logger=require('../../config/logger')(_0x6ab2('0x13'));var utils=require('../../config/utils');var config=require(_0x6ab2('0x14'));var licenseUtil=require(_0x6ab2('0x15'));var db=require(_0x6ab2('0x16'))['db'];var jayson=require(_0x6ab2('0x17'));var client=jayson[_0x6ab2('0x18')][_0x6ab2('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4744dd,_0x277d8b,_0x2cb047,_0x57a1a2){return new BPromise(function(_0x4b9aa3,_0x3e7e56){var _0x16d83c=_0x57a1a2||client;return _0x16d83c[_0x6ab2('0x1a')](_0x4744dd,_0x2cb047)['then'](function(_0x462849){logger[_0x6ab2('0x1b')](_0x6ab2('0x1c'),_0x277d8b,_0x6ab2('0x1d'));logger['debug'](_0x6ab2('0x1e'),_0x277d8b,_0x6ab2('0x1d'),JSON['stringify'](_0x462849));if(_0x462849[_0x6ab2('0x1f')]){if(_0x462849[_0x6ab2('0x1f')]['code']===0x1f4){logger[_0x6ab2('0x1f')](_0x6ab2('0x1c'),_0x277d8b,_0x462849[_0x6ab2('0x1f')]['message']);return _0x3e7e56(_0x462849[_0x6ab2('0x1f')]['message']);}logger[_0x6ab2('0x1f')](_0x6ab2('0x1c'),_0x277d8b,_0x462849[_0x6ab2('0x1f')][_0x6ab2('0x20')]);return _0x4b9aa3(_0x462849[_0x6ab2('0x1f')]['message']);}else{logger['info'](_0x6ab2('0x1c'),_0x277d8b,_0x6ab2('0x1d'));_0x4b9aa3(_0x462849['result'][_0x6ab2('0x20')]);}})[_0x6ab2('0x21')](function(_0x4863da){logger[_0x6ab2('0x1f')](_0x6ab2('0x1c'),_0x277d8b,_0x4863da);_0x3e7e56(_0x4863da);});});}function respondWithStatusCode(_0x309b06,_0x472f61){_0x472f61=_0x472f61||0xcc;return function(_0x172339){if(_0x172339){return _0x309b06[_0x6ab2('0x22')](_0x472f61);}return _0x309b06[_0x6ab2('0x23')](_0x472f61)[_0x6ab2('0x24')]();};}function respondWithResult(_0x38010d,_0x5b4266){_0x5b4266=_0x5b4266||0xc8;return function(_0x2e8406){if(_0x2e8406){return _0x38010d['status'](_0x5b4266)[_0x6ab2('0x25')](_0x2e8406);}};}function respondWithFilteredResult(_0x2224b3,_0x4d85cd){return function(_0x3cdc0d){if(_0x3cdc0d){var _0x48f086=_0x3cdc0d['count'],_0x395119=_0x4d85cd[_0x6ab2('0x26')],_0x37cd34=_0x4d85cd[_0x6ab2('0x26')]+_0x4d85cd[_0x6ab2('0x27')],_0x352fc4;if(_0x37cd34>=_0x48f086){_0x37cd34=_0x48f086;_0x352fc4=0xc8;}else{_0x352fc4=0xce;}_0x2224b3[_0x6ab2('0x23')](_0x352fc4);return _0x2224b3[_0x6ab2('0x28')]('Content-Range',_0x395119+'-'+_0x37cd34+'/'+_0x48f086)['json'](_0x3cdc0d);}return null;};}function patchUpdates(_0xc70f31){return function(_0x58cca4){try{jsonpatch[_0x6ab2('0x29')](_0x58cca4,_0xc70f31,!![]);}catch(_0x4a0b5b){return BPromise[_0x6ab2('0x2a')](_0x4a0b5b);}return _0x58cca4[_0x6ab2('0x2b')]();};}function saveUpdates(_0x218f2e,_0x1429c2){return function(_0x3a1043){if(_0x3a1043){return _0x3a1043[_0x6ab2('0x2c')](_0x218f2e)[_0x6ab2('0x2d')](function(_0x4007dd){return _0x4007dd;});}return null;};}function removeEntity(_0x538b8c,_0x22a540){return function(_0xb0646){if(_0xb0646){return _0xb0646[_0x6ab2('0x2e')]()[_0x6ab2('0x2d')](function(){_0x538b8c['status'](0xcc)[_0x6ab2('0x24')]();});}};}function handleEntityNotFound(_0x1543f1,_0x131da8){return function(_0x3fc1e1){if(!_0x3fc1e1){_0x1543f1[_0x6ab2('0x22')](0x194);}return _0x3fc1e1;};}function handleError(_0x3c7894,_0x275e8a){_0x275e8a=_0x275e8a||0x1f4;return function(_0x1beac7){logger[_0x6ab2('0x1f')](_0x1beac7['stack']);if(_0x1beac7[_0x6ab2('0x2f')]){delete _0x1beac7[_0x6ab2('0x2f')];}_0x3c7894[_0x6ab2('0x23')](_0x275e8a)[_0x6ab2('0x30')](_0x1beac7);};}exports['index']=function(_0x50f90b,_0x3f2b05){var _0x200d53={},_0x1f6223={},_0x550e73={'count':0x0,'rows':[]};var _0x599e79=_[_0x6ab2('0x31')](db[_0x6ab2('0x32')][_0x6ab2('0x33')],function(_0x4a5ce){return{'name':_0x4a5ce['fieldName'],'type':_0x4a5ce[_0x6ab2('0x34')][_0x6ab2('0x35')]};});_0x1f6223[_0x6ab2('0x36')]=_['map'](_0x599e79,_0x6ab2('0x2f'));_0x1f6223['query']=_[_0x6ab2('0x37')](_0x50f90b['query']);_0x1f6223[_0x6ab2('0x38')]=_[_0x6ab2('0x39')](_0x1f6223[_0x6ab2('0x36')],_0x1f6223[_0x6ab2('0x3a')]);_0x200d53[_0x6ab2('0x3b')]=_[_0x6ab2('0x39')](_0x1f6223[_0x6ab2('0x36')],qs['fields'](_0x50f90b[_0x6ab2('0x3a')][_0x6ab2('0x3c')]));_0x200d53[_0x6ab2('0x3b')]=_0x200d53['attributes'][_0x6ab2('0x3d')]?_0x200d53['attributes']:_0x1f6223[_0x6ab2('0x36')];if(!_0x50f90b[_0x6ab2('0x3a')]['hasOwnProperty']('nolimit')){_0x200d53[_0x6ab2('0x27')]=qs[_0x6ab2('0x27')](_0x50f90b[_0x6ab2('0x3a')]['limit']);_0x200d53[_0x6ab2('0x26')]=qs[_0x6ab2('0x26')](_0x50f90b[_0x6ab2('0x3a')][_0x6ab2('0x26')]);}_0x200d53['order']=qs[_0x6ab2('0x3e')](_0x50f90b['query']['sort']);_0x200d53['where']=qs[_0x6ab2('0x38')](_['pick'](_0x50f90b['query'],_0x1f6223[_0x6ab2('0x38')]),_0x599e79);if(_0x50f90b[_0x6ab2('0x3a')][_0x6ab2('0x3f')]){_0x200d53[_0x6ab2('0x40')]=_[_0x6ab2('0x41')](_0x200d53[_0x6ab2('0x40')],{'$or':_[_0x6ab2('0x31')](_0x599e79,function(_0x8208e0){if(_0x8208e0[_0x6ab2('0x34')]!==_0x6ab2('0x42')){var _0x31488d={};_0x31488d[_0x8208e0['name']]={'$like':'%'+_0x50f90b[_0x6ab2('0x3a')][_0x6ab2('0x3f')]+'%'};return _0x31488d;}})});}_0x200d53=_[_0x6ab2('0x41')]({},_0x200d53,_0x50f90b['options']);var _0x584c71={'where':_0x200d53[_0x6ab2('0x40')]};return db[_0x6ab2('0x32')][_0x6ab2('0x43')](_0x584c71)['then'](function(_0x324c99){_0x550e73[_0x6ab2('0x43')]=_0x324c99;if(_0x50f90b[_0x6ab2('0x3a')]['includeAll']){_0x200d53[_0x6ab2('0x44')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x200d53);})[_0x6ab2('0x2d')](function(_0x2e00e9){_0x550e73['rows']=_0x2e00e9;return _0x550e73;})[_0x6ab2('0x2d')](respondWithFilteredResult(_0x3f2b05,_0x200d53))[_0x6ab2('0x21')](handleError(_0x3f2b05,null));};exports[_0x6ab2('0x45')]=function(_0x49d5f8,_0x4971c4){var _0x457e9a={'raw':![],'where':{'id':_0x49d5f8[_0x6ab2('0x46')]['id']}},_0x41aec5={};_0x41aec5['model']=_[_0x6ab2('0x37')](db[_0x6ab2('0x32')][_0x6ab2('0x33')]);_0x41aec5['query']=_[_0x6ab2('0x37')](_0x49d5f8[_0x6ab2('0x3a')]);_0x41aec5[_0x6ab2('0x38')]=_[_0x6ab2('0x39')](_0x41aec5[_0x6ab2('0x36')],_0x41aec5['query']);_0x457e9a[_0x6ab2('0x3b')]=_[_0x6ab2('0x39')](_0x41aec5['model'],qs[_0x6ab2('0x3c')](_0x49d5f8[_0x6ab2('0x3a')][_0x6ab2('0x3c')]));_0x457e9a[_0x6ab2('0x3b')]=_0x457e9a[_0x6ab2('0x3b')][_0x6ab2('0x3d')]?_0x457e9a[_0x6ab2('0x3b')]:_0x41aec5[_0x6ab2('0x36')];if(_0x49d5f8[_0x6ab2('0x3a')][_0x6ab2('0x47')]){_0x457e9a['include']=[{'all':!![]}];}_0x457e9a=_[_0x6ab2('0x41')]({},_0x457e9a,_0x49d5f8[_0x6ab2('0x48')]);return db[_0x6ab2('0x32')][_0x6ab2('0x49')](_0x457e9a)[_0x6ab2('0x2d')](handleEntityNotFound(_0x4971c4,null))[_0x6ab2('0x2d')](respondWithResult(_0x4971c4,null))[_0x6ab2('0x21')](handleError(_0x4971c4,null));};exports['create']=function(_0x448c35,_0x1e89d2){return db['VtigerConfiguration'][_0x6ab2('0x4a')](_0x448c35[_0x6ab2('0x4b')],{})[_0x6ab2('0x2d')](respondWithResult(_0x1e89d2,0xc9))[_0x6ab2('0x21')](handleError(_0x1e89d2,null));};exports[_0x6ab2('0x2c')]=function(_0x3df106,_0x463d46){if(_0x3df106[_0x6ab2('0x4b')]['id']){delete _0x3df106[_0x6ab2('0x4b')]['id'];}return db['VtigerConfiguration'][_0x6ab2('0x49')]({'where':{'id':_0x3df106[_0x6ab2('0x46')]['id']}})[_0x6ab2('0x2d')](handleEntityNotFound(_0x463d46,null))[_0x6ab2('0x2d')](saveUpdates(_0x3df106[_0x6ab2('0x4b')],null))[_0x6ab2('0x2d')](respondWithResult(_0x463d46,null))['catch'](handleError(_0x463d46,null));};exports[_0x6ab2('0x2e')]=function(_0x214189,_0x1be5c6){return db['VtigerConfiguration'][_0x6ab2('0x49')]({'where':{'id':_0x214189[_0x6ab2('0x46')]['id']}})[_0x6ab2('0x2d')](handleEntityNotFound(_0x1be5c6,null))['then'](removeEntity(_0x1be5c6,null))[_0x6ab2('0x21')](handleError(_0x1be5c6,null));};exports['getFields']=function(_0x1d754d,_0x1586d7,_0x40cbd8){var _0x4198d6={};var _0x3ccd50={};var _0x88b7a;var _0x239eda;return db[_0x6ab2('0x32')][_0x6ab2('0x4c')]({'where':{'id':_0x1d754d[_0x6ab2('0x46')]['id']}})[_0x6ab2('0x2d')](handleEntityNotFound(_0x1586d7,null))[_0x6ab2('0x2d')](function(_0x499f43){if(_0x499f43){_0x88b7a=_0x499f43;_0x3ccd50[_0x6ab2('0x36')]=_['keys'](db[_0x6ab2('0x4d')][_0x6ab2('0x33')]);_0x3ccd50['query']=_[_0x6ab2('0x37')](_0x1d754d['query']);_0x3ccd50[_0x6ab2('0x38')]=_[_0x6ab2('0x39')](_0x3ccd50[_0x6ab2('0x36')],_0x3ccd50['query']);_0x4198d6[_0x6ab2('0x3b')]=_[_0x6ab2('0x39')](_0x3ccd50[_0x6ab2('0x36')],qs[_0x6ab2('0x3c')](_0x1d754d[_0x6ab2('0x3a')][_0x6ab2('0x3c')]));_0x4198d6[_0x6ab2('0x3b')]=_0x4198d6[_0x6ab2('0x3b')][_0x6ab2('0x3d')]?_0x4198d6[_0x6ab2('0x3b')]:_0x3ccd50['model'];_0x4198d6['order']=qs[_0x6ab2('0x3e')](_0x1d754d['query'][_0x6ab2('0x3e')]);_0x4198d6[_0x6ab2('0x40')]=qs[_0x6ab2('0x38')](_[_0x6ab2('0x4e')](_0x1d754d['query'],_0x3ccd50[_0x6ab2('0x38')]));if(_0x1d754d[_0x6ab2('0x3a')][_0x6ab2('0x3f')]){_0x4198d6[_0x6ab2('0x40')]=_[_0x6ab2('0x41')](_0x4198d6['where'],{'$or':_['map'](_0x4198d6[_0x6ab2('0x3b')],function(_0x36c150){var _0x4a4ce6={};_0x4a4ce6[_0x36c150]={'$like':'%'+_0x1d754d[_0x6ab2('0x3a')][_0x6ab2('0x3f')]+'%'};return _0x4a4ce6;})});}_0x4198d6=_[_0x6ab2('0x41')]({},_0x4198d6,_0x1d754d['options']);return _0x88b7a[_0x6ab2('0x4f')](_0x4198d6);}})[_0x6ab2('0x2d')](function(_0x2edfb2){if(_0x2edfb2){_0x239eda=_0x2edfb2[_0x6ab2('0x3d')];if(!_0x1d754d[_0x6ab2('0x3a')][_0x6ab2('0x50')](_0x6ab2('0x51'))){_0x4198d6[_0x6ab2('0x27')]=qs['limit'](_0x1d754d[_0x6ab2('0x3a')][_0x6ab2('0x27')]);_0x4198d6['offset']=qs[_0x6ab2('0x26')](_0x1d754d[_0x6ab2('0x3a')][_0x6ab2('0x26')]);}return _0x88b7a[_0x6ab2('0x4f')](_0x4198d6);}})['then'](function(_0x33984a){if(_0x33984a){return _0x33984a?{'count':_0x239eda,'rows':_0x33984a}:null;}})[_0x6ab2('0x2d')](respondWithResult(_0x1586d7,null))[_0x6ab2('0x21')](handleError(_0x1586d7,null));};exports['getSubjects']=function(_0x49efae,_0x2bb83e,_0x50eb60){var _0x1615fb={};var _0x4205d8={};var _0x241963;var _0x167c36;return db[_0x6ab2('0x32')][_0x6ab2('0x4c')]({'where':{'id':_0x49efae[_0x6ab2('0x46')]['id']}})[_0x6ab2('0x2d')](handleEntityNotFound(_0x2bb83e,null))[_0x6ab2('0x2d')](function(_0x443dfc){if(_0x443dfc){_0x241963=_0x443dfc;_0x4205d8['model']=_[_0x6ab2('0x37')](db[_0x6ab2('0x4d')][_0x6ab2('0x33')]);_0x4205d8[_0x6ab2('0x3a')]=_[_0x6ab2('0x37')](_0x49efae[_0x6ab2('0x3a')]);_0x4205d8['filters']=_[_0x6ab2('0x39')](_0x4205d8[_0x6ab2('0x36')],_0x4205d8['query']);_0x1615fb[_0x6ab2('0x3b')]=_[_0x6ab2('0x39')](_0x4205d8[_0x6ab2('0x36')],qs['fields'](_0x49efae[_0x6ab2('0x3a')]['fields']));_0x1615fb[_0x6ab2('0x3b')]=_0x1615fb[_0x6ab2('0x3b')]['length']?_0x1615fb['attributes']:_0x4205d8[_0x6ab2('0x36')];_0x1615fb[_0x6ab2('0x52')]=qs[_0x6ab2('0x3e')](_0x49efae['query']['sort']);_0x1615fb[_0x6ab2('0x40')]=qs['filters'](_[_0x6ab2('0x4e')](_0x49efae[_0x6ab2('0x3a')],_0x4205d8[_0x6ab2('0x38')]));if(_0x49efae[_0x6ab2('0x3a')][_0x6ab2('0x3f')]){_0x1615fb[_0x6ab2('0x40')]=_[_0x6ab2('0x41')](_0x1615fb[_0x6ab2('0x40')],{'$or':_[_0x6ab2('0x31')](_0x1615fb[_0x6ab2('0x3b')],function(_0x17bf4a){var _0x103f10={};_0x103f10[_0x17bf4a]={'$like':'%'+_0x49efae[_0x6ab2('0x3a')][_0x6ab2('0x3f')]+'%'};return _0x103f10;})});}_0x1615fb=_[_0x6ab2('0x41')]({},_0x1615fb,_0x49efae['options']);return _0x241963['getSubjects'](_0x1615fb);}})['then'](function(_0x81a464){if(_0x81a464){_0x167c36=_0x81a464['length'];if(!_0x49efae[_0x6ab2('0x3a')][_0x6ab2('0x50')](_0x6ab2('0x51'))){_0x1615fb[_0x6ab2('0x27')]=qs[_0x6ab2('0x27')](_0x49efae['query'][_0x6ab2('0x27')]);_0x1615fb[_0x6ab2('0x26')]=qs[_0x6ab2('0x26')](_0x49efae[_0x6ab2('0x3a')]['offset']);}return _0x241963['getSubjects'](_0x1615fb);}})[_0x6ab2('0x2d')](function(_0xae44f6){if(_0xae44f6){return _0xae44f6?{'count':_0x167c36,'rows':_0xae44f6}:null;}})[_0x6ab2('0x2d')](respondWithResult(_0x2bb83e,null))[_0x6ab2('0x21')](handleError(_0x2bb83e,null));};exports['getDescriptions']=function(_0x15fecb,_0x242313,_0x4182ec){var _0x206657={};var _0x4595dc={};var _0x28deae;var _0x332f51;return db['VtigerConfiguration'][_0x6ab2('0x4c')]({'where':{'id':_0x15fecb[_0x6ab2('0x46')]['id']}})[_0x6ab2('0x2d')](handleEntityNotFound(_0x242313,null))['then'](function(_0x14e38f){if(_0x14e38f){_0x28deae=_0x14e38f;_0x4595dc['model']=_['keys'](db[_0x6ab2('0x4d')][_0x6ab2('0x33')]);_0x4595dc[_0x6ab2('0x3a')]=_[_0x6ab2('0x37')](_0x15fecb[_0x6ab2('0x3a')]);_0x4595dc[_0x6ab2('0x38')]=_[_0x6ab2('0x39')](_0x4595dc[_0x6ab2('0x36')],_0x4595dc[_0x6ab2('0x3a')]);_0x206657[_0x6ab2('0x3b')]=_[_0x6ab2('0x39')](_0x4595dc[_0x6ab2('0x36')],qs[_0x6ab2('0x3c')](_0x15fecb['query'][_0x6ab2('0x3c')]));_0x206657[_0x6ab2('0x3b')]=_0x206657[_0x6ab2('0x3b')][_0x6ab2('0x3d')]?_0x206657[_0x6ab2('0x3b')]:_0x4595dc[_0x6ab2('0x36')];_0x206657[_0x6ab2('0x52')]=qs['sort'](_0x15fecb[_0x6ab2('0x3a')][_0x6ab2('0x3e')]);_0x206657[_0x6ab2('0x40')]=qs[_0x6ab2('0x38')](_[_0x6ab2('0x4e')](_0x15fecb[_0x6ab2('0x3a')],_0x4595dc['filters']));if(_0x15fecb[_0x6ab2('0x3a')][_0x6ab2('0x3f')]){_0x206657['where']=_[_0x6ab2('0x41')](_0x206657[_0x6ab2('0x40')],{'$or':_[_0x6ab2('0x31')](_0x206657['attributes'],function(_0x263e68){var _0xa798ad={};_0xa798ad[_0x263e68]={'$like':'%'+_0x15fecb[_0x6ab2('0x3a')][_0x6ab2('0x3f')]+'%'};return _0xa798ad;})});}_0x206657=_['merge']({},_0x206657,_0x15fecb[_0x6ab2('0x48')]);return _0x28deae[_0x6ab2('0x53')](_0x206657);}})[_0x6ab2('0x2d')](function(_0x3e56be){if(_0x3e56be){_0x332f51=_0x3e56be['length'];if(!_0x15fecb['query'][_0x6ab2('0x50')](_0x6ab2('0x51'))){_0x206657[_0x6ab2('0x27')]=qs[_0x6ab2('0x27')](_0x15fecb[_0x6ab2('0x3a')][_0x6ab2('0x27')]);_0x206657[_0x6ab2('0x26')]=qs[_0x6ab2('0x26')](_0x15fecb[_0x6ab2('0x3a')][_0x6ab2('0x26')]);}return _0x28deae['getDescriptions'](_0x206657);}})[_0x6ab2('0x2d')](function(_0x1a3156){if(_0x1a3156){return _0x1a3156?{'count':_0x332f51,'rows':_0x1a3156}:null;}})['then'](respondWithResult(_0x242313,null))[_0x6ab2('0x21')](handleError(_0x242313,null));}; \ No newline at end of file +var _0x44b4=['attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','show','params','includeAll','catch','create','body','find','findOne','VtigerField','getFields','getSubjects','hasOwnProperty','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','end','json','offset','limit','set','apply','reject','update','destroy','then','sendStatus','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x23683d,_0x14ea53){var _0xee1a9f=function(_0x2d87b0){while(--_0x2d87b0){_0x23683d['push'](_0x23683d['shift']());}};_0xee1a9f(++_0x14ea53);}(_0x44b4,0x143));var _0x444b=function(_0x437563,_0x4bcdb5){_0x437563=_0x437563-0x0;var _0xd7bf0f=_0x44b4[_0x437563];return _0xd7bf0f;};'use strict';var pdf=require(_0x444b('0x0'));var emlformat=require(_0x444b('0x1'));var rimraf=require(_0x444b('0x2'));var zipdir=require(_0x444b('0x3'));var jsonpatch=require(_0x444b('0x4'));var rp=require(_0x444b('0x5'));var moment=require(_0x444b('0x6'));var BPromise=require(_0x444b('0x7'));var Mustache=require(_0x444b('0x8'));var util=require('util');var path=require('path');var sox=require(_0x444b('0x9'));var csv=require(_0x444b('0xa'));var ejs=require(_0x444b('0xb'));var fs=require('fs');var _=require(_0x444b('0xc'));var squel=require(_0x444b('0xd'));var crypto=require(_0x444b('0xe'));var jsforce=require(_0x444b('0xf'));var deskjs=require(_0x444b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x444b('0x11'));var Papa=require(_0x444b('0x12'));var Redis=require(_0x444b('0x13'));var authService=require(_0x444b('0x14'));var qs=require(_0x444b('0x15'));var as=require(_0x444b('0x16'));var hardwareService=require(_0x444b('0x17'));var logger=require(_0x444b('0x18'))('api');var utils=require(_0x444b('0x19'));var config=require(_0x444b('0x1a'));var licenseUtil=require(_0x444b('0x1b'));var db=require(_0x444b('0x1c'))['db'];var jayson=require(_0x444b('0x1d'));var client=jayson[_0x444b('0x1e')][_0x444b('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5dbf88,_0x464d06,_0x2e3ecd,_0x128a45){return new BPromise(function(_0x325550,_0x145f6e){var _0x5bdff7=_0x128a45||client;return _0x5bdff7[_0x444b('0x20')](_0x5dbf88,_0x2e3ecd)['then'](function(_0x311b88){logger['info'](_0x444b('0x21'),_0x464d06,_0x444b('0x22'));logger[_0x444b('0x23')](_0x444b('0x24'),_0x464d06,_0x444b('0x22'),JSON[_0x444b('0x25')](_0x311b88));if(_0x311b88['error']){if(_0x311b88[_0x444b('0x26')][_0x444b('0x27')]===0x1f4){logger['error'](_0x444b('0x21'),_0x464d06,_0x311b88['error'][_0x444b('0x28')]);return _0x145f6e(_0x311b88['error'][_0x444b('0x28')]);}logger[_0x444b('0x26')](_0x444b('0x21'),_0x464d06,_0x311b88[_0x444b('0x26')][_0x444b('0x28')]);return _0x325550(_0x311b88[_0x444b('0x26')][_0x444b('0x28')]);}else{logger[_0x444b('0x29')](_0x444b('0x21'),_0x464d06,_0x444b('0x22'));_0x325550(_0x311b88[_0x444b('0x2a')][_0x444b('0x28')]);}})['catch'](function(_0xdc61b2){logger['error'](_0x444b('0x21'),_0x464d06,_0xdc61b2);_0x145f6e(_0xdc61b2);});});}function respondWithStatusCode(_0x2d13da,_0xf974bd){_0xf974bd=_0xf974bd||0xcc;return function(_0x424f20){if(_0x424f20){return _0x2d13da['sendStatus'](_0xf974bd);}return _0x2d13da[_0x444b('0x2b')](_0xf974bd)[_0x444b('0x2c')]();};}function respondWithResult(_0x269f5a,_0x5e5f51){_0x5e5f51=_0x5e5f51||0xc8;return function(_0x14b991){if(_0x14b991){return _0x269f5a['status'](_0x5e5f51)[_0x444b('0x2d')](_0x14b991);}};}function respondWithFilteredResult(_0x24accf,_0x258e08){return function(_0x50d9c2){if(_0x50d9c2){var _0x319098=_0x50d9c2['count'],_0xb3bed4=_0x258e08['offset'],_0x2649c6=_0x258e08[_0x444b('0x2e')]+_0x258e08[_0x444b('0x2f')],_0x5954f6;if(_0x2649c6>=_0x319098){_0x2649c6=_0x319098;_0x5954f6=0xc8;}else{_0x5954f6=0xce;}_0x24accf[_0x444b('0x2b')](_0x5954f6);return _0x24accf[_0x444b('0x30')]('Content-Range',_0xb3bed4+'-'+_0x2649c6+'/'+_0x319098)[_0x444b('0x2d')](_0x50d9c2);}return null;};}function patchUpdates(_0x462eb8){return function(_0x5baf47){try{jsonpatch[_0x444b('0x31')](_0x5baf47,_0x462eb8,!![]);}catch(_0x3275d0){return BPromise[_0x444b('0x32')](_0x3275d0);}return _0x5baf47['save']();};}function saveUpdates(_0x1e5379,_0x3a443b){return function(_0x2c1416){if(_0x2c1416){return _0x2c1416[_0x444b('0x33')](_0x1e5379)['then'](function(_0x310bbc){return _0x310bbc;});}return null;};}function removeEntity(_0x243846,_0x34d5b3){return function(_0x1dcd7c){if(_0x1dcd7c){return _0x1dcd7c[_0x444b('0x34')]()[_0x444b('0x35')](function(){_0x243846[_0x444b('0x2b')](0xcc)[_0x444b('0x2c')]();});}};}function handleEntityNotFound(_0x3e79be,_0x27bc3b){return function(_0x2d9cb4){if(!_0x2d9cb4){_0x3e79be[_0x444b('0x36')](0x194);}return _0x2d9cb4;};}function handleError(_0x53b7ae,_0x487782){_0x487782=_0x487782||0x1f4;return function(_0x57bf92){logger[_0x444b('0x26')](_0x57bf92[_0x444b('0x37')]);if(_0x57bf92[_0x444b('0x38')]){delete _0x57bf92[_0x444b('0x38')];}_0x53b7ae[_0x444b('0x2b')](_0x487782)[_0x444b('0x39')](_0x57bf92);};}exports[_0x444b('0x3a')]=function(_0x68a427,_0x48b3bd){var _0x524d69={},_0x4734a2={},_0x10a3aa={'count':0x0,'rows':[]};var _0x51682c=_[_0x444b('0x3b')](db[_0x444b('0x3c')][_0x444b('0x3d')],function(_0x4b1be4){return{'name':_0x4b1be4['fieldName'],'type':_0x4b1be4[_0x444b('0x3e')][_0x444b('0x3f')]};});_0x4734a2[_0x444b('0x40')]=_[_0x444b('0x3b')](_0x51682c,_0x444b('0x38'));_0x4734a2[_0x444b('0x41')]=_[_0x444b('0x42')](_0x68a427['query']);_0x4734a2[_0x444b('0x43')]=_[_0x444b('0x44')](_0x4734a2['model'],_0x4734a2['query']);_0x524d69[_0x444b('0x45')]=_['intersection'](_0x4734a2[_0x444b('0x40')],qs[_0x444b('0x46')](_0x68a427[_0x444b('0x41')]['fields']));_0x524d69[_0x444b('0x45')]=_0x524d69[_0x444b('0x45')][_0x444b('0x47')]?_0x524d69['attributes']:_0x4734a2[_0x444b('0x40')];if(!_0x68a427['query']['hasOwnProperty'](_0x444b('0x48'))){_0x524d69['limit']=qs['limit'](_0x68a427[_0x444b('0x41')][_0x444b('0x2f')]);_0x524d69[_0x444b('0x2e')]=qs[_0x444b('0x2e')](_0x68a427[_0x444b('0x41')]['offset']);}_0x524d69[_0x444b('0x49')]=qs[_0x444b('0x4a')](_0x68a427[_0x444b('0x41')][_0x444b('0x4a')]);_0x524d69['where']=qs[_0x444b('0x43')](_[_0x444b('0x4b')](_0x68a427[_0x444b('0x41')],_0x4734a2['filters']),_0x51682c);if(_0x68a427[_0x444b('0x41')][_0x444b('0x4c')]){_0x524d69[_0x444b('0x4d')]=_[_0x444b('0x4e')](_0x524d69['where'],{'$or':_['map'](_0x51682c,function(_0x4db4ec){if(_0x4db4ec[_0x444b('0x3e')]!==_0x444b('0x4f')){var _0x58e0aa={};_0x58e0aa[_0x4db4ec[_0x444b('0x38')]]={'$like':'%'+_0x68a427['query']['filter']+'%'};return _0x58e0aa;}})});}_0x524d69=_[_0x444b('0x4e')]({},_0x524d69,_0x68a427[_0x444b('0x50')]);var _0xc7d659={'where':_0x524d69[_0x444b('0x4d')]};return db[_0x444b('0x3c')][_0x444b('0x51')](_0xc7d659)[_0x444b('0x35')](function(_0x1320cb){_0x10a3aa[_0x444b('0x51')]=_0x1320cb;if(_0x68a427['query']['includeAll']){_0x524d69[_0x444b('0x52')]=[{'all':!![]}];}return db[_0x444b('0x3c')][_0x444b('0x53')](_0x524d69);})[_0x444b('0x35')](function(_0x459e2f){_0x10a3aa[_0x444b('0x54')]=_0x459e2f;return _0x10a3aa;})[_0x444b('0x35')](respondWithFilteredResult(_0x48b3bd,_0x524d69))['catch'](handleError(_0x48b3bd,null));};exports[_0x444b('0x55')]=function(_0x3cf767,_0x5498eb){var _0x15db36={'raw':![],'where':{'id':_0x3cf767[_0x444b('0x56')]['id']}},_0x4e824f={};_0x4e824f[_0x444b('0x40')]=_[_0x444b('0x42')](db[_0x444b('0x3c')][_0x444b('0x3d')]);_0x4e824f[_0x444b('0x41')]=_[_0x444b('0x42')](_0x3cf767[_0x444b('0x41')]);_0x4e824f['filters']=_[_0x444b('0x44')](_0x4e824f[_0x444b('0x40')],_0x4e824f[_0x444b('0x41')]);_0x15db36[_0x444b('0x45')]=_[_0x444b('0x44')](_0x4e824f[_0x444b('0x40')],qs[_0x444b('0x46')](_0x3cf767[_0x444b('0x41')]['fields']));_0x15db36[_0x444b('0x45')]=_0x15db36[_0x444b('0x45')][_0x444b('0x47')]?_0x15db36[_0x444b('0x45')]:_0x4e824f[_0x444b('0x40')];if(_0x3cf767[_0x444b('0x41')][_0x444b('0x57')]){_0x15db36[_0x444b('0x52')]=[{'all':!![]}];}_0x15db36=_[_0x444b('0x4e')]({},_0x15db36,_0x3cf767['options']);return db[_0x444b('0x3c')]['find'](_0x15db36)[_0x444b('0x35')](handleEntityNotFound(_0x5498eb,null))[_0x444b('0x35')](respondWithResult(_0x5498eb,null))[_0x444b('0x58')](handleError(_0x5498eb,null));};exports[_0x444b('0x59')]=function(_0x149370,_0x27fb9a){return db['VtigerConfiguration'][_0x444b('0x59')](_0x149370[_0x444b('0x5a')],{})[_0x444b('0x35')](respondWithResult(_0x27fb9a,0xc9))[_0x444b('0x58')](handleError(_0x27fb9a,null));};exports[_0x444b('0x33')]=function(_0x4d10c0,_0x2ed4c4){if(_0x4d10c0[_0x444b('0x5a')]['id']){delete _0x4d10c0['body']['id'];}return db['VtigerConfiguration'][_0x444b('0x5b')]({'where':{'id':_0x4d10c0[_0x444b('0x56')]['id']}})[_0x444b('0x35')](handleEntityNotFound(_0x2ed4c4,null))['then'](saveUpdates(_0x4d10c0[_0x444b('0x5a')],null))[_0x444b('0x35')](respondWithResult(_0x2ed4c4,null))[_0x444b('0x58')](handleError(_0x2ed4c4,null));};exports['destroy']=function(_0x88bdeb,_0x1508a1){return db[_0x444b('0x3c')][_0x444b('0x5b')]({'where':{'id':_0x88bdeb['params']['id']}})['then'](handleEntityNotFound(_0x1508a1,null))[_0x444b('0x35')](removeEntity(_0x1508a1,null))[_0x444b('0x58')](handleError(_0x1508a1,null));};exports['getFields']=function(_0x44c73b,_0xca3e9d,_0x5783fe){var _0x2e9121={};var _0x1d7190={};var _0x485421;var _0x51c826;return db[_0x444b('0x3c')][_0x444b('0x5c')]({'where':{'id':_0x44c73b[_0x444b('0x56')]['id']}})[_0x444b('0x35')](handleEntityNotFound(_0xca3e9d,null))[_0x444b('0x35')](function(_0x28984){if(_0x28984){_0x485421=_0x28984;_0x1d7190[_0x444b('0x40')]=_['keys'](db[_0x444b('0x5d')]['rawAttributes']);_0x1d7190[_0x444b('0x41')]=_[_0x444b('0x42')](_0x44c73b[_0x444b('0x41')]);_0x1d7190['filters']=_[_0x444b('0x44')](_0x1d7190['model'],_0x1d7190[_0x444b('0x41')]);_0x2e9121[_0x444b('0x45')]=_['intersection'](_0x1d7190[_0x444b('0x40')],qs[_0x444b('0x46')](_0x44c73b[_0x444b('0x41')][_0x444b('0x46')]));_0x2e9121[_0x444b('0x45')]=_0x2e9121[_0x444b('0x45')][_0x444b('0x47')]?_0x2e9121[_0x444b('0x45')]:_0x1d7190['model'];_0x2e9121[_0x444b('0x49')]=qs[_0x444b('0x4a')](_0x44c73b['query']['sort']);_0x2e9121[_0x444b('0x4d')]=qs[_0x444b('0x43')](_[_0x444b('0x4b')](_0x44c73b[_0x444b('0x41')],_0x1d7190[_0x444b('0x43')]));if(_0x44c73b['query']['filter']){_0x2e9121[_0x444b('0x4d')]=_['merge'](_0x2e9121[_0x444b('0x4d')],{'$or':_['map'](_0x2e9121[_0x444b('0x45')],function(_0x189531){var _0x4e612e={};_0x4e612e[_0x189531]={'$like':'%'+_0x44c73b[_0x444b('0x41')]['filter']+'%'};return _0x4e612e;})});}_0x2e9121=_[_0x444b('0x4e')]({},_0x2e9121,_0x44c73b[_0x444b('0x50')]);return _0x485421[_0x444b('0x5e')](_0x2e9121);}})[_0x444b('0x35')](function(_0x498424){if(_0x498424){_0x51c826=_0x498424[_0x444b('0x47')];if(!_0x44c73b[_0x444b('0x41')]['hasOwnProperty'](_0x444b('0x48'))){_0x2e9121[_0x444b('0x2f')]=qs[_0x444b('0x2f')](_0x44c73b[_0x444b('0x41')][_0x444b('0x2f')]);_0x2e9121[_0x444b('0x2e')]=qs['offset'](_0x44c73b[_0x444b('0x41')][_0x444b('0x2e')]);}return _0x485421[_0x444b('0x5e')](_0x2e9121);}})['then'](function(_0x4aa7e2){if(_0x4aa7e2){return _0x4aa7e2?{'count':_0x51c826,'rows':_0x4aa7e2}:null;}})[_0x444b('0x35')](respondWithResult(_0xca3e9d,null))['catch'](handleError(_0xca3e9d,null));};exports[_0x444b('0x5f')]=function(_0x118be2,_0x53577c,_0x33495b){var _0x3cbbfb={};var _0x31878f={};var _0x6846c7;var _0x26728a;return db[_0x444b('0x3c')]['findOne']({'where':{'id':_0x118be2[_0x444b('0x56')]['id']}})[_0x444b('0x35')](handleEntityNotFound(_0x53577c,null))[_0x444b('0x35')](function(_0xc6d1b7){if(_0xc6d1b7){_0x6846c7=_0xc6d1b7;_0x31878f[_0x444b('0x40')]=_[_0x444b('0x42')](db[_0x444b('0x5d')][_0x444b('0x3d')]);_0x31878f['query']=_[_0x444b('0x42')](_0x118be2[_0x444b('0x41')]);_0x31878f[_0x444b('0x43')]=_[_0x444b('0x44')](_0x31878f[_0x444b('0x40')],_0x31878f[_0x444b('0x41')]);_0x3cbbfb['attributes']=_[_0x444b('0x44')](_0x31878f['model'],qs[_0x444b('0x46')](_0x118be2['query'][_0x444b('0x46')]));_0x3cbbfb[_0x444b('0x45')]=_0x3cbbfb[_0x444b('0x45')][_0x444b('0x47')]?_0x3cbbfb[_0x444b('0x45')]:_0x31878f[_0x444b('0x40')];_0x3cbbfb[_0x444b('0x49')]=qs[_0x444b('0x4a')](_0x118be2[_0x444b('0x41')][_0x444b('0x4a')]);_0x3cbbfb[_0x444b('0x4d')]=qs[_0x444b('0x43')](_[_0x444b('0x4b')](_0x118be2['query'],_0x31878f['filters']));if(_0x118be2['query']['filter']){_0x3cbbfb[_0x444b('0x4d')]=_['merge'](_0x3cbbfb[_0x444b('0x4d')],{'$or':_[_0x444b('0x3b')](_0x3cbbfb[_0x444b('0x45')],function(_0x58e4c4){var _0x3378ce={};_0x3378ce[_0x58e4c4]={'$like':'%'+_0x118be2[_0x444b('0x41')]['filter']+'%'};return _0x3378ce;})});}_0x3cbbfb=_[_0x444b('0x4e')]({},_0x3cbbfb,_0x118be2[_0x444b('0x50')]);return _0x6846c7['getSubjects'](_0x3cbbfb);}})[_0x444b('0x35')](function(_0x5745ff){if(_0x5745ff){_0x26728a=_0x5745ff[_0x444b('0x47')];if(!_0x118be2[_0x444b('0x41')][_0x444b('0x60')](_0x444b('0x48'))){_0x3cbbfb[_0x444b('0x2f')]=qs['limit'](_0x118be2['query'][_0x444b('0x2f')]);_0x3cbbfb[_0x444b('0x2e')]=qs[_0x444b('0x2e')](_0x118be2[_0x444b('0x41')][_0x444b('0x2e')]);}return _0x6846c7['getSubjects'](_0x3cbbfb);}})[_0x444b('0x35')](function(_0x14abf7){if(_0x14abf7){return _0x14abf7?{'count':_0x26728a,'rows':_0x14abf7}:null;}})[_0x444b('0x35')](respondWithResult(_0x53577c,null))['catch'](handleError(_0x53577c,null));};exports[_0x444b('0x61')]=function(_0x2b045e,_0x4d10fe,_0x9cfd4a){var _0xae42c2={};var _0x18c608={};var _0x507ecb;var _0x29458e;return db['VtigerConfiguration'][_0x444b('0x5c')]({'where':{'id':_0x2b045e['params']['id']}})[_0x444b('0x35')](handleEntityNotFound(_0x4d10fe,null))['then'](function(_0x6d060){if(_0x6d060){_0x507ecb=_0x6d060;_0x18c608['model']=_[_0x444b('0x42')](db[_0x444b('0x5d')][_0x444b('0x3d')]);_0x18c608['query']=_[_0x444b('0x42')](_0x2b045e[_0x444b('0x41')]);_0x18c608['filters']=_['intersection'](_0x18c608[_0x444b('0x40')],_0x18c608[_0x444b('0x41')]);_0xae42c2['attributes']=_['intersection'](_0x18c608[_0x444b('0x40')],qs[_0x444b('0x46')](_0x2b045e['query'][_0x444b('0x46')]));_0xae42c2[_0x444b('0x45')]=_0xae42c2[_0x444b('0x45')][_0x444b('0x47')]?_0xae42c2[_0x444b('0x45')]:_0x18c608[_0x444b('0x40')];_0xae42c2[_0x444b('0x49')]=qs['sort'](_0x2b045e[_0x444b('0x41')][_0x444b('0x4a')]);_0xae42c2[_0x444b('0x4d')]=qs[_0x444b('0x43')](_[_0x444b('0x4b')](_0x2b045e[_0x444b('0x41')],_0x18c608[_0x444b('0x43')]));if(_0x2b045e[_0x444b('0x41')][_0x444b('0x4c')]){_0xae42c2[_0x444b('0x4d')]=_[_0x444b('0x4e')](_0xae42c2['where'],{'$or':_['map'](_0xae42c2[_0x444b('0x45')],function(_0xb46fe2){var _0x24fed3={};_0x24fed3[_0xb46fe2]={'$like':'%'+_0x2b045e[_0x444b('0x41')][_0x444b('0x4c')]+'%'};return _0x24fed3;})});}_0xae42c2=_['merge']({},_0xae42c2,_0x2b045e[_0x444b('0x50')]);return _0x507ecb[_0x444b('0x61')](_0xae42c2);}})[_0x444b('0x35')](function(_0xb0fd5b){if(_0xb0fd5b){_0x29458e=_0xb0fd5b[_0x444b('0x47')];if(!_0x2b045e[_0x444b('0x41')]['hasOwnProperty'](_0x444b('0x48'))){_0xae42c2[_0x444b('0x2f')]=qs[_0x444b('0x2f')](_0x2b045e['query'][_0x444b('0x2f')]);_0xae42c2['offset']=qs[_0x444b('0x2e')](_0x2b045e[_0x444b('0x41')][_0x444b('0x2e')]);}return _0x507ecb[_0x444b('0x61')](_0xae42c2);}})['then'](function(_0xd2544a){if(_0xd2544a){return _0xd2544a?{'count':_0x29458e,'rows':_0xd2544a}:null;}})[_0x444b('0x35')](respondWithResult(_0x4d10fe,null))['catch'](handleError(_0x4d10fe,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 79689b7..47731c1 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 _0x0daa=['moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x8e0cc0,_0x2df700){var _0x54b84f=function(_0x39daf8){while(--_0x39daf8){_0x8e0cc0['push'](_0x8e0cc0['shift']());}};_0x54b84f(++_0x2df700);}(_0x0daa,0x1eb));var _0xa0da=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0daa[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa0da('0x0'));var util=require(_0xa0da('0x1'));var logger=require(_0xa0da('0x2'))('api');var moment=require(_0xa0da('0x3'));var BPromise=require(_0xa0da('0x4'));var rp=require(_0xa0da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0da('0x6'));var config=require(_0xa0da('0x7'));var attributes=require(_0xa0da('0x8'));module[_0xa0da('0x9')]=function(_0x354af1,_0x4b56f7){return _0x354af1[_0xa0da('0xa')](_0xa0da('0xb'),attributes,{'tableName':_0xa0da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43a7=['request-promise','path','rimraf','../../config/environment','define','int_vtiger_configurations','lodash','moment','bluebird'];(function(_0x34f545,_0x2bd2ee){var _0x1ff6b8=function(_0x582e3b){while(--_0x582e3b){_0x34f545['push'](_0x34f545['shift']());}};_0x1ff6b8(++_0x2bd2ee);}(_0x43a7,0x153));var _0x743a=function(_0x5222d9,_0x12496d){_0x5222d9=_0x5222d9-0x0;var _0x16b0d5=_0x43a7[_0x5222d9];return _0x16b0d5;};'use strict';var _=require(_0x743a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x743a('0x1'));var BPromise=require(_0x743a('0x2'));var rp=require(_0x743a('0x3'));var fs=require('fs');var path=require(_0x743a('0x4'));var rimraf=require(_0x743a('0x5'));var config=require(_0x743a('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x117a03,_0x12c183){return _0x117a03[_0x743a('0x7')]('VtigerConfiguration',attributes,{'tableName':_0x743a('0x8'),'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 c8dc898..a47674e 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 _0x2dd1=['jayson/promise','http','then','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x13a03e,_0x5c45d4){var _0x1bad9f=function(_0x40cb4b){while(--_0x40cb4b){_0x13a03e['push'](_0x13a03e['shift']());}};_0x1bad9f(++_0x5c45d4);}(_0x2dd1,0x15c));var _0x12dd=function(_0x2c7c79,_0x24027c){_0x2c7c79=_0x2c7c79-0x0;var _0x6ddb2e=_0x2dd1[_0x2c7c79];return _0x6ddb2e;};'use strict';var _=require(_0x12dd('0x0'));var util=require(_0x12dd('0x1'));var moment=require(_0x12dd('0x2'));var BPromise=require(_0x12dd('0x3'));var rs=require(_0x12dd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12dd('0x5'))['db'];var utils=require(_0x12dd('0x6'));var logger=require(_0x12dd('0x7'))(_0x12dd('0x8'));var config=require('../../config/environment');var jayson=require(_0x12dd('0x9'));var client=jayson['client'][_0x12dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10d2bc,_0x1c6100,_0x31901e){return new BPromise(function(_0x16abed,_0x3853b5){return client['request'](_0x10d2bc,_0x31901e)[_0x12dd('0xb')](function(_0x5b4d27){logger['info'](_0x12dd('0xc'),_0x1c6100,'request\x20sent');logger[_0x12dd('0xd')](_0x12dd('0xe'),_0x1c6100,_0x12dd('0xf'),JSON['stringify'](_0x5b4d27));if(_0x5b4d27['error']){if(_0x5b4d27[_0x12dd('0x10')][_0x12dd('0x11')]===0x1f4){logger[_0x12dd('0x10')](_0x12dd('0xc'),_0x1c6100,_0x5b4d27[_0x12dd('0x10')][_0x12dd('0x12')]);return _0x3853b5(_0x5b4d27[_0x12dd('0x10')]['message']);}logger[_0x12dd('0x10')](_0x12dd('0xc'),_0x1c6100,_0x5b4d27[_0x12dd('0x10')]['message']);return _0x16abed(_0x5b4d27[_0x12dd('0x10')]['message']);}else{logger[_0x12dd('0x13')](_0x12dd('0xc'),_0x1c6100,_0x12dd('0xf'));_0x16abed(_0x5b4d27[_0x12dd('0x14')][_0x12dd('0x12')]);}})['catch'](function(_0x5e6b38){logger[_0x12dd('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x1c6100,_0x5e6b38);_0x3853b5(_0x5e6b38);});});} \ No newline at end of file +var _0x80eb=['request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0x80eb,0x6b));var _0xb80e=function(_0x127948,_0x57d306){_0x127948=_0x127948-0x0;var _0x347e11=_0x80eb[_0x127948];return _0x347e11;};'use strict';var _=require(_0xb80e('0x0'));var util=require(_0xb80e('0x1'));var moment=require(_0xb80e('0x2'));var BPromise=require(_0xb80e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb80e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb80e('0x5'))(_0xb80e('0x6'));var config=require('../../config/environment');var jayson=require(_0xb80e('0x7'));var client=jayson[_0xb80e('0x8')][_0xb80e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3592e1,_0x255778,_0x37cf63){return new BPromise(function(_0x1e7efa,_0x57ea84){return client[_0xb80e('0xa')](_0x3592e1,_0x37cf63)[_0xb80e('0xb')](function(_0x3421bb){logger['info'](_0xb80e('0xc'),_0x255778,_0xb80e('0xd'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x255778,'request\x20sent',JSON[_0xb80e('0xe')](_0x3421bb));if(_0x3421bb['error']){if(_0x3421bb[_0xb80e('0xf')][_0xb80e('0x10')]===0x1f4){logger['error'](_0xb80e('0xc'),_0x255778,_0x3421bb[_0xb80e('0xf')][_0xb80e('0x11')]);return _0x57ea84(_0x3421bb[_0xb80e('0xf')][_0xb80e('0x11')]);}logger[_0xb80e('0xf')](_0xb80e('0xc'),_0x255778,_0x3421bb[_0xb80e('0xf')][_0xb80e('0x11')]);return _0x1e7efa(_0x3421bb[_0xb80e('0xf')][_0xb80e('0x11')]);}else{logger[_0xb80e('0x12')](_0xb80e('0xc'),_0x255778,_0xb80e('0xd'));_0x1e7efa(_0x3421bb[_0xb80e('0x13')][_0xb80e('0x11')]);}})['catch'](function(_0x112b72){logger['error'](_0xb80e('0xc'),_0x255778,_0x112b72);_0x57ea84(_0x112b72);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index a35fd18..3c1c6b7 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 _0xfb0a=['multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','get','show','post','create','put','/:id','exports'];(function(_0x45c5ae,_0x30be9){var _0x2a46db=function(_0xa85828){while(--_0xa85828){_0x45c5ae['push'](_0x45c5ae['shift']());}};_0x2a46db(++_0x30be9);}(_0xfb0a,0xd2));var _0xafb0=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xfb0a[_0x43f881];return _0x365c14;};'use strict';var multer=require(_0xafb0('0x0'));var util=require('util');var path=require(_0xafb0('0x1'));var timeout=require(_0xafb0('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xafb0('0x3'));var interaction=require(_0xafb0('0x4'));var config=require(_0xafb0('0x5'));var controller=require(_0xafb0('0x6'));router['get']('/',auth[_0xafb0('0x7')](),controller['index']);router[_0xafb0('0x8')]('/:id',auth[_0xafb0('0x7')](),controller[_0xafb0('0x9')]);router[_0xafb0('0xa')]('/',auth[_0xafb0('0x7')](),controller[_0xafb0('0xb')]);router[_0xafb0('0xc')](_0xafb0('0xd'),auth[_0xafb0('0x7')](),controller['update']);router['delete'](_0xafb0('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xafb0('0xe')]=router; \ No newline at end of file +var _0x445b=['../../components/auth/service','./intVtigerField.controller','get','isAuthenticated','show','post','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x445b,0x12d));var _0xb445=function(_0x1db9c9,_0x363be4){_0x1db9c9=_0x1db9c9-0x0;var _0x5954e3=_0x445b[_0x1db9c9];return _0x5954e3;};'use strict';var multer=require(_0xb445('0x0'));var util=require(_0xb445('0x1'));var path=require('path');var timeout=require(_0xb445('0x2'));var express=require(_0xb445('0x3'));var router=express[_0xb445('0x4')]();var auth=require(_0xb445('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb445('0x6'));router[_0xb445('0x7')]('/',auth[_0xb445('0x8')](),controller['index']);router[_0xb445('0x7')]('/:id',auth[_0xb445('0x8')](),controller[_0xb445('0x9')]);router[_0xb445('0xa')]('/',auth[_0xb445('0x8')](),controller['create']);router[_0xb445('0xb')]('/:id',auth[_0xb445('0x8')](),controller[_0xb445('0xc')]);router[_0xb445('0xd')](_0xb445('0xe'),auth[_0xb445('0x8')](),controller[_0xb445('0xf')]);module[_0xb445('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 23f2b14..941ab90 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 _0xd01a=['string','customVariable','keyValue','variable','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x4bc98b,_0x356c04){var _0x4308ee=function(_0x2d163d){while(--_0x2d163d){_0x4bc98b['push'](_0x4bc98b['shift']());}};_0x4308ee(++_0x356c04);}(_0xd01a,0x1ae));var _0xad01=function(_0x3ed0e0,_0x48547e){_0x3ed0e0=_0x3ed0e0-0x0;var _0x5c6628=_0xd01a[_0x3ed0e0];return _0x5c6628;};'use strict';var Sequelize=require(_0xad01('0x0'));module['exports']={'type':{'type':Sequelize[_0xad01('0x1')](_0xad01('0x2'),'variable',_0xad01('0x3'),_0xad01('0x4')),'defaultValue':_0xad01('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xad01('0x1')](_0xad01('0x2'),_0xad01('0x5'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xad01('0x6')]},'nameField':{'type':Sequelize[_0xad01('0x6')]},'customField':{'type':Sequelize[_0xad01('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xad01('0x6')]}}; \ No newline at end of file +var _0x9f29=['variable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x20c9b9,_0x1990d1){var _0x4e7603=function(_0x3f7ab0){while(--_0x3f7ab0){_0x20c9b9['push'](_0x20c9b9['shift']());}};_0x4e7603(++_0x1990d1);}(_0x9f29,0x64));var _0x99f2=function(_0x14593a,_0x5c80a7){_0x14593a=_0x14593a-0x0;var _0x3720b9=_0x9f29[_0x14593a];return _0x3720b9;};'use strict';var Sequelize=require(_0x99f2('0x0'));module[_0x99f2('0x1')]={'type':{'type':Sequelize[_0x99f2('0x2')](_0x99f2('0x3'),_0x99f2('0x4'),'customVariable',_0x99f2('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x99f2('0x2')]('string',_0x99f2('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x99f2('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x99f2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x99f2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index b6cc1c8..769db86 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 _0x199c=['stack','send','index','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','VtigerField','findAll','rows','params','fields','find','create','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x199c,0x1d8));var _0xc199=function(_0x4c69ca,_0x2e2245){_0x4c69ca=_0x4c69ca-0x0;var _0x2a6d65=_0x199c[_0x4c69ca];return _0x2a6d65;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc199('0x0'));var zipdir=require(_0xc199('0x1'));var jsonpatch=require(_0xc199('0x2'));var rp=require(_0xc199('0x3'));var moment=require(_0xc199('0x4'));var BPromise=require(_0xc199('0x5'));var Mustache=require(_0xc199('0x6'));var util=require(_0xc199('0x7'));var path=require('path');var sox=require(_0xc199('0x8'));var csv=require(_0xc199('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc199('0xa'));var crypto=require(_0xc199('0xb'));var jsforce=require(_0xc199('0xc'));var deskjs=require(_0xc199('0xd'));var toCsv=require(_0xc199('0x9'));var querystring=require(_0xc199('0xe'));var Papa=require(_0xc199('0xf'));var Redis=require(_0xc199('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc199('0x11'));var as=require(_0xc199('0x12'));var hardwareService=require(_0xc199('0x13'));var logger=require(_0xc199('0x14'))(_0xc199('0x15'));var utils=require(_0xc199('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc199('0x17'));var db=require(_0xc199('0x18'))['db'];function respondWithStatusCode(_0x34fde3,_0x13b4fa){_0x13b4fa=_0x13b4fa||0xcc;return function(_0x3c3cf9){if(_0x3c3cf9){return _0x34fde3['sendStatus'](_0x13b4fa);}return _0x34fde3[_0xc199('0x19')](_0x13b4fa)[_0xc199('0x1a')]();};}function respondWithResult(_0x67c1ed,_0x62f34e){_0x62f34e=_0x62f34e||0xc8;return function(_0x427698){if(_0x427698){return _0x67c1ed['status'](_0x62f34e)['json'](_0x427698);}};}function respondWithFilteredResult(_0x269ab4,_0x5a8e99){return function(_0x58d871){if(_0x58d871){var _0x3c4736=_0x58d871[_0xc199('0x1b')],_0x5a4381=_0x5a8e99[_0xc199('0x1c')],_0x445c65=_0x5a8e99[_0xc199('0x1c')]+_0x5a8e99[_0xc199('0x1d')],_0x4f268d;if(_0x445c65>=_0x3c4736){_0x445c65=_0x3c4736;_0x4f268d=0xc8;}else{_0x4f268d=0xce;}_0x269ab4[_0xc199('0x19')](_0x4f268d);return _0x269ab4[_0xc199('0x1e')](_0xc199('0x1f'),_0x5a4381+'-'+_0x445c65+'/'+_0x3c4736)[_0xc199('0x20')](_0x58d871);}return null;};}function patchUpdates(_0x2c953f){return function(_0x14e969){try{jsonpatch[_0xc199('0x21')](_0x14e969,_0x2c953f,!![]);}catch(_0x54babd){return BPromise[_0xc199('0x22')](_0x54babd);}return _0x14e969[_0xc199('0x23')]();};}function saveUpdates(_0xe0b173,_0x430e4c){return function(_0x4e176b){if(_0x4e176b){return _0x4e176b[_0xc199('0x24')](_0xe0b173)[_0xc199('0x25')](function(_0x381c94){return _0x381c94;});}return null;};}function removeEntity(_0x349dd9,_0x45873f){return function(_0x5c34e8){if(_0x5c34e8){return _0x5c34e8['destroy']()['then'](function(){_0x349dd9[_0xc199('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30f576,_0x5cefd7){return function(_0x3bf1a5){if(!_0x3bf1a5){_0x30f576[_0xc199('0x26')](0x194);}return _0x3bf1a5;};}function handleError(_0x4e0306,_0x2d184d){_0x2d184d=_0x2d184d||0x1f4;return function(_0x838760){logger['error'](_0x838760[_0xc199('0x27')]);if(_0x838760['name']){delete _0x838760['name'];}_0x4e0306[_0xc199('0x19')](_0x2d184d)[_0xc199('0x28')](_0x838760);};}exports[_0xc199('0x29')]=function(_0x4d795f,_0x2ed565){var _0x138443={},_0x5bd0bc={},_0x2825c8={'count':0x0,'rows':[]};var _0x5ea29e=_[_0xc199('0x2a')](db['VtigerField'][_0xc199('0x2b')],function(_0x13e53e){return{'name':_0x13e53e[_0xc199('0x2c')],'type':_0x13e53e[_0xc199('0x2d')][_0xc199('0x2e')]};});_0x5bd0bc[_0xc199('0x2f')]=_[_0xc199('0x2a')](_0x5ea29e,_0xc199('0x30'));_0x5bd0bc['query']=_[_0xc199('0x31')](_0x4d795f[_0xc199('0x32')]);_0x5bd0bc[_0xc199('0x33')]=_['intersection'](_0x5bd0bc[_0xc199('0x2f')],_0x5bd0bc['query']);_0x138443['attributes']=_[_0xc199('0x34')](_0x5bd0bc[_0xc199('0x2f')],qs['fields'](_0x4d795f[_0xc199('0x32')]['fields']));_0x138443['attributes']=_0x138443[_0xc199('0x35')]['length']?_0x138443[_0xc199('0x35')]:_0x5bd0bc[_0xc199('0x2f')];if(!_0x4d795f[_0xc199('0x32')][_0xc199('0x36')](_0xc199('0x37'))){_0x138443['limit']=qs['limit'](_0x4d795f['query'][_0xc199('0x1d')]);_0x138443['offset']=qs[_0xc199('0x1c')](_0x4d795f[_0xc199('0x32')][_0xc199('0x1c')]);}_0x138443[_0xc199('0x38')]=qs[_0xc199('0x39')](_0x4d795f[_0xc199('0x32')][_0xc199('0x39')]);_0x138443[_0xc199('0x3a')]=qs[_0xc199('0x33')](_[_0xc199('0x3b')](_0x4d795f['query'],_0x5bd0bc['filters']),_0x5ea29e);if(_0x4d795f[_0xc199('0x32')][_0xc199('0x3c')]){_0x138443[_0xc199('0x3a')]=_[_0xc199('0x3d')](_0x138443[_0xc199('0x3a')],{'$or':_[_0xc199('0x2a')](_0x5ea29e,function(_0x3966d0){if(_0x3966d0[_0xc199('0x2d')]!=='VIRTUAL'){var _0x552467={};_0x552467[_0x3966d0['name']]={'$like':'%'+_0x4d795f[_0xc199('0x32')][_0xc199('0x3c')]+'%'};return _0x552467;}})});}_0x138443=_[_0xc199('0x3d')]({},_0x138443,_0x4d795f['options']);var _0x190877={'where':_0x138443[_0xc199('0x3a')]};return db['VtigerField'][_0xc199('0x1b')](_0x190877)[_0xc199('0x25')](function(_0x316766){_0x2825c8[_0xc199('0x1b')]=_0x316766;if(_0x4d795f['query'][_0xc199('0x3e')]){_0x138443[_0xc199('0x3f')]=[{'all':!![]}];}return db[_0xc199('0x40')][_0xc199('0x41')](_0x138443);})[_0xc199('0x25')](function(_0x2ffff7){_0x2825c8[_0xc199('0x42')]=_0x2ffff7;return _0x2825c8;})['then'](respondWithFilteredResult(_0x2ed565,_0x138443))['catch'](handleError(_0x2ed565,null));};exports['show']=function(_0x138448,_0x2e45d2){var _0x2089b5={'raw':!![],'where':{'id':_0x138448[_0xc199('0x43')]['id']}},_0xd464c3={};_0xd464c3['model']=_['keys'](db[_0xc199('0x40')][_0xc199('0x2b')]);_0xd464c3['query']=_['keys'](_0x138448[_0xc199('0x32')]);_0xd464c3[_0xc199('0x33')]=_['intersection'](_0xd464c3[_0xc199('0x2f')],_0xd464c3[_0xc199('0x32')]);_0x2089b5['attributes']=_[_0xc199('0x34')](_0xd464c3[_0xc199('0x2f')],qs[_0xc199('0x44')](_0x138448['query'][_0xc199('0x44')]));_0x2089b5[_0xc199('0x35')]=_0x2089b5[_0xc199('0x35')]['length']?_0x2089b5[_0xc199('0x35')]:_0xd464c3[_0xc199('0x2f')];if(_0x138448[_0xc199('0x32')]['includeAll']){_0x2089b5[_0xc199('0x3f')]=[{'all':!![]}];}_0x2089b5=_[_0xc199('0x3d')]({},_0x2089b5,_0x138448['options']);return db[_0xc199('0x40')][_0xc199('0x45')](_0x2089b5)[_0xc199('0x25')](handleEntityNotFound(_0x2e45d2,null))['then'](respondWithResult(_0x2e45d2,null))['catch'](handleError(_0x2e45d2,null));};exports[_0xc199('0x46')]=function(_0x1a6238,_0x54c0a8){return db[_0xc199('0x40')][_0xc199('0x46')](_0x1a6238['body'],{})[_0xc199('0x25')](respondWithResult(_0x54c0a8,0xc9))[_0xc199('0x47')](handleError(_0x54c0a8,null));};exports['update']=function(_0x10f418,_0xd845f7){if(_0x10f418[_0xc199('0x48')]['id']){delete _0x10f418[_0xc199('0x48')]['id'];}return db['VtigerField'][_0xc199('0x45')]({'where':{'id':_0x10f418[_0xc199('0x43')]['id']}})[_0xc199('0x25')](handleEntityNotFound(_0xd845f7,null))[_0xc199('0x25')](saveUpdates(_0x10f418['body'],null))[_0xc199('0x25')](respondWithResult(_0xd845f7,null))['catch'](handleError(_0xd845f7,null));};exports['destroy']=function(_0x18f410,_0xdfcf6a){return db[_0xc199('0x40')][_0xc199('0x45')]({'where':{'id':_0x18f410[_0xc199('0x43')]['id']}})[_0xc199('0x25')](handleEntityNotFound(_0xdfcf6a,null))[_0xc199('0x25')](removeEntity(_0xdfcf6a,null))[_0xc199('0x47')](handleError(_0xdfcf6a,null));}; \ No newline at end of file +var _0x9536=['create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','VtigerField','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','keys','find','catch'];(function(_0xfca8d,_0x4b138b){var _0x196f4a=function(_0x213d91){while(--_0x213d91){_0xfca8d['push'](_0xfca8d['shift']());}};_0x196f4a(++_0x4b138b);}(_0x9536,0x179));var _0x6953=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0x9536[_0x2307fa];return _0x496486;};'use strict';var pdf=require(_0x6953('0x0'));var emlformat=require(_0x6953('0x1'));var rimraf=require(_0x6953('0x2'));var zipdir=require(_0x6953('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6953('0x4'));var moment=require('moment');var BPromise=require(_0x6953('0x5'));var Mustache=require(_0x6953('0x6'));var util=require(_0x6953('0x7'));var path=require(_0x6953('0x8'));var sox=require(_0x6953('0x9'));var csv=require('to-csv');var ejs=require(_0x6953('0xa'));var fs=require('fs');var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0xf'));var querystring=require(_0x6953('0x10'));var Papa=require(_0x6953('0x11'));var Redis=require('ioredis');var authService=require(_0x6953('0x12'));var qs=require(_0x6953('0x13'));var as=require(_0x6953('0x14'));var hardwareService=require(_0x6953('0x15'));var logger=require(_0x6953('0x16'))(_0x6953('0x17'));var utils=require(_0x6953('0x18'));var config=require(_0x6953('0x19'));var licenseUtil=require(_0x6953('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1b')](_0x513dd0);}return _0x358388[_0x6953('0x1c')](_0x513dd0)[_0x6953('0x1d')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1c')](_0x244713)[_0x6953('0x1e')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=_0x548473[_0x6953('0x1f')],_0x399b9b=_0xae5515['offset'],_0x44e8a2=_0xae5515[_0x6953('0x20')]+_0xae5515[_0x6953('0x21')],_0x16b79b;if(_0x44e8a2>=_0x5f49db){_0x44e8a2=_0x5f49db;_0x16b79b=0xc8;}else{_0x16b79b=0xce;}_0x31d182['status'](_0x16b79b);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x399b9b+'-'+_0x44e8a2+'/'+_0x5f49db)[_0x6953('0x1e')](_0x548473);}return null;};}function patchUpdates(_0x174c59){return function(_0xc714d3){try{jsonpatch['apply'](_0xc714d3,_0x174c59,!![]);}catch(_0x3a93e1){return BPromise[_0x6953('0x24')](_0x3a93e1);}return _0xc714d3[_0x6953('0x25')]();};}function saveUpdates(_0x2ba433,_0x41f021){return function(_0x5e33ec){if(_0x5e33ec){return _0x5e33ec[_0x6953('0x26')](_0x2ba433)[_0x6953('0x27')](function(_0x559ae3){return _0x559ae3;});}return null;};}function removeEntity(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x28')]()['then'](function(){_0x317979[_0x6953('0x1c')](0xcc)[_0x6953('0x1d')]();});}};}function handleEntityNotFound(_0x2a7f6a,_0x508ea7){return function(_0x495ebd){if(!_0x495ebd){_0x2a7f6a['sendStatus'](0x194);}return _0x495ebd;};}function handleError(_0xc85d42,_0x1bf5a9){_0x1bf5a9=_0x1bf5a9||0x1f4;return function(_0x550be4){logger[_0x6953('0x29')](_0x550be4['stack']);if(_0x550be4[_0x6953('0x2a')]){delete _0x550be4[_0x6953('0x2a')];}_0xc85d42[_0x6953('0x1c')](_0x1bf5a9)[_0x6953('0x2b')](_0x550be4);};}exports[_0x6953('0x2c')]=function(_0x1497e3,_0x53d3dc){var _0x3dd890={},_0x3c1075={},_0x527b9a={'count':0x0,'rows':[]};var _0x3be82d=_['map'](db[_0x6953('0x2d')][_0x6953('0x2e')],function(_0x426c7c){return{'name':_0x426c7c['fieldName'],'type':_0x426c7c[_0x6953('0x2f')][_0x6953('0x30')]};});_0x3c1075[_0x6953('0x31')]=_['map'](_0x3be82d,_0x6953('0x2a'));_0x3c1075[_0x6953('0x32')]=_['keys'](_0x1497e3['query']);_0x3c1075[_0x6953('0x33')]=_[_0x6953('0x34')](_0x3c1075[_0x6953('0x31')],_0x3c1075[_0x6953('0x32')]);_0x3dd890[_0x6953('0x35')]=_['intersection'](_0x3c1075[_0x6953('0x31')],qs['fields'](_0x1497e3[_0x6953('0x32')][_0x6953('0x36')]));_0x3dd890['attributes']=_0x3dd890['attributes'][_0x6953('0x37')]?_0x3dd890[_0x6953('0x35')]:_0x3c1075[_0x6953('0x31')];if(!_0x1497e3['query'][_0x6953('0x38')]('nolimit')){_0x3dd890['limit']=qs['limit'](_0x1497e3['query'][_0x6953('0x21')]);_0x3dd890[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x1497e3[_0x6953('0x32')][_0x6953('0x20')]);}_0x3dd890[_0x6953('0x39')]=qs['sort'](_0x1497e3[_0x6953('0x32')]['sort']);_0x3dd890[_0x6953('0x3a')]=qs['filters'](_[_0x6953('0x3b')](_0x1497e3[_0x6953('0x32')],_0x3c1075[_0x6953('0x33')]),_0x3be82d);if(_0x1497e3[_0x6953('0x32')]['filter']){_0x3dd890[_0x6953('0x3a')]=_[_0x6953('0x3c')](_0x3dd890[_0x6953('0x3a')],{'$or':_[_0x6953('0x3d')](_0x3be82d,function(_0x40b6ea){if(_0x40b6ea[_0x6953('0x2f')]!==_0x6953('0x3e')){var _0x81428b={};_0x81428b[_0x40b6ea[_0x6953('0x2a')]]={'$like':'%'+_0x1497e3[_0x6953('0x32')][_0x6953('0x3f')]+'%'};return _0x81428b;}})});}_0x3dd890=_['merge']({},_0x3dd890,_0x1497e3[_0x6953('0x40')]);var _0x3c03ab={'where':_0x3dd890[_0x6953('0x3a')]};return db['VtigerField']['count'](_0x3c03ab)[_0x6953('0x27')](function(_0x4b78ca){_0x527b9a['count']=_0x4b78ca;if(_0x1497e3[_0x6953('0x32')][_0x6953('0x41')]){_0x3dd890['include']=[{'all':!![]}];}return db[_0x6953('0x2d')][_0x6953('0x42')](_0x3dd890);})[_0x6953('0x27')](function(_0x419648){_0x527b9a[_0x6953('0x43')]=_0x419648;return _0x527b9a;})[_0x6953('0x27')](respondWithFilteredResult(_0x53d3dc,_0x3dd890))['catch'](handleError(_0x53d3dc,null));};exports[_0x6953('0x44')]=function(_0x2733e6,_0x30a27a){var _0x3a0104={'raw':!![],'where':{'id':_0x2733e6[_0x6953('0x45')]['id']}},_0x26d3a5={};_0x26d3a5['model']=_['keys'](db[_0x6953('0x2d')]['rawAttributes']);_0x26d3a5['query']=_[_0x6953('0x46')](_0x2733e6[_0x6953('0x32')]);_0x26d3a5[_0x6953('0x33')]=_[_0x6953('0x34')](_0x26d3a5[_0x6953('0x31')],_0x26d3a5['query']);_0x3a0104['attributes']=_[_0x6953('0x34')](_0x26d3a5[_0x6953('0x31')],qs['fields'](_0x2733e6[_0x6953('0x32')]['fields']));_0x3a0104[_0x6953('0x35')]=_0x3a0104[_0x6953('0x35')][_0x6953('0x37')]?_0x3a0104[_0x6953('0x35')]:_0x26d3a5['model'];if(_0x2733e6[_0x6953('0x32')][_0x6953('0x41')]){_0x3a0104['include']=[{'all':!![]}];}_0x3a0104=_[_0x6953('0x3c')]({},_0x3a0104,_0x2733e6[_0x6953('0x40')]);return db[_0x6953('0x2d')][_0x6953('0x47')](_0x3a0104)[_0x6953('0x27')](handleEntityNotFound(_0x30a27a,null))[_0x6953('0x27')](respondWithResult(_0x30a27a,null))[_0x6953('0x48')](handleError(_0x30a27a,null));};exports[_0x6953('0x49')]=function(_0x156785,_0x354434){return db[_0x6953('0x2d')]['create'](_0x156785[_0x6953('0x4a')],{})['then'](respondWithResult(_0x354434,0xc9))[_0x6953('0x48')](handleError(_0x354434,null));};exports[_0x6953('0x26')]=function(_0x382332,_0x4c4954){if(_0x382332[_0x6953('0x4a')]['id']){delete _0x382332[_0x6953('0x4a')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x382332[_0x6953('0x45')]['id']}})[_0x6953('0x27')](handleEntityNotFound(_0x4c4954,null))[_0x6953('0x27')](saveUpdates(_0x382332[_0x6953('0x4a')],null))[_0x6953('0x27')](respondWithResult(_0x4c4954,null))[_0x6953('0x48')](handleError(_0x4c4954,null));};exports[_0x6953('0x28')]=function(_0xd67ece,_0x2baf90){return db[_0x6953('0x2d')][_0x6953('0x47')]({'where':{'id':_0xd67ece['params']['id']}})['then'](handleEntityNotFound(_0x2baf90,null))[_0x6953('0x27')](removeEntity(_0x2baf90,null))[_0x6953('0x48')](handleError(_0x2baf90,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 9871dd2..3e55ac4 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 _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0xc6e820,_0x4ce318){var _0x5c1c25=function(_0x175669){while(--_0x175669){_0xc6e820['push'](_0xc6e820['shift']());}};_0x5c1c25(++_0x4ce318);}(_0x7a54,0x106));var _0x47a5=function(_0x5a81ee,_0x44ec44){_0x5a81ee=_0x5a81ee-0x0;var _0x512075=_0x7a54[_0x5a81ee];return _0x512075;};'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 +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_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 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 diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index c1f4e40..1553528 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 _0x887b=['request','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x32f893,_0x5b07de){var _0x26f175=function(_0x42a43f){while(--_0x42a43f){_0x32f893['push'](_0x32f893['shift']());}};_0x26f175(++_0x5b07de);}(_0x887b,0x185));var _0xb887=function(_0xbc9ca1,_0x498f2f){_0xbc9ca1=_0xbc9ca1-0x0;var _0x4cba6f=_0x887b[_0xbc9ca1];return _0x4cba6f;};'use strict';var _=require(_0xb887('0x0'));var util=require(_0xb887('0x1'));var moment=require(_0xb887('0x2'));var BPromise=require(_0xb887('0x3'));var rs=require(_0xb887('0x4'));var fs=require('fs');var Redis=require(_0xb887('0x5'));var db=require(_0xb887('0x6'))['db'];var utils=require(_0xb887('0x7'));var logger=require(_0xb887('0x8'))('rpc');var config=require(_0xb887('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x332507,_0x353587,_0x59707f){return new BPromise(function(_0x4a1c1e,_0x32ace2){return client[_0xb887('0xa')](_0x332507,_0x59707f)['then'](function(_0x49962f){logger['info'](_0xb887('0xb'),_0x353587,_0xb887('0xc'));logger['debug'](_0xb887('0xd'),_0x353587,'request\x20sent',JSON[_0xb887('0xe')](_0x49962f));if(_0x49962f[_0xb887('0xf')]){if(_0x49962f[_0xb887('0xf')][_0xb887('0x10')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x353587,_0x49962f[_0xb887('0xf')][_0xb887('0x11')]);return _0x32ace2(_0x49962f[_0xb887('0xf')][_0xb887('0x11')]);}logger[_0xb887('0xf')]('VtigerField,\x20%s,\x20%s',_0x353587,_0x49962f[_0xb887('0xf')][_0xb887('0x11')]);return _0x4a1c1e(_0x49962f[_0xb887('0xf')][_0xb887('0x11')]);}else{logger[_0xb887('0x12')](_0xb887('0xb'),_0x353587,_0xb887('0xc'));_0x4a1c1e(_0x49962f[_0xb887('0x13')][_0xb887('0x11')]);}})[_0xb887('0x14')](function(_0x2f4e2d){logger[_0xb887('0xf')]('VtigerField,\x20%s,\x20%s',_0x353587,_0x2f4e2d);_0x32ace2(_0x2f4e2d);});});} \ No newline at end of file +var _0xe820=['message','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0xe820,0xd2));var _0x0e82=function(_0xc6cb8b,_0x522a0a){_0xc6cb8b=_0xc6cb8b-0x0;var _0x1c0745=_0xe820[_0xc6cb8b];return _0x1c0745;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var moment=require(_0x0e82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e82('0x2'));var db=require(_0x0e82('0x3'))['db'];var utils=require(_0x0e82('0x4'));var logger=require('../../config/logger')(_0x0e82('0x5'));var config=require('../../config/environment');var jayson=require(_0x0e82('0x6'));var client=jayson[_0x0e82('0x7')][_0x0e82('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x328b32,_0x2a0f9b,_0x55f277){return new BPromise(function(_0x10013b,_0x33c8a2){return client[_0x0e82('0x9')](_0x328b32,_0x55f277)[_0x0e82('0xa')](function(_0x3b7792){logger['info'](_0x0e82('0xb'),_0x2a0f9b,_0x0e82('0xc'));logger[_0x0e82('0xd')](_0x0e82('0xe'),_0x2a0f9b,_0x0e82('0xc'),JSON[_0x0e82('0xf')](_0x3b7792));if(_0x3b7792[_0x0e82('0x10')]){if(_0x3b7792['error'][_0x0e82('0x11')]===0x1f4){logger[_0x0e82('0x10')](_0x0e82('0xb'),_0x2a0f9b,_0x3b7792[_0x0e82('0x10')][_0x0e82('0x12')]);return _0x33c8a2(_0x3b7792[_0x0e82('0x10')]['message']);}logger[_0x0e82('0x10')]('VtigerField,\x20%s,\x20%s',_0x2a0f9b,_0x3b7792['error'][_0x0e82('0x12')]);return _0x10013b(_0x3b7792['error']['message']);}else{logger['info'](_0x0e82('0xb'),_0x2a0f9b,'request\x20sent');_0x10013b(_0x3b7792['result'][_0x0e82('0x12')]);}})['catch'](function(_0x319303){logger[_0x0e82('0x10')](_0x0e82('0xb'),_0x2a0f9b,_0x319303);_0x33c8a2(_0x319303);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 2135b46..299c2e0 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 _0xec56=['getFields','post','create','addConfiguration','put','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x37ed49,_0x53e558){var _0x198627=function(_0x21999d){while(--_0x21999d){_0x37ed49['push'](_0x37ed49['shift']());}};_0x198627(++_0x53e558);}(_0xec56,0x1bd));var _0x6ec5=function(_0xb9aed5,_0x3b1298){_0xb9aed5=_0xb9aed5-0x0;var _0x4716e9=_0xec56[_0xb9aed5];return _0x4716e9;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var auth=require(_0x6ec5('0x4'));var interaction=require(_0x6ec5('0x5'));var config=require(_0x6ec5('0x6'));var controller=require(_0x6ec5('0x7'));router[_0x6ec5('0x8')]('/',auth[_0x6ec5('0x9')](),controller[_0x6ec5('0xa')]);router[_0x6ec5('0x8')](_0x6ec5('0xb'),auth[_0x6ec5('0x9')](),controller[_0x6ec5('0xc')]);router[_0x6ec5('0x8')](_0x6ec5('0xd'),auth[_0x6ec5('0x9')](),controller[_0x6ec5('0xe')]);router[_0x6ec5('0x8')]('/:id/fields',auth[_0x6ec5('0x9')](),controller[_0x6ec5('0xf')]);router[_0x6ec5('0x10')]('/',auth[_0x6ec5('0x9')](),controller[_0x6ec5('0x11')]);router[_0x6ec5('0x10')](_0x6ec5('0xd'),auth['isAuthenticated'](),controller[_0x6ec5('0x12')]);router[_0x6ec5('0x13')](_0x6ec5('0xb'),auth[_0x6ec5('0x9')](),controller[_0x6ec5('0x14')]);router[_0x6ec5('0x15')](_0x6ec5('0xb'),auth[_0x6ec5('0x9')](),controller['destroy']);module[_0x6ec5('0x16')]=router; \ No newline at end of file +var _0x6f2d=['../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x33990e,_0x27b1f4){var _0x366423=function(_0x488cf4){while(--_0x488cf4){_0x33990e['push'](_0x33990e['shift']());}};_0x366423(++_0x27b1f4);}(_0x6f2d,0x182));var _0xd6f2=function(_0xff508,_0x16cdf0){_0xff508=_0xff508-0x0;var _0x49638e=_0x6f2d[_0xff508];return _0x49638e;};'use strict';var multer=require(_0xd6f2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd6f2('0x1'));var express=require('express');var router=express[_0xd6f2('0x2')]();var auth=require(_0xd6f2('0x3'));var interaction=require(_0xd6f2('0x4'));var config=require(_0xd6f2('0x5'));var controller=require(_0xd6f2('0x6'));router[_0xd6f2('0x7')]('/',auth[_0xd6f2('0x8')](),controller[_0xd6f2('0x9')]);router[_0xd6f2('0x7')](_0xd6f2('0xa'),auth[_0xd6f2('0x8')](),controller[_0xd6f2('0xb')]);router[_0xd6f2('0x7')](_0xd6f2('0xc'),auth[_0xd6f2('0x8')](),controller[_0xd6f2('0xd')]);router[_0xd6f2('0x7')](_0xd6f2('0xe'),auth[_0xd6f2('0x8')](),controller[_0xd6f2('0xf')]);router[_0xd6f2('0x10')]('/',auth[_0xd6f2('0x8')](),controller['create']);router[_0xd6f2('0x10')](_0xd6f2('0xc'),auth[_0xd6f2('0x8')](),controller[_0xd6f2('0x11')]);router[_0xd6f2('0x12')](_0xd6f2('0xa'),auth[_0xd6f2('0x8')](),controller[_0xd6f2('0x13')]);router[_0xd6f2('0x14')](_0xd6f2('0xa'),auth[_0xd6f2('0x8')](),controller[_0xd6f2('0x15')]);module[_0xd6f2('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 33cfb7a..547765f 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 _0x2935=['token','integrationTab','newTab','sequelize','STRING','remoteUri','ENUM','password'];(function(_0x576811,_0x25ff72){var _0x4d66d6=function(_0x1b454e){while(--_0x1b454e){_0x576811['push'](_0x576811['shift']());}};_0x4d66d6(++_0x25ff72);}(_0x2935,0xd3));var _0x5293=function(_0x4d1672,_0x4fc2af){_0x4d1672=_0x4d1672-0x0;var _0x3bbb42=_0x2935[_0x4d1672];return _0x3bbb42;};'use strict';var Sequelize=require(_0x5293('0x0'));module['exports']={'name':{'type':Sequelize[_0x5293('0x1')]},'description':{'type':Sequelize[_0x5293('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x5293('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5293('0x1')],'unique':_0x5293('0x2')},'authType':{'type':Sequelize[_0x5293('0x3')](_0x5293('0x4'),_0x5293('0x5')),'defaultValue':_0x5293('0x4')},'serverUrl':{'type':Sequelize[_0x5293('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5293('0x6'),_0x5293('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x8de7=['newTab','sequelize','STRING','remoteUri','ENUM','password','token','integrationTab'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8de7,0x1e9));var _0x78de=function(_0xfa90d9,_0xbfc095){_0xfa90d9=_0xfa90d9-0x0;var _0x5cbcc9=_0x8de7[_0xfa90d9];return _0x5cbcc9;};'use strict';var Sequelize=require(_0x78de('0x0'));module['exports']={'name':{'type':Sequelize[_0x78de('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x78de('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x78de('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x78de('0x2')},'authType':{'type':Sequelize[_0x78de('0x3')](_0x78de('0x4'),_0x78de('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x78de('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x78de('0x3')](_0x78de('0x6'),_0x78de('0x7')),'defaultValue':_0x78de('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 6c6ad38..56694d8 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 _0x56dc=['util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','sendStatus','status','json','count','offset','set','Content-Range','apply','update','then','destroy','stack','name','send','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','order','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','username','base64','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','title','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x176aa8,_0x5ec010){var _0x9082b5=function(_0x13da01){while(--_0x13da01){_0x176aa8['push'](_0x176aa8['shift']());}};_0x9082b5(++_0x5ec010);}(_0x56dc,0xfd));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc56d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc56d('0x1'));var zipdir=require(_0xc56d('0x2'));var jsonpatch=require(_0xc56d('0x3'));var rp=require(_0xc56d('0x4'));var moment=require(_0xc56d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc56d('0x6'));var util=require(_0xc56d('0x7'));var path=require(_0xc56d('0x8'));var sox=require(_0xc56d('0x9'));var csv=require(_0xc56d('0xa'));var ejs=require(_0xc56d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc56d('0xc'));var crypto=require(_0xc56d('0xd'));var jsforce=require(_0xc56d('0xe'));var deskjs=require(_0xc56d('0xf'));var toCsv=require(_0xc56d('0xa'));var querystring=require(_0xc56d('0x10'));var Papa=require(_0xc56d('0x11'));var Redis=require(_0xc56d('0x12'));var authService=require(_0xc56d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc56d('0x14'));var hardwareService=require(_0xc56d('0x15'));var logger=require(_0xc56d('0x16'))('api');var utils=require(_0xc56d('0x17'));var config=require(_0xc56d('0x18'));var licenseUtil=require(_0xc56d('0x19'));var db=require(_0xc56d('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xc56d('0x1b'));var client=jayson[_0xc56d('0x1c')][_0xc56d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4b60cd,_0x433b4b,_0x3c0bb5,_0xf3e4eb){return new BPromise(function(_0x13a712,_0x525da1){var _0x2eefa6=_0xf3e4eb||client;return _0x2eefa6[_0xc56d('0x1e')](_0x4b60cd,_0x3c0bb5)['then'](function(_0x4c5651){logger[_0xc56d('0x1f')](_0xc56d('0x20'),_0x433b4b,_0xc56d('0x21'));logger[_0xc56d('0x22')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x433b4b,_0xc56d('0x21'),JSON['stringify'](_0x4c5651));if(_0x4c5651[_0xc56d('0x23')]){if(_0x4c5651[_0xc56d('0x23')]['code']===0x1f4){logger[_0xc56d('0x23')](_0xc56d('0x20'),_0x433b4b,_0x4c5651[_0xc56d('0x23')][_0xc56d('0x24')]);return _0x525da1(_0x4c5651[_0xc56d('0x23')]['message']);}logger[_0xc56d('0x23')](_0xc56d('0x20'),_0x433b4b,_0x4c5651[_0xc56d('0x23')][_0xc56d('0x24')]);return _0x13a712(_0x4c5651['error']['message']);}else{logger['info'](_0xc56d('0x20'),_0x433b4b,_0xc56d('0x21'));_0x13a712(_0x4c5651[_0xc56d('0x25')]['message']);}})['catch'](function(_0xfabb4d){logger[_0xc56d('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x433b4b,_0xfabb4d);_0x525da1(_0xfabb4d);});});}function respondWithStatusCode(_0x446792,_0x41e336){_0x41e336=_0x41e336||0xcc;return function(_0x29f065){if(_0x29f065){return _0x446792[_0xc56d('0x26')](_0x41e336);}return _0x446792['status'](_0x41e336)['end']();};}function respondWithResult(_0x2a769c,_0x30eacf){_0x30eacf=_0x30eacf||0xc8;return function(_0x5405a8){if(_0x5405a8){return _0x2a769c[_0xc56d('0x27')](_0x30eacf)[_0xc56d('0x28')](_0x5405a8);}};}function respondWithFilteredResult(_0x20ab1c,_0x4d4b8e){return function(_0x29e8e2){if(_0x29e8e2){var _0x2e48ae=_0x29e8e2[_0xc56d('0x29')],_0x30dbd9=_0x4d4b8e['offset'],_0x2fff7c=_0x4d4b8e[_0xc56d('0x2a')]+_0x4d4b8e['limit'],_0x10b384;if(_0x2fff7c>=_0x2e48ae){_0x2fff7c=_0x2e48ae;_0x10b384=0xc8;}else{_0x10b384=0xce;}_0x20ab1c[_0xc56d('0x27')](_0x10b384);return _0x20ab1c[_0xc56d('0x2b')](_0xc56d('0x2c'),_0x30dbd9+'-'+_0x2fff7c+'/'+_0x2e48ae)[_0xc56d('0x28')](_0x29e8e2);}return null;};}function patchUpdates(_0x1973b1){return function(_0x5b1543){try{jsonpatch[_0xc56d('0x2d')](_0x5b1543,_0x1973b1,!![]);}catch(_0x53faa2){return BPromise['reject'](_0x53faa2);}return _0x5b1543['save']();};}function saveUpdates(_0x296cab,_0x56326a){return function(_0x391cac){if(_0x391cac){return _0x391cac[_0xc56d('0x2e')](_0x296cab)[_0xc56d('0x2f')](function(_0x5affc6){return _0x5affc6;});}return null;};}function removeEntity(_0x3ee7d0,_0x2cc4d5){return function(_0x414531){if(_0x414531){return _0x414531[_0xc56d('0x30')]()['then'](function(){_0x3ee7d0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21c852,_0x362d74){return function(_0x4373be){if(!_0x4373be){_0x21c852[_0xc56d('0x26')](0x194);}return _0x4373be;};}function handleError(_0x3cdfab,_0x5d17cc){_0x5d17cc=_0x5d17cc||0x1f4;return function(_0x1e8988){logger[_0xc56d('0x23')](_0x1e8988[_0xc56d('0x31')]);if(_0x1e8988[_0xc56d('0x32')]){delete _0x1e8988[_0xc56d('0x32')];}_0x3cdfab[_0xc56d('0x27')](_0x5d17cc)[_0xc56d('0x33')](_0x1e8988);};}exports['index']=function(_0x1219aa,_0x47bac6){var _0x36ae22={},_0x429f9d={},_0x5a1d7f={'count':0x0,'rows':[]};var _0x3b133d=_[_0xc56d('0x34')](db[_0xc56d('0x35')][_0xc56d('0x36')],function(_0x3c8a73){return{'name':_0x3c8a73[_0xc56d('0x37')],'type':_0x3c8a73[_0xc56d('0x38')][_0xc56d('0x39')]};});_0x429f9d[_0xc56d('0x3a')]=_[_0xc56d('0x34')](_0x3b133d,_0xc56d('0x32'));_0x429f9d[_0xc56d('0x3b')]=_[_0xc56d('0x3c')](_0x1219aa[_0xc56d('0x3b')]);_0x429f9d[_0xc56d('0x3d')]=_[_0xc56d('0x3e')](_0x429f9d[_0xc56d('0x3a')],_0x429f9d[_0xc56d('0x3b')]);_0x36ae22[_0xc56d('0x3f')]=_[_0xc56d('0x3e')](_0x429f9d[_0xc56d('0x3a')],qs[_0xc56d('0x40')](_0x1219aa[_0xc56d('0x3b')][_0xc56d('0x40')]));_0x36ae22[_0xc56d('0x3f')]=_0x36ae22[_0xc56d('0x3f')][_0xc56d('0x41')]?_0x36ae22[_0xc56d('0x3f')]:_0x429f9d[_0xc56d('0x3a')];if(!_0x1219aa['query'][_0xc56d('0x42')](_0xc56d('0x43'))){_0x36ae22[_0xc56d('0x44')]=qs['limit'](_0x1219aa['query'][_0xc56d('0x44')]);_0x36ae22['offset']=qs['offset'](_0x1219aa['query']['offset']);}_0x36ae22['order']=qs[_0xc56d('0x45')](_0x1219aa[_0xc56d('0x3b')][_0xc56d('0x45')]);_0x36ae22[_0xc56d('0x46')]=qs[_0xc56d('0x3d')](_[_0xc56d('0x47')](_0x1219aa[_0xc56d('0x3b')],_0x429f9d[_0xc56d('0x3d')]),_0x3b133d);if(_0x1219aa[_0xc56d('0x3b')][_0xc56d('0x48')]){_0x36ae22['where']=_[_0xc56d('0x49')](_0x36ae22[_0xc56d('0x46')],{'$or':_[_0xc56d('0x34')](_0x3b133d,function(_0x5bcf14){if(_0x5bcf14[_0xc56d('0x38')]!==_0xc56d('0x4a')){var _0x2cc663={};_0x2cc663[_0x5bcf14[_0xc56d('0x32')]]={'$like':'%'+_0x1219aa[_0xc56d('0x3b')][_0xc56d('0x48')]+'%'};return _0x2cc663;}})});}_0x36ae22=_[_0xc56d('0x49')]({},_0x36ae22,_0x1219aa[_0xc56d('0x4b')]);var _0x556dd3={'where':_0x36ae22[_0xc56d('0x46')]};return db[_0xc56d('0x35')][_0xc56d('0x29')](_0x556dd3)[_0xc56d('0x2f')](function(_0xab1fd){_0x5a1d7f[_0xc56d('0x29')]=_0xab1fd;if(_0x1219aa[_0xc56d('0x3b')]['includeAll']){_0x36ae22[_0xc56d('0x4c')]=[{'all':!![]}];}return db[_0xc56d('0x35')][_0xc56d('0x4d')](_0x36ae22);})['then'](function(_0x5d7c76){_0x5a1d7f[_0xc56d('0x4e')]=_0x5d7c76;return _0x5a1d7f;})[_0xc56d('0x2f')](respondWithFilteredResult(_0x47bac6,_0x36ae22))[_0xc56d('0x4f')](handleError(_0x47bac6,null));};exports[_0xc56d('0x50')]=function(_0x20d6eb,_0x27effc){var _0x5d738a={'raw':![],'where':{'id':_0x20d6eb['params']['id']}},_0x416b63={};_0x416b63[_0xc56d('0x3a')]=_[_0xc56d('0x3c')](db['ZendeskAccount'][_0xc56d('0x36')]);_0x416b63[_0xc56d('0x3b')]=_[_0xc56d('0x3c')](_0x20d6eb['query']);_0x416b63[_0xc56d('0x3d')]=_[_0xc56d('0x3e')](_0x416b63[_0xc56d('0x3a')],_0x416b63['query']);_0x5d738a[_0xc56d('0x3f')]=_[_0xc56d('0x3e')](_0x416b63[_0xc56d('0x3a')],qs[_0xc56d('0x40')](_0x20d6eb[_0xc56d('0x3b')]['fields']));_0x5d738a[_0xc56d('0x3f')]=_0x5d738a[_0xc56d('0x3f')][_0xc56d('0x41')]?_0x5d738a[_0xc56d('0x3f')]:_0x416b63[_0xc56d('0x3a')];if(_0x20d6eb[_0xc56d('0x3b')]['includeAll']){_0x5d738a['include']=[{'all':!![]}];}_0x5d738a=_[_0xc56d('0x49')]({},_0x5d738a,_0x20d6eb[_0xc56d('0x4b')]);return db[_0xc56d('0x35')][_0xc56d('0x51')](_0x5d738a)['then'](handleEntityNotFound(_0x27effc,null))[_0xc56d('0x2f')](respondWithResult(_0x27effc,null))[_0xc56d('0x4f')](handleError(_0x27effc,null));};exports[_0xc56d('0x52')]=function(_0x256ebb,_0x44b370){return db['ZendeskAccount'][_0xc56d('0x52')](_0x256ebb[_0xc56d('0x53')],{})[_0xc56d('0x2f')](respondWithResult(_0x44b370,0xc9))['catch'](handleError(_0x44b370,null));};exports[_0xc56d('0x2e')]=function(_0x3cdf0f,_0x4f6d64){if(_0x3cdf0f[_0xc56d('0x53')]['id']){delete _0x3cdf0f[_0xc56d('0x53')]['id'];}return db[_0xc56d('0x35')]['find']({'where':{'id':_0x3cdf0f[_0xc56d('0x54')]['id']}})[_0xc56d('0x2f')](handleEntityNotFound(_0x4f6d64,null))[_0xc56d('0x2f')](saveUpdates(_0x3cdf0f[_0xc56d('0x53')],null))[_0xc56d('0x2f')](respondWithResult(_0x4f6d64,null))[_0xc56d('0x4f')](handleError(_0x4f6d64,null));};exports['destroy']=function(_0x552d35,_0x574f4e){return db[_0xc56d('0x35')]['find']({'where':{'id':_0x552d35[_0xc56d('0x54')]['id']}})[_0xc56d('0x2f')](handleEntityNotFound(_0x574f4e,null))[_0xc56d('0x2f')](removeEntity(_0x574f4e,null))[_0xc56d('0x4f')](handleError(_0x574f4e,null));};exports[_0xc56d('0x55')]=function(_0x2944ee,_0x2eaaa5,_0x5484c4){var _0x56e313={};var _0x43eff0={};var _0x180fc9;var _0x49f314;return db[_0xc56d('0x35')][_0xc56d('0x56')]({'where':{'id':_0x2944ee[_0xc56d('0x54')]['id']}})[_0xc56d('0x2f')](handleEntityNotFound(_0x2eaaa5,null))[_0xc56d('0x2f')](function(_0x567c5d){if(_0x567c5d){_0x180fc9=_0x567c5d;_0x43eff0[_0xc56d('0x3a')]=_['keys'](db[_0xc56d('0x57')][_0xc56d('0x36')]);_0x43eff0[_0xc56d('0x3b')]=_[_0xc56d('0x3c')](_0x2944ee[_0xc56d('0x3b')]);_0x43eff0[_0xc56d('0x3d')]=_[_0xc56d('0x3e')](_0x43eff0[_0xc56d('0x3a')],_0x43eff0['query']);_0x56e313[_0xc56d('0x3f')]=_[_0xc56d('0x3e')](_0x43eff0['model'],qs[_0xc56d('0x40')](_0x2944ee[_0xc56d('0x3b')][_0xc56d('0x40')]));_0x56e313[_0xc56d('0x3f')]=_0x56e313[_0xc56d('0x3f')][_0xc56d('0x41')]?_0x56e313[_0xc56d('0x3f')]:_0x43eff0[_0xc56d('0x3a')];_0x56e313[_0xc56d('0x58')]=qs[_0xc56d('0x45')](_0x2944ee[_0xc56d('0x3b')][_0xc56d('0x45')]);_0x56e313['where']=qs[_0xc56d('0x3d')](_[_0xc56d('0x47')](_0x2944ee[_0xc56d('0x3b')],_0x43eff0['filters']));if(_0x2944ee['query'][_0xc56d('0x48')]){_0x56e313[_0xc56d('0x46')]=_[_0xc56d('0x49')](_0x56e313[_0xc56d('0x46')],{'$or':_[_0xc56d('0x34')](_0x56e313[_0xc56d('0x3f')],function(_0x33c3c7){var _0x16c24b={};_0x16c24b[_0x33c3c7]={'$like':'%'+_0x2944ee[_0xc56d('0x3b')]['filter']+'%'};return _0x16c24b;})});}_0x56e313=_['merge']({},_0x56e313,_0x2944ee[_0xc56d('0x4b')]);return _0x180fc9['getConfigurations'](_0x56e313);}})[_0xc56d('0x2f')](function(_0x21c89f){if(_0x21c89f){_0x49f314=_0x21c89f['length'];if(!_0x2944ee[_0xc56d('0x3b')][_0xc56d('0x42')](_0xc56d('0x43'))){_0x56e313[_0xc56d('0x44')]=qs[_0xc56d('0x44')](_0x2944ee[_0xc56d('0x3b')]['limit']);_0x56e313[_0xc56d('0x2a')]=qs['offset'](_0x2944ee[_0xc56d('0x3b')]['offset']);}return _0x180fc9[_0xc56d('0x55')](_0x56e313);}})[_0xc56d('0x2f')](function(_0x9da6){if(_0x9da6){return _0x9da6?{'count':_0x49f314,'rows':_0x9da6}:null;}})['then'](respondWithResult(_0x2eaaa5,null))['catch'](handleError(_0x2eaaa5,null));};exports[_0xc56d('0x59')]=function(_0x64de40,_0x6aea0e,_0x2c1dcd){if(_0x64de40[_0xc56d('0x53')]['id']){delete _0x64de40[_0xc56d('0x53')]['id'];}return db[_0xc56d('0x35')][_0xc56d('0x56')]({'where':{'id':_0x64de40[_0xc56d('0x54')]['id']}})[_0xc56d('0x2f')](handleEntityNotFound(_0x6aea0e,null))[_0xc56d('0x2f')](function(_0x35a4ba){if(_0x35a4ba){_0x64de40['body'][_0xc56d('0x5a')]=_0x35a4ba['id'];_0x64de40[_0xc56d('0x53')]['Subjects']=integrations[_0xc56d('0x5b')](_0x64de40['body'][_0xc56d('0x5c')],_0x64de40[_0xc56d('0x53')][_0xc56d('0x38')]);_0x64de40[_0xc56d('0x53')][_0xc56d('0x5d')]=integrations[_0xc56d('0x5e')](_0x64de40[_0xc56d('0x53')][_0xc56d('0x5c')],_0x64de40['body'][_0xc56d('0x38')]);return db['ZendeskConfiguration'][_0xc56d('0x52')](_0x64de40[_0xc56d('0x53')],{'include':[{'model':db[_0xc56d('0x5f')],'as':_0xc56d('0x60')},{'model':db['ZendeskField'],'as':_0xc56d('0x5d')}]});}return null;})[_0xc56d('0x2f')](respondWithResult(_0x6aea0e,null))['catch'](handleError(_0x6aea0e,null));};exports['getFields']=function(_0x558b1d,_0x443501,_0x25817a){var _0x2dc125='';return db[_0xc56d('0x35')][_0xc56d('0x56')]({'where':{'id':_0x558b1d[_0xc56d('0x54')]['id']},'attributes':['id','username',_0xc56d('0x61'),_0xc56d('0x62'),_0xc56d('0x63'),_0xc56d('0x64')]})[_0xc56d('0x2f')](handleEntityNotFound(_0x443501,null))[_0xc56d('0x2f')](function(_0x290109){if(_0x290109){_0x2dc125=_0x290109[_0xc56d('0x64')];var _0x59c445=_0x2dc125[_0xc56d('0x65')](-0x1);if(_0x59c445==='/'){_0x2dc125=_0x2dc125['substring'](0x0,_0x2dc125[_0xc56d('0x66')](_0x59c445));}var _0x2b6a3f={'method':_0xc56d('0x67'),'uri':util[_0xc56d('0x68')](_0xc56d('0x69'),_0x2dc125,_0xc56d('0x6a')),'json':!![]};switch(_0x290109[_0xc56d('0x63')]){case _0xc56d('0x61'):_0x2b6a3f[_0xc56d('0x6b')]={'Authorization':util['format'](_0xc56d('0x6c'),new Buffer(util[_0xc56d('0x68')](_0xc56d('0x6d'),_0x290109['username'],_0x290109[_0xc56d('0x61')]))[_0xc56d('0x6e')]('base64'))};break;case _0xc56d('0x62'):_0x2b6a3f[_0xc56d('0x6b')]={'Authorization':util[_0xc56d('0x68')](_0xc56d('0x6c'),new Buffer(util[_0xc56d('0x68')]('%s/token:%s',_0x290109[_0xc56d('0x6f')],_0x290109['token']))[_0xc56d('0x6e')](_0xc56d('0x70')))};break;default:throw new db['Sequelize']['ValidationError'](_0xc56d('0x71'));}return rp(_0x2b6a3f);}})[_0xc56d('0x2f')](function(_0x11ca6c){if(_0x11ca6c){var _0x473adc=[_0xc56d('0x72'),_0xc56d('0x73'),_0xc56d('0x74'),_0xc56d('0x75')];_[_0xc56d('0x76')](_0x11ca6c[_0xc56d('0x6a')],function(_0x4c368e){return _0x473adc[_0xc56d('0x77')](_0x4c368e['type']);});return{'count':_0x11ca6c[_0xc56d('0x6a')][_0xc56d('0x41')],'rows':_[_0xc56d('0x34')](_0x11ca6c[_0xc56d('0x6a')],function(_0x40fd88){return{'id':_0x40fd88['id'],'name':_0x40fd88['position']>0x7?_0x40fd88[_0xc56d('0x78')]:_0x40fd88[_0xc56d('0x38')],'custom':_0x40fd88[_0xc56d('0x79')]>0x7?!![]:![],'options':_0x40fd88[_0xc56d('0x7a')]?_0x40fd88['system_field_options']:_0x40fd88[_0xc56d('0x7b')]?_0x40fd88[_0xc56d('0x7b')]:[]};})};}})['then'](respondWithResult(_0x443501,null))[_0xc56d('0x4f')](function(_0xaa1be6){var _0x32a09f=_0x558b1d['query'][_0xc56d('0x7c')]?0x1f4:_0xaa1be6[_0xc56d('0x7d')]||0x1f4;logger[_0xc56d('0x23')](_0xc56d('0x7e'),_0xc56d('0x7f'),_0x32a09f,JSON[_0xc56d('0x80')](_0xaa1be6));delete _0xaa1be6['name'];if(_0x32a09f===0x191){_0x32a09f=0x190;}_0x443501[_0xc56d('0x27')](_0x32a09f)[_0xc56d('0x33')](_0x558b1d[_0xc56d('0x3b')][_0xc56d('0x7c')]?{'message':_0xc56d('0x81'),'statusCode':_0xaa1be6[_0xc56d('0x7d')]}:_0xaa1be6);});}; \ No newline at end of file +var _0x9d62=['body','destroy','getConfigurations','findOne','ZendeskConfiguration','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','password','toString','headers','%s/token:%s','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','title','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','count','limit','Content-Range','json','stack','name','send','index','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','merge','type','VIRTUAL','filter','ZendeskAccount','includeAll','include','findAll','show','params','rawAttributes','options','find','create'];(function(_0x50f6e5,_0x151ccb){var _0x5988c5=function(_0x490a93){while(--_0x490a93){_0x50f6e5['push'](_0x50f6e5['shift']());}};_0x5988c5(++_0x151ccb);}(_0x9d62,0xaf));var _0x29d6=function(_0x3e0922,_0x3450d8){_0x3e0922=_0x3e0922-0x0;var _0x3ccab9=_0x9d62[_0x3e0922];return _0x3ccab9;};'use strict';var pdf=require(_0x29d6('0x0'));var emlformat=require(_0x29d6('0x1'));var rimraf=require(_0x29d6('0x2'));var zipdir=require(_0x29d6('0x3'));var jsonpatch=require(_0x29d6('0x4'));var rp=require('request-promise');var moment=require(_0x29d6('0x5'));var BPromise=require(_0x29d6('0x6'));var Mustache=require(_0x29d6('0x7'));var util=require(_0x29d6('0x8'));var path=require(_0x29d6('0x9'));var sox=require('sox');var csv=require(_0x29d6('0xa'));var ejs=require(_0x29d6('0xb'));var fs=require('fs');var _=require(_0x29d6('0xc'));var squel=require(_0x29d6('0xd'));var crypto=require(_0x29d6('0xe'));var jsforce=require(_0x29d6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x29d6('0xa'));var querystring=require(_0x29d6('0x10'));var Papa=require(_0x29d6('0x11'));var Redis=require(_0x29d6('0x12'));var authService=require(_0x29d6('0x13'));var qs=require(_0x29d6('0x14'));var as=require(_0x29d6('0x15'));var hardwareService=require(_0x29d6('0x16'));var logger=require('../../config/logger')(_0x29d6('0x17'));var utils=require(_0x29d6('0x18'));var config=require(_0x29d6('0x19'));var licenseUtil=require(_0x29d6('0x1a'));var db=require(_0x29d6('0x1b'))['db'];var integrations=require(_0x29d6('0x1c'));var jayson=require(_0x29d6('0x1d'));var client=jayson['client'][_0x29d6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5d7e8a,_0x34bb86,_0x16b739,_0x2f4968){return new BPromise(function(_0x305a69,_0x5aba64){var _0x4b5142=_0x2f4968||client;return _0x4b5142['request'](_0x5d7e8a,_0x16b739)[_0x29d6('0x1f')](function(_0x30d39f){logger[_0x29d6('0x20')](_0x29d6('0x21'),_0x34bb86,_0x29d6('0x22'));logger[_0x29d6('0x23')](_0x29d6('0x24'),_0x34bb86,'request\x20sent',JSON[_0x29d6('0x25')](_0x30d39f));if(_0x30d39f[_0x29d6('0x26')]){if(_0x30d39f[_0x29d6('0x26')]['code']===0x1f4){logger[_0x29d6('0x26')](_0x29d6('0x21'),_0x34bb86,_0x30d39f[_0x29d6('0x26')][_0x29d6('0x27')]);return _0x5aba64(_0x30d39f[_0x29d6('0x26')][_0x29d6('0x27')]);}logger[_0x29d6('0x26')](_0x29d6('0x21'),_0x34bb86,_0x30d39f['error'][_0x29d6('0x27')]);return _0x305a69(_0x30d39f[_0x29d6('0x26')]['message']);}else{logger[_0x29d6('0x20')](_0x29d6('0x21'),_0x34bb86,_0x29d6('0x22'));_0x305a69(_0x30d39f['result']['message']);}})[_0x29d6('0x28')](function(_0x4a7414){logger[_0x29d6('0x26')](_0x29d6('0x21'),_0x34bb86,_0x4a7414);_0x5aba64(_0x4a7414);});});}function respondWithStatusCode(_0x51cff7,_0x8d91f5){_0x8d91f5=_0x8d91f5||0xcc;return function(_0x28370b){if(_0x28370b){return _0x51cff7[_0x29d6('0x29')](_0x8d91f5);}return _0x51cff7[_0x29d6('0x2a')](_0x8d91f5)[_0x29d6('0x2b')]();};}function respondWithResult(_0x4d0f45,_0x29c1fd){_0x29c1fd=_0x29c1fd||0xc8;return function(_0x4c6583){if(_0x4c6583){return _0x4d0f45['status'](_0x29c1fd)['json'](_0x4c6583);}};}function respondWithFilteredResult(_0x394ac0,_0x593cb3){return function(_0xb7b9e6){if(_0xb7b9e6){var _0xd911f7=_0xb7b9e6[_0x29d6('0x2c')],_0x54ea45=_0x593cb3['offset'],_0x210ee1=_0x593cb3['offset']+_0x593cb3[_0x29d6('0x2d')],_0x53830a;if(_0x210ee1>=_0xd911f7){_0x210ee1=_0xd911f7;_0x53830a=0xc8;}else{_0x53830a=0xce;}_0x394ac0[_0x29d6('0x2a')](_0x53830a);return _0x394ac0['set'](_0x29d6('0x2e'),_0x54ea45+'-'+_0x210ee1+'/'+_0xd911f7)[_0x29d6('0x2f')](_0xb7b9e6);}return null;};}function patchUpdates(_0x304801){return function(_0x2008c0){try{jsonpatch['apply'](_0x2008c0,_0x304801,!![]);}catch(_0xa9b5e){return BPromise['reject'](_0xa9b5e);}return _0x2008c0['save']();};}function saveUpdates(_0x47ebba,_0x420a15){return function(_0x7665c4){if(_0x7665c4){return _0x7665c4['update'](_0x47ebba)[_0x29d6('0x1f')](function(_0xdf63d7){return _0xdf63d7;});}return null;};}function removeEntity(_0x34099b,_0x2c8ef2){return function(_0x1c79e7){if(_0x1c79e7){return _0x1c79e7['destroy']()[_0x29d6('0x1f')](function(){_0x34099b[_0x29d6('0x2a')](0xcc)[_0x29d6('0x2b')]();});}};}function handleEntityNotFound(_0xfa92e2,_0x5e52aa){return function(_0x109549){if(!_0x109549){_0xfa92e2[_0x29d6('0x29')](0x194);}return _0x109549;};}function handleError(_0x2ef56e,_0x2098d4){_0x2098d4=_0x2098d4||0x1f4;return function(_0x1c8895){logger['error'](_0x1c8895[_0x29d6('0x30')]);if(_0x1c8895[_0x29d6('0x31')]){delete _0x1c8895[_0x29d6('0x31')];}_0x2ef56e[_0x29d6('0x2a')](_0x2098d4)[_0x29d6('0x32')](_0x1c8895);};}exports[_0x29d6('0x33')]=function(_0x2c5ada,_0x2e0fb3){var _0x33b8c1={},_0x46591e={},_0x32b1e0={'count':0x0,'rows':[]};var _0x12d4ae=_['map'](db['ZendeskAccount']['rawAttributes'],function(_0x4d95c9){return{'name':_0x4d95c9[_0x29d6('0x34')],'type':_0x4d95c9['type'][_0x29d6('0x35')]};});_0x46591e[_0x29d6('0x36')]=_[_0x29d6('0x37')](_0x12d4ae,_0x29d6('0x31'));_0x46591e[_0x29d6('0x38')]=_[_0x29d6('0x39')](_0x2c5ada['query']);_0x46591e[_0x29d6('0x3a')]=_[_0x29d6('0x3b')](_0x46591e[_0x29d6('0x36')],_0x46591e[_0x29d6('0x38')]);_0x33b8c1[_0x29d6('0x3c')]=_[_0x29d6('0x3b')](_0x46591e[_0x29d6('0x36')],qs[_0x29d6('0x3d')](_0x2c5ada[_0x29d6('0x38')][_0x29d6('0x3d')]));_0x33b8c1[_0x29d6('0x3c')]=_0x33b8c1[_0x29d6('0x3c')][_0x29d6('0x3e')]?_0x33b8c1[_0x29d6('0x3c')]:_0x46591e[_0x29d6('0x36')];if(!_0x2c5ada[_0x29d6('0x38')][_0x29d6('0x3f')]('nolimit')){_0x33b8c1['limit']=qs[_0x29d6('0x2d')](_0x2c5ada[_0x29d6('0x38')][_0x29d6('0x2d')]);_0x33b8c1[_0x29d6('0x40')]=qs[_0x29d6('0x40')](_0x2c5ada[_0x29d6('0x38')][_0x29d6('0x40')]);}_0x33b8c1[_0x29d6('0x41')]=qs['sort'](_0x2c5ada[_0x29d6('0x38')][_0x29d6('0x42')]);_0x33b8c1[_0x29d6('0x43')]=qs[_0x29d6('0x3a')](_[_0x29d6('0x44')](_0x2c5ada[_0x29d6('0x38')],_0x46591e[_0x29d6('0x3a')]),_0x12d4ae);if(_0x2c5ada[_0x29d6('0x38')]['filter']){_0x33b8c1[_0x29d6('0x43')]=_[_0x29d6('0x45')](_0x33b8c1[_0x29d6('0x43')],{'$or':_[_0x29d6('0x37')](_0x12d4ae,function(_0x5038ef){if(_0x5038ef[_0x29d6('0x46')]!==_0x29d6('0x47')){var _0x34533d={};_0x34533d[_0x5038ef[_0x29d6('0x31')]]={'$like':'%'+_0x2c5ada[_0x29d6('0x38')][_0x29d6('0x48')]+'%'};return _0x34533d;}})});}_0x33b8c1=_[_0x29d6('0x45')]({},_0x33b8c1,_0x2c5ada['options']);var _0x2b0a5b={'where':_0x33b8c1[_0x29d6('0x43')]};return db[_0x29d6('0x49')]['count'](_0x2b0a5b)['then'](function(_0x3c2852){_0x32b1e0[_0x29d6('0x2c')]=_0x3c2852;if(_0x2c5ada[_0x29d6('0x38')][_0x29d6('0x4a')]){_0x33b8c1[_0x29d6('0x4b')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x29d6('0x4c')](_0x33b8c1);})[_0x29d6('0x1f')](function(_0x5e1031){_0x32b1e0['rows']=_0x5e1031;return _0x32b1e0;})['then'](respondWithFilteredResult(_0x2e0fb3,_0x33b8c1))[_0x29d6('0x28')](handleError(_0x2e0fb3,null));};exports[_0x29d6('0x4d')]=function(_0x2e0a5f,_0x19c3e7){var _0x1b0f79={'raw':![],'where':{'id':_0x2e0a5f[_0x29d6('0x4e')]['id']}},_0x20ab2b={};_0x20ab2b['model']=_[_0x29d6('0x39')](db[_0x29d6('0x49')][_0x29d6('0x4f')]);_0x20ab2b['query']=_[_0x29d6('0x39')](_0x2e0a5f[_0x29d6('0x38')]);_0x20ab2b[_0x29d6('0x3a')]=_[_0x29d6('0x3b')](_0x20ab2b[_0x29d6('0x36')],_0x20ab2b[_0x29d6('0x38')]);_0x1b0f79[_0x29d6('0x3c')]=_[_0x29d6('0x3b')](_0x20ab2b[_0x29d6('0x36')],qs['fields'](_0x2e0a5f[_0x29d6('0x38')][_0x29d6('0x3d')]));_0x1b0f79[_0x29d6('0x3c')]=_0x1b0f79[_0x29d6('0x3c')][_0x29d6('0x3e')]?_0x1b0f79[_0x29d6('0x3c')]:_0x20ab2b[_0x29d6('0x36')];if(_0x2e0a5f[_0x29d6('0x38')]['includeAll']){_0x1b0f79[_0x29d6('0x4b')]=[{'all':!![]}];}_0x1b0f79=_[_0x29d6('0x45')]({},_0x1b0f79,_0x2e0a5f[_0x29d6('0x50')]);return db['ZendeskAccount'][_0x29d6('0x51')](_0x1b0f79)[_0x29d6('0x1f')](handleEntityNotFound(_0x19c3e7,null))['then'](respondWithResult(_0x19c3e7,null))[_0x29d6('0x28')](handleError(_0x19c3e7,null));};exports[_0x29d6('0x52')]=function(_0x2184a4,_0x3134b5){return db[_0x29d6('0x49')][_0x29d6('0x52')](_0x2184a4['body'],{})[_0x29d6('0x1f')](respondWithResult(_0x3134b5,0xc9))[_0x29d6('0x28')](handleError(_0x3134b5,null));};exports['update']=function(_0x84939,_0x115946){if(_0x84939['body']['id']){delete _0x84939[_0x29d6('0x53')]['id'];}return db[_0x29d6('0x49')]['find']({'where':{'id':_0x84939[_0x29d6('0x4e')]['id']}})[_0x29d6('0x1f')](handleEntityNotFound(_0x115946,null))[_0x29d6('0x1f')](saveUpdates(_0x84939[_0x29d6('0x53')],null))[_0x29d6('0x1f')](respondWithResult(_0x115946,null))[_0x29d6('0x28')](handleError(_0x115946,null));};exports[_0x29d6('0x54')]=function(_0x2a433a,_0x33b63f){return db['ZendeskAccount'][_0x29d6('0x51')]({'where':{'id':_0x2a433a[_0x29d6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x33b63f,null))[_0x29d6('0x1f')](removeEntity(_0x33b63f,null))['catch'](handleError(_0x33b63f,null));};exports[_0x29d6('0x55')]=function(_0x1502f3,_0x3a46aa,_0x42efb4){var _0x36296c={};var _0x94cd94={};var _0x1bffc4;var _0xbdc27b;return db[_0x29d6('0x49')][_0x29d6('0x56')]({'where':{'id':_0x1502f3[_0x29d6('0x4e')]['id']}})[_0x29d6('0x1f')](handleEntityNotFound(_0x3a46aa,null))[_0x29d6('0x1f')](function(_0x29cd4c){if(_0x29cd4c){_0x1bffc4=_0x29cd4c;_0x94cd94['model']=_[_0x29d6('0x39')](db[_0x29d6('0x57')][_0x29d6('0x4f')]);_0x94cd94[_0x29d6('0x38')]=_['keys'](_0x1502f3['query']);_0x94cd94[_0x29d6('0x3a')]=_[_0x29d6('0x3b')](_0x94cd94[_0x29d6('0x36')],_0x94cd94[_0x29d6('0x38')]);_0x36296c[_0x29d6('0x3c')]=_[_0x29d6('0x3b')](_0x94cd94['model'],qs[_0x29d6('0x3d')](_0x1502f3['query']['fields']));_0x36296c[_0x29d6('0x3c')]=_0x36296c[_0x29d6('0x3c')][_0x29d6('0x3e')]?_0x36296c[_0x29d6('0x3c')]:_0x94cd94[_0x29d6('0x36')];_0x36296c['order']=qs[_0x29d6('0x42')](_0x1502f3[_0x29d6('0x38')][_0x29d6('0x42')]);_0x36296c[_0x29d6('0x43')]=qs[_0x29d6('0x3a')](_['pick'](_0x1502f3[_0x29d6('0x38')],_0x94cd94[_0x29d6('0x3a')]));if(_0x1502f3['query'][_0x29d6('0x48')]){_0x36296c[_0x29d6('0x43')]=_[_0x29d6('0x45')](_0x36296c['where'],{'$or':_['map'](_0x36296c['attributes'],function(_0x13132e){var _0x3800fe={};_0x3800fe[_0x13132e]={'$like':'%'+_0x1502f3[_0x29d6('0x38')][_0x29d6('0x48')]+'%'};return _0x3800fe;})});}_0x36296c=_[_0x29d6('0x45')]({},_0x36296c,_0x1502f3['options']);return _0x1bffc4[_0x29d6('0x55')](_0x36296c);}})['then'](function(_0x80a6bb){if(_0x80a6bb){_0xbdc27b=_0x80a6bb['length'];if(!_0x1502f3['query']['hasOwnProperty'](_0x29d6('0x58'))){_0x36296c[_0x29d6('0x2d')]=qs['limit'](_0x1502f3[_0x29d6('0x38')][_0x29d6('0x2d')]);_0x36296c['offset']=qs['offset'](_0x1502f3[_0x29d6('0x38')]['offset']);}return _0x1bffc4[_0x29d6('0x55')](_0x36296c);}})['then'](function(_0x4ae73b){if(_0x4ae73b){return _0x4ae73b?{'count':_0xbdc27b,'rows':_0x4ae73b}:null;}})['then'](respondWithResult(_0x3a46aa,null))[_0x29d6('0x28')](handleError(_0x3a46aa,null));};exports[_0x29d6('0x59')]=function(_0x1f5ded,_0x409036,_0x3765de){if(_0x1f5ded[_0x29d6('0x53')]['id']){delete _0x1f5ded[_0x29d6('0x53')]['id'];}return db[_0x29d6('0x49')][_0x29d6('0x56')]({'where':{'id':_0x1f5ded[_0x29d6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x409036,null))[_0x29d6('0x1f')](function(_0x6b4670){if(_0x6b4670){_0x1f5ded['body']['AccountId']=_0x6b4670['id'];_0x1f5ded[_0x29d6('0x53')][_0x29d6('0x5a')]=integrations[_0x29d6('0x5b')](_0x1f5ded[_0x29d6('0x53')][_0x29d6('0x5c')],_0x1f5ded[_0x29d6('0x53')][_0x29d6('0x46')]);_0x1f5ded[_0x29d6('0x53')][_0x29d6('0x5d')]=integrations[_0x29d6('0x5e')](_0x1f5ded[_0x29d6('0x53')][_0x29d6('0x5c')],_0x1f5ded['body']['type']);return db[_0x29d6('0x57')][_0x29d6('0x52')](_0x1f5ded['body'],{'include':[{'model':db[_0x29d6('0x5f')],'as':_0x29d6('0x5a')},{'model':db[_0x29d6('0x5f')],'as':_0x29d6('0x5d')}]});}return null;})[_0x29d6('0x1f')](respondWithResult(_0x409036,null))[_0x29d6('0x28')](handleError(_0x409036,null));};exports[_0x29d6('0x60')]=function(_0x12ba45,_0x1e4080,_0x263aa6){var _0x2c36f8='';return db[_0x29d6('0x49')][_0x29d6('0x56')]({'where':{'id':_0x12ba45[_0x29d6('0x4e')]['id']},'attributes':['id',_0x29d6('0x61'),'password',_0x29d6('0x62'),_0x29d6('0x63'),_0x29d6('0x64')]})[_0x29d6('0x1f')](handleEntityNotFound(_0x1e4080,null))[_0x29d6('0x1f')](function(_0x4be083){if(_0x4be083){_0x2c36f8=_0x4be083[_0x29d6('0x64')];var _0x7dcaeb=_0x2c36f8[_0x29d6('0x65')](-0x1);if(_0x7dcaeb==='/'){_0x2c36f8=_0x2c36f8[_0x29d6('0x66')](0x0,_0x2c36f8[_0x29d6('0x67')](_0x7dcaeb));}var _0x7559da={'method':_0x29d6('0x68'),'uri':util[_0x29d6('0x69')](_0x29d6('0x6a'),_0x2c36f8,_0x29d6('0x6b')),'json':!![]};switch(_0x4be083[_0x29d6('0x63')]){case'password':_0x7559da['headers']={'Authorization':util[_0x29d6('0x69')](_0x29d6('0x6c'),new Buffer(util[_0x29d6('0x69')]('%s:%s',_0x4be083[_0x29d6('0x61')],_0x4be083[_0x29d6('0x6d')]))[_0x29d6('0x6e')]('base64'))};break;case'token':_0x7559da[_0x29d6('0x6f')]={'Authorization':util[_0x29d6('0x69')](_0x29d6('0x6c'),new Buffer(util[_0x29d6('0x69')](_0x29d6('0x70'),_0x4be083[_0x29d6('0x61')],_0x4be083[_0x29d6('0x62')]))[_0x29d6('0x6e')](_0x29d6('0x71')))};break;default:throw new db[(_0x29d6('0x72'))][(_0x29d6('0x73'))](_0x29d6('0x74'));}return rp(_0x7559da);}})[_0x29d6('0x1f')](function(_0x4457ac){if(_0x4457ac){var _0x1e9373=[_0x29d6('0x75'),_0x29d6('0x76'),_0x29d6('0x77'),_0x29d6('0x78')];_[_0x29d6('0x79')](_0x4457ac[_0x29d6('0x6b')],function(_0x18cc18){return _0x1e9373['includes'](_0x18cc18[_0x29d6('0x46')]);});return{'count':_0x4457ac['ticket_fields'][_0x29d6('0x3e')],'rows':_['map'](_0x4457ac['ticket_fields'],function(_0x2fb57c){return{'id':_0x2fb57c['id'],'name':_0x2fb57c['position']>0x7?_0x2fb57c[_0x29d6('0x7a')]:_0x2fb57c[_0x29d6('0x46')],'custom':_0x2fb57c[_0x29d6('0x7b')]>0x7?!![]:![],'options':_0x2fb57c[_0x29d6('0x7c')]?_0x2fb57c[_0x29d6('0x7c')]:_0x2fb57c[_0x29d6('0x7d')]?_0x2fb57c[_0x29d6('0x7d')]:[]};})};}})[_0x29d6('0x1f')](respondWithResult(_0x1e4080,null))['catch'](function(_0x4a7e32){var _0x4d5679=_0x12ba45['query']['test']?0x1f4:_0x4a7e32[_0x29d6('0x7e')]||0x1f4;logger[_0x29d6('0x26')](_0x29d6('0x7f'),'getFields',_0x4d5679,JSON[_0x29d6('0x25')](_0x4a7e32));delete _0x4a7e32[_0x29d6('0x31')];if(_0x4d5679===0x191){_0x4d5679=0x190;}_0x1e4080[_0x29d6('0x2a')](_0x4d5679)[_0x29d6('0x32')](_0x12ba45[_0x29d6('0x38')]['test']?{'message':_0x29d6('0x80'),'statusCode':_0x4a7e32[_0x29d6('0x7e')]}:_0x4a7e32);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index f0f1215..955fb7b 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 _0x26df=['../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment','request-promise','path','rimraf','./intZendeskAccount.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x26df,0xd5));var _0xf26d=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0x26df[_0x4e783c];return _0x2fbd6d;};'use strict';var _=require('lodash');var util=require(_0xf26d('0x0'));var logger=require(_0xf26d('0x1'))(_0xf26d('0x2'));var moment=require(_0xf26d('0x3'));var BPromise=require('bluebird');var rp=require(_0xf26d('0x4'));var fs=require('fs');var path=require(_0xf26d('0x5'));var rimraf=require(_0xf26d('0x6'));var config=require('../../config/environment');var attributes=require(_0xf26d('0x7'));var integrations=require(_0xf26d('0x8'));module[_0xf26d('0x9')]=function(_0x35ca3d,_0x779910){return _0x35ca3d[_0xf26d('0xa')](_0xf26d('0xb'),attributes,{'tableName':_0xf26d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8681=['int_zendesk_accounts','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount'];(function(_0x522eb8,_0xaf0729){var _0x32b68a=function(_0x8d6de9){while(--_0x8d6de9){_0x522eb8['push'](_0x522eb8['shift']());}};_0x32b68a(++_0xaf0729);}(_0x8681,0x83));var _0x1868=function(_0x4a095e,_0x381cd5){_0x4a095e=_0x4a095e-0x0;var _0x10ef73=_0x8681[_0x4a095e];return _0x10ef73;};'use strict';var _=require(_0x1868('0x0'));var util=require(_0x1868('0x1'));var logger=require(_0x1868('0x2'))('api');var moment=require(_0x1868('0x3'));var BPromise=require(_0x1868('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1868('0x5'));var rimraf=require(_0x1868('0x6'));var config=require(_0x1868('0x7'));var attributes=require(_0x1868('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x1868('0x9')]=function(_0x11caa7,_0x18dce6){return _0x11caa7[_0x1868('0xa')](_0x1868('0xb'),attributes,{'tableName':_0x1868('0xc'),'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 ee73dc4..83df77e 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 _0xa9e0=['code','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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['GetZendeskAccount']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowZendeskAccount',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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['GetZendeskAccount']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowZendeskAccount',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 4b6b055..d041f2e 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 _0x374f=['put','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create'];(function(_0x4239fd,_0x32b441){var _0x98031d=function(_0x14247d){while(--_0x14247d){_0x4239fd['push'](_0x4239fd['shift']());}};_0x98031d(++_0x32b441);}(_0x374f,0x183));var _0xf374=function(_0x4f2342,_0x4edaa1){_0x4f2342=_0x4f2342-0x0;var _0x561068=_0x374f[_0x4f2342];return _0x561068;};'use strict';var multer=require('multer');var util=require(_0xf374('0x0'));var path=require(_0xf374('0x1'));var timeout=require(_0xf374('0x2'));var express=require('express');var router=express[_0xf374('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf374('0x4'));var config=require(_0xf374('0x5'));var controller=require('./intZendeskConfiguration.controller');router[_0xf374('0x6')]('/',auth[_0xf374('0x7')](),controller[_0xf374('0x8')]);router[_0xf374('0x6')](_0xf374('0x9'),auth[_0xf374('0x7')](),controller[_0xf374('0xa')]);router[_0xf374('0x6')](_0xf374('0xb'),auth['isAuthenticated'](),controller[_0xf374('0xc')]);router[_0xf374('0x6')](_0xf374('0xd'),auth['isAuthenticated'](),controller[_0xf374('0xe')]);router['get'](_0xf374('0xf'),auth[_0xf374('0x7')](),controller[_0xf374('0x10')]);router[_0xf374('0x6')](_0xf374('0x11'),auth[_0xf374('0x7')](),controller[_0xf374('0x12')]);router[_0xf374('0x13')]('/',auth[_0xf374('0x7')](),controller[_0xf374('0x14')]);router['post'](_0xf374('0x11'),auth['isAuthenticated'](),controller['setTags']);router[_0xf374('0x15')](_0xf374('0x9'),auth[_0xf374('0x7')](),controller['update']);router['delete'](_0xf374('0x9'),auth[_0xf374('0x7')](),controller[_0xf374('0x16')]);module[_0xf374('0x17')]=router; \ No newline at end of file +var _0xc494=['/:id/tags','getTags','create','post','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x4741e4,_0x457e2e){var _0x459f97=function(_0x3e086d){while(--_0x3e086d){_0x4741e4['push'](_0x4741e4['shift']());}};_0x459f97(++_0x457e2e);}(_0xc494,0x8c));var _0x4c49=function(_0xe5b349,_0x5f06e4){_0xe5b349=_0xe5b349-0x0;var _0x26b0ad=_0xc494[_0xe5b349];return _0x26b0ad;};'use strict';var multer=require('multer');var util=require(_0x4c49('0x0'));var path=require(_0x4c49('0x1'));var timeout=require(_0x4c49('0x2'));var express=require('express');var router=express[_0x4c49('0x3')]();var auth=require(_0x4c49('0x4'));var interaction=require(_0x4c49('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskConfiguration.controller');router[_0x4c49('0x6')]('/',auth[_0x4c49('0x7')](),controller[_0x4c49('0x8')]);router[_0x4c49('0x6')](_0x4c49('0x9'),auth[_0x4c49('0x7')](),controller[_0x4c49('0xa')]);router[_0x4c49('0x6')](_0x4c49('0xb'),auth[_0x4c49('0x7')](),controller[_0x4c49('0xc')]);router[_0x4c49('0x6')](_0x4c49('0xd'),auth[_0x4c49('0x7')](),controller[_0x4c49('0xe')]);router[_0x4c49('0x6')](_0x4c49('0xf'),auth[_0x4c49('0x7')](),controller['getDescriptions']);router['get'](_0x4c49('0x10'),auth[_0x4c49('0x7')](),controller[_0x4c49('0x11')]);router['post']('/',auth[_0x4c49('0x7')](),controller[_0x4c49('0x12')]);router[_0x4c49('0x13')](_0x4c49('0x10'),auth[_0x4c49('0x7')](),controller[_0x4c49('0x14')]);router[_0x4c49('0x15')](_0x4c49('0x9'),auth[_0x4c49('0x7')](),controller[_0x4c49('0x16')]);router[_0x4c49('0x17')](_0x4c49('0x9'),auth[_0x4c49('0x7')](),controller[_0x4c49('0x18')]);module[_0x4c49('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 59171df..4019888 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 _0xccee=['STRING','exports'];(function(_0x105022,_0x3b5997){var _0x4635ce=function(_0x43505a){while(--_0x43505a){_0x105022['push'](_0x105022['shift']());}};_0x4635ce(++_0x3b5997);}(_0xccee,0x87));var _0xecce=function(_0x1a65aa,_0x590ae7){_0x1a65aa=_0x1a65aa-0x0;var _0x1b09e2=_0xccee[_0x1a65aa];return _0x1b09e2;};'use strict';var Sequelize=require('sequelize');module[_0xecce('0x0')]={'name':{'type':Sequelize[_0xecce('0x1')]},'description':{'type':Sequelize[_0xecce('0x1')]}}; \ No newline at end of file +var _0x393e=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x393e,0x1cc));var _0xe393=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x393e[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0xe393('0x0'));module[_0xe393('0x1')]={'name':{'type':Sequelize[_0xe393('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index cc1ca15..c199eed 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 _0x6396=['update','destroy','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','params','create','body','find','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6396,0x145));var _0x6639=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0x6396[_0x2caaef];return _0xd011f8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6639('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6639('0x1'));var rp=require('request-promise');var moment=require(_0x6639('0x2'));var BPromise=require(_0x6639('0x3'));var Mustache=require('mustache');var util=require(_0x6639('0x4'));var path=require(_0x6639('0x5'));var sox=require(_0x6639('0x6'));var csv=require(_0x6639('0x7'));var ejs=require(_0x6639('0x8'));var fs=require('fs');var _=require(_0x6639('0x9'));var squel=require(_0x6639('0xa'));var crypto=require('crypto');var jsforce=require(_0x6639('0xb'));var deskjs=require(_0x6639('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6639('0xd'));var Papa=require(_0x6639('0xe'));var Redis=require('ioredis');var authService=require(_0x6639('0xf'));var qs=require(_0x6639('0x10'));var as=require(_0x6639('0x11'));var hardwareService=require(_0x6639('0x12'));var logger=require(_0x6639('0x13'))(_0x6639('0x14'));var utils=require(_0x6639('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6639('0x16'));var db=require(_0x6639('0x17'))['db'];var jayson=require(_0x6639('0x18'));var client=jayson[_0x6639('0x19')][_0x6639('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x54b3f7,_0x560308,_0x4b0109,_0x1f7976){return new BPromise(function(_0x306743,_0x3e8655){var _0x1a87e5=_0x1f7976||client;return _0x1a87e5[_0x6639('0x1b')](_0x54b3f7,_0x4b0109)[_0x6639('0x1c')](function(_0x20c81d){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x560308,_0x6639('0x1d'));logger[_0x6639('0x1e')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x560308,_0x6639('0x1d'),JSON[_0x6639('0x1f')](_0x20c81d));if(_0x20c81d[_0x6639('0x20')]){if(_0x20c81d[_0x6639('0x20')][_0x6639('0x21')]===0x1f4){logger[_0x6639('0x20')](_0x6639('0x22'),_0x560308,_0x20c81d[_0x6639('0x20')][_0x6639('0x23')]);return _0x3e8655(_0x20c81d[_0x6639('0x20')][_0x6639('0x23')]);}logger[_0x6639('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x560308,_0x20c81d[_0x6639('0x20')][_0x6639('0x23')]);return _0x306743(_0x20c81d[_0x6639('0x20')][_0x6639('0x23')]);}else{logger[_0x6639('0x24')](_0x6639('0x22'),_0x560308,_0x6639('0x1d'));_0x306743(_0x20c81d['result']['message']);}})[_0x6639('0x25')](function(_0x2e19c9){logger['error'](_0x6639('0x22'),_0x560308,_0x2e19c9);_0x3e8655(_0x2e19c9);});});}function respondWithStatusCode(_0x512b8d,_0x5c7676){_0x5c7676=_0x5c7676||0xcc;return function(_0x35c4b1){if(_0x35c4b1){return _0x512b8d[_0x6639('0x26')](_0x5c7676);}return _0x512b8d[_0x6639('0x27')](_0x5c7676)[_0x6639('0x28')]();};}function respondWithResult(_0x483b77,_0x2a7702){_0x2a7702=_0x2a7702||0xc8;return function(_0x2e0a73){if(_0x2e0a73){return _0x483b77[_0x6639('0x27')](_0x2a7702)[_0x6639('0x29')](_0x2e0a73);}};}function respondWithFilteredResult(_0x1b6dba,_0x2208e2){return function(_0x35bef5){if(_0x35bef5){var _0x3cc9f4=_0x35bef5['count'],_0x5beea4=_0x2208e2['offset'],_0x349153=_0x2208e2[_0x6639('0x2a')]+_0x2208e2[_0x6639('0x2b')],_0x309af7;if(_0x349153>=_0x3cc9f4){_0x349153=_0x3cc9f4;_0x309af7=0xc8;}else{_0x309af7=0xce;}_0x1b6dba['status'](_0x309af7);return _0x1b6dba['set'](_0x6639('0x2c'),_0x5beea4+'-'+_0x349153+'/'+_0x3cc9f4)['json'](_0x35bef5);}return null;};}function patchUpdates(_0x1550a2){return function(_0x433d92){try{jsonpatch['apply'](_0x433d92,_0x1550a2,!![]);}catch(_0x1a432){return BPromise[_0x6639('0x2d')](_0x1a432);}return _0x433d92[_0x6639('0x2e')]();};}function saveUpdates(_0x15632b,_0x1ede04){return function(_0x1f0a4f){if(_0x1f0a4f){return _0x1f0a4f[_0x6639('0x2f')](_0x15632b)[_0x6639('0x1c')](function(_0x57c1aa){return _0x57c1aa;});}return null;};}function removeEntity(_0x344d8b,_0x5d938a){return function(_0x405dc3){if(_0x405dc3){return _0x405dc3[_0x6639('0x30')]()['then'](function(){_0x344d8b[_0x6639('0x27')](0xcc)[_0x6639('0x28')]();});}};}function handleEntityNotFound(_0x575d4e,_0x1aa9a7){return function(_0x9fc088){if(!_0x9fc088){_0x575d4e[_0x6639('0x26')](0x194);}return _0x9fc088;};}function handleError(_0x33ef29,_0x217f64){_0x217f64=_0x217f64||0x1f4;return function(_0x3635af){logger[_0x6639('0x20')](_0x3635af[_0x6639('0x31')]);if(_0x3635af[_0x6639('0x32')]){delete _0x3635af[_0x6639('0x32')];}_0x33ef29['status'](_0x217f64)[_0x6639('0x33')](_0x3635af);};}exports[_0x6639('0x34')]=function(_0x7294ce,_0x35eb1b){var _0x22df2e={},_0x5ab95c={},_0xe968a5={'count':0x0,'rows':[]};var _0xf44e44=_[_0x6639('0x35')](db[_0x6639('0x36')][_0x6639('0x37')],function(_0xbd7a1c){return{'name':_0xbd7a1c[_0x6639('0x38')],'type':_0xbd7a1c[_0x6639('0x39')][_0x6639('0x3a')]};});_0x5ab95c[_0x6639('0x3b')]=_[_0x6639('0x35')](_0xf44e44,_0x6639('0x32'));_0x5ab95c[_0x6639('0x3c')]=_[_0x6639('0x3d')](_0x7294ce[_0x6639('0x3c')]);_0x5ab95c[_0x6639('0x3e')]=_[_0x6639('0x3f')](_0x5ab95c[_0x6639('0x3b')],_0x5ab95c['query']);_0x22df2e[_0x6639('0x40')]=_[_0x6639('0x3f')](_0x5ab95c[_0x6639('0x3b')],qs[_0x6639('0x41')](_0x7294ce[_0x6639('0x3c')][_0x6639('0x41')]));_0x22df2e[_0x6639('0x40')]=_0x22df2e[_0x6639('0x40')][_0x6639('0x42')]?_0x22df2e[_0x6639('0x40')]:_0x5ab95c[_0x6639('0x3b')];if(!_0x7294ce[_0x6639('0x3c')][_0x6639('0x43')](_0x6639('0x44'))){_0x22df2e[_0x6639('0x2b')]=qs[_0x6639('0x2b')](_0x7294ce['query'][_0x6639('0x2b')]);_0x22df2e[_0x6639('0x2a')]=qs[_0x6639('0x2a')](_0x7294ce[_0x6639('0x3c')]['offset']);}_0x22df2e[_0x6639('0x45')]=qs['sort'](_0x7294ce[_0x6639('0x3c')][_0x6639('0x46')]);_0x22df2e[_0x6639('0x47')]=qs[_0x6639('0x3e')](_[_0x6639('0x48')](_0x7294ce[_0x6639('0x3c')],_0x5ab95c[_0x6639('0x3e')]),_0xf44e44);if(_0x7294ce[_0x6639('0x3c')][_0x6639('0x49')]){_0x22df2e[_0x6639('0x47')]=_[_0x6639('0x4a')](_0x22df2e[_0x6639('0x47')],{'$or':_[_0x6639('0x35')](_0xf44e44,function(_0x2efa2c){if(_0x2efa2c[_0x6639('0x39')]!==_0x6639('0x4b')){var _0x30a3c1={};_0x30a3c1[_0x2efa2c[_0x6639('0x32')]]={'$like':'%'+_0x7294ce[_0x6639('0x3c')][_0x6639('0x49')]+'%'};return _0x30a3c1;}})});}_0x22df2e=_[_0x6639('0x4a')]({},_0x22df2e,_0x7294ce[_0x6639('0x4c')]);var _0x4968ba={'where':_0x22df2e[_0x6639('0x47')]};return db[_0x6639('0x36')][_0x6639('0x4d')](_0x4968ba)['then'](function(_0x2f45b0){_0xe968a5[_0x6639('0x4d')]=_0x2f45b0;if(_0x7294ce[_0x6639('0x3c')]['includeAll']){_0x22df2e[_0x6639('0x4e')]=[{'all':!![]}];}return db[_0x6639('0x36')][_0x6639('0x4f')](_0x22df2e);})[_0x6639('0x1c')](function(_0xbe86eb){_0xe968a5[_0x6639('0x50')]=_0xbe86eb;return _0xe968a5;})[_0x6639('0x1c')](respondWithFilteredResult(_0x35eb1b,_0x22df2e))[_0x6639('0x25')](handleError(_0x35eb1b,null));};exports['show']=function(_0x58078b,_0x2af1e3){var _0x3885fa={'raw':![],'where':{'id':_0x58078b[_0x6639('0x51')]['id']}},_0x268461={};_0x268461['model']=_[_0x6639('0x3d')](db[_0x6639('0x36')][_0x6639('0x37')]);_0x268461[_0x6639('0x3c')]=_[_0x6639('0x3d')](_0x58078b[_0x6639('0x3c')]);_0x268461[_0x6639('0x3e')]=_[_0x6639('0x3f')](_0x268461[_0x6639('0x3b')],_0x268461[_0x6639('0x3c')]);_0x3885fa[_0x6639('0x40')]=_[_0x6639('0x3f')](_0x268461['model'],qs[_0x6639('0x41')](_0x58078b[_0x6639('0x3c')][_0x6639('0x41')]));_0x3885fa[_0x6639('0x40')]=_0x3885fa[_0x6639('0x40')][_0x6639('0x42')]?_0x3885fa[_0x6639('0x40')]:_0x268461[_0x6639('0x3b')];if(_0x58078b[_0x6639('0x3c')]['includeAll']){_0x3885fa[_0x6639('0x4e')]=[{'all':!![]}];}_0x3885fa=_[_0x6639('0x4a')]({},_0x3885fa,_0x58078b[_0x6639('0x4c')]);return db[_0x6639('0x36')]['find'](_0x3885fa)[_0x6639('0x1c')](handleEntityNotFound(_0x2af1e3,null))[_0x6639('0x1c')](respondWithResult(_0x2af1e3,null))[_0x6639('0x25')](handleError(_0x2af1e3,null));};exports[_0x6639('0x52')]=function(_0x5975fb,_0x16625d){return db['ZendeskConfiguration'][_0x6639('0x52')](_0x5975fb['body'],{})[_0x6639('0x1c')](respondWithResult(_0x16625d,0xc9))[_0x6639('0x25')](handleError(_0x16625d,null));};exports[_0x6639('0x2f')]=function(_0xe0a49e,_0x309c06){if(_0xe0a49e[_0x6639('0x53')]['id']){delete _0xe0a49e[_0x6639('0x53')]['id'];}return db['ZendeskConfiguration'][_0x6639('0x54')]({'where':{'id':_0xe0a49e[_0x6639('0x51')]['id']}})['then'](handleEntityNotFound(_0x309c06,null))[_0x6639('0x1c')](saveUpdates(_0xe0a49e[_0x6639('0x53')],null))['then'](respondWithResult(_0x309c06,null))[_0x6639('0x25')](handleError(_0x309c06,null));};exports[_0x6639('0x30')]=function(_0x17ad8f,_0x13dd5d){return db[_0x6639('0x36')]['find']({'where':{'id':_0x17ad8f[_0x6639('0x51')]['id']}})[_0x6639('0x1c')](handleEntityNotFound(_0x13dd5d,null))[_0x6639('0x1c')](removeEntity(_0x13dd5d,null))[_0x6639('0x25')](handleError(_0x13dd5d,null));};exports[_0x6639('0x55')]=function(_0x217b50,_0x238324,_0x2804ea){var _0x2c1942={};var _0x5cfbd6={};var _0x1a4c8d;var _0x3eba69;return db[_0x6639('0x36')][_0x6639('0x56')]({'where':{'id':_0x217b50[_0x6639('0x51')]['id']}})['then'](handleEntityNotFound(_0x238324,null))['then'](function(_0x35b2f4){if(_0x35b2f4){_0x1a4c8d=_0x35b2f4;_0x5cfbd6[_0x6639('0x3b')]=_['keys'](db[_0x6639('0x57')][_0x6639('0x37')]);_0x5cfbd6[_0x6639('0x3c')]=_[_0x6639('0x3d')](_0x217b50['query']);_0x5cfbd6[_0x6639('0x3e')]=_[_0x6639('0x3f')](_0x5cfbd6[_0x6639('0x3b')],_0x5cfbd6[_0x6639('0x3c')]);_0x2c1942[_0x6639('0x40')]=_[_0x6639('0x3f')](_0x5cfbd6['model'],qs['fields'](_0x217b50[_0x6639('0x3c')][_0x6639('0x41')]));_0x2c1942[_0x6639('0x40')]=_0x2c1942[_0x6639('0x40')]['length']?_0x2c1942['attributes']:_0x5cfbd6['model'];_0x2c1942[_0x6639('0x45')]=qs[_0x6639('0x46')](_0x217b50[_0x6639('0x3c')]['sort']);_0x2c1942[_0x6639('0x47')]=qs[_0x6639('0x3e')](_['pick'](_0x217b50[_0x6639('0x3c')],_0x5cfbd6[_0x6639('0x3e')]));if(_0x217b50['query'][_0x6639('0x49')]){_0x2c1942[_0x6639('0x47')]=_[_0x6639('0x4a')](_0x2c1942[_0x6639('0x47')],{'$or':_['map'](_0x2c1942[_0x6639('0x40')],function(_0x1f07ff){var _0x2b84c8={};_0x2b84c8[_0x1f07ff]={'$like':'%'+_0x217b50[_0x6639('0x3c')][_0x6639('0x49')]+'%'};return _0x2b84c8;})});}_0x2c1942=_['merge']({},_0x2c1942,_0x217b50[_0x6639('0x4c')]);return _0x1a4c8d['getFields'](_0x2c1942);}})[_0x6639('0x1c')](function(_0x50f8b6){if(_0x50f8b6){_0x3eba69=_0x50f8b6[_0x6639('0x42')];if(!_0x217b50[_0x6639('0x3c')]['hasOwnProperty'](_0x6639('0x44'))){_0x2c1942[_0x6639('0x2b')]=qs[_0x6639('0x2b')](_0x217b50[_0x6639('0x3c')][_0x6639('0x2b')]);_0x2c1942[_0x6639('0x2a')]=qs[_0x6639('0x2a')](_0x217b50[_0x6639('0x3c')]['offset']);}return _0x1a4c8d[_0x6639('0x55')](_0x2c1942);}})[_0x6639('0x1c')](function(_0x234c4e){if(_0x234c4e){return _0x234c4e?{'count':_0x3eba69,'rows':_0x234c4e}:null;}})[_0x6639('0x1c')](respondWithResult(_0x238324,null))[_0x6639('0x25')](handleError(_0x238324,null));};exports[_0x6639('0x58')]=function(_0x15e05d,_0x264396,_0x4888a6){var _0x287ef1={};var _0xd44f11={};var _0x350c6b;var _0x3ef1aa;return db[_0x6639('0x36')][_0x6639('0x56')]({'where':{'id':_0x15e05d[_0x6639('0x51')]['id']}})[_0x6639('0x1c')](handleEntityNotFound(_0x264396,null))[_0x6639('0x1c')](function(_0x42d632){if(_0x42d632){_0x350c6b=_0x42d632;_0xd44f11[_0x6639('0x3b')]=_[_0x6639('0x3d')](db[_0x6639('0x57')][_0x6639('0x37')]);_0xd44f11[_0x6639('0x3c')]=_['keys'](_0x15e05d[_0x6639('0x3c')]);_0xd44f11['filters']=_[_0x6639('0x3f')](_0xd44f11[_0x6639('0x3b')],_0xd44f11[_0x6639('0x3c')]);_0x287ef1[_0x6639('0x40')]=_[_0x6639('0x3f')](_0xd44f11[_0x6639('0x3b')],qs[_0x6639('0x41')](_0x15e05d['query']['fields']));_0x287ef1[_0x6639('0x40')]=_0x287ef1[_0x6639('0x40')][_0x6639('0x42')]?_0x287ef1[_0x6639('0x40')]:_0xd44f11[_0x6639('0x3b')];_0x287ef1[_0x6639('0x45')]=qs['sort'](_0x15e05d['query']['sort']);_0x287ef1[_0x6639('0x47')]=qs[_0x6639('0x3e')](_[_0x6639('0x48')](_0x15e05d[_0x6639('0x3c')],_0xd44f11['filters']));if(_0x15e05d['query'][_0x6639('0x49')]){_0x287ef1['where']=_[_0x6639('0x4a')](_0x287ef1['where'],{'$or':_[_0x6639('0x35')](_0x287ef1[_0x6639('0x40')],function(_0x54ed2b){var _0x2e297d={};_0x2e297d[_0x54ed2b]={'$like':'%'+_0x15e05d[_0x6639('0x3c')][_0x6639('0x49')]+'%'};return _0x2e297d;})});}_0x287ef1=_['merge']({},_0x287ef1,_0x15e05d[_0x6639('0x4c')]);return _0x350c6b[_0x6639('0x58')](_0x287ef1);}})[_0x6639('0x1c')](function(_0x2d551d){if(_0x2d551d){_0x3ef1aa=_0x2d551d[_0x6639('0x42')];if(!_0x15e05d[_0x6639('0x3c')][_0x6639('0x43')](_0x6639('0x44'))){_0x287ef1['limit']=qs[_0x6639('0x2b')](_0x15e05d[_0x6639('0x3c')][_0x6639('0x2b')]);_0x287ef1[_0x6639('0x2a')]=qs['offset'](_0x15e05d[_0x6639('0x3c')][_0x6639('0x2a')]);}return _0x350c6b[_0x6639('0x58')](_0x287ef1);}})['then'](function(_0x1e1584){if(_0x1e1584){return _0x1e1584?{'count':_0x3ef1aa,'rows':_0x1e1584}:null;}})[_0x6639('0x1c')](respondWithResult(_0x264396,null))[_0x6639('0x25')](handleError(_0x264396,null));};exports[_0x6639('0x59')]=function(_0x4bde72,_0x1f8efc,_0x2a7b35){var _0x1e10fe={};var _0x500ee1={};var _0x4591d4;var _0x2429f4;return db[_0x6639('0x36')][_0x6639('0x56')]({'where':{'id':_0x4bde72[_0x6639('0x51')]['id']}})['then'](handleEntityNotFound(_0x1f8efc,null))['then'](function(_0x3f25f4){if(_0x3f25f4){_0x4591d4=_0x3f25f4;_0x500ee1[_0x6639('0x3b')]=_[_0x6639('0x3d')](db[_0x6639('0x57')][_0x6639('0x37')]);_0x500ee1['query']=_[_0x6639('0x3d')](_0x4bde72[_0x6639('0x3c')]);_0x500ee1[_0x6639('0x3e')]=_[_0x6639('0x3f')](_0x500ee1[_0x6639('0x3b')],_0x500ee1[_0x6639('0x3c')]);_0x1e10fe['attributes']=_['intersection'](_0x500ee1['model'],qs[_0x6639('0x41')](_0x4bde72[_0x6639('0x3c')][_0x6639('0x41')]));_0x1e10fe[_0x6639('0x40')]=_0x1e10fe[_0x6639('0x40')][_0x6639('0x42')]?_0x1e10fe[_0x6639('0x40')]:_0x500ee1[_0x6639('0x3b')];_0x1e10fe[_0x6639('0x45')]=qs['sort'](_0x4bde72['query'][_0x6639('0x46')]);_0x1e10fe[_0x6639('0x47')]=qs['filters'](_[_0x6639('0x48')](_0x4bde72[_0x6639('0x3c')],_0x500ee1[_0x6639('0x3e')]));if(_0x4bde72[_0x6639('0x3c')][_0x6639('0x49')]){_0x1e10fe[_0x6639('0x47')]=_[_0x6639('0x4a')](_0x1e10fe['where'],{'$or':_[_0x6639('0x35')](_0x1e10fe[_0x6639('0x40')],function(_0x2c4267){var _0x266a10={};_0x266a10[_0x2c4267]={'$like':'%'+_0x4bde72['query']['filter']+'%'};return _0x266a10;})});}_0x1e10fe=_['merge']({},_0x1e10fe,_0x4bde72['options']);return _0x4591d4[_0x6639('0x59')](_0x1e10fe);}})[_0x6639('0x1c')](function(_0x1301b6){if(_0x1301b6){_0x2429f4=_0x1301b6['length'];if(!_0x4bde72[_0x6639('0x3c')][_0x6639('0x43')]('nolimit')){_0x1e10fe[_0x6639('0x2b')]=qs[_0x6639('0x2b')](_0x4bde72[_0x6639('0x3c')][_0x6639('0x2b')]);_0x1e10fe[_0x6639('0x2a')]=qs[_0x6639('0x2a')](_0x4bde72[_0x6639('0x3c')]['offset']);}return _0x4591d4[_0x6639('0x59')](_0x1e10fe);}})[_0x6639('0x1c')](function(_0x52a11a){if(_0x52a11a){return _0x52a11a?{'count':_0x2429f4,'rows':_0x52a11a}:null;}})['then'](respondWithResult(_0x1f8efc,null))[_0x6639('0x25')](handleError(_0x1f8efc,null));};exports[_0x6639('0x5a')]=function(_0x4d8b0c,_0x1d12e0,_0x41b780){var _0x4e1cec={};var _0x1750ae={};var _0xf77385;var _0x4c855d;return db[_0x6639('0x36')][_0x6639('0x56')]({'where':{'id':_0x4d8b0c['params']['id']}})['then'](handleEntityNotFound(_0x1d12e0,null))['then'](function(_0x50efac){if(_0x50efac){_0xf77385=_0x50efac;_0x1750ae[_0x6639('0x3b')]=_[_0x6639('0x3d')](db[_0x6639('0x5b')][_0x6639('0x37')]);_0x1750ae[_0x6639('0x3c')]=_[_0x6639('0x3d')](_0x4d8b0c[_0x6639('0x3c')]);_0x1750ae['filters']=_[_0x6639('0x3f')](_0x1750ae[_0x6639('0x3b')],_0x1750ae[_0x6639('0x3c')]);_0x4e1cec[_0x6639('0x40')]=_[_0x6639('0x3f')](_0x1750ae[_0x6639('0x3b')],qs[_0x6639('0x41')](_0x4d8b0c[_0x6639('0x3c')]['fields']));_0x4e1cec[_0x6639('0x40')]=_0x4e1cec[_0x6639('0x40')]['length']?_0x4e1cec['attributes']:_0x1750ae[_0x6639('0x3b')];_0x4e1cec[_0x6639('0x45')]=qs[_0x6639('0x46')](_0x4d8b0c[_0x6639('0x3c')]['sort']);_0x4e1cec[_0x6639('0x47')]=qs[_0x6639('0x3e')](_[_0x6639('0x48')](_0x4d8b0c['query'],_0x1750ae[_0x6639('0x3e')]));if(_0x4d8b0c[_0x6639('0x3c')][_0x6639('0x49')]){_0x4e1cec[_0x6639('0x47')]=_['merge'](_0x4e1cec[_0x6639('0x47')],{'$or':_[_0x6639('0x35')](_0x4e1cec[_0x6639('0x40')],function(_0x297848){var _0x48b3c7={};_0x48b3c7[_0x297848]={'$like':'%'+_0x4d8b0c[_0x6639('0x3c')][_0x6639('0x49')]+'%'};return _0x48b3c7;})});}_0x4e1cec=_[_0x6639('0x4a')]({},_0x4e1cec,_0x4d8b0c[_0x6639('0x4c')]);return _0xf77385[_0x6639('0x5a')](_0x4e1cec);}})[_0x6639('0x1c')](function(_0x1ba411){if(_0x1ba411){_0x4c855d=_0x1ba411[_0x6639('0x42')];if(!_0x4d8b0c['query'][_0x6639('0x43')](_0x6639('0x44'))){_0x4e1cec[_0x6639('0x2b')]=qs['limit'](_0x4d8b0c[_0x6639('0x3c')][_0x6639('0x2b')]);_0x4e1cec['offset']=qs[_0x6639('0x2a')](_0x4d8b0c['query'][_0x6639('0x2a')]);}return _0xf77385[_0x6639('0x5a')](_0x4e1cec);}})[_0x6639('0x1c')](function(_0x530098){if(_0x530098){return _0x530098?{'count':_0x4c855d,'rows':_0x530098}:null;}})['then'](respondWithResult(_0x1d12e0,null))['catch'](handleError(_0x1d12e0,null));};exports[_0x6639('0x5c')]=function(_0x1390d7,_0x5f0843,_0x236ae2){if(_0x1390d7['body']['id']){delete _0x1390d7[_0x6639('0x53')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1390d7[_0x6639('0x51')]['id']}})[_0x6639('0x1c')](handleEntityNotFound(_0x5f0843,null))[_0x6639('0x1c')](function(_0x1eaad9){if(_0x1eaad9){return _0x1eaad9[_0x6639('0x5c')](_0x1390d7[_0x6639('0x53')]['ids']||[]);}return null;})['then'](respondWithResult(_0x5f0843,null))[_0x6639('0x25')](handleError(_0x5f0843,null));}; \ No newline at end of file +var _0x0c96=['jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','limit','set','Content-Range','json','apply','save','update','destroy','end','stack','name','send','index','map','ZendeskConfiguration','fieldName','key','model','query','keys','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','count','findAll','show','params','rawAttributes','intersection','includeAll','include','options','create','body','find','getFields','findOne','ZendeskField','getSubjects','getDescriptions','nolimit','getTags','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x0c96,0x1c0));var _0x60c9=function(_0x35fc6b,_0x2e006b){_0x35fc6b=_0x35fc6b-0x0;var _0x1b75a6=_0x0c96[_0x35fc6b];return _0x1b75a6;};'use strict';var pdf=require(_0x60c9('0x0'));var emlformat=require(_0x60c9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x60c9('0x2'));var jsonpatch=require(_0x60c9('0x3'));var rp=require(_0x60c9('0x4'));var moment=require('moment');var BPromise=require(_0x60c9('0x5'));var Mustache=require(_0x60c9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x60c9('0x7'));var csv=require(_0x60c9('0x8'));var ejs=require(_0x60c9('0x9'));var fs=require('fs');var _=require(_0x60c9('0xa'));var squel=require(_0x60c9('0xb'));var crypto=require(_0x60c9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x60c9('0xd'));var toCsv=require(_0x60c9('0x8'));var querystring=require('querystring');var Papa=require(_0x60c9('0xe'));var Redis=require('ioredis');var authService=require(_0x60c9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x60c9('0x10'));var hardwareService=require(_0x60c9('0x11'));var logger=require(_0x60c9('0x12'))(_0x60c9('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x60c9('0x14'));var db=require(_0x60c9('0x15'))['db'];var jayson=require(_0x60c9('0x16'));var client=jayson[_0x60c9('0x17')][_0x60c9('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x36be7b,_0x3f7fc3,_0x12abdc,_0x421061){return new BPromise(function(_0x44a536,_0xd1060a){var _0x4bdc0e=_0x421061||client;return _0x4bdc0e['request'](_0x36be7b,_0x12abdc)[_0x60c9('0x19')](function(_0x27335d){logger[_0x60c9('0x1a')](_0x60c9('0x1b'),_0x3f7fc3,_0x60c9('0x1c'));logger[_0x60c9('0x1d')](_0x60c9('0x1e'),_0x3f7fc3,_0x60c9('0x1c'),JSON[_0x60c9('0x1f')](_0x27335d));if(_0x27335d[_0x60c9('0x20')]){if(_0x27335d[_0x60c9('0x20')][_0x60c9('0x21')]===0x1f4){logger[_0x60c9('0x20')](_0x60c9('0x1b'),_0x3f7fc3,_0x27335d[_0x60c9('0x20')][_0x60c9('0x22')]);return _0xd1060a(_0x27335d[_0x60c9('0x20')][_0x60c9('0x22')]);}logger[_0x60c9('0x20')](_0x60c9('0x1b'),_0x3f7fc3,_0x27335d['error']['message']);return _0x44a536(_0x27335d['error'][_0x60c9('0x22')]);}else{logger['info'](_0x60c9('0x1b'),_0x3f7fc3,_0x60c9('0x1c'));_0x44a536(_0x27335d[_0x60c9('0x23')][_0x60c9('0x22')]);}})[_0x60c9('0x24')](function(_0x32aa1a){logger[_0x60c9('0x20')](_0x60c9('0x1b'),_0x3f7fc3,_0x32aa1a);_0xd1060a(_0x32aa1a);});});}function respondWithStatusCode(_0xc2a381,_0x39f9ea){_0x39f9ea=_0x39f9ea||0xcc;return function(_0x3ce547){if(_0x3ce547){return _0xc2a381[_0x60c9('0x25')](_0x39f9ea);}return _0xc2a381[_0x60c9('0x26')](_0x39f9ea)['end']();};}function respondWithResult(_0x16a2d7,_0x188eb7){_0x188eb7=_0x188eb7||0xc8;return function(_0x3d8868){if(_0x3d8868){return _0x16a2d7[_0x60c9('0x26')](_0x188eb7)['json'](_0x3d8868);}};}function respondWithFilteredResult(_0x45d6ad,_0x43a800){return function(_0x5b56e6){if(_0x5b56e6){var _0x20faf6=_0x5b56e6['count'],_0x210f24=_0x43a800[_0x60c9('0x27')],_0x57235d=_0x43a800[_0x60c9('0x27')]+_0x43a800[_0x60c9('0x28')],_0x5b511e;if(_0x57235d>=_0x20faf6){_0x57235d=_0x20faf6;_0x5b511e=0xc8;}else{_0x5b511e=0xce;}_0x45d6ad[_0x60c9('0x26')](_0x5b511e);return _0x45d6ad[_0x60c9('0x29')](_0x60c9('0x2a'),_0x210f24+'-'+_0x57235d+'/'+_0x20faf6)[_0x60c9('0x2b')](_0x5b56e6);}return null;};}function patchUpdates(_0x319086){return function(_0x1af695){try{jsonpatch[_0x60c9('0x2c')](_0x1af695,_0x319086,!![]);}catch(_0x26599f){return BPromise['reject'](_0x26599f);}return _0x1af695[_0x60c9('0x2d')]();};}function saveUpdates(_0x475f17,_0x229815){return function(_0x27d662){if(_0x27d662){return _0x27d662[_0x60c9('0x2e')](_0x475f17)[_0x60c9('0x19')](function(_0x26b044){return _0x26b044;});}return null;};}function removeEntity(_0x1b33db,_0xa36054){return function(_0x15a78e){if(_0x15a78e){return _0x15a78e[_0x60c9('0x2f')]()[_0x60c9('0x19')](function(){_0x1b33db[_0x60c9('0x26')](0xcc)[_0x60c9('0x30')]();});}};}function handleEntityNotFound(_0xa7bf76,_0x199be8){return function(_0x53085d){if(!_0x53085d){_0xa7bf76[_0x60c9('0x25')](0x194);}return _0x53085d;};}function handleError(_0x253101,_0x59928e){_0x59928e=_0x59928e||0x1f4;return function(_0x2a1453){logger['error'](_0x2a1453[_0x60c9('0x31')]);if(_0x2a1453['name']){delete _0x2a1453[_0x60c9('0x32')];}_0x253101['status'](_0x59928e)[_0x60c9('0x33')](_0x2a1453);};}exports[_0x60c9('0x34')]=function(_0x39d90b,_0x28a6eb){var _0x1df32f={},_0x54a441={},_0x27495a={'count':0x0,'rows':[]};var _0x6a5666=_[_0x60c9('0x35')](db[_0x60c9('0x36')]['rawAttributes'],function(_0x305b41){return{'name':_0x305b41[_0x60c9('0x37')],'type':_0x305b41['type'][_0x60c9('0x38')]};});_0x54a441[_0x60c9('0x39')]=_[_0x60c9('0x35')](_0x6a5666,_0x60c9('0x32'));_0x54a441[_0x60c9('0x3a')]=_[_0x60c9('0x3b')](_0x39d90b[_0x60c9('0x3a')]);_0x54a441['filters']=_['intersection'](_0x54a441[_0x60c9('0x39')],_0x54a441[_0x60c9('0x3a')]);_0x1df32f['attributes']=_['intersection'](_0x54a441[_0x60c9('0x39')],qs['fields'](_0x39d90b[_0x60c9('0x3a')][_0x60c9('0x3c')]));_0x1df32f[_0x60c9('0x3d')]=_0x1df32f[_0x60c9('0x3d')][_0x60c9('0x3e')]?_0x1df32f[_0x60c9('0x3d')]:_0x54a441[_0x60c9('0x39')];if(!_0x39d90b[_0x60c9('0x3a')][_0x60c9('0x3f')]('nolimit')){_0x1df32f['limit']=qs[_0x60c9('0x28')](_0x39d90b[_0x60c9('0x3a')][_0x60c9('0x28')]);_0x1df32f[_0x60c9('0x27')]=qs[_0x60c9('0x27')](_0x39d90b[_0x60c9('0x3a')][_0x60c9('0x27')]);}_0x1df32f[_0x60c9('0x40')]=qs[_0x60c9('0x41')](_0x39d90b[_0x60c9('0x3a')]['sort']);_0x1df32f[_0x60c9('0x42')]=qs[_0x60c9('0x43')](_[_0x60c9('0x44')](_0x39d90b[_0x60c9('0x3a')],_0x54a441['filters']),_0x6a5666);if(_0x39d90b[_0x60c9('0x3a')][_0x60c9('0x45')]){_0x1df32f[_0x60c9('0x42')]=_[_0x60c9('0x46')](_0x1df32f['where'],{'$or':_[_0x60c9('0x35')](_0x6a5666,function(_0xe05966){if(_0xe05966[_0x60c9('0x47')]!==_0x60c9('0x48')){var _0x4afd6c={};_0x4afd6c[_0xe05966[_0x60c9('0x32')]]={'$like':'%'+_0x39d90b[_0x60c9('0x3a')][_0x60c9('0x45')]+'%'};return _0x4afd6c;}})});}_0x1df32f=_[_0x60c9('0x46')]({},_0x1df32f,_0x39d90b['options']);var _0x4d6233={'where':_0x1df32f[_0x60c9('0x42')]};return db[_0x60c9('0x36')][_0x60c9('0x49')](_0x4d6233)[_0x60c9('0x19')](function(_0x34aa50){_0x27495a[_0x60c9('0x49')]=_0x34aa50;if(_0x39d90b[_0x60c9('0x3a')]['includeAll']){_0x1df32f['include']=[{'all':!![]}];}return db[_0x60c9('0x36')][_0x60c9('0x4a')](_0x1df32f);})[_0x60c9('0x19')](function(_0x12ec92){_0x27495a['rows']=_0x12ec92;return _0x27495a;})[_0x60c9('0x19')](respondWithFilteredResult(_0x28a6eb,_0x1df32f))[_0x60c9('0x24')](handleError(_0x28a6eb,null));};exports[_0x60c9('0x4b')]=function(_0x432eb8,_0x412af0){var _0xaf7300={'raw':![],'where':{'id':_0x432eb8[_0x60c9('0x4c')]['id']}},_0x20f3f6={};_0x20f3f6['model']=_[_0x60c9('0x3b')](db['ZendeskConfiguration'][_0x60c9('0x4d')]);_0x20f3f6[_0x60c9('0x3a')]=_['keys'](_0x432eb8['query']);_0x20f3f6[_0x60c9('0x43')]=_['intersection'](_0x20f3f6[_0x60c9('0x39')],_0x20f3f6['query']);_0xaf7300[_0x60c9('0x3d')]=_[_0x60c9('0x4e')](_0x20f3f6[_0x60c9('0x39')],qs[_0x60c9('0x3c')](_0x432eb8['query'][_0x60c9('0x3c')]));_0xaf7300['attributes']=_0xaf7300['attributes'][_0x60c9('0x3e')]?_0xaf7300[_0x60c9('0x3d')]:_0x20f3f6[_0x60c9('0x39')];if(_0x432eb8['query'][_0x60c9('0x4f')]){_0xaf7300[_0x60c9('0x50')]=[{'all':!![]}];}_0xaf7300=_[_0x60c9('0x46')]({},_0xaf7300,_0x432eb8[_0x60c9('0x51')]);return db[_0x60c9('0x36')]['find'](_0xaf7300)[_0x60c9('0x19')](handleEntityNotFound(_0x412af0,null))[_0x60c9('0x19')](respondWithResult(_0x412af0,null))['catch'](handleError(_0x412af0,null));};exports[_0x60c9('0x52')]=function(_0x1b1df0,_0x1c3a6b){return db['ZendeskConfiguration']['create'](_0x1b1df0[_0x60c9('0x53')],{})[_0x60c9('0x19')](respondWithResult(_0x1c3a6b,0xc9))[_0x60c9('0x24')](handleError(_0x1c3a6b,null));};exports['update']=function(_0xa4665a,_0x5f314e){if(_0xa4665a[_0x60c9('0x53')]['id']){delete _0xa4665a[_0x60c9('0x53')]['id'];}return db['ZendeskConfiguration'][_0x60c9('0x54')]({'where':{'id':_0xa4665a[_0x60c9('0x4c')]['id']}})[_0x60c9('0x19')](handleEntityNotFound(_0x5f314e,null))[_0x60c9('0x19')](saveUpdates(_0xa4665a[_0x60c9('0x53')],null))[_0x60c9('0x19')](respondWithResult(_0x5f314e,null))[_0x60c9('0x24')](handleError(_0x5f314e,null));};exports[_0x60c9('0x2f')]=function(_0x48630d,_0x33427d){return db[_0x60c9('0x36')][_0x60c9('0x54')]({'where':{'id':_0x48630d[_0x60c9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x33427d,null))[_0x60c9('0x19')](removeEntity(_0x33427d,null))['catch'](handleError(_0x33427d,null));};exports[_0x60c9('0x55')]=function(_0x116913,_0x599dd9,_0x3a5f73){var _0x19bec2={};var _0x1cd765={};var _0x4d88b5;var _0x36062e;return db[_0x60c9('0x36')][_0x60c9('0x56')]({'where':{'id':_0x116913['params']['id']}})['then'](handleEntityNotFound(_0x599dd9,null))[_0x60c9('0x19')](function(_0x35ed5f){if(_0x35ed5f){_0x4d88b5=_0x35ed5f;_0x1cd765[_0x60c9('0x39')]=_[_0x60c9('0x3b')](db[_0x60c9('0x57')][_0x60c9('0x4d')]);_0x1cd765[_0x60c9('0x3a')]=_['keys'](_0x116913[_0x60c9('0x3a')]);_0x1cd765[_0x60c9('0x43')]=_[_0x60c9('0x4e')](_0x1cd765['model'],_0x1cd765[_0x60c9('0x3a')]);_0x19bec2['attributes']=_[_0x60c9('0x4e')](_0x1cd765[_0x60c9('0x39')],qs['fields'](_0x116913[_0x60c9('0x3a')][_0x60c9('0x3c')]));_0x19bec2[_0x60c9('0x3d')]=_0x19bec2[_0x60c9('0x3d')][_0x60c9('0x3e')]?_0x19bec2[_0x60c9('0x3d')]:_0x1cd765[_0x60c9('0x39')];_0x19bec2['order']=qs[_0x60c9('0x41')](_0x116913[_0x60c9('0x3a')]['sort']);_0x19bec2[_0x60c9('0x42')]=qs['filters'](_['pick'](_0x116913[_0x60c9('0x3a')],_0x1cd765['filters']));if(_0x116913[_0x60c9('0x3a')]['filter']){_0x19bec2[_0x60c9('0x42')]=_[_0x60c9('0x46')](_0x19bec2[_0x60c9('0x42')],{'$or':_[_0x60c9('0x35')](_0x19bec2[_0x60c9('0x3d')],function(_0x1447dd){var _0x2902e6={};_0x2902e6[_0x1447dd]={'$like':'%'+_0x116913[_0x60c9('0x3a')][_0x60c9('0x45')]+'%'};return _0x2902e6;})});}_0x19bec2=_['merge']({},_0x19bec2,_0x116913[_0x60c9('0x51')]);return _0x4d88b5[_0x60c9('0x55')](_0x19bec2);}})[_0x60c9('0x19')](function(_0x41e2ce){if(_0x41e2ce){_0x36062e=_0x41e2ce[_0x60c9('0x3e')];if(!_0x116913['query'][_0x60c9('0x3f')]('nolimit')){_0x19bec2['limit']=qs['limit'](_0x116913[_0x60c9('0x3a')][_0x60c9('0x28')]);_0x19bec2[_0x60c9('0x27')]=qs['offset'](_0x116913['query'][_0x60c9('0x27')]);}return _0x4d88b5[_0x60c9('0x55')](_0x19bec2);}})[_0x60c9('0x19')](function(_0x5a42b5){if(_0x5a42b5){return _0x5a42b5?{'count':_0x36062e,'rows':_0x5a42b5}:null;}})[_0x60c9('0x19')](respondWithResult(_0x599dd9,null))['catch'](handleError(_0x599dd9,null));};exports['getSubjects']=function(_0x57313d,_0x46c921,_0x5e5b9d){var _0x21f0ca={};var _0x76ae2e={};var _0x2338e6;var _0x51721d;return db[_0x60c9('0x36')][_0x60c9('0x56')]({'where':{'id':_0x57313d['params']['id']}})[_0x60c9('0x19')](handleEntityNotFound(_0x46c921,null))[_0x60c9('0x19')](function(_0x3d866e){if(_0x3d866e){_0x2338e6=_0x3d866e;_0x76ae2e['model']=_[_0x60c9('0x3b')](db['ZendeskField'][_0x60c9('0x4d')]);_0x76ae2e[_0x60c9('0x3a')]=_[_0x60c9('0x3b')](_0x57313d[_0x60c9('0x3a')]);_0x76ae2e['filters']=_[_0x60c9('0x4e')](_0x76ae2e['model'],_0x76ae2e['query']);_0x21f0ca['attributes']=_['intersection'](_0x76ae2e[_0x60c9('0x39')],qs[_0x60c9('0x3c')](_0x57313d[_0x60c9('0x3a')][_0x60c9('0x3c')]));_0x21f0ca['attributes']=_0x21f0ca[_0x60c9('0x3d')][_0x60c9('0x3e')]?_0x21f0ca['attributes']:_0x76ae2e[_0x60c9('0x39')];_0x21f0ca[_0x60c9('0x40')]=qs[_0x60c9('0x41')](_0x57313d['query']['sort']);_0x21f0ca['where']=qs[_0x60c9('0x43')](_[_0x60c9('0x44')](_0x57313d[_0x60c9('0x3a')],_0x76ae2e[_0x60c9('0x43')]));if(_0x57313d['query'][_0x60c9('0x45')]){_0x21f0ca[_0x60c9('0x42')]=_[_0x60c9('0x46')](_0x21f0ca[_0x60c9('0x42')],{'$or':_['map'](_0x21f0ca[_0x60c9('0x3d')],function(_0x32304a){var _0x4abae5={};_0x4abae5[_0x32304a]={'$like':'%'+_0x57313d[_0x60c9('0x3a')][_0x60c9('0x45')]+'%'};return _0x4abae5;})});}_0x21f0ca=_[_0x60c9('0x46')]({},_0x21f0ca,_0x57313d['options']);return _0x2338e6[_0x60c9('0x58')](_0x21f0ca);}})[_0x60c9('0x19')](function(_0x6d728){if(_0x6d728){_0x51721d=_0x6d728[_0x60c9('0x3e')];if(!_0x57313d[_0x60c9('0x3a')][_0x60c9('0x3f')]('nolimit')){_0x21f0ca['limit']=qs[_0x60c9('0x28')](_0x57313d['query'][_0x60c9('0x28')]);_0x21f0ca[_0x60c9('0x27')]=qs[_0x60c9('0x27')](_0x57313d[_0x60c9('0x3a')]['offset']);}return _0x2338e6[_0x60c9('0x58')](_0x21f0ca);}})['then'](function(_0x31aa54){if(_0x31aa54){return _0x31aa54?{'count':_0x51721d,'rows':_0x31aa54}:null;}})['then'](respondWithResult(_0x46c921,null))[_0x60c9('0x24')](handleError(_0x46c921,null));};exports[_0x60c9('0x59')]=function(_0x26da39,_0x9e2c4a,_0x353bb9){var _0x17eb7f={};var _0x2d3b1a={};var _0x4811d6;var _0x476877;return db[_0x60c9('0x36')][_0x60c9('0x56')]({'where':{'id':_0x26da39[_0x60c9('0x4c')]['id']}})[_0x60c9('0x19')](handleEntityNotFound(_0x9e2c4a,null))[_0x60c9('0x19')](function(_0x151582){if(_0x151582){_0x4811d6=_0x151582;_0x2d3b1a[_0x60c9('0x39')]=_[_0x60c9('0x3b')](db['ZendeskField'][_0x60c9('0x4d')]);_0x2d3b1a[_0x60c9('0x3a')]=_['keys'](_0x26da39[_0x60c9('0x3a')]);_0x2d3b1a[_0x60c9('0x43')]=_[_0x60c9('0x4e')](_0x2d3b1a['model'],_0x2d3b1a[_0x60c9('0x3a')]);_0x17eb7f[_0x60c9('0x3d')]=_['intersection'](_0x2d3b1a['model'],qs['fields'](_0x26da39[_0x60c9('0x3a')]['fields']));_0x17eb7f[_0x60c9('0x3d')]=_0x17eb7f[_0x60c9('0x3d')]['length']?_0x17eb7f[_0x60c9('0x3d')]:_0x2d3b1a[_0x60c9('0x39')];_0x17eb7f[_0x60c9('0x40')]=qs[_0x60c9('0x41')](_0x26da39['query'][_0x60c9('0x41')]);_0x17eb7f[_0x60c9('0x42')]=qs[_0x60c9('0x43')](_['pick'](_0x26da39[_0x60c9('0x3a')],_0x2d3b1a[_0x60c9('0x43')]));if(_0x26da39[_0x60c9('0x3a')][_0x60c9('0x45')]){_0x17eb7f['where']=_['merge'](_0x17eb7f[_0x60c9('0x42')],{'$or':_[_0x60c9('0x35')](_0x17eb7f[_0x60c9('0x3d')],function(_0x4354e4){var _0x3407a2={};_0x3407a2[_0x4354e4]={'$like':'%'+_0x26da39[_0x60c9('0x3a')][_0x60c9('0x45')]+'%'};return _0x3407a2;})});}_0x17eb7f=_['merge']({},_0x17eb7f,_0x26da39[_0x60c9('0x51')]);return _0x4811d6['getDescriptions'](_0x17eb7f);}})['then'](function(_0x5e0c62){if(_0x5e0c62){_0x476877=_0x5e0c62[_0x60c9('0x3e')];if(!_0x26da39[_0x60c9('0x3a')][_0x60c9('0x3f')](_0x60c9('0x5a'))){_0x17eb7f[_0x60c9('0x28')]=qs[_0x60c9('0x28')](_0x26da39['query']['limit']);_0x17eb7f['offset']=qs['offset'](_0x26da39['query']['offset']);}return _0x4811d6[_0x60c9('0x59')](_0x17eb7f);}})[_0x60c9('0x19')](function(_0x1b42bf){if(_0x1b42bf){return _0x1b42bf?{'count':_0x476877,'rows':_0x1b42bf}:null;}})['then'](respondWithResult(_0x9e2c4a,null))[_0x60c9('0x24')](handleError(_0x9e2c4a,null));};exports['getTags']=function(_0x16b537,_0x21f329,_0x2ee47b){var _0x15100e={};var _0x842ff={};var _0x5c5ef3;var _0x2d31fd;return db[_0x60c9('0x36')][_0x60c9('0x56')]({'where':{'id':_0x16b537['params']['id']}})[_0x60c9('0x19')](handleEntityNotFound(_0x21f329,null))[_0x60c9('0x19')](function(_0x278e3e){if(_0x278e3e){_0x5c5ef3=_0x278e3e;_0x842ff[_0x60c9('0x39')]=_[_0x60c9('0x3b')](db['Tag'][_0x60c9('0x4d')]);_0x842ff[_0x60c9('0x3a')]=_['keys'](_0x16b537['query']);_0x842ff['filters']=_[_0x60c9('0x4e')](_0x842ff['model'],_0x842ff['query']);_0x15100e[_0x60c9('0x3d')]=_[_0x60c9('0x4e')](_0x842ff['model'],qs['fields'](_0x16b537[_0x60c9('0x3a')][_0x60c9('0x3c')]));_0x15100e[_0x60c9('0x3d')]=_0x15100e[_0x60c9('0x3d')][_0x60c9('0x3e')]?_0x15100e[_0x60c9('0x3d')]:_0x842ff[_0x60c9('0x39')];_0x15100e['order']=qs[_0x60c9('0x41')](_0x16b537[_0x60c9('0x3a')][_0x60c9('0x41')]);_0x15100e[_0x60c9('0x42')]=qs[_0x60c9('0x43')](_[_0x60c9('0x44')](_0x16b537[_0x60c9('0x3a')],_0x842ff['filters']));if(_0x16b537[_0x60c9('0x3a')][_0x60c9('0x45')]){_0x15100e[_0x60c9('0x42')]=_['merge'](_0x15100e[_0x60c9('0x42')],{'$or':_[_0x60c9('0x35')](_0x15100e[_0x60c9('0x3d')],function(_0x4f6af1){var _0x5c54e1={};_0x5c54e1[_0x4f6af1]={'$like':'%'+_0x16b537[_0x60c9('0x3a')][_0x60c9('0x45')]+'%'};return _0x5c54e1;})});}_0x15100e=_[_0x60c9('0x46')]({},_0x15100e,_0x16b537[_0x60c9('0x51')]);return _0x5c5ef3[_0x60c9('0x5b')](_0x15100e);}})[_0x60c9('0x19')](function(_0x400697){if(_0x400697){_0x2d31fd=_0x400697[_0x60c9('0x3e')];if(!_0x16b537['query'][_0x60c9('0x3f')]('nolimit')){_0x15100e[_0x60c9('0x28')]=qs[_0x60c9('0x28')](_0x16b537[_0x60c9('0x3a')][_0x60c9('0x28')]);_0x15100e[_0x60c9('0x27')]=qs[_0x60c9('0x27')](_0x16b537['query'][_0x60c9('0x27')]);}return _0x5c5ef3['getTags'](_0x15100e);}})[_0x60c9('0x19')](function(_0x768ebc){if(_0x768ebc){return _0x768ebc?{'count':_0x2d31fd,'rows':_0x768ebc}:null;}})[_0x60c9('0x19')](respondWithResult(_0x21f329,null))[_0x60c9('0x24')](handleError(_0x21f329,null));};exports[_0x60c9('0x5c')]=function(_0x292aa1,_0x1c86c5,_0x19359e){if(_0x292aa1[_0x60c9('0x53')]['id']){delete _0x292aa1[_0x60c9('0x53')]['id'];}return db[_0x60c9('0x36')][_0x60c9('0x56')]({'where':{'id':_0x292aa1[_0x60c9('0x4c')]['id']}})[_0x60c9('0x19')](handleEntityNotFound(_0x1c86c5,null))[_0x60c9('0x19')](function(_0x326fb0){if(_0x326fb0){return _0x326fb0[_0x60c9('0x5c')](_0x292aa1[_0x60c9('0x53')][_0x60c9('0x5d')]||[]);}return null;})['then'](respondWithResult(_0x1c86c5,null))['catch'](handleError(_0x1c86c5,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 8485575..7e841fa 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 _0x6017=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash'];(function(_0x31cdfe,_0x12fc88){var _0x471ce3=function(_0xce9887){while(--_0xce9887){_0x31cdfe['push'](_0x31cdfe['shift']());}};_0x471ce3(++_0x12fc88);}(_0x6017,0x110));var _0x7601=function(_0x221608,_0x357be2){_0x221608=_0x221608-0x0;var _0x557280=_0x6017[_0x221608];return _0x557280;};'use strict';var _=require(_0x7601('0x0'));var util=require(_0x7601('0x1'));var logger=require(_0x7601('0x2'))(_0x7601('0x3'));var moment=require(_0x7601('0x4'));var BPromise=require(_0x7601('0x5'));var rp=require(_0x7601('0x6'));var fs=require('fs');var path=require(_0x7601('0x7'));var rimraf=require(_0x7601('0x8'));var config=require(_0x7601('0x9'));var attributes=require(_0x7601('0xa'));module['exports']=function(_0x2a1d2f,_0x39bb72){return _0x2a1d2f[_0x7601('0xb')]('ZendeskConfiguration',attributes,{'tableName':_0x7601('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39e5=['util','../../config/logger','api','bluebird','request-promise','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x4531f6,_0x5a27fb){var _0x5309a2=function(_0x5871eb){while(--_0x5871eb){_0x4531f6['push'](_0x4531f6['shift']());}};_0x5309a2(++_0x5a27fb);}(_0x39e5,0x8e));var _0x539e=function(_0x3af7e8,_0x1a076f){_0x3af7e8=_0x3af7e8-0x0;var _0x4ebb49=_0x39e5[_0x3af7e8];return _0x4ebb49;};'use strict';var _=require(_0x539e('0x0'));var util=require(_0x539e('0x1'));var logger=require(_0x539e('0x2'))(_0x539e('0x3'));var moment=require('moment');var BPromise=require(_0x539e('0x4'));var rp=require(_0x539e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x539e('0x6'));module[_0x539e('0x7')]=function(_0x7157be,_0x292917){return _0x7157be[_0x539e('0x8')](_0x539e('0x9'),attributes,{'tableName':_0x539e('0xa'),'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 1be7c4c..3401c69 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 _0x18f5=['http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x4a3ee0,_0xa9cfad){var _0x1a627d=function(_0x29bc91){while(--_0x29bc91){_0x4a3ee0['push'](_0x4a3ee0['shift']());}};_0x1a627d(++_0xa9cfad);}(_0x18f5,0x18e));var _0x518f=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x18f5[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x518f('0x0'));var util=require(_0x518f('0x1'));var moment=require(_0x518f('0x2'));var BPromise=require('bluebird');var rs=require(_0x518f('0x3'));var fs=require('fs');var Redis=require(_0x518f('0x4'));var db=require(_0x518f('0x5'))['db'];var utils=require(_0x518f('0x6'));var logger=require(_0x518f('0x7'))('rpc');var config=require(_0x518f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x518f('0x9')][_0x518f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10cd07,_0x2203ac,_0x3e6e77){return new BPromise(function(_0xf22eba,_0x152784){return client[_0x518f('0xb')](_0x10cd07,_0x3e6e77)[_0x518f('0xc')](function(_0x1a621d){logger['info'](_0x518f('0xd'),_0x2203ac,_0x518f('0xe'));logger[_0x518f('0xf')](_0x518f('0x10'),_0x2203ac,_0x518f('0xe'),JSON[_0x518f('0x11')](_0x1a621d));if(_0x1a621d[_0x518f('0x12')]){if(_0x1a621d[_0x518f('0x12')][_0x518f('0x13')]===0x1f4){logger['error'](_0x518f('0xd'),_0x2203ac,_0x1a621d[_0x518f('0x12')]['message']);return _0x152784(_0x1a621d['error'][_0x518f('0x14')]);}logger[_0x518f('0x12')](_0x518f('0xd'),_0x2203ac,_0x1a621d[_0x518f('0x12')][_0x518f('0x14')]);return _0xf22eba(_0x1a621d['error'][_0x518f('0x14')]);}else{logger[_0x518f('0x15')](_0x518f('0xd'),_0x2203ac,_0x518f('0xe'));_0xf22eba(_0x1a621d[_0x518f('0x16')][_0x518f('0x14')]);}})[_0x518f('0x17')](function(_0x2e6296){logger['error'](_0x518f('0xd'),_0x2203ac,_0x2e6296);_0x152784(_0x2e6296);});});} \ No newline at end of file +var _0x96a0=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x96a0,0x17b));var _0x096a=function(_0x39039d,_0x2411f8){_0x39039d=_0x39039d-0x0;var _0x97a927=_0x96a0[_0x39039d];return _0x97a927;};'use strict';var _=require(_0x096a('0x0'));var util=require('util');var moment=require(_0x096a('0x1'));var BPromise=require(_0x096a('0x2'));var rs=require(_0x096a('0x3'));var fs=require('fs');var Redis=require(_0x096a('0x4'));var db=require(_0x096a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x096a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x096a('0x7'));var client=jayson[_0x096a('0x8')][_0x096a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ecf9c,_0x326328,_0x42297d){return new BPromise(function(_0x22179c,_0x5cac3d){return client[_0x096a('0xa')](_0x3ecf9c,_0x42297d)[_0x096a('0xb')](function(_0xccceca){logger[_0x096a('0xc')](_0x096a('0xd'),_0x326328,_0x096a('0xe'));logger[_0x096a('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x326328,_0x096a('0xe'),JSON['stringify'](_0xccceca));if(_0xccceca['error']){if(_0xccceca['error'][_0x096a('0x10')]===0x1f4){logger[_0x096a('0x11')](_0x096a('0xd'),_0x326328,_0xccceca[_0x096a('0x11')][_0x096a('0x12')]);return _0x5cac3d(_0xccceca[_0x096a('0x11')][_0x096a('0x12')]);}logger[_0x096a('0x11')](_0x096a('0xd'),_0x326328,_0xccceca[_0x096a('0x11')]['message']);return _0x22179c(_0xccceca[_0x096a('0x11')]['message']);}else{logger[_0x096a('0xc')](_0x096a('0xd'),_0x326328,_0x096a('0xe'));_0x22179c(_0xccceca[_0x096a('0x13')][_0x096a('0x12')]);}})[_0x096a('0x14')](function(_0x3de5b8){logger[_0x096a('0x11')](_0x096a('0xd'),_0x326328,_0x3de5b8);_0x5cac3d(_0x3de5b8);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 1f2f85a..5f3d4fd 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 _0x3eec=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0x5bb0fd,_0x550b23){var _0x217bee=function(_0x2d6796){while(--_0x2d6796){_0x5bb0fd['push'](_0x5bb0fd['shift']());}};_0x217bee(++_0x550b23);}(_0x3eec,0x1e9));var _0xc3ee=function(_0xd790dd,_0x4f0824){_0xd790dd=_0xd790dd-0x0;var _0x313ea8=_0x3eec[_0xd790dd];return _0x313ea8;};'use strict';var multer=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var path=require(_0xc3ee('0x2'));var timeout=require(_0xc3ee('0x3'));var express=require('express');var router=express[_0xc3ee('0x4')]();var auth=require(_0xc3ee('0x5'));var interaction=require(_0xc3ee('0x6'));var config=require(_0xc3ee('0x7'));var controller=require(_0xc3ee('0x8'));router[_0xc3ee('0x9')]('/',auth['isAuthenticated'](),controller[_0xc3ee('0xa')]);router[_0xc3ee('0x9')](_0xc3ee('0xb'),auth[_0xc3ee('0xc')](),controller[_0xc3ee('0xd')]);router[_0xc3ee('0xe')]('/',auth[_0xc3ee('0xc')](),controller[_0xc3ee('0xf')]);router[_0xc3ee('0x10')](_0xc3ee('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc3ee('0x11')](_0xc3ee('0xb'),auth[_0xc3ee('0xc')](),controller[_0xc3ee('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4944=['/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5ebafc,_0x3fd116){var _0x227d5e=function(_0x151a5a){while(--_0x151a5a){_0x5ebafc['push'](_0x5ebafc['shift']());}};_0x227d5e(++_0x3fd116);}(_0x4944,0x6d));var _0x4494=function(_0x515ffd,_0x23f385){_0x515ffd=_0x515ffd-0x0;var _0x1d5b9a=_0x4944[_0x515ffd];return _0x1d5b9a;};'use strict';var multer=require(_0x4494('0x0'));var util=require('util');var path=require(_0x4494('0x1'));var timeout=require(_0x4494('0x2'));var express=require(_0x4494('0x3'));var router=express[_0x4494('0x4')]();var auth=require(_0x4494('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4494('0x6'));var controller=require('./intZendeskField.controller');router[_0x4494('0x7')]('/',auth[_0x4494('0x8')](),controller[_0x4494('0x9')]);router[_0x4494('0x7')](_0x4494('0xa'),auth[_0x4494('0x8')](),controller[_0x4494('0xb')]);router[_0x4494('0xc')]('/',auth[_0x4494('0x8')](),controller['create']);router[_0x4494('0xd')](_0x4494('0xa'),auth[_0x4494('0x8')](),controller[_0x4494('0xe')]);router['delete']('/:id',auth[_0x4494('0x8')](),controller[_0x4494('0xf')]);module[_0x4494('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index d5c36be..0eb15f5 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 _0x1738=['ENUM','string','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','STRING'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0x1738,0x1bc));var _0x8173=function(_0x410448,_0x3f8548){_0x410448=_0x410448-0x0;var _0x5c3225=_0x1738[_0x410448];return _0x5c3225;};'use strict';var Sequelize=require(_0x8173('0x0'));module[_0x8173('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x8173('0x2'),_0x8173('0x3'),_0x8173('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8173('0x5')]},'keyType':{'type':Sequelize[_0x8173('0x6')](_0x8173('0x7'),_0x8173('0x2'),_0x8173('0x3'))},'keyContent':{'type':Sequelize[_0x8173('0x5')]},'idField':{'type':Sequelize[_0x8173('0x5')]},'nameField':{'type':Sequelize[_0x8173('0x5')]},'customField':{'type':Sequelize[_0x8173('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8173('0x5')]}}; \ No newline at end of file +var _0xc737=['keyValue','STRING','sequelize','exports','string','variable','customVariable'];(function(_0x395a20,_0x285078){var _0xd83ba=function(_0x1c4e35){while(--_0x1c4e35){_0x395a20['push'](_0x395a20['shift']());}};_0xd83ba(++_0x285078);}(_0xc737,0x8e));var _0x7c73=function(_0x12bfee,_0x4aee0d){_0x12bfee=_0x12bfee-0x0;var _0x83d4af=_0xc737[_0x12bfee];return _0x83d4af;};'use strict';var Sequelize=require(_0x7c73('0x0'));module[_0x7c73('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7c73('0x2'),_0x7c73('0x3'),_0x7c73('0x4'),_0x7c73('0x5')),'defaultValue':_0x7c73('0x2')},'content':{'type':Sequelize[_0x7c73('0x6')]},'key':{'type':Sequelize[_0x7c73('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x7c73('0x3'),_0x7c73('0x4'))},'keyContent':{'type':Sequelize[_0x7c73('0x6')]},'idField':{'type':Sequelize[_0x7c73('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 0772676..3899a18 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 _0xeb3b=['util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','reject','update','then','sendStatus','error','stack','index','map','ZendeskField','fieldName','name','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','show','params','rawAttributes','includeAll','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x46b043,_0x1fd514){var _0x2bcc2a=function(_0x102be3){while(--_0x102be3){_0x46b043['push'](_0x46b043['shift']());}};_0x2bcc2a(++_0x1fd514);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0xeb3b[_0x442f02];return _0xab6ef1;};'use strict';var pdf=require(_0xbeb3('0x0'));var emlformat=require(_0xbeb3('0x1'));var rimraf=require(_0xbeb3('0x2'));var zipdir=require(_0xbeb3('0x3'));var jsonpatch=require(_0xbeb3('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbeb3('0x5'));var Mustache=require('mustache');var util=require(_0xbeb3('0x6'));var path=require('path');var sox=require(_0xbeb3('0x7'));var csv=require(_0xbeb3('0x8'));var ejs=require(_0xbeb3('0x9'));var fs=require('fs');var _=require(_0xbeb3('0xa'));var squel=require(_0xbeb3('0xb'));var crypto=require(_0xbeb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbeb3('0xd'));var toCsv=require(_0xbeb3('0x8'));var querystring=require(_0xbeb3('0xe'));var Papa=require(_0xbeb3('0xf'));var Redis=require(_0xbeb3('0x10'));var authService=require(_0xbeb3('0x11'));var qs=require(_0xbeb3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbeb3('0x13'));var logger=require(_0xbeb3('0x14'))('api');var utils=require(_0xbeb3('0x15'));var config=require(_0xbeb3('0x16'));var licenseUtil=require(_0xbeb3('0x17'));var db=require(_0xbeb3('0x18'))['db'];function respondWithStatusCode(_0x19868e,_0x313296){_0x313296=_0x313296||0xcc;return function(_0x5b9ace){if(_0x5b9ace){return _0x19868e['sendStatus'](_0x313296);}return _0x19868e[_0xbeb3('0x19')](_0x313296)[_0xbeb3('0x1a')]();};}function respondWithResult(_0x5f521b,_0x4dfb28){_0x4dfb28=_0x4dfb28||0xc8;return function(_0xed9879){if(_0xed9879){return _0x5f521b[_0xbeb3('0x19')](_0x4dfb28)[_0xbeb3('0x1b')](_0xed9879);}};}function respondWithFilteredResult(_0x43d58a,_0x26daf2){return function(_0x535836){if(_0x535836){var _0x1aeaee=_0x535836['count'],_0x5970a1=_0x26daf2['offset'],_0x80ef55=_0x26daf2[_0xbeb3('0x1c')]+_0x26daf2[_0xbeb3('0x1d')],_0x4e7d99;if(_0x80ef55>=_0x1aeaee){_0x80ef55=_0x1aeaee;_0x4e7d99=0xc8;}else{_0x4e7d99=0xce;}_0x43d58a[_0xbeb3('0x19')](_0x4e7d99);return _0x43d58a[_0xbeb3('0x1e')]('Content-Range',_0x5970a1+'-'+_0x80ef55+'/'+_0x1aeaee)[_0xbeb3('0x1b')](_0x535836);}return null;};}function patchUpdates(_0x821d92){return function(_0xe2cc47){try{jsonpatch['apply'](_0xe2cc47,_0x821d92,!![]);}catch(_0x4af96f){return BPromise[_0xbeb3('0x1f')](_0x4af96f);}return _0xe2cc47['save']();};}function saveUpdates(_0x1d917b,_0x50b005){return function(_0x5ea6f7){if(_0x5ea6f7){return _0x5ea6f7[_0xbeb3('0x20')](_0x1d917b)[_0xbeb3('0x21')](function(_0x2f3088){return _0x2f3088;});}return null;};}function removeEntity(_0x4bd89e,_0x301899){return function(_0x18ea0f){if(_0x18ea0f){return _0x18ea0f['destroy']()[_0xbeb3('0x21')](function(){_0x4bd89e[_0xbeb3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc384a,_0x278fe4){return function(_0x16b079){if(!_0x16b079){_0xfc384a[_0xbeb3('0x22')](0x194);}return _0x16b079;};}function handleError(_0x2bc188,_0xee71d7){_0xee71d7=_0xee71d7||0x1f4;return function(_0x84921a){logger[_0xbeb3('0x23')](_0x84921a[_0xbeb3('0x24')]);if(_0x84921a['name']){delete _0x84921a['name'];}_0x2bc188[_0xbeb3('0x19')](_0xee71d7)['send'](_0x84921a);};}exports[_0xbeb3('0x25')]=function(_0xda808c,_0x138adf){var _0x400f65={},_0x4fa3c7={},_0x2fe7ec={'count':0x0,'rows':[]};var _0x5bc3e1=_[_0xbeb3('0x26')](db[_0xbeb3('0x27')]['rawAttributes'],function(_0x483198){return{'name':_0x483198[_0xbeb3('0x28')],'type':_0x483198['type']['key']};});_0x4fa3c7['model']=_['map'](_0x5bc3e1,_0xbeb3('0x29'));_0x4fa3c7['query']=_[_0xbeb3('0x2a')](_0xda808c[_0xbeb3('0x2b')]);_0x4fa3c7[_0xbeb3('0x2c')]=_[_0xbeb3('0x2d')](_0x4fa3c7[_0xbeb3('0x2e')],_0x4fa3c7[_0xbeb3('0x2b')]);_0x400f65[_0xbeb3('0x2f')]=_[_0xbeb3('0x2d')](_0x4fa3c7[_0xbeb3('0x2e')],qs[_0xbeb3('0x30')](_0xda808c['query'][_0xbeb3('0x30')]));_0x400f65[_0xbeb3('0x2f')]=_0x400f65['attributes'][_0xbeb3('0x31')]?_0x400f65[_0xbeb3('0x2f')]:_0x4fa3c7[_0xbeb3('0x2e')];if(!_0xda808c[_0xbeb3('0x2b')]['hasOwnProperty'](_0xbeb3('0x32'))){_0x400f65[_0xbeb3('0x1d')]=qs[_0xbeb3('0x1d')](_0xda808c[_0xbeb3('0x2b')][_0xbeb3('0x1d')]);_0x400f65[_0xbeb3('0x1c')]=qs[_0xbeb3('0x1c')](_0xda808c[_0xbeb3('0x2b')][_0xbeb3('0x1c')]);}_0x400f65['order']=qs[_0xbeb3('0x33')](_0xda808c['query'][_0xbeb3('0x33')]);_0x400f65[_0xbeb3('0x34')]=qs[_0xbeb3('0x2c')](_[_0xbeb3('0x35')](_0xda808c[_0xbeb3('0x2b')],_0x4fa3c7[_0xbeb3('0x2c')]),_0x5bc3e1);if(_0xda808c[_0xbeb3('0x2b')][_0xbeb3('0x36')]){_0x400f65['where']=_[_0xbeb3('0x37')](_0x400f65['where'],{'$or':_['map'](_0x5bc3e1,function(_0x547275){if(_0x547275[_0xbeb3('0x38')]!==_0xbeb3('0x39')){var _0x397b68={};_0x397b68[_0x547275[_0xbeb3('0x29')]]={'$like':'%'+_0xda808c[_0xbeb3('0x2b')][_0xbeb3('0x36')]+'%'};return _0x397b68;}})});}_0x400f65=_['merge']({},_0x400f65,_0xda808c[_0xbeb3('0x3a')]);var _0x40de8d={'where':_0x400f65[_0xbeb3('0x34')]};return db['ZendeskField']['count'](_0x40de8d)['then'](function(_0x46f570){_0x2fe7ec[_0xbeb3('0x3b')]=_0x46f570;if(_0xda808c[_0xbeb3('0x2b')]['includeAll']){_0x400f65[_0xbeb3('0x3c')]=[{'all':!![]}];}return db['ZendeskField'][_0xbeb3('0x3d')](_0x400f65);})[_0xbeb3('0x21')](function(_0x12156b){_0x2fe7ec[_0xbeb3('0x3e')]=_0x12156b;return _0x2fe7ec;})['then'](respondWithFilteredResult(_0x138adf,_0x400f65))['catch'](handleError(_0x138adf,null));};exports[_0xbeb3('0x3f')]=function(_0x3684f1,_0x3d4262){var _0x2443a0={'raw':!![],'where':{'id':_0x3684f1[_0xbeb3('0x40')]['id']}},_0x1add7c={};_0x1add7c[_0xbeb3('0x2e')]=_[_0xbeb3('0x2a')](db['ZendeskField'][_0xbeb3('0x41')]);_0x1add7c[_0xbeb3('0x2b')]=_[_0xbeb3('0x2a')](_0x3684f1[_0xbeb3('0x2b')]);_0x1add7c[_0xbeb3('0x2c')]=_[_0xbeb3('0x2d')](_0x1add7c[_0xbeb3('0x2e')],_0x1add7c['query']);_0x2443a0[_0xbeb3('0x2f')]=_[_0xbeb3('0x2d')](_0x1add7c[_0xbeb3('0x2e')],qs[_0xbeb3('0x30')](_0x3684f1[_0xbeb3('0x2b')][_0xbeb3('0x30')]));_0x2443a0[_0xbeb3('0x2f')]=_0x2443a0[_0xbeb3('0x2f')][_0xbeb3('0x31')]?_0x2443a0[_0xbeb3('0x2f')]:_0x1add7c[_0xbeb3('0x2e')];if(_0x3684f1[_0xbeb3('0x2b')][_0xbeb3('0x42')]){_0x2443a0['include']=[{'all':!![]}];}_0x2443a0=_[_0xbeb3('0x37')]({},_0x2443a0,_0x3684f1[_0xbeb3('0x3a')]);return db[_0xbeb3('0x27')]['find'](_0x2443a0)['then'](handleEntityNotFound(_0x3d4262,null))[_0xbeb3('0x21')](respondWithResult(_0x3d4262,null))[_0xbeb3('0x43')](handleError(_0x3d4262,null));};exports[_0xbeb3('0x44')]=function(_0xf0fcd6,_0x5294ac){return db[_0xbeb3('0x27')]['create'](_0xf0fcd6['body'],{})[_0xbeb3('0x21')](respondWithResult(_0x5294ac,0xc9))[_0xbeb3('0x43')](handleError(_0x5294ac,null));};exports[_0xbeb3('0x20')]=function(_0x8eaebd,_0x4c55f4){if(_0x8eaebd[_0xbeb3('0x45')]['id']){delete _0x8eaebd[_0xbeb3('0x45')]['id'];}return db[_0xbeb3('0x27')]['find']({'where':{'id':_0x8eaebd[_0xbeb3('0x40')]['id']}})['then'](handleEntityNotFound(_0x4c55f4,null))['then'](saveUpdates(_0x8eaebd[_0xbeb3('0x45')],null))[_0xbeb3('0x21')](respondWithResult(_0x4c55f4,null))[_0xbeb3('0x43')](handleError(_0x4c55f4,null));};exports['destroy']=function(_0x23d63c,_0x312b28){return db[_0xbeb3('0x27')]['find']({'where':{'id':_0x23d63c[_0xbeb3('0x40')]['id']}})['then'](handleEntityNotFound(_0x312b28,null))[_0xbeb3('0x21')](removeEntity(_0x312b28,null))['catch'](handleError(_0x312b28,null));}; \ No newline at end of file +var _0x3e24=['bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','show','keys','length','find','catch','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e24,0x167));var _0x43e2=function(_0xa91bb6,_0x436b4c){_0xa91bb6=_0xa91bb6-0x0;var _0x5e3e02=_0x3e24[_0xa91bb6];return _0x5e3e02;};'use strict';var pdf=require(_0x43e2('0x0'));var emlformat=require(_0x43e2('0x1'));var rimraf=require(_0x43e2('0x2'));var zipdir=require(_0x43e2('0x3'));var jsonpatch=require(_0x43e2('0x4'));var rp=require('request-promise');var moment=require(_0x43e2('0x5'));var BPromise=require(_0x43e2('0x6'));var Mustache=require('mustache');var util=require(_0x43e2('0x7'));var path=require(_0x43e2('0x8'));var sox=require(_0x43e2('0x9'));var csv=require(_0x43e2('0xa'));var ejs=require(_0x43e2('0xb'));var fs=require('fs');var _=require(_0x43e2('0xc'));var squel=require(_0x43e2('0xd'));var crypto=require('crypto');var jsforce=require(_0x43e2('0xe'));var deskjs=require(_0x43e2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x43e2('0x10'));var Papa=require(_0x43e2('0x11'));var Redis=require('ioredis');var authService=require(_0x43e2('0x12'));var qs=require(_0x43e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43e2('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x43e2('0x15'));var licenseUtil=require(_0x43e2('0x16'));var db=require(_0x43e2('0x17'))['db'];function respondWithStatusCode(_0x44781a,_0x43ba14){_0x43ba14=_0x43ba14||0xcc;return function(_0x68e82d){if(_0x68e82d){return _0x44781a[_0x43e2('0x18')](_0x43ba14);}return _0x44781a[_0x43e2('0x19')](_0x43ba14)[_0x43e2('0x1a')]();};}function respondWithResult(_0x218ae7,_0x377097){_0x377097=_0x377097||0xc8;return function(_0x3ccccd){if(_0x3ccccd){return _0x218ae7['status'](_0x377097)[_0x43e2('0x1b')](_0x3ccccd);}};}function respondWithFilteredResult(_0x40fb7b,_0xb929b5){return function(_0x2a0fb0){if(_0x2a0fb0){var _0x5cea01=_0x2a0fb0[_0x43e2('0x1c')],_0x4a6443=_0xb929b5[_0x43e2('0x1d')],_0x241da2=_0xb929b5[_0x43e2('0x1d')]+_0xb929b5[_0x43e2('0x1e')],_0x417ce5;if(_0x241da2>=_0x5cea01){_0x241da2=_0x5cea01;_0x417ce5=0xc8;}else{_0x417ce5=0xce;}_0x40fb7b[_0x43e2('0x19')](_0x417ce5);return _0x40fb7b[_0x43e2('0x1f')](_0x43e2('0x20'),_0x4a6443+'-'+_0x241da2+'/'+_0x5cea01)[_0x43e2('0x1b')](_0x2a0fb0);}return null;};}function patchUpdates(_0x4879e9){return function(_0x3ee34c){try{jsonpatch[_0x43e2('0x21')](_0x3ee34c,_0x4879e9,!![]);}catch(_0x4de509){return BPromise[_0x43e2('0x22')](_0x4de509);}return _0x3ee34c['save']();};}function saveUpdates(_0x3bc2ce,_0x13610f){return function(_0x1fac53){if(_0x1fac53){return _0x1fac53[_0x43e2('0x23')](_0x3bc2ce)[_0x43e2('0x24')](function(_0x5ae97b){return _0x5ae97b;});}return null;};}function removeEntity(_0x3b0357,_0x12d842){return function(_0x272934){if(_0x272934){return _0x272934['destroy']()[_0x43e2('0x24')](function(){_0x3b0357[_0x43e2('0x19')](0xcc)[_0x43e2('0x1a')]();});}};}function handleEntityNotFound(_0x11b285,_0x4f20e6){return function(_0x3b5b97){if(!_0x3b5b97){_0x11b285[_0x43e2('0x18')](0x194);}return _0x3b5b97;};}function handleError(_0x215cb7,_0x3b7b22){_0x3b7b22=_0x3b7b22||0x1f4;return function(_0x178223){logger[_0x43e2('0x25')](_0x178223[_0x43e2('0x26')]);if(_0x178223[_0x43e2('0x27')]){delete _0x178223[_0x43e2('0x27')];}_0x215cb7[_0x43e2('0x19')](_0x3b7b22)[_0x43e2('0x28')](_0x178223);};}exports[_0x43e2('0x29')]=function(_0x52ed49,_0x430a0e){var _0x2f2bd8={},_0x545246={},_0x163063={'count':0x0,'rows':[]};var _0x1883c6=_[_0x43e2('0x2a')](db[_0x43e2('0x2b')][_0x43e2('0x2c')],function(_0x5a896b){return{'name':_0x5a896b[_0x43e2('0x2d')],'type':_0x5a896b[_0x43e2('0x2e')][_0x43e2('0x2f')]};});_0x545246[_0x43e2('0x30')]=_[_0x43e2('0x2a')](_0x1883c6,_0x43e2('0x27'));_0x545246['query']=_['keys'](_0x52ed49[_0x43e2('0x31')]);_0x545246[_0x43e2('0x32')]=_[_0x43e2('0x33')](_0x545246[_0x43e2('0x30')],_0x545246[_0x43e2('0x31')]);_0x2f2bd8['attributes']=_[_0x43e2('0x33')](_0x545246[_0x43e2('0x30')],qs[_0x43e2('0x34')](_0x52ed49[_0x43e2('0x31')][_0x43e2('0x34')]));_0x2f2bd8[_0x43e2('0x35')]=_0x2f2bd8[_0x43e2('0x35')]['length']?_0x2f2bd8['attributes']:_0x545246[_0x43e2('0x30')];if(!_0x52ed49[_0x43e2('0x31')]['hasOwnProperty'](_0x43e2('0x36'))){_0x2f2bd8[_0x43e2('0x1e')]=qs['limit'](_0x52ed49[_0x43e2('0x31')]['limit']);_0x2f2bd8['offset']=qs['offset'](_0x52ed49[_0x43e2('0x31')]['offset']);}_0x2f2bd8[_0x43e2('0x37')]=qs[_0x43e2('0x38')](_0x52ed49[_0x43e2('0x31')][_0x43e2('0x38')]);_0x2f2bd8[_0x43e2('0x39')]=qs[_0x43e2('0x32')](_[_0x43e2('0x3a')](_0x52ed49[_0x43e2('0x31')],_0x545246[_0x43e2('0x32')]),_0x1883c6);if(_0x52ed49[_0x43e2('0x31')][_0x43e2('0x3b')]){_0x2f2bd8[_0x43e2('0x39')]=_[_0x43e2('0x3c')](_0x2f2bd8[_0x43e2('0x39')],{'$or':_[_0x43e2('0x2a')](_0x1883c6,function(_0x40b39b){if(_0x40b39b[_0x43e2('0x2e')]!=='VIRTUAL'){var _0x4da45f={};_0x4da45f[_0x40b39b['name']]={'$like':'%'+_0x52ed49[_0x43e2('0x31')][_0x43e2('0x3b')]+'%'};return _0x4da45f;}})});}_0x2f2bd8=_['merge']({},_0x2f2bd8,_0x52ed49['options']);var _0x2b5fce={'where':_0x2f2bd8[_0x43e2('0x39')]};return db[_0x43e2('0x2b')][_0x43e2('0x1c')](_0x2b5fce)[_0x43e2('0x24')](function(_0xd316f9){_0x163063[_0x43e2('0x1c')]=_0xd316f9;if(_0x52ed49[_0x43e2('0x31')][_0x43e2('0x3d')]){_0x2f2bd8[_0x43e2('0x3e')]=[{'all':!![]}];}return db[_0x43e2('0x2b')][_0x43e2('0x3f')](_0x2f2bd8);})[_0x43e2('0x24')](function(_0x280074){_0x163063['rows']=_0x280074;return _0x163063;})[_0x43e2('0x24')](respondWithFilteredResult(_0x430a0e,_0x2f2bd8))['catch'](handleError(_0x430a0e,null));};exports[_0x43e2('0x40')]=function(_0x5e8c0b,_0x19ce1b){var _0x2ce990={'raw':!![],'where':{'id':_0x5e8c0b['params']['id']}},_0x273323={};_0x273323[_0x43e2('0x30')]=_['keys'](db[_0x43e2('0x2b')][_0x43e2('0x2c')]);_0x273323[_0x43e2('0x31')]=_[_0x43e2('0x41')](_0x5e8c0b['query']);_0x273323['filters']=_[_0x43e2('0x33')](_0x273323[_0x43e2('0x30')],_0x273323[_0x43e2('0x31')]);_0x2ce990[_0x43e2('0x35')]=_['intersection'](_0x273323[_0x43e2('0x30')],qs[_0x43e2('0x34')](_0x5e8c0b[_0x43e2('0x31')][_0x43e2('0x34')]));_0x2ce990[_0x43e2('0x35')]=_0x2ce990['attributes'][_0x43e2('0x42')]?_0x2ce990['attributes']:_0x273323[_0x43e2('0x30')];if(_0x5e8c0b[_0x43e2('0x31')]['includeAll']){_0x2ce990[_0x43e2('0x3e')]=[{'all':!![]}];}_0x2ce990=_['merge']({},_0x2ce990,_0x5e8c0b['options']);return db[_0x43e2('0x2b')][_0x43e2('0x43')](_0x2ce990)[_0x43e2('0x24')](handleEntityNotFound(_0x19ce1b,null))[_0x43e2('0x24')](respondWithResult(_0x19ce1b,null))[_0x43e2('0x44')](handleError(_0x19ce1b,null));};exports['create']=function(_0x1b001d,_0x17aaa8){return db[_0x43e2('0x2b')][_0x43e2('0x45')](_0x1b001d[_0x43e2('0x46')],{})[_0x43e2('0x24')](respondWithResult(_0x17aaa8,0xc9))[_0x43e2('0x44')](handleError(_0x17aaa8,null));};exports[_0x43e2('0x23')]=function(_0x5247c4,_0x1c6a0d){if(_0x5247c4[_0x43e2('0x46')]['id']){delete _0x5247c4['body']['id'];}return db[_0x43e2('0x2b')][_0x43e2('0x43')]({'where':{'id':_0x5247c4[_0x43e2('0x47')]['id']}})[_0x43e2('0x24')](handleEntityNotFound(_0x1c6a0d,null))['then'](saveUpdates(_0x5247c4[_0x43e2('0x46')],null))[_0x43e2('0x24')](respondWithResult(_0x1c6a0d,null))[_0x43e2('0x44')](handleError(_0x1c6a0d,null));};exports[_0x43e2('0x48')]=function(_0x42f27d,_0x4bb80f){return db['ZendeskField'][_0x43e2('0x43')]({'where':{'id':_0x42f27d[_0x43e2('0x47')]['id']}})['then'](handleEntityNotFound(_0x4bb80f,null))[_0x43e2('0x24')](removeEntity(_0x4bb80f,null))[_0x43e2('0x44')](handleError(_0x4bb80f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 44db48d..3e7171a 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 _0xfb71=['define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x290a7d,_0x20b9b1){var _0x2f573c=function(_0x5beae2){while(--_0x5beae2){_0x290a7d['push'](_0x290a7d['shift']());}};_0x2f573c(++_0x20b9b1);}(_0xfb71,0x1ef));var _0x1fb7=function(_0x42c11f,_0x100303){_0x42c11f=_0x42c11f-0x0;var _0x4b574f=_0xfb71[_0x42c11f];return _0x4b574f;};'use strict';var _=require(_0x1fb7('0x0'));var util=require(_0x1fb7('0x1'));var logger=require(_0x1fb7('0x2'))(_0x1fb7('0x3'));var moment=require(_0x1fb7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb7('0x5'));var rimraf=require(_0x1fb7('0x6'));var config=require(_0x1fb7('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x1fb7('0x8')]=function(_0x29532a,_0x2babe0){return _0x29532a[_0x1fb7('0x9')](_0x1fb7('0xa'),attributes,{'tableName':_0x1fb7('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x1fb7('0xc'),_0x1fb7('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c2c=['int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','bluebird','path','rimraf','exports','define','ZendeskField'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc9c2('0x0'));var util=require(_0xc9c2('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc9c2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9c2('0x3'));var rimraf=require(_0xc9c2('0x4'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0xc9c2('0x5')]=function(_0x5140a8,_0x30f3d6){return _0x5140a8[_0xc9c2('0x6')](_0xc9c2('0x7'),attributes,{'tableName':_0xc9c2('0x8'),'paranoid':![],'indexes':[{'name':_0xc9c2('0x9'),'fields':[_0xc9c2('0xa'),_0xc9c2('0xb')],'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 668f19a..5e31aaf 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 _0xb279=['jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb279,0x19a));var _0x9b27=function(_0x53a7d6,_0x502301){_0x53a7d6=_0x53a7d6-0x0;var _0x522645=_0xb279[_0x53a7d6];return _0x522645;};'use strict';var _=require(_0x9b27('0x0'));var util=require('util');var moment=require(_0x9b27('0x1'));var BPromise=require(_0x9b27('0x2'));var rs=require(_0x9b27('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b27('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b27('0x5'))(_0x9b27('0x6'));var config=require(_0x9b27('0x7'));var jayson=require(_0x9b27('0x8'));var client=jayson[_0x9b27('0x9')][_0x9b27('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x190683,_0x5efbd2,_0xa78916){return new BPromise(function(_0x4bff11,_0x5a4884){return client['request'](_0x190683,_0xa78916)[_0x9b27('0xb')](function(_0x571bea){logger[_0x9b27('0xc')](_0x9b27('0xd'),_0x5efbd2,_0x9b27('0xe'));logger[_0x9b27('0xf')](_0x9b27('0x10'),_0x5efbd2,'request\x20sent',JSON[_0x9b27('0x11')](_0x571bea));if(_0x571bea[_0x9b27('0x12')]){if(_0x571bea[_0x9b27('0x12')]['code']===0x1f4){logger['error'](_0x9b27('0xd'),_0x5efbd2,_0x571bea[_0x9b27('0x12')][_0x9b27('0x13')]);return _0x5a4884(_0x571bea[_0x9b27('0x12')][_0x9b27('0x13')]);}logger[_0x9b27('0x12')](_0x9b27('0xd'),_0x5efbd2,_0x571bea[_0x9b27('0x12')][_0x9b27('0x13')]);return _0x4bff11(_0x571bea[_0x9b27('0x12')]['message']);}else{logger[_0x9b27('0xc')](_0x9b27('0xd'),_0x5efbd2,_0x9b27('0xe'));_0x4bff11(_0x571bea[_0x9b27('0x14')][_0x9b27('0x13')]);}})[_0x9b27('0x15')](function(_0x4c4bcc){logger[_0x9b27('0x12')](_0x9b27('0xd'),_0x5efbd2,_0x4c4bcc);_0x5a4884(_0x4c4bcc);});});} \ No newline at end of file +var _0x574c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','code','error','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x43186d,_0x4b40ec){var _0x5f562c=function(_0x18ed7e){while(--_0x18ed7e){_0x43186d['push'](_0x43186d['shift']());}};_0x5f562c(++_0x4b40ec);}(_0x574c,0xc9));var _0xc574=function(_0x39c2a3,_0x2b6d5e){_0x39c2a3=_0x39c2a3-0x0;var _0x2c08dc=_0x574c[_0x39c2a3];return _0x2c08dc;};'use strict';var _=require(_0xc574('0x0'));var util=require('util');var moment=require(_0xc574('0x1'));var BPromise=require(_0xc574('0x2'));var rs=require(_0xc574('0x3'));var fs=require('fs');var Redis=require(_0xc574('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc574('0x5'));var logger=require(_0xc574('0x6'))(_0xc574('0x7'));var config=require(_0xc574('0x8'));var jayson=require(_0xc574('0x9'));var client=jayson[_0xc574('0xa')][_0xc574('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x894dfd,_0x53cd1d,_0x1dc0f3){return new BPromise(function(_0x4dc155,_0x2d9e9c){return client[_0xc574('0xc')](_0x894dfd,_0x1dc0f3)[_0xc574('0xd')](function(_0x57ea88){logger['info'](_0xc574('0xe'),_0x53cd1d,_0xc574('0xf'));logger[_0xc574('0x10')](_0xc574('0x11'),_0x53cd1d,'request\x20sent',JSON['stringify'](_0x57ea88));if(_0x57ea88['error']){if(_0x57ea88['error'][_0xc574('0x12')]===0x1f4){logger[_0xc574('0x13')](_0xc574('0xe'),_0x53cd1d,_0x57ea88[_0xc574('0x13')]['message']);return _0x2d9e9c(_0x57ea88[_0xc574('0x13')][_0xc574('0x14')]);}logger[_0xc574('0x13')](_0xc574('0xe'),_0x53cd1d,_0x57ea88['error'][_0xc574('0x14')]);return _0x4dc155(_0x57ea88[_0xc574('0x13')][_0xc574('0x14')]);}else{logger[_0xc574('0x15')]('ZendeskField,\x20%s,\x20%s',_0x53cd1d,'request\x20sent');_0x4dc155(_0x57ea88[_0xc574('0x16')]['message']);}})['catch'](function(_0xc66210){logger[_0xc574('0x13')](_0xc574('0xe'),_0x53cd1d,_0xc66210);_0x2d9e9c(_0xc66210);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index c7b6501..14b315f 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(_0x4d8274,_0x37b9c7){var _0x32d9fb=function(_0x3f5b24){while(--_0x3f5b24){_0x4d8274['push'](_0x4d8274['shift']());}};_0x32d9fb(++_0x37b9c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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(_0x26915b,_0x3735c7){var _0x44200c=function(_0xa76794){while(--_0xa76794){_0x26915b['push'](_0x26915b['shift']());}};_0x44200c(++_0x3735c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 c4703a2..1a8ac41 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 _0xfdf4=['STRING','sequelize','exports'];(function(_0x49e4a3,_0x23f937){var _0x13dd22=function(_0x580c32){while(--_0x580c32){_0x49e4a3['push'](_0x49e4a3['shift']());}};_0x13dd22(++_0x23f937);}(_0xfdf4,0x1c6));var _0x4fdf=function(_0x47e470,_0x161293){_0x47e470=_0x47e470-0x0;var _0x2f9d8d=_0xfdf4[_0x47e470];return _0x2f9d8d;};'use strict';var Sequelize=require(_0x4fdf('0x0'));module[_0x4fdf('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4fdf('0x2')]},'host':{'type':Sequelize[_0x4fdf('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x4fdf('0x2')]},'clientSecret':{'type':Sequelize[_0x4fdf('0x2')]},'serverUrl':{'type':Sequelize[_0x4fdf('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x4fdf('0x2')]}}; \ No newline at end of file +var _0x5333=['STRING','exports'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x5333,0x1ef));var _0x3533=function(_0x5929fa,_0x23039f){_0x5929fa=_0x5929fa-0x0;var _0x1cd289=_0x5333[_0x5929fa];return _0x1cd289;};'use strict';var Sequelize=require('sequelize');module[_0x3533('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3533('0x1')]},'host':{'type':Sequelize[_0x3533('0x1')]},'zone':{'type':Sequelize[_0x3533('0x1')]},'clientId':{'type':Sequelize[_0x3533('0x1')]},'clientSecret':{'type':Sequelize[_0x3533('0x1')]},'serverUrl':{'type':Sequelize[_0x3533('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x3533('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a724a68..d101996 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 _0x7880=['ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','status','end','name','index','map','rawAttributes','type','key','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','ZohoAccount','includeAll','include','findAll','rows','params','keys','find','create','body','getConfigurations','findOne','ZohoConfiguration','length','AccountId','Subjects','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','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','substring','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x7880,0x1f4));var _0x0788=function(_0x54d5c8,_0x344ce5){_0x54d5c8=_0x54d5c8-0x0;var _0x525e2e=_0x7880[_0x54d5c8];return _0x525e2e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0788('0x0'));var rimraf=require(_0x0788('0x1'));var zipdir=require(_0x0788('0x2'));var jsonpatch=require(_0x0788('0x3'));var rp=require(_0x0788('0x4'));var moment=require(_0x0788('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0788('0x6'));var util=require(_0x0788('0x7'));var path=require(_0x0788('0x8'));var sox=require(_0x0788('0x9'));var csv=require(_0x0788('0xa'));var ejs=require(_0x0788('0xb'));var fs=require('fs');var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0xa'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];var integrations=require(_0x0788('0x1a'));var jayson=require(_0x0788('0x1b'));var client=jayson[_0x0788('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcaa0e9,_0x7e3407,_0x3bdcdf,_0x13cf07){return new BPromise(function(_0x51e5d3,_0x43ca01){var _0x4ed024=_0x13cf07||client;return _0x4ed024[_0x0788('0x1d')](_0xcaa0e9,_0x3bdcdf)[_0x0788('0x1e')](function(_0x3fd1e4){logger[_0x0788('0x1f')](_0x0788('0x20'),_0x7e3407,_0x0788('0x21'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x7e3407,_0x0788('0x21'),JSON[_0x0788('0x22')](_0x3fd1e4));if(_0x3fd1e4['error']){if(_0x3fd1e4[_0x0788('0x23')][_0x0788('0x24')]===0x1f4){logger[_0x0788('0x23')]('ZohoAccount,\x20%s,\x20%s',_0x7e3407,_0x3fd1e4[_0x0788('0x23')][_0x0788('0x25')]);return _0x43ca01(_0x3fd1e4['error'][_0x0788('0x25')]);}logger['error'](_0x0788('0x20'),_0x7e3407,_0x3fd1e4['error'][_0x0788('0x25')]);return _0x51e5d3(_0x3fd1e4[_0x0788('0x23')][_0x0788('0x25')]);}else{logger[_0x0788('0x1f')](_0x0788('0x20'),_0x7e3407,'request\x20sent');_0x51e5d3(_0x3fd1e4['result'][_0x0788('0x25')]);}})[_0x0788('0x26')](function(_0x645320){logger[_0x0788('0x23')]('ZohoAccount,\x20%s,\x20%s',_0x7e3407,_0x645320);_0x43ca01(_0x645320);});});}function respondWithStatusCode(_0x4d5c93,_0x79204e){_0x79204e=_0x79204e||0xcc;return function(_0x18cc33){if(_0x18cc33){return _0x4d5c93[_0x0788('0x27')](_0x79204e);}return _0x4d5c93['status'](_0x79204e)['end']();};}function respondWithResult(_0x240459,_0xa1f7dc){_0xa1f7dc=_0xa1f7dc||0xc8;return function(_0x5f2dda){if(_0x5f2dda){return _0x240459['status'](_0xa1f7dc)[_0x0788('0x28')](_0x5f2dda);}};}function respondWithFilteredResult(_0x44798c,_0x57fda1){return function(_0x286730){if(_0x286730){var _0x40e7a6=_0x286730[_0x0788('0x29')],_0x467d52=_0x57fda1[_0x0788('0x2a')],_0x18fc0e=_0x57fda1[_0x0788('0x2a')]+_0x57fda1['limit'],_0xf9ba32;if(_0x18fc0e>=_0x40e7a6){_0x18fc0e=_0x40e7a6;_0xf9ba32=0xc8;}else{_0xf9ba32=0xce;}_0x44798c['status'](_0xf9ba32);return _0x44798c[_0x0788('0x2b')](_0x0788('0x2c'),_0x467d52+'-'+_0x18fc0e+'/'+_0x40e7a6)['json'](_0x286730);}return null;};}function patchUpdates(_0x4aa48b){return function(_0x2e2ca8){try{jsonpatch[_0x0788('0x2d')](_0x2e2ca8,_0x4aa48b,!![]);}catch(_0x20fcd8){return BPromise[_0x0788('0x2e')](_0x20fcd8);}return _0x2e2ca8[_0x0788('0x2f')]();};}function saveUpdates(_0x44bff2,_0x327d67){return function(_0x36e077){if(_0x36e077){return _0x36e077[_0x0788('0x30')](_0x44bff2)[_0x0788('0x1e')](function(_0x5ec0ed){return _0x5ec0ed;});}return null;};}function removeEntity(_0x2a08b7,_0x1aab6a){return function(_0x2db509){if(_0x2db509){return _0x2db509[_0x0788('0x31')]()[_0x0788('0x1e')](function(){_0x2a08b7[_0x0788('0x32')](0xcc)[_0x0788('0x33')]();});}};}function handleEntityNotFound(_0x15d67a,_0x1cb6c0){return function(_0xaed27e){if(!_0xaed27e){_0x15d67a['sendStatus'](0x194);}return _0xaed27e;};}function handleError(_0x4ae132,_0x5947d3){_0x5947d3=_0x5947d3||0x1f4;return function(_0x5633da){logger['error'](_0x5633da['stack']);if(_0x5633da[_0x0788('0x34')]){delete _0x5633da[_0x0788('0x34')];}_0x4ae132[_0x0788('0x32')](_0x5947d3)['send'](_0x5633da);};}exports[_0x0788('0x35')]=function(_0x3369a1,_0x112476){var _0xaea11d={},_0x57c4d8={},_0x2ed940={'count':0x0,'rows':[]};var _0x4a4a2b=_[_0x0788('0x36')](db['ZohoAccount'][_0x0788('0x37')],function(_0x1beb1f){return{'name':_0x1beb1f['fieldName'],'type':_0x1beb1f[_0x0788('0x38')][_0x0788('0x39')]};});_0x57c4d8['model']=_[_0x0788('0x36')](_0x4a4a2b,'name');_0x57c4d8[_0x0788('0x3a')]=_['keys'](_0x3369a1[_0x0788('0x3a')]);_0x57c4d8['filters']=_[_0x0788('0x3b')](_0x57c4d8['model'],_0x57c4d8['query']);_0xaea11d[_0x0788('0x3c')]=_[_0x0788('0x3b')](_0x57c4d8[_0x0788('0x3d')],qs[_0x0788('0x3e')](_0x3369a1[_0x0788('0x3a')]['fields']));_0xaea11d['attributes']=_0xaea11d['attributes']['length']?_0xaea11d[_0x0788('0x3c')]:_0x57c4d8[_0x0788('0x3d')];if(!_0x3369a1[_0x0788('0x3a')][_0x0788('0x3f')](_0x0788('0x40'))){_0xaea11d['limit']=qs['limit'](_0x3369a1[_0x0788('0x3a')][_0x0788('0x41')]);_0xaea11d[_0x0788('0x2a')]=qs[_0x0788('0x2a')](_0x3369a1[_0x0788('0x3a')][_0x0788('0x2a')]);}_0xaea11d[_0x0788('0x42')]=qs[_0x0788('0x43')](_0x3369a1[_0x0788('0x3a')]['sort']);_0xaea11d['where']=qs[_0x0788('0x44')](_[_0x0788('0x45')](_0x3369a1[_0x0788('0x3a')],_0x57c4d8['filters']),_0x4a4a2b);if(_0x3369a1['query']['filter']){_0xaea11d[_0x0788('0x46')]=_[_0x0788('0x47')](_0xaea11d[_0x0788('0x46')],{'$or':_[_0x0788('0x36')](_0x4a4a2b,function(_0x2737d8){if(_0x2737d8[_0x0788('0x38')]!==_0x0788('0x48')){var _0x15b90c={};_0x15b90c[_0x2737d8['name']]={'$like':'%'+_0x3369a1[_0x0788('0x3a')][_0x0788('0x49')]+'%'};return _0x15b90c;}})});}_0xaea11d=_[_0x0788('0x47')]({},_0xaea11d,_0x3369a1[_0x0788('0x4a')]);var _0x58eb04={'where':_0xaea11d[_0x0788('0x46')]};return db[_0x0788('0x4b')]['count'](_0x58eb04)['then'](function(_0x524b43){_0x2ed940[_0x0788('0x29')]=_0x524b43;if(_0x3369a1['query'][_0x0788('0x4c')]){_0xaea11d[_0x0788('0x4d')]=[{'all':!![]}];}return db[_0x0788('0x4b')][_0x0788('0x4e')](_0xaea11d);})[_0x0788('0x1e')](function(_0x359dd6){_0x2ed940[_0x0788('0x4f')]=_0x359dd6;return _0x2ed940;})[_0x0788('0x1e')](respondWithFilteredResult(_0x112476,_0xaea11d))['catch'](handleError(_0x112476,null));};exports['show']=function(_0x39c3cc,_0xe7dfdc){var _0x2f232c={'raw':![],'where':{'id':_0x39c3cc[_0x0788('0x50')]['id']}},_0x5af6dd={};_0x5af6dd[_0x0788('0x3d')]=_[_0x0788('0x51')](db[_0x0788('0x4b')][_0x0788('0x37')]);_0x5af6dd['query']=_['keys'](_0x39c3cc[_0x0788('0x3a')]);_0x5af6dd[_0x0788('0x44')]=_['intersection'](_0x5af6dd[_0x0788('0x3d')],_0x5af6dd['query']);_0x2f232c[_0x0788('0x3c')]=_[_0x0788('0x3b')](_0x5af6dd[_0x0788('0x3d')],qs[_0x0788('0x3e')](_0x39c3cc[_0x0788('0x3a')][_0x0788('0x3e')]));_0x2f232c[_0x0788('0x3c')]=_0x2f232c[_0x0788('0x3c')]['length']?_0x2f232c[_0x0788('0x3c')]:_0x5af6dd[_0x0788('0x3d')];if(_0x39c3cc[_0x0788('0x3a')]['includeAll']){_0x2f232c[_0x0788('0x4d')]=[{'all':!![]}];}_0x2f232c=_[_0x0788('0x47')]({},_0x2f232c,_0x39c3cc['options']);return db[_0x0788('0x4b')][_0x0788('0x52')](_0x2f232c)[_0x0788('0x1e')](handleEntityNotFound(_0xe7dfdc,null))[_0x0788('0x1e')](respondWithResult(_0xe7dfdc,null))[_0x0788('0x26')](handleError(_0xe7dfdc,null));};exports[_0x0788('0x53')]=function(_0x4a465c,_0x4fcd30){return db[_0x0788('0x4b')][_0x0788('0x53')](_0x4a465c['body'],{})[_0x0788('0x1e')](respondWithResult(_0x4fcd30,0xc9))[_0x0788('0x26')](handleError(_0x4fcd30,null));};exports[_0x0788('0x30')]=function(_0x2b8f63,_0xf543a8){if(_0x2b8f63[_0x0788('0x54')]['id']){delete _0x2b8f63[_0x0788('0x54')]['id'];}return db[_0x0788('0x4b')][_0x0788('0x52')]({'where':{'id':_0x2b8f63[_0x0788('0x50')]['id']}})[_0x0788('0x1e')](handleEntityNotFound(_0xf543a8,null))[_0x0788('0x1e')](saveUpdates(_0x2b8f63['body'],null))[_0x0788('0x1e')](respondWithResult(_0xf543a8,null))[_0x0788('0x26')](handleError(_0xf543a8,null));};exports[_0x0788('0x31')]=function(_0x5ba197,_0x9a13b){return db[_0x0788('0x4b')]['find']({'where':{'id':_0x5ba197['params']['id']}})[_0x0788('0x1e')](handleEntityNotFound(_0x9a13b,null))[_0x0788('0x1e')](removeEntity(_0x9a13b,null))[_0x0788('0x26')](handleError(_0x9a13b,null));};exports[_0x0788('0x55')]=function(_0x2c0bcc,_0x4c08f9,_0x535648){var _0x336d30={};var _0x3be076={};var _0x30a0e0;var _0x47be71;return db['ZohoAccount'][_0x0788('0x56')]({'where':{'id':_0x2c0bcc['params']['id']}})[_0x0788('0x1e')](handleEntityNotFound(_0x4c08f9,null))[_0x0788('0x1e')](function(_0x223767){if(_0x223767){_0x30a0e0=_0x223767;_0x3be076[_0x0788('0x3d')]=_[_0x0788('0x51')](db[_0x0788('0x57')][_0x0788('0x37')]);_0x3be076[_0x0788('0x3a')]=_[_0x0788('0x51')](_0x2c0bcc[_0x0788('0x3a')]);_0x3be076['filters']=_[_0x0788('0x3b')](_0x3be076[_0x0788('0x3d')],_0x3be076[_0x0788('0x3a')]);_0x336d30[_0x0788('0x3c')]=_['intersection'](_0x3be076[_0x0788('0x3d')],qs[_0x0788('0x3e')](_0x2c0bcc[_0x0788('0x3a')][_0x0788('0x3e')]));_0x336d30[_0x0788('0x3c')]=_0x336d30['attributes'][_0x0788('0x58')]?_0x336d30['attributes']:_0x3be076[_0x0788('0x3d')];_0x336d30[_0x0788('0x42')]=qs[_0x0788('0x43')](_0x2c0bcc[_0x0788('0x3a')][_0x0788('0x43')]);_0x336d30[_0x0788('0x46')]=qs[_0x0788('0x44')](_[_0x0788('0x45')](_0x2c0bcc[_0x0788('0x3a')],_0x3be076['filters']));if(_0x2c0bcc[_0x0788('0x3a')][_0x0788('0x49')]){_0x336d30[_0x0788('0x46')]=_['merge'](_0x336d30['where'],{'$or':_[_0x0788('0x36')](_0x336d30[_0x0788('0x3c')],function(_0x31ed44){var _0x51baa4={};_0x51baa4[_0x31ed44]={'$like':'%'+_0x2c0bcc[_0x0788('0x3a')][_0x0788('0x49')]+'%'};return _0x51baa4;})});}_0x336d30=_[_0x0788('0x47')]({},_0x336d30,_0x2c0bcc[_0x0788('0x4a')]);return _0x30a0e0['getConfigurations'](_0x336d30);}})['then'](function(_0x4fc29b){if(_0x4fc29b){_0x47be71=_0x4fc29b[_0x0788('0x58')];if(!_0x2c0bcc[_0x0788('0x3a')][_0x0788('0x3f')]('nolimit')){_0x336d30['limit']=qs[_0x0788('0x41')](_0x2c0bcc['query'][_0x0788('0x41')]);_0x336d30[_0x0788('0x2a')]=qs[_0x0788('0x2a')](_0x2c0bcc[_0x0788('0x3a')][_0x0788('0x2a')]);}return _0x30a0e0[_0x0788('0x55')](_0x336d30);}})[_0x0788('0x1e')](function(_0x47543a){if(_0x47543a){return _0x47543a?{'count':_0x47be71,'rows':_0x47543a}:null;}})[_0x0788('0x1e')](respondWithResult(_0x4c08f9,null))[_0x0788('0x26')](handleError(_0x4c08f9,null));};exports['addConfiguration']=function(_0x240210,_0x30248c,_0x52926f){if(_0x240210['body']['id']){delete _0x240210[_0x0788('0x54')]['id'];}return db[_0x0788('0x4b')][_0x0788('0x56')]({'where':{'id':_0x240210[_0x0788('0x50')]['id']}})[_0x0788('0x1e')](handleEntityNotFound(_0x30248c,null))[_0x0788('0x1e')](function(_0x489277){if(_0x489277){_0x240210[_0x0788('0x54')][_0x0788('0x59')]=_0x489277['id'];_0x240210[_0x0788('0x54')][_0x0788('0x5a')]=integrations['getSubjects'](_0x240210[_0x0788('0x54')][_0x0788('0x5b')],_0x240210[_0x0788('0x54')][_0x0788('0x38')]);_0x240210['body']['Descriptions']=integrations[_0x0788('0x5c')](_0x240210[_0x0788('0x54')][_0x0788('0x5b')],_0x240210[_0x0788('0x54')][_0x0788('0x38')]);return db[_0x0788('0x57')][_0x0788('0x53')](_0x240210[_0x0788('0x54')],{'include':[{'model':db[_0x0788('0x5d')],'as':'Subjects'},{'model':db[_0x0788('0x5d')],'as':_0x0788('0x5e')}]});}return null;})[_0x0788('0x1e')](respondWithResult(_0x30248c,null))['catch'](handleError(_0x30248c,null));};function getAccessToken(_0x534a21){return new Promise(function(_0x14fc12,_0x5cd77b){var _0x39f4fe;switch(_0x534a21[_0x0788('0x5f')]){case'US':_0x39f4fe=_0x0788('0x60');break;case'AU':_0x39f4fe=_0x0788('0x61');break;case'EU':_0x39f4fe=_0x0788('0x62');break;case'IN':_0x39f4fe=_0x0788('0x63');break;case'CN':_0x39f4fe=_0x0788('0x64');break;default:_0x39f4fe=_0x0788('0x62');break;}var _0x188eeb={'method':'POST','uri':_0x39f4fe+_0x0788('0x65'),'qs':{'refresh_token':_0x534a21[_0x0788('0x66')],'client_id':_0x534a21[_0x0788('0x67')],'client_secret':_0x534a21['clientSecret'],'grant_type':_0x0788('0x68')},'json':!![]};return rp(_0x188eeb)[_0x0788('0x1e')](function(_0x2f8788){if(_0x2f8788['access_token']){_0x14fc12(_0x2f8788[_0x0788('0x69')]);}else{_0x5cd77b(_0x0788('0x6a'));}})[_0x0788('0x26')](function(_0x33a2fb){_0x5cd77b(_0x33a2fb);});});}exports[_0x0788('0x6b')]=function(_0x1e1963,_0x358754,_0x69e7cc){var _0x25058b,_0x5d8ddb,_0x471b3a,_0x623d29,_0x32b9a8;return db[_0x0788('0x4b')][_0x0788('0x56')]({'where':{'id':_0x1e1963['params']['id']},'attributes':['id',_0x0788('0x6c'),_0x0788('0x5f'),_0x0788('0x67'),'clientSecret',_0x0788('0x6d'),_0x0788('0x24'),_0x0788('0x66')]})[_0x0788('0x1e')](handleEntityNotFound(_0x358754,null))[_0x0788('0x1e')](function(_0x48afda){_0x32b9a8=_0x48afda;_0x25058b=_0x32b9a8[_0x0788('0x6c')];_0x5d8ddb=_0x25058b===_0x0788('0x6e')?'eu':'com';_0x471b3a=_0x32b9a8[_0x0788('0x6d')];var _0x1c8f74=_0x471b3a['slice'](-0x1);if(_0x1c8f74==='/'||_0x1c8f74==='\x5c'||_0x1c8f74===':'){_0x471b3a=_0x471b3a[_0x0788('0x6f')](0x0,_0x471b3a[_0x0788('0x70')](_0x1c8f74));}if(!_0x32b9a8[_0x0788('0x66')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x32b9a8);})[_0x0788('0x1e')](function(_0x42c537){if(_0x42c537){return rp({'method':_0x0788('0x71'),'uri':util['format'](_0x0788('0x72'),_0x5d8ddb),'qs':{'module':_0x0788('0x73')},'headers':{'Authorization':_0x0788('0x74')+_0x42c537},'json':!![]});}})[_0x0788('0x1e')](function(_0x27c4d5){if(_0x27c4d5){if(_0x27c4d5[_0x0788('0x75')]&&_0x27c4d5[_0x0788('0x75')][_0x0788('0x23')]){throw new Error(_0x27c4d5['response'][_0x0788('0x23')][_0x0788('0x25')]);}var _0x121f1d=[];var _0x31c921=[];var _0x57674a=['Owner',_0x0788('0x76'),_0x0788('0x77'),'WhoId',_0x0788('0x78'),_0x0788('0x79'),_0x0788('0x7a'),'Call_Type'];_0x31c921=_['remove'](_0x27c4d5[_0x0788('0x3e')],function(_0x1927ed){return _0x57674a['includes'](_0x1927ed['api_name']);});for(var _0x4ace43=0x0;_0x4ace43<_0x31c921[_0x0788('0x58')];_0x4ace43++){if(_0x31c921[_0x4ace43][_0x0788('0x7b')]===![]){_0x121f1d['push']({'id':_0x31c921[_0x4ace43]['id'],'name':_0x31c921[_0x4ace43][_0x0788('0x7c')],'custom':_0x31c921[_0x4ace43][_0x0788('0x7d')],'options':_0x31c921[_0x4ace43][_0x0788('0x7e')]===_0x0788('0x7f')&&_0x31c921[_0x4ace43][_0x0788('0x80')]['length']>-0x1?_[_0x0788('0x36')](_0x31c921[_0x4ace43]['pick_list_values'],function(_0x2e1d76){return{'name':_0x2e1d76,'value':_0x2e1d76};}):[]});}}return{'count':_0x121f1d['length'],'rows':_0x121f1d};}else{return{'count':0x0,'rows':[]};}})[_0x0788('0x1e')](respondWithResult(_0x358754,null))[_0x0788('0x26')](function(_0xbf1276){var _0x41ef38=_0x1e1963[_0x0788('0x3a')][_0x0788('0x81')]?0x1f4:_0xbf1276[_0x0788('0x82')]||0x1f4;logger[_0x0788('0x23')](_0x0788('0x83'),_0x0788('0x6b'),_0x41ef38,JSON[_0x0788('0x22')](_0xbf1276));delete _0xbf1276[_0x0788('0x34')];if(_0x41ef38===0x191){_0x41ef38=0x190;}_0x358754[_0x0788('0x32')](_0x41ef38)['send'](_0x1e1963['query']['test']?{'message':_0x0788('0x84'),'statusCode':_0xbf1276[_0x0788('0x82')]}:_0xbf1276);});}; \ No newline at end of file +var _0xd4ad=['include','findAll','rows','show','length','find','create','params','body','findOne','ZohoConfiguration','filter','hasOwnProperty','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientId','clientSecret','serverUrl','host','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','push','display_label','custom_field','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','end','stack','name','status','map','rawAttributes','type','query','keys','filters','intersection','attributes','fields','model','nolimit','order','sort','where','pick','merge','VIRTUAL','options','ZohoAccount','includeAll'];(function(_0x381c33,_0x16405c){var _0x1a6bc9=function(_0x35e823){while(--_0x35e823){_0x381c33['push'](_0x381c33['shift']());}};_0x1a6bc9(++_0x16405c);}(_0xd4ad,0x158));var _0xdd4a=function(_0x3b210f,_0x22971f){_0x3b210f=_0x3b210f-0x0;var _0x356a93=_0xd4ad[_0x3b210f];return _0x356a93;};'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('fast-json-patch');var rp=require(_0xdd4a('0x4'));var moment=require(_0xdd4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdd4a('0x6'));var path=require(_0xdd4a('0x7'));var sox=require('sox');var csv=require(_0xdd4a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdd4a('0x9'));var squel=require(_0xdd4a('0xa'));var crypto=require('crypto');var jsforce=require(_0xdd4a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdd4a('0x8'));var querystring=require(_0xdd4a('0xc'));var Papa=require(_0xdd4a('0xd'));var Redis=require(_0xdd4a('0xe'));var authService=require(_0xdd4a('0xf'));var qs=require(_0xdd4a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd4a('0x11'))('api');var utils=require(_0xdd4a('0x12'));var config=require(_0xdd4a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd4a('0x14'))['db'];var integrations=require(_0xdd4a('0x15'));var jayson=require('jayson/promise');var client=jayson[_0xdd4a('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a24de,_0x55a374,_0xdf80d0,_0x5bdf76){return new BPromise(function(_0x4d4e47,_0x17f1c3){var _0x52d623=_0x5bdf76||client;return _0x52d623['request'](_0x2a24de,_0xdf80d0)['then'](function(_0x2971b6){logger[_0xdd4a('0x17')](_0xdd4a('0x18'),_0x55a374,_0xdd4a('0x19'));logger[_0xdd4a('0x1a')](_0xdd4a('0x1b'),_0x55a374,_0xdd4a('0x19'),JSON[_0xdd4a('0x1c')](_0x2971b6));if(_0x2971b6['error']){if(_0x2971b6[_0xdd4a('0x1d')][_0xdd4a('0x1e')]===0x1f4){logger['error'](_0xdd4a('0x18'),_0x55a374,_0x2971b6[_0xdd4a('0x1d')]['message']);return _0x17f1c3(_0x2971b6[_0xdd4a('0x1d')][_0xdd4a('0x1f')]);}logger[_0xdd4a('0x1d')](_0xdd4a('0x18'),_0x55a374,_0x2971b6[_0xdd4a('0x1d')][_0xdd4a('0x1f')]);return _0x4d4e47(_0x2971b6[_0xdd4a('0x1d')]['message']);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x55a374,'request\x20sent');_0x4d4e47(_0x2971b6[_0xdd4a('0x20')][_0xdd4a('0x1f')]);}})[_0xdd4a('0x21')](function(_0x32c9f0){logger[_0xdd4a('0x1d')]('ZohoAccount,\x20%s,\x20%s',_0x55a374,_0x32c9f0);_0x17f1c3(_0x32c9f0);});});}function respondWithStatusCode(_0x166fc6,_0x1b3840){_0x1b3840=_0x1b3840||0xcc;return function(_0x46cb1e){if(_0x46cb1e){return _0x166fc6[_0xdd4a('0x22')](_0x1b3840);}return _0x166fc6['status'](_0x1b3840)['end']();};}function respondWithResult(_0x5301ee,_0x48fc3a){_0x48fc3a=_0x48fc3a||0xc8;return function(_0x3f80e3){if(_0x3f80e3){return _0x5301ee['status'](_0x48fc3a)['json'](_0x3f80e3);}};}function respondWithFilteredResult(_0x26846d,_0x160ac1){return function(_0xf1b39c){if(_0xf1b39c){var _0xc29ce4=_0xf1b39c[_0xdd4a('0x23')],_0x6eaea3=_0x160ac1[_0xdd4a('0x24')],_0x28e499=_0x160ac1['offset']+_0x160ac1[_0xdd4a('0x25')],_0x4d2b89;if(_0x28e499>=_0xc29ce4){_0x28e499=_0xc29ce4;_0x4d2b89=0xc8;}else{_0x4d2b89=0xce;}_0x26846d['status'](_0x4d2b89);return _0x26846d[_0xdd4a('0x26')](_0xdd4a('0x27'),_0x6eaea3+'-'+_0x28e499+'/'+_0xc29ce4)[_0xdd4a('0x28')](_0xf1b39c);}return null;};}function patchUpdates(_0x1d347c){return function(_0x4e35b8){try{jsonpatch[_0xdd4a('0x29')](_0x4e35b8,_0x1d347c,!![]);}catch(_0x10e531){return BPromise[_0xdd4a('0x2a')](_0x10e531);}return _0x4e35b8['save']();};}function saveUpdates(_0x2b6d01,_0x4f9ef0){return function(_0x3521b3){if(_0x3521b3){return _0x3521b3[_0xdd4a('0x2b')](_0x2b6d01)[_0xdd4a('0x2c')](function(_0x5395a3){return _0x5395a3;});}return null;};}function removeEntity(_0x10ff47,_0x389d6b){return function(_0x559258){if(_0x559258){return _0x559258[_0xdd4a('0x2d')]()[_0xdd4a('0x2c')](function(){_0x10ff47['status'](0xcc)[_0xdd4a('0x2e')]();});}};}function handleEntityNotFound(_0x57cab6,_0x3d21fb){return function(_0x20c9d5){if(!_0x20c9d5){_0x57cab6[_0xdd4a('0x22')](0x194);}return _0x20c9d5;};}function handleError(_0x342182,_0xc7867f){_0xc7867f=_0xc7867f||0x1f4;return function(_0x53c183){logger[_0xdd4a('0x1d')](_0x53c183[_0xdd4a('0x2f')]);if(_0x53c183[_0xdd4a('0x30')]){delete _0x53c183[_0xdd4a('0x30')];}_0x342182[_0xdd4a('0x31')](_0xc7867f)['send'](_0x53c183);};}exports['index']=function(_0x23156f,_0x19b9df){var _0x50c38d={},_0x187660={},_0x4e9391={'count':0x0,'rows':[]};var _0x1fd026=_[_0xdd4a('0x32')](db['ZohoAccount'][_0xdd4a('0x33')],function(_0x391276){return{'name':_0x391276['fieldName'],'type':_0x391276[_0xdd4a('0x34')]['key']};});_0x187660['model']=_[_0xdd4a('0x32')](_0x1fd026,_0xdd4a('0x30'));_0x187660[_0xdd4a('0x35')]=_[_0xdd4a('0x36')](_0x23156f[_0xdd4a('0x35')]);_0x187660[_0xdd4a('0x37')]=_[_0xdd4a('0x38')](_0x187660['model'],_0x187660['query']);_0x50c38d[_0xdd4a('0x39')]=_[_0xdd4a('0x38')](_0x187660['model'],qs[_0xdd4a('0x3a')](_0x23156f[_0xdd4a('0x35')][_0xdd4a('0x3a')]));_0x50c38d[_0xdd4a('0x39')]=_0x50c38d['attributes']['length']?_0x50c38d[_0xdd4a('0x39')]:_0x187660[_0xdd4a('0x3b')];if(!_0x23156f[_0xdd4a('0x35')]['hasOwnProperty'](_0xdd4a('0x3c'))){_0x50c38d[_0xdd4a('0x25')]=qs[_0xdd4a('0x25')](_0x23156f[_0xdd4a('0x35')][_0xdd4a('0x25')]);_0x50c38d['offset']=qs[_0xdd4a('0x24')](_0x23156f[_0xdd4a('0x35')][_0xdd4a('0x24')]);}_0x50c38d[_0xdd4a('0x3d')]=qs[_0xdd4a('0x3e')](_0x23156f['query'][_0xdd4a('0x3e')]);_0x50c38d[_0xdd4a('0x3f')]=qs['filters'](_[_0xdd4a('0x40')](_0x23156f[_0xdd4a('0x35')],_0x187660[_0xdd4a('0x37')]),_0x1fd026);if(_0x23156f[_0xdd4a('0x35')]['filter']){_0x50c38d['where']=_[_0xdd4a('0x41')](_0x50c38d['where'],{'$or':_[_0xdd4a('0x32')](_0x1fd026,function(_0x39d893){if(_0x39d893[_0xdd4a('0x34')]!==_0xdd4a('0x42')){var _0x388ee9={};_0x388ee9[_0x39d893[_0xdd4a('0x30')]]={'$like':'%'+_0x23156f[_0xdd4a('0x35')]['filter']+'%'};return _0x388ee9;}})});}_0x50c38d=_[_0xdd4a('0x41')]({},_0x50c38d,_0x23156f[_0xdd4a('0x43')]);var _0x18eb96={'where':_0x50c38d[_0xdd4a('0x3f')]};return db[_0xdd4a('0x44')]['count'](_0x18eb96)[_0xdd4a('0x2c')](function(_0x1dc325){_0x4e9391[_0xdd4a('0x23')]=_0x1dc325;if(_0x23156f[_0xdd4a('0x35')][_0xdd4a('0x45')]){_0x50c38d[_0xdd4a('0x46')]=[{'all':!![]}];}return db[_0xdd4a('0x44')][_0xdd4a('0x47')](_0x50c38d);})[_0xdd4a('0x2c')](function(_0x1c5aff){_0x4e9391[_0xdd4a('0x48')]=_0x1c5aff;return _0x4e9391;})[_0xdd4a('0x2c')](respondWithFilteredResult(_0x19b9df,_0x50c38d))[_0xdd4a('0x21')](handleError(_0x19b9df,null));};exports[_0xdd4a('0x49')]=function(_0x4275d0,_0x1a8bca){var _0x583cfb={'raw':![],'where':{'id':_0x4275d0['params']['id']}},_0x2ff57d={};_0x2ff57d[_0xdd4a('0x3b')]=_[_0xdd4a('0x36')](db[_0xdd4a('0x44')][_0xdd4a('0x33')]);_0x2ff57d[_0xdd4a('0x35')]=_['keys'](_0x4275d0[_0xdd4a('0x35')]);_0x2ff57d['filters']=_['intersection'](_0x2ff57d[_0xdd4a('0x3b')],_0x2ff57d[_0xdd4a('0x35')]);_0x583cfb[_0xdd4a('0x39')]=_[_0xdd4a('0x38')](_0x2ff57d[_0xdd4a('0x3b')],qs[_0xdd4a('0x3a')](_0x4275d0['query'][_0xdd4a('0x3a')]));_0x583cfb[_0xdd4a('0x39')]=_0x583cfb['attributes'][_0xdd4a('0x4a')]?_0x583cfb[_0xdd4a('0x39')]:_0x2ff57d['model'];if(_0x4275d0[_0xdd4a('0x35')][_0xdd4a('0x45')]){_0x583cfb['include']=[{'all':!![]}];}_0x583cfb=_[_0xdd4a('0x41')]({},_0x583cfb,_0x4275d0[_0xdd4a('0x43')]);return db[_0xdd4a('0x44')][_0xdd4a('0x4b')](_0x583cfb)[_0xdd4a('0x2c')](handleEntityNotFound(_0x1a8bca,null))['then'](respondWithResult(_0x1a8bca,null))['catch'](handleError(_0x1a8bca,null));};exports[_0xdd4a('0x4c')]=function(_0x3ca210,_0x161e10){return db[_0xdd4a('0x44')][_0xdd4a('0x4c')](_0x3ca210['body'],{})[_0xdd4a('0x2c')](respondWithResult(_0x161e10,0xc9))[_0xdd4a('0x21')](handleError(_0x161e10,null));};exports[_0xdd4a('0x2b')]=function(_0x3681c4,_0x18580e){if(_0x3681c4['body']['id']){delete _0x3681c4['body']['id'];}return db[_0xdd4a('0x44')]['find']({'where':{'id':_0x3681c4[_0xdd4a('0x4d')]['id']}})[_0xdd4a('0x2c')](handleEntityNotFound(_0x18580e,null))[_0xdd4a('0x2c')](saveUpdates(_0x3681c4[_0xdd4a('0x4e')],null))[_0xdd4a('0x2c')](respondWithResult(_0x18580e,null))[_0xdd4a('0x21')](handleError(_0x18580e,null));};exports['destroy']=function(_0x40d96a,_0x3aebe6){return db[_0xdd4a('0x44')]['find']({'where':{'id':_0x40d96a[_0xdd4a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3aebe6,null))[_0xdd4a('0x2c')](removeEntity(_0x3aebe6,null))[_0xdd4a('0x21')](handleError(_0x3aebe6,null));};exports['getConfigurations']=function(_0x5c9d37,_0x1baaae,_0x360390){var _0x18e030={};var _0x53b933={};var _0x448aff;var _0x419c1f;return db['ZohoAccount'][_0xdd4a('0x4f')]({'where':{'id':_0x5c9d37[_0xdd4a('0x4d')]['id']}})[_0xdd4a('0x2c')](handleEntityNotFound(_0x1baaae,null))['then'](function(_0x5b9104){if(_0x5b9104){_0x448aff=_0x5b9104;_0x53b933[_0xdd4a('0x3b')]=_[_0xdd4a('0x36')](db[_0xdd4a('0x50')][_0xdd4a('0x33')]);_0x53b933[_0xdd4a('0x35')]=_[_0xdd4a('0x36')](_0x5c9d37['query']);_0x53b933[_0xdd4a('0x37')]=_[_0xdd4a('0x38')](_0x53b933['model'],_0x53b933[_0xdd4a('0x35')]);_0x18e030['attributes']=_[_0xdd4a('0x38')](_0x53b933[_0xdd4a('0x3b')],qs[_0xdd4a('0x3a')](_0x5c9d37[_0xdd4a('0x35')][_0xdd4a('0x3a')]));_0x18e030[_0xdd4a('0x39')]=_0x18e030[_0xdd4a('0x39')][_0xdd4a('0x4a')]?_0x18e030[_0xdd4a('0x39')]:_0x53b933[_0xdd4a('0x3b')];_0x18e030[_0xdd4a('0x3d')]=qs[_0xdd4a('0x3e')](_0x5c9d37[_0xdd4a('0x35')][_0xdd4a('0x3e')]);_0x18e030['where']=qs[_0xdd4a('0x37')](_[_0xdd4a('0x40')](_0x5c9d37[_0xdd4a('0x35')],_0x53b933[_0xdd4a('0x37')]));if(_0x5c9d37[_0xdd4a('0x35')][_0xdd4a('0x51')]){_0x18e030[_0xdd4a('0x3f')]=_[_0xdd4a('0x41')](_0x18e030[_0xdd4a('0x3f')],{'$or':_[_0xdd4a('0x32')](_0x18e030[_0xdd4a('0x39')],function(_0x5c0821){var _0x12a3d3={};_0x12a3d3[_0x5c0821]={'$like':'%'+_0x5c9d37[_0xdd4a('0x35')][_0xdd4a('0x51')]+'%'};return _0x12a3d3;})});}_0x18e030=_['merge']({},_0x18e030,_0x5c9d37[_0xdd4a('0x43')]);return _0x448aff['getConfigurations'](_0x18e030);}})[_0xdd4a('0x2c')](function(_0x535354){if(_0x535354){_0x419c1f=_0x535354['length'];if(!_0x5c9d37[_0xdd4a('0x35')][_0xdd4a('0x52')]('nolimit')){_0x18e030[_0xdd4a('0x25')]=qs[_0xdd4a('0x25')](_0x5c9d37[_0xdd4a('0x35')][_0xdd4a('0x25')]);_0x18e030[_0xdd4a('0x24')]=qs[_0xdd4a('0x24')](_0x5c9d37['query'][_0xdd4a('0x24')]);}return _0x448aff[_0xdd4a('0x53')](_0x18e030);}})[_0xdd4a('0x2c')](function(_0xb0057d){if(_0xb0057d){return _0xb0057d?{'count':_0x419c1f,'rows':_0xb0057d}:null;}})[_0xdd4a('0x2c')](respondWithResult(_0x1baaae,null))['catch'](handleError(_0x1baaae,null));};exports[_0xdd4a('0x54')]=function(_0x321ead,_0xec1046,_0x222dc6){if(_0x321ead[_0xdd4a('0x4e')]['id']){delete _0x321ead['body']['id'];}return db[_0xdd4a('0x44')][_0xdd4a('0x4f')]({'where':{'id':_0x321ead[_0xdd4a('0x4d')]['id']}})[_0xdd4a('0x2c')](handleEntityNotFound(_0xec1046,null))[_0xdd4a('0x2c')](function(_0x1a96f2){if(_0x1a96f2){_0x321ead['body'][_0xdd4a('0x55')]=_0x1a96f2['id'];_0x321ead['body'][_0xdd4a('0x56')]=integrations[_0xdd4a('0x57')](_0x321ead['body'][_0xdd4a('0x58')],_0x321ead[_0xdd4a('0x4e')][_0xdd4a('0x34')]);_0x321ead['body'][_0xdd4a('0x59')]=integrations[_0xdd4a('0x5a')](_0x321ead[_0xdd4a('0x4e')][_0xdd4a('0x58')],_0x321ead['body'][_0xdd4a('0x34')]);return db[_0xdd4a('0x50')]['create'](_0x321ead[_0xdd4a('0x4e')],{'include':[{'model':db[_0xdd4a('0x5b')],'as':'Subjects'},{'model':db[_0xdd4a('0x5b')],'as':'Descriptions'}]});}return null;})[_0xdd4a('0x2c')](respondWithResult(_0xec1046,null))[_0xdd4a('0x21')](handleError(_0xec1046,null));};function getAccessToken(_0x2d6679){return new Promise(function(_0x31ee1e,_0x36949b){var _0x1b7ee2;switch(_0x2d6679[_0xdd4a('0x5c')]){case'US':_0x1b7ee2=_0xdd4a('0x5d');break;case'AU':_0x1b7ee2='https://accounts.zoho.com.au';break;case'EU':_0x1b7ee2=_0xdd4a('0x5e');break;case'IN':_0x1b7ee2=_0xdd4a('0x5f');break;case'CN':_0x1b7ee2=_0xdd4a('0x60');break;default:_0x1b7ee2='https://accounts.zoho.eu';break;}var _0x4bb1c9={'method':_0xdd4a('0x61'),'uri':_0x1b7ee2+_0xdd4a('0x62'),'qs':{'refresh_token':_0x2d6679[_0xdd4a('0x63')],'client_id':_0x2d6679['clientId'],'client_secret':_0x2d6679['clientSecret'],'grant_type':_0xdd4a('0x64')},'json':!![]};return rp(_0x4bb1c9)['then'](function(_0x1f3b7b){if(_0x1f3b7b[_0xdd4a('0x65')]){_0x31ee1e(_0x1f3b7b[_0xdd4a('0x65')]);}else{_0x36949b(_0xdd4a('0x66'));}})[_0xdd4a('0x21')](function(_0x4bfec6){_0x36949b(_0x4bfec6);});});}exports[_0xdd4a('0x67')]=function(_0x2c2fda,_0x4ade3c,_0x56af60){var _0x55a9e9,_0xb355b5,_0x87ffe8,_0x252679,_0x51d996;return db[_0xdd4a('0x44')][_0xdd4a('0x4f')]({'where':{'id':_0x2c2fda[_0xdd4a('0x4d')]['id']},'attributes':['id','host',_0xdd4a('0x5c'),_0xdd4a('0x68'),_0xdd4a('0x69'),_0xdd4a('0x6a'),_0xdd4a('0x1e'),_0xdd4a('0x63')]})['then'](handleEntityNotFound(_0x4ade3c,null))['then'](function(_0x3a8ef6){_0x51d996=_0x3a8ef6;_0x55a9e9=_0x51d996[_0xdd4a('0x6b')];_0xb355b5=_0x55a9e9===_0xdd4a('0x6c')?'eu':_0xdd4a('0x6d');_0x87ffe8=_0x51d996[_0xdd4a('0x6a')];var _0x4c6006=_0x87ffe8[_0xdd4a('0x6e')](-0x1);if(_0x4c6006==='/'||_0x4c6006==='\x5c'||_0x4c6006===':'){_0x87ffe8=_0x87ffe8[_0xdd4a('0x6f')](0x0,_0x87ffe8[_0xdd4a('0x70')](_0x4c6006));}if(!_0x51d996[_0xdd4a('0x63')]){throw new Error(_0xdd4a('0x71'));}return getAccessToken(_0x51d996);})[_0xdd4a('0x2c')](function(_0x420703){if(_0x420703){return rp({'method':_0xdd4a('0x72'),'uri':util[_0xdd4a('0x73')](_0xdd4a('0x74'),_0xb355b5),'qs':{'module':_0xdd4a('0x75')},'headers':{'Authorization':_0xdd4a('0x76')+_0x420703},'json':!![]});}})['then'](function(_0x17c918){if(_0x17c918){if(_0x17c918[_0xdd4a('0x77')]&&_0x17c918[_0xdd4a('0x77')][_0xdd4a('0x1d')]){throw new Error(_0x17c918[_0xdd4a('0x77')][_0xdd4a('0x1d')][_0xdd4a('0x1f')]);}var _0x2a7f79=[];var _0x5a87e8=[];var _0x4b1fc3=[_0xdd4a('0x78'),_0xdd4a('0x79'),_0xdd4a('0x7a'),_0xdd4a('0x7b'),_0xdd4a('0x7c'),_0xdd4a('0x7d'),_0xdd4a('0x7e'),'Call_Type'];_0x5a87e8=_[_0xdd4a('0x7f')](_0x17c918[_0xdd4a('0x3a')],function(_0xd7c3ab){return _0x4b1fc3[_0xdd4a('0x80')](_0xd7c3ab[_0xdd4a('0x81')]);});for(var _0x5bef8f=0x0;_0x5bef8f<_0x5a87e8[_0xdd4a('0x4a')];_0x5bef8f++){if(_0x5a87e8[_0x5bef8f]['system_mandatory']===![]){_0x2a7f79[_0xdd4a('0x82')]({'id':_0x5a87e8[_0x5bef8f]['id'],'name':_0x5a87e8[_0x5bef8f][_0xdd4a('0x83')],'custom':_0x5a87e8[_0x5bef8f][_0xdd4a('0x84')],'options':_0x5a87e8[_0x5bef8f]['data_type']==='picklist'&&_0x5a87e8[_0x5bef8f]['pick_list_values'][_0xdd4a('0x4a')]>-0x1?_[_0xdd4a('0x32')](_0x5a87e8[_0x5bef8f][_0xdd4a('0x85')],function(_0x4f7368){return{'name':_0x4f7368,'value':_0x4f7368};}):[]});}}return{'count':_0x2a7f79[_0xdd4a('0x4a')],'rows':_0x2a7f79};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x4ade3c,null))[_0xdd4a('0x21')](function(_0x59d132){var _0x4130f1=_0x2c2fda[_0xdd4a('0x35')][_0xdd4a('0x86')]?0x1f4:_0x59d132[_0xdd4a('0x87')]||0x1f4;logger[_0xdd4a('0x1d')](_0xdd4a('0x88'),_0xdd4a('0x67'),_0x4130f1,JSON[_0xdd4a('0x1c')](_0x59d132));delete _0x59d132[_0xdd4a('0x30')];if(_0x4130f1===0x191){_0x4130f1=0x190;}_0x4ade3c[_0xdd4a('0x31')](_0x4130f1)[_0xdd4a('0x89')](_0x2c2fda['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x59d132[_0xdd4a('0x87')]}:_0x59d132);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index eac651d..402af91 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 _0x7131=['parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','clientId','https://accounts.zoho.com','https://accounts.zoho.eu','info','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','code','host','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','authorization_code','clientSecret','application/x-www-form-urlencoded'];(function(_0x5c060d,_0x4195dc){var _0x217e6b=function(_0x54788f){while(--_0x54788f){_0x5c060d['push'](_0x5c060d['shift']());}};_0x217e6b(++_0x4195dc);}(_0x7131,0x12d));var _0x1713=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x7131[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x1713('0x0'));var util=require(_0x1713('0x1'));var logger=require(_0x1713('0x2'))('api');var moment=require(_0x1713('0x3'));var BPromise=require(_0x1713('0x4'));var rp=require(_0x1713('0x5'));var fs=require('fs');var path=require(_0x1713('0x6'));var rimraf=require('rimraf');var config=require(_0x1713('0x7'));var attributes=require(_0x1713('0x8'));var integrations=require(_0x1713('0x9'));module[_0x1713('0xa')]=function(_0xaa7b7c,_0x281dea){return _0xaa7b7c[_0x1713('0xb')](_0x1713('0xc'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1e32a9,_0x673738,_0x4de281){if(_0x1e32a9[_0x1713('0xd')](_0x1713('0xe'))||_0x1e32a9[_0x1713('0xd')]('serverUrl')||_0x1e32a9[_0x1713('0xd')]('clientId')||_0x1e32a9[_0x1713('0xd')]('clientSecret')||_0x1e32a9[_0x1713('0xd')](_0x1713('0xf'))||_0x1e32a9[_0x1713('0xd')](_0x1713('0x10'))){var _0x5d9864,_0x135356;_0x5d9864=_0x1e32a9[_0x1713('0x11')];var _0x1d3ccc=_0x5d9864[_0x1713('0x12')](-0x1);if(_0x1d3ccc==='/'||_0x1d3ccc==='\x5c'||_0x1d3ccc===':'){_0x5d9864=_0x5d9864[_0x1713('0x13')](0x0,_0x5d9864[_0x1713('0x14')](_0x1d3ccc));}switch(_0x1e32a9['zone']){case'US':_0x135356='https://accounts.zoho.com';break;case'AU':_0x135356='https://accounts.zoho.com.au';break;case'IN':_0x135356=_0x1713('0x15');break;case'CN':_0x135356=_0x1713('0x16');break;default:_0x135356='https://accounts.zoho.eu';break;}var _0x486360={'method':_0x1713('0x17'),'uri':_0x135356+'/oauth/v2/token','form':{'grant_type':_0x1713('0x18'),'client_id':_0x1e32a9['clientId'],'client_secret':_0x1e32a9[_0x1713('0x19')],'redirect_uri':_0x1e32a9[_0x1713('0x11')],'code':_0x1e32a9[_0x1713('0xf')]},'headers':{'Content-Type':_0x1713('0x1a')}};return rp(_0x486360)['then'](function(_0xb197cd){var _0x4b0200=JSON[_0x1713('0x1b')](_0xb197cd);if(_0x4b0200[_0x1713('0x1c')]){_0x1e32a9[_0x1713('0x1d')]=_0x4b0200['refresh_token'];logger['info'](util[_0x1713('0x1e')](_0x1713('0x1f'),_0x1e32a9[_0x1713('0x20')],_0x1e32a9['id']));}else{logger[_0x1713('0x21')](util[_0x1713('0x1e')](_0x1713('0x22'),_0x1e32a9[_0x1713('0x20')],_0x1e32a9['id']),util[_0x1713('0x23')](_0x4b0200,{'showHidden':![],'depth':null}));}return _0x4de281(null,_0x673738);})[_0x1713('0x24')](function(_0x71795c){logger[_0x1713('0x21')](util[_0x1713('0x1e')](_0x1713('0x22'),_0x1e32a9[_0x1713('0x20')],_0x1e32a9['id']),util[_0x1713('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x4de281(_0x71795c);});}else{return _0x4de281(null,_0x673738);}},'beforeUpdate':function(_0x12ac8a,_0x92cf4e,_0x320b52){if(_0x12ac8a[_0x1713('0xd')](_0x1713('0xe'))||_0x12ac8a[_0x1713('0xd')](_0x1713('0x11'))||_0x12ac8a[_0x1713('0xd')](_0x1713('0x25'))||_0x12ac8a['changed']('clientSecret')||_0x12ac8a[_0x1713('0xd')]('code')||_0x12ac8a[_0x1713('0xd')](_0x1713('0x10'))){var _0xc6c065,_0x417b37;_0xc6c065=_0x12ac8a[_0x1713('0x11')];var _0x353e11=_0xc6c065[_0x1713('0x12')](-0x1);if(_0x353e11==='/'||_0x353e11==='\x5c'||_0x353e11===':'){_0xc6c065=_0xc6c065[_0x1713('0x13')](0x0,_0xc6c065[_0x1713('0x14')](_0x353e11));}switch(_0x12ac8a['zone']){case'US':_0x417b37=_0x1713('0x26');break;case'AU':_0x417b37='https://accounts.zoho.com.au';break;case'IN':_0x417b37=_0x1713('0x15');break;case'CN':_0x417b37=_0x1713('0x16');break;default:_0x417b37=_0x1713('0x27');break;}var _0xd47ec3={'method':_0x1713('0x17'),'uri':_0x417b37+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x12ac8a[_0x1713('0x25')],'client_secret':_0x12ac8a[_0x1713('0x19')],'redirect_uri':_0x12ac8a['serverUrl'],'code':_0x12ac8a[_0x1713('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0xd47ec3)['then'](function(_0x1b52e1){var _0x569890=JSON['parse'](_0x1b52e1);if(_0x569890['refresh_token']){_0x12ac8a[_0x1713('0x1d')]=_0x569890[_0x1713('0x1c')];logger[_0x1713('0x28')](util[_0x1713('0x1e')](_0x1713('0x1f'),_0x12ac8a['name'],_0x12ac8a['id']));}else{logger[_0x1713('0x21')](util[_0x1713('0x1e')](_0x1713('0x22'),_0x12ac8a[_0x1713('0x20')],_0x12ac8a['id']),util['inspect'](_0x569890,{'showHidden':![],'depth':null}));}return _0x320b52(null,_0x92cf4e);})[_0x1713('0x24')](function(_0xe427f0){logger[_0x1713('0x21')](util[_0x1713('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x12ac8a[_0x1713('0x20')],_0x12ac8a['id']),util[_0x1713('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x320b52(_0xe427f0);});}else{return _0x320b52(null,_0x92cf4e);}}}});}; \ No newline at end of file +var _0x6677=['../../config/logger','moment','bluebird','request-promise','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','application/x-www-form-urlencoded','then','refreshToken','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','https://accounts.zoho.com','https://accounts.zoho.eu','POST','authorization_code','info','catch','lodash','util'];(function(_0x57f7d7,_0x41443c){var _0x11b297=function(_0x2783ce){while(--_0x2783ce){_0x57f7d7['push'](_0x57f7d7['shift']());}};_0x11b297(++_0x41443c);}(_0x6677,0x11d));var _0x7667=function(_0x40d697,_0x347946){_0x40d697=_0x40d697-0x0;var _0x400ae7=_0x6677[_0x40d697];return _0x400ae7;};'use strict';var _=require(_0x7667('0x0'));var util=require(_0x7667('0x1'));var logger=require(_0x7667('0x2'))('api');var moment=require(_0x7667('0x3'));var BPromise=require(_0x7667('0x4'));var rp=require(_0x7667('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7667('0x6'));var config=require('../../config/environment');var attributes=require(_0x7667('0x7'));var integrations=require(_0x7667('0x8'));module['exports']=function(_0x3be94f,_0x475526){return _0x3be94f['define'](_0x7667('0x9'),attributes,{'tableName':_0x7667('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5a2b01,_0x4a8508,_0x2202c8){if(_0x5a2b01[_0x7667('0xb')](_0x7667('0xc'))||_0x5a2b01[_0x7667('0xb')](_0x7667('0xd'))||_0x5a2b01[_0x7667('0xb')](_0x7667('0xe'))||_0x5a2b01['changed'](_0x7667('0xf'))||_0x5a2b01['changed'](_0x7667('0x10'))||_0x5a2b01[_0x7667('0xb')](_0x7667('0x11'))){var _0x2abd4a,_0x53b736;_0x2abd4a=_0x5a2b01[_0x7667('0xd')];var _0x1cd2ea=_0x2abd4a[_0x7667('0x12')](-0x1);if(_0x1cd2ea==='/'||_0x1cd2ea==='\x5c'||_0x1cd2ea===':'){_0x2abd4a=_0x2abd4a[_0x7667('0x13')](0x0,_0x2abd4a[_0x7667('0x14')](_0x1cd2ea));}switch(_0x5a2b01['zone']){case'US':_0x53b736='https://accounts.zoho.com';break;case'AU':_0x53b736=_0x7667('0x15');break;case'IN':_0x53b736=_0x7667('0x16');break;case'CN':_0x53b736=_0x7667('0x17');break;default:_0x53b736='https://accounts.zoho.eu';break;}var _0x38f3e0={'method':'POST','uri':_0x53b736+_0x7667('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x5a2b01['clientId'],'client_secret':_0x5a2b01[_0x7667('0xf')],'redirect_uri':_0x5a2b01['serverUrl'],'code':_0x5a2b01[_0x7667('0x10')]},'headers':{'Content-Type':_0x7667('0x19')}};return rp(_0x38f3e0)[_0x7667('0x1a')](function(_0x185506){var _0x49db14=JSON['parse'](_0x185506);if(_0x49db14['refresh_token']){_0x5a2b01[_0x7667('0x1b')]=_0x49db14[_0x7667('0x1c')];logger['info'](util[_0x7667('0x1d')](_0x7667('0x1e'),_0x5a2b01[_0x7667('0x1f')],_0x5a2b01['id']));}else{logger[_0x7667('0x20')](util['format'](_0x7667('0x21'),_0x5a2b01[_0x7667('0x1f')],_0x5a2b01['id']),util[_0x7667('0x22')](_0x49db14,{'showHidden':![],'depth':null}));}return _0x2202c8(null,_0x4a8508);})['catch'](function(_0x445c28){logger[_0x7667('0x20')](util[_0x7667('0x1d')](_0x7667('0x21'),_0x5a2b01[_0x7667('0x1f')],_0x5a2b01['id']),util[_0x7667('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x2202c8(_0x445c28);});}else{return _0x2202c8(null,_0x4a8508);}},'beforeUpdate':function(_0x49adef,_0x27ce95,_0x3b4879){if(_0x49adef[_0x7667('0xb')](_0x7667('0xc'))||_0x49adef[_0x7667('0xb')](_0x7667('0xd'))||_0x49adef[_0x7667('0xb')](_0x7667('0xe'))||_0x49adef[_0x7667('0xb')](_0x7667('0xf'))||_0x49adef[_0x7667('0xb')](_0x7667('0x10'))||_0x49adef[_0x7667('0xb')]('host')){var _0x2f2ea6,_0x3b47bb;_0x2f2ea6=_0x49adef[_0x7667('0xd')];var _0x2ca71e=_0x2f2ea6[_0x7667('0x12')](-0x1);if(_0x2ca71e==='/'||_0x2ca71e==='\x5c'||_0x2ca71e===':'){_0x2f2ea6=_0x2f2ea6[_0x7667('0x13')](0x0,_0x2f2ea6[_0x7667('0x14')](_0x2ca71e));}switch(_0x49adef[_0x7667('0xc')]){case'US':_0x3b47bb=_0x7667('0x23');break;case'AU':_0x3b47bb=_0x7667('0x15');break;case'IN':_0x3b47bb=_0x7667('0x16');break;case'CN':_0x3b47bb=_0x7667('0x17');break;default:_0x3b47bb=_0x7667('0x24');break;}var _0x1abffc={'method':_0x7667('0x25'),'uri':_0x3b47bb+_0x7667('0x18'),'form':{'grant_type':_0x7667('0x26'),'client_id':_0x49adef['clientId'],'client_secret':_0x49adef[_0x7667('0xf')],'redirect_uri':_0x49adef['serverUrl'],'code':_0x49adef['code']},'headers':{'Content-Type':_0x7667('0x19')}};return rp(_0x1abffc)['then'](function(_0x4935bc){var _0x3093b3=JSON['parse'](_0x4935bc);if(_0x3093b3[_0x7667('0x1c')]){_0x49adef[_0x7667('0x1b')]=_0x3093b3['refresh_token'];logger[_0x7667('0x27')](util[_0x7667('0x1d')](_0x7667('0x1e'),_0x49adef[_0x7667('0x1f')],_0x49adef['id']));}else{logger[_0x7667('0x20')](util[_0x7667('0x1d')](_0x7667('0x21'),_0x49adef[_0x7667('0x1f')],_0x49adef['id']),util[_0x7667('0x22')](_0x3093b3,{'showHidden':![],'depth':null}));}return _0x3b4879(null,_0x27ce95);})[_0x7667('0x28')](function(_0x544380){logger[_0x7667('0x20')](util[_0x7667('0x1d')](_0x7667('0x21'),_0x49adef[_0x7667('0x1f')],_0x49adef['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x3b4879(_0x544380);});}else{return _0x3b4879(null,_0x27ce95);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 685971a..8594911 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 _0xbade=['message','catch','GetZohoAccount','ZohoAccount','options','raw','attributes','map','include','model','debug','ShowZohoAccount','where','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','info','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s'];(function(_0x4dfbe0,_0x556350){var _0x1bcb68=function(_0x4be615){while(--_0x4be615){_0x4dfbe0['push'](_0x4dfbe0['shift']());}};_0x1bcb68(++_0x556350);}(_0xbade,0x1ce));var _0xebad=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xbade[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xebad('0x0'));var util=require(_0xebad('0x1'));var moment=require(_0xebad('0x2'));var BPromise=require(_0xebad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xebad('0x4'));var db=require(_0xebad('0x5'))['db'];var utils=require(_0xebad('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xebad('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4abaf2,_0xaa3fac,_0x46391b){return new BPromise(function(_0x16e934,_0x435b3d){return client['request'](_0x4abaf2,_0x46391b)['then'](function(_0x24549d){logger[_0xebad('0x8')]('ZohoAccount,\x20%s,\x20%s',_0xaa3fac,_0xebad('0x9'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xaa3fac,_0xebad('0x9'),JSON[_0xebad('0xa')](_0x24549d));if(_0x24549d[_0xebad('0xb')]){if(_0x24549d[_0xebad('0xb')][_0xebad('0xc')]===0x1f4){logger[_0xebad('0xb')](_0xebad('0xd'),_0xaa3fac,_0x24549d[_0xebad('0xb')]['message']);return _0x435b3d(_0x24549d[_0xebad('0xb')][_0xebad('0xe')]);}logger['error'](_0xebad('0xd'),_0xaa3fac,_0x24549d['error'][_0xebad('0xe')]);return _0x16e934(_0x24549d[_0xebad('0xb')]['message']);}else{logger[_0xebad('0x8')]('ZohoAccount,\x20%s,\x20%s',_0xaa3fac,_0xebad('0x9'));_0x16e934(_0x24549d['result'][_0xebad('0xe')]);}})[_0xebad('0xf')](function(_0x104211){logger[_0xebad('0xb')]('ZohoAccount,\x20%s,\x20%s',_0xaa3fac,_0x104211);_0x435b3d(_0x104211);});});}exports[_0xebad('0x10')]=function(_0xb28f3){var _0x56fb02=this;return new Promise(function(_0x2dfc2a,_0x15dba5){return db[_0xebad('0x11')]['findAll']({'raw':_0xb28f3['options']?_0xb28f3[_0xebad('0x12')][_0xebad('0x13')]===undefined?!![]:![]:!![],'where':_0xb28f3[_0xebad('0x12')]?_0xb28f3[_0xebad('0x12')]['where']||null:null,'attributes':_0xb28f3[_0xebad('0x12')]?_0xb28f3[_0xebad('0x12')][_0xebad('0x14')]||null:null,'limit':_0xb28f3['options']?_0xb28f3[_0xebad('0x12')]['limit']||null:null,'include':_0xb28f3[_0xebad('0x12')]?_0xb28f3[_0xebad('0x12')]['include']?_[_0xebad('0x15')](_0xb28f3['options'][_0xebad('0x16')],function(_0x2d9c7a){return{'model':db[_0x2d9c7a[_0xebad('0x17')]],'as':_0x2d9c7a['as'],'attributes':_0x2d9c7a[_0xebad('0x14')],'include':_0x2d9c7a[_0xebad('0x16')]?_[_0xebad('0x15')](_0x2d9c7a[_0xebad('0x16')],function(_0x12c181){return{'model':db[_0x12c181[_0xebad('0x17')]],'as':_0x12c181['as'],'attributes':_0x12c181[_0xebad('0x14')],'include':_0x12c181[_0xebad('0x16')]?_[_0xebad('0x15')](_0x12c181['include'],function(_0x223bf8){return{'model':db[_0x223bf8['model']],'as':_0x223bf8['as'],'attributes':_0x223bf8[_0xebad('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x232450){logger['info'](_0xebad('0x10'),_0xb28f3);logger[_0xebad('0x18')](_0xebad('0x10'),_0xb28f3,JSON['stringify'](_0x232450));_0x2dfc2a(_0x232450);})['catch'](function(_0x564826){logger[_0xebad('0xb')](_0xebad('0x10'),_0x564826[_0xebad('0xe')],_0xb28f3);_0x15dba5(_0x56fb02[_0xebad('0xb')](0x1f4,_0x564826[_0xebad('0xe')]));});});};exports[_0xebad('0x19')]=function(_0x3970a7){var _0x42878d=this;return new Promise(function(_0x2558a6,_0x575751){return db[_0xebad('0x11')]['find']({'raw':_0x3970a7[_0xebad('0x12')]?_0x3970a7[_0xebad('0x12')][_0xebad('0x13')]===undefined?!![]:![]:!![],'where':_0x3970a7['options']?_0x3970a7[_0xebad('0x12')][_0xebad('0x1a')]||null:null,'attributes':_0x3970a7[_0xebad('0x12')]?_0x3970a7[_0xebad('0x12')][_0xebad('0x14')]||null:null,'include':_0x3970a7[_0xebad('0x12')]?_0x3970a7[_0xebad('0x12')][_0xebad('0x16')]?_[_0xebad('0x15')](_0x3970a7['options'][_0xebad('0x16')],function(_0x14109e){return{'model':db[_0x14109e[_0xebad('0x17')]],'as':_0x14109e['as'],'attributes':_0x14109e[_0xebad('0x14')],'include':_0x14109e[_0xebad('0x16')]?_[_0xebad('0x15')](_0x14109e[_0xebad('0x16')],function(_0x236428){return{'model':db[_0x236428[_0xebad('0x17')]],'as':_0x236428['as'],'attributes':_0x236428[_0xebad('0x14')],'include':_0x236428[_0xebad('0x16')]?_['map'](_0x236428[_0xebad('0x16')],function(_0x24a455){return{'model':db[_0x24a455[_0xebad('0x17')]],'as':_0x24a455['as'],'attributes':_0x24a455[_0xebad('0x14')]};}):[]};}):[]};}):[]:[]})[_0xebad('0x1b')](function(_0x5f4b88){logger[_0xebad('0x8')]('ShowZohoAccount',_0x3970a7);logger[_0xebad('0x18')](_0xebad('0x19'),_0x3970a7,JSON[_0xebad('0xa')](_0x5f4b88));_0x2558a6(_0x5f4b88);})[_0xebad('0xf')](function(_0x12aa0b){logger[_0xebad('0xb')](_0xebad('0x19'),_0x12aa0b[_0xebad('0xe')],_0x3970a7);_0x575751(_0x42878d['error'](0x1f4,_0x12aa0b[_0xebad('0xe')]));});});}; \ No newline at end of file +var _0xe022=['info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','catch','GetZohoAccount','ZohoAccount','findAll','options','where','limit','include','map','attributes','model','ShowZohoAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','then'];(function(_0x3ffda0,_0x56a0fd){var _0x425630=function(_0x4ec3af){while(--_0x4ec3af){_0x3ffda0['push'](_0x3ffda0['shift']());}};_0x425630(++_0x56a0fd);}(_0xe022,0xa3));var _0x2e02=function(_0x19b1c6,_0x49be5e){_0x19b1c6=_0x19b1c6-0x0;var _0x1e6bc6=_0xe022[_0x19b1c6];return _0x1e6bc6;};'use strict';var _=require(_0x2e02('0x0'));var util=require(_0x2e02('0x1'));var moment=require(_0x2e02('0x2'));var BPromise=require(_0x2e02('0x3'));var rs=require(_0x2e02('0x4'));var fs=require('fs');var Redis=require(_0x2e02('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e02('0x6'));var logger=require(_0x2e02('0x7'))(_0x2e02('0x8'));var config=require('../../config/environment');var jayson=require(_0x2e02('0x9'));var client=jayson[_0x2e02('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13f530,_0x2a1774,_0x1032b1){return new BPromise(function(_0x84839b,_0x10d01a){return client['request'](_0x13f530,_0x1032b1)[_0x2e02('0xb')](function(_0x516ddd){logger[_0x2e02('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x2a1774,_0x2e02('0xd'));logger[_0x2e02('0xe')](_0x2e02('0xf'),_0x2a1774,_0x2e02('0xd'),JSON[_0x2e02('0x10')](_0x516ddd));if(_0x516ddd['error']){if(_0x516ddd[_0x2e02('0x11')][_0x2e02('0x12')]===0x1f4){logger[_0x2e02('0x11')](_0x2e02('0x13'),_0x2a1774,_0x516ddd['error'][_0x2e02('0x14')]);return _0x10d01a(_0x516ddd[_0x2e02('0x11')][_0x2e02('0x14')]);}logger[_0x2e02('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x2a1774,_0x516ddd['error'][_0x2e02('0x14')]);return _0x84839b(_0x516ddd[_0x2e02('0x11')][_0x2e02('0x14')]);}else{logger[_0x2e02('0xc')](_0x2e02('0x13'),_0x2a1774,'request\x20sent');_0x84839b(_0x516ddd['result'][_0x2e02('0x14')]);}})[_0x2e02('0x15')](function(_0xd8efc5){logger[_0x2e02('0x11')](_0x2e02('0x13'),_0x2a1774,_0xd8efc5);_0x10d01a(_0xd8efc5);});});}exports[_0x2e02('0x16')]=function(_0x1188bb){var _0x1a23c2=this;return new Promise(function(_0x5697fa,_0x5da47c){return db[_0x2e02('0x17')][_0x2e02('0x18')]({'raw':_0x1188bb[_0x2e02('0x19')]?_0x1188bb[_0x2e02('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1188bb[_0x2e02('0x19')]?_0x1188bb[_0x2e02('0x19')][_0x2e02('0x1a')]||null:null,'attributes':_0x1188bb[_0x2e02('0x19')]?_0x1188bb['options']['attributes']||null:null,'limit':_0x1188bb[_0x2e02('0x19')]?_0x1188bb[_0x2e02('0x19')][_0x2e02('0x1b')]||null:null,'include':_0x1188bb[_0x2e02('0x19')]?_0x1188bb[_0x2e02('0x19')][_0x2e02('0x1c')]?_[_0x2e02('0x1d')](_0x1188bb[_0x2e02('0x19')][_0x2e02('0x1c')],function(_0x48f56b){return{'model':db[_0x48f56b['model']],'as':_0x48f56b['as'],'attributes':_0x48f56b[_0x2e02('0x1e')],'include':_0x48f56b[_0x2e02('0x1c')]?_['map'](_0x48f56b['include'],function(_0x12ebaa){return{'model':db[_0x12ebaa[_0x2e02('0x1f')]],'as':_0x12ebaa['as'],'attributes':_0x12ebaa[_0x2e02('0x1e')],'include':_0x12ebaa[_0x2e02('0x1c')]?_['map'](_0x12ebaa[_0x2e02('0x1c')],function(_0x408452){return{'model':db[_0x408452['model']],'as':_0x408452['as'],'attributes':_0x408452[_0x2e02('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2e02('0xb')](function(_0x3966fe){logger['info']('GetZohoAccount',_0x1188bb);logger[_0x2e02('0xe')](_0x2e02('0x16'),_0x1188bb,JSON[_0x2e02('0x10')](_0x3966fe));_0x5697fa(_0x3966fe);})[_0x2e02('0x15')](function(_0x2569a8){logger[_0x2e02('0x11')]('GetZohoAccount',_0x2569a8[_0x2e02('0x14')],_0x1188bb);_0x5da47c(_0x1a23c2[_0x2e02('0x11')](0x1f4,_0x2569a8[_0x2e02('0x14')]));});});};exports[_0x2e02('0x20')]=function(_0x52c853){var _0x400e6f=this;return new Promise(function(_0x2ec158,_0x5c3695){return db['ZohoAccount'][_0x2e02('0x21')]({'raw':_0x52c853['options']?_0x52c853[_0x2e02('0x19')][_0x2e02('0x22')]===undefined?!![]:![]:!![],'where':_0x52c853[_0x2e02('0x19')]?_0x52c853[_0x2e02('0x19')][_0x2e02('0x1a')]||null:null,'attributes':_0x52c853[_0x2e02('0x19')]?_0x52c853['options'][_0x2e02('0x1e')]||null:null,'include':_0x52c853[_0x2e02('0x19')]?_0x52c853[_0x2e02('0x19')][_0x2e02('0x1c')]?_[_0x2e02('0x1d')](_0x52c853['options']['include'],function(_0x2365a6){return{'model':db[_0x2365a6['model']],'as':_0x2365a6['as'],'attributes':_0x2365a6[_0x2e02('0x1e')],'include':_0x2365a6[_0x2e02('0x1c')]?_[_0x2e02('0x1d')](_0x2365a6[_0x2e02('0x1c')],function(_0xf5c42a){return{'model':db[_0xf5c42a[_0x2e02('0x1f')]],'as':_0xf5c42a['as'],'attributes':_0xf5c42a['attributes'],'include':_0xf5c42a[_0x2e02('0x1c')]?_[_0x2e02('0x1d')](_0xf5c42a[_0x2e02('0x1c')],function(_0x26d689){return{'model':db[_0x26d689[_0x2e02('0x1f')]],'as':_0x26d689['as'],'attributes':_0x26d689[_0x2e02('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x267d26){logger[_0x2e02('0xc')]('ShowZohoAccount',_0x52c853);logger[_0x2e02('0xe')]('ShowZohoAccount',_0x52c853,JSON[_0x2e02('0x10')](_0x267d26));_0x2ec158(_0x267d26);})[_0x2e02('0x15')](function(_0x41763f){logger[_0x2e02('0x11')](_0x2e02('0x20'),_0x41763f['message'],_0x52c853);_0x5c3695(_0x400e6f['error'](0x1f4,_0x41763f[_0x2e02('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 45857bf..f23daaf 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 _0x7070=['getSubjects','/:id/descriptions','post','create','/:id','update','delete','destroy','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','/:id/fields','getFields','get','/:id/subjects'];(function(_0x3a2a56,_0x277b9d){var _0x1f7417=function(_0x2b489f){while(--_0x2b489f){_0x3a2a56['push'](_0x3a2a56['shift']());}};_0x1f7417(++_0x277b9d);}(_0x7070,0x1d7));var _0x0707=function(_0x4c9c48,_0x1c15ae){_0x4c9c48=_0x4c9c48-0x0;var _0x47b9dd=_0x7070[_0x4c9c48];return _0x47b9dd;};'use strict';var multer=require('multer');var util=require(_0x0707('0x0'));var path=require('path');var timeout=require(_0x0707('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x0707('0x2'));var interaction=require(_0x0707('0x3'));var config=require(_0x0707('0x4'));var controller=require(_0x0707('0x5'));router['get']('/',auth[_0x0707('0x6')](),controller[_0x0707('0x7')]);router['get']('/:id',auth[_0x0707('0x6')](),controller['show']);router['get'](_0x0707('0x8'),auth[_0x0707('0x6')](),controller[_0x0707('0x9')]);router[_0x0707('0xa')](_0x0707('0xb'),auth[_0x0707('0x6')](),controller[_0x0707('0xc')]);router[_0x0707('0xa')](_0x0707('0xd'),auth[_0x0707('0x6')](),controller['getDescriptions']);router[_0x0707('0xe')]('/',auth['isAuthenticated'](),controller[_0x0707('0xf')]);router['put'](_0x0707('0x10'),auth[_0x0707('0x6')](),controller[_0x0707('0x11')]);router[_0x0707('0x12')](_0x0707('0x10'),auth[_0x0707('0x6')](),controller[_0x0707('0x13')]);module[_0x0707('0x14')]=router; \ No newline at end of file +var _0xc788=['/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get'];(function(_0x145157,_0x24220b){var _0x3e8ef7=function(_0x3c205c){while(--_0x3c205c){_0x145157['push'](_0x145157['shift']());}};_0x3e8ef7(++_0x24220b);}(_0xc788,0xc4));var _0x8c78=function(_0x19a7d3,_0x487155){_0x19a7d3=_0x19a7d3-0x0;var _0x569a8e=_0xc788[_0x19a7d3];return _0x569a8e;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var auth=require(_0x8c78('0x4'));var interaction=require(_0x8c78('0x5'));var config=require(_0x8c78('0x6'));var controller=require(_0x8c78('0x7'));router['get']('/',auth[_0x8c78('0x8')](),controller[_0x8c78('0x9')]);router[_0x8c78('0xa')](_0x8c78('0xb'),auth[_0x8c78('0x8')](),controller['show']);router[_0x8c78('0xa')](_0x8c78('0xc'),auth[_0x8c78('0x8')](),controller[_0x8c78('0xd')]);router[_0x8c78('0xa')](_0x8c78('0xe'),auth['isAuthenticated'](),controller[_0x8c78('0xf')]);router['get'](_0x8c78('0x10'),auth[_0x8c78('0x8')](),controller['getDescriptions']);router[_0x8c78('0x11')]('/',auth[_0x8c78('0x8')](),controller['create']);router[_0x8c78('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8c78('0x13')]);router[_0x8c78('0x14')](_0x8c78('0xb'),auth[_0x8c78('0x8')](),controller[_0x8c78('0x15')]);module[_0x8c78('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index ad2b488..f9e6425 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 _0xe92a=['nothing','ENUM','contact_lead','contact','sequelize','STRING','lead'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0xe92a,0x13f));var _0xae92=function(_0x16f7aa,_0x1f59e7){_0x16f7aa=_0x16f7aa-0x0;var _0x1ea658=_0xe92a[_0x16f7aa];return _0x1ea658;};'use strict';var Sequelize=require(_0xae92('0x0'));module['exports']={'name':{'type':Sequelize[_0xae92('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xae92('0x2'),'contact',_0xae92('0x3')),'defaultValue':_0xae92('0x2')},'moduleSearch':{'type':Sequelize[_0xae92('0x4')](_0xae92('0x5'),_0xae92('0x6'),_0xae92('0x2')),'defaultValue':_0xae92('0x5')},'description':{'type':Sequelize[_0xae92('0x1')]}}; \ No newline at end of file +var _0x3d82=['lead','sequelize','exports','STRING','nothing','contact_lead'];(function(_0x384105,_0x1fc75b){var _0x9d5641=function(_0x577a8f){while(--_0x577a8f){_0x384105['push'](_0x384105['shift']());}};_0x9d5641(++_0x1fc75b);}(_0x3d82,0x11b));var _0x23d8=function(_0x5a31a8,_0x5396f1){_0x5a31a8=_0x5a31a8-0x0;var _0x4e01e8=_0x3d82[_0x5a31a8];return _0x4e01e8;};'use strict';var Sequelize=require(_0x23d8('0x0'));module[_0x23d8('0x1')]={'name':{'type':Sequelize[_0x23d8('0x2')]},'moduleCreate':{'type':Sequelize['ENUM']('lead','contact',_0x23d8('0x3')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0x23d8('0x4'),'contact',_0x23d8('0x5')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x23d8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index ebd0e54..b45468d 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(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 6e1867e..aee65ae 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 _0xe934=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0xe934,0x117));var _0x4e93=function(_0x232eb7,_0x199b07){_0x232eb7=_0x232eb7-0x0;var _0xd7fb8=_0xe934[_0x232eb7];return _0xd7fb8;};'use strict';var _=require(_0x4e93('0x0'));var util=require(_0x4e93('0x1'));var logger=require(_0x4e93('0x2'))(_0x4e93('0x3'));var moment=require(_0x4e93('0x4'));var BPromise=require(_0x4e93('0x5'));var rp=require(_0x4e93('0x6'));var fs=require('fs');var path=require(_0x4e93('0x7'));var rimraf=require(_0x4e93('0x8'));var config=require(_0x4e93('0x9'));var attributes=require(_0x4e93('0xa'));module['exports']=function(_0x5e1319,_0x575e71){return _0x5e1319['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2a0=['util','api','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash'];(function(_0x2dab63,_0x97e2ec){var _0x5e31b5=function(_0x591d03){while(--_0x591d03){_0x2dab63['push'](_0x2dab63['shift']());}};_0x5e31b5(++_0x97e2ec);}(_0xe2a0,0x197));var _0x0e2a=function(_0x558e39,_0xbcc56c){_0x558e39=_0x558e39-0x0;var _0x2ffa0e=_0xe2a0[_0x558e39];return _0x2ffa0e;};'use strict';var _=require(_0x0e2a('0x0'));var util=require(_0x0e2a('0x1'));var logger=require('../../config/logger')(_0x0e2a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0e2a('0x3'));var fs=require('fs');var path=require(_0x0e2a('0x4'));var rimraf=require(_0x0e2a('0x5'));var config=require(_0x0e2a('0x6'));var attributes=require(_0x0e2a('0x7'));module[_0x0e2a('0x8')]=function(_0x4a1ab9,_0x594ce6){return _0x4a1ab9[_0x0e2a('0x9')](_0x0e2a('0xa'),attributes,{'tableName':_0x0e2a('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 a1181e6..4da5130 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 _0x756a=['jayson/promise','client','http','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x390976,_0xb59147){var _0x41906d=function(_0x13c4ca){while(--_0x13c4ca){_0x390976['push'](_0x390976['shift']());}};_0x41906d(++_0xb59147);}(_0x756a,0x163));var _0xa756=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x756a[_0x2a55f8];return _0x245efd;};'use strict';var _=require('lodash');var util=require(_0xa756('0x0'));var moment=require('moment');var BPromise=require(_0xa756('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa756('0x2'))['db'];var utils=require(_0xa756('0x3'));var logger=require('../../config/logger')(_0xa756('0x4'));var config=require('../../config/environment');var jayson=require(_0xa756('0x5'));var client=jayson[_0xa756('0x6')][_0xa756('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40a250,_0x4f9e76,_0x492a76){return new BPromise(function(_0x1cc3b4,_0x4951ed){return client['request'](_0x40a250,_0x492a76)['then'](function(_0x3867db){logger['info'](_0xa756('0x8'),_0x4f9e76,_0xa756('0x9'));logger[_0xa756('0xa')](_0xa756('0xb'),_0x4f9e76,_0xa756('0x9'),JSON['stringify'](_0x3867db));if(_0x3867db[_0xa756('0xc')]){if(_0x3867db[_0xa756('0xc')][_0xa756('0xd')]===0x1f4){logger['error'](_0xa756('0x8'),_0x4f9e76,_0x3867db['error']['message']);return _0x4951ed(_0x3867db[_0xa756('0xc')][_0xa756('0xe')]);}logger[_0xa756('0xc')](_0xa756('0x8'),_0x4f9e76,_0x3867db[_0xa756('0xc')][_0xa756('0xe')]);return _0x1cc3b4(_0x3867db[_0xa756('0xc')][_0xa756('0xe')]);}else{logger[_0xa756('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x4f9e76,_0xa756('0x9'));_0x1cc3b4(_0x3867db[_0xa756('0x10')][_0xa756('0xe')]);}})[_0xa756('0x11')](function(_0x2c8b95){logger[_0xa756('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x4f9e76,_0x2c8b95);_0x4951ed(_0x2c8b95);});});} \ No newline at end of file +var _0xff78=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x363076,_0x12fb81){var _0x5c4b25=function(_0x598dae){while(--_0x598dae){_0x363076['push'](_0x363076['shift']());}};_0x5c4b25(++_0x12fb81);}(_0xff78,0x138));var _0x8ff7=function(_0x34b821,_0x504e55){_0x34b821=_0x34b821-0x0;var _0x5e00a0=_0xff78[_0x34b821];return _0x5e00a0;};'use strict';var _=require(_0x8ff7('0x0'));var util=require('util');var moment=require(_0x8ff7('0x1'));var BPromise=require('bluebird');var rs=require(_0x8ff7('0x2'));var fs=require('fs');var Redis=require(_0x8ff7('0x3'));var db=require(_0x8ff7('0x4'))['db'];var utils=require(_0x8ff7('0x5'));var logger=require(_0x8ff7('0x6'))(_0x8ff7('0x7'));var config=require(_0x8ff7('0x8'));var jayson=require(_0x8ff7('0x9'));var client=jayson[_0x8ff7('0xa')][_0x8ff7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18008,_0x179f5a,_0x28ba59){return new BPromise(function(_0x3b084e,_0x5119de){return client[_0x8ff7('0xc')](_0x18008,_0x28ba59)[_0x8ff7('0xd')](function(_0x3bd7d5){logger[_0x8ff7('0xe')](_0x8ff7('0xf'),_0x179f5a,_0x8ff7('0x10'));logger[_0x8ff7('0x11')](_0x8ff7('0x12'),_0x179f5a,_0x8ff7('0x10'),JSON[_0x8ff7('0x13')](_0x3bd7d5));if(_0x3bd7d5[_0x8ff7('0x14')]){if(_0x3bd7d5[_0x8ff7('0x14')]['code']===0x1f4){logger[_0x8ff7('0x14')](_0x8ff7('0xf'),_0x179f5a,_0x3bd7d5[_0x8ff7('0x14')][_0x8ff7('0x15')]);return _0x5119de(_0x3bd7d5['error'][_0x8ff7('0x15')]);}logger[_0x8ff7('0x14')](_0x8ff7('0xf'),_0x179f5a,_0x3bd7d5['error'][_0x8ff7('0x15')]);return _0x3b084e(_0x3bd7d5['error'][_0x8ff7('0x15')]);}else{logger[_0x8ff7('0xe')](_0x8ff7('0xf'),_0x179f5a,_0x8ff7('0x10'));_0x3b084e(_0x3bd7d5[_0x8ff7('0x16')]['message']);}})[_0x8ff7('0x17')](function(_0x2a8acf){logger[_0x8ff7('0x14')](_0x8ff7('0xf'),_0x179f5a,_0x2a8acf);_0x5119de(_0x2a8acf);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 5edc1ef..f1250ac 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 _0xe5af=['post','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','show'];(function(_0x3b0fdb,_0x23a049){var _0x220a59=function(_0x1b9024){while(--_0x1b9024){_0x3b0fdb['push'](_0x3b0fdb['shift']());}};_0x220a59(++_0x23a049);}(_0xe5af,0x9c));var _0xfe5a=function(_0x558f99,_0x3ac63c){_0x558f99=_0x558f99-0x0;var _0x134ebc=_0xe5af[_0x558f99];return _0x134ebc;};'use strict';var multer=require('multer');var util=require(_0xfe5a('0x0'));var path=require(_0xfe5a('0x1'));var timeout=require('connect-timeout');var express=require(_0xfe5a('0x2'));var router=express[_0xfe5a('0x3')]();var auth=require(_0xfe5a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfe5a('0x5'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0xfe5a('0x6')](),controller[_0xfe5a('0x7')]);router['get']('/:id',auth[_0xfe5a('0x6')](),controller[_0xfe5a('0x8')]);router[_0xfe5a('0x9')]('/',auth[_0xfe5a('0x6')](),controller['create']);router[_0xfe5a('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xfe5a('0xb')]);router[_0xfe5a('0xc')]('/:id',auth[_0xfe5a('0x6')](),controller[_0xfe5a('0xd')]);module[_0xfe5a('0xe')]=router; \ No newline at end of file +var _0x2da6=['isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0xdeca4e,_0x2afd2b){var _0x54aa63=function(_0x4d127d){while(--_0x4d127d){_0xdeca4e['push'](_0xdeca4e['shift']());}};_0x54aa63(++_0x2afd2b);}(_0x2da6,0x1dd));var _0x62da=function(_0x50f129,_0x3d17b2){_0x50f129=_0x50f129-0x0;var _0x6cfdb7=_0x2da6[_0x50f129];return _0x6cfdb7;};'use strict';var multer=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var path=require(_0x62da('0x2'));var timeout=require(_0x62da('0x3'));var express=require(_0x62da('0x4'));var router=express[_0x62da('0x5')]();var auth=require(_0x62da('0x6'));var interaction=require(_0x62da('0x7'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0x62da('0x8')]('/',auth[_0x62da('0x9')](),controller[_0x62da('0xa')]);router[_0x62da('0x8')](_0x62da('0xb'),auth[_0x62da('0x9')](),controller[_0x62da('0xc')]);router[_0x62da('0xd')]('/',auth[_0x62da('0x9')](),controller['create']);router[_0x62da('0xe')](_0x62da('0xb'),auth[_0x62da('0x9')](),controller[_0x62da('0xf')]);router['delete'](_0x62da('0xb'),auth[_0x62da('0x9')](),controller[_0x62da('0x10')]);module[_0x62da('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a78244f..b70aef0 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 _0x2a56=['exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x39c309,_0x207f40){var _0x35e23b=function(_0x105282){while(--_0x105282){_0x39c309['push'](_0x39c309['shift']());}};_0x35e23b(++_0x207f40);}(_0x2a56,0xaf));var _0x62a5=function(_0x14ebb0,_0x2fe8a5){_0x14ebb0=_0x14ebb0-0x0;var _0xe14915=_0x2a56[_0x14ebb0];return _0xe14915;};'use strict';var Sequelize=require('sequelize');module[_0x62a5('0x0')]={'type':{'type':Sequelize['ENUM'](_0x62a5('0x1'),_0x62a5('0x2'),_0x62a5('0x3'),_0x62a5('0x4')),'defaultValue':_0x62a5('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x62a5('0x5')]},'keyType':{'type':Sequelize[_0x62a5('0x6')](_0x62a5('0x1'),_0x62a5('0x2'),_0x62a5('0x3'))},'keyContent':{'type':Sequelize[_0x62a5('0x5')]},'idField':{'type':Sequelize[_0x62a5('0x5')]},'nameField':{'type':Sequelize[_0x62a5('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x62a5('0x5')]}}; \ No newline at end of file +var _0x6dac=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x2792d6,_0x2f264e){var _0x4b5158=function(_0x5530ca){while(--_0x5530ca){_0x2792d6['push'](_0x2792d6['shift']());}};_0x4b5158(++_0x2f264e);}(_0x6dac,0x16e));var _0xc6da=function(_0x6f3bc9,_0x3ff8f7){_0x6f3bc9=_0x6f3bc9-0x0;var _0xb2674e=_0x6dac[_0x6f3bc9];return _0xb2674e;};'use strict';var Sequelize=require(_0xc6da('0x0'));module[_0xc6da('0x1')]={'type':{'type':Sequelize[_0xc6da('0x2')](_0xc6da('0x3'),_0xc6da('0x4'),_0xc6da('0x5'),_0xc6da('0x6')),'defaultValue':_0xc6da('0x3')},'content':{'type':Sequelize[_0xc6da('0x7')]},'key':{'type':Sequelize[_0xc6da('0x7')]},'keyType':{'type':Sequelize[_0xc6da('0x2')](_0xc6da('0x3'),_0xc6da('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xc6da('0x7')]},'idField':{'type':Sequelize[_0xc6da('0x7')]},'nameField':{'type':Sequelize[_0xc6da('0x7')]},'customField':{'type':Sequelize[_0xc6da('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc6da('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 8df29c4..98ed398 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 _0xee0a=['filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','sort','pick','merge','where','options','then','includeAll','findAll','rows','params','include','find','catch','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../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','update','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys'];(function(_0x580a21,_0x27af24){var _0x46ea56=function(_0x47c944){while(--_0x47c944){_0x580a21['push'](_0x580a21['shift']());}};_0x46ea56(++_0x27af24);}(_0xee0a,0xa3));var _0xaee0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee0a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xaee0('0x0'));var emlformat=require(_0xaee0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xaee0('0x2'));var jsonpatch=require(_0xaee0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaee0('0x4'));var util=require(_0xaee0('0x5'));var path=require('path');var sox=require(_0xaee0('0x6'));var csv=require(_0xaee0('0x7'));var ejs=require(_0xaee0('0x8'));var fs=require('fs');var _=require(_0xaee0('0x9'));var squel=require(_0xaee0('0xa'));var crypto=require(_0xaee0('0xb'));var jsforce=require(_0xaee0('0xc'));var deskjs=require(_0xaee0('0xd'));var toCsv=require(_0xaee0('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaee0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xaee0('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaee0('0x10'))(_0xaee0('0x11'));var utils=require(_0xaee0('0x12'));var config=require(_0xaee0('0x13'));var licenseUtil=require(_0xaee0('0x14'));var db=require(_0xaee0('0x15'))['db'];function respondWithStatusCode(_0x4636ca,_0x25af07){_0x25af07=_0x25af07||0xcc;return function(_0x279c68){if(_0x279c68){return _0x4636ca[_0xaee0('0x16')](_0x25af07);}return _0x4636ca['status'](_0x25af07)[_0xaee0('0x17')]();};}function respondWithResult(_0x1070b4,_0x3764ab){_0x3764ab=_0x3764ab||0xc8;return function(_0x3252ac){if(_0x3252ac){return _0x1070b4[_0xaee0('0x18')](_0x3764ab)[_0xaee0('0x19')](_0x3252ac);}};}function respondWithFilteredResult(_0x72556d,_0x35aff7){return function(_0x1b2e1f){if(_0x1b2e1f){var _0x39abd9=_0x1b2e1f[_0xaee0('0x1a')],_0x49ad6a=_0x35aff7[_0xaee0('0x1b')],_0x41995a=_0x35aff7[_0xaee0('0x1b')]+_0x35aff7[_0xaee0('0x1c')],_0x2518fb;if(_0x41995a>=_0x39abd9){_0x41995a=_0x39abd9;_0x2518fb=0xc8;}else{_0x2518fb=0xce;}_0x72556d[_0xaee0('0x18')](_0x2518fb);return _0x72556d[_0xaee0('0x1d')](_0xaee0('0x1e'),_0x49ad6a+'-'+_0x41995a+'/'+_0x39abd9)[_0xaee0('0x19')](_0x1b2e1f);}return null;};}function patchUpdates(_0x451e2c){return function(_0x367a2a){try{jsonpatch[_0xaee0('0x1f')](_0x367a2a,_0x451e2c,!![]);}catch(_0x694b0b){return BPromise['reject'](_0x694b0b);}return _0x367a2a['save']();};}function saveUpdates(_0x54e39c,_0x3a9c42){return function(_0x4f8fc2){if(_0x4f8fc2){return _0x4f8fc2[_0xaee0('0x20')](_0x54e39c)['then'](function(_0x30eb98){return _0x30eb98;});}return null;};}function removeEntity(_0x621973,_0x1e99ac){return function(_0x767a13){if(_0x767a13){return _0x767a13[_0xaee0('0x21')]()['then'](function(){_0x621973['status'](0xcc)[_0xaee0('0x17')]();});}};}function handleEntityNotFound(_0x51ad0e,_0x3d488e){return function(_0x704479){if(!_0x704479){_0x51ad0e[_0xaee0('0x16')](0x194);}return _0x704479;};}function handleError(_0x269943,_0x48ef9d){_0x48ef9d=_0x48ef9d||0x1f4;return function(_0x39b57a){logger[_0xaee0('0x22')](_0x39b57a[_0xaee0('0x23')]);if(_0x39b57a[_0xaee0('0x24')]){delete _0x39b57a[_0xaee0('0x24')];}_0x269943[_0xaee0('0x18')](_0x48ef9d)[_0xaee0('0x25')](_0x39b57a);};}exports[_0xaee0('0x26')]=function(_0x2d7030,_0x39c7d6){var _0x281219={},_0x209868={},_0x2b9f08={'count':0x0,'rows':[]};var _0x1df682=_[_0xaee0('0x27')](db[_0xaee0('0x28')][_0xaee0('0x29')],function(_0x20d1fc){return{'name':_0x20d1fc[_0xaee0('0x2a')],'type':_0x20d1fc[_0xaee0('0x2b')][_0xaee0('0x2c')]};});_0x209868['model']=_[_0xaee0('0x27')](_0x1df682,_0xaee0('0x24'));_0x209868[_0xaee0('0x2d')]=_[_0xaee0('0x2e')](_0x2d7030['query']);_0x209868[_0xaee0('0x2f')]=_[_0xaee0('0x30')](_0x209868['model'],_0x209868[_0xaee0('0x2d')]);_0x281219['attributes']=_[_0xaee0('0x30')](_0x209868['model'],qs[_0xaee0('0x31')](_0x2d7030[_0xaee0('0x2d')][_0xaee0('0x31')]));_0x281219[_0xaee0('0x32')]=_0x281219[_0xaee0('0x32')][_0xaee0('0x33')]?_0x281219[_0xaee0('0x32')]:_0x209868[_0xaee0('0x34')];if(!_0x2d7030['query'][_0xaee0('0x35')](_0xaee0('0x36'))){_0x281219[_0xaee0('0x1c')]=qs[_0xaee0('0x1c')](_0x2d7030[_0xaee0('0x2d')]['limit']);_0x281219['offset']=qs['offset'](_0x2d7030[_0xaee0('0x2d')]['offset']);}_0x281219['order']=qs[_0xaee0('0x37')](_0x2d7030[_0xaee0('0x2d')][_0xaee0('0x37')]);_0x281219['where']=qs[_0xaee0('0x2f')](_[_0xaee0('0x38')](_0x2d7030['query'],_0x209868[_0xaee0('0x2f')]),_0x1df682);if(_0x2d7030['query']['filter']){_0x281219['where']=_[_0xaee0('0x39')](_0x281219[_0xaee0('0x3a')],{'$or':_[_0xaee0('0x27')](_0x1df682,function(_0x368da3){if(_0x368da3['type']!=='VIRTUAL'){var _0x39a059={};_0x39a059[_0x368da3[_0xaee0('0x24')]]={'$like':'%'+_0x2d7030[_0xaee0('0x2d')]['filter']+'%'};return _0x39a059;}})});}_0x281219=_[_0xaee0('0x39')]({},_0x281219,_0x2d7030[_0xaee0('0x3b')]);var _0x21b47f={'where':_0x281219[_0xaee0('0x3a')]};return db[_0xaee0('0x28')][_0xaee0('0x1a')](_0x21b47f)[_0xaee0('0x3c')](function(_0x167b7e){_0x2b9f08[_0xaee0('0x1a')]=_0x167b7e;if(_0x2d7030[_0xaee0('0x2d')][_0xaee0('0x3d')]){_0x281219['include']=[{'all':!![]}];}return db[_0xaee0('0x28')][_0xaee0('0x3e')](_0x281219);})[_0xaee0('0x3c')](function(_0x5216ab){_0x2b9f08[_0xaee0('0x3f')]=_0x5216ab;return _0x2b9f08;})[_0xaee0('0x3c')](respondWithFilteredResult(_0x39c7d6,_0x281219))['catch'](handleError(_0x39c7d6,null));};exports['show']=function(_0x26837b,_0xe06677){var _0x590c0d={'raw':!![],'where':{'id':_0x26837b[_0xaee0('0x40')]['id']}},_0x4f7851={};_0x4f7851['model']=_[_0xaee0('0x2e')](db[_0xaee0('0x28')][_0xaee0('0x29')]);_0x4f7851[_0xaee0('0x2d')]=_[_0xaee0('0x2e')](_0x26837b[_0xaee0('0x2d')]);_0x4f7851['filters']=_[_0xaee0('0x30')](_0x4f7851[_0xaee0('0x34')],_0x4f7851[_0xaee0('0x2d')]);_0x590c0d[_0xaee0('0x32')]=_['intersection'](_0x4f7851[_0xaee0('0x34')],qs[_0xaee0('0x31')](_0x26837b[_0xaee0('0x2d')]['fields']));_0x590c0d[_0xaee0('0x32')]=_0x590c0d['attributes']['length']?_0x590c0d[_0xaee0('0x32')]:_0x4f7851[_0xaee0('0x34')];if(_0x26837b[_0xaee0('0x2d')]['includeAll']){_0x590c0d[_0xaee0('0x41')]=[{'all':!![]}];}_0x590c0d=_[_0xaee0('0x39')]({},_0x590c0d,_0x26837b['options']);return db[_0xaee0('0x28')][_0xaee0('0x42')](_0x590c0d)['then'](handleEntityNotFound(_0xe06677,null))[_0xaee0('0x3c')](respondWithResult(_0xe06677,null))[_0xaee0('0x43')](handleError(_0xe06677,null));};exports[_0xaee0('0x44')]=function(_0x5129da,_0x4429d7){return db[_0xaee0('0x28')][_0xaee0('0x44')](_0x5129da[_0xaee0('0x45')],{})[_0xaee0('0x3c')](respondWithResult(_0x4429d7,0xc9))['catch'](handleError(_0x4429d7,null));};exports[_0xaee0('0x20')]=function(_0x40d3b0,_0x722520){if(_0x40d3b0[_0xaee0('0x45')]['id']){delete _0x40d3b0[_0xaee0('0x45')]['id'];}return db[_0xaee0('0x28')][_0xaee0('0x42')]({'where':{'id':_0x40d3b0[_0xaee0('0x40')]['id']}})[_0xaee0('0x3c')](handleEntityNotFound(_0x722520,null))[_0xaee0('0x3c')](saveUpdates(_0x40d3b0[_0xaee0('0x45')],null))[_0xaee0('0x3c')](respondWithResult(_0x722520,null))[_0xaee0('0x43')](handleError(_0x722520,null));};exports[_0xaee0('0x21')]=function(_0x31d266,_0x349836){return db[_0xaee0('0x28')][_0xaee0('0x42')]({'where':{'id':_0x31d266['params']['id']}})[_0xaee0('0x3c')](handleEntityNotFound(_0x349836,null))['then'](removeEntity(_0x349836,null))[_0xaee0('0x43')](handleError(_0x349836,null));}; \ No newline at end of file +var _0xb5b8=['where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb5b8,0xa2));var _0x8b5b=function(_0x313140,_0x1f0d97){_0x313140=_0x313140-0x0;var _0x5522ef=_0xb5b8[_0x313140];return _0x5522ef;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b5b('0x0'));var rimraf=require(_0x8b5b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b5b('0x2'));var rp=require(_0x8b5b('0x3'));var moment=require(_0x8b5b('0x4'));var BPromise=require(_0x8b5b('0x5'));var Mustache=require(_0x8b5b('0x6'));var util=require('util');var path=require(_0x8b5b('0x7'));var sox=require(_0x8b5b('0x8'));var csv=require('to-csv');var ejs=require(_0x8b5b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b5b('0xa'));var crypto=require(_0x8b5b('0xb'));var jsforce=require(_0x8b5b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8b5b('0xd'));var querystring=require(_0x8b5b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b5b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8b5b('0x10'));var hardwareService=require(_0x8b5b('0x11'));var logger=require(_0x8b5b('0x12'))('api');var utils=require(_0x8b5b('0x13'));var config=require(_0x8b5b('0x14'));var licenseUtil=require(_0x8b5b('0x15'));var db=require(_0x8b5b('0x16'))['db'];function respondWithStatusCode(_0x14b0ad,_0x537bf6){_0x537bf6=_0x537bf6||0xcc;return function(_0x2f5b9c){if(_0x2f5b9c){return _0x14b0ad[_0x8b5b('0x17')](_0x537bf6);}return _0x14b0ad[_0x8b5b('0x18')](_0x537bf6)[_0x8b5b('0x19')]();};}function respondWithResult(_0x4796d1,_0x19da91){_0x19da91=_0x19da91||0xc8;return function(_0x2d35cf){if(_0x2d35cf){return _0x4796d1[_0x8b5b('0x18')](_0x19da91)[_0x8b5b('0x1a')](_0x2d35cf);}};}function respondWithFilteredResult(_0x5d7dbc,_0x3f1014){return function(_0x3718f2){if(_0x3718f2){var _0x154df4=_0x3718f2[_0x8b5b('0x1b')],_0x14c313=_0x3f1014[_0x8b5b('0x1c')],_0x4b5b88=_0x3f1014['offset']+_0x3f1014[_0x8b5b('0x1d')],_0x1737a7;if(_0x4b5b88>=_0x154df4){_0x4b5b88=_0x154df4;_0x1737a7=0xc8;}else{_0x1737a7=0xce;}_0x5d7dbc[_0x8b5b('0x18')](_0x1737a7);return _0x5d7dbc[_0x8b5b('0x1e')]('Content-Range',_0x14c313+'-'+_0x4b5b88+'/'+_0x154df4)[_0x8b5b('0x1a')](_0x3718f2);}return null;};}function patchUpdates(_0x3796c6){return function(_0x56e909){try{jsonpatch[_0x8b5b('0x1f')](_0x56e909,_0x3796c6,!![]);}catch(_0xfbb73a){return BPromise['reject'](_0xfbb73a);}return _0x56e909[_0x8b5b('0x20')]();};}function saveUpdates(_0xf3e337,_0x30531c){return function(_0x5b62b3){if(_0x5b62b3){return _0x5b62b3[_0x8b5b('0x21')](_0xf3e337)[_0x8b5b('0x22')](function(_0xb850b0){return _0xb850b0;});}return null;};}function removeEntity(_0x3c6a79,_0x1b8549){return function(_0x320209){if(_0x320209){return _0x320209[_0x8b5b('0x23')]()['then'](function(){_0x3c6a79[_0x8b5b('0x18')](0xcc)[_0x8b5b('0x19')]();});}};}function handleEntityNotFound(_0x508a28,_0x1c0645){return function(_0x23e016){if(!_0x23e016){_0x508a28[_0x8b5b('0x17')](0x194);}return _0x23e016;};}function handleError(_0xb381c8,_0x1f21ad){_0x1f21ad=_0x1f21ad||0x1f4;return function(_0x792dc9){logger[_0x8b5b('0x24')](_0x792dc9[_0x8b5b('0x25')]);if(_0x792dc9[_0x8b5b('0x26')]){delete _0x792dc9[_0x8b5b('0x26')];}_0xb381c8[_0x8b5b('0x18')](_0x1f21ad)['send'](_0x792dc9);};}exports[_0x8b5b('0x27')]=function(_0x479454,_0x37b3e4){var _0x1e1d02={},_0x5542e6={},_0x3a636c={'count':0x0,'rows':[]};var _0x3a4506=_[_0x8b5b('0x28')](db[_0x8b5b('0x29')][_0x8b5b('0x2a')],function(_0x233adb){return{'name':_0x233adb[_0x8b5b('0x2b')],'type':_0x233adb[_0x8b5b('0x2c')]['key']};});_0x5542e6[_0x8b5b('0x2d')]=_[_0x8b5b('0x28')](_0x3a4506,_0x8b5b('0x26'));_0x5542e6['query']=_[_0x8b5b('0x2e')](_0x479454[_0x8b5b('0x2f')]);_0x5542e6[_0x8b5b('0x30')]=_['intersection'](_0x5542e6[_0x8b5b('0x2d')],_0x5542e6[_0x8b5b('0x2f')]);_0x1e1d02[_0x8b5b('0x31')]=_[_0x8b5b('0x32')](_0x5542e6[_0x8b5b('0x2d')],qs[_0x8b5b('0x33')](_0x479454['query'][_0x8b5b('0x33')]));_0x1e1d02[_0x8b5b('0x31')]=_0x1e1d02[_0x8b5b('0x31')][_0x8b5b('0x34')]?_0x1e1d02[_0x8b5b('0x31')]:_0x5542e6[_0x8b5b('0x2d')];if(!_0x479454['query'][_0x8b5b('0x35')](_0x8b5b('0x36'))){_0x1e1d02['limit']=qs[_0x8b5b('0x1d')](_0x479454[_0x8b5b('0x2f')][_0x8b5b('0x1d')]);_0x1e1d02[_0x8b5b('0x1c')]=qs['offset'](_0x479454[_0x8b5b('0x2f')][_0x8b5b('0x1c')]);}_0x1e1d02[_0x8b5b('0x37')]=qs[_0x8b5b('0x38')](_0x479454[_0x8b5b('0x2f')][_0x8b5b('0x38')]);_0x1e1d02[_0x8b5b('0x39')]=qs['filters'](_[_0x8b5b('0x3a')](_0x479454[_0x8b5b('0x2f')],_0x5542e6['filters']),_0x3a4506);if(_0x479454[_0x8b5b('0x2f')][_0x8b5b('0x3b')]){_0x1e1d02[_0x8b5b('0x39')]=_[_0x8b5b('0x3c')](_0x1e1d02[_0x8b5b('0x39')],{'$or':_[_0x8b5b('0x28')](_0x3a4506,function(_0x5aaeda){if(_0x5aaeda['type']!==_0x8b5b('0x3d')){var _0x239638={};_0x239638[_0x5aaeda[_0x8b5b('0x26')]]={'$like':'%'+_0x479454['query']['filter']+'%'};return _0x239638;}})});}_0x1e1d02=_[_0x8b5b('0x3c')]({},_0x1e1d02,_0x479454['options']);var _0x51332b={'where':_0x1e1d02[_0x8b5b('0x39')]};return db[_0x8b5b('0x29')][_0x8b5b('0x1b')](_0x51332b)['then'](function(_0x5e7a34){_0x3a636c[_0x8b5b('0x1b')]=_0x5e7a34;if(_0x479454[_0x8b5b('0x2f')][_0x8b5b('0x3e')]){_0x1e1d02[_0x8b5b('0x3f')]=[{'all':!![]}];}return db['ZohoField'][_0x8b5b('0x40')](_0x1e1d02);})[_0x8b5b('0x22')](function(_0x180665){_0x3a636c[_0x8b5b('0x41')]=_0x180665;return _0x3a636c;})['then'](respondWithFilteredResult(_0x37b3e4,_0x1e1d02))[_0x8b5b('0x42')](handleError(_0x37b3e4,null));};exports[_0x8b5b('0x43')]=function(_0x3695de,_0x308949){var _0x1e1965={'raw':!![],'where':{'id':_0x3695de[_0x8b5b('0x44')]['id']}},_0x828148={};_0x828148[_0x8b5b('0x2d')]=_['keys'](db[_0x8b5b('0x29')][_0x8b5b('0x2a')]);_0x828148['query']=_[_0x8b5b('0x2e')](_0x3695de[_0x8b5b('0x2f')]);_0x828148[_0x8b5b('0x30')]=_[_0x8b5b('0x32')](_0x828148[_0x8b5b('0x2d')],_0x828148[_0x8b5b('0x2f')]);_0x1e1965[_0x8b5b('0x31')]=_[_0x8b5b('0x32')](_0x828148['model'],qs[_0x8b5b('0x33')](_0x3695de['query'][_0x8b5b('0x33')]));_0x1e1965[_0x8b5b('0x31')]=_0x1e1965[_0x8b5b('0x31')]['length']?_0x1e1965['attributes']:_0x828148[_0x8b5b('0x2d')];if(_0x3695de[_0x8b5b('0x2f')][_0x8b5b('0x3e')]){_0x1e1965[_0x8b5b('0x3f')]=[{'all':!![]}];}_0x1e1965=_[_0x8b5b('0x3c')]({},_0x1e1965,_0x3695de[_0x8b5b('0x45')]);return db[_0x8b5b('0x29')][_0x8b5b('0x46')](_0x1e1965)['then'](handleEntityNotFound(_0x308949,null))[_0x8b5b('0x22')](respondWithResult(_0x308949,null))[_0x8b5b('0x42')](handleError(_0x308949,null));};exports[_0x8b5b('0x47')]=function(_0x172f98,_0x48523b){return db[_0x8b5b('0x29')][_0x8b5b('0x47')](_0x172f98[_0x8b5b('0x48')],{})[_0x8b5b('0x22')](respondWithResult(_0x48523b,0xc9))[_0x8b5b('0x42')](handleError(_0x48523b,null));};exports[_0x8b5b('0x21')]=function(_0x5e414a,_0x2f9edb){if(_0x5e414a[_0x8b5b('0x48')]['id']){delete _0x5e414a[_0x8b5b('0x48')]['id'];}return db[_0x8b5b('0x29')]['find']({'where':{'id':_0x5e414a[_0x8b5b('0x44')]['id']}})['then'](handleEntityNotFound(_0x2f9edb,null))[_0x8b5b('0x22')](saveUpdates(_0x5e414a[_0x8b5b('0x48')],null))[_0x8b5b('0x22')](respondWithResult(_0x2f9edb,null))['catch'](handleError(_0x2f9edb,null));};exports['destroy']=function(_0x40ce92,_0x44614c){return db[_0x8b5b('0x29')][_0x8b5b('0x46')]({'where':{'id':_0x40ce92['params']['id']}})['then'](handleEntityNotFound(_0x44614c,null))[_0x8b5b('0x22')](removeEntity(_0x44614c,null))[_0x8b5b('0x42')](handleError(_0x44614c,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 0d4bacb..996cbcb 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 _0xcc57=['ZohoField','int_zoho_fields','idField','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define'];(function(_0x5b64a1,_0x2ec810){var _0x4b6f55=function(_0x44dd84){while(--_0x44dd84){_0x5b64a1['push'](_0x5b64a1['shift']());}};_0x4b6f55(++_0x2ec810);}(_0xcc57,0xd3));var _0x7cc5=function(_0x21946b,_0x165c02){_0x21946b=_0x21946b-0x0;var _0xa7f04=_0xcc57[_0x21946b];return _0xa7f04;};'use strict';var _=require('lodash');var util=require(_0x7cc5('0x0'));var logger=require(_0x7cc5('0x1'))(_0x7cc5('0x2'));var moment=require(_0x7cc5('0x3'));var BPromise=require('bluebird');var rp=require(_0x7cc5('0x4'));var fs=require('fs');var path=require(_0x7cc5('0x5'));var rimraf=require(_0x7cc5('0x6'));var config=require(_0x7cc5('0x7'));var attributes=require(_0x7cc5('0x8'));module['exports']=function(_0xd0c458,_0xeb94f7){return _0xd0c458[_0x7cc5('0x9')](_0x7cc5('0xa'),attributes,{'tableName':_0x7cc5('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x7cc5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3895=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3895,0x96));var _0x5389=function(_0x178aeb,_0x3dbd8e){_0x178aeb=_0x178aeb-0x0;var _0x56d2b8=_0x3895[_0x178aeb];return _0x56d2b8;};'use strict';var _=require(_0x5389('0x0'));var util=require(_0x5389('0x1'));var logger=require(_0x5389('0x2'))(_0x5389('0x3'));var moment=require(_0x5389('0x4'));var BPromise=require(_0x5389('0x5'));var rp=require(_0x5389('0x6'));var fs=require('fs');var path=require(_0x5389('0x7'));var rimraf=require(_0x5389('0x8'));var config=require(_0x5389('0x9'));var attributes=require(_0x5389('0xa'));module[_0x5389('0xb')]=function(_0x230f3a,_0x380a02){return _0x230f3a[_0x5389('0xc')](_0x5389('0xd'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x5389('0xe'),'fields':[_0x5389('0xf'),_0x5389('0x10')],'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 e077374..543b438 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 _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x386213,_0x308bfc){var _0x4a0cc7=function(_0x491962){while(--_0x491962){_0x386213['push'](_0x386213['shift']());}};_0x4a0cc7(++_0x308bfc);}(_0x81bd,0x7c));var _0xd81b=function(_0x47d56f,_0x4115dc){_0x47d56f=_0x47d56f-0x0;var _0x4c66a1=_0x81bd[_0x47d56f];return _0x4c66a1;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('ZohoField,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('ZohoField,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});} \ 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','ZohoField,\x20%s,\x20%s','message','catch','util'];(function(_0x7ab42b,_0x310027){var _0x16787c=function(_0x5643cf){while(--_0x5643cf){_0x7ab42b['push'](_0x7ab42b['shift']());}};_0x16787c(++_0x310027);}(_0xedd9,0xfc));var _0x9edd=function(_0x378425,_0x168b59){_0x378425=_0x378425-0x0;var _0x3ea212=_0xedd9[_0x378425];return _0x3ea212;};'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')]('ZohoField,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('ZohoField,\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/integration/index.js b/server/api/integration/index.js index f4d9c84..6396572 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 _0x0529=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0x0529,0xb6));var _0x9052=function(_0x4a6986,_0xfb44ce){_0x4a6986=_0x4a6986-0x0;var _0x11dc20=_0x0529[_0x4a6986];return _0x11dc20;};'use strict';var multer=require('multer');var util=require(_0x9052('0x0'));var path=require('path');var timeout=require(_0x9052('0x1'));var express=require(_0x9052('0x2'));var router=express['Router']();var auth=require(_0x9052('0x3'));var interaction=require(_0x9052('0x4'));var config=require(_0x9052('0x5'));module[_0x9052('0x6')]=router; \ No newline at end of file +var _0xd79c=['../../config/environment','exports','util','path','connect-timeout','express','Router'];(function(_0x1c2903,_0x265dac){var _0x21157a=function(_0x3ad5b4){while(--_0x3ad5b4){_0x1c2903['push'](_0x1c2903['shift']());}};_0x21157a(++_0x265dac);}(_0xd79c,0xfe));var _0xcd79=function(_0xb41ba2,_0x22d68d){_0xb41ba2=_0xb41ba2-0x0;var _0x251009=_0xd79c[_0xb41ba2];return _0x251009;};'use strict';var multer=require('multer');var util=require(_0xcd79('0x0'));var path=require(_0xcd79('0x1'));var timeout=require(_0xcd79('0x2'));var express=require(_0xcd79('0x3'));var router=express[_0xcd79('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcd79('0x5'));module[_0xcd79('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 0a6d8f5..e5294e2 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 _0x48d1=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','exports'];(function(_0x2ced73,_0x3ec05c){var _0x316e99=function(_0x422dae){while(--_0x422dae){_0x2ced73['push'](_0x2ced73['shift']());}};_0x316e99(++_0x3ec05c);}(_0x48d1,0x187));var _0x148d=function(_0x8014ea,_0x133292){_0x8014ea=_0x8014ea-0x0;var _0x26f9f8=_0x48d1[_0x8014ea];return _0x26f9f8;};'use strict';var Sequelize=require('sequelize');module[_0x148d('0x0')]={'name':{'type':Sequelize[_0x148d('0x1')],'allowNull':![],'unique':_0x148d('0x2')},'version':{'type':Sequelize[_0x148d('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x148d('0x1')],'defaultValue':_0x148d('0x3')},'filename':{'type':Sequelize[_0x148d('0x1')]},'path':{'type':Sequelize[_0x148d('0x1')]},'type':{'type':Sequelize[_0x148d('0x1')]},'size':{'type':Sequelize[_0x148d('0x4')]},'active':{'type':Sequelize[_0x148d('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x148d('0x1')]},'logo':{'type':Sequelize[_0x148d('0x1')]},'state':{'type':Sequelize[_0x148d('0x1')],'unique':_0x148d('0x6')},'description':{'type':Sequelize[_0x148d('0x1')]},'title':{'type':Sequelize[_0x148d('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x148d('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x4655=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','state'];(function(_0x20522a,_0x11bb0){var _0x3105e0=function(_0x500ee0){while(--_0x500ee0){_0x20522a['push'](_0x20522a['shift']());}};_0x3105e0(++_0x11bb0);}(_0x4655,0xd2));var _0x5465=function(_0x371194,_0x19b300){_0x371194=_0x371194-0x0;var _0x2bf219=_0x4655[_0x371194];return _0x2bf219;};'use strict';var Sequelize=require(_0x5465('0x0'));module[_0x5465('0x1')]={'name':{'type':Sequelize[_0x5465('0x2')],'allowNull':![],'unique':_0x5465('0x3')},'version':{'type':Sequelize[_0x5465('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0x5465('0x4')},'filename':{'type':Sequelize[_0x5465('0x2')]},'path':{'type':Sequelize[_0x5465('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x5465('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x5465('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x5465('0x2')],'unique':_0x5465('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5465('0x2')]},'link':{'type':Sequelize[_0x5465('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 1b1093f..34c2174 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 _0x4034=['includeAll','include','findAll','rows','show','params','keys','length','merge','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','set','apply','reject','update','destroy','then','end','sendStatus','error','stack','name','Integration','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','type','VIRTUAL','filter','options','count'];(function(_0x3524f5,_0x3577d0){var _0x334fc5=function(_0x3b6f6e){while(--_0x3b6f6e){_0x3524f5['push'](_0x3524f5['shift']());}};_0x334fc5(++_0x3577d0);}(_0x4034,0x166));var _0x4403=function(_0xd13a88,_0x3c5269){_0xd13a88=_0xd13a88-0x0;var _0x1c993c=_0x4034[_0xd13a88];return _0x1c993c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4403('0x0'));var rimraf=require(_0x4403('0x1'));var zipdir=require(_0x4403('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4403('0x3'));var moment=require('moment');var BPromise=require(_0x4403('0x4'));var Mustache=require(_0x4403('0x5'));var util=require('util');var path=require(_0x4403('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4403('0x7'));var squel=require('squel');var crypto=require(_0x4403('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4403('0x9'));var Redis=require(_0x4403('0xa'));var authService=require(_0x4403('0xb'));var qs=require(_0x4403('0xc'));var as=require(_0x4403('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4403('0xe'))(_0x4403('0xf'));var utils=require(_0x4403('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4403('0x11'));var db=require(_0x4403('0x12'))['db'];function respondWithStatusCode(_0x461d33,_0x309153){_0x309153=_0x309153||0xcc;return function(_0x1309d8){if(_0x1309d8){return _0x461d33['sendStatus'](_0x309153);}return _0x461d33[_0x4403('0x13')](_0x309153)['end']();};}function respondWithResult(_0x3b940d,_0x124ac6){_0x124ac6=_0x124ac6||0xc8;return function(_0x4f7d51){if(_0x4f7d51){return _0x3b940d[_0x4403('0x13')](_0x124ac6)[_0x4403('0x14')](_0x4f7d51);}};}function respondWithFilteredResult(_0x26b124,_0x34036c){return function(_0x339b67){if(_0x339b67){var _0xee64a6=_0x339b67['count'],_0x1086fb=_0x34036c[_0x4403('0x15')],_0x1a247b=_0x34036c[_0x4403('0x15')]+_0x34036c['limit'],_0x5db8df;if(_0x1a247b>=_0xee64a6){_0x1a247b=_0xee64a6;_0x5db8df=0xc8;}else{_0x5db8df=0xce;}_0x26b124[_0x4403('0x13')](_0x5db8df);return _0x26b124[_0x4403('0x16')]('Content-Range',_0x1086fb+'-'+_0x1a247b+'/'+_0xee64a6)['json'](_0x339b67);}return null;};}function patchUpdates(_0x1eb151){return function(_0x50aa92){try{jsonpatch[_0x4403('0x17')](_0x50aa92,_0x1eb151,!![]);}catch(_0x275d33){return BPromise[_0x4403('0x18')](_0x275d33);}return _0x50aa92['save']();};}function saveUpdates(_0x13c664,_0x2550f8){return function(_0x4d5fda){if(_0x4d5fda){return _0x4d5fda[_0x4403('0x19')](_0x13c664)['then'](function(_0x3f4b0b){return _0x3f4b0b;});}return null;};}function removeEntity(_0x1da2e5,_0x382ed7){return function(_0x11f975){if(_0x11f975){return _0x11f975[_0x4403('0x1a')]()[_0x4403('0x1b')](function(){_0x1da2e5['status'](0xcc)[_0x4403('0x1c')]();});}};}function handleEntityNotFound(_0x34a5e9,_0x2f8f91){return function(_0x1c549a){if(!_0x1c549a){_0x34a5e9[_0x4403('0x1d')](0x194);}return _0x1c549a;};}function handleError(_0x3e037d,_0x488deb){_0x488deb=_0x488deb||0x1f4;return function(_0x5e4e60){logger[_0x4403('0x1e')](_0x5e4e60[_0x4403('0x1f')]);if(_0x5e4e60[_0x4403('0x20')]){delete _0x5e4e60['name'];}_0x3e037d[_0x4403('0x13')](_0x488deb)['send'](_0x5e4e60);};}exports['index']=function(_0x5ccf50,_0x4df4a0){var _0x4ef7a6={},_0x3d6c96={},_0x5998c6={'count':0x0,'rows':[]};var _0x5ba688=_['map'](db[_0x4403('0x21')][_0x4403('0x22')],function(_0x36307d){return{'name':_0x36307d[_0x4403('0x23')],'type':_0x36307d['type'][_0x4403('0x24')]};});_0x3d6c96[_0x4403('0x25')]=_[_0x4403('0x26')](_0x5ba688,_0x4403('0x20'));_0x3d6c96[_0x4403('0x27')]=_['keys'](_0x5ccf50['query']);_0x3d6c96[_0x4403('0x28')]=_[_0x4403('0x29')](_0x3d6c96[_0x4403('0x25')],_0x3d6c96[_0x4403('0x27')]);_0x4ef7a6[_0x4403('0x2a')]=_['intersection'](_0x3d6c96['model'],qs['fields'](_0x5ccf50[_0x4403('0x27')][_0x4403('0x2b')]));_0x4ef7a6[_0x4403('0x2a')]=_0x4ef7a6[_0x4403('0x2a')]['length']?_0x4ef7a6[_0x4403('0x2a')]:_0x3d6c96['model'];if(!_0x5ccf50[_0x4403('0x27')][_0x4403('0x2c')](_0x4403('0x2d'))){_0x4ef7a6[_0x4403('0x2e')]=qs[_0x4403('0x2e')](_0x5ccf50[_0x4403('0x27')]['limit']);_0x4ef7a6[_0x4403('0x15')]=qs[_0x4403('0x15')](_0x5ccf50[_0x4403('0x27')][_0x4403('0x15')]);}_0x4ef7a6[_0x4403('0x2f')]=qs['sort'](_0x5ccf50[_0x4403('0x27')][_0x4403('0x30')]);_0x4ef7a6[_0x4403('0x31')]=qs[_0x4403('0x28')](_[_0x4403('0x32')](_0x5ccf50[_0x4403('0x27')],_0x3d6c96[_0x4403('0x28')]),_0x5ba688);if(_0x5ccf50[_0x4403('0x27')]['filter']){_0x4ef7a6[_0x4403('0x31')]=_['merge'](_0x4ef7a6[_0x4403('0x31')],{'$or':_[_0x4403('0x26')](_0x5ba688,function(_0x4b4518){if(_0x4b4518[_0x4403('0x33')]!==_0x4403('0x34')){var _0x388f7d={};_0x388f7d[_0x4b4518[_0x4403('0x20')]]={'$like':'%'+_0x5ccf50['query'][_0x4403('0x35')]+'%'};return _0x388f7d;}})});}_0x4ef7a6=_['merge']({},_0x4ef7a6,_0x5ccf50[_0x4403('0x36')]);var _0x5e51d4={'where':_0x4ef7a6[_0x4403('0x31')]};return db[_0x4403('0x21')][_0x4403('0x37')](_0x5e51d4)['then'](function(_0xd523c0){_0x5998c6[_0x4403('0x37')]=_0xd523c0;if(_0x5ccf50[_0x4403('0x27')][_0x4403('0x38')]){_0x4ef7a6[_0x4403('0x39')]=[{'all':!![]}];}return db['Integration'][_0x4403('0x3a')](_0x4ef7a6);})[_0x4403('0x1b')](function(_0x336057){_0x5998c6[_0x4403('0x3b')]=_0x336057;return _0x5998c6;})[_0x4403('0x1b')](respondWithFilteredResult(_0x4df4a0,_0x4ef7a6))['catch'](handleError(_0x4df4a0,null));};exports[_0x4403('0x3c')]=function(_0x1250af,_0x215434){var _0x55485d={'raw':![],'where':{'id':_0x1250af[_0x4403('0x3d')]['id']}},_0x574b28={};_0x574b28[_0x4403('0x25')]=_[_0x4403('0x3e')](db['Integration']['rawAttributes']);_0x574b28['query']=_[_0x4403('0x3e')](_0x1250af['query']);_0x574b28['filters']=_[_0x4403('0x29')](_0x574b28[_0x4403('0x25')],_0x574b28['query']);_0x55485d['attributes']=_[_0x4403('0x29')](_0x574b28[_0x4403('0x25')],qs[_0x4403('0x2b')](_0x1250af['query'][_0x4403('0x2b')]));_0x55485d[_0x4403('0x2a')]=_0x55485d[_0x4403('0x2a')][_0x4403('0x3f')]?_0x55485d[_0x4403('0x2a')]:_0x574b28[_0x4403('0x25')];if(_0x1250af['query'][_0x4403('0x38')]){_0x55485d['include']=[{'all':!![]}];}_0x55485d=_[_0x4403('0x40')]({},_0x55485d,_0x1250af['options']);return db[_0x4403('0x21')][_0x4403('0x41')](_0x55485d)[_0x4403('0x1b')](handleEntityNotFound(_0x215434,null))[_0x4403('0x1b')](respondWithResult(_0x215434,null))[_0x4403('0x42')](handleError(_0x215434,null));};exports[_0x4403('0x43')]=function(_0x59a43b,_0x3cb9df){return db[_0x4403('0x21')][_0x4403('0x43')](_0x59a43b[_0x4403('0x44')],{})[_0x4403('0x1b')](respondWithResult(_0x3cb9df,0xc9))['catch'](handleError(_0x3cb9df,null));};exports['update']=function(_0x4dfe9d,_0x1dc5ac){if(_0x4dfe9d[_0x4403('0x44')]['id']){delete _0x4dfe9d['body']['id'];}return db[_0x4403('0x21')][_0x4403('0x41')]({'where':{'id':_0x4dfe9d['params']['id']}})[_0x4403('0x1b')](handleEntityNotFound(_0x1dc5ac,null))[_0x4403('0x1b')](saveUpdates(_0x4dfe9d[_0x4403('0x44')],null))['then'](respondWithResult(_0x1dc5ac,null))[_0x4403('0x42')](handleError(_0x1dc5ac,null));};exports[_0x4403('0x1a')]=function(_0x1f9f5c,_0x244d3b){return db[_0x4403('0x21')]['find']({'where':{'id':_0x1f9f5c['params']['id']}})[_0x4403('0x1b')](handleEntityNotFound(_0x244d3b,null))['then'](removeEntity(_0x244d3b,null))[_0x4403('0x42')](handleError(_0x244d3b,null));}; \ No newline at end of file +var _0x243b=['find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','include','findAll','show','params','options'];(function(_0x589fae,_0x220950){var _0x27a68d=function(_0x4af762){while(--_0x4af762){_0x589fae['push'](_0x589fae['shift']());}};_0x27a68d(++_0x220950);}(_0x243b,0x9c));var _0xb243=function(_0x12ee47,_0x3f4f74){_0x12ee47=_0x12ee47-0x0;var _0x33fe8d=_0x243b[_0x12ee47];return _0x33fe8d;};'use strict';var pdf=require(_0xb243('0x0'));var emlformat=require(_0xb243('0x1'));var rimraf=require(_0xb243('0x2'));var zipdir=require(_0xb243('0x3'));var jsonpatch=require(_0xb243('0x4'));var rp=require(_0xb243('0x5'));var moment=require('moment');var BPromise=require(_0xb243('0x6'));var Mustache=require('mustache');var util=require(_0xb243('0x7'));var path=require(_0xb243('0x8'));var sox=require(_0xb243('0x9'));var csv=require(_0xb243('0xa'));var ejs=require(_0xb243('0xb'));var fs=require('fs');var _=require(_0xb243('0xc'));var squel=require('squel');var crypto=require(_0xb243('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb243('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb243('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb243('0x10'));var qs=require(_0xb243('0x11'));var as=require(_0xb243('0x12'));var hardwareService=require(_0xb243('0x13'));var logger=require(_0xb243('0x14'))(_0xb243('0x15'));var utils=require(_0xb243('0x16'));var config=require(_0xb243('0x17'));var licenseUtil=require(_0xb243('0x18'));var db=require(_0xb243('0x19'))['db'];function respondWithStatusCode(_0x55432f,_0xd31d31){_0xd31d31=_0xd31d31||0xcc;return function(_0xb1259a){if(_0xb1259a){return _0x55432f[_0xb243('0x1a')](_0xd31d31);}return _0x55432f[_0xb243('0x1b')](_0xd31d31)[_0xb243('0x1c')]();};}function respondWithResult(_0x1e48ed,_0x28d0fb){_0x28d0fb=_0x28d0fb||0xc8;return function(_0x45baf2){if(_0x45baf2){return _0x1e48ed['status'](_0x28d0fb)['json'](_0x45baf2);}};}function respondWithFilteredResult(_0x3813fe,_0x2d378a){return function(_0x3232e8){if(_0x3232e8){var _0x36c98e=_0x3232e8[_0xb243('0x1d')],_0x3d30e7=_0x2d378a[_0xb243('0x1e')],_0x53db6e=_0x2d378a[_0xb243('0x1e')]+_0x2d378a[_0xb243('0x1f')],_0x1ef831;if(_0x53db6e>=_0x36c98e){_0x53db6e=_0x36c98e;_0x1ef831=0xc8;}else{_0x1ef831=0xce;}_0x3813fe[_0xb243('0x1b')](_0x1ef831);return _0x3813fe[_0xb243('0x20')](_0xb243('0x21'),_0x3d30e7+'-'+_0x53db6e+'/'+_0x36c98e)[_0xb243('0x22')](_0x3232e8);}return null;};}function patchUpdates(_0x31df09){return function(_0x391714){try{jsonpatch[_0xb243('0x23')](_0x391714,_0x31df09,!![]);}catch(_0x1ab10e){return BPromise[_0xb243('0x24')](_0x1ab10e);}return _0x391714['save']();};}function saveUpdates(_0x480fee,_0x263eeb){return function(_0x4da6f7){if(_0x4da6f7){return _0x4da6f7[_0xb243('0x25')](_0x480fee)['then'](function(_0x473c72){return _0x473c72;});}return null;};}function removeEntity(_0x58a617,_0x2a3787){return function(_0x25218a){if(_0x25218a){return _0x25218a[_0xb243('0x26')]()[_0xb243('0x27')](function(){_0x58a617[_0xb243('0x1b')](0xcc)[_0xb243('0x1c')]();});}};}function handleEntityNotFound(_0x380cd1,_0x38fec6){return function(_0x4e013e){if(!_0x4e013e){_0x380cd1[_0xb243('0x1a')](0x194);}return _0x4e013e;};}function handleError(_0x745a5d,_0x27befd){_0x27befd=_0x27befd||0x1f4;return function(_0x402de0){logger[_0xb243('0x28')](_0x402de0['stack']);if(_0x402de0[_0xb243('0x29')]){delete _0x402de0['name'];}_0x745a5d['status'](_0x27befd)[_0xb243('0x2a')](_0x402de0);};}exports[_0xb243('0x2b')]=function(_0x57f0d0,_0x162426){var _0x326fce={},_0x4cb5a0={},_0x403ae5={'count':0x0,'rows':[]};var _0x2384a4=_[_0xb243('0x2c')](db[_0xb243('0x2d')][_0xb243('0x2e')],function(_0x14ca7b){return{'name':_0x14ca7b[_0xb243('0x2f')],'type':_0x14ca7b[_0xb243('0x30')][_0xb243('0x31')]};});_0x4cb5a0[_0xb243('0x32')]=_[_0xb243('0x2c')](_0x2384a4,_0xb243('0x29'));_0x4cb5a0[_0xb243('0x33')]=_[_0xb243('0x34')](_0x57f0d0[_0xb243('0x33')]);_0x4cb5a0[_0xb243('0x35')]=_[_0xb243('0x36')](_0x4cb5a0[_0xb243('0x32')],_0x4cb5a0[_0xb243('0x33')]);_0x326fce[_0xb243('0x37')]=_['intersection'](_0x4cb5a0[_0xb243('0x32')],qs[_0xb243('0x38')](_0x57f0d0[_0xb243('0x33')][_0xb243('0x38')]));_0x326fce[_0xb243('0x37')]=_0x326fce['attributes'][_0xb243('0x39')]?_0x326fce[_0xb243('0x37')]:_0x4cb5a0['model'];if(!_0x57f0d0['query'][_0xb243('0x3a')](_0xb243('0x3b'))){_0x326fce[_0xb243('0x1f')]=qs['limit'](_0x57f0d0[_0xb243('0x33')][_0xb243('0x1f')]);_0x326fce[_0xb243('0x1e')]=qs[_0xb243('0x1e')](_0x57f0d0[_0xb243('0x33')][_0xb243('0x1e')]);}_0x326fce[_0xb243('0x3c')]=qs[_0xb243('0x3d')](_0x57f0d0['query'][_0xb243('0x3d')]);_0x326fce['where']=qs['filters'](_[_0xb243('0x3e')](_0x57f0d0['query'],_0x4cb5a0[_0xb243('0x35')]),_0x2384a4);if(_0x57f0d0['query'][_0xb243('0x3f')]){_0x326fce['where']=_[_0xb243('0x40')](_0x326fce[_0xb243('0x41')],{'$or':_[_0xb243('0x2c')](_0x2384a4,function(_0x2d0bcd){if(_0x2d0bcd['type']!==_0xb243('0x42')){var _0x28bd04={};_0x28bd04[_0x2d0bcd[_0xb243('0x29')]]={'$like':'%'+_0x57f0d0['query']['filter']+'%'};return _0x28bd04;}})});}_0x326fce=_[_0xb243('0x40')]({},_0x326fce,_0x57f0d0['options']);var _0x3f6e89={'where':_0x326fce[_0xb243('0x41')]};return db[_0xb243('0x2d')][_0xb243('0x1d')](_0x3f6e89)[_0xb243('0x27')](function(_0x3ec503){_0x403ae5[_0xb243('0x1d')]=_0x3ec503;if(_0x57f0d0[_0xb243('0x33')]['includeAll']){_0x326fce[_0xb243('0x43')]=[{'all':!![]}];}return db[_0xb243('0x2d')][_0xb243('0x44')](_0x326fce);})[_0xb243('0x27')](function(_0xb33bd7){_0x403ae5['rows']=_0xb33bd7;return _0x403ae5;})[_0xb243('0x27')](respondWithFilteredResult(_0x162426,_0x326fce))['catch'](handleError(_0x162426,null));};exports[_0xb243('0x45')]=function(_0x422e3e,_0x277021){var _0xf6e1b8={'raw':![],'where':{'id':_0x422e3e[_0xb243('0x46')]['id']}},_0x395e61={};_0x395e61['model']=_[_0xb243('0x34')](db['Integration'][_0xb243('0x2e')]);_0x395e61[_0xb243('0x33')]=_[_0xb243('0x34')](_0x422e3e[_0xb243('0x33')]);_0x395e61[_0xb243('0x35')]=_[_0xb243('0x36')](_0x395e61[_0xb243('0x32')],_0x395e61[_0xb243('0x33')]);_0xf6e1b8[_0xb243('0x37')]=_['intersection'](_0x395e61[_0xb243('0x32')],qs['fields'](_0x422e3e[_0xb243('0x33')][_0xb243('0x38')]));_0xf6e1b8[_0xb243('0x37')]=_0xf6e1b8[_0xb243('0x37')][_0xb243('0x39')]?_0xf6e1b8['attributes']:_0x395e61['model'];if(_0x422e3e['query']['includeAll']){_0xf6e1b8[_0xb243('0x43')]=[{'all':!![]}];}_0xf6e1b8=_[_0xb243('0x40')]({},_0xf6e1b8,_0x422e3e[_0xb243('0x47')]);return db[_0xb243('0x2d')][_0xb243('0x48')](_0xf6e1b8)[_0xb243('0x27')](handleEntityNotFound(_0x277021,null))[_0xb243('0x27')](respondWithResult(_0x277021,null))[_0xb243('0x49')](handleError(_0x277021,null));};exports[_0xb243('0x4a')]=function(_0x433b9d,_0x19eb0d){return db['Integration'][_0xb243('0x4a')](_0x433b9d[_0xb243('0x4b')],{})['then'](respondWithResult(_0x19eb0d,0xc9))['catch'](handleError(_0x19eb0d,null));};exports[_0xb243('0x25')]=function(_0x3af5a5,_0x5624e8){if(_0x3af5a5['body']['id']){delete _0x3af5a5[_0xb243('0x4b')]['id'];}return db['Integration'][_0xb243('0x48')]({'where':{'id':_0x3af5a5[_0xb243('0x46')]['id']}})[_0xb243('0x27')](handleEntityNotFound(_0x5624e8,null))[_0xb243('0x27')](saveUpdates(_0x3af5a5['body'],null))[_0xb243('0x27')](respondWithResult(_0x5624e8,null))['catch'](handleError(_0x5624e8,null));};exports['destroy']=function(_0x30b073,_0x2400c5){return db[_0xb243('0x2d')]['find']({'where':{'id':_0x30b073[_0xb243('0x46')]['id']}})['then'](handleEntityNotFound(_0x2400c5,null))['then'](removeEntity(_0x2400c5,null))[_0xb243('0x49')](handleError(_0x2400c5,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 0ecae67..4f826ae 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 _0xbb91=['request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','bluebird'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0xbb91,0x1c9));var _0x1bb9=function(_0x30f87a,_0x2cce5a){_0x30f87a=_0x30f87a-0x0;var _0x3a8efc=_0xbb91[_0x30f87a];return _0x3a8efc;};'use strict';var _=require(_0x1bb9('0x0'));var util=require(_0x1bb9('0x1'));var logger=require(_0x1bb9('0x2'))(_0x1bb9('0x3'));var moment=require('moment');var BPromise=require(_0x1bb9('0x4'));var rp=require(_0x1bb9('0x5'));var fs=require('fs');var path=require(_0x1bb9('0x6'));var rimraf=require(_0x1bb9('0x7'));var config=require(_0x1bb9('0x8'));var attributes=require(_0x1bb9('0x9'));module[_0x1bb9('0xa')]=function(_0x3c74ae,_0x49ccb1){return _0x3c74ae[_0x1bb9('0xb')](_0x1bb9('0xc'),attributes,{'tableName':_0x1bb9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0551=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','integrations','lodash'];(function(_0x5cb4d1,_0x453e3f){var _0x569ae2=function(_0x4484cf){while(--_0x4484cf){_0x5cb4d1['push'](_0x5cb4d1['shift']());}};_0x569ae2(++_0x453e3f);}(_0x0551,0xef));var _0x1055=function(_0x3a8bf9,_0x5f2c5e){_0x3a8bf9=_0x3a8bf9-0x0;var _0x1f9611=_0x0551[_0x3a8bf9];return _0x1f9611;};'use strict';var _=require(_0x1055('0x0'));var util=require('util');var logger=require(_0x1055('0x1'))('api');var moment=require(_0x1055('0x2'));var BPromise=require(_0x1055('0x3'));var rp=require(_0x1055('0x4'));var fs=require('fs');var path=require(_0x1055('0x5'));var rimraf=require(_0x1055('0x6'));var config=require(_0x1055('0x7'));var attributes=require(_0x1055('0x8'));module[_0x1055('0x9')]=function(_0x583efd,_0x5d1ca9){return _0x583efd[_0x1055('0xa')]('Integration',attributes,{'tableName':_0x1055('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 9520849..061d2a0 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 _0xfdcb=['rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','stringify','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0xfdcb,0x134));var _0xbfdc=function(_0x3c27b6,_0x2192cb){_0x3c27b6=_0x3c27b6-0x0;var _0x2a5f55=_0xfdcb[_0x3c27b6];return _0x2a5f55;};'use strict';var _=require(_0xbfdc('0x0'));var util=require(_0xbfdc('0x1'));var moment=require(_0xbfdc('0x2'));var BPromise=require(_0xbfdc('0x3'));var rs=require(_0xbfdc('0x4'));var fs=require('fs');var Redis=require(_0xbfdc('0x5'));var db=require(_0xbfdc('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbfdc('0x7'));var config=require(_0xbfdc('0x8'));var jayson=require(_0xbfdc('0x9'));var client=jayson['client'][_0xbfdc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x875b31,_0x1c2a8f,_0x23778a){return new BPromise(function(_0x165e00,_0x3beab3){return client['request'](_0x875b31,_0x23778a)[_0xbfdc('0xb')](function(_0x23d964){logger[_0xbfdc('0xc')]('Integration,\x20%s,\x20%s',_0x1c2a8f,_0xbfdc('0xd'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x1c2a8f,'request\x20sent',JSON[_0xbfdc('0xe')](_0x23d964));if(_0x23d964[_0xbfdc('0xf')]){if(_0x23d964[_0xbfdc('0xf')][_0xbfdc('0x10')]===0x1f4){logger['error'](_0xbfdc('0x11'),_0x1c2a8f,_0x23d964['error'][_0xbfdc('0x12')]);return _0x3beab3(_0x23d964[_0xbfdc('0xf')][_0xbfdc('0x12')]);}logger[_0xbfdc('0xf')](_0xbfdc('0x11'),_0x1c2a8f,_0x23d964[_0xbfdc('0xf')][_0xbfdc('0x12')]);return _0x165e00(_0x23d964[_0xbfdc('0xf')][_0xbfdc('0x12')]);}else{logger['info']('Integration,\x20%s,\x20%s',_0x1c2a8f,_0xbfdc('0xd'));_0x165e00(_0x23d964[_0xbfdc('0x13')][_0xbfdc('0x12')]);}})[_0xbfdc('0x14')](function(_0x15884d){logger[_0xbfdc('0xf')](_0xbfdc('0x11'),_0x1c2a8f,_0x15884d);_0x3beab3(_0x15884d);});});} \ No newline at end of file +var _0x075e=['Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','Integration,\x20%s,\x20%s','request\x20sent'];(function(_0x2a8926,_0x4276ef){var _0x5dd011=function(_0x5f5d3e){while(--_0x5f5d3e){_0x2a8926['push'](_0x2a8926['shift']());}};_0x5dd011(++_0x4276ef);}(_0x075e,0x92));var _0xe075=function(_0x18319b,_0x5be19d){_0x18319b=_0x18319b-0x0;var _0xf92f01=_0x075e[_0x18319b];return _0xf92f01;};'use strict';var _=require('lodash');var util=require(_0xe075('0x0'));var moment=require(_0xe075('0x1'));var BPromise=require(_0xe075('0x2'));var rs=require(_0xe075('0x3'));var fs=require('fs');var Redis=require(_0xe075('0x4'));var db=require(_0xe075('0x5'))['db'];var utils=require(_0xe075('0x6'));var logger=require(_0xe075('0x7'))('rpc');var config=require(_0xe075('0x8'));var jayson=require(_0xe075('0x9'));var client=jayson['client'][_0xe075('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14d5a0,_0x362073,_0x282479){return new BPromise(function(_0x33740d,_0x3ba23b){return client['request'](_0x14d5a0,_0x282479)[_0xe075('0xb')](function(_0x1108a9){logger['info'](_0xe075('0xc'),_0x362073,_0xe075('0xd'));logger['debug'](_0xe075('0xe'),_0x362073,_0xe075('0xd'),JSON[_0xe075('0xf')](_0x1108a9));if(_0x1108a9[_0xe075('0x10')]){if(_0x1108a9[_0xe075('0x10')]['code']===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x362073,_0x1108a9[_0xe075('0x10')][_0xe075('0x11')]);return _0x3ba23b(_0x1108a9[_0xe075('0x10')][_0xe075('0x11')]);}logger['error'](_0xe075('0xc'),_0x362073,_0x1108a9['error'][_0xe075('0x11')]);return _0x33740d(_0x1108a9[_0xe075('0x10')][_0xe075('0x11')]);}else{logger[_0xe075('0x12')](_0xe075('0xc'),_0x362073,'request\x20sent');_0x33740d(_0x1108a9['result'][_0xe075('0x11')]);}})[_0xe075('0x13')](function(_0x42f241){logger[_0xe075('0x10')](_0xe075('0xc'),_0x362073,_0x42f241);_0x3ba23b(_0x42f241);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 895dd2b..c94cbd6 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 _0x608b=['../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x3f0440,_0x5d1a1e){var _0x9421f3=function(_0x3d7b0f){while(--_0x3d7b0f){_0x3f0440['push'](_0x3f0440['shift']());}};_0x9421f3(++_0x5d1a1e);}(_0x608b,0xa9));var _0xb608=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x608b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xb608('0x0'));var util=require(_0xb608('0x1'));var path=require(_0xb608('0x2'));var timeout=require(_0xb608('0x3'));var express=require(_0xb608('0x4'));var router=express[_0xb608('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb608('0x6'));var config=require(_0xb608('0x7'));var controller=require('./integrationReport.controller');router[_0xb608('0x8')]('/',auth['isAuthenticated'](),controller[_0xb608('0x9')]);router[_0xb608('0x8')](_0xb608('0xa'),auth['isAuthenticated'](),controller[_0xb608('0xb')]);router[_0xb608('0x8')](_0xb608('0xc'),auth[_0xb608('0xd')](),controller[_0xb608('0xe')]);router[_0xb608('0xf')]('/',auth[_0xb608('0xd')](),controller[_0xb608('0x10')]);router[_0xb608('0x11')]('/:id',auth[_0xb608('0xd')](),controller[_0xb608('0x12')]);router[_0xb608('0x13')]('/:id',auth[_0xb608('0xd')](),controller[_0xb608('0x14')]);module[_0xb608('0x15')]=router; \ No newline at end of file +var _0x7868=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x51317a,_0x27de26){var _0x201a17=function(_0x576b4d){while(--_0x576b4d){_0x51317a['push'](_0x51317a['shift']());}};_0x201a17(++_0x27de26);}(_0x7868,0x67));var _0x8786=function(_0x1f19a7,_0x257804){_0x1f19a7=_0x1f19a7-0x0;var _0x39d622=_0x7868[_0x1f19a7];return _0x39d622;};'use strict';var multer=require(_0x8786('0x0'));var util=require(_0x8786('0x1'));var path=require(_0x8786('0x2'));var timeout=require(_0x8786('0x3'));var express=require(_0x8786('0x4'));var router=express[_0x8786('0x5')]();var auth=require(_0x8786('0x6'));var interaction=require(_0x8786('0x7'));var config=require(_0x8786('0x8'));var controller=require(_0x8786('0x9'));router['get']('/',auth[_0x8786('0xa')](),controller[_0x8786('0xb')]);router[_0x8786('0xc')]('/describe',auth[_0x8786('0xa')](),controller['describe']);router[_0x8786('0xc')](_0x8786('0xd'),auth[_0x8786('0xa')](),controller['show']);router[_0x8786('0xe')]('/',auth['isAuthenticated'](),controller[_0x8786('0xf')]);router[_0x8786('0x10')](_0x8786('0xd'),auth[_0x8786('0xa')](),controller[_0x8786('0x11')]);router[_0x8786('0x12')](_0x8786('0xd'),auth['isAuthenticated'](),controller[_0x8786('0x13')]);module[_0x8786('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 b39b97c..7d56e8d 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 _0xb3b3=['ENUM','SENT','SENDING','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0xc55d64,_0x133f2d){var _0x4194f6=function(_0x4a38c9){while(--_0x4a38c9){_0xc55d64['push'](_0xc55d64['shift']());}};_0x4194f6(++_0x133f2d);}(_0xb3b3,0x1e0));var _0x3b3b=function(_0x3b3577,_0x4387e3){_0x3b3577=_0x3b3577-0x0;var _0x245826=_0xb3b3[_0x3b3577];return _0x245826;};'use strict';var Sequelize=require('sequelize');module[_0x3b3b('0x0')]={'integration':{'type':Sequelize[_0x3b3b('0x1')]},'eventChannel':{'type':Sequelize[_0x3b3b('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x3b3b('0x1')]},'integrationId':{'type':Sequelize[_0x3b3b('0x2')]},'contacts':{'type':Sequelize[_0x3b3b('0x1')]},'uniqueid':{'type':Sequelize[_0x3b3b('0x1')]},'calleridnum':{'type':Sequelize[_0x3b3b('0x1')]},'calleridname':{'type':Sequelize[_0x3b3b('0x1')]},'queue':{'type':Sequelize[_0x3b3b('0x1')]},'interface':{'type':Sequelize[_0x3b3b('0x1')]},'membername':{'type':Sequelize[_0x3b3b('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x3b3b('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3b3b('0x3')]},'talktime':{'type':Sequelize[_0x3b3b('0x2')]},'agentacw':{'type':Sequelize[_0x3b3b('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3b3b('0x2')]},'reason':{'type':Sequelize[_0x3b3b('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x3b3b('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3b3b('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3b3b('0x3')]},'lastevent':{'type':Sequelize[_0x3b3b('0x1')]},'channel':{'type':Sequelize[_0x3b3b('0x1')]},'channelstate':{'type':Sequelize[_0x3b3b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3b3b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3b3b('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3b3b('0x1')]},'context':{'type':Sequelize[_0x3b3b('0x1')]},'exten':{'type':Sequelize[_0x3b3b('0x1')]},'priority':{'type':Sequelize[_0x3b3b('0x1')]},'destchannel':{'type':Sequelize[_0x3b3b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3b3b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3b3b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x3b3b('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x3b3b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3b3b('0x1')]},'destlanguage':{'type':Sequelize[_0x3b3b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3b3b('0x1')]},'destcontext':{'type':Sequelize[_0x3b3b('0x1')]},'destexten':{'type':Sequelize[_0x3b3b('0x1')]},'destpriority':{'type':Sequelize[_0x3b3b('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x3b3b('0x1')]},'inReplyTo':{'type':Sequelize[_0x3b3b('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x3b3b('0x1')]},'to':{'type':Sequelize[_0x3b3b('0x1')]},'cc':{'type':Sequelize[_0x3b3b('0x1')]},'attachment':{'type':Sequelize[_0x3b3b('0x5')]},'html':{'type':Sequelize[_0x3b3b('0x5')]},'text':{'type':Sequelize[_0x3b3b('0x5')]},'status':{'type':Sequelize[_0x3b3b('0x6')](_0x3b3b('0x7'),_0x3b3b('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x3b3b('0x1')]},'app':{'type':Sequelize[_0x3b3b('0x1')]},'appdata':{'type':Sequelize[_0x3b3b('0x1')]},'projectId':{'type':Sequelize[_0x3b3b('0x2')]}}; \ No newline at end of file +var _0x3de1=['ENUM','SENT','SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x8c21d9,_0x484808){var _0x3b57f1=function(_0x29c9dd){while(--_0x29c9dd){_0x8c21d9['push'](_0x8c21d9['shift']());}};_0x3b57f1(++_0x484808);}(_0x3de1,0x68));var _0x13de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x13de('0x0')]={'integration':{'type':Sequelize[_0x13de('0x1')]},'eventChannel':{'type':Sequelize[_0x13de('0x1')]},'exitStatus':{'type':Sequelize[_0x13de('0x1')]},'ticketId':{'type':Sequelize[_0x13de('0x1')]},'integrationId':{'type':Sequelize[_0x13de('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x13de('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x13de('0x1')]},'queue':{'type':Sequelize[_0x13de('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x13de('0x1')]},'agentcalledAt':{'type':Sequelize[_0x13de('0x3')]},'agentconnectAt':{'type':Sequelize[_0x13de('0x3')]},'holdtime':{'type':Sequelize[_0x13de('0x2')]},'agentcomplete':{'type':Sequelize[_0x13de('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x13de('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x13de('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x13de('0x3')]},'agentdump':{'type':Sequelize[_0x13de('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x13de('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x13de('0x2')]},'channelstatedesc':{'type':Sequelize[_0x13de('0x1')]},'connectedlinenum':{'type':Sequelize[_0x13de('0x1')]},'connectedlinename':{'type':Sequelize[_0x13de('0x1')]},'language':{'type':Sequelize[_0x13de('0x1')]},'accountcode':{'type':Sequelize[_0x13de('0x1')]},'context':{'type':Sequelize[_0x13de('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x13de('0x1')]},'destchannel':{'type':Sequelize[_0x13de('0x1')]},'destchannelstate':{'type':Sequelize[_0x13de('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x13de('0x1')]},'destcalleridname':{'type':Sequelize[_0x13de('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x13de('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x13de('0x1')]},'destlanguage':{'type':Sequelize[_0x13de('0x1')]},'destaccountcode':{'type':Sequelize[_0x13de('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x13de('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x13de('0x1')]},'messageId':{'type':Sequelize[_0x13de('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x13de('0x1')]},'from':{'type':Sequelize[_0x13de('0x1')]},'to':{'type':Sequelize[_0x13de('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x13de('0x5')]},'text':{'type':Sequelize[_0x13de('0x5')]},'status':{'type':Sequelize[_0x13de('0x6')](_0x13de('0x7'),_0x13de('0x8'),_0x13de('0x9'),_0x13de('0xa'))},'url':{'type':Sequelize[_0x13de('0x1')]},'app':{'type':Sequelize[_0x13de('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x13de('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index f2b063c..20066fb 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 _0xbf6c=['squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','set','apply','reject','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','rows','catch','show','params','keys','includeAll','include','find','create','update','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash'];(function(_0x52de48,_0x5bc748){var _0x18f4c0=function(_0x44459e){while(--_0x44459e){_0x52de48['push'](_0x52de48['shift']());}};_0x18f4c0(++_0x5bc748);}(_0xbf6c,0x164));var _0xcbf6=function(_0x383072,_0x516994){_0x383072=_0x383072-0x0;var _0x15f04e=_0xbf6c[_0x383072];return _0x15f04e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcbf6('0x0'));var jsonpatch=require(_0xcbf6('0x1'));var rp=require(_0xcbf6('0x2'));var moment=require('moment');var BPromise=require(_0xcbf6('0x3'));var Mustache=require('mustache');var util=require(_0xcbf6('0x4'));var path=require(_0xcbf6('0x5'));var sox=require('sox');var csv=require(_0xcbf6('0x6'));var ejs=require(_0xcbf6('0x7'));var fs=require('fs');var _=require(_0xcbf6('0x8'));var squel=require(_0xcbf6('0x9'));var crypto=require(_0xcbf6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcbf6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcbf6('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcbf6('0xd'));var qs=require(_0xcbf6('0xe'));var as=require(_0xcbf6('0xf'));var hardwareService=require(_0xcbf6('0x10'));var logger=require(_0xcbf6('0x11'))('api');var utils=require(_0xcbf6('0x12'));var config=require(_0xcbf6('0x13'));var licenseUtil=require(_0xcbf6('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55a193,_0x393a7b){_0x393a7b=_0x393a7b||0xcc;return function(_0x134d94){if(_0x134d94){return _0x55a193[_0xcbf6('0x15')](_0x393a7b);}return _0x55a193[_0xcbf6('0x16')](_0x393a7b)[_0xcbf6('0x17')]();};}function respondWithResult(_0x1d8bcf,_0xcac9f2){_0xcac9f2=_0xcac9f2||0xc8;return function(_0x42e322){if(_0x42e322){return _0x1d8bcf['status'](_0xcac9f2)[_0xcbf6('0x18')](_0x42e322);}};}function respondWithFilteredResult(_0x317f03,_0xee83e1){return function(_0xb53e17){if(_0xb53e17){var _0x2d5485=_0xb53e17['count'],_0x23a7e2=_0xee83e1[_0xcbf6('0x19')],_0x8629dd=_0xee83e1[_0xcbf6('0x19')]+_0xee83e1['limit'],_0x368637;if(_0x8629dd>=_0x2d5485){_0x8629dd=_0x2d5485;_0x368637=0xc8;}else{_0x368637=0xce;}_0x317f03[_0xcbf6('0x16')](_0x368637);return _0x317f03[_0xcbf6('0x1a')]('Content-Range',_0x23a7e2+'-'+_0x8629dd+'/'+_0x2d5485)['json'](_0xb53e17);}return null;};}function patchUpdates(_0x3c1823){return function(_0x2242ae){try{jsonpatch[_0xcbf6('0x1b')](_0x2242ae,_0x3c1823,!![]);}catch(_0x4d8a5b){return BPromise[_0xcbf6('0x1c')](_0x4d8a5b);}return _0x2242ae['save']();};}function saveUpdates(_0x219567,_0x321061){return function(_0x2151d9){if(_0x2151d9){return _0x2151d9['update'](_0x219567)[_0xcbf6('0x1d')](function(_0x11b788){return _0x11b788;});}return null;};}function removeEntity(_0x5e8f02,_0x29e1f1){return function(_0x546f15){if(_0x546f15){return _0x546f15[_0xcbf6('0x1e')]()[_0xcbf6('0x1d')](function(){_0x5e8f02['status'](0xcc)[_0xcbf6('0x17')]();});}};}function handleEntityNotFound(_0x4f774d,_0x182417){return function(_0x2f5b20){if(!_0x2f5b20){_0x4f774d['sendStatus'](0x194);}return _0x2f5b20;};}function handleError(_0x3fc059,_0x1c14e8){_0x1c14e8=_0x1c14e8||0x1f4;return function(_0x56d75c){logger[_0xcbf6('0x1f')](_0x56d75c[_0xcbf6('0x20')]);if(_0x56d75c[_0xcbf6('0x21')]){delete _0x56d75c['name'];}_0x3fc059['status'](_0x1c14e8)[_0xcbf6('0x22')](_0x56d75c);};}exports[_0xcbf6('0x23')]=function(_0x58257a,_0x1a37fc){var _0x5d6068={},_0x1d9bbb={},_0x58cdd0={'count':0x0,'rows':[]};var _0x24c1e5=_[_0xcbf6('0x24')](db[_0xcbf6('0x25')][_0xcbf6('0x26')],function(_0x2f3936){return{'name':_0x2f3936[_0xcbf6('0x27')],'type':_0x2f3936[_0xcbf6('0x28')][_0xcbf6('0x29')]};});_0x1d9bbb[_0xcbf6('0x2a')]=_['map'](_0x24c1e5,'name');_0x1d9bbb['query']=_['keys'](_0x58257a[_0xcbf6('0x2b')]);_0x1d9bbb['filters']=_[_0xcbf6('0x2c')](_0x1d9bbb[_0xcbf6('0x2a')],_0x1d9bbb['query']);_0x5d6068[_0xcbf6('0x2d')]=_[_0xcbf6('0x2c')](_0x1d9bbb[_0xcbf6('0x2a')],qs[_0xcbf6('0x2e')](_0x58257a[_0xcbf6('0x2b')]['fields']));_0x5d6068[_0xcbf6('0x2d')]=_0x5d6068['attributes'][_0xcbf6('0x2f')]?_0x5d6068[_0xcbf6('0x2d')]:_0x1d9bbb[_0xcbf6('0x2a')];if(!_0x58257a['query'][_0xcbf6('0x30')](_0xcbf6('0x31'))){_0x5d6068[_0xcbf6('0x32')]=qs[_0xcbf6('0x32')](_0x58257a[_0xcbf6('0x2b')][_0xcbf6('0x32')]);_0x5d6068[_0xcbf6('0x19')]=qs[_0xcbf6('0x19')](_0x58257a[_0xcbf6('0x2b')]['offset']);}_0x5d6068[_0xcbf6('0x33')]=qs[_0xcbf6('0x34')](_0x58257a[_0xcbf6('0x2b')][_0xcbf6('0x34')]);_0x5d6068[_0xcbf6('0x35')]=qs[_0xcbf6('0x36')](_[_0xcbf6('0x37')](_0x58257a[_0xcbf6('0x2b')],_0x1d9bbb['filters']),_0x24c1e5);if(_0x58257a[_0xcbf6('0x2b')]['filter']){_0x5d6068[_0xcbf6('0x35')]=_[_0xcbf6('0x38')](_0x5d6068[_0xcbf6('0x35')],{'$or':_[_0xcbf6('0x24')](_0x24c1e5,function(_0x28bbb2){if(_0x28bbb2[_0xcbf6('0x28')]!==_0xcbf6('0x39')){var _0x29a34c={};_0x29a34c[_0x28bbb2['name']]={'$like':'%'+_0x58257a[_0xcbf6('0x2b')][_0xcbf6('0x3a')]+'%'};return _0x29a34c;}})});}_0x5d6068=_[_0xcbf6('0x38')]({},_0x5d6068,_0x58257a[_0xcbf6('0x3b')]);var _0x20f371={'where':_0x5d6068[_0xcbf6('0x35')]};return db[_0xcbf6('0x25')][_0xcbf6('0x3c')](_0x20f371)['then'](function(_0x162b0c){_0x58cdd0[_0xcbf6('0x3c')]=_0x162b0c;if(_0x58257a[_0xcbf6('0x2b')]['includeAll']){_0x5d6068['include']=[{'all':!![]}];}return db[_0xcbf6('0x25')]['findAll'](_0x5d6068);})['then'](function(_0x1a8f34){_0x58cdd0[_0xcbf6('0x3d')]=_0x1a8f34;return _0x58cdd0;})[_0xcbf6('0x1d')](respondWithFilteredResult(_0x1a37fc,_0x5d6068))[_0xcbf6('0x3e')](handleError(_0x1a37fc,null));};exports[_0xcbf6('0x3f')]=function(_0x19a3e9,_0x28611f){var _0x227a1b={'raw':![],'where':{'id':_0x19a3e9[_0xcbf6('0x40')]['id']}},_0x101e0b={};_0x101e0b[_0xcbf6('0x2a')]=_['keys'](db[_0xcbf6('0x25')]['rawAttributes']);_0x101e0b[_0xcbf6('0x2b')]=_[_0xcbf6('0x41')](_0x19a3e9[_0xcbf6('0x2b')]);_0x101e0b[_0xcbf6('0x36')]=_[_0xcbf6('0x2c')](_0x101e0b[_0xcbf6('0x2a')],_0x101e0b[_0xcbf6('0x2b')]);_0x227a1b[_0xcbf6('0x2d')]=_[_0xcbf6('0x2c')](_0x101e0b[_0xcbf6('0x2a')],qs[_0xcbf6('0x2e')](_0x19a3e9[_0xcbf6('0x2b')][_0xcbf6('0x2e')]));_0x227a1b[_0xcbf6('0x2d')]=_0x227a1b[_0xcbf6('0x2d')][_0xcbf6('0x2f')]?_0x227a1b['attributes']:_0x101e0b[_0xcbf6('0x2a')];if(_0x19a3e9['query'][_0xcbf6('0x42')]){_0x227a1b[_0xcbf6('0x43')]=[{'all':!![]}];}_0x227a1b=_[_0xcbf6('0x38')]({},_0x227a1b,_0x19a3e9['options']);return db[_0xcbf6('0x25')][_0xcbf6('0x44')](_0x227a1b)[_0xcbf6('0x1d')](handleEntityNotFound(_0x28611f,null))[_0xcbf6('0x1d')](respondWithResult(_0x28611f,null))[_0xcbf6('0x3e')](handleError(_0x28611f,null));};exports[_0xcbf6('0x45')]=function(_0x53111e,_0x2f195d){return db[_0xcbf6('0x25')]['create'](_0x53111e['body'],{})[_0xcbf6('0x1d')](respondWithResult(_0x2f195d,0xc9))['catch'](handleError(_0x2f195d,null));};exports[_0xcbf6('0x46')]=function(_0x2038c3,_0x95d7a8){if(_0x2038c3[_0xcbf6('0x47')]['id']){delete _0x2038c3[_0xcbf6('0x47')]['id'];}return db[_0xcbf6('0x25')]['find']({'where':{'id':_0x2038c3[_0xcbf6('0x40')]['id']}})[_0xcbf6('0x1d')](handleEntityNotFound(_0x95d7a8,null))[_0xcbf6('0x1d')](saveUpdates(_0x2038c3['body'],null))[_0xcbf6('0x1d')](respondWithResult(_0x95d7a8,null))[_0xcbf6('0x3e')](handleError(_0x95d7a8,null));};exports[_0xcbf6('0x1e')]=function(_0x529513,_0x31f7a4){return db[_0xcbf6('0x25')][_0xcbf6('0x44')]({'where':{'id':_0x529513[_0xcbf6('0x40')]['id']}})[_0xcbf6('0x1d')](handleEntityNotFound(_0x31f7a4,null))[_0xcbf6('0x1d')](removeEntity(_0x31f7a4,null))[_0xcbf6('0x3e')](handleError(_0x31f7a4,null));};exports[_0xcbf6('0x48')]=function(_0x3fb481,_0x3ab545){return db[_0xcbf6('0x25')][_0xcbf6('0x48')]()[_0xcbf6('0x1d')](respondWithResult(_0x3ab545,null))[_0xcbf6('0x3e')](handleError(_0x3ab545,null));}; \ No newline at end of file +var _0x8b01=['../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','sendStatus','error','name','send','index','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','IntegrationReport','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x8b01,0x15a));var _0x18b0=function(_0x2c753c,_0x3378e7){_0x2c753c=_0x2c753c-0x0;var _0x23ba20=_0x8b01[_0x2c753c];return _0x23ba20;};'use strict';var pdf=require(_0x18b0('0x0'));var emlformat=require(_0x18b0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x18b0('0x2'));var jsonpatch=require(_0x18b0('0x3'));var rp=require(_0x18b0('0x4'));var moment=require(_0x18b0('0x5'));var BPromise=require(_0x18b0('0x6'));var Mustache=require('mustache');var util=require(_0x18b0('0x7'));var path=require(_0x18b0('0x8'));var sox=require(_0x18b0('0x9'));var csv=require(_0x18b0('0xa'));var ejs=require(_0x18b0('0xb'));var fs=require('fs');var _=require(_0x18b0('0xc'));var squel=require(_0x18b0('0xd'));var crypto=require(_0x18b0('0xe'));var jsforce=require(_0x18b0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x18b0('0xa'));var querystring=require(_0x18b0('0x10'));var Papa=require('papaparse');var Redis=require(_0x18b0('0x11'));var authService=require(_0x18b0('0x12'));var qs=require(_0x18b0('0x13'));var as=require(_0x18b0('0x14'));var hardwareService=require(_0x18b0('0x15'));var logger=require(_0x18b0('0x16'))('api');var utils=require(_0x18b0('0x17'));var config=require(_0x18b0('0x18'));var licenseUtil=require(_0x18b0('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2584e2,_0x31ef0a){_0x31ef0a=_0x31ef0a||0xcc;return function(_0x3969fc){if(_0x3969fc){return _0x2584e2['sendStatus'](_0x31ef0a);}return _0x2584e2[_0x18b0('0x1a')](_0x31ef0a)[_0x18b0('0x1b')]();};}function respondWithResult(_0x10224e,_0x56559b){_0x56559b=_0x56559b||0xc8;return function(_0x5cb481){if(_0x5cb481){return _0x10224e[_0x18b0('0x1a')](_0x56559b)[_0x18b0('0x1c')](_0x5cb481);}};}function respondWithFilteredResult(_0x19f718,_0x2d69a5){return function(_0x1a8088){if(_0x1a8088){var _0x54e6e0=_0x1a8088[_0x18b0('0x1d')],_0x48fe0d=_0x2d69a5[_0x18b0('0x1e')],_0x231f88=_0x2d69a5[_0x18b0('0x1e')]+_0x2d69a5[_0x18b0('0x1f')],_0x2542a9;if(_0x231f88>=_0x54e6e0){_0x231f88=_0x54e6e0;_0x2542a9=0xc8;}else{_0x2542a9=0xce;}_0x19f718[_0x18b0('0x1a')](_0x2542a9);return _0x19f718[_0x18b0('0x20')](_0x18b0('0x21'),_0x48fe0d+'-'+_0x231f88+'/'+_0x54e6e0)[_0x18b0('0x1c')](_0x1a8088);}return null;};}function patchUpdates(_0x565af3){return function(_0x120571){try{jsonpatch['apply'](_0x120571,_0x565af3,!![]);}catch(_0x756c45){return BPromise[_0x18b0('0x22')](_0x756c45);}return _0x120571[_0x18b0('0x23')]();};}function saveUpdates(_0xa21453,_0x577aff){return function(_0x3af5cd){if(_0x3af5cd){return _0x3af5cd['update'](_0xa21453)['then'](function(_0x55b4c1){return _0x55b4c1;});}return null;};}function removeEntity(_0x3c4c80,_0x25c2e7){return function(_0x176c8b){if(_0x176c8b){return _0x176c8b[_0x18b0('0x24')]()[_0x18b0('0x25')](function(){_0x3c4c80[_0x18b0('0x1a')](0xcc)[_0x18b0('0x1b')]();});}};}function handleEntityNotFound(_0x5d4349,_0x5ca333){return function(_0x405146){if(!_0x405146){_0x5d4349[_0x18b0('0x26')](0x194);}return _0x405146;};}function handleError(_0x48d872,_0x4e34c6){_0x4e34c6=_0x4e34c6||0x1f4;return function(_0x485b12){logger[_0x18b0('0x27')](_0x485b12['stack']);if(_0x485b12[_0x18b0('0x28')]){delete _0x485b12[_0x18b0('0x28')];}_0x48d872[_0x18b0('0x1a')](_0x4e34c6)[_0x18b0('0x29')](_0x485b12);};}exports[_0x18b0('0x2a')]=function(_0x174fca,_0x378344){var _0x4e649c={},_0x3ccafa={},_0x3097ca={'count':0x0,'rows':[]};var _0x574863=_['map'](db['IntegrationReport']['rawAttributes'],function(_0x18c233){return{'name':_0x18c233['fieldName'],'type':_0x18c233['type']['key']};});_0x3ccafa[_0x18b0('0x2b')]=_[_0x18b0('0x2c')](_0x574863,'name');_0x3ccafa[_0x18b0('0x2d')]=_[_0x18b0('0x2e')](_0x174fca[_0x18b0('0x2d')]);_0x3ccafa[_0x18b0('0x2f')]=_[_0x18b0('0x30')](_0x3ccafa[_0x18b0('0x2b')],_0x3ccafa['query']);_0x4e649c[_0x18b0('0x31')]=_[_0x18b0('0x30')](_0x3ccafa[_0x18b0('0x2b')],qs[_0x18b0('0x32')](_0x174fca['query'][_0x18b0('0x32')]));_0x4e649c[_0x18b0('0x31')]=_0x4e649c[_0x18b0('0x31')][_0x18b0('0x33')]?_0x4e649c[_0x18b0('0x31')]:_0x3ccafa[_0x18b0('0x2b')];if(!_0x174fca[_0x18b0('0x2d')]['hasOwnProperty'](_0x18b0('0x34'))){_0x4e649c[_0x18b0('0x1f')]=qs[_0x18b0('0x1f')](_0x174fca['query']['limit']);_0x4e649c[_0x18b0('0x1e')]=qs[_0x18b0('0x1e')](_0x174fca[_0x18b0('0x2d')][_0x18b0('0x1e')]);}_0x4e649c[_0x18b0('0x35')]=qs[_0x18b0('0x36')](_0x174fca[_0x18b0('0x2d')][_0x18b0('0x36')]);_0x4e649c['where']=qs['filters'](_[_0x18b0('0x37')](_0x174fca[_0x18b0('0x2d')],_0x3ccafa[_0x18b0('0x2f')]),_0x574863);if(_0x174fca['query'][_0x18b0('0x38')]){_0x4e649c[_0x18b0('0x39')]=_['merge'](_0x4e649c['where'],{'$or':_[_0x18b0('0x2c')](_0x574863,function(_0xe82284){if(_0xe82284['type']!=='VIRTUAL'){var _0x469e57={};_0x469e57[_0xe82284[_0x18b0('0x28')]]={'$like':'%'+_0x174fca[_0x18b0('0x2d')][_0x18b0('0x38')]+'%'};return _0x469e57;}})});}_0x4e649c=_[_0x18b0('0x3a')]({},_0x4e649c,_0x174fca[_0x18b0('0x3b')]);var _0x172ea1={'where':_0x4e649c['where']};return db[_0x18b0('0x3c')][_0x18b0('0x1d')](_0x172ea1)[_0x18b0('0x25')](function(_0x219353){_0x3097ca[_0x18b0('0x1d')]=_0x219353;if(_0x174fca[_0x18b0('0x2d')][_0x18b0('0x3d')]){_0x4e649c[_0x18b0('0x3e')]=[{'all':!![]}];}return db['IntegrationReport'][_0x18b0('0x3f')](_0x4e649c);})[_0x18b0('0x25')](function(_0x29493f){_0x3097ca[_0x18b0('0x40')]=_0x29493f;return _0x3097ca;})[_0x18b0('0x25')](respondWithFilteredResult(_0x378344,_0x4e649c))[_0x18b0('0x41')](handleError(_0x378344,null));};exports[_0x18b0('0x42')]=function(_0x21d995,_0x7eb582){var _0x24c9cb={'raw':![],'where':{'id':_0x21d995['params']['id']}},_0x3e520b={};_0x3e520b[_0x18b0('0x2b')]=_[_0x18b0('0x2e')](db[_0x18b0('0x3c')][_0x18b0('0x43')]);_0x3e520b['query']=_[_0x18b0('0x2e')](_0x21d995[_0x18b0('0x2d')]);_0x3e520b[_0x18b0('0x2f')]=_[_0x18b0('0x30')](_0x3e520b[_0x18b0('0x2b')],_0x3e520b[_0x18b0('0x2d')]);_0x24c9cb[_0x18b0('0x31')]=_[_0x18b0('0x30')](_0x3e520b[_0x18b0('0x2b')],qs[_0x18b0('0x32')](_0x21d995[_0x18b0('0x2d')][_0x18b0('0x32')]));_0x24c9cb[_0x18b0('0x31')]=_0x24c9cb[_0x18b0('0x31')][_0x18b0('0x33')]?_0x24c9cb['attributes']:_0x3e520b['model'];if(_0x21d995[_0x18b0('0x2d')][_0x18b0('0x3d')]){_0x24c9cb[_0x18b0('0x3e')]=[{'all':!![]}];}_0x24c9cb=_[_0x18b0('0x3a')]({},_0x24c9cb,_0x21d995[_0x18b0('0x3b')]);return db[_0x18b0('0x3c')][_0x18b0('0x44')](_0x24c9cb)[_0x18b0('0x25')](handleEntityNotFound(_0x7eb582,null))['then'](respondWithResult(_0x7eb582,null))['catch'](handleError(_0x7eb582,null));};exports[_0x18b0('0x45')]=function(_0x55c863,_0x2b748b){return db[_0x18b0('0x3c')][_0x18b0('0x45')](_0x55c863[_0x18b0('0x46')],{})['then'](respondWithResult(_0x2b748b,0xc9))['catch'](handleError(_0x2b748b,null));};exports[_0x18b0('0x47')]=function(_0x19b23e,_0x241806){if(_0x19b23e[_0x18b0('0x46')]['id']){delete _0x19b23e[_0x18b0('0x46')]['id'];}return db[_0x18b0('0x3c')][_0x18b0('0x44')]({'where':{'id':_0x19b23e[_0x18b0('0x48')]['id']}})[_0x18b0('0x25')](handleEntityNotFound(_0x241806,null))[_0x18b0('0x25')](saveUpdates(_0x19b23e[_0x18b0('0x46')],null))['then'](respondWithResult(_0x241806,null))[_0x18b0('0x41')](handleError(_0x241806,null));};exports['destroy']=function(_0x5ecca1,_0x55c98e){return db['IntegrationReport'][_0x18b0('0x44')]({'where':{'id':_0x5ecca1[_0x18b0('0x48')]['id']}})[_0x18b0('0x25')](handleEntityNotFound(_0x55c98e,null))[_0x18b0('0x25')](removeEntity(_0x55c98e,null))[_0x18b0('0x41')](handleError(_0x55c98e,null));};exports[_0x18b0('0x49')]=function(_0x5cba59,_0x4c5ccf){return db[_0x18b0('0x3c')][_0x18b0('0x49')]()[_0x18b0('0x25')](respondWithResult(_0x4c5ccf,null))['catch'](handleError(_0x4c5ccf,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index b5c158d..9c40702 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 _0x7506=['exports','report_integration','lodash','../../config/logger','api','moment','bluebird','../../config/environment','./integrationReport.attributes'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x7506,0x13d));var _0x6750=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x7506[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x6750('0x0'));var util=require('util');var logger=require(_0x6750('0x1'))(_0x6750('0x2'));var moment=require(_0x6750('0x3'));var BPromise=require(_0x6750('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6750('0x5'));var attributes=require(_0x6750('0x6'));module[_0x6750('0x7')]=function(_0x2365ec,_0x1ea8d1){return _0x2365ec['define']('IntegrationReport',attributes,{'tableName':_0x6750('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf535=['rimraf','../../config/environment','./integrationReport.attributes','exports','define','../../config/logger','api','moment','request-promise','path'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xf535,0x131));var _0x5f53=function(_0x3cf692,_0x513e7e){_0x3cf692=_0x3cf692-0x0;var _0x59cfed=_0xf535[_0x3cf692];return _0x59cfed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5f53('0x0'))(_0x5f53('0x1'));var moment=require(_0x5f53('0x2'));var BPromise=require('bluebird');var rp=require(_0x5f53('0x3'));var fs=require('fs');var path=require(_0x5f53('0x4'));var rimraf=require(_0x5f53('0x5'));var config=require(_0x5f53('0x6'));var attributes=require(_0x5f53('0x7'));module[_0x5f53('0x8')]=function(_0x52a8c0,_0x260f4d){return _0x52a8c0[_0x5f53('0x9')]('IntegrationReport',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 be8b8f2..ed19f89 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 _0x4fc2=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x4fc2,0x111));var _0x24fc=function(_0x552804,_0x3c3d1e){_0x552804=_0x552804-0x0;var _0x32be66=_0x4fc2[_0x552804];return _0x32be66;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});} \ No newline at end of file +var _0xb7e7=['IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\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(_0x10dc3d,_0x7ef242){var _0x57e271=function(_0x4022c8){while(--_0x4022c8){_0x10dc3d['push'](_0x10dc3d['shift']());}};_0x57e271(++_0x7ef242);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xb7e7[_0x1cb18a];return _0x22442e;};'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')]('IntegrationReport,\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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 426c263..373db84 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 _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x55ca,0x126));var _0xa55c=function(_0x49bfb8,_0x5b6e2b){_0x49bfb8=_0x49bfb8-0x0;var _0x1be0b7=_0x55ca[_0x49bfb8];return _0x1be0b7;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./interval.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0xe')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller['addInterval']);router[_0x7995('0xe')](_0x7995('0x10'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index e5660c3..1062c7e 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 _0xb114=['STRING','sequelize','exports'];(function(_0x2dd849,_0x3bd1bf){var _0x38ba4e=function(_0xd89ddc){while(--_0xd89ddc){_0x2dd849['push'](_0x2dd849['shift']());}};_0x38ba4e(++_0x3bd1bf);}(_0xb114,0x133));var _0x4b11=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xb114[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0x4b11('0x0'));module[_0x4b11('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4b11('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x7938=['sequelize','exports','STRING'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0x7938,0xd2));var _0x8793=function(_0x4fabae,_0x151606){_0x4fabae=_0x4fabae-0x0;var _0x22a03f=_0x7938[_0x4fabae];return _0x22a03f;};'use strict';var Sequelize=require(_0x8793('0x0'));module[_0x8793('0x1')]={'name':{'type':Sequelize[_0x8793('0x2')]},'description':{'type':Sequelize[_0x8793('0x2')]},'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 134739b..17be501 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 _0x54bb=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset','set','reject','update','destroy','then','get','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','getIntervals','addIntervals','sequelize','transaction','IntervalId','html-pdf','eml-format'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x54bb,0xb2));var _0xb54b=function(_0x5c43cf,_0x297c45){_0x5c43cf=_0x5c43cf-0x0;var _0x56a800=_0x54bb[_0x5c43cf];return _0x56a800;};'use strict';var pdf=require(_0xb54b('0x0'));var emlformat=require(_0xb54b('0x1'));var rimraf=require(_0xb54b('0x2'));var zipdir=require(_0xb54b('0x3'));var jsonpatch=require(_0xb54b('0x4'));var rp=require(_0xb54b('0x5'));var moment=require(_0xb54b('0x6'));var BPromise=require(_0xb54b('0x7'));var Mustache=require(_0xb54b('0x8'));var util=require('util');var path=require(_0xb54b('0x9'));var sox=require(_0xb54b('0xa'));var csv=require(_0xb54b('0xb'));var ejs=require(_0xb54b('0xc'));var fs=require('fs');var _=require(_0xb54b('0xd'));var squel=require('squel');var crypto=require(_0xb54b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb54b('0xf'));var Papa=require(_0xb54b('0x10'));var Redis=require(_0xb54b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb54b('0x12'));var as=require(_0xb54b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb54b('0x14'))(_0xb54b('0x15'));var utils=require('../../config/utils');var config=require(_0xb54b('0x16'));var licenseUtil=require(_0xb54b('0x17'));var db=require(_0xb54b('0x18'))['db'];var extensions=require(_0xb54b('0x19'));function respondWithStatusCode(_0x242b54,_0x497361){_0x497361=_0x497361||0xcc;return function(_0x365c47){if(_0x365c47){return _0x242b54[_0xb54b('0x1a')](_0x497361);}return _0x242b54[_0xb54b('0x1b')](_0x497361)[_0xb54b('0x1c')]();};}function respondWithResult(_0x28e271,_0xd9a765){_0xd9a765=_0xd9a765||0xc8;return function(_0x1f39bb){if(_0x1f39bb){return _0x28e271[_0xb54b('0x1b')](_0xd9a765)[_0xb54b('0x1d')](_0x1f39bb);}};}function respondWithFilteredResult(_0x480fd5,_0x4c1763){return function(_0x44b6f9){if(_0x44b6f9){var _0xa17ea0=_0x44b6f9[_0xb54b('0x1e')],_0x48757c=_0x4c1763[_0xb54b('0x1f')],_0x59e75f=_0x4c1763[_0xb54b('0x1f')]+_0x4c1763['limit'],_0x3e86cb;if(_0x59e75f>=_0xa17ea0){_0x59e75f=_0xa17ea0;_0x3e86cb=0xc8;}else{_0x3e86cb=0xce;}_0x480fd5[_0xb54b('0x1b')](_0x3e86cb);return _0x480fd5[_0xb54b('0x20')]('Content-Range',_0x48757c+'-'+_0x59e75f+'/'+_0xa17ea0)['json'](_0x44b6f9);}return null;};}function patchUpdates(_0x5cf144){return function(_0x277f8a){try{jsonpatch['apply'](_0x277f8a,_0x5cf144,!![]);}catch(_0x506eaf){return BPromise[_0xb54b('0x21')](_0x506eaf);}return _0x277f8a['save']();};}function saveUpdates(_0x3bd282,_0xed2b43){return function(_0x409836){if(_0x409836){return _0x409836[_0xb54b('0x22')](_0x3bd282)['then'](function(_0x6a00dc){return _0x6a00dc;});}return null;};}function removeEntity(_0x380ef1,_0x5e5627){return function(_0x470c3a){if(_0x470c3a){return _0x470c3a[_0xb54b('0x23')]()[_0xb54b('0x24')](function(){var _0x4d2876=_0x470c3a[_0xb54b('0x25')]({'plain':!![]});var _0x528373=_0xb54b('0x26');return db[_0xb54b('0x27')][_0xb54b('0x23')]({'where':{'type':_0x528373,'resourceId':_0x4d2876['id']}})[_0xb54b('0x24')](function(){return _0x470c3a;});})['then'](function(){_0x380ef1[_0xb54b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26371b,_0x5efb6b){return function(_0x4b110d){if(!_0x4b110d){_0x26371b[_0xb54b('0x1a')](0x194);}return _0x4b110d;};}function handleError(_0x18e1fe,_0x3c3fa3){_0x3c3fa3=_0x3c3fa3||0x1f4;return function(_0x2d8b62){logger[_0xb54b('0x28')](_0x2d8b62[_0xb54b('0x29')]);if(_0x2d8b62[_0xb54b('0x2a')]){delete _0x2d8b62[_0xb54b('0x2a')];}_0x18e1fe['status'](_0x3c3fa3)[_0xb54b('0x2b')](_0x2d8b62);};}exports[_0xb54b('0x2c')]=function(_0x3760f0,_0x4b25d7){var _0xd36f5f={},_0x1d8b7c={},_0x3372fe={'count':0x0,'rows':[]};var _0x2108cf=_[_0xb54b('0x2d')](db[_0xb54b('0x2e')]['rawAttributes'],function(_0x87ec7c){return{'name':_0x87ec7c['fieldName'],'type':_0x87ec7c[_0xb54b('0x2f')][_0xb54b('0x30')]};});_0x1d8b7c['model']=_['map'](_0x2108cf,'name');_0x1d8b7c[_0xb54b('0x31')]=_[_0xb54b('0x32')](_0x3760f0[_0xb54b('0x31')]);_0x1d8b7c[_0xb54b('0x33')]=_[_0xb54b('0x34')](_0x1d8b7c['model'],_0x1d8b7c[_0xb54b('0x31')]);_0xd36f5f[_0xb54b('0x35')]=_[_0xb54b('0x34')](_0x1d8b7c['model'],qs[_0xb54b('0x36')](_0x3760f0[_0xb54b('0x31')]['fields']));_0xd36f5f[_0xb54b('0x35')]=_0xd36f5f[_0xb54b('0x35')][_0xb54b('0x37')]?_0xd36f5f[_0xb54b('0x35')]:_0x1d8b7c[_0xb54b('0x38')];if(!_0x3760f0[_0xb54b('0x31')][_0xb54b('0x39')](_0xb54b('0x3a'))){_0xd36f5f[_0xb54b('0x3b')]=qs[_0xb54b('0x3b')](_0x3760f0['query'][_0xb54b('0x3b')]);_0xd36f5f[_0xb54b('0x1f')]=qs[_0xb54b('0x1f')](_0x3760f0[_0xb54b('0x31')][_0xb54b('0x1f')]);}_0xd36f5f[_0xb54b('0x3c')]=qs[_0xb54b('0x3d')](_0x3760f0[_0xb54b('0x31')][_0xb54b('0x3d')]);_0xd36f5f['where']=qs[_0xb54b('0x33')](_[_0xb54b('0x3e')](_0x3760f0[_0xb54b('0x31')],_0x1d8b7c[_0xb54b('0x33')]),_0x2108cf);if(_0x3760f0['query'][_0xb54b('0x3f')]){_0xd36f5f[_0xb54b('0x40')]=_['merge'](_0xd36f5f[_0xb54b('0x40')],{'$or':_[_0xb54b('0x2d')](_0x2108cf,function(_0x176aa5){if(_0x176aa5[_0xb54b('0x2f')]!==_0xb54b('0x41')){var _0x1c9889={};_0x1c9889[_0x176aa5[_0xb54b('0x2a')]]={'$like':'%'+_0x3760f0[_0xb54b('0x31')][_0xb54b('0x3f')]+'%'};return _0x1c9889;}})});}_0xd36f5f=_[_0xb54b('0x42')]({},_0xd36f5f,_0x3760f0[_0xb54b('0x43')]);var _0x4ea62a={'where':_0xd36f5f[_0xb54b('0x40')]};return db[_0xb54b('0x2e')][_0xb54b('0x1e')](_0x4ea62a)[_0xb54b('0x24')](function(_0x3f291b){_0x3372fe[_0xb54b('0x1e')]=_0x3f291b;if(_0x3760f0[_0xb54b('0x31')][_0xb54b('0x44')]){_0xd36f5f['include']=[{'all':!![]}];}return db['Interval'][_0xb54b('0x45')](_0xd36f5f);})['then'](function(_0x440286){_0x3372fe[_0xb54b('0x46')]=_0x440286;return _0x3372fe;})[_0xb54b('0x24')](respondWithFilteredResult(_0x4b25d7,_0xd36f5f))[_0xb54b('0x47')](handleError(_0x4b25d7,null));};exports[_0xb54b('0x48')]=function(_0x34ce2f,_0x55aa0a){var _0x22cae3={'raw':!![],'where':{'id':_0x34ce2f[_0xb54b('0x49')]['id']}},_0x407ca2={};_0x407ca2[_0xb54b('0x38')]=_[_0xb54b('0x32')](db[_0xb54b('0x2e')][_0xb54b('0x4a')]);_0x407ca2[_0xb54b('0x31')]=_['keys'](_0x34ce2f['query']);_0x407ca2[_0xb54b('0x33')]=_[_0xb54b('0x34')](_0x407ca2[_0xb54b('0x38')],_0x407ca2[_0xb54b('0x31')]);_0x22cae3['attributes']=_[_0xb54b('0x34')](_0x407ca2[_0xb54b('0x38')],qs[_0xb54b('0x36')](_0x34ce2f[_0xb54b('0x31')][_0xb54b('0x36')]));_0x22cae3[_0xb54b('0x35')]=_0x22cae3[_0xb54b('0x35')]['length']?_0x22cae3[_0xb54b('0x35')]:_0x407ca2[_0xb54b('0x38')];if(_0x34ce2f[_0xb54b('0x31')][_0xb54b('0x44')]){_0x22cae3['include']=[{'all':!![]}];}_0x22cae3=_['merge']({},_0x22cae3,_0x34ce2f[_0xb54b('0x43')]);return db[_0xb54b('0x2e')][_0xb54b('0x4b')](_0x22cae3)['then'](handleEntityNotFound(_0x55aa0a,null))[_0xb54b('0x24')](respondWithResult(_0x55aa0a,null))[_0xb54b('0x47')](handleError(_0x55aa0a,null));};exports['create']=function(_0x1cf9b7,_0x13c9cd){return db['Interval'][_0xb54b('0x4c')](_0x1cf9b7[_0xb54b('0x4d')],{})[_0xb54b('0x24')](function(_0x334a83){var _0x4471f7=_0x1cf9b7[_0xb54b('0x4e')]['get']({'plain':!![]});if(!_0x4471f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4471f7[_0xb54b('0x4f')]===_0xb54b('0x4e')){var _0x14d7a9=_0x334a83[_0xb54b('0x25')]({'plain':!![]});var _0x55ca5b=_0xb54b('0x26');return db[_0xb54b('0x50')][_0xb54b('0x4b')]({'where':{'name':_0x55ca5b,'userProfileId':_0x4471f7[_0xb54b('0x51')]},'raw':!![]})[_0xb54b('0x24')](function(_0x103aef){if(_0x103aef&&_0x103aef[_0xb54b('0x52')]===0x0){return db[_0xb54b('0x27')][_0xb54b('0x4c')]({'name':_0x14d7a9[_0xb54b('0x2a')],'resourceId':_0x14d7a9['id'],'type':_0x103aef[_0xb54b('0x2a')],'sectionId':_0x103aef['id']},{})['then'](function(){return _0x334a83;});}else{return _0x334a83;}})['catch'](function(_0x328458){logger[_0xb54b('0x28')](_0xb54b('0x53'),_0x328458);throw _0x328458;});}return _0x334a83;})[_0xb54b('0x24')](respondWithResult(_0x13c9cd,0xc9))[_0xb54b('0x47')](handleError(_0x13c9cd,null));};exports[_0xb54b('0x22')]=function(_0x526ed6,_0x508b9f){if(_0x526ed6[_0xb54b('0x4d')]['id']){delete _0x526ed6[_0xb54b('0x4d')]['id'];}return db['Interval'][_0xb54b('0x4b')]({'where':{'id':_0x526ed6[_0xb54b('0x49')]['id']}})[_0xb54b('0x24')](handleEntityNotFound(_0x508b9f,null))[_0xb54b('0x24')](saveUpdates(_0x526ed6['body'],null))[_0xb54b('0x24')](respondWithResult(_0x508b9f,null))[_0xb54b('0x47')](handleError(_0x508b9f,null));};exports[_0xb54b('0x23')]=function(_0x52301e,_0x57c2fe){return db['Interval'][_0xb54b('0x4b')]({'where':{'id':_0x52301e['params']['id']}})['then'](handleEntityNotFound(_0x57c2fe,null))[_0xb54b('0x24')](removeEntity(_0x57c2fe,null))[_0xb54b('0x47')](handleError(_0x57c2fe,null));};exports['addInterval']=function(_0x2d089e,_0x26dc04,_0x5d3877){if(_0x2d089e[_0xb54b('0x4d')]['id']){delete _0x2d089e[_0xb54b('0x4d')]['id'];}return db['Interval'][_0xb54b('0x4b')]({'where':{'id':_0x2d089e[_0xb54b('0x49')]['id']}})[_0xb54b('0x24')](handleEntityNotFound(_0x26dc04,null))[_0xb54b('0x24')](function(_0x317bb2){if(_0x317bb2){_0x2d089e[_0xb54b('0x4d')]['IntervalId']=_0x317bb2['id'];return db[_0xb54b('0x2e')][_0xb54b('0x4c')](_0x2d089e[_0xb54b('0x4d')]);}})['then'](respondWithResult(_0x26dc04,null))[_0xb54b('0x47')](handleError(_0x26dc04,null));};exports['getIntervals']=function(_0x4ffb50,_0x5ac314,_0x514062){var _0x3ebcbe={};var _0x26c98b={};var _0x140554;var _0x5cd887;return db['Interval'][_0xb54b('0x54')]({'where':{'id':_0x4ffb50['params']['id']}})[_0xb54b('0x24')](handleEntityNotFound(_0x5ac314,null))[_0xb54b('0x24')](function(_0x1677f6){if(_0x1677f6){_0x140554=_0x1677f6;_0x26c98b[_0xb54b('0x38')]=_[_0xb54b('0x32')](db['Interval'][_0xb54b('0x4a')]);_0x26c98b['query']=_[_0xb54b('0x32')](_0x4ffb50['query']);_0x26c98b['filters']=_['intersection'](_0x26c98b[_0xb54b('0x38')],_0x26c98b[_0xb54b('0x31')]);_0x3ebcbe[_0xb54b('0x35')]=_[_0xb54b('0x34')](_0x26c98b[_0xb54b('0x38')],qs[_0xb54b('0x36')](_0x4ffb50[_0xb54b('0x31')][_0xb54b('0x36')]));_0x3ebcbe[_0xb54b('0x35')]=_0x3ebcbe[_0xb54b('0x35')][_0xb54b('0x37')]?_0x3ebcbe[_0xb54b('0x35')]:_0x26c98b[_0xb54b('0x38')];_0x3ebcbe['order']=qs[_0xb54b('0x3d')](_0x4ffb50[_0xb54b('0x31')][_0xb54b('0x3d')]);_0x3ebcbe[_0xb54b('0x40')]=qs[_0xb54b('0x33')](_[_0xb54b('0x3e')](_0x4ffb50[_0xb54b('0x31')],_0x26c98b['filters']));if(_0x4ffb50[_0xb54b('0x31')][_0xb54b('0x3f')]){_0x3ebcbe[_0xb54b('0x40')]=_[_0xb54b('0x42')](_0x3ebcbe[_0xb54b('0x40')],{'$or':_[_0xb54b('0x2d')](_0x3ebcbe[_0xb54b('0x35')],function(_0x4fef64){var _0x33600e={};_0x33600e[_0x4fef64]={'$like':'%'+_0x4ffb50[_0xb54b('0x31')][_0xb54b('0x3f')]+'%'};return _0x33600e;})});}_0x3ebcbe=_[_0xb54b('0x42')]({},_0x3ebcbe,_0x4ffb50[_0xb54b('0x43')]);return _0x140554[_0xb54b('0x55')](_0x3ebcbe);}})['then'](function(_0x1947cf){if(_0x1947cf){_0x5cd887=_0x1947cf[_0xb54b('0x37')];if(!_0x4ffb50[_0xb54b('0x31')][_0xb54b('0x39')]('nolimit')){_0x3ebcbe['limit']=qs['limit'](_0x4ffb50[_0xb54b('0x31')][_0xb54b('0x3b')]);_0x3ebcbe[_0xb54b('0x1f')]=qs[_0xb54b('0x1f')](_0x4ffb50[_0xb54b('0x31')][_0xb54b('0x1f')]);}return _0x140554[_0xb54b('0x55')](_0x3ebcbe);}})[_0xb54b('0x24')](function(_0x612b87){if(_0x612b87){return _0x612b87?{'count':_0x5cd887,'rows':_0x612b87}:null;}})['then'](respondWithResult(_0x5ac314,null))[_0xb54b('0x47')](handleError(_0x5ac314,null));};exports[_0xb54b('0x56')]=function(_0x463f17,_0x5357a5,_0x5267db){return db[_0xb54b('0x2e')][_0xb54b('0x54')]({'where':{'id':_0x463f17[_0xb54b('0x49')]['id']}})[_0xb54b('0x24')](handleEntityNotFound(_0x5357a5,null))['then'](function(_0x998deb){if(_0x998deb){return db[_0xb54b('0x57')][_0xb54b('0x58')](function(_0x3a3421){return db[_0xb54b('0x2e')][_0xb54b('0x23')]({'where':{'IntervalId':_0x463f17[_0xb54b('0x49')]['id']},'transaction':_0x3a3421})[_0xb54b('0x24')](function(_0x10ab31){var _0x2f7c22=_[_0xb54b('0x2d')](_0x463f17[_0xb54b('0x4d')],function(_0x282c12){delete _0x282c12['id'];_0x282c12[_0xb54b('0x59')]=_0x463f17['params']['id'];return _0x282c12;});return db[_0xb54b('0x2e')]['bulkCreate'](_0x2f7c22,{'transaction':_0x3a3421});});})['then'](function(){return db['Interval'][_0xb54b('0x45')]({'where':{'IntervalId':_0x463f17[_0xb54b('0x49')]['id']}});});}})[_0xb54b('0x24')](respondWithResult(_0x5357a5,null))[_0xb54b('0x47')](handleError(_0x5357a5,null));}; \ No newline at end of file +var _0xc234=['../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','count','offset','set','apply','reject','save','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','Interval','includeAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','findOne','length','getIntervals','addIntervals','sequelize','transaction','findAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x307c29,_0xb42b86){var _0xb3b1b9=function(_0x192704){while(--_0x192704){_0x307c29['push'](_0x307c29['shift']());}};_0xb3b1b9(++_0xb42b86);}(_0xc234,0xa7));var _0x4c23=function(_0xe0011d,_0x4cd566){_0xe0011d=_0xe0011d-0x0;var _0x343a48=_0xc234[_0xe0011d];return _0x343a48;};'use strict';var pdf=require(_0x4c23('0x0'));var emlformat=require(_0x4c23('0x1'));var rimraf=require(_0x4c23('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c23('0x3'));var rp=require(_0x4c23('0x4'));var moment=require('moment');var BPromise=require(_0x4c23('0x5'));var Mustache=require(_0x4c23('0x6'));var util=require(_0x4c23('0x7'));var path=require(_0x4c23('0x8'));var sox=require(_0x4c23('0x9'));var csv=require(_0x4c23('0xa'));var ejs=require(_0x4c23('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4c23('0xc'));var crypto=require('crypto');var jsforce=require(_0x4c23('0xd'));var deskjs=require(_0x4c23('0xe'));var toCsv=require(_0x4c23('0xa'));var querystring=require(_0x4c23('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4c23('0x10'));var as=require(_0x4c23('0x11'));var hardwareService=require(_0x4c23('0x12'));var logger=require(_0x4c23('0x13'))(_0x4c23('0x14'));var utils=require(_0x4c23('0x15'));var config=require(_0x4c23('0x16'));var licenseUtil=require(_0x4c23('0x17'));var db=require(_0x4c23('0x18'))['db'];var extensions=require(_0x4c23('0x19'));function respondWithStatusCode(_0x57d5ba,_0x458edb){_0x458edb=_0x458edb||0xcc;return function(_0x1dab35){if(_0x1dab35){return _0x57d5ba[_0x4c23('0x1a')](_0x458edb);}return _0x57d5ba[_0x4c23('0x1b')](_0x458edb)['end']();};}function respondWithResult(_0x3fb292,_0x18816c){_0x18816c=_0x18816c||0xc8;return function(_0x4e2d66){if(_0x4e2d66){return _0x3fb292[_0x4c23('0x1b')](_0x18816c)[_0x4c23('0x1c')](_0x4e2d66);}};}function respondWithFilteredResult(_0x505321,_0x4068bd){return function(_0x18fbcf){if(_0x18fbcf){var _0x4d6489=_0x18fbcf[_0x4c23('0x1d')],_0x3f6874=_0x4068bd[_0x4c23('0x1e')],_0x1eba81=_0x4068bd[_0x4c23('0x1e')]+_0x4068bd['limit'],_0x3770d5;if(_0x1eba81>=_0x4d6489){_0x1eba81=_0x4d6489;_0x3770d5=0xc8;}else{_0x3770d5=0xce;}_0x505321[_0x4c23('0x1b')](_0x3770d5);return _0x505321[_0x4c23('0x1f')]('Content-Range',_0x3f6874+'-'+_0x1eba81+'/'+_0x4d6489)['json'](_0x18fbcf);}return null;};}function patchUpdates(_0x55e923){return function(_0x228512){try{jsonpatch[_0x4c23('0x20')](_0x228512,_0x55e923,!![]);}catch(_0x6f2f0e){return BPromise[_0x4c23('0x21')](_0x6f2f0e);}return _0x228512[_0x4c23('0x22')]();};}function saveUpdates(_0x4545d8,_0x32a5af){return function(_0x290769){if(_0x290769){return _0x290769['update'](_0x4545d8)[_0x4c23('0x23')](function(_0x45b4e9){return _0x45b4e9;});}return null;};}function removeEntity(_0x5794b4,_0x42236c){return function(_0x1e5f4d){if(_0x1e5f4d){return _0x1e5f4d[_0x4c23('0x24')]()[_0x4c23('0x23')](function(){var _0x35acfa=_0x1e5f4d[_0x4c23('0x25')]({'plain':!![]});var _0x351d18='Intervals';return db[_0x4c23('0x26')][_0x4c23('0x24')]({'where':{'type':_0x351d18,'resourceId':_0x35acfa['id']}})[_0x4c23('0x23')](function(){return _0x1e5f4d;});})[_0x4c23('0x23')](function(){_0x5794b4['status'](0xcc)[_0x4c23('0x27')]();});}};}function handleEntityNotFound(_0x250a6c,_0x25c521){return function(_0x1d6fab){if(!_0x1d6fab){_0x250a6c[_0x4c23('0x1a')](0x194);}return _0x1d6fab;};}function handleError(_0x1f2457,_0x29395a){_0x29395a=_0x29395a||0x1f4;return function(_0x1d192b){logger[_0x4c23('0x28')](_0x1d192b[_0x4c23('0x29')]);if(_0x1d192b[_0x4c23('0x2a')]){delete _0x1d192b[_0x4c23('0x2a')];}_0x1f2457[_0x4c23('0x1b')](_0x29395a)[_0x4c23('0x2b')](_0x1d192b);};}exports[_0x4c23('0x2c')]=function(_0x5cdb20,_0x185809){var _0xf69aef={},_0x379564={},_0x39a1dd={'count':0x0,'rows':[]};var _0x5d704d=_[_0x4c23('0x2d')](db['Interval'][_0x4c23('0x2e')],function(_0x4397c1){return{'name':_0x4397c1[_0x4c23('0x2f')],'type':_0x4397c1[_0x4c23('0x30')][_0x4c23('0x31')]};});_0x379564[_0x4c23('0x32')]=_[_0x4c23('0x2d')](_0x5d704d,'name');_0x379564[_0x4c23('0x33')]=_[_0x4c23('0x34')](_0x5cdb20['query']);_0x379564[_0x4c23('0x35')]=_[_0x4c23('0x36')](_0x379564[_0x4c23('0x32')],_0x379564[_0x4c23('0x33')]);_0xf69aef[_0x4c23('0x37')]=_[_0x4c23('0x36')](_0x379564[_0x4c23('0x32')],qs[_0x4c23('0x38')](_0x5cdb20[_0x4c23('0x33')]['fields']));_0xf69aef['attributes']=_0xf69aef['attributes']['length']?_0xf69aef[_0x4c23('0x37')]:_0x379564['model'];if(!_0x5cdb20[_0x4c23('0x33')][_0x4c23('0x39')](_0x4c23('0x3a'))){_0xf69aef[_0x4c23('0x3b')]=qs[_0x4c23('0x3b')](_0x5cdb20['query'][_0x4c23('0x3b')]);_0xf69aef[_0x4c23('0x1e')]=qs[_0x4c23('0x1e')](_0x5cdb20[_0x4c23('0x33')][_0x4c23('0x1e')]);}_0xf69aef[_0x4c23('0x3c')]=qs['sort'](_0x5cdb20[_0x4c23('0x33')][_0x4c23('0x3d')]);_0xf69aef['where']=qs[_0x4c23('0x35')](_[_0x4c23('0x3e')](_0x5cdb20[_0x4c23('0x33')],_0x379564[_0x4c23('0x35')]),_0x5d704d);if(_0x5cdb20[_0x4c23('0x33')][_0x4c23('0x3f')]){_0xf69aef[_0x4c23('0x40')]=_[_0x4c23('0x41')](_0xf69aef[_0x4c23('0x40')],{'$or':_['map'](_0x5d704d,function(_0x3344f7){if(_0x3344f7[_0x4c23('0x30')]!==_0x4c23('0x42')){var _0x449b9f={};_0x449b9f[_0x3344f7[_0x4c23('0x2a')]]={'$like':'%'+_0x5cdb20[_0x4c23('0x33')]['filter']+'%'};return _0x449b9f;}})});}_0xf69aef=_[_0x4c23('0x41')]({},_0xf69aef,_0x5cdb20['options']);var _0x9e8457={'where':_0xf69aef['where']};return db[_0x4c23('0x43')][_0x4c23('0x1d')](_0x9e8457)[_0x4c23('0x23')](function(_0x546ea2){_0x39a1dd['count']=_0x546ea2;if(_0x5cdb20[_0x4c23('0x33')][_0x4c23('0x44')]){_0xf69aef['include']=[{'all':!![]}];}return db[_0x4c23('0x43')]['findAll'](_0xf69aef);})[_0x4c23('0x23')](function(_0xae590f){_0x39a1dd[_0x4c23('0x45')]=_0xae590f;return _0x39a1dd;})['then'](respondWithFilteredResult(_0x185809,_0xf69aef))[_0x4c23('0x46')](handleError(_0x185809,null));};exports[_0x4c23('0x47')]=function(_0x46f2ef,_0x19f2f3){var _0x672636={'raw':!![],'where':{'id':_0x46f2ef[_0x4c23('0x48')]['id']}},_0x193afc={};_0x193afc[_0x4c23('0x32')]=_[_0x4c23('0x34')](db['Interval'][_0x4c23('0x2e')]);_0x193afc['query']=_[_0x4c23('0x34')](_0x46f2ef[_0x4c23('0x33')]);_0x193afc['filters']=_[_0x4c23('0x36')](_0x193afc[_0x4c23('0x32')],_0x193afc[_0x4c23('0x33')]);_0x672636['attributes']=_[_0x4c23('0x36')](_0x193afc[_0x4c23('0x32')],qs[_0x4c23('0x38')](_0x46f2ef[_0x4c23('0x33')]['fields']));_0x672636['attributes']=_0x672636['attributes']['length']?_0x672636[_0x4c23('0x37')]:_0x193afc[_0x4c23('0x32')];if(_0x46f2ef[_0x4c23('0x33')][_0x4c23('0x44')]){_0x672636['include']=[{'all':!![]}];}_0x672636=_[_0x4c23('0x41')]({},_0x672636,_0x46f2ef[_0x4c23('0x49')]);return db[_0x4c23('0x43')][_0x4c23('0x4a')](_0x672636)[_0x4c23('0x23')](handleEntityNotFound(_0x19f2f3,null))['then'](respondWithResult(_0x19f2f3,null))[_0x4c23('0x46')](handleError(_0x19f2f3,null));};exports[_0x4c23('0x4b')]=function(_0x27b41b,_0x2b0f31){return db['Interval'][_0x4c23('0x4b')](_0x27b41b[_0x4c23('0x4c')],{})[_0x4c23('0x23')](function(_0x4e5c3d){var _0x2f2ce0=_0x27b41b[_0x4c23('0x4d')][_0x4c23('0x25')]({'plain':!![]});if(!_0x2f2ce0)throw new Error(_0x4c23('0x4e'));if(_0x2f2ce0[_0x4c23('0x4f')]===_0x4c23('0x4d')){var _0x119258=_0x4e5c3d[_0x4c23('0x25')]({'plain':!![]});var _0x34a2cb=_0x4c23('0x50');return db[_0x4c23('0x51')][_0x4c23('0x4a')]({'where':{'name':_0x34a2cb,'userProfileId':_0x2f2ce0[_0x4c23('0x52')]},'raw':!![]})[_0x4c23('0x23')](function(_0x25e82e){if(_0x25e82e&&_0x25e82e[_0x4c23('0x53')]===0x0){return db[_0x4c23('0x26')][_0x4c23('0x4b')]({'name':_0x119258[_0x4c23('0x2a')],'resourceId':_0x119258['id'],'type':_0x25e82e[_0x4c23('0x2a')],'sectionId':_0x25e82e['id']},{})[_0x4c23('0x23')](function(){return _0x4e5c3d;});}else{return _0x4e5c3d;}})[_0x4c23('0x46')](function(_0x1b202e){logger['error'](_0x4c23('0x54'),_0x1b202e);throw _0x1b202e;});}return _0x4e5c3d;})[_0x4c23('0x23')](respondWithResult(_0x2b0f31,0xc9))['catch'](handleError(_0x2b0f31,null));};exports[_0x4c23('0x55')]=function(_0x3ecc67,_0x51c0a2){if(_0x3ecc67['body']['id']){delete _0x3ecc67[_0x4c23('0x4c')]['id'];}return db[_0x4c23('0x43')]['find']({'where':{'id':_0x3ecc67['params']['id']}})[_0x4c23('0x23')](handleEntityNotFound(_0x51c0a2,null))[_0x4c23('0x23')](saveUpdates(_0x3ecc67[_0x4c23('0x4c')],null))[_0x4c23('0x23')](respondWithResult(_0x51c0a2,null))['catch'](handleError(_0x51c0a2,null));};exports[_0x4c23('0x24')]=function(_0xb4544d,_0x1c9f91){return db['Interval'][_0x4c23('0x4a')]({'where':{'id':_0xb4544d[_0x4c23('0x48')]['id']}})[_0x4c23('0x23')](handleEntityNotFound(_0x1c9f91,null))[_0x4c23('0x23')](removeEntity(_0x1c9f91,null))[_0x4c23('0x46')](handleError(_0x1c9f91,null));};exports[_0x4c23('0x56')]=function(_0x5ea8f6,_0x150d7b,_0x5cf304){if(_0x5ea8f6['body']['id']){delete _0x5ea8f6[_0x4c23('0x4c')]['id'];}return db[_0x4c23('0x43')][_0x4c23('0x4a')]({'where':{'id':_0x5ea8f6[_0x4c23('0x48')]['id']}})[_0x4c23('0x23')](handleEntityNotFound(_0x150d7b,null))[_0x4c23('0x23')](function(_0x2aada1){if(_0x2aada1){_0x5ea8f6[_0x4c23('0x4c')][_0x4c23('0x57')]=_0x2aada1['id'];return db['Interval'][_0x4c23('0x4b')](_0x5ea8f6[_0x4c23('0x4c')]);}})[_0x4c23('0x23')](respondWithResult(_0x150d7b,null))['catch'](handleError(_0x150d7b,null));};exports['getIntervals']=function(_0xdfb2bb,_0x2f4b8a,_0x36db74){var _0x10d923={};var _0x2bef9f={};var _0x4add7a;var _0x57e18e;return db[_0x4c23('0x43')][_0x4c23('0x58')]({'where':{'id':_0xdfb2bb[_0x4c23('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f4b8a,null))['then'](function(_0xa3a2bc){if(_0xa3a2bc){_0x4add7a=_0xa3a2bc;_0x2bef9f['model']=_[_0x4c23('0x34')](db[_0x4c23('0x43')]['rawAttributes']);_0x2bef9f[_0x4c23('0x33')]=_[_0x4c23('0x34')](_0xdfb2bb[_0x4c23('0x33')]);_0x2bef9f['filters']=_[_0x4c23('0x36')](_0x2bef9f['model'],_0x2bef9f[_0x4c23('0x33')]);_0x10d923[_0x4c23('0x37')]=_[_0x4c23('0x36')](_0x2bef9f[_0x4c23('0x32')],qs[_0x4c23('0x38')](_0xdfb2bb[_0x4c23('0x33')]['fields']));_0x10d923['attributes']=_0x10d923[_0x4c23('0x37')]['length']?_0x10d923[_0x4c23('0x37')]:_0x2bef9f[_0x4c23('0x32')];_0x10d923[_0x4c23('0x3c')]=qs[_0x4c23('0x3d')](_0xdfb2bb[_0x4c23('0x33')][_0x4c23('0x3d')]);_0x10d923[_0x4c23('0x40')]=qs[_0x4c23('0x35')](_[_0x4c23('0x3e')](_0xdfb2bb[_0x4c23('0x33')],_0x2bef9f['filters']));if(_0xdfb2bb['query']['filter']){_0x10d923[_0x4c23('0x40')]=_[_0x4c23('0x41')](_0x10d923['where'],{'$or':_[_0x4c23('0x2d')](_0x10d923['attributes'],function(_0x26afd9){var _0x4c2ae1={};_0x4c2ae1[_0x26afd9]={'$like':'%'+_0xdfb2bb['query']['filter']+'%'};return _0x4c2ae1;})});}_0x10d923=_[_0x4c23('0x41')]({},_0x10d923,_0xdfb2bb['options']);return _0x4add7a['getIntervals'](_0x10d923);}})['then'](function(_0x4ac6bb){if(_0x4ac6bb){_0x57e18e=_0x4ac6bb[_0x4c23('0x59')];if(!_0xdfb2bb[_0x4c23('0x33')][_0x4c23('0x39')](_0x4c23('0x3a'))){_0x10d923[_0x4c23('0x3b')]=qs['limit'](_0xdfb2bb[_0x4c23('0x33')][_0x4c23('0x3b')]);_0x10d923[_0x4c23('0x1e')]=qs[_0x4c23('0x1e')](_0xdfb2bb[_0x4c23('0x33')]['offset']);}return _0x4add7a[_0x4c23('0x5a')](_0x10d923);}})[_0x4c23('0x23')](function(_0xff8d83){if(_0xff8d83){return _0xff8d83?{'count':_0x57e18e,'rows':_0xff8d83}:null;}})['then'](respondWithResult(_0x2f4b8a,null))[_0x4c23('0x46')](handleError(_0x2f4b8a,null));};exports[_0x4c23('0x5b')]=function(_0x936908,_0x5e7a84,_0x242e19){return db[_0x4c23('0x43')]['findOne']({'where':{'id':_0x936908[_0x4c23('0x48')]['id']}})[_0x4c23('0x23')](handleEntityNotFound(_0x5e7a84,null))[_0x4c23('0x23')](function(_0x19cb51){if(_0x19cb51){return db[_0x4c23('0x5c')][_0x4c23('0x5d')](function(_0xb51e1d){return db[_0x4c23('0x43')][_0x4c23('0x24')]({'where':{'IntervalId':_0x936908[_0x4c23('0x48')]['id']},'transaction':_0xb51e1d})[_0x4c23('0x23')](function(_0x329e1b){var _0x26ee6e=_[_0x4c23('0x2d')](_0x936908[_0x4c23('0x4c')],function(_0x40754c){delete _0x40754c['id'];_0x40754c[_0x4c23('0x57')]=_0x936908[_0x4c23('0x48')]['id'];return _0x40754c;});return db['Interval']['bulkCreate'](_0x26ee6e,{'transaction':_0xb51e1d});});})['then'](function(){return db[_0x4c23('0x43')][_0x4c23('0x5e')]({'where':{'IntervalId':_0x936908['params']['id']}});});}})[_0x4c23('0x23')](respondWithResult(_0x5e7a84,null))['catch'](handleError(_0x5e7a84,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index cdef6e7..5d09a2a 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 _0x3238=['rimraf','../../config/environment','exports','define','tools_intervals','rewrite','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x16bb0e,_0x343132){var _0x102b8b=function(_0x17a62b){while(--_0x17a62b){_0x16bb0e['push'](_0x16bb0e['shift']());}};_0x102b8b(++_0x343132);}(_0x3238,0x13e));var _0x8323=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3238[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8323('0x0'));var util=require('util');var logger=require(_0x8323('0x1'))(_0x8323('0x2'));var moment=require(_0x8323('0x3'));var BPromise=require('bluebird');var rp=require(_0x8323('0x4'));var fs=require('fs');var path=require(_0x8323('0x5'));var rimraf=require(_0x8323('0x6'));var config=require(_0x8323('0x7'));var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');module[_0x8323('0x8')]=function(_0x5544f9,_0x40b1f0){return _0x5544f9[_0x8323('0x9')]('Interval',attributes,{'tableName':_0x8323('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5950e2,_0x216dc5){extensions[_0x8323('0xb')](_0x5544f9,_0x5950e2);},'afterBulkCreate':function(_0x1577a6,_0x1009a4,_0x1a5373){_0x1a5373();extensions[_0x8323('0xb')](_0x5544f9,_0x1577a6[0x0]);},'afterUpdate':function(_0x46f52b,_0x2dce91){extensions['rewrite'](_0x5544f9,_0x46f52b);},'afterDestroy':function(_0x42ca90,_0x278933){extensions[_0x8323('0xb')](_0x5544f9,_0x42ca90);}}});}; \ No newline at end of file +var _0xbb84=['../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1cbbe9,_0x469c05){var _0x5c6a17=function(_0x146ddb){while(--_0x146ddb){_0x1cbbe9['push'](_0x1cbbe9['shift']());}};_0x5c6a17(++_0x469c05);}(_0xbb84,0x158));var _0x4bb8=function(_0x4b9f35,_0x287585){_0x4b9f35=_0x4b9f35-0x0;var _0x200ea1=_0xbb84[_0x4b9f35];return _0x200ea1;};'use strict';var _=require(_0x4bb8('0x0'));var util=require(_0x4bb8('0x1'));var logger=require(_0x4bb8('0x2'))(_0x4bb8('0x3'));var moment=require('moment');var BPromise=require(_0x4bb8('0x4'));var rp=require(_0x4bb8('0x5'));var fs=require('fs');var path=require(_0x4bb8('0x6'));var rimraf=require(_0x4bb8('0x7'));var config=require(_0x4bb8('0x8'));var attributes=require(_0x4bb8('0x9'));var extensions=require(_0x4bb8('0xa'));module[_0x4bb8('0xb')]=function(_0x14bf58,_0xa06ba6){return _0x14bf58[_0x4bb8('0xc')](_0x4bb8('0xd'),attributes,{'tableName':_0x4bb8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x366add,_0x233712){extensions[_0x4bb8('0xf')](_0x14bf58,_0x366add);},'afterBulkCreate':function(_0x13e692,_0x435072,_0x2f9dec){_0x2f9dec();extensions[_0x4bb8('0xf')](_0x14bf58,_0x13e692[0x0]);},'afterUpdate':function(_0x4a3625,_0x4051fa){extensions[_0x4bb8('0xf')](_0x14bf58,_0x4a3625);},'afterDestroy':function(_0xf99073,_0x12a614){extensions[_0x4bb8('0xf')](_0x14bf58,_0xf99073);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index d6d114c..a170d81 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 _0x4e63=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetInterval','Interval','findAll','options','raw','attributes','include','map','model','ShowInterval','find','where','lodash','util','moment','bluebird'];(function(_0x3ef777,_0x69c304){var _0x1bb655=function(_0xd72f1d){while(--_0xd72f1d){_0x3ef777['push'](_0x3ef777['shift']());}};_0x1bb655(++_0x69c304);}(_0x4e63,0xce));var _0x34e6=function(_0x24f528,_0x135b93){_0x24f528=_0x24f528-0x0;var _0x444234=_0x4e63[_0x24f528];return _0x444234;};'use strict';var _=require(_0x34e6('0x0'));var util=require(_0x34e6('0x1'));var moment=require(_0x34e6('0x2'));var BPromise=require(_0x34e6('0x3'));var rs=require(_0x34e6('0x4'));var fs=require('fs');var Redis=require(_0x34e6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x34e6('0x6'));var logger=require('../../config/logger')(_0x34e6('0x7'));var config=require(_0x34e6('0x8'));var jayson=require(_0x34e6('0x9'));var client=jayson[_0x34e6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe999e6,_0x35696b,_0x511d8d){return new BPromise(function(_0x5796cf,_0x12554d){return client['request'](_0xe999e6,_0x511d8d)[_0x34e6('0xb')](function(_0x5468c0){logger[_0x34e6('0xc')](_0x34e6('0xd'),_0x35696b,'request\x20sent');logger[_0x34e6('0xe')](_0x34e6('0xf'),_0x35696b,_0x34e6('0x10'),JSON[_0x34e6('0x11')](_0x5468c0));if(_0x5468c0['error']){if(_0x5468c0['error'][_0x34e6('0x12')]===0x1f4){logger[_0x34e6('0x13')]('Interval,\x20%s,\x20%s',_0x35696b,_0x5468c0['error'][_0x34e6('0x14')]);return _0x12554d(_0x5468c0[_0x34e6('0x13')][_0x34e6('0x14')]);}logger[_0x34e6('0x13')](_0x34e6('0xd'),_0x35696b,_0x5468c0[_0x34e6('0x13')][_0x34e6('0x14')]);return _0x5796cf(_0x5468c0[_0x34e6('0x13')][_0x34e6('0x14')]);}else{logger['info']('Interval,\x20%s,\x20%s',_0x35696b,_0x34e6('0x10'));_0x5796cf(_0x5468c0[_0x34e6('0x15')][_0x34e6('0x14')]);}})[_0x34e6('0x16')](function(_0x280379){logger['error'](_0x34e6('0xd'),_0x35696b,_0x280379);_0x12554d(_0x280379);});});}exports[_0x34e6('0x17')]=function(_0x18a739){var _0x2f08b8=this;return new Promise(function(_0x5d9ac5,_0x23d9c0){return db[_0x34e6('0x18')][_0x34e6('0x19')]({'raw':_0x18a739['options']?_0x18a739[_0x34e6('0x1a')][_0x34e6('0x1b')]===undefined?!![]:![]:!![],'where':_0x18a739['options']?_0x18a739[_0x34e6('0x1a')]['where']||null:null,'attributes':_0x18a739['options']?_0x18a739[_0x34e6('0x1a')][_0x34e6('0x1c')]||null:null,'limit':_0x18a739['options']?_0x18a739[_0x34e6('0x1a')]['limit']||null:null,'include':_0x18a739['options']?_0x18a739['options'][_0x34e6('0x1d')]?_[_0x34e6('0x1e')](_0x18a739[_0x34e6('0x1a')][_0x34e6('0x1d')],function(_0x5e1a73){return{'model':db[_0x5e1a73[_0x34e6('0x1f')]],'as':_0x5e1a73['as'],'attributes':_0x5e1a73[_0x34e6('0x1c')],'include':_0x5e1a73[_0x34e6('0x1d')]?_[_0x34e6('0x1e')](_0x5e1a73[_0x34e6('0x1d')],function(_0x464791){return{'model':db[_0x464791['model']],'as':_0x464791['as'],'attributes':_0x464791[_0x34e6('0x1c')],'include':_0x464791['include']?_['map'](_0x464791[_0x34e6('0x1d')],function(_0x45e1f3){return{'model':db[_0x45e1f3['model']],'as':_0x45e1f3['as'],'attributes':_0x45e1f3['attributes']};}):[]};}):[]};}):[]:[]})[_0x34e6('0xb')](function(_0x5959c5){logger[_0x34e6('0xc')](_0x34e6('0x17'),_0x18a739);logger[_0x34e6('0xe')](_0x34e6('0x17'),_0x18a739,JSON[_0x34e6('0x11')](_0x5959c5));_0x5d9ac5(_0x5959c5);})['catch'](function(_0x52bdd9){logger['error'](_0x34e6('0x17'),_0x52bdd9['message'],_0x18a739);_0x23d9c0(_0x2f08b8[_0x34e6('0x13')](0x1f4,_0x52bdd9[_0x34e6('0x14')]));});});};exports[_0x34e6('0x20')]=function(_0x5b1d95){var _0x4691e3=this;return new Promise(function(_0x374b21,_0x3630ba){return db['Interval'][_0x34e6('0x21')]({'raw':_0x5b1d95[_0x34e6('0x1a')]?_0x5b1d95[_0x34e6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5b1d95[_0x34e6('0x1a')]?_0x5b1d95[_0x34e6('0x1a')][_0x34e6('0x22')]||null:null,'attributes':_0x5b1d95['options']?_0x5b1d95[_0x34e6('0x1a')][_0x34e6('0x1c')]||null:null,'include':_0x5b1d95[_0x34e6('0x1a')]?_0x5b1d95[_0x34e6('0x1a')][_0x34e6('0x1d')]?_[_0x34e6('0x1e')](_0x5b1d95[_0x34e6('0x1a')][_0x34e6('0x1d')],function(_0x5e85a8){return{'model':db[_0x5e85a8[_0x34e6('0x1f')]],'as':_0x5e85a8['as'],'attributes':_0x5e85a8[_0x34e6('0x1c')],'include':_0x5e85a8[_0x34e6('0x1d')]?_[_0x34e6('0x1e')](_0x5e85a8[_0x34e6('0x1d')],function(_0x389917){return{'model':db[_0x389917['model']],'as':_0x389917['as'],'attributes':_0x389917[_0x34e6('0x1c')],'include':_0x389917[_0x34e6('0x1d')]?_[_0x34e6('0x1e')](_0x389917[_0x34e6('0x1d')],function(_0x336b38){return{'model':db[_0x336b38[_0x34e6('0x1f')]],'as':_0x336b38['as'],'attributes':_0x336b38[_0x34e6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x34e6('0xb')](function(_0x1ad468){logger['info']('ShowInterval',_0x5b1d95);logger[_0x34e6('0xe')](_0x34e6('0x20'),_0x5b1d95,JSON['stringify'](_0x1ad468));_0x374b21(_0x1ad468);})[_0x34e6('0x16')](function(_0x4e2b07){logger['error']('ShowInterval',_0x4e2b07['message'],_0x5b1d95);_0x3630ba(_0x4691e3[_0x34e6('0x13')](0x1f4,_0x4e2b07[_0x34e6('0x14')]));});});}; \ No newline at end of file +var _0xdd7e=['message','result','catch','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','ShowInterval','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5c67dc,_0x458df5){var _0x2d1529=function(_0x54eaa1){while(--_0x54eaa1){_0x5c67dc['push'](_0x5c67dc['shift']());}};_0x2d1529(++_0x458df5);}(_0xdd7e,0xc4));var _0xedd7=function(_0x184a26,_0x4bc933){_0x184a26=_0x184a26-0x0;var _0x12de47=_0xdd7e[_0x184a26];return _0x12de47;};'use strict';var _=require('lodash');var util=require(_0xedd7('0x0'));var moment=require(_0xedd7('0x1'));var BPromise=require(_0xedd7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedd7('0x3'));var db=require(_0xedd7('0x4'))['db'];var utils=require(_0xedd7('0x5'));var logger=require(_0xedd7('0x6'))(_0xedd7('0x7'));var config=require(_0xedd7('0x8'));var jayson=require(_0xedd7('0x9'));var client=jayson[_0xedd7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3589b3,_0x103da1,_0x413639){return new BPromise(function(_0x3c9232,_0x176207){return client[_0xedd7('0xb')](_0x3589b3,_0x413639)[_0xedd7('0xc')](function(_0x430caf){logger[_0xedd7('0xd')](_0xedd7('0xe'),_0x103da1,_0xedd7('0xf'));logger[_0xedd7('0x10')](_0xedd7('0x11'),_0x103da1,_0xedd7('0xf'),JSON[_0xedd7('0x12')](_0x430caf));if(_0x430caf[_0xedd7('0x13')]){if(_0x430caf['error']['code']===0x1f4){logger['error'](_0xedd7('0xe'),_0x103da1,_0x430caf[_0xedd7('0x13')][_0xedd7('0x14')]);return _0x176207(_0x430caf['error'][_0xedd7('0x14')]);}logger[_0xedd7('0x13')](_0xedd7('0xe'),_0x103da1,_0x430caf[_0xedd7('0x13')][_0xedd7('0x14')]);return _0x3c9232(_0x430caf['error']['message']);}else{logger['info'](_0xedd7('0xe'),_0x103da1,'request\x20sent');_0x3c9232(_0x430caf[_0xedd7('0x15')]['message']);}})[_0xedd7('0x16')](function(_0x30b102){logger[_0xedd7('0x13')](_0xedd7('0xe'),_0x103da1,_0x30b102);_0x176207(_0x30b102);});});}exports[_0xedd7('0x17')]=function(_0x1f86fa){var _0x31cc6f=this;return new Promise(function(_0x34c3f1,_0xdf4e93){return db[_0xedd7('0x18')][_0xedd7('0x19')]({'raw':_0x1f86fa[_0xedd7('0x1a')]?_0x1f86fa[_0xedd7('0x1a')][_0xedd7('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f86fa[_0xedd7('0x1a')]?_0x1f86fa[_0xedd7('0x1a')][_0xedd7('0x1c')]||null:null,'attributes':_0x1f86fa[_0xedd7('0x1a')]?_0x1f86fa['options'][_0xedd7('0x1d')]||null:null,'limit':_0x1f86fa[_0xedd7('0x1a')]?_0x1f86fa[_0xedd7('0x1a')][_0xedd7('0x1e')]||null:null,'include':_0x1f86fa[_0xedd7('0x1a')]?_0x1f86fa[_0xedd7('0x1a')][_0xedd7('0x1f')]?_[_0xedd7('0x20')](_0x1f86fa['options'][_0xedd7('0x1f')],function(_0x1eebd5){return{'model':db[_0x1eebd5[_0xedd7('0x21')]],'as':_0x1eebd5['as'],'attributes':_0x1eebd5[_0xedd7('0x1d')],'include':_0x1eebd5[_0xedd7('0x1f')]?_[_0xedd7('0x20')](_0x1eebd5['include'],function(_0x1e0ce5){return{'model':db[_0x1e0ce5[_0xedd7('0x21')]],'as':_0x1e0ce5['as'],'attributes':_0x1e0ce5['attributes'],'include':_0x1e0ce5['include']?_[_0xedd7('0x20')](_0x1e0ce5[_0xedd7('0x1f')],function(_0x3d4ef5){return{'model':db[_0x3d4ef5[_0xedd7('0x21')]],'as':_0x3d4ef5['as'],'attributes':_0x3d4ef5[_0xedd7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xedd7('0xc')](function(_0x5a7d2c){logger[_0xedd7('0xd')](_0xedd7('0x17'),_0x1f86fa);logger[_0xedd7('0x10')](_0xedd7('0x17'),_0x1f86fa,JSON[_0xedd7('0x12')](_0x5a7d2c));_0x34c3f1(_0x5a7d2c);})[_0xedd7('0x16')](function(_0x31007d){logger[_0xedd7('0x13')]('GetInterval',_0x31007d[_0xedd7('0x14')],_0x1f86fa);_0xdf4e93(_0x31cc6f['error'](0x1f4,_0x31007d[_0xedd7('0x14')]));});});};exports[_0xedd7('0x22')]=function(_0x48a99e){var _0x38d060=this;return new Promise(function(_0x362a2d,_0xbb5c19){return db[_0xedd7('0x18')][_0xedd7('0x23')]({'raw':_0x48a99e[_0xedd7('0x1a')]?_0x48a99e[_0xedd7('0x1a')][_0xedd7('0x1b')]===undefined?!![]:![]:!![],'where':_0x48a99e[_0xedd7('0x1a')]?_0x48a99e[_0xedd7('0x1a')][_0xedd7('0x1c')]||null:null,'attributes':_0x48a99e[_0xedd7('0x1a')]?_0x48a99e['options']['attributes']||null:null,'include':_0x48a99e[_0xedd7('0x1a')]?_0x48a99e['options'][_0xedd7('0x1f')]?_[_0xedd7('0x20')](_0x48a99e[_0xedd7('0x1a')][_0xedd7('0x1f')],function(_0x239a33){return{'model':db[_0x239a33[_0xedd7('0x21')]],'as':_0x239a33['as'],'attributes':_0x239a33[_0xedd7('0x1d')],'include':_0x239a33[_0xedd7('0x1f')]?_['map'](_0x239a33['include'],function(_0x423c12){return{'model':db[_0x423c12[_0xedd7('0x21')]],'as':_0x423c12['as'],'attributes':_0x423c12[_0xedd7('0x1d')],'include':_0x423c12[_0xedd7('0x1f')]?_[_0xedd7('0x20')](_0x423c12[_0xedd7('0x1f')],function(_0x457b53){return{'model':db[_0x457b53[_0xedd7('0x21')]],'as':_0x457b53['as'],'attributes':_0x457b53['attributes']};}):[]};}):[]};}):[]:[]})[_0xedd7('0xc')](function(_0x9e1a89){logger['info']('ShowInterval',_0x48a99e);logger[_0xedd7('0x10')](_0xedd7('0x22'),_0x48a99e,JSON['stringify'](_0x9e1a89));_0x362a2d(_0x9e1a89);})[_0xedd7('0x16')](function(_0x1b51bb){logger['error'](_0xedd7('0x22'),_0x1b51bb[_0xedd7('0x14')],_0x48a99e);_0xbb5c19(_0x38d060[_0xedd7('0x13')](0x1f4,_0x1b51bb['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index c2a7230..9cba4c1 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 _0xd0e3=['./jira.controller','post','isAuthenticated','send','express'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xd0e3,0xd6));var _0x3d0e=function(_0x33898e,_0x1e994c){_0x33898e=_0x33898e-0x0;var _0x2465f4=_0xd0e3[_0x33898e];return _0x2465f4;};'use strict';var express=require(_0x3d0e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x3d0e('0x1'));router[_0x3d0e('0x2')]('/',auth[_0x3d0e('0x3')](),controller[_0x3d0e('0x4')]);module['exports']=router; \ No newline at end of file +var _0xf089=['../../components/auth/service','./jira.controller','post','isAuthenticated','send','Router'];(function(_0x1cbe6b,_0x6d9f2){var _0x23e9a8=function(_0x1bd59e){while(--_0x1bd59e){_0x1cbe6b['push'](_0x1cbe6b['shift']());}};_0x23e9a8(++_0x6d9f2);}(_0xf089,0x1a9));var _0x9f08=function(_0x1433bc,_0x198516){_0x1433bc=_0x1433bc-0x0;var _0x520740=_0xf089[_0x1433bc];return _0x520740;};'use strict';var express=require('express');var router=express[_0x9f08('0x0')]();var auth=require(_0x9f08('0x1'));var controller=require(_0x9f08('0x2'));router[_0x9f08('0x3')]('/',auth[_0x9f08('0x4')](),controller[_0x9f08('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index f84ea13..6417625 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 _0x15bf=['/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','utf8','data','end','statusCode','json','parse','error','status','api.jira','write','send','body','headers','connection','remoteAddress','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','reason','customfield_10102','track.xcallymotion.com'];(function(_0x463410,_0x51753a){var _0x375cda=function(_0x2de994){while(--_0x2de994){_0x463410['push'](_0x463410['shift']());}};_0x375cda(++_0x51753a);}(_0x15bf,0x9e));var _0xf15b=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x15bf[_0xf79bae];return _0x5d2cb7;};'use strict';var BPromise=require(_0xf15b('0x0'));var https=require(_0xf15b('0x1'));var logger=require(_0xf15b('0x2'))('api');var USERNAME=_0xf15b('0x3');var PASSWORD=_0xf15b('0x4');function openIssue(_0x2de900,_0x2dee10){var _0x3eaa5b={'fields':{'project':{'key':_0x2de900[_0xf15b('0x5')]||_0xf15b('0x6')},'summary':(_0x2de900[_0xf15b('0x7')]||_0xf15b('0x8'))+'\x20from\x20'+_0x2de900['ip'],'description':_0x2de900[_0xf15b('0x9')]||JSON['stringify'](_0x2de900),'issuetype':{'name':_0x2de900[_0xf15b('0xa')]||'Bug'}}};_0x3eaa5b[_0xf15b('0xb')][_0xf15b('0xc')]=_0x2de900[_0xf15b('0xd')];_0x3eaa5b[_0xf15b('0xb')][_0xf15b('0xe')]=_0x2de900[_0xf15b('0xf')];_0x3eaa5b['fields'][_0xf15b('0x10')]=_0x2de900[_0xf15b('0x11')];_0x3eaa5b[_0xf15b('0xb')][_0xf15b('0x12')]=_0x2de900['name'];_0x3eaa5b[_0xf15b('0xb')]['customfield_11504']=_0x2de900[_0xf15b('0x13')];_0x3eaa5b[_0xf15b('0xb')][_0xf15b('0x14')]=_0x2de900['ip'];var _0x3d79fa={'host':_0xf15b('0x15'),'port':0x1bb,'path':_0xf15b('0x16'),'method':_0xf15b('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xf15b('0x18'),'Authorization':_0xf15b('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xf15b('0x1a')](_0xf15b('0x1b'))}};var _0x2c673a=JSON[_0xf15b('0x1c')](_0x3eaa5b);var _0x38b3f9=https[_0xf15b('0x1d')](_0x3d79fa,function(_0x539849){_0x539849['setEncoding'](_0xf15b('0x1e'));var _0x22d532='';_0x539849['on'](_0xf15b('0x1f'),function(_0x3856c8){_0x22d532+=_0x3856c8;});_0x539849['on'](_0xf15b('0x20'),function(){if(_0x2dee10){return _0x2dee10['status'](_0x539849[_0xf15b('0x21')])[_0xf15b('0x22')](JSON[_0xf15b('0x23')](_0x22d532));}});});_0x38b3f9['on'](_0xf15b('0x24'),function(_0x589708){if(_0x2dee10){return _0x2dee10[_0xf15b('0x25')](0x1f4)[_0xf15b('0x22')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xf15b('0x26')}]});}});_0x38b3f9[_0xf15b('0x27')](_0x2c673a);_0x38b3f9[_0xf15b('0x20')]();}exports['openIssue']=openIssue;exports[_0xf15b('0x28')]=function(_0x2af6de,_0x3a7454){_0x2af6de[_0xf15b('0x29')]['ip']=_0x2af6de[_0xf15b('0x2a')]['x-forwarded-for']||_0x2af6de[_0xf15b('0x2b')][_0xf15b('0x2c')]||_0x2af6de['socket'][_0xf15b('0x2c')]||_0x2af6de[_0xf15b('0x2b')]['socket'][_0xf15b('0x2c')];return openIssue(_0x2af6de[_0xf15b('0x29')],_0x3a7454);}; \ No newline at end of file +var _0x2aa2=['request','setEncoding','utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','customfield_11501','fields','customfield_11503','name','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x2aa2,0x1b7));var _0x22aa=function(_0x432085,_0x5deb15){_0x432085=_0x432085-0x0;var _0x181adf=_0x2aa2[_0x432085];return _0x181adf;};'use strict';var BPromise=require(_0x22aa('0x0'));var https=require(_0x22aa('0x1'));var logger=require(_0x22aa('0x2'))(_0x22aa('0x3'));var USERNAME='support';var PASSWORD=_0x22aa('0x4');function openIssue(_0x28fd88,_0x297c53){var _0xe3ab93={'fields':{'project':{'key':_0x28fd88['key']||_0x22aa('0x5')},'summary':(_0x28fd88['summary']||_0x22aa('0x6'))+_0x22aa('0x7')+_0x28fd88['ip'],'description':_0x28fd88[_0x22aa('0x8')]||JSON[_0x22aa('0x9')](_0x28fd88),'issuetype':{'name':_0x28fd88[_0x22aa('0xa')]||_0x22aa('0xb')}}};_0xe3ab93['fields'][_0x22aa('0xc')]=_0x28fd88['email'];_0xe3ab93['fields'][_0x22aa('0xd')]=_0x28fd88['oldToken'];_0xe3ab93[_0x22aa('0xe')]['customfield_11502']=_0x28fd88['newToken'];_0xe3ab93['fields'][_0x22aa('0xf')]=_0x28fd88[_0x22aa('0x10')];_0xe3ab93['fields']['customfield_11504']=_0x28fd88['reason'];_0xe3ab93[_0x22aa('0xe')]['customfield_10102']=_0x28fd88['ip'];var _0x532901={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x22aa('0x11'),'method':_0x22aa('0x12'),'timeout':0x4e20,'headers':{'Content-Type':_0x22aa('0x13'),'Authorization':_0x22aa('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0x22aa('0x15')](_0x22aa('0x16'))}};var _0x180452=JSON['stringify'](_0xe3ab93);var _0x211d24=https[_0x22aa('0x17')](_0x532901,function(_0x4f424f){_0x4f424f[_0x22aa('0x18')](_0x22aa('0x19'));var _0xcfc23a='';_0x4f424f['on'](_0x22aa('0x1a'),function(_0x350b28){_0xcfc23a+=_0x350b28;});_0x4f424f['on'](_0x22aa('0x1b'),function(){if(_0x297c53){return _0x297c53[_0x22aa('0x1c')](_0x4f424f['statusCode'])[_0x22aa('0x1d')](JSON[_0x22aa('0x1e')](_0xcfc23a));}});});_0x211d24['on'](_0x22aa('0x1f'),function(_0x4ba959){if(_0x297c53){return _0x297c53[_0x22aa('0x1c')](0x1f4)[_0x22aa('0x1d')]({'errors':[{'message':_0x22aa('0x20'),'type':_0x22aa('0x21')}]});}});_0x211d24[_0x22aa('0x22')](_0x180452);_0x211d24['end']();}exports[_0x22aa('0x23')]=openIssue;exports[_0x22aa('0x24')]=function(_0x3f35ec,_0x4864c0){_0x3f35ec[_0x22aa('0x25')]['ip']=_0x3f35ec[_0x22aa('0x26')]['x-forwarded-for']||_0x3f35ec[_0x22aa('0x27')][_0x22aa('0x28')]||_0x3f35ec[_0x22aa('0x29')][_0x22aa('0x28')]||_0x3f35ec[_0x22aa('0x27')][_0x22aa('0x29')][_0x22aa('0x28')];return openIssue(_0x3f35ec[_0x22aa('0x25')],_0x4864c0);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 98c92d0..0711e11 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 _0x97b5=['../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x4333b0,_0x50a2d2){var _0x4541db=function(_0x3cddb6){while(--_0x3cddb6){_0x4333b0['push'](_0x4333b0['shift']());}};_0x4541db(++_0x50a2d2);}(_0x97b5,0x100));var _0x597b=function(_0x441489,_0x5a2be1){_0x441489=_0x441489-0x0;var _0x37411f=_0x97b5[_0x441489];return _0x37411f;};'use strict';var multer=require(_0x597b('0x0'));var util=require(_0x597b('0x1'));var path=require('path');var timeout=require(_0x597b('0x2'));var express=require('express');var router=express[_0x597b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x597b('0x4'));var config=require('../../config/environment');var controller=require(_0x597b('0x5'));router[_0x597b('0x6')]('/',auth[_0x597b('0x7')](),controller[_0x597b('0x8')]);router[_0x597b('0x6')](_0x597b('0x9'),auth[_0x597b('0x7')](),controller[_0x597b('0xa')]);router['get'](_0x597b('0xb'),auth[_0x597b('0x7')](),controller[_0x597b('0xc')]);router[_0x597b('0xd')]('/',auth[_0x597b('0x7')](),controller[_0x597b('0xe')]);router[_0x597b('0xf')](_0x597b('0xb'),auth['isAuthenticated'](),controller[_0x597b('0x10')]);router[_0x597b('0x11')]('/:id',auth[_0x597b('0x7')](),controller[_0x597b('0x12')]);module[_0x597b('0x13')]=router; \ No newline at end of file +var _0xc44c=['../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xc44c,0x100));var _0xcc44=function(_0x5abc2a,_0x3e7b39){_0x5abc2a=_0x5abc2a-0x0;var _0x22ff10=_0xc44c[_0x5abc2a];return _0x22ff10;};'use strict';var multer=require(_0xcc44('0x0'));var util=require(_0xcc44('0x1'));var path=require(_0xcc44('0x2'));var timeout=require(_0xcc44('0x3'));var express=require(_0xcc44('0x4'));var router=express[_0xcc44('0x5')]();var auth=require(_0xcc44('0x6'));var interaction=require(_0xcc44('0x7'));var config=require(_0xcc44('0x8'));var controller=require(_0xcc44('0x9'));router[_0xcc44('0xa')]('/',auth[_0xcc44('0xb')](),controller[_0xcc44('0xc')]);router['get'](_0xcc44('0xd'),auth[_0xcc44('0xb')](),controller[_0xcc44('0xe')]);router['get'](_0xcc44('0xf'),auth[_0xcc44('0xb')](),controller['show']);router[_0xcc44('0x10')]('/',auth[_0xcc44('0xb')](),controller[_0xcc44('0x11')]);router[_0xcc44('0x12')](_0xcc44('0xf'),auth[_0xcc44('0xb')](),controller[_0xcc44('0x13')]);router[_0xcc44('0x14')](_0xcc44('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xcc44('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 220ba4b..5acef0c 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 _0xe857=['exports','STRING','sequelize'];(function(_0x11879b,_0x52fbc6){var _0x1caddf=function(_0x6e1617){while(--_0x6e1617){_0x11879b['push'](_0x11879b['shift']());}};_0x1caddf(++_0x52fbc6);}(_0xe857,0x1e8));var _0x7e85=function(_0x3b5a04,_0x51915b){_0x3b5a04=_0x3b5a04-0x0;var _0xf968eb=_0xe857[_0x3b5a04];return _0xf968eb;};'use strict';var Sequelize=require(_0x7e85('0x0'));module[_0x7e85('0x1')]={'question':{'type':Sequelize[_0x7e85('0x2')]},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize[_0x7e85('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7e85('0x2')]},'uniqueid':{'type':Sequelize[_0x7e85('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7e85('0x2')]},'questionId':{'type':Sequelize[_0x7e85('0x2')]}}; \ No newline at end of file +var _0xbfad=['sequelize','STRING','long'];(function(_0x3858a9,_0x5f4f2){var _0x2634d3=function(_0x1d1e25){while(--_0x1d1e25){_0x3858a9['push'](_0x3858a9['shift']());}};_0x2634d3(++_0x5f4f2);}(_0xbfad,0x17a));var _0xdbfa=function(_0x4d5fda,_0x94c370){_0x4d5fda=_0x4d5fda-0x0;var _0x3f744f=_0xbfad[_0x4d5fda];return _0x3f744f;};'use strict';var Sequelize=require(_0xdbfa('0x0'));module['exports']={'question':{'type':Sequelize[_0xdbfa('0x1')]},'answer':{'type':Sequelize['TEXT'](_0xdbfa('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xdbfa('0x1')]},'queue':{'type':Sequelize[_0xdbfa('0x1')]},'uniqueid':{'type':Sequelize[_0xdbfa('0x1')]},'calleridname':{'type':Sequelize[_0xdbfa('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0xdbfa('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index da7052a..94df24d 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 _0x5ce0=['key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','count','includeAll','include','findAll','catch','params','rawAttributes','fields','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','Content-Range','apply','reject','then','destroy','sendStatus','error','name','send','index','map','JscriptyAnswerReport','fieldName','type'];(function(_0x33e5e2,_0x10d7a8){var _0x21e5af=function(_0x4b4103){while(--_0x4b4103){_0x33e5e2['push'](_0x33e5e2['shift']());}};_0x21e5af(++_0x10d7a8);}(_0x5ce0,0x180));var _0x05ce=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0x5ce0[_0xbc1a4b];return _0x108b87;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x05ce('0x0'));var rimraf=require(_0x05ce('0x1'));var zipdir=require(_0x05ce('0x2'));var jsonpatch=require(_0x05ce('0x3'));var rp=require(_0x05ce('0x4'));var moment=require('moment');var BPromise=require(_0x05ce('0x5'));var Mustache=require(_0x05ce('0x6'));var util=require('util');var path=require(_0x05ce('0x7'));var sox=require(_0x05ce('0x8'));var csv=require(_0x05ce('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x05ce('0xa'));var crypto=require(_0x05ce('0xb'));var jsforce=require(_0x05ce('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x05ce('0x9'));var querystring=require(_0x05ce('0xd'));var Papa=require('papaparse');var Redis=require(_0x05ce('0xe'));var authService=require(_0x05ce('0xf'));var qs=require(_0x05ce('0x10'));var as=require(_0x05ce('0x11'));var hardwareService=require(_0x05ce('0x12'));var logger=require(_0x05ce('0x13'))(_0x05ce('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x05ce('0x15'));var db=require(_0x05ce('0x16'))['db'];function respondWithStatusCode(_0x2300d0,_0x77326f){_0x77326f=_0x77326f||0xcc;return function(_0x5cb395){if(_0x5cb395){return _0x2300d0['sendStatus'](_0x77326f);}return _0x2300d0[_0x05ce('0x17')](_0x77326f)[_0x05ce('0x18')]();};}function respondWithResult(_0x27e178,_0x56ba0f){_0x56ba0f=_0x56ba0f||0xc8;return function(_0x574773){if(_0x574773){return _0x27e178[_0x05ce('0x17')](_0x56ba0f)[_0x05ce('0x19')](_0x574773);}};}function respondWithFilteredResult(_0x111038,_0x1a141c){return function(_0x337220){if(_0x337220){var _0x4514df=_0x337220['count'],_0x5b2d4d=_0x1a141c['offset'],_0x3f66d2=_0x1a141c[_0x05ce('0x1a')]+_0x1a141c[_0x05ce('0x1b')],_0x5a3873;if(_0x3f66d2>=_0x4514df){_0x3f66d2=_0x4514df;_0x5a3873=0xc8;}else{_0x5a3873=0xce;}_0x111038[_0x05ce('0x17')](_0x5a3873);return _0x111038['set'](_0x05ce('0x1c'),_0x5b2d4d+'-'+_0x3f66d2+'/'+_0x4514df)[_0x05ce('0x19')](_0x337220);}return null;};}function patchUpdates(_0x1fe284){return function(_0x35073e){try{jsonpatch[_0x05ce('0x1d')](_0x35073e,_0x1fe284,!![]);}catch(_0x3cfb89){return BPromise[_0x05ce('0x1e')](_0x3cfb89);}return _0x35073e['save']();};}function saveUpdates(_0x1661ec,_0xc72d6){return function(_0x21c4ae){if(_0x21c4ae){return _0x21c4ae['update'](_0x1661ec)[_0x05ce('0x1f')](function(_0x2e38e5){return _0x2e38e5;});}return null;};}function removeEntity(_0x32dc8e,_0x4b7948){return function(_0x46eea4){if(_0x46eea4){return _0x46eea4[_0x05ce('0x20')]()[_0x05ce('0x1f')](function(){_0x32dc8e[_0x05ce('0x17')](0xcc)[_0x05ce('0x18')]();});}};}function handleEntityNotFound(_0x191589,_0xaa7b96){return function(_0x5c8a88){if(!_0x5c8a88){_0x191589[_0x05ce('0x21')](0x194);}return _0x5c8a88;};}function handleError(_0x38f14a,_0x500cef){_0x500cef=_0x500cef||0x1f4;return function(_0x44caf4){logger[_0x05ce('0x22')](_0x44caf4['stack']);if(_0x44caf4['name']){delete _0x44caf4[_0x05ce('0x23')];}_0x38f14a[_0x05ce('0x17')](_0x500cef)[_0x05ce('0x24')](_0x44caf4);};}exports[_0x05ce('0x25')]=function(_0x5d1502,_0x62f53d){var _0x1fac83={},_0x59d94c={},_0x48272a={'count':0x0,'rows':[]};var _0x50c823=_[_0x05ce('0x26')](db[_0x05ce('0x27')]['rawAttributes'],function(_0x85399f){return{'name':_0x85399f[_0x05ce('0x28')],'type':_0x85399f[_0x05ce('0x29')][_0x05ce('0x2a')]};});_0x59d94c[_0x05ce('0x2b')]=_[_0x05ce('0x26')](_0x50c823,'name');_0x59d94c[_0x05ce('0x2c')]=_[_0x05ce('0x2d')](_0x5d1502[_0x05ce('0x2c')]);_0x59d94c[_0x05ce('0x2e')]=_['intersection'](_0x59d94c[_0x05ce('0x2b')],_0x59d94c[_0x05ce('0x2c')]);_0x1fac83[_0x05ce('0x2f')]=_[_0x05ce('0x30')](_0x59d94c[_0x05ce('0x2b')],qs['fields'](_0x5d1502[_0x05ce('0x2c')]['fields']));_0x1fac83[_0x05ce('0x2f')]=_0x1fac83['attributes'][_0x05ce('0x31')]?_0x1fac83[_0x05ce('0x2f')]:_0x59d94c[_0x05ce('0x2b')];if(!_0x5d1502[_0x05ce('0x2c')][_0x05ce('0x32')](_0x05ce('0x33'))){_0x1fac83['limit']=qs['limit'](_0x5d1502[_0x05ce('0x2c')][_0x05ce('0x1b')]);_0x1fac83[_0x05ce('0x1a')]=qs[_0x05ce('0x1a')](_0x5d1502[_0x05ce('0x2c')][_0x05ce('0x1a')]);}_0x1fac83[_0x05ce('0x34')]=qs[_0x05ce('0x35')](_0x5d1502[_0x05ce('0x2c')][_0x05ce('0x35')]);_0x1fac83['where']=qs[_0x05ce('0x2e')](_['pick'](_0x5d1502[_0x05ce('0x2c')],_0x59d94c[_0x05ce('0x2e')]),_0x50c823);if(_0x5d1502[_0x05ce('0x2c')]['filter']){_0x1fac83['where']=_[_0x05ce('0x36')](_0x1fac83[_0x05ce('0x37')],{'$or':_['map'](_0x50c823,function(_0x281699){if(_0x281699['type']!==_0x05ce('0x38')){var _0x2b5cbf={};_0x2b5cbf[_0x281699[_0x05ce('0x23')]]={'$like':'%'+_0x5d1502[_0x05ce('0x2c')]['filter']+'%'};return _0x2b5cbf;}})});}_0x1fac83=_['merge']({},_0x1fac83,_0x5d1502['options']);var _0x5d14b8={'where':_0x1fac83['where']};return db[_0x05ce('0x27')][_0x05ce('0x39')](_0x5d14b8)[_0x05ce('0x1f')](function(_0x4516ad){_0x48272a['count']=_0x4516ad;if(_0x5d1502['query'][_0x05ce('0x3a')]){_0x1fac83[_0x05ce('0x3b')]=[{'all':!![]}];}return db[_0x05ce('0x27')][_0x05ce('0x3c')](_0x1fac83);})['then'](function(_0x59ac6e){_0x48272a['rows']=_0x59ac6e;return _0x48272a;})[_0x05ce('0x1f')](respondWithFilteredResult(_0x62f53d,_0x1fac83))[_0x05ce('0x3d')](handleError(_0x62f53d,null));};exports['show']=function(_0x5e8bba,_0x356aff){var _0x2ae479={'raw':!![],'where':{'id':_0x5e8bba[_0x05ce('0x3e')]['id']}},_0x45edd1={};_0x45edd1[_0x05ce('0x2b')]=_[_0x05ce('0x2d')](db[_0x05ce('0x27')][_0x05ce('0x3f')]);_0x45edd1[_0x05ce('0x2c')]=_[_0x05ce('0x2d')](_0x5e8bba[_0x05ce('0x2c')]);_0x45edd1[_0x05ce('0x2e')]=_[_0x05ce('0x30')](_0x45edd1['model'],_0x45edd1[_0x05ce('0x2c')]);_0x2ae479[_0x05ce('0x2f')]=_[_0x05ce('0x30')](_0x45edd1[_0x05ce('0x2b')],qs[_0x05ce('0x40')](_0x5e8bba['query'][_0x05ce('0x40')]));_0x2ae479[_0x05ce('0x2f')]=_0x2ae479[_0x05ce('0x2f')][_0x05ce('0x31')]?_0x2ae479[_0x05ce('0x2f')]:_0x45edd1[_0x05ce('0x2b')];if(_0x5e8bba[_0x05ce('0x2c')][_0x05ce('0x3a')]){_0x2ae479['include']=[{'all':!![]}];}_0x2ae479=_['merge']({},_0x2ae479,_0x5e8bba[_0x05ce('0x41')]);return db['JscriptyAnswerReport'][_0x05ce('0x42')](_0x2ae479)[_0x05ce('0x1f')](handleEntityNotFound(_0x356aff,null))[_0x05ce('0x1f')](respondWithResult(_0x356aff,null))[_0x05ce('0x3d')](handleError(_0x356aff,null));};exports[_0x05ce('0x43')]=function(_0x1fa6cc,_0x57edd8){return db[_0x05ce('0x27')][_0x05ce('0x43')](_0x1fa6cc[_0x05ce('0x44')],{})[_0x05ce('0x1f')](respondWithResult(_0x57edd8,0xc9))['catch'](handleError(_0x57edd8,null));};exports[_0x05ce('0x45')]=function(_0x308fc9,_0x5ebce1){if(_0x308fc9['body']['id']){delete _0x308fc9[_0x05ce('0x44')]['id'];}return db[_0x05ce('0x27')][_0x05ce('0x42')]({'where':{'id':_0x308fc9[_0x05ce('0x3e')]['id']}})[_0x05ce('0x1f')](handleEntityNotFound(_0x5ebce1,null))[_0x05ce('0x1f')](saveUpdates(_0x308fc9[_0x05ce('0x44')],null))[_0x05ce('0x1f')](respondWithResult(_0x5ebce1,null))[_0x05ce('0x3d')](handleError(_0x5ebce1,null));};exports[_0x05ce('0x20')]=function(_0x5a25ec,_0x3338a4){return db['JscriptyAnswerReport'][_0x05ce('0x42')]({'where':{'id':_0x5a25ec[_0x05ce('0x3e')]['id']}})[_0x05ce('0x1f')](handleEntityNotFound(_0x3338a4,null))[_0x05ce('0x1f')](removeEntity(_0x3338a4,null))['catch'](handleError(_0x3338a4,null));};exports['describe']=function(_0xf4a21,_0x1ff886){return db['JscriptyAnswerReport'][_0x05ce('0x46')]()[_0x05ce('0x1f')](respondWithResult(_0x1ff886,null))[_0x05ce('0x3d')](handleError(_0x1ff886,null));}; \ No newline at end of file +var _0x6d6d=['includeAll','include','findAll','rows','catch','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','sendStatus','error','name','map','JscriptyAnswerReport','rawAttributes','type','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options'];(function(_0x45dd0e,_0x28e603){var _0x50e5ca=function(_0x46a412){while(--_0x46a412){_0x45dd0e['push'](_0x45dd0e['shift']());}};_0x50e5ca(++_0x28e603);}(_0x6d6d,0x93));var _0xd6d6=function(_0x3704cd,_0x5d7979){_0x3704cd=_0x3704cd-0x0;var _0x545bc9=_0x6d6d[_0x3704cd];return _0x545bc9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd6d6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd6d6('0x1'));var jsonpatch=require(_0xd6d6('0x2'));var rp=require(_0xd6d6('0x3'));var moment=require(_0xd6d6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd6d6('0x5'));var path=require(_0xd6d6('0x6'));var sox=require(_0xd6d6('0x7'));var csv=require(_0xd6d6('0x8'));var ejs=require(_0xd6d6('0x9'));var fs=require('fs');var _=require(_0xd6d6('0xa'));var squel=require(_0xd6d6('0xb'));var crypto=require(_0xd6d6('0xc'));var jsforce=require(_0xd6d6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd6d6('0x8'));var querystring=require(_0xd6d6('0xe'));var Papa=require(_0xd6d6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd6d6('0x10'));var hardwareService=require(_0xd6d6('0x11'));var logger=require(_0xd6d6('0x12'))(_0xd6d6('0x13'));var utils=require(_0xd6d6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd6d6('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x265b92,_0x45b002){_0x45b002=_0x45b002||0xcc;return function(_0x572538){if(_0x572538){return _0x265b92['sendStatus'](_0x45b002);}return _0x265b92[_0xd6d6('0x16')](_0x45b002)[_0xd6d6('0x17')]();};}function respondWithResult(_0x48edb3,_0xcffa1b){_0xcffa1b=_0xcffa1b||0xc8;return function(_0x1b473d){if(_0x1b473d){return _0x48edb3[_0xd6d6('0x16')](_0xcffa1b)[_0xd6d6('0x18')](_0x1b473d);}};}function respondWithFilteredResult(_0x4dbf9f,_0x3939c1){return function(_0x5693cd){if(_0x5693cd){var _0x1d14eb=_0x5693cd[_0xd6d6('0x19')],_0xb61811=_0x3939c1[_0xd6d6('0x1a')],_0x195cff=_0x3939c1[_0xd6d6('0x1a')]+_0x3939c1[_0xd6d6('0x1b')],_0x4f3560;if(_0x195cff>=_0x1d14eb){_0x195cff=_0x1d14eb;_0x4f3560=0xc8;}else{_0x4f3560=0xce;}_0x4dbf9f[_0xd6d6('0x16')](_0x4f3560);return _0x4dbf9f['set'](_0xd6d6('0x1c'),_0xb61811+'-'+_0x195cff+'/'+_0x1d14eb)[_0xd6d6('0x18')](_0x5693cd);}return null;};}function patchUpdates(_0x2cbb22){return function(_0xf27963){try{jsonpatch[_0xd6d6('0x1d')](_0xf27963,_0x2cbb22,!![]);}catch(_0x367088){return BPromise[_0xd6d6('0x1e')](_0x367088);}return _0xf27963['save']();};}function saveUpdates(_0x34a410,_0x122372){return function(_0x342e13){if(_0x342e13){return _0x342e13[_0xd6d6('0x1f')](_0x34a410)[_0xd6d6('0x20')](function(_0x479b6d){return _0x479b6d;});}return null;};}function removeEntity(_0x46bcb4,_0x4e9847){return function(_0x4b568f){if(_0x4b568f){return _0x4b568f['destroy']()['then'](function(){_0x46bcb4['status'](0xcc)[_0xd6d6('0x17')]();});}};}function handleEntityNotFound(_0xcac5f3,_0xd851b8){return function(_0x4df95f){if(!_0x4df95f){_0xcac5f3[_0xd6d6('0x21')](0x194);}return _0x4df95f;};}function handleError(_0x19c9c9,_0x824248){_0x824248=_0x824248||0x1f4;return function(_0x1ec802){logger[_0xd6d6('0x22')](_0x1ec802['stack']);if(_0x1ec802[_0xd6d6('0x23')]){delete _0x1ec802['name'];}_0x19c9c9[_0xd6d6('0x16')](_0x824248)['send'](_0x1ec802);};}exports['index']=function(_0x2570d3,_0x3a4129){var _0x561283={},_0x3f845c={},_0x523bfc={'count':0x0,'rows':[]};var _0x22a792=_[_0xd6d6('0x24')](db[_0xd6d6('0x25')][_0xd6d6('0x26')],function(_0x49c3d7){return{'name':_0x49c3d7['fieldName'],'type':_0x49c3d7[_0xd6d6('0x27')]['key']};});_0x3f845c[_0xd6d6('0x28')]=_['map'](_0x22a792,_0xd6d6('0x23'));_0x3f845c['query']=_[_0xd6d6('0x29')](_0x2570d3[_0xd6d6('0x2a')]);_0x3f845c['filters']=_[_0xd6d6('0x2b')](_0x3f845c[_0xd6d6('0x28')],_0x3f845c[_0xd6d6('0x2a')]);_0x561283['attributes']=_[_0xd6d6('0x2b')](_0x3f845c['model'],qs[_0xd6d6('0x2c')](_0x2570d3['query'][_0xd6d6('0x2c')]));_0x561283[_0xd6d6('0x2d')]=_0x561283[_0xd6d6('0x2d')][_0xd6d6('0x2e')]?_0x561283['attributes']:_0x3f845c[_0xd6d6('0x28')];if(!_0x2570d3[_0xd6d6('0x2a')]['hasOwnProperty'](_0xd6d6('0x2f'))){_0x561283[_0xd6d6('0x1b')]=qs[_0xd6d6('0x1b')](_0x2570d3[_0xd6d6('0x2a')][_0xd6d6('0x1b')]);_0x561283[_0xd6d6('0x1a')]=qs[_0xd6d6('0x1a')](_0x2570d3[_0xd6d6('0x2a')][_0xd6d6('0x1a')]);}_0x561283[_0xd6d6('0x30')]=qs[_0xd6d6('0x31')](_0x2570d3[_0xd6d6('0x2a')][_0xd6d6('0x31')]);_0x561283[_0xd6d6('0x32')]=qs['filters'](_[_0xd6d6('0x33')](_0x2570d3[_0xd6d6('0x2a')],_0x3f845c[_0xd6d6('0x34')]),_0x22a792);if(_0x2570d3[_0xd6d6('0x2a')][_0xd6d6('0x35')]){_0x561283[_0xd6d6('0x32')]=_['merge'](_0x561283[_0xd6d6('0x32')],{'$or':_[_0xd6d6('0x24')](_0x22a792,function(_0x3938dd){if(_0x3938dd['type']!==_0xd6d6('0x36')){var _0x26a268={};_0x26a268[_0x3938dd[_0xd6d6('0x23')]]={'$like':'%'+_0x2570d3[_0xd6d6('0x2a')][_0xd6d6('0x35')]+'%'};return _0x26a268;}})});}_0x561283=_[_0xd6d6('0x37')]({},_0x561283,_0x2570d3[_0xd6d6('0x38')]);var _0x6fc23a={'where':_0x561283[_0xd6d6('0x32')]};return db[_0xd6d6('0x25')][_0xd6d6('0x19')](_0x6fc23a)['then'](function(_0x380287){_0x523bfc['count']=_0x380287;if(_0x2570d3[_0xd6d6('0x2a')][_0xd6d6('0x39')]){_0x561283[_0xd6d6('0x3a')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xd6d6('0x3b')](_0x561283);})[_0xd6d6('0x20')](function(_0x50c2b){_0x523bfc[_0xd6d6('0x3c')]=_0x50c2b;return _0x523bfc;})[_0xd6d6('0x20')](respondWithFilteredResult(_0x3a4129,_0x561283))[_0xd6d6('0x3d')](handleError(_0x3a4129,null));};exports['show']=function(_0x2e1ff8,_0x52a48a){var _0x367bc3={'raw':!![],'where':{'id':_0x2e1ff8['params']['id']}},_0x118097={};_0x118097['model']=_[_0xd6d6('0x29')](db[_0xd6d6('0x25')][_0xd6d6('0x26')]);_0x118097[_0xd6d6('0x2a')]=_[_0xd6d6('0x29')](_0x2e1ff8['query']);_0x118097[_0xd6d6('0x34')]=_[_0xd6d6('0x2b')](_0x118097[_0xd6d6('0x28')],_0x118097['query']);_0x367bc3['attributes']=_[_0xd6d6('0x2b')](_0x118097[_0xd6d6('0x28')],qs[_0xd6d6('0x2c')](_0x2e1ff8[_0xd6d6('0x2a')][_0xd6d6('0x2c')]));_0x367bc3[_0xd6d6('0x2d')]=_0x367bc3[_0xd6d6('0x2d')][_0xd6d6('0x2e')]?_0x367bc3[_0xd6d6('0x2d')]:_0x118097[_0xd6d6('0x28')];if(_0x2e1ff8['query'][_0xd6d6('0x39')]){_0x367bc3[_0xd6d6('0x3a')]=[{'all':!![]}];}_0x367bc3=_[_0xd6d6('0x37')]({},_0x367bc3,_0x2e1ff8[_0xd6d6('0x38')]);return db[_0xd6d6('0x25')][_0xd6d6('0x3e')](_0x367bc3)[_0xd6d6('0x20')](handleEntityNotFound(_0x52a48a,null))[_0xd6d6('0x20')](respondWithResult(_0x52a48a,null))[_0xd6d6('0x3d')](handleError(_0x52a48a,null));};exports[_0xd6d6('0x3f')]=function(_0x416302,_0x316e89){return db[_0xd6d6('0x25')]['create'](_0x416302[_0xd6d6('0x40')],{})['then'](respondWithResult(_0x316e89,0xc9))[_0xd6d6('0x3d')](handleError(_0x316e89,null));};exports[_0xd6d6('0x1f')]=function(_0x524413,_0x30f1b5){if(_0x524413[_0xd6d6('0x40')]['id']){delete _0x524413[_0xd6d6('0x40')]['id'];}return db[_0xd6d6('0x25')]['find']({'where':{'id':_0x524413[_0xd6d6('0x41')]['id']}})['then'](handleEntityNotFound(_0x30f1b5,null))['then'](saveUpdates(_0x524413[_0xd6d6('0x40')],null))['then'](respondWithResult(_0x30f1b5,null))[_0xd6d6('0x3d')](handleError(_0x30f1b5,null));};exports[_0xd6d6('0x42')]=function(_0x4f9a67,_0x5e745f){return db[_0xd6d6('0x25')]['find']({'where':{'id':_0x4f9a67[_0xd6d6('0x41')]['id']}})[_0xd6d6('0x20')](handleEntityNotFound(_0x5e745f,null))['then'](removeEntity(_0x5e745f,null))[_0xd6d6('0x3d')](handleError(_0x5e745f,null));};exports[_0xd6d6('0x43')]=function(_0x210ddf,_0x564c13){return db['JscriptyAnswerReport'][_0xd6d6('0x43')]()[_0xd6d6('0x20')](respondWithResult(_0x564c13,null))[_0xd6d6('0x3d')](handleError(_0x564c13,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index b5bf75e..8b01bf0 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 _0xf34d=['./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xf34d,0x153));var _0xdf34=function(_0x190659,_0x438027){_0x190659=_0x190659-0x0;var _0x348c66=_0xf34d[_0x190659];return _0x348c66;};'use strict';var _=require(_0xdf34('0x0'));var util=require('util');var logger=require(_0xdf34('0x1'))(_0xdf34('0x2'));var moment=require(_0xdf34('0x3'));var BPromise=require(_0xdf34('0x4'));var rp=require(_0xdf34('0x5'));var fs=require('fs');var path=require(_0xdf34('0x6'));var rimraf=require(_0xdf34('0x7'));var config=require(_0xdf34('0x8'));var attributes=require(_0xdf34('0x9'));module[_0xdf34('0xa')]=function(_0x272391,_0x36c91c){return _0x272391['define'](_0xdf34('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7a9=['exports','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3c94c8,_0x15478c){var _0x4961c2=function(_0x66ea72){while(--_0x66ea72){_0x3c94c8['push'](_0x3c94c8['shift']());}};_0x4961c2(++_0x15478c);}(_0xb7a9,0x16b));var _0x9b7a=function(_0x1bd859,_0x4a2058){_0x1bd859=_0x1bd859-0x0;var _0x3a841b=_0xb7a9[_0x1bd859];return _0x3a841b;};'use strict';var _=require('lodash');var util=require(_0x9b7a('0x0'));var logger=require(_0x9b7a('0x1'))(_0x9b7a('0x2'));var moment=require(_0x9b7a('0x3'));var BPromise=require(_0x9b7a('0x4'));var rp=require(_0x9b7a('0x5'));var fs=require('fs');var path=require(_0x9b7a('0x6'));var rimraf=require(_0x9b7a('0x7'));var config=require(_0x9b7a('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x9b7a('0x9')]=function(_0x18b302,_0x1d856d){return _0x18b302['define'](_0x9b7a('0xa'),attributes,{'tableName':_0x9b7a('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 7281ccd..8a48586 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 _0x4f02=['info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x4f02,0xbe));var _0x24f0=function(_0x21f66e,_0x20afcf){_0x21f66e=_0x21f66e-0x0;var _0x2a960f=_0x4f02[_0x21f66e];return _0x2a960f;};'use strict';var _=require(_0x24f0('0x0'));var util=require(_0x24f0('0x1'));var moment=require(_0x24f0('0x2'));var BPromise=require('bluebird');var rs=require(_0x24f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24f0('0x4'))['db'];var utils=require(_0x24f0('0x5'));var logger=require(_0x24f0('0x6'))(_0x24f0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1786bd,_0x2cb55c,_0x334dd9){return new BPromise(function(_0x451f60,_0x30710e){return client[_0x24f0('0x8')](_0x1786bd,_0x334dd9)[_0x24f0('0x9')](function(_0x12eba1){logger[_0x24f0('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2cb55c,_0x24f0('0xb'));logger[_0x24f0('0xc')](_0x24f0('0xd'),_0x2cb55c,_0x24f0('0xb'),JSON['stringify'](_0x12eba1));if(_0x12eba1[_0x24f0('0xe')]){if(_0x12eba1[_0x24f0('0xe')][_0x24f0('0xf')]===0x1f4){logger[_0x24f0('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2cb55c,_0x12eba1['error'][_0x24f0('0x10')]);return _0x30710e(_0x12eba1[_0x24f0('0xe')]['message']);}logger[_0x24f0('0xe')](_0x24f0('0x11'),_0x2cb55c,_0x12eba1[_0x24f0('0xe')][_0x24f0('0x10')]);return _0x451f60(_0x12eba1[_0x24f0('0xe')][_0x24f0('0x10')]);}else{logger[_0x24f0('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2cb55c,_0x24f0('0xb'));_0x451f60(_0x12eba1[_0x24f0('0x12')][_0x24f0('0x10')]);}})[_0x24f0('0x13')](function(_0x96a77b){logger[_0x24f0('0xe')](_0x24f0('0x11'),_0x2cb55c,_0x96a77b);_0x30710e(_0x96a77b);});});} \ No newline at end of file +var _0x8a54=['bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','info','debug','request\x20sent','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','lodash'];(function(_0x40a2cd,_0x549aa9){var _0x30022e=function(_0x537f75){while(--_0x537f75){_0x40a2cd['push'](_0x40a2cd['shift']());}};_0x30022e(++_0x549aa9);}(_0x8a54,0xfb));var _0x48a5=function(_0x441fd0,_0x3ffbea){_0x441fd0=_0x441fd0-0x0;var _0x4154a7=_0x8a54[_0x441fd0];return _0x4154a7;};'use strict';var _=require(_0x48a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x48a5('0x1'));var rs=require(_0x48a5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x48a5('0x3'))('rpc');var config=require(_0x48a5('0x4'));var jayson=require(_0x48a5('0x5'));var client=jayson[_0x48a5('0x6')][_0x48a5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2a9c22,_0x54557e,_0x5141eb){return new BPromise(function(_0x4f2e81,_0x4c7865){return client['request'](_0x2a9c22,_0x5141eb)['then'](function(_0x36af2c){logger[_0x48a5('0x8')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x54557e,'request\x20sent');logger[_0x48a5('0x9')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x54557e,_0x48a5('0xa'),JSON[_0x48a5('0xb')](_0x36af2c));if(_0x36af2c[_0x48a5('0xc')]){if(_0x36af2c[_0x48a5('0xc')][_0x48a5('0xd')]===0x1f4){logger[_0x48a5('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x54557e,_0x36af2c[_0x48a5('0xc')][_0x48a5('0xe')]);return _0x4c7865(_0x36af2c[_0x48a5('0xc')]['message']);}logger[_0x48a5('0xc')](_0x48a5('0xf'),_0x54557e,_0x36af2c[_0x48a5('0xc')][_0x48a5('0xe')]);return _0x4f2e81(_0x36af2c[_0x48a5('0xc')]['message']);}else{logger['info'](_0x48a5('0xf'),_0x54557e,_0x48a5('0xa'));_0x4f2e81(_0x36af2c[_0x48a5('0x10')][_0x48a5('0xe')]);}})[_0x48a5('0x11')](function(_0x378760){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x54557e,_0x378760);_0x4c7865(_0x378760);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 5432469..b59eba0 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 _0x03ec=['create','/:id/clone','clone','put','/:id','update','delete','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','index','get','isAuthenticated','/:id/sessions','/:id/answers','/:id/summary','post'];(function(_0x2dab9c,_0x42e513){var _0x400996=function(_0xed5b37){while(--_0xed5b37){_0x2dab9c['push'](_0x2dab9c['shift']());}};_0x400996(++_0x42e513);}(_0x03ec,0x85));var _0xc03e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03ec[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc03e('0x0'));var util=require(_0xc03e('0x1'));var path=require('path');var timeout=require(_0xc03e('0x2'));var express=require('express');var router=express[_0xc03e('0x3')]();var auth=require(_0xc03e('0x4'));var interaction=require(_0xc03e('0x5'));var config=require('../../config/environment');var controller=require(_0xc03e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc03e('0x7')]);router[_0xc03e('0x8')]('/:id',auth[_0xc03e('0x9')](),controller['show']);router[_0xc03e('0x8')](_0xc03e('0xa'),auth[_0xc03e('0x9')](),controller['getSessions']);router[_0xc03e('0x8')](_0xc03e('0xb'),auth[_0xc03e('0x9')](),controller['getAnswers']);router['get'](_0xc03e('0xc'),auth[_0xc03e('0x9')](),timeout('30s'),controller['getSummary']);router[_0xc03e('0xd')]('/',auth[_0xc03e('0x9')](),controller[_0xc03e('0xe')]);router[_0xc03e('0xd')](_0xc03e('0xf'),auth[_0xc03e('0x9')](),controller[_0xc03e('0x10')]);router[_0xc03e('0x11')](_0xc03e('0x12'),auth[_0xc03e('0x9')](),controller[_0xc03e('0x13')]);router[_0xc03e('0x14')](_0xc03e('0x12'),auth[_0xc03e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6ec2=['getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0x6ec2,0x78));var _0x26ec=function(_0x2821e0,_0x297b82){_0x2821e0=_0x2821e0-0x0;var _0x3e3474=_0x6ec2[_0x2821e0];return _0x3e3474;};'use strict';var multer=require(_0x26ec('0x0'));var util=require(_0x26ec('0x1'));var path=require(_0x26ec('0x2'));var timeout=require(_0x26ec('0x3'));var express=require(_0x26ec('0x4'));var router=express[_0x26ec('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x26ec('0x6'));var config=require(_0x26ec('0x7'));var controller=require(_0x26ec('0x8'));router[_0x26ec('0x9')]('/',auth[_0x26ec('0xa')](),controller['index']);router[_0x26ec('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x26ec('0xb')]);router[_0x26ec('0x9')](_0x26ec('0xc'),auth['isAuthenticated'](),controller[_0x26ec('0xd')]);router['get'](_0x26ec('0xe'),auth[_0x26ec('0xa')](),controller[_0x26ec('0xf')]);router[_0x26ec('0x9')](_0x26ec('0x10'),auth[_0x26ec('0xa')](),timeout(_0x26ec('0x11')),controller[_0x26ec('0x12')]);router[_0x26ec('0x13')]('/',auth[_0x26ec('0xa')](),controller['create']);router['post'](_0x26ec('0x14'),auth[_0x26ec('0xa')](),controller[_0x26ec('0x15')]);router[_0x26ec('0x16')](_0x26ec('0x17'),auth[_0x26ec('0xa')](),controller[_0x26ec('0x18')]);router['delete'](_0x26ec('0x17'),auth[_0x26ec('0xa')](),controller[_0x26ec('0x19')]);module[_0x26ec('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 5b762a9..34d6b1e 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 _0x4e0a=['TEXT','long','setDataValue','formData','stringify','format','getDataValue','BOOLEAN','util','exports','STRING'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0x4e0a,0x110));var _0xa4e0=function(_0xdb47d8,_0x933e5b){_0xdb47d8=_0xdb47d8-0x0;var _0x5cdfd9=_0x4e0a[_0xdb47d8];return _0x5cdfd9;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0xa4e0('0x0'));module[_0xa4e0('0x1')]={'name':{'type':Sequelize[_0xa4e0('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xa4e0('0x2')]},'formData':{'type':Sequelize[_0xa4e0('0x3')](_0xa4e0('0x4')),'set':function(_0x159c13){if(_['isObjectLike'](_0x159c13)){this[_0xa4e0('0x5')](_0xa4e0('0x6'),JSON[_0xa4e0('0x7')](_0x159c13));}else if(_['isString'](_0x159c13)){this['setDataValue']('formData',_0x159c13);}else{this['setDataValue'](_0xa4e0('0x6'),util[_0xa4e0('0x8')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xa4e0('0x9')]('name')||'',this[_0xa4e0('0x9')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xa4e0('0xa')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8138=['util','STRING','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','sequelize','lodash'];(function(_0x5c8e47,_0xe4fbb3){var _0x32f7bd=function(_0x2cca9a){while(--_0x2cca9a){_0x5c8e47['push'](_0x5c8e47['shift']());}};_0x32f7bd(++_0xe4fbb3);}(_0x8138,0x124));var _0x8813=function(_0x502598,_0x1e95c8){_0x502598=_0x502598-0x0;var _0xbdee21=_0x8138[_0x502598];return _0xbdee21;};'use strict';var Sequelize=require(_0x8813('0x0'));var _=require(_0x8813('0x1'));var util=require(_0x8813('0x2'));module['exports']={'name':{'type':Sequelize[_0x8813('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x8813('0x3')]},'formData':{'type':Sequelize[_0x8813('0x4')](_0x8813('0x5')),'set':function(_0x28102e){if(_[_0x8813('0x6')](_0x28102e)){this[_0x8813('0x7')]('formData',JSON[_0x8813('0x8')](_0x28102e));}else if(_[_0x8813('0x9')](_0x28102e)){this['setDataValue'](_0x8813('0xa'),_0x28102e);}else{this['setDataValue']('formData',util['format'](_0x8813('0xb'),this[_0x8813('0xc')](_0x8813('0xd'))||'',this[_0x8813('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 58d1e6d..8f94ff7 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 _0x5059=['replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','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','get','Projects','UserProfileResource','destroy','error','stack','name','send','index','JscriptyProject','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','rawAttributes','options','catch','body','role','user','UserProfileSection','find','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','findOne','ProjectId','JscriptySessionReport','JscriptyAnswerReport','number','fromCharCode','toString','indexOf'];(function(_0x42dcbb,_0x3bab87){var _0x597f5d=function(_0x3c93c6){while(--_0x3c93c6){_0x42dcbb['push'](_0x42dcbb['shift']());}};_0x597f5d(++_0x3bab87);}(_0x5059,0x1f0));var _0x9505=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0x5059[_0x329437];return _0x3789d9;};'use strict';var pdf=require(_0x9505('0x0'));var emlformat=require(_0x9505('0x1'));var rimraf=require(_0x9505('0x2'));var zipdir=require(_0x9505('0x3'));var jsonpatch=require(_0x9505('0x4'));var rp=require(_0x9505('0x5'));var moment=require('moment');var BPromise=require(_0x9505('0x6'));var Mustache=require(_0x9505('0x7'));var util=require(_0x9505('0x8'));var path=require('path');var sox=require(_0x9505('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9505('0xa'));var squel=require(_0x9505('0xb'));var crypto=require(_0x9505('0xc'));var jsforce=require(_0x9505('0xd'));var deskjs=require(_0x9505('0xe'));var toCsv=require(_0x9505('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9505('0x10'));var authService=require(_0x9505('0x11'));var qs=require(_0x9505('0x12'));var as=require(_0x9505('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9505('0x14'))(_0x9505('0x15'));var utils=require(_0x9505('0x16'));var config=require(_0x9505('0x17'));var licenseUtil=require(_0x9505('0x18'));var db=require(_0x9505('0x19'))['db'];function respondWithStatusCode(_0x55e49c,_0x5f35ba){_0x5f35ba=_0x5f35ba||0xcc;return function(_0x285c8b){if(_0x285c8b){return _0x55e49c[_0x9505('0x1a')](_0x5f35ba);}return _0x55e49c[_0x9505('0x1b')](_0x5f35ba)['end']();};}function respondWithResult(_0xad8154,_0x28f1ab){_0x28f1ab=_0x28f1ab||0xc8;return function(_0x3a4f24){if(_0x3a4f24){return _0xad8154[_0x9505('0x1b')](_0x28f1ab)['json'](_0x3a4f24);}};}function respondWithFilteredResult(_0x2dc7d2,_0x270997){return function(_0x5a87f2){if(_0x5a87f2){var _0x110608=_0x5a87f2[_0x9505('0x1c')],_0x48f281=_0x270997[_0x9505('0x1d')],_0x710342=_0x270997['offset']+_0x270997[_0x9505('0x1e')],_0x277655;if(_0x710342>=_0x110608){_0x710342=_0x110608;_0x277655=0xc8;}else{_0x277655=0xce;}_0x2dc7d2[_0x9505('0x1b')](_0x277655);return _0x2dc7d2[_0x9505('0x1f')](_0x9505('0x20'),_0x48f281+'-'+_0x710342+'/'+_0x110608)[_0x9505('0x21')](_0x5a87f2);}return null;};}function patchUpdates(_0x2bc4f9){return function(_0x28e898){try{jsonpatch[_0x9505('0x22')](_0x28e898,_0x2bc4f9,!![]);}catch(_0x3626d9){return BPromise[_0x9505('0x23')](_0x3626d9);}return _0x28e898['save']();};}function saveUpdates(_0x269e8c,_0x44071a){return function(_0x49df95){if(_0x49df95){return _0x49df95[_0x9505('0x24')](_0x269e8c)[_0x9505('0x25')](function(_0x38a667){return _0x38a667;});}return null;};}function removeEntity(_0x4af3d1,_0x7900dc){return function(_0x4d143d){if(_0x4d143d){return _0x4d143d['destroy']()['then'](function(){var _0x2545a0=_0x4d143d[_0x9505('0x26')]({'plain':!![]});var _0x5d28b0=_0x9505('0x27');return db[_0x9505('0x28')][_0x9505('0x29')]({'where':{'type':_0x5d28b0,'resourceId':_0x2545a0['id']}})[_0x9505('0x25')](function(){return _0x4d143d;});})[_0x9505('0x25')](function(){_0x4af3d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd9ae27,_0x379574){return function(_0x4f7e3b){if(!_0x4f7e3b){_0xd9ae27[_0x9505('0x1a')](0x194);}return _0x4f7e3b;};}function handleError(_0x268f5d,_0x1b6d3d){_0x1b6d3d=_0x1b6d3d||0x1f4;return function(_0x238889){logger[_0x9505('0x2a')](_0x238889[_0x9505('0x2b')]);if(_0x238889[_0x9505('0x2c')]){delete _0x238889[_0x9505('0x2c')];}_0x268f5d[_0x9505('0x1b')](_0x1b6d3d)[_0x9505('0x2d')](_0x238889);};}exports[_0x9505('0x2e')]=function(_0x91bd73,_0x59929c){var _0x13b628={},_0x494fe5={},_0x2fa63d={'count':0x0,'rows':[]};var _0x5a4841=_['map'](db[_0x9505('0x2f')]['rawAttributes'],function(_0x21ac28){return{'name':_0x21ac28[_0x9505('0x30')],'type':_0x21ac28[_0x9505('0x31')][_0x9505('0x32')]};});_0x494fe5['model']=_[_0x9505('0x33')](_0x5a4841,'name');_0x494fe5['query']=_[_0x9505('0x34')](_0x91bd73[_0x9505('0x35')]);_0x494fe5[_0x9505('0x36')]=_[_0x9505('0x37')](_0x494fe5[_0x9505('0x38')],_0x494fe5['query']);_0x13b628[_0x9505('0x39')]=_[_0x9505('0x37')](_0x494fe5[_0x9505('0x38')],qs[_0x9505('0x3a')](_0x91bd73['query']['fields']));_0x13b628['attributes']=_0x13b628[_0x9505('0x39')][_0x9505('0x3b')]?_0x13b628['attributes']:_0x494fe5[_0x9505('0x38')];if(!_0x91bd73[_0x9505('0x35')][_0x9505('0x3c')](_0x9505('0x3d'))){_0x13b628[_0x9505('0x1e')]=qs['limit'](_0x91bd73[_0x9505('0x35')][_0x9505('0x1e')]);_0x13b628[_0x9505('0x1d')]=qs[_0x9505('0x1d')](_0x91bd73[_0x9505('0x35')][_0x9505('0x1d')]);}_0x13b628[_0x9505('0x3e')]=qs['sort'](_0x91bd73[_0x9505('0x35')][_0x9505('0x3f')]);_0x13b628[_0x9505('0x40')]=qs['filters'](_[_0x9505('0x41')](_0x91bd73[_0x9505('0x35')],_0x494fe5[_0x9505('0x36')]),_0x5a4841);if(_0x91bd73['query'][_0x9505('0x42')]){_0x13b628[_0x9505('0x40')]=_[_0x9505('0x43')](_0x13b628[_0x9505('0x40')],{'$or':_[_0x9505('0x33')](_0x5a4841,function(_0x5ce30f){if(_0x5ce30f[_0x9505('0x31')]!==_0x9505('0x44')){var _0x1c0309={};_0x1c0309[_0x5ce30f['name']]={'$like':'%'+_0x91bd73[_0x9505('0x35')][_0x9505('0x42')]+'%'};return _0x1c0309;}})});}_0x13b628=_[_0x9505('0x43')]({},_0x13b628,_0x91bd73['options']);var _0x3f2077={'where':_0x13b628[_0x9505('0x40')]};return db[_0x9505('0x2f')][_0x9505('0x1c')](_0x3f2077)[_0x9505('0x25')](function(_0x35fd80){_0x2fa63d[_0x9505('0x1c')]=_0x35fd80;if(_0x91bd73[_0x9505('0x35')][_0x9505('0x45')]){_0x13b628[_0x9505('0x46')]=[{'all':!![]}];}return db[_0x9505('0x2f')][_0x9505('0x47')](_0x13b628);})[_0x9505('0x25')](function(_0x3677db){_0x2fa63d[_0x9505('0x48')]=_0x3677db;return _0x2fa63d;})[_0x9505('0x25')](respondWithFilteredResult(_0x59929c,_0x13b628))['catch'](handleError(_0x59929c,null));};exports['show']=function(_0xb6cb47,_0x202e27){var _0x1a15b9={'raw':![],'where':{'id':_0xb6cb47['params']['id']}},_0x106048={};_0x106048[_0x9505('0x38')]=_[_0x9505('0x34')](db[_0x9505('0x2f')][_0x9505('0x49')]);_0x106048[_0x9505('0x35')]=_['keys'](_0xb6cb47[_0x9505('0x35')]);_0x106048[_0x9505('0x36')]=_['intersection'](_0x106048['model'],_0x106048[_0x9505('0x35')]);_0x1a15b9['attributes']=_[_0x9505('0x37')](_0x106048['model'],qs[_0x9505('0x3a')](_0xb6cb47[_0x9505('0x35')][_0x9505('0x3a')]));_0x1a15b9['attributes']=_0x1a15b9[_0x9505('0x39')][_0x9505('0x3b')]?_0x1a15b9[_0x9505('0x39')]:_0x106048[_0x9505('0x38')];if(_0xb6cb47['query'][_0x9505('0x45')]){_0x1a15b9['include']=[{'all':!![]}];}_0x1a15b9=_[_0x9505('0x43')]({},_0x1a15b9,_0xb6cb47[_0x9505('0x4a')]);return db['JscriptyProject']['find'](_0x1a15b9)[_0x9505('0x25')](handleEntityNotFound(_0x202e27,null))[_0x9505('0x25')](respondWithResult(_0x202e27,null))[_0x9505('0x4b')](handleError(_0x202e27,null));};exports['create']=function(_0x10c9a5,_0x442d97){return db[_0x9505('0x2f')]['create'](_0x10c9a5[_0x9505('0x4c')],{})[_0x9505('0x25')](function(_0x5aea02){var _0x4aad43=_0x10c9a5['user'][_0x9505('0x26')]({'plain':!![]});if(!_0x4aad43)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4aad43[_0x9505('0x4d')]===_0x9505('0x4e')){var _0x3d6276=_0x5aea02[_0x9505('0x26')]({'plain':!![]});var _0x5112c2=_0x9505('0x27');return db[_0x9505('0x4f')][_0x9505('0x50')]({'where':{'name':_0x5112c2,'userProfileId':_0x4aad43['userProfileId']},'raw':!![]})[_0x9505('0x25')](function(_0x3a1223){if(_0x3a1223&&_0x3a1223['autoAssociation']===0x0){return db[_0x9505('0x28')][_0x9505('0x51')]({'name':_0x3d6276['name'],'resourceId':_0x3d6276['id'],'type':_0x3a1223[_0x9505('0x2c')],'sectionId':_0x3a1223['id']},{})[_0x9505('0x25')](function(){return _0x5aea02;});}else{return _0x5aea02;}})[_0x9505('0x4b')](function(_0x358c4e){logger[_0x9505('0x2a')](_0x9505('0x52'),_0x358c4e);throw _0x358c4e;});}return _0x5aea02;})[_0x9505('0x25')](respondWithResult(_0x442d97,0xc9))[_0x9505('0x4b')](handleError(_0x442d97,null));};exports[_0x9505('0x53')]=function(_0x5cf058,_0x5d83d6){var _0x4f88a6={'where':{'id':_0x5cf058[_0x9505('0x54')]['id']}},_0x3407a5={};_0x3407a5[_0x9505('0x38')]=_[_0x9505('0x34')](db[_0x9505('0x2f')][_0x9505('0x49')]);_0x4f88a6[_0x9505('0x39')]=_[_0x9505('0x37')](_0x3407a5['model'],qs[_0x9505('0x3a')](_0x5cf058['query'][_0x9505('0x3a')]));_0x4f88a6[_0x9505('0x39')]=_0x4f88a6[_0x9505('0x39')][_0x9505('0x3b')]?_0x4f88a6['attributes']:_0x3407a5[_0x9505('0x38')];if(_0x5cf058[_0x9505('0x35')][_0x9505('0x45')]){_0x4f88a6[_0x9505('0x46')]=[{'all':!![]}];}_0x4f88a6=_[_0x9505('0x43')]({},_0x4f88a6,_0x5cf058['options']);return db[_0x9505('0x2f')][_0x9505('0x50')](_0x4f88a6)[_0x9505('0x25')](handleEntityNotFound(_0x5d83d6,null))[_0x9505('0x25')](function(_0x163d6e){if(_0x163d6e){var _0x1c9599=_0x163d6e[_0x9505('0x26')]({'plain':!![]});_0x1c9599=qs[_0x9505('0x55')](_0x1c9599,['id',_0x9505('0x56'),_0x9505('0x57')]);_0x5cf058[_0x9505('0x4c')]=_[_0x9505('0x55')](_0x5cf058[_0x9505('0x4c')],['id','createdAt','updatedAt']);return db[_0x9505('0x2f')][_0x9505('0x51')](_[_0x9505('0x43')](_0x1c9599,_0x5cf058[_0x9505('0x4c')]),{'include':_0x5cf058[_0x9505('0x35')][_0x9505('0x45')]?[{'all':!![]}]:undefined})[_0x9505('0x25')](function(_0x28a1bc){var _0xbb935c=_0x5cf058[_0x9505('0x4e')][_0x9505('0x26')]({'plain':!![]});if(!_0xbb935c)throw new Error(_0x9505('0x58'));if(_0xbb935c[_0x9505('0x4d')]===_0x9505('0x4e')){var _0x4f1cd3=_0x28a1bc[_0x9505('0x26')]({'plain':!![]});var _0x4f2eba='Projects';return db[_0x9505('0x4f')]['find']({'where':{'name':_0x4f2eba,'userProfileId':_0xbb935c[_0x9505('0x59')]},'raw':!![]})[_0x9505('0x25')](function(_0x4fc6f5){if(_0x4fc6f5&&_0x4fc6f5[_0x9505('0x5a')]===0x0){return db[_0x9505('0x28')]['create']({'name':_0x4f1cd3[_0x9505('0x2c')],'resourceId':_0x4f1cd3['id'],'type':_0x4fc6f5[_0x9505('0x2c')],'sectionId':_0x4fc6f5['id']},{})[_0x9505('0x25')](function(){return _0x28a1bc;});}else{return _0x28a1bc;}})['catch'](function(_0x2588c2){logger[_0x9505('0x2a')](_0x9505('0x52'),_0x2588c2);throw _0x2588c2;});}return _0x28a1bc;});}})['then'](respondWithResult(_0x5d83d6,0xc9))[_0x9505('0x4b')](handleError(_0x5d83d6,null));};exports[_0x9505('0x24')]=function(_0x172f9e,_0x1d2854){if(_0x172f9e[_0x9505('0x4c')]['id']){delete _0x172f9e[_0x9505('0x4c')]['id'];}return db[_0x9505('0x2f')]['find']({'where':{'id':_0x172f9e[_0x9505('0x54')]['id']}})['then'](handleEntityNotFound(_0x1d2854,null))[_0x9505('0x25')](saveUpdates(_0x172f9e['body'],null))[_0x9505('0x25')](respondWithResult(_0x1d2854,null))['catch'](handleError(_0x1d2854,null));};exports[_0x9505('0x29')]=function(_0x49300f,_0x294541){return db[_0x9505('0x2f')]['find']({'where':{'id':_0x49300f['params']['id']}})[_0x9505('0x25')](handleEntityNotFound(_0x294541,null))[_0x9505('0x25')](removeEntity(_0x294541,null))['catch'](handleError(_0x294541,null));};exports['getSessions']=function(_0x1eca9d,_0x5aed49,_0x46fc4f){var _0x5efd0a={'raw':!![],'where':{}};var _0x140a53={};var _0x37cd22={'count':0x0,'rows':[]};return db[_0x9505('0x2f')][_0x9505('0x5b')]({'where':{'id':_0x1eca9d[_0x9505('0x54')]['id']}})[_0x9505('0x25')](handleEntityNotFound(_0x5aed49,null))[_0x9505('0x25')](function(_0x20dc3d){if(_0x20dc3d){_0x140a53[_0x9505('0x38')]=_['keys'](db['JscriptySessionReport'][_0x9505('0x49')]);_0x140a53[_0x9505('0x35')]=_[_0x9505('0x34')](_0x1eca9d[_0x9505('0x35')]);_0x140a53[_0x9505('0x36')]=_['intersection'](_0x140a53[_0x9505('0x38')],_0x140a53['query']);_0x5efd0a[_0x9505('0x39')]=_['intersection'](_0x140a53[_0x9505('0x38')],qs[_0x9505('0x3a')](_0x1eca9d[_0x9505('0x35')][_0x9505('0x3a')]));_0x5efd0a[_0x9505('0x39')]=_0x5efd0a[_0x9505('0x39')][_0x9505('0x3b')]?_0x5efd0a['attributes']:_0x140a53[_0x9505('0x38')];if(!_0x1eca9d[_0x9505('0x35')][_0x9505('0x3c')](_0x9505('0x3d'))){_0x5efd0a[_0x9505('0x1e')]=qs[_0x9505('0x1e')](_0x1eca9d[_0x9505('0x35')]['limit']);_0x5efd0a[_0x9505('0x1d')]=qs[_0x9505('0x1d')](_0x1eca9d[_0x9505('0x35')][_0x9505('0x1d')]);}_0x5efd0a[_0x9505('0x3e')]=qs[_0x9505('0x3f')](_0x1eca9d[_0x9505('0x35')][_0x9505('0x3f')]);_0x5efd0a[_0x9505('0x40')]=qs['filters'](_[_0x9505('0x41')](_0x1eca9d[_0x9505('0x35')],_0x140a53[_0x9505('0x36')]));_0x5efd0a[_0x9505('0x40')][_0x9505('0x5c')]=_0x20dc3d['id'];if(_0x1eca9d[_0x9505('0x35')][_0x9505('0x42')]){_0x5efd0a['where']=_['merge'](_0x5efd0a[_0x9505('0x40')],{'$or':_['map'](_0x5efd0a[_0x9505('0x39')],function(_0x358c5c){var _0x3553ae={};_0x3553ae[_0x358c5c]={'$like':'%'+_0x1eca9d[_0x9505('0x35')][_0x9505('0x42')]+'%'};return _0x3553ae;})});}_0x5efd0a=_[_0x9505('0x43')]({},_0x5efd0a,_0x1eca9d['options']);return db[_0x9505('0x5d')][_0x9505('0x1c')]({'where':_0x5efd0a['where']})[_0x9505('0x25')](function(_0x29cca1){_0x37cd22[_0x9505('0x1c')]=_0x29cca1;if(_0x1eca9d['query'][_0x9505('0x45')]){_0x5efd0a[_0x9505('0x46')]=[{'all':!![]}];}return db[_0x9505('0x5d')][_0x9505('0x47')](_0x5efd0a);})[_0x9505('0x25')](function(_0x4c0777){_0x37cd22['rows']=_0x4c0777;return _0x37cd22;});}})[_0x9505('0x25')](respondWithFilteredResult(_0x5aed49,_0x5efd0a))[_0x9505('0x4b')](handleError(_0x5aed49,null));};exports['getAnswers']=function(_0x5942f3,_0x3bbd6f,_0x575eb4){var _0x520dbc={'raw':!![],'where':{}};var _0x559443={};var _0x515890={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x9505('0x5b')]({'where':{'id':_0x5942f3[_0x9505('0x54')]['id']}})[_0x9505('0x25')](handleEntityNotFound(_0x3bbd6f,null))[_0x9505('0x25')](function(_0x5d18b2){if(_0x5d18b2){_0x559443[_0x9505('0x38')]=_[_0x9505('0x34')](db[_0x9505('0x5e')][_0x9505('0x49')]);_0x559443[_0x9505('0x35')]=_['keys'](_0x5942f3[_0x9505('0x35')]);_0x559443['filters']=_[_0x9505('0x37')](_0x559443[_0x9505('0x38')],_0x559443[_0x9505('0x35')]);_0x520dbc[_0x9505('0x39')]=_[_0x9505('0x37')](_0x559443[_0x9505('0x38')],qs[_0x9505('0x3a')](_0x5942f3[_0x9505('0x35')]['fields']));_0x520dbc[_0x9505('0x39')]=_0x520dbc[_0x9505('0x39')][_0x9505('0x3b')]?_0x520dbc[_0x9505('0x39')]:_0x559443[_0x9505('0x38')];if(!_0x5942f3[_0x9505('0x35')][_0x9505('0x3c')](_0x9505('0x3d'))){_0x520dbc[_0x9505('0x1e')]=qs['limit'](_0x5942f3['query'][_0x9505('0x1e')]);_0x520dbc['offset']=qs[_0x9505('0x1d')](_0x5942f3[_0x9505('0x35')][_0x9505('0x1d')]);}_0x520dbc[_0x9505('0x3e')]=qs['sort'](_0x5942f3[_0x9505('0x35')][_0x9505('0x3f')]);_0x520dbc[_0x9505('0x40')]=qs[_0x9505('0x36')](_[_0x9505('0x41')](_0x5942f3[_0x9505('0x35')],_0x559443[_0x9505('0x36')]));_0x520dbc['where'][_0x9505('0x5c')]=_0x5d18b2['id'];if(_0x5942f3['query']['filter']){_0x520dbc[_0x9505('0x40')]=_[_0x9505('0x43')](_0x520dbc['where'],{'$or':_['map'](_0x520dbc[_0x9505('0x39')],function(_0xfb7f13){var _0xb5f123={};_0xb5f123[_0xfb7f13]={'$like':'%'+_0x5942f3[_0x9505('0x35')]['filter']+'%'};return _0xb5f123;})});}_0x520dbc=_['merge']({},_0x520dbc,_0x5942f3[_0x9505('0x4a')]);return db[_0x9505('0x5e')]['count']({'where':_0x520dbc[_0x9505('0x40')]})['then'](function(_0x49df81){_0x515890[_0x9505('0x1c')]=_0x49df81;if(_0x5942f3[_0x9505('0x35')][_0x9505('0x45')]){_0x520dbc['include']=[{'all':!![]}];}return db[_0x9505('0x5e')]['findAll'](_0x520dbc);})[_0x9505('0x25')](function(_0x2aa7fb){_0x515890[_0x9505('0x48')]=_0x2aa7fb;return _0x515890;});}})[_0x9505('0x25')](respondWithFilteredResult(_0x3bbd6f,_0x520dbc))[_0x9505('0x4b')](handleError(_0x3bbd6f,null));};function char(_0x282465){return _0x9505('0x5f')===typeof _0x282465?String[_0x9505('0x60')][_0x9505('0x22')](null,arguments):_0x282465;}function needsEncapsulation(_0x2f97bb){return!!_0x2f97bb&&(_0x2f97bb[_0x9505('0x61')]()['indexOf'](char(0xd))>=0x0||_0x2f97bb['toString']()[_0x9505('0x62')](char(0xa))>=0x0||_0x2f97bb[_0x9505('0x61')]()[_0x9505('0x62')](char(0x2c))>=0x0||_0x2f97bb[_0x9505('0x61')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4a2cb1){var _0x5700d4=char(0x22),_0x25ee17='\x5c'+char(0x22),_0x3a5878=_0x4a2cb1[_0x9505('0x61')]()[_0x9505('0x63')](new RegExp(_0x5700d4,'g'),_0x25ee17);return _0x5700d4+_0x3a5878+_0x5700d4;}exports['getSummary']=function(_0x2db7eb,_0x447e07,_0x19b73d){var _0x4b3b18,_0x23e89b;var _0x54ab5f={'where':{'ProjectId':_0x2db7eb[_0x9505('0x54')]['id']}};if(_0x2db7eb['query'][_0x9505('0x64')]){_0x54ab5f[_0x9505('0x40')][_0x9505('0x65')]=JSON[_0x9505('0x66')](_0x2db7eb[_0x9505('0x35')][_0x9505('0x64')]);}return db['JscriptySessionReport'][_0x9505('0x47')](_0x54ab5f)[_0x9505('0x25')](handleEntityNotFound(_0x447e07,null))[_0x9505('0x25')](function(_0x2d0fbf){if(_0x2d0fbf){_0x4b3b18=_0x2d0fbf;return db[_0x9505('0x67')][_0x9505('0x47')]({'where':{'SessionId':{'$in':_[_0x9505('0x33')](_0x4b3b18,'id')},'ProjectId':_0x2db7eb[_0x9505('0x54')]['id']},'order':_0x9505('0x68')});}})[_0x9505('0x25')](handleEntityNotFound(_0x447e07,null))[_0x9505('0x25')](function(_0x29f22f){if(_0x29f22f){_0x23e89b=_0x29f22f;var _0x29fa32={};for(var _0x160021=0x0,_0x51a07b=_0x23e89b['length'];_0x160021<_0x51a07b;_0x160021++){if(!_0x29fa32['hasOwnProperty'](_0x23e89b[_0x160021]['questionId'])){_0x29fa32[_0x23e89b[_0x160021][_0x9505('0x69')]]=needsEncapsulation(_0x23e89b[_0x160021][_0x9505('0x6a')])?encapsulate(_0x23e89b[_0x160021][_0x9505('0x6a')]):_0x23e89b[_0x160021]['question'];}}var _0x2e3a0e=[],_0x5f0a7d={};for(var _0xbbbe83=0x0,_0x2bb69b=_0x4b3b18['length'];_0xbbbe83<_0x2bb69b;_0xbbbe83++){_0x5f0a7d={'ProjectId':_0x2db7eb[_0x9505('0x54')]['id'],'SessionId':_0x4b3b18[_0xbbbe83]['id'],'StartTime':moment(_0x4b3b18[_0xbbbe83][_0x9505('0x65')])[_0x9505('0x6b')](_0x9505('0x6c'))};for(var _0x129ad2=0x0,_0x3f3db1=_0x23e89b['length'];_0x129ad2<_0x3f3db1;_0x129ad2++){if(_0x23e89b[_0x129ad2][_0x9505('0x6d')]==_0x4b3b18[_0xbbbe83]['id']&&_0x29fa32[_0x9505('0x3c')](_0x23e89b[_0x129ad2][_0x9505('0x69')])){_0x5f0a7d[_0x29fa32[_0x23e89b[_0x129ad2][_0x9505('0x69')]]]=_0x23e89b[_0x129ad2]['answer'];}}for(var _0x3b04c3 in _0x29fa32){if(!_0x5f0a7d[_0x9505('0x3c')](_0x29fa32[_0x3b04c3])){_0x5f0a7d[_0x29fa32[_0x3b04c3]]=null;}}_0x2e3a0e[_0x9505('0x6e')](_0x5f0a7d);}return _0x2e3a0e;}})[_0x9505('0x25')](function(_0x239bb6){if(!_[_0x9505('0x6f')](_0x239bb6)){var _0x422f08=toCsv(_0x239bb6);var _0x3296dc=Date[_0x9505('0x70')]();fs[_0x9505('0x71')](util[_0x9505('0x6b')](_0x9505('0x72'),_0x2db7eb[_0x9505('0x54')]['id'],_0x3296dc),_0x422f08);_0x447e07['setHeader']('Content-disposition','attachment;\x20filename='+util['format'](_0x9505('0x73'),_0x2db7eb[_0x9505('0x54')]['id'],_0x3296dc));_0x447e07[_0x9505('0x74')](_0x9505('0x75'),'text/csv');return _0x447e07[_0x9505('0x76')](util[_0x9505('0x6b')](_0x9505('0x72'),_0x2db7eb['params']['id'],_0x3296dc));}else{return _0x447e07[_0x9505('0x1a')](0xcc);}})[_0x9505('0x4b')](handleError(_0x447e07,null));}; \ No newline at end of file +var _0xd52d=['to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','get','Projects','UserProfileResource','destroy','error','name','send','index','map','JscriptyProject','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','omit','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','JscriptySessionReport','nolimit','pick','ProjectId','getAnswers','JscriptyAnswerReport','rows','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd52d,0xdc));var _0xdd52=function(_0x2fcec6,_0x4822ea){_0x2fcec6=_0x2fcec6-0x0;var _0x176db8=_0xd52d[_0x2fcec6];return _0x176db8;};'use strict';var pdf=require(_0xdd52('0x0'));var emlformat=require(_0xdd52('0x1'));var rimraf=require(_0xdd52('0x2'));var zipdir=require(_0xdd52('0x3'));var jsonpatch=require(_0xdd52('0x4'));var rp=require(_0xdd52('0x5'));var moment=require(_0xdd52('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xdd52('0x7'));var util=require(_0xdd52('0x8'));var path=require(_0xdd52('0x9'));var sox=require('sox');var csv=require(_0xdd52('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdd52('0xb'));var squel=require(_0xdd52('0xc'));var crypto=require(_0xdd52('0xd'));var jsforce=require(_0xdd52('0xe'));var deskjs=require(_0xdd52('0xf'));var toCsv=require(_0xdd52('0xa'));var querystring=require(_0xdd52('0x10'));var Papa=require(_0xdd52('0x11'));var Redis=require(_0xdd52('0x12'));var authService=require(_0xdd52('0x13'));var qs=require(_0xdd52('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdd52('0x15'));var utils=require('../../config/utils');var config=require(_0xdd52('0x16'));var licenseUtil=require(_0xdd52('0x17'));var db=require(_0xdd52('0x18'))['db'];function respondWithStatusCode(_0x303525,_0x5e1a3b){_0x5e1a3b=_0x5e1a3b||0xcc;return function(_0xb54a5){if(_0xb54a5){return _0x303525[_0xdd52('0x19')](_0x5e1a3b);}return _0x303525[_0xdd52('0x1a')](_0x5e1a3b)[_0xdd52('0x1b')]();};}function respondWithResult(_0x320ea4,_0x19f92d){_0x19f92d=_0x19f92d||0xc8;return function(_0x47a337){if(_0x47a337){return _0x320ea4['status'](_0x19f92d)[_0xdd52('0x1c')](_0x47a337);}};}function respondWithFilteredResult(_0x474a17,_0x4af9ea){return function(_0x273235){if(_0x273235){var _0x3af568=_0x273235[_0xdd52('0x1d')],_0x46b24f=_0x4af9ea[_0xdd52('0x1e')],_0x16d1cf=_0x4af9ea[_0xdd52('0x1e')]+_0x4af9ea[_0xdd52('0x1f')],_0x4fcbee;if(_0x16d1cf>=_0x3af568){_0x16d1cf=_0x3af568;_0x4fcbee=0xc8;}else{_0x4fcbee=0xce;}_0x474a17[_0xdd52('0x1a')](_0x4fcbee);return _0x474a17[_0xdd52('0x20')](_0xdd52('0x21'),_0x46b24f+'-'+_0x16d1cf+'/'+_0x3af568)['json'](_0x273235);}return null;};}function patchUpdates(_0x1b9e3f){return function(_0x54b488){try{jsonpatch[_0xdd52('0x22')](_0x54b488,_0x1b9e3f,!![]);}catch(_0xe67dff){return BPromise[_0xdd52('0x23')](_0xe67dff);}return _0x54b488['save']();};}function saveUpdates(_0x5b0577,_0xe76a6b){return function(_0x2bbe4c){if(_0x2bbe4c){return _0x2bbe4c['update'](_0x5b0577)[_0xdd52('0x24')](function(_0x1f1fcf){return _0x1f1fcf;});}return null;};}function removeEntity(_0x20580b,_0xd704af){return function(_0x3c585d){if(_0x3c585d){return _0x3c585d['destroy']()['then'](function(){var _0x526361=_0x3c585d[_0xdd52('0x25')]({'plain':!![]});var _0x3afc95=_0xdd52('0x26');return db[_0xdd52('0x27')][_0xdd52('0x28')]({'where':{'type':_0x3afc95,'resourceId':_0x526361['id']}})[_0xdd52('0x24')](function(){return _0x3c585d;});})[_0xdd52('0x24')](function(){_0x20580b[_0xdd52('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe39184,_0x42a932){return function(_0x5bfba8){if(!_0x5bfba8){_0xe39184['sendStatus'](0x194);}return _0x5bfba8;};}function handleError(_0x15e345,_0x3abfbe){_0x3abfbe=_0x3abfbe||0x1f4;return function(_0x486ce1){logger[_0xdd52('0x29')](_0x486ce1['stack']);if(_0x486ce1[_0xdd52('0x2a')]){delete _0x486ce1['name'];}_0x15e345[_0xdd52('0x1a')](_0x3abfbe)[_0xdd52('0x2b')](_0x486ce1);};}exports[_0xdd52('0x2c')]=function(_0x207fd8,_0x2c9aee){var _0x56bec1={},_0x381412={},_0x48e03c={'count':0x0,'rows':[]};var _0x45dacb=_[_0xdd52('0x2d')](db[_0xdd52('0x2e')]['rawAttributes'],function(_0x36a4d3){return{'name':_0x36a4d3[_0xdd52('0x2f')],'type':_0x36a4d3[_0xdd52('0x30')]['key']};});_0x381412[_0xdd52('0x31')]=_[_0xdd52('0x2d')](_0x45dacb,'name');_0x381412[_0xdd52('0x32')]=_[_0xdd52('0x33')](_0x207fd8[_0xdd52('0x32')]);_0x381412['filters']=_[_0xdd52('0x34')](_0x381412[_0xdd52('0x31')],_0x381412['query']);_0x56bec1[_0xdd52('0x35')]=_[_0xdd52('0x34')](_0x381412[_0xdd52('0x31')],qs[_0xdd52('0x36')](_0x207fd8['query'][_0xdd52('0x36')]));_0x56bec1[_0xdd52('0x35')]=_0x56bec1[_0xdd52('0x35')][_0xdd52('0x37')]?_0x56bec1[_0xdd52('0x35')]:_0x381412[_0xdd52('0x31')];if(!_0x207fd8[_0xdd52('0x32')][_0xdd52('0x38')]('nolimit')){_0x56bec1[_0xdd52('0x1f')]=qs[_0xdd52('0x1f')](_0x207fd8[_0xdd52('0x32')]['limit']);_0x56bec1[_0xdd52('0x1e')]=qs['offset'](_0x207fd8[_0xdd52('0x32')][_0xdd52('0x1e')]);}_0x56bec1[_0xdd52('0x39')]=qs['sort'](_0x207fd8[_0xdd52('0x32')][_0xdd52('0x3a')]);_0x56bec1[_0xdd52('0x3b')]=qs['filters'](_['pick'](_0x207fd8[_0xdd52('0x32')],_0x381412[_0xdd52('0x3c')]),_0x45dacb);if(_0x207fd8['query'][_0xdd52('0x3d')]){_0x56bec1[_0xdd52('0x3b')]=_[_0xdd52('0x3e')](_0x56bec1[_0xdd52('0x3b')],{'$or':_[_0xdd52('0x2d')](_0x45dacb,function(_0x578713){if(_0x578713[_0xdd52('0x30')]!==_0xdd52('0x3f')){var _0x328c93={};_0x328c93[_0x578713[_0xdd52('0x2a')]]={'$like':'%'+_0x207fd8['query'][_0xdd52('0x3d')]+'%'};return _0x328c93;}})});}_0x56bec1=_[_0xdd52('0x3e')]({},_0x56bec1,_0x207fd8[_0xdd52('0x40')]);var _0x55f93c={'where':_0x56bec1['where']};return db[_0xdd52('0x2e')]['count'](_0x55f93c)['then'](function(_0x3a96c3){_0x48e03c[_0xdd52('0x1d')]=_0x3a96c3;if(_0x207fd8[_0xdd52('0x32')][_0xdd52('0x41')]){_0x56bec1['include']=[{'all':!![]}];}return db['JscriptyProject'][_0xdd52('0x42')](_0x56bec1);})[_0xdd52('0x24')](function(_0x46d4cc){_0x48e03c['rows']=_0x46d4cc;return _0x48e03c;})[_0xdd52('0x24')](respondWithFilteredResult(_0x2c9aee,_0x56bec1))[_0xdd52('0x43')](handleError(_0x2c9aee,null));};exports[_0xdd52('0x44')]=function(_0x49f57a,_0x277549){var _0x2e8c51={'raw':![],'where':{'id':_0x49f57a[_0xdd52('0x45')]['id']}},_0x114d43={};_0x114d43[_0xdd52('0x31')]=_[_0xdd52('0x33')](db[_0xdd52('0x2e')][_0xdd52('0x46')]);_0x114d43[_0xdd52('0x32')]=_[_0xdd52('0x33')](_0x49f57a[_0xdd52('0x32')]);_0x114d43[_0xdd52('0x3c')]=_['intersection'](_0x114d43[_0xdd52('0x31')],_0x114d43[_0xdd52('0x32')]);_0x2e8c51[_0xdd52('0x35')]=_['intersection'](_0x114d43[_0xdd52('0x31')],qs[_0xdd52('0x36')](_0x49f57a['query'][_0xdd52('0x36')]));_0x2e8c51['attributes']=_0x2e8c51[_0xdd52('0x35')][_0xdd52('0x37')]?_0x2e8c51[_0xdd52('0x35')]:_0x114d43[_0xdd52('0x31')];if(_0x49f57a[_0xdd52('0x32')][_0xdd52('0x41')]){_0x2e8c51[_0xdd52('0x47')]=[{'all':!![]}];}_0x2e8c51=_[_0xdd52('0x3e')]({},_0x2e8c51,_0x49f57a[_0xdd52('0x40')]);return db[_0xdd52('0x2e')][_0xdd52('0x48')](_0x2e8c51)[_0xdd52('0x24')](handleEntityNotFound(_0x277549,null))[_0xdd52('0x24')](respondWithResult(_0x277549,null))[_0xdd52('0x43')](handleError(_0x277549,null));};exports[_0xdd52('0x49')]=function(_0xd4cb62,_0xe4e6c7){return db[_0xdd52('0x2e')][_0xdd52('0x49')](_0xd4cb62[_0xdd52('0x4a')],{})[_0xdd52('0x24')](function(_0x2ddb38){var _0x566382=_0xd4cb62['user'][_0xdd52('0x25')]({'plain':!![]});if(!_0x566382)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x566382['role']===_0xdd52('0x4b')){var _0x3d8880=_0x2ddb38[_0xdd52('0x25')]({'plain':!![]});var _0x81f4df='Projects';return db[_0xdd52('0x4c')][_0xdd52('0x48')]({'where':{'name':_0x81f4df,'userProfileId':_0x566382[_0xdd52('0x4d')]},'raw':!![]})[_0xdd52('0x24')](function(_0x1162a4){if(_0x1162a4&&_0x1162a4[_0xdd52('0x4e')]===0x0){return db[_0xdd52('0x27')][_0xdd52('0x49')]({'name':_0x3d8880[_0xdd52('0x2a')],'resourceId':_0x3d8880['id'],'type':_0x1162a4[_0xdd52('0x2a')],'sectionId':_0x1162a4['id']},{})['then'](function(){return _0x2ddb38;});}else{return _0x2ddb38;}})[_0xdd52('0x43')](function(_0x1c8fbf){logger[_0xdd52('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c8fbf);throw _0x1c8fbf;});}return _0x2ddb38;})['then'](respondWithResult(_0xe4e6c7,0xc9))[_0xdd52('0x43')](handleError(_0xe4e6c7,null));};exports['clone']=function(_0x5d2abf,_0x3f47d0){var _0x1d8e18={'where':{'id':_0x5d2abf[_0xdd52('0x45')]['id']}},_0x24a6c4={};_0x24a6c4['model']=_[_0xdd52('0x33')](db[_0xdd52('0x2e')][_0xdd52('0x46')]);_0x1d8e18[_0xdd52('0x35')]=_['intersection'](_0x24a6c4['model'],qs['fields'](_0x5d2abf[_0xdd52('0x32')][_0xdd52('0x36')]));_0x1d8e18['attributes']=_0x1d8e18[_0xdd52('0x35')][_0xdd52('0x37')]?_0x1d8e18[_0xdd52('0x35')]:_0x24a6c4[_0xdd52('0x31')];if(_0x5d2abf[_0xdd52('0x32')][_0xdd52('0x41')]){_0x1d8e18[_0xdd52('0x47')]=[{'all':!![]}];}_0x1d8e18=_[_0xdd52('0x3e')]({},_0x1d8e18,_0x5d2abf['options']);return db[_0xdd52('0x2e')][_0xdd52('0x48')](_0x1d8e18)[_0xdd52('0x24')](handleEntityNotFound(_0x3f47d0,null))[_0xdd52('0x24')](function(_0x1c33ef){if(_0x1c33ef){var _0xad8659=_0x1c33ef['get']({'plain':!![]});_0xad8659=qs[_0xdd52('0x4f')](_0xad8659,['id','createdAt','updatedAt']);_0x5d2abf[_0xdd52('0x4a')]=_[_0xdd52('0x4f')](_0x5d2abf[_0xdd52('0x4a')],['id',_0xdd52('0x50'),'updatedAt']);return db[_0xdd52('0x2e')]['create'](_[_0xdd52('0x3e')](_0xad8659,_0x5d2abf['body']),{'include':_0x5d2abf[_0xdd52('0x32')][_0xdd52('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x3e7789){var _0x23e34f=_0x5d2abf[_0xdd52('0x4b')][_0xdd52('0x25')]({'plain':!![]});if(!_0x23e34f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23e34f['role']===_0xdd52('0x4b')){var _0x18a351=_0x3e7789[_0xdd52('0x25')]({'plain':!![]});var _0x36ad42=_0xdd52('0x26');return db['UserProfileSection'][_0xdd52('0x48')]({'where':{'name':_0x36ad42,'userProfileId':_0x23e34f[_0xdd52('0x4d')]},'raw':!![]})[_0xdd52('0x24')](function(_0x347020){if(_0x347020&&_0x347020[_0xdd52('0x4e')]===0x0){return db[_0xdd52('0x27')][_0xdd52('0x49')]({'name':_0x18a351[_0xdd52('0x2a')],'resourceId':_0x18a351['id'],'type':_0x347020[_0xdd52('0x2a')],'sectionId':_0x347020['id']},{})[_0xdd52('0x24')](function(){return _0x3e7789;});}else{return _0x3e7789;}})[_0xdd52('0x43')](function(_0x436a19){logger[_0xdd52('0x29')](_0xdd52('0x51'),_0x436a19);throw _0x436a19;});}return _0x3e7789;});}})[_0xdd52('0x24')](respondWithResult(_0x3f47d0,0xc9))[_0xdd52('0x43')](handleError(_0x3f47d0,null));};exports[_0xdd52('0x52')]=function(_0x219ebe,_0x5442c0){if(_0x219ebe['body']['id']){delete _0x219ebe[_0xdd52('0x4a')]['id'];}return db[_0xdd52('0x2e')]['find']({'where':{'id':_0x219ebe['params']['id']}})['then'](handleEntityNotFound(_0x5442c0,null))[_0xdd52('0x24')](saveUpdates(_0x219ebe['body'],null))[_0xdd52('0x24')](respondWithResult(_0x5442c0,null))[_0xdd52('0x43')](handleError(_0x5442c0,null));};exports['destroy']=function(_0xaeb153,_0x45aee8){return db[_0xdd52('0x2e')]['find']({'where':{'id':_0xaeb153[_0xdd52('0x45')]['id']}})['then'](handleEntityNotFound(_0x45aee8,null))[_0xdd52('0x24')](removeEntity(_0x45aee8,null))[_0xdd52('0x43')](handleError(_0x45aee8,null));};exports['getSessions']=function(_0x200b5e,_0x5f4d85,_0x2ca9a5){var _0x23d505={'raw':!![],'where':{}};var _0x3fc376={};var _0x5a2fd3={'count':0x0,'rows':[]};return db[_0xdd52('0x2e')][_0xdd52('0x53')]({'where':{'id':_0x200b5e[_0xdd52('0x45')]['id']}})['then'](handleEntityNotFound(_0x5f4d85,null))['then'](function(_0x164ef5){if(_0x164ef5){_0x3fc376[_0xdd52('0x31')]=_[_0xdd52('0x33')](db[_0xdd52('0x54')][_0xdd52('0x46')]);_0x3fc376[_0xdd52('0x32')]=_['keys'](_0x200b5e[_0xdd52('0x32')]);_0x3fc376[_0xdd52('0x3c')]=_['intersection'](_0x3fc376['model'],_0x3fc376[_0xdd52('0x32')]);_0x23d505[_0xdd52('0x35')]=_[_0xdd52('0x34')](_0x3fc376[_0xdd52('0x31')],qs[_0xdd52('0x36')](_0x200b5e['query'][_0xdd52('0x36')]));_0x23d505['attributes']=_0x23d505[_0xdd52('0x35')]['length']?_0x23d505[_0xdd52('0x35')]:_0x3fc376[_0xdd52('0x31')];if(!_0x200b5e[_0xdd52('0x32')]['hasOwnProperty'](_0xdd52('0x55'))){_0x23d505[_0xdd52('0x1f')]=qs[_0xdd52('0x1f')](_0x200b5e[_0xdd52('0x32')][_0xdd52('0x1f')]);_0x23d505['offset']=qs['offset'](_0x200b5e[_0xdd52('0x32')]['offset']);}_0x23d505['order']=qs[_0xdd52('0x3a')](_0x200b5e[_0xdd52('0x32')][_0xdd52('0x3a')]);_0x23d505[_0xdd52('0x3b')]=qs[_0xdd52('0x3c')](_[_0xdd52('0x56')](_0x200b5e['query'],_0x3fc376[_0xdd52('0x3c')]));_0x23d505[_0xdd52('0x3b')][_0xdd52('0x57')]=_0x164ef5['id'];if(_0x200b5e[_0xdd52('0x32')][_0xdd52('0x3d')]){_0x23d505[_0xdd52('0x3b')]=_[_0xdd52('0x3e')](_0x23d505[_0xdd52('0x3b')],{'$or':_[_0xdd52('0x2d')](_0x23d505[_0xdd52('0x35')],function(_0x3092ba){var _0x377e55={};_0x377e55[_0x3092ba]={'$like':'%'+_0x200b5e[_0xdd52('0x32')][_0xdd52('0x3d')]+'%'};return _0x377e55;})});}_0x23d505=_[_0xdd52('0x3e')]({},_0x23d505,_0x200b5e[_0xdd52('0x40')]);return db[_0xdd52('0x54')][_0xdd52('0x1d')]({'where':_0x23d505[_0xdd52('0x3b')]})[_0xdd52('0x24')](function(_0x1d9161){_0x5a2fd3[_0xdd52('0x1d')]=_0x1d9161;if(_0x200b5e[_0xdd52('0x32')][_0xdd52('0x41')]){_0x23d505[_0xdd52('0x47')]=[{'all':!![]}];}return db[_0xdd52('0x54')][_0xdd52('0x42')](_0x23d505);})['then'](function(_0x10e2b0){_0x5a2fd3['rows']=_0x10e2b0;return _0x5a2fd3;});}})[_0xdd52('0x24')](respondWithFilteredResult(_0x5f4d85,_0x23d505))['catch'](handleError(_0x5f4d85,null));};exports[_0xdd52('0x58')]=function(_0x5eec60,_0x69e6,_0xcd6ac2){var _0x3cf447={'raw':!![],'where':{}};var _0x314d24={};var _0x118653={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xdd52('0x53')]({'where':{'id':_0x5eec60['params']['id']}})[_0xdd52('0x24')](handleEntityNotFound(_0x69e6,null))[_0xdd52('0x24')](function(_0x4a9c1c){if(_0x4a9c1c){_0x314d24[_0xdd52('0x31')]=_[_0xdd52('0x33')](db[_0xdd52('0x59')][_0xdd52('0x46')]);_0x314d24[_0xdd52('0x32')]=_[_0xdd52('0x33')](_0x5eec60[_0xdd52('0x32')]);_0x314d24[_0xdd52('0x3c')]=_[_0xdd52('0x34')](_0x314d24[_0xdd52('0x31')],_0x314d24['query']);_0x3cf447[_0xdd52('0x35')]=_['intersection'](_0x314d24[_0xdd52('0x31')],qs['fields'](_0x5eec60['query'][_0xdd52('0x36')]));_0x3cf447[_0xdd52('0x35')]=_0x3cf447['attributes'][_0xdd52('0x37')]?_0x3cf447['attributes']:_0x314d24['model'];if(!_0x5eec60[_0xdd52('0x32')][_0xdd52('0x38')](_0xdd52('0x55'))){_0x3cf447[_0xdd52('0x1f')]=qs[_0xdd52('0x1f')](_0x5eec60[_0xdd52('0x32')][_0xdd52('0x1f')]);_0x3cf447['offset']=qs['offset'](_0x5eec60['query'][_0xdd52('0x1e')]);}_0x3cf447['order']=qs[_0xdd52('0x3a')](_0x5eec60[_0xdd52('0x32')]['sort']);_0x3cf447[_0xdd52('0x3b')]=qs[_0xdd52('0x3c')](_[_0xdd52('0x56')](_0x5eec60[_0xdd52('0x32')],_0x314d24['filters']));_0x3cf447[_0xdd52('0x3b')][_0xdd52('0x57')]=_0x4a9c1c['id'];if(_0x5eec60[_0xdd52('0x32')][_0xdd52('0x3d')]){_0x3cf447[_0xdd52('0x3b')]=_[_0xdd52('0x3e')](_0x3cf447[_0xdd52('0x3b')],{'$or':_[_0xdd52('0x2d')](_0x3cf447[_0xdd52('0x35')],function(_0x567b46){var _0x538799={};_0x538799[_0x567b46]={'$like':'%'+_0x5eec60[_0xdd52('0x32')][_0xdd52('0x3d')]+'%'};return _0x538799;})});}_0x3cf447=_[_0xdd52('0x3e')]({},_0x3cf447,_0x5eec60[_0xdd52('0x40')]);return db[_0xdd52('0x59')][_0xdd52('0x1d')]({'where':_0x3cf447[_0xdd52('0x3b')]})[_0xdd52('0x24')](function(_0x4e7166){_0x118653[_0xdd52('0x1d')]=_0x4e7166;if(_0x5eec60['query'][_0xdd52('0x41')]){_0x3cf447[_0xdd52('0x47')]=[{'all':!![]}];}return db[_0xdd52('0x59')][_0xdd52('0x42')](_0x3cf447);})['then'](function(_0xf04467){_0x118653[_0xdd52('0x5a')]=_0xf04467;return _0x118653;});}})[_0xdd52('0x24')](respondWithFilteredResult(_0x69e6,_0x3cf447))[_0xdd52('0x43')](handleError(_0x69e6,null));};function char(_0x52b03c){return _0xdd52('0x5b')===typeof _0x52b03c?String[_0xdd52('0x5c')][_0xdd52('0x22')](null,arguments):_0x52b03c;}function needsEncapsulation(_0x93244c){return!!_0x93244c&&(_0x93244c['toString']()[_0xdd52('0x5d')](char(0xd))>=0x0||_0x93244c[_0xdd52('0x5e')]()[_0xdd52('0x5d')](char(0xa))>=0x0||_0x93244c[_0xdd52('0x5e')]()[_0xdd52('0x5d')](char(0x2c))>=0x0||_0x93244c['toString']()[_0xdd52('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x7ee5e1){var _0x5960ce=char(0x22),_0x133d7='\x5c'+char(0x22),_0x2e60d7=_0x7ee5e1['toString']()[_0xdd52('0x5f')](new RegExp(_0x5960ce,'g'),_0x133d7);return _0x5960ce+_0x2e60d7+_0x5960ce;}exports[_0xdd52('0x60')]=function(_0x1d8f37,_0x57ef2e,_0x261be5){var _0x1ef62a,_0x6d15a6;var _0x490c5e={'where':{'ProjectId':_0x1d8f37[_0xdd52('0x45')]['id']}};if(_0x1d8f37['query'][_0xdd52('0x61')]){_0x490c5e['where'][_0xdd52('0x62')]=JSON['parse'](_0x1d8f37['query'][_0xdd52('0x61')]);}return db[_0xdd52('0x54')][_0xdd52('0x42')](_0x490c5e)[_0xdd52('0x24')](handleEntityNotFound(_0x57ef2e,null))[_0xdd52('0x24')](function(_0x44f11a){if(_0x44f11a){_0x1ef62a=_0x44f11a;return db[_0xdd52('0x63')][_0xdd52('0x42')]({'where':{'SessionId':{'$in':_[_0xdd52('0x2d')](_0x1ef62a,'id')},'ProjectId':_0x1d8f37[_0xdd52('0x45')]['id']},'order':'-createdAt'});}})[_0xdd52('0x24')](handleEntityNotFound(_0x57ef2e,null))[_0xdd52('0x24')](function(_0x563081){if(_0x563081){_0x6d15a6=_0x563081;var _0x222c7a={};for(var _0x476970=0x0,_0x57725b=_0x6d15a6[_0xdd52('0x37')];_0x476970<_0x57725b;_0x476970++){if(!_0x222c7a['hasOwnProperty'](_0x6d15a6[_0x476970][_0xdd52('0x64')])){_0x222c7a[_0x6d15a6[_0x476970]['questionId']]=needsEncapsulation(_0x6d15a6[_0x476970][_0xdd52('0x65')])?encapsulate(_0x6d15a6[_0x476970][_0xdd52('0x65')]):_0x6d15a6[_0x476970]['question'];}}var _0x20fbd4=[],_0x372c5f={};for(var _0x3f825c=0x0,_0x4ee268=_0x1ef62a[_0xdd52('0x37')];_0x3f825c<_0x4ee268;_0x3f825c++){_0x372c5f={'ProjectId':_0x1d8f37[_0xdd52('0x45')]['id'],'SessionId':_0x1ef62a[_0x3f825c]['id'],'StartTime':moment(_0x1ef62a[_0x3f825c][_0xdd52('0x62')])[_0xdd52('0x66')](_0xdd52('0x67'))};for(var _0x16dbd3=0x0,_0x5e21f1=_0x6d15a6[_0xdd52('0x37')];_0x16dbd3<_0x5e21f1;_0x16dbd3++){if(_0x6d15a6[_0x16dbd3][_0xdd52('0x68')]==_0x1ef62a[_0x3f825c]['id']&&_0x222c7a[_0xdd52('0x38')](_0x6d15a6[_0x16dbd3][_0xdd52('0x64')])){_0x372c5f[_0x222c7a[_0x6d15a6[_0x16dbd3][_0xdd52('0x64')]]]=_0x6d15a6[_0x16dbd3]['answer'];}}for(var _0x1bfd81 in _0x222c7a){if(!_0x372c5f[_0xdd52('0x38')](_0x222c7a[_0x1bfd81])){_0x372c5f[_0x222c7a[_0x1bfd81]]=null;}}_0x20fbd4[_0xdd52('0x69')](_0x372c5f);}return _0x20fbd4;}})[_0xdd52('0x24')](function(_0x1e3e6f){if(!_[_0xdd52('0x6a')](_0x1e3e6f)){var _0x1c16d6=toCsv(_0x1e3e6f);var _0x480d4d=Date[_0xdd52('0x6b')]();fs[_0xdd52('0x6c')](util[_0xdd52('0x66')](_0xdd52('0x6d'),_0x1d8f37[_0xdd52('0x45')]['id'],_0x480d4d),_0x1c16d6);_0x57ef2e[_0xdd52('0x6e')](_0xdd52('0x6f'),'attachment;\x20filename='+util[_0xdd52('0x66')](_0xdd52('0x70'),_0x1d8f37[_0xdd52('0x45')]['id'],_0x480d4d));_0x57ef2e[_0xdd52('0x6e')](_0xdd52('0x71'),_0xdd52('0x72'));return _0x57ef2e['download'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1d8f37[_0xdd52('0x45')]['id'],_0x480d4d));}else{return _0x57ef2e[_0xdd52('0x19')](0xcc);}})[_0xdd52('0x43')](handleError(_0x57ef2e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 107f2a9..1057008 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 _0x33af=['JscriptyProject','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','exports'];(function(_0x4e1642,_0x1133dc){var _0x4c7998=function(_0x571374){while(--_0x571374){_0x4e1642['push'](_0x4e1642['shift']());}};_0x4c7998(++_0x1133dc);}(_0x33af,0xa3));var _0xf33a=function(_0x2b0875,_0x21ff12){_0x2b0875=_0x2b0875-0x0;var _0xedb8d7=_0x33af[_0x2b0875];return _0xedb8d7;};'use strict';var _=require(_0xf33a('0x0'));var util=require(_0xf33a('0x1'));var logger=require(_0xf33a('0x2'))(_0xf33a('0x3'));var moment=require('moment');var BPromise=require(_0xf33a('0x4'));var rp=require(_0xf33a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0xf33a('0x7')]=function(_0x412944,_0x4818fb){return _0x412944['define'](_0xf33a('0x8'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe47e=['../../config/environment','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x372d85,_0x1110e5){var _0x5393ac=function(_0x4b68f6){while(--_0x4b68f6){_0x372d85['push'](_0x372d85['shift']());}};_0x5393ac(++_0x1110e5);}(_0xe47e,0x119));var _0xee47=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0xe47e[_0x1deb72];return _0x18bbdf;};'use strict';var _=require(_0xee47('0x0'));var util=require(_0xee47('0x1'));var logger=require(_0xee47('0x2'))(_0xee47('0x3'));var moment=require(_0xee47('0x4'));var BPromise=require('bluebird');var rp=require(_0xee47('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee47('0x6'));var config=require(_0xee47('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0xee47('0x8')]=function(_0x4e3245,_0x2828fe){return _0x4e3245[_0xee47('0x9')](_0xee47('0xa'),attributes,{'tableName':_0xee47('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 6effe50..95099e6 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 _0xde1a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x3fe34c,_0x2a15b9){var _0x4a5413=function(_0xdb3546){while(--_0xdb3546){_0x3fe34c['push'](_0x3fe34c['shift']());}};_0x4a5413(++_0x2a15b9);}(_0xde1a,0x14d));var _0xade1=function(_0x5866c6,_0x5445a5){_0x5866c6=_0x5866c6-0x0;var _0xcc2415=_0xde1a[_0x5866c6];return _0xcc2415;};'use strict';var _=require(_0xade1('0x0'));var util=require(_0xade1('0x1'));var moment=require(_0xade1('0x2'));var BPromise=require(_0xade1('0x3'));var rs=require(_0xade1('0x4'));var fs=require('fs');var Redis=require(_0xade1('0x5'));var db=require(_0xade1('0x6'))['db'];var utils=require(_0xade1('0x7'));var logger=require(_0xade1('0x8'))(_0xade1('0x9'));var config=require('../../config/environment');var jayson=require(_0xade1('0xa'));var client=jayson['client'][_0xade1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf6ab1,_0x461123,_0x358be4){return new BPromise(function(_0x35b55c,_0x2f1783){return client[_0xade1('0xc')](_0xf6ab1,_0x358be4)['then'](function(_0x4d1228){logger[_0xade1('0xd')](_0xade1('0xe'),_0x461123,_0xade1('0xf'));logger['debug'](_0xade1('0x10'),_0x461123,_0xade1('0xf'),JSON[_0xade1('0x11')](_0x4d1228));if(_0x4d1228[_0xade1('0x12')]){if(_0x4d1228[_0xade1('0x12')]['code']===0x1f4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x461123,_0x4d1228[_0xade1('0x12')][_0xade1('0x13')]);return _0x2f1783(_0x4d1228[_0xade1('0x12')][_0xade1('0x13')]);}logger[_0xade1('0x12')](_0xade1('0xe'),_0x461123,_0x4d1228[_0xade1('0x12')]['message']);return _0x35b55c(_0x4d1228['error'][_0xade1('0x13')]);}else{logger['info'](_0xade1('0xe'),_0x461123,_0xade1('0xf'));_0x35b55c(_0x4d1228[_0xade1('0x14')][_0xade1('0x13')]);}})['catch'](function(_0x16788a){logger[_0xade1('0x12')](_0xade1('0xe'),_0x461123,_0x16788a);_0x2f1783(_0x16788a);});});} \ No newline at end of file +var _0x7375=['client','http','then','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7375,0x150));var _0x5737=function(_0x26df79,_0x120fb5){_0x26df79=_0x26df79-0x0;var _0x38400d=_0x7375[_0x26df79];return _0x38400d;};'use strict';var _=require(_0x5737('0x0'));var util=require(_0x5737('0x1'));var moment=require(_0x5737('0x2'));var BPromise=require('bluebird');var rs=require(_0x5737('0x3'));var fs=require('fs');var Redis=require(_0x5737('0x4'));var db=require(_0x5737('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5737('0x6'))('rpc');var config=require(_0x5737('0x7'));var jayson=require(_0x5737('0x8'));var client=jayson[_0x5737('0x9')][_0x5737('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ce51f,_0x49ef95,_0x201888){return new BPromise(function(_0x1aec41,_0x3aec05){return client['request'](_0x2ce51f,_0x201888)[_0x5737('0xb')](function(_0x597d0e){logger['info'](_0x5737('0xc'),_0x49ef95,_0x5737('0xd'));logger[_0x5737('0xe')](_0x5737('0xf'),_0x49ef95,_0x5737('0xd'),JSON[_0x5737('0x10')](_0x597d0e));if(_0x597d0e[_0x5737('0x11')]){if(_0x597d0e[_0x5737('0x11')][_0x5737('0x12')]===0x1f4){logger[_0x5737('0x11')](_0x5737('0xc'),_0x49ef95,_0x597d0e[_0x5737('0x11')]['message']);return _0x3aec05(_0x597d0e[_0x5737('0x11')][_0x5737('0x13')]);}logger[_0x5737('0x11')](_0x5737('0xc'),_0x49ef95,_0x597d0e[_0x5737('0x11')][_0x5737('0x13')]);return _0x1aec41(_0x597d0e[_0x5737('0x11')]['message']);}else{logger[_0x5737('0x14')](_0x5737('0xc'),_0x49ef95,_0x5737('0xd'));_0x1aec41(_0x597d0e[_0x5737('0x15')][_0x5737('0x13')]);}})[_0x5737('0x16')](function(_0x356ab9){logger['error'](_0x5737('0xc'),_0x49ef95,_0x356ab9);_0x3aec05(_0x356ab9);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 61b024a..444267d 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 _0x457b=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x457b,0x192));var _0xb457=function(_0x5e6c6b,_0x394668){_0x5e6c6b=_0x5e6c6b-0x0;var _0x14a242=_0x457b[_0x5e6c6b];return _0x14a242;};'use strict';var multer=require(_0xb457('0x0'));var util=require('util');var path=require(_0xb457('0x1'));var timeout=require(_0xb457('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xb457('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb457('0x4'));var controller=require('./jscriptyQuestionReport.controller');router[_0xb457('0x5')]('/',auth[_0xb457('0x6')](),controller[_0xb457('0x7')]);router[_0xb457('0x5')](_0xb457('0x8'),auth[_0xb457('0x6')](),controller['describe']);router[_0xb457('0x5')](_0xb457('0x9'),auth[_0xb457('0x6')](),controller[_0xb457('0xa')]);router['post']('/',auth[_0xb457('0x6')](),controller['create']);router[_0xb457('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb457('0xc')]);router[_0xb457('0xd')](_0xb457('0x9'),auth[_0xb457('0x6')](),controller['destroy']);module[_0xb457('0xe')]=router; \ No newline at end of file +var _0x977f=['describe','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x2c838d,_0x1ccd8c){var _0x7fc174=function(_0x6d8663){while(--_0x6d8663){_0x2c838d['push'](_0x2c838d['shift']());}};_0x7fc174(++_0x1ccd8c);}(_0x977f,0x1c2));var _0xf977=function(_0xeeef19,_0x4aa3dd){_0xeeef19=_0xeeef19-0x0;var _0x4290a0=_0x977f[_0xeeef19];return _0x4290a0;};'use strict';var multer=require(_0xf977('0x0'));var util=require(_0xf977('0x1'));var path=require(_0xf977('0x2'));var timeout=require(_0xf977('0x3'));var express=require(_0xf977('0x4'));var router=express[_0xf977('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf977('0x6'));var config=require(_0xf977('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0xf977('0x8')]('/',auth[_0xf977('0x9')](),controller[_0xf977('0xa')]);router['get'](_0xf977('0xb'),auth[_0xf977('0x9')](),controller[_0xf977('0xc')]);router[_0xf977('0x8')]('/:id',auth[_0xf977('0x9')](),controller['show']);router[_0xf977('0xd')]('/',auth[_0xf977('0x9')](),controller[_0xf977('0xe')]);router[_0xf977('0xf')]('/:id',auth[_0xf977('0x9')](),controller[_0xf977('0x10')]);router[_0xf977('0x11')](_0xf977('0x12'),auth[_0xf977('0x9')](),controller[_0xf977('0x13')]);module[_0xf977('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 45d2459..2233aa3 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 _0x3d85=['long','STRING'];(function(_0x55ba48,_0x27d352){var _0x3f43e5=function(_0x3d0a07){while(--_0x3d0a07){_0x55ba48['push'](_0x55ba48['shift']());}};_0x3f43e5(++_0x27d352);}(_0x3d85,0xe3));var _0x53d8=function(_0x5626b8,_0x49d3cc){_0x5626b8=_0x5626b8-0x0;var _0x1247d0=_0x3d85[_0x5626b8];return _0x1247d0;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0x53d8('0x0')]},'answer':{'type':Sequelize['TEXT'](_0x53d8('0x1'))},'membername':{'type':Sequelize[_0x53d8('0x0')]},'projectname':{'type':Sequelize[_0x53d8('0x0')]},'queue':{'type':Sequelize[_0x53d8('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x53d8('0x0')]},'calleridnum':{'type':Sequelize[_0x53d8('0x0')]},'questionId':{'type':Sequelize[_0x53d8('0x0')]}}; \ No newline at end of file +var _0x1d9b=['sequelize','exports','STRING','TEXT','long'];(function(_0x31509a,_0x4d80b7){var _0x31700a=function(_0x5c0d58){while(--_0x5c0d58){_0x31509a['push'](_0x31509a['shift']());}};_0x31700a(++_0x4d80b7);}(_0x1d9b,0xa5));var _0xb1d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d9b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb1d9('0x0'));module[_0xb1d9('0x1')]={'question':{'type':Sequelize[_0xb1d9('0x2')]},'answer':{'type':Sequelize[_0xb1d9('0x3')](_0xb1d9('0x4'))},'membername':{'type':Sequelize[_0xb1d9('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb1d9('0x2')]},'uniqueid':{'type':Sequelize[_0xb1d9('0x2')]},'calleridname':{'type':Sequelize[_0xb1d9('0x2')]},'calleridnum':{'type':Sequelize[_0xb1d9('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 6d80d34..6a6b70a 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 _0x5b5f=['name','send','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','keys','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','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','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','end','error'];(function(_0x3a4f6e,_0x4b14f2){var _0x394180=function(_0x34fe52){while(--_0x34fe52){_0x3a4f6e['push'](_0x3a4f6e['shift']());}};_0x394180(++_0x4b14f2);}(_0x5b5f,0x14b));var _0xf5b5=function(_0x3a4827,_0x8a4407){_0x3a4827=_0x3a4827-0x0;var _0xabf933=_0x5b5f[_0x3a4827];return _0xabf933;};'use strict';var pdf=require(_0xf5b5('0x0'));var emlformat=require(_0xf5b5('0x1'));var rimraf=require(_0xf5b5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf5b5('0x3'));var rp=require(_0xf5b5('0x4'));var moment=require('moment');var BPromise=require(_0xf5b5('0x5'));var Mustache=require(_0xf5b5('0x6'));var util=require(_0xf5b5('0x7'));var path=require(_0xf5b5('0x8'));var sox=require(_0xf5b5('0x9'));var csv=require(_0xf5b5('0xa'));var ejs=require(_0xf5b5('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf5b5('0xc'));var crypto=require(_0xf5b5('0xd'));var jsforce=require(_0xf5b5('0xe'));var deskjs=require(_0xf5b5('0xf'));var toCsv=require(_0xf5b5('0xa'));var querystring=require(_0xf5b5('0x10'));var Papa=require(_0xf5b5('0x11'));var Redis=require('ioredis');var authService=require(_0xf5b5('0x12'));var qs=require(_0xf5b5('0x13'));var as=require(_0xf5b5('0x14'));var hardwareService=require(_0xf5b5('0x15'));var logger=require('../../config/logger')(_0xf5b5('0x16'));var utils=require(_0xf5b5('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf5b5('0x18'))['db'];function respondWithStatusCode(_0x306492,_0x47c923){_0x47c923=_0x47c923||0xcc;return function(_0x2eb415){if(_0x2eb415){return _0x306492[_0xf5b5('0x19')](_0x47c923);}return _0x306492[_0xf5b5('0x1a')](_0x47c923)['end']();};}function respondWithResult(_0x1c57b4,_0x2cb7ec){_0x2cb7ec=_0x2cb7ec||0xc8;return function(_0x3485d4){if(_0x3485d4){return _0x1c57b4['status'](_0x2cb7ec)[_0xf5b5('0x1b')](_0x3485d4);}};}function respondWithFilteredResult(_0x4d1065,_0x1d1240){return function(_0x552caf){if(_0x552caf){var _0x4b7da3=_0x552caf[_0xf5b5('0x1c')],_0x3ecbd7=_0x1d1240[_0xf5b5('0x1d')],_0x39d37d=_0x1d1240[_0xf5b5('0x1d')]+_0x1d1240[_0xf5b5('0x1e')],_0x1c6929;if(_0x39d37d>=_0x4b7da3){_0x39d37d=_0x4b7da3;_0x1c6929=0xc8;}else{_0x1c6929=0xce;}_0x4d1065[_0xf5b5('0x1a')](_0x1c6929);return _0x4d1065['set']('Content-Range',_0x3ecbd7+'-'+_0x39d37d+'/'+_0x4b7da3)['json'](_0x552caf);}return null;};}function patchUpdates(_0x4e28a8){return function(_0x2d4247){try{jsonpatch[_0xf5b5('0x1f')](_0x2d4247,_0x4e28a8,!![]);}catch(_0x41abb7){return BPromise[_0xf5b5('0x20')](_0x41abb7);}return _0x2d4247[_0xf5b5('0x21')]();};}function saveUpdates(_0x49f66b,_0x110c40){return function(_0x3f0437){if(_0x3f0437){return _0x3f0437[_0xf5b5('0x22')](_0x49f66b)[_0xf5b5('0x23')](function(_0x4a1ff1){return _0x4a1ff1;});}return null;};}function removeEntity(_0x46215c,_0x16ad57){return function(_0x3d5bc8){if(_0x3d5bc8){return _0x3d5bc8[_0xf5b5('0x24')]()[_0xf5b5('0x23')](function(){_0x46215c[_0xf5b5('0x1a')](0xcc)[_0xf5b5('0x25')]();});}};}function handleEntityNotFound(_0x238f32,_0x12df36){return function(_0x16379e){if(!_0x16379e){_0x238f32[_0xf5b5('0x19')](0x194);}return _0x16379e;};}function handleError(_0x3e23bd,_0x2d436e){_0x2d436e=_0x2d436e||0x1f4;return function(_0x39f525){logger[_0xf5b5('0x26')](_0x39f525['stack']);if(_0x39f525[_0xf5b5('0x27')]){delete _0x39f525[_0xf5b5('0x27')];}_0x3e23bd[_0xf5b5('0x1a')](_0x2d436e)[_0xf5b5('0x28')](_0x39f525);};}exports[_0xf5b5('0x29')]=function(_0x249f7a,_0x312237){var _0x1638ba={},_0x3d698b={},_0x5adc79={'count':0x0,'rows':[]};var _0xace3c=_[_0xf5b5('0x2a')](db[_0xf5b5('0x2b')]['rawAttributes'],function(_0x10bdd8){return{'name':_0x10bdd8[_0xf5b5('0x2c')],'type':_0x10bdd8[_0xf5b5('0x2d')][_0xf5b5('0x2e')]};});_0x3d698b[_0xf5b5('0x2f')]=_[_0xf5b5('0x2a')](_0xace3c,_0xf5b5('0x27'));_0x3d698b['query']=_['keys'](_0x249f7a[_0xf5b5('0x30')]);_0x3d698b[_0xf5b5('0x31')]=_['intersection'](_0x3d698b[_0xf5b5('0x2f')],_0x3d698b[_0xf5b5('0x30')]);_0x1638ba[_0xf5b5('0x32')]=_[_0xf5b5('0x33')](_0x3d698b[_0xf5b5('0x2f')],qs[_0xf5b5('0x34')](_0x249f7a['query']['fields']));_0x1638ba[_0xf5b5('0x32')]=_0x1638ba['attributes'][_0xf5b5('0x35')]?_0x1638ba['attributes']:_0x3d698b[_0xf5b5('0x2f')];if(!_0x249f7a[_0xf5b5('0x30')][_0xf5b5('0x36')](_0xf5b5('0x37'))){_0x1638ba[_0xf5b5('0x1e')]=qs[_0xf5b5('0x1e')](_0x249f7a[_0xf5b5('0x30')][_0xf5b5('0x1e')]);_0x1638ba[_0xf5b5('0x1d')]=qs['offset'](_0x249f7a[_0xf5b5('0x30')][_0xf5b5('0x1d')]);}_0x1638ba[_0xf5b5('0x38')]=qs['sort'](_0x249f7a[_0xf5b5('0x30')][_0xf5b5('0x39')]);_0x1638ba[_0xf5b5('0x3a')]=qs[_0xf5b5('0x31')](_[_0xf5b5('0x3b')](_0x249f7a[_0xf5b5('0x30')],_0x3d698b[_0xf5b5('0x31')]),_0xace3c);if(_0x249f7a[_0xf5b5('0x30')][_0xf5b5('0x3c')]){_0x1638ba[_0xf5b5('0x3a')]=_[_0xf5b5('0x3d')](_0x1638ba[_0xf5b5('0x3a')],{'$or':_[_0xf5b5('0x2a')](_0xace3c,function(_0x36b209){if(_0x36b209[_0xf5b5('0x2d')]!=='VIRTUAL'){var _0x5a253c={};_0x5a253c[_0x36b209['name']]={'$like':'%'+_0x249f7a[_0xf5b5('0x30')][_0xf5b5('0x3c')]+'%'};return _0x5a253c;}})});}_0x1638ba=_[_0xf5b5('0x3d')]({},_0x1638ba,_0x249f7a[_0xf5b5('0x3e')]);var _0xe69f81={'where':_0x1638ba['where']};return db[_0xf5b5('0x2b')][_0xf5b5('0x1c')](_0xe69f81)[_0xf5b5('0x23')](function(_0x307b8b){_0x5adc79[_0xf5b5('0x1c')]=_0x307b8b;if(_0x249f7a['query'][_0xf5b5('0x3f')]){_0x1638ba[_0xf5b5('0x40')]=[{'all':!![]}];}return db[_0xf5b5('0x2b')]['findAll'](_0x1638ba);})[_0xf5b5('0x23')](function(_0x5cea5e){_0x5adc79[_0xf5b5('0x41')]=_0x5cea5e;return _0x5adc79;})['then'](respondWithFilteredResult(_0x312237,_0x1638ba))[_0xf5b5('0x42')](handleError(_0x312237,null));};exports[_0xf5b5('0x43')]=function(_0x144d2b,_0x25bc63){var _0x4b2fdc={'raw':!![],'where':{'id':_0x144d2b['params']['id']}},_0x58146f={};_0x58146f[_0xf5b5('0x2f')]=_[_0xf5b5('0x44')](db[_0xf5b5('0x2b')]['rawAttributes']);_0x58146f[_0xf5b5('0x30')]=_[_0xf5b5('0x44')](_0x144d2b[_0xf5b5('0x30')]);_0x58146f[_0xf5b5('0x31')]=_[_0xf5b5('0x33')](_0x58146f[_0xf5b5('0x2f')],_0x58146f[_0xf5b5('0x30')]);_0x4b2fdc[_0xf5b5('0x32')]=_[_0xf5b5('0x33')](_0x58146f['model'],qs['fields'](_0x144d2b['query'][_0xf5b5('0x34')]));_0x4b2fdc[_0xf5b5('0x32')]=_0x4b2fdc[_0xf5b5('0x32')][_0xf5b5('0x35')]?_0x4b2fdc[_0xf5b5('0x32')]:_0x58146f[_0xf5b5('0x2f')];if(_0x144d2b[_0xf5b5('0x30')][_0xf5b5('0x3f')]){_0x4b2fdc[_0xf5b5('0x40')]=[{'all':!![]}];}_0x4b2fdc=_[_0xf5b5('0x3d')]({},_0x4b2fdc,_0x144d2b[_0xf5b5('0x3e')]);return db[_0xf5b5('0x2b')][_0xf5b5('0x45')](_0x4b2fdc)[_0xf5b5('0x23')](handleEntityNotFound(_0x25bc63,null))[_0xf5b5('0x23')](respondWithResult(_0x25bc63,null))[_0xf5b5('0x42')](handleError(_0x25bc63,null));};exports[_0xf5b5('0x46')]=function(_0x4ef737,_0x20088c){return db[_0xf5b5('0x2b')][_0xf5b5('0x46')](_0x4ef737[_0xf5b5('0x47')],{})[_0xf5b5('0x23')](respondWithResult(_0x20088c,0xc9))['catch'](handleError(_0x20088c,null));};exports[_0xf5b5('0x22')]=function(_0x14de6b,_0x43346c){if(_0x14de6b[_0xf5b5('0x47')]['id']){delete _0x14de6b[_0xf5b5('0x47')]['id'];}return db[_0xf5b5('0x2b')][_0xf5b5('0x45')]({'where':{'id':_0x14de6b[_0xf5b5('0x48')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x43346c,null))['then'](saveUpdates(_0x14de6b['body'],null))[_0xf5b5('0x23')](respondWithResult(_0x43346c,null))[_0xf5b5('0x42')](handleError(_0x43346c,null));};exports[_0xf5b5('0x24')]=function(_0x2aa074,_0x50d69a){return db[_0xf5b5('0x2b')][_0xf5b5('0x45')]({'where':{'id':_0x2aa074[_0xf5b5('0x48')]['id']}})['then'](handleEntityNotFound(_0x50d69a,null))[_0xf5b5('0x23')](removeEntity(_0x50d69a,null))[_0xf5b5('0x42')](handleError(_0x50d69a,null));};exports[_0xf5b5('0x49')]=function(_0x533dc4,_0x10b21e){return db[_0xf5b5('0x2b')]['describe']()[_0xf5b5('0x23')](respondWithResult(_0x10b21e,null))[_0xf5b5('0x42')](handleError(_0x10b21e,null));}; \ No newline at end of file +var _0xd782=['filters','intersection','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','include','JscriptyQuestionReport','findAll','rows','show','params','fields','includeAll','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','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','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys'];(function(_0x5c2326,_0x55d9aa){var _0xdf406a=function(_0x5b6134){while(--_0x5b6134){_0x5c2326['push'](_0x5c2326['shift']());}};_0xdf406a(++_0x55d9aa);}(_0xd782,0x139));var _0x2d78=function(_0x5ac4bc,_0x359b79){_0x5ac4bc=_0x5ac4bc-0x0;var _0x480233=_0xd782[_0x5ac4bc];return _0x480233;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2d78('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d78('0x1'));var jsonpatch=require(_0x2d78('0x2'));var rp=require(_0x2d78('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2d78('0x4'));var path=require(_0x2d78('0x5'));var sox=require(_0x2d78('0x6'));var csv=require('to-csv');var ejs=require(_0x2d78('0x7'));var fs=require('fs');var _=require(_0x2d78('0x8'));var squel=require('squel');var crypto=require(_0x2d78('0x9'));var jsforce=require(_0x2d78('0xa'));var deskjs=require(_0x2d78('0xb'));var toCsv=require(_0x2d78('0xc'));var querystring=require('querystring');var Papa=require(_0x2d78('0xd'));var Redis=require(_0x2d78('0xe'));var authService=require(_0x2d78('0xf'));var qs=require(_0x2d78('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d78('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2d78('0x12'));var config=require(_0x2d78('0x13'));var licenseUtil=require(_0x2d78('0x14'));var db=require(_0x2d78('0x15'))['db'];function respondWithStatusCode(_0x16a996,_0x93b4d){_0x93b4d=_0x93b4d||0xcc;return function(_0x1a2cfe){if(_0x1a2cfe){return _0x16a996[_0x2d78('0x16')](_0x93b4d);}return _0x16a996[_0x2d78('0x17')](_0x93b4d)[_0x2d78('0x18')]();};}function respondWithResult(_0x37b414,_0x48a0a0){_0x48a0a0=_0x48a0a0||0xc8;return function(_0x170bcd){if(_0x170bcd){return _0x37b414[_0x2d78('0x17')](_0x48a0a0)[_0x2d78('0x19')](_0x170bcd);}};}function respondWithFilteredResult(_0xd8f22f,_0x29cbb7){return function(_0x12288f){if(_0x12288f){var _0x2d8efa=_0x12288f[_0x2d78('0x1a')],_0x27fab1=_0x29cbb7['offset'],_0x254673=_0x29cbb7[_0x2d78('0x1b')]+_0x29cbb7[_0x2d78('0x1c')],_0x3fec22;if(_0x254673>=_0x2d8efa){_0x254673=_0x2d8efa;_0x3fec22=0xc8;}else{_0x3fec22=0xce;}_0xd8f22f[_0x2d78('0x17')](_0x3fec22);return _0xd8f22f['set'](_0x2d78('0x1d'),_0x27fab1+'-'+_0x254673+'/'+_0x2d8efa)[_0x2d78('0x19')](_0x12288f);}return null;};}function patchUpdates(_0x548718){return function(_0x42c0f4){try{jsonpatch[_0x2d78('0x1e')](_0x42c0f4,_0x548718,!![]);}catch(_0x28ed53){return BPromise[_0x2d78('0x1f')](_0x28ed53);}return _0x42c0f4['save']();};}function saveUpdates(_0x970b17,_0x5dbd42){return function(_0x20fcd3){if(_0x20fcd3){return _0x20fcd3[_0x2d78('0x20')](_0x970b17)['then'](function(_0x254949){return _0x254949;});}return null;};}function removeEntity(_0x51d313,_0x12103a){return function(_0x22e019){if(_0x22e019){return _0x22e019[_0x2d78('0x21')]()[_0x2d78('0x22')](function(){_0x51d313[_0x2d78('0x17')](0xcc)[_0x2d78('0x18')]();});}};}function handleEntityNotFound(_0x3084d4,_0x413e19){return function(_0x21efc6){if(!_0x21efc6){_0x3084d4[_0x2d78('0x16')](0x194);}return _0x21efc6;};}function handleError(_0x492576,_0x3bb50c){_0x3bb50c=_0x3bb50c||0x1f4;return function(_0x4cf22b){logger[_0x2d78('0x23')](_0x4cf22b[_0x2d78('0x24')]);if(_0x4cf22b[_0x2d78('0x25')]){delete _0x4cf22b[_0x2d78('0x25')];}_0x492576[_0x2d78('0x17')](_0x3bb50c)[_0x2d78('0x26')](_0x4cf22b);};}exports[_0x2d78('0x27')]=function(_0x52df44,_0x333043){var _0x27b094={},_0x54c4a2={},_0x2031b9={'count':0x0,'rows':[]};var _0x3eadea=_['map'](db['JscriptyQuestionReport'][_0x2d78('0x28')],function(_0x2f52ae){return{'name':_0x2f52ae['fieldName'],'type':_0x2f52ae[_0x2d78('0x29')][_0x2d78('0x2a')]};});_0x54c4a2[_0x2d78('0x2b')]=_[_0x2d78('0x2c')](_0x3eadea,_0x2d78('0x25'));_0x54c4a2[_0x2d78('0x2d')]=_[_0x2d78('0x2e')](_0x52df44[_0x2d78('0x2d')]);_0x54c4a2[_0x2d78('0x2f')]=_[_0x2d78('0x30')](_0x54c4a2[_0x2d78('0x2b')],_0x54c4a2['query']);_0x27b094['attributes']=_[_0x2d78('0x30')](_0x54c4a2['model'],qs['fields'](_0x52df44[_0x2d78('0x2d')]['fields']));_0x27b094[_0x2d78('0x31')]=_0x27b094['attributes'][_0x2d78('0x32')]?_0x27b094['attributes']:_0x54c4a2[_0x2d78('0x2b')];if(!_0x52df44[_0x2d78('0x2d')][_0x2d78('0x33')]('nolimit')){_0x27b094['limit']=qs[_0x2d78('0x1c')](_0x52df44[_0x2d78('0x2d')][_0x2d78('0x1c')]);_0x27b094['offset']=qs['offset'](_0x52df44['query'][_0x2d78('0x1b')]);}_0x27b094['order']=qs[_0x2d78('0x34')](_0x52df44[_0x2d78('0x2d')][_0x2d78('0x34')]);_0x27b094['where']=qs[_0x2d78('0x2f')](_[_0x2d78('0x35')](_0x52df44[_0x2d78('0x2d')],_0x54c4a2[_0x2d78('0x2f')]),_0x3eadea);if(_0x52df44[_0x2d78('0x2d')][_0x2d78('0x36')]){_0x27b094[_0x2d78('0x37')]=_[_0x2d78('0x38')](_0x27b094['where'],{'$or':_['map'](_0x3eadea,function(_0x3a534e){if(_0x3a534e[_0x2d78('0x29')]!==_0x2d78('0x39')){var _0x52991a={};_0x52991a[_0x3a534e[_0x2d78('0x25')]]={'$like':'%'+_0x52df44[_0x2d78('0x2d')][_0x2d78('0x36')]+'%'};return _0x52991a;}})});}_0x27b094=_['merge']({},_0x27b094,_0x52df44[_0x2d78('0x3a')]);var _0x208e16={'where':_0x27b094[_0x2d78('0x37')]};return db['JscriptyQuestionReport'][_0x2d78('0x1a')](_0x208e16)['then'](function(_0x1a01f3){_0x2031b9[_0x2d78('0x1a')]=_0x1a01f3;if(_0x52df44[_0x2d78('0x2d')]['includeAll']){_0x27b094[_0x2d78('0x3b')]=[{'all':!![]}];}return db[_0x2d78('0x3c')][_0x2d78('0x3d')](_0x27b094);})[_0x2d78('0x22')](function(_0x5f3779){_0x2031b9[_0x2d78('0x3e')]=_0x5f3779;return _0x2031b9;})[_0x2d78('0x22')](respondWithFilteredResult(_0x333043,_0x27b094))['catch'](handleError(_0x333043,null));};exports[_0x2d78('0x3f')]=function(_0x310d02,_0xc04312){var _0x21046c={'raw':!![],'where':{'id':_0x310d02[_0x2d78('0x40')]['id']}},_0x48c5a1={};_0x48c5a1['model']=_[_0x2d78('0x2e')](db['JscriptyQuestionReport']['rawAttributes']);_0x48c5a1[_0x2d78('0x2d')]=_[_0x2d78('0x2e')](_0x310d02['query']);_0x48c5a1[_0x2d78('0x2f')]=_[_0x2d78('0x30')](_0x48c5a1[_0x2d78('0x2b')],_0x48c5a1[_0x2d78('0x2d')]);_0x21046c['attributes']=_[_0x2d78('0x30')](_0x48c5a1[_0x2d78('0x2b')],qs[_0x2d78('0x41')](_0x310d02[_0x2d78('0x2d')][_0x2d78('0x41')]));_0x21046c[_0x2d78('0x31')]=_0x21046c[_0x2d78('0x31')]['length']?_0x21046c[_0x2d78('0x31')]:_0x48c5a1[_0x2d78('0x2b')];if(_0x310d02[_0x2d78('0x2d')][_0x2d78('0x42')]){_0x21046c[_0x2d78('0x3b')]=[{'all':!![]}];}_0x21046c=_[_0x2d78('0x38')]({},_0x21046c,_0x310d02[_0x2d78('0x3a')]);return db[_0x2d78('0x3c')][_0x2d78('0x43')](_0x21046c)[_0x2d78('0x22')](handleEntityNotFound(_0xc04312,null))[_0x2d78('0x22')](respondWithResult(_0xc04312,null))[_0x2d78('0x44')](handleError(_0xc04312,null));};exports[_0x2d78('0x45')]=function(_0x1db17e,_0x19075e){return db['JscriptyQuestionReport'][_0x2d78('0x45')](_0x1db17e['body'],{})['then'](respondWithResult(_0x19075e,0xc9))[_0x2d78('0x44')](handleError(_0x19075e,null));};exports[_0x2d78('0x20')]=function(_0x2b361c,_0x3eb56c){if(_0x2b361c[_0x2d78('0x46')]['id']){delete _0x2b361c[_0x2d78('0x46')]['id'];}return db[_0x2d78('0x3c')][_0x2d78('0x43')]({'where':{'id':_0x2b361c[_0x2d78('0x40')]['id']}})[_0x2d78('0x22')](handleEntityNotFound(_0x3eb56c,null))['then'](saveUpdates(_0x2b361c[_0x2d78('0x46')],null))[_0x2d78('0x22')](respondWithResult(_0x3eb56c,null))[_0x2d78('0x44')](handleError(_0x3eb56c,null));};exports[_0x2d78('0x21')]=function(_0x5f204b,_0x58a22d){return db[_0x2d78('0x3c')][_0x2d78('0x43')]({'where':{'id':_0x5f204b[_0x2d78('0x40')]['id']}})[_0x2d78('0x22')](handleEntityNotFound(_0x58a22d,null))[_0x2d78('0x22')](removeEntity(_0x58a22d,null))[_0x2d78('0x44')](handleError(_0x58a22d,null));};exports['describe']=function(_0x370620,_0x5e5b1e){return db[_0x2d78('0x3c')][_0x2d78('0x47')]()[_0x2d78('0x22')](respondWithResult(_0x5e5b1e,null))[_0x2d78('0x44')](handleError(_0x5e5b1e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 06cbb4f..72d2743 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 _0x57c9=['request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash','api','bluebird'];(function(_0x2a7909,_0x50e5fa){var _0x3052b3=function(_0x5b5568){while(--_0x5b5568){_0x2a7909['push'](_0x2a7909['shift']());}};_0x3052b3(++_0x50e5fa);}(_0x57c9,0xde));var _0x957c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x57c9[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x957c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x957c('0x1'));var moment=require('moment');var BPromise=require(_0x957c('0x2'));var rp=require(_0x957c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x957c('0x4'));var config=require(_0x957c('0x5'));var attributes=require(_0x957c('0x6'));module['exports']=function(_0x2c3feb,_0x2f2423){return _0x2c3feb[_0x957c('0x7')](_0x957c('0x8'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20e2=['rimraf','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4775db,_0x1b80be){var _0x14e08a=function(_0x131a71){while(--_0x131a71){_0x4775db['push'](_0x4775db['shift']());}};_0x14e08a(++_0x1b80be);}(_0x20e2,0x87));var _0x220e=function(_0x450941,_0x1ef3d9){_0x450941=_0x450941-0x0;var _0x35b1fd=_0x20e2[_0x450941];return _0x35b1fd;};'use strict';var _=require('lodash');var util=require(_0x220e('0x0'));var logger=require(_0x220e('0x1'))('api');var moment=require(_0x220e('0x2'));var BPromise=require(_0x220e('0x3'));var rp=require(_0x220e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x220e('0x5'));var config=require('../../config/environment');var attributes=require(_0x220e('0x6'));module[_0x220e('0x7')]=function(_0xd68549,_0x2ea2ac){return _0xd68549['define'](_0x220e('0x8'),attributes,{'tableName':_0x220e('0x9'),'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 2c780a3..ffa1556 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 _0x417e=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x4e5040,_0x2c288a){var _0x396234=function(_0x143d97){while(--_0x143d97){_0x4e5040['push'](_0x4e5040['shift']());}};_0x396234(++_0x2c288a);}(_0x417e,0x118));var _0xe417=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0x417e[_0x2307fa];return _0x496486;};'use strict';var _=require(_0xe417('0x0'));var util=require(_0xe417('0x1'));var moment=require('moment');var BPromise=require(_0xe417('0x2'));var rs=require(_0xe417('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe417('0x4'))['db'];var utils=require(_0xe417('0x5'));var logger=require('../../config/logger')(_0xe417('0x6'));var config=require('../../config/environment');var jayson=require(_0xe417('0x7'));var client=jayson[_0xe417('0x8')][_0xe417('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14c451,_0x490baa,_0x3d8e02){return new BPromise(function(_0x1dede5,_0x32f8ff){return client['request'](_0x14c451,_0x3d8e02)['then'](function(_0xd3b9eb){logger['info'](_0xe417('0xa'),_0x490baa,_0xe417('0xb'));logger[_0xe417('0xc')](_0xe417('0xd'),_0x490baa,_0xe417('0xb'),JSON[_0xe417('0xe')](_0xd3b9eb));if(_0xd3b9eb[_0xe417('0xf')]){if(_0xd3b9eb['error'][_0xe417('0x10')]===0x1f4){logger['error'](_0xe417('0xa'),_0x490baa,_0xd3b9eb[_0xe417('0xf')][_0xe417('0x11')]);return _0x32f8ff(_0xd3b9eb[_0xe417('0xf')][_0xe417('0x11')]);}logger[_0xe417('0xf')](_0xe417('0xa'),_0x490baa,_0xd3b9eb['error'][_0xe417('0x11')]);return _0x1dede5(_0xd3b9eb[_0xe417('0xf')][_0xe417('0x11')]);}else{logger[_0xe417('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x490baa,'request\x20sent');_0x1dede5(_0xd3b9eb['result'][_0xe417('0x11')]);}})[_0xe417('0x13')](function(_0x440581){logger[_0xe417('0xf')](_0xe417('0xa'),_0x490baa,_0x440581);_0x32f8ff(_0x440581);});});} \ No newline at end of file +var _0xd4dd=['error','JscriptyQuestionReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4856c7,_0x9c015e){var _0x34f2f7=function(_0x38865f){while(--_0x38865f){_0x4856c7['push'](_0x4856c7['shift']());}};_0x34f2f7(++_0x9c015e);}(_0xd4dd,0xf0));var _0xdd4d=function(_0x27c0dc,_0x51f66f){_0x27c0dc=_0x27c0dc-0x0;var _0x417c19=_0xd4dd[_0x27c0dc];return _0x417c19;};'use strict';var _=require(_0xdd4d('0x0'));var util=require(_0xdd4d('0x1'));var moment=require(_0xdd4d('0x2'));var BPromise=require('bluebird');var rs=require(_0xdd4d('0x3'));var fs=require('fs');var Redis=require(_0xdd4d('0x4'));var db=require(_0xdd4d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd4d('0x6'))(_0xdd4d('0x7'));var config=require(_0xdd4d('0x8'));var jayson=require(_0xdd4d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14cd96,_0x443ad7,_0x2fee83){return new BPromise(function(_0x14a91b,_0x2ef1cf){return client['request'](_0x14cd96,_0x2fee83)['then'](function(_0x5b280f){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x443ad7,'request\x20sent');logger['debug'](_0xdd4d('0xa'),_0x443ad7,'request\x20sent',JSON[_0xdd4d('0xb')](_0x5b280f));if(_0x5b280f[_0xdd4d('0xc')]){if(_0x5b280f[_0xdd4d('0xc')]['code']===0x1f4){logger[_0xdd4d('0xc')](_0xdd4d('0xd'),_0x443ad7,_0x5b280f[_0xdd4d('0xc')]['message']);return _0x2ef1cf(_0x5b280f['error'][_0xdd4d('0xe')]);}logger['error'](_0xdd4d('0xd'),_0x443ad7,_0x5b280f[_0xdd4d('0xc')]['message']);return _0x14a91b(_0x5b280f['error'][_0xdd4d('0xe')]);}else{logger[_0xdd4d('0xf')](_0xdd4d('0xd'),_0x443ad7,'request\x20sent');_0x14a91b(_0x5b280f[_0xdd4d('0x10')][_0xdd4d('0xe')]);}})[_0xdd4d('0x11')](function(_0x5cf726){logger['error'](_0xdd4d('0xd'),_0x443ad7,_0x5cf726);_0x2ef1cf(_0x5cf726);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 924002c..c588859 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 _0xedd9=['show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x353a70,_0x4b34be){var _0x538a57=function(_0x1712d4){while(--_0x1712d4){_0x353a70['push'](_0x353a70['shift']());}};_0x538a57(++_0x4b34be);}(_0xedd9,0xfc));var _0x9edd=function(_0x456b77,_0x4fed12){_0x456b77=_0x456b77-0x0;var _0x118bb6=_0xedd9[_0x456b77];return _0x118bb6;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/describe',auth[_0x9edd('0x9')](),controller['describe']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['get'](_0x9edd('0xd'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x14')]);module[_0x9edd('0x15')]=router; \ No newline at end of file +var _0x818f=['isAuthenticated','index','/describe','/:id','/:id/questions','getQuestions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x5c4a87,_0x35cd28){var _0x1a8c55=function(_0x202e30){while(--_0x202e30){_0x5c4a87['push'](_0x5c4a87['shift']());}};_0x1a8c55(++_0x35cd28);}(_0x818f,0x1da));var _0xf818=function(_0x3edb9c,_0x53f7f3){_0x3edb9c=_0x3edb9c-0x0;var _0x5b75fa=_0x818f[_0x3edb9c];return _0x5b75fa;};'use strict';var multer=require(_0xf818('0x0'));var util=require(_0xf818('0x1'));var path=require(_0xf818('0x2'));var timeout=require(_0xf818('0x3'));var express=require(_0xf818('0x4'));var router=express[_0xf818('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf818('0x6'));var config=require(_0xf818('0x7'));var controller=require(_0xf818('0x8'));router[_0xf818('0x9')]('/',auth[_0xf818('0xa')](),controller[_0xf818('0xb')]);router[_0xf818('0x9')](_0xf818('0xc'),auth[_0xf818('0xa')](),controller['describe']);router[_0xf818('0x9')](_0xf818('0xd'),auth[_0xf818('0xa')](),controller['show']);router['get'](_0xf818('0xe'),auth[_0xf818('0xa')](),controller[_0xf818('0xf')]);router[_0xf818('0x10')]('/',auth[_0xf818('0xa')](),controller['create']);router[_0xf818('0x11')](_0xf818('0xd'),auth[_0xf818('0xa')](),controller[_0xf818('0x12')]);router[_0xf818('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xf818('0x14')]);module[_0xf818('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 7306752..b35a8e7 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 _0x6b9b=['BOOLEAN','moment','sequelize','DATE','setDataValue','starttime','endtime','STRING'];(function(_0x4cda06,_0x3cb29c){var _0x48f3fa=function(_0x21f3a6){while(--_0x21f3a6){_0x4cda06['push'](_0x4cda06['shift']());}};_0x48f3fa(++_0x3cb29c);}(_0x6b9b,0xb9));var _0xb6b9=function(_0x49d5df,_0x4b3a11){_0x49d5df=_0x49d5df-0x0;var _0x5de0e6=_0x6b9b[_0x49d5df];return _0x5de0e6;};'use strict';var moment=require(_0xb6b9('0x0'));var Sequelize=require(_0xb6b9('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xb6b9('0x2')],'set':function(_0x420485){this[_0xb6b9('0x3')](_0xb6b9('0x4'),_0x420485);this[_0xb6b9('0x3')](_0xb6b9('0x5'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xb6b9('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb6b9('0x6')]},'uniqueid':{'type':Sequelize[_0xb6b9('0x6')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb6b9('0x6')]},'completed':{'type':Sequelize[_0xb6b9('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xd047=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue'];(function(_0x2e60e3,_0x4cb600){var _0x10e366=function(_0x3d05d5){while(--_0x3d05d5){_0x2e60e3['push'](_0x2e60e3['shift']());}};_0x10e366(++_0x4cb600);}(_0xd047,0x145));var _0x7d04=function(_0x4f8bac,_0x5bb321){_0x4f8bac=_0x4f8bac-0x0;var _0x989e16=_0xd047[_0x4f8bac];return _0x989e16;};'use strict';var moment=require(_0x7d04('0x0'));var Sequelize=require(_0x7d04('0x1'));module[_0x7d04('0x2')]={'starttime':{'type':Sequelize[_0x7d04('0x3')],'set':function(_0x213a4b){this[_0x7d04('0x4')](_0x7d04('0x5'),_0x213a4b);this[_0x7d04('0x4')](_0x7d04('0x6'),moment()[_0x7d04('0x7')](_0x7d04('0x8')));}},'endtime':{'type':Sequelize[_0x7d04('0x3')]},'membername':{'type':Sequelize[_0x7d04('0x9')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7d04('0x9')]},'calleridnum':{'type':Sequelize[_0x7d04('0x9')]},'completed':{'type':Sequelize[_0x7d04('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 79c0d2f..e2cbf33 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 _0xd8b0=['options','includeAll','include','rows','catch','show','params','intersection','merge','create','body','update','find','describe','rawAttributes','SessionId','map','JscriptyQuestionReport','findAll','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','JscriptySessionReport','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var licenseUtil=require(_0x0d8b('0x15'));var db=require(_0x0d8b('0x16'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x17')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b)[_0x0d8b('0x19')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x18')](_0x5ad086)[_0x0d8b('0x1a')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=_0xa86349[_0x0d8b('0x1b')],_0xe2e167=_0x23eb7b[_0x0d8b('0x1c')],_0x2cb03c=_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b[_0x0d8b('0x1d')],_0x5cd485;if(_0x2cb03c>=_0x17f7df){_0x2cb03c=_0x17f7df;_0x5cd485=0xc8;}else{_0x5cd485=0xce;}_0x4f6f21[_0x0d8b('0x18')](_0x5cd485);return _0x4f6f21[_0x0d8b('0x1e')](_0x0d8b('0x1f'),_0xe2e167+'-'+_0x2cb03c+'/'+_0x17f7df)[_0x0d8b('0x1a')](_0xa86349);}return null;};}function patchUpdates(_0x4a15bf){return function(_0x27512e){try{jsonpatch[_0x0d8b('0x20')](_0x27512e,_0x4a15bf,!![]);}catch(_0x196c0a){return BPromise[_0x0d8b('0x21')](_0x196c0a);}return _0x27512e[_0x0d8b('0x22')]();};}function saveUpdates(_0x5b709c,_0x393beb){return function(_0x352c17){if(_0x352c17){return _0x352c17['update'](_0x5b709c)['then'](function(_0x33fb87){return _0x33fb87;});}return null;};}function removeEntity(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')]()[_0x0d8b('0x24')](function(){_0x54a9a7[_0x0d8b('0x18')](0xcc)[_0x0d8b('0x19')]();});}};}function handleEntityNotFound(_0x221071,_0x2c64e2){return function(_0x30980c){if(!_0x30980c){_0x221071[_0x0d8b('0x17')](0x194);}return _0x30980c;};}function handleError(_0x27b695,_0x5e5bc3){_0x5e5bc3=_0x5e5bc3||0x1f4;return function(_0xe8bbee){logger[_0x0d8b('0x25')](_0xe8bbee['stack']);if(_0xe8bbee[_0x0d8b('0x26')]){delete _0xe8bbee['name'];}_0x27b695[_0x0d8b('0x18')](_0x5e5bc3)[_0x0d8b('0x27')](_0xe8bbee);};}exports[_0x0d8b('0x28')]=function(_0x4fe6f9,_0x59a905){var _0x28f639={},_0x3ef745={},_0x4c05ee={'count':0x0,'rows':[]};var _0xcbc4ac=_['map'](db[_0x0d8b('0x29')]['rawAttributes'],function(_0x97050a){return{'name':_0x97050a['fieldName'],'type':_0x97050a[_0x0d8b('0x2a')]['key']};});_0x3ef745[_0x0d8b('0x2b')]=_['map'](_0xcbc4ac,_0x0d8b('0x26'));_0x3ef745[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0x4fe6f9['query']);_0x3ef745['filters']=_['intersection'](_0x3ef745[_0x0d8b('0x2b')],_0x3ef745['query']);_0x28f639[_0x0d8b('0x2e')]=_['intersection'](_0x3ef745['model'],qs[_0x0d8b('0x2f')](_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x28f639[_0x0d8b('0x2e')]=_0x28f639[_0x0d8b('0x2e')][_0x0d8b('0x30')]?_0x28f639[_0x0d8b('0x2e')]:_0x3ef745[_0x0d8b('0x2b')];if(!_0x4fe6f9['query'][_0x0d8b('0x31')](_0x0d8b('0x32'))){_0x28f639['limit']=qs[_0x0d8b('0x1d')](_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x1d')]);_0x28f639['offset']=qs[_0x0d8b('0x1c')](_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x1c')]);}_0x28f639[_0x0d8b('0x33')]=qs[_0x0d8b('0x34')](_0x4fe6f9['query'][_0x0d8b('0x34')]);_0x28f639[_0x0d8b('0x35')]=qs['filters'](_[_0x0d8b('0x36')](_0x4fe6f9[_0x0d8b('0x2c')],_0x3ef745[_0x0d8b('0x37')]),_0xcbc4ac);if(_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x28f639['where']=_['merge'](_0x28f639[_0x0d8b('0x35')],{'$or':_['map'](_0xcbc4ac,function(_0x531c55){if(_0x531c55[_0x0d8b('0x2a')]!==_0x0d8b('0x39')){var _0x15ec8a={};_0x15ec8a[_0x531c55[_0x0d8b('0x26')]]={'$like':'%'+_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x15ec8a;}})});}_0x28f639=_['merge']({},_0x28f639,_0x4fe6f9[_0x0d8b('0x3a')]);var _0x6a02ad={'where':_0x28f639[_0x0d8b('0x35')]};return db[_0x0d8b('0x29')][_0x0d8b('0x1b')](_0x6a02ad)[_0x0d8b('0x24')](function(_0xf1680e){_0x4c05ee['count']=_0xf1680e;if(_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x3b')]){_0x28f639[_0x0d8b('0x3c')]=[{'all':!![]}];}return db[_0x0d8b('0x29')]['findAll'](_0x28f639);})[_0x0d8b('0x24')](function(_0x4b4bde){_0x4c05ee[_0x0d8b('0x3d')]=_0x4b4bde;return _0x4c05ee;})[_0x0d8b('0x24')](respondWithFilteredResult(_0x59a905,_0x28f639))[_0x0d8b('0x3e')](handleError(_0x59a905,null));};exports[_0x0d8b('0x3f')]=function(_0x35fa7e,_0x3e632e){var _0x1ff17d={'raw':!![],'where':{'id':_0x35fa7e[_0x0d8b('0x40')]['id']}},_0x373f69={};_0x373f69[_0x0d8b('0x2b')]=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0x373f69['query']=_['keys'](_0x35fa7e[_0x0d8b('0x2c')]);_0x373f69[_0x0d8b('0x37')]=_[_0x0d8b('0x41')](_0x373f69['model'],_0x373f69['query']);_0x1ff17d[_0x0d8b('0x2e')]=_[_0x0d8b('0x41')](_0x373f69[_0x0d8b('0x2b')],qs['fields'](_0x35fa7e[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x1ff17d['attributes']=_0x1ff17d['attributes'][_0x0d8b('0x30')]?_0x1ff17d['attributes']:_0x373f69[_0x0d8b('0x2b')];if(_0x35fa7e['query']['includeAll']){_0x1ff17d[_0x0d8b('0x3c')]=[{'all':!![]}];}_0x1ff17d=_[_0x0d8b('0x42')]({},_0x1ff17d,_0x35fa7e['options']);return db['JscriptySessionReport']['find'](_0x1ff17d)['then'](handleEntityNotFound(_0x3e632e,null))[_0x0d8b('0x24')](respondWithResult(_0x3e632e,null))[_0x0d8b('0x3e')](handleError(_0x3e632e,null));};exports[_0x0d8b('0x43')]=function(_0x490eda,_0xb0910e){return db[_0x0d8b('0x29')][_0x0d8b('0x43')](_0x490eda[_0x0d8b('0x44')],{})[_0x0d8b('0x24')](respondWithResult(_0xb0910e,0xc9))[_0x0d8b('0x3e')](handleError(_0xb0910e,null));};exports[_0x0d8b('0x45')]=function(_0x1d5067,_0x384a5e){if(_0x1d5067[_0x0d8b('0x44')]['id']){delete _0x1d5067[_0x0d8b('0x44')]['id'];}return db[_0x0d8b('0x29')][_0x0d8b('0x46')]({'where':{'id':_0x1d5067[_0x0d8b('0x40')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x384a5e,null))[_0x0d8b('0x24')](saveUpdates(_0x1d5067[_0x0d8b('0x44')],null))[_0x0d8b('0x24')](respondWithResult(_0x384a5e,null))[_0x0d8b('0x3e')](handleError(_0x384a5e,null));};exports['destroy']=function(_0x371fa0,_0x4d8850){return db['JscriptySessionReport'][_0x0d8b('0x46')]({'where':{'id':_0x371fa0[_0x0d8b('0x40')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x4d8850,null))[_0x0d8b('0x24')](removeEntity(_0x4d8850,null))['catch'](handleError(_0x4d8850,null));};exports[_0x0d8b('0x47')]=function(_0x1106d6,_0x386074){return db[_0x0d8b('0x29')][_0x0d8b('0x47')]()['then'](respondWithResult(_0x386074,null))['catch'](handleError(_0x386074,null));};exports['getQuestions']=function(_0x573f4f,_0x368ede,_0xf22c3c){var _0x5e3bb4={'raw':!![],'where':{}};var _0x4950a8={};var _0x44c5c1={'count':0x0,'rows':[]};return db[_0x0d8b('0x29')]['findOne']({'where':{'id':_0x573f4f['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x368ede,null))[_0x0d8b('0x24')](function(_0x3cd00a){if(_0x3cd00a){_0x4950a8[_0x0d8b('0x2b')]=_[_0x0d8b('0x2d')](db['JscriptyQuestionReport'][_0x0d8b('0x48')]);_0x4950a8[_0x0d8b('0x2c')]=_['keys'](_0x573f4f['query']);_0x4950a8[_0x0d8b('0x37')]=_[_0x0d8b('0x41')](_0x4950a8['model'],_0x4950a8['query']);_0x5e3bb4[_0x0d8b('0x2e')]=_[_0x0d8b('0x41')](_0x4950a8[_0x0d8b('0x2b')],qs[_0x0d8b('0x2f')](_0x573f4f['query'][_0x0d8b('0x2f')]));_0x5e3bb4['attributes']=_0x5e3bb4['attributes'][_0x0d8b('0x30')]?_0x5e3bb4[_0x0d8b('0x2e')]:_0x4950a8['model'];if(!_0x573f4f['query'][_0x0d8b('0x31')](_0x0d8b('0x32'))){_0x5e3bb4[_0x0d8b('0x1d')]=qs[_0x0d8b('0x1d')](_0x573f4f[_0x0d8b('0x2c')][_0x0d8b('0x1d')]);_0x5e3bb4[_0x0d8b('0x1c')]=qs[_0x0d8b('0x1c')](_0x573f4f['query'][_0x0d8b('0x1c')]);}_0x5e3bb4[_0x0d8b('0x33')]=qs[_0x0d8b('0x34')](_0x573f4f[_0x0d8b('0x2c')][_0x0d8b('0x34')]);_0x5e3bb4[_0x0d8b('0x35')]=qs[_0x0d8b('0x37')](_[_0x0d8b('0x36')](_0x573f4f[_0x0d8b('0x2c')],_0x4950a8['filters']));_0x5e3bb4[_0x0d8b('0x35')][_0x0d8b('0x49')]=_0x3cd00a['id'];if(_0x573f4f[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x5e3bb4[_0x0d8b('0x35')]=_['merge'](_0x5e3bb4[_0x0d8b('0x35')],{'$or':_[_0x0d8b('0x4a')](_0x5e3bb4[_0x0d8b('0x2e')],function(_0x17a87f){var _0x1d6cd4={};_0x1d6cd4[_0x17a87f]={'$like':'%'+_0x573f4f['query']['filter']+'%'};return _0x1d6cd4;})});}_0x5e3bb4=_[_0x0d8b('0x42')]({},_0x5e3bb4,_0x573f4f[_0x0d8b('0x3a')]);return db[_0x0d8b('0x4b')][_0x0d8b('0x1b')]({'where':_0x5e3bb4['where']})[_0x0d8b('0x24')](function(_0x12aef7){_0x44c5c1[_0x0d8b('0x1b')]=_0x12aef7;if(_0x573f4f['query'][_0x0d8b('0x3b')]){_0x5e3bb4['include']=[{'all':!![]}];}return db[_0x0d8b('0x4b')][_0x0d8b('0x4c')](_0x5e3bb4);})[_0x0d8b('0x24')](function(_0x26ccf0){_0x44c5c1[_0x0d8b('0x3d')]=_0x26ccf0;return _0x44c5c1;});}})[_0x0d8b('0x24')](respondWithFilteredResult(_0x368ede,_0x5e3bb4))['catch'](handleError(_0x368ede,null));}; \ No newline at end of file +var _0x70e0=['SessionId','options','count','rows','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','set','apply','update','destroy','then','sendStatus','error','name','send','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','params','includeAll','find','catch','create','body','describe','getQuestions','JscriptyQuestionReport','nolimit','filters'];(function(_0x174790,_0x1cfe82){var _0x574ec4=function(_0x228e0d){while(--_0x228e0d){_0x174790['push'](_0x174790['shift']());}};_0x574ec4(++_0x1cfe82);}(_0x70e0,0x17b));var _0x070e=function(_0x3483ed,_0x542a94){_0x3483ed=_0x3483ed-0x0;var _0x5202a3=_0x70e0[_0x3483ed];return _0x5202a3;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var licenseUtil=require(_0x070e('0x15'));var db=require(_0x070e('0x16'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x17')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x18')](_0x4a33d2)[_0x070e('0x19')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=_0x373d86['count'],_0x180897=_0x5d3a38[_0x070e('0x1a')],_0x19d9da=_0x5d3a38[_0x070e('0x1a')]+_0x5d3a38[_0x070e('0x1b')],_0x5bc71e;if(_0x19d9da>=_0xeae1a5){_0x19d9da=_0xeae1a5;_0x5bc71e=0xc8;}else{_0x5bc71e=0xce;}_0x51d14d[_0x070e('0x18')](_0x5bc71e);return _0x51d14d[_0x070e('0x1c')]('Content-Range',_0x180897+'-'+_0x19d9da+'/'+_0xeae1a5)[_0x070e('0x19')](_0x373d86);}return null;};}function patchUpdates(_0x168dc6){return function(_0x1ad3de){try{jsonpatch[_0x070e('0x1d')](_0x1ad3de,_0x168dc6,!![]);}catch(_0x259893){return BPromise['reject'](_0x259893);}return _0x1ad3de['save']();};}function saveUpdates(_0x4e958f,_0x9907cf){return function(_0x3004f0){if(_0x3004f0){return _0x3004f0[_0x070e('0x1e')](_0x4e958f)['then'](function(_0x5b184){return _0x5b184;});}return null;};}function removeEntity(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x1f')]()[_0x070e('0x20')](function(){_0x5dc5d2[_0x070e('0x18')](0xcc)[_0x070e('0x17')]();});}};}function handleEntityNotFound(_0xe405e,_0x164cdf){return function(_0x595c7e){if(!_0x595c7e){_0xe405e[_0x070e('0x21')](0x194);}return _0x595c7e;};}function handleError(_0x270061,_0x4790eb){_0x4790eb=_0x4790eb||0x1f4;return function(_0x503f4d){logger[_0x070e('0x22')](_0x503f4d['stack']);if(_0x503f4d['name']){delete _0x503f4d[_0x070e('0x23')];}_0x270061[_0x070e('0x18')](_0x4790eb)[_0x070e('0x24')](_0x503f4d);};}exports[_0x070e('0x25')]=function(_0x4763c6,_0x497f58){var _0x374c54={},_0x219e48={},_0x1d72d6={'count':0x0,'rows':[]};var _0x1d2a34=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x26373b){return{'name':_0x26373b['fieldName'],'type':_0x26373b[_0x070e('0x29')][_0x070e('0x2a')]};});_0x219e48[_0x070e('0x2b')]=_['map'](_0x1d2a34,'name');_0x219e48[_0x070e('0x2c')]=_[_0x070e('0x2d')](_0x4763c6[_0x070e('0x2c')]);_0x219e48['filters']=_[_0x070e('0x2e')](_0x219e48[_0x070e('0x2b')],_0x219e48[_0x070e('0x2c')]);_0x374c54[_0x070e('0x2f')]=_['intersection'](_0x219e48['model'],qs['fields'](_0x4763c6['query'][_0x070e('0x30')]));_0x374c54['attributes']=_0x374c54[_0x070e('0x2f')][_0x070e('0x31')]?_0x374c54['attributes']:_0x219e48['model'];if(!_0x4763c6[_0x070e('0x2c')][_0x070e('0x32')]('nolimit')){_0x374c54['limit']=qs[_0x070e('0x1b')](_0x4763c6[_0x070e('0x2c')][_0x070e('0x1b')]);_0x374c54[_0x070e('0x1a')]=qs[_0x070e('0x1a')](_0x4763c6['query']['offset']);}_0x374c54[_0x070e('0x33')]=qs[_0x070e('0x34')](_0x4763c6[_0x070e('0x2c')][_0x070e('0x34')]);_0x374c54[_0x070e('0x35')]=qs['filters'](_[_0x070e('0x36')](_0x4763c6[_0x070e('0x2c')],_0x219e48['filters']),_0x1d2a34);if(_0x4763c6[_0x070e('0x2c')][_0x070e('0x37')]){_0x374c54['where']=_['merge'](_0x374c54['where'],{'$or':_[_0x070e('0x26')](_0x1d2a34,function(_0x3dfbf7){if(_0x3dfbf7[_0x070e('0x29')]!==_0x070e('0x38')){var _0x33c5f8={};_0x33c5f8[_0x3dfbf7['name']]={'$like':'%'+_0x4763c6[_0x070e('0x2c')][_0x070e('0x37')]+'%'};return _0x33c5f8;}})});}_0x374c54=_[_0x070e('0x39')]({},_0x374c54,_0x4763c6['options']);var _0x268c5d={'where':_0x374c54[_0x070e('0x35')]};return db[_0x070e('0x27')]['count'](_0x268c5d)[_0x070e('0x20')](function(_0x348092){_0x1d72d6['count']=_0x348092;if(_0x4763c6[_0x070e('0x2c')]['includeAll']){_0x374c54[_0x070e('0x3a')]=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3b')](_0x374c54);})[_0x070e('0x20')](function(_0xd03404){_0x1d72d6['rows']=_0xd03404;return _0x1d72d6;})[_0x070e('0x20')](respondWithFilteredResult(_0x497f58,_0x374c54))['catch'](handleError(_0x497f58,null));};exports['show']=function(_0x398168,_0x42c448){var _0x38879f={'raw':!![],'where':{'id':_0x398168[_0x070e('0x3c')]['id']}},_0x4d52ff={};_0x4d52ff[_0x070e('0x2b')]=_[_0x070e('0x2d')](db[_0x070e('0x27')]['rawAttributes']);_0x4d52ff[_0x070e('0x2c')]=_['keys'](_0x398168['query']);_0x4d52ff['filters']=_[_0x070e('0x2e')](_0x4d52ff[_0x070e('0x2b')],_0x4d52ff[_0x070e('0x2c')]);_0x38879f[_0x070e('0x2f')]=_[_0x070e('0x2e')](_0x4d52ff['model'],qs[_0x070e('0x30')](_0x398168['query'][_0x070e('0x30')]));_0x38879f[_0x070e('0x2f')]=_0x38879f[_0x070e('0x2f')]['length']?_0x38879f['attributes']:_0x4d52ff[_0x070e('0x2b')];if(_0x398168['query'][_0x070e('0x3d')]){_0x38879f[_0x070e('0x3a')]=[{'all':!![]}];}_0x38879f=_[_0x070e('0x39')]({},_0x38879f,_0x398168['options']);return db[_0x070e('0x27')][_0x070e('0x3e')](_0x38879f)['then'](handleEntityNotFound(_0x42c448,null))['then'](respondWithResult(_0x42c448,null))[_0x070e('0x3f')](handleError(_0x42c448,null));};exports[_0x070e('0x40')]=function(_0x2d43ce,_0x1fc7c4){return db[_0x070e('0x27')]['create'](_0x2d43ce[_0x070e('0x41')],{})[_0x070e('0x20')](respondWithResult(_0x1fc7c4,0xc9))[_0x070e('0x3f')](handleError(_0x1fc7c4,null));};exports[_0x070e('0x1e')]=function(_0x79eaa0,_0xcd1c61){if(_0x79eaa0[_0x070e('0x41')]['id']){delete _0x79eaa0[_0x070e('0x41')]['id'];}return db[_0x070e('0x27')][_0x070e('0x3e')]({'where':{'id':_0x79eaa0[_0x070e('0x3c')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0xcd1c61,null))[_0x070e('0x20')](saveUpdates(_0x79eaa0[_0x070e('0x41')],null))[_0x070e('0x20')](respondWithResult(_0xcd1c61,null))['catch'](handleError(_0xcd1c61,null));};exports[_0x070e('0x1f')]=function(_0xa7a41b,_0x40298a){return db[_0x070e('0x27')][_0x070e('0x3e')]({'where':{'id':_0xa7a41b[_0x070e('0x3c')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x40298a,null))[_0x070e('0x20')](removeEntity(_0x40298a,null))[_0x070e('0x3f')](handleError(_0x40298a,null));};exports['describe']=function(_0x251696,_0x4c22da){return db[_0x070e('0x27')][_0x070e('0x42')]()['then'](respondWithResult(_0x4c22da,null))[_0x070e('0x3f')](handleError(_0x4c22da,null));};exports[_0x070e('0x43')]=function(_0x25466f,_0xa74805,_0x2b8e51){var _0x1e8a4f={'raw':!![],'where':{}};var _0x83f21e={};var _0x5694fa={'count':0x0,'rows':[]};return db[_0x070e('0x27')]['findOne']({'where':{'id':_0x25466f['params']['id']}})[_0x070e('0x20')](handleEntityNotFound(_0xa74805,null))[_0x070e('0x20')](function(_0x208bb7){if(_0x208bb7){_0x83f21e[_0x070e('0x2b')]=_[_0x070e('0x2d')](db[_0x070e('0x44')][_0x070e('0x28')]);_0x83f21e[_0x070e('0x2c')]=_['keys'](_0x25466f[_0x070e('0x2c')]);_0x83f21e['filters']=_['intersection'](_0x83f21e[_0x070e('0x2b')],_0x83f21e[_0x070e('0x2c')]);_0x1e8a4f['attributes']=_[_0x070e('0x2e')](_0x83f21e[_0x070e('0x2b')],qs[_0x070e('0x30')](_0x25466f[_0x070e('0x2c')][_0x070e('0x30')]));_0x1e8a4f[_0x070e('0x2f')]=_0x1e8a4f[_0x070e('0x2f')]['length']?_0x1e8a4f['attributes']:_0x83f21e['model'];if(!_0x25466f[_0x070e('0x2c')][_0x070e('0x32')](_0x070e('0x45'))){_0x1e8a4f[_0x070e('0x1b')]=qs['limit'](_0x25466f[_0x070e('0x2c')]['limit']);_0x1e8a4f[_0x070e('0x1a')]=qs[_0x070e('0x1a')](_0x25466f[_0x070e('0x2c')][_0x070e('0x1a')]);}_0x1e8a4f[_0x070e('0x33')]=qs[_0x070e('0x34')](_0x25466f['query'][_0x070e('0x34')]);_0x1e8a4f[_0x070e('0x35')]=qs[_0x070e('0x46')](_['pick'](_0x25466f[_0x070e('0x2c')],_0x83f21e[_0x070e('0x46')]));_0x1e8a4f['where'][_0x070e('0x47')]=_0x208bb7['id'];if(_0x25466f['query'][_0x070e('0x37')]){_0x1e8a4f['where']=_['merge'](_0x1e8a4f['where'],{'$or':_[_0x070e('0x26')](_0x1e8a4f[_0x070e('0x2f')],function(_0x1100d8){var _0x122198={};_0x122198[_0x1100d8]={'$like':'%'+_0x25466f[_0x070e('0x2c')][_0x070e('0x37')]+'%'};return _0x122198;})});}_0x1e8a4f=_['merge']({},_0x1e8a4f,_0x25466f[_0x070e('0x48')]);return db['JscriptyQuestionReport'][_0x070e('0x49')]({'where':_0x1e8a4f['where']})[_0x070e('0x20')](function(_0x34f410){_0x5694fa['count']=_0x34f410;if(_0x25466f[_0x070e('0x2c')]['includeAll']){_0x1e8a4f[_0x070e('0x3a')]=[{'all':!![]}];}return db[_0x070e('0x44')][_0x070e('0x3b')](_0x1e8a4f);})[_0x070e('0x20')](function(_0x764b06){_0x5694fa[_0x070e('0x4a')]=_0x764b06;return _0x5694fa;});}})[_0x070e('0x20')](respondWithFilteredResult(_0xa74805,_0x1e8a4f))[_0x070e('0x3f')](handleError(_0xa74805,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index f9477ff..095ed24 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 _0x7ace=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x28d87a,_0xe7c5f){var _0x385f93=function(_0x61fed9){while(--_0x61fed9){_0x28d87a['push'](_0x28d87a['shift']());}};_0x385f93(++_0xe7c5f);}(_0x7ace,0x16c));var _0xe7ac=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x7ace[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xe7ac('0x0'));var util=require(_0xe7ac('0x1'));var logger=require(_0xe7ac('0x2'))(_0xe7ac('0x3'));var moment=require('moment');var BPromise=require(_0xe7ac('0x4'));var rp=require(_0xe7ac('0x5'));var fs=require('fs');var path=require(_0xe7ac('0x6'));var rimraf=require(_0xe7ac('0x7'));var config=require(_0xe7ac('0x8'));var attributes=require(_0xe7ac('0x9'));module[_0xe7ac('0xa')]=function(_0x3513af,_0x5088ae){return _0x3513af[_0xe7ac('0xb')](_0xe7ac('0xc'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98bf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','util'];(function(_0xadaa7e,_0x2e5146){var _0x2c9ce0=function(_0x2d4e47){while(--_0x2d4e47){_0xadaa7e['push'](_0xadaa7e['shift']());}};_0x2c9ce0(++_0x2e5146);}(_0x98bf,0xb5));var _0xf98b=function(_0x27531a,_0x2d6749){_0x27531a=_0x27531a-0x0;var _0x57afc4=_0x98bf[_0x27531a];return _0x57afc4;};'use strict';var _=require('lodash');var util=require(_0xf98b('0x0'));var logger=require('../../config/logger')(_0xf98b('0x1'));var moment=require(_0xf98b('0x2'));var BPromise=require(_0xf98b('0x3'));var rp=require(_0xf98b('0x4'));var fs=require('fs');var path=require(_0xf98b('0x5'));var rimraf=require(_0xf98b('0x6'));var config=require(_0xf98b('0x7'));var attributes=require(_0xf98b('0x8'));module[_0xf98b('0x9')]=function(_0x3285d4,_0x4fdaa5){return _0x3285d4[_0xf98b('0xa')](_0xf98b('0xb'),attributes,{'tableName':_0xf98b('0xc'),'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 c14275b..907b800 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 _0x2f36=['error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x585f40,_0x4a3091){var _0x44fc86=function(_0x5bcedc){while(--_0x5bcedc){_0x585f40['push'](_0x585f40['shift']());}};_0x44fc86(++_0x4a3091);}(_0x2f36,0x1e4));var _0x62f3=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x2f36[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x62f3('0x0'));var util=require(_0x62f3('0x1'));var moment=require(_0x62f3('0x2'));var BPromise=require('bluebird');var rs=require(_0x62f3('0x3'));var fs=require('fs');var Redis=require(_0x62f3('0x4'));var db=require(_0x62f3('0x5'))['db'];var utils=require(_0x62f3('0x6'));var logger=require(_0x62f3('0x7'))(_0x62f3('0x8'));var config=require(_0x62f3('0x9'));var jayson=require(_0x62f3('0xa'));var client=jayson[_0x62f3('0xb')][_0x62f3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59ad70,_0x4d68a5,_0xd27cc7){return new BPromise(function(_0xbeb52f,_0x2ee5f3){return client['request'](_0x59ad70,_0xd27cc7)['then'](function(_0x5ec83f){logger[_0x62f3('0xd')](_0x62f3('0xe'),_0x4d68a5,_0x62f3('0xf'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4d68a5,_0x62f3('0xf'),JSON['stringify'](_0x5ec83f));if(_0x5ec83f[_0x62f3('0x10')]){if(_0x5ec83f[_0x62f3('0x10')][_0x62f3('0x11')]===0x1f4){logger[_0x62f3('0x10')](_0x62f3('0xe'),_0x4d68a5,_0x5ec83f[_0x62f3('0x10')][_0x62f3('0x12')]);return _0x2ee5f3(_0x5ec83f[_0x62f3('0x10')][_0x62f3('0x12')]);}logger[_0x62f3('0x10')](_0x62f3('0xe'),_0x4d68a5,_0x5ec83f[_0x62f3('0x10')][_0x62f3('0x12')]);return _0xbeb52f(_0x5ec83f[_0x62f3('0x10')][_0x62f3('0x12')]);}else{logger[_0x62f3('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4d68a5,_0x62f3('0xf'));_0xbeb52f(_0x5ec83f[_0x62f3('0x13')]['message']);}})['catch'](function(_0x457453){logger['error'](_0x62f3('0xe'),_0x4d68a5,_0x457453);_0x2ee5f3(_0x457453);});});} \ No newline at end of file +var _0x477a=['JscriptySessionReport,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info'];(function(_0x36daa5,_0x50625f){var _0x1afd91=function(_0x5e775f){while(--_0x5e775f){_0x36daa5['push'](_0x36daa5['shift']());}};_0x1afd91(++_0x50625f);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa477('0x0'));var util=require('util');var moment=require(_0xa477('0x1'));var BPromise=require(_0xa477('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa477('0x3'));var db=require(_0xa477('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa477('0x5'));var config=require(_0xa477('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa477('0x7')][_0xa477('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x203871,_0x3463cd,_0x422a5d){return new BPromise(function(_0x788380,_0x2e9476){return client[_0xa477('0x9')](_0x203871,_0x422a5d)[_0xa477('0xa')](function(_0x512d8b){logger[_0xa477('0xb')](_0xa477('0xc'),_0x3463cd,'request\x20sent');logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3463cd,'request\x20sent',JSON['stringify'](_0x512d8b));if(_0x512d8b[_0xa477('0xd')]){if(_0x512d8b[_0xa477('0xd')][_0xa477('0xe')]===0x1f4){logger['error'](_0xa477('0xc'),_0x3463cd,_0x512d8b[_0xa477('0xd')][_0xa477('0xf')]);return _0x2e9476(_0x512d8b['error'][_0xa477('0xf')]);}logger[_0xa477('0xd')](_0xa477('0xc'),_0x3463cd,_0x512d8b[_0xa477('0xd')][_0xa477('0xf')]);return _0x788380(_0x512d8b['error'][_0xa477('0xf')]);}else{logger[_0xa477('0xb')](_0xa477('0xc'),_0x3463cd,_0xa477('0x10'));_0x788380(_0x512d8b[_0xa477('0x11')][_0xa477('0xf')]);}})[_0xa477('0x12')](function(_0x90c085){logger[_0xa477('0xd')](_0xa477('0xc'),_0x3463cd,_0x90c085);_0x2e9476(_0x90c085);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index c7a4e7b..efc31e6 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 _0xf86a=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','put','/:id','exports'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0xf86a,0x1d4));var _0xaf86=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf86a[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xaf86('0x0'));var util=require(_0xaf86('0x1'));var path=require(_0xaf86('0x2'));var timeout=require(_0xaf86('0x3'));var express=require(_0xaf86('0x4'));var router=express[_0xaf86('0x5')]();var auth=require(_0xaf86('0x6'));var interaction=require(_0xaf86('0x7'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0xaf86('0x8')]('/',controller[_0xaf86('0x9')]);router[_0xaf86('0xa')](_0xaf86('0xb'),auth['isAuthenticated'](),controller['update']);module[_0xaf86('0xc')]=router; \ No newline at end of file +var _0xe87f=['express','Router','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','/:id','isAuthenticated','update','exports','util','path','connect-timeout'];(function(_0x294f21,_0x1db07e){var _0x26decc=function(_0x10abb6){while(--_0x10abb6){_0x294f21['push'](_0x294f21['shift']());}};_0x26decc(++_0x1db07e);}(_0xe87f,0xb1));var _0xfe87=function(_0x4c1dcf,_0x56b757){_0x4c1dcf=_0x4c1dcf-0x0;var _0x153529=_0xe87f[_0x4c1dcf];return _0x153529;};'use strict';var multer=require('multer');var util=require(_0xfe87('0x0'));var path=require(_0xfe87('0x1'));var timeout=require(_0xfe87('0x2'));var express=require(_0xfe87('0x3'));var router=express[_0xfe87('0x4')]();var auth=require(_0xfe87('0x5'));var interaction=require(_0xfe87('0x6'));var config=require('../../config/environment');var controller=require(_0xfe87('0x7'));router[_0xfe87('0x8')]('/',controller[_0xfe87('0x9')]);router[_0xfe87('0xa')](_0xfe87('0xb'),auth[_0xfe87('0xc')](),controller[_0xfe87('0xd')]);module[_0xfe87('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index c4d3d0d..ec3d5a8 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 _0x1967=['TEXT','STRING','INTEGER','exports'];(function(_0x30764a,_0x2356ad){var _0x25f1d8=function(_0x310912){while(--_0x310912){_0x30764a['push'](_0x30764a['shift']());}};_0x25f1d8(++_0x2356ad);}(_0x1967,0x173));var _0x7196=function(_0x540605,_0x49ade1){_0x540605=_0x540605-0x0;var _0x4d89ff=_0x1967[_0x540605];return _0x4d89ff;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'license':{'type':Sequelize[_0x7196('0x1')]},'data1':{'type':Sequelize[_0x7196('0x2')]},'data2':{'type':Sequelize[_0x7196('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x7196('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','INTEGER'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0x46ed,0x168));var _0xd46e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x46ed[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xd46e('0x2')]},'data2':{'type':Sequelize[_0xd46e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd46e('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 7c06555..e101f46 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 _0xff16=['checkLicense','key','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','json','count','offset','limit','Content-Range','apply','save','update','then','sendStatus','error','stack','send','index','keys','License','rawAttributes','query','filters','intersection','model','fields','attributes','length','merge','options','getLicense','body','params'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0xff16,0x7f));var _0x6ff1=function(_0x10da77,_0x51723f){_0x10da77=_0x10da77-0x0;var _0x387dbb=_0xff16[_0x10da77];return _0x387dbb;};'use strict';var pdf=require(_0x6ff1('0x0'));var emlformat=require(_0x6ff1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6ff1('0x2'));var jsonpatch=require(_0x6ff1('0x3'));var rp=require(_0x6ff1('0x4'));var moment=require(_0x6ff1('0x5'));var BPromise=require(_0x6ff1('0x6'));var Mustache=require(_0x6ff1('0x7'));var util=require(_0x6ff1('0x8'));var path=require(_0x6ff1('0x9'));var sox=require('sox');var csv=require(_0x6ff1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6ff1('0xb'));var squel=require(_0x6ff1('0xc'));var crypto=require(_0x6ff1('0xd'));var jsforce=require(_0x6ff1('0xe'));var deskjs=require(_0x6ff1('0xf'));var toCsv=require(_0x6ff1('0xa'));var querystring=require(_0x6ff1('0x10'));var Papa=require(_0x6ff1('0x11'));var Redis=require('ioredis');var authService=require(_0x6ff1('0x12'));var qs=require(_0x6ff1('0x13'));var as=require(_0x6ff1('0x14'));var hardwareService=require(_0x6ff1('0x15'));var logger=require(_0x6ff1('0x16'))(_0x6ff1('0x17'));var utils=require(_0x6ff1('0x18'));var config=require(_0x6ff1('0x19'));var licenseUtil=require(_0x6ff1('0x1a'));var db=require(_0x6ff1('0x1b'))['db'];function respondWithStatusCode(_0x4e8484,_0x5cf649){_0x5cf649=_0x5cf649||0xcc;return function(_0x5dacd6){if(_0x5dacd6){return _0x4e8484['sendStatus'](_0x5cf649);}return _0x4e8484[_0x6ff1('0x1c')](_0x5cf649)[_0x6ff1('0x1d')]();};}function respondWithResult(_0x1451af,_0x543e07){_0x543e07=_0x543e07||0xc8;return function(_0x58952d){if(_0x58952d){return _0x1451af['status'](_0x543e07)[_0x6ff1('0x1e')](_0x58952d);}};}function respondWithFilteredResult(_0x1ec8e9,_0x23112d){return function(_0x29e6c7){if(_0x29e6c7){var _0x36fa15=_0x29e6c7[_0x6ff1('0x1f')],_0x475144=_0x23112d[_0x6ff1('0x20')],_0x5f5c1d=_0x23112d[_0x6ff1('0x20')]+_0x23112d[_0x6ff1('0x21')],_0x155d26;if(_0x5f5c1d>=_0x36fa15){_0x5f5c1d=_0x36fa15;_0x155d26=0xc8;}else{_0x155d26=0xce;}_0x1ec8e9[_0x6ff1('0x1c')](_0x155d26);return _0x1ec8e9['set'](_0x6ff1('0x22'),_0x475144+'-'+_0x5f5c1d+'/'+_0x36fa15)[_0x6ff1('0x1e')](_0x29e6c7);}return null;};}function patchUpdates(_0x24a697){return function(_0x256457){try{jsonpatch[_0x6ff1('0x23')](_0x256457,_0x24a697,!![]);}catch(_0x1b75fb){return BPromise['reject'](_0x1b75fb);}return _0x256457[_0x6ff1('0x24')]();};}function saveUpdates(_0x54c961,_0x328325){return function(_0x3d9816){if(_0x3d9816){return _0x3d9816[_0x6ff1('0x25')](_0x54c961)[_0x6ff1('0x26')](function(_0x251415){return _0x251415;});}return null;};}function removeEntity(_0x47fd1f,_0x56027f){return function(_0x561bcd){if(_0x561bcd){return _0x561bcd['destroy']()[_0x6ff1('0x26')](function(){_0x47fd1f[_0x6ff1('0x1c')](0xcc)[_0x6ff1('0x1d')]();});}};}function handleEntityNotFound(_0x41b160,_0x1ec4f1){return function(_0x25b27d){if(!_0x25b27d){_0x41b160[_0x6ff1('0x27')](0x194);}return _0x25b27d;};}function handleError(_0x35f395,_0x4e699a){_0x4e699a=_0x4e699a||0x1f4;return function(_0x13acb3){logger[_0x6ff1('0x28')](_0x13acb3[_0x6ff1('0x29')]);if(_0x13acb3['name']){delete _0x13acb3['name'];}_0x35f395[_0x6ff1('0x1c')](_0x4e699a)[_0x6ff1('0x2a')](_0x13acb3);};}var utilLicense=require('../../config/license/util');exports[_0x6ff1('0x2b')]=function(_0xc46904,_0x5cc00f){var _0x3a062c={'raw':!![],'where':{'id':0x1}},_0x3b9d53={};_0x3b9d53['model']=_[_0x6ff1('0x2c')](db[_0x6ff1('0x2d')][_0x6ff1('0x2e')]);_0x3b9d53[_0x6ff1('0x2f')]=_['keys'](_0xc46904[_0x6ff1('0x2f')]);_0x3b9d53[_0x6ff1('0x30')]=_[_0x6ff1('0x31')](_0x3b9d53[_0x6ff1('0x32')],_0x3b9d53[_0x6ff1('0x2f')]);_0x3a062c['attributes']=_[_0x6ff1('0x31')](_0x3b9d53[_0x6ff1('0x32')],qs[_0x6ff1('0x33')](_0xc46904['query'][_0x6ff1('0x33')]));_0x3a062c['attributes']=_0x3a062c[_0x6ff1('0x34')][_0x6ff1('0x35')]?_0x3a062c[_0x6ff1('0x34')]:_0x3b9d53[_0x6ff1('0x32')];_0x3a062c=_[_0x6ff1('0x36')]({},_0x3a062c,_0xc46904[_0x6ff1('0x37')]);return utilLicense[_0x6ff1('0x38')](_0x3a062c)['then'](respondWithResult(_0x5cc00f,null))['catch'](handleError(_0x5cc00f,null));};exports[_0x6ff1('0x25')]=function(_0x8f4931,_0x216e79){if(_0x8f4931[_0x6ff1('0x39')]['id']){delete _0x8f4931[_0x6ff1('0x39')]['id'];}return db[_0x6ff1('0x2d')]['find']({'where':{'id':_0x8f4931[_0x6ff1('0x3a')]['id']}})[_0x6ff1('0x26')](handleEntityNotFound(_0x216e79,null))[_0x6ff1('0x26')](function(_0x5a48bc){var _0x1b5ce1=_0x5a48bc['get']({'plain':!![]});return utilLicense[_0x6ff1('0x3b')](_0x1b5ce1,_0x8f4931['body'][_0x6ff1('0x3c')]);})[_0x6ff1('0x26')](function(_0x51e12b){if(!_0x51e12b['demo']){return saveUpdates(_0x8f4931['body'],null);}return _0x51e12b;})[_0x6ff1('0x26')](respondWithResult(_0x216e79,null))[_0x6ff1('0x3d')](handleError(_0x216e79,null));}; \ No newline at end of file +var _0x49fe=['save','update','then','error','stack','name','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','options','catch','body','find','get','checkLicense','key','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x5188a4,_0x41866d){var _0x218c30=function(_0x47c3e4){while(--_0x47c3e4){_0x5188a4['push'](_0x5188a4['shift']());}};_0x218c30(++_0x41866d);}(_0x49fe,0x100));var _0xe49f=function(_0x594c61,_0x4b1f24){_0x594c61=_0x594c61-0x0;var _0x44cc93=_0x49fe[_0x594c61];return _0x44cc93;};'use strict';var pdf=require(_0xe49f('0x0'));var emlformat=require(_0xe49f('0x1'));var rimraf=require(_0xe49f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe49f('0x3'));var moment=require('moment');var BPromise=require(_0xe49f('0x4'));var Mustache=require(_0xe49f('0x5'));var util=require(_0xe49f('0x6'));var path=require(_0xe49f('0x7'));var sox=require('sox');var csv=require(_0xe49f('0x8'));var ejs=require(_0xe49f('0x9'));var fs=require('fs');var _=require(_0xe49f('0xa'));var squel=require(_0xe49f('0xb'));var crypto=require('crypto');var jsforce=require(_0xe49f('0xc'));var deskjs=require(_0xe49f('0xd'));var toCsv=require(_0xe49f('0x8'));var querystring=require(_0xe49f('0xe'));var Papa=require(_0xe49f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe49f('0x10'));var as=require(_0xe49f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe49f('0x12'));var utils=require(_0xe49f('0x13'));var config=require(_0xe49f('0x14'));var licenseUtil=require(_0xe49f('0x15'));var db=require(_0xe49f('0x16'))['db'];function respondWithStatusCode(_0x1d5ecc,_0x564edb){_0x564edb=_0x564edb||0xcc;return function(_0x5c8b24){if(_0x5c8b24){return _0x1d5ecc[_0xe49f('0x17')](_0x564edb);}return _0x1d5ecc[_0xe49f('0x18')](_0x564edb)[_0xe49f('0x19')]();};}function respondWithResult(_0x4213f6,_0x1cd9b4){_0x1cd9b4=_0x1cd9b4||0xc8;return function(_0x517e43){if(_0x517e43){return _0x4213f6[_0xe49f('0x18')](_0x1cd9b4)[_0xe49f('0x1a')](_0x517e43);}};}function respondWithFilteredResult(_0x2cff19,_0x575030){return function(_0x1b9291){if(_0x1b9291){var _0x4268b3=_0x1b9291[_0xe49f('0x1b')],_0x1a2a86=_0x575030[_0xe49f('0x1c')],_0x5096a8=_0x575030[_0xe49f('0x1c')]+_0x575030[_0xe49f('0x1d')],_0xcb0d16;if(_0x5096a8>=_0x4268b3){_0x5096a8=_0x4268b3;_0xcb0d16=0xc8;}else{_0xcb0d16=0xce;}_0x2cff19[_0xe49f('0x18')](_0xcb0d16);return _0x2cff19[_0xe49f('0x1e')](_0xe49f('0x1f'),_0x1a2a86+'-'+_0x5096a8+'/'+_0x4268b3)['json'](_0x1b9291);}return null;};}function patchUpdates(_0xc6c762){return function(_0x4b159c){try{jsonpatch[_0xe49f('0x20')](_0x4b159c,_0xc6c762,!![]);}catch(_0xe77edc){return BPromise[_0xe49f('0x21')](_0xe77edc);}return _0x4b159c[_0xe49f('0x22')]();};}function saveUpdates(_0x2a054e,_0xfe4d5d){return function(_0x511c45){if(_0x511c45){return _0x511c45[_0xe49f('0x23')](_0x2a054e)[_0xe49f('0x24')](function(_0x104860){return _0x104860;});}return null;};}function removeEntity(_0x128b89,_0x554398){return function(_0x40018d){if(_0x40018d){return _0x40018d['destroy']()[_0xe49f('0x24')](function(){_0x128b89[_0xe49f('0x18')](0xcc)[_0xe49f('0x19')]();});}};}function handleEntityNotFound(_0x5e8908,_0x3470e1){return function(_0x2f04c0){if(!_0x2f04c0){_0x5e8908[_0xe49f('0x17')](0x194);}return _0x2f04c0;};}function handleError(_0x12908b,_0x4ba88d){_0x4ba88d=_0x4ba88d||0x1f4;return function(_0x4d8f38){logger[_0xe49f('0x25')](_0x4d8f38[_0xe49f('0x26')]);if(_0x4d8f38[_0xe49f('0x27')]){delete _0x4d8f38[_0xe49f('0x27')];}_0x12908b[_0xe49f('0x18')](_0x4ba88d)['send'](_0x4d8f38);};}var utilLicense=require('../../config/license/util');exports[_0xe49f('0x28')]=function(_0x30848d,_0x2fec02){var _0x5731cd={'raw':!![],'where':{'id':0x1}},_0x1bbcf8={};_0x1bbcf8[_0xe49f('0x29')]=_[_0xe49f('0x2a')](db[_0xe49f('0x2b')][_0xe49f('0x2c')]);_0x1bbcf8[_0xe49f('0x2d')]=_[_0xe49f('0x2a')](_0x30848d[_0xe49f('0x2d')]);_0x1bbcf8[_0xe49f('0x2e')]=_[_0xe49f('0x2f')](_0x1bbcf8[_0xe49f('0x29')],_0x1bbcf8[_0xe49f('0x2d')]);_0x5731cd[_0xe49f('0x30')]=_['intersection'](_0x1bbcf8[_0xe49f('0x29')],qs[_0xe49f('0x31')](_0x30848d['query']['fields']));_0x5731cd[_0xe49f('0x30')]=_0x5731cd['attributes'][_0xe49f('0x32')]?_0x5731cd[_0xe49f('0x30')]:_0x1bbcf8[_0xe49f('0x29')];_0x5731cd=_['merge']({},_0x5731cd,_0x30848d[_0xe49f('0x33')]);return utilLicense['getLicense'](_0x5731cd)[_0xe49f('0x24')](respondWithResult(_0x2fec02,null))[_0xe49f('0x34')](handleError(_0x2fec02,null));};exports[_0xe49f('0x23')]=function(_0x2ad8c8,_0x1d1df1){if(_0x2ad8c8[_0xe49f('0x35')]['id']){delete _0x2ad8c8[_0xe49f('0x35')]['id'];}return db[_0xe49f('0x2b')][_0xe49f('0x36')]({'where':{'id':_0x2ad8c8['params']['id']}})[_0xe49f('0x24')](handleEntityNotFound(_0x1d1df1,null))[_0xe49f('0x24')](function(_0x247c75){var _0x454890=_0x247c75[_0xe49f('0x37')]({'plain':!![]});return utilLicense[_0xe49f('0x38')](_0x454890,_0x2ad8c8[_0xe49f('0x35')][_0xe49f('0x39')]);})[_0xe49f('0x24')](function(_0x12f835){if(!_0x12f835['demo']){return saveUpdates(_0x2ad8c8['body'],null);}return _0x12f835;})[_0xe49f('0x24')](respondWithResult(_0x1d1df1,null))[_0xe49f('0x34')](handleError(_0x1d1df1,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 0477c91..817d06c 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 _0x894c=['../../config/environment','define','util','moment','request-promise','path'];(function(_0x234154,_0x300bdc){var _0x3c6e71=function(_0x436efb){while(--_0x436efb){_0x234154['push'](_0x234154['shift']());}};_0x3c6e71(++_0x300bdc);}(_0x894c,0x98));var _0xc894=function(_0x59ad4a,_0x130b73){_0x59ad4a=_0x59ad4a-0x0;var _0x3247bb=_0x894c[_0x59ad4a];return _0x3247bb;};'use strict';var _=require('lodash');var util=require(_0xc894('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc894('0x1'));var BPromise=require('bluebird');var rp=require(_0xc894('0x2'));var fs=require('fs');var path=require(_0xc894('0x3'));var rimraf=require('rimraf');var config=require(_0xc894('0x4'));var attributes=require('./license.attributes');module['exports']=function(_0xbca199,_0x6f3adc){return _0xbca199[_0xc894('0x5')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a91=['define','License','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes'];(function(_0x4a8486,_0x280a57){var _0x223f82=function(_0x15bdaf){while(--_0x15bdaf){_0x4a8486['push'](_0x4a8486['shift']());}};_0x223f82(++_0x280a57);}(_0x4a91,0x16d));var _0x14a9=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x4a91[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0x14a9('0x0'));var util=require(_0x14a9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x14a9('0x2'));var BPromise=require(_0x14a9('0x3'));var rp=require(_0x14a9('0x4'));var fs=require('fs');var path=require(_0x14a9('0x5'));var rimraf=require(_0x14a9('0x6'));var config=require(_0x14a9('0x7'));var attributes=require(_0x14a9('0x8'));module['exports']=function(_0x22e5fe,_0x5b820e){return _0x22e5fe[_0x14a9('0x9')](_0x14a9('0xa'),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 11ba711..fe65cca 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 _0x87ae=['debug','License,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','License,\x20%s,\x20%s','request\x20sent'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0x87ae,0xf5));var _0xe87a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x87ae[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe87a('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe87a('0x1'));var db=require(_0xe87a('0x2'))['db'];var utils=require(_0xe87a('0x3'));var logger=require('../../config/logger')(_0xe87a('0x4'));var config=require(_0xe87a('0x5'));var jayson=require(_0xe87a('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x125dd3,_0x2fbd6b,_0x5dff22){return new BPromise(function(_0x379db4,_0x455b3a){return client['request'](_0x125dd3,_0x5dff22)[_0xe87a('0x7')](function(_0x278d7c){logger['info'](_0xe87a('0x8'),_0x2fbd6b,_0xe87a('0x9'));logger[_0xe87a('0xa')](_0xe87a('0xb'),_0x2fbd6b,_0xe87a('0x9'),JSON[_0xe87a('0xc')](_0x278d7c));if(_0x278d7c['error']){if(_0x278d7c['error'][_0xe87a('0xd')]===0x1f4){logger[_0xe87a('0xe')](_0xe87a('0x8'),_0x2fbd6b,_0x278d7c['error'][_0xe87a('0xf')]);return _0x455b3a(_0x278d7c[_0xe87a('0xe')]['message']);}logger[_0xe87a('0xe')](_0xe87a('0x8'),_0x2fbd6b,_0x278d7c[_0xe87a('0xe')]['message']);return _0x379db4(_0x278d7c['error']['message']);}else{logger['info'](_0xe87a('0x8'),_0x2fbd6b,_0xe87a('0x9'));_0x379db4(_0x278d7c[_0xe87a('0x10')][_0xe87a('0xf')]);}})['catch'](function(_0x415147){logger[_0xe87a('0xe')]('License,\x20%s,\x20%s',_0x2fbd6b,_0x415147);_0x455b3a(_0x415147);});});} \ No newline at end of file +var _0x151b=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x33ac3f,_0x637043){var _0x3f5274=function(_0x1ac65a){while(--_0x1ac65a){_0x33ac3f['push'](_0x33ac3f['shift']());}};_0x3f5274(++_0x637043);}(_0x151b,0x153));var _0xb151=function(_0x2960c0,_0x32966b){_0x2960c0=_0x2960c0-0x0;var _0x78a13b=_0x151b[_0x2960c0];return _0x78a13b;};'use strict';var _=require(_0xb151('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb151('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb151('0x2'));var db=require(_0xb151('0x3'))['db'];var utils=require(_0xb151('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb151('0x5'));var jayson=require(_0xb151('0x6'));var client=jayson['client'][_0xb151('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ba994,_0xd89657,_0x352713){return new BPromise(function(_0x46fdb0,_0x484caf){return client['request'](_0x4ba994,_0x352713)[_0xb151('0x8')](function(_0x20f1b2){logger['info']('License,\x20%s,\x20%s',_0xd89657,_0xb151('0x9'));logger[_0xb151('0xa')](_0xb151('0xb'),_0xd89657,_0xb151('0x9'),JSON[_0xb151('0xc')](_0x20f1b2));if(_0x20f1b2[_0xb151('0xd')]){if(_0x20f1b2[_0xb151('0xd')][_0xb151('0xe')]===0x1f4){logger[_0xb151('0xd')](_0xb151('0xf'),_0xd89657,_0x20f1b2['error'][_0xb151('0x10')]);return _0x484caf(_0x20f1b2['error'][_0xb151('0x10')]);}logger[_0xb151('0xd')](_0xb151('0xf'),_0xd89657,_0x20f1b2[_0xb151('0xd')]['message']);return _0x46fdb0(_0x20f1b2[_0xb151('0xd')][_0xb151('0x10')]);}else{logger[_0xb151('0x11')]('License,\x20%s,\x20%s',_0xd89657,'request\x20sent');_0x46fdb0(_0x20f1b2[_0xb151('0x12')]['message']);}})[_0xb151('0x13')](function(_0x4ca435){logger[_0xb151('0xd')]('License,\x20%s,\x20%s',_0xd89657,_0x4ca435);_0x484caf(_0x4ca435);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 1aa8e02..d8d29fc 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 _0x7f86=['../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','/:id/send','send','addAgents','update','removeDispositions','delete','removeAnswers','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x44f563,_0x353637){var _0x3478fd=function(_0x42144d){while(--_0x42144d){_0x44f563['push'](_0x44f563['shift']());}};_0x3478fd(++_0x353637);}(_0x7f86,0xea));var _0x67f8=function(_0x52f878,_0x3a510f){_0x52f878=_0x52f878-0x0;var _0x675257=_0x7f86[_0x52f878];return _0x675257;};'use strict';var multer=require(_0x67f8('0x0'));var util=require(_0x67f8('0x1'));var path=require(_0x67f8('0x2'));var timeout=require(_0x67f8('0x3'));var express=require(_0x67f8('0x4'));var router=express['Router']();var auth=require(_0x67f8('0x5'));var interaction=require(_0x67f8('0x6'));var config=require(_0x67f8('0x7'));var controller=require(_0x67f8('0x8'));router['get']('/',auth[_0x67f8('0x9')](),controller[_0x67f8('0xa')]);router[_0x67f8('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x67f8('0xc')]);router[_0x67f8('0xb')](_0x67f8('0xd'),auth[_0x67f8('0x9')](),controller['show']);router[_0x67f8('0xb')](_0x67f8('0xe'),auth[_0x67f8('0x9')](),controller[_0x67f8('0xf')]);router[_0x67f8('0xb')](_0x67f8('0x10'),auth['isAuthenticated'](),controller[_0x67f8('0x11')]);router['get']('/:id/in_servers',auth['isAuthenticated'](),controller[_0x67f8('0x12')]);router[_0x67f8('0xb')](_0x67f8('0x13'),auth['isAuthenticated'](),controller[_0x67f8('0x14')]);router[_0x67f8('0xb')](_0x67f8('0x15'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x16')]);router[_0x67f8('0xb')](_0x67f8('0x17'),auth['isAuthenticated'](),controller['getApplications']);router[_0x67f8('0xb')](_0x67f8('0x18'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x19')]);router['get'](_0x67f8('0x1a'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x1b')]);router[_0x67f8('0xb')](_0x67f8('0x1c'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x1d')]);router[_0x67f8('0x1e')]('/:id/dispositions',auth[_0x67f8('0x9')](),controller[_0x67f8('0x1f')]);router[_0x67f8('0x1e')](_0x67f8('0x10'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x20')]);router[_0x67f8('0x1e')]('/',auth['isAuthenticated'](),controller[_0x67f8('0x21')]);router[_0x67f8('0x1e')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x67f8('0x22')]);router[_0x67f8('0x1e')](_0x67f8('0x13'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x23')]);router['post'](_0x67f8('0x15'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x24')]);router[_0x67f8('0x1e')](_0x67f8('0x17'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x67f8('0x25'),auth['isAuthenticated'](),controller[_0x67f8('0x26')]);router[_0x67f8('0x1e')]('/:id/users',auth['isAuthenticated'](),controller[_0x67f8('0x27')]);router['put'](_0x67f8('0xd'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x28')]);router['delete'](_0x67f8('0xe'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x29')]);router[_0x67f8('0x2a')](_0x67f8('0x10'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x2b')]);router[_0x67f8('0x2a')]('/:id/in_servers',auth['isAuthenticated'](),controller['removeImap']);router['delete']('/:id/out_servers',auth[_0x67f8('0x9')](),controller[_0x67f8('0x2c')]);router[_0x67f8('0x2a')]('/:id',auth[_0x67f8('0x9')](),controller[_0x67f8('0x2d')]);router['delete'](_0x67f8('0x1c'),auth['isAuthenticated'](),controller[_0x67f8('0x2e')]);module[_0x67f8('0x2f')]=router; \ No newline at end of file +var _0x0ec6=['addAnswer','create','addImap','/:id/interactions','addInteraction','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition'];(function(_0x4e9310,_0x5296e4){var _0x346b79=function(_0x2b0d41){while(--_0x2b0d41){_0x4e9310['push'](_0x4e9310['shift']());}};_0x346b79(++_0x5296e4);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x37bdf2,_0x41bc37){_0x37bdf2=_0x37bdf2-0x0;var _0x13a974=_0x0ec6[_0x37bdf2];return _0x13a974;};'use strict';var multer=require(_0x60ec('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x60ec('0x1'));var express=require(_0x60ec('0x2'));var router=express[_0x60ec('0x3')]();var auth=require(_0x60ec('0x4'));var interaction=require(_0x60ec('0x5'));var config=require(_0x60ec('0x6'));var controller=require(_0x60ec('0x7'));router['get']('/',auth[_0x60ec('0x8')](),controller[_0x60ec('0x9')]);router[_0x60ec('0xa')](_0x60ec('0xb'),auth['isAuthenticated'](),controller[_0x60ec('0xc')]);router['get'](_0x60ec('0xd'),auth[_0x60ec('0x8')](),controller[_0x60ec('0xe')]);router[_0x60ec('0xa')](_0x60ec('0xf'),auth[_0x60ec('0x8')](),controller['getDispositions']);router['get'](_0x60ec('0x10'),auth[_0x60ec('0x8')](),controller[_0x60ec('0x11')]);router[_0x60ec('0xa')](_0x60ec('0x12'),auth['isAuthenticated'](),controller['getImap']);router[_0x60ec('0xa')](_0x60ec('0x13'),auth[_0x60ec('0x8')](),controller[_0x60ec('0x14')]);router[_0x60ec('0xa')]('/:id/interactions',auth[_0x60ec('0x8')](),controller[_0x60ec('0x15')]);router[_0x60ec('0xa')](_0x60ec('0x16'),auth[_0x60ec('0x8')](),controller[_0x60ec('0x17')]);router[_0x60ec('0xa')](_0x60ec('0x18'),auth[_0x60ec('0x8')](),controller['getMessages']);router[_0x60ec('0xa')](_0x60ec('0x19'),auth[_0x60ec('0x8')](),controller[_0x60ec('0x1a')]);router[_0x60ec('0xa')](_0x60ec('0x1b'),auth[_0x60ec('0x8')](),controller[_0x60ec('0x1c')]);router[_0x60ec('0x1d')](_0x60ec('0xf'),auth[_0x60ec('0x8')](),controller[_0x60ec('0x1e')]);router['post'](_0x60ec('0x10'),auth[_0x60ec('0x8')](),controller[_0x60ec('0x1f')]);router[_0x60ec('0x1d')]('/',auth['isAuthenticated'](),controller[_0x60ec('0x20')]);router[_0x60ec('0x1d')](_0x60ec('0x12'),auth[_0x60ec('0x8')](),controller[_0x60ec('0x21')]);router[_0x60ec('0x1d')]('/:id/out_servers',auth['isAuthenticated'](),controller['addSmtp']);router[_0x60ec('0x1d')](_0x60ec('0x22'),auth[_0x60ec('0x8')](),controller[_0x60ec('0x23')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0x60ec('0x1d')](_0x60ec('0x24'),auth[_0x60ec('0x8')](),controller[_0x60ec('0x25')]);router[_0x60ec('0x1d')](_0x60ec('0x1b'),auth[_0x60ec('0x8')](),controller[_0x60ec('0x26')]);router[_0x60ec('0x27')]('/:id',auth[_0x60ec('0x8')](),controller[_0x60ec('0x28')]);router[_0x60ec('0x29')](_0x60ec('0xf'),auth[_0x60ec('0x8')](),controller[_0x60ec('0x2a')]);router[_0x60ec('0x29')](_0x60ec('0x10'),auth[_0x60ec('0x8')](),controller[_0x60ec('0x2b')]);router['delete']('/:id/in_servers',auth[_0x60ec('0x8')](),controller[_0x60ec('0x2c')]);router['delete']('/:id/out_servers',auth[_0x60ec('0x8')](),controller['removeSmtp']);router[_0x60ec('0x29')](_0x60ec('0xd'),auth[_0x60ec('0x8')](),controller[_0x60ec('0x2d')]);router[_0x60ec('0x29')]('/:id/users',auth[_0x60ec('0x8')](),controller[_0x60ec('0x2e')]);module[_0x60ec('0x2f')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index fd3d766..f83db96 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 _0x68a6=['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','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x51d959,_0x14cdb0){var _0x27c3a0=function(_0x11fc32){while(--_0x11fc32){_0x51d959['push'](_0x51d959['shift']());}};_0x27c3a0(++_0x14cdb0);}(_0x68a6,0x13b));var _0x668a=function(_0x7bb475,_0x58e315){_0x7bb475=_0x7bb475-0x0;var _0x3dbe8c=_0x68a6[_0x7bb475];return _0x3dbe8c;};'use strict';var Sequelize=require(_0x668a('0x0'));module[_0x668a('0x1')]={'description':{'type':Sequelize[_0x668a('0x2')]},'name':{'type':Sequelize[_0x668a('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x668a('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x668a('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x668a('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x668a('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x668a('0x4')]},'markAsUnread':{'type':Sequelize[_0x668a('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x668a('0x2')],'allowNull':![],'defaultValue':_0x668a('0x5')},'fontSize':{'type':Sequelize[_0x668a('0x6')](0x2)[_0x668a('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x668a('0x4')],'defaultValue':function(){return _0x668a('0x8');}},'notificationSound':{'type':Sequelize[_0x668a('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x668a('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x668a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x668a('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x668a('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x668a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x668a('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x668a('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x668a('0x3')],'defaultValue':![],'comment':_0x668a('0xa'),'set':function(_0x1b6c8e){if(!_0x1b6c8e)this['setDataValue'](_0x668a('0xb'),null);this[_0x668a('0xc')](_0x668a('0xd'),_0x1b6c8e);}}}; \ No newline at end of file +var _0x570e=['STRING','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','BOOLEAN'];(function(_0x35983f,_0xe494ac){var _0x3eb34e=function(_0x47334d){while(--_0x47334d){_0x35983f['push'](_0x35983f['shift']());}};_0x3eb34e(++_0xe494ac);}(_0x570e,0xc3));var _0xe570=function(_0x211a02,_0x3b5362){_0x211a02=_0x211a02-0x0;var _0x13d91c=_0x570e[_0x211a02];return _0x13d91c;};'use strict';var Sequelize=require(_0xe570('0x0'));module[_0xe570('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xe570('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xe570('0x3')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xe570('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xe570('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe570('0x3')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xe570('0x4')](0x2)[_0xe570('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xe570('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe570('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe570('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe570('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe570('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe570('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xe570('0x6')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe570('0x7'),'set':function(_0x190aa4){if(!_0x190aa4)this[_0xe570('0x8')](_0xe570('0x9'),null);this['setDataValue'](_0xe570('0xa'),_0x190aa4);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 63fb1e7..92b8fbe 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 _0xad9b=['filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','MailAccount','includeAll','include','rows','show','params','find','body','MailServerOut','describe','Disposition','create','findOne','MailAccountId','map','findAll','removeDispositions','ids','addAnswer','CannedAnswer','nolimit','removeAnswers','email','ListId','isNil','active','description','cservice','user','cuser','password','cpassword','authentication','host','port','service','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','Tag','Tags','tag','addApplications','sequelize','transaction','MailApplication','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','updatedAt','DESC','from','format','attachments','join','server/files/attachments','basename','secure','auth','SendMail','sendMail','Contacts','List\x20not\x20found','subject','attach','messageId','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../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','register','client','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','json','count','set','Content-Range','apply','reject','update','destroy','get','MailAccounts','UserProfileResource','stack','name','status','send','index','MailServerIn','Imap','Smtp','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','query','keys'];(function(_0x1a73f7,_0x274c12){var _0x3570fa=function(_0xdb9fc0){while(--_0xdb9fc0){_0x1a73f7['push'](_0x1a73f7['shift']());}};_0x3570fa(++_0x274c12);}(_0xad9b,0x1ea));var _0xbad9=function(_0x2d8520,_0x2d155b){_0x2d8520=_0x2d8520-0x0;var _0x5734e4=_0xad9b[_0x2d8520];return _0x5734e4;};'use strict';var pdf=require(_0xbad9('0x0'));var emlformat=require(_0xbad9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbad9('0x2'));var jsonpatch=require(_0xbad9('0x3'));var rp=require(_0xbad9('0x4'));var moment=require(_0xbad9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbad9('0x6'));var util=require(_0xbad9('0x7'));var path=require(_0xbad9('0x8'));var sox=require(_0xbad9('0x9'));var csv=require(_0xbad9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbad9('0xb'));var squel=require(_0xbad9('0xc'));var crypto=require('crypto');var jsforce=require(_0xbad9('0xd'));var deskjs=require(_0xbad9('0xe'));var toCsv=require(_0xbad9('0xa'));var querystring=require('querystring');var Papa=require(_0xbad9('0xf'));var Redis=require('ioredis');var authService=require(_0xbad9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbad9('0x11'));var hardwareService=require(_0xbad9('0x12'));var logger=require(_0xbad9('0x13'))(_0xbad9('0x14'));var utils=require(_0xbad9('0x15'));var config=require(_0xbad9('0x16'));var licenseUtil=require(_0xbad9('0x17'));var db=require(_0xbad9('0x18'))['db'];config[_0xbad9('0x19')]=_['defaults'](config['redis'],{'host':_0xbad9('0x1a'),'port':0x18eb});var socket=require(_0xbad9('0x1b'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xbad9('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbad9('0x1d')]['http']({'port':0x232b});function respondWithRpcPromise(_0x2e2bd7,_0x11f10d,_0x13d6e6,_0x17e908){return new BPromise(function(_0x228bb8,_0x5d0c29){var _0x2f54f0=_0x17e908||client;return _0x2f54f0[_0xbad9('0x1e')](_0x2e2bd7,_0x13d6e6)[_0xbad9('0x1f')](function(_0x3b1a32){logger['info'](_0xbad9('0x20'),_0x11f10d,_0xbad9('0x21'));logger['debug'](_0xbad9('0x22'),_0x11f10d,'request\x20sent',JSON[_0xbad9('0x23')](_0x3b1a32));if(_0x3b1a32[_0xbad9('0x24')]){if(_0x3b1a32[_0xbad9('0x24')][_0xbad9('0x25')]===0x1f4){logger[_0xbad9('0x24')](_0xbad9('0x20'),_0x11f10d,_0x3b1a32[_0xbad9('0x24')]['message']);return _0x5d0c29(_0x3b1a32[_0xbad9('0x24')][_0xbad9('0x26')]);}logger[_0xbad9('0x24')]('MailAccount,\x20%s,\x20%s',_0x11f10d,_0x3b1a32[_0xbad9('0x24')][_0xbad9('0x26')]);return _0x228bb8(_0x3b1a32[_0xbad9('0x24')]['message']);}else{logger[_0xbad9('0x27')](_0xbad9('0x20'),_0x11f10d,'request\x20sent');_0x228bb8(_0x3b1a32[_0xbad9('0x28')][_0xbad9('0x26')]);}})[_0xbad9('0x29')](function(_0x15c5b0){logger[_0xbad9('0x24')](_0xbad9('0x20'),_0x11f10d,_0x15c5b0);_0x5d0c29(_0x15c5b0);});});}function respondWithStatusCode(_0x388e4a,_0x22caa7){_0x22caa7=_0x22caa7||0xcc;return function(_0x3d3594){if(_0x3d3594){return _0x388e4a[_0xbad9('0x2a')](_0x22caa7);}return _0x388e4a['status'](_0x22caa7)[_0xbad9('0x2b')]();};}function respondWithResult(_0xca7f15,_0xd9687){_0xd9687=_0xd9687||0xc8;return function(_0x162d20){if(_0x162d20){return _0xca7f15['status'](_0xd9687)[_0xbad9('0x2c')](_0x162d20);}};}function respondWithFilteredResult(_0x5c0dee,_0x52187a){return function(_0x75d59){if(_0x75d59){var _0x34b51a=_0x75d59[_0xbad9('0x2d')],_0x128a45=_0x52187a['offset'],_0x2be588=_0x52187a['offset']+_0x52187a['limit'],_0x3b3ac9;if(_0x2be588>=_0x34b51a){_0x2be588=_0x34b51a;_0x3b3ac9=0xc8;}else{_0x3b3ac9=0xce;}_0x5c0dee['status'](_0x3b3ac9);return _0x5c0dee[_0xbad9('0x2e')](_0xbad9('0x2f'),_0x128a45+'-'+_0x2be588+'/'+_0x34b51a)[_0xbad9('0x2c')](_0x75d59);}return null;};}function patchUpdates(_0x23a65f){return function(_0x590325){try{jsonpatch[_0xbad9('0x30')](_0x590325,_0x23a65f,!![]);}catch(_0x200431){return BPromise[_0xbad9('0x31')](_0x200431);}return _0x590325['save']();};}function saveUpdates(_0x5c9b60,_0x1e1059){return function(_0x2c84d7){if(_0x2c84d7){return _0x2c84d7[_0xbad9('0x32')](_0x5c9b60)['then'](function(_0x5e471f){return _0x5e471f;});}return null;};}function removeEntity(_0x1e6807,_0x2f2e4a){return function(_0x5f3b53){if(_0x5f3b53){return _0x5f3b53[_0xbad9('0x33')]()['then'](function(){var _0x13aa52=_0x5f3b53[_0xbad9('0x34')]({'plain':!![]});var _0x48d33d=_0xbad9('0x35');return db[_0xbad9('0x36')][_0xbad9('0x33')]({'where':{'type':_0x48d33d,'resourceId':_0x13aa52['id']}})[_0xbad9('0x1f')](function(){return _0x5f3b53;});})[_0xbad9('0x1f')](function(){_0x1e6807['status'](0xcc)[_0xbad9('0x2b')]();});}};}function handleEntityNotFound(_0x10d200,_0x5252e9){return function(_0xa2450){if(!_0xa2450){_0x10d200['sendStatus'](0x194);}return _0xa2450;};}function handleError(_0x287cab,_0x3c29c8){_0x3c29c8=_0x3c29c8||0x1f4;return function(_0x2b3b58){logger['error'](_0x2b3b58[_0xbad9('0x37')]);if(_0x2b3b58[_0xbad9('0x38')]){delete _0x2b3b58[_0xbad9('0x38')];}_0x287cab[_0xbad9('0x39')](_0x3c29c8)[_0xbad9('0x3a')](_0x2b3b58);};}exports[_0xbad9('0x3b')]=function(_0xabc793,_0x1c27ac){var _0x264f72={'include':[{'model':db[_0xbad9('0x3c')],'as':_0xbad9('0x3d')},{'model':db['MailServerOut'],'as':_0xbad9('0x3e')},{'model':db[_0xbad9('0x3f')],'as':_0xbad9('0x40')}]},_0x106620={},_0x3f60cd={'count':0x0,'rows':[]};var _0x40c1c8=_['map'](db['MailAccount'][_0xbad9('0x41')],function(_0x340956){return{'name':_0x340956[_0xbad9('0x42')],'type':_0x340956[_0xbad9('0x43')][_0xbad9('0x44')]};});_0x106620['model']=_['map'](_0x40c1c8,_0xbad9('0x38'));_0x106620[_0xbad9('0x45')]=_[_0xbad9('0x46')](_0xabc793[_0xbad9('0x45')]);_0x106620[_0xbad9('0x47')]=_[_0xbad9('0x48')](_0x106620['model'],_0x106620[_0xbad9('0x45')]);_0x264f72['attributes']=_['intersection'](_0x106620[_0xbad9('0x49')],qs[_0xbad9('0x4a')](_0xabc793[_0xbad9('0x45')][_0xbad9('0x4a')]));_0x264f72[_0xbad9('0x4b')]=_0x264f72[_0xbad9('0x4b')][_0xbad9('0x4c')]?_0x264f72[_0xbad9('0x4b')]:_0x106620['model'];if(!_0xabc793[_0xbad9('0x45')][_0xbad9('0x4d')]('nolimit')){_0x264f72[_0xbad9('0x4e')]=qs[_0xbad9('0x4e')](_0xabc793[_0xbad9('0x45')][_0xbad9('0x4e')]);_0x264f72[_0xbad9('0x4f')]=qs[_0xbad9('0x4f')](_0xabc793[_0xbad9('0x45')][_0xbad9('0x4f')]);}_0x264f72[_0xbad9('0x50')]=qs[_0xbad9('0x51')](_0xabc793[_0xbad9('0x45')][_0xbad9('0x51')]);_0x264f72[_0xbad9('0x52')]=qs[_0xbad9('0x47')](_[_0xbad9('0x53')](_0xabc793[_0xbad9('0x45')],_0x106620[_0xbad9('0x47')]),_0x40c1c8);if(_0xabc793['query'][_0xbad9('0x54')]){_0x264f72[_0xbad9('0x52')]=_[_0xbad9('0x55')](_0x264f72['where'],{'$or':_['map'](_0x40c1c8,function(_0x294e4c){if(_0x294e4c['type']!==_0xbad9('0x56')){var _0x407a9d={};_0x407a9d[_0x294e4c['name']]={'$like':'%'+_0xabc793['query'][_0xbad9('0x54')]+'%'};return _0x407a9d;}})});}_0x264f72=_[_0xbad9('0x55')]({},_0x264f72,_0xabc793[_0xbad9('0x57')]);var _0x1c680e={'where':_0x264f72['where']};return db[_0xbad9('0x58')]['count'](_0x1c680e)['then'](function(_0x3adff9){_0x3f60cd[_0xbad9('0x2d')]=_0x3adff9;if(_0xabc793['query'][_0xbad9('0x59')]){_0x264f72[_0xbad9('0x5a')]=[{'all':!![]}];}return db[_0xbad9('0x58')]['findAll'](_0x264f72);})[_0xbad9('0x1f')](function(_0x17b0a6){_0x3f60cd[_0xbad9('0x5b')]=_0x17b0a6;return _0x3f60cd;})[_0xbad9('0x1f')](respondWithFilteredResult(_0x1c27ac,_0x264f72))[_0xbad9('0x29')](handleError(_0x1c27ac,null));};exports[_0xbad9('0x5c')]=function(_0xdb504,_0x32d0d1){var _0x3dee91={'raw':![],'where':{'id':_0xdb504[_0xbad9('0x5d')]['id']},'include':[{'model':db[_0xbad9('0x3c')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xbad9('0x3e')},{'model':db[_0xbad9('0x3f')],'as':_0xbad9('0x40')}]},_0x3baaf7={};_0x3baaf7[_0xbad9('0x49')]=_[_0xbad9('0x46')](db[_0xbad9('0x58')]['rawAttributes']);_0x3baaf7[_0xbad9('0x45')]=_[_0xbad9('0x46')](_0xdb504[_0xbad9('0x45')]);_0x3baaf7['filters']=_[_0xbad9('0x48')](_0x3baaf7[_0xbad9('0x49')],_0x3baaf7[_0xbad9('0x45')]);_0x3dee91[_0xbad9('0x4b')]=_[_0xbad9('0x48')](_0x3baaf7[_0xbad9('0x49')],qs[_0xbad9('0x4a')](_0xdb504[_0xbad9('0x45')][_0xbad9('0x4a')]));_0x3dee91['attributes']=_0x3dee91[_0xbad9('0x4b')][_0xbad9('0x4c')]?_0x3dee91[_0xbad9('0x4b')]:_0x3baaf7[_0xbad9('0x49')];if(_0xdb504[_0xbad9('0x45')][_0xbad9('0x59')]){_0x3dee91[_0xbad9('0x5a')]=[{'all':!![]}];}_0x3dee91=_[_0xbad9('0x55')]({},_0x3dee91,_0xdb504[_0xbad9('0x57')]);return db[_0xbad9('0x58')][_0xbad9('0x5e')](_0x3dee91)[_0xbad9('0x1f')](handleEntityNotFound(_0x32d0d1,null))[_0xbad9('0x1f')](respondWithResult(_0x32d0d1,null))[_0xbad9('0x29')](handleError(_0x32d0d1,null));};exports[_0xbad9('0x32')]=function(_0xfd27af,_0x48dc06){if(_0xfd27af[_0xbad9('0x5f')]['id']){delete _0xfd27af[_0xbad9('0x5f')]['id'];}return db[_0xbad9('0x58')]['find']({'where':{'id':_0xfd27af[_0xbad9('0x5d')]['id']},'include':[{'model':db[_0xbad9('0x3c')],'as':_0xbad9('0x3d')},{'model':db[_0xbad9('0x60')],'as':'Smtp'},{'model':db['Pause'],'as':_0xbad9('0x40')}]})['then'](handleEntityNotFound(_0x48dc06,null))['then'](saveUpdates(_0xfd27af[_0xbad9('0x5f')],null))[_0xbad9('0x1f')](function(_0x4bf9ec){if(_0x4bf9ec&&_0xfd27af[_0xbad9('0x5f')][_0xbad9('0x3d')]){return db[_0xbad9('0x3c')][_0xbad9('0x32')](_0xfd27af[_0xbad9('0x5f')]['Imap'],{'where':{'MailAccountId':_0x4bf9ec['id']}})[_0xbad9('0x1f')](function(){return _0x4bf9ec;});}return _0x4bf9ec;})[_0xbad9('0x1f')](function(_0x6176c0){if(_0x6176c0&&_0xfd27af[_0xbad9('0x5f')]['Smtp']){return db[_0xbad9('0x60')]['update'](_0xfd27af[_0xbad9('0x5f')]['Smtp'],{'where':{'MailAccountId':_0x6176c0['id']}})[_0xbad9('0x1f')](function(){return _0x6176c0;});}return _0x6176c0;})[_0xbad9('0x1f')](respondWithResult(_0x48dc06,null))[_0xbad9('0x29')](handleError(_0x48dc06,null));};exports['describe']=function(_0x446173,_0x36d0f3){return db['MailAccount'][_0xbad9('0x61')]()['then'](respondWithResult(_0x36d0f3,null))[_0xbad9('0x29')](handleError(_0x36d0f3,null));};exports['addDisposition']=function(_0x106270,_0x2464fc,_0x28054b){if(_0x106270[_0xbad9('0x5f')]['id']){delete _0x106270[_0xbad9('0x5f')]['id'];}return db[_0xbad9('0x58')]['find']({'where':{'id':_0x106270[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x2464fc,null))[_0xbad9('0x1f')](function(_0x33b665){if(_0x33b665){_0x106270['body']['MailAccountId']=_0x33b665['id'];return db[_0xbad9('0x62')][_0xbad9('0x63')](_0x106270[_0xbad9('0x5f')]);}})[_0xbad9('0x1f')](respondWithResult(_0x2464fc,null))[_0xbad9('0x29')](handleError(_0x2464fc,null));};exports['getDispositions']=function(_0x13a1c4,_0x17b434,_0x4dbe2a){var _0x560573={'raw':![],'where':{}};var _0x2a3efe={};var _0xe543bc={'count':0x0,'rows':[]};return db[_0xbad9('0x58')][_0xbad9('0x64')]({'where':{'id':_0x13a1c4[_0xbad9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x17b434,null))[_0xbad9('0x1f')](function(_0x3fa475){if(_0x3fa475){_0x2a3efe[_0xbad9('0x49')]=_[_0xbad9('0x46')](db['Disposition'][_0xbad9('0x41')]);_0x2a3efe[_0xbad9('0x45')]=_[_0xbad9('0x46')](_0x13a1c4['query']);_0x2a3efe[_0xbad9('0x47')]=_[_0xbad9('0x48')](_0x2a3efe['model'],_0x2a3efe[_0xbad9('0x45')]);_0x560573[_0xbad9('0x4b')]=_[_0xbad9('0x48')](_0x2a3efe[_0xbad9('0x49')],qs[_0xbad9('0x4a')](_0x13a1c4[_0xbad9('0x45')]['fields']));_0x560573[_0xbad9('0x4b')]=_0x560573[_0xbad9('0x4b')][_0xbad9('0x4c')]?_0x560573['attributes']:_0x2a3efe[_0xbad9('0x49')];if(!_0x13a1c4[_0xbad9('0x45')][_0xbad9('0x4d')]('nolimit')){_0x560573[_0xbad9('0x4e')]=qs[_0xbad9('0x4e')](_0x13a1c4[_0xbad9('0x45')]['limit']);_0x560573[_0xbad9('0x4f')]=qs['offset'](_0x13a1c4[_0xbad9('0x45')][_0xbad9('0x4f')]);}_0x560573['order']=qs[_0xbad9('0x51')](_0x13a1c4[_0xbad9('0x45')][_0xbad9('0x51')]);_0x560573[_0xbad9('0x52')]=qs['filters'](_[_0xbad9('0x53')](_0x13a1c4['query'],_0x2a3efe[_0xbad9('0x47')]));_0x560573[_0xbad9('0x52')][_0xbad9('0x65')]=_0x3fa475['id'];if(_0x13a1c4[_0xbad9('0x45')][_0xbad9('0x54')]){_0x560573[_0xbad9('0x52')]=_[_0xbad9('0x55')](_0x560573[_0xbad9('0x52')],{'$or':_[_0xbad9('0x66')](_0x560573[_0xbad9('0x4b')],function(_0x11f72b){var _0x940a0e={};_0x940a0e[_0x11f72b]={'$like':'%'+_0x13a1c4[_0xbad9('0x45')]['filter']+'%'};return _0x940a0e;})});}_0x560573=_[_0xbad9('0x55')]({},_0x560573,_0x13a1c4['options']);return db[_0xbad9('0x62')]['count']({'where':_0x560573['where']})[_0xbad9('0x1f')](function(_0x2149db){_0xe543bc['count']=_0x2149db;if(_0x13a1c4[_0xbad9('0x45')][_0xbad9('0x59')]){_0x560573['include']=[{'all':!![]}];}return db[_0xbad9('0x62')][_0xbad9('0x67')](_0x560573);})['then'](function(_0x1abf92){_0xe543bc[_0xbad9('0x5b')]=_0x1abf92;return _0xe543bc;});}})[_0xbad9('0x1f')](respondWithFilteredResult(_0x17b434,_0x560573))['catch'](handleError(_0x17b434,null));};exports[_0xbad9('0x68')]=function(_0xa5e079,_0x55c395,_0x5f3878){return db['MailAccount'][_0xbad9('0x5e')]({'where':{'id':_0xa5e079['params']['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x55c395,null))['then'](function(_0x54ff0e){if(_0x54ff0e){return _0x54ff0e[_0xbad9('0x68')](_0xa5e079[_0xbad9('0x45')][_0xbad9('0x69')]);}})[_0xbad9('0x1f')](respondWithStatusCode(_0x55c395,null))[_0xbad9('0x29')](handleError(_0x55c395,null));};exports[_0xbad9('0x6a')]=function(_0x33e0ee,_0x985e9,_0x25da05){if(_0x33e0ee[_0xbad9('0x5f')]['id']){delete _0x33e0ee['body']['id'];}return db[_0xbad9('0x58')][_0xbad9('0x5e')]({'where':{'id':_0x33e0ee[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x985e9,null))[_0xbad9('0x1f')](function(_0x105771){if(_0x105771){_0x33e0ee[_0xbad9('0x5f')][_0xbad9('0x65')]=_0x105771['id'];return db[_0xbad9('0x6b')]['create'](_0x33e0ee[_0xbad9('0x5f')]);}})[_0xbad9('0x1f')](respondWithResult(_0x985e9,null))[_0xbad9('0x29')](handleError(_0x985e9,null));};exports['getAnswers']=function(_0x5ee90d,_0x497e39,_0x4d0688){var _0x4f0138={'raw':![],'where':{}};var _0x9a5318={};var _0x5345f1={'count':0x0,'rows':[]};return db[_0xbad9('0x58')][_0xbad9('0x64')]({'where':{'id':_0x5ee90d[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x497e39,null))[_0xbad9('0x1f')](function(_0xfa23ff){if(_0xfa23ff){_0x9a5318['model']=_['keys'](db[_0xbad9('0x6b')][_0xbad9('0x41')]);_0x9a5318[_0xbad9('0x45')]=_[_0xbad9('0x46')](_0x5ee90d[_0xbad9('0x45')]);_0x9a5318[_0xbad9('0x47')]=_[_0xbad9('0x48')](_0x9a5318['model'],_0x9a5318[_0xbad9('0x45')]);_0x4f0138['attributes']=_[_0xbad9('0x48')](_0x9a5318[_0xbad9('0x49')],qs['fields'](_0x5ee90d[_0xbad9('0x45')][_0xbad9('0x4a')]));_0x4f0138[_0xbad9('0x4b')]=_0x4f0138[_0xbad9('0x4b')][_0xbad9('0x4c')]?_0x4f0138[_0xbad9('0x4b')]:_0x9a5318['model'];if(!_0x5ee90d[_0xbad9('0x45')]['hasOwnProperty'](_0xbad9('0x6c'))){_0x4f0138[_0xbad9('0x4e')]=qs[_0xbad9('0x4e')](_0x5ee90d[_0xbad9('0x45')][_0xbad9('0x4e')]);_0x4f0138[_0xbad9('0x4f')]=qs['offset'](_0x5ee90d[_0xbad9('0x45')]['offset']);}_0x4f0138[_0xbad9('0x50')]=qs[_0xbad9('0x51')](_0x5ee90d[_0xbad9('0x45')][_0xbad9('0x51')]);_0x4f0138[_0xbad9('0x52')]=qs[_0xbad9('0x47')](_['pick'](_0x5ee90d[_0xbad9('0x45')],_0x9a5318[_0xbad9('0x47')]));_0x4f0138['where'][_0xbad9('0x65')]=_0xfa23ff['id'];if(_0x5ee90d['query']['filter']){_0x4f0138[_0xbad9('0x52')]=_[_0xbad9('0x55')](_0x4f0138[_0xbad9('0x52')],{'$or':_['map'](_0x4f0138[_0xbad9('0x4b')],function(_0x23cbf1){var _0x4b3ae3={};_0x4b3ae3[_0x23cbf1]={'$like':'%'+_0x5ee90d[_0xbad9('0x45')][_0xbad9('0x54')]+'%'};return _0x4b3ae3;})});}_0x4f0138=_[_0xbad9('0x55')]({},_0x4f0138,_0x5ee90d['options']);return db['CannedAnswer'][_0xbad9('0x2d')]({'where':_0x4f0138[_0xbad9('0x52')]})[_0xbad9('0x1f')](function(_0x4972cb){_0x5345f1['count']=_0x4972cb;if(_0x5ee90d[_0xbad9('0x45')][_0xbad9('0x59')]){_0x4f0138[_0xbad9('0x5a')]=[{'all':!![]}];}return db[_0xbad9('0x6b')][_0xbad9('0x67')](_0x4f0138);})[_0xbad9('0x1f')](function(_0x33e799){_0x5345f1[_0xbad9('0x5b')]=_0x33e799;return _0x5345f1;});}})['then'](respondWithFilteredResult(_0x497e39,_0x4f0138))['catch'](handleError(_0x497e39,null));};exports['removeAnswers']=function(_0x40275f,_0x4c727f,_0x17faaf){return db[_0xbad9('0x58')][_0xbad9('0x5e')]({'where':{'id':_0x40275f[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x4c727f,null))['then'](function(_0x357957){if(_0x357957){return _0x357957[_0xbad9('0x6d')](_0x40275f[_0xbad9('0x45')]['ids']);}})[_0xbad9('0x1f')](respondWithStatusCode(_0x4c727f,null))[_0xbad9('0x29')](handleError(_0x4c727f,null));};exports['create']=function(_0x4acaf4,_0x1a6470){var _0x2b4298={'name':_0x4acaf4[_0xbad9('0x5f')]['name'],'key':_0x4acaf4['body'][_0xbad9('0x44')],'email':_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x6e')],'ListId':_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x6f')],'active':!_[_0xbad9('0x70')](_0x4acaf4['body'][_0xbad9('0x71')])?_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x71')]:!![],'description':_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x72')]||null,'Imap':{},'Smtp':{}};if(_[_0xbad9('0x70')](_0x4acaf4['body'][_0xbad9('0x73')])){if(_0x4acaf4[_0xbad9('0x5f')]['cauthentication']){_0x2b4298[_0xbad9('0x3d')][_0xbad9('0x74')]=_0x2b4298[_0xbad9('0x3e')][_0xbad9('0x74')]=_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x75')];_0x2b4298[_0xbad9('0x3d')][_0xbad9('0x76')]=_0x2b4298['Smtp']['pass']=_0x4acaf4['body'][_0xbad9('0x77')];}else{_0x2b4298[_0xbad9('0x3d')][_0xbad9('0x78')]=_0x2b4298[_0xbad9('0x3e')]['authentication']=![];}_0x2b4298[_0xbad9('0x3d')][_0xbad9('0x79')]=_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x3d')][_0xbad9('0x79')];_0x2b4298[_0xbad9('0x3d')][_0xbad9('0x7a')]=_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x3d')][_0xbad9('0x7a')];_0x2b4298['Smtp'][_0xbad9('0x79')]=_0x4acaf4['body'][_0xbad9('0x3e')][_0xbad9('0x79')];_0x2b4298[_0xbad9('0x3e')][_0xbad9('0x7a')]=_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x3e')]['port'];}else{_0x2b4298[_0xbad9('0x3d')]['service']=_0x2b4298[_0xbad9('0x3e')][_0xbad9('0x7b')]=_0x4acaf4[_0xbad9('0x5f')]['cservice'];_0x2b4298['Imap']['user']=_0x2b4298[_0xbad9('0x3e')][_0xbad9('0x74')]=_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x75')];_0x2b4298['Imap'][_0xbad9('0x76')]=_0x2b4298['Smtp'][_0xbad9('0x7c')]=_0x4acaf4['body'][_0xbad9('0x77')];}return db[_0xbad9('0x58')]['create'](_0x2b4298,{'include':[{'model':db[_0xbad9('0x60')],'as':_0xbad9('0x3e')},{'model':db[_0xbad9('0x3c')],'as':_0xbad9('0x3d')}]})['then'](function(_0x191439){var _0x2bf8f8=_0x4acaf4['user']['get']({'plain':!![]});if(!_0x2bf8f8)throw new Error(_0xbad9('0x7d'));if(_0x2bf8f8['role']===_0xbad9('0x74')){var _0x12655a=_0x191439[_0xbad9('0x34')]({'plain':!![]});return db[_0xbad9('0x7e')]['find']({'where':{'name':_0xbad9('0x35'),'userProfileId':_0x2bf8f8[_0xbad9('0x7f')]},'raw':!![]})[_0xbad9('0x1f')](function(_0xa3e084){if(_0xa3e084&&_0xa3e084['autoAssociation']===0x0){return db[_0xbad9('0x36')]['create']({'name':_0x12655a[_0xbad9('0x38')],'resourceId':_0x12655a['id'],'type':_0xa3e084[_0xbad9('0x38')],'sectionId':_0xa3e084['id']},{})[_0xbad9('0x1f')](function(){return _0x191439;});}else{return _0x191439;}})['catch'](function(_0x26d6bf){logger['error'](_0xbad9('0x80'),_0x26d6bf);throw _0x26d6bf;});}return _0x191439;})[_0xbad9('0x1f')](respondWithResult(_0x1a6470,0xc9))[_0xbad9('0x29')](handleError(_0x1a6470,null));};exports[_0xbad9('0x81')]=function(_0x467d10,_0x157679,_0x16ffce){return db['MailAccount']['findOne']({'where':{'id':_0x467d10['params']['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x157679,null))[_0xbad9('0x1f')](function(_0xc7ded){if(_0xc7ded){return _0xc7ded[_0xbad9('0x81')]();}return null;})['then'](respondWithResult(_0x157679,null))[_0xbad9('0x29')](handleError(_0x157679,null));};exports[_0xbad9('0x82')]=function(_0x383a76,_0x24ed48,_0x3c52ed){if(_0x383a76[_0xbad9('0x5f')]['id']){delete _0x383a76[_0xbad9('0x5f')]['id'];}return db[_0xbad9('0x58')][_0xbad9('0x5e')]({'where':{'id':_0x383a76[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x24ed48,null))[_0xbad9('0x1f')](function(_0xc978cf){if(_0xc978cf){_0x383a76['body'][_0xbad9('0x65')]=_0xc978cf['id'];return db[_0xbad9('0x3c')][_0xbad9('0x63')](_0x383a76['body']);}})[_0xbad9('0x1f')](respondWithResult(_0x24ed48,null))[_0xbad9('0x29')](handleError(_0x24ed48,null));};exports['removeImap']=function(_0xa0a47a,_0xeb92fa,_0x2736b4){return db[_0xbad9('0x58')][_0xbad9('0x64')]({'where':{'id':_0xa0a47a[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0xeb92fa,null))[_0xbad9('0x1f')](function(_0x4b3d9c){if(_0x4b3d9c){return _0x4b3d9c[_0xbad9('0x83')](null);}return null;})[_0xbad9('0x1f')](respondWithStatusCode(_0xeb92fa,null))[_0xbad9('0x29')](handleError(_0xeb92fa,null));};exports['getSmtp']=function(_0x5efbbf,_0x17336e,_0x2ae887){return db[_0xbad9('0x58')][_0xbad9('0x64')]({'where':{'id':_0x5efbbf['params']['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x17336e,null))['then'](function(_0x2d6204){if(_0x2d6204){return _0x2d6204[_0xbad9('0x84')]();}return null;})['then'](respondWithResult(_0x17336e,null))['catch'](handleError(_0x17336e,null));};exports['addSmtp']=function(_0xff089,_0x25dc3e,_0x205af2){if(_0xff089['body']['id']){delete _0xff089['body']['id'];}return db[_0xbad9('0x58')][_0xbad9('0x5e')]({'where':{'id':_0xff089[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x25dc3e,null))['then'](function(_0x1b521f){if(_0x1b521f){_0xff089['body']['MailAccountId']=_0x1b521f['id'];return db[_0xbad9('0x60')][_0xbad9('0x63')](_0xff089[_0xbad9('0x5f')]);}})['then'](respondWithResult(_0x25dc3e,null))[_0xbad9('0x29')](handleError(_0x25dc3e,null));};exports['removeSmtp']=function(_0x3a351d,_0x180131,_0x186652){return db['MailAccount'][_0xbad9('0x64')]({'where':{'id':_0x3a351d[_0xbad9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x180131,null))['then'](function(_0x1b66e6){if(_0x1b66e6){return _0x1b66e6[_0xbad9('0x85')](null);}return null;})[_0xbad9('0x1f')](respondWithStatusCode(_0x180131,null))['catch'](handleError(_0x180131,null));};exports[_0xbad9('0x86')]=function(_0x1719ad,_0x1f1cf2,_0x2d5349){return db[_0xbad9('0x87')][_0xbad9('0x5e')]({'where':{'id':_0x1719ad[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x1f1cf2,null))[_0xbad9('0x1f')](function(_0x2c8ec9){if(_0x2c8ec9){return _0x2c8ec9[_0xbad9('0x86')](_0x1719ad[_0xbad9('0x5f')][_0xbad9('0x69')],_[_0xbad9('0x88')](_0x1719ad[_0xbad9('0x5f')],[_0xbad9('0x69'),'id'])||{});}})[_0xbad9('0x1f')](respondWithResult(_0x1f1cf2,null))[_0xbad9('0x29')](handleError(_0x1f1cf2,null));};exports[_0xbad9('0x89')]=function(_0x488c3a,_0x489fbc,_0x235d27){var _0x38e901={'raw':![],'where':{}};var _0x49d95d={};var _0x1f276a={'count':0x0,'rows':[]};return db[_0xbad9('0x58')]['findOne']({'where':{'id':_0x488c3a[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x489fbc,null))[_0xbad9('0x1f')](function(_0x299913){if(_0x299913){_0x49d95d[_0xbad9('0x49')]=_['keys'](db[_0xbad9('0x87')][_0xbad9('0x41')]);_0x49d95d['query']=_[_0xbad9('0x46')](_0x488c3a[_0xbad9('0x45')]);_0x49d95d[_0xbad9('0x47')]=_[_0xbad9('0x48')](_0x49d95d[_0xbad9('0x49')],_0x49d95d['query']);_0x38e901[_0xbad9('0x4b')]=_[_0xbad9('0x48')](_0x49d95d['model'],qs[_0xbad9('0x4a')](_0x488c3a[_0xbad9('0x45')][_0xbad9('0x4a')]));_0x38e901[_0xbad9('0x4b')]=_0x38e901[_0xbad9('0x4b')][_0xbad9('0x4c')]?_0x38e901[_0xbad9('0x4b')]:_0x49d95d['model'];if(!_0x488c3a[_0xbad9('0x45')]['hasOwnProperty'](_0xbad9('0x6c'))){_0x38e901['limit']=qs[_0xbad9('0x4e')](_0x488c3a[_0xbad9('0x45')][_0xbad9('0x4e')]);_0x38e901[_0xbad9('0x4f')]=qs[_0xbad9('0x4f')](_0x488c3a[_0xbad9('0x45')][_0xbad9('0x4f')]);}_0x38e901[_0xbad9('0x50')]=qs[_0xbad9('0x51')](_0x488c3a[_0xbad9('0x45')][_0xbad9('0x51')]);_0x38e901[_0xbad9('0x52')]=qs['filters'](_[_0xbad9('0x53')](_0x488c3a[_0xbad9('0x45')],_0x49d95d[_0xbad9('0x47')]));_0x38e901[_0xbad9('0x52')][_0xbad9('0x65')]=_0x299913['id'];if(_0x488c3a[_0xbad9('0x45')][_0xbad9('0x54')]){_0x38e901[_0xbad9('0x52')]=_[_0xbad9('0x55')](_0x38e901[_0xbad9('0x52')],{'$or':_[_0xbad9('0x66')](_0x38e901[_0xbad9('0x4b')],function(_0x442498){var _0xacbad3={};_0xacbad3[_0x442498]={'$like':'%'+_0x488c3a[_0xbad9('0x45')][_0xbad9('0x54')]+'%'};return _0xacbad3;})});}_0x38e901=_[_0xbad9('0x55')]({},_0x38e901,_0x488c3a[_0xbad9('0x57')]);return db[_0xbad9('0x87')][_0xbad9('0x2d')]({'where':_0x38e901[_0xbad9('0x52')]})[_0xbad9('0x1f')](function(_0x55194c){_0x1f276a['count']=_0x55194c;if(_0x488c3a[_0xbad9('0x45')]['includeAll']){_0x38e901[_0xbad9('0x5a')]=[{'model':db[_0xbad9('0x8a')],'as':_0xbad9('0x8b'),'required':![]},{'model':db[_0xbad9('0x8c')],'as':_0xbad9('0x8d'),'attributes':[_0xbad9('0x38'),'fullname','internal'],'required':![]},{'model':db[_0xbad9('0x8e')],'as':_0xbad9('0x8f'),'attributes':['id',_0xbad9('0x38'),'color'],'where':_0x488c3a[_0xbad9('0x45')][_0xbad9('0x90')]?{'id':_0x488c3a[_0xbad9('0x45')][_0xbad9('0x90')]}:undefined,'required':_0x488c3a[_0xbad9('0x45')][_0xbad9('0x90')]?!![]:![]}];}return db[_0xbad9('0x87')]['findAll'](_0x38e901);})['then'](function(_0x4ec919){_0x1f276a[_0xbad9('0x5b')]=_0x4ec919;return _0x1f276a;});}})[_0xbad9('0x1f')](respondWithFilteredResult(_0x489fbc,_0x38e901))['catch'](handleError(_0x489fbc,null));};exports[_0xbad9('0x91')]=function(_0x241f66,_0x4cc6ee,_0x421c1){return db[_0xbad9('0x58')][_0xbad9('0x64')]({'where':{'id':_0x241f66['params']['id']}})['then'](handleEntityNotFound(_0x4cc6ee,null))[_0xbad9('0x1f')](function(_0x439c74){if(_0x439c74){return db[_0xbad9('0x92')][_0xbad9('0x93')](function(_0x39f4d5){return db[_0xbad9('0x94')][_0xbad9('0x33')]({'where':{'MailAccountId':_0x241f66[_0xbad9('0x5d')]['id']},'transaction':_0x39f4d5})[_0xbad9('0x1f')](function(_0x53e5f2){var _0x26c02b=_['map'](_0x241f66[_0xbad9('0x5f')],function(_0x153423){_0x153423[_0xbad9('0x65')]=_0x241f66[_0xbad9('0x5d')]['id'];return _0x153423;});return db[_0xbad9('0x94')]['bulkCreate'](_0x26c02b,{'transaction':_0x39f4d5});});})['then'](function(){return db[_0xbad9('0x94')][_0xbad9('0x95')]({'where':{'MailAccountId':_0x241f66[_0xbad9('0x5d')]['id']},'order':'priority'});});}})[_0xbad9('0x1f')](respondWithResult(_0x4cc6ee,null))[_0xbad9('0x29')](handleError(_0x4cc6ee,null));};exports[_0xbad9('0x96')]=function(_0x436a5e,_0x3ed3c4,_0x2e4fd9){var _0x10aa1c={};var _0x31a299={};var _0x2a6241;var _0x2bfea2;return db['MailAccount']['findOne']({'where':{'id':_0x436a5e['params']['id']}})['then'](handleEntityNotFound(_0x3ed3c4,null))['then'](function(_0x12a6d4){if(_0x12a6d4){_0x2a6241=_0x12a6d4;_0x31a299[_0xbad9('0x49')]=_['keys'](db[_0xbad9('0x94')][_0xbad9('0x41')]);_0x31a299[_0xbad9('0x45')]=_[_0xbad9('0x46')](_0x436a5e[_0xbad9('0x45')]);_0x31a299[_0xbad9('0x47')]=_[_0xbad9('0x48')](_0x31a299[_0xbad9('0x49')],_0x31a299[_0xbad9('0x45')]);_0x10aa1c['attributes']=_[_0xbad9('0x48')](_0x31a299['model'],qs[_0xbad9('0x4a')](_0x436a5e[_0xbad9('0x45')][_0xbad9('0x4a')]));_0x10aa1c[_0xbad9('0x4b')]=_0x10aa1c['attributes'][_0xbad9('0x4c')]?_0x10aa1c['attributes']:_0x31a299[_0xbad9('0x49')];_0x10aa1c['order']=qs[_0xbad9('0x51')](_0x436a5e[_0xbad9('0x45')][_0xbad9('0x51')]);_0x10aa1c[_0xbad9('0x52')]=qs[_0xbad9('0x47')](_[_0xbad9('0x53')](_0x436a5e[_0xbad9('0x45')],_0x31a299[_0xbad9('0x47')]));if(_0x436a5e['query'][_0xbad9('0x54')]){_0x10aa1c[_0xbad9('0x52')]=_[_0xbad9('0x55')](_0x10aa1c[_0xbad9('0x52')],{'$or':_[_0xbad9('0x66')](_0x10aa1c[_0xbad9('0x4b')],function(_0x3c3bea){var _0x3ce68c={};_0x3ce68c[_0x3c3bea]={'$like':'%'+_0x436a5e[_0xbad9('0x45')]['filter']+'%'};return _0x3ce68c;})});}_0x10aa1c=_[_0xbad9('0x55')]({},_0x10aa1c,_0x436a5e[_0xbad9('0x57')]);return _0x2a6241[_0xbad9('0x96')](_0x10aa1c);}})['then'](function(_0x2fde90){if(_0x2fde90){_0x2bfea2=_0x2fde90[_0xbad9('0x4c')];if(!_0x436a5e[_0xbad9('0x45')][_0xbad9('0x4d')](_0xbad9('0x6c'))){_0x10aa1c['limit']=qs[_0xbad9('0x4e')](_0x436a5e['query'][_0xbad9('0x4e')]);_0x10aa1c[_0xbad9('0x4f')]=qs[_0xbad9('0x4f')](_0x436a5e[_0xbad9('0x45')]['offset']);}return _0x2a6241[_0xbad9('0x96')](_0x10aa1c);}})[_0xbad9('0x1f')](function(_0x5ea8be){if(_0x5ea8be){return _0x5ea8be?{'count':_0x2bfea2,'rows':_0x5ea8be}:null;}})[_0xbad9('0x1f')](respondWithResult(_0x3ed3c4,null))[_0xbad9('0x29')](handleError(_0x3ed3c4,null));};exports[_0xbad9('0x97')]=function(_0x234f02,_0x1d1d8b,_0x14180d){var _0x26c768={'raw':!![],'where':{}};var _0x1e8e9b={};var _0xbe7206={'count':0x0,'rows':[]};return db[_0xbad9('0x58')][_0xbad9('0x64')]({'where':{'id':_0x234f02['params']['id']}})['then'](handleEntityNotFound(_0x1d1d8b,null))['then'](function(_0x1b6281){if(_0x1b6281){_0x1e8e9b[_0xbad9('0x49')]=_[_0xbad9('0x46')](db[_0xbad9('0x98')][_0xbad9('0x41')]);_0x1e8e9b[_0xbad9('0x45')]=_[_0xbad9('0x46')](_0x234f02['query']);_0x1e8e9b[_0xbad9('0x47')]=_[_0xbad9('0x48')](_0x1e8e9b[_0xbad9('0x49')],_0x1e8e9b[_0xbad9('0x45')]);_0x26c768[_0xbad9('0x4b')]=_[_0xbad9('0x48')](_0x1e8e9b['model'],qs[_0xbad9('0x4a')](_0x234f02[_0xbad9('0x45')]['fields']));_0x26c768[_0xbad9('0x4b')]=_0x26c768[_0xbad9('0x4b')]['length']?_0x26c768[_0xbad9('0x4b')]:_0x1e8e9b[_0xbad9('0x49')];if(!_0x234f02[_0xbad9('0x45')][_0xbad9('0x4d')](_0xbad9('0x6c'))){_0x26c768[_0xbad9('0x4e')]=qs[_0xbad9('0x4e')](_0x234f02[_0xbad9('0x45')][_0xbad9('0x4e')]);_0x26c768['offset']=qs[_0xbad9('0x4f')](_0x234f02[_0xbad9('0x45')]['offset']);}_0x26c768[_0xbad9('0x50')]=qs[_0xbad9('0x51')](_0x234f02[_0xbad9('0x45')]['sort']);_0x26c768[_0xbad9('0x52')]=qs['filters'](_[_0xbad9('0x53')](_0x234f02[_0xbad9('0x45')],_0x1e8e9b['filters']));_0x26c768['where'][_0xbad9('0x65')]=_0x1b6281['id'];if(_0x234f02[_0xbad9('0x45')][_0xbad9('0x54')]){_0x26c768[_0xbad9('0x52')]=_['merge'](_0x26c768['where'],{'$or':_[_0xbad9('0x66')](_0x26c768['attributes'],function(_0x2a3dc6){var _0x4e9755={};_0x4e9755[_0x2a3dc6]={'$like':'%'+_0x234f02['query'][_0xbad9('0x54')]+'%'};return _0x4e9755;})});}if(_0x234f02[_0xbad9('0x45')][_0xbad9('0x99')]){var _0x1f73e2=_0x234f02[_0xbad9('0x45')][_0xbad9('0x99')][_0xbad9('0x9a')](',');var _0x3a6f03={};_0x3a6f03[_0x1f73e2[0x0]]={'$gte':moment(_0x1f73e2[0x1])['format'](_0xbad9('0x9b'))};_0x26c768['where']=_[_0xbad9('0x55')](_0x26c768['where'],_0x3a6f03);}_0x26c768=_[_0xbad9('0x55')]({},_0x26c768,_0x234f02[_0xbad9('0x57')]);return db[_0xbad9('0x98')][_0xbad9('0x2d')]({'where':_0x26c768[_0xbad9('0x52')]})[_0xbad9('0x1f')](function(_0x55ea21){_0xbe7206[_0xbad9('0x2d')]=_0x55ea21;if(_0x234f02[_0xbad9('0x45')]['includeAll']){_0x26c768[_0xbad9('0x5a')]=[{'all':!![]}];}return db[_0xbad9('0x98')]['findAll'](_0x26c768);})[_0xbad9('0x1f')](function(_0x4a1f70){_0xbe7206[_0xbad9('0x5b')]=_0x4a1f70;return _0xbe7206;});}})[_0xbad9('0x1f')](respondWithFilteredResult(_0x1d1d8b,_0x26c768))[_0xbad9('0x29')](handleError(_0x1d1d8b,null));};exports[_0xbad9('0x3a')]=function(_0x5d3447,_0xaf00c1,_0x3c3129){var _0x43cb7b,_0x1192ce={},_0x28b8e6;if(_0x5d3447[_0xbad9('0x5f')]['to']){_0x28b8e6=_0x5d3447[_0xbad9('0x5f')]['to'][_0xbad9('0x9a')](',')[0x0];}return db[_0xbad9('0x58')][_0xbad9('0x5e')]({'where':{'id':_0x5d3447['params']['id']},'include':[{'model':db[_0xbad9('0x9c')],'as':_0xbad9('0x9d'),'include':[{'model':db[_0xbad9('0x8a')],'as':'Contacts','where':{'email':_0x28b8e6},'limit':0x1,'order':[[_0xbad9('0x9e'),_0xbad9('0x9f')]]}]},{'model':db[_0xbad9('0x60')],'as':_0xbad9('0x3e'),'raw':!![]}]})[_0xbad9('0x1f')](handleEntityNotFound(_0xaf00c1,null))[_0xbad9('0x1f')](function(_0x26fd9d){if(_0x26fd9d){_0x43cb7b=_0x26fd9d;if(_0x26fd9d[_0xbad9('0x3e')]){if(_[_0xbad9('0x70')](_0x5d3447[_0xbad9('0x5f')][_0xbad9('0xa0')])){_0x5d3447[_0xbad9('0x5f')][_0xbad9('0xa0')]=util[_0xbad9('0xa1')]('%s\x20<%s>',_0x26fd9d[_0xbad9('0x38')],_0x26fd9d[_0xbad9('0x6e')]||_0x26fd9d[_0xbad9('0x3e')][_0xbad9('0x74')]);}if(_0x5d3447['body']['attachments']&&_0x5d3447[_0xbad9('0x5f')][_0xbad9('0xa2')]['length']){for(var _0x132cba=0x0;_0x132cba<_0x5d3447['body'][_0xbad9('0xa2')][_0xbad9('0x4c')];_0x132cba+=0x1){_0x5d3447[_0xbad9('0x5f')][_0xbad9('0xa2')][_0x132cba]={'filename':_0x5d3447[_0xbad9('0x5f')]['attachments'][_0x132cba][_0xbad9('0x38')],'path':path[_0xbad9('0xa3')](config['root'],_0xbad9('0xa4'),_0x5d3447['body'][_0xbad9('0xa2')][_0x132cba][_0xbad9('0xa5')])};}}var _0x413034={'tls':{'rejectUnauthorized':![]}};if(_[_0xbad9('0x70')](_0x26fd9d['Smtp'][_0xbad9('0x7b')])){if(_0x26fd9d[_0xbad9('0x3e')][_0xbad9('0x78')]){_0x413034['auth']={'user':_0x26fd9d[_0xbad9('0x3e')][_0xbad9('0x74')],'pass':_0x26fd9d[_0xbad9('0x3e')][_0xbad9('0x7c')]};}_0x413034[_0xbad9('0x79')]=_0x26fd9d['Smtp'][_0xbad9('0x79')];_0x413034[_0xbad9('0x7a')]=_0x26fd9d[_0xbad9('0x3e')]['port'];_0x413034[_0xbad9('0xa6')]=_0x26fd9d[_0xbad9('0x3e')][_0xbad9('0xa6')];}else{_0x413034[_0xbad9('0x7b')]=_0x26fd9d[_0xbad9('0x3e')][_0xbad9('0x7b')];_0x413034[_0xbad9('0xa7')]={'user':_0x26fd9d[_0xbad9('0x3e')][_0xbad9('0x74')],'pass':_0x26fd9d[_0xbad9('0x3e')]['pass']};}return respondWithRpcPromise(_0xbad9('0xa8'),_0xbad9('0xa9'),{'account':_0x413034,'message':_0x5d3447[_0xbad9('0x5f')]});}else{throw new Error('List\x20not\x20found');}}})[_0xbad9('0x1f')](function(_0x1dbe7d){if(_0x1dbe7d){_0x1192ce=_0x1dbe7d;if(_0x43cb7b[_0xbad9('0x9d')]){if(_0x43cb7b[_0xbad9('0x9d')][_0xbad9('0xaa')]['length']){return _0x43cb7b['List'][_0xbad9('0xaa')][0x0];}else{return db[_0xbad9('0x8a')][_0xbad9('0x63')](_['defaults'](_0x5d3447[_0xbad9('0x5f')],{'firstName':_0x5d3447[_0xbad9('0x5f')]['to'],'email':_0x5d3447[_0xbad9('0x5f')]['to'],'phone':_0x5d3447[_0xbad9('0x5f')]['to'],'ListId':_0x43cb7b[_0xbad9('0x6f')]}));}}else{throw new Error(_0xbad9('0xab'));}}})[_0xbad9('0x1f')](function(_0x10c4e1){if(_0x10c4e1){var _0x336014={'UserId':_0x5d3447[_0xbad9('0x74')]['id'],'ContactId':_0x10c4e1['id'],'MailAccountId':_0x43cb7b['id'],'inReplyTo':_0x1192ce['messageId'],'to':_0x5d3447['body'][_0xbad9('0xa0')],'cc':_0x5d3447[_0xbad9('0x5f')]['cc'],'subject':_0x5d3447[_0xbad9('0x5f')][_0xbad9('0xac')],'attach':_0x5d3447['body'][_0xbad9('0xad')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xbad9('0xa1')](_0xbad9('0x9b')),'lastMsgDirection':'out','lastMsgBody':_0x5d3447['body']['body'],'Messages':[_[_0xbad9('0x55')](_0x5d3447[_0xbad9('0x5f')],{'messageId':_0x1192ce[_0xbad9('0xae')],'sentAt':moment()[_0xbad9('0xa1')](_0xbad9('0x9b')),'read':!![],'MailAccountId':_0x43cb7b['id'],'UserId':_0x5d3447['user']['id'],'ContactId':_0x10c4e1['id']})]};if(_0x5d3447[_0xbad9('0x5f')]['Interaction']){_0x336014=_[_0xbad9('0x55')](_0x336014,_0x5d3447['body']['Interaction']);}return db[_0xbad9('0x87')][_0xbad9('0x63')](_0x336014,{'include':[{'model':db['MailMessage'],'as':_0xbad9('0xaf')}]});}})['then'](respondWithResult(_0xaf00c1,null))['catch'](handleError(_0xaf00c1,null));};exports[_0xbad9('0xb0')]=function(_0x288e40,_0x25c3c8,_0x1b5099){return db['MailAccount'][_0xbad9('0x5e')]({'where':{'id':_0x288e40[_0xbad9('0x5d')]['id']},'include':[{'model':db[_0xbad9('0x60')],'as':'Smtp','raw':!![]}]})[_0xbad9('0x1f')](handleEntityNotFound(_0x25c3c8,null))[_0xbad9('0x1f')](function(_0x384589){if(_0x384589&&_0x384589['Smtp']){var _0x46c2f8={'id':_0x384589['id'],'tls':{'rejectUnauthorized':![]}};if(_0x384589[_0xbad9('0x3e')][_0xbad9('0x7b')]){_0x46c2f8[_0xbad9('0x7b')]=_0x384589[_0xbad9('0x3e')][_0xbad9('0x7b')];}else{_0x46c2f8[_0xbad9('0x79')]=_0x384589[_0xbad9('0x3e')][_0xbad9('0x79')];_0x46c2f8[_0xbad9('0x7a')]=_0x384589[_0xbad9('0x3e')]['port'];_0x46c2f8[_0xbad9('0xa6')]=_0x384589[_0xbad9('0x3e')][_0xbad9('0xa6')];}if(_0x384589[_0xbad9('0x3e')][_0xbad9('0x78')]){_0x46c2f8[_0xbad9('0xa7')]={'user':_0x384589['Smtp'][_0xbad9('0x74')],'pass':_0x384589[_0xbad9('0x3e')][_0xbad9('0x7c')]};}return respondWithRpcPromise(_0xbad9('0xb1'),_0xbad9('0xb0'),{'account':_0x46c2f8});}})[_0xbad9('0x1f')](respondWithResult(_0x25c3c8,null))[_0xbad9('0x29')](handleError(_0x25c3c8,null));};exports[_0xbad9('0x33')]=function(_0x467287,_0x376380){return db['MailAccount']['find']({'where':{'id':_0x467287['params']['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x376380,null))[_0xbad9('0x1f')](function(_0x5e161e){if(_0x5e161e&&_0x5e161e[_0xbad9('0x7b')]){throw new db[(_0xbad9('0xb2'))]['ValidationError'](_0xbad9('0xb3'));}return _0x5e161e;})[_0xbad9('0x1f')](removeEntity(_0x376380,null))[_0xbad9('0x29')](handleError(_0x376380,null));};exports[_0xbad9('0xb4')]=function(_0x578adb,_0xae72a,_0x5ee894){return db[_0xbad9('0x58')][_0xbad9('0x5e')]({'where':{'id':_0x578adb[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0xae72a,null))[_0xbad9('0x1f')](function(_0x4a2abb){if(_0x4a2abb){return _0x4a2abb['addAgents'](_0x578adb[_0xbad9('0x5f')][_0xbad9('0x69')],_['omit'](_0x578adb[_0xbad9('0x5f')],[_0xbad9('0x69'),'id'])||{})['spread'](function(_0x5015bf){for(var _0x303553=0x0;_0x303553<_0x578adb[_0xbad9('0x5f')]['ids'][_0xbad9('0x4c')];_0x303553+=0x1){socket[_0xbad9('0xb5')](_0xbad9('0xb6'),{'UserId':_0x578adb[_0xbad9('0x5f')][_0xbad9('0x69')][_0x303553],'MailAccountId':_0x578adb[_0xbad9('0x5d')]['id']});}return _0x5015bf;});}})['then'](respondWithResult(_0xae72a,null))[_0xbad9('0x29')](handleError(_0xae72a,null));};exports[_0xbad9('0xb7')]=function(_0x30334a,_0x1c9872,_0x2b8181){return db[_0xbad9('0x58')][_0xbad9('0x5e')]({'where':{'id':_0x30334a[_0xbad9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1c9872,null))[_0xbad9('0x1f')](function(_0x334d25){if(_0x334d25){return _0x334d25['removeAgents'](_0x30334a['query'][_0xbad9('0x69')])[_0xbad9('0x1f')](function(){if(_[_0xbad9('0xb8')](_0x30334a[_0xbad9('0x45')]['ids'])){for(var _0x57b4c4=0x0;_0x57b4c4<_0x30334a[_0xbad9('0x45')][_0xbad9('0x69')][_0xbad9('0x4c')];_0x57b4c4+=0x1){socket[_0xbad9('0xb5')](_0xbad9('0xb9'),{'UserId':Number(_0x30334a[_0xbad9('0x45')][_0xbad9('0x69')][_0x57b4c4]),'MailAccountId':Number(_0x30334a[_0xbad9('0x5d')]['id'])});}}else{socket[_0xbad9('0xb5')](_0xbad9('0xb9'),{'UserId':Number(_0x30334a[_0xbad9('0x45')][_0xbad9('0x69')]),'MailAccountId':Number(_0x30334a[_0xbad9('0x5d')]['id'])});}});}})[_0xbad9('0x1f')](respondWithStatusCode(_0x1c9872,null))['catch'](handleError(_0x1c9872,null));};exports[_0xbad9('0xba')]=function(_0x2e5ab6,_0x3d36c3,_0x467550){var _0x3d3e63={};var _0x4581dd={};var _0x5de079;var _0x51c4cc;return db[_0xbad9('0x58')][_0xbad9('0x64')]({'where':{'id':_0x2e5ab6[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x3d36c3,null))['then'](function(_0x5b298f){if(_0x5b298f){_0x5de079=_0x5b298f;_0x4581dd[_0xbad9('0x49')]=_[_0xbad9('0x46')](db[_0xbad9('0x8c')][_0xbad9('0x41')]);_0x4581dd['query']=_[_0xbad9('0x46')](_0x2e5ab6[_0xbad9('0x45')]);_0x4581dd[_0xbad9('0x47')]=_[_0xbad9('0x48')](_0x4581dd[_0xbad9('0x49')],_0x4581dd[_0xbad9('0x45')]);_0x3d3e63[_0xbad9('0x4b')]=_[_0xbad9('0x48')](_0x4581dd[_0xbad9('0x49')],qs[_0xbad9('0x4a')](_0x2e5ab6['query'][_0xbad9('0x4a')]));_0x3d3e63['attributes']=_0x3d3e63['attributes'][_0xbad9('0x4c')]?_0x3d3e63[_0xbad9('0x4b')]:_0x4581dd['model'];_0x3d3e63[_0xbad9('0x50')]=qs['sort'](_0x2e5ab6[_0xbad9('0x45')][_0xbad9('0x51')]);_0x3d3e63[_0xbad9('0x52')]=qs[_0xbad9('0x47')](_[_0xbad9('0x53')](_0x2e5ab6[_0xbad9('0x45')],_0x4581dd['filters']));if(_0x2e5ab6[_0xbad9('0x45')]['filter']){_0x3d3e63[_0xbad9('0x52')]=_[_0xbad9('0x55')](_0x3d3e63['where'],{'$or':_['map'](_0x3d3e63[_0xbad9('0x4b')],function(_0x4cbe3b){var _0x36551b={};_0x36551b[_0x4cbe3b]={'$like':'%'+_0x2e5ab6[_0xbad9('0x45')][_0xbad9('0x54')]+'%'};return _0x36551b;})});}_0x3d3e63=_[_0xbad9('0x55')]({},_0x3d3e63,_0x2e5ab6[_0xbad9('0x57')]);return _0x5de079[_0xbad9('0xba')](_0x3d3e63);}})[_0xbad9('0x1f')](function(_0x3853ff){if(_0x3853ff){_0x51c4cc=_0x3853ff[_0xbad9('0x4c')];if(!_0x2e5ab6[_0xbad9('0x45')][_0xbad9('0x4d')](_0xbad9('0x6c'))){_0x3d3e63[_0xbad9('0x4e')]=qs[_0xbad9('0x4e')](_0x2e5ab6[_0xbad9('0x45')][_0xbad9('0x4e')]);_0x3d3e63[_0xbad9('0x4f')]=qs[_0xbad9('0x4f')](_0x2e5ab6[_0xbad9('0x45')]['offset']);}return _0x5de079[_0xbad9('0xba')](_0x3d3e63);}})[_0xbad9('0x1f')](function(_0x549cab){if(_0x549cab){return _0x549cab?{'count':_0x51c4cc,'rows':_0x549cab}:null;}})['then'](respondWithResult(_0x3d36c3,null))['catch'](handleError(_0x3d36c3,null));}; \ No newline at end of file +var _0x86d8=['catch','show','params','rawAttributes','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','cservice','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','addInteraction','getInteractions','MailInteraction','CmContact','Contact','Owner','fullname','internal','Tag','Tags','tag','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','List','Contacts','updatedAt','DESC','from','attachments','join','root','server/files/attachments','basename','secure','List\x20not\x20found','attach','out','messageId','Interaction','Messages','verifySmtp','auth','VerifySmtp','Sequelize','ValidationError','omit','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x5106e6,_0x291daf){var _0x3296dc=function(_0x2dcf49){while(--_0x2dcf49){_0x5106e6['push'](_0x5106e6['shift']());}};_0x3296dc(++_0x291daf);}(_0x86d8,0x1de));var _0x886d=function(_0x15c420,_0x1a8ef1){_0x15c420=_0x15c420-0x0;var _0x23f862=_0x86d8[_0x15c420];return _0x23f862;};'use strict';var pdf=require(_0x886d('0x0'));var emlformat=require(_0x886d('0x1'));var rimraf=require(_0x886d('0x2'));var zipdir=require(_0x886d('0x3'));var jsonpatch=require(_0x886d('0x4'));var rp=require(_0x886d('0x5'));var moment=require(_0x886d('0x6'));var BPromise=require(_0x886d('0x7'));var Mustache=require(_0x886d('0x8'));var util=require(_0x886d('0x9'));var path=require(_0x886d('0xa'));var sox=require(_0x886d('0xb'));var csv=require(_0x886d('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x886d('0xd'));var squel=require(_0x886d('0xe'));var crypto=require(_0x886d('0xf'));var jsforce=require(_0x886d('0x10'));var deskjs=require(_0x886d('0x11'));var toCsv=require(_0x886d('0xc'));var querystring=require(_0x886d('0x12'));var Papa=require('papaparse');var Redis=require(_0x886d('0x13'));var authService=require(_0x886d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x886d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x886d('0x16'))(_0x886d('0x17'));var utils=require(_0x886d('0x18'));var config=require(_0x886d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x886d('0x1a'))['db'];config[_0x886d('0x1b')]=_[_0x886d('0x1c')](config[_0x886d('0x1b')],{'host':_0x886d('0x1d'),'port':0x18eb});var socket=require(_0x886d('0x1e'))(new Redis(config[_0x886d('0x1b')]));require('./mailAccount.socket')[_0x886d('0x1f')](socket);var jayson=require(_0x886d('0x20'));var client=jayson['client'][_0x886d('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x5873a2,_0x492724,_0x17f900,_0x5e1901){return new BPromise(function(_0x30501a,_0x3a46cb){var _0x3089c1=_0x5e1901||client;return _0x3089c1[_0x886d('0x22')](_0x5873a2,_0x17f900)[_0x886d('0x23')](function(_0x33985d){logger['info'](_0x886d('0x24'),_0x492724,_0x886d('0x25'));logger[_0x886d('0x26')](_0x886d('0x27'),_0x492724,'request\x20sent',JSON['stringify'](_0x33985d));if(_0x33985d['error']){if(_0x33985d[_0x886d('0x28')][_0x886d('0x29')]===0x1f4){logger[_0x886d('0x28')](_0x886d('0x24'),_0x492724,_0x33985d[_0x886d('0x28')][_0x886d('0x2a')]);return _0x3a46cb(_0x33985d['error'][_0x886d('0x2a')]);}logger[_0x886d('0x28')](_0x886d('0x24'),_0x492724,_0x33985d[_0x886d('0x28')][_0x886d('0x2a')]);return _0x30501a(_0x33985d[_0x886d('0x28')]['message']);}else{logger['info'](_0x886d('0x24'),_0x492724,_0x886d('0x25'));_0x30501a(_0x33985d['result']['message']);}})['catch'](function(_0x54e536){logger[_0x886d('0x28')](_0x886d('0x24'),_0x492724,_0x54e536);_0x3a46cb(_0x54e536);});});}function respondWithStatusCode(_0x397c4d,_0x5767a4){_0x5767a4=_0x5767a4||0xcc;return function(_0x1587e5){if(_0x1587e5){return _0x397c4d[_0x886d('0x2b')](_0x5767a4);}return _0x397c4d[_0x886d('0x2c')](_0x5767a4)[_0x886d('0x2d')]();};}function respondWithResult(_0x1144a8,_0x267360){_0x267360=_0x267360||0xc8;return function(_0x5acf8f){if(_0x5acf8f){return _0x1144a8[_0x886d('0x2c')](_0x267360)['json'](_0x5acf8f);}};}function respondWithFilteredResult(_0x4542c2,_0x266176){return function(_0x1325f2){if(_0x1325f2){var _0x3a9363=_0x1325f2[_0x886d('0x2e')],_0xd8ed17=_0x266176[_0x886d('0x2f')],_0x10b163=_0x266176[_0x886d('0x2f')]+_0x266176[_0x886d('0x30')],_0x5dfc1f;if(_0x10b163>=_0x3a9363){_0x10b163=_0x3a9363;_0x5dfc1f=0xc8;}else{_0x5dfc1f=0xce;}_0x4542c2[_0x886d('0x2c')](_0x5dfc1f);return _0x4542c2[_0x886d('0x31')](_0x886d('0x32'),_0xd8ed17+'-'+_0x10b163+'/'+_0x3a9363)[_0x886d('0x33')](_0x1325f2);}return null;};}function patchUpdates(_0x344706){return function(_0xb19c1c){try{jsonpatch[_0x886d('0x34')](_0xb19c1c,_0x344706,!![]);}catch(_0x5bec75){return BPromise['reject'](_0x5bec75);}return _0xb19c1c[_0x886d('0x35')]();};}function saveUpdates(_0x2bcdcd,_0x4b2c3e){return function(_0x2f1c43){if(_0x2f1c43){return _0x2f1c43[_0x886d('0x36')](_0x2bcdcd)[_0x886d('0x23')](function(_0x251d83){return _0x251d83;});}return null;};}function removeEntity(_0x3054fd,_0x596743){return function(_0x448744){if(_0x448744){return _0x448744[_0x886d('0x37')]()[_0x886d('0x23')](function(){var _0x57c88f=_0x448744[_0x886d('0x38')]({'plain':!![]});var _0x5f76ff=_0x886d('0x39');return db[_0x886d('0x3a')][_0x886d('0x37')]({'where':{'type':_0x5f76ff,'resourceId':_0x57c88f['id']}})[_0x886d('0x23')](function(){return _0x448744;});})[_0x886d('0x23')](function(){_0x3054fd[_0x886d('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15d71b,_0x5f1ab2){return function(_0x4a0c63){if(!_0x4a0c63){_0x15d71b['sendStatus'](0x194);}return _0x4a0c63;};}function handleError(_0x22cbad,_0x1c19b9){_0x1c19b9=_0x1c19b9||0x1f4;return function(_0x5ef0af){logger[_0x886d('0x28')](_0x5ef0af[_0x886d('0x3b')]);if(_0x5ef0af['name']){delete _0x5ef0af[_0x886d('0x3c')];}_0x22cbad['status'](_0x1c19b9)[_0x886d('0x3d')](_0x5ef0af);};}exports[_0x886d('0x3e')]=function(_0x308989,_0xc29707){var _0x283fba={'include':[{'model':db[_0x886d('0x3f')],'as':_0x886d('0x40')},{'model':db[_0x886d('0x41')],'as':_0x886d('0x42')},{'model':db[_0x886d('0x43')],'as':_0x886d('0x44')}]},_0x27d7a9={},_0x316a16={'count':0x0,'rows':[]};var _0xa8d1a7=_[_0x886d('0x45')](db[_0x886d('0x46')]['rawAttributes'],function(_0x116867){return{'name':_0x116867[_0x886d('0x47')],'type':_0x116867[_0x886d('0x48')][_0x886d('0x49')]};});_0x27d7a9['model']=_[_0x886d('0x45')](_0xa8d1a7,_0x886d('0x3c'));_0x27d7a9[_0x886d('0x4a')]=_[_0x886d('0x4b')](_0x308989[_0x886d('0x4a')]);_0x27d7a9[_0x886d('0x4c')]=_[_0x886d('0x4d')](_0x27d7a9[_0x886d('0x4e')],_0x27d7a9[_0x886d('0x4a')]);_0x283fba['attributes']=_[_0x886d('0x4d')](_0x27d7a9[_0x886d('0x4e')],qs[_0x886d('0x4f')](_0x308989[_0x886d('0x4a')][_0x886d('0x4f')]));_0x283fba['attributes']=_0x283fba[_0x886d('0x50')][_0x886d('0x51')]?_0x283fba[_0x886d('0x50')]:_0x27d7a9['model'];if(!_0x308989['query'][_0x886d('0x52')](_0x886d('0x53'))){_0x283fba[_0x886d('0x30')]=qs['limit'](_0x308989[_0x886d('0x4a')]['limit']);_0x283fba[_0x886d('0x2f')]=qs['offset'](_0x308989[_0x886d('0x4a')]['offset']);}_0x283fba[_0x886d('0x54')]=qs[_0x886d('0x55')](_0x308989[_0x886d('0x4a')][_0x886d('0x55')]);_0x283fba[_0x886d('0x56')]=qs[_0x886d('0x4c')](_[_0x886d('0x57')](_0x308989[_0x886d('0x4a')],_0x27d7a9[_0x886d('0x4c')]),_0xa8d1a7);if(_0x308989[_0x886d('0x4a')][_0x886d('0x58')]){_0x283fba[_0x886d('0x56')]=_[_0x886d('0x59')](_0x283fba[_0x886d('0x56')],{'$or':_[_0x886d('0x45')](_0xa8d1a7,function(_0x9499cf){if(_0x9499cf[_0x886d('0x48')]!==_0x886d('0x5a')){var _0x195246={};_0x195246[_0x9499cf['name']]={'$like':'%'+_0x308989['query'][_0x886d('0x58')]+'%'};return _0x195246;}})});}_0x283fba=_[_0x886d('0x59')]({},_0x283fba,_0x308989[_0x886d('0x5b')]);var _0x36df7a={'where':_0x283fba['where']};return db[_0x886d('0x46')][_0x886d('0x2e')](_0x36df7a)[_0x886d('0x23')](function(_0x276cef){_0x316a16[_0x886d('0x2e')]=_0x276cef;if(_0x308989['query'][_0x886d('0x5c')]){_0x283fba['include']=[{'all':!![]}];}return db[_0x886d('0x46')][_0x886d('0x5d')](_0x283fba);})['then'](function(_0x2214ae){_0x316a16[_0x886d('0x5e')]=_0x2214ae;return _0x316a16;})[_0x886d('0x23')](respondWithFilteredResult(_0xc29707,_0x283fba))[_0x886d('0x5f')](handleError(_0xc29707,null));};exports[_0x886d('0x60')]=function(_0x465410,_0x5fda45){var _0x9f5549={'raw':![],'where':{'id':_0x465410[_0x886d('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x886d('0x41')],'as':'Smtp'},{'model':db['Pause'],'as':_0x886d('0x44')}]},_0xa5da1a={};_0xa5da1a[_0x886d('0x4e')]=_['keys'](db[_0x886d('0x46')][_0x886d('0x62')]);_0xa5da1a['query']=_[_0x886d('0x4b')](_0x465410['query']);_0xa5da1a[_0x886d('0x4c')]=_['intersection'](_0xa5da1a[_0x886d('0x4e')],_0xa5da1a[_0x886d('0x4a')]);_0x9f5549['attributes']=_[_0x886d('0x4d')](_0xa5da1a[_0x886d('0x4e')],qs[_0x886d('0x4f')](_0x465410[_0x886d('0x4a')]['fields']));_0x9f5549['attributes']=_0x9f5549[_0x886d('0x50')][_0x886d('0x51')]?_0x9f5549[_0x886d('0x50')]:_0xa5da1a[_0x886d('0x4e')];if(_0x465410[_0x886d('0x4a')]['includeAll']){_0x9f5549['include']=[{'all':!![]}];}_0x9f5549=_[_0x886d('0x59')]({},_0x9f5549,_0x465410[_0x886d('0x5b')]);return db['MailAccount'][_0x886d('0x63')](_0x9f5549)['then'](handleEntityNotFound(_0x5fda45,null))[_0x886d('0x23')](respondWithResult(_0x5fda45,null))[_0x886d('0x5f')](handleError(_0x5fda45,null));};exports[_0x886d('0x36')]=function(_0x17db2d,_0x137fcf){if(_0x17db2d['body']['id']){delete _0x17db2d[_0x886d('0x64')]['id'];}return db[_0x886d('0x46')]['find']({'where':{'id':_0x17db2d[_0x886d('0x61')]['id']},'include':[{'model':db[_0x886d('0x3f')],'as':_0x886d('0x40')},{'model':db[_0x886d('0x41')],'as':_0x886d('0x42')},{'model':db[_0x886d('0x43')],'as':_0x886d('0x44')}]})[_0x886d('0x23')](handleEntityNotFound(_0x137fcf,null))[_0x886d('0x23')](saveUpdates(_0x17db2d[_0x886d('0x64')],null))['then'](function(_0x150b85){if(_0x150b85&&_0x17db2d['body'][_0x886d('0x40')]){return db[_0x886d('0x3f')][_0x886d('0x36')](_0x17db2d['body']['Imap'],{'where':{'MailAccountId':_0x150b85['id']}})[_0x886d('0x23')](function(){return _0x150b85;});}return _0x150b85;})[_0x886d('0x23')](function(_0x20c384){if(_0x20c384&&_0x17db2d[_0x886d('0x64')][_0x886d('0x42')]){return db['MailServerOut'][_0x886d('0x36')](_0x17db2d[_0x886d('0x64')][_0x886d('0x42')],{'where':{'MailAccountId':_0x20c384['id']}})['then'](function(){return _0x20c384;});}return _0x20c384;})[_0x886d('0x23')](respondWithResult(_0x137fcf,null))[_0x886d('0x5f')](handleError(_0x137fcf,null));};exports[_0x886d('0x65')]=function(_0x1d99f2,_0x2e7633){return db[_0x886d('0x46')]['describe']()['then'](respondWithResult(_0x2e7633,null))[_0x886d('0x5f')](handleError(_0x2e7633,null));};exports[_0x886d('0x66')]=function(_0x43c772,_0x34e662,_0x5c6059){if(_0x43c772[_0x886d('0x64')]['id']){delete _0x43c772[_0x886d('0x64')]['id'];}return db[_0x886d('0x46')][_0x886d('0x63')]({'where':{'id':_0x43c772['params']['id']}})['then'](handleEntityNotFound(_0x34e662,null))[_0x886d('0x23')](function(_0x23f784){if(_0x23f784){_0x43c772['body'][_0x886d('0x67')]=_0x23f784['id'];return db[_0x886d('0x68')][_0x886d('0x69')](_0x43c772['body']);}})[_0x886d('0x23')](respondWithResult(_0x34e662,null))[_0x886d('0x5f')](handleError(_0x34e662,null));};exports[_0x886d('0x6a')]=function(_0x5d6b5a,_0x215989,_0x5cc418){var _0x312fee={'raw':![],'where':{}};var _0x4ca045={};var _0x40c323={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x5d6b5a[_0x886d('0x61')]['id']}})['then'](handleEntityNotFound(_0x215989,null))[_0x886d('0x23')](function(_0x26b069){if(_0x26b069){_0x4ca045[_0x886d('0x4e')]=_[_0x886d('0x4b')](db['Disposition'][_0x886d('0x62')]);_0x4ca045['query']=_[_0x886d('0x4b')](_0x5d6b5a[_0x886d('0x4a')]);_0x4ca045[_0x886d('0x4c')]=_[_0x886d('0x4d')](_0x4ca045['model'],_0x4ca045['query']);_0x312fee[_0x886d('0x50')]=_[_0x886d('0x4d')](_0x4ca045['model'],qs['fields'](_0x5d6b5a[_0x886d('0x4a')]['fields']));_0x312fee[_0x886d('0x50')]=_0x312fee[_0x886d('0x50')][_0x886d('0x51')]?_0x312fee[_0x886d('0x50')]:_0x4ca045['model'];if(!_0x5d6b5a[_0x886d('0x4a')][_0x886d('0x52')](_0x886d('0x53'))){_0x312fee[_0x886d('0x30')]=qs[_0x886d('0x30')](_0x5d6b5a[_0x886d('0x4a')][_0x886d('0x30')]);_0x312fee['offset']=qs[_0x886d('0x2f')](_0x5d6b5a['query'][_0x886d('0x2f')]);}_0x312fee[_0x886d('0x54')]=qs[_0x886d('0x55')](_0x5d6b5a[_0x886d('0x4a')]['sort']);_0x312fee[_0x886d('0x56')]=qs[_0x886d('0x4c')](_[_0x886d('0x57')](_0x5d6b5a['query'],_0x4ca045['filters']));_0x312fee['where'][_0x886d('0x67')]=_0x26b069['id'];if(_0x5d6b5a['query'][_0x886d('0x58')]){_0x312fee['where']=_[_0x886d('0x59')](_0x312fee[_0x886d('0x56')],{'$or':_[_0x886d('0x45')](_0x312fee[_0x886d('0x50')],function(_0x394026){var _0x1fada0={};_0x1fada0[_0x394026]={'$like':'%'+_0x5d6b5a[_0x886d('0x4a')][_0x886d('0x58')]+'%'};return _0x1fada0;})});}_0x312fee=_['merge']({},_0x312fee,_0x5d6b5a[_0x886d('0x5b')]);return db['Disposition']['count']({'where':_0x312fee[_0x886d('0x56')]})[_0x886d('0x23')](function(_0x9202d8){_0x40c323[_0x886d('0x2e')]=_0x9202d8;if(_0x5d6b5a[_0x886d('0x4a')][_0x886d('0x5c')]){_0x312fee['include']=[{'all':!![]}];}return db[_0x886d('0x68')][_0x886d('0x5d')](_0x312fee);})[_0x886d('0x23')](function(_0xe53b18){_0x40c323[_0x886d('0x5e')]=_0xe53b18;return _0x40c323;});}})[_0x886d('0x23')](respondWithFilteredResult(_0x215989,_0x312fee))[_0x886d('0x5f')](handleError(_0x215989,null));};exports['removeDispositions']=function(_0xd08ced,_0x112c1d,_0x6ccdc3){return db[_0x886d('0x46')][_0x886d('0x63')]({'where':{'id':_0xd08ced[_0x886d('0x61')]['id']}})['then'](handleEntityNotFound(_0x112c1d,null))[_0x886d('0x23')](function(_0x3bb795){if(_0x3bb795){return _0x3bb795[_0x886d('0x6b')](_0xd08ced['query'][_0x886d('0x6c')]);}})[_0x886d('0x23')](respondWithStatusCode(_0x112c1d,null))[_0x886d('0x5f')](handleError(_0x112c1d,null));};exports[_0x886d('0x6d')]=function(_0x265e60,_0xb49909,_0xa67a37){if(_0x265e60['body']['id']){delete _0x265e60[_0x886d('0x64')]['id'];}return db[_0x886d('0x46')][_0x886d('0x63')]({'where':{'id':_0x265e60[_0x886d('0x61')]['id']}})[_0x886d('0x23')](handleEntityNotFound(_0xb49909,null))[_0x886d('0x23')](function(_0x843a6d){if(_0x843a6d){_0x265e60['body']['MailAccountId']=_0x843a6d['id'];return db['CannedAnswer'][_0x886d('0x69')](_0x265e60[_0x886d('0x64')]);}})[_0x886d('0x23')](respondWithResult(_0xb49909,null))[_0x886d('0x5f')](handleError(_0xb49909,null));};exports[_0x886d('0x6e')]=function(_0x17c8cd,_0x92e71f,_0x358fbe){var _0x50fd1b={'raw':![],'where':{}};var _0x3fec63={};var _0x1b8c5c={'count':0x0,'rows':[]};return db[_0x886d('0x46')][_0x886d('0x6f')]({'where':{'id':_0x17c8cd[_0x886d('0x61')]['id']}})[_0x886d('0x23')](handleEntityNotFound(_0x92e71f,null))['then'](function(_0x92ff7a){if(_0x92ff7a){_0x3fec63[_0x886d('0x4e')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x3fec63[_0x886d('0x4a')]=_[_0x886d('0x4b')](_0x17c8cd[_0x886d('0x4a')]);_0x3fec63[_0x886d('0x4c')]=_[_0x886d('0x4d')](_0x3fec63[_0x886d('0x4e')],_0x3fec63[_0x886d('0x4a')]);_0x50fd1b[_0x886d('0x50')]=_['intersection'](_0x3fec63[_0x886d('0x4e')],qs['fields'](_0x17c8cd['query'][_0x886d('0x4f')]));_0x50fd1b[_0x886d('0x50')]=_0x50fd1b[_0x886d('0x50')]['length']?_0x50fd1b[_0x886d('0x50')]:_0x3fec63[_0x886d('0x4e')];if(!_0x17c8cd[_0x886d('0x4a')][_0x886d('0x52')](_0x886d('0x53'))){_0x50fd1b['limit']=qs[_0x886d('0x30')](_0x17c8cd[_0x886d('0x4a')][_0x886d('0x30')]);_0x50fd1b[_0x886d('0x2f')]=qs[_0x886d('0x2f')](_0x17c8cd[_0x886d('0x4a')][_0x886d('0x2f')]);}_0x50fd1b[_0x886d('0x54')]=qs['sort'](_0x17c8cd[_0x886d('0x4a')][_0x886d('0x55')]);_0x50fd1b[_0x886d('0x56')]=qs[_0x886d('0x4c')](_[_0x886d('0x57')](_0x17c8cd['query'],_0x3fec63['filters']));_0x50fd1b['where'][_0x886d('0x67')]=_0x92ff7a['id'];if(_0x17c8cd[_0x886d('0x4a')][_0x886d('0x58')]){_0x50fd1b['where']=_[_0x886d('0x59')](_0x50fd1b[_0x886d('0x56')],{'$or':_[_0x886d('0x45')](_0x50fd1b[_0x886d('0x50')],function(_0x3f075c){var _0x2b8a96={};_0x2b8a96[_0x3f075c]={'$like':'%'+_0x17c8cd['query'][_0x886d('0x58')]+'%'};return _0x2b8a96;})});}_0x50fd1b=_[_0x886d('0x59')]({},_0x50fd1b,_0x17c8cd[_0x886d('0x5b')]);return db[_0x886d('0x70')][_0x886d('0x2e')]({'where':_0x50fd1b[_0x886d('0x56')]})[_0x886d('0x23')](function(_0x444bac){_0x1b8c5c['count']=_0x444bac;if(_0x17c8cd['query'][_0x886d('0x5c')]){_0x50fd1b['include']=[{'all':!![]}];}return db[_0x886d('0x70')][_0x886d('0x5d')](_0x50fd1b);})[_0x886d('0x23')](function(_0x4f557f){_0x1b8c5c[_0x886d('0x5e')]=_0x4f557f;return _0x1b8c5c;});}})['then'](respondWithFilteredResult(_0x92e71f,_0x50fd1b))['catch'](handleError(_0x92e71f,null));};exports['removeAnswers']=function(_0x3de91f,_0x1152f0,_0x52545d){return db[_0x886d('0x46')][_0x886d('0x63')]({'where':{'id':_0x3de91f[_0x886d('0x61')]['id']}})['then'](handleEntityNotFound(_0x1152f0,null))[_0x886d('0x23')](function(_0x1ec02d){if(_0x1ec02d){return _0x1ec02d[_0x886d('0x71')](_0x3de91f[_0x886d('0x4a')][_0x886d('0x6c')]);}})[_0x886d('0x23')](respondWithStatusCode(_0x1152f0,null))[_0x886d('0x5f')](handleError(_0x1152f0,null));};exports['create']=function(_0x1c27b4,_0x407602){var _0x1d3c67={'name':_0x1c27b4[_0x886d('0x64')][_0x886d('0x3c')],'key':_0x1c27b4['body'][_0x886d('0x49')],'email':_0x1c27b4[_0x886d('0x64')][_0x886d('0x72')],'ListId':_0x1c27b4['body'][_0x886d('0x73')],'active':!_[_0x886d('0x74')](_0x1c27b4['body'][_0x886d('0x75')])?_0x1c27b4[_0x886d('0x64')][_0x886d('0x75')]:!![],'description':_0x1c27b4['body'][_0x886d('0x76')]||null,'Imap':{},'Smtp':{}};if(_[_0x886d('0x74')](_0x1c27b4['body'][_0x886d('0x77')])){if(_0x1c27b4['body']['cauthentication']){_0x1d3c67[_0x886d('0x40')][_0x886d('0x78')]=_0x1d3c67[_0x886d('0x42')][_0x886d('0x78')]=_0x1c27b4['body'][_0x886d('0x79')];_0x1d3c67[_0x886d('0x40')][_0x886d('0x7a')]=_0x1d3c67['Smtp'][_0x886d('0x7b')]=_0x1c27b4[_0x886d('0x64')][_0x886d('0x7c')];}else{_0x1d3c67[_0x886d('0x40')][_0x886d('0x7d')]=_0x1d3c67[_0x886d('0x42')][_0x886d('0x7d')]=![];}_0x1d3c67[_0x886d('0x40')]['host']=_0x1c27b4[_0x886d('0x64')][_0x886d('0x40')][_0x886d('0x7e')];_0x1d3c67[_0x886d('0x40')][_0x886d('0x7f')]=_0x1c27b4[_0x886d('0x64')][_0x886d('0x40')][_0x886d('0x7f')];_0x1d3c67[_0x886d('0x42')][_0x886d('0x7e')]=_0x1c27b4[_0x886d('0x64')]['Smtp'][_0x886d('0x7e')];_0x1d3c67['Smtp'][_0x886d('0x7f')]=_0x1c27b4['body'][_0x886d('0x42')]['port'];}else{_0x1d3c67[_0x886d('0x40')][_0x886d('0x80')]=_0x1d3c67[_0x886d('0x42')][_0x886d('0x80')]=_0x1c27b4[_0x886d('0x64')][_0x886d('0x77')];_0x1d3c67[_0x886d('0x40')][_0x886d('0x78')]=_0x1d3c67[_0x886d('0x42')]['user']=_0x1c27b4[_0x886d('0x64')][_0x886d('0x79')];_0x1d3c67['Imap'][_0x886d('0x7a')]=_0x1d3c67[_0x886d('0x42')][_0x886d('0x7b')]=_0x1c27b4[_0x886d('0x64')][_0x886d('0x7c')];}return db['MailAccount'][_0x886d('0x69')](_0x1d3c67,{'include':[{'model':db[_0x886d('0x41')],'as':_0x886d('0x42')},{'model':db[_0x886d('0x3f')],'as':'Imap'}]})[_0x886d('0x23')](function(_0x54b166){var _0x2a9388=_0x1c27b4['user']['get']({'plain':!![]});if(!_0x2a9388)throw new Error(_0x886d('0x81'));if(_0x2a9388[_0x886d('0x82')]===_0x886d('0x78')){var _0x56154f=_0x54b166[_0x886d('0x38')]({'plain':!![]});return db[_0x886d('0x83')]['find']({'where':{'name':_0x886d('0x39'),'userProfileId':_0x2a9388[_0x886d('0x84')]},'raw':!![]})[_0x886d('0x23')](function(_0x2ccb04){if(_0x2ccb04&&_0x2ccb04[_0x886d('0x85')]===0x0){return db['UserProfileResource']['create']({'name':_0x56154f['name'],'resourceId':_0x56154f['id'],'type':_0x2ccb04[_0x886d('0x3c')],'sectionId':_0x2ccb04['id']},{})[_0x886d('0x23')](function(){return _0x54b166;});}else{return _0x54b166;}})['catch'](function(_0x11e940){logger[_0x886d('0x28')](_0x886d('0x86'),_0x11e940);throw _0x11e940;});}return _0x54b166;})['then'](respondWithResult(_0x407602,0xc9))[_0x886d('0x5f')](handleError(_0x407602,null));};exports[_0x886d('0x87')]=function(_0x53cdca,_0xbe62d6,_0x24edae){return db['MailAccount'][_0x886d('0x6f')]({'where':{'id':_0x53cdca[_0x886d('0x61')]['id']}})[_0x886d('0x23')](handleEntityNotFound(_0xbe62d6,null))[_0x886d('0x23')](function(_0x363859){if(_0x363859){return _0x363859['getImap']();}return null;})['then'](respondWithResult(_0xbe62d6,null))[_0x886d('0x5f')](handleError(_0xbe62d6,null));};exports[_0x886d('0x88')]=function(_0x16ab5f,_0x1c19df,_0x52ba6e){if(_0x16ab5f['body']['id']){delete _0x16ab5f[_0x886d('0x64')]['id'];}return db[_0x886d('0x46')][_0x886d('0x63')]({'where':{'id':_0x16ab5f['params']['id']}})[_0x886d('0x23')](handleEntityNotFound(_0x1c19df,null))[_0x886d('0x23')](function(_0x3e998b){if(_0x3e998b){_0x16ab5f[_0x886d('0x64')][_0x886d('0x67')]=_0x3e998b['id'];return db[_0x886d('0x3f')][_0x886d('0x69')](_0x16ab5f[_0x886d('0x64')]);}})[_0x886d('0x23')](respondWithResult(_0x1c19df,null))[_0x886d('0x5f')](handleError(_0x1c19df,null));};exports[_0x886d('0x89')]=function(_0x141572,_0x203363,_0x5036a9){return db[_0x886d('0x46')][_0x886d('0x6f')]({'where':{'id':_0x141572['params']['id']}})[_0x886d('0x23')](handleEntityNotFound(_0x203363,null))[_0x886d('0x23')](function(_0x341c2f){if(_0x341c2f){return _0x341c2f['setImap'](null);}return null;})[_0x886d('0x23')](respondWithStatusCode(_0x203363,null))['catch'](handleError(_0x203363,null));};exports[_0x886d('0x8a')]=function(_0x519603,_0x20b4fd,_0x4d2534){return db[_0x886d('0x46')]['findOne']({'where':{'id':_0x519603[_0x886d('0x61')]['id']}})['then'](handleEntityNotFound(_0x20b4fd,null))['then'](function(_0xcc6409){if(_0xcc6409){return _0xcc6409[_0x886d('0x8a')]();}return null;})[_0x886d('0x23')](respondWithResult(_0x20b4fd,null))[_0x886d('0x5f')](handleError(_0x20b4fd,null));};exports[_0x886d('0x8b')]=function(_0x3af68b,_0x181e4a,_0x338901){if(_0x3af68b[_0x886d('0x64')]['id']){delete _0x3af68b[_0x886d('0x64')]['id'];}return db[_0x886d('0x46')]['find']({'where':{'id':_0x3af68b[_0x886d('0x61')]['id']}})[_0x886d('0x23')](handleEntityNotFound(_0x181e4a,null))[_0x886d('0x23')](function(_0x5b33d1){if(_0x5b33d1){_0x3af68b[_0x886d('0x64')][_0x886d('0x67')]=_0x5b33d1['id'];return db[_0x886d('0x41')][_0x886d('0x69')](_0x3af68b[_0x886d('0x64')]);}})['then'](respondWithResult(_0x181e4a,null))['catch'](handleError(_0x181e4a,null));};exports[_0x886d('0x8c')]=function(_0x46b4fa,_0x58498b,_0x519936){return db[_0x886d('0x46')][_0x886d('0x6f')]({'where':{'id':_0x46b4fa[_0x886d('0x61')]['id']}})['then'](handleEntityNotFound(_0x58498b,null))[_0x886d('0x23')](function(_0x1cd249){if(_0x1cd249){return _0x1cd249['setSmtp'](null);}return null;})[_0x886d('0x23')](respondWithStatusCode(_0x58498b,null))[_0x886d('0x5f')](handleError(_0x58498b,null));};exports[_0x886d('0x8d')]=function(_0x245206,_0xcd9d00,_0xbb577a){return db['MailInteraction']['find']({'where':{'id':_0x245206[_0x886d('0x61')]['id']}})[_0x886d('0x23')](handleEntityNotFound(_0xcd9d00,null))[_0x886d('0x23')](function(_0xf9a921){if(_0xf9a921){return _0xf9a921[_0x886d('0x8d')](_0x245206['body'][_0x886d('0x6c')],_['omit'](_0x245206['body'],[_0x886d('0x6c'),'id'])||{});}})[_0x886d('0x23')](respondWithResult(_0xcd9d00,null))[_0x886d('0x5f')](handleError(_0xcd9d00,null));};exports[_0x886d('0x8e')]=function(_0x10de44,_0x1bc25b,_0x59dd9d){var _0x5c6366={'raw':![],'where':{}};var _0x80c952={};var _0x459534={'count':0x0,'rows':[]};return db[_0x886d('0x46')]['findOne']({'where':{'id':_0x10de44[_0x886d('0x61')]['id']}})[_0x886d('0x23')](handleEntityNotFound(_0x1bc25b,null))[_0x886d('0x23')](function(_0x5ed89d){if(_0x5ed89d){_0x80c952[_0x886d('0x4e')]=_['keys'](db[_0x886d('0x8f')]['rawAttributes']);_0x80c952[_0x886d('0x4a')]=_[_0x886d('0x4b')](_0x10de44['query']);_0x80c952['filters']=_[_0x886d('0x4d')](_0x80c952['model'],_0x80c952[_0x886d('0x4a')]);_0x5c6366[_0x886d('0x50')]=_[_0x886d('0x4d')](_0x80c952[_0x886d('0x4e')],qs['fields'](_0x10de44['query'][_0x886d('0x4f')]));_0x5c6366[_0x886d('0x50')]=_0x5c6366['attributes'][_0x886d('0x51')]?_0x5c6366[_0x886d('0x50')]:_0x80c952[_0x886d('0x4e')];if(!_0x10de44[_0x886d('0x4a')]['hasOwnProperty'](_0x886d('0x53'))){_0x5c6366[_0x886d('0x30')]=qs[_0x886d('0x30')](_0x10de44[_0x886d('0x4a')][_0x886d('0x30')]);_0x5c6366[_0x886d('0x2f')]=qs[_0x886d('0x2f')](_0x10de44[_0x886d('0x4a')][_0x886d('0x2f')]);}_0x5c6366[_0x886d('0x54')]=qs[_0x886d('0x55')](_0x10de44['query'][_0x886d('0x55')]);_0x5c6366[_0x886d('0x56')]=qs[_0x886d('0x4c')](_['pick'](_0x10de44[_0x886d('0x4a')],_0x80c952[_0x886d('0x4c')]));_0x5c6366['where']['MailAccountId']=_0x5ed89d['id'];if(_0x10de44[_0x886d('0x4a')][_0x886d('0x58')]){_0x5c6366[_0x886d('0x56')]=_[_0x886d('0x59')](_0x5c6366[_0x886d('0x56')],{'$or':_[_0x886d('0x45')](_0x5c6366[_0x886d('0x50')],function(_0x1bfffe){var _0x182818={};_0x182818[_0x1bfffe]={'$like':'%'+_0x10de44[_0x886d('0x4a')][_0x886d('0x58')]+'%'};return _0x182818;})});}_0x5c6366=_[_0x886d('0x59')]({},_0x5c6366,_0x10de44[_0x886d('0x5b')]);return db[_0x886d('0x8f')][_0x886d('0x2e')]({'where':_0x5c6366[_0x886d('0x56')]})[_0x886d('0x23')](function(_0x467ff7){_0x459534[_0x886d('0x2e')]=_0x467ff7;if(_0x10de44[_0x886d('0x4a')][_0x886d('0x5c')]){_0x5c6366['include']=[{'model':db[_0x886d('0x90')],'as':_0x886d('0x91'),'required':![]},{'model':db['User'],'as':_0x886d('0x92'),'attributes':[_0x886d('0x3c'),_0x886d('0x93'),_0x886d('0x94')],'required':![]},{'model':db[_0x886d('0x95')],'as':_0x886d('0x96'),'attributes':['id',_0x886d('0x3c'),'color'],'where':_0x10de44[_0x886d('0x4a')]['tag']?{'id':_0x10de44[_0x886d('0x4a')][_0x886d('0x97')]}:undefined,'required':_0x10de44[_0x886d('0x4a')][_0x886d('0x97')]?!![]:![]}];}return db['MailInteraction'][_0x886d('0x5d')](_0x5c6366);})['then'](function(_0x43ecc2){_0x459534[_0x886d('0x5e')]=_0x43ecc2;return _0x459534;});}})[_0x886d('0x23')](respondWithFilteredResult(_0x1bc25b,_0x5c6366))[_0x886d('0x5f')](handleError(_0x1bc25b,null));};exports['addApplications']=function(_0x10697f,_0x285729,_0x30e176){return db[_0x886d('0x46')][_0x886d('0x6f')]({'where':{'id':_0x10697f['params']['id']}})[_0x886d('0x23')](handleEntityNotFound(_0x285729,null))[_0x886d('0x23')](function(_0xc78db1){if(_0xc78db1){return db[_0x886d('0x98')][_0x886d('0x99')](function(_0x26449e){return db[_0x886d('0x9a')]['destroy']({'where':{'MailAccountId':_0x10697f[_0x886d('0x61')]['id']},'transaction':_0x26449e})[_0x886d('0x23')](function(_0x18d679){var _0x5ed1ea=_[_0x886d('0x45')](_0x10697f[_0x886d('0x64')],function(_0x5a163b){_0x5a163b[_0x886d('0x67')]=_0x10697f[_0x886d('0x61')]['id'];return _0x5a163b;});return db[_0x886d('0x9a')][_0x886d('0x9b')](_0x5ed1ea,{'transaction':_0x26449e});});})[_0x886d('0x23')](function(){return db['MailApplication'][_0x886d('0x9c')]({'where':{'MailAccountId':_0x10697f['params']['id']},'order':'priority'});});}})[_0x886d('0x23')](respondWithResult(_0x285729,null))[_0x886d('0x5f')](handleError(_0x285729,null));};exports[_0x886d('0x9d')]=function(_0x4caeb9,_0x116c02,_0x227642){var _0x38d621={};var _0xc8eb62={};var _0x2d176c;var _0x2d2d1c;return db[_0x886d('0x46')][_0x886d('0x6f')]({'where':{'id':_0x4caeb9[_0x886d('0x61')]['id']}})[_0x886d('0x23')](handleEntityNotFound(_0x116c02,null))[_0x886d('0x23')](function(_0xa18349){if(_0xa18349){_0x2d176c=_0xa18349;_0xc8eb62['model']=_[_0x886d('0x4b')](db['MailApplication'][_0x886d('0x62')]);_0xc8eb62[_0x886d('0x4a')]=_[_0x886d('0x4b')](_0x4caeb9['query']);_0xc8eb62['filters']=_[_0x886d('0x4d')](_0xc8eb62['model'],_0xc8eb62[_0x886d('0x4a')]);_0x38d621[_0x886d('0x50')]=_['intersection'](_0xc8eb62[_0x886d('0x4e')],qs[_0x886d('0x4f')](_0x4caeb9[_0x886d('0x4a')][_0x886d('0x4f')]));_0x38d621[_0x886d('0x50')]=_0x38d621[_0x886d('0x50')][_0x886d('0x51')]?_0x38d621['attributes']:_0xc8eb62[_0x886d('0x4e')];_0x38d621[_0x886d('0x54')]=qs[_0x886d('0x55')](_0x4caeb9[_0x886d('0x4a')][_0x886d('0x55')]);_0x38d621[_0x886d('0x56')]=qs[_0x886d('0x4c')](_['pick'](_0x4caeb9[_0x886d('0x4a')],_0xc8eb62[_0x886d('0x4c')]));if(_0x4caeb9[_0x886d('0x4a')][_0x886d('0x58')]){_0x38d621[_0x886d('0x56')]=_[_0x886d('0x59')](_0x38d621['where'],{'$or':_['map'](_0x38d621[_0x886d('0x50')],function(_0x5c5846){var _0x591961={};_0x591961[_0x5c5846]={'$like':'%'+_0x4caeb9[_0x886d('0x4a')]['filter']+'%'};return _0x591961;})});}_0x38d621=_[_0x886d('0x59')]({},_0x38d621,_0x4caeb9[_0x886d('0x5b')]);return _0x2d176c[_0x886d('0x9d')](_0x38d621);}})[_0x886d('0x23')](function(_0x416949){if(_0x416949){_0x2d2d1c=_0x416949[_0x886d('0x51')];if(!_0x4caeb9['query'][_0x886d('0x52')](_0x886d('0x53'))){_0x38d621['limit']=qs[_0x886d('0x30')](_0x4caeb9['query'][_0x886d('0x30')]);_0x38d621[_0x886d('0x2f')]=qs[_0x886d('0x2f')](_0x4caeb9[_0x886d('0x4a')]['offset']);}return _0x2d176c[_0x886d('0x9d')](_0x38d621);}})[_0x886d('0x23')](function(_0x1d3346){if(_0x1d3346){return _0x1d3346?{'count':_0x2d2d1c,'rows':_0x1d3346}:null;}})['then'](respondWithResult(_0x116c02,null))[_0x886d('0x5f')](handleError(_0x116c02,null));};exports['getMessages']=function(_0x181c02,_0x55db5a,_0x7c81e3){var _0x47effd={'raw':!![],'where':{}};var _0x375055={};var _0x59cae9={'count':0x0,'rows':[]};return db[_0x886d('0x46')][_0x886d('0x6f')]({'where':{'id':_0x181c02[_0x886d('0x61')]['id']}})['then'](handleEntityNotFound(_0x55db5a,null))[_0x886d('0x23')](function(_0x370669){if(_0x370669){_0x375055[_0x886d('0x4e')]=_[_0x886d('0x4b')](db['MailMessage']['rawAttributes']);_0x375055[_0x886d('0x4a')]=_['keys'](_0x181c02['query']);_0x375055[_0x886d('0x4c')]=_[_0x886d('0x4d')](_0x375055[_0x886d('0x4e')],_0x375055['query']);_0x47effd[_0x886d('0x50')]=_[_0x886d('0x4d')](_0x375055[_0x886d('0x4e')],qs[_0x886d('0x4f')](_0x181c02[_0x886d('0x4a')]['fields']));_0x47effd['attributes']=_0x47effd[_0x886d('0x50')][_0x886d('0x51')]?_0x47effd[_0x886d('0x50')]:_0x375055['model'];if(!_0x181c02['query'][_0x886d('0x52')](_0x886d('0x53'))){_0x47effd[_0x886d('0x30')]=qs['limit'](_0x181c02[_0x886d('0x4a')][_0x886d('0x30')]);_0x47effd[_0x886d('0x2f')]=qs['offset'](_0x181c02[_0x886d('0x4a')][_0x886d('0x2f')]);}_0x47effd[_0x886d('0x54')]=qs['sort'](_0x181c02['query'][_0x886d('0x55')]);_0x47effd['where']=qs[_0x886d('0x4c')](_['pick'](_0x181c02[_0x886d('0x4a')],_0x375055['filters']));_0x47effd[_0x886d('0x56')]['MailAccountId']=_0x370669['id'];if(_0x181c02['query'][_0x886d('0x58')]){_0x47effd[_0x886d('0x56')]=_['merge'](_0x47effd['where'],{'$or':_[_0x886d('0x45')](_0x47effd[_0x886d('0x50')],function(_0x1d7c92){var _0x21085c={};_0x21085c[_0x1d7c92]={'$like':'%'+_0x181c02[_0x886d('0x4a')][_0x886d('0x58')]+'%'};return _0x21085c;})});}if(_0x181c02[_0x886d('0x4a')]['$gte']){var _0x59f2fe=_0x181c02['query']['$gte']['split'](',');var _0x2ee2c4={};_0x2ee2c4[_0x59f2fe[0x0]]={'$gte':moment(_0x59f2fe[0x1])[_0x886d('0x9e')](_0x886d('0x9f'))};_0x47effd[_0x886d('0x56')]=_[_0x886d('0x59')](_0x47effd[_0x886d('0x56')],_0x2ee2c4);}_0x47effd=_[_0x886d('0x59')]({},_0x47effd,_0x181c02[_0x886d('0x5b')]);return db[_0x886d('0xa0')][_0x886d('0x2e')]({'where':_0x47effd['where']})[_0x886d('0x23')](function(_0x40406d){_0x59cae9['count']=_0x40406d;if(_0x181c02[_0x886d('0x4a')][_0x886d('0x5c')]){_0x47effd['include']=[{'all':!![]}];}return db[_0x886d('0xa0')][_0x886d('0x5d')](_0x47effd);})[_0x886d('0x23')](function(_0x3c2997){_0x59cae9[_0x886d('0x5e')]=_0x3c2997;return _0x59cae9;});}})[_0x886d('0x23')](respondWithFilteredResult(_0x55db5a,_0x47effd))[_0x886d('0x5f')](handleError(_0x55db5a,null));};exports[_0x886d('0x3d')]=function(_0x1953f7,_0x1a61f5,_0x317399){var _0x2aa64c,_0x12907d={},_0x4a9d65;if(_0x1953f7[_0x886d('0x64')]['to']){_0x4a9d65=_0x1953f7[_0x886d('0x64')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x886d('0x63')]({'where':{'id':_0x1953f7['params']['id']},'include':[{'model':db['CmList'],'as':_0x886d('0xa1'),'include':[{'model':db[_0x886d('0x90')],'as':_0x886d('0xa2'),'where':{'email':_0x4a9d65},'limit':0x1,'order':[[_0x886d('0xa3'),_0x886d('0xa4')]]}]},{'model':db[_0x886d('0x41')],'as':_0x886d('0x42'),'raw':!![]}]})[_0x886d('0x23')](handleEntityNotFound(_0x1a61f5,null))[_0x886d('0x23')](function(_0x1a6d0f){if(_0x1a6d0f){_0x2aa64c=_0x1a6d0f;if(_0x1a6d0f[_0x886d('0x42')]){if(_[_0x886d('0x74')](_0x1953f7[_0x886d('0x64')][_0x886d('0xa5')])){_0x1953f7[_0x886d('0x64')]['from']=util[_0x886d('0x9e')]('%s\x20<%s>',_0x1a6d0f[_0x886d('0x3c')],_0x1a6d0f[_0x886d('0x72')]||_0x1a6d0f[_0x886d('0x42')][_0x886d('0x78')]);}if(_0x1953f7[_0x886d('0x64')]['attachments']&&_0x1953f7[_0x886d('0x64')][_0x886d('0xa6')][_0x886d('0x51')]){for(var _0x5c8c70=0x0;_0x5c8c70<_0x1953f7[_0x886d('0x64')][_0x886d('0xa6')][_0x886d('0x51')];_0x5c8c70+=0x1){_0x1953f7[_0x886d('0x64')][_0x886d('0xa6')][_0x5c8c70]={'filename':_0x1953f7['body'][_0x886d('0xa6')][_0x5c8c70][_0x886d('0x3c')],'path':path[_0x886d('0xa7')](config[_0x886d('0xa8')],_0x886d('0xa9'),_0x1953f7[_0x886d('0x64')][_0x886d('0xa6')][_0x5c8c70][_0x886d('0xaa')])};}}var _0x35444c={'tls':{'rejectUnauthorized':![]}};if(_[_0x886d('0x74')](_0x1a6d0f[_0x886d('0x42')][_0x886d('0x80')])){if(_0x1a6d0f[_0x886d('0x42')][_0x886d('0x7d')]){_0x35444c['auth']={'user':_0x1a6d0f['Smtp']['user'],'pass':_0x1a6d0f['Smtp']['pass']};}_0x35444c[_0x886d('0x7e')]=_0x1a6d0f[_0x886d('0x42')][_0x886d('0x7e')];_0x35444c[_0x886d('0x7f')]=_0x1a6d0f[_0x886d('0x42')][_0x886d('0x7f')];_0x35444c[_0x886d('0xab')]=_0x1a6d0f[_0x886d('0x42')][_0x886d('0xab')];}else{_0x35444c['service']=_0x1a6d0f[_0x886d('0x42')][_0x886d('0x80')];_0x35444c['auth']={'user':_0x1a6d0f[_0x886d('0x42')][_0x886d('0x78')],'pass':_0x1a6d0f[_0x886d('0x42')][_0x886d('0x7b')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x35444c,'message':_0x1953f7['body']});}else{throw new Error(_0x886d('0xac'));}}})[_0x886d('0x23')](function(_0x2b2cab){if(_0x2b2cab){_0x12907d=_0x2b2cab;if(_0x2aa64c[_0x886d('0xa1')]){if(_0x2aa64c[_0x886d('0xa1')][_0x886d('0xa2')]['length']){return _0x2aa64c['List']['Contacts'][0x0];}else{return db[_0x886d('0x90')]['create'](_['defaults'](_0x1953f7[_0x886d('0x64')],{'firstName':_0x1953f7[_0x886d('0x64')]['to'],'email':_0x1953f7[_0x886d('0x64')]['to'],'phone':_0x1953f7[_0x886d('0x64')]['to'],'ListId':_0x2aa64c[_0x886d('0x73')]}));}}else{throw new Error(_0x886d('0xac'));}}})[_0x886d('0x23')](function(_0x38f4dc){if(_0x38f4dc){var _0x36aa47={'UserId':_0x1953f7[_0x886d('0x78')]['id'],'ContactId':_0x38f4dc['id'],'MailAccountId':_0x2aa64c['id'],'inReplyTo':_0x12907d['messageId'],'to':_0x1953f7[_0x886d('0x64')]['from'],'cc':_0x1953f7['body']['cc'],'subject':_0x1953f7[_0x886d('0x64')]['subject'],'attach':_0x1953f7[_0x886d('0x64')][_0x886d('0xad')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x886d('0x9f')),'lastMsgDirection':_0x886d('0xae'),'lastMsgBody':_0x1953f7[_0x886d('0x64')][_0x886d('0x64')],'Messages':[_[_0x886d('0x59')](_0x1953f7[_0x886d('0x64')],{'messageId':_0x12907d[_0x886d('0xaf')],'sentAt':moment()[_0x886d('0x9e')](_0x886d('0x9f')),'read':!![],'MailAccountId':_0x2aa64c['id'],'UserId':_0x1953f7[_0x886d('0x78')]['id'],'ContactId':_0x38f4dc['id']})]};if(_0x1953f7[_0x886d('0x64')]['Interaction']){_0x36aa47=_[_0x886d('0x59')](_0x36aa47,_0x1953f7[_0x886d('0x64')][_0x886d('0xb0')]);}return db[_0x886d('0x8f')][_0x886d('0x69')](_0x36aa47,{'include':[{'model':db['MailMessage'],'as':_0x886d('0xb1')}]});}})['then'](respondWithResult(_0x1a61f5,null))[_0x886d('0x5f')](handleError(_0x1a61f5,null));};exports[_0x886d('0xb2')]=function(_0x187782,_0x553c46,_0xecb7fc){return db[_0x886d('0x46')][_0x886d('0x63')]({'where':{'id':_0x187782[_0x886d('0x61')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x886d('0x42'),'raw':!![]}]})[_0x886d('0x23')](handleEntityNotFound(_0x553c46,null))[_0x886d('0x23')](function(_0x51c19c){if(_0x51c19c&&_0x51c19c[_0x886d('0x42')]){var _0x4a0e2e={'id':_0x51c19c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x51c19c['Smtp'][_0x886d('0x80')]){_0x4a0e2e[_0x886d('0x80')]=_0x51c19c[_0x886d('0x42')]['service'];}else{_0x4a0e2e[_0x886d('0x7e')]=_0x51c19c['Smtp'][_0x886d('0x7e')];_0x4a0e2e[_0x886d('0x7f')]=_0x51c19c['Smtp'][_0x886d('0x7f')];_0x4a0e2e[_0x886d('0xab')]=_0x51c19c[_0x886d('0x42')][_0x886d('0xab')];}if(_0x51c19c[_0x886d('0x42')][_0x886d('0x7d')]){_0x4a0e2e[_0x886d('0xb3')]={'user':_0x51c19c['Smtp'][_0x886d('0x78')],'pass':_0x51c19c['Smtp'][_0x886d('0x7b')]};}return respondWithRpcPromise(_0x886d('0xb4'),'verifySmtp',{'account':_0x4a0e2e});}})[_0x886d('0x23')](respondWithResult(_0x553c46,null))['catch'](handleError(_0x553c46,null));};exports['destroy']=function(_0x26e72d,_0x45b5db){return db['MailAccount'][_0x886d('0x63')]({'where':{'id':_0x26e72d[_0x886d('0x61')]['id']}})[_0x886d('0x23')](handleEntityNotFound(_0x45b5db,null))[_0x886d('0x23')](function(_0x38ed32){if(_0x38ed32&&_0x38ed32[_0x886d('0x80')]){throw new db[(_0x886d('0xb5'))][(_0x886d('0xb6'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x38ed32;})[_0x886d('0x23')](removeEntity(_0x45b5db,null))[_0x886d('0x5f')](handleError(_0x45b5db,null));};exports['addAgents']=function(_0x292cb0,_0x4e0621,_0x5f26c7){return db[_0x886d('0x46')]['find']({'where':{'id':_0x292cb0[_0x886d('0x61')]['id']}})[_0x886d('0x23')](handleEntityNotFound(_0x4e0621,null))['then'](function(_0x178f9b){if(_0x178f9b){return _0x178f9b['addAgents'](_0x292cb0[_0x886d('0x64')][_0x886d('0x6c')],_[_0x886d('0xb7')](_0x292cb0[_0x886d('0x64')],[_0x886d('0x6c'),'id'])||{})[_0x886d('0xb8')](function(_0x532fbb){for(var _0x4bd468=0x0;_0x4bd468<_0x292cb0[_0x886d('0x64')][_0x886d('0x6c')]['length'];_0x4bd468+=0x1){socket[_0x886d('0xb9')]('userMailAccount:save',{'UserId':_0x292cb0[_0x886d('0x64')][_0x886d('0x6c')][_0x4bd468],'MailAccountId':_0x292cb0[_0x886d('0x61')]['id']});}return _0x532fbb;});}})['then'](respondWithResult(_0x4e0621,null))[_0x886d('0x5f')](handleError(_0x4e0621,null));};exports[_0x886d('0xba')]=function(_0x31eb67,_0x3071e8,_0x154111){return db[_0x886d('0x46')][_0x886d('0x63')]({'where':{'id':_0x31eb67['params']['id']}})[_0x886d('0x23')](handleEntityNotFound(_0x3071e8,null))['then'](function(_0x199050){if(_0x199050){return _0x199050[_0x886d('0xba')](_0x31eb67[_0x886d('0x4a')][_0x886d('0x6c')])[_0x886d('0x23')](function(){if(_[_0x886d('0xbb')](_0x31eb67['query'][_0x886d('0x6c')])){for(var _0x2fe0ca=0x0;_0x2fe0ca<_0x31eb67[_0x886d('0x4a')][_0x886d('0x6c')][_0x886d('0x51')];_0x2fe0ca+=0x1){socket[_0x886d('0xb9')]('userMailAccount:remove',{'UserId':Number(_0x31eb67[_0x886d('0x4a')]['ids'][_0x2fe0ca]),'MailAccountId':Number(_0x31eb67[_0x886d('0x61')]['id'])});}}else{socket[_0x886d('0xb9')](_0x886d('0xbc'),{'UserId':Number(_0x31eb67[_0x886d('0x4a')][_0x886d('0x6c')]),'MailAccountId':Number(_0x31eb67[_0x886d('0x61')]['id'])});}});}})[_0x886d('0x23')](respondWithStatusCode(_0x3071e8,null))[_0x886d('0x5f')](handleError(_0x3071e8,null));};exports[_0x886d('0xbd')]=function(_0x4fbcc9,_0x41ecf6,_0x29921f){var _0x159264={};var _0x39e783={};var _0x32ecf1;var _0xd82c;return db['MailAccount'][_0x886d('0x6f')]({'where':{'id':_0x4fbcc9[_0x886d('0x61')]['id']}})[_0x886d('0x23')](handleEntityNotFound(_0x41ecf6,null))['then'](function(_0x32d82a){if(_0x32d82a){_0x32ecf1=_0x32d82a;_0x39e783[_0x886d('0x4e')]=_[_0x886d('0x4b')](db[_0x886d('0xbe')][_0x886d('0x62')]);_0x39e783['query']=_[_0x886d('0x4b')](_0x4fbcc9[_0x886d('0x4a')]);_0x39e783[_0x886d('0x4c')]=_['intersection'](_0x39e783['model'],_0x39e783['query']);_0x159264['attributes']=_[_0x886d('0x4d')](_0x39e783[_0x886d('0x4e')],qs['fields'](_0x4fbcc9[_0x886d('0x4a')][_0x886d('0x4f')]));_0x159264['attributes']=_0x159264[_0x886d('0x50')][_0x886d('0x51')]?_0x159264['attributes']:_0x39e783[_0x886d('0x4e')];_0x159264[_0x886d('0x54')]=qs['sort'](_0x4fbcc9['query'][_0x886d('0x55')]);_0x159264[_0x886d('0x56')]=qs[_0x886d('0x4c')](_[_0x886d('0x57')](_0x4fbcc9[_0x886d('0x4a')],_0x39e783[_0x886d('0x4c')]));if(_0x4fbcc9[_0x886d('0x4a')][_0x886d('0x58')]){_0x159264[_0x886d('0x56')]=_['merge'](_0x159264['where'],{'$or':_[_0x886d('0x45')](_0x159264[_0x886d('0x50')],function(_0x4d0ce3){var _0x29231f={};_0x29231f[_0x4d0ce3]={'$like':'%'+_0x4fbcc9[_0x886d('0x4a')]['filter']+'%'};return _0x29231f;})});}_0x159264=_[_0x886d('0x59')]({},_0x159264,_0x4fbcc9[_0x886d('0x5b')]);return _0x32ecf1[_0x886d('0xbd')](_0x159264);}})[_0x886d('0x23')](function(_0x1fee22){if(_0x1fee22){_0xd82c=_0x1fee22[_0x886d('0x51')];if(!_0x4fbcc9[_0x886d('0x4a')][_0x886d('0x52')](_0x886d('0x53'))){_0x159264[_0x886d('0x30')]=qs['limit'](_0x4fbcc9[_0x886d('0x4a')]['limit']);_0x159264[_0x886d('0x2f')]=qs[_0x886d('0x2f')](_0x4fbcc9[_0x886d('0x4a')][_0x886d('0x2f')]);}return _0x32ecf1['getAgents'](_0x159264);}})[_0x886d('0x23')](function(_0x3086ce){if(_0x3086ce){return _0x3086ce?{'count':_0xd82c,'rows':_0x3086ce}:null;}})['then'](respondWithResult(_0x41ecf6,null))[_0x886d('0x5f')](handleError(_0x41ecf6,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 37d9a85..ac7d170 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 _0xf896=['events','MailAccount','setMaxListeners','update','remove','emit'];(function(_0x58d8c3,_0x4fad0c){var _0x2fc3d5=function(_0x40e22e){while(--_0x40e22e){_0x58d8c3['push'](_0x58d8c3['shift']());}};_0x2fc3d5(++_0x4fad0c);}(_0xf896,0x186));var _0x6f89=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0xf896[_0x1ad926];return _0x1b81dc;};'use strict';var EventEmitter=require(_0x6f89('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x6f89('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6f89('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6f89('0x3'),'afterDestroy':_0x6f89('0x4')};function emitEvent(_0x1b26bd){return function(_0xb498d4,_0xc1328b,_0x3fa41a){MailAccountEvents[_0x6f89('0x5')](_0x1b26bd+':'+_0xb498d4['id'],_0xb498d4);MailAccountEvents[_0x6f89('0x5')](_0x1b26bd,_0xb498d4);_0x3fa41a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x2ec4=['hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','update','remove','emit'];(function(_0x409682,_0x370090){var _0x1ee901=function(_0xe93c56){while(--_0xe93c56){_0x409682['push'](_0x409682['shift']());}};_0x1ee901(++_0x370090);}(_0x2ec4,0x157));var _0x42ec=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2ec4[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x42ec('0x0'));var MailAccount=require(_0x42ec('0x1'))['db'][_0x42ec('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x42ec('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x42ec('0x4'),'afterDestroy':_0x42ec('0x5')};function emitEvent(_0x2f4ff6){return function(_0x1c094f,_0xdfc682,_0x27abcc){MailAccountEvents[_0x42ec('0x6')](_0x2f4ff6+':'+_0x1c094f['id'],_0x1c094f);MailAccountEvents[_0x42ec('0x6')](_0x2f4ff6,_0x1c094f);_0x27abcc(null);};}for(var e in events){if(events[_0x42ec('0x7')](e)){var event=events[e];MailAccount[_0x42ec('0x8')](e,emitEvent(event));}}module[_0x42ec('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 58b7c4a..b5d9aee 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 _0x4dcb=['util','moment','bluebird','request-promise','path','rimraf','exports','MailAccount','mail_accounts','lodash'];(function(_0x5f4769,_0x5510f4){var _0x3925bf=function(_0x349ac5){while(--_0x349ac5){_0x5f4769['push'](_0x5f4769['shift']());}};_0x3925bf(++_0x5510f4);}(_0x4dcb,0x153));var _0xb4dc=function(_0x4ffe5a,_0x4dc8ec){_0x4ffe5a=_0x4ffe5a-0x0;var _0x23a297=_0x4dcb[_0x4ffe5a];return _0x23a297;};'use strict';var _=require(_0xb4dc('0x0'));var util=require(_0xb4dc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb4dc('0x2'));var BPromise=require(_0xb4dc('0x3'));var rp=require(_0xb4dc('0x4'));var fs=require('fs');var path=require(_0xb4dc('0x5'));var rimraf=require(_0xb4dc('0x6'));var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module[_0xb4dc('0x7')]=function(_0x493ce7,_0x38f8bc){return _0x493ce7['define'](_0xb4dc('0x8'),attributes,{'tableName':_0xb4dc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20ca=['lodash','util','../../config/logger','api','bluebird','path','rimraf','./mailAccount.attributes','define','mail_accounts'];(function(_0x194f33,_0x2b1830){var _0x8e3cb0=function(_0x9f265a){while(--_0x9f265a){_0x194f33['push'](_0x194f33['shift']());}};_0x8e3cb0(++_0x2b1830);}(_0x20ca,0x15e));var _0xa20c=function(_0x23816b,_0x1b12a1){_0x23816b=_0x23816b-0x0;var _0x12beed=_0x20ca[_0x23816b];return _0x12beed;};'use strict';var _=require(_0xa20c('0x0'));var util=require(_0xa20c('0x1'));var logger=require(_0xa20c('0x2'))(_0xa20c('0x3'));var moment=require('moment');var BPromise=require(_0xa20c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa20c('0x5'));var rimraf=require(_0xa20c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa20c('0x7'));module['exports']=function(_0x2ed471,_0x37eebc){return _0x2ed471[_0xa20c('0x8')]('MailAccount',attributes,{'tableName':_0xa20c('0x9'),'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 6908eb1..5eeaeb1 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 _0x4d6e=['Contact\x20not\x20found','spread','format','interaction','MailMessage','attachments','originTo','bcc','Attachment','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','then','debug','ShowMailAccount','stringify','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','orderBy','asc','autoclose','length','*,*,*,*','ListId','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo'];(function(_0x14743f,_0xbd44a5){var _0x5aa889=function(_0x47d613){while(--_0x47d613){_0x14743f['push'](_0x14743f['shift']());}};_0x5aa889(++_0xbd44a5);}(_0x4d6e,0x77));var _0xe4d6=function(_0x2e3210,_0x555b54){_0x2e3210=_0x2e3210-0x0;var _0x399fad=_0x4d6e[_0x2e3210];return _0x399fad;};'use strict';var _=require(_0xe4d6('0x0'));var util=require(_0xe4d6('0x1'));var moment=require(_0xe4d6('0x2'));var BPromise=require(_0xe4d6('0x3'));var rs=require(_0xe4d6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4d6('0x5'))['db'];var utils=require(_0xe4d6('0x6'));var logger=require(_0xe4d6('0x7'))(_0xe4d6('0x8'));var config=require(_0xe4d6('0x9'));var jayson=require(_0xe4d6('0xa'));var client=jayson[_0xe4d6('0xb')][_0xe4d6('0xc')]({'port':0x232c});config[_0xe4d6('0xd')]=_[_0xe4d6('0xe')](config[_0xe4d6('0xd')],{'host':_0xe4d6('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe4d6('0xd')]));require(_0xe4d6('0x10'))['register'](socket);function respondWithRpcPromise(_0x1cca29,_0x162a11,_0x782aa6){return new BPromise(function(_0xb27ad4,_0x2fb743){return client[_0xe4d6('0x11')](_0x1cca29,_0x782aa6)['then'](function(_0x4ca8b5){logger[_0xe4d6('0x12')](_0xe4d6('0x13'),_0x162a11,_0xe4d6('0x14'));logger['debug'](_0xe4d6('0x15'),_0x162a11,_0xe4d6('0x14'),JSON['stringify'](_0x4ca8b5));if(_0x4ca8b5[_0xe4d6('0x16')]){if(_0x4ca8b5[_0xe4d6('0x16')]['code']===0x1f4){logger[_0xe4d6('0x16')](_0xe4d6('0x13'),_0x162a11,_0x4ca8b5[_0xe4d6('0x16')][_0xe4d6('0x17')]);return _0x2fb743(_0x4ca8b5['error'][_0xe4d6('0x17')]);}logger[_0xe4d6('0x16')](_0xe4d6('0x13'),_0x162a11,_0x4ca8b5[_0xe4d6('0x16')]['message']);return _0xb27ad4(_0x4ca8b5[_0xe4d6('0x16')]['message']);}else{logger['info'](_0xe4d6('0x13'),_0x162a11,_0xe4d6('0x14'));_0xb27ad4(_0x4ca8b5[_0xe4d6('0x18')][_0xe4d6('0x17')]);}})[_0xe4d6('0x19')](function(_0x47e4bb){logger[_0xe4d6('0x16')](_0xe4d6('0x13'),_0x162a11,_0x47e4bb);_0x2fb743(_0x47e4bb);});});}exports[_0xe4d6('0x1a')]=function(_0x34f6bd){var _0x3895ed=this;return new Promise(function(_0x2fbefc,_0x26b9b6){return db[_0xe4d6('0x1b')]['findAll']({'raw':_0x34f6bd[_0xe4d6('0x1c')]?_0x34f6bd['options'][_0xe4d6('0x1d')]===undefined?!![]:![]:!![],'where':_0x34f6bd[_0xe4d6('0x1c')]?_0x34f6bd[_0xe4d6('0x1c')][_0xe4d6('0x1e')]||null:null,'attributes':_0x34f6bd[_0xe4d6('0x1c')]?_0x34f6bd[_0xe4d6('0x1c')][_0xe4d6('0x1f')]||null:null,'limit':_0x34f6bd[_0xe4d6('0x1c')]?_0x34f6bd['options'][_0xe4d6('0x20')]||null:null,'include':_0x34f6bd[_0xe4d6('0x1c')]?_0x34f6bd['options'][_0xe4d6('0x21')]?_[_0xe4d6('0x22')](_0x34f6bd[_0xe4d6('0x1c')][_0xe4d6('0x21')],function(_0x13aeec){return{'model':db[_0x13aeec[_0xe4d6('0x23')]],'as':_0x13aeec['as'],'attributes':_0x13aeec[_0xe4d6('0x1f')],'include':_0x13aeec[_0xe4d6('0x21')]?_['map'](_0x13aeec[_0xe4d6('0x21')],function(_0x152d16){return{'model':db[_0x152d16['model']],'as':_0x152d16['as'],'attributes':_0x152d16['attributes'],'include':_0x152d16['include']?_[_0xe4d6('0x22')](_0x152d16['include'],function(_0x3d2efe){return{'model':db[_0x3d2efe['model']],'as':_0x3d2efe['as'],'attributes':_0x3d2efe['attributes']};}):[]};}):[]};}):[]:[]})[_0xe4d6('0x24')](function(_0x4e45f0){logger['info'](_0xe4d6('0x1a'),_0x34f6bd);logger[_0xe4d6('0x25')]('GetMailAccount',_0x34f6bd,JSON['stringify'](_0x4e45f0));_0x2fbefc(_0x4e45f0);})[_0xe4d6('0x19')](function(_0x4077c1){logger['error'](_0xe4d6('0x1a'),_0x4077c1[_0xe4d6('0x17')],_0x34f6bd);_0x26b9b6(_0x3895ed[_0xe4d6('0x16')](0x1f4,_0x4077c1[_0xe4d6('0x17')]));});});};exports[_0xe4d6('0x26')]=function(_0x17e467){var _0x48cf65=this;return new Promise(function(_0x562070,_0x9b089b){return db[_0xe4d6('0x1b')]['find']({'raw':_0x17e467[_0xe4d6('0x1c')]?_0x17e467['options'][_0xe4d6('0x1d')]===undefined?!![]:![]:!![],'where':_0x17e467['options']?_0x17e467['options'][_0xe4d6('0x1e')]||null:null,'attributes':_0x17e467['options']?_0x17e467['options'][_0xe4d6('0x1f')]||null:null,'include':_0x17e467[_0xe4d6('0x1c')]?_0x17e467[_0xe4d6('0x1c')][_0xe4d6('0x21')]?_['map'](_0x17e467[_0xe4d6('0x1c')][_0xe4d6('0x21')],function(_0x822a27){return{'model':db[_0x822a27[_0xe4d6('0x23')]],'as':_0x822a27['as'],'attributes':_0x822a27[_0xe4d6('0x1f')],'include':_0x822a27[_0xe4d6('0x21')]?_[_0xe4d6('0x22')](_0x822a27[_0xe4d6('0x21')],function(_0x28e423){return{'model':db[_0x28e423[_0xe4d6('0x23')]],'as':_0x28e423['as'],'attributes':_0x28e423['attributes'],'include':_0x28e423[_0xe4d6('0x21')]?_['map'](_0x28e423[_0xe4d6('0x21')],function(_0x36c147){return{'model':db[_0x36c147[_0xe4d6('0x23')]],'as':_0x36c147['as'],'attributes':_0x36c147[_0xe4d6('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x483121){logger[_0xe4d6('0x12')](_0xe4d6('0x26'),_0x17e467);logger[_0xe4d6('0x25')](_0xe4d6('0x26'),_0x17e467,JSON[_0xe4d6('0x27')](_0x483121));_0x562070(_0x483121);})[_0xe4d6('0x19')](function(_0x2c57c2){logger['error'](_0xe4d6('0x26'),_0x2c57c2[_0xe4d6('0x17')],_0x17e467);_0x9b089b(_0x48cf65['error'](0x1f4,_0x2c57c2['message']));});});};exports[_0xe4d6('0x28')]=function(_0x1b8c4b){var _0x4950cf=this;return new Promise(function(_0x1a577f,_0x35054f){var _0x310419={'body':_0x1b8c4b[_0xe4d6('0x29')],'channel':'mail'};var _0x3c0f11=_[_0xe4d6('0x2a')](_[_0xe4d6('0x2b')](db[_0xe4d6('0x2c')][_0xe4d6('0x2d')]),[_0xe4d6('0x2e'),'updatedAt','CompanyId','ListId']);var _0x551789=![];if(_0x1b8c4b[_0xe4d6('0x29')]['id']){delete _0x1b8c4b[_0xe4d6('0x29')]['id'];}if(_[_0xe4d6('0x2f')](_0x1b8c4b['body'][_0xe4d6('0x30')])){return _0x35054f(_0x4950cf['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xe4d6('0x2f')](_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x29')])||_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x29')]===''){return _0x35054f(_0x4950cf[_0xe4d6('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xe4d6('0x2f')](_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x31')])){return _0x35054f(_0x4950cf[_0xe4d6('0x16')](0x1f4,_0xe4d6('0x32')+_0x3c0f11));}if(!_[_0xe4d6('0x33')](_0x3c0f11,_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x31')])){return _0x35054f(_0x4950cf['error'](0x1f4,_0xe4d6('0x34')+_0x3c0f11));}var _0x38ceca={};_0x38ceca[_0x1b8c4b[_0xe4d6('0x29')]['mapKey']]=_0x1b8c4b['body'][_0xe4d6('0x30')];return db[_0xe4d6('0x1b')][_0xe4d6('0x35')]({'where':{'id':_0x1b8c4b[_0xe4d6('0x36')]['id']},'include':[{'model':db[_0xe4d6('0x37')],'as':_0xe4d6('0x38'),'include':[{'model':db[_0xe4d6('0x2c')],'as':_0xe4d6('0x39'),'where':_0x38ceca,'limit':0x1,'order':[[_0xe4d6('0x3a'),_0xe4d6('0x3b')]]}]},{'model':db[_0xe4d6('0x3c')],'as':_0xe4d6('0x3d')},{'model':db[_0xe4d6('0x3e')],'as':_0xe4d6('0x3f')}]})[_0xe4d6('0x24')](function(_0x179eec){if(_0x179eec&&_0x179eec['List']){var _0x1bbd16=_0x179eec[_0xe4d6('0x40')]({'plain':!![]});_0x310419['account']=_[_0xe4d6('0x41')](_0x1bbd16,['Applications',_0xe4d6('0x38')]);_0x310419[_0xe4d6('0x42')]=_0x1bbd16['Applications'];_0x310419[_0xe4d6('0x43')]=_0x1bbd16['List'];_0x310419['applications']=_[_0xe4d6('0x44')](_0x310419[_0xe4d6('0x42')],['priority'],[_0xe4d6('0x45')]);if(_0x310419[_0xe4d6('0x36')]&&_0x310419[_0xe4d6('0x36')][_0xe4d6('0x46')]){_0x310419[_0xe4d6('0x42')]['push']({'id':0x0,'priority':_0x310419[_0xe4d6('0x42')][_0xe4d6('0x47')]+0x1,'app':'close','appdata':'autoclose','interval':_0xe4d6('0x48')});}if(_0x310419[_0xe4d6('0x36')][_0xe4d6('0x3d')]){delete _0x310419['account'][_0xe4d6('0x3d')];}if(_0x310419[_0xe4d6('0x36')][_0xe4d6('0x38')]){delete _0x310419[_0xe4d6('0x36')][_0xe4d6('0x38')];}if(_0x1bbd16['List'][_0xe4d6('0x39')][_0xe4d6('0x47')]){return _0x1bbd16[_0xe4d6('0x38')][_0xe4d6('0x39')][0x0];}var _0x38a427=_['defaults'](_0x1b8c4b[_0xe4d6('0x29')],{'firstName':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x30')],'ListId':_0x1bbd16[_0xe4d6('0x49')]});_0x38a427[_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x31')]]=_0x1b8c4b['body'][_0xe4d6('0x30')];return db[_0xe4d6('0x2c')][_0xe4d6('0x4a')](_0x38a427);}else{throw new Error(_0xe4d6('0x4b'));}})[_0xe4d6('0x24')](function(_0x34731b){_0x310419[_0xe4d6('0x4c')]=_0x34731b;if(_0x34731b){if(!_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x4d')]){_0x1b8c4b[_0xe4d6('0x29')]['message'][_0xe4d6('0x4d')]=rs[_0xe4d6('0x4e')]()+'\x20'+_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x30')];}var _0x7596e8={'ContactId':_0x34731b['id'],'MailAccountId':_0x1b8c4b['account']['id'],'inReplyTo':_0x1b8c4b['body'][_0xe4d6('0x17')][_0xe4d6('0x4d')],'to':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')]['from'],'cc':_0x1b8c4b['body'][_0xe4d6('0x17')]['cc'],'subject':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x4f')],'attach':_0x1b8c4b['body'][_0xe4d6('0x17')][_0xe4d6('0x50')],'lastMsgAt':moment()['format'](_0xe4d6('0x51')),'lastMsgDirection':'in','lastMsgBody':_0x1b8c4b['body'][_0xe4d6('0x29')]};return db[_0xe4d6('0x52')]['find']({'where':{'closed':![],'MailAccountId':_0x1b8c4b[_0xe4d6('0x36')]['id']},'include':[{'model':db['MailMessage'],'as':_0xe4d6('0x53'),'attributes':[_0xe4d6('0x4d')],'where':{'messageId':_0x1b8c4b['body'][_0xe4d6('0x17')][_0xe4d6('0x54')]}}]})[_0xe4d6('0x24')](function(_0x49df65){if(_0x49df65){return[_0x49df65,![]];}return db['MailInteraction']['create'](_0x7596e8)[_0xe4d6('0x24')](function(_0x40d488){return[_0x40d488,!![]];});});}else{throw new Error(_0xe4d6('0x55'));}})[_0xe4d6('0x56')](function(_0xe54334,_0x2f3c19){if(_0xe54334){_0x551789=_0x2f3c19;if(!_0x2f3c19){return _0xe54334['update']({'inReplyTo':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x4d')],'to':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x30')],'cc':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')]['cc'],'subject':_0x1b8c4b[_0xe4d6('0x29')]['message']['subject'],'attach':_0xe54334[_0xe4d6('0x50')]?_0xe54334[_0xe4d6('0x50')]:_0x1b8c4b['body']['message'][_0xe4d6('0x50')],'substatus':null,'substatusAt':moment()[_0xe4d6('0x57')](_0xe4d6('0x51')),'lastMsgAt':moment()[_0xe4d6('0x57')](_0xe4d6('0x51')),'lastMsgDirection':'in','lastMsgBody':_0x1b8c4b['body'][_0xe4d6('0x29')]});}else{return _0xe54334;}}})[_0xe4d6('0x24')](function(_0x349b56){_0x310419[_0xe4d6('0x58')]=_0x349b56[_0xe4d6('0x40')]({'plain':!![]});_0x310419[_0xe4d6('0x58')]['created']=_0x551789;return db[_0xe4d6('0x59')]['create']({'body':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x29')],'MailAccountId':_0x1b8c4b[_0xe4d6('0x36')]['id'],'MailInteractionId':_0x349b56['id'],'direction':'in','ContactId':_0x310419[_0xe4d6('0x4c')]['id'],'messageId':_0x1b8c4b['body'][_0xe4d6('0x17')][_0xe4d6('0x4d')],'from':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')]['from'],'to':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')]['to'],'cc':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')]['cc'],'subject':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x4f')],'attach':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x50')],'Attachments':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x5a')],'originTo':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x5b')],'originCc':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')]['originCc'],'bcc':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x5c')]},{'include':[{'model':db[_0xe4d6('0x5d')],'as':'Attachments'}]});})[_0xe4d6('0x24')](function(_0x36a77f){_0x310419[_0xe4d6('0x17')]=_0x36a77f;if(_0x310419['interaction']['UserId']){return db[_0xe4d6('0x5e')]['find']({'attributes':['id',_0xe4d6('0x5f')],'where':{'id':_0x310419[_0xe4d6('0x58')][_0xe4d6('0x60')]}})['then'](function(_0x2357ba){if(_0x2357ba){_0x310419[_0xe4d6('0x42')][_0xe4d6('0x61')]({'id':0x0,'priority':0x0,'app':_0xe4d6('0x62'),'appdata':_0x2357ba[_0xe4d6('0x5f')]+','+(_0x310419[_0xe4d6('0x36')][_0xe4d6('0x63')]||0xa),'interval':_0xe4d6('0x48')});}return respondWithRpcPromise(_0xe4d6('0x64'),_0xe4d6('0x65'),_0x310419);});}return respondWithRpcPromise(_0xe4d6('0x64'),'startRouting',_0x310419);})[_0xe4d6('0x24')](function(_0x52686a){_0x1a577f(_0x52686a);})[_0xe4d6('0x19')](function(_0x5dfb3b){_0x35054f(_0x4950cf[_0xe4d6('0x16')](0x1f4,_0x5dfb3b[_0xe4d6('0x17')]));});});}; \ No newline at end of file +var _0x0506=['MailMessage','originTo','originCc','bcc','Attachment','UserId','User','name','agent','startRouting','lodash','util','moment','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetMailAccount','debug','find','ShowMailAccount','body','mail','CmContact','rawAttributes','updatedAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Applications','MailServerOut','Smtp','get','account','applications','list','orderBy','autoclose','push','length','close','Contacts','create','List\x20not\x20found','contact','generate','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','interaction','created'];(function(_0x35805a,_0x25f3f2){var _0x48b5c4=function(_0x4bb7da){while(--_0x4bb7da){_0x35805a['push'](_0x35805a['shift']());}};_0x48b5c4(++_0x25f3f2);}(_0x0506,0x1d1));var _0x6050=function(_0x40c471,_0x5ec07a){_0x40c471=_0x40c471-0x0;var _0x58e663=_0x0506[_0x40c471];return _0x58e663;};'use strict';var _=require(_0x6050('0x0'));var util=require(_0x6050('0x1'));var moment=require(_0x6050('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6050('0x3'));var logger=require('../../config/logger')(_0x6050('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6050('0x5')][_0x6050('0x6')]({'port':0x232c});config[_0x6050('0x7')]=_[_0x6050('0x8')](config[_0x6050('0x7')],{'host':_0x6050('0x9'),'port':0x18eb});var socket=require(_0x6050('0xa'))(new Redis(config[_0x6050('0x7')]));require('./mailAccount.socket')[_0x6050('0xb')](socket);function respondWithRpcPromise(_0x4f149a,_0x15ad99,_0x1b0140){return new BPromise(function(_0xd01ae7,_0x24f726){return client[_0x6050('0xc')](_0x4f149a,_0x1b0140)[_0x6050('0xd')](function(_0x105915){logger[_0x6050('0xe')](_0x6050('0xf'),_0x15ad99,_0x6050('0x10'));logger['debug'](_0x6050('0x11'),_0x15ad99,'request\x20sent',JSON[_0x6050('0x12')](_0x105915));if(_0x105915[_0x6050('0x13')]){if(_0x105915[_0x6050('0x13')][_0x6050('0x14')]===0x1f4){logger['error'](_0x6050('0xf'),_0x15ad99,_0x105915['error'][_0x6050('0x15')]);return _0x24f726(_0x105915[_0x6050('0x13')][_0x6050('0x15')]);}logger[_0x6050('0x13')](_0x6050('0xf'),_0x15ad99,_0x105915[_0x6050('0x13')][_0x6050('0x15')]);return _0xd01ae7(_0x105915[_0x6050('0x13')][_0x6050('0x15')]);}else{logger[_0x6050('0xe')](_0x6050('0xf'),_0x15ad99,_0x6050('0x10'));_0xd01ae7(_0x105915['result'][_0x6050('0x15')]);}})[_0x6050('0x16')](function(_0x44e65d){logger['error']('MailAccount,\x20%s,\x20%s',_0x15ad99,_0x44e65d);_0x24f726(_0x44e65d);});});}exports['GetMailAccount']=function(_0x521916){var _0x3c7c33=this;return new Promise(function(_0x259e5f,_0x4c0270){return db[_0x6050('0x17')][_0x6050('0x18')]({'raw':_0x521916[_0x6050('0x19')]?_0x521916[_0x6050('0x19')][_0x6050('0x1a')]===undefined?!![]:![]:!![],'where':_0x521916[_0x6050('0x19')]?_0x521916['options'][_0x6050('0x1b')]||null:null,'attributes':_0x521916[_0x6050('0x19')]?_0x521916[_0x6050('0x19')][_0x6050('0x1c')]||null:null,'limit':_0x521916[_0x6050('0x19')]?_0x521916[_0x6050('0x19')][_0x6050('0x1d')]||null:null,'include':_0x521916[_0x6050('0x19')]?_0x521916['options'][_0x6050('0x1e')]?_['map'](_0x521916[_0x6050('0x19')][_0x6050('0x1e')],function(_0xd6c11d){return{'model':db[_0xd6c11d[_0x6050('0x1f')]],'as':_0xd6c11d['as'],'attributes':_0xd6c11d[_0x6050('0x1c')],'include':_0xd6c11d[_0x6050('0x1e')]?_['map'](_0xd6c11d[_0x6050('0x1e')],function(_0x436d39){return{'model':db[_0x436d39[_0x6050('0x1f')]],'as':_0x436d39['as'],'attributes':_0x436d39[_0x6050('0x1c')],'include':_0x436d39['include']?_[_0x6050('0x20')](_0x436d39[_0x6050('0x1e')],function(_0x1698fa){return{'model':db[_0x1698fa[_0x6050('0x1f')]],'as':_0x1698fa['as'],'attributes':_0x1698fa[_0x6050('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6050('0xd')](function(_0x1c1bd0){logger['info'](_0x6050('0x21'),_0x521916);logger[_0x6050('0x22')](_0x6050('0x21'),_0x521916,JSON[_0x6050('0x12')](_0x1c1bd0));_0x259e5f(_0x1c1bd0);})[_0x6050('0x16')](function(_0x182137){logger[_0x6050('0x13')](_0x6050('0x21'),_0x182137[_0x6050('0x15')],_0x521916);_0x4c0270(_0x3c7c33['error'](0x1f4,_0x182137[_0x6050('0x15')]));});});};exports['ShowMailAccount']=function(_0x5542fa){var _0x31fd3b=this;return new Promise(function(_0x2a38a9,_0x1442f2){return db['MailAccount'][_0x6050('0x23')]({'raw':_0x5542fa['options']?_0x5542fa['options'][_0x6050('0x1a')]===undefined?!![]:![]:!![],'where':_0x5542fa[_0x6050('0x19')]?_0x5542fa['options']['where']||null:null,'attributes':_0x5542fa[_0x6050('0x19')]?_0x5542fa[_0x6050('0x19')]['attributes']||null:null,'include':_0x5542fa[_0x6050('0x19')]?_0x5542fa[_0x6050('0x19')][_0x6050('0x1e')]?_[_0x6050('0x20')](_0x5542fa['options'][_0x6050('0x1e')],function(_0x511c31){return{'model':db[_0x511c31[_0x6050('0x1f')]],'as':_0x511c31['as'],'attributes':_0x511c31['attributes'],'include':_0x511c31[_0x6050('0x1e')]?_[_0x6050('0x20')](_0x511c31[_0x6050('0x1e')],function(_0x50f014){return{'model':db[_0x50f014[_0x6050('0x1f')]],'as':_0x50f014['as'],'attributes':_0x50f014['attributes'],'include':_0x50f014[_0x6050('0x1e')]?_['map'](_0x50f014[_0x6050('0x1e')],function(_0x56aab2){return{'model':db[_0x56aab2[_0x6050('0x1f')]],'as':_0x56aab2['as'],'attributes':_0x56aab2[_0x6050('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36fb0b){logger[_0x6050('0xe')]('ShowMailAccount',_0x5542fa);logger[_0x6050('0x22')](_0x6050('0x24'),_0x5542fa,JSON[_0x6050('0x12')](_0x36fb0b));_0x2a38a9(_0x36fb0b);})['catch'](function(_0x250720){logger[_0x6050('0x13')](_0x6050('0x24'),_0x250720['message'],_0x5542fa);_0x1442f2(_0x31fd3b[_0x6050('0x13')](0x1f4,_0x250720[_0x6050('0x15')]));});});};exports['NotifyMailAccount']=function(_0x554e3f){var _0x3a36ed=this;return new Promise(function(_0xb53d7c,_0x2e9aed){var _0x39b10d={'body':_0x554e3f[_0x6050('0x25')],'channel':_0x6050('0x26')};var _0xec0238=_['difference'](_['keys'](db[_0x6050('0x27')][_0x6050('0x28')]),['createdAt',_0x6050('0x29'),'CompanyId',_0x6050('0x2a')]);var _0x360054=![];if(_0x554e3f[_0x6050('0x25')]['id']){delete _0x554e3f[_0x6050('0x25')]['id'];}if(_[_0x6050('0x2b')](_0x554e3f[_0x6050('0x25')][_0x6050('0x2c')])){return _0x2e9aed(_0x3a36ed[_0x6050('0x13')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x554e3f['body'][_0x6050('0x25')])||_0x554e3f[_0x6050('0x25')][_0x6050('0x25')]===''){return _0x2e9aed(_0x3a36ed[_0x6050('0x13')](0x1f4,_0x6050('0x2d')));}if(_[_0x6050('0x2b')](_0x554e3f[_0x6050('0x25')][_0x6050('0x2e')])){return _0x2e9aed(_0x3a36ed[_0x6050('0x13')](0x1f4,_0x6050('0x2f')+_0xec0238));}if(!_[_0x6050('0x30')](_0xec0238,_0x554e3f[_0x6050('0x25')]['mapKey'])){return _0x2e9aed(_0x3a36ed['error'](0x1f4,_0x6050('0x31')+_0xec0238));}var _0x377aa2={};_0x377aa2[_0x554e3f[_0x6050('0x25')][_0x6050('0x2e')]]=_0x554e3f[_0x6050('0x25')]['from'];return db[_0x6050('0x17')][_0x6050('0x23')]({'where':{'id':_0x554e3f['account']['id']},'include':[{'model':db[_0x6050('0x32')],'as':_0x6050('0x33'),'include':[{'model':db[_0x6050('0x27')],'as':'Contacts','where':_0x377aa2,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailApplication'],'as':_0x6050('0x34')},{'model':db[_0x6050('0x35')],'as':_0x6050('0x36')}]})[_0x6050('0xd')](function(_0x1af21){if(_0x1af21&&_0x1af21[_0x6050('0x33')]){var _0x28f971=_0x1af21[_0x6050('0x37')]({'plain':!![]});_0x39b10d[_0x6050('0x38')]=_['omit'](_0x28f971,[_0x6050('0x34'),_0x6050('0x33')]);_0x39b10d[_0x6050('0x39')]=_0x28f971[_0x6050('0x34')];_0x39b10d[_0x6050('0x3a')]=_0x28f971[_0x6050('0x33')];_0x39b10d[_0x6050('0x39')]=_[_0x6050('0x3b')](_0x39b10d['applications'],['priority'],['asc']);if(_0x39b10d[_0x6050('0x38')]&&_0x39b10d[_0x6050('0x38')][_0x6050('0x3c')]){_0x39b10d[_0x6050('0x39')][_0x6050('0x3d')]({'id':0x0,'priority':_0x39b10d['applications'][_0x6050('0x3e')]+0x1,'app':_0x6050('0x3f'),'appdata':_0x6050('0x3c'),'interval':'*,*,*,*'});}if(_0x39b10d[_0x6050('0x38')][_0x6050('0x34')]){delete _0x39b10d[_0x6050('0x38')][_0x6050('0x34')];}if(_0x39b10d[_0x6050('0x38')]['List']){delete _0x39b10d[_0x6050('0x38')][_0x6050('0x33')];}if(_0x28f971['List'][_0x6050('0x40')][_0x6050('0x3e')]){return _0x28f971['List'][_0x6050('0x40')][0x0];}var _0x135a9d=_[_0x6050('0x8')](_0x554e3f[_0x6050('0x25')],{'firstName':_0x554e3f['body']['from'],'ListId':_0x28f971[_0x6050('0x2a')]});_0x135a9d[_0x554e3f[_0x6050('0x25')][_0x6050('0x2e')]]=_0x554e3f[_0x6050('0x25')][_0x6050('0x2c')];return db[_0x6050('0x27')][_0x6050('0x41')](_0x135a9d);}else{throw new Error(_0x6050('0x42'));}})[_0x6050('0xd')](function(_0x232c9f){_0x39b10d[_0x6050('0x43')]=_0x232c9f;if(_0x232c9f){if(!_0x554e3f[_0x6050('0x25')][_0x6050('0x15')]['messageId']){_0x554e3f['body'][_0x6050('0x15')]['messageId']=rs[_0x6050('0x44')]()+'\x20'+_0x554e3f['body'][_0x6050('0x15')][_0x6050('0x2c')];}var _0x496aa8={'ContactId':_0x232c9f['id'],'MailAccountId':_0x554e3f[_0x6050('0x38')]['id'],'inReplyTo':_0x554e3f[_0x6050('0x25')][_0x6050('0x15')][_0x6050('0x45')],'to':_0x554e3f[_0x6050('0x25')][_0x6050('0x15')][_0x6050('0x2c')],'cc':_0x554e3f['body'][_0x6050('0x15')]['cc'],'subject':_0x554e3f['body']['message'][_0x6050('0x46')],'attach':_0x554e3f['body'][_0x6050('0x15')][_0x6050('0x47')],'lastMsgAt':moment()[_0x6050('0x48')](_0x6050('0x49')),'lastMsgDirection':'in','lastMsgBody':_0x554e3f['body'][_0x6050('0x25')]};return db['MailInteraction'][_0x6050('0x23')]({'where':{'closed':![],'MailAccountId':_0x554e3f[_0x6050('0x38')]['id']},'include':[{'model':db['MailMessage'],'as':_0x6050('0x4a'),'attributes':[_0x6050('0x45')],'where':{'messageId':_0x554e3f[_0x6050('0x25')][_0x6050('0x15')][_0x6050('0x4b')]}}]})[_0x6050('0xd')](function(_0x5f0293){if(_0x5f0293){return[_0x5f0293,![]];}return db[_0x6050('0x4c')][_0x6050('0x41')](_0x496aa8)[_0x6050('0xd')](function(_0x3f8aac){return[_0x3f8aac,!![]];});});}else{throw new Error(_0x6050('0x4d'));}})[_0x6050('0x4e')](function(_0x226ece,_0x3c3df){if(_0x226ece){_0x360054=_0x3c3df;if(!_0x3c3df){return _0x226ece['update']({'inReplyTo':_0x554e3f[_0x6050('0x25')][_0x6050('0x15')][_0x6050('0x45')],'to':_0x554e3f[_0x6050('0x25')][_0x6050('0x15')][_0x6050('0x2c')],'cc':_0x554e3f[_0x6050('0x25')][_0x6050('0x15')]['cc'],'subject':_0x554e3f['body']['message']['subject'],'attach':_0x226ece['attach']?_0x226ece[_0x6050('0x47')]:_0x554e3f[_0x6050('0x25')][_0x6050('0x15')]['attach'],'substatus':null,'substatusAt':moment()[_0x6050('0x48')](_0x6050('0x49')),'lastMsgAt':moment()['format'](_0x6050('0x49')),'lastMsgDirection':'in','lastMsgBody':_0x554e3f['body'][_0x6050('0x25')]});}else{return _0x226ece;}}})[_0x6050('0xd')](function(_0x4e3846){_0x39b10d[_0x6050('0x4f')]=_0x4e3846[_0x6050('0x37')]({'plain':!![]});_0x39b10d[_0x6050('0x4f')][_0x6050('0x50')]=_0x360054;return db[_0x6050('0x51')]['create']({'body':_0x554e3f[_0x6050('0x25')]['body'],'MailAccountId':_0x554e3f[_0x6050('0x38')]['id'],'MailInteractionId':_0x4e3846['id'],'direction':'in','ContactId':_0x39b10d[_0x6050('0x43')]['id'],'messageId':_0x554e3f[_0x6050('0x25')][_0x6050('0x15')]['messageId'],'from':_0x554e3f[_0x6050('0x25')][_0x6050('0x15')]['from'],'to':_0x554e3f['body'][_0x6050('0x15')]['to'],'cc':_0x554e3f[_0x6050('0x25')][_0x6050('0x15')]['cc'],'subject':_0x554e3f[_0x6050('0x25')][_0x6050('0x15')]['subject'],'attach':_0x554e3f[_0x6050('0x25')]['message'][_0x6050('0x47')],'Attachments':_0x554e3f[_0x6050('0x25')][_0x6050('0x15')]['attachments'],'originTo':_0x554e3f[_0x6050('0x25')][_0x6050('0x15')][_0x6050('0x52')],'originCc':_0x554e3f[_0x6050('0x25')][_0x6050('0x15')][_0x6050('0x53')],'bcc':_0x554e3f['body'][_0x6050('0x15')][_0x6050('0x54')]},{'include':[{'model':db[_0x6050('0x55')],'as':'Attachments'}]});})['then'](function(_0x17b765){_0x39b10d[_0x6050('0x15')]=_0x17b765;if(_0x39b10d[_0x6050('0x4f')][_0x6050('0x56')]){return db[_0x6050('0x57')][_0x6050('0x23')]({'attributes':['id',_0x6050('0x58')],'where':{'id':_0x39b10d[_0x6050('0x4f')][_0x6050('0x56')]}})[_0x6050('0xd')](function(_0xa47dd9){if(_0xa47dd9){_0x39b10d[_0x6050('0x39')]['unshift']({'id':0x0,'priority':0x0,'app':_0x6050('0x59'),'appdata':_0xa47dd9[_0x6050('0x58')]+','+(_0x39b10d[_0x6050('0x38')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x39b10d);});}return respondWithRpcPromise('Start',_0x6050('0x5a'),_0x39b10d);})['then'](function(_0x342c07){_0xb53d7c(_0x342c07);})[_0x6050('0x16')](function(_0x53cc28){_0x2e9aed(_0x3a36ed['error'](0x1f4,_0x53cc28[_0x6050('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index efab912..b26bf95 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 _0xd9ce=['update','emit','removeListener','register','./mailAccount.events','save','remove'];(function(_0x579121,_0x27e9e2){var _0x38a4ae=function(_0x53e154){while(--_0x53e154){_0x579121['push'](_0x579121['shift']());}};_0x38a4ae(++_0x27e9e2);}(_0xd9ce,0xeb));var _0xed9c=function(_0x482815,_0x3601b1){_0x482815=_0x482815-0x0;var _0x272d11=_0xd9ce[_0x482815];return _0x272d11;};'use strict';var MailAccountEvents=require(_0xed9c('0x0'));var events=[_0xed9c('0x1'),_0xed9c('0x2'),_0xed9c('0x3')];function createListener(_0x3892c2,_0x2008a1){return function(_0x1aa913){_0x2008a1[_0xed9c('0x4')](_0x3892c2,_0x1aa913);};}function removeListener(_0x5903b6,_0x3c9c4a){return function(){MailAccountEvents[_0xed9c('0x5')](_0x5903b6,_0x3c9c4a);};}exports[_0xed9c('0x6')]=function(_0x154e9d){for(var _0x3043a6=0x0,_0x434898=events['length'];_0x3043a6<_0x434898;_0x3043a6++){var _0x2ad757=events[_0x3043a6];var _0xde32e4=createListener('mailAccount:'+_0x2ad757,_0x154e9d);MailAccountEvents['on'](_0x2ad757,_0xde32e4);}}; \ No newline at end of file +var _0xdbd0=['./mailAccount.events','save','remove','update','emit','removeListener','register','mailAccount:'];(function(_0x5b75fa,_0x1df67e){var _0x1c8f6d=function(_0x5a8935){while(--_0x5a8935){_0x5b75fa['push'](_0x5b75fa['shift']());}};_0x1c8f6d(++_0x1df67e);}(_0xdbd0,0x88));var _0x0dbd=function(_0x103c05,_0x5972ed){_0x103c05=_0x103c05-0x0;var _0x1bd186=_0xdbd0[_0x103c05];return _0x1bd186;};'use strict';var MailAccountEvents=require(_0x0dbd('0x0'));var events=[_0x0dbd('0x1'),_0x0dbd('0x2'),_0x0dbd('0x3')];function createListener(_0x4392ca,_0x58ef9e){return function(_0x3ac5c2){_0x58ef9e[_0x0dbd('0x4')](_0x4392ca,_0x3ac5c2);};}function removeListener(_0x1aeffb,_0x5ec8d7){return function(){MailAccountEvents[_0x0dbd('0x5')](_0x1aeffb,_0x5ec8d7);};}exports[_0x0dbd('0x6')]=function(_0xcd515f){for(var _0x3bd770=0x0,_0x4b653b=events['length'];_0x3bd770<_0x4b653b;_0x3bd770++){var _0xcb72c2=events[_0x3bd770];var _0x3b3f21=createListener(_0x0dbd('0x7')+_0xcb72c2,_0xcd515f);MailAccountEvents['on'](_0xcb72c2,_0x3b3f21);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 857434a..1085430 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 _0xbf6e=['get','/:id','isAuthenticated','show','put','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x44a02f,_0x34aa73){var _0x5d1d8f=function(_0x5eb7b8){while(--_0x5eb7b8){_0x44a02f['push'](_0x44a02f['shift']());}};_0x5d1d8f(++_0x34aa73);}(_0xbf6e,0x149));var _0xebf6=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0xbf6e[_0x16b1a5];return _0x475e25;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xebf6('0x0'));var timeout=require(_0xebf6('0x1'));var express=require(_0xebf6('0x2'));var router=express[_0xebf6('0x3')]();var auth=require(_0xebf6('0x4'));var interaction=require(_0xebf6('0x5'));var config=require(_0xebf6('0x6'));var controller=require('./mailApplication.controller');router[_0xebf6('0x7')](_0xebf6('0x8'),auth[_0xebf6('0x9')](),controller[_0xebf6('0xa')]);router[_0xebf6('0xb')](_0xebf6('0x8'),auth[_0xebf6('0x9')](),controller['update']);router[_0xebf6('0xc')](_0xebf6('0x8'),auth[_0xebf6('0x9')](),controller['destroy']);module[_0xebf6('0xd')]=router; \ No newline at end of file +var _0x9348=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','multer'];(function(_0x728a2d,_0xca584){var _0x335548=function(_0x2f9fcb){while(--_0x2f9fcb){_0x728a2d['push'](_0x728a2d['shift']());}};_0x335548(++_0xca584);}(_0x9348,0x10d));var _0x8934=function(_0x414182,_0x34b859){_0x414182=_0x414182-0x0;var _0x2e9198=_0x9348[_0x414182];return _0x2e9198;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var auth=require(_0x8934('0x5'));var interaction=require(_0x8934('0x6'));var config=require('../../config/environment');var controller=require(_0x8934('0x7'));router[_0x8934('0x8')](_0x8934('0x9'),auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0xc')]('/:id',auth[_0x8934('0xa')](),controller[_0x8934('0xd')]);router[_0x8934('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 9303210..59840f5 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 _0x13dd=['sequelize','exports','INTEGER','noop','STRING','*,*,*,*'];(function(_0x2b0690,_0x4f742f){var _0x82be1=function(_0x1e1084){while(--_0x1e1084){_0x2b0690['push'](_0x2b0690['shift']());}};_0x82be1(++_0x4f742f);}(_0x13dd,0x84));var _0xd13d=function(_0x136d95,_0x353962){_0x136d95=_0x136d95-0x0;var _0x5c2bd9=_0x13dd[_0x136d95];return _0x5c2bd9;};'use strict';var Sequelize=require(_0xd13d('0x0'));module[_0xd13d('0x1')]={'priority':{'type':Sequelize[_0xd13d('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd13d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd13d('0x4')],'defaultValue':_0xd13d('0x5')}}; \ No newline at end of file +var _0x4763=['STRING','noop','TEXT','INTEGER'];(function(_0x39a54e,_0x462100){var _0x584bec=function(_0x3e96b9){while(--_0x3e96b9){_0x39a54e['push'](_0x39a54e['shift']());}};_0x584bec(++_0x462100);}(_0x4763,0x9f));var _0x3476=function(_0x4d5039,_0x31c087){_0x4d5039=_0x4d5039-0x0;var _0x4b5395=_0x4763[_0x4d5039];return _0x4b5395;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x3476('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x3476('0x1')],'allowNull':![],'defaultValue':_0x3476('0x2')},'appdata':{'type':Sequelize[_0x3476('0x3')]()},'description':{'type':Sequelize[_0x3476('0x1')]},'interval':{'type':Sequelize[_0x3476('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index eb8797f..418430f 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 _0xb0ff=['status','end','json','count','offset','limit','set','apply','update','then','error','name','send','params','model','rawAttributes','query','keys','intersection','attributes','fields','length','include','merge','MailApplication','find','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3fd531,_0x538738){var _0x5bd9db=function(_0x676411){while(--_0x676411){_0x3fd531['push'](_0x3fd531['shift']());}};_0x5bd9db(++_0x538738);}(_0xb0ff,0xb8));var _0xfb0f=function(_0x3f9043,_0x1b5407){_0x3f9043=_0x3f9043-0x0;var _0x24b935=_0xb0ff[_0x3f9043];return _0x24b935;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfb0f('0x0'));var zipdir=require(_0xfb0f('0x1'));var jsonpatch=require(_0xfb0f('0x2'));var rp=require(_0xfb0f('0x3'));var moment=require(_0xfb0f('0x4'));var BPromise=require(_0xfb0f('0x5'));var Mustache=require('mustache');var util=require(_0xfb0f('0x6'));var path=require(_0xfb0f('0x7'));var sox=require(_0xfb0f('0x8'));var csv=require(_0xfb0f('0x9'));var ejs=require(_0xfb0f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfb0f('0xb'));var crypto=require(_0xfb0f('0xc'));var jsforce=require(_0xfb0f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfb0f('0x9'));var querystring=require('querystring');var Papa=require(_0xfb0f('0xe'));var Redis=require(_0xfb0f('0xf'));var authService=require(_0xfb0f('0x10'));var qs=require(_0xfb0f('0x11'));var as=require(_0xfb0f('0x12'));var hardwareService=require(_0xfb0f('0x13'));var logger=require('../../config/logger')(_0xfb0f('0x14'));var utils=require('../../config/utils');var config=require(_0xfb0f('0x15'));var licenseUtil=require(_0xfb0f('0x16'));var db=require(_0xfb0f('0x17'))['db'];function respondWithStatusCode(_0x246540,_0x333934){_0x333934=_0x333934||0xcc;return function(_0x1c4964){if(_0x1c4964){return _0x246540['sendStatus'](_0x333934);}return _0x246540[_0xfb0f('0x18')](_0x333934)[_0xfb0f('0x19')]();};}function respondWithResult(_0x43339f,_0x5c4b3e){_0x5c4b3e=_0x5c4b3e||0xc8;return function(_0x5e30bd){if(_0x5e30bd){return _0x43339f[_0xfb0f('0x18')](_0x5c4b3e)[_0xfb0f('0x1a')](_0x5e30bd);}};}function respondWithFilteredResult(_0x3ce79a,_0x678832){return function(_0xc62ec4){if(_0xc62ec4){var _0x31d69a=_0xc62ec4[_0xfb0f('0x1b')],_0x1e765b=_0x678832[_0xfb0f('0x1c')],_0x4847cb=_0x678832[_0xfb0f('0x1c')]+_0x678832[_0xfb0f('0x1d')],_0xa65bec;if(_0x4847cb>=_0x31d69a){_0x4847cb=_0x31d69a;_0xa65bec=0xc8;}else{_0xa65bec=0xce;}_0x3ce79a[_0xfb0f('0x18')](_0xa65bec);return _0x3ce79a[_0xfb0f('0x1e')]('Content-Range',_0x1e765b+'-'+_0x4847cb+'/'+_0x31d69a)['json'](_0xc62ec4);}return null;};}function patchUpdates(_0x167dd1){return function(_0x2ccbb6){try{jsonpatch[_0xfb0f('0x1f')](_0x2ccbb6,_0x167dd1,!![]);}catch(_0x5d8f1a){return BPromise['reject'](_0x5d8f1a);}return _0x2ccbb6['save']();};}function saveUpdates(_0x103bdf,_0x500859){return function(_0xb79ab4){if(_0xb79ab4){return _0xb79ab4[_0xfb0f('0x20')](_0x103bdf)[_0xfb0f('0x21')](function(_0x4eaa2a){return _0x4eaa2a;});}return null;};}function removeEntity(_0x26103f,_0x2d6405){return function(_0x3d7e6a){if(_0x3d7e6a){return _0x3d7e6a['destroy']()['then'](function(){_0x26103f[_0xfb0f('0x18')](0xcc)[_0xfb0f('0x19')]();});}};}function handleEntityNotFound(_0x806198,_0x3b31dd){return function(_0x4a4965){if(!_0x4a4965){_0x806198['sendStatus'](0x194);}return _0x4a4965;};}function handleError(_0x3ff5fe,_0x18c41d){_0x18c41d=_0x18c41d||0x1f4;return function(_0x1be29e){logger[_0xfb0f('0x22')](_0x1be29e['stack']);if(_0x1be29e[_0xfb0f('0x23')]){delete _0x1be29e[_0xfb0f('0x23')];}_0x3ff5fe[_0xfb0f('0x18')](_0x18c41d)[_0xfb0f('0x24')](_0x1be29e);};}exports['show']=function(_0x221c22,_0xfb5b38){var _0x11065c={'raw':!![],'where':{'id':_0x221c22[_0xfb0f('0x25')]['id']}},_0xb40e54={};_0xb40e54[_0xfb0f('0x26')]=_['keys'](db['MailApplication'][_0xfb0f('0x27')]);_0xb40e54[_0xfb0f('0x28')]=_[_0xfb0f('0x29')](_0x221c22[_0xfb0f('0x28')]);_0xb40e54['filters']=_[_0xfb0f('0x2a')](_0xb40e54[_0xfb0f('0x26')],_0xb40e54['query']);_0x11065c[_0xfb0f('0x2b')]=_[_0xfb0f('0x2a')](_0xb40e54[_0xfb0f('0x26')],qs[_0xfb0f('0x2c')](_0x221c22[_0xfb0f('0x28')][_0xfb0f('0x2c')]));_0x11065c[_0xfb0f('0x2b')]=_0x11065c[_0xfb0f('0x2b')][_0xfb0f('0x2d')]?_0x11065c[_0xfb0f('0x2b')]:_0xb40e54[_0xfb0f('0x26')];if(_0x221c22['query']['includeAll']){_0x11065c[_0xfb0f('0x2e')]=[{'all':!![]}];}_0x11065c=_[_0xfb0f('0x2f')]({},_0x11065c,_0x221c22['options']);return db[_0xfb0f('0x30')][_0xfb0f('0x31')](_0x11065c)[_0xfb0f('0x21')](handleEntityNotFound(_0xfb5b38,null))[_0xfb0f('0x21')](respondWithResult(_0xfb5b38,null))[_0xfb0f('0x32')](handleError(_0xfb5b38,null));};exports[_0xfb0f('0x20')]=function(_0x13257e,_0x545ade){if(_0x13257e[_0xfb0f('0x33')]['id']){delete _0x13257e[_0xfb0f('0x33')]['id'];}return db[_0xfb0f('0x30')][_0xfb0f('0x31')]({'where':{'id':_0x13257e[_0xfb0f('0x25')]['id']}})['then'](handleEntityNotFound(_0x545ade,null))[_0xfb0f('0x21')](saveUpdates(_0x13257e[_0xfb0f('0x33')],null))[_0xfb0f('0x21')](respondWithResult(_0x545ade,null))[_0xfb0f('0x32')](handleError(_0x545ade,null));};exports['destroy']=function(_0x53da36,_0x15b316){return db[_0xfb0f('0x30')][_0xfb0f('0x31')]({'where':{'id':_0x53da36[_0xfb0f('0x25')]['id']}})[_0xfb0f('0x21')](handleEntityNotFound(_0x15b316,null))[_0xfb0f('0x21')](removeEntity(_0x15b316,null))[_0xfb0f('0x32')](handleError(_0x15b316,null));}; \ No newline at end of file +var _0x56bf=['../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','show','model','query','keys','filters','intersection','fields','attributes','length','include','find','catch','body','params','MailApplication','html-pdf','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x46b057,_0x25aa56){var _0x25cf84=function(_0x324ba6){while(--_0x324ba6){_0x46b057['push'](_0x46b057['shift']());}};_0x25cf84(++_0x25aa56);}(_0x56bf,0xbb));var _0xf56b=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x56bf[_0x29d915];return _0x160f86;};'use strict';var pdf=require(_0xf56b('0x0'));var emlformat=require(_0xf56b('0x1'));var rimraf=require(_0xf56b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf56b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf56b('0x4'));var util=require(_0xf56b('0x5'));var path=require(_0xf56b('0x6'));var sox=require(_0xf56b('0x7'));var csv=require(_0xf56b('0x8'));var ejs=require(_0xf56b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf56b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf56b('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf56b('0xc'));var Redis=require('ioredis');var authService=require(_0xf56b('0xd'));var qs=require(_0xf56b('0xe'));var as=require(_0xf56b('0xf'));var hardwareService=require(_0xf56b('0x10'));var logger=require(_0xf56b('0x11'))('api');var utils=require(_0xf56b('0x12'));var config=require(_0xf56b('0x13'));var licenseUtil=require(_0xf56b('0x14'));var db=require(_0xf56b('0x15'))['db'];function respondWithStatusCode(_0x367c8b,_0x8725c2){_0x8725c2=_0x8725c2||0xcc;return function(_0x298ec5){if(_0x298ec5){return _0x367c8b[_0xf56b('0x16')](_0x8725c2);}return _0x367c8b[_0xf56b('0x17')](_0x8725c2)[_0xf56b('0x18')]();};}function respondWithResult(_0x53cd33,_0x20cfee){_0x20cfee=_0x20cfee||0xc8;return function(_0x1e8771){if(_0x1e8771){return _0x53cd33[_0xf56b('0x17')](_0x20cfee)[_0xf56b('0x19')](_0x1e8771);}};}function respondWithFilteredResult(_0x1c632b,_0x21faba){return function(_0xec5b34){if(_0xec5b34){var _0x1104c4=_0xec5b34[_0xf56b('0x1a')],_0x4cf424=_0x21faba[_0xf56b('0x1b')],_0xdf6905=_0x21faba[_0xf56b('0x1b')]+_0x21faba[_0xf56b('0x1c')],_0x127482;if(_0xdf6905>=_0x1104c4){_0xdf6905=_0x1104c4;_0x127482=0xc8;}else{_0x127482=0xce;}_0x1c632b[_0xf56b('0x17')](_0x127482);return _0x1c632b[_0xf56b('0x1d')]('Content-Range',_0x4cf424+'-'+_0xdf6905+'/'+_0x1104c4)[_0xf56b('0x19')](_0xec5b34);}return null;};}function patchUpdates(_0x26cc40){return function(_0x1c7a2b){try{jsonpatch[_0xf56b('0x1e')](_0x1c7a2b,_0x26cc40,!![]);}catch(_0x18ea42){return BPromise[_0xf56b('0x1f')](_0x18ea42);}return _0x1c7a2b[_0xf56b('0x20')]();};}function saveUpdates(_0x2c447d,_0x20453d){return function(_0x30040e){if(_0x30040e){return _0x30040e[_0xf56b('0x21')](_0x2c447d)[_0xf56b('0x22')](function(_0x55b269){return _0x55b269;});}return null;};}function removeEntity(_0x5d5286,_0x93f0d1){return function(_0x1a84d7){if(_0x1a84d7){return _0x1a84d7[_0xf56b('0x23')]()['then'](function(){_0x5d5286[_0xf56b('0x17')](0xcc)[_0xf56b('0x18')]();});}};}function handleEntityNotFound(_0x48a4d9,_0x20a4b6){return function(_0x4fa67d){if(!_0x4fa67d){_0x48a4d9[_0xf56b('0x16')](0x194);}return _0x4fa67d;};}function handleError(_0x460dd3,_0x4c5611){_0x4c5611=_0x4c5611||0x1f4;return function(_0x4877c6){logger['error'](_0x4877c6[_0xf56b('0x24')]);if(_0x4877c6['name']){delete _0x4877c6['name'];}_0x460dd3[_0xf56b('0x17')](_0x4c5611)['send'](_0x4877c6);};}exports[_0xf56b('0x25')]=function(_0x1e0ec2,_0x4cb72b){var _0x5c7ee2={'raw':!![],'where':{'id':_0x1e0ec2['params']['id']}},_0x58f6c3={};_0x58f6c3[_0xf56b('0x26')]=_['keys'](db['MailApplication']['rawAttributes']);_0x58f6c3[_0xf56b('0x27')]=_[_0xf56b('0x28')](_0x1e0ec2[_0xf56b('0x27')]);_0x58f6c3[_0xf56b('0x29')]=_['intersection'](_0x58f6c3[_0xf56b('0x26')],_0x58f6c3[_0xf56b('0x27')]);_0x5c7ee2['attributes']=_[_0xf56b('0x2a')](_0x58f6c3[_0xf56b('0x26')],qs[_0xf56b('0x2b')](_0x1e0ec2[_0xf56b('0x27')][_0xf56b('0x2b')]));_0x5c7ee2[_0xf56b('0x2c')]=_0x5c7ee2[_0xf56b('0x2c')][_0xf56b('0x2d')]?_0x5c7ee2[_0xf56b('0x2c')]:_0x58f6c3[_0xf56b('0x26')];if(_0x1e0ec2[_0xf56b('0x27')]['includeAll']){_0x5c7ee2[_0xf56b('0x2e')]=[{'all':!![]}];}_0x5c7ee2=_['merge']({},_0x5c7ee2,_0x1e0ec2['options']);return db['MailApplication'][_0xf56b('0x2f')](_0x5c7ee2)[_0xf56b('0x22')](handleEntityNotFound(_0x4cb72b,null))['then'](respondWithResult(_0x4cb72b,null))[_0xf56b('0x30')](handleError(_0x4cb72b,null));};exports[_0xf56b('0x21')]=function(_0x4039e3,_0x298349){if(_0x4039e3[_0xf56b('0x31')]['id']){delete _0x4039e3[_0xf56b('0x31')]['id'];}return db['MailApplication']['find']({'where':{'id':_0x4039e3[_0xf56b('0x32')]['id']}})[_0xf56b('0x22')](handleEntityNotFound(_0x298349,null))[_0xf56b('0x22')](saveUpdates(_0x4039e3[_0xf56b('0x31')],null))[_0xf56b('0x22')](respondWithResult(_0x298349,null))['catch'](handleError(_0x298349,null));};exports[_0xf56b('0x23')]=function(_0x3cb844,_0x37a226){return db[_0xf56b('0x33')][_0xf56b('0x2f')]({'where':{'id':_0x3cb844[_0xf56b('0x32')]['id']}})[_0xf56b('0x22')](handleEntityNotFound(_0x37a226,null))['then'](removeEntity(_0x37a226,null))[_0xf56b('0x30')](handleError(_0x37a226,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 02716b6..c63fedb 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 _0x01a6=['rimraf','./mailApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01a6,0x162));var _0x601a=function(_0x39fb98,_0x3fcd7b){_0x39fb98=_0x39fb98-0x0;var _0x5062eb=_0x01a6[_0x39fb98];return _0x5062eb;};'use strict';var _=require(_0x601a('0x0'));var util=require('util');var logger=require(_0x601a('0x1'))(_0x601a('0x2'));var moment=require(_0x601a('0x3'));var BPromise=require(_0x601a('0x4'));var rp=require(_0x601a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x601a('0x6'));var config=require('../../config/environment');var attributes=require(_0x601a('0x7'));module[_0x601a('0x8')]=function(_0x30df8c,_0x196c77){return _0x30df8c[_0x601a('0x9')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x601a('0xa'),'collate':_0x601a('0xb')});}; \ No newline at end of file +var _0x20d8=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','MailApplication','mail_applications','utf8mb4','lodash','util'];(function(_0x4df6f9,_0x44bd65){var _0x4b1a73=function(_0xf5adb7){while(--_0xf5adb7){_0x4df6f9['push'](_0x4df6f9['shift']());}};_0x4b1a73(++_0x44bd65);}(_0x20d8,0xee));var _0x820d=function(_0x1f05e6,_0x2fe295){_0x1f05e6=_0x1f05e6-0x0;var _0x440a1a=_0x20d8[_0x1f05e6];return _0x440a1a;};'use strict';var _=require(_0x820d('0x0'));var util=require(_0x820d('0x1'));var logger=require(_0x820d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x820d('0x3'));var rp=require(_0x820d('0x4'));var fs=require('fs');var path=require(_0x820d('0x5'));var rimraf=require(_0x820d('0x6'));var config=require(_0x820d('0x7'));var attributes=require('./mailApplication.attributes');module[_0x820d('0x8')]=function(_0x160735,_0x3b801d){return _0x160735['define'](_0x820d('0x9'),attributes,{'tableName':_0x820d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x820d('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 329d1d1..7268ddc 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 _0xa4e8=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailApplication','MailApplication','options','raw','where','limit','util'];(function(_0x3ded,_0x491c2e){var _0x1e3e35=function(_0x2ed7b4){while(--_0x2ed7b4){_0x3ded['push'](_0x3ded['shift']());}};_0x1e3e35(++_0x491c2e);}(_0xa4e8,0xef));var _0x8a4e=function(_0xa7abb3,_0xdeb465){_0xa7abb3=_0xa7abb3-0x0;var _0x353347=_0xa4e8[_0xa7abb3];return _0x353347;};'use strict';var _=require('lodash');var util=require(_0x8a4e('0x0'));var moment=require(_0x8a4e('0x1'));var BPromise=require('bluebird');var rs=require(_0x8a4e('0x2'));var fs=require('fs');var Redis=require(_0x8a4e('0x3'));var db=require(_0x8a4e('0x4'))['db'];var utils=require(_0x8a4e('0x5'));var logger=require(_0x8a4e('0x6'))(_0x8a4e('0x7'));var config=require(_0x8a4e('0x8'));var jayson=require(_0x8a4e('0x9'));var client=jayson[_0x8a4e('0xa')][_0x8a4e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ae3e2,_0x4daa9e,_0x1caa6c){return new BPromise(function(_0x2e6e18,_0x5d8e7a){return client[_0x8a4e('0xc')](_0x4ae3e2,_0x1caa6c)[_0x8a4e('0xd')](function(_0xaf30ae){logger[_0x8a4e('0xe')](_0x8a4e('0xf'),_0x4daa9e,_0x8a4e('0x10'));logger[_0x8a4e('0x11')](_0x8a4e('0x12'),_0x4daa9e,_0x8a4e('0x10'),JSON[_0x8a4e('0x13')](_0xaf30ae));if(_0xaf30ae[_0x8a4e('0x14')]){if(_0xaf30ae[_0x8a4e('0x14')][_0x8a4e('0x15')]===0x1f4){logger[_0x8a4e('0x14')](_0x8a4e('0xf'),_0x4daa9e,_0xaf30ae[_0x8a4e('0x14')][_0x8a4e('0x16')]);return _0x5d8e7a(_0xaf30ae['error']['message']);}logger[_0x8a4e('0x14')]('MailApplication,\x20%s,\x20%s',_0x4daa9e,_0xaf30ae[_0x8a4e('0x14')][_0x8a4e('0x16')]);return _0x2e6e18(_0xaf30ae[_0x8a4e('0x14')][_0x8a4e('0x16')]);}else{logger[_0x8a4e('0xe')](_0x8a4e('0xf'),_0x4daa9e,_0x8a4e('0x10'));_0x2e6e18(_0xaf30ae['result'][_0x8a4e('0x16')]);}})[_0x8a4e('0x17')](function(_0x53178f){logger[_0x8a4e('0x14')](_0x8a4e('0xf'),_0x4daa9e,_0x53178f);_0x5d8e7a(_0x53178f);});});}exports[_0x8a4e('0x18')]=function(_0x5db1fd){var _0x4bd3f3=this;return new Promise(function(_0x2e570b,_0x2ef63d){return db[_0x8a4e('0x19')]['update'](_0x5db1fd['body'],{'raw':_0x5db1fd[_0x8a4e('0x1a')]?_0x5db1fd['options'][_0x8a4e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5db1fd['options']?_0x5db1fd['options'][_0x8a4e('0x1c')]||null:null,'attributes':_0x5db1fd[_0x8a4e('0x1a')]?_0x5db1fd[_0x8a4e('0x1a')]['attributes']||null:null,'limit':_0x5db1fd[_0x8a4e('0x1a')]?_0x5db1fd[_0x8a4e('0x1a')][_0x8a4e('0x1d')]||null:null})['then'](function(_0x743ec5){logger[_0x8a4e('0xe')](_0x8a4e('0x18'),_0x5db1fd);logger[_0x8a4e('0x11')](_0x8a4e('0x18'),_0x5db1fd,JSON[_0x8a4e('0x13')](_0x743ec5));_0x2e570b(_0x743ec5);})['catch'](function(_0x511cab){logger[_0x8a4e('0x14')](_0x8a4e('0x18'),_0x511cab[_0x8a4e('0x16')],_0x5db1fd);_0x2ef63d(_0x4bd3f3[_0x8a4e('0x14')](0x1f4,_0x511cab['message']));});});}; \ No newline at end of file +var _0x9490=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5dda75,_0x597a9a){var _0x2d6e8b=function(_0x1d8be9){while(--_0x1d8be9){_0x5dda75['push'](_0x5dda75['shift']());}};_0x2d6e8b(++_0x597a9a);}(_0x9490,0x110));var _0x0949=function(_0x217998,_0x108e7b){_0x217998=_0x217998-0x0;var _0x4db9e3=_0x9490[_0x217998];return _0x4db9e3;};'use strict';var _=require(_0x0949('0x0'));var util=require(_0x0949('0x1'));var moment=require(_0x0949('0x2'));var BPromise=require(_0x0949('0x3'));var rs=require(_0x0949('0x4'));var fs=require('fs');var Redis=require(_0x0949('0x5'));var db=require(_0x0949('0x6'))['db'];var utils=require(_0x0949('0x7'));var logger=require(_0x0949('0x8'))(_0x0949('0x9'));var config=require(_0x0949('0xa'));var jayson=require(_0x0949('0xb'));var client=jayson[_0x0949('0xc')][_0x0949('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x267018,_0x493399,_0x183897){return new BPromise(function(_0x375947,_0x13cc8e){return client[_0x0949('0xe')](_0x267018,_0x183897)[_0x0949('0xf')](function(_0x4828d7){logger[_0x0949('0x10')](_0x0949('0x11'),_0x493399,_0x0949('0x12'));logger[_0x0949('0x13')](_0x0949('0x14'),_0x493399,_0x0949('0x12'),JSON['stringify'](_0x4828d7));if(_0x4828d7[_0x0949('0x15')]){if(_0x4828d7[_0x0949('0x15')][_0x0949('0x16')]===0x1f4){logger[_0x0949('0x15')](_0x0949('0x11'),_0x493399,_0x4828d7[_0x0949('0x15')][_0x0949('0x17')]);return _0x13cc8e(_0x4828d7[_0x0949('0x15')][_0x0949('0x17')]);}logger['error'](_0x0949('0x11'),_0x493399,_0x4828d7[_0x0949('0x15')][_0x0949('0x17')]);return _0x375947(_0x4828d7['error'][_0x0949('0x17')]);}else{logger[_0x0949('0x10')](_0x0949('0x11'),_0x493399,'request\x20sent');_0x375947(_0x4828d7[_0x0949('0x18')]['message']);}})[_0x0949('0x19')](function(_0x182090){logger[_0x0949('0x15')](_0x0949('0x11'),_0x493399,_0x182090);_0x13cc8e(_0x182090);});});}exports[_0x0949('0x1a')]=function(_0x2ac12c){var _0x4747b7=this;return new Promise(function(_0x5b6341,_0x2003df){return db[_0x0949('0x1b')][_0x0949('0x1c')](_0x2ac12c[_0x0949('0x1d')],{'raw':_0x2ac12c[_0x0949('0x1e')]?_0x2ac12c[_0x0949('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ac12c[_0x0949('0x1e')]?_0x2ac12c['options'][_0x0949('0x1f')]||null:null,'attributes':_0x2ac12c[_0x0949('0x1e')]?_0x2ac12c['options'][_0x0949('0x20')]||null:null,'limit':_0x2ac12c['options']?_0x2ac12c[_0x0949('0x1e')][_0x0949('0x21')]||null:null})['then'](function(_0x4d3e26){logger[_0x0949('0x10')]('UpdateMailApplication',_0x2ac12c);logger[_0x0949('0x13')](_0x0949('0x1a'),_0x2ac12c,JSON[_0x0949('0x22')](_0x4d3e26));_0x5b6341(_0x4d3e26);})[_0x0949('0x19')](function(_0x4f73fd){logger[_0x0949('0x15')]('UpdateMailApplication',_0x4f73fd[_0x0949('0x17')],_0x2ac12c);_0x2003df(_0x4747b7['error'](0x1f4,_0x4f73fd[_0x0949('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 73e4876..728e987 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 _0xa9e5=['update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','addMessage','/:id/tags','mail','addTags','put','tracked','mailinteraction:update'];(function(_0x38d3b8,_0x80cb3b){var _0x213345=function(_0x4c24c5){while(--_0x4c24c5){_0x38d3b8['push'](_0x38d3b8['shift']());}};_0x213345(++_0x80cb3b);}(_0xa9e5,0x8a));var _0x5a9e=function(_0xdfe4da,_0x31113d){_0xdfe4da=_0xdfe4da-0x0;var _0x574a8d=_0xa9e5[_0xdfe4da];return _0x574a8d;};'use strict';var multer=require(_0x5a9e('0x0'));var util=require(_0x5a9e('0x1'));var path=require('path');var timeout=require(_0x5a9e('0x2'));var express=require(_0x5a9e('0x3'));var router=express[_0x5a9e('0x4')]();var auth=require(_0x5a9e('0x5'));var interaction=require(_0x5a9e('0x6'));var config=require(_0x5a9e('0x7'));var controller=require(_0x5a9e('0x8'));router[_0x5a9e('0x9')]('/',auth[_0x5a9e('0xa')](),controller[_0x5a9e('0xb')]);router[_0x5a9e('0x9')](_0x5a9e('0xc'),auth[_0x5a9e('0xa')](),controller[_0x5a9e('0xd')]);router['get'](_0x5a9e('0xe'),auth[_0x5a9e('0xa')](),controller[_0x5a9e('0xf')]);router[_0x5a9e('0x9')]('/:id/messages',auth[_0x5a9e('0xa')](),controller['getMessages']);router[_0x5a9e('0x9')](_0x5a9e('0x10'),auth[_0x5a9e('0xa')](),controller[_0x5a9e('0x11')]);router[_0x5a9e('0x12')]('/',auth[_0x5a9e('0xa')](),controller[_0x5a9e('0x13')]);router[_0x5a9e('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5a9e('0x14')]);router[_0x5a9e('0x12')](_0x5a9e('0x15'),auth[_0x5a9e('0xa')](),interaction['tracked'](_0x5a9e('0x16'),'mailinteraction:addtags'),controller[_0x5a9e('0x17')]);router[_0x5a9e('0x18')]('/:id',auth[_0x5a9e('0xa')](),interaction[_0x5a9e('0x19')](_0x5a9e('0x16'),_0x5a9e('0x1a')),controller[_0x5a9e('0x1b')]);router[_0x5a9e('0x1c')](_0x5a9e('0xe'),auth[_0x5a9e('0xa')](),interaction['tracked']('mail',_0x5a9e('0x1d')),controller[_0x5a9e('0x1e')]);router[_0x5a9e('0x1c')]('/:id/tags',auth[_0x5a9e('0xa')](),controller[_0x5a9e('0x1f')]);module[_0x5a9e('0x20')]=router; \ No newline at end of file +var _0x9b9b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','mail','addTags','put','tracked','mailinteraction:update','update','mailinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','express','Router'];(function(_0x2bf496,_0x1d4e6c){var _0x5e102a=function(_0x263d10){while(--_0x263d10){_0x2bf496['push'](_0x2bf496['shift']());}};_0x5e102a(++_0x1d4e6c);}(_0x9b9b,0x114));var _0xb9b9=function(_0x322f4d,_0x2211c6){_0x322f4d=_0x322f4d-0x0;var _0x548443=_0x9b9b[_0x322f4d];return _0x548443;};'use strict';var multer=require('multer');var util=require(_0xb9b9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9b9('0x1'));var router=express[_0xb9b9('0x2')]();var auth=require(_0xb9b9('0x3'));var interaction=require(_0xb9b9('0x4'));var config=require(_0xb9b9('0x5'));var controller=require(_0xb9b9('0x6'));router[_0xb9b9('0x7')]('/',auth[_0xb9b9('0x8')](),controller[_0xb9b9('0x9')]);router[_0xb9b9('0x7')](_0xb9b9('0xa'),auth[_0xb9b9('0x8')](),controller[_0xb9b9('0xb')]);router[_0xb9b9('0x7')](_0xb9b9('0xc'),auth[_0xb9b9('0x8')](),controller['show']);router['get'](_0xb9b9('0xd'),auth[_0xb9b9('0x8')](),controller[_0xb9b9('0xe')]);router['get'](_0xb9b9('0xf'),auth[_0xb9b9('0x8')](),controller[_0xb9b9('0x10')]);router['post']('/',auth[_0xb9b9('0x8')](),controller[_0xb9b9('0x11')]);router[_0xb9b9('0x12')](_0xb9b9('0xd'),auth[_0xb9b9('0x8')](),controller[_0xb9b9('0x13')]);router['post']('/:id/tags',auth[_0xb9b9('0x8')](),interaction['tracked'](_0xb9b9('0x14'),'mailinteraction:addtags'),controller[_0xb9b9('0x15')]);router[_0xb9b9('0x16')](_0xb9b9('0xc'),auth[_0xb9b9('0x8')](),interaction[_0xb9b9('0x17')](_0xb9b9('0x14'),_0xb9b9('0x18')),controller[_0xb9b9('0x19')]);router['delete'](_0xb9b9('0xc'),auth['isAuthenticated'](),interaction[_0xb9b9('0x17')](_0xb9b9('0x14'),_0xb9b9('0x1a')),controller[_0xb9b9('0x1b')]);router['delete'](_0xb9b9('0x1c'),auth[_0xb9b9('0x8')](),controller[_0xb9b9('0x1d')]);module[_0xb9b9('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 142a82d..f70a42c 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 _0x2976=['TEXT','long','DATE','out','ENUM','exports','BOOLEAN','STRING'];(function(_0x3d1203,_0xdca475){var _0x56166e=function(_0x4d51cd){while(--_0x4d51cd){_0x3d1203['push'](_0x3d1203['shift']());}};_0x56166e(++_0xdca475);}(_0x2976,0x195));var _0x6297=function(_0x578099,_0x322c67){_0x578099=_0x578099-0x0;var _0x9fce11=_0x2976[_0x578099];return _0x9fce11;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x6297('0x0')]={'closed':{'type':Sequelize[_0x6297('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6297('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x6297('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6297('0x3')](_0x6297('0x4'))},'subject':{'type':Sequelize[_0x6297('0x3')]()},'attach':{'type':Sequelize[_0x6297('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6297('0x5')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x6297('0x5')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6297('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6297('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x6297('0x7')]('in',_0x6297('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x6297('0x3')]('long')},'lastMsgText':{'type':Sequelize['TEXT']('long')}}; \ No newline at end of file +var _0xe7fb=['STRING','TEXT','long','ENUM','out','exports','BOOLEAN','DATE'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xe7fb,0x145));var _0xbe7f=function(_0x17138e,_0x39a261){_0x17138e=_0x17138e-0x0;var _0x559728=_0xe7fb[_0x17138e];return _0x559728;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0xbe7f('0x0')]={'closed':{'type':Sequelize[_0xbe7f('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbe7f('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xbe7f('0x3')]},'thirdDisposition':{'type':Sequelize[_0xbe7f('0x3')]},'note':{'type':Sequelize[_0xbe7f('0x3')]},'inReplyTo':{'type':Sequelize[_0xbe7f('0x3')](0x1fe)},'to':{'type':Sequelize[_0xbe7f('0x3')]},'cc':{'type':Sequelize[_0xbe7f('0x4')](_0xbe7f('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xbe7f('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xbe7f('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xbe7f('0x6')]('in',_0xbe7f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbe7f('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xbe7f('0x6')]('in',_0xbe7f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xbe7f('0x4')](_0xbe7f('0x5'))},'lastMsgText':{'type':Sequelize[_0xbe7f('0x4')]('long')}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 924c3cf..6db5bfa 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 _0x205c=['$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','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','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','isEmpty','i.MailAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','catch','params','keys','rawAttributes','includeAll','include','options','create','body','describe','addMessage','MailMessage','ids','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','setTags','omit','spread','findAll','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','Messages','bcc','get','mkdirSync','each','subject','headers','Bcc','Attachments','attachments','build','message%d.eml','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','html-to-text','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','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','TagIds','Tags','split','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','index','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','color','from','tools_tags','u.id','field','u.fullname','ui.MailInteractionId','left_join','users','mail_interactions','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','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20>\x200','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','some','compact','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x205c,0x76));var _0xc205=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x205c[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require(_0xc205('0x0'));var emlformat=require(_0xc205('0x1'));var rimraf=require(_0xc205('0x2'));var zipdir=require(_0xc205('0x3'));var jsonpatch=require(_0xc205('0x4'));var rp=require('request-promise');var moment=require(_0xc205('0x5'));var BPromise=require(_0xc205('0x6'));var Mustache=require('mustache');var util=require(_0xc205('0x7'));var path=require('path');var sox=require(_0xc205('0x8'));var csv=require('to-csv');var ejs=require(_0xc205('0x9'));var fs=require('fs');var _=require(_0xc205('0xa'));var squel=require('squel');var crypto=require(_0xc205('0xb'));var jsforce=require(_0xc205('0xc'));var deskjs=require(_0xc205('0xd'));var toCsv=require(_0xc205('0xe'));var querystring=require('querystring');var Papa=require(_0xc205('0xf'));var htmlToText=require(_0xc205('0x10'));var Redis=require(_0xc205('0x11'));var authService=require(_0xc205('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc205('0x13'));var hardwareService=require(_0xc205('0x14'));var logger=require(_0xc205('0x15'))(_0xc205('0x16'));var utils=require(_0xc205('0x17'));var config=require(_0xc205('0x18'));var licenseUtil=require(_0xc205('0x19'));var db=require(_0xc205('0x1a'))['db'];config[_0xc205('0x1b')]=_['defaults'](config[_0xc205('0x1b')],{'host':_0xc205('0x1c'),'port':0x18eb});var socket=require(_0xc205('0x1d'))(new Redis(config[_0xc205('0x1b')]));require('./mailInteraction.socket')[_0xc205('0x1e')](socket);function respondWithStatusCode(_0x4f4ef7,_0x4f60e4){_0x4f60e4=_0x4f60e4||0xcc;return function(_0x42a16a){if(_0x42a16a){return _0x4f4ef7[_0xc205('0x1f')](_0x4f60e4);}return _0x4f4ef7[_0xc205('0x20')](_0x4f60e4)[_0xc205('0x21')]();};}function respondWithResult(_0x4b8267,_0xc77df){_0xc77df=_0xc77df||0xc8;return function(_0x481ebe){if(_0x481ebe){return _0x4b8267[_0xc205('0x20')](_0xc77df)[_0xc205('0x22')](_0x481ebe);}};}function respondWithFilteredResult(_0x3889ef,_0x47638f){return function(_0x40e1f8){if(_0x40e1f8){var _0x4730f2=_0x40e1f8[_0xc205('0x23')],_0x3380d9=_0x47638f[_0xc205('0x24')],_0x106fca=_0x47638f[_0xc205('0x24')]+_0x47638f[_0xc205('0x25')],_0xd30915;if(_0x106fca>=_0x4730f2){_0x106fca=_0x4730f2;_0xd30915=0xc8;}else{_0xd30915=0xce;}_0x3889ef['status'](_0xd30915);return _0x3889ef[_0xc205('0x26')](_0xc205('0x27'),_0x3380d9+'-'+_0x106fca+'/'+_0x4730f2)[_0xc205('0x22')](_0x40e1f8);}return null;};}function patchUpdates(_0x4c4c21){return function(_0x4d0497){try{jsonpatch[_0xc205('0x28')](_0x4d0497,_0x4c4c21,!![]);}catch(_0x3966d4){return BPromise['reject'](_0x3966d4);}return _0x4d0497[_0xc205('0x29')]();};}function saveUpdates(_0x2e3b1d,_0x57fe29){return function(_0x4b00a8){if(_0x4b00a8){return _0x4b00a8[_0xc205('0x2a')](_0x2e3b1d)[_0xc205('0x2b')](function(_0x14cb34){return _0x14cb34;});}return null;};}function removeEntity(_0x4cf654,_0x4ac87e){return function(_0x1a4cfe){if(_0x1a4cfe){return _0x1a4cfe[_0xc205('0x2c')]()[_0xc205('0x2b')](function(){_0x4cf654['status'](0xcc)[_0xc205('0x21')]();});}};}function handleEntityNotFound(_0x1ac591,_0x4b7f6f){return function(_0x1e9906){if(!_0x1e9906){_0x1ac591[_0xc205('0x1f')](0x194);}return _0x1e9906;};}function handleError(_0x301245,_0x2ae34e){_0x2ae34e=_0x2ae34e||0x1f4;return function(_0x2a07b7){logger['error'](_0x2a07b7[_0xc205('0x2d')]);if(_0x2a07b7[_0xc205('0x2e')]){delete _0x2a07b7[_0xc205('0x2e')];}_0x301245[_0xc205('0x20')](_0x2ae34e)[_0xc205('0x2f')](_0x2a07b7);};}function getInteractionUsers(_0x210295,_0x7941a9){return new BPromise(function(_0x28a3ae,_0x320283){try{if(_0x7941a9[_0x210295['id']]){_0x210295['Users']=_[_0xc205('0x30')](_0x7941a9[_0x210295['id']],function(_0x3c595e){return{'id':_0x3c595e['id'],'fullname':_0x3c595e['fullname']};});}}catch(_0x180cba){_0x320283(_0x180cba);}_0x28a3ae(_0x210295);});}function getInteractionTags(_0x497d74,_0x43041a){return new BPromise(function(_0x58db41,_0xc75c6){try{if(_0x497d74[_0xc205('0x31')]){_0x497d74[_0xc205('0x32')]=[];_0x497d74[_0xc205('0x31')][_0xc205('0x33')](',')[_0xc205('0x34')](function(_0x4647a2){_0x497d74[_0xc205('0x32')][_0xc205('0x35')](_0x43041a[_0x4647a2]);});}delete _0x497d74['TagIds'];}catch(_0x172843){_0xc75c6(_0x172843);}_0x58db41(_0x497d74);});}function getLastMessageText(_0x34b865){return new BPromise(function(_0x3f34f8,_0x4719a5){return db[_0xc205('0x36')][_0xc205('0x37')]({'where':{'id':_0x34b865['id']},'attributes':[_0xc205('0x38'),_0xc205('0x39')],'raw':!![]})['then'](function(_0x1d18a3){if(!_0x1d18a3[_0xc205('0x39')]){_0x34b865[_0xc205('0x39')]=_[_0xc205('0x3a')](htmlToText[_0xc205('0x3b')](_0x1d18a3['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x34b865[_0xc205('0x39')]=_0x1d18a3[_0xc205('0x39')];}_0x3f34f8(_0x34b865);})['catch'](function(_0x157087){_0x4719a5(_0x157087);});});}function updateMailInteraction(_0x128fe3,_0x24de8f,_0x51b77e,_0x1894a6){return new BPromise(function(_0x234fcf,_0x376aa9){return getInteractionUsers(_0x128fe3,_0x51b77e)[_0xc205('0x2b')](function(_0x19c142){return getInteractionTags(_0x19c142,_0x24de8f);})[_0xc205('0x2b')](function(_0x11fda4){if(_0x1894a6){_0x234fcf(getLastMessageText(_0x11fda4));}else{_0x234fcf(_0x11fda4);}})['catch'](function(_0x606f19){_0x376aa9(_0x606f19);});});}exports[_0xc205('0x3c')]=function(_0x5751c3,_0x539dab){var _0x118ca8={},_0x56be7d={},_0x2fdad4={'count':0x0,'rows':[]};var _0xbb8222=_[_0xc205('0x30')](db[_0xc205('0x36')]['rawAttributes'],function(_0x451c5b){return{'name':_0x451c5b[_0xc205('0x3d')],'type':_0x451c5b[_0xc205('0x3e')]['key']};});_0x56be7d[_0xc205('0x3f')]=_[_0xc205('0x30')](_0xbb8222,_0xc205('0x2e'));_0x56be7d[_0xc205('0x40')]=_['keys'](_0x5751c3['query']);_0x56be7d[_0xc205('0x41')]=_['intersection'](_0x56be7d[_0xc205('0x3f')],_0x56be7d[_0xc205('0x40')]);_0x118ca8['attributes']=_[_0xc205('0x42')](_0x56be7d[_0xc205('0x3f')],qs[_0xc205('0x43')](_0x5751c3[_0xc205('0x40')][_0xc205('0x43')]));_0x118ca8[_0xc205('0x44')]=_0x118ca8[_0xc205('0x44')][_0xc205('0x45')]?_0x118ca8['attributes']:_0x56be7d[_0xc205('0x3f')];if(!_0x5751c3['query'][_0xc205('0x46')](_0xc205('0x47'))){_0x118ca8[_0xc205('0x25')]=qs[_0xc205('0x25')](_0x5751c3[_0xc205('0x40')][_0xc205('0x25')]);_0x118ca8['offset']=qs[_0xc205('0x24')](_0x5751c3[_0xc205('0x40')]['offset']);}_0x118ca8[_0xc205('0x48')]=qs[_0xc205('0x49')](_0x5751c3[_0xc205('0x40')]['sort']);_0x118ca8[_0xc205('0x4a')]=qs[_0xc205('0x41')](_[_0xc205('0x4b')](_0x5751c3[_0xc205('0x40')],_0x56be7d[_0xc205('0x41')]),_0xbb8222);var _0x10c96b=[];var _0x4aed6e=squel[_0xc205('0x4c')]()['field']('id')['field']('name')['field'](_0xc205('0x4d'))[_0xc205('0x4e')](_0xc205('0x4f'));var _0x1a4f8f=squel[_0xc205('0x4c')]()['field'](_0xc205('0x50'))[_0xc205('0x51')](_0xc205('0x52'))['field'](_0xc205('0x53'))[_0xc205('0x4e')]('user_has_mail_interactions','ui')[_0xc205('0x54')](_0xc205('0x55'),'u','u.id\x20=\x20ui.UserId');var _0x22ad26=squel['select']()[_0xc205('0x4e')](_0xc205('0x56'),'i')[_0xc205('0x54')](_0xc205('0x57'),'c',_0xc205('0x58'))[_0xc205('0x54')]('users','o','o.id\x20=\x20i.UserId')[_0xc205('0x54')](_0xc205('0x59'),'a',_0xc205('0x5a'))[_0xc205('0x54')](_0xc205('0x5b'),'me',_0xc205('0x5c'))['left_join'](_0xc205('0x5d'),'it','it.MailInteractionId\x20=\x20i.id')[_0xc205('0x54')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x4d63e4=squel['expr']();var _0x1e0b07=[];var _0x4c30f7=squel['expr']();var _0x5018f7;if(_0x5751c3[_0xc205('0x40')][_0xc205('0x5e')]){_0x5018f7=as[_0xc205('0x5f')](_0x5751c3[_0xc205('0x40')][_0xc205('0x5e')]);var _0x4e1f8a=_0x5018f7[_0xc205('0x60')];for(var _0x4c132a=0x0;_0x4c132a<_0x5018f7[_0xc205('0x61')][_0xc205('0x45')];_0x4c132a++){var _0x129648=_0x5018f7['conditions'][_0x4c132a];var _0x48112c='i';var _0x4b0114=_[_0xc205('0x62')](_0xbb8222,[_0xc205('0x2e'),_0x129648['field']]);if(!_0x4b0114){switch(_0x129648[_0xc205('0x51')]){case'unreadMessages':if(_0x129648[_0xc205('0x63')]==0x1){_0x22ad26[_0xc205('0x64')]('`'+_0x129648[_0xc205('0x51')]+'`\x20=\x200');}else{_0x22ad26[_0xc205('0x64')]('`'+_0x129648['field']+_0xc205('0x65'));}break;case'Contact':if(_0x129648['operator']==='$substring'){if(_0x129648['value'][_0xc205('0x33')]('\x20')[_0xc205('0x45')]>0x1){_0x4d63e4[_0x4e1f8a](_0xc205('0x66'),qs[_0xc205('0x67')](_0x129648['value']),null);}else{var _0x4e6a8d='%'+_0x129648[_0xc205('0x63')]+'%';_0x4d63e4[_0x4e1f8a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4e6a8d,_0x4e6a8d,_0x4e6a8d);}}else{_0x4b0114=_[_0xc205('0x62')](_0xbb8222,[_0xc205('0x2e'),_0xc205('0x68')]);_0x129648[_0xc205('0x51')]='ContactId';_0x44b7c0=as[_0xc205('0x69')](_0x48112c,_0x4b0114[_0xc205('0x3e')],_0x129648);_0x4d63e4[_0x4e1f8a](_0x44b7c0[_0xc205('0x6a')],_0x44b7c0[_0xc205('0x63')][_0xc205('0x6b')],_0x44b7c0[_0xc205('0x63')][_0xc205('0x21')]);}break;case _0xc205('0x6c'):var _0x57c8d1=_0x129648[_0xc205('0x63')][_0xc205('0x33')](',')[_0xc205('0x30')](function(_0x3c83a7){return Number(_0x3c83a7);});_0x57c8d1[_0xc205('0x34')](function(_0x24ecf5){_0x4c30f7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x24ecf5+',%');});_0x1e0b07=_['union'](_0x1e0b07,_0x57c8d1);break;case _0xc205('0x6d'):if(_0x129648[_0xc205('0x6e')]===_0xc205('0x6f')){_0x4d63e4[_0x4e1f8a](_0xc205('0x70'),'%'+_0x129648[_0xc205('0x63')]+'%',null);}else{_0x4b0114=_[_0xc205('0x62')](_0xbb8222,['name',_0xc205('0x71')]);_0x129648[_0xc205('0x51')]=_0xc205('0x71');_0x44b7c0=as[_0xc205('0x69')](_0x48112c,_0x4b0114[_0xc205('0x3e')],_0x129648);_0x4d63e4[_0x4e1f8a](_0x44b7c0[_0xc205('0x6a')],_0x44b7c0[_0xc205('0x63')][_0xc205('0x6b')],_0x44b7c0[_0xc205('0x63')]['end']);}break;case _0xc205('0x72'):_0x44b7c0=as[_0xc205('0x69')]('me',null,_0x129648);_0x4d63e4[_0x4e1f8a](_0x44b7c0[_0xc205('0x6a')],_0x44b7c0['value'][_0xc205('0x6b')],_0x44b7c0[_0xc205('0x63')]['end']);break;}}else{var _0x44b7c0=as[_0xc205('0x69')](_0x48112c,_0x4b0114[_0xc205('0x3e')],_0x129648);_0x4d63e4[_0x4e1f8a](_0x44b7c0[_0xc205('0x6a')],_0x44b7c0['value'][_0xc205('0x6b')],_0x44b7c0[_0xc205('0x63')][_0xc205('0x21')]);}}}else{var _0x49884=_(_0x5751c3[_0xc205('0x40')])['keys']()[_0xc205('0x30')](function(_0x52df78){return _[_0xc205('0x73')](_0xbb8222,[_0xc205('0x2e'),_0x52df78])?_0x52df78:undefined;})[_0xc205('0x74')]()[_0xc205('0x63')]();if(!_['isEmpty'](_0x49884)){_0x49884['forEach'](function(_0x28c66a){if(_0x28c66a===_0xc205('0x75')){_0x22ad26[_0xc205('0x4a')](_0xc205('0x76'),[][_0xc205('0x77')](_0x5751c3['query'][_0x28c66a]));}else if(_0x28c66a===_0xc205('0x78')){var _0x1cbb0d=JSON[_0xc205('0x79')](_0x5751c3['query'][_0x28c66a])['$gte'];var _0x2cabb0=JSON[_0xc205('0x79')](_0x5751c3['query'][_0x28c66a])[_0xc205('0x7a')];_0x22ad26['where'](_0xc205('0x7b'),_0x1cbb0d,_0x2cabb0);}else{if(_0x5751c3[_0xc205('0x40')][_0x28c66a]===_0xc205('0x7c')){_0x22ad26['where']('i.'+_0x28c66a+_0xc205('0x7d'));}else{_0x22ad26[_0xc205('0x4a')]('i.'+_0x28c66a+_0xc205('0x7e'),_0x5751c3[_0xc205('0x40')][_0x28c66a]);}}});}if(_0x5751c3[_0xc205('0x40')][_0xc205('0x7f')]){if(_0x5751c3[_0xc205('0x40')][_0xc205('0x7f')]==0x1){_0x22ad26[_0xc205('0x64')](_0xc205('0x80'));}else{_0x22ad26['having'](_0xc205('0x81'));}}if(_0x5751c3[_0xc205('0x40')][_0xc205('0x82')]){_0x1e0b07=_[_0xc205('0x83')](_0x5751c3[_0xc205('0x40')][_0xc205('0x82')])?_0x5751c3[_0xc205('0x40')][_0xc205('0x82')]:new Array(_0x5751c3[_0xc205('0x40')]['tag']);_0x1e0b07[_0xc205('0x34')](function(_0x5f0998){_0x4c30f7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5f0998+',%');});}if(_0x5751c3[_0xc205('0x40')][_0xc205('0x84')]){var _0x410e7f=_0x5751c3['query'][_0xc205('0x84')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xc205('0x85')](_0x410e7f)){_0x4d63e4['or'](_0xc205('0x86'),_0x410e7f+'%');}else if(qs[_0xc205('0x87')](_0x410e7f)){_0x4d63e4['or'](_0xc205('0x88'),_0x410e7f+'%');}else{_0x4d63e4['or'](_0xc205('0x89'),qs[_0xc205('0x67')](_0x410e7f))['or'](_0xc205('0x8a'),qs[_0xc205('0x67')](_0x410e7f));}}}_0x22ad26['where'](_0x4d63e4);_0x22ad26[_0xc205('0x8b')](_0xc205('0x8c'));var _0x18e3f1={'type':db[_0xc205('0x8d')][_0xc205('0x8e')][_0xc205('0x8f')],'raw':!![]};var _0xde2cca=_0x22ad26['clone']();_0xde2cca[_0xc205('0x51')]('i.id');_0xde2cca[_0xc205('0x51')](_0xc205('0x90'),_0xc205('0x91'));if(_0x118ca8[_0xc205('0x48')]){_0x118ca8['order'][_0xc205('0x34')](function(_0x5f1069){var _0x4f911c=_0x5f1069[0x0]==='contactName'?_0x5f1069[0x0]:'i.'+_0x5f1069[0x0];_0x22ad26['order'](_0x4f911c,_0x5f1069[0x1]===_0xc205('0x92')?![]:!![]);});}if(!_['isEmpty'](_0x1e0b07)){_0x22ad26[_0xc205('0x64')](_0x4c30f7);_0xde2cca[_0xc205('0x4a')](_0xc205('0x93'),_0x1e0b07);}BPromise['resolve']()[_0xc205('0x2b')](function(){if(!_0x5018f7){if(_0x5751c3['query'][_0xc205('0x75')]||_0x5751c3[_0xc205('0x40')]['journey'])return;_0xde2cca[_0xc205('0x4a')](_0xc205('0x94'));_0x22ad26[_0xc205('0x4a')](_0xc205('0x94'));return;}if(_0x5751c3[_0xc205('0x95')][_0xc205('0x96')]!=='agent')return;return _0x5751c3[_0xc205('0x95')][_0xc205('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x7286f3){if(_[_0xc205('0x98')](_0x7286f3)){_0xde2cca[_0xc205('0x4a')](_0xc205('0x99'));_0x22ad26[_0xc205('0x4a')](_0xc205('0x99'));}else{_0xde2cca['where']('i.MailAccountId\x20IN\x20?',_['map'](_0x7286f3,'id'));_0x22ad26[_0xc205('0x4a')]('i.MailAccountId\x20IN\x20?',_['map'](_0x7286f3,'id'));}});})[_0xc205('0x2b')](function(){if(_0x5751c3[_0xc205('0x95')][_0xc205('0x96')]===_0xc205('0x9a')&&!_0x5018f7&&!_0x5751c3[_0xc205('0x40')]['MailAccountId'])return[];return db['sequelize'][_0xc205('0x40')](_0xde2cca['toString'](),_0x18e3f1);})[_0xc205('0x2b')](function(_0x8744f){_0x2fdad4[_0xc205('0x23')]=_0x8744f[_0xc205('0x45')];if(_0x2fdad4['count']===0x0)return[];return db[_0xc205('0x9b')][_0xc205('0x40')](_0x4aed6e[_0xc205('0x9c')](),_0x18e3f1)[_0xc205('0x2b')](function(_0x236c95){_0x10c96b=_[_0xc205('0x9d')](_0x236c95,'id');_0x18e3f1=_[_0xc205('0x9e')](_0x18e3f1,{'model':db[_0xc205('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5751c3[_0xc205('0x40')][_0xc205('0x43')]){_0x118ca8[_0xc205('0x44')]['forEach'](function(_0x1df61c){_0x22ad26[_0xc205('0x51')]('i.'+_0x1df61c);});}else{_0x22ad26[_0xc205('0x51')](_0xc205('0x90'),'unreadMessages');_0x22ad26[_0xc205('0x51')](_0xc205('0x9f'),_0xc205('0xa0'));_0x22ad26['field'](_0xc205('0xa1'),_0xc205('0xa2'));_0x22ad26[_0xc205('0x51')]('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',_0xc205('0xa3'));_0x22ad26[_0xc205('0x51')](_0xc205('0x8c'));_0x22ad26[_0xc205('0x51')](_0xc205('0xa4'));_0x22ad26[_0xc205('0x51')](_0xc205('0xa5'));_0x22ad26[_0xc205('0x51')](_0xc205('0xa6'));_0x22ad26[_0xc205('0x51')](_0xc205('0xa7'));_0x22ad26[_0xc205('0x51')](_0xc205('0xa8'));_0x22ad26[_0xc205('0x51')](_0xc205('0xa9'));_0x22ad26[_0xc205('0x51')](_0xc205('0xaa'));_0x22ad26[_0xc205('0x51')](_0xc205('0xab'));_0x22ad26[_0xc205('0x51')](_0xc205('0xac'));_0x22ad26[_0xc205('0x51')](_0xc205('0xad'));_0x22ad26[_0xc205('0x51')](_0xc205('0xae'));_0x22ad26['field'](_0xc205('0xaf'));_0x22ad26[_0xc205('0x51')](_0xc205('0xb0'));_0x22ad26[_0xc205('0x51')]('i.ContactId');_0x22ad26[_0xc205('0x51')](_0xc205('0xb1'));_0x22ad26['field'](_0xc205('0xb2'));_0x22ad26[_0xc205('0x51')]('c.firstName','Contact.firstName');_0x22ad26[_0xc205('0x51')](_0xc205('0xb3'),'Contact.lastName');_0x22ad26[_0xc205('0x51')](_0xc205('0xb4'),_0xc205('0xb5'));_0x22ad26['field'](_0xc205('0xb6'),'Contact.phone');_0x22ad26[_0xc205('0x51')](_0xc205('0xb7'),'Contact.mobile');_0x22ad26[_0xc205('0x51')]('c.fax',_0xc205('0xb8'));_0x22ad26[_0xc205('0x51')](_0xc205('0xb9'),_0xc205('0xba'));_0x22ad26[_0xc205('0x51')](_0xc205('0xbb'),'Owner.internal');_0x22ad26[_0xc205('0x51')](_0xc205('0xbc'),'TagIds');}if(_0x118ca8['limit'])_0x22ad26[_0xc205('0x25')](_0x118ca8['limit']);if(_0x118ca8[_0xc205('0x24')])_0x22ad26[_0xc205('0x24')](_0x118ca8[_0xc205('0x24')]);return db['sequelize']['query'](_0x22ad26[_0xc205('0x9c')](),_0x18e3f1);})[_0xc205('0x2b')](function(_0x3152c6){_0x1a4f8f[_0xc205('0x4a')](_0xc205('0xbd'),_[_0xc205('0x30')](_0x3152c6,'id'));return db[_0xc205('0x9b')][_0xc205('0x40')](_0x1a4f8f[_0xc205('0x9c')](),_0x18e3f1)[_0xc205('0x2b')](function(_0x5630b6){var _0x298317=_[_0xc205('0xbe')](_0x5630b6,_0xc205('0xbf'));var _0x3fb044=[];return db[_0xc205('0xc0')][_0xc205('0x37')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x32a7cb){var _0x14aa01=_0x32a7cb[_0xc205('0xc1')];_0x3152c6[_0xc205('0x34')](function(_0x416f14){_0x3fb044['push'](updateMailInteraction(_0x416f14,_0x10c96b,_0x298317,_0x14aa01));});return BPromise[_0xc205('0xc2')](_0x3fb044);});});});})[_0xc205('0x2b')](function(_0xb3ba1e){_0x2fdad4[_0xc205('0xc3')]=_0xb3ba1e;return _0x2fdad4;})[_0xc205('0x2b')](respondWithFilteredResult(_0x539dab,_0x118ca8))[_0xc205('0xc4')](handleError(_0x539dab,null));};exports['show']=function(_0x96b585,_0x3af1f4){var _0x54fcb0={'raw':![],'where':{'id':_0x96b585[_0xc205('0xc5')]['id']}},_0x121d64={};_0x121d64['model']=_[_0xc205('0xc6')](db[_0xc205('0x36')][_0xc205('0xc7')]);_0x121d64['query']=_[_0xc205('0xc6')](_0x96b585[_0xc205('0x40')]);_0x121d64[_0xc205('0x41')]=_['intersection'](_0x121d64['model'],_0x121d64[_0xc205('0x40')]);_0x54fcb0['attributes']=_[_0xc205('0x42')](_0x121d64[_0xc205('0x3f')],qs['fields'](_0x96b585[_0xc205('0x40')][_0xc205('0x43')]));_0x54fcb0[_0xc205('0x44')]=_0x54fcb0[_0xc205('0x44')][_0xc205('0x45')]?_0x54fcb0['attributes']:_0x121d64[_0xc205('0x3f')];if(_0x96b585[_0xc205('0x40')][_0xc205('0xc8')]){_0x54fcb0[_0xc205('0xc9')]=[{'all':!![]}];}_0x54fcb0=_[_0xc205('0x9e')]({},_0x54fcb0,_0x96b585[_0xc205('0xca')]);return db[_0xc205('0x36')][_0xc205('0x62')](_0x54fcb0)[_0xc205('0x2b')](handleEntityNotFound(_0x3af1f4,null))[_0xc205('0x2b')](respondWithResult(_0x3af1f4,null))['catch'](handleError(_0x3af1f4,null));};exports[_0xc205('0xcb')]=function(_0xcf69b,_0x35776c){return db['MailInteraction'][_0xc205('0xcb')](_0xcf69b[_0xc205('0xcc')],{})[_0xc205('0x2b')](respondWithResult(_0x35776c,0xc9))[_0xc205('0xc4')](handleError(_0x35776c,null));};exports[_0xc205('0x2a')]=function(_0x498116,_0xa1b49c){if(_0x498116[_0xc205('0xcc')]['id']){delete _0x498116[_0xc205('0xcc')]['id'];}return db[_0xc205('0x36')][_0xc205('0x62')]({'where':{'id':_0x498116[_0xc205('0xc5')]['id']}})[_0xc205('0x2b')](handleEntityNotFound(_0xa1b49c,null))['then'](saveUpdates(_0x498116[_0xc205('0xcc')],null))['then'](respondWithResult(_0xa1b49c,null))[_0xc205('0xc4')](handleError(_0xa1b49c,null));};exports[_0xc205('0x2c')]=function(_0x2414e4,_0x153cd3){return db[_0xc205('0x36')]['find']({'where':{'id':_0x2414e4[_0xc205('0xc5')]['id']}})[_0xc205('0x2b')](handleEntityNotFound(_0x153cd3,null))['then'](removeEntity(_0x153cd3,null))[_0xc205('0xc4')](handleError(_0x153cd3,null));};exports[_0xc205('0xcd')]=function(_0x527950,_0xbfbd6){return db['MailInteraction'][_0xc205('0xcd')]()['then'](respondWithResult(_0xbfbd6,null))[_0xc205('0xc4')](handleError(_0xbfbd6,null));};exports[_0xc205('0xce')]=function(_0x3a1058,_0x40cb13,_0x58fc8b){return db[_0xc205('0xcf')][_0xc205('0x62')]({'where':{'id':_0x3a1058[_0xc205('0xc5')]['id']}})['then'](handleEntityNotFound(_0x40cb13,null))[_0xc205('0x2b')](function(_0x4dc890){if(_0x4dc890){return _0x4dc890[_0xc205('0xce')](_0x3a1058['body'][_0xc205('0xd0')],_['omit'](_0x3a1058[_0xc205('0xcc')],['ids','id'])||{});}})[_0xc205('0x2b')](respondWithResult(_0x40cb13,null))[_0xc205('0xc4')](handleError(_0x40cb13,null));};exports[_0xc205('0xd1')]=function(_0x2177e0,_0x370660,_0x41e88f){var _0x5994bf={'raw':![],'where':{}};var _0x28e9e0={};var _0x431471={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x2177e0[_0xc205('0xc5')]['id']}})['then'](handleEntityNotFound(_0x370660,null))[_0xc205('0x2b')](function(_0x218199){if(_0x218199){_0x28e9e0['model']=_['keys'](db[_0xc205('0xcf')][_0xc205('0xc7')]);_0x28e9e0[_0xc205('0x40')]=_[_0xc205('0xc6')](_0x2177e0[_0xc205('0x40')]);_0x28e9e0['filters']=_[_0xc205('0x42')](_0x28e9e0['model'],_0x28e9e0[_0xc205('0x40')]);_0x5994bf[_0xc205('0x44')]=_[_0xc205('0x42')](_0x28e9e0[_0xc205('0x3f')],qs['fields'](_0x2177e0[_0xc205('0x40')]['fields']));_0x5994bf[_0xc205('0x44')]=_0x5994bf[_0xc205('0x44')][_0xc205('0x45')]?_0x5994bf[_0xc205('0x44')]:_0x28e9e0['model'];if(!_0x2177e0['query'][_0xc205('0x46')]('nolimit')){_0x5994bf['limit']=qs[_0xc205('0x25')](_0x2177e0[_0xc205('0x40')][_0xc205('0x25')]);_0x5994bf[_0xc205('0x24')]=qs[_0xc205('0x24')](_0x2177e0[_0xc205('0x40')]['offset']);}_0x5994bf['order']=qs[_0xc205('0x49')](_0x2177e0[_0xc205('0x40')]['sort']);_0x5994bf[_0xc205('0x4a')]=qs['filters'](_['pick'](_0x2177e0['query'],_0x28e9e0[_0xc205('0x41')]));_0x5994bf[_0xc205('0x4a')][_0xc205('0xbf')]=_0x218199['id'];if(_0x2177e0[_0xc205('0x40')][_0xc205('0x84')]){_0x5994bf[_0xc205('0x4a')]=_[_0xc205('0x9e')](_0x5994bf[_0xc205('0x4a')],{'$or':_[_0xc205('0x30')](_0x5994bf[_0xc205('0x44')],function(_0x32050f){var _0x57d52b={};_0x57d52b[_0x32050f]={'$like':'%'+_0x2177e0['query']['filter']+'%'};return _0x57d52b;})});}if(_0x2177e0['query'][_0xc205('0xd2')]){var _0x5eb281=_0x2177e0[_0xc205('0x40')][_0xc205('0xd2')]['split'](',');var _0x4a4613={};_0x4a4613[_0x5eb281[0x0]]={'$gte':moment(_0x5eb281[0x1])[_0xc205('0xd3')](_0xc205('0xd4'))};_0x5994bf[_0xc205('0x4a')]=_['merge'](_0x5994bf[_0xc205('0x4a')],_0x4a4613);}_0x5994bf=_[_0xc205('0x9e')]({},_0x5994bf,_0x2177e0[_0xc205('0xca')]);return db[_0xc205('0xcf')][_0xc205('0x23')]({'where':_0x5994bf['where']})[_0xc205('0x2b')](function(_0x233e70){_0x431471[_0xc205('0x23')]=_0x233e70;if(_0x2177e0[_0xc205('0x40')][_0xc205('0xc8')]){_0x5994bf[_0xc205('0xc9')]=[{'all':!![]}];}return db[_0xc205('0xcf')]['findAll'](_0x5994bf);})[_0xc205('0x2b')](function(_0x56a585){_0x431471['rows']=_0x56a585;return _0x431471;});}})[_0xc205('0x2b')](respondWithFilteredResult(_0x370660,_0x5994bf))[_0xc205('0xc4')](handleError(_0x370660,null));};exports['addTags']=function(_0x437392,_0x28cf58,_0x54d745){return db['MailInteraction'][_0xc205('0x62')]({'where':{'id':_0x437392[_0xc205('0xc5')]['id']}})[_0xc205('0x2b')](handleEntityNotFound(_0x28cf58,null))[_0xc205('0x2b')](function(_0x92fd8e){if(_0x92fd8e){return _0x92fd8e[_0xc205('0xd5')](_0x437392['body'][_0xc205('0xd0')],_[_0xc205('0xd6')](_0x437392[_0xc205('0xcc')],[_0xc205('0xd0'),'id'])||{})[_0xc205('0xd7')](function(){return db['Tag'][_0xc205('0xd8')]({'attributes':['id',_0xc205('0x2e'),_0xc205('0x4d')],'where':{'id':_0x437392['body'][_0xc205('0xd0')]}});})[_0xc205('0x2b')](function(_0x3ec697){socket[_0xc205('0xd9')](_0xc205('0xda'),{'id':Number(_0x437392['params']['id']),'tags':_0x3ec697||[]});return{'id':Number(_0x437392[_0xc205('0xc5')]['id']),'tags':_0x3ec697||[]};});}})[_0xc205('0x2b')](respondWithResult(_0x28cf58,null))[_0xc205('0xc4')](handleError(_0x28cf58,null));};exports[_0xc205('0xdb')]=function(_0x569c4c,_0x2481b6,_0xdc454e){return db[_0xc205('0x36')][_0xc205('0x62')]({'where':{'id':_0x569c4c['params']['id']}})[_0xc205('0x2b')](handleEntityNotFound(_0x2481b6,null))['then'](function(_0x240a54){if(_0x240a54){return _0x240a54[_0xc205('0xdb')](_0x569c4c[_0xc205('0x40')][_0xc205('0xd0')]);}})[_0xc205('0x2b')](respondWithStatusCode(_0x2481b6,null))['catch'](handleError(_0x2481b6,null));};exports[_0xc205('0xdc')]=function(_0x14abb3,_0x3d29f6){var _0x4f11af=moment()[_0xc205('0xdd')]()[_0xc205('0x9c')]();var _0x22ce0a=path[_0xc205('0xde')](config[_0xc205('0xdf')],_0xc205('0xe0'),_0xc205('0xe1'),'tmp');var _0x19195a=path[_0xc205('0xde')](config[_0xc205('0xdf')],_0xc205('0xe0'),_0xc205('0xe1'),'attachments');var _0x3789c9=path['join'](_0x22ce0a,_0x4f11af);var _0xb24577=util[_0xc205('0xd3')]('transcript-%d-%s.zip',_0x14abb3[_0xc205('0xc5')]['id'],_0x4f11af);var _0x287fcd=path['join'](_0x22ce0a,_0xb24577);var _0x5a47b1=[];if(_0x14abb3[_0xc205('0x40')]['attachments']){_0x5a47b1[_0xc205('0x35')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x4909d4=[{'model':db['MailMessage'],'as':_0xc205('0xe2'),'attributes':['id',_0xc205('0xcc'),_0xc205('0x4e'),'to','cc',_0xc205('0xe3'),'subject',_0xc205('0x78')],'where':{'secret':![]},'order':qs[_0xc205('0x49')]('id'),'include':_0x5a47b1}];return db['MailInteraction'][_0xc205('0x62')]({'where':{'id':_0x14abb3[_0xc205('0xc5')]['id']},'include':_0x4909d4})['then'](handleEntityNotFound(_0x3d29f6,null))['then'](function(_0x3fa981){if(_0x3fa981&&_0x3fa981['Messages']){var _0x30eb76=_0x3fa981[_0xc205('0xe4')]({'plain':!![]});fs[_0xc205('0xe5')](_0x3789c9);return BPromise[_0xc205('0xe6')](_0x30eb76[_0xc205('0xe2')],function(_0x2a47bb,_0xa6f7e5){var _0xfd6100={'from':_0x2a47bb['from'],'to':_0x2a47bb['to'],'subject':_0x2a47bb[_0xc205('0xe7')],'html':_0x2a47bb[_0xc205('0xcc')],'headers':{'Date':moment(_0x2a47bb[_0xc205('0x78')])[_0xc205('0xd3')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x2a47bb['cc']){_0xfd6100[_0xc205('0xe8')]['Cc']=_0x2a47bb['cc'];}if(_0x2a47bb['bcc']){_0xfd6100[_0xc205('0xe8')][_0xc205('0xe9')]=_0x2a47bb['bcc'];}return new BPromise(function(_0x38ea0f,_0x3d370f){if(_0x2a47bb[_0xc205('0xea')]){for(var _0x1586cb=0x0;_0x1586cb<_0x2a47bb[_0xc205('0xea')][_0xc205('0x45')];_0x1586cb++){var _0x6b4ab9=_0x2a47bb['Attachments'][_0x1586cb];var _0x4ad603=path[_0xc205('0xde')](_0x19195a,_0x6b4ab9['basename']);if(fs['existsSync'](_0x4ad603)){_0xfd6100[_0xc205('0xeb')][_0xc205('0x35')]({'name':_0x6b4ab9[_0xc205('0x2e')],'contentType':_0x6b4ab9[_0xc205('0x3e')],'data':fs['readFileSync'](_0x4ad603)});}}}emlformat[_0xc205('0xec')](_0xfd6100,function(_0x5cacd0,_0x309fd0){if(_0x5cacd0)return _0x3d370f(_0x5cacd0);fs['writeFileSync'](path[_0xc205('0xde')](_0x3789c9,util[_0xc205('0xd3')](_0xc205('0xed'),_0xa6f7e5)),_0x309fd0);return _0x38ea0f(_0x309fd0);});});})[_0xc205('0x2b')](function(){return new BPromise(function(_0x36eccd,_0x47d9fa){zipdir(_0x3789c9,{'saveTo':_0x287fcd},function(_0x3bb079,_0xcde86c){if(_0x3bb079)return _0x47d9fa(_0x3bb079);return _0x36eccd(_0xcde86c);});})['then'](function(){return new BPromise(function(_0x4ef0d9,_0xc2a7f4){rimraf(_0x3789c9,function(_0x57973b){if(_0x57973b)_0xc2a7f4(_0x57973b);return _0x4ef0d9();});});})['then'](function(){return _0x3d29f6[_0xc205('0xdc')](_0x287fcd,_0xb24577,function(_0x562f95){if(_0x562f95){console[_0xc205('0xee')](_0xc205('0xef'),_0x562f95);}else{fs['unlinkSync'](_0x287fcd);}});});});}else{return _0x3d29f6['sendStatus'](0xc8);}})[_0xc205('0xc4')](handleError(_0x3d29f6,null));}; \ No newline at end of file +var _0xaafe=['filter','isNumeric','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','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','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','params','includeAll','options','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','color','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','format','transcript-%d-%s.zip','attachments','Attachment','Attachments','subject','Messages','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','send','Users','fullname','TagIds','Tags','split','forEach','push','MailInteraction','lastMsgText','trimStart','lastMsgBody','catch','rawAttributes','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','field','from','select','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','name','unreadMessages','value','having','`\x20>\x200','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','plainBody','keys','some','compact','isEmpty','MailAccountId','concat','createdAt','parse','$lte','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray'];(function(_0x61b4bb,_0x8431c8){var _0x242a00=function(_0x362ea3){while(--_0x362ea3){_0x61b4bb['push'](_0x61b4bb['shift']());}};_0x242a00(++_0x8431c8);}(_0xaafe,0x174));var _0xeaaf=function(_0x426672,_0x2c9373){_0x426672=_0x426672-0x0;var _0x562407=_0xaafe[_0x426672];return _0x562407;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xeaaf('0x0'));var zipdir=require(_0xeaaf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeaaf('0x2'));var moment=require(_0xeaaf('0x3'));var BPromise=require(_0xeaaf('0x4'));var Mustache=require('mustache');var util=require(_0xeaaf('0x5'));var path=require('path');var sox=require(_0xeaaf('0x6'));var csv=require(_0xeaaf('0x7'));var ejs=require(_0xeaaf('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeaaf('0x9'));var crypto=require('crypto');var jsforce=require(_0xeaaf('0xa'));var deskjs=require(_0xeaaf('0xb'));var toCsv=require('to-csv');var querystring=require(_0xeaaf('0xc'));var Papa=require(_0xeaaf('0xd'));var htmlToText=require(_0xeaaf('0xe'));var Redis=require(_0xeaaf('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeaaf('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeaaf('0x11'))(_0xeaaf('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeaaf('0x13'));var db=require(_0xeaaf('0x14'))['db'];config[_0xeaaf('0x15')]=_[_0xeaaf('0x16')](config[_0xeaaf('0x15')],{'host':_0xeaaf('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeaaf('0x15')]));require(_0xeaaf('0x18'))[_0xeaaf('0x19')](socket);function respondWithStatusCode(_0x5a411,_0x22ba3e){_0x22ba3e=_0x22ba3e||0xcc;return function(_0x1d6386){if(_0x1d6386){return _0x5a411['sendStatus'](_0x22ba3e);}return _0x5a411['status'](_0x22ba3e)[_0xeaaf('0x1a')]();};}function respondWithResult(_0x2805c3,_0x5398a6){_0x5398a6=_0x5398a6||0xc8;return function(_0x8396ff){if(_0x8396ff){return _0x2805c3['status'](_0x5398a6)[_0xeaaf('0x1b')](_0x8396ff);}};}function respondWithFilteredResult(_0x4f6bd3,_0x5184c5){return function(_0x595741){if(_0x595741){var _0x435bb9=_0x595741[_0xeaaf('0x1c')],_0x10eebf=_0x5184c5[_0xeaaf('0x1d')],_0xaace48=_0x5184c5[_0xeaaf('0x1d')]+_0x5184c5[_0xeaaf('0x1e')],_0x44fff9;if(_0xaace48>=_0x435bb9){_0xaace48=_0x435bb9;_0x44fff9=0xc8;}else{_0x44fff9=0xce;}_0x4f6bd3[_0xeaaf('0x1f')](_0x44fff9);return _0x4f6bd3['set'](_0xeaaf('0x20'),_0x10eebf+'-'+_0xaace48+'/'+_0x435bb9)['json'](_0x595741);}return null;};}function patchUpdates(_0x484848){return function(_0x16079f){try{jsonpatch[_0xeaaf('0x21')](_0x16079f,_0x484848,!![]);}catch(_0x10603e){return BPromise[_0xeaaf('0x22')](_0x10603e);}return _0x16079f[_0xeaaf('0x23')]();};}function saveUpdates(_0x4d045e,_0x13c3e8){return function(_0x3475b2){if(_0x3475b2){return _0x3475b2[_0xeaaf('0x24')](_0x4d045e)[_0xeaaf('0x25')](function(_0x414dff){return _0x414dff;});}return null;};}function removeEntity(_0x1eddad,_0x136d91){return function(_0x58970a){if(_0x58970a){return _0x58970a[_0xeaaf('0x26')]()['then'](function(){_0x1eddad[_0xeaaf('0x1f')](0xcc)[_0xeaaf('0x1a')]();});}};}function handleEntityNotFound(_0x3678f1,_0x574832){return function(_0x5caad0){if(!_0x5caad0){_0x3678f1[_0xeaaf('0x27')](0x194);}return _0x5caad0;};}function handleError(_0x1fbabb,_0x31993e){_0x31993e=_0x31993e||0x1f4;return function(_0x1721f3){logger[_0xeaaf('0x28')](_0x1721f3['stack']);if(_0x1721f3['name']){delete _0x1721f3['name'];}_0x1fbabb[_0xeaaf('0x1f')](_0x31993e)[_0xeaaf('0x29')](_0x1721f3);};}function getInteractionUsers(_0x3e8155,_0x296004){return new BPromise(function(_0x3bf510,_0x21c695){try{if(_0x296004[_0x3e8155['id']]){_0x3e8155[_0xeaaf('0x2a')]=_['map'](_0x296004[_0x3e8155['id']],function(_0x2619c4){return{'id':_0x2619c4['id'],'fullname':_0x2619c4[_0xeaaf('0x2b')]};});}}catch(_0x53ae14){_0x21c695(_0x53ae14);}_0x3bf510(_0x3e8155);});}function getInteractionTags(_0xd99041,_0x4faf8f){return new BPromise(function(_0x168a17,_0x4ef0ad){try{if(_0xd99041[_0xeaaf('0x2c')]){_0xd99041[_0xeaaf('0x2d')]=[];_0xd99041[_0xeaaf('0x2c')][_0xeaaf('0x2e')](',')[_0xeaaf('0x2f')](function(_0x2fe710){_0xd99041[_0xeaaf('0x2d')][_0xeaaf('0x30')](_0x4faf8f[_0x2fe710]);});}delete _0xd99041['TagIds'];}catch(_0x556ff8){_0x4ef0ad(_0x556ff8);}_0x168a17(_0xd99041);});}function getLastMessageText(_0x2dadd5){return new BPromise(function(_0x2d8124,_0x5423cb){return db[_0xeaaf('0x31')]['findOne']({'where':{'id':_0x2dadd5['id']},'attributes':['lastMsgBody',_0xeaaf('0x32')],'raw':!![]})['then'](function(_0x192335){if(!_0x192335['lastMsgText']){_0x2dadd5[_0xeaaf('0x32')]=_[_0xeaaf('0x33')](htmlToText['fromString'](_0x192335[_0xeaaf('0x34')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2dadd5['lastMsgText']=_0x192335['lastMsgText'];}_0x2d8124(_0x2dadd5);})[_0xeaaf('0x35')](function(_0xcb9c51){_0x5423cb(_0xcb9c51);});});}function updateMailInteraction(_0x39903c,_0x4a43f9,_0x384d17,_0x3d4330){return new BPromise(function(_0x43d55b,_0x4ded3f){return getInteractionUsers(_0x39903c,_0x384d17)[_0xeaaf('0x25')](function(_0x3561c2){return getInteractionTags(_0x3561c2,_0x4a43f9);})[_0xeaaf('0x25')](function(_0x481d54){if(_0x3d4330){_0x43d55b(getLastMessageText(_0x481d54));}else{_0x43d55b(_0x481d54);}})[_0xeaaf('0x35')](function(_0xd6572b){_0x4ded3f(_0xd6572b);});});}exports['index']=function(_0x59afc5,_0x40ea59){var _0x38db2a={},_0x1ab485={},_0x3bfe23={'count':0x0,'rows':[]};var _0x5b5e99=_['map'](db['MailInteraction'][_0xeaaf('0x36')],function(_0x3f310d){return{'name':_0x3f310d['fieldName'],'type':_0x3f310d[_0xeaaf('0x37')]['key']};});_0x1ab485[_0xeaaf('0x38')]=_[_0xeaaf('0x39')](_0x5b5e99,'name');_0x1ab485[_0xeaaf('0x3a')]=_['keys'](_0x59afc5[_0xeaaf('0x3a')]);_0x1ab485[_0xeaaf('0x3b')]=_['intersection'](_0x1ab485[_0xeaaf('0x38')],_0x1ab485[_0xeaaf('0x3a')]);_0x38db2a[_0xeaaf('0x3c')]=_[_0xeaaf('0x3d')](_0x1ab485[_0xeaaf('0x38')],qs['fields'](_0x59afc5[_0xeaaf('0x3a')][_0xeaaf('0x3e')]));_0x38db2a['attributes']=_0x38db2a[_0xeaaf('0x3c')][_0xeaaf('0x3f')]?_0x38db2a[_0xeaaf('0x3c')]:_0x1ab485['model'];if(!_0x59afc5[_0xeaaf('0x3a')][_0xeaaf('0x40')]('nolimit')){_0x38db2a[_0xeaaf('0x1e')]=qs[_0xeaaf('0x1e')](_0x59afc5[_0xeaaf('0x3a')]['limit']);_0x38db2a[_0xeaaf('0x1d')]=qs[_0xeaaf('0x1d')](_0x59afc5['query'][_0xeaaf('0x1d')]);}_0x38db2a[_0xeaaf('0x41')]=qs[_0xeaaf('0x42')](_0x59afc5[_0xeaaf('0x3a')][_0xeaaf('0x42')]);_0x38db2a['where']=qs[_0xeaaf('0x3b')](_[_0xeaaf('0x43')](_0x59afc5['query'],_0x1ab485[_0xeaaf('0x3b')]),_0x5b5e99);var _0x2eb27f=[];var _0x360137=squel['select']()[_0xeaaf('0x44')]('id')['field']('name')[_0xeaaf('0x44')]('color')[_0xeaaf('0x45')]('tools_tags');var _0x3e4702=squel[_0xeaaf('0x46')]()[_0xeaaf('0x44')](_0xeaaf('0x47'))[_0xeaaf('0x44')](_0xeaaf('0x48'))['field'](_0xeaaf('0x49'))[_0xeaaf('0x45')](_0xeaaf('0x4a'),'ui')[_0xeaaf('0x4b')](_0xeaaf('0x4c'),'u','u.id\x20=\x20ui.UserId');var _0x1bc91c=squel[_0xeaaf('0x46')]()[_0xeaaf('0x45')](_0xeaaf('0x4d'),'i')['left_join']('cm_contacts','c',_0xeaaf('0x4e'))[_0xeaaf('0x4b')]('users','o',_0xeaaf('0x4f'))[_0xeaaf('0x4b')]('mail_accounts','a',_0xeaaf('0x50'))[_0xeaaf('0x4b')](_0xeaaf('0x51'),'me',_0xeaaf('0x52'))[_0xeaaf('0x4b')](_0xeaaf('0x53'),'it',_0xeaaf('0x54'))[_0xeaaf('0x4b')](_0xeaaf('0x55'),'t',_0xeaaf('0x56'));var _0x2fa75e=squel[_0xeaaf('0x57')]();var _0x3719eb=[];var _0x273548=squel[_0xeaaf('0x57')]();var _0xb935ea;if(_0x59afc5['query']['search']){_0xb935ea=as[_0xeaaf('0x58')](_0x59afc5['query'][_0xeaaf('0x59')]);var _0x56befd=_0xb935ea[_0xeaaf('0x5a')];for(var _0x541897=0x0;_0x541897<_0xb935ea['conditions']['length'];_0x541897++){var _0x4fea55=_0xb935ea[_0xeaaf('0x5b')][_0x541897];var _0x26e1c4='i';var _0x2cf585=_[_0xeaaf('0x5c')](_0x5b5e99,[_0xeaaf('0x5d'),_0x4fea55[_0xeaaf('0x44')]]);if(!_0x2cf585){switch(_0x4fea55['field']){case _0xeaaf('0x5e'):if(_0x4fea55[_0xeaaf('0x5f')]==0x1){_0x1bc91c[_0xeaaf('0x60')]('`'+_0x4fea55['field']+'`\x20=\x200');}else{_0x1bc91c['having']('`'+_0x4fea55[_0xeaaf('0x44')]+_0xeaaf('0x61'));}break;case _0xeaaf('0x62'):if(_0x4fea55['operator']===_0xeaaf('0x63')){if(_0x4fea55[_0xeaaf('0x5f')]['split']('\x20')[_0xeaaf('0x3f')]>0x1){_0x2fa75e[_0x56befd]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4fea55[_0xeaaf('0x5f')]),null);}else{var _0x51fe57='%'+_0x4fea55[_0xeaaf('0x5f')]+'%';_0x2fa75e[_0x56befd](_0xeaaf('0x64'),_0x51fe57,_0x51fe57,_0x51fe57);}}else{_0x2cf585=_[_0xeaaf('0x5c')](_0x5b5e99,[_0xeaaf('0x5d'),_0xeaaf('0x65')]);_0x4fea55[_0xeaaf('0x44')]=_0xeaaf('0x65');_0x62bc49=as[_0xeaaf('0x66')](_0x26e1c4,_0x2cf585[_0xeaaf('0x37')],_0x4fea55);_0x2fa75e[_0x56befd](_0x62bc49[_0xeaaf('0x67')],_0x62bc49[_0xeaaf('0x5f')][_0xeaaf('0x68')],_0x62bc49[_0xeaaf('0x5f')][_0xeaaf('0x1a')]);}break;case _0xeaaf('0x69'):var _0x35047e=_0x4fea55[_0xeaaf('0x5f')][_0xeaaf('0x2e')](',')[_0xeaaf('0x39')](function(_0x73128b){return Number(_0x73128b);});_0x35047e[_0xeaaf('0x2f')](function(_0xa48055){_0x273548['or'](_0xeaaf('0x6a'),'%,'+_0xa48055+',%');});_0x3719eb=_[_0xeaaf('0x6b')](_0x3719eb,_0x35047e);break;case _0xeaaf('0x6c'):if(_0x4fea55[_0xeaaf('0x6d')]===_0xeaaf('0x63')){_0x2fa75e[_0x56befd]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4fea55[_0xeaaf('0x5f')]+'%',null);}else{_0x2cf585=_[_0xeaaf('0x5c')](_0x5b5e99,['name','UserId']);_0x4fea55[_0xeaaf('0x44')]=_0xeaaf('0x6e');_0x62bc49=as[_0xeaaf('0x66')](_0x26e1c4,_0x2cf585['type'],_0x4fea55);_0x2fa75e[_0x56befd](_0x62bc49[_0xeaaf('0x67')],_0x62bc49['value'][_0xeaaf('0x68')],_0x62bc49[_0xeaaf('0x5f')][_0xeaaf('0x1a')]);}break;case _0xeaaf('0x6f'):_0x62bc49=as['buildExpression']('me',null,_0x4fea55);_0x2fa75e[_0x56befd](_0x62bc49[_0xeaaf('0x67')],_0x62bc49['value'][_0xeaaf('0x68')],_0x62bc49['value']['end']);break;}}else{var _0x62bc49=as['buildExpression'](_0x26e1c4,_0x2cf585[_0xeaaf('0x37')],_0x4fea55);_0x2fa75e[_0x56befd](_0x62bc49[_0xeaaf('0x67')],_0x62bc49[_0xeaaf('0x5f')][_0xeaaf('0x68')],_0x62bc49['value']['end']);}}}else{var _0x13ee58=_(_0x59afc5[_0xeaaf('0x3a')])[_0xeaaf('0x70')]()['map'](function(_0x4410ce){return _[_0xeaaf('0x71')](_0x5b5e99,[_0xeaaf('0x5d'),_0x4410ce])?_0x4410ce:undefined;})[_0xeaaf('0x72')]()[_0xeaaf('0x5f')]();if(!_[_0xeaaf('0x73')](_0x13ee58)){_0x13ee58[_0xeaaf('0x2f')](function(_0x54bb48){if(_0x54bb48===_0xeaaf('0x74')){_0x1bc91c['where']('i.MailAccountId\x20IN\x20?',[][_0xeaaf('0x75')](_0x59afc5[_0xeaaf('0x3a')][_0x54bb48]));}else if(_0x54bb48===_0xeaaf('0x76')){var _0x471dc3=JSON[_0xeaaf('0x77')](_0x59afc5[_0xeaaf('0x3a')][_0x54bb48])['$gte'];var _0x35d8b1=JSON[_0xeaaf('0x77')](_0x59afc5[_0xeaaf('0x3a')][_0x54bb48])[_0xeaaf('0x78')];_0x1bc91c['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x471dc3,_0x35d8b1);}else{if(_0x59afc5[_0xeaaf('0x3a')][_0x54bb48]===_0xeaaf('0x79')){_0x1bc91c[_0xeaaf('0x7a')]('i.'+_0x54bb48+_0xeaaf('0x7b'));}else{_0x1bc91c[_0xeaaf('0x7a')]('i.'+_0x54bb48+_0xeaaf('0x7c'),_0x59afc5['query'][_0x54bb48]);}}});}if(_0x59afc5[_0xeaaf('0x3a')][_0xeaaf('0x7d')]){if(_0x59afc5[_0xeaaf('0x3a')][_0xeaaf('0x7d')]==0x1){_0x1bc91c['having'](_0xeaaf('0x7e'));}else{_0x1bc91c['having'](_0xeaaf('0x7f'));}}if(_0x59afc5[_0xeaaf('0x3a')][_0xeaaf('0x80')]){_0x3719eb=_[_0xeaaf('0x81')](_0x59afc5[_0xeaaf('0x3a')][_0xeaaf('0x80')])?_0x59afc5[_0xeaaf('0x3a')]['tag']:new Array(_0x59afc5['query'][_0xeaaf('0x80')]);_0x3719eb[_0xeaaf('0x2f')](function(_0x52696a){_0x273548['or'](_0xeaaf('0x6a'),'%,'+_0x52696a+',%');});}if(_0x59afc5[_0xeaaf('0x3a')]['filter']){var _0x32c473=_0x59afc5[_0xeaaf('0x3a')][_0xeaaf('0x82')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xeaaf('0x83')](_0x32c473)){_0x2fa75e['or']('i.id\x20LIKE\x20?',_0x32c473+'%');}else if(qs[_0xeaaf('0x84')](_0x32c473)){_0x2fa75e['or']('c.email\x20LIKE\x20?',_0x32c473+'%');}else{_0x2fa75e['or'](_0xeaaf('0x85'),qs[_0xeaaf('0x86')](_0x32c473))['or'](_0xeaaf('0x87'),qs[_0xeaaf('0x86')](_0x32c473));}}}_0x1bc91c[_0xeaaf('0x7a')](_0x2fa75e);_0x1bc91c[_0xeaaf('0x88')](_0xeaaf('0x89'));var _0x2d08df={'type':db[_0xeaaf('0x8a')][_0xeaaf('0x8b')][_0xeaaf('0x8c')],'raw':!![]};var _0x48de2c=_0x1bc91c[_0xeaaf('0x8d')]();_0x48de2c[_0xeaaf('0x44')]('i.id');_0x48de2c[_0xeaaf('0x44')](_0xeaaf('0x8e'),_0xeaaf('0x5e'));if(_0x38db2a[_0xeaaf('0x41')]){_0x38db2a[_0xeaaf('0x41')]['forEach'](function(_0x231747){var _0x281753=_0x231747[0x0]===_0xeaaf('0x8f')?_0x231747[0x0]:'i.'+_0x231747[0x0];_0x1bc91c[_0xeaaf('0x41')](_0x281753,_0x231747[0x1]===_0xeaaf('0x90')?![]:!![]);});}if(!_[_0xeaaf('0x73')](_0x3719eb)){_0x1bc91c[_0xeaaf('0x60')](_0x273548);_0x48de2c['where'](_0xeaaf('0x91'),_0x3719eb);}BPromise[_0xeaaf('0x92')]()[_0xeaaf('0x25')](function(){if(!_0xb935ea){if(_0x59afc5[_0xeaaf('0x3a')][_0xeaaf('0x74')]||_0x59afc5[_0xeaaf('0x3a')][_0xeaaf('0x93')])return;_0x48de2c[_0xeaaf('0x7a')](_0xeaaf('0x94'));_0x1bc91c[_0xeaaf('0x7a')](_0xeaaf('0x94'));return;}if(_0x59afc5[_0xeaaf('0x95')][_0xeaaf('0x96')]!==_0xeaaf('0x97'))return;return _0x59afc5[_0xeaaf('0x95')][_0xeaaf('0x98')]({'attributes':['id'],'raw':!![]})['then'](function(_0x231468){if(_[_0xeaaf('0x73')](_0x231468)){_0x48de2c[_0xeaaf('0x7a')](_0xeaaf('0x99'));_0x1bc91c['where'](_0xeaaf('0x99'));}else{_0x48de2c[_0xeaaf('0x7a')](_0xeaaf('0x9a'),_[_0xeaaf('0x39')](_0x231468,'id'));_0x1bc91c['where'](_0xeaaf('0x9a'),_[_0xeaaf('0x39')](_0x231468,'id'));}});})[_0xeaaf('0x25')](function(){if(_0x59afc5['user'][_0xeaaf('0x96')]==='agent'&&!_0xb935ea&&!_0x59afc5['query']['MailAccountId'])return[];return db['sequelize']['query'](_0x48de2c[_0xeaaf('0x9b')](),_0x2d08df);})[_0xeaaf('0x25')](function(_0x5d6e98){_0x3bfe23[_0xeaaf('0x1c')]=_0x5d6e98['length'];if(_0x3bfe23[_0xeaaf('0x1c')]===0x0)return[];return db[_0xeaaf('0x9c')][_0xeaaf('0x3a')](_0x360137[_0xeaaf('0x9b')](),_0x2d08df)[_0xeaaf('0x25')](function(_0x4713db){_0x2eb27f=_[_0xeaaf('0x9d')](_0x4713db,'id');_0x2d08df=_[_0xeaaf('0x9e')](_0x2d08df,{'model':db[_0xeaaf('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x59afc5[_0xeaaf('0x3a')]['fields']){_0x38db2a[_0xeaaf('0x3c')][_0xeaaf('0x2f')](function(_0x1955a5){_0x1bc91c[_0xeaaf('0x44')]('i.'+_0x1955a5);});}else{_0x1bc91c[_0xeaaf('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xeaaf('0x5e'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0x9f'),_0xeaaf('0xa0'));_0x1bc91c['field'](_0xeaaf('0xa1'),_0xeaaf('0xa2'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xa3'),'contactName');_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0x89'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xa4'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xa5'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xa6'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xa7'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xa8'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xa9'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xaa'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xab'));_0x1bc91c['field'](_0xeaaf('0xac'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xad'));_0x1bc91c[_0xeaaf('0x44')]('i.thirdDisposition');_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xae'));_0x1bc91c['field'](_0xeaaf('0xaf'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xb0'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xb1'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xb2'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xb3'),_0xeaaf('0xb4'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xb5'),_0xeaaf('0xb6'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xb7'),_0xeaaf('0xb8'));_0x1bc91c[_0xeaaf('0x44')]('c.phone',_0xeaaf('0xb9'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xba'),_0xeaaf('0xbb'));_0x1bc91c['field'](_0xeaaf('0xbc'),_0xeaaf('0xbd'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xbe'),_0xeaaf('0xbf'));_0x1bc91c['field'](_0xeaaf('0xc0'),_0xeaaf('0xc1'));_0x1bc91c[_0xeaaf('0x44')](_0xeaaf('0xc2'),_0xeaaf('0x2c'));}if(_0x38db2a['limit'])_0x1bc91c[_0xeaaf('0x1e')](_0x38db2a[_0xeaaf('0x1e')]);if(_0x38db2a[_0xeaaf('0x1d')])_0x1bc91c[_0xeaaf('0x1d')](_0x38db2a[_0xeaaf('0x1d')]);return db[_0xeaaf('0x9c')][_0xeaaf('0x3a')](_0x1bc91c[_0xeaaf('0x9b')](),_0x2d08df);})[_0xeaaf('0x25')](function(_0x5c551b){_0x3e4702[_0xeaaf('0x7a')](_0xeaaf('0xc3'),_[_0xeaaf('0x39')](_0x5c551b,'id'));return db[_0xeaaf('0x9c')][_0xeaaf('0x3a')](_0x3e4702['toString'](),_0x2d08df)[_0xeaaf('0x25')](function(_0x27fcfc){var _0x4780ee=_[_0xeaaf('0xc4')](_0x27fcfc,_0xeaaf('0xc5'));var _0x1af2cf=[];return db[_0xeaaf('0xc6')]['findOne']({'attributes':[_0xeaaf('0xc7')],'raw':!![]})[_0xeaaf('0x25')](function(_0x411ef8){var _0x406384=_0x411ef8[_0xeaaf('0xc7')];_0x5c551b[_0xeaaf('0x2f')](function(_0x4bbe1c){_0x1af2cf[_0xeaaf('0x30')](updateMailInteraction(_0x4bbe1c,_0x2eb27f,_0x4780ee,_0x406384));});return BPromise[_0xeaaf('0xc8')](_0x1af2cf);});});});})[_0xeaaf('0x25')](function(_0x6df168){_0x3bfe23[_0xeaaf('0xc9')]=_0x6df168;return _0x3bfe23;})['then'](respondWithFilteredResult(_0x40ea59,_0x38db2a))[_0xeaaf('0x35')](handleError(_0x40ea59,null));};exports['show']=function(_0x3ddcce,_0x8684b7){var _0x35cdca={'raw':![],'where':{'id':_0x3ddcce[_0xeaaf('0xca')]['id']}},_0xae0ce={};_0xae0ce['model']=_['keys'](db[_0xeaaf('0x31')][_0xeaaf('0x36')]);_0xae0ce[_0xeaaf('0x3a')]=_['keys'](_0x3ddcce['query']);_0xae0ce[_0xeaaf('0x3b')]=_[_0xeaaf('0x3d')](_0xae0ce[_0xeaaf('0x38')],_0xae0ce[_0xeaaf('0x3a')]);_0x35cdca[_0xeaaf('0x3c')]=_[_0xeaaf('0x3d')](_0xae0ce[_0xeaaf('0x38')],qs[_0xeaaf('0x3e')](_0x3ddcce[_0xeaaf('0x3a')]['fields']));_0x35cdca[_0xeaaf('0x3c')]=_0x35cdca['attributes'][_0xeaaf('0x3f')]?_0x35cdca[_0xeaaf('0x3c')]:_0xae0ce[_0xeaaf('0x38')];if(_0x3ddcce['query'][_0xeaaf('0xcb')]){_0x35cdca['include']=[{'all':!![]}];}_0x35cdca=_[_0xeaaf('0x9e')]({},_0x35cdca,_0x3ddcce[_0xeaaf('0xcc')]);return db[_0xeaaf('0x31')][_0xeaaf('0x5c')](_0x35cdca)[_0xeaaf('0x25')](handleEntityNotFound(_0x8684b7,null))[_0xeaaf('0x25')](respondWithResult(_0x8684b7,null))[_0xeaaf('0x35')](handleError(_0x8684b7,null));};exports[_0xeaaf('0xcd')]=function(_0x2c0569,_0x4bfdcd){return db['MailInteraction'][_0xeaaf('0xcd')](_0x2c0569[_0xeaaf('0xce')],{})[_0xeaaf('0x25')](respondWithResult(_0x4bfdcd,0xc9))['catch'](handleError(_0x4bfdcd,null));};exports['update']=function(_0x208e0f,_0x28b769){if(_0x208e0f[_0xeaaf('0xce')]['id']){delete _0x208e0f['body']['id'];}return db[_0xeaaf('0x31')][_0xeaaf('0x5c')]({'where':{'id':_0x208e0f[_0xeaaf('0xca')]['id']}})[_0xeaaf('0x25')](handleEntityNotFound(_0x28b769,null))[_0xeaaf('0x25')](saveUpdates(_0x208e0f['body'],null))[_0xeaaf('0x25')](respondWithResult(_0x28b769,null))[_0xeaaf('0x35')](handleError(_0x28b769,null));};exports[_0xeaaf('0x26')]=function(_0x1a33c3,_0x2c109a){return db[_0xeaaf('0x31')][_0xeaaf('0x5c')]({'where':{'id':_0x1a33c3[_0xeaaf('0xca')]['id']}})[_0xeaaf('0x25')](handleEntityNotFound(_0x2c109a,null))[_0xeaaf('0x25')](removeEntity(_0x2c109a,null))[_0xeaaf('0x35')](handleError(_0x2c109a,null));};exports[_0xeaaf('0xcf')]=function(_0x12a0f8,_0x412ecf){return db[_0xeaaf('0x31')][_0xeaaf('0xcf')]()[_0xeaaf('0x25')](respondWithResult(_0x412ecf,null))[_0xeaaf('0x35')](handleError(_0x412ecf,null));};exports[_0xeaaf('0xd0')]=function(_0x528bd3,_0x2faaf3,_0x3e730f){return db[_0xeaaf('0xd1')][_0xeaaf('0x5c')]({'where':{'id':_0x528bd3[_0xeaaf('0xca')]['id']}})[_0xeaaf('0x25')](handleEntityNotFound(_0x2faaf3,null))[_0xeaaf('0x25')](function(_0x14e710){if(_0x14e710){return _0x14e710[_0xeaaf('0xd0')](_0x528bd3[_0xeaaf('0xce')][_0xeaaf('0xd2')],_[_0xeaaf('0xd3')](_0x528bd3[_0xeaaf('0xce')],['ids','id'])||{});}})['then'](respondWithResult(_0x2faaf3,null))[_0xeaaf('0x35')](handleError(_0x2faaf3,null));};exports[_0xeaaf('0xd4')]=function(_0x48d432,_0x5e5def,_0x14ce96){var _0x5ed5f7={'raw':![],'where':{}};var _0x546dcc={};var _0x3a5548={'count':0x0,'rows':[]};return db[_0xeaaf('0x31')][_0xeaaf('0xd5')]({'where':{'id':_0x48d432[_0xeaaf('0xca')]['id']}})[_0xeaaf('0x25')](handleEntityNotFound(_0x5e5def,null))[_0xeaaf('0x25')](function(_0x32a489){if(_0x32a489){_0x546dcc[_0xeaaf('0x38')]=_[_0xeaaf('0x70')](db[_0xeaaf('0xd1')][_0xeaaf('0x36')]);_0x546dcc[_0xeaaf('0x3a')]=_[_0xeaaf('0x70')](_0x48d432[_0xeaaf('0x3a')]);_0x546dcc[_0xeaaf('0x3b')]=_['intersection'](_0x546dcc[_0xeaaf('0x38')],_0x546dcc[_0xeaaf('0x3a')]);_0x5ed5f7['attributes']=_[_0xeaaf('0x3d')](_0x546dcc[_0xeaaf('0x38')],qs[_0xeaaf('0x3e')](_0x48d432[_0xeaaf('0x3a')][_0xeaaf('0x3e')]));_0x5ed5f7[_0xeaaf('0x3c')]=_0x5ed5f7['attributes'][_0xeaaf('0x3f')]?_0x5ed5f7[_0xeaaf('0x3c')]:_0x546dcc['model'];if(!_0x48d432['query']['hasOwnProperty'](_0xeaaf('0xd6'))){_0x5ed5f7[_0xeaaf('0x1e')]=qs[_0xeaaf('0x1e')](_0x48d432['query'][_0xeaaf('0x1e')]);_0x5ed5f7[_0xeaaf('0x1d')]=qs[_0xeaaf('0x1d')](_0x48d432[_0xeaaf('0x3a')]['offset']);}_0x5ed5f7[_0xeaaf('0x41')]=qs[_0xeaaf('0x42')](_0x48d432[_0xeaaf('0x3a')]['sort']);_0x5ed5f7[_0xeaaf('0x7a')]=qs[_0xeaaf('0x3b')](_[_0xeaaf('0x43')](_0x48d432[_0xeaaf('0x3a')],_0x546dcc['filters']));_0x5ed5f7[_0xeaaf('0x7a')][_0xeaaf('0xc5')]=_0x32a489['id'];if(_0x48d432[_0xeaaf('0x3a')][_0xeaaf('0x82')]){_0x5ed5f7[_0xeaaf('0x7a')]=_['merge'](_0x5ed5f7[_0xeaaf('0x7a')],{'$or':_[_0xeaaf('0x39')](_0x5ed5f7['attributes'],function(_0x1ccacf){var _0x251270={};_0x251270[_0x1ccacf]={'$like':'%'+_0x48d432[_0xeaaf('0x3a')][_0xeaaf('0x82')]+'%'};return _0x251270;})});}if(_0x48d432[_0xeaaf('0x3a')][_0xeaaf('0xd7')]){var _0x8d8f5b=_0x48d432['query'][_0xeaaf('0xd7')][_0xeaaf('0x2e')](',');var _0xd0ac59={};_0xd0ac59[_0x8d8f5b[0x0]]={'$gte':moment(_0x8d8f5b[0x1])['format'](_0xeaaf('0xd8'))};_0x5ed5f7['where']=_[_0xeaaf('0x9e')](_0x5ed5f7['where'],_0xd0ac59);}_0x5ed5f7=_['merge']({},_0x5ed5f7,_0x48d432[_0xeaaf('0xcc')]);return db[_0xeaaf('0xd1')][_0xeaaf('0x1c')]({'where':_0x5ed5f7[_0xeaaf('0x7a')]})['then'](function(_0x4db066){_0x3a5548[_0xeaaf('0x1c')]=_0x4db066;if(_0x48d432['query'][_0xeaaf('0xcb')]){_0x5ed5f7[_0xeaaf('0xd9')]=[{'all':!![]}];}return db[_0xeaaf('0xd1')][_0xeaaf('0xda')](_0x5ed5f7);})[_0xeaaf('0x25')](function(_0x2f7d2c){_0x3a5548[_0xeaaf('0xc9')]=_0x2f7d2c;return _0x3a5548;});}})['then'](respondWithFilteredResult(_0x5e5def,_0x5ed5f7))[_0xeaaf('0x35')](handleError(_0x5e5def,null));};exports[_0xeaaf('0xdb')]=function(_0x3f83b8,_0x3547dc,_0x51b2d2){return db[_0xeaaf('0x31')]['find']({'where':{'id':_0x3f83b8[_0xeaaf('0xca')]['id']}})[_0xeaaf('0x25')](handleEntityNotFound(_0x3547dc,null))['then'](function(_0x6b2de9){if(_0x6b2de9){return _0x6b2de9[_0xeaaf('0xdc')](_0x3f83b8['body'][_0xeaaf('0xd2')],_[_0xeaaf('0xd3')](_0x3f83b8[_0xeaaf('0xce')],[_0xeaaf('0xd2'),'id'])||{})[_0xeaaf('0xdd')](function(){return db[_0xeaaf('0x69')][_0xeaaf('0xda')]({'attributes':['id',_0xeaaf('0x5d'),_0xeaaf('0xde')],'where':{'id':_0x3f83b8[_0xeaaf('0xce')][_0xeaaf('0xd2')]}});})[_0xeaaf('0x25')](function(_0x41bfe4){socket[_0xeaaf('0xdf')](_0xeaaf('0xe0'),{'id':Number(_0x3f83b8[_0xeaaf('0xca')]['id']),'tags':_0x41bfe4||[]});return{'id':Number(_0x3f83b8[_0xeaaf('0xca')]['id']),'tags':_0x41bfe4||[]};});}})[_0xeaaf('0x25')](respondWithResult(_0x3547dc,null))['catch'](handleError(_0x3547dc,null));};exports[_0xeaaf('0xe1')]=function(_0x1fd0a7,_0x1f5937,_0x38e7dc){return db['MailInteraction'][_0xeaaf('0x5c')]({'where':{'id':_0x1fd0a7[_0xeaaf('0xca')]['id']}})[_0xeaaf('0x25')](handleEntityNotFound(_0x1f5937,null))[_0xeaaf('0x25')](function(_0x27c744){if(_0x27c744){return _0x27c744[_0xeaaf('0xe1')](_0x1fd0a7[_0xeaaf('0x3a')][_0xeaaf('0xd2')]);}})[_0xeaaf('0x25')](respondWithStatusCode(_0x1f5937,null))[_0xeaaf('0x35')](handleError(_0x1f5937,null));};exports['download']=function(_0x5d0a49,_0x5770ea){var _0x27c08c=moment()[_0xeaaf('0xe2')]()[_0xeaaf('0x9b')]();var _0x44516e=path[_0xeaaf('0xe3')](config[_0xeaaf('0xe4')],_0xeaaf('0xe5'),_0xeaaf('0xe6'),'tmp');var _0x229ef1=path[_0xeaaf('0xe3')](config['root'],_0xeaaf('0xe5'),_0xeaaf('0xe6'),'attachments');var _0x4c9a97=path['join'](_0x44516e,_0x27c08c);var _0x11b8ae=util[_0xeaaf('0xe7')](_0xeaaf('0xe8'),_0x5d0a49[_0xeaaf('0xca')]['id'],_0x27c08c);var _0x3c86e2=path['join'](_0x44516e,_0x11b8ae);var _0x22b203=[];if(_0x5d0a49['query'][_0xeaaf('0xe9')]){_0x22b203[_0xeaaf('0x30')]({'model':db[_0xeaaf('0xea')],'as':_0xeaaf('0xeb'),'raw':!![]});}var _0x5acf70=[{'model':db[_0xeaaf('0xd1')],'as':'Messages','attributes':['id',_0xeaaf('0xce'),_0xeaaf('0x45'),'to','cc','bcc',_0xeaaf('0xec'),_0xeaaf('0x76')],'where':{'secret':![]},'order':qs[_0xeaaf('0x42')]('id'),'include':_0x22b203}];return db[_0xeaaf('0x31')][_0xeaaf('0x5c')]({'where':{'id':_0x5d0a49[_0xeaaf('0xca')]['id']},'include':_0x5acf70})[_0xeaaf('0x25')](handleEntityNotFound(_0x5770ea,null))[_0xeaaf('0x25')](function(_0x58683c){if(_0x58683c&&_0x58683c[_0xeaaf('0xed')]){var _0x2b868f=_0x58683c['get']({'plain':!![]});fs['mkdirSync'](_0x4c9a97);return BPromise[_0xeaaf('0xee')](_0x2b868f['Messages'],function(_0xa65eff,_0x399e8a){var _0x169a38={'from':_0xa65eff[_0xeaaf('0x45')],'to':_0xa65eff['to'],'subject':_0xa65eff[_0xeaaf('0xec')],'html':_0xa65eff[_0xeaaf('0xce')],'headers':{'Date':moment(_0xa65eff['createdAt'])['format'](_0xeaaf('0xef'))},'attachments':[]};if(_0xa65eff['cc']){_0x169a38[_0xeaaf('0xf0')]['Cc']=_0xa65eff['cc'];}if(_0xa65eff[_0xeaaf('0xf1')]){_0x169a38[_0xeaaf('0xf0')][_0xeaaf('0xf2')]=_0xa65eff[_0xeaaf('0xf1')];}return new BPromise(function(_0x14fb61,_0x40798d){if(_0xa65eff['Attachments']){for(var _0x10ee51=0x0;_0x10ee51<_0xa65eff['Attachments']['length'];_0x10ee51++){var _0x531a61=_0xa65eff[_0xeaaf('0xeb')][_0x10ee51];var _0x459f63=path[_0xeaaf('0xe3')](_0x229ef1,_0x531a61[_0xeaaf('0xf3')]);if(fs[_0xeaaf('0xf4')](_0x459f63)){_0x169a38['attachments'][_0xeaaf('0x30')]({'name':_0x531a61['name'],'contentType':_0x531a61[_0xeaaf('0x37')],'data':fs[_0xeaaf('0xf5')](_0x459f63)});}}}emlformat[_0xeaaf('0xf6')](_0x169a38,function(_0x11ad83,_0x544386){if(_0x11ad83)return _0x40798d(_0x11ad83);fs[_0xeaaf('0xf7')](path[_0xeaaf('0xe3')](_0x4c9a97,util['format'](_0xeaaf('0xf8'),_0x399e8a)),_0x544386);return _0x14fb61(_0x544386);});});})[_0xeaaf('0x25')](function(){return new BPromise(function(_0xba39a0,_0xc2deed){zipdir(_0x4c9a97,{'saveTo':_0x3c86e2},function(_0x583588,_0x4ee86a){if(_0x583588)return _0xc2deed(_0x583588);return _0xba39a0(_0x4ee86a);});})[_0xeaaf('0x25')](function(){return new BPromise(function(_0x1e1ee9,_0x5aa327){rimraf(_0x4c9a97,function(_0x5e91dd){if(_0x5e91dd)_0x5aa327(_0x5e91dd);return _0x1e1ee9();});});})[_0xeaaf('0x25')](function(){return _0x5770ea['download'](_0x3c86e2,_0x11b8ae,function(_0x2d1e10){if(_0x2d1e10){console['log'](_0xeaaf('0xf9'),_0x2d1e10);}else{fs[_0xeaaf('0xfa')](_0x3c86e2);}});});});}else{return _0x5770ea[_0xeaaf('0x27')](0xc8);}})[_0xeaaf('0x35')](handleError(_0x5770ea,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 3c1c337..abb2ec0 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 _0x5806=['MailInteraction','MailMessage','setMaxListeners','update','remove','setDataValue','map','findAll','then','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb'];(function(_0x332fe1,_0x276196){var _0x45a0dc=function(_0x383cd9){while(--_0x383cd9){_0x332fe1['push'](_0x332fe1['shift']());}};_0x45a0dc(++_0x276196);}(_0x5806,0x1a7));var _0x6580=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0x5806[_0x55677b];return _0x104b88;};'use strict';var EventEmitter=require(_0x6580('0x0'));var MailInteraction=require(_0x6580('0x1'))['db'][_0x6580('0x2')];var MailMessage=require(_0x6580('0x1'))['db'][_0x6580('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6580('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6580('0x5'),'afterDestroy':_0x6580('0x6')};function emitEvent(_0x5ca02c){return function(_0x177eed,_0x452d13,_0x10254b){_0x177eed['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x196555){_0x177eed[_0x6580('0x7')]('Users',_0x196555[_0x6580('0x8')](function(_0x27e188){return{'id':_0x27e188['id']};}));return MailMessage[_0x6580('0x9')]({'where':{'MailInteractionId':_0x177eed['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6580('0xa')](function(_0xf32aff){_0x177eed['setDataValue'](_0x6580('0xb'),_0xf32aff[_0x6580('0xc')]);MailInteractionEvents[_0x6580('0xd')](_0x5ca02c+':'+_0x177eed['id'],_0x177eed);MailInteractionEvents[_0x6580('0xd')](_0x5ca02c,_0x177eed);_0x10254b(null);})[_0x6580('0xe')](_0x10254b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x6580('0xf')](e,emitEvent(event));}}module[_0x6580('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x1fca=['Users','map','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove','getUsers','then'];(function(_0x11ec4e,_0x43cda5){var _0x5f4734=function(_0x1ffa14){while(--_0x1ffa14){_0x11ec4e['push'](_0x11ec4e['shift']());}};_0x5f4734(++_0x43cda5);}(_0x1fca,0x1f0));var _0xa1fc=function(_0xb1174e,_0x1e68a7){_0xb1174e=_0xb1174e-0x0;var _0x285bac=_0x1fca[_0xb1174e];return _0x285bac;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xa1fc('0x0'))['db'][_0xa1fc('0x1')];var MailMessage=require(_0xa1fc('0x0'))['db'][_0xa1fc('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa1fc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa1fc('0x4'),'afterDestroy':_0xa1fc('0x5')};function emitEvent(_0xb27bd1){return function(_0x16af3a,_0x29f440,_0x248faf){_0x16af3a[_0xa1fc('0x6')]({'attributes':['id'],'raw':!![]})[_0xa1fc('0x7')](function(_0x233127){_0x16af3a['setDataValue'](_0xa1fc('0x8'),_0x233127[_0xa1fc('0x9')](function(_0x6b4fc5){return{'id':_0x6b4fc5['id']};}));return MailMessage[_0xa1fc('0xa')]({'where':{'MailInteractionId':_0x16af3a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa1fc('0x7')](function(_0x549d4e){_0x16af3a[_0xa1fc('0xb')]('unreadMessages',_0x549d4e[_0xa1fc('0xc')]);MailInteractionEvents[_0xa1fc('0xd')](_0xb27bd1+':'+_0x16af3a['id'],_0x16af3a);MailInteractionEvents['emit'](_0xb27bd1,_0x16af3a);_0x248faf(null);})[_0xa1fc('0xe')](_0x248faf(null));};}for(var e in events){if(events[_0xa1fc('0xf')](e)){var event=events[e];MailInteraction[_0xa1fc('0x10')](e,emitEvent(event));}}module[_0xa1fc('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 0203858..a0a94fd 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 _0x1020=['then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','update'];(function(_0x98dc8a,_0x1064e6){var _0x34c560=function(_0x225879){while(--_0x225879){_0x98dc8a['push'](_0x98dc8a['shift']());}};_0x34c560(++_0x1064e6);}(_0x1020,0x1a4));var _0x0102=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0x1020[_0x2f5a22];return _0x326b70;};'use strict';var _=require(_0x0102('0x0'));var util=require('util');var logger=require(_0x0102('0x1'))(_0x0102('0x2'));var moment=require(_0x0102('0x3'));var BPromise=require(_0x0102('0x4'));var rp=require(_0x0102('0x5'));var fs=require('fs');var path=require(_0x0102('0x6'));var rimraf=require(_0x0102('0x7'));var config=require(_0x0102('0x8'));var attributes=require(_0x0102('0x9'));module[_0x0102('0xa')]=function(_0x27dd86,_0x3afe31){return _0x27dd86['define'](_0x0102('0xb'),attributes,{'tableName':_0x0102('0xc'),'paranoid':![],'indexes':[{'name':_0x0102('0xd'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x88bf17,_0x566659,_0x47fac0){if(_0x88bf17[_0x0102('0xe')]){_0x88bf17[_0x0102('0xf')]=moment()[_0x0102('0x10')](_0x0102('0x11'));}if(_0x88bf17[_0x0102('0x12')]){_0x88bf17['closedAt']=moment()[_0x0102('0x10')](_0x0102('0x11'));}_0x47fac0(null,_0x566659);},'beforeUpdate':function(_0xd75f51,_0x1af71f,_0x1945cf){if(_0xd75f51[_0x0102('0x13')](_0x0102('0xe'))){_0xd75f51[_0x0102('0xf')]=_0xd75f51[_0x0102('0xe')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0xd75f51[_0x0102('0x13')](_0x0102('0x12'))){_0xd75f51[_0x0102('0x14')]=moment()[_0x0102('0x10')](_0x0102('0x11'));_0xd75f51[_0x0102('0xe')]=null;_0xd75f51[_0x0102('0xf')]=null;}_0x1945cf(null,_0xd75f51);},'afterUpdate':function(_0x2e0c35,_0x3b7253,_0x2493fe){var _0x38fab3=_0x27dd86['models'];var _0x2ca87b=_0x2e0c35['get']({'plain':!![]});if(_0x2ca87b['closed']){return _0x38fab3['MailMessage'][_0x0102('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x2ca87b['id']}})[_0x0102('0x16')](function(){_0x2493fe();})[_0x0102('0x17')](function(_0x1a0afe){_0x2493fe(_0x1a0afe);});}else{_0x2493fe();}}},'charset':_0x0102('0x18'),'collate':_0x0102('0x19')});}; \ No newline at end of file +var _0x4bd1=['./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatus','substatusAt','closedAt','models','MailMessage','update','utf8mb4','util','api','moment','request-promise','path','../../config/environment'];(function(_0x2d5f5f,_0x5d111f){var _0x2daff6=function(_0xa8afcf){while(--_0xa8afcf){_0x2d5f5f['push'](_0x2d5f5f['shift']());}};_0x2daff6(++_0x5d111f);}(_0x4bd1,0x90));var _0x14bd=function(_0x2797c6,_0x37421b){_0x2797c6=_0x2797c6-0x0;var _0x54809f=_0x4bd1[_0x2797c6];return _0x54809f;};'use strict';var _=require('lodash');var util=require(_0x14bd('0x0'));var logger=require('../../config/logger')(_0x14bd('0x1'));var moment=require(_0x14bd('0x2'));var BPromise=require('bluebird');var rp=require(_0x14bd('0x3'));var fs=require('fs');var path=require(_0x14bd('0x4'));var rimraf=require('rimraf');var config=require(_0x14bd('0x5'));var attributes=require(_0x14bd('0x6'));module[_0x14bd('0x7')]=function(_0x31b468,_0x5c4680){return _0x31b468[_0x14bd('0x8')](_0x14bd('0x9'),attributes,{'tableName':_0x14bd('0xa'),'paranoid':![],'indexes':[{'name':_0x14bd('0xb'),'fields':[_0x14bd('0xc'),'to'],'type':_0x14bd('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x912040,_0x4193ff,_0x4e0d8d){if(_0x912040['substatus']){_0x912040['substatusAt']=moment()[_0x14bd('0xe')](_0x14bd('0xf'));}if(_0x912040[_0x14bd('0x10')]){_0x912040['closedAt']=moment()[_0x14bd('0xe')](_0x14bd('0xf'));}_0x4e0d8d(null,_0x4193ff);},'beforeUpdate':function(_0x3e41e8,_0x11358d,_0x29475f){if(_0x3e41e8[_0x14bd('0x11')](_0x14bd('0x12'))){_0x3e41e8[_0x14bd('0x13')]=_0x3e41e8['substatus']?moment()[_0x14bd('0xe')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x3e41e8[_0x14bd('0x11')]('closed')){_0x3e41e8[_0x14bd('0x14')]=moment()[_0x14bd('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e41e8[_0x14bd('0x12')]=null;_0x3e41e8['substatusAt']=null;}_0x29475f(null,_0x3e41e8);},'afterUpdate':function(_0x10e47e,_0x6579a9,_0x3833ed){var _0x1853ba=_0x31b468[_0x14bd('0x15')];var _0x7b7012=_0x10e47e['get']({'plain':!![]});if(_0x7b7012['closed']){return _0x1853ba[_0x14bd('0x16')][_0x14bd('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x7b7012['id']}})['then'](function(){_0x3833ed();})['catch'](function(_0x1f09fa){_0x3833ed(_0x1f09fa);});}else{_0x3833ed();}}},'charset':_0x14bd('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index d15ad68..d04339f 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 _0x4d41=['message','info','result','catch','UpdateMailInteraction','update','body','options','raw','where','limit','debug','AddTagsToMailInteraction','find','then','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','./mailInteraction.socket','register','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x166146,_0x1f34c6){var _0x9c7390=function(_0x1e368c){while(--_0x1e368c){_0x166146['push'](_0x166146['shift']());}};_0x9c7390(++_0x1f34c6);}(_0x4d41,0x153));var _0x14d4=function(_0x35c12c,_0x378ba0){_0x35c12c=_0x35c12c-0x0;var _0x2bab3a=_0x4d41[_0x35c12c];return _0x2bab3a;};'use strict';var _=require(_0x14d4('0x0'));var util=require(_0x14d4('0x1'));var moment=require(_0x14d4('0x2'));var BPromise=require('bluebird');var rs=require(_0x14d4('0x3'));var fs=require('fs');var Redis=require(_0x14d4('0x4'));var db=require(_0x14d4('0x5'))['db'];var utils=require(_0x14d4('0x6'));var logger=require(_0x14d4('0x7'))(_0x14d4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x14d4('0x9')][_0x14d4('0xa')]({'port':0x232a});config[_0x14d4('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x14d4('0xc'))(new Redis(config[_0x14d4('0xb')]));require(_0x14d4('0xd'))[_0x14d4('0xe')](socket);function respondWithRpcPromise(_0x4dab73,_0x54ed12,_0x14e477){return new BPromise(function(_0x3031cc,_0x2f4309){return client['request'](_0x4dab73,_0x14e477)['then'](function(_0x1469e2){logger['info'](_0x14d4('0xf'),_0x54ed12,_0x14d4('0x10'));logger['debug'](_0x14d4('0x11'),_0x54ed12,_0x14d4('0x10'),JSON[_0x14d4('0x12')](_0x1469e2));if(_0x1469e2[_0x14d4('0x13')]){if(_0x1469e2[_0x14d4('0x13')][_0x14d4('0x14')]===0x1f4){logger[_0x14d4('0x13')](_0x14d4('0xf'),_0x54ed12,_0x1469e2[_0x14d4('0x13')]['message']);return _0x2f4309(_0x1469e2[_0x14d4('0x13')][_0x14d4('0x15')]);}logger[_0x14d4('0x13')]('MailInteraction,\x20%s,\x20%s',_0x54ed12,_0x1469e2[_0x14d4('0x13')][_0x14d4('0x15')]);return _0x3031cc(_0x1469e2[_0x14d4('0x13')][_0x14d4('0x15')]);}else{logger[_0x14d4('0x16')](_0x14d4('0xf'),_0x54ed12,_0x14d4('0x10'));_0x3031cc(_0x1469e2[_0x14d4('0x17')][_0x14d4('0x15')]);}})[_0x14d4('0x18')](function(_0x75287d){logger[_0x14d4('0x13')]('MailInteraction,\x20%s,\x20%s',_0x54ed12,_0x75287d);_0x2f4309(_0x75287d);});});}exports[_0x14d4('0x19')]=function(_0x25499b){var _0x3b754f=this;return new Promise(function(_0x5abf23,_0x321f4a){return db['MailInteraction'][_0x14d4('0x1a')](_0x25499b[_0x14d4('0x1b')],{'raw':_0x25499b[_0x14d4('0x1c')]?_0x25499b[_0x14d4('0x1c')][_0x14d4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25499b['options']?_0x25499b[_0x14d4('0x1c')][_0x14d4('0x1e')]||null:null,'attributes':_0x25499b[_0x14d4('0x1c')]?_0x25499b['options']['attributes']||null:null,'limit':_0x25499b[_0x14d4('0x1c')]?_0x25499b[_0x14d4('0x1c')][_0x14d4('0x1f')]||null:null})['then'](function(_0x2ffca8){logger[_0x14d4('0x16')]('UpdateMailInteraction',_0x25499b);logger[_0x14d4('0x20')](_0x14d4('0x19'),_0x25499b,JSON[_0x14d4('0x12')](_0x2ffca8));_0x5abf23(_0x2ffca8);})[_0x14d4('0x18')](function(_0x4ed285){logger[_0x14d4('0x13')]('UpdateMailInteraction',_0x4ed285['message'],_0x25499b);_0x321f4a(_0x3b754f[_0x14d4('0x13')](0x1f4,_0x4ed285[_0x14d4('0x15')]));});});};exports[_0x14d4('0x21')]=function(_0x9fa275){return new Promise(function(_0x4e15dd,_0x3aa339){return db['MailInteraction'][_0x14d4('0x22')]({'where':_0x9fa275[_0x14d4('0x1c')]?_0x9fa275['options'][_0x14d4('0x1e')]||null:null})[_0x14d4('0x23')](function(_0x567149){if(_0x567149){return _0x567149[_0x14d4('0x24')](_0x9fa275[_0x14d4('0x1b')][_0x14d4('0x25')],_['omit'](_0x9fa275['body'],[_0x14d4('0x25'),'id'])||{});}})[_0x14d4('0x26')](function(_0x55fcd1){logger[_0x14d4('0x16')]('AddTags',_0x9fa275);logger[_0x14d4('0x20')]('AddTags',_0x9fa275,JSON[_0x14d4('0x12')](_0x55fcd1));_0x4e15dd(_0x55fcd1);})[_0x14d4('0x18')](function(_0xb5de8b){logger[_0x14d4('0x13')](_0x14d4('0x27'),_0xb5de8b[_0x14d4('0x15')],_0x9fa275);_0x3aa339(_this[_0x14d4('0x13')](0x1f4,_0xb5de8b[_0x14d4('0x15')]));});});}; \ No newline at end of file +var _0xbbfa=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','raw','options','where','attributes','limit','then','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring'];(function(_0x5a3e6a,_0x2eae21){var _0x54acd7=function(_0x40738a){while(--_0x40738a){_0x5a3e6a['push'](_0x5a3e6a['shift']());}};_0x54acd7(++_0x2eae21);}(_0xbbfa,0x1e9));var _0xabbf=function(_0x42276c,_0x141d47){_0x42276c=_0x42276c-0x0;var _0x1b5009=_0xbbfa[_0x42276c];return _0x1b5009;};'use strict';var _=require(_0xabbf('0x0'));var util=require('util');var moment=require(_0xabbf('0x1'));var BPromise=require('bluebird');var rs=require(_0xabbf('0x2'));var fs=require('fs');var Redis=require(_0xabbf('0x3'));var db=require(_0xabbf('0x4'))['db'];var utils=require(_0xabbf('0x5'));var logger=require(_0xabbf('0x6'))(_0xabbf('0x7'));var config=require(_0xabbf('0x8'));var jayson=require(_0xabbf('0x9'));var client=jayson[_0xabbf('0xa')][_0xabbf('0xb')]({'port':0x232a});config[_0xabbf('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xabbf('0xd'))(new Redis(config[_0xabbf('0xc')]));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2f1d5d,_0x5a6955,_0x170fe2){return new BPromise(function(_0x4f5cf1,_0x31e77b){return client['request'](_0x2f1d5d,_0x170fe2)['then'](function(_0xb8c3d9){logger[_0xabbf('0xe')](_0xabbf('0xf'),_0x5a6955,_0xabbf('0x10'));logger[_0xabbf('0x11')](_0xabbf('0x12'),_0x5a6955,_0xabbf('0x10'),JSON[_0xabbf('0x13')](_0xb8c3d9));if(_0xb8c3d9[_0xabbf('0x14')]){if(_0xb8c3d9['error'][_0xabbf('0x15')]===0x1f4){logger['error'](_0xabbf('0xf'),_0x5a6955,_0xb8c3d9['error'][_0xabbf('0x16')]);return _0x31e77b(_0xb8c3d9[_0xabbf('0x14')][_0xabbf('0x16')]);}logger[_0xabbf('0x14')]('MailInteraction,\x20%s,\x20%s',_0x5a6955,_0xb8c3d9[_0xabbf('0x14')][_0xabbf('0x16')]);return _0x4f5cf1(_0xb8c3d9[_0xabbf('0x14')][_0xabbf('0x16')]);}else{logger[_0xabbf('0xe')]('MailInteraction,\x20%s,\x20%s',_0x5a6955,_0xabbf('0x10'));_0x4f5cf1(_0xb8c3d9[_0xabbf('0x17')]['message']);}})[_0xabbf('0x18')](function(_0x132296){logger['error'](_0xabbf('0xf'),_0x5a6955,_0x132296);_0x31e77b(_0x132296);});});}exports[_0xabbf('0x19')]=function(_0x3d5528){var _0x5bf568=this;return new Promise(function(_0x540a12,_0xdf7640){return db[_0xabbf('0x1a')][_0xabbf('0x1b')](_0x3d5528[_0xabbf('0x1c')],{'raw':_0x3d5528['options']?_0x3d5528['options'][_0xabbf('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d5528[_0xabbf('0x1e')]?_0x3d5528[_0xabbf('0x1e')][_0xabbf('0x1f')]||null:null,'attributes':_0x3d5528[_0xabbf('0x1e')]?_0x3d5528[_0xabbf('0x1e')][_0xabbf('0x20')]||null:null,'limit':_0x3d5528['options']?_0x3d5528[_0xabbf('0x1e')][_0xabbf('0x21')]||null:null})[_0xabbf('0x22')](function(_0x5b9380){logger[_0xabbf('0xe')](_0xabbf('0x19'),_0x3d5528);logger[_0xabbf('0x11')](_0xabbf('0x19'),_0x3d5528,JSON[_0xabbf('0x13')](_0x5b9380));_0x540a12(_0x5b9380);})['catch'](function(_0x3a0eca){logger['error']('UpdateMailInteraction',_0x3a0eca[_0xabbf('0x16')],_0x3d5528);_0xdf7640(_0x5bf568[_0xabbf('0x14')](0x1f4,_0x3a0eca['message']));});});};exports[_0xabbf('0x23')]=function(_0xa39ccd){return new Promise(function(_0x527838,_0x4f8ed7){return db['MailInteraction']['find']({'where':_0xa39ccd[_0xabbf('0x1e')]?_0xa39ccd[_0xabbf('0x1e')][_0xabbf('0x1f')]||null:null})[_0xabbf('0x22')](function(_0x11243e){if(_0x11243e){return _0x11243e[_0xabbf('0x24')](_0xa39ccd[_0xabbf('0x1c')][_0xabbf('0x25')],_[_0xabbf('0x26')](_0xa39ccd[_0xabbf('0x1c')],['ids','id'])||{});}})[_0xabbf('0x27')](function(_0x56ac46){logger[_0xabbf('0xe')](_0xabbf('0x28'),_0xa39ccd);logger['debug'](_0xabbf('0x28'),_0xa39ccd,JSON[_0xabbf('0x13')](_0x56ac46));_0x527838(_0x56ac46);})[_0xabbf('0x18')](function(_0x44b9b1){logger[_0xabbf('0x14')](_0xabbf('0x28'),_0x44b9b1[_0xabbf('0x16')],_0xa39ccd);_0x4f8ed7(_this['error'](0x1f4,_0x44b9b1['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 6640f37..8ae6ff6 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 _0x70f2=['save','emit','removeListener','register','length','mailInteraction:'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x70f2,0x7e));var _0x270f=function(_0x23db34,_0x530e6e){_0x23db34=_0x23db34-0x0;var _0x5bd878=_0x70f2[_0x23db34];return _0x5bd878;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x270f('0x0'),'remove','update'];function createListener(_0x20326f,_0x13b056){return function(_0x355896){_0x13b056[_0x270f('0x1')](_0x20326f,_0x355896);};}function removeListener(_0xda7ad0,_0x3c89c4){return function(){MailInteractionEvents[_0x270f('0x2')](_0xda7ad0,_0x3c89c4);};}exports[_0x270f('0x3')]=function(_0x4a1c07){for(var _0x3b6850=0x0,_0xb64db6=events[_0x270f('0x4')];_0x3b6850<_0xb64db6;_0x3b6850++){var _0x2a0337=events[_0x3b6850];var _0x3db212=createListener(_0x270f('0x5')+_0x2a0337,_0x4a1c07);MailInteractionEvents['on'](_0x2a0337,_0x3db212);}}; \ No newline at end of file +var _0xcf56=['remove','update','emit','removeListener','mailInteraction:','./mailInteraction.events'];(function(_0x3f395d,_0x4a5b9e){var _0x1bf6fc=function(_0x5993e7){while(--_0x5993e7){_0x3f395d['push'](_0x3f395d['shift']());}};_0x1bf6fc(++_0x4a5b9e);}(_0xcf56,0x13d));var _0x6cf5=function(_0x1d50c1,_0x534d8e){_0x1d50c1=_0x1d50c1-0x0;var _0x32a783=_0xcf56[_0x1d50c1];return _0x32a783;};'use strict';var MailInteractionEvents=require(_0x6cf5('0x0'));var events=['save',_0x6cf5('0x1'),_0x6cf5('0x2')];function createListener(_0x120e49,_0x2285f4){return function(_0x1d288a){_0x2285f4[_0x6cf5('0x3')](_0x120e49,_0x1d288a);};}function removeListener(_0x402e42,_0xe85cf9){return function(){MailInteractionEvents[_0x6cf5('0x4')](_0x402e42,_0xe85cf9);};}exports['register']=function(_0x5e948c){for(var _0x49b952=0x0,_0x5bea49=events['length'];_0x49b952<_0x5bea49;_0x49b952++){var _0x1c6744=events[_0x49b952];var _0x5e9e87=createListener(_0x6cf5('0x5')+_0x1c6744,_0x5e948c);MailInteractionEvents['on'](_0x1c6744,_0x5e9e87);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 9b36a3e..d0ee2d5 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 _0x98a8=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','mail','create','update','accept','put','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x98a8,0x12c));var _0x898a=function(_0x456973,_0x4385c5){_0x456973=_0x456973-0x0;var _0x26c314=_0x98a8[_0x456973];return _0x26c314;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['get'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0xf')]);router[_0x898a('0x9')](_0x898a('0x10'),auth[_0x898a('0xa')](),controller[_0x898a('0x11')]);router[_0x898a('0x12')]('/',auth[_0x898a('0xa')](),interaction['tracked'](_0x898a('0x13'),'mailmessage:create'),controller[_0x898a('0x14')]);router['put'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0x15')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x898a('0x16')]);router[_0x898a('0x17')](_0x898a('0x18'),auth[_0x898a('0xa')](),controller[_0x898a('0x19')]);router[_0x898a('0x1a')]('/:id',auth[_0x898a('0xa')](),controller['destroy']);module[_0x898a('0x1b')]=router; \ No newline at end of file +var _0x9f62=['./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id/download','tracked','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','exports','util','connect-timeout','express','Router','../../config/environment'];(function(_0x56a06f,_0x183813){var _0x3309ac=function(_0x562fb0){while(--_0x562fb0){_0x56a06f['push'](_0x56a06f['shift']());}};_0x3309ac(++_0x183813);}(_0x9f62,0x154));var _0x29f6=function(_0x3c7a37,_0x33a60e){_0x3c7a37=_0x3c7a37-0x0;var _0x3eab4d=_0x9f62[_0x3c7a37];return _0x3eab4d;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x29f6('0x4'));var controller=require(_0x29f6('0x5'));router[_0x29f6('0x6')]('/',auth[_0x29f6('0x7')](),controller['index']);router[_0x29f6('0x6')](_0x29f6('0x8'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x9')]);router[_0x29f6('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x29f6('0xa'),auth[_0x29f6('0x7')](),controller['download']);router['post']('/',auth[_0x29f6('0x7')](),interaction[_0x29f6('0xb')]('mail',_0x29f6('0xc')),controller[_0x29f6('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x29f6('0xe')](_0x29f6('0xf'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x10')]);router[_0x29f6('0xe')](_0x29f6('0x11'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x12')]);router[_0x29f6('0x13')](_0x29f6('0x14'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x15')]);module[_0x29f6('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index e36c62e..6e784e3 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 _0x5b6e=['lodash','TEXT','medium','BOOLEAN','out','STRING','long','INTEGER','sequelize'];(function(_0x652866,_0x4c1b7c){var _0xe26c4c=function(_0x177502){while(--_0x177502){_0x652866['push'](_0x652866['shift']());}};_0xe26c4c(++_0x4c1b7c);}(_0x5b6e,0x14c));var _0xe5b6=function(_0x139713,_0x4d9d1d){_0x139713=_0x139713-0x0;var _0x49d7ac=_0x5b6e[_0x139713];return _0x49d7ac;};'use strict';var Sequelize=require(_0xe5b6('0x0'));var _=require(_0xe5b6('0x1'));module['exports']={'body':{'type':Sequelize[_0xe5b6('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe5b6('0x2')](_0xe5b6('0x3'))},'read':{'type':Sequelize[_0xe5b6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xe5b6('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe5b6('0x6')](0x1fe)},'from':{'type':Sequelize[_0xe5b6('0x6')]},'to':{'type':Sequelize[_0xe5b6('0x2')]('long')},'cc':{'type':Sequelize[_0xe5b6('0x2')](_0xe5b6('0x7'))},'bcc':{'type':Sequelize[_0xe5b6('0x2')]('long')},'subject':{'type':Sequelize[_0xe5b6('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xe5b6('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe5b6('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xe5b6('0x2')](_0xe5b6('0x7'))},'originCc':{'type':Sequelize['TEXT'](_0xe5b6('0x7'))}}; \ No newline at end of file +var _0xa064=['DATE','INTEGER','sequelize','lodash','exports','TEXT','long','BOOLEAN','out','STRING'];(function(_0x3674f2,_0x4802c9){var _0x5b7aeb=function(_0x42edfc){while(--_0x42edfc){_0x3674f2['push'](_0x3674f2['shift']());}};_0x5b7aeb(++_0x4802c9);}(_0xa064,0x192));var _0x4a06=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0xa064[_0x590a38];return _0xf36626;};'use strict';var Sequelize=require(_0x4a06('0x0'));var _=require(_0x4a06('0x1'));module[_0x4a06('0x2')]={'body':{'type':Sequelize[_0x4a06('0x3')](_0x4a06('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0x4a06('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4a06('0x6')),'defaultValue':_0x4a06('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x4a06('0x7')]},'to':{'type':Sequelize[_0x4a06('0x3')]('long')},'cc':{'type':Sequelize[_0x4a06('0x3')](_0x4a06('0x4'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x4a06('0x3')]},'sentAt':{'type':Sequelize[_0x4a06('0x8')]},'attach':{'type':Sequelize[_0x4a06('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4a06('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x4a06('0x3')](_0x4a06('0x4'))},'originCc':{'type':Sequelize[_0x4a06('0x3')](_0x4a06('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 143b9b1..fce0882 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 _0x1bd0=['includeAll','include','body','find','destroy','params','describe','create','direction','out','split','MailAccountId','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','isNil','host','port','secure','authentication','pass','service','auth','attachments','join','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','UserId','user','Contact','get','MailInteractionId','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','unix','root','server','files','message-%s.eml','from','subject','createdAt','Attachment','headers','Bcc','bcc','Attachments','existsSync','push','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','stack','name','index','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','MailMessage','findAll','rows','show','rawAttributes'];(function(_0x35a1cb,_0x5050aa){var _0x1f7dc0=function(_0x55b124){while(--_0x55b124){_0x35a1cb['push'](_0x35a1cb['shift']());}};_0x1f7dc0(++_0x5050aa);}(_0x1bd0,0x100));var _0x01bd=function(_0x3aa8b8,_0x10251d){_0x3aa8b8=_0x3aa8b8-0x0;var _0x2157fd=_0x1bd0[_0x3aa8b8];return _0x2157fd;};'use strict';var pdf=require(_0x01bd('0x0'));var emlformat=require(_0x01bd('0x1'));var rimraf=require(_0x01bd('0x2'));var zipdir=require(_0x01bd('0x3'));var jsonpatch=require(_0x01bd('0x4'));var rp=require(_0x01bd('0x5'));var moment=require(_0x01bd('0x6'));var BPromise=require(_0x01bd('0x7'));var Mustache=require(_0x01bd('0x8'));var util=require('util');var path=require(_0x01bd('0x9'));var sox=require(_0x01bd('0xa'));var csv=require(_0x01bd('0xb'));var ejs=require(_0x01bd('0xc'));var fs=require('fs');var _=require(_0x01bd('0xd'));var squel=require(_0x01bd('0xe'));var crypto=require(_0x01bd('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x01bd('0xb'));var querystring=require(_0x01bd('0x10'));var Papa=require('papaparse');var Redis=require(_0x01bd('0x11'));var authService=require(_0x01bd('0x12'));var qs=require(_0x01bd('0x13'));var as=require(_0x01bd('0x14'));var hardwareService=require(_0x01bd('0x15'));var logger=require(_0x01bd('0x16'))(_0x01bd('0x17'));var utils=require(_0x01bd('0x18'));var config=require(_0x01bd('0x19'));var licenseUtil=require(_0x01bd('0x1a'));var db=require(_0x01bd('0x1b'))['db'];config[_0x01bd('0x1c')]=_[_0x01bd('0x1d')](config[_0x01bd('0x1c')],{'host':_0x01bd('0x1e'),'port':0x18eb});var socket=require(_0x01bd('0x1f'))(new Redis(config[_0x01bd('0x1c')]));require(_0x01bd('0x20'))['register'](socket);var jayson=require(_0x01bd('0x21'));var client=jayson['client'][_0x01bd('0x22')]({'port':0x232c});var client9003=jayson['client'][_0x01bd('0x22')]({'port':0x232b});var client9002=jayson['client'][_0x01bd('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x5dd2c6,_0x299852,_0x32847b,_0x331022){return new BPromise(function(_0x584ed8,_0x716b00){var _0x415029=_0x331022||client;return _0x415029[_0x01bd('0x23')](_0x5dd2c6,_0x32847b)[_0x01bd('0x24')](function(_0x354f41){logger[_0x01bd('0x25')]('MailMessage,\x20%s,\x20%s',_0x299852,_0x01bd('0x26'));logger[_0x01bd('0x27')](_0x01bd('0x28'),_0x299852,_0x01bd('0x26'),JSON[_0x01bd('0x29')](_0x354f41));if(_0x354f41[_0x01bd('0x2a')]){if(_0x354f41['error'][_0x01bd('0x2b')]===0x1f4){logger[_0x01bd('0x2a')](_0x01bd('0x2c'),_0x299852,_0x354f41[_0x01bd('0x2a')][_0x01bd('0x2d')]);return _0x716b00(_0x354f41[_0x01bd('0x2a')][_0x01bd('0x2d')]);}logger[_0x01bd('0x2a')](_0x01bd('0x2c'),_0x299852,_0x354f41[_0x01bd('0x2a')][_0x01bd('0x2d')]);return _0x584ed8(_0x354f41[_0x01bd('0x2a')][_0x01bd('0x2d')]);}else{logger[_0x01bd('0x25')](_0x01bd('0x2c'),_0x299852,_0x01bd('0x26'));_0x584ed8(_0x354f41[_0x01bd('0x2e')][_0x01bd('0x2d')]);}})[_0x01bd('0x2f')](function(_0x13b8db){logger[_0x01bd('0x2a')](_0x01bd('0x2c'),_0x299852,_0x13b8db);_0x716b00(_0x13b8db);});});}function respondWithStatusCode(_0x413788,_0x14e55e){_0x14e55e=_0x14e55e||0xcc;return function(_0x29d66b){if(_0x29d66b){return _0x413788[_0x01bd('0x30')](_0x14e55e);}return _0x413788[_0x01bd('0x31')](_0x14e55e)[_0x01bd('0x32')]();};}function respondWithResult(_0x54d094,_0x55fcaf){_0x55fcaf=_0x55fcaf||0xc8;return function(_0x21db7c){if(_0x21db7c){return _0x54d094['status'](_0x55fcaf)[_0x01bd('0x33')](_0x21db7c);}};}function respondWithFilteredResult(_0x35afc7,_0xb2f765){return function(_0x2610df){if(_0x2610df){var _0x552586=_0x2610df[_0x01bd('0x34')],_0x5ac3f1=_0xb2f765[_0x01bd('0x35')],_0x4035ca=_0xb2f765['offset']+_0xb2f765[_0x01bd('0x36')],_0x250a90;if(_0x4035ca>=_0x552586){_0x4035ca=_0x552586;_0x250a90=0xc8;}else{_0x250a90=0xce;}_0x35afc7[_0x01bd('0x31')](_0x250a90);return _0x35afc7[_0x01bd('0x37')](_0x01bd('0x38'),_0x5ac3f1+'-'+_0x4035ca+'/'+_0x552586)[_0x01bd('0x33')](_0x2610df);}return null;};}function patchUpdates(_0x1e7eae){return function(_0x42a1cf){try{jsonpatch['apply'](_0x42a1cf,_0x1e7eae,!![]);}catch(_0x1a7c4d){return BPromise[_0x01bd('0x39')](_0x1a7c4d);}return _0x42a1cf[_0x01bd('0x3a')]();};}function saveUpdates(_0x546596,_0x24ac9f){return function(_0x1c10f8){if(_0x1c10f8){return _0x1c10f8[_0x01bd('0x3b')](_0x546596)['then'](function(_0x44f148){return _0x44f148;});}return null;};}function removeEntity(_0x28813e,_0xc27380){return function(_0xf2b8c){if(_0xf2b8c){return _0xf2b8c['destroy']()[_0x01bd('0x24')](function(){_0x28813e[_0x01bd('0x31')](0xcc)[_0x01bd('0x32')]();});}};}function handleEntityNotFound(_0x4d425a,_0x539bc2){return function(_0x21e707){if(!_0x21e707){_0x4d425a[_0x01bd('0x30')](0x194);}return _0x21e707;};}function handleError(_0x75c994,_0x199b25){_0x199b25=_0x199b25||0x1f4;return function(_0x5e75d2){logger['error'](_0x5e75d2[_0x01bd('0x3c')]);if(_0x5e75d2[_0x01bd('0x3d')]){delete _0x5e75d2['name'];}_0x75c994[_0x01bd('0x31')](_0x199b25)['send'](_0x5e75d2);};}exports[_0x01bd('0x3e')]=function(_0x5f225f,_0x49a3dd){var _0x28d1ef={},_0x5377d8={},_0x5e17b8={'count':0x0,'rows':[]};var _0x1210cf=_['map'](db['MailMessage']['rawAttributes'],function(_0x2b3319){return{'name':_0x2b3319[_0x01bd('0x3f')],'type':_0x2b3319[_0x01bd('0x40')][_0x01bd('0x41')]};});_0x5377d8[_0x01bd('0x42')]=_[_0x01bd('0x43')](_0x1210cf,_0x01bd('0x3d'));_0x5377d8['query']=_[_0x01bd('0x44')](_0x5f225f[_0x01bd('0x45')]);_0x5377d8['filters']=_[_0x01bd('0x46')](_0x5377d8[_0x01bd('0x42')],_0x5377d8[_0x01bd('0x45')]);_0x28d1ef[_0x01bd('0x47')]=_[_0x01bd('0x46')](_0x5377d8['model'],qs[_0x01bd('0x48')](_0x5f225f[_0x01bd('0x45')][_0x01bd('0x48')]));_0x28d1ef[_0x01bd('0x47')]=_0x28d1ef[_0x01bd('0x47')][_0x01bd('0x49')]?_0x28d1ef[_0x01bd('0x47')]:_0x5377d8[_0x01bd('0x42')];if(!_0x5f225f[_0x01bd('0x45')][_0x01bd('0x4a')](_0x01bd('0x4b'))){_0x28d1ef['limit']=qs[_0x01bd('0x36')](_0x5f225f[_0x01bd('0x45')][_0x01bd('0x36')]);_0x28d1ef[_0x01bd('0x35')]=qs[_0x01bd('0x35')](_0x5f225f[_0x01bd('0x45')][_0x01bd('0x35')]);}_0x28d1ef[_0x01bd('0x4c')]=qs[_0x01bd('0x4d')](_0x5f225f[_0x01bd('0x45')]['sort']);_0x28d1ef[_0x01bd('0x4e')]=qs[_0x01bd('0x4f')](_[_0x01bd('0x50')](_0x5f225f[_0x01bd('0x45')],_0x5377d8[_0x01bd('0x4f')]),_0x1210cf);if(_0x5f225f[_0x01bd('0x45')][_0x01bd('0x51')]){_0x28d1ef[_0x01bd('0x4e')]=_[_0x01bd('0x52')](_0x28d1ef['where'],{'$or':_[_0x01bd('0x43')](_0x1210cf,function(_0x126fe6){if(_0x126fe6[_0x01bd('0x40')]!==_0x01bd('0x53')){var _0x2a17b8={};_0x2a17b8[_0x126fe6[_0x01bd('0x3d')]]={'$like':'%'+_0x5f225f['query']['filter']+'%'};return _0x2a17b8;}})});}_0x28d1ef=_[_0x01bd('0x52')]({},_0x28d1ef,_0x5f225f[_0x01bd('0x54')]);var _0x5b2265={'where':_0x28d1ef[_0x01bd('0x4e')]};return db[_0x01bd('0x55')][_0x01bd('0x34')](_0x5b2265)[_0x01bd('0x24')](function(_0x1455a1){_0x5e17b8[_0x01bd('0x34')]=_0x1455a1;if(_0x5f225f['query']['includeAll']){_0x28d1ef['include']=[{'all':!![]}];}return db[_0x01bd('0x55')][_0x01bd('0x56')](_0x28d1ef);})[_0x01bd('0x24')](function(_0x51c6db){_0x5e17b8[_0x01bd('0x57')]=_0x51c6db;return _0x5e17b8;})[_0x01bd('0x24')](respondWithFilteredResult(_0x49a3dd,_0x28d1ef))[_0x01bd('0x2f')](handleError(_0x49a3dd,null));};exports[_0x01bd('0x58')]=function(_0x4cec2d,_0x28674f){var _0x2eea4a={'raw':!![],'where':{'id':_0x4cec2d['params']['id']}},_0x26ed30={};_0x26ed30[_0x01bd('0x42')]=_['keys'](db[_0x01bd('0x55')][_0x01bd('0x59')]);_0x26ed30[_0x01bd('0x45')]=_[_0x01bd('0x44')](_0x4cec2d['query']);_0x26ed30[_0x01bd('0x4f')]=_[_0x01bd('0x46')](_0x26ed30[_0x01bd('0x42')],_0x26ed30['query']);_0x2eea4a['attributes']=_[_0x01bd('0x46')](_0x26ed30['model'],qs[_0x01bd('0x48')](_0x4cec2d['query'][_0x01bd('0x48')]));_0x2eea4a[_0x01bd('0x47')]=_0x2eea4a[_0x01bd('0x47')]['length']?_0x2eea4a['attributes']:_0x26ed30[_0x01bd('0x42')];if(_0x4cec2d[_0x01bd('0x45')][_0x01bd('0x5a')]){_0x2eea4a[_0x01bd('0x5b')]=[{'all':!![]}];}_0x2eea4a=_['merge']({},_0x2eea4a,_0x4cec2d[_0x01bd('0x54')]);return db[_0x01bd('0x55')]['find'](_0x2eea4a)[_0x01bd('0x24')](handleEntityNotFound(_0x28674f,null))['then'](respondWithResult(_0x28674f,null))[_0x01bd('0x2f')](handleError(_0x28674f,null));};exports[_0x01bd('0x3b')]=function(_0x2fc394,_0x77d39b){if(_0x2fc394[_0x01bd('0x5c')]['id']){delete _0x2fc394['body']['id'];}return db[_0x01bd('0x55')][_0x01bd('0x5d')]({'where':{'id':_0x2fc394['params']['id']}})[_0x01bd('0x24')](handleEntityNotFound(_0x77d39b,null))[_0x01bd('0x24')](saveUpdates(_0x2fc394[_0x01bd('0x5c')],null))[_0x01bd('0x24')](respondWithResult(_0x77d39b,null))['catch'](handleError(_0x77d39b,null));};exports[_0x01bd('0x5e')]=function(_0x583ffd,_0x5a7c4c){return db[_0x01bd('0x55')][_0x01bd('0x5d')]({'where':{'id':_0x583ffd[_0x01bd('0x5f')]['id']}})[_0x01bd('0x24')](handleEntityNotFound(_0x5a7c4c,null))[_0x01bd('0x24')](removeEntity(_0x5a7c4c,null))[_0x01bd('0x2f')](handleError(_0x5a7c4c,null));};exports[_0x01bd('0x60')]=function(_0x3b3ab3,_0x52102a){return db['MailMessage']['describe']()[_0x01bd('0x24')](respondWithResult(_0x52102a,null))['catch'](handleError(_0x52102a,null));};exports[_0x01bd('0x61')]=function(_0x3b018a,_0x5dfcb1){return db[_0x01bd('0x55')][_0x01bd('0x61')](_0x3b018a['body'])[_0x01bd('0x24')](function(_0x2aac32){if(_0x2aac32){if(_0x2aac32[_0x01bd('0x62')]===_0x01bd('0x63')&&!_0x2aac32['secret']){var _0x458380,_0x163a6b,_0x14e259;if(_0x3b018a[_0x01bd('0x5c')]['to']){_0x163a6b=_0x3b018a[_0x01bd('0x5c')]['to'][_0x01bd('0x64')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x2aac32[_0x01bd('0x65')]},'include':[{'model':db['CmList'],'as':_0x01bd('0x66'),'include':[{'model':db[_0x01bd('0x67')],'as':'Contacts','where':{'email':_0x163a6b},'limit':0x1,'order':[[_0x01bd('0x68'),_0x01bd('0x69')]]}]},{'model':db[_0x01bd('0x6a')],'as':'Smtp','raw':!![]}]})[_0x01bd('0x24')](function(_0x410dcf){_0x458380=_0x410dcf;if(_0x458380&&_0x458380[_0x01bd('0x6b')]){var _0x32ec05={'tls':{'rejectUnauthorized':![]}};if(_[_0x01bd('0x6c')](_0x458380[_0x01bd('0x6b')]['service'])){_0x32ec05[_0x01bd('0x6d')]=_0x458380[_0x01bd('0x6b')]['host'];_0x32ec05[_0x01bd('0x6e')]=_0x458380[_0x01bd('0x6b')][_0x01bd('0x6e')];_0x32ec05['secure']=_0x458380[_0x01bd('0x6b')][_0x01bd('0x6f')];if(_0x458380[_0x01bd('0x6b')][_0x01bd('0x70')]){_0x32ec05['auth']={'user':_0x458380[_0x01bd('0x6b')]['user'],'pass':_0x458380[_0x01bd('0x6b')][_0x01bd('0x71')]};}}else{_0x32ec05[_0x01bd('0x72')]=_0x458380['Smtp'][_0x01bd('0x72')];_0x32ec05[_0x01bd('0x73')]={'user':_0x458380['Smtp']['user'],'pass':_0x458380[_0x01bd('0x6b')]['pass']};_0x32ec05[_0x01bd('0x6f')]=_0x458380['Smtp']['secure'];}if(_0x3b018a[_0x01bd('0x5c')][_0x01bd('0x74')]&&_0x3b018a[_0x01bd('0x5c')][_0x01bd('0x74')]['length']){for(var _0x4f6ac0=0x0;_0x4f6ac0<_0x3b018a['body'][_0x01bd('0x74')][_0x01bd('0x49')];_0x4f6ac0+=0x1){_0x3b018a['body']['attachments'][_0x4f6ac0]={'filename':_0x3b018a[_0x01bd('0x5c')]['attachments'][_0x4f6ac0][_0x01bd('0x3d')],'path':path[_0x01bd('0x75')](config['root'],_0x01bd('0x76'),_0x3b018a['body'][_0x01bd('0x74')][_0x4f6ac0][_0x01bd('0x77')])};}}_0x14e259={'account':_0x32ec05,'message':_0x3b018a['body']};return;}})[_0x01bd('0x24')](function(){if(_0x458380[_0x01bd('0x66')]){if(_0x458380[_0x01bd('0x66')][_0x01bd('0x78')][_0x01bd('0x49')]){return _0x458380['List'][_0x01bd('0x78')][0x0];}else{return db['CmContact'][_0x01bd('0x61')](_[_0x01bd('0x1d')](_0x3b018a[_0x01bd('0x5c')],{'firstName':_0x3b018a[_0x01bd('0x5c')]['to'],'email':_0x3b018a['body']['to'],'phone':_0x3b018a['body']['to'],'ListId':_0x458380[_0x01bd('0x79')]}));}}else{throw new Error(_0x01bd('0x7a'));}})[_0x01bd('0x24')](function(){if(_0x14e259){return respondWithRpcPromise('SendMail',_0x01bd('0x7b'),_0x14e259,client9003)[_0x01bd('0x24')](function(_0x2fa8ff){return _0x2aac32[_0x01bd('0x3b')]({'read':!![],'messageId':_0x2fa8ff[_0x01bd('0x7c')],'sentAt':moment()[_0x01bd('0x7d')](_0x01bd('0x7e'))});})[_0x01bd('0x2f')](function(_0x1208df){logger[_0x01bd('0x2a')]('%s',JSON[_0x01bd('0x29')](_0x1208df));return _0x2aac32;});}return _0x2aac32;});}return _0x2aac32;}})[_0x01bd('0x24')](respondWithResult(_0x5dfcb1,0xc9))[_0x01bd('0x2f')](handleError(_0x5dfcb1,null));};var interaction_log=require('../../config/logger')(_0x01bd('0x7f'));exports[_0x01bd('0x80')]=function(_0x7debeb,_0x17fe4a,_0x17219c){var _0x103186={'channel':_0x01bd('0x81')};if(_0x7debeb[_0x01bd('0x5c')]['id']){delete _0x7debeb[_0x01bd('0x5c')]['id'];}_0x7debeb[_0x01bd('0x5c')][_0x01bd('0x82')]=!![];_0x7debeb[_0x01bd('0x5c')][_0x01bd('0x83')]=moment()['format'](_0x01bd('0x7e'));_0x7debeb[_0x01bd('0x5c')]['UserId']=_0x7debeb['body'][_0x01bd('0x84')]||_0x7debeb[_0x01bd('0x85')]['id'];return db[_0x01bd('0x55')][_0x01bd('0x5d')]({'where':{'id':_0x7debeb[_0x01bd('0x5f')]['id'],'UserId':null},'include':[{'model':db[_0x01bd('0x67')],'as':_0x01bd('0x86')}]})[_0x01bd('0x24')](handleEntityNotFound(_0x17fe4a,null))['then'](saveUpdates(_0x7debeb['body'],null))[_0x01bd('0x24')](function(_0x49d2e3){if(_0x49d2e3){_0x103186[_0x01bd('0x2d')]=_0x49d2e3[_0x01bd('0x87')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x49d2e3[_0x01bd('0x88')]}});}return null;})['then'](handleEntityNotFound(_0x17fe4a,null))[_0x01bd('0x24')](function(_0x5015db){if(_0x5015db){return _0x5015db['update']({'UserId':_0x7debeb[_0x01bd('0x5c')][_0x01bd('0x84')],'read1stAt':_[_0x01bd('0x6c')](_0x5015db[_0x01bd('0x89')])?moment()[_0x01bd('0x7d')](_0x01bd('0x7e')):undefined});}return null;})[_0x01bd('0x24')](function(_0x34ef50){if(_0x34ef50){_0x103186[_0x01bd('0x8a')]=_0x34ef50[_0x01bd('0x87')]({'plain':!![]});interaction_log[_0x01bd('0x25')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x7debeb[_0x01bd('0x85')]['id'],_0x7debeb['user'][_0x01bd('0x3d')],_0x7debeb[_0x01bd('0x85')][_0x01bd('0x8b')],_0x103186['interaction']['id'],_0x7debeb[_0x01bd('0x5c')]?JSON[_0x01bd('0x29')](_0x7debeb[_0x01bd('0x5c')]):_0x01bd('0x8c'));return respondWithRpcPromise(_0x01bd('0x8d'),_0x01bd('0x8e'),_0x103186);}return null;})['then'](function(_0x3b4b77){if(_0x3b4b77){if(_0x7debeb[_0x01bd('0x5c')]['manual']){_0x103186['message'][_0x01bd('0x8f')]=util[_0x01bd('0x7d')]('SIP/%s',_0x7debeb['user'][_0x01bd('0x3d')]);_0x103186[_0x01bd('0x2d')][_0x01bd('0x90')]=_0x103186[_0x01bd('0x90')];_0x103186[_0x01bd('0x2d')][_0x01bd('0x91')]=_0x01bd('0x80');return respondWithRpcPromise(_0x01bd('0x92'),_0x01bd('0x92'),{'event':_0x01bd('0x93'),'message':_0x103186[_0x01bd('0x2d')]},client9002)[_0x01bd('0x24')](function(){return _0x103186;});}return _0x103186;}return null;})[_0x01bd('0x24')](respondWithResult(_0x17fe4a,null))[_0x01bd('0x2f')](handleError(_0x17fe4a,null));};var interaction_log=require(_0x01bd('0x16'))(_0x01bd('0x7f'));exports[_0x01bd('0x39')]=function(_0x6516d5,_0x1f5fec,_0x43bc21){var _0x5733ed={'agent':{},'channel':'mail'};if(_0x6516d5['body']['id']){delete _0x6516d5[_0x01bd('0x5c')]['id'];}_0x6516d5[_0x01bd('0x5c')][_0x01bd('0x84')]=_0x6516d5['body'][_0x01bd('0x84')]||_0x6516d5[_0x01bd('0x85')]['id'];_0x5733ed['agent']['id']=_0x6516d5[_0x01bd('0x5c')]['UserId'];return db[_0x01bd('0x55')]['find']({'where':{'id':_0x6516d5[_0x01bd('0x5f')]['id'],'UserId':null}})[_0x01bd('0x24')](handleEntityNotFound(_0x1f5fec,null))['then'](function(_0x68f724){if(_0x68f724){_0x5733ed[_0x01bd('0x2d')]=_0x68f724[_0x01bd('0x87')]({'plain':!![]});return db[_0x01bd('0x94')][_0x01bd('0x5d')]({'where':{'id':_0x68f724[_0x01bd('0x88')]}});}return null;})[_0x01bd('0x24')](handleEntityNotFound(_0x1f5fec,null))['then'](function(_0x57601f){if(_0x57601f){_0x5733ed[_0x01bd('0x8a')]=_0x57601f[_0x01bd('0x87')]({'plain':!![]});interaction_log['info'](_0x01bd('0x95'),_0x6516d5[_0x01bd('0x85')]['id'],_0x6516d5[_0x01bd('0x85')][_0x01bd('0x3d')],_0x6516d5['user']['role'],_0x5733ed['interaction']['id'],_0x6516d5[_0x01bd('0x5c')]?JSON[_0x01bd('0x29')](_0x6516d5['body']):_0x01bd('0x8c'));return respondWithRpcPromise(_0x01bd('0x96'),_0x01bd('0x97'),_0x5733ed);}return null;})[_0x01bd('0x24')](function(_0x592c8a){if(_0x592c8a){_0x592c8a[_0x01bd('0x2d')][_0x01bd('0x8f')]=util[_0x01bd('0x7d')]('SIP/%s',_0x6516d5[_0x01bd('0x85')][_0x01bd('0x3d')]);_0x592c8a[_0x01bd('0x2d')][_0x01bd('0x90')]=_0x5733ed[_0x01bd('0x90')];_0x592c8a[_0x01bd('0x2d')][_0x01bd('0x91')]='reject';respondWithRpcPromise(_0x01bd('0x92'),'EventManager',{'event':'rejectmessage','message':_0x592c8a[_0x01bd('0x2d')]},client9002);return _0x5733ed;}return null;})['then'](respondWithResult(_0x1f5fec,null))[_0x01bd('0x2f')](handleError(_0x1f5fec,null));};exports['download']=function(_0x509c8d,_0x383faf){var _0x3a8123=moment()[_0x01bd('0x98')]()['toString']();var _0x5b105d=path[_0x01bd('0x75')](config[_0x01bd('0x99')],_0x01bd('0x9a'),_0x01bd('0x9b'),'tmp');var _0x417631=path[_0x01bd('0x75')](config[_0x01bd('0x99')],_0x01bd('0x9a'),_0x01bd('0x9b'),_0x01bd('0x74'));var _0x33769f=util[_0x01bd('0x7d')](_0x01bd('0x9c'),_0x3a8123);return db['MailMessage'][_0x01bd('0x5d')]({'where':{'id':_0x509c8d['params']['id']},'attributes':['id',_0x01bd('0x5c'),_0x01bd('0x9d'),'to','cc','bcc',_0x01bd('0x9e'),_0x01bd('0x9f')],'include':_0x509c8d['query'][_0x01bd('0x74')]?[{'model':db[_0x01bd('0xa0')],'as':'Attachments'}]:undefined})[_0x01bd('0x24')](handleEntityNotFound(_0x383faf,null))['then'](function(_0x338aa8){if(_0x338aa8){var _0x52c6f7=_0x338aa8;var _0x2b5509={'from':_0x52c6f7[_0x01bd('0x9d')],'to':_0x52c6f7['to'],'subject':_0x52c6f7[_0x01bd('0x9e')],'html':_0x52c6f7['body'],'headers':{'Date':moment(_0x52c6f7[_0x01bd('0x9f')])[_0x01bd('0x7d')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x338aa8['cc']){_0x2b5509[_0x01bd('0xa1')]['Cc']=_0x338aa8['cc'];}if(_0x338aa8['bcc']){_0x2b5509['headers'][_0x01bd('0xa2')]=_0x338aa8[_0x01bd('0xa3')];}return new BPromise(function(_0x51a2d9,_0x3634d3){if(_0x338aa8[_0x01bd('0xa4')]){for(var _0x2ebc58=0x0;_0x2ebc58<_0x338aa8[_0x01bd('0xa4')]['length'];_0x2ebc58++){var _0x172dca=_0x338aa8[_0x01bd('0xa4')][_0x2ebc58];var _0x3fdf81=path[_0x01bd('0x75')](_0x417631,_0x172dca[_0x01bd('0x77')]);if(fs[_0x01bd('0xa5')](_0x3fdf81)){_0x2b5509[_0x01bd('0x74')][_0x01bd('0xa6')]({'name':_0x172dca[_0x01bd('0x3d')],'contentType':_0x172dca[_0x01bd('0x40')],'data':fs['readFileSync'](_0x3fdf81)});}}}emlformat[_0x01bd('0xa7')](_0x2b5509,function(_0x3daa2c,_0x12acc4){if(_0x3daa2c)return _0x3634d3(_0x3daa2c);fs[_0x01bd('0xa8')](path[_0x01bd('0x75')](_0x5b105d,_0x33769f),_0x12acc4);return _0x51a2d9(_0x12acc4);});});}})[_0x01bd('0x24')](function(_0x1cc295){if(_0x1cc295){return _0x383faf[_0x01bd('0xa9')](path['join'](_0x5b105d,_0x33769f),_0x33769f,function(_0x7d4ea0){if(_0x7d4ea0){console[_0x01bd('0xaa')](_0x01bd('0xab'),_0x7d4ea0);}else{fs[_0x01bd('0xac')](path[_0x01bd('0x75')](_0x5b105d,_0x33769f));}});}})[_0x01bd('0x2f')](handleError(_0x383faf,null));}; \ No newline at end of file +var _0x1212=['Smtp','service','port','secure','authentication','auth','user','pass','length','attachments','join','root','server/files/attachments','basename','List','ListId','List\x20not\x20found','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','format','UserId','Contact','MailInteractionId','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','RejectMessage','event','rejectmessage','download','toString','server','tmp','files','bcc','subject','createdAt','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','readFileSync','build','writeFileSync','log','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','end','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','offset','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','rows','show','params','options','body','find','destroy','create','out','secret','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut'];(function(_0x336a6e,_0x4c454f){var _0x4c0b21=function(_0x3590a0){while(--_0x3590a0){_0x336a6e['push'](_0x336a6e['shift']());}};_0x4c0b21(++_0x4c454f);}(_0x1212,0xe8));var _0x2121=function(_0x40162a,_0x265b0c){_0x40162a=_0x40162a-0x0;var _0x488161=_0x1212[_0x40162a];return _0x488161;};'use strict';var pdf=require(_0x2121('0x0'));var emlformat=require(_0x2121('0x1'));var rimraf=require(_0x2121('0x2'));var zipdir=require(_0x2121('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2121('0x4'));var moment=require(_0x2121('0x5'));var BPromise=require(_0x2121('0x6'));var Mustache=require(_0x2121('0x7'));var util=require(_0x2121('0x8'));var path=require(_0x2121('0x9'));var sox=require(_0x2121('0xa'));var csv=require(_0x2121('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2121('0xc'));var squel=require(_0x2121('0xd'));var crypto=require(_0x2121('0xe'));var jsforce=require(_0x2121('0xf'));var deskjs=require(_0x2121('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2121('0x11'));var Papa=require('papaparse');var Redis=require(_0x2121('0x12'));var authService=require(_0x2121('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2121('0x14'));var hardwareService=require(_0x2121('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2121('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2121('0x17'))['db'];config[_0x2121('0x18')]=_[_0x2121('0x19')](config[_0x2121('0x18')],{'host':_0x2121('0x1a'),'port':0x18eb});var socket=require(_0x2121('0x1b'))(new Redis(config[_0x2121('0x18')]));require(_0x2121('0x1c'))[_0x2121('0x1d')](socket);var jayson=require(_0x2121('0x1e'));var client=jayson[_0x2121('0x1f')][_0x2121('0x20')]({'port':0x232c});var client9003=jayson['client'][_0x2121('0x20')]({'port':0x232b});var client9002=jayson['client'][_0x2121('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x28ce66,_0xd4a79b,_0x1a25f7,_0x3db79d){return new BPromise(function(_0x217851,_0x5e4b1b){var _0x30eefa=_0x3db79d||client;return _0x30eefa[_0x2121('0x21')](_0x28ce66,_0x1a25f7)[_0x2121('0x22')](function(_0x18b626){logger[_0x2121('0x23')](_0x2121('0x24'),_0xd4a79b,_0x2121('0x25'));logger['debug'](_0x2121('0x26'),_0xd4a79b,_0x2121('0x25'),JSON['stringify'](_0x18b626));if(_0x18b626['error']){if(_0x18b626['error'][_0x2121('0x27')]===0x1f4){logger[_0x2121('0x28')](_0x2121('0x24'),_0xd4a79b,_0x18b626[_0x2121('0x28')][_0x2121('0x29')]);return _0x5e4b1b(_0x18b626[_0x2121('0x28')]['message']);}logger[_0x2121('0x28')](_0x2121('0x24'),_0xd4a79b,_0x18b626['error']['message']);return _0x217851(_0x18b626[_0x2121('0x28')][_0x2121('0x29')]);}else{logger[_0x2121('0x23')]('MailMessage,\x20%s,\x20%s',_0xd4a79b,_0x2121('0x25'));_0x217851(_0x18b626[_0x2121('0x2a')][_0x2121('0x29')]);}})[_0x2121('0x2b')](function(_0x1546bb){logger[_0x2121('0x28')](_0x2121('0x24'),_0xd4a79b,_0x1546bb);_0x5e4b1b(_0x1546bb);});});}function respondWithStatusCode(_0x14a7bd,_0x26891b){_0x26891b=_0x26891b||0xcc;return function(_0x20a4e1){if(_0x20a4e1){return _0x14a7bd[_0x2121('0x2c')](_0x26891b);}return _0x14a7bd[_0x2121('0x2d')](_0x26891b)['end']();};}function respondWithResult(_0x292b31,_0x40469d){_0x40469d=_0x40469d||0xc8;return function(_0x3397f5){if(_0x3397f5){return _0x292b31['status'](_0x40469d)[_0x2121('0x2e')](_0x3397f5);}};}function respondWithFilteredResult(_0x3890b9,_0x190abe){return function(_0xef9ab2){if(_0xef9ab2){var _0x5056e0=_0xef9ab2[_0x2121('0x2f')],_0x121bb5=_0x190abe['offset'],_0x15a759=_0x190abe['offset']+_0x190abe[_0x2121('0x30')],_0x1f2f85;if(_0x15a759>=_0x5056e0){_0x15a759=_0x5056e0;_0x1f2f85=0xc8;}else{_0x1f2f85=0xce;}_0x3890b9[_0x2121('0x2d')](_0x1f2f85);return _0x3890b9[_0x2121('0x31')](_0x2121('0x32'),_0x121bb5+'-'+_0x15a759+'/'+_0x5056e0)[_0x2121('0x2e')](_0xef9ab2);}return null;};}function patchUpdates(_0x15cfe6){return function(_0x20104e){try{jsonpatch[_0x2121('0x33')](_0x20104e,_0x15cfe6,!![]);}catch(_0x1e21da){return BPromise[_0x2121('0x34')](_0x1e21da);}return _0x20104e[_0x2121('0x35')]();};}function saveUpdates(_0x2016f5,_0x10e214){return function(_0x205cf5){if(_0x205cf5){return _0x205cf5[_0x2121('0x36')](_0x2016f5)[_0x2121('0x22')](function(_0x476e9e){return _0x476e9e;});}return null;};}function removeEntity(_0x696112,_0x56fabf){return function(_0x1fc8fa){if(_0x1fc8fa){return _0x1fc8fa['destroy']()['then'](function(){_0x696112['status'](0xcc)[_0x2121('0x37')]();});}};}function handleEntityNotFound(_0x59be76,_0x220685){return function(_0x4a13f2){if(!_0x4a13f2){_0x59be76['sendStatus'](0x194);}return _0x4a13f2;};}function handleError(_0x275baa,_0x3a7403){_0x3a7403=_0x3a7403||0x1f4;return function(_0x280c6d){logger['error'](_0x280c6d[_0x2121('0x38')]);if(_0x280c6d[_0x2121('0x39')]){delete _0x280c6d['name'];}_0x275baa['status'](_0x3a7403)[_0x2121('0x3a')](_0x280c6d);};}exports[_0x2121('0x3b')]=function(_0x143f81,_0x277191){var _0x5be1cd={},_0x1f47e6={},_0x29fb68={'count':0x0,'rows':[]};var _0x227cf8=_[_0x2121('0x3c')](db[_0x2121('0x3d')][_0x2121('0x3e')],function(_0x5a4f8){return{'name':_0x5a4f8[_0x2121('0x3f')],'type':_0x5a4f8[_0x2121('0x40')][_0x2121('0x41')]};});_0x1f47e6[_0x2121('0x42')]=_[_0x2121('0x3c')](_0x227cf8,_0x2121('0x39'));_0x1f47e6['query']=_[_0x2121('0x43')](_0x143f81[_0x2121('0x44')]);_0x1f47e6['filters']=_['intersection'](_0x1f47e6[_0x2121('0x42')],_0x1f47e6[_0x2121('0x44')]);_0x5be1cd[_0x2121('0x45')]=_[_0x2121('0x46')](_0x1f47e6[_0x2121('0x42')],qs[_0x2121('0x47')](_0x143f81[_0x2121('0x44')][_0x2121('0x47')]));_0x5be1cd[_0x2121('0x45')]=_0x5be1cd[_0x2121('0x45')]['length']?_0x5be1cd[_0x2121('0x45')]:_0x1f47e6[_0x2121('0x42')];if(!_0x143f81[_0x2121('0x44')]['hasOwnProperty']('nolimit')){_0x5be1cd[_0x2121('0x30')]=qs['limit'](_0x143f81[_0x2121('0x44')]['limit']);_0x5be1cd[_0x2121('0x48')]=qs['offset'](_0x143f81[_0x2121('0x44')]['offset']);}_0x5be1cd[_0x2121('0x49')]=qs['sort'](_0x143f81[_0x2121('0x44')][_0x2121('0x4a')]);_0x5be1cd['where']=qs[_0x2121('0x4b')](_['pick'](_0x143f81[_0x2121('0x44')],_0x1f47e6[_0x2121('0x4b')]),_0x227cf8);if(_0x143f81[_0x2121('0x44')][_0x2121('0x4c')]){_0x5be1cd[_0x2121('0x4d')]=_[_0x2121('0x4e')](_0x5be1cd['where'],{'$or':_[_0x2121('0x3c')](_0x227cf8,function(_0x4716e7){if(_0x4716e7[_0x2121('0x40')]!==_0x2121('0x4f')){var _0xcf5980={};_0xcf5980[_0x4716e7['name']]={'$like':'%'+_0x143f81[_0x2121('0x44')][_0x2121('0x4c')]+'%'};return _0xcf5980;}})});}_0x5be1cd=_['merge']({},_0x5be1cd,_0x143f81['options']);var _0x1f8a5a={'where':_0x5be1cd['where']};return db[_0x2121('0x3d')][_0x2121('0x2f')](_0x1f8a5a)[_0x2121('0x22')](function(_0x12229d){_0x29fb68[_0x2121('0x2f')]=_0x12229d;if(_0x143f81[_0x2121('0x44')][_0x2121('0x50')]){_0x5be1cd['include']=[{'all':!![]}];}return db[_0x2121('0x3d')]['findAll'](_0x5be1cd);})[_0x2121('0x22')](function(_0x28ce68){_0x29fb68[_0x2121('0x51')]=_0x28ce68;return _0x29fb68;})['then'](respondWithFilteredResult(_0x277191,_0x5be1cd))[_0x2121('0x2b')](handleError(_0x277191,null));};exports[_0x2121('0x52')]=function(_0x290873,_0x3ef767){var _0x5f2223={'raw':!![],'where':{'id':_0x290873[_0x2121('0x53')]['id']}},_0x52e21e={};_0x52e21e['model']=_[_0x2121('0x43')](db['MailMessage'][_0x2121('0x3e')]);_0x52e21e[_0x2121('0x44')]=_[_0x2121('0x43')](_0x290873[_0x2121('0x44')]);_0x52e21e[_0x2121('0x4b')]=_[_0x2121('0x46')](_0x52e21e['model'],_0x52e21e[_0x2121('0x44')]);_0x5f2223[_0x2121('0x45')]=_[_0x2121('0x46')](_0x52e21e['model'],qs[_0x2121('0x47')](_0x290873[_0x2121('0x44')][_0x2121('0x47')]));_0x5f2223[_0x2121('0x45')]=_0x5f2223[_0x2121('0x45')]['length']?_0x5f2223[_0x2121('0x45')]:_0x52e21e[_0x2121('0x42')];if(_0x290873[_0x2121('0x44')][_0x2121('0x50')]){_0x5f2223['include']=[{'all':!![]}];}_0x5f2223=_[_0x2121('0x4e')]({},_0x5f2223,_0x290873[_0x2121('0x54')]);return db[_0x2121('0x3d')]['find'](_0x5f2223)[_0x2121('0x22')](handleEntityNotFound(_0x3ef767,null))[_0x2121('0x22')](respondWithResult(_0x3ef767,null))[_0x2121('0x2b')](handleError(_0x3ef767,null));};exports['update']=function(_0x17a3e5,_0x22b2b0){if(_0x17a3e5[_0x2121('0x55')]['id']){delete _0x17a3e5[_0x2121('0x55')]['id'];}return db[_0x2121('0x3d')][_0x2121('0x56')]({'where':{'id':_0x17a3e5['params']['id']}})[_0x2121('0x22')](handleEntityNotFound(_0x22b2b0,null))['then'](saveUpdates(_0x17a3e5['body'],null))[_0x2121('0x22')](respondWithResult(_0x22b2b0,null))[_0x2121('0x2b')](handleError(_0x22b2b0,null));};exports[_0x2121('0x57')]=function(_0xd971c,_0x4a6915){return db[_0x2121('0x3d')][_0x2121('0x56')]({'where':{'id':_0xd971c[_0x2121('0x53')]['id']}})['then'](handleEntityNotFound(_0x4a6915,null))[_0x2121('0x22')](removeEntity(_0x4a6915,null))['catch'](handleError(_0x4a6915,null));};exports['describe']=function(_0x202e49,_0x571598){return db[_0x2121('0x3d')]['describe']()[_0x2121('0x22')](respondWithResult(_0x571598,null))['catch'](handleError(_0x571598,null));};exports[_0x2121('0x58')]=function(_0x1a0538,_0x443e76){return db['MailMessage'][_0x2121('0x58')](_0x1a0538[_0x2121('0x55')])[_0x2121('0x22')](function(_0x13710e){if(_0x13710e){if(_0x13710e['direction']===_0x2121('0x59')&&!_0x13710e[_0x2121('0x5a')]){var _0x43cd61,_0x4765b6,_0x3ec4e4;if(_0x1a0538[_0x2121('0x55')]['to']){_0x4765b6=_0x1a0538[_0x2121('0x55')]['to']['split'](',')[0x0];}return db[_0x2121('0x5b')][_0x2121('0x5c')]({'where':{'id':_0x13710e[_0x2121('0x5d')]},'include':[{'model':db[_0x2121('0x5e')],'as':'List','include':[{'model':db[_0x2121('0x5f')],'as':_0x2121('0x60'),'where':{'email':_0x4765b6},'limit':0x1,'order':[[_0x2121('0x61'),_0x2121('0x62')]]}]},{'model':db[_0x2121('0x63')],'as':_0x2121('0x64'),'raw':!![]}]})[_0x2121('0x22')](function(_0x34ba05){_0x43cd61=_0x34ba05;if(_0x43cd61&&_0x43cd61['Smtp']){var _0x1f402c={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x43cd61[_0x2121('0x64')][_0x2121('0x65')])){_0x1f402c['host']=_0x43cd61[_0x2121('0x64')]['host'];_0x1f402c[_0x2121('0x66')]=_0x43cd61['Smtp'][_0x2121('0x66')];_0x1f402c[_0x2121('0x67')]=_0x43cd61[_0x2121('0x64')][_0x2121('0x67')];if(_0x43cd61[_0x2121('0x64')][_0x2121('0x68')]){_0x1f402c[_0x2121('0x69')]={'user':_0x43cd61['Smtp'][_0x2121('0x6a')],'pass':_0x43cd61[_0x2121('0x64')][_0x2121('0x6b')]};}}else{_0x1f402c[_0x2121('0x65')]=_0x43cd61[_0x2121('0x64')][_0x2121('0x65')];_0x1f402c[_0x2121('0x69')]={'user':_0x43cd61[_0x2121('0x64')][_0x2121('0x6a')],'pass':_0x43cd61[_0x2121('0x64')]['pass']};_0x1f402c[_0x2121('0x67')]=_0x43cd61[_0x2121('0x64')]['secure'];}if(_0x1a0538[_0x2121('0x55')]['attachments']&&_0x1a0538[_0x2121('0x55')]['attachments'][_0x2121('0x6c')]){for(var _0x5c55b5=0x0;_0x5c55b5<_0x1a0538[_0x2121('0x55')]['attachments']['length'];_0x5c55b5+=0x1){_0x1a0538['body'][_0x2121('0x6d')][_0x5c55b5]={'filename':_0x1a0538[_0x2121('0x55')][_0x2121('0x6d')][_0x5c55b5][_0x2121('0x39')],'path':path[_0x2121('0x6e')](config[_0x2121('0x6f')],_0x2121('0x70'),_0x1a0538['body']['attachments'][_0x5c55b5][_0x2121('0x71')])};}}_0x3ec4e4={'account':_0x1f402c,'message':_0x1a0538[_0x2121('0x55')]};return;}})[_0x2121('0x22')](function(){if(_0x43cd61[_0x2121('0x72')]){if(_0x43cd61['List'][_0x2121('0x60')][_0x2121('0x6c')]){return _0x43cd61['List']['Contacts'][0x0];}else{return db['CmContact'][_0x2121('0x58')](_[_0x2121('0x19')](_0x1a0538['body'],{'firstName':_0x1a0538[_0x2121('0x55')]['to'],'email':_0x1a0538[_0x2121('0x55')]['to'],'phone':_0x1a0538['body']['to'],'ListId':_0x43cd61[_0x2121('0x73')]}));}}else{throw new Error(_0x2121('0x74'));}})['then'](function(){if(_0x3ec4e4){return respondWithRpcPromise('SendMail',_0x2121('0x75'),_0x3ec4e4,client9003)[_0x2121('0x22')](function(_0x2d3d2f){return _0x13710e[_0x2121('0x36')]({'read':!![],'messageId':_0x2d3d2f[_0x2121('0x76')],'sentAt':moment()['format'](_0x2121('0x77'))});})[_0x2121('0x2b')](function(_0x931858){logger['error']('%s',JSON['stringify'](_0x931858));return _0x13710e;});}return _0x13710e;});}return _0x13710e;}})[_0x2121('0x22')](respondWithResult(_0x443e76,0xc9))[_0x2121('0x2b')](handleError(_0x443e76,null));};var interaction_log=require(_0x2121('0x78'))('mail-interactions');exports[_0x2121('0x79')]=function(_0x1b8527,_0x455c2f,_0x47a489){var _0x43e09a={'channel':_0x2121('0x7a')};if(_0x1b8527['body']['id']){delete _0x1b8527[_0x2121('0x55')]['id'];}_0x1b8527['body'][_0x2121('0x7b')]=!![];_0x1b8527[_0x2121('0x55')][_0x2121('0x7c')]=moment()[_0x2121('0x7d')](_0x2121('0x77'));_0x1b8527[_0x2121('0x55')]['UserId']=_0x1b8527[_0x2121('0x55')][_0x2121('0x7e')]||_0x1b8527[_0x2121('0x6a')]['id'];return db['MailMessage'][_0x2121('0x56')]({'where':{'id':_0x1b8527['params']['id'],'UserId':null},'include':[{'model':db[_0x2121('0x5f')],'as':_0x2121('0x7f')}]})['then'](handleEntityNotFound(_0x455c2f,null))[_0x2121('0x22')](saveUpdates(_0x1b8527['body'],null))[_0x2121('0x22')](function(_0x369909){if(_0x369909){_0x43e09a['message']=_0x369909['get']({'plain':!![]});return db['MailInteraction'][_0x2121('0x56')]({'where':{'id':_0x369909[_0x2121('0x80')]}});}return null;})['then'](handleEntityNotFound(_0x455c2f,null))['then'](function(_0x1e0828){if(_0x1e0828){return _0x1e0828[_0x2121('0x36')]({'UserId':_0x1b8527[_0x2121('0x55')]['UserId'],'read1stAt':_[_0x2121('0x81')](_0x1e0828[_0x2121('0x82')])?moment()['format'](_0x2121('0x77')):undefined});}return null;})['then'](function(_0x73f2e8){if(_0x73f2e8){_0x43e09a[_0x2121('0x83')]=_0x73f2e8[_0x2121('0x84')]({'plain':!![]});interaction_log['info'](_0x2121('0x85'),_0x1b8527['user']['id'],_0x1b8527[_0x2121('0x6a')][_0x2121('0x39')],_0x1b8527[_0x2121('0x6a')]['role'],_0x43e09a['interaction']['id'],_0x1b8527[_0x2121('0x55')]?JSON['stringify'](_0x1b8527[_0x2121('0x55')]):_0x2121('0x86'));return respondWithRpcPromise(_0x2121('0x87'),_0x2121('0x88'),_0x43e09a);}return null;})[_0x2121('0x22')](function(_0x1a928d){if(_0x1a928d){if(_0x1b8527[_0x2121('0x55')][_0x2121('0x89')]){_0x43e09a['message'][_0x2121('0x8a')]=util['format'](_0x2121('0x8b'),_0x1b8527[_0x2121('0x6a')][_0x2121('0x39')]);_0x43e09a[_0x2121('0x29')][_0x2121('0x8c')]=_0x43e09a[_0x2121('0x8c')];_0x43e09a[_0x2121('0x29')]['event']='accept';return respondWithRpcPromise(_0x2121('0x8d'),_0x2121('0x8d'),{'event':_0x2121('0x8e'),'message':_0x43e09a[_0x2121('0x29')]},client9002)[_0x2121('0x22')](function(){return _0x43e09a;});}return _0x43e09a;}return null;})[_0x2121('0x22')](respondWithResult(_0x455c2f,null))['catch'](handleError(_0x455c2f,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports[_0x2121('0x34')]=function(_0x3e7b02,_0x370961,_0x1efa22){var _0x58a1b1={'agent':{},'channel':_0x2121('0x7a')};if(_0x3e7b02[_0x2121('0x55')]['id']){delete _0x3e7b02['body']['id'];}_0x3e7b02[_0x2121('0x55')][_0x2121('0x7e')]=_0x3e7b02[_0x2121('0x55')]['UserId']||_0x3e7b02[_0x2121('0x6a')]['id'];_0x58a1b1[_0x2121('0x8f')]['id']=_0x3e7b02[_0x2121('0x55')]['UserId'];return db[_0x2121('0x3d')][_0x2121('0x56')]({'where':{'id':_0x3e7b02[_0x2121('0x53')]['id'],'UserId':null}})[_0x2121('0x22')](handleEntityNotFound(_0x370961,null))[_0x2121('0x22')](function(_0x1f1287){if(_0x1f1287){_0x58a1b1['message']=_0x1f1287['get']({'plain':!![]});return db[_0x2121('0x90')][_0x2121('0x56')]({'where':{'id':_0x1f1287[_0x2121('0x80')]}});}return null;})[_0x2121('0x22')](handleEntityNotFound(_0x370961,null))[_0x2121('0x22')](function(_0x4b6fa7){if(_0x4b6fa7){_0x58a1b1[_0x2121('0x83')]=_0x4b6fa7['get']({'plain':!![]});interaction_log['info'](_0x2121('0x91'),_0x3e7b02[_0x2121('0x6a')]['id'],_0x3e7b02['user']['name'],_0x3e7b02[_0x2121('0x6a')][_0x2121('0x92')],_0x58a1b1[_0x2121('0x83')]['id'],_0x3e7b02[_0x2121('0x55')]?JSON[_0x2121('0x93')](_0x3e7b02[_0x2121('0x55')]):'null');return respondWithRpcPromise(_0x2121('0x94'),'rejectMessage',_0x58a1b1);}return null;})['then'](function(_0x1f850b){if(_0x1f850b){_0x1f850b[_0x2121('0x29')][_0x2121('0x8a')]=util[_0x2121('0x7d')]('SIP/%s',_0x3e7b02['user']['name']);_0x1f850b['message'][_0x2121('0x8c')]=_0x58a1b1[_0x2121('0x8c')];_0x1f850b[_0x2121('0x29')][_0x2121('0x95')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x2121('0x96'),'message':_0x1f850b[_0x2121('0x29')]},client9002);return _0x58a1b1;}return null;})[_0x2121('0x22')](respondWithResult(_0x370961,null))['catch'](handleError(_0x370961,null));};exports[_0x2121('0x97')]=function(_0x5e7ae7,_0x1363b2){var _0x5d570e=moment()['unix']()[_0x2121('0x98')]();var _0x3e923e=path['join'](config['root'],_0x2121('0x99'),'files',_0x2121('0x9a'));var _0x405485=path['join'](config[_0x2121('0x6f')],_0x2121('0x99'),_0x2121('0x9b'),_0x2121('0x6d'));var _0x4710bf=util[_0x2121('0x7d')]('message-%s.eml',_0x5d570e);return db[_0x2121('0x3d')][_0x2121('0x56')]({'where':{'id':_0x5e7ae7[_0x2121('0x53')]['id']},'attributes':['id',_0x2121('0x55'),'from','to','cc',_0x2121('0x9c'),_0x2121('0x9d'),_0x2121('0x9e')],'include':_0x5e7ae7['query'][_0x2121('0x6d')]?[{'model':db['Attachment'],'as':_0x2121('0x9f')}]:undefined})['then'](handleEntityNotFound(_0x1363b2,null))[_0x2121('0x22')](function(_0x1bd123){if(_0x1bd123){var _0x3fcb00=_0x1bd123;var _0x3e0df9={'from':_0x3fcb00['from'],'to':_0x3fcb00['to'],'subject':_0x3fcb00[_0x2121('0x9d')],'html':_0x3fcb00['body'],'headers':{'Date':moment(_0x3fcb00[_0x2121('0x9e')])[_0x2121('0x7d')](_0x2121('0xa0'))},'attachments':[]};if(_0x1bd123['cc']){_0x3e0df9['headers']['Cc']=_0x1bd123['cc'];}if(_0x1bd123[_0x2121('0x9c')]){_0x3e0df9[_0x2121('0xa1')]['Bcc']=_0x1bd123[_0x2121('0x9c')];}return new BPromise(function(_0xe9a96a,_0x3ea848){if(_0x1bd123['Attachments']){for(var _0x36e3f5=0x0;_0x36e3f5<_0x1bd123[_0x2121('0x9f')]['length'];_0x36e3f5++){var _0x4eae5c=_0x1bd123[_0x2121('0x9f')][_0x36e3f5];var _0x31a91a=path[_0x2121('0x6e')](_0x405485,_0x4eae5c[_0x2121('0x71')]);if(fs['existsSync'](_0x31a91a)){_0x3e0df9['attachments']['push']({'name':_0x4eae5c[_0x2121('0x39')],'contentType':_0x4eae5c[_0x2121('0x40')],'data':fs[_0x2121('0xa2')](_0x31a91a)});}}}emlformat[_0x2121('0xa3')](_0x3e0df9,function(_0x3dc60c,_0x3b05a4){if(_0x3dc60c)return _0x3ea848(_0x3dc60c);fs[_0x2121('0xa4')](path[_0x2121('0x6e')](_0x3e923e,_0x4710bf),_0x3b05a4);return _0xe9a96a(_0x3b05a4);});});}})[_0x2121('0x22')](function(_0x391288){if(_0x391288){return _0x1363b2[_0x2121('0x97')](path[_0x2121('0x6e')](_0x3e923e,_0x4710bf),_0x4710bf,function(_0x2ec1b4){if(_0x2ec1b4){console[_0x2121('0xa5')]('err',_0x2ec1b4);}else{fs['unlinkSync'](path[_0x2121('0x6e')](_0x3e923e,_0x4710bf));}});}})[_0x2121('0x2b')](handleError(_0x1363b2,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index bb25fb0..3233cae 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 _0xbf05=['events','MailMessage','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0xbf05,0x6c));var _0x5bf0=function(_0x3428b0,_0x1948c5){_0x3428b0=_0x3428b0-0x0;var _0x179550=_0xbf05[_0x3428b0];return _0x179550;};'use strict';var EventEmitter=require(_0x5bf0('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x5bf0('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x5bf0('0x2')](0x0);var events={'afterCreate':_0x5bf0('0x3'),'afterUpdate':_0x5bf0('0x4'),'afterDestroy':_0x5bf0('0x5')};function emitEvent(_0xfcdc33){return function(_0x352497,_0xc7176e,_0x30121b){MailMessageEvents['emit'](_0xfcdc33+':'+_0x352497['id'],_0x352497);MailMessageEvents[_0x5bf0('0x6')](_0xfcdc33,_0x352497);_0x30121b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x5bf0('0x7')](e,emitEvent(event));}}module[_0x5bf0('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x5c19=['MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x206ff7,_0x398545){var _0x44aa96=function(_0x31f00e){while(--_0x31f00e){_0x206ff7['push'](_0x206ff7['shift']());}};_0x44aa96(++_0x398545);}(_0x5c19,0x127));var _0x95c1=function(_0xa1da69,_0x34c5da){_0xa1da69=_0xa1da69-0x0;var _0x20ed09=_0x5c19[_0xa1da69];return _0x20ed09;};'use strict';var EventEmitter=require(_0x95c1('0x0'));var MailMessage=require(_0x95c1('0x1'))['db'][_0x95c1('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x95c1('0x3')](0x0);var events={'afterCreate':_0x95c1('0x4'),'afterUpdate':_0x95c1('0x5'),'afterDestroy':_0x95c1('0x6')};function emitEvent(_0x37babd){return function(_0x199fb1,_0x4d150c,_0x457953){MailMessageEvents[_0x95c1('0x7')](_0x37babd+':'+_0x199fb1['id'],_0x199fb1);MailMessageEvents[_0x95c1('0x7')](_0x37babd,_0x199fb1);_0x457953(null);};}for(var e in events){if(events[_0x95c1('0x8')](e)){var event=events[e];MailMessage[_0x95c1('0x9')](e,emitEvent(event));}}module[_0x95c1('0xa')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 7a8e1f8..744b142 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 _0xf676=['FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','update','createdAt','catch','error','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xf676,0x100));var _0x6f67=function(_0x43148e,_0xa81910){_0x43148e=_0x43148e-0x0;var _0x4880a7=_0xf676[_0x43148e];return _0x4880a7;};'use strict';var _=require(_0x6f67('0x0'));var util=require('util');var logger=require(_0x6f67('0x1'))(_0x6f67('0x2'));var moment=require('moment');var BPromise=require(_0x6f67('0x3'));var rp=require(_0x6f67('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x6f67('0x5'));var rimraf=require(_0x6f67('0x6'));var config=require(_0x6f67('0x7'));var attributes=require(_0x6f67('0x8'));module[_0x6f67('0x9')]=function(_0x51687b,_0x21cd64){return _0x51687b[_0x6f67('0xa')](_0x6f67('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x6f67('0xc'),'fields':['messageId']},{'name':_0x6f67('0xd'),'fields':[_0x6f67('0xe'),_0x6f67('0xf')],'type':_0x6f67('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x281621,_0x23401c,_0x547b48){if(_0x281621[_0x6f67('0x11')]){_0x281621['plainBody']=htmlToText[_0x6f67('0x12')](_0x281621[_0x6f67('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x547b48(null,_0x23401c);},'afterCreate':function(_0x3fc121,_0x232557,_0x123106){var _0x1129b6=_0x51687b[_0x6f67('0x13')];var _0x200605=_0x3fc121[_0x6f67('0x14')]({'plain':!![]});if(_0x200605[_0x6f67('0x15')]['toLowerCase']()==='in'||_0x200605[_0x6f67('0x15')][_0x6f67('0x16')]()===_0x6f67('0x17')&&!_0x200605[_0x6f67('0x18')]&&!_[_0x6f67('0x19')](_0x200605[_0x6f67('0x1a')])){_0x1129b6[_0x6f67('0x1b')]['findOne']({'where':{'id':_0x200605[_0x6f67('0x1c')]}})['then'](function(_0x33e0d5){if(_0x33e0d5){_0x33e0d5[_0x6f67('0x1d')]({'lastMsgAt':_0x200605[_0x6f67('0x1e')],'lastMsgDirection':_0x200605[_0x6f67('0x15')][_0x6f67('0x16')](),'lastMsgBody':_0x200605[_0x6f67('0x11')]});}})[_0x6f67('0x1f')](function(_0x165bb7){console[_0x6f67('0x20')](_0x165bb7);});}_0x123106();}},'charset':_0x6f67('0x21'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdfa1=['out','secret','isNil','UserId','findOne','MailInteractionId','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','html-to-text','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdfa1,0x10b));var _0x1dfa=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xdfa1[_0x257642];return _0x3d813b;};'use strict';var _=require(_0x1dfa('0x0'));var util=require(_0x1dfa('0x1'));var logger=require('../../config/logger')(_0x1dfa('0x2'));var moment=require('moment');var BPromise=require(_0x1dfa('0x3'));var rp=require(_0x1dfa('0x4'));var htmlToText=require(_0x1dfa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1dfa('0x6'));var attributes=require(_0x1dfa('0x7'));module['exports']=function(_0xdb5005,_0x4faf6c){return _0xdb5005[_0x1dfa('0x8')](_0x1dfa('0x9'),attributes,{'tableName':_0x1dfa('0xa'),'paranoid':![],'indexes':[{'name':_0x1dfa('0xb'),'fields':[_0x1dfa('0xb')]},{'name':_0x1dfa('0xc'),'fields':['plainBody',_0x1dfa('0xd')],'type':_0x1dfa('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5e2be2,_0x1130bd,_0x56c806){if(_0x5e2be2[_0x1dfa('0xf')]){_0x5e2be2['plainBody']=htmlToText[_0x1dfa('0x10')](_0x5e2be2[_0x1dfa('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x56c806(null,_0x1130bd);},'afterCreate':function(_0x27c812,_0x4a0229,_0x5dde3a){var _0x27dd76=_0xdb5005[_0x1dfa('0x11')];var _0x3d4659=_0x27c812[_0x1dfa('0x12')]({'plain':!![]});if(_0x3d4659[_0x1dfa('0x13')][_0x1dfa('0x14')]()==='in'||_0x3d4659['direction']['toLowerCase']()===_0x1dfa('0x15')&&!_0x3d4659[_0x1dfa('0x16')]&&!_[_0x1dfa('0x17')](_0x3d4659[_0x1dfa('0x18')])){_0x27dd76['MailInteraction'][_0x1dfa('0x19')]({'where':{'id':_0x3d4659[_0x1dfa('0x1a')]}})[_0x1dfa('0x1b')](function(_0x4ffa01){if(_0x4ffa01){_0x4ffa01['update']({'lastMsgAt':_0x3d4659[_0x1dfa('0x1c')],'lastMsgDirection':_0x3d4659[_0x1dfa('0x13')][_0x1dfa('0x14')](),'lastMsgBody':_0x3d4659[_0x1dfa('0xf')]});}})[_0x1dfa('0x1d')](function(_0x49e726){console['error'](_0x49e726);});}_0x5dde3a();}},'charset':_0x1dfa('0x1e'),'collate':_0x1dfa('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index ec4b433..58e14b7 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 _0x312d=['jayson/promise','http','redis','localhost','socket.io-emitter','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateMailMessage','MailMessage','body','options','raw','debug','stringify','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x312d,0x14d));var _0xd312=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x312d[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xd312('0x0'));var util=require(_0xd312('0x1'));var moment=require(_0xd312('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd312('0x3'));var db=require(_0xd312('0x4'))['db'];var utils=require(_0xd312('0x5'));var logger=require(_0xd312('0x6'))('rpc');var config=require(_0xd312('0x7'));var jayson=require(_0xd312('0x8'));var client=jayson['client'][_0xd312('0x9')]({'port':0x232a});config[_0xd312('0xa')]=_['defaults'](config[_0xd312('0xa')],{'host':_0xd312('0xb'),'port':0x18eb});var socket=require(_0xd312('0xc'))(new Redis(config['redis']));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x182317,_0x200b45,_0x1398ab){return new BPromise(function(_0x5bc6e7,_0x444f32){return client[_0xd312('0xd')](_0x182317,_0x1398ab)[_0xd312('0xe')](function(_0x4af672){logger[_0xd312('0xf')](_0xd312('0x10'),_0x200b45,_0xd312('0x11'));logger['debug'](_0xd312('0x12'),_0x200b45,_0xd312('0x11'),JSON['stringify'](_0x4af672));if(_0x4af672[_0xd312('0x13')]){if(_0x4af672[_0xd312('0x13')][_0xd312('0x14')]===0x1f4){logger[_0xd312('0x13')]('MailMessage,\x20%s,\x20%s',_0x200b45,_0x4af672[_0xd312('0x13')][_0xd312('0x15')]);return _0x444f32(_0x4af672['error'][_0xd312('0x15')]);}logger[_0xd312('0x13')]('MailMessage,\x20%s,\x20%s',_0x200b45,_0x4af672[_0xd312('0x13')][_0xd312('0x15')]);return _0x5bc6e7(_0x4af672[_0xd312('0x13')][_0xd312('0x15')]);}else{logger[_0xd312('0xf')](_0xd312('0x10'),_0x200b45,_0xd312('0x11'));_0x5bc6e7(_0x4af672[_0xd312('0x16')]['message']);}})['catch'](function(_0x3ecb32){logger[_0xd312('0x13')](_0xd312('0x10'),_0x200b45,_0x3ecb32);_0x444f32(_0x3ecb32);});});}exports[_0xd312('0x17')]=function(_0x4b959b){var _0x4ce937=this;return new Promise(function(_0x1ce5e1,_0x463b6a){return db[_0xd312('0x18')]['create'](_0x4b959b[_0xd312('0x19')],{'raw':_0x4b959b[_0xd312('0x1a')]?_0x4b959b[_0xd312('0x1a')][_0xd312('0x1b')]===undefined?!![]:![]:!![]})[_0xd312('0xe')](function(_0x38a235){logger['info'](_0xd312('0x17'),_0x4b959b);logger[_0xd312('0x1c')]('CreateMailMessage',_0x4b959b,JSON[_0xd312('0x1d')](_0x38a235));_0x1ce5e1(_0x38a235);})[_0xd312('0x1e')](function(_0x19fa39){logger['error'](_0xd312('0x17'),_0x19fa39[_0xd312('0x15')],_0x4b959b);_0x463b6a(_0x4ce937[_0xd312('0x13')](0x1f4,_0x19fa39[_0xd312('0x15')]));});});}; \ No newline at end of file +var _0x247a=['http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','CreateMailMessage','MailMessage','create','body','options','stringify','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0xd81cf,_0x538d7e){var _0x6ddc3d=function(_0x1b2015){while(--_0x1b2015){_0xd81cf['push'](_0xd81cf['shift']());}};_0x6ddc3d(++_0x538d7e);}(_0x247a,0x162));var _0xa247=function(_0x5d2699,_0xbb63f2){_0x5d2699=_0x5d2699-0x0;var _0x2a2ee6=_0x247a[_0x5d2699];return _0x2a2ee6;};'use strict';var _=require(_0xa247('0x0'));var util=require('util');var moment=require(_0xa247('0x1'));var BPromise=require('bluebird');var rs=require(_0xa247('0x2'));var fs=require('fs');var Redis=require(_0xa247('0x3'));var db=require(_0xa247('0x4'))['db'];var utils=require(_0xa247('0x5'));var logger=require(_0xa247('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa247('0x7'));var client=jayson[_0xa247('0x8')][_0xa247('0x9')]({'port':0x232a});config[_0xa247('0xa')]=_[_0xa247('0xb')](config[_0xa247('0xa')],{'host':_0xa247('0xc'),'port':0x18eb});var socket=require(_0xa247('0xd'))(new Redis(config[_0xa247('0xa')]));require(_0xa247('0xe'))[_0xa247('0xf')](socket);function respondWithRpcPromise(_0x220d36,_0x639b7c,_0x122139){return new BPromise(function(_0x201453,_0x3d339b){return client[_0xa247('0x10')](_0x220d36,_0x122139)[_0xa247('0x11')](function(_0x326400){logger['info'](_0xa247('0x12'),_0x639b7c,_0xa247('0x13'));logger[_0xa247('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x639b7c,'request\x20sent',JSON['stringify'](_0x326400));if(_0x326400['error']){if(_0x326400[_0xa247('0x15')][_0xa247('0x16')]===0x1f4){logger[_0xa247('0x15')](_0xa247('0x12'),_0x639b7c,_0x326400[_0xa247('0x15')]['message']);return _0x3d339b(_0x326400['error'][_0xa247('0x17')]);}logger[_0xa247('0x15')](_0xa247('0x12'),_0x639b7c,_0x326400[_0xa247('0x15')][_0xa247('0x17')]);return _0x201453(_0x326400[_0xa247('0x15')][_0xa247('0x17')]);}else{logger[_0xa247('0x18')](_0xa247('0x12'),_0x639b7c,'request\x20sent');_0x201453(_0x326400[_0xa247('0x19')][_0xa247('0x17')]);}})['catch'](function(_0x5df6a4){logger['error']('MailMessage,\x20%s,\x20%s',_0x639b7c,_0x5df6a4);_0x3d339b(_0x5df6a4);});});}exports[_0xa247('0x1a')]=function(_0xf51907){var _0xf702b6=this;return new Promise(function(_0x1b32b7,_0x13d6b9){return db[_0xa247('0x1b')][_0xa247('0x1c')](_0xf51907[_0xa247('0x1d')],{'raw':_0xf51907[_0xa247('0x1e')]?_0xf51907[_0xa247('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xa247('0x11')](function(_0x1b7734){logger['info']('CreateMailMessage',_0xf51907);logger['debug'](_0xa247('0x1a'),_0xf51907,JSON[_0xa247('0x1f')](_0x1b7734));_0x1b32b7(_0x1b7734);})[_0xa247('0x20')](function(_0x4c656b){logger[_0xa247('0x15')](_0xa247('0x1a'),_0x4c656b[_0xa247('0x17')],_0xf51907);_0x13d6b9(_0xf702b6[_0xa247('0x15')](0x1f4,_0x4c656b[_0xa247('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 8de22b8..8d3ae50 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 _0x4b81=['emit','removeListener','length','mailMessage:','./mailMessage.events','remove','update'];(function(_0x48fb10,_0xa50a89){var _0x534251=function(_0xcdc19e){while(--_0xcdc19e){_0x48fb10['push'](_0x48fb10['shift']());}};_0x534251(++_0xa50a89);}(_0x4b81,0x9e));var _0x14b8=function(_0x4aabe3,_0x867468){_0x4aabe3=_0x4aabe3-0x0;var _0x4df232=_0x4b81[_0x4aabe3];return _0x4df232;};'use strict';var MailMessageEvents=require(_0x14b8('0x0'));var events=['save',_0x14b8('0x1'),_0x14b8('0x2')];function createListener(_0x341fa8,_0x3a976e){return function(_0x5a1114){_0x3a976e[_0x14b8('0x3')](_0x341fa8,_0x5a1114);};}function removeListener(_0x426f1b,_0x2254d2){return function(){MailMessageEvents[_0x14b8('0x4')](_0x426f1b,_0x2254d2);};}exports['register']=function(_0x51f300){for(var _0x1d2c35=0x0,_0x512e62=events[_0x14b8('0x5')];_0x1d2c35<_0x512e62;_0x1d2c35++){var _0x104775=events[_0x1d2c35];var _0x3702b3=createListener(_0x14b8('0x6')+_0x104775,_0x51f300);MailMessageEvents['on'](_0x104775,_0x3702b3);}}; \ No newline at end of file +var _0x18ab=['./mailMessage.events','save','remove','update','emit','removeListener','length'];(function(_0x5bf110,_0x414773){var _0x531340=function(_0x106861){while(--_0x106861){_0x5bf110['push'](_0x5bf110['shift']());}};_0x531340(++_0x414773);}(_0x18ab,0xd2));var _0xb18a=function(_0x4c8214,_0x310730){_0x4c8214=_0x4c8214-0x0;var _0x34cdee=_0x18ab[_0x4c8214];return _0x34cdee;};'use strict';var MailMessageEvents=require(_0xb18a('0x0'));var events=[_0xb18a('0x1'),_0xb18a('0x2'),_0xb18a('0x3')];function createListener(_0x3a476a,_0x131b9d){return function(_0x5b1eda){_0x131b9d[_0xb18a('0x4')](_0x3a476a,_0x5b1eda);};}function removeListener(_0x118d4a,_0x260f23){return function(){MailMessageEvents[_0xb18a('0x5')](_0x118d4a,_0x260f23);};}exports['register']=function(_0x1e5da1){for(var _0x4cccff=0x0,_0x13852a=events[_0xb18a('0x6')];_0x4cccff<_0x13852a;_0x4cccff++){var _0x4ccffc=events[_0x4cccff];var _0x31cc5d=createListener('mailMessage:'+_0x4ccffc,_0x1e5da1);MailMessageEvents['on'](_0x4ccffc,_0x31cc5d);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 02a318f..2bb02de 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 _0x967f=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','update','delete','destroy','removeAgents','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x967f,0x1a4));var _0xf967=function(_0x2dc786,_0x49378d){_0x2dc786=_0x2dc786-0x0;var _0x5f0e7e=_0x967f[_0x2dc786];return _0x5f0e7e;};'use strict';var multer=require(_0xf967('0x0'));var util=require('util');var path=require(_0xf967('0x1'));var timeout=require(_0xf967('0x2'));var express=require(_0xf967('0x3'));var router=express[_0xf967('0x4')]();var auth=require(_0xf967('0x5'));var interaction=require(_0xf967('0x6'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0xf967('0x7')]('/',auth[_0xf967('0x8')](),controller[_0xf967('0x9')]);router[_0xf967('0x7')](_0xf967('0xa'),auth[_0xf967('0x8')](),controller[_0xf967('0xb')]);router[_0xf967('0x7')]('/:id',auth[_0xf967('0x8')](),controller['show']);router[_0xf967('0x7')](_0xf967('0xc'),auth['isAuthenticated'](),controller[_0xf967('0xd')]);router[_0xf967('0x7')](_0xf967('0xe'),auth[_0xf967('0x8')](),controller[_0xf967('0xf')]);router[_0xf967('0x7')](_0xf967('0x10'),auth['isAuthenticated'](),controller[_0xf967('0x11')]);router['post']('/',auth[_0xf967('0x8')](),controller['create']);router[_0xf967('0x12')](_0xf967('0xe'),auth['isAuthenticated'](),controller[_0xf967('0x13')]);router[_0xf967('0x12')](_0xf967('0x10'),auth[_0xf967('0x8')](),controller[_0xf967('0x14')]);router[_0xf967('0x15')](_0xf967('0x16'),auth['isAuthenticated'](),controller[_0xf967('0x17')]);router[_0xf967('0x18')](_0xf967('0x16'),auth[_0xf967('0x8')](),controller[_0xf967('0x19')]);router['delete'](_0xf967('0xe'),auth[_0xf967('0x8')](),controller['removeTeams']);router[_0xf967('0x18')](_0xf967('0x10'),auth['isAuthenticated'](),controller[_0xf967('0x1a')]);module[_0xf967('0x1b')]=router; \ No newline at end of file +var _0xc0df=['removeAgents','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete'];(function(_0x523bbe,_0x4eeffc){var _0x25403b=function(_0x165801){while(--_0x165801){_0x523bbe['push'](_0x523bbe['shift']());}};_0x25403b(++_0x4eeffc);}(_0xc0df,0xfb));var _0xfc0d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc0df[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0xfc0d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfc0d('0x1'));var router=express[_0xfc0d('0x2')]();var auth=require(_0xfc0d('0x3'));var interaction=require(_0xfc0d('0x4'));var config=require(_0xfc0d('0x5'));var controller=require('./mailQueue.controller');router['get']('/',auth[_0xfc0d('0x6')](),controller[_0xfc0d('0x7')]);router[_0xfc0d('0x8')](_0xfc0d('0x9'),auth['isAuthenticated'](),controller[_0xfc0d('0xa')]);router[_0xfc0d('0x8')](_0xfc0d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xfc0d('0x8')](_0xfc0d('0xc'),auth[_0xfc0d('0x6')](),controller[_0xfc0d('0xd')]);router[_0xfc0d('0x8')](_0xfc0d('0xe'),auth[_0xfc0d('0x6')](),controller[_0xfc0d('0xf')]);router[_0xfc0d('0x8')](_0xfc0d('0x10'),auth['isAuthenticated'](),controller[_0xfc0d('0x11')]);router[_0xfc0d('0x12')]('/',auth[_0xfc0d('0x6')](),controller[_0xfc0d('0x13')]);router['post'](_0xfc0d('0xe'),auth[_0xfc0d('0x6')](),controller[_0xfc0d('0x14')]);router[_0xfc0d('0x12')](_0xfc0d('0x10'),auth[_0xfc0d('0x6')](),controller['addAgents']);router[_0xfc0d('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xfc0d('0x16')]);router[_0xfc0d('0x17')](_0xfc0d('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xfc0d('0x17')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xfc0d('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xfc0d('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 a7c49eb..165031e 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 _0x4f81=['rrmemory','beepall','roundrobin','STRING','INTEGER','ENUM'];(function(_0x24d8d1,_0x54a306){var _0x2aec98=function(_0x531a63){while(--_0x531a63){_0x24d8d1['push'](_0x24d8d1['shift']());}};_0x2aec98(++_0x54a306);}(_0x4f81,0x1e3));var _0x14f8=function(_0x39ef84,_0x45b675){_0x39ef84=_0x39ef84-0x0;var _0x1bd320=_0x4f81[_0x39ef84];return _0x1bd320;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x14f8('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x14f8('0x0')]},'timeout':{'type':Sequelize[_0x14f8('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x14f8('0x2')](_0x14f8('0x3'),_0x14f8('0x4'),_0x14f8('0x5'))}}; \ No newline at end of file +var _0x065f=['beepall','roundrobin','sequelize','exports','STRING','ENUM','rrmemory'];(function(_0x38838d,_0x15d035){var _0x9f6165=function(_0x489728){while(--_0x489728){_0x38838d['push'](_0x38838d['shift']());}};_0x9f6165(++_0x15d035);}(_0x065f,0x175));var _0xf065=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x065f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xf065('0x0'));module[_0xf065('0x1')]={'name':{'type':Sequelize[_0xf065('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf065('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf065('0x3')](_0xf065('0x4'),_0xf065('0x5'),_0xf065('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 9ae72d0..47acda6 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 _0x2f8b=['spread','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','catch','create','body','user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','order','MailQueueId','User','findAndCountAll','UserId','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit'];(function(_0x968411,_0x151619){var _0x46e3e5=function(_0x3c621e){while(--_0x3c621e){_0x968411['push'](_0x968411['shift']());}};_0x46e3e5(++_0x151619);}(_0x2f8b,0x96));var _0xb2f8=function(_0x54c152,_0x4a7263){_0x54c152=_0x54c152-0x0;var _0x11ebbc=_0x2f8b[_0x54c152];return _0x11ebbc;};'use strict';var pdf=require(_0xb2f8('0x0'));var emlformat=require(_0xb2f8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb2f8('0x2'));var jsonpatch=require(_0xb2f8('0x3'));var rp=require(_0xb2f8('0x4'));var moment=require(_0xb2f8('0x5'));var BPromise=require(_0xb2f8('0x6'));var Mustache=require(_0xb2f8('0x7'));var util=require(_0xb2f8('0x8'));var path=require('path');var sox=require(_0xb2f8('0x9'));var csv=require(_0xb2f8('0xa'));var ejs=require(_0xb2f8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb2f8('0xc'));var crypto=require('crypto');var jsforce=require(_0xb2f8('0xd'));var deskjs=require(_0xb2f8('0xe'));var toCsv=require(_0xb2f8('0xa'));var querystring=require(_0xb2f8('0xf'));var Papa=require(_0xb2f8('0x10'));var Redis=require(_0xb2f8('0x11'));var authService=require(_0xb2f8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb2f8('0x13'));var hardwareService=require(_0xb2f8('0x14'));var logger=require(_0xb2f8('0x15'))(_0xb2f8('0x16'));var utils=require(_0xb2f8('0x17'));var config=require(_0xb2f8('0x18'));var licenseUtil=require(_0xb2f8('0x19'));var db=require(_0xb2f8('0x1a'))['db'];config[_0xb2f8('0x1b')]=_[_0xb2f8('0x1c')](config[_0xb2f8('0x1b')],{'host':_0xb2f8('0x1d'),'port':0x18eb});var socket=require(_0xb2f8('0x1e'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xb2f8('0x1f')](socket);function respondWithStatusCode(_0x1389a3,_0x52105e){_0x52105e=_0x52105e||0xcc;return function(_0xe6f94e){if(_0xe6f94e){return _0x1389a3[_0xb2f8('0x20')](_0x52105e);}return _0x1389a3[_0xb2f8('0x21')](_0x52105e)[_0xb2f8('0x22')]();};}function respondWithResult(_0x57d3c8,_0x4aabd4){_0x4aabd4=_0x4aabd4||0xc8;return function(_0x2a39a4){if(_0x2a39a4){return _0x57d3c8[_0xb2f8('0x21')](_0x4aabd4)['json'](_0x2a39a4);}};}function respondWithFilteredResult(_0x90ee1f,_0x31e436){return function(_0x56b307){if(_0x56b307){var _0x345a20=_0x56b307[_0xb2f8('0x23')],_0x4dae59=_0x31e436[_0xb2f8('0x24')],_0x4285ed=_0x31e436[_0xb2f8('0x24')]+_0x31e436[_0xb2f8('0x25')],_0x46333f;if(_0x4285ed>=_0x345a20){_0x4285ed=_0x345a20;_0x46333f=0xc8;}else{_0x46333f=0xce;}_0x90ee1f[_0xb2f8('0x21')](_0x46333f);return _0x90ee1f[_0xb2f8('0x26')](_0xb2f8('0x27'),_0x4dae59+'-'+_0x4285ed+'/'+_0x345a20)[_0xb2f8('0x28')](_0x56b307);}return null;};}function patchUpdates(_0x55bb42){return function(_0x4501eb){try{jsonpatch['apply'](_0x4501eb,_0x55bb42,!![]);}catch(_0x25d13a){return BPromise[_0xb2f8('0x29')](_0x25d13a);}return _0x4501eb[_0xb2f8('0x2a')]();};}function saveUpdates(_0x22fe8b,_0x4f5a75){return function(_0x3fee39){if(_0x3fee39){return _0x3fee39[_0xb2f8('0x2b')](_0x22fe8b)[_0xb2f8('0x2c')](function(_0x5a8466){return _0x5a8466;});}return null;};}function removeEntity(_0x12d551,_0x59243d){return function(_0x4d1a03){if(_0x4d1a03){return _0x4d1a03[_0xb2f8('0x2d')]()[_0xb2f8('0x2c')](function(){var _0x4c2dcc=_0x4d1a03[_0xb2f8('0x2e')]({'plain':!![]});var _0x3643e4=_0xb2f8('0x2f');return db[_0xb2f8('0x30')][_0xb2f8('0x2d')]({'where':{'type':_0x3643e4,'resourceId':_0x4c2dcc['id']}})[_0xb2f8('0x2c')](function(){return _0x4d1a03;});})['then'](function(){_0x12d551[_0xb2f8('0x21')](0xcc)[_0xb2f8('0x22')]();});}};}function handleEntityNotFound(_0x3f9e32,_0x2352dc){return function(_0x2ceb6e){if(!_0x2ceb6e){_0x3f9e32['sendStatus'](0x194);}return _0x2ceb6e;};}function handleError(_0x2a2dcf,_0x190115){_0x190115=_0x190115||0x1f4;return function(_0x4c6662){logger[_0xb2f8('0x31')](_0x4c6662[_0xb2f8('0x32')]);if(_0x4c6662[_0xb2f8('0x33')]){delete _0x4c6662[_0xb2f8('0x33')];}_0x2a2dcf['status'](_0x190115)[_0xb2f8('0x34')](_0x4c6662);};}exports[_0xb2f8('0x35')]=function(_0x196a14,_0x5ca8b1){var _0x38b7e0={},_0x573e61={},_0x19f582={'count':0x0,'rows':[]};var _0x2e1bea=_[_0xb2f8('0x36')](db[_0xb2f8('0x37')][_0xb2f8('0x38')],function(_0x31f922){return{'name':_0x31f922[_0xb2f8('0x39')],'type':_0x31f922[_0xb2f8('0x3a')][_0xb2f8('0x3b')]};});_0x573e61[_0xb2f8('0x3c')]=_['map'](_0x2e1bea,_0xb2f8('0x33'));_0x573e61[_0xb2f8('0x3d')]=_[_0xb2f8('0x3e')](_0x196a14[_0xb2f8('0x3d')]);_0x573e61['filters']=_[_0xb2f8('0x3f')](_0x573e61[_0xb2f8('0x3c')],_0x573e61[_0xb2f8('0x3d')]);_0x38b7e0[_0xb2f8('0x40')]=_[_0xb2f8('0x3f')](_0x573e61['model'],qs[_0xb2f8('0x41')](_0x196a14['query']['fields']));_0x38b7e0[_0xb2f8('0x40')]=_0x38b7e0[_0xb2f8('0x40')][_0xb2f8('0x42')]?_0x38b7e0[_0xb2f8('0x40')]:_0x573e61[_0xb2f8('0x3c')];if(!_0x196a14[_0xb2f8('0x3d')]['hasOwnProperty'](_0xb2f8('0x43'))){_0x38b7e0[_0xb2f8('0x25')]=qs[_0xb2f8('0x25')](_0x196a14['query']['limit']);_0x38b7e0['offset']=qs[_0xb2f8('0x24')](_0x196a14[_0xb2f8('0x3d')][_0xb2f8('0x24')]);}_0x38b7e0['order']=qs[_0xb2f8('0x44')](_0x196a14[_0xb2f8('0x3d')][_0xb2f8('0x44')]);_0x38b7e0[_0xb2f8('0x45')]=qs[_0xb2f8('0x46')](_[_0xb2f8('0x47')](_0x196a14[_0xb2f8('0x3d')],_0x573e61['filters']),_0x2e1bea);if(_0x196a14[_0xb2f8('0x3d')][_0xb2f8('0x48')]){_0x38b7e0['where']=_[_0xb2f8('0x49')](_0x38b7e0[_0xb2f8('0x45')],{'$or':_[_0xb2f8('0x36')](_0x2e1bea,function(_0x32ada8){if(_0x32ada8[_0xb2f8('0x3a')]!==_0xb2f8('0x4a')){var _0x24f9e0={};_0x24f9e0[_0x32ada8[_0xb2f8('0x33')]]={'$like':'%'+_0x196a14[_0xb2f8('0x3d')][_0xb2f8('0x48')]+'%'};return _0x24f9e0;}})});}_0x38b7e0=_['merge']({},_0x38b7e0,_0x196a14[_0xb2f8('0x4b')]);var _0x2ddff3={'where':_0x38b7e0[_0xb2f8('0x45')]};return db[_0xb2f8('0x37')][_0xb2f8('0x23')](_0x2ddff3)[_0xb2f8('0x2c')](function(_0x51a568){_0x19f582[_0xb2f8('0x23')]=_0x51a568;if(_0x196a14[_0xb2f8('0x3d')]['includeAll']){_0x38b7e0[_0xb2f8('0x4c')]=[{'all':!![]}];}return db[_0xb2f8('0x37')][_0xb2f8('0x4d')](_0x38b7e0);})['then'](function(_0x2881ab){_0x19f582[_0xb2f8('0x4e')]=_0x2881ab;return _0x19f582;})['then'](respondWithFilteredResult(_0x5ca8b1,_0x38b7e0))['catch'](handleError(_0x5ca8b1,null));};exports[_0xb2f8('0x4f')]=function(_0x308efb,_0x575636){var _0x33e0bb={'raw':!![],'where':{'id':_0x308efb[_0xb2f8('0x50')]['id']}},_0x54231d={};_0x54231d[_0xb2f8('0x3c')]=_[_0xb2f8('0x3e')](db[_0xb2f8('0x37')][_0xb2f8('0x38')]);_0x54231d['query']=_[_0xb2f8('0x3e')](_0x308efb[_0xb2f8('0x3d')]);_0x54231d['filters']=_[_0xb2f8('0x3f')](_0x54231d[_0xb2f8('0x3c')],_0x54231d[_0xb2f8('0x3d')]);_0x33e0bb[_0xb2f8('0x40')]=_['intersection'](_0x54231d[_0xb2f8('0x3c')],qs['fields'](_0x308efb[_0xb2f8('0x3d')]['fields']));_0x33e0bb[_0xb2f8('0x40')]=_0x33e0bb[_0xb2f8('0x40')][_0xb2f8('0x42')]?_0x33e0bb[_0xb2f8('0x40')]:_0x54231d[_0xb2f8('0x3c')];if(_0x308efb[_0xb2f8('0x3d')]['includeAll']){_0x33e0bb[_0xb2f8('0x4c')]=[{'all':!![]}];}_0x33e0bb=_[_0xb2f8('0x49')]({},_0x33e0bb,_0x308efb[_0xb2f8('0x4b')]);return db[_0xb2f8('0x37')]['find'](_0x33e0bb)[_0xb2f8('0x2c')](handleEntityNotFound(_0x575636,null))['then'](respondWithResult(_0x575636,null))[_0xb2f8('0x51')](handleError(_0x575636,null));};exports[_0xb2f8('0x52')]=function(_0x4f67af,_0x1155ff){return db[_0xb2f8('0x37')][_0xb2f8('0x52')](_0x4f67af[_0xb2f8('0x53')],{})[_0xb2f8('0x2c')](function(_0x57280b){var _0x1fc9f3=_0x4f67af[_0xb2f8('0x54')][_0xb2f8('0x2e')]({'plain':!![]});if(!_0x1fc9f3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fc9f3[_0xb2f8('0x55')]==='user'){var _0x3d77cb=_0x57280b[_0xb2f8('0x2e')]({'plain':!![]});var _0x24b6ec=_0xb2f8('0x2f');return db['UserProfileSection'][_0xb2f8('0x56')]({'where':{'name':_0x24b6ec,'userProfileId':_0x1fc9f3[_0xb2f8('0x57')]},'raw':!![]})[_0xb2f8('0x2c')](function(_0x411524){if(_0x411524&&_0x411524['autoAssociation']===0x0){return db['UserProfileResource'][_0xb2f8('0x52')]({'name':_0x3d77cb[_0xb2f8('0x33')],'resourceId':_0x3d77cb['id'],'type':_0x411524['name'],'sectionId':_0x411524['id']},{})[_0xb2f8('0x2c')](function(){return _0x57280b;});}else{return _0x57280b;}})['catch'](function(_0x190958){logger[_0xb2f8('0x31')](_0xb2f8('0x58'),_0x190958);throw _0x190958;});}return _0x57280b;})[_0xb2f8('0x2c')](respondWithResult(_0x1155ff,0xc9))[_0xb2f8('0x51')](handleError(_0x1155ff,null));};exports[_0xb2f8('0x2b')]=function(_0x4c752b,_0x36f3fd){if(_0x4c752b[_0xb2f8('0x53')]['id']){delete _0x4c752b[_0xb2f8('0x53')]['id'];}return db[_0xb2f8('0x37')]['find']({'where':{'id':_0x4c752b[_0xb2f8('0x50')]['id']}})['then'](handleEntityNotFound(_0x36f3fd,null))[_0xb2f8('0x2c')](saveUpdates(_0x4c752b[_0xb2f8('0x53')],null))[_0xb2f8('0x2c')](respondWithResult(_0x36f3fd,null))[_0xb2f8('0x51')](handleError(_0x36f3fd,null));};exports[_0xb2f8('0x2d')]=function(_0x4065fb,_0x1441d3){return db[_0xb2f8('0x37')][_0xb2f8('0x56')]({'where':{'id':_0x4065fb[_0xb2f8('0x50')]['id']}})['then'](handleEntityNotFound(_0x1441d3,null))['then'](removeEntity(_0x1441d3,null))[_0xb2f8('0x51')](handleError(_0x1441d3,null));};exports[_0xb2f8('0x59')]=function(_0x5814fc,_0x5380a9){return db['MailQueue'][_0xb2f8('0x59')]()['then'](respondWithResult(_0x5380a9,null))[_0xb2f8('0x51')](handleError(_0x5380a9,null));};exports[_0xb2f8('0x5a')]=function(_0x362012,_0x52640a,_0x1aab69){var _0x4ec32a={'raw':!![],'where':{}},_0x56b213={},_0x594f02;return db[_0xb2f8('0x37')][_0xb2f8('0x5b')]({'where':{'id':_0x362012[_0xb2f8('0x50')]['id']}})[_0xb2f8('0x2c')](handleEntityNotFound(_0x52640a,null))[_0xb2f8('0x2c')](function(_0x5af46e){if(_0x5af46e){_0x594f02=_0x5af46e[_0xb2f8('0x2e')]({'plain':!![]});_0x56b213[_0xb2f8('0x3c')]=_[_0xb2f8('0x3e')](db[_0xb2f8('0x5c')]['rawAttributes']);_0x56b213[_0xb2f8('0x3d')]=_['keys'](_0x362012[_0xb2f8('0x3d')]);_0x56b213[_0xb2f8('0x46')]=_['intersection'](_0x56b213['model'],_0x56b213[_0xb2f8('0x3d')]);_0x4ec32a[_0xb2f8('0x40')]=_[_0xb2f8('0x3f')](_0x56b213[_0xb2f8('0x3c')],qs[_0xb2f8('0x41')](_0x362012[_0xb2f8('0x3d')][_0xb2f8('0x41')]));_0x4ec32a['attributes']=_0x4ec32a['attributes'][_0xb2f8('0x42')]?_0x4ec32a['attributes']:_0x56b213[_0xb2f8('0x3c')];if(!_0x362012[_0xb2f8('0x3d')][_0xb2f8('0x5d')](_0xb2f8('0x43'))){_0x4ec32a[_0xb2f8('0x25')]=qs[_0xb2f8('0x25')](_0x362012['query']['limit']);_0x4ec32a[_0xb2f8('0x24')]=qs[_0xb2f8('0x24')](_0x362012[_0xb2f8('0x3d')]['offset']);}_0x4ec32a[_0xb2f8('0x5e')]=qs['sort'](_0x362012[_0xb2f8('0x3d')][_0xb2f8('0x44')]);_0x4ec32a[_0xb2f8('0x45')]=qs[_0xb2f8('0x46')](_['pick'](_0x362012['query'],_0x56b213[_0xb2f8('0x46')]));_0x4ec32a[_0xb2f8('0x45')][_0xb2f8('0x5f')]=_0x5af46e['id'];if(_0x362012[_0xb2f8('0x3d')][_0xb2f8('0x48')]){_0x4ec32a[_0xb2f8('0x45')]=_['merge'](_0x4ec32a[_0xb2f8('0x45')],{'$or':_['map'](_0x4ec32a[_0xb2f8('0x40')],function(_0x300eca){var _0x463d16={};_0x463d16[_0x300eca]={'$like':'%'+_0x362012[_0xb2f8('0x3d')]['filter']+'%'};return _0x463d16;})});}_0x4ec32a=_[_0xb2f8('0x49')]({},_0x4ec32a,_0x362012['options']);return db['UserMailQueue']['findAll'](_0x4ec32a);}})['then'](function(_0x5f176){if(_0x5f176){return db[_0xb2f8('0x60')][_0xb2f8('0x61')]({'where':{'id':_[_0xb2f8('0x36')](_0x5f176,_0xb2f8('0x62')),'role':'agent'},'attributes':['id',_0xb2f8('0x33'),_0xb2f8('0x63'),'updatedAt',_0xb2f8('0x64')]});}})[_0xb2f8('0x2c')](function(_0x2cdcc3){if(_0x2cdcc3){return{'count':_0x2cdcc3[_0xb2f8('0x23')],'rows':_[_0xb2f8('0x36')](_0x2cdcc3[_0xb2f8('0x4e')],function(_0x3e683b){return{'membername':_0x3e683b[_0xb2f8('0x33')],'UserId':_0x3e683b['id'],'queue_name':_0x594f02[_0xb2f8('0x33')],'MailQueueId':_0x594f02['id'],'interface':util[_0xb2f8('0x65')](_0xb2f8('0x66'),_0xb2f8('0x67'),_0x3e683b[_0xb2f8('0x33')]),'penalty':0x0,'paused':_0x3e683b['mailPause'],'createdAt':_0x3e683b[_0xb2f8('0x64')],'updatedAt':_0x3e683b[_0xb2f8('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb2f8('0x2c')](respondWithFilteredResult(_0x52640a,_0x4ec32a))[_0xb2f8('0x51')](handleError(_0x52640a,null));};exports[_0xb2f8('0x69')]=function(_0x3bdadc,_0x31aaf0,_0x4d4188){var _0x451695={};var _0x38782d={};var _0x4ff1c8;var _0x5a6df3;return db[_0xb2f8('0x37')][_0xb2f8('0x5b')]({'where':{'id':_0x3bdadc['params']['id']}})[_0xb2f8('0x2c')](handleEntityNotFound(_0x31aaf0,null))[_0xb2f8('0x2c')](function(_0x2dc354){if(_0x2dc354){_0x4ff1c8=_0x2dc354;_0x38782d[_0xb2f8('0x3c')]=_[_0xb2f8('0x3e')](db[_0xb2f8('0x6a')][_0xb2f8('0x38')]);_0x38782d[_0xb2f8('0x3d')]=_[_0xb2f8('0x3e')](_0x3bdadc[_0xb2f8('0x3d')]);_0x38782d[_0xb2f8('0x46')]=_[_0xb2f8('0x3f')](_0x38782d['model'],_0x38782d[_0xb2f8('0x3d')]);_0x451695[_0xb2f8('0x40')]=_[_0xb2f8('0x3f')](_0x38782d[_0xb2f8('0x3c')],qs['fields'](_0x3bdadc['query'][_0xb2f8('0x41')]));_0x451695[_0xb2f8('0x40')]=_0x451695['attributes'][_0xb2f8('0x42')]?_0x451695[_0xb2f8('0x40')]:_0x38782d['model'];_0x451695[_0xb2f8('0x5e')]=qs[_0xb2f8('0x44')](_0x3bdadc[_0xb2f8('0x3d')]['sort']);_0x451695[_0xb2f8('0x45')]=qs['filters'](_[_0xb2f8('0x47')](_0x3bdadc['query'],_0x38782d[_0xb2f8('0x46')]));if(_0x3bdadc[_0xb2f8('0x3d')]['filter']){_0x451695['where']=_[_0xb2f8('0x49')](_0x451695['where'],{'$or':_[_0xb2f8('0x36')](_0x451695[_0xb2f8('0x40')],function(_0x4fa258){var _0x5565d5={};_0x5565d5[_0x4fa258]={'$like':'%'+_0x3bdadc['query'][_0xb2f8('0x48')]+'%'};return _0x5565d5;})});}_0x451695=_[_0xb2f8('0x49')]({},_0x451695,_0x3bdadc['options']);return _0x4ff1c8['getTeams'](_0x451695);}})[_0xb2f8('0x2c')](function(_0x203cc1){if(_0x203cc1){_0x5a6df3=_0x203cc1[_0xb2f8('0x42')];if(!_0x3bdadc[_0xb2f8('0x3d')][_0xb2f8('0x5d')]('nolimit')){_0x451695[_0xb2f8('0x25')]=qs[_0xb2f8('0x25')](_0x3bdadc[_0xb2f8('0x3d')][_0xb2f8('0x25')]);_0x451695['offset']=qs['offset'](_0x3bdadc[_0xb2f8('0x3d')][_0xb2f8('0x24')]);}return _0x4ff1c8['getTeams'](_0x451695);}})[_0xb2f8('0x2c')](function(_0x42f926){if(_0x42f926){return _0x42f926?{'count':_0x5a6df3,'rows':_0x42f926}:null;}})['then'](respondWithResult(_0x31aaf0,null))[_0xb2f8('0x51')](handleError(_0x31aaf0,null));};exports[_0xb2f8('0x6b')]=function(_0x3e866f,_0x41fdd8,_0x45c2d3){var _0x16b0ab=_0x3e866f['body']['ids'];return db[_0xb2f8('0x6a')][_0xb2f8('0x4d')]({'where':{'id':_0x16b0ab},'attributes':['id'],'include':[{'model':db[_0xb2f8('0x60')],'as':'Agents','attributes':['id',_0xb2f8('0x33'),_0xb2f8('0x6c'),_0xb2f8('0x6d'),_0xb2f8('0x6e')],'raw':!![]}]})[_0xb2f8('0x2c')](function(_0x5d04b7){if(_0x5d04b7){var _0x3388f0=_['flatMap'](_0x5d04b7,function(_0x5c7415){var _0x1809e2=_0x5c7415['get']({'plain':!![]});return _0x1809e2[_0xb2f8('0x6f')];});return db['MailQueue'][_0xb2f8('0x56')]({'where':{'id':_0x3e866f[_0xb2f8('0x50')]['id']}})[_0xb2f8('0x2c')](function(_0x172c93){return db[_0xb2f8('0x70')][_0xb2f8('0x71')](function(_0x8110c9){return _0x172c93[_0xb2f8('0x6b')](_0x16b0ab,{'transaction':_0x8110c9})[_0xb2f8('0x2c')](function(){return BPromise[_0xb2f8('0x72')](_0x3388f0,function(_0x1278df){return db[_0xb2f8('0x5c')][_0xb2f8('0x73')]({'where':{'UserId':_0x1278df['id'],'MailQueueId':_0x3e866f[_0xb2f8('0x50')]['id']},'transaction':_0x8110c9});});})[_0xb2f8('0x2c')](function(){_0x3388f0[_0xb2f8('0x74')](function(_0x3d4f2e){socket[_0xb2f8('0x75')](_0xb2f8('0x76'),{'UserId':_0x3d4f2e['id'],'MailQueueId':_0x172c93['id']});});});});});}})[_0xb2f8('0x2c')](respondWithStatusCode(_0x41fdd8,null))['catch'](handleError(_0x41fdd8,null));};exports[_0xb2f8('0x77')]=function(_0x168f72,_0x68b445,_0x179e32){return db[_0xb2f8('0x6a')][_0xb2f8('0x4d')]({'where':{'id':_0x168f72[_0xb2f8('0x3d')][_0xb2f8('0x78')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb2f8('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xb2f8('0x2c')](handleEntityNotFound(_0x68b445,null))[_0xb2f8('0x2c')](function(_0x2c17e0){var _0x7422b9=_[_0xb2f8('0x36')](_0x2c17e0,'id');var _0x25e73e=[];var _0x55752d=[];var _0x33c383=squel[_0xb2f8('0x79')]();_0x33c383[_0xb2f8('0x7a')]('tq.TeamId')[_0xb2f8('0x7b')]('team_has_mail_queues','tq')[_0xb2f8('0x7c')](_0xb2f8('0x7d'),'ut',_0xb2f8('0x7e'))[_0xb2f8('0x45')](_0xb2f8('0x7f'),_0x168f72[_0xb2f8('0x50')]['id']);for(var _0x197fcf=0x0;_0x197fcf<_0x2c17e0[_0xb2f8('0x42')];_0x197fcf+=0x1){let _0x410abc=_0x2c17e0[_0x197fcf];for(var _0x20c34e=0x0;_0x20c34e<_0x410abc[_0xb2f8('0x6f')][_0xb2f8('0x42')];_0x20c34e+=0x1){let _0x3481c6=_0x410abc[_0xb2f8('0x6f')][_0x20c34e];var _0x403664=_0x33c383[_0xb2f8('0x80')]();_0x403664['where'](_0xb2f8('0x81'),_0x3481c6['id']);_0x55752d[_0xb2f8('0x82')](db[_0xb2f8('0x70')][_0xb2f8('0x3d')](_0x403664[_0xb2f8('0x83')](),{'type':db[_0xb2f8('0x70')][_0xb2f8('0x84')][_0xb2f8('0x85')]})[_0xb2f8('0x2c')](function(_0x9fdd52){if(_0x9fdd52[_0xb2f8('0x42')]===0x1){return _0x3481c6['id'];}else{var _0x131101=_[_0xb2f8('0x86')](_[_0xb2f8('0x36')](_0x9fdd52,'TeamId'),function(_0x480b30){return _[_0xb2f8('0x87')](_0x7422b9,_0x480b30);});if(_0x131101){return _0x3481c6['id'];}}}));}}return BPromise[_0xb2f8('0x88')](_0x55752d)[_0xb2f8('0x2c')](function(_0x302c4b){_0x25e73e=_(_0x25e73e)[_0xb2f8('0x89')](_0x302c4b)[_0xb2f8('0x8a')]()['value']();return db['MailQueue'][_0xb2f8('0x56')]({'where':{'id':_0x168f72[_0xb2f8('0x50')]['id']}})['then'](function(_0x4a87ef){return db['sequelize'][_0xb2f8('0x71')](function(_0x1cfaae){return _0x4a87ef[_0xb2f8('0x77')](_0x168f72[_0xb2f8('0x3d')][_0xb2f8('0x78')],{'transaction':_0x1cfaae})[_0xb2f8('0x2c')](function(){if(!_[_0xb2f8('0x8b')](_0x25e73e)){return _0x4a87ef[_0xb2f8('0x8c')](_0x25e73e,{'transaction':_0x1cfaae});}})[_0xb2f8('0x2c')](function(){_0x25e73e[_0xb2f8('0x74')](function(_0x37dab2){socket['emit'](_0xb2f8('0x8d'),{'UserId':_0x37dab2,'MailQueueId':_0x4a87ef['id']});});});});});});})[_0xb2f8('0x2c')](respondWithStatusCode(_0x68b445,null))[_0xb2f8('0x51')](handleError(_0x68b445,null));};exports[_0xb2f8('0x8e')]=function(_0x24bdcb,_0x454c22,_0x5714e6){return db[_0xb2f8('0x37')][_0xb2f8('0x56')]({'where':{'id':_0x24bdcb['params']['id']}})[_0xb2f8('0x2c')](handleEntityNotFound(_0x454c22,null))[_0xb2f8('0x2c')](function(_0x1bd978){if(_0x1bd978){return _0x1bd978[_0xb2f8('0x8e')](_0x24bdcb['body'][_0xb2f8('0x78')],_[_0xb2f8('0x8f')](_0x24bdcb[_0xb2f8('0x53')],[_0xb2f8('0x78'),'id'])||{})[_0xb2f8('0x90')](function(_0x2ade89){for(var _0x2a5af8=0x0;_0x2a5af8<_0x24bdcb['body'][_0xb2f8('0x78')][_0xb2f8('0x42')];_0x2a5af8+=0x1){socket['emit'](_0xb2f8('0x76'),{'UserId':_0x24bdcb[_0xb2f8('0x53')][_0xb2f8('0x78')][_0x2a5af8],'MailQueueId':_0x24bdcb['params']['id']});}return _0x2ade89;});}})[_0xb2f8('0x2c')](respondWithResult(_0x454c22,null))['catch'](handleError(_0x454c22,null));};exports[_0xb2f8('0x8c')]=function(_0x326824,_0x5b1e85,_0x26056e){return db[_0xb2f8('0x37')]['find']({'where':{'id':_0x326824[_0xb2f8('0x50')]['id']}})['then'](handleEntityNotFound(_0x5b1e85,null))[_0xb2f8('0x2c')](function(_0xf49197){if(_0xf49197){return _0xf49197[_0xb2f8('0x8c')](_0x326824[_0xb2f8('0x3d')][_0xb2f8('0x78')])[_0xb2f8('0x2c')](function(){if(_[_0xb2f8('0x91')](_0x326824[_0xb2f8('0x3d')][_0xb2f8('0x78')])){for(var _0x39693b=0x0;_0x39693b<_0x326824[_0xb2f8('0x3d')][_0xb2f8('0x78')][_0xb2f8('0x42')];_0x39693b+=0x1){socket[_0xb2f8('0x75')](_0xb2f8('0x8d'),{'UserId':Number(_0x326824[_0xb2f8('0x3d')][_0xb2f8('0x78')][_0x39693b]),'MailQueueId':Number(_0x326824['params']['id'])});}}else{socket[_0xb2f8('0x75')](_0xb2f8('0x8d'),{'UserId':Number(_0x326824[_0xb2f8('0x3d')][_0xb2f8('0x78')]),'MailQueueId':Number(_0x326824['params']['id'])});}});}})[_0xb2f8('0x2c')](respondWithStatusCode(_0x5b1e85,null))[_0xb2f8('0x51')](handleError(_0x5b1e85,null));};exports[_0xb2f8('0x92')]=function(_0x12ae08,_0x24c705,_0x14bd40){var _0x172fe2={};var _0x45de81={};var _0x76b6fa;var _0x2f42e8;return db[_0xb2f8('0x37')][_0xb2f8('0x5b')]({'where':{'id':_0x12ae08['params']['id']}})[_0xb2f8('0x2c')](handleEntityNotFound(_0x24c705,null))[_0xb2f8('0x2c')](function(_0x195c87){if(_0x195c87){_0x76b6fa=_0x195c87;_0x45de81['model']=_[_0xb2f8('0x3e')](db['User'][_0xb2f8('0x38')]);_0x45de81[_0xb2f8('0x3d')]=_[_0xb2f8('0x3e')](_0x12ae08['query']);_0x45de81[_0xb2f8('0x46')]=_[_0xb2f8('0x3f')](_0x45de81[_0xb2f8('0x3c')],_0x45de81[_0xb2f8('0x3d')]);_0x172fe2[_0xb2f8('0x40')]=_['intersection'](_0x45de81[_0xb2f8('0x3c')],qs[_0xb2f8('0x41')](_0x12ae08['query'][_0xb2f8('0x41')]));_0x172fe2['attributes']=_0x172fe2['attributes'][_0xb2f8('0x42')]?_0x172fe2[_0xb2f8('0x40')]:_0x45de81[_0xb2f8('0x3c')];_0x172fe2[_0xb2f8('0x5e')]=qs['sort'](_0x12ae08[_0xb2f8('0x3d')][_0xb2f8('0x44')]);_0x172fe2['where']=qs[_0xb2f8('0x46')](_[_0xb2f8('0x47')](_0x12ae08[_0xb2f8('0x3d')],_0x45de81[_0xb2f8('0x46')]));if(_0x12ae08['query'][_0xb2f8('0x48')]){_0x172fe2[_0xb2f8('0x45')]=_[_0xb2f8('0x49')](_0x172fe2[_0xb2f8('0x45')],{'$or':_[_0xb2f8('0x36')](_0x172fe2[_0xb2f8('0x40')],function(_0x4ce0a4){var _0x6d34db={};_0x6d34db[_0x4ce0a4]={'$like':'%'+_0x12ae08[_0xb2f8('0x3d')][_0xb2f8('0x48')]+'%'};return _0x6d34db;})});}_0x172fe2=_['merge']({},_0x172fe2,_0x12ae08[_0xb2f8('0x4b')]);return _0x76b6fa[_0xb2f8('0x92')](_0x172fe2);}})[_0xb2f8('0x2c')](function(_0x1a5e24){if(_0x1a5e24){_0x2f42e8=_0x1a5e24[_0xb2f8('0x42')];if(!_0x12ae08[_0xb2f8('0x3d')][_0xb2f8('0x5d')](_0xb2f8('0x43'))){_0x172fe2['limit']=qs[_0xb2f8('0x25')](_0x12ae08[_0xb2f8('0x3d')]['limit']);_0x172fe2[_0xb2f8('0x24')]=qs[_0xb2f8('0x24')](_0x12ae08['query']['offset']);}return _0x76b6fa[_0xb2f8('0x92')](_0x172fe2);}})['then'](function(_0x19d9e2){if(_0x19d9e2){return _0x19d9e2?{'count':_0x2f42e8,'rows':_0x19d9e2}:null;}})['then'](respondWithResult(_0x24c705,null))[_0xb2f8('0x51')](handleError(_0x24c705,null));}; \ No newline at end of file +var _0xb9e7=['sort','where','filter','merge','count','includeAll','include','findAll','rows','show','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','UserMailQueue','pick','User','agent','mailPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','findOne','Team','order','Agents','online','interface','transaction','addTeams','each','findOrCreate','forEach','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','toString','sequelize','QueryTypes','SELECT','TeamId','all','union','compact','value','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','error','name','send','index','map','MailQueue','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0xb9e7[_0x65c903];return _0x23e1d7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7b9e('0x0'));var rimraf=require(_0x7b9e('0x1'));var zipdir=require(_0x7b9e('0x2'));var jsonpatch=require(_0x7b9e('0x3'));var rp=require(_0x7b9e('0x4'));var moment=require(_0x7b9e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7b9e('0x6'));var util=require(_0x7b9e('0x7'));var path=require('path');var sox=require(_0x7b9e('0x8'));var csv=require('to-csv');var ejs=require(_0x7b9e('0x9'));var fs=require('fs');var _=require(_0x7b9e('0xa'));var squel=require(_0x7b9e('0xb'));var crypto=require(_0x7b9e('0xc'));var jsforce=require(_0x7b9e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7b9e('0xe'));var querystring=require(_0x7b9e('0xf'));var Papa=require(_0x7b9e('0x10'));var Redis=require('ioredis');var authService=require(_0x7b9e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7b9e('0x12'));var hardwareService=require(_0x7b9e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7b9e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7b9e('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x7b9e('0x16')],{'host':_0x7b9e('0x17'),'port':0x18eb});var socket=require(_0x7b9e('0x18'))(new Redis(config[_0x7b9e('0x16')]));require('./mailQueue.socket')[_0x7b9e('0x19')](socket);function respondWithStatusCode(_0x1fa0e8,_0x27d807){_0x27d807=_0x27d807||0xcc;return function(_0x13ddc0){if(_0x13ddc0){return _0x1fa0e8[_0x7b9e('0x1a')](_0x27d807);}return _0x1fa0e8[_0x7b9e('0x1b')](_0x27d807)[_0x7b9e('0x1c')]();};}function respondWithResult(_0x504954,_0x1c573f){_0x1c573f=_0x1c573f||0xc8;return function(_0x6f90f8){if(_0x6f90f8){return _0x504954['status'](_0x1c573f)[_0x7b9e('0x1d')](_0x6f90f8);}};}function respondWithFilteredResult(_0x53a085,_0x2afe9f){return function(_0x455b45){if(_0x455b45){var _0x4c8728=_0x455b45['count'],_0x447269=_0x2afe9f[_0x7b9e('0x1e')],_0x153906=_0x2afe9f[_0x7b9e('0x1e')]+_0x2afe9f[_0x7b9e('0x1f')],_0x5cbc8b;if(_0x153906>=_0x4c8728){_0x153906=_0x4c8728;_0x5cbc8b=0xc8;}else{_0x5cbc8b=0xce;}_0x53a085[_0x7b9e('0x1b')](_0x5cbc8b);return _0x53a085['set'](_0x7b9e('0x20'),_0x447269+'-'+_0x153906+'/'+_0x4c8728)[_0x7b9e('0x1d')](_0x455b45);}return null;};}function patchUpdates(_0x3bdbd8){return function(_0x112374){try{jsonpatch[_0x7b9e('0x21')](_0x112374,_0x3bdbd8,!![]);}catch(_0x535433){return BPromise[_0x7b9e('0x22')](_0x535433);}return _0x112374[_0x7b9e('0x23')]();};}function saveUpdates(_0x7db95f,_0x9b24da){return function(_0x45cb41){if(_0x45cb41){return _0x45cb41[_0x7b9e('0x24')](_0x7db95f)[_0x7b9e('0x25')](function(_0x39575a){return _0x39575a;});}return null;};}function removeEntity(_0x2b4b86,_0x5dcd42){return function(_0xf8b578){if(_0xf8b578){return _0xf8b578[_0x7b9e('0x26')]()[_0x7b9e('0x25')](function(){var _0x1033b0=_0xf8b578[_0x7b9e('0x27')]({'plain':!![]});var _0x2fde42=_0x7b9e('0x28');return db[_0x7b9e('0x29')][_0x7b9e('0x26')]({'where':{'type':_0x2fde42,'resourceId':_0x1033b0['id']}})[_0x7b9e('0x25')](function(){return _0xf8b578;});})['then'](function(){_0x2b4b86[_0x7b9e('0x1b')](0xcc)[_0x7b9e('0x1c')]();});}};}function handleEntityNotFound(_0x1a541c,_0x2dbe2a){return function(_0x2ac45e){if(!_0x2ac45e){_0x1a541c[_0x7b9e('0x1a')](0x194);}return _0x2ac45e;};}function handleError(_0x5b9db4,_0x22612e){_0x22612e=_0x22612e||0x1f4;return function(_0x5ca745){logger[_0x7b9e('0x2a')](_0x5ca745['stack']);if(_0x5ca745[_0x7b9e('0x2b')]){delete _0x5ca745[_0x7b9e('0x2b')];}_0x5b9db4[_0x7b9e('0x1b')](_0x22612e)[_0x7b9e('0x2c')](_0x5ca745);};}exports[_0x7b9e('0x2d')]=function(_0x1979d7,_0x17d5b2){var _0x11329f={},_0x8ef2f2={},_0x56e87e={'count':0x0,'rows':[]};var _0x3ebcd6=_[_0x7b9e('0x2e')](db[_0x7b9e('0x2f')][_0x7b9e('0x30')],function(_0xe53f7b){return{'name':_0xe53f7b['fieldName'],'type':_0xe53f7b[_0x7b9e('0x31')][_0x7b9e('0x32')]};});_0x8ef2f2[_0x7b9e('0x33')]=_[_0x7b9e('0x2e')](_0x3ebcd6,_0x7b9e('0x2b'));_0x8ef2f2['query']=_[_0x7b9e('0x34')](_0x1979d7[_0x7b9e('0x35')]);_0x8ef2f2[_0x7b9e('0x36')]=_[_0x7b9e('0x37')](_0x8ef2f2['model'],_0x8ef2f2['query']);_0x11329f[_0x7b9e('0x38')]=_['intersection'](_0x8ef2f2['model'],qs[_0x7b9e('0x39')](_0x1979d7['query'][_0x7b9e('0x39')]));_0x11329f['attributes']=_0x11329f[_0x7b9e('0x38')][_0x7b9e('0x3a')]?_0x11329f['attributes']:_0x8ef2f2[_0x7b9e('0x33')];if(!_0x1979d7[_0x7b9e('0x35')][_0x7b9e('0x3b')](_0x7b9e('0x3c'))){_0x11329f['limit']=qs[_0x7b9e('0x1f')](_0x1979d7[_0x7b9e('0x35')][_0x7b9e('0x1f')]);_0x11329f[_0x7b9e('0x1e')]=qs[_0x7b9e('0x1e')](_0x1979d7['query']['offset']);}_0x11329f['order']=qs[_0x7b9e('0x3d')](_0x1979d7['query'][_0x7b9e('0x3d')]);_0x11329f[_0x7b9e('0x3e')]=qs[_0x7b9e('0x36')](_['pick'](_0x1979d7[_0x7b9e('0x35')],_0x8ef2f2[_0x7b9e('0x36')]),_0x3ebcd6);if(_0x1979d7[_0x7b9e('0x35')][_0x7b9e('0x3f')]){_0x11329f[_0x7b9e('0x3e')]=_[_0x7b9e('0x40')](_0x11329f[_0x7b9e('0x3e')],{'$or':_['map'](_0x3ebcd6,function(_0x45b9ca){if(_0x45b9ca[_0x7b9e('0x31')]!=='VIRTUAL'){var _0x2ccc3b={};_0x2ccc3b[_0x45b9ca['name']]={'$like':'%'+_0x1979d7[_0x7b9e('0x35')][_0x7b9e('0x3f')]+'%'};return _0x2ccc3b;}})});}_0x11329f=_[_0x7b9e('0x40')]({},_0x11329f,_0x1979d7['options']);var _0x2a407a={'where':_0x11329f[_0x7b9e('0x3e')]};return db['MailQueue'][_0x7b9e('0x41')](_0x2a407a)[_0x7b9e('0x25')](function(_0x5a6f3e){_0x56e87e[_0x7b9e('0x41')]=_0x5a6f3e;if(_0x1979d7[_0x7b9e('0x35')][_0x7b9e('0x42')]){_0x11329f[_0x7b9e('0x43')]=[{'all':!![]}];}return db['MailQueue'][_0x7b9e('0x44')](_0x11329f);})[_0x7b9e('0x25')](function(_0x129feb){_0x56e87e[_0x7b9e('0x45')]=_0x129feb;return _0x56e87e;})['then'](respondWithFilteredResult(_0x17d5b2,_0x11329f))['catch'](handleError(_0x17d5b2,null));};exports[_0x7b9e('0x46')]=function(_0x45e04e,_0x525b09){var _0x44af51={'raw':!![],'where':{'id':_0x45e04e['params']['id']}},_0x5802f4={};_0x5802f4[_0x7b9e('0x33')]=_['keys'](db['MailQueue'][_0x7b9e('0x30')]);_0x5802f4[_0x7b9e('0x35')]=_['keys'](_0x45e04e[_0x7b9e('0x35')]);_0x5802f4[_0x7b9e('0x36')]=_[_0x7b9e('0x37')](_0x5802f4[_0x7b9e('0x33')],_0x5802f4[_0x7b9e('0x35')]);_0x44af51[_0x7b9e('0x38')]=_[_0x7b9e('0x37')](_0x5802f4[_0x7b9e('0x33')],qs[_0x7b9e('0x39')](_0x45e04e[_0x7b9e('0x35')]['fields']));_0x44af51[_0x7b9e('0x38')]=_0x44af51[_0x7b9e('0x38')][_0x7b9e('0x3a')]?_0x44af51[_0x7b9e('0x38')]:_0x5802f4[_0x7b9e('0x33')];if(_0x45e04e[_0x7b9e('0x35')]['includeAll']){_0x44af51[_0x7b9e('0x43')]=[{'all':!![]}];}_0x44af51=_['merge']({},_0x44af51,_0x45e04e[_0x7b9e('0x47')]);return db[_0x7b9e('0x2f')][_0x7b9e('0x48')](_0x44af51)['then'](handleEntityNotFound(_0x525b09,null))[_0x7b9e('0x25')](respondWithResult(_0x525b09,null))[_0x7b9e('0x49')](handleError(_0x525b09,null));};exports[_0x7b9e('0x4a')]=function(_0xd8d568,_0x155b62){return db[_0x7b9e('0x2f')][_0x7b9e('0x4a')](_0xd8d568[_0x7b9e('0x4b')],{})[_0x7b9e('0x25')](function(_0x3aa4de){var _0xd0479=_0xd8d568['user'][_0x7b9e('0x27')]({'plain':!![]});if(!_0xd0479)throw new Error(_0x7b9e('0x4c'));if(_0xd0479[_0x7b9e('0x4d')]==='user'){var _0x34f1ae=_0x3aa4de[_0x7b9e('0x27')]({'plain':!![]});var _0x113c91='MailQueues';return db[_0x7b9e('0x4e')][_0x7b9e('0x48')]({'where':{'name':_0x113c91,'userProfileId':_0xd0479[_0x7b9e('0x4f')]},'raw':!![]})[_0x7b9e('0x25')](function(_0x34bcc8){if(_0x34bcc8&&_0x34bcc8[_0x7b9e('0x50')]===0x0){return db[_0x7b9e('0x29')]['create']({'name':_0x34f1ae[_0x7b9e('0x2b')],'resourceId':_0x34f1ae['id'],'type':_0x34bcc8[_0x7b9e('0x2b')],'sectionId':_0x34bcc8['id']},{})[_0x7b9e('0x25')](function(){return _0x3aa4de;});}else{return _0x3aa4de;}})[_0x7b9e('0x49')](function(_0xf52931){logger['error'](_0x7b9e('0x51'),_0xf52931);throw _0xf52931;});}return _0x3aa4de;})['then'](respondWithResult(_0x155b62,0xc9))['catch'](handleError(_0x155b62,null));};exports[_0x7b9e('0x24')]=function(_0x69f1e7,_0x46c8d3){if(_0x69f1e7['body']['id']){delete _0x69f1e7[_0x7b9e('0x4b')]['id'];}return db[_0x7b9e('0x2f')][_0x7b9e('0x48')]({'where':{'id':_0x69f1e7[_0x7b9e('0x52')]['id']}})[_0x7b9e('0x25')](handleEntityNotFound(_0x46c8d3,null))[_0x7b9e('0x25')](saveUpdates(_0x69f1e7[_0x7b9e('0x4b')],null))['then'](respondWithResult(_0x46c8d3,null))[_0x7b9e('0x49')](handleError(_0x46c8d3,null));};exports[_0x7b9e('0x26')]=function(_0x3fbbfe,_0x5aa49d){return db[_0x7b9e('0x2f')][_0x7b9e('0x48')]({'where':{'id':_0x3fbbfe[_0x7b9e('0x52')]['id']}})[_0x7b9e('0x25')](handleEntityNotFound(_0x5aa49d,null))[_0x7b9e('0x25')](removeEntity(_0x5aa49d,null))[_0x7b9e('0x49')](handleError(_0x5aa49d,null));};exports[_0x7b9e('0x53')]=function(_0xc631e1,_0x1ff584){return db[_0x7b9e('0x2f')]['describe']()[_0x7b9e('0x25')](respondWithResult(_0x1ff584,null))[_0x7b9e('0x49')](handleError(_0x1ff584,null));};exports['getMembers']=function(_0x51f155,_0x5c95d2,_0x2debf6){var _0xc6c921={'raw':!![],'where':{}},_0x193395={},_0x4f3080;return db[_0x7b9e('0x2f')]['findOne']({'where':{'id':_0x51f155[_0x7b9e('0x52')]['id']}})[_0x7b9e('0x25')](handleEntityNotFound(_0x5c95d2,null))['then'](function(_0xb8b14){if(_0xb8b14){_0x4f3080=_0xb8b14[_0x7b9e('0x27')]({'plain':!![]});_0x193395['model']=_[_0x7b9e('0x34')](db[_0x7b9e('0x54')][_0x7b9e('0x30')]);_0x193395[_0x7b9e('0x35')]=_[_0x7b9e('0x34')](_0x51f155['query']);_0x193395[_0x7b9e('0x36')]=_[_0x7b9e('0x37')](_0x193395['model'],_0x193395[_0x7b9e('0x35')]);_0xc6c921['attributes']=_[_0x7b9e('0x37')](_0x193395[_0x7b9e('0x33')],qs[_0x7b9e('0x39')](_0x51f155[_0x7b9e('0x35')]['fields']));_0xc6c921['attributes']=_0xc6c921['attributes'][_0x7b9e('0x3a')]?_0xc6c921[_0x7b9e('0x38')]:_0x193395[_0x7b9e('0x33')];if(!_0x51f155['query']['hasOwnProperty'](_0x7b9e('0x3c'))){_0xc6c921['limit']=qs[_0x7b9e('0x1f')](_0x51f155['query'][_0x7b9e('0x1f')]);_0xc6c921['offset']=qs[_0x7b9e('0x1e')](_0x51f155['query'][_0x7b9e('0x1e')]);}_0xc6c921['order']=qs[_0x7b9e('0x3d')](_0x51f155['query']['sort']);_0xc6c921[_0x7b9e('0x3e')]=qs[_0x7b9e('0x36')](_[_0x7b9e('0x55')](_0x51f155[_0x7b9e('0x35')],_0x193395[_0x7b9e('0x36')]));_0xc6c921['where']['MailQueueId']=_0xb8b14['id'];if(_0x51f155['query'][_0x7b9e('0x3f')]){_0xc6c921[_0x7b9e('0x3e')]=_[_0x7b9e('0x40')](_0xc6c921[_0x7b9e('0x3e')],{'$or':_[_0x7b9e('0x2e')](_0xc6c921[_0x7b9e('0x38')],function(_0x390cf2){var _0x3b5b83={};_0x3b5b83[_0x390cf2]={'$like':'%'+_0x51f155[_0x7b9e('0x35')]['filter']+'%'};return _0x3b5b83;})});}_0xc6c921=_[_0x7b9e('0x40')]({},_0xc6c921,_0x51f155[_0x7b9e('0x47')]);return db[_0x7b9e('0x54')][_0x7b9e('0x44')](_0xc6c921);}})['then'](function(_0x3660a8){if(_0x3660a8){return db[_0x7b9e('0x56')]['findAndCountAll']({'where':{'id':_['map'](_0x3660a8,'UserId'),'role':_0x7b9e('0x57')},'attributes':['id','name',_0x7b9e('0x58'),'updatedAt','createdAt']});}})['then'](function(_0x64c809){if(_0x64c809){return{'count':_0x64c809['count'],'rows':_['map'](_0x64c809[_0x7b9e('0x45')],function(_0x1fb7d3){return{'membername':_0x1fb7d3[_0x7b9e('0x2b')],'UserId':_0x1fb7d3['id'],'queue_name':_0x4f3080[_0x7b9e('0x2b')],'MailQueueId':_0x4f3080['id'],'interface':util[_0x7b9e('0x59')](_0x7b9e('0x5a'),_0x7b9e('0x5b'),_0x1fb7d3[_0x7b9e('0x2b')]),'penalty':0x0,'paused':_0x1fb7d3['mailPause'],'createdAt':_0x1fb7d3[_0x7b9e('0x5c')],'updatedAt':_0x1fb7d3[_0x7b9e('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7b9e('0x25')](respondWithFilteredResult(_0x5c95d2,_0xc6c921))[_0x7b9e('0x49')](handleError(_0x5c95d2,null));};exports[_0x7b9e('0x5e')]=function(_0x401e7d,_0x2aa5d1,_0x1dc0b9){var _0x262e4c={};var _0x1b69cd={};var _0x1d2c31;var _0x4a64e4;return db[_0x7b9e('0x2f')][_0x7b9e('0x5f')]({'where':{'id':_0x401e7d['params']['id']}})[_0x7b9e('0x25')](handleEntityNotFound(_0x2aa5d1,null))['then'](function(_0x3fc838){if(_0x3fc838){_0x1d2c31=_0x3fc838;_0x1b69cd[_0x7b9e('0x33')]=_[_0x7b9e('0x34')](db[_0x7b9e('0x60')]['rawAttributes']);_0x1b69cd[_0x7b9e('0x35')]=_[_0x7b9e('0x34')](_0x401e7d[_0x7b9e('0x35')]);_0x1b69cd[_0x7b9e('0x36')]=_[_0x7b9e('0x37')](_0x1b69cd[_0x7b9e('0x33')],_0x1b69cd[_0x7b9e('0x35')]);_0x262e4c[_0x7b9e('0x38')]=_[_0x7b9e('0x37')](_0x1b69cd[_0x7b9e('0x33')],qs[_0x7b9e('0x39')](_0x401e7d['query'][_0x7b9e('0x39')]));_0x262e4c[_0x7b9e('0x38')]=_0x262e4c[_0x7b9e('0x38')][_0x7b9e('0x3a')]?_0x262e4c[_0x7b9e('0x38')]:_0x1b69cd[_0x7b9e('0x33')];_0x262e4c[_0x7b9e('0x61')]=qs[_0x7b9e('0x3d')](_0x401e7d['query'][_0x7b9e('0x3d')]);_0x262e4c[_0x7b9e('0x3e')]=qs[_0x7b9e('0x36')](_[_0x7b9e('0x55')](_0x401e7d[_0x7b9e('0x35')],_0x1b69cd['filters']));if(_0x401e7d['query'][_0x7b9e('0x3f')]){_0x262e4c[_0x7b9e('0x3e')]=_[_0x7b9e('0x40')](_0x262e4c[_0x7b9e('0x3e')],{'$or':_[_0x7b9e('0x2e')](_0x262e4c[_0x7b9e('0x38')],function(_0x24c985){var _0x19ccaf={};_0x19ccaf[_0x24c985]={'$like':'%'+_0x401e7d['query'][_0x7b9e('0x3f')]+'%'};return _0x19ccaf;})});}_0x262e4c=_['merge']({},_0x262e4c,_0x401e7d[_0x7b9e('0x47')]);return _0x1d2c31[_0x7b9e('0x5e')](_0x262e4c);}})[_0x7b9e('0x25')](function(_0xf94835){if(_0xf94835){_0x4a64e4=_0xf94835['length'];if(!_0x401e7d[_0x7b9e('0x35')]['hasOwnProperty'](_0x7b9e('0x3c'))){_0x262e4c[_0x7b9e('0x1f')]=qs['limit'](_0x401e7d[_0x7b9e('0x35')][_0x7b9e('0x1f')]);_0x262e4c[_0x7b9e('0x1e')]=qs[_0x7b9e('0x1e')](_0x401e7d[_0x7b9e('0x35')][_0x7b9e('0x1e')]);}return _0x1d2c31[_0x7b9e('0x5e')](_0x262e4c);}})[_0x7b9e('0x25')](function(_0x4b1a24){if(_0x4b1a24){return _0x4b1a24?{'count':_0x4a64e4,'rows':_0x4b1a24}:null;}})[_0x7b9e('0x25')](respondWithResult(_0x2aa5d1,null))[_0x7b9e('0x49')](handleError(_0x2aa5d1,null));};exports['addTeams']=function(_0x5e7c33,_0x2026ec,_0x47f3f5){var _0x3fca33=_0x5e7c33[_0x7b9e('0x4b')]['ids'];return db[_0x7b9e('0x60')][_0x7b9e('0x44')]({'where':{'id':_0x3fca33},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7b9e('0x62'),'attributes':['id',_0x7b9e('0x2b'),_0x7b9e('0x63'),'voicePause',_0x7b9e('0x64')],'raw':!![]}]})[_0x7b9e('0x25')](function(_0x8c3790){if(_0x8c3790){var _0x41057c=_['flatMap'](_0x8c3790,function(_0xd1b87f){var _0x2fe389=_0xd1b87f['get']({'plain':!![]});return _0x2fe389['Agents'];});return db[_0x7b9e('0x2f')]['find']({'where':{'id':_0x5e7c33[_0x7b9e('0x52')]['id']}})[_0x7b9e('0x25')](function(_0x5d28f9){return db['sequelize'][_0x7b9e('0x65')](function(_0x3319f9){return _0x5d28f9[_0x7b9e('0x66')](_0x3fca33,{'transaction':_0x3319f9})['then'](function(){return BPromise[_0x7b9e('0x67')](_0x41057c,function(_0x49617c){return db[_0x7b9e('0x54')][_0x7b9e('0x68')]({'where':{'UserId':_0x49617c['id'],'MailQueueId':_0x5e7c33[_0x7b9e('0x52')]['id']},'transaction':_0x3319f9});});})['then'](function(){_0x41057c[_0x7b9e('0x69')](function(_0x3f3af3){socket['emit'](_0x7b9e('0x6a'),{'UserId':_0x3f3af3['id'],'MailQueueId':_0x5d28f9['id']});});});});});}})[_0x7b9e('0x25')](respondWithStatusCode(_0x2026ec,null))['catch'](handleError(_0x2026ec,null));};exports[_0x7b9e('0x6b')]=function(_0x733927,_0x40b675,_0x1cfc0){return db[_0x7b9e('0x60')][_0x7b9e('0x44')]({'where':{'id':_0x733927[_0x7b9e('0x35')][_0x7b9e('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x7b9e('0x56')],'as':_0x7b9e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x7b9e('0x25')](handleEntityNotFound(_0x40b675,null))[_0x7b9e('0x25')](function(_0x55485e){var _0x10e5f4=_['map'](_0x55485e,'id');var _0x438613=[];var _0x4ff6cd=[];var _0x50bd0f=squel[_0x7b9e('0x6d')]();_0x50bd0f[_0x7b9e('0x6e')](_0x7b9e('0x6f'))['from'](_0x7b9e('0x70'),'tq')[_0x7b9e('0x71')](_0x7b9e('0x72'),'ut',_0x7b9e('0x73'))[_0x7b9e('0x3e')](_0x7b9e('0x74'),_0x733927[_0x7b9e('0x52')]['id']);for(var _0x4bac58=0x0;_0x4bac58<_0x55485e[_0x7b9e('0x3a')];_0x4bac58+=0x1){let _0x124068=_0x55485e[_0x4bac58];for(var _0x58cd91=0x0;_0x58cd91<_0x124068[_0x7b9e('0x62')][_0x7b9e('0x3a')];_0x58cd91+=0x1){let _0x37f480=_0x124068[_0x7b9e('0x62')][_0x58cd91];var _0x4dacc1=_0x50bd0f[_0x7b9e('0x75')]();_0x4dacc1[_0x7b9e('0x3e')]('ut.UserId\x20=\x20?',_0x37f480['id']);_0x4ff6cd['push'](db['sequelize'][_0x7b9e('0x35')](_0x4dacc1[_0x7b9e('0x76')](),{'type':db[_0x7b9e('0x77')][_0x7b9e('0x78')][_0x7b9e('0x79')]})[_0x7b9e('0x25')](function(_0x3f576a){if(_0x3f576a[_0x7b9e('0x3a')]===0x1){return _0x37f480['id'];}else{var _0x426717=_['every'](_[_0x7b9e('0x2e')](_0x3f576a,_0x7b9e('0x7a')),function(_0xc23470){return _['includes'](_0x10e5f4,_0xc23470);});if(_0x426717){return _0x37f480['id'];}}}));}}return BPromise[_0x7b9e('0x7b')](_0x4ff6cd)['then'](function(_0x4422c8){_0x438613=_(_0x438613)[_0x7b9e('0x7c')](_0x4422c8)[_0x7b9e('0x7d')]()[_0x7b9e('0x7e')]();return db['MailQueue'][_0x7b9e('0x48')]({'where':{'id':_0x733927['params']['id']}})[_0x7b9e('0x25')](function(_0x2998f4){return db['sequelize']['transaction'](function(_0x744cd2){return _0x2998f4['removeTeams'](_0x733927['query'][_0x7b9e('0x6c')],{'transaction':_0x744cd2})[_0x7b9e('0x25')](function(){if(!_[_0x7b9e('0x7f')](_0x438613)){return _0x2998f4[_0x7b9e('0x80')](_0x438613,{'transaction':_0x744cd2});}})['then'](function(){_0x438613['forEach'](function(_0x5d0131){socket[_0x7b9e('0x81')](_0x7b9e('0x82'),{'UserId':_0x5d0131,'MailQueueId':_0x2998f4['id']});});});});});});})[_0x7b9e('0x25')](respondWithStatusCode(_0x40b675,null))[_0x7b9e('0x49')](handleError(_0x40b675,null));};exports[_0x7b9e('0x83')]=function(_0x19d48e,_0x55c84b,_0x577125){return db[_0x7b9e('0x2f')][_0x7b9e('0x48')]({'where':{'id':_0x19d48e[_0x7b9e('0x52')]['id']}})['then'](handleEntityNotFound(_0x55c84b,null))[_0x7b9e('0x25')](function(_0x2f742f){if(_0x2f742f){return _0x2f742f[_0x7b9e('0x83')](_0x19d48e['body'][_0x7b9e('0x6c')],_[_0x7b9e('0x84')](_0x19d48e[_0x7b9e('0x4b')],[_0x7b9e('0x6c'),'id'])||{})[_0x7b9e('0x85')](function(_0x2c89f9){for(var _0x43281a=0x0;_0x43281a<_0x19d48e[_0x7b9e('0x4b')]['ids']['length'];_0x43281a+=0x1){socket[_0x7b9e('0x81')](_0x7b9e('0x6a'),{'UserId':_0x19d48e[_0x7b9e('0x4b')]['ids'][_0x43281a],'MailQueueId':_0x19d48e[_0x7b9e('0x52')]['id']});}return _0x2c89f9;});}})['then'](respondWithResult(_0x55c84b,null))['catch'](handleError(_0x55c84b,null));};exports[_0x7b9e('0x80')]=function(_0x40cf9d,_0xbdc69b,_0x33c15b){return db['MailQueue']['find']({'where':{'id':_0x40cf9d[_0x7b9e('0x52')]['id']}})[_0x7b9e('0x25')](handleEntityNotFound(_0xbdc69b,null))[_0x7b9e('0x25')](function(_0x300fe5){if(_0x300fe5){return _0x300fe5[_0x7b9e('0x80')](_0x40cf9d[_0x7b9e('0x35')][_0x7b9e('0x6c')])[_0x7b9e('0x25')](function(){if(_['isArray'](_0x40cf9d[_0x7b9e('0x35')][_0x7b9e('0x6c')])){for(var _0x498c3a=0x0;_0x498c3a<_0x40cf9d[_0x7b9e('0x35')][_0x7b9e('0x6c')]['length'];_0x498c3a+=0x1){socket[_0x7b9e('0x81')](_0x7b9e('0x82'),{'UserId':Number(_0x40cf9d[_0x7b9e('0x35')][_0x7b9e('0x6c')][_0x498c3a]),'MailQueueId':Number(_0x40cf9d[_0x7b9e('0x52')]['id'])});}}else{socket['emit'](_0x7b9e('0x82'),{'UserId':Number(_0x40cf9d[_0x7b9e('0x35')][_0x7b9e('0x6c')]),'MailQueueId':Number(_0x40cf9d[_0x7b9e('0x52')]['id'])});}});}})[_0x7b9e('0x25')](respondWithStatusCode(_0xbdc69b,null))[_0x7b9e('0x49')](handleError(_0xbdc69b,null));};exports[_0x7b9e('0x86')]=function(_0x51f2ea,_0x51cf85,_0x223c6c){var _0x237c4c={};var _0x498439={};var _0x5a7701;var _0x58d500;return db['MailQueue'][_0x7b9e('0x5f')]({'where':{'id':_0x51f2ea['params']['id']}})[_0x7b9e('0x25')](handleEntityNotFound(_0x51cf85,null))[_0x7b9e('0x25')](function(_0x595a7d){if(_0x595a7d){_0x5a7701=_0x595a7d;_0x498439[_0x7b9e('0x33')]=_[_0x7b9e('0x34')](db[_0x7b9e('0x56')]['rawAttributes']);_0x498439[_0x7b9e('0x35')]=_[_0x7b9e('0x34')](_0x51f2ea[_0x7b9e('0x35')]);_0x498439[_0x7b9e('0x36')]=_[_0x7b9e('0x37')](_0x498439[_0x7b9e('0x33')],_0x498439[_0x7b9e('0x35')]);_0x237c4c[_0x7b9e('0x38')]=_['intersection'](_0x498439[_0x7b9e('0x33')],qs[_0x7b9e('0x39')](_0x51f2ea[_0x7b9e('0x35')][_0x7b9e('0x39')]));_0x237c4c[_0x7b9e('0x38')]=_0x237c4c['attributes'][_0x7b9e('0x3a')]?_0x237c4c['attributes']:_0x498439[_0x7b9e('0x33')];_0x237c4c[_0x7b9e('0x61')]=qs['sort'](_0x51f2ea[_0x7b9e('0x35')]['sort']);_0x237c4c[_0x7b9e('0x3e')]=qs[_0x7b9e('0x36')](_[_0x7b9e('0x55')](_0x51f2ea['query'],_0x498439[_0x7b9e('0x36')]));if(_0x51f2ea['query'][_0x7b9e('0x3f')]){_0x237c4c[_0x7b9e('0x3e')]=_[_0x7b9e('0x40')](_0x237c4c[_0x7b9e('0x3e')],{'$or':_[_0x7b9e('0x2e')](_0x237c4c['attributes'],function(_0x18f5dd){var _0x30b8ec={};_0x30b8ec[_0x18f5dd]={'$like':'%'+_0x51f2ea['query'][_0x7b9e('0x3f')]+'%'};return _0x30b8ec;})});}_0x237c4c=_[_0x7b9e('0x40')]({},_0x237c4c,_0x51f2ea[_0x7b9e('0x47')]);return _0x5a7701[_0x7b9e('0x86')](_0x237c4c);}})[_0x7b9e('0x25')](function(_0x11aaba){if(_0x11aaba){_0x58d500=_0x11aaba[_0x7b9e('0x3a')];if(!_0x51f2ea[_0x7b9e('0x35')][_0x7b9e('0x3b')](_0x7b9e('0x3c'))){_0x237c4c[_0x7b9e('0x1f')]=qs['limit'](_0x51f2ea[_0x7b9e('0x35')]['limit']);_0x237c4c[_0x7b9e('0x1e')]=qs['offset'](_0x51f2ea[_0x7b9e('0x35')][_0x7b9e('0x1e')]);}return _0x5a7701[_0x7b9e('0x86')](_0x237c4c);}})[_0x7b9e('0x25')](function(_0x1ebf1e){if(_0x1ebf1e){return _0x1ebf1e?{'count':_0x58d500,'rows':_0x1ebf1e}:null;}})[_0x7b9e('0x25')](respondWithResult(_0x51cf85,null))[_0x7b9e('0x49')](handleError(_0x51cf85,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c1ca38b..bb20515 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 _0x7e1c=['MailQueue','save','emit','hook','exports','../../mysqldb'];(function(_0x420922,_0x3ec1c4){var _0x30e7a1=function(_0x28ac4d){while(--_0x28ac4d){_0x420922['push'](_0x420922['shift']());}};_0x30e7a1(++_0x3ec1c4);}(_0x7e1c,0xbf));var _0xc7e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e1c[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xc7e1('0x0'))['db'][_0xc7e1('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc7e1('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1c7555){return function(_0x20037c,_0x383700,_0x138b8d){MailQueueEvents[_0xc7e1('0x3')](_0x1c7555+':'+_0x20037c['id'],_0x20037c);MailQueueEvents[_0xc7e1('0x3')](_0x1c7555,_0x20037c);_0x138b8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xc7e1('0x4')](e,emitEvent(event));}}module[_0xc7e1('0x5')]=MailQueueEvents; \ No newline at end of file +var _0x8533=['../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x41c496,_0x38f5c2){var _0x36595d=function(_0x21c1f9){while(--_0x21c1f9){_0x41c496['push'](_0x41c496['shift']());}};_0x36595d(++_0x38f5c2);}(_0x8533,0xb3));var _0x3853=function(_0x568cfd,_0x324a5f){_0x568cfd=_0x568cfd-0x0;var _0x80d459=_0x8533[_0x568cfd];return _0x80d459;};'use strict';var EventEmitter=require(_0x3853('0x0'));var MailQueue=require(_0x3853('0x1'))['db'][_0x3853('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3853('0x3')](0x0);var events={'afterCreate':_0x3853('0x4'),'afterUpdate':_0x3853('0x5'),'afterDestroy':_0x3853('0x6')};function emitEvent(_0x5c64df){return function(_0x521161,_0x3d3578,_0x39728f){MailQueueEvents[_0x3853('0x7')](_0x5c64df+':'+_0x521161['id'],_0x521161);MailQueueEvents['emit'](_0x5c64df,_0x521161);_0x39728f(null);};}for(var e in events){if(events[_0x3853('0x8')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x3853('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index e22d152..ef45041 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 _0xcb3f=['request-promise','rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','../../config/logger','moment'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0xcb3f,0x1bf));var _0xfcb3=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xcb3f[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xfcb3('0x0'));var util=require('util');var logger=require(_0xfcb3('0x1'))('api');var moment=require(_0xfcb3('0x2'));var BPromise=require('bluebird');var rp=require(_0xfcb3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcb3('0x4'));var config=require('../../config/environment');var attributes=require(_0xfcb3('0x5'));module[_0xfcb3('0x6')]=function(_0x2bf3ea,_0x54c5be){return _0x2bf3ea[_0xfcb3('0x7')](_0xfcb3('0x8'),attributes,{'tableName':_0xfcb3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39be=['rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x410b8a,_0x52ac84){var _0xc0c783=function(_0x21a3b5){while(--_0x21a3b5){_0x410b8a['push'](_0x410b8a['shift']());}};_0xc0c783(++_0x52ac84);}(_0x39be,0x12f));var _0xe39b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x39be[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xe39b('0x0'));var util=require('util');var logger=require(_0xe39b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe39b('0x2'));var rp=require(_0xe39b('0x3'));var fs=require('fs');var path=require(_0xe39b('0x4'));var rimraf=require(_0xe39b('0x5'));var config=require(_0xe39b('0x6'));var attributes=require(_0xe39b('0x7'));module[_0xe39b('0x8')]=function(_0x696ebb,_0x4d708c){return _0x696ebb['define'](_0xe39b('0x9'),attributes,{'tableName':_0xe39b('0xa'),'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 d0aabac..2828b22 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 _0x1bd1=['find','lodash','util','moment','randomstring','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','then','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','MailQueue,\x20%s,\x20%s','info','catch','GetMailQueue','MailQueue','options','raw','where','attributes','include','map','model','stringify','ShowMailQueue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1bd1,0x177));var _0x11bd=function(_0x58885f,_0x98e475){_0x58885f=_0x58885f-0x0;var _0x15b184=_0x1bd1[_0x58885f];return _0x15b184;};'use strict';var _=require(_0x11bd('0x0'));var util=require(_0x11bd('0x1'));var moment=require(_0x11bd('0x2'));var BPromise=require('bluebird');var rs=require(_0x11bd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x11bd('0x4'))('rpc');var config=require(_0x11bd('0x5'));var jayson=require(_0x11bd('0x6'));var client=jayson['client'][_0x11bd('0x7')]({'port':0x232a});config[_0x11bd('0x8')]=_[_0x11bd('0x9')](config[_0x11bd('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x11bd('0xa'))(new Redis(config[_0x11bd('0x8')]));require('./mailQueue.socket')[_0x11bd('0xb')](socket);function respondWithRpcPromise(_0x3aef16,_0x5bc05b,_0x888787){return new BPromise(function(_0x2b5fdc,_0x55d2d1){return client['request'](_0x3aef16,_0x888787)[_0x11bd('0xc')](function(_0x5c09fa){logger['info']('MailQueue,\x20%s,\x20%s',_0x5bc05b,_0x11bd('0xd'));logger[_0x11bd('0xe')](_0x11bd('0xf'),_0x5bc05b,_0x11bd('0xd'),JSON['stringify'](_0x5c09fa));if(_0x5c09fa[_0x11bd('0x10')]){if(_0x5c09fa[_0x11bd('0x10')][_0x11bd('0x11')]===0x1f4){logger[_0x11bd('0x10')]('MailQueue,\x20%s,\x20%s',_0x5bc05b,_0x5c09fa[_0x11bd('0x10')]['message']);return _0x55d2d1(_0x5c09fa[_0x11bd('0x10')][_0x11bd('0x12')]);}logger['error'](_0x11bd('0x13'),_0x5bc05b,_0x5c09fa[_0x11bd('0x10')][_0x11bd('0x12')]);return _0x2b5fdc(_0x5c09fa['error']['message']);}else{logger[_0x11bd('0x14')](_0x11bd('0x13'),_0x5bc05b,_0x11bd('0xd'));_0x2b5fdc(_0x5c09fa['result']['message']);}})[_0x11bd('0x15')](function(_0x46f0b1){logger[_0x11bd('0x10')]('MailQueue,\x20%s,\x20%s',_0x5bc05b,_0x46f0b1);_0x55d2d1(_0x46f0b1);});});}exports[_0x11bd('0x16')]=function(_0x2b6065){var _0x387dcb=this;return new Promise(function(_0x413ad5,_0xeaa4d7){return db[_0x11bd('0x17')]['findAll']({'raw':_0x2b6065[_0x11bd('0x18')]?_0x2b6065[_0x11bd('0x18')][_0x11bd('0x19')]===undefined?!![]:![]:!![],'where':_0x2b6065[_0x11bd('0x18')]?_0x2b6065[_0x11bd('0x18')][_0x11bd('0x1a')]||null:null,'attributes':_0x2b6065[_0x11bd('0x18')]?_0x2b6065['options'][_0x11bd('0x1b')]||null:null,'limit':_0x2b6065[_0x11bd('0x18')]?_0x2b6065[_0x11bd('0x18')]['limit']||null:null,'include':_0x2b6065[_0x11bd('0x18')]?_0x2b6065[_0x11bd('0x18')][_0x11bd('0x1c')]?_[_0x11bd('0x1d')](_0x2b6065[_0x11bd('0x18')]['include'],function(_0x50e98f){return{'model':db[_0x50e98f[_0x11bd('0x1e')]],'as':_0x50e98f['as'],'attributes':_0x50e98f[_0x11bd('0x1b')],'include':_0x50e98f['include']?_[_0x11bd('0x1d')](_0x50e98f['include'],function(_0x2f2f05){return{'model':db[_0x2f2f05[_0x11bd('0x1e')]],'as':_0x2f2f05['as'],'attributes':_0x2f2f05['attributes'],'include':_0x2f2f05[_0x11bd('0x1c')]?_[_0x11bd('0x1d')](_0x2f2f05[_0x11bd('0x1c')],function(_0x5ed529){return{'model':db[_0x5ed529[_0x11bd('0x1e')]],'as':_0x5ed529['as'],'attributes':_0x5ed529['attributes']};}):[]};}):[]};}):[]:[]})[_0x11bd('0xc')](function(_0x212117){logger[_0x11bd('0x14')](_0x11bd('0x16'),_0x2b6065);logger['debug'](_0x11bd('0x16'),_0x2b6065,JSON[_0x11bd('0x1f')](_0x212117));_0x413ad5(_0x212117);})[_0x11bd('0x15')](function(_0x10bfb0){logger[_0x11bd('0x10')](_0x11bd('0x16'),_0x10bfb0['message'],_0x2b6065);_0xeaa4d7(_0x387dcb[_0x11bd('0x10')](0x1f4,_0x10bfb0[_0x11bd('0x12')]));});});};exports[_0x11bd('0x20')]=function(_0x3e3e0f){var _0x255cbc=this;return new Promise(function(_0x554f0f,_0x86ec2){return db[_0x11bd('0x17')][_0x11bd('0x21')]({'raw':_0x3e3e0f['options']?_0x3e3e0f[_0x11bd('0x18')][_0x11bd('0x19')]===undefined?!![]:![]:!![],'where':_0x3e3e0f[_0x11bd('0x18')]?_0x3e3e0f[_0x11bd('0x18')][_0x11bd('0x1a')]||null:null,'attributes':_0x3e3e0f[_0x11bd('0x18')]?_0x3e3e0f[_0x11bd('0x18')][_0x11bd('0x1b')]||null:null,'include':_0x3e3e0f['options']?_0x3e3e0f[_0x11bd('0x18')][_0x11bd('0x1c')]?_['map'](_0x3e3e0f[_0x11bd('0x18')]['include'],function(_0x41205e){return{'model':db[_0x41205e[_0x11bd('0x1e')]],'as':_0x41205e['as'],'attributes':_0x41205e['attributes'],'include':_0x41205e[_0x11bd('0x1c')]?_['map'](_0x41205e[_0x11bd('0x1c')],function(_0x21d9a9){return{'model':db[_0x21d9a9[_0x11bd('0x1e')]],'as':_0x21d9a9['as'],'attributes':_0x21d9a9[_0x11bd('0x1b')],'include':_0x21d9a9['include']?_[_0x11bd('0x1d')](_0x21d9a9['include'],function(_0x5dc746){return{'model':db[_0x5dc746[_0x11bd('0x1e')]],'as':_0x5dc746['as'],'attributes':_0x5dc746['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x48a060){logger[_0x11bd('0x14')](_0x11bd('0x20'),_0x3e3e0f);logger[_0x11bd('0xe')](_0x11bd('0x20'),_0x3e3e0f,JSON[_0x11bd('0x1f')](_0x48a060));_0x554f0f(_0x48a060);})[_0x11bd('0x15')](function(_0x4e2967){logger[_0x11bd('0x10')](_0x11bd('0x20'),_0x4e2967[_0x11bd('0x12')],_0x3e3e0f);_0x86ec2(_0x255cbc[_0x11bd('0x10')](0x1f4,_0x4e2967[_0x11bd('0x12')]));});});}; \ No newline at end of file +var _0xa15f=['map','model','catch','ShowMailQueue','find','where','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetMailQueue','MailQueue','findAll','options','raw','attributes','limit','include'];(function(_0x1fa813,_0xee056b){var _0x1e5b41=function(_0x2af1ac){while(--_0x2af1ac){_0x1fa813['push'](_0x1fa813['shift']());}};_0x1e5b41(++_0xee056b);}(_0xa15f,0xfc));var _0xfa15=function(_0x3a02b1,_0x1fd232){_0x3a02b1=_0x3a02b1-0x0;var _0x17030e=_0xa15f[_0x3a02b1];return _0x17030e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa15('0x0'));var BPromise=require('bluebird');var rs=require(_0xfa15('0x1'));var fs=require('fs');var Redis=require(_0xfa15('0x2'));var db=require(_0xfa15('0x3'))['db'];var utils=require(_0xfa15('0x4'));var logger=require(_0xfa15('0x5'))(_0xfa15('0x6'));var config=require(_0xfa15('0x7'));var jayson=require(_0xfa15('0x8'));var client=jayson[_0xfa15('0x9')][_0xfa15('0xa')]({'port':0x232a});config[_0xfa15('0xb')]=_[_0xfa15('0xc')](config[_0xfa15('0xb')],{'host':_0xfa15('0xd'),'port':0x18eb});var socket=require(_0xfa15('0xe'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xfa15('0xf')](socket);function respondWithRpcPromise(_0x15567c,_0x539de2,_0x4f6697){return new BPromise(function(_0x1c6112,_0x2d99f9){return client[_0xfa15('0x10')](_0x15567c,_0x4f6697)[_0xfa15('0x11')](function(_0xd52446){logger[_0xfa15('0x12')](_0xfa15('0x13'),_0x539de2,'request\x20sent');logger[_0xfa15('0x14')](_0xfa15('0x15'),_0x539de2,_0xfa15('0x16'),JSON[_0xfa15('0x17')](_0xd52446));if(_0xd52446[_0xfa15('0x18')]){if(_0xd52446['error'][_0xfa15('0x19')]===0x1f4){logger[_0xfa15('0x18')](_0xfa15('0x13'),_0x539de2,_0xd52446[_0xfa15('0x18')][_0xfa15('0x1a')]);return _0x2d99f9(_0xd52446[_0xfa15('0x18')][_0xfa15('0x1a')]);}logger[_0xfa15('0x18')](_0xfa15('0x13'),_0x539de2,_0xd52446[_0xfa15('0x18')][_0xfa15('0x1a')]);return _0x1c6112(_0xd52446[_0xfa15('0x18')][_0xfa15('0x1a')]);}else{logger[_0xfa15('0x12')](_0xfa15('0x13'),_0x539de2,_0xfa15('0x16'));_0x1c6112(_0xd52446['result']['message']);}})['catch'](function(_0x426824){logger[_0xfa15('0x18')](_0xfa15('0x13'),_0x539de2,_0x426824);_0x2d99f9(_0x426824);});});}exports[_0xfa15('0x1b')]=function(_0x3c028e){var _0x32e884=this;return new Promise(function(_0x13f2da,_0x494262){return db[_0xfa15('0x1c')][_0xfa15('0x1d')]({'raw':_0x3c028e[_0xfa15('0x1e')]?_0x3c028e[_0xfa15('0x1e')][_0xfa15('0x1f')]===undefined?!![]:![]:!![],'where':_0x3c028e['options']?_0x3c028e[_0xfa15('0x1e')]['where']||null:null,'attributes':_0x3c028e['options']?_0x3c028e[_0xfa15('0x1e')][_0xfa15('0x20')]||null:null,'limit':_0x3c028e[_0xfa15('0x1e')]?_0x3c028e['options'][_0xfa15('0x21')]||null:null,'include':_0x3c028e[_0xfa15('0x1e')]?_0x3c028e[_0xfa15('0x1e')][_0xfa15('0x22')]?_[_0xfa15('0x23')](_0x3c028e['options'][_0xfa15('0x22')],function(_0x113490){return{'model':db[_0x113490['model']],'as':_0x113490['as'],'attributes':_0x113490[_0xfa15('0x20')],'include':_0x113490['include']?_[_0xfa15('0x23')](_0x113490['include'],function(_0x58d2f3){return{'model':db[_0x58d2f3[_0xfa15('0x24')]],'as':_0x58d2f3['as'],'attributes':_0x58d2f3[_0xfa15('0x20')],'include':_0x58d2f3[_0xfa15('0x22')]?_[_0xfa15('0x23')](_0x58d2f3[_0xfa15('0x22')],function(_0x50e84b){return{'model':db[_0x50e84b[_0xfa15('0x24')]],'as':_0x50e84b['as'],'attributes':_0x50e84b['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa15('0x11')](function(_0x298419){logger[_0xfa15('0x12')](_0xfa15('0x1b'),_0x3c028e);logger[_0xfa15('0x14')]('GetMailQueue',_0x3c028e,JSON[_0xfa15('0x17')](_0x298419));_0x13f2da(_0x298419);})[_0xfa15('0x25')](function(_0x58564c){logger[_0xfa15('0x18')](_0xfa15('0x1b'),_0x58564c[_0xfa15('0x1a')],_0x3c028e);_0x494262(_0x32e884[_0xfa15('0x18')](0x1f4,_0x58564c[_0xfa15('0x1a')]));});});};exports[_0xfa15('0x26')]=function(_0x55ea78){var _0x1ab5e1=this;return new Promise(function(_0x5bb946,_0x4e5982){return db[_0xfa15('0x1c')][_0xfa15('0x27')]({'raw':_0x55ea78[_0xfa15('0x1e')]?_0x55ea78[_0xfa15('0x1e')][_0xfa15('0x1f')]===undefined?!![]:![]:!![],'where':_0x55ea78[_0xfa15('0x1e')]?_0x55ea78[_0xfa15('0x1e')][_0xfa15('0x28')]||null:null,'attributes':_0x55ea78['options']?_0x55ea78[_0xfa15('0x1e')][_0xfa15('0x20')]||null:null,'include':_0x55ea78[_0xfa15('0x1e')]?_0x55ea78[_0xfa15('0x1e')][_0xfa15('0x22')]?_[_0xfa15('0x23')](_0x55ea78['options'][_0xfa15('0x22')],function(_0xd3a10){return{'model':db[_0xd3a10[_0xfa15('0x24')]],'as':_0xd3a10['as'],'attributes':_0xd3a10[_0xfa15('0x20')],'include':_0xd3a10[_0xfa15('0x22')]?_['map'](_0xd3a10['include'],function(_0x48f33b){return{'model':db[_0x48f33b[_0xfa15('0x24')]],'as':_0x48f33b['as'],'attributes':_0x48f33b['attributes'],'include':_0x48f33b[_0xfa15('0x22')]?_['map'](_0x48f33b[_0xfa15('0x22')],function(_0x3f742c){return{'model':db[_0x3f742c[_0xfa15('0x24')]],'as':_0x3f742c['as'],'attributes':_0x3f742c[_0xfa15('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1142ef){logger[_0xfa15('0x12')](_0xfa15('0x26'),_0x55ea78);logger['debug']('ShowMailQueue',_0x55ea78,JSON[_0xfa15('0x17')](_0x1142ef));_0x5bb946(_0x1142ef);})[_0xfa15('0x25')](function(_0x4fd175){logger['error']('ShowMailQueue',_0x4fd175[_0xfa15('0x1a')],_0x55ea78);_0x4e5982(_0x1ab5e1[_0xfa15('0x18')](0x1f4,_0x4fd175[_0xfa15('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index e16f277..949bdf1 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 _0xa409=['save','removeListener','length','mailQueue:'];(function(_0x447b21,_0x4c1c3c){var _0x1a43e8=function(_0x174d44){while(--_0x174d44){_0x447b21['push'](_0x447b21['shift']());}};_0x1a43e8(++_0x4c1c3c);}(_0xa409,0xf8));var _0x9a40=function(_0x3692c2,_0x21116a){_0x3692c2=_0x3692c2-0x0;var _0x394483=_0xa409[_0x3692c2];return _0x394483;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x9a40('0x0'),'remove','update'];function createListener(_0x236e24,_0x392f32){return function(_0x3bfb30){_0x392f32['emit'](_0x236e24,_0x3bfb30);};}function removeListener(_0x56915f,_0x5840fb){return function(){MailQueueEvents[_0x9a40('0x1')](_0x56915f,_0x5840fb);};}exports['register']=function(_0x397372){for(var _0x9d4009=0x0,_0x2a0c6e=events[_0x9a40('0x2')];_0x9d4009<_0x2a0c6e;_0x9d4009++){var _0x8cbe30=events[_0x9d4009];var _0x3fb1f0=createListener(_0x9a40('0x3')+_0x8cbe30,_0x397372);MailQueueEvents['on'](_0x8cbe30,_0x3fb1f0);}}; \ No newline at end of file +var _0x5007=['update','emit','removeListener','register','length','./mailQueue.events','save','remove'];(function(_0x5dee87,_0x320064){var _0x5483f0=function(_0x549bcd){while(--_0x549bcd){_0x5dee87['push'](_0x5dee87['shift']());}};_0x5483f0(++_0x320064);}(_0x5007,0x7d));var _0x7500=function(_0x2cab56,_0x3a3fe5){_0x2cab56=_0x2cab56-0x0;var _0x2145fe=_0x5007[_0x2cab56];return _0x2145fe;};'use strict';var MailQueueEvents=require(_0x7500('0x0'));var events=[_0x7500('0x1'),_0x7500('0x2'),_0x7500('0x3')];function createListener(_0x4f8c68,_0xe1669e){return function(_0x2e6f77){_0xe1669e[_0x7500('0x4')](_0x4f8c68,_0x2e6f77);};}function removeListener(_0xf86acb,_0x39ed17){return function(){MailQueueEvents[_0x7500('0x5')](_0xf86acb,_0x39ed17);};}exports[_0x7500('0x6')]=function(_0x59bb4f){for(var _0x145630=0x0,_0x337cc1=events[_0x7500('0x7')];_0x145630<_0x337cc1;_0x145630++){var _0x44d64c=events[_0x145630];var _0x1c8e5a=createListener('mailQueue:'+_0x44d64c,_0x59bb4f);MailQueueEvents['on'](_0x44d64c,_0x1c8e5a);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index a51c289..f8ecafe 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 _0x02b6=['describe','/:id','show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x02b6,0x115));var _0x602b=function(_0x5ec4f4,_0x4d39bf){_0x5ec4f4=_0x5ec4f4-0x0;var _0x220187=_0x02b6[_0x5ec4f4];return _0x220187;};'use strict';var multer=require(_0x602b('0x0'));var util=require(_0x602b('0x1'));var path=require(_0x602b('0x2'));var timeout=require(_0x602b('0x3'));var express=require(_0x602b('0x4'));var router=express[_0x602b('0x5')]();var auth=require(_0x602b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x602b('0x7'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x602b('0x8')](),controller[_0x602b('0x9')]);router[_0x602b('0xa')]('/describe',auth[_0x602b('0x8')](),controller[_0x602b('0xb')]);router['get'](_0x602b('0xc'),auth[_0x602b('0x8')](),controller[_0x602b('0xd')]);router['post']('/',auth[_0x602b('0x8')](),controller['create']);router[_0x602b('0xe')](_0x602b('0xc'),auth[_0x602b('0x8')](),controller[_0x602b('0xf')]);router[_0x602b('0x10')](_0x602b('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x602b('0x11')]=router; \ No newline at end of file +var _0xaecf=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','create','put','/:id','update','delete'];(function(_0x5939b8,_0x25217a){var _0x49e667=function(_0x1c78eb){while(--_0x1c78eb){_0x5939b8['push'](_0x5939b8['shift']());}};_0x49e667(++_0x25217a);}(_0xaecf,0x6b));var _0xfaec=function(_0x3abd58,_0x17fff6){_0x3abd58=_0x3abd58-0x0;var _0x45d8fe=_0xaecf[_0x3abd58];return _0x45d8fe;};'use strict';var multer=require(_0xfaec('0x0'));var util=require(_0xfaec('0x1'));var path=require(_0xfaec('0x2'));var timeout=require(_0xfaec('0x3'));var express=require(_0xfaec('0x4'));var router=express['Router']();var auth=require(_0xfaec('0x5'));var interaction=require(_0xfaec('0x6'));var config=require(_0xfaec('0x7'));var controller=require(_0xfaec('0x8'));router[_0xfaec('0x9')]('/',auth['isAuthenticated'](),controller[_0xfaec('0xa')]);router[_0xfaec('0x9')](_0xfaec('0xb'),auth[_0xfaec('0xc')](),controller[_0xfaec('0xd')]);router[_0xfaec('0x9')]('/:id',auth[_0xfaec('0xc')](),controller['show']);router['post']('/',auth[_0xfaec('0xc')](),controller[_0xfaec('0xe')]);router[_0xfaec('0xf')](_0xfaec('0x10'),auth[_0xfaec('0xc')](),controller[_0xfaec('0x11')]);router[_0xfaec('0x12')](_0xfaec('0x10'),auth[_0xfaec('0xc')](),controller[_0xfaec('0x13')]);module[_0xfaec('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index ee032dc..0ee2bf5 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 _0xc6e2=['sequelize','STRING','DATE','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6e2,0xaf));var _0x2c6e=function(_0x361610,_0x43f725){_0x361610=_0x361610-0x0;var _0x8d6321=_0xc6e2[_0x361610];return _0x8d6321;};'use strict';var moment=require(_0x2c6e('0x0'));var Sequelize=require(_0x2c6e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x2c6e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2c6e('0x2')]},'joinAt':{'type':Sequelize[_0x2c6e('0x3')]},'leaveAt':{'type':Sequelize[_0x2c6e('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x2c6e('0x2')]}}; \ No newline at end of file +var _0x118c=['STRING','DATE','moment','exports'];(function(_0x52d032,_0x568ed5){var _0x34e6c5=function(_0x809326){while(--_0x809326){_0x52d032['push'](_0x52d032['shift']());}};_0x34e6c5(++_0x568ed5);}(_0x118c,0x9e));var _0xc118=function(_0x4f35ec,_0x840f6e){_0x4f35ec=_0x4f35ec-0x0;var _0x111757=_0x118c[_0x4f35ec];return _0x111757;};'use strict';var moment=require(_0xc118('0x0'));var Sequelize=require('sequelize');module[_0xc118('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc118('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc118('0x3')]},'acceptAt':{'type':Sequelize[_0xc118('0x3')]},'exitAt':{'type':Sequelize[_0xc118('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 9ae0b90..30c8005 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 _0x22cd=['set','Content-Range','save','update','then','destroy','stack','name','send','index','map','MailQueueReport','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','count','offset','limit','status'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x22cd,0x74));var _0xd22c=function(_0x3f2ecf,_0x4ccad6){_0x3f2ecf=_0x3f2ecf-0x0;var _0xa6dd7e=_0x22cd[_0x3f2ecf];return _0xa6dd7e;};'use strict';var pdf=require(_0xd22c('0x0'));var emlformat=require(_0xd22c('0x1'));var rimraf=require(_0xd22c('0x2'));var zipdir=require(_0xd22c('0x3'));var jsonpatch=require(_0xd22c('0x4'));var rp=require(_0xd22c('0x5'));var moment=require('moment');var BPromise=require(_0xd22c('0x6'));var Mustache=require('mustache');var util=require(_0xd22c('0x7'));var path=require(_0xd22c('0x8'));var sox=require(_0xd22c('0x9'));var csv=require(_0xd22c('0xa'));var ejs=require(_0xd22c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd22c('0xc'));var crypto=require(_0xd22c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd22c('0xe'));var toCsv=require(_0xd22c('0xa'));var querystring=require(_0xd22c('0xf'));var Papa=require(_0xd22c('0x10'));var Redis=require(_0xd22c('0x11'));var authService=require(_0xd22c('0x12'));var qs=require(_0xd22c('0x13'));var as=require(_0xd22c('0x14'));var hardwareService=require(_0xd22c('0x15'));var logger=require(_0xd22c('0x16'))(_0xd22c('0x17'));var utils=require(_0xd22c('0x18'));var config=require(_0xd22c('0x19'));var licenseUtil=require(_0xd22c('0x1a'));var db=require(_0xd22c('0x1b'))['db'];function respondWithStatusCode(_0x5561cc,_0x3910fb){_0x3910fb=_0x3910fb||0xcc;return function(_0x1358c5){if(_0x1358c5){return _0x5561cc[_0xd22c('0x1c')](_0x3910fb);}return _0x5561cc['status'](_0x3910fb)['end']();};}function respondWithResult(_0x368a26,_0x495679){_0x495679=_0x495679||0xc8;return function(_0x30314a){if(_0x30314a){return _0x368a26['status'](_0x495679)[_0xd22c('0x1d')](_0x30314a);}};}function respondWithFilteredResult(_0x2a65b4,_0x5711d0){return function(_0x2c85bc){if(_0x2c85bc){var _0x2aac66=_0x2c85bc[_0xd22c('0x1e')],_0x5ed75a=_0x5711d0[_0xd22c('0x1f')],_0x289cc7=_0x5711d0[_0xd22c('0x1f')]+_0x5711d0[_0xd22c('0x20')],_0x1118ed;if(_0x289cc7>=_0x2aac66){_0x289cc7=_0x2aac66;_0x1118ed=0xc8;}else{_0x1118ed=0xce;}_0x2a65b4[_0xd22c('0x21')](_0x1118ed);return _0x2a65b4[_0xd22c('0x22')](_0xd22c('0x23'),_0x5ed75a+'-'+_0x289cc7+'/'+_0x2aac66)[_0xd22c('0x1d')](_0x2c85bc);}return null;};}function patchUpdates(_0x50d20c){return function(_0x4c297f){try{jsonpatch['apply'](_0x4c297f,_0x50d20c,!![]);}catch(_0x305f6f){return BPromise['reject'](_0x305f6f);}return _0x4c297f[_0xd22c('0x24')]();};}function saveUpdates(_0x5b0d73,_0x14b31d){return function(_0x39c3cd){if(_0x39c3cd){return _0x39c3cd[_0xd22c('0x25')](_0x5b0d73)[_0xd22c('0x26')](function(_0x7a45d5){return _0x7a45d5;});}return null;};}function removeEntity(_0x1c33ef,_0x5b49b7){return function(_0x3f380f){if(_0x3f380f){return _0x3f380f[_0xd22c('0x27')]()[_0xd22c('0x26')](function(){_0x1c33ef[_0xd22c('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x348ea8,_0x3038ce){return function(_0x37b73f){if(!_0x37b73f){_0x348ea8['sendStatus'](0x194);}return _0x37b73f;};}function handleError(_0x370d93,_0x692b18){_0x692b18=_0x692b18||0x1f4;return function(_0x1001ac){logger['error'](_0x1001ac[_0xd22c('0x28')]);if(_0x1001ac['name']){delete _0x1001ac[_0xd22c('0x29')];}_0x370d93[_0xd22c('0x21')](_0x692b18)[_0xd22c('0x2a')](_0x1001ac);};}exports[_0xd22c('0x2b')]=function(_0x15e10d,_0x1f7baf){var _0x20a36e={},_0x5a35b3={},_0x1636e2={'count':0x0,'rows':[]};var _0x24da31=_[_0xd22c('0x2c')](db[_0xd22c('0x2d')]['rawAttributes'],function(_0x322f83){return{'name':_0x322f83[_0xd22c('0x2e')],'type':_0x322f83[_0xd22c('0x2f')][_0xd22c('0x30')]};});_0x5a35b3[_0xd22c('0x31')]=_['map'](_0x24da31,'name');_0x5a35b3['query']=_['keys'](_0x15e10d[_0xd22c('0x32')]);_0x5a35b3['filters']=_[_0xd22c('0x33')](_0x5a35b3['model'],_0x5a35b3['query']);_0x20a36e[_0xd22c('0x34')]=_[_0xd22c('0x33')](_0x5a35b3[_0xd22c('0x31')],qs[_0xd22c('0x35')](_0x15e10d[_0xd22c('0x32')][_0xd22c('0x35')]));_0x20a36e[_0xd22c('0x34')]=_0x20a36e['attributes'][_0xd22c('0x36')]?_0x20a36e['attributes']:_0x5a35b3[_0xd22c('0x31')];if(!_0x15e10d['query'][_0xd22c('0x37')]('nolimit')){_0x20a36e[_0xd22c('0x20')]=qs[_0xd22c('0x20')](_0x15e10d[_0xd22c('0x32')]['limit']);_0x20a36e[_0xd22c('0x1f')]=qs[_0xd22c('0x1f')](_0x15e10d[_0xd22c('0x32')][_0xd22c('0x1f')]);}_0x20a36e[_0xd22c('0x38')]=qs[_0xd22c('0x39')](_0x15e10d['query']['sort']);_0x20a36e[_0xd22c('0x3a')]=qs[_0xd22c('0x3b')](_['pick'](_0x15e10d[_0xd22c('0x32')],_0x5a35b3[_0xd22c('0x3b')]),_0x24da31);if(_0x15e10d[_0xd22c('0x32')][_0xd22c('0x3c')]){_0x20a36e[_0xd22c('0x3a')]=_['merge'](_0x20a36e[_0xd22c('0x3a')],{'$or':_[_0xd22c('0x2c')](_0x24da31,function(_0x34b919){if(_0x34b919['type']!=='VIRTUAL'){var _0x3d2189={};_0x3d2189[_0x34b919[_0xd22c('0x29')]]={'$like':'%'+_0x15e10d['query'][_0xd22c('0x3c')]+'%'};return _0x3d2189;}})});}_0x20a36e=_[_0xd22c('0x3d')]({},_0x20a36e,_0x15e10d['options']);var _0x16c4fa={'where':_0x20a36e[_0xd22c('0x3a')]};return db['MailQueueReport'][_0xd22c('0x1e')](_0x16c4fa)['then'](function(_0x257360){_0x1636e2[_0xd22c('0x1e')]=_0x257360;if(_0x15e10d[_0xd22c('0x32')][_0xd22c('0x3e')]){_0x20a36e['include']=[{'all':!![]}];}return db[_0xd22c('0x2d')][_0xd22c('0x3f')](_0x20a36e);})[_0xd22c('0x26')](function(_0x42b8d3){_0x1636e2[_0xd22c('0x40')]=_0x42b8d3;return _0x1636e2;})[_0xd22c('0x26')](respondWithFilteredResult(_0x1f7baf,_0x20a36e))[_0xd22c('0x41')](handleError(_0x1f7baf,null));};exports[_0xd22c('0x42')]=function(_0x5bd1c1,_0xf68122){var _0x1e3e20={'raw':!![],'where':{'id':_0x5bd1c1[_0xd22c('0x43')]['id']}},_0x54de1a={};_0x54de1a[_0xd22c('0x31')]=_[_0xd22c('0x44')](db['MailQueueReport'][_0xd22c('0x45')]);_0x54de1a[_0xd22c('0x32')]=_[_0xd22c('0x44')](_0x5bd1c1[_0xd22c('0x32')]);_0x54de1a[_0xd22c('0x3b')]=_[_0xd22c('0x33')](_0x54de1a['model'],_0x54de1a[_0xd22c('0x32')]);_0x1e3e20[_0xd22c('0x34')]=_[_0xd22c('0x33')](_0x54de1a['model'],qs[_0xd22c('0x35')](_0x5bd1c1[_0xd22c('0x32')][_0xd22c('0x35')]));_0x1e3e20[_0xd22c('0x34')]=_0x1e3e20['attributes'][_0xd22c('0x36')]?_0x1e3e20[_0xd22c('0x34')]:_0x54de1a[_0xd22c('0x31')];if(_0x5bd1c1[_0xd22c('0x32')][_0xd22c('0x3e')]){_0x1e3e20['include']=[{'all':!![]}];}_0x1e3e20=_[_0xd22c('0x3d')]({},_0x1e3e20,_0x5bd1c1[_0xd22c('0x46')]);return db[_0xd22c('0x2d')][_0xd22c('0x47')](_0x1e3e20)[_0xd22c('0x26')](handleEntityNotFound(_0xf68122,null))[_0xd22c('0x26')](respondWithResult(_0xf68122,null))[_0xd22c('0x41')](handleError(_0xf68122,null));};exports[_0xd22c('0x48')]=function(_0x91bec5,_0x2c966a){return db[_0xd22c('0x2d')][_0xd22c('0x48')](_0x91bec5['body'],{})[_0xd22c('0x26')](respondWithResult(_0x2c966a,0xc9))[_0xd22c('0x41')](handleError(_0x2c966a,null));};exports[_0xd22c('0x25')]=function(_0x19c49d,_0x202e35){if(_0x19c49d[_0xd22c('0x49')]['id']){delete _0x19c49d['body']['id'];}return db[_0xd22c('0x2d')][_0xd22c('0x47')]({'where':{'id':_0x19c49d[_0xd22c('0x43')]['id']}})[_0xd22c('0x26')](handleEntityNotFound(_0x202e35,null))[_0xd22c('0x26')](saveUpdates(_0x19c49d[_0xd22c('0x49')],null))[_0xd22c('0x26')](respondWithResult(_0x202e35,null))[_0xd22c('0x41')](handleError(_0x202e35,null));};exports[_0xd22c('0x27')]=function(_0x4791b7,_0x112c6f){return db['MailQueueReport']['find']({'where':{'id':_0x4791b7[_0xd22c('0x43')]['id']}})[_0xd22c('0x26')](handleEntityNotFound(_0x112c6f,null))[_0xd22c('0x26')](removeEntity(_0x112c6f,null))[_0xd22c('0x41')](handleError(_0x112c6f,null));};exports[_0xd22c('0x4a')]=function(_0x2337e3,_0x4096d4){return db['MailQueueReport'][_0xd22c('0x4a')]()[_0xd22c('0x26')](respondWithResult(_0x4096d4,null))[_0xd22c('0x41')](handleError(_0x4096d4,null));}; \ No newline at end of file +var _0x9173=['params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','end','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','MailQueueReport','includeAll','include','rows','catch','show','rawAttributes','intersection','find','create','body','update'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x9173,0x12a));var _0x3917=function(_0x2b048e,_0x5abd64){_0x2b048e=_0x2b048e-0x0;var _0x2f5d57=_0x9173[_0x2b048e];return _0x2f5d57;};'use strict';var pdf=require(_0x3917('0x0'));var emlformat=require(_0x3917('0x1'));var rimraf=require(_0x3917('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3917('0x3'));var rp=require(_0x3917('0x4'));var moment=require(_0x3917('0x5'));var BPromise=require(_0x3917('0x6'));var Mustache=require(_0x3917('0x7'));var util=require(_0x3917('0x8'));var path=require(_0x3917('0x9'));var sox=require(_0x3917('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3917('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3917('0xc'));var deskjs=require(_0x3917('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3917('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3917('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3917('0x10'));var hardwareService=require(_0x3917('0x11'));var logger=require(_0x3917('0x12'))('api');var utils=require(_0x3917('0x13'));var config=require(_0x3917('0x14'));var licenseUtil=require(_0x3917('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x518268,_0x36f2cb){_0x36f2cb=_0x36f2cb||0xcc;return function(_0x365326){if(_0x365326){return _0x518268[_0x3917('0x16')](_0x36f2cb);}return _0x518268[_0x3917('0x17')](_0x36f2cb)['end']();};}function respondWithResult(_0x224a9e,_0x1225a1){_0x1225a1=_0x1225a1||0xc8;return function(_0x297788){if(_0x297788){return _0x224a9e[_0x3917('0x17')](_0x1225a1)[_0x3917('0x18')](_0x297788);}};}function respondWithFilteredResult(_0x480c53,_0x3c61c4){return function(_0x2b3747){if(_0x2b3747){var _0x5a3fcb=_0x2b3747[_0x3917('0x19')],_0x5c5112=_0x3c61c4[_0x3917('0x1a')],_0x2bd70d=_0x3c61c4[_0x3917('0x1a')]+_0x3c61c4[_0x3917('0x1b')],_0x1a0ae9;if(_0x2bd70d>=_0x5a3fcb){_0x2bd70d=_0x5a3fcb;_0x1a0ae9=0xc8;}else{_0x1a0ae9=0xce;}_0x480c53[_0x3917('0x17')](_0x1a0ae9);return _0x480c53[_0x3917('0x1c')]('Content-Range',_0x5c5112+'-'+_0x2bd70d+'/'+_0x5a3fcb)['json'](_0x2b3747);}return null;};}function patchUpdates(_0x4db7c7){return function(_0x3a524c){try{jsonpatch[_0x3917('0x1d')](_0x3a524c,_0x4db7c7,!![]);}catch(_0x41c267){return BPromise[_0x3917('0x1e')](_0x41c267);}return _0x3a524c[_0x3917('0x1f')]();};}function saveUpdates(_0x28b697,_0x576453){return function(_0x3978bf){if(_0x3978bf){return _0x3978bf['update'](_0x28b697)[_0x3917('0x20')](function(_0x5bb9c8){return _0x5bb9c8;});}return null;};}function removeEntity(_0x3e478d,_0x51bc63){return function(_0x72a39e){if(_0x72a39e){return _0x72a39e[_0x3917('0x21')]()[_0x3917('0x20')](function(){_0x3e478d['status'](0xcc)[_0x3917('0x22')]();});}};}function handleEntityNotFound(_0x239c13,_0x427468){return function(_0x1571b9){if(!_0x1571b9){_0x239c13[_0x3917('0x16')](0x194);}return _0x1571b9;};}function handleError(_0x4f7944,_0x2d66a3){_0x2d66a3=_0x2d66a3||0x1f4;return function(_0x52125c){logger[_0x3917('0x23')](_0x52125c[_0x3917('0x24')]);if(_0x52125c[_0x3917('0x25')]){delete _0x52125c[_0x3917('0x25')];}_0x4f7944[_0x3917('0x17')](_0x2d66a3)[_0x3917('0x26')](_0x52125c);};}exports['index']=function(_0x3adc77,_0x3303b2){var _0x4bb7d9={},_0x19f517={},_0x2d4efe={'count':0x0,'rows':[]};var _0x42dd0c=_[_0x3917('0x27')](db['MailQueueReport']['rawAttributes'],function(_0x5c101d){return{'name':_0x5c101d[_0x3917('0x28')],'type':_0x5c101d[_0x3917('0x29')][_0x3917('0x2a')]};});_0x19f517[_0x3917('0x2b')]=_[_0x3917('0x27')](_0x42dd0c,_0x3917('0x25'));_0x19f517[_0x3917('0x2c')]=_[_0x3917('0x2d')](_0x3adc77[_0x3917('0x2c')]);_0x19f517[_0x3917('0x2e')]=_['intersection'](_0x19f517[_0x3917('0x2b')],_0x19f517[_0x3917('0x2c')]);_0x4bb7d9[_0x3917('0x2f')]=_['intersection'](_0x19f517[_0x3917('0x2b')],qs[_0x3917('0x30')](_0x3adc77['query'][_0x3917('0x30')]));_0x4bb7d9['attributes']=_0x4bb7d9[_0x3917('0x2f')][_0x3917('0x31')]?_0x4bb7d9[_0x3917('0x2f')]:_0x19f517[_0x3917('0x2b')];if(!_0x3adc77[_0x3917('0x2c')][_0x3917('0x32')](_0x3917('0x33'))){_0x4bb7d9[_0x3917('0x1b')]=qs[_0x3917('0x1b')](_0x3adc77[_0x3917('0x2c')][_0x3917('0x1b')]);_0x4bb7d9[_0x3917('0x1a')]=qs[_0x3917('0x1a')](_0x3adc77[_0x3917('0x2c')][_0x3917('0x1a')]);}_0x4bb7d9[_0x3917('0x34')]=qs[_0x3917('0x35')](_0x3adc77[_0x3917('0x2c')][_0x3917('0x35')]);_0x4bb7d9['where']=qs['filters'](_[_0x3917('0x36')](_0x3adc77[_0x3917('0x2c')],_0x19f517['filters']),_0x42dd0c);if(_0x3adc77[_0x3917('0x2c')]['filter']){_0x4bb7d9[_0x3917('0x37')]=_[_0x3917('0x38')](_0x4bb7d9[_0x3917('0x37')],{'$or':_['map'](_0x42dd0c,function(_0xe5412){if(_0xe5412['type']!==_0x3917('0x39')){var _0x4e35a2={};_0x4e35a2[_0xe5412[_0x3917('0x25')]]={'$like':'%'+_0x3adc77[_0x3917('0x2c')][_0x3917('0x3a')]+'%'};return _0x4e35a2;}})});}_0x4bb7d9=_[_0x3917('0x38')]({},_0x4bb7d9,_0x3adc77[_0x3917('0x3b')]);var _0x1ac6d9={'where':_0x4bb7d9[_0x3917('0x37')]};return db[_0x3917('0x3c')][_0x3917('0x19')](_0x1ac6d9)[_0x3917('0x20')](function(_0x132a58){_0x2d4efe[_0x3917('0x19')]=_0x132a58;if(_0x3adc77[_0x3917('0x2c')][_0x3917('0x3d')]){_0x4bb7d9[_0x3917('0x3e')]=[{'all':!![]}];}return db[_0x3917('0x3c')]['findAll'](_0x4bb7d9);})[_0x3917('0x20')](function(_0x40bc66){_0x2d4efe[_0x3917('0x3f')]=_0x40bc66;return _0x2d4efe;})[_0x3917('0x20')](respondWithFilteredResult(_0x3303b2,_0x4bb7d9))[_0x3917('0x40')](handleError(_0x3303b2,null));};exports[_0x3917('0x41')]=function(_0x55da26,_0x35e8dd){var _0x39c36e={'raw':!![],'where':{'id':_0x55da26['params']['id']}},_0x41e9ec={};_0x41e9ec['model']=_[_0x3917('0x2d')](db[_0x3917('0x3c')][_0x3917('0x42')]);_0x41e9ec[_0x3917('0x2c')]=_[_0x3917('0x2d')](_0x55da26[_0x3917('0x2c')]);_0x41e9ec['filters']=_['intersection'](_0x41e9ec['model'],_0x41e9ec[_0x3917('0x2c')]);_0x39c36e['attributes']=_[_0x3917('0x43')](_0x41e9ec[_0x3917('0x2b')],qs[_0x3917('0x30')](_0x55da26[_0x3917('0x2c')][_0x3917('0x30')]));_0x39c36e['attributes']=_0x39c36e[_0x3917('0x2f')][_0x3917('0x31')]?_0x39c36e[_0x3917('0x2f')]:_0x41e9ec[_0x3917('0x2b')];if(_0x55da26[_0x3917('0x2c')][_0x3917('0x3d')]){_0x39c36e[_0x3917('0x3e')]=[{'all':!![]}];}_0x39c36e=_['merge']({},_0x39c36e,_0x55da26[_0x3917('0x3b')]);return db[_0x3917('0x3c')][_0x3917('0x44')](_0x39c36e)[_0x3917('0x20')](handleEntityNotFound(_0x35e8dd,null))['then'](respondWithResult(_0x35e8dd,null))[_0x3917('0x40')](handleError(_0x35e8dd,null));};exports[_0x3917('0x45')]=function(_0x25601c,_0x14fe9b){return db['MailQueueReport'][_0x3917('0x45')](_0x25601c[_0x3917('0x46')],{})[_0x3917('0x20')](respondWithResult(_0x14fe9b,0xc9))[_0x3917('0x40')](handleError(_0x14fe9b,null));};exports[_0x3917('0x47')]=function(_0x281fbf,_0x358a11){if(_0x281fbf[_0x3917('0x46')]['id']){delete _0x281fbf[_0x3917('0x46')]['id'];}return db[_0x3917('0x3c')]['find']({'where':{'id':_0x281fbf['params']['id']}})[_0x3917('0x20')](handleEntityNotFound(_0x358a11,null))[_0x3917('0x20')](saveUpdates(_0x281fbf['body'],null))[_0x3917('0x20')](respondWithResult(_0x358a11,null))[_0x3917('0x40')](handleError(_0x358a11,null));};exports[_0x3917('0x21')]=function(_0x2819c7,_0x1eab2d){return db[_0x3917('0x3c')][_0x3917('0x44')]({'where':{'id':_0x2819c7[_0x3917('0x48')]['id']}})[_0x3917('0x20')](handleEntityNotFound(_0x1eab2d,null))['then'](removeEntity(_0x1eab2d,null))[_0x3917('0x40')](handleError(_0x1eab2d,null));};exports[_0x3917('0x49')]=function(_0x138895,_0x2dbc25){return db[_0x3917('0x3c')]['describe']()[_0x3917('0x20')](respondWithResult(_0x2dbc25,null))['catch'](handleError(_0x2dbc25,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index aee890e..ad2322e 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 _0xc495=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xc495,0x1e0));var _0x5c49=function(_0x14bc8a,_0x398bbd){_0x14bc8a=_0x14bc8a-0x0;var _0x13c384=_0xc495[_0x14bc8a];return _0x13c384;};'use strict';var _=require(_0x5c49('0x0'));var util=require(_0x5c49('0x1'));var logger=require(_0x5c49('0x2'))(_0x5c49('0x3'));var moment=require(_0x5c49('0x4'));var BPromise=require(_0x5c49('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c49('0x6'));var rimraf=require('rimraf');var config=require(_0x5c49('0x7'));var attributes=require(_0x5c49('0x8'));module[_0x5c49('0x9')]=function(_0x44f638,_0x1dfc85){return _0x44f638[_0x5c49('0xa')](_0x5c49('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x5c49('0xc'),'fields':[_0x5c49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe953=['define','MailQueueReport','uniqueid','lodash','util','api','bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xe953,0xc9));var _0x3e95=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0xe953[_0x318840];return _0x223da4;};'use strict';var _=require(_0x3e95('0x0'));var util=require(_0x3e95('0x1'));var logger=require('../../config/logger')(_0x3e95('0x2'));var moment=require('moment');var BPromise=require(_0x3e95('0x3'));var rp=require(_0x3e95('0x4'));var fs=require('fs');var path=require(_0x3e95('0x5'));var rimraf=require('rimraf');var config=require(_0x3e95('0x6'));var attributes=require(_0x3e95('0x7'));module['exports']=function(_0x515728,_0x2f62de){return _0x515728[_0x3e95('0x8')](_0x3e95('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x3e95('0xa'),'fields':[_0x3e95('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index c86586c..51b8620 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 _0xf885=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateMailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','where','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x418044,_0xf49cf9){var _0x2c4246=function(_0x21e38b){while(--_0x21e38b){_0x418044['push'](_0x418044['shift']());}};_0x2c4246(++_0xf49cf9);}(_0xf885,0xa9));var _0x5f88=function(_0x3f5210,_0x32f195){_0x3f5210=_0x3f5210-0x0;var _0x53c3ab=_0xf885[_0x3f5210];return _0x53c3ab;};'use strict';var _=require(_0x5f88('0x0'));var util=require('util');var moment=require(_0x5f88('0x1'));var BPromise=require(_0x5f88('0x2'));var rs=require(_0x5f88('0x3'));var fs=require('fs');var Redis=require(_0x5f88('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f88('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5f88('0x6'));var jayson=require(_0x5f88('0x7'));var client=jayson[_0x5f88('0x8')][_0x5f88('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ee068,_0x2e9d87,_0x23aa88){return new BPromise(function(_0x1bedbd,_0x4d2734){return client[_0x5f88('0xa')](_0x4ee068,_0x23aa88)[_0x5f88('0xb')](function(_0x31222b){logger[_0x5f88('0xc')](_0x5f88('0xd'),_0x2e9d87,_0x5f88('0xe'));logger[_0x5f88('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x2e9d87,'request\x20sent',JSON[_0x5f88('0x10')](_0x31222b));if(_0x31222b['error']){if(_0x31222b[_0x5f88('0x11')]['code']===0x1f4){logger[_0x5f88('0x11')]('MailQueueReport,\x20%s,\x20%s',_0x2e9d87,_0x31222b[_0x5f88('0x11')]['message']);return _0x4d2734(_0x31222b[_0x5f88('0x11')][_0x5f88('0x12')]);}logger[_0x5f88('0x11')](_0x5f88('0xd'),_0x2e9d87,_0x31222b['error'][_0x5f88('0x12')]);return _0x1bedbd(_0x31222b['error'][_0x5f88('0x12')]);}else{logger['info'](_0x5f88('0xd'),_0x2e9d87,_0x5f88('0xe'));_0x1bedbd(_0x31222b[_0x5f88('0x13')][_0x5f88('0x12')]);}})[_0x5f88('0x14')](function(_0x202503){logger[_0x5f88('0x11')](_0x5f88('0xd'),_0x2e9d87,_0x202503);_0x4d2734(_0x202503);});});}exports[_0x5f88('0x15')]=function(_0x1f2ec4){var _0xc9d15f=this;return new Promise(function(_0x3fd5bd,_0x50ae16){return db['MailQueueReport'][_0x5f88('0x16')](_0x1f2ec4[_0x5f88('0x17')],{'raw':_0x1f2ec4[_0x5f88('0x18')]?_0x1f2ec4[_0x5f88('0x18')][_0x5f88('0x19')]===undefined?!![]:![]:!![]})[_0x5f88('0xb')](function(_0x290e39){logger[_0x5f88('0xc')]('CreateMailQueueReport',_0x1f2ec4);logger[_0x5f88('0xf')](_0x5f88('0x15'),_0x1f2ec4,JSON[_0x5f88('0x10')](_0x290e39));_0x3fd5bd(_0x290e39);})[_0x5f88('0x14')](function(_0x5a7d0b){logger[_0x5f88('0x11')]('CreateMailQueueReport',_0x5a7d0b['message'],_0x1f2ec4);_0x50ae16(_0xc9d15f[_0x5f88('0x11')](0x1f4,_0x5a7d0b[_0x5f88('0x12')]));});});};exports[_0x5f88('0x1a')]=function(_0x49d76c){var _0x40044f=this;return new Promise(function(_0x138d92,_0x152968){return db['MailQueueReport'][_0x5f88('0x1b')](_0x49d76c[_0x5f88('0x17')],{'raw':_0x49d76c[_0x5f88('0x18')]?_0x49d76c[_0x5f88('0x18')][_0x5f88('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49d76c[_0x5f88('0x18')]?_0x49d76c[_0x5f88('0x18')][_0x5f88('0x1c')]||null:null,'attributes':_0x49d76c[_0x5f88('0x18')]?_0x49d76c[_0x5f88('0x18')]['attributes']||null:null,'limit':_0x49d76c[_0x5f88('0x18')]?_0x49d76c[_0x5f88('0x18')]['limit']||null:null})[_0x5f88('0xb')](function(_0x4c415c){logger[_0x5f88('0xc')](_0x5f88('0x1a'),_0x49d76c);logger['debug'](_0x5f88('0x1a'),_0x49d76c,JSON['stringify'](_0x4c415c));_0x138d92(_0x4c415c);})['catch'](function(_0x46010c){logger[_0x5f88('0x11')]('UpdateMailQueueReport',_0x46010c[_0x5f88('0x12')],_0x49d76c);_0x152968(_0x40044f[_0x5f88('0x11')](0x1f4,_0x46010c[_0x5f88('0x12')]));});});}; \ No newline at end of file +var _0x649e=['catch','CreateMailQueueReport','body','options','then','MailQueueReport','raw','where','attributes','limit','UpdateMailQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','info','debug','request\x20sent','stringify','error','code','MailQueueReport,\x20%s,\x20%s','message'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0x649e,0x7f));var _0xe649=function(_0x3626f2,_0x44e427){_0x3626f2=_0x3626f2-0x0;var _0x440a03=_0x649e[_0x3626f2];return _0x440a03;};'use strict';var _=require(_0xe649('0x0'));var util=require(_0xe649('0x1'));var moment=require(_0xe649('0x2'));var BPromise=require(_0xe649('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe649('0x4'));var db=require(_0xe649('0x5'))['db'];var utils=require(_0xe649('0x6'));var logger=require(_0xe649('0x7'))(_0xe649('0x8'));var config=require(_0xe649('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15097f,_0x562ac8,_0x59d8f2){return new BPromise(function(_0x2add8f,_0x4fe86d){return client['request'](_0x15097f,_0x59d8f2)['then'](function(_0x166882){logger[_0xe649('0xa')]('MailQueueReport,\x20%s,\x20%s',_0x562ac8,'request\x20sent');logger[_0xe649('0xb')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x562ac8,_0xe649('0xc'),JSON[_0xe649('0xd')](_0x166882));if(_0x166882[_0xe649('0xe')]){if(_0x166882[_0xe649('0xe')][_0xe649('0xf')]===0x1f4){logger['error'](_0xe649('0x10'),_0x562ac8,_0x166882[_0xe649('0xe')][_0xe649('0x11')]);return _0x4fe86d(_0x166882['error'][_0xe649('0x11')]);}logger[_0xe649('0xe')](_0xe649('0x10'),_0x562ac8,_0x166882[_0xe649('0xe')][_0xe649('0x11')]);return _0x2add8f(_0x166882[_0xe649('0xe')]['message']);}else{logger[_0xe649('0xa')]('MailQueueReport,\x20%s,\x20%s',_0x562ac8,_0xe649('0xc'));_0x2add8f(_0x166882['result'][_0xe649('0x11')]);}})[_0xe649('0x12')](function(_0x572ed0){logger['error'](_0xe649('0x10'),_0x562ac8,_0x572ed0);_0x4fe86d(_0x572ed0);});});}exports[_0xe649('0x13')]=function(_0x1d6a4e){var _0x140b1a=this;return new Promise(function(_0x31310e,_0x4b8f68){return db['MailQueueReport']['create'](_0x1d6a4e[_0xe649('0x14')],{'raw':_0x1d6a4e['options']?_0x1d6a4e[_0xe649('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xe649('0x16')](function(_0x53dd37){logger[_0xe649('0xa')](_0xe649('0x13'),_0x1d6a4e);logger[_0xe649('0xb')](_0xe649('0x13'),_0x1d6a4e,JSON['stringify'](_0x53dd37));_0x31310e(_0x53dd37);})['catch'](function(_0x53364f){logger['error'](_0xe649('0x13'),_0x53364f[_0xe649('0x11')],_0x1d6a4e);_0x4b8f68(_0x140b1a['error'](0x1f4,_0x53364f[_0xe649('0x11')]));});});};exports['UpdateMailQueueReport']=function(_0x24ec5f){var _0x3cb887=this;return new Promise(function(_0x39bf06,_0x1eefc5){return db[_0xe649('0x17')]['update'](_0x24ec5f[_0xe649('0x14')],{'raw':_0x24ec5f[_0xe649('0x15')]?_0x24ec5f[_0xe649('0x15')][_0xe649('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24ec5f[_0xe649('0x15')]?_0x24ec5f[_0xe649('0x15')][_0xe649('0x19')]||null:null,'attributes':_0x24ec5f[_0xe649('0x15')]?_0x24ec5f[_0xe649('0x15')][_0xe649('0x1a')]||null:null,'limit':_0x24ec5f[_0xe649('0x15')]?_0x24ec5f['options'][_0xe649('0x1b')]||null:null})[_0xe649('0x16')](function(_0x51898b){logger[_0xe649('0xa')](_0xe649('0x1c'),_0x24ec5f);logger[_0xe649('0xb')](_0xe649('0x1c'),_0x24ec5f,JSON[_0xe649('0xd')](_0x51898b));_0x39bf06(_0x51898b);})['catch'](function(_0xd8d1a3){logger[_0xe649('0xe')](_0xe649('0x1c'),_0xd8d1a3[_0xe649('0x11')],_0x24ec5f);_0x1eefc5(_0x3cb887[_0xe649('0xe')](0x1f4,_0xd8d1a3[_0xe649('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 147eb32..b107d6a 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 _0x1649=['express','Router','../../components/auth/service','../../config/environment','exports','path','connect-timeout'];(function(_0x201042,_0x50bd0a){var _0x17f363=function(_0x4d7519){while(--_0x4d7519){_0x201042['push'](_0x201042['shift']());}};_0x17f363(++_0x50bd0a);}(_0x1649,0x1e8));var _0x9164=function(_0x1e9d78,_0x46ea3e){_0x1e9d78=_0x1e9d78-0x0;var _0xe77e1c=_0x1649[_0x1e9d78];return _0xe77e1c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9164('0x0'));var timeout=require(_0x9164('0x1'));var express=require(_0x9164('0x2'));var router=express[_0x9164('0x3')]();var auth=require(_0x9164('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9164('0x5'));module[_0x9164('0x6')]=router; \ No newline at end of file +var _0xdb6f=['connect-timeout','express','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0xdb6f,0xa5));var _0xfdb6=function(_0xb6a965,_0x5c5ace){_0xb6a965=_0xb6a965-0x0;var _0x51d37d=_0xdb6f[_0xb6a965];return _0x51d37d;};'use strict';var multer=require(_0xfdb6('0x0'));var util=require(_0xfdb6('0x1'));var path=require(_0xfdb6('0x2'));var timeout=require(_0xfdb6('0x3'));var express=require(_0xfdb6('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfdb6('0x5'));var config=require(_0xfdb6('0x6'));module[_0xfdb6('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 336b038..8bad0b0 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 _0x5235=['BOOLEAN','INBOX','INTEGER','sequelize','exports','STRING'];(function(_0xcb19e1,_0x465489){var _0x121872=function(_0x5c9cd1){while(--_0x5c9cd1){_0xcb19e1['push'](_0xcb19e1['shift']());}};_0x121872(++_0x465489);}(_0x5235,0xd5));var _0x5523=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0x5235[_0x1e172a];return _0x96338b;};'use strict';var Sequelize=require(_0x5523('0x0'));module[_0x5523('0x1')]={'description':{'type':Sequelize[_0x5523('0x2')]},'host':{'type':Sequelize[_0x5523('0x2')]},'authentication':{'type':Sequelize[_0x5523('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5523('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x5523('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x5523('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5523('0x2')],'defaultValue':_0x5523('0x4')},'connTimeout':{'type':Sequelize[_0x5523('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x5523('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x5523('0x2')]}}; \ No newline at end of file +var _0x0805=['STRING','username','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0x0805,0x112));var _0x5080=function(_0x61ddee,_0x36ad0e){_0x61ddee=_0x61ddee-0x0;var _0xf92070=_0x0805[_0x61ddee];return _0xf92070;};'use strict';var Sequelize=require(_0x5080('0x0'));module[_0x5080('0x1')]={'description':{'type':Sequelize[_0x5080('0x2')]},'host':{'type':Sequelize[_0x5080('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x5080('0x2')],'unique':_0x5080('0x3')},'password':{'type':Sequelize[_0x5080('0x2')]},'port':{'type':Sequelize[_0x5080('0x4')]},'tls':{'type':Sequelize[_0x5080('0x5')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5080('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x5080('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x5080('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index e89ad9b..7d25870 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 _0xb921=['../../config/logger','api','moment','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util'];(function(_0x325507,_0x1968ab){var _0x1a5253=function(_0x591c8e){while(--_0x591c8e){_0x325507['push'](_0x325507['shift']());}};_0x1a5253(++_0x1968ab);}(_0xb921,0x16a));var _0x1b92=function(_0x32af46,_0xb38e36){_0x32af46=_0x32af46-0x0;var _0x5a5520=_0xb921[_0x32af46];return _0x5a5520;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var logger=require(_0x1b92('0x2'))(_0x1b92('0x3'));var moment=require(_0x1b92('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b92('0x5'));var rimraf=require(_0x1b92('0x6'));var config=require(_0x1b92('0x7'));var attributes=require(_0x1b92('0x8'));module[_0x1b92('0x9')]=function(_0x29a1db,_0x4358e3){return _0x29a1db[_0x1b92('0xa')](_0x1b92('0xb'),attributes,{'tableName':_0x1b92('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7708=['../../config/environment','exports','define','MailServerIn','mail_servers_in','lodash','util','api','rimraf'];(function(_0x11821e,_0xe435c0){var _0x4eb4cd=function(_0xf4c2dd){while(--_0xf4c2dd){_0x11821e['push'](_0x11821e['shift']());}};_0x4eb4cd(++_0xe435c0);}(_0x7708,0x188));var _0x8770=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x7708[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var logger=require('../../config/logger')(_0x8770('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var attributes=require('./mailServerIn.attributes');module[_0x8770('0x5')]=function(_0x50bab7,_0x31390d){return _0x50bab7[_0x8770('0x6')](_0x8770('0x7'),attributes,{'tableName':_0x8770('0x8'),'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 fd46845..ce4fdca 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 _0x39be=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x39be,0xe9));var _0xe39b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x39be[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xe39b('0x0'));var util=require('util');var moment=require(_0xe39b('0x1'));var BPromise=require(_0xe39b('0x2'));var rs=require(_0xe39b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe39b('0x4'))['db'];var utils=require(_0xe39b('0x5'));var logger=require(_0xe39b('0x6'))(_0xe39b('0x7'));var config=require('../../config/environment');var jayson=require(_0xe39b('0x8'));var client=jayson[_0xe39b('0x9')][_0xe39b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa14e73,_0x3de9d4,_0x9899fa){return new BPromise(function(_0x392086,_0x289481){return client['request'](_0xa14e73,_0x9899fa)[_0xe39b('0xb')](function(_0x3dd928){logger[_0xe39b('0xc')](_0xe39b('0xd'),_0x3de9d4,_0xe39b('0xe'));logger[_0xe39b('0xf')](_0xe39b('0x10'),_0x3de9d4,_0xe39b('0xe'),JSON[_0xe39b('0x11')](_0x3dd928));if(_0x3dd928[_0xe39b('0x12')]){if(_0x3dd928['error']['code']===0x1f4){logger[_0xe39b('0x12')](_0xe39b('0xd'),_0x3de9d4,_0x3dd928['error']['message']);return _0x289481(_0x3dd928[_0xe39b('0x12')][_0xe39b('0x13')]);}logger[_0xe39b('0x12')](_0xe39b('0xd'),_0x3de9d4,_0x3dd928[_0xe39b('0x12')]['message']);return _0x392086(_0x3dd928[_0xe39b('0x12')][_0xe39b('0x13')]);}else{logger['info'](_0xe39b('0xd'),_0x3de9d4,_0xe39b('0xe'));_0x392086(_0x3dd928[_0xe39b('0x14')]['message']);}})['catch'](function(_0x540a92){logger[_0xe39b('0x12')](_0xe39b('0xd'),_0x3de9d4,_0x540a92);_0x289481(_0x540a92);});});}exports[_0xe39b('0x15')]=function(_0x28d359){var _0x32ff19=this;return new Promise(function(_0x44278c,_0x17b2dd){return db[_0xe39b('0x16')][_0xe39b('0x17')]({'raw':_0x28d359[_0xe39b('0x18')]?_0x28d359[_0xe39b('0x18')][_0xe39b('0x19')]===undefined?!![]:![]:!![],'where':_0x28d359[_0xe39b('0x18')]?_0x28d359[_0xe39b('0x18')][_0xe39b('0x1a')]||null:null,'attributes':_0x28d359[_0xe39b('0x18')]?_0x28d359[_0xe39b('0x18')][_0xe39b('0x1b')]||null:null,'limit':_0x28d359[_0xe39b('0x18')]?_0x28d359[_0xe39b('0x18')]['limit']||null:null,'include':_0x28d359['options']?_0x28d359['options'][_0xe39b('0x1c')]?_[_0xe39b('0x1d')](_0x28d359['options'][_0xe39b('0x1c')],function(_0x45c507){return{'model':db[_0x45c507[_0xe39b('0x1e')]],'as':_0x45c507['as'],'attributes':_0x45c507[_0xe39b('0x1b')],'include':_0x45c507[_0xe39b('0x1c')]?_['map'](_0x45c507['include'],function(_0x237c66){return{'model':db[_0x237c66[_0xe39b('0x1e')]],'as':_0x237c66['as'],'attributes':_0x237c66[_0xe39b('0x1b')],'include':_0x237c66['include']?_[_0xe39b('0x1d')](_0x237c66[_0xe39b('0x1c')],function(_0x11c283){return{'model':db[_0x11c283[_0xe39b('0x1e')]],'as':_0x11c283['as'],'attributes':_0x11c283[_0xe39b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe39b('0xb')](function(_0x3b0c3c){logger['info']('GetMailServerIn',_0x28d359);logger[_0xe39b('0xf')](_0xe39b('0x15'),_0x28d359,JSON[_0xe39b('0x11')](_0x3b0c3c));_0x44278c(_0x3b0c3c);})['catch'](function(_0x4fa471){logger[_0xe39b('0x12')](_0xe39b('0x15'),_0x4fa471[_0xe39b('0x13')],_0x28d359);_0x17b2dd(_0x32ff19[_0xe39b('0x12')](0x1f4,_0x4fa471[_0xe39b('0x13')]));});});}; \ No newline at end of file +var _0x1719=['rpc','../../config/environment','jayson/promise','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x17d0aa,_0x527ef2){var _0x18d072=function(_0x143302){while(--_0x143302){_0x17d0aa['push'](_0x17d0aa['shift']());}};_0x18d072(++_0x527ef2);}(_0x1719,0x9a));var _0x9171=function(_0x4d1a25,_0x2fd7e9){_0x4d1a25=_0x4d1a25-0x0;var _0x48fdde=_0x1719[_0x4d1a25];return _0x48fdde;};'use strict';var _=require(_0x9171('0x0'));var util=require(_0x9171('0x1'));var moment=require(_0x9171('0x2'));var BPromise=require(_0x9171('0x3'));var rs=require(_0x9171('0x4'));var fs=require('fs');var Redis=require(_0x9171('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9171('0x6'));var config=require(_0x9171('0x7'));var jayson=require(_0x9171('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x351d9b,_0x594d65,_0x49e95d){return new BPromise(function(_0x476a37,_0x358039){return client[_0x9171('0x9')](_0x351d9b,_0x49e95d)[_0x9171('0xa')](function(_0x38b23a){logger['info'](_0x9171('0xb'),_0x594d65,_0x9171('0xc'));logger[_0x9171('0xd')](_0x9171('0xe'),_0x594d65,_0x9171('0xc'),JSON['stringify'](_0x38b23a));if(_0x38b23a[_0x9171('0xf')]){if(_0x38b23a[_0x9171('0xf')][_0x9171('0x10')]===0x1f4){logger[_0x9171('0xf')](_0x9171('0xb'),_0x594d65,_0x38b23a[_0x9171('0xf')][_0x9171('0x11')]);return _0x358039(_0x38b23a['error']['message']);}logger[_0x9171('0xf')](_0x9171('0xb'),_0x594d65,_0x38b23a['error'][_0x9171('0x11')]);return _0x476a37(_0x38b23a[_0x9171('0xf')][_0x9171('0x11')]);}else{logger[_0x9171('0x12')](_0x9171('0xb'),_0x594d65,_0x9171('0xc'));_0x476a37(_0x38b23a[_0x9171('0x13')][_0x9171('0x11')]);}})[_0x9171('0x14')](function(_0x54fd24){logger[_0x9171('0xf')](_0x9171('0xb'),_0x594d65,_0x54fd24);_0x358039(_0x54fd24);});});}exports[_0x9171('0x15')]=function(_0x234f49){var _0x25a16b=this;return new Promise(function(_0x574cd5,_0x8498ea){return db[_0x9171('0x16')][_0x9171('0x17')]({'raw':_0x234f49[_0x9171('0x18')]?_0x234f49['options'][_0x9171('0x19')]===undefined?!![]:![]:!![],'where':_0x234f49['options']?_0x234f49[_0x9171('0x18')][_0x9171('0x1a')]||null:null,'attributes':_0x234f49['options']?_0x234f49[_0x9171('0x18')][_0x9171('0x1b')]||null:null,'limit':_0x234f49[_0x9171('0x18')]?_0x234f49[_0x9171('0x18')]['limit']||null:null,'include':_0x234f49[_0x9171('0x18')]?_0x234f49[_0x9171('0x18')][_0x9171('0x1c')]?_[_0x9171('0x1d')](_0x234f49[_0x9171('0x18')][_0x9171('0x1c')],function(_0x56f0ee){return{'model':db[_0x56f0ee[_0x9171('0x1e')]],'as':_0x56f0ee['as'],'attributes':_0x56f0ee['attributes'],'include':_0x56f0ee[_0x9171('0x1c')]?_[_0x9171('0x1d')](_0x56f0ee[_0x9171('0x1c')],function(_0x3803b9){return{'model':db[_0x3803b9[_0x9171('0x1e')]],'as':_0x3803b9['as'],'attributes':_0x3803b9[_0x9171('0x1b')],'include':_0x3803b9[_0x9171('0x1c')]?_[_0x9171('0x1d')](_0x3803b9[_0x9171('0x1c')],function(_0x18d0b8){return{'model':db[_0x18d0b8[_0x9171('0x1e')]],'as':_0x18d0b8['as'],'attributes':_0x18d0b8[_0x9171('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9171('0xa')](function(_0x12f81a){logger['info']('GetMailServerIn',_0x234f49);logger[_0x9171('0xd')](_0x9171('0x15'),_0x234f49,JSON[_0x9171('0x1f')](_0x12f81a));_0x574cd5(_0x12f81a);})['catch'](function(_0x49fdfd){logger[_0x9171('0xf')](_0x9171('0x15'),_0x49fdfd[_0x9171('0x11')],_0x234f49);_0x8498ea(_0x25a16b[_0x9171('0xf')](0x1f4,_0x49fdfd[_0x9171('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 2790aee..7a61b05 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 _0x2107=['index','show','post','create','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2107,0x14c));var _0x7210=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0x2107[_0x5a636f];return _0x6a8cfb;};'use strict';var multer=require('multer');var util=require(_0x7210('0x0'));var path=require('path');var timeout=require(_0x7210('0x1'));var express=require(_0x7210('0x2'));var router=express[_0x7210('0x3')]();var auth=require(_0x7210('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7210('0x5'));var controller=require('./mailServerOut.controller');router[_0x7210('0x6')]('/',auth[_0x7210('0x7')](),controller[_0x7210('0x8')]);router['get']('/:id',auth[_0x7210('0x7')](),controller[_0x7210('0x9')]);router[_0x7210('0xa')]('/',auth[_0x7210('0x7')](),controller[_0x7210('0xb')]);router['put'](_0x7210('0xc'),auth[_0x7210('0x7')](),controller[_0x7210('0xd')]);router[_0x7210('0xe')](_0x7210('0xc'),auth[_0x7210('0x7')](),controller[_0x7210('0xf')]);module[_0x7210('0x10')]=router; \ No newline at end of file +var _0x4801=['show','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0xaa7390,_0x526716){var _0x25d4aa=function(_0x5db16f){while(--_0x5db16f){_0xaa7390['push'](_0xaa7390['shift']());}};_0x25d4aa(++_0x526716);}(_0x4801,0xb3));var _0x1480=function(_0x64f713,_0x42cc4c){_0x64f713=_0x64f713-0x0;var _0x41ea6c=_0x4801[_0x64f713];return _0x41ea6c;};'use strict';var multer=require(_0x1480('0x0'));var util=require(_0x1480('0x1'));var path=require(_0x1480('0x2'));var timeout=require('connect-timeout');var express=require(_0x1480('0x3'));var router=express[_0x1480('0x4')]();var auth=require(_0x1480('0x5'));var interaction=require(_0x1480('0x6'));var config=require(_0x1480('0x7'));var controller=require('./mailServerOut.controller');router['get']('/',auth[_0x1480('0x8')](),controller[_0x1480('0x9')]);router[_0x1480('0xa')]('/:id',auth[_0x1480('0x8')](),controller[_0x1480('0xb')]);router['post']('/',auth[_0x1480('0x8')](),controller[_0x1480('0xc')]);router[_0x1480('0xd')](_0x1480('0xe'),auth[_0x1480('0x8')](),controller[_0x1480('0xf')]);router[_0x1480('0x10')](_0x1480('0xe'),auth[_0x1480('0x8')](),controller[_0x1480('0x11')]);module[_0x1480('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 4069de4..94b29b0 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 _0x7958=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x380767,_0x5ee13b){var _0x177d8d=function(_0x47f5a6){while(--_0x47f5a6){_0x380767['push'](_0x380767['shift']());}};_0x177d8d(++_0x5ee13b);}(_0x7958,0x126));var _0x8795=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7958[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8795('0x0'));module[_0x8795('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x8795('0x2')]},'user':{'type':Sequelize[_0x8795('0x2')]},'pass':{'type':Sequelize[_0x8795('0x2')]},'port':{'type':Sequelize[_0x8795('0x3')]},'secure':{'type':Sequelize[_0x8795('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x8795('0x2')]},'authentication':{'type':Sequelize[_0x8795('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0xaf11=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x401e62,_0x53bfd6){var _0x39c0e5=function(_0x1589e1){while(--_0x1589e1){_0x401e62['push'](_0x401e62['shift']());}};_0x39c0e5(++_0x53bfd6);}(_0xaf11,0x12f));var _0x1af1=function(_0x311c26,_0x802cb6){_0x311c26=_0x311c26-0x0;var _0x38d699=_0xaf11[_0x311c26];return _0x38d699;};'use strict';var Sequelize=require(_0x1af1('0x0'));module[_0x1af1('0x1')]={'description':{'type':Sequelize[_0x1af1('0x2')]},'host':{'type':Sequelize[_0x1af1('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x1af1('0x2')]},'port':{'type':Sequelize[_0x1af1('0x3')]},'secure':{'type':Sequelize[_0x1af1('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x1af1('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 94145b5..ef4108f 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 _0x6765=['length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','reject','update','then','destroy','sendStatus','error','name','send','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes'];(function(_0x543e10,_0x141572){var _0xb1add6=function(_0x2a08f9){while(--_0x2a08f9){_0x543e10['push'](_0x543e10['shift']());}};_0xb1add6(++_0x141572);}(_0x6765,0x172));var _0x5676=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0x6765[_0x3a9661];return _0x5bb119;};'use strict';var pdf=require(_0x5676('0x0'));var emlformat=require(_0x5676('0x1'));var rimraf=require(_0x5676('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5676('0x3'));var rp=require('request-promise');var moment=require(_0x5676('0x4'));var BPromise=require(_0x5676('0x5'));var Mustache=require('mustache');var util=require(_0x5676('0x6'));var path=require(_0x5676('0x7'));var sox=require(_0x5676('0x8'));var csv=require(_0x5676('0x9'));var ejs=require(_0x5676('0xa'));var fs=require('fs');var _=require(_0x5676('0xb'));var squel=require(_0x5676('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5676('0xd'));var toCsv=require(_0x5676('0x9'));var querystring=require(_0x5676('0xe'));var Papa=require(_0x5676('0xf'));var Redis=require(_0x5676('0x10'));var authService=require(_0x5676('0x11'));var qs=require(_0x5676('0x12'));var as=require(_0x5676('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5676('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5676('0x15'));var licenseUtil=require(_0x5676('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xed856f,_0x1b194f){_0x1b194f=_0x1b194f||0xcc;return function(_0x3c601d){if(_0x3c601d){return _0xed856f['sendStatus'](_0x1b194f);}return _0xed856f[_0x5676('0x17')](_0x1b194f)[_0x5676('0x18')]();};}function respondWithResult(_0x34838e,_0x26c91a){_0x26c91a=_0x26c91a||0xc8;return function(_0x3efe34){if(_0x3efe34){return _0x34838e[_0x5676('0x17')](_0x26c91a)[_0x5676('0x19')](_0x3efe34);}};}function respondWithFilteredResult(_0x4f1ca8,_0x4e35dd){return function(_0x54a937){if(_0x54a937){var _0x3232a3=_0x54a937[_0x5676('0x1a')],_0x430a9b=_0x4e35dd[_0x5676('0x1b')],_0x377183=_0x4e35dd[_0x5676('0x1b')]+_0x4e35dd[_0x5676('0x1c')],_0x306608;if(_0x377183>=_0x3232a3){_0x377183=_0x3232a3;_0x306608=0xc8;}else{_0x306608=0xce;}_0x4f1ca8[_0x5676('0x17')](_0x306608);return _0x4f1ca8[_0x5676('0x1d')]('Content-Range',_0x430a9b+'-'+_0x377183+'/'+_0x3232a3)[_0x5676('0x19')](_0x54a937);}return null;};}function patchUpdates(_0x1c5fc9){return function(_0xf5ecb6){try{jsonpatch['apply'](_0xf5ecb6,_0x1c5fc9,!![]);}catch(_0x53e64d){return BPromise[_0x5676('0x1e')](_0x53e64d);}return _0xf5ecb6['save']();};}function saveUpdates(_0x3d7d8a,_0x3f5fde){return function(_0x39a3b8){if(_0x39a3b8){return _0x39a3b8[_0x5676('0x1f')](_0x3d7d8a)[_0x5676('0x20')](function(_0x523fee){return _0x523fee;});}return null;};}function removeEntity(_0x17d0c4,_0x4cf919){return function(_0xfe1daf){if(_0xfe1daf){return _0xfe1daf[_0x5676('0x21')]()[_0x5676('0x20')](function(){_0x17d0c4[_0x5676('0x17')](0xcc)[_0x5676('0x18')]();});}};}function handleEntityNotFound(_0x575db6,_0x1a3036){return function(_0x146da2){if(!_0x146da2){_0x575db6[_0x5676('0x22')](0x194);}return _0x146da2;};}function handleError(_0x2862f4,_0x556dd8){_0x556dd8=_0x556dd8||0x1f4;return function(_0x5dc393){logger[_0x5676('0x23')](_0x5dc393['stack']);if(_0x5dc393[_0x5676('0x24')]){delete _0x5dc393[_0x5676('0x24')];}_0x2862f4[_0x5676('0x17')](_0x556dd8)[_0x5676('0x25')](_0x5dc393);};}exports['index']=function(_0x2fe11a,_0xd4f8f){var _0x2ca761={},_0x360210={},_0xd1626a={'count':0x0,'rows':[]};var _0xb936b6=_[_0x5676('0x26')](db[_0x5676('0x27')][_0x5676('0x28')],function(_0x11220b){return{'name':_0x11220b[_0x5676('0x29')],'type':_0x11220b[_0x5676('0x2a')][_0x5676('0x2b')]};});_0x360210[_0x5676('0x2c')]=_[_0x5676('0x26')](_0xb936b6,_0x5676('0x24'));_0x360210[_0x5676('0x2d')]=_[_0x5676('0x2e')](_0x2fe11a[_0x5676('0x2d')]);_0x360210['filters']=_['intersection'](_0x360210['model'],_0x360210[_0x5676('0x2d')]);_0x2ca761['attributes']=_[_0x5676('0x2f')](_0x360210[_0x5676('0x2c')],qs[_0x5676('0x30')](_0x2fe11a[_0x5676('0x2d')][_0x5676('0x30')]));_0x2ca761['attributes']=_0x2ca761[_0x5676('0x31')][_0x5676('0x32')]?_0x2ca761[_0x5676('0x31')]:_0x360210['model'];if(!_0x2fe11a[_0x5676('0x2d')][_0x5676('0x33')](_0x5676('0x34'))){_0x2ca761[_0x5676('0x1c')]=qs['limit'](_0x2fe11a['query']['limit']);_0x2ca761[_0x5676('0x1b')]=qs[_0x5676('0x1b')](_0x2fe11a[_0x5676('0x2d')][_0x5676('0x1b')]);}_0x2ca761[_0x5676('0x35')]=qs[_0x5676('0x36')](_0x2fe11a[_0x5676('0x2d')][_0x5676('0x36')]);_0x2ca761[_0x5676('0x37')]=qs[_0x5676('0x38')](_['pick'](_0x2fe11a[_0x5676('0x2d')],_0x360210[_0x5676('0x38')]),_0xb936b6);if(_0x2fe11a['query'][_0x5676('0x39')]){_0x2ca761[_0x5676('0x37')]=_['merge'](_0x2ca761[_0x5676('0x37')],{'$or':_['map'](_0xb936b6,function(_0x25516e){if(_0x25516e[_0x5676('0x2a')]!==_0x5676('0x3a')){var _0x8de9d3={};_0x8de9d3[_0x25516e['name']]={'$like':'%'+_0x2fe11a[_0x5676('0x2d')][_0x5676('0x39')]+'%'};return _0x8de9d3;}})});}_0x2ca761=_[_0x5676('0x3b')]({},_0x2ca761,_0x2fe11a[_0x5676('0x3c')]);var _0x5877c6={'where':_0x2ca761[_0x5676('0x37')]};return db['MailServerOut'][_0x5676('0x1a')](_0x5877c6)[_0x5676('0x20')](function(_0x11eceb){_0xd1626a[_0x5676('0x1a')]=_0x11eceb;if(_0x2fe11a[_0x5676('0x2d')][_0x5676('0x3d')]){_0x2ca761['include']=[{'all':!![]}];}return db[_0x5676('0x27')][_0x5676('0x3e')](_0x2ca761);})[_0x5676('0x20')](function(_0x1e0ce9){_0xd1626a[_0x5676('0x3f')]=_0x1e0ce9;return _0xd1626a;})[_0x5676('0x20')](respondWithFilteredResult(_0xd4f8f,_0x2ca761))[_0x5676('0x40')](handleError(_0xd4f8f,null));};exports['show']=function(_0x608a2,_0x5e9204){var _0x2ca3bb={'raw':!![],'where':{'id':_0x608a2[_0x5676('0x41')]['id']}},_0x1a1f35={};_0x1a1f35[_0x5676('0x2c')]=_[_0x5676('0x2e')](db[_0x5676('0x27')]['rawAttributes']);_0x1a1f35['query']=_[_0x5676('0x2e')](_0x608a2['query']);_0x1a1f35[_0x5676('0x38')]=_[_0x5676('0x2f')](_0x1a1f35[_0x5676('0x2c')],_0x1a1f35[_0x5676('0x2d')]);_0x2ca3bb['attributes']=_[_0x5676('0x2f')](_0x1a1f35['model'],qs[_0x5676('0x30')](_0x608a2['query'][_0x5676('0x30')]));_0x2ca3bb[_0x5676('0x31')]=_0x2ca3bb[_0x5676('0x31')][_0x5676('0x32')]?_0x2ca3bb[_0x5676('0x31')]:_0x1a1f35['model'];if(_0x608a2[_0x5676('0x2d')]['includeAll']){_0x2ca3bb[_0x5676('0x42')]=[{'all':!![]}];}_0x2ca3bb=_[_0x5676('0x3b')]({},_0x2ca3bb,_0x608a2[_0x5676('0x3c')]);return db['MailServerOut'][_0x5676('0x43')](_0x2ca3bb)[_0x5676('0x20')](handleEntityNotFound(_0x5e9204,null))['then'](respondWithResult(_0x5e9204,null))[_0x5676('0x40')](handleError(_0x5e9204,null));};exports[_0x5676('0x44')]=function(_0x5c9542,_0x3754a9){return db[_0x5676('0x27')][_0x5676('0x44')](_0x5c9542[_0x5676('0x45')],{})[_0x5676('0x20')](respondWithResult(_0x3754a9,0xc9))[_0x5676('0x40')](handleError(_0x3754a9,null));};exports[_0x5676('0x1f')]=function(_0x1aab15,_0x46a396){if(_0x1aab15[_0x5676('0x45')]['id']){delete _0x1aab15[_0x5676('0x45')]['id'];}return db[_0x5676('0x27')]['find']({'where':{'id':_0x1aab15[_0x5676('0x41')]['id']}})[_0x5676('0x20')](handleEntityNotFound(_0x46a396,null))[_0x5676('0x20')](saveUpdates(_0x1aab15['body'],null))[_0x5676('0x20')](respondWithResult(_0x46a396,null))[_0x5676('0x40')](handleError(_0x46a396,null));};exports[_0x5676('0x21')]=function(_0xf624b7,_0x4558d0){return db[_0x5676('0x27')][_0x5676('0x43')]({'where':{'id':_0xf624b7[_0x5676('0x41')]['id']}})[_0x5676('0x20')](handleEntityNotFound(_0x4558d0,null))[_0x5676('0x20')](removeEntity(_0x4558d0,null))[_0x5676('0x40')](handleError(_0x4558d0,null));}; \ No newline at end of file +var _0xb333=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','MailServerOut','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','intersection','length','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel'];(function(_0x3ca961,_0x4829f4){var _0x345062=function(_0xbb48f7){while(--_0xbb48f7){_0x3ca961['push'](_0x3ca961['shift']());}};_0x345062(++_0x4829f4);}(_0xb333,0x1c1));var _0x3b33=function(_0x1a0599,_0x28581c){_0x1a0599=_0x1a0599-0x0;var _0x46ea6d=_0xb333[_0x1a0599];return _0x46ea6d;};'use strict';var pdf=require(_0x3b33('0x0'));var emlformat=require(_0x3b33('0x1'));var rimraf=require(_0x3b33('0x2'));var zipdir=require(_0x3b33('0x3'));var jsonpatch=require(_0x3b33('0x4'));var rp=require(_0x3b33('0x5'));var moment=require(_0x3b33('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3b33('0x7'));var util=require(_0x3b33('0x8'));var path=require('path');var sox=require(_0x3b33('0x9'));var csv=require('to-csv');var ejs=require(_0x3b33('0xa'));var fs=require('fs');var _=require(_0x3b33('0xb'));var squel=require(_0x3b33('0xc'));var crypto=require(_0x3b33('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3b33('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3b33('0xf'));var Papa=require(_0x3b33('0x10'));var Redis=require(_0x3b33('0x11'));var authService=require(_0x3b33('0x12'));var qs=require(_0x3b33('0x13'));var as=require(_0x3b33('0x14'));var hardwareService=require(_0x3b33('0x15'));var logger=require(_0x3b33('0x16'))(_0x3b33('0x17'));var utils=require(_0x3b33('0x18'));var config=require(_0x3b33('0x19'));var licenseUtil=require(_0x3b33('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1eb479,_0x1dbfb3){_0x1dbfb3=_0x1dbfb3||0xcc;return function(_0x2037e4){if(_0x2037e4){return _0x1eb479[_0x3b33('0x1b')](_0x1dbfb3);}return _0x1eb479[_0x3b33('0x1c')](_0x1dbfb3)[_0x3b33('0x1d')]();};}function respondWithResult(_0x52678e,_0x54678d){_0x54678d=_0x54678d||0xc8;return function(_0x32f1cd){if(_0x32f1cd){return _0x52678e[_0x3b33('0x1c')](_0x54678d)[_0x3b33('0x1e')](_0x32f1cd);}};}function respondWithFilteredResult(_0x14ed0d,_0x2c0f0f){return function(_0x5d4e38){if(_0x5d4e38){var _0x16e1e6=_0x5d4e38[_0x3b33('0x1f')],_0x149913=_0x2c0f0f[_0x3b33('0x20')],_0x153122=_0x2c0f0f[_0x3b33('0x20')]+_0x2c0f0f[_0x3b33('0x21')],_0x3ec426;if(_0x153122>=_0x16e1e6){_0x153122=_0x16e1e6;_0x3ec426=0xc8;}else{_0x3ec426=0xce;}_0x14ed0d[_0x3b33('0x1c')](_0x3ec426);return _0x14ed0d[_0x3b33('0x22')](_0x3b33('0x23'),_0x149913+'-'+_0x153122+'/'+_0x16e1e6)[_0x3b33('0x1e')](_0x5d4e38);}return null;};}function patchUpdates(_0x313b5a){return function(_0x10353f){try{jsonpatch[_0x3b33('0x24')](_0x10353f,_0x313b5a,!![]);}catch(_0x3d7511){return BPromise[_0x3b33('0x25')](_0x3d7511);}return _0x10353f[_0x3b33('0x26')]();};}function saveUpdates(_0x35e5e9,_0x52ed9e){return function(_0x42d04f){if(_0x42d04f){return _0x42d04f[_0x3b33('0x27')](_0x35e5e9)[_0x3b33('0x28')](function(_0x311d41){return _0x311d41;});}return null;};}function removeEntity(_0x56405e,_0x19cc1f){return function(_0x344c11){if(_0x344c11){return _0x344c11[_0x3b33('0x29')]()[_0x3b33('0x28')](function(){_0x56405e['status'](0xcc)[_0x3b33('0x1d')]();});}};}function handleEntityNotFound(_0x4422bb,_0x237a9b){return function(_0x4456e1){if(!_0x4456e1){_0x4422bb[_0x3b33('0x1b')](0x194);}return _0x4456e1;};}function handleError(_0x183a28,_0x13b79f){_0x13b79f=_0x13b79f||0x1f4;return function(_0x352897){logger[_0x3b33('0x2a')](_0x352897[_0x3b33('0x2b')]);if(_0x352897[_0x3b33('0x2c')]){delete _0x352897[_0x3b33('0x2c')];}_0x183a28[_0x3b33('0x1c')](_0x13b79f)[_0x3b33('0x2d')](_0x352897);};}exports['index']=function(_0x434340,_0x53c880){var _0x37aad1={},_0x41b0b2={},_0x2d11fa={'count':0x0,'rows':[]};var _0x1e47db=_[_0x3b33('0x2e')](db[_0x3b33('0x2f')][_0x3b33('0x30')],function(_0x59e0a9){return{'name':_0x59e0a9[_0x3b33('0x31')],'type':_0x59e0a9[_0x3b33('0x32')][_0x3b33('0x33')]};});_0x41b0b2['model']=_[_0x3b33('0x2e')](_0x1e47db,_0x3b33('0x2c'));_0x41b0b2[_0x3b33('0x34')]=_[_0x3b33('0x35')](_0x434340[_0x3b33('0x34')]);_0x41b0b2['filters']=_['intersection'](_0x41b0b2[_0x3b33('0x36')],_0x41b0b2[_0x3b33('0x34')]);_0x37aad1[_0x3b33('0x37')]=_['intersection'](_0x41b0b2['model'],qs[_0x3b33('0x38')](_0x434340[_0x3b33('0x34')][_0x3b33('0x38')]));_0x37aad1['attributes']=_0x37aad1['attributes']['length']?_0x37aad1['attributes']:_0x41b0b2['model'];if(!_0x434340[_0x3b33('0x34')]['hasOwnProperty'](_0x3b33('0x39'))){_0x37aad1[_0x3b33('0x21')]=qs['limit'](_0x434340[_0x3b33('0x34')][_0x3b33('0x21')]);_0x37aad1[_0x3b33('0x20')]=qs['offset'](_0x434340['query'][_0x3b33('0x20')]);}_0x37aad1['order']=qs[_0x3b33('0x3a')](_0x434340['query'][_0x3b33('0x3a')]);_0x37aad1[_0x3b33('0x3b')]=qs[_0x3b33('0x3c')](_[_0x3b33('0x3d')](_0x434340[_0x3b33('0x34')],_0x41b0b2[_0x3b33('0x3c')]),_0x1e47db);if(_0x434340[_0x3b33('0x34')][_0x3b33('0x3e')]){_0x37aad1[_0x3b33('0x3b')]=_['merge'](_0x37aad1[_0x3b33('0x3b')],{'$or':_['map'](_0x1e47db,function(_0x6d312e){if(_0x6d312e[_0x3b33('0x32')]!==_0x3b33('0x3f')){var _0x5adc5d={};_0x5adc5d[_0x6d312e[_0x3b33('0x2c')]]={'$like':'%'+_0x434340[_0x3b33('0x34')][_0x3b33('0x3e')]+'%'};return _0x5adc5d;}})});}_0x37aad1=_[_0x3b33('0x40')]({},_0x37aad1,_0x434340[_0x3b33('0x41')]);var _0x3df5a5={'where':_0x37aad1[_0x3b33('0x3b')]};return db[_0x3b33('0x2f')][_0x3b33('0x1f')](_0x3df5a5)['then'](function(_0xb92294){_0x2d11fa['count']=_0xb92294;if(_0x434340[_0x3b33('0x34')][_0x3b33('0x42')]){_0x37aad1[_0x3b33('0x43')]=[{'all':!![]}];}return db[_0x3b33('0x2f')]['findAll'](_0x37aad1);})[_0x3b33('0x28')](function(_0x2044b7){_0x2d11fa[_0x3b33('0x44')]=_0x2044b7;return _0x2d11fa;})[_0x3b33('0x28')](respondWithFilteredResult(_0x53c880,_0x37aad1))[_0x3b33('0x45')](handleError(_0x53c880,null));};exports[_0x3b33('0x46')]=function(_0x171ac2,_0xa1cf32){var _0x8738c7={'raw':!![],'where':{'id':_0x171ac2[_0x3b33('0x47')]['id']}},_0x56acb3={};_0x56acb3['model']=_[_0x3b33('0x35')](db[_0x3b33('0x2f')][_0x3b33('0x30')]);_0x56acb3[_0x3b33('0x34')]=_[_0x3b33('0x35')](_0x171ac2[_0x3b33('0x34')]);_0x56acb3[_0x3b33('0x3c')]=_[_0x3b33('0x48')](_0x56acb3[_0x3b33('0x36')],_0x56acb3[_0x3b33('0x34')]);_0x8738c7[_0x3b33('0x37')]=_[_0x3b33('0x48')](_0x56acb3[_0x3b33('0x36')],qs['fields'](_0x171ac2[_0x3b33('0x34')][_0x3b33('0x38')]));_0x8738c7[_0x3b33('0x37')]=_0x8738c7[_0x3b33('0x37')][_0x3b33('0x49')]?_0x8738c7[_0x3b33('0x37')]:_0x56acb3[_0x3b33('0x36')];if(_0x171ac2[_0x3b33('0x34')][_0x3b33('0x42')]){_0x8738c7[_0x3b33('0x43')]=[{'all':!![]}];}_0x8738c7=_[_0x3b33('0x40')]({},_0x8738c7,_0x171ac2['options']);return db[_0x3b33('0x2f')]['find'](_0x8738c7)[_0x3b33('0x28')](handleEntityNotFound(_0xa1cf32,null))['then'](respondWithResult(_0xa1cf32,null))[_0x3b33('0x45')](handleError(_0xa1cf32,null));};exports[_0x3b33('0x4a')]=function(_0x1a3311,_0x5dd86e){return db[_0x3b33('0x2f')][_0x3b33('0x4a')](_0x1a3311['body'],{})['then'](respondWithResult(_0x5dd86e,0xc9))[_0x3b33('0x45')](handleError(_0x5dd86e,null));};exports['update']=function(_0x5ea5d3,_0x248cca){if(_0x5ea5d3[_0x3b33('0x4b')]['id']){delete _0x5ea5d3['body']['id'];}return db[_0x3b33('0x2f')][_0x3b33('0x4c')]({'where':{'id':_0x5ea5d3[_0x3b33('0x47')]['id']}})[_0x3b33('0x28')](handleEntityNotFound(_0x248cca,null))[_0x3b33('0x28')](saveUpdates(_0x5ea5d3[_0x3b33('0x4b')],null))['then'](respondWithResult(_0x248cca,null))[_0x3b33('0x45')](handleError(_0x248cca,null));};exports[_0x3b33('0x29')]=function(_0x416859,_0x1ca684){return db[_0x3b33('0x2f')][_0x3b33('0x4c')]({'where':{'id':_0x416859[_0x3b33('0x47')]['id']}})[_0x3b33('0x28')](handleEntityNotFound(_0x1ca684,null))[_0x3b33('0x28')](removeEntity(_0x1ca684,null))[_0x3b33('0x45')](handleError(_0x1ca684,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 0977b55..dad6726 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 _0xda19=['exports','define','MailServerOut','mail_servers_out','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./mailServerOut.attributes'];(function(_0x51abc7,_0x404a0f){var _0x18fb20=function(_0xbf3fb7){while(--_0xbf3fb7){_0x51abc7['push'](_0x51abc7['shift']());}};_0x18fb20(++_0x404a0f);}(_0xda19,0xd5));var _0x9da1=function(_0x34cda7,_0xfd20d4){_0x34cda7=_0x34cda7-0x0;var _0x2ae028=_0xda19[_0x34cda7];return _0x2ae028;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));module[_0x9da1('0x7')]=function(_0x156faf,_0x2dcbc6){return _0x156faf[_0x9da1('0x8')](_0x9da1('0x9'),attributes,{'tableName':_0x9da1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','moment'];(function(_0x44ae18,_0x4e70bb){var _0x3d5bb5=function(_0x3b5531){while(--_0x3b5531){_0x44ae18['push'](_0x44ae18['shift']());}};_0x3d5bb5(++_0x4e70bb);}(_0xe14b,0x93));var _0xbe14=function(_0x53aa83,_0x578033){_0x53aa83=_0x53aa83-0x0;var _0x143ac8=_0xe14b[_0x53aa83];return _0x143ac8;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'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 a75792c..0643fc8 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 _0x7364=['error','code','MailServerOut,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x15f018,_0xb8c2d){var _0x555d81=function(_0xcc4ae9){while(--_0xcc4ae9){_0x15f018['push'](_0x15f018['shift']());}};_0x555d81(++_0xb8c2d);}(_0x7364,0xf6));var _0x4736=function(_0x5a6d53,_0x3a954d){_0x5a6d53=_0x5a6d53-0x0;var _0x4d677c=_0x7364[_0x5a6d53];return _0x4d677c;};'use strict';var _=require(_0x4736('0x0'));var util=require(_0x4736('0x1'));var moment=require(_0x4736('0x2'));var BPromise=require(_0x4736('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4736('0x4'));var db=require(_0x4736('0x5'))['db'];var utils=require(_0x4736('0x6'));var logger=require(_0x4736('0x7'))('rpc');var config=require(_0x4736('0x8'));var jayson=require(_0x4736('0x9'));var client=jayson[_0x4736('0xa')][_0x4736('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x112b9f,_0x2792fb,_0x41a10a){return new BPromise(function(_0x102271,_0x1efd6c){return client[_0x4736('0xc')](_0x112b9f,_0x41a10a)[_0x4736('0xd')](function(_0x3ece1f){logger[_0x4736('0xe')]('MailServerOut,\x20%s,\x20%s',_0x2792fb,'request\x20sent');logger[_0x4736('0xf')](_0x4736('0x10'),_0x2792fb,_0x4736('0x11'),JSON['stringify'](_0x3ece1f));if(_0x3ece1f[_0x4736('0x12')]){if(_0x3ece1f['error'][_0x4736('0x13')]===0x1f4){logger[_0x4736('0x12')](_0x4736('0x14'),_0x2792fb,_0x3ece1f[_0x4736('0x12')][_0x4736('0x15')]);return _0x1efd6c(_0x3ece1f[_0x4736('0x12')]['message']);}logger[_0x4736('0x12')]('MailServerOut,\x20%s,\x20%s',_0x2792fb,_0x3ece1f[_0x4736('0x12')][_0x4736('0x15')]);return _0x102271(_0x3ece1f[_0x4736('0x12')][_0x4736('0x15')]);}else{logger['info'](_0x4736('0x14'),_0x2792fb,_0x4736('0x11'));_0x102271(_0x3ece1f['result']['message']);}})['catch'](function(_0x4277c1){logger[_0x4736('0x12')](_0x4736('0x14'),_0x2792fb,_0x4277c1);_0x1efd6c(_0x4277c1);});});} \ No newline at end of file +var _0x5750=['request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','then','MailServerOut,\x20%s,\x20%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5750,0x137));var _0x0575=function(_0x3cc751,_0x38b8ff){_0x3cc751=_0x3cc751-0x0;var _0x3956a2=_0x5750[_0x3cc751];return _0x3956a2;};'use strict';var _=require(_0x0575('0x0'));var util=require(_0x0575('0x1'));var moment=require(_0x0575('0x2'));var BPromise=require('bluebird');var rs=require(_0x0575('0x3'));var fs=require('fs');var Redis=require(_0x0575('0x4'));var db=require(_0x0575('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0575('0x6'))('rpc');var config=require(_0x0575('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0575('0x8')][_0x0575('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ace45,_0x1ba465,_0x24f7f8){return new BPromise(function(_0x4fe769,_0x38cad5){return client['request'](_0x5ace45,_0x24f7f8)[_0x0575('0xa')](function(_0x4545eb){logger['info'](_0x0575('0xb'),_0x1ba465,_0x0575('0xc'));logger[_0x0575('0xd')](_0x0575('0xe'),_0x1ba465,_0x0575('0xc'),JSON['stringify'](_0x4545eb));if(_0x4545eb[_0x0575('0xf')]){if(_0x4545eb[_0x0575('0xf')]['code']===0x1f4){logger['error'](_0x0575('0xb'),_0x1ba465,_0x4545eb['error'][_0x0575('0x10')]);return _0x38cad5(_0x4545eb[_0x0575('0xf')][_0x0575('0x10')]);}logger[_0x0575('0xf')](_0x0575('0xb'),_0x1ba465,_0x4545eb[_0x0575('0xf')][_0x0575('0x10')]);return _0x4fe769(_0x4545eb[_0x0575('0xf')][_0x0575('0x10')]);}else{logger[_0x0575('0x11')]('MailServerOut,\x20%s,\x20%s',_0x1ba465,_0x0575('0xc'));_0x4fe769(_0x4545eb['result'][_0x0575('0x10')]);}})[_0x0575('0x12')](function(_0x31ec15){logger[_0x0575('0xf')](_0x0575('0xb'),_0x1ba465,_0x31ec15);_0x38cad5(_0x31ec15);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 86e37a6..eb7509d 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 _0xcb28=['../../config/environment','./mailSubstatus.controller','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xcb28,0x1c6));var _0x8cb2=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0xcb28[_0x414f67];return _0x338537;};'use strict';var multer=require(_0x8cb2('0x0'));var util=require(_0x8cb2('0x1'));var path=require(_0x8cb2('0x2'));var timeout=require(_0x8cb2('0x3'));var express=require(_0x8cb2('0x4'));var router=express[_0x8cb2('0x5')]();var auth=require(_0x8cb2('0x6'));var interaction=require(_0x8cb2('0x7'));var config=require(_0x8cb2('0x8'));var controller=require(_0x8cb2('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8cb2('0xa')]);router['get'](_0x8cb2('0xb'),auth[_0x8cb2('0xc')](),controller[_0x8cb2('0xd')]);router['get'](_0x8cb2('0xe'),auth[_0x8cb2('0xc')](),controller[_0x8cb2('0xf')]);router[_0x8cb2('0x10')]('/',auth[_0x8cb2('0xc')](),controller[_0x8cb2('0x11')]);router[_0x8cb2('0x12')]('/:id',auth[_0x8cb2('0xc')](),controller['update']);router[_0x8cb2('0x13')](_0x8cb2('0xe'),auth[_0x8cb2('0xc')](),controller[_0x8cb2('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4255=['express','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x27b0c4,_0xaf6d02){var _0xcb87b2=function(_0x2bd20f){while(--_0x2bd20f){_0x27b0c4['push'](_0x27b0c4['shift']());}};_0xcb87b2(++_0xaf6d02);}(_0x4255,0x18c));var _0x5425=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0x4255[_0x5b8b97];return _0x1fdf84;};'use strict';var multer=require('multer');var util=require(_0x5425('0x0'));var path=require(_0x5425('0x1'));var timeout=require(_0x5425('0x2'));var express=require(_0x5425('0x3'));var router=express['Router']();var auth=require(_0x5425('0x4'));var interaction=require(_0x5425('0x5'));var config=require('../../config/environment');var controller=require(_0x5425('0x6'));router[_0x5425('0x7')]('/',auth[_0x5425('0x8')](),controller[_0x5425('0x9')]);router[_0x5425('0x7')](_0x5425('0xa'),auth['isAuthenticated'](),controller[_0x5425('0xb')]);router['get'](_0x5425('0xc'),auth['isAuthenticated'](),controller[_0x5425('0xd')]);router['post']('/',auth[_0x5425('0x8')](),controller[_0x5425('0xe')]);router[_0x5425('0xf')]('/:id',auth[_0x5425('0x8')](),controller['update']);router[_0x5425('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5425('0x11')]);module[_0x5425('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 5185e49..66d14fb 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 _0x5430=['sequelize','exports','STRING','name'];(function(_0x11d411,_0x18677b){var _0x328df6=function(_0x45bc7d){while(--_0x45bc7d){_0x11d411['push'](_0x11d411['shift']());}};_0x328df6(++_0x18677b);}(_0x5430,0x10c));var _0x0543=function(_0x5d9efc,_0x2efe4f){_0x5d9efc=_0x5d9efc-0x0;var _0x40da50=_0x5430[_0x5d9efc];return _0x40da50;};'use strict';var Sequelize=require(_0x0543('0x0'));module[_0x0543('0x1')]={'name':{'type':Sequelize[_0x0543('0x2')],'unique':_0x0543('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0543('0x2')]}}; \ No newline at end of file +var _0xab00=['sequelize','exports','STRING'];(function(_0x463ed5,_0x1198a1){var _0x322f1c=function(_0x1ae939){while(--_0x1ae939){_0x463ed5['push'](_0x463ed5['shift']());}};_0x322f1c(++_0x1198a1);}(_0xab00,0x1b9));var _0x0ab0=function(_0x34f9f4,_0x24445f){_0x34f9f4=_0x34f9f4-0x0;var _0x5239c1=_0xab00[_0x34f9f4];return _0x5239c1;};'use strict';var Sequelize=require(_0x0ab0('0x0'));module[_0x0ab0('0x1')]={'name':{'type':Sequelize[_0x0ab0('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0ab0('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 3588dd5..a2c216b 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 _0x159e=['../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','type','merge','options','includeAll','findAll','rows','params','include','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','path','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x15400d,_0x349577){var _0x4d9a0e=function(_0x3de71f){while(--_0x3de71f){_0x15400d['push'](_0x15400d['shift']());}};_0x4d9a0e(++_0x349577);}(_0x159e,0x14c));var _0xe159=function(_0x5ec651,_0x597f24){_0x5ec651=_0x5ec651-0x0;var _0x38a1a4=_0x159e[_0x5ec651];return _0x38a1a4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe159('0x0'));var rimraf=require(_0xe159('0x1'));var zipdir=require(_0xe159('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe159('0x3'));var moment=require(_0xe159('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe159('0x5'));var sox=require('sox');var csv=require(_0xe159('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe159('0x7'));var jsforce=require(_0xe159('0x8'));var deskjs=require(_0xe159('0x9'));var toCsv=require(_0xe159('0x6'));var querystring=require(_0xe159('0xa'));var Papa=require('papaparse');var Redis=require(_0xe159('0xb'));var authService=require(_0xe159('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xe159('0xd'));var hardwareService=require(_0xe159('0xe'));var logger=require(_0xe159('0xf'))(_0xe159('0x10'));var utils=require(_0xe159('0x11'));var config=require(_0xe159('0x12'));var licenseUtil=require(_0xe159('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49c067,_0x33f4c6){_0x33f4c6=_0x33f4c6||0xcc;return function(_0x537ec3){if(_0x537ec3){return _0x49c067[_0xe159('0x14')](_0x33f4c6);}return _0x49c067[_0xe159('0x15')](_0x33f4c6)[_0xe159('0x16')]();};}function respondWithResult(_0x3f0e4b,_0x4b9891){_0x4b9891=_0x4b9891||0xc8;return function(_0x34af89){if(_0x34af89){return _0x3f0e4b[_0xe159('0x15')](_0x4b9891)['json'](_0x34af89);}};}function respondWithFilteredResult(_0x30fe06,_0x1b4e2e){return function(_0x410941){if(_0x410941){var _0x315542=_0x410941[_0xe159('0x17')],_0x3103c4=_0x1b4e2e[_0xe159('0x18')],_0x5754a3=_0x1b4e2e['offset']+_0x1b4e2e['limit'],_0x9f04ca;if(_0x5754a3>=_0x315542){_0x5754a3=_0x315542;_0x9f04ca=0xc8;}else{_0x9f04ca=0xce;}_0x30fe06[_0xe159('0x15')](_0x9f04ca);return _0x30fe06[_0xe159('0x19')](_0xe159('0x1a'),_0x3103c4+'-'+_0x5754a3+'/'+_0x315542)[_0xe159('0x1b')](_0x410941);}return null;};}function patchUpdates(_0xc61644){return function(_0x427560){try{jsonpatch[_0xe159('0x1c')](_0x427560,_0xc61644,!![]);}catch(_0x2081e5){return BPromise[_0xe159('0x1d')](_0x2081e5);}return _0x427560[_0xe159('0x1e')]();};}function saveUpdates(_0x185701,_0x4ff535){return function(_0x5249c8){if(_0x5249c8){return _0x5249c8[_0xe159('0x1f')](_0x185701)[_0xe159('0x20')](function(_0x576ae4){return _0x576ae4;});}return null;};}function removeEntity(_0x276ab1,_0x7cd585){return function(_0x1cb542){if(_0x1cb542){return _0x1cb542['destroy']()[_0xe159('0x20')](function(){_0x276ab1[_0xe159('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x89c74e,_0x3696bf){return function(_0x208550){if(!_0x208550){_0x89c74e[_0xe159('0x14')](0x194);}return _0x208550;};}function handleError(_0x2f1825,_0x5902f6){_0x5902f6=_0x5902f6||0x1f4;return function(_0x5535c5){logger[_0xe159('0x21')](_0x5535c5[_0xe159('0x22')]);if(_0x5535c5[_0xe159('0x23')]){delete _0x5535c5[_0xe159('0x23')];}_0x2f1825[_0xe159('0x15')](_0x5902f6)['send'](_0x5535c5);};}exports[_0xe159('0x24')]=function(_0x34a40a,_0x1e4684){var _0x11633a={},_0x1581b6={},_0x143bbb={'count':0x0,'rows':[]};var _0x44c75f=_[_0xe159('0x25')](db[_0xe159('0x26')][_0xe159('0x27')],function(_0x555bdf){return{'name':_0x555bdf[_0xe159('0x28')],'type':_0x555bdf['type'][_0xe159('0x29')]};});_0x1581b6[_0xe159('0x2a')]=_[_0xe159('0x25')](_0x44c75f,_0xe159('0x23'));_0x1581b6[_0xe159('0x2b')]=_[_0xe159('0x2c')](_0x34a40a[_0xe159('0x2b')]);_0x1581b6['filters']=_[_0xe159('0x2d')](_0x1581b6['model'],_0x1581b6[_0xe159('0x2b')]);_0x11633a[_0xe159('0x2e')]=_[_0xe159('0x2d')](_0x1581b6[_0xe159('0x2a')],qs[_0xe159('0x2f')](_0x34a40a[_0xe159('0x2b')][_0xe159('0x2f')]));_0x11633a[_0xe159('0x2e')]=_0x11633a[_0xe159('0x2e')][_0xe159('0x30')]?_0x11633a[_0xe159('0x2e')]:_0x1581b6[_0xe159('0x2a')];if(!_0x34a40a[_0xe159('0x2b')][_0xe159('0x31')](_0xe159('0x32'))){_0x11633a['limit']=qs[_0xe159('0x33')](_0x34a40a['query']['limit']);_0x11633a[_0xe159('0x18')]=qs['offset'](_0x34a40a[_0xe159('0x2b')][_0xe159('0x18')]);}_0x11633a['order']=qs[_0xe159('0x34')](_0x34a40a[_0xe159('0x2b')][_0xe159('0x34')]);_0x11633a[_0xe159('0x35')]=qs['filters'](_['pick'](_0x34a40a[_0xe159('0x2b')],_0x1581b6[_0xe159('0x36')]),_0x44c75f);if(_0x34a40a[_0xe159('0x2b')][_0xe159('0x37')]){_0x11633a[_0xe159('0x35')]=_['merge'](_0x11633a[_0xe159('0x35')],{'$or':_[_0xe159('0x25')](_0x44c75f,function(_0x47f21c){if(_0x47f21c[_0xe159('0x38')]!=='VIRTUAL'){var _0x1dc39e={};_0x1dc39e[_0x47f21c[_0xe159('0x23')]]={'$like':'%'+_0x34a40a[_0xe159('0x2b')][_0xe159('0x37')]+'%'};return _0x1dc39e;}})});}_0x11633a=_[_0xe159('0x39')]({},_0x11633a,_0x34a40a[_0xe159('0x3a')]);var _0x2cb6f1={'where':_0x11633a[_0xe159('0x35')]};return db[_0xe159('0x26')][_0xe159('0x17')](_0x2cb6f1)[_0xe159('0x20')](function(_0x17c77d){_0x143bbb[_0xe159('0x17')]=_0x17c77d;if(_0x34a40a['query'][_0xe159('0x3b')]){_0x11633a['include']=[{'all':!![]}];}return db['MailSubstatus'][_0xe159('0x3c')](_0x11633a);})[_0xe159('0x20')](function(_0x52752d){_0x143bbb[_0xe159('0x3d')]=_0x52752d;return _0x143bbb;})[_0xe159('0x20')](respondWithFilteredResult(_0x1e4684,_0x11633a))['catch'](handleError(_0x1e4684,null));};exports['show']=function(_0x260e34,_0x5dcacb){var _0x4eaa97={'raw':!![],'where':{'id':_0x260e34[_0xe159('0x3e')]['id']}},_0x53cafd={};_0x53cafd[_0xe159('0x2a')]=_[_0xe159('0x2c')](db[_0xe159('0x26')]['rawAttributes']);_0x53cafd['query']=_[_0xe159('0x2c')](_0x260e34[_0xe159('0x2b')]);_0x53cafd[_0xe159('0x36')]=_[_0xe159('0x2d')](_0x53cafd[_0xe159('0x2a')],_0x53cafd[_0xe159('0x2b')]);_0x4eaa97[_0xe159('0x2e')]=_[_0xe159('0x2d')](_0x53cafd['model'],qs[_0xe159('0x2f')](_0x260e34['query']['fields']));_0x4eaa97[_0xe159('0x2e')]=_0x4eaa97[_0xe159('0x2e')][_0xe159('0x30')]?_0x4eaa97[_0xe159('0x2e')]:_0x53cafd['model'];if(_0x260e34[_0xe159('0x2b')]['includeAll']){_0x4eaa97[_0xe159('0x3f')]=[{'all':!![]}];}_0x4eaa97=_[_0xe159('0x39')]({},_0x4eaa97,_0x260e34['options']);return db[_0xe159('0x26')][_0xe159('0x40')](_0x4eaa97)[_0xe159('0x20')](handleEntityNotFound(_0x5dcacb,null))['then'](respondWithResult(_0x5dcacb,null))[_0xe159('0x41')](handleError(_0x5dcacb,null));};exports['create']=function(_0x35b1d0,_0x5e1e90){return db[_0xe159('0x26')][_0xe159('0x42')](_0x35b1d0[_0xe159('0x43')],{})['then'](respondWithResult(_0x5e1e90,0xc9))[_0xe159('0x41')](handleError(_0x5e1e90,null));};exports[_0xe159('0x1f')]=function(_0x2271bf,_0x3d8f6a){if(_0x2271bf[_0xe159('0x43')]['id']){delete _0x2271bf[_0xe159('0x43')]['id'];}return db[_0xe159('0x26')]['find']({'where':{'id':_0x2271bf['params']['id']}})[_0xe159('0x20')](handleEntityNotFound(_0x3d8f6a,null))[_0xe159('0x20')](saveUpdates(_0x2271bf[_0xe159('0x43')],null))[_0xe159('0x20')](respondWithResult(_0x3d8f6a,null))[_0xe159('0x41')](handleError(_0x3d8f6a,null));};exports[_0xe159('0x44')]=function(_0x45aecc,_0x4a1432){return db[_0xe159('0x26')][_0xe159('0x40')]({'where':{'id':_0x45aecc[_0xe159('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4a1432,null))[_0xe159('0x20')](removeEntity(_0x4a1432,null))[_0xe159('0x41')](handleError(_0x4a1432,null));};exports[_0xe159('0x45')]=function(_0x1c096f,_0x22ce8f){return db[_0xe159('0x26')]['describe']()['then'](respondWithResult(_0x22ce8f,null))[_0xe159('0x41')](handleError(_0x22ce8f,null));}; \ No newline at end of file +var _0xa59d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','Content-Range','reject','update','then','sendStatus','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','type','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa59d,0xc9));var _0xda59=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa59d[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xda59('0x0'));var emlformat=require(_0xda59('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xda59('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda59('0x3'));var moment=require(_0xda59('0x4'));var BPromise=require(_0xda59('0x5'));var Mustache=require(_0xda59('0x6'));var util=require('util');var path=require(_0xda59('0x7'));var sox=require(_0xda59('0x8'));var csv=require('to-csv');var ejs=require(_0xda59('0x9'));var fs=require('fs');var _=require(_0xda59('0xa'));var squel=require(_0xda59('0xb'));var crypto=require(_0xda59('0xc'));var jsforce=require(_0xda59('0xd'));var deskjs=require(_0xda59('0xe'));var toCsv=require(_0xda59('0xf'));var querystring=require(_0xda59('0x10'));var Papa=require(_0xda59('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xda59('0x12'));var as=require(_0xda59('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda59('0x14'))('api');var utils=require(_0xda59('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xda59('0x16'))['db'];function respondWithStatusCode(_0x2d3280,_0x3469b5){_0x3469b5=_0x3469b5||0xcc;return function(_0x1a6c04){if(_0x1a6c04){return _0x2d3280['sendStatus'](_0x3469b5);}return _0x2d3280[_0xda59('0x17')](_0x3469b5)[_0xda59('0x18')]();};}function respondWithResult(_0x44aa66,_0x1f49e3){_0x1f49e3=_0x1f49e3||0xc8;return function(_0x4600e8){if(_0x4600e8){return _0x44aa66[_0xda59('0x17')](_0x1f49e3)[_0xda59('0x19')](_0x4600e8);}};}function respondWithFilteredResult(_0x49c5de,_0x5cd9a2){return function(_0x1df04b){if(_0x1df04b){var _0x431d7d=_0x1df04b[_0xda59('0x1a')],_0x5edc61=_0x5cd9a2[_0xda59('0x1b')],_0x1935e3=_0x5cd9a2[_0xda59('0x1b')]+_0x5cd9a2['limit'],_0x10d0f1;if(_0x1935e3>=_0x431d7d){_0x1935e3=_0x431d7d;_0x10d0f1=0xc8;}else{_0x10d0f1=0xce;}_0x49c5de[_0xda59('0x17')](_0x10d0f1);return _0x49c5de['set'](_0xda59('0x1c'),_0x5edc61+'-'+_0x1935e3+'/'+_0x431d7d)[_0xda59('0x19')](_0x1df04b);}return null;};}function patchUpdates(_0x18017b){return function(_0x142715){try{jsonpatch['apply'](_0x142715,_0x18017b,!![]);}catch(_0x6c4bd5){return BPromise[_0xda59('0x1d')](_0x6c4bd5);}return _0x142715['save']();};}function saveUpdates(_0x160bc,_0x554f98){return function(_0x48af99){if(_0x48af99){return _0x48af99[_0xda59('0x1e')](_0x160bc)[_0xda59('0x1f')](function(_0xfb4534){return _0xfb4534;});}return null;};}function removeEntity(_0xde70f6,_0xbc6709){return function(_0x110803){if(_0x110803){return _0x110803['destroy']()['then'](function(){_0xde70f6[_0xda59('0x17')](0xcc)[_0xda59('0x18')]();});}};}function handleEntityNotFound(_0x28cae9,_0x1ad053){return function(_0xa11c59){if(!_0xa11c59){_0x28cae9[_0xda59('0x20')](0x194);}return _0xa11c59;};}function handleError(_0x39aaa9,_0x225d87){_0x225d87=_0x225d87||0x1f4;return function(_0x2329d4){logger[_0xda59('0x21')](_0x2329d4[_0xda59('0x22')]);if(_0x2329d4[_0xda59('0x23')]){delete _0x2329d4['name'];}_0x39aaa9[_0xda59('0x17')](_0x225d87)[_0xda59('0x24')](_0x2329d4);};}exports[_0xda59('0x25')]=function(_0x274d74,_0x3da8b8){var _0x54b5dc={},_0x4f1e82={},_0x3f3455={'count':0x0,'rows':[]};var _0x3a9bf1=_['map'](db[_0xda59('0x26')][_0xda59('0x27')],function(_0x8ac8b1){return{'name':_0x8ac8b1[_0xda59('0x28')],'type':_0x8ac8b1['type'][_0xda59('0x29')]};});_0x4f1e82[_0xda59('0x2a')]=_['map'](_0x3a9bf1,_0xda59('0x23'));_0x4f1e82['query']=_[_0xda59('0x2b')](_0x274d74[_0xda59('0x2c')]);_0x4f1e82[_0xda59('0x2d')]=_['intersection'](_0x4f1e82['model'],_0x4f1e82['query']);_0x54b5dc['attributes']=_[_0xda59('0x2e')](_0x4f1e82[_0xda59('0x2a')],qs[_0xda59('0x2f')](_0x274d74[_0xda59('0x2c')][_0xda59('0x2f')]));_0x54b5dc['attributes']=_0x54b5dc[_0xda59('0x30')][_0xda59('0x31')]?_0x54b5dc[_0xda59('0x30')]:_0x4f1e82['model'];if(!_0x274d74[_0xda59('0x2c')][_0xda59('0x32')](_0xda59('0x33'))){_0x54b5dc[_0xda59('0x34')]=qs[_0xda59('0x34')](_0x274d74[_0xda59('0x2c')][_0xda59('0x34')]);_0x54b5dc[_0xda59('0x1b')]=qs[_0xda59('0x1b')](_0x274d74[_0xda59('0x2c')][_0xda59('0x1b')]);}_0x54b5dc['order']=qs[_0xda59('0x35')](_0x274d74[_0xda59('0x2c')][_0xda59('0x35')]);_0x54b5dc[_0xda59('0x36')]=qs[_0xda59('0x2d')](_[_0xda59('0x37')](_0x274d74[_0xda59('0x2c')],_0x4f1e82[_0xda59('0x2d')]),_0x3a9bf1);if(_0x274d74[_0xda59('0x2c')][_0xda59('0x38')]){_0x54b5dc['where']=_[_0xda59('0x39')](_0x54b5dc['where'],{'$or':_[_0xda59('0x3a')](_0x3a9bf1,function(_0x1fdb42){if(_0x1fdb42[_0xda59('0x3b')]!==_0xda59('0x3c')){var _0x20454a={};_0x20454a[_0x1fdb42['name']]={'$like':'%'+_0x274d74[_0xda59('0x2c')][_0xda59('0x38')]+'%'};return _0x20454a;}})});}_0x54b5dc=_[_0xda59('0x39')]({},_0x54b5dc,_0x274d74[_0xda59('0x3d')]);var _0x4a6f54={'where':_0x54b5dc[_0xda59('0x36')]};return db[_0xda59('0x26')]['count'](_0x4a6f54)['then'](function(_0x129404){_0x3f3455[_0xda59('0x1a')]=_0x129404;if(_0x274d74[_0xda59('0x2c')]['includeAll']){_0x54b5dc[_0xda59('0x3e')]=[{'all':!![]}];}return db[_0xda59('0x26')]['findAll'](_0x54b5dc);})['then'](function(_0x276812){_0x3f3455[_0xda59('0x3f')]=_0x276812;return _0x3f3455;})[_0xda59('0x1f')](respondWithFilteredResult(_0x3da8b8,_0x54b5dc))[_0xda59('0x40')](handleError(_0x3da8b8,null));};exports[_0xda59('0x41')]=function(_0x5bc900,_0x1445ae){var _0x2782ff={'raw':!![],'where':{'id':_0x5bc900[_0xda59('0x42')]['id']}},_0x4e97ac={};_0x4e97ac[_0xda59('0x2a')]=_[_0xda59('0x2b')](db[_0xda59('0x26')][_0xda59('0x27')]);_0x4e97ac[_0xda59('0x2c')]=_['keys'](_0x5bc900[_0xda59('0x2c')]);_0x4e97ac[_0xda59('0x2d')]=_['intersection'](_0x4e97ac[_0xda59('0x2a')],_0x4e97ac[_0xda59('0x2c')]);_0x2782ff[_0xda59('0x30')]=_[_0xda59('0x2e')](_0x4e97ac[_0xda59('0x2a')],qs[_0xda59('0x2f')](_0x5bc900['query'][_0xda59('0x2f')]));_0x2782ff[_0xda59('0x30')]=_0x2782ff[_0xda59('0x30')][_0xda59('0x31')]?_0x2782ff['attributes']:_0x4e97ac[_0xda59('0x2a')];if(_0x5bc900['query'][_0xda59('0x43')]){_0x2782ff['include']=[{'all':!![]}];}_0x2782ff=_[_0xda59('0x39')]({},_0x2782ff,_0x5bc900[_0xda59('0x3d')]);return db[_0xda59('0x26')][_0xda59('0x44')](_0x2782ff)[_0xda59('0x1f')](handleEntityNotFound(_0x1445ae,null))[_0xda59('0x1f')](respondWithResult(_0x1445ae,null))['catch'](handleError(_0x1445ae,null));};exports['create']=function(_0x3cd068,_0x11f601){return db[_0xda59('0x26')][_0xda59('0x45')](_0x3cd068[_0xda59('0x46')],{})[_0xda59('0x1f')](respondWithResult(_0x11f601,0xc9))[_0xda59('0x40')](handleError(_0x11f601,null));};exports[_0xda59('0x1e')]=function(_0x5ad975,_0x5c4f88){if(_0x5ad975['body']['id']){delete _0x5ad975[_0xda59('0x46')]['id'];}return db[_0xda59('0x26')][_0xda59('0x44')]({'where':{'id':_0x5ad975[_0xda59('0x42')]['id']}})[_0xda59('0x1f')](handleEntityNotFound(_0x5c4f88,null))[_0xda59('0x1f')](saveUpdates(_0x5ad975[_0xda59('0x46')],null))[_0xda59('0x1f')](respondWithResult(_0x5c4f88,null))[_0xda59('0x40')](handleError(_0x5c4f88,null));};exports[_0xda59('0x47')]=function(_0x386661,_0x52d778){return db[_0xda59('0x26')]['find']({'where':{'id':_0x386661[_0xda59('0x42')]['id']}})[_0xda59('0x1f')](handleEntityNotFound(_0x52d778,null))[_0xda59('0x1f')](removeEntity(_0x52d778,null))[_0xda59('0x40')](handleError(_0x52d778,null));};exports[_0xda59('0x48')]=function(_0x4f6128,_0x26e5e9){return db['MailSubstatus'][_0xda59('0x48')]()['then'](respondWithResult(_0x26e5e9,null))['catch'](handleError(_0x26e5e9,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index bf4d48c..7c89d76 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 _0x65c9=['bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','mail_substatuses','lodash','util','api','moment'];(function(_0x3a68c9,_0xc6e6b2){var _0x2f0284=function(_0x50f70d){while(--_0x50f70d){_0x3a68c9['push'](_0x3a68c9['shift']());}};_0x2f0284(++_0xc6e6b2);}(_0x65c9,0x182));var _0x965c=function(_0xdfce51,_0x455ed8){_0xdfce51=_0xdfce51-0x0;var _0x210798=_0x65c9[_0xdfce51];return _0x210798;};'use strict';var _=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var logger=require('../../config/logger')(_0x965c('0x2'));var moment=require(_0x965c('0x3'));var BPromise=require(_0x965c('0x4'));var rp=require(_0x965c('0x5'));var fs=require('fs');var path=require(_0x965c('0x6'));var rimraf=require(_0x965c('0x7'));var config=require(_0x965c('0x8'));var attributes=require(_0x965c('0x9'));module[_0x965c('0xa')]=function(_0xbda9ee,_0xb9c834){return _0xbda9ee[_0x965c('0xb')]('MailSubstatus',attributes,{'tableName':_0x965c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96f2=['request-promise','path','rimraf','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','../../config/logger','api','moment'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x96f2,0xb0));var _0x296f=function(_0x2d2b3d,_0x21f823){_0x2d2b3d=_0x2d2b3d-0x0;var _0x46fead=_0x96f2[_0x2d2b3d];return _0x46fead;};'use strict';var _=require(_0x296f('0x0'));var util=require('util');var logger=require(_0x296f('0x1'))(_0x296f('0x2'));var moment=require(_0x296f('0x3'));var BPromise=require('bluebird');var rp=require(_0x296f('0x4'));var fs=require('fs');var path=require(_0x296f('0x5'));var rimraf=require(_0x296f('0x6'));var config=require('../../config/environment');var attributes=require(_0x296f('0x7'));module[_0x296f('0x8')]=function(_0x4c3626,_0x4c55c7){return _0x4c3626[_0x296f('0x9')](_0x296f('0xa'),attributes,{'tableName':_0x296f('0xb'),'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 f60afb2..a7416fa 100644 --- a/server/api/mailSubstatus/mailSubstatus.rpc.js +++ b/server/api/mailSubstatus/mailSubstatus.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a9a=['MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x15b192,_0x38c235){var _0x396e73=function(_0x4ba480){while(--_0x4ba480){_0x15b192['push'](_0x15b192['shift']());}};_0x396e73(++_0x38c235);}(_0x0a9a,0x183));var _0xa0a9=function(_0x410234,_0x45f58c){_0x410234=_0x410234-0x0;var _0x1824fd=_0x0a9a[_0x410234];return _0x1824fd;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0xbdb7[_0x204eb7];return _0x37e444;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index fe49def..d6f09de 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 _0x8ca8=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','delete','destroy','multer'];(function(_0x3486c8,_0x5758a2){var _0x44a444=function(_0x14052a){while(--_0x14052a){_0x3486c8['push'](_0x3486c8['shift']());}};_0x44a444(++_0x5758a2);}(_0x8ca8,0x13a));var _0x88ca=function(_0x2f1c6d,_0x1abb45){_0x2f1c6d=_0x2f1c6d-0x0;var _0x18da40=_0x8ca8[_0x2f1c6d];return _0x18da40;};'use strict';var multer=require(_0x88ca('0x0'));var util=require(_0x88ca('0x1'));var path=require(_0x88ca('0x2'));var timeout=require(_0x88ca('0x3'));var express=require(_0x88ca('0x4'));var router=express[_0x88ca('0x5')]();var auth=require(_0x88ca('0x6'));var interaction=require(_0x88ca('0x7'));var config=require(_0x88ca('0x8'));var controller=require(_0x88ca('0x9'));router['get']('/',auth[_0x88ca('0xa')](),controller[_0x88ca('0xb')]);router[_0x88ca('0xc')](_0x88ca('0xd'),auth[_0x88ca('0xa')](),controller[_0x88ca('0xe')]);router['get'](_0x88ca('0xf'),auth[_0x88ca('0xa')](),controller[_0x88ca('0x10')]);router['post']('/',auth[_0x88ca('0xa')](),controller[_0x88ca('0x11')]);router[_0x88ca('0x12')]('/:id',auth[_0x88ca('0xa')](),controller['update']);router[_0x88ca('0x13')](_0x88ca('0xf'),auth[_0x88ca('0xa')](),controller[_0x88ca('0x14')]);module['exports']=router; \ No newline at end of file +var _0x08ca=['index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x154deb,_0x885c32){var _0x2fe4af=function(_0x31aab2){while(--_0x31aab2){_0x154deb['push'](_0x154deb['shift']());}};_0x2fe4af(++_0x885c32);}(_0x08ca,0x131));var _0xa08c=function(_0x1f3ad4,_0x50b263){_0x1f3ad4=_0x1f3ad4-0x0;var _0x25cd32=_0x08ca[_0x1f3ad4];return _0x25cd32;};'use strict';var multer=require('multer');var util=require(_0xa08c('0x0'));var path=require(_0xa08c('0x1'));var timeout=require(_0xa08c('0x2'));var express=require(_0xa08c('0x3'));var router=express[_0xa08c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa08c('0x5'));var config=require(_0xa08c('0x6'));var controller=require(_0xa08c('0x7'));router[_0xa08c('0x8')]('/',auth[_0xa08c('0x9')](),controller[_0xa08c('0xa')]);router[_0xa08c('0x8')](_0xa08c('0xb'),auth[_0xa08c('0x9')](),controller[_0xa08c('0xc')]);router[_0xa08c('0x8')](_0xa08c('0xd'),auth[_0xa08c('0x9')](),controller[_0xa08c('0xe')]);router[_0xa08c('0xf')]('/',auth[_0xa08c('0x9')](),controller['create']);router[_0xa08c('0x10')](_0xa08c('0xd'),auth[_0xa08c('0x9')](),controller[_0xa08c('0x11')]);router[_0xa08c('0x12')](_0xa08c('0xd'),auth[_0xa08c('0x9')](),controller[_0xa08c('0x13')]);module[_0xa08c('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 04fe5c3..3a89aca 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 _0xcb93=['agent','queue','DATE','NOW','sequelize','exports','ENUM','account'];(function(_0x4cba2d,_0x4b33af){var _0x228b0d=function(_0x5ef570){while(--_0x5ef570){_0x4cba2d['push'](_0x4cba2d['shift']());}};_0x228b0d(++_0x4b33af);}(_0xcb93,0x1a4));var _0x3cb9=function(_0x3f15c0,_0x57b955){_0x3f15c0=_0x3f15c0-0x0;var _0x3ee023=_0xcb93[_0x3f15c0];return _0x3ee023;};'use strict';var moment=require('moment');var Sequelize=require(_0x3cb9('0x0'));module[_0x3cb9('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3cb9('0x2')](_0x3cb9('0x3'),_0x3cb9('0x4'),_0x3cb9('0x5')),'allowNull':![],'defaultValue':_0x3cb9('0x5')},'transferredAt':{'type':Sequelize[_0x3cb9('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x3cb9('0x7')]}}; \ No newline at end of file +var _0xac10=['account','agent','queue','DATE','NOW','moment','exports','STRING','ENUM'];(function(_0x4ce4ad,_0x18acbd){var _0x584e23=function(_0x278cdd){while(--_0x278cdd){_0x4ce4ad['push'](_0x4ce4ad['shift']());}};_0x584e23(++_0x18acbd);}(_0xac10,0xd4));var _0x0ac1=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0xac10[_0x1c510a];return _0x23cedd;};'use strict';var moment=require(_0x0ac1('0x0'));var Sequelize=require('sequelize');module[_0x0ac1('0x1')]={'uniqueid':{'type':Sequelize[_0x0ac1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0ac1('0x3')](_0x0ac1('0x4'),_0x0ac1('0x5'),_0x0ac1('0x6')),'allowNull':![],'defaultValue':_0x0ac1('0x6')},'transferredAt':{'type':Sequelize[_0x0ac1('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x0ac1('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 49ead88..c369093 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 _0x3f71=['stack','name','status','index','map','rawAttributes','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','type','merge','options','MailTransferReport','includeAll','include','findAll','rows','catch','show','length','create','body','params','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','end'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x3f71,0x10d));var _0x13f7=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x3f71[_0xd09668];return _0x68726;};'use strict';var pdf=require(_0x13f7('0x0'));var emlformat=require(_0x13f7('0x1'));var rimraf=require(_0x13f7('0x2'));var zipdir=require(_0x13f7('0x3'));var jsonpatch=require(_0x13f7('0x4'));var rp=require(_0x13f7('0x5'));var moment=require(_0x13f7('0x6'));var BPromise=require(_0x13f7('0x7'));var Mustache=require(_0x13f7('0x8'));var util=require(_0x13f7('0x9'));var path=require('path');var sox=require(_0x13f7('0xa'));var csv=require('to-csv');var ejs=require(_0x13f7('0xb'));var fs=require('fs');var _=require(_0x13f7('0xc'));var squel=require(_0x13f7('0xd'));var crypto=require('crypto');var jsforce=require(_0x13f7('0xe'));var deskjs=require(_0x13f7('0xf'));var toCsv=require(_0x13f7('0x10'));var querystring=require('querystring');var Papa=require(_0x13f7('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x13f7('0x12'));var as=require(_0x13f7('0x13'));var hardwareService=require(_0x13f7('0x14'));var logger=require(_0x13f7('0x15'))(_0x13f7('0x16'));var utils=require(_0x13f7('0x17'));var config=require(_0x13f7('0x18'));var licenseUtil=require(_0x13f7('0x19'));var db=require(_0x13f7('0x1a'))['db'];function respondWithStatusCode(_0x390fd8,_0x571ab2){_0x571ab2=_0x571ab2||0xcc;return function(_0x774c0a){if(_0x774c0a){return _0x390fd8[_0x13f7('0x1b')](_0x571ab2);}return _0x390fd8['status'](_0x571ab2)['end']();};}function respondWithResult(_0x40dfd3,_0x42ecf1){_0x42ecf1=_0x42ecf1||0xc8;return function(_0x5ecc1c){if(_0x5ecc1c){return _0x40dfd3['status'](_0x42ecf1)[_0x13f7('0x1c')](_0x5ecc1c);}};}function respondWithFilteredResult(_0x57a432,_0x324052){return function(_0x559156){if(_0x559156){var _0xd87f1=_0x559156[_0x13f7('0x1d')],_0x2745cc=_0x324052[_0x13f7('0x1e')],_0x44f5da=_0x324052['offset']+_0x324052['limit'],_0x5838a7;if(_0x44f5da>=_0xd87f1){_0x44f5da=_0xd87f1;_0x5838a7=0xc8;}else{_0x5838a7=0xce;}_0x57a432['status'](_0x5838a7);return _0x57a432[_0x13f7('0x1f')](_0x13f7('0x20'),_0x2745cc+'-'+_0x44f5da+'/'+_0xd87f1)[_0x13f7('0x1c')](_0x559156);}return null;};}function patchUpdates(_0x4ac8b3){return function(_0x5d0ca7){try{jsonpatch[_0x13f7('0x21')](_0x5d0ca7,_0x4ac8b3,!![]);}catch(_0x4c8e3f){return BPromise[_0x13f7('0x22')](_0x4c8e3f);}return _0x5d0ca7['save']();};}function saveUpdates(_0x129dd6,_0x532493){return function(_0x4ea5dc){if(_0x4ea5dc){return _0x4ea5dc[_0x13f7('0x23')](_0x129dd6)[_0x13f7('0x24')](function(_0x316994){return _0x316994;});}return null;};}function removeEntity(_0x4e325d,_0x22c930){return function(_0x4b475a){if(_0x4b475a){return _0x4b475a[_0x13f7('0x25')]()[_0x13f7('0x24')](function(){_0x4e325d['status'](0xcc)[_0x13f7('0x26')]();});}};}function handleEntityNotFound(_0x4ed019,_0x2372d9){return function(_0x5b04ac){if(!_0x5b04ac){_0x4ed019['sendStatus'](0x194);}return _0x5b04ac;};}function handleError(_0x51113a,_0x31bf1d){_0x31bf1d=_0x31bf1d||0x1f4;return function(_0x34d562){logger['error'](_0x34d562[_0x13f7('0x27')]);if(_0x34d562[_0x13f7('0x28')]){delete _0x34d562[_0x13f7('0x28')];}_0x51113a[_0x13f7('0x29')](_0x31bf1d)['send'](_0x34d562);};}exports[_0x13f7('0x2a')]=function(_0x2230bc,_0x3b2760){var _0xc2302={},_0x45c346={},_0x4f3135={'count':0x0,'rows':[]};var _0xd432a0=_[_0x13f7('0x2b')](db['MailTransferReport'][_0x13f7('0x2c')],function(_0x24ba9b){return{'name':_0x24ba9b['fieldName'],'type':_0x24ba9b['type'][_0x13f7('0x2d')]};});_0x45c346[_0x13f7('0x2e')]=_[_0x13f7('0x2b')](_0xd432a0,'name');_0x45c346['query']=_[_0x13f7('0x2f')](_0x2230bc[_0x13f7('0x30')]);_0x45c346['filters']=_['intersection'](_0x45c346[_0x13f7('0x2e')],_0x45c346[_0x13f7('0x30')]);_0xc2302[_0x13f7('0x31')]=_[_0x13f7('0x32')](_0x45c346[_0x13f7('0x2e')],qs[_0x13f7('0x33')](_0x2230bc[_0x13f7('0x30')][_0x13f7('0x33')]));_0xc2302[_0x13f7('0x31')]=_0xc2302[_0x13f7('0x31')]['length']?_0xc2302['attributes']:_0x45c346[_0x13f7('0x2e')];if(!_0x2230bc['query'][_0x13f7('0x34')](_0x13f7('0x35'))){_0xc2302[_0x13f7('0x36')]=qs[_0x13f7('0x36')](_0x2230bc['query'][_0x13f7('0x36')]);_0xc2302['offset']=qs['offset'](_0x2230bc[_0x13f7('0x30')][_0x13f7('0x1e')]);}_0xc2302[_0x13f7('0x37')]=qs[_0x13f7('0x38')](_0x2230bc[_0x13f7('0x30')][_0x13f7('0x38')]);_0xc2302[_0x13f7('0x39')]=qs[_0x13f7('0x3a')](_[_0x13f7('0x3b')](_0x2230bc['query'],_0x45c346[_0x13f7('0x3a')]),_0xd432a0);if(_0x2230bc['query'][_0x13f7('0x3c')]){_0xc2302['where']=_['merge'](_0xc2302[_0x13f7('0x39')],{'$or':_['map'](_0xd432a0,function(_0x268f1b){if(_0x268f1b[_0x13f7('0x3d')]!=='VIRTUAL'){var _0x4f8649={};_0x4f8649[_0x268f1b[_0x13f7('0x28')]]={'$like':'%'+_0x2230bc[_0x13f7('0x30')][_0x13f7('0x3c')]+'%'};return _0x4f8649;}})});}_0xc2302=_[_0x13f7('0x3e')]({},_0xc2302,_0x2230bc[_0x13f7('0x3f')]);var _0x1b9d6e={'where':_0xc2302['where']};return db[_0x13f7('0x40')][_0x13f7('0x1d')](_0x1b9d6e)[_0x13f7('0x24')](function(_0x236568){_0x4f3135[_0x13f7('0x1d')]=_0x236568;if(_0x2230bc[_0x13f7('0x30')][_0x13f7('0x41')]){_0xc2302[_0x13f7('0x42')]=[{'all':!![]}];}return db[_0x13f7('0x40')][_0x13f7('0x43')](_0xc2302);})[_0x13f7('0x24')](function(_0x2ce8f6){_0x4f3135[_0x13f7('0x44')]=_0x2ce8f6;return _0x4f3135;})['then'](respondWithFilteredResult(_0x3b2760,_0xc2302))[_0x13f7('0x45')](handleError(_0x3b2760,null));};exports[_0x13f7('0x46')]=function(_0x58b03b,_0x2c7005){var _0x2f6320={'raw':!![],'where':{'id':_0x58b03b['params']['id']}},_0x3bb02d={};_0x3bb02d['model']=_['keys'](db[_0x13f7('0x40')]['rawAttributes']);_0x3bb02d['query']=_[_0x13f7('0x2f')](_0x58b03b[_0x13f7('0x30')]);_0x3bb02d['filters']=_[_0x13f7('0x32')](_0x3bb02d[_0x13f7('0x2e')],_0x3bb02d[_0x13f7('0x30')]);_0x2f6320['attributes']=_['intersection'](_0x3bb02d[_0x13f7('0x2e')],qs[_0x13f7('0x33')](_0x58b03b[_0x13f7('0x30')][_0x13f7('0x33')]));_0x2f6320[_0x13f7('0x31')]=_0x2f6320['attributes'][_0x13f7('0x47')]?_0x2f6320[_0x13f7('0x31')]:_0x3bb02d[_0x13f7('0x2e')];if(_0x58b03b['query']['includeAll']){_0x2f6320[_0x13f7('0x42')]=[{'all':!![]}];}_0x2f6320=_[_0x13f7('0x3e')]({},_0x2f6320,_0x58b03b[_0x13f7('0x3f')]);return db[_0x13f7('0x40')]['find'](_0x2f6320)[_0x13f7('0x24')](handleEntityNotFound(_0x2c7005,null))[_0x13f7('0x24')](respondWithResult(_0x2c7005,null))['catch'](handleError(_0x2c7005,null));};exports[_0x13f7('0x48')]=function(_0x2989c0,_0x10acf1){return db[_0x13f7('0x40')]['create'](_0x2989c0['body'],{})['then'](respondWithResult(_0x10acf1,0xc9))[_0x13f7('0x45')](handleError(_0x10acf1,null));};exports['update']=function(_0x2ad4c8,_0x3087bc){if(_0x2ad4c8['body']['id']){delete _0x2ad4c8[_0x13f7('0x49')]['id'];}return db[_0x13f7('0x40')]['find']({'where':{'id':_0x2ad4c8[_0x13f7('0x4a')]['id']}})[_0x13f7('0x24')](handleEntityNotFound(_0x3087bc,null))[_0x13f7('0x24')](saveUpdates(_0x2ad4c8[_0x13f7('0x49')],null))[_0x13f7('0x24')](respondWithResult(_0x3087bc,null))[_0x13f7('0x45')](handleError(_0x3087bc,null));};exports[_0x13f7('0x25')]=function(_0x477c44,_0x6b39ac){return db[_0x13f7('0x40')][_0x13f7('0x4b')]({'where':{'id':_0x477c44[_0x13f7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x6b39ac,null))['then'](removeEntity(_0x6b39ac,null))[_0x13f7('0x45')](handleError(_0x6b39ac,null));};exports[_0x13f7('0x4c')]=function(_0x5e8e01,_0x9da8f2){return db['MailTransferReport']['describe']()['then'](respondWithResult(_0x9da8f2,null))['catch'](handleError(_0x9da8f2,null));}; \ No newline at end of file +var _0x6f54=['catch','keys','length','includeAll','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows'];(function(_0x52a377,_0x4963fe){var _0x47c15b=function(_0x65bae4){while(--_0x65bae4){_0x52a377['push'](_0x52a377['shift']());}};_0x47c15b(++_0x4963fe);}(_0x6f54,0x9d));var _0x46f5=function(_0x21f65e,_0x580973){_0x21f65e=_0x21f65e-0x0;var _0x5e2cd=_0x6f54[_0x21f65e];return _0x5e2cd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x46f5('0x0'));var rimraf=require(_0x46f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46f5('0x2'));var rp=require(_0x46f5('0x3'));var moment=require(_0x46f5('0x4'));var BPromise=require(_0x46f5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x46f5('0x6'));var sox=require('sox');var csv=require(_0x46f5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x46f5('0x8'));var crypto=require(_0x46f5('0x9'));var jsforce=require(_0x46f5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x46f5('0x7'));var querystring=require(_0x46f5('0xb'));var Papa=require(_0x46f5('0xc'));var Redis=require(_0x46f5('0xd'));var authService=require(_0x46f5('0xe'));var qs=require(_0x46f5('0xf'));var as=require(_0x46f5('0x10'));var hardwareService=require(_0x46f5('0x11'));var logger=require('../../config/logger')(_0x46f5('0x12'));var utils=require('../../config/utils');var config=require(_0x46f5('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x46f5('0x14'))['db'];function respondWithStatusCode(_0x16785f,_0x336a2e){_0x336a2e=_0x336a2e||0xcc;return function(_0x278b39){if(_0x278b39){return _0x16785f[_0x46f5('0x15')](_0x336a2e);}return _0x16785f[_0x46f5('0x16')](_0x336a2e)[_0x46f5('0x17')]();};}function respondWithResult(_0x3cfefc,_0x3fad96){_0x3fad96=_0x3fad96||0xc8;return function(_0x3ed422){if(_0x3ed422){return _0x3cfefc[_0x46f5('0x16')](_0x3fad96)[_0x46f5('0x18')](_0x3ed422);}};}function respondWithFilteredResult(_0x11e0a8,_0x490e08){return function(_0x5cbc24){if(_0x5cbc24){var _0x3d55cd=_0x5cbc24[_0x46f5('0x19')],_0x930990=_0x490e08[_0x46f5('0x1a')],_0x23ddf4=_0x490e08['offset']+_0x490e08[_0x46f5('0x1b')],_0x38631a;if(_0x23ddf4>=_0x3d55cd){_0x23ddf4=_0x3d55cd;_0x38631a=0xc8;}else{_0x38631a=0xce;}_0x11e0a8[_0x46f5('0x16')](_0x38631a);return _0x11e0a8[_0x46f5('0x1c')]('Content-Range',_0x930990+'-'+_0x23ddf4+'/'+_0x3d55cd)[_0x46f5('0x18')](_0x5cbc24);}return null;};}function patchUpdates(_0x3f9a7e){return function(_0x52bcd9){try{jsonpatch[_0x46f5('0x1d')](_0x52bcd9,_0x3f9a7e,!![]);}catch(_0x35f726){return BPromise[_0x46f5('0x1e')](_0x35f726);}return _0x52bcd9[_0x46f5('0x1f')]();};}function saveUpdates(_0x205bfd,_0x131b53){return function(_0x287812){if(_0x287812){return _0x287812[_0x46f5('0x20')](_0x205bfd)[_0x46f5('0x21')](function(_0x47bf55){return _0x47bf55;});}return null;};}function removeEntity(_0x4d84a7,_0x1e2396){return function(_0x3dcfe0){if(_0x3dcfe0){return _0x3dcfe0[_0x46f5('0x22')]()['then'](function(){_0x4d84a7[_0x46f5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4de120,_0xbb9986){return function(_0x134050){if(!_0x134050){_0x4de120['sendStatus'](0x194);}return _0x134050;};}function handleError(_0x3a331f,_0x58ce5b){_0x58ce5b=_0x58ce5b||0x1f4;return function(_0x25238c){logger[_0x46f5('0x23')](_0x25238c[_0x46f5('0x24')]);if(_0x25238c[_0x46f5('0x25')]){delete _0x25238c['name'];}_0x3a331f[_0x46f5('0x16')](_0x58ce5b)[_0x46f5('0x26')](_0x25238c);};}exports[_0x46f5('0x27')]=function(_0x4dafe0,_0x22951a){var _0x1f8c98={},_0x4c2737={},_0x4de641={'count':0x0,'rows':[]};var _0xa339e1=_[_0x46f5('0x28')](db[_0x46f5('0x29')][_0x46f5('0x2a')],function(_0x3010e3){return{'name':_0x3010e3[_0x46f5('0x2b')],'type':_0x3010e3[_0x46f5('0x2c')][_0x46f5('0x2d')]};});_0x4c2737[_0x46f5('0x2e')]=_[_0x46f5('0x28')](_0xa339e1,'name');_0x4c2737[_0x46f5('0x2f')]=_['keys'](_0x4dafe0[_0x46f5('0x2f')]);_0x4c2737['filters']=_[_0x46f5('0x30')](_0x4c2737[_0x46f5('0x2e')],_0x4c2737[_0x46f5('0x2f')]);_0x1f8c98[_0x46f5('0x31')]=_[_0x46f5('0x30')](_0x4c2737[_0x46f5('0x2e')],qs[_0x46f5('0x32')](_0x4dafe0[_0x46f5('0x2f')][_0x46f5('0x32')]));_0x1f8c98['attributes']=_0x1f8c98[_0x46f5('0x31')]['length']?_0x1f8c98[_0x46f5('0x31')]:_0x4c2737[_0x46f5('0x2e')];if(!_0x4dafe0[_0x46f5('0x2f')][_0x46f5('0x33')](_0x46f5('0x34'))){_0x1f8c98['limit']=qs[_0x46f5('0x1b')](_0x4dafe0[_0x46f5('0x2f')]['limit']);_0x1f8c98[_0x46f5('0x1a')]=qs[_0x46f5('0x1a')](_0x4dafe0[_0x46f5('0x2f')][_0x46f5('0x1a')]);}_0x1f8c98[_0x46f5('0x35')]=qs[_0x46f5('0x36')](_0x4dafe0[_0x46f5('0x2f')]['sort']);_0x1f8c98['where']=qs[_0x46f5('0x37')](_[_0x46f5('0x38')](_0x4dafe0[_0x46f5('0x2f')],_0x4c2737[_0x46f5('0x37')]),_0xa339e1);if(_0x4dafe0[_0x46f5('0x2f')][_0x46f5('0x39')]){_0x1f8c98['where']=_[_0x46f5('0x3a')](_0x1f8c98[_0x46f5('0x3b')],{'$or':_['map'](_0xa339e1,function(_0x588ff4){if(_0x588ff4[_0x46f5('0x2c')]!==_0x46f5('0x3c')){var _0x3dd746={};_0x3dd746[_0x588ff4[_0x46f5('0x25')]]={'$like':'%'+_0x4dafe0[_0x46f5('0x2f')]['filter']+'%'};return _0x3dd746;}})});}_0x1f8c98=_[_0x46f5('0x3a')]({},_0x1f8c98,_0x4dafe0[_0x46f5('0x3d')]);var _0x48a929={'where':_0x1f8c98[_0x46f5('0x3b')]};return db[_0x46f5('0x29')][_0x46f5('0x19')](_0x48a929)['then'](function(_0x57743a){_0x4de641[_0x46f5('0x19')]=_0x57743a;if(_0x4dafe0['query']['includeAll']){_0x1f8c98[_0x46f5('0x3e')]=[{'all':!![]}];}return db[_0x46f5('0x29')][_0x46f5('0x3f')](_0x1f8c98);})['then'](function(_0x784a57){_0x4de641[_0x46f5('0x40')]=_0x784a57;return _0x4de641;})[_0x46f5('0x21')](respondWithFilteredResult(_0x22951a,_0x1f8c98))[_0x46f5('0x41')](handleError(_0x22951a,null));};exports['show']=function(_0x2c5235,_0x25d028){var _0x14ff9d={'raw':!![],'where':{'id':_0x2c5235['params']['id']}},_0x65aea7={};_0x65aea7['model']=_['keys'](db[_0x46f5('0x29')]['rawAttributes']);_0x65aea7[_0x46f5('0x2f')]=_[_0x46f5('0x42')](_0x2c5235[_0x46f5('0x2f')]);_0x65aea7[_0x46f5('0x37')]=_[_0x46f5('0x30')](_0x65aea7[_0x46f5('0x2e')],_0x65aea7[_0x46f5('0x2f')]);_0x14ff9d[_0x46f5('0x31')]=_[_0x46f5('0x30')](_0x65aea7['model'],qs[_0x46f5('0x32')](_0x2c5235['query']['fields']));_0x14ff9d[_0x46f5('0x31')]=_0x14ff9d[_0x46f5('0x31')][_0x46f5('0x43')]?_0x14ff9d[_0x46f5('0x31')]:_0x65aea7[_0x46f5('0x2e')];if(_0x2c5235[_0x46f5('0x2f')][_0x46f5('0x44')]){_0x14ff9d[_0x46f5('0x3e')]=[{'all':!![]}];}_0x14ff9d=_[_0x46f5('0x3a')]({},_0x14ff9d,_0x2c5235['options']);return db['MailTransferReport'][_0x46f5('0x45')](_0x14ff9d)[_0x46f5('0x21')](handleEntityNotFound(_0x25d028,null))[_0x46f5('0x21')](respondWithResult(_0x25d028,null))['catch'](handleError(_0x25d028,null));};exports[_0x46f5('0x46')]=function(_0x40e506,_0x173bd4){return db['MailTransferReport'][_0x46f5('0x46')](_0x40e506[_0x46f5('0x47')],{})[_0x46f5('0x21')](respondWithResult(_0x173bd4,0xc9))['catch'](handleError(_0x173bd4,null));};exports['update']=function(_0x3f9bb1,_0x2616f4){if(_0x3f9bb1[_0x46f5('0x47')]['id']){delete _0x3f9bb1[_0x46f5('0x47')]['id'];}return db[_0x46f5('0x29')][_0x46f5('0x45')]({'where':{'id':_0x3f9bb1['params']['id']}})[_0x46f5('0x21')](handleEntityNotFound(_0x2616f4,null))[_0x46f5('0x21')](saveUpdates(_0x3f9bb1[_0x46f5('0x47')],null))['then'](respondWithResult(_0x2616f4,null))['catch'](handleError(_0x2616f4,null));};exports[_0x46f5('0x22')]=function(_0x1f4afe,_0x133343){return db['MailTransferReport']['find']({'where':{'id':_0x1f4afe[_0x46f5('0x48')]['id']}})[_0x46f5('0x21')](handleEntityNotFound(_0x133343,null))[_0x46f5('0x21')](removeEntity(_0x133343,null))[_0x46f5('0x41')](handleError(_0x133343,null));};exports['describe']=function(_0x63726c,_0x4b004b){return db[_0x46f5('0x29')][_0x46f5('0x49')]()[_0x46f5('0x21')](respondWithResult(_0x4b004b,null))[_0x46f5('0x41')](handleError(_0x4b004b,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index a025900..5fc6b94 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 _0xe884=['define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x5dd0d0,_0x213a28){var _0x194c9f=function(_0x43cccf){while(--_0x43cccf){_0x5dd0d0['push'](_0x5dd0d0['shift']());}};_0x194c9f(++_0x213a28);}(_0xe884,0x1bc));var _0x4e88=function(_0x153fb4,_0x5ab8c8){_0x153fb4=_0x153fb4-0x0;var _0x373974=_0xe884[_0x153fb4];return _0x373974;};'use strict';var _=require('lodash');var util=require(_0x4e88('0x0'));var logger=require(_0x4e88('0x1'))(_0x4e88('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e88('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e88('0x4'));var config=require(_0x4e88('0x5'));var attributes=require(_0x4e88('0x6'));module['exports']=function(_0x49ce20,_0x4949a4){return _0x49ce20[_0x4e88('0x7')](_0x4e88('0x8'),attributes,{'tableName':_0x4e88('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4e88('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6bf2=['report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport'];(function(_0x3230d9,_0x5985bc){var _0x399e30=function(_0x4f6156){while(--_0x4f6156){_0x3230d9['push'](_0x3230d9['shift']());}};_0x399e30(++_0x5985bc);}(_0x6bf2,0x188));var _0x26bf=function(_0x305ac2,_0x3fae6e){_0x305ac2=_0x305ac2-0x0;var _0x54cd61=_0x6bf2[_0x305ac2];return _0x54cd61;};'use strict';var _=require(_0x26bf('0x0'));var util=require('util');var logger=require(_0x26bf('0x1'))(_0x26bf('0x2'));var moment=require(_0x26bf('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(_0x26bf('0x4'));var attributes=require(_0x26bf('0x5'));module[_0x26bf('0x6')]=function(_0x234e22,_0x593735){return _0x234e22['define'](_0x26bf('0x7'),attributes,{'tableName':_0x26bf('0x8'),'paranoid':![],'indexes':[{'name':_0x26bf('0x9'),'fields':[_0x26bf('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 8f3ad5e..20e8238 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 _0xcc02=['../../config/environment','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x573880,_0x51363d){var _0x191a2c=function(_0x1f7af8){while(--_0x1f7af8){_0x573880['push'](_0x573880['shift']());}};_0x191a2c(++_0x51363d);}(_0xcc02,0x16c));var _0x2cc0=function(_0x1fa51d,_0x271b8d){_0x1fa51d=_0x1fa51d-0x0;var _0x5d3431=_0xcc02[_0x1fa51d];return _0x5d3431;};'use strict';var _=require(_0x2cc0('0x0'));var util=require(_0x2cc0('0x1'));var moment=require(_0x2cc0('0x2'));var BPromise=require(_0x2cc0('0x3'));var rs=require(_0x2cc0('0x4'));var fs=require('fs');var Redis=require(_0x2cc0('0x5'));var db=require(_0x2cc0('0x6'))['db'];var utils=require(_0x2cc0('0x7'));var logger=require(_0x2cc0('0x8'))(_0x2cc0('0x9'));var config=require(_0x2cc0('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2cc0('0xb')][_0x2cc0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22c15b,_0x1a3439,_0x417167){return new BPromise(function(_0x566543,_0x3bac73){return client['request'](_0x22c15b,_0x417167)[_0x2cc0('0xd')](function(_0x280180){logger[_0x2cc0('0xe')](_0x2cc0('0xf'),_0x1a3439,_0x2cc0('0x10'));logger['debug'](_0x2cc0('0x11'),_0x1a3439,_0x2cc0('0x10'),JSON[_0x2cc0('0x12')](_0x280180));if(_0x280180[_0x2cc0('0x13')]){if(_0x280180[_0x2cc0('0x13')]['code']===0x1f4){logger[_0x2cc0('0x13')](_0x2cc0('0xf'),_0x1a3439,_0x280180[_0x2cc0('0x13')][_0x2cc0('0x14')]);return _0x3bac73(_0x280180[_0x2cc0('0x13')][_0x2cc0('0x14')]);}logger[_0x2cc0('0x13')](_0x2cc0('0xf'),_0x1a3439,_0x280180[_0x2cc0('0x13')][_0x2cc0('0x14')]);return _0x566543(_0x280180[_0x2cc0('0x13')][_0x2cc0('0x14')]);}else{logger['info'](_0x2cc0('0xf'),_0x1a3439,_0x2cc0('0x10'));_0x566543(_0x280180[_0x2cc0('0x15')][_0x2cc0('0x14')]);}})['catch'](function(_0x8aec6){logger[_0x2cc0('0x13')](_0x2cc0('0xf'),_0x1a3439,_0x8aec6);_0x3bac73(_0x8aec6);});});} \ No newline at end of file +var _0x65eb=['then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','MailTransferReport,\x20%s,\x20%s','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x192aa9,_0x485dca){var _0x35a957=function(_0x2bb6f7){while(--_0x2bb6f7){_0x192aa9['push'](_0x192aa9['shift']());}};_0x35a957(++_0x485dca);}(_0x65eb,0x16a));var _0xb65e=function(_0x4f2e41,_0x1dd963){_0x4f2e41=_0x4f2e41-0x0;var _0x2507be=_0x65eb[_0x4f2e41];return _0x2507be;};'use strict';var _=require(_0xb65e('0x0'));var util=require(_0xb65e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb65e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb65e('0x3'))['db'];var utils=require(_0xb65e('0x4'));var logger=require(_0xb65e('0x5'))(_0xb65e('0x6'));var config=require(_0xb65e('0x7'));var jayson=require(_0xb65e('0x8'));var client=jayson[_0xb65e('0x9')][_0xb65e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ad0b5,_0x3e4a01,_0xf7531f){return new BPromise(function(_0x41c2c5,_0x371c6f){return client[_0xb65e('0xb')](_0x1ad0b5,_0xf7531f)[_0xb65e('0xc')](function(_0x557c33){logger[_0xb65e('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x3e4a01,_0xb65e('0xe'));logger[_0xb65e('0xf')](_0xb65e('0x10'),_0x3e4a01,_0xb65e('0xe'),JSON['stringify'](_0x557c33));if(_0x557c33['error']){if(_0x557c33[_0xb65e('0x11')][_0xb65e('0x12')]===0x1f4){logger[_0xb65e('0x11')](_0xb65e('0x13'),_0x3e4a01,_0x557c33[_0xb65e('0x11')][_0xb65e('0x14')]);return _0x371c6f(_0x557c33[_0xb65e('0x11')][_0xb65e('0x14')]);}logger[_0xb65e('0x11')](_0xb65e('0x13'),_0x3e4a01,_0x557c33['error'][_0xb65e('0x14')]);return _0x41c2c5(_0x557c33[_0xb65e('0x11')][_0xb65e('0x14')]);}else{logger[_0xb65e('0xd')](_0xb65e('0x13'),_0x3e4a01,_0xb65e('0xe'));_0x41c2c5(_0x557c33[_0xb65e('0x15')][_0xb65e('0x14')]);}})['catch'](function(_0x39e058){logger[_0xb65e('0x11')](_0xb65e('0x13'),_0x3e4a01,_0x39e058);_0x371c6f(_0x39e058);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0daad93..959cfb6 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 _0xb583=['Router','../../components/interaction/service','./memberReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','util','connect-timeout','express'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xb583,0x7b));var _0x3b58=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb583[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require(_0x3b58('0x0'));var path=require('path');var timeout=require(_0x3b58('0x1'));var express=require(_0x3b58('0x2'));var router=express[_0x3b58('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3b58('0x4'));var config=require('../../config/environment');var controller=require(_0x3b58('0x5'));router[_0x3b58('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3b58('0x7'),auth[_0x3b58('0x8')](),controller[_0x3b58('0x9')]);router[_0x3b58('0x6')](_0x3b58('0xa'),auth[_0x3b58('0x8')](),controller[_0x3b58('0xb')]);router[_0x3b58('0xc')]('/',auth[_0x3b58('0x8')](),controller[_0x3b58('0xd')]);router[_0x3b58('0xe')](_0x3b58('0xa'),auth[_0x3b58('0x8')](),controller[_0x3b58('0xf')]);router[_0x3b58('0x10')]('/:id',auth[_0x3b58('0x8')](),controller['destroy']);module[_0x3b58('0x11')]=router; \ No newline at end of file +var _0xd7f0=['put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x533db1,_0x55bd11){var _0x551af4=function(_0x576f57){while(--_0x576f57){_0x533db1['push'](_0x533db1['shift']());}};_0x551af4(++_0x55bd11);}(_0xd7f0,0xb8));var _0x0d7f=function(_0x59151d,_0x2d1ff1){_0x59151d=_0x59151d-0x0;var _0x284f8b=_0xd7f0[_0x59151d];return _0x284f8b;};'use strict';var multer=require(_0x0d7f('0x0'));var util=require(_0x0d7f('0x1'));var path=require('path');var timeout=require(_0x0d7f('0x2'));var express=require(_0x0d7f('0x3'));var router=express[_0x0d7f('0x4')]();var auth=require(_0x0d7f('0x5'));var interaction=require(_0x0d7f('0x6'));var config=require(_0x0d7f('0x7'));var controller=require('./memberReport.controller');router[_0x0d7f('0x8')]('/',auth[_0x0d7f('0x9')](),controller['index']);router['get'](_0x0d7f('0xa'),auth['isAuthenticated'](),controller[_0x0d7f('0xb')]);router[_0x0d7f('0x8')](_0x0d7f('0xc'),auth[_0x0d7f('0x9')](),controller[_0x0d7f('0xd')]);router['post']('/',auth[_0x0d7f('0x9')](),controller['create']);router[_0x0d7f('0xe')](_0x0d7f('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x0d7f('0xf')](_0x0d7f('0xc'),auth['isAuthenticated'](),controller[_0x0d7f('0x10')]);module[_0x0d7f('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 0fb1939..6bf8bba 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 _0x2499=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','setDataValue','exitAt','duration'];(function(_0x390b35,_0x4b80f1){var _0x400533=function(_0xf607c1){while(--_0xf607c1){_0x390b35['push'](_0x390b35['shift']());}};_0x400533(++_0x4b80f1);}(_0x2499,0x189));var _0x9249=function(_0x5888e7,_0x4ab90f){_0x5888e7=_0x5888e7-0x0;var _0x5da1f2=_0x2499[_0x5888e7];return _0x5da1f2;};'use strict';var Sequelize=require(_0x9249('0x0'));var moment=require(_0x9249('0x1'));module[_0x9249('0x2')]={'channel':{'type':Sequelize[_0x9249('0x3')]},'membername':{'type':Sequelize[_0x9249('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9249('0x3')],'defaultValue':_0x9249('0x4'),'comment':_0x9249('0x5')},'duration':{'type':Sequelize[_0x9249('0x6')]},'enterAt':{'type':Sequelize[_0x9249('0x7')]},'exitAt':{'type':Sequelize[_0x9249('0x7')],'set':function(_0x263e89){var _0x27d36b=moment(_0x263e89);var _0x12031e=moment(this[_0x9249('0x8')]('enterAt'));var _0x9631c4=_0x27d36b['diff'](_0x12031e,'seconds');this[_0x9249('0x9')](_0x9249('0xa'),_0x263e89);this[_0x9249('0x9')](_0x9249('0xb'),_0x9631c4||null);}},'data1':{'type':Sequelize[_0x9249('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x9249('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x9249('0x3')],'comment':_0x9249('0xc')},'data4':{'type':Sequelize[_0x9249('0x3')],'comment':_0x9249('0xd')},'data5':{'type':Sequelize[_0x9249('0x3')],'comment':_0x9249('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x9249('0x6')]},'uniqueid':{'type':Sequelize[_0x9249('0x3')]}}; \ No newline at end of file +var _0x65c1=['exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','sequelize','moment'];(function(_0x36298c,_0x1e31d0){var _0xf293bc=function(_0x586ca1){while(--_0x586ca1){_0x36298c['push'](_0x36298c['shift']());}};_0xf293bc(++_0x1e31d0);}(_0x65c1,0x1d2));var _0x165c=function(_0x20f96d,_0x23e67f){_0x20f96d=_0x20f96d-0x0;var _0x9a7524=_0x65c1[_0x20f96d];return _0x9a7524;};'use strict';var Sequelize=require(_0x165c('0x0'));var moment=require(_0x165c('0x1'));module[_0x165c('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x165c('0x3')]},'type':{'type':Sequelize[_0x165c('0x3')],'defaultValue':_0x165c('0x4'),'comment':_0x165c('0x5')},'duration':{'type':Sequelize[_0x165c('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x165c('0x7')],'set':function(_0x3616e9){var _0x16ebcb=moment(_0x3616e9);var _0x1da13b=moment(this['getDataValue']('enterAt'));var _0x4a59d9=_0x16ebcb['diff'](_0x1da13b,'seconds');this[_0x165c('0x8')]('exitAt',_0x3616e9);this[_0x165c('0x8')](_0x165c('0x9'),_0x4a59d9||null);}},'data1':{'type':Sequelize[_0x165c('0x3')],'comment':_0x165c('0xa')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x165c('0x3')],'comment':_0x165c('0xb')},'data4':{'type':Sequelize[_0x165c('0x3')],'comment':_0x165c('0xc')},'data5':{'type':Sequelize[_0x165c('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x165c('0x3')]},'internal':{'type':Sequelize[_0x165c('0x6')]},'uniqueid':{'type':Sequelize[_0x165c('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index c33556a..6cabc20 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 _0xf48f=['lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','then','destroy','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs'];(function(_0x3313fa,_0x2355af){var _0x324a4e=function(_0xd1e457){while(--_0xd1e457){_0x3313fa['push'](_0x3313fa['shift']());}};_0x324a4e(++_0x2355af);}(_0xf48f,0x87));var _0xff48=function(_0x4111f7,_0x186e09){_0x4111f7=_0x4111f7-0x0;var _0x2c4bf9=_0xf48f[_0x4111f7];return _0x2c4bf9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xff48('0x0'));var rimraf=require(_0xff48('0x1'));var zipdir=require(_0xff48('0x2'));var jsonpatch=require(_0xff48('0x3'));var rp=require(_0xff48('0x4'));var moment=require(_0xff48('0x5'));var BPromise=require(_0xff48('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xff48('0x7'));var sox=require(_0xff48('0x8'));var csv=require(_0xff48('0x9'));var ejs=require(_0xff48('0xa'));var fs=require('fs');var _=require(_0xff48('0xb'));var squel=require('squel');var crypto=require(_0xff48('0xc'));var jsforce=require(_0xff48('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xff48('0x9'));var querystring=require(_0xff48('0xe'));var Papa=require(_0xff48('0xf'));var Redis=require('ioredis');var authService=require(_0xff48('0x10'));var qs=require(_0xff48('0x11'));var as=require(_0xff48('0x12'));var hardwareService=require(_0xff48('0x13'));var logger=require(_0xff48('0x14'))(_0xff48('0x15'));var utils=require(_0xff48('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xff48('0x17'));var db=require(_0xff48('0x18'))['db'];function respondWithStatusCode(_0x1dbff9,_0x4755e9){_0x4755e9=_0x4755e9||0xcc;return function(_0x5b0d58){if(_0x5b0d58){return _0x1dbff9[_0xff48('0x19')](_0x4755e9);}return _0x1dbff9[_0xff48('0x1a')](_0x4755e9)[_0xff48('0x1b')]();};}function respondWithResult(_0x5aed2a,_0x4c7a64){_0x4c7a64=_0x4c7a64||0xc8;return function(_0x3ebbd3){if(_0x3ebbd3){return _0x5aed2a['status'](_0x4c7a64)['json'](_0x3ebbd3);}};}function respondWithFilteredResult(_0x3e9740,_0x37c8c1){return function(_0x4b7f9b){if(_0x4b7f9b){var _0x29cbee=_0x4b7f9b[_0xff48('0x1c')],_0x827734=_0x37c8c1[_0xff48('0x1d')],_0x5dbd2f=_0x37c8c1['offset']+_0x37c8c1[_0xff48('0x1e')],_0x3d2990;if(_0x5dbd2f>=_0x29cbee){_0x5dbd2f=_0x29cbee;_0x3d2990=0xc8;}else{_0x3d2990=0xce;}_0x3e9740[_0xff48('0x1a')](_0x3d2990);return _0x3e9740[_0xff48('0x1f')](_0xff48('0x20'),_0x827734+'-'+_0x5dbd2f+'/'+_0x29cbee)[_0xff48('0x21')](_0x4b7f9b);}return null;};}function patchUpdates(_0x1251cd){return function(_0x1656e9){try{jsonpatch[_0xff48('0x22')](_0x1656e9,_0x1251cd,!![]);}catch(_0x29bf88){return BPromise['reject'](_0x29bf88);}return _0x1656e9['save']();};}function saveUpdates(_0x477851,_0x557846){return function(_0x5e5a65){if(_0x5e5a65){return _0x5e5a65['update'](_0x477851)[_0xff48('0x23')](function(_0x488376){return _0x488376;});}return null;};}function removeEntity(_0x54f03c,_0x36cc15){return function(_0x167f88){if(_0x167f88){return _0x167f88[_0xff48('0x24')]()[_0xff48('0x23')](function(){_0x54f03c[_0xff48('0x1a')](0xcc)[_0xff48('0x1b')]();});}};}function handleEntityNotFound(_0x19e4d8,_0x4558ea){return function(_0x5e5a43){if(!_0x5e5a43){_0x19e4d8[_0xff48('0x19')](0x194);}return _0x5e5a43;};}function handleError(_0x348eac,_0xf028cc){_0xf028cc=_0xf028cc||0x1f4;return function(_0x108a49){logger['error'](_0x108a49[_0xff48('0x25')]);if(_0x108a49['name']){delete _0x108a49[_0xff48('0x26')];}_0x348eac['status'](_0xf028cc)[_0xff48('0x27')](_0x108a49);};}exports[_0xff48('0x28')]=function(_0x2fdf58,_0x405353){var _0x230640={},_0x3c1510={},_0x2207db={'count':0x0,'rows':[]};var _0x38c25b=_[_0xff48('0x29')](db[_0xff48('0x2a')][_0xff48('0x2b')],function(_0x15c5c2){return{'name':_0x15c5c2[_0xff48('0x2c')],'type':_0x15c5c2[_0xff48('0x2d')]['key']};});_0x3c1510[_0xff48('0x2e')]=_[_0xff48('0x29')](_0x38c25b,_0xff48('0x26'));_0x3c1510[_0xff48('0x2f')]=_[_0xff48('0x30')](_0x2fdf58[_0xff48('0x2f')]);_0x3c1510[_0xff48('0x31')]=_[_0xff48('0x32')](_0x3c1510[_0xff48('0x2e')],_0x3c1510['query']);_0x230640['attributes']=_[_0xff48('0x32')](_0x3c1510['model'],qs['fields'](_0x2fdf58[_0xff48('0x2f')][_0xff48('0x33')]));_0x230640[_0xff48('0x34')]=_0x230640[_0xff48('0x34')][_0xff48('0x35')]?_0x230640[_0xff48('0x34')]:_0x3c1510[_0xff48('0x2e')];if(!_0x2fdf58[_0xff48('0x2f')][_0xff48('0x36')](_0xff48('0x37'))){_0x230640[_0xff48('0x1e')]=qs[_0xff48('0x1e')](_0x2fdf58[_0xff48('0x2f')][_0xff48('0x1e')]);_0x230640['offset']=qs[_0xff48('0x1d')](_0x2fdf58[_0xff48('0x2f')][_0xff48('0x1d')]);}_0x230640[_0xff48('0x38')]=qs[_0xff48('0x39')](_0x2fdf58['query'][_0xff48('0x39')]);_0x230640[_0xff48('0x3a')]=qs['filters'](_['pick'](_0x2fdf58[_0xff48('0x2f')],_0x3c1510['filters']),_0x38c25b);if(_0x2fdf58['query'][_0xff48('0x3b')]){_0x230640[_0xff48('0x3a')]=_[_0xff48('0x3c')](_0x230640[_0xff48('0x3a')],{'$or':_['map'](_0x38c25b,function(_0x31311d){if(_0x31311d[_0xff48('0x2d')]!==_0xff48('0x3d')){var _0x2bc024={};_0x2bc024[_0x31311d[_0xff48('0x26')]]={'$like':'%'+_0x2fdf58[_0xff48('0x2f')][_0xff48('0x3b')]+'%'};return _0x2bc024;}})});}_0x230640=_[_0xff48('0x3c')]({},_0x230640,_0x2fdf58['options']);var _0x3fb908={'where':_0x230640[_0xff48('0x3a')]};return db[_0xff48('0x2a')][_0xff48('0x1c')](_0x3fb908)[_0xff48('0x23')](function(_0x5496d5){_0x2207db[_0xff48('0x1c')]=_0x5496d5;if(_0x2fdf58['query'][_0xff48('0x3e')]){_0x230640[_0xff48('0x3f')]=[{'all':!![]}];}return db['MemberReport']['findAll'](_0x230640);})[_0xff48('0x23')](function(_0x530c73){_0x2207db[_0xff48('0x40')]=_0x530c73;return _0x2207db;})[_0xff48('0x23')](respondWithFilteredResult(_0x405353,_0x230640))[_0xff48('0x41')](handleError(_0x405353,null));};exports[_0xff48('0x42')]=function(_0x5cc12e,_0x10f2a3){var _0xe81f12={'raw':!![],'where':{'id':_0x5cc12e['params']['id']}},_0xe28c7f={};_0xe28c7f[_0xff48('0x2e')]=_['keys'](db[_0xff48('0x2a')][_0xff48('0x2b')]);_0xe28c7f['query']=_[_0xff48('0x30')](_0x5cc12e[_0xff48('0x2f')]);_0xe28c7f[_0xff48('0x31')]=_['intersection'](_0xe28c7f[_0xff48('0x2e')],_0xe28c7f[_0xff48('0x2f')]);_0xe81f12[_0xff48('0x34')]=_['intersection'](_0xe28c7f[_0xff48('0x2e')],qs[_0xff48('0x33')](_0x5cc12e[_0xff48('0x2f')][_0xff48('0x33')]));_0xe81f12[_0xff48('0x34')]=_0xe81f12['attributes'][_0xff48('0x35')]?_0xe81f12['attributes']:_0xe28c7f[_0xff48('0x2e')];if(_0x5cc12e[_0xff48('0x2f')][_0xff48('0x3e')]){_0xe81f12[_0xff48('0x3f')]=[{'all':!![]}];}_0xe81f12=_['merge']({},_0xe81f12,_0x5cc12e['options']);return db[_0xff48('0x2a')][_0xff48('0x43')](_0xe81f12)['then'](handleEntityNotFound(_0x10f2a3,null))['then'](respondWithResult(_0x10f2a3,null))[_0xff48('0x41')](handleError(_0x10f2a3,null));};exports[_0xff48('0x44')]=function(_0x1425cc,_0x1b5532){return db[_0xff48('0x2a')]['create'](_0x1425cc[_0xff48('0x45')],{})['then'](respondWithResult(_0x1b5532,0xc9))[_0xff48('0x41')](handleError(_0x1b5532,null));};exports[_0xff48('0x46')]=function(_0x1eed4a,_0x1f7df6){if(_0x1eed4a['body']['id']){delete _0x1eed4a['body']['id'];}return db[_0xff48('0x2a')][_0xff48('0x43')]({'where':{'id':_0x1eed4a[_0xff48('0x47')]['id']}})[_0xff48('0x23')](handleEntityNotFound(_0x1f7df6,null))[_0xff48('0x23')](saveUpdates(_0x1eed4a[_0xff48('0x45')],null))[_0xff48('0x23')](respondWithResult(_0x1f7df6,null))[_0xff48('0x41')](handleError(_0x1f7df6,null));};exports[_0xff48('0x24')]=function(_0x97fc00,_0x432fae){return db[_0xff48('0x2a')][_0xff48('0x43')]({'where':{'id':_0x97fc00['params']['id']}})['then'](handleEntityNotFound(_0x432fae,null))[_0xff48('0x23')](removeEntity(_0x432fae,null))[_0xff48('0x41')](handleError(_0x432fae,null));};exports['describe']=function(_0x2df773,_0x2cc224){return db['MemberReport'][_0xff48('0x48')]()[_0xff48('0x23')](respondWithResult(_0x2cc224,null))[_0xff48('0x41')](handleError(_0x2cc224,null));}; \ No newline at end of file +var _0xa262=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','length','find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','send','map','MemberReport','rawAttributes','type','key','model','name'];(function(_0x4c0de5,_0x3cb7ce){var _0x208474=function(_0x4644a){while(--_0x4644a){_0x4c0de5['push'](_0x4c0de5['shift']());}};_0x208474(++_0x3cb7ce);}(_0xa262,0xf7));var _0x2a26=function(_0x2c4dab,_0x54ef4d){_0x2c4dab=_0x2c4dab-0x0;var _0x5591cd=_0xa262[_0x2c4dab];return _0x5591cd;};'use strict';var pdf=require(_0x2a26('0x0'));var emlformat=require(_0x2a26('0x1'));var rimraf=require(_0x2a26('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a26('0x3'));var rp=require('request-promise');var moment=require(_0x2a26('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2a26('0x5'));var util=require(_0x2a26('0x6'));var path=require(_0x2a26('0x7'));var sox=require(_0x2a26('0x8'));var csv=require('to-csv');var ejs=require(_0x2a26('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2a26('0xa'));var crypto=require('crypto');var jsforce=require(_0x2a26('0xb'));var deskjs=require(_0x2a26('0xc'));var toCsv=require(_0x2a26('0xd'));var querystring=require('querystring');var Papa=require(_0x2a26('0xe'));var Redis=require(_0x2a26('0xf'));var authService=require(_0x2a26('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a26('0x11'));var hardwareService=require(_0x2a26('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2a26('0x13'));var config=require(_0x2a26('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a26('0x15'))['db'];function respondWithStatusCode(_0x37bd23,_0x1bc428){_0x1bc428=_0x1bc428||0xcc;return function(_0x1da7f9){if(_0x1da7f9){return _0x37bd23[_0x2a26('0x16')](_0x1bc428);}return _0x37bd23[_0x2a26('0x17')](_0x1bc428)[_0x2a26('0x18')]();};}function respondWithResult(_0xbe75c3,_0x5e6b70){_0x5e6b70=_0x5e6b70||0xc8;return function(_0x3cb55e){if(_0x3cb55e){return _0xbe75c3[_0x2a26('0x17')](_0x5e6b70)[_0x2a26('0x19')](_0x3cb55e);}};}function respondWithFilteredResult(_0x28ceac,_0x457a13){return function(_0x46d3c2){if(_0x46d3c2){var _0x5be10e=_0x46d3c2['count'],_0xb913e3=_0x457a13[_0x2a26('0x1a')],_0x421a49=_0x457a13[_0x2a26('0x1a')]+_0x457a13[_0x2a26('0x1b')],_0x2fd3f8;if(_0x421a49>=_0x5be10e){_0x421a49=_0x5be10e;_0x2fd3f8=0xc8;}else{_0x2fd3f8=0xce;}_0x28ceac[_0x2a26('0x17')](_0x2fd3f8);return _0x28ceac[_0x2a26('0x1c')](_0x2a26('0x1d'),_0xb913e3+'-'+_0x421a49+'/'+_0x5be10e)[_0x2a26('0x19')](_0x46d3c2);}return null;};}function patchUpdates(_0x3aa612){return function(_0x5b569b){try{jsonpatch[_0x2a26('0x1e')](_0x5b569b,_0x3aa612,!![]);}catch(_0x2691c7){return BPromise[_0x2a26('0x1f')](_0x2691c7);}return _0x5b569b[_0x2a26('0x20')]();};}function saveUpdates(_0x105eea,_0x2cb71c){return function(_0x170b72){if(_0x170b72){return _0x170b72[_0x2a26('0x21')](_0x105eea)[_0x2a26('0x22')](function(_0x583e32){return _0x583e32;});}return null;};}function removeEntity(_0x4bf107,_0x37b770){return function(_0x3b0b95){if(_0x3b0b95){return _0x3b0b95[_0x2a26('0x23')]()[_0x2a26('0x22')](function(){_0x4bf107[_0x2a26('0x17')](0xcc)[_0x2a26('0x18')]();});}};}function handleEntityNotFound(_0x4fd4f4,_0x4e6d58){return function(_0x822d7b){if(!_0x822d7b){_0x4fd4f4[_0x2a26('0x16')](0x194);}return _0x822d7b;};}function handleError(_0x538a82,_0x40bb06){_0x40bb06=_0x40bb06||0x1f4;return function(_0xf2a18f){logger[_0x2a26('0x24')](_0xf2a18f['stack']);if(_0xf2a18f['name']){delete _0xf2a18f['name'];}_0x538a82['status'](_0x40bb06)[_0x2a26('0x25')](_0xf2a18f);};}exports['index']=function(_0x1dfe49,_0x320101){var _0x4fc1d9={},_0x3fddef={},_0x13e1d4={'count':0x0,'rows':[]};var _0x31f7c6=_[_0x2a26('0x26')](db[_0x2a26('0x27')][_0x2a26('0x28')],function(_0x9a5a0a){return{'name':_0x9a5a0a['fieldName'],'type':_0x9a5a0a[_0x2a26('0x29')][_0x2a26('0x2a')]};});_0x3fddef[_0x2a26('0x2b')]=_[_0x2a26('0x26')](_0x31f7c6,_0x2a26('0x2c'));_0x3fddef[_0x2a26('0x2d')]=_[_0x2a26('0x2e')](_0x1dfe49['query']);_0x3fddef[_0x2a26('0x2f')]=_[_0x2a26('0x30')](_0x3fddef[_0x2a26('0x2b')],_0x3fddef[_0x2a26('0x2d')]);_0x4fc1d9[_0x2a26('0x31')]=_[_0x2a26('0x30')](_0x3fddef[_0x2a26('0x2b')],qs[_0x2a26('0x32')](_0x1dfe49[_0x2a26('0x2d')][_0x2a26('0x32')]));_0x4fc1d9[_0x2a26('0x31')]=_0x4fc1d9[_0x2a26('0x31')]['length']?_0x4fc1d9[_0x2a26('0x31')]:_0x3fddef[_0x2a26('0x2b')];if(!_0x1dfe49[_0x2a26('0x2d')][_0x2a26('0x33')](_0x2a26('0x34'))){_0x4fc1d9[_0x2a26('0x1b')]=qs[_0x2a26('0x1b')](_0x1dfe49[_0x2a26('0x2d')][_0x2a26('0x1b')]);_0x4fc1d9['offset']=qs[_0x2a26('0x1a')](_0x1dfe49[_0x2a26('0x2d')]['offset']);}_0x4fc1d9[_0x2a26('0x35')]=qs['sort'](_0x1dfe49[_0x2a26('0x2d')][_0x2a26('0x36')]);_0x4fc1d9[_0x2a26('0x37')]=qs[_0x2a26('0x2f')](_[_0x2a26('0x38')](_0x1dfe49[_0x2a26('0x2d')],_0x3fddef[_0x2a26('0x2f')]),_0x31f7c6);if(_0x1dfe49[_0x2a26('0x2d')][_0x2a26('0x39')]){_0x4fc1d9[_0x2a26('0x37')]=_[_0x2a26('0x3a')](_0x4fc1d9[_0x2a26('0x37')],{'$or':_['map'](_0x31f7c6,function(_0x37716d){if(_0x37716d[_0x2a26('0x29')]!==_0x2a26('0x3b')){var _0x4015ff={};_0x4015ff[_0x37716d[_0x2a26('0x2c')]]={'$like':'%'+_0x1dfe49['query']['filter']+'%'};return _0x4015ff;}})});}_0x4fc1d9=_[_0x2a26('0x3a')]({},_0x4fc1d9,_0x1dfe49[_0x2a26('0x3c')]);var _0x49c058={'where':_0x4fc1d9['where']};return db[_0x2a26('0x27')][_0x2a26('0x3d')](_0x49c058)[_0x2a26('0x22')](function(_0x2e1f55){_0x13e1d4[_0x2a26('0x3d')]=_0x2e1f55;if(_0x1dfe49[_0x2a26('0x2d')][_0x2a26('0x3e')]){_0x4fc1d9[_0x2a26('0x3f')]=[{'all':!![]}];}return db[_0x2a26('0x27')][_0x2a26('0x40')](_0x4fc1d9);})[_0x2a26('0x22')](function(_0x372969){_0x13e1d4['rows']=_0x372969;return _0x13e1d4;})[_0x2a26('0x22')](respondWithFilteredResult(_0x320101,_0x4fc1d9))['catch'](handleError(_0x320101,null));};exports[_0x2a26('0x41')]=function(_0x546eb0,_0x1c661f){var _0x9ecd5={'raw':!![],'where':{'id':_0x546eb0[_0x2a26('0x42')]['id']}},_0x3ff43e={};_0x3ff43e[_0x2a26('0x2b')]=_[_0x2a26('0x2e')](db['MemberReport']['rawAttributes']);_0x3ff43e[_0x2a26('0x2d')]=_[_0x2a26('0x2e')](_0x546eb0[_0x2a26('0x2d')]);_0x3ff43e[_0x2a26('0x2f')]=_[_0x2a26('0x30')](_0x3ff43e['model'],_0x3ff43e[_0x2a26('0x2d')]);_0x9ecd5[_0x2a26('0x31')]=_['intersection'](_0x3ff43e[_0x2a26('0x2b')],qs[_0x2a26('0x32')](_0x546eb0[_0x2a26('0x2d')][_0x2a26('0x32')]));_0x9ecd5[_0x2a26('0x31')]=_0x9ecd5[_0x2a26('0x31')][_0x2a26('0x43')]?_0x9ecd5[_0x2a26('0x31')]:_0x3ff43e[_0x2a26('0x2b')];if(_0x546eb0[_0x2a26('0x2d')][_0x2a26('0x3e')]){_0x9ecd5['include']=[{'all':!![]}];}_0x9ecd5=_[_0x2a26('0x3a')]({},_0x9ecd5,_0x546eb0['options']);return db['MemberReport'][_0x2a26('0x44')](_0x9ecd5)[_0x2a26('0x22')](handleEntityNotFound(_0x1c661f,null))[_0x2a26('0x22')](respondWithResult(_0x1c661f,null))[_0x2a26('0x45')](handleError(_0x1c661f,null));};exports[_0x2a26('0x46')]=function(_0x8f23ac,_0x13e697){return db[_0x2a26('0x27')][_0x2a26('0x46')](_0x8f23ac[_0x2a26('0x47')],{})['then'](respondWithResult(_0x13e697,0xc9))['catch'](handleError(_0x13e697,null));};exports[_0x2a26('0x21')]=function(_0x6e9f75,_0x4329ef){if(_0x6e9f75['body']['id']){delete _0x6e9f75[_0x2a26('0x47')]['id'];}return db[_0x2a26('0x27')]['find']({'where':{'id':_0x6e9f75['params']['id']}})[_0x2a26('0x22')](handleEntityNotFound(_0x4329ef,null))[_0x2a26('0x22')](saveUpdates(_0x6e9f75[_0x2a26('0x47')],null))[_0x2a26('0x22')](respondWithResult(_0x4329ef,null))[_0x2a26('0x45')](handleError(_0x4329ef,null));};exports[_0x2a26('0x23')]=function(_0x32eee4,_0x9e5d4f){return db[_0x2a26('0x27')]['find']({'where':{'id':_0x32eee4[_0x2a26('0x42')]['id']}})[_0x2a26('0x22')](handleEntityNotFound(_0x9e5d4f,null))[_0x2a26('0x22')](removeEntity(_0x9e5d4f,null))[_0x2a26('0x45')](handleError(_0x9e5d4f,null));};exports['describe']=function(_0x3ba0da,_0x59638b){return db[_0x2a26('0x27')][_0x2a26('0x48')]()[_0x2a26('0x22')](respondWithResult(_0x59638b,null))[_0x2a26('0x45')](handleError(_0x59638b,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 84412b6..9cc4649 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 _0x8f39=['path','rimraf','../../config/environment','define','MemberReport','membername','interface','lodash','../../config/logger','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8f39,0x1bf));var _0x98f3=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x8f39[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0x98f3('0x0'));var util=require('util');var logger=require(_0x98f3('0x1'))('api');var moment=require('moment');var BPromise=require(_0x98f3('0x2'));var rp=require(_0x98f3('0x3'));var fs=require('fs');var path=require(_0x98f3('0x4'));var rimraf=require(_0x98f3('0x5'));var config=require(_0x98f3('0x6'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x336dc2,_0xd006c9){return _0x336dc2[_0x98f3('0x7')](_0x98f3('0x8'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x98f3('0x9'),_0x98f3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x79f2=['util','../../config/logger','api','moment','rimraf','../../config/environment','exports','report_member','membername_interface','membername','interface','lodash'];(function(_0x5c76dc,_0x467161){var _0xa82a18=function(_0x585ff6){while(--_0x585ff6){_0x5c76dc['push'](_0x5c76dc['shift']());}};_0xa82a18(++_0x467161);}(_0x79f2,0xbf));var _0x279f=function(_0x3bd19a,_0x334e24){_0x3bd19a=_0x3bd19a-0x0;var _0x514501=_0x79f2[_0x3bd19a];return _0x514501;};'use strict';var _=require(_0x279f('0x0'));var util=require(_0x279f('0x1'));var logger=require(_0x279f('0x2'))(_0x279f('0x3'));var moment=require(_0x279f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x279f('0x5'));var config=require(_0x279f('0x6'));var attributes=require('./memberReport.attributes');module[_0x279f('0x7')]=function(_0x54965a,_0x510286){return _0x54965a['define']('MemberReport',attributes,{'tableName':_0x279f('0x8'),'paranoid':![],'indexes':[{'name':_0x279f('0x9'),'fields':[_0x279f('0xa'),_0x279f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index a578fdf..1cc3e6b 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 _0xae71=['MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateMemberReport','create','body','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMemberReport'];(function(_0x201621,_0x49d187){var _0x38c2c0=function(_0x366a65){while(--_0x366a65){_0x201621['push'](_0x201621['shift']());}};_0x38c2c0(++_0x49d187);}(_0xae71,0x194));var _0x1ae7=function(_0x5535a3,_0x1e7ab9){_0x5535a3=_0x5535a3-0x0;var _0x4da372=_0xae71[_0x5535a3];return _0x4da372;};'use strict';var _=require(_0x1ae7('0x0'));var util=require(_0x1ae7('0x1'));var moment=require(_0x1ae7('0x2'));var BPromise=require(_0x1ae7('0x3'));var rs=require(_0x1ae7('0x4'));var fs=require('fs');var Redis=require(_0x1ae7('0x5'));var db=require(_0x1ae7('0x6'))['db'];var utils=require(_0x1ae7('0x7'));var logger=require(_0x1ae7('0x8'))('rpc');var config=require(_0x1ae7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1ae7('0xa')][_0x1ae7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ad5b7,_0x3dc963,_0x3b2338){return new BPromise(function(_0x72899c,_0x54632f){return client[_0x1ae7('0xc')](_0x4ad5b7,_0x3b2338)[_0x1ae7('0xd')](function(_0x135c52){logger[_0x1ae7('0xe')](_0x1ae7('0xf'),_0x3dc963,_0x1ae7('0x10'));logger[_0x1ae7('0x11')](_0x1ae7('0x12'),_0x3dc963,_0x1ae7('0x10'),JSON[_0x1ae7('0x13')](_0x135c52));if(_0x135c52[_0x1ae7('0x14')]){if(_0x135c52[_0x1ae7('0x14')]['code']===0x1f4){logger[_0x1ae7('0x14')]('MemberReport,\x20%s,\x20%s',_0x3dc963,_0x135c52[_0x1ae7('0x14')][_0x1ae7('0x15')]);return _0x54632f(_0x135c52[_0x1ae7('0x14')][_0x1ae7('0x15')]);}logger[_0x1ae7('0x14')](_0x1ae7('0xf'),_0x3dc963,_0x135c52[_0x1ae7('0x14')]['message']);return _0x72899c(_0x135c52[_0x1ae7('0x14')]['message']);}else{logger[_0x1ae7('0xe')](_0x1ae7('0xf'),_0x3dc963,_0x1ae7('0x10'));_0x72899c(_0x135c52[_0x1ae7('0x16')][_0x1ae7('0x15')]);}})[_0x1ae7('0x17')](function(_0x259ef2){logger[_0x1ae7('0x14')](_0x1ae7('0xf'),_0x3dc963,_0x259ef2);_0x54632f(_0x259ef2);});});}exports[_0x1ae7('0x18')]=function(_0x3c04cc){var _0x434bf4=this;return new Promise(function(_0x526964,_0x57d5a7){return db[_0x1ae7('0x19')][_0x1ae7('0x1a')]({'raw':_0x3c04cc[_0x1ae7('0x1b')]?_0x3c04cc['options'][_0x1ae7('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c04cc['options']?_0x3c04cc[_0x1ae7('0x1b')][_0x1ae7('0x1d')]||null:null,'attributes':_0x3c04cc[_0x1ae7('0x1b')]?_0x3c04cc[_0x1ae7('0x1b')][_0x1ae7('0x1e')]||null:null,'limit':_0x3c04cc['options']?_0x3c04cc[_0x1ae7('0x1b')][_0x1ae7('0x1f')]||null:null,'include':_0x3c04cc[_0x1ae7('0x1b')]?_0x3c04cc[_0x1ae7('0x1b')][_0x1ae7('0x20')]?_[_0x1ae7('0x21')](_0x3c04cc[_0x1ae7('0x1b')][_0x1ae7('0x20')],function(_0x16eeef){return{'model':db[_0x16eeef['model']],'as':_0x16eeef['as'],'attributes':_0x16eeef[_0x1ae7('0x1e')],'include':_0x16eeef[_0x1ae7('0x20')]?_[_0x1ae7('0x21')](_0x16eeef[_0x1ae7('0x20')],function(_0xbc303e){return{'model':db[_0xbc303e[_0x1ae7('0x22')]],'as':_0xbc303e['as'],'attributes':_0xbc303e[_0x1ae7('0x1e')],'include':_0xbc303e['include']?_[_0x1ae7('0x21')](_0xbc303e['include'],function(_0x56993e){return{'model':db[_0x56993e['model']],'as':_0x56993e['as'],'attributes':_0x56993e[_0x1ae7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1ae7('0xd')](function(_0x9daf81){logger[_0x1ae7('0xe')](_0x1ae7('0x18'),_0x3c04cc);logger[_0x1ae7('0x11')](_0x1ae7('0x18'),_0x3c04cc,JSON['stringify'](_0x9daf81));_0x526964(_0x9daf81);})['catch'](function(_0x3e248a){logger['error'](_0x1ae7('0x18'),_0x3e248a['message'],_0x3c04cc);_0x57d5a7(_0x434bf4[_0x1ae7('0x14')](0x1f4,_0x3e248a['message']));});});};exports[_0x1ae7('0x23')]=function(_0x44471b){var _0x2a2369=this;return new Promise(function(_0x4a5ccf,_0x29b267){return db['MemberReport'][_0x1ae7('0x24')](_0x44471b[_0x1ae7('0x25')],{'raw':_0x44471b['options']?_0x44471b['options'][_0x1ae7('0x1c')]===undefined?!![]:![]:!![]})[_0x1ae7('0xd')](function(_0x4d9079){logger[_0x1ae7('0xe')]('CreateMemberReport',_0x44471b);logger[_0x1ae7('0x11')](_0x1ae7('0x23'),_0x44471b,JSON[_0x1ae7('0x13')](_0x4d9079));_0x4a5ccf(_0x4d9079);})[_0x1ae7('0x17')](function(_0xd06252){logger[_0x1ae7('0x14')](_0x1ae7('0x23'),_0xd06252[_0x1ae7('0x15')],_0x44471b);_0x29b267(_0x2a2369[_0x1ae7('0x14')](0x1f4,_0xd06252[_0x1ae7('0x15')]));});});};exports[_0x1ae7('0x26')]=function(_0x482725){var _0x56dbf9=this;return new Promise(function(_0x583a3f,_0x41ba7f){return db[_0x1ae7('0x19')]['update'](_0x482725[_0x1ae7('0x25')],{'raw':_0x482725[_0x1ae7('0x1b')]?_0x482725[_0x1ae7('0x1b')][_0x1ae7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x482725[_0x1ae7('0x1b')]?_0x482725[_0x1ae7('0x1b')][_0x1ae7('0x1d')]||null:null,'attributes':_0x482725[_0x1ae7('0x1b')]?_0x482725[_0x1ae7('0x1b')][_0x1ae7('0x1e')]||null:null,'limit':_0x482725[_0x1ae7('0x1b')]?_0x482725[_0x1ae7('0x1b')][_0x1ae7('0x1f')]||null:null})[_0x1ae7('0xd')](function(_0x3d7d2a){logger[_0x1ae7('0xe')](_0x1ae7('0x26'),_0x482725);logger[_0x1ae7('0x11')](_0x1ae7('0x26'),_0x482725,JSON['stringify'](_0x3d7d2a));_0x583a3f(_0x3d7d2a);})[_0x1ae7('0x17')](function(_0xdb653c){logger['error'](_0x1ae7('0x26'),_0xdb653c[_0x1ae7('0x15')],_0x482725);_0x41ba7f(_0x56dbf9[_0x1ae7('0x14')](0x1f4,_0xdb653c[_0x1ae7('0x15')]));});});}; \ No newline at end of file +var _0x003e=['model','attributes','then','debug','MemberReport','create','body','CreateMemberReport','update','UpdateMemberReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetMemberReport','findAll','options','raw','where','limit','include'];(function(_0x52b408,_0x22fe7e){var _0x403deb=function(_0x13defa){while(--_0x13defa){_0x52b408['push'](_0x52b408['shift']());}};_0x403deb(++_0x22fe7e);}(_0x003e,0x7f));var _0xe003=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0x003e[_0x457b64];return _0x437111;};'use strict';var _=require(_0xe003('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe003('0x1'));var rs=require(_0xe003('0x2'));var fs=require('fs');var Redis=require(_0xe003('0x3'));var db=require(_0xe003('0x4'))['db'];var utils=require(_0xe003('0x5'));var logger=require(_0xe003('0x6'))(_0xe003('0x7'));var config=require(_0xe003('0x8'));var jayson=require(_0xe003('0x9'));var client=jayson[_0xe003('0xa')][_0xe003('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f92b3,_0x1906d6,_0x1c2ae0){return new BPromise(function(_0x591594,_0x225bed){return client[_0xe003('0xc')](_0x4f92b3,_0x1c2ae0)['then'](function(_0x1c614f){logger['info'](_0xe003('0xd'),_0x1906d6,_0xe003('0xe'));logger['debug'](_0xe003('0xf'),_0x1906d6,_0xe003('0xe'),JSON[_0xe003('0x10')](_0x1c614f));if(_0x1c614f[_0xe003('0x11')]){if(_0x1c614f[_0xe003('0x11')]['code']===0x1f4){logger[_0xe003('0x11')](_0xe003('0xd'),_0x1906d6,_0x1c614f[_0xe003('0x11')][_0xe003('0x12')]);return _0x225bed(_0x1c614f[_0xe003('0x11')][_0xe003('0x12')]);}logger['error'](_0xe003('0xd'),_0x1906d6,_0x1c614f['error']['message']);return _0x591594(_0x1c614f[_0xe003('0x11')][_0xe003('0x12')]);}else{logger[_0xe003('0x13')](_0xe003('0xd'),_0x1906d6,'request\x20sent');_0x591594(_0x1c614f[_0xe003('0x14')][_0xe003('0x12')]);}})[_0xe003('0x15')](function(_0x9c18dc){logger[_0xe003('0x11')](_0xe003('0xd'),_0x1906d6,_0x9c18dc);_0x225bed(_0x9c18dc);});});}exports[_0xe003('0x16')]=function(_0x3e84d0){var _0x52a65c=this;return new Promise(function(_0x11e7c9,_0x335ed3){return db['MemberReport'][_0xe003('0x17')]({'raw':_0x3e84d0[_0xe003('0x18')]?_0x3e84d0[_0xe003('0x18')][_0xe003('0x19')]===undefined?!![]:![]:!![],'where':_0x3e84d0[_0xe003('0x18')]?_0x3e84d0['options'][_0xe003('0x1a')]||null:null,'attributes':_0x3e84d0[_0xe003('0x18')]?_0x3e84d0['options']['attributes']||null:null,'limit':_0x3e84d0[_0xe003('0x18')]?_0x3e84d0[_0xe003('0x18')][_0xe003('0x1b')]||null:null,'include':_0x3e84d0['options']?_0x3e84d0[_0xe003('0x18')]['include']?_['map'](_0x3e84d0[_0xe003('0x18')][_0xe003('0x1c')],function(_0x392a9e){return{'model':db[_0x392a9e[_0xe003('0x1d')]],'as':_0x392a9e['as'],'attributes':_0x392a9e['attributes'],'include':_0x392a9e[_0xe003('0x1c')]?_['map'](_0x392a9e[_0xe003('0x1c')],function(_0x219134){return{'model':db[_0x219134['model']],'as':_0x219134['as'],'attributes':_0x219134[_0xe003('0x1e')],'include':_0x219134[_0xe003('0x1c')]?_['map'](_0x219134['include'],function(_0x243ed6){return{'model':db[_0x243ed6['model']],'as':_0x243ed6['as'],'attributes':_0x243ed6['attributes']};}):[]};}):[]};}):[]:[]})[_0xe003('0x1f')](function(_0x5b6ce2){logger[_0xe003('0x13')](_0xe003('0x16'),_0x3e84d0);logger[_0xe003('0x20')]('GetMemberReport',_0x3e84d0,JSON['stringify'](_0x5b6ce2));_0x11e7c9(_0x5b6ce2);})['catch'](function(_0x3d30a6){logger['error']('GetMemberReport',_0x3d30a6['message'],_0x3e84d0);_0x335ed3(_0x52a65c[_0xe003('0x11')](0x1f4,_0x3d30a6['message']));});});};exports['CreateMemberReport']=function(_0xfd6297){var _0x1916c5=this;return new Promise(function(_0x42c685,_0x14e3be){return db[_0xe003('0x21')][_0xe003('0x22')](_0xfd6297[_0xe003('0x23')],{'raw':_0xfd6297[_0xe003('0x18')]?_0xfd6297['options']['raw']===undefined?!![]:![]:!![]})[_0xe003('0x1f')](function(_0x535679){logger[_0xe003('0x13')](_0xe003('0x24'),_0xfd6297);logger[_0xe003('0x20')]('CreateMemberReport',_0xfd6297,JSON['stringify'](_0x535679));_0x42c685(_0x535679);})[_0xe003('0x15')](function(_0xb2a6cc){logger['error'](_0xe003('0x24'),_0xb2a6cc['message'],_0xfd6297);_0x14e3be(_0x1916c5[_0xe003('0x11')](0x1f4,_0xb2a6cc[_0xe003('0x12')]));});});};exports['UpdateMemberReport']=function(_0x53462d){var _0xe30a67=this;return new Promise(function(_0x423507,_0x1ad14a){return db['MemberReport'][_0xe003('0x25')](_0x53462d[_0xe003('0x23')],{'raw':_0x53462d['options']?_0x53462d[_0xe003('0x18')][_0xe003('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53462d['options']?_0x53462d[_0xe003('0x18')][_0xe003('0x1a')]||null:null,'attributes':_0x53462d['options']?_0x53462d[_0xe003('0x18')]['attributes']||null:null,'limit':_0x53462d[_0xe003('0x18')]?_0x53462d[_0xe003('0x18')][_0xe003('0x1b')]||null:null})[_0xe003('0x1f')](function(_0x255d9c){logger[_0xe003('0x13')](_0xe003('0x26'),_0x53462d);logger[_0xe003('0x20')](_0xe003('0x26'),_0x53462d,JSON['stringify'](_0x255d9c));_0x423507(_0x255d9c);})[_0xe003('0x15')](function(_0x4a9555){logger['error'](_0xe003('0x26'),_0x4a9555[_0xe003('0x12')],_0x53462d);_0x1ad14a(_0xe30a67[_0xe003('0x11')](0x1f4,_0x4a9555[_0xe003('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 7249ee1..06a4314 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 _0x6324=['path','connect-timeout','Router','../../components/interaction/service','./migration.controller','index','exports','multer','util'];(function(_0x192a38,_0x229b2a){var _0x1d2b72=function(_0xfbdfb5){while(--_0xfbdfb5){_0x192a38['push'](_0x192a38['shift']());}};_0x1d2b72(++_0x229b2a);}(_0x6324,0x142));var _0x4632=function(_0x458959,_0x4cdf7a){_0x458959=_0x458959-0x0;var _0xde7ff6=_0x6324[_0x458959];return _0xde7ff6;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4632('0x5'));var config=require('../../config/environment');var controller=require(_0x4632('0x6'));router['get']('/',controller[_0x4632('0x7')]);module[_0x4632('0x8')]=router; \ No newline at end of file +var _0x9ffd=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./migration.controller','get','exports'];(function(_0x492e13,_0x41624e){var _0x163386=function(_0x2a68ea){while(--_0x2a68ea){_0x492e13['push'](_0x492e13['shift']());}};_0x163386(++_0x41624e);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x287cf6,_0x556da2){_0x287cf6=_0x287cf6-0x0;var _0x182ca4=_0x9ffd[_0x287cf6];return _0x182ca4;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var auth=require(_0xd9ff('0x5'));var interaction=require(_0xd9ff('0x6'));var config=require('../../config/environment');var controller=require(_0xd9ff('0x7'));router[_0xd9ff('0x8')]('/',controller['index']);module[_0xd9ff('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 fd85c5c..2624b58 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 _0x7dc9=['version','sequelize','exports','STRING'];(function(_0x29a29f,_0x155ce7){var _0x443ea3=function(_0xe0dd24){while(--_0xe0dd24){_0x29a29f['push'](_0x29a29f['shift']());}};_0x443ea3(++_0x155ce7);}(_0x7dc9,0x1b5));var _0x97dc=function(_0x42a2f7,_0x564723){_0x42a2f7=_0x42a2f7-0x0;var _0x5026cb=_0x7dc9[_0x42a2f7];return _0x5026cb;};'use strict';var Sequelize=require(_0x97dc('0x0'));module[_0x97dc('0x1')]={'version':{'type':Sequelize[_0x97dc('0x2')],'unique':_0x97dc('0x3')}}; \ No newline at end of file +var _0xf084=['version','exports'];(function(_0x3ab46c,_0x4d26cc){var _0x2c7e90=function(_0x29e83d){while(--_0x29e83d){_0x3ab46c['push'](_0x3ab46c['shift']());}};_0x2c7e90(++_0x4d26cc);}(_0xf084,0x1ab));var _0x4f08=function(_0x491a71,_0x4f1691){_0x491a71=_0x491a71-0x0;var _0xc0fdb4=_0xf084[_0x491a71];return _0xc0fdb4;};'use strict';var Sequelize=require('sequelize');module[_0x4f08('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x4f08('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index e694f1a..94e7a2f 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 _0x43ad=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','set','Content-Range','json','then','destroy','stack','name','send','map','Migration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','catch','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','jsforce','desk.js'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x43ad,0xaf));var _0xd43a=function(_0x4cacfd,_0x3206ed){_0x4cacfd=_0x4cacfd-0x0;var _0x17f3b7=_0x43ad[_0x4cacfd];return _0x17f3b7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd43a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd43a('0x1'));var jsonpatch=require(_0xd43a('0x2'));var rp=require(_0xd43a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd43a('0x4'));var util=require(_0xd43a('0x5'));var path=require(_0xd43a('0x6'));var sox=require('sox');var csv=require(_0xd43a('0x7'));var ejs=require(_0xd43a('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd43a('0x9'));var deskjs=require(_0xd43a('0xa'));var toCsv=require(_0xd43a('0x7'));var querystring=require(_0xd43a('0xb'));var Papa=require(_0xd43a('0xc'));var Redis=require(_0xd43a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd43a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd43a('0xf'));var logger=require(_0xd43a('0x10'))(_0xd43a('0x11'));var utils=require(_0xd43a('0x12'));var config=require(_0xd43a('0x13'));var licenseUtil=require(_0xd43a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x87ae18,_0x2a199b){_0x2a199b=_0x2a199b||0xcc;return function(_0x4d811f){if(_0x4d811f){return _0x87ae18[_0xd43a('0x15')](_0x2a199b);}return _0x87ae18[_0xd43a('0x16')](_0x2a199b)[_0xd43a('0x17')]();};}function respondWithResult(_0x47fa65,_0xa72d6c){_0xa72d6c=_0xa72d6c||0xc8;return function(_0xb5cb28){if(_0xb5cb28){return _0x47fa65['status'](_0xa72d6c)['json'](_0xb5cb28);}};}function respondWithFilteredResult(_0x47bbbd,_0x1a237b){return function(_0x1dc833){if(_0x1dc833){var _0x39c7cc=_0x1dc833[_0xd43a('0x18')],_0x2bf1f2=_0x1a237b[_0xd43a('0x19')],_0x3b9cd6=_0x1a237b[_0xd43a('0x19')]+_0x1a237b['limit'],_0x142afe;if(_0x3b9cd6>=_0x39c7cc){_0x3b9cd6=_0x39c7cc;_0x142afe=0xc8;}else{_0x142afe=0xce;}_0x47bbbd[_0xd43a('0x16')](_0x142afe);return _0x47bbbd[_0xd43a('0x1a')](_0xd43a('0x1b'),_0x2bf1f2+'-'+_0x3b9cd6+'/'+_0x39c7cc)[_0xd43a('0x1c')](_0x1dc833);}return null;};}function patchUpdates(_0x2699c9){return function(_0x5d9a05){try{jsonpatch['apply'](_0x5d9a05,_0x2699c9,!![]);}catch(_0x45cc07){return BPromise['reject'](_0x45cc07);}return _0x5d9a05['save']();};}function saveUpdates(_0x577d28,_0x1784e4){return function(_0x591d20){if(_0x591d20){return _0x591d20['update'](_0x577d28)[_0xd43a('0x1d')](function(_0x2aa319){return _0x2aa319;});}return null;};}function removeEntity(_0x40eaa9,_0x463677){return function(_0x4d54b6){if(_0x4d54b6){return _0x4d54b6[_0xd43a('0x1e')]()[_0xd43a('0x1d')](function(){_0x40eaa9[_0xd43a('0x16')](0xcc)[_0xd43a('0x17')]();});}};}function handleEntityNotFound(_0x4d467c,_0x378180){return function(_0x451105){if(!_0x451105){_0x4d467c['sendStatus'](0x194);}return _0x451105;};}function handleError(_0x52f26f,_0x18eae7){_0x18eae7=_0x18eae7||0x1f4;return function(_0x540978){logger['error'](_0x540978[_0xd43a('0x1f')]);if(_0x540978[_0xd43a('0x20')]){delete _0x540978['name'];}_0x52f26f['status'](_0x18eae7)[_0xd43a('0x21')](_0x540978);};}exports['index']=function(_0x3ec7df,_0x5e89f6){var _0x387d12={},_0x4559c4={},_0x4dad31={'count':0x0,'rows':[]};var _0xfe5b0c=_[_0xd43a('0x22')](db[_0xd43a('0x23')][_0xd43a('0x24')],function(_0x5a9664){return{'name':_0x5a9664[_0xd43a('0x25')],'type':_0x5a9664['type'][_0xd43a('0x26')]};});_0x4559c4['model']=_['map'](_0xfe5b0c,_0xd43a('0x20'));_0x4559c4[_0xd43a('0x27')]=_[_0xd43a('0x28')](_0x3ec7df[_0xd43a('0x27')]);_0x4559c4[_0xd43a('0x29')]=_[_0xd43a('0x2a')](_0x4559c4[_0xd43a('0x2b')],_0x4559c4[_0xd43a('0x27')]);_0x387d12[_0xd43a('0x2c')]=_[_0xd43a('0x2a')](_0x4559c4[_0xd43a('0x2b')],qs[_0xd43a('0x2d')](_0x3ec7df[_0xd43a('0x27')][_0xd43a('0x2d')]));_0x387d12['attributes']=_0x387d12[_0xd43a('0x2c')][_0xd43a('0x2e')]?_0x387d12[_0xd43a('0x2c')]:_0x4559c4['model'];if(!_0x3ec7df[_0xd43a('0x27')][_0xd43a('0x2f')](_0xd43a('0x30'))){_0x387d12[_0xd43a('0x31')]=qs[_0xd43a('0x31')](_0x3ec7df[_0xd43a('0x27')]['limit']);_0x387d12['offset']=qs['offset'](_0x3ec7df[_0xd43a('0x27')][_0xd43a('0x19')]);}_0x387d12[_0xd43a('0x32')]=qs[_0xd43a('0x33')](_0x3ec7df[_0xd43a('0x27')][_0xd43a('0x33')]);_0x387d12['where']=qs[_0xd43a('0x29')](_[_0xd43a('0x34')](_0x3ec7df[_0xd43a('0x27')],_0x4559c4['filters']),_0xfe5b0c);if(_0x3ec7df['query']['filter']){_0x387d12[_0xd43a('0x35')]=_[_0xd43a('0x36')](_0x387d12[_0xd43a('0x35')],{'$or':_['map'](_0xfe5b0c,function(_0x43a25b){if(_0x43a25b[_0xd43a('0x37')]!==_0xd43a('0x38')){var _0xb2426f={};_0xb2426f[_0x43a25b[_0xd43a('0x20')]]={'$like':'%'+_0x3ec7df[_0xd43a('0x27')][_0xd43a('0x39')]+'%'};return _0xb2426f;}})});}_0x387d12=_[_0xd43a('0x36')]({},_0x387d12,_0x3ec7df[_0xd43a('0x3a')]);var _0x23ddf5={'where':_0x387d12[_0xd43a('0x35')]};return db['Migration'][_0xd43a('0x18')](_0x23ddf5)['then'](function(_0x483b44){_0x4dad31[_0xd43a('0x18')]=_0x483b44;if(_0x3ec7df[_0xd43a('0x27')][_0xd43a('0x3b')]){_0x387d12['include']=[{'all':!![]}];}return db[_0xd43a('0x23')][_0xd43a('0x3c')](_0x387d12);})[_0xd43a('0x1d')](function(_0x36624d){_0x4dad31['rows']=_0x36624d;return _0x4dad31;})[_0xd43a('0x1d')](respondWithFilteredResult(_0x5e89f6,_0x387d12))[_0xd43a('0x3d')](handleError(_0x5e89f6,null));}; \ No newline at end of file +var _0xad63=['query','keys','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','limit','order','pick','filters','filter','merge','options','where','includeAll','include','findAll','catch','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','destroy','then','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key'];(function(_0x4dda0d,_0x352779){var _0x32ae66=function(_0x5472ac){while(--_0x5472ac){_0x4dda0d['push'](_0x4dda0d['shift']());}};_0x32ae66(++_0x352779);}(_0xad63,0x121));var _0x3ad6=function(_0x52219f,_0x791de0){_0x52219f=_0x52219f-0x0;var _0x448fd6=_0xad63[_0x52219f];return _0x448fd6;};'use strict';var pdf=require(_0x3ad6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3ad6('0x1'));var zipdir=require(_0x3ad6('0x2'));var jsonpatch=require(_0x3ad6('0x3'));var rp=require(_0x3ad6('0x4'));var moment=require(_0x3ad6('0x5'));var BPromise=require(_0x3ad6('0x6'));var Mustache=require(_0x3ad6('0x7'));var util=require(_0x3ad6('0x8'));var path=require('path');var sox=require(_0x3ad6('0x9'));var csv=require(_0x3ad6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3ad6('0xb'));var squel=require(_0x3ad6('0xc'));var crypto=require(_0x3ad6('0xd'));var jsforce=require(_0x3ad6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3ad6('0xa'));var querystring=require(_0x3ad6('0xf'));var Papa=require(_0x3ad6('0x10'));var Redis=require(_0x3ad6('0x11'));var authService=require(_0x3ad6('0x12'));var qs=require(_0x3ad6('0x13'));var as=require(_0x3ad6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ad6('0x15'))('api');var utils=require(_0x3ad6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3ad6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48102e,_0x8b2dff){_0x8b2dff=_0x8b2dff||0xcc;return function(_0x2e3cca){if(_0x2e3cca){return _0x48102e[_0x3ad6('0x18')](_0x8b2dff);}return _0x48102e[_0x3ad6('0x19')](_0x8b2dff)[_0x3ad6('0x1a')]();};}function respondWithResult(_0x59abc9,_0xb68391){_0xb68391=_0xb68391||0xc8;return function(_0x46ce1f){if(_0x46ce1f){return _0x59abc9[_0x3ad6('0x19')](_0xb68391)[_0x3ad6('0x1b')](_0x46ce1f);}};}function respondWithFilteredResult(_0x5ed9b9,_0x131d8f){return function(_0x3f6682){if(_0x3f6682){var _0x5b2c9c=_0x3f6682[_0x3ad6('0x1c')],_0x1d0f7c=_0x131d8f['offset'],_0x35e60b=_0x131d8f[_0x3ad6('0x1d')]+_0x131d8f['limit'],_0x48b133;if(_0x35e60b>=_0x5b2c9c){_0x35e60b=_0x5b2c9c;_0x48b133=0xc8;}else{_0x48b133=0xce;}_0x5ed9b9[_0x3ad6('0x19')](_0x48b133);return _0x5ed9b9['set'](_0x3ad6('0x1e'),_0x1d0f7c+'-'+_0x35e60b+'/'+_0x5b2c9c)[_0x3ad6('0x1b')](_0x3f6682);}return null;};}function patchUpdates(_0x51c81f){return function(_0x290885){try{jsonpatch['apply'](_0x290885,_0x51c81f,!![]);}catch(_0x34b338){return BPromise[_0x3ad6('0x1f')](_0x34b338);}return _0x290885[_0x3ad6('0x20')]();};}function saveUpdates(_0x183108,_0x4ab6e8){return function(_0x462a91){if(_0x462a91){return _0x462a91[_0x3ad6('0x21')](_0x183108)['then'](function(_0x23e1ad){return _0x23e1ad;});}return null;};}function removeEntity(_0x36c1bc,_0x3dacf2){return function(_0x19f876){if(_0x19f876){return _0x19f876[_0x3ad6('0x22')]()[_0x3ad6('0x23')](function(){_0x36c1bc[_0x3ad6('0x19')](0xcc)[_0x3ad6('0x1a')]();});}};}function handleEntityNotFound(_0x2957d0,_0x365f30){return function(_0x5298d9){if(!_0x5298d9){_0x2957d0[_0x3ad6('0x18')](0x194);}return _0x5298d9;};}function handleError(_0x1aa57f,_0xa9d493){_0xa9d493=_0xa9d493||0x1f4;return function(_0x53033f){logger['error'](_0x53033f[_0x3ad6('0x24')]);if(_0x53033f[_0x3ad6('0x25')]){delete _0x53033f[_0x3ad6('0x25')];}_0x1aa57f[_0x3ad6('0x19')](_0xa9d493)[_0x3ad6('0x26')](_0x53033f);};}exports[_0x3ad6('0x27')]=function(_0xea0172,_0x203815){var _0x24eac0={},_0x352d64={},_0x51e116={'count':0x0,'rows':[]};var _0x10fa9c=_[_0x3ad6('0x28')](db[_0x3ad6('0x29')][_0x3ad6('0x2a')],function(_0x3627e1){return{'name':_0x3627e1[_0x3ad6('0x2b')],'type':_0x3627e1[_0x3ad6('0x2c')][_0x3ad6('0x2d')]};});_0x352d64['model']=_[_0x3ad6('0x28')](_0x10fa9c,_0x3ad6('0x25'));_0x352d64[_0x3ad6('0x2e')]=_[_0x3ad6('0x2f')](_0xea0172[_0x3ad6('0x2e')]);_0x352d64['filters']=_[_0x3ad6('0x30')](_0x352d64['model'],_0x352d64['query']);_0x24eac0['attributes']=_[_0x3ad6('0x30')](_0x352d64['model'],qs[_0x3ad6('0x31')](_0xea0172[_0x3ad6('0x2e')]['fields']));_0x24eac0['attributes']=_0x24eac0[_0x3ad6('0x32')][_0x3ad6('0x33')]?_0x24eac0[_0x3ad6('0x32')]:_0x352d64[_0x3ad6('0x34')];if(!_0xea0172[_0x3ad6('0x2e')][_0x3ad6('0x35')](_0x3ad6('0x36'))){_0x24eac0[_0x3ad6('0x37')]=qs[_0x3ad6('0x37')](_0xea0172[_0x3ad6('0x2e')][_0x3ad6('0x37')]);_0x24eac0['offset']=qs[_0x3ad6('0x1d')](_0xea0172['query'][_0x3ad6('0x1d')]);}_0x24eac0[_0x3ad6('0x38')]=qs['sort'](_0xea0172['query']['sort']);_0x24eac0['where']=qs['filters'](_[_0x3ad6('0x39')](_0xea0172[_0x3ad6('0x2e')],_0x352d64[_0x3ad6('0x3a')]),_0x10fa9c);if(_0xea0172['query'][_0x3ad6('0x3b')]){_0x24eac0['where']=_[_0x3ad6('0x3c')](_0x24eac0['where'],{'$or':_[_0x3ad6('0x28')](_0x10fa9c,function(_0x3ecac5){if(_0x3ecac5[_0x3ad6('0x2c')]!=='VIRTUAL'){var _0x488c9b={};_0x488c9b[_0x3ecac5[_0x3ad6('0x25')]]={'$like':'%'+_0xea0172[_0x3ad6('0x2e')]['filter']+'%'};return _0x488c9b;}})});}_0x24eac0=_[_0x3ad6('0x3c')]({},_0x24eac0,_0xea0172[_0x3ad6('0x3d')]);var _0x89ec13={'where':_0x24eac0[_0x3ad6('0x3e')]};return db[_0x3ad6('0x29')][_0x3ad6('0x1c')](_0x89ec13)['then'](function(_0x5d54d9){_0x51e116[_0x3ad6('0x1c')]=_0x5d54d9;if(_0xea0172[_0x3ad6('0x2e')][_0x3ad6('0x3f')]){_0x24eac0[_0x3ad6('0x40')]=[{'all':!![]}];}return db[_0x3ad6('0x29')][_0x3ad6('0x41')](_0x24eac0);})['then'](function(_0x388a3c){_0x51e116['rows']=_0x388a3c;return _0x51e116;})[_0x3ad6('0x23')](respondWithFilteredResult(_0x203815,_0x24eac0))[_0x3ad6('0x42')](handleError(_0x203815,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index cc0cc0c..33fa148 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 _0x0897=['Migration','migrations','util','../../config/logger','bluebird','request-promise','path','rimraf','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0897,0x18e));var _0x7089=function(_0x1e6481,_0xd8a345){_0x1e6481=_0x1e6481-0x0;var _0x4f5cac=_0x0897[_0x1e6481];return _0x4f5cac;};'use strict';var _=require('lodash');var util=require(_0x7089('0x0'));var logger=require(_0x7089('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7089('0x2'));var rp=require(_0x7089('0x3'));var fs=require('fs');var path=require(_0x7089('0x4'));var rimraf=require(_0x7089('0x5'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x7089('0x6')]=function(_0x26b051,_0x315035){return _0x26b051['define'](_0x7089('0x7'),attributes,{'tableName':_0x7089('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x575a=['moment','request-promise','path','rimraf','../../config/environment','define','Migration','util','api'];(function(_0x3fa5c7,_0x139e0d){var _0x4484a9=function(_0x41c3dd){while(--_0x41c3dd){_0x3fa5c7['push'](_0x3fa5c7['shift']());}};_0x4484a9(++_0x139e0d);}(_0x575a,0x181));var _0xa575=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0x575a[_0x13b7fd];return _0x32a74a;};'use strict';var _=require('lodash');var util=require(_0xa575('0x0'));var logger=require('../../config/logger')(_0xa575('0x1'));var moment=require(_0xa575('0x2'));var BPromise=require('bluebird');var rp=require(_0xa575('0x3'));var fs=require('fs');var path=require(_0xa575('0x4'));var rimraf=require(_0xa575('0x5'));var config=require(_0xa575('0x6'));var attributes=require('./migration.attributes');module['exports']=function(_0x3f6c19,_0x392df0){return _0x3f6c19[_0xa575('0x7')](_0xa575('0x8'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 9bd44c4..e62e57c 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 _0x849a=['rpc','../../config/environment','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a9976,_0x35ba73){var _0x4cc15f=function(_0x1b9bb7){while(--_0x1b9bb7){_0x5a9976['push'](_0x5a9976['shift']());}};_0x4cc15f(++_0x35ba73);}(_0x849a,0x1ba));var _0xa849=function(_0x2571a7,_0x1db1d7){_0x2571a7=_0x2571a7-0x0;var _0x337c09=_0x849a[_0x2571a7];return _0x337c09;};'use strict';var _=require(_0xa849('0x0'));var util=require(_0xa849('0x1'));var moment=require(_0xa849('0x2'));var BPromise=require(_0xa849('0x3'));var rs=require(_0xa849('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa849('0x5'))['db'];var utils=require(_0xa849('0x6'));var logger=require(_0xa849('0x7'))(_0xa849('0x8'));var config=require(_0xa849('0x9'));var jayson=require(_0xa849('0xa'));var client=jayson[_0xa849('0xb')][_0xa849('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ea7b8,_0x308e26,_0x5e5aee){return new BPromise(function(_0x16e755,_0x259965){return client['request'](_0x4ea7b8,_0x5e5aee)[_0xa849('0xd')](function(_0x163c80){logger[_0xa849('0xe')](_0xa849('0xf'),_0x308e26,_0xa849('0x10'));logger[_0xa849('0x11')](_0xa849('0x12'),_0x308e26,_0xa849('0x10'),JSON[_0xa849('0x13')](_0x163c80));if(_0x163c80[_0xa849('0x14')]){if(_0x163c80[_0xa849('0x14')][_0xa849('0x15')]===0x1f4){logger[_0xa849('0x14')](_0xa849('0xf'),_0x308e26,_0x163c80[_0xa849('0x14')][_0xa849('0x16')]);return _0x259965(_0x163c80[_0xa849('0x14')][_0xa849('0x16')]);}logger[_0xa849('0x14')](_0xa849('0xf'),_0x308e26,_0x163c80[_0xa849('0x14')][_0xa849('0x16')]);return _0x16e755(_0x163c80['error'][_0xa849('0x16')]);}else{logger[_0xa849('0xe')](_0xa849('0xf'),_0x308e26,'request\x20sent');_0x16e755(_0x163c80[_0xa849('0x17')][_0xa849('0x16')]);}})[_0xa849('0x18')](function(_0x3a9a41){logger[_0xa849('0x14')](_0xa849('0xf'),_0x308e26,_0x3a9a41);_0x259965(_0x3a9a41);});});} \ No newline at end of file +var _0x3753=['message','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','Migration,\x20%s,\x20%s'];(function(_0x10585f,_0x2dd9d1){var _0x393323=function(_0x1e094a){while(--_0x1e094a){_0x10585f['push'](_0x10585f['shift']());}};_0x393323(++_0x2dd9d1);}(_0x3753,0x6d));var _0x3375=function(_0x76953b,_0x260952){_0x76953b=_0x76953b-0x0;var _0x547af2=_0x3753[_0x76953b];return _0x547af2;};'use strict';var _=require(_0x3375('0x0'));var util=require('util');var moment=require(_0x3375('0x1'));var BPromise=require(_0x3375('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3375('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3375('0x4'));var logger=require('../../config/logger')(_0x3375('0x5'));var config=require(_0x3375('0x6'));var jayson=require(_0x3375('0x7'));var client=jayson[_0x3375('0x8')][_0x3375('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x377691,_0x3a1c7f,_0x8802d1){return new BPromise(function(_0x260e45,_0x3cf9bb){return client[_0x3375('0xa')](_0x377691,_0x8802d1)[_0x3375('0xb')](function(_0x349d9e){logger[_0x3375('0xc')]('Migration,\x20%s,\x20%s',_0x3a1c7f,_0x3375('0xd'));logger['debug'](_0x3375('0xe'),_0x3a1c7f,_0x3375('0xd'),JSON['stringify'](_0x349d9e));if(_0x349d9e[_0x3375('0xf')]){if(_0x349d9e[_0x3375('0xf')]['code']===0x1f4){logger[_0x3375('0xf')](_0x3375('0x10'),_0x3a1c7f,_0x349d9e['error'][_0x3375('0x11')]);return _0x3cf9bb(_0x349d9e[_0x3375('0xf')][_0x3375('0x11')]);}logger[_0x3375('0xf')](_0x3375('0x10'),_0x3a1c7f,_0x349d9e[_0x3375('0xf')][_0x3375('0x11')]);return _0x260e45(_0x349d9e[_0x3375('0xf')]['message']);}else{logger['info']('Migration,\x20%s,\x20%s',_0x3a1c7f,'request\x20sent');_0x260e45(_0x349d9e['result'][_0x3375('0x11')]);}})['catch'](function(_0x1da3c0){logger[_0x3375('0xf')](_0x3375('0x10'),_0x3a1c7f,_0x1da3c0);_0x3cf9bb(_0x1da3c0);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index fcde7a4..8f490f4 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 _0x9888=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','multer'];(function(_0x3f8ea4,_0x84bc4f){var _0x434fd0=function(_0x4ffd2c){while(--_0x4ffd2c){_0x3f8ea4['push'](_0x3f8ea4['shift']());}};_0x434fd0(++_0x84bc4f);}(_0x9888,0xd0));var _0x8988=function(_0x158f79,_0x3b3688){_0x158f79=_0x158f79-0x0;var _0x5c4da1=_0x9888[_0x158f79];return _0x5c4da1;};'use strict';var multer=require(_0x8988('0x0'));var util=require(_0x8988('0x1'));var path=require(_0x8988('0x2'));var timeout=require(_0x8988('0x3'));var express=require(_0x8988('0x4'));var router=express[_0x8988('0x5')]();var auth=require(_0x8988('0x6'));var interaction=require(_0x8988('0x7'));var config=require(_0x8988('0x8'));var controller=require(_0x8988('0x9'));router[_0x8988('0xa')]('/',auth[_0x8988('0xb')](),controller[_0x8988('0xc')]);router[_0x8988('0xa')](_0x8988('0xd'),auth[_0x8988('0xb')](),controller['show']);router[_0x8988('0xe')]('/',auth[_0x8988('0xb')](),controller[_0x8988('0xf')]);router[_0x8988('0x10')](_0x8988('0xd'),auth[_0x8988('0xb')](),controller['update']);router[_0x8988('0x11')](_0x8988('0xd'),auth[_0x8988('0xb')](),controller[_0x8988('0x12')]);module['exports']=router; \ No newline at end of file +var _0xcd86=['get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0xc66c50,_0x4dfbc1){var _0x48bc6f=function(_0x781d40){while(--_0x781d40){_0xc66c50['push'](_0xc66c50['shift']());}};_0x48bc6f(++_0x4dfbc1);}(_0xcd86,0x16f));var _0x6cd8=function(_0x225f50,_0x48a77d){_0x225f50=_0x225f50-0x0;var _0x19d003=_0xcd86[_0x225f50];return _0x19d003;};'use strict';var multer=require('multer');var util=require(_0x6cd8('0x0'));var path=require(_0x6cd8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6cd8('0x2')]();var auth=require(_0x6cd8('0x3'));var interaction=require(_0x6cd8('0x4'));var config=require(_0x6cd8('0x5'));var controller=require(_0x6cd8('0x6'));router[_0x6cd8('0x7')]('/',auth[_0x6cd8('0x8')](),controller['index']);router[_0x6cd8('0x7')](_0x6cd8('0x9'),auth[_0x6cd8('0x8')](),controller[_0x6cd8('0xa')]);router[_0x6cd8('0xb')]('/',auth[_0x6cd8('0x8')](),controller[_0x6cd8('0xc')]);router[_0x6cd8('0xd')]('/:id',auth[_0x6cd8('0x8')](),controller[_0x6cd8('0xe')]);router[_0x6cd8('0xf')]('/:id',auth[_0x6cd8('0x8')](),controller['destroy']);module[_0x6cd8('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 c4fcbd9..a797d73 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(_0x4634d7,_0x354459){var _0x365b57=function(_0x1f1030){while(--_0x1f1030){_0x4634d7['push'](_0x4634d7['shift']());}};_0x365b57(++_0x354459);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x2036e8,_0xdd1721){var _0x1072bf=function(_0x491c63){while(--_0x491c63){_0x2036e8['push'](_0x2036e8['shift']());}};_0x1072bf(++_0xdd1721);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 e34abf0..e750239 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 _0x820e=['offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','Network','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','find','create','transaction','body','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','sequelize','update','TURN','format','chan_sip.so','toUpperCase','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','code','error','Network,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count'];(function(_0x33c52d,_0x42df8d){var _0x48201d=function(_0x10841d){while(--_0x10841d){_0x33c52d['push'](_0x33c52d['shift']());}};_0x48201d(++_0x42df8d);}(_0x820e,0xae));var _0xe820=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x820e[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0xe820('0x0'));var emlformat=require(_0xe820('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe820('0x2'));var jsonpatch=require(_0xe820('0x3'));var rp=require(_0xe820('0x4'));var moment=require(_0xe820('0x5'));var BPromise=require(_0xe820('0x6'));var Mustache=require(_0xe820('0x7'));var util=require(_0xe820('0x8'));var path=require(_0xe820('0x9'));var sox=require(_0xe820('0xa'));var csv=require('to-csv');var ejs=require(_0xe820('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe820('0xc'));var crypto=require(_0xe820('0xd'));var jsforce=require(_0xe820('0xe'));var deskjs=require(_0xe820('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe820('0x10'));var Redis=require(_0xe820('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe820('0x12'));var as=require(_0xe820('0x13'));var hardwareService=require(_0xe820('0x14'));var logger=require(_0xe820('0x15'))('api');var utils=require(_0xe820('0x16'));var config=require(_0xe820('0x17'));var licenseUtil=require(_0xe820('0x18'));var db=require(_0xe820('0x19'))['db'];var jayson=require(_0xe820('0x1a'));var client=jayson['client'][_0xe820('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x167a0e,_0x3220b2,_0x1c083e,_0x151b06){return new BPromise(function(_0x2b4208,_0x16d0e5){var _0x2745de=_0x151b06||client;return _0x2745de[_0xe820('0x1c')](_0x167a0e,_0x1c083e)[_0xe820('0x1d')](function(_0x5cfce8){logger['info']('Network,\x20%s,\x20%s',_0x3220b2,_0xe820('0x1e'));logger['debug'](_0xe820('0x1f'),_0x3220b2,_0xe820('0x1e'),JSON[_0xe820('0x20')](_0x5cfce8));if(_0x5cfce8['error']){if(_0x5cfce8['error'][_0xe820('0x21')]===0x1f4){logger[_0xe820('0x22')](_0xe820('0x23'),_0x3220b2,_0x5cfce8['error'][_0xe820('0x24')]);return _0x16d0e5(_0x5cfce8[_0xe820('0x22')][_0xe820('0x24')]);}logger[_0xe820('0x22')](_0xe820('0x23'),_0x3220b2,_0x5cfce8['error'][_0xe820('0x24')]);return _0x2b4208(_0x5cfce8[_0xe820('0x22')][_0xe820('0x24')]);}else{logger['info'](_0xe820('0x23'),_0x3220b2,_0xe820('0x1e'));_0x2b4208(_0x5cfce8[_0xe820('0x25')]['message']);}})[_0xe820('0x26')](function(_0x2e45a3){logger['error'](_0xe820('0x23'),_0x3220b2,_0x2e45a3);_0x16d0e5(_0x2e45a3);});});}function respondWithStatusCode(_0xa6972d,_0x40f942){_0x40f942=_0x40f942||0xcc;return function(_0x59888f){if(_0x59888f){return _0xa6972d[_0xe820('0x27')](_0x40f942);}return _0xa6972d[_0xe820('0x28')](_0x40f942)[_0xe820('0x29')]();};}function respondWithResult(_0x56d1a6,_0x19517c){_0x19517c=_0x19517c||0xc8;return function(_0x13f1c6){if(_0x13f1c6){return _0x56d1a6['status'](_0x19517c)[_0xe820('0x2a')](_0x13f1c6);}};}function respondWithFilteredResult(_0x3eb8d5,_0x4fba68){return function(_0x5c83c0){if(_0x5c83c0){var _0x25f016=_0x5c83c0[_0xe820('0x2b')],_0x2d4372=_0x4fba68[_0xe820('0x2c')],_0x5912c1=_0x4fba68[_0xe820('0x2c')]+_0x4fba68[_0xe820('0x2d')],_0x14dd61;if(_0x5912c1>=_0x25f016){_0x5912c1=_0x25f016;_0x14dd61=0xc8;}else{_0x14dd61=0xce;}_0x3eb8d5['status'](_0x14dd61);return _0x3eb8d5[_0xe820('0x2e')](_0xe820('0x2f'),_0x2d4372+'-'+_0x5912c1+'/'+_0x25f016)[_0xe820('0x2a')](_0x5c83c0);}return null;};}function patchUpdates(_0x3c3b2d){return function(_0x55ab9e){try{jsonpatch[_0xe820('0x30')](_0x55ab9e,_0x3c3b2d,!![]);}catch(_0x487d60){return BPromise[_0xe820('0x31')](_0x487d60);}return _0x55ab9e[_0xe820('0x32')]();};}function saveUpdates(_0x11beb7,_0x573b08){return function(_0x5a70b4){if(_0x5a70b4){return _0x5a70b4['update'](_0x11beb7)[_0xe820('0x1d')](function(_0x2abe1f){return _0x2abe1f;});}return null;};}function removeEntity(_0x3c7625,_0x495107){return function(_0x384329){if(_0x384329){return _0x384329[_0xe820('0x33')]()[_0xe820('0x1d')](function(){_0x3c7625[_0xe820('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5acb32,_0x530c0a){return function(_0x227964){if(!_0x227964){_0x5acb32['sendStatus'](0x194);}return _0x227964;};}function handleError(_0x4fa322,_0x103cf4){_0x103cf4=_0x103cf4||0x1f4;return function(_0x336b5d){logger[_0xe820('0x22')](_0x336b5d[_0xe820('0x34')]);if(_0x336b5d[_0xe820('0x35')]){delete _0x336b5d[_0xe820('0x35')];}_0x4fa322[_0xe820('0x28')](_0x103cf4)[_0xe820('0x36')](_0x336b5d);};}exports[_0xe820('0x37')]=function(_0x3b03d8,_0x2d9368){var _0x37cf1d={},_0x3f92a5={},_0x5d5368={'count':0x0,'rows':[]};var _0x55ba29=_[_0xe820('0x38')](db[_0xe820('0x39')]['rawAttributes'],function(_0x4db973){return{'name':_0x4db973[_0xe820('0x3a')],'type':_0x4db973[_0xe820('0x3b')][_0xe820('0x3c')]};});_0x3f92a5['model']=_[_0xe820('0x38')](_0x55ba29,_0xe820('0x35'));_0x3f92a5[_0xe820('0x3d')]=_[_0xe820('0x3e')](_0x3b03d8[_0xe820('0x3d')]);_0x3f92a5['filters']=_['intersection'](_0x3f92a5[_0xe820('0x3f')],_0x3f92a5[_0xe820('0x3d')]);_0x37cf1d['attributes']=_[_0xe820('0x40')](_0x3f92a5[_0xe820('0x3f')],qs[_0xe820('0x41')](_0x3b03d8[_0xe820('0x3d')][_0xe820('0x41')]));_0x37cf1d[_0xe820('0x42')]=_0x37cf1d['attributes'][_0xe820('0x43')]?_0x37cf1d[_0xe820('0x42')]:_0x3f92a5[_0xe820('0x3f')];if(!_0x3b03d8[_0xe820('0x3d')][_0xe820('0x44')](_0xe820('0x45'))){_0x37cf1d[_0xe820('0x2d')]=qs[_0xe820('0x2d')](_0x3b03d8[_0xe820('0x3d')][_0xe820('0x2d')]);_0x37cf1d['offset']=qs[_0xe820('0x2c')](_0x3b03d8['query'][_0xe820('0x2c')]);}_0x37cf1d[_0xe820('0x46')]=qs['sort'](_0x3b03d8['query']['sort']);_0x37cf1d[_0xe820('0x47')]=qs[_0xe820('0x48')](_[_0xe820('0x49')](_0x3b03d8[_0xe820('0x3d')],_0x3f92a5[_0xe820('0x48')]),_0x55ba29);if(_0x3b03d8[_0xe820('0x3d')][_0xe820('0x4a')]){_0x37cf1d['where']=_['merge'](_0x37cf1d[_0xe820('0x47')],{'$or':_[_0xe820('0x38')](_0x55ba29,function(_0x564214){if(_0x564214[_0xe820('0x3b')]!==_0xe820('0x4b')){var _0x2ce5a8={};_0x2ce5a8[_0x564214[_0xe820('0x35')]]={'$like':'%'+_0x3b03d8[_0xe820('0x3d')]['filter']+'%'};return _0x2ce5a8;}})});}_0x37cf1d=_['merge']({},_0x37cf1d,_0x3b03d8[_0xe820('0x4c')]);var _0x42aa46={'where':_0x37cf1d[_0xe820('0x47')]};return db[_0xe820('0x39')]['count'](_0x42aa46)[_0xe820('0x1d')](function(_0x52b350){_0x5d5368['count']=_0x52b350;if(_0x3b03d8[_0xe820('0x3d')][_0xe820('0x4d')]){_0x37cf1d[_0xe820('0x4e')]=[{'all':!![]}];}return db['Network'][_0xe820('0x4f')](_0x37cf1d);})['then'](function(_0x435ec4){_0x5d5368['rows']=_0x435ec4;return _0x5d5368;})[_0xe820('0x1d')](respondWithFilteredResult(_0x2d9368,_0x37cf1d))['catch'](handleError(_0x2d9368,null));};exports[_0xe820('0x50')]=function(_0x541ca0,_0x570806){var _0x220c5f={'raw':!![],'where':{'id':_0x541ca0[_0xe820('0x51')]['id']}},_0x556d58={};_0x556d58[_0xe820('0x3f')]=_[_0xe820('0x3e')](db[_0xe820('0x39')][_0xe820('0x52')]);_0x556d58[_0xe820('0x3d')]=_[_0xe820('0x3e')](_0x541ca0['query']);_0x556d58['filters']=_[_0xe820('0x40')](_0x556d58[_0xe820('0x3f')],_0x556d58[_0xe820('0x3d')]);_0x220c5f[_0xe820('0x42')]=_[_0xe820('0x40')](_0x556d58[_0xe820('0x3f')],qs[_0xe820('0x41')](_0x541ca0[_0xe820('0x3d')][_0xe820('0x41')]));_0x220c5f[_0xe820('0x42')]=_0x220c5f[_0xe820('0x42')][_0xe820('0x43')]?_0x220c5f[_0xe820('0x42')]:_0x556d58['model'];if(_0x541ca0['query'][_0xe820('0x4d')]){_0x220c5f[_0xe820('0x4e')]=[{'all':!![]}];}_0x220c5f=_['merge']({},_0x220c5f,_0x541ca0[_0xe820('0x4c')]);return db[_0xe820('0x39')][_0xe820('0x53')](_0x220c5f)[_0xe820('0x1d')](handleEntityNotFound(_0x570806,null))[_0xe820('0x1d')](respondWithResult(_0x570806,null))['catch'](handleError(_0x570806,null));};exports[_0xe820('0x54')]=function(_0x2194eb,_0x235cdd,_0x37a448){var _0x9775b5;return db['sequelize'][_0xe820('0x55')](function(_0x16ce34){return db['Network'][_0xe820('0x54')](_0x2194eb[_0xe820('0x56')],{'raw':!![]})[_0xe820('0x1d')](function(_0x1a30ef){_0x9775b5=_0x1a30ef;return db[_0xe820('0x39')][_0xe820('0x4f')]({'where':{'type':_0x2194eb[_0xe820('0x56')][_0xe820('0x3b')]},'raw':!![]});})[_0xe820('0x1d')](function(_0xe01bd2){if(_0x9775b5[_0xe820('0x3b')]['toUpperCase']()==_0xe820('0x57')){var _0x5124f8=fs[_0xe820('0x58')](path['join'](config[_0xe820('0x59')],_0xe820('0x5a')),_0xe820('0x5b'));var _0x40206b=ejs[_0xe820('0x5c')](_0x5124f8,{'networks':_0xe01bd2||[]});fs[_0xe820('0x5d')](_0xe820('0x5e'),_0x40206b);return respondWithRpcPromise(_0xe820('0x5f'),'create',{'module':'res_stun_monitor.so'});}else if(_0x9775b5[_0xe820('0x3b')]['toUpperCase']()=='TURN'){var _0x56ca8e=fs['readFileSync'](path[_0xe820('0x60')](config[_0xe820('0x59')],_0xe820('0x61')),_0xe820('0x5b'));var _0x3cf185=ejs[_0xe820('0x5c')](_0x56ca8e,{'networks':_0xe01bd2||[]});fs[_0xe820('0x5d')](_0xe820('0x62'),_0x3cf185);return respondWithRpcPromise(_0xe820('0x5f'),_0xe820('0x54'),{'module':_0xe820('0x63')});}else{var _0x275d95=fs['readFileSync'](path['join'](config[_0xe820('0x59')],_0xe820('0x64')),_0xe820('0x5b'));var _0x382532=ejs[_0xe820('0x5c')](_0x275d95,{'networks':_0xe01bd2||[]});fs[_0xe820('0x5d')](util['format'](_0xe820('0x65'),_0x2194eb[_0xe820('0x56')]['type'][_0xe820('0x66')]()),_0x382532);return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});}return null;})[_0xe820('0x1d')](function(){return _0x9775b5;});})[_0xe820('0x1d')](respondWithResult(_0x235cdd,0xc9))[_0xe820('0x26')](handleError(_0x235cdd,null));};exports['update']=function(_0x2d94d0,_0x56dd3c,_0x31acaa){var _0x4b415e;return db[_0xe820('0x67')][_0xe820('0x55')](function(_0x80d037){return db[_0xe820('0x39')]['find']({'where':{'id':_0x2d94d0[_0xe820('0x51')]['id']}})['then'](handleEntityNotFound(_0x56dd3c,null))[_0xe820('0x1d')](saveUpdates(_0x2d94d0[_0xe820('0x56')],null))[_0xe820('0x1d')](function(_0x4d9ecc){if(_0x4d9ecc){_0x4b415e=_0x4d9ecc;return db[_0xe820('0x39')]['findAll']({'where':{'type':_0x4b415e[_0xe820('0x3b')]},'raw':!![]});}return null;})[_0xe820('0x1d')](function(_0x487e2f){if(_0x4b415e[_0xe820('0x3b')]['toUpperCase']()=='STUN'){var _0x584c35=fs[_0xe820('0x58')](path[_0xe820('0x60')](config[_0xe820('0x59')],_0xe820('0x5a')),_0xe820('0x5b'));var _0x2dfea7=ejs['render'](_0x584c35,{'networks':_0x487e2f||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x2dfea7);return respondWithRpcPromise(_0xe820('0x5f'),_0xe820('0x68'),{'module':_0xe820('0x63')});}else if(_0x4b415e[_0xe820('0x3b')]['toUpperCase']()==_0xe820('0x69')){var _0xe442ee=fs[_0xe820('0x58')](path[_0xe820('0x60')](config[_0xe820('0x59')],_0xe820('0x61')),_0xe820('0x5b'));var _0x3de612=ejs[_0xe820('0x5c')](_0xe442ee,{'networks':_0x487e2f||[]});fs[_0xe820('0x5d')](_0xe820('0x62'),_0x3de612);return respondWithRpcPromise(_0xe820('0x5f'),_0xe820('0x68'),{'module':_0xe820('0x63')});}else{var _0x21fec1=fs[_0xe820('0x58')](path['join'](config[_0xe820('0x59')],'server/files/templates/network.ejs'),_0xe820('0x5b'));var _0xca5599=ejs[_0xe820('0x5c')](_0x21fec1,{'networks':_0x487e2f||[]});fs['writeFileSync'](util[_0xe820('0x6a')](_0xe820('0x65'),_0x2d94d0[_0xe820('0x56')][_0xe820('0x3b')]['toLowerCase']()),_0xca5599);return respondWithRpcPromise(_0xe820('0x5f'),_0xe820('0x68'),{'module':_0xe820('0x6b')});}return null;})[_0xe820('0x1d')](function(_0xe05ffc){if(_0xe05ffc){return _0x4b415e;}return null;});})[_0xe820('0x1d')](respondWithResult(_0x56dd3c,null))[_0xe820('0x26')](handleError(_0x56dd3c,null));};exports['destroy']=function(_0x195e06,_0xc451af,_0x6aaf81){var _0x320f9c;return db[_0xe820('0x39')][_0xe820('0x53')]({'where':{'id':_0x195e06[_0xe820('0x51')]['id']}})['then'](function(_0x349ee5){_0x320f9c=_0x349ee5;return _0x349ee5;})['then'](handleEntityNotFound(_0xc451af,null))[_0xe820('0x1d')](removeEntity(_0xc451af,null))[_0xe820('0x1d')](function(){if(_0x320f9c){return db['Network']['findAll']({'where':{'type':_0x320f9c['type']},'raw':!![]});}})[_0xe820('0x1d')](function(_0x580fcc){if(_0x320f9c[_0xe820('0x3b')][_0xe820('0x6c')]()==_0xe820('0x57')){var _0x440433=fs[_0xe820('0x58')](path[_0xe820('0x60')](config[_0xe820('0x59')],'server/files/templates/stun_multiple.ejs'),_0xe820('0x5b'));var _0x5a64fd=ejs[_0xe820('0x5c')](_0x440433,{'networks':_0x580fcc||[]});fs[_0xe820('0x5d')](_0xe820('0x5e'),_0x5a64fd);return respondWithRpcPromise(_0xe820('0x5f'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x320f9c[_0xe820('0x3b')][_0xe820('0x6c')]()==_0xe820('0x69')){var _0x3fd80b=fs['readFileSync'](path['join'](config[_0xe820('0x59')],_0xe820('0x61')),'utf8');var _0x558c60=ejs[_0xe820('0x5c')](_0x3fd80b,{'networks':_0x580fcc||[]});fs['writeFileSync'](_0xe820('0x62'),_0x558c60);return respondWithRpcPromise(_0xe820('0x5f'),_0xe820('0x33'),{'module':_0xe820('0x63')});}else{var _0x275289=fs[_0xe820('0x58')](path[_0xe820('0x60')](config['root'],_0xe820('0x64')),_0xe820('0x5b'));var _0x3365ef=ejs[_0xe820('0x5c')](_0x275289,{'networks':_0x580fcc||[]});fs[_0xe820('0x5d')](util[_0xe820('0x6a')](_0xe820('0x65'),_0x195e06[_0xe820('0x56')][_0xe820('0x3b')][_0xe820('0x66')]()),_0x3365ef);return respondWithRpcPromise('Reload',_0xe820('0x33'),{'module':'chan_sip.so'});}return null;})[_0xe820('0x26')](handleError(_0xc451af,null));}; \ No newline at end of file +var _0xe18a=['end','sendStatus','stack','name','send','map','Network','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','sequelize','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','transaction','/etc/asterisk/stun_xcally.conf','format','chan_sip.so','STUN','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x224974,_0x512c53){var _0x57ccdc=function(_0x418405){while(--_0x418405){_0x224974['push'](_0x224974['shift']());}};_0x57ccdc(++_0x512c53);}(_0xe18a,0x181));var _0xae18=function(_0x11edd1,_0x5224f8){_0x11edd1=_0x11edd1-0x0;var _0x4eaf7d=_0xe18a[_0x11edd1];return _0x4eaf7d;};'use strict';var pdf=require(_0xae18('0x0'));var emlformat=require(_0xae18('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xae18('0x2'));var jsonpatch=require(_0xae18('0x3'));var rp=require('request-promise');var moment=require(_0xae18('0x4'));var BPromise=require(_0xae18('0x5'));var Mustache=require(_0xae18('0x6'));var util=require(_0xae18('0x7'));var path=require(_0xae18('0x8'));var sox=require(_0xae18('0x9'));var csv=require(_0xae18('0xa'));var ejs=require(_0xae18('0xb'));var fs=require('fs');var _=require(_0xae18('0xc'));var squel=require(_0xae18('0xd'));var crypto=require(_0xae18('0xe'));var jsforce=require(_0xae18('0xf'));var deskjs=require(_0xae18('0x10'));var toCsv=require(_0xae18('0xa'));var querystring=require(_0xae18('0x11'));var Papa=require(_0xae18('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xae18('0x13'));var hardwareService=require(_0xae18('0x14'));var logger=require(_0xae18('0x15'))(_0xae18('0x16'));var utils=require(_0xae18('0x17'));var config=require(_0xae18('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xae18('0x19'))['db'];var jayson=require(_0xae18('0x1a'));var client=jayson[_0xae18('0x1b')][_0xae18('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4fe92f,_0x4b8142,_0x1c3d3c,_0x2281f7){return new BPromise(function(_0x4e5bb7,_0x22ea09){var _0x28c92c=_0x2281f7||client;return _0x28c92c[_0xae18('0x1d')](_0x4fe92f,_0x1c3d3c)['then'](function(_0x2fb3fa){logger[_0xae18('0x1e')](_0xae18('0x1f'),_0x4b8142,_0xae18('0x20'));logger[_0xae18('0x21')]('Network,\x20%s,\x20%s,\x20%s',_0x4b8142,_0xae18('0x20'),JSON[_0xae18('0x22')](_0x2fb3fa));if(_0x2fb3fa['error']){if(_0x2fb3fa['error'][_0xae18('0x23')]===0x1f4){logger[_0xae18('0x24')]('Network,\x20%s,\x20%s',_0x4b8142,_0x2fb3fa[_0xae18('0x24')][_0xae18('0x25')]);return _0x22ea09(_0x2fb3fa['error']['message']);}logger[_0xae18('0x24')](_0xae18('0x1f'),_0x4b8142,_0x2fb3fa[_0xae18('0x24')][_0xae18('0x25')]);return _0x4e5bb7(_0x2fb3fa['error']['message']);}else{logger[_0xae18('0x1e')](_0xae18('0x1f'),_0x4b8142,'request\x20sent');_0x4e5bb7(_0x2fb3fa['result'][_0xae18('0x25')]);}})[_0xae18('0x26')](function(_0x16aadb){logger[_0xae18('0x24')](_0xae18('0x1f'),_0x4b8142,_0x16aadb);_0x22ea09(_0x16aadb);});});}function respondWithStatusCode(_0x1c15d9,_0x4a97e3){_0x4a97e3=_0x4a97e3||0xcc;return function(_0x20431e){if(_0x20431e){return _0x1c15d9['sendStatus'](_0x4a97e3);}return _0x1c15d9[_0xae18('0x27')](_0x4a97e3)['end']();};}function respondWithResult(_0xd25ef7,_0x3339a1){_0x3339a1=_0x3339a1||0xc8;return function(_0x43b343){if(_0x43b343){return _0xd25ef7[_0xae18('0x27')](_0x3339a1)[_0xae18('0x28')](_0x43b343);}};}function respondWithFilteredResult(_0x3689e5,_0x93cbda){return function(_0x307e93){if(_0x307e93){var _0x3be83c=_0x307e93[_0xae18('0x29')],_0x1893af=_0x93cbda[_0xae18('0x2a')],_0x4207fc=_0x93cbda[_0xae18('0x2a')]+_0x93cbda[_0xae18('0x2b')],_0x299f09;if(_0x4207fc>=_0x3be83c){_0x4207fc=_0x3be83c;_0x299f09=0xc8;}else{_0x299f09=0xce;}_0x3689e5[_0xae18('0x27')](_0x299f09);return _0x3689e5['set'](_0xae18('0x2c'),_0x1893af+'-'+_0x4207fc+'/'+_0x3be83c)[_0xae18('0x28')](_0x307e93);}return null;};}function patchUpdates(_0x24f765){return function(_0x5e33f3){try{jsonpatch[_0xae18('0x2d')](_0x5e33f3,_0x24f765,!![]);}catch(_0x86db87){return BPromise[_0xae18('0x2e')](_0x86db87);}return _0x5e33f3[_0xae18('0x2f')]();};}function saveUpdates(_0xf64b45,_0x4a457b){return function(_0x5954f8){if(_0x5954f8){return _0x5954f8[_0xae18('0x30')](_0xf64b45)['then'](function(_0x1688b1){return _0x1688b1;});}return null;};}function removeEntity(_0x46842a,_0x3a926c){return function(_0x344293){if(_0x344293){return _0x344293[_0xae18('0x31')]()[_0xae18('0x32')](function(){_0x46842a[_0xae18('0x27')](0xcc)[_0xae18('0x33')]();});}};}function handleEntityNotFound(_0x3fe855,_0xa424fa){return function(_0x228831){if(!_0x228831){_0x3fe855[_0xae18('0x34')](0x194);}return _0x228831;};}function handleError(_0x2ba2db,_0x39a151){_0x39a151=_0x39a151||0x1f4;return function(_0x536fae){logger[_0xae18('0x24')](_0x536fae[_0xae18('0x35')]);if(_0x536fae[_0xae18('0x36')]){delete _0x536fae[_0xae18('0x36')];}_0x2ba2db[_0xae18('0x27')](_0x39a151)[_0xae18('0x37')](_0x536fae);};}exports['index']=function(_0x561ce2,_0x12a8c0){var _0x1faaa3={},_0x27b84c={},_0x2e71fb={'count':0x0,'rows':[]};var _0x5b04ef=_[_0xae18('0x38')](db[_0xae18('0x39')][_0xae18('0x3a')],function(_0x50c8a3){return{'name':_0x50c8a3['fieldName'],'type':_0x50c8a3['type'][_0xae18('0x3b')]};});_0x27b84c['model']=_[_0xae18('0x38')](_0x5b04ef,_0xae18('0x36'));_0x27b84c[_0xae18('0x3c')]=_[_0xae18('0x3d')](_0x561ce2[_0xae18('0x3c')]);_0x27b84c['filters']=_[_0xae18('0x3e')](_0x27b84c[_0xae18('0x3f')],_0x27b84c[_0xae18('0x3c')]);_0x1faaa3[_0xae18('0x40')]=_[_0xae18('0x3e')](_0x27b84c[_0xae18('0x3f')],qs[_0xae18('0x41')](_0x561ce2[_0xae18('0x3c')]['fields']));_0x1faaa3[_0xae18('0x40')]=_0x1faaa3['attributes'][_0xae18('0x42')]?_0x1faaa3[_0xae18('0x40')]:_0x27b84c[_0xae18('0x3f')];if(!_0x561ce2[_0xae18('0x3c')]['hasOwnProperty'](_0xae18('0x43'))){_0x1faaa3['limit']=qs[_0xae18('0x2b')](_0x561ce2[_0xae18('0x3c')][_0xae18('0x2b')]);_0x1faaa3['offset']=qs[_0xae18('0x2a')](_0x561ce2[_0xae18('0x3c')][_0xae18('0x2a')]);}_0x1faaa3[_0xae18('0x44')]=qs[_0xae18('0x45')](_0x561ce2[_0xae18('0x3c')][_0xae18('0x45')]);_0x1faaa3[_0xae18('0x46')]=qs[_0xae18('0x47')](_[_0xae18('0x48')](_0x561ce2[_0xae18('0x3c')],_0x27b84c[_0xae18('0x47')]),_0x5b04ef);if(_0x561ce2[_0xae18('0x3c')][_0xae18('0x49')]){_0x1faaa3[_0xae18('0x46')]=_[_0xae18('0x4a')](_0x1faaa3['where'],{'$or':_[_0xae18('0x38')](_0x5b04ef,function(_0x49f98e){if(_0x49f98e[_0xae18('0x4b')]!==_0xae18('0x4c')){var _0x16b94d={};_0x16b94d[_0x49f98e[_0xae18('0x36')]]={'$like':'%'+_0x561ce2[_0xae18('0x3c')][_0xae18('0x49')]+'%'};return _0x16b94d;}})});}_0x1faaa3=_[_0xae18('0x4a')]({},_0x1faaa3,_0x561ce2[_0xae18('0x4d')]);var _0x3797a5={'where':_0x1faaa3[_0xae18('0x46')]};return db[_0xae18('0x39')][_0xae18('0x29')](_0x3797a5)[_0xae18('0x32')](function(_0x1e8097){_0x2e71fb['count']=_0x1e8097;if(_0x561ce2['query'][_0xae18('0x4e')]){_0x1faaa3['include']=[{'all':!![]}];}return db['Network'][_0xae18('0x4f')](_0x1faaa3);})[_0xae18('0x32')](function(_0x42a32a){_0x2e71fb[_0xae18('0x50')]=_0x42a32a;return _0x2e71fb;})[_0xae18('0x32')](respondWithFilteredResult(_0x12a8c0,_0x1faaa3))[_0xae18('0x26')](handleError(_0x12a8c0,null));};exports[_0xae18('0x51')]=function(_0x4ade12,_0x2aad4b){var _0x41a696={'raw':!![],'where':{'id':_0x4ade12[_0xae18('0x52')]['id']}},_0xe79712={};_0xe79712[_0xae18('0x3f')]=_[_0xae18('0x3d')](db[_0xae18('0x39')]['rawAttributes']);_0xe79712[_0xae18('0x3c')]=_['keys'](_0x4ade12['query']);_0xe79712['filters']=_[_0xae18('0x3e')](_0xe79712[_0xae18('0x3f')],_0xe79712['query']);_0x41a696[_0xae18('0x40')]=_['intersection'](_0xe79712[_0xae18('0x3f')],qs[_0xae18('0x41')](_0x4ade12['query'][_0xae18('0x41')]));_0x41a696[_0xae18('0x40')]=_0x41a696[_0xae18('0x40')][_0xae18('0x42')]?_0x41a696[_0xae18('0x40')]:_0xe79712[_0xae18('0x3f')];if(_0x4ade12['query'][_0xae18('0x4e')]){_0x41a696[_0xae18('0x53')]=[{'all':!![]}];}_0x41a696=_[_0xae18('0x4a')]({},_0x41a696,_0x4ade12[_0xae18('0x4d')]);return db[_0xae18('0x39')][_0xae18('0x54')](_0x41a696)['then'](handleEntityNotFound(_0x2aad4b,null))[_0xae18('0x32')](respondWithResult(_0x2aad4b,null))[_0xae18('0x26')](handleError(_0x2aad4b,null));};exports[_0xae18('0x55')]=function(_0x1ea827,_0x2c2c72,_0x29aff2){var _0x4b92d9;return db[_0xae18('0x56')]['transaction'](function(_0x2c3af2){return db[_0xae18('0x39')][_0xae18('0x55')](_0x1ea827['body'],{'raw':!![]})[_0xae18('0x32')](function(_0x5cef6c){_0x4b92d9=_0x5cef6c;return db['Network'][_0xae18('0x4f')]({'where':{'type':_0x1ea827[_0xae18('0x57')][_0xae18('0x4b')]},'raw':!![]});})['then'](function(_0x3c2b2e){if(_0x4b92d9[_0xae18('0x4b')][_0xae18('0x58')]()=='STUN'){var _0x34305a=fs[_0xae18('0x59')](path[_0xae18('0x5a')](config[_0xae18('0x5b')],_0xae18('0x5c')),_0xae18('0x5d'));var _0x2f75fe=ejs[_0xae18('0x5e')](_0x34305a,{'networks':_0x3c2b2e||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x2f75fe);return respondWithRpcPromise('Reload','create',{'module':'res_stun_monitor.so'});}else if(_0x4b92d9[_0xae18('0x4b')]['toUpperCase']()==_0xae18('0x5f')){var _0x104471=fs['readFileSync'](path[_0xae18('0x5a')](config[_0xae18('0x5b')],_0xae18('0x60')),_0xae18('0x5d'));var _0x3c43d5=ejs[_0xae18('0x5e')](_0x104471,{'networks':_0x3c2b2e||[]});fs[_0xae18('0x61')](_0xae18('0x62'),_0x3c43d5);return respondWithRpcPromise(_0xae18('0x63'),_0xae18('0x55'),{'module':_0xae18('0x64')});}else{var _0x17b06f=fs[_0xae18('0x59')](path[_0xae18('0x5a')](config[_0xae18('0x5b')],_0xae18('0x65')),_0xae18('0x5d'));var _0x34c62c=ejs['render'](_0x17b06f,{'networks':_0x3c2b2e||[]});fs[_0xae18('0x61')](util['format'](_0xae18('0x66'),_0x1ea827[_0xae18('0x57')][_0xae18('0x4b')][_0xae18('0x67')]()),_0x34c62c);return respondWithRpcPromise(_0xae18('0x63'),'create',{'module':'chan_sip.so'});}return null;})[_0xae18('0x32')](function(){return _0x4b92d9;});})[_0xae18('0x32')](respondWithResult(_0x2c2c72,0xc9))['catch'](handleError(_0x2c2c72,null));};exports['update']=function(_0x4f7c42,_0x285fdc,_0x33ecbb){var _0x10c135;return db[_0xae18('0x56')][_0xae18('0x68')](function(_0x2fc8f4){return db[_0xae18('0x39')][_0xae18('0x54')]({'where':{'id':_0x4f7c42[_0xae18('0x52')]['id']}})[_0xae18('0x32')](handleEntityNotFound(_0x285fdc,null))['then'](saveUpdates(_0x4f7c42[_0xae18('0x57')],null))[_0xae18('0x32')](function(_0x1afe4c){if(_0x1afe4c){_0x10c135=_0x1afe4c;return db[_0xae18('0x39')][_0xae18('0x4f')]({'where':{'type':_0x10c135[_0xae18('0x4b')]},'raw':!![]});}return null;})[_0xae18('0x32')](function(_0x138736){if(_0x10c135[_0xae18('0x4b')][_0xae18('0x58')]()=='STUN'){var _0x412046=fs[_0xae18('0x59')](path[_0xae18('0x5a')](config[_0xae18('0x5b')],_0xae18('0x5c')),'utf8');var _0x4e9552=ejs[_0xae18('0x5e')](_0x412046,{'networks':_0x138736||[]});fs[_0xae18('0x61')](_0xae18('0x69'),_0x4e9552);return respondWithRpcPromise(_0xae18('0x63'),_0xae18('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x10c135['type']['toUpperCase']()==_0xae18('0x5f')){var _0x1fd0a4=fs[_0xae18('0x59')](path['join'](config[_0xae18('0x5b')],'server/files/templates/turn_multiple.ejs'),_0xae18('0x5d'));var _0xfee318=ejs['render'](_0x1fd0a4,{'networks':_0x138736||[]});fs['writeFileSync'](_0xae18('0x62'),_0xfee318);return respondWithRpcPromise(_0xae18('0x63'),'update',{'module':_0xae18('0x64')});}else{var _0x31e96=fs[_0xae18('0x59')](path[_0xae18('0x5a')](config['root'],_0xae18('0x65')),_0xae18('0x5d'));var _0x4f081d=ejs[_0xae18('0x5e')](_0x31e96,{'networks':_0x138736||[]});fs[_0xae18('0x61')](util[_0xae18('0x6a')]('/etc/asterisk/sip_xcally_%s.conf',_0x4f7c42[_0xae18('0x57')]['type']['toLowerCase']()),_0x4f081d);return respondWithRpcPromise(_0xae18('0x63'),_0xae18('0x30'),{'module':_0xae18('0x6b')});}return null;})['then'](function(_0x5465ce){if(_0x5465ce){return _0x10c135;}return null;});})[_0xae18('0x32')](respondWithResult(_0x285fdc,null))[_0xae18('0x26')](handleError(_0x285fdc,null));};exports[_0xae18('0x31')]=function(_0x1e346d,_0x5afa7,_0x165216){var _0x2b51af;return db[_0xae18('0x39')]['find']({'where':{'id':_0x1e346d[_0xae18('0x52')]['id']}})[_0xae18('0x32')](function(_0xb1736b){_0x2b51af=_0xb1736b;return _0xb1736b;})[_0xae18('0x32')](handleEntityNotFound(_0x5afa7,null))['then'](removeEntity(_0x5afa7,null))[_0xae18('0x32')](function(){if(_0x2b51af){return db[_0xae18('0x39')]['findAll']({'where':{'type':_0x2b51af[_0xae18('0x4b')]},'raw':!![]});}})[_0xae18('0x32')](function(_0x37256b){if(_0x2b51af[_0xae18('0x4b')][_0xae18('0x58')]()==_0xae18('0x6c')){var _0xb24b68=fs[_0xae18('0x59')](path[_0xae18('0x5a')](config['root'],_0xae18('0x5c')),_0xae18('0x5d'));var _0x13e524=ejs[_0xae18('0x5e')](_0xb24b68,{'networks':_0x37256b||[]});fs[_0xae18('0x61')]('/etc/asterisk/stun_xcally.conf',_0x13e524);return respondWithRpcPromise('Reload',_0xae18('0x31'),{'module':'res_stun_monitor.so'});}else if(_0x2b51af[_0xae18('0x4b')]['toUpperCase']()==_0xae18('0x5f')){var _0x28f4a9=fs[_0xae18('0x59')](path[_0xae18('0x5a')](config[_0xae18('0x5b')],_0xae18('0x60')),_0xae18('0x5d'));var _0x1e5cd2=ejs[_0xae18('0x5e')](_0x28f4a9,{'networks':_0x37256b||[]});fs[_0xae18('0x61')](_0xae18('0x62'),_0x1e5cd2);return respondWithRpcPromise(_0xae18('0x63'),_0xae18('0x31'),{'module':_0xae18('0x64')});}else{var _0x1cffe7=fs[_0xae18('0x59')](path[_0xae18('0x5a')](config['root'],_0xae18('0x65')),_0xae18('0x5d'));var _0x4226f3=ejs[_0xae18('0x5e')](_0x1cffe7,{'networks':_0x37256b||[]});fs[_0xae18('0x61')](util[_0xae18('0x6a')](_0xae18('0x66'),_0x1e346d[_0xae18('0x57')][_0xae18('0x4b')][_0xae18('0x67')]()),_0x4226f3);return respondWithRpcPromise('Reload',_0xae18('0x31'),{'module':_0xae18('0x6b')});}return null;})[_0xae18('0x26')](handleError(_0x5afa7,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 05c4cd0..34a99c2 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 _0xf10d=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf10d,0x125));var _0xdf10=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0xf10d[_0x533e4e];return _0x1f14bb;};'use strict';var _=require(_0xdf10('0x0'));var util=require(_0xdf10('0x1'));var logger=require(_0xdf10('0x2'))(_0xdf10('0x3'));var moment=require(_0xdf10('0x4'));var BPromise=require(_0xdf10('0x5'));var rp=require(_0xdf10('0x6'));var fs=require('fs');var path=require(_0xdf10('0x7'));var rimraf=require(_0xdf10('0x8'));var config=require(_0xdf10('0x9'));var attributes=require(_0xdf10('0xa'));module[_0xdf10('0xb')]=function(_0x413325,_0x6923f8){return _0x413325[_0xdf10('0xc')](_0xdf10('0xd'),attributes,{'tableName':_0xdf10('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10d3=['path','rimraf','../../config/environment','exports','define','Network','network','lodash','../../config/logger','request-promise'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x10d3,0x1ab));var _0x310d=function(_0x25c4ae,_0x5eeac5){_0x25c4ae=_0x25c4ae-0x0;var _0x27de71=_0x10d3[_0x25c4ae];return _0x27de71;};'use strict';var _=require(_0x310d('0x0'));var util=require('util');var logger=require(_0x310d('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x310d('0x2'));var fs=require('fs');var path=require(_0x310d('0x3'));var rimraf=require(_0x310d('0x4'));var config=require(_0x310d('0x5'));var attributes=require('./network.attributes');module[_0x310d('0x6')]=function(_0x49cc20,_0x10f4f6){return _0x49cc20[_0x310d('0x7')](_0x310d('0x8'),attributes,{'tableName':_0x310d('0x9'),'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 d7fe96d..8ab771e 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 _0x2dd7=['error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x50f6e5,_0x151ccb){var _0x5988c5=function(_0x490a93){while(--_0x490a93){_0x50f6e5['push'](_0x50f6e5['shift']());}};_0x5988c5(++_0x151ccb);}(_0x2dd7,0xad));var _0x72dd=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x2dd7[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0x72dd('0x0'));var util=require(_0x72dd('0x1'));var moment=require(_0x72dd('0x2'));var BPromise=require(_0x72dd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72dd('0x4'));var db=require(_0x72dd('0x5'))['db'];var utils=require(_0x72dd('0x6'));var logger=require(_0x72dd('0x7'))(_0x72dd('0x8'));var config=require('../../config/environment');var jayson=require(_0x72dd('0x9'));var client=jayson[_0x72dd('0xa')][_0x72dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e209c,_0x541bb0,_0x4ed1c2){return new BPromise(function(_0x43b195,_0x324b38){return client[_0x72dd('0xc')](_0x1e209c,_0x4ed1c2)['then'](function(_0x111599){logger['info'](_0x72dd('0xd'),_0x541bb0,_0x72dd('0xe'));logger[_0x72dd('0xf')]('Network,\x20%s,\x20%s,\x20%s',_0x541bb0,_0x72dd('0xe'),JSON['stringify'](_0x111599));if(_0x111599[_0x72dd('0x10')]){if(_0x111599[_0x72dd('0x10')][_0x72dd('0x11')]===0x1f4){logger[_0x72dd('0x10')]('Network,\x20%s,\x20%s',_0x541bb0,_0x111599[_0x72dd('0x10')][_0x72dd('0x12')]);return _0x324b38(_0x111599[_0x72dd('0x10')][_0x72dd('0x12')]);}logger['error'](_0x72dd('0xd'),_0x541bb0,_0x111599[_0x72dd('0x10')]['message']);return _0x43b195(_0x111599[_0x72dd('0x10')][_0x72dd('0x12')]);}else{logger[_0x72dd('0x13')](_0x72dd('0xd'),_0x541bb0,_0x72dd('0xe'));_0x43b195(_0x111599[_0x72dd('0x14')][_0x72dd('0x12')]);}})['catch'](function(_0x3ec374){logger[_0x72dd('0x10')](_0x72dd('0xd'),_0x541bb0,_0x3ec374);_0x324b38(_0x3ec374);});});} \ No newline at end of file +var _0x0d9e=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error'];(function(_0x87d340,_0x2a3e68){var _0x2588cc=function(_0xf1c1fc){while(--_0xf1c1fc){_0x87d340['push'](_0x87d340['shift']());}};_0x2588cc(++_0x2a3e68);}(_0x0d9e,0x136));var _0xe0d9=function(_0x4c3882,_0x20b470){_0x4c3882=_0x4c3882-0x0;var _0x5caee8=_0x0d9e[_0x4c3882];return _0x5caee8;};'use strict';var _=require(_0xe0d9('0x0'));var util=require(_0xe0d9('0x1'));var moment=require(_0xe0d9('0x2'));var BPromise=require(_0xe0d9('0x3'));var rs=require(_0xe0d9('0x4'));var fs=require('fs');var Redis=require(_0xe0d9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe0d9('0x6'));var logger=require(_0xe0d9('0x7'))(_0xe0d9('0x8'));var config=require(_0xe0d9('0x9'));var jayson=require(_0xe0d9('0xa'));var client=jayson['client'][_0xe0d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58af0,_0x2bc02d,_0x5fed32){return new BPromise(function(_0x56cbe0,_0xb5566){return client[_0xe0d9('0xc')](_0x58af0,_0x5fed32)[_0xe0d9('0xd')](function(_0x1d7814){logger[_0xe0d9('0xe')](_0xe0d9('0xf'),_0x2bc02d,_0xe0d9('0x10'));logger[_0xe0d9('0x11')](_0xe0d9('0x12'),_0x2bc02d,_0xe0d9('0x10'),JSON['stringify'](_0x1d7814));if(_0x1d7814['error']){if(_0x1d7814[_0xe0d9('0x13')]['code']===0x1f4){logger[_0xe0d9('0x13')]('Network,\x20%s,\x20%s',_0x2bc02d,_0x1d7814['error'][_0xe0d9('0x14')]);return _0xb5566(_0x1d7814['error'][_0xe0d9('0x14')]);}logger['error'](_0xe0d9('0xf'),_0x2bc02d,_0x1d7814[_0xe0d9('0x13')]['message']);return _0x56cbe0(_0x1d7814[_0xe0d9('0x13')][_0xe0d9('0x14')]);}else{logger['info'](_0xe0d9('0xf'),_0x2bc02d,'request\x20sent');_0x56cbe0(_0x1d7814['result']['message']);}})[_0xe0d9('0x15')](function(_0x120553){logger[_0xe0d9('0x13')]('Network,\x20%s,\x20%s',_0x2bc02d,_0x120553);_0xb5566(_0x120553);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 3795373..f905a59 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 _0x826a=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./notification.controller','sendNotification','exports','multer','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x826a,0x154));var _0xa826=function(_0x3e6465,_0x206f76){_0x3e6465=_0x3e6465-0x0;var _0x202c47=_0x826a[_0x3e6465];return _0x202c47;};'use strict';var multer=require(_0xa826('0x0'));var util=require('util');var path=require(_0xa826('0x1'));var timeout=require(_0xa826('0x2'));var express=require('express');var router=express[_0xa826('0x3')]();var auth=require(_0xa826('0x4'));var interaction=require(_0xa826('0x5'));var config=require('../../config/environment');var controller=require(_0xa826('0x6'));router['post']('/',auth['isAuthenticated'](),controller[_0xa826('0x7')]);module[_0xa826('0x8')]=router; \ No newline at end of file +var _0xb17d=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','exports','multer','util','path','connect-timeout'];(function(_0x125816,_0x4db4f6){var _0x45ff99=function(_0x247e9b){while(--_0x247e9b){_0x125816['push'](_0x125816['shift']());}};_0x45ff99(++_0x4db4f6);}(_0xb17d,0x130));var _0xdb17=function(_0x3cccce,_0x2af268){_0x3cccce=_0x3cccce-0x0;var _0x1bd1fd=_0xb17d[_0x3cccce];return _0x1bd1fd;};'use strict';var multer=require(_0xdb17('0x0'));var util=require(_0xdb17('0x1'));var path=require(_0xdb17('0x2'));var timeout=require(_0xdb17('0x3'));var express=require(_0xdb17('0x4'));var router=express[_0xdb17('0x5')]();var auth=require(_0xdb17('0x6'));var interaction=require(_0xdb17('0x7'));var config=require(_0xdb17('0x8'));var controller=require(_0xdb17('0x9'));router[_0xdb17('0xa')]('/',auth[_0xdb17('0xb')](),controller[_0xdb17('0xc')]);module[_0xdb17('0xd')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 685a740..b0d27b3 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 _0x247f=['sequelize','exports','TEXT','STRING'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0x247f,0x1ec));var _0xf247=function(_0x4b953a,_0xfa4b35){_0x4b953a=_0x4b953a-0x0;var _0x523513=_0x247f[_0x4b953a];return _0x523513;};'use strict';var Sequelize=require(_0xf247('0x0'));module[_0xf247('0x1')]={'body':{'type':Sequelize[_0xf247('0x2')]},'senderName':{'type':Sequelize[_0xf247('0x3')]},'recipientsId':{'type':Sequelize[_0xf247('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xb2f9=['TEXT','STRING','sequelize'];(function(_0x160c36,_0x5f1dd3){var _0x11cc8f=function(_0x48ed44){while(--_0x48ed44){_0x160c36['push'](_0x160c36['shift']());}};_0x11cc8f(++_0x5f1dd3);}(_0xb2f9,0xf5));var _0x9b2f=function(_0x49544a,_0x55620b){_0x49544a=_0x49544a-0x0;var _0x30c3ed=_0xb2f9[_0x49544a];return _0x30c3ed;};'use strict';var Sequelize=require(_0x9b2f('0x0'));module['exports']={'body':{'type':Sequelize[_0x9b2f('0x1')]},'senderName':{'type':Sequelize[_0x9b2f('0x2')]},'recipientsId':{'type':Sequelize[_0x9b2f('0x1')]},'recipientsDescription':{'type':Sequelize[_0x9b2f('0x2')]},'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 d9eae6e..a918ba3 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 _0x8ee4=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','sendStatus','status','json','offset','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','voicequeue','whatsappqueue','team','user','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','transaction','Notification','create','forEach','recipient','emit','notification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','catch','union','ids','queue','replace','push','all','flatten','getAgents','map','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel'];(function(_0x4bea66,_0x1b18e5){var _0x54abf7=function(_0x3cdb99){while(--_0x3cdb99){_0x4bea66['push'](_0x4bea66['shift']());}};_0x54abf7(++_0x1b18e5);}(_0x8ee4,0x115));var _0x48ee=function(_0x30f154,_0x2fac7c){_0x30f154=_0x30f154-0x0;var _0x27e67b=_0x8ee4[_0x30f154];return _0x27e67b;};'use strict';var pdf=require(_0x48ee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x48ee('0x1'));var zipdir=require(_0x48ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x48ee('0x3'));var moment=require('moment');var BPromise=require(_0x48ee('0x4'));var Mustache=require(_0x48ee('0x5'));var util=require(_0x48ee('0x6'));var path=require('path');var sox=require(_0x48ee('0x7'));var csv=require(_0x48ee('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x48ee('0x9'));var squel=require(_0x48ee('0xa'));var crypto=require(_0x48ee('0xb'));var jsforce=require(_0x48ee('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x48ee('0x8'));var querystring=require(_0x48ee('0xd'));var Papa=require(_0x48ee('0xe'));var Redis=require(_0x48ee('0xf'));var authService=require(_0x48ee('0x10'));var qs=require(_0x48ee('0x11'));var as=require(_0x48ee('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x48ee('0x13'))(_0x48ee('0x14'));var utils=require(_0x48ee('0x15'));var config=require(_0x48ee('0x16'));var licenseUtil=require(_0x48ee('0x17'));var db=require(_0x48ee('0x18'))['db'];config[_0x48ee('0x19')]=_[_0x48ee('0x1a')](config[_0x48ee('0x19')],{'host':_0x48ee('0x1b'),'port':0x18eb});var socket=require(_0x48ee('0x1c'))(new Redis(config[_0x48ee('0x19')]));require(_0x48ee('0x1d'))[_0x48ee('0x1e')](socket);function respondWithStatusCode(_0x27a6a2,_0x17e6dc){_0x17e6dc=_0x17e6dc||0xcc;return function(_0x281593){if(_0x281593){return _0x27a6a2[_0x48ee('0x1f')](_0x17e6dc);}return _0x27a6a2[_0x48ee('0x20')](_0x17e6dc)['end']();};}function respondWithResult(_0x5f288a,_0x38d51a){_0x38d51a=_0x38d51a||0xc8;return function(_0xfd75f5){if(_0xfd75f5){return _0x5f288a[_0x48ee('0x20')](_0x38d51a)[_0x48ee('0x21')](_0xfd75f5);}};}function respondWithFilteredResult(_0x4191f3,_0x590303){return function(_0x2060b3){if(_0x2060b3){var _0x24d542=_0x2060b3['count'],_0x5be550=_0x590303[_0x48ee('0x22')],_0x5da5a9=_0x590303[_0x48ee('0x22')]+_0x590303['limit'],_0x10e9a5;if(_0x5da5a9>=_0x24d542){_0x5da5a9=_0x24d542;_0x10e9a5=0xc8;}else{_0x10e9a5=0xce;}_0x4191f3[_0x48ee('0x20')](_0x10e9a5);return _0x4191f3['set'](_0x48ee('0x23'),_0x5be550+'-'+_0x5da5a9+'/'+_0x24d542)[_0x48ee('0x21')](_0x2060b3);}return null;};}function patchUpdates(_0xacb2da){return function(_0x17a17c){try{jsonpatch[_0x48ee('0x24')](_0x17a17c,_0xacb2da,!![]);}catch(_0x3eec09){return BPromise[_0x48ee('0x25')](_0x3eec09);}return _0x17a17c['save']();};}function saveUpdates(_0x536536,_0x2fa22e){return function(_0x44db4a){if(_0x44db4a){return _0x44db4a[_0x48ee('0x26')](_0x536536)['then'](function(_0x191854){return _0x191854;});}return null;};}function removeEntity(_0xdde82f,_0x3cf1fd){return function(_0x659d42){if(_0x659d42){return _0x659d42[_0x48ee('0x27')]()[_0x48ee('0x28')](function(){_0xdde82f[_0x48ee('0x20')](0xcc)[_0x48ee('0x29')]();});}};}function handleEntityNotFound(_0x127bba,_0x363aed){return function(_0x3d3a5b){if(!_0x3d3a5b){_0x127bba[_0x48ee('0x1f')](0x194);}return _0x3d3a5b;};}function handleError(_0x555e31,_0x28ea16){_0x28ea16=_0x28ea16||0x1f4;return function(_0x4488b2){logger[_0x48ee('0x2a')](_0x4488b2[_0x48ee('0x2b')]);if(_0x4488b2['name']){delete _0x4488b2[_0x48ee('0x2c')];}_0x555e31[_0x48ee('0x20')](_0x28ea16)[_0x48ee('0x2d')](_0x4488b2);};}exports['sendNotification']=function(_0x1ee82d,_0x31d69f,_0x42e672){if(!_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x2f')](_0x48ee('0x30'))&&!_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x2f')](_0x48ee('0x31'))){throw new db[(_0x48ee('0x32'))][(_0x48ee('0x33'))](_0x48ee('0x34'));}else{if(_0x1ee82d['body'][_0x48ee('0x2f')](_0x48ee('0x31'))&&!_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x2f')](_0x48ee('0x35'))){throw new db[(_0x48ee('0x32'))][(_0x48ee('0x33'))](_0x48ee('0x36'));}if(!_0x1ee82d['body'][_0x48ee('0x2f')]('recipients')){throw new db['Sequelize'][(_0x48ee('0x33'))](_0x48ee('0x37'));}else{try{var _0x59356f=JSON[_0x48ee('0x38')](_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x39')]);}catch(_0x31d8ea){logger[_0x48ee('0x2a')](_0x31d8ea);throw new db[(_0x48ee('0x32'))][(_0x48ee('0x33'))](_0x48ee('0x3a'));}var _0x27b37b=['chatqueue',_0x48ee('0x3b'),_0x48ee('0x3c'),'openchannelqueue','smsqueue',_0x48ee('0x3d'),_0x48ee('0x3e'),_0x48ee('0x3f'),_0x48ee('0x40')];if(_['some'](_0x59356f,function(_0x1d6609){return!_['includes'](_0x27b37b,_0x1d6609['model']['toLowerCase']());})){throw new db[(_0x48ee('0x32'))][(_0x48ee('0x33'))](_0x48ee('0x41'));}}}var _0x5a343a={};_0x5a343a[_0x48ee('0x42')]=_0x1ee82d[_0x48ee('0x2e')]['hasOwnProperty']('senderName')?_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x42')]:_0x1ee82d['user'][_0x48ee('0x43')];_0x5a343a[_0x48ee('0x44')]=_[_0x48ee('0x45')](_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x44')])?null:_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x44')];_0x5a343a['beep']=_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x46')]||![];_0x5a343a[_0x48ee('0x47')]=_0x1ee82d[_0x48ee('0x40')]['id'];return getContent(_0x1ee82d[_0x48ee('0x2e')])[_0x48ee('0x28')](function(_0x25acd7){_0x5a343a[_0x48ee('0x2e')]=_0x25acd7;return getRecipients(_0x59356f);})['then'](function(_0x45d1b1){_0x5a343a[_0x48ee('0x48')]=_[_0x48ee('0x49')](_0x45d1b1)[_0x48ee('0x4a')](',');return db['sequelize'][_0x48ee('0x4b')](function(_0x2e94ca){return db[_0x48ee('0x4c')][_0x48ee('0x4d')](_0x5a343a,{'raw':!![],'transaction':_0x2e94ca})[_0x48ee('0x28')](function(_0x1ef8a3){var _0x70760f={'sender':_0x5a343a[_0x48ee('0x42')],'description':_0x5a343a[_0x48ee('0x44')],'content':_0x5a343a['body'],'beep':_0x5a343a[_0x48ee('0x46')]};_0x45d1b1[_0x48ee('0x4e')](function(_0x465c0c){_0x70760f[_0x48ee('0x4f')]=_0x465c0c;socket[_0x48ee('0x50')](_0x48ee('0x51'),_0x70760f);});return _0x1ef8a3;});});})[_0x48ee('0x28')](respondWithResult(_0x31d69f,0xc9))['catch'](handleError(_0x31d69f,null));};function getContent(_0x167f04){return new BPromise(function(_0x4a18a1,_0xa15caa){if(_0x167f04[_0x48ee('0x30')]){_0x4a18a1(_0x167f04[_0x48ee('0x30')]);return;}return db[_0x48ee('0x52')][_0x48ee('0x53')]({'attributes':[_0x48ee('0x54')],'where':{'id':_0x167f04['TemplateId']},'raw':!![]})[_0x48ee('0x28')](function(_0x17e90c){if(!_0x17e90c)throw new db['Sequelize'][(_0x48ee('0x33'))](_0x48ee('0x55'));var _0x156b51=Mustache['render'](_0x17e90c[_0x48ee('0x54')],_0x167f04[_0x48ee('0x35')]);_0x4a18a1(_0x156b51);})[_0x48ee('0x56')](function(_0xc517fa){_0xa15caa(_0xc517fa);});});}function getRecipients(_0x336dd5){return new BPromise(function(_0x1772d0,_0x228b3e){var _0x20064d=[];var _0x10ce16=[];_0x336dd5[_0x48ee('0x4e')](function(_0x304f99){var _0x47d3e6=_['startCase'](_0x304f99['model']['toLowerCase']());if(_0x47d3e6==='User'){_0x20064d=_[_0x48ee('0x57')](_0x20064d,_0x304f99[_0x48ee('0x58')]);}else{if(_['includes'](_0x47d3e6,_0x48ee('0x59')))_0x47d3e6=_0x47d3e6[_0x48ee('0x5a')](_0x48ee('0x59'),'Queue');_0x304f99[_0x48ee('0x58')][_0x48ee('0x4e')](function(_0x4a7514){_0x10ce16[_0x48ee('0x5b')](getAgents(_0x47d3e6,_0x4a7514));});}});return BPromise[_0x48ee('0x5c')](_0x10ce16)['then'](function(_0x1fd09b){_0x20064d=_[_0x48ee('0x57')](_0x20064d,_[_0x48ee('0x5d')](_0x1fd09b));_0x1772d0(_0x20064d);})[_0x48ee('0x56')](function(_0x3bbaef){_0x228b3e(_0x3bbaef);});});}function getAgents(_0x22d7e4,_0x502a89){return new BPromise(function(_0x434b88,_0x33eb8c){return db[_0x22d7e4][_0x48ee('0x53')]({'where':{'id':_0x502a89}})['then'](function(_0xdd08d3){return _0xdd08d3[_0x48ee('0x5e')]({'attributes':['id'],'raw':!![]})[_0x48ee('0x28')](function(_0x51de36){var _0x25411d=_[_0x48ee('0x5f')](_0x51de36,'id');_0x434b88(_0x25411d);});})['catch'](function(_0x7da877){_0x33eb8c(_0x7da877);});});} \ No newline at end of file +var _0xdd00=['Queue','push','flatten','getAgents','map','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./notification.socket','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','then','recipientsId','sortBy','join','sequelize','transaction','Notification','create','forEach','text','Template','findOne','TemplateId','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','User','union','queue','replace'];(function(_0x3c573d,_0x346854){var _0x5c3cc3=function(_0x317388){while(--_0x317388){_0x3c573d['push'](_0x3c573d['shift']());}};_0x5c3cc3(++_0x346854);}(_0xdd00,0xc5));var _0x0dd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd00[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x0dd0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0dd0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0dd0('0x2'));var moment=require(_0x0dd0('0x3'));var BPromise=require(_0x0dd0('0x4'));var Mustache=require(_0x0dd0('0x5'));var util=require(_0x0dd0('0x6'));var path=require(_0x0dd0('0x7'));var sox=require(_0x0dd0('0x8'));var csv=require(_0x0dd0('0x9'));var ejs=require(_0x0dd0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0dd0('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0dd0('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0dd0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0dd0('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0dd0('0xf'));var logger=require(_0x0dd0('0x10'))('api');var utils=require(_0x0dd0('0x11'));var config=require(_0x0dd0('0x12'));var licenseUtil=require(_0x0dd0('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0dd0('0x14')](config[_0x0dd0('0x15')],{'host':_0x0dd0('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0dd0('0x15')]));require(_0x0dd0('0x17'))['register'](socket);function respondWithStatusCode(_0x5cf0c1,_0x4fb561){_0x4fb561=_0x4fb561||0xcc;return function(_0x2e50f6){if(_0x2e50f6){return _0x5cf0c1[_0x0dd0('0x18')](_0x4fb561);}return _0x5cf0c1[_0x0dd0('0x19')](_0x4fb561)[_0x0dd0('0x1a')]();};}function respondWithResult(_0x5a04b4,_0x341cdc){_0x341cdc=_0x341cdc||0xc8;return function(_0x29057e){if(_0x29057e){return _0x5a04b4[_0x0dd0('0x19')](_0x341cdc)[_0x0dd0('0x1b')](_0x29057e);}};}function respondWithFilteredResult(_0x2a30bb,_0x221dbc){return function(_0x5e58c7){if(_0x5e58c7){var _0x1bb96c=_0x5e58c7[_0x0dd0('0x1c')],_0x2d1cd0=_0x221dbc['offset'],_0x1913b0=_0x221dbc[_0x0dd0('0x1d')]+_0x221dbc[_0x0dd0('0x1e')],_0x1f6076;if(_0x1913b0>=_0x1bb96c){_0x1913b0=_0x1bb96c;_0x1f6076=0xc8;}else{_0x1f6076=0xce;}_0x2a30bb['status'](_0x1f6076);return _0x2a30bb['set'](_0x0dd0('0x1f'),_0x2d1cd0+'-'+_0x1913b0+'/'+_0x1bb96c)['json'](_0x5e58c7);}return null;};}function patchUpdates(_0x19cdca){return function(_0x4ec3d7){try{jsonpatch[_0x0dd0('0x20')](_0x4ec3d7,_0x19cdca,!![]);}catch(_0x6a0693){return BPromise[_0x0dd0('0x21')](_0x6a0693);}return _0x4ec3d7[_0x0dd0('0x22')]();};}function saveUpdates(_0x9186a0,_0x5d1f00){return function(_0x574066){if(_0x574066){return _0x574066[_0x0dd0('0x23')](_0x9186a0)['then'](function(_0x4f6a16){return _0x4f6a16;});}return null;};}function removeEntity(_0xecca65,_0x2b4859){return function(_0x219cd5){if(_0x219cd5){return _0x219cd5[_0x0dd0('0x24')]()['then'](function(){_0xecca65[_0x0dd0('0x19')](0xcc)[_0x0dd0('0x1a')]();});}};}function handleEntityNotFound(_0xb0b82e,_0x1606f3){return function(_0x5a8c96){if(!_0x5a8c96){_0xb0b82e[_0x0dd0('0x18')](0x194);}return _0x5a8c96;};}function handleError(_0x4a3925,_0x3b22ec){_0x3b22ec=_0x3b22ec||0x1f4;return function(_0x191dbc){logger[_0x0dd0('0x25')](_0x191dbc[_0x0dd0('0x26')]);if(_0x191dbc['name']){delete _0x191dbc[_0x0dd0('0x27')];}_0x4a3925[_0x0dd0('0x19')](_0x3b22ec)[_0x0dd0('0x28')](_0x191dbc);};}exports['sendNotification']=function(_0x4a9dfb,_0x46a4ac,_0x182fa5){if(!_0x4a9dfb[_0x0dd0('0x29')]['hasOwnProperty']('text')&&!_0x4a9dfb[_0x0dd0('0x29')][_0x0dd0('0x2a')]('TemplateId')){throw new db[(_0x0dd0('0x2b'))][(_0x0dd0('0x2c'))](_0x0dd0('0x2d'));}else{if(_0x4a9dfb['body']['hasOwnProperty']('TemplateId')&&!_0x4a9dfb[_0x0dd0('0x29')][_0x0dd0('0x2a')](_0x0dd0('0x2e'))){throw new db[(_0x0dd0('0x2b'))][(_0x0dd0('0x2c'))](_0x0dd0('0x2f'));}if(!_0x4a9dfb[_0x0dd0('0x29')]['hasOwnProperty'](_0x0dd0('0x30'))){throw new db[(_0x0dd0('0x2b'))][(_0x0dd0('0x2c'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x4c6222=JSON[_0x0dd0('0x31')](_0x4a9dfb['body'][_0x0dd0('0x30')]);}catch(_0x46c15a){logger[_0x0dd0('0x25')](_0x46c15a);throw new db[(_0x0dd0('0x2b'))]['ValidationError'](_0x0dd0('0x32'));}var _0x1fffc7=[_0x0dd0('0x33'),_0x0dd0('0x34'),'mailqueue',_0x0dd0('0x35'),_0x0dd0('0x36'),_0x0dd0('0x37'),_0x0dd0('0x38'),_0x0dd0('0x39'),'user'];if(_[_0x0dd0('0x3a')](_0x4c6222,function(_0x4e1380){return!_[_0x0dd0('0x3b')](_0x1fffc7,_0x4e1380[_0x0dd0('0x3c')][_0x0dd0('0x3d')]());})){throw new db[(_0x0dd0('0x2b'))]['ValidationError'](_0x0dd0('0x3e'));}}}var _0x2824a2={};_0x2824a2['senderName']=_0x4a9dfb[_0x0dd0('0x29')][_0x0dd0('0x2a')]('senderName')?_0x4a9dfb[_0x0dd0('0x29')][_0x0dd0('0x3f')]:_0x4a9dfb[_0x0dd0('0x40')][_0x0dd0('0x41')];_0x2824a2[_0x0dd0('0x42')]=_[_0x0dd0('0x43')](_0x4a9dfb[_0x0dd0('0x29')][_0x0dd0('0x42')])?null:_0x4a9dfb[_0x0dd0('0x29')][_0x0dd0('0x42')];_0x2824a2[_0x0dd0('0x44')]=_0x4a9dfb[_0x0dd0('0x29')][_0x0dd0('0x44')]||![];_0x2824a2[_0x0dd0('0x45')]=_0x4a9dfb[_0x0dd0('0x40')]['id'];return getContent(_0x4a9dfb[_0x0dd0('0x29')])[_0x0dd0('0x46')](function(_0x3b8c83){_0x2824a2[_0x0dd0('0x29')]=_0x3b8c83;return getRecipients(_0x4c6222);})[_0x0dd0('0x46')](function(_0x2a92d1){_0x2824a2[_0x0dd0('0x47')]=_[_0x0dd0('0x48')](_0x2a92d1)[_0x0dd0('0x49')](',');return db[_0x0dd0('0x4a')][_0x0dd0('0x4b')](function(_0x2eccd1){return db[_0x0dd0('0x4c')][_0x0dd0('0x4d')](_0x2824a2,{'raw':!![],'transaction':_0x2eccd1})[_0x0dd0('0x46')](function(_0x40bec3){var _0x3d0d1b={'sender':_0x2824a2[_0x0dd0('0x3f')],'description':_0x2824a2[_0x0dd0('0x42')],'content':_0x2824a2[_0x0dd0('0x29')],'beep':_0x2824a2['beep']};_0x2a92d1[_0x0dd0('0x4e')](function(_0x4aa589){_0x3d0d1b['recipient']=_0x4aa589;socket['emit']('notification:send',_0x3d0d1b);});return _0x40bec3;});});})[_0x0dd0('0x46')](respondWithResult(_0x46a4ac,0xc9))['catch'](handleError(_0x46a4ac,null));};function getContent(_0x3a80dd){return new BPromise(function(_0x4144b6,_0x484a5f){if(_0x3a80dd[_0x0dd0('0x4f')]){_0x4144b6(_0x3a80dd[_0x0dd0('0x4f')]);return;}return db[_0x0dd0('0x50')][_0x0dd0('0x51')]({'attributes':['html'],'where':{'id':_0x3a80dd[_0x0dd0('0x52')]},'raw':!![]})['then'](function(_0x4a58c0){if(!_0x4a58c0)throw new db[(_0x0dd0('0x2b'))][(_0x0dd0('0x2c'))](_0x0dd0('0x53'));var _0x373841=Mustache[_0x0dd0('0x54')](_0x4a58c0['html'],_0x3a80dd['view']);_0x4144b6(_0x373841);})[_0x0dd0('0x55')](function(_0x574ad8){_0x484a5f(_0x574ad8);});});}function getRecipients(_0x1f1ce6){return new BPromise(function(_0x2886fd,_0xb0325){var _0x18c23d=[];var _0x214c40=[];_0x1f1ce6[_0x0dd0('0x4e')](function(_0x167409){var _0xc7c2b9=_[_0x0dd0('0x56')](_0x167409['model']['toLowerCase']());if(_0xc7c2b9===_0x0dd0('0x57')){_0x18c23d=_[_0x0dd0('0x58')](_0x18c23d,_0x167409['ids']);}else{if(_[_0x0dd0('0x3b')](_0xc7c2b9,_0x0dd0('0x59')))_0xc7c2b9=_0xc7c2b9[_0x0dd0('0x5a')](_0x0dd0('0x59'),_0x0dd0('0x5b'));_0x167409['ids'][_0x0dd0('0x4e')](function(_0x56adf9){_0x214c40[_0x0dd0('0x5c')](getAgents(_0xc7c2b9,_0x56adf9));});}});return BPromise['all'](_0x214c40)[_0x0dd0('0x46')](function(_0x534c64){_0x18c23d=_[_0x0dd0('0x58')](_0x18c23d,_[_0x0dd0('0x5d')](_0x534c64));_0x2886fd(_0x18c23d);})[_0x0dd0('0x55')](function(_0xd14f05){_0xb0325(_0xd14f05);});});}function getAgents(_0x27e273,_0x5f51f9){return new BPromise(function(_0x1e1087,_0x5ef90e){return db[_0x27e273][_0x0dd0('0x51')]({'where':{'id':_0x5f51f9}})[_0x0dd0('0x46')](function(_0x262dcf){return _0x262dcf[_0x0dd0('0x5e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2d7604){var _0x3c3d31=_[_0x0dd0('0x5f')](_0x2d7604,'id');_0x1e1087(_0x3c3d31);});})['catch'](function(_0x55b550){_0x5ef90e(_0x55b550);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index bc1fae6..6768a8c 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 _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x3c88fe,_0x1633d1){var _0x11f8fd=function(_0x2d9375){while(--_0x2d9375){_0x3c88fe['push'](_0x3c88fe['shift']());}};_0x11f8fd(++_0x1633d1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Notification','setMaxListeners','save','update'];(function(_0x1a70f0,_0x267c2e){var _0x2eb2a5=function(_0x5a3815){while(--_0x5a3815){_0x1a70f0['push'](_0x1a70f0['shift']());}};_0x2eb2a5(++_0x267c2e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1f8e66,_0x2a3d83){_0x1f8e66=_0x1f8e66-0x0;var _0x59f195=_0x5f2f[_0x1f8e66];return _0x59f195;};'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 diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index a51cd90..70d0000 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 _0x5fae=['utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','Notification','notifications'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x5fae,0x121));var _0xe5fa=function(_0x58b399,_0x9d183a){_0x58b399=_0x58b399-0x0;var _0x4cccd5=_0x5fae[_0x58b399];return _0x4cccd5;};'use strict';var _=require(_0xe5fa('0x0'));var util=require(_0xe5fa('0x1'));var logger=require('../../config/logger')(_0xe5fa('0x2'));var moment=require(_0xe5fa('0x3'));var BPromise=require('bluebird');var rp=require(_0xe5fa('0x4'));var fs=require('fs');var path=require(_0xe5fa('0x5'));var rimraf=require(_0xe5fa('0x6'));var config=require(_0xe5fa('0x7'));var attributes=require('./notification.attributes');module[_0xe5fa('0x8')]=function(_0x1e8bd9,_0x505337){return _0x1e8bd9['define'](_0xe5fa('0x9'),attributes,{'tableName':_0xe5fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe5fa('0xb')});}; \ No newline at end of file +var _0x232b=['request-promise','path','rimraf','../../config/environment','./notification.attributes','exports','Notification','notifications','utf8mb4','util','api','moment'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x232b,0x8d));var _0xb232=function(_0x2a4045,_0x2be94e){_0x2a4045=_0x2a4045-0x0;var _0x2adc5b=_0x232b[_0x2a4045];return _0x2adc5b;};'use strict';var _=require('lodash');var util=require(_0xb232('0x0'));var logger=require('../../config/logger')(_0xb232('0x1'));var moment=require(_0xb232('0x2'));var BPromise=require('bluebird');var rp=require(_0xb232('0x3'));var fs=require('fs');var path=require(_0xb232('0x4'));var rimraf=require(_0xb232('0x5'));var config=require(_0xb232('0x6'));var attributes=require(_0xb232('0x7'));module[_0xb232('0x8')]=function(_0x359dd9,_0x3b2400){return _0x359dd9['define'](_0xb232('0x9'),attributes,{'tableName':_0xb232('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb232('0xb'),'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 fad13b5..9c57d15 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 _0x9e1c=['client','http','defaults','redis','register','request','then','info','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x9e1c,0x14a));var _0xc9e1=function(_0x1d3bd0,_0x3ded50){_0x1d3bd0=_0x1d3bd0-0x0;var _0x221cdb=_0x9e1c[_0x1d3bd0];return _0x221cdb;};'use strict';var _=require(_0xc9e1('0x0'));var util=require('util');var moment=require(_0xc9e1('0x1'));var BPromise=require(_0xc9e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9e1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc9e1('0x4'))(_0xc9e1('0x5'));var config=require(_0xc9e1('0x6'));var jayson=require(_0xc9e1('0x7'));var client=jayson[_0xc9e1('0x8')][_0xc9e1('0x9')]({'port':0x232a});config['redis']=_[_0xc9e1('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc9e1('0xb')]));require('./notification.socket')[_0xc9e1('0xc')](socket);function respondWithRpcPromise(_0x3a2b3f,_0x1dce00,_0x3f41a1){return new BPromise(function(_0x30a7eb,_0x335d72){return client[_0xc9e1('0xd')](_0x3a2b3f,_0x3f41a1)[_0xc9e1('0xe')](function(_0xb58b40){logger[_0xc9e1('0xf')](_0xc9e1('0x10'),_0x1dce00,'request\x20sent');logger[_0xc9e1('0x11')](_0xc9e1('0x12'),_0x1dce00,_0xc9e1('0x13'),JSON[_0xc9e1('0x14')](_0xb58b40));if(_0xb58b40[_0xc9e1('0x15')]){if(_0xb58b40[_0xc9e1('0x15')][_0xc9e1('0x16')]===0x1f4){logger[_0xc9e1('0x15')]('Notification,\x20%s,\x20%s',_0x1dce00,_0xb58b40[_0xc9e1('0x15')]['message']);return _0x335d72(_0xb58b40['error'][_0xc9e1('0x17')]);}logger[_0xc9e1('0x15')](_0xc9e1('0x10'),_0x1dce00,_0xb58b40[_0xc9e1('0x15')]['message']);return _0x30a7eb(_0xb58b40['error']['message']);}else{logger[_0xc9e1('0xf')](_0xc9e1('0x10'),_0x1dce00,_0xc9e1('0x13'));_0x30a7eb(_0xb58b40[_0xc9e1('0x18')]['message']);}})[_0xc9e1('0x19')](function(_0x1bbd79){logger[_0xc9e1('0x15')](_0xc9e1('0x10'),_0x1dce00,_0x1bbd79);_0x335d72(_0x1bbd79);});});} \ No newline at end of file +var _0x1301=['catch','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./notification.socket','register','request','info','Notification,\x20%s,\x20%s','request\x20sent','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5c5e95,_0x740a18){var _0x55c9aa=function(_0x52c94e){while(--_0x52c94e){_0x5c5e95['push'](_0x5c5e95['shift']());}};_0x55c9aa(++_0x740a18);}(_0x1301,0x187));var _0x1130=function(_0x1bc93c,_0x5252d0){_0x1bc93c=_0x1bc93c-0x0;var _0x7106ef=_0x1301[_0x1bc93c];return _0x7106ef;};'use strict';var _=require(_0x1130('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1130('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1130('0x2'));var db=require(_0x1130('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1130('0x4'))(_0x1130('0x5'));var config=require(_0x1130('0x6'));var jayson=require(_0x1130('0x7'));var client=jayson[_0x1130('0x8')][_0x1130('0x9')]({'port':0x232a});config[_0x1130('0xa')]=_[_0x1130('0xb')](config[_0x1130('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1130('0xc'))(new Redis(config[_0x1130('0xa')]));require(_0x1130('0xd'))[_0x1130('0xe')](socket);function respondWithRpcPromise(_0x377c3a,_0x3620ba,_0x5efc39){return new BPromise(function(_0x5f5034,_0x1a39d1){return client[_0x1130('0xf')](_0x377c3a,_0x5efc39)['then'](function(_0x50bce0){logger[_0x1130('0x10')](_0x1130('0x11'),_0x3620ba,_0x1130('0x12'));logger['debug'](_0x1130('0x13'),_0x3620ba,'request\x20sent',JSON[_0x1130('0x14')](_0x50bce0));if(_0x50bce0[_0x1130('0x15')]){if(_0x50bce0[_0x1130('0x15')][_0x1130('0x16')]===0x1f4){logger[_0x1130('0x15')](_0x1130('0x11'),_0x3620ba,_0x50bce0[_0x1130('0x15')][_0x1130('0x17')]);return _0x1a39d1(_0x50bce0['error'][_0x1130('0x17')]);}logger[_0x1130('0x15')](_0x1130('0x11'),_0x3620ba,_0x50bce0[_0x1130('0x15')][_0x1130('0x17')]);return _0x5f5034(_0x50bce0[_0x1130('0x15')][_0x1130('0x17')]);}else{logger[_0x1130('0x10')](_0x1130('0x11'),_0x3620ba,_0x1130('0x12'));_0x5f5034(_0x50bce0[_0x1130('0x18')][_0x1130('0x17')]);}})[_0x1130('0x19')](function(_0x4fcabc){logger['error']('Notification,\x20%s,\x20%s',_0x3620ba,_0x4fcabc);_0x1a39d1(_0x4fcabc);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index a0cba46..b35f0f3 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 _0xd575=['update','emit','removeListener','register','length','./notification.events'];(function(_0x624f98,_0x12488a){var _0x4e09ec=function(_0x5cb32f){while(--_0x5cb32f){_0x624f98['push'](_0x624f98['shift']());}};_0x4e09ec(++_0x12488a);}(_0xd575,0x12b));var _0x5d57=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0xd575[_0x336ca2];return _0xda59a6;};'use strict';var NotificationEvents=require(_0x5d57('0x0'));var events=['save','remove',_0x5d57('0x1')];function createListener(_0x379a63,_0x55f1df){return function(_0x30ea29){_0x55f1df[_0x5d57('0x2')](_0x379a63,_0x30ea29);};}function removeListener(_0x5ca101,_0x552a49){return function(){NotificationEvents[_0x5d57('0x3')](_0x5ca101,_0x552a49);};}exports[_0x5d57('0x4')]=function(_0x497b14){for(var _0x1cdbcc=0x0,_0x229944=events[_0x5d57('0x5')];_0x1cdbcc<_0x229944;_0x1cdbcc++){var _0x416546=events[_0x1cdbcc];var _0x13806f=createListener('notification:'+_0x416546,_0x497b14);NotificationEvents['on'](_0x416546,_0x13806f);}}; \ No newline at end of file +var _0xd21c=['removeListener','register','notification:','save','remove','update','emit'];(function(_0x8efe25,_0x23a546){var _0xe0067=function(_0x4d0c49){while(--_0x4d0c49){_0x8efe25['push'](_0x8efe25['shift']());}};_0xe0067(++_0x23a546);}(_0xd21c,0x1c3));var _0xcd21=function(_0x46d9a1,_0x136802){_0x46d9a1=_0x46d9a1-0x0;var _0x17c284=_0xd21c[_0x46d9a1];return _0x17c284;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0xcd21('0x0'),_0xcd21('0x1'),_0xcd21('0x2')];function createListener(_0x3989cf,_0x4bf0d3){return function(_0x371a68){_0x4bf0d3[_0xcd21('0x3')](_0x3989cf,_0x371a68);};}function removeListener(_0x558b9c,_0x31d8ac){return function(){NotificationEvents[_0xcd21('0x4')](_0x558b9c,_0x31d8ac);};}exports[_0xcd21('0x5')]=function(_0x5a7b51){for(var _0x29a6a1=0x0,_0x2677b8=events['length'];_0x29a6a1<_0x2677b8;_0x29a6a1++){var _0x14dd84=events[_0x29a6a1];var _0x593593=createListener(_0xcd21('0x6')+_0x14dd84,_0x5a7b51);NotificationEvents['on'](_0x14dd84,_0x593593);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 5c8b97f..8c9e387 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 _0x4141=['connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getAnswers','/:id/applications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addAgents','/:id/send','send','put','update','delete','removeAnswers','removeAgents','exports','multer','util'];(function(_0x4c0a0e,_0x2e4b1a){var _0x284bd0=function(_0x3b4f3d){while(--_0x3b4f3d){_0x4c0a0e['push'](_0x4c0a0e['shift']());}};_0x284bd0(++_0x2e4b1a);}(_0x4141,0x10e));var _0x1414=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4141[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x1414('0x0'));var util=require(_0x1414('0x1'));var path=require('path');var timeout=require(_0x1414('0x2'));var express=require(_0x1414('0x3'));var router=express[_0x1414('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1414('0x5'));var controller=require('./openchannelAccount.controller');router[_0x1414('0x6')]('/',auth[_0x1414('0x7')](),controller[_0x1414('0x8')]);router[_0x1414('0x6')]('/describe',auth[_0x1414('0x7')](),controller[_0x1414('0x9')]);router['get'](_0x1414('0xa'),auth[_0x1414('0x7')](),controller[_0x1414('0xb')]);router[_0x1414('0x6')](_0x1414('0xc'),auth[_0x1414('0x7')](),controller['getDispositions']);router[_0x1414('0x6')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1414('0xd')]);router[_0x1414('0x6')](_0x1414('0xe'),auth[_0x1414('0x7')](),controller['getApplications']);router[_0x1414('0x6')](_0x1414('0xf'),auth[_0x1414('0x7')](),controller['getInteractions']);router[_0x1414('0x6')](_0x1414('0x10'),auth[_0x1414('0x7')](),controller[_0x1414('0x11')]);router[_0x1414('0x12')]('/',auth['isAuthenticated'](),controller[_0x1414('0x13')]);router[_0x1414('0x12')](_0x1414('0xc'),auth['isAuthenticated'](),controller[_0x1414('0x14')]);router[_0x1414('0x12')](_0x1414('0x15'),auth[_0x1414('0x7')](),controller[_0x1414('0x16')]);router[_0x1414('0x12')](_0x1414('0x17'),controller[_0x1414('0x18')]);router['post'](_0x1414('0xe'),auth[_0x1414('0x7')](),controller['addApplications']);router[_0x1414('0x12')](_0x1414('0x10'),auth['isAuthenticated'](),controller[_0x1414('0x19')]);router[_0x1414('0x12')](_0x1414('0x1a'),auth[_0x1414('0x7')](),controller[_0x1414('0x1b')]);router[_0x1414('0x1c')](_0x1414('0xa'),auth[_0x1414('0x7')](),controller[_0x1414('0x1d')]);router['delete']('/:id',auth[_0x1414('0x7')](),controller['destroy']);router[_0x1414('0x1e')]('/:id/dispositions',auth[_0x1414('0x7')](),controller['removeDispositions']);router[_0x1414('0x1e')](_0x1414('0x15'),auth[_0x1414('0x7')](),controller[_0x1414('0x1f')]);router[_0x1414('0x1e')]('/:id/users',auth[_0x1414('0x7')](),controller[_0x1414('0x20')]);module[_0x1414('0x21')]=router; \ No newline at end of file +var _0x6879=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','/:id/canned_answers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','Router'];(function(_0x119875,_0x2dae6a){var _0x2b1fd1=function(_0x38aff1){while(--_0x38aff1){_0x119875['push'](_0x119875['shift']());}};_0x2b1fd1(++_0x2dae6a);}(_0x6879,0x1f4));var _0x9687=function(_0x1eee93,_0x56f3bc){_0x1eee93=_0x1eee93-0x0;var _0x404187=_0x6879[_0x1eee93];return _0x404187;};'use strict';var multer=require('multer');var util=require(_0x9687('0x0'));var path=require(_0x9687('0x1'));var timeout=require(_0x9687('0x2'));var express=require('express');var router=express[_0x9687('0x3')]();var auth=require(_0x9687('0x4'));var interaction=require(_0x9687('0x5'));var config=require(_0x9687('0x6'));var controller=require(_0x9687('0x7'));router[_0x9687('0x8')]('/',auth[_0x9687('0x9')](),controller[_0x9687('0xa')]);router['get']('/describe',auth[_0x9687('0x9')](),controller[_0x9687('0xb')]);router[_0x9687('0x8')](_0x9687('0xc'),auth[_0x9687('0x9')](),controller['show']);router[_0x9687('0x8')](_0x9687('0xd'),auth[_0x9687('0x9')](),controller['getDispositions']);router[_0x9687('0x8')](_0x9687('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x9687('0xf'),auth[_0x9687('0x9')](),controller['getApplications']);router['get'](_0x9687('0x10'),auth[_0x9687('0x9')](),controller[_0x9687('0x11')]);router[_0x9687('0x8')](_0x9687('0x12'),auth['isAuthenticated'](),controller[_0x9687('0x13')]);router[_0x9687('0x14')]('/',auth[_0x9687('0x9')](),controller['create']);router[_0x9687('0x14')]('/:id/dispositions',auth[_0x9687('0x9')](),controller[_0x9687('0x15')]);router['post'](_0x9687('0xe'),auth['isAuthenticated'](),controller[_0x9687('0x16')]);router[_0x9687('0x14')](_0x9687('0x17'),controller[_0x9687('0x18')]);router['post']('/:id/applications',auth[_0x9687('0x9')](),controller[_0x9687('0x19')]);router['post']('/:id/users',auth[_0x9687('0x9')](),controller[_0x9687('0x1a')]);router['post'](_0x9687('0x1b'),auth['isAuthenticated'](),controller['send']);router[_0x9687('0x1c')]('/:id',auth[_0x9687('0x9')](),controller[_0x9687('0x1d')]);router[_0x9687('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x9687('0x1f')]);router['delete'](_0x9687('0xd'),auth[_0x9687('0x9')](),controller[_0x9687('0x20')]);router[_0x9687('0x1e')]('/:id/canned_answers',auth[_0x9687('0x9')](),controller[_0x9687('0x21')]);router['delete']('/:id/users',auth[_0x9687('0x9')](),controller[_0x9687('0x22')]);module[_0x9687('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 0df63df..216d993 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 _0xe934=['setDataValue','mandatoryDisposition','sequelize','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0xe934,0x1af));var _0x4e93=function(_0x494f7f,_0x34a09b){_0x494f7f=_0x494f7f-0x0;var _0x18ebe4=_0xe934[_0x494f7f];return _0x18ebe4;};'use strict';var Sequelize=require(_0x4e93('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4e93('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x4e93('0x2')],'defaultValue':function(){return rs[_0x4e93('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x4e93('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4e93('0x4')],'defaultValue':function(){return _0x4e93('0x5');}},'notificationSound':{'type':Sequelize[_0x4e93('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4e93('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4e93('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x4e93('0x2')]},'queueTransfer':{'type':Sequelize[_0x4e93('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4e93('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4e93('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4e93('0x8'),'set':function(_0x4089ea){if(!_0x4089ea)this[_0x4e93('0x9')]('mandatoryDispositionPauseId',null);this[_0x4e93('0x9')](_0x4e93('0xa'),_0x4089ea);}}}; \ No newline at end of file +var _0xecb3=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x29bf9f,_0xffd109){var _0x6246c8=function(_0x5ad39d){while(--_0x5ad39d){_0x29bf9f['push'](_0x29bf9f['shift']());}};_0x6246c8(++_0xffd109);}(_0xecb3,0xde));var _0x3ecb=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xecb3[_0x1b4b23];return _0x2a325b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x3ecb('0x0'));module[_0x3ecb('0x1')]={'name':{'type':Sequelize[_0x3ecb('0x2')],'unique':_0x3ecb('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3ecb('0x2')]},'token':{'type':Sequelize[_0x3ecb('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x3ecb('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x3ecb('0x4');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3ecb('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3ecb('0x2')]},'queueTransfer':{'type':Sequelize[_0x3ecb('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3ecb('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3ecb('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x3ecb('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x3ecb('0x6')],'defaultValue':![],'comment':_0x3ecb('0x8'),'set':function(_0x366d92){if(!_0x366d92)this['setDataValue'](_0x3ecb('0x9'),null);this[_0x3ecb('0xa')](_0x3ecb('0xb'),_0x366d92);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ced4344..bffe4f2 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 _0x9c5a=['updatedAt','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','OpenchannelMessage','dataValues','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','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','sendStatus','end','status','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','show','keys','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','params','describe','addDisposition','OpenchannelAccountId','Disposition','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','findOne','rows','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt'];(function(_0x497e9d,_0x348ee0){var _0x4e5db2=function(_0x80a3c4){while(--_0x80a3c4){_0x497e9d['push'](_0x497e9d['shift']());}};_0x4e5db2(++_0x348ee0);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x33ad36,_0x4304a9){_0x33ad36=_0x33ad36-0x0;var _0x52e6e5=_0x9c5a[_0x33ad36];return _0x52e6e5;};'use strict';var pdf=require(_0xa9c5('0x0'));var emlformat=require(_0xa9c5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa9c5('0x2'));var jsonpatch=require(_0xa9c5('0x3'));var rp=require(_0xa9c5('0x4'));var moment=require(_0xa9c5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa9c5('0x6'));var util=require(_0xa9c5('0x7'));var path=require('path');var sox=require(_0xa9c5('0x8'));var csv=require('to-csv');var ejs=require(_0xa9c5('0x9'));var fs=require('fs');var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];config[_0xa9c5('0x17')]=_[_0xa9c5('0x18')](config[_0xa9c5('0x17')],{'host':_0xa9c5('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa9c5('0x17')]));require(_0xa9c5('0x1a'))[_0xa9c5('0x1b')](socket);var jayson=require(_0xa9c5('0x1c'));var client=jayson[_0xa9c5('0x1d')][_0xa9c5('0x1e')]({'port':0x232c});var client9002=jayson[_0xa9c5('0x1d')][_0xa9c5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x19a43e,_0xcf13f2,_0x4bb57e,_0x2b0d73){return new BPromise(function(_0xd85c32,_0x1ee5ac){var _0x55cce5=_0x2b0d73||client;return _0x55cce5[_0xa9c5('0x1f')](_0x19a43e,_0x4bb57e)[_0xa9c5('0x20')](function(_0x2b9ac5){logger[_0xa9c5('0x21')](_0xa9c5('0x22'),_0xcf13f2,_0xa9c5('0x23'));logger[_0xa9c5('0x24')](_0xa9c5('0x25'),_0xcf13f2,_0xa9c5('0x23'),JSON[_0xa9c5('0x26')](_0x2b9ac5));if(_0x2b9ac5[_0xa9c5('0x27')]){if(_0x2b9ac5[_0xa9c5('0x27')]['code']===0x1f4){logger[_0xa9c5('0x27')](_0xa9c5('0x22'),_0xcf13f2,_0x2b9ac5['error']['message']);return _0x1ee5ac(_0x2b9ac5[_0xa9c5('0x27')][_0xa9c5('0x28')]);}logger[_0xa9c5('0x27')](_0xa9c5('0x22'),_0xcf13f2,_0x2b9ac5[_0xa9c5('0x27')][_0xa9c5('0x28')]);return _0xd85c32(_0x2b9ac5['error']['message']);}else{logger[_0xa9c5('0x21')](_0xa9c5('0x22'),_0xcf13f2,'request\x20sent');_0xd85c32(_0x2b9ac5[_0xa9c5('0x29')][_0xa9c5('0x28')]);}})[_0xa9c5('0x2a')](function(_0x32fc7d){logger[_0xa9c5('0x27')](_0xa9c5('0x22'),_0xcf13f2,_0x32fc7d);_0x1ee5ac(_0x32fc7d);});});}function respondWithStatusCode(_0xe44e6d,_0x51b64a){_0x51b64a=_0x51b64a||0xcc;return function(_0x4e8a7f){if(_0x4e8a7f){return _0xe44e6d[_0xa9c5('0x2b')](_0x51b64a);}return _0xe44e6d['status'](_0x51b64a)[_0xa9c5('0x2c')]();};}function respondWithResult(_0x830bad,_0x4caefa){_0x4caefa=_0x4caefa||0xc8;return function(_0x11a723){if(_0x11a723){return _0x830bad[_0xa9c5('0x2d')](_0x4caefa)['json'](_0x11a723);}};}function respondWithFilteredResult(_0x413edf,_0x32baf9){return function(_0x198cdf){if(_0x198cdf){var _0x185eb8=_0x198cdf['count'],_0x325c65=_0x32baf9[_0xa9c5('0x2e')],_0x4f6e70=_0x32baf9[_0xa9c5('0x2e')]+_0x32baf9[_0xa9c5('0x2f')],_0x36f267;if(_0x4f6e70>=_0x185eb8){_0x4f6e70=_0x185eb8;_0x36f267=0xc8;}else{_0x36f267=0xce;}_0x413edf['status'](_0x36f267);return _0x413edf[_0xa9c5('0x30')](_0xa9c5('0x31'),_0x325c65+'-'+_0x4f6e70+'/'+_0x185eb8)['json'](_0x198cdf);}return null;};}function patchUpdates(_0x3f11a9){return function(_0xc454fd){try{jsonpatch[_0xa9c5('0x32')](_0xc454fd,_0x3f11a9,!![]);}catch(_0x378684){return BPromise[_0xa9c5('0x33')](_0x378684);}return _0xc454fd[_0xa9c5('0x34')]();};}function saveUpdates(_0x3a66d8,_0x4b9104){return function(_0x452330){if(_0x452330){return _0x452330[_0xa9c5('0x35')](_0x3a66d8)[_0xa9c5('0x20')](function(_0x1c01f9){return _0x1c01f9;});}return null;};}function removeEntity(_0x1c617c,_0x2de191){return function(_0x226427){if(_0x226427){return _0x226427[_0xa9c5('0x36')]()['then'](function(){var _0x4e3f3e=_0x226427[_0xa9c5('0x37')]({'plain':!![]});var _0x30a0e8=_0xa9c5('0x38');return db[_0xa9c5('0x39')][_0xa9c5('0x36')]({'where':{'type':_0x30a0e8,'resourceId':_0x4e3f3e['id']}})[_0xa9c5('0x20')](function(){return _0x226427;});})['then'](function(){_0x1c617c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x314010,_0x27d614){return function(_0x5087e4){if(!_0x5087e4){_0x314010[_0xa9c5('0x2b')](0x194);}return _0x5087e4;};}function handleError(_0x56eb82,_0x1f5740){_0x1f5740=_0x1f5740||0x1f4;return function(_0x1fc8bf){logger[_0xa9c5('0x27')](_0x1fc8bf[_0xa9c5('0x3a')]);if(_0x1fc8bf['name']){delete _0x1fc8bf[_0xa9c5('0x3b')];}_0x56eb82[_0xa9c5('0x2d')](_0x1f5740)[_0xa9c5('0x3c')](_0x1fc8bf);};}exports[_0xa9c5('0x3d')]=function(_0x814c1a,_0x17ef8e){var _0x422f9b={'include':[{'model':db[_0xa9c5('0x3e')],'as':_0xa9c5('0x3f')}]},_0x251812={},_0x573fc0={'count':0x0,'rows':[]};var _0x841c18=_[_0xa9c5('0x40')](db[_0xa9c5('0x41')][_0xa9c5('0x42')],function(_0x493b20){return{'name':_0x493b20[_0xa9c5('0x43')],'type':_0x493b20['type'][_0xa9c5('0x44')]};});_0x251812['model']=_[_0xa9c5('0x40')](_0x841c18,_0xa9c5('0x3b'));_0x251812[_0xa9c5('0x45')]=_['keys'](_0x814c1a[_0xa9c5('0x45')]);_0x251812[_0xa9c5('0x46')]=_[_0xa9c5('0x47')](_0x251812[_0xa9c5('0x48')],_0x251812['query']);_0x422f9b[_0xa9c5('0x49')]=_[_0xa9c5('0x47')](_0x251812[_0xa9c5('0x48')],qs[_0xa9c5('0x4a')](_0x814c1a[_0xa9c5('0x45')]['fields']));_0x422f9b[_0xa9c5('0x49')]=_0x422f9b['attributes'][_0xa9c5('0x4b')]?_0x422f9b[_0xa9c5('0x49')]:_0x251812[_0xa9c5('0x48')];if(!_0x814c1a[_0xa9c5('0x45')][_0xa9c5('0x4c')](_0xa9c5('0x4d'))){_0x422f9b[_0xa9c5('0x2f')]=qs[_0xa9c5('0x2f')](_0x814c1a[_0xa9c5('0x45')][_0xa9c5('0x2f')]);_0x422f9b['offset']=qs[_0xa9c5('0x2e')](_0x814c1a[_0xa9c5('0x45')][_0xa9c5('0x2e')]);}_0x422f9b[_0xa9c5('0x4e')]=qs[_0xa9c5('0x4f')](_0x814c1a[_0xa9c5('0x45')]['sort']);_0x422f9b[_0xa9c5('0x50')]=qs[_0xa9c5('0x46')](_['pick'](_0x814c1a['query'],_0x251812['filters']),_0x841c18);if(_0x814c1a['query']['filter']){_0x422f9b[_0xa9c5('0x50')]=_[_0xa9c5('0x51')](_0x422f9b[_0xa9c5('0x50')],{'$or':_[_0xa9c5('0x40')](_0x841c18,function(_0x255402){if(_0x255402[_0xa9c5('0x52')]!==_0xa9c5('0x53')){var _0x5b00a6={};_0x5b00a6[_0x255402[_0xa9c5('0x3b')]]={'$like':'%'+_0x814c1a[_0xa9c5('0x45')][_0xa9c5('0x54')]+'%'};return _0x5b00a6;}})});}_0x422f9b=_[_0xa9c5('0x51')]({},_0x422f9b,_0x814c1a[_0xa9c5('0x55')]);var _0x4bf8b4={'where':_0x422f9b[_0xa9c5('0x50')]};return db['OpenchannelAccount'][_0xa9c5('0x56')](_0x4bf8b4)[_0xa9c5('0x20')](function(_0x5c1c3a){_0x573fc0['count']=_0x5c1c3a;if(_0x814c1a[_0xa9c5('0x45')][_0xa9c5('0x57')]){_0x422f9b[_0xa9c5('0x58')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x422f9b);})[_0xa9c5('0x20')](function(_0xd03cec){_0x573fc0['rows']=_0xd03cec;return _0x573fc0;})[_0xa9c5('0x20')](respondWithFilteredResult(_0x17ef8e,_0x422f9b))[_0xa9c5('0x2a')](handleError(_0x17ef8e,null));};exports[_0xa9c5('0x59')]=function(_0x361b7c,_0x34020f){var _0xb369da={'raw':![],'where':{'id':_0x361b7c['params']['id']},'include':[{'model':db['Pause'],'as':_0xa9c5('0x3f')}]},_0x4b6fc9={};_0x4b6fc9[_0xa9c5('0x48')]=_[_0xa9c5('0x5a')](db[_0xa9c5('0x41')][_0xa9c5('0x42')]);_0x4b6fc9[_0xa9c5('0x45')]=_['keys'](_0x361b7c[_0xa9c5('0x45')]);_0x4b6fc9[_0xa9c5('0x46')]=_[_0xa9c5('0x47')](_0x4b6fc9[_0xa9c5('0x48')],_0x4b6fc9[_0xa9c5('0x45')]);_0xb369da[_0xa9c5('0x49')]=_['intersection'](_0x4b6fc9['model'],qs[_0xa9c5('0x4a')](_0x361b7c['query'][_0xa9c5('0x4a')]));_0xb369da['attributes']=_0xb369da[_0xa9c5('0x49')][_0xa9c5('0x4b')]?_0xb369da[_0xa9c5('0x49')]:_0x4b6fc9['model'];if(_0x361b7c[_0xa9c5('0x45')][_0xa9c5('0x57')]){_0xb369da[_0xa9c5('0x58')]=[{'all':!![]}];}_0xb369da=_[_0xa9c5('0x51')]({},_0xb369da,_0x361b7c['options']);return db['OpenchannelAccount'][_0xa9c5('0x5b')](_0xb369da)[_0xa9c5('0x20')](handleEntityNotFound(_0x34020f,null))[_0xa9c5('0x20')](respondWithResult(_0x34020f,null))['catch'](handleError(_0x34020f,null));};exports[_0xa9c5('0x5c')]=function(_0x867922,_0x3d3c04){return db[_0xa9c5('0x41')][_0xa9c5('0x5c')](_0x867922[_0xa9c5('0x5d')],{})[_0xa9c5('0x20')](function(_0x298b3d){var _0x5a7f0a=_0x867922[_0xa9c5('0x5e')]['get']({'plain':!![]});if(!_0x5a7f0a)throw new Error(_0xa9c5('0x5f'));if(_0x5a7f0a[_0xa9c5('0x60')]===_0xa9c5('0x5e')){var _0x4dfe3a=_0x298b3d[_0xa9c5('0x37')]({'plain':!![]});var _0x1dd3b2='OpenchannelAccounts';return db[_0xa9c5('0x61')][_0xa9c5('0x5b')]({'where':{'name':_0x1dd3b2,'userProfileId':_0x5a7f0a[_0xa9c5('0x62')]},'raw':!![]})[_0xa9c5('0x20')](function(_0x49f91c){if(_0x49f91c&&_0x49f91c[_0xa9c5('0x63')]===0x0){return db[_0xa9c5('0x39')][_0xa9c5('0x5c')]({'name':_0x4dfe3a[_0xa9c5('0x3b')],'resourceId':_0x4dfe3a['id'],'type':_0x49f91c['name'],'sectionId':_0x49f91c['id']},{})['then'](function(){return _0x298b3d;});}else{return _0x298b3d;}})[_0xa9c5('0x2a')](function(_0x3deb64){logger[_0xa9c5('0x27')](_0xa9c5('0x64'),_0x3deb64);throw _0x3deb64;});}return _0x298b3d;})[_0xa9c5('0x20')](respondWithResult(_0x3d3c04,0xc9))[_0xa9c5('0x2a')](handleError(_0x3d3c04,null));};exports['update']=function(_0x86be71,_0x1e787e){if(_0x86be71[_0xa9c5('0x5d')]['id']){delete _0x86be71[_0xa9c5('0x5d')]['id'];}return db[_0xa9c5('0x41')][_0xa9c5('0x5b')]({'where':{'id':_0x86be71[_0xa9c5('0x65')]['id']},'include':[{'model':db[_0xa9c5('0x3e')],'as':_0xa9c5('0x3f')}]})[_0xa9c5('0x20')](handleEntityNotFound(_0x1e787e,null))['then'](saveUpdates(_0x86be71['body'],null))[_0xa9c5('0x20')](respondWithResult(_0x1e787e,null))[_0xa9c5('0x2a')](handleError(_0x1e787e,null));};exports[_0xa9c5('0x36')]=function(_0x47afaa,_0x57abd1){return db[_0xa9c5('0x41')]['find']({'where':{'id':_0x47afaa[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x57abd1,null))[_0xa9c5('0x20')](removeEntity(_0x57abd1,null))[_0xa9c5('0x2a')](handleError(_0x57abd1,null));};exports[_0xa9c5('0x66')]=function(_0x11bb72,_0xfd6ecf){return db[_0xa9c5('0x41')][_0xa9c5('0x66')]()[_0xa9c5('0x20')](respondWithResult(_0xfd6ecf,null))[_0xa9c5('0x2a')](handleError(_0xfd6ecf,null));};exports[_0xa9c5('0x67')]=function(_0x59cfee,_0x3312d1,_0x1a4aa7){if(_0x59cfee[_0xa9c5('0x5d')]['id']){delete _0x59cfee[_0xa9c5('0x5d')]['id'];}return db[_0xa9c5('0x41')][_0xa9c5('0x5b')]({'where':{'id':_0x59cfee[_0xa9c5('0x65')]['id']}})['then'](handleEntityNotFound(_0x3312d1,null))['then'](function(_0x207bb7){if(_0x207bb7){_0x59cfee['body'][_0xa9c5('0x68')]=_0x207bb7['id'];return db[_0xa9c5('0x69')]['create'](_0x59cfee[_0xa9c5('0x5d')]);}})[_0xa9c5('0x20')](respondWithResult(_0x3312d1,null))['catch'](handleError(_0x3312d1,null));};exports['getDispositions']=function(_0x14c4f2,_0x26c805,_0x22af29){var _0x514f3d={'raw':![],'where':{}};var _0x4a2bce={};var _0xd1ea={'count':0x0,'rows':[]};return db[_0xa9c5('0x41')]['findOne']({'where':{'id':_0x14c4f2[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x26c805,null))[_0xa9c5('0x20')](function(_0x3c0c7a){if(_0x3c0c7a){_0x4a2bce[_0xa9c5('0x48')]=_[_0xa9c5('0x5a')](db['Disposition'][_0xa9c5('0x42')]);_0x4a2bce[_0xa9c5('0x45')]=_[_0xa9c5('0x5a')](_0x14c4f2[_0xa9c5('0x45')]);_0x4a2bce['filters']=_[_0xa9c5('0x47')](_0x4a2bce[_0xa9c5('0x48')],_0x4a2bce['query']);_0x514f3d[_0xa9c5('0x49')]=_[_0xa9c5('0x47')](_0x4a2bce[_0xa9c5('0x48')],qs['fields'](_0x14c4f2[_0xa9c5('0x45')][_0xa9c5('0x4a')]));_0x514f3d[_0xa9c5('0x49')]=_0x514f3d[_0xa9c5('0x49')][_0xa9c5('0x4b')]?_0x514f3d[_0xa9c5('0x49')]:_0x4a2bce[_0xa9c5('0x48')];if(!_0x14c4f2['query'][_0xa9c5('0x4c')](_0xa9c5('0x4d'))){_0x514f3d[_0xa9c5('0x2f')]=qs[_0xa9c5('0x2f')](_0x14c4f2[_0xa9c5('0x45')][_0xa9c5('0x2f')]);_0x514f3d[_0xa9c5('0x2e')]=qs[_0xa9c5('0x2e')](_0x14c4f2[_0xa9c5('0x45')][_0xa9c5('0x2e')]);}_0x514f3d[_0xa9c5('0x4e')]=qs['sort'](_0x14c4f2[_0xa9c5('0x45')][_0xa9c5('0x4f')]);_0x514f3d['where']=qs[_0xa9c5('0x46')](_[_0xa9c5('0x6a')](_0x14c4f2[_0xa9c5('0x45')],_0x4a2bce['filters']));_0x514f3d[_0xa9c5('0x50')][_0xa9c5('0x68')]=_0x3c0c7a['id'];if(_0x14c4f2[_0xa9c5('0x45')][_0xa9c5('0x54')]){_0x514f3d['where']=_[_0xa9c5('0x51')](_0x514f3d[_0xa9c5('0x50')],{'$or':_['map'](_0x514f3d['attributes'],function(_0x4b2046){var _0x4bbe99={};_0x4bbe99[_0x4b2046]={'$like':'%'+_0x14c4f2['query']['filter']+'%'};return _0x4bbe99;})});}_0x514f3d=_['merge']({},_0x514f3d,_0x14c4f2['options']);return db[_0xa9c5('0x69')][_0xa9c5('0x56')]({'where':_0x514f3d[_0xa9c5('0x50')]})[_0xa9c5('0x20')](function(_0x3e0f0f){_0xd1ea['count']=_0x3e0f0f;if(_0x14c4f2['query']['includeAll']){_0x514f3d['include']=[{'all':!![]}];}return db[_0xa9c5('0x69')][_0xa9c5('0x6b')](_0x514f3d);})[_0xa9c5('0x20')](function(_0x2eda17){_0xd1ea['rows']=_0x2eda17;return _0xd1ea;});}})['then'](respondWithFilteredResult(_0x26c805,_0x514f3d))[_0xa9c5('0x2a')](handleError(_0x26c805,null));};exports[_0xa9c5('0x6c')]=function(_0x144e97,_0x2b118d,_0x1d89ec){return db['OpenchannelAccount'][_0xa9c5('0x5b')]({'where':{'id':_0x144e97[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x2b118d,null))['then'](function(_0x26c81e){if(_0x26c81e){return _0x26c81e[_0xa9c5('0x6c')](_0x144e97[_0xa9c5('0x45')][_0xa9c5('0x6d')]);}})['then'](respondWithStatusCode(_0x2b118d,null))[_0xa9c5('0x2a')](handleError(_0x2b118d,null));};exports[_0xa9c5('0x6e')]=function(_0x58d575,_0x5deb88,_0x2f1e9f){if(_0x58d575['body']['id']){delete _0x58d575['body']['id'];}return db[_0xa9c5('0x41')][_0xa9c5('0x5b')]({'where':{'id':_0x58d575[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x5deb88,null))[_0xa9c5('0x20')](function(_0x5bc433){if(_0x5bc433){_0x58d575[_0xa9c5('0x5d')]['OpenchannelAccountId']=_0x5bc433['id'];return db[_0xa9c5('0x6f')][_0xa9c5('0x5c')](_0x58d575[_0xa9c5('0x5d')]);}})[_0xa9c5('0x20')](respondWithResult(_0x5deb88,null))['catch'](handleError(_0x5deb88,null));};exports['getAnswers']=function(_0x47225c,_0x532712,_0x57851d){var _0x38e2f={'raw':![],'where':{}};var _0x370bbb={};var _0x4cdf88={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa9c5('0x70')]({'where':{'id':_0x47225c[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x532712,null))[_0xa9c5('0x20')](function(_0x57e73c){if(_0x57e73c){_0x370bbb['model']=_[_0xa9c5('0x5a')](db[_0xa9c5('0x6f')][_0xa9c5('0x42')]);_0x370bbb[_0xa9c5('0x45')]=_[_0xa9c5('0x5a')](_0x47225c[_0xa9c5('0x45')]);_0x370bbb[_0xa9c5('0x46')]=_['intersection'](_0x370bbb[_0xa9c5('0x48')],_0x370bbb[_0xa9c5('0x45')]);_0x38e2f['attributes']=_[_0xa9c5('0x47')](_0x370bbb[_0xa9c5('0x48')],qs['fields'](_0x47225c[_0xa9c5('0x45')][_0xa9c5('0x4a')]));_0x38e2f[_0xa9c5('0x49')]=_0x38e2f[_0xa9c5('0x49')][_0xa9c5('0x4b')]?_0x38e2f[_0xa9c5('0x49')]:_0x370bbb[_0xa9c5('0x48')];if(!_0x47225c[_0xa9c5('0x45')][_0xa9c5('0x4c')](_0xa9c5('0x4d'))){_0x38e2f[_0xa9c5('0x2f')]=qs[_0xa9c5('0x2f')](_0x47225c[_0xa9c5('0x45')][_0xa9c5('0x2f')]);_0x38e2f[_0xa9c5('0x2e')]=qs[_0xa9c5('0x2e')](_0x47225c[_0xa9c5('0x45')]['offset']);}_0x38e2f[_0xa9c5('0x4e')]=qs[_0xa9c5('0x4f')](_0x47225c[_0xa9c5('0x45')]['sort']);_0x38e2f[_0xa9c5('0x50')]=qs[_0xa9c5('0x46')](_['pick'](_0x47225c[_0xa9c5('0x45')],_0x370bbb[_0xa9c5('0x46')]));_0x38e2f[_0xa9c5('0x50')][_0xa9c5('0x68')]=_0x57e73c['id'];if(_0x47225c[_0xa9c5('0x45')][_0xa9c5('0x54')]){_0x38e2f[_0xa9c5('0x50')]=_[_0xa9c5('0x51')](_0x38e2f[_0xa9c5('0x50')],{'$or':_[_0xa9c5('0x40')](_0x38e2f[_0xa9c5('0x49')],function(_0x4fe78){var _0xf8f816={};_0xf8f816[_0x4fe78]={'$like':'%'+_0x47225c['query']['filter']+'%'};return _0xf8f816;})});}_0x38e2f=_[_0xa9c5('0x51')]({},_0x38e2f,_0x47225c[_0xa9c5('0x55')]);return db['CannedAnswer'][_0xa9c5('0x56')]({'where':_0x38e2f[_0xa9c5('0x50')]})[_0xa9c5('0x20')](function(_0x148338){_0x4cdf88['count']=_0x148338;if(_0x47225c['query'][_0xa9c5('0x57')]){_0x38e2f[_0xa9c5('0x58')]=[{'all':!![]}];}return db[_0xa9c5('0x6f')]['findAll'](_0x38e2f);})[_0xa9c5('0x20')](function(_0x132958){_0x4cdf88[_0xa9c5('0x71')]=_0x132958;return _0x4cdf88;});}})['then'](respondWithFilteredResult(_0x532712,_0x38e2f))[_0xa9c5('0x2a')](handleError(_0x532712,null));};exports[_0xa9c5('0x72')]=function(_0x70230d,_0x1a09f0,_0xd2b735){return db[_0xa9c5('0x41')][_0xa9c5('0x5b')]({'where':{'id':_0x70230d[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x1a09f0,null))[_0xa9c5('0x20')](function(_0x133a2c){if(_0x133a2c){return _0x133a2c[_0xa9c5('0x72')](_0x70230d[_0xa9c5('0x45')][_0xa9c5('0x6d')]);}})[_0xa9c5('0x20')](respondWithStatusCode(_0x1a09f0,null))['catch'](handleError(_0x1a09f0,null));};exports['notify']=function(_0x4acddb,_0x1d6a2a,_0x3bfc19){var _0x4d3fa4={'body':_0x4acddb[_0xa9c5('0x5d')],'channel':_0xa9c5('0x73')};var _0x5646ab=[];var _0x428223=[];var _0x36d10b={};var _0x2f853b=![];return db[_0xa9c5('0x74')][_0xa9c5('0x66')]()['then'](function(_0x70d779){if(!_0x70d779){throw new db[(_0xa9c5('0x75'))][(_0xa9c5('0x76'))](_0xa9c5('0x77'));}_0x5646ab=_[_0xa9c5('0x78')](_[_0xa9c5('0x5a')](_0x70d779),[_0xa9c5('0x79'),_0xa9c5('0x7a')]);_0x428223=_[_0xa9c5('0x78')](_[_0xa9c5('0x5a')](_0x70d779),[_0xa9c5('0x79'),_0xa9c5('0x7a'),_0xa9c5('0x7b'),'ListId']);if(_0x4acddb['body']['id']){delete _0x4acddb[_0xa9c5('0x5d')]['id'];}if(_[_0xa9c5('0x7c')](_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x7d')])){throw new db['Sequelize'][(_0xa9c5('0x76'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x4acddb['body'][_0xa9c5('0x5d')])||_0x4acddb[_0xa9c5('0x5d')]['body']===''){throw new db[(_0xa9c5('0x75'))][(_0xa9c5('0x76'))](_0xa9c5('0x7e'));}if(_[_0xa9c5('0x7c')](_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x7f')])){throw new db[(_0xa9c5('0x75'))]['ValidationError'](_0xa9c5('0x80')+_0x428223);}if(!_['includes'](_0x428223,_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x7f')])){throw new db[(_0xa9c5('0x75'))][(_0xa9c5('0x76'))](_0xa9c5('0x81')+_0x428223);}_0x36d10b[_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x7f')]]=_0x4acddb[_0xa9c5('0x5d')]['from'];})[_0xa9c5('0x20')](function(){return db['OpenchannelAccount'][_0xa9c5('0x5b')]({'where':{'id':_0x4acddb['params']['id']},'include':[{'model':db[_0xa9c5('0x82')],'as':_0xa9c5('0x83'),'include':[{'model':db[_0xa9c5('0x74')],'as':_0xa9c5('0x84'),'where':_0x36d10b,'limit':0x1,'order':[[_0xa9c5('0x7a'),_0xa9c5('0x85')]]}]},{'model':db[_0xa9c5('0x86')],'as':_0xa9c5('0x87')}]});})['then'](handleEntityNotFound(_0x1d6a2a,null))['then'](function(_0x3fd556){if(_0x3fd556&&_0x3fd556[_0xa9c5('0x83')]){_0x4d3fa4[_0xa9c5('0x88')]=_0x3fd556;_0x4d3fa4[_0xa9c5('0x89')]=_0x3fd556['Applications'];_0x4d3fa4['list']=_0x3fd556[_0xa9c5('0x83')];_0x4d3fa4[_0xa9c5('0x89')]=_[_0xa9c5('0x8a')](_0x4d3fa4[_0xa9c5('0x89')],[_0xa9c5('0x8b')],[_0xa9c5('0x8c')]);if(_0x4d3fa4[_0xa9c5('0x88')][_0xa9c5('0x87')]){delete _0x4d3fa4[_0xa9c5('0x88')]['Applications'];}if(_0x4d3fa4[_0xa9c5('0x88')][_0xa9c5('0x83')]&&_0x4d3fa4[_0xa9c5('0x88')][_0xa9c5('0x83')][_0xa9c5('0x84')][_0xa9c5('0x4b')]){return _0x4d3fa4[_0xa9c5('0x88')][_0xa9c5('0x83')][_0xa9c5('0x84')][0x0];}var _0x2204b=_[_0xa9c5('0x18')](_0x4acddb[_0xa9c5('0x5d')],{'firstName':_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x7d')],'ListId':_0x3fd556[_0xa9c5('0x8d')]});_0x2204b[_0x4acddb['body'][_0xa9c5('0x7f')]]=_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x7d')];return db['CmContact'][_0xa9c5('0x5c')](_0x2204b,{'fields':_0x5646ab,'raw':!![]});}})['then'](handleEntityNotFound(_0x1d6a2a,null))[_0xa9c5('0x20')](function(_0x195206){_0x4d3fa4[_0xa9c5('0x8e')]=_0x195206;if(_0x195206){var _0x28f6e8={'ContactId':_0x195206['id'],'OpenchannelAccountId':_0x4acddb[_0xa9c5('0x65')]['id'],'from':(_0x195206[_0xa9c5('0x8f')]||'')+'\x20'+(_0x195206[_0xa9c5('0x90')]||'')};var _0x102868={'OpenchannelAccountId':_0x4acddb[_0xa9c5('0x65')]['id'],'closed':![]};if(_0x4acddb['body'][_0xa9c5('0x91')]){_0x102868[_0xa9c5('0x91')]=_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x91')];return db[_0xa9c5('0x92')]['find']({'where':_0x102868})[_0xa9c5('0x20')](function(_0x3c11df){if(_0x3c11df){return[_0x3c11df,![]];}_0x28f6e8[_0xa9c5('0x91')]=_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x91')];_0x28f6e8['externalUrl']=_0x4acddb[_0xa9c5('0x5d')]['externalUrl'];return db[_0xa9c5('0x92')][_0xa9c5('0x5c')](_0x28f6e8)[_0xa9c5('0x20')](function(_0x255c72){return[_0x255c72,!![]];});});}else{_0x102868[_0xa9c5('0x91')]=null;}_0x102868[_0xa9c5('0x93')]=_0x195206['id'];return db[_0xa9c5('0x92')][_0xa9c5('0x5b')]({'where':_0x102868})[_0xa9c5('0x20')](function(_0x1400b2){if(_0x1400b2){return[_0x1400b2,![]];}return db[_0xa9c5('0x92')][_0xa9c5('0x5c')](_0x28f6e8)[_0xa9c5('0x20')](function(_0x1c8efb){return[_0x1c8efb,!![]];});});}})[_0xa9c5('0x94')](function(_0x452650,_0x124b4a){if(_0x452650){_0x2f853b=_0x124b4a;if(!_0x124b4a){var _0x523391={'from':(_0x4d3fa4[_0xa9c5('0x8e')][_0xa9c5('0x8f')]||'')+'\x20'+(_0x4d3fa4[_0xa9c5('0x8e')][_0xa9c5('0x90')]||'')};if(_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x91')]&&_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x95')]&&_0x4acddb['body'][_0xa9c5('0x91')]!=_0x4acddb[_0xa9c5('0x5d')]['messageId']){_0x523391[_0xa9c5('0x91')]=_0x4acddb[_0xa9c5('0x5d')]['messageId'];}return _0x452650['update'](_0x523391);}else{return _0x452650;}}})[_0xa9c5('0x20')](function(_0x39c3e4){_0x4d3fa4['interaction']=_0x39c3e4[_0xa9c5('0x37')]({'plain':!![]});_0x4d3fa4[_0xa9c5('0x96')][_0xa9c5('0x97')]=_0x2f853b;if(_0x4d3fa4[_0xa9c5('0x96')][_0xa9c5('0x97')]){if(_0x4d3fa4[_0xa9c5('0x88')][_0xa9c5('0x98')]){_0x4d3fa4[_0xa9c5('0x89')][_0xa9c5('0x99')]({'id':0x0,'priority':_0x4d3fa4['applications'][_0xa9c5('0x4b')]+0x1,'app':_0xa9c5('0x9a'),'appdata':_0xa9c5('0x9b'),'interval':_0xa9c5('0x9c')});}}return db['OpenchannelMessage']['create']({'body':_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x5d')],'OpenchannelAccountId':_0x4acddb[_0xa9c5('0x65')]['id'],'OpenchannelInteractionId':_0x39c3e4['id'],'direction':'in','ContactId':_0x4d3fa4[_0xa9c5('0x8e')]['id'],'AttachmentId':_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x9d')]});})['then'](function(_0xca4f80){_0x4d3fa4[_0xa9c5('0x28')]=_0xca4f80;if(_0x4d3fa4[_0xa9c5('0x96')]['UserId']){return db[_0xa9c5('0x9e')][_0xa9c5('0x5b')]({'attributes':['id','name'],'where':{'id':_0x4d3fa4[_0xa9c5('0x96')]['UserId']}})[_0xa9c5('0x20')](function(_0x4d4cd2){if(_0x4d4cd2){_0x4d3fa4['applications'][_0xa9c5('0x9f')]({'id':0x0,'priority':0x0,'app':_0xa9c5('0xa0'),'appdata':_0x4d4cd2['name']+','+(_0x4d3fa4['account'][_0xa9c5('0xa1')]||0xa),'interval':_0xa9c5('0x9c')});_0x4d3fa4[_0xa9c5('0xa2')]=![];}return respondWithRpcPromise(_0xa9c5('0xa3'),'startRouting',_0x4d3fa4);});}return respondWithRpcPromise(_0xa9c5('0xa3'),_0xa9c5('0xa4'),_0x4d3fa4);})['then'](function(_0x5c3bc9){respondWithRpcPromise(_0xa9c5('0xa5'),'EventManager',{'event':_0xa9c5('0xa6'),'message':_0x5c3bc9},client9002);return _0x5c3bc9;})['then'](respondWithResult(_0x1d6a2a,null))[_0xa9c5('0x2a')](handleError(_0x1d6a2a,null));};exports['addApplications']=function(_0xc290ff,_0x27ceea,_0x15c882){return db['OpenchannelAccount'][_0xa9c5('0x70')]({'where':{'id':_0xc290ff[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x27ceea,null))[_0xa9c5('0x20')](function(_0x448971){if(_0x448971){return db[_0xa9c5('0xa7')][_0xa9c5('0xa8')](function(_0x15ee82){return db[_0xa9c5('0x86')][_0xa9c5('0x36')]({'where':{'OpenchannelAccountId':_0xc290ff[_0xa9c5('0x65')]['id']},'transaction':_0x15ee82})[_0xa9c5('0x20')](function(_0x4681f9){var _0x1ead2e=_[_0xa9c5('0x40')](_0xc290ff[_0xa9c5('0x5d')],function(_0x1e2b13){_0x1e2b13[_0xa9c5('0x68')]=_0xc290ff[_0xa9c5('0x65')]['id'];return _0x1e2b13;});return db[_0xa9c5('0x86')][_0xa9c5('0xa9')](_0x1ead2e,{'transaction':_0x15ee82});});})[_0xa9c5('0x20')](function(){return db[_0xa9c5('0x86')][_0xa9c5('0xaa')]({'where':{'OpenchannelAccountId':_0xc290ff[_0xa9c5('0x65')]['id']},'order':'priority'});});}})[_0xa9c5('0x20')](respondWithResult(_0x27ceea,null))[_0xa9c5('0x2a')](handleError(_0x27ceea,null));};exports[_0xa9c5('0xab')]=function(_0xa8905e,_0x5e9ce9,_0x1ff174){var _0x4d7916={};var _0x21a87e={};var _0x5b8f70;var _0x3725ff;return db['OpenchannelAccount'][_0xa9c5('0x70')]({'where':{'id':_0xa8905e[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x5e9ce9,null))[_0xa9c5('0x20')](function(_0x4a6123){if(_0x4a6123){_0x5b8f70=_0x4a6123;_0x21a87e[_0xa9c5('0x48')]=_[_0xa9c5('0x5a')](db[_0xa9c5('0x86')][_0xa9c5('0x42')]);_0x21a87e[_0xa9c5('0x45')]=_['keys'](_0xa8905e[_0xa9c5('0x45')]);_0x21a87e[_0xa9c5('0x46')]=_[_0xa9c5('0x47')](_0x21a87e['model'],_0x21a87e[_0xa9c5('0x45')]);_0x4d7916[_0xa9c5('0x49')]=_[_0xa9c5('0x47')](_0x21a87e[_0xa9c5('0x48')],qs['fields'](_0xa8905e['query']['fields']));_0x4d7916[_0xa9c5('0x49')]=_0x4d7916[_0xa9c5('0x49')]['length']?_0x4d7916[_0xa9c5('0x49')]:_0x21a87e['model'];_0x4d7916[_0xa9c5('0x4e')]=qs['sort'](_0xa8905e[_0xa9c5('0x45')][_0xa9c5('0x4f')]);_0x4d7916[_0xa9c5('0x50')]=qs[_0xa9c5('0x46')](_[_0xa9c5('0x6a')](_0xa8905e[_0xa9c5('0x45')],_0x21a87e[_0xa9c5('0x46')]));if(_0xa8905e[_0xa9c5('0x45')][_0xa9c5('0x54')]){_0x4d7916[_0xa9c5('0x50')]=_[_0xa9c5('0x51')](_0x4d7916['where'],{'$or':_[_0xa9c5('0x40')](_0x4d7916[_0xa9c5('0x49')],function(_0x1bf7f5){var _0x5f2be5={};_0x5f2be5[_0x1bf7f5]={'$like':'%'+_0xa8905e[_0xa9c5('0x45')][_0xa9c5('0x54')]+'%'};return _0x5f2be5;})});}_0x4d7916=_[_0xa9c5('0x51')]({},_0x4d7916,_0xa8905e['options']);return _0x5b8f70[_0xa9c5('0xab')](_0x4d7916);}})[_0xa9c5('0x20')](function(_0x47ba5a){if(_0x47ba5a){_0x3725ff=_0x47ba5a[_0xa9c5('0x4b')];if(!_0xa8905e[_0xa9c5('0x45')]['hasOwnProperty'](_0xa9c5('0x4d'))){_0x4d7916[_0xa9c5('0x2f')]=qs[_0xa9c5('0x2f')](_0xa8905e[_0xa9c5('0x45')]['limit']);_0x4d7916[_0xa9c5('0x2e')]=qs[_0xa9c5('0x2e')](_0xa8905e[_0xa9c5('0x45')][_0xa9c5('0x2e')]);}return _0x5b8f70['getApplications'](_0x4d7916);}})[_0xa9c5('0x20')](function(_0xb306d4){if(_0xb306d4){return _0xb306d4?{'count':_0x3725ff,'rows':_0xb306d4}:null;}})[_0xa9c5('0x20')](respondWithResult(_0x5e9ce9,null))[_0xa9c5('0x2a')](handleError(_0x5e9ce9,null));};exports['getInteractions']=function(_0x4ee92c,_0xec79ee,_0x5860b9){var _0x5c8e25={'raw':![],'where':{}};var _0xeea9b1={};var _0x3dd33c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa9c5('0x70')]({'where':{'id':_0x4ee92c[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0xec79ee,null))[_0xa9c5('0x20')](function(_0x2c2671){if(_0x2c2671){_0xeea9b1[_0xa9c5('0x48')]=_[_0xa9c5('0x5a')](db[_0xa9c5('0x92')]['rawAttributes']);_0xeea9b1[_0xa9c5('0x45')]=_[_0xa9c5('0x5a')](_0x4ee92c[_0xa9c5('0x45')]);_0xeea9b1[_0xa9c5('0x46')]=_['intersection'](_0xeea9b1[_0xa9c5('0x48')],_0xeea9b1[_0xa9c5('0x45')]);_0x5c8e25[_0xa9c5('0x49')]=_['intersection'](_0xeea9b1['model'],qs[_0xa9c5('0x4a')](_0x4ee92c[_0xa9c5('0x45')][_0xa9c5('0x4a')]));_0x5c8e25['attributes']=_0x5c8e25['attributes'][_0xa9c5('0x4b')]?_0x5c8e25[_0xa9c5('0x49')]:_0xeea9b1['model'];if(!_0x4ee92c[_0xa9c5('0x45')]['hasOwnProperty'](_0xa9c5('0x4d'))){_0x5c8e25[_0xa9c5('0x2f')]=qs[_0xa9c5('0x2f')](_0x4ee92c[_0xa9c5('0x45')][_0xa9c5('0x2f')]);_0x5c8e25[_0xa9c5('0x2e')]=qs[_0xa9c5('0x2e')](_0x4ee92c[_0xa9c5('0x45')][_0xa9c5('0x2e')]);}_0x5c8e25[_0xa9c5('0x4e')]=qs[_0xa9c5('0x4f')](_0x4ee92c['query'][_0xa9c5('0x4f')]);_0x5c8e25[_0xa9c5('0x50')]=qs[_0xa9c5('0x46')](_[_0xa9c5('0x6a')](_0x4ee92c[_0xa9c5('0x45')],_0xeea9b1[_0xa9c5('0x46')]));_0x5c8e25[_0xa9c5('0x50')]['OpenchannelAccountId']=_0x2c2671['id'];if(_0x4ee92c[_0xa9c5('0x45')][_0xa9c5('0x54')]){_0x5c8e25[_0xa9c5('0x50')]=_['merge'](_0x5c8e25['where'],{'$or':_[_0xa9c5('0x40')](_0x5c8e25[_0xa9c5('0x49')],function(_0x56fbe6){var _0x2a3f43={};_0x2a3f43[_0x56fbe6]={'$like':'%'+_0x4ee92c[_0xa9c5('0x45')]['filter']+'%'};return _0x2a3f43;})});}_0x5c8e25=_[_0xa9c5('0x51')]({},_0x5c8e25,_0x4ee92c[_0xa9c5('0x55')]);return db[_0xa9c5('0x92')][_0xa9c5('0x56')]({'where':_0x5c8e25[_0xa9c5('0x50')]})[_0xa9c5('0x20')](function(_0x433fb3){_0x3dd33c[_0xa9c5('0x56')]=_0x433fb3;if(_0x4ee92c[_0xa9c5('0x45')][_0xa9c5('0x57')]){_0x5c8e25[_0xa9c5('0x58')]=[{'model':db['CmContact'],'as':_0xa9c5('0xac'),'required':![]},{'model':db['User'],'as':_0xa9c5('0xad'),'attributes':[_0xa9c5('0x3b'),_0xa9c5('0xae'),_0xa9c5('0xaf')],'required':![]},{'model':db['Tag'],'as':_0xa9c5('0xb0'),'attributes':['id',_0xa9c5('0x3b'),_0xa9c5('0xb1')],'where':_0x4ee92c[_0xa9c5('0x45')]['tag']?{'id':_0x4ee92c[_0xa9c5('0x45')][_0xa9c5('0xb2')]}:undefined,'required':_0x4ee92c[_0xa9c5('0x45')][_0xa9c5('0xb2')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xa9c5('0x6b')](_0x5c8e25);})[_0xa9c5('0x20')](function(_0x42e161){_0x3dd33c[_0xa9c5('0x71')]=_0x42e161;return _0x3dd33c;});}})[_0xa9c5('0x20')](respondWithFilteredResult(_0xec79ee,_0x5c8e25))[_0xa9c5('0x2a')](handleError(_0xec79ee,null));};exports[_0xa9c5('0xb3')]=function(_0x211248,_0x1564df,_0x250e38){return db[_0xa9c5('0x41')][_0xa9c5('0x5b')]({'where':{'id':_0x211248[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x1564df,null))[_0xa9c5('0x20')](function(_0x51640b){if(_0x51640b){return _0x51640b[_0xa9c5('0xb3')](_0x211248['body']['ids'],_[_0xa9c5('0xb4')](_0x211248[_0xa9c5('0x5d')],[_0xa9c5('0x6d'),'id'])||{})[_0xa9c5('0x94')](function(_0x236792){for(var _0x485b64=0x0;_0x485b64<_0x211248[_0xa9c5('0x5d')]['ids']['length'];_0x485b64+=0x1){socket[_0xa9c5('0xb5')](_0xa9c5('0xb6'),{'UserId':_0x211248[_0xa9c5('0x5d')][_0xa9c5('0x6d')][_0x485b64],'OpenchannelAccountId':_0x211248[_0xa9c5('0x65')]['id']});}return _0x236792;});}})[_0xa9c5('0x20')](respondWithResult(_0x1564df,null))[_0xa9c5('0x2a')](handleError(_0x1564df,null));};exports[_0xa9c5('0xb7')]=function(_0x33de33,_0x3b4879,_0x3d2909){return db[_0xa9c5('0x41')]['find']({'where':{'id':_0x33de33[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x3b4879,null))[_0xa9c5('0x20')](function(_0x2bf1b3){if(_0x2bf1b3){return _0x2bf1b3[_0xa9c5('0xb7')](_0x33de33[_0xa9c5('0x45')][_0xa9c5('0x6d')])[_0xa9c5('0x20')](function(){if(_[_0xa9c5('0xb8')](_0x33de33[_0xa9c5('0x45')]['ids'])){for(var _0x42d0c9=0x0;_0x42d0c9<_0x33de33['query'][_0xa9c5('0x6d')][_0xa9c5('0x4b')];_0x42d0c9+=0x1){socket[_0xa9c5('0xb5')](_0xa9c5('0xb9'),{'UserId':Number(_0x33de33[_0xa9c5('0x45')][_0xa9c5('0x6d')][_0x42d0c9]),'OpenchannelAccountId':Number(_0x33de33['params']['id'])});}}else{socket[_0xa9c5('0xb5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x33de33[_0xa9c5('0x45')]['ids']),'OpenchannelAccountId':Number(_0x33de33[_0xa9c5('0x65')]['id'])});}});}})[_0xa9c5('0x20')](respondWithStatusCode(_0x3b4879,null))[_0xa9c5('0x2a')](handleError(_0x3b4879,null));};exports[_0xa9c5('0xba')]=function(_0x5523d9,_0x4c48fc,_0x5e02c8){var _0x21fa3e={};var _0x4d19fe={};var _0x45fa29;var _0x197ebf;return db[_0xa9c5('0x41')][_0xa9c5('0x70')]({'where':{'id':_0x5523d9['params']['id']}})['then'](handleEntityNotFound(_0x4c48fc,null))['then'](function(_0x3cd7f2){if(_0x3cd7f2){_0x45fa29=_0x3cd7f2;_0x4d19fe['model']=_[_0xa9c5('0x5a')](db[_0xa9c5('0x9e')][_0xa9c5('0x42')]);_0x4d19fe[_0xa9c5('0x45')]=_[_0xa9c5('0x5a')](_0x5523d9[_0xa9c5('0x45')]);_0x4d19fe['filters']=_[_0xa9c5('0x47')](_0x4d19fe[_0xa9c5('0x48')],_0x4d19fe[_0xa9c5('0x45')]);_0x21fa3e[_0xa9c5('0x49')]=_['intersection'](_0x4d19fe[_0xa9c5('0x48')],qs['fields'](_0x5523d9['query'][_0xa9c5('0x4a')]));_0x21fa3e[_0xa9c5('0x49')]=_0x21fa3e['attributes'][_0xa9c5('0x4b')]?_0x21fa3e[_0xa9c5('0x49')]:_0x4d19fe['model'];_0x21fa3e[_0xa9c5('0x4e')]=qs[_0xa9c5('0x4f')](_0x5523d9[_0xa9c5('0x45')]['sort']);_0x21fa3e[_0xa9c5('0x50')]=qs[_0xa9c5('0x46')](_['pick'](_0x5523d9[_0xa9c5('0x45')],_0x4d19fe[_0xa9c5('0x46')]));if(_0x5523d9[_0xa9c5('0x45')][_0xa9c5('0x54')]){_0x21fa3e[_0xa9c5('0x50')]=_[_0xa9c5('0x51')](_0x21fa3e[_0xa9c5('0x50')],{'$or':_[_0xa9c5('0x40')](_0x21fa3e['attributes'],function(_0x4961bb){var _0x4af8bb={};_0x4af8bb[_0x4961bb]={'$like':'%'+_0x5523d9[_0xa9c5('0x45')]['filter']+'%'};return _0x4af8bb;})});}_0x21fa3e=_[_0xa9c5('0x51')]({},_0x21fa3e,_0x5523d9['options']);return _0x45fa29[_0xa9c5('0xba')](_0x21fa3e);}})[_0xa9c5('0x20')](function(_0x476138){if(_0x476138){_0x197ebf=_0x476138['length'];if(!_0x5523d9['query'][_0xa9c5('0x4c')](_0xa9c5('0x4d'))){_0x21fa3e[_0xa9c5('0x2f')]=qs[_0xa9c5('0x2f')](_0x5523d9[_0xa9c5('0x45')]['limit']);_0x21fa3e[_0xa9c5('0x2e')]=qs['offset'](_0x5523d9[_0xa9c5('0x45')][_0xa9c5('0x2e')]);}return _0x45fa29['getAgents'](_0x21fa3e);}})['then'](function(_0xe1c093){if(_0xe1c093){return _0xe1c093?{'count':_0x197ebf,'rows':_0xe1c093}:null;}})[_0xa9c5('0x20')](respondWithResult(_0x4c48fc,null))['catch'](handleError(_0x4c48fc,null));};exports[_0xa9c5('0x3c')]=function(_0x3ab4e2,_0x2a7040,_0x1bad25){var _0x4600a3,_0x3179b7,_0x336e17;if(_[_0xa9c5('0x7c')](_0x3ab4e2['body'][_0xa9c5('0x5d')])||_0x3ab4e2[_0xa9c5('0x5d')][_0xa9c5('0x5d')]===''){throw new db[(_0xa9c5('0x75'))][(_0xa9c5('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa9c5('0x7c')](_0x3ab4e2[_0xa9c5('0x5d')]['to'])){}_0x4600a3=_0x3ab4e2['body']['to'];return db[_0xa9c5('0x41')][_0xa9c5('0x70')]({'where':{'id':_0x3ab4e2[_0xa9c5('0x65')]['id']}})['then'](handleEntityNotFound(_0x2a7040,null))[_0xa9c5('0x20')](function(_0x4b0823){if(_0x4b0823){return db[_0xa9c5('0x41')][_0xa9c5('0x5b')]({'where':{'id':_0x4b0823['id']},'include':[{'model':db[_0xa9c5('0x82')],'as':_0xa9c5('0x83'),'include':[{'model':db[_0xa9c5('0x74')],'as':_0xa9c5('0x84'),'where':{[_0x4b0823[_0xa9c5('0x7f')]]:_0x4600a3},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xa9c5('0x20')](handleEntityNotFound(_0x2a7040,null))[_0xa9c5('0x20')](function(_0x2068d6){if(_0x2068d6&&_0x2068d6[_0xa9c5('0x83')]){_0x3179b7=_0x2068d6['get']({'plain':!![]});if(_0x3179b7[_0xa9c5('0x83')]&&_0x3179b7[_0xa9c5('0x83')][_0xa9c5('0x84')][_0xa9c5('0x4b')]){return _0x3179b7[_0xa9c5('0x83')]['Contacts'][0x0];}return db[_0xa9c5('0x74')][_0xa9c5('0x5c')](_[_0xa9c5('0x18')](_0x3ab4e2[_0xa9c5('0x5d')],{'firstName':_0x4600a3,[_0x2068d6[_0xa9c5('0x7f')]]:_0x4600a3,'phone':_0x4600a3,'ListId':_0x3179b7[_0xa9c5('0x8d')]}));}})['then'](handleEntityNotFound(_0x2a7040,null))['then'](function(_0xa98273){if(_0xa98273){_0x336e17=_0xa98273;return db[_0xa9c5('0x92')][_0xa9c5('0x5b')]({'where':{'ContactId':_0x336e17['id'],'closed':![],'OpenchannelAccountId':_0x3179b7['id']}})['then'](function(_0x59bea2){if(_0x59bea2){return[_0x59bea2,![]];}return db[_0xa9c5('0x92')][_0xa9c5('0x5c')]({'UserId':_0x3ab4e2[_0xa9c5('0x5e')]['id'],'ContactId':_0x336e17['id'],'OpenchannelAccountId':_0x3179b7['id'],'lastMsgDirection':_0xa9c5('0xbb'),'Messages':[_['merge'](_0x3ab4e2[_0xa9c5('0x5d')],{'read':![],'body':_0x3ab4e2['body'][_0xa9c5('0x5d')],'OpenchannelAccountId':_0x3179b7['id'],'UserId':_0x3ab4e2[_0xa9c5('0x5e')]['id'],'ContactId':_0x336e17['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xa9c5('0xbc')}]})[_0xa9c5('0x20')](function(_0x133f35){return[_0x133f35,!![]];});});}})[_0xa9c5('0x94')](function(_0x1b1cef,_0x5b87a8){if(_0x5b87a8){return _0x1b1cef;}return db[_0xa9c5('0xbd')]['create'](_['merge'](_0x3ab4e2['body'],{'read':![],'body':_0x3ab4e2[_0xa9c5('0x5d')]['body'],'OpenchannelAccountId':_0x3179b7['id'],'OpenchannelInteractionId':_0x1b1cef['id'],'UserId':_0x3ab4e2[_0xa9c5('0x5e')]['id'],'ContactId':_0x336e17['id']}))[_0xa9c5('0x20')](function(_0x379ff8){_0x1b1cef[_0xa9c5('0xbe')][_0xa9c5('0xbc')]=[];_0x1b1cef[_0xa9c5('0xbe')]['Messages'][_0xa9c5('0x99')](_0x379ff8['dataValues']);return _0x1b1cef;});});}})['then'](respondWithResult(_0x2a7040,null))[_0xa9c5('0x2a')](handleError(_0x2a7040,null));}; \ No newline at end of file +var _0xafc4=['merge','options','count','includeAll','include','findAll','rows','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','isNil','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','account','applications','list','orderBy','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','OpenchannelApplication','bulkCreate','getApplications','Owner','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','out','dataValues','Messages','push','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','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x16d4f1,_0x1df9e6){var _0x2aa7f8=function(_0xfb7630){while(--_0xfb7630){_0x16d4f1['push'](_0x16d4f1['shift']());}};_0x2aa7f8(++_0x1df9e6);}(_0xafc4,0x69));var _0x4afc=function(_0x2b76f2,_0x2c859d){_0x2b76f2=_0x2b76f2-0x0;var _0x1aa854=_0xafc4[_0x2b76f2];return _0x1aa854;};'use strict';var pdf=require(_0x4afc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4afc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4afc('0x2'));var rp=require(_0x4afc('0x3'));var moment=require(_0x4afc('0x4'));var BPromise=require(_0x4afc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4afc('0x6'));var csv=require(_0x4afc('0x7'));var ejs=require(_0x4afc('0x8'));var fs=require('fs');var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x7'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];config[_0x4afc('0x16')]=_[_0x4afc('0x17')](config[_0x4afc('0x16')],{'host':_0x4afc('0x18'),'port':0x18eb});var socket=require(_0x4afc('0x19'))(new Redis(config[_0x4afc('0x16')]));require('./openchannelAccount.socket')[_0x4afc('0x1a')](socket);var jayson=require(_0x4afc('0x1b'));var client=jayson[_0x4afc('0x1c')][_0x4afc('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2452ae,_0x4f3127,_0x23ae30,_0x24ed6d){return new BPromise(function(_0x2b928b,_0x31eec4){var _0x3a306f=_0x24ed6d||client;return _0x3a306f[_0x4afc('0x1e')](_0x2452ae,_0x23ae30)[_0x4afc('0x1f')](function(_0x3ad418){logger[_0x4afc('0x20')](_0x4afc('0x21'),_0x4f3127,_0x4afc('0x22'));logger['debug'](_0x4afc('0x23'),_0x4f3127,_0x4afc('0x22'),JSON[_0x4afc('0x24')](_0x3ad418));if(_0x3ad418[_0x4afc('0x25')]){if(_0x3ad418['error'][_0x4afc('0x26')]===0x1f4){logger[_0x4afc('0x25')](_0x4afc('0x21'),_0x4f3127,_0x3ad418[_0x4afc('0x25')][_0x4afc('0x27')]);return _0x31eec4(_0x3ad418[_0x4afc('0x25')][_0x4afc('0x27')]);}logger['error'](_0x4afc('0x21'),_0x4f3127,_0x3ad418[_0x4afc('0x25')]['message']);return _0x2b928b(_0x3ad418[_0x4afc('0x25')]['message']);}else{logger[_0x4afc('0x20')](_0x4afc('0x21'),_0x4f3127,_0x4afc('0x22'));_0x2b928b(_0x3ad418[_0x4afc('0x28')][_0x4afc('0x27')]);}})[_0x4afc('0x29')](function(_0x40a0db){logger[_0x4afc('0x25')](_0x4afc('0x21'),_0x4f3127,_0x40a0db);_0x31eec4(_0x40a0db);});});}function respondWithStatusCode(_0x100220,_0x4e8273){_0x4e8273=_0x4e8273||0xcc;return function(_0x359c07){if(_0x359c07){return _0x100220[_0x4afc('0x2a')](_0x4e8273);}return _0x100220['status'](_0x4e8273)[_0x4afc('0x2b')]();};}function respondWithResult(_0x244f6c,_0x2d6112){_0x2d6112=_0x2d6112||0xc8;return function(_0x4e254d){if(_0x4e254d){return _0x244f6c['status'](_0x2d6112)['json'](_0x4e254d);}};}function respondWithFilteredResult(_0x426e9d,_0x5db47e){return function(_0x5e4747){if(_0x5e4747){var _0xd26d2f=_0x5e4747['count'],_0x628e42=_0x5db47e[_0x4afc('0x2c')],_0x494fe7=_0x5db47e[_0x4afc('0x2c')]+_0x5db47e[_0x4afc('0x2d')],_0x514278;if(_0x494fe7>=_0xd26d2f){_0x494fe7=_0xd26d2f;_0x514278=0xc8;}else{_0x514278=0xce;}_0x426e9d[_0x4afc('0x2e')](_0x514278);return _0x426e9d[_0x4afc('0x2f')](_0x4afc('0x30'),_0x628e42+'-'+_0x494fe7+'/'+_0xd26d2f)['json'](_0x5e4747);}return null;};}function patchUpdates(_0x290391){return function(_0x3d1693){try{jsonpatch[_0x4afc('0x31')](_0x3d1693,_0x290391,!![]);}catch(_0x2f178c){return BPromise[_0x4afc('0x32')](_0x2f178c);}return _0x3d1693[_0x4afc('0x33')]();};}function saveUpdates(_0xbabe1e,_0x406789){return function(_0x5ac7a8){if(_0x5ac7a8){return _0x5ac7a8[_0x4afc('0x34')](_0xbabe1e)['then'](function(_0x539b61){return _0x539b61;});}return null;};}function removeEntity(_0x324a12,_0x33ebbc){return function(_0x266f7f){if(_0x266f7f){return _0x266f7f[_0x4afc('0x35')]()[_0x4afc('0x1f')](function(){var _0x3f50cc=_0x266f7f['get']({'plain':!![]});var _0x380f9f=_0x4afc('0x36');return db[_0x4afc('0x37')][_0x4afc('0x35')]({'where':{'type':_0x380f9f,'resourceId':_0x3f50cc['id']}})[_0x4afc('0x1f')](function(){return _0x266f7f;});})[_0x4afc('0x1f')](function(){_0x324a12['status'](0xcc)[_0x4afc('0x2b')]();});}};}function handleEntityNotFound(_0x2ddce1,_0x91565d){return function(_0x283bc2){if(!_0x283bc2){_0x2ddce1['sendStatus'](0x194);}return _0x283bc2;};}function handleError(_0x4be1e6,_0x43c341){_0x43c341=_0x43c341||0x1f4;return function(_0x22bd75){logger[_0x4afc('0x25')](_0x22bd75['stack']);if(_0x22bd75['name']){delete _0x22bd75[_0x4afc('0x38')];}_0x4be1e6['status'](_0x43c341)['send'](_0x22bd75);};}exports[_0x4afc('0x39')]=function(_0x1dc853,_0x2be40e){var _0x3e41f5={'include':[{'model':db[_0x4afc('0x3a')],'as':_0x4afc('0x3b')}]},_0x395bc6={},_0x4420fb={'count':0x0,'rows':[]};var _0x3ccc5a=_[_0x4afc('0x3c')](db[_0x4afc('0x3d')][_0x4afc('0x3e')],function(_0x15c6cb){return{'name':_0x15c6cb[_0x4afc('0x3f')],'type':_0x15c6cb[_0x4afc('0x40')]['key']};});_0x395bc6[_0x4afc('0x41')]=_[_0x4afc('0x3c')](_0x3ccc5a,_0x4afc('0x38'));_0x395bc6[_0x4afc('0x42')]=_[_0x4afc('0x43')](_0x1dc853[_0x4afc('0x42')]);_0x395bc6[_0x4afc('0x44')]=_['intersection'](_0x395bc6['model'],_0x395bc6['query']);_0x3e41f5[_0x4afc('0x45')]=_[_0x4afc('0x46')](_0x395bc6['model'],qs[_0x4afc('0x47')](_0x1dc853[_0x4afc('0x42')][_0x4afc('0x47')]));_0x3e41f5[_0x4afc('0x45')]=_0x3e41f5['attributes'][_0x4afc('0x48')]?_0x3e41f5[_0x4afc('0x45')]:_0x395bc6[_0x4afc('0x41')];if(!_0x1dc853[_0x4afc('0x42')][_0x4afc('0x49')](_0x4afc('0x4a'))){_0x3e41f5['limit']=qs[_0x4afc('0x2d')](_0x1dc853['query'][_0x4afc('0x2d')]);_0x3e41f5[_0x4afc('0x2c')]=qs[_0x4afc('0x2c')](_0x1dc853['query']['offset']);}_0x3e41f5[_0x4afc('0x4b')]=qs[_0x4afc('0x4c')](_0x1dc853[_0x4afc('0x42')][_0x4afc('0x4c')]);_0x3e41f5[_0x4afc('0x4d')]=qs[_0x4afc('0x44')](_[_0x4afc('0x4e')](_0x1dc853[_0x4afc('0x42')],_0x395bc6['filters']),_0x3ccc5a);if(_0x1dc853[_0x4afc('0x42')][_0x4afc('0x4f')]){_0x3e41f5['where']=_[_0x4afc('0x50')](_0x3e41f5['where'],{'$or':_[_0x4afc('0x3c')](_0x3ccc5a,function(_0x24a731){if(_0x24a731[_0x4afc('0x40')]!=='VIRTUAL'){var _0xd0f517={};_0xd0f517[_0x24a731[_0x4afc('0x38')]]={'$like':'%'+_0x1dc853[_0x4afc('0x42')][_0x4afc('0x4f')]+'%'};return _0xd0f517;}})});}_0x3e41f5=_[_0x4afc('0x50')]({},_0x3e41f5,_0x1dc853[_0x4afc('0x51')]);var _0x5d9d90={'where':_0x3e41f5['where']};return db['OpenchannelAccount'][_0x4afc('0x52')](_0x5d9d90)[_0x4afc('0x1f')](function(_0x42e274){_0x4420fb[_0x4afc('0x52')]=_0x42e274;if(_0x1dc853[_0x4afc('0x42')][_0x4afc('0x53')]){_0x3e41f5[_0x4afc('0x54')]=[{'all':!![]}];}return db[_0x4afc('0x3d')][_0x4afc('0x55')](_0x3e41f5);})[_0x4afc('0x1f')](function(_0x48dbe3){_0x4420fb[_0x4afc('0x56')]=_0x48dbe3;return _0x4420fb;})['then'](respondWithFilteredResult(_0x2be40e,_0x3e41f5))['catch'](handleError(_0x2be40e,null));};exports[_0x4afc('0x57')]=function(_0x5c7606,_0x428d78){var _0x355198={'raw':![],'where':{'id':_0x5c7606[_0x4afc('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x4afc('0x3b')}]},_0x2fe2ae={};_0x2fe2ae['model']=_[_0x4afc('0x43')](db[_0x4afc('0x3d')][_0x4afc('0x3e')]);_0x2fe2ae[_0x4afc('0x42')]=_[_0x4afc('0x43')](_0x5c7606[_0x4afc('0x42')]);_0x2fe2ae[_0x4afc('0x44')]=_[_0x4afc('0x46')](_0x2fe2ae[_0x4afc('0x41')],_0x2fe2ae[_0x4afc('0x42')]);_0x355198[_0x4afc('0x45')]=_[_0x4afc('0x46')](_0x2fe2ae['model'],qs[_0x4afc('0x47')](_0x5c7606[_0x4afc('0x42')][_0x4afc('0x47')]));_0x355198[_0x4afc('0x45')]=_0x355198[_0x4afc('0x45')][_0x4afc('0x48')]?_0x355198[_0x4afc('0x45')]:_0x2fe2ae[_0x4afc('0x41')];if(_0x5c7606[_0x4afc('0x42')][_0x4afc('0x53')]){_0x355198[_0x4afc('0x54')]=[{'all':!![]}];}_0x355198=_[_0x4afc('0x50')]({},_0x355198,_0x5c7606[_0x4afc('0x51')]);return db['OpenchannelAccount'][_0x4afc('0x59')](_0x355198)['then'](handleEntityNotFound(_0x428d78,null))[_0x4afc('0x1f')](respondWithResult(_0x428d78,null))[_0x4afc('0x29')](handleError(_0x428d78,null));};exports[_0x4afc('0x5a')]=function(_0x2d9f3d,_0x518d6f){return db['OpenchannelAccount'][_0x4afc('0x5a')](_0x2d9f3d[_0x4afc('0x5b')],{})['then'](function(_0x40021e){var _0x3af52c=_0x2d9f3d[_0x4afc('0x5c')][_0x4afc('0x5d')]({'plain':!![]});if(!_0x3af52c)throw new Error(_0x4afc('0x5e'));if(_0x3af52c[_0x4afc('0x5f')]===_0x4afc('0x5c')){var _0x13891d=_0x40021e[_0x4afc('0x5d')]({'plain':!![]});var _0x3369a8=_0x4afc('0x36');return db[_0x4afc('0x60')][_0x4afc('0x59')]({'where':{'name':_0x3369a8,'userProfileId':_0x3af52c[_0x4afc('0x61')]},'raw':!![]})['then'](function(_0x42c65e){if(_0x42c65e&&_0x42c65e[_0x4afc('0x62')]===0x0){return db[_0x4afc('0x37')][_0x4afc('0x5a')]({'name':_0x13891d[_0x4afc('0x38')],'resourceId':_0x13891d['id'],'type':_0x42c65e[_0x4afc('0x38')],'sectionId':_0x42c65e['id']},{})[_0x4afc('0x1f')](function(){return _0x40021e;});}else{return _0x40021e;}})['catch'](function(_0x1771e8){logger[_0x4afc('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1771e8);throw _0x1771e8;});}return _0x40021e;})['then'](respondWithResult(_0x518d6f,0xc9))[_0x4afc('0x29')](handleError(_0x518d6f,null));};exports[_0x4afc('0x34')]=function(_0x2d7066,_0x389040){if(_0x2d7066[_0x4afc('0x5b')]['id']){delete _0x2d7066[_0x4afc('0x5b')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x59')]({'where':{'id':_0x2d7066[_0x4afc('0x58')]['id']},'include':[{'model':db[_0x4afc('0x3a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x389040,null))[_0x4afc('0x1f')](saveUpdates(_0x2d7066[_0x4afc('0x5b')],null))['then'](respondWithResult(_0x389040,null))[_0x4afc('0x29')](handleError(_0x389040,null));};exports[_0x4afc('0x35')]=function(_0x5be1a7,_0x56573a){return db[_0x4afc('0x3d')][_0x4afc('0x59')]({'where':{'id':_0x5be1a7[_0x4afc('0x58')]['id']}})['then'](handleEntityNotFound(_0x56573a,null))[_0x4afc('0x1f')](removeEntity(_0x56573a,null))['catch'](handleError(_0x56573a,null));};exports['describe']=function(_0x10e5c6,_0x37b5aa){return db[_0x4afc('0x3d')][_0x4afc('0x63')]()[_0x4afc('0x1f')](respondWithResult(_0x37b5aa,null))[_0x4afc('0x29')](handleError(_0x37b5aa,null));};exports[_0x4afc('0x64')]=function(_0xe05d53,_0x3d1825,_0x4a616e){if(_0xe05d53[_0x4afc('0x5b')]['id']){delete _0xe05d53[_0x4afc('0x5b')]['id'];}return db[_0x4afc('0x3d')]['find']({'where':{'id':_0xe05d53['params']['id']}})['then'](handleEntityNotFound(_0x3d1825,null))[_0x4afc('0x1f')](function(_0x135931){if(_0x135931){_0xe05d53[_0x4afc('0x5b')]['OpenchannelAccountId']=_0x135931['id'];return db[_0x4afc('0x65')]['create'](_0xe05d53['body']);}})['then'](respondWithResult(_0x3d1825,null))[_0x4afc('0x29')](handleError(_0x3d1825,null));};exports[_0x4afc('0x66')]=function(_0x315fc3,_0x4e0fb6,_0x1e56b7){var _0x45cfea={'raw':![],'where':{}};var _0x18ab12={};var _0x5e3e9b={'count':0x0,'rows':[]};return db[_0x4afc('0x3d')][_0x4afc('0x67')]({'where':{'id':_0x315fc3[_0x4afc('0x58')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x4e0fb6,null))[_0x4afc('0x1f')](function(_0x481263){if(_0x481263){_0x18ab12['model']=_[_0x4afc('0x43')](db[_0x4afc('0x65')][_0x4afc('0x3e')]);_0x18ab12['query']=_[_0x4afc('0x43')](_0x315fc3[_0x4afc('0x42')]);_0x18ab12[_0x4afc('0x44')]=_[_0x4afc('0x46')](_0x18ab12[_0x4afc('0x41')],_0x18ab12['query']);_0x45cfea[_0x4afc('0x45')]=_[_0x4afc('0x46')](_0x18ab12['model'],qs[_0x4afc('0x47')](_0x315fc3[_0x4afc('0x42')][_0x4afc('0x47')]));_0x45cfea['attributes']=_0x45cfea[_0x4afc('0x45')][_0x4afc('0x48')]?_0x45cfea[_0x4afc('0x45')]:_0x18ab12[_0x4afc('0x41')];if(!_0x315fc3[_0x4afc('0x42')][_0x4afc('0x49')](_0x4afc('0x4a'))){_0x45cfea[_0x4afc('0x2d')]=qs['limit'](_0x315fc3[_0x4afc('0x42')]['limit']);_0x45cfea['offset']=qs[_0x4afc('0x2c')](_0x315fc3[_0x4afc('0x42')][_0x4afc('0x2c')]);}_0x45cfea['order']=qs['sort'](_0x315fc3[_0x4afc('0x42')][_0x4afc('0x4c')]);_0x45cfea[_0x4afc('0x4d')]=qs[_0x4afc('0x44')](_[_0x4afc('0x4e')](_0x315fc3[_0x4afc('0x42')],_0x18ab12[_0x4afc('0x44')]));_0x45cfea[_0x4afc('0x4d')][_0x4afc('0x68')]=_0x481263['id'];if(_0x315fc3[_0x4afc('0x42')][_0x4afc('0x4f')]){_0x45cfea[_0x4afc('0x4d')]=_[_0x4afc('0x50')](_0x45cfea[_0x4afc('0x4d')],{'$or':_[_0x4afc('0x3c')](_0x45cfea[_0x4afc('0x45')],function(_0x4f8b24){var _0x2d7d36={};_0x2d7d36[_0x4f8b24]={'$like':'%'+_0x315fc3[_0x4afc('0x42')][_0x4afc('0x4f')]+'%'};return _0x2d7d36;})});}_0x45cfea=_[_0x4afc('0x50')]({},_0x45cfea,_0x315fc3[_0x4afc('0x51')]);return db[_0x4afc('0x65')][_0x4afc('0x52')]({'where':_0x45cfea[_0x4afc('0x4d')]})[_0x4afc('0x1f')](function(_0x4d3da7){_0x5e3e9b[_0x4afc('0x52')]=_0x4d3da7;if(_0x315fc3[_0x4afc('0x42')][_0x4afc('0x53')]){_0x45cfea[_0x4afc('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x4afc('0x55')](_0x45cfea);})[_0x4afc('0x1f')](function(_0x4ce81a){_0x5e3e9b[_0x4afc('0x56')]=_0x4ce81a;return _0x5e3e9b;});}})[_0x4afc('0x1f')](respondWithFilteredResult(_0x4e0fb6,_0x45cfea))[_0x4afc('0x29')](handleError(_0x4e0fb6,null));};exports[_0x4afc('0x69')]=function(_0xf9b232,_0x253d25,_0x2b20ad){return db['OpenchannelAccount'][_0x4afc('0x59')]({'where':{'id':_0xf9b232[_0x4afc('0x58')]['id']}})['then'](handleEntityNotFound(_0x253d25,null))[_0x4afc('0x1f')](function(_0x41a3a9){if(_0x41a3a9){return _0x41a3a9[_0x4afc('0x69')](_0xf9b232['query'][_0x4afc('0x6a')]);}})[_0x4afc('0x1f')](respondWithStatusCode(_0x253d25,null))[_0x4afc('0x29')](handleError(_0x253d25,null));};exports[_0x4afc('0x6b')]=function(_0x4a6f77,_0x1bbe21,_0x29297c){if(_0x4a6f77['body']['id']){delete _0x4a6f77[_0x4afc('0x5b')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x59')]({'where':{'id':_0x4a6f77['params']['id']}})['then'](handleEntityNotFound(_0x1bbe21,null))[_0x4afc('0x1f')](function(_0x41116b){if(_0x41116b){_0x4a6f77[_0x4afc('0x5b')][_0x4afc('0x68')]=_0x41116b['id'];return db[_0x4afc('0x6c')][_0x4afc('0x5a')](_0x4a6f77[_0x4afc('0x5b')]);}})[_0x4afc('0x1f')](respondWithResult(_0x1bbe21,null))[_0x4afc('0x29')](handleError(_0x1bbe21,null));};exports[_0x4afc('0x6d')]=function(_0x32a7a3,_0x6d81f2,_0x2775ec){var _0x257d02={'raw':![],'where':{}};var _0x23a491={};var _0x143340={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x4afc('0x67')]({'where':{'id':_0x32a7a3[_0x4afc('0x58')]['id']}})['then'](handleEntityNotFound(_0x6d81f2,null))[_0x4afc('0x1f')](function(_0x4d92e6){if(_0x4d92e6){_0x23a491['model']=_[_0x4afc('0x43')](db['CannedAnswer']['rawAttributes']);_0x23a491[_0x4afc('0x42')]=_['keys'](_0x32a7a3[_0x4afc('0x42')]);_0x23a491['filters']=_[_0x4afc('0x46')](_0x23a491[_0x4afc('0x41')],_0x23a491[_0x4afc('0x42')]);_0x257d02[_0x4afc('0x45')]=_[_0x4afc('0x46')](_0x23a491['model'],qs[_0x4afc('0x47')](_0x32a7a3[_0x4afc('0x42')]['fields']));_0x257d02['attributes']=_0x257d02[_0x4afc('0x45')][_0x4afc('0x48')]?_0x257d02[_0x4afc('0x45')]:_0x23a491[_0x4afc('0x41')];if(!_0x32a7a3[_0x4afc('0x42')]['hasOwnProperty'](_0x4afc('0x4a'))){_0x257d02[_0x4afc('0x2d')]=qs[_0x4afc('0x2d')](_0x32a7a3[_0x4afc('0x42')]['limit']);_0x257d02[_0x4afc('0x2c')]=qs['offset'](_0x32a7a3[_0x4afc('0x42')][_0x4afc('0x2c')]);}_0x257d02[_0x4afc('0x4b')]=qs[_0x4afc('0x4c')](_0x32a7a3[_0x4afc('0x42')][_0x4afc('0x4c')]);_0x257d02[_0x4afc('0x4d')]=qs[_0x4afc('0x44')](_[_0x4afc('0x4e')](_0x32a7a3[_0x4afc('0x42')],_0x23a491[_0x4afc('0x44')]));_0x257d02['where'][_0x4afc('0x68')]=_0x4d92e6['id'];if(_0x32a7a3['query'][_0x4afc('0x4f')]){_0x257d02['where']=_['merge'](_0x257d02[_0x4afc('0x4d')],{'$or':_['map'](_0x257d02['attributes'],function(_0x360d43){var _0x489c9d={};_0x489c9d[_0x360d43]={'$like':'%'+_0x32a7a3[_0x4afc('0x42')][_0x4afc('0x4f')]+'%'};return _0x489c9d;})});}_0x257d02=_['merge']({},_0x257d02,_0x32a7a3[_0x4afc('0x51')]);return db[_0x4afc('0x6c')]['count']({'where':_0x257d02[_0x4afc('0x4d')]})[_0x4afc('0x1f')](function(_0x3ec068){_0x143340['count']=_0x3ec068;if(_0x32a7a3[_0x4afc('0x42')][_0x4afc('0x53')]){_0x257d02[_0x4afc('0x54')]=[{'all':!![]}];}return db[_0x4afc('0x6c')][_0x4afc('0x55')](_0x257d02);})[_0x4afc('0x1f')](function(_0x5cc914){_0x143340['rows']=_0x5cc914;return _0x143340;});}})[_0x4afc('0x1f')](respondWithFilteredResult(_0x6d81f2,_0x257d02))[_0x4afc('0x29')](handleError(_0x6d81f2,null));};exports['removeAnswers']=function(_0x28381d,_0x2ff7a1,_0x4f2536){return db[_0x4afc('0x3d')][_0x4afc('0x59')]({'where':{'id':_0x28381d[_0x4afc('0x58')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x2ff7a1,null))[_0x4afc('0x1f')](function(_0x4b1bbc){if(_0x4b1bbc){return _0x4b1bbc[_0x4afc('0x6e')](_0x28381d[_0x4afc('0x42')][_0x4afc('0x6a')]);}})[_0x4afc('0x1f')](respondWithStatusCode(_0x2ff7a1,null))[_0x4afc('0x29')](handleError(_0x2ff7a1,null));};exports['notify']=function(_0x793480,_0x37f9ea,_0x31b518){var _0x57a878={'body':_0x793480[_0x4afc('0x5b')],'channel':_0x4afc('0x6f')};var _0x5bcfa7=[];var _0x530119=[];var _0x4c27a2={};var _0x1119a9=![];return db[_0x4afc('0x70')]['describe']()[_0x4afc('0x1f')](function(_0x46fe46){if(!_0x46fe46){throw new db['Sequelize'][(_0x4afc('0x71'))](_0x4afc('0x72'));}_0x5bcfa7=_[_0x4afc('0x73')](_[_0x4afc('0x43')](_0x46fe46),[_0x4afc('0x74'),_0x4afc('0x75')]);_0x530119=_[_0x4afc('0x73')](_[_0x4afc('0x43')](_0x46fe46),[_0x4afc('0x74'),'updatedAt',_0x4afc('0x76'),_0x4afc('0x77')]);if(_0x793480[_0x4afc('0x5b')]['id']){delete _0x793480[_0x4afc('0x5b')]['id'];}if(_['isNil'](_0x793480[_0x4afc('0x5b')][_0x4afc('0x78')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x4afc('0x79')](_0x793480[_0x4afc('0x5b')][_0x4afc('0x5b')])||_0x793480['body'][_0x4afc('0x5b')]===''){throw new db[(_0x4afc('0x7a'))][(_0x4afc('0x71'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4afc('0x79')](_0x793480['body']['mapKey'])){throw new db[(_0x4afc('0x7a'))][(_0x4afc('0x71'))](_0x4afc('0x7b')+_0x530119);}if(!_['includes'](_0x530119,_0x793480[_0x4afc('0x5b')][_0x4afc('0x7c')])){throw new db[(_0x4afc('0x7a'))][(_0x4afc('0x71'))](_0x4afc('0x7d')+_0x530119);}_0x4c27a2[_0x793480[_0x4afc('0x5b')][_0x4afc('0x7c')]]=_0x793480[_0x4afc('0x5b')][_0x4afc('0x78')];})['then'](function(){return db['OpenchannelAccount'][_0x4afc('0x59')]({'where':{'id':_0x793480[_0x4afc('0x58')]['id']},'include':[{'model':db[_0x4afc('0x7e')],'as':_0x4afc('0x7f'),'include':[{'model':db['CmContact'],'as':_0x4afc('0x80'),'where':_0x4c27a2,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x4afc('0x81')}]});})[_0x4afc('0x1f')](handleEntityNotFound(_0x37f9ea,null))[_0x4afc('0x1f')](function(_0x3e26e9){if(_0x3e26e9&&_0x3e26e9[_0x4afc('0x7f')]){_0x57a878[_0x4afc('0x82')]=_0x3e26e9;_0x57a878[_0x4afc('0x83')]=_0x3e26e9[_0x4afc('0x81')];_0x57a878[_0x4afc('0x84')]=_0x3e26e9[_0x4afc('0x7f')];_0x57a878[_0x4afc('0x83')]=_[_0x4afc('0x85')](_0x57a878[_0x4afc('0x83')],['priority'],[_0x4afc('0x86')]);if(_0x57a878[_0x4afc('0x82')][_0x4afc('0x81')]){delete _0x57a878[_0x4afc('0x82')]['Applications'];}if(_0x57a878[_0x4afc('0x82')][_0x4afc('0x7f')]&&_0x57a878['account'][_0x4afc('0x7f')][_0x4afc('0x80')][_0x4afc('0x48')]){return _0x57a878[_0x4afc('0x82')]['List'][_0x4afc('0x80')][0x0];}var _0x12aadc=_[_0x4afc('0x17')](_0x793480['body'],{'firstName':_0x793480[_0x4afc('0x5b')][_0x4afc('0x78')],'ListId':_0x3e26e9['ListId']});_0x12aadc[_0x793480[_0x4afc('0x5b')]['mapKey']]=_0x793480[_0x4afc('0x5b')][_0x4afc('0x78')];return db[_0x4afc('0x70')][_0x4afc('0x5a')](_0x12aadc,{'fields':_0x5bcfa7,'raw':!![]});}})[_0x4afc('0x1f')](handleEntityNotFound(_0x37f9ea,null))[_0x4afc('0x1f')](function(_0x3aff77){_0x57a878[_0x4afc('0x87')]=_0x3aff77;if(_0x3aff77){var _0x518a6f={'ContactId':_0x3aff77['id'],'OpenchannelAccountId':_0x793480['params']['id'],'from':(_0x3aff77[_0x4afc('0x88')]||'')+'\x20'+(_0x3aff77[_0x4afc('0x89')]||'')};var _0x434314={'OpenchannelAccountId':_0x793480['params']['id'],'closed':![]};if(_0x793480[_0x4afc('0x5b')][_0x4afc('0x8a')]){_0x434314['threadId']=_0x793480[_0x4afc('0x5b')][_0x4afc('0x8a')];return db[_0x4afc('0x8b')]['find']({'where':_0x434314})[_0x4afc('0x1f')](function(_0x43a30c){if(_0x43a30c){return[_0x43a30c,![]];}_0x518a6f[_0x4afc('0x8a')]=_0x793480['body'][_0x4afc('0x8a')];_0x518a6f[_0x4afc('0x8c')]=_0x793480[_0x4afc('0x5b')][_0x4afc('0x8c')];return db[_0x4afc('0x8b')][_0x4afc('0x5a')](_0x518a6f)[_0x4afc('0x1f')](function(_0x2e1881){return[_0x2e1881,!![]];});});}else{_0x434314[_0x4afc('0x8a')]=null;}_0x434314['ContactId']=_0x3aff77['id'];return db[_0x4afc('0x8b')][_0x4afc('0x59')]({'where':_0x434314})[_0x4afc('0x1f')](function(_0x4ee2aa){if(_0x4ee2aa){return[_0x4ee2aa,![]];}return db['OpenchannelInteraction'][_0x4afc('0x5a')](_0x518a6f)[_0x4afc('0x1f')](function(_0x2ddf9f){return[_0x2ddf9f,!![]];});});}})[_0x4afc('0x8d')](function(_0xc8fba2,_0x4118f3){if(_0xc8fba2){_0x1119a9=_0x4118f3;if(!_0x4118f3){var _0x1ef0de={'from':(_0x57a878[_0x4afc('0x87')][_0x4afc('0x88')]||'')+'\x20'+(_0x57a878['contact'][_0x4afc('0x89')]||'')};if(_0x793480[_0x4afc('0x5b')][_0x4afc('0x8a')]&&_0x793480['body'][_0x4afc('0x8e')]&&_0x793480[_0x4afc('0x5b')][_0x4afc('0x8a')]!=_0x793480['body'][_0x4afc('0x8e')]){_0x1ef0de[_0x4afc('0x8a')]=_0x793480[_0x4afc('0x5b')][_0x4afc('0x8e')];}return _0xc8fba2[_0x4afc('0x34')](_0x1ef0de);}else{return _0xc8fba2;}}})[_0x4afc('0x1f')](function(_0x4b9745){_0x57a878[_0x4afc('0x8f')]=_0x4b9745['get']({'plain':!![]});_0x57a878['interaction'][_0x4afc('0x90')]=_0x1119a9;if(_0x57a878['interaction'][_0x4afc('0x90')]){if(_0x57a878[_0x4afc('0x82')][_0x4afc('0x91')]){_0x57a878[_0x4afc('0x83')]['push']({'id':0x0,'priority':_0x57a878[_0x4afc('0x83')]['length']+0x1,'app':_0x4afc('0x92'),'appdata':_0x4afc('0x93'),'interval':'*,*,*,*'});}}return db[_0x4afc('0x94')][_0x4afc('0x5a')]({'body':_0x793480[_0x4afc('0x5b')][_0x4afc('0x5b')],'OpenchannelAccountId':_0x793480['params']['id'],'OpenchannelInteractionId':_0x4b9745['id'],'direction':'in','ContactId':_0x57a878[_0x4afc('0x87')]['id'],'AttachmentId':_0x793480['body'][_0x4afc('0x95')]});})[_0x4afc('0x1f')](function(_0x4c8632){_0x57a878[_0x4afc('0x27')]=_0x4c8632;if(_0x57a878[_0x4afc('0x8f')][_0x4afc('0x96')]){return db[_0x4afc('0x97')]['find']({'attributes':['id',_0x4afc('0x38')],'where':{'id':_0x57a878['interaction'][_0x4afc('0x96')]}})[_0x4afc('0x1f')](function(_0x3377c5){if(_0x3377c5){_0x57a878[_0x4afc('0x83')][_0x4afc('0x98')]({'id':0x0,'priority':0x0,'app':_0x4afc('0x99'),'appdata':_0x3377c5['name']+','+(_0x57a878['account'][_0x4afc('0x9a')]||0xa),'interval':_0x4afc('0x9b')});_0x57a878[_0x4afc('0x9c')]=![];}return respondWithRpcPromise(_0x4afc('0x9d'),_0x4afc('0x9e'),_0x57a878);});}return respondWithRpcPromise(_0x4afc('0x9d'),'startRouting',_0x57a878);})[_0x4afc('0x1f')](function(_0x17771b){respondWithRpcPromise(_0x4afc('0x9f'),_0x4afc('0x9f'),{'event':_0x4afc('0xa0'),'message':_0x17771b},client9002);return _0x17771b;})['then'](respondWithResult(_0x37f9ea,null))[_0x4afc('0x29')](handleError(_0x37f9ea,null));};exports[_0x4afc('0xa1')]=function(_0x2e2f0a,_0x54cbfa,_0x17443e){return db[_0x4afc('0x3d')][_0x4afc('0x67')]({'where':{'id':_0x2e2f0a[_0x4afc('0x58')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x54cbfa,null))[_0x4afc('0x1f')](function(_0x164b69){if(_0x164b69){return db[_0x4afc('0xa2')]['transaction'](function(_0x20ba44){return db[_0x4afc('0xa3')][_0x4afc('0x35')]({'where':{'OpenchannelAccountId':_0x2e2f0a[_0x4afc('0x58')]['id']},'transaction':_0x20ba44})[_0x4afc('0x1f')](function(_0xc36399){var _0x23a727=_['map'](_0x2e2f0a[_0x4afc('0x5b')],function(_0x45e4f4){_0x45e4f4[_0x4afc('0x68')]=_0x2e2f0a[_0x4afc('0x58')]['id'];return _0x45e4f4;});return db[_0x4afc('0xa3')][_0x4afc('0xa4')](_0x23a727,{'transaction':_0x20ba44});});})[_0x4afc('0x1f')](function(){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x2e2f0a[_0x4afc('0x58')]['id']},'order':'priority'});});}})[_0x4afc('0x1f')](respondWithResult(_0x54cbfa,null))[_0x4afc('0x29')](handleError(_0x54cbfa,null));};exports[_0x4afc('0xa5')]=function(_0x51dd4d,_0x75a628,_0x1ea1cb){var _0x1033a8={};var _0x31757b={};var _0x4a62e1;var _0x481418;return db[_0x4afc('0x3d')][_0x4afc('0x67')]({'where':{'id':_0x51dd4d[_0x4afc('0x58')]['id']}})['then'](handleEntityNotFound(_0x75a628,null))[_0x4afc('0x1f')](function(_0x48830a){if(_0x48830a){_0x4a62e1=_0x48830a;_0x31757b[_0x4afc('0x41')]=_['keys'](db[_0x4afc('0xa3')]['rawAttributes']);_0x31757b[_0x4afc('0x42')]=_['keys'](_0x51dd4d[_0x4afc('0x42')]);_0x31757b[_0x4afc('0x44')]=_[_0x4afc('0x46')](_0x31757b['model'],_0x31757b[_0x4afc('0x42')]);_0x1033a8['attributes']=_[_0x4afc('0x46')](_0x31757b['model'],qs[_0x4afc('0x47')](_0x51dd4d[_0x4afc('0x42')]['fields']));_0x1033a8[_0x4afc('0x45')]=_0x1033a8['attributes']['length']?_0x1033a8[_0x4afc('0x45')]:_0x31757b[_0x4afc('0x41')];_0x1033a8[_0x4afc('0x4b')]=qs[_0x4afc('0x4c')](_0x51dd4d[_0x4afc('0x42')][_0x4afc('0x4c')]);_0x1033a8[_0x4afc('0x4d')]=qs[_0x4afc('0x44')](_[_0x4afc('0x4e')](_0x51dd4d['query'],_0x31757b[_0x4afc('0x44')]));if(_0x51dd4d[_0x4afc('0x42')][_0x4afc('0x4f')]){_0x1033a8[_0x4afc('0x4d')]=_[_0x4afc('0x50')](_0x1033a8['where'],{'$or':_[_0x4afc('0x3c')](_0x1033a8['attributes'],function(_0x399644){var _0x14c79c={};_0x14c79c[_0x399644]={'$like':'%'+_0x51dd4d['query'][_0x4afc('0x4f')]+'%'};return _0x14c79c;})});}_0x1033a8=_[_0x4afc('0x50')]({},_0x1033a8,_0x51dd4d['options']);return _0x4a62e1[_0x4afc('0xa5')](_0x1033a8);}})[_0x4afc('0x1f')](function(_0xffddad){if(_0xffddad){_0x481418=_0xffddad['length'];if(!_0x51dd4d['query'][_0x4afc('0x49')](_0x4afc('0x4a'))){_0x1033a8[_0x4afc('0x2d')]=qs[_0x4afc('0x2d')](_0x51dd4d[_0x4afc('0x42')][_0x4afc('0x2d')]);_0x1033a8[_0x4afc('0x2c')]=qs['offset'](_0x51dd4d[_0x4afc('0x42')][_0x4afc('0x2c')]);}return _0x4a62e1[_0x4afc('0xa5')](_0x1033a8);}})[_0x4afc('0x1f')](function(_0x1a3f6a){if(_0x1a3f6a){return _0x1a3f6a?{'count':_0x481418,'rows':_0x1a3f6a}:null;}})[_0x4afc('0x1f')](respondWithResult(_0x75a628,null))[_0x4afc('0x29')](handleError(_0x75a628,null));};exports['getInteractions']=function(_0xc0ff4e,_0x5a492d,_0x2177a3){var _0x21a41f={'raw':![],'where':{}};var _0xbe1818={};var _0x354f3a={'count':0x0,'rows':[]};return db[_0x4afc('0x3d')]['findOne']({'where':{'id':_0xc0ff4e['params']['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x5a492d,null))['then'](function(_0x5d8cb3){if(_0x5d8cb3){_0xbe1818[_0x4afc('0x41')]=_[_0x4afc('0x43')](db['OpenchannelInteraction'][_0x4afc('0x3e')]);_0xbe1818[_0x4afc('0x42')]=_['keys'](_0xc0ff4e[_0x4afc('0x42')]);_0xbe1818[_0x4afc('0x44')]=_[_0x4afc('0x46')](_0xbe1818[_0x4afc('0x41')],_0xbe1818[_0x4afc('0x42')]);_0x21a41f['attributes']=_['intersection'](_0xbe1818[_0x4afc('0x41')],qs[_0x4afc('0x47')](_0xc0ff4e[_0x4afc('0x42')]['fields']));_0x21a41f['attributes']=_0x21a41f['attributes']['length']?_0x21a41f[_0x4afc('0x45')]:_0xbe1818[_0x4afc('0x41')];if(!_0xc0ff4e[_0x4afc('0x42')][_0x4afc('0x49')]('nolimit')){_0x21a41f[_0x4afc('0x2d')]=qs[_0x4afc('0x2d')](_0xc0ff4e[_0x4afc('0x42')][_0x4afc('0x2d')]);_0x21a41f['offset']=qs[_0x4afc('0x2c')](_0xc0ff4e[_0x4afc('0x42')][_0x4afc('0x2c')]);}_0x21a41f[_0x4afc('0x4b')]=qs[_0x4afc('0x4c')](_0xc0ff4e[_0x4afc('0x42')]['sort']);_0x21a41f[_0x4afc('0x4d')]=qs[_0x4afc('0x44')](_['pick'](_0xc0ff4e[_0x4afc('0x42')],_0xbe1818['filters']));_0x21a41f['where'][_0x4afc('0x68')]=_0x5d8cb3['id'];if(_0xc0ff4e[_0x4afc('0x42')][_0x4afc('0x4f')]){_0x21a41f[_0x4afc('0x4d')]=_[_0x4afc('0x50')](_0x21a41f[_0x4afc('0x4d')],{'$or':_[_0x4afc('0x3c')](_0x21a41f['attributes'],function(_0x253e57){var _0x36f6ad={};_0x36f6ad[_0x253e57]={'$like':'%'+_0xc0ff4e['query'][_0x4afc('0x4f')]+'%'};return _0x36f6ad;})});}_0x21a41f=_[_0x4afc('0x50')]({},_0x21a41f,_0xc0ff4e['options']);return db[_0x4afc('0x8b')][_0x4afc('0x52')]({'where':_0x21a41f[_0x4afc('0x4d')]})['then'](function(_0x409be5){_0x354f3a[_0x4afc('0x52')]=_0x409be5;if(_0xc0ff4e[_0x4afc('0x42')]['includeAll']){_0x21a41f['include']=[{'model':db[_0x4afc('0x70')],'as':'Contact','required':![]},{'model':db[_0x4afc('0x97')],'as':_0x4afc('0xa6'),'attributes':[_0x4afc('0x38'),'fullname','internal'],'required':![]},{'model':db[_0x4afc('0xa7')],'as':_0x4afc('0xa8'),'attributes':['id',_0x4afc('0x38'),_0x4afc('0xa9')],'where':_0xc0ff4e[_0x4afc('0x42')][_0x4afc('0xaa')]?{'id':_0xc0ff4e['query'][_0x4afc('0xaa')]}:undefined,'required':_0xc0ff4e[_0x4afc('0x42')][_0x4afc('0xaa')]?!![]:![]}];}return db[_0x4afc('0x8b')][_0x4afc('0x55')](_0x21a41f);})['then'](function(_0x1da8c0){_0x354f3a[_0x4afc('0x56')]=_0x1da8c0;return _0x354f3a;});}})[_0x4afc('0x1f')](respondWithFilteredResult(_0x5a492d,_0x21a41f))['catch'](handleError(_0x5a492d,null));};exports[_0x4afc('0xab')]=function(_0x133d22,_0x5256df,_0x537fae){return db[_0x4afc('0x3d')][_0x4afc('0x59')]({'where':{'id':_0x133d22[_0x4afc('0x58')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x5256df,null))[_0x4afc('0x1f')](function(_0x4f68fa){if(_0x4f68fa){return _0x4f68fa[_0x4afc('0xab')](_0x133d22[_0x4afc('0x5b')]['ids'],_[_0x4afc('0xac')](_0x133d22[_0x4afc('0x5b')],['ids','id'])||{})[_0x4afc('0x8d')](function(_0x17940a){for(var _0x3b3226=0x0;_0x3b3226<_0x133d22[_0x4afc('0x5b')][_0x4afc('0x6a')][_0x4afc('0x48')];_0x3b3226+=0x1){socket['emit'](_0x4afc('0xad'),{'UserId':_0x133d22[_0x4afc('0x5b')][_0x4afc('0x6a')][_0x3b3226],'OpenchannelAccountId':_0x133d22[_0x4afc('0x58')]['id']});}return _0x17940a;});}})['then'](respondWithResult(_0x5256df,null))[_0x4afc('0x29')](handleError(_0x5256df,null));};exports[_0x4afc('0xae')]=function(_0x3cac2f,_0x127814,_0x49ee03){return db[_0x4afc('0x3d')][_0x4afc('0x59')]({'where':{'id':_0x3cac2f[_0x4afc('0x58')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x127814,null))[_0x4afc('0x1f')](function(_0x338de8){if(_0x338de8){return _0x338de8[_0x4afc('0xae')](_0x3cac2f['query']['ids'])['then'](function(){if(_[_0x4afc('0xaf')](_0x3cac2f['query'][_0x4afc('0x6a')])){for(var _0x4e05af=0x0;_0x4e05af<_0x3cac2f[_0x4afc('0x42')][_0x4afc('0x6a')][_0x4afc('0x48')];_0x4e05af+=0x1){socket['emit'](_0x4afc('0xb0'),{'UserId':Number(_0x3cac2f[_0x4afc('0x42')][_0x4afc('0x6a')][_0x4e05af]),'OpenchannelAccountId':Number(_0x3cac2f[_0x4afc('0x58')]['id'])});}}else{socket['emit'](_0x4afc('0xb0'),{'UserId':Number(_0x3cac2f[_0x4afc('0x42')][_0x4afc('0x6a')]),'OpenchannelAccountId':Number(_0x3cac2f['params']['id'])});}});}})[_0x4afc('0x1f')](respondWithStatusCode(_0x127814,null))[_0x4afc('0x29')](handleError(_0x127814,null));};exports['getAgents']=function(_0x43f64e,_0x2e041a,_0x6ad393){var _0x1d6bd2={};var _0x2864fa={};var _0x48d0ee;var _0x563172;return db[_0x4afc('0x3d')][_0x4afc('0x67')]({'where':{'id':_0x43f64e[_0x4afc('0x58')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x2e041a,null))[_0x4afc('0x1f')](function(_0x5152ab){if(_0x5152ab){_0x48d0ee=_0x5152ab;_0x2864fa[_0x4afc('0x41')]=_[_0x4afc('0x43')](db[_0x4afc('0x97')][_0x4afc('0x3e')]);_0x2864fa['query']=_[_0x4afc('0x43')](_0x43f64e[_0x4afc('0x42')]);_0x2864fa[_0x4afc('0x44')]=_[_0x4afc('0x46')](_0x2864fa[_0x4afc('0x41')],_0x2864fa[_0x4afc('0x42')]);_0x1d6bd2[_0x4afc('0x45')]=_['intersection'](_0x2864fa[_0x4afc('0x41')],qs[_0x4afc('0x47')](_0x43f64e[_0x4afc('0x42')]['fields']));_0x1d6bd2['attributes']=_0x1d6bd2['attributes']['length']?_0x1d6bd2['attributes']:_0x2864fa[_0x4afc('0x41')];_0x1d6bd2['order']=qs[_0x4afc('0x4c')](_0x43f64e[_0x4afc('0x42')][_0x4afc('0x4c')]);_0x1d6bd2['where']=qs[_0x4afc('0x44')](_[_0x4afc('0x4e')](_0x43f64e[_0x4afc('0x42')],_0x2864fa[_0x4afc('0x44')]));if(_0x43f64e[_0x4afc('0x42')][_0x4afc('0x4f')]){_0x1d6bd2[_0x4afc('0x4d')]=_[_0x4afc('0x50')](_0x1d6bd2['where'],{'$or':_[_0x4afc('0x3c')](_0x1d6bd2[_0x4afc('0x45')],function(_0x5f3751){var _0x2d7590={};_0x2d7590[_0x5f3751]={'$like':'%'+_0x43f64e[_0x4afc('0x42')]['filter']+'%'};return _0x2d7590;})});}_0x1d6bd2=_['merge']({},_0x1d6bd2,_0x43f64e[_0x4afc('0x51')]);return _0x48d0ee[_0x4afc('0xb1')](_0x1d6bd2);}})[_0x4afc('0x1f')](function(_0x444e1a){if(_0x444e1a){_0x563172=_0x444e1a['length'];if(!_0x43f64e[_0x4afc('0x42')][_0x4afc('0x49')](_0x4afc('0x4a'))){_0x1d6bd2[_0x4afc('0x2d')]=qs['limit'](_0x43f64e['query']['limit']);_0x1d6bd2[_0x4afc('0x2c')]=qs[_0x4afc('0x2c')](_0x43f64e['query'][_0x4afc('0x2c')]);}return _0x48d0ee['getAgents'](_0x1d6bd2);}})['then'](function(_0x319692){if(_0x319692){return _0x319692?{'count':_0x563172,'rows':_0x319692}:null;}})['then'](respondWithResult(_0x2e041a,null))[_0x4afc('0x29')](handleError(_0x2e041a,null));};exports[_0x4afc('0xb2')]=function(_0x33ee71,_0x172a8a,_0x316e76){var _0x485f68,_0x39c4b5,_0x5bb7b9;if(_[_0x4afc('0x79')](_0x33ee71[_0x4afc('0x5b')][_0x4afc('0x5b')])||_0x33ee71[_0x4afc('0x5b')][_0x4afc('0x5b')]===''){throw new db['Sequelize'][(_0x4afc('0x71'))](_0x4afc('0xb3'));}if(_[_0x4afc('0x79')](_0x33ee71[_0x4afc('0x5b')]['to'])){}_0x485f68=_0x33ee71['body']['to'];return db[_0x4afc('0x3d')][_0x4afc('0x67')]({'where':{'id':_0x33ee71['params']['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x172a8a,null))['then'](function(_0x588d22){if(_0x588d22){return db[_0x4afc('0x3d')][_0x4afc('0x59')]({'where':{'id':_0x588d22['id']},'include':[{'model':db[_0x4afc('0x7e')],'as':_0x4afc('0x7f'),'include':[{'model':db[_0x4afc('0x70')],'as':_0x4afc('0x80'),'where':{[_0x588d22[_0x4afc('0x7c')]]:_0x485f68},'limit':0x1,'order':[[_0x4afc('0x75'),_0x4afc('0xb4')]]}]}]})[_0x4afc('0x1f')](handleEntityNotFound(_0x172a8a,null))['then'](function(_0x46d574){if(_0x46d574&&_0x46d574[_0x4afc('0x7f')]){_0x39c4b5=_0x46d574[_0x4afc('0x5d')]({'plain':!![]});if(_0x39c4b5[_0x4afc('0x7f')]&&_0x39c4b5['List'][_0x4afc('0x80')][_0x4afc('0x48')]){return _0x39c4b5[_0x4afc('0x7f')][_0x4afc('0x80')][0x0];}return db[_0x4afc('0x70')][_0x4afc('0x5a')](_[_0x4afc('0x17')](_0x33ee71['body'],{'firstName':_0x485f68,[_0x46d574['mapKey']]:_0x485f68,'phone':_0x485f68,'ListId':_0x39c4b5['ListId']}));}})['then'](handleEntityNotFound(_0x172a8a,null))[_0x4afc('0x1f')](function(_0x3af1d3){if(_0x3af1d3){_0x5bb7b9=_0x3af1d3;return db[_0x4afc('0x8b')][_0x4afc('0x59')]({'where':{'ContactId':_0x5bb7b9['id'],'closed':![],'OpenchannelAccountId':_0x39c4b5['id']}})[_0x4afc('0x1f')](function(_0x938d9a){if(_0x938d9a){return[_0x938d9a,![]];}return db[_0x4afc('0x8b')]['create']({'UserId':_0x33ee71[_0x4afc('0x5c')]['id'],'ContactId':_0x5bb7b9['id'],'OpenchannelAccountId':_0x39c4b5['id'],'lastMsgDirection':_0x4afc('0xb5'),'Messages':[_[_0x4afc('0x50')](_0x33ee71[_0x4afc('0x5b')],{'read':![],'body':_0x33ee71[_0x4afc('0x5b')][_0x4afc('0x5b')],'OpenchannelAccountId':_0x39c4b5['id'],'UserId':_0x33ee71[_0x4afc('0x5c')]['id'],'ContactId':_0x5bb7b9['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x4afc('0x1f')](function(_0x2fb006){return[_0x2fb006,!![]];});});}})[_0x4afc('0x8d')](function(_0xa1b979,_0xef44ed){if(_0xef44ed){return _0xa1b979;}return db[_0x4afc('0x94')][_0x4afc('0x5a')](_[_0x4afc('0x50')](_0x33ee71[_0x4afc('0x5b')],{'read':![],'body':_0x33ee71[_0x4afc('0x5b')]['body'],'OpenchannelAccountId':_0x39c4b5['id'],'OpenchannelInteractionId':_0xa1b979['id'],'UserId':_0x33ee71[_0x4afc('0x5c')]['id'],'ContactId':_0x5bb7b9['id']}))[_0x4afc('0x1f')](function(_0x394182){_0xa1b979[_0x4afc('0xb6')][_0x4afc('0xb7')]=[];_0xa1b979[_0x4afc('0xb6')][_0x4afc('0xb7')][_0x4afc('0xb8')](_0x394182[_0x4afc('0xb6')]);return _0xa1b979;});});}})[_0x4afc('0x1f')](respondWithResult(_0x172a8a,null))[_0x4afc('0x29')](handleError(_0x172a8a,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index edaeb1d..0d53e4b 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 _0x9cde=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount','setMaxListeners','update'];(function(_0x21c3d9,_0x1d5f2c){var _0x434f57=function(_0x26fe59){while(--_0x26fe59){_0x21c3d9['push'](_0x21c3d9['shift']());}};_0x434f57(++_0x1d5f2c);}(_0x9cde,0x1d9));var _0xe9cd=function(_0x6620b8,_0x8b3d5e){_0x6620b8=_0x6620b8-0x0;var _0x33de50=_0x9cde[_0x6620b8];return _0x33de50;};'use strict';var EventEmitter=require(_0xe9cd('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xe9cd('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xe9cd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe9cd('0x3'),'afterDestroy':_0xe9cd('0x4')};function emitEvent(_0x158845){return function(_0x374080,_0x24c657,_0x390e72){OpenchannelAccountEvents['emit'](_0x158845+':'+_0x374080['id'],_0x374080);OpenchannelAccountEvents[_0xe9cd('0x5')](_0x158845,_0x374080);_0x390e72(null);};}for(var e in events){if(events[_0xe9cd('0x6')](e)){var event=events[e];OpenchannelAccount[_0xe9cd('0x7')](e,emitEvent(event));}}module[_0xe9cd('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x0fd2=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x0fd2,0x18f));var _0x20fd=function(_0x3fb1c9,_0x4540c0){_0x3fb1c9=_0x3fb1c9-0x0;var _0x36f94f=_0x0fd2[_0x3fb1c9];return _0x36f94f;};'use strict';var EventEmitter=require(_0x20fd('0x0'));var OpenchannelAccount=require(_0x20fd('0x1'))['db'][_0x20fd('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x20fd('0x3')](0x0);var events={'afterCreate':_0x20fd('0x4'),'afterUpdate':_0x20fd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2267fb){return function(_0x5f564e,_0x5e6d38,_0x3df8f4){OpenchannelAccountEvents[_0x20fd('0x6')](_0x2267fb+':'+_0x5f564e['id'],_0x5f564e);OpenchannelAccountEvents['emit'](_0x2267fb,_0x5f564e);_0x3df8f4(null);};}for(var e in events){if(events[_0x20fd('0x7')](e)){var event=events[e];OpenchannelAccount[_0x20fd('0x8')](e,emitEvent(event));}}module[_0x20fd('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 a67adba..c6f99db 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 _0x503c=['../../config/environment','./openchannelAccount.attributes','exports','OpenchannelAccount','openchannel_accounts','bluebird','request-promise','rimraf'];(function(_0x558c4e,_0x5f57f8){var _0x3ccaba=function(_0x535a9){while(--_0x535a9){_0x558c4e['push'](_0x558c4e['shift']());}};_0x3ccaba(++_0x5f57f8);}(_0x503c,0x1bd));var _0xc503=function(_0x1e1d5d,_0x213f5b){_0x1e1d5d=_0x1e1d5d-0x0;var _0x1830ac=_0x503c[_0x1e1d5d];return _0x1830ac;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc503('0x0'));var rp=require(_0xc503('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc503('0x2'));var config=require(_0xc503('0x3'));var attributes=require(_0xc503('0x4'));module[_0xc503('0x5')]=function(_0x3cb881,_0x5e1043){return _0x3cb881['define'](_0xc503('0x6'),attributes,{'tableName':_0xc503('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4854=['lodash','util','request-promise','rimraf','../../config/environment','define','OpenchannelAccount','openchannel_accounts'];(function(_0x12d9fa,_0x6cbd7e){var _0x175de5=function(_0x288b77){while(--_0x288b77){_0x12d9fa['push'](_0x12d9fa['shift']());}};_0x175de5(++_0x6cbd7e);}(_0x4854,0xb8));var _0x4485=function(_0x356e8d,_0x24c719){_0x356e8d=_0x356e8d-0x0;var _0x39e65a=_0x4854[_0x356e8d];return _0x39e65a;};'use strict';var _=require(_0x4485('0x0'));var util=require(_0x4485('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4485('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4485('0x3'));var config=require(_0x4485('0x4'));var attributes=require('./openchannelAccount.attributes');module['exports']=function(_0x6ffe30,_0x315411){return _0x6ffe30[_0x4485('0x5')](_0x4485('0x6'),attributes,{'tableName':_0x4485('0x7'),'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 432925e..78bafaf 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 _0xc0e1=['OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info','request\x20sent','debug'];(function(_0x1e890c,_0x51cc3d){var _0x375202=function(_0x564977){while(--_0x564977){_0x1e890c['push'](_0x1e890c['shift']());}};_0x375202(++_0x51cc3d);}(_0xc0e1,0x181));var _0x1c0e=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0xc0e1[_0x35f7f5];return _0x5567a4;};'use strict';var _=require(_0x1c0e('0x0'));var util=require('util');var moment=require(_0x1c0e('0x1'));var BPromise=require(_0x1c0e('0x2'));var rs=require(_0x1c0e('0x3'));var fs=require('fs');var Redis=require(_0x1c0e('0x4'));var db=require(_0x1c0e('0x5'))['db'];var utils=require(_0x1c0e('0x6'));var logger=require(_0x1c0e('0x7'))(_0x1c0e('0x8'));var config=require('../../config/environment');var jayson=require(_0x1c0e('0x9'));var client=jayson[_0x1c0e('0xa')]['http']({'port':0x232a});config[_0x1c0e('0xb')]=_[_0x1c0e('0xc')](config[_0x1c0e('0xb')],{'host':_0x1c0e('0xd'),'port':0x18eb});var socket=require(_0x1c0e('0xe'))(new Redis(config['redis']));require(_0x1c0e('0xf'))[_0x1c0e('0x10')](socket);function respondWithRpcPromise(_0x47dcfb,_0x2aeb74,_0x55070d){return new BPromise(function(_0xabca79,_0x1a418a){return client[_0x1c0e('0x11')](_0x47dcfb,_0x55070d)['then'](function(_0x4f66a2){logger[_0x1c0e('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x2aeb74,_0x1c0e('0x13'));logger[_0x1c0e('0x14')](_0x1c0e('0x15'),_0x2aeb74,_0x1c0e('0x13'),JSON[_0x1c0e('0x16')](_0x4f66a2));if(_0x4f66a2['error']){if(_0x4f66a2[_0x1c0e('0x17')][_0x1c0e('0x18')]===0x1f4){logger[_0x1c0e('0x17')](_0x1c0e('0x19'),_0x2aeb74,_0x4f66a2[_0x1c0e('0x17')][_0x1c0e('0x1a')]);return _0x1a418a(_0x4f66a2[_0x1c0e('0x17')][_0x1c0e('0x1a')]);}logger[_0x1c0e('0x17')](_0x1c0e('0x19'),_0x2aeb74,_0x4f66a2[_0x1c0e('0x17')][_0x1c0e('0x1a')]);return _0xabca79(_0x4f66a2[_0x1c0e('0x17')]['message']);}else{logger['info'](_0x1c0e('0x19'),_0x2aeb74,_0x1c0e('0x13'));_0xabca79(_0x4f66a2[_0x1c0e('0x1b')][_0x1c0e('0x1a')]);}})[_0x1c0e('0x1c')](function(_0x324a38){logger['error'](_0x1c0e('0x19'),_0x2aeb74,_0x324a38);_0x1a418a(_0x324a38);});});} \ No newline at end of file +var _0x9e41=['error','OpenchannelAccount,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4fdb23,_0x1b5597){var _0x148e51=function(_0x2537ad){while(--_0x2537ad){_0x4fdb23['push'](_0x4fdb23['shift']());}};_0x148e51(++_0x1b5597);}(_0x9e41,0x1cf));var _0x19e4=function(_0x47d5ee,_0x40ac12){_0x47d5ee=_0x47d5ee-0x0;var _0x4962dc=_0x9e41[_0x47d5ee];return _0x4962dc;};'use strict';var _=require(_0x19e4('0x0'));var util=require('util');var moment=require(_0x19e4('0x1'));var BPromise=require(_0x19e4('0x2'));var rs=require(_0x19e4('0x3'));var fs=require('fs');var Redis=require(_0x19e4('0x4'));var db=require(_0x19e4('0x5'))['db'];var utils=require(_0x19e4('0x6'));var logger=require(_0x19e4('0x7'))(_0x19e4('0x8'));var config=require(_0x19e4('0x9'));var jayson=require(_0x19e4('0xa'));var client=jayson['client'][_0x19e4('0xb')]({'port':0x232a});config['redis']=_[_0x19e4('0xc')](config[_0x19e4('0xd')],{'host':_0x19e4('0xe'),'port':0x18eb});var socket=require(_0x19e4('0xf'))(new Redis(config['redis']));require(_0x19e4('0x10'))[_0x19e4('0x11')](socket);function respondWithRpcPromise(_0x35e300,_0x356792,_0x2545f0){return new BPromise(function(_0xd3a4cd,_0x32eb84){return client[_0x19e4('0x12')](_0x35e300,_0x2545f0)['then'](function(_0x55dfda){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x356792,_0x19e4('0x13'));logger[_0x19e4('0x14')](_0x19e4('0x15'),_0x356792,_0x19e4('0x13'),JSON[_0x19e4('0x16')](_0x55dfda));if(_0x55dfda['error']){if(_0x55dfda[_0x19e4('0x17')]['code']===0x1f4){logger[_0x19e4('0x17')](_0x19e4('0x18'),_0x356792,_0x55dfda[_0x19e4('0x17')]['message']);return _0x32eb84(_0x55dfda['error']['message']);}logger[_0x19e4('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x356792,_0x55dfda[_0x19e4('0x17')][_0x19e4('0x19')]);return _0xd3a4cd(_0x55dfda[_0x19e4('0x17')][_0x19e4('0x19')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x356792,_0x19e4('0x13'));_0xd3a4cd(_0x55dfda['result']['message']);}})[_0x19e4('0x1a')](function(_0x2232e5){logger[_0x19e4('0x17')](_0x19e4('0x18'),_0x356792,_0x2232e5);_0x32eb84(_0x2232e5);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index e3b746e..c098f56 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 _0xc3a9=['removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','update','emit'];(function(_0x2cc98e,_0x3f51e9){var _0x4c3ea6=function(_0x73d432){while(--_0x73d432){_0x2cc98e['push'](_0x2cc98e['shift']());}};_0x4c3ea6(++_0x3f51e9);}(_0xc3a9,0x1bc));var _0x9c3a=function(_0x4a837d,_0x1f2fda){_0x4a837d=_0x4a837d-0x0;var _0x4d25d9=_0xc3a9[_0x4a837d];return _0x4d25d9;};'use strict';var OpenchannelAccountEvents=require(_0x9c3a('0x0'));var events=[_0x9c3a('0x1'),'remove',_0x9c3a('0x2')];function createListener(_0x559138,_0x18dc25){return function(_0x3e444a){_0x18dc25[_0x9c3a('0x3')](_0x559138,_0x3e444a);};}function removeListener(_0x104021,_0x39b1a6){return function(){OpenchannelAccountEvents[_0x9c3a('0x4')](_0x104021,_0x39b1a6);};}exports[_0x9c3a('0x5')]=function(_0x43770f){for(var _0x34cb95=0x0,_0x16b3da=events[_0x9c3a('0x6')];_0x34cb95<_0x16b3da;_0x34cb95++){var _0x2f2505=events[_0x34cb95];var _0x64a14=createListener(_0x9c3a('0x7')+_0x2f2505,_0x43770f);OpenchannelAccountEvents['on'](_0x2f2505,_0x64a14);}}; \ No newline at end of file +var _0xad38=['emit','removeListener','openchannelAccount:','./openchannelAccount.events','save','update'];(function(_0x2a8b12,_0xb2a18a){var _0x6caf8=function(_0x2d63dc){while(--_0x2d63dc){_0x2a8b12['push'](_0x2a8b12['shift']());}};_0x6caf8(++_0xb2a18a);}(_0xad38,0x19b));var _0x8ad3=function(_0x566865,_0x2e9876){_0x566865=_0x566865-0x0;var _0x296921=_0xad38[_0x566865];return _0x296921;};'use strict';var OpenchannelAccountEvents=require(_0x8ad3('0x0'));var events=[_0x8ad3('0x1'),'remove',_0x8ad3('0x2')];function createListener(_0x4922e4,_0x1b2a3b){return function(_0x1a7e52){_0x1b2a3b[_0x8ad3('0x3')](_0x4922e4,_0x1a7e52);};}function removeListener(_0xd970eb,_0x4904b6){return function(){OpenchannelAccountEvents[_0x8ad3('0x4')](_0xd970eb,_0x4904b6);};}exports['register']=function(_0x5d7f4a){for(var _0x129dc0=0x0,_0x1be3e2=events['length'];_0x129dc0<_0x1be3e2;_0x129dc0++){var _0x420d08=events[_0x129dc0];var _0x233214=createListener(_0x8ad3('0x5')+_0x420d08,_0x5d7f4a);OpenchannelAccountEvents['on'](_0x420d08,_0x233214);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 36bb637..34fbba3 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 _0xc23c=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','show'];(function(_0x3a8c8f,_0x567295){var _0x4d8b4a=function(_0x42a96e){while(--_0x42a96e){_0x3a8c8f['push'](_0x3a8c8f['shift']());}};_0x4d8b4a(++_0x567295);}(_0xc23c,0x16f));var _0xcc23=function(_0x1ac8fe,_0xc0578f){_0x1ac8fe=_0x1ac8fe-0x0;var _0x4c6db2=_0xc23c[_0x1ac8fe];return _0x4c6db2;};'use strict';var multer=require(_0xcc23('0x0'));var util=require('util');var path=require(_0xcc23('0x1'));var timeout=require(_0xcc23('0x2'));var express=require(_0xcc23('0x3'));var router=express[_0xcc23('0x4')]();var auth=require(_0xcc23('0x5'));var interaction=require(_0xcc23('0x6'));var config=require(_0xcc23('0x7'));var controller=require(_0xcc23('0x8'));router[_0xcc23('0x9')]('/',auth[_0xcc23('0xa')](),controller['index']);router[_0xcc23('0x9')](_0xcc23('0xb'),auth[_0xcc23('0xa')](),controller[_0xcc23('0xc')]);router[_0xcc23('0xd')]('/',auth['isAuthenticated'](),controller[_0xcc23('0xe')]);router[_0xcc23('0xf')](_0xcc23('0xb'),auth[_0xcc23('0xa')](),controller[_0xcc23('0x10')]);router[_0xcc23('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xcc23('0x12')]);module[_0xcc23('0x13')]=router; \ No newline at end of file +var _0x1a6c=['show','post','put','update','delete','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x5fd2d7,_0x2b213d){var _0x1f8083=function(_0x508070){while(--_0x508070){_0x5fd2d7['push'](_0x5fd2d7['shift']());}};_0x1f8083(++_0x2b213d);}(_0x1a6c,0x75));var _0xc1a6=function(_0x1370e0,_0x25353f){_0x1370e0=_0x1370e0-0x0;var _0x53a6cb=_0x1a6c[_0x1370e0];return _0x53a6cb;};'use strict';var multer=require(_0xc1a6('0x0'));var util=require('util');var path=require(_0xc1a6('0x1'));var timeout=require(_0xc1a6('0x2'));var express=require(_0xc1a6('0x3'));var router=express['Router']();var auth=require(_0xc1a6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc1a6('0x5'));var controller=require(_0xc1a6('0x6'));router[_0xc1a6('0x7')]('/',auth[_0xc1a6('0x8')](),controller[_0xc1a6('0x9')]);router[_0xc1a6('0x7')](_0xc1a6('0xa'),auth['isAuthenticated'](),controller[_0xc1a6('0xb')]);router[_0xc1a6('0xc')]('/',auth[_0xc1a6('0x8')](),controller['create']);router[_0xc1a6('0xd')](_0xc1a6('0xa'),auth[_0xc1a6('0x8')](),controller[_0xc1a6('0xe')]);router[_0xc1a6('0xf')](_0xc1a6('0xa'),auth['isAuthenticated'](),controller['destroy']);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 803b4f4..db5ba7a 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 _0x75c3=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x556892,_0x2680cf){var _0xfb1c4d=function(_0xcd7945){while(--_0xcd7945){_0x556892['push'](_0x556892['shift']());}};_0xfb1c4d(++_0x2680cf);}(_0x75c3,0x13f));var _0x375c=function(_0x453f73,_0x4f8759){_0x453f73=_0x453f73-0x0;var _0x3a4f4c=_0x75c3[_0x453f73];return _0x3a4f4c;};'use strict';var Sequelize=require(_0x375c('0x0'));module[_0x375c('0x1')]={'priority':{'type':Sequelize[_0x375c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x375c('0x3')],'allowNull':![],'defaultValue':_0x375c('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x375c('0x3')]},'interval':{'type':Sequelize[_0x375c('0x3')],'defaultValue':_0x375c('0x5')}}; \ No newline at end of file +var _0xe5c1=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x251ab0,_0x46e532){var _0x11848c=function(_0x78e3a2){while(--_0x78e3a2){_0x251ab0['push'](_0x251ab0['shift']());}};_0x11848c(++_0x46e532);}(_0xe5c1,0x1e8));var _0x1e5c=function(_0x51dad9,_0x58799b){_0x51dad9=_0x51dad9-0x0;var _0x151ac5=_0xe5c1[_0x51dad9];return _0x151ac5;};'use strict';var Sequelize=require(_0x1e5c('0x0'));module[_0x1e5c('0x1')]={'priority':{'type':Sequelize[_0x1e5c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1e5c('0x3')],'allowNull':![],'defaultValue':_0x1e5c('0x4')},'appdata':{'type':Sequelize[_0x1e5c('0x5')]()},'description':{'type':Sequelize[_0x1e5c('0x3')]},'interval':{'type':Sequelize[_0x1e5c('0x3')],'defaultValue':_0x1e5c('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 4802946..7f44c93 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 _0x0c98=['limit','Content-Range','json','apply','reject','save','then','destroy','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset'];(function(_0xe5b699,_0xa63a8c){var _0x3238a1=function(_0x1fab54){while(--_0x1fab54){_0xe5b699['push'](_0xe5b699['shift']());}};_0x3238a1(++_0xa63a8c);}(_0x0c98,0xae));var _0x80c9=function(_0x13b35a,_0x32a31e){_0x13b35a=_0x13b35a-0x0;var _0x3181d2=_0x0c98[_0x13b35a];return _0x3181d2;};'use strict';var pdf=require(_0x80c9('0x0'));var emlformat=require(_0x80c9('0x1'));var rimraf=require(_0x80c9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x80c9('0x3'));var rp=require(_0x80c9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x80c9('0x5'));var util=require('util');var path=require(_0x80c9('0x6'));var sox=require('sox');var csv=require(_0x80c9('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x80c9('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x80c9('0x7'));var querystring=require(_0x80c9('0x9'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x80c9('0xa'));var qs=require(_0x80c9('0xb'));var as=require(_0x80c9('0xc'));var hardwareService=require(_0x80c9('0xd'));var logger=require(_0x80c9('0xe'))(_0x80c9('0xf'));var utils=require('../../config/utils');var config=require(_0x80c9('0x10'));var licenseUtil=require(_0x80c9('0x11'));var db=require(_0x80c9('0x12'))['db'];function respondWithStatusCode(_0x2305d4,_0x5cac42){_0x5cac42=_0x5cac42||0xcc;return function(_0xc10b9e){if(_0xc10b9e){return _0x2305d4[_0x80c9('0x13')](_0x5cac42);}return _0x2305d4[_0x80c9('0x14')](_0x5cac42)[_0x80c9('0x15')]();};}function respondWithResult(_0x4a230b,_0x15f2b5){_0x15f2b5=_0x15f2b5||0xc8;return function(_0x3d82ab){if(_0x3d82ab){return _0x4a230b[_0x80c9('0x14')](_0x15f2b5)['json'](_0x3d82ab);}};}function respondWithFilteredResult(_0x42d96c,_0x28e361){return function(_0x2c6bd9){if(_0x2c6bd9){var _0x3ea14b=_0x2c6bd9[_0x80c9('0x16')],_0x359545=_0x28e361[_0x80c9('0x17')],_0x265f0d=_0x28e361[_0x80c9('0x17')]+_0x28e361[_0x80c9('0x18')],_0x544849;if(_0x265f0d>=_0x3ea14b){_0x265f0d=_0x3ea14b;_0x544849=0xc8;}else{_0x544849=0xce;}_0x42d96c[_0x80c9('0x14')](_0x544849);return _0x42d96c['set'](_0x80c9('0x19'),_0x359545+'-'+_0x265f0d+'/'+_0x3ea14b)[_0x80c9('0x1a')](_0x2c6bd9);}return null;};}function patchUpdates(_0x5570e2){return function(_0x12bf01){try{jsonpatch[_0x80c9('0x1b')](_0x12bf01,_0x5570e2,!![]);}catch(_0x502fd1){return BPromise[_0x80c9('0x1c')](_0x502fd1);}return _0x12bf01[_0x80c9('0x1d')]();};}function saveUpdates(_0x1879b5,_0x3fd3e5){return function(_0x668967){if(_0x668967){return _0x668967['update'](_0x1879b5)[_0x80c9('0x1e')](function(_0x51184a){return _0x51184a;});}return null;};}function removeEntity(_0x1f28a3,_0x1dd524){return function(_0x4dced3){if(_0x4dced3){return _0x4dced3[_0x80c9('0x1f')]()[_0x80c9('0x1e')](function(){_0x1f28a3[_0x80c9('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a00e0,_0x4ae74d){return function(_0x3b7bbe){if(!_0x3b7bbe){_0x4a00e0[_0x80c9('0x13')](0x194);}return _0x3b7bbe;};}function handleError(_0x12ba70,_0x4537d2){_0x4537d2=_0x4537d2||0x1f4;return function(_0x298826){logger['error'](_0x298826['stack']);if(_0x298826['name']){delete _0x298826[_0x80c9('0x20')];}_0x12ba70['status'](_0x4537d2)[_0x80c9('0x21')](_0x298826);};}exports[_0x80c9('0x22')]=function(_0x4a440f,_0x43194a){var _0xf221ce={},_0x377803={},_0x1219fe={'count':0x0,'rows':[]};var _0x579098=_[_0x80c9('0x23')](db[_0x80c9('0x24')][_0x80c9('0x25')],function(_0x25a0e6){return{'name':_0x25a0e6[_0x80c9('0x26')],'type':_0x25a0e6[_0x80c9('0x27')][_0x80c9('0x28')]};});_0x377803[_0x80c9('0x29')]=_[_0x80c9('0x23')](_0x579098,_0x80c9('0x20'));_0x377803[_0x80c9('0x2a')]=_[_0x80c9('0x2b')](_0x4a440f[_0x80c9('0x2a')]);_0x377803[_0x80c9('0x2c')]=_[_0x80c9('0x2d')](_0x377803[_0x80c9('0x29')],_0x377803[_0x80c9('0x2a')]);_0xf221ce[_0x80c9('0x2e')]=_[_0x80c9('0x2d')](_0x377803[_0x80c9('0x29')],qs['fields'](_0x4a440f['query'][_0x80c9('0x2f')]));_0xf221ce[_0x80c9('0x2e')]=_0xf221ce[_0x80c9('0x2e')][_0x80c9('0x30')]?_0xf221ce[_0x80c9('0x2e')]:_0x377803['model'];if(!_0x4a440f[_0x80c9('0x2a')][_0x80c9('0x31')](_0x80c9('0x32'))){_0xf221ce[_0x80c9('0x18')]=qs['limit'](_0x4a440f[_0x80c9('0x2a')]['limit']);_0xf221ce[_0x80c9('0x17')]=qs[_0x80c9('0x17')](_0x4a440f[_0x80c9('0x2a')][_0x80c9('0x17')]);}_0xf221ce[_0x80c9('0x33')]=qs['sort'](_0x4a440f['query']['sort']);_0xf221ce[_0x80c9('0x34')]=qs[_0x80c9('0x2c')](_['pick'](_0x4a440f[_0x80c9('0x2a')],_0x377803[_0x80c9('0x2c')]),_0x579098);if(_0x4a440f[_0x80c9('0x2a')]['filter']){_0xf221ce['where']=_[_0x80c9('0x35')](_0xf221ce[_0x80c9('0x34')],{'$or':_['map'](_0x579098,function(_0x284790){if(_0x284790[_0x80c9('0x27')]!==_0x80c9('0x36')){var _0x70b118={};_0x70b118[_0x284790[_0x80c9('0x20')]]={'$like':'%'+_0x4a440f['query']['filter']+'%'};return _0x70b118;}})});}_0xf221ce=_[_0x80c9('0x35')]({},_0xf221ce,_0x4a440f[_0x80c9('0x37')]);var _0xdfe0e={'where':_0xf221ce[_0x80c9('0x34')]};return db[_0x80c9('0x24')][_0x80c9('0x16')](_0xdfe0e)[_0x80c9('0x1e')](function(_0x31f008){_0x1219fe['count']=_0x31f008;if(_0x4a440f['query'][_0x80c9('0x38')]){_0xf221ce[_0x80c9('0x39')]=[{'all':!![]}];}return db[_0x80c9('0x24')][_0x80c9('0x3a')](_0xf221ce);})['then'](function(_0x2fd5f0){_0x1219fe['rows']=_0x2fd5f0;return _0x1219fe;})[_0x80c9('0x1e')](respondWithFilteredResult(_0x43194a,_0xf221ce))[_0x80c9('0x3b')](handleError(_0x43194a,null));};exports[_0x80c9('0x3c')]=function(_0x3b701a,_0x3db342){var _0x23cfde={'raw':!![],'where':{'id':_0x3b701a[_0x80c9('0x3d')]['id']}},_0x1c90ff={};_0x1c90ff[_0x80c9('0x29')]=_[_0x80c9('0x2b')](db[_0x80c9('0x24')]['rawAttributes']);_0x1c90ff[_0x80c9('0x2a')]=_[_0x80c9('0x2b')](_0x3b701a[_0x80c9('0x2a')]);_0x1c90ff[_0x80c9('0x2c')]=_[_0x80c9('0x2d')](_0x1c90ff['model'],_0x1c90ff['query']);_0x23cfde[_0x80c9('0x2e')]=_[_0x80c9('0x2d')](_0x1c90ff['model'],qs[_0x80c9('0x2f')](_0x3b701a[_0x80c9('0x2a')]['fields']));_0x23cfde[_0x80c9('0x2e')]=_0x23cfde[_0x80c9('0x2e')]['length']?_0x23cfde['attributes']:_0x1c90ff[_0x80c9('0x29')];if(_0x3b701a['query']['includeAll']){_0x23cfde['include']=[{'all':!![]}];}_0x23cfde=_[_0x80c9('0x35')]({},_0x23cfde,_0x3b701a['options']);return db[_0x80c9('0x24')][_0x80c9('0x3e')](_0x23cfde)[_0x80c9('0x1e')](handleEntityNotFound(_0x3db342,null))['then'](respondWithResult(_0x3db342,null))[_0x80c9('0x3b')](handleError(_0x3db342,null));};exports[_0x80c9('0x3f')]=function(_0x139d5f,_0xe10bf2){return db[_0x80c9('0x24')]['create'](_0x139d5f[_0x80c9('0x40')],{})[_0x80c9('0x1e')](respondWithResult(_0xe10bf2,0xc9))[_0x80c9('0x3b')](handleError(_0xe10bf2,null));};exports[_0x80c9('0x41')]=function(_0x4ca7d7,_0x4249ac){if(_0x4ca7d7[_0x80c9('0x40')]['id']){delete _0x4ca7d7[_0x80c9('0x40')]['id'];}return db[_0x80c9('0x24')][_0x80c9('0x3e')]({'where':{'id':_0x4ca7d7['params']['id']}})[_0x80c9('0x1e')](handleEntityNotFound(_0x4249ac,null))[_0x80c9('0x1e')](saveUpdates(_0x4ca7d7[_0x80c9('0x40')],null))[_0x80c9('0x1e')](respondWithResult(_0x4249ac,null))[_0x80c9('0x3b')](handleError(_0x4249ac,null));};exports[_0x80c9('0x1f')]=function(_0x535db1,_0x5b8a47){return db[_0x80c9('0x24')][_0x80c9('0x3e')]({'where':{'id':_0x535db1[_0x80c9('0x3d')]['id']}})[_0x80c9('0x1e')](handleEntityNotFound(_0x5b8a47,null))[_0x80c9('0x1e')](removeEntity(_0x5b8a47,null))[_0x80c9('0x3b')](handleError(_0x5b8a47,null));}; \ No newline at end of file +var _0xfd2b=['apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','filter','options','OpenchannelApplication','includeAll','include','findAll','catch','show','params','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range'];(function(_0x3bbd2d,_0xf8ba3c){var _0x241bd4=function(_0x4f02fb){while(--_0x4f02fb){_0x3bbd2d['push'](_0x3bbd2d['shift']());}};_0x241bd4(++_0xf8ba3c);}(_0xfd2b,0xb6));var _0xbfd2=function(_0x1e7faa,_0x37a4e3){_0x1e7faa=_0x1e7faa-0x0;var _0x2ad137=_0xfd2b[_0x1e7faa];return _0x2ad137;};'use strict';var pdf=require(_0xbfd2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbfd2('0x1'));var zipdir=require(_0xbfd2('0x2'));var jsonpatch=require(_0xbfd2('0x3'));var rp=require(_0xbfd2('0x4'));var moment=require(_0xbfd2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbfd2('0x6'));var util=require(_0xbfd2('0x7'));var path=require(_0xbfd2('0x8'));var sox=require(_0xbfd2('0x9'));var csv=require(_0xbfd2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbfd2('0xb'));var squel=require(_0xbfd2('0xc'));var crypto=require('crypto');var jsforce=require(_0xbfd2('0xd'));var deskjs=require(_0xbfd2('0xe'));var toCsv=require(_0xbfd2('0xa'));var querystring=require('querystring');var Papa=require(_0xbfd2('0xf'));var Redis=require('ioredis');var authService=require(_0xbfd2('0x10'));var qs=require(_0xbfd2('0x11'));var as=require(_0xbfd2('0x12'));var hardwareService=require(_0xbfd2('0x13'));var logger=require(_0xbfd2('0x14'))('api');var utils=require(_0xbfd2('0x15'));var config=require(_0xbfd2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbfd2('0x17'))['db'];function respondWithStatusCode(_0x5aeb07,_0x56ff17){_0x56ff17=_0x56ff17||0xcc;return function(_0x308ecd){if(_0x308ecd){return _0x5aeb07[_0xbfd2('0x18')](_0x56ff17);}return _0x5aeb07[_0xbfd2('0x19')](_0x56ff17)['end']();};}function respondWithResult(_0x53f6b4,_0x51b518){_0x51b518=_0x51b518||0xc8;return function(_0x21adf5){if(_0x21adf5){return _0x53f6b4['status'](_0x51b518)[_0xbfd2('0x1a')](_0x21adf5);}};}function respondWithFilteredResult(_0x3e1c14,_0x273c3b){return function(_0x26472e){if(_0x26472e){var _0x592a8=_0x26472e[_0xbfd2('0x1b')],_0x4e439c=_0x273c3b[_0xbfd2('0x1c')],_0x243b61=_0x273c3b[_0xbfd2('0x1c')]+_0x273c3b[_0xbfd2('0x1d')],_0x30dcb5;if(_0x243b61>=_0x592a8){_0x243b61=_0x592a8;_0x30dcb5=0xc8;}else{_0x30dcb5=0xce;}_0x3e1c14['status'](_0x30dcb5);return _0x3e1c14['set'](_0xbfd2('0x1e'),_0x4e439c+'-'+_0x243b61+'/'+_0x592a8)['json'](_0x26472e);}return null;};}function patchUpdates(_0x5a5688){return function(_0x10b090){try{jsonpatch[_0xbfd2('0x1f')](_0x10b090,_0x5a5688,!![]);}catch(_0x48fe57){return BPromise[_0xbfd2('0x20')](_0x48fe57);}return _0x10b090[_0xbfd2('0x21')]();};}function saveUpdates(_0x42a777,_0x443bc8){return function(_0x5ab4ed){if(_0x5ab4ed){return _0x5ab4ed[_0xbfd2('0x22')](_0x42a777)[_0xbfd2('0x23')](function(_0x4dde52){return _0x4dde52;});}return null;};}function removeEntity(_0x5a9b98,_0x55198b){return function(_0x27cc7e){if(_0x27cc7e){return _0x27cc7e[_0xbfd2('0x24')]()['then'](function(){_0x5a9b98['status'](0xcc)[_0xbfd2('0x25')]();});}};}function handleEntityNotFound(_0xdd0f3b,_0x5ac46b){return function(_0x537013){if(!_0x537013){_0xdd0f3b[_0xbfd2('0x18')](0x194);}return _0x537013;};}function handleError(_0x1a1402,_0x24d095){_0x24d095=_0x24d095||0x1f4;return function(_0x39a609){logger[_0xbfd2('0x26')](_0x39a609[_0xbfd2('0x27')]);if(_0x39a609['name']){delete _0x39a609[_0xbfd2('0x28')];}_0x1a1402[_0xbfd2('0x19')](_0x24d095)['send'](_0x39a609);};}exports['index']=function(_0xa8fef5,_0x52eb26){var _0x2d0ad1={},_0x248dbd={},_0x1ae2e1={'count':0x0,'rows':[]};var _0x2f35f9=_[_0xbfd2('0x29')](db['OpenchannelApplication'][_0xbfd2('0x2a')],function(_0x381a62){return{'name':_0x381a62[_0xbfd2('0x2b')],'type':_0x381a62[_0xbfd2('0x2c')]['key']};});_0x248dbd[_0xbfd2('0x2d')]=_[_0xbfd2('0x29')](_0x2f35f9,'name');_0x248dbd[_0xbfd2('0x2e')]=_[_0xbfd2('0x2f')](_0xa8fef5[_0xbfd2('0x2e')]);_0x248dbd[_0xbfd2('0x30')]=_[_0xbfd2('0x31')](_0x248dbd['model'],_0x248dbd[_0xbfd2('0x2e')]);_0x2d0ad1[_0xbfd2('0x32')]=_['intersection'](_0x248dbd['model'],qs[_0xbfd2('0x33')](_0xa8fef5[_0xbfd2('0x2e')][_0xbfd2('0x33')]));_0x2d0ad1[_0xbfd2('0x32')]=_0x2d0ad1['attributes'][_0xbfd2('0x34')]?_0x2d0ad1['attributes']:_0x248dbd[_0xbfd2('0x2d')];if(!_0xa8fef5[_0xbfd2('0x2e')][_0xbfd2('0x35')]('nolimit')){_0x2d0ad1[_0xbfd2('0x1d')]=qs['limit'](_0xa8fef5[_0xbfd2('0x2e')][_0xbfd2('0x1d')]);_0x2d0ad1[_0xbfd2('0x1c')]=qs[_0xbfd2('0x1c')](_0xa8fef5['query'][_0xbfd2('0x1c')]);}_0x2d0ad1[_0xbfd2('0x36')]=qs[_0xbfd2('0x37')](_0xa8fef5[_0xbfd2('0x2e')][_0xbfd2('0x37')]);_0x2d0ad1['where']=qs[_0xbfd2('0x30')](_[_0xbfd2('0x38')](_0xa8fef5[_0xbfd2('0x2e')],_0x248dbd[_0xbfd2('0x30')]),_0x2f35f9);if(_0xa8fef5['query']['filter']){_0x2d0ad1[_0xbfd2('0x39')]=_[_0xbfd2('0x3a')](_0x2d0ad1[_0xbfd2('0x39')],{'$or':_[_0xbfd2('0x29')](_0x2f35f9,function(_0x7317dd){if(_0x7317dd[_0xbfd2('0x2c')]!=='VIRTUAL'){var _0x253abd={};_0x253abd[_0x7317dd[_0xbfd2('0x28')]]={'$like':'%'+_0xa8fef5[_0xbfd2('0x2e')][_0xbfd2('0x3b')]+'%'};return _0x253abd;}})});}_0x2d0ad1=_[_0xbfd2('0x3a')]({},_0x2d0ad1,_0xa8fef5[_0xbfd2('0x3c')]);var _0x6aaf92={'where':_0x2d0ad1[_0xbfd2('0x39')]};return db[_0xbfd2('0x3d')]['count'](_0x6aaf92)['then'](function(_0x7a5f43){_0x1ae2e1['count']=_0x7a5f43;if(_0xa8fef5['query'][_0xbfd2('0x3e')]){_0x2d0ad1[_0xbfd2('0x3f')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xbfd2('0x40')](_0x2d0ad1);})[_0xbfd2('0x23')](function(_0x75fde9){_0x1ae2e1['rows']=_0x75fde9;return _0x1ae2e1;})[_0xbfd2('0x23')](respondWithFilteredResult(_0x52eb26,_0x2d0ad1))[_0xbfd2('0x41')](handleError(_0x52eb26,null));};exports[_0xbfd2('0x42')]=function(_0x3ded3c,_0x13aaea){var _0x558fee={'raw':!![],'where':{'id':_0x3ded3c[_0xbfd2('0x43')]['id']}},_0x236c47={};_0x236c47[_0xbfd2('0x2d')]=_[_0xbfd2('0x2f')](db[_0xbfd2('0x3d')][_0xbfd2('0x2a')]);_0x236c47[_0xbfd2('0x2e')]=_[_0xbfd2('0x2f')](_0x3ded3c[_0xbfd2('0x2e')]);_0x236c47[_0xbfd2('0x30')]=_['intersection'](_0x236c47[_0xbfd2('0x2d')],_0x236c47['query']);_0x558fee[_0xbfd2('0x32')]=_[_0xbfd2('0x31')](_0x236c47['model'],qs[_0xbfd2('0x33')](_0x3ded3c['query'][_0xbfd2('0x33')]));_0x558fee['attributes']=_0x558fee[_0xbfd2('0x32')][_0xbfd2('0x34')]?_0x558fee[_0xbfd2('0x32')]:_0x236c47[_0xbfd2('0x2d')];if(_0x3ded3c[_0xbfd2('0x2e')][_0xbfd2('0x3e')]){_0x558fee[_0xbfd2('0x3f')]=[{'all':!![]}];}_0x558fee=_['merge']({},_0x558fee,_0x3ded3c[_0xbfd2('0x3c')]);return db[_0xbfd2('0x3d')][_0xbfd2('0x44')](_0x558fee)[_0xbfd2('0x23')](handleEntityNotFound(_0x13aaea,null))[_0xbfd2('0x23')](respondWithResult(_0x13aaea,null))[_0xbfd2('0x41')](handleError(_0x13aaea,null));};exports[_0xbfd2('0x45')]=function(_0x9154be,_0x1ddafa){return db[_0xbfd2('0x3d')][_0xbfd2('0x45')](_0x9154be[_0xbfd2('0x46')],{})[_0xbfd2('0x23')](respondWithResult(_0x1ddafa,0xc9))['catch'](handleError(_0x1ddafa,null));};exports[_0xbfd2('0x22')]=function(_0x1d1172,_0x1131b8){if(_0x1d1172[_0xbfd2('0x46')]['id']){delete _0x1d1172[_0xbfd2('0x46')]['id'];}return db['OpenchannelApplication'][_0xbfd2('0x44')]({'where':{'id':_0x1d1172[_0xbfd2('0x43')]['id']}})[_0xbfd2('0x23')](handleEntityNotFound(_0x1131b8,null))[_0xbfd2('0x23')](saveUpdates(_0x1d1172['body'],null))['then'](respondWithResult(_0x1131b8,null))[_0xbfd2('0x41')](handleError(_0x1131b8,null));};exports[_0xbfd2('0x24')]=function(_0xe23b55,_0x4df3e8){return db['OpenchannelApplication'][_0xbfd2('0x44')]({'where':{'id':_0xe23b55['params']['id']}})['then'](handleEntityNotFound(_0x4df3e8,null))['then'](removeEntity(_0x4df3e8,null))['catch'](handleError(_0x4df3e8,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index daa4769..a38e058 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 _0x2a14=['./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x21e5aa,_0x15a5c0){var _0x26e60d=function(_0x4cd6e8){while(--_0x4cd6e8){_0x21e5aa['push'](_0x21e5aa['shift']());}};_0x26e60d(++_0x15a5c0);}(_0x2a14,0x155));var _0x42a1=function(_0x3aa600,_0xee93db){_0x3aa600=_0x3aa600-0x0;var _0x28458e=_0x2a14[_0x3aa600];return _0x28458e;};'use strict';var _=require(_0x42a1('0x0'));var util=require(_0x42a1('0x1'));var logger=require(_0x42a1('0x2'))(_0x42a1('0x3'));var moment=require('moment');var BPromise=require(_0x42a1('0x4'));var rp=require(_0x42a1('0x5'));var fs=require('fs');var path=require(_0x42a1('0x6'));var rimraf=require(_0x42a1('0x7'));var config=require(_0x42a1('0x8'));var attributes=require(_0x42a1('0x9'));module[_0x42a1('0xa')]=function(_0x5e590d,_0x5c756c){return _0x5e590d['define'](_0x42a1('0xb'),attributes,{'tableName':_0x42a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x42a1('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x543d=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x543d,0x198));var _0xd543=function(_0x461935,_0xeaeb6e){_0x461935=_0x461935-0x0;var _0x1f809f=_0x543d[_0x461935];return _0x1f809f;};'use strict';var _=require(_0xd543('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd543('0x1'));var moment=require(_0xd543('0x2'));var BPromise=require(_0xd543('0x3'));var rp=require(_0xd543('0x4'));var fs=require('fs');var path=require(_0xd543('0x5'));var rimraf=require(_0xd543('0x6'));var config=require(_0xd543('0x7'));var attributes=require(_0xd543('0x8'));module[_0xd543('0x9')]=function(_0x4af0d5,_0x5ed24d){return _0x4af0d5['define'](_0xd543('0xa'),attributes,{'tableName':_0xd543('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 0a16de7..1d21f73 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x4a97a9,_0x52552b){var _0x43fb99=function(_0x5e775f){while(--_0x5e775f){_0x4a97a9['push'](_0x4a97a9['shift']());}};_0x43fb99(++_0x52552b);}(_0xb10b,0x12a));var _0xbb10=function(_0x335cfa,_0x1e7634){_0x335cfa=_0x335cfa-0x0;var _0xb7a81b=_0xb10b[_0x335cfa];return _0xb7a81b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x5e002,_0x115a2f){var _0x18f19c=function(_0x5e8c22){while(--_0x5e8c22){_0x5e002['push'](_0x5e002['shift']());}};_0x18f19c(++_0x115a2f);}(_0xb10b,0x12a));var _0xbb10=function(_0xe1770a,_0x4fc5d6){_0xe1770a=_0xe1770a-0x0;var _0x3e6274=_0xb10b[_0xe1770a];return _0x3e6274;};'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 b57e692..da7792e 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 _0xafea=['/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x78335b,_0xb7a172){var _0x863f42=function(_0x4d9624){while(--_0x4d9624){_0x78335b['push'](_0x78335b['shift']());}};_0x863f42(++_0xb7a172);}(_0xafea,0x1c0));var _0xaafe=function(_0x166df0,_0x5d1fb6){_0x166df0=_0x166df0-0x0;var _0x1cba78=_0xafea[_0x166df0];return _0x1cba78;};'use strict';var multer=require(_0xaafe('0x0'));var util=require(_0xaafe('0x1'));var path=require(_0xaafe('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaafe('0x3')]();var auth=require(_0xaafe('0x4'));var interaction=require(_0xaafe('0x5'));var config=require(_0xaafe('0x6'));var controller=require('./openchannelInteraction.controller');router[_0xaafe('0x7')]('/',auth[_0xaafe('0x8')](),controller[_0xaafe('0x9')]);router[_0xaafe('0x7')]('/describe',auth[_0xaafe('0x8')](),controller['describe']);router[_0xaafe('0x7')](_0xaafe('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xaafe('0x7')]('/:id/messages',auth[_0xaafe('0x8')](),controller['getMessages']);router[_0xaafe('0x7')](_0xaafe('0xb'),auth[_0xaafe('0x8')](),controller[_0xaafe('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaafe('0xd')]);router[_0xaafe('0xe')](_0xaafe('0xf'),auth[_0xaafe('0x8')](),controller[_0xaafe('0x10')]);router[_0xaafe('0xe')](_0xaafe('0x11'),auth[_0xaafe('0x8')](),interaction['tracked'](_0xaafe('0x12'),_0xaafe('0x13')),controller[_0xaafe('0x14')]);router[_0xaafe('0x15')](_0xaafe('0xa'),auth[_0xaafe('0x8')](),interaction[_0xaafe('0x16')](_0xaafe('0x12'),_0xaafe('0x17')),controller['update']);router[_0xaafe('0x18')](_0xaafe('0xa'),auth['isAuthenticated'](),interaction[_0xaafe('0x16')]('openchannel',_0xaafe('0x19')),controller[_0xaafe('0x1a')]);router[_0xaafe('0x18')](_0xaafe('0x11'),auth[_0xaafe('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x21b8=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','isAuthenticated','index','get','show','/:id/messages','getMessages','download','create','post','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','/:id','tracked','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path'];(function(_0x4cfd78,_0x52355e){var _0xf4a95a=function(_0x5c2d5b){while(--_0x5c2d5b){_0x4cfd78['push'](_0x4cfd78['shift']());}};_0xf4a95a(++_0x52355e);}(_0x21b8,0x152));var _0x821b=function(_0x5e4776,_0x26997c){_0x5e4776=_0x5e4776-0x0;var _0x3b8e8e=_0x21b8[_0x5e4776];return _0x3b8e8e;};'use strict';var multer=require(_0x821b('0x0'));var util=require(_0x821b('0x1'));var path=require(_0x821b('0x2'));var timeout=require(_0x821b('0x3'));var express=require(_0x821b('0x4'));var router=express[_0x821b('0x5')]();var auth=require(_0x821b('0x6'));var interaction=require(_0x821b('0x7'));var config=require('../../config/environment');var controller=require(_0x821b('0x8'));router['get']('/',auth[_0x821b('0x9')](),controller[_0x821b('0xa')]);router[_0x821b('0xb')]('/describe',auth[_0x821b('0x9')](),controller['describe']);router[_0x821b('0xb')]('/:id',auth[_0x821b('0x9')](),controller[_0x821b('0xc')]);router['get'](_0x821b('0xd'),auth[_0x821b('0x9')](),controller[_0x821b('0xe')]);router[_0x821b('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0x821b('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x821b('0x10')]);router[_0x821b('0x11')](_0x821b('0xd'),auth[_0x821b('0x9')](),controller['addMessage']);router[_0x821b('0x11')](_0x821b('0x12'),auth[_0x821b('0x9')](),interaction['tracked'](_0x821b('0x13'),_0x821b('0x14')),controller[_0x821b('0x15')]);router[_0x821b('0x16')](_0x821b('0x17'),auth['isAuthenticated'](),interaction[_0x821b('0x18')](_0x821b('0x13'),_0x821b('0x19')),controller[_0x821b('0x1a')]);router['delete']('/:id',auth[_0x821b('0x9')](),interaction[_0x821b('0x18')](_0x821b('0x13'),_0x821b('0x1b')),controller[_0x821b('0x1c')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x821b('0x1d')]);module[_0x821b('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 704a2d3..4235eb3 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 _0xb9fc=['STRING','out','BOOLEAN','DATE'];(function(_0x1809c5,_0x46cabc){var _0x5254a4=function(_0xd1d319){while(--_0xd1d319){_0x1809c5['push'](_0x1809c5['shift']());}};_0x5254a4(++_0x46cabc);}(_0xb9fc,0x6e));var _0xcb9f=function(_0x11c2b4,_0x147fd6){_0x11c2b4=_0x11c2b4-0x0;var _0x5cfd74=_0xb9fc[_0x11c2b4];return _0x5cfd74;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xcb9f('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcb9f('0x1')]},'disposition':{'type':Sequelize[_0xcb9f('0x2')]},'secondDisposition':{'type':Sequelize[_0xcb9f('0x2')]},'thirdDisposition':{'type':Sequelize[_0xcb9f('0x2')]},'note':{'type':Sequelize[_0xcb9f('0x2')]},'read1stAt':{'type':Sequelize[_0xcb9f('0x1')]},'threadId':{'type':Sequelize[_0xcb9f('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xcb9f('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xcb9f('0x3')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xcb9f('0x2')]}}; \ No newline at end of file +var _0x51a1=['exports','DATE','STRING','ENUM','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x51a1,0x1b7));var _0x151a=function(_0x324edd,_0x54f20c){_0x324edd=_0x324edd-0x0;var _0x495532=_0x51a1[_0x324edd];return _0x495532;};'use strict';var Sequelize=require(_0x151a('0x0'));module[_0x151a('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x151a('0x2')]},'disposition':{'type':Sequelize[_0x151a('0x3')]},'secondDisposition':{'type':Sequelize[_0x151a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x151a('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x151a('0x2')]},'threadId':{'type':Sequelize[_0x151a('0x3')]},'externalUrl':{'type':Sequelize[_0x151a('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x151a('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 3815be3..b6f9da9 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 _0x0984=['nolimit','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','unreadMessages','value','having','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','count','merge','OpenchannelInteraction','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.lastName','c.email','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','groupBy','push','all','rows','params','includeAll','include','options','create','body','update','describe','addMessage','OpenchannelMessage','ids','getMessages','pick','OpenchannelInteractionId','format','findAll','addTags','omit','spread','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','lastName','Attachment','Messages','direction','secret','Account','Owner','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','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','existsSync','createReadStream','createWriteStream','basename','out','System','firstName','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','err','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','fullname','TagIds','forEach','Tags','catch','index','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty'];(function(_0x5b825a,_0x4d4d06){var _0x29de9f=function(_0x2c7fcd){while(--_0x2c7fcd){_0x5b825a['push'](_0x5b825a['shift']());}};_0x29de9f(++_0x4d4d06);}(_0x0984,0x1b0));var _0x4098=function(_0x2006cf,_0x410386){_0x2006cf=_0x2006cf-0x0;var _0x437451=_0x0984[_0x2006cf];return _0x437451;};'use strict';var pdf=require(_0x4098('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4098('0x1'));var zipdir=require(_0x4098('0x2'));var jsonpatch=require(_0x4098('0x3'));var rp=require(_0x4098('0x4'));var moment=require(_0x4098('0x5'));var BPromise=require(_0x4098('0x6'));var Mustache=require(_0x4098('0x7'));var util=require(_0x4098('0x8'));var path=require(_0x4098('0x9'));var sox=require(_0x4098('0xa'));var csv=require(_0x4098('0xb'));var ejs=require(_0x4098('0xc'));var fs=require('fs');var _=require(_0x4098('0xd'));var squel=require(_0x4098('0xe'));var crypto=require(_0x4098('0xf'));var jsforce=require(_0x4098('0x10'));var deskjs=require(_0x4098('0x11'));var toCsv=require('to-csv');var querystring=require(_0x4098('0x12'));var Papa=require('papaparse');var Redis=require(_0x4098('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4098('0x14'));var as=require(_0x4098('0x15'));var hardwareService=require(_0x4098('0x16'));var logger=require('../../config/logger')(_0x4098('0x17'));var utils=require(_0x4098('0x18'));var config=require(_0x4098('0x19'));var licenseUtil=require(_0x4098('0x1a'));var db=require(_0x4098('0x1b'))['db'];config[_0x4098('0x1c')]=_[_0x4098('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4098('0x1e'))[_0x4098('0x1f')](socket);function respondWithStatusCode(_0x35b722,_0x5d7ca9){_0x5d7ca9=_0x5d7ca9||0xcc;return function(_0x605812){if(_0x605812){return _0x35b722[_0x4098('0x20')](_0x5d7ca9);}return _0x35b722[_0x4098('0x21')](_0x5d7ca9)[_0x4098('0x22')]();};}function respondWithResult(_0xe5e3a,_0x1eed9f){_0x1eed9f=_0x1eed9f||0xc8;return function(_0x3be17c){if(_0x3be17c){return _0xe5e3a['status'](_0x1eed9f)[_0x4098('0x23')](_0x3be17c);}};}function respondWithFilteredResult(_0x5647fd,_0x4c225d){return function(_0x57967f){if(_0x57967f){var _0x49e45a=_0x57967f['count'],_0x473e33=_0x4c225d['offset'],_0x5add97=_0x4c225d[_0x4098('0x24')]+_0x4c225d[_0x4098('0x25')],_0x1097c9;if(_0x5add97>=_0x49e45a){_0x5add97=_0x49e45a;_0x1097c9=0xc8;}else{_0x1097c9=0xce;}_0x5647fd[_0x4098('0x21')](_0x1097c9);return _0x5647fd[_0x4098('0x26')](_0x4098('0x27'),_0x473e33+'-'+_0x5add97+'/'+_0x49e45a)[_0x4098('0x23')](_0x57967f);}return null;};}function patchUpdates(_0x5347c3){return function(_0x1ad5a8){try{jsonpatch[_0x4098('0x28')](_0x1ad5a8,_0x5347c3,!![]);}catch(_0x19ac85){return BPromise[_0x4098('0x29')](_0x19ac85);}return _0x1ad5a8[_0x4098('0x2a')]();};}function saveUpdates(_0xc223d3,_0x421fac){return function(_0x2be75b){if(_0x2be75b){return _0x2be75b['update'](_0xc223d3)[_0x4098('0x2b')](function(_0x5cea0f){return _0x5cea0f;});}return null;};}function removeEntity(_0x93f80d,_0x5cc553){return function(_0x57fbcb){if(_0x57fbcb){return _0x57fbcb[_0x4098('0x2c')]()[_0x4098('0x2b')](function(){_0x93f80d[_0x4098('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x350176,_0x26b3c3){return function(_0x3c854e){if(!_0x3c854e){_0x350176[_0x4098('0x20')](0x194);}return _0x3c854e;};}function handleError(_0x538ad4,_0x4190e8){_0x4190e8=_0x4190e8||0x1f4;return function(_0x1d4318){logger[_0x4098('0x2d')](_0x1d4318[_0x4098('0x2e')]);if(_0x1d4318[_0x4098('0x2f')]){delete _0x1d4318[_0x4098('0x2f')];}_0x538ad4[_0x4098('0x21')](_0x4190e8)[_0x4098('0x30')](_0x1d4318);};}function getInteractionUsers(_0x3215f2,_0x463e83){return new BPromise(function(_0x1dab6c,_0x24de01){try{if(_0x463e83[_0x3215f2['id']]){_0x3215f2['Users']=_[_0x4098('0x31')](_0x463e83[_0x3215f2['id']],function(_0x30443c){return{'id':_0x30443c['id'],'fullname':_0x30443c[_0x4098('0x32')]};});}}catch(_0x3ea09e){_0x24de01(_0x3ea09e);}_0x1dab6c(_0x3215f2);});}function getInteractionTags(_0xb7aa8d,_0x167d36){return new BPromise(function(_0x4f5c9d,_0xecc2b7){try{if(_0xb7aa8d[_0x4098('0x33')]){_0xb7aa8d['Tags']=[];_0xb7aa8d[_0x4098('0x33')]['split'](',')[_0x4098('0x34')](function(_0x287486){_0xb7aa8d[_0x4098('0x35')]['push'](_0x167d36[_0x287486]);});}delete _0xb7aa8d[_0x4098('0x33')];}catch(_0x26d69b){_0xecc2b7(_0x26d69b);}_0x4f5c9d(_0xb7aa8d);});}function updateOpenchannelInteraction(_0x352bbe,_0xd801d9,_0x1a6c91){return new BPromise(function(_0x419ae7,_0x4ec406){return getInteractionUsers(_0x352bbe,_0x1a6c91)[_0x4098('0x2b')](function(_0xd2fa43){return getInteractionTags(_0xd2fa43,_0xd801d9);})[_0x4098('0x2b')](function(_0xe7c5ac){_0x419ae7(_0xe7c5ac);})[_0x4098('0x36')](function(_0x1504f8){_0x4ec406(_0x1504f8);});});}exports[_0x4098('0x37')]=function(_0x168442,_0x439f1b){var _0x2f8d2d={},_0x3efc8f={},_0xa06c8c={'count':0x0,'rows':[]};var _0x5e13cf=_[_0x4098('0x31')](db['OpenchannelInteraction'][_0x4098('0x38')],function(_0xe76dc5){return{'name':_0xe76dc5[_0x4098('0x39')],'type':_0xe76dc5[_0x4098('0x3a')][_0x4098('0x3b')]};});_0x3efc8f['model']=_[_0x4098('0x31')](_0x5e13cf,_0x4098('0x2f'));_0x3efc8f['query']=_[_0x4098('0x3c')](_0x168442[_0x4098('0x3d')]);_0x3efc8f[_0x4098('0x3e')]=_[_0x4098('0x3f')](_0x3efc8f[_0x4098('0x40')],_0x3efc8f[_0x4098('0x3d')]);_0x2f8d2d[_0x4098('0x41')]=_[_0x4098('0x3f')](_0x3efc8f[_0x4098('0x40')],qs[_0x4098('0x42')](_0x168442['query'][_0x4098('0x42')]));_0x2f8d2d['attributes']=_0x2f8d2d['attributes']['length']?_0x2f8d2d[_0x4098('0x41')]:_0x3efc8f['model'];if(!_0x168442[_0x4098('0x3d')][_0x4098('0x43')](_0x4098('0x44'))){_0x2f8d2d[_0x4098('0x25')]=qs[_0x4098('0x25')](_0x168442[_0x4098('0x3d')][_0x4098('0x25')]);_0x2f8d2d[_0x4098('0x24')]=qs[_0x4098('0x24')](_0x168442[_0x4098('0x3d')][_0x4098('0x24')]);}_0x2f8d2d[_0x4098('0x45')]=qs[_0x4098('0x46')](_0x168442[_0x4098('0x3d')][_0x4098('0x46')]);_0x2f8d2d[_0x4098('0x47')]=qs[_0x4098('0x3e')](_['pick'](_0x168442[_0x4098('0x3d')],_0x3efc8f['filters']),_0x5e13cf);var _0x301494=[];var _0x5e5ff4=squel[_0x4098('0x48')]()[_0x4098('0x49')]('id')[_0x4098('0x49')](_0x4098('0x2f'))['field'](_0x4098('0x4a'))[_0x4098('0x4b')](_0x4098('0x4c'));var _0x415c53=squel['select']()[_0x4098('0x49')](_0x4098('0x4d'))[_0x4098('0x49')](_0x4098('0x4e'))[_0x4098('0x49')]('ui.OpenchannelInteractionId')[_0x4098('0x4b')](_0x4098('0x4f'),'ui')[_0x4098('0x50')](_0x4098('0x51'),'u',_0x4098('0x52'));var _0x3cde74=squel['select']()['from'](_0x4098('0x53'),'i')[_0x4098('0x50')](_0x4098('0x54'),'c',_0x4098('0x55'))[_0x4098('0x50')]('users','o',_0x4098('0x56'))[_0x4098('0x50')](_0x4098('0x57'),'a',_0x4098('0x58'))[_0x4098('0x50')](_0x4098('0x59'),'me',_0x4098('0x5a'))[_0x4098('0x50')](_0x4098('0x5b'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x4098('0x50')](_0x4098('0x4c'),'t',_0x4098('0x5c'));var _0x2ecc6f=squel[_0x4098('0x5d')]();var _0x429ad6=[];var _0x2d14c9=squel[_0x4098('0x5d')]();var _0x4dfe9b;if(_0x168442[_0x4098('0x3d')][_0x4098('0x5e')]){_0x4dfe9b=as[_0x4098('0x5f')](_0x168442['query']['search']);var _0x101a52=_0x4dfe9b[_0x4098('0x60')];for(var _0x296884=0x0;_0x296884<_0x4dfe9b['conditions'][_0x4098('0x61')];_0x296884++){var _0x2db56f=_0x4dfe9b[_0x4098('0x62')][_0x296884];var _0x4b222f='i';var _0x4777e8=_['find'](_0x5e13cf,['name',_0x2db56f[_0x4098('0x49')]]);if(!_0x4777e8){switch(_0x2db56f[_0x4098('0x49')]){case _0x4098('0x63'):if(_0x2db56f[_0x4098('0x64')]==0x1){_0x3cde74['having']('`'+_0x2db56f[_0x4098('0x49')]+'`\x20=\x200');}else{_0x3cde74[_0x4098('0x65')]('`'+_0x2db56f[_0x4098('0x49')]+'`\x20>\x200');}break;case _0x4098('0x66'):if(_0x2db56f[_0x4098('0x67')]===_0x4098('0x68')){if(_0x2db56f[_0x4098('0x64')]['split']('\x20')['length']>0x1){_0x2ecc6f[_0x101a52]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4098('0x69')](_0x2db56f[_0x4098('0x64')]),null);}else{var _0x112ff9='%'+_0x2db56f[_0x4098('0x64')]+'%';_0x2ecc6f[_0x101a52](_0x4098('0x6a'),_0x112ff9,_0x112ff9,_0x112ff9);}}else{_0x4777e8=_[_0x4098('0x6b')](_0x5e13cf,['name',_0x4098('0x6c')]);_0x2db56f[_0x4098('0x49')]=_0x4098('0x6c');_0x2493ab=as[_0x4098('0x6d')](_0x4b222f,_0x4777e8['type'],_0x2db56f);_0x2ecc6f[_0x101a52](_0x2493ab['text'],_0x2493ab['value'][_0x4098('0x6e')],_0x2493ab[_0x4098('0x64')][_0x4098('0x22')]);}break;case _0x4098('0x6f'):var _0x474cfa=_0x2db56f[_0x4098('0x64')][_0x4098('0x70')](',')[_0x4098('0x31')](function(_0x57ad9e){return Number(_0x57ad9e);});_0x474cfa[_0x4098('0x34')](function(_0x4ce501){_0x2d14c9['or'](_0x4098('0x71'),'%,'+_0x4ce501+',%');});_0x429ad6=_[_0x4098('0x72')](_0x429ad6,_0x474cfa);break;case _0x4098('0x73'):if(_0x2db56f[_0x4098('0x67')]===_0x4098('0x68')){_0x2ecc6f[_0x101a52](_0x4098('0x74'),'%'+_0x2db56f[_0x4098('0x64')]+'%',null);}else{_0x4777e8=_['find'](_0x5e13cf,[_0x4098('0x2f'),'UserId']);_0x2db56f[_0x4098('0x49')]='UserId';_0x2493ab=as[_0x4098('0x6d')](_0x4b222f,_0x4777e8['type'],_0x2db56f);_0x2ecc6f[_0x101a52](_0x2493ab[_0x4098('0x75')],_0x2493ab[_0x4098('0x64')]['start'],_0x2493ab[_0x4098('0x64')][_0x4098('0x22')]);}break;case'body':_0x2493ab=as[_0x4098('0x6d')]('me',null,_0x2db56f);_0x2ecc6f[_0x101a52](_0x2493ab[_0x4098('0x75')],_0x2493ab['value'][_0x4098('0x6e')],_0x2493ab[_0x4098('0x64')][_0x4098('0x22')]);break;}}else{var _0x2493ab=as[_0x4098('0x6d')](_0x4b222f,_0x4777e8[_0x4098('0x3a')],_0x2db56f);_0x2ecc6f[_0x101a52](_0x2493ab[_0x4098('0x75')],_0x2493ab[_0x4098('0x64')]['start'],_0x2493ab[_0x4098('0x64')][_0x4098('0x22')]);}}}else{var _0x485947=_(_0x168442[_0x4098('0x3d')])[_0x4098('0x3c')]()['map'](function(_0x33be12){return _[_0x4098('0x76')](_0x5e13cf,[_0x4098('0x2f'),_0x33be12])?_0x33be12:undefined;})[_0x4098('0x77')]()[_0x4098('0x64')]();if(!_[_0x4098('0x78')](_0x485947)){_0x485947[_0x4098('0x34')](function(_0xa199d2){if(_0xa199d2==='OpenchannelAccountId'){_0x3cde74['where'](_0x4098('0x79'),[][_0x4098('0x7a')](_0x168442[_0x4098('0x3d')][_0xa199d2]));}else if(_0xa199d2===_0x4098('0x7b')){var _0x7e0bc=JSON[_0x4098('0x7c')](_0x168442[_0x4098('0x3d')][_0xa199d2])[_0x4098('0x7d')];var _0x454a04=JSON[_0x4098('0x7c')](_0x168442[_0x4098('0x3d')][_0xa199d2])[_0x4098('0x7e')];_0x3cde74[_0x4098('0x47')](_0x4098('0x7f'),_0x7e0bc,_0x454a04);}else{if(_0x168442[_0x4098('0x3d')][_0xa199d2]===_0x4098('0x80')){_0x3cde74['where']('i.'+_0xa199d2+_0x4098('0x81'));}else{_0x3cde74[_0x4098('0x47')]('i.'+_0xa199d2+'\x20=\x20?',_0x168442[_0x4098('0x3d')][_0xa199d2]);}}});}if(_0x168442[_0x4098('0x3d')]['read']){if(_0x168442[_0x4098('0x3d')][_0x4098('0x82')]==0x1){_0x3cde74[_0x4098('0x65')](_0x4098('0x83'));}else{_0x3cde74[_0x4098('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x168442['query']['tag']){_0x429ad6=_[_0x4098('0x84')](_0x168442['query']['tag'])?_0x168442['query']['tag']:new Array(_0x168442[_0x4098('0x3d')]['tag']);_0x429ad6[_0x4098('0x34')](function(_0x15c6e2){_0x2d14c9['or'](_0x4098('0x71'),'%,'+_0x15c6e2+',%');});}if(_0x168442[_0x4098('0x3d')]['filter']){var _0x7f50b5=_0x168442['query'][_0x4098('0x85')][_0x4098('0x86')]('\x5c','\x5c\x5c')[_0x4098('0x86')](/'/g,'\x27\x27');if(qs[_0x4098('0x87')](_0x7f50b5)){_0x2ecc6f['or'](_0x4098('0x88'),_0x7f50b5+'%');}else{_0x2ecc6f['or'](_0x4098('0x89'),qs['getFullTextValue'](_0x7f50b5))['or'](_0x4098('0x8a'),_0x7f50b5+'%')['or'](_0x4098('0x8b'),_0x7f50b5+'%');}}}_0x3cde74[_0x4098('0x47')](_0x2ecc6f);_0x3cde74[_0x4098('0x8c')](_0x4098('0x8d'));var _0x3ee37a={'type':db[_0x4098('0x8e')][_0x4098('0x8f')][_0x4098('0x90')],'raw':!![]};var _0x4f58cf=_0x3cde74[_0x4098('0x91')]();_0x4f58cf[_0x4098('0x49')]('i.id');_0x4f58cf['field'](_0x4098('0x92'),_0x4098('0x63'));if(_0x2f8d2d[_0x4098('0x45')]){_0x2f8d2d['order']['forEach'](function(_0x31f646){var _0x2e3c0b=_0x31f646[0x0]===_0x4098('0x93')?_0x31f646[0x0]:'i.'+_0x31f646[0x0];_0x3cde74[_0x4098('0x45')](_0x2e3c0b,_0x31f646[0x1]===_0x4098('0x94')?![]:!![]);});}if(!_[_0x4098('0x78')](_0x429ad6)){_0x3cde74['having'](_0x2d14c9);_0x4f58cf[_0x4098('0x47')](_0x4098('0x95'),_0x429ad6);}BPromise[_0x4098('0x96')]()['then'](function(){if(!_0x4dfe9b){if(_0x168442['query'][_0x4098('0x97')]||_0x168442[_0x4098('0x3d')][_0x4098('0x98')])return;_0x4f58cf[_0x4098('0x47')](_0x4098('0x99'));_0x3cde74['where'](_0x4098('0x99'));return;}if(_0x168442[_0x4098('0x9a')]['role']!==_0x4098('0x9b'))return;return _0x168442[_0x4098('0x9a')][_0x4098('0x9c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x272197){if(_[_0x4098('0x78')](_0x272197)){_0x4f58cf[_0x4098('0x47')](_0x4098('0x9d'));_0x3cde74[_0x4098('0x47')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x4f58cf[_0x4098('0x47')](_0x4098('0x79'),_[_0x4098('0x31')](_0x272197,'id'));_0x3cde74[_0x4098('0x47')](_0x4098('0x79'),_[_0x4098('0x31')](_0x272197,'id'));}});})[_0x4098('0x2b')](function(){if(_0x168442[_0x4098('0x9a')][_0x4098('0x9e')]==='agent'&&!_0x4dfe9b&&!_0x168442[_0x4098('0x3d')][_0x4098('0x97')])return[];return db[_0x4098('0x9f')]['query'](_0x4f58cf['toString'](),_0x3ee37a);})['then'](function(_0x3c1516){_0xa06c8c['count']=_0x3c1516[_0x4098('0x61')];if(_0xa06c8c[_0x4098('0xa0')]===0x0)return[];return db[_0x4098('0x9f')][_0x4098('0x3d')](_0x5e5ff4['toString'](),_0x3ee37a)['then'](function(_0x2c04bd){_0x301494=_['keyBy'](_0x2c04bd,'id');_0x3ee37a=_[_0x4098('0xa1')](_0x3ee37a,{'model':db[_0x4098('0xa2')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x168442['query'][_0x4098('0x42')]){_0x2f8d2d[_0x4098('0x41')][_0x4098('0x34')](function(_0x8a5cec){_0x3cde74[_0x4098('0x49')]('i.'+_0x8a5cec);});}else{_0x3cde74['field'](_0x4098('0x92'),_0x4098('0x63'));_0x3cde74[_0x4098('0x49')]('a.key',_0x4098('0xa3'));_0x3cde74[_0x4098('0x49')](_0x4098('0xa4'),_0x4098('0xa5'));_0x3cde74[_0x4098('0x49')](_0x4098('0xa6'),_0x4098('0x93'));_0x3cde74['field'](_0x4098('0xa7'));_0x3cde74[_0x4098('0x49')](_0x4098('0xa8'),'Contact.firstName');_0x3cde74[_0x4098('0x49')]('c.lastName',_0x4098('0xa9'));_0x3cde74[_0x4098('0x49')](_0x4098('0xaa'),'Contact.email');_0x3cde74[_0x4098('0x49')]('c.phone',_0x4098('0xab'));_0x3cde74['field']('c.mobile',_0x4098('0xac'));_0x3cde74[_0x4098('0x49')]('c.fax',_0x4098('0xad'));_0x3cde74[_0x4098('0x49')](_0x4098('0xae'),_0x4098('0xaf'));_0x3cde74[_0x4098('0x49')](_0x4098('0xb0'),_0x4098('0xb1'));_0x3cde74[_0x4098('0x49')](_0x4098('0xb2'),_0x4098('0x33'));}if(_0x2f8d2d['limit'])_0x3cde74[_0x4098('0x25')](_0x2f8d2d[_0x4098('0x25')]);if(_0x2f8d2d['offset'])_0x3cde74['offset'](_0x2f8d2d['offset']);return db['sequelize'][_0x4098('0x3d')](_0x3cde74[_0x4098('0xb3')](),_0x3ee37a);})[_0x4098('0x2b')](function(_0x17b07b){_0x415c53[_0x4098('0x47')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x17b07b,'id'));return db['sequelize'][_0x4098('0x3d')](_0x415c53[_0x4098('0xb3')](),_0x3ee37a)[_0x4098('0x2b')](function(_0x261bfe){var _0x1f828d=_[_0x4098('0xb4')](_0x261bfe,'OpenchannelInteractionId');var _0x4ae46a=[];_0x17b07b['forEach'](function(_0x1906c8){_0x4ae46a[_0x4098('0xb5')](updateOpenchannelInteraction(_0x1906c8,_0x301494,_0x1f828d));});return BPromise[_0x4098('0xb6')](_0x4ae46a);});});})['then'](function(_0x206d16){_0xa06c8c[_0x4098('0xb7')]=_0x206d16;return _0xa06c8c;})[_0x4098('0x2b')](respondWithFilteredResult(_0x439f1b,_0x2f8d2d))[_0x4098('0x36')](handleError(_0x439f1b,null));};exports['show']=function(_0xcdeec1,_0x26964d){var _0x3ab4ad={};if(_0xcdeec1[_0x4098('0x3d')][_0x4098('0x3a')]&&_0xcdeec1[_0x4098('0x3d')]['type']===_0x4098('0x4b')){_0x3ab4ad['from']=_0xcdeec1[_0x4098('0xb8')]['id'];}else{_0x3ab4ad['id']=_0xcdeec1[_0x4098('0xb8')]['id'];}var _0x380c18={'raw':![],'where':_0x3ab4ad},_0x332587={};_0x332587[_0x4098('0x40')]=_[_0x4098('0x3c')](db[_0x4098('0xa2')][_0x4098('0x38')]);_0x332587[_0x4098('0x3d')]=_[_0x4098('0x3c')](_0xcdeec1[_0x4098('0x3d')]);_0x332587['filters']=_[_0x4098('0x3f')](_0x332587['model'],_0x332587[_0x4098('0x3d')]);_0x380c18['attributes']=_[_0x4098('0x3f')](_0x332587[_0x4098('0x40')],qs[_0x4098('0x42')](_0xcdeec1[_0x4098('0x3d')][_0x4098('0x42')]));_0x380c18['attributes']=_0x380c18[_0x4098('0x41')][_0x4098('0x61')]?_0x380c18[_0x4098('0x41')]:_0x332587[_0x4098('0x40')];if(_0xcdeec1[_0x4098('0x3d')][_0x4098('0xb9')]){_0x380c18[_0x4098('0xba')]=[{'all':!![]}];}_0x380c18=_[_0x4098('0xa1')]({},_0x380c18,_0xcdeec1[_0x4098('0xbb')]);return db['OpenchannelInteraction'][_0x4098('0x6b')](_0x380c18)[_0x4098('0x2b')](handleEntityNotFound(_0x26964d,null))[_0x4098('0x2b')](respondWithResult(_0x26964d,null))[_0x4098('0x36')](handleError(_0x26964d,null));};exports[_0x4098('0xbc')]=function(_0x2b76cb,_0xfcdb46){return db['OpenchannelInteraction'][_0x4098('0xbc')](_0x2b76cb[_0x4098('0xbd')],{})[_0x4098('0x2b')](respondWithResult(_0xfcdb46,0xc9))['catch'](handleError(_0xfcdb46,null));};exports[_0x4098('0xbe')]=function(_0x3a6911,_0x408101){if(_0x3a6911[_0x4098('0xbd')]['id']){delete _0x3a6911[_0x4098('0xbd')]['id'];}return db[_0x4098('0xa2')]['find']({'where':{'id':_0x3a6911[_0x4098('0xb8')]['id']}})[_0x4098('0x2b')](handleEntityNotFound(_0x408101,null))[_0x4098('0x2b')](saveUpdates(_0x3a6911['body'],null))[_0x4098('0x2b')](respondWithResult(_0x408101,null))[_0x4098('0x36')](handleError(_0x408101,null));};exports[_0x4098('0x2c')]=function(_0x444d33,_0x49441d){return db[_0x4098('0xa2')]['find']({'where':{'id':_0x444d33['params']['id']}})[_0x4098('0x2b')](handleEntityNotFound(_0x49441d,null))[_0x4098('0x2b')](removeEntity(_0x49441d,null))[_0x4098('0x36')](handleError(_0x49441d,null));};exports[_0x4098('0xbf')]=function(_0x5e27ec,_0x5095c6){return db[_0x4098('0xa2')][_0x4098('0xbf')]()['then'](respondWithResult(_0x5095c6,null))[_0x4098('0x36')](handleError(_0x5095c6,null));};exports[_0x4098('0xc0')]=function(_0x3bff85,_0x37c718,_0x47b28f){return db[_0x4098('0xc1')][_0x4098('0x6b')]({'where':{'id':_0x3bff85[_0x4098('0xb8')]['id']}})['then'](handleEntityNotFound(_0x37c718,null))[_0x4098('0x2b')](function(_0xf559d5){if(_0xf559d5){return _0xf559d5[_0x4098('0xc0')](_0x3bff85[_0x4098('0xbd')][_0x4098('0xc2')],_['omit'](_0x3bff85[_0x4098('0xbd')],['ids','id'])||{});}})[_0x4098('0x2b')](respondWithResult(_0x37c718,null))[_0x4098('0x36')](handleError(_0x37c718,null));};exports[_0x4098('0xc3')]=function(_0x3670b5,_0x541bc3,_0x3afec3){var _0x180bd0={'raw':![],'where':{}};var _0x8c8781={};var _0x4b5a4e={'count':0x0,'rows':[]};return db[_0x4098('0xa2')]['findOne']({'where':{'id':_0x3670b5['params']['id']}})[_0x4098('0x2b')](handleEntityNotFound(_0x541bc3,null))['then'](function(_0x9d89df){if(_0x9d89df){_0x8c8781[_0x4098('0x40')]=_[_0x4098('0x3c')](db[_0x4098('0xc1')]['rawAttributes']);_0x8c8781[_0x4098('0x3d')]=_[_0x4098('0x3c')](_0x3670b5[_0x4098('0x3d')]);_0x8c8781['filters']=_['intersection'](_0x8c8781['model'],_0x8c8781['query']);_0x180bd0[_0x4098('0x41')]=_['intersection'](_0x8c8781[_0x4098('0x40')],qs[_0x4098('0x42')](_0x3670b5[_0x4098('0x3d')][_0x4098('0x42')]));_0x180bd0[_0x4098('0x41')]=_0x180bd0['attributes'][_0x4098('0x61')]?_0x180bd0[_0x4098('0x41')]:_0x8c8781[_0x4098('0x40')];if(!_0x3670b5[_0x4098('0x3d')][_0x4098('0x43')]('nolimit')){_0x180bd0[_0x4098('0x25')]=qs[_0x4098('0x25')](_0x3670b5[_0x4098('0x3d')][_0x4098('0x25')]);_0x180bd0[_0x4098('0x24')]=qs['offset'](_0x3670b5[_0x4098('0x3d')][_0x4098('0x24')]);}_0x180bd0[_0x4098('0x45')]=qs['sort'](_0x3670b5['query']['sort']);_0x180bd0[_0x4098('0x47')]=qs[_0x4098('0x3e')](_[_0x4098('0xc4')](_0x3670b5[_0x4098('0x3d')],_0x8c8781[_0x4098('0x3e')]));_0x180bd0[_0x4098('0x47')][_0x4098('0xc5')]=_0x9d89df['id'];if(_0x3670b5['query'][_0x4098('0x85')]){_0x180bd0[_0x4098('0x47')]=_[_0x4098('0xa1')](_0x180bd0[_0x4098('0x47')],{'$or':_['map'](_0x180bd0[_0x4098('0x41')],function(_0x26aa05){var _0x2e88b3={};_0x2e88b3[_0x26aa05]={'$like':'%'+_0x3670b5[_0x4098('0x3d')][_0x4098('0x85')]+'%'};return _0x2e88b3;})});}if(_0x3670b5[_0x4098('0x3d')][_0x4098('0x7d')]){var _0x728b71=_0x3670b5['query'][_0x4098('0x7d')][_0x4098('0x70')](',');var _0x185097={};_0x185097[_0x728b71[0x0]]={'$gte':moment(_0x728b71[0x1])[_0x4098('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x180bd0[_0x4098('0x47')]=_[_0x4098('0xa1')](_0x180bd0[_0x4098('0x47')],_0x185097);}_0x180bd0=_[_0x4098('0xa1')]({},_0x180bd0,_0x3670b5['options']);return db[_0x4098('0xc1')][_0x4098('0xa0')]({'where':_0x180bd0['where']})[_0x4098('0x2b')](function(_0x3cde79){_0x4b5a4e[_0x4098('0xa0')]=_0x3cde79;if(_0x3670b5[_0x4098('0x3d')][_0x4098('0xb9')]){_0x180bd0['include']=[{'all':!![]}];}return db[_0x4098('0xc1')][_0x4098('0xc7')](_0x180bd0);})['then'](function(_0x3024b4){_0x4b5a4e[_0x4098('0xb7')]=_0x3024b4;return _0x4b5a4e;});}})[_0x4098('0x2b')](respondWithFilteredResult(_0x541bc3,_0x180bd0))[_0x4098('0x36')](handleError(_0x541bc3,null));};exports[_0x4098('0xc8')]=function(_0xd6d9ae,_0x29d3c1,_0xfb9787){return db[_0x4098('0xa2')]['find']({'where':{'id':_0xd6d9ae['params']['id']}})['then'](handleEntityNotFound(_0x29d3c1,null))['then'](function(_0x322f38){if(_0x322f38){return _0x322f38['setTags'](_0xd6d9ae[_0x4098('0xbd')]['ids'],_[_0x4098('0xc9')](_0xd6d9ae[_0x4098('0xbd')],[_0x4098('0xc2'),'id'])||{})[_0x4098('0xca')](function(){return db[_0x4098('0x6f')][_0x4098('0xc7')]({'attributes':['id',_0x4098('0x2f'),_0x4098('0x4a')],'where':{'id':_0xd6d9ae[_0x4098('0xbd')]['ids']}});})[_0x4098('0x2b')](function(_0x278c7e){socket[_0x4098('0xcb')](_0x4098('0xcc'),{'id':Number(_0xd6d9ae[_0x4098('0xb8')]['id']),'tags':_0x278c7e||[]});return{'id':Number(_0xd6d9ae[_0x4098('0xb8')]['id']),'tags':_0x278c7e||[]};});}})['then'](respondWithResult(_0x29d3c1,null))[_0x4098('0x36')](handleError(_0x29d3c1,null));};exports[_0x4098('0xcd')]=function(_0xfad477,_0xca7f42,_0x11fee6){return db[_0x4098('0xa2')][_0x4098('0x6b')]({'where':{'id':_0xfad477[_0x4098('0xb8')]['id']}})[_0x4098('0x2b')](handleEntityNotFound(_0xca7f42,null))[_0x4098('0x2b')](function(_0x26f238){if(_0x26f238){return _0x26f238[_0x4098('0xcd')](_0xfad477[_0x4098('0x3d')][_0x4098('0xc2')]);}})['then'](respondWithStatusCode(_0xca7f42,null))[_0x4098('0x36')](handleError(_0xca7f42,null));};exports[_0x4098('0xce')]=function(_0x470cb4,_0x1478a0){var _0x3a9cfa=moment()['unix']()[_0x4098('0xb3')]();var _0x47ba6f=path[_0x4098('0xcf')](config[_0x4098('0xd0')],_0x4098('0xd1'),_0x4098('0xd2'),_0x4098('0xd3'));var _0x429ff1=path[_0x4098('0xcf')](config[_0x4098('0xd0')],_0x4098('0xd1'),'files',_0x4098('0xd4'));var _0x261611=path['join'](_0x47ba6f,_0x3a9cfa);var _0x2e6039=util[_0x4098('0xc6')](_0x4098('0xd5'),_0x470cb4['params']['id'],_0x3a9cfa);var _0x2bc728=path[_0x4098('0xcf')](_0x47ba6f,_0x2e6039);var _0x10165c=[];_0x10165c[_0x4098('0xb5')]({'model':db[_0x4098('0x73')],'as':_0x4098('0x73'),'attributes':['id',_0x4098('0x32')],'raw':!![]});_0x10165c[_0x4098('0xb5')]({'model':db[_0x4098('0xd6')],'as':_0x4098('0x66'),'attributes':['id','firstName',_0x4098('0xd7')],'raw':!![]});if(_0x470cb4['query'][_0x4098('0xd4')]){_0x10165c[_0x4098('0xb5')]({'model':db[_0x4098('0xd8')],'as':'Attachment','raw':!![]});}var _0x809b93=[{'model':db['OpenchannelMessage'],'as':_0x4098('0xd9'),'attributes':['id',_0x4098('0xbd'),_0x4098('0x7b'),_0x4098('0xda'),_0x4098('0xdb'),_0x4098('0x82')],'include':_0x10165c}];_0x809b93[_0x4098('0xb5')]({'model':db['OpenchannelAccount'],'as':_0x4098('0xdc'),'attributes':['id',_0x4098('0x2f')]});_0x809b93[_0x4098('0xb5')]({'model':db[_0x4098('0x73')],'as':_0x4098('0xdd'),'attributes':['id','fullname']});return db[_0x4098('0xa2')]['find']({'where':{'id':_0x470cb4[_0x4098('0xb8')]['id']},'include':_0x809b93})[_0x4098('0x2b')](handleEntityNotFound(_0x1478a0,null))[_0x4098('0x2b')](function(_0x33ac36){if(_0x33ac36){var _0x59f52c=_0x33ac36['get']({'plain':!![]});fs['mkdirSync'](_0x261611);var _0x5657cf={'format':'A4','border':_0x4098('0xde'),'header':{'height':_0x4098('0xdf'),'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':_0x4098('0xe0'),'contents':{'default':util[_0x4098('0xc6')](_0x4098('0xe1'),util[_0x4098('0xc6')](_0x4098('0xe2'),_0x4098('0xe3'),_0x59f52c['id']),moment()[_0x4098('0xc6')](_0x4098('0xe4'))[_0x4098('0xb3')]())}}};var _0x259ac0={'channel':'Openchannel','account':_0x59f52c[_0x4098('0xdc')][_0x4098('0x2f')],'agent':_0x59f52c[_0x4098('0xdd')]?_0x59f52c['Owner'][_0x4098('0x32')]:_0x4098('0xe5'),'createdAt':moment(_0x59f52c[_0x4098('0x7b')])['format'](_0x4098('0xe6'))[_0x4098('0xb3')](),'closedAt':_0x59f52c[_0x4098('0xe7')]?moment(_0x59f52c[_0x4098('0xe8')])[_0x4098('0xc6')](_0x4098('0xe6'))[_0x4098('0xb3')]():'','disposition':_0x59f52c[_0x4098('0xe9')],'visibility':_0x59f52c[_0x4098('0xea')]?_0x4098('0xeb'):'Private','messages':_(_0x59f52c[_0x4098('0xd9')])[_0x4098('0x85')]({'secret':![]})[_0x4098('0x31')](function(_0x1f5719){if(_0x1f5719[_0x4098('0xd8')]){var _0x50dcaa=path[_0x4098('0xcf')](_0x429ff1,_0x1f5719['Attachment']['basename']);if(fs[_0x4098('0xec')](_0x50dcaa)){fs[_0x4098('0xed')](_0x50dcaa)['pipe'](fs[_0x4098('0xee')](path[_0x4098('0xcf')](_0x261611,_0x1f5719[_0x4098('0xd8')][_0x4098('0xef')])));}}return{'date':moment(_0x1f5719[_0x4098('0x7b')])[_0x4098('0xc6')](_0x4098('0xe6'))[_0x4098('0xb3')](),'sender':_0x1f5719[_0x4098('0xda')]===_0x4098('0xf0')?_0x1f5719['User']?_0x1f5719[_0x4098('0x73')][_0x4098('0x32')]:_0x4098('0xf1'):_0x1f5719[_0x4098('0x66')][_0x4098('0xf2')]+(_0x1f5719[_0x4098('0x66')][_0x4098('0xd7')]?'\x20'+_0x1f5719['Contact'][_0x4098('0xd7')]:''),'body':_0x1f5719[_0x4098('0xd8')]?_0x1f5719[_0x4098('0xd8')][_0x4098('0xef')]:_0x1f5719['body'],'direction':_0x1f5719[_0x4098('0xda')]==='out'?'A':'C','secret':_0x1f5719[_0x4098('0xdb')],'read':_0x1f5719[_0x4098('0x82')],'attachment':_0x1f5719[_0x4098('0xd8')]};})[_0x4098('0x64')]()};return ejs[_0x4098('0xf3')](path['join'](config['root'],'server','views',_0x4098('0xf4')),{'interaction':_0x259ac0})[_0x4098('0x2b')](function(_0xefffad){return new BPromise(function(_0x31bd1a,_0x46c6f9){pdf['create'](_0xefffad,_0x5657cf)[_0x4098('0xf5')](path['join'](_0x261611,_0x4098('0xf6')+_0x59f52c['id']+'-'+_0x3a9cfa+_0x4098('0xf7')),function(_0xa244d0,_0x47237c){if(_0xa244d0)return _0x46c6f9(_0xa244d0);_0x31bd1a(_0x47237c);});});})[_0x4098('0x2b')](function(){return new BPromise(function(_0x42ee40,_0x43687d){zipdir(_0x261611,{'saveTo':_0x2bc728},function(_0x5d54be,_0x469f73){if(_0x5d54be)return _0x43687d(_0x5d54be);return _0x42ee40(_0x469f73);});})[_0x4098('0x2b')](function(){return new BPromise(function(_0x23a724,_0x1622fb){rimraf(_0x261611,function(_0x3d8373){if(_0x3d8373)_0x1622fb(_0x3d8373);return _0x23a724();});});})[_0x4098('0x2b')](function(){return _0x1478a0[_0x4098('0xce')](_0x2bc728,_0x2e6039,function(_0x386b37){if(_0x386b37){console[_0x4098('0xf8')](_0x4098('0xf9'),_0x386b37);}else{fs['unlinkSync'](_0x2bc728);}});});});}else{return _0x1478a0[_0x4098('0x20')](0xc8);}})[_0x4098('0x36')](handleError(_0x1478a0,null));}; \ No newline at end of file +var _0x595e=['Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','show','params','includeAll','options','create','addMessage','OpenchannelMessage','ids','findOne','hasOwnProperty','format','include','findAll','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','download','root','server','files','tmp','join','transcript-%d-%s.zip','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Openchannel','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.html','toFile','transcript-','log','err','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','count','offset','limit','apply','reject','update','then','destroy','end','stack','name','send','Users','fullname','TagIds','Tags','forEach','push','catch','index','map','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','select','field','color','tools_tags','u.id','u.fullname','from','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','start','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','OpenchannelInteraction','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.mobile','c.fax','o.fullname'];(function(_0x5a5fb8,_0x594c64){var _0x2d931b=function(_0x536dc1){while(--_0x536dc1){_0x5a5fb8['push'](_0x5a5fb8['shift']());}};_0x2d931b(++_0x594c64);}(_0x595e,0x132));var _0xe595=function(_0x45fdcb,_0x3a4972){_0x45fdcb=_0x45fdcb-0x0;var _0x24cda3=_0x595e[_0x45fdcb];return _0x24cda3;};'use strict';var pdf=require(_0xe595('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe595('0x1'));var zipdir=require(_0xe595('0x2'));var jsonpatch=require(_0xe595('0x3'));var rp=require(_0xe595('0x4'));var moment=require(_0xe595('0x5'));var BPromise=require(_0xe595('0x6'));var Mustache=require(_0xe595('0x7'));var util=require(_0xe595('0x8'));var path=require(_0xe595('0x9'));var sox=require(_0xe595('0xa'));var csv=require(_0xe595('0xb'));var ejs=require(_0xe595('0xc'));var fs=require('fs');var _=require(_0xe595('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe595('0xb'));var querystring=require(_0xe595('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe595('0xf'));var qs=require(_0xe595('0x10'));var as=require(_0xe595('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe595('0x12'))('api');var utils=require(_0xe595('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe595('0x14'));var db=require(_0xe595('0x15'))['db'];config[_0xe595('0x16')]=_[_0xe595('0x17')](config[_0xe595('0x16')],{'host':_0xe595('0x18'),'port':0x18eb});var socket=require(_0xe595('0x19'))(new Redis(config[_0xe595('0x16')]));require(_0xe595('0x1a'))[_0xe595('0x1b')](socket);function respondWithStatusCode(_0x3ec0d5,_0xa4230e){_0xa4230e=_0xa4230e||0xcc;return function(_0xa373e6){if(_0xa373e6){return _0x3ec0d5[_0xe595('0x1c')](_0xa4230e);}return _0x3ec0d5[_0xe595('0x1d')](_0xa4230e)['end']();};}function respondWithResult(_0xd9325e,_0x235867){_0x235867=_0x235867||0xc8;return function(_0x1d5afe){if(_0x1d5afe){return _0xd9325e[_0xe595('0x1d')](_0x235867)[_0xe595('0x1e')](_0x1d5afe);}};}function respondWithFilteredResult(_0x5b5db1,_0xf7446f){return function(_0x8a60fd){if(_0x8a60fd){var _0xb9f903=_0x8a60fd[_0xe595('0x1f')],_0x1d50ed=_0xf7446f[_0xe595('0x20')],_0x24010a=_0xf7446f['offset']+_0xf7446f[_0xe595('0x21')],_0x25a5b5;if(_0x24010a>=_0xb9f903){_0x24010a=_0xb9f903;_0x25a5b5=0xc8;}else{_0x25a5b5=0xce;}_0x5b5db1[_0xe595('0x1d')](_0x25a5b5);return _0x5b5db1['set']('Content-Range',_0x1d50ed+'-'+_0x24010a+'/'+_0xb9f903)[_0xe595('0x1e')](_0x8a60fd);}return null;};}function patchUpdates(_0x45409f){return function(_0x257cbd){try{jsonpatch[_0xe595('0x22')](_0x257cbd,_0x45409f,!![]);}catch(_0x39554f){return BPromise[_0xe595('0x23')](_0x39554f);}return _0x257cbd['save']();};}function saveUpdates(_0xcd864c,_0xe39e90){return function(_0x5464fc){if(_0x5464fc){return _0x5464fc[_0xe595('0x24')](_0xcd864c)[_0xe595('0x25')](function(_0x13db0b){return _0x13db0b;});}return null;};}function removeEntity(_0x3c2cdd,_0x1670ab){return function(_0x460bd2){if(_0x460bd2){return _0x460bd2[_0xe595('0x26')]()[_0xe595('0x25')](function(){_0x3c2cdd[_0xe595('0x1d')](0xcc)[_0xe595('0x27')]();});}};}function handleEntityNotFound(_0x5a00e2,_0x2598dc){return function(_0x1a5ea4){if(!_0x1a5ea4){_0x5a00e2['sendStatus'](0x194);}return _0x1a5ea4;};}function handleError(_0x4ede5f,_0x2d8364){_0x2d8364=_0x2d8364||0x1f4;return function(_0x9de35b){logger['error'](_0x9de35b[_0xe595('0x28')]);if(_0x9de35b['name']){delete _0x9de35b[_0xe595('0x29')];}_0x4ede5f[_0xe595('0x1d')](_0x2d8364)[_0xe595('0x2a')](_0x9de35b);};}function getInteractionUsers(_0x30899e,_0x38d112){return new BPromise(function(_0x5bff47,_0x16c933){try{if(_0x38d112[_0x30899e['id']]){_0x30899e[_0xe595('0x2b')]=_['map'](_0x38d112[_0x30899e['id']],function(_0x23aed5){return{'id':_0x23aed5['id'],'fullname':_0x23aed5[_0xe595('0x2c')]};});}}catch(_0x607aee){_0x16c933(_0x607aee);}_0x5bff47(_0x30899e);});}function getInteractionTags(_0x4f54ba,_0x2a847d){return new BPromise(function(_0x111571,_0x54a418){try{if(_0x4f54ba[_0xe595('0x2d')]){_0x4f54ba[_0xe595('0x2e')]=[];_0x4f54ba[_0xe595('0x2d')]['split'](',')[_0xe595('0x2f')](function(_0x2cba97){_0x4f54ba[_0xe595('0x2e')][_0xe595('0x30')](_0x2a847d[_0x2cba97]);});}delete _0x4f54ba[_0xe595('0x2d')];}catch(_0x30d793){_0x54a418(_0x30d793);}_0x111571(_0x4f54ba);});}function updateOpenchannelInteraction(_0x28d0ac,_0x1af2f9,_0x23be40){return new BPromise(function(_0x38b00e,_0x410b8a){return getInteractionUsers(_0x28d0ac,_0x23be40)[_0xe595('0x25')](function(_0x5db67d){return getInteractionTags(_0x5db67d,_0x1af2f9);})[_0xe595('0x25')](function(_0x6bb530){_0x38b00e(_0x6bb530);})[_0xe595('0x31')](function(_0x4f6e10){_0x410b8a(_0x4f6e10);});});}exports[_0xe595('0x32')]=function(_0x392460,_0x4f3491){var _0x55743a={},_0x4c438e={},_0x29c674={'count':0x0,'rows':[]};var _0x236edf=_[_0xe595('0x33')](db['OpenchannelInteraction'][_0xe595('0x34')],function(_0x1ca5a6){return{'name':_0x1ca5a6['fieldName'],'type':_0x1ca5a6[_0xe595('0x35')][_0xe595('0x36')]};});_0x4c438e[_0xe595('0x37')]=_[_0xe595('0x33')](_0x236edf,'name');_0x4c438e[_0xe595('0x38')]=_[_0xe595('0x39')](_0x392460[_0xe595('0x38')]);_0x4c438e['filters']=_['intersection'](_0x4c438e['model'],_0x4c438e[_0xe595('0x38')]);_0x55743a[_0xe595('0x3a')]=_[_0xe595('0x3b')](_0x4c438e[_0xe595('0x37')],qs['fields'](_0x392460[_0xe595('0x38')][_0xe595('0x3c')]));_0x55743a[_0xe595('0x3a')]=_0x55743a[_0xe595('0x3a')][_0xe595('0x3d')]?_0x55743a[_0xe595('0x3a')]:_0x4c438e['model'];if(!_0x392460['query']['hasOwnProperty'](_0xe595('0x3e'))){_0x55743a[_0xe595('0x21')]=qs['limit'](_0x392460[_0xe595('0x38')][_0xe595('0x21')]);_0x55743a[_0xe595('0x20')]=qs[_0xe595('0x20')](_0x392460[_0xe595('0x38')]['offset']);}_0x55743a[_0xe595('0x3f')]=qs[_0xe595('0x40')](_0x392460[_0xe595('0x38')]['sort']);_0x55743a[_0xe595('0x41')]=qs[_0xe595('0x42')](_[_0xe595('0x43')](_0x392460[_0xe595('0x38')],_0x4c438e[_0xe595('0x42')]),_0x236edf);var _0x3abd5f=[];var _0x32a6dd=squel[_0xe595('0x44')]()['field']('id')[_0xe595('0x45')](_0xe595('0x29'))['field'](_0xe595('0x46'))['from'](_0xe595('0x47'));var _0x4325f8=squel['select']()[_0xe595('0x45')](_0xe595('0x48'))[_0xe595('0x45')](_0xe595('0x49'))[_0xe595('0x45')]('ui.OpenchannelInteractionId')[_0xe595('0x4a')](_0xe595('0x4b'),'ui')[_0xe595('0x4c')](_0xe595('0x4d'),'u',_0xe595('0x4e'));var _0x176b40=squel[_0xe595('0x44')]()[_0xe595('0x4a')](_0xe595('0x4f'),'i')['left_join']('cm_contacts','c',_0xe595('0x50'))[_0xe595('0x4c')](_0xe595('0x4d'),'o','o.id\x20=\x20i.UserId')[_0xe595('0x4c')](_0xe595('0x51'),'a',_0xe595('0x52'))[_0xe595('0x4c')]('openchannel_messages','me',_0xe595('0x53'))[_0xe595('0x4c')](_0xe595('0x54'),'it',_0xe595('0x55'))[_0xe595('0x4c')](_0xe595('0x47'),'t',_0xe595('0x56'));var _0x3f37f1=squel[_0xe595('0x57')]();var _0x2d4359=[];var _0x503667=squel[_0xe595('0x57')]();var _0x1a6f89;if(_0x392460[_0xe595('0x38')][_0xe595('0x58')]){_0x1a6f89=as[_0xe595('0x59')](_0x392460['query']['search']);var _0x9dcb75=_0x1a6f89[_0xe595('0x5a')];for(var _0x2efbdd=0x0;_0x2efbdd<_0x1a6f89['conditions']['length'];_0x2efbdd++){var _0x4ea806=_0x1a6f89[_0xe595('0x5b')][_0x2efbdd];var _0x1df07b='i';var _0x393ff5=_['find'](_0x236edf,[_0xe595('0x29'),_0x4ea806[_0xe595('0x45')]]);if(!_0x393ff5){switch(_0x4ea806[_0xe595('0x45')]){case _0xe595('0x5c'):if(_0x4ea806[_0xe595('0x5d')]==0x1){_0x176b40[_0xe595('0x5e')]('`'+_0x4ea806['field']+_0xe595('0x5f'));}else{_0x176b40[_0xe595('0x5e')]('`'+_0x4ea806[_0xe595('0x45')]+_0xe595('0x60'));}break;case _0xe595('0x61'):if(_0x4ea806[_0xe595('0x62')]===_0xe595('0x63')){if(_0x4ea806[_0xe595('0x5d')][_0xe595('0x64')]('\x20')[_0xe595('0x3d')]>0x1){_0x3f37f1[_0x9dcb75](_0xe595('0x65'),qs[_0xe595('0x66')](_0x4ea806[_0xe595('0x5d')]),null);}else{var _0x599388='%'+_0x4ea806[_0xe595('0x5d')]+'%';_0x3f37f1[_0x9dcb75]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x599388,_0x599388,_0x599388);}}else{_0x393ff5=_['find'](_0x236edf,[_0xe595('0x29'),_0xe595('0x67')]);_0x4ea806[_0xe595('0x45')]=_0xe595('0x67');_0x2ff169=as[_0xe595('0x68')](_0x1df07b,_0x393ff5['type'],_0x4ea806);_0x3f37f1[_0x9dcb75](_0x2ff169[_0xe595('0x69')],_0x2ff169[_0xe595('0x5d')]['start'],_0x2ff169['value'][_0xe595('0x27')]);}break;case _0xe595('0x6a'):var _0x40e13b=_0x4ea806['value'][_0xe595('0x64')](',')[_0xe595('0x33')](function(_0x2016b8){return Number(_0x2016b8);});_0x40e13b[_0xe595('0x2f')](function(_0x2a3618){_0x503667['or'](_0xe595('0x6b'),'%,'+_0x2a3618+',%');});_0x2d4359=_[_0xe595('0x6c')](_0x2d4359,_0x40e13b);break;case _0xe595('0x6d'):if(_0x4ea806['operator']===_0xe595('0x63')){_0x3f37f1[_0x9dcb75](_0xe595('0x6e'),'%'+_0x4ea806[_0xe595('0x5d')]+'%',null);}else{_0x393ff5=_[_0xe595('0x6f')](_0x236edf,[_0xe595('0x29'),_0xe595('0x70')]);_0x4ea806[_0xe595('0x45')]=_0xe595('0x70');_0x2ff169=as[_0xe595('0x68')](_0x1df07b,_0x393ff5[_0xe595('0x35')],_0x4ea806);_0x3f37f1[_0x9dcb75](_0x2ff169['text'],_0x2ff169['value'][_0xe595('0x71')],_0x2ff169[_0xe595('0x5d')][_0xe595('0x27')]);}break;case _0xe595('0x72'):_0x2ff169=as['buildExpression']('me',null,_0x4ea806);_0x3f37f1[_0x9dcb75](_0x2ff169[_0xe595('0x69')],_0x2ff169[_0xe595('0x5d')][_0xe595('0x71')],_0x2ff169[_0xe595('0x5d')]['end']);break;}}else{var _0x2ff169=as[_0xe595('0x68')](_0x1df07b,_0x393ff5[_0xe595('0x35')],_0x4ea806);_0x3f37f1[_0x9dcb75](_0x2ff169[_0xe595('0x69')],_0x2ff169[_0xe595('0x5d')]['start'],_0x2ff169[_0xe595('0x5d')][_0xe595('0x27')]);}}}else{var _0x35cb2d=_(_0x392460['query'])[_0xe595('0x39')]()[_0xe595('0x33')](function(_0x3be2ca){return _[_0xe595('0x73')](_0x236edf,[_0xe595('0x29'),_0x3be2ca])?_0x3be2ca:undefined;})[_0xe595('0x74')]()[_0xe595('0x5d')]();if(!_[_0xe595('0x75')](_0x35cb2d)){_0x35cb2d[_0xe595('0x2f')](function(_0x3aa3db){if(_0x3aa3db===_0xe595('0x76')){_0x176b40['where'](_0xe595('0x77'),[][_0xe595('0x78')](_0x392460[_0xe595('0x38')][_0x3aa3db]));}else if(_0x3aa3db==='createdAt'){var _0x34efa2=JSON[_0xe595('0x79')](_0x392460[_0xe595('0x38')][_0x3aa3db])[_0xe595('0x7a')];var _0xaa0699=JSON[_0xe595('0x79')](_0x392460[_0xe595('0x38')][_0x3aa3db])[_0xe595('0x7b')];_0x176b40[_0xe595('0x41')](_0xe595('0x7c'),_0x34efa2,_0xaa0699);}else{if(_0x392460['query'][_0x3aa3db]==='null'){_0x176b40[_0xe595('0x41')]('i.'+_0x3aa3db+_0xe595('0x7d'));}else{_0x176b40['where']('i.'+_0x3aa3db+_0xe595('0x7e'),_0x392460[_0xe595('0x38')][_0x3aa3db]);}}});}if(_0x392460[_0xe595('0x38')][_0xe595('0x7f')]){if(_0x392460['query'][_0xe595('0x7f')]==0x1){_0x176b40['having']('`unreadMessages`\x20=\x200');}else{_0x176b40['having'](_0xe595('0x80'));}}if(_0x392460['query']['tag']){_0x2d4359=_['isArray'](_0x392460['query'][_0xe595('0x81')])?_0x392460[_0xe595('0x38')][_0xe595('0x81')]:new Array(_0x392460[_0xe595('0x38')][_0xe595('0x81')]);_0x2d4359[_0xe595('0x2f')](function(_0x37752a){_0x503667['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x37752a+',%');});}if(_0x392460[_0xe595('0x38')][_0xe595('0x82')]){var _0x240086=_0x392460[_0xe595('0x38')]['filter'][_0xe595('0x83')]('\x5c','\x5c\x5c')[_0xe595('0x83')](/'/g,'\x27\x27');if(qs[_0xe595('0x84')](_0x240086)){_0x3f37f1['or']('i.id\x20LIKE\x20?',_0x240086+'%');}else{_0x3f37f1['or'](_0xe595('0x85'),qs['getFullTextValue'](_0x240086))['or']('i.from\x20LIKE\x20?',_0x240086+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x240086+'%');}}}_0x176b40['where'](_0x3f37f1);_0x176b40[_0xe595('0x86')](_0xe595('0x87'));var _0x134553={'type':db[_0xe595('0x88')]['QueryTypes'][_0xe595('0x89')],'raw':!![]};var _0x45b748=_0x176b40[_0xe595('0x8a')]();_0x45b748[_0xe595('0x45')](_0xe595('0x87'));_0x45b748[_0xe595('0x45')](_0xe595('0x8b'),_0xe595('0x5c'));if(_0x55743a[_0xe595('0x3f')]){_0x55743a[_0xe595('0x3f')][_0xe595('0x2f')](function(_0x58dcb5){var _0x344ad4=_0x58dcb5[0x0]==='contactName'?_0x58dcb5[0x0]:'i.'+_0x58dcb5[0x0];_0x176b40['order'](_0x344ad4,_0x58dcb5[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x2d4359)){_0x176b40[_0xe595('0x5e')](_0x503667);_0x45b748['where'](_0xe595('0x8c'),_0x2d4359);}BPromise[_0xe595('0x8d')]()[_0xe595('0x25')](function(){if(!_0x1a6f89){if(_0x392460[_0xe595('0x38')][_0xe595('0x76')]||_0x392460[_0xe595('0x38')][_0xe595('0x8e')])return;_0x45b748[_0xe595('0x41')](_0xe595('0x8f'));_0x176b40[_0xe595('0x41')](_0xe595('0x8f'));return;}if(_0x392460[_0xe595('0x90')][_0xe595('0x91')]!=='agent')return;return _0x392460[_0xe595('0x90')][_0xe595('0x92')]({'attributes':['id'],'raw':!![]})[_0xe595('0x25')](function(_0x5258c9){if(_[_0xe595('0x75')](_0x5258c9)){_0x45b748[_0xe595('0x41')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x176b40['where'](_0xe595('0x93'));}else{_0x45b748['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0xe595('0x33')](_0x5258c9,'id'));_0x176b40['where'](_0xe595('0x77'),_['map'](_0x5258c9,'id'));}});})[_0xe595('0x25')](function(){if(_0x392460[_0xe595('0x90')]['role']==='agent'&&!_0x1a6f89&&!_0x392460[_0xe595('0x38')][_0xe595('0x76')])return[];return db[_0xe595('0x94')]['query'](_0x45b748[_0xe595('0x95')](),_0x134553);})[_0xe595('0x25')](function(_0x37c564){_0x29c674['count']=_0x37c564[_0xe595('0x3d')];if(_0x29c674[_0xe595('0x1f')]===0x0)return[];return db[_0xe595('0x94')][_0xe595('0x38')](_0x32a6dd['toString'](),_0x134553)[_0xe595('0x25')](function(_0x414821){_0x3abd5f=_['keyBy'](_0x414821,'id');_0x134553=_[_0xe595('0x96')](_0x134553,{'model':db[_0xe595('0x97')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x392460[_0xe595('0x38')]['fields']){_0x55743a[_0xe595('0x3a')][_0xe595('0x2f')](function(_0x1635a4){_0x176b40['field']('i.'+_0x1635a4);});}else{_0x176b40[_0xe595('0x45')](_0xe595('0x8b'),_0xe595('0x5c'));_0x176b40[_0xe595('0x45')]('a.key',_0xe595('0x98'));_0x176b40['field'](_0xe595('0x99'),'Account.mandatoryDisposition');_0x176b40[_0xe595('0x45')](_0xe595('0x9a'),_0xe595('0x9b'));_0x176b40[_0xe595('0x45')](_0xe595('0x9c'));_0x176b40[_0xe595('0x45')]('c.firstName',_0xe595('0x9d'));_0x176b40[_0xe595('0x45')](_0xe595('0x9e'),_0xe595('0x9f'));_0x176b40[_0xe595('0x45')]('c.email',_0xe595('0xa0'));_0x176b40[_0xe595('0x45')]('c.phone','Contact.phone');_0x176b40[_0xe595('0x45')]('c.mobile',_0xe595('0xa1'));_0x176b40[_0xe595('0x45')](_0xe595('0xa2'),'Contact.fax');_0x176b40[_0xe595('0x45')](_0xe595('0xa3'),_0xe595('0xa4'));_0x176b40[_0xe595('0x45')](_0xe595('0xa5'),_0xe595('0xa6'));_0x176b40[_0xe595('0x45')](_0xe595('0xa7'),_0xe595('0x2d'));}if(_0x55743a['limit'])_0x176b40['limit'](_0x55743a[_0xe595('0x21')]);if(_0x55743a[_0xe595('0x20')])_0x176b40[_0xe595('0x20')](_0x55743a['offset']);return db[_0xe595('0x94')][_0xe595('0x38')](_0x176b40[_0xe595('0x95')](),_0x134553);})[_0xe595('0x25')](function(_0x5b40a6){_0x4325f8['where'](_0xe595('0xa8'),_[_0xe595('0x33')](_0x5b40a6,'id'));return db[_0xe595('0x94')][_0xe595('0x38')](_0x4325f8[_0xe595('0x95')](),_0x134553)['then'](function(_0x2efc8a){var _0x25ef3b=_[_0xe595('0xa9')](_0x2efc8a,_0xe595('0xaa'));var _0x7a8cbd=[];_0x5b40a6[_0xe595('0x2f')](function(_0x4c8fac){_0x7a8cbd[_0xe595('0x30')](updateOpenchannelInteraction(_0x4c8fac,_0x3abd5f,_0x25ef3b));});return BPromise['all'](_0x7a8cbd);});});})[_0xe595('0x25')](function(_0x31ca13){_0x29c674[_0xe595('0xab')]=_0x31ca13;return _0x29c674;})['then'](respondWithFilteredResult(_0x4f3491,_0x55743a))['catch'](handleError(_0x4f3491,null));};exports[_0xe595('0xac')]=function(_0x27e9b,_0x409c3c){var _0x226707={};if(_0x27e9b[_0xe595('0x38')][_0xe595('0x35')]&&_0x27e9b[_0xe595('0x38')][_0xe595('0x35')]==='from'){_0x226707['from']=_0x27e9b[_0xe595('0xad')]['id'];}else{_0x226707['id']=_0x27e9b[_0xe595('0xad')]['id'];}var _0x221a1c={'raw':![],'where':_0x226707},_0x94d668={};_0x94d668['model']=_[_0xe595('0x39')](db[_0xe595('0x97')][_0xe595('0x34')]);_0x94d668[_0xe595('0x38')]=_[_0xe595('0x39')](_0x27e9b[_0xe595('0x38')]);_0x94d668['filters']=_[_0xe595('0x3b')](_0x94d668[_0xe595('0x37')],_0x94d668[_0xe595('0x38')]);_0x221a1c[_0xe595('0x3a')]=_[_0xe595('0x3b')](_0x94d668[_0xe595('0x37')],qs[_0xe595('0x3c')](_0x27e9b[_0xe595('0x38')][_0xe595('0x3c')]));_0x221a1c[_0xe595('0x3a')]=_0x221a1c[_0xe595('0x3a')][_0xe595('0x3d')]?_0x221a1c['attributes']:_0x94d668['model'];if(_0x27e9b[_0xe595('0x38')][_0xe595('0xae')]){_0x221a1c['include']=[{'all':!![]}];}_0x221a1c=_['merge']({},_0x221a1c,_0x27e9b[_0xe595('0xaf')]);return db[_0xe595('0x97')][_0xe595('0x6f')](_0x221a1c)[_0xe595('0x25')](handleEntityNotFound(_0x409c3c,null))[_0xe595('0x25')](respondWithResult(_0x409c3c,null))[_0xe595('0x31')](handleError(_0x409c3c,null));};exports[_0xe595('0xb0')]=function(_0x247fed,_0x1568af){return db[_0xe595('0x97')][_0xe595('0xb0')](_0x247fed['body'],{})[_0xe595('0x25')](respondWithResult(_0x1568af,0xc9))[_0xe595('0x31')](handleError(_0x1568af,null));};exports[_0xe595('0x24')]=function(_0x4a1599,_0x10a878){if(_0x4a1599['body']['id']){delete _0x4a1599[_0xe595('0x72')]['id'];}return db[_0xe595('0x97')][_0xe595('0x6f')]({'where':{'id':_0x4a1599[_0xe595('0xad')]['id']}})[_0xe595('0x25')](handleEntityNotFound(_0x10a878,null))[_0xe595('0x25')](saveUpdates(_0x4a1599['body'],null))[_0xe595('0x25')](respondWithResult(_0x10a878,null))[_0xe595('0x31')](handleError(_0x10a878,null));};exports[_0xe595('0x26')]=function(_0x3ab5d7,_0x4937db){return db[_0xe595('0x97')][_0xe595('0x6f')]({'where':{'id':_0x3ab5d7[_0xe595('0xad')]['id']}})[_0xe595('0x25')](handleEntityNotFound(_0x4937db,null))[_0xe595('0x25')](removeEntity(_0x4937db,null))[_0xe595('0x31')](handleError(_0x4937db,null));};exports['describe']=function(_0x2d1483,_0x107558){return db[_0xe595('0x97')]['describe']()[_0xe595('0x25')](respondWithResult(_0x107558,null))[_0xe595('0x31')](handleError(_0x107558,null));};exports[_0xe595('0xb1')]=function(_0x2622c5,_0x55a2fa,_0xbdc46e){return db[_0xe595('0xb2')][_0xe595('0x6f')]({'where':{'id':_0x2622c5['params']['id']}})[_0xe595('0x25')](handleEntityNotFound(_0x55a2fa,null))[_0xe595('0x25')](function(_0xfbf39){if(_0xfbf39){return _0xfbf39['addMessage'](_0x2622c5[_0xe595('0x72')][_0xe595('0xb3')],_['omit'](_0x2622c5[_0xe595('0x72')],[_0xe595('0xb3'),'id'])||{});}})['then'](respondWithResult(_0x55a2fa,null))['catch'](handleError(_0x55a2fa,null));};exports['getMessages']=function(_0x335f8b,_0x46a5e4,_0xefc022){var _0x4737d1={'raw':![],'where':{}};var _0x49ff8b={};var _0x4811be={'count':0x0,'rows':[]};return db[_0xe595('0x97')][_0xe595('0xb4')]({'where':{'id':_0x335f8b['params']['id']}})[_0xe595('0x25')](handleEntityNotFound(_0x46a5e4,null))[_0xe595('0x25')](function(_0x16404b){if(_0x16404b){_0x49ff8b[_0xe595('0x37')]=_[_0xe595('0x39')](db[_0xe595('0xb2')][_0xe595('0x34')]);_0x49ff8b[_0xe595('0x38')]=_[_0xe595('0x39')](_0x335f8b[_0xe595('0x38')]);_0x49ff8b[_0xe595('0x42')]=_[_0xe595('0x3b')](_0x49ff8b[_0xe595('0x37')],_0x49ff8b['query']);_0x4737d1['attributes']=_[_0xe595('0x3b')](_0x49ff8b[_0xe595('0x37')],qs[_0xe595('0x3c')](_0x335f8b[_0xe595('0x38')][_0xe595('0x3c')]));_0x4737d1[_0xe595('0x3a')]=_0x4737d1[_0xe595('0x3a')][_0xe595('0x3d')]?_0x4737d1[_0xe595('0x3a')]:_0x49ff8b[_0xe595('0x37')];if(!_0x335f8b[_0xe595('0x38')][_0xe595('0xb5')](_0xe595('0x3e'))){_0x4737d1['limit']=qs[_0xe595('0x21')](_0x335f8b['query'][_0xe595('0x21')]);_0x4737d1[_0xe595('0x20')]=qs[_0xe595('0x20')](_0x335f8b[_0xe595('0x38')][_0xe595('0x20')]);}_0x4737d1[_0xe595('0x3f')]=qs[_0xe595('0x40')](_0x335f8b[_0xe595('0x38')][_0xe595('0x40')]);_0x4737d1[_0xe595('0x41')]=qs[_0xe595('0x42')](_[_0xe595('0x43')](_0x335f8b[_0xe595('0x38')],_0x49ff8b[_0xe595('0x42')]));_0x4737d1[_0xe595('0x41')][_0xe595('0xaa')]=_0x16404b['id'];if(_0x335f8b[_0xe595('0x38')]['filter']){_0x4737d1[_0xe595('0x41')]=_['merge'](_0x4737d1[_0xe595('0x41')],{'$or':_[_0xe595('0x33')](_0x4737d1[_0xe595('0x3a')],function(_0x6d7b19){var _0x371285={};_0x371285[_0x6d7b19]={'$like':'%'+_0x335f8b['query'][_0xe595('0x82')]+'%'};return _0x371285;})});}if(_0x335f8b[_0xe595('0x38')][_0xe595('0x7a')]){var _0x2aaf7b=_0x335f8b[_0xe595('0x38')][_0xe595('0x7a')][_0xe595('0x64')](',');var _0x418bba={};_0x418bba[_0x2aaf7b[0x0]]={'$gte':moment(_0x2aaf7b[0x1])[_0xe595('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4737d1[_0xe595('0x41')]=_[_0xe595('0x96')](_0x4737d1[_0xe595('0x41')],_0x418bba);}_0x4737d1=_[_0xe595('0x96')]({},_0x4737d1,_0x335f8b[_0xe595('0xaf')]);return db[_0xe595('0xb2')][_0xe595('0x1f')]({'where':_0x4737d1['where']})[_0xe595('0x25')](function(_0x1c00f2){_0x4811be[_0xe595('0x1f')]=_0x1c00f2;if(_0x335f8b[_0xe595('0x38')][_0xe595('0xae')]){_0x4737d1[_0xe595('0xb7')]=[{'all':!![]}];}return db[_0xe595('0xb2')][_0xe595('0xb8')](_0x4737d1);})[_0xe595('0x25')](function(_0x288dce){_0x4811be[_0xe595('0xab')]=_0x288dce;return _0x4811be;});}})['then'](respondWithFilteredResult(_0x46a5e4,_0x4737d1))[_0xe595('0x31')](handleError(_0x46a5e4,null));};exports[_0xe595('0xb9')]=function(_0x18c064,_0x5cb168,_0x1a95ba){return db[_0xe595('0x97')][_0xe595('0x6f')]({'where':{'id':_0x18c064['params']['id']}})[_0xe595('0x25')](handleEntityNotFound(_0x5cb168,null))['then'](function(_0x5c518f){if(_0x5c518f){return _0x5c518f[_0xe595('0xba')](_0x18c064['body']['ids'],_['omit'](_0x18c064[_0xe595('0x72')],[_0xe595('0xb3'),'id'])||{})[_0xe595('0xbb')](function(){return db[_0xe595('0x6a')][_0xe595('0xb8')]({'attributes':['id',_0xe595('0x29'),_0xe595('0x46')],'where':{'id':_0x18c064['body'][_0xe595('0xb3')]}});})['then'](function(_0x35e401){socket['emit'](_0xe595('0xbc'),{'id':Number(_0x18c064['params']['id']),'tags':_0x35e401||[]});return{'id':Number(_0x18c064['params']['id']),'tags':_0x35e401||[]};});}})[_0xe595('0x25')](respondWithResult(_0x5cb168,null))[_0xe595('0x31')](handleError(_0x5cb168,null));};exports[_0xe595('0xbd')]=function(_0x4a72db,_0x4885b6,_0x1a8efc){return db[_0xe595('0x97')][_0xe595('0x6f')]({'where':{'id':_0x4a72db[_0xe595('0xad')]['id']}})[_0xe595('0x25')](handleEntityNotFound(_0x4885b6,null))[_0xe595('0x25')](function(_0x1c9c83){if(_0x1c9c83){return _0x1c9c83[_0xe595('0xbd')](_0x4a72db['query']['ids']);}})['then'](respondWithStatusCode(_0x4885b6,null))[_0xe595('0x31')](handleError(_0x4885b6,null));};exports[_0xe595('0xbe')]=function(_0x2c06c7,_0x521740){var _0xdc56bb=moment()['unix']()[_0xe595('0x95')]();var _0x4f1e06=path['join'](config[_0xe595('0xbf')],_0xe595('0xc0'),_0xe595('0xc1'),_0xe595('0xc2'));var _0xb12731=path[_0xe595('0xc3')](config['root'],'server','files','attachments');var _0x4aeccc=path[_0xe595('0xc3')](_0x4f1e06,_0xdc56bb);var _0x223699=util[_0xe595('0xb6')](_0xe595('0xc4'),_0x2c06c7[_0xe595('0xad')]['id'],_0xdc56bb);var _0x3dba39=path[_0xe595('0xc3')](_0x4f1e06,_0x223699);var _0x18537a=[];_0x18537a['push']({'model':db[_0xe595('0x6d')],'as':_0xe595('0x6d'),'attributes':['id',_0xe595('0x2c')],'raw':!![]});_0x18537a[_0xe595('0x30')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xe595('0xc5'),_0xe595('0xc6')],'raw':!![]});if(_0x2c06c7['query'][_0xe595('0xc7')]){_0x18537a[_0xe595('0x30')]({'model':db[_0xe595('0xc8')],'as':_0xe595('0xc8'),'raw':!![]});}var _0x11401e=[{'model':db[_0xe595('0xb2')],'as':_0xe595('0xc9'),'attributes':['id',_0xe595('0x72'),_0xe595('0xca'),_0xe595('0xcb'),_0xe595('0xcc'),'read'],'include':_0x18537a}];_0x11401e[_0xe595('0x30')]({'model':db[_0xe595('0xcd')],'as':_0xe595('0xce'),'attributes':['id',_0xe595('0x29')]});_0x11401e[_0xe595('0x30')]({'model':db[_0xe595('0x6d')],'as':_0xe595('0xcf'),'attributes':['id',_0xe595('0x2c')]});return db[_0xe595('0x97')]['find']({'where':{'id':_0x2c06c7[_0xe595('0xad')]['id']},'include':_0x11401e})[_0xe595('0x25')](handleEntityNotFound(_0x521740,null))['then'](function(_0x58d80c){if(_0x58d80c){var _0x4e2a44=_0x58d80c[_0xe595('0xd0')]({'plain':!![]});fs['mkdirSync'](_0x4aeccc);var _0x10366c={'format':'A4','border':_0xe595('0xd1'),'header':{'height':_0xe595('0xd2'),'contents':{'first':_0xe595('0xd3')}},'footer':{'height':_0xe595('0xd4'),'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'](_0xe595('0xd5'),_0xe595('0xd6'),_0x4e2a44['id']),moment()[_0xe595('0xb6')]('YYYY-MM-DD')[_0xe595('0x95')]())}}};var _0x479f10={'channel':_0xe595('0xd6'),'account':_0x4e2a44[_0xe595('0xce')]['name'],'agent':_0x4e2a44[_0xe595('0xcf')]?_0x4e2a44[_0xe595('0xcf')][_0xe595('0x2c')]:'N.A.','createdAt':moment(_0x4e2a44[_0xe595('0xca')])['format'](_0xe595('0xd7'))['toString'](),'closedAt':_0x4e2a44[_0xe595('0xd8')]?moment(_0x4e2a44[_0xe595('0xd9')])[_0xe595('0xb6')](_0xe595('0xd7'))[_0xe595('0x95')]():'','disposition':_0x4e2a44['disposition'],'visibility':_0x4e2a44[_0xe595('0xda')]?_0xe595('0xdb'):_0xe595('0xdc'),'messages':_(_0x4e2a44[_0xe595('0xc9')])['filter']({'secret':![]})['map'](function(_0x464e5d){if(_0x464e5d['Attachment']){var _0xfc208b=path[_0xe595('0xc3')](_0xb12731,_0x464e5d[_0xe595('0xc8')][_0xe595('0xdd')]);if(fs[_0xe595('0xde')](_0xfc208b)){fs[_0xe595('0xdf')](_0xfc208b)[_0xe595('0xe0')](fs[_0xe595('0xe1')](path['join'](_0x4aeccc,_0x464e5d[_0xe595('0xc8')][_0xe595('0xdd')])));}}return{'date':moment(_0x464e5d[_0xe595('0xca')])[_0xe595('0xb6')](_0xe595('0xd7'))[_0xe595('0x95')](),'sender':_0x464e5d['direction']===_0xe595('0xe2')?_0x464e5d[_0xe595('0x6d')]?_0x464e5d[_0xe595('0x6d')][_0xe595('0x2c')]:_0xe595('0xe3'):_0x464e5d['Contact'][_0xe595('0xc5')]+(_0x464e5d[_0xe595('0x61')][_0xe595('0xc6')]?'\x20'+_0x464e5d['Contact'][_0xe595('0xc6')]:''),'body':_0x464e5d[_0xe595('0xc8')]?_0x464e5d[_0xe595('0xc8')]['basename']:_0x464e5d[_0xe595('0x72')],'direction':_0x464e5d['direction']===_0xe595('0xe2')?'A':'C','secret':_0x464e5d['secret'],'read':_0x464e5d[_0xe595('0x7f')],'attachment':_0x464e5d['Attachment']};})['value']()};return ejs[_0xe595('0xe4')](path[_0xe595('0xc3')](config[_0xe595('0xbf')],'server',_0xe595('0xe5'),_0xe595('0xe6')),{'interaction':_0x479f10})['then'](function(_0x344195){return new BPromise(function(_0x1cf035,_0x19b17f){pdf[_0xe595('0xb0')](_0x344195,_0x10366c)[_0xe595('0xe7')](path[_0xe595('0xc3')](_0x4aeccc,_0xe595('0xe8')+_0x4e2a44['id']+'-'+_0xdc56bb+'.pdf'),function(_0x3cc0ac,_0x34f0f4){if(_0x3cc0ac)return _0x19b17f(_0x3cc0ac);_0x1cf035(_0x34f0f4);});});})[_0xe595('0x25')](function(){return new BPromise(function(_0x23ee34,_0x1942bf){zipdir(_0x4aeccc,{'saveTo':_0x3dba39},function(_0x38db29,_0x16765a){if(_0x38db29)return _0x1942bf(_0x38db29);return _0x23ee34(_0x16765a);});})[_0xe595('0x25')](function(){return new BPromise(function(_0x58a9a9,_0x450ac4){rimraf(_0x4aeccc,function(_0x4a2928){if(_0x4a2928)_0x450ac4(_0x4a2928);return _0x58a9a9();});});})['then'](function(){return _0x521740['download'](_0x3dba39,_0x223699,function(_0xe30e20){if(_0xe30e20){console[_0xe595('0xe9')](_0xe595('0xea'),_0xe30e20);}else{fs['unlinkSync'](_0x3dba39);}});});});}else{return _0x521740[_0xe595('0x1c')](0xc8);}})[_0xe595('0x31')](handleError(_0x521740,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 3b94196..143e082 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 _0x1f2e=['then','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','getUsers'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1f2e,0x109));var _0xe1f2=function(_0x2b50aa,_0x5a8fbc){_0x2b50aa=_0x2b50aa-0x0;var _0x46b453=_0x1f2e[_0x2b50aa];return _0x46b453;};'use strict';var EventEmitter=require(_0xe1f2('0x0'));var OpenchannelInteraction=require(_0xe1f2('0x1'))['db'][_0xe1f2('0x2')];var OpenchannelMessage=require(_0xe1f2('0x1'))['db'][_0xe1f2('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe1f2('0x4'),'afterUpdate':_0xe1f2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2a174a){return function(_0x5a23c2,_0xb603b6,_0xd36acf){_0x5a23c2[_0xe1f2('0x6')]({'attributes':['id'],'raw':!![]})[_0xe1f2('0x7')](function(_0x18b237){_0x5a23c2['setDataValue']('Users',_0x18b237[_0xe1f2('0x8')](function(_0x1b71c5){return{'id':_0x1b71c5['id']};}));return OpenchannelMessage[_0xe1f2('0x9')]({'where':{'OpenchannelInteractionId':_0x5a23c2['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe1f2('0x7')](function(_0x22674d){_0x5a23c2['setDataValue'](_0xe1f2('0xa'),_0x22674d['length']);OpenchannelInteractionEvents[_0xe1f2('0xb')](_0x2a174a+':'+_0x5a23c2['id'],_0x5a23c2);OpenchannelInteractionEvents[_0xe1f2('0xb')](_0x2a174a,_0x5a23c2);_0xd36acf(null);})[_0xe1f2('0xc')](_0xd36acf(null));};}for(var e in events){if(events[_0xe1f2('0xd')](e)){var event=events[e];OpenchannelInteraction[_0xe1f2('0xe')](e,emitEvent(event));}}module[_0xe1f2('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x36a3=['then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','update','remove','getUsers'];(function(_0x118e16,_0x2a6f97){var _0x9f7b89=function(_0xd8909a){while(--_0xd8909a){_0x118e16['push'](_0x118e16['shift']());}};_0x9f7b89(++_0x2a6f97);}(_0x36a3,0x1f1));var _0x336a=function(_0x1c5950,_0x49e128){_0x1c5950=_0x1c5950-0x0;var _0x2b720a=_0x36a3[_0x1c5950];return _0x2b720a;};'use strict';var EventEmitter=require(_0x336a('0x0'));var OpenchannelInteraction=require(_0x336a('0x1'))['db'][_0x336a('0x2')];var OpenchannelMessage=require(_0x336a('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x336a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x336a('0x4'),'afterDestroy':_0x336a('0x5')};function emitEvent(_0x2b861d){return function(_0x590e02,_0x2f06f5,_0x197d35){_0x590e02[_0x336a('0x6')]({'attributes':['id'],'raw':!![]})[_0x336a('0x7')](function(_0x2c3c93){_0x590e02[_0x336a('0x8')](_0x336a('0x9'),_0x2c3c93[_0x336a('0xa')](function(_0x3588fd){return{'id':_0x3588fd['id']};}));return OpenchannelMessage[_0x336a('0xb')]({'where':{'OpenchannelInteractionId':_0x590e02['id'],'direction':'in','read':![]},'raw':!![]});})[_0x336a('0x7')](function(_0xf990ea){_0x590e02[_0x336a('0x8')](_0x336a('0xc'),_0xf990ea[_0x336a('0xd')]);OpenchannelInteractionEvents[_0x336a('0xe')](_0x2b861d+':'+_0x590e02['id'],_0x590e02);OpenchannelInteractionEvents['emit'](_0x2b861d,_0x590e02);_0x197d35(null);})['catch'](_0x197d35(null));};}for(var e in events){if(events[_0x336a('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x336a('0x10')](e,emitEvent(event));}}module[_0x336a('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index edd911a..74e93df 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 _0x4b19=['../../config/logger','api','moment','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','openchannel_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b19,0x195));var _0x94b1=function(_0x253305,_0x2762a5){_0x253305=_0x253305-0x0;var _0x386613=_0x4b19[_0x253305];return _0x386613;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var logger=require(_0x94b1('0x1'))(_0x94b1('0x2'));var moment=require(_0x94b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x94b1('0x4'));var fs=require('fs');var path=require(_0x94b1('0x5'));var rimraf=require(_0x94b1('0x6'));var config=require('../../config/environment');var attributes=require(_0x94b1('0x7'));module[_0x94b1('0x8')]=function(_0x52d6c1,_0x24df76){return _0x52d6c1[_0x94b1('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x94b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x201a02,_0xad0a85,_0x5aee5f){if(_0x201a02[_0x94b1('0xb')]('closed')){_0x201a02['closedAt']=moment()[_0x94b1('0xc')](_0x94b1('0xd'));}_0x5aee5f(null,_0x201a02);}}});}; \ No newline at end of file +var _0x31c2=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./openchannelInteraction.attributes','exports','OpenchannelInteraction','closed','closedAt','format'];(function(_0xf2df48,_0x53e414){var _0x2def10=function(_0x12a651){while(--_0x12a651){_0xf2df48['push'](_0xf2df48['shift']());}};_0x2def10(++_0x53e414);}(_0x31c2,0x1e1));var _0x231c=function(_0x12f9d1,_0x798092){_0x12f9d1=_0x12f9d1-0x0;var _0x1b1792=_0x31c2[_0x12f9d1];return _0x1b1792;};'use strict';var _=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var logger=require(_0x231c('0x2'))(_0x231c('0x3'));var moment=require(_0x231c('0x4'));var BPromise=require(_0x231c('0x5'));var rp=require(_0x231c('0x6'));var fs=require('fs');var path=require(_0x231c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x231c('0x8'));module[_0x231c('0x9')]=function(_0x1f3f7d,_0x219c3f){return _0x1f3f7d['define'](_0x231c('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x439df8,_0x38b3b9,_0x1000c9){if(_0x439df8['changed'](_0x231c('0xb'))){_0x439df8[_0x231c('0xc')]=moment()[_0x231c('0xd')](_0x231c('0xe'));}_0x1000c9(null,_0x439df8);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 788604d..ad281bd 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 _0x22fb=['client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','info','debug','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','request\x20sent','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','attributes','then','AddTagsToOpenchannelInteraction','where','addTags','ids','omit','body','spread','AddTags','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise'];(function(_0x20e83b,_0xf15200){var _0x240f71=function(_0x102909){while(--_0x102909){_0x20e83b['push'](_0x20e83b['shift']());}};_0x240f71(++_0xf15200);}(_0x22fb,0x188));var _0xb22f=function(_0x3929dc,_0x51aa48){_0x3929dc=_0x3929dc-0x0;var _0x1eb253=_0x22fb[_0x3929dc];return _0x1eb253;};'use strict';var _=require('lodash');var util=require(_0xb22f('0x0'));var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rs=require(_0xb22f('0x3'));var fs=require('fs');var Redis=require(_0xb22f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb22f('0x5'));var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});config[_0xb22f('0xa')]=_[_0xb22f('0xb')](config[_0xb22f('0xa')],{'host':_0xb22f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb22f('0xa')]));require(_0xb22f('0xd'))[_0xb22f('0xe')](socket);function respondWithRpcPromise(_0x5ca654,_0x51caab,_0x9685b6){return new BPromise(function(_0x3bfda1,_0x249e6c){return client[_0xb22f('0xf')](_0x5ca654,_0x9685b6)['then'](function(_0x44b90a){logger[_0xb22f('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x51caab,'request\x20sent');logger[_0xb22f('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x51caab,'request\x20sent',JSON[_0xb22f('0x12')](_0x44b90a));if(_0x44b90a[_0xb22f('0x13')]){if(_0x44b90a[_0xb22f('0x13')][_0xb22f('0x14')]===0x1f4){logger[_0xb22f('0x13')](_0xb22f('0x15'),_0x51caab,_0x44b90a[_0xb22f('0x13')][_0xb22f('0x16')]);return _0x249e6c(_0x44b90a[_0xb22f('0x13')]['message']);}logger[_0xb22f('0x13')](_0xb22f('0x15'),_0x51caab,_0x44b90a[_0xb22f('0x13')]['message']);return _0x3bfda1(_0x44b90a[_0xb22f('0x13')][_0xb22f('0x16')]);}else{logger[_0xb22f('0x10')](_0xb22f('0x15'),_0x51caab,_0xb22f('0x17'));_0x3bfda1(_0x44b90a['result'][_0xb22f('0x16')]);}})[_0xb22f('0x18')](function(_0x31ec28){logger[_0xb22f('0x13')](_0xb22f('0x15'),_0x51caab,_0x31ec28);_0x249e6c(_0x31ec28);});});}exports[_0xb22f('0x19')]=function(_0x136d84){var _0x2a8c2b=this;return new Promise(function(_0x17bad8,_0x707488){return db[_0xb22f('0x1a')][_0xb22f('0x1b')](_0x136d84['body'],{'raw':_0x136d84[_0xb22f('0x1c')]?_0x136d84[_0xb22f('0x1c')][_0xb22f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x136d84[_0xb22f('0x1c')]?_0x136d84['options']['where']||null:null,'attributes':_0x136d84[_0xb22f('0x1c')]?_0x136d84[_0xb22f('0x1c')][_0xb22f('0x1e')]||null:null,'limit':_0x136d84['options']?_0x136d84[_0xb22f('0x1c')]['limit']||null:null})[_0xb22f('0x1f')](function(_0x5db217){logger[_0xb22f('0x10')](_0xb22f('0x19'),_0x136d84);logger['debug'](_0xb22f('0x19'),_0x136d84,JSON[_0xb22f('0x12')](_0x5db217));_0x17bad8(_0x5db217);})[_0xb22f('0x18')](function(_0x40c1a8){logger[_0xb22f('0x13')](_0xb22f('0x19'),_0x40c1a8[_0xb22f('0x16')],_0x136d84);_0x707488(_0x2a8c2b[_0xb22f('0x13')](0x1f4,_0x40c1a8[_0xb22f('0x16')]));});});};exports[_0xb22f('0x20')]=function(_0x157e4a){return new Promise(function(_0x1fbef9,_0x406216){return db[_0xb22f('0x1a')]['find']({'where':_0x157e4a[_0xb22f('0x1c')]?_0x157e4a['options'][_0xb22f('0x21')]||null:null})[_0xb22f('0x1f')](function(_0x627812){if(_0x627812){return _0x627812[_0xb22f('0x22')](_0x157e4a['body'][_0xb22f('0x23')],_[_0xb22f('0x24')](_0x157e4a[_0xb22f('0x25')],['ids','id'])||{});}})[_0xb22f('0x26')](function(_0x56af09){logger[_0xb22f('0x10')](_0xb22f('0x27'),_0x157e4a);logger[_0xb22f('0x11')](_0xb22f('0x27'),_0x157e4a,JSON[_0xb22f('0x12')](_0x56af09));_0x1fbef9(_0x56af09);})['catch'](function(_0x2e82cc){logger[_0xb22f('0x13')](_0xb22f('0x27'),_0x2e82cc[_0xb22f('0x16')],_0x157e4a);_0x406216(_this['error'](0x1f4,_0x2e82cc[_0xb22f('0x16')]));});});}; \ No newline at end of file +var _0x0f14=['then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','update','body','options','where','attributes','limit','info','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request'];(function(_0x21efdb,_0x1f2b98){var _0x4e8d11=function(_0x59df8c){while(--_0x59df8c){_0x21efdb['push'](_0x21efdb['shift']());}};_0x4e8d11(++_0x1f2b98);}(_0x0f14,0x19b));var _0x40f1=function(_0x50ad4a,_0x356e0c){_0x50ad4a=_0x50ad4a-0x0;var _0x130c4c=_0x0f14[_0x50ad4a];return _0x130c4c;};'use strict';var _=require(_0x40f1('0x0'));var util=require(_0x40f1('0x1'));var moment=require(_0x40f1('0x2'));var BPromise=require(_0x40f1('0x3'));var rs=require(_0x40f1('0x4'));var fs=require('fs');var Redis=require(_0x40f1('0x5'));var db=require(_0x40f1('0x6'))['db'];var utils=require(_0x40f1('0x7'));var logger=require(_0x40f1('0x8'))(_0x40f1('0x9'));var config=require(_0x40f1('0xa'));var jayson=require(_0x40f1('0xb'));var client=jayson[_0x40f1('0xc')][_0x40f1('0xd')]({'port':0x232a});config[_0x40f1('0xe')]=_[_0x40f1('0xf')](config[_0x40f1('0xe')],{'host':_0x40f1('0x10'),'port':0x18eb});var socket=require(_0x40f1('0x11'))(new Redis(config[_0x40f1('0xe')]));require(_0x40f1('0x12'))[_0x40f1('0x13')](socket);function respondWithRpcPromise(_0x1aae46,_0x2bda74,_0x9d698f){return new BPromise(function(_0x47cdbf,_0x59ff98){return client[_0x40f1('0x14')](_0x1aae46,_0x9d698f)[_0x40f1('0x15')](function(_0x44e304){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x2bda74,_0x40f1('0x16'));logger[_0x40f1('0x17')](_0x40f1('0x18'),_0x2bda74,_0x40f1('0x16'),JSON[_0x40f1('0x19')](_0x44e304));if(_0x44e304['error']){if(_0x44e304[_0x40f1('0x1a')][_0x40f1('0x1b')]===0x1f4){logger[_0x40f1('0x1a')](_0x40f1('0x1c'),_0x2bda74,_0x44e304[_0x40f1('0x1a')]['message']);return _0x59ff98(_0x44e304[_0x40f1('0x1a')]['message']);}logger[_0x40f1('0x1a')](_0x40f1('0x1c'),_0x2bda74,_0x44e304[_0x40f1('0x1a')][_0x40f1('0x1d')]);return _0x47cdbf(_0x44e304[_0x40f1('0x1a')][_0x40f1('0x1d')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x2bda74,_0x40f1('0x16'));_0x47cdbf(_0x44e304[_0x40f1('0x1e')][_0x40f1('0x1d')]);}})[_0x40f1('0x1f')](function(_0x418244){logger[_0x40f1('0x1a')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2bda74,_0x418244);_0x59ff98(_0x418244);});});}exports[_0x40f1('0x20')]=function(_0x36449e){var _0x27ff82=this;return new Promise(function(_0x50c296,_0x1f958a){return db['OpenchannelInteraction'][_0x40f1('0x21')](_0x36449e[_0x40f1('0x22')],{'raw':_0x36449e[_0x40f1('0x23')]?_0x36449e[_0x40f1('0x23')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36449e[_0x40f1('0x23')]?_0x36449e[_0x40f1('0x23')][_0x40f1('0x24')]||null:null,'attributes':_0x36449e[_0x40f1('0x23')]?_0x36449e[_0x40f1('0x23')][_0x40f1('0x25')]||null:null,'limit':_0x36449e[_0x40f1('0x23')]?_0x36449e[_0x40f1('0x23')][_0x40f1('0x26')]||null:null})[_0x40f1('0x15')](function(_0x2488c0){logger[_0x40f1('0x27')](_0x40f1('0x20'),_0x36449e);logger[_0x40f1('0x17')](_0x40f1('0x20'),_0x36449e,JSON[_0x40f1('0x19')](_0x2488c0));_0x50c296(_0x2488c0);})[_0x40f1('0x1f')](function(_0x3657b7){logger[_0x40f1('0x1a')](_0x40f1('0x20'),_0x3657b7[_0x40f1('0x1d')],_0x36449e);_0x1f958a(_0x27ff82[_0x40f1('0x1a')](0x1f4,_0x3657b7[_0x40f1('0x1d')]));});});};exports[_0x40f1('0x28')]=function(_0x476945){return new Promise(function(_0x49a7b8,_0x56599d){return db[_0x40f1('0x29')][_0x40f1('0x2a')]({'where':_0x476945[_0x40f1('0x23')]?_0x476945[_0x40f1('0x23')][_0x40f1('0x24')]||null:null})['then'](function(_0x30d0d6){if(_0x30d0d6){return _0x30d0d6[_0x40f1('0x2b')](_0x476945[_0x40f1('0x22')][_0x40f1('0x2c')],_[_0x40f1('0x2d')](_0x476945['body'],[_0x40f1('0x2c'),'id'])||{});}})[_0x40f1('0x2e')](function(_0x55317c){logger[_0x40f1('0x27')](_0x40f1('0x2f'),_0x476945);logger[_0x40f1('0x17')](_0x40f1('0x2f'),_0x476945,JSON['stringify'](_0x55317c));_0x49a7b8(_0x55317c);})[_0x40f1('0x1f')](function(_0x41416e){logger[_0x40f1('0x1a')]('AddTags',_0x41416e[_0x40f1('0x1d')],_0x476945);_0x56599d(_this[_0x40f1('0x1a')](0x1f4,_0x41416e[_0x40f1('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index b8cd546..70ffa9d 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 _0x5007=['./openchannelInteraction.events','save','remove','update','emit','removeListener','register','length','openchannelInteraction:'];(function(_0x5603ce,_0x414c69){var _0x256d69=function(_0x34a61d){while(--_0x34a61d){_0x5603ce['push'](_0x5603ce['shift']());}};_0x256d69(++_0x414c69);}(_0x5007,0xf3));var _0x7500=function(_0x3382bf,_0x83ad){_0x3382bf=_0x3382bf-0x0;var _0x456cca=_0x5007[_0x3382bf];return _0x456cca;};'use strict';var OpenchannelInteractionEvents=require(_0x7500('0x0'));var events=[_0x7500('0x1'),_0x7500('0x2'),_0x7500('0x3')];function createListener(_0xbad4d1,_0x31a50d){return function(_0x22073b){_0x31a50d[_0x7500('0x4')](_0xbad4d1,_0x22073b);};}function removeListener(_0x2ef94c,_0x1933e1){return function(){OpenchannelInteractionEvents[_0x7500('0x5')](_0x2ef94c,_0x1933e1);};}exports[_0x7500('0x6')]=function(_0x5d54ec){for(var _0x59626e=0x0,_0x54cf09=events[_0x7500('0x7')];_0x59626e<_0x54cf09;_0x59626e++){var _0x4d820e=events[_0x59626e];var _0x51adf6=createListener(_0x7500('0x8')+_0x4d820e,_0x5d54ec);OpenchannelInteractionEvents['on'](_0x4d820e,_0x51adf6);}}; \ No newline at end of file +var _0x720f=['register','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x501d87,_0x321598){var _0x27a9ac=function(_0x7dfc91){while(--_0x7dfc91){_0x501d87['push'](_0x501d87['shift']());}};_0x27a9ac(++_0x321598);}(_0x720f,0xf2));var _0xf720=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x720f[_0x3cea78];return _0x33b66b;};'use strict';var OpenchannelInteractionEvents=require(_0xf720('0x0'));var events=[_0xf720('0x1'),_0xf720('0x2'),_0xf720('0x3')];function createListener(_0x3082ed,_0x352a6c){return function(_0x5cc515){_0x352a6c[_0xf720('0x4')](_0x3082ed,_0x5cc515);};}function removeListener(_0x554ae6,_0x390bb5){return function(){OpenchannelInteractionEvents[_0xf720('0x5')](_0x554ae6,_0x390bb5);};}exports[_0xf720('0x6')]=function(_0x258681){for(var _0xa9145f=0x0,_0x153ed5=events['length'];_0xa9145f<_0x153ed5;_0xa9145f++){var _0x1194e5=events[_0xa9145f];var _0xd6aa8a=createListener(_0xf720('0x7')+_0x1194e5,_0x258681);OpenchannelInteractionEvents['on'](_0x1194e5,_0xd6aa8a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 5bfab58..8c444b0 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 _0x8f72=['put','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update'];(function(_0x20eacd,_0x2394e2){var _0x57942a=function(_0xd86eda){while(--_0xd86eda){_0x20eacd['push'](_0x20eacd['shift']());}};_0x57942a(++_0x2394e2);}(_0x8f72,0xa8));var _0x28f7=function(_0x443011,_0x421288){_0x443011=_0x443011-0x0;var _0x1585cc=_0x8f72[_0x443011];return _0x1585cc;};'use strict';var multer=require(_0x28f7('0x0'));var util=require(_0x28f7('0x1'));var path=require(_0x28f7('0x2'));var timeout=require(_0x28f7('0x3'));var express=require(_0x28f7('0x4'));var router=express['Router']();var auth=require(_0x28f7('0x5'));var interaction=require(_0x28f7('0x6'));var config=require(_0x28f7('0x7'));var controller=require('./openchannelMessage.controller');router[_0x28f7('0x8')]('/',auth['isAuthenticated'](),controller[_0x28f7('0x9')]);router[_0x28f7('0x8')](_0x28f7('0xa'),auth[_0x28f7('0xb')](),controller[_0x28f7('0xc')]);router[_0x28f7('0x8')](_0x28f7('0xd'),auth[_0x28f7('0xb')](),controller[_0x28f7('0xe')]);router[_0x28f7('0xf')]('/',auth[_0x28f7('0xb')](),interaction[_0x28f7('0x10')](_0x28f7('0x11'),_0x28f7('0x12')),controller[_0x28f7('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x28f7('0x14')]);router[_0x28f7('0x15')](_0x28f7('0x16'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x28f7('0x17'),auth[_0x28f7('0xb')](),controller[_0x28f7('0x18')]);router['delete'](_0x28f7('0xd'),auth[_0x28f7('0xb')](),controller[_0x28f7('0x19')]);module[_0x28f7('0x1a')]=router; \ No newline at end of file +var _0xac86=['destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','openchannel','openchannelmessage:create','create','put','update','/:id/accept','delete'];(function(_0x2e819c,_0x3f99a5){var _0x24e271=function(_0x27d596){while(--_0x27d596){_0x2e819c['push'](_0x2e819c['shift']());}};_0x24e271(++_0x3f99a5);}(_0xac86,0xba));var _0x6ac8=function(_0x5b970b,_0x9061c0){_0x5b970b=_0x5b970b-0x0;var _0x4ef9f4=_0xac86[_0x5b970b];return _0x4ef9f4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6ac8('0x0'));var timeout=require(_0x6ac8('0x1'));var express=require(_0x6ac8('0x2'));var router=express[_0x6ac8('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6ac8('0x4'));var config=require(_0x6ac8('0x5'));var controller=require('./openchannelMessage.controller');router[_0x6ac8('0x6')]('/',auth[_0x6ac8('0x7')](),controller[_0x6ac8('0x8')]);router['get'](_0x6ac8('0x9'),auth['isAuthenticated'](),controller[_0x6ac8('0xa')]);router['get'](_0x6ac8('0xb'),auth[_0x6ac8('0x7')](),controller[_0x6ac8('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x6ac8('0xd')](_0x6ac8('0xe'),_0x6ac8('0xf')),controller[_0x6ac8('0x10')]);router[_0x6ac8('0x11')](_0x6ac8('0xb'),auth[_0x6ac8('0x7')](),controller[_0x6ac8('0x12')]);router[_0x6ac8('0x11')](_0x6ac8('0x13'),auth['isAuthenticated'](),controller['accept']);router[_0x6ac8('0x11')]('/:id/reject',auth[_0x6ac8('0x7')](),controller['reject']);router[_0x6ac8('0x14')]('/:id',auth[_0x6ac8('0x7')](),controller[_0x6ac8('0x15')]);module[_0x6ac8('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index a01b1c0..e1b690d 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 _0x135e=['TEXT','medium','BOOLEAN','out','DATE','sequelize','exports'];(function(_0x12b9ee,_0x55560f){var _0x473e8c=function(_0x13f96b){while(--_0x13f96b){_0x12b9ee['push'](_0x12b9ee['shift']());}};_0x473e8c(++_0x55560f);}(_0x135e,0x91));var _0xe135=function(_0x161f29,_0x3f90c3){_0x161f29=_0x161f29-0x0;var _0x142eec=_0x135e[_0x161f29];return _0x142eec;};'use strict';var Sequelize=require(_0xe135('0x0'));module[_0xe135('0x1')]={'body':{'type':Sequelize[_0xe135('0x2')](_0xe135('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe135('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe135('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xe135('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe135('0x2')]}}; \ No newline at end of file +var _0x605e=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT'];(function(_0x54c5f6,_0x31f831){var _0x5df0b3=function(_0x53d07d){while(--_0x53d07d){_0x54c5f6['push'](_0x54c5f6['shift']());}};_0x5df0b3(++_0x31f831);}(_0x605e,0xa5));var _0xe605=function(_0x21c5a8,_0x28ec08){_0x21c5a8=_0x21c5a8-0x0;var _0x28a438=_0x605e[_0x21c5a8];return _0x28a438;};'use strict';var Sequelize=require(_0xe605('0x0'));module[_0xe605('0x1')]={'body':{'type':Sequelize[_0xe605('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe605('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xe605('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe605('0x5')]},'providerName':{'type':Sequelize[_0xe605('0x6')]},'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 6141a31..bbe2d76 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 _0x6f2f=['update','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','show','includeAll','include','options','find','create','body','params','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','rejectmessage','html-pdf','eml-format','request-promise','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x21d2ca,_0x5a0a5f){var _0x487407=function(_0x59817e){while(--_0x59817e){_0x21d2ca['push'](_0x21d2ca['shift']());}};_0x487407(++_0x5a0a5f);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x6f2f[_0x13e741];return _0x3f8bb3;};'use strict';var pdf=require(_0xf6f2('0x0'));var emlformat=require(_0xf6f2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf6f2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf6f2('0x3'));var util=require(_0xf6f2('0x4'));var path=require(_0xf6f2('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf6f2('0x6'));var fs=require('fs');var _=require(_0xf6f2('0x7'));var squel=require(_0xf6f2('0x8'));var crypto=require(_0xf6f2('0x9'));var jsforce=require(_0xf6f2('0xa'));var deskjs=require(_0xf6f2('0xb'));var toCsv=require(_0xf6f2('0xc'));var querystring=require(_0xf6f2('0xd'));var Papa=require(_0xf6f2('0xe'));var Redis=require(_0xf6f2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf6f2('0x10'));var as=require(_0xf6f2('0x11'));var hardwareService=require(_0xf6f2('0x12'));var logger=require(_0xf6f2('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf6f2('0x14'));var db=require(_0xf6f2('0x15'))['db'];config[_0xf6f2('0x16')]=_[_0xf6f2('0x17')](config[_0xf6f2('0x16')],{'host':_0xf6f2('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6f2('0x16')]));require(_0xf6f2('0x19'))[_0xf6f2('0x1a')](socket);var jayson=require(_0xf6f2('0x1b'));var client=jayson[_0xf6f2('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xf6f2('0x1c')][_0xf6f2('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x314f9a,_0x26c176,_0x2d4294,_0x200a85){return new BPromise(function(_0x17dec3,_0x4441f3){var _0x4115dd=_0x200a85||client;return _0x4115dd[_0xf6f2('0x1e')](_0x314f9a,_0x2d4294)[_0xf6f2('0x1f')](function(_0x506b3){logger[_0xf6f2('0x20')](_0xf6f2('0x21'),_0x26c176,_0xf6f2('0x22'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x26c176,_0xf6f2('0x22'),JSON['stringify'](_0x506b3));if(_0x506b3[_0xf6f2('0x23')]){if(_0x506b3[_0xf6f2('0x23')][_0xf6f2('0x24')]===0x1f4){logger[_0xf6f2('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x26c176,_0x506b3[_0xf6f2('0x23')][_0xf6f2('0x25')]);return _0x4441f3(_0x506b3[_0xf6f2('0x23')][_0xf6f2('0x25')]);}logger['error'](_0xf6f2('0x21'),_0x26c176,_0x506b3['error'][_0xf6f2('0x25')]);return _0x17dec3(_0x506b3['error'][_0xf6f2('0x25')]);}else{logger[_0xf6f2('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x26c176,_0xf6f2('0x22'));_0x17dec3(_0x506b3[_0xf6f2('0x26')][_0xf6f2('0x25')]);}})[_0xf6f2('0x27')](function(_0x219a12){logger[_0xf6f2('0x23')](_0xf6f2('0x21'),_0x26c176,_0x219a12);_0x4441f3(_0x219a12);});});}function respondWithStatusCode(_0x1f87ab,_0x5dac6a){_0x5dac6a=_0x5dac6a||0xcc;return function(_0x2b233f){if(_0x2b233f){return _0x1f87ab[_0xf6f2('0x28')](_0x5dac6a);}return _0x1f87ab[_0xf6f2('0x29')](_0x5dac6a)[_0xf6f2('0x2a')]();};}function respondWithResult(_0x2cf300,_0x341495){_0x341495=_0x341495||0xc8;return function(_0x3b0179){if(_0x3b0179){return _0x2cf300[_0xf6f2('0x29')](_0x341495)[_0xf6f2('0x2b')](_0x3b0179);}};}function respondWithFilteredResult(_0x40243e,_0x2c643d){return function(_0x4accfe){if(_0x4accfe){var _0x2aa645=_0x4accfe[_0xf6f2('0x2c')],_0x26c4dc=_0x2c643d[_0xf6f2('0x2d')],_0x17c63f=_0x2c643d[_0xf6f2('0x2d')]+_0x2c643d[_0xf6f2('0x2e')],_0x458171;if(_0x17c63f>=_0x2aa645){_0x17c63f=_0x2aa645;_0x458171=0xc8;}else{_0x458171=0xce;}_0x40243e[_0xf6f2('0x29')](_0x458171);return _0x40243e[_0xf6f2('0x2f')](_0xf6f2('0x30'),_0x26c4dc+'-'+_0x17c63f+'/'+_0x2aa645)[_0xf6f2('0x2b')](_0x4accfe);}return null;};}function patchUpdates(_0x5281cf){return function(_0x13145f){try{jsonpatch[_0xf6f2('0x31')](_0x13145f,_0x5281cf,!![]);}catch(_0x2fc531){return BPromise[_0xf6f2('0x32')](_0x2fc531);}return _0x13145f[_0xf6f2('0x33')]();};}function saveUpdates(_0x3a421f,_0x630ebf){return function(_0x18570a){if(_0x18570a){return _0x18570a[_0xf6f2('0x34')](_0x3a421f)[_0xf6f2('0x1f')](function(_0x68c829){return _0x68c829;});}return null;};}function removeEntity(_0x22e17c,_0x258cf7){return function(_0x5c23b2){if(_0x5c23b2){return _0x5c23b2['destroy']()['then'](function(){_0x22e17c[_0xf6f2('0x29')](0xcc)[_0xf6f2('0x2a')]();});}};}function handleEntityNotFound(_0x4f5763,_0x5f29ba){return function(_0x160d58){if(!_0x160d58){_0x4f5763[_0xf6f2('0x28')](0x194);}return _0x160d58;};}function handleError(_0x436d5f,_0x9bf3e0){_0x9bf3e0=_0x9bf3e0||0x1f4;return function(_0xce0c28){logger[_0xf6f2('0x23')](_0xce0c28['stack']);if(_0xce0c28[_0xf6f2('0x35')]){delete _0xce0c28['name'];}_0x436d5f[_0xf6f2('0x29')](_0x9bf3e0)[_0xf6f2('0x36')](_0xce0c28);};}exports[_0xf6f2('0x37')]=function(_0x2b13f2,_0x5d3c67){var _0x464e2c={},_0x311a37={},_0x4f4dce={'count':0x0,'rows':[]};var _0x4bf2df=_[_0xf6f2('0x38')](db[_0xf6f2('0x39')][_0xf6f2('0x3a')],function(_0x598489){return{'name':_0x598489[_0xf6f2('0x3b')],'type':_0x598489['type'][_0xf6f2('0x3c')]};});_0x311a37[_0xf6f2('0x3d')]=_[_0xf6f2('0x38')](_0x4bf2df,'name');_0x311a37[_0xf6f2('0x3e')]=_[_0xf6f2('0x3f')](_0x2b13f2[_0xf6f2('0x3e')]);_0x311a37[_0xf6f2('0x40')]=_[_0xf6f2('0x41')](_0x311a37['model'],_0x311a37[_0xf6f2('0x3e')]);_0x464e2c[_0xf6f2('0x42')]=_[_0xf6f2('0x41')](_0x311a37[_0xf6f2('0x3d')],qs[_0xf6f2('0x43')](_0x2b13f2[_0xf6f2('0x3e')][_0xf6f2('0x43')]));_0x464e2c['attributes']=_0x464e2c[_0xf6f2('0x42')][_0xf6f2('0x44')]?_0x464e2c[_0xf6f2('0x42')]:_0x311a37['model'];if(!_0x2b13f2[_0xf6f2('0x3e')][_0xf6f2('0x45')](_0xf6f2('0x46'))){_0x464e2c[_0xf6f2('0x2e')]=qs[_0xf6f2('0x2e')](_0x2b13f2['query'][_0xf6f2('0x2e')]);_0x464e2c[_0xf6f2('0x2d')]=qs[_0xf6f2('0x2d')](_0x2b13f2[_0xf6f2('0x3e')][_0xf6f2('0x2d')]);}_0x464e2c['order']=qs[_0xf6f2('0x47')](_0x2b13f2['query'][_0xf6f2('0x47')]);_0x464e2c[_0xf6f2('0x48')]=qs[_0xf6f2('0x40')](_[_0xf6f2('0x49')](_0x2b13f2[_0xf6f2('0x3e')],_0x311a37[_0xf6f2('0x40')]),_0x4bf2df);if(_0x2b13f2[_0xf6f2('0x3e')][_0xf6f2('0x4a')]){_0x464e2c[_0xf6f2('0x48')]=_[_0xf6f2('0x4b')](_0x464e2c[_0xf6f2('0x48')],{'$or':_['map'](_0x4bf2df,function(_0x904241){if(_0x904241[_0xf6f2('0x4c')]!==_0xf6f2('0x4d')){var _0x4c83e2={};_0x4c83e2[_0x904241['name']]={'$like':'%'+_0x2b13f2['query'][_0xf6f2('0x4a')]+'%'};return _0x4c83e2;}})});}_0x464e2c=_[_0xf6f2('0x4b')]({},_0x464e2c,_0x2b13f2['options']);var _0x5c1b80={'where':_0x464e2c[_0xf6f2('0x48')]};return db[_0xf6f2('0x39')][_0xf6f2('0x2c')](_0x5c1b80)[_0xf6f2('0x1f')](function(_0x11dd69){_0x4f4dce[_0xf6f2('0x2c')]=_0x11dd69;if(_0x2b13f2['query']['includeAll']){_0x464e2c['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xf6f2('0x4e')](_0x464e2c);})['then'](function(_0x37927d){_0x4f4dce[_0xf6f2('0x4f')]=_0x37927d;return _0x4f4dce;})[_0xf6f2('0x1f')](respondWithFilteredResult(_0x5d3c67,_0x464e2c))[_0xf6f2('0x27')](handleError(_0x5d3c67,null));};exports[_0xf6f2('0x50')]=function(_0x52939f,_0x5a7b28){var _0x198b62={'raw':!![],'where':{'id':_0x52939f['params']['id']}},_0x5f3863={};_0x5f3863[_0xf6f2('0x3d')]=_[_0xf6f2('0x3f')](db[_0xf6f2('0x39')][_0xf6f2('0x3a')]);_0x5f3863[_0xf6f2('0x3e')]=_[_0xf6f2('0x3f')](_0x52939f['query']);_0x5f3863[_0xf6f2('0x40')]=_[_0xf6f2('0x41')](_0x5f3863['model'],_0x5f3863[_0xf6f2('0x3e')]);_0x198b62[_0xf6f2('0x42')]=_[_0xf6f2('0x41')](_0x5f3863['model'],qs[_0xf6f2('0x43')](_0x52939f[_0xf6f2('0x3e')][_0xf6f2('0x43')]));_0x198b62[_0xf6f2('0x42')]=_0x198b62[_0xf6f2('0x42')][_0xf6f2('0x44')]?_0x198b62[_0xf6f2('0x42')]:_0x5f3863[_0xf6f2('0x3d')];if(_0x52939f[_0xf6f2('0x3e')][_0xf6f2('0x51')]){_0x198b62[_0xf6f2('0x52')]=[{'all':!![]}];}_0x198b62=_['merge']({},_0x198b62,_0x52939f[_0xf6f2('0x53')]);return db[_0xf6f2('0x39')][_0xf6f2('0x54')](_0x198b62)[_0xf6f2('0x1f')](handleEntityNotFound(_0x5a7b28,null))[_0xf6f2('0x1f')](respondWithResult(_0x5a7b28,null))[_0xf6f2('0x27')](handleError(_0x5a7b28,null));};exports[_0xf6f2('0x55')]=function(_0x22e7d1,_0x328cb0){return db[_0xf6f2('0x39')]['create'](_0x22e7d1[_0xf6f2('0x56')],{})[_0xf6f2('0x1f')](respondWithResult(_0x328cb0,0xc9))['catch'](handleError(_0x328cb0,null));};exports[_0xf6f2('0x34')]=function(_0x59dbfc,_0x5e4d86){if(_0x59dbfc[_0xf6f2('0x56')]['id']){delete _0x59dbfc[_0xf6f2('0x56')]['id'];}return db[_0xf6f2('0x39')][_0xf6f2('0x54')]({'where':{'id':_0x59dbfc[_0xf6f2('0x57')]['id']}})[_0xf6f2('0x1f')](handleEntityNotFound(_0x5e4d86,null))[_0xf6f2('0x1f')](saveUpdates(_0x59dbfc[_0xf6f2('0x56')],null))['then'](respondWithResult(_0x5e4d86,null))[_0xf6f2('0x27')](handleError(_0x5e4d86,null));};exports['destroy']=function(_0x2efa18,_0x4bceba){return db[_0xf6f2('0x39')][_0xf6f2('0x54')]({'where':{'id':_0x2efa18[_0xf6f2('0x57')]['id']}})[_0xf6f2('0x1f')](handleEntityNotFound(_0x4bceba,null))['then'](removeEntity(_0x4bceba,null))[_0xf6f2('0x27')](handleError(_0x4bceba,null));};exports[_0xf6f2('0x58')]=function(_0x52d278,_0x2c67cc){return db[_0xf6f2('0x39')]['describe']()[_0xf6f2('0x1f')](respondWithResult(_0x2c67cc,null))[_0xf6f2('0x27')](handleError(_0x2c67cc,null));};var interaction_log=require(_0xf6f2('0x13'))(_0xf6f2('0x59'));exports[_0xf6f2('0x5a')]=function(_0x176d0f,_0x178d55,_0x27de66){var _0x51dd58={'channel':_0xf6f2('0x5b')};if(_0x176d0f[_0xf6f2('0x56')]['id']){delete _0x176d0f['body']['id'];}_0x176d0f[_0xf6f2('0x56')]['read']=!![];_0x176d0f['body'][_0xf6f2('0x5c')]=moment()[_0xf6f2('0x5d')](_0xf6f2('0x5e'));_0x176d0f['body'][_0xf6f2('0x5f')]=_0x176d0f[_0xf6f2('0x56')][_0xf6f2('0x5f')]||_0x176d0f[_0xf6f2('0x60')]['id'];return db['OpenchannelMessage']['find']({'where':{'id':_0x176d0f[_0xf6f2('0x57')]['id'],'UserId':null},'include':[{'model':db[_0xf6f2('0x61')],'as':_0xf6f2('0x62')}]})[_0xf6f2('0x1f')](handleEntityNotFound(_0x178d55,null))[_0xf6f2('0x1f')](saveUpdates(_0x176d0f[_0xf6f2('0x56')],null))[_0xf6f2('0x1f')](function(_0x2ec204){if(_0x2ec204){_0x51dd58['message']=_0x2ec204[_0xf6f2('0x63')]({'plain':!![]});return db['OpenchannelInteraction'][_0xf6f2('0x54')]({'where':{'id':_0x2ec204[_0xf6f2('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x178d55,null))[_0xf6f2('0x1f')](function(_0x4fe17b){if(_0x4fe17b){return _0x4fe17b[_0xf6f2('0x34')]({'UserId':_0x176d0f[_0xf6f2('0x56')]['UserId'],'read1stAt':_[_0xf6f2('0x65')](_0x4fe17b[_0xf6f2('0x66')])?moment()[_0xf6f2('0x5d')](_0xf6f2('0x5e')):undefined});}return null;})[_0xf6f2('0x1f')](function(_0x4c1695){if(_0x4c1695){_0x51dd58[_0xf6f2('0x67')]=_0x4c1695[_0xf6f2('0x63')]({'plain':!![]});interaction_log[_0xf6f2('0x20')](_0xf6f2('0x68'),_0x176d0f['user']['id'],_0x176d0f[_0xf6f2('0x60')][_0xf6f2('0x35')],_0x176d0f[_0xf6f2('0x60')]['role'],_0x51dd58['interaction']['id'],_0x176d0f[_0xf6f2('0x56')]?JSON[_0xf6f2('0x69')](_0x176d0f[_0xf6f2('0x56')]):'null');return respondWithRpcPromise(_0xf6f2('0x6a'),_0xf6f2('0x6b'),_0x51dd58);}return null;})[_0xf6f2('0x1f')](function(_0x5a2ad6){if(_0x5a2ad6){if(_0x176d0f[_0xf6f2('0x56')][_0xf6f2('0x6c')]){_0x51dd58[_0xf6f2('0x25')][_0xf6f2('0x6d')]=util['format'](_0xf6f2('0x6e'),_0x176d0f[_0xf6f2('0x60')]['name']);_0x51dd58[_0xf6f2('0x25')][_0xf6f2('0x6f')]=_0x51dd58[_0xf6f2('0x6f')];_0x51dd58['message'][_0xf6f2('0x70')]=_0xf6f2('0x5a');return respondWithRpcPromise(_0xf6f2('0x71'),_0xf6f2('0x71'),{'event':_0xf6f2('0x72'),'message':_0x51dd58[_0xf6f2('0x25')]},client9002)[_0xf6f2('0x1f')](function(){return _0x51dd58;});}return _0x51dd58;}return null;})[_0xf6f2('0x1f')](respondWithResult(_0x178d55,null))[_0xf6f2('0x27')](handleError(_0x178d55,null));};var interaction_log=require(_0xf6f2('0x13'))(_0xf6f2('0x59'));exports[_0xf6f2('0x32')]=function(_0xfe7e86,_0x2a9756,_0x233d59){var _0x1243cd={'agent':{},'channel':_0xf6f2('0x5b')};if(_0xfe7e86[_0xf6f2('0x56')]['id']){delete _0xfe7e86[_0xf6f2('0x56')]['id'];}_0xfe7e86[_0xf6f2('0x56')][_0xf6f2('0x5f')]=_0xfe7e86[_0xf6f2('0x56')]['UserId']||_0xfe7e86[_0xf6f2('0x60')]['id'];_0x1243cd[_0xf6f2('0x73')]['id']=_0xfe7e86[_0xf6f2('0x56')]['UserId'];return db['OpenchannelMessage']['find']({'where':{'id':_0xfe7e86[_0xf6f2('0x57')]['id'],'UserId':null}})[_0xf6f2('0x1f')](handleEntityNotFound(_0x2a9756,null))[_0xf6f2('0x1f')](function(_0xfabb12){if(_0xfabb12){_0x1243cd[_0xf6f2('0x25')]=_0xfabb12[_0xf6f2('0x63')]({'plain':!![]});return db[_0xf6f2('0x74')][_0xf6f2('0x54')]({'where':{'id':_0xfabb12[_0xf6f2('0x64')]}});}return null;})[_0xf6f2('0x1f')](handleEntityNotFound(_0x2a9756,null))[_0xf6f2('0x1f')](function(_0x50a8a3){if(_0x50a8a3){_0x1243cd[_0xf6f2('0x67')]=_0x50a8a3[_0xf6f2('0x63')]({'plain':!![]});interaction_log[_0xf6f2('0x20')](_0xf6f2('0x75'),_0xfe7e86[_0xf6f2('0x60')]['id'],_0xfe7e86['user']['name'],_0xfe7e86[_0xf6f2('0x60')][_0xf6f2('0x76')],_0x1243cd['interaction']['id'],_0xfe7e86[_0xf6f2('0x56')]?JSON[_0xf6f2('0x69')](_0xfe7e86[_0xf6f2('0x56')]):'null');return respondWithRpcPromise('RejectMessage',_0xf6f2('0x77'),_0x1243cd);}return null;})[_0xf6f2('0x1f')](function(_0x1fd79c){if(_0x1fd79c){_0x1fd79c['message'][_0xf6f2('0x6d')]=util[_0xf6f2('0x5d')](_0xf6f2('0x6e'),_0xfe7e86[_0xf6f2('0x60')]['name']);_0x1fd79c[_0xf6f2('0x25')][_0xf6f2('0x6f')]=_0x1243cd['channel'];_0x1fd79c[_0xf6f2('0x25')][_0xf6f2('0x70')]=_0xf6f2('0x32');respondWithRpcPromise(_0xf6f2('0x71'),_0xf6f2('0x71'),{'event':_0xf6f2('0x78'),'message':_0x1fd79c['message']},client9002);return _0x1243cd;}return null;})[_0xf6f2('0x1f')](respondWithResult(_0x2a9756,null))[_0xf6f2('0x27')](handleError(_0x2a9756,null));}; \ No newline at end of file +var _0x235a=['UserId','user','CmContact','Contact','get','OpenchannelInteraction','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','channel','event','EventManager','acceptmessage','agent','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','send','map','rawAttributes','type','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','findAll','rows','params','length','find','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x840d7,_0xfb0c64){var _0x376053=function(_0x191796){while(--_0x191796){_0x840d7['push'](_0x840d7['shift']());}};_0x376053(++_0xfb0c64);}(_0x235a,0x1ef));var _0xa235=function(_0x30b871,_0x3832dd){_0x30b871=_0x30b871-0x0;var _0x3a3882=_0x235a[_0x30b871];return _0x3a3882;};'use strict';var pdf=require(_0xa235('0x0'));var emlformat=require(_0xa235('0x1'));var rimraf=require(_0xa235('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa235('0x3'));var rp=require('request-promise');var moment=require(_0xa235('0x4'));var BPromise=require(_0xa235('0x5'));var Mustache=require(_0xa235('0x6'));var util=require(_0xa235('0x7'));var path=require(_0xa235('0x8'));var sox=require(_0xa235('0x9'));var csv=require(_0xa235('0xa'));var ejs=require(_0xa235('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa235('0xc'));var crypto=require(_0xa235('0xd'));var jsforce=require(_0xa235('0xe'));var deskjs=require(_0xa235('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa235('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa235('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa235('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa235('0x13'));var config=require(_0xa235('0x14'));var licenseUtil=require(_0xa235('0x15'));var db=require(_0xa235('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xa235('0x17'),'port':0x18eb});var socket=require(_0xa235('0x18'))(new Redis(config[_0xa235('0x19')]));require(_0xa235('0x1a'))[_0xa235('0x1b')](socket);var jayson=require(_0xa235('0x1c'));var client=jayson[_0xa235('0x1d')][_0xa235('0x1e')]({'port':0x232c});var client9002=jayson[_0xa235('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x352463,_0x20cd67,_0x26fd63,_0x128244){return new BPromise(function(_0x16dbe9,_0x2a1496){var _0x5c6e95=_0x128244||client;return _0x5c6e95['request'](_0x352463,_0x26fd63)[_0xa235('0x1f')](function(_0x24f9e1){logger[_0xa235('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x20cd67,_0xa235('0x21'));logger[_0xa235('0x22')](_0xa235('0x23'),_0x20cd67,_0xa235('0x21'),JSON[_0xa235('0x24')](_0x24f9e1));if(_0x24f9e1[_0xa235('0x25')]){if(_0x24f9e1[_0xa235('0x25')]['code']===0x1f4){logger['error'](_0xa235('0x26'),_0x20cd67,_0x24f9e1[_0xa235('0x25')][_0xa235('0x27')]);return _0x2a1496(_0x24f9e1[_0xa235('0x25')][_0xa235('0x27')]);}logger[_0xa235('0x25')](_0xa235('0x26'),_0x20cd67,_0x24f9e1[_0xa235('0x25')][_0xa235('0x27')]);return _0x16dbe9(_0x24f9e1[_0xa235('0x25')][_0xa235('0x27')]);}else{logger[_0xa235('0x20')](_0xa235('0x26'),_0x20cd67,_0xa235('0x21'));_0x16dbe9(_0x24f9e1[_0xa235('0x28')][_0xa235('0x27')]);}})[_0xa235('0x29')](function(_0x13c868){logger[_0xa235('0x25')](_0xa235('0x26'),_0x20cd67,_0x13c868);_0x2a1496(_0x13c868);});});}function respondWithStatusCode(_0x1ebb2c,_0x57f591){_0x57f591=_0x57f591||0xcc;return function(_0xe1176c){if(_0xe1176c){return _0x1ebb2c['sendStatus'](_0x57f591);}return _0x1ebb2c[_0xa235('0x2a')](_0x57f591)['end']();};}function respondWithResult(_0x442edf,_0x3ab925){_0x3ab925=_0x3ab925||0xc8;return function(_0x7a6f13){if(_0x7a6f13){return _0x442edf[_0xa235('0x2a')](_0x3ab925)[_0xa235('0x2b')](_0x7a6f13);}};}function respondWithFilteredResult(_0x5d811a,_0x2585c7){return function(_0x612f2){if(_0x612f2){var _0x55a21e=_0x612f2[_0xa235('0x2c')],_0x4b33ef=_0x2585c7[_0xa235('0x2d')],_0x502df9=_0x2585c7[_0xa235('0x2d')]+_0x2585c7[_0xa235('0x2e')],_0x587a9b;if(_0x502df9>=_0x55a21e){_0x502df9=_0x55a21e;_0x587a9b=0xc8;}else{_0x587a9b=0xce;}_0x5d811a[_0xa235('0x2a')](_0x587a9b);return _0x5d811a[_0xa235('0x2f')](_0xa235('0x30'),_0x4b33ef+'-'+_0x502df9+'/'+_0x55a21e)['json'](_0x612f2);}return null;};}function patchUpdates(_0x47db2e){return function(_0x2832be){try{jsonpatch[_0xa235('0x31')](_0x2832be,_0x47db2e,!![]);}catch(_0x57a2b0){return BPromise[_0xa235('0x32')](_0x57a2b0);}return _0x2832be[_0xa235('0x33')]();};}function saveUpdates(_0x23b3f3,_0x172e53){return function(_0x324157){if(_0x324157){return _0x324157[_0xa235('0x34')](_0x23b3f3)[_0xa235('0x1f')](function(_0x193d3a){return _0x193d3a;});}return null;};}function removeEntity(_0x48eb72,_0x23718a){return function(_0x5a701b){if(_0x5a701b){return _0x5a701b[_0xa235('0x35')]()[_0xa235('0x1f')](function(){_0x48eb72[_0xa235('0x2a')](0xcc)[_0xa235('0x36')]();});}};}function handleEntityNotFound(_0x453571,_0x43ff4a){return function(_0x43752f){if(!_0x43752f){_0x453571[_0xa235('0x37')](0x194);}return _0x43752f;};}function handleError(_0xa1b9d2,_0x34bba1){_0x34bba1=_0x34bba1||0x1f4;return function(_0x291fb3){logger[_0xa235('0x25')](_0x291fb3[_0xa235('0x38')]);if(_0x291fb3['name']){delete _0x291fb3['name'];}_0xa1b9d2['status'](_0x34bba1)[_0xa235('0x39')](_0x291fb3);};}exports['index']=function(_0x36fedf,_0x142e3b){var _0x27ac63={},_0x21a835={},_0x473af7={'count':0x0,'rows':[]};var _0x94471f=_[_0xa235('0x3a')](db['OpenchannelMessage'][_0xa235('0x3b')],function(_0x244a16){return{'name':_0x244a16['fieldName'],'type':_0x244a16[_0xa235('0x3c')][_0xa235('0x3d')]};});_0x21a835[_0xa235('0x3e')]=_[_0xa235('0x3a')](_0x94471f,_0xa235('0x3f'));_0x21a835[_0xa235('0x40')]=_[_0xa235('0x41')](_0x36fedf[_0xa235('0x40')]);_0x21a835[_0xa235('0x42')]=_['intersection'](_0x21a835[_0xa235('0x3e')],_0x21a835[_0xa235('0x40')]);_0x27ac63[_0xa235('0x43')]=_[_0xa235('0x44')](_0x21a835[_0xa235('0x3e')],qs['fields'](_0x36fedf[_0xa235('0x40')][_0xa235('0x45')]));_0x27ac63[_0xa235('0x43')]=_0x27ac63[_0xa235('0x43')]['length']?_0x27ac63[_0xa235('0x43')]:_0x21a835[_0xa235('0x3e')];if(!_0x36fedf[_0xa235('0x40')][_0xa235('0x46')](_0xa235('0x47'))){_0x27ac63[_0xa235('0x2e')]=qs[_0xa235('0x2e')](_0x36fedf['query'][_0xa235('0x2e')]);_0x27ac63[_0xa235('0x2d')]=qs[_0xa235('0x2d')](_0x36fedf[_0xa235('0x40')][_0xa235('0x2d')]);}_0x27ac63['order']=qs[_0xa235('0x48')](_0x36fedf[_0xa235('0x40')][_0xa235('0x48')]);_0x27ac63[_0xa235('0x49')]=qs[_0xa235('0x42')](_['pick'](_0x36fedf[_0xa235('0x40')],_0x21a835[_0xa235('0x42')]),_0x94471f);if(_0x36fedf[_0xa235('0x40')][_0xa235('0x4a')]){_0x27ac63[_0xa235('0x49')]=_[_0xa235('0x4b')](_0x27ac63[_0xa235('0x49')],{'$or':_[_0xa235('0x3a')](_0x94471f,function(_0x4fd2bf){if(_0x4fd2bf[_0xa235('0x3c')]!==_0xa235('0x4c')){var _0x170997={};_0x170997[_0x4fd2bf[_0xa235('0x3f')]]={'$like':'%'+_0x36fedf[_0xa235('0x40')][_0xa235('0x4a')]+'%'};return _0x170997;}})});}_0x27ac63=_[_0xa235('0x4b')]({},_0x27ac63,_0x36fedf[_0xa235('0x4d')]);var _0xec860f={'where':_0x27ac63['where']};return db[_0xa235('0x4e')][_0xa235('0x2c')](_0xec860f)[_0xa235('0x1f')](function(_0xd9c9e7){_0x473af7[_0xa235('0x2c')]=_0xd9c9e7;if(_0x36fedf['query'][_0xa235('0x4f')]){_0x27ac63[_0xa235('0x50')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xa235('0x51')](_0x27ac63);})[_0xa235('0x1f')](function(_0x2ba694){_0x473af7[_0xa235('0x52')]=_0x2ba694;return _0x473af7;})['then'](respondWithFilteredResult(_0x142e3b,_0x27ac63))[_0xa235('0x29')](handleError(_0x142e3b,null));};exports['show']=function(_0x1fce0a,_0x454948){var _0x48b345={'raw':!![],'where':{'id':_0x1fce0a[_0xa235('0x53')]['id']}},_0x308dc1={};_0x308dc1[_0xa235('0x3e')]=_[_0xa235('0x41')](db[_0xa235('0x4e')][_0xa235('0x3b')]);_0x308dc1[_0xa235('0x40')]=_[_0xa235('0x41')](_0x1fce0a['query']);_0x308dc1['filters']=_['intersection'](_0x308dc1[_0xa235('0x3e')],_0x308dc1[_0xa235('0x40')]);_0x48b345[_0xa235('0x43')]=_[_0xa235('0x44')](_0x308dc1['model'],qs[_0xa235('0x45')](_0x1fce0a['query'][_0xa235('0x45')]));_0x48b345[_0xa235('0x43')]=_0x48b345[_0xa235('0x43')][_0xa235('0x54')]?_0x48b345['attributes']:_0x308dc1[_0xa235('0x3e')];if(_0x1fce0a['query'][_0xa235('0x4f')]){_0x48b345[_0xa235('0x50')]=[{'all':!![]}];}_0x48b345=_['merge']({},_0x48b345,_0x1fce0a[_0xa235('0x4d')]);return db[_0xa235('0x4e')][_0xa235('0x55')](_0x48b345)[_0xa235('0x1f')](handleEntityNotFound(_0x454948,null))['then'](respondWithResult(_0x454948,null))['catch'](handleError(_0x454948,null));};exports['create']=function(_0x386ba7,_0xf12277){return db['OpenchannelMessage']['create'](_0x386ba7[_0xa235('0x56')],{})['then'](respondWithResult(_0xf12277,0xc9))['catch'](handleError(_0xf12277,null));};exports[_0xa235('0x34')]=function(_0x16b035,_0x873161){if(_0x16b035[_0xa235('0x56')]['id']){delete _0x16b035['body']['id'];}return db[_0xa235('0x4e')][_0xa235('0x55')]({'where':{'id':_0x16b035[_0xa235('0x53')]['id']}})[_0xa235('0x1f')](handleEntityNotFound(_0x873161,null))[_0xa235('0x1f')](saveUpdates(_0x16b035[_0xa235('0x56')],null))[_0xa235('0x1f')](respondWithResult(_0x873161,null))[_0xa235('0x29')](handleError(_0x873161,null));};exports[_0xa235('0x35')]=function(_0x7917a5,_0x48fa5e){return db[_0xa235('0x4e')][_0xa235('0x55')]({'where':{'id':_0x7917a5[_0xa235('0x53')]['id']}})[_0xa235('0x1f')](handleEntityNotFound(_0x48fa5e,null))[_0xa235('0x1f')](removeEntity(_0x48fa5e,null))['catch'](handleError(_0x48fa5e,null));};exports[_0xa235('0x57')]=function(_0x10cc99,_0x50c521){return db[_0xa235('0x4e')][_0xa235('0x57')]()['then'](respondWithResult(_0x50c521,null))['catch'](handleError(_0x50c521,null));};var interaction_log=require('../../config/logger')(_0xa235('0x58'));exports[_0xa235('0x59')]=function(_0x55392a,_0x3a3b8c,_0x4e1d6a){var _0x5c00d5={'channel':_0xa235('0x5a')};if(_0x55392a['body']['id']){delete _0x55392a[_0xa235('0x56')]['id'];}_0x55392a[_0xa235('0x56')][_0xa235('0x5b')]=!![];_0x55392a[_0xa235('0x56')][_0xa235('0x5c')]=moment()[_0xa235('0x5d')](_0xa235('0x5e'));_0x55392a[_0xa235('0x56')][_0xa235('0x5f')]=_0x55392a[_0xa235('0x56')][_0xa235('0x5f')]||_0x55392a[_0xa235('0x60')]['id'];return db[_0xa235('0x4e')][_0xa235('0x55')]({'where':{'id':_0x55392a[_0xa235('0x53')]['id'],'UserId':null},'include':[{'model':db[_0xa235('0x61')],'as':_0xa235('0x62')}]})['then'](handleEntityNotFound(_0x3a3b8c,null))[_0xa235('0x1f')](saveUpdates(_0x55392a[_0xa235('0x56')],null))[_0xa235('0x1f')](function(_0x5c0c12){if(_0x5c0c12){_0x5c00d5['message']=_0x5c0c12[_0xa235('0x63')]({'plain':!![]});return db[_0xa235('0x64')][_0xa235('0x55')]({'where':{'id':_0x5c0c12['OpenchannelInteractionId']}});}return null;})[_0xa235('0x1f')](handleEntityNotFound(_0x3a3b8c,null))['then'](function(_0x3d45ee){if(_0x3d45ee){return _0x3d45ee['update']({'UserId':_0x55392a['body'][_0xa235('0x5f')],'read1stAt':_['isNil'](_0x3d45ee['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x30003c){if(_0x30003c){_0x5c00d5[_0xa235('0x65')]=_0x30003c[_0xa235('0x63')]({'plain':!![]});interaction_log['info'](_0xa235('0x66'),_0x55392a[_0xa235('0x60')]['id'],_0x55392a[_0xa235('0x60')][_0xa235('0x3f')],_0x55392a[_0xa235('0x60')]['role'],_0x5c00d5[_0xa235('0x65')]['id'],_0x55392a[_0xa235('0x56')]?JSON[_0xa235('0x24')](_0x55392a[_0xa235('0x56')]):_0xa235('0x67'));return respondWithRpcPromise(_0xa235('0x68'),_0xa235('0x69'),_0x5c00d5);}return null;})['then'](function(_0x5bde03){if(_0x5bde03){if(_0x55392a[_0xa235('0x56')][_0xa235('0x6a')]){_0x5c00d5[_0xa235('0x27')]['interface']=util[_0xa235('0x5d')]('SIP/%s',_0x55392a[_0xa235('0x60')][_0xa235('0x3f')]);_0x5c00d5['message'][_0xa235('0x6b')]=_0x5c00d5[_0xa235('0x6b')];_0x5c00d5[_0xa235('0x27')][_0xa235('0x6c')]=_0xa235('0x59');return respondWithRpcPromise(_0xa235('0x6d'),'EventManager',{'event':_0xa235('0x6e'),'message':_0x5c00d5[_0xa235('0x27')]},client9002)[_0xa235('0x1f')](function(){return _0x5c00d5;});}return _0x5c00d5;}return null;})[_0xa235('0x1f')](respondWithResult(_0x3a3b8c,null))[_0xa235('0x29')](handleError(_0x3a3b8c,null));};var interaction_log=require('../../config/logger')(_0xa235('0x58'));exports[_0xa235('0x32')]=function(_0x11662a,_0x3fb1b8,_0x1b5c05){var _0x5dc52d={'agent':{},'channel':_0xa235('0x5a')};if(_0x11662a[_0xa235('0x56')]['id']){delete _0x11662a[_0xa235('0x56')]['id'];}_0x11662a[_0xa235('0x56')][_0xa235('0x5f')]=_0x11662a[_0xa235('0x56')]['UserId']||_0x11662a[_0xa235('0x60')]['id'];_0x5dc52d[_0xa235('0x6f')]['id']=_0x11662a['body'][_0xa235('0x5f')];return db['OpenchannelMessage'][_0xa235('0x55')]({'where':{'id':_0x11662a[_0xa235('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3fb1b8,null))[_0xa235('0x1f')](function(_0x55e282){if(_0x55e282){_0x5dc52d['message']=_0x55e282[_0xa235('0x63')]({'plain':!![]});return db[_0xa235('0x64')][_0xa235('0x55')]({'where':{'id':_0x55e282[_0xa235('0x70')]}});}return null;})[_0xa235('0x1f')](handleEntityNotFound(_0x3fb1b8,null))[_0xa235('0x1f')](function(_0x371176){if(_0x371176){_0x5dc52d[_0xa235('0x65')]=_0x371176[_0xa235('0x63')]({'plain':!![]});interaction_log['info'](_0xa235('0x71'),_0x11662a['user']['id'],_0x11662a[_0xa235('0x60')][_0xa235('0x3f')],_0x11662a[_0xa235('0x60')]['role'],_0x5dc52d[_0xa235('0x65')]['id'],_0x11662a[_0xa235('0x56')]?JSON[_0xa235('0x24')](_0x11662a[_0xa235('0x56')]):'null');return respondWithRpcPromise('RejectMessage',_0xa235('0x72'),_0x5dc52d);}return null;})['then'](function(_0x1fd843){if(_0x1fd843){_0x1fd843[_0xa235('0x27')][_0xa235('0x73')]=util['format'](_0xa235('0x74'),_0x11662a[_0xa235('0x60')][_0xa235('0x3f')]);_0x1fd843[_0xa235('0x27')][_0xa235('0x6b')]=_0x5dc52d[_0xa235('0x6b')];_0x1fd843['message'][_0xa235('0x6c')]=_0xa235('0x32');respondWithRpcPromise(_0xa235('0x6d'),_0xa235('0x6d'),{'event':_0xa235('0x75'),'message':_0x1fd843[_0xa235('0x27')]},client9002);return _0x5dc52d;}return null;})[_0xa235('0x1f')](respondWithResult(_0x3fb1b8,null))[_0xa235('0x29')](handleError(_0x3fb1b8,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 2f3a8b4..b886d0e 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 _0x267a=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x2c22d4,_0xe73c28){var _0x36a1f7=function(_0x243215){while(--_0x243215){_0x2c22d4['push'](_0x2c22d4['shift']());}};_0x36a1f7(++_0xe73c28);}(_0x267a,0xaf));var _0xa267=function(_0x163f58,_0x1c8ae4){_0x163f58=_0x163f58-0x0;var _0x472ed9=_0x267a[_0x163f58];return _0x472ed9;};'use strict';var EventEmitter=require(_0xa267('0x0'));var OpenchannelMessage=require(_0xa267('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa267('0x2')](0x0);var events={'afterCreate':_0xa267('0x3'),'afterUpdate':_0xa267('0x4'),'afterDestroy':_0xa267('0x5')};function emitEvent(_0x2ff6b7){return function(_0x25e038,_0x25f2bf,_0x14ecd7){OpenchannelMessageEvents[_0xa267('0x6')](_0x2ff6b7+':'+_0x25e038['id'],_0x25e038);OpenchannelMessageEvents[_0xa267('0x6')](_0x2ff6b7,_0x25e038);_0x14ecd7(null);};}for(var e in events){if(events[_0xa267('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xa267('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x6483=['emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove'];(function(_0x4d34f4,_0x15dcd7){var _0x23330f=function(_0x52c76b){while(--_0x52c76b){_0x4d34f4['push'](_0x4d34f4['shift']());}};_0x23330f(++_0x15dcd7);}(_0x6483,0x9c));var _0x3648=function(_0x2bb894,_0xd14ef0){_0x2bb894=_0x2bb894-0x0;var _0x33ce7f=_0x6483[_0x2bb894];return _0x33ce7f;};'use strict';var EventEmitter=require(_0x3648('0x0'));var OpenchannelMessage=require(_0x3648('0x1'))['db'][_0x3648('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x3648('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3648('0x4'),'afterDestroy':_0x3648('0x5')};function emitEvent(_0x3f6855){return function(_0x53e18c,_0x8480b1,_0xbd6566){OpenchannelMessageEvents['emit'](_0x3f6855+':'+_0x53e18c['id'],_0x53e18c);OpenchannelMessageEvents[_0x3648('0x6')](_0x3f6855,_0x53e18c);_0xbd6566(null);};}for(var e in events){if(events[_0x3648('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x3648('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index ddae691..bcd9ec7 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 _0x1fa4=['UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','catch','CmContact','describe','then','find','OpenchannelAccountId','Interactions','Contact','keys','info','format','Forwarding\x20message\x20%d\x20to\x20%s','length','method','GET','POST','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','replyUri','threadId','Interaction','update','error','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','secret'];(function(_0x3b0c7d,_0x15adcc){var _0x438b84=function(_0x1d42f4){while(--_0x1d42f4){_0x3b0c7d['push'](_0x3b0c7d['shift']());}};_0x438b84(++_0x15adcc);}(_0x1fa4,0x186));var _0x41fa=function(_0x5e651e,_0x3a63b9){_0x5e651e=_0x5e651e-0x0;var _0x49db9e=_0x1fa4[_0x5e651e];return _0x49db9e;};'use strict';var _=require(_0x41fa('0x0'));var util=require('util');var logger=require(_0x41fa('0x1'))(_0x41fa('0x2'));var moment=require(_0x41fa('0x3'));var BPromise=require('bluebird');var rp=require(_0x41fa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41fa('0x5'));var config=require('../../config/environment');var attributes=require(_0x41fa('0x6'));module[_0x41fa('0x7')]=function(_0x262fcb,_0x458835){return _0x262fcb[_0x41fa('0x8')](_0x41fa('0x9'),attributes,{'tableName':_0x41fa('0xa'),'paranoid':![],'indexes':[{'name':_0x41fa('0xb'),'fields':[_0x41fa('0xc')],'type':_0x41fa('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x46e134,_0x2528a1,_0x246de1){var _0x3550ab=_0x262fcb['models'];var _0x3c763b=_0x46e134[_0x41fa('0xe')]({'plain':!![]});if(_0x3c763b[_0x41fa('0xf')][_0x41fa('0x10')]()==='in'||_0x3c763b['direction'][_0x41fa('0x10')]()==='out'&&!_0x3c763b[_0x41fa('0x11')]&&!_['isNil'](_0x3c763b[_0x41fa('0x12')])){_0x3550ab[_0x41fa('0x13')][_0x41fa('0x14')]({'where':{'id':_0x3c763b[_0x41fa('0x15')]}})['then'](function(_0x5a24ba){if(_0x5a24ba){_0x5a24ba['update']({'lastMsgAt':_0x3c763b[_0x41fa('0x16')],'lastMsgDirection':_0x3c763b[_0x41fa('0xf')][_0x41fa('0x10')]()});}})[_0x41fa('0x17')](function(_0x9bfffd){console['error'](_0x9bfffd);});}if(_0x3c763b[_0x41fa('0xf')]==='out'&&!_0x3c763b[_0x41fa('0x11')]){var _0x1a639b;_0x3550ab[_0x41fa('0x18')][_0x41fa('0x19')]()[_0x41fa('0x1a')](function(_0x3e8c34){return _0x3550ab['OpenchannelAccount'][_0x41fa('0x1b')]({'where':{'id':_0x3c763b[_0x41fa('0x1c')]},'include':[{'model':_0x3550ab[_0x41fa('0x13')],'as':_0x41fa('0x1d'),'where':{'id':_0x3c763b[_0x41fa('0x15')]},'limit':0x1,'include':[{'model':_0x3550ab[_0x41fa('0x18')],'as':_0x41fa('0x1e'),'attributes':_[_0x41fa('0x1f')](_0x3e8c34)}]}]});})[_0x41fa('0x1a')](function(_0x2b20eb){_0x1a639b=_0x2b20eb[_0x41fa('0xe')]({'plain':!![]});if(_0x1a639b&&_0x1a639b['replyUri']){logger[_0x41fa('0x20')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x41fa('0x21')](_0x41fa('0x22'),_0x3c763b['id'],_0x1a639b['replyUri']));if(_0x1a639b[_0x41fa('0x1d')]&&_0x1a639b['Interactions'][_0x41fa('0x23')]){_0x3c763b['Interaction']=_['omit'](_0x1a639b['Interactions'][0x0],'Contact');_0x3c763b[_0x41fa('0x1e')]=_0x1a639b[_0x41fa('0x1d')][0x0][_0x41fa('0x1e')];}var _0x2528a1={'method':'POST','uri':encodeURI(_0x1a639b['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2528a1[_0x41fa('0x24')]){case _0x41fa('0x25'):_0x2528a1['qs']=_0x3c763b;break;case _0x41fa('0x26'):_0x2528a1[_0x41fa('0xc')]=_0x3c763b;break;}return rp(_0x2528a1)[_0x41fa('0x1a')](function(_0x2f1eff){logger[_0x41fa('0x20')](_0x41fa('0x27'),'afterCreate',util[_0x41fa('0x21')](_0x41fa('0x28'),_0x3c763b['id'],_0x1a639b[_0x41fa('0x29')]));if(_0x2f1eff[_0x41fa('0xc')][_0x41fa('0x2a')]&&_0x2f1eff[_0x41fa('0xc')][_0x41fa('0x2a')]!=_0x3c763b[_0x41fa('0x2b')][_0x41fa('0x2a')]){return _0x3550ab[_0x41fa('0x13')][_0x41fa('0x2c')]({'threadId':_0x2f1eff[_0x41fa('0xc')][_0x41fa('0x2a')]},{'logging':!![],'where':{'id':_0x3c763b[_0x41fa('0x2b')]['id']}});}else{return;}})[_0x41fa('0x1a')](function(){return _0x46e134[_0x41fa('0x2c')]({'read':!![]});})[_0x41fa('0x17')](function(_0x2df9e9){logger[_0x41fa('0x2d')](_0x41fa('0x27'),_0x41fa('0x2e'),util[_0x41fa('0x2f')](_0x2df9e9,{'showHidden':![],'depth':null}));_0x246de1();});}else{_0x246de1();}})[_0x41fa('0x30')](function(){_0x246de1();});}else{_0x246de1();}}},'charset':_0x41fa('0x31'),'collate':_0x41fa('0x32')});}; \ No newline at end of file +var _0xf0ff=['../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','then','createdAt','error','secret','describe','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','method','GET','info','OpenchannelMessage,\x20%s,\x20%s','threadId','update','catch','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x51e9fb,_0x1545ac){var _0x301dc9=function(_0x69fbcb){while(--_0x69fbcb){_0x51e9fb['push'](_0x51e9fb['shift']());}};_0x301dc9(++_0x1545ac);}(_0xf0ff,0x101));var _0xff0f=function(_0x3301ca,_0x1131ba){_0x3301ca=_0x3301ca-0x0;var _0x31bf85=_0xf0ff[_0x3301ca];return _0x31bf85;};'use strict';var _=require(_0xff0f('0x0'));var util=require(_0xff0f('0x1'));var logger=require(_0xff0f('0x2'))(_0xff0f('0x3'));var moment=require(_0xff0f('0x4'));var BPromise=require('bluebird');var rp=require(_0xff0f('0x5'));var fs=require('fs');var path=require(_0xff0f('0x6'));var rimraf=require(_0xff0f('0x7'));var config=require(_0xff0f('0x8'));var attributes=require(_0xff0f('0x9'));module[_0xff0f('0xa')]=function(_0x8fd51f,_0x40a720){return _0x8fd51f[_0xff0f('0xb')](_0xff0f('0xc'),attributes,{'tableName':_0xff0f('0xd'),'paranoid':![],'indexes':[{'name':_0xff0f('0xe'),'fields':[_0xff0f('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5daff6,_0x1e12bd,_0x4e0e55){var _0x5b68b9=_0x8fd51f[_0xff0f('0x10')];var _0x4c7206=_0x5daff6[_0xff0f('0x11')]({'plain':!![]});if(_0x4c7206[_0xff0f('0x12')][_0xff0f('0x13')]()==='in'||_0x4c7206[_0xff0f('0x12')]['toLowerCase']()===_0xff0f('0x14')&&!_0x4c7206['secret']&&!_[_0xff0f('0x15')](_0x4c7206[_0xff0f('0x16')])){_0x5b68b9[_0xff0f('0x17')][_0xff0f('0x18')]({'where':{'id':_0x4c7206['OpenchannelInteractionId']}})[_0xff0f('0x19')](function(_0x2f2f9c){if(_0x2f2f9c){_0x2f2f9c['update']({'lastMsgAt':_0x4c7206[_0xff0f('0x1a')],'lastMsgDirection':_0x4c7206[_0xff0f('0x12')][_0xff0f('0x13')]()});}})['catch'](function(_0x7fa2a9){console[_0xff0f('0x1b')](_0x7fa2a9);});}if(_0x4c7206[_0xff0f('0x12')]===_0xff0f('0x14')&&!_0x4c7206[_0xff0f('0x1c')]){var _0x155867;_0x5b68b9['CmContact'][_0xff0f('0x1d')]()[_0xff0f('0x19')](function(_0x30a003){return _0x5b68b9['OpenchannelAccount']['find']({'where':{'id':_0x4c7206[_0xff0f('0x1e')]},'include':[{'model':_0x5b68b9[_0xff0f('0x17')],'as':_0xff0f('0x1f'),'where':{'id':_0x4c7206[_0xff0f('0x20')]},'limit':0x1,'include':[{'model':_0x5b68b9['CmContact'],'as':_0xff0f('0x21'),'attributes':_[_0xff0f('0x22')](_0x30a003)}]}]});})['then'](function(_0x1508ca){_0x155867=_0x1508ca[_0xff0f('0x11')]({'plain':!![]});if(_0x155867&&_0x155867[_0xff0f('0x23')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xff0f('0x24'),util[_0xff0f('0x25')](_0xff0f('0x26'),_0x4c7206['id'],_0x155867['replyUri']));if(_0x155867['Interactions']&&_0x155867[_0xff0f('0x1f')]['length']){_0x4c7206[_0xff0f('0x27')]=_[_0xff0f('0x28')](_0x155867[_0xff0f('0x1f')][0x0],'Contact');_0x4c7206[_0xff0f('0x21')]=_0x155867[_0xff0f('0x1f')][0x0][_0xff0f('0x21')];}var _0x1e12bd={'method':_0xff0f('0x29'),'uri':encodeURI(_0x155867[_0xff0f('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1e12bd[_0xff0f('0x2a')]){case _0xff0f('0x2b'):_0x1e12bd['qs']=_0x4c7206;break;case _0xff0f('0x29'):_0x1e12bd[_0xff0f('0xf')]=_0x4c7206;break;}return rp(_0x1e12bd)[_0xff0f('0x19')](function(_0x4a89b6){logger[_0xff0f('0x2c')](_0xff0f('0x2d'),_0xff0f('0x24'),util[_0xff0f('0x25')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x4c7206['id'],_0x155867['replyUri']));if(_0x4a89b6['body'][_0xff0f('0x2e')]&&_0x4a89b6[_0xff0f('0xf')][_0xff0f('0x2e')]!=_0x4c7206[_0xff0f('0x27')]['threadId']){return _0x5b68b9[_0xff0f('0x17')][_0xff0f('0x2f')]({'threadId':_0x4a89b6[_0xff0f('0xf')]['threadId']},{'logging':!![],'where':{'id':_0x4c7206[_0xff0f('0x27')]['id']}});}else{return;}})[_0xff0f('0x19')](function(){return _0x5daff6[_0xff0f('0x2f')]({'read':!![]});})[_0xff0f('0x30')](function(_0x39b23e){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xff0f('0x24'),util[_0xff0f('0x31')](_0x39b23e,{'showHidden':![],'depth':null}));_0x4e0e55();});}else{_0x4e0e55();}})[_0xff0f('0x32')](function(){_0x4e0e55();});}else{_0x4e0e55();}}},'charset':_0xff0f('0x33'),'collate':_0xff0f('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 34c70c4..ea8d4aa 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(_0x2a8255,_0x2ab6cb){var _0x20d7a5=function(_0x19f120){while(--_0x19f120){_0x2a8255['push'](_0x2a8255['shift']());}};_0x20d7a5(++_0x2ab6cb);}(_0xb10b,0x12a));var _0xbb10=function(_0x2d460c,_0x4f08c0){_0x2d460c=_0x2d460c-0x0;var _0xf6fc4c=_0xb10b[_0x2d460c];return _0xf6fc4c;};'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 _0xd8b0=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','./openchannelMessage.socket','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','lodash'];(function(_0x5ae785,_0xff34c7){var _0x96bb61=function(_0x2f1688){while(--_0x2f1688){_0x5ae785['push'](_0x5ae785['shift']());}};_0x96bb61(++_0xff34c7);}(_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});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')](_0x196c0a['body'],{'raw':_0x196c0a['options']?_0x196c0a[_0x0d8b('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5527d8){logger[_0x0d8b('0xe')](_0x0d8b('0x19'),_0x196c0a);logger[_0x0d8b('0x11')](_0x0d8b('0x19'),_0x196c0a,JSON[_0x0d8b('0x13')](_0x5527d8));_0x24e8ed(_0x5527d8);})[_0x0d8b('0x18')](function(_0x30980c){logger[_0x0d8b('0x14')](_0x0d8b('0x19'),_0x30980c['message'],_0x196c0a);_0x5b709c(_0x143372[_0x0d8b('0x14')](0x1f4,_0x30980c[_0x0d8b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index d124a05..18a62b3 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 _0xedd9=['removeListener','register','length','openchannelMessage:','save','remove','update','emit'];(function(_0x56cfa7,_0x36f8cc){var _0xd0941e=function(_0x2f1f63){while(--_0x2f1f63){_0x56cfa7['push'](_0x56cfa7['shift']());}};_0xd0941e(++_0x36f8cc);}(_0xedd9,0xfc));var _0x9edd=function(_0x338c0e,_0x5a11ef){_0x338c0e=_0x338c0e-0x0;var _0x5b737a=_0xedd9[_0x338c0e];return _0x5b737a;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x9edd('0x0'),_0x9edd('0x1'),_0x9edd('0x2')];function createListener(_0x2c16b8,_0x3b51bc){return function(_0x127cbe){_0x3b51bc[_0x9edd('0x3')](_0x2c16b8,_0x127cbe);};}function removeListener(_0x36b53f,_0x5943b3){return function(){OpenchannelMessageEvents[_0x9edd('0x4')](_0x36b53f,_0x5943b3);};}exports[_0x9edd('0x5')]=function(_0x268f9e){for(var _0x34c1a7=0x0,_0x5319f7=events[_0x9edd('0x6')];_0x34c1a7<_0x5319f7;_0x34c1a7++){var _0x571af9=events[_0x34c1a7];var _0x172522=createListener(_0x9edd('0x7')+_0x571af9,_0x268f9e);OpenchannelMessageEvents['on'](_0x571af9,_0x172522);}}; \ No newline at end of file +var _0x0713=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x3071('0x0'),_0x3071('0x1')];function createListener(_0x27405a,_0x305d85){return function(_0x864539){_0x305d85['emit'](_0x27405a,_0x864539);};}function removeListener(_0x2c547f,_0x7b18a4){return function(){OpenchannelMessageEvents[_0x3071('0x2')](_0x2c547f,_0x7b18a4);};}exports[_0x3071('0x3')]=function(_0xabd7b6){for(var _0x41cf76=0x0,_0x1d3dd6=events[_0x3071('0x4')];_0x41cf76<_0x1d3dd6;_0x41cf76++){var _0xbd737f=events[_0x41cf76];var _0x22274c=createListener(_0x3071('0x5')+_0xbd737f,_0xabd7b6);OpenchannelMessageEvents['on'](_0xbd737f,_0x22274c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 2b06ac9..1322f85 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 _0x282a=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x282a,0xa2));var _0xa282=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x282a[_0x42bdad];return _0x122626;};'use strict';var multer=require('multer');var util=require(_0xa282('0x0'));var path=require(_0xa282('0x1'));var timeout=require(_0xa282('0x2'));var express=require(_0xa282('0x3'));var router=express[_0xa282('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa282('0x5'));var config=require(_0xa282('0x6'));var controller=require('./openchannelQueue.controller');router[_0xa282('0x7')]('/',auth['isAuthenticated'](),controller[_0xa282('0x8')]);router['get'](_0xa282('0x9'),auth[_0xa282('0xa')](),controller[_0xa282('0xb')]);router['get'](_0xa282('0xc'),auth['isAuthenticated'](),controller[_0xa282('0xd')]);router[_0xa282('0x7')](_0xa282('0xe'),auth[_0xa282('0xa')](),controller[_0xa282('0xf')]);router[_0xa282('0x7')](_0xa282('0x10'),auth[_0xa282('0xa')](),controller[_0xa282('0x11')]);router[_0xa282('0x7')](_0xa282('0x12'),auth[_0xa282('0xa')](),controller[_0xa282('0x13')]);router[_0xa282('0x14')]('/',auth[_0xa282('0xa')](),controller[_0xa282('0x15')]);router[_0xa282('0x14')](_0xa282('0x10'),auth['isAuthenticated'](),controller[_0xa282('0x16')]);router[_0xa282('0x14')](_0xa282('0x12'),auth[_0xa282('0xa')](),controller[_0xa282('0x17')]);router['put']('/:id',auth[_0xa282('0xa')](),controller[_0xa282('0x18')]);router[_0xa282('0x19')](_0xa282('0xc'),auth[_0xa282('0xa')](),controller['destroy']);router['delete'](_0xa282('0x10'),auth[_0xa282('0xa')](),controller[_0xa282('0x1a')]);router[_0xa282('0x19')](_0xa282('0x12'),auth[_0xa282('0xa')](),controller[_0xa282('0x1b')]);module[_0xa282('0x1c')]=router; \ No newline at end of file +var _0x3f8a=['index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated'];(function(_0x9727f2,_0x485aac){var _0x1ecca6=function(_0x945f3){while(--_0x945f3){_0x9727f2['push'](_0x9727f2['shift']());}};_0x1ecca6(++_0x485aac);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x514cc6,_0x1f7df9){_0x514cc6=_0x514cc6-0x0;var _0x2af92f=_0x3f8a[_0x514cc6];return _0x2af92f;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0x9')](_0xa3f8('0xe'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x9')]('/:id/members',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0x10')]);router[_0xa3f8('0x9')](_0xa3f8('0x11'),auth['isAuthenticated'](),controller[_0xa3f8('0x12')]);router[_0xa3f8('0x9')](_0xa3f8('0x13'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0x14')]);router[_0xa3f8('0x15')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0x16')]);router[_0xa3f8('0x15')](_0xa3f8('0x11'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0x17')]);router['post'](_0xa3f8('0x13'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0x18')]);router[_0xa3f8('0x19')]('/:id',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0x1a')]);router[_0xa3f8('0x1b')](_0xa3f8('0xe'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0x1c')]);router[_0xa3f8('0x1b')](_0xa3f8('0x11'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0x1d')]);router['delete'](_0xa3f8('0x13'),auth['isAuthenticated'](),controller[_0xa3f8('0x1e')]);module[_0xa3f8('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 9b185aa..29e53a3 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 _0xbf1a=['exports','name','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xbf1a,0x1c7));var _0xabf1=function(_0x5b98c5,_0x430f22){_0x5b98c5=_0x5b98c5-0x0;var _0x28b033=_0xbf1a[_0x5b98c5];return _0x28b033;};'use strict';var Sequelize=require(_0xabf1('0x0'));module[_0xabf1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xabf1('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[_0xabf1('0x3')](_0xabf1('0x4'),'beepall',_0xabf1('0x5'))}}; \ No newline at end of file +var _0x1cdb=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x245a2,_0x4cb03b){var _0xa0c5e4=function(_0x3b26e4){while(--_0x3b26e4){_0x245a2['push'](_0x245a2['shift']());}};_0xa0c5e4(++_0x4cb03b);}(_0x1cdb,0x117));var _0xb1cd=function(_0x5f9e96,_0x281b8d){_0x5f9e96=_0x5f9e96-0x0;var _0x293cdd=_0x1cdb[_0x5f9e96];return _0x293cdd;};'use strict';var Sequelize=require('sequelize');module[_0xb1cd('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb1cd('0x1')]},'timeout':{'type':Sequelize[_0xb1cd('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb1cd('0x3')](_0xb1cd('0x4'),_0xb1cd('0x5'),_0xb1cd('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index a4dc9eb..6be30f9 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 _0x3605=['includes','all','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','OpenchannelQueue','includeAll','findAll','catch','show','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','UserId','agent','openchannelPause','updatedAt','createdAt','rows','format','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','every','TeamId'];(function(_0x52b914,_0x52bcd3){var _0x21e041=function(_0x379e3a){while(--_0x379e3a){_0x52b914['push'](_0x52b914['shift']());}};_0x21e041(++_0x52bcd3);}(_0x3605,0x123));var _0x5360=function(_0xacf6ff,_0x366edc){_0xacf6ff=_0xacf6ff-0x0;var _0x3a7374=_0x3605[_0xacf6ff];return _0x3a7374;};'use strict';var pdf=require(_0x5360('0x0'));var emlformat=require(_0x5360('0x1'));var rimraf=require(_0x5360('0x2'));var zipdir=require(_0x5360('0x3'));var jsonpatch=require(_0x5360('0x4'));var rp=require('request-promise');var moment=require(_0x5360('0x5'));var BPromise=require(_0x5360('0x6'));var Mustache=require(_0x5360('0x7'));var util=require(_0x5360('0x8'));var path=require(_0x5360('0x9'));var sox=require(_0x5360('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5360('0xb'));var squel=require('squel');var crypto=require(_0x5360('0xc'));var jsforce=require(_0x5360('0xd'));var deskjs=require(_0x5360('0xe'));var toCsv=require(_0x5360('0xf'));var querystring=require(_0x5360('0x10'));var Papa=require(_0x5360('0x11'));var Redis=require(_0x5360('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5360('0x13'));var hardwareService=require(_0x5360('0x14'));var logger=require('../../config/logger')(_0x5360('0x15'));var utils=require(_0x5360('0x16'));var config=require(_0x5360('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5360('0x18'))['db'];config[_0x5360('0x19')]=_[_0x5360('0x1a')](config['redis'],{'host':_0x5360('0x1b'),'port':0x18eb});var socket=require(_0x5360('0x1c'))(new Redis(config[_0x5360('0x19')]));require(_0x5360('0x1d'))['register'](socket);function respondWithStatusCode(_0x44b67a,_0x5559ce){_0x5559ce=_0x5559ce||0xcc;return function(_0x220a00){if(_0x220a00){return _0x44b67a[_0x5360('0x1e')](_0x5559ce);}return _0x44b67a[_0x5360('0x1f')](_0x5559ce)[_0x5360('0x20')]();};}function respondWithResult(_0x54c0dc,_0x78563){_0x78563=_0x78563||0xc8;return function(_0x55118b){if(_0x55118b){return _0x54c0dc[_0x5360('0x1f')](_0x78563)[_0x5360('0x21')](_0x55118b);}};}function respondWithFilteredResult(_0x591ec2,_0x2b2374){return function(_0xb8f2c0){if(_0xb8f2c0){var _0x4c923a=_0xb8f2c0[_0x5360('0x22')],_0x415bc8=_0x2b2374[_0x5360('0x23')],_0x32a086=_0x2b2374[_0x5360('0x23')]+_0x2b2374['limit'],_0x17377b;if(_0x32a086>=_0x4c923a){_0x32a086=_0x4c923a;_0x17377b=0xc8;}else{_0x17377b=0xce;}_0x591ec2[_0x5360('0x1f')](_0x17377b);return _0x591ec2[_0x5360('0x24')](_0x5360('0x25'),_0x415bc8+'-'+_0x32a086+'/'+_0x4c923a)[_0x5360('0x21')](_0xb8f2c0);}return null;};}function patchUpdates(_0x126135){return function(_0x2cc5fd){try{jsonpatch[_0x5360('0x26')](_0x2cc5fd,_0x126135,!![]);}catch(_0x222739){return BPromise[_0x5360('0x27')](_0x222739);}return _0x2cc5fd[_0x5360('0x28')]();};}function saveUpdates(_0x3eae81,_0x35c948){return function(_0x7a02f4){if(_0x7a02f4){return _0x7a02f4[_0x5360('0x29')](_0x3eae81)[_0x5360('0x2a')](function(_0x5ac866){return _0x5ac866;});}return null;};}function removeEntity(_0x3b8f89,_0x5ac1de){return function(_0x5b8986){if(_0x5b8986){return _0x5b8986[_0x5360('0x2b')]()[_0x5360('0x2a')](function(){var _0x1bdd46=_0x5b8986[_0x5360('0x2c')]({'plain':!![]});var _0x1ff730=_0x5360('0x2d');return db[_0x5360('0x2e')]['destroy']({'where':{'type':_0x1ff730,'resourceId':_0x1bdd46['id']}})[_0x5360('0x2a')](function(){return _0x5b8986;});})[_0x5360('0x2a')](function(){_0x3b8f89[_0x5360('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f0d94,_0x3bcf42){return function(_0x36ebeb){if(!_0x36ebeb){_0x2f0d94[_0x5360('0x1e')](0x194);}return _0x36ebeb;};}function handleError(_0x14e16a,_0x164c60){_0x164c60=_0x164c60||0x1f4;return function(_0x49a493){logger[_0x5360('0x2f')](_0x49a493['stack']);if(_0x49a493['name']){delete _0x49a493[_0x5360('0x30')];}_0x14e16a[_0x5360('0x1f')](_0x164c60)[_0x5360('0x31')](_0x49a493);};}exports[_0x5360('0x32')]=function(_0xb36911,_0x14b97e){var _0x521b30={},_0x2bb357={},_0xf391f4={'count':0x0,'rows':[]};var _0x188428=_[_0x5360('0x33')](db['OpenchannelQueue'][_0x5360('0x34')],function(_0x358ae6){return{'name':_0x358ae6[_0x5360('0x35')],'type':_0x358ae6[_0x5360('0x36')][_0x5360('0x37')]};});_0x2bb357['model']=_[_0x5360('0x33')](_0x188428,_0x5360('0x30'));_0x2bb357[_0x5360('0x38')]=_[_0x5360('0x39')](_0xb36911[_0x5360('0x38')]);_0x2bb357['filters']=_[_0x5360('0x3a')](_0x2bb357['model'],_0x2bb357['query']);_0x521b30[_0x5360('0x3b')]=_[_0x5360('0x3a')](_0x2bb357[_0x5360('0x3c')],qs['fields'](_0xb36911[_0x5360('0x38')][_0x5360('0x3d')]));_0x521b30[_0x5360('0x3b')]=_0x521b30[_0x5360('0x3b')][_0x5360('0x3e')]?_0x521b30['attributes']:_0x2bb357[_0x5360('0x3c')];if(!_0xb36911[_0x5360('0x38')][_0x5360('0x3f')](_0x5360('0x40'))){_0x521b30[_0x5360('0x41')]=qs[_0x5360('0x41')](_0xb36911['query'][_0x5360('0x41')]);_0x521b30[_0x5360('0x23')]=qs['offset'](_0xb36911['query']['offset']);}_0x521b30[_0x5360('0x42')]=qs['sort'](_0xb36911[_0x5360('0x38')][_0x5360('0x43')]);_0x521b30[_0x5360('0x44')]=qs[_0x5360('0x45')](_[_0x5360('0x46')](_0xb36911['query'],_0x2bb357['filters']),_0x188428);if(_0xb36911[_0x5360('0x38')]['filter']){_0x521b30[_0x5360('0x44')]=_[_0x5360('0x47')](_0x521b30[_0x5360('0x44')],{'$or':_[_0x5360('0x33')](_0x188428,function(_0x20d87d){if(_0x20d87d['type']!==_0x5360('0x48')){var _0x2c9871={};_0x2c9871[_0x20d87d[_0x5360('0x30')]]={'$like':'%'+_0xb36911[_0x5360('0x38')][_0x5360('0x49')]+'%'};return _0x2c9871;}})});}_0x521b30=_[_0x5360('0x47')]({},_0x521b30,_0xb36911[_0x5360('0x4a')]);var _0x35c882={'where':_0x521b30[_0x5360('0x44')]};return db[_0x5360('0x4b')][_0x5360('0x22')](_0x35c882)['then'](function(_0xd63f89){_0xf391f4['count']=_0xd63f89;if(_0xb36911[_0x5360('0x38')][_0x5360('0x4c')]){_0x521b30['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x5360('0x4d')](_0x521b30);})[_0x5360('0x2a')](function(_0x21998c){_0xf391f4['rows']=_0x21998c;return _0xf391f4;})[_0x5360('0x2a')](respondWithFilteredResult(_0x14b97e,_0x521b30))[_0x5360('0x4e')](handleError(_0x14b97e,null));};exports[_0x5360('0x4f')]=function(_0x2e534b,_0x58effd){var _0x415eab={'raw':!![],'where':{'id':_0x2e534b['params']['id']}},_0xa3de21={};_0xa3de21[_0x5360('0x3c')]=_[_0x5360('0x39')](db['OpenchannelQueue'][_0x5360('0x34')]);_0xa3de21[_0x5360('0x38')]=_[_0x5360('0x39')](_0x2e534b['query']);_0xa3de21[_0x5360('0x45')]=_['intersection'](_0xa3de21['model'],_0xa3de21[_0x5360('0x38')]);_0x415eab[_0x5360('0x3b')]=_['intersection'](_0xa3de21['model'],qs[_0x5360('0x3d')](_0x2e534b[_0x5360('0x38')][_0x5360('0x3d')]));_0x415eab[_0x5360('0x3b')]=_0x415eab[_0x5360('0x3b')]['length']?_0x415eab[_0x5360('0x3b')]:_0xa3de21['model'];if(_0x2e534b['query']['includeAll']){_0x415eab[_0x5360('0x50')]=[{'all':!![]}];}_0x415eab=_['merge']({},_0x415eab,_0x2e534b[_0x5360('0x4a')]);return db[_0x5360('0x4b')]['find'](_0x415eab)[_0x5360('0x2a')](handleEntityNotFound(_0x58effd,null))[_0x5360('0x2a')](respondWithResult(_0x58effd,null))[_0x5360('0x4e')](handleError(_0x58effd,null));};exports[_0x5360('0x51')]=function(_0x5508b3,_0x181eb0){return db['OpenchannelQueue'][_0x5360('0x51')](_0x5508b3[_0x5360('0x52')],{})['then'](function(_0x577adc){var _0x472b6e=_0x5508b3['user'][_0x5360('0x2c')]({'plain':!![]});if(!_0x472b6e)throw new Error(_0x5360('0x53'));if(_0x472b6e[_0x5360('0x54')]==='user'){var _0x13615b=_0x577adc[_0x5360('0x2c')]({'plain':!![]});var _0x2b24ea='OpenchannelQueues';return db[_0x5360('0x55')][_0x5360('0x56')]({'where':{'name':_0x2b24ea,'userProfileId':_0x472b6e[_0x5360('0x57')]},'raw':!![]})[_0x5360('0x2a')](function(_0x102262){if(_0x102262&&_0x102262['autoAssociation']===0x0){return db[_0x5360('0x2e')][_0x5360('0x51')]({'name':_0x13615b[_0x5360('0x30')],'resourceId':_0x13615b['id'],'type':_0x102262[_0x5360('0x30')],'sectionId':_0x102262['id']},{})['then'](function(){return _0x577adc;});}else{return _0x577adc;}})[_0x5360('0x4e')](function(_0x1afcd0){logger['error'](_0x5360('0x58'),_0x1afcd0);throw _0x1afcd0;});}return _0x577adc;})[_0x5360('0x2a')](respondWithResult(_0x181eb0,0xc9))['catch'](handleError(_0x181eb0,null));};exports['update']=function(_0x208920,_0x3bccb0){if(_0x208920[_0x5360('0x52')]['id']){delete _0x208920[_0x5360('0x52')]['id'];}return db['OpenchannelQueue'][_0x5360('0x56')]({'where':{'id':_0x208920[_0x5360('0x59')]['id']}})['then'](handleEntityNotFound(_0x3bccb0,null))[_0x5360('0x2a')](saveUpdates(_0x208920[_0x5360('0x52')],null))['then'](respondWithResult(_0x3bccb0,null))['catch'](handleError(_0x3bccb0,null));};exports[_0x5360('0x2b')]=function(_0x50eeee,_0x541c25){return db[_0x5360('0x4b')][_0x5360('0x56')]({'where':{'id':_0x50eeee[_0x5360('0x59')]['id']}})[_0x5360('0x2a')](handleEntityNotFound(_0x541c25,null))[_0x5360('0x2a')](removeEntity(_0x541c25,null))[_0x5360('0x4e')](handleError(_0x541c25,null));};exports[_0x5360('0x5a')]=function(_0x35cbd3,_0x1e3e27){return db[_0x5360('0x4b')][_0x5360('0x5a')]()[_0x5360('0x2a')](respondWithResult(_0x1e3e27,null))['catch'](handleError(_0x1e3e27,null));};exports['getMembers']=function(_0x13c9f8,_0x24a341,_0x503c40){var _0xd432db={'raw':!![],'where':{}},_0x559ac9={},_0x5e66fd;return db[_0x5360('0x4b')][_0x5360('0x5b')]({'where':{'id':_0x13c9f8[_0x5360('0x59')]['id']}})[_0x5360('0x2a')](handleEntityNotFound(_0x24a341,null))[_0x5360('0x2a')](function(_0x2cada5){if(_0x2cada5){_0x5e66fd=_0x2cada5[_0x5360('0x2c')]({'plain':!![]});_0x559ac9[_0x5360('0x3c')]=_[_0x5360('0x39')](db[_0x5360('0x5c')][_0x5360('0x34')]);_0x559ac9['query']=_[_0x5360('0x39')](_0x13c9f8[_0x5360('0x38')]);_0x559ac9[_0x5360('0x45')]=_[_0x5360('0x3a')](_0x559ac9[_0x5360('0x3c')],_0x559ac9[_0x5360('0x38')]);_0xd432db[_0x5360('0x3b')]=_[_0x5360('0x3a')](_0x559ac9['model'],qs[_0x5360('0x3d')](_0x13c9f8[_0x5360('0x38')][_0x5360('0x3d')]));_0xd432db[_0x5360('0x3b')]=_0xd432db[_0x5360('0x3b')][_0x5360('0x3e')]?_0xd432db['attributes']:_0x559ac9['model'];if(!_0x13c9f8[_0x5360('0x38')][_0x5360('0x3f')](_0x5360('0x40'))){_0xd432db[_0x5360('0x41')]=qs[_0x5360('0x41')](_0x13c9f8[_0x5360('0x38')][_0x5360('0x41')]);_0xd432db[_0x5360('0x23')]=qs[_0x5360('0x23')](_0x13c9f8[_0x5360('0x38')]['offset']);}_0xd432db[_0x5360('0x42')]=qs[_0x5360('0x43')](_0x13c9f8[_0x5360('0x38')][_0x5360('0x43')]);_0xd432db[_0x5360('0x44')]=qs[_0x5360('0x45')](_[_0x5360('0x46')](_0x13c9f8[_0x5360('0x38')],_0x559ac9['filters']));_0xd432db[_0x5360('0x44')][_0x5360('0x5d')]=_0x2cada5['id'];if(_0x13c9f8[_0x5360('0x38')][_0x5360('0x49')]){_0xd432db[_0x5360('0x44')]=_[_0x5360('0x47')](_0xd432db[_0x5360('0x44')],{'$or':_['map'](_0xd432db[_0x5360('0x3b')],function(_0x381697){var _0x14abb2={};_0x14abb2[_0x381697]={'$like':'%'+_0x13c9f8[_0x5360('0x38')][_0x5360('0x49')]+'%'};return _0x14abb2;})});}_0xd432db=_[_0x5360('0x47')]({},_0xd432db,_0x13c9f8[_0x5360('0x4a')]);return db[_0x5360('0x5c')][_0x5360('0x4d')](_0xd432db);}})['then'](function(_0x4f5889){if(_0x4f5889){return db[_0x5360('0x5e')]['findAndCountAll']({'where':{'id':_[_0x5360('0x33')](_0x4f5889,_0x5360('0x5f')),'role':_0x5360('0x60')},'attributes':['id',_0x5360('0x30'),_0x5360('0x61'),_0x5360('0x62'),_0x5360('0x63')]});}})['then'](function(_0x16c204){if(_0x16c204){return{'count':_0x16c204['count'],'rows':_[_0x5360('0x33')](_0x16c204[_0x5360('0x64')],function(_0x207516){return{'membername':_0x207516[_0x5360('0x30')],'UserId':_0x207516['id'],'queue_name':_0x5e66fd['name'],'OpenchannelQueueId':_0x5e66fd['id'],'interface':util[_0x5360('0x65')]('%s/%s',_0x5360('0x66'),_0x207516[_0x5360('0x30')]),'penalty':0x0,'paused':_0x207516['openchannelPause'],'createdAt':_0x207516[_0x5360('0x63')],'updatedAt':_0x207516['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5360('0x2a')](respondWithFilteredResult(_0x24a341,_0xd432db))[_0x5360('0x4e')](handleError(_0x24a341,null));};exports['getTeams']=function(_0x446b25,_0x327cc5,_0x13cc63){var _0x1d68fe={};var _0x2e0ca4={};var _0x13c193;var _0x2f5fd6;return db[_0x5360('0x4b')]['findOne']({'where':{'id':_0x446b25[_0x5360('0x59')]['id']}})['then'](handleEntityNotFound(_0x327cc5,null))[_0x5360('0x2a')](function(_0x172f31){if(_0x172f31){_0x13c193=_0x172f31;_0x2e0ca4[_0x5360('0x3c')]=_[_0x5360('0x39')](db[_0x5360('0x67')]['rawAttributes']);_0x2e0ca4['query']=_[_0x5360('0x39')](_0x446b25[_0x5360('0x38')]);_0x2e0ca4[_0x5360('0x45')]=_[_0x5360('0x3a')](_0x2e0ca4['model'],_0x2e0ca4[_0x5360('0x38')]);_0x1d68fe[_0x5360('0x3b')]=_[_0x5360('0x3a')](_0x2e0ca4['model'],qs[_0x5360('0x3d')](_0x446b25['query'][_0x5360('0x3d')]));_0x1d68fe[_0x5360('0x3b')]=_0x1d68fe['attributes'][_0x5360('0x3e')]?_0x1d68fe[_0x5360('0x3b')]:_0x2e0ca4[_0x5360('0x3c')];_0x1d68fe[_0x5360('0x42')]=qs['sort'](_0x446b25[_0x5360('0x38')][_0x5360('0x43')]);_0x1d68fe[_0x5360('0x44')]=qs['filters'](_[_0x5360('0x46')](_0x446b25[_0x5360('0x38')],_0x2e0ca4[_0x5360('0x45')]));if(_0x446b25['query'][_0x5360('0x49')]){_0x1d68fe[_0x5360('0x44')]=_[_0x5360('0x47')](_0x1d68fe[_0x5360('0x44')],{'$or':_[_0x5360('0x33')](_0x1d68fe['attributes'],function(_0x573929){var _0x268a43={};_0x268a43[_0x573929]={'$like':'%'+_0x446b25[_0x5360('0x38')][_0x5360('0x49')]+'%'};return _0x268a43;})});}_0x1d68fe=_['merge']({},_0x1d68fe,_0x446b25[_0x5360('0x4a')]);return _0x13c193[_0x5360('0x68')](_0x1d68fe);}})[_0x5360('0x2a')](function(_0x19b3f5){if(_0x19b3f5){_0x2f5fd6=_0x19b3f5[_0x5360('0x3e')];if(!_0x446b25['query'][_0x5360('0x3f')](_0x5360('0x40'))){_0x1d68fe[_0x5360('0x41')]=qs[_0x5360('0x41')](_0x446b25['query'][_0x5360('0x41')]);_0x1d68fe[_0x5360('0x23')]=qs[_0x5360('0x23')](_0x446b25['query'][_0x5360('0x23')]);}return _0x13c193[_0x5360('0x68')](_0x1d68fe);}})[_0x5360('0x2a')](function(_0x145b55){if(_0x145b55){return _0x145b55?{'count':_0x2f5fd6,'rows':_0x145b55}:null;}})[_0x5360('0x2a')](respondWithResult(_0x327cc5,null))[_0x5360('0x4e')](handleError(_0x327cc5,null));};exports[_0x5360('0x69')]=function(_0x286dd4,_0x182123,_0x391b2e){var _0x2be28a=_0x286dd4[_0x5360('0x52')][_0x5360('0x6a')];return db['Team'][_0x5360('0x4d')]({'where':{'id':_0x2be28a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5360('0x6b'),'attributes':['id',_0x5360('0x30'),_0x5360('0x6c'),_0x5360('0x6d'),'interface'],'raw':!![]}]})[_0x5360('0x2a')](function(_0xd51380){if(_0xd51380){var _0x374597=_['flatMap'](_0xd51380,function(_0x46a593){var _0x5bbf49=_0x46a593[_0x5360('0x2c')]({'plain':!![]});return _0x5bbf49['Agents'];});return db[_0x5360('0x4b')][_0x5360('0x56')]({'where':{'id':_0x286dd4[_0x5360('0x59')]['id']}})[_0x5360('0x2a')](function(_0x2b5ead){return db[_0x5360('0x6e')][_0x5360('0x6f')](function(_0x51d8b5){return _0x2b5ead[_0x5360('0x69')](_0x2be28a,{'transaction':_0x51d8b5})[_0x5360('0x2a')](function(){return BPromise[_0x5360('0x70')](_0x374597,function(_0x20fbd5){return db[_0x5360('0x5c')][_0x5360('0x71')]({'where':{'UserId':_0x20fbd5['id'],'OpenchannelQueueId':_0x286dd4[_0x5360('0x59')]['id']},'transaction':_0x51d8b5});});})[_0x5360('0x2a')](function(){_0x374597[_0x5360('0x72')](function(_0x53084a){socket[_0x5360('0x73')](_0x5360('0x74'),{'UserId':_0x53084a['id'],'OpenchannelQueueId':_0x2b5ead['id']});});});});});}})['then'](respondWithStatusCode(_0x182123,null))['catch'](handleError(_0x182123,null));};exports['removeTeams']=function(_0x5a5f87,_0x3c5109,_0x26e06d){return db['Team'][_0x5360('0x4d')]({'where':{'id':_0x5a5f87[_0x5360('0x38')][_0x5360('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x5360('0x5e')],'as':_0x5360('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x5360('0x2a')](handleEntityNotFound(_0x3c5109,null))[_0x5360('0x2a')](function(_0x327586){var _0x34c7cb=_[_0x5360('0x33')](_0x327586,'id');var _0x20d803=[];var _0x460159=[];var _0x361ee8=squel[_0x5360('0x75')]();_0x361ee8[_0x5360('0x76')](_0x5360('0x77'))[_0x5360('0x78')]('team_has_openchannel_queues','tq')[_0x5360('0x79')](_0x5360('0x7a'),'ut',_0x5360('0x7b'))[_0x5360('0x44')]('OpenchannelQueueId\x20=\x20?',_0x5a5f87[_0x5360('0x59')]['id']);for(var _0x485b52=0x0;_0x485b52<_0x327586['length'];_0x485b52+=0x1){let _0x44dd18=_0x327586[_0x485b52];for(var _0x3fd6da=0x0;_0x3fd6da<_0x44dd18[_0x5360('0x6b')][_0x5360('0x3e')];_0x3fd6da+=0x1){let _0x213d3e=_0x44dd18[_0x5360('0x6b')][_0x3fd6da];var _0x1737ca=_0x361ee8[_0x5360('0x7c')]();_0x1737ca[_0x5360('0x44')]('ut.UserId\x20=\x20?',_0x213d3e['id']);_0x460159['push'](db['sequelize']['query'](_0x1737ca['toString'](),{'type':db[_0x5360('0x6e')][_0x5360('0x7d')][_0x5360('0x7e')]})['then'](function(_0x40159a){if(_0x40159a[_0x5360('0x3e')]===0x1){return _0x213d3e['id'];}else{var _0x1f39ce=_[_0x5360('0x7f')](_[_0x5360('0x33')](_0x40159a,_0x5360('0x80')),function(_0x1d00fe){return _[_0x5360('0x81')](_0x34c7cb,_0x1d00fe);});if(_0x1f39ce){return _0x213d3e['id'];}}}));}}return BPromise[_0x5360('0x82')](_0x460159)[_0x5360('0x2a')](function(_0x214398){_0x20d803=_(_0x20d803)['union'](_0x214398)[_0x5360('0x83')]()[_0x5360('0x84')]();return db[_0x5360('0x4b')][_0x5360('0x56')]({'where':{'id':_0x5a5f87[_0x5360('0x59')]['id']}})[_0x5360('0x2a')](function(_0x14f585){return db[_0x5360('0x6e')][_0x5360('0x6f')](function(_0x5b6795){return _0x14f585[_0x5360('0x85')](_0x5a5f87[_0x5360('0x38')]['ids'],{'transaction':_0x5b6795})['then'](function(){if(!_[_0x5360('0x86')](_0x20d803)){return _0x14f585[_0x5360('0x87')](_0x20d803,{'transaction':_0x5b6795});}})[_0x5360('0x2a')](function(){_0x20d803[_0x5360('0x72')](function(_0x4bc3ba){socket[_0x5360('0x73')](_0x5360('0x88'),{'UserId':_0x4bc3ba,'OpenchannelQueueId':_0x14f585['id']});});});});});});})[_0x5360('0x2a')](respondWithStatusCode(_0x3c5109,null))[_0x5360('0x4e')](handleError(_0x3c5109,null));};exports[_0x5360('0x89')]=function(_0x20c4b2,_0x269a23,_0x393228){return db[_0x5360('0x4b')][_0x5360('0x56')]({'where':{'id':_0x20c4b2[_0x5360('0x59')]['id']}})[_0x5360('0x2a')](handleEntityNotFound(_0x269a23,null))['then'](function(_0x55c3bf){if(_0x55c3bf){return _0x55c3bf['addAgents'](_0x20c4b2['body'][_0x5360('0x6a')],_['omit'](_0x20c4b2['body'],[_0x5360('0x6a'),'id'])||{})['spread'](function(_0x172244){for(var _0x4b5d4e=0x0;_0x4b5d4e<_0x20c4b2[_0x5360('0x52')][_0x5360('0x6a')]['length'];_0x4b5d4e+=0x1){socket[_0x5360('0x73')](_0x5360('0x74'),{'UserId':_0x20c4b2[_0x5360('0x52')][_0x5360('0x6a')][_0x4b5d4e],'OpenchannelQueueId':_0x20c4b2[_0x5360('0x59')]['id']});}return _0x172244;});}})['then'](respondWithResult(_0x269a23,null))[_0x5360('0x4e')](handleError(_0x269a23,null));};exports[_0x5360('0x87')]=function(_0x1d2517,_0x17c697,_0x2e6f37){return db[_0x5360('0x4b')]['find']({'where':{'id':_0x1d2517['params']['id']}})[_0x5360('0x2a')](handleEntityNotFound(_0x17c697,null))[_0x5360('0x2a')](function(_0x572fa1){if(_0x572fa1){return _0x572fa1[_0x5360('0x87')](_0x1d2517[_0x5360('0x38')]['ids'])[_0x5360('0x2a')](function(){if(_[_0x5360('0x8a')](_0x1d2517[_0x5360('0x38')][_0x5360('0x6a')])){for(var _0x4ab928=0x0;_0x4ab928<_0x1d2517[_0x5360('0x38')][_0x5360('0x6a')]['length'];_0x4ab928+=0x1){socket[_0x5360('0x73')](_0x5360('0x88'),{'UserId':Number(_0x1d2517[_0x5360('0x38')][_0x5360('0x6a')][_0x4ab928]),'OpenchannelQueueId':Number(_0x1d2517[_0x5360('0x59')]['id'])});}}else{socket[_0x5360('0x73')](_0x5360('0x88'),{'UserId':Number(_0x1d2517[_0x5360('0x38')][_0x5360('0x6a')]),'OpenchannelQueueId':Number(_0x1d2517['params']['id'])});}});}})[_0x5360('0x2a')](respondWithStatusCode(_0x17c697,null))['catch'](handleError(_0x17c697,null));};exports['getAgents']=function(_0x9bb523,_0x34e2a8,_0x5d6304){var _0x2764bf={};var _0x599e5a={};var _0x2eb089;var _0x44e7c8;return db[_0x5360('0x4b')]['findOne']({'where':{'id':_0x9bb523[_0x5360('0x59')]['id']}})[_0x5360('0x2a')](handleEntityNotFound(_0x34e2a8,null))['then'](function(_0x1f36c4){if(_0x1f36c4){_0x2eb089=_0x1f36c4;_0x599e5a[_0x5360('0x3c')]=_[_0x5360('0x39')](db[_0x5360('0x5e')][_0x5360('0x34')]);_0x599e5a['query']=_['keys'](_0x9bb523['query']);_0x599e5a[_0x5360('0x45')]=_['intersection'](_0x599e5a[_0x5360('0x3c')],_0x599e5a[_0x5360('0x38')]);_0x2764bf[_0x5360('0x3b')]=_[_0x5360('0x3a')](_0x599e5a[_0x5360('0x3c')],qs['fields'](_0x9bb523['query']['fields']));_0x2764bf[_0x5360('0x3b')]=_0x2764bf[_0x5360('0x3b')]['length']?_0x2764bf[_0x5360('0x3b')]:_0x599e5a[_0x5360('0x3c')];_0x2764bf[_0x5360('0x42')]=qs[_0x5360('0x43')](_0x9bb523[_0x5360('0x38')]['sort']);_0x2764bf[_0x5360('0x44')]=qs[_0x5360('0x45')](_[_0x5360('0x46')](_0x9bb523['query'],_0x599e5a[_0x5360('0x45')]));if(_0x9bb523[_0x5360('0x38')][_0x5360('0x49')]){_0x2764bf[_0x5360('0x44')]=_[_0x5360('0x47')](_0x2764bf[_0x5360('0x44')],{'$or':_[_0x5360('0x33')](_0x2764bf['attributes'],function(_0x479a61){var _0x147e47={};_0x147e47[_0x479a61]={'$like':'%'+_0x9bb523[_0x5360('0x38')][_0x5360('0x49')]+'%'};return _0x147e47;})});}_0x2764bf=_[_0x5360('0x47')]({},_0x2764bf,_0x9bb523[_0x5360('0x4a')]);return _0x2eb089[_0x5360('0x8b')](_0x2764bf);}})[_0x5360('0x2a')](function(_0x6d7820){if(_0x6d7820){_0x44e7c8=_0x6d7820[_0x5360('0x3e')];if(!_0x9bb523[_0x5360('0x38')]['hasOwnProperty'](_0x5360('0x40'))){_0x2764bf[_0x5360('0x41')]=qs[_0x5360('0x41')](_0x9bb523[_0x5360('0x38')]['limit']);_0x2764bf[_0x5360('0x23')]=qs[_0x5360('0x23')](_0x9bb523[_0x5360('0x38')][_0x5360('0x23')]);}return _0x2eb089['getAgents'](_0x2764bf);}})[_0x5360('0x2a')](function(_0x26ea5e){if(_0x26ea5e){return _0x26ea5e?{'count':_0x44e7c8,'rows':_0x26ea5e}:null;}})[_0x5360('0x2a')](respondWithResult(_0x34e2a8,null))[_0x5360('0x4e')](handleError(_0x34e2a8,null));}; \ No newline at end of file +var _0x3368=['map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueue','includeAll','include','rows','show','params','filters','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','order','OpenchannelQueueId','User','findAndCountAll','UserId','format','%s/%s','SIP','openchannelPause','createdAt','Team','getTeams','addTeams','ids','findAll','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','user_has_teams','clone','push','QueryTypes','TeamId','all','union','compact','value','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index'];(function(_0x4dd8dd,_0x410c3d){var _0x321734=function(_0x307926){while(--_0x307926){_0x4dd8dd['push'](_0x4dd8dd['shift']());}};_0x321734(++_0x410c3d);}(_0x3368,0x1ef));var _0x8336=function(_0x7d095,_0x1b5d9a){_0x7d095=_0x7d095-0x0;var _0x44baa8=_0x3368[_0x7d095];return _0x44baa8;};'use strict';var pdf=require(_0x8336('0x0'));var emlformat=require(_0x8336('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8336('0x2'));var jsonpatch=require(_0x8336('0x3'));var rp=require(_0x8336('0x4'));var moment=require(_0x8336('0x5'));var BPromise=require(_0x8336('0x6'));var Mustache=require(_0x8336('0x7'));var util=require(_0x8336('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8336('0x9'));var fs=require('fs');var _=require(_0x8336('0xa'));var squel=require(_0x8336('0xb'));var crypto=require(_0x8336('0xc'));var jsforce=require(_0x8336('0xd'));var deskjs=require(_0x8336('0xe'));var toCsv=require(_0x8336('0xf'));var querystring=require('querystring');var Papa=require(_0x8336('0x10'));var Redis=require(_0x8336('0x11'));var authService=require(_0x8336('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8336('0x13'));var logger=require(_0x8336('0x14'))(_0x8336('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8336('0x16'));var db=require(_0x8336('0x17'))['db'];config['redis']=_[_0x8336('0x18')](config[_0x8336('0x19')],{'host':_0x8336('0x1a'),'port':0x18eb});var socket=require(_0x8336('0x1b'))(new Redis(config['redis']));require(_0x8336('0x1c'))['register'](socket);function respondWithStatusCode(_0x205feb,_0x56420d){_0x56420d=_0x56420d||0xcc;return function(_0x495836){if(_0x495836){return _0x205feb[_0x8336('0x1d')](_0x56420d);}return _0x205feb[_0x8336('0x1e')](_0x56420d)['end']();};}function respondWithResult(_0x1f475c,_0x30cde0){_0x30cde0=_0x30cde0||0xc8;return function(_0x13bd32){if(_0x13bd32){return _0x1f475c[_0x8336('0x1e')](_0x30cde0)[_0x8336('0x1f')](_0x13bd32);}};}function respondWithFilteredResult(_0x5e0b28,_0x2ba804){return function(_0x78cbd8){if(_0x78cbd8){var _0x536f4f=_0x78cbd8[_0x8336('0x20')],_0x1c7bd8=_0x2ba804[_0x8336('0x21')],_0x5d8878=_0x2ba804[_0x8336('0x21')]+_0x2ba804[_0x8336('0x22')],_0x123f66;if(_0x5d8878>=_0x536f4f){_0x5d8878=_0x536f4f;_0x123f66=0xc8;}else{_0x123f66=0xce;}_0x5e0b28['status'](_0x123f66);return _0x5e0b28[_0x8336('0x23')]('Content-Range',_0x1c7bd8+'-'+_0x5d8878+'/'+_0x536f4f)['json'](_0x78cbd8);}return null;};}function patchUpdates(_0x1f11f9){return function(_0x5425f5){try{jsonpatch[_0x8336('0x24')](_0x5425f5,_0x1f11f9,!![]);}catch(_0x551f0a){return BPromise[_0x8336('0x25')](_0x551f0a);}return _0x5425f5[_0x8336('0x26')]();};}function saveUpdates(_0x208156,_0x5d3fd4){return function(_0x1535d0){if(_0x1535d0){return _0x1535d0[_0x8336('0x27')](_0x208156)[_0x8336('0x28')](function(_0x126453){return _0x126453;});}return null;};}function removeEntity(_0xf5aa2e,_0x413d11){return function(_0x104963){if(_0x104963){return _0x104963['destroy']()['then'](function(){var _0x3575a1=_0x104963[_0x8336('0x29')]({'plain':!![]});var _0x2b1c13='OpenchannelQueues';return db[_0x8336('0x2a')][_0x8336('0x2b')]({'where':{'type':_0x2b1c13,'resourceId':_0x3575a1['id']}})['then'](function(){return _0x104963;});})['then'](function(){_0xf5aa2e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x546576,_0xc834f1){return function(_0x37929d){if(!_0x37929d){_0x546576[_0x8336('0x1d')](0x194);}return _0x37929d;};}function handleError(_0x5bcb08,_0x4c81cf){_0x4c81cf=_0x4c81cf||0x1f4;return function(_0x311b9d){logger[_0x8336('0x2c')](_0x311b9d[_0x8336('0x2d')]);if(_0x311b9d[_0x8336('0x2e')]){delete _0x311b9d[_0x8336('0x2e')];}_0x5bcb08[_0x8336('0x1e')](_0x4c81cf)[_0x8336('0x2f')](_0x311b9d);};}exports[_0x8336('0x30')]=function(_0xe7f89d,_0x2c0cbe){var _0x451bed={},_0x3ba436={},_0x5206bb={'count':0x0,'rows':[]};var _0x16fa15=_[_0x8336('0x31')](db['OpenchannelQueue'][_0x8336('0x32')],function(_0x1be8e2){return{'name':_0x1be8e2[_0x8336('0x33')],'type':_0x1be8e2[_0x8336('0x34')][_0x8336('0x35')]};});_0x3ba436[_0x8336('0x36')]=_[_0x8336('0x31')](_0x16fa15,_0x8336('0x2e'));_0x3ba436[_0x8336('0x37')]=_[_0x8336('0x38')](_0xe7f89d[_0x8336('0x37')]);_0x3ba436['filters']=_[_0x8336('0x39')](_0x3ba436[_0x8336('0x36')],_0x3ba436[_0x8336('0x37')]);_0x451bed[_0x8336('0x3a')]=_[_0x8336('0x39')](_0x3ba436[_0x8336('0x36')],qs[_0x8336('0x3b')](_0xe7f89d[_0x8336('0x37')][_0x8336('0x3b')]));_0x451bed[_0x8336('0x3a')]=_0x451bed[_0x8336('0x3a')][_0x8336('0x3c')]?_0x451bed['attributes']:_0x3ba436[_0x8336('0x36')];if(!_0xe7f89d[_0x8336('0x37')][_0x8336('0x3d')](_0x8336('0x3e'))){_0x451bed[_0x8336('0x22')]=qs[_0x8336('0x22')](_0xe7f89d[_0x8336('0x37')]['limit']);_0x451bed['offset']=qs['offset'](_0xe7f89d['query'][_0x8336('0x21')]);}_0x451bed['order']=qs[_0x8336('0x3f')](_0xe7f89d[_0x8336('0x37')][_0x8336('0x3f')]);_0x451bed[_0x8336('0x40')]=qs['filters'](_[_0x8336('0x41')](_0xe7f89d['query'],_0x3ba436['filters']),_0x16fa15);if(_0xe7f89d[_0x8336('0x37')][_0x8336('0x42')]){_0x451bed[_0x8336('0x40')]=_[_0x8336('0x43')](_0x451bed[_0x8336('0x40')],{'$or':_[_0x8336('0x31')](_0x16fa15,function(_0x332b18){if(_0x332b18[_0x8336('0x34')]!==_0x8336('0x44')){var _0x2ace80={};_0x2ace80[_0x332b18['name']]={'$like':'%'+_0xe7f89d['query'][_0x8336('0x42')]+'%'};return _0x2ace80;}})});}_0x451bed=_['merge']({},_0x451bed,_0xe7f89d[_0x8336('0x45')]);var _0x55be35={'where':_0x451bed[_0x8336('0x40')]};return db[_0x8336('0x46')][_0x8336('0x20')](_0x55be35)['then'](function(_0x403e7a){_0x5206bb[_0x8336('0x20')]=_0x403e7a;if(_0xe7f89d['query'][_0x8336('0x47')]){_0x451bed[_0x8336('0x48')]=[{'all':!![]}];}return db[_0x8336('0x46')]['findAll'](_0x451bed);})[_0x8336('0x28')](function(_0x2387b2){_0x5206bb[_0x8336('0x49')]=_0x2387b2;return _0x5206bb;})[_0x8336('0x28')](respondWithFilteredResult(_0x2c0cbe,_0x451bed))['catch'](handleError(_0x2c0cbe,null));};exports[_0x8336('0x4a')]=function(_0x51c55c,_0x21ca7f){var _0x2cb8c4={'raw':!![],'where':{'id':_0x51c55c[_0x8336('0x4b')]['id']}},_0x589811={};_0x589811['model']=_[_0x8336('0x38')](db[_0x8336('0x46')]['rawAttributes']);_0x589811[_0x8336('0x37')]=_[_0x8336('0x38')](_0x51c55c[_0x8336('0x37')]);_0x589811[_0x8336('0x4c')]=_[_0x8336('0x39')](_0x589811[_0x8336('0x36')],_0x589811[_0x8336('0x37')]);_0x2cb8c4[_0x8336('0x3a')]=_[_0x8336('0x39')](_0x589811[_0x8336('0x36')],qs['fields'](_0x51c55c[_0x8336('0x37')][_0x8336('0x3b')]));_0x2cb8c4[_0x8336('0x3a')]=_0x2cb8c4[_0x8336('0x3a')][_0x8336('0x3c')]?_0x2cb8c4['attributes']:_0x589811[_0x8336('0x36')];if(_0x51c55c[_0x8336('0x37')][_0x8336('0x47')]){_0x2cb8c4[_0x8336('0x48')]=[{'all':!![]}];}_0x2cb8c4=_[_0x8336('0x43')]({},_0x2cb8c4,_0x51c55c[_0x8336('0x45')]);return db[_0x8336('0x46')][_0x8336('0x4d')](_0x2cb8c4)[_0x8336('0x28')](handleEntityNotFound(_0x21ca7f,null))[_0x8336('0x28')](respondWithResult(_0x21ca7f,null))[_0x8336('0x4e')](handleError(_0x21ca7f,null));};exports['create']=function(_0x521fd3,_0x2e20a6){return db[_0x8336('0x46')][_0x8336('0x4f')](_0x521fd3[_0x8336('0x50')],{})[_0x8336('0x28')](function(_0x3bebc0){var _0x29afb3=_0x521fd3[_0x8336('0x51')]['get']({'plain':!![]});if(!_0x29afb3)throw new Error(_0x8336('0x52'));if(_0x29afb3['role']===_0x8336('0x51')){var _0x3750fc=_0x3bebc0[_0x8336('0x29')]({'plain':!![]});var _0x4bdcd6=_0x8336('0x53');return db[_0x8336('0x54')][_0x8336('0x4d')]({'where':{'name':_0x4bdcd6,'userProfileId':_0x29afb3['userProfileId']},'raw':!![]})[_0x8336('0x28')](function(_0x23316b){if(_0x23316b&&_0x23316b[_0x8336('0x55')]===0x0){return db[_0x8336('0x2a')][_0x8336('0x4f')]({'name':_0x3750fc['name'],'resourceId':_0x3750fc['id'],'type':_0x23316b[_0x8336('0x2e')],'sectionId':_0x23316b['id']},{})[_0x8336('0x28')](function(){return _0x3bebc0;});}else{return _0x3bebc0;}})[_0x8336('0x4e')](function(_0x13e372){logger[_0x8336('0x2c')](_0x8336('0x56'),_0x13e372);throw _0x13e372;});}return _0x3bebc0;})[_0x8336('0x28')](respondWithResult(_0x2e20a6,0xc9))[_0x8336('0x4e')](handleError(_0x2e20a6,null));};exports['update']=function(_0x2c7566,_0x1e109f){if(_0x2c7566[_0x8336('0x50')]['id']){delete _0x2c7566['body']['id'];}return db[_0x8336('0x46')]['find']({'where':{'id':_0x2c7566[_0x8336('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e109f,null))[_0x8336('0x28')](saveUpdates(_0x2c7566['body'],null))[_0x8336('0x28')](respondWithResult(_0x1e109f,null))[_0x8336('0x4e')](handleError(_0x1e109f,null));};exports['destroy']=function(_0x5299c2,_0x1a551c){return db['OpenchannelQueue'][_0x8336('0x4d')]({'where':{'id':_0x5299c2[_0x8336('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1a551c,null))[_0x8336('0x28')](removeEntity(_0x1a551c,null))[_0x8336('0x4e')](handleError(_0x1a551c,null));};exports[_0x8336('0x57')]=function(_0x402e05,_0x15bf0a){return db[_0x8336('0x46')][_0x8336('0x57')]()[_0x8336('0x28')](respondWithResult(_0x15bf0a,null))['catch'](handleError(_0x15bf0a,null));};exports['getMembers']=function(_0x16920e,_0x1970be,_0x35d981){var _0x2838ef={'raw':!![],'where':{}},_0x5daaad={},_0x810096;return db[_0x8336('0x46')][_0x8336('0x58')]({'where':{'id':_0x16920e[_0x8336('0x4b')]['id']}})[_0x8336('0x28')](handleEntityNotFound(_0x1970be,null))[_0x8336('0x28')](function(_0x4b572c){if(_0x4b572c){_0x810096=_0x4b572c['get']({'plain':!![]});_0x5daaad[_0x8336('0x36')]=_[_0x8336('0x38')](db[_0x8336('0x59')]['rawAttributes']);_0x5daaad['query']=_[_0x8336('0x38')](_0x16920e[_0x8336('0x37')]);_0x5daaad[_0x8336('0x4c')]=_[_0x8336('0x39')](_0x5daaad[_0x8336('0x36')],_0x5daaad[_0x8336('0x37')]);_0x2838ef[_0x8336('0x3a')]=_[_0x8336('0x39')](_0x5daaad[_0x8336('0x36')],qs['fields'](_0x16920e[_0x8336('0x37')][_0x8336('0x3b')]));_0x2838ef[_0x8336('0x3a')]=_0x2838ef[_0x8336('0x3a')][_0x8336('0x3c')]?_0x2838ef['attributes']:_0x5daaad[_0x8336('0x36')];if(!_0x16920e[_0x8336('0x37')][_0x8336('0x3d')](_0x8336('0x3e'))){_0x2838ef[_0x8336('0x22')]=qs[_0x8336('0x22')](_0x16920e[_0x8336('0x37')]['limit']);_0x2838ef[_0x8336('0x21')]=qs[_0x8336('0x21')](_0x16920e[_0x8336('0x37')][_0x8336('0x21')]);}_0x2838ef[_0x8336('0x5a')]=qs[_0x8336('0x3f')](_0x16920e[_0x8336('0x37')][_0x8336('0x3f')]);_0x2838ef['where']=qs['filters'](_[_0x8336('0x41')](_0x16920e[_0x8336('0x37')],_0x5daaad[_0x8336('0x4c')]));_0x2838ef[_0x8336('0x40')][_0x8336('0x5b')]=_0x4b572c['id'];if(_0x16920e['query'][_0x8336('0x42')]){_0x2838ef[_0x8336('0x40')]=_['merge'](_0x2838ef[_0x8336('0x40')],{'$or':_[_0x8336('0x31')](_0x2838ef['attributes'],function(_0x1381e0){var _0x3dbbf0={};_0x3dbbf0[_0x1381e0]={'$like':'%'+_0x16920e[_0x8336('0x37')]['filter']+'%'};return _0x3dbbf0;})});}_0x2838ef=_[_0x8336('0x43')]({},_0x2838ef,_0x16920e[_0x8336('0x45')]);return db[_0x8336('0x59')]['findAll'](_0x2838ef);}})['then'](function(_0x42c7d3){if(_0x42c7d3){return db[_0x8336('0x5c')][_0x8336('0x5d')]({'where':{'id':_[_0x8336('0x31')](_0x42c7d3,_0x8336('0x5e')),'role':'agent'},'attributes':['id','name','openchannelPause','updatedAt','createdAt']});}})[_0x8336('0x28')](function(_0x129612){if(_0x129612){return{'count':_0x129612[_0x8336('0x20')],'rows':_['map'](_0x129612[_0x8336('0x49')],function(_0x1eef71){return{'membername':_0x1eef71[_0x8336('0x2e')],'UserId':_0x1eef71['id'],'queue_name':_0x810096[_0x8336('0x2e')],'OpenchannelQueueId':_0x810096['id'],'interface':util[_0x8336('0x5f')](_0x8336('0x60'),_0x8336('0x61'),_0x1eef71[_0x8336('0x2e')]),'penalty':0x0,'paused':_0x1eef71[_0x8336('0x62')],'createdAt':_0x1eef71[_0x8336('0x63')],'updatedAt':_0x1eef71['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8336('0x28')](respondWithFilteredResult(_0x1970be,_0x2838ef))[_0x8336('0x4e')](handleError(_0x1970be,null));};exports['getTeams']=function(_0x4429f3,_0x2749c0,_0x348870){var _0x1739c9={};var _0x384acc={};var _0xeceb4a;var _0x41b086;return db[_0x8336('0x46')][_0x8336('0x58')]({'where':{'id':_0x4429f3[_0x8336('0x4b')]['id']}})[_0x8336('0x28')](handleEntityNotFound(_0x2749c0,null))['then'](function(_0x5eaa7d){if(_0x5eaa7d){_0xeceb4a=_0x5eaa7d;_0x384acc[_0x8336('0x36')]=_[_0x8336('0x38')](db[_0x8336('0x64')]['rawAttributes']);_0x384acc[_0x8336('0x37')]=_[_0x8336('0x38')](_0x4429f3['query']);_0x384acc['filters']=_[_0x8336('0x39')](_0x384acc[_0x8336('0x36')],_0x384acc['query']);_0x1739c9[_0x8336('0x3a')]=_[_0x8336('0x39')](_0x384acc['model'],qs[_0x8336('0x3b')](_0x4429f3[_0x8336('0x37')][_0x8336('0x3b')]));_0x1739c9[_0x8336('0x3a')]=_0x1739c9['attributes'][_0x8336('0x3c')]?_0x1739c9[_0x8336('0x3a')]:_0x384acc[_0x8336('0x36')];_0x1739c9[_0x8336('0x5a')]=qs[_0x8336('0x3f')](_0x4429f3[_0x8336('0x37')][_0x8336('0x3f')]);_0x1739c9[_0x8336('0x40')]=qs[_0x8336('0x4c')](_[_0x8336('0x41')](_0x4429f3['query'],_0x384acc['filters']));if(_0x4429f3['query'][_0x8336('0x42')]){_0x1739c9[_0x8336('0x40')]=_[_0x8336('0x43')](_0x1739c9[_0x8336('0x40')],{'$or':_['map'](_0x1739c9['attributes'],function(_0x29d9f8){var _0x1be2a0={};_0x1be2a0[_0x29d9f8]={'$like':'%'+_0x4429f3[_0x8336('0x37')][_0x8336('0x42')]+'%'};return _0x1be2a0;})});}_0x1739c9=_[_0x8336('0x43')]({},_0x1739c9,_0x4429f3[_0x8336('0x45')]);return _0xeceb4a[_0x8336('0x65')](_0x1739c9);}})[_0x8336('0x28')](function(_0x4a11b5){if(_0x4a11b5){_0x41b086=_0x4a11b5[_0x8336('0x3c')];if(!_0x4429f3[_0x8336('0x37')][_0x8336('0x3d')](_0x8336('0x3e'))){_0x1739c9[_0x8336('0x22')]=qs[_0x8336('0x22')](_0x4429f3['query']['limit']);_0x1739c9['offset']=qs[_0x8336('0x21')](_0x4429f3[_0x8336('0x37')][_0x8336('0x21')]);}return _0xeceb4a[_0x8336('0x65')](_0x1739c9);}})['then'](function(_0xf5aee7){if(_0xf5aee7){return _0xf5aee7?{'count':_0x41b086,'rows':_0xf5aee7}:null;}})[_0x8336('0x28')](respondWithResult(_0x2749c0,null))['catch'](handleError(_0x2749c0,null));};exports[_0x8336('0x66')]=function(_0x4297a0,_0x26ebec,_0x51f162){var _0x4ac0f5=_0x4297a0['body'][_0x8336('0x67')];return db[_0x8336('0x64')][_0x8336('0x68')]({'where':{'id':_0x4ac0f5},'attributes':['id'],'include':[{'model':db[_0x8336('0x5c')],'as':_0x8336('0x69'),'attributes':['id',_0x8336('0x2e'),_0x8336('0x6a'),_0x8336('0x6b'),'interface'],'raw':!![]}]})['then'](function(_0x3aeae1){if(_0x3aeae1){var _0x515970=_['flatMap'](_0x3aeae1,function(_0x50e445){var _0x160620=_0x50e445[_0x8336('0x29')]({'plain':!![]});return _0x160620['Agents'];});return db[_0x8336('0x46')][_0x8336('0x4d')]({'where':{'id':_0x4297a0[_0x8336('0x4b')]['id']}})[_0x8336('0x28')](function(_0x242437){return db[_0x8336('0x6c')][_0x8336('0x6d')](function(_0x25aef4){return _0x242437['addTeams'](_0x4ac0f5,{'transaction':_0x25aef4})[_0x8336('0x28')](function(){return BPromise[_0x8336('0x6e')](_0x515970,function(_0x202ed9){return db['UserOpenchannelQueue'][_0x8336('0x6f')]({'where':{'UserId':_0x202ed9['id'],'OpenchannelQueueId':_0x4297a0[_0x8336('0x4b')]['id']},'transaction':_0x25aef4});});})['then'](function(){_0x515970[_0x8336('0x70')](function(_0x5a41fc){socket[_0x8336('0x71')](_0x8336('0x72'),{'UserId':_0x5a41fc['id'],'OpenchannelQueueId':_0x242437['id']});});});});});}})[_0x8336('0x28')](respondWithStatusCode(_0x26ebec,null))[_0x8336('0x4e')](handleError(_0x26ebec,null));};exports[_0x8336('0x73')]=function(_0x1abc82,_0x33e9cb,_0x41422f){return db['Team'][_0x8336('0x68')]({'where':{'id':_0x1abc82[_0x8336('0x37')][_0x8336('0x67')]},'attributes':['id'],'include':[{'model':db[_0x8336('0x5c')],'as':_0x8336('0x69'),'attributes':['id'],'raw':!![]}]})[_0x8336('0x28')](handleEntityNotFound(_0x33e9cb,null))['then'](function(_0x6d859a){var _0x14e5a5=_[_0x8336('0x31')](_0x6d859a,'id');var _0x2ffeda=[];var _0x45c339=[];var _0x282372=squel[_0x8336('0x74')]();_0x282372[_0x8336('0x75')](_0x8336('0x76'))[_0x8336('0x77')]('team_has_openchannel_queues','tq')['join'](_0x8336('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8336('0x40')]('OpenchannelQueueId\x20=\x20?',_0x1abc82[_0x8336('0x4b')]['id']);for(var _0x8320b=0x0;_0x8320b<_0x6d859a[_0x8336('0x3c')];_0x8320b+=0x1){let _0x3d05f1=_0x6d859a[_0x8320b];for(var _0x6924c6=0x0;_0x6924c6<_0x3d05f1['Agents'][_0x8336('0x3c')];_0x6924c6+=0x1){let _0x57dd6f=_0x3d05f1[_0x8336('0x69')][_0x6924c6];var _0x47c2ca=_0x282372[_0x8336('0x79')]();_0x47c2ca[_0x8336('0x40')]('ut.UserId\x20=\x20?',_0x57dd6f['id']);_0x45c339[_0x8336('0x7a')](db['sequelize'][_0x8336('0x37')](_0x47c2ca['toString'](),{'type':db[_0x8336('0x6c')][_0x8336('0x7b')]['SELECT']})[_0x8336('0x28')](function(_0x54125e){if(_0x54125e[_0x8336('0x3c')]===0x1){return _0x57dd6f['id'];}else{var _0xbee75a=_['every'](_[_0x8336('0x31')](_0x54125e,_0x8336('0x7c')),function(_0x187244){return _['includes'](_0x14e5a5,_0x187244);});if(_0xbee75a){return _0x57dd6f['id'];}}}));}}return BPromise[_0x8336('0x7d')](_0x45c339)[_0x8336('0x28')](function(_0x37c3fe){_0x2ffeda=_(_0x2ffeda)[_0x8336('0x7e')](_0x37c3fe)[_0x8336('0x7f')]()[_0x8336('0x80')]();return db[_0x8336('0x46')][_0x8336('0x4d')]({'where':{'id':_0x1abc82[_0x8336('0x4b')]['id']}})[_0x8336('0x28')](function(_0x4a2371){return db[_0x8336('0x6c')][_0x8336('0x6d')](function(_0x5a4232){return _0x4a2371[_0x8336('0x73')](_0x1abc82['query'][_0x8336('0x67')],{'transaction':_0x5a4232})[_0x8336('0x28')](function(){if(!_['isEmpty'](_0x2ffeda)){return _0x4a2371[_0x8336('0x81')](_0x2ffeda,{'transaction':_0x5a4232});}})[_0x8336('0x28')](function(){_0x2ffeda[_0x8336('0x70')](function(_0x10e7c){socket[_0x8336('0x71')](_0x8336('0x82'),{'UserId':_0x10e7c,'OpenchannelQueueId':_0x4a2371['id']});});});});});});})[_0x8336('0x28')](respondWithStatusCode(_0x33e9cb,null))[_0x8336('0x4e')](handleError(_0x33e9cb,null));};exports[_0x8336('0x83')]=function(_0x229d3f,_0x1b8dd5,_0x297e81){return db[_0x8336('0x46')]['find']({'where':{'id':_0x229d3f[_0x8336('0x4b')]['id']}})[_0x8336('0x28')](handleEntityNotFound(_0x1b8dd5,null))[_0x8336('0x28')](function(_0x1c4488){if(_0x1c4488){return _0x1c4488['addAgents'](_0x229d3f[_0x8336('0x50')][_0x8336('0x67')],_[_0x8336('0x84')](_0x229d3f[_0x8336('0x50')],[_0x8336('0x67'),'id'])||{})[_0x8336('0x85')](function(_0xbd2083){for(var _0x101096=0x0;_0x101096<_0x229d3f['body'][_0x8336('0x67')]['length'];_0x101096+=0x1){socket[_0x8336('0x71')](_0x8336('0x72'),{'UserId':_0x229d3f['body'][_0x8336('0x67')][_0x101096],'OpenchannelQueueId':_0x229d3f[_0x8336('0x4b')]['id']});}return _0xbd2083;});}})[_0x8336('0x28')](respondWithResult(_0x1b8dd5,null))[_0x8336('0x4e')](handleError(_0x1b8dd5,null));};exports['removeAgents']=function(_0x2094aa,_0x315c08,_0x38b96b){return db[_0x8336('0x46')][_0x8336('0x4d')]({'where':{'id':_0x2094aa[_0x8336('0x4b')]['id']}})['then'](handleEntityNotFound(_0x315c08,null))[_0x8336('0x28')](function(_0x5869c4){if(_0x5869c4){return _0x5869c4[_0x8336('0x81')](_0x2094aa[_0x8336('0x37')][_0x8336('0x67')])[_0x8336('0x28')](function(){if(_[_0x8336('0x86')](_0x2094aa['query'][_0x8336('0x67')])){for(var _0x4267d4=0x0;_0x4267d4<_0x2094aa[_0x8336('0x37')]['ids']['length'];_0x4267d4+=0x1){socket[_0x8336('0x71')](_0x8336('0x82'),{'UserId':Number(_0x2094aa[_0x8336('0x37')]['ids'][_0x4267d4]),'OpenchannelQueueId':Number(_0x2094aa[_0x8336('0x4b')]['id'])});}}else{socket[_0x8336('0x71')](_0x8336('0x82'),{'UserId':Number(_0x2094aa[_0x8336('0x37')][_0x8336('0x67')]),'OpenchannelQueueId':Number(_0x2094aa[_0x8336('0x4b')]['id'])});}});}})[_0x8336('0x28')](respondWithStatusCode(_0x315c08,null))['catch'](handleError(_0x315c08,null));};exports[_0x8336('0x87')]=function(_0x553ee9,_0x5aa441,_0x424230){var _0x120252={};var _0x2e54d5={};var _0x4a710b;var _0x4fa814;return db[_0x8336('0x46')][_0x8336('0x58')]({'where':{'id':_0x553ee9[_0x8336('0x4b')]['id']}})[_0x8336('0x28')](handleEntityNotFound(_0x5aa441,null))[_0x8336('0x28')](function(_0x1ce6fd){if(_0x1ce6fd){_0x4a710b=_0x1ce6fd;_0x2e54d5['model']=_[_0x8336('0x38')](db[_0x8336('0x5c')][_0x8336('0x32')]);_0x2e54d5[_0x8336('0x37')]=_[_0x8336('0x38')](_0x553ee9[_0x8336('0x37')]);_0x2e54d5[_0x8336('0x4c')]=_[_0x8336('0x39')](_0x2e54d5[_0x8336('0x36')],_0x2e54d5[_0x8336('0x37')]);_0x120252[_0x8336('0x3a')]=_[_0x8336('0x39')](_0x2e54d5[_0x8336('0x36')],qs['fields'](_0x553ee9[_0x8336('0x37')]['fields']));_0x120252[_0x8336('0x3a')]=_0x120252[_0x8336('0x3a')][_0x8336('0x3c')]?_0x120252[_0x8336('0x3a')]:_0x2e54d5[_0x8336('0x36')];_0x120252['order']=qs['sort'](_0x553ee9[_0x8336('0x37')][_0x8336('0x3f')]);_0x120252['where']=qs[_0x8336('0x4c')](_[_0x8336('0x41')](_0x553ee9[_0x8336('0x37')],_0x2e54d5[_0x8336('0x4c')]));if(_0x553ee9[_0x8336('0x37')][_0x8336('0x42')]){_0x120252[_0x8336('0x40')]=_[_0x8336('0x43')](_0x120252[_0x8336('0x40')],{'$or':_[_0x8336('0x31')](_0x120252[_0x8336('0x3a')],function(_0x1aed4b){var _0x5ecbfb={};_0x5ecbfb[_0x1aed4b]={'$like':'%'+_0x553ee9['query'][_0x8336('0x42')]+'%'};return _0x5ecbfb;})});}_0x120252=_[_0x8336('0x43')]({},_0x120252,_0x553ee9[_0x8336('0x45')]);return _0x4a710b[_0x8336('0x87')](_0x120252);}})['then'](function(_0xaa339){if(_0xaa339){_0x4fa814=_0xaa339[_0x8336('0x3c')];if(!_0x553ee9[_0x8336('0x37')]['hasOwnProperty'](_0x8336('0x3e'))){_0x120252[_0x8336('0x22')]=qs[_0x8336('0x22')](_0x553ee9['query'][_0x8336('0x22')]);_0x120252[_0x8336('0x21')]=qs[_0x8336('0x21')](_0x553ee9[_0x8336('0x37')][_0x8336('0x21')]);}return _0x4a710b[_0x8336('0x87')](_0x120252);}})[_0x8336('0x28')](function(_0x52fb6c){if(_0x52fb6c){return _0x52fb6c?{'count':_0x4fa814,'rows':_0x52fb6c}:null;}})[_0x8336('0x28')](respondWithResult(_0x5aa441,null))['catch'](handleError(_0x5aa441,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index adbf2c5..b712214 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 _0x4655=['save','update','remove','emit','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x7d653b,_0x3f3341){var _0x3a30e7=function(_0x4e7b60){while(--_0x4e7b60){_0x7d653b['push'](_0x7d653b['shift']());}};_0x3a30e7(++_0x3f3341);}(_0x4655,0x11c));var _0x5465=function(_0x346156,_0x35e0ae){_0x346156=_0x346156-0x0;var _0x5b3ec7=_0x4655[_0x346156];return _0x5b3ec7;};'use strict';var EventEmitter=require(_0x5465('0x0'));var OpenchannelQueue=require(_0x5465('0x1'))['db'][_0x5465('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5465('0x3')](0x0);var events={'afterCreate':_0x5465('0x4'),'afterUpdate':_0x5465('0x5'),'afterDestroy':_0x5465('0x6')};function emitEvent(_0x2f15db){return function(_0x41601b,_0x5f1e4f,_0x49d94){OpenchannelQueueEvents[_0x5465('0x7')](_0x2f15db+':'+_0x41601b['id'],_0x41601b);OpenchannelQueueEvents[_0x5465('0x7')](_0x2f15db,_0x41601b);_0x49d94(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x5465('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x8585=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x8585,0x183));var _0x5858=function(_0x13f923,_0x16130e){_0x13f923=_0x13f923-0x0;var _0x36bc51=_0x8585[_0x13f923];return _0x36bc51;};'use strict';var EventEmitter=require(_0x5858('0x0'));var OpenchannelQueue=require(_0x5858('0x1'))['db'][_0x5858('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5858('0x3')](0x0);var events={'afterCreate':_0x5858('0x4'),'afterUpdate':_0x5858('0x5'),'afterDestroy':_0x5858('0x6')};function emitEvent(_0x47b255){return function(_0x4be340,_0xfcf10,_0x5a37fd){OpenchannelQueueEvents[_0x5858('0x7')](_0x47b255+':'+_0x4be340['id'],_0x4be340);OpenchannelQueueEvents['emit'](_0x47b255,_0x4be340);_0x5a37fd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x5858('0x8')](e,emitEvent(event));}}module[_0x5858('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index d221fc2..65b8856 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 _0xcb49=['define','openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','exports'];(function(_0x32f725,_0x1c4b0d){var _0x544673=function(_0x9b5a9b){while(--_0x9b5a9b){_0x32f725['push'](_0x32f725['shift']());}};_0x544673(++_0x1c4b0d);}(_0xcb49,0x156));var _0x9cb4=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xcb49[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x9cb4('0x0'));var util=require('util');var logger=require(_0x9cb4('0x1'))(_0x9cb4('0x2'));var moment=require(_0x9cb4('0x3'));var BPromise=require(_0x9cb4('0x4'));var rp=require(_0x9cb4('0x5'));var fs=require('fs');var path=require(_0x9cb4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x9cb4('0x7')]=function(_0x5c54b7,_0x5618ab){return _0x5c54b7[_0x9cb4('0x8')]('OpenchannelQueue',attributes,{'tableName':_0x9cb4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7b1=['openchannel_queues','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x12911b,_0x5c28b0){var _0x12abf9=function(_0x13b8be){while(--_0x13b8be){_0x12911b['push'](_0x12911b['shift']());}};_0x12abf9(++_0x5c28b0);}(_0xa7b1,0x194));var _0x1a7b=function(_0x2987b3,_0x16ccec){_0x2987b3=_0x2987b3-0x0;var _0x1195f6=_0xa7b1[_0x2987b3];return _0x1195f6;};'use strict';var _=require('lodash');var util=require(_0x1a7b('0x0'));var logger=require('../../config/logger')(_0x1a7b('0x1'));var moment=require(_0x1a7b('0x2'));var BPromise=require(_0x1a7b('0x3'));var rp=require(_0x1a7b('0x4'));var fs=require('fs');var path=require(_0x1a7b('0x5'));var rimraf=require(_0x1a7b('0x6'));var config=require(_0x1a7b('0x7'));var attributes=require(_0x1a7b('0x8'));module[_0x1a7b('0x9')]=function(_0x29fcb9,_0x34f2b3){return _0x29fcb9[_0x1a7b('0xa')](_0x1a7b('0xb'),attributes,{'tableName':_0x1a7b('0xc'),'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 a66bcd4..32f0456 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 _0x56b2=['request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','model','include','map','catch','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56b2,0x85));var _0x256b=function(_0x60c113,_0x5d2578){_0x60c113=_0x60c113-0x0;var _0x384785=_0x56b2[_0x60c113];return _0x384785;};'use strict';var _=require(_0x256b('0x0'));var util=require(_0x256b('0x1'));var moment=require(_0x256b('0x2'));var BPromise=require(_0x256b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x256b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x256b('0x5'));var logger=require(_0x256b('0x6'))(_0x256b('0x7'));var config=require(_0x256b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x256b('0x9')][_0x256b('0xa')]({'port':0x232a});config[_0x256b('0xb')]=_[_0x256b('0xc')](config[_0x256b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x256b('0xd'))(new Redis(config[_0x256b('0xb')]));require(_0x256b('0xe'))['register'](socket);function respondWithRpcPromise(_0x788058,_0x129e55,_0x5dada1){return new BPromise(function(_0x191446,_0x3d847a){return client[_0x256b('0xf')](_0x788058,_0x5dada1)[_0x256b('0x10')](function(_0x1d84b9){logger[_0x256b('0x11')](_0x256b('0x12'),_0x129e55,_0x256b('0x13'));logger[_0x256b('0x14')](_0x256b('0x15'),_0x129e55,'request\x20sent',JSON[_0x256b('0x16')](_0x1d84b9));if(_0x1d84b9['error']){if(_0x1d84b9[_0x256b('0x17')]['code']===0x1f4){logger[_0x256b('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x129e55,_0x1d84b9[_0x256b('0x17')]['message']);return _0x3d847a(_0x1d84b9['error']['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x129e55,_0x1d84b9[_0x256b('0x17')][_0x256b('0x18')]);return _0x191446(_0x1d84b9[_0x256b('0x17')][_0x256b('0x18')]);}else{logger[_0x256b('0x11')](_0x256b('0x12'),_0x129e55,'request\x20sent');_0x191446(_0x1d84b9['result'][_0x256b('0x18')]);}})['catch'](function(_0x428fd1){logger['error'](_0x256b('0x12'),_0x129e55,_0x428fd1);_0x3d847a(_0x428fd1);});});}exports[_0x256b('0x19')]=function(_0x478df5){var _0x2e567e=this;return new Promise(function(_0x1e85d9,_0x1e1221){return db[_0x256b('0x1a')]['findAll']({'raw':_0x478df5['options']?_0x478df5[_0x256b('0x1b')][_0x256b('0x1c')]===undefined?!![]:![]:!![],'where':_0x478df5[_0x256b('0x1b')]?_0x478df5[_0x256b('0x1b')][_0x256b('0x1d')]||null:null,'attributes':_0x478df5[_0x256b('0x1b')]?_0x478df5[_0x256b('0x1b')][_0x256b('0x1e')]||null:null,'limit':_0x478df5[_0x256b('0x1b')]?_0x478df5[_0x256b('0x1b')][_0x256b('0x1f')]||null:null,'include':_0x478df5[_0x256b('0x1b')]?_0x478df5[_0x256b('0x1b')]['include']?_['map'](_0x478df5[_0x256b('0x1b')]['include'],function(_0x3498be){return{'model':db[_0x3498be[_0x256b('0x20')]],'as':_0x3498be['as'],'attributes':_0x3498be[_0x256b('0x1e')],'include':_0x3498be[_0x256b('0x21')]?_[_0x256b('0x22')](_0x3498be[_0x256b('0x21')],function(_0x13cb70){return{'model':db[_0x13cb70['model']],'as':_0x13cb70['as'],'attributes':_0x13cb70[_0x256b('0x1e')],'include':_0x13cb70[_0x256b('0x21')]?_[_0x256b('0x22')](_0x13cb70[_0x256b('0x21')],function(_0xaa913e){return{'model':db[_0xaa913e[_0x256b('0x20')]],'as':_0xaa913e['as'],'attributes':_0xaa913e[_0x256b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x256b('0x10')](function(_0x2dd761){logger[_0x256b('0x11')](_0x256b('0x19'),_0x478df5);logger['debug'](_0x256b('0x19'),_0x478df5,JSON[_0x256b('0x16')](_0x2dd761));_0x1e85d9(_0x2dd761);})[_0x256b('0x23')](function(_0xa3e4ee){logger[_0x256b('0x17')](_0x256b('0x19'),_0xa3e4ee['message'],_0x478df5);_0x1e1221(_0x2e567e['error'](0x1f4,_0xa3e4ee[_0x256b('0x18')]));});});};exports[_0x256b('0x24')]=function(_0x3f5359){var _0x288675=this;return new Promise(function(_0x7241fb,_0x27305a){return db[_0x256b('0x1a')][_0x256b('0x25')]({'raw':_0x3f5359[_0x256b('0x1b')]?_0x3f5359[_0x256b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3f5359[_0x256b('0x1b')]?_0x3f5359[_0x256b('0x1b')][_0x256b('0x1d')]||null:null,'attributes':_0x3f5359[_0x256b('0x1b')]?_0x3f5359['options'][_0x256b('0x1e')]||null:null,'include':_0x3f5359['options']?_0x3f5359[_0x256b('0x1b')][_0x256b('0x21')]?_[_0x256b('0x22')](_0x3f5359[_0x256b('0x1b')]['include'],function(_0x360811){return{'model':db[_0x360811[_0x256b('0x20')]],'as':_0x360811['as'],'attributes':_0x360811[_0x256b('0x1e')],'include':_0x360811[_0x256b('0x21')]?_[_0x256b('0x22')](_0x360811['include'],function(_0x4b5a56){return{'model':db[_0x4b5a56[_0x256b('0x20')]],'as':_0x4b5a56['as'],'attributes':_0x4b5a56[_0x256b('0x1e')],'include':_0x4b5a56[_0x256b('0x21')]?_['map'](_0x4b5a56[_0x256b('0x21')],function(_0x3a7ffa){return{'model':db[_0x3a7ffa[_0x256b('0x20')]],'as':_0x3a7ffa['as'],'attributes':_0x3a7ffa[_0x256b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x256b('0x10')](function(_0x3f4be4){logger['info'](_0x256b('0x24'),_0x3f5359);logger[_0x256b('0x14')](_0x256b('0x24'),_0x3f5359,JSON['stringify'](_0x3f4be4));_0x7241fb(_0x3f4be4);})[_0x256b('0x23')](function(_0x50cc34){logger[_0x256b('0x17')]('ShowOpenchannelQueue',_0x50cc34[_0x256b('0x18')],_0x3f5359);_0x27305a(_0x288675[_0x256b('0x17')](0x1f4,_0x50cc34[_0x256b('0x18')]));});});}; \ No newline at end of file +var _0xe134=['../../config/environment','jayson/promise','redis','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','map','include','model','debug','ShowOpenchannelQueue','OpenchannelQueue','find','stringify','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4ea194,_0x4ad92c){var _0x5a91ef=function(_0x445e8b){while(--_0x445e8b){_0x4ea194['push'](_0x4ea194['shift']());}};_0x5a91ef(++_0x4ad92c);}(_0xe134,0xae));var _0x4e13=function(_0x313c97,_0x194958){_0x313c97=_0x313c97-0x0;var _0x26cb65=_0xe134[_0x313c97];return _0x26cb65;};'use strict';var _=require(_0x4e13('0x0'));var util=require('util');var moment=require(_0x4e13('0x1'));var BPromise=require(_0x4e13('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e13('0x3'))['db'];var utils=require(_0x4e13('0x4'));var logger=require(_0x4e13('0x5'))('rpc');var config=require(_0x4e13('0x6'));var jayson=require(_0x4e13('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x4e13('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4e13('0x9'))(new Redis(config[_0x4e13('0x8')]));require(_0x4e13('0xa'))[_0x4e13('0xb')](socket);function respondWithRpcPromise(_0xe93c28,_0x16d757,_0x47b876){return new BPromise(function(_0x3a68aa,_0x3bec01){return client[_0x4e13('0xc')](_0xe93c28,_0x47b876)[_0x4e13('0xd')](function(_0x4e119a){logger[_0x4e13('0xe')](_0x4e13('0xf'),_0x16d757,_0x4e13('0x10'));logger['debug'](_0x4e13('0x11'),_0x16d757,_0x4e13('0x10'),JSON['stringify'](_0x4e119a));if(_0x4e119a[_0x4e13('0x12')]){if(_0x4e119a[_0x4e13('0x12')][_0x4e13('0x13')]===0x1f4){logger[_0x4e13('0x12')](_0x4e13('0xf'),_0x16d757,_0x4e119a[_0x4e13('0x12')][_0x4e13('0x14')]);return _0x3bec01(_0x4e119a['error']['message']);}logger['error'](_0x4e13('0xf'),_0x16d757,_0x4e119a['error'][_0x4e13('0x14')]);return _0x3a68aa(_0x4e119a['error'][_0x4e13('0x14')]);}else{logger[_0x4e13('0xe')](_0x4e13('0xf'),_0x16d757,_0x4e13('0x10'));_0x3a68aa(_0x4e119a['result'][_0x4e13('0x14')]);}})[_0x4e13('0x15')](function(_0x2cce8f){logger[_0x4e13('0x12')](_0x4e13('0xf'),_0x16d757,_0x2cce8f);_0x3bec01(_0x2cce8f);});});}exports[_0x4e13('0x16')]=function(_0x5ccf97){var _0x5b3b2a=this;return new Promise(function(_0x443337,_0x3591fd){return db['OpenchannelQueue'][_0x4e13('0x17')]({'raw':_0x5ccf97[_0x4e13('0x18')]?_0x5ccf97[_0x4e13('0x18')][_0x4e13('0x19')]===undefined?!![]:![]:!![],'where':_0x5ccf97['options']?_0x5ccf97[_0x4e13('0x18')][_0x4e13('0x1a')]||null:null,'attributes':_0x5ccf97[_0x4e13('0x18')]?_0x5ccf97[_0x4e13('0x18')][_0x4e13('0x1b')]||null:null,'limit':_0x5ccf97['options']?_0x5ccf97[_0x4e13('0x18')]['limit']||null:null,'include':_0x5ccf97[_0x4e13('0x18')]?_0x5ccf97[_0x4e13('0x18')]['include']?_[_0x4e13('0x1c')](_0x5ccf97['options'][_0x4e13('0x1d')],function(_0x5b4ba7){return{'model':db[_0x5b4ba7[_0x4e13('0x1e')]],'as':_0x5b4ba7['as'],'attributes':_0x5b4ba7[_0x4e13('0x1b')],'include':_0x5b4ba7['include']?_['map'](_0x5b4ba7['include'],function(_0x47db1d){return{'model':db[_0x47db1d[_0x4e13('0x1e')]],'as':_0x47db1d['as'],'attributes':_0x47db1d[_0x4e13('0x1b')],'include':_0x47db1d[_0x4e13('0x1d')]?_['map'](_0x47db1d['include'],function(_0x4f5d03){return{'model':db[_0x4f5d03[_0x4e13('0x1e')]],'as':_0x4f5d03['as'],'attributes':_0x4f5d03[_0x4e13('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4e13('0xd')](function(_0x1692dc){logger['info'](_0x4e13('0x16'),_0x5ccf97);logger[_0x4e13('0x1f')](_0x4e13('0x16'),_0x5ccf97,JSON['stringify'](_0x1692dc));_0x443337(_0x1692dc);})[_0x4e13('0x15')](function(_0x1f0c5e){logger[_0x4e13('0x12')](_0x4e13('0x16'),_0x1f0c5e['message'],_0x5ccf97);_0x3591fd(_0x5b3b2a[_0x4e13('0x12')](0x1f4,_0x1f0c5e['message']));});});};exports[_0x4e13('0x20')]=function(_0x38069d){var _0x587d81=this;return new Promise(function(_0x31ea46,_0x4b756e){return db[_0x4e13('0x21')][_0x4e13('0x22')]({'raw':_0x38069d[_0x4e13('0x18')]?_0x38069d[_0x4e13('0x18')][_0x4e13('0x19')]===undefined?!![]:![]:!![],'where':_0x38069d[_0x4e13('0x18')]?_0x38069d[_0x4e13('0x18')][_0x4e13('0x1a')]||null:null,'attributes':_0x38069d[_0x4e13('0x18')]?_0x38069d[_0x4e13('0x18')][_0x4e13('0x1b')]||null:null,'include':_0x38069d['options']?_0x38069d[_0x4e13('0x18')][_0x4e13('0x1d')]?_['map'](_0x38069d[_0x4e13('0x18')]['include'],function(_0x6d2ae2){return{'model':db[_0x6d2ae2[_0x4e13('0x1e')]],'as':_0x6d2ae2['as'],'attributes':_0x6d2ae2[_0x4e13('0x1b')],'include':_0x6d2ae2[_0x4e13('0x1d')]?_[_0x4e13('0x1c')](_0x6d2ae2[_0x4e13('0x1d')],function(_0x50c840){return{'model':db[_0x50c840[_0x4e13('0x1e')]],'as':_0x50c840['as'],'attributes':_0x50c840['attributes'],'include':_0x50c840[_0x4e13('0x1d')]?_[_0x4e13('0x1c')](_0x50c840[_0x4e13('0x1d')],function(_0x9251cf){return{'model':db[_0x9251cf[_0x4e13('0x1e')]],'as':_0x9251cf['as'],'attributes':_0x9251cf[_0x4e13('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54b97a){logger[_0x4e13('0xe')](_0x4e13('0x20'),_0x38069d);logger['debug'](_0x4e13('0x20'),_0x38069d,JSON[_0x4e13('0x23')](_0x54b97a));_0x31ea46(_0x54b97a);})[_0x4e13('0x15')](function(_0x57c984){logger['error'](_0x4e13('0x20'),_0x57c984[_0x4e13('0x14')],_0x38069d);_0x4b756e(_0x587d81[_0x4e13('0x12')](0x1f4,_0x57c984[_0x4e13('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 8aea31c..13ba12e 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 _0xa401=['emit','removeListener','length','openchannelQueue:','remove'];(function(_0x29524c,_0x5a0936){var _0xa1f54c=function(_0x1177d9){while(--_0x1177d9){_0x29524c['push'](_0x29524c['shift']());}};_0xa1f54c(++_0x5a0936);}(_0xa401,0x17b));var _0x1a40=function(_0x217d38,_0x5e416a){_0x217d38=_0x217d38-0x0;var _0x5c6140=_0xa401[_0x217d38];return _0x5c6140;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x1a40('0x0'),'update'];function createListener(_0x2f849a,_0x5788f5){return function(_0x27044b){_0x5788f5[_0x1a40('0x1')](_0x2f849a,_0x27044b);};}function removeListener(_0xa12013,_0x196e8e){return function(){OpenchannelQueueEvents[_0x1a40('0x2')](_0xa12013,_0x196e8e);};}exports['register']=function(_0x5515d5){for(var _0x3e5202=0x0,_0x4d94b3=events[_0x1a40('0x3')];_0x3e5202<_0x4d94b3;_0x3e5202++){var _0x41623e=events[_0x3e5202];var _0x540a5e=createListener(_0x1a40('0x4')+_0x41623e,_0x5515d5);OpenchannelQueueEvents['on'](_0x41623e,_0x540a5e);}}; \ No newline at end of file +var _0x1cba=['remove','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x1cba,0x147));var _0xa1cb=function(_0x739b76,_0x2250f8){_0x739b76=_0x739b76-0x0;var _0x3b471f=_0x1cba[_0x739b76];return _0x3b471f;};'use strict';var OpenchannelQueueEvents=require(_0xa1cb('0x0'));var events=[_0xa1cb('0x1'),_0xa1cb('0x2'),'update'];function createListener(_0x4abddf,_0x66f864){return function(_0x424816){_0x66f864[_0xa1cb('0x3')](_0x4abddf,_0x424816);};}function removeListener(_0x2f7fd9,_0x5f5612){return function(){OpenchannelQueueEvents[_0xa1cb('0x4')](_0x2f7fd9,_0x5f5612);};}exports[_0xa1cb('0x5')]=function(_0x46d2ca){for(var _0x1561c7=0x0,_0xb769ca=events['length'];_0x1561c7<_0xb769ca;_0x1561c7++){var _0xd3048=events[_0x1561c7];var _0x4224ac=createListener(_0xa1cb('0x6')+_0xd3048,_0x46d2ca);OpenchannelQueueEvents['on'](_0xd3048,_0x4224ac);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 3938a2a..db89493 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 _0x9be1=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x9be1,0x128));var _0x19be=function(_0x3b08e2,_0x55204d){_0x3b08e2=_0x3b08e2-0x0;var _0x437253=_0x9be1[_0x3b08e2];return _0x437253;};'use strict';var multer=require(_0x19be('0x0'));var util=require(_0x19be('0x1'));var path=require(_0x19be('0x2'));var timeout=require(_0x19be('0x3'));var express=require(_0x19be('0x4'));var router=express[_0x19be('0x5')]();var auth=require(_0x19be('0x6'));var interaction=require(_0x19be('0x7'));var config=require(_0x19be('0x8'));var controller=require(_0x19be('0x9'));router[_0x19be('0xa')]('/',auth[_0x19be('0xb')](),controller['index']);router[_0x19be('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x19be('0xc')]);router[_0x19be('0xa')](_0x19be('0xd'),auth[_0x19be('0xb')](),controller[_0x19be('0xe')]);router['post']('/',auth[_0x19be('0xb')](),controller['create']);router[_0x19be('0xf')](_0x19be('0xd'),auth[_0x19be('0xb')](),controller[_0x19be('0x10')]);router[_0x19be('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x19be('0x12')]);module[_0x19be('0x13')]=router; \ No newline at end of file +var _0x8fb8=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','exports','multer','util'];(function(_0x1276b9,_0x5d17df){var _0x2bb276=function(_0x1a8f97){while(--_0x1a8f97){_0x1276b9['push'](_0x1276b9['shift']());}};_0x2bb276(++_0x5d17df);}(_0x8fb8,0x141));var _0x88fb=function(_0x362519,_0x5d067b){_0x362519=_0x362519-0x0;var _0x134ba4=_0x8fb8[_0x362519];return _0x134ba4;};'use strict';var multer=require(_0x88fb('0x0'));var util=require(_0x88fb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x88fb('0x2'));var router=express[_0x88fb('0x3')]();var auth=require(_0x88fb('0x4'));var interaction=require(_0x88fb('0x5'));var config=require(_0x88fb('0x6'));var controller=require(_0x88fb('0x7'));router[_0x88fb('0x8')]('/',auth[_0x88fb('0x9')](),controller[_0x88fb('0xa')]);router[_0x88fb('0x8')](_0x88fb('0xb'),auth['isAuthenticated'](),controller[_0x88fb('0xc')]);router[_0x88fb('0x8')](_0x88fb('0xd'),auth[_0x88fb('0x9')](),controller[_0x88fb('0xe')]);router[_0x88fb('0xf')]('/',auth[_0x88fb('0x9')](),controller['create']);router[_0x88fb('0x10')](_0x88fb('0xd'),auth[_0x88fb('0x9')](),controller['update']);router[_0x88fb('0x11')]('/:id',auth[_0x88fb('0x9')](),controller['destroy']);module[_0x88fb('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 1280088..2e7deee 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 _0x2f9d=['moment','sequelize','STRING','DATE'];(function(_0x29ed9b,_0x3787b5){var _0x3cd011=function(_0x3ee66c){while(--_0x3ee66c){_0x29ed9b['push'](_0x29ed9b['shift']());}};_0x3cd011(++_0x3787b5);}(_0x2f9d,0x1e4));var _0xd2f9=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x2f9d[_0xd1d19a];return _0x52a79d;};'use strict';var moment=require(_0xd2f9('0x0'));var Sequelize=require(_0xd2f9('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd2f9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd2f9('0x2')]},'joinAt':{'type':Sequelize[_0xd2f9('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd2f9('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x18f8=['DATE','moment','sequelize','exports','STRING'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x18f8,0x1eb));var _0x818f=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x18f8[_0x1f36bb];return _0xaf97fa;};'use strict';var moment=require(_0x818f('0x0'));var Sequelize=require(_0x818f('0x1'));module[_0x818f('0x2')]={'uniqueid':{'type':Sequelize[_0x818f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x818f('0x3')]},'joinAt':{'type':Sequelize[_0x818f('0x4')]},'leaveAt':{'type':Sequelize[_0x818f('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x818f('0x4')]},'reason':{'type':Sequelize[_0x818f('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 8e58a1d..9000581 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 _0x177a=['catch','create','body','destroy','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','find'];(function(_0x5d6af2,_0x359d90){var _0x23d91c=function(_0x424f1a){while(--_0x424f1a){_0x5d6af2['push'](_0x5d6af2['shift']());}};_0x23d91c(++_0x359d90);}(_0x177a,0xdd));var _0xa177=function(_0x5b5390,_0x28fe85){_0x5b5390=_0x5b5390-0x0;var _0xac323b=_0x177a[_0x5b5390];return _0xac323b;};'use strict';var pdf=require(_0xa177('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa177('0x1'));var jsonpatch=require(_0xa177('0x2'));var rp=require(_0xa177('0x3'));var moment=require(_0xa177('0x4'));var BPromise=require(_0xa177('0x5'));var Mustache=require(_0xa177('0x6'));var util=require('util');var path=require(_0xa177('0x7'));var sox=require(_0xa177('0x8'));var csv=require(_0xa177('0x9'));var ejs=require(_0xa177('0xa'));var fs=require('fs');var _=require(_0xa177('0xb'));var squel=require(_0xa177('0xc'));var crypto=require(_0xa177('0xd'));var jsforce=require(_0xa177('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa177('0x9'));var querystring=require('querystring');var Papa=require(_0xa177('0xf'));var Redis=require(_0xa177('0x10'));var authService=require(_0xa177('0x11'));var qs=require(_0xa177('0x12'));var as=require(_0xa177('0x13'));var hardwareService=require(_0xa177('0x14'));var logger=require(_0xa177('0x15'))('api');var utils=require(_0xa177('0x16'));var config=require(_0xa177('0x17'));var licenseUtil=require(_0xa177('0x18'));var db=require(_0xa177('0x19'))['db'];function respondWithStatusCode(_0x411274,_0x34baf1){_0x34baf1=_0x34baf1||0xcc;return function(_0x26c738){if(_0x26c738){return _0x411274['sendStatus'](_0x34baf1);}return _0x411274['status'](_0x34baf1)[_0xa177('0x1a')]();};}function respondWithResult(_0x198a92,_0x39d274){_0x39d274=_0x39d274||0xc8;return function(_0x179f42){if(_0x179f42){return _0x198a92[_0xa177('0x1b')](_0x39d274)[_0xa177('0x1c')](_0x179f42);}};}function respondWithFilteredResult(_0x258985,_0xbc9fa4){return function(_0x278633){if(_0x278633){var _0x3c1443=_0x278633[_0xa177('0x1d')],_0x26be7a=_0xbc9fa4[_0xa177('0x1e')],_0x24a35e=_0xbc9fa4['offset']+_0xbc9fa4[_0xa177('0x1f')],_0x5445da;if(_0x24a35e>=_0x3c1443){_0x24a35e=_0x3c1443;_0x5445da=0xc8;}else{_0x5445da=0xce;}_0x258985[_0xa177('0x1b')](_0x5445da);return _0x258985[_0xa177('0x20')](_0xa177('0x21'),_0x26be7a+'-'+_0x24a35e+'/'+_0x3c1443)['json'](_0x278633);}return null;};}function patchUpdates(_0x56816d){return function(_0x516acf){try{jsonpatch[_0xa177('0x22')](_0x516acf,_0x56816d,!![]);}catch(_0x2bc02d){return BPromise[_0xa177('0x23')](_0x2bc02d);}return _0x516acf[_0xa177('0x24')]();};}function saveUpdates(_0x50a957,_0x324bda){return function(_0x5ec792){if(_0x5ec792){return _0x5ec792[_0xa177('0x25')](_0x50a957)['then'](function(_0x401481){return _0x401481;});}return null;};}function removeEntity(_0x184178,_0x369942){return function(_0x279632){if(_0x279632){return _0x279632['destroy']()[_0xa177('0x26')](function(){_0x184178[_0xa177('0x1b')](0xcc)[_0xa177('0x1a')]();});}};}function handleEntityNotFound(_0x4bc686,_0x5d5118){return function(_0x4e0159){if(!_0x4e0159){_0x4bc686['sendStatus'](0x194);}return _0x4e0159;};}function handleError(_0x440d3d,_0x382a61){_0x382a61=_0x382a61||0x1f4;return function(_0x1cf775){logger[_0xa177('0x27')](_0x1cf775[_0xa177('0x28')]);if(_0x1cf775['name']){delete _0x1cf775[_0xa177('0x29')];}_0x440d3d[_0xa177('0x1b')](_0x382a61)['send'](_0x1cf775);};}exports['index']=function(_0x182160,_0x5b42a1){var _0x55f460={},_0x59d40d={},_0x45c513={'count':0x0,'rows':[]};var _0x4c8a61=_[_0xa177('0x2a')](db[_0xa177('0x2b')][_0xa177('0x2c')],function(_0x5f20d4){return{'name':_0x5f20d4[_0xa177('0x2d')],'type':_0x5f20d4[_0xa177('0x2e')]['key']};});_0x59d40d[_0xa177('0x2f')]=_[_0xa177('0x2a')](_0x4c8a61,_0xa177('0x29'));_0x59d40d[_0xa177('0x30')]=_[_0xa177('0x31')](_0x182160[_0xa177('0x30')]);_0x59d40d[_0xa177('0x32')]=_[_0xa177('0x33')](_0x59d40d['model'],_0x59d40d[_0xa177('0x30')]);_0x55f460[_0xa177('0x34')]=_['intersection'](_0x59d40d[_0xa177('0x2f')],qs[_0xa177('0x35')](_0x182160['query'][_0xa177('0x35')]));_0x55f460[_0xa177('0x34')]=_0x55f460['attributes'][_0xa177('0x36')]?_0x55f460[_0xa177('0x34')]:_0x59d40d[_0xa177('0x2f')];if(!_0x182160['query']['hasOwnProperty']('nolimit')){_0x55f460['limit']=qs['limit'](_0x182160[_0xa177('0x30')][_0xa177('0x1f')]);_0x55f460[_0xa177('0x1e')]=qs[_0xa177('0x1e')](_0x182160[_0xa177('0x30')][_0xa177('0x1e')]);}_0x55f460['order']=qs[_0xa177('0x37')](_0x182160[_0xa177('0x30')][_0xa177('0x37')]);_0x55f460[_0xa177('0x38')]=qs[_0xa177('0x32')](_[_0xa177('0x39')](_0x182160[_0xa177('0x30')],_0x59d40d[_0xa177('0x32')]),_0x4c8a61);if(_0x182160['query'][_0xa177('0x3a')]){_0x55f460[_0xa177('0x38')]=_['merge'](_0x55f460[_0xa177('0x38')],{'$or':_['map'](_0x4c8a61,function(_0x319c9c){if(_0x319c9c[_0xa177('0x2e')]!=='VIRTUAL'){var _0x129aed={};_0x129aed[_0x319c9c[_0xa177('0x29')]]={'$like':'%'+_0x182160[_0xa177('0x30')][_0xa177('0x3a')]+'%'};return _0x129aed;}})});}_0x55f460=_[_0xa177('0x3b')]({},_0x55f460,_0x182160[_0xa177('0x3c')]);var _0x4e6297={'where':_0x55f460[_0xa177('0x38')]};return db[_0xa177('0x2b')][_0xa177('0x1d')](_0x4e6297)[_0xa177('0x26')](function(_0x235241){_0x45c513['count']=_0x235241;if(_0x182160['query'][_0xa177('0x3d')]){_0x55f460[_0xa177('0x3e')]=[{'all':!![]}];}return db[_0xa177('0x2b')][_0xa177('0x3f')](_0x55f460);})[_0xa177('0x26')](function(_0x32f300){_0x45c513[_0xa177('0x40')]=_0x32f300;return _0x45c513;})[_0xa177('0x26')](respondWithFilteredResult(_0x5b42a1,_0x55f460))['catch'](handleError(_0x5b42a1,null));};exports['show']=function(_0x44774e,_0x3de295){var _0x36b5b8={'raw':!![],'where':{'id':_0x44774e[_0xa177('0x41')]['id']}},_0x374571={};_0x374571[_0xa177('0x2f')]=_[_0xa177('0x31')](db['OpenchannelQueueReport'][_0xa177('0x2c')]);_0x374571['query']=_[_0xa177('0x31')](_0x44774e[_0xa177('0x30')]);_0x374571[_0xa177('0x32')]=_[_0xa177('0x33')](_0x374571[_0xa177('0x2f')],_0x374571[_0xa177('0x30')]);_0x36b5b8['attributes']=_[_0xa177('0x33')](_0x374571[_0xa177('0x2f')],qs[_0xa177('0x35')](_0x44774e[_0xa177('0x30')][_0xa177('0x35')]));_0x36b5b8[_0xa177('0x34')]=_0x36b5b8['attributes'][_0xa177('0x36')]?_0x36b5b8[_0xa177('0x34')]:_0x374571[_0xa177('0x2f')];if(_0x44774e[_0xa177('0x30')][_0xa177('0x3d')]){_0x36b5b8[_0xa177('0x3e')]=[{'all':!![]}];}_0x36b5b8=_['merge']({},_0x36b5b8,_0x44774e[_0xa177('0x3c')]);return db[_0xa177('0x2b')][_0xa177('0x42')](_0x36b5b8)[_0xa177('0x26')](handleEntityNotFound(_0x3de295,null))[_0xa177('0x26')](respondWithResult(_0x3de295,null))[_0xa177('0x43')](handleError(_0x3de295,null));};exports[_0xa177('0x44')]=function(_0x280d40,_0x26d84b){return db[_0xa177('0x2b')][_0xa177('0x44')](_0x280d40[_0xa177('0x45')],{})[_0xa177('0x26')](respondWithResult(_0x26d84b,0xc9))[_0xa177('0x43')](handleError(_0x26d84b,null));};exports[_0xa177('0x25')]=function(_0x14a2c6,_0x5f2ebd){if(_0x14a2c6[_0xa177('0x45')]['id']){delete _0x14a2c6[_0xa177('0x45')]['id'];}return db[_0xa177('0x2b')][_0xa177('0x42')]({'where':{'id':_0x14a2c6[_0xa177('0x41')]['id']}})['then'](handleEntityNotFound(_0x5f2ebd,null))[_0xa177('0x26')](saveUpdates(_0x14a2c6[_0xa177('0x45')],null))['then'](respondWithResult(_0x5f2ebd,null))[_0xa177('0x43')](handleError(_0x5f2ebd,null));};exports[_0xa177('0x46')]=function(_0x230a9d,_0x32703b){return db[_0xa177('0x2b')][_0xa177('0x42')]({'where':{'id':_0x230a9d['params']['id']}})[_0xa177('0x26')](handleEntityNotFound(_0x32703b,null))[_0xa177('0x26')](removeEntity(_0x32703b,null))[_0xa177('0x43')](handleError(_0x32703b,null));};exports['describe']=function(_0x1f3977,_0xb1b274){return db[_0xa177('0x2b')][_0xa177('0x47')]()[_0xa177('0x26')](respondWithResult(_0xb1b274,null))[_0xa177('0x43')](handleError(_0xb1b274,null));}; \ No newline at end of file +var _0x4b84=['rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','OpenchannelQueueReport','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x26f83c,_0x98209){var _0x48aa6b=function(_0x5c745e){while(--_0x5c745e){_0x26f83c['push'](_0x26f83c['shift']());}};_0x48aa6b(++_0x98209);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x4b84[_0x2cd1fb];return _0x48fd2b;};'use strict';var pdf=require(_0x44b8('0x0'));var emlformat=require(_0x44b8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x44b8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x44b8('0x3'));var Mustache=require(_0x44b8('0x4'));var util=require(_0x44b8('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x44b8('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=_0x41ab46['count'],_0x495c74=_0x1722da[_0x44b8('0x17')],_0x5d6349=_0x1722da[_0x44b8('0x17')]+_0x1722da['limit'],_0x3fe9fb;if(_0x5d6349>=_0x5e52f2){_0x5d6349=_0x5e52f2;_0x3fe9fb=0xc8;}else{_0x3fe9fb=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x3fe9fb);return _0x2af0ad[_0x44b8('0x18')]('Content-Range',_0x495c74+'-'+_0x5d6349+'/'+_0x5e52f2)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x3f4688){return function(_0x4b600f){try{jsonpatch[_0x44b8('0x19')](_0x4b600f,_0x3f4688,!![]);}catch(_0x8b4301){return BPromise[_0x44b8('0x1a')](_0x8b4301);}return _0x4b600f[_0x44b8('0x1b')]();};}function saveUpdates(_0x102ef9,_0x369c09){return function(_0x452f2f){if(_0x452f2f){return _0x452f2f[_0x44b8('0x1c')](_0x102ef9)[_0x44b8('0x1d')](function(_0x1e0f2d){return _0x1e0f2d;});}return null;};}function removeEntity(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1e')]()[_0x44b8('0x1d')](function(){_0x1d642b[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x305a5c,_0x51a34a){return function(_0x402497){if(!_0x402497){_0x305a5c['sendStatus'](0x194);}return _0x402497;};}function handleError(_0x41a922,_0x228c81){_0x228c81=_0x228c81||0x1f4;return function(_0x25a0c1){logger[_0x44b8('0x1f')](_0x25a0c1[_0x44b8('0x20')]);if(_0x25a0c1['name']){delete _0x25a0c1[_0x44b8('0x21')];}_0x41a922['status'](_0x228c81)[_0x44b8('0x22')](_0x25a0c1);};}exports[_0x44b8('0x23')]=function(_0x549a26,_0x17ac44){var _0x470f49={},_0x2656d7={},_0x59c1bf={'count':0x0,'rows':[]};var _0xb22107=_[_0x44b8('0x24')](db['OpenchannelQueueReport'][_0x44b8('0x25')],function(_0x4a182d){return{'name':_0x4a182d[_0x44b8('0x26')],'type':_0x4a182d['type']['key']};});_0x2656d7['model']=_[_0x44b8('0x24')](_0xb22107,_0x44b8('0x21'));_0x2656d7[_0x44b8('0x27')]=_[_0x44b8('0x28')](_0x549a26[_0x44b8('0x27')]);_0x2656d7[_0x44b8('0x29')]=_[_0x44b8('0x2a')](_0x2656d7[_0x44b8('0x2b')],_0x2656d7[_0x44b8('0x27')]);_0x470f49[_0x44b8('0x2c')]=_[_0x44b8('0x2a')](_0x2656d7[_0x44b8('0x2b')],qs[_0x44b8('0x2d')](_0x549a26['query'][_0x44b8('0x2d')]));_0x470f49['attributes']=_0x470f49[_0x44b8('0x2c')][_0x44b8('0x2e')]?_0x470f49[_0x44b8('0x2c')]:_0x2656d7[_0x44b8('0x2b')];if(!_0x549a26[_0x44b8('0x27')]['hasOwnProperty'](_0x44b8('0x2f'))){_0x470f49[_0x44b8('0x30')]=qs[_0x44b8('0x30')](_0x549a26[_0x44b8('0x27')][_0x44b8('0x30')]);_0x470f49['offset']=qs[_0x44b8('0x17')](_0x549a26[_0x44b8('0x27')][_0x44b8('0x17')]);}_0x470f49[_0x44b8('0x31')]=qs[_0x44b8('0x32')](_0x549a26[_0x44b8('0x27')][_0x44b8('0x32')]);_0x470f49[_0x44b8('0x33')]=qs[_0x44b8('0x29')](_[_0x44b8('0x34')](_0x549a26[_0x44b8('0x27')],_0x2656d7[_0x44b8('0x29')]),_0xb22107);if(_0x549a26[_0x44b8('0x27')][_0x44b8('0x35')]){_0x470f49[_0x44b8('0x33')]=_[_0x44b8('0x36')](_0x470f49[_0x44b8('0x33')],{'$or':_[_0x44b8('0x24')](_0xb22107,function(_0x28faa9){if(_0x28faa9[_0x44b8('0x37')]!==_0x44b8('0x38')){var _0x282345={};_0x282345[_0x28faa9['name']]={'$like':'%'+_0x549a26[_0x44b8('0x27')][_0x44b8('0x35')]+'%'};return _0x282345;}})});}_0x470f49=_['merge']({},_0x470f49,_0x549a26[_0x44b8('0x39')]);var _0x2b9139={'where':_0x470f49[_0x44b8('0x33')]};return db[_0x44b8('0x3a')]['count'](_0x2b9139)[_0x44b8('0x1d')](function(_0x11e4e3){_0x59c1bf[_0x44b8('0x3b')]=_0x11e4e3;if(_0x549a26[_0x44b8('0x27')][_0x44b8('0x3c')]){_0x470f49[_0x44b8('0x3d')]=[{'all':!![]}];}return db[_0x44b8('0x3a')][_0x44b8('0x3e')](_0x470f49);})[_0x44b8('0x1d')](function(_0x3d1be1){_0x59c1bf[_0x44b8('0x3f')]=_0x3d1be1;return _0x59c1bf;})[_0x44b8('0x1d')](respondWithFilteredResult(_0x17ac44,_0x470f49))[_0x44b8('0x40')](handleError(_0x17ac44,null));};exports[_0x44b8('0x41')]=function(_0x2f8b59,_0x29b43f){var _0x57d8c4={'raw':!![],'where':{'id':_0x2f8b59[_0x44b8('0x42')]['id']}},_0x12a0a4={};_0x12a0a4[_0x44b8('0x2b')]=_['keys'](db[_0x44b8('0x3a')][_0x44b8('0x25')]);_0x12a0a4[_0x44b8('0x27')]=_['keys'](_0x2f8b59[_0x44b8('0x27')]);_0x12a0a4[_0x44b8('0x29')]=_[_0x44b8('0x2a')](_0x12a0a4[_0x44b8('0x2b')],_0x12a0a4[_0x44b8('0x27')]);_0x57d8c4['attributes']=_['intersection'](_0x12a0a4[_0x44b8('0x2b')],qs[_0x44b8('0x2d')](_0x2f8b59[_0x44b8('0x27')][_0x44b8('0x2d')]));_0x57d8c4[_0x44b8('0x2c')]=_0x57d8c4[_0x44b8('0x2c')][_0x44b8('0x2e')]?_0x57d8c4[_0x44b8('0x2c')]:_0x12a0a4[_0x44b8('0x2b')];if(_0x2f8b59[_0x44b8('0x27')][_0x44b8('0x3c')]){_0x57d8c4[_0x44b8('0x3d')]=[{'all':!![]}];}_0x57d8c4=_[_0x44b8('0x36')]({},_0x57d8c4,_0x2f8b59[_0x44b8('0x39')]);return db[_0x44b8('0x3a')][_0x44b8('0x43')](_0x57d8c4)[_0x44b8('0x1d')](handleEntityNotFound(_0x29b43f,null))[_0x44b8('0x1d')](respondWithResult(_0x29b43f,null))[_0x44b8('0x40')](handleError(_0x29b43f,null));};exports['create']=function(_0x547dc1,_0x3b1b12){return db[_0x44b8('0x3a')][_0x44b8('0x44')](_0x547dc1[_0x44b8('0x45')],{})[_0x44b8('0x1d')](respondWithResult(_0x3b1b12,0xc9))[_0x44b8('0x40')](handleError(_0x3b1b12,null));};exports[_0x44b8('0x1c')]=function(_0x4fe73f,_0x156070){if(_0x4fe73f['body']['id']){delete _0x4fe73f[_0x44b8('0x45')]['id'];}return db[_0x44b8('0x3a')][_0x44b8('0x43')]({'where':{'id':_0x4fe73f[_0x44b8('0x42')]['id']}})[_0x44b8('0x1d')](handleEntityNotFound(_0x156070,null))[_0x44b8('0x1d')](saveUpdates(_0x4fe73f['body'],null))[_0x44b8('0x1d')](respondWithResult(_0x156070,null))[_0x44b8('0x40')](handleError(_0x156070,null));};exports[_0x44b8('0x1e')]=function(_0x25d266,_0x4ccc77){return db[_0x44b8('0x3a')][_0x44b8('0x43')]({'where':{'id':_0x25d266[_0x44b8('0x42')]['id']}})[_0x44b8('0x1d')](handleEntityNotFound(_0x4ccc77,null))[_0x44b8('0x1d')](removeEntity(_0x4ccc77,null))[_0x44b8('0x40')](handleError(_0x4ccc77,null));};exports['describe']=function(_0x19d95d,_0x450715){return db[_0x44b8('0x3a')][_0x44b8('0x46')]()[_0x44b8('0x1d')](respondWithResult(_0x450715,null))['catch'](handleError(_0x450715,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 8502e20..8ec8028 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 _0x006d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport','report_openchannel_queue','uniqueid'];(function(_0x1a9607,_0x39d774){var _0x43773c=function(_0x3e6739){while(--_0x3e6739){_0x1a9607['push'](_0x1a9607['shift']());}};_0x43773c(++_0x39d774);}(_0x006d,0xea));var _0xd006=function(_0x41e0d4,_0x40536e){_0x41e0d4=_0x41e0d4-0x0;var _0x3a2ded=_0x006d[_0x41e0d4];return _0x3a2ded;};'use strict';var _=require(_0xd006('0x0'));var util=require(_0xd006('0x1'));var logger=require(_0xd006('0x2'))(_0xd006('0x3'));var moment=require(_0xd006('0x4'));var BPromise=require(_0xd006('0x5'));var rp=require(_0xd006('0x6'));var fs=require('fs');var path=require(_0xd006('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd006('0x8'));module[_0xd006('0x9')]=function(_0x4d16cb,_0xd874b1){return _0x4d16cb['define'](_0xd006('0xa'),attributes,{'tableName':_0xd006('0xb'),'paranoid':![],'indexes':[{'name':_0xd006('0xc'),'fields':[_0xd006('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ff6=['OpenchannelQueueReport','report_openchannel_queue','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define'];(function(_0x590234,_0x20b30d){var _0x3d9c96=function(_0x4b3dc4){while(--_0x4b3dc4){_0x590234['push'](_0x590234['shift']());}};_0x3d9c96(++_0x20b30d);}(_0x4ff6,0xd5));var _0x64ff=function(_0xc59dea,_0x7f85af){_0xc59dea=_0xc59dea-0x0;var _0x7602b7=_0x4ff6[_0xc59dea];return _0x7602b7;};'use strict';var _=require('lodash');var util=require(_0x64ff('0x0'));var logger=require(_0x64ff('0x1'))(_0x64ff('0x2'));var moment=require(_0x64ff('0x3'));var BPromise=require(_0x64ff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64ff('0x5'));var rimraf=require(_0x64ff('0x6'));var config=require(_0x64ff('0x7'));var attributes=require(_0x64ff('0x8'));module[_0x64ff('0x9')]=function(_0x34dacd,_0x37ad86){return _0x34dacd[_0x64ff('0xa')](_0x64ff('0xb'),attributes,{'tableName':_0x64ff('0xc'),'paranoid':![],'indexes':[{'name':_0x64ff('0xd'),'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 a3ce014..693560d 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 _0xc0a2=['body','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','options','raw','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc0a2,0xae));var _0x2c0a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc0a2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2c0a('0x0'));var util=require(_0x2c0a('0x1'));var moment=require(_0x2c0a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c0a('0x3'));var db=require(_0x2c0a('0x4'))['db'];var utils=require(_0x2c0a('0x5'));var logger=require('../../config/logger')(_0x2c0a('0x6'));var config=require('../../config/environment');var jayson=require(_0x2c0a('0x7'));var client=jayson[_0x2c0a('0x8')][_0x2c0a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37a117,_0x2d7532,_0x1e7e6f){return new BPromise(function(_0x2c8f8a,_0x2e5dab){return client[_0x2c0a('0xa')](_0x37a117,_0x1e7e6f)['then'](function(_0x531fb7){logger[_0x2c0a('0xb')](_0x2c0a('0xc'),_0x2d7532,'request\x20sent');logger[_0x2c0a('0xd')](_0x2c0a('0xe'),_0x2d7532,_0x2c0a('0xf'),JSON[_0x2c0a('0x10')](_0x531fb7));if(_0x531fb7[_0x2c0a('0x11')]){if(_0x531fb7[_0x2c0a('0x11')][_0x2c0a('0x12')]===0x1f4){logger['error'](_0x2c0a('0xc'),_0x2d7532,_0x531fb7[_0x2c0a('0x11')][_0x2c0a('0x13')]);return _0x2e5dab(_0x531fb7['error']['message']);}logger['error'](_0x2c0a('0xc'),_0x2d7532,_0x531fb7[_0x2c0a('0x11')][_0x2c0a('0x13')]);return _0x2c8f8a(_0x531fb7[_0x2c0a('0x11')][_0x2c0a('0x13')]);}else{logger[_0x2c0a('0xb')](_0x2c0a('0xc'),_0x2d7532,_0x2c0a('0xf'));_0x2c8f8a(_0x531fb7[_0x2c0a('0x14')][_0x2c0a('0x13')]);}})[_0x2c0a('0x15')](function(_0x245742){logger[_0x2c0a('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2d7532,_0x245742);_0x2e5dab(_0x245742);});});}exports['CreateOpenchannelQueueReport']=function(_0x3e1eb1){var _0x105c76=this;return new Promise(function(_0x30433e,_0x10b005){return db[_0x2c0a('0x16')][_0x2c0a('0x17')](_0x3e1eb1['body'],{'raw':_0x3e1eb1[_0x2c0a('0x18')]?_0x3e1eb1[_0x2c0a('0x18')][_0x2c0a('0x19')]===undefined?!![]:![]:!![]})[_0x2c0a('0x1a')](function(_0x4f68a9){logger[_0x2c0a('0xb')](_0x2c0a('0x1b'),_0x3e1eb1);logger['debug'](_0x2c0a('0x1b'),_0x3e1eb1,JSON[_0x2c0a('0x10')](_0x4f68a9));_0x30433e(_0x4f68a9);})[_0x2c0a('0x15')](function(_0x26c91c){logger['error'](_0x2c0a('0x1b'),_0x26c91c[_0x2c0a('0x13')],_0x3e1eb1);_0x10b005(_0x105c76[_0x2c0a('0x11')](0x1f4,_0x26c91c[_0x2c0a('0x13')]));});});};exports[_0x2c0a('0x1c')]=function(_0xc55f42){var _0x24f378=this;return new Promise(function(_0x5a23aa,_0x21d906){return db[_0x2c0a('0x16')][_0x2c0a('0x1d')](_0xc55f42[_0x2c0a('0x1e')],{'raw':_0xc55f42[_0x2c0a('0x18')]?_0xc55f42[_0x2c0a('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc55f42[_0x2c0a('0x18')]?_0xc55f42[_0x2c0a('0x18')][_0x2c0a('0x1f')]||null:null,'attributes':_0xc55f42['options']?_0xc55f42[_0x2c0a('0x18')][_0x2c0a('0x20')]||null:null,'limit':_0xc55f42[_0x2c0a('0x18')]?_0xc55f42[_0x2c0a('0x18')][_0x2c0a('0x21')]||null:null})['then'](function(_0x2c529c){logger[_0x2c0a('0xb')](_0x2c0a('0x1c'),_0xc55f42);logger[_0x2c0a('0xd')]('UpdateOpenchannelQueueReport',_0xc55f42,JSON[_0x2c0a('0x10')](_0x2c529c));_0x5a23aa(_0x2c529c);})[_0x2c0a('0x15')](function(_0x3f980a){logger['error'](_0x2c0a('0x1c'),_0x3f980a['message'],_0xc55f42);_0x21d906(_0x24f378[_0x2c0a('0x11')](0x1f4,_0x3f980a[_0x2c0a('0x13')]));});});}; \ No newline at end of file +var _0xdb8a=['util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','info','result','catch','create','body','options','raw','CreateOpenchannelQueueReport','update','where','attributes','limit','UpdateOpenchannelQueueReport','lodash'];(function(_0x1a809b,_0x4c15e3){var _0x5d90e6=function(_0x5dd2e1){while(--_0x5dd2e1){_0x1a809b['push'](_0x1a809b['shift']());}};_0x5d90e6(++_0x4c15e3);}(_0xdb8a,0x135));var _0xadb8=function(_0x3ce53b,_0x30bbcc){_0x3ce53b=_0x3ce53b-0x0;var _0x7fa584=_0xdb8a[_0x3ce53b];return _0x7fa584;};'use strict';var _=require(_0xadb8('0x0'));var util=require(_0xadb8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xadb8('0x2'));var fs=require('fs');var Redis=require(_0xadb8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xadb8('0x4'));var logger=require(_0xadb8('0x5'))(_0xadb8('0x6'));var config=require('../../config/environment');var jayson=require(_0xadb8('0x7'));var client=jayson[_0xadb8('0x8')][_0xadb8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319030,_0x2b9a27,_0x44df88){return new BPromise(function(_0x2ae9d6,_0x4b792b){return client[_0xadb8('0xa')](_0x319030,_0x44df88)[_0xadb8('0xb')](function(_0x195223){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x2b9a27,_0xadb8('0xc'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x2b9a27,_0xadb8('0xc'),JSON[_0xadb8('0xd')](_0x195223));if(_0x195223[_0xadb8('0xe')]){if(_0x195223[_0xadb8('0xe')][_0xadb8('0xf')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x2b9a27,_0x195223[_0xadb8('0xe')][_0xadb8('0x10')]);return _0x4b792b(_0x195223[_0xadb8('0xe')]['message']);}logger[_0xadb8('0xe')](_0xadb8('0x11'),_0x2b9a27,_0x195223[_0xadb8('0xe')]['message']);return _0x2ae9d6(_0x195223[_0xadb8('0xe')][_0xadb8('0x10')]);}else{logger[_0xadb8('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2b9a27,'request\x20sent');_0x2ae9d6(_0x195223[_0xadb8('0x13')][_0xadb8('0x10')]);}})[_0xadb8('0x14')](function(_0x1994b0){logger[_0xadb8('0xe')](_0xadb8('0x11'),_0x2b9a27,_0x1994b0);_0x4b792b(_0x1994b0);});});}exports['CreateOpenchannelQueueReport']=function(_0x4a68a0){var _0x272e3d=this;return new Promise(function(_0x5932f9,_0x3c03ca){return db['OpenchannelQueueReport'][_0xadb8('0x15')](_0x4a68a0[_0xadb8('0x16')],{'raw':_0x4a68a0[_0xadb8('0x17')]?_0x4a68a0[_0xadb8('0x17')][_0xadb8('0x18')]===undefined?!![]:![]:!![]})[_0xadb8('0xb')](function(_0x1ee8b2){logger[_0xadb8('0x12')](_0xadb8('0x19'),_0x4a68a0);logger['debug'](_0xadb8('0x19'),_0x4a68a0,JSON[_0xadb8('0xd')](_0x1ee8b2));_0x5932f9(_0x1ee8b2);})[_0xadb8('0x14')](function(_0x59c286){logger[_0xadb8('0xe')](_0xadb8('0x19'),_0x59c286[_0xadb8('0x10')],_0x4a68a0);_0x3c03ca(_0x272e3d[_0xadb8('0xe')](0x1f4,_0x59c286[_0xadb8('0x10')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x5cd14e){var _0x2bb6e1=this;return new Promise(function(_0x2eaa90,_0x49e731){return db['OpenchannelQueueReport'][_0xadb8('0x1a')](_0x5cd14e[_0xadb8('0x16')],{'raw':_0x5cd14e[_0xadb8('0x17')]?_0x5cd14e[_0xadb8('0x17')][_0xadb8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cd14e['options']?_0x5cd14e[_0xadb8('0x17')][_0xadb8('0x1b')]||null:null,'attributes':_0x5cd14e[_0xadb8('0x17')]?_0x5cd14e[_0xadb8('0x17')][_0xadb8('0x1c')]||null:null,'limit':_0x5cd14e[_0xadb8('0x17')]?_0x5cd14e[_0xadb8('0x17')][_0xadb8('0x1d')]||null:null})[_0xadb8('0xb')](function(_0x3e74c4){logger['info'](_0xadb8('0x1e'),_0x5cd14e);logger['debug'](_0xadb8('0x1e'),_0x5cd14e,JSON[_0xadb8('0xd')](_0x3e74c4));_0x2eaa90(_0x3e74c4);})[_0xadb8('0x14')](function(_0x8d4df2){logger['error'](_0xadb8('0x1e'),_0x8d4df2[_0xadb8('0x10')],_0x5cd14e);_0x49e731(_0x2bb6e1[_0xadb8('0xe')](0x1f4,_0x8d4df2['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index c25fd49..c63c60b 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(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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 458a9c1..506fdf0 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 _0x1ecf=['DATE','NOW','sequelize','exports','STRING','account','agent','queue'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1ecf,0x1a2));var _0xf1ec=function(_0x4b3e49,_0x9e566c){_0x4b3e49=_0x4b3e49-0x0;var _0x57e339=_0x1ecf[_0x4b3e49];return _0x57e339;};'use strict';var moment=require('moment');var Sequelize=require(_0xf1ec('0x0'));module[_0xf1ec('0x1')]={'uniqueid':{'type':Sequelize[_0xf1ec('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf1ec('0x3'),_0xf1ec('0x4'),_0xf1ec('0x5')),'allowNull':![],'defaultValue':_0xf1ec('0x5')},'transferredAt':{'type':Sequelize[_0xf1ec('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xf1ec('0x7')]}}; \ No newline at end of file +var _0xdbab=['DATE','NOW','moment','account'];(function(_0x35fcf3,_0x1cd4b2){var _0x2a7f85=function(_0x32c56e){while(--_0x32c56e){_0x35fcf3['push'](_0x35fcf3['shift']());}};_0x2a7f85(++_0x1cd4b2);}(_0xdbab,0x14e));var _0xbdba=function(_0x3c5c49,_0x70d174){_0x3c5c49=_0x3c5c49-0x0;var _0x397b13=_0xdbab[_0x3c5c49];return _0x397b13;};'use strict';var moment=require(_0xbdba('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbdba('0x1'),'agent','queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xbdba('0x2')],'allowNull':![],'defaultValue':Sequelize[_0xbdba('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 2ff9222..35577b9 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 _0x46af=['where','merge','VIRTUAL','count','include','findAll','rows','show','params','keys','includeAll','find','create','body','catch','describe','html-pdf','fast-json-patch','request-promise','util','sox','to-csv','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','OpenchannelTransferReport','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','sort','filter'];(function(_0x3f36ed,_0x38124c){var _0x402a89=function(_0x4d8924){while(--_0x4d8924){_0x3f36ed['push'](_0x3f36ed['shift']());}};_0x402a89(++_0x38124c);}(_0x46af,0x1a2));var _0xf46a=function(_0x1c8655,_0x2e298b){_0x1c8655=_0x1c8655-0x0;var _0x569164=_0x46af[_0x1c8655];return _0x569164;};'use strict';var pdf=require(_0xf46a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf46a('0x1'));var rp=require(_0xf46a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf46a('0x3'));var path=require('path');var sox=require(_0xf46a('0x4'));var csv=require(_0xf46a('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf46a('0x6'));var squel=require(_0xf46a('0x7'));var crypto=require(_0xf46a('0x8'));var jsforce=require(_0xf46a('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xf46a('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf46a('0xa'));var authService=require(_0xf46a('0xb'));var qs=require(_0xf46a('0xc'));var as=require(_0xf46a('0xd'));var hardwareService=require(_0xf46a('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0xf46a('0xf'));var config=require(_0xf46a('0x10'));var licenseUtil=require(_0xf46a('0x11'));var db=require(_0xf46a('0x12'))['db'];function respondWithStatusCode(_0x8cce71,_0x2ae94d){_0x2ae94d=_0x2ae94d||0xcc;return function(_0x259612){if(_0x259612){return _0x8cce71['sendStatus'](_0x2ae94d);}return _0x8cce71[_0xf46a('0x13')](_0x2ae94d)['end']();};}function respondWithResult(_0x119a80,_0x816afc){_0x816afc=_0x816afc||0xc8;return function(_0x328697){if(_0x328697){return _0x119a80['status'](_0x816afc)[_0xf46a('0x14')](_0x328697);}};}function respondWithFilteredResult(_0x18d838,_0x3493c5){return function(_0xce52bb){if(_0xce52bb){var _0x2289a6=_0xce52bb['count'],_0x29a2d2=_0x3493c5[_0xf46a('0x15')],_0x43f7a7=_0x3493c5[_0xf46a('0x15')]+_0x3493c5[_0xf46a('0x16')],_0x49ddc3;if(_0x43f7a7>=_0x2289a6){_0x43f7a7=_0x2289a6;_0x49ddc3=0xc8;}else{_0x49ddc3=0xce;}_0x18d838[_0xf46a('0x13')](_0x49ddc3);return _0x18d838[_0xf46a('0x17')](_0xf46a('0x18'),_0x29a2d2+'-'+_0x43f7a7+'/'+_0x2289a6)[_0xf46a('0x14')](_0xce52bb);}return null;};}function patchUpdates(_0xbafad9){return function(_0x4af959){try{jsonpatch[_0xf46a('0x19')](_0x4af959,_0xbafad9,!![]);}catch(_0x2c75c8){return BPromise[_0xf46a('0x1a')](_0x2c75c8);}return _0x4af959[_0xf46a('0x1b')]();};}function saveUpdates(_0x3accb7,_0x4fa891){return function(_0x5cbf0a){if(_0x5cbf0a){return _0x5cbf0a[_0xf46a('0x1c')](_0x3accb7)['then'](function(_0x46ce02){return _0x46ce02;});}return null;};}function removeEntity(_0x553182,_0x2f94fe){return function(_0x8dbee1){if(_0x8dbee1){return _0x8dbee1[_0xf46a('0x1d')]()[_0xf46a('0x1e')](function(){_0x553182['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x348d44,_0x3c8ce9){return function(_0x1504b7){if(!_0x1504b7){_0x348d44[_0xf46a('0x1f')](0x194);}return _0x1504b7;};}function handleError(_0x5b97b2,_0x3b716f){_0x3b716f=_0x3b716f||0x1f4;return function(_0x3fa8e7){logger[_0xf46a('0x20')](_0x3fa8e7[_0xf46a('0x21')]);if(_0x3fa8e7[_0xf46a('0x22')]){delete _0x3fa8e7[_0xf46a('0x22')];}_0x5b97b2['status'](_0x3b716f)[_0xf46a('0x23')](_0x3fa8e7);};}exports['index']=function(_0xc9f4f2,_0x31d622){var _0x52fb57={},_0x451690={},_0x20e873={'count':0x0,'rows':[]};var _0x4769cd=_['map'](db[_0xf46a('0x24')][_0xf46a('0x25')],function(_0x2127d2){return{'name':_0x2127d2['fieldName'],'type':_0x2127d2[_0xf46a('0x26')][_0xf46a('0x27')]};});_0x451690[_0xf46a('0x28')]=_[_0xf46a('0x29')](_0x4769cd,'name');_0x451690[_0xf46a('0x2a')]=_['keys'](_0xc9f4f2['query']);_0x451690[_0xf46a('0x2b')]=_[_0xf46a('0x2c')](_0x451690[_0xf46a('0x28')],_0x451690[_0xf46a('0x2a')]);_0x52fb57['attributes']=_[_0xf46a('0x2c')](_0x451690[_0xf46a('0x28')],qs['fields'](_0xc9f4f2[_0xf46a('0x2a')][_0xf46a('0x2d')]));_0x52fb57['attributes']=_0x52fb57[_0xf46a('0x2e')][_0xf46a('0x2f')]?_0x52fb57[_0xf46a('0x2e')]:_0x451690['model'];if(!_0xc9f4f2['query']['hasOwnProperty'](_0xf46a('0x30'))){_0x52fb57[_0xf46a('0x16')]=qs[_0xf46a('0x16')](_0xc9f4f2['query'][_0xf46a('0x16')]);_0x52fb57[_0xf46a('0x15')]=qs[_0xf46a('0x15')](_0xc9f4f2['query'][_0xf46a('0x15')]);}_0x52fb57['order']=qs['sort'](_0xc9f4f2[_0xf46a('0x2a')][_0xf46a('0x31')]);_0x52fb57['where']=qs[_0xf46a('0x2b')](_['pick'](_0xc9f4f2[_0xf46a('0x2a')],_0x451690[_0xf46a('0x2b')]),_0x4769cd);if(_0xc9f4f2[_0xf46a('0x2a')][_0xf46a('0x32')]){_0x52fb57[_0xf46a('0x33')]=_[_0xf46a('0x34')](_0x52fb57['where'],{'$or':_[_0xf46a('0x29')](_0x4769cd,function(_0x1cb087){if(_0x1cb087[_0xf46a('0x26')]!==_0xf46a('0x35')){var _0x3ba232={};_0x3ba232[_0x1cb087[_0xf46a('0x22')]]={'$like':'%'+_0xc9f4f2[_0xf46a('0x2a')][_0xf46a('0x32')]+'%'};return _0x3ba232;}})});}_0x52fb57=_['merge']({},_0x52fb57,_0xc9f4f2['options']);var _0x546702={'where':_0x52fb57[_0xf46a('0x33')]};return db[_0xf46a('0x24')][_0xf46a('0x36')](_0x546702)['then'](function(_0x57e970){_0x20e873[_0xf46a('0x36')]=_0x57e970;if(_0xc9f4f2[_0xf46a('0x2a')]['includeAll']){_0x52fb57[_0xf46a('0x37')]=[{'all':!![]}];}return db[_0xf46a('0x24')][_0xf46a('0x38')](_0x52fb57);})[_0xf46a('0x1e')](function(_0x37af42){_0x20e873[_0xf46a('0x39')]=_0x37af42;return _0x20e873;})[_0xf46a('0x1e')](respondWithFilteredResult(_0x31d622,_0x52fb57))['catch'](handleError(_0x31d622,null));};exports[_0xf46a('0x3a')]=function(_0x211bb9,_0x6db179){var _0x303965={'raw':!![],'where':{'id':_0x211bb9[_0xf46a('0x3b')]['id']}},_0x541251={};_0x541251[_0xf46a('0x28')]=_['keys'](db[_0xf46a('0x24')][_0xf46a('0x25')]);_0x541251[_0xf46a('0x2a')]=_[_0xf46a('0x3c')](_0x211bb9[_0xf46a('0x2a')]);_0x541251[_0xf46a('0x2b')]=_['intersection'](_0x541251[_0xf46a('0x28')],_0x541251[_0xf46a('0x2a')]);_0x303965[_0xf46a('0x2e')]=_[_0xf46a('0x2c')](_0x541251[_0xf46a('0x28')],qs[_0xf46a('0x2d')](_0x211bb9[_0xf46a('0x2a')][_0xf46a('0x2d')]));_0x303965[_0xf46a('0x2e')]=_0x303965[_0xf46a('0x2e')][_0xf46a('0x2f')]?_0x303965[_0xf46a('0x2e')]:_0x541251[_0xf46a('0x28')];if(_0x211bb9[_0xf46a('0x2a')][_0xf46a('0x3d')]){_0x303965[_0xf46a('0x37')]=[{'all':!![]}];}_0x303965=_[_0xf46a('0x34')]({},_0x303965,_0x211bb9['options']);return db[_0xf46a('0x24')][_0xf46a('0x3e')](_0x303965)[_0xf46a('0x1e')](handleEntityNotFound(_0x6db179,null))['then'](respondWithResult(_0x6db179,null))['catch'](handleError(_0x6db179,null));};exports[_0xf46a('0x3f')]=function(_0x32df80,_0x429b71){return db['OpenchannelTransferReport']['create'](_0x32df80[_0xf46a('0x40')],{})[_0xf46a('0x1e')](respondWithResult(_0x429b71,0xc9))[_0xf46a('0x41')](handleError(_0x429b71,null));};exports[_0xf46a('0x1c')]=function(_0x417262,_0x4cb920){if(_0x417262[_0xf46a('0x40')]['id']){delete _0x417262[_0xf46a('0x40')]['id'];}return db[_0xf46a('0x24')][_0xf46a('0x3e')]({'where':{'id':_0x417262[_0xf46a('0x3b')]['id']}})[_0xf46a('0x1e')](handleEntityNotFound(_0x4cb920,null))[_0xf46a('0x1e')](saveUpdates(_0x417262[_0xf46a('0x40')],null))[_0xf46a('0x1e')](respondWithResult(_0x4cb920,null))[_0xf46a('0x41')](handleError(_0x4cb920,null));};exports[_0xf46a('0x1d')]=function(_0x2703e3,_0x595e14){return db['OpenchannelTransferReport'][_0xf46a('0x3e')]({'where':{'id':_0x2703e3[_0xf46a('0x3b')]['id']}})[_0xf46a('0x1e')](handleEntityNotFound(_0x595e14,null))[_0xf46a('0x1e')](removeEntity(_0x595e14,null))[_0xf46a('0x41')](handleError(_0x595e14,null));};exports[_0xf46a('0x42')]=function(_0x4e2989,_0x15508b){return db['OpenchannelTransferReport'][_0xf46a('0x42')]()[_0xf46a('0x1e')](respondWithResult(_0x15508b,null))[_0xf46a('0x41')](handleError(_0x15508b,null));}; \ No newline at end of file +var _0x40ff=['sendStatus','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','status','end','error','stack','name','send','index','map','OpenchannelTransferReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','catch','show','include','find','create','body','params','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x1e1b87,_0x3984ea){var _0x2280b5=function(_0x49a34a){while(--_0x49a34a){_0x1e1b87['push'](_0x1e1b87['shift']());}};_0x2280b5(++_0x3984ea);}(_0x40ff,0x10e));var _0xf40f=function(_0x2333a4,_0x524fc9){_0x2333a4=_0x2333a4-0x0;var _0xee12d5=_0x40ff[_0x2333a4];return _0xee12d5;};'use strict';var pdf=require(_0xf40f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf40f('0x1'));var zipdir=require(_0xf40f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf40f('0x3'));var moment=require(_0xf40f('0x4'));var BPromise=require(_0xf40f('0x5'));var Mustache=require(_0xf40f('0x6'));var util=require('util');var path=require(_0xf40f('0x7'));var sox=require('sox');var csv=require(_0xf40f('0x8'));var ejs=require(_0xf40f('0x9'));var fs=require('fs');var _=require(_0xf40f('0xa'));var squel=require(_0xf40f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf40f('0xc'));var toCsv=require(_0xf40f('0x8'));var querystring=require('querystring');var Papa=require(_0xf40f('0xd'));var Redis=require(_0xf40f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf40f('0xf'));var as=require(_0xf40f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf40f('0x11'))(_0xf40f('0x12'));var utils=require(_0xf40f('0x13'));var config=require(_0xf40f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf40f('0x15'))['db'];function respondWithStatusCode(_0x2e980f,_0x37fbd9){_0x37fbd9=_0x37fbd9||0xcc;return function(_0x9de4c9){if(_0x9de4c9){return _0x2e980f[_0xf40f('0x16')](_0x37fbd9);}return _0x2e980f['status'](_0x37fbd9)['end']();};}function respondWithResult(_0x2f8dd8,_0x142afc){_0x142afc=_0x142afc||0xc8;return function(_0x3dfb86){if(_0x3dfb86){return _0x2f8dd8['status'](_0x142afc)[_0xf40f('0x17')](_0x3dfb86);}};}function respondWithFilteredResult(_0x12b505,_0x139563){return function(_0x14ceb7){if(_0x14ceb7){var _0x1ecdb6=_0x14ceb7[_0xf40f('0x18')],_0xbefaea=_0x139563[_0xf40f('0x19')],_0x72e03e=_0x139563['offset']+_0x139563[_0xf40f('0x1a')],_0x2b1a02;if(_0x72e03e>=_0x1ecdb6){_0x72e03e=_0x1ecdb6;_0x2b1a02=0xc8;}else{_0x2b1a02=0xce;}_0x12b505['status'](_0x2b1a02);return _0x12b505[_0xf40f('0x1b')](_0xf40f('0x1c'),_0xbefaea+'-'+_0x72e03e+'/'+_0x1ecdb6)[_0xf40f('0x17')](_0x14ceb7);}return null;};}function patchUpdates(_0x54295b){return function(_0x4da935){try{jsonpatch[_0xf40f('0x1d')](_0x4da935,_0x54295b,!![]);}catch(_0x5fdefb){return BPromise['reject'](_0x5fdefb);}return _0x4da935[_0xf40f('0x1e')]();};}function saveUpdates(_0x55e833,_0x25fd5c){return function(_0xc4803b){if(_0xc4803b){return _0xc4803b[_0xf40f('0x1f')](_0x55e833)[_0xf40f('0x20')](function(_0x39ebb8){return _0x39ebb8;});}return null;};}function removeEntity(_0x43fc27,_0x57e7c0){return function(_0x31ea59){if(_0x31ea59){return _0x31ea59[_0xf40f('0x21')]()[_0xf40f('0x20')](function(){_0x43fc27[_0xf40f('0x22')](0xcc)[_0xf40f('0x23')]();});}};}function handleEntityNotFound(_0x31909a,_0x5d4416){return function(_0x172170){if(!_0x172170){_0x31909a[_0xf40f('0x16')](0x194);}return _0x172170;};}function handleError(_0x1e525a,_0x4566c6){_0x4566c6=_0x4566c6||0x1f4;return function(_0x5e83a5){logger[_0xf40f('0x24')](_0x5e83a5[_0xf40f('0x25')]);if(_0x5e83a5[_0xf40f('0x26')]){delete _0x5e83a5[_0xf40f('0x26')];}_0x1e525a[_0xf40f('0x22')](_0x4566c6)[_0xf40f('0x27')](_0x5e83a5);};}exports[_0xf40f('0x28')]=function(_0x3bb9c1,_0x3fbf8c){var _0x42eb5a={},_0x2ea267={},_0x15bd2d={'count':0x0,'rows':[]};var _0x586fc0=_[_0xf40f('0x29')](db[_0xf40f('0x2a')]['rawAttributes'],function(_0x3374f6){return{'name':_0x3374f6[_0xf40f('0x2b')],'type':_0x3374f6[_0xf40f('0x2c')][_0xf40f('0x2d')]};});_0x2ea267[_0xf40f('0x2e')]=_[_0xf40f('0x29')](_0x586fc0,'name');_0x2ea267['query']=_[_0xf40f('0x2f')](_0x3bb9c1[_0xf40f('0x30')]);_0x2ea267[_0xf40f('0x31')]=_[_0xf40f('0x32')](_0x2ea267['model'],_0x2ea267['query']);_0x42eb5a[_0xf40f('0x33')]=_[_0xf40f('0x32')](_0x2ea267[_0xf40f('0x2e')],qs[_0xf40f('0x34')](_0x3bb9c1['query'][_0xf40f('0x34')]));_0x42eb5a[_0xf40f('0x33')]=_0x42eb5a[_0xf40f('0x33')][_0xf40f('0x35')]?_0x42eb5a[_0xf40f('0x33')]:_0x2ea267['model'];if(!_0x3bb9c1[_0xf40f('0x30')][_0xf40f('0x36')](_0xf40f('0x37'))){_0x42eb5a['limit']=qs[_0xf40f('0x1a')](_0x3bb9c1[_0xf40f('0x30')][_0xf40f('0x1a')]);_0x42eb5a[_0xf40f('0x19')]=qs[_0xf40f('0x19')](_0x3bb9c1[_0xf40f('0x30')][_0xf40f('0x19')]);}_0x42eb5a[_0xf40f('0x38')]=qs[_0xf40f('0x39')](_0x3bb9c1[_0xf40f('0x30')][_0xf40f('0x39')]);_0x42eb5a[_0xf40f('0x3a')]=qs['filters'](_[_0xf40f('0x3b')](_0x3bb9c1[_0xf40f('0x30')],_0x2ea267[_0xf40f('0x31')]),_0x586fc0);if(_0x3bb9c1[_0xf40f('0x30')][_0xf40f('0x3c')]){_0x42eb5a[_0xf40f('0x3a')]=_['merge'](_0x42eb5a[_0xf40f('0x3a')],{'$or':_[_0xf40f('0x29')](_0x586fc0,function(_0x5e1542){if(_0x5e1542[_0xf40f('0x2c')]!==_0xf40f('0x3d')){var _0x4d0f00={};_0x4d0f00[_0x5e1542[_0xf40f('0x26')]]={'$like':'%'+_0x3bb9c1['query'][_0xf40f('0x3c')]+'%'};return _0x4d0f00;}})});}_0x42eb5a=_[_0xf40f('0x3e')]({},_0x42eb5a,_0x3bb9c1[_0xf40f('0x3f')]);var _0x52e425={'where':_0x42eb5a[_0xf40f('0x3a')]};return db[_0xf40f('0x2a')][_0xf40f('0x18')](_0x52e425)[_0xf40f('0x20')](function(_0x2ea1e2){_0x15bd2d[_0xf40f('0x18')]=_0x2ea1e2;if(_0x3bb9c1[_0xf40f('0x30')]['includeAll']){_0x42eb5a['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xf40f('0x40')](_0x42eb5a);})['then'](function(_0x2fb7f1){_0x15bd2d['rows']=_0x2fb7f1;return _0x15bd2d;})[_0xf40f('0x20')](respondWithFilteredResult(_0x3fbf8c,_0x42eb5a))[_0xf40f('0x41')](handleError(_0x3fbf8c,null));};exports[_0xf40f('0x42')]=function(_0x5b3aab,_0x5666b3){var _0x406f18={'raw':!![],'where':{'id':_0x5b3aab['params']['id']}},_0x2081c4={};_0x2081c4[_0xf40f('0x2e')]=_[_0xf40f('0x2f')](db['OpenchannelTransferReport']['rawAttributes']);_0x2081c4[_0xf40f('0x30')]=_[_0xf40f('0x2f')](_0x5b3aab[_0xf40f('0x30')]);_0x2081c4[_0xf40f('0x31')]=_[_0xf40f('0x32')](_0x2081c4[_0xf40f('0x2e')],_0x2081c4['query']);_0x406f18[_0xf40f('0x33')]=_[_0xf40f('0x32')](_0x2081c4[_0xf40f('0x2e')],qs[_0xf40f('0x34')](_0x5b3aab[_0xf40f('0x30')][_0xf40f('0x34')]));_0x406f18[_0xf40f('0x33')]=_0x406f18[_0xf40f('0x33')][_0xf40f('0x35')]?_0x406f18[_0xf40f('0x33')]:_0x2081c4['model'];if(_0x5b3aab[_0xf40f('0x30')]['includeAll']){_0x406f18[_0xf40f('0x43')]=[{'all':!![]}];}_0x406f18=_[_0xf40f('0x3e')]({},_0x406f18,_0x5b3aab['options']);return db[_0xf40f('0x2a')][_0xf40f('0x44')](_0x406f18)[_0xf40f('0x20')](handleEntityNotFound(_0x5666b3,null))['then'](respondWithResult(_0x5666b3,null))[_0xf40f('0x41')](handleError(_0x5666b3,null));};exports[_0xf40f('0x45')]=function(_0x46255e,_0x47fe49){return db[_0xf40f('0x2a')]['create'](_0x46255e[_0xf40f('0x46')],{})['then'](respondWithResult(_0x47fe49,0xc9))[_0xf40f('0x41')](handleError(_0x47fe49,null));};exports[_0xf40f('0x1f')]=function(_0x1d0302,_0x466eaf){if(_0x1d0302['body']['id']){delete _0x1d0302[_0xf40f('0x46')]['id'];}return db[_0xf40f('0x2a')][_0xf40f('0x44')]({'where':{'id':_0x1d0302['params']['id']}})[_0xf40f('0x20')](handleEntityNotFound(_0x466eaf,null))[_0xf40f('0x20')](saveUpdates(_0x1d0302[_0xf40f('0x46')],null))[_0xf40f('0x20')](respondWithResult(_0x466eaf,null))[_0xf40f('0x41')](handleError(_0x466eaf,null));};exports[_0xf40f('0x21')]=function(_0x50181a,_0x4877f1){return db[_0xf40f('0x2a')][_0xf40f('0x44')]({'where':{'id':_0x50181a[_0xf40f('0x47')]['id']}})['then'](handleEntityNotFound(_0x4877f1,null))[_0xf40f('0x20')](removeEntity(_0x4877f1,null))[_0xf40f('0x41')](handleError(_0x4877f1,null));};exports[_0xf40f('0x48')]=function(_0x3956e5,_0x5e64ed){return db[_0xf40f('0x2a')][_0xf40f('0x48')]()[_0xf40f('0x20')](respondWithResult(_0x5e64ed,null))['catch'](handleError(_0x5e64ed,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 8c56ad0..3859627 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 _0xfa14=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash'];(function(_0x4f9d26,_0x641341){var _0x57debc=function(_0x48f368){while(--_0x48f368){_0x4f9d26['push'](_0x4f9d26['shift']());}};_0x57debc(++_0x641341);}(_0xfa14,0x1d3));var _0x4fa1=function(_0x45d1b1,_0x328cb0){_0x45d1b1=_0x45d1b1-0x0;var _0x313c30=_0xfa14[_0x45d1b1];return _0x313c30;};'use strict';var _=require(_0x4fa1('0x0'));var util=require(_0x4fa1('0x1'));var logger=require(_0x4fa1('0x2'))(_0x4fa1('0x3'));var moment=require(_0x4fa1('0x4'));var BPromise=require(_0x4fa1('0x5'));var rp=require(_0x4fa1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4fa1('0x7'));var attributes=require(_0x4fa1('0x8'));module[_0x4fa1('0x9')]=function(_0x18f52d,_0x3e0796){return _0x18f52d['define'](_0x4fa1('0xa'),attributes,{'tableName':_0x4fa1('0xb'),'paranoid':![],'indexes':[{'name':_0x4fa1('0xc'),'fields':[_0x4fa1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8eb=['path','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x51098e,_0x4cbaaf){var _0x59f291=function(_0x47b992){while(--_0x47b992){_0x51098e['push'](_0x51098e['shift']());}};_0x59f291(++_0x4cbaaf);}(_0xb8eb,0x1ab));var _0xbb8e=function(_0x354cf5,_0x22c429){_0x354cf5=_0x354cf5-0x0;var _0x4dda1b=_0xb8eb[_0x354cf5];return _0x4dda1b;};'use strict';var _=require(_0xbb8e('0x0'));var util=require(_0xbb8e('0x1'));var logger=require(_0xbb8e('0x2'))(_0xbb8e('0x3'));var moment=require(_0xbb8e('0x4'));var BPromise=require(_0xbb8e('0x5'));var rp=require(_0xbb8e('0x6'));var fs=require('fs');var path=require(_0xbb8e('0x7'));var rimraf=require('rimraf');var config=require(_0xbb8e('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0xbb8e('0x9')]=function(_0x43b650,_0x1cd7a0){return _0x43b650[_0xbb8e('0xa')](_0xbb8e('0xb'),attributes,{'tableName':_0xbb8e('0xc'),'paranoid':![],'indexes':[{'name':_0xbb8e('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index c59ba69..b8d17af 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 _0x57b3=['then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x400fc9,_0x3f52a7){var _0x1204d1=function(_0x245e09){while(--_0x245e09){_0x400fc9['push'](_0x400fc9['shift']());}};_0x1204d1(++_0x3f52a7);}(_0x57b3,0x1ad));var _0x357b=function(_0x375893,_0x46d391){_0x375893=_0x375893-0x0;var _0x6ac68=_0x57b3[_0x375893];return _0x6ac68;};'use strict';var _=require('lodash');var util=require(_0x357b('0x0'));var moment=require(_0x357b('0x1'));var BPromise=require(_0x357b('0x2'));var rs=require(_0x357b('0x3'));var fs=require('fs');var Redis=require(_0x357b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x357b('0x5'));var logger=require(_0x357b('0x6'))(_0x357b('0x7'));var config=require(_0x357b('0x8'));var jayson=require(_0x357b('0x9'));var client=jayson['client'][_0x357b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48d284,_0x49060f,_0x1791de){return new BPromise(function(_0x46ca92,_0x688272){return client['request'](_0x48d284,_0x1791de)[_0x357b('0xb')](function(_0x170608){logger[_0x357b('0xc')](_0x357b('0xd'),_0x49060f,_0x357b('0xe'));logger[_0x357b('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x49060f,_0x357b('0xe'),JSON[_0x357b('0x10')](_0x170608));if(_0x170608[_0x357b('0x11')]){if(_0x170608[_0x357b('0x11')]['code']===0x1f4){logger[_0x357b('0x11')](_0x357b('0xd'),_0x49060f,_0x170608[_0x357b('0x11')][_0x357b('0x12')]);return _0x688272(_0x170608[_0x357b('0x11')][_0x357b('0x12')]);}logger[_0x357b('0x11')](_0x357b('0xd'),_0x49060f,_0x170608['error']['message']);return _0x46ca92(_0x170608[_0x357b('0x11')][_0x357b('0x12')]);}else{logger[_0x357b('0xc')](_0x357b('0xd'),_0x49060f,_0x357b('0xe'));_0x46ca92(_0x170608['result'][_0x357b('0x12')]);}})[_0x357b('0x13')](function(_0x27d4f8){logger['error'](_0x357b('0xd'),_0x49060f,_0x27d4f8);_0x688272(_0x27d4f8);});});} \ No newline at end of file +var _0x15a0=['rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x51dbec,_0x6d58b9){var _0x4d0532=function(_0x1bc7bb){while(--_0x1bc7bb){_0x51dbec['push'](_0x51dbec['shift']());}};_0x4d0532(++_0x6d58b9);}(_0x15a0,0x8d));var _0x015a=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0x15a0[_0x47408e];return _0x1636bc;};'use strict';var _=require(_0x015a('0x0'));var util=require('util');var moment=require(_0x015a('0x1'));var BPromise=require(_0x015a('0x2'));var rs=require(_0x015a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x015a('0x4'))['db'];var utils=require(_0x015a('0x5'));var logger=require('../../config/logger')(_0x015a('0x6'));var config=require(_0x015a('0x7'));var jayson=require(_0x015a('0x8'));var client=jayson[_0x015a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4062cf,_0x5cc03f,_0x3c83fb){return new BPromise(function(_0x50f1f3,_0x53edba){return client[_0x015a('0xa')](_0x4062cf,_0x3c83fb)[_0x015a('0xb')](function(_0x293a02){logger[_0x015a('0xc')](_0x015a('0xd'),_0x5cc03f,'request\x20sent');logger[_0x015a('0xe')](_0x015a('0xf'),_0x5cc03f,_0x015a('0x10'),JSON['stringify'](_0x293a02));if(_0x293a02[_0x015a('0x11')]){if(_0x293a02[_0x015a('0x11')][_0x015a('0x12')]===0x1f4){logger[_0x015a('0x11')](_0x015a('0xd'),_0x5cc03f,_0x293a02[_0x015a('0x11')][_0x015a('0x13')]);return _0x53edba(_0x293a02[_0x015a('0x11')]['message']);}logger[_0x015a('0x11')](_0x015a('0xd'),_0x5cc03f,_0x293a02[_0x015a('0x11')][_0x015a('0x13')]);return _0x50f1f3(_0x293a02[_0x015a('0x11')][_0x015a('0x13')]);}else{logger['info'](_0x015a('0xd'),_0x5cc03f,'request\x20sent');_0x50f1f3(_0x293a02['result'][_0x015a('0x13')]);}})[_0x015a('0x14')](function(_0x211e6a){logger[_0x015a('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5cc03f,_0x211e6a);_0x53edba(_0x211e6a);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index b877f7c..b2c4e7a 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 _0x2cba=['post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show'];(function(_0x470c92,_0x104210){var _0x16c0ae=function(_0x4006b4){while(--_0x4006b4){_0x470c92['push'](_0x470c92['shift']());}};_0x16c0ae(++_0x104210);}(_0x2cba,0x1bf));var _0xa2cb=function(_0x1e2f99,_0x42ca89){_0x1e2f99=_0x1e2f99-0x0;var _0xaaf02d=_0x2cba[_0x1e2f99];return _0xaaf02d;};'use strict';var multer=require(_0xa2cb('0x0'));var util=require('util');var path=require(_0xa2cb('0x1'));var timeout=require(_0xa2cb('0x2'));var express=require(_0xa2cb('0x3'));var router=express[_0xa2cb('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa2cb('0x5'));var controller=require(_0xa2cb('0x6'));router[_0xa2cb('0x7')]('/',auth[_0xa2cb('0x8')](),controller[_0xa2cb('0x9')]);router[_0xa2cb('0x7')](_0xa2cb('0xa'),auth[_0xa2cb('0x8')](),controller[_0xa2cb('0xb')]);router[_0xa2cb('0xc')]('/',auth[_0xa2cb('0x8')](),controller['create']);router[_0xa2cb('0xd')](_0xa2cb('0xa'),auth[_0xa2cb('0x8')](),controller[_0xa2cb('0xe')]);router[_0xa2cb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa2cb('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0634=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x433152,_0x1d1c08){var _0x5691fc=function(_0x34bbb5){while(--_0x34bbb5){_0x433152['push'](_0x433152['shift']());}};_0x5691fc(++_0x1d1c08);}(_0x0634,0x1c2));var _0x4063=function(_0x26cab7,_0x1ccfca){_0x26cab7=_0x26cab7-0x0;var _0x31ba06=_0x0634[_0x26cab7];return _0x31ba06;};'use strict';var multer=require('multer');var util=require(_0x4063('0x0'));var path=require(_0x4063('0x1'));var timeout=require(_0x4063('0x2'));var express=require(_0x4063('0x3'));var router=express[_0x4063('0x4')]();var auth=require(_0x4063('0x5'));var interaction=require(_0x4063('0x6'));var config=require(_0x4063('0x7'));var controller=require('./pause.controller');router[_0x4063('0x8')]('/',auth[_0x4063('0x9')](),controller['index']);router[_0x4063('0x8')](_0x4063('0xa'),auth[_0x4063('0x9')](),controller[_0x4063('0xb')]);router[_0x4063('0xc')]('/',auth[_0x4063('0x9')](),controller[_0x4063('0xd')]);router[_0x4063('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4063('0xf')]);router[_0x4063('0x10')](_0x4063('0xa'),auth[_0x4063('0x9')](),controller[_0x4063('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 64c7388..bd72c87 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 _0x520b=['STRING','sequelize','exports','name'];(function(_0x99cd0c,_0x2a778f){var _0x18f2e5=function(_0x53b2ae){while(--_0x53b2ae){_0x99cd0c['push'](_0x99cd0c['shift']());}};_0x18f2e5(++_0x2a778f);}(_0x520b,0x1d9));var _0xb520=function(_0x1635fe,_0x5f1d9f){_0x1635fe=_0x1635fe-0x0;var _0x3c512a=_0x520b[_0x1635fe];return _0x3c512a;};'use strict';var Sequelize=require(_0xb520('0x0'));module[_0xb520('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb520('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb520('0x3')]}}; \ No newline at end of file +var _0xea6b=['exports','STRING'];(function(_0x408a63,_0x4cc182){var _0x27c11a=function(_0x42eaac){while(--_0x42eaac){_0x408a63['push'](_0x408a63['shift']());}};_0x27c11a(++_0x4cc182);}(_0xea6b,0x1de));var _0xbea6=function(_0x5a5414,_0x37546e){_0x5a5414=_0x5a5414-0x0;var _0x16086f=_0xea6b[_0x5a5414];return _0x16086f;};'use strict';var Sequelize=require('sequelize');module[_0xbea6('0x0')]={'name':{'type':Sequelize[_0xbea6('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xbea6('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 08c468f..b0bd56a 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 _0x4fd0=['get','Pauses','UserProfileResource','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy'];(function(_0x337d97,_0x19c381){var _0x53aa89=function(_0x1ee5eb){while(--_0x1ee5eb){_0x337d97['push'](_0x337d97['shift']());}};_0x53aa89(++_0x19c381);}(_0x4fd0,0x176));var _0x04fd=function(_0x403fc7,_0x32931a){_0x403fc7=_0x403fc7-0x0;var _0x5d0827=_0x4fd0[_0x403fc7];return _0x5d0827;};'use strict';var pdf=require(_0x04fd('0x0'));var emlformat=require(_0x04fd('0x1'));var rimraf=require(_0x04fd('0x2'));var zipdir=require(_0x04fd('0x3'));var jsonpatch=require(_0x04fd('0x4'));var rp=require('request-promise');var moment=require(_0x04fd('0x5'));var BPromise=require(_0x04fd('0x6'));var Mustache=require(_0x04fd('0x7'));var util=require(_0x04fd('0x8'));var path=require('path');var sox=require(_0x04fd('0x9'));var csv=require(_0x04fd('0xa'));var ejs=require(_0x04fd('0xb'));var fs=require('fs');var _=require(_0x04fd('0xc'));var squel=require(_0x04fd('0xd'));var crypto=require(_0x04fd('0xe'));var jsforce=require(_0x04fd('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x04fd('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04fd('0x11'));var hardwareService=require(_0x04fd('0x12'));var logger=require(_0x04fd('0x13'))(_0x04fd('0x14'));var utils=require('../../config/utils');var config=require(_0x04fd('0x15'));var licenseUtil=require(_0x04fd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a7e0b,_0x1435e6){_0x1435e6=_0x1435e6||0xcc;return function(_0x5477ab){if(_0x5477ab){return _0x4a7e0b[_0x04fd('0x17')](_0x1435e6);}return _0x4a7e0b[_0x04fd('0x18')](_0x1435e6)[_0x04fd('0x19')]();};}function respondWithResult(_0x379927,_0x103434){_0x103434=_0x103434||0xc8;return function(_0x54e200){if(_0x54e200){return _0x379927['status'](_0x103434)[_0x04fd('0x1a')](_0x54e200);}};}function respondWithFilteredResult(_0x2e9471,_0x4ed8d8){return function(_0x2d4617){if(_0x2d4617){var _0x1f0f0a=_0x2d4617[_0x04fd('0x1b')],_0x2dc7c5=_0x4ed8d8[_0x04fd('0x1c')],_0x152ac6=_0x4ed8d8['offset']+_0x4ed8d8['limit'],_0x3464e5;if(_0x152ac6>=_0x1f0f0a){_0x152ac6=_0x1f0f0a;_0x3464e5=0xc8;}else{_0x3464e5=0xce;}_0x2e9471[_0x04fd('0x18')](_0x3464e5);return _0x2e9471[_0x04fd('0x1d')]('Content-Range',_0x2dc7c5+'-'+_0x152ac6+'/'+_0x1f0f0a)[_0x04fd('0x1a')](_0x2d4617);}return null;};}function patchUpdates(_0x29c6e8){return function(_0x2b29cb){try{jsonpatch[_0x04fd('0x1e')](_0x2b29cb,_0x29c6e8,!![]);}catch(_0x1d0b9c){return BPromise[_0x04fd('0x1f')](_0x1d0b9c);}return _0x2b29cb[_0x04fd('0x20')]();};}function saveUpdates(_0x1c29e1,_0x534205){return function(_0x30bff2){if(_0x30bff2){return _0x30bff2[_0x04fd('0x21')](_0x1c29e1)[_0x04fd('0x22')](function(_0x1797ec){return _0x1797ec;});}return null;};}function removeEntity(_0xca73e,_0x5d053d){return function(_0x40c75e){if(_0x40c75e){return _0x40c75e[_0x04fd('0x23')]()['then'](function(){var _0x172cf7=_0x40c75e[_0x04fd('0x24')]({'plain':!![]});var _0x2a0423=_0x04fd('0x25');return db[_0x04fd('0x26')][_0x04fd('0x23')]({'where':{'type':_0x2a0423,'resourceId':_0x172cf7['id']}})[_0x04fd('0x22')](function(){return _0x40c75e;});})[_0x04fd('0x22')](function(){_0xca73e[_0x04fd('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x111879,_0x4001f9){return function(_0x387e4a){if(!_0x387e4a){_0x111879[_0x04fd('0x17')](0x194);}return _0x387e4a;};}function handleError(_0x28a9b1,_0x4489eb){_0x4489eb=_0x4489eb||0x1f4;return function(_0x3ab9ca){logger['error'](_0x3ab9ca['stack']);if(_0x3ab9ca[_0x04fd('0x27')]){delete _0x3ab9ca[_0x04fd('0x27')];}_0x28a9b1[_0x04fd('0x18')](_0x4489eb)[_0x04fd('0x28')](_0x3ab9ca);};}exports[_0x04fd('0x29')]=function(_0xc993bd,_0x595793){var _0x575eeb={},_0x37eec4={},_0x35ad15={'count':0x0,'rows':[]};var _0x323a99=_[_0x04fd('0x2a')](db[_0x04fd('0x2b')][_0x04fd('0x2c')],function(_0xfcacbc){return{'name':_0xfcacbc[_0x04fd('0x2d')],'type':_0xfcacbc[_0x04fd('0x2e')][_0x04fd('0x2f')]};});_0x37eec4[_0x04fd('0x30')]=_[_0x04fd('0x2a')](_0x323a99,'name');_0x37eec4['query']=_[_0x04fd('0x31')](_0xc993bd[_0x04fd('0x32')]);_0x37eec4['filters']=_['intersection'](_0x37eec4[_0x04fd('0x30')],_0x37eec4[_0x04fd('0x32')]);_0x575eeb['attributes']=_[_0x04fd('0x33')](_0x37eec4[_0x04fd('0x30')],qs[_0x04fd('0x34')](_0xc993bd[_0x04fd('0x32')][_0x04fd('0x34')]));_0x575eeb[_0x04fd('0x35')]=_0x575eeb[_0x04fd('0x35')][_0x04fd('0x36')]?_0x575eeb[_0x04fd('0x35')]:_0x37eec4[_0x04fd('0x30')];if(!_0xc993bd[_0x04fd('0x32')][_0x04fd('0x37')]('nolimit')){_0x575eeb[_0x04fd('0x38')]=qs[_0x04fd('0x38')](_0xc993bd['query']['limit']);_0x575eeb[_0x04fd('0x1c')]=qs[_0x04fd('0x1c')](_0xc993bd[_0x04fd('0x32')][_0x04fd('0x1c')]);}_0x575eeb[_0x04fd('0x39')]=qs[_0x04fd('0x3a')](_0xc993bd[_0x04fd('0x32')][_0x04fd('0x3a')]);_0x575eeb[_0x04fd('0x3b')]=qs[_0x04fd('0x3c')](_[_0x04fd('0x3d')](_0xc993bd['query'],_0x37eec4['filters']),_0x323a99);if(_0xc993bd[_0x04fd('0x32')][_0x04fd('0x3e')]){_0x575eeb[_0x04fd('0x3b')]=_[_0x04fd('0x3f')](_0x575eeb[_0x04fd('0x3b')],{'$or':_[_0x04fd('0x2a')](_0x323a99,function(_0x5926f4){if(_0x5926f4[_0x04fd('0x2e')]!==_0x04fd('0x40')){var _0x52e427={};_0x52e427[_0x5926f4[_0x04fd('0x27')]]={'$like':'%'+_0xc993bd[_0x04fd('0x32')][_0x04fd('0x3e')]+'%'};return _0x52e427;}})});}_0x575eeb=_[_0x04fd('0x3f')]({},_0x575eeb,_0xc993bd[_0x04fd('0x41')]);var _0x280972={'where':_0x575eeb[_0x04fd('0x3b')]};return db[_0x04fd('0x2b')][_0x04fd('0x1b')](_0x280972)[_0x04fd('0x22')](function(_0x205dde){_0x35ad15['count']=_0x205dde;if(_0xc993bd[_0x04fd('0x32')]['includeAll']){_0x575eeb['include']=[{'all':!![]}];}return db[_0x04fd('0x2b')][_0x04fd('0x42')](_0x575eeb);})[_0x04fd('0x22')](function(_0x4ed622){_0x35ad15[_0x04fd('0x43')]=_0x4ed622;return _0x35ad15;})[_0x04fd('0x22')](respondWithFilteredResult(_0x595793,_0x575eeb))[_0x04fd('0x44')](handleError(_0x595793,null));};exports['show']=function(_0x4b6e22,_0x5ea7ca){var _0x10a659={'raw':!![],'where':{'id':_0x4b6e22[_0x04fd('0x45')]['id']}},_0x4a4b26={};_0x4a4b26['model']=_[_0x04fd('0x31')](db[_0x04fd('0x2b')][_0x04fd('0x2c')]);_0x4a4b26['query']=_[_0x04fd('0x31')](_0x4b6e22[_0x04fd('0x32')]);_0x4a4b26[_0x04fd('0x3c')]=_[_0x04fd('0x33')](_0x4a4b26[_0x04fd('0x30')],_0x4a4b26[_0x04fd('0x32')]);_0x10a659[_0x04fd('0x35')]=_['intersection'](_0x4a4b26[_0x04fd('0x30')],qs[_0x04fd('0x34')](_0x4b6e22['query'][_0x04fd('0x34')]));_0x10a659[_0x04fd('0x35')]=_0x10a659[_0x04fd('0x35')]['length']?_0x10a659[_0x04fd('0x35')]:_0x4a4b26['model'];if(_0x4b6e22[_0x04fd('0x32')]['includeAll']){_0x10a659[_0x04fd('0x46')]=[{'all':!![]}];}_0x10a659=_[_0x04fd('0x3f')]({},_0x10a659,_0x4b6e22['options']);return db[_0x04fd('0x2b')][_0x04fd('0x47')](_0x10a659)['then'](handleEntityNotFound(_0x5ea7ca,null))['then'](respondWithResult(_0x5ea7ca,null))[_0x04fd('0x44')](handleError(_0x5ea7ca,null));};exports['create']=function(_0x386786,_0x5812da){return db[_0x04fd('0x2b')]['create'](_0x386786[_0x04fd('0x48')],{})[_0x04fd('0x22')](function(_0x2ef86b){var _0xc78269=_0x386786[_0x04fd('0x49')][_0x04fd('0x24')]({'plain':!![]});if(!_0xc78269)throw new Error(_0x04fd('0x4a'));if(_0xc78269[_0x04fd('0x4b')]===_0x04fd('0x49')){var _0x13e3b1=_0x2ef86b[_0x04fd('0x24')]({'plain':!![]});var _0x59ce50=_0x04fd('0x25');return db[_0x04fd('0x4c')][_0x04fd('0x47')]({'where':{'name':_0x59ce50,'userProfileId':_0xc78269[_0x04fd('0x4d')]},'raw':!![]})[_0x04fd('0x22')](function(_0x466244){if(_0x466244&&_0x466244[_0x04fd('0x4e')]===0x0){return db[_0x04fd('0x26')][_0x04fd('0x4f')]({'name':_0x13e3b1[_0x04fd('0x27')],'resourceId':_0x13e3b1['id'],'type':_0x466244[_0x04fd('0x27')],'sectionId':_0x466244['id']},{})[_0x04fd('0x22')](function(){return _0x2ef86b;});}else{return _0x2ef86b;}})[_0x04fd('0x44')](function(_0x555346){logger[_0x04fd('0x50')](_0x04fd('0x51'),_0x555346);throw _0x555346;});}return _0x2ef86b;})[_0x04fd('0x22')](respondWithResult(_0x5812da,0xc9))[_0x04fd('0x44')](handleError(_0x5812da,null));};exports[_0x04fd('0x21')]=function(_0x4a566f,_0x2c9cd9){if(_0x4a566f[_0x04fd('0x48')]['id']){delete _0x4a566f['body']['id'];}return db['Pause'][_0x04fd('0x47')]({'where':{'id':_0x4a566f[_0x04fd('0x45')]['id']}})[_0x04fd('0x22')](handleEntityNotFound(_0x2c9cd9,null))['then'](saveUpdates(_0x4a566f[_0x04fd('0x48')],null))['then'](respondWithResult(_0x2c9cd9,null))[_0x04fd('0x44')](handleError(_0x2c9cd9,null));};exports[_0x04fd('0x23')]=function(_0x3918d5,_0x495ae1){return db[_0x04fd('0x2b')]['find']({'where':{'id':_0x3918d5[_0x04fd('0x45')]['id']}})['then'](handleEntityNotFound(_0x495ae1,null))[_0x04fd('0x22')](removeEntity(_0x495ae1,null))['catch'](handleError(_0x495ae1,null));}; \ No newline at end of file +var _0x7259=['VIRTUAL','options','includeAll','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','error','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','update','then','get','Pauses','destroy','stack','name','index','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7259,0xee));var _0x9725=function(_0x996362,_0x4d80a9){_0x996362=_0x996362-0x0;var _0x3adba0=_0x7259[_0x996362];return _0x3adba0;};'use strict';var pdf=require(_0x9725('0x0'));var emlformat=require(_0x9725('0x1'));var rimraf=require(_0x9725('0x2'));var zipdir=require(_0x9725('0x3'));var jsonpatch=require(_0x9725('0x4'));var rp=require(_0x9725('0x5'));var moment=require('moment');var BPromise=require(_0x9725('0x6'));var Mustache=require(_0x9725('0x7'));var util=require(_0x9725('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x9725('0x9'));var ejs=require(_0x9725('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9725('0xb'));var crypto=require('crypto');var jsforce=require(_0x9725('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9725('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9725('0xe'));var qs=require(_0x9725('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9725('0x10'));var logger=require(_0x9725('0x11'))('api');var utils=require(_0x9725('0x12'));var config=require(_0x9725('0x13'));var licenseUtil=require(_0x9725('0x14'));var db=require(_0x9725('0x15'))['db'];function respondWithStatusCode(_0x166fae,_0x4fa154){_0x4fa154=_0x4fa154||0xcc;return function(_0x46c64e){if(_0x46c64e){return _0x166fae[_0x9725('0x16')](_0x4fa154);}return _0x166fae[_0x9725('0x17')](_0x4fa154)['end']();};}function respondWithResult(_0x282941,_0x4c077d){_0x4c077d=_0x4c077d||0xc8;return function(_0x20c9d3){if(_0x20c9d3){return _0x282941[_0x9725('0x17')](_0x4c077d)[_0x9725('0x18')](_0x20c9d3);}};}function respondWithFilteredResult(_0x518df6,_0x23ee30){return function(_0x45724b){if(_0x45724b){var _0x5dde90=_0x45724b[_0x9725('0x19')],_0x1198b2=_0x23ee30[_0x9725('0x1a')],_0x2d9c25=_0x23ee30[_0x9725('0x1a')]+_0x23ee30[_0x9725('0x1b')],_0x418615;if(_0x2d9c25>=_0x5dde90){_0x2d9c25=_0x5dde90;_0x418615=0xc8;}else{_0x418615=0xce;}_0x518df6[_0x9725('0x17')](_0x418615);return _0x518df6['set']('Content-Range',_0x1198b2+'-'+_0x2d9c25+'/'+_0x5dde90)[_0x9725('0x18')](_0x45724b);}return null;};}function patchUpdates(_0x1bcd6f){return function(_0x42d03b){try{jsonpatch[_0x9725('0x1c')](_0x42d03b,_0x1bcd6f,!![]);}catch(_0x15f43d){return BPromise['reject'](_0x15f43d);}return _0x42d03b['save']();};}function saveUpdates(_0x18c8ac,_0x222a8b){return function(_0x5e0a2a){if(_0x5e0a2a){return _0x5e0a2a[_0x9725('0x1d')](_0x18c8ac)[_0x9725('0x1e')](function(_0xc8e6c6){return _0xc8e6c6;});}return null;};}function removeEntity(_0x4c79f3,_0x1e7410){return function(_0x56234d){if(_0x56234d){return _0x56234d['destroy']()['then'](function(){var _0x4f656e=_0x56234d[_0x9725('0x1f')]({'plain':!![]});var _0x588032=_0x9725('0x20');return db['UserProfileResource'][_0x9725('0x21')]({'where':{'type':_0x588032,'resourceId':_0x4f656e['id']}})[_0x9725('0x1e')](function(){return _0x56234d;});})[_0x9725('0x1e')](function(){_0x4c79f3[_0x9725('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x92ced2,_0x16090e){return function(_0x3d5d61){if(!_0x3d5d61){_0x92ced2[_0x9725('0x16')](0x194);}return _0x3d5d61;};}function handleError(_0x52a389,_0x13f9eb){_0x13f9eb=_0x13f9eb||0x1f4;return function(_0x1db562){logger['error'](_0x1db562[_0x9725('0x22')]);if(_0x1db562[_0x9725('0x23')]){delete _0x1db562[_0x9725('0x23')];}_0x52a389['status'](_0x13f9eb)['send'](_0x1db562);};}exports[_0x9725('0x24')]=function(_0x5c2a3d,_0x5e3f5c){var _0x16bac9={},_0x4707fd={},_0x385ab0={'count':0x0,'rows':[]};var _0x37c94a=_[_0x9725('0x25')](db[_0x9725('0x26')][_0x9725('0x27')],function(_0x417623){return{'name':_0x417623[_0x9725('0x28')],'type':_0x417623[_0x9725('0x29')][_0x9725('0x2a')]};});_0x4707fd['model']=_[_0x9725('0x25')](_0x37c94a,_0x9725('0x23'));_0x4707fd[_0x9725('0x2b')]=_[_0x9725('0x2c')](_0x5c2a3d[_0x9725('0x2b')]);_0x4707fd[_0x9725('0x2d')]=_[_0x9725('0x2e')](_0x4707fd['model'],_0x4707fd[_0x9725('0x2b')]);_0x16bac9[_0x9725('0x2f')]=_[_0x9725('0x2e')](_0x4707fd[_0x9725('0x30')],qs['fields'](_0x5c2a3d[_0x9725('0x2b')][_0x9725('0x31')]));_0x16bac9['attributes']=_0x16bac9[_0x9725('0x2f')][_0x9725('0x32')]?_0x16bac9[_0x9725('0x2f')]:_0x4707fd[_0x9725('0x30')];if(!_0x5c2a3d[_0x9725('0x2b')][_0x9725('0x33')](_0x9725('0x34'))){_0x16bac9[_0x9725('0x1b')]=qs[_0x9725('0x1b')](_0x5c2a3d[_0x9725('0x2b')][_0x9725('0x1b')]);_0x16bac9[_0x9725('0x1a')]=qs[_0x9725('0x1a')](_0x5c2a3d[_0x9725('0x2b')][_0x9725('0x1a')]);}_0x16bac9[_0x9725('0x35')]=qs['sort'](_0x5c2a3d[_0x9725('0x2b')][_0x9725('0x36')]);_0x16bac9[_0x9725('0x37')]=qs[_0x9725('0x2d')](_['pick'](_0x5c2a3d[_0x9725('0x2b')],_0x4707fd[_0x9725('0x2d')]),_0x37c94a);if(_0x5c2a3d[_0x9725('0x2b')][_0x9725('0x38')]){_0x16bac9[_0x9725('0x37')]=_[_0x9725('0x39')](_0x16bac9[_0x9725('0x37')],{'$or':_[_0x9725('0x25')](_0x37c94a,function(_0x456346){if(_0x456346[_0x9725('0x29')]!==_0x9725('0x3a')){var _0x82bb2e={};_0x82bb2e[_0x456346[_0x9725('0x23')]]={'$like':'%'+_0x5c2a3d[_0x9725('0x2b')][_0x9725('0x38')]+'%'};return _0x82bb2e;}})});}_0x16bac9=_[_0x9725('0x39')]({},_0x16bac9,_0x5c2a3d[_0x9725('0x3b')]);var _0x5960b1={'where':_0x16bac9['where']};return db[_0x9725('0x26')][_0x9725('0x19')](_0x5960b1)[_0x9725('0x1e')](function(_0x1e4333){_0x385ab0[_0x9725('0x19')]=_0x1e4333;if(_0x5c2a3d[_0x9725('0x2b')][_0x9725('0x3c')]){_0x16bac9['include']=[{'all':!![]}];}return db[_0x9725('0x26')][_0x9725('0x3d')](_0x16bac9);})[_0x9725('0x1e')](function(_0x24500b){_0x385ab0['rows']=_0x24500b;return _0x385ab0;})[_0x9725('0x1e')](respondWithFilteredResult(_0x5e3f5c,_0x16bac9))[_0x9725('0x3e')](handleError(_0x5e3f5c,null));};exports[_0x9725('0x3f')]=function(_0x40e668,_0x50fb99){var _0x17611c={'raw':!![],'where':{'id':_0x40e668[_0x9725('0x40')]['id']}},_0x42864b={};_0x42864b[_0x9725('0x30')]=_['keys'](db[_0x9725('0x26')][_0x9725('0x27')]);_0x42864b[_0x9725('0x2b')]=_['keys'](_0x40e668[_0x9725('0x2b')]);_0x42864b[_0x9725('0x2d')]=_[_0x9725('0x2e')](_0x42864b[_0x9725('0x30')],_0x42864b[_0x9725('0x2b')]);_0x17611c[_0x9725('0x2f')]=_['intersection'](_0x42864b[_0x9725('0x30')],qs[_0x9725('0x31')](_0x40e668['query'][_0x9725('0x31')]));_0x17611c[_0x9725('0x2f')]=_0x17611c[_0x9725('0x2f')][_0x9725('0x32')]?_0x17611c[_0x9725('0x2f')]:_0x42864b[_0x9725('0x30')];if(_0x40e668[_0x9725('0x2b')][_0x9725('0x3c')]){_0x17611c['include']=[{'all':!![]}];}_0x17611c=_[_0x9725('0x39')]({},_0x17611c,_0x40e668[_0x9725('0x3b')]);return db[_0x9725('0x26')][_0x9725('0x41')](_0x17611c)[_0x9725('0x1e')](handleEntityNotFound(_0x50fb99,null))[_0x9725('0x1e')](respondWithResult(_0x50fb99,null))[_0x9725('0x3e')](handleError(_0x50fb99,null));};exports[_0x9725('0x42')]=function(_0x195efd,_0x25eddb){return db['Pause'][_0x9725('0x42')](_0x195efd[_0x9725('0x43')],{})[_0x9725('0x1e')](function(_0x13c960){var _0x1dcc22=_0x195efd[_0x9725('0x44')]['get']({'plain':!![]});if(!_0x1dcc22)throw new Error(_0x9725('0x45'));if(_0x1dcc22[_0x9725('0x46')]===_0x9725('0x44')){var _0x10fa87=_0x13c960[_0x9725('0x1f')]({'plain':!![]});var _0x1a9417='Pauses';return db[_0x9725('0x47')][_0x9725('0x41')]({'where':{'name':_0x1a9417,'userProfileId':_0x1dcc22['userProfileId']},'raw':!![]})[_0x9725('0x1e')](function(_0x35b2c6){if(_0x35b2c6&&_0x35b2c6['autoAssociation']===0x0){return db[_0x9725('0x48')][_0x9725('0x42')]({'name':_0x10fa87['name'],'resourceId':_0x10fa87['id'],'type':_0x35b2c6[_0x9725('0x23')],'sectionId':_0x35b2c6['id']},{})[_0x9725('0x1e')](function(){return _0x13c960;});}else{return _0x13c960;}})[_0x9725('0x3e')](function(_0x994b37){logger[_0x9725('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x994b37);throw _0x994b37;});}return _0x13c960;})[_0x9725('0x1e')](respondWithResult(_0x25eddb,0xc9))[_0x9725('0x3e')](handleError(_0x25eddb,null));};exports['update']=function(_0xcac3aa,_0x629cf4){if(_0xcac3aa[_0x9725('0x43')]['id']){delete _0xcac3aa[_0x9725('0x43')]['id'];}return db[_0x9725('0x26')][_0x9725('0x41')]({'where':{'id':_0xcac3aa['params']['id']}})[_0x9725('0x1e')](handleEntityNotFound(_0x629cf4,null))['then'](saveUpdates(_0xcac3aa[_0x9725('0x43')],null))[_0x9725('0x1e')](respondWithResult(_0x629cf4,null))[_0x9725('0x3e')](handleError(_0x629cf4,null));};exports[_0x9725('0x21')]=function(_0x46ae42,_0x1ee205){return db[_0x9725('0x26')][_0x9725('0x41')]({'where':{'id':_0x46ae42[_0x9725('0x40')]['id']}})['then'](handleEntityNotFound(_0x1ee205,null))['then'](removeEntity(_0x1ee205,null))[_0x9725('0x3e')](handleError(_0x1ee205,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index df6edb4..9f7a1d7 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 _0x199d=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./pause.attributes','Pause','tools_pauses','lodash','util'];(function(_0x397da6,_0x444b8d){var _0x604023=function(_0x27d65e){while(--_0x27d65e){_0x397da6['push'](_0x397da6['shift']());}};_0x604023(++_0x444b8d);}(_0x199d,0x13d));var _0xd199=function(_0xf34895,_0x21fb70){_0xf34895=_0xf34895-0x0;var _0x143f44=_0x199d[_0xf34895];return _0x143f44;};'use strict';var _=require(_0xd199('0x0'));var util=require(_0xd199('0x1'));var logger=require(_0xd199('0x2'))(_0xd199('0x3'));var moment=require(_0xd199('0x4'));var BPromise=require('bluebird');var rp=require(_0xd199('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd199('0x6'));var config=require(_0xd199('0x7'));var attributes=require(_0xd199('0x8'));module['exports']=function(_0x44dc53,_0x16825f){return _0x44dc53['define'](_0xd199('0x9'),attributes,{'tableName':_0xd199('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3445=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./pause.attributes','exports','lodash'];(function(_0x5c128b,_0x34b078){var _0x36fe44=function(_0x373879){while(--_0x373879){_0x5c128b['push'](_0x5c128b['shift']());}};_0x36fe44(++_0x34b078);}(_0x3445,0x1b7));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var logger=require(_0x5344('0x2'))(_0x5344('0x3'));var moment=require(_0x5344('0x4'));var BPromise=require(_0x5344('0x5'));var rp=require(_0x5344('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5344('0x7'));var attributes=require(_0x5344('0x8'));module[_0x5344('0x9')]=function(_0x1f654a,_0x5c1b4e){return _0x1f654a['define']('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 44ca8e7..4bd8eaa 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 _0xeadc=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','Pause,\x20%s,\x20%s','message','result','catch','ShowPause','Pause','raw','options','where','attributes','include','map','model','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1c7e8a,_0x44bda3){var _0x396a48=function(_0xc8de){while(--_0xc8de){_0x1c7e8a['push'](_0x1c7e8a['shift']());}};_0x396a48(++_0x44bda3);}(_0xeadc,0xdf));var _0xcead=function(_0x3ffb61,_0x1969e0){_0x3ffb61=_0x3ffb61-0x0;var _0x1fca08=_0xeadc[_0x3ffb61];return _0x1fca08;};'use strict';var _=require(_0xcead('0x0'));var util=require('util');var moment=require(_0xcead('0x1'));var BPromise=require('bluebird');var rs=require(_0xcead('0x2'));var fs=require('fs');var Redis=require(_0xcead('0x3'));var db=require(_0xcead('0x4'))['db'];var utils=require(_0xcead('0x5'));var logger=require(_0xcead('0x6'))(_0xcead('0x7'));var config=require(_0xcead('0x8'));var jayson=require(_0xcead('0x9'));var client=jayson[_0xcead('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26a4f5,_0x236ab2,_0x617299){return new BPromise(function(_0x45f9cd,_0x4873cc){return client[_0xcead('0xb')](_0x26a4f5,_0x617299)[_0xcead('0xc')](function(_0x3bc4e0){logger[_0xcead('0xd')]('Pause,\x20%s,\x20%s',_0x236ab2,_0xcead('0xe'));logger['debug'](_0xcead('0xf'),_0x236ab2,_0xcead('0xe'),JSON[_0xcead('0x10')](_0x3bc4e0));if(_0x3bc4e0['error']){if(_0x3bc4e0[_0xcead('0x11')][_0xcead('0x12')]===0x1f4){logger[_0xcead('0x11')](_0xcead('0x13'),_0x236ab2,_0x3bc4e0[_0xcead('0x11')][_0xcead('0x14')]);return _0x4873cc(_0x3bc4e0['error'][_0xcead('0x14')]);}logger[_0xcead('0x11')](_0xcead('0x13'),_0x236ab2,_0x3bc4e0['error']['message']);return _0x45f9cd(_0x3bc4e0['error'][_0xcead('0x14')]);}else{logger[_0xcead('0xd')](_0xcead('0x13'),_0x236ab2,'request\x20sent');_0x45f9cd(_0x3bc4e0[_0xcead('0x15')][_0xcead('0x14')]);}})[_0xcead('0x16')](function(_0x32d3c4){logger[_0xcead('0x11')](_0xcead('0x13'),_0x236ab2,_0x32d3c4);_0x4873cc(_0x32d3c4);});});}exports[_0xcead('0x17')]=function(_0x241635){var _0x43cab6=this;return new Promise(function(_0x5d55ef,_0x47570e){return db[_0xcead('0x18')]['find']({'raw':_0x241635['options']?_0x241635['options'][_0xcead('0x19')]===undefined?!![]:![]:!![],'where':_0x241635['options']?_0x241635[_0xcead('0x1a')][_0xcead('0x1b')]||null:null,'attributes':_0x241635[_0xcead('0x1a')]?_0x241635[_0xcead('0x1a')][_0xcead('0x1c')]||null:null,'include':_0x241635[_0xcead('0x1a')]?_0x241635[_0xcead('0x1a')][_0xcead('0x1d')]?_[_0xcead('0x1e')](_0x241635['options'][_0xcead('0x1d')],function(_0x5d1242){return{'model':db[_0x5d1242[_0xcead('0x1f')]],'as':_0x5d1242['as'],'attributes':_0x5d1242['attributes'],'include':_0x5d1242['include']?_['map'](_0x5d1242[_0xcead('0x1d')],function(_0x193eee){return{'model':db[_0x193eee[_0xcead('0x1f')]],'as':_0x193eee['as'],'attributes':_0x193eee[_0xcead('0x1c')],'include':_0x193eee[_0xcead('0x1d')]?_['map'](_0x193eee[_0xcead('0x1d')],function(_0x2318bf){return{'model':db[_0x2318bf['model']],'as':_0x2318bf['as'],'attributes':_0x2318bf[_0xcead('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcead('0xc')](function(_0x381a58){logger[_0xcead('0xd')]('ShowPause',_0x241635);logger[_0xcead('0x20')](_0xcead('0x17'),_0x241635,JSON['stringify'](_0x381a58));_0x5d55ef(_0x381a58);})[_0xcead('0x16')](function(_0x2e6f74){logger[_0xcead('0x11')](_0xcead('0x17'),_0x2e6f74[_0xcead('0x14')],_0x241635);_0x47570e(_0x43cab6[_0xcead('0x11')](0x1f4,_0x2e6f74[_0xcead('0x14')]));});});}; \ No newline at end of file +var _0x2090=['message','result','ShowPause','Pause','find','options','raw','where','attributes','include','map','model','then','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x6e4e76,_0x464712){var _0x2c18af=function(_0x2681d3){while(--_0x2681d3){_0x6e4e76['push'](_0x6e4e76['shift']());}};_0x2c18af(++_0x464712);}(_0x2090,0xae));var _0x0209=function(_0x206afe,_0x40d7c1){_0x206afe=_0x206afe-0x0;var _0x4cb63f=_0x2090[_0x206afe];return _0x4cb63f;};'use strict';var _=require('lodash');var util=require(_0x0209('0x0'));var moment=require(_0x0209('0x1'));var BPromise=require('bluebird');var rs=require(_0x0209('0x2'));var fs=require('fs');var Redis=require(_0x0209('0x3'));var db=require(_0x0209('0x4'))['db'];var utils=require(_0x0209('0x5'));var logger=require(_0x0209('0x6'))('rpc');var config=require(_0x0209('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0209('0x8')][_0x0209('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48e0f2,_0x1dccbd,_0x5706e9){return new BPromise(function(_0x3d0c98,_0x19ba02){return client[_0x0209('0xa')](_0x48e0f2,_0x5706e9)['then'](function(_0x41484b){logger[_0x0209('0xb')](_0x0209('0xc'),_0x1dccbd,_0x0209('0xd'));logger[_0x0209('0xe')](_0x0209('0xf'),_0x1dccbd,'request\x20sent',JSON[_0x0209('0x10')](_0x41484b));if(_0x41484b['error']){if(_0x41484b[_0x0209('0x11')]['code']===0x1f4){logger[_0x0209('0x11')](_0x0209('0xc'),_0x1dccbd,_0x41484b[_0x0209('0x11')][_0x0209('0x12')]);return _0x19ba02(_0x41484b['error']['message']);}logger[_0x0209('0x11')](_0x0209('0xc'),_0x1dccbd,_0x41484b['error'][_0x0209('0x12')]);return _0x3d0c98(_0x41484b[_0x0209('0x11')][_0x0209('0x12')]);}else{logger[_0x0209('0xb')](_0x0209('0xc'),_0x1dccbd,_0x0209('0xd'));_0x3d0c98(_0x41484b[_0x0209('0x13')][_0x0209('0x12')]);}})['catch'](function(_0x192c24){logger[_0x0209('0x11')](_0x0209('0xc'),_0x1dccbd,_0x192c24);_0x19ba02(_0x192c24);});});}exports[_0x0209('0x14')]=function(_0x51aae3){var _0x2921f5=this;return new Promise(function(_0xbacdce,_0x2fbd62){return db[_0x0209('0x15')][_0x0209('0x16')]({'raw':_0x51aae3[_0x0209('0x17')]?_0x51aae3[_0x0209('0x17')][_0x0209('0x18')]===undefined?!![]:![]:!![],'where':_0x51aae3[_0x0209('0x17')]?_0x51aae3[_0x0209('0x17')][_0x0209('0x19')]||null:null,'attributes':_0x51aae3[_0x0209('0x17')]?_0x51aae3[_0x0209('0x17')][_0x0209('0x1a')]||null:null,'include':_0x51aae3[_0x0209('0x17')]?_0x51aae3[_0x0209('0x17')][_0x0209('0x1b')]?_[_0x0209('0x1c')](_0x51aae3[_0x0209('0x17')][_0x0209('0x1b')],function(_0x5e0e87){return{'model':db[_0x5e0e87[_0x0209('0x1d')]],'as':_0x5e0e87['as'],'attributes':_0x5e0e87[_0x0209('0x1a')],'include':_0x5e0e87['include']?_['map'](_0x5e0e87[_0x0209('0x1b')],function(_0x5b73f5){return{'model':db[_0x5b73f5[_0x0209('0x1d')]],'as':_0x5b73f5['as'],'attributes':_0x5b73f5['attributes'],'include':_0x5b73f5[_0x0209('0x1b')]?_[_0x0209('0x1c')](_0x5b73f5[_0x0209('0x1b')],function(_0x3d815c){return{'model':db[_0x3d815c[_0x0209('0x1d')]],'as':_0x3d815c['as'],'attributes':_0x3d815c[_0x0209('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0209('0x1e')](function(_0x1406df){logger['info'](_0x0209('0x14'),_0x51aae3);logger['debug'](_0x0209('0x14'),_0x51aae3,JSON[_0x0209('0x10')](_0x1406df));_0xbacdce(_0x1406df);})[_0x0209('0x1f')](function(_0x114544){logger[_0x0209('0x11')](_0x0209('0x14'),_0x114544['message'],_0x51aae3);_0x2fbd62(_0x2921f5[_0x0209('0x11')](0x1f4,_0x114544[_0x0209('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index a1c0062..9ac84f7 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 _0xa3e8=['/:id','show','/:id/download','join','root','server/files/plugins','originalname','format','basename','extname','now','post','single','file','upload','put','update','delete','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet'];(function(_0x439b2f,_0x48b320){var _0x2d5910=function(_0x2d2913){while(--_0x2d2913){_0x439b2f['push'](_0x439b2f['shift']());}};_0x2d5910(++_0x48b320);}(_0xa3e8,0x186));var _0x8a3e=function(_0xaacc18,_0x502187){_0xaacc18=_0xaacc18-0x0;var _0x28bbac=_0xa3e8[_0xaacc18];return _0x28bbac;};'use strict';var multer=require(_0x8a3e('0x0'));var util=require(_0x8a3e('0x1'));var path=require('path');var timeout=require(_0x8a3e('0x2'));var express=require(_0x8a3e('0x3'));var router=express[_0x8a3e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8a3e('0x5'));var config=require(_0x8a3e('0x6'));var controller=require(_0x8a3e('0x7'));router[_0x8a3e('0x8')]('/',auth[_0x8a3e('0x9')](),controller[_0x8a3e('0xa')]);router[_0x8a3e('0x8')](_0x8a3e('0xb'),controller[_0x8a3e('0xc')]);router['get'](_0x8a3e('0xd'),auth[_0x8a3e('0x9')](),controller[_0x8a3e('0xe')]);router[_0x8a3e('0x8')](_0x8a3e('0xf'),auth[_0x8a3e('0x9')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5b47de,_0x1fe891,_0x5a477b){_0x5a477b(null,path[_0x8a3e('0x10')](config[_0x8a3e('0x11')],_0x8a3e('0x12')));},'filename':function(_0xe52cd4,_0x1842fb,_0x5175b9){_0x1842fb[_0x8a3e('0x13')]=_0x1842fb[_0x8a3e('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5175b9(null,util[_0x8a3e('0x14')]('%s-%s%s',path[_0x8a3e('0x15')](_0x1842fb['originalname'],path[_0x8a3e('0x16')](_0x1842fb[_0x8a3e('0x13')])),Date[_0x8a3e('0x17')](),path['extname'](_0x1842fb[_0x8a3e('0x13')])));}})});router[_0x8a3e('0x18')]('/',upload[_0x8a3e('0x19')](_0x8a3e('0x1a')),controller[_0x8a3e('0x1b')]);router[_0x8a3e('0x18')](_0x8a3e('0xb'),controller['webhookPost']);router[_0x8a3e('0x1c')](_0x8a3e('0xd'),auth[_0x8a3e('0x9')](),controller[_0x8a3e('0x1d')]);router[_0x8a3e('0x1e')](_0x8a3e('0xd'),auth[_0x8a3e('0x9')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x0430=['basename','extname','now','post','single','file','upload','/webhook','put','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','webhookGet','/:id','/:id/download','download','join','server/files/plugins','originalname','replace','%s-%s%s'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0x0430,0xe5));var _0x0043=function(_0x5c290d,_0x482b9a){_0x5c290d=_0x5c290d-0x0;var _0x1a2a3b=_0x0430[_0x5c290d];return _0x1a2a3b;};'use strict';var multer=require(_0x0043('0x0'));var util=require('util');var path=require(_0x0043('0x1'));var timeout=require('connect-timeout');var express=require(_0x0043('0x2'));var router=express[_0x0043('0x3')]();var auth=require(_0x0043('0x4'));var interaction=require(_0x0043('0x5'));var config=require(_0x0043('0x6'));var controller=require('./plugin.controller');router[_0x0043('0x7')]('/',auth[_0x0043('0x8')](),controller[_0x0043('0x9')]);router[_0x0043('0x7')]('/webhook',controller[_0x0043('0xa')]);router[_0x0043('0x7')](_0x0043('0xb'),auth[_0x0043('0x8')](),controller['show']);router[_0x0043('0x7')](_0x0043('0xc'),auth[_0x0043('0x8')](),controller[_0x0043('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x58b96f,_0x5b277c,_0x5356bb){_0x5356bb(null,path[_0x0043('0xe')](config['root'],_0x0043('0xf')));},'filename':function(_0x2bce0b,_0x361bb1,_0x39d226){_0x361bb1['originalname']=_0x361bb1[_0x0043('0x10')][_0x0043('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x39d226(null,util['format'](_0x0043('0x12'),path[_0x0043('0x13')](_0x361bb1[_0x0043('0x10')],path[_0x0043('0x14')](_0x361bb1[_0x0043('0x10')])),Date[_0x0043('0x15')](),path[_0x0043('0x14')](_0x361bb1[_0x0043('0x10')])));}})});router[_0x0043('0x16')]('/',upload[_0x0043('0x17')](_0x0043('0x18')),controller[_0x0043('0x19')]);router[_0x0043('0x16')](_0x0043('0x1a'),controller['webhookPost']);router[_0x0043('0x1b')](_0x0043('0xb'),auth['isAuthenticated'](),controller[_0x0043('0x1c')]);router[_0x0043('0x1d')](_0x0043('0xb'),auth['isAuthenticated'](),controller[_0x0043('0x1d')]);module[_0x0043('0x1e')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 611cbdf..658c0b9 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 _0x4ddb=['agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly'];(function(_0x2c6c54,_0x1f99c9){var _0x3cc4fe=function(_0xe971a1){while(--_0xe971a1){_0x2c6c54['push'](_0x2c6c54['shift']());}};_0x3cc4fe(++_0x1f99c9);}(_0x4ddb,0x107));var _0xb4dd=function(_0x2912b9,_0x55e6e1){_0x2912b9=_0x2912b9-0x0;var _0x154da8=_0x4ddb[_0x2912b9];return _0x154da8;};'use strict';var Sequelize=require(_0xb4dd('0x0'));module[_0xb4dd('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb4dd('0x2')]('html','script')},'description':{'type':Sequelize[_0xb4dd('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xb4dd('0x4')],'comment':_0xb4dd('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xb4dd('0x2')](_0xb4dd('0x6'),_0xb4dd('0x7'),_0xb4dd('0x8'),'never'),'defaultValue':_0xb4dd('0x8'),'comment':_0xb4dd('0x9')},'icon':{'type':Sequelize[_0xb4dd('0x4')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xb4dd('0x4')]},'scriptName':{'type':Sequelize[_0xb4dd('0x4')]},'scriptPath':{'type':Sequelize[_0xb4dd('0x4')]}}; \ No newline at end of file +var _0xd25d=['never','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always'];(function(_0x5abe1b,_0x30d6ea){var _0x25a925=function(_0x102db9){while(--_0x102db9){_0x5abe1b['push'](_0x5abe1b['shift']());}};_0x25a925(++_0x30d6ea);}(_0xd25d,0xde));var _0xdd25=function(_0x4c48a8,_0x44bd25){_0x4c48a8=_0x4c48a8-0x0;var _0x462ccf=_0xd25d[_0x4c48a8];return _0x462ccf;};'use strict';var Sequelize=require('sequelize');module[_0xdd25('0x0')]={'name':{'type':Sequelize[_0xdd25('0x1')]},'type':{'type':Sequelize[_0xdd25('0x2')](_0xdd25('0x3'),_0xdd25('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xdd25('0x5')]},'path':{'type':Sequelize[_0xdd25('0x1')],'comment':_0xdd25('0x6')},'active':{'type':Sequelize[_0xdd25('0x7')],'defaultValue':0x0,'comment':_0xdd25('0x8')},'sidebar':{'type':Sequelize[_0xdd25('0x2')](_0xdd25('0x9'),_0xdd25('0xa'),_0xdd25('0xb'),_0xdd25('0xc')),'defaultValue':_0xdd25('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xdd25('0x1')]},'adminUrl':{'type':Sequelize[_0xdd25('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xdd25('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 64cf1f3..4a2161a 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 _0xdf97=['root','server/files/plugins','format','%s.zip','basename','path','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','**/*','dirname','node_modules/**/*','attachments/**/*','close','existsSync','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','version','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Zip\x20archive\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','method','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','redis','register','sendStatus','end','status','count','offset','set','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','join'];(function(_0x555435,_0xa74e4e){var _0x42c398=function(_0x1fdd48){while(--_0x1fdd48){_0x555435['push'](_0x555435['shift']());}};_0x42c398(++_0xa74e4e);}(_0xdf97,0x1b4));var _0x7df9=function(_0x1e9e51,_0x5b18d9){_0x1e9e51=_0x1e9e51-0x0;var _0x2bba1e=_0xdf97[_0x1e9e51];return _0x2bba1e;};'use strict';var pdf=require(_0x7df9('0x0'));var emlformat=require(_0x7df9('0x1'));var rimraf=require(_0x7df9('0x2'));var zipdir=require(_0x7df9('0x3'));var jsonpatch=require(_0x7df9('0x4'));var rp=require(_0x7df9('0x5'));var moment=require(_0x7df9('0x6'));var BPromise=require(_0x7df9('0x7'));var Mustache=require(_0x7df9('0x8'));var util=require(_0x7df9('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x7df9('0xa'));var ejs=require(_0x7df9('0xb'));var fs=require('fs');var _=require(_0x7df9('0xc'));var squel=require('squel');var crypto=require(_0x7df9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7df9('0xe'));var toCsv=require(_0x7df9('0xa'));var querystring=require(_0x7df9('0xf'));var Papa=require(_0x7df9('0x10'));var extract=require(_0x7df9('0x11'));var rimraf=require(_0x7df9('0x2'));var archiver=require(_0x7df9('0x12'));var Redis=require(_0x7df9('0x13'));var authService=require(_0x7df9('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7df9('0x15'));var logger=require(_0x7df9('0x16'))(_0x7df9('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7df9('0x18'))['db'];config['redis']=_[_0x7df9('0x19')](config[_0x7df9('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7df9('0x1a')]));require('./plugin.socket')[_0x7df9('0x1b')](socket);function respondWithStatusCode(_0x1e7e49,_0x30dcd0){_0x30dcd0=_0x30dcd0||0xcc;return function(_0x581eb9){if(_0x581eb9){return _0x1e7e49[_0x7df9('0x1c')](_0x30dcd0);}return _0x1e7e49['status'](_0x30dcd0)[_0x7df9('0x1d')]();};}function respondWithResult(_0x462a67,_0x2e879f){_0x2e879f=_0x2e879f||0xc8;return function(_0x1b2758){if(_0x1b2758){return _0x462a67[_0x7df9('0x1e')](_0x2e879f)['json'](_0x1b2758);}};}function respondWithFilteredResult(_0x2d8f3a,_0x18f2b1){return function(_0x137a03){if(_0x137a03){var _0x4e5b47=_0x137a03[_0x7df9('0x1f')],_0x3790bb=_0x18f2b1[_0x7df9('0x20')],_0x374374=_0x18f2b1[_0x7df9('0x20')]+_0x18f2b1['limit'],_0x3570d3;if(_0x374374>=_0x4e5b47){_0x374374=_0x4e5b47;_0x3570d3=0xc8;}else{_0x3570d3=0xce;}_0x2d8f3a[_0x7df9('0x1e')](_0x3570d3);return _0x2d8f3a[_0x7df9('0x21')](_0x7df9('0x22'),_0x3790bb+'-'+_0x374374+'/'+_0x4e5b47)[_0x7df9('0x23')](_0x137a03);}return null;};}function patchUpdates(_0x420c98){return function(_0x63cb6c){try{jsonpatch['apply'](_0x63cb6c,_0x420c98,!![]);}catch(_0x241dd4){return BPromise[_0x7df9('0x24')](_0x241dd4);}return _0x63cb6c[_0x7df9('0x25')]();};}function saveUpdates(_0x2dae67,_0x124f35){return function(_0x4f68e2){if(_0x4f68e2){return _0x4f68e2[_0x7df9('0x26')](_0x2dae67)[_0x7df9('0x27')](function(_0x5cdaea){return _0x5cdaea;});}return null;};}function removeEntity(_0x4b4a42,_0x2ce280){return function(_0x15f5fb){if(_0x15f5fb){return _0x15f5fb[_0x7df9('0x28')]()[_0x7df9('0x27')](function(){var _0x23444f=_0x15f5fb[_0x7df9('0x29')]({'plain':!![]});var _0x121f20='Plugins';return db[_0x7df9('0x2a')][_0x7df9('0x28')]({'where':{'type':_0x121f20,'resourceId':_0x23444f['id']}})[_0x7df9('0x27')](function(){return _0x15f5fb;});})['then'](function(){_0x4b4a42[_0x7df9('0x1e')](0xcc)[_0x7df9('0x1d')]();});}};}function handleEntityNotFound(_0xfa2f3b,_0x32df5a){return function(_0x55b371){if(!_0x55b371){_0xfa2f3b[_0x7df9('0x1c')](0x194);}return _0x55b371;};}function handleError(_0x3e0d76,_0x3cc09a){_0x3cc09a=_0x3cc09a||0x1f4;return function(_0x66ec99){logger[_0x7df9('0x2b')](_0x66ec99[_0x7df9('0x2c')]);if(_0x66ec99[_0x7df9('0x2d')]){delete _0x66ec99['name'];}_0x3e0d76[_0x7df9('0x1e')](_0x3cc09a)[_0x7df9('0x2e')](_0x66ec99);};}exports[_0x7df9('0x2f')]=function(_0x217a58,_0x2fa3de){var _0x2a81d0={},_0x35cc49={},_0x4e33a4={'count':0x0,'rows':[]};var _0x11c261=_[_0x7df9('0x30')](db[_0x7df9('0x31')][_0x7df9('0x32')],function(_0x1a98a3){return{'name':_0x1a98a3[_0x7df9('0x33')],'type':_0x1a98a3[_0x7df9('0x34')][_0x7df9('0x35')]};});_0x35cc49[_0x7df9('0x36')]=_[_0x7df9('0x30')](_0x11c261,'name');_0x35cc49['query']=_[_0x7df9('0x37')](_0x217a58[_0x7df9('0x38')]);_0x35cc49[_0x7df9('0x39')]=_[_0x7df9('0x3a')](_0x35cc49[_0x7df9('0x36')],_0x35cc49['query']);_0x2a81d0[_0x7df9('0x3b')]=_['intersection'](_0x35cc49['model'],qs['fields'](_0x217a58[_0x7df9('0x38')]['fields']));_0x2a81d0['attributes']=_0x2a81d0['attributes'][_0x7df9('0x3c')]?_0x2a81d0[_0x7df9('0x3b')]:_0x35cc49[_0x7df9('0x36')];if(!_0x217a58[_0x7df9('0x38')]['hasOwnProperty'](_0x7df9('0x3d'))){_0x2a81d0[_0x7df9('0x3e')]=qs[_0x7df9('0x3e')](_0x217a58[_0x7df9('0x38')][_0x7df9('0x3e')]);_0x2a81d0[_0x7df9('0x20')]=qs[_0x7df9('0x20')](_0x217a58[_0x7df9('0x38')][_0x7df9('0x20')]);}_0x2a81d0[_0x7df9('0x3f')]=qs['sort'](_0x217a58[_0x7df9('0x38')][_0x7df9('0x40')]);_0x2a81d0[_0x7df9('0x41')]=qs['filters'](_[_0x7df9('0x42')](_0x217a58[_0x7df9('0x38')],_0x35cc49[_0x7df9('0x39')]),_0x11c261);if(_0x217a58[_0x7df9('0x38')][_0x7df9('0x43')]){_0x2a81d0[_0x7df9('0x41')]=_[_0x7df9('0x44')](_0x2a81d0['where'],{'$or':_[_0x7df9('0x30')](_0x11c261,function(_0x413a09){if(_0x413a09[_0x7df9('0x34')]!==_0x7df9('0x45')){var _0x86e808={};_0x86e808[_0x413a09[_0x7df9('0x2d')]]={'$like':'%'+_0x217a58[_0x7df9('0x38')][_0x7df9('0x43')]+'%'};return _0x86e808;}})});}_0x2a81d0=_[_0x7df9('0x44')]({},_0x2a81d0,_0x217a58[_0x7df9('0x46')]);var _0x2a5601={'where':_0x2a81d0['where']};return db[_0x7df9('0x31')][_0x7df9('0x1f')](_0x2a5601)[_0x7df9('0x27')](function(_0x5c7bf6){_0x4e33a4['count']=_0x5c7bf6;if(_0x217a58[_0x7df9('0x38')][_0x7df9('0x47')]){_0x2a81d0[_0x7df9('0x48')]=[{'all':!![]}];}return db[_0x7df9('0x31')][_0x7df9('0x49')](_0x2a81d0);})['then'](function(_0x327566){_0x4e33a4[_0x7df9('0x4a')]=_0x327566;return _0x4e33a4;})[_0x7df9('0x27')](respondWithFilteredResult(_0x2fa3de,_0x2a81d0))[_0x7df9('0x4b')](handleError(_0x2fa3de,null));};exports['show']=function(_0xb8412a,_0xb9bc57){var _0x2dbefb={'raw':!![],'where':{'id':_0xb8412a[_0x7df9('0x4c')]['id']}},_0x114013={};_0x114013[_0x7df9('0x36')]=_[_0x7df9('0x37')](db[_0x7df9('0x31')][_0x7df9('0x32')]);_0x114013[_0x7df9('0x38')]=_[_0x7df9('0x37')](_0xb8412a['query']);_0x114013[_0x7df9('0x39')]=_[_0x7df9('0x3a')](_0x114013[_0x7df9('0x36')],_0x114013[_0x7df9('0x38')]);_0x2dbefb[_0x7df9('0x3b')]=_[_0x7df9('0x3a')](_0x114013[_0x7df9('0x36')],qs['fields'](_0xb8412a[_0x7df9('0x38')][_0x7df9('0x4d')]));_0x2dbefb[_0x7df9('0x3b')]=_0x2dbefb[_0x7df9('0x3b')][_0x7df9('0x3c')]?_0x2dbefb[_0x7df9('0x3b')]:_0x114013['model'];if(_0xb8412a[_0x7df9('0x38')][_0x7df9('0x47')]){_0x2dbefb[_0x7df9('0x48')]=[{'all':!![]}];}_0x2dbefb=_[_0x7df9('0x44')]({},_0x2dbefb,_0xb8412a[_0x7df9('0x46')]);return db[_0x7df9('0x31')][_0x7df9('0x4e')](_0x2dbefb)[_0x7df9('0x27')](handleEntityNotFound(_0xb9bc57,null))[_0x7df9('0x27')](respondWithResult(_0xb9bc57,null))[_0x7df9('0x4b')](handleError(_0xb9bc57,null));};exports['download']=function(_0x213e28,_0x5cd330,_0x28e177){return db['Plugin']['find']({'where':{'id':_0x213e28[_0x7df9('0x4c')]['id']},'attributes':[_0x7df9('0x2d'),'path'],'raw':!![]})[_0x7df9('0x27')](handleEntityNotFound(_0x5cd330,null))['then'](function(_0x19c9b4){if(_0x19c9b4){var _0x5ebd1d=path[_0x7df9('0x4f')](config[_0x7df9('0x50')],_0x7df9('0x51'),util[_0x7df9('0x52')](_0x7df9('0x53'),path[_0x7df9('0x54')](_0x19c9b4[_0x7df9('0x55')])));var _0x226ba5=fs[_0x7df9('0x56')](_0x5ebd1d);var _0x37f35c=archiver(_0x7df9('0x57'),{'zlib':{'level':0x9}});_0x37f35c['on'](_0x7df9('0x58'),function(_0x21cfbb){if(_0x21cfbb[_0x7df9('0x59')]===_0x7df9('0x5a')){logger[_0x7df9('0x2b')](_0x21cfbb);}else{throw new db[(_0x7df9('0x5b'))]['Error'](_0x7df9('0x5c'));}});_0x37f35c['on'](_0x7df9('0x2b'),function(_0x976dc6){throw new db['Sequelize'][(_0x7df9('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x37f35c[_0x7df9('0x5e')](_0x226ba5);_0x37f35c['glob'](_0x7df9('0x5f'),{'cwd':path[_0x7df9('0x4f')](config[_0x7df9('0x50')],'server/files/plugins',path[_0x7df9('0x60')](_0x19c9b4[_0x7df9('0x55')])),'ignore':[path['join'](path[_0x7df9('0x54')](_0x19c9b4[_0x7df9('0x55')]),_0x7df9('0x61')),path[_0x7df9('0x4f')](path['basename'](_0x19c9b4[_0x7df9('0x55')]),_0x7df9('0x62'))],'nodir':!![]})['finalize']();_0x226ba5['on'](_0x7df9('0x63'),function(){if(!fs[_0x7df9('0x64')](_0x5ebd1d)){throw new db['Sequelize'][(_0x7df9('0x5d'))]('Plugin\x20not\x20found');}return _0x5cd330[_0x7df9('0x65')](_0x5ebd1d,util[_0x7df9('0x52')](_0x7df9('0x53'),path[_0x7df9('0x54')](_0x19c9b4[_0x7df9('0x55')])),function(_0x4aaf7d){if(_0x4aaf7d){throw new db[(_0x7df9('0x5b'))]['Error'](_0x7df9('0x66'));}fs[_0x7df9('0x67')](_0x5ebd1d);logger[_0x7df9('0x68')](_0x7df9('0x69'));logger[_0x7df9('0x68')]('Temporary\x20file\x20removed');});});}return null;})[_0x7df9('0x4b')](handleError(_0x5cd330,null));};exports[_0x7df9('0x6a')]=function(_0xe37071,_0x2ebdf9,_0x2db3b3){var _0x4d5e6b=path[_0x7df9('0x54')](_0xe37071['file'][_0x7df9('0x6b')],path[_0x7df9('0x6c')](_0xe37071[_0x7df9('0x6d')]['filename']));var _0x2ab472=path[_0x7df9('0x4f')](config['root'],_0x7df9('0x51'),_0xe37071['file'][_0x7df9('0x6b')]);var _0x3725c2=path[_0x7df9('0x4f')](config[_0x7df9('0x50')],'server/files/plugins',_0x4d5e6b);logger[_0x7df9('0x68')](_0x7df9('0x6e'),_0x2ab472);logger[_0x7df9('0x68')](_0x7df9('0x6f'),_0x3725c2);try{fs[_0x7df9('0x70')](_0x2ab472,parseInt(_0x7df9('0x71'),0x8));extract(_0x2ab472,{'dir':_0x3725c2},function(_0x18097f){if(_0x18097f){logger['error'](_0x18097f);handleError(_0x18097f,!![]);};var _0x165b56=fs[_0x7df9('0x72')](_0x3725c2);if(_0x165b56[_0x7df9('0x3c')]>0x1){removeReferences(_0x2ab472,_0x3725c2);logger[_0x7df9('0x2b')](_0x7df9('0x73'));return _0x2db3b3(new Error(_0x7df9('0x73')));}var _0x413b03=fs[_0x7df9('0x74')](path[_0x7df9('0x4f')](_0x3725c2,_0x165b56[0x0]));if(_0x413b03[_0x7df9('0x75')]()){removeReferences(_0x2ab472,_0x3725c2);logger[_0x7df9('0x2b')](_0x7df9('0x73'));return _0x2db3b3(new Error(_0x7df9('0x73')));}if(_0x413b03[_0x7df9('0x76')]()){var _0xdf9f94=fs[_0x7df9('0x72')](path[_0x7df9('0x4f')](_0x3725c2,_0x165b56[0x0]));if(_0xdf9f94[_0x7df9('0x3c')]===0x0){removeReferences(_0x2ab472,_0x3725c2);logger['error'](_0x7df9('0x73'));return _0x2db3b3(new Error(_0x7df9('0x73')));}var _0x5a66ee=_0xdf9f94[_0x7df9('0x77')](function(_0x40b0e7){return _0x40b0e7===_0x7df9('0x78');});if(!_0x5a66ee){return _0x2db3b3(new Error(_0x7df9('0x79')));}var _0xfba696=fs['readFileSync'](path[_0x7df9('0x4f')](_0x3725c2,_0x165b56[0x0],_0x7df9('0x78')));var _0x5afced=JSON[_0x7df9('0x7a')](_0xfba696);if(_0x7df9('0x7b')==typeof _0x5afced[_0x7df9('0x2d')]){return _0x2db3b3(new Error(_0x7df9('0x7c')));}if(_0x7df9('0x7b')==typeof _0x5afced[_0x7df9('0x34')]){return _0x2db3b3(new Error(_0x7df9('0x7d')));}if(_0x7df9('0x7b')==typeof _0x5afced['version']){return _0x2db3b3(new Error(_0x7df9('0x7e')));}if(_0x7df9('0x7b')==typeof _0x5afced[_0x7df9('0x7f')]){return _0x2db3b3(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x5afced['type']===_0x7df9('0x80')){if('undefined'==typeof _0x5afced['parameters'][_0x7df9('0x81')]){return _0x2db3b3(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x5afced[_0x7df9('0x7f')][_0x7df9('0x81')][_0x7df9('0x82')]&&_0x7df9('0x7b')==typeof _0x5afced['parameters']['views'][_0x7df9('0x83')]){return _0x2db3b3(new Error(_0x7df9('0x84')));}}else if(_0x5afced[_0x7df9('0x34')]===_0x7df9('0x85')){if(_0x7df9('0x7b')==typeof _0x5afced[_0x7df9('0x7f')][_0x7df9('0x86')]){return _0x2db3b3(new Error(_0x7df9('0x87')));}if(_0x7df9('0x7b')==typeof _0x5afced[_0x7df9('0x7f')][_0x7df9('0x88')]){return _0x2db3b3(new Error(_0x7df9('0x89')));}}else{return _0x2db3b3(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0xd6a5fb=_0x5afced['name'];var _0x594fd8=_0x5afced[_0x7df9('0x8a')];var _0x5b8fe5=_0x5afced['type'];var _0x55cd2c=_0x5afced[_0x7df9('0x8b')]?_0x5afced[_0x7df9('0x8b')]:_0x7df9('0x8c');var _0x3fb71d=_0x5afced[_0x7df9('0x8d')]?_0x5afced[_0x7df9('0x8d')]:_0x7df9('0x8e');var _0x552b4a='';var _0x324263='';var _0x407e6d='';var _0x11c7ab='';var _0x36f6ce=_0x5afced[_0x7df9('0x8f')];if(_0x5b8fe5==='html'){if(_0x7df9('0x7b')!=typeof _0x5afced[_0x7df9('0x7f')][_0x7df9('0x81')]['admin']){var _0x21eb73=_0x5afced['parameters'][_0x7df9('0x81')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x7df9('0x90')](_0x21eb73)){_0x552b4a=path[_0x7df9('0x4f')](_0x7df9('0x91'),_0x4d5e6b,_0x165b56[0x0],_0x21eb73);}else{_0x552b4a=_0x21eb73;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x7df9('0x7b')!=typeof _0x5afced[_0x7df9('0x7f')]['views']['agent']){var _0x45b669=_0x5afced[_0x7df9('0x7f')][_0x7df9('0x81')][_0x7df9('0x83')];if(!/^(f|ht)tps?:\/\//i['test'](_0x45b669)){_0x324263=path[_0x7df9('0x4f')](_0x7df9('0x91'),_0x4d5e6b,_0x165b56[0x0],_0x45b669);}else{_0x324263=_0x45b669;}}else{logger[_0x7df9('0x68')](_0x7df9('0x92'));}}else if(_0x5b8fe5===_0x7df9('0x85')){_0x407e6d=_0x5afced[_0x7df9('0x7f')]['scriptName'];_0x11c7ab=_0x5afced[_0x7df9('0x7f')]['scriptPath'];if(_0x7df9('0x7b')!=typeof _0x5afced[_0x7df9('0x7f')][_0x7df9('0x81')]){if(_0x7df9('0x7b')!=typeof _0x5afced[_0x7df9('0x7f')]['views'][_0x7df9('0x82')]){var _0x21eb73=_0x5afced[_0x7df9('0x7f')][_0x7df9('0x81')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x7df9('0x90')](_0x21eb73)){_0x552b4a=path[_0x7df9('0x4f')]('plugins',_0x4d5e6b,_0x165b56[0x0],_0x21eb73);}else{_0x552b4a=_0x21eb73;}}if('undefined'!=typeof _0x5afced[_0x7df9('0x7f')]['views'][_0x7df9('0x83')]){var _0x45b669=_0x5afced['parameters'][_0x7df9('0x81')][_0x7df9('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x7df9('0x90')](_0x45b669)){_0x324263=path[_0x7df9('0x4f')](_0x7df9('0x91'),_0x4d5e6b,_0x165b56[0x0],_0x45b669);}else{_0x324263=_0x45b669;}}}}var _0x11386e={'name':_0xd6a5fb,'description':_0x594fd8,'path':path[_0x7df9('0x4f')](_0x4d5e6b,_0x165b56[0x0]),'type':_0x5b8fe5,'sidebar':_0x55cd2c,'icon':_0x3fb71d,'adminUrl':_0x552b4a,'agentUrl':_0x324263,'scriptName':_0x407e6d,'scriptPath':_0x11c7ab,'version':_0x36f6ce};removeReferences(_0x2ab472,null);return db['Plugin'][_0x7df9('0x93')](_0x11386e)[_0x7df9('0x27')](function(_0x148973){var _0x48a6cc={'role':_0xe37071['body'][_0x7df9('0x94')],'userProfileId':_0xe37071[_0x7df9('0x95')]['userProfileId']};if(!_0x48a6cc)throw new Error(_0x7df9('0x96'));if(_0x48a6cc[_0x7df9('0x94')]===_0x7df9('0x97')){var _0x6cd24d=_0x148973['get']({'plain':!![]});return db['UserProfileSection'][_0x7df9('0x4e')]({'where':{'name':'Plugins','userProfileId':_0x48a6cc[_0x7df9('0x98')]},'raw':!![]})[_0x7df9('0x27')](function(_0x13bc78){if(_0x13bc78&&_0x13bc78[_0x7df9('0x99')]===0x0){return db[_0x7df9('0x2a')][_0x7df9('0x93')]({'name':_0x6cd24d[_0x7df9('0x2d')],'resourceId':_0x6cd24d['id'],'type':_0x13bc78['name'],'sectionId':_0x13bc78['id']},{})['then'](function(){return _0x148973;});}else{return _0x148973;}})[_0x7df9('0x4b')](function(_0x45d9c0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45d9c0);throw _0x45d9c0;});}return _0x148973;})[_0x7df9('0x27')](respondWithResult(_0x2ebdf9,null))[_0x7df9('0x4b')](handleError(_0x2ebdf9,null));}});}catch(_0x1236b8){_0x2ebdf9[_0x7df9('0x1e')](0x1f4)['send'](_0x1236b8);}};function removeReferences(_0x1c0c53,_0x547c61){try{if(_0x1c0c53){fs[_0x7df9('0x67')](_0x1c0c53);logger['info'](_0x7df9('0x9a'));}if(_0x547c61){rimraf(_0x547c61,function(){});logger[_0x7df9('0x68')]('Extracted\x20folder\x20removed');}}catch(_0x1f8f40){logger['error'](_0x1f8f40);}}exports[_0x7df9('0x26')]=function(_0x142be3,_0x16c6f9,_0x37de31){return db[_0x7df9('0x31')][_0x7df9('0x4e')]({'where':{'id':_0x142be3[_0x7df9('0x4c')]['id']}})[_0x7df9('0x27')](handleEntityNotFound(_0x16c6f9,null))['then'](saveUpdates(_0x142be3[_0x7df9('0x95')],null))['then'](respondWithResult(_0x16c6f9,null))['catch'](handleError(_0x16c6f9,null));};exports[_0x7df9('0x9b')]=function(_0x39a24c,_0x2b76cd,_0x32e7ee){return db[_0x7df9('0x31')][_0x7df9('0x4e')]({'where':{'id':_0x39a24c['params']['id']}})[_0x7df9('0x27')](function(_0x3357d2){if(_0x3357d2){return _0x3357d2[_0x7df9('0x28')]();}})['then'](function(_0x1917a1){rimraf(path[_0x7df9('0x4f')](config[_0x7df9('0x50')],_0x7df9('0x51'),path['dirname'](_0x1917a1['path'])),function(){});return _0x1917a1;})[_0x7df9('0x27')](handleEntityNotFound(_0x2b76cd,null))[_0x7df9('0x27')](respondWithStatusCode(_0x2b76cd,null))[_0x7df9('0x4b')](handleError(_0x2b76cd,null));};exports[_0x7df9('0x9c')]=function(_0x1456df,_0x56da09,_0xa8a759){return BPromise[_0x7df9('0x9d')]()[_0x7df9('0x27')](function(){if(!_0x1456df['query'][_0x7df9('0x55')]){throw new Error(_0x7df9('0x9e'));}if(!_0x1456df[_0x7df9('0x38')][_0x7df9('0x9f')]){throw new Error(_0x7df9('0xa0'));}var _0x25520b=_0x1456df[_0x7df9('0x38')]['hostname']?_0x1456df['query'][_0x7df9('0xa1')]+':'+_0x1456df[_0x7df9('0x38')][_0x7df9('0x9f')]:_0x7df9('0xa2')+_0x1456df[_0x7df9('0x38')][_0x7df9('0x9f')];var _0x1bb232=_0x1456df[_0x7df9('0x38')][_0x7df9('0x23')]?_0x1456df[_0x7df9('0x38')][_0x7df9('0x23')]:!![];var _0x3519d7=_0x1456df[_0x7df9('0x38')][_0x7df9('0xa3')]?_0x1456df[_0x7df9('0x38')][_0x7df9('0xa3')]:null;var _0x35961d={'method':_0x1456df['method'],'uri':util[_0x7df9('0x52')](_0x7df9('0xa4'),_0x25520b,_0x1456df[_0x7df9('0x38')]['path']),'json':_0x1bb232,'resolveWithFullResponse':!![],'encoding':_0x3519d7,'qs':_0x1456df[_0x7df9('0x38')]};if(_0x1456df[_0x7df9('0xa5')]){_0x35961d[_0x7df9('0xa5')]=_0x1456df[_0x7df9('0xa5')];if(_0x35961d[_0x7df9('0xa5')][_0x7df9('0xa6')]){delete _0x35961d[_0x7df9('0xa5')][_0x7df9('0xa6')];}}if(_0x35961d[_0x7df9('0xa5')][_0x7df9('0xa7')]){delete _0x35961d['headers'][_0x7df9('0xa7')];}return rp(_0x35961d);})[_0x7df9('0x27')](function(_0x1f261f){if(_0x1f261f){_0x56da09[_0x7df9('0x21')](_0x1f261f[_0x7df9('0xa5')]);logger[_0x7df9('0x68')](_0x1f261f[_0x7df9('0x95')]);if(_[_0x7df9('0xa8')](_0x1456df[_0x7df9('0x38')][_0x7df9('0x55')],_0x7df9('0x65'))&&_0x1f261f[_0x7df9('0xa9')]==0x1f4){return _0x56da09[_0x7df9('0x1c')](_0x1f261f['statusCode']);}else{return _0x56da09[_0x7df9('0x1e')](_0x1f261f[_0x7df9('0xa9')])[_0x7df9('0x2e')](_0x1f261f['body']);}}else{return _0x56da09[_0x7df9('0x1c')](0xc8);}})[_0x7df9('0x4b')](handleError(_0x56da09,null));};exports[_0x7df9('0xaa')]=function(_0x2185ab,_0x5b989a,_0x1f6ebd){return BPromise[_0x7df9('0x9d')]()[_0x7df9('0x27')](function(){if(!_0x2185ab[_0x7df9('0x38')][_0x7df9('0x55')]){throw new Error(_0x7df9('0x9e'));}if(!_0x2185ab['query']['port']){throw new Error(_0x7df9('0xa0'));}var _0x2f7d99=_0x2185ab[_0x7df9('0x38')][_0x7df9('0xa1')]?_0x2185ab['query'][_0x7df9('0xa1')]+':'+_0x2185ab[_0x7df9('0x38')]['port']:'http://localhost:'+_0x2185ab[_0x7df9('0x38')][_0x7df9('0x9f')];var _0x2f810f=_0x2185ab['query']['json']?_0x2185ab[_0x7df9('0x38')]['json']:!![];var _0x339bfa=_0x2185ab[_0x7df9('0x38')][_0x7df9('0xa3')]?_0x2185ab['query'][_0x7df9('0xa3')]:null;var _0x1deff4={'method':_0x2185ab[_0x7df9('0xab')],'uri':util[_0x7df9('0x52')]('%s%s',_0x2f7d99,_0x2185ab[_0x7df9('0x38')][_0x7df9('0x55')]),'json':_0x2f810f,'resolveWithFullResponse':!![],'encoding':_0x339bfa,'body':_0x2185ab['body']};if(_0x2185ab[_0x7df9('0xa5')]){_0x1deff4[_0x7df9('0xa5')]=_0x2185ab['headers'];if(_0x1deff4['headers'][_0x7df9('0xa6')]){delete _0x1deff4['headers'][_0x7df9('0xa6')];}}if(_0x1deff4[_0x7df9('0xa5')][_0x7df9('0xa7')]){delete _0x1deff4[_0x7df9('0xa5')][_0x7df9('0xa7')];}return rp(_0x1deff4);})[_0x7df9('0x27')](function(_0x944157){if(_0x944157){_0x5b989a[_0x7df9('0x21')](_0x944157[_0x7df9('0xa5')]);logger['info'](_0x944157[_0x7df9('0x95')]);return _0x5b989a[_0x7df9('0x1e')](_0x944157[_0x7df9('0xa9')])[_0x7df9('0x2e')](_0x944157[_0x7df9('0x95')]);}else{return _0x5b989a[_0x7df9('0x1c')](0xc8);}})['catch'](handleError(_0x5b989a,null));}; \ No newline at end of file +var _0xe146=['webhookPost','resolve','http://localhost:','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','archiver','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','count','offset','limit','set','apply','save','then','get','Plugins','UserProfileResource','error','name','send','index','map','Plugin','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','download','join','root','server/files/plugins','format','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','finalize','existsSync','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','destroy','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','statusCode'];(function(_0x348634,_0x2e0505){var _0x187864=function(_0x4a8e50){while(--_0x4a8e50){_0x348634['push'](_0x348634['shift']());}};_0x187864(++_0x2e0505);}(_0xe146,0x15b));var _0x6e14=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xe146[_0x62c958];return _0x57ec61;};'use strict';var pdf=require(_0x6e14('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6e14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e14('0x2'));var rp=require(_0x6e14('0x3'));var moment=require('moment');var BPromise=require(_0x6e14('0x4'));var Mustache=require(_0x6e14('0x5'));var util=require(_0x6e14('0x6'));var path=require(_0x6e14('0x7'));var sox=require('sox');var csv=require(_0x6e14('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6e14('0x9'));var squel=require(_0x6e14('0xa'));var crypto=require(_0x6e14('0xb'));var jsforce=require(_0x6e14('0xc'));var deskjs=require(_0x6e14('0xd'));var toCsv=require(_0x6e14('0x8'));var querystring=require(_0x6e14('0xe'));var Papa=require(_0x6e14('0xf'));var extract=require('extract-zip');var rimraf=require(_0x6e14('0x1'));var archiver=require(_0x6e14('0x10'));var Redis=require('ioredis');var authService=require(_0x6e14('0x11'));var qs=require(_0x6e14('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e14('0x13'))(_0x6e14('0x14'));var utils=require(_0x6e14('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6e14('0x16'));var db=require(_0x6e14('0x17'))['db'];config[_0x6e14('0x18')]=_[_0x6e14('0x19')](config[_0x6e14('0x18')],{'host':_0x6e14('0x1a'),'port':0x18eb});var socket=require(_0x6e14('0x1b'))(new Redis(config['redis']));require(_0x6e14('0x1c'))[_0x6e14('0x1d')](socket);function respondWithStatusCode(_0x67ac2,_0x14ad0b){_0x14ad0b=_0x14ad0b||0xcc;return function(_0x183d60){if(_0x183d60){return _0x67ac2[_0x6e14('0x1e')](_0x14ad0b);}return _0x67ac2[_0x6e14('0x1f')](_0x14ad0b)['end']();};}function respondWithResult(_0xcc7644,_0x1a6f53){_0x1a6f53=_0x1a6f53||0xc8;return function(_0x270144){if(_0x270144){return _0xcc7644[_0x6e14('0x1f')](_0x1a6f53)[_0x6e14('0x20')](_0x270144);}};}function respondWithFilteredResult(_0x31fbeb,_0x3d331d){return function(_0x5237f8){if(_0x5237f8){var _0xcbd581=_0x5237f8[_0x6e14('0x21')],_0x4864a5=_0x3d331d[_0x6e14('0x22')],_0x5dfedc=_0x3d331d[_0x6e14('0x22')]+_0x3d331d[_0x6e14('0x23')],_0x48ccac;if(_0x5dfedc>=_0xcbd581){_0x5dfedc=_0xcbd581;_0x48ccac=0xc8;}else{_0x48ccac=0xce;}_0x31fbeb[_0x6e14('0x1f')](_0x48ccac);return _0x31fbeb[_0x6e14('0x24')]('Content-Range',_0x4864a5+'-'+_0x5dfedc+'/'+_0xcbd581)[_0x6e14('0x20')](_0x5237f8);}return null;};}function patchUpdates(_0x5a06c9){return function(_0x41ddbf){try{jsonpatch[_0x6e14('0x25')](_0x41ddbf,_0x5a06c9,!![]);}catch(_0x5e7192){return BPromise['reject'](_0x5e7192);}return _0x41ddbf[_0x6e14('0x26')]();};}function saveUpdates(_0x4682b1,_0xfffe8d){return function(_0x5bf12d){if(_0x5bf12d){return _0x5bf12d['update'](_0x4682b1)[_0x6e14('0x27')](function(_0x87d80){return _0x87d80;});}return null;};}function removeEntity(_0x1eac56,_0x27d582){return function(_0x3b0e9b){if(_0x3b0e9b){return _0x3b0e9b['destroy']()[_0x6e14('0x27')](function(){var _0x4eae77=_0x3b0e9b[_0x6e14('0x28')]({'plain':!![]});var _0x21825b=_0x6e14('0x29');return db[_0x6e14('0x2a')]['destroy']({'where':{'type':_0x21825b,'resourceId':_0x4eae77['id']}})[_0x6e14('0x27')](function(){return _0x3b0e9b;});})[_0x6e14('0x27')](function(){_0x1eac56[_0x6e14('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24c743,_0x34e496){return function(_0x4a814f){if(!_0x4a814f){_0x24c743[_0x6e14('0x1e')](0x194);}return _0x4a814f;};}function handleError(_0x152c26,_0x19239b){_0x19239b=_0x19239b||0x1f4;return function(_0x34eca9){logger[_0x6e14('0x2b')](_0x34eca9['stack']);if(_0x34eca9[_0x6e14('0x2c')]){delete _0x34eca9['name'];}_0x152c26[_0x6e14('0x1f')](_0x19239b)[_0x6e14('0x2d')](_0x34eca9);};}exports[_0x6e14('0x2e')]=function(_0x11e6fa,_0x592e7b){var _0x84cab={},_0x2df509={},_0x2982fd={'count':0x0,'rows':[]};var _0x3b23d5=_[_0x6e14('0x2f')](db[_0x6e14('0x30')][_0x6e14('0x31')],function(_0x47fd69){return{'name':_0x47fd69[_0x6e14('0x32')],'type':_0x47fd69['type'][_0x6e14('0x33')]};});_0x2df509[_0x6e14('0x34')]=_['map'](_0x3b23d5,_0x6e14('0x2c'));_0x2df509['query']=_[_0x6e14('0x35')](_0x11e6fa[_0x6e14('0x36')]);_0x2df509[_0x6e14('0x37')]=_[_0x6e14('0x38')](_0x2df509['model'],_0x2df509[_0x6e14('0x36')]);_0x84cab[_0x6e14('0x39')]=_[_0x6e14('0x38')](_0x2df509[_0x6e14('0x34')],qs[_0x6e14('0x3a')](_0x11e6fa['query']['fields']));_0x84cab[_0x6e14('0x39')]=_0x84cab[_0x6e14('0x39')][_0x6e14('0x3b')]?_0x84cab['attributes']:_0x2df509[_0x6e14('0x34')];if(!_0x11e6fa['query'][_0x6e14('0x3c')]('nolimit')){_0x84cab['limit']=qs['limit'](_0x11e6fa[_0x6e14('0x36')][_0x6e14('0x23')]);_0x84cab[_0x6e14('0x22')]=qs[_0x6e14('0x22')](_0x11e6fa['query'][_0x6e14('0x22')]);}_0x84cab[_0x6e14('0x3d')]=qs[_0x6e14('0x3e')](_0x11e6fa[_0x6e14('0x36')][_0x6e14('0x3e')]);_0x84cab[_0x6e14('0x3f')]=qs['filters'](_[_0x6e14('0x40')](_0x11e6fa[_0x6e14('0x36')],_0x2df509[_0x6e14('0x37')]),_0x3b23d5);if(_0x11e6fa['query'][_0x6e14('0x41')]){_0x84cab[_0x6e14('0x3f')]=_[_0x6e14('0x42')](_0x84cab[_0x6e14('0x3f')],{'$or':_['map'](_0x3b23d5,function(_0x5591a0){if(_0x5591a0[_0x6e14('0x43')]!==_0x6e14('0x44')){var _0x13131e={};_0x13131e[_0x5591a0['name']]={'$like':'%'+_0x11e6fa[_0x6e14('0x36')][_0x6e14('0x41')]+'%'};return _0x13131e;}})});}_0x84cab=_[_0x6e14('0x42')]({},_0x84cab,_0x11e6fa[_0x6e14('0x45')]);var _0x1ba104={'where':_0x84cab[_0x6e14('0x3f')]};return db[_0x6e14('0x30')][_0x6e14('0x21')](_0x1ba104)['then'](function(_0x3d30c5){_0x2982fd[_0x6e14('0x21')]=_0x3d30c5;if(_0x11e6fa[_0x6e14('0x36')][_0x6e14('0x46')]){_0x84cab[_0x6e14('0x47')]=[{'all':!![]}];}return db['Plugin'][_0x6e14('0x48')](_0x84cab);})[_0x6e14('0x27')](function(_0x2bba1f){_0x2982fd[_0x6e14('0x49')]=_0x2bba1f;return _0x2982fd;})[_0x6e14('0x27')](respondWithFilteredResult(_0x592e7b,_0x84cab))['catch'](handleError(_0x592e7b,null));};exports['show']=function(_0x51042c,_0x4f81c3){var _0x438d91={'raw':!![],'where':{'id':_0x51042c[_0x6e14('0x4a')]['id']}},_0x2032e1={};_0x2032e1[_0x6e14('0x34')]=_[_0x6e14('0x35')](db[_0x6e14('0x30')][_0x6e14('0x31')]);_0x2032e1[_0x6e14('0x36')]=_[_0x6e14('0x35')](_0x51042c[_0x6e14('0x36')]);_0x2032e1[_0x6e14('0x37')]=_[_0x6e14('0x38')](_0x2032e1[_0x6e14('0x34')],_0x2032e1['query']);_0x438d91[_0x6e14('0x39')]=_[_0x6e14('0x38')](_0x2032e1[_0x6e14('0x34')],qs[_0x6e14('0x3a')](_0x51042c['query'][_0x6e14('0x3a')]));_0x438d91[_0x6e14('0x39')]=_0x438d91[_0x6e14('0x39')][_0x6e14('0x3b')]?_0x438d91['attributes']:_0x2032e1[_0x6e14('0x34')];if(_0x51042c[_0x6e14('0x36')][_0x6e14('0x46')]){_0x438d91['include']=[{'all':!![]}];}_0x438d91=_[_0x6e14('0x42')]({},_0x438d91,_0x51042c[_0x6e14('0x45')]);return db[_0x6e14('0x30')][_0x6e14('0x4b')](_0x438d91)['then'](handleEntityNotFound(_0x4f81c3,null))[_0x6e14('0x27')](respondWithResult(_0x4f81c3,null))[_0x6e14('0x4c')](handleError(_0x4f81c3,null));};exports[_0x6e14('0x4d')]=function(_0x40f8e3,_0x6daec1,_0x2944df){return db['Plugin']['find']({'where':{'id':_0x40f8e3[_0x6e14('0x4a')]['id']},'attributes':[_0x6e14('0x2c'),'path'],'raw':!![]})[_0x6e14('0x27')](handleEntityNotFound(_0x6daec1,null))['then'](function(_0x1477c8){if(_0x1477c8){var _0x5ebd71=path[_0x6e14('0x4e')](config[_0x6e14('0x4f')],_0x6e14('0x50'),util[_0x6e14('0x51')]('%s.zip',path[_0x6e14('0x52')](_0x1477c8[_0x6e14('0x7')])));var _0x22da7d=fs[_0x6e14('0x53')](_0x5ebd71);var _0x2da0f4=archiver(_0x6e14('0x54'),{'zlib':{'level':0x9}});_0x2da0f4['on'](_0x6e14('0x55'),function(_0xc52c4f){if(_0xc52c4f[_0x6e14('0x56')]===_0x6e14('0x57')){logger[_0x6e14('0x2b')](_0xc52c4f);}else{throw new db[(_0x6e14('0x58'))][(_0x6e14('0x59'))](_0x6e14('0x5a'));}});_0x2da0f4['on']('error',function(_0x3ca216){throw new db[(_0x6e14('0x58'))][(_0x6e14('0x59'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2da0f4[_0x6e14('0x5b')](_0x22da7d);_0x2da0f4[_0x6e14('0x5c')](_0x6e14('0x5d'),{'cwd':path[_0x6e14('0x4e')](config['root'],_0x6e14('0x50'),path[_0x6e14('0x5e')](_0x1477c8[_0x6e14('0x7')])),'ignore':[path[_0x6e14('0x4e')](path[_0x6e14('0x52')](_0x1477c8[_0x6e14('0x7')]),_0x6e14('0x5f')),path['join'](path['basename'](_0x1477c8[_0x6e14('0x7')]),'attachments/**/*')],'nodir':!![]})[_0x6e14('0x60')]();_0x22da7d['on']('close',function(){if(!fs[_0x6e14('0x61')](_0x5ebd71)){throw new db[(_0x6e14('0x58'))][(_0x6e14('0x59'))]('Plugin\x20not\x20found');}return _0x6daec1[_0x6e14('0x4d')](_0x5ebd71,util[_0x6e14('0x51')](_0x6e14('0x62'),path['basename'](_0x1477c8[_0x6e14('0x7')])),function(_0x16f3cc){if(_0x16f3cc){throw new db[(_0x6e14('0x58'))][(_0x6e14('0x59'))](_0x6e14('0x63'));}fs[_0x6e14('0x64')](_0x5ebd71);logger['info'](_0x6e14('0x65'));logger[_0x6e14('0x66')](_0x6e14('0x67'));});});}return null;})[_0x6e14('0x4c')](handleError(_0x6daec1,null));};exports[_0x6e14('0x68')]=function(_0x56b8ae,_0x2e5b7a,_0xf3dd3b){var _0x10e2d8=path[_0x6e14('0x52')](_0x56b8ae[_0x6e14('0x69')]['filename'],path[_0x6e14('0x6a')](_0x56b8ae[_0x6e14('0x69')][_0x6e14('0x6b')]));var _0x2376be=path[_0x6e14('0x4e')](config[_0x6e14('0x4f')],_0x6e14('0x50'),_0x56b8ae[_0x6e14('0x69')][_0x6e14('0x6b')]);var _0x586096=path[_0x6e14('0x4e')](config[_0x6e14('0x4f')],'server/files/plugins',_0x10e2d8);logger[_0x6e14('0x66')](_0x6e14('0x6c'),_0x2376be);logger[_0x6e14('0x66')](_0x6e14('0x6d'),_0x586096);try{fs[_0x6e14('0x6e')](_0x2376be,parseInt('0777',0x8));extract(_0x2376be,{'dir':_0x586096},function(_0x46fa81){if(_0x46fa81){logger[_0x6e14('0x2b')](_0x46fa81);handleError(_0x46fa81,!![]);};var _0x1748d2=fs[_0x6e14('0x6f')](_0x586096);if(_0x1748d2['length']>0x1){removeReferences(_0x2376be,_0x586096);logger['error'](_0x6e14('0x70'));return _0xf3dd3b(new Error('Invalid\x20plugin\x20structure'));}var _0x4d6fec=fs[_0x6e14('0x71')](path[_0x6e14('0x4e')](_0x586096,_0x1748d2[0x0]));if(_0x4d6fec[_0x6e14('0x72')]()){removeReferences(_0x2376be,_0x586096);logger['error'](_0x6e14('0x70'));return _0xf3dd3b(new Error(_0x6e14('0x70')));}if(_0x4d6fec[_0x6e14('0x73')]()){var _0x49bf73=fs[_0x6e14('0x6f')](path[_0x6e14('0x4e')](_0x586096,_0x1748d2[0x0]));if(_0x49bf73['length']===0x0){removeReferences(_0x2376be,_0x586096);logger[_0x6e14('0x2b')](_0x6e14('0x70'));return _0xf3dd3b(new Error('Invalid\x20plugin\x20structure'));}var _0x729ab2=_0x49bf73['some'](function(_0x47f01d){return _0x47f01d===_0x6e14('0x74');});if(!_0x729ab2){return _0xf3dd3b(new Error(_0x6e14('0x75')));}var _0x1488eb=fs[_0x6e14('0x76')](path[_0x6e14('0x4e')](_0x586096,_0x1748d2[0x0],_0x6e14('0x74')));var _0x53688a=JSON[_0x6e14('0x77')](_0x1488eb);if(_0x6e14('0x78')==typeof _0x53688a[_0x6e14('0x2c')]){return _0xf3dd3b(new Error(_0x6e14('0x79')));}if('undefined'==typeof _0x53688a[_0x6e14('0x43')]){return _0xf3dd3b(new Error(_0x6e14('0x7a')));}if(_0x6e14('0x78')==typeof _0x53688a[_0x6e14('0x7b')]){return _0xf3dd3b(new Error(_0x6e14('0x7c')));}if('undefined'==typeof _0x53688a['parameters']){return _0xf3dd3b(new Error(_0x6e14('0x7d')));}if(_0x53688a[_0x6e14('0x43')]===_0x6e14('0x7e')){if(_0x6e14('0x78')==typeof _0x53688a[_0x6e14('0x7f')][_0x6e14('0x80')]){return _0xf3dd3b(new Error(_0x6e14('0x81')));}if(_0x6e14('0x78')==typeof _0x53688a['parameters'][_0x6e14('0x80')][_0x6e14('0x82')]&&_0x6e14('0x78')==typeof _0x53688a['parameters'][_0x6e14('0x80')]['agent']){return _0xf3dd3b(new Error(_0x6e14('0x83')));}}else if(_0x53688a[_0x6e14('0x43')]===_0x6e14('0x84')){if(_0x6e14('0x78')==typeof _0x53688a[_0x6e14('0x7f')][_0x6e14('0x85')]){return _0xf3dd3b(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x6e14('0x78')==typeof _0x53688a[_0x6e14('0x7f')][_0x6e14('0x86')]){return _0xf3dd3b(new Error(_0x6e14('0x87')));}}else{return _0xf3dd3b(new Error(_0x6e14('0x88')));}var _0xc2e142=_0x53688a['name'];var _0x42b835=_0x53688a[_0x6e14('0x89')];var _0xc9cc2c=_0x53688a['type'];var _0x3f33d5=_0x53688a['sidebar']?_0x53688a['sidebar']:'always';var _0x501e29=_0x53688a['icon']?_0x53688a[_0x6e14('0x8a')]:_0x6e14('0x8b');var _0x56fa6e='';var _0x36aa82='';var _0x229d9d='';var _0x379f17='';var _0x3faf77=_0x53688a['version'];if(_0xc9cc2c===_0x6e14('0x7e')){if(_0x6e14('0x78')!=typeof _0x53688a[_0x6e14('0x7f')]['views'][_0x6e14('0x82')]){var _0x18d751=_0x53688a[_0x6e14('0x7f')]['views'][_0x6e14('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x6e14('0x8c')](_0x18d751)){_0x56fa6e=path[_0x6e14('0x4e')]('plugins',_0x10e2d8,_0x1748d2[0x0],_0x18d751);}else{_0x56fa6e=_0x18d751;}}else{logger[_0x6e14('0x66')](_0x6e14('0x8d'));}if(_0x6e14('0x78')!=typeof _0x53688a[_0x6e14('0x7f')][_0x6e14('0x80')][_0x6e14('0x8e')]){var _0x186091=_0x53688a[_0x6e14('0x7f')][_0x6e14('0x80')][_0x6e14('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x6e14('0x8c')](_0x186091)){_0x36aa82=path[_0x6e14('0x4e')](_0x6e14('0x8f'),_0x10e2d8,_0x1748d2[0x0],_0x186091);}else{_0x36aa82=_0x186091;}}else{logger[_0x6e14('0x66')](_0x6e14('0x90'));}}else if(_0xc9cc2c==='script'){_0x229d9d=_0x53688a[_0x6e14('0x7f')][_0x6e14('0x85')];_0x379f17=_0x53688a['parameters'][_0x6e14('0x86')];if(_0x6e14('0x78')!=typeof _0x53688a[_0x6e14('0x7f')][_0x6e14('0x80')]){if('undefined'!=typeof _0x53688a[_0x6e14('0x7f')][_0x6e14('0x80')][_0x6e14('0x82')]){var _0x18d751=_0x53688a['parameters'][_0x6e14('0x80')][_0x6e14('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x18d751)){_0x56fa6e=path[_0x6e14('0x4e')](_0x6e14('0x8f'),_0x10e2d8,_0x1748d2[0x0],_0x18d751);}else{_0x56fa6e=_0x18d751;}}if(_0x6e14('0x78')!=typeof _0x53688a['parameters'][_0x6e14('0x80')][_0x6e14('0x8e')]){var _0x186091=_0x53688a[_0x6e14('0x7f')][_0x6e14('0x80')][_0x6e14('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x6e14('0x8c')](_0x186091)){_0x36aa82=path[_0x6e14('0x4e')](_0x6e14('0x8f'),_0x10e2d8,_0x1748d2[0x0],_0x186091);}else{_0x36aa82=_0x186091;}}}}var _0x3a07ed={'name':_0xc2e142,'description':_0x42b835,'path':path['join'](_0x10e2d8,_0x1748d2[0x0]),'type':_0xc9cc2c,'sidebar':_0x3f33d5,'icon':_0x501e29,'adminUrl':_0x56fa6e,'agentUrl':_0x36aa82,'scriptName':_0x229d9d,'scriptPath':_0x379f17,'version':_0x3faf77};removeReferences(_0x2376be,null);return db['Plugin'][_0x6e14('0x91')](_0x3a07ed)[_0x6e14('0x27')](function(_0x3fd811){var _0x554efe={'role':_0x56b8ae['body']['role'],'userProfileId':_0x56b8ae[_0x6e14('0x92')][_0x6e14('0x93')]};if(!_0x554efe)throw new Error(_0x6e14('0x94'));if(_0x554efe['role']===_0x6e14('0x95')){var _0x18a12c=_0x3fd811[_0x6e14('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x6e14('0x4b')]({'where':{'name':_0x6e14('0x29'),'userProfileId':_0x554efe[_0x6e14('0x93')]},'raw':!![]})[_0x6e14('0x27')](function(_0x57b0d1){if(_0x57b0d1&&_0x57b0d1[_0x6e14('0x96')]===0x0){return db['UserProfileResource'][_0x6e14('0x91')]({'name':_0x18a12c[_0x6e14('0x2c')],'resourceId':_0x18a12c['id'],'type':_0x57b0d1[_0x6e14('0x2c')],'sectionId':_0x57b0d1['id']},{})['then'](function(){return _0x3fd811;});}else{return _0x3fd811;}})[_0x6e14('0x4c')](function(_0x3d441f){logger[_0x6e14('0x2b')](_0x6e14('0x97'),_0x3d441f);throw _0x3d441f;});}return _0x3fd811;})[_0x6e14('0x27')](respondWithResult(_0x2e5b7a,null))[_0x6e14('0x4c')](handleError(_0x2e5b7a,null));}});}catch(_0x341994){_0x2e5b7a[_0x6e14('0x1f')](0x1f4)[_0x6e14('0x2d')](_0x341994);}};function removeReferences(_0x373947,_0x685c5b){try{if(_0x373947){fs[_0x6e14('0x64')](_0x373947);logger[_0x6e14('0x66')](_0x6e14('0x98'));}if(_0x685c5b){rimraf(_0x685c5b,function(){});logger[_0x6e14('0x66')](_0x6e14('0x99'));}}catch(_0x5a9c1d){logger[_0x6e14('0x2b')](_0x5a9c1d);}}exports[_0x6e14('0x9a')]=function(_0xebd931,_0x344433,_0x4c72ff){return db['Plugin'][_0x6e14('0x4b')]({'where':{'id':_0xebd931[_0x6e14('0x4a')]['id']}})[_0x6e14('0x27')](handleEntityNotFound(_0x344433,null))['then'](saveUpdates(_0xebd931['body'],null))[_0x6e14('0x27')](respondWithResult(_0x344433,null))[_0x6e14('0x4c')](handleError(_0x344433,null));};exports[_0x6e14('0x9b')]=function(_0x33ef3d,_0x9c46d4,_0x554e92){return db[_0x6e14('0x30')][_0x6e14('0x4b')]({'where':{'id':_0x33ef3d['params']['id']}})['then'](function(_0x4b5852){if(_0x4b5852){return _0x4b5852[_0x6e14('0x9c')]();}})['then'](function(_0x4bafd2){rimraf(path['join'](config[_0x6e14('0x4f')],_0x6e14('0x50'),path[_0x6e14('0x5e')](_0x4bafd2['path'])),function(){});return _0x4bafd2;})['then'](handleEntityNotFound(_0x9c46d4,null))['then'](respondWithStatusCode(_0x9c46d4,null))[_0x6e14('0x4c')](handleError(_0x9c46d4,null));};exports[_0x6e14('0x9d')]=function(_0x59f8db,_0x3227c8,_0xd7adeb){return BPromise['resolve']()['then'](function(){if(!_0x59f8db['query']['path']){throw new Error(_0x6e14('0x9e'));}if(!_0x59f8db[_0x6e14('0x36')][_0x6e14('0x9f')]){throw new Error(_0x6e14('0xa0'));}var _0x4336f7=_0x59f8db[_0x6e14('0x36')][_0x6e14('0xa1')]?_0x59f8db[_0x6e14('0x36')][_0x6e14('0xa1')]+':'+_0x59f8db[_0x6e14('0x36')]['port']:'http://localhost:'+_0x59f8db[_0x6e14('0x36')][_0x6e14('0x9f')];var _0x6f6867=_0x59f8db[_0x6e14('0x36')][_0x6e14('0x20')]?_0x59f8db[_0x6e14('0x36')][_0x6e14('0x20')]:!![];var _0x5a593e=_0x59f8db[_0x6e14('0x36')][_0x6e14('0xa2')]?_0x59f8db[_0x6e14('0x36')][_0x6e14('0xa2')]:null;var _0x4c34e4={'method':_0x59f8db[_0x6e14('0xa3')],'uri':util[_0x6e14('0x51')](_0x6e14('0xa4'),_0x4336f7,_0x59f8db[_0x6e14('0x36')]['path']),'json':_0x6f6867,'resolveWithFullResponse':!![],'encoding':_0x5a593e,'qs':_0x59f8db[_0x6e14('0x36')]};if(_0x59f8db[_0x6e14('0xa5')]){_0x4c34e4[_0x6e14('0xa5')]=_0x59f8db['headers'];if(_0x4c34e4[_0x6e14('0xa5')]['content-length']){delete _0x4c34e4[_0x6e14('0xa5')][_0x6e14('0xa6')];}}if(_0x4c34e4[_0x6e14('0xa5')][_0x6e14('0xa7')]){delete _0x4c34e4[_0x6e14('0xa5')][_0x6e14('0xa7')];}return rp(_0x4c34e4);})[_0x6e14('0x27')](function(_0x1e5776){if(_0x1e5776){_0x3227c8[_0x6e14('0x24')](_0x1e5776[_0x6e14('0xa5')]);logger[_0x6e14('0x66')](_0x1e5776[_0x6e14('0x92')]);if(_['endsWith'](_0x59f8db[_0x6e14('0x36')]['path'],_0x6e14('0x4d'))&&_0x1e5776[_0x6e14('0xa8')]==0x1f4){return _0x3227c8[_0x6e14('0x1e')](_0x1e5776['statusCode']);}else{return _0x3227c8[_0x6e14('0x1f')](_0x1e5776[_0x6e14('0xa8')])[_0x6e14('0x2d')](_0x1e5776[_0x6e14('0x92')]);}}else{return _0x3227c8[_0x6e14('0x1e')](0xc8);}})['catch'](handleError(_0x3227c8,null));};exports[_0x6e14('0xa9')]=function(_0x19be57,_0x2c7f17,_0x262101){return BPromise[_0x6e14('0xaa')]()[_0x6e14('0x27')](function(){if(!_0x19be57[_0x6e14('0x36')][_0x6e14('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x19be57[_0x6e14('0x36')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x59ffd9=_0x19be57[_0x6e14('0x36')][_0x6e14('0xa1')]?_0x19be57[_0x6e14('0x36')][_0x6e14('0xa1')]+':'+_0x19be57['query']['port']:_0x6e14('0xab')+_0x19be57[_0x6e14('0x36')][_0x6e14('0x9f')];var _0x1ae11a=_0x19be57[_0x6e14('0x36')][_0x6e14('0x20')]?_0x19be57[_0x6e14('0x36')]['json']:!![];var _0x5dccb7=_0x19be57[_0x6e14('0x36')][_0x6e14('0xa2')]?_0x19be57['query']['encoding']:null;var _0x597c2d={'method':_0x19be57[_0x6e14('0xa3')],'uri':util[_0x6e14('0x51')]('%s%s',_0x59ffd9,_0x19be57[_0x6e14('0x36')][_0x6e14('0x7')]),'json':_0x1ae11a,'resolveWithFullResponse':!![],'encoding':_0x5dccb7,'body':_0x19be57[_0x6e14('0x92')]};if(_0x19be57[_0x6e14('0xa5')]){_0x597c2d[_0x6e14('0xa5')]=_0x19be57[_0x6e14('0xa5')];if(_0x597c2d['headers'][_0x6e14('0xa6')]){delete _0x597c2d[_0x6e14('0xa5')]['content-length'];}}if(_0x597c2d[_0x6e14('0xa5')][_0x6e14('0xa7')]){delete _0x597c2d[_0x6e14('0xa5')][_0x6e14('0xa7')];}return rp(_0x597c2d);})[_0x6e14('0x27')](function(_0x236bb4){if(_0x236bb4){_0x2c7f17[_0x6e14('0x24')](_0x236bb4[_0x6e14('0xa5')]);logger[_0x6e14('0x66')](_0x236bb4[_0x6e14('0x92')]);return _0x2c7f17[_0x6e14('0x1f')](_0x236bb4[_0x6e14('0xa8')])[_0x6e14('0x2d')](_0x236bb4[_0x6e14('0x92')]);}else{return _0x2c7f17['sendStatus'](0xc8);}})[_0x6e14('0x4c')](handleError(_0x2c7f17,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 05dc90e..e13511a 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 _0x6a55=['hasOwnProperty','hook','exports','events','save','emit'];(function(_0xc70a7f,_0x54be61){var _0x1d529b=function(_0x184a71){while(--_0x184a71){_0xc70a7f['push'](_0xc70a7f['shift']());}};_0x1d529b(++_0x54be61);}(_0x6a55,0xdb));var _0x56a5=function(_0x3bee55,_0x4e25c8){_0x3bee55=_0x3bee55-0x0;var _0x5649d2=_0x6a55[_0x3bee55];return _0x5649d2;};'use strict';var EventEmitter=require(_0x56a5('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x56a5('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x116199){return function(_0x5e5a32,_0x3ff76a,_0x5171fa){PluginEvents[_0x56a5('0x2')](_0x116199+':'+_0x5e5a32['id'],_0x5e5a32);PluginEvents[_0x56a5('0x2')](_0x116199,_0x5e5a32);_0x5171fa(null);};}for(var e in events){if(events[_0x56a5('0x3')](e)){var event=events[e];Plugin[_0x56a5('0x4')](e,emitEvent(event));}}module[_0x56a5('0x5')]=PluginEvents; \ No newline at end of file +var _0x4bd3=['events','Plugin','setMaxListeners','emit','hook','exports'];(function(_0x15df0b,_0x204724){var _0x37615a=function(_0xa9a214){while(--_0xa9a214){_0x15df0b['push'](_0x15df0b['shift']());}};_0x37615a(++_0x204724);}(_0x4bd3,0x174));var _0x34bd=function(_0x407c68,_0x232afd){_0x407c68=_0x407c68-0x0;var _0x434724=_0x4bd3[_0x407c68];return _0x434724;};'use strict';var EventEmitter=require(_0x34bd('0x0'));var Plugin=require('../../mysqldb')['db'][_0x34bd('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x34bd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22b921){return function(_0x44854a,_0x1fc8eb,_0x5846f3){PluginEvents[_0x34bd('0x3')](_0x22b921+':'+_0x44854a['id'],_0x44854a);PluginEvents[_0x34bd('0x3')](_0x22b921,_0x44854a);_0x5846f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x34bd('0x4')](e,emitEvent(event));}}module[_0x34bd('0x5')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 54fe32e..d8a77fa 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 _0x4bc3=['./plugin.attributes','exports','define','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4acf22,_0x46e90d){var _0x382928=function(_0x24573a){while(--_0x24573a){_0x4acf22['push'](_0x4acf22['shift']());}};_0x382928(++_0x46e90d);}(_0x4bc3,0x16e));var _0x34bc=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x4bc3[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var logger=require('../../config/logger')(_0x34bc('0x2'));var moment=require(_0x34bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x34bc('0x4'));var fs=require('fs');var path=require(_0x34bc('0x5'));var rimraf=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var attributes=require(_0x34bc('0x8'));module[_0x34bc('0x9')]=function(_0x2cc9c2,_0x4c63a1){return _0x2cc9c2[_0x34bc('0xa')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['plugins','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin'];(function(_0x228322,_0x18e9ec){var _0x401d82=function(_0xed2f16){while(--_0xed2f16){_0x228322['push'](_0x228322['shift']());}};_0x401d82(++_0x18e9ec);}(_0x34e8,0x12c));var _0x834e=function(_0x142356,_0x90ad9d){_0x142356=_0x142356-0x0;var _0x98563e=_0x34e8[_0x142356];return _0x98563e;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('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 a00d271..915a8fe 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 _0xc523=['then','info','request\x20sent','debug','error','code','Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','Plugin','create','options','raw','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request'];(function(_0x229101,_0x31339d){var _0xc93cb=function(_0x461394){while(--_0x461394){_0x229101['push'](_0x229101['shift']());}};_0xc93cb(++_0x31339d);}(_0xc523,0x1ca));var _0x3c52=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0xc523[_0x3b4b1d];return _0x488c36;};'use strict';var _=require('lodash');var util=require(_0x3c52('0x0'));var moment=require(_0x3c52('0x1'));var BPromise=require(_0x3c52('0x2'));var rs=require(_0x3c52('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c52('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c52('0x5'))(_0x3c52('0x6'));var config=require(_0x3c52('0x7'));var jayson=require(_0x3c52('0x8'));var client=jayson[_0x3c52('0x9')][_0x3c52('0xa')]({'port':0x232a});config[_0x3c52('0xb')]=_[_0x3c52('0xc')](config['redis'],{'host':_0x3c52('0xd'),'port':0x18eb});var socket=require(_0x3c52('0xe'))(new Redis(config[_0x3c52('0xb')]));require(_0x3c52('0xf'))[_0x3c52('0x10')](socket);function respondWithRpcPromise(_0x399cfd,_0x239039,_0x2b8ff1){return new BPromise(function(_0x30031f,_0x440fe2){return client[_0x3c52('0x11')](_0x399cfd,_0x2b8ff1)[_0x3c52('0x12')](function(_0x437070){logger[_0x3c52('0x13')]('Plugin,\x20%s,\x20%s',_0x239039,_0x3c52('0x14'));logger[_0x3c52('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x239039,_0x3c52('0x14'),JSON['stringify'](_0x437070));if(_0x437070['error']){if(_0x437070[_0x3c52('0x16')][_0x3c52('0x17')]===0x1f4){logger[_0x3c52('0x16')](_0x3c52('0x18'),_0x239039,_0x437070[_0x3c52('0x16')][_0x3c52('0x19')]);return _0x440fe2(_0x437070[_0x3c52('0x16')][_0x3c52('0x19')]);}logger[_0x3c52('0x16')](_0x3c52('0x18'),_0x239039,_0x437070['error']['message']);return _0x30031f(_0x437070['error'][_0x3c52('0x19')]);}else{logger[_0x3c52('0x13')]('Plugin,\x20%s,\x20%s',_0x239039,_0x3c52('0x14'));_0x30031f(_0x437070[_0x3c52('0x1a')][_0x3c52('0x19')]);}})[_0x3c52('0x1b')](function(_0x29693e){logger['error'](_0x3c52('0x18'),_0x239039,_0x29693e);_0x440fe2(_0x29693e);});});}exports[_0x3c52('0x1c')]=function(_0x5b1b8b){var _0x117eec=this;return new Promise(function(_0x252ae9,_0x38290b){return db[_0x3c52('0x1d')][_0x3c52('0x1e')](_0x5b1b8b['body'],{'raw':_0x5b1b8b[_0x3c52('0x1f')]?_0x5b1b8b[_0x3c52('0x1f')][_0x3c52('0x20')]===undefined?!![]:![]:!![]})[_0x3c52('0x12')](function(_0x285caf){logger[_0x3c52('0x13')]('CreatePlugin',_0x5b1b8b);logger[_0x3c52('0x15')]('CreatePlugin',_0x5b1b8b,JSON[_0x3c52('0x21')](_0x285caf));_0x252ae9(_0x285caf);})['catch'](function(_0x441063){logger[_0x3c52('0x16')](_0x3c52('0x1c'),_0x441063[_0x3c52('0x19')],_0x5b1b8b);_0x38290b(_0x117eec[_0x3c52('0x16')](0x1f4,_0x441063['message']));});});}; \ No newline at end of file +var _0x05d6=['error','code','message','result','CreatePlugin','create','body','options','raw','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x58e9d6,_0x3d05af){var _0x5d0762=function(_0x158e24){while(--_0x158e24){_0x58e9d6['push'](_0x58e9d6['shift']());}};_0x5d0762(++_0x3d05af);}(_0x05d6,0x1de));var _0x605d=function(_0x24548f,_0x1f6e4a){_0x24548f=_0x24548f-0x0;var _0x2d7c3f=_0x05d6[_0x24548f];return _0x2d7c3f;};'use strict';var _=require(_0x605d('0x0'));var util=require('util');var moment=require(_0x605d('0x1'));var BPromise=require(_0x605d('0x2'));var rs=require(_0x605d('0x3'));var fs=require('fs');var Redis=require(_0x605d('0x4'));var db=require(_0x605d('0x5'))['db'];var utils=require(_0x605d('0x6'));var logger=require(_0x605d('0x7'))(_0x605d('0x8'));var config=require(_0x605d('0x9'));var jayson=require(_0x605d('0xa'));var client=jayson['client'][_0x605d('0xb')]({'port':0x232a});config[_0x605d('0xc')]=_[_0x605d('0xd')](config[_0x605d('0xc')],{'host':_0x605d('0xe'),'port':0x18eb});var socket=require(_0x605d('0xf'))(new Redis(config['redis']));require(_0x605d('0x10'))[_0x605d('0x11')](socket);function respondWithRpcPromise(_0x1bb83f,_0x2c4271,_0x3ab6e1){return new BPromise(function(_0x2aba8e,_0x25632c){return client[_0x605d('0x12')](_0x1bb83f,_0x3ab6e1)[_0x605d('0x13')](function(_0x249576){logger[_0x605d('0x14')](_0x605d('0x15'),_0x2c4271,_0x605d('0x16'));logger[_0x605d('0x17')](_0x605d('0x18'),_0x2c4271,_0x605d('0x16'),JSON[_0x605d('0x19')](_0x249576));if(_0x249576[_0x605d('0x1a')]){if(_0x249576[_0x605d('0x1a')][_0x605d('0x1b')]===0x1f4){logger[_0x605d('0x1a')](_0x605d('0x15'),_0x2c4271,_0x249576[_0x605d('0x1a')]['message']);return _0x25632c(_0x249576['error'][_0x605d('0x1c')]);}logger[_0x605d('0x1a')](_0x605d('0x15'),_0x2c4271,_0x249576[_0x605d('0x1a')][_0x605d('0x1c')]);return _0x2aba8e(_0x249576['error']['message']);}else{logger[_0x605d('0x14')](_0x605d('0x15'),_0x2c4271,_0x605d('0x16'));_0x2aba8e(_0x249576[_0x605d('0x1d')][_0x605d('0x1c')]);}})['catch'](function(_0x592ec7){logger[_0x605d('0x1a')](_0x605d('0x15'),_0x2c4271,_0x592ec7);_0x25632c(_0x592ec7);});});}exports[_0x605d('0x1e')]=function(_0x2a6686){var _0xaf5df4=this;return new Promise(function(_0x537c34,_0xbc79fd){return db['Plugin'][_0x605d('0x1f')](_0x2a6686[_0x605d('0x20')],{'raw':_0x2a6686[_0x605d('0x21')]?_0x2a6686[_0x605d('0x21')][_0x605d('0x22')]===undefined?!![]:![]:!![]})[_0x605d('0x13')](function(_0x5132c6){logger[_0x605d('0x14')](_0x605d('0x1e'),_0x2a6686);logger[_0x605d('0x17')](_0x605d('0x1e'),_0x2a6686,JSON['stringify'](_0x5132c6));_0x537c34(_0x5132c6);})[_0x605d('0x23')](function(_0x9bbe75){logger[_0x605d('0x1a')](_0x605d('0x1e'),_0x9bbe75[_0x605d('0x1c')],_0x2a6686);_0xbc79fd(_0xaf5df4[_0x605d('0x1a')](0x1f4,_0x9bbe75[_0x605d('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 228fc7c..f6f8ddb 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 _0x1eb4=['plugin:','save','remove','update','emit','register','length'];(function(_0x2a9c99,_0x28d7fb){var _0x5aabae=function(_0x2f267f){while(--_0x2f267f){_0x2a9c99['push'](_0x2a9c99['shift']());}};_0x5aabae(++_0x28d7fb);}(_0x1eb4,0x158));var _0x41eb=function(_0x39834f,_0x5939c8){_0x39834f=_0x39834f-0x0;var _0x5ae226=_0x1eb4[_0x39834f];return _0x5ae226;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x41eb('0x0'),_0x41eb('0x1'),_0x41eb('0x2')];function createListener(_0x971583,_0x25fb4c){return function(_0x17c125){_0x25fb4c[_0x41eb('0x3')](_0x971583,_0x17c125);};}function removeListener(_0x1ee197,_0x1e33f9){return function(){PluginEvents['removeListener'](_0x1ee197,_0x1e33f9);};}exports[_0x41eb('0x4')]=function(_0x56a695){for(var _0x43c280=0x0,_0x4bea2e=events[_0x41eb('0x5')];_0x43c280<_0x4bea2e;_0x43c280++){var _0x92acfa=events[_0x43c280];var _0x2f42fd=createListener(_0x41eb('0x6')+_0x92acfa,_0x56a695);PluginEvents['on'](_0x92acfa,_0x2f42fd);}}; \ No newline at end of file +var _0x3a29=['plugin:','./plugin.events','save','remove','update','removeListener','register','length'];(function(_0x3a8eb8,_0x30cd2b){var _0xe20633=function(_0x2249e2){while(--_0x2249e2){_0x3a8eb8['push'](_0x3a8eb8['shift']());}};_0xe20633(++_0x30cd2b);}(_0x3a29,0x199));var _0x93a2=function(_0xc1d559,_0x42ca0d){_0xc1d559=_0xc1d559-0x0;var _0x57e6ee=_0x3a29[_0xc1d559];return _0x57e6ee;};'use strict';var PluginEvents=require(_0x93a2('0x0'));var events=[_0x93a2('0x1'),_0x93a2('0x2'),_0x93a2('0x3')];function createListener(_0x55079b,_0x332384){return function(_0x2eea60){_0x332384['emit'](_0x55079b,_0x2eea60);};}function removeListener(_0x31b944,_0x2e0daf){return function(){PluginEvents[_0x93a2('0x4')](_0x31b944,_0x2e0daf);};}exports[_0x93a2('0x5')]=function(_0x319cf0){for(var _0xa73dd5=0x0,_0x15ad38=events[_0x93a2('0x6')];_0xa73dd5<_0x15ad38;_0xa73dd5++){var _0x1c55f4=events[_0xa73dd5];var _0x174b90=createListener(_0x93a2('0x7')+_0x1c55f4,_0x319cf0);PluginEvents['on'](_0x1c55f4,_0x174b90);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 7a8fc87..57bc13f 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 _0x8f16=['create','put','/:id','update','delete','destroy','express','get','isAuthenticated','index','post'];(function(_0x19e316,_0x13394c){var _0x1245dc=function(_0x5d477a){while(--_0x5d477a){_0x19e316['push'](_0x19e316['shift']());}};_0x1245dc(++_0x13394c);}(_0x8f16,0x95));var _0x68f1=function(_0x2a77ff,_0x3a389f){_0x2a77ff=_0x2a77ff-0x0;var _0x453d6a=_0x8f16[_0x2a77ff];return _0x453d6a;};'use strict';var express=require(_0x68f1('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router[_0x68f1('0x1')]('/',auth[_0x68f1('0x2')](),controller[_0x68f1('0x3')]);router['get']('/:id',auth[_0x68f1('0x2')](),controller['show']);router[_0x68f1('0x4')]('/',auth[_0x68f1('0x2')](),controller[_0x68f1('0x5')]);router[_0x68f1('0x6')](_0x68f1('0x7'),auth[_0x68f1('0x2')](),controller[_0x68f1('0x8')]);router[_0x68f1('0x9')](_0x68f1('0x7'),auth['isAuthenticated'](),controller[_0x68f1('0xa')]);module['exports']=router; \ No newline at end of file +var _0x8f59=['destroy','exports','../../components/auth/service','./pm2.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x8f59,0x91));var _0x98f5=function(_0xfb8f31,_0x2d3880){_0xfb8f31=_0xfb8f31-0x0;var _0x28b6e0=_0x8f59[_0xfb8f31];return _0x28b6e0;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x98f5('0x0'));var controller=require(_0x98f5('0x1'));router[_0x98f5('0x2')]('/',auth[_0x98f5('0x3')](),controller['index']);router[_0x98f5('0x2')]('/:id',auth['isAuthenticated'](),controller[_0x98f5('0x4')]);router[_0x98f5('0x5')]('/',auth['isAuthenticated'](),controller[_0x98f5('0x6')]);router[_0x98f5('0x7')]('/:id',auth[_0x98f5('0x3')](),controller[_0x98f5('0x8')]);router[_0x98f5('0x9')](_0x98f5('0xa'),auth[_0x98f5('0x3')](),controller[_0x98f5('0xb')]);module[_0x98f5('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 9646693..2f8da88 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 _0x6172=['npm\x20install','info','then','reject','express','length','catch','show','params','create','body','script','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','sendStatus','status','json','error','stack','name','send'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6172,0xa3));var _0x2617=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6172[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2617('0x0'));var pm2=require(_0x2617('0x1'));var logger=require(_0x2617('0x2'))('api');var path=require(_0x2617('0x3'));var exec=require(_0x2617('0x4'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x4331a3,_0x15509f){return function(_0x1a785c){if(!_0x1a785c){_0x4331a3[_0x2617('0x5')](0x194);;}return _0x1a785c;};}function respondWithResult(_0x3fc0a7,_0xf9eba2){_0xf9eba2=_0xf9eba2||0xc8;return function(_0x1d1f5a){if(_0x1d1f5a){return _0x3fc0a7[_0x2617('0x6')](_0xf9eba2)[_0x2617('0x7')](_0x1d1f5a);}return null;};}function handleError(_0x253911,_0x95582){_0x95582=_0x95582||0x1f4;return function(_0x32dd65){logger[_0x2617('0x8')](_0x32dd65[_0x2617('0x9')]);if(_0x32dd65[_0x2617('0xa')]){delete _0x32dd65[_0x2617('0xa')];}_0x253911[_0x2617('0x6')](_0x95582)[_0x2617('0xb')](_0x32dd65);};}function execChildProcess(){return new BPromise(function(_0x24098c,_0x1a3012){exec(_0x2617('0xc'),function(_0x1ebd1f,_0x359b59,_0x1f3df1){logger['info'](_0x359b59);logger[_0x2617('0xd')](_0x1f3df1);if(_0x1ebd1f){logger[_0x2617('0x8')](_0x1ebd1f);return _0x1a3012(_0x1ebd1f);}return _0x24098c(_0x359b59);});});}exports['index']=function(_0x336323,_0x2f56ab){return pm2['list']()[_0x2617('0xe')](function(_0x4b6d52){if(_0x4b6d52){var _0x3f1d3c=_[_0x2617('0xf')](_0x4b6d52,function(_0x11a675){return _0x11a675[_0x2617('0xa')]===_0x2617('0x10')||_0x11a675[_0x2617('0xa')]==='motion2';});return{'rows':_0x3f1d3c,'count':_0x3f1d3c[_0x2617('0x11')]};}return null;})['then'](respondWithResult(_0x2f56ab,null))[_0x2617('0x12')](handleError(_0x2f56ab,null));};exports[_0x2617('0x13')]=function(_0x28a6e8,_0x7ee075){return pm2['describe'](_0x28a6e8[_0x2617('0x14')]['id'])[_0x2617('0xe')](respondWithResult(_0x7ee075,null))[_0x2617('0xe')](handleEntityNotFound(_0x7ee075,null))[_0x2617('0x12')](handleError(_0x7ee075,null));};exports[_0x2617('0x15')]=function(_0x583808,_0x2d66b6){if(_0x583808[_0x2617('0x16')]['name']&&_0x583808[_0x2617('0x16')][_0x2617('0x17')]){var _0x41cb00=path['join'](__dirname,_0x2617('0x18'),_0x583808[_0x2617('0x16')][_0x2617('0x17')]);var _0x5c8129=process[_0x2617('0x19')]();process['chdir'](path[_0x2617('0x1a')](_0x41cb00));return execChildProcess()[_0x2617('0xe')](function(_0x3bcded){process[_0x2617('0x1b')](_0x5c8129);return pm2['start']({'name':_0x583808[_0x2617('0x16')][_0x2617('0xa')],'script':_0x41cb00});})[_0x2617('0xe')](function(_0xbe13d2){pm2[_0x2617('0x1c')]();return _0xbe13d2[0x0];})[_0x2617('0xe')](respondWithResult(_0x2d66b6,0xc9))[_0x2617('0x12')](handleError(_0x2d66b6,null));}else{return _0x2d66b6[_0x2617('0x6')](0x1f4)[_0x2617('0xb')]({'message':_0x2617('0x1d')});}};exports[_0x2617('0x1e')]=function(_0x120bbd,_0x14ea46){if(_0x120bbd[_0x2617('0x16')]['id']){delete _0x120bbd[_0x2617('0x16')]['id'];}var _0xa39474={'online':_0x2617('0x1f'),'stopped':'stop'};if(_0xa39474[_0x2617('0x20')](_0x120bbd['body'][_0x2617('0x6')])){return pm2[_0xa39474[_0x120bbd['body'][_0x2617('0x6')]]](_0x120bbd[_0x2617('0x14')]['id'])[_0x2617('0xe')](respondWithResult(_0x14ea46,0xc8))['catch'](handleError(_0x14ea46,null));}else{return _0x14ea46[_0x2617('0x6')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0x2617('0x21')]=function(_0x5697c5,_0x38f908){if(_0x5697c5[_0x2617('0x16')]['id']){delete _0x5697c5[_0x2617('0x16')]['id'];}if(_0x5697c5[_0x2617('0x14')]['id']){return pm2['delete'](_0x5697c5['params']['id'])[_0x2617('0xe')](function(_0x63843e){pm2[_0x2617('0x1c')]();return _0x63843e[0x0];})[_0x2617('0xe')](respondWithResult(_0x38f908,null))[_0x2617('0x12')](handleError(_0x38f908,null));}else{return _0x38f908['status'](0x1f4)[_0x2617('0xb')]({'message':_0x2617('0x22')});}}; \ No newline at end of file +var _0xa00a=['show','params','create','body','join','../../files/plugins','cwd','chdir','dirname','start','dump','status','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20status','destroy','delete','../../config/pm2','api','path','sendStatus','json','stack','name','send','info','error','index','list','then','length','catch'];(function(_0x305b81,_0x47c0cc){var _0x12e30b=function(_0x24f5e6){while(--_0x24f5e6){_0x305b81['push'](_0x305b81['shift']());}};_0x12e30b(++_0x47c0cc);}(_0xa00a,0xf9));var _0xaa00=function(_0x128f1a,_0x3eb021){_0x128f1a=_0x128f1a-0x0;var _0x493d3a=_0xa00a[_0x128f1a];return _0x493d3a;};'use strict';var _=require('lodash');var pm2=require(_0xaa00('0x0'));var logger=require('../../config/logger')(_0xaa00('0x1'));var path=require(_0xaa00('0x2'));var exec=require('child_process')['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x9815f6,_0x537cfd){return function(_0x496866){if(!_0x496866){_0x9815f6[_0xaa00('0x3')](0x194);;}return _0x496866;};}function respondWithResult(_0x3663ee,_0x273ab1){_0x273ab1=_0x273ab1||0xc8;return function(_0x47ce01){if(_0x47ce01){return _0x3663ee['status'](_0x273ab1)[_0xaa00('0x4')](_0x47ce01);}return null;};}function handleError(_0x1a27f9,_0x1f30fa){_0x1f30fa=_0x1f30fa||0x1f4;return function(_0x58be3c){logger['error'](_0x58be3c[_0xaa00('0x5')]);if(_0x58be3c[_0xaa00('0x6')]){delete _0x58be3c[_0xaa00('0x6')];}_0x1a27f9['status'](_0x1f30fa)[_0xaa00('0x7')](_0x58be3c);};}function execChildProcess(){return new BPromise(function(_0x55de42,_0x10b99e){exec('npm\x20install',function(_0x1aa5a1,_0x33f06a,_0x41ea74){logger[_0xaa00('0x8')](_0x33f06a);logger[_0xaa00('0x8')](_0x41ea74);if(_0x1aa5a1){logger[_0xaa00('0x9')](_0x1aa5a1);return _0x10b99e(_0x1aa5a1);}return _0x55de42(_0x33f06a);});});}exports[_0xaa00('0xa')]=function(_0x1a66d0,_0x50167c){return pm2[_0xaa00('0xb')]()[_0xaa00('0xc')](function(_0x24b2b3){if(_0x24b2b3){var _0x3e1882=_['reject'](_0x24b2b3,function(_0x2561c5){return _0x2561c5[_0xaa00('0x6')]==='express'||_0x2561c5['name']==='motion2';});return{'rows':_0x3e1882,'count':_0x3e1882[_0xaa00('0xd')]};}return null;})[_0xaa00('0xc')](respondWithResult(_0x50167c,null))[_0xaa00('0xe')](handleError(_0x50167c,null));};exports[_0xaa00('0xf')]=function(_0xf9c1c9,_0x5ccd05){return pm2['describe'](_0xf9c1c9[_0xaa00('0x10')]['id'])[_0xaa00('0xc')](respondWithResult(_0x5ccd05,null))[_0xaa00('0xc')](handleEntityNotFound(_0x5ccd05,null))[_0xaa00('0xe')](handleError(_0x5ccd05,null));};exports[_0xaa00('0x11')]=function(_0x27cc1b,_0x5c7f5e){if(_0x27cc1b[_0xaa00('0x12')][_0xaa00('0x6')]&&_0x27cc1b['body']['script']){var _0xf27def=path[_0xaa00('0x13')](__dirname,_0xaa00('0x14'),_0x27cc1b['body']['script']);var _0xa62c7=process[_0xaa00('0x15')]();process[_0xaa00('0x16')](path[_0xaa00('0x17')](_0xf27def));return execChildProcess()[_0xaa00('0xc')](function(_0x4a159c){process[_0xaa00('0x16')](_0xa62c7);return pm2[_0xaa00('0x18')]({'name':_0x27cc1b[_0xaa00('0x12')][_0xaa00('0x6')],'script':_0xf27def});})[_0xaa00('0xc')](function(_0x310c30){pm2[_0xaa00('0x19')]();return _0x310c30[0x0];})[_0xaa00('0xc')](respondWithResult(_0x5c7f5e,0xc9))[_0xaa00('0xe')](handleError(_0x5c7f5e,null));}else{return _0x5c7f5e[_0xaa00('0x1a')](0x1f4)[_0xaa00('0x7')]({'message':_0xaa00('0x1b')});}};exports['update']=function(_0x33e7be,_0x288af5){if(_0x33e7be[_0xaa00('0x12')]['id']){delete _0x33e7be[_0xaa00('0x12')]['id'];}var _0x54c26b={'online':_0xaa00('0x1c'),'stopped':_0xaa00('0x1d')};if(_0x54c26b['hasOwnProperty'](_0x33e7be[_0xaa00('0x12')][_0xaa00('0x1a')])){return pm2[_0x54c26b[_0x33e7be[_0xaa00('0x12')]['status']]](_0x33e7be[_0xaa00('0x10')]['id'])[_0xaa00('0xc')](respondWithResult(_0x288af5,0xc8))['catch'](handleError(_0x288af5,null));}else{return _0x288af5[_0xaa00('0x1a')](0x1f4)['send']({'message':_0xaa00('0x1e')});}};exports[_0xaa00('0x1f')]=function(_0x3a3af1,_0x1f524e){if(_0x3a3af1['body']['id']){delete _0x3a3af1[_0xaa00('0x12')]['id'];}if(_0x3a3af1[_0xaa00('0x10')]['id']){return pm2[_0xaa00('0x20')](_0x3a3af1[_0xaa00('0x10')]['id'])[_0xaa00('0xc')](function(_0xee28ec){pm2[_0xaa00('0x19')]();return _0xee28ec[0x0];})[_0xaa00('0xc')](respondWithResult(_0x1f524e,null))['catch'](handleError(_0x1f524e,null));}else{return _0x1f524e[_0xaa00('0x1a')](0x1f4)[_0xaa00('0x7')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index c77b861..560f34b 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 _0x7d21=['exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x291404,_0x2d0e52){var _0x5a26bb=function(_0x57605c){while(--_0x57605c){_0x291404['push'](_0x291404['shift']());}};_0x5a26bb(++_0x2d0e52);}(_0x7d21,0x8b));var _0x17d2=function(_0x11c5a4,_0x1be848){_0x11c5a4=_0x11c5a4-0x0;var _0x15562c=_0x7d21[_0x11c5a4];return _0x15562c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x17d2('0x0'));var timeout=require(_0x17d2('0x1'));var express=require('express');var router=express[_0x17d2('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x17d2('0x3'));var config=require(_0x17d2('0x4'));module[_0x17d2('0x5')]=router; \ No newline at end of file +var _0xdf3e=['../../components/interaction/service','../../config/environment','util','connect-timeout','Router','../../components/auth/service'];(function(_0x2e1280,_0x45f975){var _0x376723=function(_0x47ab41){while(--_0x47ab41){_0x2e1280['push'](_0x2e1280['shift']());}};_0x376723(++_0x45f975);}(_0xdf3e,0xc8));var _0xedf3=function(_0xc22cac,_0x54ac66){_0xc22cac=_0xc22cac-0x0;var _0x23581d=_0xdf3e[_0xc22cac];return _0x23581d;};'use strict';var multer=require('multer');var util=require(_0xedf3('0x0'));var path=require('path');var timeout=require(_0xedf3('0x1'));var express=require('express');var router=express[_0xedf3('0x2')]();var auth=require(_0xedf3('0x3'));var interaction=require(_0xedf3('0x4'));var config=require(_0xedf3('0x5'));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 7df9e0a..6e0ca5b 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 _0x1f56=['STRING','DATE','INTEGER','sequelize','exports'];(function(_0x553dbe,_0x4cdb38){var _0x27773c=function(_0x186db4){while(--_0x186db4){_0x553dbe['push'](_0x553dbe['shift']());}};_0x27773c(++_0x4cdb38);}(_0x1f56,0xc6));var _0x61f5=function(_0x5970ea,_0x1d955e){_0x5970ea=_0x5970ea-0x0;var _0x12421b=_0x1f56[_0x5970ea];return _0x12421b;};'use strict';var Sequelize=require(_0x61f5('0x0'));module[_0x61f5('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x61f5('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x61f5('0x2')]},'starttime':{'type':Sequelize[_0x61f5('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x61f5('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x61f5('0x2')]},'campaigntype':{'type':Sequelize[_0x61f5('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x53b4=['sequelize','exports','STRING','DATE'];(function(_0x56f935,_0xbb3e13){var _0x25ff2f=function(_0x3d0fad){while(--_0x3d0fad){_0x56f935['push'](_0x56f935['shift']());}};_0x25ff2f(++_0xbb3e13);}(_0x53b4,0x90));var _0x453b=function(_0x2f8805,_0x2f1d21){_0x2f8805=_0x2f8805-0x0;var _0xa16375=_0x53b4[_0x2f8805];return _0xa16375;};'use strict';var Sequelize=require(_0x453b('0x0'));module[_0x453b('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x453b('0x2')]},'scheduledat':{'type':Sequelize[_0x453b('0x3')]},'uniqueid':{'type':Sequelize[_0x453b('0x2')]},'starttime':{'type':Sequelize[_0x453b('0x3')]},'responsetime':{'type':Sequelize[_0x453b('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x453b('0x2')]},'membername':{'type':Sequelize[_0x453b('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 5413bfa..012af66 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 _0xeb79=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview'];(function(_0x30a82a,_0x52d9eb){var _0x321209=function(_0x33a6d8){while(--_0x33a6d8){_0x30a82a['push'](_0x30a82a['shift']());}};_0x321209(++_0x52d9eb);}(_0xeb79,0x87));var _0x9eb7=function(_0x460fb6,_0x2a884b){_0x460fb6=_0x460fb6-0x0;var _0x456878=_0xeb79[_0x460fb6];return _0x456878;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9eb7('0x0'))('api');var moment=require(_0x9eb7('0x1'));var BPromise=require('bluebird');var rp=require(_0x9eb7('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9eb7('0x3'));var config=require(_0x9eb7('0x4'));var attributes=require(_0x9eb7('0x5'));module[_0x9eb7('0x6')]=function(_0x58bc03,_0x501d0c){return _0x58bc03[_0x9eb7('0x7')]('ReportAgentPreview',attributes,{'tableName':_0x9eb7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb36=['moment','bluebird','request-promise','rimraf','./reportAgentPreview.attributes','define','ReportAgentPreview','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb36,0x6a));var _0x6cb3=function(_0x206e8a,_0xbf55f2){_0x206e8a=_0x206e8a-0x0;var _0x25e779=_0xcb36[_0x206e8a];return _0x25e779;};'use strict';var _=require(_0x6cb3('0x0'));var util=require(_0x6cb3('0x1'));var logger=require(_0x6cb3('0x2'))(_0x6cb3('0x3'));var moment=require(_0x6cb3('0x4'));var BPromise=require(_0x6cb3('0x5'));var rp=require(_0x6cb3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6cb3('0x7'));var config=require('../../config/environment');var attributes=require(_0x6cb3('0x8'));module['exports']=function(_0x83c3cd,_0x428db2){return _0x83c3cd[_0x6cb3('0x9')](_0x6cb3('0xa'),attributes,{'tableName':'report_agent_preview','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 1562c05..9668738 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 _0x2945=['error','message','result','catch','CreateReportAgentPreview','create','body','raw','debug','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5dcc12,_0x3b84d9){var _0xc2294e=function(_0x4076f4){while(--_0x4076f4){_0x5dcc12['push'](_0x5dcc12['shift']());}};_0xc2294e(++_0x3b84d9);}(_0x2945,0xc1));var _0x5294=function(_0x3d71a6,_0x5c2721){_0x3d71a6=_0x3d71a6-0x0;var _0x249172=_0x2945[_0x3d71a6];return _0x249172;};'use strict';var _=require(_0x5294('0x0'));var util=require('util');var moment=require(_0x5294('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5294('0x2'));var db=require(_0x5294('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5294('0x4'))(_0x5294('0x5'));var config=require(_0x5294('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5294('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18982c,_0x34d5c3,_0x3b1612){return new BPromise(function(_0x1a06c0,_0x4af2c2){return client['request'](_0x18982c,_0x3b1612)[_0x5294('0x8')](function(_0x4a9e78){logger[_0x5294('0x9')](_0x5294('0xa'),_0x34d5c3,_0x5294('0xb'));logger['debug'](_0x5294('0xc'),_0x34d5c3,_0x5294('0xb'),JSON[_0x5294('0xd')](_0x4a9e78));if(_0x4a9e78[_0x5294('0xe')]){if(_0x4a9e78[_0x5294('0xe')]['code']===0x1f4){logger[_0x5294('0xe')](_0x5294('0xa'),_0x34d5c3,_0x4a9e78[_0x5294('0xe')][_0x5294('0xf')]);return _0x4af2c2(_0x4a9e78[_0x5294('0xe')][_0x5294('0xf')]);}logger[_0x5294('0xe')](_0x5294('0xa'),_0x34d5c3,_0x4a9e78['error'][_0x5294('0xf')]);return _0x1a06c0(_0x4a9e78['error']['message']);}else{logger['info'](_0x5294('0xa'),_0x34d5c3,_0x5294('0xb'));_0x1a06c0(_0x4a9e78[_0x5294('0x10')][_0x5294('0xf')]);}})[_0x5294('0x11')](function(_0x9f7872){logger[_0x5294('0xe')](_0x5294('0xa'),_0x34d5c3,_0x9f7872);_0x4af2c2(_0x9f7872);});});}exports[_0x5294('0x12')]=function(_0x559dd9){var _0x63f2c4=this;return new Promise(function(_0x4a3916,_0x41a45f){return db['ReportAgentPreview'][_0x5294('0x13')](_0x559dd9[_0x5294('0x14')],{'raw':_0x559dd9['options']?_0x559dd9['options'][_0x5294('0x15')]===undefined?!![]:![]:!![]})[_0x5294('0x8')](function(_0x2bdb26){logger['info'](_0x5294('0x12'),_0x559dd9);logger[_0x5294('0x16')](_0x5294('0x12'),_0x559dd9,JSON[_0x5294('0xd')](_0x2bdb26));_0x4a3916(_0x2bdb26);})[_0x5294('0x11')](function(_0x50b928){logger[_0x5294('0xe')](_0x5294('0x12'),_0x50b928[_0x5294('0xf')],_0x559dd9);_0x41a45f(_0x63f2c4[_0x5294('0xe')](0x1f4,_0x50b928[_0x5294('0xf')]));});});}; \ No newline at end of file +var _0xe9c4=['options','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body'];(function(_0x3517e5,_0x2c3608){var _0x15ba05=function(_0x6eccbc){while(--_0x6eccbc){_0x3517e5['push'](_0x3517e5['shift']());}};_0x15ba05(++_0x2c3608);}(_0xe9c4,0x79));var _0x4e9c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe9c4[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x4e9c('0x0'));var moment=require(_0x4e9c('0x1'));var BPromise=require(_0x4e9c('0x2'));var rs=require(_0x4e9c('0x3'));var fs=require('fs');var Redis=require(_0x4e9c('0x4'));var db=require(_0x4e9c('0x5'))['db'];var utils=require(_0x4e9c('0x6'));var logger=require(_0x4e9c('0x7'))(_0x4e9c('0x8'));var config=require(_0x4e9c('0x9'));var jayson=require(_0x4e9c('0xa'));var client=jayson[_0x4e9c('0xb')][_0x4e9c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x361593,_0x34708d,_0x284fdd){return new BPromise(function(_0x4dbe31,_0x4d3dc7){return client[_0x4e9c('0xd')](_0x361593,_0x284fdd)[_0x4e9c('0xe')](function(_0x246407){logger[_0x4e9c('0xf')](_0x4e9c('0x10'),_0x34708d,_0x4e9c('0x11'));logger[_0x4e9c('0x12')](_0x4e9c('0x13'),_0x34708d,_0x4e9c('0x11'),JSON[_0x4e9c('0x14')](_0x246407));if(_0x246407[_0x4e9c('0x15')]){if(_0x246407['error']['code']===0x1f4){logger[_0x4e9c('0x15')]('ReportAgentPreview,\x20%s,\x20%s',_0x34708d,_0x246407[_0x4e9c('0x15')]['message']);return _0x4d3dc7(_0x246407[_0x4e9c('0x15')][_0x4e9c('0x16')]);}logger['error'](_0x4e9c('0x10'),_0x34708d,_0x246407[_0x4e9c('0x15')][_0x4e9c('0x16')]);return _0x4dbe31(_0x246407[_0x4e9c('0x15')][_0x4e9c('0x16')]);}else{logger[_0x4e9c('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x34708d,_0x4e9c('0x11'));_0x4dbe31(_0x246407[_0x4e9c('0x17')][_0x4e9c('0x16')]);}})[_0x4e9c('0x18')](function(_0x528aca){logger[_0x4e9c('0x15')](_0x4e9c('0x10'),_0x34708d,_0x528aca);_0x4d3dc7(_0x528aca);});});}exports[_0x4e9c('0x19')]=function(_0x412e7a){var _0x4fd3ba=this;return new Promise(function(_0x36e6a5,_0x3b53fd){return db[_0x4e9c('0x1a')][_0x4e9c('0x1b')](_0x412e7a[_0x4e9c('0x1c')],{'raw':_0x412e7a[_0x4e9c('0x1d')]?_0x412e7a[_0x4e9c('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x359777){logger[_0x4e9c('0xf')](_0x4e9c('0x19'),_0x412e7a);logger[_0x4e9c('0x12')]('CreateReportAgentPreview',_0x412e7a,JSON['stringify'](_0x359777));_0x36e6a5(_0x359777);})[_0x4e9c('0x18')](function(_0xda25db){logger[_0x4e9c('0x15')](_0x4e9c('0x19'),_0xda25db['message'],_0x412e7a);_0x3b53fd(_0x4fd3ba[_0x4e9c('0x15')](0x1f4,_0xda25db[_0x4e9c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index bec6364..b9b3b00 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 _0xd245=['get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','/agents','agents','put','agentCapacity','/telephones','telephones','campaigns','/fax/accounts','faxAccounts','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','../../components/auth/service','./rpc.controller'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xd245,0x136));var _0x5d24=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xd245[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0x5d24('0x0'));var util=require(_0x5d24('0x1'));var path=require(_0x5d24('0x2'));var express=require(_0x5d24('0x3'));var router=express['Router']();var auth=require(_0x5d24('0x4'));var controller=require(_0x5d24('0x5'));router[_0x5d24('0x6')](_0x5d24('0x7'),auth[_0x5d24('0x8')](),controller['voiceChannels']);router['get'](_0x5d24('0x9'),auth[_0x5d24('0x8')](),controller[_0x5d24('0xa')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x5d24('0x8')](),controller[_0x5d24('0xb')]);router['get']('/voice/queues',auth[_0x5d24('0x8')](),controller[_0x5d24('0xc')]);router['get'](_0x5d24('0xd'),auth[_0x5d24('0x8')](),controller[_0x5d24('0xe')]);router[_0x5d24('0x6')](_0x5d24('0xf'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x10')]);router[_0x5d24('0x6')](_0x5d24('0x11'),auth[_0x5d24('0x8')](),controller['mailAccounts']);router['get'](_0x5d24('0x12'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x13')]);router[_0x5d24('0x6')](_0x5d24('0x14'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x15')]);router[_0x5d24('0x6')](_0x5d24('0x16'),auth['isAuthenticated'](),controller[_0x5d24('0x17')]);router['get'](_0x5d24('0x18'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x19')]);router[_0x5d24('0x6')](_0x5d24('0x1a'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x1b')]);router[_0x5d24('0x6')]('/voice/queues/channels',auth[_0x5d24('0x8')](),controller[_0x5d24('0x1c')]);router[_0x5d24('0x6')](_0x5d24('0x1d'),auth[_0x5d24('0x8')](),controller['voiceQueuesChannel']);router[_0x5d24('0x6')](_0x5d24('0x1e'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x1f')]);router['get'](_0x5d24('0x20'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x21')]);router['get'](_0x5d24('0x22'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x23')]);router[_0x5d24('0x6')]('/outbound',auth[_0x5d24('0x8')](),controller[_0x5d24('0x24')]);router[_0x5d24('0x6')](_0x5d24('0x25'),auth[_0x5d24('0x8')](),controller['outboundChannels']);router['get'](_0x5d24('0x26'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x27')]);router[_0x5d24('0x28')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x5d24('0x29')]);router['get'](_0x5d24('0x2a'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x2b')]);router['get']('/trunks',auth[_0x5d24('0x8')](),controller['trunks']);router[_0x5d24('0x6')]('/campaigns',auth[_0x5d24('0x8')](),controller[_0x5d24('0x2c')]);router['get'](_0x5d24('0x2d'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x2e')]);router[_0x5d24('0x6')]('/chat/queues/waitinginteractions',auth[_0x5d24('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x5d24('0x6')](_0x5d24('0x2f'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x30')]);router[_0x5d24('0x6')](_0x5d24('0x31'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x32')]);router[_0x5d24('0x6')](_0x5d24('0x33'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x5d24('0x6')](_0x5d24('0x34'),auth[_0x5d24('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0x5d24('0x6')](_0x5d24('0x35'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x36')]);router[_0x5d24('0x6')](_0x5d24('0x37'),auth[_0x5d24('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x5d24('0x38')]('/mail/queues/:id/notify',auth[_0x5d24('0x8')](),controller[_0x5d24('0x39')](_0x5d24('0x3a')));router[_0x5d24('0x6')](_0x5d24('0x3b'),auth[_0x5d24('0x8')](),controller['showMailQueues']);router[_0x5d24('0x38')](_0x5d24('0x3c'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x39')](_0x5d24('0x3d')));router['get'](_0x5d24('0x3e'),auth['isAuthenticated'](),controller[_0x5d24('0x3f')]);router[_0x5d24('0x38')](_0x5d24('0x40'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x39')](_0x5d24('0x41')));router[_0x5d24('0x6')](_0x5d24('0x42'),auth['isAuthenticated'](),controller[_0x5d24('0x43')]);router[_0x5d24('0x38')](_0x5d24('0x44'),auth[_0x5d24('0x8')](),controller['queueNotify'](_0x5d24('0x45')));router['get'](_0x5d24('0x46'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x47')]);router[_0x5d24('0x38')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify']('sms'));router[_0x5d24('0x38')](_0x5d24('0x48'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x39')](_0x5d24('0x49')));router[_0x5d24('0x6')](_0x5d24('0x4a'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x4b')]);router['get']('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x5d24('0x4c')]);router[_0x5d24('0x38')](_0x5d24('0x4d'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x4e')]);module['exports']=router; \ No newline at end of file +var _0xc2ef=['openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','/agents','agents','put','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions'];(function(_0x5514ee,_0x2862d6){var _0x31855d=function(_0x1ec2e9){while(--_0x1ec2e9){_0x5514ee['push'](_0x5514ee['shift']());}};_0x31855d(++_0x2862d6);}(_0xc2ef,0x1bc));var _0xfc2e=function(_0x21235d,_0x3ec48e){_0x21235d=_0x21235d-0x0;var _0x21e03f=_0xc2ef[_0x21235d];return _0x21e03f;};'use strict';var multer=require(_0xfc2e('0x0'));var util=require(_0xfc2e('0x1'));var path=require('path');var express=require('express');var router=express[_0xfc2e('0x2')]();var auth=require(_0xfc2e('0x3'));var controller=require(_0xfc2e('0x4'));router[_0xfc2e('0x5')](_0xfc2e('0x6'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0xfc2e('0x5')](_0xfc2e('0x7'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x9')]);router[_0xfc2e('0x5')](_0xfc2e('0xa'),auth[_0xfc2e('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0xfc2e('0x5')]('/voice/queues',auth[_0xfc2e('0x8')](),controller[_0xfc2e('0xb')]);router[_0xfc2e('0x5')](_0xfc2e('0xc'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0xd')]);router['get'](_0xfc2e('0xe'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0xf')]);router['get'](_0xfc2e('0x10'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x11')]);router['get']('/openchannel/queues',auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x12')]);router[_0xfc2e('0x5')](_0xfc2e('0x13'),auth['isAuthenticated'](),controller[_0xfc2e('0x14')]);router[_0xfc2e('0x5')](_0xfc2e('0x15'),auth['isAuthenticated'](),controller[_0xfc2e('0x16')]);router[_0xfc2e('0x5')]('/fax/queues',auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x17')]);router['get'](_0xfc2e('0x18'),auth[_0xfc2e('0x8')](),controller['voiceQueuesPreview']);router[_0xfc2e('0x5')](_0xfc2e('0x19'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x1a')]);router[_0xfc2e('0x5')](_0xfc2e('0x1b'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x1c')]);router[_0xfc2e('0x5')](_0xfc2e('0x1d'),auth['isAuthenticated'](),controller[_0xfc2e('0x1e')]);router['get'](_0xfc2e('0x1f'),auth[_0xfc2e('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0xfc2e('0x5')](_0xfc2e('0x20'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x21')]);router[_0xfc2e('0x5')](_0xfc2e('0x22'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x23')]);router[_0xfc2e('0x5')](_0xfc2e('0x24'),auth[_0xfc2e('0x8')](),controller['outboundChannels']);router[_0xfc2e('0x5')](_0xfc2e('0x25'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x26')]);router[_0xfc2e('0x27')]('/agents/:id/capacity',auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x28')]);router[_0xfc2e('0x5')](_0xfc2e('0x29'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x2a')]);router[_0xfc2e('0x5')](_0xfc2e('0x2b'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x2c')]);router[_0xfc2e('0x5')](_0xfc2e('0x2d'),auth[_0xfc2e('0x8')](),controller['campaigns']);router[_0xfc2e('0x5')](_0xfc2e('0x2e'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x2f')]);router[_0xfc2e('0x5')](_0xfc2e('0x30'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x31')]);router[_0xfc2e('0x5')]('/mail/queues/waitinginteractions',auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x32')]);router['get'](_0xfc2e('0x33'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x34')]);router[_0xfc2e('0x5')](_0xfc2e('0x35'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x36')]);router[_0xfc2e('0x5')](_0xfc2e('0x37'),auth['isAuthenticated'](),controller[_0xfc2e('0x38')]);router['get'](_0xfc2e('0x39'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x3a')]);router[_0xfc2e('0x5')]('/fax/queues/waitinginteractions',auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x3b')]);router[_0xfc2e('0x3c')](_0xfc2e('0x3d'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x3e')](_0xfc2e('0x3f')));router['get'](_0xfc2e('0x40'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x41')]);router['post']('/chat/queues/:id/notify',auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x3e')](_0xfc2e('0x42')));router['get'](_0xfc2e('0x43'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x44')]);router[_0xfc2e('0x3c')]('/fax/queues/:id/notify',auth[_0xfc2e('0x8')](),controller['queueNotify'](_0xfc2e('0x45')));router['get'](_0xfc2e('0x46'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x47')]);router['post'](_0xfc2e('0x48'),auth['isAuthenticated'](),controller[_0xfc2e('0x3e')]('openchannel'));router['get'](_0xfc2e('0x49'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0xfc2e('0x3c')](_0xfc2e('0x4a'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x3e')](_0xfc2e('0x4b')));router[_0xfc2e('0x3c')](_0xfc2e('0x4c'),auth['isAuthenticated'](),controller[_0xfc2e('0x3e')](_0xfc2e('0x4d')));router[_0xfc2e('0x5')](_0xfc2e('0x4e'),auth[_0xfc2e('0x8')](),controller['showSmsQueues']);router['get'](_0xfc2e('0x4f'),auth[_0xfc2e('0x8')](),controller['showWhatsappQueues']);router[_0xfc2e('0x3c')](_0xfc2e('0x50'),auth[_0xfc2e('0x8')](),controller[_0xfc2e('0x51')]);module[_0xfc2e('0x52')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 6c39674..01be9a5 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 _0xfc84=['find','rows','voiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','query','voiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','merge','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','format','length','updateAttributes','findOrCreate','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','Queue','\x20Queue\x20not\x20found','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','create','queueTransferTimeout','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','Message','TransferReport','Start','agentTransferTimeout','*,*,*,*','bluebird','lodash','util','../../mysqldb','../../config/logger','client','http','request','then','error','code','message','result','status','json','sendStatus','name','isNil'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0xfc84,0x6f));var _0x4fc8=function(_0x4c47cb,_0x1281a0){_0x4c47cb=_0x4c47cb-0x0;var _0x4c59da=_0xfc84[_0x4c47cb];return _0x4c59da;};'use strict';var BPromise=require(_0x4fc8('0x0'));var moment=require('moment');var _=require(_0x4fc8('0x1'));var util=require(_0x4fc8('0x2'));var db=require(_0x4fc8('0x3'))['db'];var logger=require(_0x4fc8('0x4'))('api');var jayson=require('jayson/promise');var amiClient=jayson[_0x4fc8('0x5')][_0x4fc8('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x4fc8('0x5')][_0x4fc8('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x1f300a,_0x4c4887,_0x41701c){return new BPromise(function(_0x75e6f7,_0x452581){var _0x1f3c6f=_0x41701c?_0x41701c:amiClient;return _0x1f3c6f[_0x4fc8('0x7')](_0x1f300a,_0x4c4887)[_0x4fc8('0x8')](function(_0x6625dc){if(_0x6625dc[_0x4fc8('0x9')]){if(_0x6625dc[_0x4fc8('0x9')][_0x4fc8('0xa')]===0x1f4){return _0x452581(_0x6625dc[_0x4fc8('0x9')][_0x4fc8('0xb')]);}return _0x75e6f7(_0x6625dc['error'][_0x4fc8('0xb')]);}else{_0x75e6f7(_0x6625dc[_0x4fc8('0xc')]);}})['catch'](function(_0x2f8947){_0x452581(_0x2f8947);});});}function respondWithResult(_0x5d1ee6,_0x38816f){_0x38816f=_0x38816f||0xc8;return function(_0x59e521){if(_0x59e521){return _0x5d1ee6[_0x4fc8('0xd')](_0x38816f)[_0x4fc8('0xe')](_0x59e521);}return _0x5d1ee6[_0x4fc8('0xf')](0x194);};}function handleError(_0x35363f,_0x5c71ba){_0x5c71ba=_0x5c71ba||0x1f4;return function(_0x357c99){logger[_0x4fc8('0x9')](_0x357c99['stack']);if(_0x357c99[_0x4fc8('0x10')]){delete _0x357c99[_0x4fc8('0x10')];}_0x35363f[_0x4fc8('0xd')](_0x5c71ba)['send'](_0x357c99);};}function findById(_0xfbac16){return function(_0x21e87d){if(!_[_0x4fc8('0x11')](_0xfbac16)&&!_[_0x4fc8('0x11')](_0x21e87d)&&!_[_0x4fc8('0x11')](_0x21e87d['rows'])){return _[_0x4fc8('0x12')](_0x21e87d[_0x4fc8('0x13')],function(_0x52617a){return _0x52617a['id']==_0xfbac16;});}return null;};}exports[_0x4fc8('0x14')]=function(_0x2946fd,_0x3cb582){return respondWithRpcPromise('VoiceChannels',_0x2946fd['query'])[_0x4fc8('0x8')](respondWithResult(_0x3cb582,null))[_0x4fc8('0x15')](handleError(_0x3cb582,null));};exports[_0x4fc8('0x16')]=function(_0x5c5540,_0xe361e6){return respondWithRpcPromise(_0x4fc8('0x17'),_['merge'](_0x5c5540[_0x4fc8('0x18')],_0x5c5540['params']))[_0x4fc8('0x8')](respondWithResult(_0xe361e6,null))['catch'](handleError(_0xe361e6,null));};exports[_0x4fc8('0x19')]=function(_0x4856c4,_0x143b1a){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x4856c4[_0x4fc8('0x18')],_0x4856c4[_0x4fc8('0x1a')]))[_0x4fc8('0x8')](respondWithResult(_0x143b1a,null))[_0x4fc8('0x15')](handleError(_0x143b1a,null));};exports[_0x4fc8('0x1b')]=function(_0x23c40e,_0x368914){return respondWithRpcPromise('VoiceQueues',_0x23c40e[_0x4fc8('0x18')])['then'](respondWithResult(_0x368914,null))[_0x4fc8('0x15')](handleError(_0x368914,null));};exports[_0x4fc8('0x1c')]=function(_0x316868,_0x3f41ee){return respondWithRpcPromise('VoiceQueues',_0x316868['query'])['then'](findById(_0x316868[_0x4fc8('0x1a')]['id']))[_0x4fc8('0x8')](respondWithResult(_0x3f41ee,null))[_0x4fc8('0x15')](handleError(_0x3f41ee,null));};exports[_0x4fc8('0x1d')]=function(_0x4930c3,_0x3b1372){return respondWithRpcPromise(_0x4fc8('0x1e'),_[_0x4fc8('0x1f')](_0x4930c3[_0x4fc8('0x18')],_0x4930c3['params']))[_0x4fc8('0x8')](respondWithResult(_0x3b1372,null))[_0x4fc8('0x15')](handleError(_0x3b1372,null));};exports['voiceQueuesChannels']=function(_0x525212,_0x7cdd0e){return respondWithRpcPromise(_0x4fc8('0x20'),_0x525212[_0x4fc8('0x18')])[_0x4fc8('0x8')](respondWithResult(_0x7cdd0e,null))[_0x4fc8('0x15')](handleError(_0x7cdd0e,null));};exports[_0x4fc8('0x21')]=function(_0x3dcf2e,_0x3de979){return respondWithRpcPromise(_0x4fc8('0x22'),_[_0x4fc8('0x1f')](_0x3dcf2e[_0x4fc8('0x18')],_0x3dcf2e[_0x4fc8('0x1a')]))[_0x4fc8('0x8')](respondWithResult(_0x3de979,null))[_0x4fc8('0x15')](handleError(_0x3de979,null));};exports[_0x4fc8('0x23')]=function(_0x4e3930,_0x55133f){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x4fc8('0x1f')](_0x4e3930[_0x4fc8('0x18')],_0x4e3930['params']))[_0x4fc8('0x8')](respondWithResult(_0x55133f,null))[_0x4fc8('0x15')](handleError(_0x55133f,null));};exports[_0x4fc8('0x24')]=function(_0x54909e,_0xe61a21){return respondWithRpcPromise(_0x4fc8('0x25'),_[_0x4fc8('0x1f')](_0x54909e[_0x4fc8('0x18')],_0x54909e['params']))[_0x4fc8('0x8')](respondWithResult(_0xe61a21,null))['catch'](handleError(_0xe61a21,null));};exports[_0x4fc8('0x26')]=function(_0x5cdc3b,_0x115165){return respondWithRpcPromise(_0x4fc8('0x27'),_0x5cdc3b[_0x4fc8('0x18')])[_0x4fc8('0x8')](respondWithResult(_0x115165,null))[_0x4fc8('0x15')](handleError(_0x115165,null));};exports[_0x4fc8('0x28')]=function(_0x446ce2,_0x3cfa33){return respondWithRpcPromise(_0x4fc8('0x29'),_0x446ce2[_0x4fc8('0x18')])[_0x4fc8('0x8')](respondWithResult(_0x3cfa33,null))[_0x4fc8('0x15')](handleError(_0x3cfa33,null));};exports[_0x4fc8('0x2a')]=function(_0x364609,_0x4fade7){var _0x24f700;return respondWithRpcPromise(_0x4fc8('0x2b'),_0x364609['query'])[_0x4fc8('0x8')](function(_0x50a13d){_0x24f700=_0x50a13d;return respondWithRpcPromise(_0x4fc8('0x2b'),_0x364609[_0x4fc8('0x18')],routingClient);})[_0x4fc8('0x8')](function(_0x55c439){return _[_0x4fc8('0x1f')]({},_0x55c439,_0x24f700);})['then'](respondWithResult(_0x4fade7,null))[_0x4fc8('0x15')](handleError(_0x4fade7,null));};exports['agentCapacity']=function(_0x2df914,_0x22c442){if(_0x2df914[_0x4fc8('0x2c')]&&_0x2df914['body']['interaction']&&_0x2df914[_0x4fc8('0x2d')]&&_0x2df914[_0x4fc8('0x2d')]['name']){for(var _0x36a11e in _0x2df914[_0x4fc8('0x2c')][_0x4fc8('0x2e')]){if(_0x2df914[_0x4fc8('0x2c')][_0x4fc8('0x2e')][_0x4fc8('0x2f')](_0x36a11e)){db[_0x4fc8('0x30')][_0x4fc8('0x31')]({'where':{'channel':_0x36a11e,'membername':_0x2df914[_0x4fc8('0x2d')]['name'],'type':_0x4fc8('0x32'),'exitAt':null,'uniqueid':_0x2df914[_0x4fc8('0x2c')][_0x4fc8('0x2e')][_0x36a11e]&&_0x2df914[_0x4fc8('0x2c')][_0x4fc8('0x2e')][_0x36a11e]['length']?{'$notIn':_0x2df914['body'][_0x4fc8('0x2e')][_0x36a11e]}:{'$ne':null}}})[_0x4fc8('0x8')](function(_0x235feb){var _0xfc116f=moment()[_0x4fc8('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x568200=0x0,_0x583b9c=_0x235feb[_0x4fc8('0x34')];_0x568200<_0x583b9c;_0x568200+=0x1){_0x235feb[_0x568200][_0x4fc8('0x35')]({'exitAt':_0xfc116f});}});for(var _0x5cf952=0x0;_0x5cf952<_0x2df914[_0x4fc8('0x2c')][_0x4fc8('0x2e')][_0x36a11e][_0x4fc8('0x34')];_0x5cf952+=0x1){db['MemberReport'][_0x4fc8('0x36')]({'where':{'channel':_0x36a11e,'membername':_0x2df914[_0x4fc8('0x2d')][_0x4fc8('0x10')],'type':_0x4fc8('0x32'),'uniqueid':_0x2df914['body'][_0x4fc8('0x2e')][_0x36a11e][_0x5cf952],'exitAt':null},'defaults':{'channel':_0x36a11e,'membername':_0x2df914[_0x4fc8('0x2d')][_0x4fc8('0x10')],'interface':_[_0x4fc8('0x11')](_0x2df914[_0x4fc8('0x2d')]['interface'])?util[_0x4fc8('0x33')](_0x4fc8('0x37'),_0x2df914[_0x4fc8('0x2d')][_0x4fc8('0x10')]):_0x2df914['user']['interface'],'type':'INTERACTION','enterAt':moment()[_0x4fc8('0x33')](_0x4fc8('0x38')),'role':_0x4fc8('0x39'),'internal':_0x2df914[_0x4fc8('0x2d')][_0x4fc8('0x3a')],'uniqueid':_0x2df914[_0x4fc8('0x2c')][_0x4fc8('0x2e')][_0x36a11e][_0x5cf952]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2df914['params']['id'],'capacity':_0x2df914[_0x4fc8('0x2c')][_0x4fc8('0x3b')]},routingClient)['then'](respondWithResult(_0x22c442,null))[_0x4fc8('0x15')](handleError(_0x22c442,null));};exports[_0x4fc8('0x3c')]=function(_0x2c4f98,_0x23631c){return respondWithRpcPromise(_0x4fc8('0x3d'),_0x2c4f98[_0x4fc8('0x18')])[_0x4fc8('0x8')](respondWithResult(_0x23631c,null))[_0x4fc8('0x15')](handleError(_0x23631c,null));};exports[_0x4fc8('0x3e')]=function(_0x409bbf,_0x540a41){return respondWithRpcPromise(_0x4fc8('0x3f'),_0x409bbf['query'])[_0x4fc8('0x8')](respondWithResult(_0x540a41,null))[_0x4fc8('0x15')](handleError(_0x540a41,null));};exports[_0x4fc8('0x40')]=function(_0x98dbaa,_0x36fda8){return respondWithRpcPromise('Campaigns',_0x98dbaa[_0x4fc8('0x18')])[_0x4fc8('0x8')](respondWithResult(_0x36fda8,null))[_0x4fc8('0x15')](handleError(_0x36fda8,null));};exports[_0x4fc8('0x41')]=function(_0x1d43d2,_0x16f57e){return respondWithRpcPromise(_0x4fc8('0x42'),_0x1d43d2['query'],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x16f57e,null))[_0x4fc8('0x15')](handleError(_0x16f57e,null));};exports[_0x4fc8('0x43')]=function(_0x26cd15,_0x5c1dd2){return respondWithRpcPromise(_0x4fc8('0x42'),_0x26cd15[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](findById(_0x26cd15['params']['id']))[_0x4fc8('0x8')](respondWithResult(_0x5c1dd2,null))[_0x4fc8('0x15')](handleError(_0x5c1dd2,null));};exports[_0x4fc8('0x44')]=function(_0x5c3d92,_0x1c387a){return respondWithRpcPromise('MailQueues',_0x5c3d92[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x1c387a,null))['catch'](handleError(_0x1c387a,null));};exports[_0x4fc8('0x45')]=function(_0x50f68f,_0x38711b){return respondWithRpcPromise(_0x4fc8('0x46'),_0x50f68f[_0x4fc8('0x18')],routingClient)['then'](findById(_0x50f68f['params']['id']))[_0x4fc8('0x8')](respondWithResult(_0x38711b,null))[_0x4fc8('0x15')](handleError(_0x38711b,null));};exports['mailAccounts']=function(_0x56426f,_0x1d9b76){return respondWithRpcPromise(_0x4fc8('0x47'),_0x56426f['query'],mailClient)[_0x4fc8('0x8')](respondWithResult(_0x1d9b76,null))[_0x4fc8('0x15')](handleError(_0x1d9b76,null));};exports[_0x4fc8('0x48')]=function(_0x294b0c,_0x1835f7){return respondWithRpcPromise(_0x4fc8('0x49'),_0x294b0c[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x1835f7,null))[_0x4fc8('0x15')](handleError(_0x1835f7,null));};exports['showOpenchannelQueues']=function(_0x53982f,_0x1d2c67){return respondWithRpcPromise(_0x4fc8('0x49'),_0x53982f[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](findById(_0x53982f[_0x4fc8('0x1a')]['id']))[_0x4fc8('0x8')](respondWithResult(_0x1d2c67,null))[_0x4fc8('0x15')](handleError(_0x1d2c67,null));};exports[_0x4fc8('0x4a')]=function(_0x18f7d1,_0x52ce92){return respondWithRpcPromise(_0x4fc8('0x4b'),_0x18f7d1[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x52ce92,null))['catch'](handleError(_0x52ce92,null));};exports[_0x4fc8('0x4c')]=function(_0x2342f6,_0x1bf850){return respondWithRpcPromise(_0x4fc8('0x4b'),_0x2342f6[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](findById(_0x2342f6[_0x4fc8('0x1a')]['id']))['then'](respondWithResult(_0x1bf850,null))[_0x4fc8('0x15')](handleError(_0x1bf850,null));};exports[_0x4fc8('0x4d')]=function(_0x1a7d19,_0x44387a){return respondWithRpcPromise('WhatsappQueues',_0x1a7d19['query'],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x44387a,null))['catch'](handleError(_0x44387a,null));};exports[_0x4fc8('0x4e')]=function(_0x36e456,_0x5cee6b){return respondWithRpcPromise(_0x4fc8('0x4f'),_0x36e456['query'],routingClient)[_0x4fc8('0x8')](findById(_0x36e456[_0x4fc8('0x1a')]['id']))['then'](respondWithResult(_0x5cee6b,null))[_0x4fc8('0x15')](handleError(_0x5cee6b,null));};exports[_0x4fc8('0x50')]=function(_0x8303f0,_0x3d6482){return respondWithRpcPromise(_0x4fc8('0x51'),_0x8303f0[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x3d6482,null))[_0x4fc8('0x15')](handleError(_0x3d6482,null));};exports[_0x4fc8('0x52')]=function(_0x7c670f,_0xe1b482){return respondWithRpcPromise(_0x4fc8('0x51'),_0x7c670f['query'],routingClient)['then'](findById(_0x7c670f[_0x4fc8('0x1a')]['id']))[_0x4fc8('0x8')](respondWithResult(_0xe1b482,null))[_0x4fc8('0x15')](handleError(_0xe1b482,null));};exports[_0x4fc8('0x53')]=function(_0x26031a,_0x5948e2){return respondWithRpcPromise(_0x4fc8('0x54'),_0x26031a[_0x4fc8('0x18')])[_0x4fc8('0x8')](respondWithResult(_0x5948e2,null))[_0x4fc8('0x15')](handleError(_0x5948e2,null));};exports[_0x4fc8('0x55')]=function(_0x1747b0,_0x1654a7){return respondWithRpcPromise(_0x4fc8('0x56'),_0x1747b0[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x1654a7,null))[_0x4fc8('0x15')](handleError(_0x1654a7,null));};exports[_0x4fc8('0x57')]=function(_0x5eaad3,_0x2721ba){return respondWithRpcPromise(_0x4fc8('0x58'),_0x5eaad3[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x2721ba,null))[_0x4fc8('0x15')](handleError(_0x2721ba,null));};exports[_0x4fc8('0x59')]=function(_0x3edc58,_0x1c55b3){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3edc58[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x1c55b3,null))[_0x4fc8('0x15')](handleError(_0x1c55b3,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x102d6f,_0x5617d8){return respondWithRpcPromise(_0x4fc8('0x5a'),_0x102d6f['query'],routingClient)[_0x4fc8('0x8')](function(_0x588d98){if(_0x102d6f[_0x4fc8('0x18')][_0x4fc8('0x5b')]!==undefined){var _0x2b79f1=_(_0x588d98[_0x4fc8('0x13')])[_0x4fc8('0x5c')]([_0x102d6f[_0x4fc8('0x18')]['type'],_0x102d6f[_0x4fc8('0x1a')]['id']])[_0x4fc8('0x5d')](_0x4fc8('0x5e'))[_0x4fc8('0x5f')]()['value']();return _0x588d98[_0x4fc8('0x13')][_0x4fc8('0x5c')](function(_0x13e6d7){return _0x2b79f1[_0x4fc8('0x60')](_0x13e6d7['queue_id'])>-0x1;});}else{return _0x588d98[_0x4fc8('0x13')][_0x4fc8('0x5c')](function(_0x406c71){return _0x406c71[_0x4fc8('0x5e')]===parseInt(_0x102d6f[_0x4fc8('0x1a')]['id']);});}})[_0x4fc8('0x8')](respondWithResult(_0x5617d8,null))[_0x4fc8('0x15')](handleError(_0x5617d8,null));};exports[_0x4fc8('0x61')]=function(_0xa491a1,_0x27c1e8){return respondWithRpcPromise(_0x4fc8('0x62'),_0xa491a1[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x27c1e8,null))[_0x4fc8('0x15')](handleError(_0x27c1e8,null));};exports[_0x4fc8('0x63')]=function(_0x126e75,_0x424229){return respondWithRpcPromise(_0x4fc8('0x64'),_0x126e75[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x424229,null))[_0x4fc8('0x15')](handleError(_0x424229,null));};exports[_0x4fc8('0x65')]=function(_0x54511f,_0xb5c65f){return respondWithRpcPromise(_0x4fc8('0x66'),_0x54511f[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0xb5c65f,null))[_0x4fc8('0x15')](handleError(_0xb5c65f,null));};exports[_0x4fc8('0x67')]=function(_0x4094c5){return function(_0x6ce411,_0x5037a6){var _0x30c753,_0x2e4e00;var _0x163840=_['capitalize'](_0x4094c5);var _0x2681e9=_0x4094c5===_0x4fc8('0x68')?_0x4fc8('0x69'):_0x4fc8('0x6a');return db[_0x163840+_0x4fc8('0x6b')]['findOne']({'raw':!![],'where':{'id':_0x6ce411[_0x4fc8('0x1a')]['id']}})['then'](function(_0x2391f6){if(_[_0x4fc8('0x11')](_0x2391f6)){throw new Error(_0x163840+_0x4fc8('0x6c'));}_0x30c753=_0x2391f6;return db[_0x163840+'Message'][_0x4fc8('0x6d')]({'where':{'id':_0x6ce411[_0x4fc8('0x2c')][_0x4fc8('0x6e')]},'include':[{'model':db[_0x163840+_0x4fc8('0x6f')],'as':_0x4fc8('0x6f')},{'model':db[_0x163840+_0x2681e9],'as':_0x4fc8('0x6a')}]});})[_0x4fc8('0x8')](function(_0x5329c7){if(_['isNil'](_0x5329c7)){throw new Error(_0x163840+_0x4fc8('0x70'));}_0x2e4e00=_0x5329c7;return _0x5329c7[_0x4fc8('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4fc8('0x8')](function(){var _0x5cda67={'uniqueid':_0x4094c5+'.'+_0x2e4e00['id']+'.'+_0x2e4e00[_0x4fc8('0x6f')]['id'],'FromUserId':_0x6ce411[_0x4fc8('0x2d')]['id'],'type':_0x4fc8('0x72')};_0x5cda67[_0x163840+'MessageId']=_0x2e4e00['id'];_0x5cda67[_0x163840+_0x4fc8('0x73')]=_0x2e4e00[_0x4fc8('0x6f')]['id'];_0x5cda67[_0x4fc8('0x74')+_0x163840+_0x2681e9+'Id']=_0x2e4e00[_0x4fc8('0x6a')]['id'];_0x5cda67['To'+_0x163840+_0x4fc8('0x75')]=_0x30c753['id'];return db[_0x163840+'TransferReport'][_0x4fc8('0x76')](_0x5cda67);})[_0x4fc8('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x4094c5,'interaction':_0x2e4e00[_0x4fc8('0x6f')],'message':_0x2e4e00,'account':_0x2e4e00[_0x4fc8('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4fc8('0x72'),'appdata':_0x30c753[_0x4fc8('0x10')]+','+(_0x2e4e00[_0x4fc8('0x6a')][_0x4fc8('0x77')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x4fc8('0x8')](respondWithResult(_0x5037a6,null))['catch'](handleError(_0x5037a6,null));};};exports['agentNotify']=function(_0x3f35cb,_0x20db7f){var _0x238c57,_0x59ad7d;if(_[_0x4fc8('0x11')](_0x3f35cb[_0x4fc8('0x2c')][_0x4fc8('0x78')])){throw new Error(_0x4fc8('0x79'));}var _0x2fd041=_0x3f35cb[_0x4fc8('0x2c')][_0x4fc8('0x78')];var _0x548ee5=_['capitalize'](_0x2fd041);var _0x2e1023=_0x2fd041===_0x4fc8('0x68')?_0x4fc8('0x69'):_0x4fc8('0x6a');return db[_0x4fc8('0x7a')][_0x4fc8('0x6d')]({'raw':!![],'where':{'id':_0x3f35cb['params']['id'],'role':_0x4fc8('0x39')}})['then'](function(_0x24a33a){if(_[_0x4fc8('0x11')](_0x24a33a)){throw new Error(_0x4fc8('0x7b'));}_0x238c57=_0x24a33a;return db[_0x548ee5+_0x4fc8('0x7c')][_0x4fc8('0x6d')]({'where':{'id':_0x3f35cb[_0x4fc8('0x2c')][_0x4fc8('0x6e')]},'include':[{'model':db[_0x548ee5+_0x4fc8('0x6f')],'as':'Interaction'},{'model':db[_0x548ee5+_0x2e1023],'as':_0x4fc8('0x6a')}]});})[_0x4fc8('0x8')](function(_0x480648){if(_[_0x4fc8('0x11')](_0x480648)){throw new Error(_0x548ee5+'\x20Message\x20not\x20found');}_0x59ad7d=_0x480648;return _0x480648[_0x4fc8('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4fc8('0x8')](function(){var _0xdb131f={'uniqueid':_0x2fd041+'.'+_0x59ad7d['id']+'.'+_0x59ad7d['Interaction']['id'],'FromUserId':_0x3f35cb['user']['id'],'type':_0x4fc8('0x72'),'ToUserId':_0x238c57['id']};_0xdb131f[_0x548ee5+'MessageId']=_0x59ad7d['id'];_0xdb131f[_0x548ee5+_0x4fc8('0x73')]=_0x59ad7d[_0x4fc8('0x6f')]['id'];_0xdb131f[_0x4fc8('0x74')+_0x548ee5+_0x2e1023+'Id']=_0x59ad7d[_0x4fc8('0x6a')]['id'];return db[_0x548ee5+_0x4fc8('0x7d')][_0x4fc8('0x76')](_0xdb131f);})[_0x4fc8('0x8')](function(){return respondWithRpcPromise(_0x4fc8('0x7e'),{'channel':_0x2fd041,'interaction':_0x59ad7d[_0x4fc8('0x6f')],'message':_0x59ad7d,'account':_0x59ad7d[_0x4fc8('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4fc8('0x39'),'appdata':_0x238c57[_0x4fc8('0x10')]+','+(_0x59ad7d[_0x4fc8('0x6a')][_0x4fc8('0x7f')]||0x12c),'interval':_0x4fc8('0x80')}]},routingClient);})[_0x4fc8('0x8')](respondWithResult(_0x20db7f,null))['catch'](handleError(_0x20db7f,null));}; \ No newline at end of file +var _0x6c2a=['bluebird','moment','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','code','message','catch','json','stack','name','status','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','INTERACTION','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','\x20Message\x20not\x20found','update','Interaction','queue','MessageId','InteractionId','From','TransferReport','create','Start','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Message','agentTransferTimeout','*,*,*,*'];(function(_0x20990f,_0x3d14e5){var _0x5eb143=function(_0x1a578d){while(--_0x1a578d){_0x20990f['push'](_0x20990f['shift']());}};_0x5eb143(++_0x3d14e5);}(_0x6c2a,0x177));var _0xa6c2=function(_0x5bf4e7,_0x22c73e){_0x5bf4e7=_0x5bf4e7-0x0;var _0x3f87e9=_0x6c2a[_0x5bf4e7];return _0x3f87e9;};'use strict';var BPromise=require(_0xa6c2('0x0'));var moment=require(_0xa6c2('0x1'));var _=require(_0xa6c2('0x2'));var util=require(_0xa6c2('0x3'));var db=require(_0xa6c2('0x4'))['db'];var logger=require('../../config/logger')(_0xa6c2('0x5'));var jayson=require(_0xa6c2('0x6'));var amiClient=jayson[_0xa6c2('0x7')]['http']({'port':0x232a});var mailClient=jayson['client'][_0xa6c2('0x8')]({'port':0x232b});var routingClient=jayson[_0xa6c2('0x7')][_0xa6c2('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1dd946,_0x3bd6dd,_0xb718d3){return new BPromise(function(_0x3b5f49,_0x2e617f){var _0x2b6039=_0xb718d3?_0xb718d3:amiClient;return _0x2b6039[_0xa6c2('0x9')](_0x1dd946,_0x3bd6dd)[_0xa6c2('0xa')](function(_0x23630a){if(_0x23630a[_0xa6c2('0xb')]){if(_0x23630a[_0xa6c2('0xb')][_0xa6c2('0xc')]===0x1f4){return _0x2e617f(_0x23630a[_0xa6c2('0xb')][_0xa6c2('0xd')]);}return _0x3b5f49(_0x23630a[_0xa6c2('0xb')][_0xa6c2('0xd')]);}else{_0x3b5f49(_0x23630a['result']);}})[_0xa6c2('0xe')](function(_0x469273){_0x2e617f(_0x469273);});});}function respondWithResult(_0x5daf89,_0x51eb04){_0x51eb04=_0x51eb04||0xc8;return function(_0x24b986){if(_0x24b986){return _0x5daf89['status'](_0x51eb04)[_0xa6c2('0xf')](_0x24b986);}return _0x5daf89['sendStatus'](0x194);};}function handleError(_0x242df8,_0x2ab70b){_0x2ab70b=_0x2ab70b||0x1f4;return function(_0x8809a2){logger['error'](_0x8809a2[_0xa6c2('0x10')]);if(_0x8809a2[_0xa6c2('0x11')]){delete _0x8809a2[_0xa6c2('0x11')];}_0x242df8[_0xa6c2('0x12')](_0x2ab70b)[_0xa6c2('0x13')](_0x8809a2);};}function findById(_0x314c83){return function(_0x5c1bc7){if(!_[_0xa6c2('0x14')](_0x314c83)&&!_['isNil'](_0x5c1bc7)&&!_['isNil'](_0x5c1bc7[_0xa6c2('0x15')])){return _[_0xa6c2('0x16')](_0x5c1bc7['rows'],function(_0x34ff14){return _0x34ff14['id']==_0x314c83;});}return null;};}exports[_0xa6c2('0x17')]=function(_0xa04346,_0x2031c9){return respondWithRpcPromise(_0xa6c2('0x18'),_0xa04346[_0xa6c2('0x19')])['then'](respondWithResult(_0x2031c9,null))[_0xa6c2('0xe')](handleError(_0x2031c9,null));};exports[_0xa6c2('0x1a')]=function(_0x22a591,_0x248ff7){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xa6c2('0x1b')](_0x22a591[_0xa6c2('0x19')],_0x22a591['params']))[_0xa6c2('0xa')](respondWithResult(_0x248ff7,null))[_0xa6c2('0xe')](handleError(_0x248ff7,null));};exports[_0xa6c2('0x1c')]=function(_0x90ae21,_0x54cd71){return respondWithRpcPromise(_0xa6c2('0x1d'),_[_0xa6c2('0x1b')](_0x90ae21[_0xa6c2('0x19')],_0x90ae21[_0xa6c2('0x1e')]))[_0xa6c2('0xa')](respondWithResult(_0x54cd71,null))['catch'](handleError(_0x54cd71,null));};exports['voiceQueues']=function(_0x48cbb5,_0x1ec916){return respondWithRpcPromise(_0xa6c2('0x1f'),_0x48cbb5['query'])[_0xa6c2('0xa')](respondWithResult(_0x1ec916,null))['catch'](handleError(_0x1ec916,null));};exports[_0xa6c2('0x20')]=function(_0x421263,_0x3d2157){return respondWithRpcPromise(_0xa6c2('0x1f'),_0x421263[_0xa6c2('0x19')])[_0xa6c2('0xa')](findById(_0x421263['params']['id']))[_0xa6c2('0xa')](respondWithResult(_0x3d2157,null))[_0xa6c2('0xe')](handleError(_0x3d2157,null));};exports[_0xa6c2('0x21')]=function(_0x1eefbf,_0x4e73ec){return respondWithRpcPromise(_0xa6c2('0x22'),_[_0xa6c2('0x1b')](_0x1eefbf[_0xa6c2('0x19')],_0x1eefbf[_0xa6c2('0x1e')]))['then'](respondWithResult(_0x4e73ec,null))[_0xa6c2('0xe')](handleError(_0x4e73ec,null));};exports['voiceQueuesChannels']=function(_0x4ab867,_0x3b4244){return respondWithRpcPromise(_0xa6c2('0x23'),_0x4ab867[_0xa6c2('0x19')])[_0xa6c2('0xa')](respondWithResult(_0x3b4244,null))['catch'](handleError(_0x3b4244,null));};exports[_0xa6c2('0x24')]=function(_0x3e5975,_0x357ebc){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xa6c2('0x1b')](_0x3e5975['query'],_0x3e5975[_0xa6c2('0x1e')]))[_0xa6c2('0xa')](respondWithResult(_0x357ebc,null))[_0xa6c2('0xe')](handleError(_0x357ebc,null));};exports['voiceQueuesChannelHangup']=function(_0x3137e1,_0x48bf13){return respondWithRpcPromise(_0xa6c2('0x25'),_[_0xa6c2('0x1b')](_0x3137e1[_0xa6c2('0x19')],_0x3137e1[_0xa6c2('0x1e')]))['then'](respondWithResult(_0x48bf13,null))[_0xa6c2('0xe')](handleError(_0x48bf13,null));};exports[_0xa6c2('0x26')]=function(_0x208531,_0x29a80f){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0x208531['query'],_0x208531[_0xa6c2('0x1e')]))[_0xa6c2('0xa')](respondWithResult(_0x29a80f,null))[_0xa6c2('0xe')](handleError(_0x29a80f,null));};exports[_0xa6c2('0x27')]=function(_0x5ace89,_0x3fa732){return respondWithRpcPromise(_0xa6c2('0x28'),_0x5ace89[_0xa6c2('0x19')])[_0xa6c2('0xa')](respondWithResult(_0x3fa732,null))[_0xa6c2('0xe')](handleError(_0x3fa732,null));};exports[_0xa6c2('0x29')]=function(_0x5c9563,_0x323219){return respondWithRpcPromise(_0xa6c2('0x2a'),_0x5c9563[_0xa6c2('0x19')])[_0xa6c2('0xa')](respondWithResult(_0x323219,null))[_0xa6c2('0xe')](handleError(_0x323219,null));};exports['agents']=function(_0x8c4d4d,_0x322133){var _0x47f929;return respondWithRpcPromise('Agents',_0x8c4d4d[_0xa6c2('0x19')])[_0xa6c2('0xa')](function(_0x501327){_0x47f929=_0x501327;return respondWithRpcPromise(_0xa6c2('0x2b'),_0x8c4d4d[_0xa6c2('0x19')],routingClient);})[_0xa6c2('0xa')](function(_0x3bd006){return _[_0xa6c2('0x1b')]({},_0x3bd006,_0x47f929);})['then'](respondWithResult(_0x322133,null))[_0xa6c2('0xe')](handleError(_0x322133,null));};exports[_0xa6c2('0x2c')]=function(_0x1c8429,_0x927bf0){if(_0x1c8429[_0xa6c2('0x2d')]&&_0x1c8429[_0xa6c2('0x2d')][_0xa6c2('0x2e')]&&_0x1c8429[_0xa6c2('0x2f')]&&_0x1c8429['user'][_0xa6c2('0x11')]){for(var _0x126455 in _0x1c8429[_0xa6c2('0x2d')][_0xa6c2('0x2e')]){if(_0x1c8429['body'][_0xa6c2('0x2e')][_0xa6c2('0x30')](_0x126455)){db[_0xa6c2('0x31')]['findAll']({'where':{'channel':_0x126455,'membername':_0x1c8429[_0xa6c2('0x2f')][_0xa6c2('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1c8429[_0xa6c2('0x2d')][_0xa6c2('0x2e')][_0x126455]&&_0x1c8429[_0xa6c2('0x2d')]['interaction'][_0x126455][_0xa6c2('0x32')]?{'$notIn':_0x1c8429['body']['interaction'][_0x126455]}:{'$ne':null}}})['then'](function(_0x3bd1ad){var _0x60dce5=moment()[_0xa6c2('0x33')](_0xa6c2('0x34'));for(var _0x39be42=0x0,_0x4484c5=_0x3bd1ad['length'];_0x39be42<_0x4484c5;_0x39be42+=0x1){_0x3bd1ad[_0x39be42][_0xa6c2('0x35')]({'exitAt':_0x60dce5});}});for(var _0x3bd0c7=0x0;_0x3bd0c7<_0x1c8429[_0xa6c2('0x2d')]['interaction'][_0x126455]['length'];_0x3bd0c7+=0x1){db[_0xa6c2('0x31')][_0xa6c2('0x36')]({'where':{'channel':_0x126455,'membername':_0x1c8429['user']['name'],'type':'INTERACTION','uniqueid':_0x1c8429[_0xa6c2('0x2d')][_0xa6c2('0x2e')][_0x126455][_0x3bd0c7],'exitAt':null},'defaults':{'channel':_0x126455,'membername':_0x1c8429[_0xa6c2('0x2f')][_0xa6c2('0x11')],'interface':_[_0xa6c2('0x14')](_0x1c8429['user'][_0xa6c2('0x37')])?util['format'](_0xa6c2('0x38'),_0x1c8429[_0xa6c2('0x2f')][_0xa6c2('0x11')]):_0x1c8429[_0xa6c2('0x2f')][_0xa6c2('0x37')],'type':_0xa6c2('0x39'),'enterAt':moment()[_0xa6c2('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xa6c2('0x3a'),'internal':_0x1c8429['user'][_0xa6c2('0x3b')],'uniqueid':_0x1c8429[_0xa6c2('0x2d')]['interaction'][_0x126455][_0x3bd0c7]}});}}}}return respondWithRpcPromise(_0xa6c2('0x3c'),{'id':_0x1c8429[_0xa6c2('0x1e')]['id'],'capacity':_0x1c8429[_0xa6c2('0x2d')][_0xa6c2('0x3d')]},routingClient)[_0xa6c2('0xa')](respondWithResult(_0x927bf0,null))[_0xa6c2('0xe')](handleError(_0x927bf0,null));};exports['telephones']=function(_0x346733,_0xd70cdd){return respondWithRpcPromise(_0xa6c2('0x3e'),_0x346733['query'])[_0xa6c2('0xa')](respondWithResult(_0xd70cdd,null))[_0xa6c2('0xe')](handleError(_0xd70cdd,null));};exports[_0xa6c2('0x3f')]=function(_0x1bbe93,_0x132c6d){return respondWithRpcPromise(_0xa6c2('0x40'),_0x1bbe93[_0xa6c2('0x19')])[_0xa6c2('0xa')](respondWithResult(_0x132c6d,null))['catch'](handleError(_0x132c6d,null));};exports[_0xa6c2('0x41')]=function(_0x36a3de,_0x334fa0){return respondWithRpcPromise(_0xa6c2('0x42'),_0x36a3de[_0xa6c2('0x19')])['then'](respondWithResult(_0x334fa0,null))['catch'](handleError(_0x334fa0,null));};exports['chatQueues']=function(_0x10beb2,_0x27a8a5){return respondWithRpcPromise(_0xa6c2('0x43'),_0x10beb2[_0xa6c2('0x19')],routingClient)['then'](respondWithResult(_0x27a8a5,null))[_0xa6c2('0xe')](handleError(_0x27a8a5,null));};exports[_0xa6c2('0x44')]=function(_0x1c9a31,_0x2ebc4e){return respondWithRpcPromise(_0xa6c2('0x43'),_0x1c9a31[_0xa6c2('0x19')],routingClient)[_0xa6c2('0xa')](findById(_0x1c9a31['params']['id']))[_0xa6c2('0xa')](respondWithResult(_0x2ebc4e,null))['catch'](handleError(_0x2ebc4e,null));};exports['mailQueues']=function(_0x59922d,_0x57f34d){return respondWithRpcPromise(_0xa6c2('0x45'),_0x59922d['query'],routingClient)[_0xa6c2('0xa')](respondWithResult(_0x57f34d,null))[_0xa6c2('0xe')](handleError(_0x57f34d,null));};exports[_0xa6c2('0x46')]=function(_0x1267f9,_0x1ac530){return respondWithRpcPromise(_0xa6c2('0x45'),_0x1267f9[_0xa6c2('0x19')],routingClient)['then'](findById(_0x1267f9['params']['id']))[_0xa6c2('0xa')](respondWithResult(_0x1ac530,null))[_0xa6c2('0xe')](handleError(_0x1ac530,null));};exports[_0xa6c2('0x47')]=function(_0x4bbacf,_0x58e5c5){return respondWithRpcPromise('MailAccounts',_0x4bbacf['query'],mailClient)[_0xa6c2('0xa')](respondWithResult(_0x58e5c5,null))[_0xa6c2('0xe')](handleError(_0x58e5c5,null));};exports[_0xa6c2('0x48')]=function(_0x52e7dc,_0x955203){return respondWithRpcPromise(_0xa6c2('0x49'),_0x52e7dc[_0xa6c2('0x19')],routingClient)[_0xa6c2('0xa')](respondWithResult(_0x955203,null))['catch'](handleError(_0x955203,null));};exports[_0xa6c2('0x4a')]=function(_0x34ddf7,_0x341373){return respondWithRpcPromise('OpenchannelQueues',_0x34ddf7[_0xa6c2('0x19')],routingClient)[_0xa6c2('0xa')](findById(_0x34ddf7[_0xa6c2('0x1e')]['id']))['then'](respondWithResult(_0x341373,null))[_0xa6c2('0xe')](handleError(_0x341373,null));};exports[_0xa6c2('0x4b')]=function(_0xcfa058,_0x2b6d2b){return respondWithRpcPromise(_0xa6c2('0x4c'),_0xcfa058['query'],routingClient)[_0xa6c2('0xa')](respondWithResult(_0x2b6d2b,null))[_0xa6c2('0xe')](handleError(_0x2b6d2b,null));};exports[_0xa6c2('0x4d')]=function(_0xd880b4,_0x543325){return respondWithRpcPromise(_0xa6c2('0x4c'),_0xd880b4[_0xa6c2('0x19')],routingClient)[_0xa6c2('0xa')](findById(_0xd880b4[_0xa6c2('0x1e')]['id']))['then'](respondWithResult(_0x543325,null))[_0xa6c2('0xe')](handleError(_0x543325,null));};exports[_0xa6c2('0x4e')]=function(_0x4ab15f,_0x5744f7){return respondWithRpcPromise(_0xa6c2('0x4f'),_0x4ab15f[_0xa6c2('0x19')],routingClient)[_0xa6c2('0xa')](respondWithResult(_0x5744f7,null))[_0xa6c2('0xe')](handleError(_0x5744f7,null));};exports[_0xa6c2('0x50')]=function(_0x4280c4,_0x1c5f6c){return respondWithRpcPromise(_0xa6c2('0x4f'),_0x4280c4[_0xa6c2('0x19')],routingClient)[_0xa6c2('0xa')](findById(_0x4280c4[_0xa6c2('0x1e')]['id']))[_0xa6c2('0xa')](respondWithResult(_0x1c5f6c,null))[_0xa6c2('0xe')](handleError(_0x1c5f6c,null));};exports[_0xa6c2('0x51')]=function(_0x2e341b,_0x43c562){return respondWithRpcPromise('FaxQueues',_0x2e341b[_0xa6c2('0x19')],routingClient)[_0xa6c2('0xa')](respondWithResult(_0x43c562,null))[_0xa6c2('0xe')](handleError(_0x43c562,null));};exports[_0xa6c2('0x52')]=function(_0x1520a1,_0x170c12){return respondWithRpcPromise('FaxQueues',_0x1520a1[_0xa6c2('0x19')],routingClient)[_0xa6c2('0xa')](findById(_0x1520a1[_0xa6c2('0x1e')]['id']))['then'](respondWithResult(_0x170c12,null))[_0xa6c2('0xe')](handleError(_0x170c12,null));};exports[_0xa6c2('0x53')]=function(_0x1ebf71,_0x5a36c8){return respondWithRpcPromise(_0xa6c2('0x54'),_0x1ebf71[_0xa6c2('0x19')])['then'](respondWithResult(_0x5a36c8,null))[_0xa6c2('0xe')](handleError(_0x5a36c8,null));};exports[_0xa6c2('0x55')]=function(_0x5c6410,_0x13549f){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5c6410['query'],routingClient)[_0xa6c2('0xa')](respondWithResult(_0x13549f,null))[_0xa6c2('0xe')](handleError(_0x13549f,null));};exports[_0xa6c2('0x56')]=function(_0x4c9236,_0xbb5438){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x4c9236[_0xa6c2('0x19')],routingClient)[_0xa6c2('0xa')](respondWithResult(_0xbb5438,null))[_0xa6c2('0xe')](handleError(_0xbb5438,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x4be36d,_0xadca95){return respondWithRpcPromise(_0xa6c2('0x57'),_0x4be36d['query'],routingClient)[_0xa6c2('0xa')](respondWithResult(_0xadca95,null))[_0xa6c2('0xe')](handleError(_0xadca95,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x3e8364,_0x7b9aa5){return respondWithRpcPromise(_0xa6c2('0x57'),_0x3e8364[_0xa6c2('0x19')],routingClient)[_0xa6c2('0xa')](function(_0x2bb173){if(_0x3e8364[_0xa6c2('0x19')][_0xa6c2('0x58')]!==undefined){var _0x36bf19=_(_0x2bb173[_0xa6c2('0x15')])[_0xa6c2('0x59')]([_0x3e8364['query'][_0xa6c2('0x58')],_0x3e8364[_0xa6c2('0x1e')]['id']])['map']('queue_id')[_0xa6c2('0x5a')]()[_0xa6c2('0x5b')]();return _0x2bb173[_0xa6c2('0x15')]['filter'](function(_0x17f26c){return _0x36bf19[_0xa6c2('0x5c')](_0x17f26c[_0xa6c2('0x5d')])>-0x1;});}else{return _0x2bb173[_0xa6c2('0x15')]['filter'](function(_0x2f99c9){return _0x2f99c9['queue_id']===parseInt(_0x3e8364['params']['id']);});}})['then'](respondWithResult(_0x7b9aa5,null))[_0xa6c2('0xe')](handleError(_0x7b9aa5,null));};exports[_0xa6c2('0x5e')]=function(_0xe20773,_0x193e88){return respondWithRpcPromise(_0xa6c2('0x5f'),_0xe20773['query'],routingClient)[_0xa6c2('0xa')](respondWithResult(_0x193e88,null))['catch'](handleError(_0x193e88,null));};exports[_0xa6c2('0x60')]=function(_0x5b57f0,_0x4adbd5){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x5b57f0[_0xa6c2('0x19')],routingClient)[_0xa6c2('0xa')](respondWithResult(_0x4adbd5,null))[_0xa6c2('0xe')](handleError(_0x4adbd5,null));};exports[_0xa6c2('0x61')]=function(_0x1e6cbd,_0x140e24){return respondWithRpcPromise(_0xa6c2('0x62'),_0x1e6cbd[_0xa6c2('0x19')],routingClient)[_0xa6c2('0xa')](respondWithResult(_0x140e24,null))[_0xa6c2('0xe')](handleError(_0x140e24,null));};exports[_0xa6c2('0x63')]=function(_0x4170a4){return function(_0xf30b71,_0x210378){var _0x1e1b50,_0x2aa072;var _0x1e7f7b=_[_0xa6c2('0x64')](_0x4170a4);var _0x5e24a6=_0x4170a4===_0xa6c2('0x65')?_0xa6c2('0x66'):_0xa6c2('0x67');return db[_0x1e7f7b+_0xa6c2('0x68')][_0xa6c2('0x69')]({'raw':!![],'where':{'id':_0xf30b71['params']['id']}})[_0xa6c2('0xa')](function(_0x18249f){if(_[_0xa6c2('0x14')](_0x18249f)){throw new Error(_0x1e7f7b+_0xa6c2('0x6a'));}_0x1e1b50=_0x18249f;return db[_0x1e7f7b+'Message']['findOne']({'where':{'id':_0xf30b71[_0xa6c2('0x2d')][_0xa6c2('0x6b')]},'include':[{'model':db[_0x1e7f7b+'Interaction'],'as':'Interaction'},{'model':db[_0x1e7f7b+_0x5e24a6],'as':_0xa6c2('0x67')}]});})[_0xa6c2('0xa')](function(_0x572789){if(_['isNil'](_0x572789)){throw new Error(_0x1e7f7b+_0xa6c2('0x6c'));}_0x2aa072=_0x572789;return _0x572789[_0xa6c2('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x1fcc9f={'uniqueid':_0x4170a4+'.'+_0x2aa072['id']+'.'+_0x2aa072[_0xa6c2('0x6e')]['id'],'FromUserId':_0xf30b71[_0xa6c2('0x2f')]['id'],'type':_0xa6c2('0x6f')};_0x1fcc9f[_0x1e7f7b+_0xa6c2('0x70')]=_0x2aa072['id'];_0x1fcc9f[_0x1e7f7b+_0xa6c2('0x71')]=_0x2aa072[_0xa6c2('0x6e')]['id'];_0x1fcc9f[_0xa6c2('0x72')+_0x1e7f7b+_0x5e24a6+'Id']=_0x2aa072['Account']['id'];_0x1fcc9f['To'+_0x1e7f7b+'QueueId']=_0x1e1b50['id'];return db[_0x1e7f7b+_0xa6c2('0x73')][_0xa6c2('0x74')](_0x1fcc9f);})[_0xa6c2('0xa')](function(){return respondWithRpcPromise(_0xa6c2('0x75'),{'channel':_0x4170a4,'interaction':_0x2aa072[_0xa6c2('0x6e')],'message':_0x2aa072,'account':_0x2aa072[_0xa6c2('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa6c2('0x6f'),'appdata':_0x1e1b50[_0xa6c2('0x11')]+','+(_0x2aa072[_0xa6c2('0x67')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x210378,null))['catch'](handleError(_0x210378,null));};};exports[_0xa6c2('0x76')]=function(_0x257e9a,_0x15b28d){var _0x1b39a0,_0x5abba2;if(_[_0xa6c2('0x14')](_0x257e9a[_0xa6c2('0x2d')][_0xa6c2('0x77')])){throw new Error(_0xa6c2('0x78'));}var _0xfb0575=_0x257e9a[_0xa6c2('0x2d')][_0xa6c2('0x77')];var _0x378fca=_[_0xa6c2('0x64')](_0xfb0575);var _0xd4bafd=_0xfb0575==='chat'?_0xa6c2('0x66'):'Account';return db[_0xa6c2('0x79')][_0xa6c2('0x69')]({'raw':!![],'where':{'id':_0x257e9a[_0xa6c2('0x1e')]['id'],'role':_0xa6c2('0x3a')}})[_0xa6c2('0xa')](function(_0x1eb42){if(_[_0xa6c2('0x14')](_0x1eb42)){throw new Error('Agent\x20not\x20found');}_0x1b39a0=_0x1eb42;return db[_0x378fca+_0xa6c2('0x7a')][_0xa6c2('0x69')]({'where':{'id':_0x257e9a['body'][_0xa6c2('0x6b')]},'include':[{'model':db[_0x378fca+_0xa6c2('0x6e')],'as':'Interaction'},{'model':db[_0x378fca+_0xd4bafd],'as':_0xa6c2('0x67')}]});})[_0xa6c2('0xa')](function(_0x3e04c0){if(_[_0xa6c2('0x14')](_0x3e04c0)){throw new Error(_0x378fca+_0xa6c2('0x6c'));}_0x5abba2=_0x3e04c0;return _0x3e04c0[_0xa6c2('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa6c2('0xa')](function(){var _0xbe6e35={'uniqueid':_0xfb0575+'.'+_0x5abba2['id']+'.'+_0x5abba2['Interaction']['id'],'FromUserId':_0x257e9a[_0xa6c2('0x2f')]['id'],'type':'queue','ToUserId':_0x1b39a0['id']};_0xbe6e35[_0x378fca+_0xa6c2('0x70')]=_0x5abba2['id'];_0xbe6e35[_0x378fca+_0xa6c2('0x71')]=_0x5abba2['Interaction']['id'];_0xbe6e35[_0xa6c2('0x72')+_0x378fca+_0xd4bafd+'Id']=_0x5abba2['Account']['id'];return db[_0x378fca+'TransferReport'][_0xa6c2('0x74')](_0xbe6e35);})[_0xa6c2('0xa')](function(){return respondWithRpcPromise(_0xa6c2('0x75'),{'channel':_0xfb0575,'interaction':_0x5abba2[_0xa6c2('0x6e')],'message':_0x5abba2,'account':_0x5abba2[_0xa6c2('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa6c2('0x3a'),'appdata':_0x1b39a0[_0xa6c2('0x11')]+','+(_0x5abba2['Account'][_0xa6c2('0x7b')]||0x12c),'interval':_0xa6c2('0x7c')}]},routingClient);})[_0xa6c2('0xa')](respondWithResult(_0x15b28d,null))['catch'](handleError(_0x15b28d,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index fd3d9e8..fa08a72 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 _0xc024=['isAuthenticated','/:id','/:id/run','create','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get'];(function(_0x5f1fd3,_0x2592ea){var _0x5ecb14=function(_0x3c3972){while(--_0x3c3972){_0x5f1fd3['push'](_0x5f1fd3['shift']());}};_0x5ecb14(++_0x2592ea);}(_0xc024,0x19f));var _0x4c02=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xc024[_0x279d37];return _0x530173;};'use strict';var multer=require('multer');var util=require(_0x4c02('0x0'));var path=require(_0x4c02('0x1'));var timeout=require(_0x4c02('0x2'));var express=require(_0x4c02('0x3'));var router=express[_0x4c02('0x4')]();var auth=require(_0x4c02('0x5'));var interaction=require(_0x4c02('0x6'));var config=require(_0x4c02('0x7'));var controller=require(_0x4c02('0x8'));router[_0x4c02('0x9')]('/',auth[_0x4c02('0xa')](),controller['index']);router[_0x4c02('0x9')](_0x4c02('0xb'),auth[_0x4c02('0xa')](),controller['show']);router[_0x4c02('0x9')](_0x4c02('0xc'),auth[_0x4c02('0xa')](),controller['run']);router['post']('/',auth['isAuthenticated'](),controller[_0x4c02('0xd')]);router['put'](_0x4c02('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x4c02('0xe')](_0x4c02('0xb'),auth[_0x4c02('0xa')](),controller[_0x4c02('0xf')]);module[_0x4c02('0x10')]=router; \ No newline at end of file +var _0x5997=['post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','isAuthenticated','show','/:id/run','run'];(function(_0x2b55ec,_0x3eca28){var _0x9debfd=function(_0x415a4f){while(--_0x415a4f){_0x2b55ec['push'](_0x2b55ec['shift']());}};_0x9debfd(++_0x3eca28);}(_0x5997,0x197));var _0x7599=function(_0x411fa3,_0x1299e6){_0x411fa3=_0x411fa3-0x0;var _0x283fde=_0x5997[_0x411fa3];return _0x283fde;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7599('0x0'));var timeout=require(_0x7599('0x1'));var express=require(_0x7599('0x2'));var router=express[_0x7599('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7599('0x4'));var config=require(_0x7599('0x5'));var controller=require(_0x7599('0x6'));router[_0x7599('0x7')]('/',auth['isAuthenticated'](),controller[_0x7599('0x8')]);router[_0x7599('0x7')]('/:id',auth[_0x7599('0x9')](),controller[_0x7599('0xa')]);router['get'](_0x7599('0xb'),auth[_0x7599('0x9')](),controller[_0x7599('0xc')]);router[_0x7599('0xd')]('/',auth[_0x7599('0x9')](),controller[_0x7599('0xe')]);router[_0x7599('0xf')](_0x7599('0x10'),auth[_0x7599('0x9')](),controller[_0x7599('0x11')]);router[_0x7599('0x12')](_0x7599('0x10'),auth[_0x7599('0x9')](),controller[_0x7599('0x13')]);module[_0x7599('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 9bda4b6..a10d379 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 _0x0ef4=['minutes','csv','pdf','custom','default','BOOLEAN','TEXT','exports','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','months','weeks','days','hours'];(function(_0x336b4b,_0x3da0a0){var _0x41a72e=function(_0x836635){while(--_0x836635){_0x336b4b['push'](_0x336b4b['shift']());}};_0x41a72e(++_0x3da0a0);}(_0x0ef4,0xc7));var _0x40ef=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0x0ef4[_0x1ca890];return _0x3f8e01;};'use strict';var Sequelize=require('sequelize');module[_0x40ef('0x0')]={'name':{'type':Sequelize[_0x40ef('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x40ef('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x40ef('0x2')},'startAt':{'type':Sequelize[_0x40ef('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x40ef('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x40ef('0x4')]('years','quarters',_0x40ef('0x5'),_0x40ef('0x6'),_0x40ef('0x7'),_0x40ef('0x8'),_0x40ef('0x9')),'allowNull':![],'defaultValue':_0x40ef('0x7')},'output':{'type':Sequelize[_0x40ef('0x4')](_0x40ef('0xa'),_0x40ef('0xb'),'xlsx'),'allowNull':![],'defaultValue':_0x40ef('0xa')},'type':{'type':Sequelize['ENUM'](_0x40ef('0xc'),_0x40ef('0xd')),'allowNull':![],'defaultValue':_0x40ef('0xc')},'sendMail':{'type':Sequelize[_0x40ef('0xe')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x40ef('0xf')]},'bcc':{'type':Sequelize[_0x40ef('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x40ef('0xe')],'defaultValue':!![]}}; \ No newline at end of file +var _0x539d=['STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','days','hours','minutes','csv','pdf','xlsx','custom','default','BOOLEAN','TEXT','sequelize'];(function(_0x264bc4,_0x1db236){var _0x2cdccd=function(_0x42ed13){while(--_0x42ed13){_0x264bc4['push'](_0x264bc4['shift']());}};_0x2cdccd(++_0x1db236);}(_0x539d,0x17b));var _0xd539=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x539d[_0x5cbf0e];return _0x1c76f8;};'use strict';var Sequelize=require(_0xd539('0x0'));module['exports']={'name':{'type':Sequelize[_0xd539('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd539('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd539('0x2')},'startAt':{'type':Sequelize[_0xd539('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xd539('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xd539('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd539('0x5')]('years',_0xd539('0x6'),_0xd539('0x7'),_0xd539('0x8'),_0xd539('0x9'),_0xd539('0xa'),_0xd539('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xd539('0x5')](_0xd539('0xc'),_0xd539('0xd'),_0xd539('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0xd539('0xf'),_0xd539('0x10')),'allowNull':![],'defaultValue':_0xd539('0xf')},'sendMail':{'type':Sequelize[_0xd539('0x11')],'defaultValue':![]},'email':{'type':Sequelize[_0xd539('0x1')]},'cc':{'type':Sequelize[_0xd539('0x12')]},'bcc':{'type':Sequelize[_0xd539('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xd539('0x11')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index c4b3998..2d7b0bb 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 _0x7785=['squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','reject','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','util','path','to-csv','ejs'];(function(_0xf804d4,_0x46b271){var _0x24afaa=function(_0x16faa4){while(--_0x16faa4){_0xf804d4['push'](_0xf804d4['shift']());}};_0x24afaa(++_0x46b271);}(_0x7785,0x1cb));var _0x5778=function(_0xd365dc,_0x573a11){_0xd365dc=_0xd365dc-0x0;var _0x198418=_0x7785[_0xd365dc];return _0x198418;};'use strict';var pdf=require(_0x5778('0x0'));var emlformat=require(_0x5778('0x1'));var rimraf=require(_0x5778('0x2'));var zipdir=require(_0x5778('0x3'));var jsonpatch=require(_0x5778('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5778('0x5'));var path=require(_0x5778('0x6'));var sox=require('sox');var csv=require(_0x5778('0x7'));var ejs=require(_0x5778('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5778('0x9'));var crypto=require(_0x5778('0xa'));var jsforce=require(_0x5778('0xb'));var deskjs=require(_0x5778('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5778('0xd'));var authService=require(_0x5778('0xe'));var qs=require(_0x5778('0xf'));var as=require(_0x5778('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5778('0x11'));var utils=require(_0x5778('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5778('0x13'))['db'];function respondWithStatusCode(_0x16b121,_0x4a7de4){_0x4a7de4=_0x4a7de4||0xcc;return function(_0x524c91){if(_0x524c91){return _0x16b121['sendStatus'](_0x4a7de4);}return _0x16b121[_0x5778('0x14')](_0x4a7de4)[_0x5778('0x15')]();};}function respondWithResult(_0x46d6af,_0x54f444){_0x54f444=_0x54f444||0xc8;return function(_0x3772db){if(_0x3772db){return _0x46d6af['status'](_0x54f444)[_0x5778('0x16')](_0x3772db);}};}function respondWithFilteredResult(_0xaf6af5,_0x2cd2d1){return function(_0x467f89){if(_0x467f89){var _0x5df5e3=_0x467f89[_0x5778('0x17')],_0x1adaec=_0x2cd2d1[_0x5778('0x18')],_0x279484=_0x2cd2d1[_0x5778('0x18')]+_0x2cd2d1[_0x5778('0x19')],_0x186987;if(_0x279484>=_0x5df5e3){_0x279484=_0x5df5e3;_0x186987=0xc8;}else{_0x186987=0xce;}_0xaf6af5[_0x5778('0x14')](_0x186987);return _0xaf6af5[_0x5778('0x1a')]('Content-Range',_0x1adaec+'-'+_0x279484+'/'+_0x5df5e3)['json'](_0x467f89);}return null;};}function patchUpdates(_0xcb40e6){return function(_0x48cfd3){try{jsonpatch['apply'](_0x48cfd3,_0xcb40e6,!![]);}catch(_0x12335a){return BPromise[_0x5778('0x1b')](_0x12335a);}return _0x48cfd3['save']();};}function saveUpdates(_0x5cf7c6,_0x48e54b){return function(_0x7e637c){if(_0x7e637c){return _0x7e637c[_0x5778('0x1c')](_0x5cf7c6)[_0x5778('0x1d')](function(_0x4cc085){return _0x4cc085;});}return null;};}function removeEntity(_0x1170be,_0x5ba3eb){return function(_0x3e7cd2){if(_0x3e7cd2){return _0x3e7cd2[_0x5778('0x1e')]()[_0x5778('0x1d')](function(){var _0x57215f=_0x3e7cd2[_0x5778('0x1f')]({'plain':!![]});var _0x3da2ca=_0x5778('0x20');return db[_0x5778('0x21')][_0x5778('0x1e')]({'where':{'type':_0x3da2ca,'resourceId':_0x57215f['id']}})['then'](function(){return _0x3e7cd2;});})['then'](function(){_0x1170be[_0x5778('0x14')](0xcc)[_0x5778('0x15')]();});}};}function handleEntityNotFound(_0x25c21c,_0x2a3499){return function(_0x29a10c){if(!_0x29a10c){_0x25c21c[_0x5778('0x22')](0x194);}return _0x29a10c;};}function handleError(_0x534035,_0x38d344){_0x38d344=_0x38d344||0x1f4;return function(_0x25e312){logger[_0x5778('0x23')](_0x25e312[_0x5778('0x24')]);if(_0x25e312[_0x5778('0x25')]){delete _0x25e312[_0x5778('0x25')];}_0x534035[_0x5778('0x14')](_0x38d344)[_0x5778('0x26')](_0x25e312);};}exports[_0x5778('0x27')]=function(_0x279bfb,_0x456579){var _0x4eedd7={},_0x58dcee={},_0x37aa7d={'count':0x0,'rows':[]};var _0x1a8a7e=_[_0x5778('0x28')](db[_0x5778('0x29')][_0x5778('0x2a')],function(_0x4e6666){return{'name':_0x4e6666[_0x5778('0x2b')],'type':_0x4e6666['type'][_0x5778('0x2c')]};});_0x58dcee[_0x5778('0x2d')]=_[_0x5778('0x28')](_0x1a8a7e,_0x5778('0x25'));_0x58dcee[_0x5778('0x2e')]=_[_0x5778('0x2f')](_0x279bfb[_0x5778('0x2e')]);_0x58dcee[_0x5778('0x30')]=_[_0x5778('0x31')](_0x58dcee['model'],_0x58dcee['query']);_0x4eedd7[_0x5778('0x32')]=_[_0x5778('0x31')](_0x58dcee[_0x5778('0x2d')],qs[_0x5778('0x33')](_0x279bfb[_0x5778('0x2e')][_0x5778('0x33')]));_0x4eedd7['attributes']=_0x4eedd7[_0x5778('0x32')][_0x5778('0x34')]?_0x4eedd7['attributes']:_0x58dcee[_0x5778('0x2d')];if(!_0x279bfb[_0x5778('0x2e')]['hasOwnProperty'](_0x5778('0x35'))){_0x4eedd7[_0x5778('0x19')]=qs[_0x5778('0x19')](_0x279bfb[_0x5778('0x2e')][_0x5778('0x19')]);_0x4eedd7[_0x5778('0x18')]=qs[_0x5778('0x18')](_0x279bfb[_0x5778('0x2e')][_0x5778('0x18')]);}_0x4eedd7[_0x5778('0x36')]=qs['sort'](_0x279bfb[_0x5778('0x2e')][_0x5778('0x37')]);_0x4eedd7[_0x5778('0x38')]=qs[_0x5778('0x30')](_[_0x5778('0x39')](_0x279bfb[_0x5778('0x2e')],_0x58dcee[_0x5778('0x30')]),_0x1a8a7e);if(_0x279bfb[_0x5778('0x2e')][_0x5778('0x3a')]){_0x4eedd7['where']=_['merge'](_0x4eedd7['where'],{'$or':_['map'](_0x1a8a7e,function(_0x5e06d8){if(_0x5e06d8['type']!==_0x5778('0x3b')){var _0x127c5d={};_0x127c5d[_0x5e06d8[_0x5778('0x25')]]={'$like':'%'+_0x279bfb[_0x5778('0x2e')][_0x5778('0x3a')]+'%'};return _0x127c5d;}})});}_0x4eedd7=_[_0x5778('0x3c')]({},_0x4eedd7,_0x279bfb[_0x5778('0x3d')]);var _0x560d9b={'where':_0x4eedd7[_0x5778('0x38')]};return db[_0x5778('0x29')][_0x5778('0x17')](_0x560d9b)[_0x5778('0x1d')](function(_0x1ed55e){_0x37aa7d['count']=_0x1ed55e;if(_0x279bfb[_0x5778('0x2e')]['includeAll']){_0x4eedd7[_0x5778('0x3e')]=[{'all':!![]}];}return db['Schedule'][_0x5778('0x3f')](_0x4eedd7);})['then'](function(_0x5a6795){_0x37aa7d[_0x5778('0x40')]=_0x5a6795;return _0x37aa7d;})[_0x5778('0x1d')](respondWithFilteredResult(_0x456579,_0x4eedd7))[_0x5778('0x41')](handleError(_0x456579,null));};exports[_0x5778('0x42')]=function(_0x35af97,_0x3584a7){var _0x41bbed={'raw':![],'where':{'id':_0x35af97[_0x5778('0x43')]['id']}},_0x2c5f91={};_0x2c5f91[_0x5778('0x2d')]=_['keys'](db[_0x5778('0x29')]['rawAttributes']);_0x2c5f91[_0x5778('0x2e')]=_[_0x5778('0x2f')](_0x35af97[_0x5778('0x2e')]);_0x2c5f91[_0x5778('0x30')]=_[_0x5778('0x31')](_0x2c5f91['model'],_0x2c5f91[_0x5778('0x2e')]);_0x41bbed[_0x5778('0x32')]=_[_0x5778('0x31')](_0x2c5f91[_0x5778('0x2d')],qs[_0x5778('0x33')](_0x35af97[_0x5778('0x2e')]['fields']));_0x41bbed[_0x5778('0x32')]=_0x41bbed[_0x5778('0x32')][_0x5778('0x34')]?_0x41bbed[_0x5778('0x32')]:_0x2c5f91[_0x5778('0x2d')];if(_0x35af97['query']['includeAll']){_0x41bbed[_0x5778('0x3e')]=[{'all':!![]}];}_0x41bbed=_[_0x5778('0x3c')]({},_0x41bbed,_0x35af97[_0x5778('0x3d')]);return db[_0x5778('0x29')][_0x5778('0x44')](_0x41bbed)[_0x5778('0x1d')](handleEntityNotFound(_0x3584a7,null))[_0x5778('0x1d')](respondWithResult(_0x3584a7,null))[_0x5778('0x41')](handleError(_0x3584a7,null));};exports['create']=function(_0xcc51e9,_0x30c9d7){return db[_0x5778('0x29')][_0x5778('0x45')](_0xcc51e9[_0x5778('0x46')],{})[_0x5778('0x1d')](function(_0x49abd1){var _0x4b2311=_0xcc51e9[_0x5778('0x47')][_0x5778('0x1f')]({'plain':!![]});if(!_0x4b2311)throw new Error(_0x5778('0x48'));if(_0x4b2311[_0x5778('0x49')]===_0x5778('0x47')){var _0x2cb27b=_0x49abd1[_0x5778('0x1f')]({'plain':!![]});var _0x56cd2d='Scheduler';return db['UserProfileSection'][_0x5778('0x44')]({'where':{'name':_0x56cd2d,'userProfileId':_0x4b2311[_0x5778('0x4a')]},'raw':!![]})[_0x5778('0x1d')](function(_0xd12570){if(_0xd12570&&_0xd12570['autoAssociation']===0x0){return db[_0x5778('0x21')][_0x5778('0x45')]({'name':_0x2cb27b[_0x5778('0x25')],'resourceId':_0x2cb27b['id'],'type':_0xd12570[_0x5778('0x25')],'sectionId':_0xd12570['id']},{})[_0x5778('0x1d')](function(){return _0x49abd1;});}else{return _0x49abd1;}})[_0x5778('0x41')](function(_0x1a809d){logger[_0x5778('0x23')](_0x5778('0x4b'),_0x1a809d);throw _0x1a809d;});}return _0x49abd1;})['then'](respondWithResult(_0x30c9d7,0xc9))['catch'](handleError(_0x30c9d7,null));};exports[_0x5778('0x1c')]=function(_0x49e01f,_0x5ad0b0){if(_0x49e01f[_0x5778('0x46')]['id']){delete _0x49e01f['body']['id'];}return db[_0x5778('0x29')][_0x5778('0x44')]({'where':{'id':_0x49e01f[_0x5778('0x43')]['id']}})[_0x5778('0x1d')](handleEntityNotFound(_0x5ad0b0,null))['then'](saveUpdates(_0x49e01f[_0x5778('0x46')],null))[_0x5778('0x1d')](respondWithResult(_0x5ad0b0,null))['catch'](handleError(_0x5ad0b0,null));};exports['destroy']=function(_0x14dde8,_0x515193){return db[_0x5778('0x29')][_0x5778('0x44')]({'where':{'id':_0x14dde8[_0x5778('0x43')]['id']}})[_0x5778('0x1d')](handleEntityNotFound(_0x515193,null))[_0x5778('0x1d')](removeEntity(_0x515193,null))['catch'](handleError(_0x515193,null));};exports[_0x5778('0x4c')]=function(_0x1e772d,_0x62ac31,_0x24ba7d){var _0x16a7e8=require(_0x5778('0x4d'));return db[_0x5778('0x29')][_0x5778('0x44')]({'where':{'id':_0x1e772d[_0x5778('0x43')]['id']},'raw':!![]})[_0x5778('0x1d')](handleEntityNotFound(_0x62ac31,null))[_0x5778('0x1d')](function(){_0x16a7e8['run'](_0x1e772d[_0x5778('0x43')]['id']);})[_0x5778('0x1d')](respondWithStatusCode(_0x62ac31,null))[_0x5778('0x41')](handleError(_0x62ac31,null));}; \ No newline at end of file +var _0x3e3b=['userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','Schedule','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','rows','catch','show','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x4a9b47,_0x336b91){var _0x316c4a=function(_0x2a5398){while(--_0x2a5398){_0x4a9b47['push'](_0x4a9b47['shift']());}};_0x316c4a(++_0x336b91);}(_0x3e3b,0x106));var _0xb3e3=function(_0x162257,_0x43935b){_0x162257=_0x162257-0x0;var _0x2ac167=_0x3e3b[_0x162257];return _0x2ac167;};'use strict';var pdf=require(_0xb3e3('0x0'));var emlformat=require(_0xb3e3('0x1'));var rimraf=require(_0xb3e3('0x2'));var zipdir=require(_0xb3e3('0x3'));var jsonpatch=require(_0xb3e3('0x4'));var rp=require(_0xb3e3('0x5'));var moment=require('moment');var BPromise=require(_0xb3e3('0x6'));var Mustache=require(_0xb3e3('0x7'));var util=require(_0xb3e3('0x8'));var path=require(_0xb3e3('0x9'));var sox=require('sox');var csv=require(_0xb3e3('0xa'));var ejs=require(_0xb3e3('0xb'));var fs=require('fs');var _=require(_0xb3e3('0xc'));var squel=require(_0xb3e3('0xd'));var crypto=require(_0xb3e3('0xe'));var jsforce=require(_0xb3e3('0xf'));var deskjs=require(_0xb3e3('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb3e3('0x11'));var Papa=require('papaparse');var Redis=require(_0xb3e3('0x12'));var authService=require(_0xb3e3('0x13'));var qs=require(_0xb3e3('0x14'));var as=require(_0xb3e3('0x15'));var hardwareService=require(_0xb3e3('0x16'));var logger=require(_0xb3e3('0x17'))(_0xb3e3('0x18'));var utils=require(_0xb3e3('0x19'));var config=require(_0xb3e3('0x1a'));var licenseUtil=require(_0xb3e3('0x1b'));var db=require(_0xb3e3('0x1c'))['db'];function respondWithStatusCode(_0x5a7a35,_0x2b5b90){_0x2b5b90=_0x2b5b90||0xcc;return function(_0x2ffbd9){if(_0x2ffbd9){return _0x5a7a35[_0xb3e3('0x1d')](_0x2b5b90);}return _0x5a7a35[_0xb3e3('0x1e')](_0x2b5b90)[_0xb3e3('0x1f')]();};}function respondWithResult(_0x468519,_0x5b8e71){_0x5b8e71=_0x5b8e71||0xc8;return function(_0x55d0b6){if(_0x55d0b6){return _0x468519['status'](_0x5b8e71)[_0xb3e3('0x20')](_0x55d0b6);}};}function respondWithFilteredResult(_0x1efe02,_0x4465d8){return function(_0x50fd04){if(_0x50fd04){var _0x463075=_0x50fd04[_0xb3e3('0x21')],_0x440b8e=_0x4465d8[_0xb3e3('0x22')],_0x198d11=_0x4465d8[_0xb3e3('0x22')]+_0x4465d8[_0xb3e3('0x23')],_0xc6b1a2;if(_0x198d11>=_0x463075){_0x198d11=_0x463075;_0xc6b1a2=0xc8;}else{_0xc6b1a2=0xce;}_0x1efe02[_0xb3e3('0x1e')](_0xc6b1a2);return _0x1efe02[_0xb3e3('0x24')]('Content-Range',_0x440b8e+'-'+_0x198d11+'/'+_0x463075)[_0xb3e3('0x20')](_0x50fd04);}return null;};}function patchUpdates(_0x190aa3){return function(_0x25fc8f){try{jsonpatch['apply'](_0x25fc8f,_0x190aa3,!![]);}catch(_0xc9379f){return BPromise['reject'](_0xc9379f);}return _0x25fc8f[_0xb3e3('0x25')]();};}function saveUpdates(_0xedb3e0,_0x1d5cec){return function(_0x43bde6){if(_0x43bde6){return _0x43bde6[_0xb3e3('0x26')](_0xedb3e0)[_0xb3e3('0x27')](function(_0x5d582c){return _0x5d582c;});}return null;};}function removeEntity(_0x1b44f0,_0x49c87e){return function(_0x447de5){if(_0x447de5){return _0x447de5[_0xb3e3('0x28')]()[_0xb3e3('0x27')](function(){var _0x22f464=_0x447de5[_0xb3e3('0x29')]({'plain':!![]});var _0x19af98=_0xb3e3('0x2a');return db[_0xb3e3('0x2b')]['destroy']({'where':{'type':_0x19af98,'resourceId':_0x22f464['id']}})[_0xb3e3('0x27')](function(){return _0x447de5;});})[_0xb3e3('0x27')](function(){_0x1b44f0[_0xb3e3('0x1e')](0xcc)[_0xb3e3('0x1f')]();});}};}function handleEntityNotFound(_0x1edaaf,_0x135ac7){return function(_0x12e1c4){if(!_0x12e1c4){_0x1edaaf['sendStatus'](0x194);}return _0x12e1c4;};}function handleError(_0x45fa4a,_0x4fb60e){_0x4fb60e=_0x4fb60e||0x1f4;return function(_0x233263){logger[_0xb3e3('0x2c')](_0x233263[_0xb3e3('0x2d')]);if(_0x233263[_0xb3e3('0x2e')]){delete _0x233263['name'];}_0x45fa4a[_0xb3e3('0x1e')](_0x4fb60e)[_0xb3e3('0x2f')](_0x233263);};}exports['index']=function(_0x31c1de,_0x1f48ea){var _0x2e096c={},_0x51e6dd={},_0x4e9f90={'count':0x0,'rows':[]};var _0x23041d=_['map'](db[_0xb3e3('0x30')][_0xb3e3('0x31')],function(_0x3b431d){return{'name':_0x3b431d[_0xb3e3('0x32')],'type':_0x3b431d['type']['key']};});_0x51e6dd[_0xb3e3('0x33')]=_[_0xb3e3('0x34')](_0x23041d,_0xb3e3('0x2e'));_0x51e6dd[_0xb3e3('0x35')]=_['keys'](_0x31c1de[_0xb3e3('0x35')]);_0x51e6dd[_0xb3e3('0x36')]=_[_0xb3e3('0x37')](_0x51e6dd[_0xb3e3('0x33')],_0x51e6dd[_0xb3e3('0x35')]);_0x2e096c[_0xb3e3('0x38')]=_[_0xb3e3('0x37')](_0x51e6dd[_0xb3e3('0x33')],qs[_0xb3e3('0x39')](_0x31c1de[_0xb3e3('0x35')][_0xb3e3('0x39')]));_0x2e096c[_0xb3e3('0x38')]=_0x2e096c[_0xb3e3('0x38')][_0xb3e3('0x3a')]?_0x2e096c['attributes']:_0x51e6dd[_0xb3e3('0x33')];if(!_0x31c1de[_0xb3e3('0x35')][_0xb3e3('0x3b')](_0xb3e3('0x3c'))){_0x2e096c[_0xb3e3('0x23')]=qs[_0xb3e3('0x23')](_0x31c1de[_0xb3e3('0x35')][_0xb3e3('0x23')]);_0x2e096c[_0xb3e3('0x22')]=qs[_0xb3e3('0x22')](_0x31c1de[_0xb3e3('0x35')]['offset']);}_0x2e096c[_0xb3e3('0x3d')]=qs[_0xb3e3('0x3e')](_0x31c1de['query'][_0xb3e3('0x3e')]);_0x2e096c[_0xb3e3('0x3f')]=qs[_0xb3e3('0x36')](_[_0xb3e3('0x40')](_0x31c1de[_0xb3e3('0x35')],_0x51e6dd[_0xb3e3('0x36')]),_0x23041d);if(_0x31c1de[_0xb3e3('0x35')][_0xb3e3('0x41')]){_0x2e096c[_0xb3e3('0x3f')]=_[_0xb3e3('0x42')](_0x2e096c[_0xb3e3('0x3f')],{'$or':_['map'](_0x23041d,function(_0x238edc){if(_0x238edc[_0xb3e3('0x43')]!=='VIRTUAL'){var _0x43de0b={};_0x43de0b[_0x238edc[_0xb3e3('0x2e')]]={'$like':'%'+_0x31c1de[_0xb3e3('0x35')][_0xb3e3('0x41')]+'%'};return _0x43de0b;}})});}_0x2e096c=_[_0xb3e3('0x42')]({},_0x2e096c,_0x31c1de['options']);var _0x2f5b38={'where':_0x2e096c[_0xb3e3('0x3f')]};return db[_0xb3e3('0x30')][_0xb3e3('0x21')](_0x2f5b38)[_0xb3e3('0x27')](function(_0x23ba06){_0x4e9f90['count']=_0x23ba06;if(_0x31c1de[_0xb3e3('0x35')][_0xb3e3('0x44')]){_0x2e096c[_0xb3e3('0x45')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x2e096c);})[_0xb3e3('0x27')](function(_0x587271){_0x4e9f90[_0xb3e3('0x46')]=_0x587271;return _0x4e9f90;})[_0xb3e3('0x27')](respondWithFilteredResult(_0x1f48ea,_0x2e096c))[_0xb3e3('0x47')](handleError(_0x1f48ea,null));};exports[_0xb3e3('0x48')]=function(_0x4cf453,_0xb938ac){var _0x445e81={'raw':![],'where':{'id':_0x4cf453['params']['id']}},_0x155e5c={};_0x155e5c[_0xb3e3('0x33')]=_[_0xb3e3('0x49')](db['Schedule'][_0xb3e3('0x31')]);_0x155e5c[_0xb3e3('0x35')]=_[_0xb3e3('0x49')](_0x4cf453[_0xb3e3('0x35')]);_0x155e5c['filters']=_[_0xb3e3('0x37')](_0x155e5c['model'],_0x155e5c[_0xb3e3('0x35')]);_0x445e81[_0xb3e3('0x38')]=_['intersection'](_0x155e5c[_0xb3e3('0x33')],qs[_0xb3e3('0x39')](_0x4cf453[_0xb3e3('0x35')]['fields']));_0x445e81['attributes']=_0x445e81[_0xb3e3('0x38')][_0xb3e3('0x3a')]?_0x445e81[_0xb3e3('0x38')]:_0x155e5c['model'];if(_0x4cf453['query'][_0xb3e3('0x44')]){_0x445e81[_0xb3e3('0x45')]=[{'all':!![]}];}_0x445e81=_['merge']({},_0x445e81,_0x4cf453[_0xb3e3('0x4a')]);return db[_0xb3e3('0x30')][_0xb3e3('0x4b')](_0x445e81)[_0xb3e3('0x27')](handleEntityNotFound(_0xb938ac,null))[_0xb3e3('0x27')](respondWithResult(_0xb938ac,null))[_0xb3e3('0x47')](handleError(_0xb938ac,null));};exports[_0xb3e3('0x4c')]=function(_0x40531e,_0x3f20b5){return db[_0xb3e3('0x30')][_0xb3e3('0x4c')](_0x40531e[_0xb3e3('0x4d')],{})[_0xb3e3('0x27')](function(_0x206d32){var _0x5801c9=_0x40531e[_0xb3e3('0x4e')][_0xb3e3('0x29')]({'plain':!![]});if(!_0x5801c9)throw new Error(_0xb3e3('0x4f'));if(_0x5801c9[_0xb3e3('0x50')]===_0xb3e3('0x4e')){var _0x2a2c9f=_0x206d32[_0xb3e3('0x29')]({'plain':!![]});var _0x24ae00=_0xb3e3('0x2a');return db[_0xb3e3('0x51')][_0xb3e3('0x4b')]({'where':{'name':_0x24ae00,'userProfileId':_0x5801c9[_0xb3e3('0x52')]},'raw':!![]})[_0xb3e3('0x27')](function(_0x5577d1){if(_0x5577d1&&_0x5577d1['autoAssociation']===0x0){return db[_0xb3e3('0x2b')]['create']({'name':_0x2a2c9f[_0xb3e3('0x2e')],'resourceId':_0x2a2c9f['id'],'type':_0x5577d1[_0xb3e3('0x2e')],'sectionId':_0x5577d1['id']},{})['then'](function(){return _0x206d32;});}else{return _0x206d32;}})[_0xb3e3('0x47')](function(_0x99150b){logger[_0xb3e3('0x2c')](_0xb3e3('0x53'),_0x99150b);throw _0x99150b;});}return _0x206d32;})[_0xb3e3('0x27')](respondWithResult(_0x3f20b5,0xc9))[_0xb3e3('0x47')](handleError(_0x3f20b5,null));};exports[_0xb3e3('0x26')]=function(_0x4480ac,_0x210e31){if(_0x4480ac[_0xb3e3('0x4d')]['id']){delete _0x4480ac[_0xb3e3('0x4d')]['id'];}return db[_0xb3e3('0x30')][_0xb3e3('0x4b')]({'where':{'id':_0x4480ac[_0xb3e3('0x54')]['id']}})['then'](handleEntityNotFound(_0x210e31,null))[_0xb3e3('0x27')](saveUpdates(_0x4480ac[_0xb3e3('0x4d')],null))[_0xb3e3('0x27')](respondWithResult(_0x210e31,null))[_0xb3e3('0x47')](handleError(_0x210e31,null));};exports[_0xb3e3('0x28')]=function(_0xfc09b,_0x5453ed){return db[_0xb3e3('0x30')]['find']({'where':{'id':_0xfc09b['params']['id']}})['then'](handleEntityNotFound(_0x5453ed,null))[_0xb3e3('0x27')](removeEntity(_0x5453ed,null))['catch'](handleError(_0x5453ed,null));};exports[_0xb3e3('0x55')]=function(_0x153f0c,_0x4123ce,_0x3be6a0){var _0x4a6e8c=require('../../config/schedule');return db[_0xb3e3('0x30')]['find']({'where':{'id':_0x153f0c[_0xb3e3('0x54')]['id']},'raw':!![]})[_0xb3e3('0x27')](handleEntityNotFound(_0x4123ce,null))['then'](function(){_0x4a6e8c[_0xb3e3('0x55')](_0x153f0c[_0xb3e3('0x54')]['id']);})['then'](respondWithStatusCode(_0x4123ce,null))[_0xb3e3('0x47')](handleError(_0x4123ce,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 9ddb358..d5a6cd6 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 _0xdd83=['Schedule','tools_schedules','lodash','util','bluebird','request-promise','path','rimraf','./schedule.attributes','exports','define'];(function(_0x3c307c,_0x1b06c4){var _0x32cf08=function(_0x371144){while(--_0x371144){_0x3c307c['push'](_0x3c307c['shift']());}};_0x32cf08(++_0x1b06c4);}(_0xdd83,0x1e6));var _0x3dd8=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xdd83[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x3dd8('0x0'));var util=require(_0x3dd8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3dd8('0x2'));var rp=require(_0x3dd8('0x3'));var fs=require('fs');var path=require(_0x3dd8('0x4'));var rimraf=require(_0x3dd8('0x5'));var config=require('../../config/environment');var attributes=require(_0x3dd8('0x6'));module[_0x3dd8('0x7')]=function(_0x406f5b,_0xec5d94){return _0x406f5b[_0x3dd8('0x8')](_0x3dd8('0x9'),attributes,{'tableName':_0x3dd8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x544e=['api','moment','bluebird','path','./schedule.attributes','exports','Schedule','tools_schedules','lodash','../../config/logger'];(function(_0x4bee28,_0x33f8d0){var _0x568769=function(_0x3e1d3d){while(--_0x3e1d3d){_0x4bee28['push'](_0x4bee28['shift']());}};_0x568769(++_0x33f8d0);}(_0x544e,0x166));var _0xe544=function(_0x46276c,_0x120887){_0x46276c=_0x46276c-0x0;var _0x2c8291=_0x544e[_0x46276c];return _0x2c8291;};'use strict';var _=require(_0xe544('0x0'));var util=require('util');var logger=require(_0xe544('0x1'))(_0xe544('0x2'));var moment=require(_0xe544('0x3'));var BPromise=require(_0xe544('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe544('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe544('0x6'));module[_0xe544('0x7')]=function(_0x312f90,_0x3dbff1){return _0x312f90['define'](_0xe544('0x8'),attributes,{'tableName':_0xe544('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 352a237..d994ae4 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 _0xdf40=['error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x23f825,_0x2e29b7){var _0x172b9b=function(_0x1e472c){while(--_0x1e472c){_0x23f825['push'](_0x23f825['shift']());}};_0x172b9b(++_0x2e29b7);}(_0xdf40,0x81));var _0x0df4=function(_0x4fda88,_0x1a4d19){_0x4fda88=_0x4fda88-0x0;var _0xe37511=_0xdf40[_0x4fda88];return _0xe37511;};'use strict';var _=require(_0x0df4('0x0'));var util=require(_0x0df4('0x1'));var moment=require(_0x0df4('0x2'));var BPromise=require(_0x0df4('0x3'));var rs=require(_0x0df4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0df4('0x5'))['db'];var utils=require(_0x0df4('0x6'));var logger=require(_0x0df4('0x7'))(_0x0df4('0x8'));var config=require('../../config/environment');var jayson=require(_0x0df4('0x9'));var client=jayson['client'][_0x0df4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20639c,_0x103b34,_0x4912b7){return new BPromise(function(_0x4b0076,_0x2ad0af){return client['request'](_0x20639c,_0x4912b7)[_0x0df4('0xb')](function(_0x587565){logger[_0x0df4('0xc')](_0x0df4('0xd'),_0x103b34,'request\x20sent');logger[_0x0df4('0xe')](_0x0df4('0xf'),_0x103b34,_0x0df4('0x10'),JSON[_0x0df4('0x11')](_0x587565));if(_0x587565[_0x0df4('0x12')]){if(_0x587565['error'][_0x0df4('0x13')]===0x1f4){logger['error'](_0x0df4('0xd'),_0x103b34,_0x587565[_0x0df4('0x12')][_0x0df4('0x14')]);return _0x2ad0af(_0x587565[_0x0df4('0x12')][_0x0df4('0x14')]);}logger[_0x0df4('0x12')](_0x0df4('0xd'),_0x103b34,_0x587565['error'][_0x0df4('0x14')]);return _0x4b0076(_0x587565['error'][_0x0df4('0x14')]);}else{logger[_0x0df4('0xc')](_0x0df4('0xd'),_0x103b34,_0x0df4('0x10'));_0x4b0076(_0x587565['result']['message']);}})['catch'](function(_0x50a731){logger['error']('Schedule,\x20%s,\x20%s',_0x103b34,_0x50a731);_0x2ad0af(_0x50a731);});});} \ No newline at end of file +var _0x9dc5=['http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x9dc5,0x1f1));var _0x59dc=function(_0x4c1a53,_0x1ff473){_0x4c1a53=_0x4c1a53-0x0;var _0x1b025b=_0x9dc5[_0x4c1a53];return _0x1b025b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x59dc('0x0'));var BPromise=require(_0x59dc('0x1'));var rs=require(_0x59dc('0x2'));var fs=require('fs');var Redis=require(_0x59dc('0x3'));var db=require(_0x59dc('0x4'))['db'];var utils=require(_0x59dc('0x5'));var logger=require(_0x59dc('0x6'))(_0x59dc('0x7'));var config=require(_0x59dc('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x59dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48baeb,_0x51dcd0,_0x61a1e9){return new BPromise(function(_0xd4a53f,_0x4724a4){return client[_0x59dc('0xa')](_0x48baeb,_0x61a1e9)[_0x59dc('0xb')](function(_0x498aff){logger['info'](_0x59dc('0xc'),_0x51dcd0,_0x59dc('0xd'));logger[_0x59dc('0xe')](_0x59dc('0xf'),_0x51dcd0,_0x59dc('0xd'),JSON[_0x59dc('0x10')](_0x498aff));if(_0x498aff['error']){if(_0x498aff[_0x59dc('0x11')]['code']===0x1f4){logger[_0x59dc('0x11')](_0x59dc('0xc'),_0x51dcd0,_0x498aff[_0x59dc('0x11')][_0x59dc('0x12')]);return _0x4724a4(_0x498aff[_0x59dc('0x11')]['message']);}logger[_0x59dc('0x11')]('Schedule,\x20%s,\x20%s',_0x51dcd0,_0x498aff[_0x59dc('0x11')]['message']);return _0xd4a53f(_0x498aff['error'][_0x59dc('0x12')]);}else{logger[_0x59dc('0x13')](_0x59dc('0xc'),_0x51dcd0,'request\x20sent');_0xd4a53f(_0x498aff[_0x59dc('0x14')]['message']);}})[_0x59dc('0x15')](function(_0x1fe0eb){logger[_0x59dc('0x11')](_0x59dc('0xc'),_0x51dcd0,_0x1fe0eb);_0x4724a4(_0x1fe0eb);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 2e81008..2bf173b 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 _0x8571=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','./screenRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','create'];(function(_0x5a488c,_0x4cc470){var _0x53a7d6=function(_0x43a0d8){while(--_0x43a0d8){_0x5a488c['push'](_0x5a488c['shift']());}};_0x53a7d6(++_0x4cc470);}(_0x8571,0x1bd));var _0x1857=function(_0x2af7e6,_0x56c925){_0x2af7e6=_0x2af7e6-0x0;var _0x45b8fd=_0x8571[_0x2af7e6];return _0x45b8fd;};'use strict';var multer=require(_0x1857('0x0'));var util=require(_0x1857('0x1'));var path=require(_0x1857('0x2'));var timeout=require(_0x1857('0x3'));var express=require('express');var router=express[_0x1857('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1857('0x5'));router[_0x1857('0x6')]('/',auth['isAuthenticated'](),controller[_0x1857('0x7')]);router[_0x1857('0x6')](_0x1857('0x8'),auth[_0x1857('0x9')](),controller[_0x1857('0xa')]);router[_0x1857('0x6')](_0x1857('0xb'),auth[_0x1857('0x9')](),controller[_0x1857('0xc')]);router[_0x1857('0x6')](_0x1857('0xd'),auth['isAuthenticated'](),controller[_0x1857('0xe')]);router[_0x1857('0xf')]('/',auth[_0x1857('0x9')](),controller[_0x1857('0x10')]);router[_0x1857('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1857('0x12')]);router[_0x1857('0x13')]('/:id',auth[_0x1857('0x9')](),controller[_0x1857('0x14')]);module[_0x1857('0x15')]=router; \ No newline at end of file +var _0xad41=['../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','describe','show','/:id/download','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x19fa29,_0x14b275){var _0x1b4975=function(_0x4a5887){while(--_0x4a5887){_0x19fa29['push'](_0x19fa29['shift']());}};_0x1b4975(++_0x14b275);}(_0xad41,0x143));var _0x1ad4=function(_0x2c8b7a,_0x483fe0){_0x2c8b7a=_0x2c8b7a-0x0;var _0x1c1cf9=_0xad41[_0x2c8b7a];return _0x1c1cf9;};'use strict';var multer=require(_0x1ad4('0x0'));var util=require(_0x1ad4('0x1'));var path=require(_0x1ad4('0x2'));var timeout=require(_0x1ad4('0x3'));var express=require(_0x1ad4('0x4'));var router=express[_0x1ad4('0x5')]();var auth=require(_0x1ad4('0x6'));var interaction=require(_0x1ad4('0x7'));var config=require(_0x1ad4('0x8'));var controller=require(_0x1ad4('0x9'));router[_0x1ad4('0xa')]('/',auth[_0x1ad4('0xb')](),controller['index']);router['get']('/describe',auth[_0x1ad4('0xb')](),controller[_0x1ad4('0xc')]);router[_0x1ad4('0xa')]('/:id',auth[_0x1ad4('0xb')](),controller[_0x1ad4('0xd')]);router[_0x1ad4('0xa')](_0x1ad4('0xe'),auth[_0x1ad4('0xb')](),controller['download']);router[_0x1ad4('0xf')]('/',auth[_0x1ad4('0xb')](),controller[_0x1ad4('0x10')]);router[_0x1ad4('0x11')](_0x1ad4('0x12'),auth[_0x1ad4('0xb')](),controller[_0x1ad4('0x13')]);router[_0x1ad4('0x14')](_0x1ad4('0x12'),auth[_0x1ad4('0xb')](),controller['destroy']);module[_0x1ad4('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 95d67b8..8c68a08 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 _0x5636=['format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','sequelize','moment','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','subtract','DATE','startedAt'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5636,0x102));var _0x6563=function(_0x3d71e6,_0x53c2be){_0x3d71e6=_0x3d71e6-0x0;var _0x49a153=_0x5636[_0x3d71e6];return _0x49a153;};'use strict';var Sequelize=require(_0x6563('0x0'));var moment=require(_0x6563('0x1'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x6563('0x2')],'get':function(){return this[_0x6563('0x3')](_0x6563('0x4'))?path['extname'](this[_0x6563('0x3')](_0x6563('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x6563('0x5')]},'channel':{'type':Sequelize[_0x6563('0x5')]},'value':{'type':Sequelize[_0x6563('0x5')],'set':function(_0x193942){var _0x9884a9=_0x193942[_0x6563('0x6')](/\\/g,'/');this[_0x6563('0x7')](_0x6563('0x4'),_0x9884a9);}},'rating':{'type':Sequelize[_0x6563('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x6563('0x8')],'set':function(_0x3ccb4e){this['setDataValue']('startedAt',moment()[_0x6563('0x9')](_0x3ccb4e,'ms'));this[_0x6563('0x7')]('closedAt',moment());this['setDataValue']('duration',_0x3ccb4e);}},'startedAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0xb')))[_0x6563('0xc')](_0x6563('0xd'))[_0x6563('0xe')]();}},'closedAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0xf')))['format'](_0x6563('0xd'))['toString']();}},'createdAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0x10')))[_0x6563('0xc')]('MM-DD-YYYY\x20HH:mm')[_0x6563('0xe')]();}},'updatedAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0x11')))['format'](_0x6563('0xd'))['toString']();}}}; \ No newline at end of file +var _0x008c=['extname','STRING','replace','setDataValue','closedAt','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue','value'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x008c,0x188));var _0xc008=function(_0x12c7e5,_0x4f82a7){_0x12c7e5=_0x12c7e5-0x0;var _0x266fe0=_0x008c[_0x12c7e5];return _0x266fe0;};'use strict';var Sequelize=require(_0xc008('0x0'));var moment=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var config=require(_0xc008('0x3'));module[_0xc008('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc008('0x5')](_0xc008('0x6'))?path[_0xc008('0x7')](this[_0xc008('0x5')](_0xc008('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xc008('0x8')]},'channel':{'type':Sequelize[_0xc008('0x8')]},'value':{'type':Sequelize[_0xc008('0x8')],'set':function(_0x9c8cb2){var _0x4af530=_0x9c8cb2[_0xc008('0x9')](/\\/g,'/');this['setDataValue'](_0xc008('0x6'),_0x4af530);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x27830d){this[_0xc008('0xa')]('startedAt',moment()['subtract'](_0x27830d,'ms'));this['setDataValue'](_0xc008('0xb'),moment());this[_0xc008('0xa')]('duration',_0x27830d);}},'startedAt':{'type':Sequelize[_0xc008('0xc')],'get':function(){return moment(this[_0xc008('0x5')](_0xc008('0xd')))[_0xc008('0xe')](_0xc008('0xf'))[_0xc008('0x10')]();}},'closedAt':{'type':Sequelize[_0xc008('0xc')],'get':function(){return moment(this['getDataValue']('closedAt'))[_0xc008('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xc008('0x10')]();}},'createdAt':{'type':Sequelize[_0xc008('0xc')],'get':function(){return moment(this[_0xc008('0x5')](_0xc008('0x11')))[_0xc008('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc008('0x5')](_0xc008('0x12')))[_0xc008('0xe')](_0xc008('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index a7f8df9..462b48c 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 _0xe251=['pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','type','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','sox','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','key','differenceBy','format','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where'];(function(_0x54ece6,_0x11a6c6){var _0x2cfd35=function(_0x8163c6){while(--_0x8163c6){_0x54ece6['push'](_0x54ece6['shift']());}};_0x2cfd35(++_0x11a6c6);}(_0xe251,0x1c0));var _0x1e25=function(_0x16b992,_0x43d74c){_0x16b992=_0x16b992-0x0;var _0x385c78=_0xe251[_0x16b992];return _0x385c78;};'use strict';var pdf=require(_0x1e25('0x0'));var emlformat=require(_0x1e25('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1e25('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e25('0x3'));var moment=require(_0x1e25('0x4'));var BPromise=require(_0x1e25('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1e25('0x6'));var csv=require('to-csv');var ejs=require(_0x1e25('0x7'));var fs=require('fs');var _=require(_0x1e25('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e25('0x9'));var deskjs=require(_0x1e25('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1e25('0xb'));var Papa=require('papaparse');var Redis=require(_0x1e25('0xc'));var authService=require(_0x1e25('0xd'));var qs=require(_0x1e25('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e25('0xf'));var logger=require(_0x1e25('0x10'))(_0x1e25('0x11'));var utils=require(_0x1e25('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1e25('0x13'));var db=require(_0x1e25('0x14'))['db'];function respondWithStatusCode(_0x3b0051,_0x325873){_0x325873=_0x325873||0xcc;return function(_0x393f9f){if(_0x393f9f){return _0x3b0051['sendStatus'](_0x325873);}return _0x3b0051['status'](_0x325873)['end']();};}function respondWithResult(_0x1b9f7e,_0x247498){_0x247498=_0x247498||0xc8;return function(_0x3817b2){if(_0x3817b2){return _0x1b9f7e[_0x1e25('0x15')](_0x247498)[_0x1e25('0x16')](_0x3817b2);}};}function respondWithFilteredResult(_0x405cf8,_0x3005a5){return function(_0x5704f2){if(_0x5704f2){var _0x1d8e25=_0x5704f2[_0x1e25('0x17')],_0x40bf18=_0x3005a5[_0x1e25('0x18')],_0x3abe83=_0x3005a5[_0x1e25('0x18')]+_0x3005a5[_0x1e25('0x19')],_0x141eb6;if(_0x3abe83>=_0x1d8e25){_0x3abe83=_0x1d8e25;_0x141eb6=0xc8;}else{_0x141eb6=0xce;}_0x405cf8[_0x1e25('0x15')](_0x141eb6);return _0x405cf8[_0x1e25('0x1a')](_0x1e25('0x1b'),_0x40bf18+'-'+_0x3abe83+'/'+_0x1d8e25)['json'](_0x5704f2);}return null;};}function patchUpdates(_0x61a470){return function(_0x3dcaf0){try{jsonpatch['apply'](_0x3dcaf0,_0x61a470,!![]);}catch(_0x5f0156){return BPromise[_0x1e25('0x1c')](_0x5f0156);}return _0x3dcaf0[_0x1e25('0x1d')]();};}function saveUpdates(_0x5d1f26,_0x4de212){return function(_0x57d74a){if(_0x57d74a){return _0x57d74a[_0x1e25('0x1e')](_0x5d1f26)[_0x1e25('0x1f')](function(_0x398e09){return _0x398e09;});}return null;};}function removeEntity(_0x2b9cc2,_0x5eb681){return function(_0x27d68b){if(_0x27d68b){return _0x27d68b[_0x1e25('0x20')]()[_0x1e25('0x1f')](function(){_0x2b9cc2[_0x1e25('0x15')](0xcc)[_0x1e25('0x21')]();});}};}function handleEntityNotFound(_0x1bc382,_0x1117a9){return function(_0x3e86e1){if(!_0x3e86e1){_0x1bc382['sendStatus'](0x194);}return _0x3e86e1;};}function handleError(_0x426525,_0x2180b7){_0x2180b7=_0x2180b7||0x1f4;return function(_0x23068f){logger[_0x1e25('0x22')](_0x23068f[_0x1e25('0x23')]);if(_0x23068f[_0x1e25('0x24')]){delete _0x23068f[_0x1e25('0x24')];}_0x426525['status'](_0x2180b7)[_0x1e25('0x25')](_0x23068f);};}exports[_0x1e25('0x26')]=function(_0x43b321,_0x15ab3c){var _0x520656={},_0xe36bd={},_0x8cf468={'count':0x0,'rows':[]};var _0x3f4cf0=_[_0x1e25('0x27')](db[_0x1e25('0x28')][_0x1e25('0x29')],function(_0x1716d0){return{'name':_0x1716d0[_0x1e25('0x2a')],'type':_0x1716d0['type'][_0x1e25('0x2b')]};});_0xe36bd['model']=_[_0x1e25('0x2c')](_[_0x1e25('0x27')](_0x3f4cf0,_0x1e25('0x24')),[_0x1e25('0x2d')]);_0xe36bd[_0x1e25('0x2e')]=_[_0x1e25('0x2f')](_0x43b321[_0x1e25('0x2e')]);_0xe36bd[_0x1e25('0x30')]=_[_0x1e25('0x31')](_0xe36bd[_0x1e25('0x32')],_0xe36bd[_0x1e25('0x2e')]);_0x520656[_0x1e25('0x33')]=_[_0x1e25('0x31')](_0xe36bd['model'],qs[_0x1e25('0x34')](_0x43b321['query'][_0x1e25('0x34')]));_0x520656['attributes']=_0x520656[_0x1e25('0x33')]['length']?_0x520656[_0x1e25('0x33')]:_0xe36bd[_0x1e25('0x32')];if(!_0x43b321[_0x1e25('0x2e')][_0x1e25('0x35')]('nolimit')){_0x520656['limit']=qs[_0x1e25('0x19')](_0x43b321[_0x1e25('0x2e')][_0x1e25('0x19')]);_0x520656[_0x1e25('0x18')]=qs[_0x1e25('0x18')](_0x43b321['query'][_0x1e25('0x18')]);}_0x520656[_0x1e25('0x36')]=qs[_0x1e25('0x37')](_0x43b321[_0x1e25('0x2e')][_0x1e25('0x37')]);_0x520656[_0x1e25('0x38')]=qs[_0x1e25('0x30')](_[_0x1e25('0x39')](_0x43b321[_0x1e25('0x2e')],_0xe36bd[_0x1e25('0x30')]),_0x3f4cf0);if(_0x43b321[_0x1e25('0x2e')][_0x1e25('0x3a')]){_0x520656[_0x1e25('0x38')]=_[_0x1e25('0x3b')](_0x520656['where'],{'$or':_[_0x1e25('0x27')](_0x3f4cf0,function(_0x277e57){if(_0x277e57['type']!==_0x1e25('0x3c')){var _0xe24231={};_0xe24231[_0x277e57[_0x1e25('0x24')]]={'$like':'%'+_0x43b321['query']['filter']+'%'};return _0xe24231;}})});}_0x520656=_[_0x1e25('0x3b')]({},_0x520656,_0x43b321[_0x1e25('0x3d')]);var _0x2e628f={'where':_0x520656[_0x1e25('0x38')]};return db[_0x1e25('0x28')][_0x1e25('0x17')](_0x2e628f)[_0x1e25('0x1f')](function(_0x20539d){_0x8cf468[_0x1e25('0x17')]=_0x20539d;if(_0x43b321[_0x1e25('0x2e')]['includeAll']){_0x520656[_0x1e25('0x3e')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x520656);})[_0x1e25('0x1f')](function(_0x4b2ce9){_0x8cf468[_0x1e25('0x3f')]=_0x4b2ce9;return _0x8cf468;})['then'](respondWithFilteredResult(_0x15ab3c,_0x520656))[_0x1e25('0x40')](handleError(_0x15ab3c,null));};exports[_0x1e25('0x41')]=function(_0x64ff69,_0x1446a1){var _0x2615c8={'raw':![],'where':{'id':_0x64ff69[_0x1e25('0x42')]['id']}},_0x7ce347={};_0x7ce347['model']=_[_0x1e25('0x2f')](db[_0x1e25('0x28')]['rawAttributes']);_0x7ce347[_0x1e25('0x2e')]=_[_0x1e25('0x2f')](_0x64ff69['query']);_0x7ce347[_0x1e25('0x30')]=_[_0x1e25('0x31')](_0x7ce347['model'],_0x7ce347[_0x1e25('0x2e')]);_0x2615c8[_0x1e25('0x33')]=_[_0x1e25('0x31')](_0x7ce347['model'],qs[_0x1e25('0x34')](_0x64ff69[_0x1e25('0x2e')][_0x1e25('0x34')]));_0x2615c8[_0x1e25('0x33')]=_0x2615c8['attributes'][_0x1e25('0x43')]?_0x2615c8[_0x1e25('0x33')]:_0x7ce347['model'];if(_0x64ff69[_0x1e25('0x2e')][_0x1e25('0x44')]){_0x2615c8[_0x1e25('0x3e')]=[{'all':!![]}];}_0x2615c8=_[_0x1e25('0x3b')]({},_0x2615c8,_0x64ff69[_0x1e25('0x3d')]);return db['ScreenRecording'][_0x1e25('0x45')](_0x2615c8)[_0x1e25('0x1f')](handleEntityNotFound(_0x1446a1,null))[_0x1e25('0x1f')](respondWithResult(_0x1446a1,null))[_0x1e25('0x40')](handleError(_0x1446a1,null));};exports[_0x1e25('0x46')]=function(_0x46c367,_0x1b2156){return db[_0x1e25('0x28')][_0x1e25('0x46')](_0x46c367[_0x1e25('0x47')],{})[_0x1e25('0x1f')](respondWithResult(_0x1b2156,0xc9))['catch'](handleError(_0x1b2156,null));};exports[_0x1e25('0x1e')]=function(_0x53ba87,_0x543b16){if(_0x53ba87['body']['id']){delete _0x53ba87[_0x1e25('0x47')]['id'];}delete _0x53ba87[_0x1e25('0x47')][_0x1e25('0x48')];delete _0x53ba87['body'][_0x1e25('0x49')];delete _0x53ba87[_0x1e25('0x47')][_0x1e25('0x4a')];delete _0x53ba87['body'][_0x1e25('0x4b')];return db[_0x1e25('0x28')][_0x1e25('0x45')]({'where':{'id':_0x53ba87['params']['id']}})[_0x1e25('0x1f')](handleEntityNotFound(_0x543b16,null))[_0x1e25('0x1f')](saveUpdates(_0x53ba87[_0x1e25('0x47')],null))[_0x1e25('0x1f')](respondWithResult(_0x543b16,null))[_0x1e25('0x40')](handleError(_0x543b16,null));};exports[_0x1e25('0x4c')]=function(_0x2a24d0,_0x17f8ab){return db[_0x1e25('0x28')][_0x1e25('0x4c')]()[_0x1e25('0x1f')](respondWithResult(_0x17f8ab,null))[_0x1e25('0x40')](handleError(_0x17f8ab,null));};exports[_0x1e25('0x4d')]=function(_0x40ced6,_0x2e5b66,_0xc22476){var _0xb56904=require(_0x1e25('0x4e'));var _0x19b509=![];var _0x400a2b={};if(_0x40ced6[_0x1e25('0x2e')][_0x1e25('0x4f')]&&_0x40ced6[_0x1e25('0x2e')][_0x1e25('0x4f')]==='uniqueid'){_0x400a2b['uniqueid']=_0x40ced6[_0x1e25('0x42')]['id'];}else{_0x400a2b['id']=_0x40ced6[_0x1e25('0x42')]['id'];}return db['ScreenRecording'][_0x1e25('0x45')]({'where':_0x400a2b,'attributes':['id','value'],'raw':!![]})[_0x1e25('0x1f')](handleEntityNotFound(_0x2e5b66,null))[_0x1e25('0x1f')](function(_0x2705c9){if(_0x2705c9){var _0x41ecb8=path[_0x1e25('0x50')](config[_0x1e25('0x51')],_0x1e25('0x52'),_0x2705c9[_0x1e25('0x4b')]);var _0x24998f=util[_0x1e25('0x2d')](_0x1e25('0x53'),_0x41ecb8);if(fs[_0x1e25('0x54')](_0x24998f)){_0x19b509=!![];return _0xb56904[_0x1e25('0x55')](_0x24998f,_0x41ecb8,config['secrets'][_0x1e25('0x56')])[_0x1e25('0x1f')](function(){return _0x2705c9;});}return _0x2705c9;}})[_0x1e25('0x1f')](function(_0x2cc50b){if(_0x2cc50b){var _0x464409=path[_0x1e25('0x50')](config[_0x1e25('0x51')],_0x1e25('0x52'),_0x2cc50b['value']);if(!fs[_0x1e25('0x54')](_0x464409)){throw new db[(_0x1e25('0x57'))][(_0x1e25('0x58'))](_0x1e25('0x59'));}if(_0x2cc50b[_0x1e25('0x5a')]){return _0x2e5b66[_0x1e25('0x4d')](_0x464409,_0x2cc50b[_0x1e25('0x5a')]+path[_0x1e25('0x5b')](_0x464409),function(){if(_0x19b509){fs[_0x1e25('0x5c')](_0x464409);}});}else{return _0x2e5b66[_0x1e25('0x4d')](_0x464409,function(_0x2867f9){if(_0x19b509){fs['unlink'](_0x464409);}});}}})[_0x1e25('0x40')](function(_0x4d046f){if(_0x4d046f['message']==='ScreenRecording\x20not\x20found'){_0x2e5b66[_0x1e25('0x15')](0x194)[_0x1e25('0x25')](_0x1e25('0x5d'));}else{return handleError(_0x2e5b66,null);}});};exports[_0x1e25('0x20')]=function(_0x34033c,_0x5aa0cc){return db[_0x1e25('0x28')]['find']({'where':{'id':_0x34033c[_0x1e25('0x42')]['id']}})[_0x1e25('0x1f')](function(_0x402e17){if(!_0x402e17)throw new ReferenceError(_0x1e25('0x5e'));return _0x402e17;})[_0x1e25('0x1f')](function(_0x155680){var _0x56a6a9=path[_0x1e25('0x50')](config[_0x1e25('0x51')],'server/files/screen_recordings',_0x155680['value']);logger['info'](_0x1e25('0x5f'),_0x56a6a9);if(!_['isNil'](_0x155680[_0x1e25('0x4b')])&&fs[_0x1e25('0x54')](_0x56a6a9)){logger[_0x1e25('0x60')]('File:\x20\x22'+_0x56a6a9+_0x1e25('0x61'));fs[_0x1e25('0x62')](_0x56a6a9);}_0x56a6a9=_0x56a6a9+_0x1e25('0x63');if(!_[_0x1e25('0x64')](_0x155680[_0x1e25('0x4b')])&&fs[_0x1e25('0x54')](_0x56a6a9)){logger[_0x1e25('0x60')]('File:\x20\x22'+_0x56a6a9+_0x1e25('0x61'));fs[_0x1e25('0x62')](_0x56a6a9);}return _0x155680;})[_0x1e25('0x1f')](function(_0x5b66c9){if(!_0x5b66c9)throw new InternalError();return _0x5b66c9['destroy']();})[_0x1e25('0x1f')](function(){_0x5aa0cc['status'](0xcc)['end']();})[_0x1e25('0x40')](handleError(_0x5aa0cc,null));}; \ No newline at end of file +var _0x20b1=['desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','root','existsSync','decryptFile','secrets','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','join','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0xb9e757,_0x3c4b52){var _0x4cd239=function(_0xb4a417){while(--_0xb4a417){_0xb9e757['push'](_0xb9e757['shift']());}};_0x4cd239(++_0x3c4b52);}(_0x20b1,0x197));var _0x120b=function(_0xcca1d3,_0xc72fab){_0xcca1d3=_0xcca1d3-0x0;var _0x1b7798=_0x20b1[_0xcca1d3];return _0x1b7798;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x120b('0x0'));var rimraf=require(_0x120b('0x1'));var zipdir=require(_0x120b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x120b('0x3'));var moment=require(_0x120b('0x4'));var BPromise=require(_0x120b('0x5'));var Mustache=require('mustache');var util=require(_0x120b('0x6'));var path=require('path');var sox=require(_0x120b('0x7'));var csv=require(_0x120b('0x8'));var ejs=require(_0x120b('0x9'));var fs=require('fs');var _=require(_0x120b('0xa'));var squel=require(_0x120b('0xb'));var crypto=require(_0x120b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x120b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x120b('0xe'));var Redis=require(_0x120b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x120b('0x10'));var as=require(_0x120b('0x11'));var hardwareService=require(_0x120b('0x12'));var logger=require(_0x120b('0x13'))(_0x120b('0x14'));var utils=require(_0x120b('0x15'));var config=require(_0x120b('0x16'));var licenseUtil=require(_0x120b('0x17'));var db=require(_0x120b('0x18'))['db'];function respondWithStatusCode(_0x477120,_0x45bf52){_0x45bf52=_0x45bf52||0xcc;return function(_0x3a1ba3){if(_0x3a1ba3){return _0x477120[_0x120b('0x19')](_0x45bf52);}return _0x477120[_0x120b('0x1a')](_0x45bf52)[_0x120b('0x1b')]();};}function respondWithResult(_0x21b897,_0xda6122){_0xda6122=_0xda6122||0xc8;return function(_0x210d7d){if(_0x210d7d){return _0x21b897['status'](_0xda6122)[_0x120b('0x1c')](_0x210d7d);}};}function respondWithFilteredResult(_0x3e0e6c,_0xca4be5){return function(_0x3b5da7){if(_0x3b5da7){var _0x4e574a=_0x3b5da7[_0x120b('0x1d')],_0x2ea4ba=_0xca4be5['offset'],_0x578b1d=_0xca4be5['offset']+_0xca4be5[_0x120b('0x1e')],_0x21211;if(_0x578b1d>=_0x4e574a){_0x578b1d=_0x4e574a;_0x21211=0xc8;}else{_0x21211=0xce;}_0x3e0e6c[_0x120b('0x1a')](_0x21211);return _0x3e0e6c[_0x120b('0x1f')](_0x120b('0x20'),_0x2ea4ba+'-'+_0x578b1d+'/'+_0x4e574a)[_0x120b('0x1c')](_0x3b5da7);}return null;};}function patchUpdates(_0x27a085){return function(_0x25a597){try{jsonpatch[_0x120b('0x21')](_0x25a597,_0x27a085,!![]);}catch(_0x1d5a5b){return BPromise[_0x120b('0x22')](_0x1d5a5b);}return _0x25a597[_0x120b('0x23')]();};}function saveUpdates(_0x595e78,_0xd5c9b2){return function(_0x590382){if(_0x590382){return _0x590382[_0x120b('0x24')](_0x595e78)['then'](function(_0x160ee4){return _0x160ee4;});}return null;};}function removeEntity(_0x12fc85,_0x1b1c1e){return function(_0x515879){if(_0x515879){return _0x515879['destroy']()[_0x120b('0x25')](function(){_0x12fc85[_0x120b('0x1a')](0xcc)[_0x120b('0x1b')]();});}};}function handleEntityNotFound(_0x4ca45b,_0x205003){return function(_0x29a2e1){if(!_0x29a2e1){_0x4ca45b[_0x120b('0x19')](0x194);}return _0x29a2e1;};}function handleError(_0x25bb91,_0x5aafcd){_0x5aafcd=_0x5aafcd||0x1f4;return function(_0x3d8b6b){logger[_0x120b('0x26')](_0x3d8b6b[_0x120b('0x27')]);if(_0x3d8b6b[_0x120b('0x28')]){delete _0x3d8b6b[_0x120b('0x28')];}_0x25bb91['status'](_0x5aafcd)[_0x120b('0x29')](_0x3d8b6b);};}exports[_0x120b('0x2a')]=function(_0x4df986,_0x59a042){var _0x1266a7={},_0x3c8d37={},_0x374d09={'count':0x0,'rows':[]};var _0x2c5a06=_['map'](db[_0x120b('0x2b')][_0x120b('0x2c')],function(_0x42ab54){return{'name':_0x42ab54['fieldName'],'type':_0x42ab54[_0x120b('0x2d')][_0x120b('0x2e')]};});_0x3c8d37[_0x120b('0x2f')]=_[_0x120b('0x30')](_['map'](_0x2c5a06,'name'),[_0x120b('0x31')]);_0x3c8d37['query']=_[_0x120b('0x32')](_0x4df986['query']);_0x3c8d37[_0x120b('0x33')]=_[_0x120b('0x34')](_0x3c8d37[_0x120b('0x2f')],_0x3c8d37[_0x120b('0x35')]);_0x1266a7['attributes']=_[_0x120b('0x34')](_0x3c8d37[_0x120b('0x2f')],qs['fields'](_0x4df986[_0x120b('0x35')][_0x120b('0x36')]));_0x1266a7[_0x120b('0x37')]=_0x1266a7[_0x120b('0x37')][_0x120b('0x38')]?_0x1266a7['attributes']:_0x3c8d37[_0x120b('0x2f')];if(!_0x4df986[_0x120b('0x35')][_0x120b('0x39')](_0x120b('0x3a'))){_0x1266a7[_0x120b('0x1e')]=qs[_0x120b('0x1e')](_0x4df986['query'][_0x120b('0x1e')]);_0x1266a7[_0x120b('0x3b')]=qs[_0x120b('0x3b')](_0x4df986[_0x120b('0x35')]['offset']);}_0x1266a7[_0x120b('0x3c')]=qs[_0x120b('0x3d')](_0x4df986[_0x120b('0x35')][_0x120b('0x3d')]);_0x1266a7[_0x120b('0x3e')]=qs[_0x120b('0x33')](_[_0x120b('0x3f')](_0x4df986[_0x120b('0x35')],_0x3c8d37[_0x120b('0x33')]),_0x2c5a06);if(_0x4df986[_0x120b('0x35')][_0x120b('0x40')]){_0x1266a7[_0x120b('0x3e')]=_[_0x120b('0x41')](_0x1266a7[_0x120b('0x3e')],{'$or':_[_0x120b('0x42')](_0x2c5a06,function(_0x347361){if(_0x347361[_0x120b('0x2d')]!==_0x120b('0x43')){var _0x1897e6={};_0x1897e6[_0x347361[_0x120b('0x28')]]={'$like':'%'+_0x4df986[_0x120b('0x35')][_0x120b('0x40')]+'%'};return _0x1897e6;}})});}_0x1266a7=_['merge']({},_0x1266a7,_0x4df986[_0x120b('0x44')]);var _0x388b47={'where':_0x1266a7[_0x120b('0x3e')]};return db[_0x120b('0x2b')][_0x120b('0x1d')](_0x388b47)[_0x120b('0x25')](function(_0x3bed6c){_0x374d09['count']=_0x3bed6c;if(_0x4df986[_0x120b('0x35')][_0x120b('0x45')]){_0x1266a7['include']=[{'all':!![]}];}return db[_0x120b('0x2b')][_0x120b('0x46')](_0x1266a7);})[_0x120b('0x25')](function(_0x5bcdb0){_0x374d09[_0x120b('0x47')]=_0x5bcdb0;return _0x374d09;})[_0x120b('0x25')](respondWithFilteredResult(_0x59a042,_0x1266a7))[_0x120b('0x48')](handleError(_0x59a042,null));};exports[_0x120b('0x49')]=function(_0x4c78da,_0x30d4fd){var _0x3b9ac5={'raw':![],'where':{'id':_0x4c78da[_0x120b('0x4a')]['id']}},_0x11d81b={};_0x11d81b['model']=_[_0x120b('0x32')](db[_0x120b('0x2b')][_0x120b('0x2c')]);_0x11d81b[_0x120b('0x35')]=_[_0x120b('0x32')](_0x4c78da[_0x120b('0x35')]);_0x11d81b[_0x120b('0x33')]=_[_0x120b('0x34')](_0x11d81b['model'],_0x11d81b[_0x120b('0x35')]);_0x3b9ac5['attributes']=_[_0x120b('0x34')](_0x11d81b[_0x120b('0x2f')],qs[_0x120b('0x36')](_0x4c78da[_0x120b('0x35')][_0x120b('0x36')]));_0x3b9ac5[_0x120b('0x37')]=_0x3b9ac5[_0x120b('0x37')][_0x120b('0x38')]?_0x3b9ac5[_0x120b('0x37')]:_0x11d81b['model'];if(_0x4c78da[_0x120b('0x35')][_0x120b('0x45')]){_0x3b9ac5['include']=[{'all':!![]}];}_0x3b9ac5=_[_0x120b('0x41')]({},_0x3b9ac5,_0x4c78da[_0x120b('0x44')]);return db[_0x120b('0x2b')][_0x120b('0x4b')](_0x3b9ac5)[_0x120b('0x25')](handleEntityNotFound(_0x30d4fd,null))[_0x120b('0x25')](respondWithResult(_0x30d4fd,null))['catch'](handleError(_0x30d4fd,null));};exports[_0x120b('0x4c')]=function(_0x3118e0,_0x1d2ef2){return db[_0x120b('0x2b')]['create'](_0x3118e0[_0x120b('0x4d')],{})['then'](respondWithResult(_0x1d2ef2,0xc9))[_0x120b('0x48')](handleError(_0x1d2ef2,null));};exports[_0x120b('0x24')]=function(_0x3bad00,_0x3fabd0){if(_0x3bad00[_0x120b('0x4d')]['id']){delete _0x3bad00['body']['id'];}delete _0x3bad00[_0x120b('0x4d')][_0x120b('0x4e')];delete _0x3bad00[_0x120b('0x4d')][_0x120b('0x4f')];delete _0x3bad00['body'][_0x120b('0x50')];delete _0x3bad00[_0x120b('0x4d')][_0x120b('0x51')];return db[_0x120b('0x2b')][_0x120b('0x4b')]({'where':{'id':_0x3bad00[_0x120b('0x4a')]['id']}})[_0x120b('0x25')](handleEntityNotFound(_0x3fabd0,null))[_0x120b('0x25')](saveUpdates(_0x3bad00[_0x120b('0x4d')],null))['then'](respondWithResult(_0x3fabd0,null))[_0x120b('0x48')](handleError(_0x3fabd0,null));};exports[_0x120b('0x52')]=function(_0x1403f9,_0x5aedd8){return db[_0x120b('0x2b')][_0x120b('0x52')]()['then'](respondWithResult(_0x5aedd8,null))['catch'](handleError(_0x5aedd8,null));};exports[_0x120b('0x53')]=function(_0x3ad04d,_0x2bf943,_0x5b9d6f){var _0x66051d=require(_0x120b('0x54'));var _0x385213=![];var _0x29dff4={};if(_0x3ad04d[_0x120b('0x35')][_0x120b('0x2d')]&&_0x3ad04d['query'][_0x120b('0x2d')]==='uniqueid'){_0x29dff4[_0x120b('0x55')]=_0x3ad04d['params']['id'];}else{_0x29dff4['id']=_0x3ad04d[_0x120b('0x4a')]['id'];}return db[_0x120b('0x2b')][_0x120b('0x4b')]({'where':_0x29dff4,'attributes':['id',_0x120b('0x51')],'raw':!![]})[_0x120b('0x25')](handleEntityNotFound(_0x2bf943,null))['then'](function(_0x1f2cac){if(_0x1f2cac){var _0x79d1bb=path['join'](config[_0x120b('0x56')],'server/files/screen_recordings',_0x1f2cac[_0x120b('0x51')]);var _0x4a21bf=util[_0x120b('0x31')]('%s.cypher',_0x79d1bb);if(fs[_0x120b('0x57')](_0x4a21bf)){_0x385213=!![];return _0x66051d[_0x120b('0x58')](_0x4a21bf,_0x79d1bb,config[_0x120b('0x59')]['recording'])['then'](function(){return _0x1f2cac;});}return _0x1f2cac;}})[_0x120b('0x25')](function(_0x522e59){if(_0x522e59){var _0x1916da=path['join'](config['root'],_0x120b('0x5a'),_0x522e59[_0x120b('0x51')]);if(!fs['existsSync'](_0x1916da)){throw new db[(_0x120b('0x5b'))]['ValidationError'](_0x120b('0x5c'));}if(_0x522e59[_0x120b('0x5d')]){return _0x2bf943['download'](_0x1916da,_0x522e59[_0x120b('0x5d')]+path[_0x120b('0x5e')](_0x1916da),function(){if(_0x385213){fs[_0x120b('0x5f')](_0x1916da);}});}else{return _0x2bf943[_0x120b('0x53')](_0x1916da,function(_0x45da45){if(_0x385213){fs[_0x120b('0x5f')](_0x1916da);}});}}})[_0x120b('0x48')](function(_0x8ea133){if(_0x8ea133[_0x120b('0x60')]===_0x120b('0x5c')){_0x2bf943[_0x120b('0x1a')](0x194)['send'](_0x120b('0x61'));}else{return handleError(_0x2bf943,null);}});};exports[_0x120b('0x62')]=function(_0x3772ec,_0x5d5cf4){return db[_0x120b('0x2b')][_0x120b('0x4b')]({'where':{'id':_0x3772ec[_0x120b('0x4a')]['id']}})[_0x120b('0x25')](function(_0x288d04){if(!_0x288d04)throw new ReferenceError('Entity\x20not\x20found');return _0x288d04;})[_0x120b('0x25')](function(_0x1e31b3){var _0xd47a6=path[_0x120b('0x63')](config['root'],'server/files/screen_recordings',_0x1e31b3['value']);logger['info'](_0x120b('0x64'),_0xd47a6);if(!_[_0x120b('0x65')](_0x1e31b3[_0x120b('0x51')])&&fs['existsSync'](_0xd47a6)){logger['info'](_0x120b('0x66')+_0xd47a6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x120b('0x67')](_0xd47a6);}_0xd47a6=_0xd47a6+'.cypher';if(!_['isNil'](_0x1e31b3['value'])&&fs['existsSync'](_0xd47a6)){logger['info'](_0x120b('0x66')+_0xd47a6+_0x120b('0x68'));fs['unlinkSync'](_0xd47a6);}return _0x1e31b3;})[_0x120b('0x25')](function(_0xe23680){if(!_0xe23680)throw new InternalError();return _0xe23680['destroy']();})[_0x120b('0x25')](function(){_0x5d5cf4['status'](0xcc)[_0x120b('0x1b')]();})[_0x120b('0x48')](handleError(_0x5d5cf4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index bf4f884..a5c3427 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 _0x85f1=['rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0x85f1,0x125));var _0x185f=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x85f1[_0x1030ce];return _0x3367fd;};'use strict';var _=require('lodash');var util=require(_0x185f('0x0'));var logger=require(_0x185f('0x1'))(_0x185f('0x2'));var moment=require(_0x185f('0x3'));var BPromise=require(_0x185f('0x4'));var rp=require(_0x185f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x185f('0x6'));var config=require(_0x185f('0x7'));var attributes=require(_0x185f('0x8'));module[_0x185f('0x9')]=function(_0x556a98,_0x5aede2){return _0x556a98['define'](_0x185f('0xa'),attributes,{'tableName':_0x185f('0xb'),'paranoid':![],'indexes':[{'name':_0x185f('0xc'),'fields':[_0x185f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe7a7=['interactionid','api','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','ScreenRecording','screen_recordings'];(function(_0xdd600b,_0x99f782){var _0x259b41=function(_0x279690){while(--_0x279690){_0xdd600b['push'](_0xdd600b['shift']());}};_0x259b41(++_0x99f782);}(_0xe7a7,0x10f));var _0x7e7a=function(_0xf25cbf,_0x1713b3){_0xf25cbf=_0xf25cbf-0x0;var _0xda90ab=_0xe7a7[_0xf25cbf];return _0xda90ab;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7e7a('0x0'));var moment=require('moment');var BPromise=require(_0x7e7a('0x1'));var rp=require(_0x7e7a('0x2'));var fs=require('fs');var path=require(_0x7e7a('0x3'));var rimraf=require(_0x7e7a('0x4'));var config=require(_0x7e7a('0x5'));var attributes=require(_0x7e7a('0x6'));module['exports']=function(_0x17990d,_0x4de30f){return _0x17990d['define'](_0x7e7a('0x7'),attributes,{'tableName':_0x7e7a('0x8'),'paranoid':![],'indexes':[{'name':_0x7e7a('0x9'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 32337b1..90d8fe8 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(_0x23b9c6,_0x4a4023){var _0x12ce86=function(_0x3e37d0){while(--_0x3e37d0){_0x23b9c6['push'](_0x23b9c6['shift']());}};_0x12ce86(++_0x4a4023);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x54a78a,_0x25378b){var _0x200a7a=function(_0x5d9cd6){while(--_0x5d9cd6){_0x54a78a['push'](_0x54a78a['shift']());}};_0x200a7a(++_0x25378b);}(_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 diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 4886ad6..74a663b 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 _0x4fac=['index','get','getDate','show','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','/:id/logo','single','file','addLogo','join','logologin','post','/:id/logo_login','preferred','addPreferred','favicon','addFavicon','put','isAuthenticated','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./setting.controller'];(function(_0x3533c0,_0x4122af){var _0x567538=function(_0x1ceeab){while(--_0x1ceeab){_0x3533c0['push'](_0x3533c0['shift']());}};_0x567538(++_0x4122af);}(_0x4fac,0xf5));var _0xc4fa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4fac[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xc4fa('0x0'));var util=require(_0xc4fa('0x1'));var path=require('path');var timeout=require(_0xc4fa('0x2'));var express=require(_0xc4fa('0x3'));var router=express[_0xc4fa('0x4')]();var auth=require(_0xc4fa('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc4fa('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc4fa('0x7')]);router[_0xc4fa('0x8')]('/now',controller[_0xc4fa('0x9')]);router[_0xc4fa('0x8')]('/:id',controller[_0xc4fa('0xa')]);router['get']('/:id/logo',controller[_0xc4fa('0xb')]);router[_0xc4fa('0x8')]('/:id/logo_login',controller[_0xc4fa('0xc')]);router[_0xc4fa('0x8')](_0xc4fa('0xd'),controller[_0xc4fa('0xe')]);router['get'](_0xc4fa('0xf'),controller[_0xc4fa('0x10')]);router[_0xc4fa('0x8')](_0xc4fa('0x11'),controller['getFavicon']);var upload=multer({'storage':multer[_0xc4fa('0x12')]({'destination':function(_0x306681,_0x308bbd,_0x46e99f){_0x46e99f(null,path['join'](config[_0xc4fa('0x13')],_0xc4fa('0x14')));},'filename':function(_0x2e44da,_0x1649ce,_0x8fc1f){_0x8fc1f(null,util[_0xc4fa('0x15')](_0xc4fa('0x16'),_0xc4fa('0x17'),path[_0xc4fa('0x18')](_0x1649ce[_0xc4fa('0x19')])));}})});router['post'](_0xc4fa('0x1a'),upload[_0xc4fa('0x1b')](_0xc4fa('0x1c')),controller[_0xc4fa('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ece97,_0x5ea7fc,_0x2f8e6f){_0x2f8e6f(null,path[_0xc4fa('0x1e')](config['root'],_0xc4fa('0x14')));},'filename':function(_0x4fb01d,_0x558365,_0xba3e77){_0xba3e77(null,util[_0xc4fa('0x15')](_0xc4fa('0x16'),_0xc4fa('0x1f'),path['extname'](_0x558365[_0xc4fa('0x19')])));}})});router[_0xc4fa('0x20')](_0xc4fa('0x21'),upload['single'](_0xc4fa('0x1c')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3288c2,_0x3a6825,_0x5a93b7){_0x5a93b7(null,path[_0xc4fa('0x1e')](config[_0xc4fa('0x13')],'server/files/images/logos/'));},'filename':function(_0x5cd76b,_0x39c6c6,_0x51c346){_0x51c346(null,util[_0xc4fa('0x15')](_0xc4fa('0x16'),_0xc4fa('0x22'),path[_0xc4fa('0x18')](_0x39c6c6[_0xc4fa('0x19')])));}})});router['post'](_0xc4fa('0xf'),upload[_0xc4fa('0x1b')]('file'),controller[_0xc4fa('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a3097,_0xb883e9,_0x9db5d2){_0x9db5d2(null,path[_0xc4fa('0x1e')](config[_0xc4fa('0x13')],_0xc4fa('0x14')));},'filename':function(_0x5e4496,_0x3b8be0,_0x206d65){_0x206d65(null,util[_0xc4fa('0x15')](_0xc4fa('0x16'),_0xc4fa('0x24'),path[_0xc4fa('0x18')](_0x3b8be0[_0xc4fa('0x19')])));}})});router[_0xc4fa('0x20')](_0xc4fa('0x11'),upload['single'](_0xc4fa('0x1c')),controller[_0xc4fa('0x25')]);router[_0xc4fa('0x26')]('/:id',auth[_0xc4fa('0x27')](),controller[_0xc4fa('0x28')]);module[_0xc4fa('0x29')]=router; \ No newline at end of file +var _0x68a4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','format','%s%s','extname','post','single','file','addLogo','join','server/files/images/logos/','logologin','originalname','addLogoLogin','addPreferred','favicon','put','/:id','update','exports','util','path','connect-timeout','express'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0x68a4,0xa8));var _0x468a=function(_0xfe0ba,_0x5aaae8){_0xfe0ba=_0xfe0ba-0x0;var _0x1368e0=_0x68a4[_0xfe0ba];return _0x1368e0;};'use strict';var multer=require('multer');var util=require(_0x468a('0x0'));var path=require(_0x468a('0x1'));var timeout=require(_0x468a('0x2'));var express=require(_0x468a('0x3'));var router=express['Router']();var auth=require(_0x468a('0x4'));var interaction=require(_0x468a('0x5'));var config=require(_0x468a('0x6'));var controller=require(_0x468a('0x7'));router[_0x468a('0x8')]('/',auth[_0x468a('0x9')](),controller[_0x468a('0xa')]);router[_0x468a('0x8')](_0x468a('0xb'),controller[_0x468a('0xc')]);router['get']('/:id',controller['show']);router[_0x468a('0x8')](_0x468a('0xd'),controller[_0x468a('0xe')]);router[_0x468a('0x8')](_0x468a('0xf'),controller[_0x468a('0x10')]);router[_0x468a('0x8')](_0x468a('0x11'),controller[_0x468a('0x12')]);router[_0x468a('0x8')](_0x468a('0x13'),controller[_0x468a('0x14')]);router[_0x468a('0x8')](_0x468a('0x15'),controller[_0x468a('0x16')]);var upload=multer({'storage':multer[_0x468a('0x17')]({'destination':function(_0x261081,_0x157967,_0x37da7d){_0x37da7d(null,path['join'](config[_0x468a('0x18')],'server/files/images/logos/'));},'filename':function(_0x441537,_0x11608a,_0x1878d9){_0x1878d9(null,util[_0x468a('0x19')](_0x468a('0x1a'),'logo',path[_0x468a('0x1b')](_0x11608a['originalname'])));}})});router[_0x468a('0x1c')](_0x468a('0xd'),upload[_0x468a('0x1d')](_0x468a('0x1e')),controller[_0x468a('0x1f')]);var upload=multer({'storage':multer[_0x468a('0x17')]({'destination':function(_0x58eb76,_0x3f37ec,_0x4ad147){_0x4ad147(null,path[_0x468a('0x20')](config[_0x468a('0x18')],_0x468a('0x21')));},'filename':function(_0x1f373e,_0x3ecd93,_0x28d815){_0x28d815(null,util['format']('%s%s',_0x468a('0x22'),path[_0x468a('0x1b')](_0x3ecd93[_0x468a('0x23')])));}})});router['post']('/:id/logo_login',upload[_0x468a('0x1d')](_0x468a('0x1e')),controller[_0x468a('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ca472,_0x373374,_0x59eada){_0x59eada(null,path['join'](config[_0x468a('0x18')],_0x468a('0x21')));},'filename':function(_0x13507b,_0x23fd77,_0x1a1c8a){_0x1a1c8a(null,util[_0x468a('0x19')]('%s%s','preferred',path[_0x468a('0x1b')](_0x23fd77[_0x468a('0x23')])));}})});router['post']('/:id/preferred',upload['single']('file'),controller[_0x468a('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a7303,_0x87fe51,_0x493db0){_0x493db0(null,path[_0x468a('0x20')](config[_0x468a('0x18')],_0x468a('0x21')));},'filename':function(_0x2be59b,_0x3b1723,_0x276b24){_0x276b24(null,util[_0x468a('0x19')](_0x468a('0x1a'),_0x468a('0x26'),path[_0x468a('0x1b')](_0x3b1723[_0x468a('0x23')])));}})});router[_0x468a('0x1c')](_0x468a('0x15'),upload[_0x468a('0x1d')]('file'),controller['addFavicon']);router[_0x468a('0x27')](_0x468a('0x28'),auth[_0x468a('0x9')](),controller[_0x468a('0x29')]);module[_0x468a('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 930fe10..a578da0 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 _0xc95c=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x1adca0,_0x28434c){var _0x41200b=function(_0xc1a044){while(--_0xc1a044){_0x1adca0['push'](_0x1adca0['shift']());}};_0x41200b(++_0x28434c);}(_0xc95c,0x1bb));var _0xcc95=function(_0x33ee94,_0x1663a3){_0x33ee94=_0x33ee94-0x0;var _0xd269a0=_0xc95c[_0x33ee94];return _0xd269a0;};'use strict';var Sequelize=require(_0xcc95('0x0'));module[_0xcc95('0x1')]={'min_internal':{'type':Sequelize[_0xcc95('0x2')](0xb),'unique':_0xcc95('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xcc95('0x2')](0xb),'unique':_0xcc95('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xcc95('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xcc95('0x5')],'defaultValue':_0xcc95('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xcc95('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xcc95('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xcc95('0x5')]},'turnaddr':{'type':Sequelize[_0xcc95('0x5')]},'turnusername':{'type':Sequelize[_0xcc95('0x5')]},'turnpassword':{'type':Sequelize[_0xcc95('0x5')]},'pageTitle':{'type':Sequelize[_0xcc95('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xcc95('0x5')],'defaultValue':_0xcc95('0x8')},'enableEmailPreview':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xcc95('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xcc95('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xcc95('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xcc95('0x9')},'chatTimeout':{'type':Sequelize[_0xcc95('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xcc95('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xcc95('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xcc95('0x5')]},'defaultFavicon':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xcc95('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xcc95('0x2')]},'transcribeRegion':{'type':Sequelize[_0xcc95('0x5')]},'sentiment':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xcc95('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xcc95('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xcc95('0x2')](0x2)[_0xcc95('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x7fdc=['sequelize','exports','min_mailbox','INTEGER','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED'];(function(_0x3e9579,_0x14f56f){var _0x50f6b5=function(_0x566821){while(--_0x566821){_0x3e9579['push'](_0x3e9579['shift']());}};_0x50f6b5(++_0x14f56f);}(_0x7fdc,0x87));var _0xc7fd=function(_0xb305ce,_0x5d3cf2){_0xb305ce=_0xb305ce-0x0;var _0x550555=_0x7fdc[_0xb305ce];return _0x550555;};'use strict';var Sequelize=require(_0xc7fd('0x0'));module[_0xc7fd('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xc7fd('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xc7fd('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xc7fd('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xc7fd('0x4')]},'defaultLogo':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xc7fd('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xc7fd('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xc7fd('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xc7fd('0x4')]},'pageTitle':{'type':Sequelize[_0xc7fd('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xc7fd('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xc7fd('0x6')},'enableEmailPreview':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xc7fd('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xc7fd('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xc7fd('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xc7fd('0x4')],'defaultValue':_0xc7fd('0x7')},'chatTimeout':{'type':Sequelize[_0xc7fd('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xc7fd('0x4')]},'defaultPreferred':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xc7fd('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xc7fd('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xc7fd('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xc7fd('0x4')]},'defaultFavicon':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xc7fd('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xc7fd('0x3')]},'transcribeRegion':{'type':Sequelize[_0xc7fd('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xc7fd('0x3')]},'sentimentRegion':{'type':Sequelize[_0xc7fd('0x4')]},'language':{'type':Sequelize[_0xc7fd('0x4')]},'bucket':{'type':Sequelize[_0xc7fd('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xc7fd('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0xc7fd('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 43c96fb..be3a35c 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 _0x2215=['getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','json','count','limit','status','set','Content-Range','reject','save','update','destroy','stack','name','index','map','Setting','fieldName','type','key','model','query','keys','attributes','intersection','length','nolimit','offset','order','sort','filters','where','merge','includeAll','include','findAll','rows','show','params','rawAttributes','fields','options','find','body','file','filename','logo','loginLogo','getLogo','preferred','defaultLogo','defaultPreferred','existsSync','join','root','toLower','default','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLogoLogin','server/files/images/logos','getLicense','defaultLoginLogo','defaultFavicon','default_loginLogo.svg','download','gdpr','securePassword','getPreferred','favicon','default_preferred.png','addFavicon','getFavicon'];(function(_0x57fd18,_0x49ef9d){var _0x3c5930=function(_0x135268){while(--_0x135268){_0x57fd18['push'](_0x57fd18['shift']());}};_0x3c5930(++_0x49ef9d);}(_0x2215,0xf9));var _0x5221=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2215[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5221('0x0'));var rimraf=require(_0x5221('0x1'));var zipdir=require(_0x5221('0x2'));var jsonpatch=require(_0x5221('0x3'));var rp=require('request-promise');var moment=require(_0x5221('0x4'));var BPromise=require(_0x5221('0x5'));var Mustache=require(_0x5221('0x6'));var util=require(_0x5221('0x7'));var path=require(_0x5221('0x8'));var sox=require(_0x5221('0x9'));var csv=require(_0x5221('0xa'));var ejs=require(_0x5221('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5221('0xc'));var crypto=require(_0x5221('0xd'));var jsforce=require(_0x5221('0xe'));var deskjs=require(_0x5221('0xf'));var toCsv=require(_0x5221('0xa'));var querystring=require(_0x5221('0x10'));var Papa=require(_0x5221('0x11'));var Redis=require(_0x5221('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5221('0x13'));var as=require(_0x5221('0x14'));var hardwareService=require(_0x5221('0x15'));var logger=require(_0x5221('0x16'))(_0x5221('0x17'));var utils=require(_0x5221('0x18'));var config=require(_0x5221('0x19'));var licenseUtil=require(_0x5221('0x1a'));var db=require(_0x5221('0x1b'))['db'];var jayson=require(_0x5221('0x1c'));var client=jayson[_0x5221('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x417c87,_0x269b7b,_0x1e250c,_0x36662a){return new BPromise(function(_0x1f02eb,_0x3814e0){var _0x53fe10=_0x36662a||client;return _0x53fe10[_0x5221('0x1e')](_0x417c87,_0x1e250c)[_0x5221('0x1f')](function(_0x1d8e7c){logger[_0x5221('0x20')](_0x5221('0x21'),_0x269b7b,_0x5221('0x22'));logger[_0x5221('0x23')]('Setting,\x20%s,\x20%s,\x20%s',_0x269b7b,_0x5221('0x22'),JSON[_0x5221('0x24')](_0x1d8e7c));if(_0x1d8e7c[_0x5221('0x25')]){if(_0x1d8e7c[_0x5221('0x25')][_0x5221('0x26')]===0x1f4){logger[_0x5221('0x25')]('Setting,\x20%s,\x20%s',_0x269b7b,_0x1d8e7c[_0x5221('0x25')][_0x5221('0x27')]);return _0x3814e0(_0x1d8e7c[_0x5221('0x25')][_0x5221('0x27')]);}logger[_0x5221('0x25')](_0x5221('0x21'),_0x269b7b,_0x1d8e7c[_0x5221('0x25')][_0x5221('0x27')]);return _0x1f02eb(_0x1d8e7c[_0x5221('0x25')]['message']);}else{logger[_0x5221('0x20')](_0x5221('0x21'),_0x269b7b,_0x5221('0x22'));_0x1f02eb(_0x1d8e7c[_0x5221('0x28')][_0x5221('0x27')]);}})[_0x5221('0x29')](function(_0x5a9057){logger[_0x5221('0x25')](_0x5221('0x21'),_0x269b7b,_0x5a9057);_0x3814e0(_0x5a9057);});});}function respondWithStatusCode(_0x21d164,_0x49f57c){_0x49f57c=_0x49f57c||0xcc;return function(_0x586e65){if(_0x586e65){return _0x21d164['sendStatus'](_0x49f57c);}return _0x21d164['status'](_0x49f57c)[_0x5221('0x2a')]();};}function respondWithResult(_0x14a573,_0x53a133){_0x53a133=_0x53a133||0xc8;return function(_0x1f1896){if(_0x1f1896){return _0x14a573['status'](_0x53a133)[_0x5221('0x2b')](_0x1f1896);}};}function respondWithFilteredResult(_0x67ae35,_0x508bdc){return function(_0x6f769f){if(_0x6f769f){var _0x2b3841=_0x6f769f[_0x5221('0x2c')],_0x587318=_0x508bdc['offset'],_0x41509d=_0x508bdc['offset']+_0x508bdc[_0x5221('0x2d')],_0x932665;if(_0x41509d>=_0x2b3841){_0x41509d=_0x2b3841;_0x932665=0xc8;}else{_0x932665=0xce;}_0x67ae35[_0x5221('0x2e')](_0x932665);return _0x67ae35[_0x5221('0x2f')](_0x5221('0x30'),_0x587318+'-'+_0x41509d+'/'+_0x2b3841)[_0x5221('0x2b')](_0x6f769f);}return null;};}function patchUpdates(_0x53007e){return function(_0x2a913a){try{jsonpatch['apply'](_0x2a913a,_0x53007e,!![]);}catch(_0x580092){return BPromise[_0x5221('0x31')](_0x580092);}return _0x2a913a[_0x5221('0x32')]();};}function saveUpdates(_0xbf790c,_0x59923f){return function(_0x52ea04){if(_0x52ea04){return _0x52ea04[_0x5221('0x33')](_0xbf790c)['then'](function(_0x26abb6){return _0x26abb6;});}return null;};}function removeEntity(_0x4f01a3,_0x3da148){return function(_0x60b341){if(_0x60b341){return _0x60b341[_0x5221('0x34')]()[_0x5221('0x1f')](function(){_0x4f01a3[_0x5221('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b7692,_0x81ca04){return function(_0x215ef2){if(!_0x215ef2){_0x2b7692['sendStatus'](0x194);}return _0x215ef2;};}function handleError(_0x3dfe04,_0xef6224){_0xef6224=_0xef6224||0x1f4;return function(_0x57ca4f){logger[_0x5221('0x25')](_0x57ca4f[_0x5221('0x35')]);if(_0x57ca4f[_0x5221('0x36')]){delete _0x57ca4f[_0x5221('0x36')];}_0x3dfe04[_0x5221('0x2e')](_0xef6224)['send'](_0x57ca4f);};}exports[_0x5221('0x37')]=function(_0x519472,_0x50b2d4){var _0x464332={},_0x269c3e={},_0x5e7ae1={'count':0x0,'rows':[]};var _0x373f7d=_[_0x5221('0x38')](db[_0x5221('0x39')]['rawAttributes'],function(_0x7a3cef){return{'name':_0x7a3cef[_0x5221('0x3a')],'type':_0x7a3cef[_0x5221('0x3b')][_0x5221('0x3c')]};});_0x269c3e[_0x5221('0x3d')]=_[_0x5221('0x38')](_0x373f7d,_0x5221('0x36'));_0x269c3e[_0x5221('0x3e')]=_[_0x5221('0x3f')](_0x519472[_0x5221('0x3e')]);_0x269c3e['filters']=_['intersection'](_0x269c3e[_0x5221('0x3d')],_0x269c3e[_0x5221('0x3e')]);_0x464332[_0x5221('0x40')]=_[_0x5221('0x41')](_0x269c3e[_0x5221('0x3d')],qs['fields'](_0x519472[_0x5221('0x3e')]['fields']));_0x464332[_0x5221('0x40')]=_0x464332['attributes'][_0x5221('0x42')]?_0x464332[_0x5221('0x40')]:_0x269c3e[_0x5221('0x3d')];if(!_0x519472[_0x5221('0x3e')]['hasOwnProperty'](_0x5221('0x43'))){_0x464332[_0x5221('0x2d')]=qs['limit'](_0x519472['query'][_0x5221('0x2d')]);_0x464332['offset']=qs[_0x5221('0x44')](_0x519472['query']['offset']);}_0x464332[_0x5221('0x45')]=qs['sort'](_0x519472[_0x5221('0x3e')][_0x5221('0x46')]);_0x464332['where']=qs[_0x5221('0x47')](_['pick'](_0x519472[_0x5221('0x3e')],_0x269c3e['filters']),_0x373f7d);if(_0x519472['query']['filter']){_0x464332[_0x5221('0x48')]=_[_0x5221('0x49')](_0x464332[_0x5221('0x48')],{'$or':_[_0x5221('0x38')](_0x373f7d,function(_0x350e1f){if(_0x350e1f['type']!=='VIRTUAL'){var _0x59ad0b={};_0x59ad0b[_0x350e1f[_0x5221('0x36')]]={'$like':'%'+_0x519472[_0x5221('0x3e')]['filter']+'%'};return _0x59ad0b;}})});}_0x464332=_[_0x5221('0x49')]({},_0x464332,_0x519472['options']);var _0xe1e671={'where':_0x464332['where']};return db[_0x5221('0x39')][_0x5221('0x2c')](_0xe1e671)['then'](function(_0x3eeb34){_0x5e7ae1[_0x5221('0x2c')]=_0x3eeb34;if(_0x519472['query'][_0x5221('0x4a')]){_0x464332[_0x5221('0x4b')]=[{'all':!![]}];}return db[_0x5221('0x39')][_0x5221('0x4c')](_0x464332);})[_0x5221('0x1f')](function(_0x4729dc){_0x5e7ae1[_0x5221('0x4d')]=_0x4729dc;return _0x5e7ae1;})[_0x5221('0x1f')](respondWithFilteredResult(_0x50b2d4,_0x464332))['catch'](handleError(_0x50b2d4,null));};exports[_0x5221('0x4e')]=function(_0x36b182,_0x38a28e){var _0x269c73={'raw':![],'where':{'id':_0x36b182[_0x5221('0x4f')]['id']}},_0x268f76={};_0x268f76[_0x5221('0x3d')]=_[_0x5221('0x3f')](db['Setting'][_0x5221('0x50')]);_0x268f76[_0x5221('0x3e')]=_[_0x5221('0x3f')](_0x36b182[_0x5221('0x3e')]);_0x268f76[_0x5221('0x47')]=_[_0x5221('0x41')](_0x268f76['model'],_0x268f76[_0x5221('0x3e')]);_0x269c73[_0x5221('0x40')]=_[_0x5221('0x41')](_0x268f76[_0x5221('0x3d')],qs[_0x5221('0x51')](_0x36b182['query'][_0x5221('0x51')]));_0x269c73[_0x5221('0x40')]=_0x269c73[_0x5221('0x40')][_0x5221('0x42')]?_0x269c73['attributes']:_0x268f76[_0x5221('0x3d')];if(_0x36b182[_0x5221('0x3e')][_0x5221('0x4a')]){_0x269c73[_0x5221('0x4b')]=[{'all':!![]}];}_0x269c73=_[_0x5221('0x49')]({},_0x269c73,_0x36b182[_0x5221('0x52')]);return db[_0x5221('0x39')][_0x5221('0x53')](_0x269c73)[_0x5221('0x1f')](handleEntityNotFound(_0x38a28e,null))[_0x5221('0x1f')](respondWithResult(_0x38a28e,null))[_0x5221('0x29')](handleError(_0x38a28e,null));};exports[_0x5221('0x33')]=function(_0xce1b4b,_0x27dc3a){if(_0xce1b4b[_0x5221('0x54')]['id']){delete _0xce1b4b[_0x5221('0x54')]['id'];}return db[_0x5221('0x39')][_0x5221('0x53')]({'where':{'id':_0xce1b4b[_0x5221('0x4f')]['id']}})[_0x5221('0x1f')](handleEntityNotFound(_0x27dc3a,null))[_0x5221('0x1f')](saveUpdates(_0xce1b4b[_0x5221('0x54')],null))[_0x5221('0x1f')](respondWithResult(_0x27dc3a,null))[_0x5221('0x29')](handleError(_0x27dc3a,null));};exports['addLogo']=function(_0x386dcd,_0x279f1b,_0x276eac){if(_0x386dcd[_0x5221('0x55')]&&_0x386dcd[_0x5221('0x55')][_0x5221('0x56')]){_0x386dcd['body'][_0x5221('0x57')]=_0x386dcd[_0x5221('0x55')][_0x5221('0x56')];}return db[_0x5221('0x39')][_0x5221('0x53')]({'where':{'id':_0x386dcd['params']['id']}})[_0x5221('0x1f')](handleEntityNotFound(_0x279f1b,null))[_0x5221('0x1f')](saveUpdates(_0x386dcd[_0x5221('0x54')],null))[_0x5221('0x1f')](respondWithResult(_0x279f1b,null))[_0x5221('0x29')](handleError(_0x279f1b,null));};exports['addLogoLogin']=function(_0x564277,_0x4bad5b,_0x57f6b5){if(_0x564277[_0x5221('0x55')]&&_0x564277[_0x5221('0x55')][_0x5221('0x56')]){_0x564277[_0x5221('0x54')][_0x5221('0x58')]=_0x564277[_0x5221('0x55')][_0x5221('0x56')];}return db['Setting']['find']({'where':{'id':_0x564277[_0x5221('0x4f')]['id']}})[_0x5221('0x1f')](handleEntityNotFound(_0x4bad5b,null))['then'](saveUpdates(_0x564277[_0x5221('0x54')],null))[_0x5221('0x1f')](respondWithResult(_0x4bad5b,null))[_0x5221('0x29')](handleError(_0x4bad5b,null));};var utilLicense=require(_0x5221('0x1a'));exports[_0x5221('0x59')]=function(_0xbf1bc6,_0x5e4db8,_0x21e0ce){var _0x21d384='server/files/images/logos';var _0x4cd5c3={'custom':![]};return utilLicense['getLicense']()[_0x5221('0x1f')](function(_0x3997a7){if(_0x3997a7){_0x4cd5c3=_0x3997a7;}return db['Setting']['find']({'where':{'id':_0xbf1bc6[_0x5221('0x4f')]['id']},'attributes':[_0x5221('0x57'),_0x5221('0x58'),_0x5221('0x5a'),'favicon',_0x5221('0x5b'),'defaultLoginLogo',_0x5221('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x5221('0x1f')](handleEntityNotFound(_0x5e4db8,null))[_0x5221('0x1f')](function(_0xf2857f){if(_0xf2857f){var _0x4b64b9=_0xf2857f[_0x5221('0x57')]&&fs[_0x5221('0x5d')](path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0x21d384,_[_0x5221('0x60')](_0xf2857f[_0x5221('0x57')])))?path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0x21d384,_[_0x5221('0x60')](_0xf2857f[_0x5221('0x57')])):path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0x21d384,_[_0x5221('0x60')]('default_logo.svg'));var _0x3d8abd=_0x5221('0x61')+_['upperFirst'](_0x5221('0x57'));if(_0xf2857f[_0x3d8abd]||!_0x4cd5c3[_0x5221('0x62')]){_0x4b64b9=path['join'](config[_0x5221('0x5f')],_0x21d384,_[_0x5221('0x60')]('default_logo.svg'));}if(!fs[_0x5221('0x5d')](_0x4b64b9)){throw new db[(_0x5221('0x63'))][(_0x5221('0x64'))](_[_0x5221('0x65')]('logo')+_0x5221('0x66'));}return _0x5e4db8['download'](_0x4b64b9);}})[_0x5221('0x29')](handleError(_0x5e4db8,null));};var utilLicense=require('../../config/license/util');exports[_0x5221('0x67')]=function(_0x378074,_0x1e8d76,_0x4af416){var _0x276121=_0x5221('0x68');var _0x3e575d={'custom':![]};return utilLicense[_0x5221('0x69')]()['then'](function(_0x916a17){if(_0x916a17){_0x3e575d=_0x916a17;}return db[_0x5221('0x39')][_0x5221('0x53')]({'where':{'id':_0x378074[_0x5221('0x4f')]['id']},'attributes':[_0x5221('0x57'),_0x5221('0x58'),_0x5221('0x5a'),'favicon',_0x5221('0x5b'),_0x5221('0x6a'),_0x5221('0x5c'),_0x5221('0x6b')],'raw':!![]});})[_0x5221('0x1f')](handleEntityNotFound(_0x1e8d76,null))[_0x5221('0x1f')](function(_0x5dbc62){if(_0x5dbc62){var _0x5ce8ec=_0x5dbc62['loginLogo']&&fs[_0x5221('0x5d')](path['join'](config[_0x5221('0x5f')],_0x276121,_[_0x5221('0x60')](_0x5dbc62[_0x5221('0x58')])))?path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0x276121,_[_0x5221('0x60')](_0x5dbc62['loginLogo'])):path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0x276121,_[_0x5221('0x60')](_0x5221('0x6c')));var _0x5bc2ba='default'+_['upperFirst'](_0x5221('0x58'));if(_0x5dbc62[_0x5bc2ba]||!_0x3e575d[_0x5221('0x62')]){_0x5ce8ec=path['join'](config['root'],_0x276121,_[_0x5221('0x60')](_0x5221('0x6c')));}if(!fs[_0x5221('0x5d')](_0x5ce8ec)){throw new db['Sequelize'][(_0x5221('0x64'))](_[_0x5221('0x65')]('loginLogo')+_0x5221('0x66'));}return _0x1e8d76[_0x5221('0x6d')](_0x5ce8ec);}})[_0x5221('0x29')](handleError(_0x1e8d76,null));};exports[_0x5221('0x6e')]=function(_0x1f615d,_0x1de303){return db['Setting'][_0x5221('0x53')]({'where':{'id':_0x1f615d[_0x5221('0x4f')]['id']},'attributes':[_0x5221('0x6f')]})[_0x5221('0x1f')](respondWithResult(_0x1de303,null))[_0x5221('0x29')](handleError(_0x1de303,null));};exports['addPreferred']=function(_0x24ee15,_0x3fa4f6,_0x36a346){if(_0x24ee15[_0x5221('0x55')]&&_0x24ee15[_0x5221('0x55')][_0x5221('0x56')]){_0x24ee15['body']['preferred']=_0x24ee15[_0x5221('0x55')][_0x5221('0x56')];}return db[_0x5221('0x39')][_0x5221('0x53')]({'where':{'id':_0x24ee15[_0x5221('0x4f')]['id']}})[_0x5221('0x1f')](handleEntityNotFound(_0x3fa4f6,null))[_0x5221('0x1f')](saveUpdates(_0x24ee15['body'],null))[_0x5221('0x1f')](respondWithResult(_0x3fa4f6,null))[_0x5221('0x29')](handleError(_0x3fa4f6,null));};var utilLicense=require(_0x5221('0x1a'));exports[_0x5221('0x70')]=function(_0x5ae576,_0x52b9e5,_0x47c4b7){var _0x2012c7=_0x5221('0x68');var _0x573a73={'custom':![]};return utilLicense[_0x5221('0x69')]()['then'](function(_0x2c6a2f){if(_0x2c6a2f){_0x573a73=_0x2c6a2f;}return db[_0x5221('0x39')][_0x5221('0x53')]({'where':{'id':_0x5ae576[_0x5221('0x4f')]['id']},'attributes':['logo',_0x5221('0x58'),_0x5221('0x5a'),_0x5221('0x71'),'defaultLogo',_0x5221('0x6a'),_0x5221('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x5221('0x1f')](handleEntityNotFound(_0x52b9e5,null))[_0x5221('0x1f')](function(_0x3e2860){if(_0x3e2860){var _0x45b56f=_0x3e2860[_0x5221('0x5a')]&&fs['existsSync'](path[_0x5221('0x5e')](config['root'],_0x2012c7,_[_0x5221('0x60')](_0x3e2860[_0x5221('0x5a')])))?path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0x2012c7,_[_0x5221('0x60')](_0x3e2860[_0x5221('0x5a')])):path[_0x5221('0x5e')](config['root'],_0x2012c7,_[_0x5221('0x60')](_0x5221('0x72')));var _0x1852c9=_0x5221('0x61')+_['upperFirst']('preferred');if(_0x3e2860[_0x1852c9]||!_0x573a73[_0x5221('0x62')]||!_0x573a73[_0x5221('0x5a')]){_0x45b56f=path['join'](config[_0x5221('0x5f')],_0x2012c7,_[_0x5221('0x60')]('default_preferred.png'));}if(!fs['existsSync'](_0x45b56f)){throw new db[(_0x5221('0x63'))][(_0x5221('0x64'))](_[_0x5221('0x65')](_0x5221('0x5a'))+_0x5221('0x66'));}return _0x52b9e5[_0x5221('0x6d')](_0x45b56f);}})['catch'](handleError(_0x52b9e5,null));};exports[_0x5221('0x73')]=function(_0x4328ad,_0xd444a6,_0x460603){if(_0x4328ad[_0x5221('0x55')]&&_0x4328ad[_0x5221('0x55')][_0x5221('0x56')]){_0x4328ad[_0x5221('0x54')][_0x5221('0x71')]=_0x4328ad['file'][_0x5221('0x56')];}return db[_0x5221('0x39')]['find']({'where':{'id':_0x4328ad['params']['id']}})[_0x5221('0x1f')](handleEntityNotFound(_0xd444a6,null))[_0x5221('0x1f')](saveUpdates(_0x4328ad[_0x5221('0x54')],null))['then'](respondWithResult(_0xd444a6,null))[_0x5221('0x29')](handleError(_0xd444a6,null));};var utilLicense=require(_0x5221('0x1a'));exports[_0x5221('0x74')]=function(_0x341629,_0x3e2333,_0x493da3){var _0xa0208c=_0x5221('0x68');var _0x525d32={'custom':![]};return utilLicense[_0x5221('0x69')]()['then'](function(_0x23f8d3){if(_0x23f8d3){_0x525d32=_0x23f8d3;}return db[_0x5221('0x39')][_0x5221('0x53')]({'where':{'id':_0x341629[_0x5221('0x4f')]['id']},'attributes':[_0x5221('0x57'),_0x5221('0x58'),_0x5221('0x5a'),_0x5221('0x71'),_0x5221('0x5b'),_0x5221('0x6a'),_0x5221('0x5c'),_0x5221('0x6b')],'raw':!![]});})[_0x5221('0x1f')](handleEntityNotFound(_0x3e2333,null))['then'](function(_0x43d858){if(_0x43d858){var _0x5361df=_0x43d858[_0x5221('0x71')]&&fs[_0x5221('0x5d')](path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0xa0208c,_[_0x5221('0x60')](_0x43d858['favicon'])))?path[_0x5221('0x5e')](config['root'],_0xa0208c,_[_0x5221('0x60')](_0x43d858['favicon'])):path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0xa0208c,_[_0x5221('0x60')]('default_favicon.ico'));var _0xe0f78='default'+_[_0x5221('0x65')](_0x5221('0x71'));if(_0x43d858[_0xe0f78]||!_0x525d32[_0x5221('0x62')]){_0x5361df=path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0xa0208c,_[_0x5221('0x60')]('default_favicon.ico'));}if(!fs['existsSync'](_0x5361df)){throw new db['Sequelize'][(_0x5221('0x64'))](_[_0x5221('0x65')](_0x5221('0x71'))+_0x5221('0x66'));}return _0x3e2333['download'](_0x5361df);}})[_0x5221('0x29')](handleError(_0x3e2333,null));};exports[_0x5221('0x75')]=function(_0x2a914b,_0x153f27){var _0x58dec6={'offset':moment()[_0x5221('0x76')]()};_0x58dec6['now']=moment()[_0x5221('0x76')](_0x58dec6[_0x5221('0x44')])[_0x5221('0x77')](_0x5221('0x78'));return _0x153f27[_0x5221('0x2e')](0xc8)[_0x5221('0x79')](_0x58dec6);}; \ No newline at end of file +var _0x564c=['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','../../mysqldb','jayson/promise','http','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','code','error','message','info','result','sendStatus','end','status','json','offset','limit','set','reject','update','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','body','file','filename','logo','addLogoLogin','../../config/license/util','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','root','toLower','join','default','upperFirst','custom','default_logo.svg','existsSync','Sequelize','ValidationError','download','getLogoLogin','defaultFavicon','loginLogo','default_loginLogo.svg','\x20not\x20found','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x17225e,_0x3e48d3){var _0x47b19c=function(_0x523129){while(--_0x523129){_0x17225e['push'](_0x17225e['shift']());}};_0x47b19c(++_0x3e48d3);}(_0x564c,0xe7));var _0xc564=function(_0x33b578,_0x2b7bf0){_0x33b578=_0x33b578-0x0;var _0x407b4b=_0x564c[_0x33b578];return _0x407b4b;};'use strict';var pdf=require(_0xc564('0x0'));var emlformat=require(_0xc564('0x1'));var rimraf=require(_0xc564('0x2'));var zipdir=require(_0xc564('0x3'));var jsonpatch=require(_0xc564('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc564('0x5'));var Mustache=require(_0xc564('0x6'));var util=require(_0xc564('0x7'));var path=require('path');var sox=require(_0xc564('0x8'));var csv=require(_0xc564('0x9'));var ejs=require(_0xc564('0xa'));var fs=require('fs');var _=require(_0xc564('0xb'));var squel=require(_0xc564('0xc'));var crypto=require(_0xc564('0xd'));var jsforce=require(_0xc564('0xe'));var deskjs=require(_0xc564('0xf'));var toCsv=require(_0xc564('0x9'));var querystring=require(_0xc564('0x10'));var Papa=require(_0xc564('0x11'));var Redis=require(_0xc564('0x12'));var authService=require(_0xc564('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc564('0x14'));var hardwareService=require(_0xc564('0x15'));var logger=require(_0xc564('0x16'))(_0xc564('0x17'));var utils=require(_0xc564('0x18'));var config=require(_0xc564('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc564('0x1a'))['db'];var jayson=require(_0xc564('0x1b'));var client=jayson['client'][_0xc564('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xeeec9f,_0x2780a5,_0x2ca94a,_0x2672ed){return new BPromise(function(_0x3bacff,_0x4e486b){var _0xc1861b=_0x2672ed||client;return _0xc1861b['request'](_0xeeec9f,_0x2ca94a)[_0xc564('0x1d')](function(_0x52de66){logger['info'](_0xc564('0x1e'),_0x2780a5,_0xc564('0x1f'));logger[_0xc564('0x20')](_0xc564('0x21'),_0x2780a5,_0xc564('0x1f'),JSON['stringify'](_0x52de66));if(_0x52de66['error']){if(_0x52de66['error'][_0xc564('0x22')]===0x1f4){logger[_0xc564('0x23')](_0xc564('0x1e'),_0x2780a5,_0x52de66[_0xc564('0x23')][_0xc564('0x24')]);return _0x4e486b(_0x52de66[_0xc564('0x23')][_0xc564('0x24')]);}logger['error'](_0xc564('0x1e'),_0x2780a5,_0x52de66[_0xc564('0x23')][_0xc564('0x24')]);return _0x3bacff(_0x52de66[_0xc564('0x23')]['message']);}else{logger[_0xc564('0x25')](_0xc564('0x1e'),_0x2780a5,_0xc564('0x1f'));_0x3bacff(_0x52de66[_0xc564('0x26')][_0xc564('0x24')]);}})['catch'](function(_0xfab3f1){logger['error'](_0xc564('0x1e'),_0x2780a5,_0xfab3f1);_0x4e486b(_0xfab3f1);});});}function respondWithStatusCode(_0x4b50a4,_0x322883){_0x322883=_0x322883||0xcc;return function(_0x5935f5){if(_0x5935f5){return _0x4b50a4[_0xc564('0x27')](_0x322883);}return _0x4b50a4['status'](_0x322883)[_0xc564('0x28')]();};}function respondWithResult(_0xd2f07d,_0x4f7f36){_0x4f7f36=_0x4f7f36||0xc8;return function(_0x4c4501){if(_0x4c4501){return _0xd2f07d[_0xc564('0x29')](_0x4f7f36)[_0xc564('0x2a')](_0x4c4501);}};}function respondWithFilteredResult(_0xa2858b,_0x39727e){return function(_0x503556){if(_0x503556){var _0x40fd27=_0x503556['count'],_0x46f6b0=_0x39727e['offset'],_0x586d79=_0x39727e[_0xc564('0x2b')]+_0x39727e[_0xc564('0x2c')],_0x42706c;if(_0x586d79>=_0x40fd27){_0x586d79=_0x40fd27;_0x42706c=0xc8;}else{_0x42706c=0xce;}_0xa2858b[_0xc564('0x29')](_0x42706c);return _0xa2858b[_0xc564('0x2d')]('Content-Range',_0x46f6b0+'-'+_0x586d79+'/'+_0x40fd27)[_0xc564('0x2a')](_0x503556);}return null;};}function patchUpdates(_0xf1f8a2){return function(_0x254911){try{jsonpatch['apply'](_0x254911,_0xf1f8a2,!![]);}catch(_0x4e38d9){return BPromise[_0xc564('0x2e')](_0x4e38d9);}return _0x254911['save']();};}function saveUpdates(_0x4ce7a5,_0x41c8ae){return function(_0x3650d1){if(_0x3650d1){return _0x3650d1[_0xc564('0x2f')](_0x4ce7a5)[_0xc564('0x1d')](function(_0x370773){return _0x370773;});}return null;};}function removeEntity(_0xb9caaf,_0x1d08c7){return function(_0x174205){if(_0x174205){return _0x174205[_0xc564('0x30')]()['then'](function(){_0xb9caaf[_0xc564('0x29')](0xcc)[_0xc564('0x28')]();});}};}function handleEntityNotFound(_0x90a5c3,_0x2381d3){return function(_0xd28748){if(!_0xd28748){_0x90a5c3['sendStatus'](0x194);}return _0xd28748;};}function handleError(_0xa5422a,_0x4c6caf){_0x4c6caf=_0x4c6caf||0x1f4;return function(_0x45c98a){logger[_0xc564('0x23')](_0x45c98a[_0xc564('0x31')]);if(_0x45c98a[_0xc564('0x32')]){delete _0x45c98a[_0xc564('0x32')];}_0xa5422a[_0xc564('0x29')](_0x4c6caf)[_0xc564('0x33')](_0x45c98a);};}exports['index']=function(_0x49be0f,_0x32315d){var _0x555f6e={},_0x44bdff={},_0x489e00={'count':0x0,'rows':[]};var _0x38c4b5=_[_0xc564('0x34')](db[_0xc564('0x35')][_0xc564('0x36')],function(_0x37474d){return{'name':_0x37474d[_0xc564('0x37')],'type':_0x37474d[_0xc564('0x38')]['key']};});_0x44bdff['model']=_[_0xc564('0x34')](_0x38c4b5,_0xc564('0x32'));_0x44bdff['query']=_[_0xc564('0x39')](_0x49be0f[_0xc564('0x3a')]);_0x44bdff[_0xc564('0x3b')]=_[_0xc564('0x3c')](_0x44bdff[_0xc564('0x3d')],_0x44bdff[_0xc564('0x3a')]);_0x555f6e[_0xc564('0x3e')]=_[_0xc564('0x3c')](_0x44bdff[_0xc564('0x3d')],qs['fields'](_0x49be0f['query'][_0xc564('0x3f')]));_0x555f6e[_0xc564('0x3e')]=_0x555f6e[_0xc564('0x3e')][_0xc564('0x40')]?_0x555f6e[_0xc564('0x3e')]:_0x44bdff[_0xc564('0x3d')];if(!_0x49be0f['query'][_0xc564('0x41')](_0xc564('0x42'))){_0x555f6e[_0xc564('0x2c')]=qs[_0xc564('0x2c')](_0x49be0f['query'][_0xc564('0x2c')]);_0x555f6e[_0xc564('0x2b')]=qs[_0xc564('0x2b')](_0x49be0f[_0xc564('0x3a')][_0xc564('0x2b')]);}_0x555f6e[_0xc564('0x43')]=qs['sort'](_0x49be0f['query'][_0xc564('0x44')]);_0x555f6e[_0xc564('0x45')]=qs[_0xc564('0x3b')](_[_0xc564('0x46')](_0x49be0f['query'],_0x44bdff['filters']),_0x38c4b5);if(_0x49be0f['query'][_0xc564('0x47')]){_0x555f6e[_0xc564('0x45')]=_['merge'](_0x555f6e[_0xc564('0x45')],{'$or':_[_0xc564('0x34')](_0x38c4b5,function(_0x3efcf0){if(_0x3efcf0[_0xc564('0x38')]!==_0xc564('0x48')){var _0x45ec71={};_0x45ec71[_0x3efcf0[_0xc564('0x32')]]={'$like':'%'+_0x49be0f[_0xc564('0x3a')][_0xc564('0x47')]+'%'};return _0x45ec71;}})});}_0x555f6e=_[_0xc564('0x49')]({},_0x555f6e,_0x49be0f[_0xc564('0x4a')]);var _0x3eff9e={'where':_0x555f6e[_0xc564('0x45')]};return db[_0xc564('0x35')]['count'](_0x3eff9e)['then'](function(_0x16e042){_0x489e00['count']=_0x16e042;if(_0x49be0f['query'][_0xc564('0x4b')]){_0x555f6e['include']=[{'all':!![]}];}return db[_0xc564('0x35')][_0xc564('0x4c')](_0x555f6e);})[_0xc564('0x1d')](function(_0x374009){_0x489e00[_0xc564('0x4d')]=_0x374009;return _0x489e00;})[_0xc564('0x1d')](respondWithFilteredResult(_0x32315d,_0x555f6e))[_0xc564('0x4e')](handleError(_0x32315d,null));};exports[_0xc564('0x4f')]=function(_0x5984bc,_0x289bbf){var _0x20fb43={'raw':![],'where':{'id':_0x5984bc[_0xc564('0x50')]['id']}},_0x509cdc={};_0x509cdc[_0xc564('0x3d')]=_[_0xc564('0x39')](db[_0xc564('0x35')][_0xc564('0x36')]);_0x509cdc['query']=_['keys'](_0x5984bc[_0xc564('0x3a')]);_0x509cdc[_0xc564('0x3b')]=_[_0xc564('0x3c')](_0x509cdc[_0xc564('0x3d')],_0x509cdc[_0xc564('0x3a')]);_0x20fb43[_0xc564('0x3e')]=_[_0xc564('0x3c')](_0x509cdc['model'],qs[_0xc564('0x3f')](_0x5984bc[_0xc564('0x3a')][_0xc564('0x3f')]));_0x20fb43[_0xc564('0x3e')]=_0x20fb43[_0xc564('0x3e')]['length']?_0x20fb43['attributes']:_0x509cdc[_0xc564('0x3d')];if(_0x5984bc[_0xc564('0x3a')][_0xc564('0x4b')]){_0x20fb43[_0xc564('0x51')]=[{'all':!![]}];}_0x20fb43=_['merge']({},_0x20fb43,_0x5984bc[_0xc564('0x4a')]);return db['Setting'][_0xc564('0x52')](_0x20fb43)[_0xc564('0x1d')](handleEntityNotFound(_0x289bbf,null))[_0xc564('0x1d')](respondWithResult(_0x289bbf,null))[_0xc564('0x4e')](handleError(_0x289bbf,null));};exports[_0xc564('0x2f')]=function(_0x49b309,_0x5ea792){if(_0x49b309['body']['id']){delete _0x49b309[_0xc564('0x53')]['id'];}return db['Setting'][_0xc564('0x52')]({'where':{'id':_0x49b309[_0xc564('0x50')]['id']}})[_0xc564('0x1d')](handleEntityNotFound(_0x5ea792,null))[_0xc564('0x1d')](saveUpdates(_0x49b309['body'],null))[_0xc564('0x1d')](respondWithResult(_0x5ea792,null))[_0xc564('0x4e')](handleError(_0x5ea792,null));};exports['addLogo']=function(_0x6287a1,_0x4f0f81,_0x334e72){if(_0x6287a1[_0xc564('0x54')]&&_0x6287a1['file'][_0xc564('0x55')]){_0x6287a1['body'][_0xc564('0x56')]=_0x6287a1[_0xc564('0x54')][_0xc564('0x55')];}return db[_0xc564('0x35')][_0xc564('0x52')]({'where':{'id':_0x6287a1[_0xc564('0x50')]['id']}})[_0xc564('0x1d')](handleEntityNotFound(_0x4f0f81,null))['then'](saveUpdates(_0x6287a1[_0xc564('0x53')],null))[_0xc564('0x1d')](respondWithResult(_0x4f0f81,null))['catch'](handleError(_0x4f0f81,null));};exports[_0xc564('0x57')]=function(_0x14ada4,_0x1587a9,_0x55f896){if(_0x14ada4[_0xc564('0x54')]&&_0x14ada4[_0xc564('0x54')][_0xc564('0x55')]){_0x14ada4[_0xc564('0x53')]['loginLogo']=_0x14ada4[_0xc564('0x54')][_0xc564('0x55')];}return db[_0xc564('0x35')]['find']({'where':{'id':_0x14ada4[_0xc564('0x50')]['id']}})[_0xc564('0x1d')](handleEntityNotFound(_0x1587a9,null))[_0xc564('0x1d')](saveUpdates(_0x14ada4[_0xc564('0x53')],null))[_0xc564('0x1d')](respondWithResult(_0x1587a9,null))['catch'](handleError(_0x1587a9,null));};var utilLicense=require(_0xc564('0x58'));exports['getLogo']=function(_0xb54cba,_0x4dccbe,_0x3dfda2){var _0x1d009e=_0xc564('0x59');var _0x3a84fd={'custom':![]};return utilLicense[_0xc564('0x5a')]()[_0xc564('0x1d')](function(_0x4067db){if(_0x4067db){_0x3a84fd=_0x4067db;}return db[_0xc564('0x35')][_0xc564('0x52')]({'where':{'id':_0xb54cba[_0xc564('0x50')]['id']},'attributes':[_0xc564('0x56'),'loginLogo',_0xc564('0x5b'),_0xc564('0x5c'),_0xc564('0x5d'),_0xc564('0x5e'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x4dccbe,null))['then'](function(_0x508da0){if(_0x508da0){var _0x36c1d8=_0x508da0[_0xc564('0x56')]&&fs['existsSync'](path['join'](config[_0xc564('0x5f')],_0x1d009e,_[_0xc564('0x60')](_0x508da0[_0xc564('0x56')])))?path[_0xc564('0x61')](config[_0xc564('0x5f')],_0x1d009e,_[_0xc564('0x60')](_0x508da0[_0xc564('0x56')])):path[_0xc564('0x61')](config[_0xc564('0x5f')],_0x1d009e,_['toLower']('default_logo.svg'));var _0x3bdbbf=_0xc564('0x62')+_[_0xc564('0x63')](_0xc564('0x56'));if(_0x508da0[_0x3bdbbf]||!_0x3a84fd[_0xc564('0x64')]){_0x36c1d8=path['join'](config[_0xc564('0x5f')],_0x1d009e,_[_0xc564('0x60')](_0xc564('0x65')));}if(!fs[_0xc564('0x66')](_0x36c1d8)){throw new db[(_0xc564('0x67'))][(_0xc564('0x68'))](_[_0xc564('0x63')]('logo')+'\x20not\x20found');}return _0x4dccbe[_0xc564('0x69')](_0x36c1d8);}})['catch'](handleError(_0x4dccbe,null));};var utilLicense=require(_0xc564('0x58'));exports[_0xc564('0x6a')]=function(_0x47c944,_0x93a843,_0x16bc4f){var _0x57a03c=_0xc564('0x59');var _0x1e962b={'custom':![]};return utilLicense['getLicense']()[_0xc564('0x1d')](function(_0x58f479){if(_0x58f479){_0x1e962b=_0x58f479;}return db[_0xc564('0x35')][_0xc564('0x52')]({'where':{'id':_0x47c944[_0xc564('0x50')]['id']},'attributes':[_0xc564('0x56'),'loginLogo',_0xc564('0x5b'),_0xc564('0x5c'),_0xc564('0x5d'),_0xc564('0x5e'),'defaultPreferred',_0xc564('0x6b')],'raw':!![]});})[_0xc564('0x1d')](handleEntityNotFound(_0x93a843,null))['then'](function(_0x5ac909){if(_0x5ac909){var _0x5e9923=_0x5ac909['loginLogo']&&fs[_0xc564('0x66')](path['join'](config[_0xc564('0x5f')],_0x57a03c,_[_0xc564('0x60')](_0x5ac909[_0xc564('0x6c')])))?path['join'](config[_0xc564('0x5f')],_0x57a03c,_[_0xc564('0x60')](_0x5ac909[_0xc564('0x6c')])):path[_0xc564('0x61')](config['root'],_0x57a03c,_[_0xc564('0x60')](_0xc564('0x6d')));var _0x2a3706=_0xc564('0x62')+_['upperFirst']('loginLogo');if(_0x5ac909[_0x2a3706]||!_0x1e962b[_0xc564('0x64')]){_0x5e9923=path[_0xc564('0x61')](config['root'],_0x57a03c,_[_0xc564('0x60')](_0xc564('0x6d')));}if(!fs[_0xc564('0x66')](_0x5e9923)){throw new db[(_0xc564('0x67'))][(_0xc564('0x68'))](_[_0xc564('0x63')]('loginLogo')+_0xc564('0x6e'));}return _0x93a843[_0xc564('0x69')](_0x5e9923);}})[_0xc564('0x4e')](handleError(_0x93a843,null));};exports[_0xc564('0x6f')]=function(_0x38d46f,_0x1e8055){return db[_0xc564('0x35')][_0xc564('0x52')]({'where':{'id':_0x38d46f[_0xc564('0x50')]['id']},'attributes':['securePassword']})[_0xc564('0x1d')](respondWithResult(_0x1e8055,null))[_0xc564('0x4e')](handleError(_0x1e8055,null));};exports[_0xc564('0x70')]=function(_0x55cc84,_0x4b6741,_0x594770){if(_0x55cc84['file']&&_0x55cc84[_0xc564('0x54')][_0xc564('0x55')]){_0x55cc84[_0xc564('0x53')][_0xc564('0x5b')]=_0x55cc84[_0xc564('0x54')][_0xc564('0x55')];}return db[_0xc564('0x35')]['find']({'where':{'id':_0x55cc84['params']['id']}})[_0xc564('0x1d')](handleEntityNotFound(_0x4b6741,null))[_0xc564('0x1d')](saveUpdates(_0x55cc84['body'],null))[_0xc564('0x1d')](respondWithResult(_0x4b6741,null))[_0xc564('0x4e')](handleError(_0x4b6741,null));};var utilLicense=require(_0xc564('0x58'));exports[_0xc564('0x71')]=function(_0x3d3ea3,_0x542e48,_0xab1476){var _0x1425e6=_0xc564('0x59');var _0x3bfdac={'custom':![]};return utilLicense[_0xc564('0x5a')]()[_0xc564('0x1d')](function(_0x2ff37d){if(_0x2ff37d){_0x3bfdac=_0x2ff37d;}return db['Setting'][_0xc564('0x52')]({'where':{'id':_0x3d3ea3['params']['id']},'attributes':['logo',_0xc564('0x6c'),_0xc564('0x5b'),_0xc564('0x5c'),_0xc564('0x5d'),'defaultLoginLogo','defaultPreferred',_0xc564('0x6b')],'raw':!![]});})[_0xc564('0x1d')](handleEntityNotFound(_0x542e48,null))[_0xc564('0x1d')](function(_0x3ba00b){if(_0x3ba00b){var _0x6ce880=_0x3ba00b[_0xc564('0x5b')]&&fs[_0xc564('0x66')](path[_0xc564('0x61')](config[_0xc564('0x5f')],_0x1425e6,_['toLower'](_0x3ba00b[_0xc564('0x5b')])))?path[_0xc564('0x61')](config[_0xc564('0x5f')],_0x1425e6,_[_0xc564('0x60')](_0x3ba00b[_0xc564('0x5b')])):path[_0xc564('0x61')](config[_0xc564('0x5f')],_0x1425e6,_['toLower'](_0xc564('0x72')));var _0x29eb8b=_0xc564('0x62')+_['upperFirst'](_0xc564('0x5b'));if(_0x3ba00b[_0x29eb8b]||!_0x3bfdac['custom']||!_0x3bfdac[_0xc564('0x5b')]){_0x6ce880=path[_0xc564('0x61')](config['root'],_0x1425e6,_['toLower'](_0xc564('0x72')));}if(!fs[_0xc564('0x66')](_0x6ce880)){throw new db[(_0xc564('0x67'))][(_0xc564('0x68'))](_['upperFirst'](_0xc564('0x5b'))+_0xc564('0x6e'));}return _0x542e48[_0xc564('0x69')](_0x6ce880);}})['catch'](handleError(_0x542e48,null));};exports[_0xc564('0x73')]=function(_0x536e29,_0x28970b,_0x3a00cd){if(_0x536e29['file']&&_0x536e29['file'][_0xc564('0x55')]){_0x536e29[_0xc564('0x53')][_0xc564('0x5c')]=_0x536e29[_0xc564('0x54')][_0xc564('0x55')];}return db[_0xc564('0x35')][_0xc564('0x52')]({'where':{'id':_0x536e29[_0xc564('0x50')]['id']}})[_0xc564('0x1d')](handleEntityNotFound(_0x28970b,null))[_0xc564('0x1d')](saveUpdates(_0x536e29[_0xc564('0x53')],null))[_0xc564('0x1d')](respondWithResult(_0x28970b,null))[_0xc564('0x4e')](handleError(_0x28970b,null));};var utilLicense=require(_0xc564('0x58'));exports[_0xc564('0x74')]=function(_0x595d35,_0x50d478,_0x2adc28){var _0x37c672=_0xc564('0x59');var _0x25dc04={'custom':![]};return utilLicense[_0xc564('0x5a')]()[_0xc564('0x1d')](function(_0x4da328){if(_0x4da328){_0x25dc04=_0x4da328;}return db[_0xc564('0x35')][_0xc564('0x52')]({'where':{'id':_0x595d35[_0xc564('0x50')]['id']},'attributes':['logo','loginLogo','preferred','favicon',_0xc564('0x5d'),_0xc564('0x5e'),'defaultPreferred',_0xc564('0x6b')],'raw':!![]});})[_0xc564('0x1d')](handleEntityNotFound(_0x50d478,null))[_0xc564('0x1d')](function(_0x50e868){if(_0x50e868){var _0x4cf4f5=_0x50e868[_0xc564('0x5c')]&&fs[_0xc564('0x66')](path['join'](config[_0xc564('0x5f')],_0x37c672,_[_0xc564('0x60')](_0x50e868[_0xc564('0x5c')])))?path[_0xc564('0x61')](config[_0xc564('0x5f')],_0x37c672,_[_0xc564('0x60')](_0x50e868[_0xc564('0x5c')])):path[_0xc564('0x61')](config['root'],_0x37c672,_[_0xc564('0x60')](_0xc564('0x75')));var _0x1af0e7=_0xc564('0x62')+_[_0xc564('0x63')](_0xc564('0x5c'));if(_0x50e868[_0x1af0e7]||!_0x25dc04['custom']){_0x4cf4f5=path['join'](config[_0xc564('0x5f')],_0x37c672,_[_0xc564('0x60')](_0xc564('0x75')));}if(!fs[_0xc564('0x66')](_0x4cf4f5)){throw new db[(_0xc564('0x67'))][(_0xc564('0x68'))](_[_0xc564('0x63')](_0xc564('0x5c'))+_0xc564('0x6e'));}return _0x50d478['download'](_0x4cf4f5);}})[_0xc564('0x4e')](handleError(_0x50d478,null));};exports['getDate']=function(_0x32d18f,_0xf48121){var _0x32071e={'offset':moment()[_0xc564('0x76')]()};_0x32071e['now']=moment()['utcOffset'](_0x32071e[_0xc564('0x2b')])[_0xc564('0x77')](_0xc564('0x78'));return _0xf48121[_0xc564('0x29')](0xc8)['send'](_0x32071e);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 2aed274..ff788de 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 _0x7af3=['./setting.attributes','define','Setting','settings','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x16efc9,_0x4fa873){var _0x162eaf=function(_0x1db3d2){while(--_0x1db3d2){_0x16efc9['push'](_0x16efc9['shift']());}};_0x162eaf(++_0x4fa873);}(_0x7af3,0x176));var _0x37af=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x7af3[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require(_0x37af('0x0'));var logger=require(_0x37af('0x1'))(_0x37af('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x37af('0x3'));var fs=require('fs');var path=require(_0x37af('0x4'));var rimraf=require('rimraf');var config=require(_0x37af('0x5'));var attributes=require(_0x37af('0x6'));module['exports']=function(_0x222e41,_0x2e3979){return _0x222e41[_0x37af('0x7')](_0x37af('0x8'),attributes,{'tableName':_0x37af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5dca=['bluebird','path','rimraf','../../config/environment','./setting.attributes','exports','settings','util','../../config/logger','api','moment'];(function(_0x3330f1,_0x21e518){var _0x3bac15=function(_0x124ba9){while(--_0x124ba9){_0x3330f1['push'](_0x3330f1['shift']());}};_0x3bac15(++_0x21e518);}(_0x5dca,0x17d));var _0xa5dc=function(_0x1b0b65,_0x317886){_0x1b0b65=_0x1b0b65-0x0;var _0x47fafa=_0x5dca[_0x1b0b65];return _0x47fafa;};'use strict';var _=require('lodash');var util=require(_0xa5dc('0x0'));var logger=require(_0xa5dc('0x1'))(_0xa5dc('0x2'));var moment=require(_0xa5dc('0x3'));var BPromise=require(_0xa5dc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5dc('0x5'));var rimraf=require(_0xa5dc('0x6'));var config=require(_0xa5dc('0x7'));var attributes=require(_0xa5dc('0x8'));module[_0xa5dc('0x9')]=function(_0x1f552b,_0x44ede6){return _0x1f552b['define']('Setting',attributes,{'tableName':_0xa5dc('0xa'),'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 7be30e1..7eaa923 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 _0x2507=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','stringify','error','code','Setting,\x20%s,\x20%s','message','request\x20sent','lodash','util','moment','bluebird'];(function(_0x5a852b,_0x1694c2){var _0xd74d84=function(_0x170a6d){while(--_0x170a6d){_0x5a852b['push'](_0x5a852b['shift']());}};_0xd74d84(++_0x1694c2);}(_0x2507,0x6f));var _0x7250=function(_0x485869,_0x3f0b71){_0x485869=_0x485869-0x0;var _0x52ee7a=_0x2507[_0x485869];return _0x52ee7a;};'use strict';var _=require(_0x7250('0x0'));var util=require(_0x7250('0x1'));var moment=require(_0x7250('0x2'));var BPromise=require(_0x7250('0x3'));var rs=require(_0x7250('0x4'));var fs=require('fs');var Redis=require(_0x7250('0x5'));var db=require(_0x7250('0x6'))['db'];var utils=require(_0x7250('0x7'));var logger=require(_0x7250('0x8'))(_0x7250('0x9'));var config=require(_0x7250('0xa'));var jayson=require(_0x7250('0xb'));var client=jayson[_0x7250('0xc')][_0x7250('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x457cf0,_0x2b9d69,_0x2fa096){return new BPromise(function(_0x5b3a39,_0x177cb0){return client[_0x7250('0xe')](_0x457cf0,_0x2fa096)[_0x7250('0xf')](function(_0xb0b986){logger[_0x7250('0x10')]('Setting,\x20%s,\x20%s',_0x2b9d69,'request\x20sent');logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x2b9d69,'request\x20sent',JSON[_0x7250('0x11')](_0xb0b986));if(_0xb0b986[_0x7250('0x12')]){if(_0xb0b986['error'][_0x7250('0x13')]===0x1f4){logger[_0x7250('0x12')](_0x7250('0x14'),_0x2b9d69,_0xb0b986[_0x7250('0x12')][_0x7250('0x15')]);return _0x177cb0(_0xb0b986[_0x7250('0x12')][_0x7250('0x15')]);}logger[_0x7250('0x12')](_0x7250('0x14'),_0x2b9d69,_0xb0b986[_0x7250('0x12')][_0x7250('0x15')]);return _0x5b3a39(_0xb0b986['error'][_0x7250('0x15')]);}else{logger[_0x7250('0x10')]('Setting,\x20%s,\x20%s',_0x2b9d69,_0x7250('0x16'));_0x5b3a39(_0xb0b986['result'][_0x7250('0x15')]);}})['catch'](function(_0x39aa32){logger[_0x7250('0x12')](_0x7250('0x14'),_0x2b9d69,_0x39aa32);_0x177cb0(_0x39aa32);});});} \ No newline at end of file +var _0xc6f1=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0xc49a14,_0xb10b70){var _0x4f817a=function(_0x574eed){while(--_0x574eed){_0xc49a14['push'](_0xc49a14['shift']());}};_0x4f817a(++_0xb10b70);}(_0xc6f1,0xd9));var _0x1c6f=function(_0x27c69b,_0x4cbe55){_0x27c69b=_0x27c69b-0x0;var _0x198ac4=_0xc6f1[_0x27c69b];return _0x198ac4;};'use strict';var _=require(_0x1c6f('0x0'));var util=require(_0x1c6f('0x1'));var moment=require(_0x1c6f('0x2'));var BPromise=require(_0x1c6f('0x3'));var rs=require(_0x1c6f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c6f('0x5'))['db'];var utils=require(_0x1c6f('0x6'));var logger=require('../../config/logger')(_0x1c6f('0x7'));var config=require(_0x1c6f('0x8'));var jayson=require(_0x1c6f('0x9'));var client=jayson[_0x1c6f('0xa')][_0x1c6f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3eb80e,_0x3efb76,_0x10742a){return new BPromise(function(_0x2f0096,_0x1b41e0){return client[_0x1c6f('0xc')](_0x3eb80e,_0x10742a)['then'](function(_0x212ddf){logger[_0x1c6f('0xd')](_0x1c6f('0xe'),_0x3efb76,'request\x20sent');logger[_0x1c6f('0xf')](_0x1c6f('0x10'),_0x3efb76,_0x1c6f('0x11'),JSON[_0x1c6f('0x12')](_0x212ddf));if(_0x212ddf[_0x1c6f('0x13')]){if(_0x212ddf['error'][_0x1c6f('0x14')]===0x1f4){logger[_0x1c6f('0x13')](_0x1c6f('0xe'),_0x3efb76,_0x212ddf[_0x1c6f('0x13')][_0x1c6f('0x15')]);return _0x1b41e0(_0x212ddf[_0x1c6f('0x13')][_0x1c6f('0x15')]);}logger[_0x1c6f('0x13')](_0x1c6f('0xe'),_0x3efb76,_0x212ddf[_0x1c6f('0x13')]['message']);return _0x2f0096(_0x212ddf[_0x1c6f('0x13')]['message']);}else{logger['info'](_0x1c6f('0xe'),_0x3efb76,_0x1c6f('0x11'));_0x2f0096(_0x212ddf[_0x1c6f('0x16')][_0x1c6f('0x15')]);}})[_0x1c6f('0x17')](function(_0x5da738){logger['error'](_0x1c6f('0xe'),_0x3efb76,_0x5da738);_0x1b41e0(_0x5da738);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index cd1e63b..7d01cdb 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 _0x757a=['/:id/interactions','/:id/users','getAgents','post','create','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','/:id/status','status','addAgents','put','update','delete','removeAgents','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x552b03,_0x48e023){var _0x14ab19=function(_0x58fb5e){while(--_0x58fb5e){_0x552b03['push'](_0x552b03['shift']());}};_0x14ab19(++_0x48e023);}(_0x757a,0xde));var _0xa757=function(_0x3f5277,_0x564d83){_0x3f5277=_0x3f5277-0x0;var _0x1d8dd1=_0x757a[_0x3f5277];return _0x1d8dd1;};'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('0x6')](_0xa757('0xe'),auth[_0xa757('0x7')](),controller[_0xa757('0xf')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['get'](_0xa757('0x10'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xa757('0x6')]('/:id/status',controller['statusGet']);router[_0xa757('0x6')](_0xa757('0x11'),auth[_0xa757('0x7')](),controller[_0xa757('0x12')]);router[_0xa757('0x13')]('/',auth[_0xa757('0x7')](),controller[_0xa757('0x14')]);router[_0xa757('0x13')](_0xa757('0xc'),auth[_0xa757('0x7')](),controller['addDisposition']);router[_0xa757('0x13')](_0xa757('0xe'),auth[_0xa757('0x7')](),controller['addAnswer']);router['post'](_0xa757('0x15'),controller[_0xa757('0x16')]);router[_0xa757('0x13')](_0xa757('0x17'),auth[_0xa757('0x7')](),controller[_0xa757('0x18')]);router['post'](_0xa757('0x19'),auth['isAuthenticated'](),controller[_0xa757('0x1a')]);router[_0xa757('0x13')](_0xa757('0x1b'),controller[_0xa757('0x1c')]);router['post']('/:id/users',auth[_0xa757('0x7')](),controller[_0xa757('0x1d')]);router[_0xa757('0x1e')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0x1f')]);router[_0xa757('0x20')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller['destroy']);router[_0xa757('0x20')]('/:id/dispositions',auth[_0xa757('0x7')](),controller['removeDispositions']);router[_0xa757('0x20')](_0xa757('0xe'),auth[_0xa757('0x7')](),controller['removeAnswers']);router[_0xa757('0x20')](_0xa757('0x11'),auth[_0xa757('0x7')](),controller[_0xa757('0x21')]);module['exports']=router; \ No newline at end of file +var _0xbaf0=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post','addDisposition','/:id/notify','notify','/:id/send','send','status','addAgents','update','removeDispositions','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1a635e,_0x241651){var _0x5b3345=function(_0x5d94d8){while(--_0x5d94d8){_0x1a635e['push'](_0x1a635e['shift']());}};_0x5b3345(++_0x241651);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'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['getApplications']);router[_0x0baf('0x8')](_0x0baf('0x14'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router['get'](_0x0baf('0x16'),controller['statusGet']);router[_0x0baf('0x8')](_0x0baf('0x17'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/',auth[_0x0baf('0x9')](),controller['create']);router['post'](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x19')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller['addAnswer']);router[_0x0baf('0x19')](_0x0baf('0x1b'),controller[_0x0baf('0x1c')]);router[_0x0baf('0x19')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller['addApplications']);router['post'](_0x0baf('0x1d'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1e')]);router[_0x0baf('0x19')](_0x0baf('0x16'),controller[_0x0baf('0x1f')]);router[_0x0baf('0x19')](_0x0baf('0x17'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x20')]);router['put'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0x21')]);router['delete']('/:id',auth[_0x0baf('0x9')](),controller['destroy']);router['delete'](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x22')]);router[_0x0baf('0x23')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x24')]);router[_0x0baf('0x23')](_0x0baf('0x17'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x25')]);module[_0x0baf('0x26')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index b682714..d2585bf 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 _0x9ded=['csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','STRING','name','generate','ENUM','skebby','plivo','clickatell'];(function(_0x39691e,_0x8d94d2){var _0x2a8fdf=function(_0x3e45d5){while(--_0x3e45d5){_0x39691e['push'](_0x39691e['shift']());}};_0x2a8fdf(++_0x8d94d2);}(_0x9ded,0x1ee));var _0xd9de=function(_0xa3f0c9,_0x281090){_0xa3f0c9=_0xa3f0c9-0x0;var _0x168a1a=_0x9ded[_0xa3f0c9];return _0x168a1a;};'use strict';var Sequelize=require(_0xd9de('0x0'));var rs=require(_0xd9de('0x1'));module[_0xd9de('0x2')]={'name':{'type':Sequelize[_0xd9de('0x3')],'unique':_0xd9de('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xd9de('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xd9de('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xd9de('0x3')],'defaultValue':function(){return rs[_0xd9de('0x5')]();}},'phone':{'type':Sequelize[_0xd9de('0x3')]},'type':{'type':Sequelize[_0xd9de('0x6')]('twilio',_0xd9de('0x7'),'connectel','clicksend',_0xd9de('0x8'),_0xd9de('0x9'),_0xd9de('0xa'),_0xd9de('0xb'),_0xd9de('0xc'))},'accountSid':{'type':Sequelize[_0xd9de('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xd9de('0x3')]},'smsMethod':{'type':Sequelize[_0xd9de('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd9de('0x3')]},'password':{'type':Sequelize[_0xd9de('0x3')]},'apiKey':{'type':Sequelize[_0xd9de('0x3')]},'senderString':{'type':Sequelize[_0xd9de('0x3')]},'deliveryReport':{'type':Sequelize[_0xd9de('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xd9de('0x3')]},'notificationTemplate':{'type':Sequelize[_0xd9de('0xe')],'defaultValue':function(){return _0xd9de('0xf');}},'notificationSound':{'type':Sequelize[_0xd9de('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd9de('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd9de('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd9de('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd9de('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd9de('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd9de('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd9de('0x10')],'comment':_0xd9de('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xd9de('0xd')],'defaultValue':![],'comment':_0xd9de('0x12'),'set':function(_0x5286a0){if(!_0x5286a0)this['setDataValue'](_0xd9de('0x13'),null);this[_0xd9de('0x14')]('mandatoryDisposition',_0x5286a0);}}}; \ No newline at end of file +var _0xfba0=['BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize','randomstring','exports','STRING','name','generate','twilio','skebby','connectel','clicksend','csc','infobip','intelepeer','ENUM'];(function(_0x509c0d,_0x319134){var _0x58dc8=function(_0xd586f5){while(--_0xd586f5){_0x509c0d['push'](_0x509c0d['shift']());}};_0x58dc8(++_0x319134);}(_0xfba0,0x1be));var _0x0fba=function(_0x2cce9e,_0x2239e0){_0x2cce9e=_0x2cce9e-0x0;var _0x1be350=_0xfba0[_0x2cce9e];return _0x1be350;};'use strict';var Sequelize=require(_0x0fba('0x0'));var rs=require(_0x0fba('0x1'));module[_0x0fba('0x2')]={'name':{'type':Sequelize[_0x0fba('0x3')],'unique':_0x0fba('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x0fba('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x0fba('0x3')],'defaultValue':function(){return rs[_0x0fba('0x5')]();}},'phone':{'type':Sequelize[_0x0fba('0x3')]},'type':{'type':Sequelize['ENUM'](_0x0fba('0x6'),_0x0fba('0x7'),_0x0fba('0x8'),_0x0fba('0x9'),'plivo','clickatell',_0x0fba('0xa'),_0x0fba('0xb'),_0x0fba('0xc'))},'accountSid':{'type':Sequelize[_0x0fba('0x3')]},'authId':{'type':Sequelize[_0x0fba('0x3')]},'authToken':{'type':Sequelize[_0x0fba('0x3')]},'smsMethod':{'type':Sequelize[_0x0fba('0xd')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0fba('0x3')]},'apiKey':{'type':Sequelize[_0x0fba('0x3')]},'senderString':{'type':Sequelize[_0x0fba('0x3')]},'deliveryReport':{'type':Sequelize[_0x0fba('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x0fba('0xf')],'defaultValue':function(){return _0x0fba('0x10');}},'notificationSound':{'type':Sequelize[_0x0fba('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0fba('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0fba('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0fba('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0fba('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0fba('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x0fba('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x0fba('0xe')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x340a95){if(!_0x340a95)this[_0x0fba('0x13')]('mandatoryDispositionPauseId',null);this[_0x0fba('0x13')]('mandatoryDisposition',_0x340a95);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index d3b5d69..c57ffde 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 _0x3a8a=['userSmsAccount:remove','getAgents','User','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','status','json','count','offset','limit','Content-Range','apply','reject','save','update','get','SmsAccounts','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','Pause','map','SmsAccount','rawAttributes','type','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','findAll','rows','show','params','keys','fields','length','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','sort','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','SmsApplication','Applications','account','orderBy','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','Text','results','csc','originatingAddress','segmentedMessage','clickatell','refid','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','applications','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','List','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','infobip','DELIVERED','intelepeer','redif','groupName','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','userSmsAccount:save','removeAgents','isArray','emit'];(function(_0x101a17,_0x5d047a){var _0x3b76ee=function(_0x89be1b){while(--_0x89be1b){_0x101a17['push'](_0x101a17['shift']());}};_0x3b76ee(++_0x5d047a);}(_0x3a8a,0x1c5));var _0xa3a8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3a8a[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0xa3a8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa3a8('0x1'));var zipdir=require(_0xa3a8('0x2'));var jsonpatch=require(_0xa3a8('0x3'));var rp=require(_0xa3a8('0x4'));var moment=require(_0xa3a8('0x5'));var BPromise=require(_0xa3a8('0x6'));var Mustache=require(_0xa3a8('0x7'));var util=require(_0xa3a8('0x8'));var path=require(_0xa3a8('0x9'));var sox=require(_0xa3a8('0xa'));var csv=require(_0xa3a8('0xb'));var ejs=require(_0xa3a8('0xc'));var fs=require('fs');var _=require(_0xa3a8('0xd'));var squel=require(_0xa3a8('0xe'));var crypto=require(_0xa3a8('0xf'));var jsforce=require(_0xa3a8('0x10'));var deskjs=require(_0xa3a8('0x11'));var toCsv=require(_0xa3a8('0xb'));var querystring=require(_0xa3a8('0x12'));var Papa=require(_0xa3a8('0x13'));var Redis=require(_0xa3a8('0x14'));var authService=require(_0xa3a8('0x15'));var qs=require(_0xa3a8('0x16'));var as=require(_0xa3a8('0x17'));var hardwareService=require(_0xa3a8('0x18'));var logger=require(_0xa3a8('0x19'))(_0xa3a8('0x1a'));var utils=require(_0xa3a8('0x1b'));var config=require(_0xa3a8('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0xa3a8('0x1d'))['db'];config[_0xa3a8('0x1e')]=_[_0xa3a8('0x1f')](config['redis'],{'host':_0xa3a8('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3a8('0x1e')]));require('./smsAccount.socket')[_0xa3a8('0x21')](socket);var jayson=require(_0xa3a8('0x22'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x27c2b6,_0x43fc6c,_0x3f7150,_0x5f12ba){return new BPromise(function(_0x832230,_0x3a99e7){var _0x21673e=_0x5f12ba||client;return _0x21673e['request'](_0x27c2b6,_0x3f7150)[_0xa3a8('0x23')](function(_0x45d803){logger[_0xa3a8('0x24')]('SmsAccount,\x20%s,\x20%s',_0x43fc6c,'request\x20sent');logger[_0xa3a8('0x25')](_0xa3a8('0x26'),_0x43fc6c,_0xa3a8('0x27'),JSON[_0xa3a8('0x28')](_0x45d803));if(_0x45d803[_0xa3a8('0x29')]){if(_0x45d803[_0xa3a8('0x29')][_0xa3a8('0x2a')]===0x1f4){logger['error'](_0xa3a8('0x2b'),_0x43fc6c,_0x45d803[_0xa3a8('0x29')]['message']);return _0x3a99e7(_0x45d803[_0xa3a8('0x29')][_0xa3a8('0x2c')]);}logger[_0xa3a8('0x29')](_0xa3a8('0x2b'),_0x43fc6c,_0x45d803[_0xa3a8('0x29')][_0xa3a8('0x2c')]);return _0x832230(_0x45d803[_0xa3a8('0x29')][_0xa3a8('0x2c')]);}else{logger['info'](_0xa3a8('0x2b'),_0x43fc6c,'request\x20sent');_0x832230(_0x45d803[_0xa3a8('0x2d')][_0xa3a8('0x2c')]);}})[_0xa3a8('0x2e')](function(_0x9376f4){logger['error'](_0xa3a8('0x2b'),_0x43fc6c,_0x9376f4);_0x3a99e7(_0x9376f4);});});}function respondWithStatusCode(_0x228069,_0xd18f9b){_0xd18f9b=_0xd18f9b||0xcc;return function(_0x4feaf6){if(_0x4feaf6){return _0x228069['sendStatus'](_0xd18f9b);}return _0x228069[_0xa3a8('0x2f')](_0xd18f9b)['end']();};}function respondWithResult(_0x45fede,_0x5df38d){_0x5df38d=_0x5df38d||0xc8;return function(_0x3428f5){if(_0x3428f5){return _0x45fede[_0xa3a8('0x2f')](_0x5df38d)[_0xa3a8('0x30')](_0x3428f5);}};}function respondWithFilteredResult(_0x27c916,_0x37c1f8){return function(_0x189b42){if(_0x189b42){var _0x4b6d05=_0x189b42[_0xa3a8('0x31')],_0x22c6cf=_0x37c1f8['offset'],_0x48e5e3=_0x37c1f8[_0xa3a8('0x32')]+_0x37c1f8[_0xa3a8('0x33')],_0x329894;if(_0x48e5e3>=_0x4b6d05){_0x48e5e3=_0x4b6d05;_0x329894=0xc8;}else{_0x329894=0xce;}_0x27c916[_0xa3a8('0x2f')](_0x329894);return _0x27c916['set'](_0xa3a8('0x34'),_0x22c6cf+'-'+_0x48e5e3+'/'+_0x4b6d05)[_0xa3a8('0x30')](_0x189b42);}return null;};}function patchUpdates(_0x5da73c){return function(_0x5c9cac){try{jsonpatch[_0xa3a8('0x35')](_0x5c9cac,_0x5da73c,!![]);}catch(_0x131604){return BPromise[_0xa3a8('0x36')](_0x131604);}return _0x5c9cac[_0xa3a8('0x37')]();};}function saveUpdates(_0x1bfbf5,_0x52b9a0){return function(_0xf37155){if(_0xf37155){return _0xf37155[_0xa3a8('0x38')](_0x1bfbf5)[_0xa3a8('0x23')](function(_0x3c1fbc){return _0x3c1fbc;});}return null;};}function removeEntity(_0x11cd82,_0x12e370){return function(_0x214f05){if(_0x214f05){return _0x214f05['destroy']()[_0xa3a8('0x23')](function(){var _0x5e7bef=_0x214f05[_0xa3a8('0x39')]({'plain':!![]});var _0x40017a=_0xa3a8('0x3a');return db[_0xa3a8('0x3b')][_0xa3a8('0x3c')]({'where':{'type':_0x40017a,'resourceId':_0x5e7bef['id']}})[_0xa3a8('0x23')](function(){return _0x214f05;});})[_0xa3a8('0x23')](function(){_0x11cd82[_0xa3a8('0x2f')](0xcc)[_0xa3a8('0x3d')]();});}};}function handleEntityNotFound(_0x42fe35,_0x310d14){return function(_0x414c7e){if(!_0x414c7e){_0x42fe35[_0xa3a8('0x3e')](0x194);}return _0x414c7e;};}function handleError(_0x682ff2,_0x35a7b4){_0x35a7b4=_0x35a7b4||0x1f4;return function(_0x5d263a){logger[_0xa3a8('0x29')](_0x5d263a[_0xa3a8('0x3f')]);if(_0x5d263a[_0xa3a8('0x40')]){delete _0x5d263a[_0xa3a8('0x40')];}_0x682ff2['status'](_0x35a7b4)[_0xa3a8('0x41')](_0x5d263a);};}exports[_0xa3a8('0x42')]=function(_0x30fbea,_0x38f62a){var _0x8151d5={'include':[{'model':db[_0xa3a8('0x43')],'as':'mandatoryDispositionPause'}]},_0x5c5570={},_0x11a134={'count':0x0,'rows':[]};var _0x2d3e49=_[_0xa3a8('0x44')](db[_0xa3a8('0x45')][_0xa3a8('0x46')],function(_0x17ba86){return{'name':_0x17ba86['fieldName'],'type':_0x17ba86[_0xa3a8('0x47')]['key']};});_0x5c5570[_0xa3a8('0x48')]=_[_0xa3a8('0x44')](_0x2d3e49,_0xa3a8('0x40'));_0x5c5570[_0xa3a8('0x49')]=_['keys'](_0x30fbea['query']);_0x5c5570[_0xa3a8('0x4a')]=_[_0xa3a8('0x4b')](_0x5c5570[_0xa3a8('0x48')],_0x5c5570[_0xa3a8('0x49')]);_0x8151d5[_0xa3a8('0x4c')]=_['intersection'](_0x5c5570[_0xa3a8('0x48')],qs['fields'](_0x30fbea[_0xa3a8('0x49')]['fields']));_0x8151d5[_0xa3a8('0x4c')]=_0x8151d5[_0xa3a8('0x4c')]['length']?_0x8151d5[_0xa3a8('0x4c')]:_0x5c5570['model'];if(!_0x30fbea['query'][_0xa3a8('0x4d')](_0xa3a8('0x4e'))){_0x8151d5[_0xa3a8('0x33')]=qs[_0xa3a8('0x33')](_0x30fbea[_0xa3a8('0x49')]['limit']);_0x8151d5[_0xa3a8('0x32')]=qs['offset'](_0x30fbea[_0xa3a8('0x49')][_0xa3a8('0x32')]);}_0x8151d5[_0xa3a8('0x4f')]=qs['sort'](_0x30fbea[_0xa3a8('0x49')]['sort']);_0x8151d5[_0xa3a8('0x50')]=qs['filters'](_['pick'](_0x30fbea[_0xa3a8('0x49')],_0x5c5570[_0xa3a8('0x4a')]),_0x2d3e49);if(_0x30fbea[_0xa3a8('0x49')][_0xa3a8('0x51')]){_0x8151d5[_0xa3a8('0x50')]=_['merge'](_0x8151d5[_0xa3a8('0x50')],{'$or':_[_0xa3a8('0x44')](_0x2d3e49,function(_0x29dbc1){if(_0x29dbc1[_0xa3a8('0x47')]!=='VIRTUAL'){var _0x3bf311={};_0x3bf311[_0x29dbc1['name']]={'$like':'%'+_0x30fbea['query'][_0xa3a8('0x51')]+'%'};return _0x3bf311;}})});}_0x8151d5=_[_0xa3a8('0x52')]({},_0x8151d5,_0x30fbea[_0xa3a8('0x53')]);var _0x49a16c={'where':_0x8151d5[_0xa3a8('0x50')]};return db[_0xa3a8('0x45')][_0xa3a8('0x31')](_0x49a16c)[_0xa3a8('0x23')](function(_0x54e71c){_0x11a134['count']=_0x54e71c;if(_0x30fbea[_0xa3a8('0x49')][_0xa3a8('0x54')]){_0x8151d5['include']=[{'all':!![]}];}return db[_0xa3a8('0x45')][_0xa3a8('0x55')](_0x8151d5);})[_0xa3a8('0x23')](function(_0x869b6){_0x11a134[_0xa3a8('0x56')]=_0x869b6;return _0x11a134;})[_0xa3a8('0x23')](respondWithFilteredResult(_0x38f62a,_0x8151d5))[_0xa3a8('0x2e')](handleError(_0x38f62a,null));};exports[_0xa3a8('0x57')]=function(_0x1965d9,_0x22a1e2){var _0x460dfd={'raw':![],'where':{'id':_0x1965d9[_0xa3a8('0x58')]['id']},'include':[{'model':db[_0xa3a8('0x43')],'as':'mandatoryDispositionPause'}]},_0x4e8791={};_0x4e8791[_0xa3a8('0x48')]=_[_0xa3a8('0x59')](db[_0xa3a8('0x45')]['rawAttributes']);_0x4e8791[_0xa3a8('0x49')]=_[_0xa3a8('0x59')](_0x1965d9['query']);_0x4e8791['filters']=_['intersection'](_0x4e8791[_0xa3a8('0x48')],_0x4e8791['query']);_0x460dfd['attributes']=_['intersection'](_0x4e8791[_0xa3a8('0x48')],qs[_0xa3a8('0x5a')](_0x1965d9[_0xa3a8('0x49')][_0xa3a8('0x5a')]));_0x460dfd['attributes']=_0x460dfd[_0xa3a8('0x4c')][_0xa3a8('0x5b')]?_0x460dfd[_0xa3a8('0x4c')]:_0x4e8791['model'];if(_0x1965d9[_0xa3a8('0x49')][_0xa3a8('0x54')]){_0x460dfd[_0xa3a8('0x5c')]=[{'all':!![]}];}_0x460dfd=_['merge']({},_0x460dfd,_0x1965d9['options']);return db['SmsAccount'][_0xa3a8('0x5d')](_0x460dfd)['then'](handleEntityNotFound(_0x22a1e2,null))[_0xa3a8('0x23')](respondWithResult(_0x22a1e2,null))[_0xa3a8('0x2e')](handleError(_0x22a1e2,null));};exports[_0xa3a8('0x5e')]=function(_0x5b8057,_0xc9ee85){return db[_0xa3a8('0x45')][_0xa3a8('0x5e')](_0x5b8057['body'],{})[_0xa3a8('0x23')](function(_0x2f3534){var _0x3fac24=_0x5b8057[_0xa3a8('0x5f')][_0xa3a8('0x39')]({'plain':!![]});if(!_0x3fac24)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fac24[_0xa3a8('0x60')]===_0xa3a8('0x5f')){var _0x340a90=_0x2f3534[_0xa3a8('0x39')]({'plain':!![]});var _0x92a0dd=_0xa3a8('0x3a');return db[_0xa3a8('0x61')][_0xa3a8('0x5d')]({'where':{'name':_0x92a0dd,'userProfileId':_0x3fac24[_0xa3a8('0x62')]},'raw':!![]})[_0xa3a8('0x23')](function(_0x2eef98){if(_0x2eef98&&_0x2eef98[_0xa3a8('0x63')]===0x0){return db[_0xa3a8('0x3b')][_0xa3a8('0x5e')]({'name':_0x340a90[_0xa3a8('0x40')],'resourceId':_0x340a90['id'],'type':_0x2eef98[_0xa3a8('0x40')],'sectionId':_0x2eef98['id']},{})[_0xa3a8('0x23')](function(){return _0x2f3534;});}else{return _0x2f3534;}})[_0xa3a8('0x2e')](function(_0x753c19){logger['error'](_0xa3a8('0x64'),_0x753c19);throw _0x753c19;});}return _0x2f3534;})[_0xa3a8('0x23')](respondWithResult(_0xc9ee85,0xc9))[_0xa3a8('0x2e')](handleError(_0xc9ee85,null));};exports[_0xa3a8('0x38')]=function(_0x18bcf8,_0x1b2517){if(_0x18bcf8['body']['id']){delete _0x18bcf8[_0xa3a8('0x65')]['id'];}return db[_0xa3a8('0x45')][_0xa3a8('0x5d')]({'where':{'id':_0x18bcf8[_0xa3a8('0x58')]['id']},'include':[{'model':db[_0xa3a8('0x43')],'as':'mandatoryDispositionPause'}]})[_0xa3a8('0x23')](handleEntityNotFound(_0x1b2517,null))[_0xa3a8('0x23')](saveUpdates(_0x18bcf8[_0xa3a8('0x65')],null))[_0xa3a8('0x23')](respondWithResult(_0x1b2517,null))[_0xa3a8('0x2e')](handleError(_0x1b2517,null));};exports[_0xa3a8('0x3c')]=function(_0x19acb6,_0x2d73da){return db[_0xa3a8('0x45')]['find']({'where':{'id':_0x19acb6[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x2d73da,null))[_0xa3a8('0x23')](removeEntity(_0x2d73da,null))[_0xa3a8('0x2e')](handleError(_0x2d73da,null));};exports[_0xa3a8('0x66')]=function(_0x30d3a8,_0x4b98c8){return db[_0xa3a8('0x45')][_0xa3a8('0x66')]()[_0xa3a8('0x23')](respondWithResult(_0x4b98c8,null))['catch'](handleError(_0x4b98c8,null));};exports[_0xa3a8('0x67')]=function(_0x1ad902,_0x112715,_0x4917e6){if(_0x1ad902[_0xa3a8('0x65')]['id']){delete _0x1ad902[_0xa3a8('0x65')]['id'];}return db['SmsAccount'][_0xa3a8('0x5d')]({'where':{'id':_0x1ad902[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x112715,null))[_0xa3a8('0x23')](function(_0x12cc30){if(_0x12cc30){_0x1ad902[_0xa3a8('0x65')][_0xa3a8('0x68')]=_0x12cc30['id'];return db[_0xa3a8('0x69')][_0xa3a8('0x5e')](_0x1ad902[_0xa3a8('0x65')]);}})['then'](respondWithResult(_0x112715,null))[_0xa3a8('0x2e')](handleError(_0x112715,null));};exports[_0xa3a8('0x6a')]=function(_0x53e376,_0x289d13,_0x2180fc){var _0x4d9474={'raw':![],'where':{}};var _0x11e2a2={};var _0x2c214f={'count':0x0,'rows':[]};return db[_0xa3a8('0x45')][_0xa3a8('0x6b')]({'where':{'id':_0x53e376['params']['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x289d13,null))[_0xa3a8('0x23')](function(_0x5e02bc){if(_0x5e02bc){_0x11e2a2[_0xa3a8('0x48')]=_[_0xa3a8('0x59')](db['Disposition'][_0xa3a8('0x46')]);_0x11e2a2[_0xa3a8('0x49')]=_[_0xa3a8('0x59')](_0x53e376[_0xa3a8('0x49')]);_0x11e2a2[_0xa3a8('0x4a')]=_[_0xa3a8('0x4b')](_0x11e2a2['model'],_0x11e2a2[_0xa3a8('0x49')]);_0x4d9474[_0xa3a8('0x4c')]=_[_0xa3a8('0x4b')](_0x11e2a2[_0xa3a8('0x48')],qs[_0xa3a8('0x5a')](_0x53e376['query'][_0xa3a8('0x5a')]));_0x4d9474[_0xa3a8('0x4c')]=_0x4d9474[_0xa3a8('0x4c')]['length']?_0x4d9474[_0xa3a8('0x4c')]:_0x11e2a2[_0xa3a8('0x48')];if(!_0x53e376[_0xa3a8('0x49')][_0xa3a8('0x4d')](_0xa3a8('0x4e'))){_0x4d9474[_0xa3a8('0x33')]=qs[_0xa3a8('0x33')](_0x53e376[_0xa3a8('0x49')]['limit']);_0x4d9474[_0xa3a8('0x32')]=qs[_0xa3a8('0x32')](_0x53e376['query'][_0xa3a8('0x32')]);}_0x4d9474['order']=qs[_0xa3a8('0x6c')](_0x53e376[_0xa3a8('0x49')][_0xa3a8('0x6c')]);_0x4d9474[_0xa3a8('0x50')]=qs['filters'](_[_0xa3a8('0x6d')](_0x53e376[_0xa3a8('0x49')],_0x11e2a2[_0xa3a8('0x4a')]));_0x4d9474['where'][_0xa3a8('0x68')]=_0x5e02bc['id'];if(_0x53e376[_0xa3a8('0x49')][_0xa3a8('0x51')]){_0x4d9474[_0xa3a8('0x50')]=_[_0xa3a8('0x52')](_0x4d9474['where'],{'$or':_[_0xa3a8('0x44')](_0x4d9474[_0xa3a8('0x4c')],function(_0x695a75){var _0x44118c={};_0x44118c[_0x695a75]={'$like':'%'+_0x53e376['query'][_0xa3a8('0x51')]+'%'};return _0x44118c;})});}_0x4d9474=_[_0xa3a8('0x52')]({},_0x4d9474,_0x53e376[_0xa3a8('0x53')]);return db['Disposition']['count']({'where':_0x4d9474[_0xa3a8('0x50')]})[_0xa3a8('0x23')](function(_0x1e1e34){_0x2c214f[_0xa3a8('0x31')]=_0x1e1e34;if(_0x53e376['query']['includeAll']){_0x4d9474[_0xa3a8('0x5c')]=[{'all':!![]}];}return db[_0xa3a8('0x69')]['findAll'](_0x4d9474);})['then'](function(_0x342c4c){_0x2c214f[_0xa3a8('0x56')]=_0x342c4c;return _0x2c214f;});}})[_0xa3a8('0x23')](respondWithFilteredResult(_0x289d13,_0x4d9474))[_0xa3a8('0x2e')](handleError(_0x289d13,null));};exports['removeDispositions']=function(_0x23febf,_0x2f6b10,_0x7bcdf4){return db['SmsAccount'][_0xa3a8('0x5d')]({'where':{'id':_0x23febf[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x2f6b10,null))[_0xa3a8('0x23')](function(_0x2de153){if(_0x2de153){return _0x2de153[_0xa3a8('0x6e')](_0x23febf[_0xa3a8('0x49')]['ids']);}})[_0xa3a8('0x23')](respondWithStatusCode(_0x2f6b10,null))['catch'](handleError(_0x2f6b10,null));};exports[_0xa3a8('0x6f')]=function(_0x212df3,_0x2c5219,_0x4cbb4d){if(_0x212df3[_0xa3a8('0x65')]['id']){delete _0x212df3[_0xa3a8('0x65')]['id'];}return db[_0xa3a8('0x45')][_0xa3a8('0x5d')]({'where':{'id':_0x212df3['params']['id']}})['then'](handleEntityNotFound(_0x2c5219,null))[_0xa3a8('0x23')](function(_0x5bf78c){if(_0x5bf78c){_0x212df3[_0xa3a8('0x65')][_0xa3a8('0x68')]=_0x5bf78c['id'];return db[_0xa3a8('0x70')][_0xa3a8('0x5e')](_0x212df3[_0xa3a8('0x65')]);}})[_0xa3a8('0x23')](respondWithResult(_0x2c5219,null))[_0xa3a8('0x2e')](handleError(_0x2c5219,null));};exports[_0xa3a8('0x71')]=function(_0x134ebb,_0x475319,_0x38e128){var _0x18a56c={'raw':![],'where':{}};var _0xf71546={};var _0x41c083={'count':0x0,'rows':[]};return db[_0xa3a8('0x45')][_0xa3a8('0x6b')]({'where':{'id':_0x134ebb['params']['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x475319,null))[_0xa3a8('0x23')](function(_0x49b28a){if(_0x49b28a){_0xf71546[_0xa3a8('0x48')]=_[_0xa3a8('0x59')](db['CannedAnswer'][_0xa3a8('0x46')]);_0xf71546['query']=_[_0xa3a8('0x59')](_0x134ebb[_0xa3a8('0x49')]);_0xf71546[_0xa3a8('0x4a')]=_['intersection'](_0xf71546[_0xa3a8('0x48')],_0xf71546['query']);_0x18a56c[_0xa3a8('0x4c')]=_[_0xa3a8('0x4b')](_0xf71546['model'],qs['fields'](_0x134ebb[_0xa3a8('0x49')][_0xa3a8('0x5a')]));_0x18a56c['attributes']=_0x18a56c[_0xa3a8('0x4c')][_0xa3a8('0x5b')]?_0x18a56c[_0xa3a8('0x4c')]:_0xf71546[_0xa3a8('0x48')];if(!_0x134ebb[_0xa3a8('0x49')][_0xa3a8('0x4d')](_0xa3a8('0x4e'))){_0x18a56c[_0xa3a8('0x33')]=qs[_0xa3a8('0x33')](_0x134ebb[_0xa3a8('0x49')][_0xa3a8('0x33')]);_0x18a56c['offset']=qs[_0xa3a8('0x32')](_0x134ebb[_0xa3a8('0x49')][_0xa3a8('0x32')]);}_0x18a56c['order']=qs['sort'](_0x134ebb[_0xa3a8('0x49')][_0xa3a8('0x6c')]);_0x18a56c[_0xa3a8('0x50')]=qs[_0xa3a8('0x4a')](_[_0xa3a8('0x6d')](_0x134ebb[_0xa3a8('0x49')],_0xf71546['filters']));_0x18a56c[_0xa3a8('0x50')][_0xa3a8('0x68')]=_0x49b28a['id'];if(_0x134ebb[_0xa3a8('0x49')]['filter']){_0x18a56c[_0xa3a8('0x50')]=_[_0xa3a8('0x52')](_0x18a56c[_0xa3a8('0x50')],{'$or':_[_0xa3a8('0x44')](_0x18a56c[_0xa3a8('0x4c')],function(_0x4b8361){var _0x5ba736={};_0x5ba736[_0x4b8361]={'$like':'%'+_0x134ebb['query'][_0xa3a8('0x51')]+'%'};return _0x5ba736;})});}_0x18a56c=_[_0xa3a8('0x52')]({},_0x18a56c,_0x134ebb[_0xa3a8('0x53')]);return db[_0xa3a8('0x70')]['count']({'where':_0x18a56c[_0xa3a8('0x50')]})[_0xa3a8('0x23')](function(_0x479751){_0x41c083[_0xa3a8('0x31')]=_0x479751;if(_0x134ebb[_0xa3a8('0x49')][_0xa3a8('0x54')]){_0x18a56c['include']=[{'all':!![]}];}return db[_0xa3a8('0x70')][_0xa3a8('0x55')](_0x18a56c);})['then'](function(_0x1acbc2){_0x41c083[_0xa3a8('0x56')]=_0x1acbc2;return _0x41c083;});}})[_0xa3a8('0x23')](respondWithFilteredResult(_0x475319,_0x18a56c))[_0xa3a8('0x2e')](handleError(_0x475319,null));};exports[_0xa3a8('0x72')]=function(_0x183490,_0x5952a7,_0x222c44){return db['SmsAccount']['find']({'where':{'id':_0x183490[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x5952a7,null))[_0xa3a8('0x23')](function(_0x93731c){if(_0x93731c){return _0x93731c['removeAnswers'](_0x183490[_0xa3a8('0x49')][_0xa3a8('0x73')]);}})[_0xa3a8('0x23')](respondWithStatusCode(_0x5952a7,null))[_0xa3a8('0x2e')](handleError(_0x5952a7,null));};exports[_0xa3a8('0x74')]=function(_0x34a250,_0x4534a4,_0x5060c9){var _0x2c60de={'channel':'sms'};var _0x2e35d6=[];var _0xd202d5=[];var _0x24956b={};return db[_0xa3a8('0x45')][_0xa3a8('0x5d')]({'where':{'id':_0x34a250[_0xa3a8('0x58')]['id']},'include':[{'model':db[_0xa3a8('0x75')],'as':_0xa3a8('0x76')}]})[_0xa3a8('0x23')](handleEntityNotFound(_0x4534a4,null))[_0xa3a8('0x23')](function(_0x4ad955){_0x2c60de[_0xa3a8('0x77')]=_0x4ad955;_0x2c60de['applications']=_[_0xa3a8('0x78')](_0x4ad955[_0xa3a8('0x76')],[_0xa3a8('0x79')],[_0xa3a8('0x7a')]);if(_0x2c60de[_0xa3a8('0x77')][_0xa3a8('0x76')]){delete _0x2c60de['account']['Applications'];}return db[_0xa3a8('0x7b')][_0xa3a8('0x66')]();})[_0xa3a8('0x23')](function(_0x140859){if(!_0x140859){throw new db['Sequelize'][(_0xa3a8('0x7c'))](_0xa3a8('0x7d'));}_0x2e35d6=_[_0xa3a8('0x7e')](_[_0xa3a8('0x59')](_0x140859),['createdAt','updatedAt']);_0xd202d5=_[_0xa3a8('0x7e')](_[_0xa3a8('0x59')](_0x140859),['createdAt',_0xa3a8('0x7f'),_0xa3a8('0x80'),_0xa3a8('0x81')]);_0x2c60de[_0xa3a8('0x65')]={'mapKey':_0xa3a8('0x82')};if(_0x2c60de[_0xa3a8('0x77')][_0xa3a8('0x47')]){switch(_0x2c60de['account'][_0xa3a8('0x47')]){case _0xa3a8('0x83'):_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')]=_0x34a250['body']['From'];_0x2c60de['body'][_0xa3a8('0x65')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x85')];_0x2c60de['body'][_0xa3a8('0x86')]=_0x34a250['body'][_0xa3a8('0x87')];break;case _0xa3a8('0x88'):_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')]='+'+_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x89')];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')]=_0x34a250['body'][_0xa3a8('0x8a')];break;case _0xa3a8('0x8b'):_0x2c60de['body'][_0xa3a8('0x84')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x84')];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x2c')];break;case _0xa3a8('0x8c'):_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x84')];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')]=_0x34a250[_0xa3a8('0x65')]['body'];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x86')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x8d')];break;case'plivo':_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')]=_0x34a250[_0xa3a8('0x65')]['From'];_0x2c60de[_0xa3a8('0x65')]['body']=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x8e')];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x86')]=_0x34a250[_0xa3a8('0x65')]['MessageUUID'];break;case'infobip':_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')]='+'+_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x8f')][0x0][_0xa3a8('0x84')];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')]=_0x34a250[_0xa3a8('0x65')]['results'][0x0]['text'];_0x2c60de['body'][_0xa3a8('0x86')]=_0x34a250[_0xa3a8('0x65')]['results'][0x0][_0xa3a8('0x86')];break;case _0xa3a8('0x90'):_0x2c60de['body'][_0xa3a8('0x84')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x91')];_0x2c60de['body'][_0xa3a8('0x65')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x92')][_0xa3a8('0x2c')];break;case _0xa3a8('0x93'):_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')]=_0x34a250['body']['fromNumber'];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x8a')];_0x2c60de['body'][_0xa3a8('0x86')]=_0x34a250['body']['replyMessageId'];break;case'intelepeer':_0x2c60de[_0xa3a8('0x65')]['from']=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x84')];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x2c')];_0x2c60de['body'][_0xa3a8('0x86')]=_0x34a250['body'][_0xa3a8('0x94')];break;}}if(_0x2c60de[_0xa3a8('0x65')]['id']){delete _0x2c60de[_0xa3a8('0x65')]['id'];}if(_[_0xa3a8('0x95')](_0x2c60de['body'][_0xa3a8('0x84')])){throw new db['Sequelize'][(_0xa3a8('0x7c'))](_0xa3a8('0x96'));}if(_[_0xa3a8('0x95')](_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')])||_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')]===''){throw new db[(_0xa3a8('0x97'))][(_0xa3a8('0x7c'))](_0xa3a8('0x98'));}if(_[_0xa3a8('0x95')](_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x99')])){throw new db[(_0xa3a8('0x97'))][(_0xa3a8('0x7c'))](_0xa3a8('0x9a')+_0xd202d5);}if(!_['includes'](_0xd202d5,_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x99')])){throw new db['Sequelize'][(_0xa3a8('0x7c'))](_0xa3a8('0x9b')+_0xd202d5);}_0x24956b[_0x2c60de[_0xa3a8('0x65')]['mapKey']]=_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')];return db[_0xa3a8('0x9c')][_0xa3a8('0x5d')]({'where':{'id':_0x2c60de[_0xa3a8('0x77')][_0xa3a8('0x81')]},'include':[{'model':db['CmContact'],'as':_0xa3a8('0x9d'),'where':_0x24956b,'limit':0x1,'order':[[_0xa3a8('0x7f'),_0xa3a8('0x9e')]]}]});})['then'](handleEntityNotFound(_0x4534a4,null))[_0xa3a8('0x23')](function(_0x1bd773){if(_0x1bd773){_0x2c60de[_0xa3a8('0x9f')]=_[_0xa3a8('0xa0')](_0x1bd773,[_0xa3a8('0x9d')]);if(_0x1bd773[_0xa3a8('0x9d')]['length']){return _0x1bd773[_0xa3a8('0x9d')][0x0];}var _0x38ad67=_['defaults'](_0x2c60de[_0xa3a8('0x65')],{'firstName':_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')],'ListId':_0x1bd773['id']});_0x38ad67[_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x99')]]=_0x2c60de['body'][_0xa3a8('0x84')];return db[_0xa3a8('0x7b')][_0xa3a8('0x5e')](_0x38ad67,{'fields':_0x2e35d6,'raw':!![]});}})['then'](handleEntityNotFound(_0x4534a4,null))[_0xa3a8('0x23')](function(_0x57315a){if(_0x57315a){_0x2c60de['contact']=_0x57315a;var _0x32d0bd={'ContactId':_0x57315a['id'],'phone':_0x2c60de['body'][_0xa3a8('0x84')],'SmsAccountId':_0x34a250[_0xa3a8('0x58')]['id']};var _0x398eb3={'ContactId':_0x57315a['id'],'SmsAccountId':_0x34a250[_0xa3a8('0x58')]['id'],'closed':![]};return db[_0xa3a8('0xa1')][_0xa3a8('0x5d')]({'where':_0x398eb3})[_0xa3a8('0x23')](function(_0x32a888){if(_0x32a888){return[_0x32a888,![]];}return db[_0xa3a8('0xa1')]['create'](_0x32d0bd)['then'](function(_0x1b30cf){return[_0x1b30cf,!![]];});});}})[_0xa3a8('0xa2')](function(_0x237e8a,_0x23db06){_0x2c60de[_0xa3a8('0xa3')]=_0x237e8a['get']({'plain':!![]});_0x2c60de['interaction']['created']=![];if(_0x23db06){if(_0x2c60de['account']['autoclose']){_0x2c60de[_0xa3a8('0xa4')][_0xa3a8('0xa5')]({'id':0x0,'priority':_0x2c60de[_0xa3a8('0xa4')]['length']+0x1,'app':_0xa3a8('0xa6'),'appdata':_0xa3a8('0xa7'),'interval':_0xa3a8('0xa8')});}_0x2c60de[_0xa3a8('0xa3')][_0xa3a8('0xa9')]=!![];}return db[_0xa3a8('0xaa')][_0xa3a8('0x5e')]({'phone':_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')],'messageId':_0x2c60de[_0xa3a8('0x65')]['messageId'],'body':_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')],'SmsAccountId':_0x34a250[_0xa3a8('0x58')]['id'],'SmsInteractionId':_0x237e8a['id'],'direction':'in','ContactId':_0x237e8a[_0xa3a8('0xab')],'AttachmentId':_0x2c60de['body'][_0xa3a8('0xac')]});})[_0xa3a8('0x23')](function(_0x13c02e){_0x2c60de[_0xa3a8('0x2c')]=_0x13c02e;if(_0x2c60de[_0xa3a8('0xa3')][_0xa3a8('0xad')]){return db['User'][_0xa3a8('0x5d')]({'attributes':['id',_0xa3a8('0x40')],'where':{'id':_0x2c60de[_0xa3a8('0xa3')][_0xa3a8('0xad')]}})[_0xa3a8('0x23')](function(_0x2e0843){if(_0x2e0843){_0x2c60de[_0xa3a8('0xa4')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2e0843[_0xa3a8('0x40')]+','+(_0x2c60de['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xa3a8('0xae'),_0xa3a8('0xaf'),_0x2c60de);});}return respondWithRpcPromise(_0xa3a8('0xae'),_0xa3a8('0xaf'),_0x2c60de);})[_0xa3a8('0x23')](function(_0x54ac90){if(_0x54ac90){var _0x2c4e1=0xc8;var _0xc3ce3=_0xa3a8('0xb0');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc3ce3,_0x2c4e1,_0xa3a8('0xb1'));logger[_0xa3a8('0x25')](_0xa3a8('0xb2'),_0xc3ce3,_0x2c4e1,_0xa3a8('0xb1'),JSON[_0xa3a8('0x28')](_0x54ac90));if(_0x2c60de[_0xa3a8('0x77')][_0xa3a8('0x47')]==='twilio'){return _0x4534a4[_0xa3a8('0x2f')](_0x2c4e1)[_0xa3a8('0xb3')](_0xa3a8('0xb4'),_0xa3a8('0xb5'))['send']('\x0a');}else{return _0x4534a4[_0xa3a8('0x2f')](_0x2c4e1)[_0xa3a8('0x30')](_0x54ac90);}}})[_0xa3a8('0x2e')](handleError(_0x4534a4,null));};exports[_0xa3a8('0xb6')]=function(_0xfa0f77,_0x424175,_0x4c2f5e){return db[_0xa3a8('0x45')][_0xa3a8('0x6b')]({'where':{'id':_0xfa0f77['params']['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x424175,null))[_0xa3a8('0x23')](function(_0x3e9c49){if(_0x3e9c49){return db[_0xa3a8('0xb7')]['transaction'](function(_0x95f955){return db[_0xa3a8('0x75')][_0xa3a8('0x3c')]({'where':{'SmsAccountId':_0xfa0f77[_0xa3a8('0x58')]['id']},'transaction':_0x95f955})[_0xa3a8('0x23')](function(_0x40d9d5){var _0x16d30e=_[_0xa3a8('0x44')](_0xfa0f77[_0xa3a8('0x65')],function(_0x255e33){_0x255e33[_0xa3a8('0x68')]=_0xfa0f77[_0xa3a8('0x58')]['id'];return _0x255e33;});return db['SmsApplication'][_0xa3a8('0xb8')](_0x16d30e,{'transaction':_0x95f955});});})[_0xa3a8('0x23')](function(){return db[_0xa3a8('0x75')][_0xa3a8('0xb9')]({'where':{'SmsAccountId':_0xfa0f77[_0xa3a8('0x58')]['id']},'order':_0xa3a8('0x79')});});}})[_0xa3a8('0x23')](respondWithResult(_0x424175,null))[_0xa3a8('0x2e')](handleError(_0x424175,null));};exports['getApplications']=function(_0xad3bad,_0x26bf82,_0x36f0f3){var _0x140a72={};var _0x344ae2={};var _0x4b7a4e;var _0x4e3955;return db[_0xa3a8('0x45')]['findOne']({'where':{'id':_0xad3bad[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x26bf82,null))['then'](function(_0x262f7f){if(_0x262f7f){_0x4b7a4e=_0x262f7f;_0x344ae2['model']=_[_0xa3a8('0x59')](db[_0xa3a8('0x75')][_0xa3a8('0x46')]);_0x344ae2['query']=_[_0xa3a8('0x59')](_0xad3bad[_0xa3a8('0x49')]);_0x344ae2[_0xa3a8('0x4a')]=_[_0xa3a8('0x4b')](_0x344ae2[_0xa3a8('0x48')],_0x344ae2['query']);_0x140a72[_0xa3a8('0x4c')]=_[_0xa3a8('0x4b')](_0x344ae2['model'],qs[_0xa3a8('0x5a')](_0xad3bad['query'][_0xa3a8('0x5a')]));_0x140a72[_0xa3a8('0x4c')]=_0x140a72[_0xa3a8('0x4c')]['length']?_0x140a72[_0xa3a8('0x4c')]:_0x344ae2[_0xa3a8('0x48')];_0x140a72[_0xa3a8('0x4f')]=qs[_0xa3a8('0x6c')](_0xad3bad[_0xa3a8('0x49')][_0xa3a8('0x6c')]);_0x140a72[_0xa3a8('0x50')]=qs['filters'](_[_0xa3a8('0x6d')](_0xad3bad[_0xa3a8('0x49')],_0x344ae2[_0xa3a8('0x4a')]));if(_0xad3bad[_0xa3a8('0x49')][_0xa3a8('0x51')]){_0x140a72[_0xa3a8('0x50')]=_[_0xa3a8('0x52')](_0x140a72['where'],{'$or':_[_0xa3a8('0x44')](_0x140a72[_0xa3a8('0x4c')],function(_0x2c863b){var _0x19036f={};_0x19036f[_0x2c863b]={'$like':'%'+_0xad3bad[_0xa3a8('0x49')][_0xa3a8('0x51')]+'%'};return _0x19036f;})});}_0x140a72=_[_0xa3a8('0x52')]({},_0x140a72,_0xad3bad['options']);return _0x4b7a4e[_0xa3a8('0xba')](_0x140a72);}})[_0xa3a8('0x23')](function(_0x4bf85c){if(_0x4bf85c){_0x4e3955=_0x4bf85c[_0xa3a8('0x5b')];if(!_0xad3bad[_0xa3a8('0x49')][_0xa3a8('0x4d')](_0xa3a8('0x4e'))){_0x140a72[_0xa3a8('0x33')]=qs[_0xa3a8('0x33')](_0xad3bad[_0xa3a8('0x49')][_0xa3a8('0x33')]);_0x140a72[_0xa3a8('0x32')]=qs[_0xa3a8('0x32')](_0xad3bad[_0xa3a8('0x49')]['offset']);}return _0x4b7a4e[_0xa3a8('0xba')](_0x140a72);}})[_0xa3a8('0x23')](function(_0x4a2148){if(_0x4a2148){return _0x4a2148?{'count':_0x4e3955,'rows':_0x4a2148}:null;}})[_0xa3a8('0x23')](respondWithResult(_0x26bf82,null))['catch'](handleError(_0x26bf82,null));};exports['getInteractions']=function(_0x122817,_0x5dcf18,_0x1623ee){var _0x52bc62={'raw':![],'where':{}};var _0x2243f0={};var _0x278cca={'count':0x0,'rows':[]};return db[_0xa3a8('0x45')][_0xa3a8('0x6b')]({'where':{'id':_0x122817[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x5dcf18,null))[_0xa3a8('0x23')](function(_0x1b6038){if(_0x1b6038){_0x2243f0[_0xa3a8('0x48')]=_['keys'](db[_0xa3a8('0xa1')][_0xa3a8('0x46')]);_0x2243f0[_0xa3a8('0x49')]=_[_0xa3a8('0x59')](_0x122817[_0xa3a8('0x49')]);_0x2243f0[_0xa3a8('0x4a')]=_[_0xa3a8('0x4b')](_0x2243f0[_0xa3a8('0x48')],_0x2243f0[_0xa3a8('0x49')]);_0x52bc62[_0xa3a8('0x4c')]=_[_0xa3a8('0x4b')](_0x2243f0['model'],qs['fields'](_0x122817[_0xa3a8('0x49')][_0xa3a8('0x5a')]));_0x52bc62[_0xa3a8('0x4c')]=_0x52bc62['attributes']['length']?_0x52bc62[_0xa3a8('0x4c')]:_0x2243f0[_0xa3a8('0x48')];if(!_0x122817[_0xa3a8('0x49')][_0xa3a8('0x4d')](_0xa3a8('0x4e'))){_0x52bc62['limit']=qs['limit'](_0x122817['query'][_0xa3a8('0x33')]);_0x52bc62[_0xa3a8('0x32')]=qs[_0xa3a8('0x32')](_0x122817[_0xa3a8('0x49')][_0xa3a8('0x32')]);}_0x52bc62[_0xa3a8('0x4f')]=qs['sort'](_0x122817[_0xa3a8('0x49')][_0xa3a8('0x6c')]);_0x52bc62[_0xa3a8('0x50')]=qs[_0xa3a8('0x4a')](_[_0xa3a8('0x6d')](_0x122817['query'],_0x2243f0[_0xa3a8('0x4a')]));_0x52bc62[_0xa3a8('0x50')][_0xa3a8('0x68')]=_0x1b6038['id'];if(_0x122817[_0xa3a8('0x49')]['filter']){_0x52bc62['where']=_['merge'](_0x52bc62[_0xa3a8('0x50')],{'$or':_[_0xa3a8('0x44')](_0x52bc62[_0xa3a8('0x4c')],function(_0x2eb6dc){var _0x3ae86c={};_0x3ae86c[_0x2eb6dc]={'$like':'%'+_0x122817[_0xa3a8('0x49')][_0xa3a8('0x51')]+'%'};return _0x3ae86c;})});}_0x52bc62=_['merge']({},_0x52bc62,_0x122817[_0xa3a8('0x53')]);return db[_0xa3a8('0xa1')]['count']({'where':_0x52bc62[_0xa3a8('0x50')]})['then'](function(_0x324b8c){_0x278cca[_0xa3a8('0x31')]=_0x324b8c;if(_0x122817[_0xa3a8('0x49')][_0xa3a8('0x54')]){_0x52bc62[_0xa3a8('0x5c')]=[{'model':db[_0xa3a8('0x7b')],'as':_0xa3a8('0xbb'),'required':![]},{'model':db['User'],'as':_0xa3a8('0xbc'),'attributes':[_0xa3a8('0x40'),_0xa3a8('0xbd'),_0xa3a8('0xbe')],'required':![]},{'model':db[_0xa3a8('0xbf')],'as':_0xa3a8('0xc0'),'attributes':['id',_0xa3a8('0x40'),_0xa3a8('0xc1')],'where':_0x122817[_0xa3a8('0x49')]['tag']?{'id':_0x122817['query']['tag']}:undefined,'required':_0x122817[_0xa3a8('0x49')][_0xa3a8('0xc2')]?!![]:![]}];}return db[_0xa3a8('0xa1')][_0xa3a8('0x55')](_0x52bc62);})[_0xa3a8('0x23')](function(_0x49d8db){_0x278cca[_0xa3a8('0x56')]=_0x49d8db;return _0x278cca;});}})[_0xa3a8('0x23')](respondWithFilteredResult(_0x5dcf18,_0x52bc62))[_0xa3a8('0x2e')](handleError(_0x5dcf18,null));};exports[_0xa3a8('0x41')]=function(_0x495de8,_0x5e7dd1,_0x31b061){var _0x140440,_0x575482,_0x202079;if(_['isNil'](_0x495de8['body'][_0xa3a8('0x65')])||_0x495de8['body'][_0xa3a8('0x65')]===''){throw new db[(_0xa3a8('0x97'))][(_0xa3a8('0x7c'))](_0xa3a8('0x98'));}if(_[_0xa3a8('0x95')](_0x495de8[_0xa3a8('0x65')]['to'])){throw new db['Sequelize'][(_0xa3a8('0x7c'))]('to\x20is\x20mandatory');}_0x140440=_0x495de8[_0xa3a8('0x65')]['to'];return db[_0xa3a8('0x45')][_0xa3a8('0x5d')]({'where':{'id':_0x495de8[_0xa3a8('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xa3a8('0xc3'),'include':[{'model':db[_0xa3a8('0x7b')],'as':'Contacts','where':{'mobile':_0x140440},'limit':0x1,'order':[[_0xa3a8('0x7f'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x5e7dd1,null))['then'](function(_0xb04135){if(_0xb04135&&_0xb04135[_0xa3a8('0xc3')]){_0x575482=_0xb04135[_0xa3a8('0x39')]({'plain':!![]});if(_0x575482[_0xa3a8('0xc3')]&&_0x575482['List'][_0xa3a8('0x9d')]['length']){return _0x575482[_0xa3a8('0xc3')][_0xa3a8('0x9d')][0x0];}return db['CmContact'][_0xa3a8('0x5e')](_[_0xa3a8('0x1f')](_0x495de8['body'],{'firstName':_0x140440,'mobile':_0x140440,'phone':_0x140440,'ListId':_0x575482['ListId']}));}})['then'](handleEntityNotFound(_0x5e7dd1,null))['then'](function(_0x52f5b0){if(_0x52f5b0){_0x202079=_0x52f5b0;return db['SmsInteraction'][_0xa3a8('0x5d')]({'where':{'ContactId':_0x202079['id'],'closed':![],'SmsAccountId':_0x575482['id']}})[_0xa3a8('0x23')](function(_0x2fb555){if(_0x2fb555){return[_0x2fb555,![]];}return db[_0xa3a8('0xa1')]['create']({'UserId':_0x495de8[_0xa3a8('0x5f')]['id'],'ContactId':_0x202079['id'],'SmsAccountId':_0x575482['id'],'phone':_0x140440,'firstMsgDirection':'out','Messages':[_[_0xa3a8('0x52')](_0x495de8[_0xa3a8('0x65')],{'read':![],'body':_0x495de8[_0xa3a8('0x65')][_0xa3a8('0x65')],'phone':_0x140440,'SmsAccountId':_0x575482['id'],'UserId':_0x495de8[_0xa3a8('0x5f')]['id'],'ContactId':_0x202079['id']})]},{'include':[{'model':db[_0xa3a8('0xaa')],'as':_0xa3a8('0xc4')}]})[_0xa3a8('0x23')](function(_0x129fb7){return[_0x129fb7,!![]];});});}})['spread'](function(_0x23ca24,_0x1e13a4){if(_0x1e13a4){return _0x23ca24;}return db['SmsMessage'][_0xa3a8('0x5e')](_[_0xa3a8('0x52')](_0x495de8['body'],{'read':![],'body':_0x495de8[_0xa3a8('0x65')][_0xa3a8('0x65')],'phone':_0x140440,'SmsAccountId':_0x575482['id'],'SmsInteractionId':_0x23ca24['id'],'UserId':_0x495de8[_0xa3a8('0x5f')]['id'],'ContactId':_0x202079['id']}))[_0xa3a8('0x23')](function(_0x3ec193){_0x23ca24[_0xa3a8('0xc5')]['Messages']=[];_0x23ca24['dataValues'][_0xa3a8('0xc4')]['push'](_0x3ec193[_0xa3a8('0xc5')]);return _0x23ca24;});})[_0xa3a8('0x23')](respondWithResult(_0x5e7dd1,null))[_0xa3a8('0x2e')](handleError(_0x5e7dd1,null));};exports['status']=function(_0x400e5f,_0x231a51,_0x49a059){if(_0x400e5f[_0xa3a8('0x65')]['id']){delete _0x400e5f['body']['id'];}console[_0xa3a8('0xc6')](_0xa3a8('0xc7'),_0x400e5f['body']);var _0x20914d,_0x281b85,_0x16ccbd;return db['SmsAccount']['find']({'where':{'id':_0x400e5f[_0xa3a8('0x58')]['id']}})['then'](handleEntityNotFound(_0x231a51,null))['then'](function(_0x24db46){if(_0x24db46){_0x16ccbd=_0x24db46;logger[_0xa3a8('0x25')](_0xa3a8('0x26'),'status',_0xa3a8('0xc8'),_0x24db46[_0xa3a8('0x47')],util[_0xa3a8('0xc9')](_0x400e5f[_0xa3a8('0x65')],{'showHidden':![],'depth':null}));switch(_0x24db46[_0xa3a8('0x47')]){case _0xa3a8('0x88'):if(_0x400e5f[_0xa3a8('0x65')]['skebby_dispatch_id']&&_0x400e5f[_0xa3a8('0x65')]['status']){_0x281b85=_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0x2f')];return db[_0xa3a8('0xaa')][_0xa3a8('0x5d')]({'where':{'messageId':_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0xca')]}});}break;case _0xa3a8('0x8b'):if(_0x400e5f[_0xa3a8('0x65')]['requestid']&&_0x400e5f['body'][_0xa3a8('0xcb')]){_0x281b85=_0x400e5f[_0xa3a8('0x65')]['statusInt'];return db['SmsMessage'][_0xa3a8('0x5d')]({'where':{'messageId':_0x400e5f['body'][_0xa3a8('0xcc')]}});}break;case'clicksend':if(_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0x8d')]&&_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0xcd')]){_0x281b85=_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0xcd')];return db['SmsMessage'][_0xa3a8('0x5d')]({'where':{'messageId':_0x400e5f['body'][_0xa3a8('0x8d')]}});}break;case _0xa3a8('0xce'):var _0x2e5349=_0x400e5f[_0xa3a8('0x65')]['results'][0x0];if(_0x2e5349['messageId']&&_0x2e5349[_0xa3a8('0x2f')]['groupName']===_0xa3a8('0xcf')){_0x281b85=_0x2e5349[_0xa3a8('0x2f')]['groupName'];return db[_0xa3a8('0xaa')][_0xa3a8('0x5d')]({'where':{'messageId':_0x2e5349[_0xa3a8('0x86')]}});}break;case _0xa3a8('0x93'):if(_0x400e5f[_0xa3a8('0x65')]['messageId']&&_0x400e5f['body'][_0xa3a8('0x2f')]){_0x281b85=_0x400e5f['body'][_0xa3a8('0x2f')];return db[_0xa3a8('0xaa')][_0xa3a8('0x5d')]({'where':{'messageId':_0x400e5f['body'][_0xa3a8('0x86')]}});}break;case _0xa3a8('0xd0'):if(_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0xd1')]&&_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0x2f')]){_0x281b85=_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0x2f')];return db[_0xa3a8('0xaa')][_0xa3a8('0x5d')]({'where':{'messageId':_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0xd1')]}});}break;}}})[_0xa3a8('0x23')](handleEntityNotFound(_0x231a51,null))[_0xa3a8('0x23')](function(_0x3942c2){if(_0x3942c2){_0x20914d=_0x3942c2;switch(_0x16ccbd[_0xa3a8('0x47')]){case _0xa3a8('0x88'):if(_0x281b85===_0xa3a8('0xcf')){return _0x20914d[_0xa3a8('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa3a8('0x2f'),'skebby',util[_0xa3a8('0xc9')](_0x400e5f[_0xa3a8('0x65')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x281b85==='1'){return _0x20914d[_0xa3a8('0x38')]({'read':!![]});}else{logger[_0xa3a8('0x29')](_0xa3a8('0x26'),'status','skebby',util[_0xa3a8('0xc9')](_0x400e5f['body'],{'showHidden':![],'depth':null}));}break;case _0xa3a8('0x8c'):if(!_0x400e5f[_0xa3a8('0x65')]['error_code']&&_0x281b85>=0xc8&&_0x281b85<=0xce){return _0x20914d[_0xa3a8('0x38')]({'read':!![]});}else{logger[_0xa3a8('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa3a8('0x2f'),_0xa3a8('0x8c'),util['inspect'](_0x400e5f['body'],{'showHidden':![],'depth':null}));}break;case _0xa3a8('0xce'):var _0x3b6fb8=_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0x8f')][0x0];if(_0x3b6fb8[_0xa3a8('0x2f')][_0xa3a8('0xd2')]===_0xa3a8('0xcf')){return _0x20914d[_0xa3a8('0x38')]({'read':!![]});}else{logger[_0xa3a8('0x29')](_0xa3a8('0x26'),_0xa3a8('0x2f'),_0xa3a8('0xce'),util[_0xa3a8('0xc9')](_0x400e5f[_0xa3a8('0x65')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x281b85=='DELIVERED_TO_GATEWAY'||_0x281b85==_0xa3a8('0xd3')){return _0x20914d['update']({'read':!![]});}else{logger['error'](_0xa3a8('0x26'),_0xa3a8('0x2f'),_0xa3a8('0x93'),util[_0xa3a8('0xc9')](_0x400e5f['body'],{'showHidden':![],'depth':null}));}break;case _0xa3a8('0xd0'):if(_0x281b85===_0xa3a8('0xd4')||_0x281b85===_0xa3a8('0xd5')){return _0x20914d['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa3a8('0x2f'),_0xa3a8('0xd0'),util[_0xa3a8('0xc9')](_0x400e5f['body'],{'showHidden':![],'depth':null}));}break;}return _0x20914d;}})[_0xa3a8('0x23')](respondWithResult(_0x231a51,null))[_0xa3a8('0x2e')](handleError(_0x231a51,null));};exports[_0xa3a8('0xd6')]=function(_0x434b71,_0x5f3cad,_0x37829f){var _0x5eb451,_0x13283b,_0x8d0448;return db['SmsAccount'][_0xa3a8('0x5d')]({'where':{'id':_0x434b71[_0xa3a8('0x58')]['id']}})['then'](handleEntityNotFound(_0x5f3cad,null))[_0xa3a8('0x23')](function(_0x2b651e){if(_0x2b651e){_0x8d0448=_0x2b651e;logger[_0xa3a8('0x25')](_0xa3a8('0x26'),_0xa3a8('0x2f'),_0xa3a8('0xc8'),_0x2b651e['type'],util['inspect'](_0x434b71[_0xa3a8('0x49')],{'showHidden':![],'depth':null}));switch(_0x2b651e[_0xa3a8('0x47')]){case _0xa3a8('0x90'):if(_0x434b71[_0xa3a8('0x49')]['message-id']&&_0x434b71[_0xa3a8('0x49')][_0xa3a8('0xd7')]){_0x13283b=_0x434b71[_0xa3a8('0x49')][_0xa3a8('0xd7')];return db[_0xa3a8('0xaa')]['find']({'where':{'messageId':_0x434b71[_0xa3a8('0x49')][_0xa3a8('0xd8')]}});}break;}}})[_0xa3a8('0x23')](handleEntityNotFound(_0x5f3cad,null))['then'](function(_0x5333f8){if(_0x5333f8){_0x5eb451=_0x5333f8;switch(_0x8d0448['type']){case _0xa3a8('0x90'):if(_0x13283b==='2'||_0x13283b==='6'){return _0x5eb451[_0xa3a8('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa3a8('0x2f'),_0xa3a8('0x90'),util[_0xa3a8('0xc9')](_0x434b71[_0xa3a8('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x5eb451;}})[_0xa3a8('0x23')](respondWithResult(_0x5f3cad,null))['catch'](handleError(_0x5f3cad,null));};exports[_0xa3a8('0xd9')]=function(_0x4d74fe,_0x325398,_0x329424){return db[_0xa3a8('0x45')][_0xa3a8('0x5d')]({'where':{'id':_0x4d74fe[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x325398,null))[_0xa3a8('0x23')](function(_0x3287ab){if(_0x3287ab){return _0x3287ab['addAgents'](_0x4d74fe['body'][_0xa3a8('0x73')],_[_0xa3a8('0xa0')](_0x4d74fe[_0xa3a8('0x65')],[_0xa3a8('0x73'),'id'])||{})[_0xa3a8('0xa2')](function(_0x2a8b51){for(var _0x888b0e=0x0;_0x888b0e<_0x4d74fe[_0xa3a8('0x65')][_0xa3a8('0x73')][_0xa3a8('0x5b')];_0x888b0e+=0x1){socket['emit'](_0xa3a8('0xda'),{'UserId':_0x4d74fe[_0xa3a8('0x65')][_0xa3a8('0x73')][_0x888b0e],'SmsAccountId':_0x4d74fe[_0xa3a8('0x58')]['id']});}return _0x2a8b51;});}})['then'](respondWithResult(_0x325398,null))['catch'](handleError(_0x325398,null));};exports[_0xa3a8('0xdb')]=function(_0x3ea613,_0x450044,_0x1a7a54){return db[_0xa3a8('0x45')]['find']({'where':{'id':_0x3ea613[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x450044,null))[_0xa3a8('0x23')](function(_0x14bb1a){if(_0x14bb1a){return _0x14bb1a[_0xa3a8('0xdb')](_0x3ea613[_0xa3a8('0x49')][_0xa3a8('0x73')])[_0xa3a8('0x23')](function(){if(_[_0xa3a8('0xdc')](_0x3ea613[_0xa3a8('0x49')]['ids'])){for(var _0x1c1abb=0x0;_0x1c1abb<_0x3ea613[_0xa3a8('0x49')]['ids'][_0xa3a8('0x5b')];_0x1c1abb+=0x1){socket[_0xa3a8('0xdd')](_0xa3a8('0xde'),{'UserId':Number(_0x3ea613['query'][_0xa3a8('0x73')][_0x1c1abb]),'SmsAccountId':Number(_0x3ea613['params']['id'])});}}else{socket[_0xa3a8('0xdd')](_0xa3a8('0xde'),{'UserId':Number(_0x3ea613[_0xa3a8('0x49')]['ids']),'SmsAccountId':Number(_0x3ea613['params']['id'])});}});}})[_0xa3a8('0x23')](respondWithStatusCode(_0x450044,null))[_0xa3a8('0x2e')](handleError(_0x450044,null));};exports[_0xa3a8('0xdf')]=function(_0x82cd57,_0x5dfa66,_0xc279fd){var _0x2ff993={};var _0x43d4fc={};var _0xd379a6;var _0x4466c5;return db[_0xa3a8('0x45')][_0xa3a8('0x6b')]({'where':{'id':_0x82cd57[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x5dfa66,null))['then'](function(_0x552514){if(_0x552514){_0xd379a6=_0x552514;_0x43d4fc[_0xa3a8('0x48')]=_[_0xa3a8('0x59')](db[_0xa3a8('0xe0')]['rawAttributes']);_0x43d4fc[_0xa3a8('0x49')]=_[_0xa3a8('0x59')](_0x82cd57[_0xa3a8('0x49')]);_0x43d4fc['filters']=_[_0xa3a8('0x4b')](_0x43d4fc[_0xa3a8('0x48')],_0x43d4fc[_0xa3a8('0x49')]);_0x2ff993[_0xa3a8('0x4c')]=_[_0xa3a8('0x4b')](_0x43d4fc[_0xa3a8('0x48')],qs[_0xa3a8('0x5a')](_0x82cd57['query'][_0xa3a8('0x5a')]));_0x2ff993[_0xa3a8('0x4c')]=_0x2ff993[_0xa3a8('0x4c')][_0xa3a8('0x5b')]?_0x2ff993[_0xa3a8('0x4c')]:_0x43d4fc['model'];_0x2ff993[_0xa3a8('0x4f')]=qs[_0xa3a8('0x6c')](_0x82cd57[_0xa3a8('0x49')][_0xa3a8('0x6c')]);_0x2ff993[_0xa3a8('0x50')]=qs[_0xa3a8('0x4a')](_[_0xa3a8('0x6d')](_0x82cd57['query'],_0x43d4fc[_0xa3a8('0x4a')]));if(_0x82cd57[_0xa3a8('0x49')][_0xa3a8('0x51')]){_0x2ff993['where']=_[_0xa3a8('0x52')](_0x2ff993[_0xa3a8('0x50')],{'$or':_[_0xa3a8('0x44')](_0x2ff993[_0xa3a8('0x4c')],function(_0x1974e6){var _0x490b7b={};_0x490b7b[_0x1974e6]={'$like':'%'+_0x82cd57['query'][_0xa3a8('0x51')]+'%'};return _0x490b7b;})});}_0x2ff993=_[_0xa3a8('0x52')]({},_0x2ff993,_0x82cd57[_0xa3a8('0x53')]);return _0xd379a6[_0xa3a8('0xdf')](_0x2ff993);}})[_0xa3a8('0x23')](function(_0x117612){if(_0x117612){_0x4466c5=_0x117612[_0xa3a8('0x5b')];if(!_0x82cd57['query']['hasOwnProperty'](_0xa3a8('0x4e'))){_0x2ff993[_0xa3a8('0x33')]=qs[_0xa3a8('0x33')](_0x82cd57[_0xa3a8('0x49')][_0xa3a8('0x33')]);_0x2ff993[_0xa3a8('0x32')]=qs[_0xa3a8('0x32')](_0x82cd57[_0xa3a8('0x49')][_0xa3a8('0x32')]);}return _0xd379a6['getAgents'](_0x2ff993);}})['then'](function(_0x53472a){if(_0x53472a){return _0x53472a?{'count':_0x4466c5,'rows':_0x53472a}:null;}})[_0xa3a8('0x23')](respondWithResult(_0x5dfa66,null))['catch'](handleError(_0x5dfa66,null));}; \ No newline at end of file +var _0x33a7=['keys','intersection','attributes','hasOwnProperty','limit','offset','order','sort','filters','pick','filter','where','VIRTUAL','includeAll','findAll','rows','show','params','Pause','fields','length','include','merge','options','find','body','user','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','Applications','account','orderBy','priority','asc','Sequelize','difference','createdAt','updatedAt','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','text','connectel','clicksend','message_id','plivo','From','Text','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','intelepeer','refid','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','interaction','created','autoclose','applications','close','ContactId','AttachmentId','UserId','User','unshift','agent','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','List','out','SmsMessage','Messages','spread','dataValues','push','log','endpoint\x20/status\x20POST\x20/','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','clickatell','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','DELIVRD','ACCEPTD','received\x20delivery\x20report\x20from','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./smsAccount.socket','register','jayson/promise','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','set','apply','reject','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x1df470,_0x43cff9){var _0x277849=function(_0x164f32){while(--_0x164f32){_0x1df470['push'](_0x1df470['shift']());}};_0x277849(++_0x43cff9);}(_0x33a7,0x17d));var _0x733a=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x33a7[_0x5d1044];return _0x3cd90e;};'use strict';var pdf=require(_0x733a('0x0'));var emlformat=require(_0x733a('0x1'));var rimraf=require(_0x733a('0x2'));var zipdir=require(_0x733a('0x3'));var jsonpatch=require(_0x733a('0x4'));var rp=require(_0x733a('0x5'));var moment=require('moment');var BPromise=require(_0x733a('0x6'));var Mustache=require(_0x733a('0x7'));var util=require(_0x733a('0x8'));var path=require('path');var sox=require(_0x733a('0x9'));var csv=require(_0x733a('0xa'));var ejs=require(_0x733a('0xb'));var fs=require('fs');var _=require(_0x733a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x733a('0xd'));var toCsv=require(_0x733a('0xa'));var querystring=require(_0x733a('0xe'));var Papa=require(_0x733a('0xf'));var Redis=require(_0x733a('0x10'));var authService=require(_0x733a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x733a('0x12'));var hardwareService=require(_0x733a('0x13'));var logger=require(_0x733a('0x14'))('api');var utils=require(_0x733a('0x15'));var config=require(_0x733a('0x16'));var licenseUtil=require(_0x733a('0x17'));var db=require(_0x733a('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x733a('0x19'),'port':0x18eb});var socket=require(_0x733a('0x1a'))(new Redis(config[_0x733a('0x1b')]));require(_0x733a('0x1c'))[_0x733a('0x1d')](socket);var jayson=require(_0x733a('0x1e'));var client=jayson['client'][_0x733a('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x27f1f3,_0x578eca,_0x5a2791,_0xe46946){return new BPromise(function(_0x448d7d,_0x53a04c){var _0xa445ef=_0xe46946||client;return _0xa445ef['request'](_0x27f1f3,_0x5a2791)[_0x733a('0x20')](function(_0x2d526d){logger[_0x733a('0x21')](_0x733a('0x22'),_0x578eca,_0x733a('0x23'));logger[_0x733a('0x24')](_0x733a('0x25'),_0x578eca,_0x733a('0x23'),JSON[_0x733a('0x26')](_0x2d526d));if(_0x2d526d['error']){if(_0x2d526d[_0x733a('0x27')]['code']===0x1f4){logger[_0x733a('0x27')]('SmsAccount,\x20%s,\x20%s',_0x578eca,_0x2d526d[_0x733a('0x27')][_0x733a('0x28')]);return _0x53a04c(_0x2d526d[_0x733a('0x27')][_0x733a('0x28')]);}logger['error'](_0x733a('0x22'),_0x578eca,_0x2d526d[_0x733a('0x27')]['message']);return _0x448d7d(_0x2d526d[_0x733a('0x27')][_0x733a('0x28')]);}else{logger[_0x733a('0x21')](_0x733a('0x22'),_0x578eca,_0x733a('0x23'));_0x448d7d(_0x2d526d[_0x733a('0x29')]['message']);}})[_0x733a('0x2a')](function(_0x5a1e91){logger[_0x733a('0x27')](_0x733a('0x22'),_0x578eca,_0x5a1e91);_0x53a04c(_0x5a1e91);});});}function respondWithStatusCode(_0x2405ff,_0x47fcf6){_0x47fcf6=_0x47fcf6||0xcc;return function(_0x59c28f){if(_0x59c28f){return _0x2405ff[_0x733a('0x2b')](_0x47fcf6);}return _0x2405ff[_0x733a('0x2c')](_0x47fcf6)[_0x733a('0x2d')]();};}function respondWithResult(_0x434ba6,_0xcdd2ed){_0xcdd2ed=_0xcdd2ed||0xc8;return function(_0x411389){if(_0x411389){return _0x434ba6[_0x733a('0x2c')](_0xcdd2ed)[_0x733a('0x2e')](_0x411389);}};}function respondWithFilteredResult(_0x673c88,_0x2fd784){return function(_0x576152){if(_0x576152){var _0x143924=_0x576152[_0x733a('0x2f')],_0x5f1dc4=_0x2fd784['offset'],_0x8e2e4=_0x2fd784['offset']+_0x2fd784['limit'],_0x3ec1df;if(_0x8e2e4>=_0x143924){_0x8e2e4=_0x143924;_0x3ec1df=0xc8;}else{_0x3ec1df=0xce;}_0x673c88[_0x733a('0x2c')](_0x3ec1df);return _0x673c88[_0x733a('0x30')]('Content-Range',_0x5f1dc4+'-'+_0x8e2e4+'/'+_0x143924)[_0x733a('0x2e')](_0x576152);}return null;};}function patchUpdates(_0x25e65a){return function(_0xa8987d){try{jsonpatch[_0x733a('0x31')](_0xa8987d,_0x25e65a,!![]);}catch(_0x5c7c33){return BPromise[_0x733a('0x32')](_0x5c7c33);}return _0xa8987d['save']();};}function saveUpdates(_0x1c622d,_0x150991){return function(_0x334386){if(_0x334386){return _0x334386[_0x733a('0x33')](_0x1c622d)[_0x733a('0x20')](function(_0x3c6856){return _0x3c6856;});}return null;};}function removeEntity(_0x5bb3c3,_0x42bc9a){return function(_0xc9723e){if(_0xc9723e){return _0xc9723e[_0x733a('0x34')]()[_0x733a('0x20')](function(){var _0x5b2f3a=_0xc9723e[_0x733a('0x35')]({'plain':!![]});var _0x80f30a=_0x733a('0x36');return db[_0x733a('0x37')][_0x733a('0x34')]({'where':{'type':_0x80f30a,'resourceId':_0x5b2f3a['id']}})[_0x733a('0x20')](function(){return _0xc9723e;});})[_0x733a('0x20')](function(){_0x5bb3c3[_0x733a('0x2c')](0xcc)[_0x733a('0x2d')]();});}};}function handleEntityNotFound(_0x45b2e9,_0x276039){return function(_0xab3135){if(!_0xab3135){_0x45b2e9[_0x733a('0x2b')](0x194);}return _0xab3135;};}function handleError(_0x154774,_0x4e8001){_0x4e8001=_0x4e8001||0x1f4;return function(_0x22a845){logger['error'](_0x22a845[_0x733a('0x38')]);if(_0x22a845[_0x733a('0x39')]){delete _0x22a845[_0x733a('0x39')];}_0x154774[_0x733a('0x2c')](_0x4e8001)[_0x733a('0x3a')](_0x22a845);};}exports[_0x733a('0x3b')]=function(_0x1634d7,_0x5a3175){var _0x26c89e={'include':[{'model':db['Pause'],'as':_0x733a('0x3c')}]},_0x89db86={},_0x429dd3={'count':0x0,'rows':[]};var _0x57657e=_['map'](db[_0x733a('0x3d')][_0x733a('0x3e')],function(_0x6777c8){return{'name':_0x6777c8[_0x733a('0x3f')],'type':_0x6777c8[_0x733a('0x40')][_0x733a('0x41')]};});_0x89db86[_0x733a('0x42')]=_[_0x733a('0x43')](_0x57657e,'name');_0x89db86[_0x733a('0x44')]=_[_0x733a('0x45')](_0x1634d7[_0x733a('0x44')]);_0x89db86['filters']=_[_0x733a('0x46')](_0x89db86[_0x733a('0x42')],_0x89db86[_0x733a('0x44')]);_0x26c89e['attributes']=_['intersection'](_0x89db86['model'],qs['fields'](_0x1634d7[_0x733a('0x44')]['fields']));_0x26c89e[_0x733a('0x47')]=_0x26c89e[_0x733a('0x47')]['length']?_0x26c89e[_0x733a('0x47')]:_0x89db86['model'];if(!_0x1634d7[_0x733a('0x44')][_0x733a('0x48')]('nolimit')){_0x26c89e[_0x733a('0x49')]=qs[_0x733a('0x49')](_0x1634d7[_0x733a('0x44')][_0x733a('0x49')]);_0x26c89e[_0x733a('0x4a')]=qs[_0x733a('0x4a')](_0x1634d7['query']['offset']);}_0x26c89e[_0x733a('0x4b')]=qs[_0x733a('0x4c')](_0x1634d7[_0x733a('0x44')][_0x733a('0x4c')]);_0x26c89e['where']=qs[_0x733a('0x4d')](_[_0x733a('0x4e')](_0x1634d7[_0x733a('0x44')],_0x89db86[_0x733a('0x4d')]),_0x57657e);if(_0x1634d7['query'][_0x733a('0x4f')]){_0x26c89e['where']=_['merge'](_0x26c89e[_0x733a('0x50')],{'$or':_[_0x733a('0x43')](_0x57657e,function(_0x1f477b){if(_0x1f477b[_0x733a('0x40')]!==_0x733a('0x51')){var _0x5857e1={};_0x5857e1[_0x1f477b['name']]={'$like':'%'+_0x1634d7[_0x733a('0x44')][_0x733a('0x4f')]+'%'};return _0x5857e1;}})});}_0x26c89e=_['merge']({},_0x26c89e,_0x1634d7['options']);var _0x3136e0={'where':_0x26c89e[_0x733a('0x50')]};return db['SmsAccount'][_0x733a('0x2f')](_0x3136e0)[_0x733a('0x20')](function(_0x5e39c3){_0x429dd3['count']=_0x5e39c3;if(_0x1634d7[_0x733a('0x44')][_0x733a('0x52')]){_0x26c89e['include']=[{'all':!![]}];}return db[_0x733a('0x3d')][_0x733a('0x53')](_0x26c89e);})[_0x733a('0x20')](function(_0x4036ed){_0x429dd3[_0x733a('0x54')]=_0x4036ed;return _0x429dd3;})[_0x733a('0x20')](respondWithFilteredResult(_0x5a3175,_0x26c89e))['catch'](handleError(_0x5a3175,null));};exports[_0x733a('0x55')]=function(_0x1eb276,_0x4703b2){var _0x4c7d76={'raw':![],'where':{'id':_0x1eb276[_0x733a('0x56')]['id']},'include':[{'model':db[_0x733a('0x57')],'as':_0x733a('0x3c')}]},_0x408a06={};_0x408a06['model']=_[_0x733a('0x45')](db['SmsAccount']['rawAttributes']);_0x408a06[_0x733a('0x44')]=_[_0x733a('0x45')](_0x1eb276['query']);_0x408a06[_0x733a('0x4d')]=_[_0x733a('0x46')](_0x408a06[_0x733a('0x42')],_0x408a06[_0x733a('0x44')]);_0x4c7d76[_0x733a('0x47')]=_[_0x733a('0x46')](_0x408a06[_0x733a('0x42')],qs[_0x733a('0x58')](_0x1eb276[_0x733a('0x44')][_0x733a('0x58')]));_0x4c7d76[_0x733a('0x47')]=_0x4c7d76['attributes'][_0x733a('0x59')]?_0x4c7d76[_0x733a('0x47')]:_0x408a06[_0x733a('0x42')];if(_0x1eb276[_0x733a('0x44')][_0x733a('0x52')]){_0x4c7d76[_0x733a('0x5a')]=[{'all':!![]}];}_0x4c7d76=_[_0x733a('0x5b')]({},_0x4c7d76,_0x1eb276[_0x733a('0x5c')]);return db['SmsAccount'][_0x733a('0x5d')](_0x4c7d76)['then'](handleEntityNotFound(_0x4703b2,null))[_0x733a('0x20')](respondWithResult(_0x4703b2,null))['catch'](handleError(_0x4703b2,null));};exports['create']=function(_0x582476,_0x4230e9){return db[_0x733a('0x3d')]['create'](_0x582476[_0x733a('0x5e')],{})[_0x733a('0x20')](function(_0x44751f){var _0xeac0c1=_0x582476[_0x733a('0x5f')][_0x733a('0x35')]({'plain':!![]});if(!_0xeac0c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xeac0c1['role']===_0x733a('0x5f')){var _0x409035=_0x44751f['get']({'plain':!![]});var _0x17d173=_0x733a('0x36');return db[_0x733a('0x60')][_0x733a('0x5d')]({'where':{'name':_0x17d173,'userProfileId':_0xeac0c1['userProfileId']},'raw':!![]})[_0x733a('0x20')](function(_0x4ba748){if(_0x4ba748&&_0x4ba748['autoAssociation']===0x0){return db[_0x733a('0x37')][_0x733a('0x61')]({'name':_0x409035[_0x733a('0x39')],'resourceId':_0x409035['id'],'type':_0x4ba748[_0x733a('0x39')],'sectionId':_0x4ba748['id']},{})[_0x733a('0x20')](function(){return _0x44751f;});}else{return _0x44751f;}})[_0x733a('0x2a')](function(_0x4af6cc){logger['error'](_0x733a('0x62'),_0x4af6cc);throw _0x4af6cc;});}return _0x44751f;})['then'](respondWithResult(_0x4230e9,0xc9))[_0x733a('0x2a')](handleError(_0x4230e9,null));};exports[_0x733a('0x33')]=function(_0x407097,_0x3de308){if(_0x407097[_0x733a('0x5e')]['id']){delete _0x407097[_0x733a('0x5e')]['id'];}return db[_0x733a('0x3d')][_0x733a('0x5d')]({'where':{'id':_0x407097[_0x733a('0x56')]['id']},'include':[{'model':db[_0x733a('0x57')],'as':_0x733a('0x3c')}]})['then'](handleEntityNotFound(_0x3de308,null))[_0x733a('0x20')](saveUpdates(_0x407097['body'],null))[_0x733a('0x20')](respondWithResult(_0x3de308,null))[_0x733a('0x2a')](handleError(_0x3de308,null));};exports[_0x733a('0x34')]=function(_0x5e7f30,_0x4c1c3b){return db[_0x733a('0x3d')][_0x733a('0x5d')]({'where':{'id':_0x5e7f30[_0x733a('0x56')]['id']}})[_0x733a('0x20')](handleEntityNotFound(_0x4c1c3b,null))['then'](removeEntity(_0x4c1c3b,null))[_0x733a('0x2a')](handleError(_0x4c1c3b,null));};exports['describe']=function(_0x55a12a,_0x3aaecb){return db[_0x733a('0x3d')][_0x733a('0x63')]()[_0x733a('0x20')](respondWithResult(_0x3aaecb,null))['catch'](handleError(_0x3aaecb,null));};exports[_0x733a('0x64')]=function(_0x526fbd,_0x1bc05d,_0x344170){if(_0x526fbd[_0x733a('0x5e')]['id']){delete _0x526fbd[_0x733a('0x5e')]['id'];}return db[_0x733a('0x3d')]['find']({'where':{'id':_0x526fbd[_0x733a('0x56')]['id']}})['then'](handleEntityNotFound(_0x1bc05d,null))[_0x733a('0x20')](function(_0x1f4635){if(_0x1f4635){_0x526fbd[_0x733a('0x5e')]['SmsAccountId']=_0x1f4635['id'];return db[_0x733a('0x65')][_0x733a('0x61')](_0x526fbd[_0x733a('0x5e')]);}})[_0x733a('0x20')](respondWithResult(_0x1bc05d,null))['catch'](handleError(_0x1bc05d,null));};exports[_0x733a('0x66')]=function(_0x23bbdc,_0x2440e5,_0xcb9bda){var _0x59c555={'raw':![],'where':{}};var _0x4c9fe9={};var _0x4150e4={'count':0x0,'rows':[]};return db[_0x733a('0x3d')][_0x733a('0x67')]({'where':{'id':_0x23bbdc[_0x733a('0x56')]['id']}})['then'](handleEntityNotFound(_0x2440e5,null))[_0x733a('0x20')](function(_0x1b141f){if(_0x1b141f){_0x4c9fe9[_0x733a('0x42')]=_['keys'](db['Disposition'][_0x733a('0x3e')]);_0x4c9fe9[_0x733a('0x44')]=_[_0x733a('0x45')](_0x23bbdc[_0x733a('0x44')]);_0x4c9fe9[_0x733a('0x4d')]=_[_0x733a('0x46')](_0x4c9fe9['model'],_0x4c9fe9[_0x733a('0x44')]);_0x59c555[_0x733a('0x47')]=_['intersection'](_0x4c9fe9['model'],qs[_0x733a('0x58')](_0x23bbdc[_0x733a('0x44')][_0x733a('0x58')]));_0x59c555['attributes']=_0x59c555[_0x733a('0x47')]['length']?_0x59c555['attributes']:_0x4c9fe9[_0x733a('0x42')];if(!_0x23bbdc[_0x733a('0x44')][_0x733a('0x48')]('nolimit')){_0x59c555[_0x733a('0x49')]=qs[_0x733a('0x49')](_0x23bbdc['query'][_0x733a('0x49')]);_0x59c555[_0x733a('0x4a')]=qs[_0x733a('0x4a')](_0x23bbdc[_0x733a('0x44')][_0x733a('0x4a')]);}_0x59c555['order']=qs['sort'](_0x23bbdc[_0x733a('0x44')][_0x733a('0x4c')]);_0x59c555[_0x733a('0x50')]=qs[_0x733a('0x4d')](_['pick'](_0x23bbdc[_0x733a('0x44')],_0x4c9fe9[_0x733a('0x4d')]));_0x59c555[_0x733a('0x50')]['SmsAccountId']=_0x1b141f['id'];if(_0x23bbdc['query'][_0x733a('0x4f')]){_0x59c555[_0x733a('0x50')]=_[_0x733a('0x5b')](_0x59c555[_0x733a('0x50')],{'$or':_[_0x733a('0x43')](_0x59c555[_0x733a('0x47')],function(_0x568c03){var _0x2176fb={};_0x2176fb[_0x568c03]={'$like':'%'+_0x23bbdc[_0x733a('0x44')][_0x733a('0x4f')]+'%'};return _0x2176fb;})});}_0x59c555=_[_0x733a('0x5b')]({},_0x59c555,_0x23bbdc[_0x733a('0x5c')]);return db[_0x733a('0x65')][_0x733a('0x2f')]({'where':_0x59c555[_0x733a('0x50')]})[_0x733a('0x20')](function(_0x2976c5){_0x4150e4[_0x733a('0x2f')]=_0x2976c5;if(_0x23bbdc[_0x733a('0x44')][_0x733a('0x52')]){_0x59c555[_0x733a('0x5a')]=[{'all':!![]}];}return db[_0x733a('0x65')][_0x733a('0x53')](_0x59c555);})[_0x733a('0x20')](function(_0x1467a5){_0x4150e4[_0x733a('0x54')]=_0x1467a5;return _0x4150e4;});}})['then'](respondWithFilteredResult(_0x2440e5,_0x59c555))[_0x733a('0x2a')](handleError(_0x2440e5,null));};exports[_0x733a('0x68')]=function(_0x2481fc,_0x1ae3ce,_0x3f8695){return db[_0x733a('0x3d')][_0x733a('0x5d')]({'where':{'id':_0x2481fc[_0x733a('0x56')]['id']}})['then'](handleEntityNotFound(_0x1ae3ce,null))['then'](function(_0x4e0bba){if(_0x4e0bba){return _0x4e0bba[_0x733a('0x68')](_0x2481fc[_0x733a('0x44')][_0x733a('0x69')]);}})['then'](respondWithStatusCode(_0x1ae3ce,null))['catch'](handleError(_0x1ae3ce,null));};exports[_0x733a('0x6a')]=function(_0x48dc1b,_0x548403,_0x241033){if(_0x48dc1b[_0x733a('0x5e')]['id']){delete _0x48dc1b[_0x733a('0x5e')]['id'];}return db[_0x733a('0x3d')][_0x733a('0x5d')]({'where':{'id':_0x48dc1b['params']['id']}})[_0x733a('0x20')](handleEntityNotFound(_0x548403,null))[_0x733a('0x20')](function(_0x292fc7){if(_0x292fc7){_0x48dc1b[_0x733a('0x5e')][_0x733a('0x6b')]=_0x292fc7['id'];return db[_0x733a('0x6c')][_0x733a('0x61')](_0x48dc1b[_0x733a('0x5e')]);}})[_0x733a('0x20')](respondWithResult(_0x548403,null))[_0x733a('0x2a')](handleError(_0x548403,null));};exports[_0x733a('0x6d')]=function(_0x3976ae,_0x10bcd5,_0x51c42d){var _0x3b8ec7={'raw':![],'where':{}};var _0x12bcc0={};var _0x3f1588={'count':0x0,'rows':[]};return db[_0x733a('0x3d')][_0x733a('0x67')]({'where':{'id':_0x3976ae[_0x733a('0x56')]['id']}})['then'](handleEntityNotFound(_0x10bcd5,null))[_0x733a('0x20')](function(_0x495c0){if(_0x495c0){_0x12bcc0[_0x733a('0x42')]=_[_0x733a('0x45')](db['CannedAnswer'][_0x733a('0x3e')]);_0x12bcc0[_0x733a('0x44')]=_['keys'](_0x3976ae[_0x733a('0x44')]);_0x12bcc0[_0x733a('0x4d')]=_[_0x733a('0x46')](_0x12bcc0[_0x733a('0x42')],_0x12bcc0[_0x733a('0x44')]);_0x3b8ec7[_0x733a('0x47')]=_[_0x733a('0x46')](_0x12bcc0[_0x733a('0x42')],qs[_0x733a('0x58')](_0x3976ae[_0x733a('0x44')][_0x733a('0x58')]));_0x3b8ec7[_0x733a('0x47')]=_0x3b8ec7[_0x733a('0x47')][_0x733a('0x59')]?_0x3b8ec7[_0x733a('0x47')]:_0x12bcc0[_0x733a('0x42')];if(!_0x3976ae[_0x733a('0x44')]['hasOwnProperty']('nolimit')){_0x3b8ec7[_0x733a('0x49')]=qs['limit'](_0x3976ae[_0x733a('0x44')][_0x733a('0x49')]);_0x3b8ec7[_0x733a('0x4a')]=qs[_0x733a('0x4a')](_0x3976ae[_0x733a('0x44')][_0x733a('0x4a')]);}_0x3b8ec7[_0x733a('0x4b')]=qs['sort'](_0x3976ae['query'][_0x733a('0x4c')]);_0x3b8ec7['where']=qs[_0x733a('0x4d')](_['pick'](_0x3976ae['query'],_0x12bcc0[_0x733a('0x4d')]));_0x3b8ec7[_0x733a('0x50')]['SmsAccountId']=_0x495c0['id'];if(_0x3976ae[_0x733a('0x44')]['filter']){_0x3b8ec7[_0x733a('0x50')]=_[_0x733a('0x5b')](_0x3b8ec7[_0x733a('0x50')],{'$or':_['map'](_0x3b8ec7[_0x733a('0x47')],function(_0x3bacf0){var _0x5b3007={};_0x5b3007[_0x3bacf0]={'$like':'%'+_0x3976ae[_0x733a('0x44')][_0x733a('0x4f')]+'%'};return _0x5b3007;})});}_0x3b8ec7=_[_0x733a('0x5b')]({},_0x3b8ec7,_0x3976ae[_0x733a('0x5c')]);return db[_0x733a('0x6c')][_0x733a('0x2f')]({'where':_0x3b8ec7[_0x733a('0x50')]})['then'](function(_0x2739b4){_0x3f1588[_0x733a('0x2f')]=_0x2739b4;if(_0x3976ae[_0x733a('0x44')]['includeAll']){_0x3b8ec7[_0x733a('0x5a')]=[{'all':!![]}];}return db[_0x733a('0x6c')]['findAll'](_0x3b8ec7);})[_0x733a('0x20')](function(_0x109c20){_0x3f1588[_0x733a('0x54')]=_0x109c20;return _0x3f1588;});}})[_0x733a('0x20')](respondWithFilteredResult(_0x10bcd5,_0x3b8ec7))[_0x733a('0x2a')](handleError(_0x10bcd5,null));};exports[_0x733a('0x6e')]=function(_0x1dd46d,_0x9a4f6e,_0x1c5f61){return db[_0x733a('0x3d')][_0x733a('0x5d')]({'where':{'id':_0x1dd46d[_0x733a('0x56')]['id']}})['then'](handleEntityNotFound(_0x9a4f6e,null))[_0x733a('0x20')](function(_0x1ff5af){if(_0x1ff5af){return _0x1ff5af[_0x733a('0x6e')](_0x1dd46d[_0x733a('0x44')][_0x733a('0x69')]);}})[_0x733a('0x20')](respondWithStatusCode(_0x9a4f6e,null))[_0x733a('0x2a')](handleError(_0x9a4f6e,null));};exports[_0x733a('0x6f')]=function(_0x20abfe,_0x9d0b5e,_0x1f1b15){var _0x2f37a0={'channel':'sms'};var _0x18fddd=[];var _0x3dc609=[];var _0xc14884={};return db[_0x733a('0x3d')][_0x733a('0x5d')]({'where':{'id':_0x20abfe[_0x733a('0x56')]['id']},'include':[{'model':db[_0x733a('0x70')],'as':_0x733a('0x71')}]})['then'](handleEntityNotFound(_0x9d0b5e,null))[_0x733a('0x20')](function(_0x4745da){_0x2f37a0[_0x733a('0x72')]=_0x4745da;_0x2f37a0['applications']=_[_0x733a('0x73')](_0x4745da[_0x733a('0x71')],[_0x733a('0x74')],[_0x733a('0x75')]);if(_0x2f37a0[_0x733a('0x72')][_0x733a('0x71')]){delete _0x2f37a0['account']['Applications'];}return db['CmContact'][_0x733a('0x63')]();})[_0x733a('0x20')](function(_0x291d76){if(!_0x291d76){throw new db[(_0x733a('0x76'))]['ValidationError']('no\x20available\x20attributes');}_0x18fddd=_[_0x733a('0x77')](_['keys'](_0x291d76),[_0x733a('0x78'),_0x733a('0x79')]);_0x3dc609=_[_0x733a('0x77')](_[_0x733a('0x45')](_0x291d76),[_0x733a('0x78'),_0x733a('0x79'),'CompanyId',_0x733a('0x7a')]);_0x2f37a0[_0x733a('0x5e')]={'mapKey':_0x733a('0x7b')};if(_0x2f37a0[_0x733a('0x72')][_0x733a('0x40')]){switch(_0x2f37a0[_0x733a('0x72')][_0x733a('0x40')]){case _0x733a('0x7c'):_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7d')]=_0x20abfe[_0x733a('0x5e')]['From'];_0x2f37a0['body']['body']=_0x20abfe[_0x733a('0x5e')][_0x733a('0x7e')];_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7f')]=_0x20abfe[_0x733a('0x5e')][_0x733a('0x80')];break;case _0x733a('0x81'):_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7d')]='+'+_0x20abfe['body']['sender'];_0x2f37a0[_0x733a('0x5e')][_0x733a('0x5e')]=_0x20abfe[_0x733a('0x5e')][_0x733a('0x82')];break;case _0x733a('0x83'):_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7d')]=_0x20abfe[_0x733a('0x5e')][_0x733a('0x7d')];_0x2f37a0[_0x733a('0x5e')]['body']=_0x20abfe[_0x733a('0x5e')][_0x733a('0x28')];break;case _0x733a('0x84'):_0x2f37a0['body'][_0x733a('0x7d')]=_0x20abfe[_0x733a('0x5e')][_0x733a('0x7d')];_0x2f37a0[_0x733a('0x5e')][_0x733a('0x5e')]=_0x20abfe[_0x733a('0x5e')][_0x733a('0x5e')];_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7f')]=_0x20abfe[_0x733a('0x5e')][_0x733a('0x85')];break;case _0x733a('0x86'):_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7d')]=_0x20abfe[_0x733a('0x5e')][_0x733a('0x87')];_0x2f37a0[_0x733a('0x5e')][_0x733a('0x5e')]=_0x20abfe[_0x733a('0x5e')][_0x733a('0x88')];_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7f')]=_0x20abfe['body']['MessageUUID'];break;case _0x733a('0x89'):_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7d')]='+'+_0x20abfe[_0x733a('0x5e')][_0x733a('0x8a')][0x0]['from'];_0x2f37a0[_0x733a('0x5e')][_0x733a('0x5e')]=_0x20abfe['body'][_0x733a('0x8a')][0x0]['text'];_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7f')]=_0x20abfe[_0x733a('0x5e')][_0x733a('0x8a')][0x0][_0x733a('0x7f')];break;case _0x733a('0x8b'):_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7d')]=_0x20abfe[_0x733a('0x5e')][_0x733a('0x8c')];_0x2f37a0['body'][_0x733a('0x5e')]=_0x20abfe['body'][_0x733a('0x8d')]['message'];break;case'clickatell':_0x2f37a0['body'][_0x733a('0x7d')]=_0x20abfe['body'][_0x733a('0x8e')];_0x2f37a0['body'][_0x733a('0x5e')]=_0x20abfe[_0x733a('0x5e')]['text'];_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7f')]=_0x20abfe[_0x733a('0x5e')][_0x733a('0x8f')];break;case _0x733a('0x90'):_0x2f37a0[_0x733a('0x5e')]['from']=_0x20abfe[_0x733a('0x5e')][_0x733a('0x7d')];_0x2f37a0[_0x733a('0x5e')][_0x733a('0x5e')]=_0x20abfe[_0x733a('0x5e')][_0x733a('0x28')];_0x2f37a0[_0x733a('0x5e')]['messageId']=_0x20abfe['body'][_0x733a('0x91')];break;}}if(_0x2f37a0[_0x733a('0x5e')]['id']){delete _0x2f37a0[_0x733a('0x5e')]['id'];}if(_['isNil'](_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7d')])){throw new db[(_0x733a('0x76'))][(_0x733a('0x92'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2f37a0[_0x733a('0x5e')]['body'])||_0x2f37a0[_0x733a('0x5e')][_0x733a('0x5e')]===''){throw new db[(_0x733a('0x76'))][(_0x733a('0x92'))](_0x733a('0x93'));}if(_[_0x733a('0x94')](_0x2f37a0['body']['mapKey'])){throw new db['Sequelize'][(_0x733a('0x92'))](_0x733a('0x95')+_0x3dc609);}if(!_['includes'](_0x3dc609,_0x2f37a0[_0x733a('0x5e')][_0x733a('0x96')])){throw new db[(_0x733a('0x76'))][(_0x733a('0x92'))](_0x733a('0x97')+_0x3dc609);}_0xc14884[_0x2f37a0['body'][_0x733a('0x96')]]=_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7d')];return db[_0x733a('0x98')][_0x733a('0x5d')]({'where':{'id':_0x2f37a0[_0x733a('0x72')][_0x733a('0x7a')]},'include':[{'model':db[_0x733a('0x99')],'as':_0x733a('0x9a'),'where':_0xc14884,'limit':0x1,'order':[[_0x733a('0x79'),_0x733a('0x9b')]]}]});})[_0x733a('0x20')](handleEntityNotFound(_0x9d0b5e,null))[_0x733a('0x20')](function(_0x565057){if(_0x565057){_0x2f37a0[_0x733a('0x9c')]=_[_0x733a('0x9d')](_0x565057,[_0x733a('0x9a')]);if(_0x565057[_0x733a('0x9a')][_0x733a('0x59')]){return _0x565057[_0x733a('0x9a')][0x0];}var _0x368f05=_[_0x733a('0x9e')](_0x2f37a0[_0x733a('0x5e')],{'firstName':_0x2f37a0['body'][_0x733a('0x7d')],'ListId':_0x565057['id']});_0x368f05[_0x2f37a0[_0x733a('0x5e')][_0x733a('0x96')]]=_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7d')];return db['CmContact'][_0x733a('0x61')](_0x368f05,{'fields':_0x18fddd,'raw':!![]});}})[_0x733a('0x20')](handleEntityNotFound(_0x9d0b5e,null))['then'](function(_0x1b2b50){if(_0x1b2b50){_0x2f37a0[_0x733a('0x9f')]=_0x1b2b50;var _0x49774a={'ContactId':_0x1b2b50['id'],'phone':_0x2f37a0[_0x733a('0x5e')]['from'],'SmsAccountId':_0x20abfe[_0x733a('0x56')]['id']};var _0xd7a4d1={'ContactId':_0x1b2b50['id'],'SmsAccountId':_0x20abfe[_0x733a('0x56')]['id'],'closed':![]};return db[_0x733a('0xa0')][_0x733a('0x5d')]({'where':_0xd7a4d1})[_0x733a('0x20')](function(_0x1c4454){if(_0x1c4454){return[_0x1c4454,![]];}return db[_0x733a('0xa0')][_0x733a('0x61')](_0x49774a)[_0x733a('0x20')](function(_0x7d8df7){return[_0x7d8df7,!![]];});});}})['spread'](function(_0x3a9426,_0x11c44b){_0x2f37a0[_0x733a('0xa1')]=_0x3a9426['get']({'plain':!![]});_0x2f37a0[_0x733a('0xa1')][_0x733a('0xa2')]=![];if(_0x11c44b){if(_0x2f37a0[_0x733a('0x72')][_0x733a('0xa3')]){_0x2f37a0[_0x733a('0xa4')]['push']({'id':0x0,'priority':_0x2f37a0[_0x733a('0xa4')]['length']+0x1,'app':_0x733a('0xa5'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x2f37a0[_0x733a('0xa1')][_0x733a('0xa2')]=!![];}return db['SmsMessage']['create']({'phone':_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7d')],'messageId':_0x2f37a0[_0x733a('0x5e')][_0x733a('0x7f')],'body':_0x2f37a0[_0x733a('0x5e')][_0x733a('0x5e')],'SmsAccountId':_0x20abfe[_0x733a('0x56')]['id'],'SmsInteractionId':_0x3a9426['id'],'direction':'in','ContactId':_0x3a9426[_0x733a('0xa6')],'AttachmentId':_0x2f37a0[_0x733a('0x5e')][_0x733a('0xa7')]});})[_0x733a('0x20')](function(_0x1724e5){_0x2f37a0[_0x733a('0x28')]=_0x1724e5;if(_0x2f37a0[_0x733a('0xa1')][_0x733a('0xa8')]){return db[_0x733a('0xa9')][_0x733a('0x5d')]({'attributes':['id','name'],'where':{'id':_0x2f37a0['interaction'][_0x733a('0xa8')]}})[_0x733a('0x20')](function(_0x3a48c9){if(_0x3a48c9){_0x2f37a0[_0x733a('0xa4')][_0x733a('0xaa')]({'id':0x0,'priority':0x0,'app':_0x733a('0xab'),'appdata':_0x3a48c9[_0x733a('0x39')]+','+(_0x2f37a0[_0x733a('0x72')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x733a('0xac'),'startRouting',_0x2f37a0);});}return respondWithRpcPromise(_0x733a('0xac'),'startRouting',_0x2f37a0);})[_0x733a('0x20')](function(_0x414c6f){if(_0x414c6f){var _0x79fc5a=0xc8;var _0x5430ef=_0x733a('0xad');logger[_0x733a('0x21')](_0x733a('0x25'),_0x5430ef,_0x79fc5a,_0x733a('0xae'));logger[_0x733a('0x24')](_0x733a('0xaf'),_0x5430ef,_0x79fc5a,'entity\x20found',JSON[_0x733a('0x26')](_0x414c6f));if(_0x2f37a0[_0x733a('0x72')][_0x733a('0x40')]==='twilio'){return _0x9d0b5e[_0x733a('0x2c')](_0x79fc5a)['set'](_0x733a('0xb0'),_0x733a('0xb1'))[_0x733a('0x3a')](_0x733a('0xb2'));}else{return _0x9d0b5e[_0x733a('0x2c')](_0x79fc5a)[_0x733a('0x2e')](_0x414c6f);}}})[_0x733a('0x2a')](handleError(_0x9d0b5e,null));};exports[_0x733a('0xb3')]=function(_0x4b587a,_0x8d255b,_0x19d70d){return db[_0x733a('0x3d')][_0x733a('0x67')]({'where':{'id':_0x4b587a['params']['id']}})[_0x733a('0x20')](handleEntityNotFound(_0x8d255b,null))['then'](function(_0x270c96){if(_0x270c96){return db['sequelize'][_0x733a('0xb4')](function(_0x4228c9){return db[_0x733a('0x70')][_0x733a('0x34')]({'where':{'SmsAccountId':_0x4b587a[_0x733a('0x56')]['id']},'transaction':_0x4228c9})[_0x733a('0x20')](function(_0x201d27){var _0x2ce41d=_[_0x733a('0x43')](_0x4b587a[_0x733a('0x5e')],function(_0x3155f1){_0x3155f1[_0x733a('0x6b')]=_0x4b587a[_0x733a('0x56')]['id'];return _0x3155f1;});return db[_0x733a('0x70')][_0x733a('0xb5')](_0x2ce41d,{'transaction':_0x4228c9});});})[_0x733a('0x20')](function(){return db[_0x733a('0x70')][_0x733a('0xb6')]({'where':{'SmsAccountId':_0x4b587a[_0x733a('0x56')]['id']},'order':_0x733a('0x74')});});}})['then'](respondWithResult(_0x8d255b,null))['catch'](handleError(_0x8d255b,null));};exports[_0x733a('0xb7')]=function(_0x2a090a,_0x48d0b0,_0x1d79f6){var _0x5e3b34={};var _0x324b20={};var _0x319e35;var _0x3fb7fa;return db[_0x733a('0x3d')][_0x733a('0x67')]({'where':{'id':_0x2a090a['params']['id']}})[_0x733a('0x20')](handleEntityNotFound(_0x48d0b0,null))['then'](function(_0x4d7e15){if(_0x4d7e15){_0x319e35=_0x4d7e15;_0x324b20[_0x733a('0x42')]=_[_0x733a('0x45')](db[_0x733a('0x70')][_0x733a('0x3e')]);_0x324b20[_0x733a('0x44')]=_['keys'](_0x2a090a['query']);_0x324b20[_0x733a('0x4d')]=_[_0x733a('0x46')](_0x324b20['model'],_0x324b20[_0x733a('0x44')]);_0x5e3b34[_0x733a('0x47')]=_['intersection'](_0x324b20[_0x733a('0x42')],qs[_0x733a('0x58')](_0x2a090a[_0x733a('0x44')]['fields']));_0x5e3b34[_0x733a('0x47')]=_0x5e3b34[_0x733a('0x47')][_0x733a('0x59')]?_0x5e3b34[_0x733a('0x47')]:_0x324b20[_0x733a('0x42')];_0x5e3b34[_0x733a('0x4b')]=qs[_0x733a('0x4c')](_0x2a090a[_0x733a('0x44')][_0x733a('0x4c')]);_0x5e3b34[_0x733a('0x50')]=qs[_0x733a('0x4d')](_['pick'](_0x2a090a['query'],_0x324b20['filters']));if(_0x2a090a[_0x733a('0x44')][_0x733a('0x4f')]){_0x5e3b34['where']=_[_0x733a('0x5b')](_0x5e3b34[_0x733a('0x50')],{'$or':_[_0x733a('0x43')](_0x5e3b34[_0x733a('0x47')],function(_0x191c3b){var _0x15992={};_0x15992[_0x191c3b]={'$like':'%'+_0x2a090a['query'][_0x733a('0x4f')]+'%'};return _0x15992;})});}_0x5e3b34=_[_0x733a('0x5b')]({},_0x5e3b34,_0x2a090a[_0x733a('0x5c')]);return _0x319e35['getApplications'](_0x5e3b34);}})[_0x733a('0x20')](function(_0x24fa01){if(_0x24fa01){_0x3fb7fa=_0x24fa01['length'];if(!_0x2a090a[_0x733a('0x44')]['hasOwnProperty']('nolimit')){_0x5e3b34[_0x733a('0x49')]=qs[_0x733a('0x49')](_0x2a090a[_0x733a('0x44')][_0x733a('0x49')]);_0x5e3b34[_0x733a('0x4a')]=qs['offset'](_0x2a090a['query']['offset']);}return _0x319e35[_0x733a('0xb7')](_0x5e3b34);}})[_0x733a('0x20')](function(_0x196b23){if(_0x196b23){return _0x196b23?{'count':_0x3fb7fa,'rows':_0x196b23}:null;}})[_0x733a('0x20')](respondWithResult(_0x48d0b0,null))[_0x733a('0x2a')](handleError(_0x48d0b0,null));};exports[_0x733a('0xb8')]=function(_0xe70f7,_0x17e89f,_0x4635bf){var _0x4af1b8={'raw':![],'where':{}};var _0x42af11={};var _0x57adcc={'count':0x0,'rows':[]};return db['SmsAccount'][_0x733a('0x67')]({'where':{'id':_0xe70f7[_0x733a('0x56')]['id']}})[_0x733a('0x20')](handleEntityNotFound(_0x17e89f,null))['then'](function(_0x16fdf0){if(_0x16fdf0){_0x42af11[_0x733a('0x42')]=_[_0x733a('0x45')](db[_0x733a('0xa0')][_0x733a('0x3e')]);_0x42af11['query']=_[_0x733a('0x45')](_0xe70f7['query']);_0x42af11[_0x733a('0x4d')]=_[_0x733a('0x46')](_0x42af11['model'],_0x42af11[_0x733a('0x44')]);_0x4af1b8[_0x733a('0x47')]=_[_0x733a('0x46')](_0x42af11[_0x733a('0x42')],qs['fields'](_0xe70f7[_0x733a('0x44')]['fields']));_0x4af1b8['attributes']=_0x4af1b8['attributes'][_0x733a('0x59')]?_0x4af1b8[_0x733a('0x47')]:_0x42af11[_0x733a('0x42')];if(!_0xe70f7['query'][_0x733a('0x48')]('nolimit')){_0x4af1b8[_0x733a('0x49')]=qs[_0x733a('0x49')](_0xe70f7[_0x733a('0x44')]['limit']);_0x4af1b8['offset']=qs[_0x733a('0x4a')](_0xe70f7['query'][_0x733a('0x4a')]);}_0x4af1b8['order']=qs['sort'](_0xe70f7[_0x733a('0x44')][_0x733a('0x4c')]);_0x4af1b8['where']=qs['filters'](_[_0x733a('0x4e')](_0xe70f7[_0x733a('0x44')],_0x42af11['filters']));_0x4af1b8['where'][_0x733a('0x6b')]=_0x16fdf0['id'];if(_0xe70f7['query'][_0x733a('0x4f')]){_0x4af1b8[_0x733a('0x50')]=_[_0x733a('0x5b')](_0x4af1b8[_0x733a('0x50')],{'$or':_['map'](_0x4af1b8['attributes'],function(_0x3c60af){var _0x143e66={};_0x143e66[_0x3c60af]={'$like':'%'+_0xe70f7[_0x733a('0x44')]['filter']+'%'};return _0x143e66;})});}_0x4af1b8=_[_0x733a('0x5b')]({},_0x4af1b8,_0xe70f7[_0x733a('0x5c')]);return db[_0x733a('0xa0')][_0x733a('0x2f')]({'where':_0x4af1b8[_0x733a('0x50')]})[_0x733a('0x20')](function(_0x50b8d7){_0x57adcc[_0x733a('0x2f')]=_0x50b8d7;if(_0xe70f7[_0x733a('0x44')]['includeAll']){_0x4af1b8[_0x733a('0x5a')]=[{'model':db[_0x733a('0x99')],'as':_0x733a('0xb9'),'required':![]},{'model':db[_0x733a('0xa9')],'as':_0x733a('0xba'),'attributes':[_0x733a('0x39'),_0x733a('0xbb'),_0x733a('0xbc')],'required':![]},{'model':db[_0x733a('0xbd')],'as':_0x733a('0xbe'),'attributes':['id',_0x733a('0x39'),_0x733a('0xbf')],'where':_0xe70f7[_0x733a('0x44')]['tag']?{'id':_0xe70f7[_0x733a('0x44')]['tag']}:undefined,'required':_0xe70f7[_0x733a('0x44')][_0x733a('0xc0')]?!![]:![]}];}return db[_0x733a('0xa0')][_0x733a('0x53')](_0x4af1b8);})['then'](function(_0x1c76f7){_0x57adcc[_0x733a('0x54')]=_0x1c76f7;return _0x57adcc;});}})[_0x733a('0x20')](respondWithFilteredResult(_0x17e89f,_0x4af1b8))[_0x733a('0x2a')](handleError(_0x17e89f,null));};exports['send']=function(_0x2a3ca5,_0x163a55,_0x4ca525){var _0x5ec971,_0x6e1bb8,_0x2505e2;if(_[_0x733a('0x94')](_0x2a3ca5[_0x733a('0x5e')]['body'])||_0x2a3ca5[_0x733a('0x5e')]['body']===''){throw new db[(_0x733a('0x76'))][(_0x733a('0x92'))](_0x733a('0x93'));}if(_['isNil'](_0x2a3ca5[_0x733a('0x5e')]['to'])){throw new db[(_0x733a('0x76'))][(_0x733a('0x92'))]('to\x20is\x20mandatory');}_0x5ec971=_0x2a3ca5[_0x733a('0x5e')]['to'];return db[_0x733a('0x3d')][_0x733a('0x5d')]({'where':{'id':_0x2a3ca5[_0x733a('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0x733a('0xc1'),'include':[{'model':db[_0x733a('0x99')],'as':'Contacts','where':{'mobile':_0x5ec971},'limit':0x1,'order':[[_0x733a('0x79'),'DESC']]}]}]})[_0x733a('0x20')](handleEntityNotFound(_0x163a55,null))[_0x733a('0x20')](function(_0x1f52b7){if(_0x1f52b7&&_0x1f52b7[_0x733a('0xc1')]){_0x6e1bb8=_0x1f52b7[_0x733a('0x35')]({'plain':!![]});if(_0x6e1bb8[_0x733a('0xc1')]&&_0x6e1bb8[_0x733a('0xc1')][_0x733a('0x9a')][_0x733a('0x59')]){return _0x6e1bb8['List'][_0x733a('0x9a')][0x0];}return db['CmContact'][_0x733a('0x61')](_[_0x733a('0x9e')](_0x2a3ca5[_0x733a('0x5e')],{'firstName':_0x5ec971,'mobile':_0x5ec971,'phone':_0x5ec971,'ListId':_0x6e1bb8['ListId']}));}})['then'](handleEntityNotFound(_0x163a55,null))[_0x733a('0x20')](function(_0x49197d){if(_0x49197d){_0x2505e2=_0x49197d;return db[_0x733a('0xa0')][_0x733a('0x5d')]({'where':{'ContactId':_0x2505e2['id'],'closed':![],'SmsAccountId':_0x6e1bb8['id']}})['then'](function(_0x5d07d8){if(_0x5d07d8){return[_0x5d07d8,![]];}return db[_0x733a('0xa0')]['create']({'UserId':_0x2a3ca5[_0x733a('0x5f')]['id'],'ContactId':_0x2505e2['id'],'SmsAccountId':_0x6e1bb8['id'],'phone':_0x5ec971,'firstMsgDirection':_0x733a('0xc2'),'Messages':[_[_0x733a('0x5b')](_0x2a3ca5['body'],{'read':![],'body':_0x2a3ca5['body'][_0x733a('0x5e')],'phone':_0x5ec971,'SmsAccountId':_0x6e1bb8['id'],'UserId':_0x2a3ca5[_0x733a('0x5f')]['id'],'ContactId':_0x2505e2['id']})]},{'include':[{'model':db[_0x733a('0xc3')],'as':_0x733a('0xc4')}]})['then'](function(_0x56288b){return[_0x56288b,!![]];});});}})[_0x733a('0xc5')](function(_0x269cbe,_0x462625){if(_0x462625){return _0x269cbe;}return db['SmsMessage'][_0x733a('0x61')](_['merge'](_0x2a3ca5['body'],{'read':![],'body':_0x2a3ca5[_0x733a('0x5e')]['body'],'phone':_0x5ec971,'SmsAccountId':_0x6e1bb8['id'],'SmsInteractionId':_0x269cbe['id'],'UserId':_0x2a3ca5[_0x733a('0x5f')]['id'],'ContactId':_0x2505e2['id']}))['then'](function(_0x5761d5){_0x269cbe[_0x733a('0xc6')][_0x733a('0xc4')]=[];_0x269cbe[_0x733a('0xc6')][_0x733a('0xc4')][_0x733a('0xc7')](_0x5761d5[_0x733a('0xc6')]);return _0x269cbe;});})[_0x733a('0x20')](respondWithResult(_0x163a55,null))[_0x733a('0x2a')](handleError(_0x163a55,null));};exports[_0x733a('0x2c')]=function(_0x4598f7,_0x11e884,_0x428f6d){if(_0x4598f7[_0x733a('0x5e')]['id']){delete _0x4598f7[_0x733a('0x5e')]['id'];}console[_0x733a('0xc8')](_0x733a('0xc9'),_0x4598f7[_0x733a('0x5e')]);var _0x48300f,_0x592009,_0x248df6;return db[_0x733a('0x3d')][_0x733a('0x5d')]({'where':{'id':_0x4598f7[_0x733a('0x56')]['id']}})[_0x733a('0x20')](handleEntityNotFound(_0x11e884,null))[_0x733a('0x20')](function(_0x3f42fc){if(_0x3f42fc){_0x248df6=_0x3f42fc;logger['debug'](_0x733a('0x25'),_0x733a('0x2c'),'received\x20delivery\x20report\x20from',_0x3f42fc['type'],util[_0x733a('0xca')](_0x4598f7['body'],{'showHidden':![],'depth':null}));switch(_0x3f42fc['type']){case _0x733a('0x81'):if(_0x4598f7[_0x733a('0x5e')]['skebby_dispatch_id']&&_0x4598f7['body'][_0x733a('0x2c')]){_0x592009=_0x4598f7[_0x733a('0x5e')][_0x733a('0x2c')];return db[_0x733a('0xc3')][_0x733a('0x5d')]({'where':{'messageId':_0x4598f7['body'][_0x733a('0xcb')]}});}break;case _0x733a('0x83'):if(_0x4598f7[_0x733a('0x5e')]['requestid']&&_0x4598f7[_0x733a('0x5e')][_0x733a('0xcc')]){_0x592009=_0x4598f7[_0x733a('0x5e')][_0x733a('0xcc')];return db[_0x733a('0xc3')][_0x733a('0x5d')]({'where':{'messageId':_0x4598f7[_0x733a('0x5e')][_0x733a('0xcd')]}});}break;case _0x733a('0x84'):if(_0x4598f7['body'][_0x733a('0x85')]&&_0x4598f7[_0x733a('0x5e')][_0x733a('0xce')]){_0x592009=_0x4598f7['body']['status_code'];return db[_0x733a('0xc3')][_0x733a('0x5d')]({'where':{'messageId':_0x4598f7[_0x733a('0x5e')][_0x733a('0x85')]}});}break;case _0x733a('0x89'):var _0x4f27e8=_0x4598f7[_0x733a('0x5e')][_0x733a('0x8a')][0x0];if(_0x4f27e8['messageId']&&_0x4f27e8[_0x733a('0x2c')][_0x733a('0xcf')]==='DELIVERED'){_0x592009=_0x4f27e8[_0x733a('0x2c')][_0x733a('0xcf')];return db[_0x733a('0xc3')]['find']({'where':{'messageId':_0x4f27e8['messageId']}});}break;case _0x733a('0xd0'):if(_0x4598f7['body'][_0x733a('0x7f')]&&_0x4598f7[_0x733a('0x5e')][_0x733a('0x2c')]){_0x592009=_0x4598f7[_0x733a('0x5e')][_0x733a('0x2c')];return db[_0x733a('0xc3')][_0x733a('0x5d')]({'where':{'messageId':_0x4598f7[_0x733a('0x5e')][_0x733a('0x7f')]}});}break;case'intelepeer':if(_0x4598f7[_0x733a('0x5e')][_0x733a('0xd1')]&&_0x4598f7[_0x733a('0x5e')][_0x733a('0x2c')]){_0x592009=_0x4598f7[_0x733a('0x5e')][_0x733a('0x2c')];return db['SmsMessage'][_0x733a('0x5d')]({'where':{'messageId':_0x4598f7[_0x733a('0x5e')][_0x733a('0xd1')]}});}break;}}})[_0x733a('0x20')](handleEntityNotFound(_0x11e884,null))[_0x733a('0x20')](function(_0x54e417){if(_0x54e417){_0x48300f=_0x54e417;switch(_0x248df6['type']){case'skebby':if(_0x592009===_0x733a('0xd2')){return _0x48300f[_0x733a('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x733a('0x2c'),_0x733a('0x81'),util[_0x733a('0xca')](_0x4598f7[_0x733a('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x733a('0x83'):if(_0x592009==='1'){return _0x48300f[_0x733a('0x33')]({'read':!![]});}else{logger[_0x733a('0x27')](_0x733a('0x25'),_0x733a('0x2c'),_0x733a('0x81'),util[_0x733a('0xca')](_0x4598f7[_0x733a('0x5e')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4598f7[_0x733a('0x5e')][_0x733a('0xd3')]&&_0x592009>=0xc8&&_0x592009<=0xce){return _0x48300f[_0x733a('0x33')]({'read':!![]});}else{logger['error'](_0x733a('0x25'),_0x733a('0x2c'),'clicksend',util[_0x733a('0xca')](_0x4598f7[_0x733a('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x733a('0x89'):var _0x54e2da=_0x4598f7[_0x733a('0x5e')][_0x733a('0x8a')][0x0];if(_0x54e2da[_0x733a('0x2c')]['groupName']==='DELIVERED'){return _0x48300f[_0x733a('0x33')]({'read':!![]});}else{logger[_0x733a('0x27')](_0x733a('0x25'),_0x733a('0x2c'),_0x733a('0x89'),util[_0x733a('0xca')](_0x4598f7['body'],{'showHidden':![],'depth':null}));}break;case _0x733a('0xd0'):if(_0x592009==_0x733a('0xd4')||_0x592009=='RECEIVED_BY_RECIPIENT'){return _0x48300f['update']({'read':!![]});}else{logger['error'](_0x733a('0x25'),'status',_0x733a('0xd0'),util[_0x733a('0xca')](_0x4598f7[_0x733a('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x733a('0x90'):if(_0x592009===_0x733a('0xd5')||_0x592009===_0x733a('0xd6')){return _0x48300f['update']({'read':!![]});}else{logger[_0x733a('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x733a('0x2c'),_0x733a('0x90'),util[_0x733a('0xca')](_0x4598f7[_0x733a('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x48300f;}})[_0x733a('0x20')](respondWithResult(_0x11e884,null))[_0x733a('0x2a')](handleError(_0x11e884,null));};exports['statusGet']=function(_0x471e57,_0x1ccca9,_0x4b98d3){var _0x1a60ad,_0x48ed10,_0xe62378;return db[_0x733a('0x3d')][_0x733a('0x5d')]({'where':{'id':_0x471e57[_0x733a('0x56')]['id']}})[_0x733a('0x20')](handleEntityNotFound(_0x1ccca9,null))[_0x733a('0x20')](function(_0x154bb5){if(_0x154bb5){_0xe62378=_0x154bb5;logger[_0x733a('0x24')](_0x733a('0x25'),_0x733a('0x2c'),_0x733a('0xd7'),_0x154bb5[_0x733a('0x40')],util[_0x733a('0xca')](_0x471e57[_0x733a('0x44')],{'showHidden':![],'depth':null}));switch(_0x154bb5['type']){case _0x733a('0x8b'):if(_0x471e57[_0x733a('0x44')][_0x733a('0xd8')]&&_0x471e57['query']['state']){_0x48ed10=_0x471e57['query']['state'];return db[_0x733a('0xc3')][_0x733a('0x5d')]({'where':{'messageId':_0x471e57[_0x733a('0x44')][_0x733a('0xd8')]}});}break;}}})['then'](handleEntityNotFound(_0x1ccca9,null))['then'](function(_0x34311c){if(_0x34311c){_0x1a60ad=_0x34311c;switch(_0xe62378[_0x733a('0x40')]){case _0x733a('0x8b'):if(_0x48ed10==='2'||_0x48ed10==='6'){return _0x1a60ad['update']({'read':!![]});}else{logger[_0x733a('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x733a('0x8b'),util[_0x733a('0xca')](_0x471e57[_0x733a('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x1a60ad;}})['then'](respondWithResult(_0x1ccca9,null))[_0x733a('0x2a')](handleError(_0x1ccca9,null));};exports[_0x733a('0xd9')]=function(_0x25622b,_0xdc779e,_0xa804c6){return db['SmsAccount'][_0x733a('0x5d')]({'where':{'id':_0x25622b[_0x733a('0x56')]['id']}})[_0x733a('0x20')](handleEntityNotFound(_0xdc779e,null))[_0x733a('0x20')](function(_0x2ddaab){if(_0x2ddaab){return _0x2ddaab[_0x733a('0xd9')](_0x25622b[_0x733a('0x5e')]['ids'],_[_0x733a('0x9d')](_0x25622b[_0x733a('0x5e')],[_0x733a('0x69'),'id'])||{})[_0x733a('0xc5')](function(_0x4ab818){for(var _0x45b651=0x0;_0x45b651<_0x25622b['body'][_0x733a('0x69')][_0x733a('0x59')];_0x45b651+=0x1){socket[_0x733a('0xda')](_0x733a('0xdb'),{'UserId':_0x25622b['body'][_0x733a('0x69')][_0x45b651],'SmsAccountId':_0x25622b[_0x733a('0x56')]['id']});}return _0x4ab818;});}})['then'](respondWithResult(_0xdc779e,null))[_0x733a('0x2a')](handleError(_0xdc779e,null));};exports[_0x733a('0xdc')]=function(_0xf2b397,_0x416ce1,_0x2cc0dc){return db[_0x733a('0x3d')][_0x733a('0x5d')]({'where':{'id':_0xf2b397['params']['id']}})[_0x733a('0x20')](handleEntityNotFound(_0x416ce1,null))[_0x733a('0x20')](function(_0x295e0b){if(_0x295e0b){return _0x295e0b[_0x733a('0xdc')](_0xf2b397[_0x733a('0x44')][_0x733a('0x69')])['then'](function(){if(_[_0x733a('0xdd')](_0xf2b397[_0x733a('0x44')][_0x733a('0x69')])){for(var _0x4b85de=0x0;_0x4b85de<_0xf2b397[_0x733a('0x44')][_0x733a('0x69')]['length'];_0x4b85de+=0x1){socket[_0x733a('0xda')](_0x733a('0xde'),{'UserId':Number(_0xf2b397[_0x733a('0x44')][_0x733a('0x69')][_0x4b85de]),'SmsAccountId':Number(_0xf2b397[_0x733a('0x56')]['id'])});}}else{socket[_0x733a('0xda')](_0x733a('0xde'),{'UserId':Number(_0xf2b397[_0x733a('0x44')][_0x733a('0x69')]),'SmsAccountId':Number(_0xf2b397[_0x733a('0x56')]['id'])});}});}})[_0x733a('0x20')](respondWithStatusCode(_0x416ce1,null))['catch'](handleError(_0x416ce1,null));};exports['getAgents']=function(_0x36fbe6,_0x1cf937,_0x5a825d){var _0x23f3b1={};var _0x1e6757={};var _0x5eb6ce;var _0x4f8a5d;return db[_0x733a('0x3d')][_0x733a('0x67')]({'where':{'id':_0x36fbe6[_0x733a('0x56')]['id']}})['then'](handleEntityNotFound(_0x1cf937,null))['then'](function(_0x133160){if(_0x133160){_0x5eb6ce=_0x133160;_0x1e6757['model']=_[_0x733a('0x45')](db[_0x733a('0xa9')]['rawAttributes']);_0x1e6757[_0x733a('0x44')]=_['keys'](_0x36fbe6['query']);_0x1e6757[_0x733a('0x4d')]=_['intersection'](_0x1e6757[_0x733a('0x42')],_0x1e6757[_0x733a('0x44')]);_0x23f3b1[_0x733a('0x47')]=_[_0x733a('0x46')](_0x1e6757[_0x733a('0x42')],qs[_0x733a('0x58')](_0x36fbe6['query'][_0x733a('0x58')]));_0x23f3b1[_0x733a('0x47')]=_0x23f3b1[_0x733a('0x47')][_0x733a('0x59')]?_0x23f3b1['attributes']:_0x1e6757[_0x733a('0x42')];_0x23f3b1[_0x733a('0x4b')]=qs[_0x733a('0x4c')](_0x36fbe6[_0x733a('0x44')][_0x733a('0x4c')]);_0x23f3b1[_0x733a('0x50')]=qs[_0x733a('0x4d')](_[_0x733a('0x4e')](_0x36fbe6['query'],_0x1e6757[_0x733a('0x4d')]));if(_0x36fbe6[_0x733a('0x44')]['filter']){_0x23f3b1[_0x733a('0x50')]=_[_0x733a('0x5b')](_0x23f3b1['where'],{'$or':_[_0x733a('0x43')](_0x23f3b1[_0x733a('0x47')],function(_0x2c2e44){var _0x2e8ea6={};_0x2e8ea6[_0x2c2e44]={'$like':'%'+_0x36fbe6[_0x733a('0x44')][_0x733a('0x4f')]+'%'};return _0x2e8ea6;})});}_0x23f3b1=_['merge']({},_0x23f3b1,_0x36fbe6[_0x733a('0x5c')]);return _0x5eb6ce[_0x733a('0xdf')](_0x23f3b1);}})[_0x733a('0x20')](function(_0x483c66){if(_0x483c66){_0x4f8a5d=_0x483c66[_0x733a('0x59')];if(!_0x36fbe6[_0x733a('0x44')]['hasOwnProperty'](_0x733a('0xe0'))){_0x23f3b1[_0x733a('0x49')]=qs[_0x733a('0x49')](_0x36fbe6['query']['limit']);_0x23f3b1[_0x733a('0x4a')]=qs[_0x733a('0x4a')](_0x36fbe6[_0x733a('0x44')]['offset']);}return _0x5eb6ce[_0x733a('0xdf')](_0x23f3b1);}})[_0x733a('0x20')](function(_0x2fc90d){if(_0x2fc90d){return _0x2fc90d?{'count':_0x4f8a5d,'rows':_0x2fc90d}:null;}})[_0x733a('0x20')](respondWithResult(_0x1cf937,null))[_0x733a('0x2a')](handleError(_0x1cf937,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index e31ea72..2987697 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 _0x93d6=['remove','emit','hook','exports','events','SmsAccount','setMaxListeners','save'];(function(_0x5c7ea7,_0x4f7d6f){var _0x4c3cf1=function(_0x5d8516){while(--_0x5d8516){_0x5c7ea7['push'](_0x5c7ea7['shift']());}};_0x4c3cf1(++_0x4f7d6f);}(_0x93d6,0x10c));var _0x693d=function(_0x27f024,_0x5ade12){_0x27f024=_0x27f024-0x0;var _0x4410fd=_0x93d6[_0x27f024];return _0x4410fd;};'use strict';var EventEmitter=require(_0x693d('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x693d('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x693d('0x2')](0x0);var events={'afterCreate':_0x693d('0x3'),'afterUpdate':'update','afterDestroy':_0x693d('0x4')};function emitEvent(_0x40bfee){return function(_0x57e1bf,_0x5dcedd,_0x74a9ea){SmsAccountEvents['emit'](_0x40bfee+':'+_0x57e1bf['id'],_0x57e1bf);SmsAccountEvents[_0x693d('0x5')](_0x40bfee,_0x57e1bf);_0x74a9ea(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x693d('0x6')](e,emitEvent(event));}}module[_0x693d('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x0142=['setMaxListeners','save','remove','emit','hook','exports','../../mysqldb'];(function(_0x1437d9,_0x35f814){var _0x122630=function(_0x360d2d){while(--_0x360d2d){_0x1437d9['push'](_0x1437d9['shift']());}};_0x122630(++_0x35f814);}(_0x0142,0xe6));var _0x2014=function(_0x37269c,_0x40fae8){_0x37269c=_0x37269c-0x0;var _0x19869b=_0x0142[_0x37269c];return _0x19869b;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x2014('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x2014('0x1')](0x0);var events={'afterCreate':_0x2014('0x2'),'afterUpdate':'update','afterDestroy':_0x2014('0x3')};function emitEvent(_0x22ef48){return function(_0x48ff05,_0x46e3fa,_0x4a0d13){SmsAccountEvents[_0x2014('0x4')](_0x22ef48+':'+_0x48ff05['id'],_0x48ff05);SmsAccountEvents[_0x2014('0x4')](_0x22ef48,_0x48ff05);_0x4a0d13(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x2014('0x5')](e,emitEvent(event));}}module[_0x2014('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index d5668cb..604ada9 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 _0xcd69=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','SmsAccount','sms_accounts'];(function(_0x44a3c1,_0x2ee8da){var _0x1ce6cd=function(_0x1c4519){while(--_0x1c4519){_0x44a3c1['push'](_0x44a3c1['shift']());}};_0x1ce6cd(++_0x2ee8da);}(_0xcd69,0x16b));var _0x9cd6=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xcd69[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9cd6('0x0'))(_0x9cd6('0x1'));var moment=require(_0x9cd6('0x2'));var BPromise=require(_0x9cd6('0x3'));var rp=require(_0x9cd6('0x4'));var fs=require('fs');var path=require(_0x9cd6('0x5'));var rimraf=require(_0x9cd6('0x6'));var config=require(_0x9cd6('0x7'));var attributes=require(_0x9cd6('0x8'));module['exports']=function(_0x4952e7,_0x45deec){return _0x4952e7['define'](_0x9cd6('0x9'),attributes,{'tableName':_0x9cd6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71da=['bluebird','request-promise','path','../../config/environment','exports','define','SmsAccount','sms_accounts','util','api'];(function(_0xb77dfe,_0x39c4c7){var _0x5e4f5d=function(_0x49f1){while(--_0x49f1){_0xb77dfe['push'](_0xb77dfe['shift']());}};_0x5e4f5d(++_0x39c4c7);}(_0x71da,0x8a));var _0xa71d=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0x71da[_0x576266];return _0x18234f;};'use strict';var _=require('lodash');var util=require(_0xa71d('0x0'));var logger=require('../../config/logger')(_0xa71d('0x1'));var moment=require('moment');var BPromise=require(_0xa71d('0x2'));var rp=require(_0xa71d('0x3'));var fs=require('fs');var path=require(_0xa71d('0x4'));var rimraf=require('rimraf');var config=require(_0xa71d('0x5'));var attributes=require('./smsAccount.attributes');module[_0xa71d('0x6')]=function(_0x349e61,_0x2dedca){return _0x349e61[_0xa71d('0x7')](_0xa71d('0x8'),attributes,{'tableName':_0xa71d('0x9'),'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 78cddcc..c9245e8 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 _0x31d2=['attributes','include','map','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','find','options','raw','where'];(function(_0x1f652f,_0x20030d){var _0x314e5f=function(_0x2f3e51){while(--_0x2f3e51){_0x1f652f['push'](_0x1f652f['shift']());}};_0x314e5f(++_0x20030d);}(_0x31d2,0x180));var _0x231d=function(_0x6e0c08,_0x2c10e2){_0x6e0c08=_0x6e0c08-0x0;var _0x4e27a6=_0x31d2[_0x6e0c08];return _0x4e27a6;};'use strict';var _=require('lodash');var util=require(_0x231d('0x0'));var moment=require(_0x231d('0x1'));var BPromise=require('bluebird');var rs=require(_0x231d('0x2'));var fs=require('fs');var Redis=require(_0x231d('0x3'));var db=require(_0x231d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x231d('0x5'))(_0x231d('0x6'));var config=require(_0x231d('0x7'));var jayson=require(_0x231d('0x8'));var client=jayson[_0x231d('0x9')]['http']({'port':0x232a});config[_0x231d('0xa')]=_[_0x231d('0xb')](config[_0x231d('0xa')],{'host':_0x231d('0xc'),'port':0x18eb});var socket=require(_0x231d('0xd'))(new Redis(config[_0x231d('0xa')]));require(_0x231d('0xe'))[_0x231d('0xf')](socket);function respondWithRpcPromise(_0x476d92,_0x82c88c,_0x1f54a7){return new BPromise(function(_0x68d2bd,_0x155e42){return client[_0x231d('0x10')](_0x476d92,_0x1f54a7)[_0x231d('0x11')](function(_0x1b6fbe){logger[_0x231d('0x12')](_0x231d('0x13'),_0x82c88c,_0x231d('0x14'));logger[_0x231d('0x15')](_0x231d('0x16'),_0x82c88c,_0x231d('0x14'),JSON[_0x231d('0x17')](_0x1b6fbe));if(_0x1b6fbe[_0x231d('0x18')]){if(_0x1b6fbe['error'][_0x231d('0x19')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x82c88c,_0x1b6fbe[_0x231d('0x18')][_0x231d('0x1a')]);return _0x155e42(_0x1b6fbe[_0x231d('0x18')][_0x231d('0x1a')]);}logger[_0x231d('0x18')](_0x231d('0x13'),_0x82c88c,_0x1b6fbe['error'][_0x231d('0x1a')]);return _0x68d2bd(_0x1b6fbe[_0x231d('0x18')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x82c88c,_0x231d('0x14'));_0x68d2bd(_0x1b6fbe[_0x231d('0x1b')][_0x231d('0x1a')]);}})[_0x231d('0x1c')](function(_0x1ff17f){logger[_0x231d('0x18')]('SmsAccount,\x20%s,\x20%s',_0x82c88c,_0x1ff17f);_0x155e42(_0x1ff17f);});});}exports[_0x231d('0x1d')]=function(_0x4d004a){var _0x4a4b27=this;return new Promise(function(_0x28d7a9,_0x417e4a){return db['SmsAccount'][_0x231d('0x1e')]({'raw':_0x4d004a['options']?_0x4d004a[_0x231d('0x1f')][_0x231d('0x20')]===undefined?!![]:![]:!![],'where':_0x4d004a[_0x231d('0x1f')]?_0x4d004a[_0x231d('0x1f')][_0x231d('0x21')]||null:null,'attributes':_0x4d004a[_0x231d('0x1f')]?_0x4d004a['options'][_0x231d('0x22')]||null:null,'include':_0x4d004a[_0x231d('0x1f')]?_0x4d004a[_0x231d('0x1f')][_0x231d('0x23')]?_[_0x231d('0x24')](_0x4d004a[_0x231d('0x1f')][_0x231d('0x23')],function(_0x280d79){return{'model':db[_0x280d79[_0x231d('0x25')]],'as':_0x280d79['as'],'attributes':_0x280d79[_0x231d('0x22')],'include':_0x280d79[_0x231d('0x23')]?_[_0x231d('0x24')](_0x280d79[_0x231d('0x23')],function(_0x26ef61){return{'model':db[_0x26ef61[_0x231d('0x25')]],'as':_0x26ef61['as'],'attributes':_0x26ef61[_0x231d('0x22')],'include':_0x26ef61[_0x231d('0x23')]?_['map'](_0x26ef61[_0x231d('0x23')],function(_0x5950fb){return{'model':db[_0x5950fb[_0x231d('0x25')]],'as':_0x5950fb['as'],'attributes':_0x5950fb[_0x231d('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x409950){logger['info'](_0x231d('0x1d'),_0x4d004a);logger[_0x231d('0x15')](_0x231d('0x1d'),_0x4d004a,JSON[_0x231d('0x17')](_0x409950));_0x28d7a9(_0x409950);})[_0x231d('0x1c')](function(_0x1739c7){logger[_0x231d('0x18')](_0x231d('0x1d'),_0x1739c7[_0x231d('0x1a')],_0x4d004a);_0x417e4a(_0x4a4b27['error'](0x1f4,_0x1739c7[_0x231d('0x1a')]));});});}; \ No newline at end of file +var _0x3487=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./smsAccount.socket','register','info','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','ShowSmsAccount','SmsAccount','find','raw','options','where','attributes','include','map','model','then','stringify','lodash','util','moment'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x3487,0x8d));var _0x7348=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x3487[_0x616290];return _0x453879;};'use strict';var _=require(_0x7348('0x0'));var util=require(_0x7348('0x1'));var moment=require(_0x7348('0x2'));var BPromise=require(_0x7348('0x3'));var rs=require(_0x7348('0x4'));var fs=require('fs');var Redis=require(_0x7348('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7348('0x6'))(_0x7348('0x7'));var config=require(_0x7348('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7348('0x9')][_0x7348('0xa')]({'port':0x232a});config['redis']=_[_0x7348('0xb')](config[_0x7348('0xc')],{'host':_0x7348('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7348('0xc')]));require(_0x7348('0xe'))[_0x7348('0xf')](socket);function respondWithRpcPromise(_0x1b2682,_0x6d3f83,_0x4028d2){return new BPromise(function(_0x494ed7,_0x4e8d98){return client['request'](_0x1b2682,_0x4028d2)['then'](function(_0x5a1e7b){logger[_0x7348('0x10')](_0x7348('0x11'),_0x6d3f83,'request\x20sent');logger[_0x7348('0x12')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6d3f83,_0x7348('0x13'),JSON['stringify'](_0x5a1e7b));if(_0x5a1e7b[_0x7348('0x14')]){if(_0x5a1e7b[_0x7348('0x14')]['code']===0x1f4){logger['error'](_0x7348('0x11'),_0x6d3f83,_0x5a1e7b['error'][_0x7348('0x15')]);return _0x4e8d98(_0x5a1e7b[_0x7348('0x14')][_0x7348('0x15')]);}logger['error'](_0x7348('0x11'),_0x6d3f83,_0x5a1e7b['error'][_0x7348('0x15')]);return _0x494ed7(_0x5a1e7b[_0x7348('0x14')]['message']);}else{logger[_0x7348('0x10')](_0x7348('0x11'),_0x6d3f83,_0x7348('0x13'));_0x494ed7(_0x5a1e7b[_0x7348('0x16')][_0x7348('0x15')]);}})[_0x7348('0x17')](function(_0xcb80a1){logger[_0x7348('0x14')](_0x7348('0x11'),_0x6d3f83,_0xcb80a1);_0x4e8d98(_0xcb80a1);});});}exports[_0x7348('0x18')]=function(_0x3e206e){var _0x4101d6=this;return new Promise(function(_0x2c0d46,_0x2bcb6a){return db[_0x7348('0x19')][_0x7348('0x1a')]({'raw':_0x3e206e['options']?_0x3e206e['options'][_0x7348('0x1b')]===undefined?!![]:![]:!![],'where':_0x3e206e[_0x7348('0x1c')]?_0x3e206e[_0x7348('0x1c')][_0x7348('0x1d')]||null:null,'attributes':_0x3e206e[_0x7348('0x1c')]?_0x3e206e[_0x7348('0x1c')][_0x7348('0x1e')]||null:null,'include':_0x3e206e[_0x7348('0x1c')]?_0x3e206e[_0x7348('0x1c')][_0x7348('0x1f')]?_[_0x7348('0x20')](_0x3e206e[_0x7348('0x1c')][_0x7348('0x1f')],function(_0x12d002){return{'model':db[_0x12d002['model']],'as':_0x12d002['as'],'attributes':_0x12d002[_0x7348('0x1e')],'include':_0x12d002['include']?_[_0x7348('0x20')](_0x12d002[_0x7348('0x1f')],function(_0x4776a3){return{'model':db[_0x4776a3[_0x7348('0x21')]],'as':_0x4776a3['as'],'attributes':_0x4776a3[_0x7348('0x1e')],'include':_0x4776a3[_0x7348('0x1f')]?_[_0x7348('0x20')](_0x4776a3[_0x7348('0x1f')],function(_0x4b6421){return{'model':db[_0x4b6421[_0x7348('0x21')]],'as':_0x4b6421['as'],'attributes':_0x4b6421[_0x7348('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7348('0x22')](function(_0x4592fd){logger[_0x7348('0x10')](_0x7348('0x18'),_0x3e206e);logger[_0x7348('0x12')](_0x7348('0x18'),_0x3e206e,JSON[_0x7348('0x23')](_0x4592fd));_0x2c0d46(_0x4592fd);})[_0x7348('0x17')](function(_0x2cd28e){logger['error'](_0x7348('0x18'),_0x2cd28e[_0x7348('0x15')],_0x3e206e);_0x2bcb6a(_0x4101d6[_0x7348('0x14')](0x1f4,_0x2cd28e[_0x7348('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index b9f0f55..75652f9 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 _0x70a8=['remove','update','emit','removeListener','register'];(function(_0x9c9f5d,_0x5c8e94){var _0x205f51=function(_0x2c08ec){while(--_0x2c08ec){_0x9c9f5d['push'](_0x9c9f5d['shift']());}};_0x205f51(++_0x5c8e94);}(_0x70a8,0x1f4));var _0x870a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x70a8[_0x397e5f];return _0x5302b8;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save',_0x870a('0x0'),_0x870a('0x1')];function createListener(_0x4bb2bd,_0x32cc92){return function(_0x5450d8){_0x32cc92[_0x870a('0x2')](_0x4bb2bd,_0x5450d8);};}function removeListener(_0x5623fd,_0x3a3213){return function(){SmsAccountEvents[_0x870a('0x3')](_0x5623fd,_0x3a3213);};}exports[_0x870a('0x4')]=function(_0x14ff49){for(var _0x321a7b=0x0,_0x29f591=events['length'];_0x321a7b<_0x29f591;_0x321a7b++){var _0x2954e2=events[_0x321a7b];var _0x1df986=createListener('smsAccount:'+_0x2954e2,_0x14ff49);SmsAccountEvents['on'](_0x2954e2,_0x1df986);}}; \ No newline at end of file +var _0x751c=['./smsAccount.events','save','remove','removeListener','register','length','smsAccount:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x751c,0x69));var _0xc751=function(_0x57266f,_0x111e81){_0x57266f=_0x57266f-0x0;var _0x2a4083=_0x751c[_0x57266f];return _0x2a4083;};'use strict';var SmsAccountEvents=require(_0xc751('0x0'));var events=[_0xc751('0x1'),_0xc751('0x2'),'update'];function createListener(_0x65aded,_0x567128){return function(_0x2e9301){_0x567128['emit'](_0x65aded,_0x2e9301);};}function removeListener(_0x26b60d,_0x152802){return function(){SmsAccountEvents[_0xc751('0x3')](_0x26b60d,_0x152802);};}exports[_0xc751('0x4')]=function(_0x3b8c5a){for(var _0x562b89=0x0,_0x12d079=events[_0xc751('0x5')];_0x562b89<_0x12d079;_0x562b89++){var _0x527cf9=events[_0x562b89];var _0x363b18=createListener(_0xc751('0x6')+_0x527cf9,_0x3b8c5a);SmsAccountEvents['on'](_0x527cf9,_0x363b18);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index c45055f..b043cba 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 _0xba93=['connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0xd1a252,_0x16396f){var _0x560ee1=function(_0x35dd90){while(--_0x35dd90){_0xd1a252['push'](_0xd1a252['shift']());}};_0x560ee1(++_0x16396f);}(_0xba93,0xe7));var _0x3ba9=function(_0xdd6f76,_0xf7c748){_0xdd6f76=_0xdd6f76-0x0;var _0x1ff8a1=_0xba93[_0xdd6f76];return _0x1ff8a1;};'use strict';var multer=require(_0x3ba9('0x0'));var util=require(_0x3ba9('0x1'));var path=require(_0x3ba9('0x2'));var timeout=require(_0x3ba9('0x3'));var express=require('express');var router=express[_0x3ba9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3ba9('0x5'));var config=require(_0x3ba9('0x6'));var controller=require('./smsApplication.controller');router[_0x3ba9('0x7')]('/',auth[_0x3ba9('0x8')](),controller[_0x3ba9('0x9')]);router[_0x3ba9('0x7')](_0x3ba9('0xa'),auth[_0x3ba9('0x8')](),controller[_0x3ba9('0xb')]);router[_0x3ba9('0xc')]('/',auth[_0x3ba9('0x8')](),controller[_0x3ba9('0xd')]);router['put'](_0x3ba9('0xa'),auth['isAuthenticated'](),controller[_0x3ba9('0xe')]);router[_0x3ba9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3ba9('0x10')]);module[_0x3ba9('0x11')]=router; \ No newline at end of file +var _0xaac7=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','isAuthenticated','index','get','/:id','post','put','delete','destroy','multer','util'];(function(_0x28eafa,_0x54f0e3){var _0x2d96d9=function(_0x4f2be1){while(--_0x4f2be1){_0x28eafa['push'](_0x28eafa['shift']());}};_0x2d96d9(++_0x54f0e3);}(_0xaac7,0x11e));var _0x7aac=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0xaac7[_0xb1cf84];return _0x4bad2e;};'use strict';var multer=require(_0x7aac('0x0'));var util=require(_0x7aac('0x1'));var path=require(_0x7aac('0x2'));var timeout=require(_0x7aac('0x3'));var express=require(_0x7aac('0x4'));var router=express[_0x7aac('0x5')]();var auth=require(_0x7aac('0x6'));var interaction=require(_0x7aac('0x7'));var config=require(_0x7aac('0x8'));var controller=require(_0x7aac('0x9'));router['get']('/',auth[_0x7aac('0xa')](),controller[_0x7aac('0xb')]);router[_0x7aac('0xc')](_0x7aac('0xd'),auth[_0x7aac('0xa')](),controller['show']);router[_0x7aac('0xe')]('/',auth[_0x7aac('0xa')](),controller['create']);router[_0x7aac('0xf')](_0x7aac('0xd'),auth[_0x7aac('0xa')](),controller['update']);router[_0x7aac('0x10')](_0x7aac('0xd'),auth[_0x7aac('0xa')](),controller[_0x7aac('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 055d333..1851484 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 _0xd755=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x27ad60,_0x5c91c9){var _0x1ef090=function(_0x3bf0fa){while(--_0x3bf0fa){_0x27ad60['push'](_0x27ad60['shift']());}};_0x1ef090(++_0x5c91c9);}(_0xd755,0x1e9));var _0x5d75=function(_0x229cfd,_0x3d7b4c){_0x229cfd=_0x229cfd-0x0;var _0x5621a3=_0xd755[_0x229cfd];return _0x5621a3;};'use strict';var Sequelize=require(_0x5d75('0x0'));module[_0x5d75('0x1')]={'priority':{'type':Sequelize[_0x5d75('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5d75('0x3')],'allowNull':![],'defaultValue':_0x5d75('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5d75('0x3')]},'interval':{'type':Sequelize[_0x5d75('0x3')],'defaultValue':_0x5d75('0x5')}}; \ No newline at end of file +var _0xf7b9=['*,*,*,*','sequelize','INTEGER','STRING','TEXT'];(function(_0x1e4841,_0x200c1e){var _0x40c6ee=function(_0x15c05f){while(--_0x15c05f){_0x1e4841['push'](_0x1e4841['shift']());}};_0x40c6ee(++_0x200c1e);}(_0xf7b9,0x74));var _0x9f7b=function(_0x355f5f,_0xd9b86b){_0x355f5f=_0x355f5f-0x0;var _0x2bbaca=_0xf7b9[_0x355f5f];return _0x2bbaca;};'use strict';var Sequelize=require(_0x9f7b('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9f7b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9f7b('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9f7b('0x3')]()},'description':{'type':Sequelize[_0x9f7b('0x2')]},'interval':{'type':Sequelize[_0x9f7b('0x2')],'defaultValue':_0x9f7b('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 26bdb43..e00ee23 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 _0x4bec=['create','body','find','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','type','key','filters','model','attributes','intersection','query','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','params','keys','length','includeAll'];(function(_0x513f3c,_0x146723){var _0x37b196=function(_0x43dfb3){while(--_0x43dfb3){_0x513f3c['push'](_0x513f3c['shift']());}};_0x37b196(++_0x146723);}(_0x4bec,0xdc));var _0xc4be=function(_0x33f40e,_0x43c383){_0x33f40e=_0x33f40e-0x0;var _0x35c72d=_0x4bec[_0x33f40e];return _0x35c72d;};'use strict';var pdf=require(_0xc4be('0x0'));var emlformat=require(_0xc4be('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc4be('0x2'));var jsonpatch=require(_0xc4be('0x3'));var rp=require(_0xc4be('0x4'));var moment=require(_0xc4be('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc4be('0x6'));var util=require(_0xc4be('0x7'));var path=require(_0xc4be('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc4be('0x9'));var fs=require('fs');var _=require(_0xc4be('0xa'));var squel=require('squel');var crypto=require(_0xc4be('0xb'));var jsforce=require(_0xc4be('0xc'));var deskjs=require(_0xc4be('0xd'));var toCsv=require(_0xc4be('0xe'));var querystring=require('querystring');var Papa=require(_0xc4be('0xf'));var Redis=require(_0xc4be('0x10'));var authService=require(_0xc4be('0x11'));var qs=require(_0xc4be('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4be('0x13'));var logger=require(_0xc4be('0x14'))(_0xc4be('0x15'));var utils=require('../../config/utils');var config=require(_0xc4be('0x16'));var licenseUtil=require(_0xc4be('0x17'));var db=require(_0xc4be('0x18'))['db'];function respondWithStatusCode(_0x74bf32,_0x2bc750){_0x2bc750=_0x2bc750||0xcc;return function(_0xc54542){if(_0xc54542){return _0x74bf32[_0xc4be('0x19')](_0x2bc750);}return _0x74bf32[_0xc4be('0x1a')](_0x2bc750)['end']();};}function respondWithResult(_0x4e18ec,_0x3bc51f){_0x3bc51f=_0x3bc51f||0xc8;return function(_0x45187c){if(_0x45187c){return _0x4e18ec[_0xc4be('0x1a')](_0x3bc51f)[_0xc4be('0x1b')](_0x45187c);}};}function respondWithFilteredResult(_0x7680d2,_0xcdc9f5){return function(_0x525962){if(_0x525962){var _0x376769=_0x525962[_0xc4be('0x1c')],_0x129615=_0xcdc9f5['offset'],_0x43e811=_0xcdc9f5[_0xc4be('0x1d')]+_0xcdc9f5[_0xc4be('0x1e')],_0x1fec0f;if(_0x43e811>=_0x376769){_0x43e811=_0x376769;_0x1fec0f=0xc8;}else{_0x1fec0f=0xce;}_0x7680d2[_0xc4be('0x1a')](_0x1fec0f);return _0x7680d2['set'](_0xc4be('0x1f'),_0x129615+'-'+_0x43e811+'/'+_0x376769)['json'](_0x525962);}return null;};}function patchUpdates(_0x581fc6){return function(_0x2cf247){try{jsonpatch['apply'](_0x2cf247,_0x581fc6,!![]);}catch(_0x5f3d7f){return BPromise['reject'](_0x5f3d7f);}return _0x2cf247[_0xc4be('0x20')]();};}function saveUpdates(_0x3a7993,_0x3f16b7){return function(_0x2924c5){if(_0x2924c5){return _0x2924c5[_0xc4be('0x21')](_0x3a7993)[_0xc4be('0x22')](function(_0x2025a4){return _0x2025a4;});}return null;};}function removeEntity(_0x4cd94e,_0xf82f06){return function(_0x1b55d8){if(_0x1b55d8){return _0x1b55d8[_0xc4be('0x23')]()[_0xc4be('0x22')](function(){_0x4cd94e[_0xc4be('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x154250,_0x5ad5b6){return function(_0x1443c6){if(!_0x1443c6){_0x154250[_0xc4be('0x19')](0x194);}return _0x1443c6;};}function handleError(_0x590c8e,_0x5b3482){_0x5b3482=_0x5b3482||0x1f4;return function(_0xe60ae4){logger[_0xc4be('0x24')](_0xe60ae4[_0xc4be('0x25')]);if(_0xe60ae4['name']){delete _0xe60ae4[_0xc4be('0x26')];}_0x590c8e[_0xc4be('0x1a')](_0x5b3482)[_0xc4be('0x27')](_0xe60ae4);};}exports[_0xc4be('0x28')]=function(_0x1710fd,_0x2c8cb8){var _0x408fca={},_0xaa8aff={},_0x16411c={'count':0x0,'rows':[]};var _0x49d919=_[_0xc4be('0x29')](db[_0xc4be('0x2a')][_0xc4be('0x2b')],function(_0x2702a4){return{'name':_0x2702a4['fieldName'],'type':_0x2702a4[_0xc4be('0x2c')][_0xc4be('0x2d')]};});_0xaa8aff['model']=_[_0xc4be('0x29')](_0x49d919,_0xc4be('0x26'));_0xaa8aff['query']=_['keys'](_0x1710fd['query']);_0xaa8aff[_0xc4be('0x2e')]=_['intersection'](_0xaa8aff[_0xc4be('0x2f')],_0xaa8aff['query']);_0x408fca[_0xc4be('0x30')]=_[_0xc4be('0x31')](_0xaa8aff[_0xc4be('0x2f')],qs['fields'](_0x1710fd[_0xc4be('0x32')][_0xc4be('0x33')]));_0x408fca[_0xc4be('0x30')]=_0x408fca[_0xc4be('0x30')]['length']?_0x408fca[_0xc4be('0x30')]:_0xaa8aff[_0xc4be('0x2f')];if(!_0x1710fd[_0xc4be('0x32')][_0xc4be('0x34')]('nolimit')){_0x408fca[_0xc4be('0x1e')]=qs[_0xc4be('0x1e')](_0x1710fd[_0xc4be('0x32')][_0xc4be('0x1e')]);_0x408fca[_0xc4be('0x1d')]=qs['offset'](_0x1710fd['query'][_0xc4be('0x1d')]);}_0x408fca[_0xc4be('0x35')]=qs[_0xc4be('0x36')](_0x1710fd['query'][_0xc4be('0x36')]);_0x408fca['where']=qs[_0xc4be('0x2e')](_[_0xc4be('0x37')](_0x1710fd[_0xc4be('0x32')],_0xaa8aff[_0xc4be('0x2e')]),_0x49d919);if(_0x1710fd[_0xc4be('0x32')][_0xc4be('0x38')]){_0x408fca[_0xc4be('0x39')]=_['merge'](_0x408fca['where'],{'$or':_['map'](_0x49d919,function(_0x2d1abf){if(_0x2d1abf[_0xc4be('0x2c')]!==_0xc4be('0x3a')){var _0x4886cf={};_0x4886cf[_0x2d1abf[_0xc4be('0x26')]]={'$like':'%'+_0x1710fd[_0xc4be('0x32')]['filter']+'%'};return _0x4886cf;}})});}_0x408fca=_[_0xc4be('0x3b')]({},_0x408fca,_0x1710fd[_0xc4be('0x3c')]);var _0x437ed1={'where':_0x408fca['where']};return db[_0xc4be('0x2a')][_0xc4be('0x1c')](_0x437ed1)[_0xc4be('0x22')](function(_0x1566c9){_0x16411c[_0xc4be('0x1c')]=_0x1566c9;if(_0x1710fd[_0xc4be('0x32')]['includeAll']){_0x408fca[_0xc4be('0x3d')]=[{'all':!![]}];}return db[_0xc4be('0x2a')][_0xc4be('0x3e')](_0x408fca);})[_0xc4be('0x22')](function(_0x4cb898){_0x16411c[_0xc4be('0x3f')]=_0x4cb898;return _0x16411c;})[_0xc4be('0x22')](respondWithFilteredResult(_0x2c8cb8,_0x408fca))['catch'](handleError(_0x2c8cb8,null));};exports['show']=function(_0x5e9065,_0x11bffb){var _0x1ac509={'raw':!![],'where':{'id':_0x5e9065[_0xc4be('0x40')]['id']}},_0x5aae93={};_0x5aae93['model']=_[_0xc4be('0x41')](db[_0xc4be('0x2a')][_0xc4be('0x2b')]);_0x5aae93[_0xc4be('0x32')]=_[_0xc4be('0x41')](_0x5e9065[_0xc4be('0x32')]);_0x5aae93[_0xc4be('0x2e')]=_[_0xc4be('0x31')](_0x5aae93[_0xc4be('0x2f')],_0x5aae93[_0xc4be('0x32')]);_0x1ac509[_0xc4be('0x30')]=_['intersection'](_0x5aae93[_0xc4be('0x2f')],qs['fields'](_0x5e9065[_0xc4be('0x32')][_0xc4be('0x33')]));_0x1ac509[_0xc4be('0x30')]=_0x1ac509[_0xc4be('0x30')][_0xc4be('0x42')]?_0x1ac509[_0xc4be('0x30')]:_0x5aae93[_0xc4be('0x2f')];if(_0x5e9065[_0xc4be('0x32')][_0xc4be('0x43')]){_0x1ac509[_0xc4be('0x3d')]=[{'all':!![]}];}_0x1ac509=_['merge']({},_0x1ac509,_0x5e9065['options']);return db['SmsApplication']['find'](_0x1ac509)[_0xc4be('0x22')](handleEntityNotFound(_0x11bffb,null))[_0xc4be('0x22')](respondWithResult(_0x11bffb,null))['catch'](handleError(_0x11bffb,null));};exports[_0xc4be('0x44')]=function(_0x4f9b04,_0x3a4c33){return db[_0xc4be('0x2a')]['create'](_0x4f9b04[_0xc4be('0x45')],{})[_0xc4be('0x22')](respondWithResult(_0x3a4c33,0xc9))['catch'](handleError(_0x3a4c33,null));};exports[_0xc4be('0x21')]=function(_0x38887f,_0x2dc5fa){if(_0x38887f[_0xc4be('0x45')]['id']){delete _0x38887f[_0xc4be('0x45')]['id'];}return db[_0xc4be('0x2a')][_0xc4be('0x46')]({'where':{'id':_0x38887f[_0xc4be('0x40')]['id']}})[_0xc4be('0x22')](handleEntityNotFound(_0x2dc5fa,null))['then'](saveUpdates(_0x38887f[_0xc4be('0x45')],null))[_0xc4be('0x22')](respondWithResult(_0x2dc5fa,null))[_0xc4be('0x47')](handleError(_0x2dc5fa,null));};exports[_0xc4be('0x23')]=function(_0x2a9c93,_0x25776a){return db[_0xc4be('0x2a')]['find']({'where':{'id':_0x2a9c93[_0xc4be('0x40')]['id']}})[_0xc4be('0x22')](handleEntityNotFound(_0x25776a,null))[_0xc4be('0x22')](removeEntity(_0x25776a,null))[_0xc4be('0x47')](handleError(_0x25776a,null));}; \ No newline at end of file +var _0xbd49=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','update','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x4c8060,_0xc3c3c0){var _0x2ada40=function(_0x4f1779){while(--_0x4f1779){_0x4c8060['push'](_0x4c8060['shift']());}};_0x2ada40(++_0xc3c3c0);}(_0xbd49,0x86));var _0x9bd4=function(_0x42a575,_0x27f96f){_0x42a575=_0x42a575-0x0;var _0x27856e=_0xbd49[_0x42a575];return _0x27856e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9bd4('0x0'));var zipdir=require(_0x9bd4('0x1'));var jsonpatch=require(_0x9bd4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9bd4('0x3'));var Mustache=require(_0x9bd4('0x4'));var util=require(_0x9bd4('0x5'));var path=require('path');var sox=require(_0x9bd4('0x6'));var csv=require(_0x9bd4('0x7'));var ejs=require(_0x9bd4('0x8'));var fs=require('fs');var _=require(_0x9bd4('0x9'));var squel=require(_0x9bd4('0xa'));var crypto=require('crypto');var jsforce=require(_0x9bd4('0xb'));var deskjs=require(_0x9bd4('0xc'));var toCsv=require(_0x9bd4('0x7'));var querystring=require(_0x9bd4('0xd'));var Papa=require(_0x9bd4('0xe'));var Redis=require('ioredis');var authService=require(_0x9bd4('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9bd4('0x10'));var logger=require(_0x9bd4('0x11'))(_0x9bd4('0x12'));var utils=require(_0x9bd4('0x13'));var config=require(_0x9bd4('0x14'));var licenseUtil=require(_0x9bd4('0x15'));var db=require(_0x9bd4('0x16'))['db'];function respondWithStatusCode(_0x3baca1,_0x1486b7){_0x1486b7=_0x1486b7||0xcc;return function(_0x35aff9){if(_0x35aff9){return _0x3baca1[_0x9bd4('0x17')](_0x1486b7);}return _0x3baca1[_0x9bd4('0x18')](_0x1486b7)['end']();};}function respondWithResult(_0x303cdc,_0x15a400){_0x15a400=_0x15a400||0xc8;return function(_0x3dbe50){if(_0x3dbe50){return _0x303cdc['status'](_0x15a400)[_0x9bd4('0x19')](_0x3dbe50);}};}function respondWithFilteredResult(_0x15e5f2,_0x3f94d1){return function(_0x25fd07){if(_0x25fd07){var _0x396ee6=_0x25fd07['count'],_0x39274b=_0x3f94d1[_0x9bd4('0x1a')],_0x4d4553=_0x3f94d1[_0x9bd4('0x1a')]+_0x3f94d1['limit'],_0x3f913f;if(_0x4d4553>=_0x396ee6){_0x4d4553=_0x396ee6;_0x3f913f=0xc8;}else{_0x3f913f=0xce;}_0x15e5f2['status'](_0x3f913f);return _0x15e5f2[_0x9bd4('0x1b')](_0x9bd4('0x1c'),_0x39274b+'-'+_0x4d4553+'/'+_0x396ee6)[_0x9bd4('0x19')](_0x25fd07);}return null;};}function patchUpdates(_0x1c6b50){return function(_0x1c5302){try{jsonpatch[_0x9bd4('0x1d')](_0x1c5302,_0x1c6b50,!![]);}catch(_0xb06fa8){return BPromise[_0x9bd4('0x1e')](_0xb06fa8);}return _0x1c5302[_0x9bd4('0x1f')]();};}function saveUpdates(_0x47bbb1,_0x24b691){return function(_0x371a09){if(_0x371a09){return _0x371a09['update'](_0x47bbb1)[_0x9bd4('0x20')](function(_0x13b809){return _0x13b809;});}return null;};}function removeEntity(_0x5ef6e7,_0x499447){return function(_0x4e5ae1){if(_0x4e5ae1){return _0x4e5ae1[_0x9bd4('0x21')]()[_0x9bd4('0x20')](function(){_0x5ef6e7[_0x9bd4('0x18')](0xcc)[_0x9bd4('0x22')]();});}};}function handleEntityNotFound(_0x357fe8,_0x550c95){return function(_0x25277d){if(!_0x25277d){_0x357fe8[_0x9bd4('0x17')](0x194);}return _0x25277d;};}function handleError(_0x3b2444,_0x5da3c3){_0x5da3c3=_0x5da3c3||0x1f4;return function(_0x4c64aa){logger[_0x9bd4('0x23')](_0x4c64aa['stack']);if(_0x4c64aa[_0x9bd4('0x24')]){delete _0x4c64aa[_0x9bd4('0x24')];}_0x3b2444[_0x9bd4('0x18')](_0x5da3c3)[_0x9bd4('0x25')](_0x4c64aa);};}exports[_0x9bd4('0x26')]=function(_0x224479,_0x1117df){var _0x208133={},_0x4eae95={},_0x4a84b2={'count':0x0,'rows':[]};var _0x1a54d6=_[_0x9bd4('0x27')](db[_0x9bd4('0x28')][_0x9bd4('0x29')],function(_0x16192c){return{'name':_0x16192c[_0x9bd4('0x2a')],'type':_0x16192c[_0x9bd4('0x2b')][_0x9bd4('0x2c')]};});_0x4eae95[_0x9bd4('0x2d')]=_['map'](_0x1a54d6,'name');_0x4eae95[_0x9bd4('0x2e')]=_[_0x9bd4('0x2f')](_0x224479['query']);_0x4eae95[_0x9bd4('0x30')]=_[_0x9bd4('0x31')](_0x4eae95[_0x9bd4('0x2d')],_0x4eae95[_0x9bd4('0x2e')]);_0x208133[_0x9bd4('0x32')]=_[_0x9bd4('0x31')](_0x4eae95['model'],qs['fields'](_0x224479['query'][_0x9bd4('0x33')]));_0x208133[_0x9bd4('0x32')]=_0x208133[_0x9bd4('0x32')]['length']?_0x208133[_0x9bd4('0x32')]:_0x4eae95['model'];if(!_0x224479[_0x9bd4('0x2e')][_0x9bd4('0x34')]('nolimit')){_0x208133[_0x9bd4('0x35')]=qs[_0x9bd4('0x35')](_0x224479['query'][_0x9bd4('0x35')]);_0x208133['offset']=qs['offset'](_0x224479[_0x9bd4('0x2e')][_0x9bd4('0x1a')]);}_0x208133[_0x9bd4('0x36')]=qs[_0x9bd4('0x37')](_0x224479['query']['sort']);_0x208133[_0x9bd4('0x38')]=qs[_0x9bd4('0x30')](_[_0x9bd4('0x39')](_0x224479[_0x9bd4('0x2e')],_0x4eae95[_0x9bd4('0x30')]),_0x1a54d6);if(_0x224479[_0x9bd4('0x2e')][_0x9bd4('0x3a')]){_0x208133[_0x9bd4('0x38')]=_[_0x9bd4('0x3b')](_0x208133[_0x9bd4('0x38')],{'$or':_['map'](_0x1a54d6,function(_0x5b314e){if(_0x5b314e[_0x9bd4('0x2b')]!==_0x9bd4('0x3c')){var _0x25fadc={};_0x25fadc[_0x5b314e[_0x9bd4('0x24')]]={'$like':'%'+_0x224479['query'][_0x9bd4('0x3a')]+'%'};return _0x25fadc;}})});}_0x208133=_['merge']({},_0x208133,_0x224479['options']);var _0x2b682d={'where':_0x208133[_0x9bd4('0x38')]};return db[_0x9bd4('0x28')][_0x9bd4('0x3d')](_0x2b682d)[_0x9bd4('0x20')](function(_0x27abcd){_0x4a84b2['count']=_0x27abcd;if(_0x224479[_0x9bd4('0x2e')][_0x9bd4('0x3e')]){_0x208133['include']=[{'all':!![]}];}return db[_0x9bd4('0x28')][_0x9bd4('0x3f')](_0x208133);})[_0x9bd4('0x20')](function(_0x4b118f){_0x4a84b2[_0x9bd4('0x40')]=_0x4b118f;return _0x4a84b2;})[_0x9bd4('0x20')](respondWithFilteredResult(_0x1117df,_0x208133))[_0x9bd4('0x41')](handleError(_0x1117df,null));};exports[_0x9bd4('0x42')]=function(_0x1b5fd5,_0xfc132e){var _0xb4e7d6={'raw':!![],'where':{'id':_0x1b5fd5[_0x9bd4('0x43')]['id']}},_0x277062={};_0x277062[_0x9bd4('0x2d')]=_['keys'](db[_0x9bd4('0x28')][_0x9bd4('0x29')]);_0x277062[_0x9bd4('0x2e')]=_['keys'](_0x1b5fd5[_0x9bd4('0x2e')]);_0x277062['filters']=_[_0x9bd4('0x31')](_0x277062[_0x9bd4('0x2d')],_0x277062[_0x9bd4('0x2e')]);_0xb4e7d6[_0x9bd4('0x32')]=_['intersection'](_0x277062[_0x9bd4('0x2d')],qs[_0x9bd4('0x33')](_0x1b5fd5[_0x9bd4('0x2e')][_0x9bd4('0x33')]));_0xb4e7d6['attributes']=_0xb4e7d6['attributes'][_0x9bd4('0x44')]?_0xb4e7d6[_0x9bd4('0x32')]:_0x277062[_0x9bd4('0x2d')];if(_0x1b5fd5[_0x9bd4('0x2e')][_0x9bd4('0x3e')]){_0xb4e7d6[_0x9bd4('0x45')]=[{'all':!![]}];}_0xb4e7d6=_['merge']({},_0xb4e7d6,_0x1b5fd5[_0x9bd4('0x46')]);return db[_0x9bd4('0x28')][_0x9bd4('0x47')](_0xb4e7d6)[_0x9bd4('0x20')](handleEntityNotFound(_0xfc132e,null))['then'](respondWithResult(_0xfc132e,null))[_0x9bd4('0x41')](handleError(_0xfc132e,null));};exports[_0x9bd4('0x48')]=function(_0xb6a945,_0x1a8283){return db[_0x9bd4('0x28')][_0x9bd4('0x48')](_0xb6a945[_0x9bd4('0x49')],{})[_0x9bd4('0x20')](respondWithResult(_0x1a8283,0xc9))[_0x9bd4('0x41')](handleError(_0x1a8283,null));};exports[_0x9bd4('0x4a')]=function(_0x48c15f,_0x16a90b){if(_0x48c15f[_0x9bd4('0x49')]['id']){delete _0x48c15f[_0x9bd4('0x49')]['id'];}return db[_0x9bd4('0x28')][_0x9bd4('0x47')]({'where':{'id':_0x48c15f[_0x9bd4('0x43')]['id']}})['then'](handleEntityNotFound(_0x16a90b,null))['then'](saveUpdates(_0x48c15f[_0x9bd4('0x49')],null))[_0x9bd4('0x20')](respondWithResult(_0x16a90b,null))[_0x9bd4('0x41')](handleError(_0x16a90b,null));};exports[_0x9bd4('0x21')]=function(_0x36329a,_0x3e829a){return db[_0x9bd4('0x28')]['find']({'where':{'id':_0x36329a[_0x9bd4('0x43')]['id']}})[_0x9bd4('0x20')](handleEntityNotFound(_0x3e829a,null))[_0x9bd4('0x20')](removeEntity(_0x3e829a,null))[_0x9bd4('0x41')](handleError(_0x3e829a,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 9ce2742..203079e 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 _0x29c3=['sms_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','SmsApplication'];(function(_0x424939,_0x1d73ac){var _0x205af5=function(_0x31ecf4){while(--_0x31ecf4){_0x424939['push'](_0x424939['shift']());}};_0x205af5(++_0x1d73ac);}(_0x29c3,0x1cb));var _0x329c=function(_0x2cbd0a,_0x2e3f2a){_0x2cbd0a=_0x2cbd0a-0x0;var _0x223ac9=_0x29c3[_0x2cbd0a];return _0x223ac9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x329c('0x0'))(_0x329c('0x1'));var moment=require(_0x329c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x329c('0x3'));var rimraf=require(_0x329c('0x4'));var config=require(_0x329c('0x5'));var attributes=require('./smsApplication.attributes');module[_0x329c('0x6')]=function(_0x23762f,_0x43a518){return _0x23762f[_0x329c('0x7')](_0x329c('0x8'),attributes,{'tableName':_0x329c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x329c('0xa'),'collate':_0x329c('0xb')});}; \ No newline at end of file +var _0xc27e=['exports','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x47a8c0,_0x4d5931){var _0x551fa1=function(_0x45ac5a){while(--_0x45ac5a){_0x47a8c0['push'](_0x47a8c0['shift']());}};_0x551fa1(++_0x4d5931);}(_0xc27e,0xba));var _0xec27=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc27e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xec27('0x0'));var util=require(_0xec27('0x1'));var logger=require(_0xec27('0x2'))(_0xec27('0x3'));var moment=require(_0xec27('0x4'));var BPromise=require(_0xec27('0x5'));var rp=require(_0xec27('0x6'));var fs=require('fs');var path=require(_0xec27('0x7'));var rimraf=require(_0xec27('0x8'));var config=require(_0xec27('0x9'));var attributes=require('./smsApplication.attributes');module[_0xec27('0xa')]=function(_0x5f1296,_0xe81461){return _0x5f1296['define']('SmsApplication',attributes,{'tableName':_0xec27('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xec27('0xc'),'collate':_0xec27('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 06b8919..d984498 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 _0x106f=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird'];(function(_0x9fc922,_0x1b72e9){var _0x170ccb=function(_0xb08662){while(--_0xb08662){_0x9fc922['push'](_0x9fc922['shift']());}};_0x170ccb(++_0x1b72e9);}(_0x106f,0x162));var _0xf106=function(_0x478b34,_0x484bda){_0x478b34=_0x478b34-0x0;var _0xd36963=_0x106f[_0x478b34];return _0xd36963;};'use strict';var _=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var moment=require('moment');var BPromise=require(_0xf106('0x2'));var rs=require(_0xf106('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf106('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf106('0x5'))(_0xf106('0x6'));var config=require(_0xf106('0x7'));var jayson=require(_0xf106('0x8'));var client=jayson[_0xf106('0x9')][_0xf106('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc9588d,_0x546acc,_0x4ea3b8){return new BPromise(function(_0x3ac1bd,_0x5ea4f0){return client['request'](_0xc9588d,_0x4ea3b8)['then'](function(_0x4bd78d){logger['info'](_0xf106('0xb'),_0x546acc,_0xf106('0xc'));logger[_0xf106('0xd')](_0xf106('0xe'),_0x546acc,_0xf106('0xc'),JSON[_0xf106('0xf')](_0x4bd78d));if(_0x4bd78d[_0xf106('0x10')]){if(_0x4bd78d[_0xf106('0x10')][_0xf106('0x11')]===0x1f4){logger[_0xf106('0x10')](_0xf106('0xb'),_0x546acc,_0x4bd78d['error'][_0xf106('0x12')]);return _0x5ea4f0(_0x4bd78d[_0xf106('0x10')]['message']);}logger['error'](_0xf106('0xb'),_0x546acc,_0x4bd78d[_0xf106('0x10')][_0xf106('0x12')]);return _0x3ac1bd(_0x4bd78d['error'][_0xf106('0x12')]);}else{logger[_0xf106('0x13')](_0xf106('0xb'),_0x546acc,'request\x20sent');_0x3ac1bd(_0x4bd78d[_0xf106('0x14')][_0xf106('0x12')]);}})['catch'](function(_0x134f6d){logger[_0xf106('0x10')](_0xf106('0xb'),_0x546acc,_0x134f6d);_0x5ea4f0(_0x134f6d);});});} \ No newline at end of file +var _0xf3ff=['error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x383bdb,_0x51b3a7){var _0x24ed7f=function(_0x3a256b){while(--_0x3a256b){_0x383bdb['push'](_0x383bdb['shift']());}};_0x24ed7f(++_0x51b3a7);}(_0xf3ff,0xae));var _0xff3f=function(_0x50437d,_0x330016){_0x50437d=_0x50437d-0x0;var _0x1e344a=_0xf3ff[_0x50437d];return _0x1e344a;};'use strict';var _=require(_0xff3f('0x0'));var util=require('util');var moment=require(_0xff3f('0x1'));var BPromise=require(_0xff3f('0x2'));var rs=require(_0xff3f('0x3'));var fs=require('fs');var Redis=require(_0xff3f('0x4'));var db=require(_0xff3f('0x5'))['db'];var utils=require(_0xff3f('0x6'));var logger=require('../../config/logger')(_0xff3f('0x7'));var config=require(_0xff3f('0x8'));var jayson=require(_0xff3f('0x9'));var client=jayson['client'][_0xff3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45a86f,_0x5568d0,_0x465c8a){return new BPromise(function(_0x1543bf,_0x5c1d76){return client['request'](_0x45a86f,_0x465c8a)['then'](function(_0x34df96){logger['info'](_0xff3f('0xb'),_0x5568d0,'request\x20sent');logger[_0xff3f('0xc')](_0xff3f('0xd'),_0x5568d0,_0xff3f('0xe'),JSON[_0xff3f('0xf')](_0x34df96));if(_0x34df96[_0xff3f('0x10')]){if(_0x34df96[_0xff3f('0x10')][_0xff3f('0x11')]===0x1f4){logger[_0xff3f('0x10')](_0xff3f('0xb'),_0x5568d0,_0x34df96[_0xff3f('0x10')]['message']);return _0x5c1d76(_0x34df96['error'][_0xff3f('0x12')]);}logger[_0xff3f('0x10')](_0xff3f('0xb'),_0x5568d0,_0x34df96['error']['message']);return _0x1543bf(_0x34df96[_0xff3f('0x10')]['message']);}else{logger['info'](_0xff3f('0xb'),_0x5568d0,_0xff3f('0xe'));_0x1543bf(_0x34df96['result'][_0xff3f('0x12')]);}})['catch'](function(_0x129647){logger['error'](_0xff3f('0xb'),_0x5568d0,_0x129647);_0x5c1d76(_0x129647);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 8162661..ecc379b 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 _0x507d=['removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','smsinteraction:destroy','destroy','delete','/:id/tags'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x507d,0x178));var _0xd507=function(_0x497c14,_0x317176){_0x497c14=_0x497c14-0x0;var _0x3cc8d7=_0x507d[_0x497c14];return _0x3cc8d7;};'use strict';var multer=require('multer');var util=require(_0xd507('0x0'));var path=require(_0xd507('0x1'));var timeout=require(_0xd507('0x2'));var express=require(_0xd507('0x3'));var router=express[_0xd507('0x4')]();var auth=require(_0xd507('0x5'));var interaction=require(_0xd507('0x6'));var config=require(_0xd507('0x7'));var controller=require(_0xd507('0x8'));router[_0xd507('0x9')]('/',auth[_0xd507('0xa')](),controller[_0xd507('0xb')]);router[_0xd507('0x9')]('/describe',auth[_0xd507('0xa')](),controller[_0xd507('0xc')]);router[_0xd507('0x9')](_0xd507('0xd'),auth[_0xd507('0xa')](),controller[_0xd507('0xe')]);router[_0xd507('0x9')]('/:id/messages',auth[_0xd507('0xa')](),controller[_0xd507('0xf')]);router[_0xd507('0x9')](_0xd507('0x10'),auth[_0xd507('0xa')](),controller[_0xd507('0x11')]);router[_0xd507('0x12')]('/',auth[_0xd507('0xa')](),controller[_0xd507('0x13')]);router['post'](_0xd507('0x14'),auth[_0xd507('0xa')](),controller[_0xd507('0x15')]);router[_0xd507('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xd507('0x16')](_0xd507('0x17'),_0xd507('0x18')),controller[_0xd507('0x19')]);router[_0xd507('0x1a')](_0xd507('0xd'),auth[_0xd507('0xa')](),interaction['tracked'](_0xd507('0x17'),_0xd507('0x1b')),controller['update']);router['delete'](_0xd507('0xd'),auth[_0xd507('0xa')](),interaction['tracked']('sms',_0xd507('0x1c')),controller[_0xd507('0x1d')]);router[_0xd507('0x1e')](_0xd507('0x1f'),auth[_0xd507('0xa')](),controller[_0xd507('0x20')]);module[_0xd507('0x21')]=router; \ No newline at end of file +var _0xc294=['smsinteraction:destroy','destroy','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','put','sms','smsinteraction:update','update'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xc294,0xec));var _0x4c29=function(_0x2820fc,_0x481318){_0x2820fc=_0x2820fc-0x0;var _0x1e1508=_0xc294[_0x2820fc];return _0x1e1508;};'use strict';var multer=require(_0x4c29('0x0'));var util=require(_0x4c29('0x1'));var path=require(_0x4c29('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x4c29('0x3'));var interaction=require(_0x4c29('0x4'));var config=require('../../config/environment');var controller=require(_0x4c29('0x5'));router[_0x4c29('0x6')]('/',auth[_0x4c29('0x7')](),controller[_0x4c29('0x8')]);router[_0x4c29('0x6')](_0x4c29('0x9'),auth['isAuthenticated'](),controller[_0x4c29('0xa')]);router[_0x4c29('0x6')](_0x4c29('0xb'),auth[_0x4c29('0x7')](),controller[_0x4c29('0xc')]);router[_0x4c29('0x6')](_0x4c29('0xd'),auth[_0x4c29('0x7')](),controller['getMessages']);router[_0x4c29('0x6')](_0x4c29('0xe'),auth[_0x4c29('0x7')](),controller[_0x4c29('0xf')]);router[_0x4c29('0x10')]('/',auth[_0x4c29('0x7')](),controller[_0x4c29('0x11')]);router[_0x4c29('0x10')](_0x4c29('0xd'),auth['isAuthenticated'](),controller[_0x4c29('0x12')]);router[_0x4c29('0x10')](_0x4c29('0x13'),auth[_0x4c29('0x7')](),interaction[_0x4c29('0x14')]('sms','smsinteraction:addtags'),controller['addTags']);router[_0x4c29('0x15')](_0x4c29('0xb'),auth[_0x4c29('0x7')](),interaction['tracked'](_0x4c29('0x16'),_0x4c29('0x17')),controller[_0x4c29('0x18')]);router['delete']('/:id',auth[_0x4c29('0x7')](),interaction[_0x4c29('0x14')](_0x4c29('0x16'),_0x4c29('0x19')),controller[_0x4c29('0x1a')]);router[_0x4c29('0x1b')](_0x4c29('0x13'),auth['isAuthenticated'](),controller['removeTags']);module[_0x4c29('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 6f61a25..28aae44 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 _0x0d91=['ENUM','moment','DATE','STRING'];(function(_0x5079f6,_0x2e0e35){var _0x3c41c7=function(_0x50a20f){while(--_0x50a20f){_0x5079f6['push'](_0x5079f6['shift']());}};_0x3c41c7(++_0x2e0e35);}(_0x0d91,0xad));var _0x10d9=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x0d91[_0x2ec2bf];return _0x2c279c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x10d9('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x10d9('0x1')]},'disposition':{'type':Sequelize[_0x10d9('0x2')]},'secondDisposition':{'type':Sequelize[_0x10d9('0x2')]},'thirdDisposition':{'type':Sequelize[_0x10d9('0x2')]},'note':{'type':Sequelize[_0x10d9('0x2')]},'phone':{'type':Sequelize[_0x10d9('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x10d9('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x10d9('0x3')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x943d=['ENUM','out','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x5e5cc8,_0x18a32a){var _0xef6ff0=function(_0x238b19){while(--_0x238b19){_0x5e5cc8['push'](_0x5e5cc8['shift']());}};_0xef6ff0(++_0x18a32a);}(_0x943d,0xbf));var _0xd943=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x943d[_0x2f87cd];return _0x5d7eda;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd943('0x0'));module[_0xd943('0x1')]={'closed':{'type':Sequelize[_0xd943('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd943('0x3')]},'disposition':{'type':Sequelize[_0xd943('0x4')]},'secondDisposition':{'type':Sequelize[_0xd943('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd943('0x4')]},'note':{'type':Sequelize[_0xd943('0x4')]},'phone':{'type':Sequelize[_0xd943('0x4')]},'read1stAt':{'type':Sequelize[_0xd943('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd943('0x5')]('in',_0xd943('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd943('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd943('0x6')),'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 051d0d9..0431ffc 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 _0xaf86=['crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','pick','select','field','color','tools_tags','u.id','u.fullname','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','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?','ContactId','buildExpression','text','Tag','union','User','operator','UserId','start','body','compact','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','role','sequelize','toString','keyBy','merge','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','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','limit','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','params','keys','rawAttributes','includeAll','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','sort','findAll','spread','removeTags','download','unix','root','server','files','tmp','join','format','transcript-%d-%s.zip','CmContact','lastName','Messages','secret','SmsAccount','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','\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','Account','N.A.','closed','YYYY-MM-DD\x20HH:mm:ss','disposition','direction','out','System','firstName','renderFile','views','toFile','transcript-','.pdf','unlinkSync','sendStatus','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash'];(function(_0x2335e5,_0x2703a7){var _0x3e5b5d=function(_0x51cc8b){while(--_0x51cc8b){_0x2335e5['push'](_0x2335e5['shift']());}};_0x3e5b5d(++_0x2703a7);}(_0xaf86,0x1ca));var _0x6af8=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0xaf86[_0x2fbcf6];return _0x3e7265;};'use strict';var pdf=require(_0x6af8('0x0'));var emlformat=require(_0x6af8('0x1'));var rimraf=require(_0x6af8('0x2'));var zipdir=require(_0x6af8('0x3'));var jsonpatch=require(_0x6af8('0x4'));var rp=require('request-promise');var moment=require(_0x6af8('0x5'));var BPromise=require(_0x6af8('0x6'));var Mustache=require('mustache');var util=require(_0x6af8('0x7'));var path=require(_0x6af8('0x8'));var sox=require(_0x6af8('0x9'));var csv=require(_0x6af8('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6af8('0xb'));var squel=require('squel');var crypto=require(_0x6af8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6af8('0xd'));var toCsv=require(_0x6af8('0xa'));var querystring=require(_0x6af8('0xe'));var Papa=require('papaparse');var Redis=require(_0x6af8('0xf'));var authService=require(_0x6af8('0x10'));var qs=require(_0x6af8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6af8('0x12'));var logger=require('../../config/logger')(_0x6af8('0x13'));var utils=require(_0x6af8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6af8('0x15'));var db=require(_0x6af8('0x16'))['db'];config[_0x6af8('0x17')]=_[_0x6af8('0x18')](config['redis'],{'host':_0x6af8('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6af8('0x17')]));require(_0x6af8('0x1a'))[_0x6af8('0x1b')](socket);function respondWithStatusCode(_0x3ac9d1,_0x489665){_0x489665=_0x489665||0xcc;return function(_0x4f4923){if(_0x4f4923){return _0x3ac9d1['sendStatus'](_0x489665);}return _0x3ac9d1[_0x6af8('0x1c')](_0x489665)[_0x6af8('0x1d')]();};}function respondWithResult(_0x6058e7,_0x3bd814){_0x3bd814=_0x3bd814||0xc8;return function(_0x4faa43){if(_0x4faa43){return _0x6058e7[_0x6af8('0x1c')](_0x3bd814)[_0x6af8('0x1e')](_0x4faa43);}};}function respondWithFilteredResult(_0xa393f8,_0x3cd5c3){return function(_0x13f238){if(_0x13f238){var _0x2325f4=_0x13f238[_0x6af8('0x1f')],_0x11c422=_0x3cd5c3['offset'],_0x15025f=_0x3cd5c3[_0x6af8('0x20')]+_0x3cd5c3['limit'],_0x22ecd2;if(_0x15025f>=_0x2325f4){_0x15025f=_0x2325f4;_0x22ecd2=0xc8;}else{_0x22ecd2=0xce;}_0xa393f8[_0x6af8('0x1c')](_0x22ecd2);return _0xa393f8[_0x6af8('0x21')](_0x6af8('0x22'),_0x11c422+'-'+_0x15025f+'/'+_0x2325f4)[_0x6af8('0x1e')](_0x13f238);}return null;};}function patchUpdates(_0x16f83f){return function(_0x365eea){try{jsonpatch[_0x6af8('0x23')](_0x365eea,_0x16f83f,!![]);}catch(_0x3041fc){return BPromise[_0x6af8('0x24')](_0x3041fc);}return _0x365eea[_0x6af8('0x25')]();};}function saveUpdates(_0xfddd79,_0x4c1268){return function(_0x428b7f){if(_0x428b7f){return _0x428b7f[_0x6af8('0x26')](_0xfddd79)[_0x6af8('0x27')](function(_0x55b3f5){return _0x55b3f5;});}return null;};}function removeEntity(_0xda2264,_0x13c429){return function(_0x34c08b){if(_0x34c08b){return _0x34c08b[_0x6af8('0x28')]()['then'](function(){_0xda2264[_0x6af8('0x1c')](0xcc)[_0x6af8('0x1d')]();});}};}function handleEntityNotFound(_0x3c402f,_0x1e80e1){return function(_0x1bd3fc){if(!_0x1bd3fc){_0x3c402f['sendStatus'](0x194);}return _0x1bd3fc;};}function handleError(_0x363d6b,_0x38cd48){_0x38cd48=_0x38cd48||0x1f4;return function(_0x43e968){logger[_0x6af8('0x29')](_0x43e968[_0x6af8('0x2a')]);if(_0x43e968[_0x6af8('0x2b')]){delete _0x43e968[_0x6af8('0x2b')];}_0x363d6b[_0x6af8('0x1c')](_0x38cd48)[_0x6af8('0x2c')](_0x43e968);};}function getInteractionUsers(_0x117159,_0x1e7499){return new BPromise(function(_0x37df62,_0x15dc30){try{if(_0x1e7499[_0x117159['id']]){_0x117159[_0x6af8('0x2d')]=_[_0x6af8('0x2e')](_0x1e7499[_0x117159['id']],function(_0x2ee48b){return{'id':_0x2ee48b['id'],'fullname':_0x2ee48b[_0x6af8('0x2f')]};});}}catch(_0x2a810b){_0x15dc30(_0x2a810b);}_0x37df62(_0x117159);});}function getInteractionTags(_0x4b285d,_0x1b8813){return new BPromise(function(_0x26175b,_0x2926f0){try{if(_0x4b285d[_0x6af8('0x30')]){_0x4b285d[_0x6af8('0x31')]=[];_0x4b285d[_0x6af8('0x30')][_0x6af8('0x32')](',')[_0x6af8('0x33')](function(_0x122058){_0x4b285d[_0x6af8('0x31')][_0x6af8('0x34')](_0x1b8813[_0x122058]);});}delete _0x4b285d[_0x6af8('0x30')];}catch(_0x32dcfb){_0x2926f0(_0x32dcfb);}_0x26175b(_0x4b285d);});}function updateSmsInteraction(_0x4ec196,_0x49a08b,_0x21d904){return new BPromise(function(_0x3bc3f9,_0x695642){return getInteractionUsers(_0x4ec196,_0x21d904)['then'](function(_0x4528ec){return getInteractionTags(_0x4528ec,_0x49a08b);})['then'](function(_0x374b86){_0x3bc3f9(_0x374b86);})[_0x6af8('0x35')](function(_0x1725c1){_0x695642(_0x1725c1);});});}exports[_0x6af8('0x36')]=function(_0x5b3cfa,_0x194a3e){var _0x5e5e74={},_0x47a104={},_0xce3f0a={'count':0x0,'rows':[]};var _0x3d9c19=_[_0x6af8('0x2e')](db[_0x6af8('0x37')]['rawAttributes'],function(_0x853f77){return{'name':_0x853f77[_0x6af8('0x38')],'type':_0x853f77[_0x6af8('0x39')][_0x6af8('0x3a')]};});_0x47a104['model']=_[_0x6af8('0x2e')](_0x3d9c19,_0x6af8('0x2b'));_0x47a104[_0x6af8('0x3b')]=_['keys'](_0x5b3cfa[_0x6af8('0x3b')]);_0x47a104[_0x6af8('0x3c')]=_[_0x6af8('0x3d')](_0x47a104['model'],_0x47a104[_0x6af8('0x3b')]);_0x5e5e74[_0x6af8('0x3e')]=_[_0x6af8('0x3d')](_0x47a104[_0x6af8('0x3f')],qs[_0x6af8('0x40')](_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x40')]));_0x5e5e74[_0x6af8('0x3e')]=_0x5e5e74[_0x6af8('0x3e')][_0x6af8('0x41')]?_0x5e5e74['attributes']:_0x47a104[_0x6af8('0x3f')];if(!_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x42')](_0x6af8('0x43'))){_0x5e5e74['limit']=qs['limit'](_0x5b3cfa[_0x6af8('0x3b')]['limit']);_0x5e5e74[_0x6af8('0x20')]=qs['offset'](_0x5b3cfa['query'][_0x6af8('0x20')]);}_0x5e5e74[_0x6af8('0x44')]=qs['sort'](_0x5b3cfa[_0x6af8('0x3b')]['sort']);_0x5e5e74[_0x6af8('0x45')]=qs[_0x6af8('0x3c')](_[_0x6af8('0x46')](_0x5b3cfa[_0x6af8('0x3b')],_0x47a104[_0x6af8('0x3c')]),_0x3d9c19);var _0x364d6d=[];var _0x21a8b6=squel[_0x6af8('0x47')]()['field']('id')['field'](_0x6af8('0x2b'))[_0x6af8('0x48')](_0x6af8('0x49'))['from'](_0x6af8('0x4a'));var _0x21574c=squel['select']()[_0x6af8('0x48')](_0x6af8('0x4b'))[_0x6af8('0x48')](_0x6af8('0x4c'))[_0x6af8('0x48')]('ui.SmsInteractionId')[_0x6af8('0x4d')](_0x6af8('0x4e'),'ui')[_0x6af8('0x4f')](_0x6af8('0x50'),'u',_0x6af8('0x51'));var _0x3fdbcc=squel[_0x6af8('0x47')]()[_0x6af8('0x4d')](_0x6af8('0x52'),'i')[_0x6af8('0x4f')](_0x6af8('0x53'),'c',_0x6af8('0x54'))['left_join'](_0x6af8('0x50'),'o',_0x6af8('0x55'))[_0x6af8('0x4f')](_0x6af8('0x56'),'a',_0x6af8('0x57'))[_0x6af8('0x4f')](_0x6af8('0x58'),'me',_0x6af8('0x59'))[_0x6af8('0x4f')]('sms_interaction_has_tags','it',_0x6af8('0x5a'))[_0x6af8('0x4f')](_0x6af8('0x4a'),'t',_0x6af8('0x5b'));var _0x2b0021=squel[_0x6af8('0x5c')]();var _0x3d7185=[];var _0x329f57=squel['expr']();var _0x4cacc7;if(_0x5b3cfa['query'][_0x6af8('0x5d')]){_0x4cacc7=as[_0x6af8('0x5e')](_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x5d')]);var _0x1db15c=_0x4cacc7[_0x6af8('0x5f')];for(var _0x58b5f0=0x0;_0x58b5f0<_0x4cacc7[_0x6af8('0x60')][_0x6af8('0x41')];_0x58b5f0++){var _0x24bc76=_0x4cacc7[_0x6af8('0x60')][_0x58b5f0];var _0x4794fa='i';var _0x4f4559=_[_0x6af8('0x61')](_0x3d9c19,[_0x6af8('0x2b'),_0x24bc76[_0x6af8('0x48')]]);if(!_0x4f4559){switch(_0x24bc76[_0x6af8('0x48')]){case _0x6af8('0x62'):if(_0x24bc76[_0x6af8('0x63')]==0x1){_0x3fdbcc[_0x6af8('0x64')]('`'+_0x24bc76[_0x6af8('0x48')]+'`\x20=\x200');}else{_0x3fdbcc[_0x6af8('0x64')]('`'+_0x24bc76[_0x6af8('0x48')]+_0x6af8('0x65'));}break;case _0x6af8('0x66'):if(_0x24bc76['operator']===_0x6af8('0x67')){if(_0x24bc76[_0x6af8('0x63')][_0x6af8('0x32')]('\x20')['length']>0x1){_0x2b0021[_0x1db15c](_0x6af8('0x68'),qs[_0x6af8('0x69')](_0x24bc76[_0x6af8('0x63')]),null);}else{var _0xdb2001='%'+_0x24bc76['value']+'%';_0x2b0021[_0x1db15c](_0x6af8('0x6a'),_0xdb2001,_0xdb2001,_0xdb2001);}}else{_0x4f4559=_[_0x6af8('0x61')](_0x3d9c19,[_0x6af8('0x2b'),_0x6af8('0x6b')]);_0x24bc76[_0x6af8('0x48')]=_0x6af8('0x6b');_0x1e9486=as[_0x6af8('0x6c')](_0x4794fa,_0x4f4559[_0x6af8('0x39')],_0x24bc76);_0x2b0021[_0x1db15c](_0x1e9486[_0x6af8('0x6d')],_0x1e9486[_0x6af8('0x63')]['start'],_0x1e9486['value'][_0x6af8('0x1d')]);}break;case _0x6af8('0x6e'):var _0x539fa2=_0x24bc76[_0x6af8('0x63')][_0x6af8('0x32')](',')[_0x6af8('0x2e')](function(_0x5a2280){return Number(_0x5a2280);});_0x539fa2['forEach'](function(_0x65a69a){_0x329f57['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x65a69a+',%');});_0x3d7185=_[_0x6af8('0x6f')](_0x3d7185,_0x539fa2);break;case _0x6af8('0x70'):if(_0x24bc76[_0x6af8('0x71')]===_0x6af8('0x67')){_0x2b0021[_0x1db15c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x24bc76['value']+'%',null);}else{_0x4f4559=_['find'](_0x3d9c19,['name',_0x6af8('0x72')]);_0x24bc76[_0x6af8('0x48')]=_0x6af8('0x72');_0x1e9486=as[_0x6af8('0x6c')](_0x4794fa,_0x4f4559[_0x6af8('0x39')],_0x24bc76);_0x2b0021[_0x1db15c](_0x1e9486[_0x6af8('0x6d')],_0x1e9486[_0x6af8('0x63')][_0x6af8('0x73')],_0x1e9486[_0x6af8('0x63')][_0x6af8('0x1d')]);}break;case _0x6af8('0x74'):_0x1e9486=as[_0x6af8('0x6c')]('me',null,_0x24bc76);_0x2b0021[_0x1db15c](_0x1e9486[_0x6af8('0x6d')],_0x1e9486[_0x6af8('0x63')][_0x6af8('0x73')],_0x1e9486['value']['end']);break;}}else{var _0x1e9486=as[_0x6af8('0x6c')](_0x4794fa,_0x4f4559[_0x6af8('0x39')],_0x24bc76);_0x2b0021[_0x1db15c](_0x1e9486[_0x6af8('0x6d')],_0x1e9486[_0x6af8('0x63')]['start'],_0x1e9486[_0x6af8('0x63')][_0x6af8('0x1d')]);}}}else{var _0x5619d1=_(_0x5b3cfa[_0x6af8('0x3b')])['keys']()[_0x6af8('0x2e')](function(_0x41e5a2){return _['some'](_0x3d9c19,[_0x6af8('0x2b'),_0x41e5a2])?_0x41e5a2:undefined;})[_0x6af8('0x75')]()[_0x6af8('0x63')]();if(!_['isEmpty'](_0x5619d1)){_0x5619d1[_0x6af8('0x33')](function(_0x31fbfa){if(_0x31fbfa==='SmsAccountId'){_0x3fdbcc[_0x6af8('0x45')](_0x6af8('0x76'),[][_0x6af8('0x77')](_0x5b3cfa['query'][_0x31fbfa]));}else if(_0x31fbfa===_0x6af8('0x78')){var _0x5333d8=JSON[_0x6af8('0x79')](_0x5b3cfa[_0x6af8('0x3b')][_0x31fbfa])[_0x6af8('0x7a')];var _0x3b1a34=JSON[_0x6af8('0x79')](_0x5b3cfa['query'][_0x31fbfa])[_0x6af8('0x7b')];_0x3fdbcc[_0x6af8('0x45')](_0x6af8('0x7c'),_0x5333d8,_0x3b1a34);}else{if(_0x5b3cfa[_0x6af8('0x3b')][_0x31fbfa]===_0x6af8('0x7d')){_0x3fdbcc[_0x6af8('0x45')]('i.'+_0x31fbfa+_0x6af8('0x7e'));}else{_0x3fdbcc[_0x6af8('0x45')]('i.'+_0x31fbfa+_0x6af8('0x7f'),_0x5b3cfa[_0x6af8('0x3b')][_0x31fbfa]);}}});}if(_0x5b3cfa['query'][_0x6af8('0x80')]){if(_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x80')]==0x1){_0x3fdbcc['having']('`unreadMessages`\x20=\x200');}else{_0x3fdbcc[_0x6af8('0x64')](_0x6af8('0x81'));}}if(_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x82')]){_0x3d7185=_['isArray'](_0x5b3cfa[_0x6af8('0x3b')]['tag'])?_0x5b3cfa[_0x6af8('0x3b')]['tag']:new Array(_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x82')]);_0x3d7185[_0x6af8('0x33')](function(_0x8c9573){_0x329f57['or'](_0x6af8('0x83'),'%,'+_0x8c9573+',%');});}if(_0x5b3cfa[_0x6af8('0x3b')]['filter']){var _0x44632b=_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x84')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x6af8('0x85')](_0x44632b)){_0x2b0021['or'](_0x6af8('0x86'),_0x44632b+'%')['or'](_0x6af8('0x87'),_0x44632b+'%');}else{_0x2b0021['or'](_0x6af8('0x88'),qs['getFullTextValue'](_0x44632b))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x44632b+'%');}}}_0x3fdbcc[_0x6af8('0x45')](_0x2b0021);_0x3fdbcc['group'](_0x6af8('0x89'));var _0x159a4c={'type':db[_0x6af8('0x8a')][_0x6af8('0x8b')][_0x6af8('0x8c')],'raw':!![]};var _0x4e2727=_0x3fdbcc['clone']();_0x4e2727['field'](_0x6af8('0x89'));_0x4e2727[_0x6af8('0x48')](_0x6af8('0x8d'),_0x6af8('0x62'));if(_0x5e5e74['order']){_0x5e5e74[_0x6af8('0x44')][_0x6af8('0x33')](function(_0x34d0e0){var _0x490665=_0x34d0e0[0x0]===_0x6af8('0x8e')?_0x34d0e0[0x0]:'i.'+_0x34d0e0[0x0];_0x3fdbcc[_0x6af8('0x44')](_0x490665,_0x34d0e0[0x1]===_0x6af8('0x8f')?![]:!![]);});}if(!_[_0x6af8('0x90')](_0x3d7185)){_0x3fdbcc['having'](_0x329f57);_0x4e2727[_0x6af8('0x45')](_0x6af8('0x91'),_0x3d7185);}BPromise[_0x6af8('0x92')]()[_0x6af8('0x27')](function(){if(!_0x4cacc7){if(_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x93')]||_0x5b3cfa[_0x6af8('0x3b')]['journey'])return;_0x4e2727[_0x6af8('0x45')](_0x6af8('0x94'));_0x3fdbcc[_0x6af8('0x45')](_0x6af8('0x94'));return;}if(_0x5b3cfa[_0x6af8('0x95')]['role']!==_0x6af8('0x96'))return;return _0x5b3cfa[_0x6af8('0x95')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x3f0358){if(_[_0x6af8('0x90')](_0x3f0358)){_0x4e2727[_0x6af8('0x45')]('i.SmsAccountId\x20IS\x20NULL');_0x3fdbcc[_0x6af8('0x45')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x4e2727[_0x6af8('0x45')](_0x6af8('0x76'),_['map'](_0x3f0358,'id'));_0x3fdbcc[_0x6af8('0x45')]('i.SmsAccountId\x20IN\x20?',_[_0x6af8('0x2e')](_0x3f0358,'id'));}});})[_0x6af8('0x27')](function(){if(_0x5b3cfa[_0x6af8('0x95')][_0x6af8('0x97')]===_0x6af8('0x96')&&!_0x4cacc7&&!_0x5b3cfa['query'][_0x6af8('0x93')])return[];return db[_0x6af8('0x98')][_0x6af8('0x3b')](_0x4e2727[_0x6af8('0x99')](),_0x159a4c);})[_0x6af8('0x27')](function(_0x5688c2){_0xce3f0a[_0x6af8('0x1f')]=_0x5688c2[_0x6af8('0x41')];if(_0xce3f0a['count']===0x0)return[];return db[_0x6af8('0x98')][_0x6af8('0x3b')](_0x21a8b6[_0x6af8('0x99')](),_0x159a4c)['then'](function(_0x119346){_0x364d6d=_[_0x6af8('0x9a')](_0x119346,'id');_0x159a4c=_[_0x6af8('0x9b')](_0x159a4c,{'model':db[_0x6af8('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5b3cfa[_0x6af8('0x3b')]['fields']){_0x5e5e74[_0x6af8('0x3e')][_0x6af8('0x33')](function(_0x118d46){_0x3fdbcc[_0x6af8('0x48')]('i.'+_0x118d46);});}else{_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0x8d'),_0x6af8('0x62'));_0x3fdbcc['field'](_0x6af8('0x9c'),_0x6af8('0x9d'));_0x3fdbcc[_0x6af8('0x48')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0x9e'),_0x6af8('0x8e'));_0x3fdbcc['field'](_0x6af8('0x9f'));_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0xa0'),_0x6af8('0xa1'));_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0xa2'),_0x6af8('0xa3'));_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0xa4'),_0x6af8('0xa5'));_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0xa6'),_0x6af8('0xa7'));_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0xa8'),_0x6af8('0xa9'));_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0xaa'),_0x6af8('0xab'));_0x3fdbcc[_0x6af8('0x48')]('o.fullname','Owner.fullname');_0x3fdbcc[_0x6af8('0x48')]('o.internal','Owner.internal');_0x3fdbcc[_0x6af8('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x6af8('0x30'));}if(_0x5e5e74[_0x6af8('0xac')])_0x3fdbcc[_0x6af8('0xac')](_0x5e5e74[_0x6af8('0xac')]);if(_0x5e5e74[_0x6af8('0x20')])_0x3fdbcc[_0x6af8('0x20')](_0x5e5e74[_0x6af8('0x20')]);return db['sequelize'][_0x6af8('0x3b')](_0x3fdbcc[_0x6af8('0x99')](),_0x159a4c);})[_0x6af8('0x27')](function(_0x493666){_0x21574c[_0x6af8('0x45')](_0x6af8('0xad'),_[_0x6af8('0x2e')](_0x493666,'id'));return db[_0x6af8('0x98')]['query'](_0x21574c[_0x6af8('0x99')](),_0x159a4c)[_0x6af8('0x27')](function(_0x41d783){var _0xf2508=_[_0x6af8('0xae')](_0x41d783,_0x6af8('0xaf'));var _0x4972c7=[];_0x493666[_0x6af8('0x33')](function(_0x145bb2){_0x4972c7['push'](updateSmsInteraction(_0x145bb2,_0x364d6d,_0xf2508));});return BPromise[_0x6af8('0xb0')](_0x4972c7);});});})['then'](function(_0x21c9f5){_0xce3f0a[_0x6af8('0xb1')]=_0x21c9f5;return _0xce3f0a;})[_0x6af8('0x27')](respondWithFilteredResult(_0x194a3e,_0x5e5e74))['catch'](handleError(_0x194a3e,null));};exports['show']=function(_0x326bb2,_0x306002){var _0xb1cee8={'raw':![],'where':{'id':_0x326bb2[_0x6af8('0xb2')]['id']}},_0x1ee36e={};_0x1ee36e[_0x6af8('0x3f')]=_[_0x6af8('0xb3')](db[_0x6af8('0x37')][_0x6af8('0xb4')]);_0x1ee36e[_0x6af8('0x3b')]=_[_0x6af8('0xb3')](_0x326bb2[_0x6af8('0x3b')]);_0x1ee36e[_0x6af8('0x3c')]=_[_0x6af8('0x3d')](_0x1ee36e[_0x6af8('0x3f')],_0x1ee36e['query']);_0xb1cee8[_0x6af8('0x3e')]=_[_0x6af8('0x3d')](_0x1ee36e[_0x6af8('0x3f')],qs[_0x6af8('0x40')](_0x326bb2[_0x6af8('0x3b')][_0x6af8('0x40')]));_0xb1cee8[_0x6af8('0x3e')]=_0xb1cee8[_0x6af8('0x3e')]['length']?_0xb1cee8['attributes']:_0x1ee36e[_0x6af8('0x3f')];if(_0x326bb2[_0x6af8('0x3b')][_0x6af8('0xb5')]){_0xb1cee8['include']=[{'all':!![]}];}_0xb1cee8=_[_0x6af8('0x9b')]({},_0xb1cee8,_0x326bb2[_0x6af8('0xb6')]);return db['SmsInteraction'][_0x6af8('0x61')](_0xb1cee8)['then'](handleEntityNotFound(_0x306002,null))[_0x6af8('0x27')](respondWithResult(_0x306002,null))[_0x6af8('0x35')](handleError(_0x306002,null));};exports[_0x6af8('0xb7')]=function(_0x25576f,_0x5ef053){return db[_0x6af8('0x37')][_0x6af8('0xb7')](_0x25576f['body'],{})[_0x6af8('0x27')](respondWithResult(_0x5ef053,0xc9))['catch'](handleError(_0x5ef053,null));};exports[_0x6af8('0x26')]=function(_0x13146f,_0x22e5e0){if(_0x13146f[_0x6af8('0x74')]['id']){delete _0x13146f['body']['id'];}return db[_0x6af8('0x37')][_0x6af8('0x61')]({'where':{'id':_0x13146f[_0x6af8('0xb2')]['id']}})[_0x6af8('0x27')](handleEntityNotFound(_0x22e5e0,null))[_0x6af8('0x27')](saveUpdates(_0x13146f['body'],null))[_0x6af8('0x27')](respondWithResult(_0x22e5e0,null))[_0x6af8('0x35')](handleError(_0x22e5e0,null));};exports[_0x6af8('0x28')]=function(_0x416ce5,_0x1564c8){return db[_0x6af8('0x37')][_0x6af8('0x61')]({'where':{'id':_0x416ce5[_0x6af8('0xb2')]['id']}})[_0x6af8('0x27')](handleEntityNotFound(_0x1564c8,null))[_0x6af8('0x27')](removeEntity(_0x1564c8,null))[_0x6af8('0x35')](handleError(_0x1564c8,null));};exports[_0x6af8('0xb8')]=function(_0x663f93,_0x20023f){return db[_0x6af8('0x37')]['describe']()[_0x6af8('0x27')](respondWithResult(_0x20023f,null))[_0x6af8('0x35')](handleError(_0x20023f,null));};exports[_0x6af8('0xb9')]=function(_0x192e9e,_0x723943,_0x2868b4){return db[_0x6af8('0xba')][_0x6af8('0x61')]({'where':{'id':_0x192e9e['params']['id']}})[_0x6af8('0x27')](handleEntityNotFound(_0x723943,null))['then'](function(_0x11a881){if(_0x11a881){return _0x11a881[_0x6af8('0xb9')](_0x192e9e[_0x6af8('0x74')][_0x6af8('0xbb')],_[_0x6af8('0xbc')](_0x192e9e['body'],[_0x6af8('0xbb'),'id'])||{});}})[_0x6af8('0x27')](respondWithResult(_0x723943,null))[_0x6af8('0x35')](handleError(_0x723943,null));};exports[_0x6af8('0xbd')]=function(_0x10d4e2,_0x22576a,_0x3678aa){var _0x107c05={'raw':![],'where':{}};var _0x4827ea={};var _0x1de744={'count':0x0,'rows':[]};return db[_0x6af8('0x37')][_0x6af8('0xbe')]({'where':{'id':_0x10d4e2[_0x6af8('0xb2')]['id']}})[_0x6af8('0x27')](handleEntityNotFound(_0x22576a,null))[_0x6af8('0x27')](function(_0x18c513){if(_0x18c513){_0x4827ea[_0x6af8('0x3f')]=_[_0x6af8('0xb3')](db[_0x6af8('0xba')]['rawAttributes']);_0x4827ea[_0x6af8('0x3b')]=_['keys'](_0x10d4e2[_0x6af8('0x3b')]);_0x4827ea[_0x6af8('0x3c')]=_[_0x6af8('0x3d')](_0x4827ea[_0x6af8('0x3f')],_0x4827ea[_0x6af8('0x3b')]);_0x107c05['attributes']=_[_0x6af8('0x3d')](_0x4827ea['model'],qs[_0x6af8('0x40')](_0x10d4e2[_0x6af8('0x3b')][_0x6af8('0x40')]));_0x107c05[_0x6af8('0x3e')]=_0x107c05[_0x6af8('0x3e')][_0x6af8('0x41')]?_0x107c05['attributes']:_0x4827ea[_0x6af8('0x3f')];if(!_0x10d4e2['query'][_0x6af8('0x42')]('nolimit')){_0x107c05[_0x6af8('0xac')]=qs['limit'](_0x10d4e2[_0x6af8('0x3b')][_0x6af8('0xac')]);_0x107c05[_0x6af8('0x20')]=qs['offset'](_0x10d4e2[_0x6af8('0x3b')][_0x6af8('0x20')]);}_0x107c05['order']=qs[_0x6af8('0xbf')](_0x10d4e2[_0x6af8('0x3b')]['sort']);_0x107c05['where']=qs[_0x6af8('0x3c')](_[_0x6af8('0x46')](_0x10d4e2[_0x6af8('0x3b')],_0x4827ea[_0x6af8('0x3c')]));_0x107c05[_0x6af8('0x45')]['SmsInteractionId']=_0x18c513['id'];if(_0x10d4e2['query']['filter']){_0x107c05[_0x6af8('0x45')]=_[_0x6af8('0x9b')](_0x107c05[_0x6af8('0x45')],{'$or':_[_0x6af8('0x2e')](_0x107c05['attributes'],function(_0x35c26a){var _0x553e55={};_0x553e55[_0x35c26a]={'$like':'%'+_0x10d4e2['query'][_0x6af8('0x84')]+'%'};return _0x553e55;})});}if(_0x10d4e2[_0x6af8('0x3b')][_0x6af8('0x7a')]){var _0x12064e=_0x10d4e2[_0x6af8('0x3b')][_0x6af8('0x7a')][_0x6af8('0x32')](',');var _0xb770d9={};_0xb770d9[_0x12064e[0x0]]={'$gte':moment(_0x12064e[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x107c05[_0x6af8('0x45')]=_[_0x6af8('0x9b')](_0x107c05[_0x6af8('0x45')],_0xb770d9);}_0x107c05=_[_0x6af8('0x9b')]({},_0x107c05,_0x10d4e2[_0x6af8('0xb6')]);return db[_0x6af8('0xba')][_0x6af8('0x1f')]({'where':_0x107c05[_0x6af8('0x45')]})[_0x6af8('0x27')](function(_0x4ec737){_0x1de744['count']=_0x4ec737;if(_0x10d4e2['query'][_0x6af8('0xb5')]){_0x107c05['include']=[{'all':!![]}];}return db[_0x6af8('0xba')][_0x6af8('0xc0')](_0x107c05);})[_0x6af8('0x27')](function(_0x36b70c){_0x1de744['rows']=_0x36b70c;return _0x1de744;});}})[_0x6af8('0x27')](respondWithFilteredResult(_0x22576a,_0x107c05))[_0x6af8('0x35')](handleError(_0x22576a,null));};exports['addTags']=function(_0x45e358,_0x243b51,_0x17ef3a){return db[_0x6af8('0x37')][_0x6af8('0x61')]({'where':{'id':_0x45e358[_0x6af8('0xb2')]['id']}})[_0x6af8('0x27')](handleEntityNotFound(_0x243b51,null))[_0x6af8('0x27')](function(_0x1684a0){if(_0x1684a0){return _0x1684a0['setTags'](_0x45e358['body'][_0x6af8('0xbb')],_[_0x6af8('0xbc')](_0x45e358[_0x6af8('0x74')],[_0x6af8('0xbb'),'id'])||{})[_0x6af8('0xc1')](function(){return db[_0x6af8('0x6e')][_0x6af8('0xc0')]({'attributes':['id',_0x6af8('0x2b'),_0x6af8('0x49')],'where':{'id':_0x45e358[_0x6af8('0x74')][_0x6af8('0xbb')]}});})[_0x6af8('0x27')](function(_0x1c3959){socket['emit']('smsInteractionTags:save',{'id':Number(_0x45e358[_0x6af8('0xb2')]['id']),'tags':_0x1c3959||[]});return{'id':Number(_0x45e358[_0x6af8('0xb2')]['id']),'tags':_0x1c3959||[]};});}})['then'](respondWithResult(_0x243b51,null))[_0x6af8('0x35')](handleError(_0x243b51,null));};exports[_0x6af8('0xc2')]=function(_0x1c6711,_0x4f51c0,_0x4df977){return db[_0x6af8('0x37')][_0x6af8('0x61')]({'where':{'id':_0x1c6711['params']['id']}})['then'](handleEntityNotFound(_0x4f51c0,null))[_0x6af8('0x27')](function(_0x5ce2a5){if(_0x5ce2a5){return _0x5ce2a5['removeTags'](_0x1c6711[_0x6af8('0x3b')][_0x6af8('0xbb')]);}})['then'](respondWithStatusCode(_0x4f51c0,null))[_0x6af8('0x35')](handleError(_0x4f51c0,null));};exports[_0x6af8('0xc3')]=function(_0x2b007f,_0x12af44){var _0x4a6f36=moment()[_0x6af8('0xc4')]()[_0x6af8('0x99')]();var _0x3ffd39=path['join'](config[_0x6af8('0xc5')],_0x6af8('0xc6'),_0x6af8('0xc7'),_0x6af8('0xc8'));var _0x4d2388=path[_0x6af8('0xc9')](config[_0x6af8('0xc5')],_0x6af8('0xc6'),_0x6af8('0xc7'),'attachments');var _0x106541=path[_0x6af8('0xc9')](_0x3ffd39,_0x4a6f36);var _0x41ac3a=util[_0x6af8('0xca')](_0x6af8('0xcb'),_0x2b007f['params']['id'],_0x4a6f36);var _0x5f4a9f=path[_0x6af8('0xc9')](_0x3ffd39,_0x41ac3a);var _0x5740f4=[];_0x5740f4[_0x6af8('0x34')]({'model':db[_0x6af8('0x70')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x5740f4[_0x6af8('0x34')]({'model':db[_0x6af8('0xcc')],'as':'Contact','attributes':['id','firstName',_0x6af8('0xcd')],'raw':!![]});var _0x3ecda5=[{'model':db[_0x6af8('0xba')],'as':_0x6af8('0xce'),'attributes':['id',_0x6af8('0x74'),_0x6af8('0x78'),'direction',_0x6af8('0xcf'),'read'],'include':_0x5740f4}];_0x3ecda5[_0x6af8('0x34')]({'model':db[_0x6af8('0xd0')],'as':'Account','attributes':['id',_0x6af8('0x2b')]});_0x3ecda5[_0x6af8('0x34')]({'model':db[_0x6af8('0x70')],'as':_0x6af8('0xd1'),'attributes':['id',_0x6af8('0x2f')]});return db[_0x6af8('0x37')]['find']({'where':{'id':_0x2b007f['params']['id']},'include':_0x3ecda5})[_0x6af8('0x27')](handleEntityNotFound(_0x12af44,null))['then'](function(_0x17130c){if(_0x17130c){var _0x7c9272=_0x17130c[_0x6af8('0xd2')]({'plain':!![]});fs[_0x6af8('0xd3')](_0x106541);var _0x4c60c3={'format':'A4','border':_0x6af8('0xd4'),'header':{'height':_0x6af8('0xd5'),'contents':{'first':_0x6af8('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x6af8('0xca')](_0x6af8('0xd7'),util[_0x6af8('0xca')](_0x6af8('0xd8'),_0x6af8('0xd9'),_0x7c9272['id']),moment()['format'](_0x6af8('0xda'))['toString']())}}};var _0x559e6c={'channel':_0x6af8('0xd9'),'account':_0x7c9272[_0x6af8('0xdb')][_0x6af8('0x2b')],'agent':_0x7c9272[_0x6af8('0xd1')]?_0x7c9272[_0x6af8('0xd1')][_0x6af8('0x2f')]:_0x6af8('0xdc'),'createdAt':moment(_0x7c9272[_0x6af8('0x78')])[_0x6af8('0xca')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x7c9272[_0x6af8('0xdd')]?moment(_0x7c9272['closedAt'])['format'](_0x6af8('0xde'))['toString']():'','disposition':_0x7c9272[_0x6af8('0xdf')],'messages':_(_0x7c9272[_0x6af8('0xce')])[_0x6af8('0x84')]({'secret':![]})[_0x6af8('0x2e')](function(_0x1535bb){return{'date':moment(_0x1535bb[_0x6af8('0x78')])[_0x6af8('0xca')](_0x6af8('0xde'))['toString'](),'sender':_0x1535bb[_0x6af8('0xe0')]===_0x6af8('0xe1')?_0x1535bb['User']?_0x1535bb[_0x6af8('0x70')][_0x6af8('0x2f')]:_0x6af8('0xe2'):_0x1535bb[_0x6af8('0x66')][_0x6af8('0xe3')]+(_0x1535bb['Contact'][_0x6af8('0xcd')]?'\x20'+_0x1535bb[_0x6af8('0x66')][_0x6af8('0xcd')]:''),'body':_0x1535bb['body'],'direction':_0x1535bb[_0x6af8('0xe0')]===_0x6af8('0xe1')?'A':'C','secret':_0x1535bb[_0x6af8('0xcf')],'read':_0x1535bb[_0x6af8('0x80')]};})[_0x6af8('0x63')]()};return ejs[_0x6af8('0xe4')](path[_0x6af8('0xc9')](config[_0x6af8('0xc5')],_0x6af8('0xc6'),_0x6af8('0xe5'),'downloadInteraction.html'),{'interaction':_0x559e6c})[_0x6af8('0x27')](function(_0x553999){return new BPromise(function(_0x567990,_0x46dfd3){pdf['create'](_0x553999,_0x4c60c3)[_0x6af8('0xe6')](path[_0x6af8('0xc9')](_0x106541,_0x6af8('0xe7')+_0x7c9272['id']+'-'+_0x4a6f36+_0x6af8('0xe8')),function(_0x4150f0,_0x58ffe2){if(_0x4150f0)return _0x46dfd3(_0x4150f0);_0x567990(_0x58ffe2);});});})['then'](function(){return new BPromise(function(_0x7984ae,_0x310c78){zipdir(_0x106541,{'saveTo':_0x5f4a9f},function(_0x4434df,_0x58061c){if(_0x4434df)return _0x310c78(_0x4434df);return _0x7984ae(_0x58061c);});})[_0x6af8('0x27')](function(){return new BPromise(function(_0x326b51,_0x1df439){rimraf(_0x106541,function(_0xcff770){if(_0xcff770)_0x1df439(_0xcff770);return _0x326b51();});});})['then'](function(){return _0x12af44[_0x6af8('0xc3')](_0x5f4a9f,_0x41ac3a,function(_0x273323){if(_0x273323){console['log']('err',_0x273323);}else{fs[_0x6af8('0xe9')](_0x5f4a9f);}});});});}else{return _0x12af44[_0x6af8('0xea')](0xc8);}})[_0x6af8('0x35')](handleError(_0x12af44,null));}; \ No newline at end of file +var _0x6e44=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filters','field','from','select','u.id','u.fullname','ui.SmsInteractionId','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','union','User','UserId','buildExpression','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\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?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','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','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','agent','toString','sequelize','keyBy','merge','Account.key','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.SmsInteractionId\x20IN\x20?','all','rows','show','params','rawAttributes','include','options','create','describe','addMessage','SmsMessage','omit','ids','findOne','SmsInteractionId','count','includeAll','findAll','setTags','spread','color','emit','smsInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Owner','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','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','%s\x20#%d','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','out','System','renderFile','downloadInteraction.html','.pdf','download','err','unlinkSync','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','end','set','Content-Range','json','reject','save','update','destroy','then','stack','name','send','Users','map','fullname','TagIds','split','forEach','push','catch','index','SmsInteraction','fieldName','type','key','model','query'];(function(_0x1e74c6,_0x56a205){var _0x495599=function(_0x341c03){while(--_0x341c03){_0x1e74c6['push'](_0x1e74c6['shift']());}};_0x495599(++_0x56a205);}(_0x6e44,0xb1));var _0x46e4=function(_0x27a45d,_0x14499a){_0x27a45d=_0x27a45d-0x0;var _0x5aee32=_0x6e44[_0x27a45d];return _0x5aee32;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x46e4('0x0'));var rimraf=require(_0x46e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x46e4('0x2'));var moment=require(_0x46e4('0x3'));var BPromise=require(_0x46e4('0x4'));var Mustache=require(_0x46e4('0x5'));var util=require('util');var path=require(_0x46e4('0x6'));var sox=require(_0x46e4('0x7'));var csv=require(_0x46e4('0x8'));var ejs=require(_0x46e4('0x9'));var fs=require('fs');var _=require(_0x46e4('0xa'));var squel=require('squel');var crypto=require(_0x46e4('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x46e4('0x8'));var querystring=require(_0x46e4('0xc'));var Papa=require(_0x46e4('0xd'));var Redis=require(_0x46e4('0xe'));var authService=require(_0x46e4('0xf'));var qs=require(_0x46e4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x46e4('0x11'))(_0x46e4('0x12'));var utils=require('../../config/utils');var config=require(_0x46e4('0x13'));var licenseUtil=require(_0x46e4('0x14'));var db=require('../../mysqldb')['db'];config[_0x46e4('0x15')]=_[_0x46e4('0x16')](config[_0x46e4('0x15')],{'host':_0x46e4('0x17'),'port':0x18eb});var socket=require(_0x46e4('0x18'))(new Redis(config[_0x46e4('0x15')]));require(_0x46e4('0x19'))['register'](socket);function respondWithStatusCode(_0x19eb91,_0x537188){_0x537188=_0x537188||0xcc;return function(_0x108352){if(_0x108352){return _0x19eb91[_0x46e4('0x1a')](_0x537188);}return _0x19eb91[_0x46e4('0x1b')](_0x537188)[_0x46e4('0x1c')]();};}function respondWithResult(_0x4f93cb,_0x22a738){_0x22a738=_0x22a738||0xc8;return function(_0x1c8358){if(_0x1c8358){return _0x4f93cb[_0x46e4('0x1b')](_0x22a738)['json'](_0x1c8358);}};}function respondWithFilteredResult(_0xddbb47,_0x3aa746){return function(_0x3ff6f6){if(_0x3ff6f6){var _0x57dbaa=_0x3ff6f6['count'],_0x5314ad=_0x3aa746['offset'],_0x1fdd62=_0x3aa746['offset']+_0x3aa746['limit'],_0x1ab677;if(_0x1fdd62>=_0x57dbaa){_0x1fdd62=_0x57dbaa;_0x1ab677=0xc8;}else{_0x1ab677=0xce;}_0xddbb47['status'](_0x1ab677);return _0xddbb47[_0x46e4('0x1d')](_0x46e4('0x1e'),_0x5314ad+'-'+_0x1fdd62+'/'+_0x57dbaa)[_0x46e4('0x1f')](_0x3ff6f6);}return null;};}function patchUpdates(_0x3eb5e8){return function(_0x1875f8){try{jsonpatch['apply'](_0x1875f8,_0x3eb5e8,!![]);}catch(_0x3f1b8e){return BPromise[_0x46e4('0x20')](_0x3f1b8e);}return _0x1875f8[_0x46e4('0x21')]();};}function saveUpdates(_0x1d9111,_0x93927d){return function(_0x1bc7a0){if(_0x1bc7a0){return _0x1bc7a0[_0x46e4('0x22')](_0x1d9111)['then'](function(_0x2b499e){return _0x2b499e;});}return null;};}function removeEntity(_0x41c679,_0x18130c){return function(_0x488368){if(_0x488368){return _0x488368[_0x46e4('0x23')]()[_0x46e4('0x24')](function(){_0x41c679[_0x46e4('0x1b')](0xcc)[_0x46e4('0x1c')]();});}};}function handleEntityNotFound(_0x836856,_0x5ef318){return function(_0x38d1f1){if(!_0x38d1f1){_0x836856[_0x46e4('0x1a')](0x194);}return _0x38d1f1;};}function handleError(_0x40b1ea,_0x2b19a9){_0x2b19a9=_0x2b19a9||0x1f4;return function(_0x5c512b){logger['error'](_0x5c512b[_0x46e4('0x25')]);if(_0x5c512b[_0x46e4('0x26')]){delete _0x5c512b[_0x46e4('0x26')];}_0x40b1ea[_0x46e4('0x1b')](_0x2b19a9)[_0x46e4('0x27')](_0x5c512b);};}function getInteractionUsers(_0x30a68b,_0x2b2fc6){return new BPromise(function(_0xeb456b,_0x43c6d5){try{if(_0x2b2fc6[_0x30a68b['id']]){_0x30a68b[_0x46e4('0x28')]=_[_0x46e4('0x29')](_0x2b2fc6[_0x30a68b['id']],function(_0x351229){return{'id':_0x351229['id'],'fullname':_0x351229[_0x46e4('0x2a')]};});}}catch(_0x3262f3){_0x43c6d5(_0x3262f3);}_0xeb456b(_0x30a68b);});}function getInteractionTags(_0x36efa5,_0x3d3d00){return new BPromise(function(_0x4d1660,_0x130fa4){try{if(_0x36efa5[_0x46e4('0x2b')]){_0x36efa5['Tags']=[];_0x36efa5[_0x46e4('0x2b')][_0x46e4('0x2c')](',')[_0x46e4('0x2d')](function(_0x4f77d5){_0x36efa5['Tags'][_0x46e4('0x2e')](_0x3d3d00[_0x4f77d5]);});}delete _0x36efa5[_0x46e4('0x2b')];}catch(_0x4e11c4){_0x130fa4(_0x4e11c4);}_0x4d1660(_0x36efa5);});}function updateSmsInteraction(_0x1ba37a,_0x316b20,_0x37b402){return new BPromise(function(_0x19151f,_0x2e5982){return getInteractionUsers(_0x1ba37a,_0x37b402)[_0x46e4('0x24')](function(_0x2effe2){return getInteractionTags(_0x2effe2,_0x316b20);})[_0x46e4('0x24')](function(_0xf6417b){_0x19151f(_0xf6417b);})[_0x46e4('0x2f')](function(_0x5da396){_0x2e5982(_0x5da396);});});}exports[_0x46e4('0x30')]=function(_0x3c011f,_0x188b1f){var _0x3be540={},_0x5770d0={},_0x23bdc0={'count':0x0,'rows':[]};var _0x3605df=_[_0x46e4('0x29')](db[_0x46e4('0x31')]['rawAttributes'],function(_0x1f752b){return{'name':_0x1f752b[_0x46e4('0x32')],'type':_0x1f752b[_0x46e4('0x33')][_0x46e4('0x34')]};});_0x5770d0[_0x46e4('0x35')]=_[_0x46e4('0x29')](_0x3605df,_0x46e4('0x26'));_0x5770d0[_0x46e4('0x36')]=_[_0x46e4('0x37')](_0x3c011f[_0x46e4('0x36')]);_0x5770d0['filters']=_[_0x46e4('0x38')](_0x5770d0[_0x46e4('0x35')],_0x5770d0[_0x46e4('0x36')]);_0x3be540[_0x46e4('0x39')]=_[_0x46e4('0x38')](_0x5770d0['model'],qs['fields'](_0x3c011f[_0x46e4('0x36')][_0x46e4('0x3a')]));_0x3be540[_0x46e4('0x39')]=_0x3be540[_0x46e4('0x39')][_0x46e4('0x3b')]?_0x3be540[_0x46e4('0x39')]:_0x5770d0[_0x46e4('0x35')];if(!_0x3c011f[_0x46e4('0x36')][_0x46e4('0x3c')](_0x46e4('0x3d'))){_0x3be540[_0x46e4('0x3e')]=qs[_0x46e4('0x3e')](_0x3c011f[_0x46e4('0x36')][_0x46e4('0x3e')]);_0x3be540[_0x46e4('0x3f')]=qs['offset'](_0x3c011f[_0x46e4('0x36')]['offset']);}_0x3be540[_0x46e4('0x40')]=qs[_0x46e4('0x41')](_0x3c011f['query'][_0x46e4('0x41')]);_0x3be540[_0x46e4('0x42')]=qs['filters'](_[_0x46e4('0x43')](_0x3c011f[_0x46e4('0x36')],_0x5770d0[_0x46e4('0x44')]),_0x3605df);var _0x57ac00=[];var _0x1e901b=squel['select']()['field']('id')[_0x46e4('0x45')](_0x46e4('0x26'))[_0x46e4('0x45')]('color')[_0x46e4('0x46')]('tools_tags');var _0xc7f7ee=squel[_0x46e4('0x47')]()[_0x46e4('0x45')](_0x46e4('0x48'))[_0x46e4('0x45')](_0x46e4('0x49'))[_0x46e4('0x45')](_0x46e4('0x4a'))[_0x46e4('0x46')]('user_has_sms_interactions','ui')[_0x46e4('0x4b')](_0x46e4('0x4c'),'u',_0x46e4('0x4d'));var _0x21734f=squel[_0x46e4('0x47')]()['from'](_0x46e4('0x4e'),'i')[_0x46e4('0x4b')](_0x46e4('0x4f'),'c',_0x46e4('0x50'))[_0x46e4('0x4b')](_0x46e4('0x4c'),'o',_0x46e4('0x51'))[_0x46e4('0x4b')]('sms_accounts','a',_0x46e4('0x52'))[_0x46e4('0x4b')](_0x46e4('0x53'),'me',_0x46e4('0x54'))[_0x46e4('0x4b')](_0x46e4('0x55'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0x46e4('0x56'));var _0x4289bc=squel[_0x46e4('0x57')]();var _0x25c295=[];var _0x5ba7c6=squel['expr']();var _0x276ea5;if(_0x3c011f[_0x46e4('0x36')][_0x46e4('0x58')]){_0x276ea5=as[_0x46e4('0x59')](_0x3c011f[_0x46e4('0x36')]['search']);var _0x5e62b0=_0x276ea5[_0x46e4('0x5a')];for(var _0x391289=0x0;_0x391289<_0x276ea5[_0x46e4('0x5b')][_0x46e4('0x3b')];_0x391289++){var _0x2c4e55=_0x276ea5['conditions'][_0x391289];var _0x167cd6='i';var _0x2a17b3=_[_0x46e4('0x5c')](_0x3605df,[_0x46e4('0x26'),_0x2c4e55[_0x46e4('0x45')]]);if(!_0x2a17b3){switch(_0x2c4e55['field']){case _0x46e4('0x5d'):if(_0x2c4e55[_0x46e4('0x5e')]==0x1){_0x21734f[_0x46e4('0x5f')]('`'+_0x2c4e55[_0x46e4('0x45')]+_0x46e4('0x60'));}else{_0x21734f[_0x46e4('0x5f')]('`'+_0x2c4e55[_0x46e4('0x45')]+_0x46e4('0x61'));}break;case _0x46e4('0x62'):if(_0x2c4e55[_0x46e4('0x63')]===_0x46e4('0x64')){if(_0x2c4e55['value'][_0x46e4('0x2c')]('\x20')[_0x46e4('0x3b')]>0x1){_0x4289bc[_0x5e62b0]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2c4e55[_0x46e4('0x5e')]),null);}else{var _0xc89c9d='%'+_0x2c4e55[_0x46e4('0x5e')]+'%';_0x4289bc[_0x5e62b0](_0x46e4('0x65'),_0xc89c9d,_0xc89c9d,_0xc89c9d);}}else{_0x2a17b3=_[_0x46e4('0x5c')](_0x3605df,[_0x46e4('0x26'),_0x46e4('0x66')]);_0x2c4e55[_0x46e4('0x45')]=_0x46e4('0x66');_0x1dc157=as['buildExpression'](_0x167cd6,_0x2a17b3['type'],_0x2c4e55);_0x4289bc[_0x5e62b0](_0x1dc157[_0x46e4('0x67')],_0x1dc157[_0x46e4('0x5e')][_0x46e4('0x68')],_0x1dc157['value']['end']);}break;case'Tag':var _0x856338=_0x2c4e55[_0x46e4('0x5e')][_0x46e4('0x2c')](',')[_0x46e4('0x29')](function(_0x1949a3){return Number(_0x1949a3);});_0x856338[_0x46e4('0x2d')](function(_0x5c1587){_0x5ba7c6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5c1587+',%');});_0x25c295=_[_0x46e4('0x69')](_0x25c295,_0x856338);break;case _0x46e4('0x6a'):if(_0x2c4e55[_0x46e4('0x63')]==='$substring'){_0x4289bc[_0x5e62b0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2c4e55['value']+'%',null);}else{_0x2a17b3=_['find'](_0x3605df,[_0x46e4('0x26'),_0x46e4('0x6b')]);_0x2c4e55[_0x46e4('0x45')]=_0x46e4('0x6b');_0x1dc157=as[_0x46e4('0x6c')](_0x167cd6,_0x2a17b3['type'],_0x2c4e55);_0x4289bc[_0x5e62b0](_0x1dc157[_0x46e4('0x67')],_0x1dc157['value'][_0x46e4('0x68')],_0x1dc157[_0x46e4('0x5e')][_0x46e4('0x1c')]);}break;case _0x46e4('0x6d'):_0x1dc157=as['buildExpression']('me',null,_0x2c4e55);_0x4289bc[_0x5e62b0](_0x1dc157[_0x46e4('0x67')],_0x1dc157['value'][_0x46e4('0x68')],_0x1dc157[_0x46e4('0x5e')][_0x46e4('0x1c')]);break;}}else{var _0x1dc157=as[_0x46e4('0x6c')](_0x167cd6,_0x2a17b3['type'],_0x2c4e55);_0x4289bc[_0x5e62b0](_0x1dc157['text'],_0x1dc157[_0x46e4('0x5e')][_0x46e4('0x68')],_0x1dc157[_0x46e4('0x5e')]['end']);}}}else{var _0xf1fa2a=_(_0x3c011f['query'])[_0x46e4('0x37')]()[_0x46e4('0x29')](function(_0x36d08f){return _[_0x46e4('0x6e')](_0x3605df,[_0x46e4('0x26'),_0x36d08f])?_0x36d08f:undefined;})[_0x46e4('0x6f')]()[_0x46e4('0x5e')]();if(!_[_0x46e4('0x70')](_0xf1fa2a)){_0xf1fa2a['forEach'](function(_0xcb4303){if(_0xcb4303===_0x46e4('0x71')){_0x21734f[_0x46e4('0x42')](_0x46e4('0x72'),[]['concat'](_0x3c011f[_0x46e4('0x36')][_0xcb4303]));}else if(_0xcb4303===_0x46e4('0x73')){var _0xc7e3df=JSON[_0x46e4('0x74')](_0x3c011f[_0x46e4('0x36')][_0xcb4303])[_0x46e4('0x75')];var _0x35417e=JSON[_0x46e4('0x74')](_0x3c011f['query'][_0xcb4303])['$lte'];_0x21734f[_0x46e4('0x42')](_0x46e4('0x76'),_0xc7e3df,_0x35417e);}else{if(_0x3c011f[_0x46e4('0x36')][_0xcb4303]==='null'){_0x21734f[_0x46e4('0x42')]('i.'+_0xcb4303+_0x46e4('0x77'));}else{_0x21734f['where']('i.'+_0xcb4303+_0x46e4('0x78'),_0x3c011f[_0x46e4('0x36')][_0xcb4303]);}}});}if(_0x3c011f[_0x46e4('0x36')]['read']){if(_0x3c011f['query'][_0x46e4('0x79')]==0x1){_0x21734f[_0x46e4('0x5f')]('`unreadMessages`\x20=\x200');}else{_0x21734f[_0x46e4('0x5f')]('`unreadMessages`\x20>\x200');}}if(_0x3c011f[_0x46e4('0x36')][_0x46e4('0x7a')]){_0x25c295=_[_0x46e4('0x7b')](_0x3c011f[_0x46e4('0x36')][_0x46e4('0x7a')])?_0x3c011f['query']['tag']:new Array(_0x3c011f['query']['tag']);_0x25c295[_0x46e4('0x2d')](function(_0x1e9360){_0x5ba7c6['or'](_0x46e4('0x7c'),'%,'+_0x1e9360+',%');});}if(_0x3c011f[_0x46e4('0x36')][_0x46e4('0x7d')]){var _0x9dc470=_0x3c011f[_0x46e4('0x36')][_0x46e4('0x7d')][_0x46e4('0x7e')]('\x5c','\x5c\x5c')[_0x46e4('0x7e')](/'/g,'\x27\x27');if(qs[_0x46e4('0x7f')](_0x9dc470)){_0x4289bc['or'](_0x46e4('0x80'),_0x9dc470+'%')['or'](_0x46e4('0x81'),_0x9dc470+'%');}else{_0x4289bc['or'](_0x46e4('0x82'),qs[_0x46e4('0x83')](_0x9dc470))['or'](_0x46e4('0x84'),_0x9dc470+'%');}}}_0x21734f[_0x46e4('0x42')](_0x4289bc);_0x21734f['group'](_0x46e4('0x85'));var _0x1f3510={'type':db[_0x46e4('0x86')]['QueryTypes'][_0x46e4('0x87')],'raw':!![]};var _0x5c9508=_0x21734f[_0x46e4('0x88')]();_0x5c9508[_0x46e4('0x45')]('i.id');_0x5c9508[_0x46e4('0x45')](_0x46e4('0x89'),_0x46e4('0x5d'));if(_0x3be540[_0x46e4('0x40')]){_0x3be540['order']['forEach'](function(_0x3978ba){var _0x576299=_0x3978ba[0x0]===_0x46e4('0x8a')?_0x3978ba[0x0]:'i.'+_0x3978ba[0x0];_0x21734f[_0x46e4('0x40')](_0x576299,_0x3978ba[0x1]===_0x46e4('0x8b')?![]:!![]);});}if(!_[_0x46e4('0x70')](_0x25c295)){_0x21734f['having'](_0x5ba7c6);_0x5c9508[_0x46e4('0x42')](_0x46e4('0x8c'),_0x25c295);}BPromise[_0x46e4('0x8d')]()[_0x46e4('0x24')](function(){if(!_0x276ea5){if(_0x3c011f['query']['SmsAccountId']||_0x3c011f['query'][_0x46e4('0x8e')])return;_0x5c9508[_0x46e4('0x42')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x21734f[_0x46e4('0x42')](_0x46e4('0x8f'));return;}if(_0x3c011f[_0x46e4('0x90')]['role']!=='agent')return;return _0x3c011f[_0x46e4('0x90')][_0x46e4('0x91')]({'attributes':['id'],'raw':!![]})[_0x46e4('0x24')](function(_0x35a5f5){if(_[_0x46e4('0x70')](_0x35a5f5)){_0x5c9508[_0x46e4('0x42')](_0x46e4('0x92'));_0x21734f['where'](_0x46e4('0x92'));}else{_0x5c9508[_0x46e4('0x42')](_0x46e4('0x72'),_[_0x46e4('0x29')](_0x35a5f5,'id'));_0x21734f['where']('i.SmsAccountId\x20IN\x20?',_[_0x46e4('0x29')](_0x35a5f5,'id'));}});})['then'](function(){if(_0x3c011f[_0x46e4('0x90')][_0x46e4('0x93')]===_0x46e4('0x94')&&!_0x276ea5&&!_0x3c011f['query'][_0x46e4('0x71')])return[];return db['sequelize'][_0x46e4('0x36')](_0x5c9508[_0x46e4('0x95')](),_0x1f3510);})[_0x46e4('0x24')](function(_0x128d35){_0x23bdc0['count']=_0x128d35['length'];if(_0x23bdc0['count']===0x0)return[];return db[_0x46e4('0x96')]['query'](_0x1e901b[_0x46e4('0x95')](),_0x1f3510)[_0x46e4('0x24')](function(_0x1f0635){_0x57ac00=_[_0x46e4('0x97')](_0x1f0635,'id');_0x1f3510=_[_0x46e4('0x98')](_0x1f3510,{'model':db[_0x46e4('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3c011f[_0x46e4('0x36')][_0x46e4('0x3a')]){_0x3be540[_0x46e4('0x39')][_0x46e4('0x2d')](function(_0x5ed83f){_0x21734f[_0x46e4('0x45')]('i.'+_0x5ed83f);});}else{_0x21734f[_0x46e4('0x45')](_0x46e4('0x89'),'unreadMessages');_0x21734f[_0x46e4('0x45')]('a.key',_0x46e4('0x99'));_0x21734f[_0x46e4('0x45')]('a.mandatoryDisposition',_0x46e4('0x9a'));_0x21734f['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x46e4('0x8a'));_0x21734f['field']('i.*');_0x21734f[_0x46e4('0x45')](_0x46e4('0x9b'),_0x46e4('0x9c'));_0x21734f[_0x46e4('0x45')](_0x46e4('0x9d'),_0x46e4('0x9e'));_0x21734f[_0x46e4('0x45')](_0x46e4('0x9f'),_0x46e4('0xa0'));_0x21734f[_0x46e4('0x45')](_0x46e4('0xa1'),'Contact.phone');_0x21734f[_0x46e4('0x45')](_0x46e4('0xa2'),'Contact.mobile');_0x21734f['field'](_0x46e4('0xa3'),_0x46e4('0xa4'));_0x21734f[_0x46e4('0x45')](_0x46e4('0xa5'),_0x46e4('0xa6'));_0x21734f[_0x46e4('0x45')](_0x46e4('0xa7'),'Owner.internal');_0x21734f[_0x46e4('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x46e4('0x2b'));}if(_0x3be540[_0x46e4('0x3e')])_0x21734f[_0x46e4('0x3e')](_0x3be540['limit']);if(_0x3be540[_0x46e4('0x3f')])_0x21734f[_0x46e4('0x3f')](_0x3be540[_0x46e4('0x3f')]);return db[_0x46e4('0x96')][_0x46e4('0x36')](_0x21734f['toString'](),_0x1f3510);})['then'](function(_0x479c00){_0xc7f7ee[_0x46e4('0x42')](_0x46e4('0xa8'),_['map'](_0x479c00,'id'));return db['sequelize'][_0x46e4('0x36')](_0xc7f7ee[_0x46e4('0x95')](),_0x1f3510)[_0x46e4('0x24')](function(_0x1c5a9a){var _0x28c070=_['groupBy'](_0x1c5a9a,'SmsInteractionId');var _0x5a1829=[];_0x479c00['forEach'](function(_0xa6595a){_0x5a1829[_0x46e4('0x2e')](updateSmsInteraction(_0xa6595a,_0x57ac00,_0x28c070));});return BPromise[_0x46e4('0xa9')](_0x5a1829);});});})[_0x46e4('0x24')](function(_0x4e3f21){_0x23bdc0[_0x46e4('0xaa')]=_0x4e3f21;return _0x23bdc0;})[_0x46e4('0x24')](respondWithFilteredResult(_0x188b1f,_0x3be540))[_0x46e4('0x2f')](handleError(_0x188b1f,null));};exports[_0x46e4('0xab')]=function(_0x46c4b6,_0x31e7ce){var _0x59d75d={'raw':![],'where':{'id':_0x46c4b6[_0x46e4('0xac')]['id']}},_0x199650={};_0x199650['model']=_[_0x46e4('0x37')](db['SmsInteraction'][_0x46e4('0xad')]);_0x199650[_0x46e4('0x36')]=_[_0x46e4('0x37')](_0x46c4b6[_0x46e4('0x36')]);_0x199650[_0x46e4('0x44')]=_[_0x46e4('0x38')](_0x199650[_0x46e4('0x35')],_0x199650['query']);_0x59d75d[_0x46e4('0x39')]=_[_0x46e4('0x38')](_0x199650[_0x46e4('0x35')],qs[_0x46e4('0x3a')](_0x46c4b6[_0x46e4('0x36')]['fields']));_0x59d75d[_0x46e4('0x39')]=_0x59d75d['attributes'][_0x46e4('0x3b')]?_0x59d75d[_0x46e4('0x39')]:_0x199650[_0x46e4('0x35')];if(_0x46c4b6['query']['includeAll']){_0x59d75d[_0x46e4('0xae')]=[{'all':!![]}];}_0x59d75d=_[_0x46e4('0x98')]({},_0x59d75d,_0x46c4b6[_0x46e4('0xaf')]);return db[_0x46e4('0x31')][_0x46e4('0x5c')](_0x59d75d)['then'](handleEntityNotFound(_0x31e7ce,null))[_0x46e4('0x24')](respondWithResult(_0x31e7ce,null))[_0x46e4('0x2f')](handleError(_0x31e7ce,null));};exports[_0x46e4('0xb0')]=function(_0x57a940,_0x507759){return db[_0x46e4('0x31')][_0x46e4('0xb0')](_0x57a940[_0x46e4('0x6d')],{})[_0x46e4('0x24')](respondWithResult(_0x507759,0xc9))[_0x46e4('0x2f')](handleError(_0x507759,null));};exports[_0x46e4('0x22')]=function(_0x523b68,_0x428f80){if(_0x523b68[_0x46e4('0x6d')]['id']){delete _0x523b68[_0x46e4('0x6d')]['id'];}return db[_0x46e4('0x31')][_0x46e4('0x5c')]({'where':{'id':_0x523b68[_0x46e4('0xac')]['id']}})[_0x46e4('0x24')](handleEntityNotFound(_0x428f80,null))[_0x46e4('0x24')](saveUpdates(_0x523b68[_0x46e4('0x6d')],null))[_0x46e4('0x24')](respondWithResult(_0x428f80,null))[_0x46e4('0x2f')](handleError(_0x428f80,null));};exports[_0x46e4('0x23')]=function(_0x48259b,_0x5f5983){return db['SmsInteraction']['find']({'where':{'id':_0x48259b['params']['id']}})[_0x46e4('0x24')](handleEntityNotFound(_0x5f5983,null))[_0x46e4('0x24')](removeEntity(_0x5f5983,null))['catch'](handleError(_0x5f5983,null));};exports[_0x46e4('0xb1')]=function(_0x20fe78,_0x192b52){return db['SmsInteraction']['describe']()[_0x46e4('0x24')](respondWithResult(_0x192b52,null))['catch'](handleError(_0x192b52,null));};exports[_0x46e4('0xb2')]=function(_0x150049,_0x6422af,_0x16e586){return db[_0x46e4('0xb3')][_0x46e4('0x5c')]({'where':{'id':_0x150049['params']['id']}})[_0x46e4('0x24')](handleEntityNotFound(_0x6422af,null))[_0x46e4('0x24')](function(_0x464415){if(_0x464415){return _0x464415[_0x46e4('0xb2')](_0x150049[_0x46e4('0x6d')]['ids'],_[_0x46e4('0xb4')](_0x150049[_0x46e4('0x6d')],[_0x46e4('0xb5'),'id'])||{});}})['then'](respondWithResult(_0x6422af,null))['catch'](handleError(_0x6422af,null));};exports['getMessages']=function(_0x3ef619,_0xc3e4c,_0x4886d2){var _0x50f263={'raw':![],'where':{}};var _0x313304={};var _0x3a0cd1={'count':0x0,'rows':[]};return db[_0x46e4('0x31')][_0x46e4('0xb6')]({'where':{'id':_0x3ef619['params']['id']}})['then'](handleEntityNotFound(_0xc3e4c,null))[_0x46e4('0x24')](function(_0x68aa56){if(_0x68aa56){_0x313304[_0x46e4('0x35')]=_[_0x46e4('0x37')](db['SmsMessage'][_0x46e4('0xad')]);_0x313304['query']=_[_0x46e4('0x37')](_0x3ef619[_0x46e4('0x36')]);_0x313304[_0x46e4('0x44')]=_[_0x46e4('0x38')](_0x313304['model'],_0x313304[_0x46e4('0x36')]);_0x50f263['attributes']=_[_0x46e4('0x38')](_0x313304['model'],qs[_0x46e4('0x3a')](_0x3ef619[_0x46e4('0x36')][_0x46e4('0x3a')]));_0x50f263[_0x46e4('0x39')]=_0x50f263['attributes']['length']?_0x50f263['attributes']:_0x313304[_0x46e4('0x35')];if(!_0x3ef619[_0x46e4('0x36')][_0x46e4('0x3c')](_0x46e4('0x3d'))){_0x50f263[_0x46e4('0x3e')]=qs['limit'](_0x3ef619['query']['limit']);_0x50f263[_0x46e4('0x3f')]=qs['offset'](_0x3ef619['query'][_0x46e4('0x3f')]);}_0x50f263[_0x46e4('0x40')]=qs['sort'](_0x3ef619['query'][_0x46e4('0x41')]);_0x50f263[_0x46e4('0x42')]=qs['filters'](_['pick'](_0x3ef619[_0x46e4('0x36')],_0x313304[_0x46e4('0x44')]));_0x50f263[_0x46e4('0x42')][_0x46e4('0xb7')]=_0x68aa56['id'];if(_0x3ef619[_0x46e4('0x36')][_0x46e4('0x7d')]){_0x50f263[_0x46e4('0x42')]=_[_0x46e4('0x98')](_0x50f263[_0x46e4('0x42')],{'$or':_[_0x46e4('0x29')](_0x50f263['attributes'],function(_0x2e68ff){var _0x3f9fc7={};_0x3f9fc7[_0x2e68ff]={'$like':'%'+_0x3ef619[_0x46e4('0x36')][_0x46e4('0x7d')]+'%'};return _0x3f9fc7;})});}if(_0x3ef619['query']['$gte']){var _0x35c260=_0x3ef619['query'][_0x46e4('0x75')][_0x46e4('0x2c')](',');var _0x4ffe31={};_0x4ffe31[_0x35c260[0x0]]={'$gte':moment(_0x35c260[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x50f263[_0x46e4('0x42')]=_[_0x46e4('0x98')](_0x50f263[_0x46e4('0x42')],_0x4ffe31);}_0x50f263=_[_0x46e4('0x98')]({},_0x50f263,_0x3ef619['options']);return db[_0x46e4('0xb3')][_0x46e4('0xb8')]({'where':_0x50f263['where']})[_0x46e4('0x24')](function(_0x11873f){_0x3a0cd1[_0x46e4('0xb8')]=_0x11873f;if(_0x3ef619['query'][_0x46e4('0xb9')]){_0x50f263[_0x46e4('0xae')]=[{'all':!![]}];}return db[_0x46e4('0xb3')][_0x46e4('0xba')](_0x50f263);})[_0x46e4('0x24')](function(_0x39a63b){_0x3a0cd1[_0x46e4('0xaa')]=_0x39a63b;return _0x3a0cd1;});}})[_0x46e4('0x24')](respondWithFilteredResult(_0xc3e4c,_0x50f263))[_0x46e4('0x2f')](handleError(_0xc3e4c,null));};exports['addTags']=function(_0x56eb97,_0x48bf7b,_0x264be3){return db[_0x46e4('0x31')][_0x46e4('0x5c')]({'where':{'id':_0x56eb97['params']['id']}})['then'](handleEntityNotFound(_0x48bf7b,null))[_0x46e4('0x24')](function(_0x34dcec){if(_0x34dcec){return _0x34dcec[_0x46e4('0xbb')](_0x56eb97[_0x46e4('0x6d')]['ids'],_[_0x46e4('0xb4')](_0x56eb97['body'],[_0x46e4('0xb5'),'id'])||{})[_0x46e4('0xbc')](function(){return db['Tag'][_0x46e4('0xba')]({'attributes':['id',_0x46e4('0x26'),_0x46e4('0xbd')],'where':{'id':_0x56eb97['body'][_0x46e4('0xb5')]}});})[_0x46e4('0x24')](function(_0x471dcf){socket[_0x46e4('0xbe')](_0x46e4('0xbf'),{'id':Number(_0x56eb97[_0x46e4('0xac')]['id']),'tags':_0x471dcf||[]});return{'id':Number(_0x56eb97[_0x46e4('0xac')]['id']),'tags':_0x471dcf||[]};});}})[_0x46e4('0x24')](respondWithResult(_0x48bf7b,null))[_0x46e4('0x2f')](handleError(_0x48bf7b,null));};exports['removeTags']=function(_0xa95f0c,_0x65b96e,_0x53a786){return db[_0x46e4('0x31')][_0x46e4('0x5c')]({'where':{'id':_0xa95f0c[_0x46e4('0xac')]['id']}})[_0x46e4('0x24')](handleEntityNotFound(_0x65b96e,null))[_0x46e4('0x24')](function(_0xf9e012){if(_0xf9e012){return _0xf9e012[_0x46e4('0xc0')](_0xa95f0c[_0x46e4('0x36')][_0x46e4('0xb5')]);}})['then'](respondWithStatusCode(_0x65b96e,null))[_0x46e4('0x2f')](handleError(_0x65b96e,null));};exports['download']=function(_0x534522,_0x158901){var _0x54ebab=moment()[_0x46e4('0xc1')]()[_0x46e4('0x95')]();var _0x222378=path[_0x46e4('0xc2')](config[_0x46e4('0xc3')],_0x46e4('0xc4'),_0x46e4('0xc5'),_0x46e4('0xc6'));var _0x1c03d0=path[_0x46e4('0xc2')](config[_0x46e4('0xc3')],_0x46e4('0xc4'),_0x46e4('0xc5'),_0x46e4('0xc7'));var _0x2ad5fa=path[_0x46e4('0xc2')](_0x222378,_0x54ebab);var _0xa1970a=util['format'](_0x46e4('0xc8'),_0x534522[_0x46e4('0xac')]['id'],_0x54ebab);var _0x131c2a=path[_0x46e4('0xc2')](_0x222378,_0xa1970a);var _0x113d46=[];_0x113d46[_0x46e4('0x2e')]({'model':db[_0x46e4('0x6a')],'as':'User','attributes':['id',_0x46e4('0x2a')],'raw':!![]});_0x113d46[_0x46e4('0x2e')]({'model':db[_0x46e4('0xc9')],'as':_0x46e4('0x62'),'attributes':['id',_0x46e4('0xca'),_0x46e4('0xcb')],'raw':!![]});var _0x3f722b=[{'model':db[_0x46e4('0xb3')],'as':_0x46e4('0xcc'),'attributes':['id','body','createdAt',_0x46e4('0xcd'),_0x46e4('0xce'),'read'],'include':_0x113d46}];_0x3f722b[_0x46e4('0x2e')]({'model':db[_0x46e4('0xcf')],'as':'Account','attributes':['id',_0x46e4('0x26')]});_0x3f722b[_0x46e4('0x2e')]({'model':db[_0x46e4('0x6a')],'as':_0x46e4('0xd0'),'attributes':['id',_0x46e4('0x2a')]});return db[_0x46e4('0x31')][_0x46e4('0x5c')]({'where':{'id':_0x534522[_0x46e4('0xac')]['id']},'include':_0x3f722b})[_0x46e4('0x24')](handleEntityNotFound(_0x158901,null))[_0x46e4('0x24')](function(_0x43234a){if(_0x43234a){var _0x177d48=_0x43234a[_0x46e4('0xd1')]({'plain':!![]});fs[_0x46e4('0xd2')](_0x2ad5fa);var _0x2652ff={'format':'A4','border':_0x46e4('0xd3'),'header':{'height':'40px','contents':{'first':_0x46e4('0xd4')}},'footer':{'height':_0x46e4('0xd5'),'contents':{'default':util[_0x46e4('0xd6')](_0x46e4('0xd7'),util[_0x46e4('0xd6')](_0x46e4('0xd8'),_0x46e4('0xd9'),_0x177d48['id']),moment()['format'](_0x46e4('0xda'))[_0x46e4('0x95')]())}}};var _0x49e978={'channel':_0x46e4('0xd9'),'account':_0x177d48[_0x46e4('0xdb')][_0x46e4('0x26')],'agent':_0x177d48[_0x46e4('0xd0')]?_0x177d48['Owner'][_0x46e4('0x2a')]:_0x46e4('0xdc'),'createdAt':moment(_0x177d48[_0x46e4('0x73')])[_0x46e4('0xd6')](_0x46e4('0xdd'))['toString'](),'closedAt':_0x177d48['closed']?moment(_0x177d48[_0x46e4('0xde')])[_0x46e4('0xd6')](_0x46e4('0xdd'))[_0x46e4('0x95')]():'','disposition':_0x177d48[_0x46e4('0xdf')],'messages':_(_0x177d48[_0x46e4('0xcc')])[_0x46e4('0x7d')]({'secret':![]})[_0x46e4('0x29')](function(_0x3847cf){return{'date':moment(_0x3847cf[_0x46e4('0x73')])[_0x46e4('0xd6')](_0x46e4('0xdd'))[_0x46e4('0x95')](),'sender':_0x3847cf[_0x46e4('0xcd')]===_0x46e4('0xe0')?_0x3847cf[_0x46e4('0x6a')]?_0x3847cf[_0x46e4('0x6a')][_0x46e4('0x2a')]:_0x46e4('0xe1'):_0x3847cf[_0x46e4('0x62')][_0x46e4('0xca')]+(_0x3847cf[_0x46e4('0x62')][_0x46e4('0xcb')]?'\x20'+_0x3847cf[_0x46e4('0x62')][_0x46e4('0xcb')]:''),'body':_0x3847cf[_0x46e4('0x6d')],'direction':_0x3847cf[_0x46e4('0xcd')]===_0x46e4('0xe0')?'A':'C','secret':_0x3847cf[_0x46e4('0xce')],'read':_0x3847cf[_0x46e4('0x79')]};})[_0x46e4('0x5e')]()};return ejs[_0x46e4('0xe2')](path['join'](config[_0x46e4('0xc3')],_0x46e4('0xc4'),'views',_0x46e4('0xe3')),{'interaction':_0x49e978})[_0x46e4('0x24')](function(_0x3a9536){return new BPromise(function(_0x124553,_0x3fcd41){pdf[_0x46e4('0xb0')](_0x3a9536,_0x2652ff)['toFile'](path['join'](_0x2ad5fa,'transcript-'+_0x177d48['id']+'-'+_0x54ebab+_0x46e4('0xe4')),function(_0x3f80b2,_0x575a9d){if(_0x3f80b2)return _0x3fcd41(_0x3f80b2);_0x124553(_0x575a9d);});});})['then'](function(){return new BPromise(function(_0x21ef28,_0x53bbe3){zipdir(_0x2ad5fa,{'saveTo':_0x131c2a},function(_0x425b9c,_0x5a4605){if(_0x425b9c)return _0x53bbe3(_0x425b9c);return _0x21ef28(_0x5a4605);});})[_0x46e4('0x24')](function(){return new BPromise(function(_0x4343b8,_0x3baec1){rimraf(_0x2ad5fa,function(_0x25ea63){if(_0x25ea63)_0x3baec1(_0x25ea63);return _0x4343b8();});});})['then'](function(){return _0x158901[_0x46e4('0xe5')](_0x131c2a,_0xa1970a,function(_0x1b8a9e){if(_0x1b8a9e){console['log'](_0x46e4('0xe6'),_0x1b8a9e);}else{fs[_0x46e4('0xe7')](_0x131c2a);}});});});}else{return _0x158901[_0x46e4('0x1a')](0xc8);}})['catch'](handleError(_0x158901,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index bc49fb2..2011b27 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 _0xac9d=['setDataValue','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers','then'];(function(_0x5a1cc9,_0x28f54d){var _0x471761=function(_0xda51c0){while(--_0xda51c0){_0x5a1cc9['push'](_0x5a1cc9['shift']());}};_0x471761(++_0x28f54d);}(_0xac9d,0x14d));var _0xdac9=function(_0x41ed37,_0xbcd1d4){_0x41ed37=_0x41ed37-0x0;var _0x13f7ea=_0xac9d[_0x41ed37];return _0x13f7ea;};'use strict';var EventEmitter=require(_0xdac9('0x0'));var SmsInteraction=require(_0xdac9('0x1'))['db'][_0xdac9('0x2')];var SmsMessage=require(_0xdac9('0x1'))['db'][_0xdac9('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xdac9('0x4')](0x0);var events={'afterCreate':_0xdac9('0x5'),'afterUpdate':_0xdac9('0x6'),'afterDestroy':'remove'};function emitEvent(_0x1c17a6){return function(_0x5a984a,_0x3d56ae,_0x1f8ff3){_0x5a984a[_0xdac9('0x7')]({'attributes':['id'],'raw':!![]})[_0xdac9('0x8')](function(_0x1c78c5){_0x5a984a[_0xdac9('0x9')]('Users',_0x1c78c5[_0xdac9('0xa')](function(_0x47d9fd){return{'id':_0x47d9fd['id']};}));return SmsMessage[_0xdac9('0xb')]({'where':{'SmsInteractionId':_0x5a984a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdac9('0x8')](function(_0x39c92c){_0x5a984a[_0xdac9('0x9')](_0xdac9('0xc'),_0x39c92c[_0xdac9('0xd')]);SmsInteractionEvents[_0xdac9('0xe')](_0x1c17a6+':'+_0x5a984a['id'],_0x5a984a);SmsInteractionEvents[_0xdac9('0xe')](_0x1c17a6,_0x5a984a);_0x1f8ff3(null);})[_0xdac9('0xf')](_0x1f8ff3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xdac9('0x10')](e,emitEvent(event));}}module[_0xdac9('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0xf767=['findAll','length','emit','catch','hasOwnProperty','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','map'];(function(_0xfbe80b,_0x23cd2c){var _0x5b9caf=function(_0x5638c0){while(--_0x5638c0){_0xfbe80b['push'](_0xfbe80b['shift']());}};_0x5b9caf(++_0x23cd2c);}(_0xf767,0x76));var _0x7f76=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0xf767[_0x1e4f2d];return _0xd05ce5;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x7f76('0x0'))['db'][_0x7f76('0x1')];var SmsMessage=require(_0x7f76('0x0'))['db'][_0x7f76('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x7f76('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7f76('0x4'),'afterDestroy':_0x7f76('0x5')};function emitEvent(_0x40ba50){return function(_0x25cd62,_0x5922e5,_0x23c243){_0x25cd62[_0x7f76('0x6')]({'attributes':['id'],'raw':!![]})[_0x7f76('0x7')](function(_0x1eeb08){_0x25cd62[_0x7f76('0x8')]('Users',_0x1eeb08[_0x7f76('0x9')](function(_0x109950){return{'id':_0x109950['id']};}));return SmsMessage[_0x7f76('0xa')]({'where':{'SmsInteractionId':_0x25cd62['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7f76('0x7')](function(_0x4c5f88){_0x25cd62[_0x7f76('0x8')]('unreadMessages',_0x4c5f88[_0x7f76('0xb')]);SmsInteractionEvents[_0x7f76('0xc')](_0x40ba50+':'+_0x25cd62['id'],_0x25cd62);SmsInteractionEvents[_0x7f76('0xc')](_0x40ba50,_0x25cd62);_0x23c243(null);})[_0x7f76('0xd')](_0x23c243(null));};}for(var e in events){if(events[_0x7f76('0xe')](e)){var event=events[e];SmsInteraction[_0x7f76('0xf')](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 f5598cd..a35d97f 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 _0x84a5=['rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0x84a5,0x138));var _0x584a=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x84a5[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x584a('0x0'));var util=require(_0x584a('0x1'));var logger=require(_0x584a('0x2'))(_0x584a('0x3'));var moment=require(_0x584a('0x4'));var BPromise=require(_0x584a('0x5'));var rp=require(_0x584a('0x6'));var fs=require('fs');var path=require(_0x584a('0x7'));var rimraf=require(_0x584a('0x8'));var config=require(_0x584a('0x9'));var attributes=require(_0x584a('0xa'));module[_0x584a('0xb')]=function(_0x58fafb,_0xb07f53){return _0x58fafb[_0x584a('0xc')](_0x584a('0xd'),attributes,{'tableName':_0x584a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15d59c,_0x36ff46,_0x2510ec){if(_0x15d59c[_0x584a('0xf')](_0x584a('0x10'))){_0x15d59c[_0x584a('0x11')]=moment()[_0x584a('0x12')](_0x584a('0x13'));}_0x2510ec(null,_0x15d59c);}}});}; \ No newline at end of file +var _0xcc64=['sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','path','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction'];(function(_0x3131b3,_0x56fd06){var _0x5e349c=function(_0x3b99ba){while(--_0x3b99ba){_0x3131b3['push'](_0x3131b3['shift']());}};_0x5e349c(++_0x56fd06);}(_0xcc64,0xd2));var _0x4cc6=function(_0x3f3272,_0xa7891e){_0x3f3272=_0x3f3272-0x0;var _0x2ad5e9=_0xcc64[_0x3f3272];return _0x2ad5e9;};'use strict';var _=require(_0x4cc6('0x0'));var util=require(_0x4cc6('0x1'));var logger=require(_0x4cc6('0x2'))(_0x4cc6('0x3'));var moment=require(_0x4cc6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4cc6('0x5'));var rimraf=require('rimraf');var config=require(_0x4cc6('0x6'));var attributes=require(_0x4cc6('0x7'));module[_0x4cc6('0x8')]=function(_0x5b52ed,_0x3eedf5){return _0x5b52ed[_0x4cc6('0x9')](_0x4cc6('0xa'),attributes,{'tableName':_0x4cc6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2fccd5,_0x27d030,_0x2aa536){if(_0x2fccd5[_0x4cc6('0xc')](_0x4cc6('0xd'))){_0x2fccd5[_0x4cc6('0xe')]=moment()[_0x4cc6('0xf')](_0x4cc6('0x10'));}_0x2aa536(null,_0x2fccd5);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 7538dd0..26d04c6 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 _0x34b9=['omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SmsInteraction','update','body','options','raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids'];(function(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0x34b9,0x9f));var _0x934b=function(_0x1fb130,_0x55b130){_0x1fb130=_0x1fb130-0x0;var _0x16d296=_0x34b9[_0x1fb130];return _0x16d296;};'use strict';var _=require('lodash');var util=require(_0x934b('0x0'));var moment=require('moment');var BPromise=require(_0x934b('0x1'));var rs=require(_0x934b('0x2'));var fs=require('fs');var Redis=require(_0x934b('0x3'));var db=require(_0x934b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x934b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x934b('0x6')][_0x934b('0x7')]({'port':0x232a});config[_0x934b('0x8')]=_[_0x934b('0x9')](config[_0x934b('0x8')],{'host':_0x934b('0xa'),'port':0x18eb});var socket=require(_0x934b('0xb'))(new Redis(config[_0x934b('0x8')]));require(_0x934b('0xc'))['register'](socket);function respondWithRpcPromise(_0x855845,_0x143a05,_0x1b5f96){return new BPromise(function(_0x2de259,_0x884eb4){return client[_0x934b('0xd')](_0x855845,_0x1b5f96)[_0x934b('0xe')](function(_0x3ec48a){logger[_0x934b('0xf')](_0x934b('0x10'),_0x143a05,'request\x20sent');logger[_0x934b('0x11')](_0x934b('0x12'),_0x143a05,'request\x20sent',JSON[_0x934b('0x13')](_0x3ec48a));if(_0x3ec48a['error']){if(_0x3ec48a[_0x934b('0x14')]['code']===0x1f4){logger[_0x934b('0x14')](_0x934b('0x10'),_0x143a05,_0x3ec48a[_0x934b('0x14')][_0x934b('0x15')]);return _0x884eb4(_0x3ec48a['error'][_0x934b('0x15')]);}logger['error'](_0x934b('0x10'),_0x143a05,_0x3ec48a[_0x934b('0x14')][_0x934b('0x15')]);return _0x2de259(_0x3ec48a[_0x934b('0x14')][_0x934b('0x15')]);}else{logger[_0x934b('0xf')](_0x934b('0x10'),_0x143a05,'request\x20sent');_0x2de259(_0x3ec48a['result'][_0x934b('0x15')]);}})[_0x934b('0x16')](function(_0x587a43){logger[_0x934b('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x143a05,_0x587a43);_0x884eb4(_0x587a43);});});}exports['UpdateSmsInteraction']=function(_0x57fbcb){var _0x56122c=this;return new Promise(function(_0x595188,_0x1e83a6){return db[_0x934b('0x17')][_0x934b('0x18')](_0x57fbcb[_0x934b('0x19')],{'raw':_0x57fbcb[_0x934b('0x1a')]?_0x57fbcb['options'][_0x934b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57fbcb[_0x934b('0x1a')]?_0x57fbcb['options'][_0x934b('0x1c')]||null:null,'attributes':_0x57fbcb['options']?_0x57fbcb[_0x934b('0x1a')][_0x934b('0x1d')]||null:null,'limit':_0x57fbcb[_0x934b('0x1a')]?_0x57fbcb[_0x934b('0x1a')][_0x934b('0x1e')]||null:null})[_0x934b('0xe')](function(_0x5b00b7){logger['info'](_0x934b('0x1f'),_0x57fbcb);logger['debug'](_0x934b('0x1f'),_0x57fbcb,JSON[_0x934b('0x13')](_0x5b00b7));_0x595188(_0x5b00b7);})[_0x934b('0x16')](function(_0x400d3b){logger['error'](_0x934b('0x1f'),_0x400d3b[_0x934b('0x15')],_0x57fbcb);_0x1e83a6(_0x56122c[_0x934b('0x14')](0x1f4,_0x400d3b['message']));});});};exports[_0x934b('0x20')]=function(_0x1e42d4){return new Promise(function(_0x569349,_0x368209){return db[_0x934b('0x17')][_0x934b('0x21')]({'where':_0x1e42d4[_0x934b('0x1a')]?_0x1e42d4[_0x934b('0x1a')][_0x934b('0x1c')]||null:null})[_0x934b('0xe')](function(_0x5f02fc){if(_0x5f02fc){return _0x5f02fc[_0x934b('0x22')](_0x1e42d4['body'][_0x934b('0x23')],_[_0x934b('0x24')](_0x1e42d4[_0x934b('0x19')],[_0x934b('0x23'),'id'])||{});}})[_0x934b('0x25')](function(_0x43c49e){logger['info'](_0x934b('0x26'),_0x1e42d4);logger[_0x934b('0x11')]('AddTags',_0x1e42d4,JSON[_0x934b('0x13')](_0x43c49e));_0x569349(_0x43c49e);})[_0x934b('0x16')](function(_0x492fa5){logger[_0x934b('0x14')](_0x934b('0x26'),_0x492fa5[_0x934b('0x15')],_0x1e42d4);_0x368209(_this[_0x934b('0x14')](0x1f4,_0x492fa5[_0x934b('0x15')]));});});}; \ No newline at end of file +var _0xa9ea=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','SmsInteraction,\x20%s,\x20%s','message','result','catch','SmsInteraction','update','body','options','raw','attributes','limit','UpdateSmsInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment'];(function(_0x593bc5,_0x364f4e){var _0x16a78d=function(_0x5e77aa){while(--_0x5e77aa){_0x593bc5['push'](_0x593bc5['shift']());}};_0x16a78d(++_0x364f4e);}(_0xa9ea,0x12a));var _0xaa9e=function(_0xd685e,_0x360045){_0xd685e=_0xd685e-0x0;var _0x5ef5e0=_0xa9ea[_0xd685e];return _0x5ef5e0;};'use strict';var _=require(_0xaa9e('0x0'));var util=require(_0xaa9e('0x1'));var moment=require(_0xaa9e('0x2'));var BPromise=require(_0xaa9e('0x3'));var rs=require(_0xaa9e('0x4'));var fs=require('fs');var Redis=require(_0xaa9e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa9e('0x6'));var logger=require('../../config/logger')(_0xaa9e('0x7'));var config=require(_0xaa9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaa9e('0x9')][_0xaa9e('0xa')]({'port':0x232a});config[_0xaa9e('0xb')]=_['defaults'](config[_0xaa9e('0xb')],{'host':_0xaa9e('0xc'),'port':0x18eb});var socket=require(_0xaa9e('0xd'))(new Redis(config[_0xaa9e('0xb')]));require('./smsInteraction.socket')[_0xaa9e('0xe')](socket);function respondWithRpcPromise(_0x12f475,_0x171ed5,_0x8e9b5b){return new BPromise(function(_0x6a1c0a,_0x3c319d){return client[_0xaa9e('0xf')](_0x12f475,_0x8e9b5b)[_0xaa9e('0x10')](function(_0x493dd6){logger[_0xaa9e('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x171ed5,'request\x20sent');logger[_0xaa9e('0x12')](_0xaa9e('0x13'),_0x171ed5,_0xaa9e('0x14'),JSON[_0xaa9e('0x15')](_0x493dd6));if(_0x493dd6['error']){if(_0x493dd6['error'][_0xaa9e('0x16')]===0x1f4){logger[_0xaa9e('0x17')](_0xaa9e('0x18'),_0x171ed5,_0x493dd6[_0xaa9e('0x17')]['message']);return _0x3c319d(_0x493dd6[_0xaa9e('0x17')][_0xaa9e('0x19')]);}logger[_0xaa9e('0x17')](_0xaa9e('0x18'),_0x171ed5,_0x493dd6[_0xaa9e('0x17')]['message']);return _0x6a1c0a(_0x493dd6[_0xaa9e('0x17')][_0xaa9e('0x19')]);}else{logger[_0xaa9e('0x11')](_0xaa9e('0x18'),_0x171ed5,_0xaa9e('0x14'));_0x6a1c0a(_0x493dd6[_0xaa9e('0x1a')][_0xaa9e('0x19')]);}})[_0xaa9e('0x1b')](function(_0x191e25){logger['error'](_0xaa9e('0x18'),_0x171ed5,_0x191e25);_0x3c319d(_0x191e25);});});}exports['UpdateSmsInteraction']=function(_0x4d9270){var _0x2c467a=this;return new Promise(function(_0x224284,_0x2a2ae7){return db[_0xaa9e('0x1c')][_0xaa9e('0x1d')](_0x4d9270[_0xaa9e('0x1e')],{'raw':_0x4d9270['options']?_0x4d9270[_0xaa9e('0x1f')][_0xaa9e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d9270['options']?_0x4d9270['options']['where']||null:null,'attributes':_0x4d9270[_0xaa9e('0x1f')]?_0x4d9270[_0xaa9e('0x1f')][_0xaa9e('0x21')]||null:null,'limit':_0x4d9270[_0xaa9e('0x1f')]?_0x4d9270[_0xaa9e('0x1f')][_0xaa9e('0x22')]||null:null})[_0xaa9e('0x10')](function(_0x124255){logger[_0xaa9e('0x11')](_0xaa9e('0x23'),_0x4d9270);logger[_0xaa9e('0x12')]('UpdateSmsInteraction',_0x4d9270,JSON[_0xaa9e('0x15')](_0x124255));_0x224284(_0x124255);})['catch'](function(_0x4d4490){logger[_0xaa9e('0x17')](_0xaa9e('0x23'),_0x4d4490[_0xaa9e('0x19')],_0x4d9270);_0x2a2ae7(_0x2c467a[_0xaa9e('0x17')](0x1f4,_0x4d4490['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x3b640e){return new Promise(function(_0x5ebf20,_0x1e724b){return db[_0xaa9e('0x1c')][_0xaa9e('0x24')]({'where':_0x3b640e[_0xaa9e('0x1f')]?_0x3b640e['options'][_0xaa9e('0x25')]||null:null})[_0xaa9e('0x10')](function(_0x302f1c){if(_0x302f1c){return _0x302f1c[_0xaa9e('0x26')](_0x3b640e[_0xaa9e('0x1e')][_0xaa9e('0x27')],_[_0xaa9e('0x28')](_0x3b640e[_0xaa9e('0x1e')],[_0xaa9e('0x27'),'id'])||{});}})[_0xaa9e('0x29')](function(_0x5c3c21){logger[_0xaa9e('0x11')](_0xaa9e('0x2a'),_0x3b640e);logger['debug'](_0xaa9e('0x2a'),_0x3b640e,JSON[_0xaa9e('0x15')](_0x5c3c21));_0x5ebf20(_0x5c3c21);})[_0xaa9e('0x1b')](function(_0x4633cf){logger['error'](_0xaa9e('0x2a'),_0x4633cf[_0xaa9e('0x19')],_0x3b640e);_0x1e724b(_this[_0xaa9e('0x17')](0x1f4,_0x4633cf['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 7a07440..e2a7681 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x26bcec,_0xe13f50){var _0x1049dc=function(_0x4c0d9b){while(--_0x4c0d9b){_0x26bcec['push'](_0x26bcec['shift']());}};_0x1049dc(++_0xe13f50);}(_0x2032,0xd9));var _0x2203=function(_0x4d27c4,_0x1aff11){_0x4d27c4=_0x4d27c4-0x0;var _0x3bc86b=_0x2032[_0x4d27c4];return _0x3bc86b;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file +var _0x0b0e=['smsInteraction:','./smsInteraction.events','remove','emit','removeListener','register'];(function(_0x5f3e26,_0x2eb0de){var _0x56be07=function(_0x5909ac){while(--_0x5909ac){_0x5f3e26['push'](_0x5f3e26['shift']());}};_0x56be07(++_0x2eb0de);}(_0x0b0e,0x187));var _0xe0b0=function(_0x558099,_0x4be744){_0x558099=_0x558099-0x0;var _0x18ac2e=_0x0b0e[_0x558099];return _0x18ac2e;};'use strict';var SmsInteractionEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){SmsInteractionEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);SmsInteractionEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 1eef011..4d46b2c 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 _0x6041=['update','/:id/accept','accept','/:id/reject','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','/:id','show','tracked','sms','smsmessage:create','create','post','/:id/status','status','put'];(function(_0x1227fa,_0x1502d4){var _0x281e11=function(_0x2924db){while(--_0x2924db){_0x1227fa['push'](_0x1227fa['shift']());}};_0x281e11(++_0x1502d4);}(_0x6041,0x92));var _0x1604=function(_0x10e485,_0x4ee577){_0x10e485=_0x10e485-0x0;var _0x540f38=_0x6041[_0x10e485];return _0x540f38;};'use strict';var multer=require(_0x1604('0x0'));var util=require(_0x1604('0x1'));var path=require('path');var timeout=require(_0x1604('0x2'));var express=require(_0x1604('0x3'));var router=express[_0x1604('0x4')]();var auth=require(_0x1604('0x5'));var interaction=require(_0x1604('0x6'));var config=require(_0x1604('0x7'));var controller=require(_0x1604('0x8'));router[_0x1604('0x9')]('/',auth[_0x1604('0xa')](),controller['index']);router[_0x1604('0x9')](_0x1604('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x1604('0xc'),auth[_0x1604('0xa')](),controller[_0x1604('0xd')]);router['post']('/',auth[_0x1604('0xa')](),interaction[_0x1604('0xe')](_0x1604('0xf'),_0x1604('0x10')),controller[_0x1604('0x11')]);router[_0x1604('0x12')](_0x1604('0x13'),controller[_0x1604('0x14')]);router[_0x1604('0x15')](_0x1604('0xc'),auth[_0x1604('0xa')](),controller[_0x1604('0x16')]);router[_0x1604('0x15')](_0x1604('0x17'),auth[_0x1604('0xa')](),controller[_0x1604('0x18')]);router[_0x1604('0x15')](_0x1604('0x19'),auth['isAuthenticated'](),controller['reject']);router[_0x1604('0x1a')]('/:id',auth[_0x1604('0xa')](),controller['destroy']);module[_0x1604('0x1b')]=router; \ No newline at end of file +var _0x7015=['describe','/:id','isAuthenticated','show','post','tracked','smsmessage:create','create','/:id/status','put','/:id/accept','/:id/reject','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','index','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7015,0x68));var _0x5701=function(_0x2024f7,_0x46d1e0){_0x2024f7=_0x2024f7-0x0;var _0x32d514=_0x7015[_0x2024f7];return _0x32d514;};'use strict';var multer=require(_0x5701('0x0'));var util=require(_0x5701('0x1'));var path=require(_0x5701('0x2'));var timeout=require('connect-timeout');var express=require(_0x5701('0x3'));var router=express[_0x5701('0x4')]();var auth=require(_0x5701('0x5'));var interaction=require(_0x5701('0x6'));var config=require('../../config/environment');var controller=require(_0x5701('0x7'));router[_0x5701('0x8')]('/',auth['isAuthenticated'](),controller[_0x5701('0x9')]);router[_0x5701('0x8')](_0x5701('0xa'),auth['isAuthenticated'](),controller[_0x5701('0xb')]);router['get'](_0x5701('0xc'),auth[_0x5701('0xd')](),controller[_0x5701('0xe')]);router[_0x5701('0xf')]('/',auth[_0x5701('0xd')](),interaction[_0x5701('0x10')]('sms',_0x5701('0x11')),controller[_0x5701('0x12')]);router[_0x5701('0xf')](_0x5701('0x13'),controller['status']);router[_0x5701('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5701('0x14')](_0x5701('0x15'),auth[_0x5701('0xd')](),controller['accept']);router['put'](_0x5701('0x16'),auth[_0x5701('0xd')](),controller['reject']);router['delete']('/:id',auth[_0x5701('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 806bba4..10e177a 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 _0xf113=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x4dec34,_0x455eef){var _0x35d630=function(_0x249eb9){while(--_0x249eb9){_0x4dec34['push'](_0x4dec34['shift']());}};_0x35d630(++_0x455eef);}(_0xf113,0x1e7));var _0x3f11=function(_0x41a03b,_0x170772){_0x41a03b=_0x41a03b-0x0;var _0x5c7a85=_0xf113[_0x41a03b];return _0x5c7a85;};'use strict';var Sequelize=require(_0x3f11('0x0'));module[_0x3f11('0x1')]={'body':{'type':Sequelize[_0x3f11('0x2')](_0x3f11('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3f11('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3f11('0x5')]('in',_0x3f11('0x6')),'defaultValue':_0x3f11('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x3f11('0x7')]},'secret':{'type':Sequelize[_0x3f11('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3f11('0x8')]},'providerResponse':{'type':Sequelize[_0x3f11('0x2')]}}; \ No newline at end of file +var _0x8bbe=['STRING','DATE','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8bbe,0x19a));var _0xe8bb=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0x8bbe[_0x29d2d2];return _0x3f6476;};'use strict';var Sequelize=require(_0xe8bb('0x0'));module[_0xe8bb('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe8bb('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe8bb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe8bb('0x4')]('in',_0xe8bb('0x5')),'defaultValue':_0xe8bb('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe8bb('0x6')](0xbe)},'phone':{'type':Sequelize[_0xe8bb('0x6')]},'readAt':{'type':Sequelize[_0xe8bb('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe8bb('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index abbb1fc..fb8958d 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 _0x9dc3=['count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','index','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','filter','SmsMessage','include','findAll','show','includeAll','find','create','body','params','describe','sms-interactions','accept','sms','read','readAt','format','UserId','user','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','event','debug','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','infobip','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','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','redis','defaults','localhost','./smsMessage.socket','jayson/promise','client','http','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json'];(function(_0x178ce4,_0x53dc65){var _0x25a4de=function(_0x5a3928){while(--_0x5a3928){_0x178ce4['push'](_0x178ce4['shift']());}};_0x25a4de(++_0x53dc65);}(_0x9dc3,0x15d));var _0x39dc=function(_0x362e87,_0x38d17c){_0x362e87=_0x362e87-0x0;var _0x334244=_0x9dc3[_0x362e87];return _0x334244;};'use strict';var pdf=require(_0x39dc('0x0'));var emlformat=require(_0x39dc('0x1'));var rimraf=require(_0x39dc('0x2'));var zipdir=require(_0x39dc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x39dc('0x4'));var moment=require('moment');var BPromise=require(_0x39dc('0x5'));var Mustache=require(_0x39dc('0x6'));var util=require(_0x39dc('0x7'));var path=require(_0x39dc('0x8'));var sox=require(_0x39dc('0x9'));var csv=require('to-csv');var ejs=require(_0x39dc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x39dc('0xb'));var crypto=require(_0x39dc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x39dc('0xd'));var toCsv=require(_0x39dc('0xe'));var querystring=require(_0x39dc('0xf'));var Papa=require(_0x39dc('0x10'));var Redis=require(_0x39dc('0x11'));var authService=require(_0x39dc('0x12'));var qs=require(_0x39dc('0x13'));var as=require(_0x39dc('0x14'));var hardwareService=require(_0x39dc('0x15'));var logger=require(_0x39dc('0x16'))(_0x39dc('0x17'));var utils=require(_0x39dc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x39dc('0x19'));var db=require(_0x39dc('0x1a'))['db'];config[_0x39dc('0x1b')]=_[_0x39dc('0x1c')](config[_0x39dc('0x1b')],{'host':_0x39dc('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x39dc('0x1b')]));require(_0x39dc('0x1e'))['register'](socket);var jayson=require(_0x39dc('0x1f'));var client=jayson[_0x39dc('0x20')][_0x39dc('0x21')]({'port':0x232c});var client9002=jayson[_0x39dc('0x20')][_0x39dc('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xadf5d4,_0x2d1a5d,_0x5314ac,_0x353eb9){return new BPromise(function(_0x40a441,_0x60b474){var _0x4f8717=_0x353eb9||client;return _0x4f8717['request'](_0xadf5d4,_0x5314ac)['then'](function(_0x674008){logger['info'](_0x39dc('0x22'),_0x2d1a5d,_0x39dc('0x23'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2d1a5d,_0x39dc('0x23'),JSON[_0x39dc('0x24')](_0x674008));if(_0x674008['error']){if(_0x674008[_0x39dc('0x25')][_0x39dc('0x26')]===0x1f4){logger['error'](_0x39dc('0x22'),_0x2d1a5d,_0x674008['error'][_0x39dc('0x27')]);return _0x60b474(_0x674008[_0x39dc('0x25')][_0x39dc('0x27')]);}logger[_0x39dc('0x25')]('SmsMessage,\x20%s,\x20%s',_0x2d1a5d,_0x674008['error']['message']);return _0x40a441(_0x674008[_0x39dc('0x25')]['message']);}else{logger[_0x39dc('0x28')]('SmsMessage,\x20%s,\x20%s',_0x2d1a5d,_0x39dc('0x23'));_0x40a441(_0x674008[_0x39dc('0x29')][_0x39dc('0x27')]);}})[_0x39dc('0x2a')](function(_0x2f8319){logger[_0x39dc('0x25')](_0x39dc('0x22'),_0x2d1a5d,_0x2f8319);_0x60b474(_0x2f8319);});});}function respondWithStatusCode(_0x43968e,_0x1eb9b2){_0x1eb9b2=_0x1eb9b2||0xcc;return function(_0x2c4121){if(_0x2c4121){return _0x43968e[_0x39dc('0x2b')](_0x1eb9b2);}return _0x43968e[_0x39dc('0x2c')](_0x1eb9b2)[_0x39dc('0x2d')]();};}function respondWithResult(_0x1cee9f,_0x1de417){_0x1de417=_0x1de417||0xc8;return function(_0x44fe64){if(_0x44fe64){return _0x1cee9f[_0x39dc('0x2c')](_0x1de417)[_0x39dc('0x2e')](_0x44fe64);}};}function respondWithFilteredResult(_0x3dcaa9,_0x8e4666){return function(_0x50d6f7){if(_0x50d6f7){var _0x5e1c36=_0x50d6f7[_0x39dc('0x2f')],_0xf7367d=_0x8e4666[_0x39dc('0x30')],_0x48084d=_0x8e4666['offset']+_0x8e4666[_0x39dc('0x31')],_0x4f65ac;if(_0x48084d>=_0x5e1c36){_0x48084d=_0x5e1c36;_0x4f65ac=0xc8;}else{_0x4f65ac=0xce;}_0x3dcaa9[_0x39dc('0x2c')](_0x4f65ac);return _0x3dcaa9[_0x39dc('0x32')](_0x39dc('0x33'),_0xf7367d+'-'+_0x48084d+'/'+_0x5e1c36)['json'](_0x50d6f7);}return null;};}function patchUpdates(_0x47bbf5){return function(_0x4ee0d3){try{jsonpatch[_0x39dc('0x34')](_0x4ee0d3,_0x47bbf5,!![]);}catch(_0x4de211){return BPromise[_0x39dc('0x35')](_0x4de211);}return _0x4ee0d3[_0x39dc('0x36')]();};}function saveUpdates(_0x36f48b,_0x20b983){return function(_0x29f97c){if(_0x29f97c){return _0x29f97c[_0x39dc('0x37')](_0x36f48b)[_0x39dc('0x38')](function(_0x3db8f3){return _0x3db8f3;});}return null;};}function removeEntity(_0x3f6287,_0x41736e){return function(_0x44ffc4){if(_0x44ffc4){return _0x44ffc4[_0x39dc('0x39')]()['then'](function(){_0x3f6287['status'](0xcc)[_0x39dc('0x2d')]();});}};}function handleEntityNotFound(_0x496f11,_0x5429ef){return function(_0x1dfcbd){if(!_0x1dfcbd){_0x496f11[_0x39dc('0x2b')](0x194);}return _0x1dfcbd;};}function handleError(_0x5692df,_0x3dbb92){_0x3dbb92=_0x3dbb92||0x1f4;return function(_0x550513){logger['error'](_0x550513['stack']);if(_0x550513[_0x39dc('0x3a')]){delete _0x550513[_0x39dc('0x3a')];}_0x5692df[_0x39dc('0x2c')](_0x3dbb92)['send'](_0x550513);};}exports[_0x39dc('0x3b')]=function(_0x159a34,_0x5e32be){var _0x363c5c={},_0x1092c1={},_0x1dee71={'count':0x0,'rows':[]};var _0x56e35f=_['map'](db['SmsMessage'][_0x39dc('0x3c')],function(_0xd6fdb1){return{'name':_0xd6fdb1[_0x39dc('0x3d')],'type':_0xd6fdb1['type'][_0x39dc('0x3e')]};});_0x1092c1[_0x39dc('0x3f')]=_[_0x39dc('0x40')](_0x56e35f,_0x39dc('0x3a'));_0x1092c1[_0x39dc('0x41')]=_[_0x39dc('0x42')](_0x159a34[_0x39dc('0x41')]);_0x1092c1['filters']=_[_0x39dc('0x43')](_0x1092c1['model'],_0x1092c1[_0x39dc('0x41')]);_0x363c5c[_0x39dc('0x44')]=_[_0x39dc('0x43')](_0x1092c1['model'],qs[_0x39dc('0x45')](_0x159a34[_0x39dc('0x41')][_0x39dc('0x45')]));_0x363c5c[_0x39dc('0x44')]=_0x363c5c['attributes'][_0x39dc('0x46')]?_0x363c5c[_0x39dc('0x44')]:_0x1092c1[_0x39dc('0x3f')];if(!_0x159a34[_0x39dc('0x41')][_0x39dc('0x47')](_0x39dc('0x48'))){_0x363c5c[_0x39dc('0x31')]=qs[_0x39dc('0x31')](_0x159a34[_0x39dc('0x41')][_0x39dc('0x31')]);_0x363c5c[_0x39dc('0x30')]=qs[_0x39dc('0x30')](_0x159a34[_0x39dc('0x41')][_0x39dc('0x30')]);}_0x363c5c['order']=qs[_0x39dc('0x49')](_0x159a34[_0x39dc('0x41')][_0x39dc('0x49')]);_0x363c5c[_0x39dc('0x4a')]=qs[_0x39dc('0x4b')](_[_0x39dc('0x4c')](_0x159a34[_0x39dc('0x41')],_0x1092c1['filters']),_0x56e35f);if(_0x159a34[_0x39dc('0x41')]['filter']){_0x363c5c[_0x39dc('0x4a')]=_[_0x39dc('0x4d')](_0x363c5c['where'],{'$or':_[_0x39dc('0x40')](_0x56e35f,function(_0x427fa5){if(_0x427fa5[_0x39dc('0x4e')]!==_0x39dc('0x4f')){var _0xd34a0c={};_0xd34a0c[_0x427fa5[_0x39dc('0x3a')]]={'$like':'%'+_0x159a34[_0x39dc('0x41')][_0x39dc('0x50')]+'%'};return _0xd34a0c;}})});}_0x363c5c=_['merge']({},_0x363c5c,_0x159a34['options']);var _0x2c25e7={'where':_0x363c5c[_0x39dc('0x4a')]};return db[_0x39dc('0x51')][_0x39dc('0x2f')](_0x2c25e7)['then'](function(_0xaa2e7d){_0x1dee71[_0x39dc('0x2f')]=_0xaa2e7d;if(_0x159a34['query']['includeAll']){_0x363c5c[_0x39dc('0x52')]=[{'all':!![]}];}return db[_0x39dc('0x51')][_0x39dc('0x53')](_0x363c5c);})[_0x39dc('0x38')](function(_0x43b87c){_0x1dee71['rows']=_0x43b87c;return _0x1dee71;})[_0x39dc('0x38')](respondWithFilteredResult(_0x5e32be,_0x363c5c))[_0x39dc('0x2a')](handleError(_0x5e32be,null));};exports[_0x39dc('0x54')]=function(_0x272c54,_0x3eae5a){var _0x42e781={'raw':!![],'where':{'id':_0x272c54['params']['id']}},_0x1a995e={};_0x1a995e[_0x39dc('0x3f')]=_[_0x39dc('0x42')](db[_0x39dc('0x51')]['rawAttributes']);_0x1a995e[_0x39dc('0x41')]=_['keys'](_0x272c54[_0x39dc('0x41')]);_0x1a995e[_0x39dc('0x4b')]=_['intersection'](_0x1a995e[_0x39dc('0x3f')],_0x1a995e[_0x39dc('0x41')]);_0x42e781['attributes']=_[_0x39dc('0x43')](_0x1a995e['model'],qs[_0x39dc('0x45')](_0x272c54[_0x39dc('0x41')][_0x39dc('0x45')]));_0x42e781[_0x39dc('0x44')]=_0x42e781[_0x39dc('0x44')][_0x39dc('0x46')]?_0x42e781['attributes']:_0x1a995e['model'];if(_0x272c54[_0x39dc('0x41')][_0x39dc('0x55')]){_0x42e781[_0x39dc('0x52')]=[{'all':!![]}];}_0x42e781=_[_0x39dc('0x4d')]({},_0x42e781,_0x272c54['options']);return db[_0x39dc('0x51')][_0x39dc('0x56')](_0x42e781)[_0x39dc('0x38')](handleEntityNotFound(_0x3eae5a,null))[_0x39dc('0x38')](respondWithResult(_0x3eae5a,null))[_0x39dc('0x2a')](handleError(_0x3eae5a,null));};exports[_0x39dc('0x57')]=function(_0x18813d,_0x41c5de){return db[_0x39dc('0x51')]['create'](_0x18813d[_0x39dc('0x58')],{})['then'](respondWithResult(_0x41c5de,0xc9))['catch'](handleError(_0x41c5de,null));};exports['update']=function(_0x433890,_0x3d5ca4){if(_0x433890[_0x39dc('0x58')]['id']){delete _0x433890[_0x39dc('0x58')]['id'];}return db[_0x39dc('0x51')]['find']({'where':{'id':_0x433890[_0x39dc('0x59')]['id']}})[_0x39dc('0x38')](handleEntityNotFound(_0x3d5ca4,null))[_0x39dc('0x38')](saveUpdates(_0x433890['body'],null))['then'](respondWithResult(_0x3d5ca4,null))[_0x39dc('0x2a')](handleError(_0x3d5ca4,null));};exports[_0x39dc('0x39')]=function(_0x164bec,_0x2728dd){return db['SmsMessage'][_0x39dc('0x56')]({'where':{'id':_0x164bec[_0x39dc('0x59')]['id']}})[_0x39dc('0x38')](handleEntityNotFound(_0x2728dd,null))['then'](removeEntity(_0x2728dd,null))['catch'](handleError(_0x2728dd,null));};exports['describe']=function(_0x5fbb15,_0x576178){return db[_0x39dc('0x51')][_0x39dc('0x5a')]()[_0x39dc('0x38')](respondWithResult(_0x576178,null))[_0x39dc('0x2a')](handleError(_0x576178,null));};var interaction_log=require(_0x39dc('0x16'))(_0x39dc('0x5b'));exports[_0x39dc('0x5c')]=function(_0x1a9048,_0x4d60d7,_0x811a30){var _0x21193d={'channel':_0x39dc('0x5d')};if(_0x1a9048[_0x39dc('0x58')]['id']){delete _0x1a9048['body']['id'];}_0x1a9048[_0x39dc('0x58')][_0x39dc('0x5e')]=!![];_0x1a9048['body'][_0x39dc('0x5f')]=moment()[_0x39dc('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a9048[_0x39dc('0x58')][_0x39dc('0x61')]=_0x1a9048[_0x39dc('0x58')][_0x39dc('0x61')]||_0x1a9048[_0x39dc('0x62')]['id'];return db[_0x39dc('0x51')][_0x39dc('0x56')]({'where':{'id':_0x1a9048[_0x39dc('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x39dc('0x38')](handleEntityNotFound(_0x4d60d7,null))['then'](saveUpdates(_0x1a9048['body'],null))[_0x39dc('0x38')](function(_0x438697){if(_0x438697){_0x21193d[_0x39dc('0x27')]=_0x438697['get']({'plain':!![]});return db[_0x39dc('0x63')][_0x39dc('0x56')]({'where':{'id':_0x438697[_0x39dc('0x64')]}});}return null;})[_0x39dc('0x38')](handleEntityNotFound(_0x4d60d7,null))[_0x39dc('0x38')](function(_0x5bca81){if(_0x5bca81){return _0x5bca81[_0x39dc('0x37')]({'UserId':_0x1a9048[_0x39dc('0x58')][_0x39dc('0x61')],'read1stAt':_[_0x39dc('0x65')](_0x5bca81[_0x39dc('0x66')])?moment()[_0x39dc('0x60')](_0x39dc('0x67')):undefined});}return null;})[_0x39dc('0x38')](function(_0x459387){if(_0x459387){_0x21193d[_0x39dc('0x68')]=_0x459387[_0x39dc('0x69')]({'plain':!![]});interaction_log[_0x39dc('0x28')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1a9048[_0x39dc('0x62')]['id'],_0x1a9048[_0x39dc('0x62')][_0x39dc('0x3a')],_0x1a9048[_0x39dc('0x62')][_0x39dc('0x6a')],_0x21193d[_0x39dc('0x68')]['id'],_0x1a9048[_0x39dc('0x58')]?JSON['stringify'](_0x1a9048[_0x39dc('0x58')]):_0x39dc('0x6b'));return respondWithRpcPromise(_0x39dc('0x6c'),_0x39dc('0x6d'),_0x21193d);}return null;})[_0x39dc('0x38')](function(_0x19fa49){if(_0x19fa49){if(_0x1a9048[_0x39dc('0x58')][_0x39dc('0x6e')]){_0x21193d[_0x39dc('0x27')]['interface']=util['format'](_0x39dc('0x6f'),_0x1a9048[_0x39dc('0x62')]['name']);_0x21193d[_0x39dc('0x27')][_0x39dc('0x70')]=_0x21193d[_0x39dc('0x70')];_0x21193d[_0x39dc('0x27')]['event']=_0x39dc('0x5c');return respondWithRpcPromise(_0x39dc('0x71'),_0x39dc('0x71'),{'event':_0x39dc('0x72'),'message':_0x21193d[_0x39dc('0x27')]},client9002)[_0x39dc('0x38')](function(){return _0x21193d;});}return _0x21193d;}return null;})[_0x39dc('0x38')](respondWithResult(_0x4d60d7,null))['catch'](handleError(_0x4d60d7,null));};var interaction_log=require(_0x39dc('0x16'))(_0x39dc('0x5b'));exports[_0x39dc('0x35')]=function(_0x732801,_0x171e7e,_0x5ea3a7){var _0x5ddbc2={'agent':{},'channel':_0x39dc('0x5d')};if(_0x732801[_0x39dc('0x58')]['id']){delete _0x732801[_0x39dc('0x58')]['id'];}_0x732801[_0x39dc('0x58')]['UserId']=_0x732801['body']['UserId']||_0x732801[_0x39dc('0x62')]['id'];_0x5ddbc2['agent']['id']=_0x732801[_0x39dc('0x58')][_0x39dc('0x61')];return db['SmsMessage'][_0x39dc('0x56')]({'where':{'id':_0x732801['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x171e7e,null))[_0x39dc('0x38')](function(_0x11e798){if(_0x11e798){_0x5ddbc2[_0x39dc('0x27')]=_0x11e798[_0x39dc('0x69')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x11e798['SmsInteractionId']}});}return null;})[_0x39dc('0x38')](handleEntityNotFound(_0x171e7e,null))[_0x39dc('0x38')](function(_0x469a2d){if(_0x469a2d){_0x5ddbc2['interaction']=_0x469a2d['get']({'plain':!![]});interaction_log[_0x39dc('0x28')](_0x39dc('0x73'),_0x732801[_0x39dc('0x62')]['id'],_0x732801[_0x39dc('0x62')][_0x39dc('0x3a')],_0x732801[_0x39dc('0x62')][_0x39dc('0x6a')],_0x5ddbc2[_0x39dc('0x68')]['id'],_0x732801[_0x39dc('0x58')]?JSON[_0x39dc('0x24')](_0x732801[_0x39dc('0x58')]):_0x39dc('0x6b'));return respondWithRpcPromise('RejectMessage',_0x39dc('0x74'),_0x5ddbc2);}return null;})['then'](function(_0x3d8d44){if(_0x3d8d44){_0x3d8d44[_0x39dc('0x27')][_0x39dc('0x75')]=util[_0x39dc('0x60')](_0x39dc('0x6f'),_0x732801['user']['name']);_0x3d8d44[_0x39dc('0x27')][_0x39dc('0x70')]=_0x5ddbc2[_0x39dc('0x70')];_0x3d8d44[_0x39dc('0x27')][_0x39dc('0x76')]='reject';respondWithRpcPromise(_0x39dc('0x71'),_0x39dc('0x71'),{'event':'rejectmessage','message':_0x3d8d44['message']},client9002);return _0x5ddbc2;}return null;})[_0x39dc('0x38')](respondWithResult(_0x171e7e,null))['catch'](handleError(_0x171e7e,null));};exports[_0x39dc('0x2c')]=function(_0x4f608c,_0x4bf7f6,_0x7b441f){if(_0x4f608c[_0x39dc('0x58')]['id']){delete _0x4f608c[_0x39dc('0x58')]['id'];}var _0x212bcd;return db['SmsMessage'][_0x39dc('0x56')]({'where':{'id':_0x4f608c[_0x39dc('0x59')]['id']}})['then'](handleEntityNotFound(_0x4bf7f6,null))[_0x39dc('0x38')](function(_0x3c6b20){if(_0x3c6b20){_0x212bcd=_0x3c6b20;return db['SmsAccount'][_0x39dc('0x56')]({'where':{'id':_0x3c6b20['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x4bf7f6,null))['then'](function(_0x141a54){if(_0x141a54){logger[_0x39dc('0x77')](_0x39dc('0x78'),_0x39dc('0x2c'),'received\x20delivery\x20report\x20from',_0x141a54[_0x39dc('0x4e')],util[_0x39dc('0x79')](_0x4f608c[_0x39dc('0x58')],{'showHidden':![],'depth':null}));switch(_0x141a54[_0x39dc('0x4e')]){case _0x39dc('0x7a'):if(_0x4f608c[_0x39dc('0x58')][_0x39dc('0x7b')]&&_0x4f608c[_0x39dc('0x58')]['MessageSid']===_0x212bcd[_0x39dc('0x7c')]){return _0x212bcd[_0x39dc('0x37')]({'read':!![]});}else{logger['error'](_0x39dc('0x7d'),_0x39dc('0x2c'),_0x39dc('0x7a'),util[_0x39dc('0x79')](_0x4f608c[_0x39dc('0x58')],{'showHidden':![],'depth':null}));}break;case _0x39dc('0x7e'):if(_0x4f608c[_0x39dc('0x58')][_0x39dc('0x7f')]&&_0x4f608c['body']['MessageUUID']===_0x212bcd[_0x39dc('0x7c')]&&_[_0x39dc('0x80')](['sent','delivered'],_0x4f608c['body']['Status'])>=0x0){return _0x212bcd[_0x39dc('0x37')]({'read':!![]});}else{logger[_0x39dc('0x25')](_0x39dc('0x7d'),_0x39dc('0x2c'),'plivio',util[_0x39dc('0x79')](_0x4f608c[_0x39dc('0x58')],{'showHidden':![],'depth':null}));}break;case _0x39dc('0x81'):var _0x3c1e39=_0x4f608c[_0x39dc('0x58')]['results'][0x0];if(_0x3c1e39['status'][_0x39dc('0x82')]===_0x39dc('0x83')){return _0x212bcd[_0x39dc('0x37')]({'read':!![]});}else{logger[_0x39dc('0x25')](_0x39dc('0x7d'),_0x39dc('0x2c'),'infobip',util['inspect'](_0x4f608c['body'],{'showHidden':![],'depth':null}));}break;}return _0x212bcd;}})[_0x39dc('0x38')](respondWithResult(_0x4bf7f6,null))[_0x39dc('0x2a')](handleError(_0x4bf7f6,null));}; \ No newline at end of file +var _0xa008=['rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','count','offset','Content-Range','apply','reject','destroy','stack','name','send','index','map','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','SmsMessage','includeAll','include','findAll','show','rawAttributes','options','find','catch','create','update','body','params','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event'];(function(_0x4ec256,_0xd407b1){var _0x3aa2c7=function(_0x4da626){while(--_0x4da626){_0x4ec256['push'](_0x4ec256['shift']());}};_0x3aa2c7(++_0xd407b1);}(_0xa008,0x9c));var _0x8a00=function(_0xf5ba9b,_0x2113db){_0xf5ba9b=_0xf5ba9b-0x0;var _0x33e36c=_0xa008[_0xf5ba9b];return _0x33e36c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8a00('0x0'));var rimraf=require(_0x8a00('0x1'));var zipdir=require(_0x8a00('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a00('0x3'));var moment=require(_0x8a00('0x4'));var BPromise=require(_0x8a00('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8a00('0x6'));var sox=require('sox');var csv=require(_0x8a00('0x7'));var ejs=require(_0x8a00('0x8'));var fs=require('fs');var _=require(_0x8a00('0x9'));var squel=require(_0x8a00('0xa'));var crypto=require(_0x8a00('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8a00('0xc'));var toCsv=require(_0x8a00('0x7'));var querystring=require(_0x8a00('0xd'));var Papa=require('papaparse');var Redis=require(_0x8a00('0xe'));var authService=require(_0x8a00('0xf'));var qs=require(_0x8a00('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a00('0x11'));var logger=require(_0x8a00('0x12'))(_0x8a00('0x13'));var utils=require(_0x8a00('0x14'));var config=require(_0x8a00('0x15'));var licenseUtil=require(_0x8a00('0x16'));var db=require(_0x8a00('0x17'))['db'];config[_0x8a00('0x18')]=_['defaults'](config[_0x8a00('0x18')],{'host':_0x8a00('0x19'),'port':0x18eb});var socket=require(_0x8a00('0x1a'))(new Redis(config[_0x8a00('0x18')]));require(_0x8a00('0x1b'))[_0x8a00('0x1c')](socket);var jayson=require(_0x8a00('0x1d'));var client=jayson['client'][_0x8a00('0x1e')]({'port':0x232c});var client9002=jayson[_0x8a00('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52ee35,_0x5c4fb6,_0xf1a283,_0x37ce3f){return new BPromise(function(_0xddc593,_0x1fa31d){var _0x357809=_0x37ce3f||client;return _0x357809['request'](_0x52ee35,_0xf1a283)[_0x8a00('0x20')](function(_0x25105f){logger[_0x8a00('0x21')](_0x8a00('0x22'),_0x5c4fb6,_0x8a00('0x23'));logger['debug'](_0x8a00('0x24'),_0x5c4fb6,_0x8a00('0x23'),JSON[_0x8a00('0x25')](_0x25105f));if(_0x25105f['error']){if(_0x25105f[_0x8a00('0x26')][_0x8a00('0x27')]===0x1f4){logger['error'](_0x8a00('0x22'),_0x5c4fb6,_0x25105f[_0x8a00('0x26')][_0x8a00('0x28')]);return _0x1fa31d(_0x25105f[_0x8a00('0x26')][_0x8a00('0x28')]);}logger[_0x8a00('0x26')](_0x8a00('0x22'),_0x5c4fb6,_0x25105f[_0x8a00('0x26')][_0x8a00('0x28')]);return _0xddc593(_0x25105f['error'][_0x8a00('0x28')]);}else{logger['info'](_0x8a00('0x22'),_0x5c4fb6,'request\x20sent');_0xddc593(_0x25105f['result']['message']);}})['catch'](function(_0x4d9e28){logger[_0x8a00('0x26')](_0x8a00('0x22'),_0x5c4fb6,_0x4d9e28);_0x1fa31d(_0x4d9e28);});});}function respondWithStatusCode(_0x27a150,_0x48e119){_0x48e119=_0x48e119||0xcc;return function(_0x102f59){if(_0x102f59){return _0x27a150[_0x8a00('0x29')](_0x48e119);}return _0x27a150[_0x8a00('0x2a')](_0x48e119)[_0x8a00('0x2b')]();};}function respondWithResult(_0x48c21d,_0x2e2a09){_0x2e2a09=_0x2e2a09||0xc8;return function(_0x3c5680){if(_0x3c5680){return _0x48c21d[_0x8a00('0x2a')](_0x2e2a09)['json'](_0x3c5680);}};}function respondWithFilteredResult(_0x3fd6ee,_0x5db811){return function(_0x4260ee){if(_0x4260ee){var _0x37247e=_0x4260ee[_0x8a00('0x2c')],_0x29e172=_0x5db811[_0x8a00('0x2d')],_0x25d4ab=_0x5db811['offset']+_0x5db811['limit'],_0x2ea76e;if(_0x25d4ab>=_0x37247e){_0x25d4ab=_0x37247e;_0x2ea76e=0xc8;}else{_0x2ea76e=0xce;}_0x3fd6ee['status'](_0x2ea76e);return _0x3fd6ee['set'](_0x8a00('0x2e'),_0x29e172+'-'+_0x25d4ab+'/'+_0x37247e)['json'](_0x4260ee);}return null;};}function patchUpdates(_0x3e3347){return function(_0x2d2f98){try{jsonpatch[_0x8a00('0x2f')](_0x2d2f98,_0x3e3347,!![]);}catch(_0x2e522e){return BPromise[_0x8a00('0x30')](_0x2e522e);}return _0x2d2f98['save']();};}function saveUpdates(_0x44780d,_0x3d7d77){return function(_0x3db932){if(_0x3db932){return _0x3db932['update'](_0x44780d)['then'](function(_0x1cde21){return _0x1cde21;});}return null;};}function removeEntity(_0x484ea5,_0x34c4c0){return function(_0x64af3f){if(_0x64af3f){return _0x64af3f[_0x8a00('0x31')]()[_0x8a00('0x20')](function(){_0x484ea5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f27b4,_0x3444ed){return function(_0x16020b){if(!_0x16020b){_0x1f27b4[_0x8a00('0x29')](0x194);}return _0x16020b;};}function handleError(_0x313aac,_0x18499e){_0x18499e=_0x18499e||0x1f4;return function(_0x5365cb){logger[_0x8a00('0x26')](_0x5365cb[_0x8a00('0x32')]);if(_0x5365cb[_0x8a00('0x33')]){delete _0x5365cb[_0x8a00('0x33')];}_0x313aac[_0x8a00('0x2a')](_0x18499e)[_0x8a00('0x34')](_0x5365cb);};}exports[_0x8a00('0x35')]=function(_0x3922af,_0x5113ac){var _0x34a162={},_0x557ad2={},_0x35bcc9={'count':0x0,'rows':[]};var _0x57444c=_[_0x8a00('0x36')](db['SmsMessage']['rawAttributes'],function(_0x58769b){return{'name':_0x58769b[_0x8a00('0x37')],'type':_0x58769b['type']['key']};});_0x557ad2[_0x8a00('0x38')]=_[_0x8a00('0x36')](_0x57444c,_0x8a00('0x33'));_0x557ad2[_0x8a00('0x39')]=_[_0x8a00('0x3a')](_0x3922af[_0x8a00('0x39')]);_0x557ad2[_0x8a00('0x3b')]=_[_0x8a00('0x3c')](_0x557ad2['model'],_0x557ad2[_0x8a00('0x39')]);_0x34a162[_0x8a00('0x3d')]=_[_0x8a00('0x3c')](_0x557ad2[_0x8a00('0x38')],qs[_0x8a00('0x3e')](_0x3922af[_0x8a00('0x39')][_0x8a00('0x3e')]));_0x34a162[_0x8a00('0x3d')]=_0x34a162[_0x8a00('0x3d')][_0x8a00('0x3f')]?_0x34a162[_0x8a00('0x3d')]:_0x557ad2[_0x8a00('0x38')];if(!_0x3922af['query'][_0x8a00('0x40')](_0x8a00('0x41'))){_0x34a162[_0x8a00('0x42')]=qs[_0x8a00('0x42')](_0x3922af[_0x8a00('0x39')][_0x8a00('0x42')]);_0x34a162[_0x8a00('0x2d')]=qs[_0x8a00('0x2d')](_0x3922af['query'][_0x8a00('0x2d')]);}_0x34a162[_0x8a00('0x43')]=qs[_0x8a00('0x44')](_0x3922af[_0x8a00('0x39')][_0x8a00('0x44')]);_0x34a162[_0x8a00('0x45')]=qs[_0x8a00('0x3b')](_['pick'](_0x3922af[_0x8a00('0x39')],_0x557ad2['filters']),_0x57444c);if(_0x3922af['query'][_0x8a00('0x46')]){_0x34a162[_0x8a00('0x45')]=_[_0x8a00('0x47')](_0x34a162[_0x8a00('0x45')],{'$or':_['map'](_0x57444c,function(_0xfb6356){if(_0xfb6356[_0x8a00('0x48')]!==_0x8a00('0x49')){var _0x44da41={};_0x44da41[_0xfb6356[_0x8a00('0x33')]]={'$like':'%'+_0x3922af[_0x8a00('0x39')][_0x8a00('0x46')]+'%'};return _0x44da41;}})});}_0x34a162=_[_0x8a00('0x47')]({},_0x34a162,_0x3922af['options']);var _0x3133b7={'where':_0x34a162[_0x8a00('0x45')]};return db[_0x8a00('0x4a')][_0x8a00('0x2c')](_0x3133b7)[_0x8a00('0x20')](function(_0x3764e3){_0x35bcc9[_0x8a00('0x2c')]=_0x3764e3;if(_0x3922af[_0x8a00('0x39')][_0x8a00('0x4b')]){_0x34a162[_0x8a00('0x4c')]=[{'all':!![]}];}return db[_0x8a00('0x4a')][_0x8a00('0x4d')](_0x34a162);})[_0x8a00('0x20')](function(_0x4c5460){_0x35bcc9['rows']=_0x4c5460;return _0x35bcc9;})['then'](respondWithFilteredResult(_0x5113ac,_0x34a162))['catch'](handleError(_0x5113ac,null));};exports[_0x8a00('0x4e')]=function(_0x763cb1,_0x4cf222){var _0xc9e150={'raw':!![],'where':{'id':_0x763cb1['params']['id']}},_0xe79ecd={};_0xe79ecd[_0x8a00('0x38')]=_[_0x8a00('0x3a')](db[_0x8a00('0x4a')][_0x8a00('0x4f')]);_0xe79ecd[_0x8a00('0x39')]=_[_0x8a00('0x3a')](_0x763cb1[_0x8a00('0x39')]);_0xe79ecd['filters']=_[_0x8a00('0x3c')](_0xe79ecd[_0x8a00('0x38')],_0xe79ecd[_0x8a00('0x39')]);_0xc9e150['attributes']=_[_0x8a00('0x3c')](_0xe79ecd[_0x8a00('0x38')],qs['fields'](_0x763cb1['query'][_0x8a00('0x3e')]));_0xc9e150[_0x8a00('0x3d')]=_0xc9e150[_0x8a00('0x3d')][_0x8a00('0x3f')]?_0xc9e150['attributes']:_0xe79ecd[_0x8a00('0x38')];if(_0x763cb1[_0x8a00('0x39')][_0x8a00('0x4b')]){_0xc9e150['include']=[{'all':!![]}];}_0xc9e150=_[_0x8a00('0x47')]({},_0xc9e150,_0x763cb1[_0x8a00('0x50')]);return db[_0x8a00('0x4a')][_0x8a00('0x51')](_0xc9e150)[_0x8a00('0x20')](handleEntityNotFound(_0x4cf222,null))[_0x8a00('0x20')](respondWithResult(_0x4cf222,null))[_0x8a00('0x52')](handleError(_0x4cf222,null));};exports['create']=function(_0x236fd1,_0xb4854f){return db['SmsMessage'][_0x8a00('0x53')](_0x236fd1['body'],{})[_0x8a00('0x20')](respondWithResult(_0xb4854f,0xc9))[_0x8a00('0x52')](handleError(_0xb4854f,null));};exports[_0x8a00('0x54')]=function(_0xb84e85,_0x43d16e){if(_0xb84e85[_0x8a00('0x55')]['id']){delete _0xb84e85[_0x8a00('0x55')]['id'];}return db[_0x8a00('0x4a')][_0x8a00('0x51')]({'where':{'id':_0xb84e85[_0x8a00('0x56')]['id']}})[_0x8a00('0x20')](handleEntityNotFound(_0x43d16e,null))[_0x8a00('0x20')](saveUpdates(_0xb84e85['body'],null))[_0x8a00('0x20')](respondWithResult(_0x43d16e,null))[_0x8a00('0x52')](handleError(_0x43d16e,null));};exports[_0x8a00('0x31')]=function(_0xc28bcf,_0x5782b1){return db[_0x8a00('0x4a')][_0x8a00('0x51')]({'where':{'id':_0xc28bcf[_0x8a00('0x56')]['id']}})[_0x8a00('0x20')](handleEntityNotFound(_0x5782b1,null))[_0x8a00('0x20')](removeEntity(_0x5782b1,null))[_0x8a00('0x52')](handleError(_0x5782b1,null));};exports['describe']=function(_0x58ccf4,_0x178599){return db[_0x8a00('0x4a')][_0x8a00('0x57')]()[_0x8a00('0x20')](respondWithResult(_0x178599,null))[_0x8a00('0x52')](handleError(_0x178599,null));};var interaction_log=require(_0x8a00('0x12'))(_0x8a00('0x58'));exports[_0x8a00('0x59')]=function(_0x4e401e,_0x30d1c8,_0x55b3ea){var _0x49de28={'channel':'sms'};if(_0x4e401e['body']['id']){delete _0x4e401e[_0x8a00('0x55')]['id'];}_0x4e401e[_0x8a00('0x55')][_0x8a00('0x5a')]=!![];_0x4e401e['body'][_0x8a00('0x5b')]=moment()[_0x8a00('0x5c')](_0x8a00('0x5d'));_0x4e401e['body'][_0x8a00('0x5e')]=_0x4e401e[_0x8a00('0x55')][_0x8a00('0x5e')]||_0x4e401e['user']['id'];return db[_0x8a00('0x4a')]['find']({'where':{'id':_0x4e401e[_0x8a00('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x8a00('0x5f')],'as':'Contact'}]})[_0x8a00('0x20')](handleEntityNotFound(_0x30d1c8,null))[_0x8a00('0x20')](saveUpdates(_0x4e401e[_0x8a00('0x55')],null))[_0x8a00('0x20')](function(_0x5dbbda){if(_0x5dbbda){_0x49de28[_0x8a00('0x28')]=_0x5dbbda[_0x8a00('0x60')]({'plain':!![]});return db[_0x8a00('0x61')][_0x8a00('0x51')]({'where':{'id':_0x5dbbda[_0x8a00('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x30d1c8,null))[_0x8a00('0x20')](function(_0xd687f0){if(_0xd687f0){return _0xd687f0['update']({'UserId':_0x4e401e[_0x8a00('0x55')][_0x8a00('0x5e')],'read1stAt':_[_0x8a00('0x63')](_0xd687f0[_0x8a00('0x64')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x8a00('0x20')](function(_0x5993cf){if(_0x5993cf){_0x49de28[_0x8a00('0x65')]=_0x5993cf[_0x8a00('0x60')]({'plain':!![]});interaction_log[_0x8a00('0x21')](_0x8a00('0x66'),_0x4e401e['user']['id'],_0x4e401e['user'][_0x8a00('0x33')],_0x4e401e[_0x8a00('0x67')]['role'],_0x49de28['interaction']['id'],_0x4e401e[_0x8a00('0x55')]?JSON[_0x8a00('0x25')](_0x4e401e[_0x8a00('0x55')]):_0x8a00('0x68'));return respondWithRpcPromise('AcceptMessage',_0x8a00('0x69'),_0x49de28);}return null;})[_0x8a00('0x20')](function(_0x24f42e){if(_0x24f42e){if(_0x4e401e[_0x8a00('0x55')][_0x8a00('0x6a')]){_0x49de28['message'][_0x8a00('0x6b')]=util[_0x8a00('0x5c')](_0x8a00('0x6c'),_0x4e401e[_0x8a00('0x67')]['name']);_0x49de28[_0x8a00('0x28')][_0x8a00('0x6d')]=_0x49de28[_0x8a00('0x6d')];_0x49de28[_0x8a00('0x28')]['event']='accept';return respondWithRpcPromise('EventManager',_0x8a00('0x6e'),{'event':_0x8a00('0x6f'),'message':_0x49de28[_0x8a00('0x28')]},client9002)[_0x8a00('0x20')](function(){return _0x49de28;});}return _0x49de28;}return null;})[_0x8a00('0x20')](respondWithResult(_0x30d1c8,null))[_0x8a00('0x52')](handleError(_0x30d1c8,null));};var interaction_log=require(_0x8a00('0x12'))(_0x8a00('0x58'));exports[_0x8a00('0x30')]=function(_0x4b7366,_0x3583c3,_0x43ec08){var _0x32318c={'agent':{},'channel':'sms'};if(_0x4b7366[_0x8a00('0x55')]['id']){delete _0x4b7366[_0x8a00('0x55')]['id'];}_0x4b7366[_0x8a00('0x55')][_0x8a00('0x5e')]=_0x4b7366['body'][_0x8a00('0x5e')]||_0x4b7366[_0x8a00('0x67')]['id'];_0x32318c['agent']['id']=_0x4b7366[_0x8a00('0x55')][_0x8a00('0x5e')];return db[_0x8a00('0x4a')][_0x8a00('0x51')]({'where':{'id':_0x4b7366[_0x8a00('0x56')]['id'],'UserId':null}})[_0x8a00('0x20')](handleEntityNotFound(_0x3583c3,null))[_0x8a00('0x20')](function(_0x9e25b5){if(_0x9e25b5){_0x32318c[_0x8a00('0x28')]=_0x9e25b5[_0x8a00('0x60')]({'plain':!![]});return db[_0x8a00('0x61')][_0x8a00('0x51')]({'where':{'id':_0x9e25b5[_0x8a00('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x3583c3,null))[_0x8a00('0x20')](function(_0x57c579){if(_0x57c579){_0x32318c[_0x8a00('0x65')]=_0x57c579[_0x8a00('0x60')]({'plain':!![]});interaction_log[_0x8a00('0x21')](_0x8a00('0x70'),_0x4b7366[_0x8a00('0x67')]['id'],_0x4b7366[_0x8a00('0x67')][_0x8a00('0x33')],_0x4b7366[_0x8a00('0x67')]['role'],_0x32318c[_0x8a00('0x65')]['id'],_0x4b7366[_0x8a00('0x55')]?JSON['stringify'](_0x4b7366[_0x8a00('0x55')]):'null');return respondWithRpcPromise(_0x8a00('0x71'),_0x8a00('0x72'),_0x32318c);}return null;})[_0x8a00('0x20')](function(_0x123f67){if(_0x123f67){_0x123f67['message']['interface']=util[_0x8a00('0x5c')](_0x8a00('0x6c'),_0x4b7366[_0x8a00('0x67')][_0x8a00('0x33')]);_0x123f67['message']['channel']=_0x32318c['channel'];_0x123f67['message'][_0x8a00('0x73')]=_0x8a00('0x30');respondWithRpcPromise(_0x8a00('0x6e'),_0x8a00('0x6e'),{'event':_0x8a00('0x74'),'message':_0x123f67['message']},client9002);return _0x32318c;}return null;})[_0x8a00('0x20')](respondWithResult(_0x3583c3,null))[_0x8a00('0x52')](handleError(_0x3583c3,null));};exports[_0x8a00('0x2a')]=function(_0x4daa78,_0x5421b0,_0x1a96d2){if(_0x4daa78['body']['id']){delete _0x4daa78[_0x8a00('0x55')]['id'];}var _0x2ac946;return db[_0x8a00('0x4a')]['find']({'where':{'id':_0x4daa78[_0x8a00('0x56')]['id']}})['then'](handleEntityNotFound(_0x5421b0,null))[_0x8a00('0x20')](function(_0x2a0552){if(_0x2a0552){_0x2ac946=_0x2a0552;return db[_0x8a00('0x75')][_0x8a00('0x51')]({'where':{'id':_0x2a0552[_0x8a00('0x76')]}});}})[_0x8a00('0x20')](handleEntityNotFound(_0x5421b0,null))['then'](function(_0x3e28c7){if(_0x3e28c7){logger[_0x8a00('0x77')](_0x8a00('0x24'),_0x8a00('0x2a'),_0x8a00('0x78'),_0x3e28c7[_0x8a00('0x48')],util[_0x8a00('0x79')](_0x4daa78['body'],{'showHidden':![],'depth':null}));switch(_0x3e28c7['type']){case _0x8a00('0x7a'):if(_0x4daa78['body'][_0x8a00('0x7b')]&&_0x4daa78[_0x8a00('0x55')][_0x8a00('0x7b')]===_0x2ac946[_0x8a00('0x7c')]){return _0x2ac946['update']({'read':!![]});}else{logger[_0x8a00('0x26')](_0x8a00('0x7d'),_0x8a00('0x2a'),_0x8a00('0x7a'),util[_0x8a00('0x79')](_0x4daa78['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x4daa78[_0x8a00('0x55')][_0x8a00('0x7e')]&&_0x4daa78[_0x8a00('0x55')][_0x8a00('0x7e')]===_0x2ac946[_0x8a00('0x7c')]&&_[_0x8a00('0x7f')]([_0x8a00('0x80'),_0x8a00('0x81')],_0x4daa78[_0x8a00('0x55')][_0x8a00('0x82')])>=0x0){return _0x2ac946[_0x8a00('0x54')]({'read':!![]});}else{logger[_0x8a00('0x26')](_0x8a00('0x7d'),_0x8a00('0x2a'),_0x8a00('0x83'),util[_0x8a00('0x79')](_0x4daa78[_0x8a00('0x55')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4e8f72=_0x4daa78[_0x8a00('0x55')][_0x8a00('0x84')][0x0];if(_0x4e8f72[_0x8a00('0x2a')][_0x8a00('0x85')]===_0x8a00('0x86')){return _0x2ac946[_0x8a00('0x54')]({'read':!![]});}else{logger[_0x8a00('0x26')](_0x8a00('0x7d'),'status',_0x8a00('0x87'),util[_0x8a00('0x79')](_0x4daa78[_0x8a00('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x2ac946;}})['then'](respondWithResult(_0x5421b0,null))['catch'](handleError(_0x5421b0,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index e6c69f2..cb5f426 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 _0x1b9c=['../../mysqldb','SmsMessage','update','emit','hook'];(function(_0xffa29a,_0x4c671e){var _0x2875c2=function(_0x40eca2){while(--_0x40eca2){_0xffa29a['push'](_0xffa29a['shift']());}};_0x2875c2(++_0x4c671e);}(_0x1b9c,0x15e));var _0xc1b9=function(_0x1e4433,_0x137702){_0x1e4433=_0x1e4433-0x0;var _0x47a678=_0x1b9c[_0x1e4433];return _0x47a678;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xc1b9('0x0'))['db'][_0xc1b9('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc1b9('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5bf234){return function(_0x5d84f2,_0xbc1c14,_0x2d08e3){SmsMessageEvents[_0xc1b9('0x3')](_0x5bf234+':'+_0x5d84f2['id'],_0x5d84f2);SmsMessageEvents[_0xc1b9('0x3')](_0x5bf234,_0x5d84f2);_0x2d08e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xc1b9('0x4')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x9577=['remove','emit','hook','exports','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x9577,0xc1));var _0x7957=function(_0x6534b8,_0x2504b1){_0x6534b8=_0x6534b8-0x0;var _0x31c9f1=_0x9577[_0x6534b8];return _0x31c9f1;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x7957('0x0'))['db'][_0x7957('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7957('0x2')](0x0);var events={'afterCreate':_0x7957('0x3'),'afterUpdate':_0x7957('0x4'),'afterDestroy':_0x7957('0x5')};function emitEvent(_0x8e6fa9){return function(_0x463244,_0xec9fe0,_0x3fd70c){SmsMessageEvents[_0x7957('0x6')](_0x8e6fa9+':'+_0x463244['id'],_0x463244);SmsMessageEvents[_0x7957('0x6')](_0x8e6fa9,_0x463244);_0x3fd70c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x7957('0x7')](e,emitEvent(event));}}module[_0x7957('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 ed668f8..fa2d847 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 _0xc2b7=['base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','POST','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','uuid','UTF-8','apiMessageId','clickatell','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','application/json','message','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','messageId','fti_sms_messages','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','update','createdAt','catch','error','find','type','twilio','authToken','create','body','phone','remote','/api/sms/messages/','/status?token=','token','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','&password=','sms','user_key','session_key','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','then','requestid','deliveryReport','connectel','xCALLY\x20Motion','format','%s:%s','username','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc2b7,0x119));var _0x7c2b=function(_0x3c21ba,_0x5f2565){_0x3c21ba=_0x3c21ba-0x0;var _0x4392ee=_0xc2b7[_0x3c21ba];return _0x4392ee;};'use strict';var _=require(_0x7c2b('0x0'));var util=require('util');var logger=require(_0x7c2b('0x1'))('api');var moment=require(_0x7c2b('0x2'));var BPromise=require(_0x7c2b('0x3'));var rp=require(_0x7c2b('0x4'));var fs=require('fs');var path=require(_0x7c2b('0x5'));var rimraf=require(_0x7c2b('0x6'));var config=require(_0x7c2b('0x7'));var attributes=require(_0x7c2b('0x8'));module[_0x7c2b('0x9')]=function(_0x31a0c7,_0x3f5cb0){return _0x31a0c7['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x7c2b('0xa'),'fields':['messageId']},{'name':_0x7c2b('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1996a9,_0x425d6d,_0xa81584){var _0x3e3bbd=_0x31a0c7[_0x7c2b('0xc')];var _0x238b16=_0x1996a9[_0x7c2b('0xd')]({'plain':!![]});if(_0x238b16[_0x7c2b('0xe')][_0x7c2b('0xf')]()==='in'||_0x238b16[_0x7c2b('0xe')][_0x7c2b('0xf')]()==='out'&&!_0x238b16[_0x7c2b('0x10')]&&!_[_0x7c2b('0x11')](_0x238b16[_0x7c2b('0x12')])){_0x3e3bbd[_0x7c2b('0x13')][_0x7c2b('0x14')]({'where':{'id':_0x238b16[_0x7c2b('0x15')]}})['then'](function(_0x1898ca){if(_0x1898ca){_0x1898ca[_0x7c2b('0x16')]({'lastMsgAt':_0x238b16[_0x7c2b('0x17')],'lastMsgDirection':_0x238b16[_0x7c2b('0xe')][_0x7c2b('0xf')]()});}})[_0x7c2b('0x18')](function(_0x156087){console[_0x7c2b('0x19')](_0x156087);});}if(_0x238b16[_0x7c2b('0xe')]==='out'&&!_0x238b16[_0x7c2b('0x10')]){var _0x36353b;_0x3e3bbd['SmsAccount'][_0x7c2b('0x1a')]({'where':{'id':_0x238b16['SmsAccountId']},'raw':!![]})['then'](function(_0x2e5b0c){_0x36353b=_0x2e5b0c;if(_0x36353b&&_0x36353b[_0x7c2b('0x1b')]){switch(_0x36353b[_0x7c2b('0x1b')]){case _0x7c2b('0x1c'):var _0x36ca35=require(_0x7c2b('0x1c'));if(_0x36353b['accountSid']&&_0x36353b[_0x7c2b('0x1d')]&&_0x36353b['phone']){var _0x20fa26=new _0x36ca35(_0x36353b['accountSid'],_0x36353b[_0x7c2b('0x1d')]);_0x20fa26['messages'][_0x7c2b('0x1e')]({'body':_0x238b16[_0x7c2b('0x1f')],'to':_0x238b16[_0x7c2b('0x20')],'from':_0x36353b[_0x7c2b('0x20')],'statusCallback':_0x36353b[_0x7c2b('0x21')]+_0x7c2b('0x22')+_0x238b16['id']+_0x7c2b('0x23')+_0x36353b[_0x7c2b('0x24')]})['then'](function(_0x15c228){if(_0x15c228[_0x7c2b('0x25')]){return _0x1996a9['update']({'messageId':_0x15c228[_0x7c2b('0x25')]});}})[_0x7c2b('0x18')](function(_0x2da4b4){logger[_0x7c2b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c2b('0x26'),_0x7c2b('0x1c'),util[_0x7c2b('0x27')](_0x2da4b4,{'showHidden':![],'depth':null}));});}else{logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x1c'),_0x7c2b('0x29'));}break;case _0x7c2b('0x2a'):var _0x130b0c=_0x7c2b('0x2b');if(_0x36353b['username']&&_0x36353b[_0x7c2b('0x2c')]){var _0x572e50={'recipient':[_0x238b16['phone']],'message':_0x238b16[_0x7c2b('0x1f')],'message_type':_0x36353b['smsMethod']};if(_0x36353b['smsMethod']&&_0x36353b[_0x7c2b('0x2d')]!=='SI'){_0x572e50[_0x7c2b('0x2e')]=_0x36353b[_0x7c2b('0x20')];}var _0xdbbdcc={'url':_0x130b0c+'login?username='+_0x36353b['username']+_0x7c2b('0x2f')+_0x36353b[_0x7c2b('0x2c')],'method':'GET'};rp(_0xdbbdcc)['then'](function(_0x2fb1a3){var _0x3a3388=_0x2fb1a3['split'](';');var _0x171a23={'user_key':_0x3a3388[0x0],'session_key':_0x3a3388[0x1]};_0xdbbdcc={'url':_0x130b0c+_0x7c2b('0x30'),'method':'POST','headers':{'user_key':_0x171a23[_0x7c2b('0x31')],'Session_key':_0x171a23[_0x7c2b('0x32')]},'json':!![],'body':_0x572e50};return rp(_0xdbbdcc);})['then'](function(_0x4628bc){if(_0x4628bc['total_sent']>=0x1){var _0x65f24c={'messageId':_0x4628bc[_0x7c2b('0x33')]};if(_0x36353b[_0x7c2b('0x2d')]!=='GP'||!_0x36353b['deliveryReport']){_0x65f24c[_0x7c2b('0x34')]=!![];}return _0x1996a9[_0x7c2b('0x16')](_0x65f24c);}else{return logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x2a'),util['inspect'](_0x4628bc,{'showHidden':![],'depth':null}));}})['catch'](function(_0x40949d){return logger[_0x7c2b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c2b('0x26'),'skebby',util['inspect'](_0x40949d,{'showHidden':![],'depth':null}));});}else{logger[_0x7c2b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c2b('0x26'),'skebby',_0x7c2b('0x35'));}break;case'connectel':if(_0x36353b[_0x7c2b('0x1d')]){var _0xe3aea9={'recipient':_0x238b16['phone'],'message':_0x238b16[_0x7c2b('0x1f')],'sender':_0x36353b[_0x7c2b('0x36')]||_0x36353b[_0x7c2b('0x20')],'authorization':_0x36353b['authToken']};var _0x425d6d={'method':'POST','uri':_0x7c2b('0x37'),'body':_0xe3aea9,'json':!![]};rp(_0x425d6d)[_0x7c2b('0x38')](function(_0x4eeba5){var _0x56d0f5={'messageId':_0x4eeba5[_0x7c2b('0x39')]};if(!_0x36353b[_0x7c2b('0x3a')]){_0x56d0f5[_0x7c2b('0x34')]=!![];}return _0x1996a9[_0x7c2b('0x16')](_0x56d0f5);})['catch'](function(_0x3d20e7){logger[_0x7c2b('0x19')](_0x7c2b('0x28'),'afterCreate',_0x7c2b('0x3b'),util[_0x7c2b('0x27')](_0x3d20e7,{'showHidden':![],'depth':null}));});}else{logger[_0x7c2b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c2b('0x26'),'connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x36353b['username']&&_0x36353b[_0x7c2b('0x2c')]){var _0xe3aea9={'messages':[{'source':_0x7c2b('0x3c'),'to':_0x238b16['phone'],'body':_0x238b16[_0x7c2b('0x1f')],'from':_0x36353b[_0x7c2b('0x36')]||_0x36353b[_0x7c2b('0x20')]}]};var _0x8d4ce0=util[_0x7c2b('0x3d')](_0x7c2b('0x3e'),_0x36353b[_0x7c2b('0x3f')],_0x36353b[_0x7c2b('0x2c')]);var _0x425d6d={'method':'POST','uri':_0x7c2b('0x40'),'body':_0xe3aea9,'headers':{'Authorization':util[_0x7c2b('0x3d')](_0x7c2b('0x41'),new Buffer(_0x8d4ce0)[_0x7c2b('0x42')](_0x7c2b('0x43')))},'json':!![]};rp(_0x425d6d)[_0x7c2b('0x38')](function(_0xf21ea8){if(_0xf21ea8[_0x7c2b('0x44')]>=0xc8&&_0xf21ea8[_0x7c2b('0x44')]<=0xce){if(_0xf21ea8[_0x7c2b('0x45')]&&_0xf21ea8[_0x7c2b('0x45')][_0x7c2b('0x46')]>0x0){var _0x5cd089=_[_0x7c2b('0x47')](_0xf21ea8['data'][_0x7c2b('0x48')]);var _0x432235={'messageId':_0x5cd089[_0x7c2b('0x49')]};if(!_0x36353b['deliveryReport']){_0x432235[_0x7c2b('0x34')]=!![];}return _0x1996a9['update'](_0x432235);}else{logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x4a'),util[_0x7c2b('0x27')](_0xf21ea8,{'showHidden':![],'depth':null}));}}else{logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x4a'),util[_0x7c2b('0x27')](_0xf21ea8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5a53f7){logger['error'](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x4a'),util[_0x7c2b('0x27')](_0x5a53f7,{'showHidden':![],'depth':null}));});}else{logger[_0x7c2b('0x19')](_0x7c2b('0x28'),'afterCreate',_0x7c2b('0x4a'),_0x7c2b('0x35'));}break;case _0x7c2b('0x4b'):if(_0x36353b[_0x7c2b('0x4c')]&&_0x36353b[_0x7c2b('0x1d')]){var _0xe3aea9={'dst':_0x238b16['phone'],'text':_0x238b16[_0x7c2b('0x1f')],'src':_0x36353b[_0x7c2b('0x36')]||_0x36353b[_0x7c2b('0x20')],'url':_0x36353b[_0x7c2b('0x21')]+'/api/sms/messages/'+_0x238b16['id']+_0x7c2b('0x23')+_0x36353b['token']};var _0x8d4ce0=util['format'](_0x7c2b('0x3e'),_0x36353b['authId'],_0x36353b['authToken']);var _0x425d6d={'method':_0x7c2b('0x4d'),'uri':util[_0x7c2b('0x3d')](_0x7c2b('0x4e'),_0x36353b[_0x7c2b('0x4c')]),'body':_0xe3aea9,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x8d4ce0)[_0x7c2b('0x42')](_0x7c2b('0x43')))},'json':!![]};rp(_0x425d6d)[_0x7c2b('0x38')](function(_0x33f256){var _0x3f71ff={'messageId':_0x33f256[_0x7c2b('0x4f')][0x0]};return _0x1996a9['update'](_0x3f71ff);})[_0x7c2b('0x18')](function(_0x3e1b1c){logger['error'](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x4b'),util['inspect'](_0x3e1b1c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7c2b('0x28'),_0x7c2b('0x26'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x7c2b('0x50'):if(_0x36353b[_0x7c2b('0x3f')]&&_0x36353b[_0x7c2b('0x2c')]){if(_0x36353b['baseUrl']){var _0x101117={'method':_0x7c2b('0x4d'),'uri':_0x36353b[_0x7c2b('0x51')]+_0x7c2b('0x52'),'body':{'username':_0x36353b['username'],'password':_0x36353b[_0x7c2b('0x2c')]},'json':!![]};return rp(_0x101117)[_0x7c2b('0x38')](function(_0x35ad31){var _0x38ef33={'method':_0x7c2b('0x4d'),'uri':_0x36353b[_0x7c2b('0x51')]+_0x7c2b('0x53'),'body':{'messages':[{'from':_0x36353b[_0x7c2b('0x20')],'destinations':[{'to':_0x238b16[_0x7c2b('0x20')]}],'text':_0x238b16[_0x7c2b('0x1f')],'notifyUrl':_0x36353b[_0x7c2b('0x21')]+'/api/sms/messages/'+_0x238b16['id']+_0x7c2b('0x23')+_0x36353b[_0x7c2b('0x24')],'notifyContentType':'application/json','callbackData':_0x36353b[_0x7c2b('0x20')]+';'+_0x238b16['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x35ad31['token']},'json':!![]};return rp(_0x38ef33)[_0x7c2b('0x38')](function(_0x1a7943){if(_0x1a7943[_0x7c2b('0x48')]){var _0x38e362={'messageId':_0x1a7943[_0x7c2b('0x48')][0x0][_0x7c2b('0xa')]};if(!_0x36353b['deliveryReport']){_0x38e362[_0x7c2b('0x34')]=!![];}return _0x1996a9[_0x7c2b('0x16')](_0x38e362);}else{return logger[_0x7c2b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c2b('0x26'),_0x7c2b('0x50'),util[_0x7c2b('0x27')](_0x1a7943,{'showHidden':![],'depth':null}));}});})[_0x7c2b('0x18')](function(_0x4f0097){return logger['error'](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x50'),util[_0x7c2b('0x27')](_0x4f0097,{'showHidden':![],'depth':null}));});}else{logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),'infobip',_0x7c2b('0x54'));}}else{logger[_0x7c2b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7c2b('0x50'),_0x7c2b('0x35'));}break;case _0x7c2b('0x55'):var _0x1ffce0=require(_0x7c2b('0x56'));if(_0x36353b[_0x7c2b('0x57')]){var _0x24e67b={};_0x24e67b[_0x7c2b('0x58')]=_0x36353b[_0x7c2b('0x3f')];_0x24e67b[_0x7c2b('0x20')]=_0x238b16['phone'];_0x24e67b[_0x7c2b('0x2e')]=_0x36353b['phone'];_0x24e67b[_0x7c2b('0x59')]=_0x238b16['body'];_0x24e67b[_0x7c2b('0x5a')]=+new Date();var _0xabd23='';var _0x404338='';var _0x3f2472=Object[_0x7c2b('0x5b')](_0x24e67b);_0x3f2472['sort']();for(var _0x4b889c=0x0;_0x4b889c<_0x3f2472[_0x7c2b('0x5c')];_0x4b889c++){if(_0xabd23!=''){_0xabd23+='&';}_0xabd23+=_0x3f2472[_0x4b889c]+'='+encodeURIComponent(_0x24e67b[_0x3f2472[_0x4b889c]]);_0x404338+=_0x24e67b[_0x3f2472[_0x4b889c]];}_0x404338+=_0x36353b['apiKey'];_0x404338=_0x1ffce0[_0x7c2b('0x5d')](_0x7c2b('0x5e'))['update'](_0x404338)[_0x7c2b('0x5f')](_0x7c2b('0x60'));if(_0xabd23!==''){_0xabd23+='&';}_0xabd23+=_0x7c2b('0x61')+_0x404338;var _0xdbbdcc={'method':'GET','uri':_0x36353b[_0x7c2b('0x51')]+_0x7c2b('0x62')+_0xabd23,'json':!![]};return rp(_0xdbbdcc)[_0x7c2b('0x38')](function(_0x146223){var _0x2ad9d4=Object[_0x7c2b('0x5b')](_0x146223);if(_0x146223[_0x2ad9d4[0x0]][_0x7c2b('0x19')]&&parseInt(_0x146223[_0x2ad9d4[0x0]][_0x7c2b('0x19')])===0x0){var _0x581615={'messageId':_0x146223[_0x2ad9d4[0x0]]['id_sms']};if(!_0x36353b[_0x7c2b('0x3a')]){_0x581615[_0x7c2b('0x34')]=!![];}return _0x1996a9['update'](_0x581615);}else{return logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),'csc',util[_0x7c2b('0x27')](_0x146223['error'],{'showHidden':![],'depth':null}));}})[_0x7c2b('0x18')](function(_0x1da630){return logger[_0x7c2b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c2b('0x26'),_0x7c2b('0x55'),util[_0x7c2b('0x27')](_0x1da630,{'showHidden':![],'depth':null}));});}else{logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x55'),_0x7c2b('0x63'));}break;case'clickatell':if(_0x36353b[_0x7c2b('0x57')]){var _0x49b6b7={'method':_0x7c2b('0x4d'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x36353b['apiKey']},'body':{'content':_0x238b16['body'],'to':[_0x238b16[_0x7c2b('0x20')]],'from':_0x36353b[_0x7c2b('0x20')],'binary':![],'clientMessageId':_0x7c2b('0x64'),'charset':_0x7c2b('0x65')},'json':!![]};rp(_0x49b6b7)['then'](function(_0x5e6bb2){if(!_0x5e6bb2[_0x7c2b('0x19')]){var _0x1c3adb={'messageId':_0x5e6bb2[_0x7c2b('0x48')][0x0][_0x7c2b('0x66')]};if(!_0x36353b[_0x7c2b('0x3a')]){_0x1c3adb[_0x7c2b('0x34')]=!![];}return _0x1996a9[_0x7c2b('0x16')](_0x1c3adb);}else{return logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x67'),util['inspect'](_0x5e6bb2['error'],{'showHidden':![],'depth':null}));}})[_0x7c2b('0x18')](function(_0x489d4d){return logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x67'),util[_0x7c2b('0x27')](_0x489d4d,{'showHidden':![],'depth':null}));});}else{logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x67'),_0x7c2b('0x63'));}break;case _0x7c2b('0x68'):if(_0x36353b[_0x7c2b('0x57')]){var _0x58fe36={};var _0xdbbdcc={'method':_0x7c2b('0x4d'),'uri':_0x7c2b('0x69'),'headers':{'Authorization':_0x7c2b('0x6a')+_0x36353b[_0x7c2b('0x57')],'Content-Type':'application/json'},'body':{'from':_0x36353b[_0x7c2b('0x20')],'to':_0x238b16[_0x7c2b('0x20')],'text':_0x238b16[_0x7c2b('0x1f')]},'json':!![]};return rp(_0xdbbdcc)['then'](function(_0x358078){if(_0x358078[_0x7c2b('0x6b')]==0xca){_0x58fe36['message']=_0x358078;var _0x3ec767={'method':_0x7c2b('0x4d'),'uri':_0x7c2b('0x6c'),'headers':{'Authorization':'Bearer\x20'+_0x36353b[_0x7c2b('0x57')],'Content-Type':_0x7c2b('0x6d')},'body':{'refid':_0x58fe36[_0x7c2b('0x6e')][_0x7c2b('0x6f')]},'json':!![]};return rp(_0x3ec767)['then'](function(_0x2e61b4){_0x58fe36[_0x7c2b('0x70')]=_0x2e61b4;var _0xacfbd={'messageId':_0x58fe36[_0x7c2b('0x6e')]['refid'],'read':!![]};return _0x1996a9[_0x7c2b('0x16')](_0xacfbd);});}else{return logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),'intelepeer',util[_0x7c2b('0x27')](_0x358078,{'showHidden':![],'depth':null}));}})[_0x7c2b('0x18')](function(_0x37bf67){return logger['error'](_0x7c2b('0x28'),'afterCreate',_0x7c2b('0x68'),util[_0x7c2b('0x27')](_0x37bf67,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x68'),'Token\x20not\x20received');}break;}}})[_0x7c2b('0x71')](function(){_0xa81584();});}else{_0xa81584();}}},'charset':_0x7c2b('0x72'),'collate':_0x7c2b('0x73')});}; \ No newline at end of file +var _0x878a=['exports','define','messageId','fti_sms_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','createdAt','error','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','update','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','body','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','keys','sort','createHash','digest','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x878a,0x6b));var _0xa878=function(_0x115f6c,_0x2c78b0){_0x115f6c=_0x115f6c-0x0;var _0x66b78f=_0x878a[_0x115f6c];return _0x66b78f;};'use strict';var _=require(_0xa878('0x0'));var util=require(_0xa878('0x1'));var logger=require(_0xa878('0x2'))(_0xa878('0x3'));var moment=require('moment');var BPromise=require(_0xa878('0x4'));var rp=require(_0xa878('0x5'));var fs=require('fs');var path=require(_0xa878('0x6'));var rimraf=require(_0xa878('0x7'));var config=require(_0xa878('0x8'));var attributes=require('./smsMessage.attributes');module[_0xa878('0x9')]=function(_0x5c3416,_0xb28252){return _0x5c3416[_0xa878('0xa')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xa878('0xb'),'fields':[_0xa878('0xb')]},{'name':_0xa878('0xc'),'fields':['body'],'type':_0xa878('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1b9cfb,_0x548729,_0x29796c){var _0x58bcec=_0x5c3416['models'];var _0x5a6745=_0x1b9cfb[_0xa878('0xe')]({'plain':!![]});if(_0x5a6745[_0xa878('0xf')][_0xa878('0x10')]()==='in'||_0x5a6745[_0xa878('0xf')]['toLowerCase']()===_0xa878('0x11')&&!_0x5a6745[_0xa878('0x12')]&&!_[_0xa878('0x13')](_0x5a6745[_0xa878('0x14')])){_0x58bcec[_0xa878('0x15')]['findOne']({'where':{'id':_0x5a6745[_0xa878('0x16')]}})[_0xa878('0x17')](function(_0x546b38){if(_0x546b38){_0x546b38['update']({'lastMsgAt':_0x5a6745[_0xa878('0x18')],'lastMsgDirection':_0x5a6745['direction']['toLowerCase']()});}})['catch'](function(_0x47a040){console[_0xa878('0x19')](_0x47a040);});}if(_0x5a6745[_0xa878('0xf')]===_0xa878('0x11')&&!_0x5a6745[_0xa878('0x12')]){var _0x14ced8;_0x58bcec['SmsAccount'][_0xa878('0x1a')]({'where':{'id':_0x5a6745[_0xa878('0x1b')]},'raw':!![]})[_0xa878('0x17')](function(_0x48a563){_0x14ced8=_0x48a563;if(_0x14ced8&&_0x14ced8[_0xa878('0x1c')]){switch(_0x14ced8[_0xa878('0x1c')]){case'twilio':var _0x510b47=require(_0xa878('0x1d'));if(_0x14ced8[_0xa878('0x1e')]&&_0x14ced8[_0xa878('0x1f')]&&_0x14ced8[_0xa878('0x20')]){var _0x299132=new _0x510b47(_0x14ced8[_0xa878('0x1e')],_0x14ced8[_0xa878('0x1f')]);_0x299132[_0xa878('0x21')][_0xa878('0x22')]({'body':_0x5a6745['body'],'to':_0x5a6745['phone'],'from':_0x14ced8[_0xa878('0x20')],'statusCallback':_0x14ced8[_0xa878('0x23')]+_0xa878('0x24')+_0x5a6745['id']+_0xa878('0x25')+_0x14ced8[_0xa878('0x26')]})[_0xa878('0x17')](function(_0x5493aa){if(_0x5493aa[_0xa878('0x27')]){return _0x1b9cfb[_0xa878('0x28')]({'messageId':_0x5493aa[_0xa878('0x27')]});}})[_0xa878('0x29')](function(_0x11b9bd){logger[_0xa878('0x19')](_0xa878('0x2a'),_0xa878('0x2b'),_0xa878('0x1d'),util[_0xa878('0x2c')](_0x11b9bd,{'showHidden':![],'depth':null}));});}else{logger[_0xa878('0x19')](_0xa878('0x2a'),_0xa878('0x2b'),_0xa878('0x1d'),_0xa878('0x2d'));}break;case _0xa878('0x2e'):var _0x361a97='https://api.skebby.it/API/v1.0/REST/';if(_0x14ced8[_0xa878('0x2f')]&&_0x14ced8[_0xa878('0x30')]){var _0x56020d={'recipient':[_0x5a6745[_0xa878('0x20')]],'message':_0x5a6745[_0xa878('0x31')],'message_type':_0x14ced8[_0xa878('0x32')]};if(_0x14ced8['smsMethod']&&_0x14ced8[_0xa878('0x32')]!=='SI'){_0x56020d[_0xa878('0x33')]=_0x14ced8[_0xa878('0x20')];}var _0x219285={'url':_0x361a97+_0xa878('0x34')+_0x14ced8['username']+_0xa878('0x35')+_0x14ced8['password'],'method':_0xa878('0x36')};rp(_0x219285)[_0xa878('0x17')](function(_0xc3865c){var _0x18a536=_0xc3865c[_0xa878('0x37')](';');var _0x41e2c6={'user_key':_0x18a536[0x0],'session_key':_0x18a536[0x1]};_0x219285={'url':_0x361a97+_0xa878('0x38'),'method':_0xa878('0x39'),'headers':{'user_key':_0x41e2c6[_0xa878('0x3a')],'Session_key':_0x41e2c6[_0xa878('0x3b')]},'json':!![],'body':_0x56020d};return rp(_0x219285);})[_0xa878('0x17')](function(_0xc61ac3){if(_0xc61ac3[_0xa878('0x3c')]>=0x1){var _0x394eec={'messageId':_0xc61ac3['internal_order_id']};if(_0x14ced8['smsMethod']!=='GP'||!_0x14ced8[_0xa878('0x3d')]){_0x394eec[_0xa878('0x3e')]=!![];}return _0x1b9cfb[_0xa878('0x28')](_0x394eec);}else{return logger[_0xa878('0x19')](_0xa878('0x2a'),'afterCreate',_0xa878('0x2e'),util[_0xa878('0x2c')](_0xc61ac3,{'showHidden':![],'depth':null}));}})[_0xa878('0x29')](function(_0x3285ed){return logger[_0xa878('0x19')](_0xa878('0x2a'),_0xa878('0x2b'),'skebby',util['inspect'](_0x3285ed,{'showHidden':![],'depth':null}));});}else{logger[_0xa878('0x19')](_0xa878('0x2a'),_0xa878('0x2b'),_0xa878('0x2e'),_0xa878('0x3f'));}break;case _0xa878('0x40'):if(_0x14ced8[_0xa878('0x1f')]){var _0x47dd09={'recipient':_0x5a6745[_0xa878('0x20')],'message':_0x5a6745['body'],'sender':_0x14ced8['senderString']||_0x14ced8[_0xa878('0x20')],'authorization':_0x14ced8[_0xa878('0x1f')]};var _0x548729={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x47dd09,'json':!![]};rp(_0x548729)[_0xa878('0x17')](function(_0x10e7d5){var _0x3fb3d2={'messageId':_0x10e7d5['requestid']};if(!_0x14ced8[_0xa878('0x3d')]){_0x3fb3d2[_0xa878('0x3e')]=!![];}return _0x1b9cfb[_0xa878('0x28')](_0x3fb3d2);})[_0xa878('0x29')](function(_0x4de9f5){logger[_0xa878('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa878('0x2b'),_0xa878('0x40'),util[_0xa878('0x2c')](_0x4de9f5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa878('0x2a'),'afterCreate',_0xa878('0x40'),_0xa878('0x41'));}break;case _0xa878('0x42'):if(_0x14ced8['username']&&_0x14ced8[_0xa878('0x30')]){var _0x47dd09={'messages':[{'source':_0xa878('0x43'),'to':_0x5a6745[_0xa878('0x20')],'body':_0x5a6745[_0xa878('0x31')],'from':_0x14ced8[_0xa878('0x44')]||_0x14ced8[_0xa878('0x20')]}]};var _0x4bb735=util[_0xa878('0x45')]('%s:%s',_0x14ced8['username'],_0x14ced8[_0xa878('0x30')]);var _0x548729={'method':_0xa878('0x39'),'uri':_0xa878('0x46'),'body':_0x47dd09,'headers':{'Authorization':util[_0xa878('0x45')](_0xa878('0x47'),new Buffer(_0x4bb735)[_0xa878('0x48')](_0xa878('0x49')))},'json':!![]};rp(_0x548729)[_0xa878('0x17')](function(_0x28b771){if(_0x28b771[_0xa878('0x4a')]>=0xc8&&_0x28b771[_0xa878('0x4a')]<=0xce){if(_0x28b771[_0xa878('0x4b')]&&_0x28b771[_0xa878('0x4b')][_0xa878('0x4c')]>0x0){var _0x2077e8=_[_0xa878('0x4d')](_0x28b771[_0xa878('0x4b')][_0xa878('0x21')]);var _0x35e52d={'messageId':_0x2077e8['message_id']};if(!_0x14ced8[_0xa878('0x3d')]){_0x35e52d[_0xa878('0x3e')]=!![];}return _0x1b9cfb['update'](_0x35e52d);}else{logger[_0xa878('0x19')](_0xa878('0x2a'),_0xa878('0x2b'),_0xa878('0x4e'),util['inspect'](_0x28b771,{'showHidden':![],'depth':null}));}}else{logger[_0xa878('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa878('0x4e'),util[_0xa878('0x2c')](_0x28b771,{'showHidden':![],'depth':null}));}})[_0xa878('0x29')](function(_0x47f2d0){logger[_0xa878('0x19')](_0xa878('0x2a'),'afterCreate','clickSend',util[_0xa878('0x2c')](_0x47f2d0,{'showHidden':![],'depth':null}));});}else{logger[_0xa878('0x19')](_0xa878('0x2a'),'afterCreate',_0xa878('0x4e'),_0xa878('0x3f'));}break;case'plivo':if(_0x14ced8[_0xa878('0x4f')]&&_0x14ced8[_0xa878('0x1f')]){var _0x47dd09={'dst':_0x5a6745[_0xa878('0x20')],'text':_0x5a6745[_0xa878('0x31')],'src':_0x14ced8['senderString']||_0x14ced8[_0xa878('0x20')],'url':_0x14ced8[_0xa878('0x23')]+_0xa878('0x24')+_0x5a6745['id']+_0xa878('0x25')+_0x14ced8[_0xa878('0x26')]};var _0x4bb735=util['format'](_0xa878('0x50'),_0x14ced8[_0xa878('0x4f')],_0x14ced8[_0xa878('0x1f')]);var _0x548729={'method':_0xa878('0x39'),'uri':util[_0xa878('0x45')](_0xa878('0x51'),_0x14ced8['authId']),'body':_0x47dd09,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x4bb735)[_0xa878('0x48')](_0xa878('0x49')))},'json':!![]};rp(_0x548729)['then'](function(_0x51588a){var _0x245e28={'messageId':_0x51588a['message_uuid'][0x0]};return _0x1b9cfb[_0xa878('0x28')](_0x245e28);})[_0xa878('0x29')](function(_0x5ad84d){logger[_0xa878('0x19')](_0xa878('0x2a'),_0xa878('0x2b'),_0xa878('0x52'),util['inspect'](_0x5ad84d,{'showHidden':![],'depth':null}));});}else{logger[_0xa878('0x19')](_0xa878('0x2a'),_0xa878('0x2b'),_0xa878('0x52'),_0xa878('0x53'));}break;case'infobip':if(_0x14ced8['username']&&_0x14ced8[_0xa878('0x30')]){if(_0x14ced8[_0xa878('0x54')]){var _0x103801={'method':_0xa878('0x39'),'uri':_0x14ced8[_0xa878('0x54')]+'/auth/1/session','body':{'username':_0x14ced8[_0xa878('0x2f')],'password':_0x14ced8[_0xa878('0x30')]},'json':!![]};return rp(_0x103801)['then'](function(_0x533d5e){var _0x3021bd={'method':_0xa878('0x39'),'uri':_0x14ced8[_0xa878('0x54')]+_0xa878('0x55'),'body':{'messages':[{'from':_0x14ced8[_0xa878('0x20')],'destinations':[{'to':_0x5a6745[_0xa878('0x20')]}],'text':_0x5a6745['body'],'notifyUrl':_0x14ced8[_0xa878('0x23')]+_0xa878('0x24')+_0x5a6745['id']+'/status?token='+_0x14ced8['token'],'notifyContentType':_0xa878('0x56'),'callbackData':_0x14ced8['phone']+';'+_0x5a6745[_0xa878('0x31')]}]},'headers':{'Authorization':_0xa878('0x57')+_0x533d5e[_0xa878('0x26')]},'json':!![]};return rp(_0x3021bd)[_0xa878('0x17')](function(_0x317b84){if(_0x317b84[_0xa878('0x21')]){var _0x56285d={'messageId':_0x317b84[_0xa878('0x21')][0x0][_0xa878('0xb')]};if(!_0x14ced8['deliveryReport']){_0x56285d[_0xa878('0x3e')]=!![];}return _0x1b9cfb[_0xa878('0x28')](_0x56285d);}else{return logger[_0xa878('0x19')](_0xa878('0x2a'),_0xa878('0x2b'),_0xa878('0x58'),util[_0xa878('0x2c')](_0x317b84,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x4fc5e6){return logger[_0xa878('0x19')](_0xa878('0x2a'),_0xa878('0x2b'),_0xa878('0x58'),util[_0xa878('0x2c')](_0x4fc5e6,{'showHidden':![],'depth':null}));});}else{logger[_0xa878('0x19')](_0xa878('0x2a'),'afterCreate',_0xa878('0x58'),_0xa878('0x59'));}}else{logger[_0xa878('0x19')](_0xa878('0x2a'),_0xa878('0x2b'),'infobip',_0xa878('0x3f'));}break;case _0xa878('0x5a'):var _0x64aff4=require(_0xa878('0x5b'));if(_0x14ced8[_0xa878('0x5c')]){var _0x25be8f={};_0x25be8f[_0xa878('0x5d')]=_0x14ced8[_0xa878('0x2f')];_0x25be8f['phone']=_0x5a6745[_0xa878('0x20')];_0x25be8f[_0xa878('0x33')]=_0x14ced8[_0xa878('0x20')];_0x25be8f['text']=_0x5a6745[_0xa878('0x31')];_0x25be8f[_0xa878('0x5e')]=+new Date();var _0x3f4cc9='';var _0xf351ad='';var _0x278ae9=Object[_0xa878('0x5f')](_0x25be8f);_0x278ae9[_0xa878('0x60')]();for(var _0x2c1f72=0x0;_0x2c1f72<_0x278ae9['length'];_0x2c1f72++){if(_0x3f4cc9!=''){_0x3f4cc9+='&';}_0x3f4cc9+=_0x278ae9[_0x2c1f72]+'='+encodeURIComponent(_0x25be8f[_0x278ae9[_0x2c1f72]]);_0xf351ad+=_0x25be8f[_0x278ae9[_0x2c1f72]];}_0xf351ad+=_0x14ced8[_0xa878('0x5c')];_0xf351ad=_0x64aff4[_0xa878('0x61')]('md5')[_0xa878('0x28')](_0xf351ad)[_0xa878('0x62')]('hex');if(_0x3f4cc9!==''){_0x3f4cc9+='&';}_0x3f4cc9+=_0xa878('0x63')+_0xf351ad;var _0x219285={'method':_0xa878('0x36'),'uri':_0x14ced8[_0xa878('0x54')]+_0xa878('0x64')+_0x3f4cc9,'json':!![]};return rp(_0x219285)[_0xa878('0x17')](function(_0x3fa68f){var _0x424bd5=Object[_0xa878('0x5f')](_0x3fa68f);if(_0x3fa68f[_0x424bd5[0x0]][_0xa878('0x19')]&&parseInt(_0x3fa68f[_0x424bd5[0x0]][_0xa878('0x19')])===0x0){var _0x3b34fe={'messageId':_0x3fa68f[_0x424bd5[0x0]][_0xa878('0x65')]};if(!_0x14ced8[_0xa878('0x3d')]){_0x3b34fe['read']=!![];}return _0x1b9cfb[_0xa878('0x28')](_0x3b34fe);}else{return logger['error'](_0xa878('0x2a'),_0xa878('0x2b'),_0xa878('0x5a'),util[_0xa878('0x2c')](_0x3fa68f['error'],{'showHidden':![],'depth':null}));}})[_0xa878('0x29')](function(_0x55475f){return logger[_0xa878('0x19')](_0xa878('0x2a'),_0xa878('0x2b'),_0xa878('0x5a'),util[_0xa878('0x2c')](_0x55475f,{'showHidden':![],'depth':null}));});}else{logger[_0xa878('0x19')](_0xa878('0x2a'),_0xa878('0x2b'),_0xa878('0x5a'),'Missing\x20parameters:\x20apiKey');}break;case _0xa878('0x66'):if(_0x14ced8[_0xa878('0x5c')]){var _0x4fbd7f={'method':_0xa878('0x39'),'uri':_0xa878('0x67'),'headers':{'Authorization':_0x14ced8['apiKey']},'body':{'content':_0x5a6745[_0xa878('0x31')],'to':[_0x5a6745['phone']],'from':_0x14ced8[_0xa878('0x20')],'binary':![],'clientMessageId':'uuid','charset':_0xa878('0x68')},'json':!![]};rp(_0x4fbd7f)[_0xa878('0x17')](function(_0x5aef57){if(!_0x5aef57[_0xa878('0x19')]){var _0x10e86b={'messageId':_0x5aef57[_0xa878('0x21')][0x0][_0xa878('0x69')]};if(!_0x14ced8[_0xa878('0x3d')]){_0x10e86b['read']=!![];}return _0x1b9cfb['update'](_0x10e86b);}else{return logger[_0xa878('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa878('0x2b'),_0xa878('0x66'),util[_0xa878('0x2c')](_0x5aef57[_0xa878('0x19')],{'showHidden':![],'depth':null}));}})[_0xa878('0x29')](function(_0x137721){return logger[_0xa878('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa878('0x2b'),'clickatell',util[_0xa878('0x2c')](_0x137721,{'showHidden':![],'depth':null}));});}else{logger[_0xa878('0x19')](_0xa878('0x2a'),_0xa878('0x2b'),_0xa878('0x66'),_0xa878('0x6a'));}break;case _0xa878('0x6b'):if(_0x14ced8[_0xa878('0x5c')]){var _0xf23f6={};var _0x219285={'method':'POST','uri':_0xa878('0x6c'),'headers':{'Authorization':_0xa878('0x6d')+_0x14ced8[_0xa878('0x5c')],'Content-Type':_0xa878('0x56')},'body':{'from':_0x14ced8[_0xa878('0x20')],'to':_0x5a6745[_0xa878('0x20')],'text':_0x5a6745['body']},'json':!![]};return rp(_0x219285)[_0xa878('0x17')](function(_0x5d0285){if(_0x5d0285[_0xa878('0x6e')]==0xca){_0xf23f6['message']=_0x5d0285;var _0x192f2b={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xa878('0x6d')+_0x14ced8[_0xa878('0x5c')],'Content-Type':_0xa878('0x56')},'body':{'refid':_0xf23f6[_0xa878('0x6f')][_0xa878('0x70')]},'json':!![]};return rp(_0x192f2b)[_0xa878('0x17')](function(_0x503a99){_0xf23f6[_0xa878('0x71')]=_0x503a99;var _0x301b87={'messageId':_0xf23f6['message'][_0xa878('0x70')],'read':!![]};return _0x1b9cfb[_0xa878('0x28')](_0x301b87);});}else{return logger[_0xa878('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa878('0x2b'),_0xa878('0x6b'),util[_0xa878('0x2c')](_0x5d0285,{'showHidden':![],'depth':null}));}})[_0xa878('0x29')](function(_0xa3f517){return logger[_0xa878('0x19')](_0xa878('0x2a'),'afterCreate',_0xa878('0x6b'),util[_0xa878('0x2c')](_0xa3f517,{'showHidden':![],'depth':null}));});}else{return logger[_0xa878('0x19')](_0xa878('0x2a'),_0xa878('0x2b'),_0xa878('0x6b'),'Token\x20not\x20received');}break;}}})[_0xa878('0x72')](function(){_0x29796c();});}else{_0x29796c();}}},'charset':'utf8mb4','collate':_0xa878('0x73')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 70342f9..4669e3f 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 _0x53fb=['rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','then','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4fa622,_0x4e2fe9){var _0xc754da=function(_0x117cd7){while(--_0x117cd7){_0x4fa622['push'](_0x4fa622['shift']());}};_0xc754da(++_0x4e2fe9);}(_0x53fb,0x1b3));var _0xb53f=function(_0x480a67,_0x4e7bde){_0x480a67=_0x480a67-0x0;var _0xa19779=_0x53fb[_0x480a67];return _0xa19779;};'use strict';var _=require(_0xb53f('0x0'));var util=require(_0xb53f('0x1'));var moment=require('moment');var BPromise=require(_0xb53f('0x2'));var rs=require(_0xb53f('0x3'));var fs=require('fs');var Redis=require(_0xb53f('0x4'));var db=require(_0xb53f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb53f('0x6'))(_0xb53f('0x7'));var config=require(_0xb53f('0x8'));var jayson=require(_0xb53f('0x9'));var client=jayson['client'][_0xb53f('0xa')]({'port':0x232a});config['redis']=_[_0xb53f('0xb')](config[_0xb53f('0xc')],{'host':_0xb53f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb53f('0xc')]));require(_0xb53f('0xe'))[_0xb53f('0xf')](socket);function respondWithRpcPromise(_0x385339,_0x71aabf,_0x2d7540){return new BPromise(function(_0x32affc,_0x1e1732){return client[_0xb53f('0x10')](_0x385339,_0x2d7540)['then'](function(_0x326671){logger[_0xb53f('0x11')](_0xb53f('0x12'),_0x71aabf,_0xb53f('0x13'));logger['debug'](_0xb53f('0x14'),_0x71aabf,_0xb53f('0x13'),JSON['stringify'](_0x326671));if(_0x326671[_0xb53f('0x15')]){if(_0x326671[_0xb53f('0x15')]['code']===0x1f4){logger[_0xb53f('0x15')](_0xb53f('0x12'),_0x71aabf,_0x326671['error'][_0xb53f('0x16')]);return _0x1e1732(_0x326671[_0xb53f('0x15')]['message']);}logger[_0xb53f('0x15')](_0xb53f('0x12'),_0x71aabf,_0x326671[_0xb53f('0x15')][_0xb53f('0x16')]);return _0x32affc(_0x326671[_0xb53f('0x15')][_0xb53f('0x16')]);}else{logger[_0xb53f('0x11')]('SmsMessage,\x20%s,\x20%s',_0x71aabf,_0xb53f('0x13'));_0x32affc(_0x326671[_0xb53f('0x17')][_0xb53f('0x16')]);}})[_0xb53f('0x18')](function(_0xf1608f){logger['error'](_0xb53f('0x12'),_0x71aabf,_0xf1608f);_0x1e1732(_0xf1608f);});});}exports[_0xb53f('0x19')]=function(_0x190d96){var _0x2138d0=this;return new Promise(function(_0xf84774,_0x3a8555){return db[_0xb53f('0x1a')][_0xb53f('0x1b')](_0x190d96[_0xb53f('0x1c')],{'raw':_0x190d96[_0xb53f('0x1d')]?_0x190d96[_0xb53f('0x1d')][_0xb53f('0x1e')]===undefined?!![]:![]:!![]})[_0xb53f('0x1f')](function(_0x3c8d8b){logger[_0xb53f('0x11')](_0xb53f('0x19'),_0x190d96);logger[_0xb53f('0x20')]('CreateSmsMessage',_0x190d96,JSON[_0xb53f('0x21')](_0x3c8d8b));_0xf84774(_0x3c8d8b);})[_0xb53f('0x18')](function(_0x46d9b2){logger['error'](_0xb53f('0x19'),_0x46d9b2['message'],_0x190d96);_0x3a8555(_0x2138d0['error'](0x1f4,_0x46d9b2[_0xb53f('0x16')]));});});}; \ No newline at end of file +var _0xc7bf=['redis','defaults','localhost','socket.io-emitter','register','request','then','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','options','info','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5337fa,_0x435f92){var _0x43e388=function(_0x3e26e3){while(--_0x3e26e3){_0x5337fa['push'](_0x5337fa['shift']());}};_0x43e388(++_0x435f92);}(_0xc7bf,0x8c));var _0xfc7b=function(_0x1e5fbd,_0x2e3998){_0x1e5fbd=_0x1e5fbd-0x0;var _0x153ca4=_0xc7bf[_0x1e5fbd];return _0x153ca4;};'use strict';var _=require('lodash');var util=require(_0xfc7b('0x0'));var moment=require(_0xfc7b('0x1'));var BPromise=require(_0xfc7b('0x2'));var rs=require(_0xfc7b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc7b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfc7b('0x5'));var config=require(_0xfc7b('0x6'));var jayson=require(_0xfc7b('0x7'));var client=jayson[_0xfc7b('0x8')][_0xfc7b('0x9')]({'port':0x232a});config[_0xfc7b('0xa')]=_[_0xfc7b('0xb')](config[_0xfc7b('0xa')],{'host':_0xfc7b('0xc'),'port':0x18eb});var socket=require(_0xfc7b('0xd'))(new Redis(config[_0xfc7b('0xa')]));require('./smsMessage.socket')[_0xfc7b('0xe')](socket);function respondWithRpcPromise(_0x353e2c,_0x54e3cd,_0x346b9f){return new BPromise(function(_0x5a5efc,_0x288f71){return client[_0xfc7b('0xf')](_0x353e2c,_0x346b9f)[_0xfc7b('0x10')](function(_0x14d2a1){logger['info']('SmsMessage,\x20%s,\x20%s',_0x54e3cd,'request\x20sent');logger[_0xfc7b('0x11')](_0xfc7b('0x12'),_0x54e3cd,_0xfc7b('0x13'),JSON[_0xfc7b('0x14')](_0x14d2a1));if(_0x14d2a1[_0xfc7b('0x15')]){if(_0x14d2a1[_0xfc7b('0x15')]['code']===0x1f4){logger['error'](_0xfc7b('0x16'),_0x54e3cd,_0x14d2a1[_0xfc7b('0x15')][_0xfc7b('0x17')]);return _0x288f71(_0x14d2a1[_0xfc7b('0x15')]['message']);}logger['error'](_0xfc7b('0x16'),_0x54e3cd,_0x14d2a1[_0xfc7b('0x15')][_0xfc7b('0x17')]);return _0x5a5efc(_0x14d2a1['error'][_0xfc7b('0x17')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x54e3cd,_0xfc7b('0x13'));_0x5a5efc(_0x14d2a1[_0xfc7b('0x18')][_0xfc7b('0x17')]);}})[_0xfc7b('0x19')](function(_0x482a50){logger[_0xfc7b('0x15')]('SmsMessage,\x20%s,\x20%s',_0x54e3cd,_0x482a50);_0x288f71(_0x482a50);});});}exports[_0xfc7b('0x1a')]=function(_0x43a1b6){var _0x5bfa8c=this;return new Promise(function(_0x263426,_0x504212){return db[_0xfc7b('0x1b')]['create'](_0x43a1b6['body'],{'raw':_0x43a1b6[_0xfc7b('0x1c')]?_0x43a1b6[_0xfc7b('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xfc7b('0x10')](function(_0x142238){logger[_0xfc7b('0x1d')](_0xfc7b('0x1a'),_0x43a1b6);logger[_0xfc7b('0x11')](_0xfc7b('0x1a'),_0x43a1b6,JSON[_0xfc7b('0x14')](_0x142238));_0x263426(_0x142238);})[_0xfc7b('0x19')](function(_0x101740){logger[_0xfc7b('0x15')](_0xfc7b('0x1a'),_0x101740[_0xfc7b('0x17')],_0x43a1b6);_0x504212(_0x5bfa8c[_0xfc7b('0x15')](0x1f4,_0x101740[_0xfc7b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 6757aa0..c2698f0 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 _0xe116=['update','removeListener','smsMessage:','./smsMessage.events','save','remove'];(function(_0x5cbe8e,_0x599120){var _0x53921d=function(_0x660f5a){while(--_0x660f5a){_0x5cbe8e['push'](_0x5cbe8e['shift']());}};_0x53921d(++_0x599120);}(_0xe116,0x1b3));var _0x6e11=function(_0x426618,_0x137a7f){_0x426618=_0x426618-0x0;var _0x20f9cd=_0xe116[_0x426618];return _0x20f9cd;};'use strict';var SmsMessageEvents=require(_0x6e11('0x0'));var events=[_0x6e11('0x1'),_0x6e11('0x2'),_0x6e11('0x3')];function createListener(_0x256492,_0x2c3641){return function(_0x1f1bc1){_0x2c3641['emit'](_0x256492,_0x1f1bc1);};}function removeListener(_0x71232e,_0x46774a){return function(){SmsMessageEvents[_0x6e11('0x4')](_0x71232e,_0x46774a);};}exports['register']=function(_0x215cb1){for(var _0x55a421=0x0,_0x4e4859=events['length'];_0x55a421<_0x4e4859;_0x55a421++){var _0xe2344c=events[_0x55a421];var _0x2ea552=createListener(_0x6e11('0x5')+_0xe2344c,_0x215cb1);SmsMessageEvents['on'](_0xe2344c,_0x2ea552);}}; \ No newline at end of file +var _0x9c9a=['save','remove','emit','register','length','smsMessage:'];(function(_0x2a33fd,_0x58cc79){var _0x1d1313=function(_0x19e476){while(--_0x19e476){_0x2a33fd['push'](_0x2a33fd['shift']());}};_0x1d1313(++_0x58cc79);}(_0x9c9a,0xe4));var _0xa9c9=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9c9a[_0x1facfa];return _0x9ec701;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xa9c9('0x0'),_0xa9c9('0x1'),'update'];function createListener(_0x49021e,_0x4762af){return function(_0x3165a9){_0x4762af[_0xa9c9('0x2')](_0x49021e,_0x3165a9);};}function removeListener(_0x4cc87b,_0x4e7031){return function(){SmsMessageEvents['removeListener'](_0x4cc87b,_0x4e7031);};}exports[_0xa9c9('0x3')]=function(_0x3eee64){for(var _0x2b439b=0x0,_0x4d053c=events[_0xa9c9('0x4')];_0x2b439b<_0x4d053c;_0x2b439b++){var _0xca04b1=events[_0x2b439b];var _0x1e9de9=createListener(_0xa9c9('0x5')+_0xca04b1,_0x3eee64);SmsMessageEvents['on'](_0xca04b1,_0x1e9de9);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index bd2b327..0aee19c 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 _0x18af=['get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addAgents','update','delete','destroy','removeTeams','/:id/users','removeAgents','multer','path','express','../../config/environment','./smsQueue.controller'];(function(_0x12dd1e,_0x25dafe){var _0x119c18=function(_0x53219e){while(--_0x53219e){_0x12dd1e['push'](_0x12dd1e['shift']());}};_0x119c18(++_0x25dafe);}(_0x18af,0x8b));var _0xf18a=function(_0x555682,_0x1120e3){_0x555682=_0x555682-0x0;var _0x192fca=_0x18af[_0x555682];return _0x192fca;};'use strict';var multer=require(_0xf18a('0x0'));var util=require('util');var path=require(_0xf18a('0x1'));var timeout=require('connect-timeout');var express=require(_0xf18a('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf18a('0x3'));var controller=require(_0xf18a('0x4'));router[_0xf18a('0x5')]('/',auth[_0xf18a('0x6')](),controller['index']);router[_0xf18a('0x5')](_0xf18a('0x7'),auth[_0xf18a('0x6')](),controller['describe']);router[_0xf18a('0x5')](_0xf18a('0x8'),auth[_0xf18a('0x6')](),controller[_0xf18a('0x9')]);router[_0xf18a('0x5')](_0xf18a('0xa'),auth[_0xf18a('0x6')](),controller[_0xf18a('0xb')]);router[_0xf18a('0x5')](_0xf18a('0xc'),auth[_0xf18a('0x6')](),controller[_0xf18a('0xd')]);router[_0xf18a('0x5')]('/:id/users',auth[_0xf18a('0x6')](),controller[_0xf18a('0xe')]);router[_0xf18a('0xf')]('/',auth[_0xf18a('0x6')](),controller[_0xf18a('0x10')]);router['post'](_0xf18a('0xc'),auth[_0xf18a('0x6')](),controller['addTeams']);router[_0xf18a('0xf')]('/:id/users',auth[_0xf18a('0x6')](),controller[_0xf18a('0x11')]);router['put'](_0xf18a('0x8'),auth['isAuthenticated'](),controller[_0xf18a('0x12')]);router[_0xf18a('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xf18a('0x14')]);router[_0xf18a('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf18a('0x15')]);router[_0xf18a('0x13')](_0xf18a('0x16'),auth['isAuthenticated'](),controller[_0xf18a('0x17')]);module['exports']=router; \ No newline at end of file +var _0xafb9=['../../config/environment','isAuthenticated','get','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','destroy','delete','/:id/teams','removeTeams','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x33ae69,_0x31eece){var _0x2137b0=function(_0xcca992){while(--_0xcca992){_0x33ae69['push'](_0x33ae69['shift']());}};_0x2137b0(++_0x31eece);}(_0xafb9,0x68));var _0x9afb=function(_0x51e3e9,_0x319e1e){_0x51e3e9=_0x51e3e9-0x0;var _0x5bed1b=_0xafb9[_0x51e3e9];return _0x5bed1b;};'use strict';var multer=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var path=require(_0x9afb('0x2'));var timeout=require(_0x9afb('0x3'));var express=require(_0x9afb('0x4'));var router=express[_0x9afb('0x5')]();var auth=require(_0x9afb('0x6'));var interaction=require(_0x9afb('0x7'));var config=require(_0x9afb('0x8'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x9afb('0x9')](),controller['index']);router[_0x9afb('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x9afb('0xb')]);router[_0x9afb('0xa')](_0x9afb('0xc'),auth['isAuthenticated'](),controller[_0x9afb('0xd')]);router[_0x9afb('0xa')](_0x9afb('0xe'),auth[_0x9afb('0x9')](),controller[_0x9afb('0xf')]);router['get']('/:id/teams',auth[_0x9afb('0x9')](),controller[_0x9afb('0x10')]);router[_0x9afb('0xa')](_0x9afb('0x11'),auth[_0x9afb('0x9')](),controller[_0x9afb('0x12')]);router[_0x9afb('0x13')]('/',auth[_0x9afb('0x9')](),controller[_0x9afb('0x14')]);router[_0x9afb('0x13')]('/:id/teams',auth[_0x9afb('0x9')](),controller['addTeams']);router['post'](_0x9afb('0x11'),auth[_0x9afb('0x9')](),controller[_0x9afb('0x15')]);router[_0x9afb('0x16')](_0x9afb('0xc'),auth[_0x9afb('0x9')](),controller[_0x9afb('0x17')]);router['delete'](_0x9afb('0xc'),auth[_0x9afb('0x9')](),controller[_0x9afb('0x18')]);router[_0x9afb('0x19')](_0x9afb('0x1a'),auth['isAuthenticated'](),controller[_0x9afb('0x1b')]);router['delete'](_0x9afb('0x11'),auth[_0x9afb('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 27f16b0..ac31e26 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 _0x1de2=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x23d03a,_0x625eba){var _0x142157=function(_0x2e7033){while(--_0x2e7033){_0x23d03a['push'](_0x23d03a['shift']());}};_0x142157(++_0x625eba);}(_0x1de2,0x18c));var _0x21de=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0x1de2[_0x120123];return _0x3bec4c;};'use strict';var Sequelize=require('sequelize');module[_0x21de('0x0')]={'name':{'type':Sequelize[_0x21de('0x1')],'unique':_0x21de('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x21de('0x1')]},'timeout':{'type':Sequelize[_0x21de('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x21de('0x4')](_0x21de('0x5'),_0x21de('0x6'),_0x21de('0x7'))}}; \ No newline at end of file +var _0xda50=['INTEGER','ENUM','roundrobin','sequelize','exports','STRING'];(function(_0x11f080,_0x417423){var _0x1a53a6=function(_0x3b18c5){while(--_0x3b18c5){_0x11f080['push'](_0x11f080['shift']());}};_0x1a53a6(++_0x417423);}(_0xda50,0x1b3));var _0x0da5=function(_0x1b8e07,_0x5e1067){_0x1b8e07=_0x1b8e07-0x0;var _0x116666=_0xda50[_0x1b8e07];return _0x116666;};'use strict';var Sequelize=require(_0x0da5('0x0'));module[_0x0da5('0x1')]={'name':{'type':Sequelize[_0x0da5('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0da5('0x2')]},'timeout':{'type':Sequelize[_0x0da5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0da5('0x4')]('rrmemory','beepall',_0x0da5('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 9717c6c..20d417f 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 _0x24ca=['path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./smsQueue.socket','register','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','name','send','index','map','SmsQueue','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','Team','pick','getTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','zip-dir','request-promise','moment','bluebird','util'];(function(_0x41bd01,_0x59569e){var _0x36cc76=function(_0x1f3ca8){while(--_0x1f3ca8){_0x41bd01['push'](_0x41bd01['shift']());}};_0x36cc76(++_0x59569e);}(_0x24ca,0x8c));var _0xa24c=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x24ca[_0x2d7f0e];return _0x110b07;};'use strict';var pdf=require(_0xa24c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require(_0xa24c('0x4'));var Mustache=require('mustache');var util=require(_0xa24c('0x5'));var path=require(_0xa24c('0x6'));var sox=require(_0xa24c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa24c('0x8'));var crypto=require(_0xa24c('0x9'));var jsforce=require(_0xa24c('0xa'));var deskjs=require(_0xa24c('0xb'));var toCsv=require(_0xa24c('0xc'));var querystring=require(_0xa24c('0xd'));var Papa=require('papaparse');var Redis=require(_0xa24c('0xe'));var authService=require(_0xa24c('0xf'));var qs=require(_0xa24c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa24c('0x11'))(_0xa24c('0x12'));var utils=require(_0xa24c('0x13'));var config=require(_0xa24c('0x14'));var licenseUtil=require(_0xa24c('0x15'));var db=require(_0xa24c('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xa24c('0x17'),'port':0x18eb});var socket=require(_0xa24c('0x18'))(new Redis(config[_0xa24c('0x19')]));require(_0xa24c('0x1a'))[_0xa24c('0x1b')](socket);function respondWithStatusCode(_0x4971af,_0x13076d){_0x13076d=_0x13076d||0xcc;return function(_0x488a78){if(_0x488a78){return _0x4971af['sendStatus'](_0x13076d);}return _0x4971af['status'](_0x13076d)[_0xa24c('0x1c')]();};}function respondWithResult(_0x2a4270,_0x3f762e){_0x3f762e=_0x3f762e||0xc8;return function(_0x267762){if(_0x267762){return _0x2a4270[_0xa24c('0x1d')](_0x3f762e)[_0xa24c('0x1e')](_0x267762);}};}function respondWithFilteredResult(_0x2197da,_0x32a226){return function(_0x14f0aa){if(_0x14f0aa){var _0x117177=_0x14f0aa[_0xa24c('0x1f')],_0x1970fc=_0x32a226['offset'],_0x1a667b=_0x32a226[_0xa24c('0x20')]+_0x32a226['limit'],_0x278cce;if(_0x1a667b>=_0x117177){_0x1a667b=_0x117177;_0x278cce=0xc8;}else{_0x278cce=0xce;}_0x2197da[_0xa24c('0x1d')](_0x278cce);return _0x2197da[_0xa24c('0x21')](_0xa24c('0x22'),_0x1970fc+'-'+_0x1a667b+'/'+_0x117177)[_0xa24c('0x1e')](_0x14f0aa);}return null;};}function patchUpdates(_0x240f6c){return function(_0x416dea){try{jsonpatch[_0xa24c('0x23')](_0x416dea,_0x240f6c,!![]);}catch(_0x432c15){return BPromise[_0xa24c('0x24')](_0x432c15);}return _0x416dea[_0xa24c('0x25')]();};}function saveUpdates(_0x2b471a,_0x53e729){return function(_0x4eadb2){if(_0x4eadb2){return _0x4eadb2[_0xa24c('0x26')](_0x2b471a)[_0xa24c('0x27')](function(_0x316a68){return _0x316a68;});}return null;};}function removeEntity(_0x1a04ff,_0x375c83){return function(_0xfb13c0){if(_0xfb13c0){return _0xfb13c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x304d6c=_0xfb13c0['get']({'plain':!![]});var _0x2290e1='SmsQueues';return db[_0xa24c('0x29')][_0xa24c('0x28')]({'where':{'type':_0x2290e1,'resourceId':_0x304d6c['id']}})[_0xa24c('0x27')](function(){return _0xfb13c0;});})[_0xa24c('0x27')](function(){_0x1a04ff['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c86c6,_0x4e5d2c){return function(_0x23fb79){if(!_0x23fb79){_0x4c86c6[_0xa24c('0x2a')](0x194);}return _0x23fb79;};}function handleError(_0xab6197,_0x1cdee4){_0x1cdee4=_0x1cdee4||0x1f4;return function(_0x37cbd3){logger['error'](_0x37cbd3['stack']);if(_0x37cbd3[_0xa24c('0x2b')]){delete _0x37cbd3[_0xa24c('0x2b')];}_0xab6197[_0xa24c('0x1d')](_0x1cdee4)[_0xa24c('0x2c')](_0x37cbd3);};}exports[_0xa24c('0x2d')]=function(_0x3f7102,_0xc0db8f){var _0x1e30a9={},_0x29f539={},_0x17a001={'count':0x0,'rows':[]};var _0x59526b=_[_0xa24c('0x2e')](db[_0xa24c('0x2f')]['rawAttributes'],function(_0x3c9649){return{'name':_0x3c9649[_0xa24c('0x30')],'type':_0x3c9649[_0xa24c('0x31')][_0xa24c('0x32')]};});_0x29f539[_0xa24c('0x33')]=_[_0xa24c('0x2e')](_0x59526b,_0xa24c('0x2b'));_0x29f539[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x3f7102[_0xa24c('0x34')]);_0x29f539['filters']=_['intersection'](_0x29f539['model'],_0x29f539[_0xa24c('0x34')]);_0x1e30a9['attributes']=_[_0xa24c('0x36')](_0x29f539[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x3f7102['query'][_0xa24c('0x37')]));_0x1e30a9[_0xa24c('0x38')]=_0x1e30a9[_0xa24c('0x38')]['length']?_0x1e30a9[_0xa24c('0x38')]:_0x29f539[_0xa24c('0x33')];if(!_0x3f7102['query'][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x1e30a9[_0xa24c('0x3b')]=qs['limit'](_0x3f7102[_0xa24c('0x34')][_0xa24c('0x3b')]);_0x1e30a9[_0xa24c('0x20')]=qs[_0xa24c('0x20')](_0x3f7102[_0xa24c('0x34')]['offset']);}_0x1e30a9[_0xa24c('0x3c')]=qs[_0xa24c('0x3d')](_0x3f7102['query'][_0xa24c('0x3d')]);_0x1e30a9[_0xa24c('0x3e')]=qs[_0xa24c('0x3f')](_['pick'](_0x3f7102['query'],_0x29f539[_0xa24c('0x3f')]),_0x59526b);if(_0x3f7102[_0xa24c('0x34')][_0xa24c('0x40')]){_0x1e30a9[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x1e30a9[_0xa24c('0x3e')],{'$or':_['map'](_0x59526b,function(_0x46c0bf){if(_0x46c0bf[_0xa24c('0x31')]!==_0xa24c('0x42')){var _0x137a1d={};_0x137a1d[_0x46c0bf['name']]={'$like':'%'+_0x3f7102[_0xa24c('0x34')][_0xa24c('0x40')]+'%'};return _0x137a1d;}})});}_0x1e30a9=_[_0xa24c('0x41')]({},_0x1e30a9,_0x3f7102[_0xa24c('0x43')]);var _0x103b50={'where':_0x1e30a9[_0xa24c('0x3e')]};return db[_0xa24c('0x2f')]['count'](_0x103b50)['then'](function(_0x22c57e){_0x17a001['count']=_0x22c57e;if(_0x3f7102[_0xa24c('0x34')]['includeAll']){_0x1e30a9[_0xa24c('0x44')]=[{'all':!![]}];}return db[_0xa24c('0x2f')][_0xa24c('0x45')](_0x1e30a9);})[_0xa24c('0x27')](function(_0x21328f){_0x17a001[_0xa24c('0x46')]=_0x21328f;return _0x17a001;})[_0xa24c('0x27')](respondWithFilteredResult(_0xc0db8f,_0x1e30a9))[_0xa24c('0x47')](handleError(_0xc0db8f,null));};exports[_0xa24c('0x48')]=function(_0x38791c,_0x45dd80){var _0x1f87b7={'raw':!![],'where':{'id':_0x38791c[_0xa24c('0x49')]['id']}},_0x2e2f06={};_0x2e2f06[_0xa24c('0x33')]=_[_0xa24c('0x35')](db['SmsQueue'][_0xa24c('0x4a')]);_0x2e2f06[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x38791c['query']);_0x2e2f06[_0xa24c('0x3f')]=_[_0xa24c('0x36')](_0x2e2f06[_0xa24c('0x33')],_0x2e2f06[_0xa24c('0x34')]);_0x1f87b7['attributes']=_[_0xa24c('0x36')](_0x2e2f06[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x38791c[_0xa24c('0x34')][_0xa24c('0x37')]));_0x1f87b7[_0xa24c('0x38')]=_0x1f87b7[_0xa24c('0x38')][_0xa24c('0x4b')]?_0x1f87b7[_0xa24c('0x38')]:_0x2e2f06[_0xa24c('0x33')];if(_0x38791c[_0xa24c('0x34')][_0xa24c('0x4c')]){_0x1f87b7[_0xa24c('0x44')]=[{'all':!![]}];}_0x1f87b7=_['merge']({},_0x1f87b7,_0x38791c[_0xa24c('0x43')]);return db['SmsQueue'][_0xa24c('0x4d')](_0x1f87b7)[_0xa24c('0x27')](handleEntityNotFound(_0x45dd80,null))[_0xa24c('0x27')](respondWithResult(_0x45dd80,null))[_0xa24c('0x47')](handleError(_0x45dd80,null));};exports[_0xa24c('0x4e')]=function(_0x42d84b,_0x338877){return db[_0xa24c('0x2f')][_0xa24c('0x4e')](_0x42d84b[_0xa24c('0x4f')],{})[_0xa24c('0x27')](function(_0x390688){var _0x14c813=_0x42d84b['user'][_0xa24c('0x50')]({'plain':!![]});if(!_0x14c813)throw new Error(_0xa24c('0x51'));if(_0x14c813[_0xa24c('0x52')]===_0xa24c('0x53')){var _0x4b6cc0=_0x390688[_0xa24c('0x50')]({'plain':!![]});var _0xd09fd4=_0xa24c('0x54');return db['UserProfileSection']['find']({'where':{'name':_0xd09fd4,'userProfileId':_0x14c813[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x4992ee){if(_0x4992ee&&_0x4992ee[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x29')]['create']({'name':_0x4b6cc0[_0xa24c('0x2b')],'resourceId':_0x4b6cc0['id'],'type':_0x4992ee['name'],'sectionId':_0x4992ee['id']},{})['then'](function(){return _0x390688;});}else{return _0x390688;}})[_0xa24c('0x47')](function(_0x58f0e8){logger[_0xa24c('0x57')](_0xa24c('0x58'),_0x58f0e8);throw _0x58f0e8;});}return _0x390688;})['then'](respondWithResult(_0x338877,0xc9))[_0xa24c('0x47')](handleError(_0x338877,null));};exports[_0xa24c('0x26')]=function(_0x37379d,_0x2fe35e){if(_0x37379d['body']['id']){delete _0x37379d[_0xa24c('0x4f')]['id'];}return db['SmsQueue'][_0xa24c('0x4d')]({'where':{'id':_0x37379d[_0xa24c('0x49')]['id']}})['then'](handleEntityNotFound(_0x2fe35e,null))['then'](saveUpdates(_0x37379d[_0xa24c('0x4f')],null))[_0xa24c('0x27')](respondWithResult(_0x2fe35e,null))[_0xa24c('0x47')](handleError(_0x2fe35e,null));};exports[_0xa24c('0x28')]=function(_0x3aa9d7,_0x5f2564){return db[_0xa24c('0x2f')]['find']({'where':{'id':_0x3aa9d7[_0xa24c('0x49')]['id']}})['then'](handleEntityNotFound(_0x5f2564,null))['then'](removeEntity(_0x5f2564,null))['catch'](handleError(_0x5f2564,null));};exports[_0xa24c('0x59')]=function(_0x5c4834,_0x5d8086){return db[_0xa24c('0x2f')]['describe']()[_0xa24c('0x27')](respondWithResult(_0x5d8086,null))[_0xa24c('0x47')](handleError(_0x5d8086,null));};exports[_0xa24c('0x5a')]=function(_0x14c819,_0x33c5f7,_0x29c643){var _0x45d2fd={'raw':!![],'where':{}},_0x366505={},_0x47a366;return db['SmsQueue'][_0xa24c('0x5b')]({'where':{'id':_0x14c819[_0xa24c('0x49')]['id']}})['then'](handleEntityNotFound(_0x33c5f7,null))[_0xa24c('0x27')](function(_0x17d92d){if(_0x17d92d){_0x47a366=_0x17d92d['get']({'plain':!![]});_0x366505[_0xa24c('0x33')]=_[_0xa24c('0x35')](db[_0xa24c('0x5c')]['rawAttributes']);_0x366505[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x14c819['query']);_0x366505[_0xa24c('0x3f')]=_['intersection'](_0x366505[_0xa24c('0x33')],_0x366505[_0xa24c('0x34')]);_0x45d2fd[_0xa24c('0x38')]=_[_0xa24c('0x36')](_0x366505[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x14c819[_0xa24c('0x34')][_0xa24c('0x37')]));_0x45d2fd[_0xa24c('0x38')]=_0x45d2fd[_0xa24c('0x38')][_0xa24c('0x4b')]?_0x45d2fd[_0xa24c('0x38')]:_0x366505[_0xa24c('0x33')];if(!_0x14c819[_0xa24c('0x34')][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x45d2fd[_0xa24c('0x3b')]=qs[_0xa24c('0x3b')](_0x14c819['query'][_0xa24c('0x3b')]);_0x45d2fd['offset']=qs[_0xa24c('0x20')](_0x14c819[_0xa24c('0x34')][_0xa24c('0x20')]);}_0x45d2fd[_0xa24c('0x3c')]=qs['sort'](_0x14c819['query'][_0xa24c('0x3d')]);_0x45d2fd[_0xa24c('0x3e')]=qs[_0xa24c('0x3f')](_['pick'](_0x14c819[_0xa24c('0x34')],_0x366505[_0xa24c('0x3f')]));_0x45d2fd[_0xa24c('0x3e')][_0xa24c('0x5d')]=_0x17d92d['id'];if(_0x14c819[_0xa24c('0x34')][_0xa24c('0x40')]){_0x45d2fd[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x45d2fd[_0xa24c('0x3e')],{'$or':_[_0xa24c('0x2e')](_0x45d2fd[_0xa24c('0x38')],function(_0x19c87a){var _0x3b68d7={};_0x3b68d7[_0x19c87a]={'$like':'%'+_0x14c819[_0xa24c('0x34')][_0xa24c('0x40')]+'%'};return _0x3b68d7;})});}_0x45d2fd=_[_0xa24c('0x41')]({},_0x45d2fd,_0x14c819[_0xa24c('0x43')]);return db[_0xa24c('0x5c')][_0xa24c('0x45')](_0x45d2fd);}})[_0xa24c('0x27')](function(_0x333cb7){if(_0x333cb7){return db[_0xa24c('0x5e')][_0xa24c('0x5f')]({'where':{'id':_[_0xa24c('0x2e')](_0x333cb7,_0xa24c('0x60')),'role':_0xa24c('0x61')},'attributes':['id',_0xa24c('0x2b'),_0xa24c('0x62'),_0xa24c('0x63'),_0xa24c('0x64')]});}})['then'](function(_0x37f25d){if(_0x37f25d){return{'count':_0x37f25d['count'],'rows':_[_0xa24c('0x2e')](_0x37f25d[_0xa24c('0x46')],function(_0x19a6f3){return{'membername':_0x19a6f3[_0xa24c('0x2b')],'UserId':_0x19a6f3['id'],'queue_name':_0x47a366['name'],'SmsQueueId':_0x47a366['id'],'interface':util[_0xa24c('0x65')](_0xa24c('0x66'),_0xa24c('0x67'),_0x19a6f3['name']),'penalty':0x0,'paused':_0x19a6f3[_0xa24c('0x62')],'createdAt':_0x19a6f3['createdAt'],'updatedAt':_0x19a6f3[_0xa24c('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa24c('0x27')](respondWithFilteredResult(_0x33c5f7,_0x45d2fd))[_0xa24c('0x47')](handleError(_0x33c5f7,null));};exports['getTeams']=function(_0x2d1f56,_0x846186,_0x5ae89a){var _0x35fae7={};var _0x36e108={};var _0x316e26;var _0x2a189a;return db[_0xa24c('0x2f')][_0xa24c('0x5b')]({'where':{'id':_0x2d1f56[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x846186,null))[_0xa24c('0x27')](function(_0x327360){if(_0x327360){_0x316e26=_0x327360;_0x36e108[_0xa24c('0x33')]=_[_0xa24c('0x35')](db[_0xa24c('0x68')][_0xa24c('0x4a')]);_0x36e108[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x2d1f56['query']);_0x36e108[_0xa24c('0x3f')]=_[_0xa24c('0x36')](_0x36e108[_0xa24c('0x33')],_0x36e108[_0xa24c('0x34')]);_0x35fae7[_0xa24c('0x38')]=_['intersection'](_0x36e108['model'],qs[_0xa24c('0x37')](_0x2d1f56[_0xa24c('0x34')][_0xa24c('0x37')]));_0x35fae7[_0xa24c('0x38')]=_0x35fae7[_0xa24c('0x38')]['length']?_0x35fae7[_0xa24c('0x38')]:_0x36e108[_0xa24c('0x33')];_0x35fae7[_0xa24c('0x3c')]=qs['sort'](_0x2d1f56[_0xa24c('0x34')]['sort']);_0x35fae7['where']=qs['filters'](_[_0xa24c('0x69')](_0x2d1f56[_0xa24c('0x34')],_0x36e108[_0xa24c('0x3f')]));if(_0x2d1f56[_0xa24c('0x34')]['filter']){_0x35fae7[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x35fae7[_0xa24c('0x3e')],{'$or':_[_0xa24c('0x2e')](_0x35fae7[_0xa24c('0x38')],function(_0x4baa40){var _0x35f8e5={};_0x35f8e5[_0x4baa40]={'$like':'%'+_0x2d1f56[_0xa24c('0x34')]['filter']+'%'};return _0x35f8e5;})});}_0x35fae7=_['merge']({},_0x35fae7,_0x2d1f56[_0xa24c('0x43')]);return _0x316e26[_0xa24c('0x6a')](_0x35fae7);}})[_0xa24c('0x27')](function(_0x3479a9){if(_0x3479a9){_0x2a189a=_0x3479a9[_0xa24c('0x4b')];if(!_0x2d1f56[_0xa24c('0x34')][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x35fae7['limit']=qs['limit'](_0x2d1f56[_0xa24c('0x34')][_0xa24c('0x3b')]);_0x35fae7[_0xa24c('0x20')]=qs[_0xa24c('0x20')](_0x2d1f56[_0xa24c('0x34')]['offset']);}return _0x316e26[_0xa24c('0x6a')](_0x35fae7);}})['then'](function(_0x47f744){if(_0x47f744){return _0x47f744?{'count':_0x2a189a,'rows':_0x47f744}:null;}})[_0xa24c('0x27')](respondWithResult(_0x846186,null))[_0xa24c('0x47')](handleError(_0x846186,null));};exports['addTeams']=function(_0x32b835,_0x2915f1,_0x283f63){var _0x4c7ca1=_0x32b835[_0xa24c('0x4f')]['ids'];return db[_0xa24c('0x68')][_0xa24c('0x45')]({'where':{'id':_0x4c7ca1},'attributes':['id'],'include':[{'model':db[_0xa24c('0x5e')],'as':_0xa24c('0x6b'),'attributes':['id',_0xa24c('0x2b'),_0xa24c('0x6c'),_0xa24c('0x6d'),_0xa24c('0x6e')],'raw':!![]}]})[_0xa24c('0x27')](function(_0x286b89){if(_0x286b89){var _0x475526=_[_0xa24c('0x6f')](_0x286b89,function(_0xd11c2a){var _0x569475=_0xd11c2a['get']({'plain':!![]});return _0x569475[_0xa24c('0x6b')];});return db[_0xa24c('0x2f')][_0xa24c('0x4d')]({'where':{'id':_0x32b835[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](function(_0x4b4f88){return db[_0xa24c('0x70')][_0xa24c('0x71')](function(_0x409f10){return _0x4b4f88[_0xa24c('0x72')](_0x4c7ca1,{'transaction':_0x409f10})[_0xa24c('0x27')](function(){return BPromise['each'](_0x475526,function(_0x1927c2){return db[_0xa24c('0x5c')][_0xa24c('0x73')]({'where':{'UserId':_0x1927c2['id'],'SmsQueueId':_0x32b835[_0xa24c('0x49')]['id']},'transaction':_0x409f10});});})[_0xa24c('0x27')](function(){_0x475526[_0xa24c('0x74')](function(_0x4bec32){socket[_0xa24c('0x75')](_0xa24c('0x76'),{'UserId':_0x4bec32['id'],'SmsQueueId':_0x4b4f88['id']});});});});});}})[_0xa24c('0x27')](respondWithStatusCode(_0x2915f1,null))['catch'](handleError(_0x2915f1,null));};exports[_0xa24c('0x77')]=function(_0x48edc9,_0x2c52fc,_0x43150f){return db[_0xa24c('0x68')]['findAll']({'where':{'id':_0x48edc9[_0xa24c('0x34')][_0xa24c('0x78')]},'attributes':['id'],'include':[{'model':db[_0xa24c('0x5e')],'as':_0xa24c('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xa24c('0x27')](handleEntityNotFound(_0x2c52fc,null))[_0xa24c('0x27')](function(_0x3c364d){var _0x2813cc=_[_0xa24c('0x2e')](_0x3c364d,'id');var _0x230bba=[];var _0x2e95cb=[];var _0x2f89cc=squel['select']();_0x2f89cc[_0xa24c('0x79')](_0xa24c('0x7a'))[_0xa24c('0x7b')](_0xa24c('0x7c'),'tq')[_0xa24c('0x7d')]('user_has_teams','ut',_0xa24c('0x7e'))['where'](_0xa24c('0x7f'),_0x48edc9[_0xa24c('0x49')]['id']);for(var _0x3d5949=0x0;_0x3d5949<_0x3c364d['length'];_0x3d5949+=0x1){let _0x1eb531=_0x3c364d[_0x3d5949];for(var _0x4f033b=0x0;_0x4f033b<_0x1eb531[_0xa24c('0x6b')][_0xa24c('0x4b')];_0x4f033b+=0x1){let _0x1e469d=_0x1eb531['Agents'][_0x4f033b];var _0x31b6f9=_0x2f89cc[_0xa24c('0x80')]();_0x31b6f9['where'](_0xa24c('0x81'),_0x1e469d['id']);_0x2e95cb[_0xa24c('0x82')](db[_0xa24c('0x70')][_0xa24c('0x34')](_0x31b6f9[_0xa24c('0x83')](),{'type':db[_0xa24c('0x70')][_0xa24c('0x84')][_0xa24c('0x85')]})[_0xa24c('0x27')](function(_0x2f3c06){if(_0x2f3c06[_0xa24c('0x4b')]===0x1){return _0x1e469d['id'];}else{var _0x2cffcd=_['every'](_[_0xa24c('0x2e')](_0x2f3c06,_0xa24c('0x86')),function(_0x2d3953){return _['includes'](_0x2813cc,_0x2d3953);});if(_0x2cffcd){return _0x1e469d['id'];}}}));}}return BPromise[_0xa24c('0x87')](_0x2e95cb)[_0xa24c('0x27')](function(_0xcbebc5){_0x230bba=_(_0x230bba)['union'](_0xcbebc5)[_0xa24c('0x88')]()[_0xa24c('0x89')]();return db[_0xa24c('0x2f')][_0xa24c('0x4d')]({'where':{'id':_0x48edc9[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](function(_0x5a1c2e){return db[_0xa24c('0x70')][_0xa24c('0x71')](function(_0xb4b74e){return _0x5a1c2e[_0xa24c('0x77')](_0x48edc9[_0xa24c('0x34')]['ids'],{'transaction':_0xb4b74e})[_0xa24c('0x27')](function(){if(!_[_0xa24c('0x8a')](_0x230bba)){return _0x5a1c2e[_0xa24c('0x8b')](_0x230bba,{'transaction':_0xb4b74e});}})[_0xa24c('0x27')](function(){_0x230bba[_0xa24c('0x74')](function(_0x494225){socket['emit'](_0xa24c('0x8c'),{'UserId':_0x494225,'SmsQueueId':_0x5a1c2e['id']});});});});});});})[_0xa24c('0x27')](respondWithStatusCode(_0x2c52fc,null))['catch'](handleError(_0x2c52fc,null));};exports[_0xa24c('0x8d')]=function(_0x25725d,_0x19a9d8,_0x39bfc5){return db['SmsQueue'][_0xa24c('0x4d')]({'where':{'id':_0x25725d[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x19a9d8,null))[_0xa24c('0x27')](function(_0x4a5fcd){if(_0x4a5fcd){return _0x4a5fcd['addAgents'](_0x25725d[_0xa24c('0x4f')][_0xa24c('0x78')],_[_0xa24c('0x8e')](_0x25725d[_0xa24c('0x4f')],['ids','id'])||{})[_0xa24c('0x8f')](function(_0x16f089){for(var _0x3b6a05=0x0;_0x3b6a05<_0x25725d[_0xa24c('0x4f')][_0xa24c('0x78')][_0xa24c('0x4b')];_0x3b6a05+=0x1){socket[_0xa24c('0x75')](_0xa24c('0x76'),{'UserId':_0x25725d[_0xa24c('0x4f')][_0xa24c('0x78')][_0x3b6a05],'SmsQueueId':_0x25725d[_0xa24c('0x49')]['id']});}return _0x16f089;});}})[_0xa24c('0x27')](respondWithResult(_0x19a9d8,null))[_0xa24c('0x47')](handleError(_0x19a9d8,null));};exports['removeAgents']=function(_0x4538e6,_0x3bf62c,_0x2a3d0b){return db[_0xa24c('0x2f')][_0xa24c('0x4d')]({'where':{'id':_0x4538e6['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x3bf62c,null))[_0xa24c('0x27')](function(_0x598d8e){if(_0x598d8e){return _0x598d8e['removeAgents'](_0x4538e6['query'][_0xa24c('0x78')])['then'](function(){if(_[_0xa24c('0x90')](_0x4538e6[_0xa24c('0x34')]['ids'])){for(var _0x30e24d=0x0;_0x30e24d<_0x4538e6[_0xa24c('0x34')]['ids']['length'];_0x30e24d+=0x1){socket[_0xa24c('0x75')](_0xa24c('0x8c'),{'UserId':Number(_0x4538e6[_0xa24c('0x34')][_0xa24c('0x78')][_0x30e24d]),'SmsQueueId':Number(_0x4538e6['params']['id'])});}}else{socket[_0xa24c('0x75')](_0xa24c('0x8c'),{'UserId':Number(_0x4538e6['query'][_0xa24c('0x78')]),'SmsQueueId':Number(_0x4538e6[_0xa24c('0x49')]['id'])});}});}})[_0xa24c('0x27')](respondWithStatusCode(_0x3bf62c,null))[_0xa24c('0x47')](handleError(_0x3bf62c,null));};exports[_0xa24c('0x91')]=function(_0x2bafac,_0x43e01a,_0x4e4788){var _0x55c670={};var _0x1e3114={};var _0x3bf57c;var _0x5c2235;return db['SmsQueue'][_0xa24c('0x5b')]({'where':{'id':_0x2bafac[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x43e01a,null))['then'](function(_0x469d56){if(_0x469d56){_0x3bf57c=_0x469d56;_0x1e3114[_0xa24c('0x33')]=_[_0xa24c('0x35')](db[_0xa24c('0x5e')][_0xa24c('0x4a')]);_0x1e3114[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x2bafac[_0xa24c('0x34')]);_0x1e3114['filters']=_['intersection'](_0x1e3114[_0xa24c('0x33')],_0x1e3114[_0xa24c('0x34')]);_0x55c670['attributes']=_['intersection'](_0x1e3114[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x37')]));_0x55c670[_0xa24c('0x38')]=_0x55c670[_0xa24c('0x38')][_0xa24c('0x4b')]?_0x55c670[_0xa24c('0x38')]:_0x1e3114['model'];_0x55c670[_0xa24c('0x3c')]=qs[_0xa24c('0x3d')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x3d')]);_0x55c670[_0xa24c('0x3e')]=qs[_0xa24c('0x3f')](_[_0xa24c('0x69')](_0x2bafac[_0xa24c('0x34')],_0x1e3114[_0xa24c('0x3f')]));if(_0x2bafac[_0xa24c('0x34')][_0xa24c('0x40')]){_0x55c670[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x55c670[_0xa24c('0x3e')],{'$or':_[_0xa24c('0x2e')](_0x55c670[_0xa24c('0x38')],function(_0x5eb0fa){var _0x5af5e4={};_0x5af5e4[_0x5eb0fa]={'$like':'%'+_0x2bafac[_0xa24c('0x34')][_0xa24c('0x40')]+'%'};return _0x5af5e4;})});}_0x55c670=_[_0xa24c('0x41')]({},_0x55c670,_0x2bafac[_0xa24c('0x43')]);return _0x3bf57c[_0xa24c('0x91')](_0x55c670);}})[_0xa24c('0x27')](function(_0x2d47ca){if(_0x2d47ca){_0x5c2235=_0x2d47ca['length'];if(!_0x2bafac['query']['hasOwnProperty']('nolimit')){_0x55c670['limit']=qs[_0xa24c('0x3b')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x3b')]);_0x55c670[_0xa24c('0x20')]=qs[_0xa24c('0x20')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x20')]);}return _0x3bf57c['getAgents'](_0x55c670);}})[_0xa24c('0x27')](function(_0x54ba90){if(_0x54ba90){return _0x54ba90?{'count':_0x5c2235,'rows':_0x54ba90}:null;}})[_0xa24c('0x27')](respondWithResult(_0x43e01a,null))[_0xa24c('0x47')](handleError(_0x43e01a,null));}; \ No newline at end of file +var _0xf006=['rawAttributes','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','%s/%s','SIP','createdAt','getTeams','ids','Team','Agents','online','voicePause','flatMap','find','sequelize','transaction','addTeams','each','findOrCreate','emit','userSmsQueue:save','removeTeams','from','team_has_sms_queues','join','user_has_teams','clone','push','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','order','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','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','redis','defaults','localhost','register','sendStatus','status','end','count','offset','limit','set','apply','save','update','then','destroy','get','SmsQueues','error','stack','name','send','index','SmsQueue','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserSmsQueue'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xf006,0x146));var _0x6f00=function(_0x5d6496,_0x4ff649){_0x5d6496=_0x5d6496-0x0;var _0x30fb35=_0xf006[_0x5d6496];return _0x30fb35;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6f00('0x0'));var zipdir=require(_0x6f00('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f00('0x2'));var moment=require('moment');var BPromise=require(_0x6f00('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f00('0x4'));var sox=require(_0x6f00('0x5'));var csv=require(_0x6f00('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f00('0x7'));var squel=require('squel');var crypto=require(_0x6f00('0x8'));var jsforce=require(_0x6f00('0x9'));var deskjs=require(_0x6f00('0xa'));var toCsv=require(_0x6f00('0x6'));var querystring=require(_0x6f00('0xb'));var Papa=require(_0x6f00('0xc'));var Redis=require(_0x6f00('0xd'));var authService=require(_0x6f00('0xe'));var qs=require(_0x6f00('0xf'));var as=require(_0x6f00('0x10'));var hardwareService=require(_0x6f00('0x11'));var logger=require(_0x6f00('0x12'))(_0x6f00('0x13'));var utils=require('../../config/utils');var config=require(_0x6f00('0x14'));var licenseUtil=require(_0x6f00('0x15'));var db=require(_0x6f00('0x16'))['db'];config[_0x6f00('0x17')]=_[_0x6f00('0x18')](config['redis'],{'host':_0x6f00('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f00('0x17')]));require('./smsQueue.socket')[_0x6f00('0x1a')](socket);function respondWithStatusCode(_0x220e68,_0x327e10){_0x327e10=_0x327e10||0xcc;return function(_0x33f3a2){if(_0x33f3a2){return _0x220e68[_0x6f00('0x1b')](_0x327e10);}return _0x220e68[_0x6f00('0x1c')](_0x327e10)[_0x6f00('0x1d')]();};}function respondWithResult(_0x4d8aee,_0x342c7f){_0x342c7f=_0x342c7f||0xc8;return function(_0x4bfac3){if(_0x4bfac3){return _0x4d8aee[_0x6f00('0x1c')](_0x342c7f)['json'](_0x4bfac3);}};}function respondWithFilteredResult(_0x534275,_0x7c047e){return function(_0x6cf83f){if(_0x6cf83f){var _0x466c7c=_0x6cf83f[_0x6f00('0x1e')],_0x340f78=_0x7c047e[_0x6f00('0x1f')],_0x13f09f=_0x7c047e[_0x6f00('0x1f')]+_0x7c047e[_0x6f00('0x20')],_0x27e466;if(_0x13f09f>=_0x466c7c){_0x13f09f=_0x466c7c;_0x27e466=0xc8;}else{_0x27e466=0xce;}_0x534275[_0x6f00('0x1c')](_0x27e466);return _0x534275[_0x6f00('0x21')]('Content-Range',_0x340f78+'-'+_0x13f09f+'/'+_0x466c7c)['json'](_0x6cf83f);}return null;};}function patchUpdates(_0x5850dd){return function(_0x2a5286){try{jsonpatch[_0x6f00('0x22')](_0x2a5286,_0x5850dd,!![]);}catch(_0x43bfb8){return BPromise['reject'](_0x43bfb8);}return _0x2a5286[_0x6f00('0x23')]();};}function saveUpdates(_0x9066ff,_0x321e26){return function(_0x1da9b9){if(_0x1da9b9){return _0x1da9b9[_0x6f00('0x24')](_0x9066ff)[_0x6f00('0x25')](function(_0x90d74c){return _0x90d74c;});}return null;};}function removeEntity(_0x1ea061,_0x533d70){return function(_0x3c05ef){if(_0x3c05ef){return _0x3c05ef[_0x6f00('0x26')]()[_0x6f00('0x25')](function(){var _0x4d41ef=_0x3c05ef[_0x6f00('0x27')]({'plain':!![]});var _0x4f7e29=_0x6f00('0x28');return db['UserProfileResource'][_0x6f00('0x26')]({'where':{'type':_0x4f7e29,'resourceId':_0x4d41ef['id']}})[_0x6f00('0x25')](function(){return _0x3c05ef;});})[_0x6f00('0x25')](function(){_0x1ea061[_0x6f00('0x1c')](0xcc)[_0x6f00('0x1d')]();});}};}function handleEntityNotFound(_0x49eb87,_0x23a346){return function(_0x25cc71){if(!_0x25cc71){_0x49eb87[_0x6f00('0x1b')](0x194);}return _0x25cc71;};}function handleError(_0x4366a4,_0x2671fe){_0x2671fe=_0x2671fe||0x1f4;return function(_0x235a86){logger[_0x6f00('0x29')](_0x235a86[_0x6f00('0x2a')]);if(_0x235a86[_0x6f00('0x2b')]){delete _0x235a86[_0x6f00('0x2b')];}_0x4366a4[_0x6f00('0x1c')](_0x2671fe)[_0x6f00('0x2c')](_0x235a86);};}exports[_0x6f00('0x2d')]=function(_0x17d9d1,_0x5dde51){var _0x5775c5={},_0x5d16ad={},_0x5df06d={'count':0x0,'rows':[]};var _0x522d4f=_['map'](db[_0x6f00('0x2e')]['rawAttributes'],function(_0x3c0e5d){return{'name':_0x3c0e5d[_0x6f00('0x2f')],'type':_0x3c0e5d[_0x6f00('0x30')][_0x6f00('0x31')]};});_0x5d16ad[_0x6f00('0x32')]=_[_0x6f00('0x33')](_0x522d4f,'name');_0x5d16ad[_0x6f00('0x34')]=_[_0x6f00('0x35')](_0x17d9d1[_0x6f00('0x34')]);_0x5d16ad[_0x6f00('0x36')]=_[_0x6f00('0x37')](_0x5d16ad['model'],_0x5d16ad['query']);_0x5775c5['attributes']=_[_0x6f00('0x37')](_0x5d16ad[_0x6f00('0x32')],qs[_0x6f00('0x38')](_0x17d9d1[_0x6f00('0x34')][_0x6f00('0x38')]));_0x5775c5['attributes']=_0x5775c5[_0x6f00('0x39')][_0x6f00('0x3a')]?_0x5775c5[_0x6f00('0x39')]:_0x5d16ad[_0x6f00('0x32')];if(!_0x17d9d1[_0x6f00('0x34')][_0x6f00('0x3b')](_0x6f00('0x3c'))){_0x5775c5['limit']=qs[_0x6f00('0x20')](_0x17d9d1[_0x6f00('0x34')][_0x6f00('0x20')]);_0x5775c5['offset']=qs[_0x6f00('0x1f')](_0x17d9d1[_0x6f00('0x34')][_0x6f00('0x1f')]);}_0x5775c5['order']=qs[_0x6f00('0x3d')](_0x17d9d1['query'][_0x6f00('0x3d')]);_0x5775c5['where']=qs[_0x6f00('0x36')](_[_0x6f00('0x3e')](_0x17d9d1[_0x6f00('0x34')],_0x5d16ad[_0x6f00('0x36')]),_0x522d4f);if(_0x17d9d1['query'][_0x6f00('0x3f')]){_0x5775c5['where']=_[_0x6f00('0x40')](_0x5775c5['where'],{'$or':_[_0x6f00('0x33')](_0x522d4f,function(_0x2f1ef1){if(_0x2f1ef1[_0x6f00('0x30')]!==_0x6f00('0x41')){var _0x57c72d={};_0x57c72d[_0x2f1ef1['name']]={'$like':'%'+_0x17d9d1[_0x6f00('0x34')]['filter']+'%'};return _0x57c72d;}})});}_0x5775c5=_[_0x6f00('0x40')]({},_0x5775c5,_0x17d9d1[_0x6f00('0x42')]);var _0x4a70ea={'where':_0x5775c5[_0x6f00('0x43')]};return db['SmsQueue']['count'](_0x4a70ea)[_0x6f00('0x25')](function(_0x3c19bb){_0x5df06d[_0x6f00('0x1e')]=_0x3c19bb;if(_0x17d9d1[_0x6f00('0x34')]['includeAll']){_0x5775c5[_0x6f00('0x44')]=[{'all':!![]}];}return db[_0x6f00('0x2e')][_0x6f00('0x45')](_0x5775c5);})[_0x6f00('0x25')](function(_0x2788ad){_0x5df06d[_0x6f00('0x46')]=_0x2788ad;return _0x5df06d;})['then'](respondWithFilteredResult(_0x5dde51,_0x5775c5))[_0x6f00('0x47')](handleError(_0x5dde51,null));};exports[_0x6f00('0x48')]=function(_0x8d4dde,_0x1c8b81){var _0x303a32={'raw':!![],'where':{'id':_0x8d4dde['params']['id']}},_0x35ce8d={};_0x35ce8d[_0x6f00('0x32')]=_[_0x6f00('0x35')](db[_0x6f00('0x2e')]['rawAttributes']);_0x35ce8d[_0x6f00('0x34')]=_['keys'](_0x8d4dde[_0x6f00('0x34')]);_0x35ce8d[_0x6f00('0x36')]=_['intersection'](_0x35ce8d[_0x6f00('0x32')],_0x35ce8d['query']);_0x303a32[_0x6f00('0x39')]=_[_0x6f00('0x37')](_0x35ce8d[_0x6f00('0x32')],qs[_0x6f00('0x38')](_0x8d4dde['query'][_0x6f00('0x38')]));_0x303a32['attributes']=_0x303a32[_0x6f00('0x39')]['length']?_0x303a32[_0x6f00('0x39')]:_0x35ce8d[_0x6f00('0x32')];if(_0x8d4dde[_0x6f00('0x34')][_0x6f00('0x49')]){_0x303a32[_0x6f00('0x44')]=[{'all':!![]}];}_0x303a32=_[_0x6f00('0x40')]({},_0x303a32,_0x8d4dde[_0x6f00('0x42')]);return db[_0x6f00('0x2e')]['find'](_0x303a32)[_0x6f00('0x25')](handleEntityNotFound(_0x1c8b81,null))['then'](respondWithResult(_0x1c8b81,null))[_0x6f00('0x47')](handleError(_0x1c8b81,null));};exports[_0x6f00('0x4a')]=function(_0x27f38b,_0x5eec08){return db['SmsQueue'][_0x6f00('0x4a')](_0x27f38b[_0x6f00('0x4b')],{})['then'](function(_0x3b15c6){var _0x4b2386=_0x27f38b[_0x6f00('0x4c')]['get']({'plain':!![]});if(!_0x4b2386)throw new Error(_0x6f00('0x4d'));if(_0x4b2386[_0x6f00('0x4e')]==='user'){var _0x52ee5a=_0x3b15c6[_0x6f00('0x27')]({'plain':!![]});var _0x2520ff='SmsQueues';return db[_0x6f00('0x4f')]['find']({'where':{'name':_0x2520ff,'userProfileId':_0x4b2386[_0x6f00('0x50')]},'raw':!![]})[_0x6f00('0x25')](function(_0x3100ee){if(_0x3100ee&&_0x3100ee[_0x6f00('0x51')]===0x0){return db[_0x6f00('0x52')][_0x6f00('0x4a')]({'name':_0x52ee5a[_0x6f00('0x2b')],'resourceId':_0x52ee5a['id'],'type':_0x3100ee[_0x6f00('0x2b')],'sectionId':_0x3100ee['id']},{})[_0x6f00('0x25')](function(){return _0x3b15c6;});}else{return _0x3b15c6;}})[_0x6f00('0x47')](function(_0x1ddfa2){logger[_0x6f00('0x29')](_0x6f00('0x53'),_0x1ddfa2);throw _0x1ddfa2;});}return _0x3b15c6;})[_0x6f00('0x25')](respondWithResult(_0x5eec08,0xc9))[_0x6f00('0x47')](handleError(_0x5eec08,null));};exports[_0x6f00('0x24')]=function(_0x2ba83e,_0x1bf8d8){if(_0x2ba83e[_0x6f00('0x4b')]['id']){delete _0x2ba83e[_0x6f00('0x4b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x2ba83e[_0x6f00('0x54')]['id']}})['then'](handleEntityNotFound(_0x1bf8d8,null))[_0x6f00('0x25')](saveUpdates(_0x2ba83e[_0x6f00('0x4b')],null))['then'](respondWithResult(_0x1bf8d8,null))[_0x6f00('0x47')](handleError(_0x1bf8d8,null));};exports[_0x6f00('0x26')]=function(_0x2c87b5,_0x4e2ddb){return db[_0x6f00('0x2e')]['find']({'where':{'id':_0x2c87b5[_0x6f00('0x54')]['id']}})[_0x6f00('0x25')](handleEntityNotFound(_0x4e2ddb,null))['then'](removeEntity(_0x4e2ddb,null))[_0x6f00('0x47')](handleError(_0x4e2ddb,null));};exports[_0x6f00('0x55')]=function(_0xd2e139,_0x111fd4){return db[_0x6f00('0x2e')][_0x6f00('0x55')]()[_0x6f00('0x25')](respondWithResult(_0x111fd4,null))['catch'](handleError(_0x111fd4,null));};exports['getMembers']=function(_0x5bd485,_0x4a421b,_0x197555){var _0x269753={'raw':!![],'where':{}},_0x5bbfdb={},_0x53e735;return db[_0x6f00('0x2e')][_0x6f00('0x56')]({'where':{'id':_0x5bd485[_0x6f00('0x54')]['id']}})[_0x6f00('0x25')](handleEntityNotFound(_0x4a421b,null))['then'](function(_0x37f5d4){if(_0x37f5d4){_0x53e735=_0x37f5d4['get']({'plain':!![]});_0x5bbfdb['model']=_[_0x6f00('0x35')](db[_0x6f00('0x57')][_0x6f00('0x58')]);_0x5bbfdb[_0x6f00('0x34')]=_[_0x6f00('0x35')](_0x5bd485['query']);_0x5bbfdb[_0x6f00('0x36')]=_[_0x6f00('0x37')](_0x5bbfdb[_0x6f00('0x32')],_0x5bbfdb[_0x6f00('0x34')]);_0x269753['attributes']=_['intersection'](_0x5bbfdb[_0x6f00('0x32')],qs['fields'](_0x5bd485[_0x6f00('0x34')][_0x6f00('0x38')]));_0x269753[_0x6f00('0x39')]=_0x269753[_0x6f00('0x39')]['length']?_0x269753['attributes']:_0x5bbfdb[_0x6f00('0x32')];if(!_0x5bd485[_0x6f00('0x34')][_0x6f00('0x3b')](_0x6f00('0x3c'))){_0x269753['limit']=qs[_0x6f00('0x20')](_0x5bd485[_0x6f00('0x34')][_0x6f00('0x20')]);_0x269753[_0x6f00('0x1f')]=qs[_0x6f00('0x1f')](_0x5bd485['query']['offset']);}_0x269753['order']=qs[_0x6f00('0x3d')](_0x5bd485[_0x6f00('0x34')]['sort']);_0x269753['where']=qs[_0x6f00('0x36')](_[_0x6f00('0x3e')](_0x5bd485['query'],_0x5bbfdb['filters']));_0x269753[_0x6f00('0x43')][_0x6f00('0x59')]=_0x37f5d4['id'];if(_0x5bd485[_0x6f00('0x34')][_0x6f00('0x3f')]){_0x269753[_0x6f00('0x43')]=_[_0x6f00('0x40')](_0x269753[_0x6f00('0x43')],{'$or':_[_0x6f00('0x33')](_0x269753['attributes'],function(_0x5b16e6){var _0x38471c={};_0x38471c[_0x5b16e6]={'$like':'%'+_0x5bd485[_0x6f00('0x34')][_0x6f00('0x3f')]+'%'};return _0x38471c;})});}_0x269753=_[_0x6f00('0x40')]({},_0x269753,_0x5bd485[_0x6f00('0x42')]);return db[_0x6f00('0x57')][_0x6f00('0x45')](_0x269753);}})[_0x6f00('0x25')](function(_0xd212a6){if(_0xd212a6){return db[_0x6f00('0x5a')][_0x6f00('0x5b')]({'where':{'id':_[_0x6f00('0x33')](_0xd212a6,_0x6f00('0x5c')),'role':_0x6f00('0x5d')},'attributes':['id',_0x6f00('0x2b'),_0x6f00('0x5e'),_0x6f00('0x5f'),'createdAt']});}})['then'](function(_0x28bdeb){if(_0x28bdeb){return{'count':_0x28bdeb['count'],'rows':_[_0x6f00('0x33')](_0x28bdeb[_0x6f00('0x46')],function(_0x3d14db){return{'membername':_0x3d14db[_0x6f00('0x2b')],'UserId':_0x3d14db['id'],'queue_name':_0x53e735[_0x6f00('0x2b')],'SmsQueueId':_0x53e735['id'],'interface':util['format'](_0x6f00('0x60'),_0x6f00('0x61'),_0x3d14db[_0x6f00('0x2b')]),'penalty':0x0,'paused':_0x3d14db[_0x6f00('0x5e')],'createdAt':_0x3d14db[_0x6f00('0x62')],'updatedAt':_0x3d14db[_0x6f00('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6f00('0x25')](respondWithFilteredResult(_0x4a421b,_0x269753))[_0x6f00('0x47')](handleError(_0x4a421b,null));};exports[_0x6f00('0x63')]=function(_0x1cc857,_0x19b5eb,_0x58a7b8){var _0x1ca7ad={};var _0xb3bb9a={};var _0x422318;var _0x511905;return db['SmsQueue'][_0x6f00('0x56')]({'where':{'id':_0x1cc857[_0x6f00('0x54')]['id']}})[_0x6f00('0x25')](handleEntityNotFound(_0x19b5eb,null))[_0x6f00('0x25')](function(_0x5a9b42){if(_0x5a9b42){_0x422318=_0x5a9b42;_0xb3bb9a['model']=_['keys'](db['Team'][_0x6f00('0x58')]);_0xb3bb9a[_0x6f00('0x34')]=_[_0x6f00('0x35')](_0x1cc857[_0x6f00('0x34')]);_0xb3bb9a[_0x6f00('0x36')]=_['intersection'](_0xb3bb9a[_0x6f00('0x32')],_0xb3bb9a[_0x6f00('0x34')]);_0x1ca7ad['attributes']=_[_0x6f00('0x37')](_0xb3bb9a[_0x6f00('0x32')],qs[_0x6f00('0x38')](_0x1cc857[_0x6f00('0x34')][_0x6f00('0x38')]));_0x1ca7ad[_0x6f00('0x39')]=_0x1ca7ad[_0x6f00('0x39')][_0x6f00('0x3a')]?_0x1ca7ad['attributes']:_0xb3bb9a[_0x6f00('0x32')];_0x1ca7ad['order']=qs[_0x6f00('0x3d')](_0x1cc857[_0x6f00('0x34')][_0x6f00('0x3d')]);_0x1ca7ad[_0x6f00('0x43')]=qs[_0x6f00('0x36')](_[_0x6f00('0x3e')](_0x1cc857[_0x6f00('0x34')],_0xb3bb9a[_0x6f00('0x36')]));if(_0x1cc857[_0x6f00('0x34')][_0x6f00('0x3f')]){_0x1ca7ad[_0x6f00('0x43')]=_[_0x6f00('0x40')](_0x1ca7ad[_0x6f00('0x43')],{'$or':_[_0x6f00('0x33')](_0x1ca7ad['attributes'],function(_0x3ba021){var _0xdfa8ff={};_0xdfa8ff[_0x3ba021]={'$like':'%'+_0x1cc857[_0x6f00('0x34')]['filter']+'%'};return _0xdfa8ff;})});}_0x1ca7ad=_[_0x6f00('0x40')]({},_0x1ca7ad,_0x1cc857[_0x6f00('0x42')]);return _0x422318['getTeams'](_0x1ca7ad);}})[_0x6f00('0x25')](function(_0x44762e){if(_0x44762e){_0x511905=_0x44762e[_0x6f00('0x3a')];if(!_0x1cc857[_0x6f00('0x34')]['hasOwnProperty']('nolimit')){_0x1ca7ad['limit']=qs[_0x6f00('0x20')](_0x1cc857[_0x6f00('0x34')][_0x6f00('0x20')]);_0x1ca7ad[_0x6f00('0x1f')]=qs['offset'](_0x1cc857[_0x6f00('0x34')][_0x6f00('0x1f')]);}return _0x422318[_0x6f00('0x63')](_0x1ca7ad);}})[_0x6f00('0x25')](function(_0x163885){if(_0x163885){return _0x163885?{'count':_0x511905,'rows':_0x163885}:null;}})[_0x6f00('0x25')](respondWithResult(_0x19b5eb,null))['catch'](handleError(_0x19b5eb,null));};exports['addTeams']=function(_0x31ce4f,_0x179fb7,_0x2f97cd){var _0x1abd35=_0x31ce4f[_0x6f00('0x4b')][_0x6f00('0x64')];return db[_0x6f00('0x65')]['findAll']({'where':{'id':_0x1abd35},'attributes':['id'],'include':[{'model':db[_0x6f00('0x5a')],'as':_0x6f00('0x66'),'attributes':['id','name',_0x6f00('0x67'),_0x6f00('0x68'),'interface'],'raw':!![]}]})['then'](function(_0x340f76){if(_0x340f76){var _0x422649=_[_0x6f00('0x69')](_0x340f76,function(_0x1e6f2c){var _0x1fb213=_0x1e6f2c[_0x6f00('0x27')]({'plain':!![]});return _0x1fb213[_0x6f00('0x66')];});return db['SmsQueue'][_0x6f00('0x6a')]({'where':{'id':_0x31ce4f[_0x6f00('0x54')]['id']}})[_0x6f00('0x25')](function(_0x431eae){return db[_0x6f00('0x6b')][_0x6f00('0x6c')](function(_0xc77edd){return _0x431eae[_0x6f00('0x6d')](_0x1abd35,{'transaction':_0xc77edd})[_0x6f00('0x25')](function(){return BPromise[_0x6f00('0x6e')](_0x422649,function(_0x25ad68){return db[_0x6f00('0x57')][_0x6f00('0x6f')]({'where':{'UserId':_0x25ad68['id'],'SmsQueueId':_0x31ce4f[_0x6f00('0x54')]['id']},'transaction':_0xc77edd});});})[_0x6f00('0x25')](function(){_0x422649['forEach'](function(_0x2dd18c){socket[_0x6f00('0x70')](_0x6f00('0x71'),{'UserId':_0x2dd18c['id'],'SmsQueueId':_0x431eae['id']});});});});});}})[_0x6f00('0x25')](respondWithStatusCode(_0x179fb7,null))['catch'](handleError(_0x179fb7,null));};exports[_0x6f00('0x72')]=function(_0x426ce1,_0x3a47ac,_0x101480){return db[_0x6f00('0x65')][_0x6f00('0x45')]({'where':{'id':_0x426ce1[_0x6f00('0x34')][_0x6f00('0x64')]},'attributes':['id'],'include':[{'model':db[_0x6f00('0x5a')],'as':_0x6f00('0x66'),'attributes':['id'],'raw':!![]}]})[_0x6f00('0x25')](handleEntityNotFound(_0x3a47ac,null))[_0x6f00('0x25')](function(_0x3692dd){var _0x2fb417=_['map'](_0x3692dd,'id');var _0x37fdfd=[];var _0x190139=[];var _0x39b2ce=squel['select']();_0x39b2ce['field']('tq.TeamId')[_0x6f00('0x73')](_0x6f00('0x74'),'tq')[_0x6f00('0x75')](_0x6f00('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6f00('0x43')]('SmsQueueId\x20=\x20?',_0x426ce1['params']['id']);for(var _0x44568b=0x0;_0x44568b<_0x3692dd[_0x6f00('0x3a')];_0x44568b+=0x1){let _0x260f1d=_0x3692dd[_0x44568b];for(var _0x1d8637=0x0;_0x1d8637<_0x260f1d[_0x6f00('0x66')][_0x6f00('0x3a')];_0x1d8637+=0x1){let _0x31b66c=_0x260f1d[_0x6f00('0x66')][_0x1d8637];var _0xae32c4=_0x39b2ce[_0x6f00('0x77')]();_0xae32c4[_0x6f00('0x43')]('ut.UserId\x20=\x20?',_0x31b66c['id']);_0x190139[_0x6f00('0x78')](db[_0x6f00('0x6b')][_0x6f00('0x34')](_0xae32c4['toString'](),{'type':db['sequelize'][_0x6f00('0x79')][_0x6f00('0x7a')]})[_0x6f00('0x25')](function(_0x1f148e){if(_0x1f148e[_0x6f00('0x3a')]===0x1){return _0x31b66c['id'];}else{var _0x338a00=_[_0x6f00('0x7b')](_[_0x6f00('0x33')](_0x1f148e,'TeamId'),function(_0x2728e0){return _[_0x6f00('0x7c')](_0x2fb417,_0x2728e0);});if(_0x338a00){return _0x31b66c['id'];}}}));}}return BPromise[_0x6f00('0x7d')](_0x190139)[_0x6f00('0x25')](function(_0x365dec){_0x37fdfd=_(_0x37fdfd)[_0x6f00('0x7e')](_0x365dec)[_0x6f00('0x7f')]()[_0x6f00('0x80')]();return db[_0x6f00('0x2e')][_0x6f00('0x6a')]({'where':{'id':_0x426ce1[_0x6f00('0x54')]['id']}})['then'](function(_0x4ba02d){return db[_0x6f00('0x6b')]['transaction'](function(_0xfc0777){return _0x4ba02d[_0x6f00('0x72')](_0x426ce1[_0x6f00('0x34')]['ids'],{'transaction':_0xfc0777})[_0x6f00('0x25')](function(){if(!_[_0x6f00('0x81')](_0x37fdfd)){return _0x4ba02d[_0x6f00('0x82')](_0x37fdfd,{'transaction':_0xfc0777});}})[_0x6f00('0x25')](function(){_0x37fdfd['forEach'](function(_0x415682){socket[_0x6f00('0x70')](_0x6f00('0x83'),{'UserId':_0x415682,'SmsQueueId':_0x4ba02d['id']});});});});});});})[_0x6f00('0x25')](respondWithStatusCode(_0x3a47ac,null))[_0x6f00('0x47')](handleError(_0x3a47ac,null));};exports[_0x6f00('0x84')]=function(_0x517813,_0x28c0a7,_0x1e78d3){return db[_0x6f00('0x2e')][_0x6f00('0x6a')]({'where':{'id':_0x517813[_0x6f00('0x54')]['id']}})['then'](handleEntityNotFound(_0x28c0a7,null))[_0x6f00('0x25')](function(_0x4d2d70){if(_0x4d2d70){return _0x4d2d70[_0x6f00('0x84')](_0x517813[_0x6f00('0x4b')][_0x6f00('0x64')],_[_0x6f00('0x85')](_0x517813['body'],[_0x6f00('0x64'),'id'])||{})[_0x6f00('0x86')](function(_0x4f8d5f){for(var _0x9e969c=0x0;_0x9e969c<_0x517813[_0x6f00('0x4b')]['ids'][_0x6f00('0x3a')];_0x9e969c+=0x1){socket[_0x6f00('0x70')](_0x6f00('0x71'),{'UserId':_0x517813[_0x6f00('0x4b')]['ids'][_0x9e969c],'SmsQueueId':_0x517813[_0x6f00('0x54')]['id']});}return _0x4f8d5f;});}})[_0x6f00('0x25')](respondWithResult(_0x28c0a7,null))[_0x6f00('0x47')](handleError(_0x28c0a7,null));};exports[_0x6f00('0x82')]=function(_0x2e76ff,_0x31384d,_0x2e2c1d){return db[_0x6f00('0x2e')][_0x6f00('0x6a')]({'where':{'id':_0x2e76ff[_0x6f00('0x54')]['id']}})[_0x6f00('0x25')](handleEntityNotFound(_0x31384d,null))['then'](function(_0x37b970){if(_0x37b970){return _0x37b970[_0x6f00('0x82')](_0x2e76ff[_0x6f00('0x34')][_0x6f00('0x64')])['then'](function(){if(_[_0x6f00('0x87')](_0x2e76ff[_0x6f00('0x34')]['ids'])){for(var _0x3e6526=0x0;_0x3e6526<_0x2e76ff['query'][_0x6f00('0x64')]['length'];_0x3e6526+=0x1){socket[_0x6f00('0x70')]('userSmsQueue:remove',{'UserId':Number(_0x2e76ff[_0x6f00('0x34')][_0x6f00('0x64')][_0x3e6526]),'SmsQueueId':Number(_0x2e76ff['params']['id'])});}}else{socket[_0x6f00('0x70')](_0x6f00('0x83'),{'UserId':Number(_0x2e76ff['query'][_0x6f00('0x64')]),'SmsQueueId':Number(_0x2e76ff[_0x6f00('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x31384d,null))[_0x6f00('0x47')](handleError(_0x31384d,null));};exports[_0x6f00('0x88')]=function(_0x2150c3,_0x9b3729,_0x5337d3){var _0x460034={};var _0x1dc864={};var _0x1f542d;var _0x4f97e4;return db['SmsQueue'][_0x6f00('0x56')]({'where':{'id':_0x2150c3[_0x6f00('0x54')]['id']}})[_0x6f00('0x25')](handleEntityNotFound(_0x9b3729,null))[_0x6f00('0x25')](function(_0xead7d4){if(_0xead7d4){_0x1f542d=_0xead7d4;_0x1dc864['model']=_[_0x6f00('0x35')](db[_0x6f00('0x5a')]['rawAttributes']);_0x1dc864[_0x6f00('0x34')]=_[_0x6f00('0x35')](_0x2150c3['query']);_0x1dc864[_0x6f00('0x36')]=_['intersection'](_0x1dc864[_0x6f00('0x32')],_0x1dc864[_0x6f00('0x34')]);_0x460034[_0x6f00('0x39')]=_[_0x6f00('0x37')](_0x1dc864[_0x6f00('0x32')],qs[_0x6f00('0x38')](_0x2150c3[_0x6f00('0x34')]['fields']));_0x460034[_0x6f00('0x39')]=_0x460034[_0x6f00('0x39')]['length']?_0x460034[_0x6f00('0x39')]:_0x1dc864[_0x6f00('0x32')];_0x460034[_0x6f00('0x89')]=qs[_0x6f00('0x3d')](_0x2150c3[_0x6f00('0x34')][_0x6f00('0x3d')]);_0x460034[_0x6f00('0x43')]=qs[_0x6f00('0x36')](_['pick'](_0x2150c3[_0x6f00('0x34')],_0x1dc864['filters']));if(_0x2150c3[_0x6f00('0x34')]['filter']){_0x460034[_0x6f00('0x43')]=_[_0x6f00('0x40')](_0x460034[_0x6f00('0x43')],{'$or':_[_0x6f00('0x33')](_0x460034[_0x6f00('0x39')],function(_0x12149c){var _0x177243={};_0x177243[_0x12149c]={'$like':'%'+_0x2150c3[_0x6f00('0x34')][_0x6f00('0x3f')]+'%'};return _0x177243;})});}_0x460034=_[_0x6f00('0x40')]({},_0x460034,_0x2150c3[_0x6f00('0x42')]);return _0x1f542d['getAgents'](_0x460034);}})[_0x6f00('0x25')](function(_0x11b4ff){if(_0x11b4ff){_0x4f97e4=_0x11b4ff[_0x6f00('0x3a')];if(!_0x2150c3[_0x6f00('0x34')][_0x6f00('0x3b')]('nolimit')){_0x460034[_0x6f00('0x20')]=qs[_0x6f00('0x20')](_0x2150c3[_0x6f00('0x34')]['limit']);_0x460034['offset']=qs[_0x6f00('0x1f')](_0x2150c3[_0x6f00('0x34')]['offset']);}return _0x1f542d[_0x6f00('0x88')](_0x460034);}})[_0x6f00('0x25')](function(_0x540ea3){if(_0x540ea3){return _0x540ea3?{'count':_0x4f97e4,'rows':_0x540ea3}:null;}})[_0x6f00('0x25')](respondWithResult(_0x9b3729,null))[_0x6f00('0x47')](handleError(_0x9b3729,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 1ea13aa..03206f9 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 _0x6785=['update','remove','hasOwnProperty','hook','events','SmsQueue','setMaxListeners'];(function(_0x3965a8,_0x2247d4){var _0x397c25=function(_0x402017){while(--_0x402017){_0x3965a8['push'](_0x3965a8['shift']());}};_0x397c25(++_0x2247d4);}(_0x6785,0x1c4));var _0x5678=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x6785[_0x59d89e];return _0x554e93;};'use strict';var EventEmitter=require(_0x5678('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x5678('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5678('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5678('0x3'),'afterDestroy':_0x5678('0x4')};function emitEvent(_0x15f236){return function(_0x5a551e,_0xc4dafd,_0x2e2197){SmsQueueEvents['emit'](_0x15f236+':'+_0x5a551e['id'],_0x5a551e);SmsQueueEvents['emit'](_0x15f236,_0x5a551e);_0x2e2197(null);};}for(var e in events){if(events[_0x5678('0x5')](e)){var event=events[e];SmsQueue[_0x5678('0x6')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xe806=['update','emit','hasOwnProperty','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x19fad6,_0x3b85ae){var _0x183f27=function(_0x4a2268){while(--_0x4a2268){_0x19fad6['push'](_0x19fad6['shift']());}};_0x183f27(++_0x3b85ae);}(_0xe806,0x1bd));var _0x6e80=function(_0x2c5447,_0x38f581){_0x2c5447=_0x2c5447-0x0;var _0x3af22a=_0xe806[_0x2c5447];return _0x3af22a;};'use strict';var EventEmitter=require(_0x6e80('0x0'));var SmsQueue=require(_0x6e80('0x1'))['db'][_0x6e80('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6e80('0x3')](0x0);var events={'afterCreate':_0x6e80('0x4'),'afterUpdate':_0x6e80('0x5'),'afterDestroy':'remove'};function emitEvent(_0x348d6c){return function(_0x108fe0,_0x2b1e09,_0xd02876){SmsQueueEvents[_0x6e80('0x6')](_0x348d6c+':'+_0x108fe0['id'],_0x108fe0);SmsQueueEvents[_0x6e80('0x6')](_0x348d6c,_0x108fe0);_0xd02876(null);};}for(var e in events){if(events[_0x6e80('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x6e80('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 568b0c1..fceb4c5 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 _0x7166=['sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x329c79,_0x35c249){var _0x491a86=function(_0x7cef96){while(--_0x7cef96){_0x329c79['push'](_0x329c79['shift']());}};_0x491a86(++_0x35c249);}(_0x7166,0x90));var _0x6716=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0x7166[_0x44cb92];return _0x56b9e6;};'use strict';var _=require(_0x6716('0x0'));var util=require(_0x6716('0x1'));var logger=require(_0x6716('0x2'))('api');var moment=require(_0x6716('0x3'));var BPromise=require(_0x6716('0x4'));var rp=require(_0x6716('0x5'));var fs=require('fs');var path=require(_0x6716('0x6'));var rimraf=require('rimraf');var config=require(_0x6716('0x7'));var attributes=require(_0x6716('0x8'));module[_0x6716('0x9')]=function(_0x472e27,_0x3b4341){return _0x472e27[_0x6716('0xa')](_0x6716('0xb'),attributes,{'tableName':_0x6716('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbb7=['exports','SmsQueue','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x35f596,_0x4390f4){var _0x32def5=function(_0x444a82){while(--_0x444a82){_0x35f596['push'](_0x35f596['shift']());}};_0x32def5(++_0x4390f4);}(_0xbbb7,0xaa));var _0x7bbb=function(_0x52e06c,_0x470f22){_0x52e06c=_0x52e06c-0x0;var _0x409365=_0xbbb7[_0x52e06c];return _0x409365;};'use strict';var _=require(_0x7bbb('0x0'));var util=require(_0x7bbb('0x1'));var logger=require('../../config/logger')(_0x7bbb('0x2'));var moment=require(_0x7bbb('0x3'));var BPromise=require(_0x7bbb('0x4'));var rp=require(_0x7bbb('0x5'));var fs=require('fs');var path=require(_0x7bbb('0x6'));var rimraf=require(_0x7bbb('0x7'));var config=require(_0x7bbb('0x8'));var attributes=require(_0x7bbb('0x9'));module[_0x7bbb('0xa')]=function(_0x35071f,_0x57f38a){return _0x35071f['define'](_0x7bbb('0xb'),attributes,{'tableName':'sms_queues','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 992de94..dbab3a6 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 _0xd6a0=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','error','code','message','GetSmsQueue','options','raw','where','attributes','limit','include','map','model','info','stringify','catch','ShowSmsQueue','SmsQueue','find','debug','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd6a0,0x131));var _0x0d6a=function(_0x6ade11,_0x2a272c){_0x6ade11=_0x6ade11-0x0;var _0x2d52ef=_0xd6a0[_0x6ade11];return _0x2d52ef;};'use strict';var _=require(_0x0d6a('0x0'));var util=require(_0x0d6a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0d6a('0x2'));var fs=require('fs');var Redis=require(_0x0d6a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d6a('0x4'));var logger=require(_0x0d6a('0x5'))(_0x0d6a('0x6'));var config=require(_0x0d6a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d6a('0x8')][_0x0d6a('0x9')]({'port':0x232a});config[_0x0d6a('0xa')]=_[_0x0d6a('0xb')](config[_0x0d6a('0xa')],{'host':_0x0d6a('0xc'),'port':0x18eb});var socket=require(_0x0d6a('0xd'))(new Redis(config[_0x0d6a('0xa')]));require(_0x0d6a('0xe'))[_0x0d6a('0xf')](socket);function respondWithRpcPromise(_0x552833,_0x119cf3,_0x47cbf0){return new BPromise(function(_0x121bff,_0x4a37f1){return client[_0x0d6a('0x10')](_0x552833,_0x47cbf0)[_0x0d6a('0x11')](function(_0x425bfa){logger['info'](_0x0d6a('0x12'),_0x119cf3,_0x0d6a('0x13'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x119cf3,_0x0d6a('0x13'),JSON['stringify'](_0x425bfa));if(_0x425bfa[_0x0d6a('0x14')]){if(_0x425bfa[_0x0d6a('0x14')][_0x0d6a('0x15')]===0x1f4){logger[_0x0d6a('0x14')](_0x0d6a('0x12'),_0x119cf3,_0x425bfa[_0x0d6a('0x14')][_0x0d6a('0x16')]);return _0x4a37f1(_0x425bfa[_0x0d6a('0x14')][_0x0d6a('0x16')]);}logger[_0x0d6a('0x14')](_0x0d6a('0x12'),_0x119cf3,_0x425bfa[_0x0d6a('0x14')][_0x0d6a('0x16')]);return _0x121bff(_0x425bfa[_0x0d6a('0x14')][_0x0d6a('0x16')]);}else{logger['info'](_0x0d6a('0x12'),_0x119cf3,_0x0d6a('0x13'));_0x121bff(_0x425bfa['result'][_0x0d6a('0x16')]);}})['catch'](function(_0x2c09f9){logger[_0x0d6a('0x14')](_0x0d6a('0x12'),_0x119cf3,_0x2c09f9);_0x4a37f1(_0x2c09f9);});});}exports[_0x0d6a('0x17')]=function(_0x3a80d1){var _0x50abcb=this;return new Promise(function(_0x5a66b5,_0x1c61c1){return db['SmsQueue']['findAll']({'raw':_0x3a80d1[_0x0d6a('0x18')]?_0x3a80d1[_0x0d6a('0x18')][_0x0d6a('0x19')]===undefined?!![]:![]:!![],'where':_0x3a80d1[_0x0d6a('0x18')]?_0x3a80d1[_0x0d6a('0x18')][_0x0d6a('0x1a')]||null:null,'attributes':_0x3a80d1[_0x0d6a('0x18')]?_0x3a80d1[_0x0d6a('0x18')][_0x0d6a('0x1b')]||null:null,'limit':_0x3a80d1['options']?_0x3a80d1['options'][_0x0d6a('0x1c')]||null:null,'include':_0x3a80d1[_0x0d6a('0x18')]?_0x3a80d1[_0x0d6a('0x18')][_0x0d6a('0x1d')]?_['map'](_0x3a80d1[_0x0d6a('0x18')][_0x0d6a('0x1d')],function(_0xbe2168){return{'model':db[_0xbe2168['model']],'as':_0xbe2168['as'],'attributes':_0xbe2168[_0x0d6a('0x1b')],'include':_0xbe2168[_0x0d6a('0x1d')]?_[_0x0d6a('0x1e')](_0xbe2168['include'],function(_0x29aa6c){return{'model':db[_0x29aa6c[_0x0d6a('0x1f')]],'as':_0x29aa6c['as'],'attributes':_0x29aa6c[_0x0d6a('0x1b')],'include':_0x29aa6c[_0x0d6a('0x1d')]?_[_0x0d6a('0x1e')](_0x29aa6c[_0x0d6a('0x1d')],function(_0x416a94){return{'model':db[_0x416a94[_0x0d6a('0x1f')]],'as':_0x416a94['as'],'attributes':_0x416a94[_0x0d6a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0d6a('0x11')](function(_0x9ece38){logger[_0x0d6a('0x20')]('GetSmsQueue',_0x3a80d1);logger['debug']('GetSmsQueue',_0x3a80d1,JSON[_0x0d6a('0x21')](_0x9ece38));_0x5a66b5(_0x9ece38);})[_0x0d6a('0x22')](function(_0x442f79){logger['error'](_0x0d6a('0x17'),_0x442f79['message'],_0x3a80d1);_0x1c61c1(_0x50abcb[_0x0d6a('0x14')](0x1f4,_0x442f79['message']));});});};exports[_0x0d6a('0x23')]=function(_0x49d3b9){var _0x371e8e=this;return new Promise(function(_0xfebe63,_0x34db79){return db[_0x0d6a('0x24')][_0x0d6a('0x25')]({'raw':_0x49d3b9[_0x0d6a('0x18')]?_0x49d3b9[_0x0d6a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x49d3b9[_0x0d6a('0x18')]?_0x49d3b9['options']['where']||null:null,'attributes':_0x49d3b9[_0x0d6a('0x18')]?_0x49d3b9[_0x0d6a('0x18')][_0x0d6a('0x1b')]||null:null,'include':_0x49d3b9['options']?_0x49d3b9[_0x0d6a('0x18')][_0x0d6a('0x1d')]?_['map'](_0x49d3b9[_0x0d6a('0x18')]['include'],function(_0x512b73){return{'model':db[_0x512b73[_0x0d6a('0x1f')]],'as':_0x512b73['as'],'attributes':_0x512b73[_0x0d6a('0x1b')],'include':_0x512b73[_0x0d6a('0x1d')]?_[_0x0d6a('0x1e')](_0x512b73[_0x0d6a('0x1d')],function(_0x31a45d){return{'model':db[_0x31a45d[_0x0d6a('0x1f')]],'as':_0x31a45d['as'],'attributes':_0x31a45d['attributes'],'include':_0x31a45d['include']?_[_0x0d6a('0x1e')](_0x31a45d[_0x0d6a('0x1d')],function(_0x561305){return{'model':db[_0x561305['model']],'as':_0x561305['as'],'attributes':_0x561305[_0x0d6a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0d6a('0x11')](function(_0x53d9d7){logger[_0x0d6a('0x20')](_0x0d6a('0x23'),_0x49d3b9);logger[_0x0d6a('0x26')]('ShowSmsQueue',_0x49d3b9,JSON[_0x0d6a('0x21')](_0x53d9d7));_0xfebe63(_0x53d9d7);})[_0x0d6a('0x22')](function(_0x30ef36){logger['error'](_0x0d6a('0x23'),_0x30ef36[_0x0d6a('0x16')],_0x49d3b9);_0x34db79(_0x371e8e[_0x0d6a('0x14')](0x1f4,_0x30ef36[_0x0d6a('0x16')]));});});}; \ No newline at end of file +var _0x24df=['result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsQueue,\x20%s,\x20%s'];(function(_0x5f3905,_0x43a651){var _0x2923b1=function(_0x3c72d8){while(--_0x3c72d8){_0x5f3905['push'](_0x5f3905['shift']());}};_0x2923b1(++_0x43a651);}(_0x24df,0x157));var _0xf24d=function(_0x5d008b,_0x12b7b2){_0x5d008b=_0x5d008b-0x0;var _0x381807=_0x24df[_0x5d008b];return _0x381807;};'use strict';var _=require(_0xf24d('0x0'));var util=require(_0xf24d('0x1'));var moment=require(_0xf24d('0x2'));var BPromise=require(_0xf24d('0x3'));var rs=require(_0xf24d('0x4'));var fs=require('fs');var Redis=require(_0xf24d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf24d('0x6'))(_0xf24d('0x7'));var config=require(_0xf24d('0x8'));var jayson=require(_0xf24d('0x9'));var client=jayson[_0xf24d('0xa')]['http']({'port':0x232a});config['redis']=_[_0xf24d('0xb')](config[_0xf24d('0xc')],{'host':_0xf24d('0xd'),'port':0x18eb});var socket=require(_0xf24d('0xe'))(new Redis(config[_0xf24d('0xc')]));require('./smsQueue.socket')[_0xf24d('0xf')](socket);function respondWithRpcPromise(_0x509f54,_0x27ff3a,_0x1c397e){return new BPromise(function(_0x5f4903,_0x5ddb00){return client[_0xf24d('0x10')](_0x509f54,_0x1c397e)[_0xf24d('0x11')](function(_0x280b71){logger[_0xf24d('0x12')]('SmsQueue,\x20%s,\x20%s',_0x27ff3a,_0xf24d('0x13'));logger[_0xf24d('0x14')](_0xf24d('0x15'),_0x27ff3a,_0xf24d('0x13'),JSON[_0xf24d('0x16')](_0x280b71));if(_0x280b71['error']){if(_0x280b71['error']['code']===0x1f4){logger[_0xf24d('0x17')]('SmsQueue,\x20%s,\x20%s',_0x27ff3a,_0x280b71['error'][_0xf24d('0x18')]);return _0x5ddb00(_0x280b71[_0xf24d('0x17')][_0xf24d('0x18')]);}logger[_0xf24d('0x17')](_0xf24d('0x19'),_0x27ff3a,_0x280b71['error'][_0xf24d('0x18')]);return _0x5f4903(_0x280b71[_0xf24d('0x17')][_0xf24d('0x18')]);}else{logger[_0xf24d('0x12')](_0xf24d('0x19'),_0x27ff3a,'request\x20sent');_0x5f4903(_0x280b71[_0xf24d('0x1a')][_0xf24d('0x18')]);}})[_0xf24d('0x1b')](function(_0x2e4477){logger[_0xf24d('0x17')](_0xf24d('0x19'),_0x27ff3a,_0x2e4477);_0x5ddb00(_0x2e4477);});});}exports[_0xf24d('0x1c')]=function(_0x2cfb83){var _0x338112=this;return new Promise(function(_0x347f79,_0x588fde){return db[_0xf24d('0x1d')][_0xf24d('0x1e')]({'raw':_0x2cfb83[_0xf24d('0x1f')]?_0x2cfb83[_0xf24d('0x1f')][_0xf24d('0x20')]===undefined?!![]:![]:!![],'where':_0x2cfb83['options']?_0x2cfb83['options'][_0xf24d('0x21')]||null:null,'attributes':_0x2cfb83[_0xf24d('0x1f')]?_0x2cfb83['options']['attributes']||null:null,'limit':_0x2cfb83[_0xf24d('0x1f')]?_0x2cfb83[_0xf24d('0x1f')][_0xf24d('0x22')]||null:null,'include':_0x2cfb83['options']?_0x2cfb83[_0xf24d('0x1f')][_0xf24d('0x23')]?_[_0xf24d('0x24')](_0x2cfb83[_0xf24d('0x1f')][_0xf24d('0x23')],function(_0x5f11e9){return{'model':db[_0x5f11e9[_0xf24d('0x25')]],'as':_0x5f11e9['as'],'attributes':_0x5f11e9[_0xf24d('0x26')],'include':_0x5f11e9[_0xf24d('0x23')]?_[_0xf24d('0x24')](_0x5f11e9[_0xf24d('0x23')],function(_0x4d9c25){return{'model':db[_0x4d9c25[_0xf24d('0x25')]],'as':_0x4d9c25['as'],'attributes':_0x4d9c25[_0xf24d('0x26')],'include':_0x4d9c25[_0xf24d('0x23')]?_[_0xf24d('0x24')](_0x4d9c25[_0xf24d('0x23')],function(_0x49d148){return{'model':db[_0x49d148[_0xf24d('0x25')]],'as':_0x49d148['as'],'attributes':_0x49d148[_0xf24d('0x26')]};}):[]};}):[]};}):[]:[]})[_0xf24d('0x11')](function(_0x526109){logger[_0xf24d('0x12')]('GetSmsQueue',_0x2cfb83);logger[_0xf24d('0x14')](_0xf24d('0x1c'),_0x2cfb83,JSON['stringify'](_0x526109));_0x347f79(_0x526109);})[_0xf24d('0x1b')](function(_0xaf8b23){logger[_0xf24d('0x17')](_0xf24d('0x1c'),_0xaf8b23[_0xf24d('0x18')],_0x2cfb83);_0x588fde(_0x338112['error'](0x1f4,_0xaf8b23[_0xf24d('0x18')]));});});};exports[_0xf24d('0x27')]=function(_0xe2268f){var _0x355fcc=this;return new Promise(function(_0x242f88,_0x885d09){return db[_0xf24d('0x1d')][_0xf24d('0x28')]({'raw':_0xe2268f[_0xf24d('0x1f')]?_0xe2268f['options'][_0xf24d('0x20')]===undefined?!![]:![]:!![],'where':_0xe2268f[_0xf24d('0x1f')]?_0xe2268f[_0xf24d('0x1f')]['where']||null:null,'attributes':_0xe2268f[_0xf24d('0x1f')]?_0xe2268f[_0xf24d('0x1f')][_0xf24d('0x26')]||null:null,'include':_0xe2268f[_0xf24d('0x1f')]?_0xe2268f[_0xf24d('0x1f')][_0xf24d('0x23')]?_[_0xf24d('0x24')](_0xe2268f['options'][_0xf24d('0x23')],function(_0x5094b7){return{'model':db[_0x5094b7['model']],'as':_0x5094b7['as'],'attributes':_0x5094b7[_0xf24d('0x26')],'include':_0x5094b7[_0xf24d('0x23')]?_[_0xf24d('0x24')](_0x5094b7['include'],function(_0x185b7c){return{'model':db[_0x185b7c[_0xf24d('0x25')]],'as':_0x185b7c['as'],'attributes':_0x185b7c[_0xf24d('0x26')],'include':_0x185b7c['include']?_[_0xf24d('0x24')](_0x185b7c[_0xf24d('0x23')],function(_0x1470a){return{'model':db[_0x1470a[_0xf24d('0x25')]],'as':_0x1470a['as'],'attributes':_0x1470a['attributes']};}):[]};}):[]};}):[]:[]})[_0xf24d('0x11')](function(_0xadeed0){logger['info'](_0xf24d('0x27'),_0xe2268f);logger[_0xf24d('0x14')](_0xf24d('0x27'),_0xe2268f,JSON[_0xf24d('0x16')](_0xadeed0));_0x242f88(_0xadeed0);})[_0xf24d('0x1b')](function(_0x849c43){logger[_0xf24d('0x17')](_0xf24d('0x27'),_0x849c43[_0xf24d('0x18')],_0xe2268f);_0x885d09(_0x355fcc['error'](0x1f4,_0x849c43[_0xf24d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 5e39c03..ca68765 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 _0xf85e=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf85e,0xee));var _0xef85=function(_0x17a264,_0x489c04){_0x17a264=_0x17a264-0x0;var _0x2bbbf6=_0xf85e[_0x17a264];return _0x2bbbf6;};'use strict';var SmsQueueEvents=require(_0xef85('0x0'));var events=[_0xef85('0x1'),_0xef85('0x2'),_0xef85('0x3')];function createListener(_0x28046e,_0x270131){return function(_0x38fd70){_0x270131[_0xef85('0x4')](_0x28046e,_0x38fd70);};}function removeListener(_0x371801,_0x4f29f7){return function(){SmsQueueEvents[_0xef85('0x5')](_0x371801,_0x4f29f7);};}exports[_0xef85('0x6')]=function(_0x3bd6a0){for(var _0x3aed65=0x0,_0x54e202=events[_0xef85('0x7')];_0x3aed65<_0x54e202;_0x3aed65++){var _0x1444b5=events[_0x3aed65];var _0x55efb1=createListener(_0xef85('0x8')+_0x1444b5,_0x3bd6a0);SmsQueueEvents['on'](_0x1444b5,_0x55efb1);}}; \ No newline at end of file +var _0xab08=['update','removeListener','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x28056e,_0x57e2d1){var _0x2aa80e=function(_0x40df98){while(--_0x40df98){_0x28056e['push'](_0x28056e['shift']());}};_0x2aa80e(++_0x57e2d1);}(_0xab08,0xc5));var _0x8ab0=function(_0x414c03,_0x4a93ec){_0x414c03=_0x414c03-0x0;var _0x4854ff=_0xab08[_0x414c03];return _0x4854ff;};'use strict';var SmsQueueEvents=require(_0x8ab0('0x0'));var events=[_0x8ab0('0x1'),_0x8ab0('0x2'),_0x8ab0('0x3')];function createListener(_0x263d03,_0x4c0f8f){return function(_0x116256){_0x4c0f8f['emit'](_0x263d03,_0x116256);};}function removeListener(_0x3538b0,_0x3b92cd){return function(){SmsQueueEvents[_0x8ab0('0x4')](_0x3538b0,_0x3b92cd);};}exports[_0x8ab0('0x5')]=function(_0x2c8359){for(var _0x28f381=0x0,_0x2b30aa=events[_0x8ab0('0x6')];_0x28f381<_0x2b30aa;_0x28f381++){var _0x1026e1=events[_0x28f381];var _0x4b3973=createListener(_0x8ab0('0x7')+_0x1026e1,_0x2c8359);SmsQueueEvents['on'](_0x1026e1,_0x4b3973);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 36ec6d4..7728994 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 _0x7bf4=['../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x5c5043,_0x4ad678){var _0x2dd68f=function(_0x331faa){while(--_0x331faa){_0x5c5043['push'](_0x5c5043['shift']());}};_0x2dd68f(++_0x4ad678);}(_0x7bf4,0x188));var _0x47bf=function(_0x523cbf,_0x5f30ab){_0x523cbf=_0x523cbf-0x0;var _0x363509=_0x7bf4[_0x523cbf];return _0x363509;};'use strict';var multer=require(_0x47bf('0x0'));var util=require(_0x47bf('0x1'));var path=require(_0x47bf('0x2'));var timeout=require(_0x47bf('0x3'));var express=require(_0x47bf('0x4'));var router=express[_0x47bf('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x47bf('0x6'));var config=require(_0x47bf('0x7'));var controller=require(_0x47bf('0x8'));router[_0x47bf('0x9')]('/',auth[_0x47bf('0xa')](),controller['index']);router[_0x47bf('0x9')](_0x47bf('0xb'),auth[_0x47bf('0xa')](),controller[_0x47bf('0xc')]);router['get'](_0x47bf('0xd'),auth['isAuthenticated'](),controller[_0x47bf('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x47bf('0xf')]);router[_0x47bf('0x10')](_0x47bf('0xd'),auth['isAuthenticated'](),controller[_0x47bf('0x11')]);router[_0x47bf('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x47bf('0x13')]);module[_0x47bf('0x14')]=router; \ No newline at end of file +var _0xd72c=['../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4a4cfe,_0xbe6944){var _0xc88ac1=function(_0xe4ed73){while(--_0xe4ed73){_0x4a4cfe['push'](_0x4a4cfe['shift']());}};_0xc88ac1(++_0xbe6944);}(_0xd72c,0xb0));var _0xcd72=function(_0x51ec3a,_0x3d5d7f){_0x51ec3a=_0x51ec3a-0x0;var _0xa36a2=_0xd72c[_0x51ec3a];return _0xa36a2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcd72('0x0'));var router=express[_0xcd72('0x1')]();var auth=require(_0xcd72('0x2'));var interaction=require(_0xcd72('0x3'));var config=require(_0xcd72('0x4'));var controller=require(_0xcd72('0x5'));router[_0xcd72('0x6')]('/',auth[_0xcd72('0x7')](),controller[_0xcd72('0x8')]);router[_0xcd72('0x6')](_0xcd72('0x9'),auth[_0xcd72('0x7')](),controller['describe']);router['get']('/:id',auth[_0xcd72('0x7')](),controller[_0xcd72('0xa')]);router[_0xcd72('0xb')]('/',auth['isAuthenticated'](),controller[_0xcd72('0xc')]);router[_0xcd72('0xd')](_0xcd72('0xe'),auth[_0xcd72('0x7')](),controller[_0xcd72('0xf')]);router['delete'](_0xcd72('0xe'),auth[_0xcd72('0x7')](),controller[_0xcd72('0x10')]);module[_0xcd72('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index e8a135c..799cd8f 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 _0x952c=['DATE','sequelize','STRING'];(function(_0xb73c76,_0x59963f){var _0xe37125=function(_0x1d64b7){while(--_0x1d64b7){_0xb73c76['push'](_0xb73c76['shift']());}};_0xe37125(++_0x59963f);}(_0x952c,0x1d2));var _0xc952=function(_0x2c27ed,_0x5c50f0){_0x2c27ed=_0x2c27ed-0x0;var _0x597bd1=_0x952c[_0x2c27ed];return _0x597bd1;};'use strict';var moment=require('moment');var Sequelize=require(_0xc952('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc952('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc952('0x2')]},'exitAt':{'type':Sequelize[_0xc952('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0455=['STRING','DATE','moment','sequelize','exports'];(function(_0x5dc475,_0x24fdef){var _0x1682bd=function(_0x2e36b0){while(--_0x2e36b0){_0x5dc475['push'](_0x5dc475['shift']());}};_0x1682bd(++_0x24fdef);}(_0x0455,0x17e));var _0x5045=function(_0x5d7f79,_0x3b9254){_0x5d7f79=_0x5d7f79-0x0;var _0x44d902=_0x0455[_0x5d7f79];return _0x44d902;};'use strict';var moment=require(_0x5045('0x0'));var Sequelize=require(_0x5045('0x1'));module[_0x5045('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5045('0x3')]},'joinAt':{'type':Sequelize[_0x5045('0x4')]},'leaveAt':{'type':Sequelize[_0x5045('0x4')]},'acceptAt':{'type':Sequelize[_0x5045('0x4')]},'exitAt':{'type':Sequelize[_0x5045('0x4')]},'reason':{'type':Sequelize[_0x5045('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index fa0ede1..5d94e00 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 _0xdfd1=['VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','status','end','json','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters'];(function(_0x3da2c1,_0x5534ec){var _0x53c430=function(_0x4f1e57){while(--_0x4f1e57){_0x3da2c1['push'](_0x3da2c1['shift']());}};_0x53c430(++_0x5534ec);}(_0xdfd1,0x1e4));var _0x1dfd=function(_0x3c4a2b,_0x553598){_0x3c4a2b=_0x3c4a2b-0x0;var _0x30add8=_0xdfd1[_0x3c4a2b];return _0x30add8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1dfd('0x0'));var rimraf=require(_0x1dfd('0x1'));var zipdir=require(_0x1dfd('0x2'));var jsonpatch=require(_0x1dfd('0x3'));var rp=require(_0x1dfd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1dfd('0x5'));var util=require(_0x1dfd('0x6'));var path=require(_0x1dfd('0x7'));var sox=require(_0x1dfd('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1dfd('0x9'));var squel=require(_0x1dfd('0xa'));var crypto=require(_0x1dfd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1dfd('0xc'));var toCsv=require(_0x1dfd('0xd'));var querystring=require(_0x1dfd('0xe'));var Papa=require(_0x1dfd('0xf'));var Redis=require(_0x1dfd('0x10'));var authService=require(_0x1dfd('0x11'));var qs=require(_0x1dfd('0x12'));var as=require(_0x1dfd('0x13'));var hardwareService=require(_0x1dfd('0x14'));var logger=require(_0x1dfd('0x15'))(_0x1dfd('0x16'));var utils=require(_0x1dfd('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1dfd('0x18'));var db=require(_0x1dfd('0x19'))['db'];function respondWithStatusCode(_0x82dd1f,_0x1ebbff){_0x1ebbff=_0x1ebbff||0xcc;return function(_0x373a7b){if(_0x373a7b){return _0x82dd1f[_0x1dfd('0x1a')](_0x1ebbff);}return _0x82dd1f[_0x1dfd('0x1b')](_0x1ebbff)[_0x1dfd('0x1c')]();};}function respondWithResult(_0x3decde,_0x2ea3d5){_0x2ea3d5=_0x2ea3d5||0xc8;return function(_0x30a715){if(_0x30a715){return _0x3decde[_0x1dfd('0x1b')](_0x2ea3d5)[_0x1dfd('0x1d')](_0x30a715);}};}function respondWithFilteredResult(_0x28a118,_0x4e3ed5){return function(_0x540893){if(_0x540893){var _0x210f73=_0x540893['count'],_0x434937=_0x4e3ed5[_0x1dfd('0x1e')],_0x16c6c1=_0x4e3ed5[_0x1dfd('0x1e')]+_0x4e3ed5['limit'],_0x43ed0a;if(_0x16c6c1>=_0x210f73){_0x16c6c1=_0x210f73;_0x43ed0a=0xc8;}else{_0x43ed0a=0xce;}_0x28a118[_0x1dfd('0x1b')](_0x43ed0a);return _0x28a118['set'](_0x1dfd('0x1f'),_0x434937+'-'+_0x16c6c1+'/'+_0x210f73)[_0x1dfd('0x1d')](_0x540893);}return null;};}function patchUpdates(_0x3de2df){return function(_0x4ca5f9){try{jsonpatch[_0x1dfd('0x20')](_0x4ca5f9,_0x3de2df,!![]);}catch(_0x4342a0){return BPromise[_0x1dfd('0x21')](_0x4342a0);}return _0x4ca5f9[_0x1dfd('0x22')]();};}function saveUpdates(_0x2c4a11,_0xc21776){return function(_0x43c3f1){if(_0x43c3f1){return _0x43c3f1[_0x1dfd('0x23')](_0x2c4a11)[_0x1dfd('0x24')](function(_0x132ab8){return _0x132ab8;});}return null;};}function removeEntity(_0x50f81d,_0x433848){return function(_0x2df1d4){if(_0x2df1d4){return _0x2df1d4[_0x1dfd('0x25')]()[_0x1dfd('0x24')](function(){_0x50f81d[_0x1dfd('0x1b')](0xcc)[_0x1dfd('0x1c')]();});}};}function handleEntityNotFound(_0x338db4,_0x571fa5){return function(_0x29e665){if(!_0x29e665){_0x338db4[_0x1dfd('0x1a')](0x194);}return _0x29e665;};}function handleError(_0x38a6c6,_0x4a26f0){_0x4a26f0=_0x4a26f0||0x1f4;return function(_0x1b7b06){logger[_0x1dfd('0x26')](_0x1b7b06[_0x1dfd('0x27')]);if(_0x1b7b06[_0x1dfd('0x28')]){delete _0x1b7b06[_0x1dfd('0x28')];}_0x38a6c6['status'](_0x4a26f0)['send'](_0x1b7b06);};}exports[_0x1dfd('0x29')]=function(_0x342ce5,_0x4944ed){var _0x19bb03={},_0x4f4e64={},_0x50db73={'count':0x0,'rows':[]};var _0xa1554=_[_0x1dfd('0x2a')](db[_0x1dfd('0x2b')][_0x1dfd('0x2c')],function(_0x37ac44){return{'name':_0x37ac44[_0x1dfd('0x2d')],'type':_0x37ac44[_0x1dfd('0x2e')][_0x1dfd('0x2f')]};});_0x4f4e64['model']=_[_0x1dfd('0x2a')](_0xa1554,_0x1dfd('0x28'));_0x4f4e64[_0x1dfd('0x30')]=_[_0x1dfd('0x31')](_0x342ce5['query']);_0x4f4e64['filters']=_['intersection'](_0x4f4e64['model'],_0x4f4e64[_0x1dfd('0x30')]);_0x19bb03[_0x1dfd('0x32')]=_[_0x1dfd('0x33')](_0x4f4e64[_0x1dfd('0x34')],qs[_0x1dfd('0x35')](_0x342ce5[_0x1dfd('0x30')]['fields']));_0x19bb03[_0x1dfd('0x32')]=_0x19bb03[_0x1dfd('0x32')][_0x1dfd('0x36')]?_0x19bb03[_0x1dfd('0x32')]:_0x4f4e64[_0x1dfd('0x34')];if(!_0x342ce5[_0x1dfd('0x30')][_0x1dfd('0x37')](_0x1dfd('0x38'))){_0x19bb03[_0x1dfd('0x39')]=qs[_0x1dfd('0x39')](_0x342ce5[_0x1dfd('0x30')][_0x1dfd('0x39')]);_0x19bb03[_0x1dfd('0x1e')]=qs[_0x1dfd('0x1e')](_0x342ce5['query'][_0x1dfd('0x1e')]);}_0x19bb03[_0x1dfd('0x3a')]=qs[_0x1dfd('0x3b')](_0x342ce5[_0x1dfd('0x30')][_0x1dfd('0x3b')]);_0x19bb03[_0x1dfd('0x3c')]=qs[_0x1dfd('0x3d')](_['pick'](_0x342ce5['query'],_0x4f4e64['filters']),_0xa1554);if(_0x342ce5[_0x1dfd('0x30')]['filter']){_0x19bb03[_0x1dfd('0x3c')]=_['merge'](_0x19bb03['where'],{'$or':_[_0x1dfd('0x2a')](_0xa1554,function(_0x510c8c){if(_0x510c8c['type']!==_0x1dfd('0x3e')){var _0x3a1b64={};_0x3a1b64[_0x510c8c[_0x1dfd('0x28')]]={'$like':'%'+_0x342ce5['query'][_0x1dfd('0x3f')]+'%'};return _0x3a1b64;}})});}_0x19bb03=_[_0x1dfd('0x40')]({},_0x19bb03,_0x342ce5[_0x1dfd('0x41')]);var _0xfeee3b={'where':_0x19bb03[_0x1dfd('0x3c')]};return db[_0x1dfd('0x2b')][_0x1dfd('0x42')](_0xfeee3b)[_0x1dfd('0x24')](function(_0x21b49b){_0x50db73[_0x1dfd('0x42')]=_0x21b49b;if(_0x342ce5['query'][_0x1dfd('0x43')]){_0x19bb03[_0x1dfd('0x44')]=[{'all':!![]}];}return db[_0x1dfd('0x2b')][_0x1dfd('0x45')](_0x19bb03);})[_0x1dfd('0x24')](function(_0x37790c){_0x50db73[_0x1dfd('0x46')]=_0x37790c;return _0x50db73;})[_0x1dfd('0x24')](respondWithFilteredResult(_0x4944ed,_0x19bb03))[_0x1dfd('0x47')](handleError(_0x4944ed,null));};exports[_0x1dfd('0x48')]=function(_0x3a215d,_0x1af836){var _0x420a19={'raw':!![],'where':{'id':_0x3a215d[_0x1dfd('0x49')]['id']}},_0x58e0e8={};_0x58e0e8[_0x1dfd('0x34')]=_[_0x1dfd('0x31')](db[_0x1dfd('0x2b')][_0x1dfd('0x2c')]);_0x58e0e8[_0x1dfd('0x30')]=_['keys'](_0x3a215d[_0x1dfd('0x30')]);_0x58e0e8[_0x1dfd('0x3d')]=_[_0x1dfd('0x33')](_0x58e0e8['model'],_0x58e0e8[_0x1dfd('0x30')]);_0x420a19['attributes']=_['intersection'](_0x58e0e8['model'],qs['fields'](_0x3a215d[_0x1dfd('0x30')]['fields']));_0x420a19[_0x1dfd('0x32')]=_0x420a19[_0x1dfd('0x32')]['length']?_0x420a19[_0x1dfd('0x32')]:_0x58e0e8[_0x1dfd('0x34')];if(_0x3a215d[_0x1dfd('0x30')][_0x1dfd('0x43')]){_0x420a19[_0x1dfd('0x44')]=[{'all':!![]}];}_0x420a19=_[_0x1dfd('0x40')]({},_0x420a19,_0x3a215d[_0x1dfd('0x41')]);return db['SmsQueueReport'][_0x1dfd('0x4a')](_0x420a19)[_0x1dfd('0x24')](handleEntityNotFound(_0x1af836,null))['then'](respondWithResult(_0x1af836,null))[_0x1dfd('0x47')](handleError(_0x1af836,null));};exports[_0x1dfd('0x4b')]=function(_0x185429,_0x18fb71){return db['SmsQueueReport'][_0x1dfd('0x4b')](_0x185429[_0x1dfd('0x4c')],{})['then'](respondWithResult(_0x18fb71,0xc9))['catch'](handleError(_0x18fb71,null));};exports['update']=function(_0x2147a3,_0x441eca){if(_0x2147a3['body']['id']){delete _0x2147a3[_0x1dfd('0x4c')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x2147a3[_0x1dfd('0x49')]['id']}})[_0x1dfd('0x24')](handleEntityNotFound(_0x441eca,null))[_0x1dfd('0x24')](saveUpdates(_0x2147a3[_0x1dfd('0x4c')],null))[_0x1dfd('0x24')](respondWithResult(_0x441eca,null))['catch'](handleError(_0x441eca,null));};exports['destroy']=function(_0x3132a5,_0x5492af){return db[_0x1dfd('0x2b')][_0x1dfd('0x4a')]({'where':{'id':_0x3132a5['params']['id']}})['then'](handleEntityNotFound(_0x5492af,null))[_0x1dfd('0x24')](removeEntity(_0x5492af,null))[_0x1dfd('0x47')](handleError(_0x5492af,null));};exports[_0x1dfd('0x4d')]=function(_0x4dbfdb,_0x180ab1){return db['SmsQueueReport'][_0x1dfd('0x4d')]()['then'](respondWithResult(_0x180ab1,null))['catch'](handleError(_0x180ab1,null));}; \ No newline at end of file +var _0xc43d=['Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','filter','merge','VIRTUAL','options','SmsQueueReport','includeAll','findAll','rows','show','keys','include','find','create','body','catch','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','lodash','squel','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','../../mysqldb','sendStatus','status','json','count','offset'];(function(_0x2316b9,_0x87059b){var _0x4405a9=function(_0xd9a3e1){while(--_0xd9a3e1){_0x2316b9['push'](_0x2316b9['shift']());}};_0x4405a9(++_0x87059b);}(_0xc43d,0x15e));var _0xdc43=function(_0x1778e1,_0x3e1727){_0x1778e1=_0x1778e1-0x0;var _0x2bc4c6=_0xc43d[_0x1778e1];return _0x2bc4c6;};'use strict';var pdf=require(_0xdc43('0x0'));var emlformat=require(_0xdc43('0x1'));var rimraf=require(_0xdc43('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc43('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdc43('0x4'));var Mustache=require('mustache');var util=require(_0xdc43('0x5'));var path=require(_0xdc43('0x6'));var sox=require(_0xdc43('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdc43('0x8'));var squel=require(_0xdc43('0x9'));var crypto=require(_0xdc43('0xa'));var jsforce=require(_0xdc43('0xb'));var deskjs=require(_0xdc43('0xc'));var toCsv=require(_0xdc43('0xd'));var querystring=require(_0xdc43('0xe'));var Papa=require(_0xdc43('0xf'));var Redis=require(_0xdc43('0x10'));var authService=require(_0xdc43('0x11'));var qs=require(_0xdc43('0x12'));var as=require(_0xdc43('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc43('0x14'))(_0xdc43('0x15'));var utils=require(_0xdc43('0x16'));var config=require(_0xdc43('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc43('0x18'))['db'];function respondWithStatusCode(_0x599f6f,_0x5b2b92){_0x5b2b92=_0x5b2b92||0xcc;return function(_0x949ecf){if(_0x949ecf){return _0x599f6f[_0xdc43('0x19')](_0x5b2b92);}return _0x599f6f[_0xdc43('0x1a')](_0x5b2b92)['end']();};}function respondWithResult(_0x2a9d87,_0x510a1d){_0x510a1d=_0x510a1d||0xc8;return function(_0xe3dd51){if(_0xe3dd51){return _0x2a9d87['status'](_0x510a1d)[_0xdc43('0x1b')](_0xe3dd51);}};}function respondWithFilteredResult(_0x323518,_0x397436){return function(_0x1e89bb){if(_0x1e89bb){var _0x1bd6af=_0x1e89bb[_0xdc43('0x1c')],_0x5c2995=_0x397436[_0xdc43('0x1d')],_0x3ced91=_0x397436[_0xdc43('0x1d')]+_0x397436['limit'],_0x302512;if(_0x3ced91>=_0x1bd6af){_0x3ced91=_0x1bd6af;_0x302512=0xc8;}else{_0x302512=0xce;}_0x323518[_0xdc43('0x1a')](_0x302512);return _0x323518['set'](_0xdc43('0x1e'),_0x5c2995+'-'+_0x3ced91+'/'+_0x1bd6af)[_0xdc43('0x1b')](_0x1e89bb);}return null;};}function patchUpdates(_0x21c9a5){return function(_0xc6f8){try{jsonpatch[_0xdc43('0x1f')](_0xc6f8,_0x21c9a5,!![]);}catch(_0x24ea66){return BPromise[_0xdc43('0x20')](_0x24ea66);}return _0xc6f8['save']();};}function saveUpdates(_0x30e4ed,_0x1c496b){return function(_0x29c1d9){if(_0x29c1d9){return _0x29c1d9[_0xdc43('0x21')](_0x30e4ed)[_0xdc43('0x22')](function(_0x5da939){return _0x5da939;});}return null;};}function removeEntity(_0x426bf0,_0x47266c){return function(_0x2b94d5){if(_0x2b94d5){return _0x2b94d5[_0xdc43('0x23')]()[_0xdc43('0x22')](function(){_0x426bf0[_0xdc43('0x1a')](0xcc)[_0xdc43('0x24')]();});}};}function handleEntityNotFound(_0x2d1081,_0x1fcbf9){return function(_0x48b10d){if(!_0x48b10d){_0x2d1081[_0xdc43('0x19')](0x194);}return _0x48b10d;};}function handleError(_0x56cf96,_0x52b05b){_0x52b05b=_0x52b05b||0x1f4;return function(_0x59da10){logger[_0xdc43('0x25')](_0x59da10[_0xdc43('0x26')]);if(_0x59da10[_0xdc43('0x27')]){delete _0x59da10[_0xdc43('0x27')];}_0x56cf96[_0xdc43('0x1a')](_0x52b05b)['send'](_0x59da10);};}exports[_0xdc43('0x28')]=function(_0x4ea696,_0x630aa4){var _0x387781={},_0x512db4={},_0x2fb1bc={'count':0x0,'rows':[]};var _0x58e833=_[_0xdc43('0x29')](db['SmsQueueReport'][_0xdc43('0x2a')],function(_0x50f8a6){return{'name':_0x50f8a6[_0xdc43('0x2b')],'type':_0x50f8a6[_0xdc43('0x2c')][_0xdc43('0x2d')]};});_0x512db4['model']=_['map'](_0x58e833,_0xdc43('0x27'));_0x512db4['query']=_['keys'](_0x4ea696[_0xdc43('0x2e')]);_0x512db4['filters']=_['intersection'](_0x512db4[_0xdc43('0x2f')],_0x512db4[_0xdc43('0x2e')]);_0x387781[_0xdc43('0x30')]=_[_0xdc43('0x31')](_0x512db4[_0xdc43('0x2f')],qs[_0xdc43('0x32')](_0x4ea696['query'][_0xdc43('0x32')]));_0x387781[_0xdc43('0x30')]=_0x387781[_0xdc43('0x30')][_0xdc43('0x33')]?_0x387781['attributes']:_0x512db4[_0xdc43('0x2f')];if(!_0x4ea696[_0xdc43('0x2e')][_0xdc43('0x34')](_0xdc43('0x35'))){_0x387781[_0xdc43('0x36')]=qs[_0xdc43('0x36')](_0x4ea696['query'][_0xdc43('0x36')]);_0x387781[_0xdc43('0x1d')]=qs[_0xdc43('0x1d')](_0x4ea696['query'][_0xdc43('0x1d')]);}_0x387781['order']=qs['sort'](_0x4ea696['query'][_0xdc43('0x37')]);_0x387781[_0xdc43('0x38')]=qs['filters'](_[_0xdc43('0x39')](_0x4ea696[_0xdc43('0x2e')],_0x512db4[_0xdc43('0x3a')]),_0x58e833);if(_0x4ea696['query'][_0xdc43('0x3b')]){_0x387781['where']=_[_0xdc43('0x3c')](_0x387781[_0xdc43('0x38')],{'$or':_[_0xdc43('0x29')](_0x58e833,function(_0x4ebc38){if(_0x4ebc38[_0xdc43('0x2c')]!==_0xdc43('0x3d')){var _0x52b4f6={};_0x52b4f6[_0x4ebc38['name']]={'$like':'%'+_0x4ea696[_0xdc43('0x2e')]['filter']+'%'};return _0x52b4f6;}})});}_0x387781=_[_0xdc43('0x3c')]({},_0x387781,_0x4ea696[_0xdc43('0x3e')]);var _0x525727={'where':_0x387781[_0xdc43('0x38')]};return db[_0xdc43('0x3f')][_0xdc43('0x1c')](_0x525727)[_0xdc43('0x22')](function(_0xaba281){_0x2fb1bc[_0xdc43('0x1c')]=_0xaba281;if(_0x4ea696['query'][_0xdc43('0x40')]){_0x387781['include']=[{'all':!![]}];}return db[_0xdc43('0x3f')][_0xdc43('0x41')](_0x387781);})[_0xdc43('0x22')](function(_0x7c30c9){_0x2fb1bc[_0xdc43('0x42')]=_0x7c30c9;return _0x2fb1bc;})[_0xdc43('0x22')](respondWithFilteredResult(_0x630aa4,_0x387781))['catch'](handleError(_0x630aa4,null));};exports[_0xdc43('0x43')]=function(_0x29140f,_0x17c2b4){var _0x3ff3fb={'raw':!![],'where':{'id':_0x29140f['params']['id']}},_0x46fa13={};_0x46fa13[_0xdc43('0x2f')]=_[_0xdc43('0x44')](db[_0xdc43('0x3f')][_0xdc43('0x2a')]);_0x46fa13[_0xdc43('0x2e')]=_[_0xdc43('0x44')](_0x29140f[_0xdc43('0x2e')]);_0x46fa13[_0xdc43('0x3a')]=_[_0xdc43('0x31')](_0x46fa13[_0xdc43('0x2f')],_0x46fa13[_0xdc43('0x2e')]);_0x3ff3fb[_0xdc43('0x30')]=_[_0xdc43('0x31')](_0x46fa13[_0xdc43('0x2f')],qs['fields'](_0x29140f[_0xdc43('0x2e')][_0xdc43('0x32')]));_0x3ff3fb[_0xdc43('0x30')]=_0x3ff3fb['attributes'][_0xdc43('0x33')]?_0x3ff3fb['attributes']:_0x46fa13['model'];if(_0x29140f[_0xdc43('0x2e')]['includeAll']){_0x3ff3fb[_0xdc43('0x45')]=[{'all':!![]}];}_0x3ff3fb=_[_0xdc43('0x3c')]({},_0x3ff3fb,_0x29140f[_0xdc43('0x3e')]);return db[_0xdc43('0x3f')][_0xdc43('0x46')](_0x3ff3fb)[_0xdc43('0x22')](handleEntityNotFound(_0x17c2b4,null))[_0xdc43('0x22')](respondWithResult(_0x17c2b4,null))['catch'](handleError(_0x17c2b4,null));};exports[_0xdc43('0x47')]=function(_0x2d7a93,_0x55586a){return db['SmsQueueReport'][_0xdc43('0x47')](_0x2d7a93[_0xdc43('0x48')],{})[_0xdc43('0x22')](respondWithResult(_0x55586a,0xc9))[_0xdc43('0x49')](handleError(_0x55586a,null));};exports[_0xdc43('0x21')]=function(_0x57c661,_0x46faa5){if(_0x57c661[_0xdc43('0x48')]['id']){delete _0x57c661[_0xdc43('0x48')]['id'];}return db[_0xdc43('0x3f')][_0xdc43('0x46')]({'where':{'id':_0x57c661[_0xdc43('0x4a')]['id']}})[_0xdc43('0x22')](handleEntityNotFound(_0x46faa5,null))[_0xdc43('0x22')](saveUpdates(_0x57c661[_0xdc43('0x48')],null))[_0xdc43('0x22')](respondWithResult(_0x46faa5,null))['catch'](handleError(_0x46faa5,null));};exports[_0xdc43('0x23')]=function(_0x3186ed,_0x75fd0d){return db[_0xdc43('0x3f')][_0xdc43('0x46')]({'where':{'id':_0x3186ed[_0xdc43('0x4a')]['id']}})[_0xdc43('0x22')](handleEntityNotFound(_0x75fd0d,null))['then'](removeEntity(_0x75fd0d,null))[_0xdc43('0x49')](handleError(_0x75fd0d,null));};exports[_0xdc43('0x4b')]=function(_0x1163c4,_0x37f83b){return db[_0xdc43('0x3f')][_0xdc43('0x4b')]()[_0xdc43('0x22')](respondWithResult(_0x37f83b,null))[_0xdc43('0x49')](handleError(_0x37f83b,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 1c55caa..08f488b 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 _0x4c06=['uniqueid','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','report_sms_queue'];(function(_0x2ac432,_0x34f760){var _0x50d1b2=function(_0x359514){while(--_0x359514){_0x2ac432['push'](_0x2ac432['shift']());}};_0x50d1b2(++_0x34f760);}(_0x4c06,0x9a));var _0x64c0=function(_0x185d2a,_0x308609){_0x185d2a=_0x185d2a-0x0;var _0x4dea27=_0x4c06[_0x185d2a];return _0x4dea27;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x64c0('0x0'));var moment=require(_0x64c0('0x1'));var BPromise=require(_0x64c0('0x2'));var rp=require(_0x64c0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x64c0('0x4'));var config=require(_0x64c0('0x5'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x82a4e6,_0x2b52a8){return _0x82a4e6[_0x64c0('0x6')]('SmsQueueReport',attributes,{'tableName':_0x64c0('0x7'),'paranoid':![],'indexes':[{'name':_0x64c0('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5106=['../../config/logger','moment','bluebird','rimraf','../../config/environment','./smsQueueReport.attributes','exports','uniqueid','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5106,0x116));var _0x6510=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5106[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x6510('0x0'));var util=require('util');var logger=require(_0x6510('0x1'))('api');var moment=require(_0x6510('0x2'));var BPromise=require(_0x6510('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6510('0x4'));var config=require(_0x6510('0x5'));var attributes=require(_0x6510('0x6'));module[_0x6510('0x7')]=function(_0x28cb6e,_0x2f5cb3){return _0x28cb6e['define']('SmsQueueReport',attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x6510('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index af497a1..4148808 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 _0x238f=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','debug','UpdateSmsQueueReport','update','body','where','attributes','limit','stringify','lodash','util','moment'];(function(_0x499ca5,_0x4986cf){var _0x7bfd9c=function(_0x36fe88){while(--_0x36fe88){_0x499ca5['push'](_0x499ca5['shift']());}};_0x7bfd9c(++_0x4986cf);}(_0x238f,0x66));var _0xf238=function(_0x29f229,_0x5ada66){_0x29f229=_0x29f229-0x0;var _0x27ae41=_0x238f[_0x29f229];return _0x27ae41;};'use strict';var _=require(_0xf238('0x0'));var util=require(_0xf238('0x1'));var moment=require(_0xf238('0x2'));var BPromise=require(_0xf238('0x3'));var rs=require(_0xf238('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf238('0x5'))['db'];var utils=require(_0xf238('0x6'));var logger=require(_0xf238('0x7'))(_0xf238('0x8'));var config=require(_0xf238('0x9'));var jayson=require(_0xf238('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x131c73,_0x150e9a,_0x10ebb3){return new BPromise(function(_0x316cdb,_0x1e1005){return client[_0xf238('0xb')](_0x131c73,_0x10ebb3)[_0xf238('0xc')](function(_0x49364c){logger['info'](_0xf238('0xd'),_0x150e9a,_0xf238('0xe'));logger['debug'](_0xf238('0xf'),_0x150e9a,_0xf238('0xe'),JSON['stringify'](_0x49364c));if(_0x49364c[_0xf238('0x10')]){if(_0x49364c[_0xf238('0x10')][_0xf238('0x11')]===0x1f4){logger[_0xf238('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x150e9a,_0x49364c[_0xf238('0x10')][_0xf238('0x12')]);return _0x1e1005(_0x49364c[_0xf238('0x10')][_0xf238('0x12')]);}logger[_0xf238('0x10')](_0xf238('0xd'),_0x150e9a,_0x49364c[_0xf238('0x10')]['message']);return _0x316cdb(_0x49364c[_0xf238('0x10')]['message']);}else{logger[_0xf238('0x13')](_0xf238('0xd'),_0x150e9a,_0xf238('0xe'));_0x316cdb(_0x49364c[_0xf238('0x14')][_0xf238('0x12')]);}})[_0xf238('0x15')](function(_0x2a3e10){logger[_0xf238('0x10')](_0xf238('0xd'),_0x150e9a,_0x2a3e10);_0x1e1005(_0x2a3e10);});});}exports[_0xf238('0x16')]=function(_0x26e87e){var _0xa0d2f3=this;return new Promise(function(_0x1eda38,_0x545992){return db[_0xf238('0x17')][_0xf238('0x18')](_0x26e87e['body'],{'raw':_0x26e87e[_0xf238('0x19')]?_0x26e87e[_0xf238('0x19')][_0xf238('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x164971){logger[_0xf238('0x13')](_0xf238('0x16'),_0x26e87e);logger[_0xf238('0x1b')](_0xf238('0x16'),_0x26e87e,JSON['stringify'](_0x164971));_0x1eda38(_0x164971);})[_0xf238('0x15')](function(_0x5eca38){logger[_0xf238('0x10')]('CreateSmsQueueReport',_0x5eca38[_0xf238('0x12')],_0x26e87e);_0x545992(_0xa0d2f3[_0xf238('0x10')](0x1f4,_0x5eca38['message']));});});};exports[_0xf238('0x1c')]=function(_0x8bd04b){var _0x57890f=this;return new Promise(function(_0x280680,_0x4829ae){return db[_0xf238('0x17')][_0xf238('0x1d')](_0x8bd04b[_0xf238('0x1e')],{'raw':_0x8bd04b[_0xf238('0x19')]?_0x8bd04b[_0xf238('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8bd04b[_0xf238('0x19')]?_0x8bd04b[_0xf238('0x19')][_0xf238('0x1f')]||null:null,'attributes':_0x8bd04b[_0xf238('0x19')]?_0x8bd04b['options'][_0xf238('0x20')]||null:null,'limit':_0x8bd04b[_0xf238('0x19')]?_0x8bd04b['options'][_0xf238('0x21')]||null:null})[_0xf238('0xc')](function(_0x441798){logger['info'](_0xf238('0x1c'),_0x8bd04b);logger[_0xf238('0x1b')](_0xf238('0x1c'),_0x8bd04b,JSON[_0xf238('0x22')](_0x441798));_0x280680(_0x441798);})['catch'](function(_0x5e3029){logger[_0xf238('0x10')](_0xf238('0x1c'),_0x5e3029[_0xf238('0x12')],_0x8bd04b);_0x4829ae(_0x57890f['error'](0x1f4,_0x5e3029[_0xf238('0x12')]));});});}; \ No newline at end of file +var _0x17ac=['body','options','raw','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create'];(function(_0x471c7e,_0x3b98a9){var _0x2ff35b=function(_0x1c450a){while(--_0x1c450a){_0x471c7e['push'](_0x471c7e['shift']());}};_0x2ff35b(++_0x3b98a9);}(_0x17ac,0x13a));var _0xc17a=function(_0x14bd48,_0x394393){_0x14bd48=_0x14bd48-0x0;var _0x253fa9=_0x17ac[_0x14bd48];return _0x253fa9;};'use strict';var _=require(_0xc17a('0x0'));var util=require(_0xc17a('0x1'));var moment=require(_0xc17a('0x2'));var BPromise=require('bluebird');var rs=require(_0xc17a('0x3'));var fs=require('fs');var Redis=require(_0xc17a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc17a('0x5'))(_0xc17a('0x6'));var config=require(_0xc17a('0x7'));var jayson=require(_0xc17a('0x8'));var client=jayson['client'][_0xc17a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c60e1,_0x7288ff,_0xe27d69){return new BPromise(function(_0x3a6678,_0x278227){return client[_0xc17a('0xa')](_0x1c60e1,_0xe27d69)[_0xc17a('0xb')](function(_0x1a9588){logger[_0xc17a('0xc')](_0xc17a('0xd'),_0x7288ff,_0xc17a('0xe'));logger[_0xc17a('0xf')](_0xc17a('0x10'),_0x7288ff,_0xc17a('0xe'),JSON[_0xc17a('0x11')](_0x1a9588));if(_0x1a9588[_0xc17a('0x12')]){if(_0x1a9588[_0xc17a('0x12')][_0xc17a('0x13')]===0x1f4){logger['error'](_0xc17a('0xd'),_0x7288ff,_0x1a9588['error'][_0xc17a('0x14')]);return _0x278227(_0x1a9588['error'][_0xc17a('0x14')]);}logger[_0xc17a('0x12')](_0xc17a('0xd'),_0x7288ff,_0x1a9588[_0xc17a('0x12')][_0xc17a('0x14')]);return _0x3a6678(_0x1a9588['error']['message']);}else{logger[_0xc17a('0xc')](_0xc17a('0xd'),_0x7288ff,'request\x20sent');_0x3a6678(_0x1a9588[_0xc17a('0x15')]['message']);}})[_0xc17a('0x16')](function(_0x42af85){logger[_0xc17a('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x7288ff,_0x42af85);_0x278227(_0x42af85);});});}exports[_0xc17a('0x17')]=function(_0x3bc711){var _0x4eecc9=this;return new Promise(function(_0xe3d05d,_0x357036){return db[_0xc17a('0x18')][_0xc17a('0x19')](_0x3bc711[_0xc17a('0x1a')],{'raw':_0x3bc711[_0xc17a('0x1b')]?_0x3bc711[_0xc17a('0x1b')][_0xc17a('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x53df99){logger[_0xc17a('0xc')](_0xc17a('0x17'),_0x3bc711);logger[_0xc17a('0xf')](_0xc17a('0x17'),_0x3bc711,JSON[_0xc17a('0x11')](_0x53df99));_0xe3d05d(_0x53df99);})[_0xc17a('0x16')](function(_0x1a2b38){logger[_0xc17a('0x12')](_0xc17a('0x17'),_0x1a2b38[_0xc17a('0x14')],_0x3bc711);_0x357036(_0x4eecc9[_0xc17a('0x12')](0x1f4,_0x1a2b38[_0xc17a('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x35fb04){var _0x33811d=this;return new Promise(function(_0x5a0710,_0x10b8b3){return db[_0xc17a('0x18')][_0xc17a('0x1d')](_0x35fb04[_0xc17a('0x1a')],{'raw':_0x35fb04[_0xc17a('0x1b')]?_0x35fb04[_0xc17a('0x1b')][_0xc17a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35fb04[_0xc17a('0x1b')]?_0x35fb04[_0xc17a('0x1b')][_0xc17a('0x1e')]||null:null,'attributes':_0x35fb04['options']?_0x35fb04['options'][_0xc17a('0x1f')]||null:null,'limit':_0x35fb04[_0xc17a('0x1b')]?_0x35fb04['options'][_0xc17a('0x20')]||null:null})[_0xc17a('0xb')](function(_0x44636d){logger[_0xc17a('0xc')](_0xc17a('0x21'),_0x35fb04);logger['debug']('UpdateSmsQueueReport',_0x35fb04,JSON['stringify'](_0x44636d));_0x5a0710(_0x44636d);})[_0xc17a('0x16')](function(_0x37081f){logger[_0xc17a('0x12')](_0xc17a('0x21'),_0x37081f[_0xc17a('0x14')],_0x35fb04);_0x10b8b3(_0x33811d['error'](0x1f4,_0x37081f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 49da676..813fa17 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 _0x1339=['./smsTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x1339,0x1ed));var _0x9133=function(_0x20ac67,_0x237d66){_0x20ac67=_0x20ac67-0x0;var _0x4b165e=_0x1339[_0x20ac67];return _0x4b165e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var auth=require(_0x9133('0x4'));var interaction=require(_0x9133('0x5'));var config=require(_0x9133('0x6'));var controller=require(_0x9133('0x7'));router['get']('/',auth[_0x9133('0x8')](),controller[_0x9133('0x9')]);router[_0x9133('0xa')]('/describe',auth[_0x9133('0x8')](),controller[_0x9133('0xb')]);router[_0x9133('0xa')](_0x9133('0xc'),auth[_0x9133('0x8')](),controller[_0x9133('0xd')]);router[_0x9133('0xe')]('/',auth[_0x9133('0x8')](),controller[_0x9133('0xf')]);router[_0x9133('0x10')]('/:id',auth[_0x9133('0x8')](),controller[_0x9133('0x11')]);router[_0x9133('0x12')](_0x9133('0xc'),auth[_0x9133('0x8')](),controller[_0x9133('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1775=['./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x24507a,_0x58e59b){var _0x20ed6a=function(_0x3ed6e8){while(--_0x3ed6e8){_0x24507a['push'](_0x24507a['shift']());}};_0x20ed6a(++_0x58e59b);}(_0x1775,0x1db));var _0x5177=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1775[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var auth=require(_0x5177('0x5'));var interaction=require(_0x5177('0x6'));var config=require(_0x5177('0x7'));var controller=require(_0x5177('0x8'));router[_0x5177('0x9')]('/',auth[_0x5177('0xa')](),controller[_0x5177('0xb')]);router[_0x5177('0x9')](_0x5177('0xc'),auth[_0x5177('0xa')](),controller[_0x5177('0xd')]);router[_0x5177('0x9')](_0x5177('0xe'),auth[_0x5177('0xa')](),controller[_0x5177('0xf')]);router[_0x5177('0x10')]('/',auth[_0x5177('0xa')](),controller['create']);router['put'](_0x5177('0xe'),auth[_0x5177('0xa')](),controller[_0x5177('0x11')]);router[_0x5177('0x12')](_0x5177('0xe'),auth['isAuthenticated'](),controller[_0x5177('0x13')]);module[_0x5177('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 652609f..5ba317b 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 _0x728f=['agent','queue','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x1ca040,_0x3c9f94){var _0x24ba3f=function(_0x299609){while(--_0x299609){_0x1ca040['push'](_0x1ca040['shift']());}};_0x24ba3f(++_0x3c9f94);}(_0x728f,0xd3));var _0xf728=function(_0x3a11ce,_0x3b203e){_0x3a11ce=_0x3a11ce-0x0;var _0x159267=_0x728f[_0x3a11ce];return _0x159267;};'use strict';var moment=require(_0xf728('0x0'));var Sequelize=require(_0xf728('0x1'));module[_0xf728('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf728('0x3')](_0xf728('0x4'),_0xf728('0x5'),'queue'),'allowNull':![],'defaultValue':_0xf728('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xf728('0x7')]}}; \ No newline at end of file +var _0x6388=['NOW','moment','sequelize','exports','STRING','ENUM','account','agent','queue','DATE'];(function(_0x54db44,_0xb3f985){var _0x319095=function(_0x53fb0a){while(--_0x53fb0a){_0x54db44['push'](_0x54db44['shift']());}};_0x319095(++_0xb3f985);}(_0x6388,0x123));var _0x8638=function(_0x25aff2,_0x3eb98a){_0x25aff2=_0x25aff2-0x0;var _0xceb3f8=_0x6388[_0x25aff2];return _0xceb3f8;};'use strict';var moment=require(_0x8638('0x0'));var Sequelize=require(_0x8638('0x1'));module[_0x8638('0x2')]={'uniqueid':{'type':Sequelize[_0x8638('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8638('0x4')](_0x8638('0x5'),_0x8638('0x6'),_0x8638('0x7')),'allowNull':![],'defaultValue':_0x8638('0x7')},'transferredAt':{'type':Sequelize[_0x8638('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x8638('0x9')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index dac32db..3160144 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 _0x13c0=['sendStatus','end','status','count','offset','limit','set','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','SmsTransferReport','includeAll','findAll','rows','catch','show','include','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0x13c0,0x79));var _0x013c=function(_0x2724e5,_0x229d74){_0x2724e5=_0x2724e5-0x0;var _0x4b6621=_0x13c0[_0x2724e5];return _0x4b6621;};'use strict';var pdf=require(_0x013c('0x0'));var emlformat=require(_0x013c('0x1'));var rimraf=require(_0x013c('0x2'));var zipdir=require(_0x013c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x013c('0x4'));var Mustache=require(_0x013c('0x5'));var util=require(_0x013c('0x6'));var path=require(_0x013c('0x7'));var sox=require(_0x013c('0x8'));var csv=require(_0x013c('0x9'));var ejs=require(_0x013c('0xa'));var fs=require('fs');var _=require(_0x013c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x013c('0xc'));var toCsv=require(_0x013c('0x9'));var querystring=require('querystring');var Papa=require(_0x013c('0xd'));var Redis=require(_0x013c('0xe'));var authService=require(_0x013c('0xf'));var qs=require(_0x013c('0x10'));var as=require(_0x013c('0x11'));var hardwareService=require(_0x013c('0x12'));var logger=require(_0x013c('0x13'))(_0x013c('0x14'));var utils=require(_0x013c('0x15'));var config=require(_0x013c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xce456f,_0x4631c5){_0x4631c5=_0x4631c5||0xcc;return function(_0x1ee348){if(_0x1ee348){return _0xce456f[_0x013c('0x17')](_0x4631c5);}return _0xce456f['status'](_0x4631c5)[_0x013c('0x18')]();};}function respondWithResult(_0x2313de,_0xcfe81a){_0xcfe81a=_0xcfe81a||0xc8;return function(_0x17b085){if(_0x17b085){return _0x2313de[_0x013c('0x19')](_0xcfe81a)['json'](_0x17b085);}};}function respondWithFilteredResult(_0x307f34,_0x1c2e11){return function(_0x84244){if(_0x84244){var _0x92c3ca=_0x84244[_0x013c('0x1a')],_0x1a5e16=_0x1c2e11[_0x013c('0x1b')],_0x1038d6=_0x1c2e11[_0x013c('0x1b')]+_0x1c2e11[_0x013c('0x1c')],_0x6b8b5;if(_0x1038d6>=_0x92c3ca){_0x1038d6=_0x92c3ca;_0x6b8b5=0xc8;}else{_0x6b8b5=0xce;}_0x307f34[_0x013c('0x19')](_0x6b8b5);return _0x307f34[_0x013c('0x1d')]('Content-Range',_0x1a5e16+'-'+_0x1038d6+'/'+_0x92c3ca)['json'](_0x84244);}return null;};}function patchUpdates(_0x42d0a1){return function(_0x153b0a){try{jsonpatch['apply'](_0x153b0a,_0x42d0a1,!![]);}catch(_0x260006){return BPromise[_0x013c('0x1e')](_0x260006);}return _0x153b0a[_0x013c('0x1f')]();};}function saveUpdates(_0x38bac2,_0xb87452){return function(_0x56796a){if(_0x56796a){return _0x56796a[_0x013c('0x20')](_0x38bac2)[_0x013c('0x21')](function(_0x48e6af){return _0x48e6af;});}return null;};}function removeEntity(_0x1df9d2,_0x82f9f1){return function(_0x53fbbd){if(_0x53fbbd){return _0x53fbbd['destroy']()[_0x013c('0x21')](function(){_0x1df9d2[_0x013c('0x19')](0xcc)[_0x013c('0x18')]();});}};}function handleEntityNotFound(_0x447c0b,_0x20aff2){return function(_0x2c28a7){if(!_0x2c28a7){_0x447c0b[_0x013c('0x17')](0x194);}return _0x2c28a7;};}function handleError(_0x1b9bdc,_0x4ffb6d){_0x4ffb6d=_0x4ffb6d||0x1f4;return function(_0x468fe7){logger[_0x013c('0x22')](_0x468fe7[_0x013c('0x23')]);if(_0x468fe7[_0x013c('0x24')]){delete _0x468fe7[_0x013c('0x24')];}_0x1b9bdc[_0x013c('0x19')](_0x4ffb6d)['send'](_0x468fe7);};}exports[_0x013c('0x25')]=function(_0xd85349,_0x21c86e){var _0x5f251b={},_0xa74f05={},_0x4f062f={'count':0x0,'rows':[]};var _0x395081=_[_0x013c('0x26')](db['SmsTransferReport'][_0x013c('0x27')],function(_0x32da8c){return{'name':_0x32da8c[_0x013c('0x28')],'type':_0x32da8c[_0x013c('0x29')][_0x013c('0x2a')]};});_0xa74f05[_0x013c('0x2b')]=_[_0x013c('0x26')](_0x395081,_0x013c('0x24'));_0xa74f05[_0x013c('0x2c')]=_[_0x013c('0x2d')](_0xd85349['query']);_0xa74f05[_0x013c('0x2e')]=_[_0x013c('0x2f')](_0xa74f05[_0x013c('0x2b')],_0xa74f05[_0x013c('0x2c')]);_0x5f251b[_0x013c('0x30')]=_['intersection'](_0xa74f05[_0x013c('0x2b')],qs[_0x013c('0x31')](_0xd85349[_0x013c('0x2c')][_0x013c('0x31')]));_0x5f251b['attributes']=_0x5f251b['attributes']['length']?_0x5f251b[_0x013c('0x30')]:_0xa74f05[_0x013c('0x2b')];if(!_0xd85349[_0x013c('0x2c')][_0x013c('0x32')](_0x013c('0x33'))){_0x5f251b[_0x013c('0x1c')]=qs[_0x013c('0x1c')](_0xd85349[_0x013c('0x2c')][_0x013c('0x1c')]);_0x5f251b[_0x013c('0x1b')]=qs[_0x013c('0x1b')](_0xd85349[_0x013c('0x2c')]['offset']);}_0x5f251b['order']=qs[_0x013c('0x34')](_0xd85349[_0x013c('0x2c')][_0x013c('0x34')]);_0x5f251b[_0x013c('0x35')]=qs['filters'](_[_0x013c('0x36')](_0xd85349[_0x013c('0x2c')],_0xa74f05[_0x013c('0x2e')]),_0x395081);if(_0xd85349[_0x013c('0x2c')]['filter']){_0x5f251b[_0x013c('0x35')]=_[_0x013c('0x37')](_0x5f251b['where'],{'$or':_[_0x013c('0x26')](_0x395081,function(_0x4a3565){if(_0x4a3565[_0x013c('0x29')]!==_0x013c('0x38')){var _0x447aae={};_0x447aae[_0x4a3565[_0x013c('0x24')]]={'$like':'%'+_0xd85349['query'][_0x013c('0x39')]+'%'};return _0x447aae;}})});}_0x5f251b=_[_0x013c('0x37')]({},_0x5f251b,_0xd85349[_0x013c('0x3a')]);var _0x2f6044={'where':_0x5f251b[_0x013c('0x35')]};return db[_0x013c('0x3b')][_0x013c('0x1a')](_0x2f6044)[_0x013c('0x21')](function(_0x3de22f){_0x4f062f['count']=_0x3de22f;if(_0xd85349[_0x013c('0x2c')][_0x013c('0x3c')]){_0x5f251b['include']=[{'all':!![]}];}return db[_0x013c('0x3b')][_0x013c('0x3d')](_0x5f251b);})['then'](function(_0x4212f3){_0x4f062f[_0x013c('0x3e')]=_0x4212f3;return _0x4f062f;})[_0x013c('0x21')](respondWithFilteredResult(_0x21c86e,_0x5f251b))[_0x013c('0x3f')](handleError(_0x21c86e,null));};exports[_0x013c('0x40')]=function(_0x5eb1db,_0x3d0ffd){var _0x4ea6c3={'raw':!![],'where':{'id':_0x5eb1db['params']['id']}},_0x59629e={};_0x59629e['model']=_[_0x013c('0x2d')](db[_0x013c('0x3b')][_0x013c('0x27')]);_0x59629e['query']=_[_0x013c('0x2d')](_0x5eb1db[_0x013c('0x2c')]);_0x59629e[_0x013c('0x2e')]=_[_0x013c('0x2f')](_0x59629e[_0x013c('0x2b')],_0x59629e['query']);_0x4ea6c3[_0x013c('0x30')]=_[_0x013c('0x2f')](_0x59629e['model'],qs['fields'](_0x5eb1db['query']['fields']));_0x4ea6c3[_0x013c('0x30')]=_0x4ea6c3[_0x013c('0x30')]['length']?_0x4ea6c3[_0x013c('0x30')]:_0x59629e[_0x013c('0x2b')];if(_0x5eb1db['query'][_0x013c('0x3c')]){_0x4ea6c3[_0x013c('0x41')]=[{'all':!![]}];}_0x4ea6c3=_[_0x013c('0x37')]({},_0x4ea6c3,_0x5eb1db[_0x013c('0x3a')]);return db[_0x013c('0x3b')][_0x013c('0x42')](_0x4ea6c3)[_0x013c('0x21')](handleEntityNotFound(_0x3d0ffd,null))[_0x013c('0x21')](respondWithResult(_0x3d0ffd,null))['catch'](handleError(_0x3d0ffd,null));};exports[_0x013c('0x43')]=function(_0x499f0d,_0x31fbad){return db['SmsTransferReport']['create'](_0x499f0d[_0x013c('0x44')],{})['then'](respondWithResult(_0x31fbad,0xc9))[_0x013c('0x3f')](handleError(_0x31fbad,null));};exports[_0x013c('0x20')]=function(_0x3352c3,_0x29e8c6){if(_0x3352c3['body']['id']){delete _0x3352c3['body']['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x3352c3[_0x013c('0x45')]['id']}})['then'](handleEntityNotFound(_0x29e8c6,null))[_0x013c('0x21')](saveUpdates(_0x3352c3[_0x013c('0x44')],null))[_0x013c('0x21')](respondWithResult(_0x29e8c6,null))[_0x013c('0x3f')](handleError(_0x29e8c6,null));};exports[_0x013c('0x46')]=function(_0x2e99db,_0x2ef3ec){return db[_0x013c('0x3b')][_0x013c('0x42')]({'where':{'id':_0x2e99db['params']['id']}})[_0x013c('0x21')](handleEntityNotFound(_0x2ef3ec,null))['then'](removeEntity(_0x2ef3ec,null))['catch'](handleError(_0x2ef3ec,null));};exports[_0x013c('0x47')]=function(_0x5f2b11,_0x551433){return db[_0x013c('0x3b')][_0x013c('0x47')]()['then'](respondWithResult(_0x551433,null))[_0x013c('0x3f')](handleError(_0x551433,null));}; \ No newline at end of file +var _0x3df4=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','includeAll','rows','catch','show','params','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring'];(function(_0x16cfdd,_0x4ac2ee){var _0x2bfa65=function(_0x5c1156){while(--_0x5c1156){_0x16cfdd['push'](_0x16cfdd['shift']());}};_0x2bfa65(++_0x4ac2ee);}(_0x3df4,0x102));var _0x43df=function(_0x3ec0e2,_0x5d09a3){_0x3ec0e2=_0x3ec0e2-0x0;var _0x34ec43=_0x3df4[_0x3ec0e2];return _0x34ec43;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x43df('0x0'));var zipdir=require(_0x43df('0x1'));var jsonpatch=require(_0x43df('0x2'));var rp=require(_0x43df('0x3'));var moment=require(_0x43df('0x4'));var BPromise=require(_0x43df('0x5'));var Mustache=require(_0x43df('0x6'));var util=require('util');var path=require('path');var sox=require(_0x43df('0x7'));var csv=require(_0x43df('0x8'));var ejs=require(_0x43df('0x9'));var fs=require('fs');var _=require(_0x43df('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43df('0xb'));var deskjs=require(_0x43df('0xc'));var toCsv=require(_0x43df('0x8'));var querystring=require(_0x43df('0xd'));var Papa=require('papaparse');var Redis=require(_0x43df('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x43df('0xf'));var as=require(_0x43df('0x10'));var hardwareService=require(_0x43df('0x11'));var logger=require(_0x43df('0x12'))(_0x43df('0x13'));var utils=require(_0x43df('0x14'));var config=require(_0x43df('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x43df('0x16'))['db'];function respondWithStatusCode(_0x1140a9,_0x592a64){_0x592a64=_0x592a64||0xcc;return function(_0x14df5c){if(_0x14df5c){return _0x1140a9['sendStatus'](_0x592a64);}return _0x1140a9[_0x43df('0x17')](_0x592a64)[_0x43df('0x18')]();};}function respondWithResult(_0x4c4105,_0x3cbca1){_0x3cbca1=_0x3cbca1||0xc8;return function(_0x549159){if(_0x549159){return _0x4c4105['status'](_0x3cbca1)[_0x43df('0x19')](_0x549159);}};}function respondWithFilteredResult(_0x3748f2,_0x5c00d9){return function(_0x24f026){if(_0x24f026){var _0x592c70=_0x24f026[_0x43df('0x1a')],_0x3bed20=_0x5c00d9[_0x43df('0x1b')],_0x54965f=_0x5c00d9[_0x43df('0x1b')]+_0x5c00d9['limit'],_0x14b258;if(_0x54965f>=_0x592c70){_0x54965f=_0x592c70;_0x14b258=0xc8;}else{_0x14b258=0xce;}_0x3748f2[_0x43df('0x17')](_0x14b258);return _0x3748f2[_0x43df('0x1c')](_0x43df('0x1d'),_0x3bed20+'-'+_0x54965f+'/'+_0x592c70)[_0x43df('0x19')](_0x24f026);}return null;};}function patchUpdates(_0x591441){return function(_0x22314c){try{jsonpatch[_0x43df('0x1e')](_0x22314c,_0x591441,!![]);}catch(_0x121786){return BPromise['reject'](_0x121786);}return _0x22314c['save']();};}function saveUpdates(_0x4303c5,_0x18e382){return function(_0x5a521f){if(_0x5a521f){return _0x5a521f[_0x43df('0x1f')](_0x4303c5)[_0x43df('0x20')](function(_0x43085e){return _0x43085e;});}return null;};}function removeEntity(_0x5c1cfc,_0x3b44d8){return function(_0x493e2c){if(_0x493e2c){return _0x493e2c[_0x43df('0x21')]()['then'](function(){_0x5c1cfc[_0x43df('0x17')](0xcc)[_0x43df('0x18')]();});}};}function handleEntityNotFound(_0xbb793b,_0x4d05c9){return function(_0x228afb){if(!_0x228afb){_0xbb793b['sendStatus'](0x194);}return _0x228afb;};}function handleError(_0x252bcb,_0x2e3e5a){_0x2e3e5a=_0x2e3e5a||0x1f4;return function(_0xda44f3){logger[_0x43df('0x22')](_0xda44f3[_0x43df('0x23')]);if(_0xda44f3[_0x43df('0x24')]){delete _0xda44f3[_0x43df('0x24')];}_0x252bcb[_0x43df('0x17')](_0x2e3e5a)[_0x43df('0x25')](_0xda44f3);};}exports[_0x43df('0x26')]=function(_0x2aa723,_0x4ade02){var _0x38f9b8={},_0x2555ad={},_0x5afab5={'count':0x0,'rows':[]};var _0x29f984=_[_0x43df('0x27')](db[_0x43df('0x28')][_0x43df('0x29')],function(_0xcc74c7){return{'name':_0xcc74c7[_0x43df('0x2a')],'type':_0xcc74c7['type']['key']};});_0x2555ad[_0x43df('0x2b')]=_[_0x43df('0x27')](_0x29f984,_0x43df('0x24'));_0x2555ad[_0x43df('0x2c')]=_[_0x43df('0x2d')](_0x2aa723['query']);_0x2555ad[_0x43df('0x2e')]=_[_0x43df('0x2f')](_0x2555ad[_0x43df('0x2b')],_0x2555ad[_0x43df('0x2c')]);_0x38f9b8[_0x43df('0x30')]=_[_0x43df('0x2f')](_0x2555ad[_0x43df('0x2b')],qs[_0x43df('0x31')](_0x2aa723[_0x43df('0x2c')][_0x43df('0x31')]));_0x38f9b8[_0x43df('0x30')]=_0x38f9b8[_0x43df('0x30')][_0x43df('0x32')]?_0x38f9b8[_0x43df('0x30')]:_0x2555ad['model'];if(!_0x2aa723['query'][_0x43df('0x33')]('nolimit')){_0x38f9b8[_0x43df('0x34')]=qs[_0x43df('0x34')](_0x2aa723[_0x43df('0x2c')][_0x43df('0x34')]);_0x38f9b8['offset']=qs[_0x43df('0x1b')](_0x2aa723[_0x43df('0x2c')][_0x43df('0x1b')]);}_0x38f9b8['order']=qs[_0x43df('0x35')](_0x2aa723[_0x43df('0x2c')][_0x43df('0x35')]);_0x38f9b8[_0x43df('0x36')]=qs['filters'](_[_0x43df('0x37')](_0x2aa723[_0x43df('0x2c')],_0x2555ad[_0x43df('0x2e')]),_0x29f984);if(_0x2aa723[_0x43df('0x2c')][_0x43df('0x38')]){_0x38f9b8[_0x43df('0x36')]=_['merge'](_0x38f9b8['where'],{'$or':_[_0x43df('0x27')](_0x29f984,function(_0x599760){if(_0x599760['type']!=='VIRTUAL'){var _0x58577f={};_0x58577f[_0x599760[_0x43df('0x24')]]={'$like':'%'+_0x2aa723[_0x43df('0x2c')][_0x43df('0x38')]+'%'};return _0x58577f;}})});}_0x38f9b8=_[_0x43df('0x39')]({},_0x38f9b8,_0x2aa723['options']);var _0x3d8aad={'where':_0x38f9b8[_0x43df('0x36')]};return db['SmsTransferReport'][_0x43df('0x1a')](_0x3d8aad)[_0x43df('0x20')](function(_0xed9f0d){_0x5afab5[_0x43df('0x1a')]=_0xed9f0d;if(_0x2aa723[_0x43df('0x2c')][_0x43df('0x3a')]){_0x38f9b8['include']=[{'all':!![]}];}return db[_0x43df('0x28')]['findAll'](_0x38f9b8);})['then'](function(_0x250b08){_0x5afab5[_0x43df('0x3b')]=_0x250b08;return _0x5afab5;})[_0x43df('0x20')](respondWithFilteredResult(_0x4ade02,_0x38f9b8))[_0x43df('0x3c')](handleError(_0x4ade02,null));};exports[_0x43df('0x3d')]=function(_0x35ca53,_0x50a37d){var _0x134025={'raw':!![],'where':{'id':_0x35ca53[_0x43df('0x3e')]['id']}},_0x250505={};_0x250505[_0x43df('0x2b')]=_[_0x43df('0x2d')](db[_0x43df('0x28')]['rawAttributes']);_0x250505[_0x43df('0x2c')]=_['keys'](_0x35ca53[_0x43df('0x2c')]);_0x250505[_0x43df('0x2e')]=_['intersection'](_0x250505[_0x43df('0x2b')],_0x250505[_0x43df('0x2c')]);_0x134025[_0x43df('0x30')]=_[_0x43df('0x2f')](_0x250505[_0x43df('0x2b')],qs[_0x43df('0x31')](_0x35ca53[_0x43df('0x2c')][_0x43df('0x31')]));_0x134025[_0x43df('0x30')]=_0x134025[_0x43df('0x30')]['length']?_0x134025[_0x43df('0x30')]:_0x250505['model'];if(_0x35ca53['query'][_0x43df('0x3a')]){_0x134025[_0x43df('0x3f')]=[{'all':!![]}];}_0x134025=_[_0x43df('0x39')]({},_0x134025,_0x35ca53['options']);return db[_0x43df('0x28')][_0x43df('0x40')](_0x134025)[_0x43df('0x20')](handleEntityNotFound(_0x50a37d,null))[_0x43df('0x20')](respondWithResult(_0x50a37d,null))[_0x43df('0x3c')](handleError(_0x50a37d,null));};exports[_0x43df('0x41')]=function(_0x4555fd,_0x198715){return db[_0x43df('0x28')][_0x43df('0x41')](_0x4555fd[_0x43df('0x42')],{})['then'](respondWithResult(_0x198715,0xc9))[_0x43df('0x3c')](handleError(_0x198715,null));};exports['update']=function(_0x1d7c77,_0x3b6125){if(_0x1d7c77['body']['id']){delete _0x1d7c77[_0x43df('0x42')]['id'];}return db['SmsTransferReport'][_0x43df('0x40')]({'where':{'id':_0x1d7c77['params']['id']}})[_0x43df('0x20')](handleEntityNotFound(_0x3b6125,null))[_0x43df('0x20')](saveUpdates(_0x1d7c77[_0x43df('0x42')],null))[_0x43df('0x20')](respondWithResult(_0x3b6125,null))['catch'](handleError(_0x3b6125,null));};exports[_0x43df('0x21')]=function(_0x10d596,_0xbd636){return db['SmsTransferReport']['find']({'where':{'id':_0x10d596[_0x43df('0x3e')]['id']}})[_0x43df('0x20')](handleEntityNotFound(_0xbd636,null))[_0x43df('0x20')](removeEntity(_0xbd636,null))['catch'](handleError(_0xbd636,null));};exports[_0x43df('0x43')]=function(_0x28fadd,_0x257248){return db[_0x43df('0x28')][_0x43df('0x43')]()[_0x43df('0x20')](respondWithResult(_0x257248,null))[_0x43df('0x3c')](handleError(_0x257248,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 4d3195e..970224c 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 _0x82c4=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsTransferReport.attributes','define'];(function(_0x328428,_0x215933){var _0x4cfa3d=function(_0x35a1a6){while(--_0x35a1a6){_0x328428['push'](_0x328428['shift']());}};_0x4cfa3d(++_0x215933);}(_0x82c4,0x1ca));var _0x482c=function(_0x3def55,_0x53ce57){_0x3def55=_0x3def55-0x0;var _0xf4cb7d=_0x82c4[_0x3def55];return _0xf4cb7d;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[{'name':_0x482c('0xc'),'fields':[_0x482c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x627e=['path','rimraf','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x512bfd,_0x40a463){var _0x144f65=function(_0x2b523c){while(--_0x2b523c){_0x512bfd['push'](_0x512bfd['shift']());}};_0x144f65(++_0x40a463);}(_0x627e,0x14a));var _0xe627=function(_0x2a259c,_0x3ab4fa){_0x2a259c=_0x2a259c-0x0;var _0x4f1420=_0x627e[_0x2a259c];return _0x4f1420;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var logger=require(_0xe627('0x2'))(_0xe627('0x3'));var moment=require(_0xe627('0x4'));var BPromise=require('bluebird');var rp=require(_0xe627('0x5'));var fs=require('fs');var path=require(_0xe627('0x6'));var rimraf=require(_0xe627('0x7'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x1a1a3d,_0x3f2791){return _0x1a1a3d[_0xe627('0x8')](_0xe627('0x9'),attributes,{'tableName':_0xe627('0xa'),'paranoid':![],'indexes':[{'name':_0xe627('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 6fb3c3c..8b8e434 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 _0x9978=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','code','error','message','SmsTransferReport,\x20%s,\x20%s','result','catch'];(function(_0x2e9515,_0x5c76b6){var _0x187fca=function(_0x28943){while(--_0x28943){_0x2e9515['push'](_0x2e9515['shift']());}};_0x187fca(++_0x5c76b6);}(_0x9978,0x176));var _0x8997=function(_0x3e7265,_0x935c3c){_0x3e7265=_0x3e7265-0x0;var _0x2fc9da=_0x9978[_0x3e7265];return _0x2fc9da;};'use strict';var _=require('lodash');var util=require(_0x8997('0x0'));var moment=require(_0x8997('0x1'));var BPromise=require(_0x8997('0x2'));var rs=require(_0x8997('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8997('0x4'))['db'];var utils=require(_0x8997('0x5'));var logger=require(_0x8997('0x6'))(_0x8997('0x7'));var config=require(_0x8997('0x8'));var jayson=require(_0x8997('0x9'));var client=jayson[_0x8997('0xa')][_0x8997('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x584833,_0x3b3651,_0x4c9687){return new BPromise(function(_0x5cbb79,_0x44c539){return client[_0x8997('0xc')](_0x584833,_0x4c9687)['then'](function(_0x4a87cb){logger[_0x8997('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x3b3651,_0x8997('0xe'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3b3651,_0x8997('0xe'),JSON[_0x8997('0xf')](_0x4a87cb));if(_0x4a87cb['error']){if(_0x4a87cb['error'][_0x8997('0x10')]===0x1f4){logger[_0x8997('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x3b3651,_0x4a87cb[_0x8997('0x11')][_0x8997('0x12')]);return _0x44c539(_0x4a87cb['error']['message']);}logger[_0x8997('0x11')](_0x8997('0x13'),_0x3b3651,_0x4a87cb['error']['message']);return _0x5cbb79(_0x4a87cb[_0x8997('0x11')][_0x8997('0x12')]);}else{logger[_0x8997('0xd')](_0x8997('0x13'),_0x3b3651,_0x8997('0xe'));_0x5cbb79(_0x4a87cb[_0x8997('0x14')][_0x8997('0x12')]);}})[_0x8997('0x15')](function(_0x3321ce){logger[_0x8997('0x11')](_0x8997('0x13'),_0x3b3651,_0x3321ce);_0x44c539(_0x3321ce);});});} \ No newline at end of file +var _0x9637=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x6b1c9e,_0x322a1){var _0x4fb0d5=function(_0x3770bd){while(--_0x3770bd){_0x6b1c9e['push'](_0x6b1c9e['shift']());}};_0x4fb0d5(++_0x322a1);}(_0x9637,0xc9));var _0x7963=function(_0x17b110,_0x4dd74a){_0x17b110=_0x17b110-0x0;var _0x59a055=_0x9637[_0x17b110];return _0x59a055;};'use strict';var _=require(_0x7963('0x0'));var util=require(_0x7963('0x1'));var moment=require(_0x7963('0x2'));var BPromise=require(_0x7963('0x3'));var rs=require(_0x7963('0x4'));var fs=require('fs');var Redis=require(_0x7963('0x5'));var db=require(_0x7963('0x6'))['db'];var utils=require(_0x7963('0x7'));var logger=require('../../config/logger')(_0x7963('0x8'));var config=require(_0x7963('0x9'));var jayson=require(_0x7963('0xa'));var client=jayson[_0x7963('0xb')][_0x7963('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22c9de,_0x3559df,_0x5b1f9d){return new BPromise(function(_0x3eec0a,_0x5a0db6){return client['request'](_0x22c9de,_0x5b1f9d)[_0x7963('0xd')](function(_0x113cc4){logger[_0x7963('0xe')](_0x7963('0xf'),_0x3559df,_0x7963('0x10'));logger['debug'](_0x7963('0x11'),_0x3559df,_0x7963('0x10'),JSON['stringify'](_0x113cc4));if(_0x113cc4[_0x7963('0x12')]){if(_0x113cc4[_0x7963('0x12')][_0x7963('0x13')]===0x1f4){logger[_0x7963('0x12')](_0x7963('0xf'),_0x3559df,_0x113cc4[_0x7963('0x12')][_0x7963('0x14')]);return _0x5a0db6(_0x113cc4[_0x7963('0x12')][_0x7963('0x14')]);}logger[_0x7963('0x12')](_0x7963('0xf'),_0x3559df,_0x113cc4[_0x7963('0x12')]['message']);return _0x3eec0a(_0x113cc4[_0x7963('0x12')][_0x7963('0x14')]);}else{logger['info'](_0x7963('0xf'),_0x3559df,'request\x20sent');_0x3eec0a(_0x113cc4['result'][_0x7963('0x14')]);}})[_0x7963('0x15')](function(_0x540bcf){logger['error'](_0x7963('0xf'),_0x3559df,_0x540bcf);_0x5a0db6(_0x540bcf);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 04e780a..17937f8 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 _0xeeee=['server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xeeee,0x72));var _0xeeee=function(_0x26004d,_0x41a35c){_0x26004d=_0x26004d-0x0;var _0x3147ff=_0xeeee[_0x26004d];return _0x3147ff;};'use strict';var multer=require(_0xeeee('0x0'));var util=require(_0xeeee('0x1'));var path=require(_0xeeee('0x2'));var timeout=require(_0xeeee('0x3'));var express=require(_0xeeee('0x4'));var router=express[_0xeeee('0x5')]();var auth=require(_0xeeee('0x6'));var interaction=require(_0xeeee('0x7'));var config=require('../../config/environment');var controller=require(_0xeeee('0x8'));router[_0xeeee('0x9')]('/',auth['isAuthenticated'](),controller[_0xeeee('0xa')]);router[_0xeeee('0x9')](_0xeeee('0xb'),auth[_0xeeee('0xc')](),controller[_0xeeee('0xd')]);router[_0xeeee('0x9')](_0xeeee('0xe'),auth[_0xeeee('0xc')](),controller['download']);var upload=multer({'storage':multer[_0xeeee('0xf')]({'destination':function(_0x2dea1c,_0x16e75c,_0x2f1c72){_0x2f1c72(null,path[_0xeeee('0x10')](config[_0xeeee('0x11')],_0xeeee('0x12')));},'filename':function(_0x2380d9,_0x4f9523,_0x16bd6e){_0x4f9523[_0xeeee('0x13')]=_0x4f9523[_0xeeee('0x13')][_0xeeee('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x16bd6e(null,util[_0xeeee('0x15')](_0xeeee('0x16'),path[_0xeeee('0x17')](_0x4f9523[_0xeeee('0x13')],path[_0xeeee('0x18')](_0x4f9523[_0xeeee('0x13')])),Date[_0xeeee('0x19')](),path[_0xeeee('0x18')](_0x4f9523[_0xeeee('0x13')])));}})});router[_0xeeee('0x1a')]('/',upload[_0xeeee('0x1b')](_0xeeee('0x1c')),controller[_0xeeee('0x1d')]);router[_0xeeee('0x1e')](_0xeeee('0xb'),auth[_0xeeee('0xc')](),controller['update']);router[_0xeeee('0x1f')](_0xeeee('0xb'),auth[_0xeeee('0xc')](),controller[_0xeeee('0x1f')]);module[_0xeeee('0x20')]=router; \ No newline at end of file +var _0x9df2=['show','/:id/download','download','diskStorage','join','root','originalname','replace','format','basename','now','post','single','file','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index'];(function(_0x4c9f76,_0x5e0403){var _0x551afe=function(_0x1a3d2a){while(--_0x1a3d2a){_0x4c9f76['push'](_0x4c9f76['shift']());}};_0x551afe(++_0x5e0403);}(_0x9df2,0x10c));var _0x29df=function(_0x3633e3,_0x20ce4b){_0x3633e3=_0x3633e3-0x0;var _0x5cdbfe=_0x9df2[_0x3633e3];return _0x5cdbfe;};'use strict';var multer=require(_0x29df('0x0'));var util=require('util');var path=require(_0x29df('0x1'));var timeout=require(_0x29df('0x2'));var express=require(_0x29df('0x3'));var router=express[_0x29df('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x29df('0x5'));var config=require(_0x29df('0x6'));var controller=require(_0x29df('0x7'));router[_0x29df('0x8')]('/',auth[_0x29df('0x9')](),controller[_0x29df('0xa')]);router[_0x29df('0x8')]('/:id',auth[_0x29df('0x9')](),controller[_0x29df('0xb')]);router['get'](_0x29df('0xc'),auth[_0x29df('0x9')](),controller[_0x29df('0xd')]);var upload=multer({'storage':multer[_0x29df('0xe')]({'destination':function(_0xf50281,_0x1a65d8,_0x59fe13){_0x59fe13(null,path[_0x29df('0xf')](config[_0x29df('0x10')],'server/files/sounds/original/'));},'filename':function(_0x3c79cb,_0x1c7346,_0x50d068){_0x1c7346[_0x29df('0x11')]=_0x1c7346[_0x29df('0x11')][_0x29df('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x50d068(null,util[_0x29df('0x13')]('%s-%s%s',path[_0x29df('0x14')](_0x1c7346['originalname'],path['extname'](_0x1c7346['originalname'])),Date[_0x29df('0x15')](),path['extname'](_0x1c7346['originalname'])));}})});router[_0x29df('0x16')]('/',upload[_0x29df('0x17')](_0x29df('0x18')),controller[_0x29df('0x19')]);router[_0x29df('0x1a')](_0x29df('0x1b'),auth[_0x29df('0x9')](),controller[_0x29df('0x1c')]);router[_0x29df('0x1d')](_0x29df('0x1b'),auth['isAuthenticated'](),controller[_0x29df('0x1d')]);module[_0x29df('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index cbb29f2..a1980f1 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 _0xbfb0=['INTEGER','BIGINT','FLOAT','exports','name','STRING'];(function(_0x29a5e8,_0x3511bc){var _0x28513b=function(_0x4647b4){while(--_0x4647b4){_0x29a5e8['push'](_0x29a5e8['shift']());}};_0x28513b(++_0x3511bc);}(_0xbfb0,0x1d1));var _0x0bfb=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xbfb0[_0x4e9628];return _0x27bc8c;};'use strict';var Sequelize=require('sequelize');module[_0x0bfb('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x0bfb('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x0bfb('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x0bfb('0x2')]},'original_format':{'type':Sequelize[_0x0bfb('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x0bfb('0x3')]},'original_bitRate':{'type':Sequelize[_0x0bfb('0x4')]},'original_sampleRate':{'type':Sequelize[_0x0bfb('0x3')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x0bfb('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x0bfb('0x4')]},'converted_channelCount':{'type':Sequelize[_0x0bfb('0x3')]},'converted_bitRate':{'type':Sequelize[_0x0bfb('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x0bfb('0x3')]}}; \ No newline at end of file +var _0x2aa6=['name','STRING','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x5d86e9,_0x4e8dfa){var _0x34e352=function(_0xa2cb58){while(--_0xa2cb58){_0x5d86e9['push'](_0x5d86e9['shift']());}};_0x34e352(++_0x4e8dfa);}(_0x2aa6,0x67));var _0x62aa=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0x2aa6[_0x45313f];return _0x402910;};'use strict';var Sequelize=require(_0x62aa('0x0'));module[_0x62aa('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x62aa('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x62aa('0x3')]},'display_name':{'type':Sequelize[_0x62aa('0x3')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x62aa('0x4')]},'original_sampleCount':{'type':Sequelize[_0x62aa('0x5')]},'original_channelCount':{'type':Sequelize[_0x62aa('0x6')]},'original_bitRate':{'type':Sequelize[_0x62aa('0x5')]},'original_sampleRate':{'type':Sequelize[_0x62aa('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x62aa('0x5')]},'converted_channelCount':{'type':Sequelize[_0x62aa('0x6')]},'converted_bitRate':{'type':Sequelize[_0x62aa('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x62aa('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 9899a70..f11a08f 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 _0x98c8=['Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','original_duration','duration','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','userProfileId','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Sounds','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','VIRTUAL','includeAll','findAll','rows','show','params','include','merge','options','find','catch','existsSync','join','root','server/files/sounds/converted','save_name','converted_format','Sequelize','ValidationError'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x98c8,0xa5));var _0x898c=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x98c8[_0x618414];return _0x21c19a;};'use strict';var pdf=require(_0x898c('0x0'));var emlformat=require(_0x898c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x898c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x898c('0x3'));var moment=require(_0x898c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x898c('0x5'));var util=require(_0x898c('0x6'));var path=require(_0x898c('0x7'));var sox=require('sox');var csv=require(_0x898c('0x8'));var ejs=require(_0x898c('0x9'));var fs=require('fs');var _=require(_0x898c('0xa'));var squel=require('squel');var crypto=require(_0x898c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x898c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x898c('0xd'));var Redis=require(_0x898c('0xe'));var authService=require(_0x898c('0xf'));var qs=require(_0x898c('0x10'));var as=require(_0x898c('0x11'));var hardwareService=require(_0x898c('0x12'));var logger=require(_0x898c('0x13'))(_0x898c('0x14'));var utils=require(_0x898c('0x15'));var config=require(_0x898c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x898c('0x17'))['db'];function respondWithStatusCode(_0xc57139,_0x275c76){_0x275c76=_0x275c76||0xcc;return function(_0x16e15d){if(_0x16e15d){return _0xc57139[_0x898c('0x18')](_0x275c76);}return _0xc57139[_0x898c('0x19')](_0x275c76)[_0x898c('0x1a')]();};}function respondWithResult(_0x2b37c7,_0x4a8eac){_0x4a8eac=_0x4a8eac||0xc8;return function(_0x2af29f){if(_0x2af29f){return _0x2b37c7[_0x898c('0x19')](_0x4a8eac)[_0x898c('0x1b')](_0x2af29f);}};}function respondWithFilteredResult(_0xe19cb4,_0x250ab4){return function(_0x8759e1){if(_0x8759e1){var _0x180d19=_0x8759e1[_0x898c('0x1c')],_0x488555=_0x250ab4[_0x898c('0x1d')],_0x250c6f=_0x250ab4[_0x898c('0x1d')]+_0x250ab4['limit'],_0x3512e9;if(_0x250c6f>=_0x180d19){_0x250c6f=_0x180d19;_0x3512e9=0xc8;}else{_0x3512e9=0xce;}_0xe19cb4['status'](_0x3512e9);return _0xe19cb4[_0x898c('0x1e')](_0x898c('0x1f'),_0x488555+'-'+_0x250c6f+'/'+_0x180d19)['json'](_0x8759e1);}return null;};}function patchUpdates(_0x2a28f6){return function(_0x4e4102){try{jsonpatch[_0x898c('0x20')](_0x4e4102,_0x2a28f6,!![]);}catch(_0x176b60){return BPromise[_0x898c('0x21')](_0x176b60);}return _0x4e4102['save']();};}function saveUpdates(_0x48a0f1,_0x551277){return function(_0x4a9042){if(_0x4a9042){return _0x4a9042[_0x898c('0x22')](_0x48a0f1)[_0x898c('0x23')](function(_0x52aae5){return _0x52aae5;});}return null;};}function removeEntity(_0x440eb8,_0x188500){return function(_0x24002a){if(_0x24002a){return _0x24002a[_0x898c('0x24')]()['then'](function(){var _0x5092f4=_0x24002a[_0x898c('0x25')]({'plain':!![]});var _0x386d4d=_0x898c('0x26');return db['UserProfileResource'][_0x898c('0x24')]({'where':{'type':_0x386d4d,'resourceId':_0x5092f4['id']}})['then'](function(){return _0x24002a;});})[_0x898c('0x23')](function(){_0x440eb8[_0x898c('0x19')](0xcc)[_0x898c('0x1a')]();});}};}function handleEntityNotFound(_0x4a1b72,_0x1b7569){return function(_0x1e0bcf){if(!_0x1e0bcf){_0x4a1b72[_0x898c('0x18')](0x194);}return _0x1e0bcf;};}function handleError(_0x360e28,_0x14c997){_0x14c997=_0x14c997||0x1f4;return function(_0x4ac2ab){logger['error'](_0x4ac2ab[_0x898c('0x27')]);if(_0x4ac2ab[_0x898c('0x28')]){delete _0x4ac2ab[_0x898c('0x28')];}_0x360e28[_0x898c('0x19')](_0x14c997)[_0x898c('0x29')](_0x4ac2ab);};}exports[_0x898c('0x2a')]=function(_0x1febc6,_0x51d883){var _0x3b25fa={},_0xf81ca6={},_0x695d5d={'count':0x0,'rows':[]};var _0x17a586=_['map'](db[_0x898c('0x2b')][_0x898c('0x2c')],function(_0x164890){return{'name':_0x164890[_0x898c('0x2d')],'type':_0x164890[_0x898c('0x2e')][_0x898c('0x2f')]};});_0xf81ca6[_0x898c('0x30')]=_[_0x898c('0x31')](_0x17a586,_0x898c('0x28'));_0xf81ca6[_0x898c('0x32')]=_[_0x898c('0x33')](_0x1febc6[_0x898c('0x32')]);_0xf81ca6[_0x898c('0x34')]=_[_0x898c('0x35')](_0xf81ca6['model'],_0xf81ca6['query']);_0x3b25fa[_0x898c('0x36')]=_[_0x898c('0x35')](_0xf81ca6[_0x898c('0x30')],qs[_0x898c('0x37')](_0x1febc6[_0x898c('0x32')]['fields']));_0x3b25fa['attributes']=_0x3b25fa[_0x898c('0x36')][_0x898c('0x38')]?_0x3b25fa['attributes']:_0xf81ca6[_0x898c('0x30')];if(!_0x1febc6[_0x898c('0x32')]['hasOwnProperty'](_0x898c('0x39'))){_0x3b25fa[_0x898c('0x3a')]=qs[_0x898c('0x3a')](_0x1febc6[_0x898c('0x32')][_0x898c('0x3a')]);_0x3b25fa[_0x898c('0x1d')]=qs[_0x898c('0x1d')](_0x1febc6[_0x898c('0x32')][_0x898c('0x1d')]);}_0x3b25fa[_0x898c('0x3b')]=qs['sort'](_0x1febc6[_0x898c('0x32')][_0x898c('0x3c')]);_0x3b25fa[_0x898c('0x3d')]=qs[_0x898c('0x34')](_['pick'](_0x1febc6[_0x898c('0x32')],_0xf81ca6[_0x898c('0x34')]),_0x17a586);if(_0x1febc6['query']['filter']){_0x3b25fa[_0x898c('0x3d')]=_['merge'](_0x3b25fa[_0x898c('0x3d')],{'$or':_[_0x898c('0x31')](_0x17a586,function(_0x1dd890){if(_0x1dd890[_0x898c('0x2e')]!==_0x898c('0x3e')){var _0x42bbf5={};_0x42bbf5[_0x1dd890[_0x898c('0x28')]]={'$like':'%'+_0x1febc6[_0x898c('0x32')]['filter']+'%'};return _0x42bbf5;}})});}_0x3b25fa=_['merge']({},_0x3b25fa,_0x1febc6['options']);var _0x582b62={'where':_0x3b25fa['where']};return db['Sound'][_0x898c('0x1c')](_0x582b62)[_0x898c('0x23')](function(_0x138b7b){_0x695d5d['count']=_0x138b7b;if(_0x1febc6['query'][_0x898c('0x3f')]){_0x3b25fa['include']=[{'all':!![]}];}return db[_0x898c('0x2b')][_0x898c('0x40')](_0x3b25fa);})[_0x898c('0x23')](function(_0x36699d){_0x695d5d[_0x898c('0x41')]=_0x36699d;return _0x695d5d;})['then'](respondWithFilteredResult(_0x51d883,_0x3b25fa))['catch'](handleError(_0x51d883,null));};exports[_0x898c('0x42')]=function(_0x1ea111,_0x19187f){var _0x28c7de={'raw':!![],'where':{'id':_0x1ea111[_0x898c('0x43')]['id']}},_0x25f3b5={};_0x25f3b5[_0x898c('0x30')]=_[_0x898c('0x33')](db['Sound'][_0x898c('0x2c')]);_0x25f3b5[_0x898c('0x32')]=_[_0x898c('0x33')](_0x1ea111['query']);_0x25f3b5[_0x898c('0x34')]=_['intersection'](_0x25f3b5[_0x898c('0x30')],_0x25f3b5['query']);_0x28c7de[_0x898c('0x36')]=_['intersection'](_0x25f3b5[_0x898c('0x30')],qs[_0x898c('0x37')](_0x1ea111[_0x898c('0x32')][_0x898c('0x37')]));_0x28c7de['attributes']=_0x28c7de[_0x898c('0x36')][_0x898c('0x38')]?_0x28c7de['attributes']:_0x25f3b5[_0x898c('0x30')];if(_0x1ea111['query'][_0x898c('0x3f')]){_0x28c7de[_0x898c('0x44')]=[{'all':!![]}];}_0x28c7de=_[_0x898c('0x45')]({},_0x28c7de,_0x1ea111[_0x898c('0x46')]);return db[_0x898c('0x2b')][_0x898c('0x47')](_0x28c7de)[_0x898c('0x23')](handleEntityNotFound(_0x19187f,null))[_0x898c('0x23')](respondWithResult(_0x19187f,null))[_0x898c('0x48')](handleError(_0x19187f,null));};exports['download']=function(_0x3ec796,_0x4bcc38,_0x132384){return db[_0x898c('0x2b')]['find']({'where':{'id':_0x3ec796['params']['id']},'attributes':[_0x898c('0x28'),'save_name','converted_format'],'raw':!![]})[_0x898c('0x23')](handleEntityNotFound(_0x4bcc38,null))[_0x898c('0x23')](function(_0x57297c){if(_0x57297c){if(!fs[_0x898c('0x49')](path[_0x898c('0x4a')](config[_0x898c('0x4b')],_0x898c('0x4c'),_0x57297c[_0x898c('0x4d')]+'.'+_0x57297c[_0x898c('0x4e')]))){throw new db[(_0x898c('0x4f'))][(_0x898c('0x50'))](_0x898c('0x51'));}return _0x4bcc38['download'](path[_0x898c('0x4a')](config[_0x898c('0x4b')],_0x898c('0x4c'),util[_0x898c('0x52')]('%s.%s',_0x57297c['save_name'],_0x57297c[_0x898c('0x4e')])),util['format'](_0x898c('0x53'),_0x57297c['name'],_0x57297c[_0x898c('0x4e')]));}return null;})[_0x898c('0x48')](handleError(_0x4bcc38,null));};exports[_0x898c('0x54')]=function(_0x4ded56,_0x3b2654,_0x4e0086){var _0x13da45={'name':path[_0x898c('0x55')](_0x4ded56[_0x898c('0x56')][_0x898c('0x57')],path[_0x898c('0x58')](_0x4ded56[_0x898c('0x56')][_0x898c('0x57')])),'save_name':path[_0x898c('0x55')](_0x4ded56[_0x898c('0x56')]['filename'],path[_0x898c('0x58')](_0x4ded56['file'][_0x898c('0x59')])),'original_format':path['extname'](_0x4ded56['file'][_0x898c('0x57')])['substring'](0x1),'converted_format':_0x898c('0x5a')};var _0x5af8c6=path['join'](config[_0x898c('0x4b')],_0x898c('0x5b'),_0x4ded56['file']['filename']);var _0x23b922=path[_0x898c('0x4a')](config['root'],_0x898c('0x4c'),util['format'](_0x898c('0x53'),path[_0x898c('0x55')](_0x4ded56[_0x898c('0x56')][_0x898c('0x59')],path['extname'](_0x4ded56[_0x898c('0x56')][_0x898c('0x59')])),_0x13da45[_0x898c('0x4e')]));logger['info'](_0x898c('0x5c'),_0x5af8c6);logger[_0x898c('0x5d')](_0x898c('0x5e'),_0x23b922);try{fs[_0x898c('0x5f')](_0x5af8c6,parseInt(_0x898c('0x60'),0x8));var _0x40eeea=sox[_0x898c('0x61')](_0x5af8c6,_0x23b922,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x40eeea['on'](_0x898c('0x62'),function(_0x2a9953){fs[_0x898c('0x63')](_0x5af8c6);_0x3b2654[_0x898c('0x19')](0x1f4)['send'](_0x2a9953);});_0x40eeea['on']('src',function(_0x53e7c4){_0x13da45[_0x898c('0x64')]=isNaN(_0x53e7c4['duration'])?null:_0x53e7c4[_0x898c('0x65')]*0x3e8;_0x13da45['original_sampleCount']=isNaN(_0x53e7c4[_0x898c('0x66')])?null:_0x53e7c4['sampleCount'];_0x13da45[_0x898c('0x67')]=isNaN(_0x53e7c4[_0x898c('0x68')])?null:_0x53e7c4['channelCount'];_0x13da45['original_bitRate']=isNaN(_0x53e7c4[_0x898c('0x69')])?null:_0x53e7c4[_0x898c('0x69')];_0x13da45[_0x898c('0x6a')]=isNaN(_0x53e7c4[_0x898c('0x6b')])?null:_0x53e7c4[_0x898c('0x6b')];});_0x40eeea['on'](_0x898c('0x6c'),function(_0x1f99f1){_0x13da45[_0x898c('0x6d')]=isNaN(_0x1f99f1['duration'])?null:_0x1f99f1['duration']*0x3e8;_0x13da45['converted_sampleCount']=isNaN(_0x1f99f1['sampleCount'])?null:_0x1f99f1[_0x898c('0x66')];_0x13da45[_0x898c('0x6e')]=isNaN(_0x1f99f1[_0x898c('0x68')])?null:_0x1f99f1[_0x898c('0x68')];_0x13da45[_0x898c('0x6f')]=isNaN(_0x1f99f1['bitRate'])?null:_0x1f99f1['bitRate'];_0x13da45[_0x898c('0x70')]=isNaN(_0x1f99f1[_0x898c('0x6b')])?null:_0x1f99f1[_0x898c('0x6b')];});_0x40eeea['on'](_0x898c('0x1a'),function(){fs[_0x898c('0x5f')](_0x23b922,parseInt(_0x898c('0x60'),0x8));return db[_0x898c('0x2b')]['create'](_0x13da45)[_0x898c('0x23')](function(_0x4e278d){var _0x4a91e8={'role':_0x4ded56[_0x898c('0x71')]['role'],'userProfileId':_0x4ded56[_0x898c('0x71')][_0x898c('0x72')]};if(!_0x4a91e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a91e8[_0x898c('0x73')]===_0x898c('0x74')){var _0x4886d9=_0x4e278d[_0x898c('0x25')]({'plain':!![]});return db[_0x898c('0x75')]['find']({'where':{'name':_0x898c('0x26'),'userProfileId':_0x4a91e8[_0x898c('0x72')]},'raw':!![]})[_0x898c('0x23')](function(_0x1199eb){if(_0x1199eb&&_0x1199eb[_0x898c('0x76')]===0x0){return db[_0x898c('0x77')]['create']({'name':_0x4886d9[_0x898c('0x28')],'resourceId':_0x4886d9['id'],'type':_0x1199eb[_0x898c('0x28')],'sectionId':_0x1199eb['id']},{})[_0x898c('0x23')](function(){return _0x4e278d;});}else{return _0x4e278d;}})['catch'](function(_0x28dc65){logger[_0x898c('0x62')](_0x898c('0x78'),_0x28dc65);throw _0x28dc65;});}return _0x4e278d;})[_0x898c('0x23')](respondWithResult(_0x3b2654,null))[_0x898c('0x48')](handleError(_0x3b2654,null));});_0x40eeea['start']();}catch(_0x450328){_0x3b2654[_0x898c('0x19')](0x1f4)[_0x898c('0x29')](_0x450328);}};exports[_0x898c('0x22')]=function(_0x430f73,_0x12535d,_0x1342ea){return db[_0x898c('0x2b')][_0x898c('0x47')]({'where':{'id':_0x430f73[_0x898c('0x43')]['id']}})[_0x898c('0x23')](handleEntityNotFound(_0x12535d,null))[_0x898c('0x23')](saveUpdates(_['pick'](_0x430f73['body'],[_0x898c('0x28'),_0x898c('0x79')]),null))['then'](respondWithResult(_0x12535d,null))[_0x898c('0x48')](handleError(_0x12535d,null));};exports[_0x898c('0x7a')]=function(_0x41c743,_0x308f19,_0xd8f91b){return db[_0x898c('0x2b')]['find']({'where':{'id':_0x41c743[_0x898c('0x43')]['id']}})[_0x898c('0x23')](function(_0x18f328){if(_0x18f328){return _0x18f328[_0x898c('0x24')]();}})['then'](function(_0x2c047e){var _0x177a88=path[_0x898c('0x4a')](config['root'],_0x898c('0x5b'),util[_0x898c('0x52')](_0x898c('0x53'),_0x2c047e[_0x898c('0x4d')],_0x2c047e['original_format']));var _0x17ff86=path[_0x898c('0x4a')](config['root'],_0x898c('0x4c'),util['format']('%s.%s',_0x2c047e[_0x898c('0x4d')],_0x2c047e[_0x898c('0x4e')]));fs[_0x898c('0x63')](_0x177a88);fs[_0x898c('0x63')](_0x17ff86);return _0x2c047e;})['then'](function(_0x50766d){if(_0x50766d){return _0x308f19['status'](0xcc)[_0x898c('0x1a')]();}})[_0x898c('0x23')](handleEntityNotFound(_0x308f19,null))['catch'](handleError(_0x308f19,null));}; \ No newline at end of file +var _0x66b5=['src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','role','body','userProfileId','UserProfileSection','Sounds','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','Sound','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','include','findAll','rows','catch','show','params','keys','length','includeAll','options','find','download','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','originalname','extname','basename','file','filename','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x66b5,0x10e));var _0x566b=function(_0x1fb24f,_0x371e89){_0x1fb24f=_0x1fb24f-0x0;var _0x410609=_0x66b5[_0x1fb24f];return _0x410609;};'use strict';var pdf=require(_0x566b('0x0'));var emlformat=require(_0x566b('0x1'));var rimraf=require(_0x566b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x566b('0x3'));var rp=require('request-promise');var moment=require(_0x566b('0x4'));var BPromise=require(_0x566b('0x5'));var Mustache=require(_0x566b('0x6'));var util=require(_0x566b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x566b('0x8'));var ejs=require(_0x566b('0x9'));var fs=require('fs');var _=require(_0x566b('0xa'));var squel=require(_0x566b('0xb'));var crypto=require(_0x566b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x566b('0xd'));var toCsv=require(_0x566b('0x8'));var querystring=require(_0x566b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x566b('0xf'));var as=require(_0x566b('0x10'));var hardwareService=require(_0x566b('0x11'));var logger=require('../../config/logger')(_0x566b('0x12'));var utils=require(_0x566b('0x13'));var config=require(_0x566b('0x14'));var licenseUtil=require(_0x566b('0x15'));var db=require(_0x566b('0x16'))['db'];function respondWithStatusCode(_0x4d91a3,_0x51b15f){_0x51b15f=_0x51b15f||0xcc;return function(_0x5f047d){if(_0x5f047d){return _0x4d91a3[_0x566b('0x17')](_0x51b15f);}return _0x4d91a3[_0x566b('0x18')](_0x51b15f)['end']();};}function respondWithResult(_0x1b60ca,_0x4b1e63){_0x4b1e63=_0x4b1e63||0xc8;return function(_0x4a4815){if(_0x4a4815){return _0x1b60ca['status'](_0x4b1e63)[_0x566b('0x19')](_0x4a4815);}};}function respondWithFilteredResult(_0x970282,_0x50aa3a){return function(_0x28058e){if(_0x28058e){var _0xb88f9e=_0x28058e[_0x566b('0x1a')],_0x501b12=_0x50aa3a[_0x566b('0x1b')],_0x43aaeb=_0x50aa3a[_0x566b('0x1b')]+_0x50aa3a[_0x566b('0x1c')],_0xc07e32;if(_0x43aaeb>=_0xb88f9e){_0x43aaeb=_0xb88f9e;_0xc07e32=0xc8;}else{_0xc07e32=0xce;}_0x970282[_0x566b('0x18')](_0xc07e32);return _0x970282['set'](_0x566b('0x1d'),_0x501b12+'-'+_0x43aaeb+'/'+_0xb88f9e)[_0x566b('0x19')](_0x28058e);}return null;};}function patchUpdates(_0x3ad473){return function(_0x295d43){try{jsonpatch[_0x566b('0x1e')](_0x295d43,_0x3ad473,!![]);}catch(_0x9c9e42){return BPromise[_0x566b('0x1f')](_0x9c9e42);}return _0x295d43['save']();};}function saveUpdates(_0x467357,_0x599fe7){return function(_0x196915){if(_0x196915){return _0x196915[_0x566b('0x20')](_0x467357)[_0x566b('0x21')](function(_0x520ae2){return _0x520ae2;});}return null;};}function removeEntity(_0x1b295d,_0x57be6b){return function(_0x2fb882){if(_0x2fb882){return _0x2fb882[_0x566b('0x22')]()[_0x566b('0x21')](function(){var _0x59e002=_0x2fb882['get']({'plain':!![]});var _0x3502b0='Sounds';return db['UserProfileResource'][_0x566b('0x22')]({'where':{'type':_0x3502b0,'resourceId':_0x59e002['id']}})[_0x566b('0x21')](function(){return _0x2fb882;});})['then'](function(){_0x1b295d[_0x566b('0x18')](0xcc)[_0x566b('0x23')]();});}};}function handleEntityNotFound(_0x1fc4bc,_0x3485e8){return function(_0x198e6a){if(!_0x198e6a){_0x1fc4bc[_0x566b('0x17')](0x194);}return _0x198e6a;};}function handleError(_0x8dd974,_0x57a8fa){_0x57a8fa=_0x57a8fa||0x1f4;return function(_0x304f5a){logger[_0x566b('0x24')](_0x304f5a[_0x566b('0x25')]);if(_0x304f5a[_0x566b('0x26')]){delete _0x304f5a[_0x566b('0x26')];}_0x8dd974[_0x566b('0x18')](_0x57a8fa)['send'](_0x304f5a);};}exports[_0x566b('0x27')]=function(_0x300221,_0x41a0dd){var _0x35975e={},_0x486e02={},_0x32c5a1={'count':0x0,'rows':[]};var _0x2c9aa8=_['map'](db[_0x566b('0x28')][_0x566b('0x29')],function(_0x4134a1){return{'name':_0x4134a1['fieldName'],'type':_0x4134a1['type'][_0x566b('0x2a')]};});_0x486e02[_0x566b('0x2b')]=_['map'](_0x2c9aa8,_0x566b('0x26'));_0x486e02[_0x566b('0x2c')]=_['keys'](_0x300221[_0x566b('0x2c')]);_0x486e02[_0x566b('0x2d')]=_[_0x566b('0x2e')](_0x486e02['model'],_0x486e02[_0x566b('0x2c')]);_0x35975e[_0x566b('0x2f')]=_['intersection'](_0x486e02[_0x566b('0x2b')],qs[_0x566b('0x30')](_0x300221[_0x566b('0x2c')][_0x566b('0x30')]));_0x35975e[_0x566b('0x2f')]=_0x35975e[_0x566b('0x2f')]['length']?_0x35975e[_0x566b('0x2f')]:_0x486e02[_0x566b('0x2b')];if(!_0x300221[_0x566b('0x2c')][_0x566b('0x31')]('nolimit')){_0x35975e[_0x566b('0x1c')]=qs[_0x566b('0x1c')](_0x300221[_0x566b('0x2c')][_0x566b('0x1c')]);_0x35975e['offset']=qs['offset'](_0x300221[_0x566b('0x2c')][_0x566b('0x1b')]);}_0x35975e[_0x566b('0x32')]=qs[_0x566b('0x33')](_0x300221[_0x566b('0x2c')][_0x566b('0x33')]);_0x35975e[_0x566b('0x34')]=qs[_0x566b('0x2d')](_[_0x566b('0x35')](_0x300221['query'],_0x486e02[_0x566b('0x2d')]),_0x2c9aa8);if(_0x300221[_0x566b('0x2c')][_0x566b('0x36')]){_0x35975e[_0x566b('0x34')]=_[_0x566b('0x37')](_0x35975e['where'],{'$or':_[_0x566b('0x38')](_0x2c9aa8,function(_0x102ce1){if(_0x102ce1[_0x566b('0x39')]!==_0x566b('0x3a')){var _0x444372={};_0x444372[_0x102ce1[_0x566b('0x26')]]={'$like':'%'+_0x300221[_0x566b('0x2c')]['filter']+'%'};return _0x444372;}})});}_0x35975e=_['merge']({},_0x35975e,_0x300221['options']);var _0x50f71d={'where':_0x35975e[_0x566b('0x34')]};return db[_0x566b('0x28')][_0x566b('0x1a')](_0x50f71d)[_0x566b('0x21')](function(_0x44d534){_0x32c5a1[_0x566b('0x1a')]=_0x44d534;if(_0x300221[_0x566b('0x2c')]['includeAll']){_0x35975e[_0x566b('0x3b')]=[{'all':!![]}];}return db[_0x566b('0x28')][_0x566b('0x3c')](_0x35975e);})[_0x566b('0x21')](function(_0xea14f1){_0x32c5a1[_0x566b('0x3d')]=_0xea14f1;return _0x32c5a1;})[_0x566b('0x21')](respondWithFilteredResult(_0x41a0dd,_0x35975e))[_0x566b('0x3e')](handleError(_0x41a0dd,null));};exports[_0x566b('0x3f')]=function(_0x50a82f,_0x4505a9){var _0x3e6d27={'raw':!![],'where':{'id':_0x50a82f[_0x566b('0x40')]['id']}},_0x4aad1f={};_0x4aad1f[_0x566b('0x2b')]=_['keys'](db['Sound'][_0x566b('0x29')]);_0x4aad1f[_0x566b('0x2c')]=_[_0x566b('0x41')](_0x50a82f[_0x566b('0x2c')]);_0x4aad1f[_0x566b('0x2d')]=_[_0x566b('0x2e')](_0x4aad1f[_0x566b('0x2b')],_0x4aad1f[_0x566b('0x2c')]);_0x3e6d27[_0x566b('0x2f')]=_[_0x566b('0x2e')](_0x4aad1f[_0x566b('0x2b')],qs[_0x566b('0x30')](_0x50a82f[_0x566b('0x2c')][_0x566b('0x30')]));_0x3e6d27[_0x566b('0x2f')]=_0x3e6d27[_0x566b('0x2f')][_0x566b('0x42')]?_0x3e6d27[_0x566b('0x2f')]:_0x4aad1f[_0x566b('0x2b')];if(_0x50a82f['query'][_0x566b('0x43')]){_0x3e6d27[_0x566b('0x3b')]=[{'all':!![]}];}_0x3e6d27=_[_0x566b('0x37')]({},_0x3e6d27,_0x50a82f[_0x566b('0x44')]);return db[_0x566b('0x28')][_0x566b('0x45')](_0x3e6d27)[_0x566b('0x21')](handleEntityNotFound(_0x4505a9,null))['then'](respondWithResult(_0x4505a9,null))[_0x566b('0x3e')](handleError(_0x4505a9,null));};exports[_0x566b('0x46')]=function(_0x314fd4,_0x2df3e0,_0x2cd1e0){return db[_0x566b('0x28')][_0x566b('0x45')]({'where':{'id':_0x314fd4['params']['id']},'attributes':[_0x566b('0x26'),'save_name',_0x566b('0x47')],'raw':!![]})[_0x566b('0x21')](handleEntityNotFound(_0x2df3e0,null))[_0x566b('0x21')](function(_0x28c1ec){if(_0x28c1ec){if(!fs[_0x566b('0x48')](path[_0x566b('0x49')](config[_0x566b('0x4a')],_0x566b('0x4b'),_0x28c1ec[_0x566b('0x4c')]+'.'+_0x28c1ec[_0x566b('0x47')]))){throw new db[(_0x566b('0x4d'))][(_0x566b('0x4e'))](_0x566b('0x4f'));}return _0x2df3e0[_0x566b('0x46')](path['join'](config[_0x566b('0x4a')],_0x566b('0x4b'),util[_0x566b('0x50')](_0x566b('0x51'),_0x28c1ec['save_name'],_0x28c1ec[_0x566b('0x47')])),util[_0x566b('0x50')](_0x566b('0x51'),_0x28c1ec[_0x566b('0x26')],_0x28c1ec[_0x566b('0x47')]));}return null;})[_0x566b('0x3e')](handleError(_0x2df3e0,null));};exports[_0x566b('0x52')]=function(_0x17da78,_0x1f0581,_0x2e2328){var _0x2df0ed={'name':path['basename'](_0x17da78['file'][_0x566b('0x53')],path[_0x566b('0x54')](_0x17da78['file']['originalname'])),'save_name':path[_0x566b('0x55')](_0x17da78[_0x566b('0x56')]['filename'],path[_0x566b('0x54')](_0x17da78[_0x566b('0x56')][_0x566b('0x57')])),'original_format':path['extname'](_0x17da78[_0x566b('0x56')][_0x566b('0x53')])['substring'](0x1),'converted_format':'wav'};var _0x36beb9=path['join'](config[_0x566b('0x4a')],_0x566b('0x58'),_0x17da78[_0x566b('0x56')]['filename']);var _0x516f56=path[_0x566b('0x49')](config[_0x566b('0x4a')],'server/files/sounds/converted',util['format'](_0x566b('0x51'),path['basename'](_0x17da78['file'][_0x566b('0x57')],path[_0x566b('0x54')](_0x17da78[_0x566b('0x56')][_0x566b('0x57')])),_0x2df0ed['converted_format']));logger[_0x566b('0x59')](_0x566b('0x5a'),_0x36beb9);logger[_0x566b('0x59')](_0x566b('0x5b'),_0x516f56);try{fs[_0x566b('0x5c')](_0x36beb9,parseInt('0777',0x8));var _0x1876ba=sox[_0x566b('0x5d')](_0x36beb9,_0x516f56,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1876ba['on'](_0x566b('0x24'),function(_0x8eed13){fs[_0x566b('0x5e')](_0x36beb9);_0x1f0581[_0x566b('0x18')](0x1f4)[_0x566b('0x5f')](_0x8eed13);});_0x1876ba['on'](_0x566b('0x60'),function(_0x11dd0f){_0x2df0ed[_0x566b('0x61')]=isNaN(_0x11dd0f[_0x566b('0x62')])?null:_0x11dd0f[_0x566b('0x62')]*0x3e8;_0x2df0ed['original_sampleCount']=isNaN(_0x11dd0f['sampleCount'])?null:_0x11dd0f[_0x566b('0x63')];_0x2df0ed[_0x566b('0x64')]=isNaN(_0x11dd0f[_0x566b('0x65')])?null:_0x11dd0f['channelCount'];_0x2df0ed[_0x566b('0x66')]=isNaN(_0x11dd0f['bitRate'])?null:_0x11dd0f[_0x566b('0x67')];_0x2df0ed[_0x566b('0x68')]=isNaN(_0x11dd0f[_0x566b('0x69')])?null:_0x11dd0f[_0x566b('0x69')];});_0x1876ba['on'](_0x566b('0x6a'),function(_0x3c82e6){_0x2df0ed[_0x566b('0x6b')]=isNaN(_0x3c82e6[_0x566b('0x62')])?null:_0x3c82e6[_0x566b('0x62')]*0x3e8;_0x2df0ed['converted_sampleCount']=isNaN(_0x3c82e6['sampleCount'])?null:_0x3c82e6['sampleCount'];_0x2df0ed[_0x566b('0x6c')]=isNaN(_0x3c82e6[_0x566b('0x65')])?null:_0x3c82e6[_0x566b('0x65')];_0x2df0ed[_0x566b('0x6d')]=isNaN(_0x3c82e6[_0x566b('0x67')])?null:_0x3c82e6['bitRate'];_0x2df0ed[_0x566b('0x6e')]=isNaN(_0x3c82e6[_0x566b('0x69')])?null:_0x3c82e6['sampleRate'];});_0x1876ba['on'](_0x566b('0x23'),function(){fs['chmodSync'](_0x516f56,parseInt('0777',0x8));return db[_0x566b('0x28')][_0x566b('0x52')](_0x2df0ed)[_0x566b('0x21')](function(_0x52054a){var _0x5b4c0c={'role':_0x17da78['body'][_0x566b('0x6f')],'userProfileId':_0x17da78[_0x566b('0x70')][_0x566b('0x71')]};if(!_0x5b4c0c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b4c0c[_0x566b('0x6f')]==='user'){var _0x1741ab=_0x52054a['get']({'plain':!![]});return db[_0x566b('0x72')][_0x566b('0x45')]({'where':{'name':_0x566b('0x73'),'userProfileId':_0x5b4c0c['userProfileId']},'raw':!![]})[_0x566b('0x21')](function(_0x4754e8){if(_0x4754e8&&_0x4754e8['autoAssociation']===0x0){return db[_0x566b('0x74')][_0x566b('0x52')]({'name':_0x1741ab[_0x566b('0x26')],'resourceId':_0x1741ab['id'],'type':_0x4754e8['name'],'sectionId':_0x4754e8['id']},{})[_0x566b('0x21')](function(){return _0x52054a;});}else{return _0x52054a;}})[_0x566b('0x3e')](function(_0xee90c){logger[_0x566b('0x24')](_0x566b('0x75'),_0xee90c);throw _0xee90c;});}return _0x52054a;})[_0x566b('0x21')](respondWithResult(_0x1f0581,null))['catch'](handleError(_0x1f0581,null));});_0x1876ba[_0x566b('0x76')]();}catch(_0x228af8){_0x1f0581[_0x566b('0x18')](0x1f4)[_0x566b('0x5f')](_0x228af8);}};exports[_0x566b('0x20')]=function(_0x3ea5c7,_0x29c41d,_0x392be4){return db[_0x566b('0x28')][_0x566b('0x45')]({'where':{'id':_0x3ea5c7[_0x566b('0x40')]['id']}})[_0x566b('0x21')](handleEntityNotFound(_0x29c41d,null))[_0x566b('0x21')](saveUpdates(_[_0x566b('0x35')](_0x3ea5c7[_0x566b('0x70')],[_0x566b('0x26'),_0x566b('0x77')]),null))[_0x566b('0x21')](respondWithResult(_0x29c41d,null))[_0x566b('0x3e')](handleError(_0x29c41d,null));};exports[_0x566b('0x78')]=function(_0xa94d0a,_0x41893d,_0x192f8a){return db[_0x566b('0x28')][_0x566b('0x45')]({'where':{'id':_0xa94d0a[_0x566b('0x40')]['id']}})[_0x566b('0x21')](function(_0x2c1c66){if(_0x2c1c66){return _0x2c1c66[_0x566b('0x22')]();}})[_0x566b('0x21')](function(_0x519e60){var _0x1ea773=path['join'](config[_0x566b('0x4a')],_0x566b('0x58'),util[_0x566b('0x50')](_0x566b('0x51'),_0x519e60[_0x566b('0x4c')],_0x519e60[_0x566b('0x79')]));var _0x50e6b7=path['join'](config[_0x566b('0x4a')],_0x566b('0x4b'),util[_0x566b('0x50')](_0x566b('0x51'),_0x519e60[_0x566b('0x4c')],_0x519e60[_0x566b('0x47')]));fs[_0x566b('0x5e')](_0x1ea773);fs['unlinkSync'](_0x50e6b7);return _0x519e60;})[_0x566b('0x21')](function(_0x43e2f6){if(_0x43e2f6){return _0x41893d[_0x566b('0x18')](0xcc)[_0x566b('0x23')]();}})['then'](handleEntityNotFound(_0x41893d,null))[_0x566b('0x3e')](handleError(_0x41893d,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 9e8b50d..6330fdf 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 _0xfdd3=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./sound.attributes','exports','define','Sound','lodash'];(function(_0x32efcb,_0x55523f){var _0x1dae88=function(_0x11c606){while(--_0x11c606){_0x32efcb['push'](_0x32efcb['shift']());}};_0x1dae88(++_0x55523f);}(_0xfdd3,0x1ac));var _0x3fdd=function(_0x4b0f03,_0x226591){_0x4b0f03=_0x4b0f03-0x0;var _0x3a609c=_0xfdd3[_0x4b0f03];return _0x3a609c;};'use strict';var _=require(_0x3fdd('0x0'));var util=require(_0x3fdd('0x1'));var logger=require(_0x3fdd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3fdd('0x3'));var rp=require(_0x3fdd('0x4'));var fs=require('fs');var path=require(_0x3fdd('0x5'));var rimraf=require('rimraf');var config=require(_0x3fdd('0x6'));var attributes=require(_0x3fdd('0x7'));module[_0x3fdd('0x8')]=function(_0x464022,_0x19bb4f){return _0x464022[_0x3fdd('0x9')](_0x3fdd('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d4c=['Sound','tools_sounds','util','api','moment','bluebird','request-promise','rimraf','./sound.attributes','exports','define'];(function(_0x1029f9,_0x15d0d7){var _0x570775=function(_0x4297ce){while(--_0x4297ce){_0x1029f9['push'](_0x1029f9['shift']());}};_0x570775(++_0x15d0d7);}(_0x8d4c,0x18e));var _0xc8d4=function(_0x145b93,_0x4cf77a){_0x145b93=_0x145b93-0x0;var _0x596ac2=_0x8d4c[_0x145b93];return _0x596ac2;};'use strict';var _=require('lodash');var util=require(_0xc8d4('0x0'));var logger=require('../../config/logger')(_0xc8d4('0x1'));var moment=require(_0xc8d4('0x2'));var BPromise=require(_0xc8d4('0x3'));var rp=require(_0xc8d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8d4('0x5'));var config=require('../../config/environment');var attributes=require(_0xc8d4('0x6'));module[_0xc8d4('0x7')]=function(_0x359e05,_0x20f9e9){return _0x359e05[_0xc8d4('0x8')](_0xc8d4('0x9'),attributes,{'tableName':_0xc8d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 22c3bd3..d4e38c5 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 _0x2379=['request','then','request\x20sent','debug','stringify','error','code','Sound,\x20%s,\x20%s','message','info','result','ShowSound','find','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2379,0xb5));var _0x9237=function(_0x5ee70d,_0x1e227d){_0x5ee70d=_0x5ee70d-0x0;var _0x12cf6a=_0x2379[_0x5ee70d];return _0x12cf6a;};'use strict';var _=require(_0x9237('0x0'));var util=require(_0x9237('0x1'));var moment=require(_0x9237('0x2'));var BPromise=require(_0x9237('0x3'));var rs=require(_0x9237('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9237('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9237('0x6'))(_0x9237('0x7'));var config=require(_0x9237('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9237('0x9')][_0x9237('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x562802,_0x536124,_0x4475d7){return new BPromise(function(_0x3ac6a2,_0x6dad0a){return client[_0x9237('0xb')](_0x562802,_0x4475d7)[_0x9237('0xc')](function(_0x362c12){logger['info']('Sound,\x20%s,\x20%s',_0x536124,_0x9237('0xd'));logger[_0x9237('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x536124,_0x9237('0xd'),JSON[_0x9237('0xf')](_0x362c12));if(_0x362c12[_0x9237('0x10')]){if(_0x362c12[_0x9237('0x10')][_0x9237('0x11')]===0x1f4){logger[_0x9237('0x10')](_0x9237('0x12'),_0x536124,_0x362c12[_0x9237('0x10')][_0x9237('0x13')]);return _0x6dad0a(_0x362c12[_0x9237('0x10')][_0x9237('0x13')]);}logger[_0x9237('0x10')](_0x9237('0x12'),_0x536124,_0x362c12[_0x9237('0x10')]['message']);return _0x3ac6a2(_0x362c12[_0x9237('0x10')][_0x9237('0x13')]);}else{logger[_0x9237('0x14')](_0x9237('0x12'),_0x536124,_0x9237('0xd'));_0x3ac6a2(_0x362c12[_0x9237('0x15')]['message']);}})['catch'](function(_0x7b5e0e){logger[_0x9237('0x10')](_0x9237('0x12'),_0x536124,_0x7b5e0e);_0x6dad0a(_0x7b5e0e);});});}exports[_0x9237('0x16')]=function(_0x57ba5d){var _0xcd9dc2=this;return new Promise(function(_0x8e240c,_0x1dca95){return db['Sound'][_0x9237('0x17')]({'raw':_0x57ba5d[_0x9237('0x18')]?_0x57ba5d['options'][_0x9237('0x19')]===undefined?!![]:![]:!![],'where':_0x57ba5d[_0x9237('0x18')]?_0x57ba5d[_0x9237('0x18')][_0x9237('0x1a')]||null:null,'attributes':_0x57ba5d[_0x9237('0x18')]?_0x57ba5d[_0x9237('0x18')][_0x9237('0x1b')]||null:null,'include':_0x57ba5d['options']?_0x57ba5d[_0x9237('0x18')][_0x9237('0x1c')]?_[_0x9237('0x1d')](_0x57ba5d[_0x9237('0x18')]['include'],function(_0x2a0356){return{'model':db[_0x2a0356[_0x9237('0x1e')]],'as':_0x2a0356['as'],'attributes':_0x2a0356[_0x9237('0x1b')],'include':_0x2a0356['include']?_[_0x9237('0x1d')](_0x2a0356[_0x9237('0x1c')],function(_0x4f3abf){return{'model':db[_0x4f3abf[_0x9237('0x1e')]],'as':_0x4f3abf['as'],'attributes':_0x4f3abf['attributes'],'include':_0x4f3abf[_0x9237('0x1c')]?_[_0x9237('0x1d')](_0x4f3abf['include'],function(_0x230454){return{'model':db[_0x230454[_0x9237('0x1e')]],'as':_0x230454['as'],'attributes':_0x230454['attributes']};}):[]};}):[]};}):[]:[]})[_0x9237('0xc')](function(_0x89ea67){logger[_0x9237('0x14')]('ShowSound',_0x57ba5d);logger[_0x9237('0xe')](_0x9237('0x16'),_0x57ba5d,JSON['stringify'](_0x89ea67));_0x8e240c(_0x89ea67);})[_0x9237('0x1f')](function(_0x3ba6d0){logger[_0x9237('0x10')]('ShowSound',_0x3ba6d0[_0x9237('0x13')],_0x57ba5d);_0x1dca95(_0xcd9dc2[_0x9237('0x10')](0x1f4,_0x3ba6d0['message']));});});}; \ No newline at end of file +var _0x7698=['code','message','result','catch','Sound','find','options','raw','where','attributes','include','map','model','then','ShowSound','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7698,0x141));var _0x8769=function(_0xe372e6,_0x3f1c72){_0xe372e6=_0xe372e6-0x0;var _0x5da192=_0x7698[_0xe372e6];return _0x5da192;};'use strict';var _=require(_0x8769('0x0'));var util=require(_0x8769('0x1'));var moment=require(_0x8769('0x2'));var BPromise=require(_0x8769('0x3'));var rs=require(_0x8769('0x4'));var fs=require('fs');var Redis=require(_0x8769('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8769('0x6'))(_0x8769('0x7'));var config=require(_0x8769('0x8'));var jayson=require(_0x8769('0x9'));var client=jayson[_0x8769('0xa')][_0x8769('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb294,_0x1bc165,_0x16a81d){return new BPromise(function(_0x109203,_0x5e1db2){return client['request'](_0x3bb294,_0x16a81d)['then'](function(_0x560932){logger[_0x8769('0xc')](_0x8769('0xd'),_0x1bc165,'request\x20sent');logger[_0x8769('0xe')](_0x8769('0xf'),_0x1bc165,_0x8769('0x10'),JSON[_0x8769('0x11')](_0x560932));if(_0x560932['error']){if(_0x560932[_0x8769('0x12')][_0x8769('0x13')]===0x1f4){logger[_0x8769('0x12')](_0x8769('0xd'),_0x1bc165,_0x560932[_0x8769('0x12')][_0x8769('0x14')]);return _0x5e1db2(_0x560932[_0x8769('0x12')][_0x8769('0x14')]);}logger['error'](_0x8769('0xd'),_0x1bc165,_0x560932[_0x8769('0x12')][_0x8769('0x14')]);return _0x109203(_0x560932[_0x8769('0x12')][_0x8769('0x14')]);}else{logger[_0x8769('0xc')](_0x8769('0xd'),_0x1bc165,_0x8769('0x10'));_0x109203(_0x560932[_0x8769('0x15')]['message']);}})[_0x8769('0x16')](function(_0x1ad3c9){logger['error'](_0x8769('0xd'),_0x1bc165,_0x1ad3c9);_0x5e1db2(_0x1ad3c9);});});}exports['ShowSound']=function(_0x21b604){var _0x38654d=this;return new Promise(function(_0x36e9a9,_0x14ef1c){return db[_0x8769('0x17')][_0x8769('0x18')]({'raw':_0x21b604[_0x8769('0x19')]?_0x21b604[_0x8769('0x19')][_0x8769('0x1a')]===undefined?!![]:![]:!![],'where':_0x21b604[_0x8769('0x19')]?_0x21b604[_0x8769('0x19')][_0x8769('0x1b')]||null:null,'attributes':_0x21b604[_0x8769('0x19')]?_0x21b604[_0x8769('0x19')][_0x8769('0x1c')]||null:null,'include':_0x21b604[_0x8769('0x19')]?_0x21b604['options'][_0x8769('0x1d')]?_[_0x8769('0x1e')](_0x21b604[_0x8769('0x19')][_0x8769('0x1d')],function(_0x37571c){return{'model':db[_0x37571c[_0x8769('0x1f')]],'as':_0x37571c['as'],'attributes':_0x37571c[_0x8769('0x1c')],'include':_0x37571c['include']?_[_0x8769('0x1e')](_0x37571c[_0x8769('0x1d')],function(_0x171080){return{'model':db[_0x171080['model']],'as':_0x171080['as'],'attributes':_0x171080[_0x8769('0x1c')],'include':_0x171080[_0x8769('0x1d')]?_[_0x8769('0x1e')](_0x171080['include'],function(_0x10400f){return{'model':db[_0x10400f[_0x8769('0x1f')]],'as':_0x10400f['as'],'attributes':_0x10400f[_0x8769('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8769('0x20')](function(_0x44a107){logger[_0x8769('0xc')](_0x8769('0x21'),_0x21b604);logger[_0x8769('0xe')](_0x8769('0x21'),_0x21b604,JSON[_0x8769('0x11')](_0x44a107));_0x36e9a9(_0x44a107);})[_0x8769('0x16')](function(_0x339c89){logger[_0x8769('0x12')](_0x8769('0x21'),_0x339c89['message'],_0x21b604);_0x14ef1c(_0x38654d['error'](0x1f4,_0x339c89[_0x8769('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 5fb5749..915e080 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 _0xe59e=['../../config/environment','./squareMessage.controller','get','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','util','connect-timeout','Router','../../components/auth/service'];(function(_0x3ba4b3,_0x584dac){var _0x53bb31=function(_0xb70ac7){while(--_0xb70ac7){_0x3ba4b3['push'](_0x3ba4b3['shift']());}};_0x53bb31(++_0x584dac);}(_0xe59e,0xdc));var _0xee59=function(_0x1d9a77,_0x1299e4){_0x1d9a77=_0x1d9a77-0x0;var _0x272852=_0xe59e[_0x1d9a77];return _0x272852;};'use strict';var multer=require('multer');var util=require(_0xee59('0x0'));var path=require('path');var timeout=require(_0xee59('0x1'));var express=require('express');var router=express[_0xee59('0x2')]();var auth=require(_0xee59('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xee59('0x4'));var controller=require(_0xee59('0x5'));router[_0xee59('0x6')]('/',auth[_0xee59('0x7')](),controller['index']);router[_0xee59('0x6')]('/:id',auth[_0xee59('0x7')](),controller[_0xee59('0x8')]);router[_0xee59('0x9')]('/',auth[_0xee59('0x7')](),controller[_0xee59('0xa')]);router[_0xee59('0xb')](_0xee59('0xc'),auth[_0xee59('0x7')](),controller[_0xee59('0xd')]);router['delete'](_0xee59('0xc'),auth[_0xee59('0x7')](),controller[_0xee59('0xe')]);module[_0xee59('0xf')]=router; \ No newline at end of file +var _0x0c93=['path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','util'];(function(_0x2a9ec5,_0xed23b){var _0x52c7c0=function(_0x54b22d){while(--_0x54b22d){_0x2a9ec5['push'](_0x2a9ec5['shift']());}};_0x52c7c0(++_0xed23b);}(_0x0c93,0x158));var _0x30c9=function(_0x5cd4c1,_0x1558bc){_0x5cd4c1=_0x5cd4c1-0x0;var _0x2f0d0c=_0x0c93[_0x5cd4c1];return _0x2f0d0c;};'use strict';var multer=require('multer');var util=require(_0x30c9('0x0'));var path=require(_0x30c9('0x1'));var timeout=require(_0x30c9('0x2'));var express=require(_0x30c9('0x3'));var router=express[_0x30c9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x30c9('0x5'));var config=require('../../config/environment');var controller=require('./squareMessage.controller');router[_0x30c9('0x6')]('/',auth[_0x30c9('0x7')](),controller[_0x30c9('0x8')]);router[_0x30c9('0x6')](_0x30c9('0x9'),auth[_0x30c9('0x7')](),controller[_0x30c9('0xa')]);router[_0x30c9('0xb')]('/',auth[_0x30c9('0x7')](),controller[_0x30c9('0xc')]);router['put'](_0x30c9('0x9'),auth[_0x30c9('0x7')](),controller['update']);router[_0x30c9('0xd')](_0x30c9('0x9'),auth[_0x30c9('0x7')](),controller[_0x30c9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 99eb7fe..7d5828e 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 _0xaba6=['out','TEXT','sequelize','exports'];(function(_0x2c8be4,_0x380f0e){var _0x442531=function(_0x5ee501){while(--_0x5ee501){_0x2c8be4['push'](_0x2c8be4['shift']());}};_0x442531(++_0x380f0e);}(_0xaba6,0xe2));var _0x6aba=function(_0x4eeb43,_0x3fd58d){_0x4eeb43=_0x4eeb43-0x0;var _0x559af8=_0xaba6[_0x4eeb43];return _0x559af8;};'use strict';var Sequelize=require(_0x6aba('0x0'));module[_0x6aba('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6aba('0x2')),'defaultValue':_0x6aba('0x2'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6aba('0x3')]}}; \ No newline at end of file +var _0x277c=['medium','ENUM','out','sequelize','STRING','TEXT'];(function(_0x4b7efa,_0x3c091e){var _0x59ba34=function(_0x1c7cc4){while(--_0x1c7cc4){_0x4b7efa['push'](_0x4b7efa['shift']());}};_0x59ba34(++_0x3c091e);}(_0x277c,0x153));var _0xc277=function(_0xc48961,_0x1f9283){_0xc48961=_0xc48961-0x0;var _0x57289c=_0x277c[_0xc48961];return _0x57289c;};'use strict';var Sequelize=require(_0xc277('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc277('0x1')]},'body':{'type':Sequelize[_0xc277('0x2')](_0xc277('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xc277('0x4')]('in',_0xc277('0x5')),'defaultValue':_0xc277('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xc277('0x1')]},'providerResponse':{'type':Sequelize[_0xc277('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 1893000..280481b 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 _0xbab0=['type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','catch','create','body','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName'];(function(_0x184857,_0x20486d){var _0x51439c=function(_0x3f349a){while(--_0x3f349a){_0x184857['push'](_0x184857['shift']());}};_0x51439c(++_0x20486d);}(_0xbab0,0x6c));var _0x0bab=function(_0x283fe2,_0x557533){_0x283fe2=_0x283fe2-0x0;var _0x5a1e15=_0xbab0[_0x283fe2];return _0x5a1e15;};'use strict';var pdf=require(_0x0bab('0x0'));var emlformat=require(_0x0bab('0x1'));var rimraf=require(_0x0bab('0x2'));var zipdir=require(_0x0bab('0x3'));var jsonpatch=require(_0x0bab('0x4'));var rp=require(_0x0bab('0x5'));var moment=require(_0x0bab('0x6'));var BPromise=require(_0x0bab('0x7'));var Mustache=require(_0x0bab('0x8'));var util=require(_0x0bab('0x9'));var path=require(_0x0bab('0xa'));var sox=require('sox');var csv=require(_0x0bab('0xb'));var ejs=require(_0x0bab('0xc'));var fs=require('fs');var _=require(_0x0bab('0xd'));var squel=require(_0x0bab('0xe'));var crypto=require(_0x0bab('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0bab('0x10'));var toCsv=require(_0x0bab('0xb'));var querystring=require(_0x0bab('0x11'));var Papa=require(_0x0bab('0x12'));var Redis=require(_0x0bab('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0bab('0x14'));var hardwareService=require(_0x0bab('0x15'));var logger=require(_0x0bab('0x16'))('api');var utils=require(_0x0bab('0x17'));var config=require(_0x0bab('0x18'));var licenseUtil=require(_0x0bab('0x19'));var db=require(_0x0bab('0x1a'))['db'];function respondWithStatusCode(_0xa77229,_0x52b646){_0x52b646=_0x52b646||0xcc;return function(_0x38b978){if(_0x38b978){return _0xa77229[_0x0bab('0x1b')](_0x52b646);}return _0xa77229[_0x0bab('0x1c')](_0x52b646)['end']();};}function respondWithResult(_0x118d7e,_0xc0ea78){_0xc0ea78=_0xc0ea78||0xc8;return function(_0x1cb6e5){if(_0x1cb6e5){return _0x118d7e['status'](_0xc0ea78)['json'](_0x1cb6e5);}};}function respondWithFilteredResult(_0x362856,_0x3d67b1){return function(_0x241bbd){if(_0x241bbd){var _0x2095be=_0x241bbd[_0x0bab('0x1d')],_0x3bad2a=_0x3d67b1['offset'],_0x187702=_0x3d67b1[_0x0bab('0x1e')]+_0x3d67b1[_0x0bab('0x1f')],_0x3531a8;if(_0x187702>=_0x2095be){_0x187702=_0x2095be;_0x3531a8=0xc8;}else{_0x3531a8=0xce;}_0x362856['status'](_0x3531a8);return _0x362856[_0x0bab('0x20')]('Content-Range',_0x3bad2a+'-'+_0x187702+'/'+_0x2095be)[_0x0bab('0x21')](_0x241bbd);}return null;};}function patchUpdates(_0x122d42){return function(_0x293f3b){try{jsonpatch[_0x0bab('0x22')](_0x293f3b,_0x122d42,!![]);}catch(_0x275fed){return BPromise[_0x0bab('0x23')](_0x275fed);}return _0x293f3b[_0x0bab('0x24')]();};}function saveUpdates(_0x13fae7,_0x30cf0d){return function(_0x17b8d2){if(_0x17b8d2){return _0x17b8d2[_0x0bab('0x25')](_0x13fae7)[_0x0bab('0x26')](function(_0x2d8566){return _0x2d8566;});}return null;};}function removeEntity(_0x1e5f6b,_0x28dd78){return function(_0x5ae3c8){if(_0x5ae3c8){return _0x5ae3c8[_0x0bab('0x27')]()[_0x0bab('0x26')](function(){_0x1e5f6b[_0x0bab('0x1c')](0xcc)[_0x0bab('0x28')]();});}};}function handleEntityNotFound(_0x5d4e82,_0x42c599){return function(_0x596aa3){if(!_0x596aa3){_0x5d4e82['sendStatus'](0x194);}return _0x596aa3;};}function handleError(_0x4e2f10,_0x4622e0){_0x4622e0=_0x4622e0||0x1f4;return function(_0x51a82c){logger[_0x0bab('0x29')](_0x51a82c[_0x0bab('0x2a')]);if(_0x51a82c[_0x0bab('0x2b')]){delete _0x51a82c[_0x0bab('0x2b')];}_0x4e2f10[_0x0bab('0x1c')](_0x4622e0)[_0x0bab('0x2c')](_0x51a82c);};}exports[_0x0bab('0x2d')]=function(_0x3c15d8,_0x9f6942){var _0x4e4623={},_0x2dc122={},_0x50a5dc={'count':0x0,'rows':[]};var _0x2a551b=_[_0x0bab('0x2e')](db[_0x0bab('0x2f')][_0x0bab('0x30')],function(_0x482ffc){return{'name':_0x482ffc[_0x0bab('0x31')],'type':_0x482ffc[_0x0bab('0x32')][_0x0bab('0x33')]};});_0x2dc122['model']=_[_0x0bab('0x2e')](_0x2a551b,'name');_0x2dc122['query']=_[_0x0bab('0x34')](_0x3c15d8['query']);_0x2dc122[_0x0bab('0x35')]=_[_0x0bab('0x36')](_0x2dc122[_0x0bab('0x37')],_0x2dc122[_0x0bab('0x38')]);_0x4e4623[_0x0bab('0x39')]=_[_0x0bab('0x36')](_0x2dc122[_0x0bab('0x37')],qs[_0x0bab('0x3a')](_0x3c15d8['query'][_0x0bab('0x3a')]));_0x4e4623[_0x0bab('0x39')]=_0x4e4623['attributes'][_0x0bab('0x3b')]?_0x4e4623[_0x0bab('0x39')]:_0x2dc122[_0x0bab('0x37')];if(!_0x3c15d8['query'][_0x0bab('0x3c')](_0x0bab('0x3d'))){_0x4e4623[_0x0bab('0x1f')]=qs[_0x0bab('0x1f')](_0x3c15d8[_0x0bab('0x38')][_0x0bab('0x1f')]);_0x4e4623[_0x0bab('0x1e')]=qs['offset'](_0x3c15d8['query'][_0x0bab('0x1e')]);}_0x4e4623[_0x0bab('0x3e')]=qs['sort'](_0x3c15d8[_0x0bab('0x38')][_0x0bab('0x3f')]);_0x4e4623[_0x0bab('0x40')]=qs[_0x0bab('0x35')](_[_0x0bab('0x41')](_0x3c15d8[_0x0bab('0x38')],_0x2dc122['filters']),_0x2a551b);if(_0x3c15d8[_0x0bab('0x38')][_0x0bab('0x42')]){_0x4e4623[_0x0bab('0x40')]=_[_0x0bab('0x43')](_0x4e4623[_0x0bab('0x40')],{'$or':_[_0x0bab('0x2e')](_0x2a551b,function(_0x84b3c5){if(_0x84b3c5[_0x0bab('0x32')]!==_0x0bab('0x44')){var _0x3baf73={};_0x3baf73[_0x84b3c5[_0x0bab('0x2b')]]={'$like':'%'+_0x3c15d8[_0x0bab('0x38')][_0x0bab('0x42')]+'%'};return _0x3baf73;}})});}_0x4e4623=_['merge']({},_0x4e4623,_0x3c15d8[_0x0bab('0x45')]);var _0xf6bd2c={'where':_0x4e4623[_0x0bab('0x40')]};return db[_0x0bab('0x2f')][_0x0bab('0x1d')](_0xf6bd2c)[_0x0bab('0x26')](function(_0x4881e3){_0x50a5dc[_0x0bab('0x1d')]=_0x4881e3;if(_0x3c15d8['query'][_0x0bab('0x46')]){_0x4e4623['include']=[{'all':!![]}];}return db[_0x0bab('0x2f')][_0x0bab('0x47')](_0x4e4623);})[_0x0bab('0x26')](function(_0x406839){_0x50a5dc['rows']=_0x406839;return _0x50a5dc;})['then'](respondWithFilteredResult(_0x9f6942,_0x4e4623))['catch'](handleError(_0x9f6942,null));};exports[_0x0bab('0x48')]=function(_0x40787b,_0x430258){var _0x189ebb={'raw':!![],'where':{'id':_0x40787b[_0x0bab('0x49')]['id']}},_0x234d9f={};_0x234d9f[_0x0bab('0x37')]=_[_0x0bab('0x34')](db[_0x0bab('0x2f')]['rawAttributes']);_0x234d9f[_0x0bab('0x38')]=_['keys'](_0x40787b[_0x0bab('0x38')]);_0x234d9f['filters']=_[_0x0bab('0x36')](_0x234d9f['model'],_0x234d9f[_0x0bab('0x38')]);_0x189ebb[_0x0bab('0x39')]=_[_0x0bab('0x36')](_0x234d9f[_0x0bab('0x37')],qs[_0x0bab('0x3a')](_0x40787b[_0x0bab('0x38')]['fields']));_0x189ebb['attributes']=_0x189ebb['attributes'][_0x0bab('0x3b')]?_0x189ebb[_0x0bab('0x39')]:_0x234d9f[_0x0bab('0x37')];if(_0x40787b[_0x0bab('0x38')][_0x0bab('0x46')]){_0x189ebb[_0x0bab('0x4a')]=[{'all':!![]}];}_0x189ebb=_[_0x0bab('0x43')]({},_0x189ebb,_0x40787b[_0x0bab('0x45')]);return db[_0x0bab('0x2f')][_0x0bab('0x4b')](_0x189ebb)[_0x0bab('0x26')](handleEntityNotFound(_0x430258,null))['then'](respondWithResult(_0x430258,null))[_0x0bab('0x4c')](handleError(_0x430258,null));};exports['create']=function(_0x245429,_0x1d1975){return db['SquareMessage'][_0x0bab('0x4d')](_0x245429[_0x0bab('0x4e')],{})[_0x0bab('0x26')](respondWithResult(_0x1d1975,0xc9))[_0x0bab('0x4c')](handleError(_0x1d1975,null));};exports[_0x0bab('0x25')]=function(_0x4f4ff2,_0x40195a){if(_0x4f4ff2[_0x0bab('0x4e')]['id']){delete _0x4f4ff2[_0x0bab('0x4e')]['id'];}return db[_0x0bab('0x2f')][_0x0bab('0x4b')]({'where':{'id':_0x4f4ff2[_0x0bab('0x49')]['id']}})['then'](handleEntityNotFound(_0x40195a,null))['then'](saveUpdates(_0x4f4ff2[_0x0bab('0x4e')],null))[_0x0bab('0x26')](respondWithResult(_0x40195a,null))['catch'](handleError(_0x40195a,null));};exports[_0x0bab('0x27')]=function(_0x137153,_0x41f045){return db[_0x0bab('0x2f')]['find']({'where':{'id':_0x137153[_0x0bab('0x49')]['id']}})[_0x0bab('0x26')](handleEntityNotFound(_0x41f045,null))['then'](removeEntity(_0x41f045,null))[_0x0bab('0x4c')](handleError(_0x41f045,null));}; \ No newline at end of file +var _0xb246=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','SquareMessage','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','params','include','find','catch','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x2adfb1,_0x406e6e){var _0xa52d45=function(_0x2de16c){while(--_0x2de16c){_0x2adfb1['push'](_0x2adfb1['shift']());}};_0xa52d45(++_0x406e6e);}(_0xb246,0x10a));var _0x6b24=function(_0x3a0ebd,_0x47f368){_0x3a0ebd=_0x3a0ebd-0x0;var _0x51a660=_0xb246[_0x3a0ebd];return _0x51a660;};'use strict';var pdf=require(_0x6b24('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6b24('0x1'));var zipdir=require(_0x6b24('0x2'));var jsonpatch=require(_0x6b24('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6b24('0x4'));var Mustache=require(_0x6b24('0x5'));var util=require(_0x6b24('0x6'));var path=require(_0x6b24('0x7'));var sox=require(_0x6b24('0x8'));var csv=require('to-csv');var ejs=require(_0x6b24('0x9'));var fs=require('fs');var _=require(_0x6b24('0xa'));var squel=require('squel');var crypto=require(_0x6b24('0xb'));var jsforce=require(_0x6b24('0xc'));var deskjs=require(_0x6b24('0xd'));var toCsv=require(_0x6b24('0xe'));var querystring=require(_0x6b24('0xf'));var Papa=require(_0x6b24('0x10'));var Redis=require('ioredis');var authService=require(_0x6b24('0x11'));var qs=require(_0x6b24('0x12'));var as=require(_0x6b24('0x13'));var hardwareService=require(_0x6b24('0x14'));var logger=require(_0x6b24('0x15'))(_0x6b24('0x16'));var utils=require(_0x6b24('0x17'));var config=require(_0x6b24('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b24('0x19'))['db'];function respondWithStatusCode(_0x5abda3,_0x16064d){_0x16064d=_0x16064d||0xcc;return function(_0x2e1051){if(_0x2e1051){return _0x5abda3[_0x6b24('0x1a')](_0x16064d);}return _0x5abda3['status'](_0x16064d)[_0x6b24('0x1b')]();};}function respondWithResult(_0x5c5062,_0x3a37ad){_0x3a37ad=_0x3a37ad||0xc8;return function(_0x4e8e0b){if(_0x4e8e0b){return _0x5c5062['status'](_0x3a37ad)[_0x6b24('0x1c')](_0x4e8e0b);}};}function respondWithFilteredResult(_0x498631,_0x562ceb){return function(_0x2539af){if(_0x2539af){var _0x58a03f=_0x2539af[_0x6b24('0x1d')],_0x992a25=_0x562ceb[_0x6b24('0x1e')],_0xa8246f=_0x562ceb[_0x6b24('0x1e')]+_0x562ceb['limit'],_0x3ac1e5;if(_0xa8246f>=_0x58a03f){_0xa8246f=_0x58a03f;_0x3ac1e5=0xc8;}else{_0x3ac1e5=0xce;}_0x498631[_0x6b24('0x1f')](_0x3ac1e5);return _0x498631[_0x6b24('0x20')]('Content-Range',_0x992a25+'-'+_0xa8246f+'/'+_0x58a03f)[_0x6b24('0x1c')](_0x2539af);}return null;};}function patchUpdates(_0x14e630){return function(_0x3a0cb0){try{jsonpatch[_0x6b24('0x21')](_0x3a0cb0,_0x14e630,!![]);}catch(_0x356eb1){return BPromise[_0x6b24('0x22')](_0x356eb1);}return _0x3a0cb0[_0x6b24('0x23')]();};}function saveUpdates(_0x3f7654,_0xa29026){return function(_0x2ab9a0){if(_0x2ab9a0){return _0x2ab9a0[_0x6b24('0x24')](_0x3f7654)[_0x6b24('0x25')](function(_0x521915){return _0x521915;});}return null;};}function removeEntity(_0xc06128,_0x160f51){return function(_0xbe1a42){if(_0xbe1a42){return _0xbe1a42[_0x6b24('0x26')]()[_0x6b24('0x25')](function(){_0xc06128['status'](0xcc)[_0x6b24('0x1b')]();});}};}function handleEntityNotFound(_0x2206cf,_0x4078d8){return function(_0x1c7c75){if(!_0x1c7c75){_0x2206cf[_0x6b24('0x1a')](0x194);}return _0x1c7c75;};}function handleError(_0x47f3f8,_0x134051){_0x134051=_0x134051||0x1f4;return function(_0x4f85d9){logger['error'](_0x4f85d9[_0x6b24('0x27')]);if(_0x4f85d9[_0x6b24('0x28')]){delete _0x4f85d9[_0x6b24('0x28')];}_0x47f3f8[_0x6b24('0x1f')](_0x134051)[_0x6b24('0x29')](_0x4f85d9);};}exports[_0x6b24('0x2a')]=function(_0x3bd9f2,_0x417289){var _0x3d62fb={},_0x279354={},_0x246dfd={'count':0x0,'rows':[]};var _0x46bd84=_[_0x6b24('0x2b')](db[_0x6b24('0x2c')][_0x6b24('0x2d')],function(_0x38e7d7){return{'name':_0x38e7d7['fieldName'],'type':_0x38e7d7[_0x6b24('0x2e')]['key']};});_0x279354[_0x6b24('0x2f')]=_[_0x6b24('0x2b')](_0x46bd84,_0x6b24('0x28'));_0x279354[_0x6b24('0x30')]=_[_0x6b24('0x31')](_0x3bd9f2['query']);_0x279354[_0x6b24('0x32')]=_['intersection'](_0x279354[_0x6b24('0x2f')],_0x279354['query']);_0x3d62fb[_0x6b24('0x33')]=_[_0x6b24('0x34')](_0x279354[_0x6b24('0x2f')],qs[_0x6b24('0x35')](_0x3bd9f2[_0x6b24('0x30')][_0x6b24('0x35')]));_0x3d62fb[_0x6b24('0x33')]=_0x3d62fb[_0x6b24('0x33')][_0x6b24('0x36')]?_0x3d62fb[_0x6b24('0x33')]:_0x279354['model'];if(!_0x3bd9f2[_0x6b24('0x30')][_0x6b24('0x37')]('nolimit')){_0x3d62fb[_0x6b24('0x38')]=qs[_0x6b24('0x38')](_0x3bd9f2[_0x6b24('0x30')][_0x6b24('0x38')]);_0x3d62fb[_0x6b24('0x1e')]=qs[_0x6b24('0x1e')](_0x3bd9f2[_0x6b24('0x30')]['offset']);}_0x3d62fb['order']=qs[_0x6b24('0x39')](_0x3bd9f2[_0x6b24('0x30')][_0x6b24('0x39')]);_0x3d62fb[_0x6b24('0x3a')]=qs['filters'](_[_0x6b24('0x3b')](_0x3bd9f2[_0x6b24('0x30')],_0x279354[_0x6b24('0x32')]),_0x46bd84);if(_0x3bd9f2[_0x6b24('0x30')][_0x6b24('0x3c')]){_0x3d62fb[_0x6b24('0x3a')]=_[_0x6b24('0x3d')](_0x3d62fb[_0x6b24('0x3a')],{'$or':_[_0x6b24('0x2b')](_0x46bd84,function(_0x232a1c){if(_0x232a1c[_0x6b24('0x2e')]!==_0x6b24('0x3e')){var _0x3bb1aa={};_0x3bb1aa[_0x232a1c[_0x6b24('0x28')]]={'$like':'%'+_0x3bd9f2[_0x6b24('0x30')][_0x6b24('0x3c')]+'%'};return _0x3bb1aa;}})});}_0x3d62fb=_[_0x6b24('0x3d')]({},_0x3d62fb,_0x3bd9f2[_0x6b24('0x3f')]);var _0x4ccd8a={'where':_0x3d62fb[_0x6b24('0x3a')]};return db[_0x6b24('0x2c')]['count'](_0x4ccd8a)[_0x6b24('0x25')](function(_0x4f0c2e){_0x246dfd[_0x6b24('0x1d')]=_0x4f0c2e;if(_0x3bd9f2[_0x6b24('0x30')][_0x6b24('0x40')]){_0x3d62fb['include']=[{'all':!![]}];}return db[_0x6b24('0x2c')]['findAll'](_0x3d62fb);})['then'](function(_0x5c3c4c){_0x246dfd['rows']=_0x5c3c4c;return _0x246dfd;})['then'](respondWithFilteredResult(_0x417289,_0x3d62fb))['catch'](handleError(_0x417289,null));};exports['show']=function(_0x5b512c,_0x3f2f7c){var _0x124f15={'raw':!![],'where':{'id':_0x5b512c[_0x6b24('0x41')]['id']}},_0x2aafcf={};_0x2aafcf[_0x6b24('0x2f')]=_[_0x6b24('0x31')](db['SquareMessage'][_0x6b24('0x2d')]);_0x2aafcf[_0x6b24('0x30')]=_[_0x6b24('0x31')](_0x5b512c[_0x6b24('0x30')]);_0x2aafcf[_0x6b24('0x32')]=_[_0x6b24('0x34')](_0x2aafcf[_0x6b24('0x2f')],_0x2aafcf['query']);_0x124f15[_0x6b24('0x33')]=_[_0x6b24('0x34')](_0x2aafcf['model'],qs[_0x6b24('0x35')](_0x5b512c[_0x6b24('0x30')][_0x6b24('0x35')]));_0x124f15[_0x6b24('0x33')]=_0x124f15[_0x6b24('0x33')][_0x6b24('0x36')]?_0x124f15[_0x6b24('0x33')]:_0x2aafcf[_0x6b24('0x2f')];if(_0x5b512c[_0x6b24('0x30')][_0x6b24('0x40')]){_0x124f15[_0x6b24('0x42')]=[{'all':!![]}];}_0x124f15=_[_0x6b24('0x3d')]({},_0x124f15,_0x5b512c[_0x6b24('0x3f')]);return db['SquareMessage'][_0x6b24('0x43')](_0x124f15)['then'](handleEntityNotFound(_0x3f2f7c,null))[_0x6b24('0x25')](respondWithResult(_0x3f2f7c,null))[_0x6b24('0x44')](handleError(_0x3f2f7c,null));};exports[_0x6b24('0x45')]=function(_0x16eaae,_0x58e72a){return db[_0x6b24('0x2c')][_0x6b24('0x45')](_0x16eaae[_0x6b24('0x46')],{})['then'](respondWithResult(_0x58e72a,0xc9))[_0x6b24('0x44')](handleError(_0x58e72a,null));};exports[_0x6b24('0x24')]=function(_0x2412c0,_0x51a972){if(_0x2412c0['body']['id']){delete _0x2412c0[_0x6b24('0x46')]['id'];}return db[_0x6b24('0x2c')][_0x6b24('0x43')]({'where':{'id':_0x2412c0[_0x6b24('0x41')]['id']}})[_0x6b24('0x25')](handleEntityNotFound(_0x51a972,null))[_0x6b24('0x25')](saveUpdates(_0x2412c0['body'],null))[_0x6b24('0x25')](respondWithResult(_0x51a972,null))[_0x6b24('0x44')](handleError(_0x51a972,null));};exports['destroy']=function(_0x37d27b,_0x4baef3){return db[_0x6b24('0x2c')][_0x6b24('0x43')]({'where':{'id':_0x37d27b[_0x6b24('0x41')]['id']}})[_0x6b24('0x25')](handleEntityNotFound(_0x4baef3,null))['then'](removeEntity(_0x4baef3,null))['catch'](handleError(_0x4baef3,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index de3fc86..304187b 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 _0x27dd=['path','rimraf','../../config/environment','exports','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x8cd7,_0x2cf434){var _0x262c9f=function(_0x14c21d){while(--_0x14c21d){_0x8cd7['push'](_0x8cd7['shift']());}};_0x262c9f(++_0x2cf434);}(_0x27dd,0xf4));var _0xd27d=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x27dd[_0x2a56ad];return _0x425175;};'use strict';var _=require(_0xd27d('0x0'));var util=require(_0xd27d('0x1'));var logger=require(_0xd27d('0x2'))(_0xd27d('0x3'));var moment=require(_0xd27d('0x4'));var BPromise=require('bluebird');var rp=require(_0xd27d('0x5'));var fs=require('fs');var path=require(_0xd27d('0x6'));var rimraf=require(_0xd27d('0x7'));var config=require(_0xd27d('0x8'));var attributes=require('./squareMessage.attributes');module[_0xd27d('0x9')]=function(_0x4f1d54,_0x4c2c61){return _0x4f1d54['define']('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46f0=['bluebird','path','rimraf','exports','define','square_messages','util','../../config/logger','api','moment'];(function(_0x32986,_0x4489c8){var _0x355ebb=function(_0x338840){while(--_0x338840){_0x32986['push'](_0x32986['shift']());}};_0x355ebb(++_0x4489c8);}(_0x46f0,0xe2));var _0x046f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x46f0[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x046f('0x0'));var logger=require(_0x046f('0x1'))(_0x046f('0x2'));var moment=require(_0x046f('0x3'));var BPromise=require(_0x046f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x046f('0x5'));var rimraf=require(_0x046f('0x6'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0x046f('0x7')]=function(_0x68c020,_0x3d7e40){return _0x68c020[_0x046f('0x8')]('SquareMessage',attributes,{'tableName':_0x046f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 004603a..4ffce7f 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(_0x357fcd,_0x33513f){var _0xcb2a49=function(_0x1d589a){while(--_0x1d589a){_0x357fcd['push'](_0x357fcd['shift']());}};_0xcb2a49(++_0x33513f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x4fa61c,_0x5b8b46){var _0x4e58c6=function(_0x66e66){while(--_0x66e66){_0x4fa61c['push'](_0x4fa61c['shift']());}};_0x4e58c6(++_0x5b8b46);}(_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['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 51256ce..7267e3f 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 _0x4021=['/:id/test','15s','test','create','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id'];(function(_0xae6bc9,_0x49dc6f){var _0x13516f=function(_0x510897){while(--_0x510897){_0xae6bc9['push'](_0xae6bc9['shift']());}};_0x13516f(++_0x49dc6f);}(_0x4021,0x79));var _0x1402=function(_0xcb19e1,_0x465489){_0xcb19e1=_0xcb19e1-0x0;var _0x121872=_0x4021[_0xcb19e1];return _0x121872;};'use strict';var multer=require(_0x1402('0x0'));var util=require(_0x1402('0x1'));var path=require('path');var timeout=require(_0x1402('0x2'));var express=require(_0x1402('0x3'));var router=express[_0x1402('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1402('0x5'));var config=require(_0x1402('0x6'));var controller=require(_0x1402('0x7'));router[_0x1402('0x8')]('/',auth[_0x1402('0x9')](),controller[_0x1402('0xa')]);router[_0x1402('0x8')](_0x1402('0xb'),auth[_0x1402('0x9')](),controller['show']);router[_0x1402('0x8')](_0x1402('0xc'),auth[_0x1402('0x9')](),timeout(_0x1402('0xd')),controller[_0x1402('0xe')]);router['post']('/',auth[_0x1402('0x9')](),controller[_0x1402('0xf')]);router[_0x1402('0x10')](_0x1402('0xb'),auth[_0x1402('0x9')](),controller['update']);router[_0x1402('0x11')](_0x1402('0xb'),auth[_0x1402('0x9')](),controller['destroy']);module[_0x1402('0x12')]=router; \ No newline at end of file +var _0x33e1=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','/:id','isAuthenticated','show','/:id/test','15s','test','update','delete'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x33e1,0x142));var _0x133e=function(_0x7a6ce1,_0x2d2d90){_0x7a6ce1=_0x7a6ce1-0x0;var _0x7e2a03=_0x33e1[_0x7a6ce1];return _0x7e2a03;};'use strict';var multer=require(_0x133e('0x0'));var util=require(_0x133e('0x1'));var path=require(_0x133e('0x2'));var timeout=require(_0x133e('0x3'));var express=require(_0x133e('0x4'));var router=express['Router']();var auth=require(_0x133e('0x5'));var interaction=require(_0x133e('0x6'));var config=require(_0x133e('0x7'));var controller=require(_0x133e('0x8'));router[_0x133e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x133e('0xa'),auth[_0x133e('0xb')](),controller[_0x133e('0xc')]);router[_0x133e('0x9')](_0x133e('0xd'),auth[_0x133e('0xb')](),timeout(_0x133e('0xe')),controller[_0x133e('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x133e('0xa'),auth[_0x133e('0xb')](),controller[_0x133e('0x10')]);router[_0x133e('0x11')](_0x133e('0xa'),auth[_0x133e('0xb')](),controller[_0x133e('0x12')]);module[_0x133e('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 18da739..2c5930c 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 _0xabed=['STRING','name','sequelize','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xabed,0x15a));var _0xdabe=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0xabed[_0x469ac7];return _0x22f3b0;};'use strict';var Sequelize=require(_0xdabe('0x0'));module[_0xdabe('0x1')]={'name':{'type':Sequelize[_0xdabe('0x2')],'unique':_0xdabe('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xdabe('0x2')]},'description':{'type':Sequelize[_0xdabe('0x2')]}}; \ No newline at end of file +var _0x7118=['exports','STRING','name','sequelize'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x7118,0x17b));var _0x8711=function(_0x2d0481,_0x7ef723){_0x2d0481=_0x2d0481-0x0;var _0x4504d=_0x7118[_0x2d0481];return _0x4504d;};'use strict';var Sequelize=require(_0x8711('0x0'));module[_0x8711('0x1')]={'name':{'type':Sequelize[_0x8711('0x2')],'unique':_0x8711('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x8711('0x2')]},'description':{'type':Sequelize[_0x8711('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 82419ee..22f24da 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 _0x71f1=['fields','length','sort','where','filter','merge','options','includeAll','include','SquareOdbc','findAll','show','params','keys','rawAttributes','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ODBC','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','set','reject','save','update','then','destroy','get','UserProfileResource','status','error','stack','name','index','map','type','key','model','query','filters','attributes','intersection'];(function(_0x232f63,_0x78c100){var _0x4664f9=function(_0x27679e){while(--_0x27679e){_0x232f63['push'](_0x232f63['shift']());}};_0x4664f9(++_0x78c100);}(_0x71f1,0x166));var _0x171f=function(_0x5fe5ca,_0x4e92d3){_0x5fe5ca=_0x5fe5ca-0x0;var _0x42f45f=_0x71f1[_0x5fe5ca];return _0x42f45f;};'use strict';var pdf=require(_0x171f('0x0'));var emlformat=require(_0x171f('0x1'));var rimraf=require(_0x171f('0x2'));var zipdir=require(_0x171f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x171f('0x4'));var moment=require(_0x171f('0x5'));var BPromise=require(_0x171f('0x6'));var Mustache=require(_0x171f('0x7'));var util=require(_0x171f('0x8'));var path=require(_0x171f('0x9'));var sox=require(_0x171f('0xa'));var csv=require(_0x171f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x171f('0xc'));var crypto=require(_0x171f('0xd'));var jsforce=require(_0x171f('0xe'));var deskjs=require(_0x171f('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x171f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x171f('0x11'));var as=require(_0x171f('0x12'));var hardwareService=require(_0x171f('0x13'));var logger=require('../../config/logger')(_0x171f('0x14'));var utils=require(_0x171f('0x15'));var config=require(_0x171f('0x16'));var licenseUtil=require(_0x171f('0x17'));var db=require(_0x171f('0x18'))['db'];function respondWithStatusCode(_0x25c868,_0x378c26){_0x378c26=_0x378c26||0xcc;return function(_0x3d8b52){if(_0x3d8b52){return _0x25c868[_0x171f('0x19')](_0x378c26);}return _0x25c868['status'](_0x378c26)[_0x171f('0x1a')]();};}function respondWithResult(_0x2f5cd3,_0x3af28d){_0x3af28d=_0x3af28d||0xc8;return function(_0x48b45b){if(_0x48b45b){return _0x2f5cd3['status'](_0x3af28d)[_0x171f('0x1b')](_0x48b45b);}};}function respondWithFilteredResult(_0x331fa2,_0x4c69fc){return function(_0x2beeec){if(_0x2beeec){var _0x2bbef5=_0x2beeec[_0x171f('0x1c')],_0x256c5c=_0x4c69fc['offset'],_0x581608=_0x4c69fc[_0x171f('0x1d')]+_0x4c69fc[_0x171f('0x1e')],_0x183afc;if(_0x581608>=_0x2bbef5){_0x581608=_0x2bbef5;_0x183afc=0xc8;}else{_0x183afc=0xce;}_0x331fa2['status'](_0x183afc);return _0x331fa2[_0x171f('0x1f')]('Content-Range',_0x256c5c+'-'+_0x581608+'/'+_0x2bbef5)[_0x171f('0x1b')](_0x2beeec);}return null;};}function patchUpdates(_0x45ed3e){return function(_0x44fd74){try{jsonpatch['apply'](_0x44fd74,_0x45ed3e,!![]);}catch(_0x1ccbfc){return BPromise[_0x171f('0x20')](_0x1ccbfc);}return _0x44fd74[_0x171f('0x21')]();};}function saveUpdates(_0x580a25,_0x529ee3){return function(_0x5896d7){if(_0x5896d7){return _0x5896d7[_0x171f('0x22')](_0x580a25)[_0x171f('0x23')](function(_0x4007d9){return _0x4007d9;});}return null;};}function removeEntity(_0x4d7ac9,_0x24dea5){return function(_0x3cef51){if(_0x3cef51){return _0x3cef51[_0x171f('0x24')]()[_0x171f('0x23')](function(){var _0x5370c9=_0x3cef51[_0x171f('0x25')]({'plain':!![]});var _0x12c83b='ODBC';return db[_0x171f('0x26')][_0x171f('0x24')]({'where':{'type':_0x12c83b,'resourceId':_0x5370c9['id']}})[_0x171f('0x23')](function(){return _0x3cef51;});})['then'](function(){_0x4d7ac9[_0x171f('0x27')](0xcc)[_0x171f('0x1a')]();});}};}function handleEntityNotFound(_0x2a18fc,_0x53964f){return function(_0x2ced51){if(!_0x2ced51){_0x2a18fc[_0x171f('0x19')](0x194);}return _0x2ced51;};}function handleError(_0x5c82f4,_0x5c31c9){_0x5c31c9=_0x5c31c9||0x1f4;return function(_0x313c9c){logger[_0x171f('0x28')](_0x313c9c[_0x171f('0x29')]);if(_0x313c9c[_0x171f('0x2a')]){delete _0x313c9c[_0x171f('0x2a')];}_0x5c82f4[_0x171f('0x27')](_0x5c31c9)['send'](_0x313c9c);};}exports[_0x171f('0x2b')]=function(_0x179a5a,_0x3e8a89){var _0x46844c={},_0x436974={},_0x2cbe55={'count':0x0,'rows':[]};var _0x3ea9cf=_[_0x171f('0x2c')](db['SquareOdbc']['rawAttributes'],function(_0x1e6132){return{'name':_0x1e6132['fieldName'],'type':_0x1e6132[_0x171f('0x2d')][_0x171f('0x2e')]};});_0x436974[_0x171f('0x2f')]=_[_0x171f('0x2c')](_0x3ea9cf,_0x171f('0x2a'));_0x436974[_0x171f('0x30')]=_['keys'](_0x179a5a[_0x171f('0x30')]);_0x436974[_0x171f('0x31')]=_['intersection'](_0x436974['model'],_0x436974[_0x171f('0x30')]);_0x46844c[_0x171f('0x32')]=_[_0x171f('0x33')](_0x436974[_0x171f('0x2f')],qs[_0x171f('0x34')](_0x179a5a['query'][_0x171f('0x34')]));_0x46844c[_0x171f('0x32')]=_0x46844c['attributes'][_0x171f('0x35')]?_0x46844c[_0x171f('0x32')]:_0x436974[_0x171f('0x2f')];if(!_0x179a5a[_0x171f('0x30')]['hasOwnProperty']('nolimit')){_0x46844c['limit']=qs[_0x171f('0x1e')](_0x179a5a[_0x171f('0x30')][_0x171f('0x1e')]);_0x46844c[_0x171f('0x1d')]=qs['offset'](_0x179a5a[_0x171f('0x30')][_0x171f('0x1d')]);}_0x46844c['order']=qs[_0x171f('0x36')](_0x179a5a[_0x171f('0x30')]['sort']);_0x46844c[_0x171f('0x37')]=qs['filters'](_['pick'](_0x179a5a[_0x171f('0x30')],_0x436974[_0x171f('0x31')]),_0x3ea9cf);if(_0x179a5a[_0x171f('0x30')]['filter']){_0x46844c[_0x171f('0x37')]=_['merge'](_0x46844c[_0x171f('0x37')],{'$or':_['map'](_0x3ea9cf,function(_0x1de09e){if(_0x1de09e[_0x171f('0x2d')]!=='VIRTUAL'){var _0x3d2f94={};_0x3d2f94[_0x1de09e[_0x171f('0x2a')]]={'$like':'%'+_0x179a5a[_0x171f('0x30')][_0x171f('0x38')]+'%'};return _0x3d2f94;}})});}_0x46844c=_[_0x171f('0x39')]({},_0x46844c,_0x179a5a[_0x171f('0x3a')]);var _0x81d08a={'where':_0x46844c[_0x171f('0x37')]};return db['SquareOdbc']['count'](_0x81d08a)['then'](function(_0x4780c9){_0x2cbe55[_0x171f('0x1c')]=_0x4780c9;if(_0x179a5a[_0x171f('0x30')][_0x171f('0x3b')]){_0x46844c[_0x171f('0x3c')]=[{'all':!![]}];}return db[_0x171f('0x3d')][_0x171f('0x3e')](_0x46844c);})['then'](function(_0x306bc4){_0x2cbe55['rows']=_0x306bc4;return _0x2cbe55;})[_0x171f('0x23')](respondWithFilteredResult(_0x3e8a89,_0x46844c))['catch'](handleError(_0x3e8a89,null));};exports[_0x171f('0x3f')]=function(_0x2e6de3,_0x3d9f63){var _0x4bb576={'raw':!![],'where':{'id':_0x2e6de3[_0x171f('0x40')]['id']}},_0x49e7fb={};_0x49e7fb[_0x171f('0x2f')]=_[_0x171f('0x41')](db[_0x171f('0x3d')][_0x171f('0x42')]);_0x49e7fb[_0x171f('0x30')]=_[_0x171f('0x41')](_0x2e6de3[_0x171f('0x30')]);_0x49e7fb[_0x171f('0x31')]=_[_0x171f('0x33')](_0x49e7fb[_0x171f('0x2f')],_0x49e7fb[_0x171f('0x30')]);_0x4bb576[_0x171f('0x32')]=_[_0x171f('0x33')](_0x49e7fb['model'],qs['fields'](_0x2e6de3[_0x171f('0x30')]['fields']));_0x4bb576['attributes']=_0x4bb576['attributes'][_0x171f('0x35')]?_0x4bb576['attributes']:_0x49e7fb[_0x171f('0x2f')];if(_0x2e6de3[_0x171f('0x30')][_0x171f('0x3b')]){_0x4bb576['include']=[{'all':!![]}];}_0x4bb576=_[_0x171f('0x39')]({},_0x4bb576,_0x2e6de3[_0x171f('0x3a')]);return db[_0x171f('0x3d')]['find'](_0x4bb576)[_0x171f('0x23')](handleEntityNotFound(_0x3d9f63,null))[_0x171f('0x23')](respondWithResult(_0x3d9f63,null))[_0x171f('0x43')](handleError(_0x3d9f63,null));};exports['create']=function(_0x508ca9,_0x3292d9){return db[_0x171f('0x3d')][_0x171f('0x44')](_0x508ca9[_0x171f('0x45')],{})[_0x171f('0x23')](function(_0x51d47d){var _0x204447=_0x508ca9['user'][_0x171f('0x25')]({'plain':!![]});if(!_0x204447)throw new Error(_0x171f('0x46'));if(_0x204447[_0x171f('0x47')]===_0x171f('0x48')){var _0xd85742=_0x51d47d[_0x171f('0x25')]({'plain':!![]});var _0x2ded7a=_0x171f('0x49');return db['UserProfileSection'][_0x171f('0x4a')]({'where':{'name':_0x2ded7a,'userProfileId':_0x204447['userProfileId']},'raw':!![]})[_0x171f('0x23')](function(_0x5be899){if(_0x5be899&&_0x5be899[_0x171f('0x4b')]===0x0){return db[_0x171f('0x26')]['create']({'name':_0xd85742['name'],'resourceId':_0xd85742['id'],'type':_0x5be899[_0x171f('0x2a')],'sectionId':_0x5be899['id']},{})[_0x171f('0x23')](function(){return _0x51d47d;});}else{return _0x51d47d;}})[_0x171f('0x43')](function(_0x53ec8a){logger[_0x171f('0x28')](_0x171f('0x4c'),_0x53ec8a);throw _0x53ec8a;});}return _0x51d47d;})[_0x171f('0x23')](respondWithResult(_0x3292d9,0xc9))[_0x171f('0x43')](handleError(_0x3292d9,null));};exports[_0x171f('0x22')]=function(_0x56c2ef,_0x1d5902){if(_0x56c2ef['body']['id']){delete _0x56c2ef[_0x171f('0x45')]['id'];}return db['SquareOdbc'][_0x171f('0x4a')]({'where':{'id':_0x56c2ef[_0x171f('0x40')]['id']}})[_0x171f('0x23')](handleEntityNotFound(_0x1d5902,null))[_0x171f('0x23')](saveUpdates(_0x56c2ef['body'],null))[_0x171f('0x23')](respondWithResult(_0x1d5902,null))[_0x171f('0x43')](handleError(_0x1d5902,null));};exports[_0x171f('0x24')]=function(_0x35c6d2,_0x3e25ca){return db['SquareOdbc']['find']({'where':{'id':_0x35c6d2['params']['id']}})[_0x171f('0x23')](handleEntityNotFound(_0x3e25ca,null))[_0x171f('0x23')](removeEntity(_0x3e25ca,null))[_0x171f('0x43')](handleError(_0x3e25ca,null));};exports[_0x171f('0x4d')]=function(_0x15e9f2,_0x56fecf,_0x3d0eb2){var _0x2a1037;return db[_0x171f('0x3d')]['find']({'where':{'id':_0x15e9f2[_0x171f('0x40')]['id']},'attributes':['id',_0x171f('0x4e')]})['then'](handleEntityNotFound(_0x56fecf,null))['then'](function(_0x534717){if(_0x534717){var _0x3ed900=require(_0x171f('0x4f'))();_0x3ed900[_0x171f('0x50')](_0x534717[_0x171f('0x4e')]);_0x3ed900[_0x171f('0x51')]();return _0x534717;}})['then'](respondWithResult(_0x56fecf,null))[_0x171f('0x43')](handleError(_0x56fecf,null));}; \ No newline at end of file +var _0x1255=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','map','SquareOdbc','fieldName','type','key','model','keys','query','filters','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','intersection','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','test','dsn','odbc','openSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x43a44a,_0x45892b){var _0x3c8ad8=function(_0x5da24e){while(--_0x5da24e){_0x43a44a['push'](_0x43a44a['shift']());}};_0x3c8ad8(++_0x45892b);}(_0x1255,0x141));var _0x5125=function(_0x828718,_0x258f7b){_0x828718=_0x828718-0x0;var _0x533f2c=_0x1255[_0x828718];return _0x533f2c;};'use strict';var pdf=require(_0x5125('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5125('0x1'));var zipdir=require(_0x5125('0x2'));var jsonpatch=require(_0x5125('0x3'));var rp=require(_0x5125('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5125('0x5'));var util=require('util');var path=require(_0x5125('0x6'));var sox=require('sox');var csv=require(_0x5125('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5125('0x8'));var squel=require(_0x5125('0x9'));var crypto=require(_0x5125('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5125('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5125('0xc'));var Papa=require(_0x5125('0xd'));var Redis=require(_0x5125('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5125('0xf'));var hardwareService=require(_0x5125('0x10'));var logger=require('../../config/logger')(_0x5125('0x11'));var utils=require(_0x5125('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x5125('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bfd10,_0x2d26bc){_0x2d26bc=_0x2d26bc||0xcc;return function(_0x279552){if(_0x279552){return _0x3bfd10[_0x5125('0x14')](_0x2d26bc);}return _0x3bfd10[_0x5125('0x15')](_0x2d26bc)[_0x5125('0x16')]();};}function respondWithResult(_0x3de804,_0x4f44ad){_0x4f44ad=_0x4f44ad||0xc8;return function(_0x507531){if(_0x507531){return _0x3de804['status'](_0x4f44ad)[_0x5125('0x17')](_0x507531);}};}function respondWithFilteredResult(_0x4d09ef,_0x145579){return function(_0x14bf0c){if(_0x14bf0c){var _0x5392a8=_0x14bf0c[_0x5125('0x18')],_0x39b24a=_0x145579['offset'],_0x491a4f=_0x145579[_0x5125('0x19')]+_0x145579['limit'],_0x237c24;if(_0x491a4f>=_0x5392a8){_0x491a4f=_0x5392a8;_0x237c24=0xc8;}else{_0x237c24=0xce;}_0x4d09ef[_0x5125('0x15')](_0x237c24);return _0x4d09ef[_0x5125('0x1a')](_0x5125('0x1b'),_0x39b24a+'-'+_0x491a4f+'/'+_0x5392a8)[_0x5125('0x17')](_0x14bf0c);}return null;};}function patchUpdates(_0x1bb86e){return function(_0x301afd){try{jsonpatch[_0x5125('0x1c')](_0x301afd,_0x1bb86e,!![]);}catch(_0x251c07){return BPromise[_0x5125('0x1d')](_0x251c07);}return _0x301afd['save']();};}function saveUpdates(_0x40eed3,_0x1a26d9){return function(_0x2af9a9){if(_0x2af9a9){return _0x2af9a9[_0x5125('0x1e')](_0x40eed3)[_0x5125('0x1f')](function(_0x52c26b){return _0x52c26b;});}return null;};}function removeEntity(_0x325251,_0x3c1c63){return function(_0x39b7be){if(_0x39b7be){return _0x39b7be[_0x5125('0x20')]()[_0x5125('0x1f')](function(){var _0x21d7cf=_0x39b7be[_0x5125('0x21')]({'plain':!![]});var _0x3762ef=_0x5125('0x22');return db[_0x5125('0x23')][_0x5125('0x20')]({'where':{'type':_0x3762ef,'resourceId':_0x21d7cf['id']}})[_0x5125('0x1f')](function(){return _0x39b7be;});})[_0x5125('0x1f')](function(){_0x325251[_0x5125('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fc990,_0x553714){return function(_0xd37494){if(!_0xd37494){_0x1fc990[_0x5125('0x14')](0x194);}return _0xd37494;};}function handleError(_0x5e00f0,_0xdb249e){_0xdb249e=_0xdb249e||0x1f4;return function(_0x306434){logger[_0x5125('0x24')](_0x306434[_0x5125('0x25')]);if(_0x306434[_0x5125('0x26')]){delete _0x306434[_0x5125('0x26')];}_0x5e00f0[_0x5125('0x15')](_0xdb249e)[_0x5125('0x27')](_0x306434);};}exports['index']=function(_0x195f95,_0x2464b1){var _0x4701b2={},_0x48b08f={},_0x14c6e9={'count':0x0,'rows':[]};var _0x177591=_[_0x5125('0x28')](db[_0x5125('0x29')]['rawAttributes'],function(_0x27c8f1){return{'name':_0x27c8f1[_0x5125('0x2a')],'type':_0x27c8f1[_0x5125('0x2b')][_0x5125('0x2c')]};});_0x48b08f[_0x5125('0x2d')]=_[_0x5125('0x28')](_0x177591,_0x5125('0x26'));_0x48b08f['query']=_[_0x5125('0x2e')](_0x195f95[_0x5125('0x2f')]);_0x48b08f[_0x5125('0x30')]=_['intersection'](_0x48b08f[_0x5125('0x2d')],_0x48b08f[_0x5125('0x2f')]);_0x4701b2['attributes']=_['intersection'](_0x48b08f[_0x5125('0x2d')],qs['fields'](_0x195f95[_0x5125('0x2f')][_0x5125('0x31')]));_0x4701b2['attributes']=_0x4701b2[_0x5125('0x32')]['length']?_0x4701b2[_0x5125('0x32')]:_0x48b08f['model'];if(!_0x195f95[_0x5125('0x2f')][_0x5125('0x33')](_0x5125('0x34'))){_0x4701b2[_0x5125('0x35')]=qs['limit'](_0x195f95[_0x5125('0x2f')][_0x5125('0x35')]);_0x4701b2['offset']=qs['offset'](_0x195f95['query'][_0x5125('0x19')]);}_0x4701b2[_0x5125('0x36')]=qs[_0x5125('0x37')](_0x195f95[_0x5125('0x2f')][_0x5125('0x37')]);_0x4701b2[_0x5125('0x38')]=qs[_0x5125('0x30')](_[_0x5125('0x39')](_0x195f95[_0x5125('0x2f')],_0x48b08f[_0x5125('0x30')]),_0x177591);if(_0x195f95['query'][_0x5125('0x3a')]){_0x4701b2['where']=_[_0x5125('0x3b')](_0x4701b2[_0x5125('0x38')],{'$or':_['map'](_0x177591,function(_0x1910d1){if(_0x1910d1['type']!==_0x5125('0x3c')){var _0x12cde0={};_0x12cde0[_0x1910d1[_0x5125('0x26')]]={'$like':'%'+_0x195f95[_0x5125('0x2f')][_0x5125('0x3a')]+'%'};return _0x12cde0;}})});}_0x4701b2=_['merge']({},_0x4701b2,_0x195f95['options']);var _0x55c628={'where':_0x4701b2['where']};return db[_0x5125('0x29')][_0x5125('0x18')](_0x55c628)[_0x5125('0x1f')](function(_0x25b548){_0x14c6e9[_0x5125('0x18')]=_0x25b548;if(_0x195f95[_0x5125('0x2f')][_0x5125('0x3d')]){_0x4701b2[_0x5125('0x3e')]=[{'all':!![]}];}return db[_0x5125('0x29')]['findAll'](_0x4701b2);})[_0x5125('0x1f')](function(_0x33c905){_0x14c6e9[_0x5125('0x3f')]=_0x33c905;return _0x14c6e9;})['then'](respondWithFilteredResult(_0x2464b1,_0x4701b2))[_0x5125('0x40')](handleError(_0x2464b1,null));};exports[_0x5125('0x41')]=function(_0x3d8233,_0x2d9f1d){var _0x4f7ede={'raw':!![],'where':{'id':_0x3d8233[_0x5125('0x42')]['id']}},_0x3dcae1={};_0x3dcae1[_0x5125('0x2d')]=_['keys'](db[_0x5125('0x29')][_0x5125('0x43')]);_0x3dcae1['query']=_[_0x5125('0x2e')](_0x3d8233['query']);_0x3dcae1[_0x5125('0x30')]=_[_0x5125('0x44')](_0x3dcae1[_0x5125('0x2d')],_0x3dcae1[_0x5125('0x2f')]);_0x4f7ede[_0x5125('0x32')]=_[_0x5125('0x44')](_0x3dcae1['model'],qs[_0x5125('0x31')](_0x3d8233['query']['fields']));_0x4f7ede[_0x5125('0x32')]=_0x4f7ede[_0x5125('0x32')][_0x5125('0x45')]?_0x4f7ede[_0x5125('0x32')]:_0x3dcae1[_0x5125('0x2d')];if(_0x3d8233[_0x5125('0x2f')]['includeAll']){_0x4f7ede[_0x5125('0x3e')]=[{'all':!![]}];}_0x4f7ede=_['merge']({},_0x4f7ede,_0x3d8233[_0x5125('0x46')]);return db[_0x5125('0x29')][_0x5125('0x47')](_0x4f7ede)[_0x5125('0x1f')](handleEntityNotFound(_0x2d9f1d,null))[_0x5125('0x1f')](respondWithResult(_0x2d9f1d,null))[_0x5125('0x40')](handleError(_0x2d9f1d,null));};exports[_0x5125('0x48')]=function(_0x4bb6aa,_0x3fca2c){return db[_0x5125('0x29')][_0x5125('0x48')](_0x4bb6aa[_0x5125('0x49')],{})[_0x5125('0x1f')](function(_0x173685){var _0x21a14d=_0x4bb6aa[_0x5125('0x4a')]['get']({'plain':!![]});if(!_0x21a14d)throw new Error(_0x5125('0x4b'));if(_0x21a14d[_0x5125('0x4c')]===_0x5125('0x4a')){var _0x45baf1=_0x173685['get']({'plain':!![]});var _0x15f49c=_0x5125('0x22');return db[_0x5125('0x4d')][_0x5125('0x47')]({'where':{'name':_0x15f49c,'userProfileId':_0x21a14d[_0x5125('0x4e')]},'raw':!![]})[_0x5125('0x1f')](function(_0x102de6){if(_0x102de6&&_0x102de6[_0x5125('0x4f')]===0x0){return db[_0x5125('0x23')][_0x5125('0x48')]({'name':_0x45baf1[_0x5125('0x26')],'resourceId':_0x45baf1['id'],'type':_0x102de6[_0x5125('0x26')],'sectionId':_0x102de6['id']},{})[_0x5125('0x1f')](function(){return _0x173685;});}else{return _0x173685;}})['catch'](function(_0x3f80c2){logger[_0x5125('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f80c2);throw _0x3f80c2;});}return _0x173685;})[_0x5125('0x1f')](respondWithResult(_0x3fca2c,0xc9))[_0x5125('0x40')](handleError(_0x3fca2c,null));};exports[_0x5125('0x1e')]=function(_0xb15213,_0x4dd212){if(_0xb15213[_0x5125('0x49')]['id']){delete _0xb15213[_0x5125('0x49')]['id'];}return db[_0x5125('0x29')][_0x5125('0x47')]({'where':{'id':_0xb15213[_0x5125('0x42')]['id']}})[_0x5125('0x1f')](handleEntityNotFound(_0x4dd212,null))[_0x5125('0x1f')](saveUpdates(_0xb15213[_0x5125('0x49')],null))[_0x5125('0x1f')](respondWithResult(_0x4dd212,null))[_0x5125('0x40')](handleError(_0x4dd212,null));};exports[_0x5125('0x20')]=function(_0x999aa9,_0x2b1bca){return db[_0x5125('0x29')]['find']({'where':{'id':_0x999aa9[_0x5125('0x42')]['id']}})[_0x5125('0x1f')](handleEntityNotFound(_0x2b1bca,null))['then'](removeEntity(_0x2b1bca,null))[_0x5125('0x40')](handleError(_0x2b1bca,null));};exports[_0x5125('0x50')]=function(_0x434eef,_0x49284d,_0x5026bd){var _0x40af48;return db['SquareOdbc'][_0x5125('0x47')]({'where':{'id':_0x434eef[_0x5125('0x42')]['id']},'attributes':['id',_0x5125('0x51')]})['then'](handleEntityNotFound(_0x49284d,null))[_0x5125('0x1f')](function(_0x20b9db){if(_0x20b9db){var _0x1813ef=require(_0x5125('0x52'))();_0x1813ef[_0x5125('0x53')](_0x20b9db[_0x5125('0x51')]);_0x1813ef['closeSync']();return _0x20b9db;}})[_0x5125('0x1f')](respondWithResult(_0x49284d,null))[_0x5125('0x40')](handleError(_0x49284d,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 5204ceb..e53c5b7 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 _0xc97f=['../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2878d5,_0x4539de){var _0x1b86b0=function(_0x5a8ce8){while(--_0x5a8ce8){_0x2878d5['push'](_0x2878d5['shift']());}};_0x1b86b0(++_0x4539de);}(_0xc97f,0x102));var _0xfc97=function(_0x13db5f,_0x4ea2c6){_0x13db5f=_0x13db5f-0x0;var _0x8b35b0=_0xc97f[_0x13db5f];return _0x8b35b0;};'use strict';var _=require(_0xfc97('0x0'));var util=require('util');var logger=require(_0xfc97('0x1'))(_0xfc97('0x2'));var moment=require(_0xfc97('0x3'));var BPromise=require(_0xfc97('0x4'));var rp=require(_0xfc97('0x5'));var fs=require('fs');var path=require(_0xfc97('0x6'));var rimraf=require(_0xfc97('0x7'));var config=require(_0xfc97('0x8'));var attributes=require(_0xfc97('0x9'));module[_0xfc97('0xa')]=function(_0x10c0db,_0x44704f){return _0x10c0db[_0xfc97('0xb')](_0xfc97('0xc'),attributes,{'tableName':_0xfc97('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bec=['SquareOdbc','square_odbc','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x5df16b,_0x10f470){var _0x36ce09=function(_0x1f9310){while(--_0x1f9310){_0x5df16b['push'](_0x5df16b['shift']());}};_0x36ce09(++_0x10f470);}(_0x8bec,0x6e));var _0xc8be=function(_0x78987f,_0x446616){_0x78987f=_0x78987f-0x0;var _0x129c52=_0x8bec[_0x78987f];return _0x129c52;};'use strict';var _=require(_0xc8be('0x0'));var util=require(_0xc8be('0x1'));var logger=require(_0xc8be('0x2'))(_0xc8be('0x3'));var moment=require('moment');var BPromise=require(_0xc8be('0x4'));var rp=require(_0xc8be('0x5'));var fs=require('fs');var path=require(_0xc8be('0x6'));var rimraf=require(_0xc8be('0x7'));var config=require(_0xc8be('0x8'));var attributes=require(_0xc8be('0x9'));module['exports']=function(_0x400b1c,_0x4f79fb){return _0x400b1c['define'](_0xc8be('0xa'),attributes,{'tableName':_0xc8be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 4567c6a..058690a 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(_0x4fd156,_0x146f0a){var _0x325bea=function(_0x5743fe){while(--_0x5743fe){_0x4fd156['push'](_0x4fd156['shift']());}};_0x325bea(++_0x146f0a);}(_0x7217,0x19e));var _0x7721=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x7217[_0x387777];return _0x3f84c0;};'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(_0x25567b,_0x1340e4){var _0x4383eb=function(_0x5e03a1){while(--_0x5e03a1){_0x25567b['push'](_0x25567b['shift']());}};_0x4383eb(++_0x1340e4);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 2de9ced..58059ed 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 _0x7910=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','/:id/users','put','update','destroy','delete','removeUsers','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2779ba,_0x29dfd3){var _0x5952ff=function(_0x9d0459){while(--_0x9d0459){_0x2779ba['push'](_0x2779ba['shift']());}};_0x5952ff(++_0x29dfd3);}(_0x7910,0xcd));var _0x0791=function(_0x1d7300,_0x17f109){_0x1d7300=_0x1d7300-0x0;var _0x46ee98=_0x7910[_0x1d7300];return _0x46ee98;};'use strict';var multer=require(_0x0791('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0791('0x1'));var express=require(_0x0791('0x2'));var router=express[_0x0791('0x3')]();var auth=require(_0x0791('0x4'));var interaction=require(_0x0791('0x5'));var config=require(_0x0791('0x6'));var controller=require('./squareProject.controller');router[_0x0791('0x7')]('/',auth[_0x0791('0x8')](),controller[_0x0791('0x9')]);router[_0x0791('0x7')](_0x0791('0xa'),auth[_0x0791('0x8')](),controller[_0x0791('0xb')]);router[_0x0791('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getUsers']);router[_0x0791('0xc')]('/',auth[_0x0791('0x8')](),controller[_0x0791('0xd')]);router[_0x0791('0xc')](_0x0791('0xe'),auth[_0x0791('0x8')](),controller['addUsers']);router[_0x0791('0xf')]('/:id',auth[_0x0791('0x8')](),controller[_0x0791('0x10')]);router['delete'](_0x0791('0xa'),auth[_0x0791('0x8')](),controller[_0x0791('0x11')]);router[_0x0791('0x12')]('/:id/users',auth[_0x0791('0x8')](),controller[_0x0791('0x13')]);module[_0x0791('0x14')]=router; \ No newline at end of file +var _0xda42=['Router','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','show','getUsers','post','/:id/users','addUsers','put','/:id','update','delete','destroy','multer','path','express'];(function(_0x5cb3eb,_0x30bd6f){var _0x1ecdf1=function(_0x9cdf1a){while(--_0x9cdf1a){_0x5cb3eb['push'](_0x5cb3eb['shift']());}};_0x1ecdf1(++_0x30bd6f);}(_0xda42,0x1d8));var _0x2da4=function(_0x2bb892,_0x159e03){_0x2bb892=_0x2bb892-0x0;var _0x524190=_0xda42[_0x2bb892];return _0x524190;};'use strict';var multer=require(_0x2da4('0x0'));var util=require('util');var path=require(_0x2da4('0x1'));var timeout=require('connect-timeout');var express=require(_0x2da4('0x2'));var router=express[_0x2da4('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2da4('0x4'));var config=require(_0x2da4('0x5'));var controller=require(_0x2da4('0x6'));router[_0x2da4('0x7')]('/',auth[_0x2da4('0x8')](),controller['index']);router[_0x2da4('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2da4('0x9')]);router[_0x2da4('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x2da4('0xa')]);router[_0x2da4('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2da4('0xb')](_0x2da4('0xc'),auth[_0x2da4('0x8')](),controller[_0x2da4('0xd')]);router[_0x2da4('0xe')](_0x2da4('0xf'),auth[_0x2da4('0x8')](),controller[_0x2da4('0x10')]);router[_0x2da4('0x11')]('/:id',auth[_0x2da4('0x8')](),controller[_0x2da4('0x12')]);router[_0x2da4('0x11')](_0x2da4('0xc'),auth['isAuthenticated'](),controller['removeUsers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index de676f0..72da14e 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 _0xd187=['name','TEXT','BLOB','preproduction','getDataValue','toString','utf8','long','production','DATE','exports','STRING'];(function(_0x5f0937,_0x1bb8d7){var _0x82117e=function(_0x1acb23){while(--_0x1acb23){_0x5f0937['push'](_0x5f0937['shift']());}};_0x82117e(++_0x1bb8d7);}(_0xd187,0x1ba));var _0x7d18=function(_0x56daff,_0xadca9a){_0x56daff=_0x56daff-0x0;var _0x132c82=_0xd187[_0x56daff];return _0x132c82;};'use strict';var Sequelize=require('sequelize');module[_0x7d18('0x0')]={'name':{'type':Sequelize[_0x7d18('0x1')],'unique':_0x7d18('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7d18('0x1')]},'notes':{'type':Sequelize[_0x7d18('0x3')]},'preproduction':{'type':Sequelize[_0x7d18('0x4')]('long'),'get':function(){if(this['getDataValue'](_0x7d18('0x5'))){return this[_0x7d18('0x6')](_0x7d18('0x5'))[_0x7d18('0x7')](_0x7d18('0x8'));}}},'production':{'type':Sequelize[_0x7d18('0x4')](_0x7d18('0x9')),'get':function(){if(this[_0x7d18('0x6')](_0x7d18('0xa'))){return this[_0x7d18('0x6')](_0x7d18('0xa'))[_0x7d18('0x7')](_0x7d18('0x8'));}}},'savedAt':{'type':Sequelize[_0x7d18('0xb')]},'publishedAt':{'type':Sequelize[_0x7d18('0xb')]}}; \ No newline at end of file +var _0xba58=['long','getDataValue','toString','utf8','production','DATE','name','STRING'];(function(_0x216beb,_0x331aa8){var _0x2010e3=function(_0x39cd4d){while(--_0x39cd4d){_0x216beb['push'](_0x216beb['shift']());}};_0x2010e3(++_0x331aa8);}(_0xba58,0x166));var _0x8ba5=function(_0x1808d7,_0x5daa82){_0x1808d7=_0x1808d7-0x0;var _0x54185e=_0xba58[_0x1808d7];return _0x54185e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8ba5('0x0'),'allowNull':![]},'description':{'type':Sequelize[_0x8ba5('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x8ba5('0x2')),'get':function(){if(this[_0x8ba5('0x3')]('preproduction')){return this[_0x8ba5('0x3')]('preproduction')[_0x8ba5('0x4')](_0x8ba5('0x5'));}}},'production':{'type':Sequelize['BLOB'](_0x8ba5('0x2')),'get':function(){if(this['getDataValue'](_0x8ba5('0x6'))){return this[_0x8ba5('0x3')](_0x8ba5('0x6'))[_0x8ba5('0x4')]('utf8');}}},'savedAt':{'type':Sequelize[_0x8ba5('0x7')]},'publishedAt':{'type':Sequelize[_0x8ba5('0x7')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index b92debf..2405412 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 _0xcc32=['include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','addUsers','ids','omit','removeUsers','userSquareProject:remove','emit','getUsers','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','squel','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','redis','defaults','./squareProject.socket','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','SquareProjects','end','error','stack','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','name','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xcc32,0x138));var _0x2cc3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xcc32[_0x1d1779];return _0x2377e9;};'use strict';var pdf=require(_0x2cc3('0x0'));var emlformat=require(_0x2cc3('0x1'));var rimraf=require(_0x2cc3('0x2'));var zipdir=require(_0x2cc3('0x3'));var jsonpatch=require(_0x2cc3('0x4'));var rp=require(_0x2cc3('0x5'));var moment=require(_0x2cc3('0x6'));var BPromise=require(_0x2cc3('0x7'));var Mustache=require('mustache');var util=require(_0x2cc3('0x8'));var path=require(_0x2cc3('0x9'));var sox=require(_0x2cc3('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2cc3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2cc3('0xc'));var toCsv=require(_0x2cc3('0xd'));var querystring=require(_0x2cc3('0xe'));var Papa=require(_0x2cc3('0xf'));var Redis=require(_0x2cc3('0x10'));var authService=require(_0x2cc3('0x11'));var qs=require(_0x2cc3('0x12'));var as=require(_0x2cc3('0x13'));var hardwareService=require(_0x2cc3('0x14'));var logger=require(_0x2cc3('0x15'))(_0x2cc3('0x16'));var utils=require(_0x2cc3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2cc3('0x18'));var db=require(_0x2cc3('0x19'))['db'];config[_0x2cc3('0x1a')]=_[_0x2cc3('0x1b')](config[_0x2cc3('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2cc3('0x1a')]));require(_0x2cc3('0x1c'))['register'](socket);function respondWithStatusCode(_0x45d54f,_0x3e17a7){_0x3e17a7=_0x3e17a7||0xcc;return function(_0x4f6e76){if(_0x4f6e76){return _0x45d54f[_0x2cc3('0x1d')](_0x3e17a7);}return _0x45d54f[_0x2cc3('0x1e')](_0x3e17a7)['end']();};}function respondWithResult(_0x142255,_0x3cdf30){_0x3cdf30=_0x3cdf30||0xc8;return function(_0x5c5767){if(_0x5c5767){return _0x142255['status'](_0x3cdf30)[_0x2cc3('0x1f')](_0x5c5767);}};}function respondWithFilteredResult(_0x536b3c,_0x37ccfe){return function(_0x4baf3e){if(_0x4baf3e){var _0x5d4ac2=_0x4baf3e[_0x2cc3('0x20')],_0x4aa660=_0x37ccfe[_0x2cc3('0x21')],_0x3f7f7e=_0x37ccfe[_0x2cc3('0x21')]+_0x37ccfe[_0x2cc3('0x22')],_0x1843b7;if(_0x3f7f7e>=_0x5d4ac2){_0x3f7f7e=_0x5d4ac2;_0x1843b7=0xc8;}else{_0x1843b7=0xce;}_0x536b3c['status'](_0x1843b7);return _0x536b3c['set']('Content-Range',_0x4aa660+'-'+_0x3f7f7e+'/'+_0x5d4ac2)[_0x2cc3('0x1f')](_0x4baf3e);}return null;};}function patchUpdates(_0x5114d2){return function(_0x37cb2d){try{jsonpatch[_0x2cc3('0x23')](_0x37cb2d,_0x5114d2,!![]);}catch(_0x17a405){return BPromise[_0x2cc3('0x24')](_0x17a405);}return _0x37cb2d[_0x2cc3('0x25')]();};}function saveUpdates(_0x3f3d2e,_0x2d7278){return function(_0x3e0b71){if(_0x3e0b71){return _0x3e0b71[_0x2cc3('0x26')](_0x3f3d2e)[_0x2cc3('0x27')](function(_0xa268ba){return _0xa268ba;});}return null;};}function removeEntity(_0x3fdd0b,_0x2a189f){return function(_0x32b066){if(_0x32b066){return _0x32b066[_0x2cc3('0x28')]()[_0x2cc3('0x27')](function(){var _0x3320de=_0x32b066['get']({'plain':!![]});var _0x94a91f=_0x2cc3('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x94a91f,'resourceId':_0x3320de['id']}})['then'](function(){return _0x32b066;});})[_0x2cc3('0x27')](function(){_0x3fdd0b['status'](0xcc)[_0x2cc3('0x2a')]();});}};}function handleEntityNotFound(_0x4e9dfc,_0x257db6){return function(_0x2be55f){if(!_0x2be55f){_0x4e9dfc['sendStatus'](0x194);}return _0x2be55f;};}function handleError(_0xda24f6,_0x2f4d03){_0x2f4d03=_0x2f4d03||0x1f4;return function(_0x5bb21e){logger[_0x2cc3('0x2b')](_0x5bb21e[_0x2cc3('0x2c')]);if(_0x5bb21e['name']){delete _0x5bb21e['name'];}_0xda24f6['status'](_0x2f4d03)[_0x2cc3('0x2d')](_0x5bb21e);};}exports[_0x2cc3('0x2e')]=function(_0x1a99a4,_0x4d9bf0){var _0x3c20d5={},_0x41ed80={},_0x59f76c={'count':0x0,'rows':[]};var _0x421576=_[_0x2cc3('0x2f')](db[_0x2cc3('0x30')][_0x2cc3('0x31')],function(_0x5623d8){return{'name':_0x5623d8[_0x2cc3('0x32')],'type':_0x5623d8[_0x2cc3('0x33')][_0x2cc3('0x34')]};});_0x41ed80[_0x2cc3('0x35')]=_[_0x2cc3('0x2f')](_0x421576,_0x2cc3('0x36'));_0x41ed80['query']=_[_0x2cc3('0x37')](_0x1a99a4[_0x2cc3('0x38')]);_0x41ed80['filters']=_['intersection'](_0x41ed80[_0x2cc3('0x35')],_0x41ed80[_0x2cc3('0x38')]);_0x3c20d5[_0x2cc3('0x39')]=_[_0x2cc3('0x3a')](_0x41ed80['model'],qs['fields'](_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x3b')]));_0x3c20d5[_0x2cc3('0x39')]=_0x3c20d5['attributes'][_0x2cc3('0x3c')]?_0x3c20d5[_0x2cc3('0x39')]:_0x41ed80[_0x2cc3('0x35')];if(!_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x3d')](_0x2cc3('0x3e'))){_0x3c20d5['limit']=qs[_0x2cc3('0x22')](_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x22')]);_0x3c20d5[_0x2cc3('0x21')]=qs[_0x2cc3('0x21')](_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x21')]);}_0x3c20d5[_0x2cc3('0x3f')]=qs[_0x2cc3('0x40')](_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x40')]);_0x3c20d5[_0x2cc3('0x41')]=qs[_0x2cc3('0x42')](_[_0x2cc3('0x43')](_0x1a99a4['query'],_0x41ed80[_0x2cc3('0x42')]),_0x421576);if(_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x44')]){_0x3c20d5['where']=_[_0x2cc3('0x45')](_0x3c20d5[_0x2cc3('0x41')],{'$or':_[_0x2cc3('0x2f')](_0x421576,function(_0x569c5b){if(_0x569c5b['type']!=='VIRTUAL'){var _0x3e5813={};_0x3e5813[_0x569c5b[_0x2cc3('0x36')]]={'$like':'%'+_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x44')]+'%'};return _0x3e5813;}})});}_0x3c20d5=_['merge']({},_0x3c20d5,_0x1a99a4[_0x2cc3('0x46')]);var _0x238ddf={'where':_0x3c20d5[_0x2cc3('0x41')]};return db[_0x2cc3('0x30')][_0x2cc3('0x20')](_0x238ddf)[_0x2cc3('0x27')](function(_0x2996b6){_0x59f76c[_0x2cc3('0x20')]=_0x2996b6;if(_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x47')]){_0x3c20d5[_0x2cc3('0x48')]=[{'all':!![]}];}return db[_0x2cc3('0x30')][_0x2cc3('0x49')](_0x3c20d5);})[_0x2cc3('0x27')](function(_0x839970){_0x59f76c[_0x2cc3('0x4a')]=_0x839970;return _0x59f76c;})['then'](respondWithFilteredResult(_0x4d9bf0,_0x3c20d5))[_0x2cc3('0x4b')](handleError(_0x4d9bf0,null));};exports[_0x2cc3('0x4c')]=function(_0x561bd0,_0x350b08){var _0x582951={'raw':![],'where':{'id':_0x561bd0[_0x2cc3('0x4d')]['id']}},_0x5a4f4c={};_0x5a4f4c[_0x2cc3('0x35')]=_[_0x2cc3('0x37')](db[_0x2cc3('0x30')]['rawAttributes']);_0x5a4f4c['query']=_[_0x2cc3('0x37')](_0x561bd0[_0x2cc3('0x38')]);_0x5a4f4c[_0x2cc3('0x42')]=_['intersection'](_0x5a4f4c['model'],_0x5a4f4c[_0x2cc3('0x38')]);_0x582951[_0x2cc3('0x39')]=_[_0x2cc3('0x3a')](_0x5a4f4c[_0x2cc3('0x35')],qs[_0x2cc3('0x3b')](_0x561bd0[_0x2cc3('0x38')]['fields']));_0x582951[_0x2cc3('0x39')]=_0x582951[_0x2cc3('0x39')][_0x2cc3('0x3c')]?_0x582951['attributes']:_0x5a4f4c[_0x2cc3('0x35')];if(_0x561bd0[_0x2cc3('0x38')][_0x2cc3('0x47')]){_0x582951[_0x2cc3('0x48')]=[{'all':!![]}];}_0x582951=_['merge']({},_0x582951,_0x561bd0['options']);return db[_0x2cc3('0x30')]['find'](_0x582951)[_0x2cc3('0x27')](handleEntityNotFound(_0x350b08,null))[_0x2cc3('0x27')](respondWithResult(_0x350b08,null))[_0x2cc3('0x4b')](handleError(_0x350b08,null));};exports[_0x2cc3('0x4e')]=function(_0x1dfedf,_0x4a15a4){return db[_0x2cc3('0x30')][_0x2cc3('0x4e')](_0x1dfedf[_0x2cc3('0x4f')],{})[_0x2cc3('0x27')](function(_0x3da920){var _0xefb65d=_0x1dfedf[_0x2cc3('0x50')][_0x2cc3('0x51')]({'plain':!![]});if(!_0xefb65d)throw new Error(_0x2cc3('0x52'));if(_0xefb65d['role']===_0x2cc3('0x50')){var _0xc43329=_0x3da920[_0x2cc3('0x51')]({'plain':!![]});var _0x3a7455='SquareProjects';return db[_0x2cc3('0x53')][_0x2cc3('0x54')]({'where':{'name':_0x3a7455,'userProfileId':_0xefb65d[_0x2cc3('0x55')]},'raw':!![]})['then'](function(_0x40fb1b){if(_0x40fb1b&&_0x40fb1b[_0x2cc3('0x56')]===0x0){return db[_0x2cc3('0x57')][_0x2cc3('0x4e')]({'name':_0xc43329[_0x2cc3('0x36')],'resourceId':_0xc43329['id'],'type':_0x40fb1b[_0x2cc3('0x36')],'sectionId':_0x40fb1b['id']},{})[_0x2cc3('0x27')](function(){return _0x3da920;});}else{return _0x3da920;}})[_0x2cc3('0x4b')](function(_0x103b3b){logger[_0x2cc3('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x103b3b);throw _0x103b3b;});}return _0x3da920;})[_0x2cc3('0x27')](respondWithResult(_0x4a15a4,0xc9))['catch'](handleError(_0x4a15a4,null));};exports[_0x2cc3('0x26')]=function(_0x41ee17,_0x419f2a){if(_0x41ee17[_0x2cc3('0x4f')]['id']){delete _0x41ee17[_0x2cc3('0x4f')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x41ee17['params']['id']}})[_0x2cc3('0x27')](handleEntityNotFound(_0x419f2a,null))[_0x2cc3('0x27')](saveUpdates(_0x41ee17[_0x2cc3('0x4f')],null))[_0x2cc3('0x27')](respondWithResult(_0x419f2a,null))[_0x2cc3('0x4b')](handleError(_0x419f2a,null));};exports['destroy']=function(_0x3c0687,_0xb97838){return db['SquareProject'][_0x2cc3('0x54')]({'where':{'id':_0x3c0687['params']['id']}})[_0x2cc3('0x27')](handleEntityNotFound(_0xb97838,null))['then'](removeEntity(_0xb97838,null))[_0x2cc3('0x4b')](handleError(_0xb97838,null));};exports[_0x2cc3('0x58')]=function(_0x2aa5e2,_0x2e4991,_0x13b3d4){return db[_0x2cc3('0x30')]['find']({'where':{'id':_0x2aa5e2[_0x2cc3('0x4d')]['id']}})[_0x2cc3('0x27')](handleEntityNotFound(_0x2e4991,null))[_0x2cc3('0x27')](function(_0x358994){if(_0x358994){return _0x358994[_0x2cc3('0x58')](_0x2aa5e2['body'][_0x2cc3('0x59')],_[_0x2cc3('0x5a')](_0x2aa5e2['body'],['ids','id'])||{});}})[_0x2cc3('0x27')](respondWithResult(_0x2e4991,null))[_0x2cc3('0x4b')](handleError(_0x2e4991,null));};exports[_0x2cc3('0x5b')]=function(_0x511ecf,_0x259d31,_0x2f35a0){return db[_0x2cc3('0x30')]['find']({'where':{'id':_0x511ecf[_0x2cc3('0x4d')]['id']}})[_0x2cc3('0x27')](handleEntityNotFound(_0x259d31,null))[_0x2cc3('0x27')](function(_0x2d190b){if(_0x2d190b){return _0x2d190b['removeUsers'](_0x511ecf[_0x2cc3('0x38')][_0x2cc3('0x59')])[_0x2cc3('0x27')](function(){if(_['isArray'](_0x511ecf['query']['ids'])){for(var _0x4e7a77=0x0;_0x4e7a77<_0x511ecf[_0x2cc3('0x38')][_0x2cc3('0x59')][_0x2cc3('0x3c')];_0x4e7a77+=0x1){socket['emit'](_0x2cc3('0x5c'),{'UserId':Number(_0x511ecf[_0x2cc3('0x38')][_0x2cc3('0x59')][_0x4e7a77]),'SquareProjectId':Number(_0x511ecf[_0x2cc3('0x4d')]['id'])});}}else{socket[_0x2cc3('0x5d')](_0x2cc3('0x5c'),{'UserId':Number(_0x511ecf[_0x2cc3('0x38')][_0x2cc3('0x59')]),'SquareProjectId':Number(_0x511ecf[_0x2cc3('0x4d')]['id'])});}});}})[_0x2cc3('0x27')](respondWithStatusCode(_0x259d31,null))['catch'](handleError(_0x259d31,null));};exports[_0x2cc3('0x5e')]=function(_0x3af10c,_0x4fb9cc,_0x2e83e1){var _0x533824={};var _0x5beb8e={};var _0x5e095a;var _0x318423;return db['SquareProject']['findOne']({'where':{'id':_0x3af10c[_0x2cc3('0x4d')]['id']}})[_0x2cc3('0x27')](handleEntityNotFound(_0x4fb9cc,null))[_0x2cc3('0x27')](function(_0x1806aa){if(_0x1806aa){_0x5e095a=_0x1806aa;_0x5beb8e[_0x2cc3('0x35')]=_[_0x2cc3('0x37')](db[_0x2cc3('0x5f')][_0x2cc3('0x31')]);_0x5beb8e['query']=_[_0x2cc3('0x37')](_0x3af10c[_0x2cc3('0x38')]);_0x5beb8e[_0x2cc3('0x42')]=_[_0x2cc3('0x3a')](_0x5beb8e[_0x2cc3('0x35')],_0x5beb8e[_0x2cc3('0x38')]);_0x533824[_0x2cc3('0x39')]=_[_0x2cc3('0x3a')](_0x5beb8e[_0x2cc3('0x35')],qs['fields'](_0x3af10c[_0x2cc3('0x38')][_0x2cc3('0x3b')]));_0x533824['attributes']=_0x533824[_0x2cc3('0x39')][_0x2cc3('0x3c')]?_0x533824[_0x2cc3('0x39')]:_0x5beb8e['model'];_0x533824[_0x2cc3('0x3f')]=qs[_0x2cc3('0x40')](_0x3af10c[_0x2cc3('0x38')][_0x2cc3('0x40')]);_0x533824[_0x2cc3('0x41')]=qs[_0x2cc3('0x42')](_['pick'](_0x3af10c[_0x2cc3('0x38')],_0x5beb8e[_0x2cc3('0x42')]));if(_0x3af10c[_0x2cc3('0x38')][_0x2cc3('0x44')]){_0x533824[_0x2cc3('0x41')]=_[_0x2cc3('0x45')](_0x533824[_0x2cc3('0x41')],{'$or':_['map'](_0x533824[_0x2cc3('0x39')],function(_0x47f493){var _0x474833={};_0x474833[_0x47f493]={'$like':'%'+_0x3af10c[_0x2cc3('0x38')]['filter']+'%'};return _0x474833;})});}_0x533824=_[_0x2cc3('0x45')]({},_0x533824,_0x3af10c[_0x2cc3('0x46')]);return _0x5e095a[_0x2cc3('0x5e')](_0x533824);}})[_0x2cc3('0x27')](function(_0x547761){if(_0x547761){_0x318423=_0x547761['length'];if(!_0x3af10c[_0x2cc3('0x38')][_0x2cc3('0x3d')](_0x2cc3('0x3e'))){_0x533824[_0x2cc3('0x22')]=qs[_0x2cc3('0x22')](_0x3af10c[_0x2cc3('0x38')][_0x2cc3('0x22')]);_0x533824[_0x2cc3('0x21')]=qs[_0x2cc3('0x21')](_0x3af10c[_0x2cc3('0x38')][_0x2cc3('0x21')]);}return _0x5e095a['getUsers'](_0x533824);}})['then'](function(_0x506a32){if(_0x506a32){return _0x506a32?{'count':_0x318423,'rows':_0x506a32}:null;}})[_0x2cc3('0x27')](respondWithResult(_0x4fb9cc,null))['catch'](handleError(_0x4fb9cc,null));}; \ No newline at end of file +var _0x5793=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','socket.io-emitter','redis','./squareProject.socket','register','sendStatus','end','status','json','limit','set','Content-Range','apply','reject','update','destroy','then','get','UserProfileResource','error','stack','name','send','map','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','SquareProject','count','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','length','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0x5793,0xb5));var _0x3579=function(_0x1d7d2c,_0x930dc3){_0x1d7d2c=_0x1d7d2c-0x0;var _0x55149b=_0x5793[_0x1d7d2c];return _0x55149b;};'use strict';var pdf=require(_0x3579('0x0'));var emlformat=require(_0x3579('0x1'));var rimraf=require(_0x3579('0x2'));var zipdir=require(_0x3579('0x3'));var jsonpatch=require(_0x3579('0x4'));var rp=require(_0x3579('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3579('0x6'));var util=require(_0x3579('0x7'));var path=require(_0x3579('0x8'));var sox=require(_0x3579('0x9'));var csv=require(_0x3579('0xa'));var ejs=require(_0x3579('0xb'));var fs=require('fs');var _=require(_0x3579('0xc'));var squel=require(_0x3579('0xd'));var crypto=require('crypto');var jsforce=require(_0x3579('0xe'));var deskjs=require(_0x3579('0xf'));var toCsv=require(_0x3579('0xa'));var querystring=require(_0x3579('0x10'));var Papa=require(_0x3579('0x11'));var Redis=require(_0x3579('0x12'));var authService=require(_0x3579('0x13'));var qs=require(_0x3579('0x14'));var as=require(_0x3579('0x15'));var hardwareService=require(_0x3579('0x16'));var logger=require(_0x3579('0x17'))('api');var utils=require(_0x3579('0x18'));var config=require(_0x3579('0x19'));var licenseUtil=require(_0x3579('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3579('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3579('0x1c'))(new Redis(config[_0x3579('0x1d')]));require(_0x3579('0x1e'))[_0x3579('0x1f')](socket);function respondWithStatusCode(_0x9f69ea,_0xd0a0fa){_0xd0a0fa=_0xd0a0fa||0xcc;return function(_0x3bf116){if(_0x3bf116){return _0x9f69ea[_0x3579('0x20')](_0xd0a0fa);}return _0x9f69ea['status'](_0xd0a0fa)[_0x3579('0x21')]();};}function respondWithResult(_0x1a734c,_0xa072c8){_0xa072c8=_0xa072c8||0xc8;return function(_0x3ed592){if(_0x3ed592){return _0x1a734c[_0x3579('0x22')](_0xa072c8)[_0x3579('0x23')](_0x3ed592);}};}function respondWithFilteredResult(_0x16ca6e,_0x285c16){return function(_0x4d0474){if(_0x4d0474){var _0x4be6cc=_0x4d0474['count'],_0x139b87=_0x285c16['offset'],_0x1f7584=_0x285c16['offset']+_0x285c16[_0x3579('0x24')],_0x258ded;if(_0x1f7584>=_0x4be6cc){_0x1f7584=_0x4be6cc;_0x258ded=0xc8;}else{_0x258ded=0xce;}_0x16ca6e[_0x3579('0x22')](_0x258ded);return _0x16ca6e[_0x3579('0x25')](_0x3579('0x26'),_0x139b87+'-'+_0x1f7584+'/'+_0x4be6cc)[_0x3579('0x23')](_0x4d0474);}return null;};}function patchUpdates(_0x249135){return function(_0x31a4c8){try{jsonpatch[_0x3579('0x27')](_0x31a4c8,_0x249135,!![]);}catch(_0x38275d){return BPromise[_0x3579('0x28')](_0x38275d);}return _0x31a4c8['save']();};}function saveUpdates(_0x33b2f6,_0x41f521){return function(_0x389c27){if(_0x389c27){return _0x389c27[_0x3579('0x29')](_0x33b2f6)['then'](function(_0x5968ad){return _0x5968ad;});}return null;};}function removeEntity(_0x4cd6d6,_0x1f7210){return function(_0x1d3b13){if(_0x1d3b13){return _0x1d3b13[_0x3579('0x2a')]()[_0x3579('0x2b')](function(){var _0x35e98d=_0x1d3b13[_0x3579('0x2c')]({'plain':!![]});var _0x285c7c='SquareProjects';return db[_0x3579('0x2d')][_0x3579('0x2a')]({'where':{'type':_0x285c7c,'resourceId':_0x35e98d['id']}})[_0x3579('0x2b')](function(){return _0x1d3b13;});})[_0x3579('0x2b')](function(){_0x4cd6d6[_0x3579('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b9e63,_0x3cce8e){return function(_0x157ceb){if(!_0x157ceb){_0x3b9e63[_0x3579('0x20')](0x194);}return _0x157ceb;};}function handleError(_0x5bb323,_0xd5a30){_0xd5a30=_0xd5a30||0x1f4;return function(_0x3feb7a){logger[_0x3579('0x2e')](_0x3feb7a[_0x3579('0x2f')]);if(_0x3feb7a[_0x3579('0x30')]){delete _0x3feb7a[_0x3579('0x30')];}_0x5bb323[_0x3579('0x22')](_0xd5a30)[_0x3579('0x31')](_0x3feb7a);};}exports['index']=function(_0x4b2563,_0x532804){var _0x503cfc={},_0xf38090={},_0x4b851c={'count':0x0,'rows':[]};var _0x4c59c4=_[_0x3579('0x32')](db['SquareProject']['rawAttributes'],function(_0x50a868){return{'name':_0x50a868['fieldName'],'type':_0x50a868[_0x3579('0x33')][_0x3579('0x34')]};});_0xf38090[_0x3579('0x35')]=_[_0x3579('0x32')](_0x4c59c4,_0x3579('0x30'));_0xf38090[_0x3579('0x36')]=_[_0x3579('0x37')](_0x4b2563[_0x3579('0x36')]);_0xf38090['filters']=_[_0x3579('0x38')](_0xf38090[_0x3579('0x35')],_0xf38090[_0x3579('0x36')]);_0x503cfc[_0x3579('0x39')]=_[_0x3579('0x38')](_0xf38090['model'],qs[_0x3579('0x3a')](_0x4b2563['query']['fields']));_0x503cfc[_0x3579('0x39')]=_0x503cfc[_0x3579('0x39')]['length']?_0x503cfc[_0x3579('0x39')]:_0xf38090[_0x3579('0x35')];if(!_0x4b2563[_0x3579('0x36')][_0x3579('0x3b')](_0x3579('0x3c'))){_0x503cfc[_0x3579('0x24')]=qs['limit'](_0x4b2563['query'][_0x3579('0x24')]);_0x503cfc['offset']=qs[_0x3579('0x3d')](_0x4b2563[_0x3579('0x36')][_0x3579('0x3d')]);}_0x503cfc[_0x3579('0x3e')]=qs['sort'](_0x4b2563[_0x3579('0x36')][_0x3579('0x3f')]);_0x503cfc[_0x3579('0x40')]=qs['filters'](_[_0x3579('0x41')](_0x4b2563['query'],_0xf38090[_0x3579('0x42')]),_0x4c59c4);if(_0x4b2563['query']['filter']){_0x503cfc['where']=_[_0x3579('0x43')](_0x503cfc[_0x3579('0x40')],{'$or':_[_0x3579('0x32')](_0x4c59c4,function(_0x398487){if(_0x398487[_0x3579('0x33')]!==_0x3579('0x44')){var _0x3919ed={};_0x3919ed[_0x398487[_0x3579('0x30')]]={'$like':'%'+_0x4b2563[_0x3579('0x36')][_0x3579('0x45')]+'%'};return _0x3919ed;}})});}_0x503cfc=_['merge']({},_0x503cfc,_0x4b2563[_0x3579('0x46')]);var _0x5a2760={'where':_0x503cfc['where']};return db[_0x3579('0x47')]['count'](_0x5a2760)[_0x3579('0x2b')](function(_0x5aa043){_0x4b851c[_0x3579('0x48')]=_0x5aa043;if(_0x4b2563[_0x3579('0x36')]['includeAll']){_0x503cfc['include']=[{'all':!![]}];}return db[_0x3579('0x47')][_0x3579('0x49')](_0x503cfc);})[_0x3579('0x2b')](function(_0x540efa){_0x4b851c[_0x3579('0x4a')]=_0x540efa;return _0x4b851c;})[_0x3579('0x2b')](respondWithFilteredResult(_0x532804,_0x503cfc))[_0x3579('0x4b')](handleError(_0x532804,null));};exports[_0x3579('0x4c')]=function(_0x3fe850,_0x50aabb){var _0x370c23={'raw':![],'where':{'id':_0x3fe850[_0x3579('0x4d')]['id']}},_0x5c42e3={};_0x5c42e3[_0x3579('0x35')]=_[_0x3579('0x37')](db['SquareProject'][_0x3579('0x4e')]);_0x5c42e3[_0x3579('0x36')]=_[_0x3579('0x37')](_0x3fe850[_0x3579('0x36')]);_0x5c42e3[_0x3579('0x42')]=_['intersection'](_0x5c42e3[_0x3579('0x35')],_0x5c42e3[_0x3579('0x36')]);_0x370c23[_0x3579('0x39')]=_['intersection'](_0x5c42e3[_0x3579('0x35')],qs[_0x3579('0x3a')](_0x3fe850[_0x3579('0x36')][_0x3579('0x3a')]));_0x370c23['attributes']=_0x370c23[_0x3579('0x39')]['length']?_0x370c23['attributes']:_0x5c42e3[_0x3579('0x35')];if(_0x3fe850[_0x3579('0x36')][_0x3579('0x4f')]){_0x370c23[_0x3579('0x50')]=[{'all':!![]}];}_0x370c23=_[_0x3579('0x43')]({},_0x370c23,_0x3fe850[_0x3579('0x46')]);return db[_0x3579('0x47')][_0x3579('0x51')](_0x370c23)[_0x3579('0x2b')](handleEntityNotFound(_0x50aabb,null))[_0x3579('0x2b')](respondWithResult(_0x50aabb,null))[_0x3579('0x4b')](handleError(_0x50aabb,null));};exports[_0x3579('0x52')]=function(_0x27eaa8,_0x308085){return db[_0x3579('0x47')][_0x3579('0x52')](_0x27eaa8[_0x3579('0x53')],{})[_0x3579('0x2b')](function(_0x402327){var _0x364416=_0x27eaa8[_0x3579('0x54')]['get']({'plain':!![]});if(!_0x364416)throw new Error(_0x3579('0x55'));if(_0x364416[_0x3579('0x56')]===_0x3579('0x54')){var _0x4571cc=_0x402327[_0x3579('0x2c')]({'plain':!![]});var _0x3bd240='SquareProjects';return db['UserProfileSection']['find']({'where':{'name':_0x3bd240,'userProfileId':_0x364416[_0x3579('0x57')]},'raw':!![]})['then'](function(_0x346fc6){if(_0x346fc6&&_0x346fc6[_0x3579('0x58')]===0x0){return db[_0x3579('0x2d')]['create']({'name':_0x4571cc['name'],'resourceId':_0x4571cc['id'],'type':_0x346fc6[_0x3579('0x30')],'sectionId':_0x346fc6['id']},{})['then'](function(){return _0x402327;});}else{return _0x402327;}})[_0x3579('0x4b')](function(_0x4ede09){logger['error'](_0x3579('0x59'),_0x4ede09);throw _0x4ede09;});}return _0x402327;})[_0x3579('0x2b')](respondWithResult(_0x308085,0xc9))['catch'](handleError(_0x308085,null));};exports['update']=function(_0x141383,_0x2cda5e){if(_0x141383['body']['id']){delete _0x141383[_0x3579('0x53')]['id'];}return db[_0x3579('0x47')][_0x3579('0x51')]({'where':{'id':_0x141383[_0x3579('0x4d')]['id']}})[_0x3579('0x2b')](handleEntityNotFound(_0x2cda5e,null))[_0x3579('0x2b')](saveUpdates(_0x141383[_0x3579('0x53')],null))[_0x3579('0x2b')](respondWithResult(_0x2cda5e,null))[_0x3579('0x4b')](handleError(_0x2cda5e,null));};exports[_0x3579('0x2a')]=function(_0x322f33,_0x56c0be){return db[_0x3579('0x47')]['find']({'where':{'id':_0x322f33['params']['id']}})['then'](handleEntityNotFound(_0x56c0be,null))[_0x3579('0x2b')](removeEntity(_0x56c0be,null))[_0x3579('0x4b')](handleError(_0x56c0be,null));};exports[_0x3579('0x5a')]=function(_0x3ce664,_0x3f17ce,_0x242114){return db[_0x3579('0x47')]['find']({'where':{'id':_0x3ce664['params']['id']}})[_0x3579('0x2b')](handleEntityNotFound(_0x3f17ce,null))[_0x3579('0x2b')](function(_0x430672){if(_0x430672){return _0x430672[_0x3579('0x5a')](_0x3ce664[_0x3579('0x53')]['ids'],_['omit'](_0x3ce664['body'],[_0x3579('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x3f17ce,null))[_0x3579('0x4b')](handleError(_0x3f17ce,null));};exports[_0x3579('0x5c')]=function(_0x4a6d0a,_0x33be81,_0x14f0cb){return db[_0x3579('0x47')][_0x3579('0x51')]({'where':{'id':_0x4a6d0a['params']['id']}})['then'](handleEntityNotFound(_0x33be81,null))['then'](function(_0x3c123b){if(_0x3c123b){return _0x3c123b[_0x3579('0x5c')](_0x4a6d0a[_0x3579('0x36')][_0x3579('0x5b')])[_0x3579('0x2b')](function(){if(_[_0x3579('0x5d')](_0x4a6d0a[_0x3579('0x36')]['ids'])){for(var _0x87f942=0x0;_0x87f942<_0x4a6d0a[_0x3579('0x36')][_0x3579('0x5b')]['length'];_0x87f942+=0x1){socket[_0x3579('0x5e')](_0x3579('0x5f'),{'UserId':Number(_0x4a6d0a[_0x3579('0x36')]['ids'][_0x87f942]),'SquareProjectId':Number(_0x4a6d0a[_0x3579('0x4d')]['id'])});}}else{socket[_0x3579('0x5e')]('userSquareProject:remove',{'UserId':Number(_0x4a6d0a[_0x3579('0x36')][_0x3579('0x5b')]),'SquareProjectId':Number(_0x4a6d0a[_0x3579('0x4d')]['id'])});}});}})[_0x3579('0x2b')](respondWithStatusCode(_0x33be81,null))['catch'](handleError(_0x33be81,null));};exports[_0x3579('0x60')]=function(_0x57709a,_0x2ac0ee,_0x9ccdf0){var _0x546271={};var _0xcca2b8={};var _0x2e4e09;var _0x2249e9;return db[_0x3579('0x47')][_0x3579('0x61')]({'where':{'id':_0x57709a[_0x3579('0x4d')]['id']}})[_0x3579('0x2b')](handleEntityNotFound(_0x2ac0ee,null))[_0x3579('0x2b')](function(_0x3656e4){if(_0x3656e4){_0x2e4e09=_0x3656e4;_0xcca2b8['model']=_[_0x3579('0x37')](db[_0x3579('0x62')][_0x3579('0x4e')]);_0xcca2b8[_0x3579('0x36')]=_[_0x3579('0x37')](_0x57709a[_0x3579('0x36')]);_0xcca2b8[_0x3579('0x42')]=_['intersection'](_0xcca2b8[_0x3579('0x35')],_0xcca2b8[_0x3579('0x36')]);_0x546271['attributes']=_['intersection'](_0xcca2b8[_0x3579('0x35')],qs['fields'](_0x57709a[_0x3579('0x36')][_0x3579('0x3a')]));_0x546271[_0x3579('0x39')]=_0x546271[_0x3579('0x39')][_0x3579('0x63')]?_0x546271[_0x3579('0x39')]:_0xcca2b8[_0x3579('0x35')];_0x546271[_0x3579('0x3e')]=qs[_0x3579('0x3f')](_0x57709a[_0x3579('0x36')]['sort']);_0x546271[_0x3579('0x40')]=qs[_0x3579('0x42')](_[_0x3579('0x41')](_0x57709a[_0x3579('0x36')],_0xcca2b8[_0x3579('0x42')]));if(_0x57709a[_0x3579('0x36')]['filter']){_0x546271[_0x3579('0x40')]=_[_0x3579('0x43')](_0x546271[_0x3579('0x40')],{'$or':_[_0x3579('0x32')](_0x546271[_0x3579('0x39')],function(_0x4488ea){var _0x5147f9={};_0x5147f9[_0x4488ea]={'$like':'%'+_0x57709a[_0x3579('0x36')][_0x3579('0x45')]+'%'};return _0x5147f9;})});}_0x546271=_[_0x3579('0x43')]({},_0x546271,_0x57709a[_0x3579('0x46')]);return _0x2e4e09[_0x3579('0x60')](_0x546271);}})[_0x3579('0x2b')](function(_0x14e07e){if(_0x14e07e){_0x2249e9=_0x14e07e[_0x3579('0x63')];if(!_0x57709a[_0x3579('0x36')][_0x3579('0x3b')](_0x3579('0x3c'))){_0x546271[_0x3579('0x24')]=qs[_0x3579('0x24')](_0x57709a['query']['limit']);_0x546271['offset']=qs[_0x3579('0x3d')](_0x57709a[_0x3579('0x36')][_0x3579('0x3d')]);}return _0x2e4e09[_0x3579('0x60')](_0x546271);}})[_0x3579('0x2b')](function(_0x5cd95a){if(_0x5cd95a){return _0x5cd95a?{'count':_0x2249e9,'rows':_0x5cd95a}:null;}})[_0x3579('0x2b')](respondWithResult(_0x2ac0ee,null))[_0x3579('0x4b')](handleError(_0x2ac0ee,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 317901e..c95f8d6 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 _0xd246=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x1837da,_0x5e3681){var _0x3b0ba2=function(_0x2ed3b6){while(--_0x2ed3b6){_0x1837da['push'](_0x1837da['shift']());}};_0x3b0ba2(++_0x5e3681);}(_0xd246,0xf5));var _0x6d24=function(_0x1394a2,_0x533264){_0x1394a2=_0x1394a2-0x0;var _0x31dcd1=_0xd246[_0x1394a2];return _0x31dcd1;};'use strict';var EventEmitter=require(_0x6d24('0x0'));var SquareProject=require(_0x6d24('0x1'))['db'][_0x6d24('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x6d24('0x3')](0x0);var events={'afterCreate':_0x6d24('0x4'),'afterUpdate':_0x6d24('0x5'),'afterDestroy':_0x6d24('0x6')};function emitEvent(_0x51c18f){return function(_0x4e76e1,_0xfa68f3,_0x58e7fc){SquareProjectEvents[_0x6d24('0x7')](_0x51c18f+':'+_0x4e76e1['id'],_0x4e76e1);SquareProjectEvents['emit'](_0x51c18f,_0x4e76e1);_0x58e7fc(null);};}for(var e in events){if(events[_0x6d24('0x8')](e)){var event=events[e];SquareProject[_0x6d24('0x9')](e,emitEvent(event));}}module[_0x6d24('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0x63c5=['save','update','emit','hasOwnProperty','hook','SquareProject','setMaxListeners'];(function(_0x2d4217,_0x559f1d){var _0x465368=function(_0x459509){while(--_0x459509){_0x2d4217['push'](_0x2d4217['shift']());}};_0x465368(++_0x559f1d);}(_0x63c5,0xde));var _0x563c=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x63c5[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x563c('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x563c('0x1')](0x0);var events={'afterCreate':_0x563c('0x2'),'afterUpdate':_0x563c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4a1c0a){return function(_0x31a098,_0x3e4756,_0x5a029f){SquareProjectEvents[_0x563c('0x4')](_0x4a1c0a+':'+_0x31a098['id'],_0x31a098);SquareProjectEvents[_0x563c('0x4')](_0x4a1c0a,_0x31a098);_0x5a029f(null);};}for(var e in events){if(events[_0x563c('0x5')](e)){var event=events[e];SquareProject[_0x563c('0x6')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index f5b89fe..fb56468 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 _0xae79=['square_projects','changed','preproduction','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define'];(function(_0x409c70,_0x1e5d8d){var _0x1891bb=function(_0x311388){while(--_0x311388){_0x409c70['push'](_0x409c70['shift']());}};_0x1891bb(++_0x1e5d8d);}(_0xae79,0x1d3));var _0x9ae7=function(_0x2c66da,_0x1e24b4){_0x2c66da=_0x2c66da-0x0;var _0xde8333=_0xae79[_0x2c66da];return _0xde8333;};'use strict';var _=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var logger=require(_0x9ae7('0x2'))(_0x9ae7('0x3'));var moment=require(_0x9ae7('0x4'));var BPromise=require(_0x9ae7('0x5'));var rp=require(_0x9ae7('0x6'));var fs=require('fs');var path=require(_0x9ae7('0x7'));var rimraf=require(_0x9ae7('0x8'));var config=require(_0x9ae7('0x9'));var attributes=require(_0x9ae7('0xa'));module[_0x9ae7('0xb')]=function(_0x3e98cf,_0x396863){return _0x3e98cf[_0x9ae7('0xc')]('SquareProject',attributes,{'tableName':_0x9ae7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47774e,_0x3c7738,_0x113cab){if(_0x47774e[_0x9ae7('0xe')](_0x9ae7('0xf'))){_0x47774e['savedAt']=moment()[_0x9ae7('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x47774e[_0x9ae7('0xe')](_0x9ae7('0x11'))){_0x47774e[_0x9ae7('0x12')]=moment()[_0x9ae7('0x10')](_0x9ae7('0x13'));}_0x113cab(null,_0x47774e);}}});}; \ No newline at end of file +var _0x3d9c=['production','publishedAt','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3d9c,0x134));var _0xc3d9=function(_0x39cc54,_0x307f82){_0x39cc54=_0x39cc54-0x0;var _0x5d8972=_0x3d9c[_0x39cc54];return _0x5d8972;};'use strict';var _=require(_0xc3d9('0x0'));var util=require('util');var logger=require(_0xc3d9('0x1'))(_0xc3d9('0x2'));var moment=require(_0xc3d9('0x3'));var BPromise=require('bluebird');var rp=require(_0xc3d9('0x4'));var fs=require('fs');var path=require(_0xc3d9('0x5'));var rimraf=require(_0xc3d9('0x6'));var config=require(_0xc3d9('0x7'));var attributes=require(_0xc3d9('0x8'));module[_0xc3d9('0x9')]=function(_0x137aaf,_0x492577){return _0x137aaf[_0xc3d9('0xa')](_0xc3d9('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c0a2f,_0x50bfe8,_0x3eff61){if(_0x3c0a2f[_0xc3d9('0xc')](_0xc3d9('0xd'))){_0x3c0a2f['savedAt']=moment()[_0xc3d9('0xe')](_0xc3d9('0xf'));}if(_0x3c0a2f['changed'](_0xc3d9('0x10'))){_0x3c0a2f[_0xc3d9('0x11')]=moment()[_0xc3d9('0xe')](_0xc3d9('0xf'));}_0x3eff61(null,_0x3c0a2f);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index cad5215..844adcc 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 _0x7b21=['request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','then','info','SquareProject,\x20%s,\x20%s'];(function(_0x3b29f3,_0xc2389c){var _0x2ccf8e=function(_0x437a76){while(--_0x437a76){_0x3b29f3['push'](_0x3b29f3['shift']());}};_0x2ccf8e(++_0xc2389c);}(_0x7b21,0x11b));var _0x17b2=function(_0x2838b5,_0x5e9b2c){_0x2838b5=_0x2838b5-0x0;var _0x8a341=_0x7b21[_0x2838b5];return _0x8a341;};'use strict';var _=require(_0x17b2('0x0'));var util=require(_0x17b2('0x1'));var moment=require(_0x17b2('0x2'));var BPromise=require('bluebird');var rs=require(_0x17b2('0x3'));var fs=require('fs');var Redis=require(_0x17b2('0x4'));var db=require(_0x17b2('0x5'))['db'];var utils=require(_0x17b2('0x6'));var logger=require(_0x17b2('0x7'))(_0x17b2('0x8'));var config=require(_0x17b2('0x9'));var jayson=require(_0x17b2('0xa'));var client=jayson[_0x17b2('0xb')][_0x17b2('0xc')]({'port':0x232a});config[_0x17b2('0xd')]=_[_0x17b2('0xe')](config['redis'],{'host':_0x17b2('0xf'),'port':0x18eb});var socket=require(_0x17b2('0x10'))(new Redis(config[_0x17b2('0xd')]));require(_0x17b2('0x11'))['register'](socket);function respondWithRpcPromise(_0x15ceda,_0x16e5ab,_0x4d9d2c){return new BPromise(function(_0xa3bbaf,_0x28fec0){return client['request'](_0x15ceda,_0x4d9d2c)[_0x17b2('0x12')](function(_0x1a2075){logger[_0x17b2('0x13')](_0x17b2('0x14'),_0x16e5ab,_0x17b2('0x15'));logger['debug'](_0x17b2('0x16'),_0x16e5ab,_0x17b2('0x15'),JSON[_0x17b2('0x17')](_0x1a2075));if(_0x1a2075['error']){if(_0x1a2075['error'][_0x17b2('0x18')]===0x1f4){logger[_0x17b2('0x19')](_0x17b2('0x14'),_0x16e5ab,_0x1a2075[_0x17b2('0x19')][_0x17b2('0x1a')]);return _0x28fec0(_0x1a2075[_0x17b2('0x19')][_0x17b2('0x1a')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0x16e5ab,_0x1a2075['error']['message']);return _0xa3bbaf(_0x1a2075[_0x17b2('0x19')]['message']);}else{logger[_0x17b2('0x13')]('SquareProject,\x20%s,\x20%s',_0x16e5ab,'request\x20sent');_0xa3bbaf(_0x1a2075['result']['message']);}})[_0x17b2('0x1b')](function(_0x31b339){logger[_0x17b2('0x19')](_0x17b2('0x14'),_0x16e5ab,_0x31b339);_0x28fec0(_0x31b339);});});}exports[_0x17b2('0x1c')]=function(_0x458f25){var _0x4df3b5=this;return new Promise(function(_0x18c52c,_0x1f8563){return db[_0x17b2('0x1d')][_0x17b2('0x1e')]({'raw':_0x458f25[_0x17b2('0x1f')]?_0x458f25[_0x17b2('0x1f')][_0x17b2('0x20')]===undefined?!![]:![]:!![],'where':_0x458f25[_0x17b2('0x1f')]?_0x458f25[_0x17b2('0x1f')][_0x17b2('0x21')]||null:null,'attributes':_0x458f25[_0x17b2('0x1f')]?_0x458f25[_0x17b2('0x1f')][_0x17b2('0x22')]||null:null,'include':_0x458f25['options']?_0x458f25[_0x17b2('0x1f')][_0x17b2('0x23')]?_[_0x17b2('0x24')](_0x458f25[_0x17b2('0x1f')]['include'],function(_0x4b2d2e){return{'model':db[_0x4b2d2e[_0x17b2('0x25')]],'as':_0x4b2d2e['as'],'attributes':_0x4b2d2e[_0x17b2('0x22')],'include':_0x4b2d2e['include']?_[_0x17b2('0x24')](_0x4b2d2e[_0x17b2('0x23')],function(_0x44767e){return{'model':db[_0x44767e[_0x17b2('0x25')]],'as':_0x44767e['as'],'attributes':_0x44767e['attributes'],'include':_0x44767e['include']?_[_0x17b2('0x24')](_0x44767e[_0x17b2('0x23')],function(_0x53c106){return{'model':db[_0x53c106[_0x17b2('0x25')]],'as':_0x53c106['as'],'attributes':_0x53c106[_0x17b2('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59af37){logger[_0x17b2('0x13')](_0x17b2('0x1c'),_0x458f25);logger['debug'](_0x17b2('0x1c'),_0x458f25,JSON[_0x17b2('0x17')](_0x59af37));_0x18c52c(_0x59af37);})['catch'](function(_0x42f7a6){logger[_0x17b2('0x19')](_0x17b2('0x1c'),_0x42f7a6['message'],_0x458f25);_0x1f8563(_0x4df3b5[_0x17b2('0x19')](0x1f4,_0x42f7a6['message']));});});}; \ No newline at end of file +var _0x9185=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','request','then','info','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','lodash','moment','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x1439e6,_0x2634b8){var _0x1101a9=function(_0x591d44){while(--_0x591d44){_0x1439e6['push'](_0x1439e6['shift']());}};_0x1101a9(++_0x2634b8);}(_0x9185,0x11a));var _0x5918=function(_0x3806e6,_0x2f55d1){_0x3806e6=_0x3806e6-0x0;var _0x43aea8=_0x9185[_0x3806e6];return _0x43aea8;};'use strict';var _=require(_0x5918('0x0'));var util=require('util');var moment=require(_0x5918('0x1'));var BPromise=require('bluebird');var rs=require(_0x5918('0x2'));var fs=require('fs');var Redis=require(_0x5918('0x3'));var db=require(_0x5918('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5918('0x5'));var config=require(_0x5918('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5918('0x7')][_0x5918('0x8')]({'port':0x232a});config[_0x5918('0x9')]=_[_0x5918('0xa')](config[_0x5918('0x9')],{'host':_0x5918('0xb'),'port':0x18eb});var socket=require(_0x5918('0xc'))(new Redis(config[_0x5918('0x9')]));require(_0x5918('0xd'))['register'](socket);function respondWithRpcPromise(_0x36276f,_0x390338,_0x71550){return new BPromise(function(_0x2c8ba5,_0x412fb8){return client[_0x5918('0xe')](_0x36276f,_0x71550)[_0x5918('0xf')](function(_0x4da49d){logger[_0x5918('0x10')](_0x5918('0x11'),_0x390338,'request\x20sent');logger[_0x5918('0x12')](_0x5918('0x13'),_0x390338,'request\x20sent',JSON[_0x5918('0x14')](_0x4da49d));if(_0x4da49d[_0x5918('0x15')]){if(_0x4da49d[_0x5918('0x15')][_0x5918('0x16')]===0x1f4){logger[_0x5918('0x15')](_0x5918('0x11'),_0x390338,_0x4da49d[_0x5918('0x15')][_0x5918('0x17')]);return _0x412fb8(_0x4da49d[_0x5918('0x15')]['message']);}logger[_0x5918('0x15')](_0x5918('0x11'),_0x390338,_0x4da49d[_0x5918('0x15')][_0x5918('0x17')]);return _0x2c8ba5(_0x4da49d[_0x5918('0x15')][_0x5918('0x17')]);}else{logger[_0x5918('0x10')]('SquareProject,\x20%s,\x20%s',_0x390338,'request\x20sent');_0x2c8ba5(_0x4da49d[_0x5918('0x18')][_0x5918('0x17')]);}})[_0x5918('0x19')](function(_0x4b6e15){logger[_0x5918('0x15')](_0x5918('0x11'),_0x390338,_0x4b6e15);_0x412fb8(_0x4b6e15);});});}exports[_0x5918('0x1a')]=function(_0x3e4ff5){var _0x541c9c=this;return new Promise(function(_0x598ca8,_0x1d3727){return db[_0x5918('0x1b')][_0x5918('0x1c')]({'raw':_0x3e4ff5[_0x5918('0x1d')]?_0x3e4ff5[_0x5918('0x1d')][_0x5918('0x1e')]===undefined?!![]:![]:!![],'where':_0x3e4ff5[_0x5918('0x1d')]?_0x3e4ff5[_0x5918('0x1d')][_0x5918('0x1f')]||null:null,'attributes':_0x3e4ff5[_0x5918('0x1d')]?_0x3e4ff5[_0x5918('0x1d')][_0x5918('0x20')]||null:null,'include':_0x3e4ff5['options']?_0x3e4ff5[_0x5918('0x1d')][_0x5918('0x21')]?_[_0x5918('0x22')](_0x3e4ff5['options'][_0x5918('0x21')],function(_0x2eb00d){return{'model':db[_0x2eb00d[_0x5918('0x23')]],'as':_0x2eb00d['as'],'attributes':_0x2eb00d['attributes'],'include':_0x2eb00d[_0x5918('0x21')]?_['map'](_0x2eb00d[_0x5918('0x21')],function(_0x5a62f4){return{'model':db[_0x5a62f4[_0x5918('0x23')]],'as':_0x5a62f4['as'],'attributes':_0x5a62f4[_0x5918('0x20')],'include':_0x5a62f4['include']?_[_0x5918('0x22')](_0x5a62f4[_0x5918('0x21')],function(_0x1cdb07){return{'model':db[_0x1cdb07[_0x5918('0x23')]],'as':_0x1cdb07['as'],'attributes':_0x1cdb07[_0x5918('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa93925){logger[_0x5918('0x10')](_0x5918('0x1a'),_0x3e4ff5);logger['debug'](_0x5918('0x1a'),_0x3e4ff5,JSON[_0x5918('0x14')](_0xa93925));_0x598ca8(_0xa93925);})[_0x5918('0x19')](function(_0x36f1c0){logger[_0x5918('0x15')](_0x5918('0x1a'),_0x36f1c0[_0x5918('0x17')],_0x3e4ff5);_0x1d3727(_0x541c9c[_0x5918('0x15')](0x1f4,_0x36f1c0[_0x5918('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index f108c8d..5f689c2 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 _0xb016=['register','./squareProject.events','save','emit'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0xb016,0x159));var _0x6b01=function(_0x4f8f68,_0x39ff0e){_0x4f8f68=_0x4f8f68-0x0;var _0x252f44=_0xb016[_0x4f8f68];return _0x252f44;};'use strict';var SquareProjectEvents=require(_0x6b01('0x0'));var events=[_0x6b01('0x1'),'remove','update'];function createListener(_0xf74fa1,_0x531b6a){return function(_0x160a7d){_0x531b6a[_0x6b01('0x2')](_0xf74fa1,_0x160a7d);};}function removeListener(_0x161b59,_0x3b9de1){return function(){SquareProjectEvents['removeListener'](_0x161b59,_0x3b9de1);};}exports[_0x6b01('0x3')]=function(_0x65407a){for(var _0x192b2d=0x0,_0x5759a1=events['length'];_0x192b2d<_0x5759a1;_0x192b2d++){var _0x374aab=events[_0x192b2d];var _0x39f9fa=createListener('squareProject:'+_0x374aab,_0x65407a);SquareProjectEvents['on'](_0x374aab,_0x39f9fa);}}; \ No newline at end of file +var _0x7c09=['save','remove','emit','removeListener','length','squareProject:'];(function(_0x1c8723,_0x4334af){var _0x50d5ca=function(_0x5695ae){while(--_0x5695ae){_0x1c8723['push'](_0x1c8723['shift']());}};_0x50d5ca(++_0x4334af);}(_0x7c09,0x102));var _0x97c0=function(_0x18f339,_0x2c15d1){_0x18f339=_0x18f339-0x0;var _0x2f4016=_0x7c09[_0x18f339];return _0x2f4016;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x97c0('0x0'),_0x97c0('0x1'),'update'];function createListener(_0xfbf689,_0x7d8f6f){return function(_0x2d04b9){_0x7d8f6f[_0x97c0('0x2')](_0xfbf689,_0x2d04b9);};}function removeListener(_0x12eb6d,_0x99bf54){return function(){SquareProjectEvents[_0x97c0('0x3')](_0x12eb6d,_0x99bf54);};}exports['register']=function(_0x4b2f81){for(var _0x590368=0x0,_0x46fdd9=events[_0x97c0('0x4')];_0x590368<_0x46fdd9;_0x590368++){var _0x2c19fa=events[_0x590368];var _0x109bc8=createListener(_0x97c0('0x5')+_0x2c19fa,_0x4b2f81);SquareProjectEvents['on'](_0x2c19fa,_0x109bc8);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 278b50f..102608d 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 _0x2fee=['destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','update','delete','/:id/delete'];(function(_0x48f361,_0x30baa6){var _0x3b32b5=function(_0x3c7684){while(--_0x3c7684){_0x48f361['push'](_0x48f361['shift']());}};_0x3b32b5(++_0x30baa6);}(_0x2fee,0x11a));var _0xe2fe=function(_0x314ee0,_0x2c854d){_0x314ee0=_0x314ee0-0x0;var _0x2c618a=_0x2fee[_0x314ee0];return _0x2c618a;};'use strict';var multer=require(_0xe2fe('0x0'));var util=require('util');var path=require(_0xe2fe('0x1'));var timeout=require('connect-timeout');var express=require(_0xe2fe('0x2'));var router=express['Router']();var auth=require(_0xe2fe('0x3'));var interaction=require(_0xe2fe('0x4'));var config=require('../../config/environment');var controller=require(_0xe2fe('0x5'));router[_0xe2fe('0x6')]('/',auth[_0xe2fe('0x7')](),controller['index']);router[_0xe2fe('0x6')](_0xe2fe('0x8'),auth[_0xe2fe('0x7')](),controller[_0xe2fe('0x9')]);router[_0xe2fe('0x6')](_0xe2fe('0xa'),auth['isAuthenticated'](),controller[_0xe2fe('0xb')]);router[_0xe2fe('0xc')]('/',auth['isAuthenticated'](),controller[_0xe2fe('0xd')]);router[_0xe2fe('0xe')](_0xe2fe('0x8'),auth[_0xe2fe('0x7')](),controller[_0xe2fe('0xf')]);router[_0xe2fe('0x10')](_0xe2fe('0x11'),auth[_0xe2fe('0x7')](),controller[_0xe2fe('0x12')]);module[_0xe2fe('0x13')]=router; \ No newline at end of file +var _0xc711=['get','isAuthenticated','index','/:id','/:id/download','download','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller'];(function(_0x5bf8e8,_0x49ad06){var _0x3f5ef9=function(_0x15988b){while(--_0x15988b){_0x5bf8e8['push'](_0x5bf8e8['shift']());}};_0x3f5ef9(++_0x49ad06);}(_0xc711,0x9f));var _0x1c71=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0xc711[_0x3b0912];return _0xa8f339;};'use strict';var multer=require(_0x1c71('0x0'));var util=require(_0x1c71('0x1'));var path=require(_0x1c71('0x2'));var timeout=require('connect-timeout');var express=require(_0x1c71('0x3'));var router=express[_0x1c71('0x4')]();var auth=require(_0x1c71('0x5'));var interaction=require(_0x1c71('0x6'));var config=require(_0x1c71('0x7'));var controller=require(_0x1c71('0x8'));router[_0x1c71('0x9')]('/',auth[_0x1c71('0xa')](),controller[_0x1c71('0xb')]);router[_0x1c71('0x9')](_0x1c71('0xc'),auth[_0x1c71('0xa')](),controller['show']);router['get'](_0x1c71('0xd'),auth[_0x1c71('0xa')](),controller[_0x1c71('0xe')]);router['post']('/',auth[_0x1c71('0xa')](),controller[_0x1c71('0xf')]);router[_0x1c71('0x10')](_0x1c71('0xc'),auth[_0x1c71('0xa')](),controller[_0x1c71('0x11')]);router[_0x1c71('0x12')]('/:id/delete',auth[_0x1c71('0xa')](),controller[_0x1c71('0x13')]);module[_0x1c71('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 954860b..724b39e 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 _0x2149=['VIRTUAL','getDataValue','substring','sequelize','exports','STRING'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x2149,0x1e3));var _0x9214=function(_0x2b0e5b,_0x3532b1){_0x2b0e5b=_0x2b0e5b-0x0;var _0x319989=_0x2149[_0x2b0e5b];return _0x319989;};'use strict';var Sequelize=require(_0x9214('0x0'));module[_0x9214('0x1')]={'uniqueid':{'type':Sequelize[_0x9214('0x2')]},'callerid':{'type':Sequelize[_0x9214('0x2')]},'calleridname':{'type':Sequelize[_0x9214('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9214('0x2')]},'priority':{'type':Sequelize[_0x9214('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x9214('0x2')]},'projectName':{'type':Sequelize[_0x9214('0x2')]},'saveName':{'type':Sequelize[_0x9214('0x2')]},'filename':{'type':Sequelize[_0x9214('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x9214('0x3')],'get':function(){var _0x48a610='';var _0x85e7b1=this[_0x9214('0x4')]('savePath');if(_0x85e7b1){_0x48a610=_0x85e7b1[_0x9214('0x5')](_0x85e7b1['lastIndexOf']('.'));}return _0x48a610;}}}; \ No newline at end of file +var _0xb7dc=['savePath','substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x4a59c8,_0x40e45b){var _0x51681d=function(_0x1c1223){while(--_0x1c1223){_0x4a59c8['push'](_0x4a59c8['shift']());}};_0x51681d(++_0x40e45b);}(_0xb7dc,0x9b));var _0xcb7d=function(_0x51f417,_0x1a65ca){_0x51f417=_0x51f417-0x0;var _0x141a8d=_0xb7dc[_0x51f417];return _0x141a8d;};'use strict';var Sequelize=require(_0xcb7d('0x0'));module[_0xcb7d('0x1')]={'uniqueid':{'type':Sequelize[_0xcb7d('0x2')]},'callerid':{'type':Sequelize[_0xcb7d('0x2')]},'calleridname':{'type':Sequelize[_0xcb7d('0x2')]},'context':{'type':Sequelize[_0xcb7d('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xcb7d('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xcb7d('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xcb7d('0x2')]},'savePath':{'type':Sequelize[_0xcb7d('0x2')]},'format':{'type':Sequelize[_0xcb7d('0x3')],'get':function(){var _0x3eb3cb='';var _0x26cdc2=this[_0xcb7d('0x4')](_0xcb7d('0x5'));if(_0x26cdc2){_0x3eb3cb=_0x26cdc2[_0xcb7d('0x6')](_0x26cdc2[_0xcb7d('0x7')]('.'));}return _0x3eb3cb;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 3aa2710..2acd9dd 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 _0x1ab2=['find','catch','create','body','params','download','../../components/encryptor','uniqueid','savePath','%s.cypher','existsSync','decryptFile','recording','SquareRecording\x20not\x20found','filename','extname','unlink','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','SquareRecording','findAll','rows','show','keys','fields'];(function(_0xd970da,_0x3ce3d9){var _0x29bdbd=function(_0x6f9cf2){while(--_0x6f9cf2){_0xd970da['push'](_0xd970da['shift']());}};_0x29bdbd(++_0x3ce3d9);}(_0x1ab2,0x198));var _0x21ab=function(_0x23b4b5,_0xd7ea37){_0x23b4b5=_0x23b4b5-0x0;var _0x2a041a=_0x1ab2[_0x23b4b5];return _0x2a041a;};'use strict';var pdf=require(_0x21ab('0x0'));var emlformat=require(_0x21ab('0x1'));var rimraf=require(_0x21ab('0x2'));var zipdir=require(_0x21ab('0x3'));var jsonpatch=require(_0x21ab('0x4'));var rp=require('request-promise');var moment=require(_0x21ab('0x5'));var BPromise=require(_0x21ab('0x6'));var Mustache=require(_0x21ab('0x7'));var util=require(_0x21ab('0x8'));var path=require('path');var sox=require(_0x21ab('0x9'));var csv=require(_0x21ab('0xa'));var ejs=require(_0x21ab('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x21ab('0xc'));var deskjs=require(_0x21ab('0xd'));var toCsv=require(_0x21ab('0xa'));var querystring=require(_0x21ab('0xe'));var Papa=require('papaparse');var Redis=require(_0x21ab('0xf'));var authService=require(_0x21ab('0x10'));var qs=require(_0x21ab('0x11'));var as=require(_0x21ab('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21ab('0x13'))(_0x21ab('0x14'));var utils=require(_0x21ab('0x15'));var config=require(_0x21ab('0x16'));var licenseUtil=require(_0x21ab('0x17'));var db=require(_0x21ab('0x18'))['db'];function respondWithStatusCode(_0x23f187,_0x44477a){_0x44477a=_0x44477a||0xcc;return function(_0x574626){if(_0x574626){return _0x23f187[_0x21ab('0x19')](_0x44477a);}return _0x23f187[_0x21ab('0x1a')](_0x44477a)[_0x21ab('0x1b')]();};}function respondWithResult(_0x2720b4,_0x4d655f){_0x4d655f=_0x4d655f||0xc8;return function(_0x3a7741){if(_0x3a7741){return _0x2720b4[_0x21ab('0x1a')](_0x4d655f)[_0x21ab('0x1c')](_0x3a7741);}};}function respondWithFilteredResult(_0x412345,_0x2d4b90){return function(_0x3784a6){if(_0x3784a6){var _0x2292a8=_0x3784a6[_0x21ab('0x1d')],_0x3414ec=_0x2d4b90[_0x21ab('0x1e')],_0x596e8a=_0x2d4b90[_0x21ab('0x1e')]+_0x2d4b90[_0x21ab('0x1f')],_0x9aa4ef;if(_0x596e8a>=_0x2292a8){_0x596e8a=_0x2292a8;_0x9aa4ef=0xc8;}else{_0x9aa4ef=0xce;}_0x412345[_0x21ab('0x1a')](_0x9aa4ef);return _0x412345[_0x21ab('0x20')](_0x21ab('0x21'),_0x3414ec+'-'+_0x596e8a+'/'+_0x2292a8)[_0x21ab('0x1c')](_0x3784a6);}return null;};}function patchUpdates(_0x49061f){return function(_0x3ac3e7){try{jsonpatch[_0x21ab('0x22')](_0x3ac3e7,_0x49061f,!![]);}catch(_0x36f474){return BPromise[_0x21ab('0x23')](_0x36f474);}return _0x3ac3e7[_0x21ab('0x24')]();};}function saveUpdates(_0x11e005,_0x5df8de){return function(_0xeae02e){if(_0xeae02e){return _0xeae02e[_0x21ab('0x25')](_0x11e005)[_0x21ab('0x26')](function(_0xcf7bca){return _0xcf7bca;});}return null;};}function removeEntity(_0x3e7ad8,_0x11a316){return function(_0x4bd5f1){if(_0x4bd5f1){return _0x4bd5f1[_0x21ab('0x27')]()[_0x21ab('0x26')](function(){_0x3e7ad8['status'](0xcc)[_0x21ab('0x1b')]();});}};}function handleEntityNotFound(_0x59b216,_0x18601b){return function(_0x205ce9){if(!_0x205ce9){_0x59b216[_0x21ab('0x19')](0x194);}return _0x205ce9;};}function handleError(_0x211e59,_0x4e5157){_0x4e5157=_0x4e5157||0x1f4;return function(_0x22685a){logger[_0x21ab('0x28')](_0x22685a[_0x21ab('0x29')]);if(_0x22685a[_0x21ab('0x2a')]){delete _0x22685a[_0x21ab('0x2a')];}_0x211e59['status'](_0x4e5157)['send'](_0x22685a);};}exports[_0x21ab('0x2b')]=function(_0x2263bc,_0x2e5740){var _0x3efd47={},_0x407d01={},_0x42e897={'count':0x0,'rows':[]};var _0x29d5cb=_['map'](db['SquareRecording'][_0x21ab('0x2c')],function(_0x13bed4){return{'name':_0x13bed4[_0x21ab('0x2d')],'type':_0x13bed4['type'][_0x21ab('0x2e')]};});_0x407d01['model']=_[_0x21ab('0x2f')](_0x29d5cb,_0x21ab('0x2a'));_0x407d01['query']=_['keys'](_0x2263bc[_0x21ab('0x30')]);_0x407d01[_0x21ab('0x31')]=_[_0x21ab('0x32')](_0x407d01[_0x21ab('0x33')],_0x407d01[_0x21ab('0x30')]);_0x3efd47[_0x21ab('0x34')]=_[_0x21ab('0x32')](_0x407d01[_0x21ab('0x33')],qs['fields'](_0x2263bc[_0x21ab('0x30')]['fields']));_0x3efd47[_0x21ab('0x34')]=_0x3efd47['attributes'][_0x21ab('0x35')]?_0x3efd47[_0x21ab('0x34')]:_0x407d01[_0x21ab('0x33')];if(!_0x2263bc['query'][_0x21ab('0x36')]('nolimit')){_0x3efd47[_0x21ab('0x1f')]=qs['limit'](_0x2263bc[_0x21ab('0x30')][_0x21ab('0x1f')]);_0x3efd47[_0x21ab('0x1e')]=qs[_0x21ab('0x1e')](_0x2263bc[_0x21ab('0x30')][_0x21ab('0x1e')]);}_0x3efd47[_0x21ab('0x37')]=qs['sort'](_0x2263bc[_0x21ab('0x30')][_0x21ab('0x38')]);_0x3efd47['where']=qs[_0x21ab('0x31')](_[_0x21ab('0x39')](_0x2263bc[_0x21ab('0x30')],_0x407d01['filters']),_0x29d5cb);if(_0x2263bc[_0x21ab('0x30')][_0x21ab('0x3a')]){_0x3efd47[_0x21ab('0x3b')]=_[_0x21ab('0x3c')](_0x3efd47[_0x21ab('0x3b')],{'$or':_[_0x21ab('0x2f')](_0x29d5cb,function(_0x4e297a){if(_0x4e297a[_0x21ab('0x3d')]!==_0x21ab('0x3e')){var _0x5cf0cc={};_0x5cf0cc[_0x4e297a[_0x21ab('0x2a')]]={'$like':'%'+_0x2263bc['query'][_0x21ab('0x3a')]+'%'};return _0x5cf0cc;}})});}_0x3efd47=_[_0x21ab('0x3c')]({},_0x3efd47,_0x2263bc[_0x21ab('0x3f')]);var _0x268d6a={'where':_0x3efd47[_0x21ab('0x3b')]};return db['SquareRecording'][_0x21ab('0x1d')](_0x268d6a)[_0x21ab('0x26')](function(_0x1dc674){_0x42e897['count']=_0x1dc674;if(_0x2263bc['query'][_0x21ab('0x40')]){_0x3efd47[_0x21ab('0x41')]=[{'all':!![]}];}return db[_0x21ab('0x42')][_0x21ab('0x43')](_0x3efd47);})[_0x21ab('0x26')](function(_0x3d7373){_0x42e897[_0x21ab('0x44')]=_0x3d7373;return _0x42e897;})[_0x21ab('0x26')](respondWithFilteredResult(_0x2e5740,_0x3efd47))['catch'](handleError(_0x2e5740,null));};exports[_0x21ab('0x45')]=function(_0x50c533,_0x276031){var _0x157a47={'raw':!![],'where':{'id':_0x50c533['params']['id']}},_0x35b707={};_0x35b707[_0x21ab('0x33')]=_['keys'](db[_0x21ab('0x42')][_0x21ab('0x2c')]);_0x35b707[_0x21ab('0x30')]=_[_0x21ab('0x46')](_0x50c533[_0x21ab('0x30')]);_0x35b707[_0x21ab('0x31')]=_[_0x21ab('0x32')](_0x35b707[_0x21ab('0x33')],_0x35b707['query']);_0x157a47[_0x21ab('0x34')]=_['intersection'](_0x35b707['model'],qs[_0x21ab('0x47')](_0x50c533[_0x21ab('0x30')][_0x21ab('0x47')]));_0x157a47[_0x21ab('0x34')]=_0x157a47['attributes']['length']?_0x157a47[_0x21ab('0x34')]:_0x35b707['model'];if(_0x50c533[_0x21ab('0x30')][_0x21ab('0x40')]){_0x157a47[_0x21ab('0x41')]=[{'all':!![]}];}_0x157a47=_['merge']({},_0x157a47,_0x50c533['options']);return db[_0x21ab('0x42')][_0x21ab('0x48')](_0x157a47)[_0x21ab('0x26')](handleEntityNotFound(_0x276031,null))[_0x21ab('0x26')](respondWithResult(_0x276031,null))[_0x21ab('0x49')](handleError(_0x276031,null));};exports[_0x21ab('0x4a')]=function(_0x433aa7,_0x3cd07c){return db[_0x21ab('0x42')]['create'](_0x433aa7[_0x21ab('0x4b')],{})[_0x21ab('0x26')](respondWithResult(_0x3cd07c,0xc9))[_0x21ab('0x49')](handleError(_0x3cd07c,null));};exports['update']=function(_0x142862,_0x484eba){if(_0x142862[_0x21ab('0x4b')]['id']){delete _0x142862[_0x21ab('0x4b')]['id'];}return db[_0x21ab('0x42')]['find']({'where':{'id':_0x142862[_0x21ab('0x4c')]['id']}})[_0x21ab('0x26')](handleEntityNotFound(_0x484eba,null))[_0x21ab('0x26')](saveUpdates(_0x142862[_0x21ab('0x4b')],null))['then'](respondWithResult(_0x484eba,null))['catch'](handleError(_0x484eba,null));};exports[_0x21ab('0x4d')]=function(_0x210c2e,_0x4c5cea,_0x46f471){var _0x2d4675=require(_0x21ab('0x4e'));var _0x2b86d1=![];var _0x3c7c8c={};if(_0x210c2e[_0x21ab('0x30')][_0x21ab('0x3d')]&&_0x210c2e[_0x21ab('0x30')][_0x21ab('0x3d')]==='uniqueid'){_0x3c7c8c[_0x21ab('0x4f')]=_0x210c2e[_0x21ab('0x4c')]['id'];}else{_0x3c7c8c['id']=_0x210c2e[_0x21ab('0x4c')]['id'];}return db[_0x21ab('0x42')]['find']({'where':_0x3c7c8c,'attributes':['id',_0x21ab('0x50'),'filename'],'raw':!![]})[_0x21ab('0x26')](handleEntityNotFound(_0x4c5cea,null))[_0x21ab('0x26')](function(_0x28e9d4){if(_0x28e9d4){var _0x42a5ce=_0x28e9d4['savePath'];var _0x3f646c=util['format'](_0x21ab('0x51'),_0x42a5ce);if(fs[_0x21ab('0x52')](_0x3f646c)){_0x2b86d1=!![];return _0x2d4675[_0x21ab('0x53')](_0x3f646c,_0x42a5ce,config['secrets'][_0x21ab('0x54')])[_0x21ab('0x26')](function(){return _0x28e9d4;});}return _0x28e9d4;}})[_0x21ab('0x26')](function(_0x4e5c82){if(_0x4e5c82){var _0x4d48cf=_0x4e5c82[_0x21ab('0x50')];if(!fs[_0x21ab('0x52')](_0x4d48cf)){throw new db['Sequelize']['ValidationError'](_0x21ab('0x55'));}if(_0x4e5c82[_0x21ab('0x56')]){return _0x4c5cea[_0x21ab('0x4d')](_0x4d48cf,_0x4e5c82[_0x21ab('0x56')]+path[_0x21ab('0x57')](_0x4d48cf),function(){if(_0x2b86d1){fs[_0x21ab('0x58')](_0x4d48cf);}});}else{return _0x4c5cea[_0x21ab('0x4d')](_0x4d48cf,function(_0xac4075){if(_0x2b86d1){fs[_0x21ab('0x58')](_0x4d48cf);}});}}})[_0x21ab('0x49')](function(_0x1a07eb){if(_0x1a07eb['message']===_0x21ab('0x55')){_0x4c5cea[_0x21ab('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x4c5cea,null);}});};exports[_0x21ab('0x27')]=function(_0x25aa0f,_0x253774){return db[_0x21ab('0x42')][_0x21ab('0x48')]({'where':{'id':_0x25aa0f[_0x21ab('0x4c')]['id']}})['then'](function(_0x1c79a3){if(!_0x1c79a3)throw new ReferenceError(_0x21ab('0x59'));return _0x1c79a3;})[_0x21ab('0x26')](function(_0x6e4705){var _0x54e077=_0x6e4705['savePath'];logger['info'](_0x21ab('0x5a'),_0x54e077);if(!_[_0x21ab('0x5b')](_0x6e4705[_0x21ab('0x50')])&&fs['existsSync'](_0x54e077)){logger[_0x21ab('0x5c')](_0x21ab('0x5d')+_0x54e077+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x21ab('0x5e')](_0x54e077);}_0x54e077=_0x54e077+'.cypher';if(!_[_0x21ab('0x5b')](_0x6e4705[_0x21ab('0x50')])&&fs[_0x21ab('0x52')](_0x54e077)){logger[_0x21ab('0x5c')](_0x21ab('0x5d')+_0x54e077+_0x21ab('0x5f'));fs[_0x21ab('0x5e')](_0x54e077);}return _0x6e4705;})[_0x21ab('0x26')](function(_0x5857b2){if(!_0x5857b2)throw new InternalError();return _0x5857b2[_0x21ab('0x27')]();})['then'](function(){_0x253774[_0x21ab('0x1a')](0xcc)[_0x21ab('0x1b')]();})[_0x21ab('0x49')](handleError(_0x253774,null));}; \ No newline at end of file +var _0x2f86=['ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','SquareRecording','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','catch','show','includeAll','create','body','../../components/encryptor','uniqueid','params','find','savePath','filename','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','send','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','request-promise','bluebird','mustache','path','to-csv'];(function(_0x2ef492,_0x513742){var _0x298219=function(_0x5f133f){while(--_0x5f133f){_0x2ef492['push'](_0x2ef492['shift']());}};_0x298219(++_0x513742);}(_0x2f86,0xb1));var _0x62f8=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x2f86[_0x55abd9];return _0x3e5669;};'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(_0x62f8('0x0'));var moment=require('moment');var BPromise=require(_0x62f8('0x1'));var Mustache=require(_0x62f8('0x2'));var util=require('util');var path=require(_0x62f8('0x3'));var sox=require('sox');var csv=require(_0x62f8('0x4'));var ejs=require(_0x62f8('0x5'));var fs=require('fs');var _=require(_0x62f8('0x6'));var squel=require(_0x62f8('0x7'));var crypto=require(_0x62f8('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x62f8('0x4'));var querystring=require(_0x62f8('0x9'));var Papa=require(_0x62f8('0xa'));var Redis=require(_0x62f8('0xb'));var authService=require(_0x62f8('0xc'));var qs=require(_0x62f8('0xd'));var as=require(_0x62f8('0xe'));var hardwareService=require(_0x62f8('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x62f8('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x62f8('0x11'))['db'];function respondWithStatusCode(_0x5a7612,_0x1af259){_0x1af259=_0x1af259||0xcc;return function(_0x1db049){if(_0x1db049){return _0x5a7612[_0x62f8('0x12')](_0x1af259);}return _0x5a7612[_0x62f8('0x13')](_0x1af259)[_0x62f8('0x14')]();};}function respondWithResult(_0xa468a8,_0xc8cc49){_0xc8cc49=_0xc8cc49||0xc8;return function(_0x163790){if(_0x163790){return _0xa468a8['status'](_0xc8cc49)[_0x62f8('0x15')](_0x163790);}};}function respondWithFilteredResult(_0x638138,_0x160bc7){return function(_0x37a863){if(_0x37a863){var _0x33eea6=_0x37a863[_0x62f8('0x16')],_0x4eb8f3=_0x160bc7[_0x62f8('0x17')],_0x2f42e4=_0x160bc7[_0x62f8('0x17')]+_0x160bc7['limit'],_0x369861;if(_0x2f42e4>=_0x33eea6){_0x2f42e4=_0x33eea6;_0x369861=0xc8;}else{_0x369861=0xce;}_0x638138[_0x62f8('0x13')](_0x369861);return _0x638138['set'](_0x62f8('0x18'),_0x4eb8f3+'-'+_0x2f42e4+'/'+_0x33eea6)[_0x62f8('0x15')](_0x37a863);}return null;};}function patchUpdates(_0x4eea2f){return function(_0x5f5411){try{jsonpatch[_0x62f8('0x19')](_0x5f5411,_0x4eea2f,!![]);}catch(_0x2f35ad){return BPromise[_0x62f8('0x1a')](_0x2f35ad);}return _0x5f5411[_0x62f8('0x1b')]();};}function saveUpdates(_0x47afc0,_0x31f88b){return function(_0x3ef75e){if(_0x3ef75e){return _0x3ef75e[_0x62f8('0x1c')](_0x47afc0)[_0x62f8('0x1d')](function(_0x5f201d){return _0x5f201d;});}return null;};}function removeEntity(_0x2c3434,_0x2c95d0){return function(_0x45c35b){if(_0x45c35b){return _0x45c35b[_0x62f8('0x1e')]()[_0x62f8('0x1d')](function(){_0x2c3434[_0x62f8('0x13')](0xcc)[_0x62f8('0x14')]();});}};}function handleEntityNotFound(_0x4b776c,_0x2af8a3){return function(_0x333bd0){if(!_0x333bd0){_0x4b776c[_0x62f8('0x12')](0x194);}return _0x333bd0;};}function handleError(_0x4ff784,_0x29be07){_0x29be07=_0x29be07||0x1f4;return function(_0x481fc0){logger[_0x62f8('0x1f')](_0x481fc0['stack']);if(_0x481fc0[_0x62f8('0x20')]){delete _0x481fc0[_0x62f8('0x20')];}_0x4ff784[_0x62f8('0x13')](_0x29be07)['send'](_0x481fc0);};}exports[_0x62f8('0x21')]=function(_0x504ada,_0x76df15){var _0x12531f={},_0x4a379e={},_0x2d92cd={'count':0x0,'rows':[]};var _0x1f1df2=_[_0x62f8('0x22')](db[_0x62f8('0x23')][_0x62f8('0x24')],function(_0x412fa9){return{'name':_0x412fa9['fieldName'],'type':_0x412fa9[_0x62f8('0x25')][_0x62f8('0x26')]};});_0x4a379e[_0x62f8('0x27')]=_[_0x62f8('0x22')](_0x1f1df2,_0x62f8('0x20'));_0x4a379e[_0x62f8('0x28')]=_[_0x62f8('0x29')](_0x504ada[_0x62f8('0x28')]);_0x4a379e[_0x62f8('0x2a')]=_[_0x62f8('0x2b')](_0x4a379e[_0x62f8('0x27')],_0x4a379e[_0x62f8('0x28')]);_0x12531f[_0x62f8('0x2c')]=_['intersection'](_0x4a379e[_0x62f8('0x27')],qs['fields'](_0x504ada[_0x62f8('0x28')][_0x62f8('0x2d')]));_0x12531f[_0x62f8('0x2c')]=_0x12531f[_0x62f8('0x2c')][_0x62f8('0x2e')]?_0x12531f['attributes']:_0x4a379e[_0x62f8('0x27')];if(!_0x504ada[_0x62f8('0x28')][_0x62f8('0x2f')](_0x62f8('0x30'))){_0x12531f['limit']=qs[_0x62f8('0x31')](_0x504ada[_0x62f8('0x28')]['limit']);_0x12531f[_0x62f8('0x17')]=qs[_0x62f8('0x17')](_0x504ada['query'][_0x62f8('0x17')]);}_0x12531f[_0x62f8('0x32')]=qs[_0x62f8('0x33')](_0x504ada[_0x62f8('0x28')]['sort']);_0x12531f['where']=qs['filters'](_[_0x62f8('0x34')](_0x504ada['query'],_0x4a379e['filters']),_0x1f1df2);if(_0x504ada[_0x62f8('0x28')][_0x62f8('0x35')]){_0x12531f[_0x62f8('0x36')]=_['merge'](_0x12531f[_0x62f8('0x36')],{'$or':_[_0x62f8('0x22')](_0x1f1df2,function(_0x2742fb){if(_0x2742fb[_0x62f8('0x25')]!==_0x62f8('0x37')){var _0x97fd30={};_0x97fd30[_0x2742fb['name']]={'$like':'%'+_0x504ada[_0x62f8('0x28')]['filter']+'%'};return _0x97fd30;}})});}_0x12531f=_[_0x62f8('0x38')]({},_0x12531f,_0x504ada[_0x62f8('0x39')]);var _0x30637a={'where':_0x12531f[_0x62f8('0x36')]};return db[_0x62f8('0x23')][_0x62f8('0x16')](_0x30637a)[_0x62f8('0x1d')](function(_0x1250d8){_0x2d92cd[_0x62f8('0x16')]=_0x1250d8;if(_0x504ada[_0x62f8('0x28')]['includeAll']){_0x12531f[_0x62f8('0x3a')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x12531f);})[_0x62f8('0x1d')](function(_0x13a75a){_0x2d92cd['rows']=_0x13a75a;return _0x2d92cd;})[_0x62f8('0x1d')](respondWithFilteredResult(_0x76df15,_0x12531f))[_0x62f8('0x3b')](handleError(_0x76df15,null));};exports[_0x62f8('0x3c')]=function(_0x38b96f,_0x5c8a68){var _0x11f090={'raw':!![],'where':{'id':_0x38b96f['params']['id']}},_0x27e412={};_0x27e412[_0x62f8('0x27')]=_[_0x62f8('0x29')](db[_0x62f8('0x23')][_0x62f8('0x24')]);_0x27e412[_0x62f8('0x28')]=_[_0x62f8('0x29')](_0x38b96f[_0x62f8('0x28')]);_0x27e412['filters']=_[_0x62f8('0x2b')](_0x27e412[_0x62f8('0x27')],_0x27e412[_0x62f8('0x28')]);_0x11f090[_0x62f8('0x2c')]=_[_0x62f8('0x2b')](_0x27e412[_0x62f8('0x27')],qs[_0x62f8('0x2d')](_0x38b96f[_0x62f8('0x28')]['fields']));_0x11f090[_0x62f8('0x2c')]=_0x11f090[_0x62f8('0x2c')]['length']?_0x11f090['attributes']:_0x27e412['model'];if(_0x38b96f[_0x62f8('0x28')][_0x62f8('0x3d')]){_0x11f090[_0x62f8('0x3a')]=[{'all':!![]}];}_0x11f090=_[_0x62f8('0x38')]({},_0x11f090,_0x38b96f['options']);return db[_0x62f8('0x23')]['find'](_0x11f090)[_0x62f8('0x1d')](handleEntityNotFound(_0x5c8a68,null))[_0x62f8('0x1d')](respondWithResult(_0x5c8a68,null))['catch'](handleError(_0x5c8a68,null));};exports[_0x62f8('0x3e')]=function(_0x454351,_0x542cda){return db['SquareRecording'][_0x62f8('0x3e')](_0x454351[_0x62f8('0x3f')],{})[_0x62f8('0x1d')](respondWithResult(_0x542cda,0xc9))[_0x62f8('0x3b')](handleError(_0x542cda,null));};exports[_0x62f8('0x1c')]=function(_0x49ba03,_0x7434c8){if(_0x49ba03[_0x62f8('0x3f')]['id']){delete _0x49ba03[_0x62f8('0x3f')]['id'];}return db[_0x62f8('0x23')]['find']({'where':{'id':_0x49ba03['params']['id']}})['then'](handleEntityNotFound(_0x7434c8,null))[_0x62f8('0x1d')](saveUpdates(_0x49ba03[_0x62f8('0x3f')],null))['then'](respondWithResult(_0x7434c8,null))[_0x62f8('0x3b')](handleError(_0x7434c8,null));};exports['download']=function(_0x192af3,_0x3eaef3,_0x278e43){var _0x2270e3=require(_0x62f8('0x40'));var _0x2b081a=![];var _0xdf51eb={};if(_0x192af3[_0x62f8('0x28')][_0x62f8('0x25')]&&_0x192af3[_0x62f8('0x28')][_0x62f8('0x25')]===_0x62f8('0x41')){_0xdf51eb['uniqueid']=_0x192af3[_0x62f8('0x42')]['id'];}else{_0xdf51eb['id']=_0x192af3[_0x62f8('0x42')]['id'];}return db['SquareRecording'][_0x62f8('0x43')]({'where':_0xdf51eb,'attributes':['id',_0x62f8('0x44'),_0x62f8('0x45')],'raw':!![]})[_0x62f8('0x1d')](handleEntityNotFound(_0x3eaef3,null))['then'](function(_0x5e33fd){if(_0x5e33fd){var _0x3ddf8c=_0x5e33fd['savePath'];var _0x7eb96=util[_0x62f8('0x46')](_0x62f8('0x47'),_0x3ddf8c);if(fs[_0x62f8('0x48')](_0x7eb96)){_0x2b081a=!![];return _0x2270e3['decryptFile'](_0x7eb96,_0x3ddf8c,config[_0x62f8('0x49')][_0x62f8('0x4a')])[_0x62f8('0x1d')](function(){return _0x5e33fd;});}return _0x5e33fd;}})[_0x62f8('0x1d')](function(_0x923166){if(_0x923166){var _0x53e52c=_0x923166[_0x62f8('0x44')];if(!fs['existsSync'](_0x53e52c)){throw new db[(_0x62f8('0x4b'))][(_0x62f8('0x4c'))](_0x62f8('0x4d'));}if(_0x923166[_0x62f8('0x45')]){return _0x3eaef3[_0x62f8('0x4e')](_0x53e52c,_0x923166[_0x62f8('0x45')]+path[_0x62f8('0x4f')](_0x53e52c),function(){if(_0x2b081a){fs[_0x62f8('0x50')](_0x53e52c);}});}else{return _0x3eaef3['download'](_0x53e52c,function(_0x4c0ce5){if(_0x2b081a){fs['unlink'](_0x53e52c);}});}}})[_0x62f8('0x3b')](function(_0x443a59){if(_0x443a59[_0x62f8('0x51')]===_0x62f8('0x4d')){_0x3eaef3[_0x62f8('0x13')](0x194)[_0x62f8('0x52')](_0x62f8('0x53'));}else{return handleError(_0x3eaef3,null);}});};exports['destroy']=function(_0x56e4aa,_0x4203c1){return db[_0x62f8('0x23')][_0x62f8('0x43')]({'where':{'id':_0x56e4aa[_0x62f8('0x42')]['id']}})['then'](function(_0x590558){if(!_0x590558)throw new ReferenceError(_0x62f8('0x54'));return _0x590558;})['then'](function(_0x5bcd96){var _0x233720=_0x5bcd96[_0x62f8('0x44')];logger[_0x62f8('0x55')]('cancellazione\x20fisica\x20documento\x20%s',_0x233720);if(!_[_0x62f8('0x56')](_0x5bcd96[_0x62f8('0x44')])&&fs[_0x62f8('0x48')](_0x233720)){logger[_0x62f8('0x55')](_0x62f8('0x57')+_0x233720+_0x62f8('0x58'));fs['unlinkSync'](_0x233720);}_0x233720=_0x233720+_0x62f8('0x59');if(!_['isNil'](_0x5bcd96['savePath'])&&fs[_0x62f8('0x48')](_0x233720)){logger[_0x62f8('0x55')]('File:\x20\x22'+_0x233720+_0x62f8('0x58'));fs[_0x62f8('0x5a')](_0x233720);}return _0x5bcd96;})['then'](function(_0x1a747b){if(!_0x1a747b)throw new InternalError();return _0x1a747b[_0x62f8('0x1e')]();})[_0x62f8('0x1d')](function(){_0x4203c1['status'](0xcc)[_0x62f8('0x14')]();})[_0x62f8('0x3b')](handleError(_0x4203c1,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 3445b5e..090a154 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 _0x2ace=['api','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','util','../../config/logger'];(function(_0x493f9c,_0x428966){var _0x1b32f6=function(_0x222c98){while(--_0x222c98){_0x493f9c['push'](_0x493f9c['shift']());}};_0x1b32f6(++_0x428966);}(_0x2ace,0x17e));var _0xe2ac=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2ace[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0xe2ac('0x0'));var logger=require(_0xe2ac('0x1'))(_0xe2ac('0x2'));var moment=require('moment');var BPromise=require(_0xe2ac('0x3'));var rp=require(_0xe2ac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2ac('0x5'));var config=require(_0xe2ac('0x6'));var attributes=require(_0xe2ac('0x7'));module[_0xe2ac('0x8')]=function(_0x386b18,_0x46e9f3){return _0x386b18[_0xe2ac('0x9')](_0xe2ac('0xa'),attributes,{'tableName':_0xe2ac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5c9=['util','../../config/logger','api','request-promise','path','exports','define','square_recordings','lodash'];(function(_0x273510,_0x4cb419){var _0x3f46fb=function(_0x189f84){while(--_0x189f84){_0x273510['push'](_0x273510['shift']());}};_0x3f46fb(++_0x4cb419);}(_0xa5c9,0x143));var _0x9a5c=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xa5c9[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0x9a5c('0x0'));var util=require(_0x9a5c('0x1'));var logger=require(_0x9a5c('0x2'))(_0x9a5c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9a5c('0x4'));var fs=require('fs');var path=require(_0x9a5c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0x9a5c('0x6')]=function(_0x2a697c,_0x2cac2a){return _0x2a697c[_0x9a5c('0x7')]('SquareRecording',attributes,{'tableName':_0x9a5c('0x8'),'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 6ab73a9..643bf0c 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 _0xfaec=['stringify','error','message','catch','CreateSquareRecording','SquareRecording','create','options','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../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'];(function(_0x5173b2,_0x2b2911){var _0x6be46f=function(_0x1d62c6){while(--_0x1d62c6){_0x5173b2['push'](_0x5173b2['shift']());}};_0x6be46f(++_0x2b2911);}(_0xfaec,0xc5));var _0xcfae=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xfaec[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0xcfae('0x0'));var moment=require(_0xcfae('0x1'));var BPromise=require(_0xcfae('0x2'));var rs=require(_0xcfae('0x3'));var fs=require('fs');var Redis=require(_0xcfae('0x4'));var db=require(_0xcfae('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcfae('0x6'))(_0xcfae('0x7'));var config=require(_0xcfae('0x8'));var jayson=require(_0xcfae('0x9'));var client=jayson[_0xcfae('0xa')][_0xcfae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x369bae,_0x18a107,_0x2fac66){return new BPromise(function(_0x4f15cb,_0x2b8a8d){return client[_0xcfae('0xc')](_0x369bae,_0x2fac66)[_0xcfae('0xd')](function(_0x25c828){logger[_0xcfae('0xe')](_0xcfae('0xf'),_0x18a107,_0xcfae('0x10'));logger[_0xcfae('0x11')](_0xcfae('0x12'),_0x18a107,_0xcfae('0x10'),JSON[_0xcfae('0x13')](_0x25c828));if(_0x25c828[_0xcfae('0x14')]){if(_0x25c828[_0xcfae('0x14')]['code']===0x1f4){logger[_0xcfae('0x14')]('SquareRecording,\x20%s,\x20%s',_0x18a107,_0x25c828[_0xcfae('0x14')][_0xcfae('0x15')]);return _0x2b8a8d(_0x25c828[_0xcfae('0x14')][_0xcfae('0x15')]);}logger[_0xcfae('0x14')]('SquareRecording,\x20%s,\x20%s',_0x18a107,_0x25c828[_0xcfae('0x14')][_0xcfae('0x15')]);return _0x4f15cb(_0x25c828[_0xcfae('0x14')][_0xcfae('0x15')]);}else{logger[_0xcfae('0xe')](_0xcfae('0xf'),_0x18a107,'request\x20sent');_0x4f15cb(_0x25c828['result'][_0xcfae('0x15')]);}})[_0xcfae('0x16')](function(_0x43c9fd){logger[_0xcfae('0x14')](_0xcfae('0xf'),_0x18a107,_0x43c9fd);_0x2b8a8d(_0x43c9fd);});});}exports[_0xcfae('0x17')]=function(_0x2b5ff5){var _0x52bd32=this;return new Promise(function(_0x447c5b,_0x53f9d1){return db[_0xcfae('0x18')][_0xcfae('0x19')](_0x2b5ff5['body'],{'raw':_0x2b5ff5[_0xcfae('0x1a')]?_0x2b5ff5[_0xcfae('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3d0463){logger['info'](_0xcfae('0x17'),_0x2b5ff5);logger[_0xcfae('0x11')](_0xcfae('0x17'),_0x2b5ff5,JSON['stringify'](_0x3d0463));_0x447c5b(_0x3d0463);})[_0xcfae('0x16')](function(_0x8f9c11){logger[_0xcfae('0x14')](_0xcfae('0x17'),_0x8f9c11[_0xcfae('0x15')],_0x2b5ff5);_0x53f9d1(_0x52bd32['error'](0x1f4,_0x8f9c11[_0xcfae('0x15')]));});});}; \ No newline at end of file +var _0x8433=['message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8433,0x159));var _0x3843=function(_0x366e99,_0x15d82d){_0x366e99=_0x366e99-0x0;var _0x180bbe=_0x8433[_0x366e99];return _0x180bbe;};'use strict';var _=require('lodash');var util=require(_0x3843('0x0'));var moment=require('moment');var BPromise=require(_0x3843('0x1'));var rs=require(_0x3843('0x2'));var fs=require('fs');var Redis=require(_0x3843('0x3'));var db=require(_0x3843('0x4'))['db'];var utils=require(_0x3843('0x5'));var logger=require(_0x3843('0x6'))('rpc');var config=require(_0x3843('0x7'));var jayson=require(_0x3843('0x8'));var client=jayson['client'][_0x3843('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57dfab,_0x1a8604,_0x5247be){return new BPromise(function(_0xe1c413,_0x1133cb){return client[_0x3843('0xa')](_0x57dfab,_0x5247be)[_0x3843('0xb')](function(_0x5cd90e){logger[_0x3843('0xc')](_0x3843('0xd'),_0x1a8604,_0x3843('0xe'));logger[_0x3843('0xf')](_0x3843('0x10'),_0x1a8604,_0x3843('0xe'),JSON['stringify'](_0x5cd90e));if(_0x5cd90e[_0x3843('0x11')]){if(_0x5cd90e[_0x3843('0x11')][_0x3843('0x12')]===0x1f4){logger[_0x3843('0x11')](_0x3843('0xd'),_0x1a8604,_0x5cd90e[_0x3843('0x11')][_0x3843('0x13')]);return _0x1133cb(_0x5cd90e[_0x3843('0x11')]['message']);}logger[_0x3843('0x11')](_0x3843('0xd'),_0x1a8604,_0x5cd90e[_0x3843('0x11')][_0x3843('0x13')]);return _0xe1c413(_0x5cd90e[_0x3843('0x11')][_0x3843('0x13')]);}else{logger[_0x3843('0xc')](_0x3843('0xd'),_0x1a8604,_0x3843('0xe'));_0xe1c413(_0x5cd90e[_0x3843('0x14')][_0x3843('0x13')]);}})[_0x3843('0x15')](function(_0x102cba){logger['error'](_0x3843('0xd'),_0x1a8604,_0x102cba);_0x1133cb(_0x102cba);});});}exports[_0x3843('0x16')]=function(_0x2b31a5){var _0x335a87=this;return new Promise(function(_0x473efc,_0x1fea4c){return db[_0x3843('0x17')][_0x3843('0x18')](_0x2b31a5[_0x3843('0x19')],{'raw':_0x2b31a5[_0x3843('0x1a')]?_0x2b31a5[_0x3843('0x1a')][_0x3843('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x371f8e){logger[_0x3843('0xc')](_0x3843('0x16'),_0x2b31a5);logger[_0x3843('0xf')](_0x3843('0x16'),_0x2b31a5,JSON['stringify'](_0x371f8e));_0x473efc(_0x371f8e);})[_0x3843('0x15')](function(_0x1369b2){logger[_0x3843('0x11')](_0x3843('0x16'),_0x1369b2[_0x3843('0x13')],_0x2b31a5);_0x1fea4c(_0x335a87[_0x3843('0x11')](0x1f4,_0x1369b2['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 2de7aa4..5a94b92 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 _0x7f2a=['get','/describe','describe','/:id','post','create','delete','exports','connect-timeout','express','Router','../../config/environment','isAuthenticated','index'];(function(_0x29aa84,_0x25a260){var _0x46cc12=function(_0x1a11f3){while(--_0x1a11f3){_0x29aa84['push'](_0x29aa84['shift']());}};_0x46cc12(++_0x25a260);}(_0x7f2a,0x120));var _0xa7f2=function(_0xb1162f,_0x5a6159){_0xb1162f=_0xb1162f-0x0;var _0xb16c3d=_0x7f2a[_0xb1162f];return _0xb16c3d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa7f2('0x0'));var express=require(_0xa7f2('0x1'));var router=express[_0xa7f2('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa7f2('0x3'));var controller=require('./squareReport.controller');router['get']('/',auth[_0xa7f2('0x4')](),controller[_0xa7f2('0x5')]);router[_0xa7f2('0x6')](_0xa7f2('0x7'),auth[_0xa7f2('0x4')](),controller[_0xa7f2('0x8')]);router[_0xa7f2('0x6')](_0xa7f2('0x9'),auth[_0xa7f2('0x4')](),controller['show']);router[_0xa7f2('0xa')]('/',auth['isAuthenticated'](),controller[_0xa7f2('0xb')]);router['put'](_0xa7f2('0x9'),auth[_0xa7f2('0x4')](),controller['update']);router[_0xa7f2('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa7f2('0xd')]=router; \ No newline at end of file +var _0x6ce7=['get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','./squareReport.controller'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x6ce7,0x6b));var _0x76ce=function(_0x513097,_0x38d747){_0x513097=_0x513097-0x0;var _0x2295ba=_0x6ce7[_0x513097];return _0x2295ba;};'use strict';var multer=require(_0x76ce('0x0'));var util=require(_0x76ce('0x1'));var path=require(_0x76ce('0x2'));var timeout=require(_0x76ce('0x3'));var express=require(_0x76ce('0x4'));var router=express[_0x76ce('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x76ce('0x6'));router[_0x76ce('0x7')]('/',auth[_0x76ce('0x8')](),controller['index']);router['get'](_0x76ce('0x9'),auth[_0x76ce('0x8')](),controller[_0x76ce('0xa')]);router[_0x76ce('0x7')]('/:id',auth[_0x76ce('0x8')](),controller[_0x76ce('0xb')]);router[_0x76ce('0xc')]('/',auth[_0x76ce('0x8')](),controller[_0x76ce('0xd')]);router[_0x76ce('0xe')](_0x76ce('0xf'),auth[_0x76ce('0x8')](),controller[_0x76ce('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x76ce('0x11')]);module[_0x76ce('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 813925c..5ba206a 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 _0xefac=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xefac,0x7c));var _0xcefa=function(_0x14d969,_0x522c63){_0x14d969=_0x14d969-0x0;var _0x55d55c=_0xefac[_0x14d969];return _0x55d55c;};'use strict';var Sequelize=require(_0xcefa('0x0'));module[_0xcefa('0x1')]={'network':{'type':Sequelize[_0xcefa('0x2')]},'network_script':{'type':Sequelize[_0xcefa('0x2')]},'request':{'type':Sequelize[_0xcefa('0x2')]},'channel':{'type':Sequelize[_0xcefa('0x2')]},'language':{'type':Sequelize[_0xcefa('0x2')]},'type':{'type':Sequelize[_0xcefa('0x2')]},'uniqueid':{'type':Sequelize[_0xcefa('0x2')]},'version':{'type':Sequelize[_0xcefa('0x2')]},'callerid':{'type':Sequelize[_0xcefa('0x2')]},'calleridname':{'type':Sequelize[_0xcefa('0x2')]},'callingpres':{'type':Sequelize[_0xcefa('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xcefa('0x2')]},'dnid':{'type':Sequelize[_0xcefa('0x2')]},'rdnis':{'type':Sequelize[_0xcefa('0x2')]},'context':{'type':Sequelize[_0xcefa('0x2')]},'extension':{'type':Sequelize[_0xcefa('0x2')]},'priority':{'type':Sequelize[_0xcefa('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xcefa('0x2')]},'threadid':{'type':Sequelize[_0xcefa('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xcefa('0x3')]},'leaveAt':{'type':Sequelize[_0xcefa('0x3')]},'bot':{'type':Sequelize[_0xcefa('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x7571=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x1d3019,_0x8dbbd5){var _0x36458e=function(_0x5d60db){while(--_0x5d60db){_0x1d3019['push'](_0x1d3019['shift']());}};_0x36458e(++_0x8dbbd5);}(_0x7571,0x164));var _0x1757=function(_0x4b544a,_0x462e83){_0x4b544a=_0x4b544a-0x0;var _0xcd5a5d=_0x7571[_0x4b544a];return _0xcd5a5d;};'use strict';var Sequelize=require(_0x1757('0x0'));module[_0x1757('0x1')]={'network':{'type':Sequelize[_0x1757('0x2')]},'network_script':{'type':Sequelize[_0x1757('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1757('0x2')]},'language':{'type':Sequelize[_0x1757('0x2')]},'type':{'type':Sequelize[_0x1757('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x1757('0x2')]},'callerid':{'type':Sequelize[_0x1757('0x2')]},'calleridname':{'type':Sequelize[_0x1757('0x2')]},'callingpres':{'type':Sequelize[_0x1757('0x2')]},'callingani2':{'type':Sequelize[_0x1757('0x2')]},'callington':{'type':Sequelize[_0x1757('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x1757('0x2')]},'rdnis':{'type':Sequelize[_0x1757('0x2')]},'context':{'type':Sequelize[_0x1757('0x2')]},'extension':{'type':Sequelize[_0x1757('0x2')]},'priority':{'type':Sequelize[_0x1757('0x2')]},'enhanced':{'type':Sequelize[_0x1757('0x2')]},'accountcode':{'type':Sequelize[_0x1757('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x1757('0x2')]},'joinAt':{'type':Sequelize[_0x1757('0x3')]},'leaveAt':{'type':Sequelize[_0x1757('0x3')]},'bot':{'type':Sequelize[_0x1757('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 8f291c3..4b6d8d8 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 _0x1a38=['filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','merge','VIRTUAL','count','include','findAll','rows','catch','show','rawAttributes','options','create','body','find','params','describe','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','SquareReport','fieldName','type','query','keys'];(function(_0x697afd,_0x2b09d8){var _0x167358=function(_0x41bdfe){while(--_0x41bdfe){_0x697afd['push'](_0x697afd['shift']());}};_0x167358(++_0x2b09d8);}(_0x1a38,0xb0));var _0x81a3=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x1a38[_0x474bc0];return _0x4b24cf;};'use strict';var pdf=require(_0x81a3('0x0'));var emlformat=require(_0x81a3('0x1'));var rimraf=require(_0x81a3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x81a3('0x3'));var BPromise=require(_0x81a3('0x4'));var Mustache=require(_0x81a3('0x5'));var util=require(_0x81a3('0x6'));var path=require(_0x81a3('0x7'));var sox=require(_0x81a3('0x8'));var csv=require(_0x81a3('0x9'));var ejs=require(_0x81a3('0xa'));var fs=require('fs');var _=require(_0x81a3('0xb'));var squel=require(_0x81a3('0xc'));var crypto=require(_0x81a3('0xd'));var jsforce=require(_0x81a3('0xe'));var deskjs=require(_0x81a3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x81a3('0x10'));var Papa=require(_0x81a3('0x11'));var Redis=require(_0x81a3('0x12'));var authService=require(_0x81a3('0x13'));var qs=require(_0x81a3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x81a3('0x15'));var logger=require(_0x81a3('0x16'))(_0x81a3('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x81a3('0x18'));var db=require(_0x81a3('0x19'))['db'];function respondWithStatusCode(_0x44ac21,_0x45004e){_0x45004e=_0x45004e||0xcc;return function(_0x199fa0){if(_0x199fa0){return _0x44ac21[_0x81a3('0x1a')](_0x45004e);}return _0x44ac21[_0x81a3('0x1b')](_0x45004e)[_0x81a3('0x1c')]();};}function respondWithResult(_0x3305a9,_0x17fa02){_0x17fa02=_0x17fa02||0xc8;return function(_0x2683f3){if(_0x2683f3){return _0x3305a9[_0x81a3('0x1b')](_0x17fa02)['json'](_0x2683f3);}};}function respondWithFilteredResult(_0x168cf1,_0x277e02){return function(_0x2c5a34){if(_0x2c5a34){var _0x2a0b2c=_0x2c5a34['count'],_0x4fe29c=_0x277e02[_0x81a3('0x1d')],_0x44da7e=_0x277e02['offset']+_0x277e02['limit'],_0x18fc8d;if(_0x44da7e>=_0x2a0b2c){_0x44da7e=_0x2a0b2c;_0x18fc8d=0xc8;}else{_0x18fc8d=0xce;}_0x168cf1[_0x81a3('0x1b')](_0x18fc8d);return _0x168cf1[_0x81a3('0x1e')](_0x81a3('0x1f'),_0x4fe29c+'-'+_0x44da7e+'/'+_0x2a0b2c)[_0x81a3('0x20')](_0x2c5a34);}return null;};}function patchUpdates(_0x1c3f9c){return function(_0x2aaa65){try{jsonpatch[_0x81a3('0x21')](_0x2aaa65,_0x1c3f9c,!![]);}catch(_0xbb1c60){return BPromise['reject'](_0xbb1c60);}return _0x2aaa65[_0x81a3('0x22')]();};}function saveUpdates(_0x324706,_0x4ef0c4){return function(_0x457bd0){if(_0x457bd0){return _0x457bd0[_0x81a3('0x23')](_0x324706)[_0x81a3('0x24')](function(_0x172afa){return _0x172afa;});}return null;};}function removeEntity(_0x58b63d,_0x316d48){return function(_0x3f15ca){if(_0x3f15ca){return _0x3f15ca[_0x81a3('0x25')]()['then'](function(){_0x58b63d['status'](0xcc)[_0x81a3('0x1c')]();});}};}function handleEntityNotFound(_0x328b0d,_0x19d2e1){return function(_0x40aaec){if(!_0x40aaec){_0x328b0d['sendStatus'](0x194);}return _0x40aaec;};}function handleError(_0x57dcca,_0x488a07){_0x488a07=_0x488a07||0x1f4;return function(_0x1583fd){logger[_0x81a3('0x26')](_0x1583fd[_0x81a3('0x27')]);if(_0x1583fd[_0x81a3('0x28')]){delete _0x1583fd[_0x81a3('0x28')];}_0x57dcca[_0x81a3('0x1b')](_0x488a07)[_0x81a3('0x29')](_0x1583fd);};}exports[_0x81a3('0x2a')]=function(_0x46a4d0,_0x1852e4){var _0x113863={},_0x3cfad2={},_0x52fcfc={'count':0x0,'rows':[]};var _0x40032e=_[_0x81a3('0x2b')](db[_0x81a3('0x2c')]['rawAttributes'],function(_0x4afd80){return{'name':_0x4afd80[_0x81a3('0x2d')],'type':_0x4afd80[_0x81a3('0x2e')]['key']};});_0x3cfad2['model']=_['map'](_0x40032e,_0x81a3('0x28'));_0x3cfad2[_0x81a3('0x2f')]=_[_0x81a3('0x30')](_0x46a4d0[_0x81a3('0x2f')]);_0x3cfad2[_0x81a3('0x31')]=_[_0x81a3('0x32')](_0x3cfad2['model'],_0x3cfad2[_0x81a3('0x2f')]);_0x113863['attributes']=_[_0x81a3('0x32')](_0x3cfad2[_0x81a3('0x33')],qs[_0x81a3('0x34')](_0x46a4d0[_0x81a3('0x2f')][_0x81a3('0x34')]));_0x113863[_0x81a3('0x35')]=_0x113863[_0x81a3('0x35')][_0x81a3('0x36')]?_0x113863[_0x81a3('0x35')]:_0x3cfad2['model'];if(!_0x46a4d0['query'][_0x81a3('0x37')]('nolimit')){_0x113863[_0x81a3('0x38')]=qs['limit'](_0x46a4d0['query'][_0x81a3('0x38')]);_0x113863[_0x81a3('0x1d')]=qs[_0x81a3('0x1d')](_0x46a4d0[_0x81a3('0x2f')]['offset']);}_0x113863[_0x81a3('0x39')]=qs[_0x81a3('0x3a')](_0x46a4d0[_0x81a3('0x2f')]['sort']);_0x113863[_0x81a3('0x3b')]=qs['filters'](_['pick'](_0x46a4d0['query'],_0x3cfad2[_0x81a3('0x31')]),_0x40032e);if(_0x46a4d0[_0x81a3('0x2f')]['filter']){_0x113863[_0x81a3('0x3b')]=_[_0x81a3('0x3c')](_0x113863[_0x81a3('0x3b')],{'$or':_['map'](_0x40032e,function(_0x503707){if(_0x503707[_0x81a3('0x2e')]!==_0x81a3('0x3d')){var _0x525e3b={};_0x525e3b[_0x503707[_0x81a3('0x28')]]={'$like':'%'+_0x46a4d0[_0x81a3('0x2f')]['filter']+'%'};return _0x525e3b;}})});}_0x113863=_[_0x81a3('0x3c')]({},_0x113863,_0x46a4d0['options']);var _0x53cf9f={'where':_0x113863['where']};return db[_0x81a3('0x2c')][_0x81a3('0x3e')](_0x53cf9f)[_0x81a3('0x24')](function(_0x1fe25c){_0x52fcfc[_0x81a3('0x3e')]=_0x1fe25c;if(_0x46a4d0[_0x81a3('0x2f')]['includeAll']){_0x113863[_0x81a3('0x3f')]=[{'all':!![]}];}return db[_0x81a3('0x2c')][_0x81a3('0x40')](_0x113863);})[_0x81a3('0x24')](function(_0x3ad129){_0x52fcfc[_0x81a3('0x41')]=_0x3ad129;return _0x52fcfc;})['then'](respondWithFilteredResult(_0x1852e4,_0x113863))[_0x81a3('0x42')](handleError(_0x1852e4,null));};exports[_0x81a3('0x43')]=function(_0x51315e,_0x45bc48){var _0x24fca3={'raw':!![],'where':{'id':_0x51315e['params']['id']}},_0x11551a={};_0x11551a[_0x81a3('0x33')]=_[_0x81a3('0x30')](db['SquareReport'][_0x81a3('0x44')]);_0x11551a[_0x81a3('0x2f')]=_[_0x81a3('0x30')](_0x51315e[_0x81a3('0x2f')]);_0x11551a[_0x81a3('0x31')]=_[_0x81a3('0x32')](_0x11551a[_0x81a3('0x33')],_0x11551a['query']);_0x24fca3['attributes']=_['intersection'](_0x11551a[_0x81a3('0x33')],qs[_0x81a3('0x34')](_0x51315e[_0x81a3('0x2f')]['fields']));_0x24fca3[_0x81a3('0x35')]=_0x24fca3[_0x81a3('0x35')]['length']?_0x24fca3[_0x81a3('0x35')]:_0x11551a[_0x81a3('0x33')];if(_0x51315e[_0x81a3('0x2f')]['includeAll']){_0x24fca3[_0x81a3('0x3f')]=[{'all':!![]}];}_0x24fca3=_['merge']({},_0x24fca3,_0x51315e[_0x81a3('0x45')]);return db[_0x81a3('0x2c')]['find'](_0x24fca3)['then'](handleEntityNotFound(_0x45bc48,null))[_0x81a3('0x24')](respondWithResult(_0x45bc48,null))[_0x81a3('0x42')](handleError(_0x45bc48,null));};exports['create']=function(_0xb7ce17,_0x32ed17){return db[_0x81a3('0x2c')][_0x81a3('0x46')](_0xb7ce17[_0x81a3('0x47')],{})[_0x81a3('0x24')](respondWithResult(_0x32ed17,0xc9))['catch'](handleError(_0x32ed17,null));};exports[_0x81a3('0x23')]=function(_0x48a1be,_0x496901){if(_0x48a1be[_0x81a3('0x47')]['id']){delete _0x48a1be['body']['id'];}return db[_0x81a3('0x2c')][_0x81a3('0x48')]({'where':{'id':_0x48a1be[_0x81a3('0x49')]['id']}})['then'](handleEntityNotFound(_0x496901,null))[_0x81a3('0x24')](saveUpdates(_0x48a1be[_0x81a3('0x47')],null))[_0x81a3('0x24')](respondWithResult(_0x496901,null))[_0x81a3('0x42')](handleError(_0x496901,null));};exports[_0x81a3('0x25')]=function(_0x35b792,_0x5b4a72){return db[_0x81a3('0x2c')][_0x81a3('0x48')]({'where':{'id':_0x35b792['params']['id']}})['then'](handleEntityNotFound(_0x5b4a72,null))[_0x81a3('0x24')](removeEntity(_0x5b4a72,null))[_0x81a3('0x42')](handleError(_0x5b4a72,null));};exports[_0x81a3('0x4a')]=function(_0x380932,_0x356dd4){return db[_0x81a3('0x2c')][_0x81a3('0x4a')]()[_0x81a3('0x24')](respondWithResult(_0x356dd4,null))[_0x81a3('0x42')](handleError(_0x356dd4,null));}; \ No newline at end of file +var _0x524e=['query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','SquareReport','count','includeAll','include','rows','catch','show','params','keys','intersection','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','map'];(function(_0x58fb84,_0x507bc5){var _0x19215a=function(_0x5420d5){while(--_0x5420d5){_0x58fb84['push'](_0x58fb84['shift']());}};_0x19215a(++_0x507bc5);}(_0x524e,0x15e));var _0xe524=function(_0x102fc8,_0x48e0bc){_0x102fc8=_0x102fc8-0x0;var _0x3013ba=_0x524e[_0x102fc8];return _0x3013ba;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe524('0x0'));var zipdir=require(_0xe524('0x1'));var jsonpatch=require(_0xe524('0x2'));var rp=require(_0xe524('0x3'));var moment=require(_0xe524('0x4'));var BPromise=require(_0xe524('0x5'));var Mustache=require(_0xe524('0x6'));var util=require(_0xe524('0x7'));var path=require(_0xe524('0x8'));var sox=require(_0xe524('0x9'));var csv=require('to-csv');var ejs=require(_0xe524('0xa'));var fs=require('fs');var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0xf'));var querystring=require(_0xe524('0x10'));var Papa=require(_0xe524('0x11'));var Redis=require(_0xe524('0x12'));var authService=require(_0xe524('0x13'));var qs=require(_0xe524('0x14'));var as=require(_0xe524('0x15'));var hardwareService=require(_0xe524('0x16'));var logger=require(_0xe524('0x17'))(_0xe524('0x18'));var utils=require(_0xe524('0x19'));var config=require(_0xe524('0x1a'));var licenseUtil=require(_0xe524('0x1b'));var db=require(_0xe524('0x1c'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1d')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1e')](_0x4b0f51)[_0xe524('0x1f')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x20')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=_0x569660['count'],_0x109795=_0x48165e['offset'],_0x538754=_0x48165e['offset']+_0x48165e[_0xe524('0x21')],_0x29a031;if(_0x538754>=_0x488fce){_0x538754=_0x488fce;_0x29a031=0xc8;}else{_0x29a031=0xce;}_0x1b0af6['status'](_0x29a031);return _0x1b0af6[_0xe524('0x22')](_0xe524('0x23'),_0x109795+'-'+_0x538754+'/'+_0x488fce)[_0xe524('0x20')](_0x569660);}return null;};}function patchUpdates(_0x209d0b){return function(_0x5d7b17){try{jsonpatch[_0xe524('0x24')](_0x5d7b17,_0x209d0b,!![]);}catch(_0x3ccb3f){return BPromise['reject'](_0x3ccb3f);}return _0x5d7b17[_0xe524('0x25')]();};}function saveUpdates(_0x309f85,_0x43a4f9){return function(_0x1dcc0f){if(_0x1dcc0f){return _0x1dcc0f[_0xe524('0x26')](_0x309f85)[_0xe524('0x27')](function(_0xbf059b){return _0xbf059b;});}return null;};}function removeEntity(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x28')]()['then'](function(){_0x375219['status'](0xcc)[_0xe524('0x1f')]();});}};}function handleEntityNotFound(_0x23df5e,_0x1ad106){return function(_0x85fc51){if(!_0x85fc51){_0x23df5e['sendStatus'](0x194);}return _0x85fc51;};}function handleError(_0x158f07,_0x4a03bc){_0x4a03bc=_0x4a03bc||0x1f4;return function(_0x17e245){logger[_0xe524('0x29')](_0x17e245[_0xe524('0x2a')]);if(_0x17e245[_0xe524('0x2b')]){delete _0x17e245[_0xe524('0x2b')];}_0x158f07[_0xe524('0x1e')](_0x4a03bc)[_0xe524('0x2c')](_0x17e245);};}exports['index']=function(_0x58a896,_0x283f18){var _0x45abad={},_0x476572={},_0x109a96={'count':0x0,'rows':[]};var _0x359c8b=_['map'](db['SquareReport'][_0xe524('0x2d')],function(_0x25e7a7){return{'name':_0x25e7a7[_0xe524('0x2e')],'type':_0x25e7a7[_0xe524('0x2f')][_0xe524('0x30')]};});_0x476572['model']=_[_0xe524('0x31')](_0x359c8b,_0xe524('0x2b'));_0x476572['query']=_['keys'](_0x58a896[_0xe524('0x32')]);_0x476572[_0xe524('0x33')]=_['intersection'](_0x476572[_0xe524('0x34')],_0x476572['query']);_0x45abad[_0xe524('0x35')]=_['intersection'](_0x476572[_0xe524('0x34')],qs[_0xe524('0x36')](_0x58a896[_0xe524('0x32')]['fields']));_0x45abad[_0xe524('0x35')]=_0x45abad['attributes'][_0xe524('0x37')]?_0x45abad[_0xe524('0x35')]:_0x476572[_0xe524('0x34')];if(!_0x58a896['query'][_0xe524('0x38')](_0xe524('0x39'))){_0x45abad['limit']=qs[_0xe524('0x21')](_0x58a896[_0xe524('0x32')][_0xe524('0x21')]);_0x45abad[_0xe524('0x3a')]=qs['offset'](_0x58a896[_0xe524('0x32')][_0xe524('0x3a')]);}_0x45abad[_0xe524('0x3b')]=qs[_0xe524('0x3c')](_0x58a896[_0xe524('0x32')][_0xe524('0x3c')]);_0x45abad[_0xe524('0x3d')]=qs[_0xe524('0x33')](_['pick'](_0x58a896[_0xe524('0x32')],_0x476572['filters']),_0x359c8b);if(_0x58a896[_0xe524('0x32')][_0xe524('0x3e')]){_0x45abad['where']=_[_0xe524('0x3f')](_0x45abad['where'],{'$or':_[_0xe524('0x31')](_0x359c8b,function(_0x41af26){if(_0x41af26[_0xe524('0x2f')]!==_0xe524('0x40')){var _0x82a87b={};_0x82a87b[_0x41af26[_0xe524('0x2b')]]={'$like':'%'+_0x58a896[_0xe524('0x32')][_0xe524('0x3e')]+'%'};return _0x82a87b;}})});}_0x45abad=_['merge']({},_0x45abad,_0x58a896[_0xe524('0x41')]);var _0x940c05={'where':_0x45abad[_0xe524('0x3d')]};return db[_0xe524('0x42')][_0xe524('0x43')](_0x940c05)[_0xe524('0x27')](function(_0x1d9648){_0x109a96[_0xe524('0x43')]=_0x1d9648;if(_0x58a896['query'][_0xe524('0x44')]){_0x45abad[_0xe524('0x45')]=[{'all':!![]}];}return db[_0xe524('0x42')]['findAll'](_0x45abad);})[_0xe524('0x27')](function(_0x5213ed){_0x109a96[_0xe524('0x46')]=_0x5213ed;return _0x109a96;})[_0xe524('0x27')](respondWithFilteredResult(_0x283f18,_0x45abad))[_0xe524('0x47')](handleError(_0x283f18,null));};exports[_0xe524('0x48')]=function(_0x27a9e5,_0x4746cd){var _0xbeb2a9={'raw':!![],'where':{'id':_0x27a9e5[_0xe524('0x49')]['id']}},_0x52cd0e={};_0x52cd0e[_0xe524('0x34')]=_[_0xe524('0x4a')](db[_0xe524('0x42')][_0xe524('0x2d')]);_0x52cd0e[_0xe524('0x32')]=_['keys'](_0x27a9e5[_0xe524('0x32')]);_0x52cd0e[_0xe524('0x33')]=_[_0xe524('0x4b')](_0x52cd0e['model'],_0x52cd0e[_0xe524('0x32')]);_0xbeb2a9['attributes']=_['intersection'](_0x52cd0e[_0xe524('0x34')],qs[_0xe524('0x36')](_0x27a9e5['query'][_0xe524('0x36')]));_0xbeb2a9[_0xe524('0x35')]=_0xbeb2a9[_0xe524('0x35')][_0xe524('0x37')]?_0xbeb2a9['attributes']:_0x52cd0e['model'];if(_0x27a9e5[_0xe524('0x32')][_0xe524('0x44')]){_0xbeb2a9['include']=[{'all':!![]}];}_0xbeb2a9=_[_0xe524('0x3f')]({},_0xbeb2a9,_0x27a9e5['options']);return db[_0xe524('0x42')][_0xe524('0x4c')](_0xbeb2a9)[_0xe524('0x27')](handleEntityNotFound(_0x4746cd,null))[_0xe524('0x27')](respondWithResult(_0x4746cd,null))[_0xe524('0x47')](handleError(_0x4746cd,null));};exports[_0xe524('0x4d')]=function(_0x305503,_0x22fb42){return db[_0xe524('0x42')][_0xe524('0x4d')](_0x305503[_0xe524('0x4e')],{})[_0xe524('0x27')](respondWithResult(_0x22fb42,0xc9))[_0xe524('0x47')](handleError(_0x22fb42,null));};exports[_0xe524('0x26')]=function(_0x37d44d,_0x4dff40){if(_0x37d44d[_0xe524('0x4e')]['id']){delete _0x37d44d['body']['id'];}return db['SquareReport'][_0xe524('0x4c')]({'where':{'id':_0x37d44d['params']['id']}})[_0xe524('0x27')](handleEntityNotFound(_0x4dff40,null))[_0xe524('0x27')](saveUpdates(_0x37d44d['body'],null))[_0xe524('0x27')](respondWithResult(_0x4dff40,null))['catch'](handleError(_0x4dff40,null));};exports['destroy']=function(_0x2fa574,_0x1e5687){return db[_0xe524('0x42')]['find']({'where':{'id':_0x2fa574['params']['id']}})['then'](handleEntityNotFound(_0x1e5687,null))['then'](removeEntity(_0x1e5687,null))['catch'](handleError(_0x1e5687,null));};exports['describe']=function(_0x45f504,_0x2ce5c0){return db['SquareReport'][_0xe524('0x4f')]()[_0xe524('0x27')](respondWithResult(_0x2ce5c0,null))[_0xe524('0x47')](handleError(_0x2ce5c0,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index e49fc47..2906aeb 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 _0xcec0=['leaveAt','lodash','util','../../config/logger','api','moment','bluebird','exports','define','report_square','uid_pname','uniqueid','project_name'];(function(_0xb2e5e0,_0x41e736){var _0x1cc01e=function(_0x1d3628){while(--_0x1d3628){_0xb2e5e0['push'](_0xb2e5e0['shift']());}};_0x1cc01e(++_0x41e736);}(_0xcec0,0x1bb));var _0x0cec=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xcec0[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x0cec('0x0'));var util=require(_0x0cec('0x1'));var logger=require(_0x0cec('0x2'))(_0x0cec('0x3'));var moment=require(_0x0cec('0x4'));var BPromise=require(_0x0cec('0x5'));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('./squareReport.attributes');module[_0x0cec('0x6')]=function(_0x32e693,_0x126f30){return _0x32e693[_0x0cec('0x7')]('SquareReport',attributes,{'tableName':_0x0cec('0x8'),'paranoid':![],'indexes':[{'name':_0x0cec('0x9'),'fields':[_0x0cec('0xa'),_0x0cec('0xb')]},{'name':_0x0cec('0xc'),'fields':[_0x0cec('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x17e0=['report_square','project_name','leaveAt','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x17e0,0x1e4));var _0x017e=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x17e0[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x017e('0x0'));var util=require('util');var logger=require(_0x017e('0x1'))('api');var moment=require(_0x017e('0x2'));var BPromise=require(_0x017e('0x3'));var rp=require(_0x017e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x017e('0x5'));var config=require(_0x017e('0x6'));var attributes=require(_0x017e('0x7'));module[_0x017e('0x8')]=function(_0x4d0010,_0x3e035a){return _0x4d0010['define'](_0x017e('0x9'),attributes,{'tableName':_0x017e('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0x017e('0xb')]},{'name':_0x017e('0xc'),'fields':[_0x017e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 78ff29d..9ec2759 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 _0x31f0=['attributes','limit','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','raw','then','UpdateSquareReport'];(function(_0x36a36c,_0x2dfc5a){var _0x110321=function(_0x334a22){while(--_0x334a22){_0x36a36c['push'](_0x36a36c['shift']());}};_0x110321(++_0x2dfc5a);}(_0x31f0,0xb7));var _0x031f=function(_0x5de495,_0x2a4df0){_0x5de495=_0x5de495-0x0;var _0xcfe56f=_0x31f0[_0x5de495];return _0xcfe56f;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('SquareReport,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});}exports[_0x031f('0x13')]=function(_0x535e70){var _0x421f75=this;return new Promise(function(_0x5f2199,_0x563bc8){return db[_0x031f('0x14')][_0x031f('0x15')](_0x535e70[_0x031f('0x16')],{'raw':_0x535e70[_0x031f('0x17')]?_0x535e70[_0x031f('0x17')][_0x031f('0x18')]===undefined?!![]:![]:!![]})[_0x031f('0x19')](function(_0x29dd6e){logger['info'](_0x031f('0x13'),_0x535e70);logger[_0x031f('0xc')](_0x031f('0x13'),_0x535e70,JSON['stringify'](_0x29dd6e));_0x5f2199(_0x29dd6e);})['catch'](function(_0xa11a2b){logger['error'](_0x031f('0x13'),_0xa11a2b['message'],_0x535e70);_0x563bc8(_0x421f75['error'](0x1f4,_0xa11a2b['message']));});});};exports[_0x031f('0x1a')]=function(_0x12c406){var _0x2920cd=this;return new Promise(function(_0x4c8126,_0x494568){return db[_0x031f('0x14')]['update'](_0x12c406[_0x031f('0x16')],{'raw':_0x12c406[_0x031f('0x17')]?_0x12c406[_0x031f('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12c406[_0x031f('0x17')]?_0x12c406[_0x031f('0x17')]['where']||null:null,'attributes':_0x12c406[_0x031f('0x17')]?_0x12c406[_0x031f('0x17')][_0x031f('0x1b')]||null:null,'limit':_0x12c406['options']?_0x12c406[_0x031f('0x17')][_0x031f('0x1c')]||null:null})[_0x031f('0x19')](function(_0xaf5bea){logger[_0x031f('0x9')](_0x031f('0x1a'),_0x12c406);logger['debug'](_0x031f('0x1a'),_0x12c406,JSON[_0x031f('0xe')](_0xaf5bea));_0x4c8126(_0xaf5bea);})[_0x031f('0x1d')](function(_0x2ea861){logger[_0x031f('0xf')](_0x031f('0x1a'),_0x2ea861[_0x031f('0x11')],_0x12c406);_0x494568(_0x2920cd[_0x031f('0xf')](0x1f4,_0x2ea861[_0x031f('0x11')]));});});}; \ No newline at end of file +var _0x81bd=['error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4e0873,_0x4660c2){var _0x1229f9=function(_0x13eb80){while(--_0x13eb80){_0x4e0873['push'](_0x4e0873['shift']());}};_0x1229f9(++_0x4660c2);}(_0x81bd,0x7c));var _0xd81b=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0x81bd[_0x2cc569];return _0x1bfc2e;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('SquareReport,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('SquareReport,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});}exports[_0xd81b('0x19')]=function(_0xc49b8d){var _0x6746f0=this;return new Promise(function(_0x3d4d34,_0x1c34c5){return db[_0xd81b('0x1a')][_0xd81b('0x1b')](_0xc49b8d[_0xd81b('0x1c')],{'raw':_0xc49b8d[_0xd81b('0x1d')]?_0xc49b8d[_0xd81b('0x1d')][_0xd81b('0x1e')]===undefined?!![]:![]:!![]})[_0xd81b('0xd')](function(_0x5f101a){logger['info'](_0xd81b('0x19'),_0xc49b8d);logger[_0xd81b('0x11')](_0xd81b('0x19'),_0xc49b8d,JSON['stringify'](_0x5f101a));_0x3d4d34(_0x5f101a);})[_0xd81b('0x18')](function(_0x6571a6){logger['error'](_0xd81b('0x19'),_0x6571a6[_0xd81b('0x16')],_0xc49b8d);_0x1c34c5(_0x6746f0[_0xd81b('0x14')](0x1f4,_0x6571a6[_0xd81b('0x16')]));});});};exports[_0xd81b('0x1f')]=function(_0xcb4f91){var _0x255011=this;return new Promise(function(_0x5ecba9,_0x341aec){return db[_0xd81b('0x1a')][_0xd81b('0x20')](_0xcb4f91[_0xd81b('0x1c')],{'raw':_0xcb4f91['options']?_0xcb4f91[_0xd81b('0x1d')][_0xd81b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb4f91[_0xd81b('0x1d')]?_0xcb4f91[_0xd81b('0x1d')][_0xd81b('0x21')]||null:null,'attributes':_0xcb4f91[_0xd81b('0x1d')]?_0xcb4f91[_0xd81b('0x1d')][_0xd81b('0x22')]||null:null,'limit':_0xcb4f91[_0xd81b('0x1d')]?_0xcb4f91['options'][_0xd81b('0x23')]||null:null})['then'](function(_0x5c8aee){logger[_0xd81b('0xe')](_0xd81b('0x1f'),_0xcb4f91);logger['debug']('UpdateSquareReport',_0xcb4f91,JSON[_0xd81b('0x13')](_0x5c8aee));_0x5ecba9(_0x5c8aee);})[_0xd81b('0x18')](function(_0x1b1434){logger[_0xd81b('0x14')](_0xd81b('0x1f'),_0x1b1434[_0xd81b('0x16')],_0xcb4f91);_0x341aec(_0x255011['error'](0x1f4,_0x1b1434[_0xd81b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index d7e5d90..d8778e9 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(_0x2a84ef,_0x2e57bc){var _0x23143d=function(_0x4df86a){while(--_0x4df86a){_0x2a84ef['push'](_0x2a84ef['shift']());}};_0x23143d(++_0x2e57bc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x12d121,_0x1ef59d){_0x12d121=_0x12d121-0x0;var _0x1af836=_0x5f2f[_0x12d121];return _0x1af836;};'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 _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x48d929,_0x35ed77){var _0x1fcf32=function(_0x541572){while(--_0x541572){_0x48d929['push'](_0x48d929['shift']());}};_0x1fcf32(++_0x35ed77);}(_0x7a54,0x106));var _0x47a5=function(_0x2c215d,_0xfc7475){_0x2c215d=_0x2c215d-0x0;var _0x142317=_0x7a54[_0x2c215d];return _0x142317;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index dc30ece..bd215b9 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 _0x1861=['exports','STRING','sequelize'];(function(_0x209acb,_0x51399f){var _0x45ab6a=function(_0x3a6a99){while(--_0x3a6a99){_0x209acb['push'](_0x209acb['shift']());}};_0x45ab6a(++_0x51399f);}(_0x1861,0xe0));var _0x1186=function(_0x3aed1e,_0x154b6a){_0x3aed1e=_0x3aed1e-0x0;var _0x25a6f0=_0x1861[_0x3aed1e];return _0x25a6f0;};'use strict';var Sequelize=require(_0x1186('0x0'));module[_0x1186('0x1')]={'uniqueid':{'type':Sequelize[_0x1186('0x2')]},'node':{'type':Sequelize[_0x1186('0x2')]},'application':{'type':Sequelize[_0x1186('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x1186('0x2')]},'callerid':{'type':Sequelize[_0x1186('0x2')]}}; \ No newline at end of file +var _0xb9d8=['exports','STRING','sequelize'];(function(_0x54e9cd,_0x16ae73){var _0x343ae7=function(_0x4a9ea4){while(--_0x4a9ea4){_0x54e9cd['push'](_0x54e9cd['shift']());}};_0x343ae7(++_0x16ae73);}(_0xb9d8,0x1e8));var _0x8b9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb9d8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8b9d('0x0'));module[_0x8b9d('0x1')]={'uniqueid':{'type':Sequelize[_0x8b9d('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x8b9d('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x8b9d('0x2')]},'callerid':{'type':Sequelize[_0x8b9d('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index e82075a..a624e14 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 _0x5b92=['fast-json-patch','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','index','map','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','type','SquareDetailsReport','catch','show','params','rawAttributes','includeAll','include','create','update','body','find','describe','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x3812e7,_0x33da43){var _0x4d70d9=function(_0x5d2784){while(--_0x5d2784){_0x3812e7['push'](_0x3812e7['shift']());}};_0x4d70d9(++_0x33da43);}(_0x5b92,0x1a0));var _0x25b9=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x5b92[_0x5783f4];return _0x28e380;};'use strict';var pdf=require(_0x25b9('0x0'));var emlformat=require(_0x25b9('0x1'));var rimraf=require(_0x25b9('0x2'));var zipdir=require(_0x25b9('0x3'));var jsonpatch=require(_0x25b9('0x4'));var rp=require('request-promise');var moment=require(_0x25b9('0x5'));var BPromise=require(_0x25b9('0x6'));var Mustache=require('mustache');var util=require(_0x25b9('0x7'));var path=require(_0x25b9('0x8'));var sox=require('sox');var csv=require(_0x25b9('0x9'));var ejs=require(_0x25b9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x25b9('0xb'));var crypto=require(_0x25b9('0xc'));var jsforce=require(_0x25b9('0xd'));var deskjs=require(_0x25b9('0xe'));var toCsv=require(_0x25b9('0x9'));var querystring=require(_0x25b9('0xf'));var Papa=require('papaparse');var Redis=require(_0x25b9('0x10'));var authService=require(_0x25b9('0x11'));var qs=require(_0x25b9('0x12'));var as=require(_0x25b9('0x13'));var hardwareService=require(_0x25b9('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x25b9('0x15'));var config=require(_0x25b9('0x16'));var licenseUtil=require(_0x25b9('0x17'));var db=require(_0x25b9('0x18'))['db'];function respondWithStatusCode(_0x158b60,_0x294991){_0x294991=_0x294991||0xcc;return function(_0x3e3655){if(_0x3e3655){return _0x158b60['sendStatus'](_0x294991);}return _0x158b60[_0x25b9('0x19')](_0x294991)[_0x25b9('0x1a')]();};}function respondWithResult(_0x4b1083,_0x4871ba){_0x4871ba=_0x4871ba||0xc8;return function(_0x1666e7){if(_0x1666e7){return _0x4b1083['status'](_0x4871ba)['json'](_0x1666e7);}};}function respondWithFilteredResult(_0x3ca9fe,_0x3876b3){return function(_0x45b41b){if(_0x45b41b){var _0x26758d=_0x45b41b[_0x25b9('0x1b')],_0x3f4f4e=_0x3876b3[_0x25b9('0x1c')],_0x246d99=_0x3876b3[_0x25b9('0x1c')]+_0x3876b3[_0x25b9('0x1d')],_0x2ac891;if(_0x246d99>=_0x26758d){_0x246d99=_0x26758d;_0x2ac891=0xc8;}else{_0x2ac891=0xce;}_0x3ca9fe[_0x25b9('0x19')](_0x2ac891);return _0x3ca9fe[_0x25b9('0x1e')](_0x25b9('0x1f'),_0x3f4f4e+'-'+_0x246d99+'/'+_0x26758d)['json'](_0x45b41b);}return null;};}function patchUpdates(_0x4d35c2){return function(_0xc5a9f6){try{jsonpatch[_0x25b9('0x20')](_0xc5a9f6,_0x4d35c2,!![]);}catch(_0x5f098c){return BPromise[_0x25b9('0x21')](_0x5f098c);}return _0xc5a9f6[_0x25b9('0x22')]();};}function saveUpdates(_0x3a2b86,_0x5e3058){return function(_0x57e012){if(_0x57e012){return _0x57e012['update'](_0x3a2b86)['then'](function(_0x47fba3){return _0x47fba3;});}return null;};}function removeEntity(_0x4a7449,_0x349140){return function(_0x37e65f){if(_0x37e65f){return _0x37e65f[_0x25b9('0x23')]()[_0x25b9('0x24')](function(){_0x4a7449[_0x25b9('0x19')](0xcc)[_0x25b9('0x1a')]();});}};}function handleEntityNotFound(_0x46b3d1,_0x136c17){return function(_0x326ea6){if(!_0x326ea6){_0x46b3d1[_0x25b9('0x25')](0x194);}return _0x326ea6;};}function handleError(_0x35a76c,_0x126aca){_0x126aca=_0x126aca||0x1f4;return function(_0x326000){logger[_0x25b9('0x26')](_0x326000[_0x25b9('0x27')]);if(_0x326000[_0x25b9('0x28')]){delete _0x326000[_0x25b9('0x28')];}_0x35a76c[_0x25b9('0x19')](_0x126aca)['send'](_0x326000);};}exports[_0x25b9('0x29')]=function(_0x407eae,_0x787544){var _0xbff519={},_0x3af628={},_0x222470={'count':0x0,'rows':[]};var _0x35b540=_[_0x25b9('0x2a')](db['SquareDetailsReport']['rawAttributes'],function(_0x1ba165){return{'name':_0x1ba165['fieldName'],'type':_0x1ba165['type']['key']};});_0x3af628[_0x25b9('0x2b')]=_[_0x25b9('0x2a')](_0x35b540,_0x25b9('0x28'));_0x3af628[_0x25b9('0x2c')]=_[_0x25b9('0x2d')](_0x407eae['query']);_0x3af628[_0x25b9('0x2e')]=_[_0x25b9('0x2f')](_0x3af628[_0x25b9('0x2b')],_0x3af628[_0x25b9('0x2c')]);_0xbff519[_0x25b9('0x30')]=_[_0x25b9('0x2f')](_0x3af628[_0x25b9('0x2b')],qs[_0x25b9('0x31')](_0x407eae[_0x25b9('0x2c')][_0x25b9('0x31')]));_0xbff519['attributes']=_0xbff519['attributes'][_0x25b9('0x32')]?_0xbff519[_0x25b9('0x30')]:_0x3af628['model'];if(!_0x407eae[_0x25b9('0x2c')][_0x25b9('0x33')](_0x25b9('0x34'))){_0xbff519['limit']=qs['limit'](_0x407eae['query'][_0x25b9('0x1d')]);_0xbff519[_0x25b9('0x1c')]=qs[_0x25b9('0x1c')](_0x407eae[_0x25b9('0x2c')][_0x25b9('0x1c')]);}_0xbff519[_0x25b9('0x35')]=qs['sort'](_0x407eae[_0x25b9('0x2c')]['sort']);_0xbff519[_0x25b9('0x36')]=qs['filters'](_['pick'](_0x407eae[_0x25b9('0x2c')],_0x3af628[_0x25b9('0x2e')]),_0x35b540);if(_0x407eae[_0x25b9('0x2c')][_0x25b9('0x37')]){_0xbff519[_0x25b9('0x36')]=_[_0x25b9('0x38')](_0xbff519[_0x25b9('0x36')],{'$or':_[_0x25b9('0x2a')](_0x35b540,function(_0x182765){if(_0x182765[_0x25b9('0x39')]!=='VIRTUAL'){var _0x2fd300={};_0x2fd300[_0x182765[_0x25b9('0x28')]]={'$like':'%'+_0x407eae[_0x25b9('0x2c')]['filter']+'%'};return _0x2fd300;}})});}_0xbff519=_[_0x25b9('0x38')]({},_0xbff519,_0x407eae['options']);var _0x214c88={'where':_0xbff519[_0x25b9('0x36')]};return db['SquareDetailsReport']['count'](_0x214c88)[_0x25b9('0x24')](function(_0x359153){_0x222470[_0x25b9('0x1b')]=_0x359153;if(_0x407eae[_0x25b9('0x2c')]['includeAll']){_0xbff519['include']=[{'all':!![]}];}return db[_0x25b9('0x3a')]['findAll'](_0xbff519);})[_0x25b9('0x24')](function(_0x3cc3bc){_0x222470['rows']=_0x3cc3bc;return _0x222470;})[_0x25b9('0x24')](respondWithFilteredResult(_0x787544,_0xbff519))[_0x25b9('0x3b')](handleError(_0x787544,null));};exports[_0x25b9('0x3c')]=function(_0x4644d3,_0xc80da4){var _0x1f2fd8={'raw':!![],'where':{'id':_0x4644d3[_0x25b9('0x3d')]['id']}},_0x2dce4f={};_0x2dce4f[_0x25b9('0x2b')]=_[_0x25b9('0x2d')](db['SquareDetailsReport'][_0x25b9('0x3e')]);_0x2dce4f[_0x25b9('0x2c')]=_[_0x25b9('0x2d')](_0x4644d3[_0x25b9('0x2c')]);_0x2dce4f['filters']=_[_0x25b9('0x2f')](_0x2dce4f[_0x25b9('0x2b')],_0x2dce4f[_0x25b9('0x2c')]);_0x1f2fd8[_0x25b9('0x30')]=_[_0x25b9('0x2f')](_0x2dce4f[_0x25b9('0x2b')],qs[_0x25b9('0x31')](_0x4644d3['query'][_0x25b9('0x31')]));_0x1f2fd8[_0x25b9('0x30')]=_0x1f2fd8[_0x25b9('0x30')]['length']?_0x1f2fd8[_0x25b9('0x30')]:_0x2dce4f['model'];if(_0x4644d3[_0x25b9('0x2c')][_0x25b9('0x3f')]){_0x1f2fd8[_0x25b9('0x40')]=[{'all':!![]}];}_0x1f2fd8=_['merge']({},_0x1f2fd8,_0x4644d3['options']);return db[_0x25b9('0x3a')]['find'](_0x1f2fd8)['then'](handleEntityNotFound(_0xc80da4,null))[_0x25b9('0x24')](respondWithResult(_0xc80da4,null))[_0x25b9('0x3b')](handleError(_0xc80da4,null));};exports[_0x25b9('0x41')]=function(_0x11937f,_0x4328dc){return db[_0x25b9('0x3a')][_0x25b9('0x41')](_0x11937f['body'],{})['then'](respondWithResult(_0x4328dc,0xc9))[_0x25b9('0x3b')](handleError(_0x4328dc,null));};exports[_0x25b9('0x42')]=function(_0x36d484,_0x592361){if(_0x36d484[_0x25b9('0x43')]['id']){delete _0x36d484['body']['id'];}return db[_0x25b9('0x3a')][_0x25b9('0x44')]({'where':{'id':_0x36d484[_0x25b9('0x3d')]['id']}})[_0x25b9('0x24')](handleEntityNotFound(_0x592361,null))['then'](saveUpdates(_0x36d484[_0x25b9('0x43')],null))[_0x25b9('0x24')](respondWithResult(_0x592361,null))[_0x25b9('0x3b')](handleError(_0x592361,null));};exports[_0x25b9('0x23')]=function(_0x3af9bb,_0x11b5fe){return db[_0x25b9('0x3a')][_0x25b9('0x44')]({'where':{'id':_0x3af9bb[_0x25b9('0x3d')]['id']}})[_0x25b9('0x24')](handleEntityNotFound(_0x11b5fe,null))['then'](removeEntity(_0x11b5fe,null))['catch'](handleError(_0x11b5fe,null));};exports[_0x25b9('0x45')]=function(_0x183603,_0x1899ba){return db[_0x25b9('0x3a')][_0x25b9('0x45')]()[_0x25b9('0x24')](respondWithResult(_0x1899ba,null))[_0x25b9('0x3b')](handleError(_0x1899ba,null));}; \ No newline at end of file +var _0x29b1=['../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','options','SquareDetailsReport','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5e0d6e,_0x55b185){var _0x282597=function(_0x5305c9){while(--_0x5305c9){_0x5e0d6e['push'](_0x5e0d6e['shift']());}};_0x282597(++_0x55b185);}(_0x29b1,0x16d));var _0x129b=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x29b1[_0x278e3c];return _0x3e2d9b;};'use strict';var pdf=require(_0x129b('0x0'));var emlformat=require(_0x129b('0x1'));var rimraf=require(_0x129b('0x2'));var zipdir=require(_0x129b('0x3'));var jsonpatch=require(_0x129b('0x4'));var rp=require('request-promise');var moment=require(_0x129b('0x5'));var BPromise=require(_0x129b('0x6'));var Mustache=require(_0x129b('0x7'));var util=require(_0x129b('0x8'));var path=require(_0x129b('0x9'));var sox=require(_0x129b('0xa'));var csv=require(_0x129b('0xb'));var ejs=require(_0x129b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x129b('0xd'));var crypto=require('crypto');var jsforce=require(_0x129b('0xe'));var deskjs=require(_0x129b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x129b('0x10'));var Papa=require(_0x129b('0x11'));var Redis=require('ioredis');var authService=require(_0x129b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x129b('0x13'));var hardwareService=require(_0x129b('0x14'));var logger=require(_0x129b('0x15'))('api');var utils=require(_0x129b('0x16'));var config=require(_0x129b('0x17'));var licenseUtil=require(_0x129b('0x18'));var db=require(_0x129b('0x19'))['db'];function respondWithStatusCode(_0x4d5fbd,_0x5767b5){_0x5767b5=_0x5767b5||0xcc;return function(_0x4cc6ee){if(_0x4cc6ee){return _0x4d5fbd[_0x129b('0x1a')](_0x5767b5);}return _0x4d5fbd['status'](_0x5767b5)[_0x129b('0x1b')]();};}function respondWithResult(_0x3e7b83,_0x17255b){_0x17255b=_0x17255b||0xc8;return function(_0x52137c){if(_0x52137c){return _0x3e7b83[_0x129b('0x1c')](_0x17255b)['json'](_0x52137c);}};}function respondWithFilteredResult(_0x160d17,_0xafc5b9){return function(_0x17fff2){if(_0x17fff2){var _0x50d62b=_0x17fff2[_0x129b('0x1d')],_0x46a6a4=_0xafc5b9[_0x129b('0x1e')],_0x453ba2=_0xafc5b9[_0x129b('0x1e')]+_0xafc5b9[_0x129b('0x1f')],_0x1364f8;if(_0x453ba2>=_0x50d62b){_0x453ba2=_0x50d62b;_0x1364f8=0xc8;}else{_0x1364f8=0xce;}_0x160d17[_0x129b('0x1c')](_0x1364f8);return _0x160d17[_0x129b('0x20')](_0x129b('0x21'),_0x46a6a4+'-'+_0x453ba2+'/'+_0x50d62b)[_0x129b('0x22')](_0x17fff2);}return null;};}function patchUpdates(_0xc60027){return function(_0x4ec534){try{jsonpatch[_0x129b('0x23')](_0x4ec534,_0xc60027,!![]);}catch(_0x46bcfa){return BPromise[_0x129b('0x24')](_0x46bcfa);}return _0x4ec534[_0x129b('0x25')]();};}function saveUpdates(_0x2dcaa1,_0x252a69){return function(_0x35bfad){if(_0x35bfad){return _0x35bfad[_0x129b('0x26')](_0x2dcaa1)[_0x129b('0x27')](function(_0x1bb520){return _0x1bb520;});}return null;};}function removeEntity(_0x1cae1a,_0x19b23b){return function(_0x491624){if(_0x491624){return _0x491624[_0x129b('0x28')]()[_0x129b('0x27')](function(){_0x1cae1a[_0x129b('0x1c')](0xcc)[_0x129b('0x1b')]();});}};}function handleEntityNotFound(_0x4d4b76,_0x4fedcd){return function(_0x31bccc){if(!_0x31bccc){_0x4d4b76['sendStatus'](0x194);}return _0x31bccc;};}function handleError(_0x30ffe4,_0x2076a1){_0x2076a1=_0x2076a1||0x1f4;return function(_0x4c733d){logger['error'](_0x4c733d[_0x129b('0x29')]);if(_0x4c733d[_0x129b('0x2a')]){delete _0x4c733d[_0x129b('0x2a')];}_0x30ffe4[_0x129b('0x1c')](_0x2076a1)[_0x129b('0x2b')](_0x4c733d);};}exports[_0x129b('0x2c')]=function(_0x42d623,_0x3fec4b){var _0x4aaa74={},_0x275ff0={},_0x28b8d8={'count':0x0,'rows':[]};var _0x57a47d=_[_0x129b('0x2d')](db['SquareDetailsReport'][_0x129b('0x2e')],function(_0x4d1017){return{'name':_0x4d1017[_0x129b('0x2f')],'type':_0x4d1017[_0x129b('0x30')][_0x129b('0x31')]};});_0x275ff0[_0x129b('0x32')]=_[_0x129b('0x2d')](_0x57a47d,_0x129b('0x2a'));_0x275ff0[_0x129b('0x33')]=_[_0x129b('0x34')](_0x42d623[_0x129b('0x33')]);_0x275ff0['filters']=_[_0x129b('0x35')](_0x275ff0[_0x129b('0x32')],_0x275ff0['query']);_0x4aaa74[_0x129b('0x36')]=_[_0x129b('0x35')](_0x275ff0[_0x129b('0x32')],qs['fields'](_0x42d623[_0x129b('0x33')][_0x129b('0x37')]));_0x4aaa74['attributes']=_0x4aaa74['attributes'][_0x129b('0x38')]?_0x4aaa74['attributes']:_0x275ff0[_0x129b('0x32')];if(!_0x42d623['query'][_0x129b('0x39')](_0x129b('0x3a'))){_0x4aaa74['limit']=qs[_0x129b('0x1f')](_0x42d623[_0x129b('0x33')][_0x129b('0x1f')]);_0x4aaa74['offset']=qs[_0x129b('0x1e')](_0x42d623[_0x129b('0x33')][_0x129b('0x1e')]);}_0x4aaa74[_0x129b('0x3b')]=qs['sort'](_0x42d623['query'][_0x129b('0x3c')]);_0x4aaa74[_0x129b('0x3d')]=qs['filters'](_[_0x129b('0x3e')](_0x42d623[_0x129b('0x33')],_0x275ff0[_0x129b('0x3f')]),_0x57a47d);if(_0x42d623['query']['filter']){_0x4aaa74[_0x129b('0x3d')]=_[_0x129b('0x40')](_0x4aaa74[_0x129b('0x3d')],{'$or':_['map'](_0x57a47d,function(_0x25569f){if(_0x25569f[_0x129b('0x30')]!=='VIRTUAL'){var _0xf2da76={};_0xf2da76[_0x25569f[_0x129b('0x2a')]]={'$like':'%'+_0x42d623['query']['filter']+'%'};return _0xf2da76;}})});}_0x4aaa74=_[_0x129b('0x40')]({},_0x4aaa74,_0x42d623[_0x129b('0x41')]);var _0x2a81e8={'where':_0x4aaa74[_0x129b('0x3d')]};return db[_0x129b('0x42')][_0x129b('0x1d')](_0x2a81e8)[_0x129b('0x27')](function(_0x5700b3){_0x28b8d8['count']=_0x5700b3;if(_0x42d623[_0x129b('0x33')]['includeAll']){_0x4aaa74[_0x129b('0x43')]=[{'all':!![]}];}return db[_0x129b('0x42')][_0x129b('0x44')](_0x4aaa74);})[_0x129b('0x27')](function(_0x4171cb){_0x28b8d8[_0x129b('0x45')]=_0x4171cb;return _0x28b8d8;})['then'](respondWithFilteredResult(_0x3fec4b,_0x4aaa74))['catch'](handleError(_0x3fec4b,null));};exports[_0x129b('0x46')]=function(_0x4ae750,_0x252b55){var _0x1f6d86={'raw':!![],'where':{'id':_0x4ae750[_0x129b('0x47')]['id']}},_0x1c7fbb={};_0x1c7fbb['model']=_['keys'](db['SquareDetailsReport'][_0x129b('0x2e')]);_0x1c7fbb['query']=_[_0x129b('0x34')](_0x4ae750['query']);_0x1c7fbb[_0x129b('0x3f')]=_['intersection'](_0x1c7fbb[_0x129b('0x32')],_0x1c7fbb[_0x129b('0x33')]);_0x1f6d86[_0x129b('0x36')]=_[_0x129b('0x35')](_0x1c7fbb[_0x129b('0x32')],qs[_0x129b('0x37')](_0x4ae750['query']['fields']));_0x1f6d86['attributes']=_0x1f6d86[_0x129b('0x36')][_0x129b('0x38')]?_0x1f6d86[_0x129b('0x36')]:_0x1c7fbb['model'];if(_0x4ae750['query'][_0x129b('0x48')]){_0x1f6d86[_0x129b('0x43')]=[{'all':!![]}];}_0x1f6d86=_[_0x129b('0x40')]({},_0x1f6d86,_0x4ae750[_0x129b('0x41')]);return db[_0x129b('0x42')][_0x129b('0x49')](_0x1f6d86)['then'](handleEntityNotFound(_0x252b55,null))[_0x129b('0x27')](respondWithResult(_0x252b55,null))[_0x129b('0x4a')](handleError(_0x252b55,null));};exports['create']=function(_0x29764b,_0x18e25f){return db[_0x129b('0x42')][_0x129b('0x4b')](_0x29764b[_0x129b('0x4c')],{})[_0x129b('0x27')](respondWithResult(_0x18e25f,0xc9))[_0x129b('0x4a')](handleError(_0x18e25f,null));};exports[_0x129b('0x26')]=function(_0x399e73,_0x336f72){if(_0x399e73[_0x129b('0x4c')]['id']){delete _0x399e73[_0x129b('0x4c')]['id'];}return db[_0x129b('0x42')][_0x129b('0x49')]({'where':{'id':_0x399e73[_0x129b('0x47')]['id']}})[_0x129b('0x27')](handleEntityNotFound(_0x336f72,null))[_0x129b('0x27')](saveUpdates(_0x399e73[_0x129b('0x4c')],null))[_0x129b('0x27')](respondWithResult(_0x336f72,null))[_0x129b('0x4a')](handleError(_0x336f72,null));};exports['destroy']=function(_0xb1e56e,_0x128d59){return db[_0x129b('0x42')][_0x129b('0x49')]({'where':{'id':_0xb1e56e['params']['id']}})['then'](handleEntityNotFound(_0x128d59,null))[_0x129b('0x27')](removeEntity(_0x128d59,null))[_0x129b('0x4a')](handleError(_0x128d59,null));};exports[_0x129b('0x4d')]=function(_0x5a5cb4,_0x484c50){return db[_0x129b('0x42')][_0x129b('0x4d')]()['then'](respondWithResult(_0x484c50,null))[_0x129b('0x4a')](handleError(_0x484c50,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 0438508..07ab426 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 _0x7198=['moment','request-promise','path','rimraf','../../config/environment','define','SquareDetailsReport','util','api'];(function(_0x646625,_0x4b7e5f){var _0x1a067c=function(_0x3323d1){while(--_0x3323d1){_0x646625['push'](_0x646625['shift']());}};_0x1a067c(++_0x4b7e5f);}(_0x7198,0x115));var _0x8719=function(_0x475a4b,_0x15b8a0){_0x475a4b=_0x475a4b-0x0;var _0x82d913=_0x7198[_0x475a4b];return _0x82d913;};'use strict';var _=require('lodash');var util=require(_0x8719('0x0'));var logger=require('../../config/logger')(_0x8719('0x1'));var moment=require(_0x8719('0x2'));var BPromise=require('bluebird');var rp=require(_0x8719('0x3'));var fs=require('fs');var path=require(_0x8719('0x4'));var rimraf=require(_0x8719('0x5'));var config=require(_0x8719('0x6'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0xc76e2a,_0x37b99c){return _0xc76e2a[_0x8719('0x7')](_0x8719('0x8'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index ce1512f..a76cce1 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 _0x5687=['SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','CreateSquareDetailsReport','SquareDetailsReport','options','raw','then','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x5687,0x100));var _0x7568=function(_0x5150b8,_0x204f83){_0x5150b8=_0x5150b8-0x0;var _0x1d8f61=_0x5687[_0x5150b8];return _0x1d8f61;};'use strict';var _=require(_0x7568('0x0'));var util=require('util');var moment=require(_0x7568('0x1'));var BPromise=require(_0x7568('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7568('0x3'));var db=require(_0x7568('0x4'))['db'];var utils=require(_0x7568('0x5'));var logger=require(_0x7568('0x6'))(_0x7568('0x7'));var config=require(_0x7568('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7568('0x9')][_0x7568('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53b699,_0x4e6a18,_0x1afe1f){return new BPromise(function(_0x18e2ef,_0x1c8239){return client[_0x7568('0xb')](_0x53b699,_0x1afe1f)['then'](function(_0x58616a){logger[_0x7568('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x4e6a18,_0x7568('0xd'));logger['debug'](_0x7568('0xe'),_0x4e6a18,_0x7568('0xd'),JSON[_0x7568('0xf')](_0x58616a));if(_0x58616a[_0x7568('0x10')]){if(_0x58616a[_0x7568('0x10')][_0x7568('0x11')]===0x1f4){logger[_0x7568('0x10')](_0x7568('0x12'),_0x4e6a18,_0x58616a[_0x7568('0x10')][_0x7568('0x13')]);return _0x1c8239(_0x58616a[_0x7568('0x10')]['message']);}logger[_0x7568('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x4e6a18,_0x58616a[_0x7568('0x10')][_0x7568('0x13')]);return _0x18e2ef(_0x58616a['error'][_0x7568('0x13')]);}else{logger[_0x7568('0xc')](_0x7568('0x12'),_0x4e6a18,_0x7568('0xd'));_0x18e2ef(_0x58616a[_0x7568('0x14')][_0x7568('0x13')]);}})['catch'](function(_0x4d9bac){logger['error'](_0x7568('0x12'),_0x4e6a18,_0x4d9bac);_0x1c8239(_0x4d9bac);});});}exports[_0x7568('0x15')]=function(_0x59b5ea){var _0x1f5620=this;return new Promise(function(_0x580c22,_0x4c41c6){return db[_0x7568('0x16')]['create'](_0x59b5ea['body'],{'raw':_0x59b5ea['options']?_0x59b5ea[_0x7568('0x17')][_0x7568('0x18')]===undefined?!![]:![]:!![]})[_0x7568('0x19')](function(_0x4d2fb8){logger['info'](_0x7568('0x15'),_0x59b5ea);logger[_0x7568('0x1a')](_0x7568('0x15'),_0x59b5ea,JSON[_0x7568('0xf')](_0x4d2fb8));_0x580c22(_0x4d2fb8);})['catch'](function(_0x45b734){logger[_0x7568('0x10')]('CreateSquareDetailsReport',_0x45b734[_0x7568('0x13')],_0x59b5ea);_0x4c41c6(_0x1f5620['error'](0x1f4,_0x45b734[_0x7568('0x13')]));});});}; \ No newline at end of file +var _0x9e0d=['error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x9e0d,0xc8));var _0xd9e0=function(_0x520021,_0x1aa561){_0x520021=_0x520021-0x0;var _0x28d500=_0x9e0d[_0x520021];return _0x28d500;};'use strict';var _=require(_0xd9e0('0x0'));var util=require('util');var moment=require(_0xd9e0('0x1'));var BPromise=require(_0xd9e0('0x2'));var rs=require(_0xd9e0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9e0('0x4'))['db'];var utils=require(_0xd9e0('0x5'));var logger=require('../../config/logger')(_0xd9e0('0x6'));var config=require(_0xd9e0('0x7'));var jayson=require(_0xd9e0('0x8'));var client=jayson[_0xd9e0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf69a4,_0x5cbe89,_0x1f3cbe){return new BPromise(function(_0x10a880,_0x5a452b){return client[_0xd9e0('0xa')](_0xf69a4,_0x1f3cbe)[_0xd9e0('0xb')](function(_0x3cf655){logger[_0xd9e0('0xc')](_0xd9e0('0xd'),_0x5cbe89,_0xd9e0('0xe'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5cbe89,'request\x20sent',JSON[_0xd9e0('0xf')](_0x3cf655));if(_0x3cf655[_0xd9e0('0x10')]){if(_0x3cf655[_0xd9e0('0x10')][_0xd9e0('0x11')]===0x1f4){logger[_0xd9e0('0x10')](_0xd9e0('0xd'),_0x5cbe89,_0x3cf655[_0xd9e0('0x10')][_0xd9e0('0x12')]);return _0x5a452b(_0x3cf655[_0xd9e0('0x10')][_0xd9e0('0x12')]);}logger[_0xd9e0('0x10')](_0xd9e0('0xd'),_0x5cbe89,_0x3cf655['error']['message']);return _0x10a880(_0x3cf655[_0xd9e0('0x10')][_0xd9e0('0x12')]);}else{logger[_0xd9e0('0xc')](_0xd9e0('0xd'),_0x5cbe89,_0xd9e0('0xe'));_0x10a880(_0x3cf655[_0xd9e0('0x13')]['message']);}})[_0xd9e0('0x14')](function(_0x5d5d2e){logger[_0xd9e0('0x10')](_0xd9e0('0xd'),_0x5cbe89,_0x5d5d2e);_0x5a452b(_0x5d5d2e);});});}exports[_0xd9e0('0x15')]=function(_0x2d48c2){var _0x2caaa2=this;return new Promise(function(_0x306539,_0x11cf0a){return db[_0xd9e0('0x16')]['create'](_0x2d48c2[_0xd9e0('0x17')],{'raw':_0x2d48c2[_0xd9e0('0x18')]?_0x2d48c2[_0xd9e0('0x18')][_0xd9e0('0x19')]===undefined?!![]:![]:!![]})[_0xd9e0('0xb')](function(_0xc8e797){logger['info'](_0xd9e0('0x15'),_0x2d48c2);logger[_0xd9e0('0x1a')](_0xd9e0('0x15'),_0x2d48c2,JSON[_0xd9e0('0xf')](_0xc8e797));_0x306539(_0xc8e797);})[_0xd9e0('0x14')](function(_0x3657b6){logger[_0xd9e0('0x10')](_0xd9e0('0x15'),_0x3657b6[_0xd9e0('0x12')],_0x2d48c2);_0x11cf0a(_0x2caaa2[_0xd9e0('0x10')](0x1f4,_0x3657b6['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 896e045..2c48fb2 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 _0x20fb=['killProcess','exports','express','Router','../../components/auth/service','isAuthenticated','index','get'];(function(_0xf60865,_0x597ad7){var _0x182572=function(_0x585bb4){while(--_0x585bb4){_0xf60865['push'](_0xf60865['shift']());}};_0x182572(++_0x597ad7);}(_0x20fb,0x1b2));var _0xb20f=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x20fb[_0x34bf97];return _0x292719;};'use strict';var express=require(_0xb20f('0x0'));var router=express[_0xb20f('0x1')]();var auth=require(_0xb20f('0x2'));var controller=require('./system.controller');router['get']('/',auth[_0xb20f('0x3')](),controller[_0xb20f('0x4')]);router[_0xb20f('0x5')]('/process/:pid/kill',auth[_0xb20f('0x3')](),controller[_0xb20f('0x6')]);module[_0xb20f('0x7')]=router; \ No newline at end of file +var _0x494d=['./system.controller','isAuthenticated','get','killProcess','exports','express','Router'];(function(_0x545534,_0x4d8979){var _0x1bf920=function(_0x53526b){while(--_0x53526b){_0x545534['push'](_0x545534['shift']());}};_0x1bf920(++_0x4d8979);}(_0x494d,0x7c));var _0xd494=function(_0x33d2a3,_0x2bb035){_0x33d2a3=_0x33d2a3-0x0;var _0x573e52=_0x494d[_0x33d2a3];return _0x573e52;};'use strict';var express=require(_0xd494('0x0'));var router=express[_0xd494('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xd494('0x2'));router['get']('/',auth[_0xd494('0x3')](),controller['index']);router[_0xd494('0x4')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0xd494('0x5')]);module[_0xd494('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index d50371e..cf285fc 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 _0xcd3b=['indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcd3b,0x145));var _0xbcd3=function(_0x537cb5,_0x36fa7d){_0x537cb5=_0x537cb5-0x0;var _0x27759c=_0xcd3b[_0x537cb5];return _0x27759c;};'use strict';var info=require(_0xbcd3('0x0'));var exec=require(_0xbcd3('0x1'))[_0xbcd3('0x2')];var logger=require(_0xbcd3('0x3'))(_0xbcd3('0x4'));var util=require(_0xbcd3('0x5'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x3d6ddb,_0x57b94e,_0x5c808e){_0x57b94e=_0x57b94e||0x1f4;return function(_0x27a93c){logger[_0xbcd3('0x6')](_0xbcd3('0x7'),_0x5c808e,_0x57b94e,util[_0xbcd3('0x8')](_0x27a93c,{'showHidden':![],'depth':null}));delete _0x27a93c[_0xbcd3('0x9')];_0x3d6ddb[_0xbcd3('0xa')](_0x57b94e)[_0xbcd3('0xb')](_0x27a93c);};}exports['index']=function(_0x1a3ff5,_0x1be496){return info[_0xbcd3('0xc')]()[_0xbcd3('0xd')](function(_0x3ff1c2){return _0x1be496['status'](0xc8)[_0xbcd3('0xe')](_0x3ff1c2);})[_0xbcd3('0xf')](function(_0xdf4ef9){return _0x1be496[_0xbcd3('0xa')](0x1f4)[_0xbcd3('0xe')](_0xdf4ef9);});};exports[_0xbcd3('0x10')]=function(_0x1d8f9c,_0x7d52da){var _0xca9bb6=[_0xbcd3('0x11')];return new BPromise(function(_0x30acfb,_0x4bd155){return exec(util[_0xbcd3('0x12')](_0xbcd3('0x13'),_0x1d8f9c[_0xbcd3('0x14')]['pid']),function(_0x3e3a69,_0x4e8e21,_0x1b577b){if(_0x3e3a69){return _0x4bd155(_0x3e3a69);}return _0x30acfb(_0x4e8e21);});})[_0xbcd3('0xd')](function(_0x350b40){var _0x5e4ac8=![];var _0x27dbfc=_0x350b40[_0xbcd3('0x15')](/\n/);for(var _0x2ad7e6=0x0,_0x3387fc=_0xca9bb6[_0xbcd3('0x16')];_0x2ad7e6<_0x3387fc,_0x5e4ac8===![];_0x2ad7e6+=0x1){if(_0x350b40[_0xbcd3('0x17')](_0xca9bb6[_0x2ad7e6])>=0x0){_0x5e4ac8=!![];}}if(!_0x5e4ac8){throw new Error(util[_0xbcd3('0x12')](_0xbcd3('0x18'),_0x1d8f9c[_0xbcd3('0x14')][_0xbcd3('0x19')]));}process[_0xbcd3('0x1a')](_0x1d8f9c[_0xbcd3('0x14')][_0xbcd3('0x19')],_0xbcd3('0x1b'));return _0x7d52da['status'](0xc8)['json']({'message':util[_0xbcd3('0x12')](_0xbcd3('0x1c'),_0x1d8f9c[_0xbcd3('0x14')]['pid'])});})[_0xbcd3('0xf')](handleError(_0x7d52da,null,_0xbcd3('0x10')));}; \ No newline at end of file +var _0xbc2b=['indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','send','index','getAllData','then','status','json','components/import/cm','format','params','pid','split','length'];(function(_0x30ee6e,_0x3551e6){var _0x201fc6=function(_0x3141dd){while(--_0x3141dd){_0x30ee6e['push'](_0x30ee6e['shift']());}};_0x201fc6(++_0x3551e6);}(_0xbc2b,0x11e));var _0xbbc2=function(_0xbffd6c,_0x4bd0f6){_0xbffd6c=_0xbffd6c-0x0;var _0x37eb6c=_0xbc2b[_0xbffd6c];return _0x37eb6c;};'use strict';var info=require(_0xbbc2('0x0'));var exec=require('child_process')[_0xbbc2('0x1')];var logger=require(_0xbbc2('0x2'))(_0xbbc2('0x3'));var util=require(_0xbbc2('0x4'));var BPromise=require(_0xbbc2('0x5'));var _=require(_0xbbc2('0x6'));function handleError(_0x10ad7d,_0xf18d2e,_0x50ca0f){_0xf18d2e=_0xf18d2e||0x1f4;return function(_0x56a959){logger[_0xbbc2('0x7')](_0xbbc2('0x8'),_0x50ca0f,_0xf18d2e,util['inspect'](_0x56a959,{'showHidden':![],'depth':null}));delete _0x56a959[_0xbbc2('0x9')];_0x10ad7d['status'](_0xf18d2e)[_0xbbc2('0xa')](_0x56a959);};}exports[_0xbbc2('0xb')]=function(_0x334127,_0x387ea4){return info[_0xbbc2('0xc')]()[_0xbbc2('0xd')](function(_0x4e8ba4){return _0x387ea4[_0xbbc2('0xe')](0xc8)[_0xbbc2('0xf')](_0x4e8ba4);})['catch'](function(_0x40489d){return _0x387ea4[_0xbbc2('0xe')](0x1f4)[_0xbbc2('0xf')](_0x40489d);});};exports['killProcess']=function(_0x4d12e7,_0x14259c){var _0x36f3e3=[_0xbbc2('0x10')];return new BPromise(function(_0x5f3a2e,_0x43dfe6){return exec(util[_0xbbc2('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x4d12e7[_0xbbc2('0x12')][_0xbbc2('0x13')]),function(_0x3e6e28,_0x4bac42,_0x7a84dd){if(_0x3e6e28){return _0x43dfe6(_0x3e6e28);}return _0x5f3a2e(_0x4bac42);});})[_0xbbc2('0xd')](function(_0x1a7aa0){var _0x38a5f3=![];var _0xe99460=_0x1a7aa0[_0xbbc2('0x14')](/\n/);for(var _0x13e585=0x0,_0x11592f=_0x36f3e3[_0xbbc2('0x15')];_0x13e585<_0x11592f,_0x38a5f3===![];_0x13e585+=0x1){if(_0x1a7aa0[_0xbbc2('0x16')](_0x36f3e3[_0x13e585])>=0x0){_0x38a5f3=!![];}}if(!_0x38a5f3){throw new Error(util[_0xbbc2('0x11')](_0xbbc2('0x17'),_0x4d12e7[_0xbbc2('0x12')]['pid']));}process[_0xbbc2('0x18')](_0x4d12e7[_0xbbc2('0x12')]['pid'],_0xbbc2('0x19'));return _0x14259c[_0xbbc2('0xe')](0xc8)[_0xbbc2('0xf')]({'message':util[_0xbbc2('0x11')](_0xbbc2('0x1a'),_0x4d12e7['params']['pid'])});})['catch'](handleError(_0x14259c,null,_0xbbc2('0x1b')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index d412e6e..807cf70 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 _0x0a9a=['get','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./tag.controller','isAuthenticated','index'];(function(_0x16d415,_0x37760a){var _0x569d4b=function(_0x4ada69){while(--_0x4ada69){_0x16d415['push'](_0x16d415['shift']());}};_0x569d4b(++_0x37760a);}(_0x0a9a,0x183));var _0xa0a9=function(_0xb23b20,_0x33033d){_0xb23b20=_0xb23b20-0x0;var _0x3a4d14=_0x0a9a[_0xb23b20];return _0x3a4d14;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var auth=require(_0xa0a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa0a9('0x5'));var controller=require(_0xa0a9('0x6'));router['get']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0x8')]);router[_0xa0a9('0x9')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0xc')]);router[_0xa0a9('0xd')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);router[_0xa0a9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa0a9('0x10')]);module[_0xa0a9('0x11')]=router; \ No newline at end of file +var _0x750a=['/:id','show','create','delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index'];(function(_0x352d72,_0x32287f){var _0x38495a=function(_0x478f0c){while(--_0x478f0c){_0x352d72['push'](_0x352d72['shift']());}};_0x38495a(++_0x32287f);}(_0x750a,0x140));var _0xa750=function(_0x3e91e0,_0x44516f){_0x3e91e0=_0x3e91e0-0x0;var _0xd9e7b9=_0x750a[_0x3e91e0];return _0xd9e7b9;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var auth=require(_0xa750('0x3'));var interaction=require(_0xa750('0x4'));var config=require(_0xa750('0x5'));var controller=require(_0xa750('0x6'));router[_0xa750('0x7')]('/',auth[_0xa750('0x8')](),controller[_0xa750('0x9')]);router[_0xa750('0x7')](_0xa750('0xa'),auth[_0xa750('0x8')](),controller[_0xa750('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa750('0xc')]);router['put'](_0xa750('0xa'),auth[_0xa750('0x8')](),controller['update']);router[_0xa750('0xd')](_0xa750('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xa750('0xe')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 180dd8e..6dddfd7 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 _0x7916=['sequelize','STRING','name','#0091EA'];(function(_0x2776ad,_0x5e26ed){var _0x378760=function(_0x10bb9f){while(--_0x10bb9f){_0x2776ad['push'](_0x2776ad['shift']());}};_0x378760(++_0x5e26ed);}(_0x7916,0x128));var _0x6791=function(_0x3cc32d,_0x1aacff){_0x3cc32d=_0x3cc32d-0x0;var _0x327c84=_0x7916[_0x3cc32d];return _0x327c84;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x6791('0x3')},'description':{'type':Sequelize[_0x6791('0x1')]}}; \ No newline at end of file +var _0x5eb8=['name','#0091EA','STRING'];(function(_0x32e457,_0x1e03ef){var _0x5c4175=function(_0x8d8462){while(--_0x8d8462){_0x32e457['push'](_0x32e457['shift']());}};_0x5c4175(++_0x1e03ef);}(_0x5eb8,0xb0));var _0x85eb=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0x5eb8[_0x402c8f];return _0x11e809;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x85eb('0x0')],'unique':_0x85eb('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':_0x85eb('0x2')},'description':{'type':Sequelize[_0x85eb('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 786c329..66ca53b 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 _0x3f32=['sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','then','get','destroy','error','stack','name','map','Tag','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','options','includeAll','rows','catch','show','include','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Tags','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path'];(function(_0xddce13,_0x2957df){var _0x3c1580=function(_0x3f8a34){while(--_0x3f8a34){_0xddce13['push'](_0xddce13['shift']());}};_0x3c1580(++_0x2957df);}(_0x3f32,0x1d2));var _0x23f3=function(_0x343b56,_0x27ebbf){_0x343b56=_0x343b56-0x0;var _0x4bdc57=_0x3f32[_0x343b56];return _0x4bdc57;};'use strict';var pdf=require(_0x23f3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x23f3('0x1'));var zipdir=require(_0x23f3('0x2'));var jsonpatch=require(_0x23f3('0x3'));var rp=require(_0x23f3('0x4'));var moment=require(_0x23f3('0x5'));var BPromise=require(_0x23f3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x23f3('0x7'));var sox=require(_0x23f3('0x8'));var csv=require(_0x23f3('0x9'));var ejs=require(_0x23f3('0xa'));var fs=require('fs');var _=require(_0x23f3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x23f3('0xc'));var deskjs=require(_0x23f3('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x23f3('0xe'));var Redis=require(_0x23f3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x23f3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x23f3('0x11'));var logger=require(_0x23f3('0x12'))(_0x23f3('0x13'));var utils=require('../../config/utils');var config=require(_0x23f3('0x14'));var licenseUtil=require(_0x23f3('0x15'));var db=require(_0x23f3('0x16'))['db'];function respondWithStatusCode(_0x18467f,_0x5ebfcd){_0x5ebfcd=_0x5ebfcd||0xcc;return function(_0x351394){if(_0x351394){return _0x18467f[_0x23f3('0x17')](_0x5ebfcd);}return _0x18467f[_0x23f3('0x18')](_0x5ebfcd)[_0x23f3('0x19')]();};}function respondWithResult(_0x44fc94,_0x2ccc55){_0x2ccc55=_0x2ccc55||0xc8;return function(_0x42b8d3){if(_0x42b8d3){return _0x44fc94[_0x23f3('0x18')](_0x2ccc55)[_0x23f3('0x1a')](_0x42b8d3);}};}function respondWithFilteredResult(_0x4f739b,_0x5ea9d8){return function(_0x29e6b1){if(_0x29e6b1){var _0x2fdf79=_0x29e6b1[_0x23f3('0x1b')],_0x3d8ddc=_0x5ea9d8[_0x23f3('0x1c')],_0x110f70=_0x5ea9d8['offset']+_0x5ea9d8['limit'],_0xf2e97a;if(_0x110f70>=_0x2fdf79){_0x110f70=_0x2fdf79;_0xf2e97a=0xc8;}else{_0xf2e97a=0xce;}_0x4f739b[_0x23f3('0x18')](_0xf2e97a);return _0x4f739b[_0x23f3('0x1d')](_0x23f3('0x1e'),_0x3d8ddc+'-'+_0x110f70+'/'+_0x2fdf79)['json'](_0x29e6b1);}return null;};}function patchUpdates(_0x20d0dd){return function(_0x190300){try{jsonpatch[_0x23f3('0x1f')](_0x190300,_0x20d0dd,!![]);}catch(_0x266cd6){return BPromise['reject'](_0x266cd6);}return _0x190300['save']();};}function saveUpdates(_0x502396,_0x2d5cd9){return function(_0x31d365){if(_0x31d365){return _0x31d365[_0x23f3('0x20')](_0x502396)[_0x23f3('0x21')](function(_0x7fdc18){return _0x7fdc18;});}return null;};}function removeEntity(_0x323812,_0x406748){return function(_0x156fa5){if(_0x156fa5){return _0x156fa5['destroy']()[_0x23f3('0x21')](function(){var _0x13f87b=_0x156fa5[_0x23f3('0x22')]({'plain':!![]});var _0x172bd1='Tags';return db['UserProfileResource'][_0x23f3('0x23')]({'where':{'type':_0x172bd1,'resourceId':_0x13f87b['id']}})[_0x23f3('0x21')](function(){return _0x156fa5;});})[_0x23f3('0x21')](function(){_0x323812[_0x23f3('0x18')](0xcc)[_0x23f3('0x19')]();});}};}function handleEntityNotFound(_0x1e8228,_0x2abe64){return function(_0x1b1c88){if(!_0x1b1c88){_0x1e8228[_0x23f3('0x17')](0x194);}return _0x1b1c88;};}function handleError(_0x4bcf9a,_0x5e708c){_0x5e708c=_0x5e708c||0x1f4;return function(_0x3462b2){logger[_0x23f3('0x24')](_0x3462b2[_0x23f3('0x25')]);if(_0x3462b2['name']){delete _0x3462b2[_0x23f3('0x26')];}_0x4bcf9a[_0x23f3('0x18')](_0x5e708c)['send'](_0x3462b2);};}exports['index']=function(_0x4fbb9b,_0x4c26a2){var _0xb5fed2={},_0x25b495={},_0x186de7={'count':0x0,'rows':[]};var _0x5cc307=_[_0x23f3('0x27')](db[_0x23f3('0x28')][_0x23f3('0x29')],function(_0x455a04){return{'name':_0x455a04[_0x23f3('0x2a')],'type':_0x455a04['type'][_0x23f3('0x2b')]};});_0x25b495[_0x23f3('0x2c')]=_[_0x23f3('0x27')](_0x5cc307,_0x23f3('0x26'));_0x25b495[_0x23f3('0x2d')]=_[_0x23f3('0x2e')](_0x4fbb9b[_0x23f3('0x2d')]);_0x25b495[_0x23f3('0x2f')]=_[_0x23f3('0x30')](_0x25b495[_0x23f3('0x2c')],_0x25b495[_0x23f3('0x2d')]);_0xb5fed2[_0x23f3('0x31')]=_[_0x23f3('0x30')](_0x25b495[_0x23f3('0x2c')],qs['fields'](_0x4fbb9b[_0x23f3('0x2d')][_0x23f3('0x32')]));_0xb5fed2[_0x23f3('0x31')]=_0xb5fed2[_0x23f3('0x31')][_0x23f3('0x33')]?_0xb5fed2[_0x23f3('0x31')]:_0x25b495[_0x23f3('0x2c')];if(!_0x4fbb9b[_0x23f3('0x2d')][_0x23f3('0x34')](_0x23f3('0x35'))){_0xb5fed2[_0x23f3('0x36')]=qs[_0x23f3('0x36')](_0x4fbb9b[_0x23f3('0x2d')][_0x23f3('0x36')]);_0xb5fed2['offset']=qs[_0x23f3('0x1c')](_0x4fbb9b[_0x23f3('0x2d')][_0x23f3('0x1c')]);}_0xb5fed2['order']=qs[_0x23f3('0x37')](_0x4fbb9b['query']['sort']);_0xb5fed2[_0x23f3('0x38')]=qs[_0x23f3('0x2f')](_[_0x23f3('0x39')](_0x4fbb9b[_0x23f3('0x2d')],_0x25b495[_0x23f3('0x2f')]),_0x5cc307);if(_0x4fbb9b[_0x23f3('0x2d')][_0x23f3('0x3a')]){_0xb5fed2[_0x23f3('0x38')]=_['merge'](_0xb5fed2[_0x23f3('0x38')],{'$or':_[_0x23f3('0x27')](_0x5cc307,function(_0x27ddf3){if(_0x27ddf3[_0x23f3('0x3b')]!=='VIRTUAL'){var _0x3c65b8={};_0x3c65b8[_0x27ddf3[_0x23f3('0x26')]]={'$like':'%'+_0x4fbb9b['query'][_0x23f3('0x3a')]+'%'};return _0x3c65b8;}})});}_0xb5fed2=_['merge']({},_0xb5fed2,_0x4fbb9b[_0x23f3('0x3c')]);var _0x48b668={'where':_0xb5fed2[_0x23f3('0x38')]};return db[_0x23f3('0x28')][_0x23f3('0x1b')](_0x48b668)[_0x23f3('0x21')](function(_0x4b7f09){_0x186de7['count']=_0x4b7f09;if(_0x4fbb9b[_0x23f3('0x2d')][_0x23f3('0x3d')]){_0xb5fed2['include']=[{'all':!![]}];}return db[_0x23f3('0x28')]['findAll'](_0xb5fed2);})[_0x23f3('0x21')](function(_0x4b1fd1){_0x186de7[_0x23f3('0x3e')]=_0x4b1fd1;return _0x186de7;})[_0x23f3('0x21')](respondWithFilteredResult(_0x4c26a2,_0xb5fed2))[_0x23f3('0x3f')](handleError(_0x4c26a2,null));};exports[_0x23f3('0x40')]=function(_0x41797e,_0x666ccd){var _0x66654c={'raw':!![],'where':{'id':_0x41797e['params']['id']}},_0x379f90={};_0x379f90[_0x23f3('0x2c')]=_['keys'](db[_0x23f3('0x28')][_0x23f3('0x29')]);_0x379f90['query']=_[_0x23f3('0x2e')](_0x41797e[_0x23f3('0x2d')]);_0x379f90[_0x23f3('0x2f')]=_[_0x23f3('0x30')](_0x379f90[_0x23f3('0x2c')],_0x379f90['query']);_0x66654c['attributes']=_['intersection'](_0x379f90[_0x23f3('0x2c')],qs[_0x23f3('0x32')](_0x41797e[_0x23f3('0x2d')][_0x23f3('0x32')]));_0x66654c[_0x23f3('0x31')]=_0x66654c['attributes'][_0x23f3('0x33')]?_0x66654c[_0x23f3('0x31')]:_0x379f90[_0x23f3('0x2c')];if(_0x41797e[_0x23f3('0x2d')][_0x23f3('0x3d')]){_0x66654c[_0x23f3('0x41')]=[{'all':!![]}];}_0x66654c=_[_0x23f3('0x42')]({},_0x66654c,_0x41797e[_0x23f3('0x3c')]);return db[_0x23f3('0x28')][_0x23f3('0x43')](_0x66654c)['then'](handleEntityNotFound(_0x666ccd,null))[_0x23f3('0x21')](respondWithResult(_0x666ccd,null))[_0x23f3('0x3f')](handleError(_0x666ccd,null));};exports[_0x23f3('0x44')]=function(_0x41e727,_0x28349e){return db['Tag'][_0x23f3('0x44')](_0x41e727[_0x23f3('0x45')],{})['then'](function(_0x10c650){var _0xeecab5=_0x41e727['user'][_0x23f3('0x22')]({'plain':!![]});if(!_0xeecab5)throw new Error(_0x23f3('0x46'));if(_0xeecab5[_0x23f3('0x47')]===_0x23f3('0x48')){var _0x3c9d0f=_0x10c650[_0x23f3('0x22')]({'plain':!![]});var _0x36fe1b=_0x23f3('0x49');return db[_0x23f3('0x4a')]['find']({'where':{'name':_0x36fe1b,'userProfileId':_0xeecab5['userProfileId']},'raw':!![]})['then'](function(_0x46bef7){if(_0x46bef7&&_0x46bef7[_0x23f3('0x4b')]===0x0){return db[_0x23f3('0x4c')][_0x23f3('0x44')]({'name':_0x3c9d0f[_0x23f3('0x26')],'resourceId':_0x3c9d0f['id'],'type':_0x46bef7[_0x23f3('0x26')],'sectionId':_0x46bef7['id']},{})[_0x23f3('0x21')](function(){return _0x10c650;});}else{return _0x10c650;}})['catch'](function(_0x2a6a01){logger[_0x23f3('0x24')](_0x23f3('0x4d'),_0x2a6a01);throw _0x2a6a01;});}return _0x10c650;})['then'](respondWithResult(_0x28349e,0xc9))[_0x23f3('0x3f')](handleError(_0x28349e,null));};exports[_0x23f3('0x20')]=function(_0x4a8820,_0x53111f){if(_0x4a8820[_0x23f3('0x45')]['id']){delete _0x4a8820[_0x23f3('0x45')]['id'];}return db['Tag'][_0x23f3('0x43')]({'where':{'id':_0x4a8820[_0x23f3('0x4e')]['id']}})[_0x23f3('0x21')](handleEntityNotFound(_0x53111f,null))[_0x23f3('0x21')](saveUpdates(_0x4a8820[_0x23f3('0x45')],null))['then'](respondWithResult(_0x53111f,null))[_0x23f3('0x3f')](handleError(_0x53111f,null));};exports[_0x23f3('0x23')]=function(_0x1be511,_0x36caa9){return db[_0x23f3('0x28')][_0x23f3('0x43')]({'where':{'id':_0x1be511['params']['id']}})[_0x23f3('0x21')](handleEntityNotFound(_0x36caa9,null))[_0x23f3('0x21')](removeEntity(_0x36caa9,null))[_0x23f3('0x3f')](handleError(_0x36caa9,null));}; \ No newline at end of file +var _0x3893=['sendStatus','end','json','count','offset','limit','status','Content-Range','reject','save','update','then','get','Tags','UserProfileResource','destroy','error','name','index','Tag','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x41671c,_0x2e834a){var _0x332e5e=function(_0x37b7b5){while(--_0x37b7b5){_0x41671c['push'](_0x41671c['shift']());}};_0x332e5e(++_0x2e834a);}(_0x3893,0x1b4));var _0x3389=function(_0x33466d,_0x4d7e8c){_0x33466d=_0x33466d-0x0;var _0x401b25=_0x3893[_0x33466d];return _0x401b25;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3389('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3389('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3389('0x2'));var moment=require(_0x3389('0x3'));var BPromise=require(_0x3389('0x4'));var Mustache=require(_0x3389('0x5'));var util=require('util');var path=require(_0x3389('0x6'));var sox=require(_0x3389('0x7'));var csv=require(_0x3389('0x8'));var ejs=require(_0x3389('0x9'));var fs=require('fs');var _=require(_0x3389('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3389('0xb'));var toCsv=require(_0x3389('0x8'));var querystring=require(_0x3389('0xc'));var Papa=require(_0x3389('0xd'));var Redis=require('ioredis');var authService=require(_0x3389('0xe'));var qs=require(_0x3389('0xf'));var as=require(_0x3389('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3389('0x11'))(_0x3389('0x12'));var utils=require(_0x3389('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f6450,_0x4ddd72){_0x4ddd72=_0x4ddd72||0xcc;return function(_0x5d6670){if(_0x5d6670){return _0x3f6450[_0x3389('0x14')](_0x4ddd72);}return _0x3f6450['status'](_0x4ddd72)[_0x3389('0x15')]();};}function respondWithResult(_0x624fef,_0x201bf9){_0x201bf9=_0x201bf9||0xc8;return function(_0x3cbf5b){if(_0x3cbf5b){return _0x624fef['status'](_0x201bf9)[_0x3389('0x16')](_0x3cbf5b);}};}function respondWithFilteredResult(_0x217d15,_0x224deb){return function(_0x2ad352){if(_0x2ad352){var _0x5a36e4=_0x2ad352[_0x3389('0x17')],_0x22cc00=_0x224deb[_0x3389('0x18')],_0x2be4cd=_0x224deb[_0x3389('0x18')]+_0x224deb[_0x3389('0x19')],_0xf130dc;if(_0x2be4cd>=_0x5a36e4){_0x2be4cd=_0x5a36e4;_0xf130dc=0xc8;}else{_0xf130dc=0xce;}_0x217d15[_0x3389('0x1a')](_0xf130dc);return _0x217d15['set'](_0x3389('0x1b'),_0x22cc00+'-'+_0x2be4cd+'/'+_0x5a36e4)[_0x3389('0x16')](_0x2ad352);}return null;};}function patchUpdates(_0x3be1f5){return function(_0x4fd022){try{jsonpatch['apply'](_0x4fd022,_0x3be1f5,!![]);}catch(_0x1254f2){return BPromise[_0x3389('0x1c')](_0x1254f2);}return _0x4fd022[_0x3389('0x1d')]();};}function saveUpdates(_0x2bd112,_0x37e167){return function(_0xea135f){if(_0xea135f){return _0xea135f[_0x3389('0x1e')](_0x2bd112)['then'](function(_0x532598){return _0x532598;});}return null;};}function removeEntity(_0xb4dbcc,_0x3b1a99){return function(_0x3d9eef){if(_0x3d9eef){return _0x3d9eef['destroy']()[_0x3389('0x1f')](function(){var _0x419d1e=_0x3d9eef[_0x3389('0x20')]({'plain':!![]});var _0x4bd243=_0x3389('0x21');return db[_0x3389('0x22')][_0x3389('0x23')]({'where':{'type':_0x4bd243,'resourceId':_0x419d1e['id']}})['then'](function(){return _0x3d9eef;});})['then'](function(){_0xb4dbcc[_0x3389('0x1a')](0xcc)[_0x3389('0x15')]();});}};}function handleEntityNotFound(_0x22b232,_0x26fef2){return function(_0x12dffe){if(!_0x12dffe){_0x22b232[_0x3389('0x14')](0x194);}return _0x12dffe;};}function handleError(_0x4575f7,_0xee350a){_0xee350a=_0xee350a||0x1f4;return function(_0x5bfb38){logger[_0x3389('0x24')](_0x5bfb38['stack']);if(_0x5bfb38[_0x3389('0x25')]){delete _0x5bfb38[_0x3389('0x25')];}_0x4575f7[_0x3389('0x1a')](_0xee350a)['send'](_0x5bfb38);};}exports[_0x3389('0x26')]=function(_0x1ea7d0,_0x53a346){var _0x346f49={},_0x10ba74={},_0xa1ed48={'count':0x0,'rows':[]};var _0x1cc41c=_['map'](db[_0x3389('0x27')][_0x3389('0x28')],function(_0x23e50e){return{'name':_0x23e50e[_0x3389('0x29')],'type':_0x23e50e[_0x3389('0x2a')][_0x3389('0x2b')]};});_0x10ba74['model']=_[_0x3389('0x2c')](_0x1cc41c,_0x3389('0x25'));_0x10ba74[_0x3389('0x2d')]=_[_0x3389('0x2e')](_0x1ea7d0[_0x3389('0x2d')]);_0x10ba74['filters']=_[_0x3389('0x2f')](_0x10ba74[_0x3389('0x30')],_0x10ba74[_0x3389('0x2d')]);_0x346f49[_0x3389('0x31')]=_[_0x3389('0x2f')](_0x10ba74['model'],qs[_0x3389('0x32')](_0x1ea7d0[_0x3389('0x2d')]['fields']));_0x346f49[_0x3389('0x31')]=_0x346f49['attributes']['length']?_0x346f49[_0x3389('0x31')]:_0x10ba74['model'];if(!_0x1ea7d0['query']['hasOwnProperty'](_0x3389('0x33'))){_0x346f49['limit']=qs['limit'](_0x1ea7d0[_0x3389('0x2d')][_0x3389('0x19')]);_0x346f49['offset']=qs['offset'](_0x1ea7d0[_0x3389('0x2d')][_0x3389('0x18')]);}_0x346f49[_0x3389('0x34')]=qs[_0x3389('0x35')](_0x1ea7d0[_0x3389('0x2d')]['sort']);_0x346f49['where']=qs[_0x3389('0x36')](_[_0x3389('0x37')](_0x1ea7d0['query'],_0x10ba74[_0x3389('0x36')]),_0x1cc41c);if(_0x1ea7d0[_0x3389('0x2d')]['filter']){_0x346f49[_0x3389('0x38')]=_[_0x3389('0x39')](_0x346f49[_0x3389('0x38')],{'$or':_[_0x3389('0x2c')](_0x1cc41c,function(_0x9f6c3d){if(_0x9f6c3d[_0x3389('0x2a')]!==_0x3389('0x3a')){var _0x19ed20={};_0x19ed20[_0x9f6c3d[_0x3389('0x25')]]={'$like':'%'+_0x1ea7d0[_0x3389('0x2d')]['filter']+'%'};return _0x19ed20;}})});}_0x346f49=_[_0x3389('0x39')]({},_0x346f49,_0x1ea7d0[_0x3389('0x3b')]);var _0x394a1b={'where':_0x346f49['where']};return db[_0x3389('0x27')]['count'](_0x394a1b)[_0x3389('0x1f')](function(_0x2eb9d1){_0xa1ed48[_0x3389('0x17')]=_0x2eb9d1;if(_0x1ea7d0[_0x3389('0x2d')][_0x3389('0x3c')]){_0x346f49[_0x3389('0x3d')]=[{'all':!![]}];}return db[_0x3389('0x27')][_0x3389('0x3e')](_0x346f49);})[_0x3389('0x1f')](function(_0x273216){_0xa1ed48[_0x3389('0x3f')]=_0x273216;return _0xa1ed48;})['then'](respondWithFilteredResult(_0x53a346,_0x346f49))[_0x3389('0x40')](handleError(_0x53a346,null));};exports['show']=function(_0x288de4,_0x16012c){var _0x3d42bc={'raw':!![],'where':{'id':_0x288de4[_0x3389('0x41')]['id']}},_0x992c42={};_0x992c42[_0x3389('0x30')]=_[_0x3389('0x2e')](db['Tag']['rawAttributes']);_0x992c42[_0x3389('0x2d')]=_[_0x3389('0x2e')](_0x288de4[_0x3389('0x2d')]);_0x992c42['filters']=_['intersection'](_0x992c42[_0x3389('0x30')],_0x992c42['query']);_0x3d42bc[_0x3389('0x31')]=_[_0x3389('0x2f')](_0x992c42[_0x3389('0x30')],qs[_0x3389('0x32')](_0x288de4[_0x3389('0x2d')][_0x3389('0x32')]));_0x3d42bc[_0x3389('0x31')]=_0x3d42bc[_0x3389('0x31')][_0x3389('0x42')]?_0x3d42bc[_0x3389('0x31')]:_0x992c42['model'];if(_0x288de4[_0x3389('0x2d')][_0x3389('0x3c')]){_0x3d42bc[_0x3389('0x3d')]=[{'all':!![]}];}_0x3d42bc=_[_0x3389('0x39')]({},_0x3d42bc,_0x288de4[_0x3389('0x3b')]);return db[_0x3389('0x27')][_0x3389('0x43')](_0x3d42bc)['then'](handleEntityNotFound(_0x16012c,null))['then'](respondWithResult(_0x16012c,null))[_0x3389('0x40')](handleError(_0x16012c,null));};exports[_0x3389('0x44')]=function(_0x526cb7,_0x1e7f8b){return db['Tag'][_0x3389('0x44')](_0x526cb7[_0x3389('0x45')],{})[_0x3389('0x1f')](function(_0x443b55){var _0x2acb91=_0x526cb7[_0x3389('0x46')][_0x3389('0x20')]({'plain':!![]});if(!_0x2acb91)throw new Error(_0x3389('0x47'));if(_0x2acb91['role']===_0x3389('0x46')){var _0x22b026=_0x443b55[_0x3389('0x20')]({'plain':!![]});var _0x3d73c9=_0x3389('0x21');return db[_0x3389('0x48')][_0x3389('0x43')]({'where':{'name':_0x3d73c9,'userProfileId':_0x2acb91[_0x3389('0x49')]},'raw':!![]})[_0x3389('0x1f')](function(_0x591b6e){if(_0x591b6e&&_0x591b6e[_0x3389('0x4a')]===0x0){return db[_0x3389('0x22')]['create']({'name':_0x22b026[_0x3389('0x25')],'resourceId':_0x22b026['id'],'type':_0x591b6e['name'],'sectionId':_0x591b6e['id']},{})[_0x3389('0x1f')](function(){return _0x443b55;});}else{return _0x443b55;}})[_0x3389('0x40')](function(_0x8857f9){logger['error'](_0x3389('0x4b'),_0x8857f9);throw _0x8857f9;});}return _0x443b55;})[_0x3389('0x1f')](respondWithResult(_0x1e7f8b,0xc9))[_0x3389('0x40')](handleError(_0x1e7f8b,null));};exports[_0x3389('0x1e')]=function(_0x4457a4,_0x38106b){if(_0x4457a4[_0x3389('0x45')]['id']){delete _0x4457a4[_0x3389('0x45')]['id'];}return db[_0x3389('0x27')][_0x3389('0x43')]({'where':{'id':_0x4457a4[_0x3389('0x41')]['id']}})['then'](handleEntityNotFound(_0x38106b,null))[_0x3389('0x1f')](saveUpdates(_0x4457a4[_0x3389('0x45')],null))[_0x3389('0x1f')](respondWithResult(_0x38106b,null))[_0x3389('0x40')](handleError(_0x38106b,null));};exports[_0x3389('0x23')]=function(_0x4c1011,_0x2df4e0){return db['Tag'][_0x3389('0x43')]({'where':{'id':_0x4c1011[_0x3389('0x41')]['id']}})[_0x3389('0x1f')](handleEntityNotFound(_0x2df4e0,null))['then'](removeEntity(_0x2df4e0,null))['catch'](handleError(_0x2df4e0,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 5bb5bdf..3ab3af3 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 _0x39ee=['exports','define','Tag','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./tag.attributes'];(function(_0x55a7db,_0x5c28fc){var _0x5341dd=function(_0x25eb6d){while(--_0x25eb6d){_0x55a7db['push'](_0x55a7db['shift']());}};_0x5341dd(++_0x5c28fc);}(_0x39ee,0x8f));var _0xe39e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x39ee[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe39e('0x0'))(_0xe39e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe39e('0x2'));var fs=require('fs');var path=require(_0xe39e('0x3'));var rimraf=require(_0xe39e('0x4'));var config=require(_0xe39e('0x5'));var attributes=require(_0xe39e('0x6'));module[_0xe39e('0x7')]=function(_0x57292c,_0x254d0c){return _0x57292c[_0xe39e('0x8')](_0xe39e('0x9'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf930=['./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0xcb40a9,_0x25b874){var _0x28c63b=function(_0x1e1217){while(--_0x1e1217){_0xcb40a9['push'](_0xcb40a9['shift']());}};_0x28c63b(++_0x25b874);}(_0xf930,0x17e));var _0x0f93=function(_0x44db1f,_0x28676d){_0x44db1f=_0x44db1f-0x0;var _0x3a364f=_0xf930[_0x44db1f];return _0x3a364f;};'use strict';var _=require(_0x0f93('0x0'));var util=require(_0x0f93('0x1'));var logger=require(_0x0f93('0x2'))(_0x0f93('0x3'));var moment=require(_0x0f93('0x4'));var BPromise=require(_0x0f93('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0f93('0x6'));var config=require(_0x0f93('0x7'));var attributes=require(_0x0f93('0x8'));module[_0x0f93('0x9')]=function(_0x53dd3f,_0x34e415){return _0x53dd3f[_0x0f93('0xa')](_0x0f93('0xb'),attributes,{'tableName':_0x0f93('0xc'),'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 d365a3d..24f3b44 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 _0x1d2d=['lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2433d1,_0x24d249){var _0x15834f=function(_0x3b5a21){while(--_0x3b5a21){_0x2433d1['push'](_0x2433d1['shift']());}};_0x15834f(++_0x24d249);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x310c54,_0x26fbf8){_0x310c54=_0x310c54-0x0;var _0x401b5a=_0x1d2d[_0x310c54];return _0x401b5a;};'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')]('Tag,\x20%s,\x20%s',_0x55be7a,_0x2723b3);_0x35735f(_0x2723b3);});});} \ No newline at end of file +var _0xd3d1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x11b775,_0x55020f){var _0x2229c3=function(_0x5deb31){while(--_0x5deb31){_0x11b775['push'](_0x11b775['shift']());}};_0x2229c3(++_0x55020f);}(_0xd3d1,0x172));var _0x1d3d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd3d1[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d3d('0x2'));var fs=require('fs');var Redis=require(_0x1d3d('0x3'));var db=require(_0x1d3d('0x4'))['db'];var utils=require(_0x1d3d('0x5'));var logger=require(_0x1d3d('0x6'))(_0x1d3d('0x7'));var config=require(_0x1d3d('0x8'));var jayson=require(_0x1d3d('0x9'));var client=jayson[_0x1d3d('0xa')][_0x1d3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3831ce,_0xb1b3c6,_0xe10bca){return new BPromise(function(_0x2c377c,_0xbea61e){return client[_0x1d3d('0xc')](_0x3831ce,_0xe10bca)[_0x1d3d('0xd')](function(_0x510a37){logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));logger[_0x1d3d('0x11')](_0x1d3d('0x12'),_0xb1b3c6,_0x1d3d('0x10'),JSON[_0x1d3d('0x13')](_0x510a37));if(_0x510a37[_0x1d3d('0x14')]){if(_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x15')]===0x1f4){logger[_0x1d3d('0x14')]('Tag,\x20%s,\x20%s',_0xb1b3c6,_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x16')]);return _0xbea61e(_0x510a37['error']['message']);}logger[_0x1d3d('0x14')](_0x1d3d('0xf'),_0xb1b3c6,_0x510a37[_0x1d3d('0x14')]['message']);return _0x2c377c(_0x510a37[_0x1d3d('0x14')]['message']);}else{logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));_0x2c377c(_0x510a37[_0x1d3d('0x17')][_0x1d3d('0x16')]);}})[_0x1d3d('0x18')](function(_0x3dcb67){logger['error']('Tag,\x20%s,\x20%s',_0xb1b3c6,_0x3dcb67);_0xbea61e(_0x3dcb67);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index ca54a3c..5c88230 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 _0xcfd6=['../../components/auth/service','./team.controller','get','isAuthenticated','index','/:id','show','getQueues','/:id/users','getAgents','create','post','/:id/queues','addQueues','addAgents','update','delete','destroy','removeQueues','multer','path','Router'];(function(_0x5c6bc2,_0x4ac8ec){var _0x26435c=function(_0x29a082){while(--_0x29a082){_0x5c6bc2['push'](_0x5c6bc2['shift']());}};_0x26435c(++_0x4ac8ec);}(_0xcfd6,0x97));var _0x6cfd=function(_0x1b07e0,_0x4d0564){_0x1b07e0=_0x1b07e0-0x0;var _0x25751f=_0xcfd6[_0x1b07e0];return _0x25751f;};'use strict';var multer=require(_0x6cfd('0x0'));var util=require('util');var path=require(_0x6cfd('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6cfd('0x2')]();var auth=require(_0x6cfd('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6cfd('0x4'));router[_0x6cfd('0x5')]('/',auth[_0x6cfd('0x6')](),controller[_0x6cfd('0x7')]);router[_0x6cfd('0x5')](_0x6cfd('0x8'),auth[_0x6cfd('0x6')](),controller[_0x6cfd('0x9')]);router['get']('/:id/queues',auth['isAuthenticated'](),controller[_0x6cfd('0xa')]);router['get'](_0x6cfd('0xb'),auth[_0x6cfd('0x6')](),controller[_0x6cfd('0xc')]);router['post']('/',auth[_0x6cfd('0x6')](),controller[_0x6cfd('0xd')]);router[_0x6cfd('0xe')](_0x6cfd('0xf'),auth[_0x6cfd('0x6')](),controller[_0x6cfd('0x10')]);router[_0x6cfd('0xe')]('/:id/users',auth[_0x6cfd('0x6')](),controller[_0x6cfd('0x11')]);router['put'](_0x6cfd('0x8'),auth[_0x6cfd('0x6')](),controller[_0x6cfd('0x12')]);router[_0x6cfd('0x13')](_0x6cfd('0x8'),auth[_0x6cfd('0x6')](),controller[_0x6cfd('0x14')]);router[_0x6cfd('0x13')](_0x6cfd('0xf'),auth[_0x6cfd('0x6')](),controller[_0x6cfd('0x15')]);router[_0x6cfd('0x13')](_0x6cfd('0xb'),auth[_0x6cfd('0x6')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x94ae=['/:id/users','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/queues','getQueues','post','create','addQueues','addAgents','put','update','destroy','delete','removeQueues'];(function(_0x7065a4,_0x5420ae){var _0x40f1ca=function(_0x5299fc){while(--_0x5299fc){_0x7065a4['push'](_0x7065a4['shift']());}};_0x40f1ca(++_0x5420ae);}(_0x94ae,0x17c));var _0xe94a=function(_0x5975ce,_0x1174ab){_0x5975ce=_0x5975ce-0x0;var _0x5b1f80=_0x94ae[_0x5975ce];return _0x5b1f80;};'use strict';var multer=require(_0xe94a('0x0'));var util=require(_0xe94a('0x1'));var path=require(_0xe94a('0x2'));var timeout=require(_0xe94a('0x3'));var express=require(_0xe94a('0x4'));var router=express[_0xe94a('0x5')]();var auth=require(_0xe94a('0x6'));var interaction=require(_0xe94a('0x7'));var config=require(_0xe94a('0x8'));var controller=require('./team.controller');router[_0xe94a('0x9')]('/',auth[_0xe94a('0xa')](),controller[_0xe94a('0xb')]);router[_0xe94a('0x9')](_0xe94a('0xc'),auth[_0xe94a('0xa')](),controller[_0xe94a('0xd')]);router[_0xe94a('0x9')](_0xe94a('0xe'),auth['isAuthenticated'](),controller[_0xe94a('0xf')]);router[_0xe94a('0x9')]('/:id/users',auth[_0xe94a('0xa')](),controller['getAgents']);router[_0xe94a('0x10')]('/',auth['isAuthenticated'](),controller[_0xe94a('0x11')]);router['post'](_0xe94a('0xe'),auth[_0xe94a('0xa')](),controller[_0xe94a('0x12')]);router[_0xe94a('0x10')]('/:id/users',auth[_0xe94a('0xa')](),controller[_0xe94a('0x13')]);router[_0xe94a('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe94a('0x15')]);router['delete']('/:id',auth[_0xe94a('0xa')](),controller[_0xe94a('0x16')]);router[_0xe94a('0x17')]('/:id/queues',auth[_0xe94a('0xa')](),controller[_0xe94a('0x18')]);router[_0xe94a('0x17')](_0xe94a('0x19'),auth['isAuthenticated'](),controller[_0xe94a('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 7ab2fb6..4ccb074 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 _0x2216=['STRING','name','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2216,0x7a));var _0x6221=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x2216[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x6221('0x0'));module[_0x6221('0x1')]={'name':{'type':Sequelize[_0x6221('0x2')],'allowNull':![],'unique':_0x6221('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc918=['name','exports','STRING'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xc918,0xca));var _0x8c91=function(_0x7fbcb7,_0x288dcb){_0x7fbcb7=_0x7fbcb7-0x0;var _0x694916=_0xc918[_0x7fbcb7];return _0x694916;};'use strict';var Sequelize=require('sequelize');module[_0x8c91('0x0')]={'name':{'type':Sequelize[_0x8c91('0x1')],'allowNull':![],'unique':_0x8c91('0x2')},'description':{'type':Sequelize[_0x8c91('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 561b324..5abdeb4 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 _0x3a34=['role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','Queue','order','toLowerCase','Queues','addQueues','add','ids','removeQueues','remove','addAgents','Voice','Fax','Openchannel','Whatsapp','each','User','online','voicePause','interface','upsert','isNil','SIP/%s','omit','spread','emit','removeAgents','sms','fax','whatsapp','voice','UserVoiceQueueRt','isArray','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','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','./team.socket','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','get','Teams','UserProfileResource','then','stack','name','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','options','Team','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x5be1ac,_0x5ee1f4){var _0x21b996=function(_0x377104){while(--_0x377104){_0x5be1ac['push'](_0x5be1ac['shift']());}};_0x21b996(++_0x5ee1f4);}(_0x3a34,0xb3));var _0x43a3=function(_0x2e440b,_0x540f27){_0x2e440b=_0x2e440b-0x0;var _0x46e1a4=_0x3a34[_0x2e440b];return _0x46e1a4;};'use strict';var pdf=require(_0x43a3('0x0'));var emlformat=require(_0x43a3('0x1'));var rimraf=require(_0x43a3('0x2'));var zipdir=require(_0x43a3('0x3'));var jsonpatch=require(_0x43a3('0x4'));var rp=require(_0x43a3('0x5'));var moment=require('moment');var BPromise=require(_0x43a3('0x6'));var Mustache=require(_0x43a3('0x7'));var util=require(_0x43a3('0x8'));var path=require('path');var sox=require(_0x43a3('0x9'));var csv=require('to-csv');var ejs=require(_0x43a3('0xa'));var fs=require('fs');var _=require(_0x43a3('0xb'));var squel=require(_0x43a3('0xc'));var crypto=require(_0x43a3('0xd'));var jsforce=require(_0x43a3('0xe'));var deskjs=require(_0x43a3('0xf'));var toCsv=require(_0x43a3('0x10'));var querystring=require('querystring');var Papa=require(_0x43a3('0x11'));var Redis=require('ioredis');var authService=require(_0x43a3('0x12'));var qs=require(_0x43a3('0x13'));var as=require(_0x43a3('0x14'));var hardwareService=require(_0x43a3('0x15'));var logger=require('../../config/logger')(_0x43a3('0x16'));var utils=require(_0x43a3('0x17'));var config=require(_0x43a3('0x18'));var licenseUtil=require(_0x43a3('0x19'));var db=require(_0x43a3('0x1a'))['db'];config[_0x43a3('0x1b')]=_[_0x43a3('0x1c')](config[_0x43a3('0x1b')],{'host':_0x43a3('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x43a3('0x1e'))['register'](socket);function respondWithStatusCode(_0x2bbbeb,_0x20b93a){_0x20b93a=_0x20b93a||0xcc;return function(_0x429138){if(_0x429138){return _0x2bbbeb[_0x43a3('0x1f')](_0x20b93a);}return _0x2bbbeb['status'](_0x20b93a)[_0x43a3('0x20')]();};}function respondWithResult(_0x11633c,_0x525fb2){_0x525fb2=_0x525fb2||0xc8;return function(_0x3f7346){if(_0x3f7346){return _0x11633c[_0x43a3('0x21')](_0x525fb2)['json'](_0x3f7346);}};}function respondWithFilteredResult(_0x577552,_0x4588b9){return function(_0x1a0e43){if(_0x1a0e43){var _0x5773d3=_0x1a0e43[_0x43a3('0x22')],_0x4a26a4=_0x4588b9[_0x43a3('0x23')],_0x9f22b9=_0x4588b9[_0x43a3('0x23')]+_0x4588b9[_0x43a3('0x24')],_0x4af6e3;if(_0x9f22b9>=_0x5773d3){_0x9f22b9=_0x5773d3;_0x4af6e3=0xc8;}else{_0x4af6e3=0xce;}_0x577552['status'](_0x4af6e3);return _0x577552[_0x43a3('0x25')](_0x43a3('0x26'),_0x4a26a4+'-'+_0x9f22b9+'/'+_0x5773d3)[_0x43a3('0x27')](_0x1a0e43);}return null;};}function patchUpdates(_0x42c6a3){return function(_0x4e758b){try{jsonpatch['apply'](_0x4e758b,_0x42c6a3,!![]);}catch(_0x31b748){return BPromise[_0x43a3('0x28')](_0x31b748);}return _0x4e758b[_0x43a3('0x29')]();};}function saveUpdates(_0x24ff97,_0x3d5d2c){return function(_0x5b42e9){if(_0x5b42e9){return _0x5b42e9[_0x43a3('0x2a')](_0x24ff97)['then'](function(_0x3c5b6b){return _0x3c5b6b;});}return null;};}function removeEntity(_0x4bb7e7,_0x1a016b){return function(_0x21b015){if(_0x21b015){return _0x21b015[_0x43a3('0x2b')]()['then'](function(){var _0x4184df=_0x21b015[_0x43a3('0x2c')]({'plain':!![]});var _0xabcddc=_0x43a3('0x2d');return db[_0x43a3('0x2e')]['destroy']({'where':{'type':_0xabcddc,'resourceId':_0x4184df['id']}})[_0x43a3('0x2f')](function(){return _0x21b015;});})[_0x43a3('0x2f')](function(){_0x4bb7e7[_0x43a3('0x21')](0xcc)[_0x43a3('0x20')]();});}};}function handleEntityNotFound(_0x286be4,_0x14cd43){return function(_0x5c4e31){if(!_0x5c4e31){_0x286be4[_0x43a3('0x1f')](0x194);}return _0x5c4e31;};}function handleError(_0x39b380,_0x3ab218){_0x3ab218=_0x3ab218||0x1f4;return function(_0x1384dc){logger['error'](_0x1384dc[_0x43a3('0x30')]);if(_0x1384dc[_0x43a3('0x31')]){delete _0x1384dc['name'];}_0x39b380[_0x43a3('0x21')](_0x3ab218)['send'](_0x1384dc);};}exports['index']=function(_0x1fe3b6,_0x67e299){var _0x3bca53={},_0xb1a9f0={},_0x4d4036={'count':0x0,'rows':[]};var _0x30d6d6=_['map'](db['Team']['rawAttributes'],function(_0x16373a){return{'name':_0x16373a['fieldName'],'type':_0x16373a[_0x43a3('0x32')][_0x43a3('0x33')]};});_0xb1a9f0[_0x43a3('0x34')]=_['map'](_0x30d6d6,'name');_0xb1a9f0[_0x43a3('0x35')]=_[_0x43a3('0x36')](_0x1fe3b6['query']);_0xb1a9f0[_0x43a3('0x37')]=_['intersection'](_0xb1a9f0[_0x43a3('0x34')],_0xb1a9f0[_0x43a3('0x35')]);_0x3bca53[_0x43a3('0x38')]=_['intersection'](_0xb1a9f0[_0x43a3('0x34')],qs[_0x43a3('0x39')](_0x1fe3b6[_0x43a3('0x35')][_0x43a3('0x39')]));_0x3bca53[_0x43a3('0x38')]=_0x3bca53['attributes'][_0x43a3('0x3a')]?_0x3bca53[_0x43a3('0x38')]:_0xb1a9f0[_0x43a3('0x34')];if(!_0x1fe3b6[_0x43a3('0x35')][_0x43a3('0x3b')](_0x43a3('0x3c'))){_0x3bca53['limit']=qs[_0x43a3('0x24')](_0x1fe3b6['query'][_0x43a3('0x24')]);_0x3bca53[_0x43a3('0x23')]=qs[_0x43a3('0x23')](_0x1fe3b6[_0x43a3('0x35')][_0x43a3('0x23')]);}_0x3bca53['order']=qs[_0x43a3('0x3d')](_0x1fe3b6[_0x43a3('0x35')][_0x43a3('0x3d')]);_0x3bca53['where']=qs[_0x43a3('0x37')](_[_0x43a3('0x3e')](_0x1fe3b6[_0x43a3('0x35')],_0xb1a9f0[_0x43a3('0x37')]),_0x30d6d6);if(_0x1fe3b6[_0x43a3('0x35')][_0x43a3('0x3f')]){_0x3bca53[_0x43a3('0x40')]=_[_0x43a3('0x41')](_0x3bca53[_0x43a3('0x40')],{'$or':_[_0x43a3('0x42')](_0x30d6d6,function(_0x2ada71){if(_0x2ada71[_0x43a3('0x32')]!==_0x43a3('0x43')){var _0x348aa5={};_0x348aa5[_0x2ada71['name']]={'$like':'%'+_0x1fe3b6['query'][_0x43a3('0x3f')]+'%'};return _0x348aa5;}})});}_0x3bca53=_[_0x43a3('0x41')]({},_0x3bca53,_0x1fe3b6[_0x43a3('0x44')]);var _0x2c595e={'where':_0x3bca53[_0x43a3('0x40')]};return db[_0x43a3('0x45')]['count'](_0x2c595e)['then'](function(_0x157d22){_0x4d4036[_0x43a3('0x22')]=_0x157d22;if(_0x1fe3b6[_0x43a3('0x35')][_0x43a3('0x46')]){_0x3bca53[_0x43a3('0x47')]=[{'all':!![]}];}return db[_0x43a3('0x45')][_0x43a3('0x48')](_0x3bca53);})[_0x43a3('0x2f')](function(_0x4ae273){_0x4d4036[_0x43a3('0x49')]=_0x4ae273;return _0x4d4036;})[_0x43a3('0x2f')](respondWithFilteredResult(_0x67e299,_0x3bca53))[_0x43a3('0x4a')](handleError(_0x67e299,null));};exports[_0x43a3('0x4b')]=function(_0x5e3716,_0x403e71){var _0x46d122={'raw':![],'where':{'id':_0x5e3716[_0x43a3('0x4c')]['id']}},_0x5cb571={};_0x5cb571[_0x43a3('0x34')]=_[_0x43a3('0x36')](db[_0x43a3('0x45')][_0x43a3('0x4d')]);_0x5cb571[_0x43a3('0x35')]=_['keys'](_0x5e3716[_0x43a3('0x35')]);_0x5cb571[_0x43a3('0x37')]=_[_0x43a3('0x4e')](_0x5cb571[_0x43a3('0x34')],_0x5cb571[_0x43a3('0x35')]);_0x46d122[_0x43a3('0x38')]=_[_0x43a3('0x4e')](_0x5cb571['model'],qs['fields'](_0x5e3716['query']['fields']));_0x46d122[_0x43a3('0x38')]=_0x46d122[_0x43a3('0x38')][_0x43a3('0x3a')]?_0x46d122[_0x43a3('0x38')]:_0x5cb571[_0x43a3('0x34')];if(_0x5e3716[_0x43a3('0x35')][_0x43a3('0x46')]){_0x46d122['include']=[{'all':!![]}];}_0x46d122=_[_0x43a3('0x41')]({},_0x46d122,_0x5e3716[_0x43a3('0x44')]);return db['Team'][_0x43a3('0x4f')](_0x46d122)[_0x43a3('0x2f')](handleEntityNotFound(_0x403e71,null))[_0x43a3('0x2f')](respondWithResult(_0x403e71,null))[_0x43a3('0x4a')](handleError(_0x403e71,null));};exports[_0x43a3('0x50')]=function(_0xd36bc1,_0xef0314){return db[_0x43a3('0x45')]['create'](_0xd36bc1['body'],{})[_0x43a3('0x2f')](function(_0x32d467){var _0x59ec44=_0xd36bc1[_0x43a3('0x51')][_0x43a3('0x2c')]({'plain':!![]});if(!_0x59ec44)throw new Error(_0x43a3('0x52'));if(_0x59ec44[_0x43a3('0x53')]===_0x43a3('0x51')){var _0x156736=_0x32d467[_0x43a3('0x2c')]({'plain':!![]});var _0x1bcd71=_0x43a3('0x2d');return db[_0x43a3('0x54')][_0x43a3('0x4f')]({'where':{'name':_0x1bcd71,'userProfileId':_0x59ec44[_0x43a3('0x55')]},'raw':!![]})['then'](function(_0x523e84){if(_0x523e84&&_0x523e84['autoAssociation']===0x0){return db[_0x43a3('0x2e')][_0x43a3('0x50')]({'name':_0x156736[_0x43a3('0x31')],'resourceId':_0x156736['id'],'type':_0x523e84[_0x43a3('0x31')],'sectionId':_0x523e84['id']},{})[_0x43a3('0x2f')](function(){return _0x32d467;});}else{return _0x32d467;}})[_0x43a3('0x4a')](function(_0x226f32){logger[_0x43a3('0x56')](_0x43a3('0x57'),_0x226f32);throw _0x226f32;});}return _0x32d467;})[_0x43a3('0x2f')](respondWithResult(_0xef0314,0xc9))[_0x43a3('0x4a')](handleError(_0xef0314,null));};exports[_0x43a3('0x2a')]=function(_0x59fd22,_0x5aa68f){if(_0x59fd22['body']['id']){delete _0x59fd22[_0x43a3('0x58')]['id'];}return db[_0x43a3('0x45')][_0x43a3('0x4f')]({'where':{'id':_0x59fd22[_0x43a3('0x4c')]['id']}})[_0x43a3('0x2f')](handleEntityNotFound(_0x5aa68f,null))['then'](saveUpdates(_0x59fd22[_0x43a3('0x58')],null))[_0x43a3('0x2f')](respondWithResult(_0x5aa68f,null))[_0x43a3('0x4a')](handleError(_0x5aa68f,null));};exports[_0x43a3('0x2b')]=function(_0x5b8f9e,_0x22f4e6){return db[_0x43a3('0x45')][_0x43a3('0x4f')]({'where':{'id':_0x5b8f9e[_0x43a3('0x4c')]['id']}})[_0x43a3('0x2f')](handleEntityNotFound(_0x22f4e6,null))[_0x43a3('0x2f')](removeEntity(_0x22f4e6,null))[_0x43a3('0x4a')](handleError(_0x22f4e6,null));};exports[_0x43a3('0x59')]=function(_0x241550,_0x96522c,_0x363da0){return db[_0x43a3('0x45')][_0x43a3('0x5a')]({'where':{'id':_0x241550['params']['id']}})[_0x43a3('0x2f')](handleEntityNotFound(_0x96522c,null))[_0x43a3('0x2f')](function(_0x2d780e){if(!_0x241550[_0x43a3('0x35')][_0x43a3('0x5b')]||!utils[_0x43a3('0x5c')](_0x241550[_0x43a3('0x35')][_0x43a3('0x5b')])){throw new db[(_0x43a3('0x5d'))][(_0x43a3('0x5e'))](_0x43a3('0x5f'));}var _0x5631f6={};var _0x1168ed={};_0x1168ed['model']=_[_0x43a3('0x36')](db[_[_0x43a3('0x60')](_0x241550['query']['channel']['toLowerCase']())+_0x43a3('0x61')][_0x43a3('0x4d')]);_0x1168ed[_0x43a3('0x35')]=_['keys'](_0x241550[_0x43a3('0x35')]);_0x1168ed[_0x43a3('0x37')]=_[_0x43a3('0x4e')](_0x1168ed[_0x43a3('0x34')],_0x1168ed[_0x43a3('0x35')]);_0x5631f6[_0x43a3('0x38')]=_[_0x43a3('0x4e')](_0x1168ed[_0x43a3('0x34')],qs['fields'](_0x241550[_0x43a3('0x35')][_0x43a3('0x39')]));_0x5631f6[_0x43a3('0x38')]=_0x5631f6[_0x43a3('0x38')]['length']?_0x5631f6[_0x43a3('0x38')]:_0x1168ed[_0x43a3('0x34')];_0x5631f6[_0x43a3('0x24')]=qs[_0x43a3('0x24')](_0x241550[_0x43a3('0x35')][_0x43a3('0x24')]);_0x5631f6['offset']=qs['offset'](_0x241550[_0x43a3('0x35')][_0x43a3('0x23')]);_0x5631f6[_0x43a3('0x62')]=qs['sort'](_0x241550[_0x43a3('0x35')][_0x43a3('0x3d')]);_0x5631f6[_0x43a3('0x40')]=qs['filters'](_[_0x43a3('0x3e')](_0x241550[_0x43a3('0x35')],_0x1168ed[_0x43a3('0x37')]));_0x5631f6=_['merge']({},_0x5631f6,_0x241550['options']);return _0x2d780e[_0x43a3('0x2c')+_['capitalize'](_0x241550[_0x43a3('0x35')]['channel'][_0x43a3('0x63')]())+_0x43a3('0x64')](_0x5631f6);})[_0x43a3('0x2f')](respondWithResult(_0x96522c,null))[_0x43a3('0x4a')](handleError(_0x96522c,null));};exports[_0x43a3('0x65')]=function(_0x3e5cff,_0x747206,_0x124597){return db[_0x43a3('0x45')]['findOne']({'where':{'id':_0x3e5cff[_0x43a3('0x4c')]['id']}})[_0x43a3('0x2f')](function(_0x208c86){if(_0x208c86){if(!_0x3e5cff[_0x43a3('0x58')]['channel']||!utils[_0x43a3('0x5c')](_0x3e5cff['body']['channel'])){throw new db[(_0x43a3('0x5d'))]['ValidationError'](_0x43a3('0x5f'));}return _0x208c86[_0x43a3('0x66')+_[_0x43a3('0x60')](_0x3e5cff[_0x43a3('0x58')][_0x43a3('0x5b')][_0x43a3('0x63')]())+_0x43a3('0x64')](_0x3e5cff[_0x43a3('0x58')][_0x43a3('0x67')]);}return null;})['then'](handleEntityNotFound(_0x747206,null))[_0x43a3('0x2f')](respondWithStatusCode(_0x747206,null))[_0x43a3('0x4a')](handleError(_0x747206,null));};exports[_0x43a3('0x68')]=function(_0x2edf60,_0x2b8be0,_0x20bdf6){return db[_0x43a3('0x45')]['findOne']({'where':{'id':_0x2edf60[_0x43a3('0x4c')]['id']}})[_0x43a3('0x2f')](function(_0xa2c299){if(_0xa2c299){if(!_0x2edf60[_0x43a3('0x35')]['channel']||!utils['isValidChannel'](_0x2edf60[_0x43a3('0x35')]['channel'])){throw new db['Sequelize'][(_0x43a3('0x5e'))]('Unknown\x20channel');}return _0xa2c299[_0x43a3('0x69')+_['capitalize'](_0x2edf60['query'][_0x43a3('0x5b')][_0x43a3('0x63')]())+'Queues'](_0x2edf60[_0x43a3('0x35')][_0x43a3('0x67')]);}return null;})[_0x43a3('0x2f')](handleEntityNotFound(_0x2b8be0,null))[_0x43a3('0x2f')](respondWithStatusCode(_0x2b8be0,null))['catch'](handleError(_0x2b8be0,null));};exports[_0x43a3('0x6a')]=function(_0x294ec2,_0x8576e8,_0x5961b7){return db[_0x43a3('0x45')][_0x43a3('0x4f')]({'where':{'id':_0x294ec2[_0x43a3('0x4c')]['id']}})[_0x43a3('0x2f')](handleEntityNotFound(_0x8576e8,null))['then'](function(_0x459809){if(_0x459809){var _0x591ea5=[_0x43a3('0x6b'),'Chat','Mail','Sms',_0x43a3('0x6c'),_0x43a3('0x6d'),_0x43a3('0x6e')];return BPromise[_0x43a3('0x6f')](_0x591ea5,function(_0xfe3353){return _0x459809[_0x43a3('0x2c')+_0xfe3353+'Queues']({'attributes':['id',_0x43a3('0x31')]})[_0x43a3('0x2f')](function(_0x15340a){return BPromise[_0x43a3('0x6f')](_0x15340a,function(_0x12f8c0){return _0x12f8c0[_0x43a3('0x6a')](_0x294ec2['body'][_0x43a3('0x67')])[_0x43a3('0x2f')](function(){if(_0xfe3353===_0x43a3('0x6b')){return db[_0x43a3('0x70')][_0x43a3('0x48')]({'where':{'id':_0x294ec2[_0x43a3('0x58')]['ids']},'attributes':['id','name',_0x43a3('0x71'),_0x43a3('0x72'),_0x43a3('0x73')],'raw':!![]})[_0x43a3('0x2f')](function(_0x7f0668){return BPromise[_0x43a3('0x6f')](_['filter'](_0x7f0668,{'online':0x1}),function(_0x295b76){return db['UserVoiceQueueRt'][_0x43a3('0x74')]({'membername':_0x295b76['name'],'UserId':_0x295b76['id'],'queue_name':_0x12f8c0[_0x43a3('0x31')],'VoiceQueueId':_0x12f8c0['id'],'interface':_[_0x43a3('0x75')](_0x295b76['interface'])?util['format'](_0x43a3('0x76'),_0x295b76['name']):_0x295b76['interface'],'paused':_0x295b76[_0x43a3('0x72')]||![],'penalty':0x0});});});}});});})[_0x43a3('0x2f')](function(){return _0x459809;});})[_0x43a3('0x2f')](function(){return _0x459809;});}})['then'](function(_0xf472f1){if(_0xf472f1){return _0xf472f1['addAgents'](_0x294ec2[_0x43a3('0x58')][_0x43a3('0x67')],_[_0x43a3('0x77')](_0x294ec2[_0x43a3('0x58')],[_0x43a3('0x67'),'id'])||{})[_0x43a3('0x78')](function(_0x10d07d){for(var _0x3ca3bb=0x0;_0x3ca3bb<_0x294ec2['body'][_0x43a3('0x67')][_0x43a3('0x3a')];_0x3ca3bb+=0x1){socket[_0x43a3('0x79')]('userTeam:save',{'UserId':_0x294ec2[_0x43a3('0x58')]['ids'][_0x3ca3bb],'TeamId':_0x294ec2['params']['id']});}return _0x10d07d;});}})[_0x43a3('0x2f')](respondWithResult(_0x8576e8,null))[_0x43a3('0x4a')](handleError(_0x8576e8,null));};exports[_0x43a3('0x7a')]=function(_0x5952d8,_0x48c96d,_0x38e2a9){return db[_0x43a3('0x45')]['find']({'where':{'id':_0x5952d8[_0x43a3('0x4c')]['id']}})[_0x43a3('0x2f')](handleEntityNotFound(_0x48c96d,null))['then'](function(_0x56a7d8){if(_0x56a7d8){return BPromise[_0x43a3('0x6f')](['voice','chat','mail',_0x43a3('0x7b'),_0x43a3('0x7c'),'openchannel',_0x43a3('0x7d')],function(_0x14a02e){return _0x56a7d8['get'+_[_0x43a3('0x60')](_0x14a02e)+_0x43a3('0x64')]({'attributes':['id',_0x43a3('0x31')]})['then'](function(_0x4a8a24){return BPromise[_0x43a3('0x6f')](_0x4a8a24,function(_0x3c375c){return _0x3c375c[_0x43a3('0x7a')](_0x5952d8[_0x43a3('0x35')][_0x43a3('0x67')])['then'](function(){if(_0x14a02e===_0x43a3('0x7e')){return db[_0x43a3('0x7f')][_0x43a3('0x2b')]({'where':{'VoiceQueueId':_0x3c375c['id'],'UserId':_0x5952d8[_0x43a3('0x35')][_0x43a3('0x67')]}});}});});})['then'](function(){return _0x56a7d8;});})['then'](function(){return _0x56a7d8;});}})[_0x43a3('0x2f')](function(_0x2cc09a){if(_0x2cc09a){return _0x2cc09a['removeAgents'](_0x5952d8['query'][_0x43a3('0x67')])[_0x43a3('0x2f')](function(){if(_[_0x43a3('0x80')](_0x5952d8[_0x43a3('0x35')]['ids'])){for(var _0x1d97f5=0x0;_0x1d97f5<_0x5952d8['query'][_0x43a3('0x67')][_0x43a3('0x3a')];_0x1d97f5+=0x1){socket[_0x43a3('0x79')](_0x43a3('0x81'),{'UserId':Number(_0x5952d8[_0x43a3('0x35')][_0x43a3('0x67')][_0x1d97f5]),'TeamId':Number(_0x5952d8['params']['id'])});}}else{socket['emit'](_0x43a3('0x81'),{'UserId':Number(_0x5952d8[_0x43a3('0x35')][_0x43a3('0x67')]),'TeamId':Number(_0x5952d8[_0x43a3('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x48c96d,null))['catch'](handleError(_0x48c96d,null));};exports['getAgents']=function(_0x229528,_0x4cebfd,_0x3ba298){var _0x2b81de={};var _0x1cbbbb={};var _0x171f38;var _0x2dd54f;return db[_0x43a3('0x45')][_0x43a3('0x5a')]({'where':{'id':_0x229528[_0x43a3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4cebfd,null))[_0x43a3('0x2f')](function(_0x52b540){if(_0x52b540){_0x171f38=_0x52b540;_0x1cbbbb[_0x43a3('0x34')]=_[_0x43a3('0x36')](db['User'][_0x43a3('0x4d')]);_0x1cbbbb['query']=_['keys'](_0x229528[_0x43a3('0x35')]);_0x1cbbbb[_0x43a3('0x37')]=_[_0x43a3('0x4e')](_0x1cbbbb['model'],_0x1cbbbb[_0x43a3('0x35')]);_0x2b81de[_0x43a3('0x38')]=_[_0x43a3('0x4e')](_0x1cbbbb[_0x43a3('0x34')],qs[_0x43a3('0x39')](_0x229528['query'][_0x43a3('0x39')]));_0x2b81de['attributes']=_0x2b81de[_0x43a3('0x38')]['length']?_0x2b81de[_0x43a3('0x38')]:_0x1cbbbb[_0x43a3('0x34')];_0x2b81de[_0x43a3('0x62')]=qs[_0x43a3('0x3d')](_0x229528[_0x43a3('0x35')]['sort']);_0x2b81de[_0x43a3('0x40')]=qs[_0x43a3('0x37')](_[_0x43a3('0x3e')](_0x229528[_0x43a3('0x35')],_0x1cbbbb['filters']));if(_0x229528[_0x43a3('0x35')]['filter']){_0x2b81de[_0x43a3('0x40')]=_['merge'](_0x2b81de[_0x43a3('0x40')],{'$or':_['map'](_0x2b81de[_0x43a3('0x38')],function(_0x906258){var _0x2fe586={};_0x2fe586[_0x906258]={'$like':'%'+_0x229528[_0x43a3('0x35')]['filter']+'%'};return _0x2fe586;})});}_0x2b81de=_[_0x43a3('0x41')]({},_0x2b81de,_0x229528[_0x43a3('0x44')]);return _0x171f38[_0x43a3('0x82')](_0x2b81de);}})[_0x43a3('0x2f')](function(_0x482d04){if(_0x482d04){_0x2dd54f=_0x482d04[_0x43a3('0x3a')];if(!_0x229528[_0x43a3('0x35')]['hasOwnProperty'](_0x43a3('0x3c'))){_0x2b81de[_0x43a3('0x24')]=qs[_0x43a3('0x24')](_0x229528[_0x43a3('0x35')][_0x43a3('0x24')]);_0x2b81de[_0x43a3('0x23')]=qs['offset'](_0x229528[_0x43a3('0x35')][_0x43a3('0x23')]);}return _0x171f38[_0x43a3('0x82')](_0x2b81de);}})[_0x43a3('0x2f')](function(_0x12db7b){if(_0x12db7b){return _0x12db7b?{'count':_0x2dd54f,'rows':_0x12db7b}:null;}})[_0x43a3('0x2f')](respondWithResult(_0x4cebfd,null))[_0x43a3('0x4a')](handleError(_0x4cebfd,null));}; \ No newline at end of file +var _0x625d=['../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','Teams','UserProfileResource','sendStatus','error','stack','name','send','index','map','key','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','Team','includeAll','include','findAll','rows','show','params','keys','rawAttributes','filters','length','find','catch','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','getQueues','findOne','channel','ValidationError','Unknown\x20channel','toLowerCase','Queue','addQueues','Sequelize','capitalize','Queues','ids','removeQueues','isValidChannel','remove','Voice','Chat','Mail','Sms','Fax','Whatsapp','each','addAgents','User','online','voicePause','interface','upsert','isNil','SIP/%s','omit','emit','voice','chat','sms','fax','openchannel','whatsapp','removeAgents','isArray','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x399e2b,_0x59450b){var _0x82906d=function(_0x1f031c){while(--_0x1f031c){_0x399e2b['push'](_0x399e2b['shift']());}};_0x82906d(++_0x59450b);}(_0x625d,0x6f));var _0xd625=function(_0x5155fd,_0xaa956f){_0x5155fd=_0x5155fd-0x0;var _0x1bf312=_0x625d[_0x5155fd];return _0x1bf312;};'use strict';var pdf=require(_0xd625('0x0'));var emlformat=require(_0xd625('0x1'));var rimraf=require(_0xd625('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd625('0x3'));var rp=require(_0xd625('0x4'));var moment=require(_0xd625('0x5'));var BPromise=require(_0xd625('0x6'));var Mustache=require(_0xd625('0x7'));var util=require(_0xd625('0x8'));var path=require(_0xd625('0x9'));var sox=require(_0xd625('0xa'));var csv=require(_0xd625('0xb'));var ejs=require(_0xd625('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd625('0xd'));var crypto=require(_0xd625('0xe'));var jsforce=require(_0xd625('0xf'));var deskjs=require(_0xd625('0x10'));var toCsv=require(_0xd625('0xb'));var querystring=require(_0xd625('0x11'));var Papa=require(_0xd625('0x12'));var Redis=require(_0xd625('0x13'));var authService=require(_0xd625('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd625('0x15'));var hardwareService=require(_0xd625('0x16'));var logger=require(_0xd625('0x17'))(_0xd625('0x18'));var utils=require(_0xd625('0x19'));var config=require(_0xd625('0x1a'));var licenseUtil=require(_0xd625('0x1b'));var db=require(_0xd625('0x1c'))['db'];config[_0xd625('0x1d')]=_['defaults'](config[_0xd625('0x1d')],{'host':_0xd625('0x1e'),'port':0x18eb});var socket=require(_0xd625('0x1f'))(new Redis(config[_0xd625('0x1d')]));require(_0xd625('0x20'))[_0xd625('0x21')](socket);function respondWithStatusCode(_0x1e6a5c,_0xcf5e90){_0xcf5e90=_0xcf5e90||0xcc;return function(_0x2c0f77){if(_0x2c0f77){return _0x1e6a5c['sendStatus'](_0xcf5e90);}return _0x1e6a5c[_0xd625('0x22')](_0xcf5e90)[_0xd625('0x23')]();};}function respondWithResult(_0x444a48,_0x32b05a){_0x32b05a=_0x32b05a||0xc8;return function(_0x2e0a53){if(_0x2e0a53){return _0x444a48[_0xd625('0x22')](_0x32b05a)[_0xd625('0x24')](_0x2e0a53);}};}function respondWithFilteredResult(_0x3d7f0d,_0x32c02d){return function(_0x57c382){if(_0x57c382){var _0x3fc71=_0x57c382[_0xd625('0x25')],_0x493c39=_0x32c02d[_0xd625('0x26')],_0x1d89e4=_0x32c02d[_0xd625('0x26')]+_0x32c02d[_0xd625('0x27')],_0x119aef;if(_0x1d89e4>=_0x3fc71){_0x1d89e4=_0x3fc71;_0x119aef=0xc8;}else{_0x119aef=0xce;}_0x3d7f0d[_0xd625('0x22')](_0x119aef);return _0x3d7f0d[_0xd625('0x28')](_0xd625('0x29'),_0x493c39+'-'+_0x1d89e4+'/'+_0x3fc71)[_0xd625('0x24')](_0x57c382);}return null;};}function patchUpdates(_0x2aedfa){return function(_0x12ef87){try{jsonpatch[_0xd625('0x2a')](_0x12ef87,_0x2aedfa,!![]);}catch(_0x519237){return BPromise[_0xd625('0x2b')](_0x519237);}return _0x12ef87[_0xd625('0x2c')]();};}function saveUpdates(_0x463657,_0x5acfc6){return function(_0x4048e3){if(_0x4048e3){return _0x4048e3['update'](_0x463657)[_0xd625('0x2d')](function(_0xfda335){return _0xfda335;});}return null;};}function removeEntity(_0x12ae44,_0x2790a3){return function(_0x427ee2){if(_0x427ee2){return _0x427ee2[_0xd625('0x2e')]()[_0xd625('0x2d')](function(){var _0x11bb22=_0x427ee2['get']({'plain':!![]});var _0x5e27ec=_0xd625('0x2f');return db[_0xd625('0x30')][_0xd625('0x2e')]({'where':{'type':_0x5e27ec,'resourceId':_0x11bb22['id']}})['then'](function(){return _0x427ee2;});})[_0xd625('0x2d')](function(){_0x12ae44[_0xd625('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cc9bd,_0x70dc3e){return function(_0x278036){if(!_0x278036){_0x3cc9bd[_0xd625('0x31')](0x194);}return _0x278036;};}function handleError(_0x1a4dc1,_0x505141){_0x505141=_0x505141||0x1f4;return function(_0x56d175){logger[_0xd625('0x32')](_0x56d175[_0xd625('0x33')]);if(_0x56d175[_0xd625('0x34')]){delete _0x56d175['name'];}_0x1a4dc1['status'](_0x505141)[_0xd625('0x35')](_0x56d175);};}exports[_0xd625('0x36')]=function(_0x267de6,_0x3d80ba){var _0x3835e5={},_0x16a18a={},_0x2442fb={'count':0x0,'rows':[]};var _0x5d3ca5=_[_0xd625('0x37')](db['Team']['rawAttributes'],function(_0x3f9030){return{'name':_0x3f9030['fieldName'],'type':_0x3f9030['type'][_0xd625('0x38')]};});_0x16a18a['model']=_[_0xd625('0x37')](_0x5d3ca5,_0xd625('0x34'));_0x16a18a[_0xd625('0x39')]=_['keys'](_0x267de6['query']);_0x16a18a['filters']=_['intersection'](_0x16a18a[_0xd625('0x3a')],_0x16a18a[_0xd625('0x39')]);_0x3835e5[_0xd625('0x3b')]=_[_0xd625('0x3c')](_0x16a18a['model'],qs[_0xd625('0x3d')](_0x267de6[_0xd625('0x39')][_0xd625('0x3d')]));_0x3835e5[_0xd625('0x3b')]=_0x3835e5['attributes']['length']?_0x3835e5[_0xd625('0x3b')]:_0x16a18a[_0xd625('0x3a')];if(!_0x267de6['query'][_0xd625('0x3e')](_0xd625('0x3f'))){_0x3835e5[_0xd625('0x27')]=qs[_0xd625('0x27')](_0x267de6['query']['limit']);_0x3835e5[_0xd625('0x26')]=qs['offset'](_0x267de6[_0xd625('0x39')][_0xd625('0x26')]);}_0x3835e5[_0xd625('0x40')]=qs[_0xd625('0x41')](_0x267de6[_0xd625('0x39')][_0xd625('0x41')]);_0x3835e5[_0xd625('0x42')]=qs['filters'](_[_0xd625('0x43')](_0x267de6[_0xd625('0x39')],_0x16a18a['filters']),_0x5d3ca5);if(_0x267de6[_0xd625('0x39')]['filter']){_0x3835e5[_0xd625('0x42')]=_['merge'](_0x3835e5[_0xd625('0x42')],{'$or':_[_0xd625('0x37')](_0x5d3ca5,function(_0x50a925){if(_0x50a925[_0xd625('0x44')]!==_0xd625('0x45')){var _0x47b030={};_0x47b030[_0x50a925[_0xd625('0x34')]]={'$like':'%'+_0x267de6[_0xd625('0x39')][_0xd625('0x46')]+'%'};return _0x47b030;}})});}_0x3835e5=_[_0xd625('0x47')]({},_0x3835e5,_0x267de6[_0xd625('0x48')]);var _0x4b846b={'where':_0x3835e5[_0xd625('0x42')]};return db[_0xd625('0x49')]['count'](_0x4b846b)['then'](function(_0x3c0fd3){_0x2442fb[_0xd625('0x25')]=_0x3c0fd3;if(_0x267de6[_0xd625('0x39')][_0xd625('0x4a')]){_0x3835e5[_0xd625('0x4b')]=[{'all':!![]}];}return db[_0xd625('0x49')][_0xd625('0x4c')](_0x3835e5);})['then'](function(_0x338280){_0x2442fb[_0xd625('0x4d')]=_0x338280;return _0x2442fb;})[_0xd625('0x2d')](respondWithFilteredResult(_0x3d80ba,_0x3835e5))['catch'](handleError(_0x3d80ba,null));};exports[_0xd625('0x4e')]=function(_0x3b8e89,_0x1a6806){var _0x5bcb17={'raw':![],'where':{'id':_0x3b8e89[_0xd625('0x4f')]['id']}},_0x336f08={};_0x336f08['model']=_[_0xd625('0x50')](db['Team'][_0xd625('0x51')]);_0x336f08[_0xd625('0x39')]=_[_0xd625('0x50')](_0x3b8e89[_0xd625('0x39')]);_0x336f08[_0xd625('0x52')]=_[_0xd625('0x3c')](_0x336f08['model'],_0x336f08['query']);_0x5bcb17[_0xd625('0x3b')]=_[_0xd625('0x3c')](_0x336f08[_0xd625('0x3a')],qs['fields'](_0x3b8e89[_0xd625('0x39')]['fields']));_0x5bcb17['attributes']=_0x5bcb17[_0xd625('0x3b')][_0xd625('0x53')]?_0x5bcb17[_0xd625('0x3b')]:_0x336f08[_0xd625('0x3a')];if(_0x3b8e89[_0xd625('0x39')][_0xd625('0x4a')]){_0x5bcb17[_0xd625('0x4b')]=[{'all':!![]}];}_0x5bcb17=_[_0xd625('0x47')]({},_0x5bcb17,_0x3b8e89[_0xd625('0x48')]);return db[_0xd625('0x49')][_0xd625('0x54')](_0x5bcb17)[_0xd625('0x2d')](handleEntityNotFound(_0x1a6806,null))[_0xd625('0x2d')](respondWithResult(_0x1a6806,null))[_0xd625('0x55')](handleError(_0x1a6806,null));};exports['create']=function(_0x144b9a,_0x3fdab6){return db[_0xd625('0x49')]['create'](_0x144b9a['body'],{})[_0xd625('0x2d')](function(_0xd268d4){var _0x4a1335=_0x144b9a[_0xd625('0x56')][_0xd625('0x57')]({'plain':!![]});if(!_0x4a1335)throw new Error(_0xd625('0x58'));if(_0x4a1335[_0xd625('0x59')]==='user'){var _0x58fbf4=_0xd268d4[_0xd625('0x57')]({'plain':!![]});var _0x3e20be=_0xd625('0x2f');return db[_0xd625('0x5a')][_0xd625('0x54')]({'where':{'name':_0x3e20be,'userProfileId':_0x4a1335['userProfileId']},'raw':!![]})[_0xd625('0x2d')](function(_0x4418ab){if(_0x4418ab&&_0x4418ab['autoAssociation']===0x0){return db['UserProfileResource'][_0xd625('0x5b')]({'name':_0x58fbf4[_0xd625('0x34')],'resourceId':_0x58fbf4['id'],'type':_0x4418ab[_0xd625('0x34')],'sectionId':_0x4418ab['id']},{})[_0xd625('0x2d')](function(){return _0xd268d4;});}else{return _0xd268d4;}})['catch'](function(_0x5aa4d2){logger[_0xd625('0x32')](_0xd625('0x5c'),_0x5aa4d2);throw _0x5aa4d2;});}return _0xd268d4;})[_0xd625('0x2d')](respondWithResult(_0x3fdab6,0xc9))[_0xd625('0x55')](handleError(_0x3fdab6,null));};exports[_0xd625('0x5d')]=function(_0x595d1e,_0x3766cb){if(_0x595d1e[_0xd625('0x5e')]['id']){delete _0x595d1e['body']['id'];}return db[_0xd625('0x49')][_0xd625('0x54')]({'where':{'id':_0x595d1e[_0xd625('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3766cb,null))[_0xd625('0x2d')](saveUpdates(_0x595d1e[_0xd625('0x5e')],null))[_0xd625('0x2d')](respondWithResult(_0x3766cb,null))[_0xd625('0x55')](handleError(_0x3766cb,null));};exports[_0xd625('0x2e')]=function(_0x5d8280,_0x2e3649){return db['Team'][_0xd625('0x54')]({'where':{'id':_0x5d8280[_0xd625('0x4f')]['id']}})[_0xd625('0x2d')](handleEntityNotFound(_0x2e3649,null))[_0xd625('0x2d')](removeEntity(_0x2e3649,null))[_0xd625('0x55')](handleError(_0x2e3649,null));};exports[_0xd625('0x5f')]=function(_0x295bf3,_0x53c286,_0x84a907){return db['Team'][_0xd625('0x60')]({'where':{'id':_0x295bf3[_0xd625('0x4f')]['id']}})[_0xd625('0x2d')](handleEntityNotFound(_0x53c286,null))[_0xd625('0x2d')](function(_0x38bf9e){if(!_0x295bf3[_0xd625('0x39')]['channel']||!utils['isValidChannel'](_0x295bf3['query'][_0xd625('0x61')])){throw new db['Sequelize'][(_0xd625('0x62'))](_0xd625('0x63'));}var _0x99c49d={};var _0x2f9380={};_0x2f9380[_0xd625('0x3a')]=_['keys'](db[_['capitalize'](_0x295bf3['query']['channel'][_0xd625('0x64')]())+_0xd625('0x65')]['rawAttributes']);_0x2f9380[_0xd625('0x39')]=_[_0xd625('0x50')](_0x295bf3[_0xd625('0x39')]);_0x2f9380[_0xd625('0x52')]=_[_0xd625('0x3c')](_0x2f9380['model'],_0x2f9380[_0xd625('0x39')]);_0x99c49d[_0xd625('0x3b')]=_[_0xd625('0x3c')](_0x2f9380[_0xd625('0x3a')],qs[_0xd625('0x3d')](_0x295bf3[_0xd625('0x39')][_0xd625('0x3d')]));_0x99c49d['attributes']=_0x99c49d[_0xd625('0x3b')][_0xd625('0x53')]?_0x99c49d[_0xd625('0x3b')]:_0x2f9380[_0xd625('0x3a')];_0x99c49d[_0xd625('0x27')]=qs[_0xd625('0x27')](_0x295bf3['query']['limit']);_0x99c49d[_0xd625('0x26')]=qs[_0xd625('0x26')](_0x295bf3[_0xd625('0x39')][_0xd625('0x26')]);_0x99c49d[_0xd625('0x40')]=qs[_0xd625('0x41')](_0x295bf3[_0xd625('0x39')]['sort']);_0x99c49d['where']=qs[_0xd625('0x52')](_['pick'](_0x295bf3['query'],_0x2f9380['filters']));_0x99c49d=_[_0xd625('0x47')]({},_0x99c49d,_0x295bf3[_0xd625('0x48')]);return _0x38bf9e[_0xd625('0x57')+_['capitalize'](_0x295bf3[_0xd625('0x39')][_0xd625('0x61')][_0xd625('0x64')]())+'Queues'](_0x99c49d);})[_0xd625('0x2d')](respondWithResult(_0x53c286,null))[_0xd625('0x55')](handleError(_0x53c286,null));};exports[_0xd625('0x66')]=function(_0x8a13bc,_0x43b09c,_0xc877b8){return db[_0xd625('0x49')][_0xd625('0x60')]({'where':{'id':_0x8a13bc[_0xd625('0x4f')]['id']}})[_0xd625('0x2d')](function(_0x1fd84a){if(_0x1fd84a){if(!_0x8a13bc['body']['channel']||!utils['isValidChannel'](_0x8a13bc[_0xd625('0x5e')]['channel'])){throw new db[(_0xd625('0x67'))][(_0xd625('0x62'))](_0xd625('0x63'));}return _0x1fd84a['add'+_[_0xd625('0x68')](_0x8a13bc[_0xd625('0x5e')][_0xd625('0x61')][_0xd625('0x64')]())+_0xd625('0x69')](_0x8a13bc[_0xd625('0x5e')][_0xd625('0x6a')]);}return null;})[_0xd625('0x2d')](handleEntityNotFound(_0x43b09c,null))['then'](respondWithStatusCode(_0x43b09c,null))[_0xd625('0x55')](handleError(_0x43b09c,null));};exports[_0xd625('0x6b')]=function(_0x28f815,_0x5fcabc,_0x4169b0){return db[_0xd625('0x49')]['findOne']({'where':{'id':_0x28f815['params']['id']}})[_0xd625('0x2d')](function(_0x3719a1){if(_0x3719a1){if(!_0x28f815[_0xd625('0x39')][_0xd625('0x61')]||!utils[_0xd625('0x6c')](_0x28f815['query'][_0xd625('0x61')])){throw new db['Sequelize'][(_0xd625('0x62'))]('Unknown\x20channel');}return _0x3719a1[_0xd625('0x6d')+_[_0xd625('0x68')](_0x28f815['query'][_0xd625('0x61')][_0xd625('0x64')]())+_0xd625('0x69')](_0x28f815[_0xd625('0x39')][_0xd625('0x6a')]);}return null;})[_0xd625('0x2d')](handleEntityNotFound(_0x5fcabc,null))[_0xd625('0x2d')](respondWithStatusCode(_0x5fcabc,null))[_0xd625('0x55')](handleError(_0x5fcabc,null));};exports['addAgents']=function(_0xdf5aa9,_0x25a1fb,_0xa2fa6c){return db[_0xd625('0x49')]['find']({'where':{'id':_0xdf5aa9[_0xd625('0x4f')]['id']}})[_0xd625('0x2d')](handleEntityNotFound(_0x25a1fb,null))[_0xd625('0x2d')](function(_0x3962dc){if(_0x3962dc){var _0x4fa263=[_0xd625('0x6e'),_0xd625('0x6f'),_0xd625('0x70'),_0xd625('0x71'),_0xd625('0x72'),'Openchannel',_0xd625('0x73')];return BPromise['each'](_0x4fa263,function(_0x14aeaa){return _0x3962dc[_0xd625('0x57')+_0x14aeaa+_0xd625('0x69')]({'attributes':['id',_0xd625('0x34')]})[_0xd625('0x2d')](function(_0x515b7b){return BPromise[_0xd625('0x74')](_0x515b7b,function(_0x51ceb5){return _0x51ceb5[_0xd625('0x75')](_0xdf5aa9[_0xd625('0x5e')][_0xd625('0x6a')])[_0xd625('0x2d')](function(){if(_0x14aeaa===_0xd625('0x6e')){return db[_0xd625('0x76')][_0xd625('0x4c')]({'where':{'id':_0xdf5aa9[_0xd625('0x5e')][_0xd625('0x6a')]},'attributes':['id','name',_0xd625('0x77'),_0xd625('0x78'),_0xd625('0x79')],'raw':!![]})['then'](function(_0x5dd9de){return BPromise[_0xd625('0x74')](_[_0xd625('0x46')](_0x5dd9de,{'online':0x1}),function(_0x590dd9){return db['UserVoiceQueueRt'][_0xd625('0x7a')]({'membername':_0x590dd9[_0xd625('0x34')],'UserId':_0x590dd9['id'],'queue_name':_0x51ceb5[_0xd625('0x34')],'VoiceQueueId':_0x51ceb5['id'],'interface':_[_0xd625('0x7b')](_0x590dd9[_0xd625('0x79')])?util['format'](_0xd625('0x7c'),_0x590dd9[_0xd625('0x34')]):_0x590dd9[_0xd625('0x79')],'paused':_0x590dd9[_0xd625('0x78')]||![],'penalty':0x0});});});}});});})[_0xd625('0x2d')](function(){return _0x3962dc;});})[_0xd625('0x2d')](function(){return _0x3962dc;});}})[_0xd625('0x2d')](function(_0x53261b){if(_0x53261b){return _0x53261b['addAgents'](_0xdf5aa9['body']['ids'],_[_0xd625('0x7d')](_0xdf5aa9[_0xd625('0x5e')],[_0xd625('0x6a'),'id'])||{})['spread'](function(_0x7e6d69){for(var _0x48ac5c=0x0;_0x48ac5c<_0xdf5aa9[_0xd625('0x5e')][_0xd625('0x6a')][_0xd625('0x53')];_0x48ac5c+=0x1){socket[_0xd625('0x7e')]('userTeam:save',{'UserId':_0xdf5aa9[_0xd625('0x5e')][_0xd625('0x6a')][_0x48ac5c],'TeamId':_0xdf5aa9[_0xd625('0x4f')]['id']});}return _0x7e6d69;});}})[_0xd625('0x2d')](respondWithResult(_0x25a1fb,null))[_0xd625('0x55')](handleError(_0x25a1fb,null));};exports['removeAgents']=function(_0x105668,_0x26eb45,_0x4e37db){return db[_0xd625('0x49')][_0xd625('0x54')]({'where':{'id':_0x105668[_0xd625('0x4f')]['id']}})[_0xd625('0x2d')](handleEntityNotFound(_0x26eb45,null))['then'](function(_0x449361){if(_0x449361){return BPromise[_0xd625('0x74')]([_0xd625('0x7f'),_0xd625('0x80'),'mail',_0xd625('0x81'),_0xd625('0x82'),_0xd625('0x83'),_0xd625('0x84')],function(_0x43f812){return _0x449361[_0xd625('0x57')+_[_0xd625('0x68')](_0x43f812)+'Queues']({'attributes':['id',_0xd625('0x34')]})[_0xd625('0x2d')](function(_0xf52ea4){return BPromise[_0xd625('0x74')](_0xf52ea4,function(_0xd05e91){return _0xd05e91[_0xd625('0x85')](_0x105668['query'][_0xd625('0x6a')])['then'](function(){if(_0x43f812===_0xd625('0x7f')){return db['UserVoiceQueueRt'][_0xd625('0x2e')]({'where':{'VoiceQueueId':_0xd05e91['id'],'UserId':_0x105668[_0xd625('0x39')][_0xd625('0x6a')]}});}});});})[_0xd625('0x2d')](function(){return _0x449361;});})['then'](function(){return _0x449361;});}})[_0xd625('0x2d')](function(_0x77d459){if(_0x77d459){return _0x77d459[_0xd625('0x85')](_0x105668[_0xd625('0x39')]['ids'])[_0xd625('0x2d')](function(){if(_[_0xd625('0x86')](_0x105668[_0xd625('0x39')][_0xd625('0x6a')])){for(var _0x51f91a=0x0;_0x51f91a<_0x105668['query']['ids']['length'];_0x51f91a+=0x1){socket[_0xd625('0x7e')](_0xd625('0x87'),{'UserId':Number(_0x105668[_0xd625('0x39')][_0xd625('0x6a')][_0x51f91a]),'TeamId':Number(_0x105668[_0xd625('0x4f')]['id'])});}}else{socket['emit']('userTeam:remove',{'UserId':Number(_0x105668[_0xd625('0x39')][_0xd625('0x6a')]),'TeamId':Number(_0x105668[_0xd625('0x4f')]['id'])});}});}})[_0xd625('0x2d')](respondWithStatusCode(_0x26eb45,null))[_0xd625('0x55')](handleError(_0x26eb45,null));};exports[_0xd625('0x88')]=function(_0x54ff3e,_0x37a9c5,_0x2d7df6){var _0x3af6dd={};var _0x55c334={};var _0x4921ce;var _0x17b691;return db[_0xd625('0x49')][_0xd625('0x60')]({'where':{'id':_0x54ff3e[_0xd625('0x4f')]['id']}})['then'](handleEntityNotFound(_0x37a9c5,null))[_0xd625('0x2d')](function(_0x165746){if(_0x165746){_0x4921ce=_0x165746;_0x55c334[_0xd625('0x3a')]=_[_0xd625('0x50')](db[_0xd625('0x76')][_0xd625('0x51')]);_0x55c334['query']=_[_0xd625('0x50')](_0x54ff3e[_0xd625('0x39')]);_0x55c334[_0xd625('0x52')]=_[_0xd625('0x3c')](_0x55c334['model'],_0x55c334['query']);_0x3af6dd[_0xd625('0x3b')]=_[_0xd625('0x3c')](_0x55c334[_0xd625('0x3a')],qs[_0xd625('0x3d')](_0x54ff3e[_0xd625('0x39')][_0xd625('0x3d')]));_0x3af6dd[_0xd625('0x3b')]=_0x3af6dd[_0xd625('0x3b')][_0xd625('0x53')]?_0x3af6dd[_0xd625('0x3b')]:_0x55c334[_0xd625('0x3a')];_0x3af6dd['order']=qs[_0xd625('0x41')](_0x54ff3e[_0xd625('0x39')]['sort']);_0x3af6dd[_0xd625('0x42')]=qs['filters'](_['pick'](_0x54ff3e[_0xd625('0x39')],_0x55c334[_0xd625('0x52')]));if(_0x54ff3e[_0xd625('0x39')]['filter']){_0x3af6dd[_0xd625('0x42')]=_[_0xd625('0x47')](_0x3af6dd[_0xd625('0x42')],{'$or':_[_0xd625('0x37')](_0x3af6dd[_0xd625('0x3b')],function(_0x4cf5f2){var _0xafebce={};_0xafebce[_0x4cf5f2]={'$like':'%'+_0x54ff3e[_0xd625('0x39')]['filter']+'%'};return _0xafebce;})});}_0x3af6dd=_['merge']({},_0x3af6dd,_0x54ff3e[_0xd625('0x48')]);return _0x4921ce[_0xd625('0x88')](_0x3af6dd);}})[_0xd625('0x2d')](function(_0x56e0d5){if(_0x56e0d5){_0x17b691=_0x56e0d5['length'];if(!_0x54ff3e[_0xd625('0x39')][_0xd625('0x3e')](_0xd625('0x3f'))){_0x3af6dd[_0xd625('0x27')]=qs['limit'](_0x54ff3e[_0xd625('0x39')][_0xd625('0x27')]);_0x3af6dd['offset']=qs[_0xd625('0x26')](_0x54ff3e[_0xd625('0x39')]['offset']);}return _0x4921ce[_0xd625('0x88')](_0x3af6dd);}})['then'](function(_0x405787){if(_0x405787){return _0x405787?{'count':_0x17b691,'rows':_0x405787}:null;}})['then'](respondWithResult(_0x37a9c5,null))[_0xd625('0x55')](handleError(_0x37a9c5,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index c694c86..8fe9e91 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 _0xa058=['save','update','hook','exports','events','Team','setMaxListeners'];(function(_0x3b247d,_0xbe4218){var _0x131bcf=function(_0x4882f4){while(--_0x4882f4){_0x3b247d['push'](_0x3b247d['shift']());}};_0x131bcf(++_0xbe4218);}(_0xa058,0x13f));var _0x8a05=function(_0x5f12fd,_0x33c70d){_0x5f12fd=_0x5f12fd-0x0;var _0x58bd80=_0xa058[_0x5f12fd];return _0x58bd80;};'use strict';var EventEmitter=require(_0x8a05('0x0'));var Team=require('../../mysqldb')['db'][_0x8a05('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x8a05('0x2')](0x0);var events={'afterCreate':_0x8a05('0x3'),'afterUpdate':_0x8a05('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2c22a1){return function(_0x1e2be2,_0x525b23,_0x17a00e){TeamEvents['emit'](_0x2c22a1+':'+_0x1e2be2['id'],_0x1e2be2);TeamEvents['emit'](_0x2c22a1,_0x1e2be2);_0x17a00e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x8a05('0x5')](e,emitEvent(event));}}module[_0x8a05('0x6')]=TeamEvents; \ No newline at end of file +var _0xd396=['../../mysqldb','Team','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x583747,_0x14d327){var _0x84ae65=function(_0x3b76bf){while(--_0x3b76bf){_0x583747['push'](_0x583747['shift']());}};_0x84ae65(++_0x14d327);}(_0xd396,0x17b));var _0x6d39=function(_0x172002,_0x4e0955){_0x172002=_0x172002-0x0;var _0x37bf74=_0xd396[_0x172002];return _0x37bf74;};'use strict';var EventEmitter=require(_0x6d39('0x0'));var Team=require(_0x6d39('0x1'))['db'][_0x6d39('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x6d39('0x3')](0x0);var events={'afterCreate':_0x6d39('0x4'),'afterUpdate':'update','afterDestroy':_0x6d39('0x5')};function emitEvent(_0x4cbbc9){return function(_0x4fe6fe,_0x3e0d2e,_0x18e355){TeamEvents[_0x6d39('0x6')](_0x4cbbc9+':'+_0x4fe6fe['id'],_0x4fe6fe);TeamEvents[_0x6d39('0x6')](_0x4cbbc9,_0x4fe6fe);_0x18e355(null);};}for(var e in events){if(events[_0x6d39('0x7')](e)){var event=events[e];Team[_0x6d39('0x8')](e,emitEvent(event));}}module[_0x6d39('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 35cdfeb..405001c 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 _0x5163=['rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x65aab5,_0x46628f){var _0x26fcb0=function(_0x406b40){while(--_0x406b40){_0x65aab5['push'](_0x65aab5['shift']());}};_0x26fcb0(++_0x46628f);}(_0x5163,0x132));var _0x3516=function(_0x4b62e6,_0xf60f50){_0x4b62e6=_0x4b62e6-0x0;var _0x44263d=_0x5163[_0x4b62e6];return _0x44263d;};'use strict';var _=require(_0x3516('0x0'));var util=require(_0x3516('0x1'));var logger=require(_0x3516('0x2'))(_0x3516('0x3'));var moment=require('moment');var BPromise=require(_0x3516('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3516('0x5'));var rimraf=require(_0x3516('0x6'));var config=require(_0x3516('0x7'));var attributes=require(_0x3516('0x8'));module[_0x3516('0x9')]=function(_0x544a0b,_0x1011f2){return _0x544a0b[_0x3516('0xa')](_0x3516('0xb'),attributes,{'tableName':_0x3516('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e81=['bluebird','path','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','../../config/logger','moment'];(function(_0x2d6164,_0x3a5fcd){var _0x232c3e=function(_0x349a13){while(--_0x349a13){_0x2d6164['push'](_0x2d6164['shift']());}};_0x232c3e(++_0x3a5fcd);}(_0x6e81,0x11b));var _0x16e8=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x6e81[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x16e8('0x0'));var util=require('util');var logger=require(_0x16e8('0x1'))('api');var moment=require(_0x16e8('0x2'));var BPromise=require(_0x16e8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x16e8('0x4'));var rimraf=require('rimraf');var config=require(_0x16e8('0x5'));var attributes=require(_0x16e8('0x6'));module[_0x16e8('0x7')]=function(_0x34cd51,_0x4c8440){return _0x34cd51[_0x16e8('0x8')](_0x16e8('0x9'),attributes,{'tableName':_0x16e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 4b18ae9..2a8ee9a 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 _0xfbb4=['request','then','info','request\x20sent','debug','stringify','error','Team,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0xfbb4,0xc1));var _0x4fbb=function(_0x4587bb,_0x14c42b){_0x4587bb=_0x4587bb-0x0;var _0x3ca16a=_0xfbb4[_0x4587bb];return _0x3ca16a;};'use strict';var _=require(_0x4fbb('0x0'));var util=require('util');var moment=require(_0x4fbb('0x1'));var BPromise=require('bluebird');var rs=require(_0x4fbb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4fbb('0x3'));var logger=require(_0x4fbb('0x4'))(_0x4fbb('0x5'));var config=require(_0x4fbb('0x6'));var jayson=require(_0x4fbb('0x7'));var client=jayson[_0x4fbb('0x8')]['http']({'port':0x232a});config[_0x4fbb('0x9')]=_[_0x4fbb('0xa')](config['redis'],{'host':_0x4fbb('0xb'),'port':0x18eb});var socket=require(_0x4fbb('0xc'))(new Redis(config['redis']));require(_0x4fbb('0xd'))[_0x4fbb('0xe')](socket);function respondWithRpcPromise(_0x497316,_0x3b59cb,_0x29d586){return new BPromise(function(_0x2ba535,_0x13c3ff){return client[_0x4fbb('0xf')](_0x497316,_0x29d586)[_0x4fbb('0x10')](function(_0x4abf2a){logger[_0x4fbb('0x11')]('Team,\x20%s,\x20%s',_0x3b59cb,_0x4fbb('0x12'));logger[_0x4fbb('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x3b59cb,'request\x20sent',JSON[_0x4fbb('0x14')](_0x4abf2a));if(_0x4abf2a[_0x4fbb('0x15')]){if(_0x4abf2a[_0x4fbb('0x15')]['code']===0x1f4){logger[_0x4fbb('0x15')](_0x4fbb('0x16'),_0x3b59cb,_0x4abf2a[_0x4fbb('0x15')][_0x4fbb('0x17')]);return _0x13c3ff(_0x4abf2a['error'][_0x4fbb('0x17')]);}logger[_0x4fbb('0x15')](_0x4fbb('0x16'),_0x3b59cb,_0x4abf2a[_0x4fbb('0x15')][_0x4fbb('0x17')]);return _0x2ba535(_0x4abf2a[_0x4fbb('0x15')][_0x4fbb('0x17')]);}else{logger[_0x4fbb('0x11')](_0x4fbb('0x16'),_0x3b59cb,_0x4fbb('0x12'));_0x2ba535(_0x4abf2a[_0x4fbb('0x18')][_0x4fbb('0x17')]);}})[_0x4fbb('0x19')](function(_0x16e71f){logger['error'](_0x4fbb('0x16'),_0x3b59cb,_0x16e71f);_0x13c3ff(_0x16e71f);});});} \ No newline at end of file +var _0x85e4=['defaults','socket.io-emitter','register','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis'];(function(_0x50d17b,_0x17cc5e){var _0x35038b=function(_0x24c078){while(--_0x24c078){_0x50d17b['push'](_0x50d17b['shift']());}};_0x35038b(++_0x17cc5e);}(_0x85e4,0xe7));var _0x485e=function(_0xf4f002,_0x393d5b){_0xf4f002=_0xf4f002-0x0;var _0x21362a=_0x85e4[_0xf4f002];return _0x21362a;};'use strict';var _=require(_0x485e('0x0'));var util=require(_0x485e('0x1'));var moment=require('moment');var BPromise=require(_0x485e('0x2'));var rs=require(_0x485e('0x3'));var fs=require('fs');var Redis=require(_0x485e('0x4'));var db=require(_0x485e('0x5'))['db'];var utils=require(_0x485e('0x6'));var logger=require(_0x485e('0x7'))(_0x485e('0x8'));var config=require('../../config/environment');var jayson=require(_0x485e('0x9'));var client=jayson[_0x485e('0xa')]['http']({'port':0x232a});config[_0x485e('0xb')]=_[_0x485e('0xc')](config[_0x485e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x485e('0xd'))(new Redis(config[_0x485e('0xb')]));require('./team.socket')[_0x485e('0xe')](socket);function respondWithRpcPromise(_0x496929,_0x2c09ed,_0x4fb477){return new BPromise(function(_0xfb9289,_0x5467ba){return client['request'](_0x496929,_0x4fb477)[_0x485e('0xf')](function(_0x35f672){logger['info'](_0x485e('0x10'),_0x2c09ed,_0x485e('0x11'));logger[_0x485e('0x12')](_0x485e('0x13'),_0x2c09ed,_0x485e('0x11'),JSON[_0x485e('0x14')](_0x35f672));if(_0x35f672[_0x485e('0x15')]){if(_0x35f672[_0x485e('0x15')][_0x485e('0x16')]===0x1f4){logger[_0x485e('0x15')](_0x485e('0x10'),_0x2c09ed,_0x35f672[_0x485e('0x15')][_0x485e('0x17')]);return _0x5467ba(_0x35f672[_0x485e('0x15')][_0x485e('0x17')]);}logger[_0x485e('0x15')](_0x485e('0x10'),_0x2c09ed,_0x35f672[_0x485e('0x15')][_0x485e('0x17')]);return _0xfb9289(_0x35f672[_0x485e('0x15')]['message']);}else{logger[_0x485e('0x18')](_0x485e('0x10'),_0x2c09ed,_0x485e('0x11'));_0xfb9289(_0x35f672[_0x485e('0x19')]['message']);}})[_0x485e('0x1a')](function(_0x576033){logger[_0x485e('0x15')]('Team,\x20%s,\x20%s',_0x2c09ed,_0x576033);_0x5467ba(_0x576033);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index d605b79..acf0547 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 _0x1a38=['./team.events','save','remove','emit','removeListener','register','length','team:'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1a38,0xb0));var _0x81a3=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0x1a38[_0x2fdf82];return _0x2382f5;};'use strict';var TeamEvents=require(_0x81a3('0x0'));var events=[_0x81a3('0x1'),_0x81a3('0x2'),'update'];function createListener(_0x57f36a,_0x538035){return function(_0x477513){_0x538035[_0x81a3('0x3')](_0x57f36a,_0x477513);};}function removeListener(_0x2faf46,_0x28fd86){return function(){TeamEvents[_0x81a3('0x4')](_0x2faf46,_0x28fd86);};}exports[_0x81a3('0x5')]=function(_0x2f0a07){for(var _0x189c2b=0x0,_0x3153ee=events[_0x81a3('0x6')];_0x189c2b<_0x3153ee;_0x189c2b++){var _0x207345=events[_0x189c2b];var _0xe10e0a=createListener(_0x81a3('0x7')+_0x207345,_0x2f0a07);TeamEvents['on'](_0x207345,_0xe10e0a);}}; \ No newline at end of file +var _0xeda7=['team:','./team.events','save','remove','update','emit','removeListener','register','length'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xeda7,0x196));var _0x7eda=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0xeda7[_0x2c1dcd];return _0x158ce5;};'use strict';var TeamEvents=require(_0x7eda('0x0'));var events=[_0x7eda('0x1'),_0x7eda('0x2'),_0x7eda('0x3')];function createListener(_0x26c84b,_0x3780f0){return function(_0x29e7bd){_0x3780f0[_0x7eda('0x4')](_0x26c84b,_0x29e7bd);};}function removeListener(_0x324a25,_0x36a9f1){return function(){TeamEvents[_0x7eda('0x5')](_0x324a25,_0x36a9f1);};}exports[_0x7eda('0x6')]=function(_0x6ee7be){for(var _0x328430=0x0,_0x314602=events[_0x7eda('0x7')];_0x328430<_0x314602;_0x328430++){var _0x163427=events[_0x328430];var _0x2bc200=createListener(_0x7eda('0x8')+_0x163427,_0x6ee7be);TeamEvents['on'](_0x163427,_0x2bc200);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 134fddc..2a3714e 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 _0xdd11=['isAuthenticated','show','post','create','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./template.controller','get','index','/:id'];(function(_0x4aba2a,_0x58bc97){var _0x38bbcb=function(_0x4a50e1){while(--_0x4a50e1){_0x4aba2a['push'](_0x4aba2a['shift']());}};_0x38bbcb(++_0x58bc97);}(_0xdd11,0x15d));var _0x1dd1=function(_0x131d7e,_0x1376ad){_0x131d7e=_0x131d7e-0x0;var _0xdb586e=_0xdd11[_0x131d7e];return _0xdb586e;};'use strict';var multer=require(_0x1dd1('0x0'));var util=require(_0x1dd1('0x1'));var path=require('path');var timeout=require(_0x1dd1('0x2'));var express=require(_0x1dd1('0x3'));var router=express[_0x1dd1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1dd1('0x5'));var config=require(_0x1dd1('0x6'));var controller=require(_0x1dd1('0x7'));router[_0x1dd1('0x8')]('/',auth['isAuthenticated'](),controller[_0x1dd1('0x9')]);router['get'](_0x1dd1('0xa'),auth[_0x1dd1('0xb')](),controller[_0x1dd1('0xc')]);router[_0x1dd1('0xd')]('/',auth[_0x1dd1('0xb')](),controller[_0x1dd1('0xe')]);router['put'](_0x1dd1('0xa'),auth[_0x1dd1('0xb')](),controller[_0x1dd1('0xf')]);router['delete'](_0x1dd1('0xa'),auth[_0x1dd1('0xb')](),controller[_0x1dd1('0x10')]);module[_0x1dd1('0x11')]=router; \ No newline at end of file +var _0x1c65=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util','path'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x1c65,0x1c8));var _0x51c6=function(_0x40402c,_0x405b09){_0x40402c=_0x40402c-0x0;var _0x53d166=_0x1c65[_0x40402c];return _0x53d166;};'use strict';var multer=require(_0x51c6('0x0'));var util=require(_0x51c6('0x1'));var path=require(_0x51c6('0x2'));var timeout=require(_0x51c6('0x3'));var express=require(_0x51c6('0x4'));var router=express['Router']();var auth=require(_0x51c6('0x5'));var interaction=require(_0x51c6('0x6'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0x51c6('0x7')]('/',auth['isAuthenticated'](),controller[_0x51c6('0x8')]);router['get'](_0x51c6('0x9'),auth[_0x51c6('0xa')](),controller[_0x51c6('0xb')]);router[_0x51c6('0xc')]('/',auth[_0x51c6('0xa')](),controller['create']);router[_0x51c6('0xd')](_0x51c6('0x9'),auth[_0x51c6('0xa')](),controller['update']);router[_0x51c6('0xe')](_0x51c6('0x9'),auth[_0x51c6('0xa')](),controller[_0x51c6('0xf')]);module[_0x51c6('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index a61873b..d29dd8c 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 _0xaf34=['exports','STRING','TEXT'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xaf34,0x186));var _0x4af3=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xaf34[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');module[_0x4af3('0x0')]={'name':{'type':Sequelize[_0x4af3('0x1')]},'description':{'type':Sequelize[_0x4af3('0x1')]},'html':{'type':Sequelize[_0x4af3('0x2')]}}; \ No newline at end of file +var _0xc556=['exports','STRING'];(function(_0x3c4088,_0x47a980){var _0x4be355=function(_0xe93f74){while(--_0xe93f74){_0x3c4088['push'](_0x3c4088['shift']());}};_0x4be355(++_0x47a980);}(_0xc556,0xe4));var _0x6c55=function(_0x4c0566,_0x3fd656){_0x4c0566=_0x4c0566-0x0;var _0x3b2c06=_0xc556[_0x4c0566];return _0x3b2c06;};'use strict';var Sequelize=require('sequelize');module[_0x6c55('0x0')]={'name':{'type':Sequelize[_0x6c55('0x1')]},'description':{'type':Sequelize[_0x6c55('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 215b254..75a7aba 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 _0x7217=['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','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','sendStatus','name','send','index','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','Template','count','includeAll','rows','catch','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs'];(function(_0x31a1cd,_0x502703){var _0xc69b39=function(_0x3cbe53){while(--_0x3cbe53){_0x31a1cd['push'](_0x31a1cd['shift']());}};_0xc69b39(++_0x502703);}(_0x7217,0x19e));var _0x7721=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7217[_0x5c351c];return _0x26f3b3;};'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'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=_0x4b183e['count'],_0x25a628=_0x4e199a[_0x7721('0x1f')],_0x3cc909=_0x4e199a['offset']+_0x4e199a[_0x7721('0x20')],_0x32550d;if(_0x3cc909>=_0x5ed54){_0x3cc909=_0x5ed54;_0x32550d=0xc8;}else{_0x32550d=0xce;}_0x534f1b['status'](_0x32550d);return _0x534f1b[_0x7721('0x21')](_0x7721('0x22'),_0x25a628+'-'+_0x3cc909+'/'+_0x5ed54)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0x3e140d){return function(_0x2286e5){try{jsonpatch[_0x7721('0x23')](_0x2286e5,_0x3e140d,!![]);}catch(_0x402820){return BPromise[_0x7721('0x24')](_0x402820);}return _0x2286e5[_0x7721('0x25')]();};}function saveUpdates(_0xaeccc4,_0x4ce1db){return function(_0x288f7e){if(_0x288f7e){return _0x288f7e[_0x7721('0x26')](_0xaeccc4)[_0x7721('0x27')](function(_0xd8ad3c){return _0xd8ad3c;});}return null;};}function removeEntity(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')]()[_0x7721('0x27')](function(){var _0x3e8a4e=_0x512f31[_0x7721('0x29')]({'plain':!![]});var _0x121cc4=_0x7721('0x2a');return db[_0x7721('0x2b')]['destroy']({'where':{'type':_0x121cc4,'resourceId':_0x3e8a4e['id']}})[_0x7721('0x27')](function(){return _0x512f31;});})[_0x7721('0x27')](function(){_0x57140c[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x40d550,_0x16355a){return function(_0x424e05){if(!_0x424e05){_0x40d550[_0x7721('0x2c')](0x194);}return _0x424e05;};}function handleError(_0x40f367,_0x52316e){_0x52316e=_0x52316e||0x1f4;return function(_0x258ddf){logger['error'](_0x258ddf['stack']);if(_0x258ddf[_0x7721('0x2d')]){delete _0x258ddf[_0x7721('0x2d')];}_0x40f367[_0x7721('0x1c')](_0x52316e)[_0x7721('0x2e')](_0x258ddf);};}exports[_0x7721('0x2f')]=function(_0x37b9f0,_0xd7d703){var _0x1da2d8={},_0x5c54f0={},_0x471651={'count':0x0,'rows':[]};var _0x2871c5=_['map'](db['Template'][_0x7721('0x30')],function(_0x220bbf){return{'name':_0x220bbf['fieldName'],'type':_0x220bbf[_0x7721('0x31')][_0x7721('0x32')]};});_0x5c54f0[_0x7721('0x33')]=_['map'](_0x2871c5,_0x7721('0x2d'));_0x5c54f0[_0x7721('0x34')]=_[_0x7721('0x35')](_0x37b9f0[_0x7721('0x34')]);_0x5c54f0[_0x7721('0x36')]=_['intersection'](_0x5c54f0[_0x7721('0x33')],_0x5c54f0[_0x7721('0x34')]);_0x1da2d8[_0x7721('0x37')]=_['intersection'](_0x5c54f0[_0x7721('0x33')],qs[_0x7721('0x38')](_0x37b9f0['query'][_0x7721('0x38')]));_0x1da2d8['attributes']=_0x1da2d8[_0x7721('0x37')][_0x7721('0x39')]?_0x1da2d8[_0x7721('0x37')]:_0x5c54f0[_0x7721('0x33')];if(!_0x37b9f0[_0x7721('0x34')][_0x7721('0x3a')](_0x7721('0x3b'))){_0x1da2d8[_0x7721('0x20')]=qs[_0x7721('0x20')](_0x37b9f0[_0x7721('0x34')][_0x7721('0x20')]);_0x1da2d8['offset']=qs[_0x7721('0x1f')](_0x37b9f0['query'][_0x7721('0x1f')]);}_0x1da2d8[_0x7721('0x3c')]=qs[_0x7721('0x3d')](_0x37b9f0[_0x7721('0x34')][_0x7721('0x3d')]);_0x1da2d8[_0x7721('0x3e')]=qs['filters'](_['pick'](_0x37b9f0['query'],_0x5c54f0['filters']),_0x2871c5);if(_0x37b9f0[_0x7721('0x34')][_0x7721('0x3f')]){_0x1da2d8[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x1da2d8['where'],{'$or':_[_0x7721('0x41')](_0x2871c5,function(_0x4cf659){if(_0x4cf659[_0x7721('0x31')]!==_0x7721('0x42')){var _0x5a278e={};_0x5a278e[_0x4cf659[_0x7721('0x2d')]]={'$like':'%'+_0x37b9f0[_0x7721('0x34')]['filter']+'%'};return _0x5a278e;}})});}_0x1da2d8=_['merge']({},_0x1da2d8,_0x37b9f0[_0x7721('0x43')]);var _0xfc4dc4={'where':_0x1da2d8[_0x7721('0x3e')]};return db[_0x7721('0x44')]['count'](_0xfc4dc4)[_0x7721('0x27')](function(_0x120de9){_0x471651[_0x7721('0x45')]=_0x120de9;if(_0x37b9f0[_0x7721('0x34')][_0x7721('0x46')]){_0x1da2d8['include']=[{'all':!![]}];}return db[_0x7721('0x44')]['findAll'](_0x1da2d8);})[_0x7721('0x27')](function(_0x4a5b59){_0x471651[_0x7721('0x47')]=_0x4a5b59;return _0x471651;})[_0x7721('0x27')](respondWithFilteredResult(_0xd7d703,_0x1da2d8))[_0x7721('0x48')](handleError(_0xd7d703,null));};exports['show']=function(_0x1453d4,_0x11d853){var _0x1ad315={'raw':!![],'where':{'id':_0x1453d4[_0x7721('0x49')]['id']}},_0x481fa8={};_0x481fa8[_0x7721('0x33')]=_[_0x7721('0x35')](db[_0x7721('0x44')][_0x7721('0x30')]);_0x481fa8[_0x7721('0x34')]=_[_0x7721('0x35')](_0x1453d4['query']);_0x481fa8['filters']=_[_0x7721('0x4a')](_0x481fa8[_0x7721('0x33')],_0x481fa8[_0x7721('0x34')]);_0x1ad315[_0x7721('0x37')]=_[_0x7721('0x4a')](_0x481fa8[_0x7721('0x33')],qs[_0x7721('0x38')](_0x1453d4[_0x7721('0x34')][_0x7721('0x38')]));_0x1ad315[_0x7721('0x37')]=_0x1ad315['attributes']['length']?_0x1ad315[_0x7721('0x37')]:_0x481fa8[_0x7721('0x33')];if(_0x1453d4[_0x7721('0x34')][_0x7721('0x46')]){_0x1ad315['include']=[{'all':!![]}];}_0x1ad315=_[_0x7721('0x40')]({},_0x1ad315,_0x1453d4[_0x7721('0x43')]);return db['Template'][_0x7721('0x4b')](_0x1ad315)['then'](handleEntityNotFound(_0x11d853,null))[_0x7721('0x27')](respondWithResult(_0x11d853,null))['catch'](handleError(_0x11d853,null));};exports[_0x7721('0x4c')]=function(_0x196be4,_0xf17c40){return db['Template'][_0x7721('0x4c')](_0x196be4[_0x7721('0x4d')],{})['then'](function(_0x223d93){var _0x1196c2=_0x196be4[_0x7721('0x4e')]['get']({'plain':!![]});if(!_0x1196c2)throw new Error(_0x7721('0x4f'));if(_0x1196c2['role']===_0x7721('0x4e')){var _0x310549=_0x223d93[_0x7721('0x29')]({'plain':!![]});var _0x443503=_0x7721('0x2a');return db[_0x7721('0x50')][_0x7721('0x4b')]({'where':{'name':_0x443503,'userProfileId':_0x1196c2[_0x7721('0x51')]},'raw':!![]})[_0x7721('0x27')](function(_0x3386aa){if(_0x3386aa&&_0x3386aa[_0x7721('0x52')]===0x0){return db[_0x7721('0x2b')][_0x7721('0x4c')]({'name':_0x310549[_0x7721('0x2d')],'resourceId':_0x310549['id'],'type':_0x3386aa[_0x7721('0x2d')],'sectionId':_0x3386aa['id']},{})['then'](function(){return _0x223d93;});}else{return _0x223d93;}})[_0x7721('0x48')](function(_0x2f6f30){logger[_0x7721('0x53')](_0x7721('0x54'),_0x2f6f30);throw _0x2f6f30;});}return _0x223d93;})[_0x7721('0x27')](respondWithResult(_0xf17c40,0xc9))[_0x7721('0x48')](handleError(_0xf17c40,null));};exports[_0x7721('0x26')]=function(_0x57484c,_0x234bee){if(_0x57484c[_0x7721('0x4d')]['id']){delete _0x57484c[_0x7721('0x4d')]['id'];}return db[_0x7721('0x44')][_0x7721('0x4b')]({'where':{'id':_0x57484c[_0x7721('0x49')]['id']}})[_0x7721('0x27')](handleEntityNotFound(_0x234bee,null))[_0x7721('0x27')](saveUpdates(_0x57484c[_0x7721('0x4d')],null))[_0x7721('0x27')](respondWithResult(_0x234bee,null))[_0x7721('0x48')](handleError(_0x234bee,null));};exports['destroy']=function(_0x421c27,_0xadb365){return db[_0x7721('0x44')][_0x7721('0x4b')]({'where':{'id':_0x421c27[_0x7721('0x49')]['id']}})[_0x7721('0x27')](handleEntityNotFound(_0xadb365,null))[_0x7721('0x27')](removeEntity(_0xadb365,null))[_0x7721('0x48')](handleError(_0xadb365,null));}; \ No newline at end of file +var _0x5fc3=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','Template','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','options','count','include','rows','catch','show','params','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection'];(function(_0x4c77cb,_0x4b6412){var _0x5d64d2=function(_0x5757b3){while(--_0x5757b3){_0x4c77cb['push'](_0x4c77cb['shift']());}};_0x5d64d2(++_0x4b6412);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5805d7,_0x3d584a){_0x5805d7=_0x5805d7-0x0;var _0x170fe4=_0x5fc3[_0x5805d7];return _0x170fe4;};'use strict';var pdf=require(_0x35fc('0x0'));var emlformat=require(_0x35fc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35fc('0x2'));var jsonpatch=require(_0x35fc('0x3'));var rp=require(_0x35fc('0x4'));var moment=require(_0x35fc('0x5'));var BPromise=require(_0x35fc('0x6'));var Mustache=require('mustache');var util=require(_0x35fc('0x7'));var path=require(_0x35fc('0x8'));var sox=require(_0x35fc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0xe'));var querystring=require(_0x35fc('0xf'));var Papa=require(_0x35fc('0x10'));var Redis=require(_0x35fc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x12'));var as=require(_0x35fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x14'))(_0x35fc('0x15'));var utils=require('../../config/utils');var config=require(_0x35fc('0x16'));var licenseUtil=require(_0x35fc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x18')](_0x409357);}return _0x4cbe74[_0x35fc('0x19')](_0x409357)[_0x35fc('0x1a')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=_0x229d56['count'],_0x154958=_0x398b67[_0x35fc('0x1b')],_0x227a49=_0x398b67[_0x35fc('0x1b')]+_0x398b67['limit'],_0x1121fa;if(_0x227a49>=_0x53b898){_0x227a49=_0x53b898;_0x1121fa=0xc8;}else{_0x1121fa=0xce;}_0x558364[_0x35fc('0x19')](_0x1121fa);return _0x558364[_0x35fc('0x1c')](_0x35fc('0x1d'),_0x154958+'-'+_0x227a49+'/'+_0x53b898)['json'](_0x229d56);}return null;};}function patchUpdates(_0x1a86e9){return function(_0x3c58ea){try{jsonpatch[_0x35fc('0x1e')](_0x3c58ea,_0x1a86e9,!![]);}catch(_0x488234){return BPromise[_0x35fc('0x1f')](_0x488234);}return _0x3c58ea[_0x35fc('0x20')]();};}function saveUpdates(_0x3229d1,_0x251a1f){return function(_0x20ffde){if(_0x20ffde){return _0x20ffde[_0x35fc('0x21')](_0x3229d1)[_0x35fc('0x22')](function(_0x3b05b0){return _0x3b05b0;});}return null;};}function removeEntity(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')]()[_0x35fc('0x22')](function(){var _0x257719=_0x5bd2b8[_0x35fc('0x24')]({'plain':!![]});var _0x3b4743='Templates';return db[_0x35fc('0x25')][_0x35fc('0x23')]({'where':{'type':_0x3b4743,'resourceId':_0x257719['id']}})['then'](function(){return _0x5bd2b8;});})[_0x35fc('0x22')](function(){_0x2405e8[_0x35fc('0x19')](0xcc)[_0x35fc('0x1a')]();});}};}function handleEntityNotFound(_0x51cfec,_0x4086e9){return function(_0x598d7a){if(!_0x598d7a){_0x51cfec[_0x35fc('0x18')](0x194);}return _0x598d7a;};}function handleError(_0xdfab9f,_0x5cb986){_0x5cb986=_0x5cb986||0x1f4;return function(_0x519264){logger[_0x35fc('0x26')](_0x519264['stack']);if(_0x519264[_0x35fc('0x27')]){delete _0x519264[_0x35fc('0x27')];}_0xdfab9f['status'](_0x5cb986)[_0x35fc('0x28')](_0x519264);};}exports[_0x35fc('0x29')]=function(_0x383837,_0x9f3c8a){var _0x3735da={},_0x134dfa={},_0x11ccdb={'count':0x0,'rows':[]};var _0x451f0c=_['map'](db[_0x35fc('0x2a')][_0x35fc('0x2b')],function(_0x22af18){return{'name':_0x22af18['fieldName'],'type':_0x22af18[_0x35fc('0x2c')][_0x35fc('0x2d')]};});_0x134dfa[_0x35fc('0x2e')]=_[_0x35fc('0x2f')](_0x451f0c,_0x35fc('0x27'));_0x134dfa[_0x35fc('0x30')]=_[_0x35fc('0x31')](_0x383837[_0x35fc('0x30')]);_0x134dfa[_0x35fc('0x32')]=_[_0x35fc('0x33')](_0x134dfa['model'],_0x134dfa['query']);_0x3735da[_0x35fc('0x34')]=_['intersection'](_0x134dfa[_0x35fc('0x2e')],qs[_0x35fc('0x35')](_0x383837[_0x35fc('0x30')][_0x35fc('0x35')]));_0x3735da[_0x35fc('0x34')]=_0x3735da[_0x35fc('0x34')]['length']?_0x3735da[_0x35fc('0x34')]:_0x134dfa[_0x35fc('0x2e')];if(!_0x383837[_0x35fc('0x30')][_0x35fc('0x36')](_0x35fc('0x37'))){_0x3735da[_0x35fc('0x38')]=qs['limit'](_0x383837[_0x35fc('0x30')][_0x35fc('0x38')]);_0x3735da[_0x35fc('0x1b')]=qs['offset'](_0x383837[_0x35fc('0x30')]['offset']);}_0x3735da[_0x35fc('0x39')]=qs[_0x35fc('0x3a')](_0x383837[_0x35fc('0x30')][_0x35fc('0x3a')]);_0x3735da['where']=qs['filters'](_['pick'](_0x383837[_0x35fc('0x30')],_0x134dfa['filters']),_0x451f0c);if(_0x383837[_0x35fc('0x30')]['filter']){_0x3735da[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x3735da[_0x35fc('0x3b')],{'$or':_[_0x35fc('0x2f')](_0x451f0c,function(_0x1c10e0){if(_0x1c10e0[_0x35fc('0x2c')]!==_0x35fc('0x3d')){var _0x4ec0dc={};_0x4ec0dc[_0x1c10e0[_0x35fc('0x27')]]={'$like':'%'+_0x383837[_0x35fc('0x30')]['filter']+'%'};return _0x4ec0dc;}})});}_0x3735da=_[_0x35fc('0x3c')]({},_0x3735da,_0x383837[_0x35fc('0x3e')]);var _0x1aac67={'where':_0x3735da[_0x35fc('0x3b')]};return db[_0x35fc('0x2a')][_0x35fc('0x3f')](_0x1aac67)['then'](function(_0x3f6480){_0x11ccdb[_0x35fc('0x3f')]=_0x3f6480;if(_0x383837[_0x35fc('0x30')]['includeAll']){_0x3735da[_0x35fc('0x40')]=[{'all':!![]}];}return db[_0x35fc('0x2a')]['findAll'](_0x3735da);})[_0x35fc('0x22')](function(_0x280af1){_0x11ccdb[_0x35fc('0x41')]=_0x280af1;return _0x11ccdb;})[_0x35fc('0x22')](respondWithFilteredResult(_0x9f3c8a,_0x3735da))[_0x35fc('0x42')](handleError(_0x9f3c8a,null));};exports[_0x35fc('0x43')]=function(_0x211b70,_0x3ec51f){var _0x5a7e9e={'raw':!![],'where':{'id':_0x211b70[_0x35fc('0x44')]['id']}},_0x596e83={};_0x596e83[_0x35fc('0x2e')]=_['keys'](db['Template']['rawAttributes']);_0x596e83[_0x35fc('0x30')]=_[_0x35fc('0x31')](_0x211b70['query']);_0x596e83[_0x35fc('0x32')]=_[_0x35fc('0x33')](_0x596e83[_0x35fc('0x2e')],_0x596e83[_0x35fc('0x30')]);_0x5a7e9e['attributes']=_['intersection'](_0x596e83['model'],qs['fields'](_0x211b70['query'][_0x35fc('0x35')]));_0x5a7e9e[_0x35fc('0x34')]=_0x5a7e9e['attributes'][_0x35fc('0x45')]?_0x5a7e9e['attributes']:_0x596e83[_0x35fc('0x2e')];if(_0x211b70[_0x35fc('0x30')][_0x35fc('0x46')]){_0x5a7e9e[_0x35fc('0x40')]=[{'all':!![]}];}_0x5a7e9e=_[_0x35fc('0x3c')]({},_0x5a7e9e,_0x211b70['options']);return db[_0x35fc('0x2a')][_0x35fc('0x47')](_0x5a7e9e)['then'](handleEntityNotFound(_0x3ec51f,null))[_0x35fc('0x22')](respondWithResult(_0x3ec51f,null))[_0x35fc('0x42')](handleError(_0x3ec51f,null));};exports[_0x35fc('0x48')]=function(_0x211746,_0x5bc8c3){return db[_0x35fc('0x2a')]['create'](_0x211746['body'],{})[_0x35fc('0x22')](function(_0x9db7e8){var _0x18dc78=_0x211746[_0x35fc('0x49')][_0x35fc('0x24')]({'plain':!![]});if(!_0x18dc78)throw new Error(_0x35fc('0x4a'));if(_0x18dc78[_0x35fc('0x4b')]===_0x35fc('0x49')){var _0x4f555f=_0x9db7e8[_0x35fc('0x24')]({'plain':!![]});var _0x91d7c0=_0x35fc('0x4c');return db[_0x35fc('0x4d')][_0x35fc('0x47')]({'where':{'name':_0x91d7c0,'userProfileId':_0x18dc78[_0x35fc('0x4e')]},'raw':!![]})[_0x35fc('0x22')](function(_0x347a4a){if(_0x347a4a&&_0x347a4a[_0x35fc('0x4f')]===0x0){return db[_0x35fc('0x25')][_0x35fc('0x48')]({'name':_0x4f555f[_0x35fc('0x27')],'resourceId':_0x4f555f['id'],'type':_0x347a4a[_0x35fc('0x27')],'sectionId':_0x347a4a['id']},{})[_0x35fc('0x22')](function(){return _0x9db7e8;});}else{return _0x9db7e8;}})['catch'](function(_0x553ed6){logger[_0x35fc('0x26')](_0x35fc('0x50'),_0x553ed6);throw _0x553ed6;});}return _0x9db7e8;})[_0x35fc('0x22')](respondWithResult(_0x5bc8c3,0xc9))[_0x35fc('0x42')](handleError(_0x5bc8c3,null));};exports[_0x35fc('0x21')]=function(_0x3e6494,_0x4a4798){if(_0x3e6494['body']['id']){delete _0x3e6494[_0x35fc('0x51')]['id'];}return db[_0x35fc('0x2a')][_0x35fc('0x47')]({'where':{'id':_0x3e6494[_0x35fc('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a4798,null))[_0x35fc('0x22')](saveUpdates(_0x3e6494[_0x35fc('0x51')],null))['then'](respondWithResult(_0x4a4798,null))[_0x35fc('0x42')](handleError(_0x4a4798,null));};exports[_0x35fc('0x23')]=function(_0x590faa,_0x3e12e4){return db[_0x35fc('0x2a')][_0x35fc('0x47')]({'where':{'id':_0x590faa[_0x35fc('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e12e4,null))['then'](removeEntity(_0x3e12e4,null))['catch'](handleError(_0x3e12e4,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 19fbe2e..f25d957 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 _0xfaf8=['api','request-promise','path','rimraf','../../config/environment','exports','define','Template'];(function(_0xe2c95e,_0x3e6545){var _0x42ce6f=function(_0x218482){while(--_0x218482){_0xe2c95e['push'](_0xe2c95e['shift']());}};_0x42ce6f(++_0x3e6545);}(_0xfaf8,0x178));var _0x8faf=function(_0x492ecf,_0x27167e){_0x492ecf=_0x492ecf-0x0;var _0xa4189c=_0xfaf8[_0x492ecf];return _0xa4189c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8faf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8faf('0x1'));var fs=require('fs');var path=require(_0x8faf('0x2'));var rimraf=require(_0x8faf('0x3'));var config=require(_0x8faf('0x4'));var attributes=require('./template.attributes');module[_0x8faf('0x5')]=function(_0xe0e102,_0x9f88e3){return _0xe0e102[_0x8faf('0x6')](_0x8faf('0x7'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58b9=['request-promise','../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x348b2d,_0x4ad477){var _0x5ac2cd=function(_0x580987){while(--_0x580987){_0x348b2d['push'](_0x348b2d['shift']());}};_0x5ac2cd(++_0x4ad477);}(_0x58b9,0x96));var _0x958b=function(_0x37c766,_0x12df9a){_0x37c766=_0x37c766-0x0;var _0x9f4e48=_0x58b9[_0x37c766];return _0x9f4e48;};'use strict';var _=require(_0x958b('0x0'));var util=require(_0x958b('0x1'));var logger=require(_0x958b('0x2'))(_0x958b('0x3'));var moment=require(_0x958b('0x4'));var BPromise=require(_0x958b('0x5'));var rp=require(_0x958b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x958b('0x7'));var attributes=require(_0x958b('0x8'));module[_0x958b('0x9')]=function(_0x56330a,_0x4ff39a){return _0x56330a[_0x958b('0xa')]('Template',attributes,{'tableName':_0x958b('0xb'),'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 8c8f78b..d557765 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 _0xdad7=['where','limit','include','map','model','attributes','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','code','error','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','raw','options'];(function(_0x18e590,_0x47b7f7){var _0x43890c=function(_0x141946){while(--_0x141946){_0x18e590['push'](_0x18e590['shift']());}};_0x43890c(++_0x47b7f7);}(_0xdad7,0x12f));var _0x7dad=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xdad7[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x7dad('0x0'));var util=require('util');var moment=require(_0x7dad('0x1'));var BPromise=require(_0x7dad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7dad('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7dad('0x4'));var logger=require('../../config/logger')(_0x7dad('0x5'));var config=require(_0x7dad('0x6'));var jayson=require(_0x7dad('0x7'));var client=jayson[_0x7dad('0x8')][_0x7dad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4852ed,_0x4a0ef6,_0x902996){return new BPromise(function(_0x1e56d5,_0x377a47){return client['request'](_0x4852ed,_0x902996)[_0x7dad('0xa')](function(_0xb13ab5){logger[_0x7dad('0xb')]('Template,\x20%s,\x20%s',_0x4a0ef6,_0x7dad('0xc'));logger[_0x7dad('0xd')](_0x7dad('0xe'),_0x4a0ef6,_0x7dad('0xc'),JSON[_0x7dad('0xf')](_0xb13ab5));if(_0xb13ab5['error']){if(_0xb13ab5['error'][_0x7dad('0x10')]===0x1f4){logger[_0x7dad('0x11')](_0x7dad('0x12'),_0x4a0ef6,_0xb13ab5['error'][_0x7dad('0x13')]);return _0x377a47(_0xb13ab5[_0x7dad('0x11')][_0x7dad('0x13')]);}logger[_0x7dad('0x11')](_0x7dad('0x12'),_0x4a0ef6,_0xb13ab5['error'][_0x7dad('0x13')]);return _0x1e56d5(_0xb13ab5[_0x7dad('0x11')][_0x7dad('0x13')]);}else{logger[_0x7dad('0xb')](_0x7dad('0x12'),_0x4a0ef6,_0x7dad('0xc'));_0x1e56d5(_0xb13ab5[_0x7dad('0x14')]['message']);}})[_0x7dad('0x15')](function(_0x4936c6){logger[_0x7dad('0x11')](_0x7dad('0x12'),_0x4a0ef6,_0x4936c6);_0x377a47(_0x4936c6);});});}exports[_0x7dad('0x16')]=function(_0x5a8b13){var _0x3e8aa1=this;return new Promise(function(_0x3fe062,_0x483e41){return db[_0x7dad('0x17')][_0x7dad('0x18')]({'raw':_0x5a8b13['options']?_0x5a8b13['options'][_0x7dad('0x19')]===undefined?!![]:![]:!![],'where':_0x5a8b13[_0x7dad('0x1a')]?_0x5a8b13[_0x7dad('0x1a')][_0x7dad('0x1b')]||null:null,'attributes':_0x5a8b13[_0x7dad('0x1a')]?_0x5a8b13[_0x7dad('0x1a')]['attributes']||null:null,'limit':_0x5a8b13[_0x7dad('0x1a')]?_0x5a8b13[_0x7dad('0x1a')][_0x7dad('0x1c')]||null:null,'include':_0x5a8b13[_0x7dad('0x1a')]?_0x5a8b13[_0x7dad('0x1a')][_0x7dad('0x1d')]?_[_0x7dad('0x1e')](_0x5a8b13['options'][_0x7dad('0x1d')],function(_0x5f41df){return{'model':db[_0x5f41df[_0x7dad('0x1f')]],'as':_0x5f41df['as'],'attributes':_0x5f41df[_0x7dad('0x20')],'include':_0x5f41df['include']?_[_0x7dad('0x1e')](_0x5f41df[_0x7dad('0x1d')],function(_0x4a3074){return{'model':db[_0x4a3074['model']],'as':_0x4a3074['as'],'attributes':_0x4a3074[_0x7dad('0x20')],'include':_0x4a3074[_0x7dad('0x1d')]?_[_0x7dad('0x1e')](_0x4a3074['include'],function(_0x1bf96e){return{'model':db[_0x1bf96e['model']],'as':_0x1bf96e['as'],'attributes':_0x1bf96e[_0x7dad('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7dad('0xa')](function(_0x4be53c){logger[_0x7dad('0xb')](_0x7dad('0x16'),_0x5a8b13);logger['debug'](_0x7dad('0x16'),_0x5a8b13,JSON[_0x7dad('0xf')](_0x4be53c));_0x3fe062(_0x4be53c);})['catch'](function(_0x17cda0){logger[_0x7dad('0x11')](_0x7dad('0x16'),_0x17cda0[_0x7dad('0x13')],_0x5a8b13);_0x483e41(_0x3e8aa1[_0x7dad('0x11')](0x1f4,_0x17cda0[_0x7dad('0x13')]));});});}; \ No newline at end of file +var _0x4175=['error','code','message','Template,\x20%s,\x20%s','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','Template,\x20%s,\x20%s,\x20%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4175,0xa8));var _0x5417=function(_0x2ead0d,_0x4b9839){_0x2ead0d=_0x2ead0d-0x0;var _0x1c4989=_0x4175[_0x2ead0d];return _0x1c4989;};'use strict';var _=require(_0x5417('0x0'));var util=require('util');var moment=require(_0x5417('0x1'));var BPromise=require(_0x5417('0x2'));var rs=require(_0x5417('0x3'));var fs=require('fs');var Redis=require(_0x5417('0x4'));var db=require(_0x5417('0x5'))['db'];var utils=require(_0x5417('0x6'));var logger=require(_0x5417('0x7'))(_0x5417('0x8'));var config=require(_0x5417('0x9'));var jayson=require(_0x5417('0xa'));var client=jayson[_0x5417('0xb')][_0x5417('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7b56dd,_0x3d65f2,_0x118c38){return new BPromise(function(_0x53ec00,_0x1b9f00){return client[_0x5417('0xd')](_0x7b56dd,_0x118c38)['then'](function(_0x42a50f){logger[_0x5417('0xe')]('Template,\x20%s,\x20%s',_0x3d65f2,_0x5417('0xf'));logger['debug'](_0x5417('0x10'),_0x3d65f2,_0x5417('0xf'),JSON['stringify'](_0x42a50f));if(_0x42a50f['error']){if(_0x42a50f[_0x5417('0x11')][_0x5417('0x12')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x3d65f2,_0x42a50f['error'][_0x5417('0x13')]);return _0x1b9f00(_0x42a50f[_0x5417('0x11')][_0x5417('0x13')]);}logger['error'](_0x5417('0x14'),_0x3d65f2,_0x42a50f['error'][_0x5417('0x13')]);return _0x53ec00(_0x42a50f[_0x5417('0x11')][_0x5417('0x13')]);}else{logger[_0x5417('0xe')]('Template,\x20%s,\x20%s',_0x3d65f2,_0x5417('0xf'));_0x53ec00(_0x42a50f[_0x5417('0x15')][_0x5417('0x13')]);}})[_0x5417('0x16')](function(_0xa1be50){logger[_0x5417('0x11')](_0x5417('0x14'),_0x3d65f2,_0xa1be50);_0x1b9f00(_0xa1be50);});});}exports[_0x5417('0x17')]=function(_0x48fc86){var _0xb9677a=this;return new Promise(function(_0x82637c,_0x2f74f2){return db[_0x5417('0x18')][_0x5417('0x19')]({'raw':_0x48fc86[_0x5417('0x1a')]?_0x48fc86['options'][_0x5417('0x1b')]===undefined?!![]:![]:!![],'where':_0x48fc86['options']?_0x48fc86[_0x5417('0x1a')][_0x5417('0x1c')]||null:null,'attributes':_0x48fc86[_0x5417('0x1a')]?_0x48fc86['options'][_0x5417('0x1d')]||null:null,'limit':_0x48fc86[_0x5417('0x1a')]?_0x48fc86[_0x5417('0x1a')][_0x5417('0x1e')]||null:null,'include':_0x48fc86[_0x5417('0x1a')]?_0x48fc86[_0x5417('0x1a')]['include']?_[_0x5417('0x1f')](_0x48fc86[_0x5417('0x1a')][_0x5417('0x20')],function(_0x215c77){return{'model':db[_0x215c77['model']],'as':_0x215c77['as'],'attributes':_0x215c77['attributes'],'include':_0x215c77[_0x5417('0x20')]?_[_0x5417('0x1f')](_0x215c77[_0x5417('0x20')],function(_0x5c5d49){return{'model':db[_0x5c5d49[_0x5417('0x21')]],'as':_0x5c5d49['as'],'attributes':_0x5c5d49[_0x5417('0x1d')],'include':_0x5c5d49[_0x5417('0x20')]?_[_0x5417('0x1f')](_0x5c5d49[_0x5417('0x20')],function(_0x1d0625){return{'model':db[_0x1d0625['model']],'as':_0x1d0625['as'],'attributes':_0x1d0625[_0x5417('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5417('0x22')](function(_0x5d47e8){logger[_0x5417('0xe')]('GetTemplate',_0x48fc86);logger[_0x5417('0x23')]('GetTemplate',_0x48fc86,JSON[_0x5417('0x24')](_0x5d47e8));_0x82637c(_0x5d47e8);})['catch'](function(_0x1c010e){logger[_0x5417('0x11')]('GetTemplate',_0x1c010e[_0x5417('0x13')],_0x48fc86);_0x2f74f2(_0xb9677a[_0x5417('0x11')](0x1f4,_0x1c010e[_0x5417('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index baf8e4e..f4a4929 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 _0x86dc=['post','addAllCondition','addAnyCondition','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions'];(function(_0x3c45c9,_0x551fd3){var _0x38390d=function(_0x294c14){while(--_0x294c14){_0x3c45c9['push'](_0x3c45c9['shift']());}};_0x38390d(++_0x551fd3);}(_0x86dc,0x18e));var _0xc86d=function(_0x2e89d7,_0x52243d){_0x2e89d7=_0x2e89d7-0x0;var _0xc9b37a=_0x86dc[_0x2e89d7];return _0xc9b37a;};'use strict';var multer=require('multer');var util=require(_0xc86d('0x0'));var path=require(_0xc86d('0x1'));var timeout=require(_0xc86d('0x2'));var express=require(_0xc86d('0x3'));var router=express['Router']();var auth=require(_0xc86d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc86d('0x5'));router[_0xc86d('0x6')]('/',auth[_0xc86d('0x7')](),controller[_0xc86d('0x8')]);router[_0xc86d('0x6')](_0xc86d('0x9'),auth[_0xc86d('0x7')](),controller[_0xc86d('0xa')]);router['get'](_0xc86d('0xb'),auth[_0xc86d('0x7')](),controller[_0xc86d('0xc')]);router[_0xc86d('0x6')](_0xc86d('0xd'),auth[_0xc86d('0x7')](),controller[_0xc86d('0xe')]);router[_0xc86d('0x6')]('/:id/actions',auth[_0xc86d('0x7')](),controller[_0xc86d('0xf')]);router[_0xc86d('0x10')]('/',auth[_0xc86d('0x7')](),controller['create']);router['post'](_0xc86d('0xb'),auth[_0xc86d('0x7')](),controller[_0xc86d('0x11')]);router[_0xc86d('0x10')]('/:id/any_conditions',auth[_0xc86d('0x7')](),controller[_0xc86d('0x12')]);router[_0xc86d('0x10')]('/:id/actions',auth[_0xc86d('0x7')](),controller['addAction']);router[_0xc86d('0x13')](_0xc86d('0x9'),auth[_0xc86d('0x7')](),controller['update']);router[_0xc86d('0x14')](_0xc86d('0x9'),auth[_0xc86d('0x7')](),controller[_0xc86d('0x15')]);module[_0xc86d('0x16')]=router; \ No newline at end of file +var _0xa296=['../../config/environment','./trigger.controller','get','index','/:id','show','/:id/all_conditions','/:id/any_conditions','isAuthenticated','getAnyConditions','/:id/actions','create','post','addAnyCondition','addAction','update','delete','exports','util','path','express','../../components/interaction/service'];(function(_0xdbfe2f,_0x30155c){var _0xf89e94=function(_0x45344f){while(--_0x45344f){_0xdbfe2f['push'](_0xdbfe2f['shift']());}};_0xf89e94(++_0x30155c);}(_0xa296,0x172));var _0x6a29=function(_0x5c38cd,_0x5a6b4e){_0x5c38cd=_0x5c38cd-0x0;var _0xc985ef=_0xa296[_0x5c38cd];return _0xc985ef;};'use strict';var multer=require('multer');var util=require(_0x6a29('0x0'));var path=require(_0x6a29('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a29('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6a29('0x3'));var config=require(_0x6a29('0x4'));var controller=require(_0x6a29('0x5'));router[_0x6a29('0x6')]('/',auth['isAuthenticated'](),controller[_0x6a29('0x7')]);router[_0x6a29('0x6')](_0x6a29('0x8'),auth['isAuthenticated'](),controller[_0x6a29('0x9')]);router[_0x6a29('0x6')](_0x6a29('0xa'),auth['isAuthenticated'](),controller['getAllConditions']);router['get'](_0x6a29('0xb'),auth[_0x6a29('0xc')](),controller[_0x6a29('0xd')]);router[_0x6a29('0x6')](_0x6a29('0xe'),auth[_0x6a29('0xc')](),controller['getActions']);router['post']('/',auth[_0x6a29('0xc')](),controller[_0x6a29('0xf')]);router[_0x6a29('0x10')](_0x6a29('0xa'),auth[_0x6a29('0xc')](),controller['addAllCondition']);router[_0x6a29('0x10')](_0x6a29('0xb'),auth[_0x6a29('0xc')](),controller[_0x6a29('0x11')]);router[_0x6a29('0x10')](_0x6a29('0xe'),auth[_0x6a29('0xc')](),controller[_0x6a29('0x12')]);router['put']('/:id',auth[_0x6a29('0xc')](),controller[_0x6a29('0x13')]);router[_0x6a29('0x14')](_0x6a29('0x8'),auth[_0x6a29('0xc')](),controller['destroy']);module[_0x6a29('0x15')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 8015479..ba977f0 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 _0xfb00=['exports','STRING','BOOLEAN','sequelize'];(function(_0x458656,_0x4292d8){var _0x24e475=function(_0x15f497){while(--_0x15f497){_0x458656['push'](_0x458656['shift']());}};_0x24e475(++_0x4292d8);}(_0xfb00,0xdf));var _0x0fb0=function(_0x5d4906,_0x537ec){_0x5d4906=_0x5d4906-0x0;var _0x98fb41=_0xfb00[_0x5d4906];return _0x98fb41;};'use strict';var Sequelize=require(_0x0fb0('0x0'));module[_0x0fb0('0x1')]={'name':{'type':Sequelize[_0x0fb0('0x2')]},'channel':{'type':Sequelize[_0x0fb0('0x2')]},'description':{'type':Sequelize[_0x0fb0('0x2')]},'status':{'type':Sequelize[_0x0fb0('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe19f=['exports','STRING','BOOLEAN','sequelize'];(function(_0x53b992,_0x5951ad){var _0x561d89=function(_0x42e7d0){while(--_0x42e7d0){_0x53b992['push'](_0x53b992['shift']());}};_0x561d89(++_0x5951ad);}(_0xe19f,0x1b7));var _0xfe19=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe19f[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xfe19('0x0'));module[_0xfe19('0x1')]={'name':{'type':Sequelize[_0xfe19('0x2')]},'channel':{'type':Sequelize[_0xfe19('0x2')]},'description':{'type':Sequelize[_0xfe19('0x2')]},'status':{'type':Sequelize[_0xfe19('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 15252ca..1b74963 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 _0xfcbd=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','then','destroy','Triggers','UserProfileResource','error','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','type','merge','options','Trigger','include','findAll','rows','params','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','sort','nolimit','getAnyConditions','TriggerId','getActions','Action','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x42aaf4,_0x26474c){var _0x4d2105=function(_0x103468){while(--_0x103468){_0x42aaf4['push'](_0x42aaf4['shift']());}};_0x4d2105(++_0x26474c);}(_0xfcbd,0x160));var _0xdfcb=function(_0x26d467,_0x864bb1){_0x26d467=_0x26d467-0x0;var _0x5b86dd=_0xfcbd[_0x26d467];return _0x5b86dd;};'use strict';var pdf=require(_0xdfcb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdfcb('0x1'));var jsonpatch=require(_0xdfcb('0x2'));var rp=require(_0xdfcb('0x3'));var moment=require(_0xdfcb('0x4'));var BPromise=require(_0xdfcb('0x5'));var Mustache=require(_0xdfcb('0x6'));var util=require(_0xdfcb('0x7'));var path=require(_0xdfcb('0x8'));var sox=require(_0xdfcb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdfcb('0xa'));var squel=require(_0xdfcb('0xb'));var crypto=require(_0xdfcb('0xc'));var jsforce=require(_0xdfcb('0xd'));var deskjs=require(_0xdfcb('0xe'));var toCsv=require(_0xdfcb('0xf'));var querystring=require(_0xdfcb('0x10'));var Papa=require('papaparse');var Redis=require(_0xdfcb('0x11'));var authService=require(_0xdfcb('0x12'));var qs=require(_0xdfcb('0x13'));var as=require(_0xdfcb('0x14'));var hardwareService=require(_0xdfcb('0x15'));var logger=require(_0xdfcb('0x16'))(_0xdfcb('0x17'));var utils=require(_0xdfcb('0x18'));var config=require(_0xdfcb('0x19'));var licenseUtil=require(_0xdfcb('0x1a'));var db=require(_0xdfcb('0x1b'))['db'];function respondWithStatusCode(_0x4efab3,_0x47404b){_0x47404b=_0x47404b||0xcc;return function(_0x2e33ab){if(_0x2e33ab){return _0x4efab3[_0xdfcb('0x1c')](_0x47404b);}return _0x4efab3[_0xdfcb('0x1d')](_0x47404b)[_0xdfcb('0x1e')]();};}function respondWithResult(_0x5d10d3,_0xd8c73d){_0xd8c73d=_0xd8c73d||0xc8;return function(_0x391bf4){if(_0x391bf4){return _0x5d10d3[_0xdfcb('0x1d')](_0xd8c73d)[_0xdfcb('0x1f')](_0x391bf4);}};}function respondWithFilteredResult(_0x336866,_0x519cef){return function(_0x3afbd2){if(_0x3afbd2){var _0x421054=_0x3afbd2[_0xdfcb('0x20')],_0x1b48fa=_0x519cef[_0xdfcb('0x21')],_0x65ec83=_0x519cef[_0xdfcb('0x21')]+_0x519cef[_0xdfcb('0x22')],_0x11437d;if(_0x65ec83>=_0x421054){_0x65ec83=_0x421054;_0x11437d=0xc8;}else{_0x11437d=0xce;}_0x336866[_0xdfcb('0x1d')](_0x11437d);return _0x336866['set']('Content-Range',_0x1b48fa+'-'+_0x65ec83+'/'+_0x421054)[_0xdfcb('0x1f')](_0x3afbd2);}return null;};}function patchUpdates(_0x19051f){return function(_0x4a395c){try{jsonpatch[_0xdfcb('0x23')](_0x4a395c,_0x19051f,!![]);}catch(_0x14ffea){return BPromise['reject'](_0x14ffea);}return _0x4a395c['save']();};}function saveUpdates(_0x33ecab,_0x497db4){return function(_0x58e054){if(_0x58e054){return _0x58e054['update'](_0x33ecab)[_0xdfcb('0x24')](function(_0x206ee1){return _0x206ee1;});}return null;};}function removeEntity(_0x3e90f3,_0x52a572){return function(_0x31e168){if(_0x31e168){return _0x31e168[_0xdfcb('0x25')]()[_0xdfcb('0x24')](function(){var _0x4fa977=_0x31e168['get']({'plain':!![]});var _0x4de7f1=_0xdfcb('0x26');return db[_0xdfcb('0x27')][_0xdfcb('0x25')]({'where':{'type':_0x4de7f1,'resourceId':_0x4fa977['id']}})[_0xdfcb('0x24')](function(){return _0x31e168;});})[_0xdfcb('0x24')](function(){_0x3e90f3[_0xdfcb('0x1d')](0xcc)[_0xdfcb('0x1e')]();});}};}function handleEntityNotFound(_0xd59237,_0xcc70ee){return function(_0x3cca71){if(!_0x3cca71){_0xd59237[_0xdfcb('0x1c')](0x194);}return _0x3cca71;};}function handleError(_0x17de12,_0xb2ef1f){_0xb2ef1f=_0xb2ef1f||0x1f4;return function(_0x20cbcd){logger[_0xdfcb('0x28')](_0x20cbcd['stack']);if(_0x20cbcd[_0xdfcb('0x29')]){delete _0x20cbcd[_0xdfcb('0x29')];}_0x17de12[_0xdfcb('0x1d')](_0xb2ef1f)[_0xdfcb('0x2a')](_0x20cbcd);};}exports['index']=function(_0x241f11,_0x531918){var _0x57bc52={},_0x29ce66={},_0x28682c={'count':0x0,'rows':[]};var _0x629381=_[_0xdfcb('0x2b')](db['Trigger'][_0xdfcb('0x2c')],function(_0x5e2945){return{'name':_0x5e2945[_0xdfcb('0x2d')],'type':_0x5e2945['type'][_0xdfcb('0x2e')]};});_0x29ce66[_0xdfcb('0x2f')]=_[_0xdfcb('0x2b')](_0x629381,'name');_0x29ce66['query']=_[_0xdfcb('0x30')](_0x241f11[_0xdfcb('0x31')]);_0x29ce66[_0xdfcb('0x32')]=_[_0xdfcb('0x33')](_0x29ce66[_0xdfcb('0x2f')],_0x29ce66[_0xdfcb('0x31')]);_0x57bc52[_0xdfcb('0x34')]=_['intersection'](_0x29ce66[_0xdfcb('0x2f')],qs[_0xdfcb('0x35')](_0x241f11['query']['fields']));_0x57bc52[_0xdfcb('0x34')]=_0x57bc52[_0xdfcb('0x34')][_0xdfcb('0x36')]?_0x57bc52[_0xdfcb('0x34')]:_0x29ce66['model'];if(!_0x241f11['query'][_0xdfcb('0x37')]('nolimit')){_0x57bc52['limit']=qs['limit'](_0x241f11[_0xdfcb('0x31')][_0xdfcb('0x22')]);_0x57bc52['offset']=qs['offset'](_0x241f11['query'][_0xdfcb('0x21')]);}_0x57bc52[_0xdfcb('0x38')]=qs['sort'](_0x241f11['query']['sort']);_0x57bc52[_0xdfcb('0x39')]=qs[_0xdfcb('0x32')](_[_0xdfcb('0x3a')](_0x241f11[_0xdfcb('0x31')],_0x29ce66[_0xdfcb('0x32')]),_0x629381);if(_0x241f11[_0xdfcb('0x31')][_0xdfcb('0x3b')]){_0x57bc52['where']=_['merge'](_0x57bc52[_0xdfcb('0x39')],{'$or':_[_0xdfcb('0x2b')](_0x629381,function(_0x3634cc){if(_0x3634cc[_0xdfcb('0x3c')]!=='VIRTUAL'){var _0x293973={};_0x293973[_0x3634cc[_0xdfcb('0x29')]]={'$like':'%'+_0x241f11['query'][_0xdfcb('0x3b')]+'%'};return _0x293973;}})});}_0x57bc52=_[_0xdfcb('0x3d')]({},_0x57bc52,_0x241f11[_0xdfcb('0x3e')]);var _0x2f73af={'where':_0x57bc52['where']};return db[_0xdfcb('0x3f')][_0xdfcb('0x20')](_0x2f73af)[_0xdfcb('0x24')](function(_0x33c0db){_0x28682c['count']=_0x33c0db;if(_0x241f11[_0xdfcb('0x31')]['includeAll']){_0x57bc52[_0xdfcb('0x40')]=[{'all':!![]}];}return db[_0xdfcb('0x3f')][_0xdfcb('0x41')](_0x57bc52);})[_0xdfcb('0x24')](function(_0x294efb){_0x28682c[_0xdfcb('0x42')]=_0x294efb;return _0x28682c;})['then'](respondWithFilteredResult(_0x531918,_0x57bc52))['catch'](handleError(_0x531918,null));};exports['show']=function(_0x176ec5,_0x2c45b5){var _0x3abf85={'raw':![],'where':{'id':_0x176ec5[_0xdfcb('0x43')]['id']}},_0x1d36b0={};_0x1d36b0[_0xdfcb('0x2f')]=_[_0xdfcb('0x30')](db[_0xdfcb('0x3f')][_0xdfcb('0x2c')]);_0x1d36b0['query']=_[_0xdfcb('0x30')](_0x176ec5['query']);_0x1d36b0[_0xdfcb('0x32')]=_['intersection'](_0x1d36b0[_0xdfcb('0x2f')],_0x1d36b0['query']);_0x3abf85[_0xdfcb('0x34')]=_[_0xdfcb('0x33')](_0x1d36b0[_0xdfcb('0x2f')],qs['fields'](_0x176ec5[_0xdfcb('0x31')][_0xdfcb('0x35')]));_0x3abf85[_0xdfcb('0x34')]=_0x3abf85[_0xdfcb('0x34')][_0xdfcb('0x36')]?_0x3abf85['attributes']:_0x1d36b0[_0xdfcb('0x2f')];if(_0x176ec5['query'][_0xdfcb('0x44')]){_0x3abf85['include']=[{'all':!![]}];}_0x3abf85=_[_0xdfcb('0x3d')]({},_0x3abf85,_0x176ec5['options']);return db[_0xdfcb('0x3f')]['find'](_0x3abf85)['then'](handleEntityNotFound(_0x2c45b5,null))['then'](respondWithResult(_0x2c45b5,null))[_0xdfcb('0x45')](handleError(_0x2c45b5,null));};exports[_0xdfcb('0x46')]=function(_0x5831da,_0xf380c6){return db[_0xdfcb('0x3f')][_0xdfcb('0x46')](_0x5831da[_0xdfcb('0x47')],{})[_0xdfcb('0x24')](function(_0x14716d){var _0x5ae111=_0x5831da[_0xdfcb('0x48')]['get']({'plain':!![]});if(!_0x5ae111)throw new Error(_0xdfcb('0x49'));if(_0x5ae111['role']===_0xdfcb('0x48')){var _0x2de51c=_0x14716d[_0xdfcb('0x4a')]({'plain':!![]});var _0x51129a=_0xdfcb('0x26');return db[_0xdfcb('0x4b')][_0xdfcb('0x4c')]({'where':{'name':_0x51129a,'userProfileId':_0x5ae111[_0xdfcb('0x4d')]},'raw':!![]})[_0xdfcb('0x24')](function(_0x5c2176){if(_0x5c2176&&_0x5c2176[_0xdfcb('0x4e')]===0x0){return db[_0xdfcb('0x27')][_0xdfcb('0x46')]({'name':_0x2de51c['name'],'resourceId':_0x2de51c['id'],'type':_0x5c2176[_0xdfcb('0x29')],'sectionId':_0x5c2176['id']},{})[_0xdfcb('0x24')](function(){return _0x14716d;});}else{return _0x14716d;}})[_0xdfcb('0x45')](function(_0x5bb87c){logger[_0xdfcb('0x28')](_0xdfcb('0x4f'),_0x5bb87c);throw _0x5bb87c;});}return _0x14716d;})[_0xdfcb('0x24')](respondWithResult(_0xf380c6,0xc9))['catch'](handleError(_0xf380c6,null));};exports[_0xdfcb('0x50')]=function(_0x13b922,_0x55e1a9){if(_0x13b922[_0xdfcb('0x47')]['id']){delete _0x13b922[_0xdfcb('0x47')]['id'];}return db['Trigger'][_0xdfcb('0x4c')]({'where':{'id':_0x13b922['params']['id']}})[_0xdfcb('0x24')](handleEntityNotFound(_0x55e1a9,null))[_0xdfcb('0x24')](saveUpdates(_0x13b922[_0xdfcb('0x47')],null))[_0xdfcb('0x24')](respondWithResult(_0x55e1a9,null))[_0xdfcb('0x45')](handleError(_0x55e1a9,null));};exports[_0xdfcb('0x25')]=function(_0x9f88ea,_0x1fe021){return db[_0xdfcb('0x3f')][_0xdfcb('0x4c')]({'where':{'id':_0x9f88ea['params']['id']}})[_0xdfcb('0x24')](handleEntityNotFound(_0x1fe021,null))[_0xdfcb('0x24')](removeEntity(_0x1fe021,null))['catch'](handleError(_0x1fe021,null));};exports[_0xdfcb('0x51')]=function(_0xea12af,_0x4badac,_0x1d8719){if(_0xea12af[_0xdfcb('0x47')]['id']){delete _0xea12af[_0xdfcb('0x47')]['id'];}return db[_0xdfcb('0x3f')]['find']({'where':{'id':_0xea12af[_0xdfcb('0x43')]['id']}})['then'](handleEntityNotFound(_0x4badac,null))[_0xdfcb('0x24')](function(_0x72390f){if(_0x72390f){_0xea12af[_0xdfcb('0x47')]['TriggerAllId']=_0x72390f['id'];return db[_0xdfcb('0x52')][_0xdfcb('0x46')](_0xea12af[_0xdfcb('0x47')]);}})[_0xdfcb('0x24')](respondWithResult(_0x4badac,null))[_0xdfcb('0x45')](handleError(_0x4badac,null));};exports[_0xdfcb('0x53')]=function(_0x59b218,_0x2f41c2,_0x26e5ab){if(_0x59b218[_0xdfcb('0x47')]['id']){delete _0x59b218[_0xdfcb('0x47')]['id'];}return db[_0xdfcb('0x3f')][_0xdfcb('0x4c')]({'where':{'id':_0x59b218[_0xdfcb('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f41c2,null))[_0xdfcb('0x24')](function(_0x5a317b){if(_0x5a317b){_0x59b218[_0xdfcb('0x47')]['TriggerAnyId']=_0x5a317b['id'];return db['Condition'][_0xdfcb('0x46')](_0x59b218['body']);}})['then'](respondWithResult(_0x2f41c2,null))[_0xdfcb('0x45')](handleError(_0x2f41c2,null));};exports[_0xdfcb('0x54')]=function(_0x2b6af7,_0x137030,_0x2361b3){var _0x5c073d={};var _0x1b6fcd={};var _0x11346e;var _0x437e7d;return db[_0xdfcb('0x3f')][_0xdfcb('0x55')]({'where':{'id':_0x2b6af7['params']['id']}})[_0xdfcb('0x24')](handleEntityNotFound(_0x137030,null))['then'](function(_0x3b6cb8){if(_0x3b6cb8){_0x11346e=_0x3b6cb8;_0x1b6fcd[_0xdfcb('0x2f')]=_[_0xdfcb('0x30')](db[_0xdfcb('0x52')]['rawAttributes']);_0x1b6fcd[_0xdfcb('0x31')]=_['keys'](_0x2b6af7[_0xdfcb('0x31')]);_0x1b6fcd['filters']=_[_0xdfcb('0x33')](_0x1b6fcd[_0xdfcb('0x2f')],_0x1b6fcd[_0xdfcb('0x31')]);_0x5c073d['attributes']=_['intersection'](_0x1b6fcd['model'],qs[_0xdfcb('0x35')](_0x2b6af7['query'][_0xdfcb('0x35')]));_0x5c073d[_0xdfcb('0x34')]=_0x5c073d[_0xdfcb('0x34')][_0xdfcb('0x36')]?_0x5c073d[_0xdfcb('0x34')]:_0x1b6fcd[_0xdfcb('0x2f')];_0x5c073d['order']=qs['sort'](_0x2b6af7['query'][_0xdfcb('0x56')]);_0x5c073d[_0xdfcb('0x39')]=qs[_0xdfcb('0x32')](_[_0xdfcb('0x3a')](_0x2b6af7['query'],_0x1b6fcd[_0xdfcb('0x32')]));if(_0x2b6af7[_0xdfcb('0x31')][_0xdfcb('0x3b')]){_0x5c073d[_0xdfcb('0x39')]=_[_0xdfcb('0x3d')](_0x5c073d[_0xdfcb('0x39')],{'$or':_[_0xdfcb('0x2b')](_0x5c073d[_0xdfcb('0x34')],function(_0x300337){var _0x2a2d15={};_0x2a2d15[_0x300337]={'$like':'%'+_0x2b6af7[_0xdfcb('0x31')][_0xdfcb('0x3b')]+'%'};return _0x2a2d15;})});}_0x5c073d=_['merge']({},_0x5c073d,_0x2b6af7[_0xdfcb('0x3e')]);return _0x11346e[_0xdfcb('0x54')](_0x5c073d);}})[_0xdfcb('0x24')](function(_0xf539fd){if(_0xf539fd){_0x437e7d=_0xf539fd[_0xdfcb('0x36')];if(!_0x2b6af7[_0xdfcb('0x31')][_0xdfcb('0x37')](_0xdfcb('0x57'))){_0x5c073d[_0xdfcb('0x22')]=qs[_0xdfcb('0x22')](_0x2b6af7[_0xdfcb('0x31')][_0xdfcb('0x22')]);_0x5c073d[_0xdfcb('0x21')]=qs[_0xdfcb('0x21')](_0x2b6af7[_0xdfcb('0x31')][_0xdfcb('0x21')]);}return _0x11346e[_0xdfcb('0x54')](_0x5c073d);}})[_0xdfcb('0x24')](function(_0x52651f){if(_0x52651f){return _0x52651f?{'count':_0x437e7d,'rows':_0x52651f}:null;}})[_0xdfcb('0x24')](respondWithResult(_0x137030,null))[_0xdfcb('0x45')](handleError(_0x137030,null));};exports[_0xdfcb('0x58')]=function(_0xf4175e,_0x29c2d4,_0x24808c){var _0x2f5f65={};var _0x47ff09={};var _0x3fc3b0;var _0x2d2f36;return db[_0xdfcb('0x3f')]['findOne']({'where':{'id':_0xf4175e[_0xdfcb('0x43')]['id']}})[_0xdfcb('0x24')](handleEntityNotFound(_0x29c2d4,null))[_0xdfcb('0x24')](function(_0x4c808f){if(_0x4c808f){_0x3fc3b0=_0x4c808f;_0x47ff09[_0xdfcb('0x2f')]=_['keys'](db['Condition'][_0xdfcb('0x2c')]);_0x47ff09[_0xdfcb('0x31')]=_[_0xdfcb('0x30')](_0xf4175e[_0xdfcb('0x31')]);_0x47ff09[_0xdfcb('0x32')]=_[_0xdfcb('0x33')](_0x47ff09['model'],_0x47ff09[_0xdfcb('0x31')]);_0x2f5f65['attributes']=_['intersection'](_0x47ff09['model'],qs[_0xdfcb('0x35')](_0xf4175e[_0xdfcb('0x31')]['fields']));_0x2f5f65[_0xdfcb('0x34')]=_0x2f5f65['attributes']['length']?_0x2f5f65['attributes']:_0x47ff09[_0xdfcb('0x2f')];_0x2f5f65['order']=qs['sort'](_0xf4175e['query']['sort']);_0x2f5f65[_0xdfcb('0x39')]=qs[_0xdfcb('0x32')](_[_0xdfcb('0x3a')](_0xf4175e[_0xdfcb('0x31')],_0x47ff09['filters']));if(_0xf4175e[_0xdfcb('0x31')][_0xdfcb('0x3b')]){_0x2f5f65[_0xdfcb('0x39')]=_[_0xdfcb('0x3d')](_0x2f5f65[_0xdfcb('0x39')],{'$or':_[_0xdfcb('0x2b')](_0x2f5f65['attributes'],function(_0x4e9326){var _0x523a59={};_0x523a59[_0x4e9326]={'$like':'%'+_0xf4175e[_0xdfcb('0x31')][_0xdfcb('0x3b')]+'%'};return _0x523a59;})});}_0x2f5f65=_[_0xdfcb('0x3d')]({},_0x2f5f65,_0xf4175e['options']);return _0x3fc3b0[_0xdfcb('0x58')](_0x2f5f65);}})[_0xdfcb('0x24')](function(_0xf359cc){if(_0xf359cc){_0x2d2f36=_0xf359cc[_0xdfcb('0x36')];if(!_0xf4175e[_0xdfcb('0x31')][_0xdfcb('0x37')]('nolimit')){_0x2f5f65[_0xdfcb('0x22')]=qs['limit'](_0xf4175e['query'][_0xdfcb('0x22')]);_0x2f5f65[_0xdfcb('0x21')]=qs[_0xdfcb('0x21')](_0xf4175e[_0xdfcb('0x31')][_0xdfcb('0x21')]);}return _0x3fc3b0[_0xdfcb('0x58')](_0x2f5f65);}})[_0xdfcb('0x24')](function(_0x191223){if(_0x191223){return _0x191223?{'count':_0x2d2f36,'rows':_0x191223}:null;}})['then'](respondWithResult(_0x29c2d4,null))['catch'](handleError(_0x29c2d4,null));};exports['addAction']=function(_0x10310f,_0x353a36,_0x50b139){if(_0x10310f[_0xdfcb('0x47')]['id']){delete _0x10310f[_0xdfcb('0x47')]['id'];}return db['Trigger']['find']({'where':{'id':_0x10310f[_0xdfcb('0x43')]['id']}})[_0xdfcb('0x24')](handleEntityNotFound(_0x353a36,null))[_0xdfcb('0x24')](function(_0x4bb934){if(_0x4bb934){_0x10310f[_0xdfcb('0x47')][_0xdfcb('0x59')]=_0x4bb934['id'];return db['Action'][_0xdfcb('0x46')](_0x10310f[_0xdfcb('0x47')]);}})[_0xdfcb('0x24')](respondWithResult(_0x353a36,null))[_0xdfcb('0x45')](handleError(_0x353a36,null));};exports[_0xdfcb('0x5a')]=function(_0x17c33d,_0x102b07,_0x1b3c38){var _0x5e2499={};var _0x3e8a01={};var _0x1cb735;var _0x78ee20;return db['Trigger']['findOne']({'where':{'id':_0x17c33d[_0xdfcb('0x43')]['id']}})[_0xdfcb('0x24')](handleEntityNotFound(_0x102b07,null))[_0xdfcb('0x24')](function(_0x11ed12){if(_0x11ed12){_0x1cb735=_0x11ed12;_0x3e8a01['model']=_[_0xdfcb('0x30')](db[_0xdfcb('0x5b')]['rawAttributes']);_0x3e8a01['query']=_['keys'](_0x17c33d['query']);_0x3e8a01['filters']=_['intersection'](_0x3e8a01['model'],_0x3e8a01[_0xdfcb('0x31')]);_0x5e2499[_0xdfcb('0x34')]=_[_0xdfcb('0x33')](_0x3e8a01['model'],qs[_0xdfcb('0x35')](_0x17c33d[_0xdfcb('0x31')][_0xdfcb('0x35')]));_0x5e2499['attributes']=_0x5e2499[_0xdfcb('0x34')][_0xdfcb('0x36')]?_0x5e2499[_0xdfcb('0x34')]:_0x3e8a01[_0xdfcb('0x2f')];_0x5e2499[_0xdfcb('0x38')]=qs[_0xdfcb('0x56')](_0x17c33d[_0xdfcb('0x31')][_0xdfcb('0x56')]);_0x5e2499['where']=qs[_0xdfcb('0x32')](_[_0xdfcb('0x3a')](_0x17c33d[_0xdfcb('0x31')],_0x3e8a01[_0xdfcb('0x32')]));if(_0x17c33d[_0xdfcb('0x31')][_0xdfcb('0x3b')]){_0x5e2499[_0xdfcb('0x39')]=_['merge'](_0x5e2499['where'],{'$or':_[_0xdfcb('0x2b')](_0x5e2499[_0xdfcb('0x34')],function(_0x1123ec){var _0x6b9109={};_0x6b9109[_0x1123ec]={'$like':'%'+_0x17c33d['query'][_0xdfcb('0x3b')]+'%'};return _0x6b9109;})});}_0x5e2499=_[_0xdfcb('0x3d')]({},_0x5e2499,_0x17c33d[_0xdfcb('0x3e')]);return _0x1cb735['getActions'](_0x5e2499);}})[_0xdfcb('0x24')](function(_0x4f2b4b){if(_0x4f2b4b){_0x78ee20=_0x4f2b4b[_0xdfcb('0x36')];if(!_0x17c33d['query'][_0xdfcb('0x37')](_0xdfcb('0x57'))){_0x5e2499[_0xdfcb('0x22')]=qs['limit'](_0x17c33d[_0xdfcb('0x31')][_0xdfcb('0x22')]);_0x5e2499['offset']=qs['offset'](_0x17c33d['query'][_0xdfcb('0x21')]);}return _0x1cb735[_0xdfcb('0x5a')](_0x5e2499);}})['then'](function(_0x1ad126){if(_0x1ad126){return _0x1ad126?{'count':_0x78ee20,'rows':_0x1ad126}:null;}})[_0xdfcb('0x24')](respondWithResult(_0x102b07,null))['catch'](handleError(_0x102b07,null));}; \ No newline at end of file +var _0x80ce=['ejs','lodash','squel','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','offset','set','apply','reject','save','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','sort','where','filters','merge','VIRTUAL','filter','Trigger','count','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','order','pick','options','getAnyConditions','addAction','TriggerId','Action','getActions','hasOwnProperty','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv'];(function(_0x197853,_0x24487b){var _0x1cbb30=function(_0x53bab3){while(--_0x53bab3){_0x197853['push'](_0x197853['shift']());}};_0x1cbb30(++_0x24487b);}(_0x80ce,0xae));var _0xe80c=function(_0x11cc87,_0xd1147a){_0x11cc87=_0x11cc87-0x0;var _0x531edd=_0x80ce[_0x11cc87];return _0x531edd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe80c('0x0'));var jsonpatch=require(_0xe80c('0x1'));var rp=require('request-promise');var moment=require(_0xe80c('0x2'));var BPromise=require(_0xe80c('0x3'));var Mustache=require(_0xe80c('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe80c('0x5'));var ejs=require(_0xe80c('0x6'));var fs=require('fs');var _=require(_0xe80c('0x7'));var squel=require(_0xe80c('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe80c('0x9'));var toCsv=require(_0xe80c('0x5'));var querystring=require('querystring');var Papa=require(_0xe80c('0xa'));var Redis=require(_0xe80c('0xb'));var authService=require(_0xe80c('0xc'));var qs=require(_0xe80c('0xd'));var as=require(_0xe80c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe80c('0xf'));var config=require(_0xe80c('0x10'));var licenseUtil=require(_0xe80c('0x11'));var db=require(_0xe80c('0x12'))['db'];function respondWithStatusCode(_0xfc0809,_0x3cd7ba){_0x3cd7ba=_0x3cd7ba||0xcc;return function(_0xefba08){if(_0xefba08){return _0xfc0809[_0xe80c('0x13')](_0x3cd7ba);}return _0xfc0809[_0xe80c('0x14')](_0x3cd7ba)[_0xe80c('0x15')]();};}function respondWithResult(_0x185a51,_0x46f217){_0x46f217=_0x46f217||0xc8;return function(_0x24bbd2){if(_0x24bbd2){return _0x185a51['status'](_0x46f217)[_0xe80c('0x16')](_0x24bbd2);}};}function respondWithFilteredResult(_0x52801b,_0x451535){return function(_0x2a118e){if(_0x2a118e){var _0x100606=_0x2a118e['count'],_0x532e00=_0x451535[_0xe80c('0x17')],_0x6ff463=_0x451535[_0xe80c('0x17')]+_0x451535['limit'],_0x35d108;if(_0x6ff463>=_0x100606){_0x6ff463=_0x100606;_0x35d108=0xc8;}else{_0x35d108=0xce;}_0x52801b[_0xe80c('0x14')](_0x35d108);return _0x52801b[_0xe80c('0x18')]('Content-Range',_0x532e00+'-'+_0x6ff463+'/'+_0x100606)['json'](_0x2a118e);}return null;};}function patchUpdates(_0x1ba731){return function(_0x752469){try{jsonpatch[_0xe80c('0x19')](_0x752469,_0x1ba731,!![]);}catch(_0xdc8b26){return BPromise[_0xe80c('0x1a')](_0xdc8b26);}return _0x752469[_0xe80c('0x1b')]();};}function saveUpdates(_0x534471,_0x5da513){return function(_0x5417c4){if(_0x5417c4){return _0x5417c4['update'](_0x534471)[_0xe80c('0x1c')](function(_0x5078f8){return _0x5078f8;});}return null;};}function removeEntity(_0x39996f,_0x3efad0){return function(_0x3e6058){if(_0x3e6058){return _0x3e6058[_0xe80c('0x1d')]()[_0xe80c('0x1c')](function(){var _0x3fd5ba=_0x3e6058[_0xe80c('0x1e')]({'plain':!![]});var _0x360d8b=_0xe80c('0x1f');return db[_0xe80c('0x20')][_0xe80c('0x1d')]({'where':{'type':_0x360d8b,'resourceId':_0x3fd5ba['id']}})[_0xe80c('0x1c')](function(){return _0x3e6058;});})['then'](function(){_0x39996f[_0xe80c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31e778,_0x4ef883){return function(_0x270ded){if(!_0x270ded){_0x31e778['sendStatus'](0x194);}return _0x270ded;};}function handleError(_0x468875,_0x43f290){_0x43f290=_0x43f290||0x1f4;return function(_0x54595d){logger[_0xe80c('0x21')](_0x54595d[_0xe80c('0x22')]);if(_0x54595d[_0xe80c('0x23')]){delete _0x54595d[_0xe80c('0x23')];}_0x468875[_0xe80c('0x14')](_0x43f290)[_0xe80c('0x24')](_0x54595d);};}exports[_0xe80c('0x25')]=function(_0x2936bf,_0x1e1b23){var _0x5bb254={},_0x415690={},_0x460cef={'count':0x0,'rows':[]};var _0x512c94=_[_0xe80c('0x26')](db['Trigger'][_0xe80c('0x27')],function(_0x3be1d2){return{'name':_0x3be1d2[_0xe80c('0x28')],'type':_0x3be1d2[_0xe80c('0x29')][_0xe80c('0x2a')]};});_0x415690[_0xe80c('0x2b')]=_[_0xe80c('0x26')](_0x512c94,_0xe80c('0x23'));_0x415690[_0xe80c('0x2c')]=_['keys'](_0x2936bf['query']);_0x415690['filters']=_[_0xe80c('0x2d')](_0x415690[_0xe80c('0x2b')],_0x415690[_0xe80c('0x2c')]);_0x5bb254[_0xe80c('0x2e')]=_[_0xe80c('0x2d')](_0x415690['model'],qs[_0xe80c('0x2f')](_0x2936bf['query']['fields']));_0x5bb254[_0xe80c('0x2e')]=_0x5bb254[_0xe80c('0x2e')][_0xe80c('0x30')]?_0x5bb254[_0xe80c('0x2e')]:_0x415690[_0xe80c('0x2b')];if(!_0x2936bf[_0xe80c('0x2c')]['hasOwnProperty'](_0xe80c('0x31'))){_0x5bb254[_0xe80c('0x32')]=qs[_0xe80c('0x32')](_0x2936bf[_0xe80c('0x2c')][_0xe80c('0x32')]);_0x5bb254[_0xe80c('0x17')]=qs[_0xe80c('0x17')](_0x2936bf[_0xe80c('0x2c')][_0xe80c('0x17')]);}_0x5bb254['order']=qs['sort'](_0x2936bf['query'][_0xe80c('0x33')]);_0x5bb254[_0xe80c('0x34')]=qs[_0xe80c('0x35')](_['pick'](_0x2936bf[_0xe80c('0x2c')],_0x415690[_0xe80c('0x35')]),_0x512c94);if(_0x2936bf[_0xe80c('0x2c')]['filter']){_0x5bb254[_0xe80c('0x34')]=_[_0xe80c('0x36')](_0x5bb254[_0xe80c('0x34')],{'$or':_[_0xe80c('0x26')](_0x512c94,function(_0x2e22b0){if(_0x2e22b0[_0xe80c('0x29')]!==_0xe80c('0x37')){var _0xbfeb3d={};_0xbfeb3d[_0x2e22b0['name']]={'$like':'%'+_0x2936bf[_0xe80c('0x2c')][_0xe80c('0x38')]+'%'};return _0xbfeb3d;}})});}_0x5bb254=_[_0xe80c('0x36')]({},_0x5bb254,_0x2936bf['options']);var _0x5b628e={'where':_0x5bb254[_0xe80c('0x34')]};return db[_0xe80c('0x39')]['count'](_0x5b628e)[_0xe80c('0x1c')](function(_0x1e9dff){_0x460cef[_0xe80c('0x3a')]=_0x1e9dff;if(_0x2936bf['query'][_0xe80c('0x3b')]){_0x5bb254[_0xe80c('0x3c')]=[{'all':!![]}];}return db[_0xe80c('0x39')][_0xe80c('0x3d')](_0x5bb254);})[_0xe80c('0x1c')](function(_0x17d0e6){_0x460cef[_0xe80c('0x3e')]=_0x17d0e6;return _0x460cef;})['then'](respondWithFilteredResult(_0x1e1b23,_0x5bb254))['catch'](handleError(_0x1e1b23,null));};exports[_0xe80c('0x3f')]=function(_0x90219d,_0xef04bf){var _0x1bd916={'raw':![],'where':{'id':_0x90219d[_0xe80c('0x40')]['id']}},_0x41cc60={};_0x41cc60['model']=_[_0xe80c('0x41')](db[_0xe80c('0x39')]['rawAttributes']);_0x41cc60['query']=_[_0xe80c('0x41')](_0x90219d[_0xe80c('0x2c')]);_0x41cc60[_0xe80c('0x35')]=_['intersection'](_0x41cc60['model'],_0x41cc60[_0xe80c('0x2c')]);_0x1bd916[_0xe80c('0x2e')]=_[_0xe80c('0x2d')](_0x41cc60[_0xe80c('0x2b')],qs[_0xe80c('0x2f')](_0x90219d['query']['fields']));_0x1bd916[_0xe80c('0x2e')]=_0x1bd916[_0xe80c('0x2e')]['length']?_0x1bd916['attributes']:_0x41cc60[_0xe80c('0x2b')];if(_0x90219d[_0xe80c('0x2c')][_0xe80c('0x3b')]){_0x1bd916[_0xe80c('0x3c')]=[{'all':!![]}];}_0x1bd916=_[_0xe80c('0x36')]({},_0x1bd916,_0x90219d['options']);return db[_0xe80c('0x39')][_0xe80c('0x42')](_0x1bd916)[_0xe80c('0x1c')](handleEntityNotFound(_0xef04bf,null))[_0xe80c('0x1c')](respondWithResult(_0xef04bf,null))[_0xe80c('0x43')](handleError(_0xef04bf,null));};exports[_0xe80c('0x44')]=function(_0x4ddf5c,_0x28013f){return db[_0xe80c('0x39')][_0xe80c('0x44')](_0x4ddf5c['body'],{})[_0xe80c('0x1c')](function(_0x2dde4d){var _0x4e6d7e=_0x4ddf5c[_0xe80c('0x45')][_0xe80c('0x1e')]({'plain':!![]});if(!_0x4e6d7e)throw new Error(_0xe80c('0x46'));if(_0x4e6d7e[_0xe80c('0x47')]===_0xe80c('0x45')){var _0x3dc0b1=_0x2dde4d[_0xe80c('0x1e')]({'plain':!![]});var _0x50bee9=_0xe80c('0x1f');return db[_0xe80c('0x48')][_0xe80c('0x42')]({'where':{'name':_0x50bee9,'userProfileId':_0x4e6d7e[_0xe80c('0x49')]},'raw':!![]})[_0xe80c('0x1c')](function(_0x5e1b32){if(_0x5e1b32&&_0x5e1b32[_0xe80c('0x4a')]===0x0){return db[_0xe80c('0x20')][_0xe80c('0x44')]({'name':_0x3dc0b1[_0xe80c('0x23')],'resourceId':_0x3dc0b1['id'],'type':_0x5e1b32[_0xe80c('0x23')],'sectionId':_0x5e1b32['id']},{})['then'](function(){return _0x2dde4d;});}else{return _0x2dde4d;}})[_0xe80c('0x43')](function(_0x192b7f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x192b7f);throw _0x192b7f;});}return _0x2dde4d;})[_0xe80c('0x1c')](respondWithResult(_0x28013f,0xc9))[_0xe80c('0x43')](handleError(_0x28013f,null));};exports['update']=function(_0x5088ef,_0x376cc4){if(_0x5088ef['body']['id']){delete _0x5088ef[_0xe80c('0x4b')]['id'];}return db[_0xe80c('0x39')][_0xe80c('0x42')]({'where':{'id':_0x5088ef['params']['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x376cc4,null))['then'](saveUpdates(_0x5088ef['body'],null))[_0xe80c('0x1c')](respondWithResult(_0x376cc4,null))[_0xe80c('0x43')](handleError(_0x376cc4,null));};exports[_0xe80c('0x1d')]=function(_0xa54742,_0x3e4ce2){return db[_0xe80c('0x39')][_0xe80c('0x42')]({'where':{'id':_0xa54742[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x3e4ce2,null))[_0xe80c('0x1c')](removeEntity(_0x3e4ce2,null))[_0xe80c('0x43')](handleError(_0x3e4ce2,null));};exports[_0xe80c('0x4c')]=function(_0x29518a,_0x475e32,_0x12bcf5){if(_0x29518a[_0xe80c('0x4b')]['id']){delete _0x29518a[_0xe80c('0x4b')]['id'];}return db[_0xe80c('0x39')][_0xe80c('0x42')]({'where':{'id':_0x29518a[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x475e32,null))[_0xe80c('0x1c')](function(_0x3be7f1){if(_0x3be7f1){_0x29518a[_0xe80c('0x4b')]['TriggerAllId']=_0x3be7f1['id'];return db[_0xe80c('0x4d')][_0xe80c('0x44')](_0x29518a[_0xe80c('0x4b')]);}})['then'](respondWithResult(_0x475e32,null))['catch'](handleError(_0x475e32,null));};exports[_0xe80c('0x4e')]=function(_0x4e6c95,_0x303603,_0x3d5e5e){if(_0x4e6c95[_0xe80c('0x4b')]['id']){delete _0x4e6c95[_0xe80c('0x4b')]['id'];}return db[_0xe80c('0x39')][_0xe80c('0x42')]({'where':{'id':_0x4e6c95[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x303603,null))['then'](function(_0x34d843){if(_0x34d843){_0x4e6c95['body']['TriggerAnyId']=_0x34d843['id'];return db[_0xe80c('0x4d')][_0xe80c('0x44')](_0x4e6c95[_0xe80c('0x4b')]);}})[_0xe80c('0x1c')](respondWithResult(_0x303603,null))[_0xe80c('0x43')](handleError(_0x303603,null));};exports[_0xe80c('0x4f')]=function(_0x13b623,_0x4a920f,_0x515876){var _0x554401={};var _0x5ddab3={};var _0x15c541;var _0x5d46b9;return db[_0xe80c('0x39')][_0xe80c('0x50')]({'where':{'id':_0x13b623[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x4a920f,null))[_0xe80c('0x1c')](function(_0x100418){if(_0x100418){_0x15c541=_0x100418;_0x5ddab3[_0xe80c('0x2b')]=_['keys'](db[_0xe80c('0x4d')][_0xe80c('0x27')]);_0x5ddab3[_0xe80c('0x2c')]=_[_0xe80c('0x41')](_0x13b623[_0xe80c('0x2c')]);_0x5ddab3[_0xe80c('0x35')]=_['intersection'](_0x5ddab3['model'],_0x5ddab3['query']);_0x554401['attributes']=_[_0xe80c('0x2d')](_0x5ddab3[_0xe80c('0x2b')],qs['fields'](_0x13b623[_0xe80c('0x2c')][_0xe80c('0x2f')]));_0x554401['attributes']=_0x554401['attributes'][_0xe80c('0x30')]?_0x554401['attributes']:_0x5ddab3[_0xe80c('0x2b')];_0x554401[_0xe80c('0x51')]=qs['sort'](_0x13b623['query']['sort']);_0x554401['where']=qs[_0xe80c('0x35')](_[_0xe80c('0x52')](_0x13b623[_0xe80c('0x2c')],_0x5ddab3[_0xe80c('0x35')]));if(_0x13b623[_0xe80c('0x2c')][_0xe80c('0x38')]){_0x554401[_0xe80c('0x34')]=_[_0xe80c('0x36')](_0x554401[_0xe80c('0x34')],{'$or':_['map'](_0x554401[_0xe80c('0x2e')],function(_0x183d9f){var _0x3e3e32={};_0x3e3e32[_0x183d9f]={'$like':'%'+_0x13b623[_0xe80c('0x2c')]['filter']+'%'};return _0x3e3e32;})});}_0x554401=_[_0xe80c('0x36')]({},_0x554401,_0x13b623[_0xe80c('0x53')]);return _0x15c541[_0xe80c('0x4f')](_0x554401);}})[_0xe80c('0x1c')](function(_0x584c65){if(_0x584c65){_0x5d46b9=_0x584c65[_0xe80c('0x30')];if(!_0x13b623[_0xe80c('0x2c')]['hasOwnProperty'](_0xe80c('0x31'))){_0x554401[_0xe80c('0x32')]=qs[_0xe80c('0x32')](_0x13b623[_0xe80c('0x2c')][_0xe80c('0x32')]);_0x554401[_0xe80c('0x17')]=qs[_0xe80c('0x17')](_0x13b623[_0xe80c('0x2c')][_0xe80c('0x17')]);}return _0x15c541[_0xe80c('0x4f')](_0x554401);}})[_0xe80c('0x1c')](function(_0x31efbc){if(_0x31efbc){return _0x31efbc?{'count':_0x5d46b9,'rows':_0x31efbc}:null;}})['then'](respondWithResult(_0x4a920f,null))[_0xe80c('0x43')](handleError(_0x4a920f,null));};exports[_0xe80c('0x54')]=function(_0x7bd4c4,_0x3bc71b,_0x2ca24e){var _0x550d71={};var _0x26e58c={};var _0x28b5b7;var _0x50ae66;return db[_0xe80c('0x39')]['findOne']({'where':{'id':_0x7bd4c4[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x3bc71b,null))[_0xe80c('0x1c')](function(_0x4acb25){if(_0x4acb25){_0x28b5b7=_0x4acb25;_0x26e58c['model']=_[_0xe80c('0x41')](db[_0xe80c('0x4d')][_0xe80c('0x27')]);_0x26e58c[_0xe80c('0x2c')]=_[_0xe80c('0x41')](_0x7bd4c4[_0xe80c('0x2c')]);_0x26e58c[_0xe80c('0x35')]=_[_0xe80c('0x2d')](_0x26e58c[_0xe80c('0x2b')],_0x26e58c[_0xe80c('0x2c')]);_0x550d71[_0xe80c('0x2e')]=_[_0xe80c('0x2d')](_0x26e58c[_0xe80c('0x2b')],qs[_0xe80c('0x2f')](_0x7bd4c4['query']['fields']));_0x550d71[_0xe80c('0x2e')]=_0x550d71['attributes'][_0xe80c('0x30')]?_0x550d71[_0xe80c('0x2e')]:_0x26e58c[_0xe80c('0x2b')];_0x550d71[_0xe80c('0x51')]=qs[_0xe80c('0x33')](_0x7bd4c4[_0xe80c('0x2c')]['sort']);_0x550d71['where']=qs['filters'](_['pick'](_0x7bd4c4[_0xe80c('0x2c')],_0x26e58c[_0xe80c('0x35')]));if(_0x7bd4c4[_0xe80c('0x2c')][_0xe80c('0x38')]){_0x550d71[_0xe80c('0x34')]=_[_0xe80c('0x36')](_0x550d71[_0xe80c('0x34')],{'$or':_['map'](_0x550d71[_0xe80c('0x2e')],function(_0xfcd2fc){var _0x3e103a={};_0x3e103a[_0xfcd2fc]={'$like':'%'+_0x7bd4c4[_0xe80c('0x2c')][_0xe80c('0x38')]+'%'};return _0x3e103a;})});}_0x550d71=_['merge']({},_0x550d71,_0x7bd4c4[_0xe80c('0x53')]);return _0x28b5b7[_0xe80c('0x54')](_0x550d71);}})['then'](function(_0x40d4a8){if(_0x40d4a8){_0x50ae66=_0x40d4a8[_0xe80c('0x30')];if(!_0x7bd4c4[_0xe80c('0x2c')]['hasOwnProperty'](_0xe80c('0x31'))){_0x550d71[_0xe80c('0x32')]=qs[_0xe80c('0x32')](_0x7bd4c4[_0xe80c('0x2c')]['limit']);_0x550d71[_0xe80c('0x17')]=qs[_0xe80c('0x17')](_0x7bd4c4[_0xe80c('0x2c')]['offset']);}return _0x28b5b7[_0xe80c('0x54')](_0x550d71);}})['then'](function(_0xa7f199){if(_0xa7f199){return _0xa7f199?{'count':_0x50ae66,'rows':_0xa7f199}:null;}})['then'](respondWithResult(_0x3bc71b,null))[_0xe80c('0x43')](handleError(_0x3bc71b,null));};exports[_0xe80c('0x55')]=function(_0x419e48,_0x80fe71,_0x1542bc){if(_0x419e48[_0xe80c('0x4b')]['id']){delete _0x419e48[_0xe80c('0x4b')]['id'];}return db['Trigger'][_0xe80c('0x42')]({'where':{'id':_0x419e48[_0xe80c('0x40')]['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0x80fe71,null))['then'](function(_0x48e26f){if(_0x48e26f){_0x419e48[_0xe80c('0x4b')][_0xe80c('0x56')]=_0x48e26f['id'];return db[_0xe80c('0x57')][_0xe80c('0x44')](_0x419e48['body']);}})[_0xe80c('0x1c')](respondWithResult(_0x80fe71,null))[_0xe80c('0x43')](handleError(_0x80fe71,null));};exports[_0xe80c('0x58')]=function(_0x24b2a9,_0xaf2bca,_0x4a32d7){var _0x3daf19={};var _0x4713ce={};var _0x236bad;var _0x44397b;return db['Trigger'][_0xe80c('0x50')]({'where':{'id':_0x24b2a9['params']['id']}})[_0xe80c('0x1c')](handleEntityNotFound(_0xaf2bca,null))[_0xe80c('0x1c')](function(_0x18cdd2){if(_0x18cdd2){_0x236bad=_0x18cdd2;_0x4713ce['model']=_[_0xe80c('0x41')](db[_0xe80c('0x57')]['rawAttributes']);_0x4713ce[_0xe80c('0x2c')]=_[_0xe80c('0x41')](_0x24b2a9[_0xe80c('0x2c')]);_0x4713ce[_0xe80c('0x35')]=_[_0xe80c('0x2d')](_0x4713ce[_0xe80c('0x2b')],_0x4713ce[_0xe80c('0x2c')]);_0x3daf19[_0xe80c('0x2e')]=_[_0xe80c('0x2d')](_0x4713ce['model'],qs[_0xe80c('0x2f')](_0x24b2a9['query']['fields']));_0x3daf19['attributes']=_0x3daf19[_0xe80c('0x2e')][_0xe80c('0x30')]?_0x3daf19[_0xe80c('0x2e')]:_0x4713ce[_0xe80c('0x2b')];_0x3daf19[_0xe80c('0x51')]=qs[_0xe80c('0x33')](_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x33')]);_0x3daf19[_0xe80c('0x34')]=qs['filters'](_[_0xe80c('0x52')](_0x24b2a9[_0xe80c('0x2c')],_0x4713ce[_0xe80c('0x35')]));if(_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x38')]){_0x3daf19[_0xe80c('0x34')]=_[_0xe80c('0x36')](_0x3daf19['where'],{'$or':_[_0xe80c('0x26')](_0x3daf19['attributes'],function(_0x6e1d81){var _0x347f87={};_0x347f87[_0x6e1d81]={'$like':'%'+_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x38')]+'%'};return _0x347f87;})});}_0x3daf19=_[_0xe80c('0x36')]({},_0x3daf19,_0x24b2a9[_0xe80c('0x53')]);return _0x236bad[_0xe80c('0x58')](_0x3daf19);}})[_0xe80c('0x1c')](function(_0x4caa8c){if(_0x4caa8c){_0x44397b=_0x4caa8c[_0xe80c('0x30')];if(!_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x59')](_0xe80c('0x31'))){_0x3daf19['limit']=qs['limit'](_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x32')]);_0x3daf19['offset']=qs[_0xe80c('0x17')](_0x24b2a9[_0xe80c('0x2c')][_0xe80c('0x17')]);}return _0x236bad[_0xe80c('0x58')](_0x3daf19);}})[_0xe80c('0x1c')](function(_0x329c88){if(_0x329c88){return _0x329c88?{'count':_0x44397b,'rows':_0x329c88}:null;}})[_0xe80c('0x1c')](respondWithResult(_0xaf2bca,null))['catch'](handleError(_0xaf2bca,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 6106025..f1864c5 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 _0x58d0=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','Trigger','tools_triggers','lodash'];(function(_0x22f72e,_0x54cdad){var _0x56c4bf=function(_0x1979ec){while(--_0x1979ec){_0x22f72e['push'](_0x22f72e['shift']());}};_0x56c4bf(++_0x54cdad);}(_0x58d0,0xd0));var _0x058d=function(_0x100dc5,_0xc853e9){_0x100dc5=_0x100dc5-0x0;var _0x1dc4f6=_0x58d0[_0x100dc5];return _0x1dc4f6;};'use strict';var _=require(_0x058d('0x0'));var util=require(_0x058d('0x1'));var logger=require(_0x058d('0x2'))(_0x058d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x058d('0x4'));var fs=require('fs');var path=require(_0x058d('0x5'));var rimraf=require(_0x058d('0x6'));var config=require(_0x058d('0x7'));var attributes=require('./trigger.attributes');module[_0x058d('0x8')]=function(_0x26c5ae,_0xbc40ae){return _0x26c5ae['define'](_0x058d('0x9'),attributes,{'tableName':_0x058d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74ed=['./trigger.attributes','define','Trigger','tools_triggers','util','../../config/logger','moment','bluebird','path'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x74ed,0x109));var _0xd74e=function(_0x34f801,_0x522830){_0x34f801=_0x34f801-0x0;var _0x1522a6=_0x74ed[_0x34f801];return _0x1522a6;};'use strict';var _=require('lodash');var util=require(_0xd74e('0x0'));var logger=require(_0xd74e('0x1'))('api');var moment=require(_0xd74e('0x2'));var BPromise=require(_0xd74e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd74e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd74e('0x5'));module['exports']=function(_0x590118,_0x46d872){return _0x590118[_0xd74e('0x6')](_0xd74e('0x7'),attributes,{'tableName':_0xd74e('0x8'),'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 ade63e2..07c51b5 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 _0x9354=['catch','GetTrigger','findAll','options','where','attributes','limit','include','map','model','then','stringify','ShowTrigger','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x53fc50,_0x46b346){var _0xf287e=function(_0x473943){while(--_0x473943){_0x53fc50['push'](_0x53fc50['shift']());}};_0xf287e(++_0x46b346);}(_0x9354,0x96));var _0x4935=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x9354[_0x38537f];return _0x141e23;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var moment=require(_0x4935('0x1'));var BPromise=require('bluebird');var rs=require(_0x4935('0x2'));var fs=require('fs');var Redis=require(_0x4935('0x3'));var db=require(_0x4935('0x4'))['db'];var utils=require(_0x4935('0x5'));var logger=require('../../config/logger')(_0x4935('0x6'));var config=require(_0x4935('0x7'));var jayson=require(_0x4935('0x8'));var client=jayson[_0x4935('0x9')][_0x4935('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e47bd,_0x118d36,_0x2d735e){return new BPromise(function(_0x10793e,_0x4c9902){return client[_0x4935('0xb')](_0x2e47bd,_0x2d735e)['then'](function(_0x2aac9a){logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));logger[_0x4935('0xf')](_0x4935('0x10'),_0x118d36,'request\x20sent',JSON['stringify'](_0x2aac9a));if(_0x2aac9a[_0x4935('0x11')]){if(_0x2aac9a['error']['code']===0x1f4){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x4c9902(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x10793e(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}else{logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));_0x10793e(_0x2aac9a[_0x4935('0x13')]['message']);}})[_0x4935('0x14')](function(_0x46526a){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x46526a);_0x4c9902(_0x46526a);});});}exports[_0x4935('0x15')]=function(_0x429ef3){var _0x4ebc63=this;return new Promise(function(_0xd70eff,_0x145277){return db['Trigger'][_0x4935('0x16')]({'raw':_0x429ef3[_0x4935('0x17')]?_0x429ef3[_0x4935('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x429ef3['options']?_0x429ef3[_0x4935('0x17')][_0x4935('0x18')]||null:null,'attributes':_0x429ef3[_0x4935('0x17')]?_0x429ef3[_0x4935('0x17')][_0x4935('0x19')]||null:null,'limit':_0x429ef3[_0x4935('0x17')]?_0x429ef3[_0x4935('0x17')][_0x4935('0x1a')]||null:null,'include':_0x429ef3['options']?_0x429ef3[_0x4935('0x17')][_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x429ef3[_0x4935('0x17')][_0x4935('0x1b')],function(_0x53530f){return{'model':db[_0x53530f['model']],'as':_0x53530f['as'],'attributes':_0x53530f[_0x4935('0x19')],'include':_0x53530f[_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x53530f[_0x4935('0x1b')],function(_0x344e51){return{'model':db[_0x344e51[_0x4935('0x1d')]],'as':_0x344e51['as'],'attributes':_0x344e51[_0x4935('0x19')],'include':_0x344e51[_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x344e51[_0x4935('0x1b')],function(_0x1d08b5){return{'model':db[_0x1d08b5[_0x4935('0x1d')]],'as':_0x1d08b5['as'],'attributes':_0x1d08b5[_0x4935('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4935('0x1e')](function(_0x359522){logger['info']('GetTrigger',_0x429ef3);logger['debug'](_0x4935('0x15'),_0x429ef3,JSON[_0x4935('0x1f')](_0x359522));_0xd70eff(_0x359522);})['catch'](function(_0x3f0707){logger[_0x4935('0x11')](_0x4935('0x15'),_0x3f0707[_0x4935('0x12')],_0x429ef3);_0x145277(_0x4ebc63[_0x4935('0x11')](0x1f4,_0x3f0707[_0x4935('0x12')]));});});};exports[_0x4935('0x20')]=function(_0x2fe6da){var _0x5b3c8e=this;return new Promise(function(_0xb7fe2a,_0x2dcb0b){return db['Trigger']['find']({'raw':_0x2fe6da[_0x4935('0x17')]?_0x2fe6da['options'][_0x4935('0x21')]===undefined?!![]:![]:!![],'where':_0x2fe6da[_0x4935('0x17')]?_0x2fe6da[_0x4935('0x17')]['where']||null:null,'attributes':_0x2fe6da['options']?_0x2fe6da[_0x4935('0x17')][_0x4935('0x19')]||null:null,'include':_0x2fe6da['options']?_0x2fe6da[_0x4935('0x17')][_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x2fe6da[_0x4935('0x17')][_0x4935('0x1b')],function(_0x4a69bc){return{'model':db[_0x4a69bc['model']],'as':_0x4a69bc['as'],'attributes':_0x4a69bc[_0x4935('0x19')],'include':_0x4a69bc[_0x4935('0x1b')]?_['map'](_0x4a69bc['include'],function(_0xb3d934){return{'model':db[_0xb3d934['model']],'as':_0xb3d934['as'],'attributes':_0xb3d934[_0x4935('0x19')],'include':_0xb3d934[_0x4935('0x1b')]?_[_0x4935('0x1c')](_0xb3d934[_0x4935('0x1b')],function(_0x1d77b8){return{'model':db[_0x1d77b8[_0x4935('0x1d')]],'as':_0x1d77b8['as'],'attributes':_0x1d77b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x4935('0x1e')](function(_0x51b7ac){logger[_0x4935('0xc')]('ShowTrigger',_0x2fe6da);logger[_0x4935('0xf')]('ShowTrigger',_0x2fe6da,JSON[_0x4935('0x1f')](_0x51b7ac));_0xb7fe2a(_0x51b7ac);})[_0x4935('0x14')](function(_0x352679){logger[_0x4935('0x11')](_0x4935('0x20'),_0x352679[_0x4935('0x12')],_0x2fe6da);_0x2dcb0b(_0x5b3c8e[_0x4935('0x11')](0x1f4,_0x352679['message']));});});}; \ No newline at end of file +var _0x236c=['jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','options','raw','where','attributes','include','map','model','Trigger','find','ShowTrigger','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x278ab6,_0x27f3c1){var _0x2f98a4=function(_0x38a43a){while(--_0x38a43a){_0x278ab6['push'](_0x278ab6['shift']());}};_0x2f98a4(++_0x27f3c1);}(_0x236c,0x155));var _0xc236=function(_0x4a16d5,_0x35089d){_0x4a16d5=_0x4a16d5-0x0;var _0x51dc6e=_0x236c[_0x4a16d5];return _0x51dc6e;};'use strict';var _=require(_0xc236('0x0'));var util=require('util');var moment=require(_0xc236('0x1'));var BPromise=require(_0xc236('0x2'));var rs=require(_0xc236('0x3'));var fs=require('fs');var Redis=require(_0xc236('0x4'));var db=require(_0xc236('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc236('0x6'))(_0xc236('0x7'));var config=require(_0xc236('0x8'));var jayson=require(_0xc236('0x9'));var client=jayson[_0xc236('0xa')][_0xc236('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5abd65,_0xd612c6,_0x4d349b){return new BPromise(function(_0x51a13b,_0x5bc6a2){return client['request'](_0x5abd65,_0x4d349b)[_0xc236('0xc')](function(_0x4b8dc6){logger[_0xc236('0xd')](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));logger[_0xc236('0x10')](_0xc236('0x11'),_0xd612c6,'request\x20sent',JSON[_0xc236('0x12')](_0x4b8dc6));if(_0x4b8dc6[_0xc236('0x13')]){if(_0x4b8dc6['error'][_0xc236('0x14')]===0x1f4){logger[_0xc236('0x13')]('Trigger,\x20%s,\x20%s',_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x5bc6a2(_0x4b8dc6['error'][_0xc236('0x15')]);}logger[_0xc236('0x13')](_0xc236('0xe'),_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x51a13b(_0x4b8dc6[_0xc236('0x13')]['message']);}else{logger['info'](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));_0x51a13b(_0x4b8dc6[_0xc236('0x16')][_0xc236('0x15')]);}})[_0xc236('0x17')](function(_0x5ac3ed){logger['error']('Trigger,\x20%s,\x20%s',_0xd612c6,_0x5ac3ed);_0x5bc6a2(_0x5ac3ed);});});}exports[_0xc236('0x18')]=function(_0x76f45){var _0x11ec65=this;return new Promise(function(_0x541a20,_0x13b432){return db['Trigger']['findAll']({'raw':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1a')]===undefined?!![]:![]:!![],'where':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1b')]||null:null,'attributes':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1c')]||null:null,'limit':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')]['limit']||null:null,'include':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1d')]?_[_0xc236('0x1e')](_0x76f45[_0xc236('0x19')][_0xc236('0x1d')],function(_0x3a315b){return{'model':db[_0x3a315b[_0xc236('0x1f')]],'as':_0x3a315b['as'],'attributes':_0x3a315b[_0xc236('0x1c')],'include':_0x3a315b[_0xc236('0x1d')]?_[_0xc236('0x1e')](_0x3a315b['include'],function(_0x308cd6){return{'model':db[_0x308cd6[_0xc236('0x1f')]],'as':_0x308cd6['as'],'attributes':_0x308cd6[_0xc236('0x1c')],'include':_0x308cd6[_0xc236('0x1d')]?_['map'](_0x308cd6[_0xc236('0x1d')],function(_0x5da4b2){return{'model':db[_0x5da4b2['model']],'as':_0x5da4b2['as'],'attributes':_0x5da4b2[_0xc236('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36e578){logger['info'](_0xc236('0x18'),_0x76f45);logger['debug'](_0xc236('0x18'),_0x76f45,JSON[_0xc236('0x12')](_0x36e578));_0x541a20(_0x36e578);})['catch'](function(_0x5a61b5){logger[_0xc236('0x13')](_0xc236('0x18'),_0x5a61b5[_0xc236('0x15')],_0x76f45);_0x13b432(_0x11ec65[_0xc236('0x13')](0x1f4,_0x5a61b5['message']));});});};exports['ShowTrigger']=function(_0x28ffa5){var _0x53b767=this;return new Promise(function(_0x2c756f,_0x4ddc87){return db[_0xc236('0x20')][_0xc236('0x21')]({'raw':_0x28ffa5['options']?_0x28ffa5['options'][_0xc236('0x1a')]===undefined?!![]:![]:!![],'where':_0x28ffa5[_0xc236('0x19')]?_0x28ffa5[_0xc236('0x19')][_0xc236('0x1b')]||null:null,'attributes':_0x28ffa5[_0xc236('0x19')]?_0x28ffa5[_0xc236('0x19')][_0xc236('0x1c')]||null:null,'include':_0x28ffa5[_0xc236('0x19')]?_0x28ffa5[_0xc236('0x19')]['include']?_['map'](_0x28ffa5['options'][_0xc236('0x1d')],function(_0xfda1f9){return{'model':db[_0xfda1f9[_0xc236('0x1f')]],'as':_0xfda1f9['as'],'attributes':_0xfda1f9[_0xc236('0x1c')],'include':_0xfda1f9[_0xc236('0x1d')]?_[_0xc236('0x1e')](_0xfda1f9[_0xc236('0x1d')],function(_0x5761de){return{'model':db[_0x5761de[_0xc236('0x1f')]],'as':_0x5761de['as'],'attributes':_0x5761de[_0xc236('0x1c')],'include':_0x5761de[_0xc236('0x1d')]?_['map'](_0x5761de[_0xc236('0x1d')],function(_0x2a8f33){return{'model':db[_0x2a8f33[_0xc236('0x1f')]],'as':_0x2a8f33['as'],'attributes':_0x2a8f33[_0xc236('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12348b){logger[_0xc236('0xd')](_0xc236('0x22'),_0x28ffa5);logger[_0xc236('0x10')](_0xc236('0x22'),_0x28ffa5,JSON[_0xc236('0x12')](_0x12348b));_0x2c756f(_0x12348b);})[_0xc236('0x17')](function(_0x11ca1c){logger[_0xc236('0x13')](_0xc236('0x22'),_0x11ca1c[_0xc236('0x15')],_0x28ffa5);_0x4ddc87(_0x53b767[_0xc236('0x13')](0x1f4,_0x11ca1c[_0xc236('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 83cca04..de1e709 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 _0xedd9=['get','isAuthenticated','index','post','/:id/clone','clone','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x26fe41,_0x22b289){var _0x212c15=function(_0xc3e6fd){while(--_0xc3e6fd){_0x26fe41['push'](_0x26fe41['shift']());}};_0x212c15(++_0x22b289);}(_0xedd9,0xfc));var _0x9edd=function(_0x5d6d32,_0x87e471){_0x5d6d32=_0x5d6d32-0x0;var _0x1baccb=_0xedd9[_0x5d6d32];return _0x1baccb;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./trunk.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')](_0x9edd('0xc'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xd')]);router['post']('/',auth[_0x9edd('0x9')](),controller['create']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);module[_0x9edd('0x13')]=router; \ No newline at end of file +var _0x98a8=['clone','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone'];(function(_0x540fad,_0x5874e5){var _0x8508a2=function(_0x541a07){while(--_0x541a07){_0x540fad['push'](_0x540fad['shift']());}};_0x8508a2(++_0x5874e5);}(_0x98a8,0x12c));var _0x898a=function(_0x1cb104,_0x5ed9ed){_0x1cb104=_0x1cb104-0x0;var _0x3cec0b=_0x98a8[_0x1cb104];return _0x3cec0b;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['post'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0xf')]);router[_0x898a('0x10')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0x11')]);router[_0x898a('0x12')](_0x898a('0xc'),auth[_0x898a('0xa')](),controller['update']);router[_0x898a('0x13')]('/:id',auth[_0x898a('0xa')](),controller['destroy']);module[_0x898a('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index be25c63..1ef355e 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 _0x4c0f=['PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','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\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','sequelize','exports','ENUM','user','peer','friend','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c0f,0x12d));var _0xf4c0=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4c0f[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0xf4c0('0x0'));module[_0xf4c0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf4c0('0x2')]('friend',_0xf4c0('0x3'),_0xf4c0('0x4')),'allowNull':![],'defaultValue':_0xf4c0('0x5')},'context':{'type':Sequelize[_0xf4c0('0x6')],'allowNull':![],'defaultValue':_0xf4c0('0x7')},'callingpres':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x8'),_0xf4c0('0x9'),'ALLOWED_FAILED_SCREEN',_0xf4c0('0xa'),_0xf4c0('0xb'),_0xf4c0('0xc'),_0xf4c0('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0xf4c0('0x6')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xf4c0('0x6')]},'md5secret':{'type':Sequelize[_0xf4c0('0x6')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x5df37f){this[_0xf4c0('0xe')](_0xf4c0('0xf'),_0x5df37f?_0x5df37f[_0xf4c0('0x10')](','):null);},'get':function(){return this[_0xf4c0('0x11')](_0xf4c0('0xf'))?this[_0xf4c0('0x11')](_0xf4c0('0xf'))[_0xf4c0('0x12')](','):null;},'comment':_0xf4c0('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0xf4c0('0x14'),_0xf4c0('0x15'),_0xf4c0('0x16'),_0xf4c0('0x17'),_0xf4c0('0x18')),'defaultValue':_0xf4c0('0x14')},'directmedia':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no','nonat',_0xf4c0('0x1a'),_0xf4c0('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xf4c0('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf4c0('0x6')]},'directmediadeny':{'type':Sequelize[_0xf4c0('0x6')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x2700c6){this['setDataValue'](_0xf4c0('0x1c'),_0x2700c6?_0x2700c6[_0xf4c0('0x10')](','):null);},'get':function(){return this[_0xf4c0('0x11')](_0xf4c0('0x1c'))?this[_0xf4c0('0x11')](_0xf4c0('0x1c'))[_0xf4c0('0x12')](','):null;},'comment':_0xf4c0('0x1d')},'callgroup':{'type':Sequelize[_0xf4c0('0x6')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xf4c0('0x6')]},'namedpickupgroup':{'type':Sequelize[_0xf4c0('0x6')]},'language':{'type':Sequelize[_0xf4c0('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf4c0('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf4c0('0x6')],'defaultValue':_0xf4c0('0x1e')},'allow':{'type':Sequelize[_0xf4c0('0x6')],'allowNull':![],'defaultValue':_0xf4c0('0x1f'),'set':function(_0x1717d4){this[_0xf4c0('0xe')](_0xf4c0('0x20'),_0x1717d4?_0x1717d4[_0xf4c0('0x10')](';'):_0xf4c0('0x1f'));},'get':function(){return this[_0xf4c0('0x11')](_0xf4c0('0x20'))?this['getDataValue'](_0xf4c0('0x20'))['split'](';'):null;},'comment':_0xf4c0('0x21')},'autoframing':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no')},'insecure':{'type':Sequelize[_0xf4c0('0x6')],'defaultValue':'port,invite','set':function(_0x1bedf3){this['setDataValue'](_0xf4c0('0x22'),_0x1bedf3?_0x1bedf3[_0xf4c0('0x10')](','):null);},'get':function(){return this[_0xf4c0('0x11')](_0xf4c0('0x22'))?this['getDataValue']('insecure')[_0xf4c0('0x12')](','):null;},'comment':_0xf4c0('0x23')},'trustrpid':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xf4c0('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf4c0('0x2')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xf4c0('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no')},'accountcode':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'setvar':{'type':Sequelize[_0xf4c0('0x6')]},'callerid':{'type':Sequelize[_0xf4c0('0x6')],'defaultValue':_0xf4c0('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no'),'defaultValue':_0xf4c0('0x19')},'busylevel':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xf4c0('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xf4c0('0x6')]},'template':{'type':Sequelize[_0xf4c0('0x6')]},'videosupport':{'type':Sequelize['ENUM'](_0xf4c0('0x19'),'no',_0xf4c0('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf4c0('0x2')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x27'),_0xf4c0('0x28'),_0xf4c0('0x29'))},'session_expires':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x2a'),_0xf4c0('0x2b')),'defaultValue':_0xf4c0('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xf4c0('0x6')]},'regexten':{'type':Sequelize[_0xf4c0('0x6')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xf4c0('0x6')]},'port':{'type':Sequelize[_0xf4c0('0x24')](0x5)},'qualify':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no'),'defaultValue':_0xf4c0('0x19')},'keepalive':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xf4c0('0x6')]},'defaultuser':{'type':Sequelize[_0xf4c0('0x6')]},'rtptimeout':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no',_0xf4c0('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'timerb':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xf4c0('0x6')]},'contactdeny':{'type':Sequelize[_0xf4c0('0x6')]},'contactacl':{'type':Sequelize[_0xf4c0('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0xf4c0('0x6')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xf4c0('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf4c0('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no')},'icesupport':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xf4c0('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no',_0xf4c0('0x2d'),_0xf4c0('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf4c0('0x6')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xf4c0('0x6')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x2f'),_0xf4c0('0x30'),_0xf4c0('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf4c0('0x6')]},'usereqphone':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf4c0('0x6')]},'recordofffeature':{'type':Sequelize[_0xf4c0('0x6')]},'call_limit':{'type':Sequelize[_0xf4c0('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no')},'vmexten':{'type':Sequelize[_0xf4c0('0x6')]},'mohinterpret':{'type':Sequelize[_0xf4c0('0x6')]},'mohsuggest':{'type':Sequelize[_0xf4c0('0x6')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf4c0('0x6')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xf4c0('0x32')},'canreinvite':{'type':Sequelize[_0xf4c0('0x2')]('yes','no','nonat',_0xf4c0('0x1a'),_0xf4c0('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xf4c0('0x6')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf4c0('0x6')],'defaultValue':'no'}}; \ No newline at end of file +var _0x4117=['STRING','name','ENUM','friend','user','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','pai','certificate','active','passive','actpass','dynamic','nonat','update,nonat','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4117,0x90));var _0x7411=function(_0x456002,_0x343c22){_0x456002=_0x456002-0x0;var _0x16f755=_0x4117[_0x456002];return _0x16f755;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7411('0x0')],'allowNull':![],'unique':_0x7411('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x3'),_0x7411('0x4'),'peer'),'allowNull':![],'defaultValue':_0x7411('0x3')},'context':{'type':Sequelize[_0x7411('0x0')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x5'),_0x7411('0x6'),'ALLOWED_FAILED_SCREEN',_0x7411('0x7'),_0x7411('0x8'),_0x7411('0x9'),_0x7411('0xa'),_0x7411('0xb'))},'deny':{'type':Sequelize[_0x7411('0x0')]},'permit':{'type':Sequelize[_0x7411('0x0')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x7411('0x0')]},'remotesecret':{'type':Sequelize[_0x7411('0x0')]},'transport':{'type':Sequelize[_0x7411('0x0')],'defaultValue':_0x7411('0xc'),'set':function(_0xa1d3de){this[_0x7411('0xd')](_0x7411('0xe'),_0xa1d3de?_0xa1d3de[_0x7411('0xf')](','):null);},'get':function(){return this[_0x7411('0x10')](_0x7411('0xe'))?this[_0x7411('0x10')]('transport')[_0x7411('0x11')](','):null;},'comment':_0x7411('0x12')},'dtmfmode':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x13'),'info',_0x7411('0x14'),_0x7411('0x15'),_0x7411('0x16')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no','nonat',_0x7411('0x18'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7411('0x0')]},'directmediadeny':{'type':Sequelize[_0x7411('0x0')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x7411('0x19'),'set':function(_0x1d8c51){this[_0x7411('0xd')](_0x7411('0x1a'),_0x1d8c51?_0x1d8c51[_0x7411('0xf')](','):null);},'get':function(){return this[_0x7411('0x10')](_0x7411('0x1a'))?this['getDataValue'](_0x7411('0x1a'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x7411('0x0')]},'namedcallgroup':{'type':Sequelize[_0x7411('0x0')]},'pickupgroup':{'type':Sequelize[_0x7411('0x0')]},'namedpickupgroup':{'type':Sequelize[_0x7411('0x0')]},'language':{'type':Sequelize[_0x7411('0x0')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7411('0x0')],'defaultValue':_0x7411('0x1b')},'allow':{'type':Sequelize[_0x7411('0x0')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x37d05b){this['setDataValue']('allow',_0x37d05b?_0x37d05b[_0x7411('0xf')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x7411('0x10')](_0x7411('0x1c'))?this[_0x7411('0x10')](_0x7411('0x1c'))['split'](';'):null;},'comment':_0x7411('0x1d')},'autoframing':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no')},'insecure':{'type':Sequelize[_0x7411('0x0')],'defaultValue':'port,invite','set':function(_0x3ca987){this[_0x7411('0xd')](_0x7411('0x1e'),_0x3ca987?_0x3ca987[_0x7411('0xf')](','):null);},'get':function(){return this[_0x7411('0x10')](_0x7411('0x1e'))?this[_0x7411('0x10')](_0x7411('0x1e'))[_0x7411('0x11')](','):null;},'comment':_0x7411('0x1f')},'trustrpid':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x7411('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no')},'accountcode':{'type':Sequelize[_0x7411('0x20')](0xb)},'setvar':{'type':Sequelize[_0x7411('0x0')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x7411('0x21')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x7411('0x2')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x7411('0x20')](0xb)},'allowoverlap':{'type':Sequelize[_0x7411('0x2')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x7411('0x17'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x7411('0x0')]},'videosupport':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no',_0x7411('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7411('0x20')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x7411('0x2')]('yes','no')},'mailbox':{'type':Sequelize[_0x7411('0x0')]},'session_timers':{'type':Sequelize[_0x7411('0x2')]('accept',_0x7411('0x23'),_0x7411('0x24'))},'session_expires':{'type':Sequelize[_0x7411('0x20')](0xb)},'session_minse':{'type':Sequelize[_0x7411('0x20')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x7411('0x25'),_0x7411('0x26')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x7411('0x0')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x7411('0x0')]},'port':{'type':Sequelize[_0x7411('0x20')](0x5)},'qualify':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no'),'defaultValue':_0x7411('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x7411('0x0')]},'defaultuser':{'type':Sequelize[_0x7411('0x0')]},'rtptimeout':{'type':Sequelize[_0x7411('0x20')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7411('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7411('0x20')](0xb)},'sendrpid':{'type':Sequelize[_0x7411('0x2')]('yes','no',_0x7411('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7411('0x0')]},'callbackextension':{'type':Sequelize[_0x7411('0x0')]},'timert1':{'type':Sequelize[_0x7411('0x20')](0xb)},'timerb':{'type':Sequelize[_0x7411('0x20')](0xb)},'qualifyfreq':{'type':Sequelize[_0x7411('0x20')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x7411('0x0')]},'unsolicited_mailbox':{'type':Sequelize[_0x7411('0x0')]},'use_q850_reason':{'type':Sequelize[_0x7411('0x0')]},'maxforwards':{'type':Sequelize[_0x7411('0x20')](0xb)},'encryption':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no')},'force_avp':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no')},'icesupport':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no','fingerprint',_0x7411('0x28'))},'dtlsrekey':{'type':Sequelize[_0x7411('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0x7411('0x0')]},'dtlsprivatekey':{'type':Sequelize[_0x7411('0x0')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x7411('0x0')]},'dtlscapath':{'type':Sequelize[_0x7411('0x0')]},'dtlssetup':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x29'),_0x7411('0x2a'),_0x7411('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7411('0x0')]},'usereqphone':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7411('0x0')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no')},'vmexten':{'type':Sequelize[_0x7411('0x0')]},'mohinterpret':{'type':Sequelize[_0x7411('0x0')]},'mohsuggest':{'type':Sequelize[_0x7411('0x0')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7411('0x0')]},'host':{'type':Sequelize[_0x7411('0x0')],'defaultValue':_0x7411('0x2c')},'canreinvite':{'type':Sequelize[_0x7411('0x2')](_0x7411('0x17'),'no',_0x7411('0x2d'),_0x7411('0x18'),_0x7411('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x7411('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7411('0x0')],'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 34a3bbe..586532e 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 _0xf647=['rawAttributes','includeAll','find','length','omit','updatedAt','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','UserProfileSection','join','chan_sip.so','server/files/templates/registry.ejs','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','get','UserProfileResource','destroy','stack','name','send','index','map','fieldName','key','keys','query','filters','intersection','model','attributes','fields','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','Trunk','include','rows','show','params'];(function(_0x1eaf8c,_0xae6572){var _0x515157=function(_0x1ecb90){while(--_0x1ecb90){_0x1eaf8c['push'](_0x1eaf8c['shift']());}};_0x515157(++_0xae6572);}(_0xf647,0xf5));var _0x7f64=function(_0x2a9be5,_0x4dd8fb){_0x2a9be5=_0x2a9be5-0x0;var _0x29a093=_0xf647[_0x2a9be5];return _0x29a093;};'use strict';var pdf=require(_0x7f64('0x0'));var emlformat=require(_0x7f64('0x1'));var rimraf=require(_0x7f64('0x2'));var zipdir=require(_0x7f64('0x3'));var jsonpatch=require(_0x7f64('0x4'));var rp=require(_0x7f64('0x5'));var moment=require('moment');var BPromise=require(_0x7f64('0x6'));var Mustache=require('mustache');var util=require(_0x7f64('0x7'));var path=require(_0x7f64('0x8'));var sox=require(_0x7f64('0x9'));var csv=require(_0x7f64('0xa'));var ejs=require(_0x7f64('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f64('0xc'));var jsforce=require(_0x7f64('0xd'));var deskjs=require(_0x7f64('0xe'));var toCsv=require(_0x7f64('0xa'));var querystring=require('querystring');var Papa=require(_0x7f64('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7f64('0x10'));var as=require(_0x7f64('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7f64('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7f64('0x13'));var db=require(_0x7f64('0x14'))['db'];var jayson=require(_0x7f64('0x15'));var client=jayson[_0x7f64('0x16')][_0x7f64('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x553155,_0x1f9a1d,_0x4a80bf,_0x2054bc){return new BPromise(function(_0x121c1f,_0x4331b8){var _0x12a442=_0x2054bc||client;return _0x12a442['request'](_0x553155,_0x4a80bf)[_0x7f64('0x18')](function(_0x2b40aa){logger[_0x7f64('0x19')](_0x7f64('0x1a'),_0x1f9a1d,_0x7f64('0x1b'));logger[_0x7f64('0x1c')](_0x7f64('0x1d'),_0x1f9a1d,_0x7f64('0x1b'),JSON[_0x7f64('0x1e')](_0x2b40aa));if(_0x2b40aa['error']){if(_0x2b40aa[_0x7f64('0x1f')][_0x7f64('0x20')]===0x1f4){logger[_0x7f64('0x1f')](_0x7f64('0x1a'),_0x1f9a1d,_0x2b40aa[_0x7f64('0x1f')][_0x7f64('0x21')]);return _0x4331b8(_0x2b40aa[_0x7f64('0x1f')][_0x7f64('0x21')]);}logger[_0x7f64('0x1f')]('Trunk,\x20%s,\x20%s',_0x1f9a1d,_0x2b40aa[_0x7f64('0x1f')]['message']);return _0x121c1f(_0x2b40aa[_0x7f64('0x1f')][_0x7f64('0x21')]);}else{logger[_0x7f64('0x19')](_0x7f64('0x1a'),_0x1f9a1d,_0x7f64('0x1b'));_0x121c1f(_0x2b40aa['result'][_0x7f64('0x21')]);}})[_0x7f64('0x22')](function(_0x4073e2){logger[_0x7f64('0x1f')](_0x7f64('0x1a'),_0x1f9a1d,_0x4073e2);_0x4331b8(_0x4073e2);});});}function respondWithStatusCode(_0x1f5b89,_0x443afd){_0x443afd=_0x443afd||0xcc;return function(_0x3e91df){if(_0x3e91df){return _0x1f5b89[_0x7f64('0x23')](_0x443afd);}return _0x1f5b89[_0x7f64('0x24')](_0x443afd)[_0x7f64('0x25')]();};}function respondWithResult(_0x3abb5b,_0x47354d){_0x47354d=_0x47354d||0xc8;return function(_0x4306e5){if(_0x4306e5){return _0x3abb5b[_0x7f64('0x24')](_0x47354d)[_0x7f64('0x26')](_0x4306e5);}};}function respondWithFilteredResult(_0x3be493,_0x425099){return function(_0x5ecd79){if(_0x5ecd79){var _0x3d0ca3=_0x5ecd79[_0x7f64('0x27')],_0x2d78aa=_0x425099[_0x7f64('0x28')],_0x4aec9d=_0x425099['offset']+_0x425099['limit'],_0x22e865;if(_0x4aec9d>=_0x3d0ca3){_0x4aec9d=_0x3d0ca3;_0x22e865=0xc8;}else{_0x22e865=0xce;}_0x3be493[_0x7f64('0x24')](_0x22e865);return _0x3be493[_0x7f64('0x29')](_0x7f64('0x2a'),_0x2d78aa+'-'+_0x4aec9d+'/'+_0x3d0ca3)[_0x7f64('0x26')](_0x5ecd79);}return null;};}function patchUpdates(_0x16a830){return function(_0x20512d){try{jsonpatch[_0x7f64('0x2b')](_0x20512d,_0x16a830,!![]);}catch(_0x54b134){return BPromise['reject'](_0x54b134);}return _0x20512d['save']();};}function saveUpdates(_0x5b90ad,_0x3fd871){return function(_0x58c11d){if(_0x58c11d){return _0x58c11d[_0x7f64('0x2c')](_0x5b90ad)['then'](function(_0x159201){return _0x159201;});}return null;};}function removeEntity(_0x13f689,_0x1c67f4){return function(_0x27acd8){if(_0x27acd8){return _0x27acd8['destroy']()[_0x7f64('0x18')](function(){var _0x55709d=_0x27acd8[_0x7f64('0x2d')]({'plain':!![]});var _0x282516='Trunks';return db[_0x7f64('0x2e')][_0x7f64('0x2f')]({'where':{'type':_0x282516,'resourceId':_0x55709d['id']}})[_0x7f64('0x18')](function(){return _0x27acd8;});})['then'](function(){_0x13f689[_0x7f64('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x148aa4,_0x4750dc){return function(_0x30a91c){if(!_0x30a91c){_0x148aa4[_0x7f64('0x23')](0x194);}return _0x30a91c;};}function handleError(_0x517bbd,_0x3f711b){_0x3f711b=_0x3f711b||0x1f4;return function(_0x2a96ff){logger[_0x7f64('0x1f')](_0x2a96ff[_0x7f64('0x30')]);if(_0x2a96ff[_0x7f64('0x31')]){delete _0x2a96ff['name'];}_0x517bbd['status'](_0x3f711b)[_0x7f64('0x32')](_0x2a96ff);};}exports[_0x7f64('0x33')]=function(_0x21958c,_0x2464c4){var _0x5d67aa={},_0x4da21f={},_0x2849f6={'count':0x0,'rows':[]};var _0x565788=_[_0x7f64('0x34')](db['Trunk']['rawAttributes'],function(_0x3d22d9){return{'name':_0x3d22d9[_0x7f64('0x35')],'type':_0x3d22d9['type'][_0x7f64('0x36')]};});_0x4da21f['model']=_['map'](_0x565788,_0x7f64('0x31'));_0x4da21f['query']=_[_0x7f64('0x37')](_0x21958c[_0x7f64('0x38')]);_0x4da21f[_0x7f64('0x39')]=_[_0x7f64('0x3a')](_0x4da21f[_0x7f64('0x3b')],_0x4da21f[_0x7f64('0x38')]);_0x5d67aa[_0x7f64('0x3c')]=_[_0x7f64('0x3a')](_0x4da21f[_0x7f64('0x3b')],qs[_0x7f64('0x3d')](_0x21958c[_0x7f64('0x38')]['fields']));_0x5d67aa[_0x7f64('0x3c')]=_0x5d67aa[_0x7f64('0x3c')]['length']?_0x5d67aa[_0x7f64('0x3c')]:_0x4da21f['model'];if(!_0x21958c['query']['hasOwnProperty']('nolimit')){_0x5d67aa[_0x7f64('0x3e')]=qs['limit'](_0x21958c[_0x7f64('0x38')][_0x7f64('0x3e')]);_0x5d67aa[_0x7f64('0x28')]=qs[_0x7f64('0x28')](_0x21958c['query'][_0x7f64('0x28')]);}_0x5d67aa[_0x7f64('0x3f')]=qs[_0x7f64('0x40')](_0x21958c['query'][_0x7f64('0x40')]);_0x5d67aa[_0x7f64('0x41')]=qs[_0x7f64('0x39')](_[_0x7f64('0x42')](_0x21958c['query'],_0x4da21f[_0x7f64('0x39')]),_0x565788);if(_0x21958c[_0x7f64('0x38')]['filter']){_0x5d67aa[_0x7f64('0x41')]=_[_0x7f64('0x43')](_0x5d67aa['where'],{'$or':_['map'](_0x565788,function(_0x19ea0a){if(_0x19ea0a['type']!==_0x7f64('0x44')){var _0x3731e1={};_0x3731e1[_0x19ea0a[_0x7f64('0x31')]]={'$like':'%'+_0x21958c[_0x7f64('0x38')][_0x7f64('0x45')]+'%'};return _0x3731e1;}})});}_0x5d67aa=_[_0x7f64('0x43')]({},_0x5d67aa,_0x21958c[_0x7f64('0x46')]);var _0x37891f={'where':_0x5d67aa[_0x7f64('0x41')]};return db[_0x7f64('0x47')][_0x7f64('0x27')](_0x37891f)['then'](function(_0x3c7f09){_0x2849f6['count']=_0x3c7f09;if(_0x21958c['query']['includeAll']){_0x5d67aa[_0x7f64('0x48')]=[{'all':!![]}];}return db[_0x7f64('0x47')]['findAll'](_0x5d67aa);})[_0x7f64('0x18')](function(_0x11348a){_0x2849f6[_0x7f64('0x49')]=_0x11348a;return _0x2849f6;})[_0x7f64('0x18')](respondWithFilteredResult(_0x2464c4,_0x5d67aa))['catch'](handleError(_0x2464c4,null));};exports[_0x7f64('0x4a')]=function(_0xbef562,_0x38e43a){var _0x233c40={'raw':![],'where':{'id':_0xbef562[_0x7f64('0x4b')]['id']}},_0x3d7b6a={};_0x3d7b6a[_0x7f64('0x3b')]=_['keys'](db[_0x7f64('0x47')][_0x7f64('0x4c')]);_0x3d7b6a[_0x7f64('0x38')]=_[_0x7f64('0x37')](_0xbef562[_0x7f64('0x38')]);_0x3d7b6a[_0x7f64('0x39')]=_['intersection'](_0x3d7b6a[_0x7f64('0x3b')],_0x3d7b6a['query']);_0x233c40[_0x7f64('0x3c')]=_[_0x7f64('0x3a')](_0x3d7b6a[_0x7f64('0x3b')],qs[_0x7f64('0x3d')](_0xbef562['query'][_0x7f64('0x3d')]));_0x233c40[_0x7f64('0x3c')]=_0x233c40[_0x7f64('0x3c')]['length']?_0x233c40[_0x7f64('0x3c')]:_0x3d7b6a[_0x7f64('0x3b')];if(_0xbef562[_0x7f64('0x38')][_0x7f64('0x4d')]){_0x233c40[_0x7f64('0x48')]=[{'all':!![]}];}_0x233c40=_[_0x7f64('0x43')]({},_0x233c40,_0xbef562[_0x7f64('0x46')]);return db[_0x7f64('0x47')][_0x7f64('0x4e')](_0x233c40)[_0x7f64('0x18')](handleEntityNotFound(_0x38e43a,null))[_0x7f64('0x18')](respondWithResult(_0x38e43a,null))[_0x7f64('0x22')](handleError(_0x38e43a,null));};exports['clone']=function(_0x2eaeb9,_0x526030){var _0xd78a87={'where':{'id':_0x2eaeb9[_0x7f64('0x4b')]['id']}},_0x5ae00e={};_0x5ae00e[_0x7f64('0x3b')]=_[_0x7f64('0x37')](db[_0x7f64('0x47')][_0x7f64('0x4c')]);_0xd78a87[_0x7f64('0x3c')]=_['intersection'](_0x5ae00e[_0x7f64('0x3b')],qs['fields'](_0x2eaeb9['query'][_0x7f64('0x3d')]));_0xd78a87['attributes']=_0xd78a87[_0x7f64('0x3c')][_0x7f64('0x4f')]?_0xd78a87['attributes']:_0x5ae00e[_0x7f64('0x3b')];if(_0x2eaeb9[_0x7f64('0x38')][_0x7f64('0x4d')]){_0xd78a87[_0x7f64('0x48')]=[{'all':!![]}];}_0xd78a87=_[_0x7f64('0x43')]({},_0xd78a87,_0x2eaeb9[_0x7f64('0x46')]);return db[_0x7f64('0x47')][_0x7f64('0x4e')](_0xd78a87)[_0x7f64('0x18')](handleEntityNotFound(_0x526030,null))[_0x7f64('0x18')](function(_0x4f0c13){if(_0x4f0c13){var _0x25d53b=_0x4f0c13['get']({'plain':!![]});_0x25d53b=qs[_0x7f64('0x50')](_0x25d53b,['id','createdAt',_0x7f64('0x51')]);_0x2eaeb9[_0x7f64('0x52')]=_['omit'](_0x2eaeb9[_0x7f64('0x52')],['id',_0x7f64('0x53'),_0x7f64('0x51')]);return db[_0x7f64('0x47')][_0x7f64('0x54')](_[_0x7f64('0x43')](_0x25d53b,_0x2eaeb9['body']),{'include':_0x2eaeb9[_0x7f64('0x38')][_0x7f64('0x4d')]?[{'all':!![]}]:undefined})['then'](function(_0x38326f){var _0x5c339b=_0x2eaeb9[_0x7f64('0x55')][_0x7f64('0x2d')]({'plain':!![]});if(!_0x5c339b)throw new Error(_0x7f64('0x56'));if(_0x5c339b[_0x7f64('0x57')]===_0x7f64('0x55')){var _0x51594c=_0x38326f['get']({'plain':!![]});var _0x2c5c65=_0x7f64('0x58');return db['UserProfileSection']['find']({'where':{'name':_0x2c5c65,'userProfileId':_0x5c339b[_0x7f64('0x59')]},'raw':!![]})[_0x7f64('0x18')](function(_0x95e242){if(_0x95e242&&_0x95e242[_0x7f64('0x5a')]===0x0){return db[_0x7f64('0x2e')][_0x7f64('0x54')]({'name':_0x51594c[_0x7f64('0x31')],'resourceId':_0x51594c['id'],'type':_0x95e242[_0x7f64('0x31')],'sectionId':_0x95e242['id']},{})[_0x7f64('0x18')](function(){return _0x38326f;});}else{return _0x38326f;}})['catch'](function(_0x3903d6){logger[_0x7f64('0x1f')](_0x7f64('0x5b'),_0x3903d6);throw _0x3903d6;});}return _0x38326f;});}})[_0x7f64('0x18')](respondWithResult(_0x526030,0xc9))[_0x7f64('0x22')](handleError(_0x526030,null));};exports[_0x7f64('0x54')]=function(_0x4631a4,_0x3ce7cc,_0x5dbfbd){var _0x4d112b;return db['Trunk'][_0x7f64('0x54')](_0x4631a4[_0x7f64('0x52')],{'raw':!![]})[_0x7f64('0x18')](function(_0xf58f1e){_0x4d112b=_0xf58f1e;return db[_0x7f64('0x47')][_0x7f64('0x5c')]({'raw':!![]});})[_0x7f64('0x18')](function(_0x5bdb5e){var _0x326fe8=fs[_0x7f64('0x5d')](path['join'](config[_0x7f64('0x5e')],_0x7f64('0x5f')),_0x7f64('0x60'));var _0x54c4c2=fs[_0x7f64('0x5d')](path['join'](config[_0x7f64('0x5e')],'server/files/templates/registry.ejs'),_0x7f64('0x60'));var _0x137f45=ejs[_0x7f64('0x61')](_0x326fe8,{'trunks':_0x5bdb5e||[]});fs[_0x7f64('0x62')](_0x7f64('0x63'),_0x137f45);if(_0x4d112b[_0x7f64('0x64')]){var _0x2821fd=ejs[_0x7f64('0x61')](_0x54c4c2,{'trunks':_0x5bdb5e||[]});fs['writeFileSync'](_0x7f64('0x65'),_0x2821fd);}})[_0x7f64('0x18')](function(){return respondWithRpcPromise(_0x7f64('0x66'),'create',{'module':'chan_sip.so'});})['then'](function(){var _0x3ea5fb=_0x4631a4[_0x7f64('0x55')][_0x7f64('0x2d')]({'plain':!![]});if(!_0x3ea5fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ea5fb[_0x7f64('0x57')]===_0x7f64('0x55')){var _0xd4a50c=_0x4d112b[_0x7f64('0x2d')]({'plain':!![]});return db[_0x7f64('0x67')][_0x7f64('0x4e')]({'where':{'name':'Trunks','userProfileId':_0x3ea5fb['userProfileId']},'raw':!![]})[_0x7f64('0x18')](function(_0x381732){if(_0x381732&&_0x381732[_0x7f64('0x5a')]===0x0){return db['UserProfileResource'][_0x7f64('0x54')]({'name':_0xd4a50c[_0x7f64('0x31')],'resourceId':_0xd4a50c['id'],'type':_0x381732[_0x7f64('0x31')],'sectionId':_0x381732['id']},{})[_0x7f64('0x18')](function(){return _0x4d112b;});}else{return _0x4d112b;}})[_0x7f64('0x22')](function(_0x5f2b3e){logger[_0x7f64('0x1f')](_0x7f64('0x5b'),_0x5f2b3e);throw _0x5f2b3e;});}return _0x4d112b;})['then'](respondWithResult(_0x3ce7cc,0xc9))[_0x7f64('0x22')](handleError(_0x3ce7cc,null));};exports['update']=function(_0x54c683,_0x2cb5ed,_0x214001){var _0x1bb1da;return db[_0x7f64('0x47')][_0x7f64('0x4e')]({'where':{'id':_0x54c683[_0x7f64('0x4b')]['id']}})[_0x7f64('0x18')](handleEntityNotFound(_0x2cb5ed,null))[_0x7f64('0x18')](saveUpdates(_0x54c683['body'],null))[_0x7f64('0x18')](function(_0x1232aa){if(_0x1232aa){_0x1bb1da=_0x1232aa;return db[_0x7f64('0x47')]['findAll']({'raw':!![]});}})[_0x7f64('0x18')](function(_0x427d9f){if(_0x427d9f){var _0x538777=fs['readFileSync'](path[_0x7f64('0x68')](config[_0x7f64('0x5e')],_0x7f64('0x5f')),_0x7f64('0x60'));var _0x3c0549=fs[_0x7f64('0x5d')](path[_0x7f64('0x68')](config[_0x7f64('0x5e')],'server/files/templates/registry.ejs'),'utf8');var _0x558441=ejs['render'](_0x538777,{'trunks':_0x427d9f||[]});fs[_0x7f64('0x62')](_0x7f64('0x63'),_0x558441);var _0x4198b5=ejs[_0x7f64('0x61')](_0x3c0549,{'trunks':_0x427d9f||[]});fs[_0x7f64('0x62')]('/etc/asterisk/sip_xcally_registers.conf',_0x4198b5);return respondWithRpcPromise(_0x7f64('0x66'),_0x7f64('0x2c'),{'module':_0x7f64('0x69')});}return null;})['then'](function(_0x25c553){if(_0x25c553){return _0x1bb1da;}})[_0x7f64('0x18')](respondWithResult(_0x2cb5ed,null))[_0x7f64('0x22')](handleError(_0x2cb5ed,null));};exports[_0x7f64('0x2f')]=function(_0x268153,_0x47c450,_0x37f5ad){var _0x3d297a;return db['Trunk']['find']({'where':{'id':_0x268153[_0x7f64('0x4b')]['id']}})[_0x7f64('0x18')](handleEntityNotFound(_0x47c450,null))[_0x7f64('0x18')](removeEntity(_0x47c450,null))[_0x7f64('0x18')](function(){return db['Trunk'][_0x7f64('0x5c')]({'raw':!![]});})[_0x7f64('0x18')](function(_0x29f746){var _0x1f9fd9=fs[_0x7f64('0x5d')](path[_0x7f64('0x68')](config[_0x7f64('0x5e')],_0x7f64('0x5f')),_0x7f64('0x60'));var _0x5d8dee=fs[_0x7f64('0x5d')](path[_0x7f64('0x68')](config['root'],_0x7f64('0x6a')),'utf8');var _0x23dd55=ejs[_0x7f64('0x61')](_0x1f9fd9,{'trunks':_0x29f746});var _0x7e1fbd=ejs[_0x7f64('0x61')](_0x5d8dee,{'trunks':_0x29f746});fs['writeFileSync'](_0x7f64('0x63'),_0x23dd55);fs[_0x7f64('0x62')]('/etc/asterisk/sip_xcally_registers.conf',_0x7e1fbd);return respondWithRpcPromise(_0x7f64('0x66'),_0x7f64('0x2f'),{'module':_0x7f64('0x69')});})[_0x7f64('0x22')](handleError(_0x47c450,null));}; \ No newline at end of file +var _0xa785=['registry','Reload','chan_sip.so','role','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','html-pdf','eml-format','rimraf','zip-dir','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/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','get','Trunks','UserProfileResource','destroy','end','name','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','show','find','clone','params','options','omit','updatedAt','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xa785,0x77));var _0x5a78=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0xa785[_0x3f3f06];return _0x140feb;};'use strict';var pdf=require(_0x5a78('0x0'));var emlformat=require(_0x5a78('0x1'));var rimraf=require(_0x5a78('0x2'));var zipdir=require(_0x5a78('0x3'));var jsonpatch=require(_0x5a78('0x4'));var rp=require(_0x5a78('0x5'));var moment=require(_0x5a78('0x6'));var BPromise=require(_0x5a78('0x7'));var Mustache=require(_0x5a78('0x8'));var util=require(_0x5a78('0x9'));var path=require('path');var sox=require(_0x5a78('0xa'));var csv=require(_0x5a78('0xb'));var ejs=require(_0x5a78('0xc'));var fs=require('fs');var _=require(_0x5a78('0xd'));var squel=require(_0x5a78('0xe'));var crypto=require(_0x5a78('0xf'));var jsforce=require(_0x5a78('0x10'));var deskjs=require(_0x5a78('0x11'));var toCsv=require('to-csv');var querystring=require(_0x5a78('0x12'));var Papa=require(_0x5a78('0x13'));var Redis=require(_0x5a78('0x14'));var authService=require(_0x5a78('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x5a78('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a78('0x17'))(_0x5a78('0x18'));var utils=require(_0x5a78('0x19'));var config=require(_0x5a78('0x1a'));var licenseUtil=require(_0x5a78('0x1b'));var db=require(_0x5a78('0x1c'))['db'];var jayson=require(_0x5a78('0x1d'));var client=jayson[_0x5a78('0x1e')][_0x5a78('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x18296b,_0x466017,_0xd26b5a,_0x186287){return new BPromise(function(_0x24e1d6,_0x32b0da){var _0x322860=_0x186287||client;return _0x322860[_0x5a78('0x20')](_0x18296b,_0xd26b5a)[_0x5a78('0x21')](function(_0x2a9d0b){logger['info'](_0x5a78('0x22'),_0x466017,_0x5a78('0x23'));logger['debug'](_0x5a78('0x24'),_0x466017,_0x5a78('0x23'),JSON[_0x5a78('0x25')](_0x2a9d0b));if(_0x2a9d0b['error']){if(_0x2a9d0b[_0x5a78('0x26')]['code']===0x1f4){logger[_0x5a78('0x26')](_0x5a78('0x22'),_0x466017,_0x2a9d0b[_0x5a78('0x26')]['message']);return _0x32b0da(_0x2a9d0b[_0x5a78('0x26')]['message']);}logger[_0x5a78('0x26')](_0x5a78('0x22'),_0x466017,_0x2a9d0b['error'][_0x5a78('0x27')]);return _0x24e1d6(_0x2a9d0b[_0x5a78('0x26')][_0x5a78('0x27')]);}else{logger[_0x5a78('0x28')](_0x5a78('0x22'),_0x466017,_0x5a78('0x23'));_0x24e1d6(_0x2a9d0b[_0x5a78('0x29')][_0x5a78('0x27')]);}})[_0x5a78('0x2a')](function(_0x34af2f){logger['error'](_0x5a78('0x22'),_0x466017,_0x34af2f);_0x32b0da(_0x34af2f);});});}function respondWithStatusCode(_0x222ead,_0x27a88e){_0x27a88e=_0x27a88e||0xcc;return function(_0x45597e){if(_0x45597e){return _0x222ead[_0x5a78('0x2b')](_0x27a88e);}return _0x222ead[_0x5a78('0x2c')](_0x27a88e)['end']();};}function respondWithResult(_0x5e35c7,_0xe36c5e){_0xe36c5e=_0xe36c5e||0xc8;return function(_0x1916b8){if(_0x1916b8){return _0x5e35c7[_0x5a78('0x2c')](_0xe36c5e)[_0x5a78('0x2d')](_0x1916b8);}};}function respondWithFilteredResult(_0xf965f9,_0x2d567e){return function(_0x7866a6){if(_0x7866a6){var _0x5f3232=_0x7866a6[_0x5a78('0x2e')],_0x163e4e=_0x2d567e[_0x5a78('0x2f')],_0x17467c=_0x2d567e['offset']+_0x2d567e[_0x5a78('0x30')],_0x9a7154;if(_0x17467c>=_0x5f3232){_0x17467c=_0x5f3232;_0x9a7154=0xc8;}else{_0x9a7154=0xce;}_0xf965f9[_0x5a78('0x2c')](_0x9a7154);return _0xf965f9['set'](_0x5a78('0x31'),_0x163e4e+'-'+_0x17467c+'/'+_0x5f3232)[_0x5a78('0x2d')](_0x7866a6);}return null;};}function patchUpdates(_0x2a94f5){return function(_0x395bf4){try{jsonpatch[_0x5a78('0x32')](_0x395bf4,_0x2a94f5,!![]);}catch(_0x40d498){return BPromise[_0x5a78('0x33')](_0x40d498);}return _0x395bf4['save']();};}function saveUpdates(_0x3f8fbb,_0x704f64){return function(_0x5a3d14){if(_0x5a3d14){return _0x5a3d14[_0x5a78('0x34')](_0x3f8fbb)[_0x5a78('0x21')](function(_0x1b1b3a){return _0x1b1b3a;});}return null;};}function removeEntity(_0x4b22eb,_0x3f7ef0){return function(_0x478a66){if(_0x478a66){return _0x478a66['destroy']()[_0x5a78('0x21')](function(){var _0x23e848=_0x478a66[_0x5a78('0x35')]({'plain':!![]});var _0x1facc0=_0x5a78('0x36');return db[_0x5a78('0x37')][_0x5a78('0x38')]({'where':{'type':_0x1facc0,'resourceId':_0x23e848['id']}})['then'](function(){return _0x478a66;});})['then'](function(){_0x4b22eb['status'](0xcc)[_0x5a78('0x39')]();});}};}function handleEntityNotFound(_0x1bd102,_0x4b3a39){return function(_0x1c7555){if(!_0x1c7555){_0x1bd102[_0x5a78('0x2b')](0x194);}return _0x1c7555;};}function handleError(_0xf3e923,_0x5c0011){_0x5c0011=_0x5c0011||0x1f4;return function(_0x287342){logger[_0x5a78('0x26')](_0x287342['stack']);if(_0x287342[_0x5a78('0x3a')]){delete _0x287342[_0x5a78('0x3a')];}_0xf3e923[_0x5a78('0x2c')](_0x5c0011)['send'](_0x287342);};}exports[_0x5a78('0x3b')]=function(_0x12a05a,_0x373e96){var _0x1262bb={},_0x104cc2={},_0x391739={'count':0x0,'rows':[]};var _0x7c9f53=_[_0x5a78('0x3c')](db[_0x5a78('0x3d')][_0x5a78('0x3e')],function(_0x4220f2){return{'name':_0x4220f2[_0x5a78('0x3f')],'type':_0x4220f2[_0x5a78('0x40')][_0x5a78('0x41')]};});_0x104cc2[_0x5a78('0x42')]=_[_0x5a78('0x3c')](_0x7c9f53,_0x5a78('0x3a'));_0x104cc2[_0x5a78('0x43')]=_[_0x5a78('0x44')](_0x12a05a['query']);_0x104cc2[_0x5a78('0x45')]=_[_0x5a78('0x46')](_0x104cc2['model'],_0x104cc2[_0x5a78('0x43')]);_0x1262bb[_0x5a78('0x47')]=_[_0x5a78('0x46')](_0x104cc2[_0x5a78('0x42')],qs[_0x5a78('0x48')](_0x12a05a[_0x5a78('0x43')][_0x5a78('0x48')]));_0x1262bb[_0x5a78('0x47')]=_0x1262bb['attributes'][_0x5a78('0x49')]?_0x1262bb[_0x5a78('0x47')]:_0x104cc2[_0x5a78('0x42')];if(!_0x12a05a[_0x5a78('0x43')][_0x5a78('0x4a')](_0x5a78('0x4b'))){_0x1262bb['limit']=qs[_0x5a78('0x30')](_0x12a05a['query'][_0x5a78('0x30')]);_0x1262bb[_0x5a78('0x2f')]=qs[_0x5a78('0x2f')](_0x12a05a[_0x5a78('0x43')][_0x5a78('0x2f')]);}_0x1262bb['order']=qs[_0x5a78('0x4c')](_0x12a05a[_0x5a78('0x43')][_0x5a78('0x4c')]);_0x1262bb[_0x5a78('0x4d')]=qs['filters'](_[_0x5a78('0x4e')](_0x12a05a[_0x5a78('0x43')],_0x104cc2[_0x5a78('0x45')]),_0x7c9f53);if(_0x12a05a['query'][_0x5a78('0x4f')]){_0x1262bb[_0x5a78('0x4d')]=_[_0x5a78('0x50')](_0x1262bb['where'],{'$or':_[_0x5a78('0x3c')](_0x7c9f53,function(_0x25c590){if(_0x25c590[_0x5a78('0x40')]!=='VIRTUAL'){var _0x94b80={};_0x94b80[_0x25c590[_0x5a78('0x3a')]]={'$like':'%'+_0x12a05a[_0x5a78('0x43')][_0x5a78('0x4f')]+'%'};return _0x94b80;}})});}_0x1262bb=_[_0x5a78('0x50')]({},_0x1262bb,_0x12a05a['options']);var _0x31e1b1={'where':_0x1262bb[_0x5a78('0x4d')]};return db[_0x5a78('0x3d')][_0x5a78('0x2e')](_0x31e1b1)[_0x5a78('0x21')](function(_0x565447){_0x391739['count']=_0x565447;if(_0x12a05a[_0x5a78('0x43')][_0x5a78('0x51')]){_0x1262bb[_0x5a78('0x52')]=[{'all':!![]}];}return db['Trunk'][_0x5a78('0x53')](_0x1262bb);})['then'](function(_0x1976f8){_0x391739['rows']=_0x1976f8;return _0x391739;})['then'](respondWithFilteredResult(_0x373e96,_0x1262bb))['catch'](handleError(_0x373e96,null));};exports[_0x5a78('0x54')]=function(_0x399907,_0x2b477b){var _0x21bbb4={'raw':![],'where':{'id':_0x399907['params']['id']}},_0x135309={};_0x135309[_0x5a78('0x42')]=_[_0x5a78('0x44')](db['Trunk'][_0x5a78('0x3e')]);_0x135309[_0x5a78('0x43')]=_[_0x5a78('0x44')](_0x399907[_0x5a78('0x43')]);_0x135309[_0x5a78('0x45')]=_['intersection'](_0x135309[_0x5a78('0x42')],_0x135309[_0x5a78('0x43')]);_0x21bbb4[_0x5a78('0x47')]=_['intersection'](_0x135309[_0x5a78('0x42')],qs['fields'](_0x399907[_0x5a78('0x43')][_0x5a78('0x48')]));_0x21bbb4[_0x5a78('0x47')]=_0x21bbb4[_0x5a78('0x47')]['length']?_0x21bbb4[_0x5a78('0x47')]:_0x135309[_0x5a78('0x42')];if(_0x399907[_0x5a78('0x43')]['includeAll']){_0x21bbb4['include']=[{'all':!![]}];}_0x21bbb4=_[_0x5a78('0x50')]({},_0x21bbb4,_0x399907['options']);return db[_0x5a78('0x3d')][_0x5a78('0x55')](_0x21bbb4)[_0x5a78('0x21')](handleEntityNotFound(_0x2b477b,null))[_0x5a78('0x21')](respondWithResult(_0x2b477b,null))['catch'](handleError(_0x2b477b,null));};exports[_0x5a78('0x56')]=function(_0x253164,_0x5ddf61){var _0x563613={'where':{'id':_0x253164[_0x5a78('0x57')]['id']}},_0x3e3578={};_0x3e3578[_0x5a78('0x42')]=_[_0x5a78('0x44')](db[_0x5a78('0x3d')][_0x5a78('0x3e')]);_0x563613['attributes']=_[_0x5a78('0x46')](_0x3e3578[_0x5a78('0x42')],qs[_0x5a78('0x48')](_0x253164[_0x5a78('0x43')][_0x5a78('0x48')]));_0x563613[_0x5a78('0x47')]=_0x563613[_0x5a78('0x47')][_0x5a78('0x49')]?_0x563613[_0x5a78('0x47')]:_0x3e3578[_0x5a78('0x42')];if(_0x253164[_0x5a78('0x43')][_0x5a78('0x51')]){_0x563613['include']=[{'all':!![]}];}_0x563613=_[_0x5a78('0x50')]({},_0x563613,_0x253164[_0x5a78('0x58')]);return db[_0x5a78('0x3d')][_0x5a78('0x55')](_0x563613)[_0x5a78('0x21')](handleEntityNotFound(_0x5ddf61,null))[_0x5a78('0x21')](function(_0x3daa57){if(_0x3daa57){var _0xbb3ac8=_0x3daa57[_0x5a78('0x35')]({'plain':!![]});_0xbb3ac8=qs[_0x5a78('0x59')](_0xbb3ac8,['id','createdAt',_0x5a78('0x5a')]);_0x253164[_0x5a78('0x5b')]=_[_0x5a78('0x59')](_0x253164[_0x5a78('0x5b')],['id',_0x5a78('0x5c'),_0x5a78('0x5a')]);return db['Trunk'][_0x5a78('0x5d')](_[_0x5a78('0x50')](_0xbb3ac8,_0x253164['body']),{'include':_0x253164[_0x5a78('0x43')][_0x5a78('0x51')]?[{'all':!![]}]:undefined})[_0x5a78('0x21')](function(_0xc5e941){var _0x2c0ea0=_0x253164[_0x5a78('0x5e')][_0x5a78('0x35')]({'plain':!![]});if(!_0x2c0ea0)throw new Error(_0x5a78('0x5f'));if(_0x2c0ea0['role']===_0x5a78('0x5e')){var _0x978f25=_0xc5e941['get']({'plain':!![]});var _0x3203cc=_0x5a78('0x36');return db[_0x5a78('0x60')][_0x5a78('0x55')]({'where':{'name':_0x3203cc,'userProfileId':_0x2c0ea0[_0x5a78('0x61')]},'raw':!![]})[_0x5a78('0x21')](function(_0x57bccc){if(_0x57bccc&&_0x57bccc['autoAssociation']===0x0){return db['UserProfileResource'][_0x5a78('0x5d')]({'name':_0x978f25[_0x5a78('0x3a')],'resourceId':_0x978f25['id'],'type':_0x57bccc['name'],'sectionId':_0x57bccc['id']},{})[_0x5a78('0x21')](function(){return _0xc5e941;});}else{return _0xc5e941;}})[_0x5a78('0x2a')](function(_0x471586){logger[_0x5a78('0x26')](_0x5a78('0x62'),_0x471586);throw _0x471586;});}return _0xc5e941;});}})[_0x5a78('0x21')](respondWithResult(_0x5ddf61,0xc9))[_0x5a78('0x2a')](handleError(_0x5ddf61,null));};exports[_0x5a78('0x5d')]=function(_0x189170,_0x57d548,_0x5db633){var _0x5fb428;return db[_0x5a78('0x3d')][_0x5a78('0x5d')](_0x189170[_0x5a78('0x5b')],{'raw':!![]})[_0x5a78('0x21')](function(_0x5ed484){_0x5fb428=_0x5ed484;return db[_0x5a78('0x3d')][_0x5a78('0x53')]({'raw':!![]});})[_0x5a78('0x21')](function(_0x1b0e63){var _0x50d62d=fs[_0x5a78('0x63')](path[_0x5a78('0x64')](config[_0x5a78('0x65')],_0x5a78('0x66')),_0x5a78('0x67'));var _0x394b16=fs[_0x5a78('0x63')](path[_0x5a78('0x64')](config['root'],'server/files/templates/registry.ejs'),_0x5a78('0x67'));var _0x377e7d=ejs[_0x5a78('0x68')](_0x50d62d,{'trunks':_0x1b0e63||[]});fs[_0x5a78('0x69')](_0x5a78('0x6a'),_0x377e7d);if(_0x5fb428[_0x5a78('0x6b')]){var _0x38abb8=ejs['render'](_0x394b16,{'trunks':_0x1b0e63||[]});fs[_0x5a78('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x38abb8);}})['then'](function(){return respondWithRpcPromise(_0x5a78('0x6c'),_0x5a78('0x5d'),{'module':_0x5a78('0x6d')});})[_0x5a78('0x21')](function(){var _0xb61dd7=_0x189170[_0x5a78('0x5e')][_0x5a78('0x35')]({'plain':!![]});if(!_0xb61dd7)throw new Error(_0x5a78('0x5f'));if(_0xb61dd7[_0x5a78('0x6e')]==='user'){var _0x55ee5c=_0x5fb428[_0x5a78('0x35')]({'plain':!![]});return db[_0x5a78('0x60')][_0x5a78('0x55')]({'where':{'name':'Trunks','userProfileId':_0xb61dd7[_0x5a78('0x61')]},'raw':!![]})[_0x5a78('0x21')](function(_0x276523){if(_0x276523&&_0x276523['autoAssociation']===0x0){return db[_0x5a78('0x37')][_0x5a78('0x5d')]({'name':_0x55ee5c[_0x5a78('0x3a')],'resourceId':_0x55ee5c['id'],'type':_0x276523[_0x5a78('0x3a')],'sectionId':_0x276523['id']},{})['then'](function(){return _0x5fb428;});}else{return _0x5fb428;}})[_0x5a78('0x2a')](function(_0x276980){logger['error'](_0x5a78('0x62'),_0x276980);throw _0x276980;});}return _0x5fb428;})[_0x5a78('0x21')](respondWithResult(_0x57d548,0xc9))[_0x5a78('0x2a')](handleError(_0x57d548,null));};exports[_0x5a78('0x34')]=function(_0x16c4d0,_0x4afc23,_0x1aabb8){var _0x1d63ec;return db[_0x5a78('0x3d')][_0x5a78('0x55')]({'where':{'id':_0x16c4d0[_0x5a78('0x57')]['id']}})['then'](handleEntityNotFound(_0x4afc23,null))[_0x5a78('0x21')](saveUpdates(_0x16c4d0['body'],null))[_0x5a78('0x21')](function(_0x4f280f){if(_0x4f280f){_0x1d63ec=_0x4f280f;return db[_0x5a78('0x3d')][_0x5a78('0x53')]({'raw':!![]});}})[_0x5a78('0x21')](function(_0x8e3c53){if(_0x8e3c53){var _0x4fca0a=fs[_0x5a78('0x63')](path[_0x5a78('0x64')](config[_0x5a78('0x65')],'server/files/templates/trunk.ejs'),'utf8');var _0x1195c8=fs[_0x5a78('0x63')](path['join'](config['root'],_0x5a78('0x6f')),'utf8');var _0x407bd0=ejs[_0x5a78('0x68')](_0x4fca0a,{'trunks':_0x8e3c53||[]});fs[_0x5a78('0x69')](_0x5a78('0x6a'),_0x407bd0);var _0x8ec5da=ejs[_0x5a78('0x68')](_0x1195c8,{'trunks':_0x8e3c53||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x8ec5da);return respondWithRpcPromise('Reload','update',{'module':_0x5a78('0x6d')});}return null;})[_0x5a78('0x21')](function(_0x15b7e1){if(_0x15b7e1){return _0x1d63ec;}})['then'](respondWithResult(_0x4afc23,null))[_0x5a78('0x2a')](handleError(_0x4afc23,null));};exports[_0x5a78('0x38')]=function(_0x2bd017,_0x2296cb,_0x36cbd0){var _0x51031c;return db['Trunk'][_0x5a78('0x55')]({'where':{'id':_0x2bd017[_0x5a78('0x57')]['id']}})[_0x5a78('0x21')](handleEntityNotFound(_0x2296cb,null))[_0x5a78('0x21')](removeEntity(_0x2296cb,null))[_0x5a78('0x21')](function(){return db[_0x5a78('0x3d')][_0x5a78('0x53')]({'raw':!![]});})[_0x5a78('0x21')](function(_0x2ba25c){var _0x4f048c=fs[_0x5a78('0x63')](path['join'](config[_0x5a78('0x65')],_0x5a78('0x66')),_0x5a78('0x67'));var _0x1a6b46=fs[_0x5a78('0x63')](path['join'](config['root'],_0x5a78('0x6f')),_0x5a78('0x67'));var _0xdf9eed=ejs[_0x5a78('0x68')](_0x4f048c,{'trunks':_0x2ba25c});var _0x56e55e=ejs[_0x5a78('0x68')](_0x1a6b46,{'trunks':_0x2ba25c});fs[_0x5a78('0x69')](_0x5a78('0x6a'),_0xdf9eed);fs[_0x5a78('0x69')](_0x5a78('0x70'),_0x56e55e);return respondWithRpcPromise('Reload',_0x5a78('0x38'),{'module':_0x5a78('0x6d')});})[_0x5a78('0x2a')](handleError(_0x2296cb,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 05eb55c..7f25f90 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 _0xf878=['define','Trunk','tools_trunks','lodash','util','moment','request-promise','../../config/environment','exports'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xf878,0x6f));var _0x8f87=function(_0x55b91b,_0x3fd726){_0x55b91b=_0x55b91b-0x0;var _0x447d14=_0xf878[_0x55b91b];return _0x447d14;};'use strict';var _=require(_0x8f87('0x0'));var util=require(_0x8f87('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8f87('0x2'));var BPromise=require('bluebird');var rp=require(_0x8f87('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8f87('0x4'));var attributes=require('./trunk.attributes');module[_0x8f87('0x5')]=function(_0x18c08d,_0xf621e7){return _0x18c08d[_0x8f87('0x6')](_0x8f87('0x7'),attributes,{'tableName':_0x8f87('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0fa=['bluebird','path','rimraf','../../config/environment','define','tools_trunks','lodash','util','api'];(function(_0x5130f1,_0x4386bc){var _0x23bac3=function(_0x4f968a){while(--_0x4f968a){_0x5130f1['push'](_0x5130f1['shift']());}};_0x23bac3(++_0x4386bc);}(_0xa0fa,0xf9));var _0xaa0f=function(_0x299db5,_0x5ddafa){_0x299db5=_0x299db5-0x0;var _0x49e1ca=_0xa0fa[_0x299db5];return _0x49e1ca;};'use strict';var _=require(_0xaa0f('0x0'));var util=require(_0xaa0f('0x1'));var logger=require('../../config/logger')(_0xaa0f('0x2'));var moment=require('moment');var BPromise=require(_0xaa0f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa0f('0x4'));var rimraf=require(_0xaa0f('0x5'));var config=require(_0xaa0f('0x6'));var attributes=require('./trunk.attributes');module['exports']=function(_0xe3d26c,_0x57edb3){return _0xe3d26c[_0xaa0f('0x7')]('Trunk',attributes,{'tableName':_0xaa0f('0x8'),'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 f433d1a..eb82c05 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 _0xda2d=['../../config/environment','jayson/promise','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetTrunk','Trunk','findAll','options','raw','attributes','include','map','model','catch','find','where','ShowTrunk','util','moment','bluebird','randomstring','ioredis','rpc'];(function(_0x445024,_0x36dca6){var _0x5ab19a=function(_0x598957){while(--_0x598957){_0x445024['push'](_0x445024['shift']());}};_0x5ab19a(++_0x36dca6);}(_0xda2d,0x102));var _0xdda2=function(_0x93ff2c,_0x3881b6){_0x93ff2c=_0x93ff2c-0x0;var _0x408fa7=_0xda2d[_0x93ff2c];return _0x408fa7;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Trunk,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});}exports[_0xdda2('0x14')]=function(_0x1a3b35){var _0x335fb5=this;return new Promise(function(_0x2b6ee8,_0x8d44b7){return db[_0xdda2('0x15')][_0xdda2('0x16')]({'raw':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')][_0xdda2('0x18')]===undefined?!![]:![]:!![],'where':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['where']||null:null,'attributes':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x19')]||null:null,'limit':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['limit']||null:null,'include':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x1a3b35['options'][_0xdda2('0x1a')],function(_0xfda248){return{'model':db[_0xfda248[_0xdda2('0x1c')]],'as':_0xfda248['as'],'attributes':_0xfda248[_0xdda2('0x19')],'include':_0xfda248[_0xdda2('0x1a')]?_['map'](_0xfda248[_0xdda2('0x1a')],function(_0x4be5ea){return{'model':db[_0x4be5ea[_0xdda2('0x1c')]],'as':_0x4be5ea['as'],'attributes':_0x4be5ea[_0xdda2('0x19')],'include':_0x4be5ea['include']?_['map'](_0x4be5ea[_0xdda2('0x1a')],function(_0x4567e7){return{'model':db[_0x4567e7[_0xdda2('0x1c')]],'as':_0x4567e7['as'],'attributes':_0x4567e7['attributes']};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x5d26ae){logger[_0xdda2('0x12')](_0xdda2('0x14'),_0x1a3b35);logger[_0xdda2('0xd')](_0xdda2('0x14'),_0x1a3b35,JSON['stringify'](_0x5d26ae));_0x2b6ee8(_0x5d26ae);})[_0xdda2('0x1d')](function(_0x255bbc){logger['error'](_0xdda2('0x14'),_0x255bbc[_0xdda2('0x11')],_0x1a3b35);_0x8d44b7(_0x335fb5[_0xdda2('0x10')](0x1f4,_0x255bbc[_0xdda2('0x11')]));});});};exports['ShowTrunk']=function(_0x129eba){var _0x5e107f=this;return new Promise(function(_0x4b19b7,_0x1ca9f3){return db['Trunk'][_0xdda2('0x1e')]({'raw':_0x129eba['options']?_0x129eba['options']['raw']===undefined?!![]:![]:!![],'where':_0x129eba[_0xdda2('0x17')]?_0x129eba['options'][_0xdda2('0x1f')]||null:null,'attributes':_0x129eba['options']?_0x129eba['options']['attributes']||null:null,'include':_0x129eba[_0xdda2('0x17')]?_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')],function(_0x2bcfba){return{'model':db[_0x2bcfba[_0xdda2('0x1c')]],'as':_0x2bcfba['as'],'attributes':_0x2bcfba[_0xdda2('0x19')],'include':_0x2bcfba[_0xdda2('0x1a')]?_['map'](_0x2bcfba[_0xdda2('0x1a')],function(_0x4212da){return{'model':db[_0x4212da[_0xdda2('0x1c')]],'as':_0x4212da['as'],'attributes':_0x4212da[_0xdda2('0x19')],'include':_0x4212da[_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x4212da[_0xdda2('0x1a')],function(_0x5835cd){return{'model':db[_0x5835cd['model']],'as':_0x5835cd['as'],'attributes':_0x5835cd[_0xdda2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x40eb19){logger['info']('ShowTrunk',_0x129eba);logger[_0xdda2('0xd')](_0xdda2('0x20'),_0x129eba,JSON[_0xdda2('0xf')](_0x40eb19));_0x4b19b7(_0x40eb19);})[_0xdda2('0x1d')](function(_0x246001){logger['error'](_0xdda2('0x20'),_0x246001[_0xdda2('0x11')],_0x129eba);_0x1ca9f3(_0x5e107f['error'](0x1f4,_0x246001['message']));});});}; \ No newline at end of file +var _0x14a0=['limit','include','model','map','find','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes'];(function(_0x115683,_0x4a1c36){var _0x5715b0=function(_0x17a343){while(--_0x17a343){_0x115683['push'](_0x115683['shift']());}};_0x5715b0(++_0x4a1c36);}(_0x14a0,0x8e));var _0x014a=function(_0x3b1839,_0x2c5125){_0x3b1839=_0x3b1839-0x0;var _0x48d3c4=_0x14a0[_0x3b1839];return _0x48d3c4;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Trunk,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Trunk,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Trunk,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')]({'raw':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x12d339['options']?_0x12d339[_0x014a('0x18')][_0x014a('0x1a')]||null:null,'attributes':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'limit':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1c')]||null:null,'include':_0x12d339[_0x014a('0x18')]?_0x12d339['options'][_0x014a('0x1d')]?_['map'](_0x12d339[_0x014a('0x18')][_0x014a('0x1d')],function(_0x44d921){return{'model':db[_0x44d921[_0x014a('0x1e')]],'as':_0x44d921['as'],'attributes':_0x44d921[_0x014a('0x1b')],'include':_0x44d921[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x44d921[_0x014a('0x1d')],function(_0x165a42){return{'model':db[_0x165a42['model']],'as':_0x165a42['as'],'attributes':_0x165a42[_0x014a('0x1b')],'include':_0x165a42['include']?_[_0x014a('0x1f')](_0x165a42[_0x014a('0x1d')],function(_0x4f1c44){return{'model':db[_0x4f1c44['model']],'as':_0x4f1c44['as'],'attributes':_0x4f1c44[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x014a('0xa')](function(_0x143346){logger['info'](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')]('GetTrunk',_0x12d339,JSON[_0x014a('0xd')](_0x143346));_0x263b07(_0x143346);})[_0x014a('0x14')](function(_0x496040){logger['error'](_0x014a('0x15'),_0x496040[_0x014a('0x11')],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x496040[_0x014a('0x11')]));});});};exports['ShowTrunk']=function(_0x434038){var _0x147e7e=this;return new Promise(function(_0x15af07,_0x402d3b){return db[_0x014a('0x16')][_0x014a('0x20')]({'raw':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')]['where']||null:null,'attributes':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'include':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x434038['options'][_0x014a('0x1d')],function(_0x325b3c){return{'model':db[_0x325b3c['model']],'as':_0x325b3c['as'],'attributes':_0x325b3c[_0x014a('0x1b')],'include':_0x325b3c[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x325b3c[_0x014a('0x1d')],function(_0x329136){return{'model':db[_0x329136[_0x014a('0x1e')]],'as':_0x329136['as'],'attributes':_0x329136[_0x014a('0x1b')],'include':_0x329136[_0x014a('0x1d')]?_['map'](_0x329136[_0x014a('0x1d')],function(_0x1dfe6e){return{'model':db[_0x1dfe6e[_0x014a('0x1e')]],'as':_0x1dfe6e['as'],'attributes':_0x1dfe6e[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x427c7a){logger[_0x014a('0x12')](_0x014a('0x21'),_0x434038);logger[_0x014a('0xb')](_0x014a('0x21'),_0x434038,JSON[_0x014a('0xd')](_0x427c7a));_0x15af07(_0x427c7a);})[_0x014a('0x14')](function(_0x36187b){logger[_0x014a('0xe')]('ShowTrunk',_0x36187b[_0x014a('0x11')],_0x434038);_0x402d3b(_0x147e7e['error'](0x1f4,_0x36187b[_0x014a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 1772870..c9888ab 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 _0xfbcb=['getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','/:id/queues','diskStorage','join','format','%s-%s','now','originalname','file','addAvatar','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/sms_accounts','addSmsAccounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','/:id/password','delete','removeQueues','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','/:id','show','/:id/avatar','getAvatar','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts'];(function(_0x5a852b,_0x1694c2){var _0xd74d84=function(_0x170a6d){while(--_0x170a6d){_0x5a852b['push'](_0x5a852b['shift']());}};_0xd74d84(++_0x1694c2);}(_0xfbcb,0x19e));var _0xbfbc=function(_0x1e25db,_0x3d9d8d){_0x1e25db=_0x1e25db-0x0;var _0x245fd4=_0xfbcb[_0x1e25db];return _0x245fd4;};'use strict';var multer=require(_0xbfbc('0x0'));var util=require(_0xbfbc('0x1'));var path=require(_0xbfbc('0x2'));var timeout=require(_0xbfbc('0x3'));var express=require(_0xbfbc('0x4'));var router=express[_0xbfbc('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbfbc('0x6'));var config=require(_0xbfbc('0x7'));var controller=require(_0xbfbc('0x8'));router[_0xbfbc('0x9')]('/',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0xb')]);router['get'](_0xbfbc('0xc'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0xd')]);router[_0xbfbc('0x9')](_0xbfbc('0xe'),auth[_0xbfbc('0xa')](),controller['whoami']);router[_0xbfbc('0x9')](_0xbfbc('0xf'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x10')]);router[_0xbfbc('0x9')](_0xbfbc('0x11'),controller[_0xbfbc('0x12')]);router['get']('/:id/contacts',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x13')]);router[_0xbfbc('0x9')]('/:id/queues',auth[_0xbfbc('0xa')](),controller['getQueues']);router[_0xbfbc('0x9')](_0xbfbc('0x14'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x15')]);router['get'](_0xbfbc('0x16'),auth[_0xbfbc('0xa')](),controller['getGroups']);router['get'](_0xbfbc('0x17'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x18')]);router[_0xbfbc('0x9')](_0xbfbc('0x19'),auth[_0xbfbc('0xa')](),controller['getScreenRecordings']);router[_0xbfbc('0x9')](_0xbfbc('0x1a'),auth['isAuthenticated'](),controller[_0xbfbc('0x1b')]);router[_0xbfbc('0x9')](_0xbfbc('0x1c'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x1d')]);router[_0xbfbc('0x9')](_0xbfbc('0x1e'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x1f')]);router[_0xbfbc('0x9')](_0xbfbc('0x20'),auth['isAuthenticated'](),controller[_0xbfbc('0x21')]);router[_0xbfbc('0x9')](_0xbfbc('0x22'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x23')]);router[_0xbfbc('0x9')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0xbfbc('0x24')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0xbfbc('0x25')]);router[_0xbfbc('0x9')](_0xbfbc('0x26'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x27')]);router[_0xbfbc('0x9')](_0xbfbc('0x28'),auth['isAuthenticated'](),controller[_0xbfbc('0x29')]);router[_0xbfbc('0x9')](_0xbfbc('0x2a'),auth[_0xbfbc('0xa')](),controller['getVoicePrefixes']);router[_0xbfbc('0x9')](_0xbfbc('0x2b'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x2c')]);router[_0xbfbc('0x9')](_0xbfbc('0x2d'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x2e')]);router[_0xbfbc('0x9')](_0xbfbc('0x2f'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x30')]);router[_0xbfbc('0x9')]('/:id/sms_accounts',auth[_0xbfbc('0xa')](),controller['getSmsAccounts']);router['get'](_0xbfbc('0x31'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x32')]);router['get']('/:id/whatsapp_accounts',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x33')]);router['get'](_0xbfbc('0x34'),auth['isAuthenticated'](),controller['getSquareProjects']);router[_0xbfbc('0x9')](_0xbfbc('0x35'),auth['isAuthenticated'](),controller[_0xbfbc('0x36')]);router[_0xbfbc('0x9')](_0xbfbc('0x37'),auth['isAuthenticated'](),controller[_0xbfbc('0x38')]);router[_0xbfbc('0x39')](_0xbfbc('0x3a'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x3b')]);router[_0xbfbc('0x39')]('/',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x3c')]);router['post'](_0xbfbc('0x3d'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x3e')]);router['post'](_0xbfbc('0x3f'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0xbfbc('0x40')]({'destination':function(_0x2c625f,_0x29c182,_0x1e9ef9){_0x1e9ef9(null,path[_0xbfbc('0x41')](config['root'],'server/files/images/'));},'filename':function(_0x54be7b,_0x354fbd,_0x49bbae){_0x49bbae(null,util[_0xbfbc('0x42')](_0xbfbc('0x43'),Date[_0xbfbc('0x44')](),_0x354fbd[_0xbfbc('0x45')]));}})});router[_0xbfbc('0x39')](_0xbfbc('0x11'),upload['single'](_0xbfbc('0x46')),controller[_0xbfbc('0x47')]);router[_0xbfbc('0x39')]('/:id/login',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x48')]);router[_0xbfbc('0x39')](_0xbfbc('0x49'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x4a')]);router[_0xbfbc('0x39')](_0xbfbc('0x4b'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x4c')]);router[_0xbfbc('0x39')](_0xbfbc('0x4d'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x4e')]);router['post'](_0xbfbc('0x4f'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x50')]);router['post'](_0xbfbc('0x51'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x52')]);router[_0xbfbc('0x39')](_0xbfbc('0x53'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x54')]);router[_0xbfbc('0x39')](_0xbfbc('0x55'),auth[_0xbfbc('0xa')](),controller['addFaxInteractions']);router[_0xbfbc('0x39')](_0xbfbc('0x56'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x57')]);router[_0xbfbc('0x39')](_0xbfbc('0x58'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x59')]);router[_0xbfbc('0x39')](_0xbfbc('0x5a'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x5b')]);router[_0xbfbc('0x39')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xbfbc('0x5c')]);router[_0xbfbc('0x39')]('/:id/mail_accounts',auth[_0xbfbc('0xa')](),controller['addMailAccounts']);router[_0xbfbc('0x39')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0xbfbc('0x39')](_0xbfbc('0x5d'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x5e')]);router[_0xbfbc('0x39')](_0xbfbc('0x31'),auth[_0xbfbc('0xa')](),controller['addChatWebsites']);router['post']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xbfbc('0x5f')]);router['post'](_0xbfbc('0x34'),auth['isAuthenticated'](),controller[_0xbfbc('0x60')]);router[_0xbfbc('0x39')](_0xbfbc('0x37'),auth['isAuthenticated'](),controller[_0xbfbc('0x61')]);router[_0xbfbc('0x62')](_0xbfbc('0xf'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x63')]);router[_0xbfbc('0x62')](_0xbfbc('0x64'),auth[_0xbfbc('0xa')](),controller['changePassword']);router[_0xbfbc('0x65')](_0xbfbc('0x3f'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x66')]);router['delete'](_0xbfbc('0x4f'),auth[_0xbfbc('0xa')](),controller['removeTeams']);router[_0xbfbc('0x65')]('/:id',auth[_0xbfbc('0xa')](),controller['destroy']);router[_0xbfbc('0x65')]('/:id/chat_interactions',auth[_0xbfbc('0xa')](),controller['removeChatInteractions']);router['delete'](_0xbfbc('0x53'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x67')]);router[_0xbfbc('0x65')](_0xbfbc('0x55'),auth['isAuthenticated'](),controller[_0xbfbc('0x68')]);router[_0xbfbc('0x65')](_0xbfbc('0x56'),auth[_0xbfbc('0xa')](),controller['removeSmsInteractions']);router[_0xbfbc('0x65')]('/:id/openchannel_interactions',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x69')]);router[_0xbfbc('0x65')](_0xbfbc('0x5a'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x6a')]);router[_0xbfbc('0x65')](_0xbfbc('0x2b'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x6b')]);router[_0xbfbc('0x65')](_0xbfbc('0x2d'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x6c')]);router[_0xbfbc('0x65')](_0xbfbc('0x2f'),auth[_0xbfbc('0xa')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x6d')]);router[_0xbfbc('0x65')]('/:id/chat_websites',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x6e')]);router[_0xbfbc('0x65')](_0xbfbc('0x6f'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x70')]);router[_0xbfbc('0x65')]('/:id/square_projects',auth[_0xbfbc('0xa')](),controller['removeSquareProjects']);router[_0xbfbc('0x65')](_0xbfbc('0x37'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x71')]);module[_0xbfbc('0x72')]=router; \ No newline at end of file +var _0xbbf3=['addOpenchannelInteractions','addFaxAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','put','update','/:id/password','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','/describe','isAuthenticated','describe','/whoami','/:id','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','diskStorage','join','root','format','single','file','addAvatar','/:id/logout','pause','/:id/unpause','unpause','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','/:id/openchannel_interactions'];(function(_0x436bb2,_0x3b5665){var _0x182bd8=function(_0x423bc9){while(--_0x423bc9){_0x436bb2['push'](_0x436bb2['shift']());}};_0x182bd8(++_0x3b5665);}(_0xbbf3,0xeb));var _0x3bbf=function(_0x64b622,_0xb458b9){_0x64b622=_0x64b622-0x0;var _0x376c49=_0xbbf3[_0x64b622];return _0x376c49;};'use strict';var multer=require(_0x3bbf('0x0'));var util=require('util');var path=require(_0x3bbf('0x1'));var timeout=require('connect-timeout');var express=require(_0x3bbf('0x2'));var router=express[_0x3bbf('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3bbf('0x4'));var config=require(_0x3bbf('0x5'));var controller=require(_0x3bbf('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3bbf('0x7')](_0x3bbf('0x8'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0xa')]);router[_0x3bbf('0x7')](_0x3bbf('0xb'),auth[_0x3bbf('0x9')](),controller['whoami']);router[_0x3bbf('0x7')](_0x3bbf('0xc'),auth[_0x3bbf('0x9')](),controller['show']);router[_0x3bbf('0x7')](_0x3bbf('0xd'),controller[_0x3bbf('0xe')]);router[_0x3bbf('0x7')](_0x3bbf('0xf'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x10')]);router[_0x3bbf('0x7')](_0x3bbf('0x11'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x12')]);router[_0x3bbf('0x7')]('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x3bbf('0x13')]);router[_0x3bbf('0x7')](_0x3bbf('0x14'),auth[_0x3bbf('0x9')](),controller['getGroups']);router[_0x3bbf('0x7')](_0x3bbf('0x15'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x16')]);router['get']('/:id/screen_recordings',auth[_0x3bbf('0x9')](),controller['getScreenRecordings']);router[_0x3bbf('0x7')]('/:id/chat/interactions',auth['isAuthenticated'](),controller['getChatInteractions']);router['get'](_0x3bbf('0x17'),auth['isAuthenticated'](),controller[_0x3bbf('0x18')]);router[_0x3bbf('0x7')](_0x3bbf('0x19'),auth['isAuthenticated'](),controller[_0x3bbf('0x1a')]);router[_0x3bbf('0x7')](_0x3bbf('0x1b'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x3bbf('0x7')](_0x3bbf('0x1c'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x1d')]);router['get'](_0x3bbf('0x1e'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x1f')]);router[_0x3bbf('0x7')](_0x3bbf('0x20'),auth[_0x3bbf('0x9')](),controller['getTeams']);router['get'](_0x3bbf('0x21'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x22')]);router[_0x3bbf('0x7')](_0x3bbf('0x23'),auth['isAuthenticated'](),controller[_0x3bbf('0x24')]);router['get'](_0x3bbf('0x25'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x26')]);router[_0x3bbf('0x7')](_0x3bbf('0x27'),auth[_0x3bbf('0x9')](),controller['getFaxAccounts']);router['get'](_0x3bbf('0x28'),auth['isAuthenticated'](),controller[_0x3bbf('0x29')]);router[_0x3bbf('0x7')](_0x3bbf('0x2a'),auth['isAuthenticated'](),controller[_0x3bbf('0x2b')]);router[_0x3bbf('0x7')]('/:id/sms_accounts',auth['isAuthenticated'](),controller['getSmsAccounts']);router['get'](_0x3bbf('0x2c'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x2d')]);router['get'](_0x3bbf('0x2e'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x2f')]);router[_0x3bbf('0x7')](_0x3bbf('0x30'),auth['isAuthenticated'](),controller[_0x3bbf('0x31')]);router[_0x3bbf('0x7')](_0x3bbf('0x32'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x33')]);router[_0x3bbf('0x7')](_0x3bbf('0x34'),auth['isAuthenticated'](),controller[_0x3bbf('0x35')]);router[_0x3bbf('0x36')](_0x3bbf('0xf'),auth[_0x3bbf('0x9')](),controller['addContacts']);router[_0x3bbf('0x36')]('/',auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x37')]);router['post'](_0x3bbf('0x38'),auth[_0x3bbf('0x9')](),controller['bulkCreate']);router[_0x3bbf('0x36')]('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x3bbf('0x39')]({'destination':function(_0x348ae0,_0x9d0455,_0xefcdd6){_0xefcdd6(null,path[_0x3bbf('0x3a')](config[_0x3bbf('0x3b')],'server/files/images/'));},'filename':function(_0x537d9d,_0x3b031c,_0x263363){_0x263363(null,util[_0x3bbf('0x3c')]('%s-%s',Date['now'](),_0x3b031c['originalname']));}})});router['post']('/:id/avatar',upload[_0x3bbf('0x3d')](_0x3bbf('0x3e')),controller[_0x3bbf('0x3f')]);router[_0x3bbf('0x36')]('/:id/login',auth[_0x3bbf('0x9')](),controller['login']);router['post'](_0x3bbf('0x40'),auth['isAuthenticated'](),controller['logout']);router['post']('/:id/pause',auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x41')]);router['post'](_0x3bbf('0x42'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x43')]);router[_0x3bbf('0x36')](_0x3bbf('0x20'),auth[_0x3bbf('0x9')](),controller['addTeams']);router[_0x3bbf('0x36')](_0x3bbf('0x44'),auth[_0x3bbf('0x9')](),controller['addChatInteractions']);router[_0x3bbf('0x36')](_0x3bbf('0x45'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x46')]);router[_0x3bbf('0x36')](_0x3bbf('0x47'),auth[_0x3bbf('0x9')](),controller['addFaxInteractions']);router['post'](_0x3bbf('0x48'),auth[_0x3bbf('0x9')](),controller['addSmsInteractions']);router[_0x3bbf('0x36')](_0x3bbf('0x49'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x4a')]);router['post']('/:id/whatsapp_interactions',auth[_0x3bbf('0x9')](),controller['addWhatsappInteractions']);router[_0x3bbf('0x36')](_0x3bbf('0x27'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x4b')]);router[_0x3bbf('0x36')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['addMailAccounts']);router['post'](_0x3bbf('0x2a'),auth['isAuthenticated'](),controller[_0x3bbf('0x4c')]);router['post'](_0x3bbf('0x4d'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x4e')]);router[_0x3bbf('0x36')](_0x3bbf('0x2c'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x4f')]);router['post']('/:id/whatsapp_accounts',auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x50')]);router[_0x3bbf('0x36')](_0x3bbf('0x30'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x51')]);router['post']('/:id/api_key',auth[_0x3bbf('0x9')](),controller['createApiKey']);router[_0x3bbf('0x52')](_0x3bbf('0xc'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x53')]);router[_0x3bbf('0x52')](_0x3bbf('0x54'),auth['isAuthenticated'](),controller['changePassword']);router['delete'](_0x3bbf('0x11'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x55')]);router[_0x3bbf('0x56')]('/:id/teams',auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x57')]);router[_0x3bbf('0x56')](_0x3bbf('0xc'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x58')]);router[_0x3bbf('0x56')](_0x3bbf('0x44'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x59')]);router['delete'](_0x3bbf('0x45'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x5a')]);router[_0x3bbf('0x56')]('/:id/fax_interactions',auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x5b')]);router[_0x3bbf('0x56')]('/:id/sms_interactions',auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x5c')]);router[_0x3bbf('0x56')](_0x3bbf('0x49'),auth[_0x3bbf('0x9')](),controller['removeOpenchannelInteractions']);router[_0x3bbf('0x56')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x3bbf('0x5d')]);router['delete'](_0x3bbf('0x27'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x5e')]);router['delete'](_0x3bbf('0x28'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x5f')]);router[_0x3bbf('0x56')](_0x3bbf('0x2a'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x60')]);router[_0x3bbf('0x56')](_0x3bbf('0x4d'),auth['isAuthenticated'](),controller[_0x3bbf('0x61')]);router[_0x3bbf('0x56')](_0x3bbf('0x2c'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x62')]);router['delete'](_0x3bbf('0x2e'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x63')]);router[_0x3bbf('0x56')](_0x3bbf('0x30'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x64')]);router[_0x3bbf('0x56')](_0x3bbf('0x34'),auth[_0x3bbf('0x9')](),controller[_0x3bbf('0x65')]);module[_0x3bbf('0x66')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index f7c37a8..f5933d3 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 _0x3ae5=['user','telephone','local','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','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','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','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]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','passive','update','update,nonat','showWebBar','get','isArray','encryption','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','wss','actpass','dtlscertfile','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3ae5,0xfc));var _0x53ae=function(_0x459ca3,_0x40be58){_0x459ca3=_0x459ca3-0x0;var _0x3a75ca=_0x3ae5[_0x459ca3];return _0x3a75ca;};'use strict';var Sequelize=require(_0x53ae('0x0'));var moment=require('moment');var util=require('util');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x53ae('0x1')],'allowNull':![],'unique':_0x53ae('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x248ada){this[_0x53ae('0x3')](_0x53ae('0x2'),_0x248ada);this['setDataValue'](_0x53ae('0x4'),_0x248ada);},'comment':_0x53ae('0x5')},'fullname':{'type':Sequelize[_0x53ae('0x1')],'allowNull':![],'set':function(_0x386ed1){this[_0x53ae('0x3')](_0x53ae('0x6'),_0x386ed1);this[_0x53ae('0x3')](_0x53ae('0x7'),util['format'](_0x53ae('0x8'),_0x386ed1,this[_0x53ae('0x9')](_0x53ae('0xa'))));}},'alias':{'type':Sequelize[_0x53ae('0x1')]},'email':{'type':Sequelize[_0x53ae('0x1')],'allowNull':![],'unique':_0x53ae('0xb'),'validate':{'isEmail':!![]},'set':function(_0x34feb0){if(_0x34feb0){this[_0x53ae('0x3')]('email',_0x34feb0[_0x53ae('0xc')]());}}},'role':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0xe'),_0x53ae('0xf'),'agent',_0x53ae('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x53ae('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x53ae('0x1')],'defaultValue':_0x53ae('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x53ae('0xa'),'set':function(_0x1a4e04){this[_0x53ae('0x3')](_0x53ae('0xa'),_0x1a4e04);this[_0x53ae('0x3')]('accountcode',_0x1a4e04);this[_0x53ae('0x3')](_0x53ae('0x7'),util[_0x53ae('0x12')](_0x53ae('0x8'),this[_0x53ae('0x9')](_0x53ae('0x6')),_0x1a4e04));}},'salt':{'type':Sequelize[_0x53ae('0x1')]},'phone':{'type':Sequelize[_0x53ae('0x1')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x53ae('0x1')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x53ae('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x53ae('0x14')]},'voicePause':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x53ae('0x1')],'defaultValue':_0x53ae('0x15')},'lastPauseAt':{'type':Sequelize[_0x53ae('0x14')]},'chatCapacity':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x53ae('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x53ae('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x53ae('0x17')},'ipaddr':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x18'),_0x53ae('0xf'),_0x53ae('0x19')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![],'defaultValue':_0x53ae('0x1a')},'callingpres':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x1b'),_0x53ae('0x1c'),_0x53ae('0x1d'),'ALLOWED','PROHIB_NOT_SCREENED',_0x53ae('0x1e'),_0x53ae('0x1f'),_0x53ae('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'permit':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'secret':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x53ae('0x21'),'set':function(_0x5ac050){this[_0x53ae('0x3')](_0x53ae('0x22'),_0x5ac050?_0x5ac050[_0x53ae('0x23')](','):null);},'get':function(){return this['getDataValue'](_0x53ae('0x22'))?this[_0x53ae('0x9')](_0x53ae('0x22'))[_0x53ae('0x24')](','):null;},'comment':_0x53ae('0x25')},'dtmfmode':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x26'),_0x53ae('0x27'),_0x53ae('0x28'),_0x53ae('0x29'),_0x53ae('0x2a')),'allowNull':!![],'defaultValue':_0x53ae('0x26')},'directmedia':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no',_0x53ae('0x2c'),'update',_0x53ae('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![],'defaultValue':_0x53ae('0x2e'),'set':function(_0x2fb607){this[_0x53ae('0x3')]('nat',_0x2fb607?_0x2fb607[_0x53ae('0x23')](','):null);},'get':function(){return this[_0x53ae('0x9')](_0x53ae('0x2f'))?this[_0x53ae('0x9')](_0x53ae('0x2f'))[_0x53ae('0x24')](','):null;},'comment':_0x53ae('0x30')},'callgroup':{'type':Sequelize[_0x53ae('0x1')]},'namedcallgroup':{'type':Sequelize[_0x53ae('0x1')]},'pickupgroup':{'type':Sequelize[_0x53ae('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x53ae('0x1')]},'disallow':{'type':Sequelize[_0x53ae('0x1')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x53ae('0x31'),'set':function(_0x3323db){this[_0x53ae('0x3')](_0x53ae('0x32'),_0x3323db?_0x3323db[_0x53ae('0x23')](';'):_0x53ae('0x31'));},'get':function(){return this[_0x53ae('0x9')](_0x53ae('0x32'))?this[_0x53ae('0x9')]('allow')[_0x53ae('0x24')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x53ae('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![],'set':function(_0x4417f6){this[_0x53ae('0x3')]('insecure',_0x4417f6?_0x4417f6[_0x53ae('0x23')](','):null);},'get':function(){return this[_0x53ae('0x9')](_0x53ae('0x33'))?this[_0x53ae('0x9')](_0x53ae('0x33'))[_0x53ae('0x24')](','):null;},'comment':_0x53ae('0x34')},'trustrpid':{'type':Sequelize['ENUM'](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x53ae('0xd')]('yes','no',_0x53ae('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x53ae('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![],'defaultValue':_0x53ae('0x36')},'amaflags':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x53ae('0x2b')},'busylevel':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x53ae('0xd')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x53ae('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x53ae('0xd')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no',_0x53ae('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x53ae('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x38'),_0x53ae('0x39'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x3a'),_0x53ae('0x3b')),'allowNull':!![],'defaultValue':_0x53ae('0x3b')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x53ae('0x2b')},'keepalive':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x53ae('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x53ae('0xd')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x53ae('0xd')]('yes','no',_0x53ae('0x3c'),_0x53ae('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x53ae('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x53ae('0xd')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x53ae('0xd')]('yes','no',_0x53ae('0x2c'),_0x53ae('0x3f'),_0x53ae('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x53ae('0x1')]},'resetPasswordExpires':{'type':Sequelize[_0x53ae('0x14')]},'passwordResetAt':{'type':Sequelize[_0x53ae('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x53ae('0x1')]},'showWebBar':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x0,'set':function(_0x1c31be){this[_0x53ae('0x3')](_0x53ae('0x41'),_0x1c31be);var _0x4a4d65=this[_0x53ae('0x42')]({'plain':!![]});switch(_0x1c31be){case 0x0:case 0x1:var _0x56190b=_0x4a4d65[_0x53ae('0x22')]?_[_0x53ae('0x43')](_0x4a4d65[_0x53ae('0x22')])?_0x4a4d65['transport'][_0x53ae('0x23')]():_0x4a4d65[_0x53ae('0x22')]:_0x53ae('0x21');if(_0x56190b==='wss'){_0x56190b=_0x53ae('0x21');}this[_0x53ae('0x3')]('transport',_0x56190b);this[_0x53ae('0x3')](_0x53ae('0x44'),'no');this[_0x53ae('0x3')]('avpf',null);this[_0x53ae('0x3')](_0x53ae('0x45'),null);this[_0x53ae('0x3')]('icesupport',null);this[_0x53ae('0x3')](_0x53ae('0x46'),null);this[_0x53ae('0x3')](_0x53ae('0x47'),null);this[_0x53ae('0x3')](_0x53ae('0x48'),null);this[_0x53ae('0x3')]('dtlscertfile',null);this[_0x53ae('0x3')](_0x53ae('0x49'),null);this[_0x53ae('0x3')](_0x53ae('0x4a'),'no');break;case 0x2:this['setDataValue']('transport',_0x53ae('0x4b'));this[_0x53ae('0x3')](_0x53ae('0x44'),_0x53ae('0x2b'));this[_0x53ae('0x3')]('avpf',_0x53ae('0x2b'));this[_0x53ae('0x3')](_0x53ae('0x45'),_0x53ae('0x2b'));this[_0x53ae('0x3')]('icesupport',_0x53ae('0x2b'));this['setDataValue'](_0x53ae('0x46'),'yes');this[_0x53ae('0x3')]('dtlsverify','no');this[_0x53ae('0x3')](_0x53ae('0x48'),_0x53ae('0x4c'));this[_0x53ae('0x3')](_0x53ae('0x4d'),_0x4a4d65[_0x53ae('0x4d')]||'/etc/pki/tls/certs/motion.crt');this[_0x53ae('0x3')](_0x53ae('0x49'),_0x4a4d65[_0x53ae('0x49')]||_0x53ae('0x4e'));this[_0x53ae('0x3')](_0x53ae('0x4a'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x5790b7){this[_0x53ae('0x3')](_0x53ae('0x4f'),_0x5790b7?_0x5790b7[_0x53ae('0x23')](','):[]);},'get':function(){return this[_0x53ae('0x9')](_0x53ae('0x4f'))?_[_0x53ae('0x50')](this['getDataValue'](_0x53ae('0x4f'))[_0x53ae('0x24')](','),function(_0x473ba1){return parseInt(_0x473ba1,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x53ae('0x1')]},'phoneBarBusyNumber':{'type':Sequelize[_0x53ae('0x1')]},'phoneBarUnconditional':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x53ae('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x53ae('0x1')]},'phoneBarEnableJaws':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x53ae('0x51')],'get':function(){return this[_0x53ae('0x9')]('phoneBarEnableScreenRecordingByAgent')?this[_0x53ae('0x9')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x13466a){if(typeof _0x13466a===_0x53ae('0x52')){var _0xf3fbdb=_0x13466a==='1'?!![]:_0x13466a==='0'?![]:_0x13466a===_0x53ae('0x53')?!![]:_0x13466a===_0x53ae('0x54')?![]:![];this[_0x53ae('0x3')](_0x53ae('0x55'),_0xf3fbdb);}else{this[_0x53ae('0x3')](_0x53ae('0x55'),_0x13466a);}}},'blocked':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![],'set':function(_0x2b362c){this['setDataValue'](_0x53ae('0x56'),_0x2b362c);if(_0x2b362c===!![]){this[_0x53ae('0x3')](_0x53ae('0x57'),moment());this['setDataValue'](_0x53ae('0x58'),0x0);}else{this[_0x53ae('0x3')](_0x53ae('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x53ae('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x9209=['/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','format','getDataValue','email','ENUM','admin','user','agent','telephone','local','INTEGER','internal','accountcode','callerid','\x22%s\x22\x20<%s>','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','split','info','inband','auto','rfc2833','yes','nonat','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','update','update,nonat','showWebBar','get','isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','dtlscertfile','/etc/pki/tls/certs/motion.crt'];(function(_0x452a19,_0x4ab5ca){var _0x1af440=function(_0xea9b33){while(--_0xea9b33){_0x452a19['push'](_0x452a19['shift']());}};_0x1af440(++_0x4ab5ca);}(_0x9209,0xc6));var _0x9920=function(_0x25791f,_0x508008){_0x25791f=_0x25791f-0x0;var _0x151b1b=_0x9209[_0x25791f];return _0x151b1b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9920('0x0'));var util=require(_0x9920('0x1'));var _=require(_0x9920('0x2'));module[_0x9920('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9920('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x37d4d1){this[_0x9920('0x5')](_0x9920('0x4'),_0x37d4d1);this[_0x9920('0x5')](_0x9920('0x6'),_0x37d4d1);},'comment':_0x9920('0x7')},'fullname':{'type':Sequelize[_0x9920('0x8')],'allowNull':![],'set':function(_0x1bbdbb){this['setDataValue'](_0x9920('0x9'),_0x1bbdbb);this[_0x9920('0x5')]('callerid',util[_0x9920('0xa')]('\x22%s\x22\x20<%s>',_0x1bbdbb,this[_0x9920('0xb')]('internal')));}},'alias':{'type':Sequelize[_0x9920('0x8')]},'email':{'type':Sequelize[_0x9920('0x8')],'allowNull':![],'unique':_0x9920('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58ee8f){if(_0x58ee8f){this['setDataValue'](_0x9920('0xc'),_0x58ee8f['toLowerCase']());}}},'role':{'type':Sequelize[_0x9920('0xd')](_0x9920('0xe'),_0x9920('0xf'),_0x9920('0x10'),_0x9920('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x9920('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9920('0x8')],'defaultValue':_0x9920('0x12')},'internal':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':![],'unique':_0x9920('0x14'),'set':function(_0x5d4a42){this['setDataValue'](_0x9920('0x14'),_0x5d4a42);this[_0x9920('0x5')](_0x9920('0x15'),_0x5d4a42);this[_0x9920('0x5')](_0x9920('0x16'),util['format'](_0x9920('0x17'),this[_0x9920('0xb')](_0x9920('0x9')),_0x5d4a42));}},'salt':{'type':Sequelize[_0x9920('0x8')]},'phone':{'type':Sequelize[_0x9920('0x8')]},'mobile':{'type':Sequelize[_0x9920('0x8')]},'address':{'type':Sequelize[_0x9920('0x8')]},'zipcode':{'type':Sequelize[_0x9920('0x8')]},'userpic':{'type':Sequelize[_0x9920('0x8')]},'city':{'type':Sequelize[_0x9920('0x8')]},'country':{'type':Sequelize[_0x9920('0x8')]},'online':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9920('0x8')],'defaultValue':_0x9920('0x19')},'lastPauseAt':{'type':Sequelize[_0x9920('0x1a')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9920('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x9920('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9920('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9920('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x9920('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'host':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![],'defaultValue':_0x9920('0x1b')},'ipaddr':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'port':{'type':Sequelize[_0x9920('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x1c'),_0x9920('0xf'),_0x9920('0x1d')),'allowNull':!![],'defaultValue':_0x9920('0x1c')},'context':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![],'defaultValue':_0x9920('0x1e')},'callingpres':{'type':Sequelize[_0x9920('0xd')]('ALLOWED_NOT_SCREENED',_0x9920('0x1f'),_0x9920('0x20'),_0x9920('0x21'),_0x9920('0x22'),_0x9920('0x23'),_0x9920('0x24'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![],'defaultValue':'udp','set':function(_0x1df37e){this['setDataValue'](_0x9920('0x25'),_0x1df37e?_0x1df37e['join'](','):null);},'get':function(){return this[_0x9920('0xb')](_0x9920('0x25'))?this['getDataValue'](_0x9920('0x25'))[_0x9920('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x9920('0xd')]('rfc2833',_0x9920('0x27'),'shortinfo',_0x9920('0x28'),_0x9920('0x29')),'allowNull':!![],'defaultValue':_0x9920('0x2a')},'directmedia':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no',_0x9920('0x2c'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'nat':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![],'defaultValue':_0x9920('0x2d'),'set':function(_0x147a69){this[_0x9920('0x5')](_0x9920('0x2e'),_0x147a69?_0x147a69[_0x9920('0x2f')](','):null);},'get':function(){return this['getDataValue'](_0x9920('0x2e'))?this[_0x9920('0xb')](_0x9920('0x2e'))[_0x9920('0x26')](','):null;},'comment':_0x9920('0x30')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9920('0x8')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x9920('0x8')]},'language':{'type':Sequelize[_0x9920('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x9920('0x8')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x9920('0x8')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x56daad){this[_0x9920('0x5')](_0x9920('0x31'),_0x56daad?_0x56daad[_0x9920('0x2f')](';'):_0x9920('0x32'));},'get':function(){return this['getDataValue'](_0x9920('0x31'))?this['getDataValue']('allow')[_0x9920('0x26')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x9920('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x29a700){this[_0x9920('0x5')](_0x9920('0x33'),_0x29a700?_0x29a700['join'](','):null);},'get':function(){return this['getDataValue'](_0x9920('0x33'))?this[_0x9920('0xb')](_0x9920('0x33'))['split'](','):null;},'comment':_0x9920('0x34')},'trustrpid':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x9920('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![],'defaultValue':_0x9920('0x35')},'amaflags':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x9920('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x9920('0x2b')},'busylevel':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x9920('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x9920('0xd')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no',_0x9920('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x9920('0xd')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9920('0xd')]('accept',_0x9920('0x37'),_0x9920('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x9920('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x9920('0x2b')},'keepalive':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9920('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x9920('0xd')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x9920('0xd')]('yes','no',_0x9920('0x3b'),_0x9920('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9920('0xd')]('active',_0x9920('0x3d'),_0x9920('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9920('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x9920('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9920('0xd')]('yes','no',_0x9920('0x2c'),_0x9920('0x3f'),_0x9920('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x9920('0x8')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x9920('0x1a')],'defaultValue':null},'previousPasswords':{'type':Sequelize['STRING']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x149738){this[_0x9920('0x5')](_0x9920('0x41'),_0x149738);var _0x2ab4aa=this[_0x9920('0x42')]({'plain':!![]});switch(_0x149738){case 0x0:case 0x1:var _0xe17702=_0x2ab4aa[_0x9920('0x25')]?_[_0x9920('0x43')](_0x2ab4aa[_0x9920('0x25')])?_0x2ab4aa[_0x9920('0x25')][_0x9920('0x2f')]():_0x2ab4aa[_0x9920('0x25')]:_0x9920('0x44');if(_0xe17702===_0x9920('0x45')){_0xe17702=_0x9920('0x44');}this[_0x9920('0x5')](_0x9920('0x25'),_0xe17702);this[_0x9920('0x5')](_0x9920('0x46'),'no');this[_0x9920('0x5')](_0x9920('0x47'),null);this['setDataValue'](_0x9920('0x48'),null);this[_0x9920('0x5')](_0x9920('0x49'),null);this[_0x9920('0x5')](_0x9920('0x4a'),null);this['setDataValue'](_0x9920('0x4b'),null);this[_0x9920('0x5')](_0x9920('0x4c'),null);this[_0x9920('0x5')]('dtlscertfile',null);this[_0x9920('0x5')](_0x9920('0x4d'),null);this[_0x9920('0x5')](_0x9920('0x4e'),'no');break;case 0x2:this['setDataValue'](_0x9920('0x25'),_0x9920('0x45'));this[_0x9920('0x5')]('encryption',_0x9920('0x2b'));this[_0x9920('0x5')](_0x9920('0x47'),_0x9920('0x2b'));this[_0x9920('0x5')](_0x9920('0x48'),_0x9920('0x2b'));this['setDataValue'](_0x9920('0x49'),_0x9920('0x2b'));this['setDataValue'](_0x9920('0x4a'),_0x9920('0x2b'));this[_0x9920('0x5')]('dtlsverify','no');this[_0x9920('0x5')](_0x9920('0x4c'),_0x9920('0x3e'));this['setDataValue'](_0x9920('0x4f'),_0x2ab4aa[_0x9920('0x4f')]||_0x9920('0x50'));this[_0x9920('0x5')](_0x9920('0x4d'),_0x2ab4aa[_0x9920('0x4d')]||_0x9920('0x51'));this[_0x9920('0x5')](_0x9920('0x4e'),_0x9920('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x9920('0x52')],'set':function(_0x2b0937){this[_0x9920('0x5')]('permissions',_0x2b0937?_0x2b0937[_0x9920('0x2f')](','):[]);},'get':function(){return this[_0x9920('0xb')](_0x9920('0x53'))?_[_0x9920('0x54')](this['getDataValue'](_0x9920('0x53'))[_0x9920('0x26')](','),function(_0x47b82b){return parseInt(_0x47b82b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x9920('0x8')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9920('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x9920('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9920('0xd')](_0x9920('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9920('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9920('0x8')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9920('0x55')],'get':function(){return this['getDataValue'](_0x9920('0x56'))?this[_0x9920('0xb')](_0x9920('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9920('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9920('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![],'set':function(_0x281079){if(typeof _0x281079===_0x9920('0x57')){var _0x5839c4=_0x281079==='1'?!![]:_0x281079==='0'?![]:_0x281079===_0x9920('0x58')?!![]:_0x281079===_0x9920('0x59')?![]:![];this[_0x9920('0x5')]('screenrecording',_0x5839c4);}else{this[_0x9920('0x5')](_0x9920('0x5a'),_0x281079);}}},'blocked':{'type':Sequelize[_0x9920('0x18')],'defaultValue':![],'set':function(_0x510234){this[_0x9920('0x5')]('blocked',_0x510234);if(_0x510234===!![]){this[_0x9920('0x5')](_0x9920('0x5b'),moment());this[_0x9920('0x5')](_0x9920('0x5c'),0x0);}else{this['setDataValue'](_0x9920('0x5b'),null);}}},'blockedAt':{'type':Sequelize[_0x9920('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9920('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x9920('0x18')],'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 5cee5da..300ed2f 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 _0xa4c2=['upsert','removeQueues','remove','Queues','Queue:remove','userpic','filename','getAvatar','join','root','server/files/images/','download','findOne','CmContact','order','getContacts','List','Tag','Tags','color','tag','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','headers','remoteAddress','connection','socket','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','QueuePause','DEFAULT\x20PAUSE','voicePause','chatPause','faxPause','smsPause','pauseType','lastPauseAt','unpause','manual','chat','fax','whatsapp','openchannel','%s%s','Pause','getTeams','addTeams','Team','setDataValue','Voice','getChatQueues','getMailQueues','Mail','getSmsQueues','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','flatten','transaction','getDataValue','Queue:save','removeTeams','Chat','Sms','Openchannel','removeAgent','CmList','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','firstName','lastName','Contact','dialActive','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','html-pdf','rimraf','fast-json-patch','request-promise','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./user.socket','jayson/promise','client','request','info','debug','stringify','error','code','User,\x20%s,\x20%s','message','request\x20sent','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','admin','Agents','agent','telephone','filter','map','value','includes','role','UserProfileResource','stack','name','send','index','User','rawAttributes','type','model','differenceBy','salt','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','sequelize','col','options','includeAll','include','findAll','rows','catch','show','password','length','find','body','params','describe','addContacts','omit','internal','findById','securePassword','max','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','SELECT','from','voicemail','fullname','email','permissions','101','102','113','110','104','106','107','108','109','111','create','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','push','all','each','isEmpty','changePassword','oldPassword','Sequelize','authenticate','ValidationError','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','online','loginInPause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','ids','penalty','spread','QueueId','emit','voice','VoiceQueue','interface','format','SIP/%s','UserVoiceQueueRt'];(function(_0x1d1f04,_0x40cdae){var _0xba8258=function(_0x454d7a){while(--_0x454d7a){_0x1d1f04['push'](_0x1d1f04['shift']());}};_0xba8258(++_0x40cdae);}(_0xa4c2,0xc1));var _0x2a4c=function(_0x23db28,_0xb38d31){_0x23db28=_0x23db28-0x0;var _0x53e75a=_0xa4c2[_0x23db28];return _0x53e75a;};'use strict';var pdf=require(_0x2a4c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2a4c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a4c('0x2'));var rp=require(_0x2a4c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2a4c('0x4'));var util=require('util');var path=require(_0x2a4c('0x5'));var sox=require(_0x2a4c('0x6'));var csv=require('to-csv');var ejs=require(_0x2a4c('0x7'));var fs=require('fs');var _=require(_0x2a4c('0x8'));var squel=require(_0x2a4c('0x9'));var crypto=require(_0x2a4c('0xa'));var jsforce=require(_0x2a4c('0xb'));var deskjs=require(_0x2a4c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2a4c('0xd'));var Papa=require(_0x2a4c('0xe'));var Redis=require(_0x2a4c('0xf'));var authService=require(_0x2a4c('0x10'));var qs=require(_0x2a4c('0x11'));var as=require(_0x2a4c('0x12'));var hardwareService=require(_0x2a4c('0x13'));var logger=require('../../config/logger')(_0x2a4c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2a4c('0x15'));var db=require(_0x2a4c('0x16'))['db'];config['redis']=_[_0x2a4c('0x17')](config[_0x2a4c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x2a4c('0x19'))(new Redis(config['redis']));require(_0x2a4c('0x1a'))['register'](socket);var jayson=require(_0x2a4c('0x1b'));var client=jayson[_0x2a4c('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x272a4a,_0xa1bca6,_0x4e39d6,_0x2df708){return new BPromise(function(_0x391629,_0x27f81a){var _0x47921d=_0x2df708||client;return _0x47921d[_0x2a4c('0x1d')](_0x272a4a,_0x4e39d6)['then'](function(_0x217732){logger[_0x2a4c('0x1e')]('User,\x20%s,\x20%s',_0xa1bca6,'request\x20sent');logger[_0x2a4c('0x1f')]('User,\x20%s,\x20%s,\x20%s',_0xa1bca6,'request\x20sent',JSON[_0x2a4c('0x20')](_0x217732));if(_0x217732['error']){if(_0x217732[_0x2a4c('0x21')][_0x2a4c('0x22')]===0x1f4){logger['error'](_0x2a4c('0x23'),_0xa1bca6,_0x217732['error'][_0x2a4c('0x24')]);return _0x27f81a(_0x217732[_0x2a4c('0x21')][_0x2a4c('0x24')]);}logger['error'](_0x2a4c('0x23'),_0xa1bca6,_0x217732[_0x2a4c('0x21')][_0x2a4c('0x24')]);return _0x391629(_0x217732[_0x2a4c('0x21')][_0x2a4c('0x24')]);}else{logger['info']('User,\x20%s,\x20%s',_0xa1bca6,_0x2a4c('0x25'));_0x391629(_0x217732[_0x2a4c('0x26')]['message']);}})['catch'](function(_0xd381cf){logger[_0x2a4c('0x21')](_0x2a4c('0x23'),_0xa1bca6,_0xd381cf);_0x27f81a(_0xd381cf);});});}function respondWithStatusCode(_0x561045,_0x3be947){_0x3be947=_0x3be947||0xcc;return function(_0x1524be){if(_0x1524be){return _0x561045[_0x2a4c('0x27')](_0x3be947);}return _0x561045[_0x2a4c('0x28')](_0x3be947)[_0x2a4c('0x29')]();};}function respondWithResult(_0x14fb3e,_0x2f462c){_0x2f462c=_0x2f462c||0xc8;return function(_0x1275d6){if(_0x1275d6){return _0x14fb3e[_0x2a4c('0x28')](_0x2f462c)[_0x2a4c('0x2a')](_0x1275d6);}};}function respondWithFilteredResult(_0x2201cc,_0x433729){return function(_0x5b3466){if(_0x5b3466){var _0x17f12b=_0x5b3466[_0x2a4c('0x2b')],_0x233d3c=_0x433729[_0x2a4c('0x2c')],_0x595366=_0x433729[_0x2a4c('0x2c')]+_0x433729[_0x2a4c('0x2d')],_0x247916;if(_0x595366>=_0x17f12b){_0x595366=_0x17f12b;_0x247916=0xc8;}else{_0x247916=0xce;}_0x2201cc[_0x2a4c('0x28')](_0x247916);return _0x2201cc[_0x2a4c('0x2e')](_0x2a4c('0x2f'),_0x233d3c+'-'+_0x595366+'/'+_0x17f12b)[_0x2a4c('0x2a')](_0x5b3466);}return null;};}function patchUpdates(_0xc0f174){return function(_0x564ad9){try{jsonpatch[_0x2a4c('0x30')](_0x564ad9,_0xc0f174,!![]);}catch(_0x187fb6){return BPromise[_0x2a4c('0x31')](_0x187fb6);}return _0x564ad9['save']();};}function saveUpdates(_0x2757fb,_0x4288b4){return function(_0x4e0c9b){if(_0x4e0c9b){return _0x4e0c9b[_0x2a4c('0x32')](_0x2757fb)[_0x2a4c('0x33')](function(_0x543c1){return _0x543c1;});}return null;};}function removeEntity(_0x25b596,_0x1956ff){return function(_0xcdde3e){if(_0xcdde3e){return _0xcdde3e[_0x2a4c('0x34')]()[_0x2a4c('0x33')](function(){var _0x2036c2=_0xcdde3e[_0x2a4c('0x35')]({'plain':!![]});if(_0x2036c2['role']===_0x2a4c('0x36'))return;var _0x1af000=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x2a4c('0x37'),'value':_0x2a4c('0x38'),'ignore':![]},{'name':'Telephones','value':_0x2a4c('0x39'),'ignore':![]}];var _0x4360d2=_(_0x1af000)[_0x2a4c('0x3a')]('ignore')[_0x2a4c('0x3b')](_0x2a4c('0x3c'))[_0x2a4c('0x3c')]();if(_[_0x2a4c('0x3d')](_0x4360d2,_0x2036c2[_0x2a4c('0x3e')])){return;}var _0x1aa6f1=_['find'](_0x1af000,[_0x2a4c('0x3c'),_0x2036c2['role']])['name'];return db[_0x2a4c('0x3f')]['destroy']({'where':{'type':_0x1aa6f1,'resourceId':_0x2036c2['id']}})['then'](function(){return _0xcdde3e;});})[_0x2a4c('0x33')](function(){_0x25b596[_0x2a4c('0x28')](0xcc)[_0x2a4c('0x29')]();});}};}function handleEntityNotFound(_0x329880,_0x57deca){return function(_0x50a17e){if(!_0x50a17e){_0x329880[_0x2a4c('0x27')](0x194);}return _0x50a17e;};}function handleError(_0x1c94d4,_0x19b6b6){_0x19b6b6=_0x19b6b6||0x1f4;return function(_0xe4fdca){logger[_0x2a4c('0x21')](_0xe4fdca[_0x2a4c('0x40')]);if(_0xe4fdca[_0x2a4c('0x41')]){delete _0xe4fdca[_0x2a4c('0x41')];}_0x1c94d4[_0x2a4c('0x28')](_0x19b6b6)[_0x2a4c('0x42')](_0xe4fdca);};}exports[_0x2a4c('0x43')]=function(_0x486fe6,_0x308698){var _0x3f0078={},_0x2eab91={},_0x2f8fe8={'count':0x0,'rows':[]};var _0x2ba413=_[_0x2a4c('0x3b')](db[_0x2a4c('0x44')][_0x2a4c('0x45')],function(_0x19bcad){return{'name':_0x19bcad['fieldName'],'type':_0x19bcad[_0x2a4c('0x46')]['key']};});_0x2eab91[_0x2a4c('0x47')]=_[_0x2a4c('0x48')](_[_0x2a4c('0x3b')](_0x2ba413,_0x2a4c('0x41')),['password',_0x2a4c('0x49')]);_0x2eab91[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x486fe6['query']);_0x2eab91[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x2eab91[_0x2a4c('0x47')],_0x2eab91[_0x2a4c('0x4a')]);_0x3f0078['attributes']=_[_0x2a4c('0x4d')](_0x2eab91['model'],qs[_0x2a4c('0x4e')](_0x486fe6[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x3f0078[_0x2a4c('0x4f')]=_0x3f0078['attributes']['length']?_0x3f0078[_0x2a4c('0x4f')]:_0x2eab91['model'];if(!_0x486fe6['query'][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x3f0078['limit']=qs[_0x2a4c('0x2d')](_0x486fe6[_0x2a4c('0x4a')][_0x2a4c('0x2d')]);_0x3f0078[_0x2a4c('0x2c')]=qs['offset'](_0x486fe6[_0x2a4c('0x4a')]['offset']);}_0x3f0078['order']=qs['sort'](_0x486fe6['query'][_0x2a4c('0x52')]);_0x3f0078[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x486fe6[_0x2a4c('0x4a')],_0x2eab91[_0x2a4c('0x4c')]),_0x2ba413);if(_0x486fe6[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x3f0078[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x3f0078['where'],{'$or':_[_0x2a4c('0x3b')](_0x2ba413,function(_0x133ca7){if(_0x133ca7[_0x2a4c('0x46')]!==_0x2a4c('0x56')){return db[_0x2a4c('0x57')][_0x2a4c('0x53')](db['sequelize']['fn']('lower',db[_0x2a4c('0x57')][_0x2a4c('0x58')](_0x133ca7[_0x2a4c('0x41')])),{'$like':db[_0x2a4c('0x57')]['fn']('lower','%'+_0x486fe6[_0x2a4c('0x4a')][_0x2a4c('0x3a')]+'%')});}})});}_0x3f0078=_[_0x2a4c('0x55')]({},_0x3f0078,_0x486fe6[_0x2a4c('0x59')]);var _0x17a332={'where':_0x3f0078[_0x2a4c('0x53')]};return db[_0x2a4c('0x44')][_0x2a4c('0x2b')](_0x17a332)['then'](function(_0x5e67d8){_0x2f8fe8[_0x2a4c('0x2b')]=_0x5e67d8;if(_0x486fe6['query'][_0x2a4c('0x5a')]){_0x3f0078[_0x2a4c('0x5b')]=[{'all':!![]}];}return db['User'][_0x2a4c('0x5c')](_0x3f0078);})[_0x2a4c('0x33')](function(_0x2205e9){_0x2f8fe8[_0x2a4c('0x5d')]=_0x2205e9;return _0x2f8fe8;})[_0x2a4c('0x33')](respondWithFilteredResult(_0x308698,_0x3f0078))[_0x2a4c('0x5e')](handleError(_0x308698,null));};exports[_0x2a4c('0x5f')]=function(_0x148787,_0x566a93){var _0xe1c829={'raw':![],'where':{'id':_0x148787['params']['id']}},_0x51452a={};_0x51452a['model']=_[_0x2a4c('0x48')](_['keys'](db[_0x2a4c('0x44')][_0x2a4c('0x45')]),[_0x2a4c('0x60'),'salt']);_0x51452a['query']=_[_0x2a4c('0x4b')](_0x148787[_0x2a4c('0x4a')]);_0x51452a[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x51452a['model'],_0x51452a[_0x2a4c('0x4a')]);_0xe1c829[_0x2a4c('0x4f')]=_[_0x2a4c('0x4d')](_0x51452a[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0x148787['query'][_0x2a4c('0x4e')]));_0xe1c829['attributes']=_0xe1c829[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0xe1c829[_0x2a4c('0x4f')]:_0x51452a[_0x2a4c('0x47')];if(_0x148787[_0x2a4c('0x4a')][_0x2a4c('0x5a')]){_0xe1c829[_0x2a4c('0x5b')]=[{'all':!![]}];}_0xe1c829=_[_0x2a4c('0x55')]({},_0xe1c829,_0x148787[_0x2a4c('0x59')]);return db['User'][_0x2a4c('0x62')](_0xe1c829)[_0x2a4c('0x33')](handleEntityNotFound(_0x566a93,null))[_0x2a4c('0x33')](respondWithResult(_0x566a93,null))[_0x2a4c('0x5e')](handleError(_0x566a93,null));};exports[_0x2a4c('0x32')]=function(_0x446d5e,_0x44ca34){if(_0x446d5e[_0x2a4c('0x63')]['id']){delete _0x446d5e[_0x2a4c('0x63')]['id'];}delete _0x446d5e[_0x2a4c('0x63')]['role'];return db[_0x2a4c('0x44')]['find']({'where':{'id':_0x446d5e[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x44ca34,null))[_0x2a4c('0x33')](saveUpdates(_0x446d5e[_0x2a4c('0x63')],null))[_0x2a4c('0x33')](respondWithResult(_0x44ca34,null))[_0x2a4c('0x5e')](handleError(_0x44ca34,null));};exports['describe']=function(_0x109357,_0x284d7c){return db[_0x2a4c('0x44')][_0x2a4c('0x65')]()[_0x2a4c('0x33')](respondWithResult(_0x284d7c,null))[_0x2a4c('0x5e')](handleError(_0x284d7c,null));};exports[_0x2a4c('0x66')]=function(_0x20951e,_0x7f06b0,_0x1b5b88){return db[_0x2a4c('0x44')]['find']({'where':{'id':_0x20951e[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x7f06b0,null))['then'](function(_0x3844df){if(_0x3844df){return _0x3844df['addContacts'](_0x20951e[_0x2a4c('0x63')]['ids'],_[_0x2a4c('0x67')](_0x20951e[_0x2a4c('0x63')],['ids','id'])||{});}})['then'](respondWithResult(_0x7f06b0,null))['catch'](handleError(_0x7f06b0,null));};function validateUser(_0x184345){return new BPromise(function(_0x4d64bb,_0x1c2896){if(_0x184345[_0x2a4c('0x68')])return _0x4d64bb(_0x184345);return db['Setting'][_0x2a4c('0x69')](0x1)[_0x2a4c('0x33')](function(_0x5abf4b){if(_0x5abf4b[_0x2a4c('0x6a')])authService['validatePasswordPattern'](_0x184345[_0x2a4c('0x60')]);db[_0x2a4c('0x44')][_0x2a4c('0x6b')](_0x2a4c('0x68'))[_0x2a4c('0x33')](function(_0x5a316c){if(_[_0x2a4c('0x6c')](_0x5a316c)){_0x184345[_0x2a4c('0x68')]=_0x5abf4b[_0x2a4c('0x6d')]||0x1;return;}if(_[_0x2a4c('0x6c')](_0x5abf4b['min_internal'])||_0x5abf4b[_0x2a4c('0x6d')]===_0x5a316c){_0x184345['internal']=_0x5a316c+0x1;return;}if(_0x5abf4b[_0x2a4c('0x6d')]>_0x5a316c){_0x184345[_0x2a4c('0x68')]=_0x5abf4b[_0x2a4c('0x6d')];return;}return db[_0x2a4c('0x57')][_0x2a4c('0x4a')](_0x2a4c('0x6e'),{'type':db[_0x2a4c('0x57')][_0x2a4c('0x6f')][_0x2a4c('0x70')]})[_0x2a4c('0x33')](function(_0x4afe5b){if(_0x4afe5b&&_0x4afe5b[_0x2a4c('0x61')]){for(var _0x10abd2=0x0,_0x36acd7=_0x4afe5b[_0x2a4c('0x61')];_0x10abd2<_0x36acd7&&_[_0x2a4c('0x6c')](_0x184345[_0x2a4c('0x68')]);_0x10abd2++){if(_0x5abf4b['min_internal']<=_0x4afe5b[_0x10abd2][_0x2a4c('0x71')]){_0x184345['internal']=_0x4afe5b[_0x10abd2]['from'];}else if(_0x5abf4b[_0x2a4c('0x6d')]>_0x4afe5b[_0x10abd2][_0x2a4c('0x71')]&&_0x5abf4b[_0x2a4c('0x6d')]<=_0x4afe5b[_0x10abd2]['to']){_0x184345['internal']=_0x5abf4b[_0x2a4c('0x6d')];}}}if(_[_0x2a4c('0x6c')](_0x184345[_0x2a4c('0x68')])){_0x184345['internal']=_0x5a316c+0x1;}return _0x4d64bb(_0x184345);});});})['catch'](function(_0x2cbddc){_0x1c2896(_0x2cbddc);});});}function updateUser(_0x246dc1){return new BPromise(function(_0x3c3520,_0x5a0742){try{if(_0x246dc1[_0x2a4c('0x72')]){_0x246dc1['mailbox']=_0x246dc1['internal'];_0x246dc1['VoiceMail']={'mailbox':_0x246dc1['internal'],'password':_0x246dc1['password'],'fullname':_0x246dc1[_0x2a4c('0x73')],'email':_0x246dc1[_0x2a4c('0x74')]};}if(_0x246dc1[_0x2a4c('0x3e')]==='agent'){if(!_0x246dc1[_0x2a4c('0x75')])_0x246dc1[_0x2a4c('0x75')]=[_0x2a4c('0x76'),_0x2a4c('0x77'),'103',_0x2a4c('0x78'),_0x2a4c('0x79'),_0x2a4c('0x7a'),'105',_0x2a4c('0x7b'),_0x2a4c('0x7c'),_0x2a4c('0x7d'),_0x2a4c('0x7e'),'100',_0x2a4c('0x7f'),'114'];}_0x3c3520(_0x246dc1);}catch(_0x122906){_0x5a0742(_0x122906);}});}exports[_0x2a4c('0x80')]=function(_0x53f31b,_0x452f5b){if(_0x53f31b[_0x2a4c('0x81')]['role']==='agent')throw new Error(_0x2a4c('0x82'));if(_0x53f31b[_0x2a4c('0x63')][_0x2a4c('0x3e')]===_0x2a4c('0x81')&&_0x53f31b[_0x2a4c('0x81')][_0x2a4c('0x3e')]!==_0x2a4c('0x36')){throw new Error(_0x2a4c('0x83'));}if(_0x53f31b[_0x2a4c('0x63')][_0x2a4c('0x3e')]===_0x2a4c('0x36')&&_0x53f31b['user'][_0x2a4c('0x3e')]!=='admin'){throw new Error(_0x2a4c('0x84'));}return licenseUtil[_0x2a4c('0x85')]([_0x53f31b[_0x2a4c('0x63')]])[_0x2a4c('0x33')](function(){return validateUser(_0x53f31b[_0x2a4c('0x63')]);})[_0x2a4c('0x33')](function(_0x5f3af1){return updateUser(_0x5f3af1)['then'](function(_0x4bef5f){if(_0x4bef5f[_0x2a4c('0x3e')]===_0x2a4c('0x36')){_0x4bef5f[_0x2a4c('0x86')]=_0x53f31b[_0x2a4c('0x81')][_0x2a4c('0x86')];delete _0x4bef5f[_0x2a4c('0x87')];}return _0x4bef5f;});})[_0x2a4c('0x33')](function(_0x28ac92){return db[_0x2a4c('0x44')][_0x2a4c('0x80')](_0x28ac92,{'include':[{'model':db[_0x2a4c('0x88')],'as':_0x2a4c('0x88')}]});})[_0x2a4c('0x33')](function(_0x39bb89){if(_0x53f31b[_0x2a4c('0x63')][_0x2a4c('0x3e')]===_0x2a4c('0x81'))return _0x39bb89;if(_0x53f31b[_0x2a4c('0x81')][_0x2a4c('0x3e')]!=='user')return _0x39bb89;return db[_0x2a4c('0x89')][_0x2a4c('0x62')]({'where':{'name':_0x39bb89['role']===_0x2a4c('0x38')?_0x2a4c('0x37'):_0x2a4c('0x8a'),'userProfileId':_0x53f31b[_0x2a4c('0x81')][_0x2a4c('0x87')]},'raw':!![]})[_0x2a4c('0x33')](function(_0x57df28){if(!_0x57df28||_0x57df28[_0x2a4c('0x8b')]!=0x0)return _0x39bb89;return db[_0x2a4c('0x3f')][_0x2a4c('0x80')]({'name':_0x39bb89[_0x2a4c('0x41')],'resourceId':_0x39bb89['id'],'type':_0x57df28[_0x2a4c('0x41')],'sectionId':_0x57df28['id']},{})[_0x2a4c('0x33')](function(){return _0x39bb89;});})[_0x2a4c('0x5e')](function(_0x1b38a4){logger[_0x2a4c('0x21')](_0x2a4c('0x8c'),_0x1b38a4);throw _0x1b38a4;});})[_0x2a4c('0x33')](respondWithResult(_0x452f5b,0xc9))['catch'](handleError(_0x452f5b,null));};exports[_0x2a4c('0x8d')]=function(_0x4e4f9e,_0x2e1ffb){var _0x202e16=_0x4e4f9e['body'];var _0x50c1c4=[];if(_0x4e4f9e['user']['role']==='agent')throw new Error('Unauthorized');if(_[_0x2a4c('0x8e')](_0x202e16,[_0x2a4c('0x3e'),'user'])&&_0x4e4f9e['user']['role']!==_0x2a4c('0x36')){throw new Error(_0x2a4c('0x83'));}if(_['some'](_0x202e16,[_0x2a4c('0x3e'),_0x2a4c('0x36')])&&_0x4e4f9e[_0x2a4c('0x81')][_0x2a4c('0x3e')]!==_0x2a4c('0x36')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x202e16)[_0x2a4c('0x33')](function(){return validateUser(_0x202e16[0x0]);})[_0x2a4c('0x33')](function(){for(var _0x16ad43=0x1;_0x16ad43<_0x202e16[_0x2a4c('0x61')];_0x16ad43++){var _0x3240ae=_0x202e16[_0x16ad43-0x1][_0x2a4c('0x68')];if(!_0x202e16[_0x16ad43][_0x2a4c('0x68')])_0x202e16[_0x16ad43]['internal']=_0x3240ae+0x1;_0x50c1c4[_0x2a4c('0x8f')](validateUser(_0x202e16[_0x16ad43]));}return BPromise[_0x2a4c('0x90')](_0x50c1c4);})[_0x2a4c('0x33')](function(){_0x50c1c4=[];for(var _0x2a7423=0x0;_0x2a7423<_0x202e16[_0x2a4c('0x61')];_0x2a7423++){_0x50c1c4[_0x2a4c('0x8f')](updateUser(_0x202e16[_0x2a7423]));}return BPromise[_0x2a4c('0x90')](_0x50c1c4);})[_0x2a4c('0x33')](function(){return BPromise[_0x2a4c('0x91')](_0x202e16,function(_0x5295da){return db[_0x2a4c('0x44')][_0x2a4c('0x80')](_0x5295da,{'include':[{'model':db[_0x2a4c('0x88')],'as':_0x2a4c('0x88')}]})[_0x2a4c('0x33')](function(_0x40dc03){_0x5295da['id']=_0x40dc03['id'];return _0x5295da;});});})[_0x2a4c('0x33')](function(_0x111c4c){if(_0x4e4f9e['body']['role']===_0x2a4c('0x81'))return _0x111c4c;if(_0x4e4f9e[_0x2a4c('0x81')][_0x2a4c('0x3e')]!=='user')return _0x111c4c;var _0x2cb13f=_[_0x2a4c('0x8e')](_0x111c4c,function(_0x249820){return _0x249820[_0x2a4c('0x3e')]===_0x2a4c('0x38')||_0x249820[_0x2a4c('0x3e')]===_0x2a4c('0x39');});if(!_0x2cb13f)return _0x111c4c;return db[_0x2a4c('0x89')][_0x2a4c('0x5c')]({'where':{'name':{'$or':[_0x2a4c('0x37'),'Telephones']},'userProfileId':_0x4e4f9e[_0x2a4c('0x81')][_0x2a4c('0x87')]},'raw':!![]})[_0x2a4c('0x33')](function(_0x419388){if(_[_0x2a4c('0x92')](_0x419388)||!_[_0x2a4c('0x8e')](_0x419388,[_0x2a4c('0x8b'),0x0]))return _0x111c4c;_0x50c1c4=[];var _0x335e04=_(_0x419388)[_0x2a4c('0x3b')](function(_0x4acacb){if(_0x4acacb[_0x2a4c('0x8b')]===0x1)return;return _0x4acacb['name']===_0x2a4c('0x37')?_0x2a4c('0x38'):_0x2a4c('0x39');})['compact']()['value']();for(var _0x3d69de=0x0;_0x3d69de<_0x111c4c[_0x2a4c('0x61')];_0x3d69de++){if(!_[_0x2a4c('0x3d')](_0x335e04,_0x111c4c[_0x3d69de][_0x2a4c('0x3e')]))return;var _0x402d50=_0x111c4c[_0x3d69de][_0x2a4c('0x3e')]===_0x2a4c('0x38')?_0x2a4c('0x37'):_0x2a4c('0x8a');_0x50c1c4['push'](db[_0x2a4c('0x3f')]['create']({'name':_0x111c4c[_0x3d69de][_0x2a4c('0x41')],'resourceId':_0x111c4c[_0x3d69de]['id'],'type':_0x402d50,'sectionId':_[_0x2a4c('0x62')](_0x419388,[_0x2a4c('0x41'),_0x402d50])['id']},{}));}return BPromise[_0x2a4c('0x90')](_0x50c1c4);})[_0x2a4c('0x33')](respondWithResult(_0x2e1ffb,0xc9))[_0x2a4c('0x5e')](handleError(_0x2e1ffb,null));});};exports[_0x2a4c('0x93')]=function(_0x389338,_0x15ab1d,_0x43af90){if(_0x389338[_0x2a4c('0x63')]['id']){delete _0x389338[_0x2a4c('0x63')]['id'];}return db['User']['find']({'where':{'id':_0x389338['params']['id']}})[_0x2a4c('0x33')](function(_0x7d81fe){if(!_0x7d81fe)return null;if(_0x7d81fe['id']===_0x389338[_0x2a4c('0x81')]['id']){if(!_0x389338[_0x2a4c('0x63')][_0x2a4c('0x94')]||!_0x389338['body']['newPassword']){throw new db[(_0x2a4c('0x95'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x7d81fe[_0x2a4c('0x96')](_0x389338['body'][_0x2a4c('0x94')])){throw new db[(_0x2a4c('0x95'))][(_0x2a4c('0x97'))](_0x2a4c('0x98'));}if(_0x389338['body'][_0x2a4c('0x94')]===_0x389338['body'][_0x2a4c('0x99')]){throw new db['Sequelize'][(_0x2a4c('0x97'))](_0x2a4c('0x9a'));}}else if(_0x389338['user'][_0x2a4c('0x3e')]==='admin'){if(!_0x389338[_0x2a4c('0x63')]['newPassword']){throw new db['Sequelize'][(_0x2a4c('0x97'))](_0x2a4c('0x9b'));}}else if(_0x389338['user'][_0x2a4c('0x3e')]===_0x2a4c('0x81')){if(!_0x389338[_0x2a4c('0x63')][_0x2a4c('0x99')]){throw new db['Sequelize'][(_0x2a4c('0x97'))](_0x2a4c('0x9b'));}if(_0x7d81fe['role']!==_0x2a4c('0x38')){throw new db[(_0x2a4c('0x95'))]['ValidationError'](_0x2a4c('0x82'));}}else{throw new db[(_0x2a4c('0x95'))][(_0x2a4c('0x97'))](_0x2a4c('0x82'));}return _0x7d81fe;})[_0x2a4c('0x33')](handleEntityNotFound(_0x15ab1d,null))[_0x2a4c('0x33')](function(_0x1596c2){return db[_0x2a4c('0x9c')]['findOne']({'attributes':['id',_0x2a4c('0x6a'),_0x2a4c('0x9d'),'passwordHistoryLimit']})['then'](function(_0x14b29f){if(_0x14b29f['securePassword'])authService[_0x2a4c('0x9e')](_0x389338[_0x2a4c('0x63')][_0x2a4c('0x99')]);if(!_0x14b29f[_0x2a4c('0x9d')]||!_0x1596c2[_0x2a4c('0x9f')])return _0x1596c2;authService[_0x2a4c('0xa0')](_0x389338[_0x2a4c('0x63')][_0x2a4c('0x99')],_0x1596c2[_0x2a4c('0x9f')],_0x14b29f[_0x2a4c('0xa1')]);return _0x1596c2;})[_0x2a4c('0x33')](saveUpdates({'password':_0x389338['body']['newPassword'],'passwordResetAt':_0x389338['user']['id']==_0x389338[_0x2a4c('0x64')]['id']?moment():null,'previousPasswords':authService[_0x2a4c('0xa2')](_0x389338[_0x2a4c('0x63')][_0x2a4c('0x99')],_0x1596c2[_0x2a4c('0x9f')])},null));})[_0x2a4c('0x33')](respondWithResult(_0x15ab1d,null))[_0x2a4c('0x5e')](handleError(_0x15ab1d,null));};exports[_0x2a4c('0xa3')]=function(_0x273d31,_0x2b95ce,_0x2aadbc){var _0x19fd48=_0x273d31[_0x2a4c('0x63')][_0x2a4c('0xa4')];return db[_0x2a4c('0x44')][_0x2a4c('0x62')]({'where':{'id':_0x273d31[_0x2a4c('0x64')]['id']},'attributes':['id',_0x2a4c('0x41'),'role',_0x2a4c('0xa5'),_0x2a4c('0xa6'),'voicePause','interface']})[_0x2a4c('0x33')](handleEntityNotFound(_0x2b95ce,null))[_0x2a4c('0x33')](function(_0x1e5354){if(_0x1e5354){if(!utils[_0x2a4c('0xa7')](_0x19fd48)){throw new db[(_0x2a4c('0x95'))][(_0x2a4c('0x97'))](_0x2a4c('0xa8'));}return _0x1e5354[_0x2a4c('0xa9')+_[_0x2a4c('0xaa')](_0x19fd48[_0x2a4c('0xab')]())+'Queues'](_0x273d31['body'][_0x2a4c('0xac')],{'penalty':_0x273d31[_0x2a4c('0x63')][_0x2a4c('0xad')]||0x0})[_0x2a4c('0xae')](function(_0x32f2c3){for(var _0x5f4487=0x0;_0x5f4487<_0x273d31[_0x2a4c('0x63')][_0x2a4c('0xac')]['length'];_0x5f4487+=0x1){var _0x597126={'UserId':_0x273d31[_0x2a4c('0x64')]['id']};_0x597126[_[_0x2a4c('0xaa')](_0x19fd48[_0x2a4c('0xab')]())+_0x2a4c('0xaf')]=_0x273d31[_0x2a4c('0x63')][_0x2a4c('0xac')][_0x5f4487];socket[_0x2a4c('0xb0')]('user'+_[_0x2a4c('0xaa')](_0x19fd48[_0x2a4c('0xab')]())+'Queue:save',_0x597126);}return _0x32f2c3;})[_0x2a4c('0x33')](function(){if(_0x19fd48===_0x2a4c('0xb1')){return db[_0x2a4c('0xb2')][_0x2a4c('0x5c')]({'where':{'id':_0x273d31[_0x2a4c('0x63')][_0x2a4c('0xac')]||[]},'raw':!![],'attributes':['id',_0x2a4c('0x41')]});}})['then'](function(_0x3ad766){var _0x38ac9a=_0x1e5354[_0x2a4c('0x35')]({'plain':!![]});var _0x322fa=[];if(_0x19fd48===_0x2a4c('0xb1')&&_0x38ac9a[_0x2a4c('0x3e')]===_0x2a4c('0x38')&&_0x38ac9a[_0x2a4c('0xa5')]){for(var _0x4c4143=0x0;_0x4c4143<_0x3ad766[_0x2a4c('0x61')];_0x4c4143+=0x1){_0x322fa[_0x2a4c('0x8f')]({'membername':_0x38ac9a[_0x2a4c('0x41')],'UserId':_0x38ac9a['id'],'queue_name':_0x3ad766[_0x4c4143][_0x2a4c('0x41')],'VoiceQueueId':_0x3ad766[_0x4c4143]['id'],'interface':_[_0x2a4c('0x6c')](_0x38ac9a[_0x2a4c('0xb3')])?util[_0x2a4c('0xb4')](_0x2a4c('0xb5'),_0x38ac9a[_0x2a4c('0x41')]):_0x38ac9a[_0x2a4c('0xb3')],'paused':_0x38ac9a['voicePause']||![],'penalty':_0x273d31[_0x2a4c('0x63')][_0x2a4c('0xad')]||0x0});}return BPromise[_0x2a4c('0x91')](_0x322fa,function(_0x3aba6f){return db[_0x2a4c('0xb6')][_0x2a4c('0xb7')](_0x3aba6f);});}return _0x1e5354;});}})[_0x2a4c('0x33')](respondWithStatusCode(_0x2b95ce,null))[_0x2a4c('0x5e')](handleError(_0x2b95ce,null));};exports[_0x2a4c('0xb8')]=function(_0x23e43d,_0xfea979,_0x34598f){var _0x5b1401;return db[_0x2a4c('0x44')][_0x2a4c('0x62')]({'where':{'id':_0x23e43d[_0x2a4c('0x64')]['id']},'attributes':['id','name',_0x2a4c('0x3e')]})[_0x2a4c('0x33')](handleEntityNotFound(_0xfea979,null))[_0x2a4c('0x33')](function(_0x49f625){if(_0x49f625){_0x5b1401=_0x49f625;if(!_0x23e43d['query']['channel']||!utils['isValidChannel'](_0x23e43d[_0x2a4c('0x4a')][_0x2a4c('0xa4')])){throw new db[(_0x2a4c('0x95'))][(_0x2a4c('0x97'))](_0x2a4c('0xa8'));}return _0x49f625[_0x2a4c('0xb9')+_[_0x2a4c('0xaa')](_0x23e43d[_0x2a4c('0x4a')][_0x2a4c('0xa4')][_0x2a4c('0xab')]())+_0x2a4c('0xba')](_0x23e43d[_0x2a4c('0x4a')]['ids']);}})[_0x2a4c('0x33')](function(_0x9a1313){for(var _0x5ee07f=0x0;_0x5ee07f<_0x23e43d[_0x2a4c('0x4a')]['ids'][_0x2a4c('0x61')];_0x5ee07f+=0x1){var _0x571b4d={'UserId':_0x23e43d[_0x2a4c('0x64')]['id']};_0x571b4d[_['capitalize'](_0x23e43d[_0x2a4c('0x4a')][_0x2a4c('0xa4')][_0x2a4c('0xab')]())+'QueueId']=_0x23e43d['query'][_0x2a4c('0xac')][_0x5ee07f];socket[_0x2a4c('0xb0')](_0x2a4c('0x81')+_[_0x2a4c('0xaa')](_0x23e43d[_0x2a4c('0x4a')][_0x2a4c('0xa4')][_0x2a4c('0xab')]())+_0x2a4c('0xbb'),_0x571b4d);}return _0x9a1313;})['then'](function(){if(_0x23e43d[_0x2a4c('0x4a')][_0x2a4c('0xa4')]===_0x2a4c('0xb1')){return db[_0x2a4c('0xb6')][_0x2a4c('0x34')]({'where':{'UserId':_0x23e43d[_0x2a4c('0x64')]['id'],'VoiceQueueId':_0x23e43d[_0x2a4c('0x4a')][_0x2a4c('0xac')]},'individualHooks':!![]})[_0x2a4c('0x33')](function(){return _0x5b1401;});}return _0x5b1401;})['then'](respondWithStatusCode(_0xfea979,null))[_0x2a4c('0x5e')](handleError(_0xfea979,null));};exports['addAvatar']=function(_0x44d1ba,_0x2be84f,_0x132e29){_0x44d1ba[_0x2a4c('0x63')][_0x2a4c('0xbc')]=_0x44d1ba['file'][_0x2a4c('0xbd')];return db[_0x2a4c('0x44')][_0x2a4c('0x62')]({'where':{'id':_0x44d1ba[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x2be84f,null))['then'](saveUpdates(_0x44d1ba[_0x2a4c('0x63')],null))[_0x2a4c('0x33')](respondWithResult(_0x2be84f,null))[_0x2a4c('0x5e')](handleError(_0x2be84f,null));};exports[_0x2a4c('0xbe')]=function(_0x228249,_0xdb9305,_0xf33a77){var _0x36848f=path[_0x2a4c('0xbf')](config['root'],'server/files/images/logos/default_profile.png');return db[_0x2a4c('0x44')]['find']({'where':{'id':_0x228249[_0x2a4c('0x64')]['id']},'attributes':['id',_0x2a4c('0xbc')],'raw':!![]})['then'](handleEntityNotFound(_0xdb9305,null))['then'](function(_0x10f3b4){if(_0x10f3b4){if(_['isNil'](_0x10f3b4[_0x2a4c('0xbc')])){return _0xdb9305['download'](_0x36848f);}else{if(!fs['existsSync'](path[_0x2a4c('0xbf')](config[_0x2a4c('0xc0')],_0x2a4c('0xc1'),_0x10f3b4[_0x2a4c('0xbc')]))){return _0xdb9305['download'](_0x36848f);}return _0xdb9305[_0x2a4c('0xc2')](path[_0x2a4c('0xbf')](config['root'],_0x2a4c('0xc1'),_0x10f3b4['userpic']));}}})[_0x2a4c('0x5e')](handleError(_0xdb9305,null));};exports['getContacts']=function(_0x377687,_0x50ea26,_0x3c6e49){var _0x49f3b7={};var _0x41ba74={};var _0x5a8f9e;var _0x401d64;return db[_0x2a4c('0x44')][_0x2a4c('0xc3')]({'where':{'id':_0x377687[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x50ea26,null))['then'](function(_0x298fcf){if(_0x298fcf){_0x5a8f9e=_0x298fcf;_0x41ba74['model']=_[_0x2a4c('0x4b')](db[_0x2a4c('0xc4')][_0x2a4c('0x45')]);_0x41ba74[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x377687['query']);_0x41ba74[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x41ba74[_0x2a4c('0x47')],_0x41ba74[_0x2a4c('0x4a')]);_0x49f3b7[_0x2a4c('0x4f')]=_[_0x2a4c('0x4d')](_0x41ba74['model'],qs[_0x2a4c('0x4e')](_0x377687[_0x2a4c('0x4a')]['fields']));_0x49f3b7['attributes']=_0x49f3b7[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0x49f3b7['attributes']:_0x41ba74[_0x2a4c('0x47')];_0x49f3b7[_0x2a4c('0xc5')]=qs['sort'](_0x377687[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x49f3b7[_0x2a4c('0x53')]=qs['filters'](_['pick'](_0x377687[_0x2a4c('0x4a')],_0x41ba74[_0x2a4c('0x4c')]));if(_0x377687[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x49f3b7[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x49f3b7['where'],{'$or':_[_0x2a4c('0x3b')](_0x49f3b7['attributes'],function(_0x237282){var _0x8017e={};_0x8017e[_0x237282]={'$like':'%'+_0x377687[_0x2a4c('0x4a')][_0x2a4c('0x3a')]+'%'};return _0x8017e;})});}_0x49f3b7=_[_0x2a4c('0x55')]({},_0x49f3b7,_0x377687['options']);return _0x5a8f9e[_0x2a4c('0xc6')](_0x49f3b7);}})[_0x2a4c('0x33')](function(_0x5a38b2){if(_0x5a38b2){_0x401d64=_0x5a38b2[_0x2a4c('0x61')];if(_0x377687[_0x2a4c('0x4a')][_0x2a4c('0x50')]('includeAll')){_0x49f3b7[_0x2a4c('0x5b')]=[{'model':db['CmList'],'as':_0x2a4c('0xc7'),'required':![]},{'model':db[_0x2a4c('0xc8')],'as':_0x2a4c('0xc9'),'attributes':['id',_0x2a4c('0x41'),_0x2a4c('0xca')],'where':_0x377687[_0x2a4c('0x4a')][_0x2a4c('0xcb')]?{'id':_0x377687[_0x2a4c('0x4a')][_0x2a4c('0xcb')]}:undefined,'required':_0x377687[_0x2a4c('0x4a')][_0x2a4c('0xcb')]?!![]:![]}];}if(!_0x377687[_0x2a4c('0x4a')][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x49f3b7['limit']=qs[_0x2a4c('0x2d')](_0x377687['query'][_0x2a4c('0x2d')]);_0x49f3b7[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0x377687[_0x2a4c('0x4a')]['offset']);}return _0x5a8f9e[_0x2a4c('0xc6')](_0x49f3b7);}})[_0x2a4c('0x33')](function(_0x4886b7){if(_0x4886b7){return _0x4886b7?{'count':_0x401d64,'rows':_0x4886b7}:null;}})[_0x2a4c('0x33')](respondWithResult(_0x50ea26,null))['catch'](handleError(_0x50ea26,null));};exports[_0x2a4c('0xcc')]=function(_0x2491dd,_0x1ee943,_0x157994){var _0x50ace6;var _0x302cc9;var _0x525ca4={};var _0x523915;return db['User'][_0x2a4c('0xc3')]({'where':{'id':_0x2491dd[_0x2a4c('0x64')]['id']},'attributes':['id',_0x2a4c('0x41'),_0x2a4c('0x3e')]})[_0x2a4c('0x33')](handleEntityNotFound(_0x1ee943,null))[_0x2a4c('0x33')](function(_0xd697f0){if(!utils['isValidChannel'](_0x2491dd['query'][_0x2a4c('0xa4')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}_0x50ace6=_0xd697f0;var _0x32bb8d={};_0x32bb8d[_0x2a4c('0x47')]=_['keys'](db[_[_0x2a4c('0xaa')](_0x2491dd[_0x2a4c('0x4a')][_0x2a4c('0xa4')])+'Queue'][_0x2a4c('0x45')]);_0x32bb8d['query']=_[_0x2a4c('0x4b')](_0x2491dd['query']);_0x32bb8d[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x32bb8d[_0x2a4c('0x47')],_0x32bb8d[_0x2a4c('0x4a')]);_0x525ca4[_0x2a4c('0x4f')]=_['intersection'](_0x32bb8d['model'],qs[_0x2a4c('0x4e')](_0x2491dd[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x525ca4[_0x2a4c('0x4f')]=_0x525ca4[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0x525ca4[_0x2a4c('0x4f')]:_0x32bb8d[_0x2a4c('0x47')];_0x525ca4['order']=qs[_0x2a4c('0x52')](_0x2491dd[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x525ca4[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x2491dd['query'],_0x32bb8d[_0x2a4c('0x4c')]));if(_0x2491dd['query'][_0x2a4c('0x3a')]){_0x525ca4[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x525ca4[_0x2a4c('0x53')],{'$or':_[_0x2a4c('0x3b')](_0x525ca4[_0x2a4c('0x4f')],function(_0x3a4287){var _0x1c8769={};_0x1c8769[_0x3a4287]={'$like':'%'+_0x2491dd[_0x2a4c('0x4a')]['filter']+'%'};return _0x1c8769;})});}_0x525ca4=_[_0x2a4c('0x55')]({},_0x525ca4,_0x2491dd[_0x2a4c('0x59')]);switch(_0x50ace6[_0x2a4c('0x3e')]){case'admin':return db[_[_0x2a4c('0xaa')](_0x2491dd['query'][_0x2a4c('0xa4')])+_0x2a4c('0xcd')][_0x2a4c('0x5c')](_0x525ca4);case _0x2a4c('0x81'):case'agent':return _0x50ace6[_0x2a4c('0x35')+_[_0x2a4c('0xaa')](_0x2491dd[_0x2a4c('0x4a')]['channel'])+_0x2a4c('0xba')](_0x525ca4);default:throw new db[(_0x2a4c('0x95'))][(_0x2a4c('0x97'))](_0x2a4c('0xce'));}})[_0x2a4c('0x33')](function(_0x3cdcaf){_0x523915=_0x3cdcaf['length'];if(!_0x2491dd['query'][_0x2a4c('0x50')]('nolimit')){_0x525ca4['limit']=qs[_0x2a4c('0x2d')](_0x2491dd[_0x2a4c('0x4a')][_0x2a4c('0x2d')]);_0x525ca4[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0x2491dd[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);}switch(_0x50ace6[_0x2a4c('0x3e')]){case _0x2a4c('0x36'):return db[_[_0x2a4c('0xaa')](_0x2491dd[_0x2a4c('0x4a')][_0x2a4c('0xa4')])+_0x2a4c('0xcd')][_0x2a4c('0x5c')](_0x525ca4);case _0x2a4c('0x81'):case _0x2a4c('0x38'):return _0x50ace6[_0x2a4c('0x35')+_[_0x2a4c('0xaa')](_0x2491dd['query'][_0x2a4c('0xa4')])+_0x2a4c('0xba')](_0x525ca4);}})['then'](function(_0x1cb290){return{'count':_0x523915,'rows':_0x1cb290};})['then'](respondWithResult(_0x1ee943,null))['catch'](handleError(_0x1ee943,null));};exports[_0x2a4c('0xcf')]=function(_0x71b3d6,_0x511793,_0x1eddb8){var _0x41bb03={};var _0x594f1c={};var _0x52aa4f;var _0x2b2d4c;return db[_0x2a4c('0x44')]['findOne']({'where':{'id':_0x71b3d6[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x511793,null))[_0x2a4c('0x33')](function(_0x55b2d1){if(_0x55b2d1){_0x52aa4f=_0x55b2d1;_0x594f1c[_0x2a4c('0x47')]=_['keys'](db[_0x2a4c('0xb6')]['rawAttributes']);_0x594f1c[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x71b3d6[_0x2a4c('0x4a')]);_0x594f1c[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x594f1c[_0x2a4c('0x47')],_0x594f1c[_0x2a4c('0x4a')]);_0x41bb03[_0x2a4c('0x4f')]=_['intersection'](_0x594f1c['model'],qs['fields'](_0x71b3d6[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x41bb03[_0x2a4c('0x4f')]=_0x41bb03['attributes']['length']?_0x41bb03['attributes']:_0x594f1c[_0x2a4c('0x47')];_0x41bb03[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x71b3d6[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x41bb03[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_['pick'](_0x71b3d6[_0x2a4c('0x4a')],_0x594f1c[_0x2a4c('0x4c')]));if(_0x71b3d6[_0x2a4c('0x4a')]['filter']){_0x41bb03[_0x2a4c('0x53')]=_['merge'](_0x41bb03['where'],{'$or':_['map'](_0x41bb03[_0x2a4c('0x4f')],function(_0x431ed2){var _0x3b2769={};_0x3b2769[_0x431ed2]={'$like':'%'+_0x71b3d6[_0x2a4c('0x4a')][_0x2a4c('0x3a')]+'%'};return _0x3b2769;})});}_0x41bb03=_[_0x2a4c('0x55')]({},_0x41bb03,_0x71b3d6[_0x2a4c('0x59')]);return _0x52aa4f['getVoiceQueuesRt'](_0x41bb03);}})['then'](function(_0x1b10f8){if(_0x1b10f8){_0x2b2d4c=_0x1b10f8[_0x2a4c('0x61')];if(!_0x71b3d6[_0x2a4c('0x4a')][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x41bb03[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0x71b3d6[_0x2a4c('0x4a')][_0x2a4c('0x2d')]);_0x41bb03[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0x71b3d6['query'][_0x2a4c('0x2c')]);}return _0x52aa4f[_0x2a4c('0xcf')](_0x41bb03);}})['then'](function(_0x13f5ac){if(_0x13f5ac){return _0x13f5ac?{'count':_0x2b2d4c,'rows':_0x13f5ac}:null;}})[_0x2a4c('0x33')](respondWithResult(_0x511793,null))['catch'](handleError(_0x511793,null));};exports['getGroups']=function(_0x3bc796,_0x22d571,_0x29d663){var _0x44b57d={};var _0x4f6a9f={};var _0x4e881b;var _0x10e7b4;return db['User'][_0x2a4c('0xc3')]({'where':{'id':_0x3bc796['params']['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x22d571,null))[_0x2a4c('0x33')](function(_0x31cccb){if(_0x31cccb){_0x4e881b=_0x31cccb;_0x4f6a9f['model']=_['keys'](db[_0x2a4c('0xd0')][_0x2a4c('0x45')]);_0x4f6a9f['query']=_[_0x2a4c('0x4b')](_0x3bc796[_0x2a4c('0x4a')]);_0x4f6a9f[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x4f6a9f[_0x2a4c('0x47')],_0x4f6a9f[_0x2a4c('0x4a')]);_0x44b57d['attributes']=_[_0x2a4c('0x4d')](_0x4f6a9f[_0x2a4c('0x47')],qs['fields'](_0x3bc796['query'][_0x2a4c('0x4e')]));_0x44b57d[_0x2a4c('0x4f')]=_0x44b57d[_0x2a4c('0x4f')]['length']?_0x44b57d[_0x2a4c('0x4f')]:_0x4f6a9f[_0x2a4c('0x47')];_0x44b57d[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x3bc796['query'][_0x2a4c('0x52')]);_0x44b57d['where']=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x3bc796[_0x2a4c('0x4a')],_0x4f6a9f[_0x2a4c('0x4c')]));if(_0x3bc796[_0x2a4c('0x4a')]['filter']){_0x44b57d[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x44b57d['where'],{'$or':_['map'](_0x44b57d['attributes'],function(_0x385f1e){var _0x2c6f92={};_0x2c6f92[_0x385f1e]={'$like':'%'+_0x3bc796['query'][_0x2a4c('0x3a')]+'%'};return _0x2c6f92;})});}_0x44b57d=_[_0x2a4c('0x55')]({},_0x44b57d,_0x3bc796['options']);return _0x4e881b[_0x2a4c('0xd1')](_0x44b57d);}})[_0x2a4c('0x33')](function(_0xbd010){if(_0xbd010){_0x10e7b4=_0xbd010[_0x2a4c('0x61')];if(!_0x3bc796['query'][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x44b57d[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0x3bc796[_0x2a4c('0x4a')][_0x2a4c('0x2d')]);_0x44b57d[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0x3bc796[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);}return _0x4e881b[_0x2a4c('0xd1')](_0x44b57d);}})[_0x2a4c('0x33')](function(_0x212a80){if(_0x212a80){return _0x212a80?{'count':_0x10e7b4,'rows':_0x212a80}:null;}})['then'](respondWithResult(_0x22d571,null))[_0x2a4c('0x5e')](handleError(_0x22d571,null));};exports[_0x2a4c('0xd2')]=function(_0x24dfcb,_0x215c36,_0x422da6){var _0xb34686={'raw':!![],'where':{}};var _0x5c13ac={};var _0x3f7146={'count':0x0,'rows':[]};return db[_0x2a4c('0x44')]['findOne']({'where':{'id':_0x24dfcb['params']['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x215c36,null))[_0x2a4c('0x33')](function(_0x14580c){if(_0x14580c){_0x5c13ac[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db[_0x2a4c('0xd3')][_0x2a4c('0x45')]);_0x5c13ac[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x24dfcb[_0x2a4c('0x4a')]);_0x5c13ac[_0x2a4c('0x4c')]=_['intersection'](_0x5c13ac[_0x2a4c('0x47')],_0x5c13ac[_0x2a4c('0x4a')]);_0xb34686[_0x2a4c('0x4f')]=_['intersection'](_0x5c13ac['model'],qs[_0x2a4c('0x4e')](_0x24dfcb[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0xb34686[_0x2a4c('0x4f')]=_0xb34686[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0xb34686['attributes']:_0x5c13ac[_0x2a4c('0x47')];if(!_0x24dfcb[_0x2a4c('0x4a')][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0xb34686[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0x24dfcb[_0x2a4c('0x4a')]['limit']);_0xb34686['offset']=qs['offset'](_0x24dfcb[_0x2a4c('0x4a')]['offset']);}_0xb34686['order']=qs[_0x2a4c('0x52')](_0x24dfcb[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0xb34686[_0x2a4c('0x53')]=qs['filters'](_[_0x2a4c('0x54')](_0x24dfcb[_0x2a4c('0x4a')],_0x5c13ac[_0x2a4c('0x4c')]));_0xb34686[_0x2a4c('0x53')][_0x2a4c('0xd4')]=_0x14580c['id'];if(_0x24dfcb['query']['filter']){_0xb34686[_0x2a4c('0x53')]=_['merge'](_0xb34686[_0x2a4c('0x53')],{'$or':_[_0x2a4c('0x3b')](_0xb34686['attributes'],function(_0x2b32e0){var _0x1e942b={};_0x1e942b[_0x2b32e0]={'$like':'%'+_0x24dfcb['query'][_0x2a4c('0x3a')]+'%'};return _0x1e942b;})});}_0xb34686=_[_0x2a4c('0x55')]({},_0xb34686,_0x24dfcb['options']);return db[_0x2a4c('0xd3')][_0x2a4c('0x2b')]({'where':_0xb34686['where']})[_0x2a4c('0x33')](function(_0x2f2a63){_0x3f7146['count']=_0x2f2a63;if(_0x24dfcb[_0x2a4c('0x4a')][_0x2a4c('0x5a')]){_0xb34686[_0x2a4c('0x5b')]=[{'all':!![]}];}return db[_0x2a4c('0xd3')][_0x2a4c('0x5c')](_0xb34686);})['then'](function(_0x14c5da){_0x3f7146[_0x2a4c('0x5d')]=_0x14c5da;return _0x3f7146;});}})['then'](respondWithFilteredResult(_0x215c36,_0xb34686))[_0x2a4c('0x5e')](handleError(_0x215c36,null));};exports[_0x2a4c('0xd5')]=function(_0x1f4d82,_0x1fab8a,_0x27c954){var _0x327705={'raw':!![],'where':{}};var _0x423945={};var _0xfebdb9={'count':0x0,'rows':[]};return db['User'][_0x2a4c('0xc3')]({'where':{'id':_0x1f4d82['params']['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x1fab8a,null))[_0x2a4c('0x33')](function(_0x140421){if(_0x140421){_0x423945[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db['ScreenRecording'][_0x2a4c('0x45')]);_0x423945['query']=_['keys'](_0x1f4d82[_0x2a4c('0x4a')]);_0x423945[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x423945[_0x2a4c('0x47')],_0x423945[_0x2a4c('0x4a')]);_0x327705['attributes']=_[_0x2a4c('0x4d')](_0x423945['model'],qs[_0x2a4c('0x4e')](_0x1f4d82[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x327705[_0x2a4c('0x4f')]=_0x327705[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0x327705[_0x2a4c('0x4f')]:_0x423945[_0x2a4c('0x47')];if(!_0x1f4d82['query'][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x327705[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0x1f4d82[_0x2a4c('0x4a')]['limit']);_0x327705['offset']=qs['offset'](_0x1f4d82[_0x2a4c('0x4a')]['offset']);}_0x327705[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x1f4d82[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x327705[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x1f4d82[_0x2a4c('0x4a')],_0x423945[_0x2a4c('0x4c')]));_0x327705['where'][_0x2a4c('0xd4')]=_0x140421['id'];if(_0x1f4d82[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x327705[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x327705['where'],{'$or':_[_0x2a4c('0x3b')](_0x327705['attributes'],function(_0x648f56){var _0x12306c={};_0x12306c[_0x648f56]={'$like':'%'+_0x1f4d82[_0x2a4c('0x4a')]['filter']+'%'};return _0x12306c;})});}_0x327705=_[_0x2a4c('0x55')]({},_0x327705,_0x1f4d82['options']);return db[_0x2a4c('0xd6')]['count']({'where':_0x327705[_0x2a4c('0x53')]})[_0x2a4c('0x33')](function(_0x4091a4){_0xfebdb9[_0x2a4c('0x2b')]=_0x4091a4;if(_0x1f4d82[_0x2a4c('0x4a')]['includeAll']){_0x327705['include']=[{'all':!![]}];}return db[_0x2a4c('0xd6')][_0x2a4c('0x5c')](_0x327705);})['then'](function(_0x37d723){_0xfebdb9[_0x2a4c('0x5d')]=_0x37d723;return _0xfebdb9;});}})['then'](respondWithFilteredResult(_0x1fab8a,_0x327705))[_0x2a4c('0x5e')](handleError(_0x1fab8a,null));};exports['getChatInteractions']=function(_0x439dd4,_0x29e43b,_0x53d6c){var _0x3898cc={};var _0x27861c={};var _0xa5d9a6;var _0x99ef25;return db[_0x2a4c('0x44')]['findOne']({'where':{'id':_0x439dd4[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x29e43b,null))['then'](function(_0x2ce345){if(_0x2ce345){_0xa5d9a6=_0x2ce345;_0x27861c[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db[_0x2a4c('0xd7')]['rawAttributes']);_0x27861c[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x439dd4['query']);_0x27861c[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x27861c[_0x2a4c('0x47')],_0x27861c['query']);_0x3898cc[_0x2a4c('0x4f')]=_[_0x2a4c('0x4d')](_0x27861c[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0x439dd4[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x3898cc[_0x2a4c('0x4f')]=_0x3898cc[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0x3898cc['attributes']:_0x27861c[_0x2a4c('0x47')];_0x3898cc[_0x2a4c('0xc5')]=qs['sort'](_0x439dd4[_0x2a4c('0x4a')]['sort']);_0x3898cc['where']=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x439dd4[_0x2a4c('0x4a')],_0x27861c[_0x2a4c('0x4c')]));if(_0x439dd4[_0x2a4c('0x4a')]['filter']){_0x3898cc[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x3898cc[_0x2a4c('0x53')],{'$or':_[_0x2a4c('0x3b')](_0x3898cc[_0x2a4c('0x4f')],function(_0x5e229d){var _0xbb601e={};_0xbb601e[_0x5e229d]={'$like':'%'+_0x439dd4[_0x2a4c('0x4a')][_0x2a4c('0x3a')]+'%'};return _0xbb601e;})});}_0x3898cc=_[_0x2a4c('0x55')]({},_0x3898cc,_0x439dd4['options']);return _0xa5d9a6[_0x2a4c('0xd8')](_0x3898cc);}})[_0x2a4c('0x33')](function(_0x1c7b05){if(_0x1c7b05){_0x99ef25=_0x1c7b05[_0x2a4c('0x61')];if(!_0x439dd4[_0x2a4c('0x4a')][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x3898cc['limit']=qs['limit'](_0x439dd4[_0x2a4c('0x4a')]['limit']);_0x3898cc['offset']=qs[_0x2a4c('0x2c')](_0x439dd4['query'][_0x2a4c('0x2c')]);}return _0xa5d9a6['getChatInteractions'](_0x3898cc);}})[_0x2a4c('0x33')](function(_0x368ce9){if(_0x368ce9){return _0x368ce9?{'count':_0x99ef25,'rows':_0x368ce9}:null;}})[_0x2a4c('0x33')](respondWithResult(_0x29e43b,null))[_0x2a4c('0x5e')](handleError(_0x29e43b,null));};exports[_0x2a4c('0xd9')]=function(_0x3a7178,_0x535201,_0x53ccf3){var _0x1eca31={};var _0x35f28d={};var _0x581321;var _0x4ec7b2;return db[_0x2a4c('0x44')][_0x2a4c('0xc3')]({'where':{'id':_0x3a7178[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x535201,null))[_0x2a4c('0x33')](function(_0x38e334){if(_0x38e334){_0x581321=_0x38e334;_0x35f28d[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db[_0x2a4c('0xda')][_0x2a4c('0x45')]);_0x35f28d[_0x2a4c('0x4a')]=_['keys'](_0x3a7178[_0x2a4c('0x4a')]);_0x35f28d[_0x2a4c('0x4c')]=_['intersection'](_0x35f28d[_0x2a4c('0x47')],_0x35f28d['query']);_0x1eca31[_0x2a4c('0x4f')]=_[_0x2a4c('0x4d')](_0x35f28d[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0x3a7178[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x1eca31[_0x2a4c('0x4f')]=_0x1eca31['attributes'][_0x2a4c('0x61')]?_0x1eca31['attributes']:_0x35f28d[_0x2a4c('0x47')];_0x1eca31['order']=qs[_0x2a4c('0x52')](_0x3a7178['query'][_0x2a4c('0x52')]);_0x1eca31[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x3a7178[_0x2a4c('0x4a')],_0x35f28d['filters']));if(_0x3a7178[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x1eca31['where']=_[_0x2a4c('0x55')](_0x1eca31[_0x2a4c('0x53')],{'$or':_[_0x2a4c('0x3b')](_0x1eca31[_0x2a4c('0x4f')],function(_0x4617a7){var _0x2c3a05={};_0x2c3a05[_0x4617a7]={'$like':'%'+_0x3a7178[_0x2a4c('0x4a')][_0x2a4c('0x3a')]+'%'};return _0x2c3a05;})});}_0x1eca31=_[_0x2a4c('0x55')]({},_0x1eca31,_0x3a7178[_0x2a4c('0x59')]);return _0x581321[_0x2a4c('0xd9')](_0x1eca31);}})[_0x2a4c('0x33')](function(_0x54e7a8){if(_0x54e7a8){_0x4ec7b2=_0x54e7a8[_0x2a4c('0x61')];if(!_0x3a7178['query'][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x1eca31['limit']=qs['limit'](_0x3a7178['query'][_0x2a4c('0x2d')]);_0x1eca31[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0x3a7178[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);}return _0x581321[_0x2a4c('0xd9')](_0x1eca31);}})[_0x2a4c('0x33')](function(_0x677040){if(_0x677040){return _0x677040?{'count':_0x4ec7b2,'rows':_0x677040}:null;}})[_0x2a4c('0x33')](respondWithResult(_0x535201,null))[_0x2a4c('0x5e')](handleError(_0x535201,null));};exports[_0x2a4c('0xdb')]=function(_0x1a2aca,_0xdc56cf,_0x133eba){var _0x78037b={'raw':!![],'where':{}};var _0x38dddf={};var _0x5279cc={'count':0x0,'rows':[]};return db[_0x2a4c('0x44')][_0x2a4c('0xc3')]({'where':{'id':_0x1a2aca['params']['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0xdc56cf,null))['then'](function(_0x5a3ed3){if(_0x5a3ed3){_0x38dddf[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db[_0x2a4c('0xdc')]['rawAttributes']);_0x38dddf[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x1a2aca[_0x2a4c('0x4a')]);_0x38dddf['filters']=_['intersection'](_0x38dddf[_0x2a4c('0x47')],_0x38dddf[_0x2a4c('0x4a')]);_0x78037b[_0x2a4c('0x4f')]=_[_0x2a4c('0x4d')](_0x38dddf[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0x1a2aca[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x78037b[_0x2a4c('0x4f')]=_0x78037b[_0x2a4c('0x4f')]['length']?_0x78037b[_0x2a4c('0x4f')]:_0x38dddf[_0x2a4c('0x47')];if(!_0x1a2aca['query'][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x78037b[_0x2a4c('0x2d')]=qs['limit'](_0x1a2aca['query'][_0x2a4c('0x2d')]);_0x78037b[_0x2a4c('0x2c')]=qs['offset'](_0x1a2aca['query'][_0x2a4c('0x2c')]);}_0x78037b[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x1a2aca[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x78037b[_0x2a4c('0x53')]=qs['filters'](_['pick'](_0x1a2aca[_0x2a4c('0x4a')],_0x38dddf[_0x2a4c('0x4c')]));_0x78037b[_0x2a4c('0x53')]['UserId']=_0x5a3ed3['id'];if(_0x1a2aca[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x78037b['where']=_['merge'](_0x78037b[_0x2a4c('0x53')],{'$or':_[_0x2a4c('0x3b')](_0x78037b['attributes'],function(_0x4c7650){var _0x148321={};_0x148321[_0x4c7650]={'$like':'%'+_0x1a2aca[_0x2a4c('0x4a')]['filter']+'%'};return _0x148321;})});}_0x78037b=_[_0x2a4c('0x55')]({},_0x78037b,_0x1a2aca['options']);return db[_0x2a4c('0xdc')]['count']({'where':_0x78037b[_0x2a4c('0x53')]})['then'](function(_0x3401fc){_0x5279cc[_0x2a4c('0x2b')]=_0x3401fc;if(_0x1a2aca[_0x2a4c('0x4a')][_0x2a4c('0x5a')]){_0x78037b['include']=[{'all':!![]}];}return db['MailInteraction'][_0x2a4c('0x5c')](_0x78037b);})[_0x2a4c('0x33')](function(_0xeffb76){_0x5279cc['rows']=_0xeffb76;return _0x5279cc;});}})[_0x2a4c('0x33')](respondWithFilteredResult(_0xdc56cf,_0x78037b))['catch'](handleError(_0xdc56cf,null));};exports[_0x2a4c('0xdd')]=function(_0x1ec760,_0x9f1f7b,_0x3d131b){var _0x3ab224={};var _0x5b89ae={};var _0xcf7a30;var _0x24e7e5;return db[_0x2a4c('0x44')][_0x2a4c('0xc3')]({'where':{'id':_0x1ec760[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x9f1f7b,null))[_0x2a4c('0x33')](function(_0x576811){if(_0x576811){_0xcf7a30=_0x576811;_0x5b89ae[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db['SmsInteraction'][_0x2a4c('0x45')]);_0x5b89ae[_0x2a4c('0x4a')]=_['keys'](_0x1ec760[_0x2a4c('0x4a')]);_0x5b89ae['filters']=_[_0x2a4c('0x4d')](_0x5b89ae[_0x2a4c('0x47')],_0x5b89ae[_0x2a4c('0x4a')]);_0x3ab224[_0x2a4c('0x4f')]=_[_0x2a4c('0x4d')](_0x5b89ae[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0x1ec760[_0x2a4c('0x4a')]['fields']));_0x3ab224[_0x2a4c('0x4f')]=_0x3ab224[_0x2a4c('0x4f')]['length']?_0x3ab224[_0x2a4c('0x4f')]:_0x5b89ae[_0x2a4c('0x47')];_0x3ab224[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x1ec760['query'][_0x2a4c('0x52')]);_0x3ab224[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x1ec760[_0x2a4c('0x4a')],_0x5b89ae[_0x2a4c('0x4c')]));if(_0x1ec760[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x3ab224[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x3ab224['where'],{'$or':_[_0x2a4c('0x3b')](_0x3ab224[_0x2a4c('0x4f')],function(_0x50d5aa){var _0x37df97={};_0x37df97[_0x50d5aa]={'$like':'%'+_0x1ec760[_0x2a4c('0x4a')]['filter']+'%'};return _0x37df97;})});}_0x3ab224=_[_0x2a4c('0x55')]({},_0x3ab224,_0x1ec760[_0x2a4c('0x59')]);return _0xcf7a30['getSmsInteractions'](_0x3ab224);}})['then'](function(_0xd058b2){if(_0xd058b2){_0x24e7e5=_0xd058b2['length'];if(!_0x1ec760[_0x2a4c('0x4a')][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x3ab224[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0x1ec760[_0x2a4c('0x4a')][_0x2a4c('0x2d')]);_0x3ab224[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0x1ec760[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);}return _0xcf7a30[_0x2a4c('0xdd')](_0x3ab224);}})[_0x2a4c('0x33')](function(_0x54841f){if(_0x54841f){return _0x54841f?{'count':_0x24e7e5,'rows':_0x54841f}:null;}})[_0x2a4c('0x33')](respondWithResult(_0x9f1f7b,null))[_0x2a4c('0x5e')](handleError(_0x9f1f7b,null));};exports[_0x2a4c('0xde')]=function(_0x28f45e,_0xe2a6e3,_0x7e0104){var _0x26d77c={};var _0x48ed4b={};var _0x54a260;var _0x5e1078;return db[_0x2a4c('0x44')][_0x2a4c('0xc3')]({'where':{'id':_0x28f45e[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0xe2a6e3,null))[_0x2a4c('0x33')](function(_0x1bb830){if(_0x1bb830){_0x54a260=_0x1bb830;_0x48ed4b['model']=_[_0x2a4c('0x4b')](db[_0x2a4c('0xdf')]['rawAttributes']);_0x48ed4b[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x28f45e['query']);_0x48ed4b[_0x2a4c('0x4c')]=_['intersection'](_0x48ed4b[_0x2a4c('0x47')],_0x48ed4b['query']);_0x26d77c[_0x2a4c('0x4f')]=_[_0x2a4c('0x4d')](_0x48ed4b[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0x28f45e[_0x2a4c('0x4a')]['fields']));_0x26d77c[_0x2a4c('0x4f')]=_0x26d77c[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0x26d77c[_0x2a4c('0x4f')]:_0x48ed4b[_0x2a4c('0x47')];_0x26d77c[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x28f45e[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x26d77c[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x28f45e[_0x2a4c('0x4a')],_0x48ed4b['filters']));if(_0x28f45e[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x26d77c[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x26d77c[_0x2a4c('0x53')],{'$or':_['map'](_0x26d77c[_0x2a4c('0x4f')],function(_0x4edc91){var _0x4c6dbc={};_0x4c6dbc[_0x4edc91]={'$like':'%'+_0x28f45e[_0x2a4c('0x4a')][_0x2a4c('0x3a')]+'%'};return _0x4c6dbc;})});}_0x26d77c=_['merge']({},_0x26d77c,_0x28f45e[_0x2a4c('0x59')]);return _0x54a260[_0x2a4c('0xde')](_0x26d77c);}})[_0x2a4c('0x33')](function(_0x5acd06){if(_0x5acd06){_0x5e1078=_0x5acd06[_0x2a4c('0x61')];if(!_0x28f45e[_0x2a4c('0x4a')]['hasOwnProperty'](_0x2a4c('0x51'))){_0x26d77c[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0x28f45e[_0x2a4c('0x4a')][_0x2a4c('0x2d')]);_0x26d77c['offset']=qs['offset'](_0x28f45e[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);}return _0x54a260[_0x2a4c('0xde')](_0x26d77c);}})[_0x2a4c('0x33')](function(_0x351d3c){if(_0x351d3c){return _0x351d3c?{'count':_0x5e1078,'rows':_0x351d3c}:null;}})[_0x2a4c('0x33')](respondWithResult(_0xe2a6e3,null))[_0x2a4c('0x5e')](handleError(_0xe2a6e3,null));};exports[_0x2a4c('0xe0')]=function(_0xb34b25,_0x214b37,_0x1828d1){var _0x44fe0c={};var _0x4b4a2f={};var _0x251a0b;var _0x5111be;return db['User'][_0x2a4c('0xc3')]({'where':{'id':_0xb34b25['params']['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x214b37,null))[_0x2a4c('0x33')](function(_0x3e4301){if(_0x3e4301){_0x251a0b=_0x3e4301;_0x4b4a2f[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db[_0x2a4c('0xe1')][_0x2a4c('0x45')]);_0x4b4a2f[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0xb34b25[_0x2a4c('0x4a')]);_0x4b4a2f['filters']=_[_0x2a4c('0x4d')](_0x4b4a2f[_0x2a4c('0x47')],_0x4b4a2f[_0x2a4c('0x4a')]);_0x44fe0c[_0x2a4c('0x4f')]=_['intersection'](_0x4b4a2f['model'],qs['fields'](_0xb34b25[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x44fe0c[_0x2a4c('0x4f')]=_0x44fe0c[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0x44fe0c[_0x2a4c('0x4f')]:_0x4b4a2f[_0x2a4c('0x47')];_0x44fe0c[_0x2a4c('0xc5')]=qs['sort'](_0xb34b25['query']['sort']);_0x44fe0c[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_['pick'](_0xb34b25[_0x2a4c('0x4a')],_0x4b4a2f[_0x2a4c('0x4c')]));if(_0xb34b25[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x44fe0c['where']=_[_0x2a4c('0x55')](_0x44fe0c['where'],{'$or':_[_0x2a4c('0x3b')](_0x44fe0c[_0x2a4c('0x4f')],function(_0x2d1d6f){var _0x4cf57d={};_0x4cf57d[_0x2d1d6f]={'$like':'%'+_0xb34b25[_0x2a4c('0x4a')]['filter']+'%'};return _0x4cf57d;})});}_0x44fe0c=_[_0x2a4c('0x55')]({},_0x44fe0c,_0xb34b25[_0x2a4c('0x59')]);return _0x251a0b['getWhatsappInteractions'](_0x44fe0c);}})[_0x2a4c('0x33')](function(_0xadd4f5){if(_0xadd4f5){_0x5111be=_0xadd4f5[_0x2a4c('0x61')];if(!_0xb34b25[_0x2a4c('0x4a')][_0x2a4c('0x50')]('nolimit')){_0x44fe0c[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0xb34b25[_0x2a4c('0x4a')]['limit']);_0x44fe0c[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0xb34b25[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);}return _0x251a0b[_0x2a4c('0xe0')](_0x44fe0c);}})[_0x2a4c('0x33')](function(_0x2b3e99){if(_0x2b3e99){return _0x2b3e99?{'count':_0x5111be,'rows':_0x2b3e99}:null;}})[_0x2a4c('0x33')](respondWithResult(_0x214b37,null))[_0x2a4c('0x5e')](handleError(_0x214b37,null));};exports['login']=function(_0x43b85f,_0x59a92c,_0x223ba2){var _0x24adfe;var _0x19231d;var _0x47ba54;var _0x39aba1=!_[_0x2a4c('0x6c')](_0x43b85f['params']['id'])?_0x43b85f[_0x2a4c('0x64')]['id']:!_[_0x2a4c('0x6c')](_0x43b85f['user']['id'])?_0x43b85f[_0x2a4c('0x81')]['id']:null;return db[_0x2a4c('0x44')][_0x2a4c('0x62')]({'where':{'id':_0x39aba1,'role':{'$or':[_0x2a4c('0x36'),_0x2a4c('0x81'),_0x2a4c('0x38')]}},'attributes':['id',_0x2a4c('0x41'),_0x2a4c('0xe2'),_0x2a4c('0xe3'),_0x2a4c('0x3e'),_0x2a4c('0x68'),_0x2a4c('0xa6')]})['then'](function(_0x1826db){if(_0x1826db){if(_0x1826db['role']===_0x2a4c('0x38')){_0x24adfe=_0x1826db;if(_0x43b85f[_0x2a4c('0x63')]['interface']){_0x47ba54=util[_0x2a4c('0xb4')](_0x2a4c('0xe4'),_0x24adfe[_0x43b85f[_0x2a4c('0x63')][_0x2a4c('0xb3')]]);}else if(_0x43b85f['body'][_0x2a4c('0xe5')]){_0x47ba54=util[_0x2a4c('0xb4')](_0x2a4c('0xb5'),_0x43b85f[_0x2a4c('0x63')]['intrf']);}else{_0x47ba54=util[_0x2a4c('0xb4')]('SIP/%s',_0x24adfe['name']);}socket['to'](util['format'](_0x2a4c('0xe6'),_0x24adfe[_0x2a4c('0x41')]))[_0x2a4c('0xb0')]('user:forcelogout',{'ip':_0x43b85f[_0x2a4c('0xe7')]['x-forwarded-for']||_0x43b85f['connection'][_0x2a4c('0xe8')]||_0x43b85f['socket'][_0x2a4c('0xe8')]||_0x43b85f[_0x2a4c('0xe9')][_0x2a4c('0xea')][_0x2a4c('0xe8')]});return db[_0x2a4c('0xb6')]['destroy']({'where':{'membername':_0x24adfe[_0x2a4c('0x41')]},'individualHooks':!![]});}}else{throw new db[(_0x2a4c('0x95'))][(_0x2a4c('0x97'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x2a4c('0x33')](function(){if(_0x24adfe){return _0x24adfe[_0x2a4c('0xeb')]({'raw':!![]});}})['then'](function(_0x5db196){if(_0x24adfe){var _0x10cff6=[];if(_0x5db196){_0x19231d=_0x5db196;if(_0x19231d['length']){for(var _0x37bbf0=0x0;_0x37bbf0<_0x19231d['length'];_0x37bbf0++){_0x10cff6[_0x2a4c('0x8f')]({'membername':_0x24adfe[_0x2a4c('0x41')],'UserId':_0x24adfe['id'],'queue_name':_0x19231d[_0x37bbf0][_0x2a4c('0x41')],'VoiceQueueId':_0x19231d[_0x37bbf0]['id'],'interface':_0x47ba54,'paused':_0x24adfe['loginInPause']||![],'penalty':_0x19231d[_0x37bbf0][_0x2a4c('0xec')]||0x0});}return BPromise[_0x2a4c('0x91')](_0x10cff6,function(_0x440114){return db[_0x2a4c('0xb6')]['upsert'](_0x440114);});}}}})['then'](function(){if(_0x24adfe){return db[_0x2a4c('0xed')][_0x2a4c('0x5c')]({'where':{'membername':_0x24adfe[_0x2a4c('0x41')],'exitAt':null}});}})[_0x2a4c('0x33')](function(_0x4a5fae){if(_0x24adfe){var _0x4b2f7b=[];_0x4a5fae[_0x2a4c('0xee')](function(_0x4a3cf8){_0x4b2f7b[_0x2a4c('0x8f')](_0x4a3cf8['update']({'exitAt':moment()['format'](_0x2a4c('0xef'))}));});return BPromise[_0x2a4c('0x90')](_0x4b2f7b);}})['then'](function(){if(_0x24adfe){var _0x1024bd=[];var _0x473077=[];var _0x72e480=utils[_0x2a4c('0xf0')]();var _0x3ed45d={'membername':_0x24adfe['name'],'interface':_0x47ba54,'enterAt':moment()['format'](_0x2a4c('0xef')),'role':_0x24adfe['role'],'internal':_0x24adfe[_0x2a4c('0x68')]};_0x72e480['forEach'](function(_0x39b95b){_0x1024bd[_0x2a4c('0x8f')](_[_0x2a4c('0x55')]({'channel':_0x39b95b,'type':_0x2a4c('0xf1'),'data1':_0x43b85f[_0x2a4c('0x63')][_0x2a4c('0xf2')],'data2':_0x47ba54},_0x3ed45d));if(_0x24adfe['loginInPause']){_0x473077['push'](_[_0x2a4c('0x55')]({'channel':_0x39b95b,'type':_0x2a4c('0xf3'),'data1':_0x2a4c('0xf4')},_0x3ed45d));}});return db[_0x2a4c('0xed')][_0x2a4c('0x8d')](_0x1024bd[_0x2a4c('0xf5')](_0x473077),{'individualHooks':!![]});}})[_0x2a4c('0x33')](function(){if(_0x24adfe){return _0x24adfe['update']({'online':!![],'lastLoginAt':moment()[_0x2a4c('0xb4')](_0x2a4c('0xef')),'voicePause':_0x24adfe[_0x2a4c('0xa6')]||![],'mailPause':_0x24adfe[_0x2a4c('0xa6')]||![],'chatPause':_0x24adfe[_0x2a4c('0xa6')]||![],'faxPause':_0x24adfe[_0x2a4c('0xa6')]||![],'smsPause':_0x24adfe[_0x2a4c('0xa6')]||![],'openchannelPause':_0x24adfe[_0x2a4c('0xa6')]||![],'whatsappPause':_0x24adfe['loginInPause']||![],'pauseType':_0x24adfe['loginInPause']?'LOGININPAUSE':null,'interface':_0x47ba54,'lastPauseAt':moment()[_0x2a4c('0xb4')](_0x2a4c('0xef'))});}})['then'](function(_0xac1d21){if(_0x43b85f[_0x2a4c('0xf6')]){return _0x223ba2();}else{return BPromise[_0x2a4c('0xf7')](_0xac1d21)['then'](respondWithResult(_0x59a92c,null));}})[_0x2a4c('0x5e')](handleError(_0x59a92c,null));};exports[_0x2a4c('0xf8')]=function(_0x27127d,_0x60496d,_0xc986d9){var _0x529068;return db[_0x2a4c('0x44')][_0x2a4c('0x62')]({'where':{'id':_0x27127d['params']['id'],'role':_0x2a4c('0x38')},'attributes':['id',_0x2a4c('0x41'),'role']})[_0x2a4c('0x33')](handleEntityNotFound(_0x60496d,null))[_0x2a4c('0x33')](function(_0x3f3f29){if(_0x3f3f29){_0x529068=_0x3f3f29;return db[_0x2a4c('0xb6')][_0x2a4c('0x34')]({'where':{'membername':_0x529068[_0x2a4c('0x41')]},'individualHooks':!![]});}})[_0x2a4c('0x33')](function(){return db[_0x2a4c('0xed')]['findAll']({'where':{'membername':_0x529068[_0x2a4c('0x41')],'exitAt':null}});})['then'](function(_0x217509){var _0x4f9eaf=[];_0x217509[_0x2a4c('0xee')](function(_0x51fb40){_0x4f9eaf['push'](_0x51fb40[_0x2a4c('0x32')]({'exitAt':moment()[_0x2a4c('0xb4')](_0x2a4c('0xef'))}));});return BPromise['all'](_0x4f9eaf);})[_0x2a4c('0x33')](function(){return _0x529068[_0x2a4c('0x32')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2a4c('0x33')](respondWithResult(_0x60496d,null))[_0x2a4c('0x5e')](handleError(_0x60496d,null));};exports['pause']=function(_0x1a93a5,_0x5215d6,_0x2aa204){var _0x3b9d27;return db[_0x2a4c('0xb6')][_0x2a4c('0x32')]({'paused':0x1},{'where':{'UserId':_0x1a93a5[_0x2a4c('0x64')]['id']},'individualHooks':!![]})[_0x2a4c('0x33')](function(){return db[_0x2a4c('0x44')]['find']({'where':{'id':_0x1a93a5['params']['id'],'role':'agent'},'attributes':['id',_0x2a4c('0x41'),'role',_0x2a4c('0x68'),_0x2a4c('0xb3')]});})[_0x2a4c('0x33')](handleEntityNotFound(_0x5215d6,null))[_0x2a4c('0x33')](function(_0x39b96b){if(_0x39b96b){_0x3b9d27=_0x39b96b;return respondWithRpcPromise(_0x2a4c('0xf9'),'pause',{'id':_0x3b9d27['id'],'name':_0x3b9d27[_0x2a4c('0x41')],'pause':!![]});}})['then'](function(){if(_0x3b9d27){return db[_0x2a4c('0xed')]['findAll']({'where':{'membername':_0x3b9d27['name'],'type':_0x2a4c('0xf3'),'exitAt':null}});}})['then'](function(_0x4d2dac){if(_0x4d2dac[_0x2a4c('0x61')]){var _0xe92ea9=moment()[_0x2a4c('0xb4')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x31bc04=0x0,_0x366676=_0x4d2dac[_0x2a4c('0x61')];_0x31bc04<_0x366676;_0x31bc04++){_0x4d2dac[_0x31bc04]['updateAttributes']({'exitAt':_0xe92ea9});}}})[_0x2a4c('0x33')](function(){var _0x2b03db=[];var _0x324843=utils[_0x2a4c('0xf0')]();_0x324843[_0x2a4c('0xee')](function(_0x379c45){_0x2b03db[_0x2a4c('0x8f')]({'channel':_0x379c45,'membername':_0x3b9d27['name'],'interface':_[_0x2a4c('0x6c')](_0x3b9d27[_0x2a4c('0xb3')])?util[_0x2a4c('0xb4')](_0x2a4c('0xb5'),_0x3b9d27[_0x2a4c('0x41')]):_0x3b9d27[_0x2a4c('0xb3')],'type':_0x2a4c('0xf3'),'enterAt':moment()[_0x2a4c('0xb4')](_0x2a4c('0xef')),'data1':_0x1a93a5[_0x2a4c('0x63')]['type']||_0x2a4c('0xfa'),'role':_0x3b9d27[_0x2a4c('0x3e')],'internal':_0x3b9d27[_0x2a4c('0x68')]});});return db[_0x2a4c('0xed')]['bulkCreate'](_0x2b03db,{'individualHooks':!![]});})[_0x2a4c('0x33')](function(){return _0x3b9d27[_0x2a4c('0x32')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1a93a5[_0x2a4c('0x63')][_0x2a4c('0x46')]||_0x2a4c('0xfa'),'lastPauseAt':moment()['format'](_0x2a4c('0xef'))});})[_0x2a4c('0x33')](respondWithResult(_0x5215d6,null))[_0x2a4c('0x5e')](handleError(_0x5215d6,null));};exports['unpause']=function(_0x3dbffc,_0x14b55d,_0x15c992){var _0x5107a1;return db['User'][_0x2a4c('0x62')]({'where':{'id':_0x3dbffc[_0x2a4c('0x64')]['id']},'attributes':['id',_0x2a4c('0x41'),_0x2a4c('0x3e'),_0x2a4c('0xfb'),'mailPause',_0x2a4c('0xfc'),_0x2a4c('0xfd'),'openchannelPause',_0x2a4c('0xfe'),'whatsapppause',_0x2a4c('0xff'),_0x2a4c('0x100')]})[_0x2a4c('0x33')](handleEntityNotFound(_0x14b55d,null))[_0x2a4c('0x33')](function(_0x593e91){if(_0x593e91){_0x5107a1=_0x593e91;if(_0x3dbffc[_0x2a4c('0x63')]['channel']&&!utils['isValidChannel'](_0x3dbffc[_0x2a4c('0x63')][_0x2a4c('0xa4')])){throw new db[(_0x2a4c('0x95'))][(_0x2a4c('0x97'))](_0x2a4c('0xa8'));}switch(_0x3dbffc[_0x2a4c('0x63')][_0x2a4c('0xa4')]){case'voice':return respondWithRpcPromise(_0x2a4c('0xf9'),_0x2a4c('0x101'),{'id':_0x5107a1['id'],'name':_0x5107a1[_0x2a4c('0x41')],'pause':![]})[_0x2a4c('0x33')](function(){return db[_0x2a4c('0xb6')][_0x2a4c('0x32')]({'paused':0x0},{'where':{'UserId':_0x5107a1['id']},'individualHooks':!![]});})[_0x2a4c('0x33')](function(){return db[_0x2a4c('0xed')]['find']({'where':{'channel':_0x3dbffc[_0x2a4c('0x63')][_0x2a4c('0xa4')],'membername':_0x5107a1['name'],'type':_0x2a4c('0xf3'),'exitAt':null}});})[_0x2a4c('0x33')](function(_0x50642d){if(_0x50642d){return _0x50642d[_0x2a4c('0x32')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x2a4c('0x102')},{'individualHooks':!![]});}return null;})[_0x2a4c('0x33')](function(){return _0x5107a1['update']({'voicePause':![]});});case'mail':case _0x2a4c('0x103'):case _0x2a4c('0x104'):case'sms':case _0x2a4c('0x105'):case _0x2a4c('0x106'):return db[_0x2a4c('0xed')][_0x2a4c('0x62')]({'where':{'channel':_0x3dbffc[_0x2a4c('0x63')][_0x2a4c('0xa4')],'membername':_0x5107a1[_0x2a4c('0x41')],'type':'PAUSE','exitAt':null}})[_0x2a4c('0x33')](function(_0x23b546){if(_0x23b546){return _0x23b546['update']({'exitAt':moment()[_0x2a4c('0xb4')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x2a4c('0x102')},{'individualHooks':!![]});}return null;})[_0x2a4c('0x33')](function(){var _0x656f94={};_['set'](_0x656f94,util[_0x2a4c('0xb4')](_0x2a4c('0x107'),_0x3dbffc[_0x2a4c('0x63')][_0x2a4c('0xa4')],_0x2a4c('0x108')),![]);return _0x5107a1[_0x2a4c('0x32')](_0x656f94);});default:return respondWithRpcPromise(_0x2a4c('0xf9'),_0x2a4c('0x101'),{'id':_0x5107a1['id'],'name':_0x5107a1[_0x2a4c('0x41')],'pause':![]})[_0x2a4c('0x33')](function(){return db[_0x2a4c('0xb6')][_0x2a4c('0x32')]({'paused':0x0},{'where':{'UserId':_0x5107a1['id']}});})[_0x2a4c('0x33')](function(){return db['MemberReport'][_0x2a4c('0x5c')]({'where':{'membername':_0x5107a1[_0x2a4c('0x41')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x392d9e){var _0x2118fe=[];_0x392d9e['forEach'](function(_0x288a63){_0x2118fe[_0x2a4c('0x8f')](_0x288a63['update']({'exitAt':moment()[_0x2a4c('0xb4')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'}));});return BPromise[_0x2a4c('0x90')](_0x2118fe);})[_0x2a4c('0x33')](function(){return _0x5107a1['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x2a4c('0x33')](respondWithResult(_0x14b55d,null))[_0x2a4c('0x5e')](handleError(_0x14b55d,null));};exports[_0x2a4c('0x109')]=function(_0x588061,_0x500945,_0x42a284){var _0x342bae={};var _0x583b16={};var _0x676aa7;var _0x528ee7;return db[_0x2a4c('0x44')]['findOne']({'where':{'id':_0x588061[_0x2a4c('0x64')]['id']}})['then'](handleEntityNotFound(_0x500945,null))['then'](function(_0x370fcf){if(_0x370fcf){_0x676aa7=_0x370fcf;_0x583b16['model']=_[_0x2a4c('0x4b')](db['Team'][_0x2a4c('0x45')]);_0x583b16[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x588061[_0x2a4c('0x4a')]);_0x583b16[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x583b16[_0x2a4c('0x47')],_0x583b16[_0x2a4c('0x4a')]);_0x342bae[_0x2a4c('0x4f')]=_['intersection'](_0x583b16[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0x588061[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x342bae['attributes']=_0x342bae['attributes']['length']?_0x342bae['attributes']:_0x583b16['model'];_0x342bae[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x588061[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x342bae[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_['pick'](_0x588061['query'],_0x583b16[_0x2a4c('0x4c')]));if(_0x588061[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x342bae[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x342bae[_0x2a4c('0x53')],{'$or':_[_0x2a4c('0x3b')](_0x342bae[_0x2a4c('0x4f')],function(_0x459e28){var _0x19e35b={};_0x19e35b[_0x459e28]={'$like':'%'+_0x588061['query'][_0x2a4c('0x3a')]+'%'};return _0x19e35b;})});}_0x342bae=_[_0x2a4c('0x55')]({},_0x342bae,_0x588061[_0x2a4c('0x59')]);return _0x676aa7[_0x2a4c('0x109')](_0x342bae);}})['then'](function(_0x92cb58){if(_0x92cb58){_0x528ee7=_0x92cb58[_0x2a4c('0x61')];if(!_0x588061[_0x2a4c('0x4a')]['hasOwnProperty'](_0x2a4c('0x51'))){_0x342bae[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0x588061['query'][_0x2a4c('0x2d')]);_0x342bae[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0x588061[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);}return _0x676aa7[_0x2a4c('0x109')](_0x342bae);}})[_0x2a4c('0x33')](function(_0x565772){if(_0x565772){return _0x565772?{'count':_0x528ee7,'rows':_0x565772}:null;}})[_0x2a4c('0x33')](respondWithResult(_0x500945,null))[_0x2a4c('0x5e')](handleError(_0x500945,null));};exports[_0x2a4c('0x10a')]=function(_0xf04222,_0x5f0951){return db[_0x2a4c('0x44')]['find']({'where':{'id':_0xf04222[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x5f0951,null))[_0x2a4c('0x33')](function(_0x5d48a4){if(_0x5d48a4){var _0x29b24b=_0x5d48a4[_0x2a4c('0x35')]({'plain':!![]});return _0x5d48a4[_0x2a4c('0x10a')](_0xf04222[_0x2a4c('0x63')][_0x2a4c('0xac')],_['omit'](_0xf04222[_0x2a4c('0x63')],[_0x2a4c('0xac'),'id'])||{})[_0x2a4c('0x33')](function(){for(var _0x3e0b63=0x0;_0x3e0b63<_0xf04222[_0x2a4c('0x63')][_0x2a4c('0xac')][_0x2a4c('0x61')];_0x3e0b63++){var _0x391198=[];db[_0x2a4c('0x10b')]['findOne']({'where':{'id':_0xf04222[_0x2a4c('0x63')]['ids'][_0x3e0b63]}})[_0x2a4c('0x33')](function(_0x43128e){_0x391198[_0x2a4c('0x8f')](_0x43128e[_0x2a4c('0xeb')]()['then'](function(_0x28a9e2){for(var _0x565ddb=0x0;_0x565ddb<_0x28a9e2['length'];_0x565ddb++){_0x28a9e2[_0x565ddb][_0x2a4c('0x10c')](_0x2a4c('0xa4'),_0x2a4c('0x10d'));}return _0x28a9e2;}));_0x391198[_0x2a4c('0x8f')](_0x43128e[_0x2a4c('0x10e')]()[_0x2a4c('0x33')](function(_0x20b5c4){for(var _0x3bec35=0x0;_0x3bec35<_0x20b5c4[_0x2a4c('0x61')];_0x3bec35++){_0x20b5c4[_0x3bec35][_0x2a4c('0x10c')](_0x2a4c('0xa4'),'Chat');}return _0x20b5c4;}));_0x391198[_0x2a4c('0x8f')](_0x43128e[_0x2a4c('0x10f')]()[_0x2a4c('0x33')](function(_0x1c24ec){for(var _0xfdc846=0x0;_0xfdc846<_0x1c24ec[_0x2a4c('0x61')];_0xfdc846++){_0x1c24ec[_0xfdc846][_0x2a4c('0x10c')]('channel',_0x2a4c('0x110'));}return _0x1c24ec;}));_0x391198[_0x2a4c('0x8f')](_0x43128e[_0x2a4c('0x111')]()[_0x2a4c('0x33')](function(_0x4e5ab0){for(var _0x252ac4=0x0;_0x252ac4<_0x4e5ab0['length'];_0x252ac4++){_0x4e5ab0[_0x252ac4][_0x2a4c('0x10c')](_0x2a4c('0xa4'),'Sms');}return _0x4e5ab0;}));_0x391198['push'](_0x43128e[_0x2a4c('0x112')]()['then'](function(_0xdcd5f8){for(var _0x1b4b2c=0x0;_0x1b4b2c<_0xdcd5f8[_0x2a4c('0x61')];_0x1b4b2c++){_0xdcd5f8[_0x1b4b2c][_0x2a4c('0x10c')]('channel',_0x2a4c('0x113'));}return _0xdcd5f8;}));_0x391198['push'](_0x43128e[_0x2a4c('0x114')]()[_0x2a4c('0x33')](function(_0x510982){for(var _0x36ed6e=0x0;_0x36ed6e<_0x510982[_0x2a4c('0x61')];_0x36ed6e++){_0x510982[_0x36ed6e][_0x2a4c('0x10c')](_0x2a4c('0xa4'),_0x2a4c('0x115'));}return _0x510982;}));_0x391198[_0x2a4c('0x8f')](_0x43128e[_0x2a4c('0x116')]()[_0x2a4c('0x33')](function(_0x5ebd42){for(var _0x389cef=0x0;_0x389cef<_0x5ebd42[_0x2a4c('0x61')];_0x389cef++){_0x5ebd42[_0x389cef][_0x2a4c('0x10c')](_0x2a4c('0xa4'),'Openchannel');}return _0x5ebd42;}));return BPromise[_0x2a4c('0x90')](_0x391198);})[_0x2a4c('0x33')](function(_0x440f43){var _0x94e6cd=_[_0x2a4c('0x117')](_0x440f43);_0x391198=[];return db[_0x2a4c('0x57')][_0x2a4c('0x118')](function(_0x228f63){for(var _0x5a5f6b=0x0;_0x5a5f6b<_0x94e6cd[_0x2a4c('0x61')];_0x5a5f6b++){_0x391198[_0x2a4c('0x8f')](_0x94e6cd[_0x5a5f6b]['addAgent'](_0x29b24b['id']),{'transaction':_0x228f63});}return BPromise[_0x2a4c('0x90')](_0x391198)[_0x2a4c('0x33')](function(){if(_0x29b24b[_0x2a4c('0xa5')]){return BPromise[_0x2a4c('0x91')](_['filter'](_0x94e6cd,function(_0x399357){return _0x399357['getDataValue'](_0x2a4c('0xa4'))==='Voice';}),function(_0x5979bf){return db[_0x2a4c('0xb6')][_0x2a4c('0xb7')]({'membername':_0x29b24b[_0x2a4c('0x41')],'UserId':_0x29b24b['id'],'queue_name':_0x5979bf[_0x2a4c('0x41')],'VoiceQueueId':_0x5979bf['id'],'interface':_[_0x2a4c('0x6c')](_0x29b24b[_0x2a4c('0xb3')])?util[_0x2a4c('0xb4')](_0x2a4c('0xb5'),_0x29b24b[_0x2a4c('0x41')]):_0x29b24b['interface'],'paused':_0x29b24b[_0x2a4c('0xfb')]||![],'penalty':_0x29b24b[_0x2a4c('0xad')]},{'transaction':_0x228f63});});}else{return;}})[_0x2a4c('0x33')](function(){for(var _0x47c0a8=0x0;_0x47c0a8<_0x94e6cd[_0x2a4c('0x61')];_0x47c0a8++){var _0x37e85c=_0x94e6cd[_0x47c0a8][_0x2a4c('0x119')](_0x2a4c('0xa4'));var _0x5cdb55=_0x37e85c+_0x2a4c('0xaf');socket[_0x2a4c('0xb0')](_0x2a4c('0x81')+_0x37e85c+_0x2a4c('0x11a'),{'UserId':_0x29b24b['id'],['queueField']:_0x94e6cd[_0x47c0a8]['id']});}});});});}});}})[_0x2a4c('0x33')](respondWithStatusCode(_0x5f0951,null))['catch'](handleError(_0x5f0951,null));};exports[_0x2a4c('0x11b')]=function(_0x4ec8b3,_0x429f78){return db['User'][_0x2a4c('0xc3')]({'where':{'id':_0x4ec8b3[_0x2a4c('0x64')]['id']}})['then'](handleEntityNotFound(_0x429f78,null))[_0x2a4c('0x33')](function(_0x12442c){if(_0x12442c){var _0x5e1b48=_0x12442c[_0x2a4c('0x35')]({'plain':!![]});var _0x5af4ff=_0x4ec8b3['query'][_0x2a4c('0xac')];return _0x12442c['removeTeams'](_0x5af4ff)[_0x2a4c('0x33')](function(){for(var _0xfe15c8=0x0;_0xfe15c8<_0x5af4ff['length'];_0xfe15c8++){var _0x5cf231=[];db[_0x2a4c('0x10b')]['findOne']({'where':{'id':_0x5af4ff[_0xfe15c8]}})[_0x2a4c('0x33')](function(_0x13585c){_0x5cf231[_0x2a4c('0x8f')](_0x13585c[_0x2a4c('0xeb')]()[_0x2a4c('0x33')](function(_0x2711a5){for(var _0xb1b9d7=0x0;_0xb1b9d7<_0x2711a5[_0x2a4c('0x61')];_0xb1b9d7++){_0x2711a5[_0xb1b9d7][_0x2a4c('0x10c')](_0x2a4c('0xa4'),_0x2a4c('0x10d'));}return _0x2711a5;}));_0x5cf231[_0x2a4c('0x8f')](_0x13585c[_0x2a4c('0x10e')]()['then'](function(_0xab490a){for(var _0x419cb2=0x0;_0x419cb2<_0xab490a[_0x2a4c('0x61')];_0x419cb2++){_0xab490a[_0x419cb2][_0x2a4c('0x10c')](_0x2a4c('0xa4'),_0x2a4c('0x11c'));}return _0xab490a;}));_0x5cf231[_0x2a4c('0x8f')](_0x13585c['getMailQueues']()[_0x2a4c('0x33')](function(_0xc73644){for(var _0xdcf68f=0x0;_0xdcf68f<_0xc73644[_0x2a4c('0x61')];_0xdcf68f++){_0xc73644[_0xdcf68f][_0x2a4c('0x10c')](_0x2a4c('0xa4'),_0x2a4c('0x110'));}return _0xc73644;}));_0x5cf231[_0x2a4c('0x8f')](_0x13585c[_0x2a4c('0x111')]()[_0x2a4c('0x33')](function(_0x174dcc){for(var _0x1e18f9=0x0;_0x1e18f9<_0x174dcc[_0x2a4c('0x61')];_0x1e18f9++){_0x174dcc[_0x1e18f9][_0x2a4c('0x10c')]('channel',_0x2a4c('0x11d'));}return _0x174dcc;}));_0x5cf231[_0x2a4c('0x8f')](_0x13585c[_0x2a4c('0x112')]()['then'](function(_0x52cdbb){for(var _0xd2bd5b=0x0;_0xd2bd5b<_0x52cdbb['length'];_0xd2bd5b++){_0x52cdbb[_0xd2bd5b][_0x2a4c('0x10c')](_0x2a4c('0xa4'),_0x2a4c('0x113'));}return _0x52cdbb;}));_0x5cf231[_0x2a4c('0x8f')](_0x13585c['getFaxQueues']()['then'](function(_0x5daa2d){for(var _0x217202=0x0;_0x217202<_0x5daa2d[_0x2a4c('0x61')];_0x217202++){_0x5daa2d[_0x217202][_0x2a4c('0x10c')](_0x2a4c('0xa4'),_0x2a4c('0x115'));}return _0x5daa2d;}));_0x5cf231[_0x2a4c('0x8f')](_0x13585c[_0x2a4c('0x116')]()[_0x2a4c('0x33')](function(_0x5da253){for(var _0x5cab77=0x0;_0x5cab77<_0x5da253[_0x2a4c('0x61')];_0x5cab77++){_0x5da253[_0x5cab77]['setDataValue'](_0x2a4c('0xa4'),_0x2a4c('0x11e'));}return _0x5da253;}));return BPromise[_0x2a4c('0x90')](_0x5cf231);})[_0x2a4c('0x33')](function(_0x5aa8e6){var _0x47b34e=_[_0x2a4c('0x117')](_0x5aa8e6);_0x5cf231=[];return db[_0x2a4c('0x57')][_0x2a4c('0x118')](function(_0x32700d){for(var _0x309d4e=0x0;_0x309d4e<_0x47b34e[_0x2a4c('0x61')];_0x309d4e++){_0x5cf231['push'](_0x47b34e[_0x309d4e][_0x2a4c('0x11f')](_0x5e1b48['id']),{'transaction':_0x32700d});}return BPromise[_0x2a4c('0x90')](_0x5cf231)[_0x2a4c('0x33')](function(){if(_0x5e1b48[_0x2a4c('0xa5')]){return BPromise[_0x2a4c('0x91')](_[_0x2a4c('0x3a')](_0x47b34e,function(_0x4db0b4){return _0x4db0b4[_0x2a4c('0x119')](_0x2a4c('0xa4'))===_0x2a4c('0x10d');}),function(_0x26c2e6){return db[_0x2a4c('0xb6')][_0x2a4c('0x34')]({'where':{'VoiceQueueId':_0x26c2e6['id'],'UserId':_0x5e1b48['id']},'transaction':_0x32700d});});}else{return;}})[_0x2a4c('0x33')](function(){for(var _0x2cceb6=0x0;_0x2cceb6<_0x47b34e[_0x2a4c('0x61')];_0x2cceb6++){var _0x6f73a8=_0x47b34e[_0x2cceb6][_0x2a4c('0x119')](_0x2a4c('0xa4'));var _0x1c9901=_0x6f73a8+_0x2a4c('0xaf');socket[_0x2a4c('0xb0')](_0x2a4c('0x81')+_0x6f73a8+'Queue:remove',{'UserId':_0x5e1b48['id'],['queueField']:_0x47b34e[_0x2cceb6]['id']});}});});});}});}})[_0x2a4c('0x33')](respondWithStatusCode(_0x429f78,null))['catch'](handleError(_0x429f78,null));};exports['getLists']=function(_0xe7b65f,_0x111693,_0x4b9f0b){var _0x2c6246={};var _0xa9e0f6={};var _0x123bfd;var _0xc7bbd2;return db[_0x2a4c('0x44')][_0x2a4c('0xc3')]({'where':{'id':_0xe7b65f[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x111693,null))[_0x2a4c('0x33')](function(_0x4317c1){if(_0x4317c1){_0x123bfd=_0x4317c1;_0xa9e0f6[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db[_0x2a4c('0x120')]['rawAttributes']);_0xa9e0f6[_0x2a4c('0x4a')]=_['keys'](_0xe7b65f['query']);_0xa9e0f6[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0xa9e0f6[_0x2a4c('0x47')],_0xa9e0f6[_0x2a4c('0x4a')]);_0x2c6246[_0x2a4c('0x4f')]=_['intersection'](_0xa9e0f6[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0xe7b65f[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x2c6246['attributes']=_0x2c6246[_0x2a4c('0x4f')]['length']?_0x2c6246['attributes']:_0xa9e0f6[_0x2a4c('0x47')];_0x2c6246[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0xe7b65f['query'][_0x2a4c('0x52')]);_0x2c6246[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0xe7b65f[_0x2a4c('0x4a')],_0xa9e0f6[_0x2a4c('0x4c')]));if(_0xe7b65f['query']['filter']){_0x2c6246[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x2c6246['where'],{'$or':_[_0x2a4c('0x3b')](_0x2c6246[_0x2a4c('0x4f')],function(_0x2c6aaa){var _0x1854b6={};_0x1854b6[_0x2c6aaa]={'$like':'%'+_0xe7b65f['query'][_0x2a4c('0x3a')]+'%'};return _0x1854b6;})});}_0x2c6246=_[_0x2a4c('0x55')]({},_0x2c6246,_0xe7b65f[_0x2a4c('0x59')]);return _0x123bfd[_0x2a4c('0x121')](_0x2c6246);}})[_0x2a4c('0x33')](function(_0x302ed8){if(_0x302ed8){_0xc7bbd2=_0x302ed8[_0x2a4c('0x61')];if(!_0xe7b65f[_0x2a4c('0x4a')][_0x2a4c('0x50')]('nolimit')){_0x2c6246['limit']=qs[_0x2a4c('0x2d')](_0xe7b65f['query'][_0x2a4c('0x2d')]);_0x2c6246[_0x2a4c('0x2c')]=qs['offset'](_0xe7b65f[_0x2a4c('0x4a')]['offset']);}return _0x123bfd[_0x2a4c('0x121')](_0x2c6246);}})['then'](function(_0x2997c9){if(_0x2997c9){return _0x2997c9?{'count':_0xc7bbd2,'rows':_0x2997c9}:null;}})['then'](respondWithResult(_0x111693,null))[_0x2a4c('0x5e')](handleError(_0x111693,null));};exports[_0x2a4c('0x122')]=function(_0x1623df,_0x45d4dd,_0x3cfd9f){var _0x40fabb={};var _0x572b53={};var _0xc8bb1e;var _0x328ca0;return db[_0x2a4c('0x44')]['findOne']({'where':{'id':_0x1623df['params']['id']}})['then'](handleEntityNotFound(_0x45d4dd,null))[_0x2a4c('0x33')](function(_0x3c7fb1){if(_0x3c7fb1){_0xc8bb1e=_0x3c7fb1;_0x572b53[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db[_0x2a4c('0x44')][_0x2a4c('0x45')]);_0x572b53[_0x2a4c('0x4a')]=_['keys'](_0x1623df['query']);_0x572b53[_0x2a4c('0x4c')]=_['intersection'](_0x572b53[_0x2a4c('0x47')],_0x572b53[_0x2a4c('0x4a')]);_0x40fabb[_0x2a4c('0x4f')]=_['intersection'](_0x572b53['model'],qs[_0x2a4c('0x4e')](_0x1623df[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x40fabb[_0x2a4c('0x4f')]=_0x40fabb[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0x40fabb[_0x2a4c('0x4f')]:_0x572b53[_0x2a4c('0x47')];_0x40fabb[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x1623df[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x40fabb[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x1623df['query'],_0x572b53[_0x2a4c('0x4c')]));if(_0x1623df[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x40fabb[_0x2a4c('0x53')]=_['merge'](_0x40fabb[_0x2a4c('0x53')],{'$or':_[_0x2a4c('0x3b')](_0x40fabb[_0x2a4c('0x4f')],function(_0x116ea7){var _0xe109e={};_0xe109e[_0x116ea7]={'$like':'%'+_0x1623df[_0x2a4c('0x4a')][_0x2a4c('0x3a')]+'%'};return _0xe109e;})});}_0x40fabb['model']=db[_0x2a4c('0x44')];_0x40fabb['as']='Agents';_0x40fabb=_[_0x2a4c('0x55')]({},_0x40fabb,_0x1623df[_0x2a4c('0x59')]);return _0xc8bb1e[_0x2a4c('0xeb')]({'include':[_0x40fabb]});}})[_0x2a4c('0x33')](function(_0x4f580d){if(_0x4f580d){var _0x542ccf={},_0x2a424c=[],_0x59e623=0x0;for(var _0x2f1abe=0x0;_0x2f1abe<_0x4f580d[_0x2a4c('0x61')];_0x2f1abe+=0x1){for(var _0x406b94=0x0,_0x4ef33f;_0x406b94<_0x4f580d[_0x2f1abe][_0x2a4c('0x37')][_0x2a4c('0x61')];_0x406b94+=0x1){_0x4ef33f=_0x4f580d[_0x2f1abe][_0x2a4c('0x37')][_0x406b94][_0x2a4c('0x35')]({'plain':!![]});_0x542ccf[_0x4ef33f['id']]=_0x4ef33f;}}_0x542ccf=_[_0x2a4c('0x123')](_0x542ccf);for(var _0x35ec52=qs['offset'](_0x1623df[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);_0x35ec52<_0x542ccf['length']&&_0x2a424c[_0x2a4c('0x61')]=_0x44e0b4){_0x1f26a9=_0x44e0b4;_0x2dad35=0xc8;}else{_0x2dad35=0xce;}_0x5e9dda[_0x8855('0x2b')](_0x2dad35);return _0x5e9dda[_0x8855('0x2f')](_0x8855('0x30'),_0x346b2+'-'+_0x1f26a9+'/'+_0x44e0b4)[_0x8855('0x2d')](_0x44802d);}return null;};}function patchUpdates(_0x29bf15){return function(_0x48fcfe){try{jsonpatch['apply'](_0x48fcfe,_0x29bf15,!![]);}catch(_0x4dcf24){return BPromise['reject'](_0x4dcf24);}return _0x48fcfe[_0x8855('0x31')]();};}function saveUpdates(_0x2756da,_0x59e2a1){return function(_0x2e8756){if(_0x2e8756){return _0x2e8756['update'](_0x2756da)[_0x8855('0x21')](function(_0x3e78f6){return _0x3e78f6;});}return null;};}function removeEntity(_0x36a66c,_0x31197d){return function(_0x50cffb){if(_0x50cffb){return _0x50cffb[_0x8855('0x32')]()[_0x8855('0x21')](function(){var _0x5e7a56=_0x50cffb[_0x8855('0x33')]({'plain':!![]});if(_0x5e7a56[_0x8855('0x34')]===_0x8855('0x35'))return;var _0x24e977=[{'name':'Users','value':_0x8855('0x36'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x8855('0x37'),'value':_0x8855('0x38'),'ignore':![]}];var _0x33d066=_(_0x24e977)['filter'](_0x8855('0x39'))[_0x8855('0x3a')](_0x8855('0x3b'))[_0x8855('0x3b')]();if(_[_0x8855('0x3c')](_0x33d066,_0x5e7a56[_0x8855('0x34')])){return;}var _0x1e1070=_[_0x8855('0x3d')](_0x24e977,[_0x8855('0x3b'),_0x5e7a56[_0x8855('0x34')]])['name'];return db[_0x8855('0x3e')][_0x8855('0x32')]({'where':{'type':_0x1e1070,'resourceId':_0x5e7a56['id']}})[_0x8855('0x21')](function(){return _0x50cffb;});})[_0x8855('0x21')](function(){_0x36a66c[_0x8855('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a72e4,_0x2b9658){return function(_0x576785){if(!_0x576785){_0x4a72e4['sendStatus'](0x194);}return _0x576785;};}function handleError(_0xc3f96c,_0x41d106){_0x41d106=_0x41d106||0x1f4;return function(_0x437aad){logger[_0x8855('0x25')](_0x437aad[_0x8855('0x3f')]);if(_0x437aad['name']){delete _0x437aad[_0x8855('0x40')];}_0xc3f96c[_0x8855('0x2b')](_0x41d106)[_0x8855('0x41')](_0x437aad);};}exports['index']=function(_0x42c985,_0xea3a3){var _0x21e182={},_0x160f97={},_0xa82144={'count':0x0,'rows':[]};var _0x113583=_[_0x8855('0x3a')](db[_0x8855('0x42')][_0x8855('0x43')],function(_0x1f55c1){return{'name':_0x1f55c1['fieldName'],'type':_0x1f55c1['type']['key']};});_0x160f97[_0x8855('0x44')]=_[_0x8855('0x45')](_[_0x8855('0x3a')](_0x113583,_0x8855('0x40')),[_0x8855('0x46'),'salt']);_0x160f97[_0x8855('0x47')]=_[_0x8855('0x48')](_0x42c985[_0x8855('0x47')]);_0x160f97['filters']=_['intersection'](_0x160f97[_0x8855('0x44')],_0x160f97['query']);_0x21e182[_0x8855('0x49')]=_[_0x8855('0x4a')](_0x160f97[_0x8855('0x44')],qs[_0x8855('0x4b')](_0x42c985[_0x8855('0x47')][_0x8855('0x4b')]));_0x21e182[_0x8855('0x49')]=_0x21e182[_0x8855('0x49')][_0x8855('0x4c')]?_0x21e182[_0x8855('0x49')]:_0x160f97['model'];if(!_0x42c985[_0x8855('0x47')]['hasOwnProperty']('nolimit')){_0x21e182['limit']=qs[_0x8855('0x4d')](_0x42c985[_0x8855('0x47')][_0x8855('0x4d')]);_0x21e182['offset']=qs[_0x8855('0x4e')](_0x42c985[_0x8855('0x47')][_0x8855('0x4e')]);}_0x21e182[_0x8855('0x4f')]=qs['sort'](_0x42c985[_0x8855('0x47')]['sort']);_0x21e182[_0x8855('0x50')]=qs[_0x8855('0x51')](_[_0x8855('0x52')](_0x42c985[_0x8855('0x47')],_0x160f97[_0x8855('0x51')]),_0x113583);if(_0x42c985[_0x8855('0x47')][_0x8855('0x53')]){_0x21e182[_0x8855('0x50')]=_['merge'](_0x21e182[_0x8855('0x50')],{'$or':_[_0x8855('0x3a')](_0x113583,function(_0x4e3d61){if(_0x4e3d61['type']!==_0x8855('0x54')){return db[_0x8855('0x55')][_0x8855('0x50')](db['sequelize']['fn']('lower',db[_0x8855('0x55')]['col'](_0x4e3d61['name'])),{'$like':db[_0x8855('0x55')]['fn'](_0x8855('0x56'),'%'+_0x42c985['query'][_0x8855('0x53')]+'%')});}})});}_0x21e182=_['merge']({},_0x21e182,_0x42c985[_0x8855('0x57')]);var _0x5e7314={'where':_0x21e182['where']};return db[_0x8855('0x42')]['count'](_0x5e7314)['then'](function(_0xad84d8){_0xa82144[_0x8855('0x2e')]=_0xad84d8;if(_0x42c985[_0x8855('0x47')][_0x8855('0x58')]){_0x21e182[_0x8855('0x59')]=[{'all':!![]}];}return db[_0x8855('0x42')][_0x8855('0x5a')](_0x21e182);})[_0x8855('0x21')](function(_0xc157e8){_0xa82144[_0x8855('0x5b')]=_0xc157e8;return _0xa82144;})[_0x8855('0x21')](respondWithFilteredResult(_0xea3a3,_0x21e182))[_0x8855('0x29')](handleError(_0xea3a3,null));};exports[_0x8855('0x5c')]=function(_0xdbb35a,_0x53f619){var _0x10069b={'raw':![],'where':{'id':_0xdbb35a[_0x8855('0x5d')]['id']}},_0x7f0c30={};_0x7f0c30['model']=_[_0x8855('0x45')](_[_0x8855('0x48')](db[_0x8855('0x42')][_0x8855('0x43')]),[_0x8855('0x46'),_0x8855('0x5e')]);_0x7f0c30['query']=_['keys'](_0xdbb35a[_0x8855('0x47')]);_0x7f0c30[_0x8855('0x51')]=_['intersection'](_0x7f0c30['model'],_0x7f0c30['query']);_0x10069b[_0x8855('0x49')]=_['intersection'](_0x7f0c30['model'],qs[_0x8855('0x4b')](_0xdbb35a[_0x8855('0x47')][_0x8855('0x4b')]));_0x10069b[_0x8855('0x49')]=_0x10069b['attributes'][_0x8855('0x4c')]?_0x10069b[_0x8855('0x49')]:_0x7f0c30[_0x8855('0x44')];if(_0xdbb35a[_0x8855('0x47')]['includeAll']){_0x10069b['include']=[{'all':!![]}];}_0x10069b=_[_0x8855('0x5f')]({},_0x10069b,_0xdbb35a[_0x8855('0x57')]);return db[_0x8855('0x42')][_0x8855('0x3d')](_0x10069b)['then'](handleEntityNotFound(_0x53f619,null))[_0x8855('0x21')](respondWithResult(_0x53f619,null))[_0x8855('0x29')](handleError(_0x53f619,null));};exports[_0x8855('0x60')]=function(_0x3e5997,_0x480ff9){if(_0x3e5997[_0x8855('0x61')]['id']){delete _0x3e5997[_0x8855('0x61')]['id'];}delete _0x3e5997[_0x8855('0x61')][_0x8855('0x34')];return db[_0x8855('0x42')][_0x8855('0x3d')]({'where':{'id':_0x3e5997['params']['id']}})['then'](handleEntityNotFound(_0x480ff9,null))['then'](saveUpdates(_0x3e5997[_0x8855('0x61')],null))[_0x8855('0x21')](respondWithResult(_0x480ff9,null))[_0x8855('0x29')](handleError(_0x480ff9,null));};exports['describe']=function(_0x1347fa,_0x5a8cb0){return db[_0x8855('0x42')][_0x8855('0x62')]()[_0x8855('0x21')](respondWithResult(_0x5a8cb0,null))[_0x8855('0x29')](handleError(_0x5a8cb0,null));};exports[_0x8855('0x63')]=function(_0x10e5d3,_0x2819eb,_0x3fceb3){return db[_0x8855('0x42')]['find']({'where':{'id':_0x10e5d3['params']['id']}})[_0x8855('0x21')](handleEntityNotFound(_0x2819eb,null))[_0x8855('0x21')](function(_0x9d6e1e){if(_0x9d6e1e){return _0x9d6e1e[_0x8855('0x63')](_0x10e5d3[_0x8855('0x61')][_0x8855('0x64')],_[_0x8855('0x65')](_0x10e5d3['body'],[_0x8855('0x64'),'id'])||{});}})[_0x8855('0x21')](respondWithResult(_0x2819eb,null))[_0x8855('0x29')](handleError(_0x2819eb,null));};function validateUser(_0x336f9c){return new BPromise(function(_0x90f948,_0xda46a8){if(_0x336f9c['internal'])return _0x90f948(_0x336f9c);return db[_0x8855('0x66')]['findById'](0x1)[_0x8855('0x21')](function(_0x59338e){if(_0x59338e['securePassword'])authService[_0x8855('0x67')](_0x336f9c['password']);db['User'][_0x8855('0x68')]('internal')[_0x8855('0x21')](function(_0x3b3453){if(_['isNil'](_0x3b3453)){_0x336f9c['internal']=_0x59338e['min_internal']||0x1;return;}if(_[_0x8855('0x69')](_0x59338e[_0x8855('0x6a')])||_0x59338e[_0x8855('0x6a')]===_0x3b3453){_0x336f9c['internal']=_0x3b3453+0x1;return;}if(_0x59338e[_0x8855('0x6a')]>_0x3b3453){_0x336f9c[_0x8855('0x6b')]=_0x59338e[_0x8855('0x6a')];return;}return db[_0x8855('0x55')][_0x8855('0x47')](_0x8855('0x6c'),{'type':db[_0x8855('0x55')][_0x8855('0x6d')][_0x8855('0x6e')]})[_0x8855('0x21')](function(_0xef043e){if(_0xef043e&&_0xef043e[_0x8855('0x4c')]){for(var _0x1d7410=0x0,_0x33cbbb=_0xef043e[_0x8855('0x4c')];_0x1d7410<_0x33cbbb&&_[_0x8855('0x69')](_0x336f9c['internal']);_0x1d7410++){if(_0x59338e['min_internal']<=_0xef043e[_0x1d7410]['from']){_0x336f9c[_0x8855('0x6b')]=_0xef043e[_0x1d7410][_0x8855('0x6f')];}else if(_0x59338e['min_internal']>_0xef043e[_0x1d7410][_0x8855('0x6f')]&&_0x59338e[_0x8855('0x6a')]<=_0xef043e[_0x1d7410]['to']){_0x336f9c[_0x8855('0x6b')]=_0x59338e[_0x8855('0x6a')];}}}if(_[_0x8855('0x69')](_0x336f9c[_0x8855('0x6b')])){_0x336f9c[_0x8855('0x6b')]=_0x3b3453+0x1;}return _0x90f948(_0x336f9c);});});})[_0x8855('0x29')](function(_0x5b39de){_0xda46a8(_0x5b39de);});});}function updateUser(_0x211156){return new BPromise(function(_0x31297e,_0x26bb1b){try{if(_0x211156['voicemail']){_0x211156[_0x8855('0x70')]=_0x211156['internal'];_0x211156[_0x8855('0x71')]={'mailbox':_0x211156[_0x8855('0x6b')],'password':_0x211156['password'],'fullname':_0x211156[_0x8855('0x72')],'email':_0x211156[_0x8855('0x73')]};}if(_0x211156[_0x8855('0x34')]===_0x8855('0x74')){if(!_0x211156[_0x8855('0x75')])_0x211156[_0x8855('0x75')]=[_0x8855('0x76'),_0x8855('0x77'),_0x8855('0x78'),'113','110',_0x8855('0x79'),_0x8855('0x7a'),_0x8855('0x7b'),'107',_0x8855('0x7c'),'109',_0x8855('0x7d'),'111',_0x8855('0x7e')];}_0x31297e(_0x211156);}catch(_0x21e5a1){_0x26bb1b(_0x21e5a1);}});}exports['create']=function(_0x5a8859,_0x488f6b){if(_0x5a8859[_0x8855('0x36')][_0x8855('0x34')]===_0x8855('0x74'))throw new Error(_0x8855('0x7f'));if(_0x5a8859[_0x8855('0x61')][_0x8855('0x34')]==='user'&&_0x5a8859[_0x8855('0x36')][_0x8855('0x34')]!==_0x8855('0x35')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x5a8859[_0x8855('0x61')][_0x8855('0x34')]==='admin'&&_0x5a8859[_0x8855('0x36')]['role']!==_0x8855('0x35')){throw new Error(_0x8855('0x80'));}return licenseUtil['checkUserLimits']([_0x5a8859[_0x8855('0x61')]])[_0x8855('0x21')](function(){return validateUser(_0x5a8859[_0x8855('0x61')]);})[_0x8855('0x21')](function(_0x27b414){return updateUser(_0x27b414)[_0x8855('0x21')](function(_0x56160e){if(_0x56160e['role']==='admin'){_0x56160e[_0x8855('0x81')]=_0x5a8859[_0x8855('0x36')][_0x8855('0x81')];delete _0x56160e[_0x8855('0x82')];}return _0x56160e;});})[_0x8855('0x21')](function(_0x564838){return db[_0x8855('0x42')][_0x8855('0x83')](_0x564838,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0x8855('0x21')](function(_0x2aa23e){if(_0x5a8859[_0x8855('0x61')]['role']===_0x8855('0x36'))return _0x2aa23e;if(_0x5a8859[_0x8855('0x36')][_0x8855('0x34')]!==_0x8855('0x36'))return _0x2aa23e;return db[_0x8855('0x84')][_0x8855('0x3d')]({'where':{'name':_0x2aa23e['role']==='agent'?_0x8855('0x85'):_0x8855('0x37'),'userProfileId':_0x5a8859[_0x8855('0x36')][_0x8855('0x82')]},'raw':!![]})[_0x8855('0x21')](function(_0x34c4db){if(!_0x34c4db||_0x34c4db['autoAssociation']!=0x0)return _0x2aa23e;return db[_0x8855('0x3e')]['create']({'name':_0x2aa23e[_0x8855('0x40')],'resourceId':_0x2aa23e['id'],'type':_0x34c4db[_0x8855('0x40')],'sectionId':_0x34c4db['id']},{})['then'](function(){return _0x2aa23e;});})['catch'](function(_0x4c0b38){logger['error'](_0x8855('0x86'),_0x4c0b38);throw _0x4c0b38;});})[_0x8855('0x21')](respondWithResult(_0x488f6b,0xc9))[_0x8855('0x29')](handleError(_0x488f6b,null));};exports[_0x8855('0x87')]=function(_0x5f1e8b,_0x3f80e5){var _0x2d1ce9=_0x5f1e8b[_0x8855('0x61')];var _0x1f7389=[];if(_0x5f1e8b['user'][_0x8855('0x34')]===_0x8855('0x74'))throw new Error('Unauthorized');if(_['some'](_0x2d1ce9,[_0x8855('0x34'),_0x8855('0x36')])&&_0x5f1e8b['user'][_0x8855('0x34')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x8855('0x88')](_0x2d1ce9,[_0x8855('0x34'),'admin'])&&_0x5f1e8b[_0x8855('0x36')][_0x8855('0x34')]!==_0x8855('0x35')){throw new Error(_0x8855('0x89'));}return licenseUtil[_0x8855('0x8a')](_0x2d1ce9)[_0x8855('0x21')](function(){return validateUser(_0x2d1ce9[0x0]);})['then'](function(){for(var _0x51b92b=0x1;_0x51b92b<_0x2d1ce9[_0x8855('0x4c')];_0x51b92b++){var _0x3b3b4d=_0x2d1ce9[_0x51b92b-0x1][_0x8855('0x6b')];if(!_0x2d1ce9[_0x51b92b][_0x8855('0x6b')])_0x2d1ce9[_0x51b92b][_0x8855('0x6b')]=_0x3b3b4d+0x1;_0x1f7389['push'](validateUser(_0x2d1ce9[_0x51b92b]));}return BPromise[_0x8855('0x8b')](_0x1f7389);})[_0x8855('0x21')](function(){_0x1f7389=[];for(var _0x25029b=0x0;_0x25029b<_0x2d1ce9['length'];_0x25029b++){_0x1f7389[_0x8855('0x8c')](updateUser(_0x2d1ce9[_0x25029b]));}return BPromise[_0x8855('0x8b')](_0x1f7389);})[_0x8855('0x21')](function(){return BPromise[_0x8855('0x8d')](_0x2d1ce9,function(_0x2c373d){return db[_0x8855('0x42')][_0x8855('0x83')](_0x2c373d,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x8855('0x21')](function(_0x26c344){_0x2c373d['id']=_0x26c344['id'];return _0x2c373d;});});})[_0x8855('0x21')](function(_0x273507){if(_0x5f1e8b['body']['role']===_0x8855('0x36'))return _0x273507;if(_0x5f1e8b[_0x8855('0x36')]['role']!==_0x8855('0x36'))return _0x273507;var _0x41f91c=_['some'](_0x273507,function(_0x54c951){return _0x54c951[_0x8855('0x34')]===_0x8855('0x74')||_0x54c951[_0x8855('0x34')]===_0x8855('0x38');});if(!_0x41f91c)return _0x273507;return db[_0x8855('0x84')][_0x8855('0x5a')]({'where':{'name':{'$or':['Agents',_0x8855('0x37')]},'userProfileId':_0x5f1e8b[_0x8855('0x36')][_0x8855('0x82')]},'raw':!![]})[_0x8855('0x21')](function(_0x741d08){if(_['isEmpty'](_0x741d08)||!_[_0x8855('0x88')](_0x741d08,[_0x8855('0x8e'),0x0]))return _0x273507;_0x1f7389=[];var _0x310d82=_(_0x741d08)[_0x8855('0x3a')](function(_0x5a71e3){if(_0x5a71e3[_0x8855('0x8e')]===0x1)return;return _0x5a71e3[_0x8855('0x40')]==='Agents'?_0x8855('0x74'):_0x8855('0x38');})[_0x8855('0x8f')]()[_0x8855('0x3b')]();for(var _0x760a4c=0x0;_0x760a4c<_0x273507['length'];_0x760a4c++){if(!_[_0x8855('0x3c')](_0x310d82,_0x273507[_0x760a4c][_0x8855('0x34')]))return;var _0x33d749=_0x273507[_0x760a4c][_0x8855('0x34')]===_0x8855('0x74')?_0x8855('0x85'):_0x8855('0x37');_0x1f7389[_0x8855('0x8c')](db[_0x8855('0x3e')][_0x8855('0x83')]({'name':_0x273507[_0x760a4c]['name'],'resourceId':_0x273507[_0x760a4c]['id'],'type':_0x33d749,'sectionId':_[_0x8855('0x3d')](_0x741d08,['name',_0x33d749])['id']},{}));}return BPromise[_0x8855('0x8b')](_0x1f7389);})[_0x8855('0x21')](respondWithResult(_0x3f80e5,0xc9))[_0x8855('0x29')](handleError(_0x3f80e5,null));});};exports[_0x8855('0x90')]=function(_0x565e74,_0xe6951b,_0x56ab14){if(_0x565e74[_0x8855('0x61')]['id']){delete _0x565e74[_0x8855('0x61')]['id'];}return db[_0x8855('0x42')]['find']({'where':{'id':_0x565e74[_0x8855('0x5d')]['id']}})[_0x8855('0x21')](function(_0x1b786b){if(!_0x1b786b)return null;if(_0x1b786b['id']===_0x565e74[_0x8855('0x36')]['id']){if(!_0x565e74[_0x8855('0x61')][_0x8855('0x91')]||!_0x565e74[_0x8855('0x61')]['newPassword']){throw new db[(_0x8855('0x92'))][(_0x8855('0x93'))](_0x8855('0x94'));}if(!_0x1b786b[_0x8855('0x95')](_0x565e74[_0x8855('0x61')][_0x8855('0x91')])){throw new db[(_0x8855('0x92'))][(_0x8855('0x93'))](_0x8855('0x96'));}if(_0x565e74['body'][_0x8855('0x91')]===_0x565e74['body']['newPassword']){throw new db[(_0x8855('0x92'))][(_0x8855('0x93'))](_0x8855('0x97'));}}else if(_0x565e74['user']['role']===_0x8855('0x35')){if(!_0x565e74[_0x8855('0x61')][_0x8855('0x98')]){throw new db['Sequelize'][(_0x8855('0x93'))](_0x8855('0x99'));}}else if(_0x565e74[_0x8855('0x36')][_0x8855('0x34')]==='user'){if(!_0x565e74[_0x8855('0x61')]['newPassword']){throw new db[(_0x8855('0x92'))][(_0x8855('0x93'))](_0x8855('0x99'));}if(_0x1b786b['role']!==_0x8855('0x74')){throw new db[(_0x8855('0x92'))][(_0x8855('0x93'))](_0x8855('0x7f'));}}else{throw new db['Sequelize'][(_0x8855('0x93'))](_0x8855('0x7f'));}return _0x1b786b;})[_0x8855('0x21')](handleEntityNotFound(_0xe6951b,null))[_0x8855('0x21')](function(_0x4c724b){return db[_0x8855('0x66')]['findOne']({'attributes':['id',_0x8855('0x9a'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x8855('0x21')](function(_0x36f4f7){if(_0x36f4f7['securePassword'])authService[_0x8855('0x67')](_0x565e74[_0x8855('0x61')]['newPassword']);if(!_0x36f4f7[_0x8855('0x9b')]||!_0x4c724b[_0x8855('0x9c')])return _0x4c724b;authService['validatePasswordHistory'](_0x565e74[_0x8855('0x61')][_0x8855('0x98')],_0x4c724b[_0x8855('0x9c')],_0x36f4f7[_0x8855('0x9d')]);return _0x4c724b;})[_0x8855('0x21')](saveUpdates({'password':_0x565e74[_0x8855('0x61')]['newPassword'],'passwordResetAt':_0x565e74[_0x8855('0x36')]['id']==_0x565e74['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x565e74[_0x8855('0x61')][_0x8855('0x98')],_0x4c724b[_0x8855('0x9c')])},null));})[_0x8855('0x21')](respondWithResult(_0xe6951b,null))[_0x8855('0x29')](handleError(_0xe6951b,null));};exports[_0x8855('0x9e')]=function(_0x37015a,_0x4891f6,_0x114f25){var _0x1da824=_0x37015a[_0x8855('0x61')][_0x8855('0x9f')];return db[_0x8855('0x42')][_0x8855('0x3d')]({'where':{'id':_0x37015a[_0x8855('0x5d')]['id']},'attributes':['id',_0x8855('0x40'),_0x8855('0x34'),_0x8855('0xa0'),_0x8855('0xa1'),_0x8855('0xa2'),_0x8855('0xa3')]})['then'](handleEntityNotFound(_0x4891f6,null))['then'](function(_0x1300d1){if(_0x1300d1){if(!utils[_0x8855('0xa4')](_0x1da824)){throw new db[(_0x8855('0x92'))]['ValidationError'](_0x8855('0xa5'));}return _0x1300d1['add'+_[_0x8855('0xa6')](_0x1da824[_0x8855('0xa7')]())+_0x8855('0xa8')](_0x37015a[_0x8855('0x61')]['ids'],{'penalty':_0x37015a[_0x8855('0x61')][_0x8855('0xa9')]||0x0})[_0x8855('0xaa')](function(_0x48f0cc){for(var _0x5065b4=0x0;_0x5065b4<_0x37015a[_0x8855('0x61')][_0x8855('0x64')][_0x8855('0x4c')];_0x5065b4+=0x1){var _0x300188={'UserId':_0x37015a['params']['id']};_0x300188[_['capitalize'](_0x1da824[_0x8855('0xa7')]())+_0x8855('0xab')]=_0x37015a[_0x8855('0x61')][_0x8855('0x64')][_0x5065b4];socket['emit'](_0x8855('0x36')+_[_0x8855('0xa6')](_0x1da824[_0x8855('0xa7')]())+_0x8855('0xac'),_0x300188);}return _0x48f0cc;})[_0x8855('0x21')](function(){if(_0x1da824==='voice'){return db['VoiceQueue'][_0x8855('0x5a')]({'where':{'id':_0x37015a['body']['ids']||[]},'raw':!![],'attributes':['id',_0x8855('0x40')]});}})[_0x8855('0x21')](function(_0x5ce123){var _0x1408b5=_0x1300d1[_0x8855('0x33')]({'plain':!![]});var _0x385133=[];if(_0x1da824===_0x8855('0xad')&&_0x1408b5['role']==='agent'&&_0x1408b5[_0x8855('0xa0')]){for(var _0x30657d=0x0;_0x30657d<_0x5ce123['length'];_0x30657d+=0x1){_0x385133['push']({'membername':_0x1408b5[_0x8855('0x40')],'UserId':_0x1408b5['id'],'queue_name':_0x5ce123[_0x30657d][_0x8855('0x40')],'VoiceQueueId':_0x5ce123[_0x30657d]['id'],'interface':_[_0x8855('0x69')](_0x1408b5['interface'])?util[_0x8855('0xae')](_0x8855('0xaf'),_0x1408b5[_0x8855('0x40')]):_0x1408b5['interface'],'paused':_0x1408b5['voicePause']||![],'penalty':_0x37015a[_0x8855('0x61')][_0x8855('0xa9')]||0x0});}return BPromise[_0x8855('0x8d')](_0x385133,function(_0x100937){return db[_0x8855('0xb0')][_0x8855('0xb1')](_0x100937);});}return _0x1300d1;});}})['then'](respondWithStatusCode(_0x4891f6,null))[_0x8855('0x29')](handleError(_0x4891f6,null));};exports[_0x8855('0xb2')]=function(_0x3b66ae,_0x379348,_0x23e5b9){var _0x336814;return db[_0x8855('0x42')][_0x8855('0x3d')]({'where':{'id':_0x3b66ae[_0x8855('0x5d')]['id']},'attributes':['id',_0x8855('0x40'),_0x8855('0x34')]})[_0x8855('0x21')](handleEntityNotFound(_0x379348,null))[_0x8855('0x21')](function(_0x17bd6a){if(_0x17bd6a){_0x336814=_0x17bd6a;if(!_0x3b66ae['query'][_0x8855('0x9f')]||!utils['isValidChannel'](_0x3b66ae['query'][_0x8855('0x9f')])){throw new db[(_0x8855('0x92'))][(_0x8855('0x93'))](_0x8855('0xa5'));}return _0x17bd6a['remove'+_[_0x8855('0xa6')](_0x3b66ae['query'][_0x8855('0x9f')][_0x8855('0xa7')]())+_0x8855('0xa8')](_0x3b66ae['query']['ids']);}})['then'](function(_0x37563c){for(var _0xd93b42=0x0;_0xd93b42<_0x3b66ae['query'][_0x8855('0x64')]['length'];_0xd93b42+=0x1){var _0x54fd31={'UserId':_0x3b66ae[_0x8855('0x5d')]['id']};_0x54fd31[_[_0x8855('0xa6')](_0x3b66ae[_0x8855('0x47')][_0x8855('0x9f')]['toLowerCase']())+'QueueId']=_0x3b66ae[_0x8855('0x47')]['ids'][_0xd93b42];socket[_0x8855('0xb3')]('user'+_[_0x8855('0xa6')](_0x3b66ae[_0x8855('0x47')][_0x8855('0x9f')][_0x8855('0xa7')]())+_0x8855('0xb4'),_0x54fd31);}return _0x37563c;})['then'](function(){if(_0x3b66ae['query'][_0x8855('0x9f')]===_0x8855('0xad')){return db['UserVoiceQueueRt'][_0x8855('0x32')]({'where':{'UserId':_0x3b66ae[_0x8855('0x5d')]['id'],'VoiceQueueId':_0x3b66ae[_0x8855('0x47')][_0x8855('0x64')]},'individualHooks':!![]})[_0x8855('0x21')](function(){return _0x336814;});}return _0x336814;})[_0x8855('0x21')](respondWithStatusCode(_0x379348,null))[_0x8855('0x29')](handleError(_0x379348,null));};exports['addAvatar']=function(_0xf52a5,_0x471eaa,_0x1adbf3){_0xf52a5[_0x8855('0x61')][_0x8855('0xb5')]=_0xf52a5[_0x8855('0xb6')][_0x8855('0xb7')];return db[_0x8855('0x42')][_0x8855('0x3d')]({'where':{'id':_0xf52a5[_0x8855('0x5d')]['id']}})[_0x8855('0x21')](handleEntityNotFound(_0x471eaa,null))['then'](saveUpdates(_0xf52a5[_0x8855('0x61')],null))['then'](respondWithResult(_0x471eaa,null))[_0x8855('0x29')](handleError(_0x471eaa,null));};exports[_0x8855('0xb8')]=function(_0x2101b2,_0x15fdfc,_0x6fa6ff){var _0x132e34=path[_0x8855('0xb9')](config['root'],_0x8855('0xba'));return db[_0x8855('0x42')][_0x8855('0x3d')]({'where':{'id':_0x2101b2[_0x8855('0x5d')]['id']},'attributes':['id',_0x8855('0xb5')],'raw':!![]})[_0x8855('0x21')](handleEntityNotFound(_0x15fdfc,null))[_0x8855('0x21')](function(_0x53ec30){if(_0x53ec30){if(_[_0x8855('0x69')](_0x53ec30[_0x8855('0xb5')])){return _0x15fdfc[_0x8855('0xbb')](_0x132e34);}else{if(!fs[_0x8855('0xbc')](path[_0x8855('0xb9')](config[_0x8855('0xbd')],_0x8855('0xbe'),_0x53ec30[_0x8855('0xb5')]))){return _0x15fdfc[_0x8855('0xbb')](_0x132e34);}return _0x15fdfc[_0x8855('0xbb')](path[_0x8855('0xb9')](config[_0x8855('0xbd')],_0x8855('0xbe'),_0x53ec30[_0x8855('0xb5')]));}}})[_0x8855('0x29')](handleError(_0x15fdfc,null));};exports['getContacts']=function(_0xde67e0,_0x41e3ac,_0x553492){var _0x3b593e={};var _0x1b13ed={};var _0xd7e54b;var _0x453af7;return db[_0x8855('0x42')][_0x8855('0xbf')]({'where':{'id':_0xde67e0[_0x8855('0x5d')]['id']}})['then'](handleEntityNotFound(_0x41e3ac,null))[_0x8855('0x21')](function(_0x5dec86){if(_0x5dec86){_0xd7e54b=_0x5dec86;_0x1b13ed['model']=_[_0x8855('0x48')](db[_0x8855('0xc0')]['rawAttributes']);_0x1b13ed[_0x8855('0x47')]=_['keys'](_0xde67e0[_0x8855('0x47')]);_0x1b13ed['filters']=_['intersection'](_0x1b13ed['model'],_0x1b13ed['query']);_0x3b593e['attributes']=_[_0x8855('0x4a')](_0x1b13ed['model'],qs[_0x8855('0x4b')](_0xde67e0['query'][_0x8855('0x4b')]));_0x3b593e[_0x8855('0x49')]=_0x3b593e[_0x8855('0x49')][_0x8855('0x4c')]?_0x3b593e[_0x8855('0x49')]:_0x1b13ed[_0x8855('0x44')];_0x3b593e['order']=qs[_0x8855('0xc1')](_0xde67e0[_0x8855('0x47')][_0x8855('0xc1')]);_0x3b593e[_0x8855('0x50')]=qs[_0x8855('0x51')](_['pick'](_0xde67e0[_0x8855('0x47')],_0x1b13ed[_0x8855('0x51')]));if(_0xde67e0['query'][_0x8855('0x53')]){_0x3b593e[_0x8855('0x50')]=_[_0x8855('0x5f')](_0x3b593e['where'],{'$or':_[_0x8855('0x3a')](_0x3b593e['attributes'],function(_0x14c030){var _0x41d868={};_0x41d868[_0x14c030]={'$like':'%'+_0xde67e0['query'][_0x8855('0x53')]+'%'};return _0x41d868;})});}_0x3b593e=_[_0x8855('0x5f')]({},_0x3b593e,_0xde67e0[_0x8855('0x57')]);return _0xd7e54b[_0x8855('0xc2')](_0x3b593e);}})['then'](function(_0x298637){if(_0x298637){_0x453af7=_0x298637[_0x8855('0x4c')];if(_0xde67e0[_0x8855('0x47')]['hasOwnProperty'](_0x8855('0x58'))){_0x3b593e[_0x8855('0x59')]=[{'model':db[_0x8855('0xc3')],'as':_0x8855('0xc4'),'required':![]},{'model':db['Tag'],'as':_0x8855('0xc5'),'attributes':['id',_0x8855('0x40'),'color'],'where':_0xde67e0[_0x8855('0x47')][_0x8855('0xc6')]?{'id':_0xde67e0['query'][_0x8855('0xc6')]}:undefined,'required':_0xde67e0[_0x8855('0x47')][_0x8855('0xc6')]?!![]:![]}];}if(!_0xde67e0['query']['hasOwnProperty'](_0x8855('0xc7'))){_0x3b593e[_0x8855('0x4d')]=qs['limit'](_0xde67e0['query'][_0x8855('0x4d')]);_0x3b593e[_0x8855('0x4e')]=qs[_0x8855('0x4e')](_0xde67e0[_0x8855('0x47')]['offset']);}return _0xd7e54b['getContacts'](_0x3b593e);}})[_0x8855('0x21')](function(_0x466527){if(_0x466527){return _0x466527?{'count':_0x453af7,'rows':_0x466527}:null;}})['then'](respondWithResult(_0x41e3ac,null))['catch'](handleError(_0x41e3ac,null));};exports['getQueues']=function(_0x27dc18,_0xa4e6f6,_0x26c069){var _0x21ae7e;var _0x4e6000;var _0x2321f5={};var _0x50e035;return db['User'][_0x8855('0xbf')]({'where':{'id':_0x27dc18[_0x8855('0x5d')]['id']},'attributes':['id',_0x8855('0x40'),_0x8855('0x34')]})[_0x8855('0x21')](handleEntityNotFound(_0xa4e6f6,null))[_0x8855('0x21')](function(_0x44cf3a){if(!utils[_0x8855('0xa4')](_0x27dc18[_0x8855('0x47')]['channel'])){throw new db[(_0x8855('0x92'))]['ValidationError']('Unknown\x20channel');}_0x21ae7e=_0x44cf3a;var _0x70edcd={};_0x70edcd[_0x8855('0x44')]=_[_0x8855('0x48')](db[_[_0x8855('0xa6')](_0x27dc18['query'][_0x8855('0x9f')])+_0x8855('0xc8')]['rawAttributes']);_0x70edcd[_0x8855('0x47')]=_[_0x8855('0x48')](_0x27dc18[_0x8855('0x47')]);_0x70edcd[_0x8855('0x51')]=_[_0x8855('0x4a')](_0x70edcd[_0x8855('0x44')],_0x70edcd[_0x8855('0x47')]);_0x2321f5['attributes']=_['intersection'](_0x70edcd[_0x8855('0x44')],qs[_0x8855('0x4b')](_0x27dc18[_0x8855('0x47')]['fields']));_0x2321f5[_0x8855('0x49')]=_0x2321f5['attributes'][_0x8855('0x4c')]?_0x2321f5[_0x8855('0x49')]:_0x70edcd[_0x8855('0x44')];_0x2321f5[_0x8855('0x4f')]=qs[_0x8855('0xc1')](_0x27dc18[_0x8855('0x47')]['sort']);_0x2321f5[_0x8855('0x50')]=qs[_0x8855('0x51')](_[_0x8855('0x52')](_0x27dc18['query'],_0x70edcd['filters']));if(_0x27dc18['query'][_0x8855('0x53')]){_0x2321f5[_0x8855('0x50')]=_[_0x8855('0x5f')](_0x2321f5[_0x8855('0x50')],{'$or':_[_0x8855('0x3a')](_0x2321f5[_0x8855('0x49')],function(_0x5c84f2){var _0x159cf9={};_0x159cf9[_0x5c84f2]={'$like':'%'+_0x27dc18[_0x8855('0x47')][_0x8855('0x53')]+'%'};return _0x159cf9;})});}_0x2321f5=_[_0x8855('0x5f')]({},_0x2321f5,_0x27dc18['options']);switch(_0x21ae7e[_0x8855('0x34')]){case _0x8855('0x35'):return db[_[_0x8855('0xa6')](_0x27dc18[_0x8855('0x47')][_0x8855('0x9f')])+_0x8855('0xc8')][_0x8855('0x5a')](_0x2321f5);case'user':case _0x8855('0x74'):return _0x21ae7e['get'+_['capitalize'](_0x27dc18[_0x8855('0x47')][_0x8855('0x9f')])+_0x8855('0xa8')](_0x2321f5);default:throw new db['Sequelize']['ValidationError'](_0x8855('0xc9'));}})[_0x8855('0x21')](function(_0x4082a0){_0x50e035=_0x4082a0[_0x8855('0x4c')];if(!_0x27dc18[_0x8855('0x47')]['hasOwnProperty'](_0x8855('0xc7'))){_0x2321f5['limit']=qs['limit'](_0x27dc18[_0x8855('0x47')]['limit']);_0x2321f5[_0x8855('0x4e')]=qs[_0x8855('0x4e')](_0x27dc18[_0x8855('0x47')]['offset']);}switch(_0x21ae7e[_0x8855('0x34')]){case _0x8855('0x35'):return db[_['capitalize'](_0x27dc18['query']['channel'])+_0x8855('0xc8')][_0x8855('0x5a')](_0x2321f5);case _0x8855('0x36'):case'agent':return _0x21ae7e[_0x8855('0x33')+_[_0x8855('0xa6')](_0x27dc18[_0x8855('0x47')][_0x8855('0x9f')])+'Queues'](_0x2321f5);}})[_0x8855('0x21')](function(_0x5c35ae){return{'count':_0x50e035,'rows':_0x5c35ae};})[_0x8855('0x21')](respondWithResult(_0xa4e6f6,null))[_0x8855('0x29')](handleError(_0xa4e6f6,null));};exports[_0x8855('0xca')]=function(_0x5c38ba,_0xa5c3f3,_0x13e57a){var _0x133774={};var _0xc44945={};var _0x4542fd;var _0x5367ad;return db[_0x8855('0x42')][_0x8855('0xbf')]({'where':{'id':_0x5c38ba['params']['id']}})[_0x8855('0x21')](handleEntityNotFound(_0xa5c3f3,null))[_0x8855('0x21')](function(_0x17eed7){if(_0x17eed7){_0x4542fd=_0x17eed7;_0xc44945[_0x8855('0x44')]=_[_0x8855('0x48')](db[_0x8855('0xb0')][_0x8855('0x43')]);_0xc44945[_0x8855('0x47')]=_[_0x8855('0x48')](_0x5c38ba['query']);_0xc44945[_0x8855('0x51')]=_[_0x8855('0x4a')](_0xc44945[_0x8855('0x44')],_0xc44945[_0x8855('0x47')]);_0x133774['attributes']=_['intersection'](_0xc44945['model'],qs[_0x8855('0x4b')](_0x5c38ba['query'][_0x8855('0x4b')]));_0x133774[_0x8855('0x49')]=_0x133774[_0x8855('0x49')][_0x8855('0x4c')]?_0x133774[_0x8855('0x49')]:_0xc44945[_0x8855('0x44')];_0x133774[_0x8855('0x4f')]=qs[_0x8855('0xc1')](_0x5c38ba[_0x8855('0x47')][_0x8855('0xc1')]);_0x133774['where']=qs[_0x8855('0x51')](_[_0x8855('0x52')](_0x5c38ba['query'],_0xc44945[_0x8855('0x51')]));if(_0x5c38ba['query'][_0x8855('0x53')]){_0x133774['where']=_['merge'](_0x133774[_0x8855('0x50')],{'$or':_['map'](_0x133774[_0x8855('0x49')],function(_0x33069f){var _0x4fe841={};_0x4fe841[_0x33069f]={'$like':'%'+_0x5c38ba[_0x8855('0x47')][_0x8855('0x53')]+'%'};return _0x4fe841;})});}_0x133774=_[_0x8855('0x5f')]({},_0x133774,_0x5c38ba[_0x8855('0x57')]);return _0x4542fd[_0x8855('0xca')](_0x133774);}})['then'](function(_0x10c8a5){if(_0x10c8a5){_0x5367ad=_0x10c8a5['length'];if(!_0x5c38ba[_0x8855('0x47')][_0x8855('0xcb')]('nolimit')){_0x133774['limit']=qs[_0x8855('0x4d')](_0x5c38ba['query']['limit']);_0x133774[_0x8855('0x4e')]=qs[_0x8855('0x4e')](_0x5c38ba['query'][_0x8855('0x4e')]);}return _0x4542fd[_0x8855('0xca')](_0x133774);}})['then'](function(_0x2ab9a7){if(_0x2ab9a7){return _0x2ab9a7?{'count':_0x5367ad,'rows':_0x2ab9a7}:null;}})[_0x8855('0x21')](respondWithResult(_0xa5c3f3,null))[_0x8855('0x29')](handleError(_0xa5c3f3,null));};exports[_0x8855('0xcc')]=function(_0x574149,_0x122b86,_0xf88ea4){var _0x2f5110={};var _0x4a56ab={};var _0x2a9065;var _0x14a8e4;return db[_0x8855('0x42')][_0x8855('0xbf')]({'where':{'id':_0x574149[_0x8855('0x5d')]['id']}})[_0x8855('0x21')](handleEntityNotFound(_0x122b86,null))[_0x8855('0x21')](function(_0x59f6eb){if(_0x59f6eb){_0x2a9065=_0x59f6eb;_0x4a56ab[_0x8855('0x44')]=_[_0x8855('0x48')](db[_0x8855('0xcd')][_0x8855('0x43')]);_0x4a56ab['query']=_[_0x8855('0x48')](_0x574149[_0x8855('0x47')]);_0x4a56ab[_0x8855('0x51')]=_[_0x8855('0x4a')](_0x4a56ab[_0x8855('0x44')],_0x4a56ab[_0x8855('0x47')]);_0x2f5110['attributes']=_[_0x8855('0x4a')](_0x4a56ab[_0x8855('0x44')],qs[_0x8855('0x4b')](_0x574149[_0x8855('0x47')][_0x8855('0x4b')]));_0x2f5110['attributes']=_0x2f5110[_0x8855('0x49')][_0x8855('0x4c')]?_0x2f5110[_0x8855('0x49')]:_0x4a56ab[_0x8855('0x44')];_0x2f5110[_0x8855('0x4f')]=qs[_0x8855('0xc1')](_0x574149['query'][_0x8855('0xc1')]);_0x2f5110[_0x8855('0x50')]=qs['filters'](_[_0x8855('0x52')](_0x574149[_0x8855('0x47')],_0x4a56ab[_0x8855('0x51')]));if(_0x574149[_0x8855('0x47')][_0x8855('0x53')]){_0x2f5110[_0x8855('0x50')]=_[_0x8855('0x5f')](_0x2f5110[_0x8855('0x50')],{'$or':_[_0x8855('0x3a')](_0x2f5110['attributes'],function(_0x516355){var _0x6fd09a={};_0x6fd09a[_0x516355]={'$like':'%'+_0x574149[_0x8855('0x47')][_0x8855('0x53')]+'%'};return _0x6fd09a;})});}_0x2f5110=_[_0x8855('0x5f')]({},_0x2f5110,_0x574149['options']);return _0x2a9065[_0x8855('0xcc')](_0x2f5110);}})['then'](function(_0x23ca2d){if(_0x23ca2d){_0x14a8e4=_0x23ca2d['length'];if(!_0x574149['query'][_0x8855('0xcb')](_0x8855('0xc7'))){_0x2f5110[_0x8855('0x4d')]=qs[_0x8855('0x4d')](_0x574149[_0x8855('0x47')][_0x8855('0x4d')]);_0x2f5110[_0x8855('0x4e')]=qs[_0x8855('0x4e')](_0x574149['query'][_0x8855('0x4e')]);}return _0x2a9065[_0x8855('0xcc')](_0x2f5110);}})[_0x8855('0x21')](function(_0x4f5480){if(_0x4f5480){return _0x4f5480?{'count':_0x14a8e4,'rows':_0x4f5480}:null;}})[_0x8855('0x21')](respondWithResult(_0x122b86,null))[_0x8855('0x29')](handleError(_0x122b86,null));};exports[_0x8855('0xce')]=function(_0x2716ec,_0x33b82b,_0x5c393e){var _0xd5a6ed={'raw':!![],'where':{}};var _0x35150e={};var _0x494265={'count':0x0,'rows':[]};return db['User'][_0x8855('0xbf')]({'where':{'id':_0x2716ec[_0x8855('0x5d')]['id']}})[_0x8855('0x21')](handleEntityNotFound(_0x33b82b,null))[_0x8855('0x21')](function(_0xf7b298){if(_0xf7b298){_0x35150e[_0x8855('0x44')]=_[_0x8855('0x48')](db['VoiceRecording'][_0x8855('0x43')]);_0x35150e[_0x8855('0x47')]=_['keys'](_0x2716ec['query']);_0x35150e[_0x8855('0x51')]=_[_0x8855('0x4a')](_0x35150e[_0x8855('0x44')],_0x35150e[_0x8855('0x47')]);_0xd5a6ed[_0x8855('0x49')]=_[_0x8855('0x4a')](_0x35150e[_0x8855('0x44')],qs[_0x8855('0x4b')](_0x2716ec['query'][_0x8855('0x4b')]));_0xd5a6ed[_0x8855('0x49')]=_0xd5a6ed[_0x8855('0x49')][_0x8855('0x4c')]?_0xd5a6ed[_0x8855('0x49')]:_0x35150e[_0x8855('0x44')];if(!_0x2716ec['query'][_0x8855('0xcb')](_0x8855('0xc7'))){_0xd5a6ed[_0x8855('0x4d')]=qs[_0x8855('0x4d')](_0x2716ec[_0x8855('0x47')][_0x8855('0x4d')]);_0xd5a6ed[_0x8855('0x4e')]=qs[_0x8855('0x4e')](_0x2716ec[_0x8855('0x47')][_0x8855('0x4e')]);}_0xd5a6ed['order']=qs[_0x8855('0xc1')](_0x2716ec['query'][_0x8855('0xc1')]);_0xd5a6ed[_0x8855('0x50')]=qs[_0x8855('0x51')](_[_0x8855('0x52')](_0x2716ec['query'],_0x35150e['filters']));_0xd5a6ed['where'][_0x8855('0xcf')]=_0xf7b298['id'];if(_0x2716ec[_0x8855('0x47')][_0x8855('0x53')]){_0xd5a6ed[_0x8855('0x50')]=_[_0x8855('0x5f')](_0xd5a6ed[_0x8855('0x50')],{'$or':_[_0x8855('0x3a')](_0xd5a6ed['attributes'],function(_0x3bd5ce){var _0x3d97a2={};_0x3d97a2[_0x3bd5ce]={'$like':'%'+_0x2716ec['query'][_0x8855('0x53')]+'%'};return _0x3d97a2;})});}_0xd5a6ed=_[_0x8855('0x5f')]({},_0xd5a6ed,_0x2716ec[_0x8855('0x57')]);return db['VoiceRecording'][_0x8855('0x2e')]({'where':_0xd5a6ed['where']})[_0x8855('0x21')](function(_0x372b2d){_0x494265[_0x8855('0x2e')]=_0x372b2d;if(_0x2716ec[_0x8855('0x47')][_0x8855('0x58')]){_0xd5a6ed['include']=[{'all':!![]}];}return db[_0x8855('0xd0')]['findAll'](_0xd5a6ed);})[_0x8855('0x21')](function(_0xf55983){_0x494265[_0x8855('0x5b')]=_0xf55983;return _0x494265;});}})['then'](respondWithFilteredResult(_0x33b82b,_0xd5a6ed))[_0x8855('0x29')](handleError(_0x33b82b,null));};exports[_0x8855('0xd1')]=function(_0x3a98c0,_0x5a60f6,_0x37f4c1){var _0x2d54aa={'raw':!![],'where':{}};var _0x109fee={};var _0x34119a={'count':0x0,'rows':[]};return db[_0x8855('0x42')][_0x8855('0xbf')]({'where':{'id':_0x3a98c0[_0x8855('0x5d')]['id']}})[_0x8855('0x21')](handleEntityNotFound(_0x5a60f6,null))[_0x8855('0x21')](function(_0x28e0ea){if(_0x28e0ea){_0x109fee[_0x8855('0x44')]=_[_0x8855('0x48')](db[_0x8855('0xd2')][_0x8855('0x43')]);_0x109fee[_0x8855('0x47')]=_[_0x8855('0x48')](_0x3a98c0[_0x8855('0x47')]);_0x109fee[_0x8855('0x51')]=_[_0x8855('0x4a')](_0x109fee[_0x8855('0x44')],_0x109fee['query']);_0x2d54aa['attributes']=_[_0x8855('0x4a')](_0x109fee['model'],qs['fields'](_0x3a98c0[_0x8855('0x47')]['fields']));_0x2d54aa[_0x8855('0x49')]=_0x2d54aa[_0x8855('0x49')][_0x8855('0x4c')]?_0x2d54aa[_0x8855('0x49')]:_0x109fee[_0x8855('0x44')];if(!_0x3a98c0[_0x8855('0x47')][_0x8855('0xcb')](_0x8855('0xc7'))){_0x2d54aa[_0x8855('0x4d')]=qs[_0x8855('0x4d')](_0x3a98c0[_0x8855('0x47')][_0x8855('0x4d')]);_0x2d54aa[_0x8855('0x4e')]=qs[_0x8855('0x4e')](_0x3a98c0[_0x8855('0x47')][_0x8855('0x4e')]);}_0x2d54aa[_0x8855('0x4f')]=qs[_0x8855('0xc1')](_0x3a98c0[_0x8855('0x47')]['sort']);_0x2d54aa[_0x8855('0x50')]=qs[_0x8855('0x51')](_['pick'](_0x3a98c0[_0x8855('0x47')],_0x109fee[_0x8855('0x51')]));_0x2d54aa[_0x8855('0x50')][_0x8855('0xcf')]=_0x28e0ea['id'];if(_0x3a98c0[_0x8855('0x47')]['filter']){_0x2d54aa['where']=_['merge'](_0x2d54aa[_0x8855('0x50')],{'$or':_[_0x8855('0x3a')](_0x2d54aa[_0x8855('0x49')],function(_0x1938ee){var _0x2e3556={};_0x2e3556[_0x1938ee]={'$like':'%'+_0x3a98c0[_0x8855('0x47')]['filter']+'%'};return _0x2e3556;})});}_0x2d54aa=_['merge']({},_0x2d54aa,_0x3a98c0[_0x8855('0x57')]);return db[_0x8855('0xd2')][_0x8855('0x2e')]({'where':_0x2d54aa[_0x8855('0x50')]})[_0x8855('0x21')](function(_0x2d9f36){_0x34119a[_0x8855('0x2e')]=_0x2d9f36;if(_0x3a98c0[_0x8855('0x47')]['includeAll']){_0x2d54aa[_0x8855('0x59')]=[{'all':!![]}];}return db[_0x8855('0xd2')]['findAll'](_0x2d54aa);})[_0x8855('0x21')](function(_0x45a83e){_0x34119a[_0x8855('0x5b')]=_0x45a83e;return _0x34119a;});}})[_0x8855('0x21')](respondWithFilteredResult(_0x5a60f6,_0x2d54aa))[_0x8855('0x29')](handleError(_0x5a60f6,null));};exports['getChatInteractions']=function(_0x516c50,_0x2cec1d,_0x2bae49){var _0x530bf6={};var _0x4fa6e3={};var _0x4b6723;var _0x3e1579;return db['User'][_0x8855('0xbf')]({'where':{'id':_0x516c50['params']['id']}})[_0x8855('0x21')](handleEntityNotFound(_0x2cec1d,null))[_0x8855('0x21')](function(_0x5affad){if(_0x5affad){_0x4b6723=_0x5affad;_0x4fa6e3[_0x8855('0x44')]=_[_0x8855('0x48')](db[_0x8855('0xd3')]['rawAttributes']);_0x4fa6e3[_0x8855('0x47')]=_[_0x8855('0x48')](_0x516c50[_0x8855('0x47')]);_0x4fa6e3[_0x8855('0x51')]=_[_0x8855('0x4a')](_0x4fa6e3[_0x8855('0x44')],_0x4fa6e3[_0x8855('0x47')]);_0x530bf6[_0x8855('0x49')]=_['intersection'](_0x4fa6e3[_0x8855('0x44')],qs[_0x8855('0x4b')](_0x516c50[_0x8855('0x47')]['fields']));_0x530bf6['attributes']=_0x530bf6[_0x8855('0x49')]['length']?_0x530bf6[_0x8855('0x49')]:_0x4fa6e3[_0x8855('0x44')];_0x530bf6[_0x8855('0x4f')]=qs['sort'](_0x516c50['query'][_0x8855('0xc1')]);_0x530bf6[_0x8855('0x50')]=qs['filters'](_[_0x8855('0x52')](_0x516c50[_0x8855('0x47')],_0x4fa6e3[_0x8855('0x51')]));if(_0x516c50[_0x8855('0x47')][_0x8855('0x53')]){_0x530bf6[_0x8855('0x50')]=_[_0x8855('0x5f')](_0x530bf6[_0x8855('0x50')],{'$or':_[_0x8855('0x3a')](_0x530bf6['attributes'],function(_0x50a2e1){var _0xfbc61f={};_0xfbc61f[_0x50a2e1]={'$like':'%'+_0x516c50[_0x8855('0x47')][_0x8855('0x53')]+'%'};return _0xfbc61f;})});}_0x530bf6=_[_0x8855('0x5f')]({},_0x530bf6,_0x516c50[_0x8855('0x57')]);return _0x4b6723[_0x8855('0xd4')](_0x530bf6);}})[_0x8855('0x21')](function(_0x149029){if(_0x149029){_0x3e1579=_0x149029[_0x8855('0x4c')];if(!_0x516c50[_0x8855('0x47')][_0x8855('0xcb')](_0x8855('0xc7'))){_0x530bf6[_0x8855('0x4d')]=qs[_0x8855('0x4d')](_0x516c50[_0x8855('0x47')][_0x8855('0x4d')]);_0x530bf6[_0x8855('0x4e')]=qs['offset'](_0x516c50[_0x8855('0x47')][_0x8855('0x4e')]);}return _0x4b6723[_0x8855('0xd4')](_0x530bf6);}})[_0x8855('0x21')](function(_0x41e857){if(_0x41e857){return _0x41e857?{'count':_0x3e1579,'rows':_0x41e857}:null;}})[_0x8855('0x21')](respondWithResult(_0x2cec1d,null))[_0x8855('0x29')](handleError(_0x2cec1d,null));};exports[_0x8855('0xd5')]=function(_0x5b4a09,_0x48eedf,_0x3a8ee7){var _0x423b2d={};var _0x34f8b5={};var _0x58cc55;var _0x198a62;return db[_0x8855('0x42')][_0x8855('0xbf')]({'where':{'id':_0x5b4a09[_0x8855('0x5d')]['id']}})[_0x8855('0x21')](handleEntityNotFound(_0x48eedf,null))[_0x8855('0x21')](function(_0xf36a01){if(_0xf36a01){_0x58cc55=_0xf36a01;_0x34f8b5[_0x8855('0x44')]=_[_0x8855('0x48')](db[_0x8855('0xd6')][_0x8855('0x43')]);_0x34f8b5[_0x8855('0x47')]=_[_0x8855('0x48')](_0x5b4a09[_0x8855('0x47')]);_0x34f8b5['filters']=_['intersection'](_0x34f8b5[_0x8855('0x44')],_0x34f8b5[_0x8855('0x47')]);_0x423b2d['attributes']=_[_0x8855('0x4a')](_0x34f8b5[_0x8855('0x44')],qs['fields'](_0x5b4a09[_0x8855('0x47')]['fields']));_0x423b2d[_0x8855('0x49')]=_0x423b2d[_0x8855('0x49')][_0x8855('0x4c')]?_0x423b2d[_0x8855('0x49')]:_0x34f8b5[_0x8855('0x44')];_0x423b2d['order']=qs[_0x8855('0xc1')](_0x5b4a09[_0x8855('0x47')][_0x8855('0xc1')]);_0x423b2d['where']=qs[_0x8855('0x51')](_['pick'](_0x5b4a09[_0x8855('0x47')],_0x34f8b5[_0x8855('0x51')]));if(_0x5b4a09[_0x8855('0x47')]['filter']){_0x423b2d['where']=_[_0x8855('0x5f')](_0x423b2d['where'],{'$or':_[_0x8855('0x3a')](_0x423b2d['attributes'],function(_0x229379){var _0x1e8588={};_0x1e8588[_0x229379]={'$like':'%'+_0x5b4a09[_0x8855('0x47')][_0x8855('0x53')]+'%'};return _0x1e8588;})});}_0x423b2d=_[_0x8855('0x5f')]({},_0x423b2d,_0x5b4a09[_0x8855('0x57')]);return _0x58cc55['getOpenchannelInteractions'](_0x423b2d);}})['then'](function(_0x8f4ad6){if(_0x8f4ad6){_0x198a62=_0x8f4ad6[_0x8855('0x4c')];if(!_0x5b4a09[_0x8855('0x47')][_0x8855('0xcb')](_0x8855('0xc7'))){_0x423b2d['limit']=qs[_0x8855('0x4d')](_0x5b4a09['query']['limit']);_0x423b2d[_0x8855('0x4e')]=qs['offset'](_0x5b4a09[_0x8855('0x47')][_0x8855('0x4e')]);}return _0x58cc55[_0x8855('0xd5')](_0x423b2d);}})[_0x8855('0x21')](function(_0x3d81d9){if(_0x3d81d9){return _0x3d81d9?{'count':_0x198a62,'rows':_0x3d81d9}:null;}})['then'](respondWithResult(_0x48eedf,null))[_0x8855('0x29')](handleError(_0x48eedf,null));};exports[_0x8855('0xd7')]=function(_0x3961b7,_0x445cc6,_0x38b1fb){var _0x3d657c={'raw':!![],'where':{}};var _0x49a190={};var _0x3ad9a1={'count':0x0,'rows':[]};return db[_0x8855('0x42')][_0x8855('0xbf')]({'where':{'id':_0x3961b7[_0x8855('0x5d')]['id']}})[_0x8855('0x21')](handleEntityNotFound(_0x445cc6,null))[_0x8855('0x21')](function(_0xa5bc30){if(_0xa5bc30){_0x49a190['model']=_['keys'](db[_0x8855('0xd8')]['rawAttributes']);_0x49a190['query']=_[_0x8855('0x48')](_0x3961b7[_0x8855('0x47')]);_0x49a190[_0x8855('0x51')]=_[_0x8855('0x4a')](_0x49a190[_0x8855('0x44')],_0x49a190[_0x8855('0x47')]);_0x3d657c[_0x8855('0x49')]=_[_0x8855('0x4a')](_0x49a190[_0x8855('0x44')],qs['fields'](_0x3961b7['query']['fields']));_0x3d657c[_0x8855('0x49')]=_0x3d657c[_0x8855('0x49')][_0x8855('0x4c')]?_0x3d657c['attributes']:_0x49a190[_0x8855('0x44')];if(!_0x3961b7[_0x8855('0x47')]['hasOwnProperty'](_0x8855('0xc7'))){_0x3d657c[_0x8855('0x4d')]=qs[_0x8855('0x4d')](_0x3961b7[_0x8855('0x47')]['limit']);_0x3d657c[_0x8855('0x4e')]=qs[_0x8855('0x4e')](_0x3961b7[_0x8855('0x47')]['offset']);}_0x3d657c[_0x8855('0x4f')]=qs[_0x8855('0xc1')](_0x3961b7[_0x8855('0x47')][_0x8855('0xc1')]);_0x3d657c[_0x8855('0x50')]=qs[_0x8855('0x51')](_['pick'](_0x3961b7[_0x8855('0x47')],_0x49a190[_0x8855('0x51')]));_0x3d657c[_0x8855('0x50')][_0x8855('0xcf')]=_0xa5bc30['id'];if(_0x3961b7['query'][_0x8855('0x53')]){_0x3d657c['where']=_['merge'](_0x3d657c[_0x8855('0x50')],{'$or':_[_0x8855('0x3a')](_0x3d657c[_0x8855('0x49')],function(_0x633887){var _0x39c69f={};_0x39c69f[_0x633887]={'$like':'%'+_0x3961b7[_0x8855('0x47')][_0x8855('0x53')]+'%'};return _0x39c69f;})});}_0x3d657c=_[_0x8855('0x5f')]({},_0x3d657c,_0x3961b7[_0x8855('0x57')]);return db[_0x8855('0xd8')][_0x8855('0x2e')]({'where':_0x3d657c[_0x8855('0x50')]})[_0x8855('0x21')](function(_0x47e369){_0x3ad9a1['count']=_0x47e369;if(_0x3961b7[_0x8855('0x47')][_0x8855('0x58')]){_0x3d657c[_0x8855('0x59')]=[{'all':!![]}];}return db[_0x8855('0xd8')][_0x8855('0x5a')](_0x3d657c);})['then'](function(_0x1c1e36){_0x3ad9a1[_0x8855('0x5b')]=_0x1c1e36;return _0x3ad9a1;});}})['then'](respondWithFilteredResult(_0x445cc6,_0x3d657c))[_0x8855('0x29')](handleError(_0x445cc6,null));};exports[_0x8855('0xd9')]=function(_0x54158c,_0x2aec4a,_0x255d28){var _0x1d126e={};var _0x3a8ffc={};var _0x38f027;var _0x304597;return db[_0x8855('0x42')][_0x8855('0xbf')]({'where':{'id':_0x54158c[_0x8855('0x5d')]['id']}})[_0x8855('0x21')](handleEntityNotFound(_0x2aec4a,null))[_0x8855('0x21')](function(_0x195567){if(_0x195567){_0x38f027=_0x195567;_0x3a8ffc[_0x8855('0x44')]=_[_0x8855('0x48')](db[_0x8855('0xda')][_0x8855('0x43')]);_0x3a8ffc[_0x8855('0x47')]=_[_0x8855('0x48')](_0x54158c[_0x8855('0x47')]);_0x3a8ffc[_0x8855('0x51')]=_[_0x8855('0x4a')](_0x3a8ffc[_0x8855('0x44')],_0x3a8ffc[_0x8855('0x47')]);_0x1d126e[_0x8855('0x49')]=_[_0x8855('0x4a')](_0x3a8ffc['model'],qs[_0x8855('0x4b')](_0x54158c['query'][_0x8855('0x4b')]));_0x1d126e[_0x8855('0x49')]=_0x1d126e['attributes']['length']?_0x1d126e['attributes']:_0x3a8ffc[_0x8855('0x44')];_0x1d126e[_0x8855('0x4f')]=qs[_0x8855('0xc1')](_0x54158c[_0x8855('0x47')][_0x8855('0xc1')]);_0x1d126e[_0x8855('0x50')]=qs[_0x8855('0x51')](_[_0x8855('0x52')](_0x54158c[_0x8855('0x47')],_0x3a8ffc[_0x8855('0x51')]));if(_0x54158c[_0x8855('0x47')]['filter']){_0x1d126e[_0x8855('0x50')]=_['merge'](_0x1d126e['where'],{'$or':_[_0x8855('0x3a')](_0x1d126e[_0x8855('0x49')],function(_0x38e3eb){var _0x472edd={};_0x472edd[_0x38e3eb]={'$like':'%'+_0x54158c[_0x8855('0x47')][_0x8855('0x53')]+'%'};return _0x472edd;})});}_0x1d126e=_[_0x8855('0x5f')]({},_0x1d126e,_0x54158c['options']);return _0x38f027[_0x8855('0xd9')](_0x1d126e);}})[_0x8855('0x21')](function(_0x37da3e){if(_0x37da3e){_0x304597=_0x37da3e[_0x8855('0x4c')];if(!_0x54158c[_0x8855('0x47')][_0x8855('0xcb')](_0x8855('0xc7'))){_0x1d126e[_0x8855('0x4d')]=qs[_0x8855('0x4d')](_0x54158c[_0x8855('0x47')][_0x8855('0x4d')]);_0x1d126e[_0x8855('0x4e')]=qs[_0x8855('0x4e')](_0x54158c[_0x8855('0x47')][_0x8855('0x4e')]);}return _0x38f027[_0x8855('0xd9')](_0x1d126e);}})[_0x8855('0x21')](function(_0xd724ee){if(_0xd724ee){return _0xd724ee?{'count':_0x304597,'rows':_0xd724ee}:null;}})[_0x8855('0x21')](respondWithResult(_0x2aec4a,null))['catch'](handleError(_0x2aec4a,null));};exports[_0x8855('0xdb')]=function(_0x4625b5,_0x37ffa8,_0x561f8f){var _0x55303d={};var _0x107765={};var _0x596b63;var _0x2c0836;return db[_0x8855('0x42')][_0x8855('0xbf')]({'where':{'id':_0x4625b5[_0x8855('0x5d')]['id']}})['then'](handleEntityNotFound(_0x37ffa8,null))[_0x8855('0x21')](function(_0xad92bc){if(_0xad92bc){_0x596b63=_0xad92bc;_0x107765[_0x8855('0x44')]=_[_0x8855('0x48')](db[_0x8855('0xdc')][_0x8855('0x43')]);_0x107765[_0x8855('0x47')]=_[_0x8855('0x48')](_0x4625b5[_0x8855('0x47')]);_0x107765[_0x8855('0x51')]=_[_0x8855('0x4a')](_0x107765[_0x8855('0x44')],_0x107765[_0x8855('0x47')]);_0x55303d[_0x8855('0x49')]=_[_0x8855('0x4a')](_0x107765[_0x8855('0x44')],qs[_0x8855('0x4b')](_0x4625b5[_0x8855('0x47')][_0x8855('0x4b')]));_0x55303d[_0x8855('0x49')]=_0x55303d[_0x8855('0x49')]['length']?_0x55303d[_0x8855('0x49')]:_0x107765[_0x8855('0x44')];_0x55303d[_0x8855('0x4f')]=qs[_0x8855('0xc1')](_0x4625b5['query'][_0x8855('0xc1')]);_0x55303d[_0x8855('0x50')]=qs[_0x8855('0x51')](_[_0x8855('0x52')](_0x4625b5[_0x8855('0x47')],_0x107765[_0x8855('0x51')]));if(_0x4625b5[_0x8855('0x47')]['filter']){_0x55303d[_0x8855('0x50')]=_[_0x8855('0x5f')](_0x55303d[_0x8855('0x50')],{'$or':_['map'](_0x55303d[_0x8855('0x49')],function(_0x331783){var _0x26008a={};_0x26008a[_0x331783]={'$like':'%'+_0x4625b5['query'][_0x8855('0x53')]+'%'};return _0x26008a;})});}_0x55303d=_[_0x8855('0x5f')]({},_0x55303d,_0x4625b5[_0x8855('0x57')]);return _0x596b63[_0x8855('0xdb')](_0x55303d);}})['then'](function(_0x8a45b0){if(_0x8a45b0){_0x2c0836=_0x8a45b0['length'];if(!_0x4625b5[_0x8855('0x47')][_0x8855('0xcb')](_0x8855('0xc7'))){_0x55303d[_0x8855('0x4d')]=qs[_0x8855('0x4d')](_0x4625b5[_0x8855('0x47')][_0x8855('0x4d')]);_0x55303d[_0x8855('0x4e')]=qs['offset'](_0x4625b5[_0x8855('0x47')][_0x8855('0x4e')]);}return _0x596b63['getFaxInteractions'](_0x55303d);}})[_0x8855('0x21')](function(_0x3c4a0f){if(_0x3c4a0f){return _0x3c4a0f?{'count':_0x2c0836,'rows':_0x3c4a0f}:null;}})[_0x8855('0x21')](respondWithResult(_0x37ffa8,null))['catch'](handleError(_0x37ffa8,null));};exports[_0x8855('0xdd')]=function(_0x47b3af,_0x3365ba,_0x1b846d){var _0x1f14c7={};var _0x268f9f={};var _0x32dd29;var _0x332292;return db[_0x8855('0x42')][_0x8855('0xbf')]({'where':{'id':_0x47b3af[_0x8855('0x5d')]['id']}})[_0x8855('0x21')](handleEntityNotFound(_0x3365ba,null))[_0x8855('0x21')](function(_0x408e74){if(_0x408e74){_0x32dd29=_0x408e74;_0x268f9f[_0x8855('0x44')]=_['keys'](db[_0x8855('0xde')][_0x8855('0x43')]);_0x268f9f[_0x8855('0x47')]=_[_0x8855('0x48')](_0x47b3af[_0x8855('0x47')]);_0x268f9f['filters']=_[_0x8855('0x4a')](_0x268f9f[_0x8855('0x44')],_0x268f9f[_0x8855('0x47')]);_0x1f14c7[_0x8855('0x49')]=_[_0x8855('0x4a')](_0x268f9f['model'],qs[_0x8855('0x4b')](_0x47b3af[_0x8855('0x47')][_0x8855('0x4b')]));_0x1f14c7[_0x8855('0x49')]=_0x1f14c7[_0x8855('0x49')][_0x8855('0x4c')]?_0x1f14c7['attributes']:_0x268f9f[_0x8855('0x44')];_0x1f14c7[_0x8855('0x4f')]=qs['sort'](_0x47b3af['query']['sort']);_0x1f14c7['where']=qs[_0x8855('0x51')](_['pick'](_0x47b3af['query'],_0x268f9f['filters']));if(_0x47b3af[_0x8855('0x47')][_0x8855('0x53')]){_0x1f14c7['where']=_[_0x8855('0x5f')](_0x1f14c7[_0x8855('0x50')],{'$or':_[_0x8855('0x3a')](_0x1f14c7['attributes'],function(_0x25f5aa){var _0x318a39={};_0x318a39[_0x25f5aa]={'$like':'%'+_0x47b3af[_0x8855('0x47')][_0x8855('0x53')]+'%'};return _0x318a39;})});}_0x1f14c7=_['merge']({},_0x1f14c7,_0x47b3af[_0x8855('0x57')]);return _0x32dd29[_0x8855('0xdd')](_0x1f14c7);}})[_0x8855('0x21')](function(_0x5bc2c5){if(_0x5bc2c5){_0x332292=_0x5bc2c5[_0x8855('0x4c')];if(!_0x47b3af[_0x8855('0x47')]['hasOwnProperty']('nolimit')){_0x1f14c7[_0x8855('0x4d')]=qs['limit'](_0x47b3af[_0x8855('0x47')][_0x8855('0x4d')]);_0x1f14c7[_0x8855('0x4e')]=qs['offset'](_0x47b3af[_0x8855('0x47')]['offset']);}return _0x32dd29[_0x8855('0xdd')](_0x1f14c7);}})[_0x8855('0x21')](function(_0x3bfb83){if(_0x3bfb83){return _0x3bfb83?{'count':_0x332292,'rows':_0x3bfb83}:null;}})[_0x8855('0x21')](respondWithResult(_0x3365ba,null))['catch'](handleError(_0x3365ba,null));};exports[_0x8855('0xdf')]=function(_0x1195e9,_0x2dba42,_0x4091db){var _0x4cf0f9;var _0x2f16eb;var _0x1c69c5;var _0x554d85=!_[_0x8855('0x69')](_0x1195e9[_0x8855('0x5d')]['id'])?_0x1195e9[_0x8855('0x5d')]['id']:!_[_0x8855('0x69')](_0x1195e9[_0x8855('0x36')]['id'])?_0x1195e9[_0x8855('0x36')]['id']:null;return db['User'][_0x8855('0x3d')]({'where':{'id':_0x554d85,'role':{'$or':['admin',_0x8855('0x36'),_0x8855('0x74')]}},'attributes':['id',_0x8855('0x40'),_0x8855('0xe0'),_0x8855('0xe1'),_0x8855('0x34'),_0x8855('0x6b'),'loginInPause']})['then'](function(_0x412d6c){if(_0x412d6c){if(_0x412d6c[_0x8855('0x34')]==='agent'){_0x4cf0f9=_0x412d6c;if(_0x1195e9[_0x8855('0x61')][_0x8855('0xa3')]){_0x1c69c5=util[_0x8855('0xae')](_0x8855('0xe2'),_0x4cf0f9[_0x1195e9[_0x8855('0x61')][_0x8855('0xa3')]]);}else if(_0x1195e9[_0x8855('0x61')][_0x8855('0xe3')]){_0x1c69c5=util[_0x8855('0xae')]('SIP/%s',_0x1195e9[_0x8855('0x61')][_0x8855('0xe3')]);}else{_0x1c69c5=util[_0x8855('0xae')]('SIP/%s',_0x4cf0f9[_0x8855('0x40')]);}socket['to'](util['format']('user:%s',_0x4cf0f9[_0x8855('0x40')]))[_0x8855('0xb3')]('user:forcelogout',{'ip':_0x1195e9['headers'][_0x8855('0xe4')]||_0x1195e9[_0x8855('0xe5')]['remoteAddress']||_0x1195e9['socket'][_0x8855('0xe6')]||_0x1195e9['connection'][_0x8855('0xe7')][_0x8855('0xe6')]});return db[_0x8855('0xb0')][_0x8855('0x32')]({'where':{'membername':_0x4cf0f9[_0x8855('0x40')]},'individualHooks':!![]});}}else{throw new db[(_0x8855('0x92'))]['ValidationError'](_0x8855('0xe8'));}})[_0x8855('0x21')](function(){if(_0x4cf0f9){return _0x4cf0f9['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x1beb14){if(_0x4cf0f9){var _0x134b69=[];if(_0x1beb14){_0x2f16eb=_0x1beb14;if(_0x2f16eb[_0x8855('0x4c')]){for(var _0x5cca5f=0x0;_0x5cca5f<_0x2f16eb[_0x8855('0x4c')];_0x5cca5f++){_0x134b69[_0x8855('0x8c')]({'membername':_0x4cf0f9[_0x8855('0x40')],'UserId':_0x4cf0f9['id'],'queue_name':_0x2f16eb[_0x5cca5f][_0x8855('0x40')],'VoiceQueueId':_0x2f16eb[_0x5cca5f]['id'],'interface':_0x1c69c5,'paused':_0x4cf0f9[_0x8855('0xa1')]||![],'penalty':_0x2f16eb[_0x5cca5f][_0x8855('0xe9')]||0x0});}return BPromise[_0x8855('0x8d')](_0x134b69,function(_0x1020ea){return db['UserVoiceQueueRt']['upsert'](_0x1020ea);});}}}})[_0x8855('0x21')](function(){if(_0x4cf0f9){return db[_0x8855('0xea')][_0x8855('0x5a')]({'where':{'membername':_0x4cf0f9[_0x8855('0x40')],'exitAt':null}});}})[_0x8855('0x21')](function(_0x56346b){if(_0x4cf0f9){var _0xedb716=[];_0x56346b[_0x8855('0xeb')](function(_0x1ed9d3){_0xedb716[_0x8855('0x8c')](_0x1ed9d3['update']({'exitAt':moment()['format'](_0x8855('0xec'))}));});return BPromise['all'](_0xedb716);}})[_0x8855('0x21')](function(){if(_0x4cf0f9){var _0x137967=[];var _0x2d386d=[];var _0xd0e0b3=utils[_0x8855('0xed')]();var _0x24609f={'membername':_0x4cf0f9[_0x8855('0x40')],'interface':_0x1c69c5,'enterAt':moment()['format'](_0x8855('0xec')),'role':_0x4cf0f9[_0x8855('0x34')],'internal':_0x4cf0f9[_0x8855('0x6b')]};_0xd0e0b3[_0x8855('0xeb')](function(_0x466c6f){_0x137967[_0x8855('0x8c')](_[_0x8855('0x5f')]({'channel':_0x466c6f,'type':_0x8855('0xee'),'data1':_0x1195e9['body'][_0x8855('0xef')],'data2':_0x1c69c5},_0x24609f));if(_0x4cf0f9[_0x8855('0xa1')]){_0x2d386d['push'](_[_0x8855('0x5f')]({'channel':_0x466c6f,'type':_0x8855('0xf0'),'data1':'LOGININPAUSE'},_0x24609f));}});return db['MemberReport'][_0x8855('0x87')](_0x137967[_0x8855('0xf1')](_0x2d386d),{'individualHooks':!![]});}})[_0x8855('0x21')](function(){if(_0x4cf0f9){return _0x4cf0f9['update']({'online':!![],'lastLoginAt':moment()[_0x8855('0xae')](_0x8855('0xec')),'voicePause':_0x4cf0f9[_0x8855('0xa1')]||![],'mailPause':_0x4cf0f9[_0x8855('0xa1')]||![],'chatPause':_0x4cf0f9['loginInPause']||![],'faxPause':_0x4cf0f9[_0x8855('0xa1')]||![],'smsPause':_0x4cf0f9[_0x8855('0xa1')]||![],'openchannelPause':_0x4cf0f9[_0x8855('0xa1')]||![],'whatsappPause':_0x4cf0f9[_0x8855('0xa1')]||![],'pauseType':_0x4cf0f9['loginInPause']?_0x8855('0xf2'):null,'interface':_0x1c69c5,'lastPauseAt':moment()[_0x8855('0xae')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x8855('0x21')](function(_0x3eb322){if(_0x1195e9[_0x8855('0xf3')]){return _0x4091db();}else{return BPromise[_0x8855('0xf4')](_0x3eb322)[_0x8855('0x21')](respondWithResult(_0x2dba42,null));}})[_0x8855('0x29')](handleError(_0x2dba42,null));};exports[_0x8855('0xf5')]=function(_0x31c2f4,_0x2ebbbc,_0x52d6cc){var _0x37dea5;return db['User'][_0x8855('0x3d')]({'where':{'id':_0x31c2f4[_0x8855('0x5d')]['id'],'role':_0x8855('0x74')},'attributes':['id',_0x8855('0x40'),_0x8855('0x34')]})[_0x8855('0x21')](handleEntityNotFound(_0x2ebbbc,null))[_0x8855('0x21')](function(_0x21ebaa){if(_0x21ebaa){_0x37dea5=_0x21ebaa;return db['UserVoiceQueueRt'][_0x8855('0x32')]({'where':{'membername':_0x37dea5[_0x8855('0x40')]},'individualHooks':!![]});}})['then'](function(){return db[_0x8855('0xea')][_0x8855('0x5a')]({'where':{'membername':_0x37dea5[_0x8855('0x40')],'exitAt':null}});})[_0x8855('0x21')](function(_0x1d492e){var _0x22e9b6=[];_0x1d492e['forEach'](function(_0x362620){_0x22e9b6['push'](_0x362620['update']({'exitAt':moment()[_0x8855('0xae')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x8855('0x8b')](_0x22e9b6);})[_0x8855('0x21')](function(){return _0x37dea5[_0x8855('0x60')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x8855('0x21')](respondWithResult(_0x2ebbbc,null))[_0x8855('0x29')](handleError(_0x2ebbbc,null));};exports[_0x8855('0xf6')]=function(_0x5a9dff,_0x5db399,_0x262082){var _0x28a9d1;return db[_0x8855('0xb0')][_0x8855('0x60')]({'paused':0x1},{'where':{'UserId':_0x5a9dff[_0x8855('0x5d')]['id']},'individualHooks':!![]})[_0x8855('0x21')](function(){return db['User']['find']({'where':{'id':_0x5a9dff[_0x8855('0x5d')]['id'],'role':_0x8855('0x74')},'attributes':['id',_0x8855('0x40'),_0x8855('0x34'),'internal',_0x8855('0xa3')]});})[_0x8855('0x21')](handleEntityNotFound(_0x5db399,null))[_0x8855('0x21')](function(_0x437578){if(_0x437578){_0x28a9d1=_0x437578;return respondWithRpcPromise(_0x8855('0xf7'),_0x8855('0xf6'),{'id':_0x28a9d1['id'],'name':_0x28a9d1[_0x8855('0x40')],'pause':!![]});}})[_0x8855('0x21')](function(){if(_0x28a9d1){return db['MemberReport'][_0x8855('0x5a')]({'where':{'membername':_0x28a9d1[_0x8855('0x40')],'type':_0x8855('0xf0'),'exitAt':null}});}})['then'](function(_0x19ecb2){if(_0x19ecb2[_0x8855('0x4c')]){var _0x3abc51=moment()[_0x8855('0xae')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5d31d5=0x0,_0x12a129=_0x19ecb2['length'];_0x5d31d5<_0x12a129;_0x5d31d5++){_0x19ecb2[_0x5d31d5][_0x8855('0xf8')]({'exitAt':_0x3abc51});}}})['then'](function(){var _0x5e8612=[];var _0x3a06e1=utils[_0x8855('0xed')]();_0x3a06e1[_0x8855('0xeb')](function(_0x520674){_0x5e8612[_0x8855('0x8c')]({'channel':_0x520674,'membername':_0x28a9d1[_0x8855('0x40')],'interface':_[_0x8855('0x69')](_0x28a9d1[_0x8855('0xa3')])?util[_0x8855('0xae')](_0x8855('0xaf'),_0x28a9d1[_0x8855('0x40')]):_0x28a9d1[_0x8855('0xa3')],'type':_0x8855('0xf0'),'enterAt':moment()[_0x8855('0xae')](_0x8855('0xec')),'data1':_0x5a9dff[_0x8855('0x61')][_0x8855('0xf9')]||'DEFAULT\x20PAUSE','role':_0x28a9d1['role'],'internal':_0x28a9d1['internal']});});return db[_0x8855('0xea')][_0x8855('0x87')](_0x5e8612,{'individualHooks':!![]});})[_0x8855('0x21')](function(){return _0x28a9d1[_0x8855('0x60')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5a9dff[_0x8855('0x61')]['type']||_0x8855('0xfa'),'lastPauseAt':moment()[_0x8855('0xae')](_0x8855('0xec'))});})['then'](respondWithResult(_0x5db399,null))['catch'](handleError(_0x5db399,null));};exports[_0x8855('0xfb')]=function(_0x14b09b,_0x19ff74,_0x3d8d8a){var _0x23dd1e;return db['User'][_0x8855('0x3d')]({'where':{'id':_0x14b09b['params']['id']},'attributes':['id',_0x8855('0x40'),_0x8855('0x34'),_0x8855('0xa2'),_0x8855('0xfc'),_0x8855('0xfd'),_0x8855('0xfe'),_0x8855('0xff'),_0x8855('0x100'),_0x8855('0x101'),_0x8855('0x102'),_0x8855('0x103')]})[_0x8855('0x21')](handleEntityNotFound(_0x19ff74,null))[_0x8855('0x21')](function(_0x4da73f){if(_0x4da73f){_0x23dd1e=_0x4da73f;if(_0x14b09b['body']['channel']&&!utils[_0x8855('0xa4')](_0x14b09b[_0x8855('0x61')][_0x8855('0x9f')])){throw new db[(_0x8855('0x92'))][(_0x8855('0x93'))](_0x8855('0xa5'));}switch(_0x14b09b[_0x8855('0x61')][_0x8855('0x9f')]){case _0x8855('0xad'):return respondWithRpcPromise(_0x8855('0xf7'),_0x8855('0xfb'),{'id':_0x23dd1e['id'],'name':_0x23dd1e[_0x8855('0x40')],'pause':![]})[_0x8855('0x21')](function(){return db[_0x8855('0xb0')][_0x8855('0x60')]({'paused':0x0},{'where':{'UserId':_0x23dd1e['id']},'individualHooks':!![]});})[_0x8855('0x21')](function(){return db['MemberReport']['find']({'where':{'channel':_0x14b09b[_0x8855('0x61')][_0x8855('0x9f')],'membername':_0x23dd1e['name'],'type':'PAUSE','exitAt':null}});})[_0x8855('0x21')](function(_0x22cded){if(_0x22cded){return _0x22cded['update']({'exitAt':moment()[_0x8855('0xae')](_0x8855('0xec')),'data2':_0x8855('0x104')},{'individualHooks':!![]});}return null;})[_0x8855('0x21')](function(){return _0x23dd1e['update']({'voicePause':![]});});case _0x8855('0x105'):case _0x8855('0x106'):case _0x8855('0x107'):case _0x8855('0x108'):case _0x8855('0x109'):case _0x8855('0x10a'):return db[_0x8855('0xea')]['find']({'where':{'channel':_0x14b09b[_0x8855('0x61')][_0x8855('0x9f')],'membername':_0x23dd1e['name'],'type':_0x8855('0xf0'),'exitAt':null}})[_0x8855('0x21')](function(_0x47cb76){if(_0x47cb76){return _0x47cb76['update']({'exitAt':moment()[_0x8855('0xae')](_0x8855('0xec')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){var _0x54a226={};_[_0x8855('0x2f')](_0x54a226,util[_0x8855('0xae')]('%s%s',_0x14b09b['body']['channel'],_0x8855('0x10b')),![]);return _0x23dd1e[_0x8855('0x60')](_0x54a226);});default:return respondWithRpcPromise(_0x8855('0xf7'),_0x8855('0xfb'),{'id':_0x23dd1e['id'],'name':_0x23dd1e[_0x8855('0x40')],'pause':![]})[_0x8855('0x21')](function(){return db[_0x8855('0xb0')][_0x8855('0x60')]({'paused':0x0},{'where':{'UserId':_0x23dd1e['id']}});})[_0x8855('0x21')](function(){return db[_0x8855('0xea')][_0x8855('0x5a')]({'where':{'membername':_0x23dd1e[_0x8855('0x40')],'type':_0x8855('0xf0'),'exitAt':null}});})[_0x8855('0x21')](function(_0x1e32d5){var _0x39a44c=[];_0x1e32d5['forEach'](function(_0x6068bf){_0x39a44c[_0x8855('0x8c')](_0x6068bf[_0x8855('0x60')]({'exitAt':moment()[_0x8855('0xae')](_0x8855('0xec')),'data2':'manual'}));});return BPromise['all'](_0x39a44c);})[_0x8855('0x21')](function(){return _0x23dd1e['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x8855('0x21')](respondWithResult(_0x19ff74,null))['catch'](handleError(_0x19ff74,null));};exports[_0x8855('0x10c')]=function(_0x2e289a,_0x31b3d7,_0x356a29){var _0x26a747={};var _0x795938={};var _0x257977;var _0x4f8a1b;return db[_0x8855('0x42')][_0x8855('0xbf')]({'where':{'id':_0x2e289a[_0x8855('0x5d')]['id']}})[_0x8855('0x21')](handleEntityNotFound(_0x31b3d7,null))['then'](function(_0x2f35be){if(_0x2f35be){_0x257977=_0x2f35be;_0x795938[_0x8855('0x44')]=_[_0x8855('0x48')](db['Team']['rawAttributes']);_0x795938[_0x8855('0x47')]=_[_0x8855('0x48')](_0x2e289a['query']);_0x795938[_0x8855('0x51')]=_[_0x8855('0x4a')](_0x795938[_0x8855('0x44')],_0x795938['query']);_0x26a747[_0x8855('0x49')]=_[_0x8855('0x4a')](_0x795938['model'],qs[_0x8855('0x4b')](_0x2e289a['query']['fields']));_0x26a747['attributes']=_0x26a747[_0x8855('0x49')]['length']?_0x26a747['attributes']:_0x795938[_0x8855('0x44')];_0x26a747['order']=qs[_0x8855('0xc1')](_0x2e289a[_0x8855('0x47')][_0x8855('0xc1')]);_0x26a747[_0x8855('0x50')]=qs[_0x8855('0x51')](_[_0x8855('0x52')](_0x2e289a[_0x8855('0x47')],_0x795938[_0x8855('0x51')]));if(_0x2e289a[_0x8855('0x47')]['filter']){_0x26a747['where']=_['merge'](_0x26a747['where'],{'$or':_['map'](_0x26a747[_0x8855('0x49')],function(_0x17e124){var _0x39abb0={};_0x39abb0[_0x17e124]={'$like':'%'+_0x2e289a[_0x8855('0x47')][_0x8855('0x53')]+'%'};return _0x39abb0;})});}_0x26a747=_['merge']({},_0x26a747,_0x2e289a[_0x8855('0x57')]);return _0x257977[_0x8855('0x10c')](_0x26a747);}})['then'](function(_0x3cd887){if(_0x3cd887){_0x4f8a1b=_0x3cd887[_0x8855('0x4c')];if(!_0x2e289a[_0x8855('0x47')][_0x8855('0xcb')]('nolimit')){_0x26a747[_0x8855('0x4d')]=qs['limit'](_0x2e289a[_0x8855('0x47')]['limit']);_0x26a747['offset']=qs[_0x8855('0x4e')](_0x2e289a[_0x8855('0x47')][_0x8855('0x4e')]);}return _0x257977[_0x8855('0x10c')](_0x26a747);}})[_0x8855('0x21')](function(_0x44d166){if(_0x44d166){return _0x44d166?{'count':_0x4f8a1b,'rows':_0x44d166}:null;}})[_0x8855('0x21')](respondWithResult(_0x31b3d7,null))['catch'](handleError(_0x31b3d7,null));};exports['addTeams']=function(_0xfac355,_0x119c0b){return db[_0x8855('0x42')][_0x8855('0x3d')]({'where':{'id':_0xfac355[_0x8855('0x5d')]['id']}})[_0x8855('0x21')](handleEntityNotFound(_0x119c0b,null))[_0x8855('0x21')](function(_0x4fab74){if(_0x4fab74){var _0x17dc22=_0x4fab74[_0x8855('0x33')]({'plain':!![]});return _0x4fab74[_0x8855('0x10d')](_0xfac355['body'][_0x8855('0x64')],_[_0x8855('0x65')](_0xfac355['body'],[_0x8855('0x64'),'id'])||{})['then'](function(){for(var _0x6ada72=0x0;_0x6ada72<_0xfac355[_0x8855('0x61')][_0x8855('0x64')][_0x8855('0x4c')];_0x6ada72++){var _0x38c57a=[];db[_0x8855('0x10e')][_0x8855('0xbf')]({'where':{'id':_0xfac355[_0x8855('0x61')][_0x8855('0x64')][_0x6ada72]}})[_0x8855('0x21')](function(_0x42ce76){_0x38c57a[_0x8855('0x8c')](_0x42ce76[_0x8855('0x10f')]()['then'](function(_0x463a7a){for(var _0x2cd06e=0x0;_0x2cd06e<_0x463a7a[_0x8855('0x4c')];_0x2cd06e++){_0x463a7a[_0x2cd06e][_0x8855('0x110')](_0x8855('0x9f'),'Voice');}return _0x463a7a;}));_0x38c57a[_0x8855('0x8c')](_0x42ce76[_0x8855('0x111')]()[_0x8855('0x21')](function(_0x8e96bd){for(var _0x1b1643=0x0;_0x1b1643<_0x8e96bd[_0x8855('0x4c')];_0x1b1643++){_0x8e96bd[_0x1b1643]['setDataValue']('channel','Chat');}return _0x8e96bd;}));_0x38c57a[_0x8855('0x8c')](_0x42ce76['getMailQueues']()[_0x8855('0x21')](function(_0x203f45){for(var _0x5af875=0x0;_0x5af875<_0x203f45[_0x8855('0x4c')];_0x5af875++){_0x203f45[_0x5af875][_0x8855('0x110')](_0x8855('0x9f'),_0x8855('0x112'));}return _0x203f45;}));_0x38c57a[_0x8855('0x8c')](_0x42ce76[_0x8855('0x113')]()[_0x8855('0x21')](function(_0x4173ef){for(var _0x299cb5=0x0;_0x299cb5<_0x4173ef[_0x8855('0x4c')];_0x299cb5++){_0x4173ef[_0x299cb5][_0x8855('0x110')]('channel',_0x8855('0x114'));}return _0x4173ef;}));_0x38c57a[_0x8855('0x8c')](_0x42ce76[_0x8855('0x115')]()[_0x8855('0x21')](function(_0x5ee14c){for(var _0x4aa968=0x0;_0x4aa968<_0x5ee14c[_0x8855('0x4c')];_0x4aa968++){_0x5ee14c[_0x4aa968][_0x8855('0x110')](_0x8855('0x9f'),_0x8855('0x116'));}return _0x5ee14c;}));_0x38c57a[_0x8855('0x8c')](_0x42ce76['getFaxQueues']()[_0x8855('0x21')](function(_0x200bd0){for(var _0x57c6df=0x0;_0x57c6df<_0x200bd0[_0x8855('0x4c')];_0x57c6df++){_0x200bd0[_0x57c6df][_0x8855('0x110')]('channel',_0x8855('0x117'));}return _0x200bd0;}));_0x38c57a[_0x8855('0x8c')](_0x42ce76[_0x8855('0x118')]()[_0x8855('0x21')](function(_0x3c4284){for(var _0x10b693=0x0;_0x10b693<_0x3c4284['length'];_0x10b693++){_0x3c4284[_0x10b693][_0x8855('0x110')](_0x8855('0x9f'),_0x8855('0x119'));}return _0x3c4284;}));return BPromise[_0x8855('0x8b')](_0x38c57a);})[_0x8855('0x21')](function(_0x5cca8c){var _0x43e0c=_[_0x8855('0x11a')](_0x5cca8c);_0x38c57a=[];return db[_0x8855('0x55')][_0x8855('0x11b')](function(_0x117f0f){for(var _0x22d7fa=0x0;_0x22d7fa<_0x43e0c[_0x8855('0x4c')];_0x22d7fa++){_0x38c57a[_0x8855('0x8c')](_0x43e0c[_0x22d7fa][_0x8855('0x11c')](_0x17dc22['id']),{'transaction':_0x117f0f});}return BPromise['all'](_0x38c57a)[_0x8855('0x21')](function(){if(_0x17dc22['online']){return BPromise[_0x8855('0x8d')](_[_0x8855('0x53')](_0x43e0c,function(_0x5019cc){return _0x5019cc['getDataValue'](_0x8855('0x9f'))==='Voice';}),function(_0x5b6752){return db['UserVoiceQueueRt'][_0x8855('0xb1')]({'membername':_0x17dc22[_0x8855('0x40')],'UserId':_0x17dc22['id'],'queue_name':_0x5b6752[_0x8855('0x40')],'VoiceQueueId':_0x5b6752['id'],'interface':_['isNil'](_0x17dc22[_0x8855('0xa3')])?util['format']('SIP/%s',_0x17dc22[_0x8855('0x40')]):_0x17dc22[_0x8855('0xa3')],'paused':_0x17dc22[_0x8855('0xa2')]||![],'penalty':_0x17dc22[_0x8855('0xa9')]},{'transaction':_0x117f0f});});}else{return;}})[_0x8855('0x21')](function(){for(var _0x99aa45=0x0;_0x99aa45<_0x43e0c['length'];_0x99aa45++){var _0x5d32bf=_0x43e0c[_0x99aa45][_0x8855('0x11d')](_0x8855('0x9f'));var _0x355b6c=_0x5d32bf+_0x8855('0xab');socket[_0x8855('0xb3')](_0x8855('0x36')+_0x5d32bf+_0x8855('0xac'),{'UserId':_0x17dc22['id'],['queueField']:_0x43e0c[_0x99aa45]['id']});}});});});}});}})[_0x8855('0x21')](respondWithStatusCode(_0x119c0b,null))[_0x8855('0x29')](handleError(_0x119c0b,null));};exports[_0x8855('0x11e')]=function(_0x51ca6f,_0x2e65e6){return db[_0x8855('0x42')]['findOne']({'where':{'id':_0x51ca6f[_0x8855('0x5d')]['id']}})[_0x8855('0x21')](handleEntityNotFound(_0x2e65e6,null))[_0x8855('0x21')](function(_0x548dfa){if(_0x548dfa){var _0x149478=_0x548dfa['get']({'plain':!![]});var _0x9d70e4=_0x51ca6f['query']['ids'];return _0x548dfa['removeTeams'](_0x9d70e4)[_0x8855('0x21')](function(){for(var _0x497ea8=0x0;_0x497ea8<_0x9d70e4[_0x8855('0x4c')];_0x497ea8++){var _0xfcfa0f=[];db[_0x8855('0x10e')][_0x8855('0xbf')]({'where':{'id':_0x9d70e4[_0x497ea8]}})[_0x8855('0x21')](function(_0x3b5fae){_0xfcfa0f[_0x8855('0x8c')](_0x3b5fae[_0x8855('0x10f')]()[_0x8855('0x21')](function(_0x5b93a1){for(var _0x16f99b=0x0;_0x16f99b<_0x5b93a1[_0x8855('0x4c')];_0x16f99b++){_0x5b93a1[_0x16f99b][_0x8855('0x110')]('channel','Voice');}return _0x5b93a1;}));_0xfcfa0f['push'](_0x3b5fae['getChatQueues']()[_0x8855('0x21')](function(_0x22be1e){for(var _0x19b346=0x0;_0x19b346<_0x22be1e[_0x8855('0x4c')];_0x19b346++){_0x22be1e[_0x19b346][_0x8855('0x110')]('channel','Chat');}return _0x22be1e;}));_0xfcfa0f['push'](_0x3b5fae['getMailQueues']()[_0x8855('0x21')](function(_0x4e8e07){for(var _0x2f2bd3=0x0;_0x2f2bd3<_0x4e8e07[_0x8855('0x4c')];_0x2f2bd3++){_0x4e8e07[_0x2f2bd3][_0x8855('0x110')]('channel',_0x8855('0x112'));}return _0x4e8e07;}));_0xfcfa0f['push'](_0x3b5fae['getSmsQueues']()[_0x8855('0x21')](function(_0x3fb4ef){for(var _0x4f7638=0x0;_0x4f7638<_0x3fb4ef[_0x8855('0x4c')];_0x4f7638++){_0x3fb4ef[_0x4f7638]['setDataValue'](_0x8855('0x9f'),_0x8855('0x114'));}return _0x3fb4ef;}));_0xfcfa0f[_0x8855('0x8c')](_0x3b5fae[_0x8855('0x115')]()[_0x8855('0x21')](function(_0x45de64){for(var _0x23b624=0x0;_0x23b624<_0x45de64['length'];_0x23b624++){_0x45de64[_0x23b624][_0x8855('0x110')]('channel',_0x8855('0x116'));}return _0x45de64;}));_0xfcfa0f[_0x8855('0x8c')](_0x3b5fae[_0x8855('0x11f')]()[_0x8855('0x21')](function(_0x83fa80){for(var _0x386a64=0x0;_0x386a64<_0x83fa80['length'];_0x386a64++){_0x83fa80[_0x386a64]['setDataValue'](_0x8855('0x9f'),_0x8855('0x117'));}return _0x83fa80;}));_0xfcfa0f[_0x8855('0x8c')](_0x3b5fae['getOpenchannelQueues']()['then'](function(_0xd631ef){for(var _0x790f4=0x0;_0x790f4<_0xd631ef[_0x8855('0x4c')];_0x790f4++){_0xd631ef[_0x790f4]['setDataValue'](_0x8855('0x9f'),_0x8855('0x119'));}return _0xd631ef;}));return BPromise[_0x8855('0x8b')](_0xfcfa0f);})[_0x8855('0x21')](function(_0xd92ae1){var _0x4f72b7=_[_0x8855('0x11a')](_0xd92ae1);_0xfcfa0f=[];return db[_0x8855('0x55')][_0x8855('0x11b')](function(_0x397129){for(var _0x15f3fd=0x0;_0x15f3fd<_0x4f72b7['length'];_0x15f3fd++){_0xfcfa0f[_0x8855('0x8c')](_0x4f72b7[_0x15f3fd][_0x8855('0x120')](_0x149478['id']),{'transaction':_0x397129});}return BPromise['all'](_0xfcfa0f)[_0x8855('0x21')](function(){if(_0x149478[_0x8855('0xa0')]){return BPromise[_0x8855('0x8d')](_[_0x8855('0x53')](_0x4f72b7,function(_0xda2221){return _0xda2221[_0x8855('0x11d')](_0x8855('0x9f'))===_0x8855('0x121');}),function(_0x4daff0){return db[_0x8855('0xb0')][_0x8855('0x32')]({'where':{'VoiceQueueId':_0x4daff0['id'],'UserId':_0x149478['id']},'transaction':_0x397129});});}else{return;}})[_0x8855('0x21')](function(){for(var _0x17f08e=0x0;_0x17f08e<_0x4f72b7[_0x8855('0x4c')];_0x17f08e++){var _0x1c33da=_0x4f72b7[_0x17f08e][_0x8855('0x11d')](_0x8855('0x9f'));var _0x3a068c=_0x1c33da+_0x8855('0xab');socket[_0x8855('0xb3')](_0x8855('0x36')+_0x1c33da+_0x8855('0xb4'),{'UserId':_0x149478['id'],['queueField']:_0x4f72b7[_0x17f08e]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x2e65e6,null))[_0x8855('0x29')](handleError(_0x2e65e6,null));};exports[_0x8855('0x122')]=function(_0x31c6a2,_0x5232bc,_0x3b8d04){var _0x585ff6={};var _0x148372={};var _0x2395c4;var _0xdcf2f9;return db[_0x8855('0x42')][_0x8855('0xbf')]({'where':{'id':_0x31c6a2['params']['id']}})['then'](handleEntityNotFound(_0x5232bc,null))['then'](function(_0x3f3940){if(_0x3f3940){_0x2395c4=_0x3f3940;_0x148372[_0x8855('0x44')]=_['keys'](db[_0x8855('0xc3')][_0x8855('0x43')]);_0x148372[_0x8855('0x47')]=_[_0x8855('0x48')](_0x31c6a2[_0x8855('0x47')]);_0x148372[_0x8855('0x51')]=_[_0x8855('0x4a')](_0x148372[_0x8855('0x44')],_0x148372[_0x8855('0x47')]);_0x585ff6['attributes']=_['intersection'](_0x148372[_0x8855('0x44')],qs['fields'](_0x31c6a2['query'][_0x8855('0x4b')]));_0x585ff6['attributes']=_0x585ff6[_0x8855('0x49')]['length']?_0x585ff6[_0x8855('0x49')]:_0x148372['model'];_0x585ff6['order']=qs[_0x8855('0xc1')](_0x31c6a2[_0x8855('0x47')][_0x8855('0xc1')]);_0x585ff6[_0x8855('0x50')]=qs[_0x8855('0x51')](_[_0x8855('0x52')](_0x31c6a2['query'],_0x148372['filters']));if(_0x31c6a2[_0x8855('0x47')][_0x8855('0x53')]){_0x585ff6[_0x8855('0x50')]=_[_0x8855('0x5f')](_0x585ff6[_0x8855('0x50')],{'$or':_['map'](_0x585ff6[_0x8855('0x49')],function(_0x1320df){var _0x548d4c={};_0x548d4c[_0x1320df]={'$like':'%'+_0x31c6a2[_0x8855('0x47')][_0x8855('0x53')]+'%'};return _0x548d4c;})});}_0x585ff6=_['merge']({},_0x585ff6,_0x31c6a2[_0x8855('0x57')]);return _0x2395c4[_0x8855('0x122')](_0x585ff6);}})[_0x8855('0x21')](function(_0x2fde20){if(_0x2fde20){_0xdcf2f9=_0x2fde20['length'];if(!_0x31c6a2['query'][_0x8855('0xcb')](_0x8855('0xc7'))){_0x585ff6[_0x8855('0x4d')]=qs[_0x8855('0x4d')](_0x31c6a2[_0x8855('0x47')][_0x8855('0x4d')]);_0x585ff6[_0x8855('0x4e')]=qs[_0x8855('0x4e')](_0x31c6a2['query'][_0x8855('0x4e')]);}return _0x2395c4['getLists'](_0x585ff6);}})[_0x8855('0x21')](function(_0xa09b13){if(_0xa09b13){return _0xa09b13?{'count':_0xdcf2f9,'rows':_0xa09b13}:null;}})[_0x8855('0x21')](respondWithResult(_0x5232bc,null))[_0x8855('0x29')](handleError(_0x5232bc,null));};exports['getAgents']=function(_0x1c9aa7,_0x10c46f,_0x134b7c){var _0x1ff79a={};var _0x240027={};var _0x3f0a43;var _0x4658d0;return db[_0x8855('0x42')][_0x8855('0xbf')]({'where':{'id':_0x1c9aa7[_0x8855('0x5d')]['id']}})[_0x8855('0x21')](handleEntityNotFound(_0x10c46f,null))['then'](function(_0x201f4a){if(_0x201f4a){_0x3f0a43=_0x201f4a;_0x240027[_0x8855('0x44')]=_[_0x8855('0x48')](db[_0x8855('0x42')][_0x8855('0x43')]);_0x240027[_0x8855('0x47')]=_['keys'](_0x1c9aa7[_0x8855('0x47')]);_0x240027[_0x8855('0x51')]=_['intersection'](_0x240027[_0x8855('0x44')],_0x240027[_0x8855('0x47')]);_0x1ff79a['attributes']=_['intersection'](_0x240027['model'],qs['fields'](_0x1c9aa7[_0x8855('0x47')][_0x8855('0x4b')]));_0x1ff79a['attributes']=_0x1ff79a[_0x8855('0x49')]['length']?_0x1ff79a[_0x8855('0x49')]:_0x240027['model'];_0x1ff79a[_0x8855('0x4f')]=qs[_0x8855('0xc1')](_0x1c9aa7[_0x8855('0x47')][_0x8855('0xc1')]);_0x1ff79a[_0x8855('0x50')]=qs[_0x8855('0x51')](_['pick'](_0x1c9aa7[_0x8855('0x47')],_0x240027[_0x8855('0x51')]));if(_0x1c9aa7[_0x8855('0x47')][_0x8855('0x53')]){_0x1ff79a['where']=_['merge'](_0x1ff79a[_0x8855('0x50')],{'$or':_[_0x8855('0x3a')](_0x1ff79a['attributes'],function(_0x2ead89){var _0x1c1df5={};_0x1c1df5[_0x2ead89]={'$like':'%'+_0x1c9aa7[_0x8855('0x47')][_0x8855('0x53')]+'%'};return _0x1c1df5;})});}_0x1ff79a[_0x8855('0x44')]=db[_0x8855('0x42')];_0x1ff79a['as']=_0x8855('0x85');_0x1ff79a=_[_0x8855('0x5f')]({},_0x1ff79a,_0x1c9aa7[_0x8855('0x57')]);return _0x3f0a43[_0x8855('0x10f')]({'include':[_0x1ff79a]});}})['then'](function(_0x880e75){if(_0x880e75){var _0x3e1297={},_0x55aa47=[],_0x61604b=0x0;for(var _0x4e025d=0x0;_0x4e025d<_0x880e75[_0x8855('0x4c')];_0x4e025d+=0x1){for(var _0x3ac48a=0x0,_0x35d07d;_0x3ac48a<_0x880e75[_0x4e025d]['Agents'][_0x8855('0x4c')];_0x3ac48a+=0x1){_0x35d07d=_0x880e75[_0x4e025d]['Agents'][_0x3ac48a][_0x8855('0x33')]({'plain':!![]});_0x3e1297[_0x35d07d['id']]=_0x35d07d;}}_0x3e1297=_[_0x8855('0x123')](_0x3e1297);for(var _0x39275c=qs['offset'](_0x1c9aa7['query'][_0x8855('0x4e')]);_0x39275c<_0x3e1297[_0x8855('0x4c')]&&_0x55aa47[_0x8855('0x4c')]=_0x18b3fe[_0x8d5c('0x56')]){throw new Error(_0x8d5c('0x57'));}})['then'](function(){if(_0x2c0cdd){return db[_0x8d5c('0x2d')][_0x8d5c('0x4d')]({'where':{'membername':_0x2c0cdd[_0x8d5c('0x37')]},'individualHooks':!![]});}})[_0x8d5c('0x10')](function(){if(_0x2c0cdd){return _0x2c0cdd[_0x8d5c('0x58')]({'raw':!![]});}})[_0x8d5c('0x10')](function(_0x117551){if(_0x2c0cdd){if(_0x117551){var _0x4f59c1=[];_0x43596a=_0x117551;if(_0x43596a[_0x8d5c('0x30')]){for(var _0x439502=0x0;_0x439502<_0x43596a[_0x8d5c('0x30')];_0x439502++){_0x4f59c1[_0x8d5c('0x36')](db[_0x8d5c('0x2d')][_0x8d5c('0x59')]({'membername':_0x2c0cdd[_0x8d5c('0x37')],'UserId':_0x2c0cdd['id'],'queue_name':_0x43596a[_0x439502][_0x8d5c('0x37')],'VoiceQueueId':_0x43596a[_0x439502]['id'],'interface':_0x2e816e,'paused':_0x2c0cdd['loginInPause']||![],'penalty':_0x43596a[_0x439502][_0x8d5c('0x5a')]||0x0}));}return BPromise['all'](_0x4f59c1);}}}})['then'](function(){if(_0x2c0cdd){return db['MemberReport'][_0x8d5c('0x1d')]({'where':{'membername':_0x2c0cdd[_0x8d5c('0x37')],'exitAt':null}});}})[_0x8d5c('0x10')](function(_0x490935){if(_0x2c0cdd){if(_0x490935&&_0x490935[_0x8d5c('0x30')]){var _0x5e86f5=[];_0x490935[_0x8d5c('0x35')](function(_0x50241a){_0x5e86f5[_0x8d5c('0x36')](_0x50241a[_0x8d5c('0x2e')]({'exitAt':moment()['format'](_0x8d5c('0x32'))}));});return BPromise[_0x8d5c('0x4b')](_0x5e86f5);}}})[_0x8d5c('0x10')](function(_0x3e5850){if(_0x2c0cdd){var _0x33a6a5=[];var _0x58bac6=[];var _0x100d0=utils[_0x8d5c('0x34')]();var _0xfc4a61={'membername':_0x2c0cdd[_0x8d5c('0x37')],'interface':_0x2e816e,'enterAt':moment()[_0x8d5c('0x31')](_0x8d5c('0x32')),'role':_0x2c0cdd[_0x8d5c('0x2a')],'internal':_0x2c0cdd[_0x8d5c('0x2b')]};_0x100d0[_0x8d5c('0x35')](function(_0x9f1fb5){_0x33a6a5[_0x8d5c('0x36')](_[_0x8d5c('0x5b')]({'channel':_0x9f1fb5,'type':_0x8d5c('0x5c'),'data1':'callysquare','data2':_0x2e816e},_0xfc4a61));if(_0x2c0cdd[_0x8d5c('0x51')]){_0x58bac6['push'](_[_0x8d5c('0x5b')]({'channel':_0x9f1fb5,'type':_0x8d5c('0x42'),'data1':_0x8d5c('0x5d')},_0xfc4a61));}});return db[_0x8d5c('0x2f')][_0x8d5c('0x3b')](_0x33a6a5['concat'](_0x58bac6),{'individualHooks':!![]});}})[_0x8d5c('0x10')](function(){if(_0x2c0cdd){return _0x2c0cdd[_0x8d5c('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x8d5c('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2c0cdd[_0x8d5c('0x51')]||![],'mailPause':_0x2c0cdd['loginInPause']||![],'chatPause':_0x2c0cdd['loginInPause']||![],'faxPause':_0x2c0cdd[_0x8d5c('0x51')]||![],'smsPause':_0x2c0cdd['loginInPause']||![],'openchannelPause':_0x2c0cdd[_0x8d5c('0x51')]||![],'pauseType':_0x2c0cdd['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0x8d5c('0x32')),'interface':_0x2e816e});}})[_0x8d5c('0x10')](function(_0x29910b){_0x5c1f62(_0x29910b);})[_0x8d5c('0x1b')](function(_0x24f331){_0x227046(_0x2f0bef['error'](0x1f4,_0x24f331[_0x8d5c('0x19')]));});});}; \ No newline at end of file +var _0xf79e=['voice','update','find','system','chat','fax','sms','openchannel','whatsapp','set','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','LOGIN','merge','LOGININPAUSE','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetUser','findAll','options','raw','include','map','model','attributes','ShowUser','User','where','name','role','internal','interface','UserVoiceQueueRt','MemberReport','PAUSE','length','forEach','push','isNil','format','SIP/%s','type','DEFAULT\x20PAUSE','body','uniqueid','bulkCreate','YYYY-MM-DD\x20HH:mm:ss','UnpauseUser','findOne','isValidChannel','Unknown\x20channel','channel'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf79e,0x185));var _0xef79=function(_0x3d0c36,_0x1fa22b){_0x3d0c36=_0x3d0c36-0x0;var _0x587fde=_0xf79e[_0x3d0c36];return _0x587fde;};'use strict';var _=require('lodash');var util=require(_0xef79('0x0'));var moment=require(_0xef79('0x1'));var BPromise=require(_0xef79('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef79('0x3'));var db=require(_0xef79('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xef79('0x5'));var config=require(_0xef79('0x6'));var jayson=require(_0xef79('0x7'));var client=jayson[_0xef79('0x8')][_0xef79('0x9')]({'port':0x232a});config[_0xef79('0xa')]=_['defaults'](config[_0xef79('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xef79('0xb'))(new Redis(config[_0xef79('0xa')]));require('./user.socket')[_0xef79('0xc')](socket);function respondWithRpcPromise(_0x2607aa,_0x10943f,_0x45e01c){return new BPromise(function(_0x2c35a0,_0xe2055d){return client[_0xef79('0xd')](_0x2607aa,_0x45e01c)[_0xef79('0xe')](function(_0x4f2b57){logger[_0xef79('0xf')](_0xef79('0x10'),_0x10943f,_0xef79('0x11'));logger[_0xef79('0x12')](_0xef79('0x13'),_0x10943f,_0xef79('0x11'),JSON[_0xef79('0x14')](_0x4f2b57));if(_0x4f2b57[_0xef79('0x15')]){if(_0x4f2b57[_0xef79('0x15')][_0xef79('0x16')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x10943f,_0x4f2b57['error']['message']);return _0xe2055d(_0x4f2b57[_0xef79('0x15')][_0xef79('0x17')]);}logger[_0xef79('0x15')](_0xef79('0x10'),_0x10943f,_0x4f2b57['error'][_0xef79('0x17')]);return _0x2c35a0(_0x4f2b57[_0xef79('0x15')]['message']);}else{logger[_0xef79('0xf')](_0xef79('0x10'),_0x10943f,_0xef79('0x11'));_0x2c35a0(_0x4f2b57[_0xef79('0x18')]['message']);}})[_0xef79('0x19')](function(_0x540f87){logger[_0xef79('0x15')](_0xef79('0x10'),_0x10943f,_0x540f87);_0xe2055d(_0x540f87);});});}exports[_0xef79('0x1a')]=function(_0x56cbb7){var _0xdd1f3d=this;return new Promise(function(_0x3902f9,_0x48e6e6){return db['User'][_0xef79('0x1b')]({'raw':_0x56cbb7[_0xef79('0x1c')]?_0x56cbb7['options'][_0xef79('0x1d')]===undefined?!![]:![]:!![],'where':_0x56cbb7[_0xef79('0x1c')]?_0x56cbb7[_0xef79('0x1c')]['where']||null:null,'attributes':_0x56cbb7[_0xef79('0x1c')]?_0x56cbb7['options']['attributes']||null:null,'limit':_0x56cbb7[_0xef79('0x1c')]?_0x56cbb7[_0xef79('0x1c')]['limit']||null:null,'include':_0x56cbb7[_0xef79('0x1c')]?_0x56cbb7[_0xef79('0x1c')][_0xef79('0x1e')]?_[_0xef79('0x1f')](_0x56cbb7[_0xef79('0x1c')][_0xef79('0x1e')],function(_0x1d9220){return{'model':db[_0x1d9220[_0xef79('0x20')]],'as':_0x1d9220['as'],'attributes':_0x1d9220[_0xef79('0x21')],'include':_0x1d9220['include']?_[_0xef79('0x1f')](_0x1d9220['include'],function(_0x395674){return{'model':db[_0x395674['model']],'as':_0x395674['as'],'attributes':_0x395674[_0xef79('0x21')],'include':_0x395674[_0xef79('0x1e')]?_[_0xef79('0x1f')](_0x395674[_0xef79('0x1e')],function(_0x5c29ea){return{'model':db[_0x5c29ea[_0xef79('0x20')]],'as':_0x5c29ea['as'],'attributes':_0x5c29ea[_0xef79('0x21')]};}):[]};}):[]};}):[]:[]})[_0xef79('0xe')](function(_0x56fb08){logger[_0xef79('0xf')]('GetUser',_0x56cbb7);logger[_0xef79('0x12')](_0xef79('0x1a'),_0x56cbb7,JSON[_0xef79('0x14')](_0x56fb08));_0x3902f9(_0x56fb08);})[_0xef79('0x19')](function(_0x84ad52){logger[_0xef79('0x15')](_0xef79('0x1a'),_0x84ad52[_0xef79('0x17')],_0x56cbb7);_0x48e6e6(_0xdd1f3d['error'](0x1f4,_0x84ad52[_0xef79('0x17')]));});});};exports[_0xef79('0x22')]=function(_0x100978){var _0x3efb8c=this;return new Promise(function(_0xebb64f,_0x100229){return db[_0xef79('0x23')]['find']({'raw':_0x100978[_0xef79('0x1c')]?_0x100978[_0xef79('0x1c')][_0xef79('0x1d')]===undefined?!![]:![]:!![],'where':_0x100978[_0xef79('0x1c')]?_0x100978[_0xef79('0x1c')][_0xef79('0x24')]||null:null,'attributes':_0x100978[_0xef79('0x1c')]?_0x100978[_0xef79('0x1c')][_0xef79('0x21')]||null:null,'include':_0x100978[_0xef79('0x1c')]?_0x100978[_0xef79('0x1c')][_0xef79('0x1e')]?_[_0xef79('0x1f')](_0x100978[_0xef79('0x1c')][_0xef79('0x1e')],function(_0x1ee5d1){return{'model':db[_0x1ee5d1[_0xef79('0x20')]],'as':_0x1ee5d1['as'],'attributes':_0x1ee5d1[_0xef79('0x21')],'include':_0x1ee5d1[_0xef79('0x1e')]?_['map'](_0x1ee5d1['include'],function(_0x424ad4){return{'model':db[_0x424ad4['model']],'as':_0x424ad4['as'],'attributes':_0x424ad4[_0xef79('0x21')],'include':_0x424ad4['include']?_[_0xef79('0x1f')](_0x424ad4[_0xef79('0x1e')],function(_0x4cfe91){return{'model':db[_0x4cfe91[_0xef79('0x20')]],'as':_0x4cfe91['as'],'attributes':_0x4cfe91['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bfdec){logger[_0xef79('0xf')](_0xef79('0x22'),_0x100978);logger[_0xef79('0x12')](_0xef79('0x22'),_0x100978,JSON[_0xef79('0x14')](_0x5bfdec));_0xebb64f(_0x5bfdec);})[_0xef79('0x19')](function(_0x34ba3a){logger[_0xef79('0x15')](_0xef79('0x22'),_0x34ba3a[_0xef79('0x17')],_0x100978);_0x100229(_0x3efb8c[_0xef79('0x15')](0x1f4,_0x34ba3a['message']));});});};exports['PauseUser']=function(_0x44db71){var _0x2ffaa4=this;return new Promise(function(_0xe630c9,_0x4816cc){var _0x15bb7b;return db[_0xef79('0x23')]['find']({'where':_0x44db71[_0xef79('0x1c')][_0xef79('0x24')]||{},'attributes':['id',_0xef79('0x25'),_0xef79('0x26'),_0xef79('0x27'),_0xef79('0x28')]})['then'](function(_0x12ee75){if(_0x12ee75){_0x15bb7b=_0x12ee75;return db[_0xef79('0x29')]['update']({'paused':0x1},{'where':{'UserId':_0x15bb7b['id']},'individualHooks':!![]});}})[_0xef79('0xe')](function(){if(_0x15bb7b){return db[_0xef79('0x2a')]['findAll']({'where':{'membername':_0x15bb7b[_0xef79('0x25')],'type':_0xef79('0x2b'),'exitAt':null}});}})[_0xef79('0xe')](function(_0x1e125c){if(_0x15bb7b){if(_0x1e125c&&_0x1e125c[_0xef79('0x2c')]){var _0x2224a5=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2678b9=0x0,_0x1ff893=_0x1e125c[_0xef79('0x2c')];_0x2678b9<_0x1ff893;_0x2678b9++){_0x1e125c[_0x2678b9]['updateAttributes']({'exitAt':_0x2224a5});}}}})[_0xef79('0xe')](function(){if(_0x15bb7b){var _0x5d86e5=[];var _0x499cbc=utils['getChannels']();_0x499cbc[_0xef79('0x2d')](function(_0x7a81a){_0x5d86e5[_0xef79('0x2e')]({'channel':_0x7a81a,'membername':_0x15bb7b['name'],'interface':_[_0xef79('0x2f')](_0x15bb7b[_0xef79('0x28')])?util[_0xef79('0x30')](_0xef79('0x31'),_0x15bb7b[_0xef79('0x25')]):_0x15bb7b[_0xef79('0x28')],'type':_0xef79('0x2b'),'enterAt':moment()[_0xef79('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x44db71['body'][_0xef79('0x32')]||_0xef79('0x33'),'role':_0x15bb7b[_0xef79('0x26')],'internal':_0x15bb7b[_0xef79('0x27')],'uniqueid':_0x44db71[_0xef79('0x34')][_0xef79('0x35')]||null});});return db[_0xef79('0x2a')][_0xef79('0x36')](_0x5d86e5,{'individualHooks':!![]});}})['then'](function(){if(_0x15bb7b){return _0x15bb7b['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x44db71['body'][_0xef79('0x32')]||_0xef79('0x33'),'lastPauseAt':moment()['format'](_0xef79('0x37'))});}})[_0xef79('0xe')](function(_0x833229){_0xe630c9(_0x833229);})['catch'](function(_0x1baf71){_0x4816cc(_0x2ffaa4['error'](0x1f4,_0x1baf71[_0xef79('0x17')]));});});};exports[_0xef79('0x38')]=function(_0x89da3d){var _0x523e84=this;return new Promise(function(_0x77f593,_0x4c0b0b){var _0x3ee5cf;return db[_0xef79('0x23')][_0xef79('0x39')]({'where':_0x89da3d['options'][_0xef79('0x24')]||{},'attributes':['id',_0xef79('0x25')]})[_0xef79('0xe')](function(_0x5b06c6){if(_0x5b06c6){_0x3ee5cf=_0x5b06c6;if(_0x89da3d[_0xef79('0x34')]['channel']&&!utils[_0xef79('0x3a')](_0x89da3d[_0xef79('0x34')]['channel'])){throw new Error(_0xef79('0x3b'));}switch(_0x89da3d['body'][_0xef79('0x3c')]){case _0xef79('0x3d'):return db[_0xef79('0x29')][_0xef79('0x3e')]({'paused':0x0},{'where':{'UserId':_0x3ee5cf['id']}})[_0xef79('0xe')](function(){return db[_0xef79('0x2a')][_0xef79('0x3f')]({'where':{'channel':_0x89da3d[_0xef79('0x34')][_0xef79('0x3c')],'membername':_0x3ee5cf[_0xef79('0x25')],'type':_0xef79('0x2b'),'exitAt':null}});})[_0xef79('0xe')](function(_0x34b17c){if(_0x34b17c){return _0x34b17c[_0xef79('0x3e')]({'exitAt':moment()[_0xef79('0x30')](_0xef79('0x37')),'data2':_0xef79('0x40')},{'individualHooks':!![]});}return null;})[_0xef79('0xe')](function(){return _0x3ee5cf[_0xef79('0x3e')]({'voicePause':![]});});case'mail':case _0xef79('0x41'):case _0xef79('0x42'):case _0xef79('0x43'):case _0xef79('0x44'):case _0xef79('0x45'):return db['MemberReport'][_0xef79('0x3f')]({'where':{'channel':_0x89da3d[_0xef79('0x34')][_0xef79('0x3c')],'membername':_0x3ee5cf['name'],'type':_0xef79('0x2b'),'exitAt':null}})[_0xef79('0xe')](function(_0x550f55){return _0x550f55['update']({'exitAt':moment()[_0xef79('0x30')](_0xef79('0x37')),'data2':_0xef79('0x40')},{'individualHooks':!![]});})['then'](function(){var _0x12522b={};_[_0xef79('0x46')](_0x12522b,util[_0xef79('0x30')]('%s%s',_0x89da3d[_0xef79('0x34')]['channel'],'Pause'),![]);return _0x3ee5cf[_0xef79('0x3e')](_0x12522b);});default:return db[_0xef79('0x29')]['update']({'paused':0x0},{'where':{'UserId':_0x3ee5cf['id']}})['then'](function(){return db[_0xef79('0x2a')][_0xef79('0x1b')]({'where':{'membername':_0x3ee5cf[_0xef79('0x25')],'type':_0xef79('0x2b'),'exitAt':null}});})[_0xef79('0xe')](function(_0x2bf930){var _0x495881=[];_0x2bf930[_0xef79('0x2d')](function(_0x4d9cc8){_0x495881[_0xef79('0x2e')](_0x4d9cc8[_0xef79('0x3e')]({'exitAt':moment()[_0xef79('0x30')](_0xef79('0x37')),'data2':_0xef79('0x40')}));});return BPromise[_0xef79('0x47')](_0x495881);})[_0xef79('0xe')](function(){return _0x3ee5cf[_0xef79('0x3e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xef79('0xe')](function(_0x297b23){_0x77f593(_0x297b23);})[_0xef79('0x19')](function(_0x297158){_0x4c0b0b(_0x523e84['error'](0x1f4,_0x297158[_0xef79('0x17')]));});});};exports[_0xef79('0x48')]=function(_0x20bcdc){var _0x3a9ff6=this;return new Promise(function(_0x24b992,_0x4d1e9f){var _0x5c134e;return db[_0xef79('0x23')][_0xef79('0x39')]({'where':_0x20bcdc[_0xef79('0x1c')][_0xef79('0x24')]||{},'attributes':['id','name']})[_0xef79('0xe')](function(_0x2ffb48){if(_0x2ffb48){_0x5c134e=_0x2ffb48;return db[_0xef79('0x29')][_0xef79('0x49')]({'where':{'membername':_0x5c134e[_0xef79('0x25')]},'individualHooks':!![]});}})[_0xef79('0xe')](function(){if(_0x5c134e){return db[_0xef79('0x2a')][_0xef79('0x1b')]({'where':{'membername':_0x5c134e[_0xef79('0x25')],'exitAt':null}});}})[_0xef79('0xe')](function(_0x2f9af4){if(_0x5c134e){if(_0x2f9af4&&_0x2f9af4[_0xef79('0x2c')]){var _0x10bff0=[];_0x2f9af4[_0xef79('0x2d')](function(_0x55f8d4){_0x10bff0[_0xef79('0x2e')](_0x55f8d4[_0xef79('0x3e')]({'exitAt':moment()['format'](_0xef79('0x37'))}));});return BPromise[_0xef79('0x47')](_0x10bff0);}}})[_0xef79('0xe')](function(){if(_0x5c134e){return _0x5c134e['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xef79('0xe')](function(_0x23c2ba){_0x24b992(_0x23c2ba);})[_0xef79('0x19')](function(_0x546f5b){_0x4d1e9f(_0x3a9ff6['error'](0x1f4,_0x546f5b[_0xef79('0x17')]));});});};exports[_0xef79('0x4a')]=function(_0x968e72){var _0x14c11c=this;return new Promise(function(_0x1a4f91,_0x4df8d8){var _0x488751;var _0x3cdcde;var _0x2ff2ea;var _0x1ccfa5;return db['User'][_0xef79('0x39')]({'where':_0x968e72[_0xef79('0x1c')][_0xef79('0x24')]||{},'attributes':['id',_0xef79('0x25'),'role',_0xef79('0x4b'),_0xef79('0x4c'),'internal',_0xef79('0x4d'),_0xef79('0x28')]})['then'](function(_0x3c9dbd){if(_0x3c9dbd){_0x488751=_0x3c9dbd;_0x1ccfa5=_0x968e72[_0xef79('0x34')][_0xef79('0x28')]?_0x968e72[_0xef79('0x34')][_0xef79('0x28')]:util[_0xef79('0x30')](_0xef79('0x31'),_0x488751[_0xef79('0x25')]);return db[_0xef79('0x23')][_0xef79('0x4e')]({'where':{'role':_0xef79('0x4f'),'online':!![],'id':{'$ne':_0x488751['id']}}});}})[_0xef79('0xe')](function(_0x157bae){if(_0x157bae){_0x2ff2ea=_0x157bae;return require(_0xef79('0x50'))[_0xef79('0x51')]();}})[_0xef79('0xe')](function(_0xe57fbe){if(_0xe57fbe&&_0xe57fbe['agents']&&_0x2ff2ea>=_0xe57fbe[_0xef79('0x52')]){throw new Error(_0xef79('0x53'));}})['then'](function(){if(_0x488751){return db[_0xef79('0x29')]['destroy']({'where':{'membername':_0x488751[_0xef79('0x25')]},'individualHooks':!![]});}})[_0xef79('0xe')](function(){if(_0x488751){return _0x488751[_0xef79('0x54')]({'raw':!![]});}})['then'](function(_0x1257f0){if(_0x488751){if(_0x1257f0){var _0x41237e=[];_0x3cdcde=_0x1257f0;if(_0x3cdcde[_0xef79('0x2c')]){for(var _0x59dfc9=0x0;_0x59dfc9<_0x3cdcde['length'];_0x59dfc9++){_0x41237e[_0xef79('0x2e')](db['UserVoiceQueueRt'][_0xef79('0x55')]({'membername':_0x488751[_0xef79('0x25')],'UserId':_0x488751['id'],'queue_name':_0x3cdcde[_0x59dfc9][_0xef79('0x25')],'VoiceQueueId':_0x3cdcde[_0x59dfc9]['id'],'interface':_0x1ccfa5,'paused':_0x488751['loginInPause']||![],'penalty':_0x3cdcde[_0x59dfc9][_0xef79('0x56')]||0x0}));}return BPromise[_0xef79('0x47')](_0x41237e);}}}})['then'](function(){if(_0x488751){return db[_0xef79('0x2a')]['findAll']({'where':{'membername':_0x488751['name'],'exitAt':null}});}})[_0xef79('0xe')](function(_0x59577d){if(_0x488751){if(_0x59577d&&_0x59577d[_0xef79('0x2c')]){var _0x118b4c=[];_0x59577d['forEach'](function(_0x2c82cd){_0x118b4c['push'](_0x2c82cd[_0xef79('0x3e')]({'exitAt':moment()['format'](_0xef79('0x37'))}));});return BPromise['all'](_0x118b4c);}}})['then'](function(_0xdffe10){if(_0x488751){var _0x12b6d4=[];var _0x58a221=[];var _0x3605e4=utils['getChannels']();var _0x2cb5e9={'membername':_0x488751[_0xef79('0x25')],'interface':_0x1ccfa5,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x488751['role'],'internal':_0x488751[_0xef79('0x27')]};_0x3605e4[_0xef79('0x2d')](function(_0x5da0c0){_0x12b6d4['push'](_['merge']({'channel':_0x5da0c0,'type':_0xef79('0x57'),'data1':'callysquare','data2':_0x1ccfa5},_0x2cb5e9));if(_0x488751[_0xef79('0x4d')]){_0x58a221[_0xef79('0x2e')](_[_0xef79('0x58')]({'channel':_0x5da0c0,'type':_0xef79('0x2b'),'data1':_0xef79('0x59')},_0x2cb5e9));}});return db[_0xef79('0x2a')][_0xef79('0x36')](_0x12b6d4['concat'](_0x58a221),{'individualHooks':!![]});}})[_0xef79('0xe')](function(){if(_0x488751){return _0x488751[_0xef79('0x3e')]({'online':!![],'lastLoginAt':moment()[_0xef79('0x30')](_0xef79('0x37')),'voicePause':_0x488751['loginInPause']||![],'mailPause':_0x488751[_0xef79('0x4d')]||![],'chatPause':_0x488751[_0xef79('0x4d')]||![],'faxPause':_0x488751[_0xef79('0x4d')]||![],'smsPause':_0x488751[_0xef79('0x4d')]||![],'openchannelPause':_0x488751['loginInPause']||![],'pauseType':_0x488751['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xef79('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x1ccfa5});}})[_0xef79('0xe')](function(_0x4eca60){_0x1a4f91(_0x4eca60);})[_0xef79('0x19')](function(_0x127bb3){_0x4df8d8(_0x14c11c['error'](0x1f4,_0x127bb3[_0xef79('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 706ed37..16b76e8 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 _0xdbab=['removeListener','register','save','remove','update','emit'];(function(_0x30b057,_0x1d1505){var _0x331671=function(_0x30bcdf){while(--_0x30bcdf){_0x30b057['push'](_0x30b057['shift']());}};_0x331671(++_0x1d1505);}(_0xdbab,0x146));var _0xbdba=function(_0x2570b1,_0x3fed7f){_0x2570b1=_0x2570b1-0x0;var _0x5b4e74=_0xdbab[_0x2570b1];return _0x5b4e74;};'use strict';var UserEvents=require('./user.events');var events=[_0xbdba('0x0'),_0xbdba('0x1'),_0xbdba('0x2')];function createListener(_0x2b6d60,_0x964638){return function(_0xa8aaf1){_0x964638[_0xbdba('0x3')](_0x2b6d60,_0xa8aaf1);};}function removeListener(_0x5b646c,_0x1205da){return function(){UserEvents[_0xbdba('0x4')](_0x5b646c,_0x1205da);};}exports[_0xbdba('0x5')]=function(_0x2ca05f){for(var _0x470e0a=0x0,_0x5f4654=events['length'];_0x470e0a<_0x5f4654;_0x470e0a++){var _0x16b54f=events[_0x470e0a];var _0x2235cc=createListener('user:'+_0x16b54f,_0x2ca05f);UserEvents['on'](_0x16b54f,_0x2235cc);}}; \ No newline at end of file +var _0x1a39=['./user.events','update','length'];(function(_0x48ab18,_0x5ba306){var _0x5d3b18=function(_0xf8d5de){while(--_0xf8d5de){_0x48ab18['push'](_0x48ab18['shift']());}};_0x5d3b18(++_0x5ba306);}(_0x1a39,0x195));var _0x91a3=function(_0x266cc8,_0x2711ac){_0x266cc8=_0x266cc8-0x0;var _0x3915a3=_0x1a39[_0x266cc8];return _0x3915a3;};'use strict';var UserEvents=require(_0x91a3('0x0'));var events=['save','remove',_0x91a3('0x1')];function createListener(_0x516b48,_0x5841f3){return function(_0x42a560){_0x5841f3['emit'](_0x516b48,_0x42a560);};}function removeListener(_0x43d8e,_0x3075d4){return function(){UserEvents['removeListener'](_0x43d8e,_0x3075d4);};}exports['register']=function(_0x4c46d3){for(var _0x12a963=0x0,_0x1c2021=events[_0x91a3('0x2')];_0x12a963<_0x1c2021;_0x12a963++){var _0xde7dff=events[_0x12a963];var _0x5d28e5=createListener('user:'+_0xde7dff,_0x4c46d3);UserEvents['on'](_0xde7dff,_0x5d28e5);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 3d3655b..2e243e3 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 _0x4a70=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0xebf298,_0x4a09a1){var _0x41c764=function(_0x1e885f){while(--_0x1e885f){_0xebf298['push'](_0xebf298['shift']());}};_0x41c764(++_0x4a09a1);}(_0x4a70,0x77));var _0x04a7=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0x4a70[_0x104e21];return _0x605b37;};'use strict';var multer=require(_0x04a7('0x0'));var util=require(_0x04a7('0x1'));var path=require(_0x04a7('0x2'));var timeout=require('connect-timeout');var express=require(_0x04a7('0x3'));var router=express['Router']();var auth=require(_0x04a7('0x4'));var interaction=require(_0x04a7('0x5'));var config=require(_0x04a7('0x6'));module[_0x04a7('0x7')]=router; \ No newline at end of file +var _0xf03f=['util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x1d2bc8,_0x2860bc){var _0x1857e1=function(_0x3a3073){while(--_0x3a3073){_0x1d2bc8['push'](_0x1d2bc8['shift']());}};_0x1857e1(++_0x2860bc);}(_0xf03f,0xe7));var _0xff03=function(_0x5b7963,_0x10bff5){_0x5b7963=_0x5b7963-0x0;var _0x57f611=_0xf03f[_0x5b7963];return _0x57f611;};'use strict';var multer=require(_0xff03('0x0'));var util=require(_0xff03('0x1'));var path=require(_0xff03('0x2'));var timeout=require(_0xff03('0x3'));var express=require(_0xff03('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xff03('0x5'));var config=require(_0xff03('0x6'));module[_0xff03('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index b4fe19f..6556aeb 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 _0xb10b=['sequelize','INTEGER'];(function(_0x40a0ce,_0x36a40f){var _0x48e121=function(_0x4622b2){while(--_0x4622b2){_0x40a0ce['push'](_0x40a0ce['shift']());}};_0x48e121(++_0x36a40f);}(_0xb10b,0x12a));var _0xbb10=function(_0xe7a99e,_0x4902a1){_0xe7a99e=_0xe7a99e-0x0;var _0x3bef5c=_0xb10b[_0xe7a99e];return _0x3bef5c;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x24460f,_0x4fc2af){var _0x1e91af=function(_0x382cb7){while(--_0x382cb7){_0x24460f['push'](_0x24460f['shift']());}};_0x1e91af(++_0x4fc2af);}(_0xe706,0xa3));var _0x6e70=function(_0x3ae812,_0x57767f){_0x3ae812=_0x3ae812-0x0;var _0x3f6639=_0xe706[_0x3ae812];return _0x3f6639;};'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 2bfd00a..23a53b0 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 _0x219d=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','define','user_has_chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x26eecf,_0x362106){var _0x2ea204=function(_0x4a5d1f){while(--_0x4a5d1f){_0x26eecf['push'](_0x26eecf['shift']());}};_0x2ea204(++_0x362106);}(_0x219d,0xa4));var _0xd219=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x219d[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xd219('0x0'));var util=require(_0xd219('0x1'));var logger=require(_0xd219('0x2'))(_0xd219('0x3'));var moment=require(_0xd219('0x4'));var BPromise=require(_0xd219('0x5'));var rp=require(_0xd219('0x6'));var fs=require('fs');var path=require(_0xd219('0x7'));var rimraf=require(_0xd219('0x8'));var config=require(_0xd219('0x9'));var attributes=require(_0xd219('0xa'));module['exports']=function(_0x4f325f,_0x2658a2){return _0x4f325f[_0xd219('0xb')]('UserChatQueue',attributes,{'tableName':_0xd219('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c70=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes','exports','user_has_chat_queues','lodash'];(function(_0x427612,_0xbeb540){var _0x4ba8b4=function(_0x146027){while(--_0x146027){_0x427612['push'](_0x427612['shift']());}};_0x4ba8b4(++_0xbeb540);}(_0x1c70,0xe3));var _0x01c7=function(_0x77cbc3,_0x3f2d07){_0x77cbc3=_0x77cbc3-0x0;var _0x263ee5=_0x1c70[_0x77cbc3];return _0x263ee5;};'use strict';var _=require(_0x01c7('0x0'));var util=require(_0x01c7('0x1'));var logger=require(_0x01c7('0x2'))(_0x01c7('0x3'));var moment=require(_0x01c7('0x4'));var BPromise=require(_0x01c7('0x5'));var rp=require(_0x01c7('0x6'));var fs=require('fs');var path=require(_0x01c7('0x7'));var rimraf=require('rimraf');var config=require(_0x01c7('0x8'));var attributes=require(_0x01c7('0x9'));module[_0x01c7('0xa')]=function(_0x4da908,_0x4e8065){return _0x4da908['define']('UserChatQueue',attributes,{'tableName':_0x01c7('0xb'),'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 53a8d2b..80ff422 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 _0xc329=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment'];(function(_0x18dc34,_0x205f71){var _0x4ab15b=function(_0x50572f){while(--_0x50572f){_0x18dc34['push'](_0x18dc34['shift']());}};_0x4ab15b(++_0x205f71);}(_0xc329,0x105));var _0x9c32=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0xc329[_0x4eaa4c];return _0x15aec6;};'use strict';var _=require(_0x9c32('0x0'));var util=require(_0x9c32('0x1'));var moment=require(_0x9c32('0x2'));var BPromise=require(_0x9c32('0x3'));var rs=require(_0x9c32('0x4'));var fs=require('fs');var Redis=require(_0x9c32('0x5'));var db=require(_0x9c32('0x6'))['db'];var utils=require(_0x9c32('0x7'));var logger=require(_0x9c32('0x8'))(_0x9c32('0x9'));var config=require(_0x9c32('0xa'));var jayson=require(_0x9c32('0xb'));var client=jayson[_0x9c32('0xc')][_0x9c32('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x366200,_0x16203a,_0x57219b){return new BPromise(function(_0x4ef77c,_0x206912){return client[_0x9c32('0xe')](_0x366200,_0x57219b)['then'](function(_0x3976e0){logger[_0x9c32('0xf')](_0x9c32('0x10'),_0x16203a,_0x9c32('0x11'));logger[_0x9c32('0x12')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x16203a,_0x9c32('0x11'),JSON['stringify'](_0x3976e0));if(_0x3976e0['error']){if(_0x3976e0[_0x9c32('0x13')][_0x9c32('0x14')]===0x1f4){logger['error'](_0x9c32('0x10'),_0x16203a,_0x3976e0[_0x9c32('0x13')][_0x9c32('0x15')]);return _0x206912(_0x3976e0[_0x9c32('0x13')]['message']);}logger['error'](_0x9c32('0x10'),_0x16203a,_0x3976e0[_0x9c32('0x13')][_0x9c32('0x15')]);return _0x4ef77c(_0x3976e0[_0x9c32('0x13')][_0x9c32('0x15')]);}else{logger[_0x9c32('0xf')](_0x9c32('0x10'),_0x16203a,_0x9c32('0x11'));_0x4ef77c(_0x3976e0[_0x9c32('0x16')][_0x9c32('0x15')]);}})[_0x9c32('0x17')](function(_0xcd14df){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x16203a,_0xcd14df);_0x206912(_0xcd14df);});});} \ No newline at end of file +var _0xc2f2=['http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x3ad04d,_0xc06f67){var _0x18ebc8=function(_0x16226f){while(--_0x16226f){_0x3ad04d['push'](_0x3ad04d['shift']());}};_0x18ebc8(++_0xc06f67);}(_0xc2f2,0x19c));var _0x2c2f=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xc2f2[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x2c2f('0x0'));var util=require(_0x2c2f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2c2f('0x2'));var fs=require('fs');var Redis=require(_0x2c2f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c2f('0x4'));var logger=require(_0x2c2f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2c2f('0x6'));var client=jayson[_0x2c2f('0x7')][_0x2c2f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x512345,_0x3cebe3,_0x6582d3){return new BPromise(function(_0x589b4d,_0x356465){return client[_0x2c2f('0x9')](_0x512345,_0x6582d3)[_0x2c2f('0xa')](function(_0x11783e){logger[_0x2c2f('0xb')](_0x2c2f('0xc'),_0x3cebe3,_0x2c2f('0xd'));logger['debug'](_0x2c2f('0xe'),_0x3cebe3,_0x2c2f('0xd'),JSON[_0x2c2f('0xf')](_0x11783e));if(_0x11783e['error']){if(_0x11783e[_0x2c2f('0x10')][_0x2c2f('0x11')]===0x1f4){logger['error'](_0x2c2f('0xc'),_0x3cebe3,_0x11783e[_0x2c2f('0x10')][_0x2c2f('0x12')]);return _0x356465(_0x11783e[_0x2c2f('0x10')][_0x2c2f('0x12')]);}logger['error'](_0x2c2f('0xc'),_0x3cebe3,_0x11783e[_0x2c2f('0x10')][_0x2c2f('0x12')]);return _0x589b4d(_0x11783e[_0x2c2f('0x10')][_0x2c2f('0x12')]);}else{logger['info'](_0x2c2f('0xc'),_0x3cebe3,'request\x20sent');_0x589b4d(_0x11783e[_0x2c2f('0x13')][_0x2c2f('0x12')]);}})[_0x2c2f('0x14')](function(_0x427603){logger[_0x2c2f('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x3cebe3,_0x427603);_0x356465(_0x427603);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 881c3b8..bd5360b 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 _0x6435=['multer','util','../../components/auth/service','../../config/environment','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6435,0xb4));var _0x5643=function(_0x1cd0af,_0x33cd9d){_0x1cd0af=_0x1cd0af-0x0;var _0x3a7880=_0x6435[_0x1cd0af];return _0x3a7880;};'use strict';var multer=require(_0x5643('0x0'));var util=require(_0x5643('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x5643('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x5643('0x3'));module[_0x5643('0x4')]=router; \ No newline at end of file +var _0xffe4=['exports','multer','util','path','express','../../components/interaction/service','../../config/environment'];(function(_0xfd1fcd,_0x3182b7){var _0x1e0646=function(_0x4f4fa4){while(--_0x4f4fa4){_0xfd1fcd['push'](_0xfd1fcd['shift']());}};_0x1e0646(++_0x3182b7);}(_0xffe4,0xa9));var _0x4ffe=function(_0x599b8a,_0x238659){_0x599b8a=_0x599b8a-0x0;var _0x541aed=_0xffe4[_0x599b8a];return _0x541aed;};'use strict';var multer=require(_0x4ffe('0x0'));var util=require(_0x4ffe('0x1'));var path=require(_0x4ffe('0x2'));var timeout=require('connect-timeout');var express=require(_0x4ffe('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4ffe('0x4'));var config=require(_0x4ffe('0x5'));module[_0x4ffe('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 51e301b..014d69d 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 _0x96cc=['STRING','sequelize','INTEGER'];(function(_0x572165,_0x6a45cc){var _0x8c8709=function(_0x43faab){while(--_0x43faab){_0x572165['push'](_0x572165['shift']());}};_0x8c8709(++_0x6a45cc);}(_0x96cc,0x16c));var _0xc96c=function(_0x6b15e9,_0x20eaa3){_0x6b15e9=_0x6b15e9-0x0;var _0x630fd6=_0x96cc[_0x6b15e9];return _0x630fd6;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc96c('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc96c('0x2')]}}; \ No newline at end of file +var _0xe605=['INTEGER','STRING','sequelize','exports'];(function(_0xbc4e3b,_0x35c7ea){var _0x4002f3=function(_0x426375){while(--_0x426375){_0xbc4e3b['push'](_0xbc4e3b['shift']());}};_0x4002f3(++_0x35c7ea);}(_0xe605,0x92));var _0x5e60=function(_0xe7f720,_0x5a5bd2){_0xe7f720=_0xe7f720-0x0;var _0x252193=_0xe605[_0xe7f720];return _0x252193;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5e60('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5e60('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 3c0c803..76e06f5 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 _0x6cb4=['bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x4c595a,_0x160314){var _0x59eed5=function(_0x2f9a46){while(--_0x2f9a46){_0x4c595a['push'](_0x4c595a['shift']());}};_0x59eed5(++_0x160314);}(_0x6cb4,0xff));var _0x46cb=function(_0x5c5476,_0x39c982){_0x5c5476=_0x5c5476-0x0;var _0x28890e=_0x6cb4[_0x5c5476];return _0x28890e;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var logger=require(_0x46cb('0x2'))(_0x46cb('0x3'));var moment=require(_0x46cb('0x4'));var BPromise=require(_0x46cb('0x5'));var rp=require(_0x46cb('0x6'));var fs=require('fs');var path=require(_0x46cb('0x7'));var rimraf=require(_0x46cb('0x8'));var config=require('../../config/environment');var attributes=require(_0x46cb('0x9'));module['exports']=function(_0x3d9d3c,_0x4d9f1d){return _0x3d9d3c[_0x46cb('0xa')](_0x46cb('0xb'),attributes,{'tableName':_0x46cb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x749c=['path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x30df37,_0x48ad64){var _0x41ab55=function(_0x28feb2){while(--_0x28feb2){_0x30df37['push'](_0x30df37['shift']());}};_0x41ab55(++_0x48ad64);}(_0x749c,0x17a));var _0xc749=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x749c[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0xc749('0x0'));var util=require(_0xc749('0x1'));var logger=require(_0xc749('0x2'))(_0xc749('0x3'));var moment=require('moment');var BPromise=require(_0xc749('0x4'));var rp=require(_0xc749('0x5'));var fs=require('fs');var path=require(_0xc749('0x6'));var rimraf=require(_0xc749('0x7'));var config=require(_0xc749('0x8'));var attributes=require(_0xc749('0x9'));module['exports']=function(_0x2b3dbc,_0x4adb3e){return _0x2b3dbc[_0xc749('0xa')](_0xc749('0xb'),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 543f0a7..768459c 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 _0x7ff7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment'];(function(_0x2849c9,_0x306b2f){var _0x42fa59=function(_0x249135){while(--_0x249135){_0x2849c9['push'](_0x2849c9['shift']());}};_0x42fa59(++_0x306b2f);}(_0x7ff7,0xc4));var _0x77ff=function(_0x37bff2,_0x157462){_0x37bff2=_0x37bff2-0x0;var _0x31f42f=_0x7ff7[_0x37bff2];return _0x31f42f;};'use strict';var _=require(_0x77ff('0x0'));var util=require('util');var moment=require(_0x77ff('0x1'));var BPromise=require(_0x77ff('0x2'));var rs=require(_0x77ff('0x3'));var fs=require('fs');var Redis=require(_0x77ff('0x4'));var db=require(_0x77ff('0x5'))['db'];var utils=require(_0x77ff('0x6'));var logger=require('../../config/logger')(_0x77ff('0x7'));var config=require(_0x77ff('0x8'));var jayson=require(_0x77ff('0x9'));var client=jayson[_0x77ff('0xa')][_0x77ff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b88e4,_0x1c146c,_0x488d12){return new BPromise(function(_0xc084c6,_0x5b4aac){return client['request'](_0x4b88e4,_0x488d12)[_0x77ff('0xc')](function(_0x12a4a4){logger[_0x77ff('0xd')](_0x77ff('0xe'),_0x1c146c,_0x77ff('0xf'));logger['debug'](_0x77ff('0x10'),_0x1c146c,_0x77ff('0xf'),JSON[_0x77ff('0x11')](_0x12a4a4));if(_0x12a4a4[_0x77ff('0x12')]){if(_0x12a4a4[_0x77ff('0x12')][_0x77ff('0x13')]===0x1f4){logger['error'](_0x77ff('0xe'),_0x1c146c,_0x12a4a4[_0x77ff('0x12')][_0x77ff('0x14')]);return _0x5b4aac(_0x12a4a4['error'][_0x77ff('0x14')]);}logger[_0x77ff('0x12')](_0x77ff('0xe'),_0x1c146c,_0x12a4a4['error'][_0x77ff('0x14')]);return _0xc084c6(_0x12a4a4['error']['message']);}else{logger[_0x77ff('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x1c146c,'request\x20sent');_0xc084c6(_0x12a4a4['result']['message']);}})[_0x77ff('0x15')](function(_0x32677f){logger[_0x77ff('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x1c146c,_0x32677f);_0x5b4aac(_0x32677f);});});} \ No newline at end of file +var _0x256a=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0x256a,0x83));var _0xa256=function(_0x2112ea,_0x421d12){_0x2112ea=_0x2112ea-0x0;var _0x197e71=_0x256a[_0x2112ea];return _0x197e71;};'use strict';var _=require('lodash');var util=require(_0xa256('0x0'));var moment=require(_0xa256('0x1'));var BPromise=require(_0xa256('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa256('0x3'));var db=require(_0xa256('0x4'))['db'];var utils=require(_0xa256('0x5'));var logger=require(_0xa256('0x6'))('rpc');var config=require(_0xa256('0x7'));var jayson=require(_0xa256('0x8'));var client=jayson[_0xa256('0x9')][_0xa256('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a87f2,_0x41e1db,_0x160534){return new BPromise(function(_0x1b1a89,_0x98d217){return client['request'](_0x2a87f2,_0x160534)['then'](function(_0x4c02b6){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x41e1db,_0xa256('0xb'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x41e1db,_0xa256('0xb'),JSON[_0xa256('0xc')](_0x4c02b6));if(_0x4c02b6[_0xa256('0xd')]){if(_0x4c02b6[_0xa256('0xd')][_0xa256('0xe')]===0x1f4){logger[_0xa256('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x41e1db,_0x4c02b6[_0xa256('0xd')][_0xa256('0xf')]);return _0x98d217(_0x4c02b6['error'][_0xa256('0xf')]);}logger[_0xa256('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x41e1db,_0x4c02b6['error'][_0xa256('0xf')]);return _0x1b1a89(_0x4c02b6['error'][_0xa256('0xf')]);}else{logger[_0xa256('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x41e1db,_0xa256('0xb'));_0x1b1a89(_0x4c02b6[_0xa256('0x11')][_0xa256('0xf')]);}})[_0xa256('0x12')](function(_0xd966b2){logger[_0xa256('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x41e1db,_0xd966b2);_0x98d217(_0xd966b2);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index eacb7f9..9657189 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 _0xccf0=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xbf99dd,_0x255ca3){var _0x3f173d=function(_0x110182){while(--_0x110182){_0xbf99dd['push'](_0xbf99dd['shift']());}};_0x3f173d(++_0x255ca3);}(_0xccf0,0xbe));var _0x0ccf=function(_0x367ad9,_0x23486c){_0x367ad9=_0x367ad9-0x0;var _0x39e4fb=_0xccf0[_0x367ad9];return _0x39e4fb;};'use strict';var multer=require(_0x0ccf('0x0'));var util=require(_0x0ccf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0ccf('0x2'));var router=express[_0x0ccf('0x3')]();var auth=require(_0x0ccf('0x4'));var interaction=require(_0x0ccf('0x5'));var config=require('../../config/environment');module[_0x0ccf('0x6')]=router; \ No newline at end of file +var _0x058a=['../../components/auth/service','../../components/interaction/service','../../config/environment','multer','path','connect-timeout','express'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0x058a,0x130));var _0xa058=function(_0x27a93b,_0xf04963){_0x27a93b=_0x27a93b-0x0;var _0xb7a1ae=_0x058a[_0x27a93b];return _0xb7a1ae;};'use strict';var multer=require(_0xa058('0x0'));var util=require('util');var path=require(_0xa058('0x1'));var timeout=require(_0xa058('0x2'));var express=require(_0xa058('0x3'));var router=express['Router']();var auth=require(_0xa058('0x4'));var interaction=require(_0xa058('0x5'));var config=require(_0xa058('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 1b1ae1f..45b42ba 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 _0xd8b0=['exports','sequelize'];(function(_0x479b99,_0x1e5bec){var _0x1e7eb7=function(_0x52ac6c){while(--_0x52ac6c){_0x479b99['push'](_0x479b99['shift']());}};_0x1e7eb7(++_0x1e5bec);}(_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 +var _0xd8b0=['exports','sequelize'];(function(_0x3cab38,_0x439e61){var _0x187d60=function(_0x285a14){while(--_0x285a14){_0x3cab38['push'](_0x3cab38['shift']());}};_0x187d60(++_0x439e61);}(_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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 92aa191..fe5c7f2 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 _0xd8b0=['define','user_has_mail_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c615a,_0xc3918b){var _0x324a39=function(_0x19869e){while(--_0x19869e){_0x2c615a['push'](_0x2c615a['shift']());}};_0x324a39(++_0xc3918b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserMailQueue',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x1a165d,_0x4083c6){var _0x302744=function(_0x1753ac){while(--_0x1753ac){_0x1a165d['push'](_0x1a165d['shift']());}};_0x302744(++_0x4083c6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 2a2f03a..257a767 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 _0xf77e=['UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug'];(function(_0x458270,_0x24df8a){var _0x4a9f73=function(_0x24c90d){while(--_0x24c90d){_0x458270['push'](_0x458270['shift']());}};_0x4a9f73(++_0x24df8a);}(_0xf77e,0x15a));var _0xef77=function(_0x1374a,_0x46426d){_0x1374a=_0x1374a-0x0;var _0xfcb53c=_0xf77e[_0x1374a];return _0xfcb53c;};'use strict';var _=require(_0xef77('0x0'));var util=require(_0xef77('0x1'));var moment=require('moment');var BPromise=require(_0xef77('0x2'));var rs=require(_0xef77('0x3'));var fs=require('fs');var Redis=require(_0xef77('0x4'));var db=require(_0xef77('0x5'))['db'];var utils=require(_0xef77('0x6'));var logger=require(_0xef77('0x7'))(_0xef77('0x8'));var config=require(_0xef77('0x9'));var jayson=require(_0xef77('0xa'));var client=jayson[_0xef77('0xb')][_0xef77('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd83a4b,_0x16a58e,_0x4cdf78){return new BPromise(function(_0xcdd632,_0xcdc7bc){return client[_0xef77('0xd')](_0xd83a4b,_0x4cdf78)[_0xef77('0xe')](function(_0x7735e9){logger[_0xef77('0xf')](_0xef77('0x10'),_0x16a58e,'request\x20sent');logger[_0xef77('0x11')](_0xef77('0x12'),_0x16a58e,_0xef77('0x13'),JSON[_0xef77('0x14')](_0x7735e9));if(_0x7735e9[_0xef77('0x15')]){if(_0x7735e9['error'][_0xef77('0x16')]===0x1f4){logger[_0xef77('0x15')]('UserMailQueue,\x20%s,\x20%s',_0x16a58e,_0x7735e9['error'][_0xef77('0x17')]);return _0xcdc7bc(_0x7735e9['error'][_0xef77('0x17')]);}logger[_0xef77('0x15')]('UserMailQueue,\x20%s,\x20%s',_0x16a58e,_0x7735e9[_0xef77('0x15')]['message']);return _0xcdd632(_0x7735e9[_0xef77('0x15')][_0xef77('0x17')]);}else{logger[_0xef77('0xf')](_0xef77('0x10'),_0x16a58e,_0xef77('0x13'));_0xcdd632(_0x7735e9[_0xef77('0x18')]['message']);}})[_0xef77('0x19')](function(_0x1ec157){logger[_0xef77('0x15')]('UserMailQueue,\x20%s,\x20%s',_0x16a58e,_0x1ec157);_0xcdc7bc(_0x1ec157);});});} \ No newline at end of file +var _0x0db8=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x0db8,0x1cd));var _0x80db=function(_0x2c28e9,_0x2257f1){_0x2c28e9=_0x2c28e9-0x0;var _0x3ada94=_0x0db8[_0x2c28e9];return _0x3ada94;};'use strict';var _=require(_0x80db('0x0'));var util=require('util');var moment=require(_0x80db('0x1'));var BPromise=require(_0x80db('0x2'));var rs=require(_0x80db('0x3'));var fs=require('fs');var Redis=require(_0x80db('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x80db('0x5'))(_0x80db('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x80db('0x7')][_0x80db('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x423ecf,_0x58abba,_0x3df596){return new BPromise(function(_0x1b7955,_0xe0b86e){return client[_0x80db('0x9')](_0x423ecf,_0x3df596)[_0x80db('0xa')](function(_0x238572){logger[_0x80db('0xb')](_0x80db('0xc'),_0x58abba,'request\x20sent');logger['debug'](_0x80db('0xd'),_0x58abba,_0x80db('0xe'),JSON[_0x80db('0xf')](_0x238572));if(_0x238572[_0x80db('0x10')]){if(_0x238572['error'][_0x80db('0x11')]===0x1f4){logger['error'](_0x80db('0xc'),_0x58abba,_0x238572[_0x80db('0x10')][_0x80db('0x12')]);return _0xe0b86e(_0x238572[_0x80db('0x10')][_0x80db('0x12')]);}logger[_0x80db('0x10')](_0x80db('0xc'),_0x58abba,_0x238572[_0x80db('0x10')][_0x80db('0x12')]);return _0x1b7955(_0x238572[_0x80db('0x10')][_0x80db('0x12')]);}else{logger[_0x80db('0xb')]('UserMailQueue,\x20%s,\x20%s',_0x58abba,_0x80db('0xe'));_0x1b7955(_0x238572[_0x80db('0x13')][_0x80db('0x12')]);}})[_0x80db('0x14')](function(_0x1dcc2c){logger['error'](_0x80db('0xc'),_0x58abba,_0x1dcc2c);_0xe0b86e(_0x1dcc2c);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 21caa25..16cd0e4 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 _0x8172=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x17f855,_0x3ac0d3){var _0x50c5a4=function(_0x15ad5e){while(--_0x15ad5e){_0x17f855['push'](_0x17f855['shift']());}};_0x50c5a4(++_0x3ac0d3);}(_0x8172,0x1ce));var _0x2817=function(_0x80a731,_0x19d37e){_0x80a731=_0x80a731-0x0;var _0x171d92=_0x8172[_0x80a731];return _0x171d92;};'use strict';var multer=require(_0x2817('0x0'));var util=require(_0x2817('0x1'));var path=require(_0x2817('0x2'));var timeout=require(_0x2817('0x3'));var express=require(_0x2817('0x4'));var router=express[_0x2817('0x5')]();var auth=require(_0x2817('0x6'));var interaction=require(_0x2817('0x7'));var config=require(_0x2817('0x8'));module[_0x2817('0x9')]=router; \ No newline at end of file +var _0x3a95=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x3a95,0x198));var _0x53a9=function(_0x4f50e1,_0x4d6fa1){_0x4f50e1=_0x4f50e1-0x0;var _0xe5b3bc=_0x3a95[_0x4f50e1];return _0xe5b3bc;};'use strict';var multer=require(_0x53a9('0x0'));var util=require(_0x53a9('0x1'));var path=require(_0x53a9('0x2'));var timeout=require(_0x53a9('0x3'));var express=require(_0x53a9('0x4'));var router=express[_0x53a9('0x5')]();var auth=require(_0x53a9('0x6'));var interaction=require(_0x53a9('0x7'));var config=require('../../config/environment');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 24dd57e..b583c9f 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x2874b9,_0x23f744){var _0x3fe836=function(_0xb185b6){while(--_0xb185b6){_0x2874b9['push'](_0x2874b9['shift']());}};_0x3fe836(++_0x23f744);}(_0xe706,0xa3));var _0x6e70=function(_0x512f81,_0x4a7986){_0x512f81=_0x512f81-0x0;var _0xa15099=_0xe706[_0x512f81];return _0xa15099;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1e49ff,_0x1a41e6){var _0x20ab06=function(_0x4d160b){while(--_0x4d160b){_0x1e49ff['push'](_0x1e49ff['shift']());}};_0x20ab06(++_0x1a41e6);}(_0xe706,0xa3));var _0x6e70=function(_0x17fc20,_0x7d3f2f){_0x17fc20=_0x17fc20-0x0;var _0x29d108=_0xe706[_0x17fc20];return _0x29d108;};'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/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 3cd5aca..ae155ca 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 _0xafb9=['bluebird','request-promise','path','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xafb9,0x1c9));var _0x9afb=function(_0x29d645,_0x4c6c2d){_0x29d645=_0x29d645-0x0;var _0x14e5c1=_0xafb9[_0x29d645];return _0x14e5c1;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var logger=require(_0x9afb('0x2'))(_0x9afb('0x3'));var moment=require(_0x9afb('0x4'));var BPromise=require(_0x9afb('0x5'));var rp=require(_0x9afb('0x6'));var fs=require('fs');var path=require(_0x9afb('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9afb('0x8'));module['exports']=function(_0x393f29,_0x10c0de){return _0x393f29['define'](_0x9afb('0x9'),attributes,{'tableName':_0x9afb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x436b=['../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash','api','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x436b,0xaf));var _0xb436=function(_0x530a6c,_0x5b31b2){_0x530a6c=_0x530a6c-0x0;var _0x5522f0=_0x436b[_0x530a6c];return _0x5522f0;};'use strict';var _=require(_0xb436('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb436('0x1'));var moment=require('moment');var BPromise=require(_0xb436('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb436('0x3'));var rimraf=require(_0xb436('0x4'));var config=require(_0xb436('0x5'));var attributes=require(_0xb436('0x6'));module[_0xb436('0x7')]=function(_0x373f92,_0x957fd3){return _0x373f92[_0xb436('0x8')](_0xb436('0x9'),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 9c8dc37..af478fc 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 _0xbe36=['then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x25acdb,_0x578093){var _0x33c680=function(_0x2e5c22){while(--_0x2e5c22){_0x25acdb['push'](_0x25acdb['shift']());}};_0x33c680(++_0x578093);}(_0xbe36,0x1da));var _0x6be3=function(_0x104ecb,_0x19c969){_0x104ecb=_0x104ecb-0x0;var _0x4fa432=_0xbe36[_0x104ecb];return _0x4fa432;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6be3('0x0'));var rs=require(_0x6be3('0x1'));var fs=require('fs');var Redis=require(_0x6be3('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6be3('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6be3('0x4'));var jayson=require(_0x6be3('0x5'));var client=jayson[_0x6be3('0x6')][_0x6be3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x471f52,_0xbd6e9e,_0x241809){return new BPromise(function(_0x4c8cc3,_0x3ade76){return client[_0x6be3('0x8')](_0x471f52,_0x241809)[_0x6be3('0x9')](function(_0x5aa2f1){logger[_0x6be3('0xa')](_0x6be3('0xb'),_0xbd6e9e,_0x6be3('0xc'));logger[_0x6be3('0xd')](_0x6be3('0xe'),_0xbd6e9e,_0x6be3('0xc'),JSON[_0x6be3('0xf')](_0x5aa2f1));if(_0x5aa2f1[_0x6be3('0x10')]){if(_0x5aa2f1[_0x6be3('0x10')][_0x6be3('0x11')]===0x1f4){logger[_0x6be3('0x10')](_0x6be3('0xb'),_0xbd6e9e,_0x5aa2f1[_0x6be3('0x10')][_0x6be3('0x12')]);return _0x3ade76(_0x5aa2f1[_0x6be3('0x10')][_0x6be3('0x12')]);}logger[_0x6be3('0x10')](_0x6be3('0xb'),_0xbd6e9e,_0x5aa2f1[_0x6be3('0x10')][_0x6be3('0x12')]);return _0x4c8cc3(_0x5aa2f1[_0x6be3('0x10')][_0x6be3('0x12')]);}else{logger['info'](_0x6be3('0xb'),_0xbd6e9e,_0x6be3('0xc'));_0x4c8cc3(_0x5aa2f1[_0x6be3('0x13')]['message']);}})[_0x6be3('0x14')](function(_0x32e450){logger[_0x6be3('0x10')](_0x6be3('0xb'),_0xbd6e9e,_0x32e450);_0x3ade76(_0x32e450);});});} \ No newline at end of file +var _0x132e=['UserOpenchannelQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x54393b,_0xf56708){var _0x1d521f=function(_0x35b849){while(--_0x35b849){_0x54393b['push'](_0x54393b['shift']());}};_0x1d521f(++_0xf56708);}(_0x132e,0x1b3));var _0xe132=function(_0xe7d07d,_0x52e4e3){_0xe7d07d=_0xe7d07d-0x0;var _0x229e46=_0x132e[_0xe7d07d];return _0x229e46;};'use strict';var _=require(_0xe132('0x0'));var util=require(_0xe132('0x1'));var moment=require(_0xe132('0x2'));var BPromise=require(_0xe132('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe132('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe132('0x5'));var logger=require(_0xe132('0x6'))(_0xe132('0x7'));var config=require(_0xe132('0x8'));var jayson=require(_0xe132('0x9'));var client=jayson[_0xe132('0xa')][_0xe132('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x505a4f,_0x5536d6,_0x25e9fa){return new BPromise(function(_0x409d50,_0x591545){return client[_0xe132('0xc')](_0x505a4f,_0x25e9fa)[_0xe132('0xd')](function(_0x22988d){logger[_0xe132('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5536d6,_0xe132('0xf'));logger['debug'](_0xe132('0x10'),_0x5536d6,_0xe132('0xf'),JSON[_0xe132('0x11')](_0x22988d));if(_0x22988d[_0xe132('0x12')]){if(_0x22988d['error'][_0xe132('0x13')]===0x1f4){logger[_0xe132('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5536d6,_0x22988d[_0xe132('0x12')]['message']);return _0x591545(_0x22988d[_0xe132('0x12')][_0xe132('0x14')]);}logger[_0xe132('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5536d6,_0x22988d[_0xe132('0x12')][_0xe132('0x14')]);return _0x409d50(_0x22988d[_0xe132('0x12')]['message']);}else{logger[_0xe132('0xe')](_0xe132('0x15'),_0x5536d6,'request\x20sent');_0x409d50(_0x22988d[_0xe132('0x16')][_0xe132('0x14')]);}})[_0xe132('0x17')](function(_0x1eaaba){logger[_0xe132('0x12')](_0xe132('0x15'),_0x5536d6,_0x1eaaba);_0x591545(_0x1eaaba);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 895d2db..996fa20 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 _0x7fbc=['create','/:id/clone','clone','addSections','put','update','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post'];(function(_0x2aca66,_0x2cf8d6){var _0x569919=function(_0x26bb24){while(--_0x26bb24){_0x2aca66['push'](_0x2aca66['shift']());}};_0x569919(++_0x2cf8d6);}(_0x7fbc,0x18b));var _0xc7fb=function(_0x15aa78,_0x3125e8){_0x15aa78=_0x15aa78-0x0;var _0x413ef1=_0x7fbc[_0x15aa78];return _0x413ef1;};'use strict';var multer=require('multer');var util=require(_0xc7fb('0x0'));var path=require(_0xc7fb('0x1'));var timeout=require(_0xc7fb('0x2'));var express=require(_0xc7fb('0x3'));var router=express[_0xc7fb('0x4')]();var auth=require(_0xc7fb('0x5'));var interaction=require(_0xc7fb('0x6'));var config=require(_0xc7fb('0x7'));var controller=require(_0xc7fb('0x8'));router[_0xc7fb('0x9')]('/',auth[_0xc7fb('0xa')](),controller[_0xc7fb('0xb')]);router['get'](_0xc7fb('0xc'),auth['isAuthenticated'](),controller[_0xc7fb('0xd')]);router[_0xc7fb('0x9')](_0xc7fb('0xe'),auth['isAuthenticated'](),controller[_0xc7fb('0xf')]);router[_0xc7fb('0x9')](_0xc7fb('0x10'),auth[_0xc7fb('0xa')](),controller[_0xc7fb('0x11')]);router[_0xc7fb('0x9')](_0xc7fb('0x12'),auth[_0xc7fb('0xa')](),controller[_0xc7fb('0x13')]);router[_0xc7fb('0x14')]('/',auth[_0xc7fb('0xa')](),controller[_0xc7fb('0x15')]);router[_0xc7fb('0x14')](_0xc7fb('0x16'),auth[_0xc7fb('0xa')](),controller[_0xc7fb('0x17')]);router[_0xc7fb('0x14')](_0xc7fb('0x10'),auth[_0xc7fb('0xa')](),controller[_0xc7fb('0x18')]);router[_0xc7fb('0x14')](_0xc7fb('0x12'),auth['isAuthenticated'](),controller['addResources']);router[_0xc7fb('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xc7fb('0x1a')]);router[_0xc7fb('0x1b')]('/:id',auth[_0xc7fb('0xa')](),controller[_0xc7fb('0x1c')]);router[_0xc7fb('0x1b')]('/:id/sections',auth['isAuthenticated'](),controller[_0xc7fb('0x1d')]);router[_0xc7fb('0x1b')]('/:id/resources',auth[_0xc7fb('0xa')](),controller[_0xc7fb('0x1e')]);module[_0xc7fb('0x1f')]=router; \ No newline at end of file +var _0xd5c4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','addResources','delete','destroy','removeSections','exports','util','connect-timeout','express'];(function(_0x2a2612,_0x43d9ff){var _0x637b62=function(_0x454059){while(--_0x454059){_0x2a2612['push'](_0x2a2612['shift']());}};_0x637b62(++_0x43d9ff);}(_0xd5c4,0x19d));var _0x4d5c=function(_0x2af74d,_0x57ef53){_0x2af74d=_0x2af74d-0x0;var _0x456972=_0xd5c4[_0x2af74d];return _0x456972;};'use strict';var multer=require('multer');var util=require(_0x4d5c('0x0'));var path=require('path');var timeout=require(_0x4d5c('0x1'));var express=require(_0x4d5c('0x2'));var router=express['Router']();var auth=require(_0x4d5c('0x3'));var interaction=require(_0x4d5c('0x4'));var config=require(_0x4d5c('0x5'));var controller=require(_0x4d5c('0x6'));router[_0x4d5c('0x7')]('/',auth[_0x4d5c('0x8')](),controller[_0x4d5c('0x9')]);router['get'](_0x4d5c('0xa'),auth[_0x4d5c('0x8')](),controller[_0x4d5c('0xb')]);router['get'](_0x4d5c('0xc'),auth[_0x4d5c('0x8')](),controller[_0x4d5c('0xd')]);router[_0x4d5c('0x7')](_0x4d5c('0xe'),auth['isAuthenticated'](),controller[_0x4d5c('0xf')]);router[_0x4d5c('0x7')](_0x4d5c('0x10'),auth[_0x4d5c('0x8')](),controller[_0x4d5c('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4d5c('0x12')]);router[_0x4d5c('0x13')](_0x4d5c('0x14'),auth[_0x4d5c('0x8')](),controller['clone']);router[_0x4d5c('0x13')]('/:id/sections',auth[_0x4d5c('0x8')](),controller['addSections']);router[_0x4d5c('0x13')]('/:id/resources',auth[_0x4d5c('0x8')](),controller[_0x4d5c('0x15')]);router['put'](_0x4d5c('0xc'),auth[_0x4d5c('0x8')](),controller['update']);router[_0x4d5c('0x16')](_0x4d5c('0xc'),auth['isAuthenticated'](),controller[_0x4d5c('0x17')]);router['delete'](_0x4d5c('0xe'),auth[_0x4d5c('0x8')](),controller[_0x4d5c('0x18')]);router[_0x4d5c('0x16')](_0x4d5c('0x10'),auth['isAuthenticated'](),controller['removeResources']);module[_0x4d5c('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 8bbeccf..09ee25e 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 _0x3e74=['split','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x192aa7,_0x160e97){var _0x2bfe6e=function(_0x3f6093){while(--_0x3f6093){_0x192aa7['push'](_0x192aa7['shift']());}};_0x2bfe6e(++_0x160e97);}(_0x3e74,0x1e4));var _0x43e7=function(_0x830266,_0xc78807){_0x830266=_0x830266-0x0;var _0x477d32=_0x3e74[_0x830266];return _0x477d32;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x43e7('0x0')],'allowNull':![],'unique':_0x43e7('0x1')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1aa252){this[_0x43e7('0x2')](_0x43e7('0x3'),_0x1aa252?_0x1aa252[_0x43e7('0x4')](''):[]);},'get':function(){return this[_0x43e7('0x5')](_0x43e7('0x3'))?this[_0x43e7('0x5')](_0x43e7('0x3'))[_0x43e7('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xb251=['join','getDataValue','sequelize','exports','name','STRING','setDataValue','crudPermissions'];(function(_0x3df899,_0x550bed){var _0x4ef4c0=function(_0x4e27f3){while(--_0x4e27f3){_0x3df899['push'](_0x3df899['shift']());}};_0x4ef4c0(++_0x550bed);}(_0xb251,0x15a));var _0x1b25=function(_0xdbbd16,_0x1e9f6f){_0xdbbd16=_0xdbbd16-0x0;var _0x16b880=_0xb251[_0xdbbd16];return _0x16b880;};'use strict';var Sequelize=require(_0x1b25('0x0'));module[_0x1b25('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1b25('0x2')},'crudPermissions':{'type':Sequelize[_0x1b25('0x3')],'set':function(_0xc6ef9d){this[_0x1b25('0x4')](_0x1b25('0x5'),_0xc6ef9d?_0xc6ef9d[_0x1b25('0x6')](''):[]);},'get':function(){return this[_0x1b25('0x7')](_0x1b25('0x5'))?this[_0x1b25('0x7')](_0x1b25('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x1b25('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 0725a65..c1ae574 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 _0x70c2=['model','map','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','VIRTUAL','merge','includeAll','findAll','rows','show','params','include','catch','create','body','clone','length','options','find','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','undefined','Invalid\x20section\x20\x27','parentSections','all','ignore','union','hasOwnProperty','pick','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','CmContact','Tag','Tags','color','tag','ThroughTags','value','squareprojects','SquareProject','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','companies','globalcustomfields','chatqueues','ChatQueue','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','User','agent','Telephones','membername','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','Users','admin','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','customdashboards','intervals','Interval','Pause','scheduler','sounds','tags','templates','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Reports','AnalyticMetric','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','jsforce','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','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','index','UserProfile','rawAttributes','fieldName','type','key'];(function(_0x3d0144,_0x38639f){var _0x33527e=function(_0x4086c5){while(--_0x4086c5){_0x3d0144['push'](_0x3d0144['shift']());}};_0x33527e(++_0x38639f);}(_0x70c2,0xb8));var _0x270c=function(_0x45b9bc,_0x447c93){_0x45b9bc=_0x45b9bc-0x0;var _0x354665=_0x70c2[_0x45b9bc];return _0x354665;};'use strict';var pdf=require(_0x270c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x270c('0x1'));var jsonpatch=require(_0x270c('0x2'));var rp=require(_0x270c('0x3'));var moment=require(_0x270c('0x4'));var BPromise=require(_0x270c('0x5'));var Mustache=require('mustache');var util=require(_0x270c('0x6'));var path=require(_0x270c('0x7'));var sox=require(_0x270c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x270c('0x9'));var squel=require(_0x270c('0xa'));var crypto=require('crypto');var jsforce=require(_0x270c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x270c('0xc'));var querystring=require(_0x270c('0xd'));var Papa=require(_0x270c('0xe'));var Redis=require(_0x270c('0xf'));var authService=require(_0x270c('0x10'));var qs=require(_0x270c('0x11'));var as=require(_0x270c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x270c('0x13'))(_0x270c('0x14'));var utils=require(_0x270c('0x15'));var config=require(_0x270c('0x16'));var licenseUtil=require(_0x270c('0x17'));var db=require(_0x270c('0x18'))['db'];config[_0x270c('0x19')]=_[_0x270c('0x1a')](config[_0x270c('0x19')],{'host':_0x270c('0x1b'),'port':0x18eb});var socket=require(_0x270c('0x1c'))(new Redis(config[_0x270c('0x19')]));require('./userProfile.socket')[_0x270c('0x1d')](socket);function respondWithStatusCode(_0x534b4e,_0x17865a){_0x17865a=_0x17865a||0xcc;return function(_0x217c55){if(_0x217c55){return _0x534b4e[_0x270c('0x1e')](_0x17865a);}return _0x534b4e[_0x270c('0x1f')](_0x17865a)[_0x270c('0x20')]();};}function respondWithResult(_0x1ffb6c,_0x3ab2a3){_0x3ab2a3=_0x3ab2a3||0xc8;return function(_0x316c7b){if(_0x316c7b){return _0x1ffb6c[_0x270c('0x1f')](_0x3ab2a3)[_0x270c('0x21')](_0x316c7b);}};}function respondWithFilteredResult(_0x38bb4b,_0x5876d2){return function(_0x219fe1){if(_0x219fe1){var _0x47386b=_0x219fe1[_0x270c('0x22')],_0x3d0d0a=_0x5876d2[_0x270c('0x23')],_0x3c1e64=_0x5876d2[_0x270c('0x23')]+_0x5876d2[_0x270c('0x24')],_0x2e2688;if(_0x3c1e64>=_0x47386b){_0x3c1e64=_0x47386b;_0x2e2688=0xc8;}else{_0x2e2688=0xce;}_0x38bb4b[_0x270c('0x1f')](_0x2e2688);return _0x38bb4b[_0x270c('0x25')](_0x270c('0x26'),_0x3d0d0a+'-'+_0x3c1e64+'/'+_0x47386b)['json'](_0x219fe1);}return null;};}function patchUpdates(_0x3673f4){return function(_0x387296){try{jsonpatch[_0x270c('0x27')](_0x387296,_0x3673f4,!![]);}catch(_0x1c295f){return BPromise[_0x270c('0x28')](_0x1c295f);}return _0x387296[_0x270c('0x29')]();};}function saveUpdates(_0x3e1f00,_0x169c34){return function(_0x277c94){if(_0x277c94){return _0x277c94['update'](_0x3e1f00)[_0x270c('0x2a')](function(_0x325b45){return _0x325b45;});}return null;};}function removeEntity(_0x3e6418,_0x4366d1){return function(_0x4f948c){if(_0x4f948c){return _0x4f948c[_0x270c('0x2b')]()[_0x270c('0x2a')](function(){_0x3e6418[_0x270c('0x1f')](0xcc)[_0x270c('0x20')]();});}};}function handleEntityNotFound(_0x3a20ab,_0x59dc95){return function(_0x3030dd){if(!_0x3030dd){_0x3a20ab[_0x270c('0x1e')](0x194);}return _0x3030dd;};}function handleError(_0x2a6534,_0x12821b){_0x12821b=_0x12821b||0x1f4;return function(_0x5f3fff){logger[_0x270c('0x2c')](_0x5f3fff['stack']);if(_0x5f3fff['name']){delete _0x5f3fff[_0x270c('0x2d')];}_0x2a6534[_0x270c('0x1f')](_0x12821b)['send'](_0x5f3fff);};}exports[_0x270c('0x2e')]=function(_0x1ccddb,_0x383410){var _0x3e1d04={},_0xe4547e={},_0x21023b={'count':0x0,'rows':[]};var _0x1d1375=_['map'](db[_0x270c('0x2f')][_0x270c('0x30')],function(_0x247433){return{'name':_0x247433[_0x270c('0x31')],'type':_0x247433[_0x270c('0x32')][_0x270c('0x33')]};});_0xe4547e[_0x270c('0x34')]=_[_0x270c('0x35')](_0x1d1375,_0x270c('0x2d'));_0xe4547e['query']=_[_0x270c('0x36')](_0x1ccddb[_0x270c('0x37')]);_0xe4547e[_0x270c('0x38')]=_[_0x270c('0x39')](_0xe4547e[_0x270c('0x34')],_0xe4547e[_0x270c('0x37')]);_0x3e1d04[_0x270c('0x3a')]=_['intersection'](_0xe4547e[_0x270c('0x34')],qs[_0x270c('0x3b')](_0x1ccddb['query'][_0x270c('0x3b')]));_0x3e1d04[_0x270c('0x3a')]=_0x3e1d04['attributes']['length']?_0x3e1d04[_0x270c('0x3a')]:_0xe4547e[_0x270c('0x34')];if(!_0x1ccddb[_0x270c('0x37')]['hasOwnProperty'](_0x270c('0x3c'))){_0x3e1d04[_0x270c('0x24')]=qs[_0x270c('0x24')](_0x1ccddb[_0x270c('0x37')]['limit']);_0x3e1d04[_0x270c('0x23')]=qs[_0x270c('0x23')](_0x1ccddb['query'][_0x270c('0x23')]);}_0x3e1d04[_0x270c('0x3d')]=qs[_0x270c('0x3e')](_0x1ccddb[_0x270c('0x37')][_0x270c('0x3e')]);_0x3e1d04['where']=qs['filters'](_['pick'](_0x1ccddb[_0x270c('0x37')],_0xe4547e['filters']),_0x1d1375);if(_0x1ccddb['query'][_0x270c('0x3f')]){_0x3e1d04['where']=_['merge'](_0x3e1d04[_0x270c('0x40')],{'$or':_[_0x270c('0x35')](_0x1d1375,function(_0x4b0357){if(_0x4b0357[_0x270c('0x32')]!==_0x270c('0x41')){var _0x45680c={};_0x45680c[_0x4b0357[_0x270c('0x2d')]]={'$like':'%'+_0x1ccddb[_0x270c('0x37')]['filter']+'%'};return _0x45680c;}})});}_0x3e1d04=_[_0x270c('0x42')]({},_0x3e1d04,_0x1ccddb['options']);var _0x370631={'where':_0x3e1d04[_0x270c('0x40')]};return db[_0x270c('0x2f')][_0x270c('0x22')](_0x370631)[_0x270c('0x2a')](function(_0x48ad28){_0x21023b['count']=_0x48ad28;if(_0x1ccddb['query'][_0x270c('0x43')]){_0x3e1d04['include']=[{'all':!![]}];}return db[_0x270c('0x2f')][_0x270c('0x44')](_0x3e1d04);})['then'](function(_0x293734){_0x21023b[_0x270c('0x45')]=_0x293734;return _0x21023b;})[_0x270c('0x2a')](respondWithFilteredResult(_0x383410,_0x3e1d04))['catch'](handleError(_0x383410,null));};exports[_0x270c('0x46')]=function(_0x556e97,_0xb0df6e){var _0xb2fb15={'raw':![],'where':{'id':_0x556e97[_0x270c('0x47')]['id']}},_0x11793f={};_0x11793f['model']=_[_0x270c('0x36')](db[_0x270c('0x2f')][_0x270c('0x30')]);_0x11793f[_0x270c('0x37')]=_[_0x270c('0x36')](_0x556e97['query']);_0x11793f['filters']=_[_0x270c('0x39')](_0x11793f[_0x270c('0x34')],_0x11793f[_0x270c('0x37')]);_0xb2fb15[_0x270c('0x3a')]=_[_0x270c('0x39')](_0x11793f[_0x270c('0x34')],qs['fields'](_0x556e97[_0x270c('0x37')][_0x270c('0x3b')]));_0xb2fb15['attributes']=_0xb2fb15['attributes']['length']?_0xb2fb15['attributes']:_0x11793f['model'];if(_0x556e97[_0x270c('0x37')][_0x270c('0x43')]){_0xb2fb15[_0x270c('0x48')]=[{'all':!![]}];}_0xb2fb15=_[_0x270c('0x42')]({},_0xb2fb15,_0x556e97['options']);return db[_0x270c('0x2f')]['find'](_0xb2fb15)[_0x270c('0x2a')](handleEntityNotFound(_0xb0df6e,null))[_0x270c('0x2a')](respondWithResult(_0xb0df6e,null))[_0x270c('0x49')](handleError(_0xb0df6e,null));};exports[_0x270c('0x4a')]=function(_0x4b0553,_0x16d662){return db['UserProfile']['create'](_0x4b0553[_0x270c('0x4b')],{})[_0x270c('0x2a')](respondWithResult(_0x16d662,0xc9))[_0x270c('0x49')](handleError(_0x16d662,null));};exports[_0x270c('0x4c')]=function(_0x5bdc07,_0x305ea4){var _0x19da5f={'where':{'id':_0x5bdc07[_0x270c('0x47')]['id']}},_0x215212={};_0x215212[_0x270c('0x34')]=_[_0x270c('0x36')](db[_0x270c('0x2f')][_0x270c('0x30')]);_0x19da5f[_0x270c('0x3a')]=_['intersection'](_0x215212[_0x270c('0x34')],qs[_0x270c('0x3b')](_0x5bdc07[_0x270c('0x37')][_0x270c('0x3b')]));_0x19da5f['attributes']=_0x19da5f[_0x270c('0x3a')][_0x270c('0x4d')]?_0x19da5f[_0x270c('0x3a')]:_0x215212[_0x270c('0x34')];if(_0x5bdc07['query'][_0x270c('0x43')]){_0x19da5f['include']=[{'all':!![]}];}_0x19da5f=_['merge']({},_0x19da5f,_0x5bdc07[_0x270c('0x4e')]);return db[_0x270c('0x2f')][_0x270c('0x4f')](_0x19da5f)[_0x270c('0x2a')](handleEntityNotFound(_0x305ea4,null))[_0x270c('0x2a')](function(_0x2a48e2){if(_0x2a48e2){var _0x4b97ce=_0x2a48e2['get']({'plain':!![]});_0x4b97ce=qs['omit'](_0x4b97ce,['id',_0x270c('0x50'),_0x270c('0x51'),_0x270c('0x52')]);_0x5bdc07[_0x270c('0x4b')]=_[_0x270c('0x53')](_0x5bdc07[_0x270c('0x4b')],['id',_0x270c('0x50'),'updatedAt']);return db[_0x270c('0x54')][_0x270c('0x55')](function(_0x38d06d){return db['UserProfile'][_0x270c('0x4a')](_[_0x270c('0x42')](_0x4b97ce,_0x5bdc07['body']),{'include':_0x5bdc07['query'][_0x270c('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x38d06d})[_0x270c('0x2a')](function(_0x115b3c){var _0x43a871=_0x115b3c[_0x270c('0x56')]({'plain':!![]});return db[_0x270c('0x57')][_0x270c('0x44')]({'where':{'userProfileId':_0x5bdc07['params']['id']},'raw':!![]})['then'](function(_0xc7455c){if(_0xc7455c){return BPromise[_0x270c('0x58')](_0xc7455c,function(_0x968435){return new BPromise(function(_0xfad987,_0x1a2f1d){if(_0x968435['autoAssociation']===null||_0x968435[_0x270c('0x59')]===0x1)_0xfad987(null);return db[_0x270c('0x5a')][_0x270c('0x44')]({'where':{'sectionId':_0x968435['id']},'raw':!![]})[_0x270c('0x2a')](function(_0x24ddb3){var _0xdc3c70=_['map'](_0x24ddb3,function(_0x4f6444){return qs[_0x270c('0x53')](_0x4f6444,['id',_0x270c('0x50'),_0x270c('0x51'),_0x270c('0x5b')]);});_0xfad987(_0xdc3c70);})[_0x270c('0x49')](function(_0x2d8e0f){_0x1a2f1d(_0x2d8e0f);});})['then'](function(_0x33eb51){var _0x256690=qs['omit'](_0x968435,['id',_0x270c('0x50'),_0x270c('0x51')]);_0x256690[_0x270c('0x5c')]=_0x43a871['id'];if(_0x33eb51)_0x256690[_0x270c('0x5d')]=_0x33eb51;return _0x256690;})[_0x270c('0x2a')](function(_0x55186d){return db[_0x270c('0x57')]['create'](_0x55186d,{'include':[{'model':db[_0x270c('0x5a')],'as':_0x270c('0x5d')}],'raw':!![],'transaction':_0x38d06d});});})[_0x270c('0x2a')](function(){return _0x43a871;});}});});});}})['then'](respondWithResult(_0x305ea4,0xc9))['catch'](handleError(_0x305ea4,null));};exports[_0x270c('0x5e')]=function(_0x212cc2,_0xac93b5){if(_0x212cc2[_0x270c('0x4b')]['id']){delete _0x212cc2[_0x270c('0x4b')]['id'];}return db[_0x270c('0x2f')]['find']({'where':{'id':_0x212cc2[_0x270c('0x47')]['id']}})['then'](handleEntityNotFound(_0xac93b5,null))[_0x270c('0x2a')](saveUpdates(_0x212cc2[_0x270c('0x4b')],null))[_0x270c('0x2a')](respondWithResult(_0xac93b5,null))[_0x270c('0x49')](handleError(_0xac93b5,null));};exports[_0x270c('0x2b')]=function(_0x1e9bd2,_0x5cefec){return db[_0x270c('0x2f')][_0x270c('0x4f')]({'where':{'id':_0x1e9bd2[_0x270c('0x47')]['id']}})['then'](handleEntityNotFound(_0x5cefec,null))['then'](removeEntity(_0x5cefec,null))[_0x270c('0x49')](handleError(_0x5cefec,null));};exports[_0x270c('0x5f')]=function(_0x35e750,_0x59e037){return db[_0x270c('0x2f')][_0x270c('0x5f')]()[_0x270c('0x2a')](respondWithResult(_0x59e037,null))['catch'](handleError(_0x59e037,null));};exports['addSections']=function(_0x17167a,_0x38b715){var _0x5db546=_0x17167a[_0x270c('0x4b')];return db['UserProfile']['find']({'where':{'id':_0x17167a[_0x270c('0x47')]['id']}})[_0x270c('0x2a')](handleEntityNotFound(_0x38b715,null))[_0x270c('0x2a')](function(_0x3429a9){if(_0x3429a9){return db[_0x270c('0x54')][_0x270c('0x55')](function(_0x41012b){return db[_0x270c('0x57')][_0x270c('0x2b')]({'where':{'userProfileId':_0x17167a['params']['id'],'sectionId':_[_0x270c('0x35')](_0x5db546,function(_0x3488b5){return _0x3488b5[_0x270c('0x5b')];})},'transaction':_0x41012b})[_0x270c('0x2a')](function(){var _0x42642d=_[_0x270c('0x35')](_0x5db546,function(_0x4b33dc){_0x4b33dc[_0x270c('0x5c')]=_0x17167a[_0x270c('0x47')]['id'];return _0x4b33dc;});var _0x536064=[];return BPromise['each'](_0x42642d,function(_0x1652b5){return db[_0x270c('0x57')][_0x270c('0x4a')](_0x1652b5,{'include':[{'model':db[_0x270c('0x5a')],'as':_0x270c('0x5d')}],'raw':!![],'transaction':_0x41012b})[_0x270c('0x2a')](function(_0x2f6fab){_0x536064[_0x270c('0x60')](_0x2f6fab[_0x270c('0x56')]({'plain':!![]}));});})[_0x270c('0x2a')](function(){return _0x536064;});});});}})[_0x270c('0x2a')](function(_0xa7e44f){return _0xa7e44f;})[_0x270c('0x2a')](respondWithResult(_0x38b715,null))[_0x270c('0x49')](handleError(_0x38b715,null));};exports[_0x270c('0x61')]=function(_0x4c78d3,_0x1abbad){var _0x35d37f;return db[_0x270c('0x2f')][_0x270c('0x4f')]({'where':{'id':_0x4c78d3[_0x270c('0x47')]['id']},'attributes':['id','name']})[_0x270c('0x2a')](handleEntityNotFound(_0x1abbad,null))['then'](function(_0x6936cf){if(_0x6936cf){_0x35d37f=_0x6936cf;return db[_0x270c('0x57')][_0x270c('0x2b')]({'where':{'userProfileId':_0x4c78d3[_0x270c('0x47')]['id'],'sectionId':_0x4c78d3[_0x270c('0x37')][_0x270c('0x62')]}});}})[_0x270c('0x2a')](function(){return _0x35d37f;})['then'](respondWithStatusCode(_0x1abbad,null))['catch'](handleError(_0x1abbad,null));};exports[_0x270c('0x63')]=function(_0xb7dd80,_0xd18b2e){var _0xfda686=[];var _0x172f36=[];return db[_0x270c('0x57')]['findAll']({'where':{'userProfileId':_0xb7dd80[_0x270c('0x47')]['id']},'raw':!![]})['then'](function(_0x1a8394){_0xfda686=_[_0x270c('0x3f')](_0x1a8394,function(_0x4fc231){return _0x4fc231[_0x270c('0x64')]===0x1||_[_0x270c('0x65')]([0x3eb,0x709],_0x4fc231[_0x270c('0x5b')]);});if(!_[_0x270c('0x66')](_0xfda686)){return _[_0x270c('0x35')](_0xfda686,function(_0x1d2c8d){return _0x1d2c8d[_0x270c('0x5b')];});}else{return;}})[_0x270c('0x2a')](function(_0x31912f){if(_0x31912f)_0x172f36=_0x31912f;if(_[_0x270c('0x65')](_0x172f36,0x64)){var _0x100b77=_[_0x270c('0x4f')](_0xfda686,{'sectionId':0x64});return hasDefaultDashboard(_0x100b77)['then'](function(_0x222776){return _[_0x270c('0x35')](_0xfda686,function(_0x29627c){if(_0x29627c[_0x270c('0x5b')]===0x64){_0x29627c[_0x270c('0x67')]=_0x222776;}return _0x29627c;});});}else{return;}})[_0x270c('0x2a')](function(_0x2b1dcf){if(_0x2b1dcf)_0xfda686=_0x2b1dcf;if(_[_0x270c('0x65')](_0x172f36,0x3eb)){var _0x10ce2d=_['find'](_0xfda686,{'sectionId':0x3eb});return getCustomDashboards(_0x10ce2d)[_0x270c('0x2a')](function(_0x564462){return _[_0x270c('0x35')](_0xfda686,function(_0x4c60ec){if(_0x10ce2d['enabled']){if(_0x4c60ec['sectionId']===0x3eb){_0x4c60ec[_0x270c('0x67')]=_0x564462;}}else{if(_0x4c60ec[_0x270c('0x5b')]===0x64){_0x4c60ec[_0x270c('0x67')]=_0x564462;}}return _0x4c60ec;});});}else{return;}})['then'](function(_0x263c13){if(_0x263c13)_0xfda686=_0x263c13;if(_[_0x270c('0x65')](_0x172f36,0x709)){var _0x5df1b6=_[_0x270c('0x4f')](_0xfda686,{'sectionId':0x709});return getPlugins(_0x5df1b6)[_0x270c('0x2a')](function(_0x27caf2){if(_0x5df1b6[_0x270c('0x64')]){return _[_0x270c('0x35')](_0xfda686,function(_0x1d66b1){if(_0x1d66b1[_0x270c('0x5b')]===0x709){_0x1d66b1['subsections']=_0x27caf2;}return _0x1d66b1;});}else{var _0x4dc8f0={'sectionId':0x76c,'enabled':0x1,'subsections':_0x27caf2};var _0x599f11=_[_0x270c('0x35')](_0xfda686);_0x599f11[_0x270c('0x60')](_0x4dc8f0);return _0x599f11;}});}else{return;}})[_0x270c('0x2a')](function(_0x45ff12){if(_0x45ff12)_0xfda686=_0x45ff12;return _['filter'](_0xfda686,[_0x270c('0x64'),0x1]);})[_0x270c('0x2a')](respondWithResult(_0xd18b2e,null))[_0x270c('0x49')](handleError(_0xd18b2e,null));};function hasDefaultDashboard(_0x4ee91c){var _0x5ef0fa=[0x65];return new BPromise(function(_0x297134,_0x23cbce){try{if(_0x4ee91c['autoAssociation']){_0x297134(_0x5ef0fa);}else{return db[_0x270c('0x5a')][_0x270c('0x68')]({'where':{'sectionId':_0x4ee91c['id']},'raw':!![]})['then'](function(_0x54da50){_0x54da50?_0x297134(_0x5ef0fa):_0x297134();});}}catch(_0x367aad){_0x23cbce(_0x367aad);}});}function getCustomDashboards(_0x1c0587){var _0x367258=[];return new BPromise(function(_0x456733,_0x5693a7){try{if(_0x1c0587[_0x270c('0x59')]){return db[_0x270c('0x69')]['findAll']({'raw':!![]})['then'](function(_0x2b1b03){_0x2b1b03[_0x270c('0x6a')](function(_0x4707d3){_0x367258[_0x270c('0x60')](_0x4707d3['id']+0x1869f);});_0x456733(_0x367258);});}else{return db[_0x270c('0x5a')][_0x270c('0x44')]({'where':{'sectionId':_0x1c0587['id']},'raw':!![]})[_0x270c('0x2a')](function(_0x548b22){_0x548b22['forEach'](function(_0x2aa916){_0x367258[_0x270c('0x60')](_0x2aa916[_0x270c('0x6b')]+0x1869f);});_0x456733(_0x367258);});}}catch(_0x46d2f9){_0x5693a7(_0x46d2f9);}});}function getPlugins(_0x2a173d){var _0x59060b=[];return new BPromise(function(_0x1c10b7,_0x4e869a){try{if(_0x2a173d[_0x270c('0x59')]){return db[_0x270c('0x6c')][_0x270c('0x44')]({'raw':!![]})[_0x270c('0x2a')](function(_0x514e85){_0x514e85['forEach'](function(_0xb27f6b){_0x59060b[_0x270c('0x60')](_0xb27f6b['id']+0x15b38);});_0x1c10b7(_0x59060b);});}else{return db[_0x270c('0x5a')][_0x270c('0x44')]({'where':{'sectionId':_0x2a173d['id']},'raw':!![]})[_0x270c('0x2a')](function(_0x651cf6){_0x651cf6[_0x270c('0x6a')](function(_0x74fac9){_0x59060b['push'](_0x74fac9[_0x270c('0x6b')]+0x15b38);});_0x1c10b7(_0x59060b);});}}catch(_0x553177){_0x4e869a(_0x553177);}});}exports[_0x270c('0x6d')]=function(_0x4447ba,_0x43a8c5){return db[_0x270c('0x2f')]['find']({'where':{'id':_0x4447ba[_0x270c('0x47')]['id']}})[_0x270c('0x2a')](handleEntityNotFound(_0x43a8c5,null))[_0x270c('0x2a')](function(_0x23603c){if(_0x23603c){return db[_0x270c('0x54')]['transaction'](function(_0x45879c){return db[_0x270c('0x57')][_0x270c('0x44')]({'where':{'userProfileId':_0x4447ba[_0x270c('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0x270c('0x2a')](function(_0x33950d){if(_0x33950d){return db[_0x270c('0x57')][_0x270c('0x2b')]({'where':{'userProfileId':_0x4447ba[_0x270c('0x47')]['id'],'id':_['map'](_0x33950d,function(_0x4cbeb8){return _0x4cbeb8['id'];})},'transaction':_0x45879c});}})[_0x270c('0x2a')](function(_0x22a8ca){var _0x35b4d6=_['map'](_0x4447ba[_0x270c('0x4b')],function(_0x21a089){_0x21a089['userProfileId']=_0x4447ba[_0x270c('0x47')]['id'];return _0x21a089;});return db[_0x270c('0x57')][_0x270c('0x6e')](_0x35b4d6,{'raw':!![],'transaction':_0x45879c});})[_0x270c('0x2a')](function(_0x158ccc){var _0x549642=_['filter'](_[_0x270c('0x35')](_0x158ccc,function(_0x564015){return _0x564015[_0x270c('0x56')]({'plain':!![]});}),{'includeAll':![]});if(_0x549642){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x4447ba['params']['id'],'sectionId':_[_0x270c('0x35')](_0x549642,function(_0x23290f){return _0x23290f[_0x270c('0x5b')];})},'attributes':['id',_0x270c('0x5b')],'raw':!![]})['then'](function(_0x35b9cb){var _0x5069d5=_[_0x270c('0x35')](_0x4447ba[_0x270c('0x4b')],function(_0x4e060e){_0x4e060e['userProfileId']=_0x4447ba[_0x270c('0x47')]['id'];return _0x4e060e;});return db[_0x270c('0x5a')][_0x270c('0x6e')](_0x5069d5,{'raw':!![],'transaction':_0x45879c});});}})[_0x270c('0x49')](handleError(_0x43a8c5,null));});}})[_0x270c('0x2a')](function(_0x47427a){var _0x48ab11=_[_0x270c('0x35')](_0x47427a,function(_0x151d72){return _0x151d72['get']({'plain':!![]});});})[_0x270c('0x2a')](respondWithResult(_0x43a8c5,null))[_0x270c('0x49')](handleError(_0x43a8c5,null));};exports['removeResources']=function(_0x3c9f3e,_0x5d00a5,_0x4c943a){return db['UserProfile']['find']({'where':{'id':_0x3c9f3e[_0x270c('0x47')]['id']}})[_0x270c('0x2a')](handleEntityNotFound(_0x5d00a5,null))[_0x270c('0x2a')](function(_0x1ac56e){if(_0x1ac56e){return _0x1ac56e[_0x270c('0x6f')](_0x3c9f3e[_0x270c('0x37')][_0x270c('0x62')]);}})[_0x270c('0x2a')](respondWithStatusCode(_0x5d00a5,null))[_0x270c('0x49')](handleError(_0x5d00a5,null));};exports[_0x270c('0x70')]=function(_0x5ca179,_0x5e7d43){var _0x328997={'raw':![],'where':{}};var _0x3d42ed={};var _0x3ad4e1={'count':0x0,'rows':[]};var _0x3acea0=_0x5ca179[_0x270c('0x37')][_0x270c('0x71')];if(typeof _0x3acea0==='undefined'){throw new db[(_0x270c('0x72'))][(_0x270c('0x73'))](_0x270c('0x74'));}var _0x46c535=_0x5ca179[_0x270c('0x37')][_0x270c('0x75')]||![];var _0x467ba8=getQueryModels(_0x3acea0,_0x46c535);if(typeof _0x467ba8[_0x270c('0x76')]===_0x270c('0x77')){throw new db[(_0x270c('0x72'))][(_0x270c('0x73'))](_0x270c('0x78')+_0x3acea0+'\x27');}var _0x41ecae=[];if(!_[_0x270c('0x66')](_0x467ba8['parentSections'])){_0x41ecae=_0x467ba8[_0x270c('0x79')];}else{_0x41ecae=[{'name':_0x3acea0}];}return db[_0x270c('0x2f')][_0x270c('0x68')]({'where':{'id':_0x5ca179['params']['id']}})[_0x270c('0x2a')](handleEntityNotFound(_0x5e7d43,null))[_0x270c('0x2a')](function(_0xfa3041){if(_0xfa3041){var _0xbdb16=[];for(var _0x5d5cb0=0x0;_0x5d5cb0<_0x41ecae[_0x270c('0x4d')];_0x5d5cb0++){_0xbdb16[_0x270c('0x60')](db[_0x270c('0x57')][_0x270c('0x68')]({'where':{'userProfileId':_0xfa3041['id'],'name':_0x41ecae[_0x5d5cb0][_0x270c('0x2d')]},'raw':!![]}));}return BPromise[_0x270c('0x7a')](_0xbdb16);}})['then'](function(_0x1608c4){var _0x498386=_['filter'](_0x1608c4,function(_0x4bdd9b){return _0x4bdd9b?_0x4bdd9b:undefined;});var _0x3c932b=_[_0x270c('0x3f')](_0x41ecae,[_0x270c('0x7b'),!![]]);var _0x55750a=_['isEmpty'](_0x498386)&&_[_0x270c('0x66')](_0x3c932b)?null:_[_0x270c('0x7c')](_0x3c932b,_0x498386);if(_0x55750a){var _0x10fbaf=[];for(var _0x414fa8=0x0;_0x414fa8<_0x55750a[_0x270c('0x4d')];_0x414fa8++){var _0x1fe8e7=_[_0x270c('0x4f')](_0x41ecae,function(_0x384f22){return _0x55750a[_0x414fa8]?_0x384f22[_0x270c('0x2d')]===_0x55750a[_0x414fa8]['name']:null;});if(_0x1fe8e7){if(_0x55750a[_0x414fa8][_0x270c('0x7b')]){_0x10fbaf[_0x270c('0x60')](getAllResources(_0x467ba8[_0x270c('0x76')],_0x55750a[_0x414fa8]));}else{if(!_0x55750a[_0x414fa8]['autoAssociation']){_0x10fbaf[_0x270c('0x60')](getAllowedResources(_0x1fe8e7,_0x55750a[_0x414fa8],_0x467ba8[_0x270c('0x76')]));}else{if(_0x1fe8e7[_0x270c('0x34')]){_0x10fbaf[_0x270c('0x60')](getAllFilteredResources(_0x1fe8e7,_0x55750a[_0x414fa8]));}}}}}return BPromise['all'](_0x10fbaf);}else{return null;}})[_0x270c('0x2a')](function(_0x5179ad){var _0x58447e=_0x5179ad;var _0x13aecb=null;if(_0x58447e){_0x13aecb=_0x58447e[_0x270c('0x4d')]===0x1?_0x58447e[0x0]:null;}if(_0x13aecb||_0x58447e){var _0x51f4b3=db[_0x467ba8[_0x270c('0x76')]][_0x270c('0x30')];_0x3d42ed[_0x270c('0x34')]=_[_0x270c('0x36')](_0x51f4b3);_0x3d42ed[_0x270c('0x37')]=_[_0x270c('0x36')](_0x5ca179[_0x270c('0x37')]);_0x3d42ed[_0x270c('0x38')]=_[_0x270c('0x39')](_0x3d42ed[_0x270c('0x34')],_0x3d42ed[_0x270c('0x37')]);_0x328997[_0x270c('0x3a')]=_['intersection'](_0x3d42ed[_0x270c('0x34')],qs[_0x270c('0x3b')](_0x5ca179[_0x270c('0x37')][_0x270c('0x3b')]));_0x328997[_0x270c('0x3a')]=_0x328997['attributes'][_0x270c('0x4d')]?_0x328997[_0x270c('0x3a')]:_0x3d42ed[_0x270c('0x34')];if(!_0x5ca179['query'][_0x270c('0x7d')](_0x270c('0x3c'))){_0x328997['limit']=qs[_0x270c('0x24')](_0x5ca179[_0x270c('0x37')][_0x270c('0x24')]);_0x328997[_0x270c('0x23')]=qs[_0x270c('0x23')](_0x5ca179['query']['offset']);}_0x328997[_0x270c('0x3d')]=qs['sort'](_0x5ca179[_0x270c('0x37')]['sort']);_0x328997[_0x270c('0x40')]=qs[_0x270c('0x38')](_[_0x270c('0x7e')](_0x5ca179[_0x270c('0x37')],_0x3d42ed[_0x270c('0x38')]));if(_0x5ca179['query'][_0x270c('0x3f')]){_0x328997[_0x270c('0x40')]=_[_0x270c('0x42')](_0x328997[_0x270c('0x40')],{'$or':_[_0x270c('0x35')](_0x51f4b3,function(_0x4a1fc4){if(_0x4a1fc4[_0x270c('0x32')][_0x270c('0x33')]!=='VIRTUAL'){var _0x22763b={};_0x22763b[_0x4a1fc4[_0x270c('0x7f')]]={'$like':'%'+_0x5ca179[_0x270c('0x37')][_0x270c('0x3f')]+'%'};return _0x22763b;}})});}var _0xc73609=[];if(_0x13aecb){var _0x1c34f5=_['find'](_0x41ecae,[_0x270c('0x2d'),_0x13aecb[_0x270c('0x2d')]]);if(_0x1c34f5['field']){var _0x27361={};if(_0x467ba8[_0x270c('0x76')]===_0x270c('0x80')){_0x27361[_0x1c34f5[_0x270c('0x81')]]=_['map'](_0x13aecb[_0x270c('0x82')],'id');}else{_0x27361[_0x1c34f5[_0x270c('0x81')]]=_0x13aecb['associatedResources'];}_0xc73609[_0x270c('0x60')](_0x27361);}else{_0x328997[_0x270c('0x40')]['id']=_0x13aecb['associatedResources'];}}else{for(var _0x3bfa94=0x0;_0x3bfa94<_0x58447e['length'];_0x3bfa94++){var _0x1c34f5=_[_0x270c('0x4f')](_0x41ecae,['name',_0x58447e[_0x3bfa94]['name']]);if(_0x1c34f5[_0x270c('0x7f')]){var _0x27361={};_0x27361[_0x1c34f5[_0x270c('0x81')]]=_0x58447e[_0x3bfa94][_0x270c('0x82')];_0xc73609[_0x270c('0x60')](_0x27361);}else{if(!_0x328997[_0x270c('0x40')]['id'])_0x328997[_0x270c('0x40')]['id']=[];_0x58447e[_0x3bfa94][_0x270c('0x82')][_0x270c('0x6a')](function(_0x4753b9){_0x328997[_0x270c('0x40')]['id'][_0x270c('0x60')](_0x4753b9);});}}}if(!_[_0x270c('0x66')](_0xc73609)){_0x328997[_0x270c('0x40')]=_[_0x270c('0x42')](_0x328997[_0x270c('0x40')],{'$and':{'$or':_0xc73609}});}_0x328997=_[_0x270c('0x42')]({},_0x328997,_0x5ca179[_0x270c('0x4e')]);if(_0x13aecb&&!_0x13aecb['autoAssociation']&&_0x467ba8['childModel']==='AnalyticExtractedReport'){if(_0x5ca179['query'][_0x270c('0x43')]){_0x328997[_0x270c('0x48')]=[{'all':!![]}];}return db[_0x467ba8[_0x270c('0x76')]][_0x270c('0x44')](_0x328997)['then'](function(_0x471c60){var _0x5309b3=[];_0x471c60[_0x270c('0x6a')](function(_0xe5bc35){var _0x43bdc0;switch(_0xe5bc35[_0x270c('0x83')]){case _0x270c('0x84'):_0x43bdc0=_[_0x270c('0x4f')](_0x13aecb['associatedResources'],function(_0x576664){return _0x576664['id']===_0xe5bc35[_0x270c('0x85')]&&_0x576664[_0x270c('0x32')]===_0x270c('0x86');});break;case _0x270c('0x87'):_0x43bdc0=_[_0x270c('0x4f')](_0x13aecb[_0x270c('0x82')],function(_0x15e7e6){return _0x15e7e6['id']===_0xe5bc35[_0x270c('0x85')]&&_0x15e7e6[_0x270c('0x32')]==='CustomReports';});break;}if(_0x43bdc0)_0x5309b3[_0x270c('0x60')](_0xe5bc35);});_0x3ad4e1[_0x270c('0x22')]=_0x5309b3[_0x270c('0x4d')];_0x3ad4e1[_0x270c('0x45')]=_0x5309b3;return _0x3ad4e1;});}else{return db[_0x467ba8[_0x270c('0x76')]]['count']({'where':_0x328997[_0x270c('0x40')]})['then'](function(_0x35f5d4){_0x3ad4e1[_0x270c('0x22')]=_0x35f5d4;if(_0x5ca179[_0x270c('0x37')]['includeAll']){if(_0x467ba8['childModel']===_0x270c('0x88')){_0x328997[_0x270c('0x48')]=[{'model':db[_0x270c('0x89')],'as':_0x270c('0x8a'),'attributes':['id',_0x270c('0x2d'),_0x270c('0x8b')],'required':_0x5ca179[_0x270c('0x37')][_0x270c('0x8c')]?!![]:![]},{'model':db[_0x270c('0x89')],'as':_0x270c('0x8d'),'attributes':['id',_0x270c('0x2d'),'color'],'through':_0x5ca179[_0x270c('0x37')]['tag']?{'attributes':[],'where':{'TagId':_0x5ca179[_0x270c('0x37')]['tag']||undefined}}:{},'required':_0x5ca179[_0x270c('0x37')]['tag']?!![]:![]}];}else{_0x328997[_0x270c('0x48')]=[{'all':!![]}];}}return db[_0x467ba8[_0x270c('0x76')]][_0x270c('0x44')](_0x328997);})[_0x270c('0x2a')](function(_0x526332){_0x3ad4e1[_0x270c('0x45')]=_0x526332;return _0x3ad4e1;});}}else{return _0x3ad4e1;}})[_0x270c('0x2a')](respondWithFilteredResult(_0x5e7d43,_0x328997))[_0x270c('0x49')](handleError(_0x5e7d43,null));};function getAllResources(_0x19d824,_0x397961){return new BPromise(function(_0x3edbb2,_0x5d9718){if(_0x397961){var _0x3e693d=_0x397961['filter']?{[_0x397961[_0x270c('0x3f')][_0x270c('0x7f')]]:_0x397961[_0x270c('0x3f')]['value']}:undefined;return db[_0x19d824]['findAll']({'where':_0x3e693d,'raw':!![]})[_0x270c('0x2a')](function(_0x5bc1c2){_0x397961['associatedResources']=_[_0x270c('0x35')](_0x5bc1c2,'id');_0x3edbb2(_0x397961);})[_0x270c('0x49')](function(_0xfd84f0){_0x5d9718(_0xfd84f0);});}else{_0x3edbb2(null);}});}function getAllFilteredResources(_0x1fae64,_0x451985){return new BPromise(function(_0x1f0df0,_0x4791fe){var _0x39edae=_0x1fae64[_0x270c('0x3f')]?{[_0x1fae64['filter'][_0x270c('0x7f')]]:_0x1fae64['filter'][_0x270c('0x8e')]}:undefined;return db[_0x1fae64[_0x270c('0x34')]]['findAll']({'where':_0x39edae,'raw':!![]})['then'](function(_0x107080){_0x451985[_0x270c('0x82')]=_['map'](_0x107080,function(_0x3cb636){return _0x3cb636[_0x270c('0x2d')];});_0x1f0df0(_0x451985);})['catch'](function(_0x452d9b){_0x4791fe(_0x452d9b);});});}function getAllowedResources(_0x3753b7,_0x4bb734,_0x29f8f5){return new BPromise(function(_0x4a98fc,_0x13feec){if(_0x4bb734){return db[_0x270c('0x5a')][_0x270c('0x44')]({'where':{'sectionId':_0x4bb734['id']},'raw':!![]})[_0x270c('0x2a')](function(_0x54f918){if(_0x3753b7[_0x270c('0x7f')]&&_0x3753b7[_0x270c('0x7f')]!=='id'){_0x4bb734[_0x270c('0x82')]=_[_0x270c('0x35')](_0x54f918,function(_0x7622e8){return _0x7622e8[_0x3753b7[_0x270c('0x7f')]];});}else{if(_0x29f8f5===_0x270c('0x80')){_0x4bb734[_0x270c('0x82')]=_[_0x270c('0x35')](_0x54f918,function(_0xdbe896){return{'id':_0xdbe896[_0x270c('0x6b')],'type':_0xdbe896[_0x270c('0x32')]};});}else{_0x4bb734[_0x270c('0x82')]=_[_0x270c('0x35')](_0x54f918,function(_0x3e1fdc){return _0x3e1fdc[_0x270c('0x6b')];});}}_0x4a98fc(_0x4bb734);})['catch'](function(_0x53c9fc){_0x13feec(_0x53c9fc);});}else{_0x4a98fc(null);}});}function getQueryModels(_0x5da11e,_0x141809){var _0x1f3db1=_0x5da11e['toLowerCase']();var _0x3756d3={'childModel':undefined,'parentSections':[]};switch(_0x1f3db1){case _0x270c('0x8f'):_0x3756d3[_0x270c('0x76')]=_0x270c('0x90');break;case'odbc':_0x3756d3[_0x270c('0x76')]=_0x270c('0x91');break;case'squarerecordings':_0x3756d3[_0x270c('0x76')]=_0x270c('0x92');_0x3756d3[_0x270c('0x79')]=[{'name':_0x270c('0x93'),'field':'name','foreignKey':_0x270c('0x94')}];break;case _0x270c('0x95'):_0x3756d3[_0x270c('0x76')]=_0x270c('0x96');break;case _0x270c('0x97'):_0x3756d3[_0x270c('0x76')]='CmContact';_0x3756d3[_0x270c('0x79')]=[{'name':_0x270c('0x98'),'field':'id','foreignKey':_0x270c('0x99')}];break;case _0x270c('0x9a'):_0x3756d3[_0x270c('0x76')]='CmList';break;case _0x270c('0x9b'):_0x3756d3[_0x270c('0x76')]='CmCompany';break;case _0x270c('0x9c'):_0x3756d3['childModel']='CmCustomField';break;case _0x270c('0x9d'):_0x3756d3['childModel']=_0x270c('0x9e');break;case'chatwebsites':_0x3756d3[_0x270c('0x76')]='ChatWebsite';break;case _0x270c('0x9f'):_0x3756d3['childModel']=_0x270c('0xa0');break;case _0x270c('0xa1'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xa2');break;case _0x270c('0xa3'):case _0x270c('0xa4'):case _0x270c('0xa5'):_0x3756d3['childModel']='VoiceExtension';break;case _0x270c('0xa6'):_0x3756d3['childModel']=_0x270c('0xa7');break;case _0x270c('0xa8'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xa9');break;case _0x270c('0xaa'):_0x3756d3['childModel']='VoiceRecording';_0x3756d3[_0x270c('0x79')]=[{'name':'Agents','field':_0x270c('0x2d'),'foreignKey':'membername','model':_0x270c('0xab'),'filter':{'field':'role','value':[_0x270c('0xac')]}},{'name':_0x270c('0xad'),'field':'name','foreignKey':_0x270c('0xae'),'model':_0x270c('0xab'),'filter':{'field':_0x270c('0xaf'),'value':[_0x270c('0xb0')]}},{'name':_0x270c('0xb1'),'field':'name','foreignKey':_0x270c('0xb2'),'model':_0x270c('0xb3'),'filter':{'field':_0x270c('0x32'),'value':[_0x270c('0xb4')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x270c('0xb2'),'model':'VoiceQueue','filter':{'field':'type','value':['outbound']}}];break;case _0x270c('0xb5'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xb6');break;case'chanspies':_0x3756d3[_0x270c('0x76')]=_0x270c('0xb7');break;case _0x270c('0xb8'):_0x3756d3['childModel']=_0x270c('0xb9');break;case'ivrcampaigns':_0x3756d3[_0x270c('0x76')]=_0x270c('0xba');break;case _0x270c('0xbb'):_0x3756d3[_0x270c('0x76')]='MailQueue';break;case'mailaccounts':_0x3756d3[_0x270c('0x76')]=_0x270c('0xbc');break;case _0x270c('0xbd'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xbe');break;case'openchannelqueues':_0x3756d3['childModel']=_0x270c('0xbf');break;case'openchannelaccounts':_0x3756d3[_0x270c('0x76')]=_0x270c('0xc0');break;case _0x270c('0xc1'):_0x3756d3[_0x270c('0x76')]='SmsQueue';break;case _0x270c('0xc2'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xc3');break;case _0x270c('0xc4'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xc5');break;case _0x270c('0xc6'):_0x3756d3['childModel']=_0x270c('0xc7');break;case'teams':_0x3756d3[_0x270c('0x76')]=_0x270c('0xc8');break;case _0x270c('0xc9'):case _0x270c('0xca'):_0x3756d3['childModel']='VoiceQueue';if(_0x141809){_0x3756d3[_0x270c('0x79')]=[{'name':'VoiceQueues'},{'name':_0x270c('0xcb')}];}break;case _0x270c('0xcc'):case _0x270c('0xcd'):case _0x270c('0xce'):_0x3756d3['childModel']='User';if(_0x141809){_0x3756d3[_0x270c('0x79')]=[{'name':_0x270c('0xcf'),'filter':{'field':_0x270c('0xaf'),'value':[_0x270c('0xd0'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0x270c('0xad')}];}break;case _0x270c('0xd1'):_0x3756d3[_0x270c('0x76')]='ZendeskAccount';break;case'salesforceaccounts':_0x3756d3['childModel']=_0x270c('0xd2');break;case _0x270c('0xd3'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xd4');break;case'sugarcrmaccounts':_0x3756d3[_0x270c('0x76')]='SugarcrmAccount';break;case'deskaccounts':_0x3756d3[_0x270c('0x76')]=_0x270c('0xd5');break;case _0x270c('0xd6'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xd7');break;case _0x270c('0xd8'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xab');break;case _0x270c('0xd9'):_0x3756d3[_0x270c('0x76')]='CannedAnswer';break;case _0x270c('0xda'):_0x3756d3['childModel']='Disposition';break;case _0x270c('0xdb'):_0x3756d3['childModel']=_0x270c('0x69');break;case _0x270c('0xdc'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xdd');break;case'pauses':_0x3756d3['childModel']=_0x270c('0xde');break;case _0x270c('0xdf'):_0x3756d3[_0x270c('0x76')]='Schedule';break;case _0x270c('0xe0'):_0x3756d3[_0x270c('0x76')]='Sound';break;case _0x270c('0xe1'):_0x3756d3['childModel']=_0x270c('0x89');break;case _0x270c('0xe2'):_0x3756d3['childModel']='Template';break;case _0x270c('0xe3'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xe4');break;case _0x270c('0xe5'):_0x3756d3['childModel']=_0x270c('0xe6');break;case _0x270c('0xe7'):_0x3756d3['childModel']=_0x270c('0xe8');break;case _0x270c('0xe9'):_0x3756d3[_0x270c('0x76')]=_0x270c('0x6c');break;case'extractedreports':_0x3756d3[_0x270c('0x76')]=_0x270c('0x80');_0x3756d3[_0x270c('0x79')]=[{'name':_0x270c('0xea'),'field':'id','foreignKey':_0x270c('0x85')}];break;case'metrics':_0x3756d3['childModel']=_0x270c('0xeb');break;case _0x270c('0xc6'):_0x3756d3[_0x270c('0x76')]='WhatsappAccount';break;default:return _0x3756d3;}return _0x3756d3;} \ No newline at end of file +var _0xd817=['FaxAccount','inboundroutes','internalroutes','VoiceExtension','VoiceContext','voicemails','VoiceRecording','parentSections','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','SmsQueue','WhatsappQueue','whatsappaccounts','voicequeues','users','agents','telephones','Users','admin','user','ZendeskAccount','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','intervals','pauses','Schedule','Sound','tags','Template','triggers','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','WhatsappAccount','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','UserProfile','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','fields','find','create','body','clone','get','omit','createdAt','crudPermissions','sequelize','UserProfileSection','each','autoAssociation','updatedAt','sectionId','userProfileId','Resources','UserProfileResource','describe','addSections','transaction','destroy','push','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','undefined','Invalid\x20section\x20\x27','all','union','ignore','childModel','order','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','CustomReports','Tag','tag','ThroughTags','color','value','SquareProject','SquareRecording','CmContact','Lists','ListId','CmList','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue'];(function(_0x3a5b87,_0x5d3457){var _0x48b275=function(_0xab0520){while(--_0xab0520){_0x3a5b87['push'](_0x3a5b87['shift']());}};_0x48b275(++_0x5d3457);}(_0xd817,0x12e));var _0x7d81=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0xd817[_0x2c9b79];return _0x265032;};'use strict';var pdf=require(_0x7d81('0x0'));var emlformat=require(_0x7d81('0x1'));var rimraf=require(_0x7d81('0x2'));var zipdir=require(_0x7d81('0x3'));var jsonpatch=require(_0x7d81('0x4'));var rp=require(_0x7d81('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7d81('0x6'));var path=require(_0x7d81('0x7'));var sox=require(_0x7d81('0x8'));var csv=require(_0x7d81('0x9'));var ejs=require(_0x7d81('0xa'));var fs=require('fs');var _=require(_0x7d81('0xb'));var squel=require('squel');var crypto=require(_0x7d81('0xc'));var jsforce=require(_0x7d81('0xd'));var deskjs=require(_0x7d81('0xe'));var toCsv=require(_0x7d81('0x9'));var querystring=require('querystring');var Papa=require(_0x7d81('0xf'));var Redis=require(_0x7d81('0x10'));var authService=require(_0x7d81('0x11'));var qs=require(_0x7d81('0x12'));var as=require(_0x7d81('0x13'));var hardwareService=require(_0x7d81('0x14'));var logger=require(_0x7d81('0x15'))(_0x7d81('0x16'));var utils=require(_0x7d81('0x17'));var config=require(_0x7d81('0x18'));var licenseUtil=require(_0x7d81('0x19'));var db=require(_0x7d81('0x1a'))['db'];config[_0x7d81('0x1b')]=_[_0x7d81('0x1c')](config['redis'],{'host':_0x7d81('0x1d'),'port':0x18eb});var socket=require(_0x7d81('0x1e'))(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x28eea6,_0x5cce3e){_0x5cce3e=_0x5cce3e||0xcc;return function(_0x2ec603){if(_0x2ec603){return _0x28eea6[_0x7d81('0x1f')](_0x5cce3e);}return _0x28eea6[_0x7d81('0x20')](_0x5cce3e)[_0x7d81('0x21')]();};}function respondWithResult(_0x1ffe09,_0x1bee64){_0x1bee64=_0x1bee64||0xc8;return function(_0x51defe){if(_0x51defe){return _0x1ffe09[_0x7d81('0x20')](_0x1bee64)['json'](_0x51defe);}};}function respondWithFilteredResult(_0x583009,_0x556a76){return function(_0x2b1cb6){if(_0x2b1cb6){var _0x2352bd=_0x2b1cb6[_0x7d81('0x22')],_0x47a9c2=_0x556a76[_0x7d81('0x23')],_0x479546=_0x556a76[_0x7d81('0x23')]+_0x556a76[_0x7d81('0x24')],_0x159c0f;if(_0x479546>=_0x2352bd){_0x479546=_0x2352bd;_0x159c0f=0xc8;}else{_0x159c0f=0xce;}_0x583009[_0x7d81('0x20')](_0x159c0f);return _0x583009[_0x7d81('0x25')](_0x7d81('0x26'),_0x47a9c2+'-'+_0x479546+'/'+_0x2352bd)[_0x7d81('0x27')](_0x2b1cb6);}return null;};}function patchUpdates(_0x415147){return function(_0x4277c7){try{jsonpatch[_0x7d81('0x28')](_0x4277c7,_0x415147,!![]);}catch(_0xe2cc47){return BPromise[_0x7d81('0x29')](_0xe2cc47);}return _0x4277c7[_0x7d81('0x2a')]();};}function saveUpdates(_0x463a7b,_0x10702c){return function(_0x4f74ea){if(_0x4f74ea){return _0x4f74ea[_0x7d81('0x2b')](_0x463a7b)[_0x7d81('0x2c')](function(_0x4f931d){return _0x4f931d;});}return null;};}function removeEntity(_0x3037c9,_0x59596a){return function(_0x3b0eda){if(_0x3b0eda){return _0x3b0eda['destroy']()[_0x7d81('0x2c')](function(){_0x3037c9[_0x7d81('0x20')](0xcc)[_0x7d81('0x21')]();});}};}function handleEntityNotFound(_0x218a5b,_0x3eb48e){return function(_0x52f32a){if(!_0x52f32a){_0x218a5b[_0x7d81('0x1f')](0x194);}return _0x52f32a;};}function handleError(_0x6d06b7,_0x240e4a){_0x240e4a=_0x240e4a||0x1f4;return function(_0x3e17e0){logger['error'](_0x3e17e0[_0x7d81('0x2d')]);if(_0x3e17e0[_0x7d81('0x2e')]){delete _0x3e17e0['name'];}_0x6d06b7[_0x7d81('0x20')](_0x240e4a)[_0x7d81('0x2f')](_0x3e17e0);};}exports[_0x7d81('0x30')]=function(_0x4fa734,_0x20ecaf){var _0x370565={},_0x1fdd11={},_0x55e273={'count':0x0,'rows':[]};var _0x504a43=_[_0x7d81('0x31')](db['UserProfile']['rawAttributes'],function(_0x36d40d){return{'name':_0x36d40d[_0x7d81('0x32')],'type':_0x36d40d[_0x7d81('0x33')][_0x7d81('0x34')]};});_0x1fdd11[_0x7d81('0x35')]=_[_0x7d81('0x31')](_0x504a43,_0x7d81('0x2e'));_0x1fdd11[_0x7d81('0x36')]=_['keys'](_0x4fa734['query']);_0x1fdd11['filters']=_[_0x7d81('0x37')](_0x1fdd11[_0x7d81('0x35')],_0x1fdd11['query']);_0x370565[_0x7d81('0x38')]=_[_0x7d81('0x37')](_0x1fdd11[_0x7d81('0x35')],qs['fields'](_0x4fa734['query']['fields']));_0x370565[_0x7d81('0x38')]=_0x370565[_0x7d81('0x38')][_0x7d81('0x39')]?_0x370565[_0x7d81('0x38')]:_0x1fdd11[_0x7d81('0x35')];if(!_0x4fa734[_0x7d81('0x36')][_0x7d81('0x3a')](_0x7d81('0x3b'))){_0x370565[_0x7d81('0x24')]=qs['limit'](_0x4fa734['query'][_0x7d81('0x24')]);_0x370565[_0x7d81('0x23')]=qs[_0x7d81('0x23')](_0x4fa734[_0x7d81('0x36')][_0x7d81('0x23')]);}_0x370565['order']=qs[_0x7d81('0x3c')](_0x4fa734[_0x7d81('0x36')][_0x7d81('0x3c')]);_0x370565[_0x7d81('0x3d')]=qs[_0x7d81('0x3e')](_[_0x7d81('0x3f')](_0x4fa734[_0x7d81('0x36')],_0x1fdd11[_0x7d81('0x3e')]),_0x504a43);if(_0x4fa734[_0x7d81('0x36')][_0x7d81('0x40')]){_0x370565[_0x7d81('0x3d')]=_['merge'](_0x370565[_0x7d81('0x3d')],{'$or':_['map'](_0x504a43,function(_0x965ae0){if(_0x965ae0[_0x7d81('0x33')]!=='VIRTUAL'){var _0x307f5e={};_0x307f5e[_0x965ae0[_0x7d81('0x2e')]]={'$like':'%'+_0x4fa734[_0x7d81('0x36')]['filter']+'%'};return _0x307f5e;}})});}_0x370565=_[_0x7d81('0x41')]({},_0x370565,_0x4fa734[_0x7d81('0x42')]);var _0x3a29c6={'where':_0x370565[_0x7d81('0x3d')]};return db[_0x7d81('0x43')][_0x7d81('0x22')](_0x3a29c6)['then'](function(_0x1bf68b){_0x55e273[_0x7d81('0x22')]=_0x1bf68b;if(_0x4fa734['query'][_0x7d81('0x44')]){_0x370565[_0x7d81('0x45')]=[{'all':!![]}];}return db['UserProfile'][_0x7d81('0x46')](_0x370565);})[_0x7d81('0x2c')](function(_0x532176){_0x55e273[_0x7d81('0x47')]=_0x532176;return _0x55e273;})[_0x7d81('0x2c')](respondWithFilteredResult(_0x20ecaf,_0x370565))[_0x7d81('0x48')](handleError(_0x20ecaf,null));};exports['show']=function(_0x1003c4,_0x4ad0fe){var _0x249c98={'raw':![],'where':{'id':_0x1003c4[_0x7d81('0x49')]['id']}},_0x10735f={};_0x10735f[_0x7d81('0x35')]=_[_0x7d81('0x4a')](db[_0x7d81('0x43')][_0x7d81('0x4b')]);_0x10735f[_0x7d81('0x36')]=_[_0x7d81('0x4a')](_0x1003c4['query']);_0x10735f[_0x7d81('0x3e')]=_[_0x7d81('0x37')](_0x10735f[_0x7d81('0x35')],_0x10735f[_0x7d81('0x36')]);_0x249c98[_0x7d81('0x38')]=_[_0x7d81('0x37')](_0x10735f[_0x7d81('0x35')],qs['fields'](_0x1003c4[_0x7d81('0x36')][_0x7d81('0x4c')]));_0x249c98[_0x7d81('0x38')]=_0x249c98['attributes'][_0x7d81('0x39')]?_0x249c98[_0x7d81('0x38')]:_0x10735f[_0x7d81('0x35')];if(_0x1003c4[_0x7d81('0x36')][_0x7d81('0x44')]){_0x249c98[_0x7d81('0x45')]=[{'all':!![]}];}_0x249c98=_[_0x7d81('0x41')]({},_0x249c98,_0x1003c4[_0x7d81('0x42')]);return db[_0x7d81('0x43')][_0x7d81('0x4d')](_0x249c98)['then'](handleEntityNotFound(_0x4ad0fe,null))['then'](respondWithResult(_0x4ad0fe,null))[_0x7d81('0x48')](handleError(_0x4ad0fe,null));};exports[_0x7d81('0x4e')]=function(_0x558ae8,_0xb61b73){return db['UserProfile']['create'](_0x558ae8[_0x7d81('0x4f')],{})[_0x7d81('0x2c')](respondWithResult(_0xb61b73,0xc9))[_0x7d81('0x48')](handleError(_0xb61b73,null));};exports[_0x7d81('0x50')]=function(_0x1d3387,_0x4f24bf){var _0x31e970={'where':{'id':_0x1d3387['params']['id']}},_0x402849={};_0x402849['model']=_[_0x7d81('0x4a')](db[_0x7d81('0x43')][_0x7d81('0x4b')]);_0x31e970['attributes']=_[_0x7d81('0x37')](_0x402849['model'],qs[_0x7d81('0x4c')](_0x1d3387[_0x7d81('0x36')][_0x7d81('0x4c')]));_0x31e970['attributes']=_0x31e970['attributes'][_0x7d81('0x39')]?_0x31e970[_0x7d81('0x38')]:_0x402849[_0x7d81('0x35')];if(_0x1d3387[_0x7d81('0x36')][_0x7d81('0x44')]){_0x31e970['include']=[{'all':!![]}];}_0x31e970=_[_0x7d81('0x41')]({},_0x31e970,_0x1d3387[_0x7d81('0x42')]);return db[_0x7d81('0x43')][_0x7d81('0x4d')](_0x31e970)[_0x7d81('0x2c')](handleEntityNotFound(_0x4f24bf,null))[_0x7d81('0x2c')](function(_0xa78961){if(_0xa78961){var _0x479be9=_0xa78961[_0x7d81('0x51')]({'plain':!![]});_0x479be9=qs[_0x7d81('0x52')](_0x479be9,['id',_0x7d81('0x53'),'updatedAt',_0x7d81('0x54')]);_0x1d3387[_0x7d81('0x4f')]=_[_0x7d81('0x52')](_0x1d3387['body'],['id',_0x7d81('0x53'),'updatedAt']);return db[_0x7d81('0x55')]['transaction'](function(_0x182e3a){return db[_0x7d81('0x43')]['create'](_['merge'](_0x479be9,_0x1d3387[_0x7d81('0x4f')]),{'include':_0x1d3387['query'][_0x7d81('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x182e3a})[_0x7d81('0x2c')](function(_0x1c9088){var _0x36eebd=_0x1c9088[_0x7d81('0x51')]({'plain':!![]});return db[_0x7d81('0x56')][_0x7d81('0x46')]({'where':{'userProfileId':_0x1d3387[_0x7d81('0x49')]['id']},'raw':!![]})[_0x7d81('0x2c')](function(_0x4bcfa2){if(_0x4bcfa2){return BPromise[_0x7d81('0x57')](_0x4bcfa2,function(_0x2d2b85){return new BPromise(function(_0x227702,_0x23066b){if(_0x2d2b85[_0x7d81('0x58')]===null||_0x2d2b85[_0x7d81('0x58')]===0x1)_0x227702(null);return db['UserProfileResource'][_0x7d81('0x46')]({'where':{'sectionId':_0x2d2b85['id']},'raw':!![]})[_0x7d81('0x2c')](function(_0x235bea){var _0x2aa89e=_[_0x7d81('0x31')](_0x235bea,function(_0x5cb750){return qs[_0x7d81('0x52')](_0x5cb750,['id',_0x7d81('0x53'),_0x7d81('0x59'),_0x7d81('0x5a')]);});_0x227702(_0x2aa89e);})[_0x7d81('0x48')](function(_0x31151b){_0x23066b(_0x31151b);});})[_0x7d81('0x2c')](function(_0x36b805){var _0x3ca2b6=qs['omit'](_0x2d2b85,['id','createdAt',_0x7d81('0x59')]);_0x3ca2b6[_0x7d81('0x5b')]=_0x36eebd['id'];if(_0x36b805)_0x3ca2b6[_0x7d81('0x5c')]=_0x36b805;return _0x3ca2b6;})['then'](function(_0x56aa6b){return db[_0x7d81('0x56')][_0x7d81('0x4e')](_0x56aa6b,{'include':[{'model':db[_0x7d81('0x5d')],'as':'Resources'}],'raw':!![],'transaction':_0x182e3a});});})['then'](function(){return _0x36eebd;});}});});});}})['then'](respondWithResult(_0x4f24bf,0xc9))[_0x7d81('0x48')](handleError(_0x4f24bf,null));};exports[_0x7d81('0x2b')]=function(_0x4a5eee,_0x3c2535){if(_0x4a5eee['body']['id']){delete _0x4a5eee[_0x7d81('0x4f')]['id'];}return db['UserProfile'][_0x7d81('0x4d')]({'where':{'id':_0x4a5eee[_0x7d81('0x49')]['id']}})[_0x7d81('0x2c')](handleEntityNotFound(_0x3c2535,null))['then'](saveUpdates(_0x4a5eee['body'],null))[_0x7d81('0x2c')](respondWithResult(_0x3c2535,null))[_0x7d81('0x48')](handleError(_0x3c2535,null));};exports['destroy']=function(_0x542ddb,_0x8192a0){return db[_0x7d81('0x43')][_0x7d81('0x4d')]({'where':{'id':_0x542ddb[_0x7d81('0x49')]['id']}})[_0x7d81('0x2c')](handleEntityNotFound(_0x8192a0,null))[_0x7d81('0x2c')](removeEntity(_0x8192a0,null))[_0x7d81('0x48')](handleError(_0x8192a0,null));};exports['describe']=function(_0x51cc86,_0x1afd8b){return db['UserProfile'][_0x7d81('0x5e')]()[_0x7d81('0x2c')](respondWithResult(_0x1afd8b,null))[_0x7d81('0x48')](handleError(_0x1afd8b,null));};exports[_0x7d81('0x5f')]=function(_0x2e1294,_0x3aec2c){var _0x10a979=_0x2e1294['body'];return db[_0x7d81('0x43')]['find']({'where':{'id':_0x2e1294[_0x7d81('0x49')]['id']}})[_0x7d81('0x2c')](handleEntityNotFound(_0x3aec2c,null))[_0x7d81('0x2c')](function(_0x3c4b09){if(_0x3c4b09){return db['sequelize'][_0x7d81('0x60')](function(_0x6b1098){return db[_0x7d81('0x56')][_0x7d81('0x61')]({'where':{'userProfileId':_0x2e1294[_0x7d81('0x49')]['id'],'sectionId':_[_0x7d81('0x31')](_0x10a979,function(_0x21ffa2){return _0x21ffa2['sectionId'];})},'transaction':_0x6b1098})['then'](function(){var _0xd53e99=_['map'](_0x10a979,function(_0x2fdae7){_0x2fdae7[_0x7d81('0x5b')]=_0x2e1294[_0x7d81('0x49')]['id'];return _0x2fdae7;});var _0x5767d1=[];return BPromise[_0x7d81('0x57')](_0xd53e99,function(_0x398b8b){return db[_0x7d81('0x56')]['create'](_0x398b8b,{'include':[{'model':db[_0x7d81('0x5d')],'as':_0x7d81('0x5c')}],'raw':!![],'transaction':_0x6b1098})[_0x7d81('0x2c')](function(_0x27b305){_0x5767d1[_0x7d81('0x62')](_0x27b305[_0x7d81('0x51')]({'plain':!![]}));});})[_0x7d81('0x2c')](function(){return _0x5767d1;});});});}})[_0x7d81('0x2c')](function(_0xd32268){return _0xd32268;})[_0x7d81('0x2c')](respondWithResult(_0x3aec2c,null))['catch'](handleError(_0x3aec2c,null));};exports[_0x7d81('0x63')]=function(_0x2c9ce0,_0x580242){var _0x4b540a;return db['UserProfile'][_0x7d81('0x4d')]({'where':{'id':_0x2c9ce0[_0x7d81('0x49')]['id']},'attributes':['id','name']})[_0x7d81('0x2c')](handleEntityNotFound(_0x580242,null))[_0x7d81('0x2c')](function(_0x266ef7){if(_0x266ef7){_0x4b540a=_0x266ef7;return db[_0x7d81('0x56')][_0x7d81('0x61')]({'where':{'userProfileId':_0x2c9ce0[_0x7d81('0x49')]['id'],'sectionId':_0x2c9ce0['query']['ids']}});}})[_0x7d81('0x2c')](function(){return _0x4b540a;})[_0x7d81('0x2c')](respondWithStatusCode(_0x580242,null))[_0x7d81('0x48')](handleError(_0x580242,null));};exports[_0x7d81('0x64')]=function(_0x146bd4,_0x4d32ab){var _0x2eeb34=[];var _0x5d2ff5=[];return db['UserProfileSection'][_0x7d81('0x46')]({'where':{'userProfileId':_0x146bd4['params']['id']},'raw':!![]})['then'](function(_0x289619){_0x2eeb34=_[_0x7d81('0x40')](_0x289619,function(_0x33b064){return _0x33b064[_0x7d81('0x65')]===0x1||_[_0x7d81('0x66')]([0x3eb,0x709],_0x33b064[_0x7d81('0x5a')]);});if(!_[_0x7d81('0x67')](_0x2eeb34)){return _[_0x7d81('0x31')](_0x2eeb34,function(_0x438373){return _0x438373[_0x7d81('0x5a')];});}else{return;}})[_0x7d81('0x2c')](function(_0x3b8415){if(_0x3b8415)_0x5d2ff5=_0x3b8415;if(_[_0x7d81('0x66')](_0x5d2ff5,0x64)){var _0x48ab42=_[_0x7d81('0x4d')](_0x2eeb34,{'sectionId':0x64});return hasDefaultDashboard(_0x48ab42)['then'](function(_0x31a7fd){return _[_0x7d81('0x31')](_0x2eeb34,function(_0x1d749d){if(_0x1d749d[_0x7d81('0x5a')]===0x64){_0x1d749d[_0x7d81('0x68')]=_0x31a7fd;}return _0x1d749d;});});}else{return;}})['then'](function(_0x161e8f){if(_0x161e8f)_0x2eeb34=_0x161e8f;if(_[_0x7d81('0x66')](_0x5d2ff5,0x3eb)){var _0x38dbd4=_[_0x7d81('0x4d')](_0x2eeb34,{'sectionId':0x3eb});return getCustomDashboards(_0x38dbd4)[_0x7d81('0x2c')](function(_0x51156f){return _[_0x7d81('0x31')](_0x2eeb34,function(_0x20749a){if(_0x38dbd4['enabled']){if(_0x20749a[_0x7d81('0x5a')]===0x3eb){_0x20749a[_0x7d81('0x68')]=_0x51156f;}}else{if(_0x20749a[_0x7d81('0x5a')]===0x64){_0x20749a[_0x7d81('0x68')]=_0x51156f;}}return _0x20749a;});});}else{return;}})[_0x7d81('0x2c')](function(_0x3b2afd){if(_0x3b2afd)_0x2eeb34=_0x3b2afd;if(_[_0x7d81('0x66')](_0x5d2ff5,0x709)){var _0x34bab2=_['find'](_0x2eeb34,{'sectionId':0x709});return getPlugins(_0x34bab2)[_0x7d81('0x2c')](function(_0x596460){if(_0x34bab2[_0x7d81('0x65')]){return _[_0x7d81('0x31')](_0x2eeb34,function(_0xc6f8ef){if(_0xc6f8ef['sectionId']===0x709){_0xc6f8ef['subsections']=_0x596460;}return _0xc6f8ef;});}else{var _0x918405={'sectionId':0x76c,'enabled':0x1,'subsections':_0x596460};var _0x64a10=_[_0x7d81('0x31')](_0x2eeb34);_0x64a10[_0x7d81('0x62')](_0x918405);return _0x64a10;}});}else{return;}})[_0x7d81('0x2c')](function(_0x53703b){if(_0x53703b)_0x2eeb34=_0x53703b;return _['filter'](_0x2eeb34,[_0x7d81('0x65'),0x1]);})[_0x7d81('0x2c')](respondWithResult(_0x4d32ab,null))[_0x7d81('0x48')](handleError(_0x4d32ab,null));};function hasDefaultDashboard(_0x516994){var _0x3b9235=[0x65];return new BPromise(function(_0x6a9ddc,_0x1dd49c){try{if(_0x516994[_0x7d81('0x58')]){_0x6a9ddc(_0x3b9235);}else{return db[_0x7d81('0x5d')][_0x7d81('0x69')]({'where':{'sectionId':_0x516994['id']},'raw':!![]})['then'](function(_0x335bc9){_0x335bc9?_0x6a9ddc(_0x3b9235):_0x6a9ddc();});}}catch(_0x684577){_0x1dd49c(_0x684577);}});}function getCustomDashboards(_0x55838b){var _0x24a710=[];return new BPromise(function(_0x28cae2,_0x51858d){try{if(_0x55838b[_0x7d81('0x58')]){return db[_0x7d81('0x6a')]['findAll']({'raw':!![]})[_0x7d81('0x2c')](function(_0x43ce56){_0x43ce56[_0x7d81('0x6b')](function(_0x4039d2){_0x24a710[_0x7d81('0x62')](_0x4039d2['id']+0x1869f);});_0x28cae2(_0x24a710);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x55838b['id']},'raw':!![]})['then'](function(_0x3dbccc){_0x3dbccc[_0x7d81('0x6b')](function(_0x5df653){_0x24a710[_0x7d81('0x62')](_0x5df653['resourceId']+0x1869f);});_0x28cae2(_0x24a710);});}}catch(_0x5c8e36){_0x51858d(_0x5c8e36);}});}function getPlugins(_0x2992b0){var _0x25973e=[];return new BPromise(function(_0x13f494,_0x1afdac){try{if(_0x2992b0[_0x7d81('0x58')]){return db[_0x7d81('0x6c')][_0x7d81('0x46')]({'raw':!![]})['then'](function(_0x3c76b8){_0x3c76b8[_0x7d81('0x6b')](function(_0x3283e7){_0x25973e['push'](_0x3283e7['id']+0x15b38);});_0x13f494(_0x25973e);});}else{return db[_0x7d81('0x5d')][_0x7d81('0x46')]({'where':{'sectionId':_0x2992b0['id']},'raw':!![]})[_0x7d81('0x2c')](function(_0x3e0add){_0x3e0add[_0x7d81('0x6b')](function(_0x5c4dda){_0x25973e['push'](_0x5c4dda[_0x7d81('0x6d')]+0x15b38);});_0x13f494(_0x25973e);});}}catch(_0x11157b){_0x1afdac(_0x11157b);}});}exports[_0x7d81('0x6e')]=function(_0xbd917d,_0x5754f8){return db[_0x7d81('0x43')][_0x7d81('0x4d')]({'where':{'id':_0xbd917d[_0x7d81('0x49')]['id']}})[_0x7d81('0x2c')](handleEntityNotFound(_0x5754f8,null))[_0x7d81('0x2c')](function(_0x1d1c41){if(_0x1d1c41){return db[_0x7d81('0x55')][_0x7d81('0x60')](function(_0x5acef3){return db[_0x7d81('0x56')][_0x7d81('0x46')]({'where':{'userProfileId':_0xbd917d[_0x7d81('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x7d81('0x2c')](function(_0x54fc76){if(_0x54fc76){return db[_0x7d81('0x56')][_0x7d81('0x61')]({'where':{'userProfileId':_0xbd917d[_0x7d81('0x49')]['id'],'id':_[_0x7d81('0x31')](_0x54fc76,function(_0x3877f6){return _0x3877f6['id'];})},'transaction':_0x5acef3});}})[_0x7d81('0x2c')](function(_0x49f7bc){var _0x577afc=_[_0x7d81('0x31')](_0xbd917d[_0x7d81('0x4f')],function(_0x5b24d6){_0x5b24d6[_0x7d81('0x5b')]=_0xbd917d[_0x7d81('0x49')]['id'];return _0x5b24d6;});return db['UserProfileSection'][_0x7d81('0x6f')](_0x577afc,{'raw':!![],'transaction':_0x5acef3});})[_0x7d81('0x2c')](function(_0x3263dd){var _0x237c25=_[_0x7d81('0x40')](_[_0x7d81('0x31')](_0x3263dd,function(_0x30c5e9){return _0x30c5e9['get']({'plain':!![]});}),{'includeAll':![]});if(_0x237c25){return db[_0x7d81('0x56')][_0x7d81('0x46')]({'where':{'userProfileId':_0xbd917d[_0x7d81('0x49')]['id'],'sectionId':_[_0x7d81('0x31')](_0x237c25,function(_0x57fd95){return _0x57fd95[_0x7d81('0x5a')];})},'attributes':['id',_0x7d81('0x5a')],'raw':!![]})[_0x7d81('0x2c')](function(_0x5b21ed){var _0x1db2a9=_[_0x7d81('0x31')](_0xbd917d[_0x7d81('0x4f')],function(_0x2be4da){_0x2be4da[_0x7d81('0x5b')]=_0xbd917d[_0x7d81('0x49')]['id'];return _0x2be4da;});return db[_0x7d81('0x5d')][_0x7d81('0x6f')](_0x1db2a9,{'raw':!![],'transaction':_0x5acef3});});}})['catch'](handleError(_0x5754f8,null));});}})[_0x7d81('0x2c')](function(_0x1065ca){var _0x351b46=_[_0x7d81('0x31')](_0x1065ca,function(_0x4febe6){return _0x4febe6[_0x7d81('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0x5754f8,null))['catch'](handleError(_0x5754f8,null));};exports[_0x7d81('0x70')]=function(_0x31435f,_0x4967de,_0x3bf44f){return db['UserProfile'][_0x7d81('0x4d')]({'where':{'id':_0x31435f['params']['id']}})[_0x7d81('0x2c')](handleEntityNotFound(_0x4967de,null))['then'](function(_0x18f099){if(_0x18f099){return _0x18f099['removeResources'](_0x31435f['query']['ids']);}})[_0x7d81('0x2c')](respondWithStatusCode(_0x4967de,null))[_0x7d81('0x48')](handleError(_0x4967de,null));};exports[_0x7d81('0x71')]=function(_0x460526,_0xd400b6){var _0x2b2e14={'raw':![],'where':{}};var _0x46b819={};var _0x248be1={'count':0x0,'rows':[]};var _0x216016=_0x460526[_0x7d81('0x36')][_0x7d81('0x72')];if(typeof _0x216016==='undefined'){throw new db[(_0x7d81('0x73'))][(_0x7d81('0x74'))](_0x7d81('0x75'));}var _0x3aea7c=_0x460526['query'][_0x7d81('0x76')]||![];var _0x29fa1c=getQueryModels(_0x216016,_0x3aea7c);if(typeof _0x29fa1c['childModel']===_0x7d81('0x77')){throw new db[(_0x7d81('0x73'))][(_0x7d81('0x74'))](_0x7d81('0x78')+_0x216016+'\x27');}var _0x5003fd=[];if(!_['isEmpty'](_0x29fa1c['parentSections'])){_0x5003fd=_0x29fa1c['parentSections'];}else{_0x5003fd=[{'name':_0x216016}];}return db[_0x7d81('0x43')][_0x7d81('0x69')]({'where':{'id':_0x460526[_0x7d81('0x49')]['id']}})[_0x7d81('0x2c')](handleEntityNotFound(_0xd400b6,null))[_0x7d81('0x2c')](function(_0x4e9310){if(_0x4e9310){var _0x5aad6f=[];for(var _0x3f07f0=0x0;_0x3f07f0<_0x5003fd[_0x7d81('0x39')];_0x3f07f0++){_0x5aad6f[_0x7d81('0x62')](db[_0x7d81('0x56')][_0x7d81('0x69')]({'where':{'userProfileId':_0x4e9310['id'],'name':_0x5003fd[_0x3f07f0]['name']},'raw':!![]}));}return BPromise[_0x7d81('0x79')](_0x5aad6f);}})['then'](function(_0x457ff8){var _0x55ba36=_['filter'](_0x457ff8,function(_0x141488){return _0x141488?_0x141488:undefined;});var _0x38d823=_[_0x7d81('0x40')](_0x5003fd,['ignore',!![]]);var _0x188d74=_[_0x7d81('0x67')](_0x55ba36)&&_[_0x7d81('0x67')](_0x38d823)?null:_[_0x7d81('0x7a')](_0x38d823,_0x55ba36);if(_0x188d74){var _0x21b7f0=[];for(var _0x11d0ed=0x0;_0x11d0ed<_0x188d74['length'];_0x11d0ed++){var _0x152abe=_['find'](_0x5003fd,function(_0xc5676e){return _0x188d74[_0x11d0ed]?_0xc5676e[_0x7d81('0x2e')]===_0x188d74[_0x11d0ed][_0x7d81('0x2e')]:null;});if(_0x152abe){if(_0x188d74[_0x11d0ed][_0x7d81('0x7b')]){_0x21b7f0[_0x7d81('0x62')](getAllResources(_0x29fa1c[_0x7d81('0x7c')],_0x188d74[_0x11d0ed]));}else{if(!_0x188d74[_0x11d0ed]['autoAssociation']){_0x21b7f0[_0x7d81('0x62')](getAllowedResources(_0x152abe,_0x188d74[_0x11d0ed],_0x29fa1c[_0x7d81('0x7c')]));}else{if(_0x152abe[_0x7d81('0x35')]){_0x21b7f0[_0x7d81('0x62')](getAllFilteredResources(_0x152abe,_0x188d74[_0x11d0ed]));}}}}}return BPromise[_0x7d81('0x79')](_0x21b7f0);}else{return null;}})['then'](function(_0xa4a68b){var _0x1f8425=_0xa4a68b;var _0x28a92a=null;if(_0x1f8425){_0x28a92a=_0x1f8425[_0x7d81('0x39')]===0x1?_0x1f8425[0x0]:null;}if(_0x28a92a||_0x1f8425){var _0x338e07=db[_0x29fa1c[_0x7d81('0x7c')]][_0x7d81('0x4b')];_0x46b819[_0x7d81('0x35')]=_[_0x7d81('0x4a')](_0x338e07);_0x46b819[_0x7d81('0x36')]=_[_0x7d81('0x4a')](_0x460526[_0x7d81('0x36')]);_0x46b819[_0x7d81('0x3e')]=_['intersection'](_0x46b819[_0x7d81('0x35')],_0x46b819[_0x7d81('0x36')]);_0x2b2e14[_0x7d81('0x38')]=_[_0x7d81('0x37')](_0x46b819['model'],qs[_0x7d81('0x4c')](_0x460526[_0x7d81('0x36')][_0x7d81('0x4c')]));_0x2b2e14[_0x7d81('0x38')]=_0x2b2e14[_0x7d81('0x38')][_0x7d81('0x39')]?_0x2b2e14[_0x7d81('0x38')]:_0x46b819['model'];if(!_0x460526[_0x7d81('0x36')]['hasOwnProperty']('nolimit')){_0x2b2e14['limit']=qs[_0x7d81('0x24')](_0x460526[_0x7d81('0x36')][_0x7d81('0x24')]);_0x2b2e14[_0x7d81('0x23')]=qs[_0x7d81('0x23')](_0x460526[_0x7d81('0x36')][_0x7d81('0x23')]);}_0x2b2e14[_0x7d81('0x7d')]=qs[_0x7d81('0x3c')](_0x460526['query'][_0x7d81('0x3c')]);_0x2b2e14[_0x7d81('0x3d')]=qs[_0x7d81('0x3e')](_[_0x7d81('0x3f')](_0x460526[_0x7d81('0x36')],_0x46b819['filters']));if(_0x460526[_0x7d81('0x36')]['filter']){_0x2b2e14['where']=_[_0x7d81('0x41')](_0x2b2e14[_0x7d81('0x3d')],{'$or':_[_0x7d81('0x31')](_0x338e07,function(_0x3d096f){if(_0x3d096f[_0x7d81('0x33')][_0x7d81('0x34')]!==_0x7d81('0x7e')){var _0x5eb199={};_0x5eb199[_0x3d096f[_0x7d81('0x7f')]]={'$like':'%'+_0x460526['query'][_0x7d81('0x40')]+'%'};return _0x5eb199;}})});}var _0xff92db=[];if(_0x28a92a){var _0xf0d441=_[_0x7d81('0x4d')](_0x5003fd,[_0x7d81('0x2e'),_0x28a92a[_0x7d81('0x2e')]]);if(_0xf0d441[_0x7d81('0x7f')]){var _0x47da3b={};if(_0x29fa1c[_0x7d81('0x7c')]===_0x7d81('0x80')){_0x47da3b[_0xf0d441[_0x7d81('0x81')]]=_['map'](_0x28a92a[_0x7d81('0x82')],'id');}else{_0x47da3b[_0xf0d441[_0x7d81('0x81')]]=_0x28a92a[_0x7d81('0x82')];}_0xff92db[_0x7d81('0x62')](_0x47da3b);}else{_0x2b2e14[_0x7d81('0x3d')]['id']=_0x28a92a[_0x7d81('0x82')];}}else{for(var _0x12d01e=0x0;_0x12d01e<_0x1f8425[_0x7d81('0x39')];_0x12d01e++){var _0xf0d441=_[_0x7d81('0x4d')](_0x5003fd,['name',_0x1f8425[_0x12d01e][_0x7d81('0x2e')]]);if(_0xf0d441[_0x7d81('0x7f')]){var _0x47da3b={};_0x47da3b[_0xf0d441[_0x7d81('0x81')]]=_0x1f8425[_0x12d01e][_0x7d81('0x82')];_0xff92db[_0x7d81('0x62')](_0x47da3b);}else{if(!_0x2b2e14[_0x7d81('0x3d')]['id'])_0x2b2e14[_0x7d81('0x3d')]['id']=[];_0x1f8425[_0x12d01e][_0x7d81('0x82')]['forEach'](function(_0x58854c){_0x2b2e14[_0x7d81('0x3d')]['id'][_0x7d81('0x62')](_0x58854c);});}}}if(!_['isEmpty'](_0xff92db)){_0x2b2e14[_0x7d81('0x3d')]=_[_0x7d81('0x41')](_0x2b2e14[_0x7d81('0x3d')],{'$and':{'$or':_0xff92db}});}_0x2b2e14=_['merge']({},_0x2b2e14,_0x460526[_0x7d81('0x42')]);if(_0x28a92a&&!_0x28a92a[_0x7d81('0x58')]&&_0x29fa1c[_0x7d81('0x7c')]==='AnalyticExtractedReport'){if(_0x460526['query'][_0x7d81('0x44')]){_0x2b2e14[_0x7d81('0x45')]=[{'all':!![]}];}return db[_0x29fa1c[_0x7d81('0x7c')]][_0x7d81('0x46')](_0x2b2e14)[_0x7d81('0x2c')](function(_0x5b2985){var _0x6b7599=[];_0x5b2985['forEach'](function(_0x22c50e){var _0xc8d71d;switch(_0x22c50e[_0x7d81('0x83')]){case _0x7d81('0x84'):_0xc8d71d=_[_0x7d81('0x4d')](_0x28a92a[_0x7d81('0x82')],function(_0x5c6414){return _0x5c6414['id']===_0x22c50e[_0x7d81('0x85')]&&_0x5c6414[_0x7d81('0x33')]===_0x7d81('0x86');});break;case _0x7d81('0x87'):_0xc8d71d=_[_0x7d81('0x4d')](_0x28a92a[_0x7d81('0x82')],function(_0x154ec8){return _0x154ec8['id']===_0x22c50e['reportId']&&_0x154ec8['type']===_0x7d81('0x88');});break;}if(_0xc8d71d)_0x6b7599[_0x7d81('0x62')](_0x22c50e);});_0x248be1[_0x7d81('0x22')]=_0x6b7599[_0x7d81('0x39')];_0x248be1[_0x7d81('0x47')]=_0x6b7599;return _0x248be1;});}else{return db[_0x29fa1c[_0x7d81('0x7c')]][_0x7d81('0x22')]({'where':_0x2b2e14[_0x7d81('0x3d')]})[_0x7d81('0x2c')](function(_0x515d78){_0x248be1[_0x7d81('0x22')]=_0x515d78;if(_0x460526[_0x7d81('0x36')][_0x7d81('0x44')]){if(_0x29fa1c[_0x7d81('0x7c')]==='CmContact'){_0x2b2e14[_0x7d81('0x45')]=[{'model':db[_0x7d81('0x89')],'as':'Tags','attributes':['id','name','color'],'required':_0x460526[_0x7d81('0x36')][_0x7d81('0x8a')]?!![]:![]},{'model':db['Tag'],'as':_0x7d81('0x8b'),'attributes':['id',_0x7d81('0x2e'),_0x7d81('0x8c')],'through':_0x460526[_0x7d81('0x36')]['tag']?{'attributes':[],'where':{'TagId':_0x460526[_0x7d81('0x36')][_0x7d81('0x8a')]||undefined}}:{},'required':_0x460526['query'][_0x7d81('0x8a')]?!![]:![]}];}else{_0x2b2e14[_0x7d81('0x45')]=[{'all':!![]}];}}return db[_0x29fa1c[_0x7d81('0x7c')]][_0x7d81('0x46')](_0x2b2e14);})[_0x7d81('0x2c')](function(_0x2ebaec){_0x248be1[_0x7d81('0x47')]=_0x2ebaec;return _0x248be1;});}}else{return _0x248be1;}})[_0x7d81('0x2c')](respondWithFilteredResult(_0xd400b6,_0x2b2e14))['catch'](handleError(_0xd400b6,null));};function getAllResources(_0x23938d,_0x1c233f){return new BPromise(function(_0x505f62,_0x4e09fe){if(_0x1c233f){var _0x86f197=_0x1c233f[_0x7d81('0x40')]?{[_0x1c233f[_0x7d81('0x40')][_0x7d81('0x7f')]]:_0x1c233f['filter'][_0x7d81('0x8d')]}:undefined;return db[_0x23938d]['findAll']({'where':_0x86f197,'raw':!![]})[_0x7d81('0x2c')](function(_0x37ff22){_0x1c233f['associatedResources']=_[_0x7d81('0x31')](_0x37ff22,'id');_0x505f62(_0x1c233f);})['catch'](function(_0x1ec75b){_0x4e09fe(_0x1ec75b);});}else{_0x505f62(null);}});}function getAllFilteredResources(_0x4a14e5,_0x43d37d){return new BPromise(function(_0x5ed266,_0x2ac7bf){var _0x5c50b7=_0x4a14e5[_0x7d81('0x40')]?{[_0x4a14e5[_0x7d81('0x40')][_0x7d81('0x7f')]]:_0x4a14e5[_0x7d81('0x40')][_0x7d81('0x8d')]}:undefined;return db[_0x4a14e5['model']]['findAll']({'where':_0x5c50b7,'raw':!![]})[_0x7d81('0x2c')](function(_0x41afb7){_0x43d37d[_0x7d81('0x82')]=_[_0x7d81('0x31')](_0x41afb7,function(_0x20154f){return _0x20154f[_0x7d81('0x2e')];});_0x5ed266(_0x43d37d);})[_0x7d81('0x48')](function(_0x2ef5af){_0x2ac7bf(_0x2ef5af);});});}function getAllowedResources(_0x2930b6,_0x142c09,_0x52160a){return new BPromise(function(_0x2f1811,_0x4826df){if(_0x142c09){return db[_0x7d81('0x5d')][_0x7d81('0x46')]({'where':{'sectionId':_0x142c09['id']},'raw':!![]})[_0x7d81('0x2c')](function(_0x4fa811){if(_0x2930b6[_0x7d81('0x7f')]&&_0x2930b6[_0x7d81('0x7f')]!=='id'){_0x142c09[_0x7d81('0x82')]=_[_0x7d81('0x31')](_0x4fa811,function(_0x5179f9){return _0x5179f9[_0x2930b6[_0x7d81('0x7f')]];});}else{if(_0x52160a==='AnalyticExtractedReport'){_0x142c09[_0x7d81('0x82')]=_[_0x7d81('0x31')](_0x4fa811,function(_0x2c0c68){return{'id':_0x2c0c68[_0x7d81('0x6d')],'type':_0x2c0c68[_0x7d81('0x33')]};});}else{_0x142c09[_0x7d81('0x82')]=_['map'](_0x4fa811,function(_0x4d3249){return _0x4d3249[_0x7d81('0x6d')];});}}_0x2f1811(_0x142c09);})[_0x7d81('0x48')](function(_0x581c7a){_0x4826df(_0x581c7a);});}else{_0x2f1811(null);}});}function getQueryModels(_0x1c9755,_0x47c4ff){var _0x4d3e94=_0x1c9755['toLowerCase']();var _0x196afb={'childModel':undefined,'parentSections':[]};switch(_0x4d3e94){case'squareprojects':_0x196afb['childModel']=_0x7d81('0x8e');break;case'odbc':_0x196afb['childModel']='SquareOdbc';break;case'squarerecordings':_0x196afb['childModel']=_0x7d81('0x8f');_0x196afb['parentSections']=[{'name':'SquareProjects','field':_0x7d81('0x2e'),'foreignKey':'projectName'}];break;case'projects':_0x196afb[_0x7d81('0x7c')]='JscriptyProject';break;case'contacts':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0x90');_0x196afb['parentSections']=[{'name':_0x7d81('0x91'),'field':'id','foreignKey':_0x7d81('0x92')}];break;case'lists':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0x93');break;case'companies':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0x94');break;case _0x7d81('0x95'):_0x196afb[_0x7d81('0x7c')]='CmCustomField';break;case _0x7d81('0x96'):_0x196afb['childModel']=_0x7d81('0x97');break;case _0x7d81('0x98'):_0x196afb['childModel']=_0x7d81('0x99');break;case _0x7d81('0x9a'):_0x196afb['childModel']=_0x7d81('0x9b');break;case'faxaccounts':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0x9c');break;case _0x7d81('0x9d'):case _0x7d81('0x9e'):case'outboundroutes':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0x9f');break;case'contexts':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xa0');break;case _0x7d81('0xa1'):_0x196afb[_0x7d81('0x7c')]='VoiceMail';break;case'voicerecordings':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xa2');_0x196afb[_0x7d81('0xa3')]=[{'name':_0x7d81('0xa4'),'field':'name','foreignKey':_0x7d81('0xa5'),'model':_0x7d81('0xa6'),'filter':{'field':'role','value':[_0x7d81('0xa7')]}},{'name':_0x7d81('0xa8'),'field':_0x7d81('0x2e'),'foreignKey':_0x7d81('0xa5'),'model':_0x7d81('0xa6'),'filter':{'field':_0x7d81('0xa9'),'value':[_0x7d81('0xaa')]}},{'name':_0x7d81('0xab'),'field':_0x7d81('0x2e'),'foreignKey':_0x7d81('0xac'),'model':_0x7d81('0xad'),'filter':{'field':_0x7d81('0x33'),'value':[_0x7d81('0xae')]}},{'name':_0x7d81('0xaf'),'field':_0x7d81('0x2e'),'foreignKey':_0x7d81('0xac'),'model':_0x7d81('0xad'),'filter':{'field':_0x7d81('0x33'),'value':['outbound']}}];break;case _0x7d81('0xb0'):_0x196afb['childModel']=_0x7d81('0xb1');break;case _0x7d81('0xb2'):_0x196afb['childModel']=_0x7d81('0xb3');break;case'voiceprefixes':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xb4');break;case _0x7d81('0xb5'):_0x196afb[_0x7d81('0x7c')]='Campaign';break;case _0x7d81('0xb6'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xb7');break;case _0x7d81('0xb8'):_0x196afb[_0x7d81('0x7c')]='MailAccount';break;case _0x7d81('0xb9'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xba');break;case _0x7d81('0xbb'):_0x196afb['childModel']='OpenchannelQueue';break;case _0x7d81('0xbc'):_0x196afb[_0x7d81('0x7c')]='OpenchannelAccount';break;case'smsqueues':_0x196afb['childModel']=_0x7d81('0xbd');break;case'smsaccounts':_0x196afb[_0x7d81('0x7c')]='SmsAccount';break;case'whatsappqueues':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xbe');break;case _0x7d81('0xbf'):_0x196afb[_0x7d81('0x7c')]='WhatsappAccount';break;case'teams':_0x196afb[_0x7d81('0x7c')]='Team';break;case _0x7d81('0xc0'):case'queuecampaigns':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xad');if(_0x47c4ff){_0x196afb[_0x7d81('0xa3')]=[{'name':'VoiceQueues'},{'name':_0x7d81('0xaf')}];}break;case _0x7d81('0xc1'):case _0x7d81('0xc2'):case _0x7d81('0xc3'):_0x196afb['childModel']='User';if(_0x47c4ff){_0x196afb[_0x7d81('0xa3')]=[{'name':_0x7d81('0xc4'),'filter':{'field':_0x7d81('0xa9'),'value':[_0x7d81('0xc5'),_0x7d81('0xc6')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xc7');break;case'salesforceaccounts':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xc8');break;case'freshdeskaccounts':_0x196afb['childModel']=_0x7d81('0xc9');break;case'sugarcrmaccounts':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xca');break;case _0x7d81('0xcb'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xcc');break;case _0x7d81('0xcd'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xce');break;case _0x7d81('0xcf'):_0x196afb['childModel']='User';break;case _0x7d81('0xd0'):_0x196afb['childModel']=_0x7d81('0xd1');break;case'dispositions':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xd2');break;case _0x7d81('0xd3'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0x6a');break;case _0x7d81('0xd4'):_0x196afb[_0x7d81('0x7c')]='Interval';break;case _0x7d81('0xd5'):_0x196afb[_0x7d81('0x7c')]='Pause';break;case'scheduler':_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xd6');break;case'sounds':_0x196afb['childModel']=_0x7d81('0xd7');break;case _0x7d81('0xd8'):_0x196afb[_0x7d81('0x7c')]='Tag';break;case'templates':_0x196afb['childModel']=_0x7d81('0xd9');break;case _0x7d81('0xda'):_0x196afb['childModel']='Trigger';break;case _0x7d81('0xdb'):_0x196afb['childModel']=_0x7d81('0xdc');break;case _0x7d81('0xdd'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xde');break;case _0x7d81('0xdf'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0x6c');break;case _0x7d81('0xe0'):_0x196afb['childModel']=_0x7d81('0x80');_0x196afb[_0x7d81('0xa3')]=[{'name':_0x7d81('0xe1'),'field':'id','foreignKey':_0x7d81('0x85')}];break;case _0x7d81('0xe2'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xe3');break;case _0x7d81('0xbf'):_0x196afb[_0x7d81('0x7c')]=_0x7d81('0xe4');break;default:return _0x196afb;}return _0x196afb;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index d81e7af..88f1f52 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 _0xf54c=['events','../../mysqldb','UserProfile','setMaxListeners','update','emit','hook'];(function(_0x2bf4db,_0x935f73){var _0x75830c=function(_0x4cffef){while(--_0x4cffef){_0x2bf4db['push'](_0x2bf4db['shift']());}};_0x75830c(++_0x935f73);}(_0xf54c,0x150));var _0xcf54=function(_0x22960c,_0x352028){_0x22960c=_0x22960c-0x0;var _0x330529=_0xf54c[_0x22960c];return _0x330529;};'use strict';var EventEmitter=require(_0xcf54('0x0'));var UserProfile=require(_0xcf54('0x1'))['db'][_0xcf54('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xcf54('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcf54('0x4'),'afterDestroy':'remove'};function emitEvent(_0x318b80){return function(_0x323046,_0x501a68,_0x2e069e){UserProfileEvents[_0xcf54('0x5')](_0x318b80+':'+_0x323046['id'],_0x323046);UserProfileEvents[_0xcf54('0x5')](_0x318b80,_0x323046);_0x2e069e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xcf54('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xff57=['UserProfile','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xff57,0x9e));var _0x7ff5=function(_0x3cc05a,_0x1a0c6c){_0x3cc05a=_0x3cc05a-0x0;var _0x301bae=_0xff57[_0x3cc05a];return _0x301bae;};'use strict';var EventEmitter=require(_0x7ff5('0x0'));var UserProfile=require(_0x7ff5('0x1'))['db'][_0x7ff5('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7ff5('0x3')](0x0);var events={'afterCreate':_0x7ff5('0x4'),'afterUpdate':'update','afterDestroy':_0x7ff5('0x5')};function emitEvent(_0x2b7116){return function(_0x5b41ff,_0x5601c3,_0x1be135){UserProfileEvents[_0x7ff5('0x6')](_0x2b7116+':'+_0x5b41ff['id'],_0x5b41ff);UserProfileEvents[_0x7ff5('0x6')](_0x2b7116,_0x5b41ff);_0x1be135(null);};}for(var e in events){if(events[_0x7ff5('0x7')](e)){var event=events[e];UserProfile[_0x7ff5('0x8')](e,emitEvent(event));}}module[_0x7ff5('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 2ca4ada..b746b38 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 _0x8a00=['user_profiles','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfile.attributes','define','UserProfile'];(function(_0x187e4e,_0x8d4f4b){var _0x43b7f4=function(_0x4805de){while(--_0x4805de){_0x187e4e['push'](_0x187e4e['shift']());}};_0x43b7f4(++_0x8d4f4b);}(_0x8a00,0x121));var _0x08a0=function(_0x4bcf2a,_0x2c2d5a){_0x4bcf2a=_0x4bcf2a-0x0;var _0x28ba88=_0x8a00[_0x4bcf2a];return _0x28ba88;};'use strict';var _=require(_0x08a0('0x0'));var util=require(_0x08a0('0x1'));var logger=require('../../config/logger')(_0x08a0('0x2'));var moment=require(_0x08a0('0x3'));var BPromise=require(_0x08a0('0x4'));var rp=require(_0x08a0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x08a0('0x6'));var config=require(_0x08a0('0x7'));var attributes=require(_0x08a0('0x8'));module['exports']=function(_0x53df6b,_0x40762d){return _0x53df6b[_0x08a0('0x9')](_0x08a0('0xa'),attributes,{'tableName':_0x08a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x593b=['rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5cbc88,_0x382062){var _0x47cfd2=function(_0x4b97a3){while(--_0x4b97a3){_0x5cbc88['push'](_0x5cbc88['shift']());}};_0x47cfd2(++_0x382062);}(_0x593b,0xfe));var _0xb593=function(_0x21080c,_0x4ae402){_0x21080c=_0x21080c-0x0;var _0x162045=_0x593b[_0x21080c];return _0x162045;};'use strict';var _=require('lodash');var util=require(_0xb593('0x0'));var logger=require(_0xb593('0x1'))(_0xb593('0x2'));var moment=require(_0xb593('0x3'));var BPromise=require('bluebird');var rp=require(_0xb593('0x4'));var fs=require('fs');var path=require(_0xb593('0x5'));var rimraf=require(_0xb593('0x6'));var config=require(_0xb593('0x7'));var attributes=require(_0xb593('0x8'));module[_0xb593('0x9')]=function(_0x5c2a07,_0xf5dbc1){return _0x5c2a07[_0xb593('0xa')](_0xb593('0xb'),attributes,{'tableName':_0xb593('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 a24fd7d..4a3aea6 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 _0xeec6=['localhost','socket.io-emitter','./userProfile.socket','register','request','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis'];(function(_0x3bff47,_0x43601f){var _0x531204=function(_0x14526b){while(--_0x14526b){_0x3bff47['push'](_0x3bff47['shift']());}};_0x531204(++_0x43601f);}(_0xeec6,0x1c2));var _0x6eec=function(_0x399849,_0x3b630d){_0x399849=_0x399849-0x0;var _0xfbb04=_0xeec6[_0x399849];return _0xfbb04;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});config['redis']=_[_0x6eec('0xc')](config[_0x6eec('0xd')],{'host':_0x6eec('0xe'),'port':0x18eb});var socket=require(_0x6eec('0xf'))(new Redis(config['redis']));require(_0x6eec('0x10'))[_0x6eec('0x11')](socket);function respondWithRpcPromise(_0x1c774d,_0x49ad4c,_0x595dd4){return new BPromise(function(_0x5e8aba,_0x295cae){return client[_0x6eec('0x12')](_0x1c774d,_0x595dd4)['then'](function(_0x4b8de1){logger[_0x6eec('0x13')]('UserProfile,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));logger[_0x6eec('0x15')](_0x6eec('0x16'),_0x49ad4c,_0x6eec('0x14'),JSON[_0x6eec('0x17')](_0x4b8de1));if(_0x4b8de1['error']){if(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x19')]===0x1f4){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);return _0x295cae(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);}logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1['error'][_0x6eec('0x1b')]);return _0x5e8aba(_0x4b8de1['error'][_0x6eec('0x1b')]);}else{logger[_0x6eec('0x13')]('UserProfile,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));_0x5e8aba(_0x4b8de1[_0x6eec('0x1c')][_0x6eec('0x1b')]);}})['catch'](function(_0x87f3be){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x87f3be);_0x295cae(_0x87f3be);});});} \ No newline at end of file +var _0xafc4=['error','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b9eeb,_0x4ca29b){var _0x72c21e=function(_0x52fdee){while(--_0x52fdee){_0x1b9eeb['push'](_0x1b9eeb['shift']());}};_0x72c21e(++_0x4ca29b);}(_0xafc4,0x69));var _0x4afc=function(_0x3d1996,_0x1f08f0){_0x3d1996=_0x3d1996-0x0;var _0x550afd=_0xafc4[_0x3d1996];return _0x550afd;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});config[_0x4afc('0x9')]=_[_0x4afc('0xa')](config[_0x4afc('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4afc('0xb'))(new Redis(config[_0x4afc('0x9')]));require(_0x4afc('0xc'))[_0x4afc('0xd')](socket);function respondWithRpcPromise(_0x1b8981,_0x458fde,_0x5542ec){return new BPromise(function(_0x5c523b,_0x7f127f){return client['request'](_0x1b8981,_0x5542ec)[_0x4afc('0xe')](function(_0x225793){logger['info'](_0x4afc('0xf'),_0x458fde,_0x4afc('0x10'));logger[_0x4afc('0x11')](_0x4afc('0x12'),_0x458fde,_0x4afc('0x10'),JSON[_0x4afc('0x13')](_0x225793));if(_0x225793[_0x4afc('0x14')]){if(_0x225793[_0x4afc('0x14')]['code']===0x1f4){logger[_0x4afc('0x14')](_0x4afc('0xf'),_0x458fde,_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);return _0x7f127f(_0x225793['error']['message']);}logger[_0x4afc('0x14')]('UserProfile,\x20%s,\x20%s',_0x458fde,_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);return _0x5c523b(_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);}else{logger[_0x4afc('0x16')](_0x4afc('0xf'),_0x458fde,_0x4afc('0x10'));_0x5c523b(_0x225793[_0x4afc('0x17')][_0x4afc('0x15')]);}})[_0x4afc('0x18')](function(_0x178229){logger['error'](_0x4afc('0xf'),_0x458fde,_0x178229);_0x7f127f(_0x178229);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index ad99fba..9be009c 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 _0xa41a=['length','./userProfile.events','save','remove','emit','removeListener','register'];(function(_0x18ff42,_0x4a3b2d){var _0x1b850c=function(_0x5907ee){while(--_0x5907ee){_0x18ff42['push'](_0x18ff42['shift']());}};_0x1b850c(++_0x4a3b2d);}(_0xa41a,0x16d));var _0xaa41=function(_0x37a443,_0x5228e4){_0x37a443=_0x37a443-0x0;var _0xb631c=_0xa41a[_0x37a443];return _0xb631c;};'use strict';var UserProfileEvents=require(_0xaa41('0x0'));var events=[_0xaa41('0x1'),_0xaa41('0x2'),'update'];function createListener(_0xdc90c7,_0x2d82b6){return function(_0x501302){_0x2d82b6[_0xaa41('0x3')](_0xdc90c7,_0x501302);};}function removeListener(_0x3dfaac,_0xd7106f){return function(){UserProfileEvents[_0xaa41('0x4')](_0x3dfaac,_0xd7106f);};}exports[_0xaa41('0x5')]=function(_0x4d7706){for(var _0x835ee4=0x0,_0x459ce5=events[_0xaa41('0x6')];_0x835ee4<_0x459ce5;_0x835ee4++){var _0x37f05a=events[_0x835ee4];var _0x398fe2=createListener('userProfile:'+_0x37f05a,_0x4d7706);UserProfileEvents['on'](_0x37f05a,_0x398fe2);}}; \ No newline at end of file +var _0x2aca=['removeListener','register','userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0x152b6b,_0x4c61f5){var _0xa0541=function(_0xe44b36){while(--_0xe44b36){_0x152b6b['push'](_0x152b6b['shift']());}};_0xa0541(++_0x4c61f5);}(_0x2aca,0x19b));var _0xa2ac=function(_0x867dab,_0x1daea5){_0x867dab=_0x867dab-0x0;var _0x4d2cee=_0x2aca[_0x867dab];return _0x4d2cee;};'use strict';var UserProfileEvents=require(_0xa2ac('0x0'));var events=[_0xa2ac('0x1'),_0xa2ac('0x2'),_0xa2ac('0x3')];function createListener(_0xb6d340,_0x45c4a1){return function(_0x206f6a){_0x45c4a1[_0xa2ac('0x4')](_0xb6d340,_0x206f6a);};}function removeListener(_0x16d151,_0x20876d){return function(){UserProfileEvents[_0xa2ac('0x5')](_0x16d151,_0x20876d);};}exports[_0xa2ac('0x6')]=function(_0x16eb42){for(var _0x9908ae=0x0,_0x19e3c0=events['length'];_0x9908ae<_0x19e3c0;_0x9908ae++){var _0x10c45a=events[_0x9908ae];var _0x3372ab=createListener(_0xa2ac('0x7')+_0x10c45a,_0x16eb42);UserProfileEvents['on'](_0x10c45a,_0x3372ab);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index eaf6ed4..a7e8015 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 _0xa2cb=['post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show'];(function(_0x344de0,_0x42e2c1){var _0xe4d01b=function(_0x18f109){while(--_0x18f109){_0x344de0['push'](_0x344de0['shift']());}};_0xe4d01b(++_0x42e2c1);}(_0xa2cb,0x7d));var _0xba2c=function(_0x2ed279,_0x208b52){_0x2ed279=_0x2ed279-0x0;var _0x14c267=_0xa2cb[_0x2ed279];return _0x14c267;};'use strict';var multer=require(_0xba2c('0x0'));var util=require(_0xba2c('0x1'));var path=require('path');var timeout=require(_0xba2c('0x2'));var express=require(_0xba2c('0x3'));var router=express[_0xba2c('0x4')]();var auth=require(_0xba2c('0x5'));var interaction=require(_0xba2c('0x6'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xba2c('0x7')]('/describe',auth[_0xba2c('0x8')](),controller['describe']);router[_0xba2c('0x7')](_0xba2c('0x9'),auth['isAuthenticated'](),controller[_0xba2c('0xa')]);router[_0xba2c('0xb')]('/',auth['isAuthenticated'](),controller[_0xba2c('0xc')]);router[_0xba2c('0xd')](_0xba2c('0x9'),auth[_0xba2c('0x8')](),controller['update']);router[_0xba2c('0xe')](_0xba2c('0x9'),auth[_0xba2c('0x8')](),controller[_0xba2c('0xf')]);module[_0xba2c('0x10')]=router; \ No newline at end of file +var _0xef82=['/:id','show','post','create','update','delete','destroy','exports','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe'];(function(_0x382dfc,_0x779e6d){var _0x43ddbd=function(_0x4d025d){while(--_0x4d025d){_0x382dfc['push'](_0x382dfc['shift']());}};_0x43ddbd(++_0x779e6d);}(_0xef82,0x98));var _0x2ef8=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xef82[_0x42bdad];return _0x122626;};'use strict';var multer=require('multer');var util=require(_0x2ef8('0x0'));var path=require(_0x2ef8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x2ef8('0x2'));var interaction=require(_0x2ef8('0x3'));var config=require(_0x2ef8('0x4'));var controller=require(_0x2ef8('0x5'));router['get']('/',auth[_0x2ef8('0x6')](),controller[_0x2ef8('0x7')]);router[_0x2ef8('0x8')](_0x2ef8('0x9'),auth[_0x2ef8('0x6')](),controller['describe']);router[_0x2ef8('0x8')](_0x2ef8('0xa'),auth[_0x2ef8('0x6')](),controller[_0x2ef8('0xb')]);router[_0x2ef8('0xc')]('/',auth[_0x2ef8('0x6')](),controller[_0x2ef8('0xd')]);router['put'](_0x2ef8('0xa'),auth['isAuthenticated'](),controller[_0x2ef8('0xe')]);router[_0x2ef8('0xf')](_0x2ef8('0xa'),auth[_0x2ef8('0x6')](),controller[_0x2ef8('0x10')]);module[_0x2ef8('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index f54754a..f367533 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 _0x7fbf=['exports','STRING','sequelize'];(function(_0x57c8d8,_0x44344d){var _0xda7dbe=function(_0x3ab316){while(--_0x3ab316){_0x57c8d8['push'](_0x57c8d8['shift']());}};_0xda7dbe(++_0x44344d);}(_0x7fbf,0xad));var _0xf7fb=function(_0x2d4ee1,_0x45988e){_0x2d4ee1=_0x2d4ee1-0x0;var _0x37d5b5=_0x7fbf[_0x2d4ee1];return _0x37d5b5;};'use strict';var Sequelize=require(_0xf7fb('0x0'));module[_0xf7fb('0x1')]={'name':{'type':Sequelize[_0xf7fb('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x6e5e=['INTEGER','sequelize','STRING'];(function(_0x2b35fd,_0x322c3c){var _0x5362df=function(_0x37fbf3){while(--_0x37fbf3){_0x2b35fd['push'](_0x2b35fd['shift']());}};_0x5362df(++_0x322c3c);}(_0x6e5e,0x73));var _0xe6e5=function(_0x23da45,_0x932547){_0x23da45=_0x23da45-0x0;var _0x3844f1=_0x6e5e[_0x23da45];return _0x3844f1;};'use strict';var Sequelize=require(_0xe6e5('0x0'));module['exports']={'name':{'type':Sequelize[_0xe6e5('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe6e5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe6e5('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 0c728d8..25e1616 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 _0x9c5a=['params','keys','find','create','body','update','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','UserProfileResource','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch'];(function(_0x246119,_0x30a4f3){var _0x59c74f=function(_0x313fb5){while(--_0x313fb5){_0x246119['push'](_0x246119['shift']());}};_0x59c74f(++_0x30a4f3);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x2cb411,_0x4f88a2){_0x2cb411=_0x2cb411-0x0;var _0x115d18=_0x9c5a[_0x2cb411];return _0x115d18;};'use strict';var pdf=require(_0xa9c5('0x0'));var emlformat=require(_0xa9c5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa9c5('0x2'));var jsonpatch=require(_0xa9c5('0x3'));var rp=require(_0xa9c5('0x4'));var moment=require(_0xa9c5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa9c5('0x6'));var util=require(_0xa9c5('0x7'));var path=require('path');var sox=require(_0xa9c5('0x8'));var csv=require('to-csv');var ejs=require(_0xa9c5('0x9'));var fs=require('fs');var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=_0x19a43e[_0xa9c5('0x1b')],_0x4bb57e=_0x40b001['offset'],_0x2b0d73=_0x40b001[_0xa9c5('0x1c')]+_0x40b001[_0xa9c5('0x1d')],_0xd85c32;if(_0x2b0d73>=_0xcf13f2){_0x2b0d73=_0xcf13f2;_0xd85c32=0xc8;}else{_0xd85c32=0xce;}_0x251099[_0xa9c5('0x19')](_0xd85c32);return _0x251099[_0xa9c5('0x1e')](_0xa9c5('0x1f'),_0x4bb57e+'-'+_0x2b0d73+'/'+_0xcf13f2)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x3b8d4d){return function(_0x1e5ce6){try{jsonpatch[_0xa9c5('0x20')](_0x1e5ce6,_0x3b8d4d,!![]);}catch(_0x36c486){return BPromise[_0xa9c5('0x21')](_0x36c486);}return _0x1e5ce6[_0xa9c5('0x22')]();};}function saveUpdates(_0x54f8b9,_0x1115ad){return function(_0x21ab50){if(_0x21ab50){return _0x21ab50['update'](_0x54f8b9)['then'](function(_0xce9af6){return _0xce9af6;});}return null;};}function removeEntity(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')]()[_0xa9c5('0x24')](function(){_0x366f5c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d4e1b,_0x11d395){return function(_0x4b0f05){if(!_0x4b0f05){_0x3d4e1b[_0xa9c5('0x17')](0x194);}return _0x4b0f05;};}function handleError(_0x424b4c,_0x306c9b){_0x306c9b=_0x306c9b||0x1f4;return function(_0x32fc7d){logger[_0xa9c5('0x25')](_0x32fc7d[_0xa9c5('0x26')]);if(_0x32fc7d[_0xa9c5('0x27')]){delete _0x32fc7d['name'];}_0x424b4c['status'](_0x306c9b)[_0xa9c5('0x28')](_0x32fc7d);};}exports['index']=function(_0x1762ac,_0x830bad){var _0x4caefa={},_0x11a723={},_0x320dc0={'count':0x0,'rows':[]};var _0x5f468b=_[_0xa9c5('0x29')](db[_0xa9c5('0x2a')][_0xa9c5('0x2b')],function(_0x185eb8){return{'name':_0x185eb8[_0xa9c5('0x2c')],'type':_0x185eb8['type'][_0xa9c5('0x2d')]};});_0x11a723['model']=_[_0xa9c5('0x29')](_0x5f468b,_0xa9c5('0x27'));_0x11a723[_0xa9c5('0x2e')]=_['keys'](_0x1762ac[_0xa9c5('0x2e')]);_0x11a723[_0xa9c5('0x2f')]=_['intersection'](_0x11a723[_0xa9c5('0x30')],_0x11a723[_0xa9c5('0x2e')]);_0x4caefa[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x11a723[_0xa9c5('0x30')],qs[_0xa9c5('0x33')](_0x1762ac[_0xa9c5('0x2e')]['fields']));_0x4caefa[_0xa9c5('0x31')]=_0x4caefa[_0xa9c5('0x31')][_0xa9c5('0x34')]?_0x4caefa[_0xa9c5('0x31')]:_0x11a723[_0xa9c5('0x30')];if(!_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x35')](_0xa9c5('0x36'))){_0x4caefa['limit']=qs['limit'](_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x1d')]);_0x4caefa[_0xa9c5('0x1c')]=qs[_0xa9c5('0x1c')](_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x1c')]);}_0x4caefa['order']=qs['sort'](_0x1762ac['query'][_0xa9c5('0x37')]);_0x4caefa[_0xa9c5('0x38')]=qs['filters'](_[_0xa9c5('0x39')](_0x1762ac['query'],_0x11a723[_0xa9c5('0x2f')]),_0x5f468b);if(_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x3a')]){_0x4caefa[_0xa9c5('0x38')]=_['merge'](_0x4caefa[_0xa9c5('0x38')],{'$or':_[_0xa9c5('0x29')](_0x5f468b,function(_0x191153){if(_0x191153[_0xa9c5('0x3b')]!==_0xa9c5('0x3c')){var _0x17ef8e={};_0x17ef8e[_0x191153[_0xa9c5('0x27')]]={'$like':'%'+_0x1762ac[_0xa9c5('0x2e')]['filter']+'%'};return _0x17ef8e;}})});}_0x4caefa=_[_0xa9c5('0x3d')]({},_0x4caefa,_0x1762ac[_0xa9c5('0x3e')]);var _0x841c18={'where':_0x4caefa[_0xa9c5('0x38')]};return db[_0xa9c5('0x2a')][_0xa9c5('0x1b')](_0x841c18)['then'](function(_0x307736){_0x320dc0['count']=_0x307736;if(_0x1762ac[_0xa9c5('0x2e')]['includeAll']){_0x4caefa[_0xa9c5('0x3f')]=[{'all':!![]}];}return db[_0xa9c5('0x2a')][_0xa9c5('0x40')](_0x4caefa);})['then'](function(_0x12e19c){_0x320dc0[_0xa9c5('0x41')]=_0x12e19c;return _0x320dc0;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x830bad,_0x4caefa))[_0xa9c5('0x42')](handleError(_0x830bad,null));};exports['show']=function(_0x2dbb48,_0x97803f){var _0x3db918={'raw':![],'where':{'id':_0x2dbb48[_0xa9c5('0x43')]['id']}},_0x45668e={};_0x45668e['model']=_[_0xa9c5('0x44')](db['UserProfileResource'][_0xa9c5('0x2b')]);_0x45668e[_0xa9c5('0x2e')]=_[_0xa9c5('0x44')](_0x2dbb48[_0xa9c5('0x2e')]);_0x45668e[_0xa9c5('0x2f')]=_[_0xa9c5('0x32')](_0x45668e[_0xa9c5('0x30')],_0x45668e[_0xa9c5('0x2e')]);_0x3db918[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x45668e['model'],qs[_0xa9c5('0x33')](_0x2dbb48[_0xa9c5('0x2e')][_0xa9c5('0x33')]));_0x3db918[_0xa9c5('0x31')]=_0x3db918[_0xa9c5('0x31')][_0xa9c5('0x34')]?_0x3db918['attributes']:_0x45668e[_0xa9c5('0x30')];if(_0x2dbb48[_0xa9c5('0x2e')]['includeAll']){_0x3db918['include']=[{'all':!![]}];}_0x3db918=_['merge']({},_0x3db918,_0x2dbb48['options']);return db['UserProfileResource'][_0xa9c5('0x45')](_0x3db918)[_0xa9c5('0x24')](handleEntityNotFound(_0x97803f,null))[_0xa9c5('0x24')](respondWithResult(_0x97803f,null))[_0xa9c5('0x42')](handleError(_0x97803f,null));};exports[_0xa9c5('0x46')]=function(_0x240c40,_0xec9c4){return db[_0xa9c5('0x2a')][_0xa9c5('0x46')](_0x240c40[_0xa9c5('0x47')],{})[_0xa9c5('0x24')](respondWithResult(_0xec9c4,0xc9))[_0xa9c5('0x42')](handleError(_0xec9c4,null));};exports[_0xa9c5('0x48')]=function(_0x4bf8b4,_0x1108f0){if(_0x4bf8b4['body']['id']){delete _0x4bf8b4[_0xa9c5('0x47')]['id'];}return db[_0xa9c5('0x2a')]['find']({'where':{'id':_0x4bf8b4['params']['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x1108f0,null))[_0xa9c5('0x24')](saveUpdates(_0x4bf8b4[_0xa9c5('0x47')],null))['then'](respondWithResult(_0x1108f0,null))['catch'](handleError(_0x1108f0,null));};exports[_0xa9c5('0x23')]=function(_0xd03cec,_0x481f9c){return db[_0xa9c5('0x2a')][_0xa9c5('0x45')]({'where':{'id':_0xd03cec[_0xa9c5('0x43')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x481f9c,null))[_0xa9c5('0x24')](removeEntity(_0x481f9c,null))[_0xa9c5('0x42')](handleError(_0x481f9c,null));};exports['describe']=function(_0x4cd8e4,_0x54c60c){return db[_0xa9c5('0x2a')][_0xa9c5('0x49')]()[_0xa9c5('0x24')](respondWithResult(_0x54c60c,null))[_0xa9c5('0x42')](handleError(_0x54c60c,null));}; \ No newline at end of file +var _0x98a8=['options','UserProfileResource','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','sendStatus','stack','send','index','map','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','merge'];(function(_0x4346d9,_0x1a8338){var _0x4c033d=function(_0x39ee11){while(--_0x39ee11){_0x4346d9['push'](_0x4346d9['shift']());}};_0x4c033d(++_0x1a8338);}(_0x98a8,0x12c));var _0x898a=function(_0x7ec782,_0x4c4f49){_0x7ec782=_0x7ec782-0x0;var _0x15c8f8=_0x98a8[_0x7ec782];return _0x15c8f8;};'use strict';var pdf=require(_0x898a('0x0'));var emlformat=require(_0x898a('0x1'));var rimraf=require(_0x898a('0x2'));var zipdir=require(_0x898a('0x3'));var jsonpatch=require(_0x898a('0x4'));var rp=require(_0x898a('0x5'));var moment=require(_0x898a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x898a('0x7'));var util=require(_0x898a('0x8'));var path=require(_0x898a('0x9'));var sox=require(_0x898a('0xa'));var csv=require(_0x898a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xb'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=_0x53a4b8[_0x898a('0x1c')],_0x5c96a6=_0x47033c['offset'],_0x303321=_0x47033c[_0x898a('0x1d')]+_0x47033c[_0x898a('0x1e')],_0x4fb05b;if(_0x303321>=_0x3fec7a){_0x303321=_0x3fec7a;_0x4fb05b=0xc8;}else{_0x4fb05b=0xce;}_0x506023[_0x898a('0x1a')](_0x4fb05b);return _0x506023['set'](_0x898a('0x1f'),_0x5c96a6+'-'+_0x303321+'/'+_0x3fec7a)['json'](_0x53a4b8);}return null;};}function patchUpdates(_0x54c8f3){return function(_0x3f8af4){try{jsonpatch[_0x898a('0x20')](_0x3f8af4,_0x54c8f3,!![]);}catch(_0x58c3ab){return BPromise['reject'](_0x58c3ab);}return _0x3f8af4[_0x898a('0x21')]();};}function saveUpdates(_0x26449a,_0x38a8f0){return function(_0x2917ff){if(_0x2917ff){return _0x2917ff[_0x898a('0x22')](_0x26449a)[_0x898a('0x23')](function(_0x259541){return _0x259541;});}return null;};}function removeEntity(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x24')]()[_0x898a('0x23')](function(){_0x483212[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x4e254d,_0x274cdf){return function(_0x16c318){if(!_0x16c318){_0x4e254d[_0x898a('0x25')](0x194);}return _0x16c318;};}function handleError(_0x32eca5,_0x3901ab){_0x3901ab=_0x3901ab||0x1f4;return function(_0x1426e3){logger['error'](_0x1426e3[_0x898a('0x26')]);if(_0x1426e3['name']){delete _0x1426e3['name'];}_0x32eca5['status'](_0x3901ab)[_0x898a('0x27')](_0x1426e3);};}exports[_0x898a('0x28')]=function(_0x420b25,_0x40b3db){var _0x28ae6a={},_0x2efde2={},_0x398e98={'count':0x0,'rows':[]};var _0xac1fc4=_[_0x898a('0x29')](db['UserProfileResource']['rawAttributes'],function(_0x47f1ed){return{'name':_0x47f1ed[_0x898a('0x2a')],'type':_0x47f1ed[_0x898a('0x2b')][_0x898a('0x2c')]};});_0x2efde2[_0x898a('0x2d')]=_[_0x898a('0x29')](_0xac1fc4,_0x898a('0x2e'));_0x2efde2[_0x898a('0x2f')]=_[_0x898a('0x30')](_0x420b25[_0x898a('0x2f')]);_0x2efde2[_0x898a('0x31')]=_[_0x898a('0x32')](_0x2efde2[_0x898a('0x2d')],_0x2efde2['query']);_0x28ae6a[_0x898a('0x33')]=_[_0x898a('0x32')](_0x2efde2[_0x898a('0x2d')],qs[_0x898a('0x34')](_0x420b25[_0x898a('0x2f')]['fields']));_0x28ae6a['attributes']=_0x28ae6a[_0x898a('0x33')][_0x898a('0x35')]?_0x28ae6a[_0x898a('0x33')]:_0x2efde2['model'];if(!_0x420b25[_0x898a('0x2f')][_0x898a('0x36')](_0x898a('0x37'))){_0x28ae6a[_0x898a('0x1e')]=qs[_0x898a('0x1e')](_0x420b25[_0x898a('0x2f')][_0x898a('0x1e')]);_0x28ae6a[_0x898a('0x1d')]=qs['offset'](_0x420b25[_0x898a('0x2f')]['offset']);}_0x28ae6a['order']=qs[_0x898a('0x38')](_0x420b25['query'][_0x898a('0x38')]);_0x28ae6a['where']=qs[_0x898a('0x31')](_['pick'](_0x420b25[_0x898a('0x2f')],_0x2efde2[_0x898a('0x31')]),_0xac1fc4);if(_0x420b25[_0x898a('0x2f')]['filter']){_0x28ae6a['where']=_['merge'](_0x28ae6a[_0x898a('0x39')],{'$or':_[_0x898a('0x29')](_0xac1fc4,function(_0x5a228f){if(_0x5a228f[_0x898a('0x2b')]!==_0x898a('0x3a')){var _0xe84f7e={};_0xe84f7e[_0x5a228f[_0x898a('0x2e')]]={'$like':'%'+_0x420b25['query']['filter']+'%'};return _0xe84f7e;}})});}_0x28ae6a=_[_0x898a('0x3b')]({},_0x28ae6a,_0x420b25[_0x898a('0x3c')]);var _0x4d486b={'where':_0x28ae6a['where']};return db[_0x898a('0x3d')][_0x898a('0x1c')](_0x4d486b)[_0x898a('0x23')](function(_0xa45405){_0x398e98['count']=_0xa45405;if(_0x420b25[_0x898a('0x2f')][_0x898a('0x3e')]){_0x28ae6a['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x28ae6a);})[_0x898a('0x23')](function(_0x477a9d){_0x398e98[_0x898a('0x3f')]=_0x477a9d;return _0x398e98;})[_0x898a('0x23')](respondWithFilteredResult(_0x40b3db,_0x28ae6a))[_0x898a('0x40')](handleError(_0x40b3db,null));};exports[_0x898a('0x41')]=function(_0x10daf6,_0x1432ec){var _0x3292c2={'raw':![],'where':{'id':_0x10daf6[_0x898a('0x42')]['id']}},_0x235fcf={};_0x235fcf[_0x898a('0x2d')]=_[_0x898a('0x30')](db[_0x898a('0x3d')][_0x898a('0x43')]);_0x235fcf['query']=_[_0x898a('0x30')](_0x10daf6[_0x898a('0x2f')]);_0x235fcf[_0x898a('0x31')]=_['intersection'](_0x235fcf[_0x898a('0x2d')],_0x235fcf[_0x898a('0x2f')]);_0x3292c2[_0x898a('0x33')]=_[_0x898a('0x32')](_0x235fcf[_0x898a('0x2d')],qs[_0x898a('0x34')](_0x10daf6[_0x898a('0x2f')][_0x898a('0x34')]));_0x3292c2['attributes']=_0x3292c2[_0x898a('0x33')][_0x898a('0x35')]?_0x3292c2[_0x898a('0x33')]:_0x235fcf[_0x898a('0x2d')];if(_0x10daf6['query'][_0x898a('0x3e')]){_0x3292c2[_0x898a('0x44')]=[{'all':!![]}];}_0x3292c2=_['merge']({},_0x3292c2,_0x10daf6[_0x898a('0x3c')]);return db['UserProfileResource'][_0x898a('0x45')](_0x3292c2)['then'](handleEntityNotFound(_0x1432ec,null))['then'](respondWithResult(_0x1432ec,null))[_0x898a('0x40')](handleError(_0x1432ec,null));};exports['create']=function(_0x313fb4,_0x1edb26){return db['UserProfileResource'][_0x898a('0x46')](_0x313fb4[_0x898a('0x47')],{})['then'](respondWithResult(_0x1edb26,0xc9))[_0x898a('0x40')](handleError(_0x1edb26,null));};exports[_0x898a('0x22')]=function(_0x11a0a3,_0x118240){if(_0x11a0a3['body']['id']){delete _0x11a0a3[_0x898a('0x47')]['id'];}return db[_0x898a('0x3d')]['find']({'where':{'id':_0x11a0a3[_0x898a('0x42')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x118240,null))['then'](saveUpdates(_0x11a0a3[_0x898a('0x47')],null))['then'](respondWithResult(_0x118240,null))[_0x898a('0x40')](handleError(_0x118240,null));};exports[_0x898a('0x24')]=function(_0x32ccb9,_0x50f9e3){return db[_0x898a('0x3d')][_0x898a('0x45')]({'where':{'id':_0x32ccb9[_0x898a('0x42')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x50f9e3,null))['then'](removeEntity(_0x50f9e3,null))[_0x898a('0x40')](handleError(_0x50f9e3,null));};exports['describe']=function(_0x3db796,_0x2feb38){return db[_0x898a('0x3d')]['describe']()[_0x898a('0x23')](respondWithResult(_0x2feb38,null))[_0x898a('0x40')](handleError(_0x2feb38,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index e3e0ab1..6c410a0 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 _0xc1e2=['bluebird','request-promise','path','../../config/environment','exports','define','compositeIndex','sectionId','util','api','moment'];(function(_0x3ef201,_0x8a2dbc){var _0x4337ff=function(_0x417877){while(--_0x417877){_0x3ef201['push'](_0x3ef201['shift']());}};_0x4337ff(++_0x8a2dbc);}(_0xc1e2,0x1aa));var _0x2c1e=function(_0x240745,_0x28a86d){_0x240745=_0x240745-0x0;var _0x1582fb=_0xc1e2[_0x240745];return _0x1582fb;};'use strict';var _=require('lodash');var util=require(_0x2c1e('0x0'));var logger=require('../../config/logger')(_0x2c1e('0x1'));var moment=require(_0x2c1e('0x2'));var BPromise=require(_0x2c1e('0x3'));var rp=require(_0x2c1e('0x4'));var fs=require('fs');var path=require(_0x2c1e('0x5'));var rimraf=require('rimraf');var config=require(_0x2c1e('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x2c1e('0x7')]=function(_0x2e5b3e,_0x3a4a9f){return _0x2e5b3e[_0x2c1e('0x8')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x2c1e('0x9'),'fields':['resourceId',_0x2c1e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3cdf=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId'];(function(_0x4b9077,_0x255b98){var _0x55e0c8=function(_0x39fc9a){while(--_0x39fc9a){_0x4b9077['push'](_0x4b9077['shift']());}};_0x55e0c8(++_0x255b98);}(_0x3cdf,0x12c));var _0xf3cd=function(_0x5af86d,_0xca3ea3){_0x5af86d=_0x5af86d-0x0;var _0x1b9d05=_0x3cdf[_0x5af86d];return _0x1b9d05;};'use strict';var _=require(_0xf3cd('0x0'));var util=require(_0xf3cd('0x1'));var logger=require(_0xf3cd('0x2'))(_0xf3cd('0x3'));var moment=require(_0xf3cd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3cd('0x5'));var rimraf=require(_0xf3cd('0x6'));var config=require(_0xf3cd('0x7'));var attributes=require(_0xf3cd('0x8'));module[_0xf3cd('0x9')]=function(_0x30dcde,_0x274942){return _0x30dcde['define'](_0xf3cd('0xa'),attributes,{'tableName':_0xf3cd('0xb'),'paranoid':![],'indexes':[{'name':_0xf3cd('0xc'),'fields':[_0xf3cd('0xd'),_0xf3cd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 306b2c1..ffa49c1 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 _0x9d5d=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x41f841,_0x4929ef){var _0x3f8bdf=function(_0x179c56){while(--_0x179c56){_0x41f841['push'](_0x41f841['shift']());}};_0x3f8bdf(++_0x4929ef);}(_0x9d5d,0x15c));var _0xd9d5=function(_0x2829ef,_0x552e3d){_0x2829ef=_0x2829ef-0x0;var _0x1a7597=_0x9d5d[_0x2829ef];return _0x1a7597;};'use strict';var _=require(_0xd9d5('0x0'));var util=require(_0xd9d5('0x1'));var moment=require(_0xd9d5('0x2'));var BPromise=require(_0xd9d5('0x3'));var rs=require(_0xd9d5('0x4'));var fs=require('fs');var Redis=require(_0xd9d5('0x5'));var db=require(_0xd9d5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9d5('0x7'))('rpc');var config=require(_0xd9d5('0x8'));var jayson=require(_0xd9d5('0x9'));var client=jayson[_0xd9d5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2492d5,_0xfb0ffb,_0x45db57){return new BPromise(function(_0x1ae95c,_0x2095bc){return client[_0xd9d5('0xb')](_0x2492d5,_0x45db57)[_0xd9d5('0xc')](function(_0x2a2575){logger[_0xd9d5('0xd')](_0xd9d5('0xe'),_0xfb0ffb,_0xd9d5('0xf'));logger['debug'](_0xd9d5('0x10'),_0xfb0ffb,_0xd9d5('0xf'),JSON[_0xd9d5('0x11')](_0x2a2575));if(_0x2a2575[_0xd9d5('0x12')]){if(_0x2a2575[_0xd9d5('0x12')][_0xd9d5('0x13')]===0x1f4){logger['error'](_0xd9d5('0xe'),_0xfb0ffb,_0x2a2575[_0xd9d5('0x12')]['message']);return _0x2095bc(_0x2a2575['error']['message']);}logger[_0xd9d5('0x12')]('UserProfileResource,\x20%s,\x20%s',_0xfb0ffb,_0x2a2575['error'][_0xd9d5('0x14')]);return _0x1ae95c(_0x2a2575[_0xd9d5('0x12')][_0xd9d5('0x14')]);}else{logger[_0xd9d5('0xd')](_0xd9d5('0xe'),_0xfb0ffb,_0xd9d5('0xf'));_0x1ae95c(_0x2a2575[_0xd9d5('0x15')][_0xd9d5('0x14')]);}})[_0xd9d5('0x16')](function(_0x15e3dd){logger[_0xd9d5('0x12')](_0xd9d5('0xe'),_0xfb0ffb,_0x15e3dd);_0x2095bc(_0x15e3dd);});});} \ No newline at end of file +var _0x08ac=['../../config/logger','../../config/environment','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x08ac,0x1db));var _0xc08a=function(_0x120ee3,_0x49cc54){_0x120ee3=_0x120ee3-0x0;var _0x8413f9=_0x08ac[_0x120ee3];return _0x8413f9;};'use strict';var _=require(_0xc08a('0x0'));var util=require(_0xc08a('0x1'));var moment=require(_0xc08a('0x2'));var BPromise=require(_0xc08a('0x3'));var rs=require(_0xc08a('0x4'));var fs=require('fs');var Redis=require(_0xc08a('0x5'));var db=require(_0xc08a('0x6'))['db'];var utils=require(_0xc08a('0x7'));var logger=require(_0xc08a('0x8'))('rpc');var config=require(_0xc08a('0x9'));var jayson=require(_0xc08a('0xa'));var client=jayson['client'][_0xc08a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e36f9,_0x3bb08f,_0x1dcf6b){return new BPromise(function(_0x3769cc,_0x3b5336){return client[_0xc08a('0xc')](_0x2e36f9,_0x1dcf6b)[_0xc08a('0xd')](function(_0x181dbb){logger[_0xc08a('0xe')](_0xc08a('0xf'),_0x3bb08f,_0xc08a('0x10'));logger[_0xc08a('0x11')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x3bb08f,_0xc08a('0x10'),JSON['stringify'](_0x181dbb));if(_0x181dbb[_0xc08a('0x12')]){if(_0x181dbb[_0xc08a('0x12')][_0xc08a('0x13')]===0x1f4){logger[_0xc08a('0x12')](_0xc08a('0xf'),_0x3bb08f,_0x181dbb[_0xc08a('0x12')][_0xc08a('0x14')]);return _0x3b5336(_0x181dbb['error']['message']);}logger[_0xc08a('0x12')](_0xc08a('0xf'),_0x3bb08f,_0x181dbb[_0xc08a('0x12')][_0xc08a('0x14')]);return _0x3769cc(_0x181dbb[_0xc08a('0x12')][_0xc08a('0x14')]);}else{logger['info'](_0xc08a('0xf'),_0x3bb08f,_0xc08a('0x10'));_0x3769cc(_0x181dbb[_0xc08a('0x15')][_0xc08a('0x14')]);}})[_0xc08a('0x16')](function(_0x15b3d0){logger[_0xc08a('0x12')](_0xc08a('0xf'),_0x3bb08f,_0x15b3d0);_0x3b5336(_0x15b3d0);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 90ab3e0..1f4b7f7 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 _0x657f=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','path','connect-timeout'];(function(_0x2a1cc2,_0x15fea0){var _0x20f8c4=function(_0x514fb0){while(--_0x514fb0){_0x2a1cc2['push'](_0x2a1cc2['shift']());}};_0x20f8c4(++_0x15fea0);}(_0x657f,0x1d9));var _0xf657=function(_0x5401ae,_0x5e58ac){_0x5401ae=_0x5401ae-0x0;var _0x286068=_0x657f[_0x5401ae];return _0x286068;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf657('0x0'));var timeout=require(_0xf657('0x1'));var express=require(_0xf657('0x2'));var router=express['Router']();var auth=require(_0xf657('0x3'));var interaction=require(_0xf657('0x4'));var config=require(_0xf657('0x5'));var controller=require(_0xf657('0x6'));router[_0xf657('0x7')]('/',auth[_0xf657('0x8')](),controller[_0xf657('0x9')]);router[_0xf657('0x7')](_0xf657('0xa'),auth[_0xf657('0x8')](),controller[_0xf657('0xb')]);router[_0xf657('0x7')](_0xf657('0xc'),auth[_0xf657('0x8')](),controller[_0xf657('0xd')]);router[_0xf657('0xe')]('/',auth[_0xf657('0x8')](),controller['create']);router[_0xf657('0xf')](_0xf657('0xc'),auth[_0xf657('0x8')](),controller[_0xf657('0x10')]);router['delete'](_0xf657('0xc'),auth[_0xf657('0x8')](),controller[_0xf657('0x11')]);module[_0xf657('0x12')]=router; \ No newline at end of file +var _0xe167=['path','connect-timeout','Router','../../components/auth/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','delete','destroy','exports','util'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xe167,0xb3));var _0x7e16=function(_0x12412b,_0x58fb8a){_0x12412b=_0x12412b-0x0;var _0x29fb43=_0xe167[_0x12412b];return _0x29fb43;};'use strict';var multer=require('multer');var util=require(_0x7e16('0x0'));var path=require(_0x7e16('0x1'));var timeout=require(_0x7e16('0x2'));var express=require('express');var router=express[_0x7e16('0x3')]();var auth=require(_0x7e16('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7e16('0x5'));router[_0x7e16('0x6')]('/',auth[_0x7e16('0x7')](),controller[_0x7e16('0x8')]);router[_0x7e16('0x6')](_0x7e16('0x9'),auth[_0x7e16('0x7')](),controller[_0x7e16('0xa')]);router[_0x7e16('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x7e16('0xb')]);router[_0x7e16('0xc')]('/',auth['isAuthenticated'](),controller[_0x7e16('0xd')]);router['put'](_0x7e16('0xe'),auth[_0x7e16('0x7')](),controller['update']);router[_0x7e16('0xf')](_0x7e16('0xe'),auth['isAuthenticated'](),controller[_0x7e16('0x10')]);module[_0x7e16('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 85b015a..6faa991 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 _0x5afe=['crudPermissions','join','getDataValue','split','sequelize','exports','STRING','BOOLEAN','setDataValue'];(function(_0x2ffa8d,_0x216e8a){var _0x4a4403=function(_0x2f62c7){while(--_0x2f62c7){_0x2ffa8d['push'](_0x2ffa8d['shift']());}};_0x4a4403(++_0x216e8a);}(_0x5afe,0x1ab));var _0xe5af=function(_0x3330b8,_0x19b32a){_0x3330b8=_0x3330b8-0x0;var _0x191799=_0x5afe[_0x3330b8];return _0x191799;};'use strict';var Sequelize=require(_0xe5af('0x0'));module[_0xe5af('0x1')]={'name':{'type':Sequelize[_0xe5af('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xe5af('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xe5af('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe5af('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xe5af('0x2')],'set':function(_0xda9de7){this[_0xe5af('0x4')](_0xe5af('0x5'),_0xda9de7?_0xda9de7[_0xe5af('0x6')](''):[]);},'get':function(){return this[_0xe5af('0x7')](_0xe5af('0x5'))?this['getDataValue']('crudPermissions')[_0xe5af('0x8')](''):[];}}}; \ No newline at end of file +var _0x63e4=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x63e4,0x12a));var _0x463e=function(_0x15224c,_0x51841a){_0x15224c=_0x15224c-0x0;var _0x1aa8b0=_0x63e4[_0x15224c];return _0x1aa8b0;};'use strict';var Sequelize=require(_0x463e('0x0'));module[_0x463e('0x1')]={'name':{'type':Sequelize[_0x463e('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x463e('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x463e('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x463e('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x463e('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x35daa4){this[_0x463e('0x5')](_0x463e('0x6'),_0x35daa4?_0x35daa4[_0x463e('0x7')](''):[]);},'get':function(){return this[_0x463e('0x8')](_0x463e('0x6'))?this[_0x463e('0x8')](_0x463e('0x6'))[_0x463e('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index b4e0cb9..dde210b 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 _0xcaa1=['pick','filter','merge','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','catch','show','find','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../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','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x275266,_0x5288e0){var _0x4a044a=function(_0xa79a37){while(--_0xa79a37){_0x275266['push'](_0x275266['shift']());}};_0x4a044a(++_0x5288e0);}(_0xcaa1,0x13f));var _0x1caa=function(_0x355399,_0x143077){_0x355399=_0x355399-0x0;var _0x378e13=_0xcaa1[_0x355399];return _0x378e13;};'use strict';var pdf=require(_0x1caa('0x0'));var emlformat=require(_0x1caa('0x1'));var rimraf=require(_0x1caa('0x2'));var zipdir=require(_0x1caa('0x3'));var jsonpatch=require(_0x1caa('0x4'));var rp=require(_0x1caa('0x5'));var moment=require(_0x1caa('0x6'));var BPromise=require(_0x1caa('0x7'));var Mustache=require(_0x1caa('0x8'));var util=require(_0x1caa('0x9'));var path=require(_0x1caa('0xa'));var sox=require(_0x1caa('0xb'));var csv=require(_0x1caa('0xc'));var ejs=require(_0x1caa('0xd'));var fs=require('fs');var _=require(_0x1caa('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1caa('0xf'));var deskjs=require(_0x1caa('0x10'));var toCsv=require(_0x1caa('0xc'));var querystring=require(_0x1caa('0x11'));var Papa=require('papaparse');var Redis=require(_0x1caa('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1caa('0x13'))(_0x1caa('0x14'));var utils=require(_0x1caa('0x15'));var config=require(_0x1caa('0x16'));var licenseUtil=require(_0x1caa('0x17'));var db=require(_0x1caa('0x18'))['db'];function respondWithStatusCode(_0x12b582,_0x3380cc){_0x3380cc=_0x3380cc||0xcc;return function(_0x41f976){if(_0x41f976){return _0x12b582[_0x1caa('0x19')](_0x3380cc);}return _0x12b582[_0x1caa('0x1a')](_0x3380cc)[_0x1caa('0x1b')]();};}function respondWithResult(_0x17cc35,_0x38d2c8){_0x38d2c8=_0x38d2c8||0xc8;return function(_0x5fcbe1){if(_0x5fcbe1){return _0x17cc35[_0x1caa('0x1a')](_0x38d2c8)[_0x1caa('0x1c')](_0x5fcbe1);}};}function respondWithFilteredResult(_0x39f5f5,_0x216e74){return function(_0x23e5c8){if(_0x23e5c8){var _0x25cacd=_0x23e5c8[_0x1caa('0x1d')],_0x2a76a8=_0x216e74[_0x1caa('0x1e')],_0x58c088=_0x216e74[_0x1caa('0x1e')]+_0x216e74[_0x1caa('0x1f')],_0x1c96bf;if(_0x58c088>=_0x25cacd){_0x58c088=_0x25cacd;_0x1c96bf=0xc8;}else{_0x1c96bf=0xce;}_0x39f5f5[_0x1caa('0x1a')](_0x1c96bf);return _0x39f5f5[_0x1caa('0x20')](_0x1caa('0x21'),_0x2a76a8+'-'+_0x58c088+'/'+_0x25cacd)['json'](_0x23e5c8);}return null;};}function patchUpdates(_0x4c1b9c){return function(_0x453e52){try{jsonpatch[_0x1caa('0x22')](_0x453e52,_0x4c1b9c,!![]);}catch(_0x41b1c3){return BPromise[_0x1caa('0x23')](_0x41b1c3);}return _0x453e52[_0x1caa('0x24')]();};}function saveUpdates(_0x2bab7c,_0x42e263){return function(_0x1443c8){if(_0x1443c8){return _0x1443c8[_0x1caa('0x25')](_0x2bab7c)[_0x1caa('0x26')](function(_0x55f71f){return _0x55f71f;});}return null;};}function removeEntity(_0x57237c,_0x7c2634){return function(_0x49cf1f){if(_0x49cf1f){return _0x49cf1f[_0x1caa('0x27')]()['then'](function(){_0x57237c[_0x1caa('0x1a')](0xcc)[_0x1caa('0x1b')]();});}};}function handleEntityNotFound(_0x106c7b,_0x320814){return function(_0x222f57){if(!_0x222f57){_0x106c7b['sendStatus'](0x194);}return _0x222f57;};}function handleError(_0x580dac,_0x18aa91){_0x18aa91=_0x18aa91||0x1f4;return function(_0x2e39a0){logger[_0x1caa('0x28')](_0x2e39a0['stack']);if(_0x2e39a0['name']){delete _0x2e39a0[_0x1caa('0x29')];}_0x580dac['status'](_0x18aa91)[_0x1caa('0x2a')](_0x2e39a0);};}exports['index']=function(_0x3d0a57,_0x2358ee){var _0x19ddca={},_0x412d7e={},_0x5065e9={'count':0x0,'rows':[]};var _0xaf0d27=_[_0x1caa('0x2b')](db['UserProfileSection'][_0x1caa('0x2c')],function(_0x374646){return{'name':_0x374646[_0x1caa('0x2d')],'type':_0x374646[_0x1caa('0x2e')][_0x1caa('0x2f')]};});_0x412d7e[_0x1caa('0x30')]=_[_0x1caa('0x2b')](_0xaf0d27,_0x1caa('0x29'));_0x412d7e[_0x1caa('0x31')]=_[_0x1caa('0x32')](_0x3d0a57['query']);_0x412d7e[_0x1caa('0x33')]=_[_0x1caa('0x34')](_0x412d7e[_0x1caa('0x30')],_0x412d7e[_0x1caa('0x31')]);_0x19ddca[_0x1caa('0x35')]=_[_0x1caa('0x34')](_0x412d7e[_0x1caa('0x30')],qs[_0x1caa('0x36')](_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x36')]));_0x19ddca[_0x1caa('0x35')]=_0x19ddca[_0x1caa('0x35')][_0x1caa('0x37')]?_0x19ddca[_0x1caa('0x35')]:_0x412d7e[_0x1caa('0x30')];if(!_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x38')](_0x1caa('0x39'))){_0x19ddca[_0x1caa('0x1f')]=qs[_0x1caa('0x1f')](_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x1f')]);_0x19ddca[_0x1caa('0x1e')]=qs[_0x1caa('0x1e')](_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x1e')]);}_0x19ddca[_0x1caa('0x3a')]=qs[_0x1caa('0x3b')](_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x3b')]);_0x19ddca[_0x1caa('0x3c')]=qs['filters'](_[_0x1caa('0x3d')](_0x3d0a57[_0x1caa('0x31')],_0x412d7e[_0x1caa('0x33')]),_0xaf0d27);if(_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x3e')]){_0x19ddca[_0x1caa('0x3c')]=_[_0x1caa('0x3f')](_0x19ddca['where'],{'$or':_[_0x1caa('0x2b')](_0xaf0d27,function(_0x43794f){if(_0x43794f[_0x1caa('0x2e')]!==_0x1caa('0x40')){var _0x918a84={};_0x918a84[_0x43794f[_0x1caa('0x29')]]={'$like':'%'+_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x3e')]+'%'};return _0x918a84;}})});}_0x19ddca=_[_0x1caa('0x3f')]({},_0x19ddca,_0x3d0a57[_0x1caa('0x41')]);var _0x5edda9={'where':_0x19ddca[_0x1caa('0x3c')]};return db[_0x1caa('0x42')][_0x1caa('0x1d')](_0x5edda9)[_0x1caa('0x26')](function(_0x25eb46){_0x5065e9[_0x1caa('0x1d')]=_0x25eb46;if(_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x43')]){_0x19ddca[_0x1caa('0x44')]=[{'all':!![]}];}return db[_0x1caa('0x42')][_0x1caa('0x45')](_0x19ddca);})['then'](function(_0x383ded){_0x5065e9['rows']=_0x383ded;return _0x5065e9;})[_0x1caa('0x26')](respondWithFilteredResult(_0x2358ee,_0x19ddca))[_0x1caa('0x46')](handleError(_0x2358ee,null));};exports[_0x1caa('0x47')]=function(_0x3f8c51,_0xd87dfc){var _0x4b57b8={'raw':![],'where':{'id':_0x3f8c51['params']['id']}},_0x381af5={};_0x381af5[_0x1caa('0x30')]=_[_0x1caa('0x32')](db[_0x1caa('0x42')][_0x1caa('0x2c')]);_0x381af5['query']=_[_0x1caa('0x32')](_0x3f8c51['query']);_0x381af5[_0x1caa('0x33')]=_[_0x1caa('0x34')](_0x381af5[_0x1caa('0x30')],_0x381af5[_0x1caa('0x31')]);_0x4b57b8[_0x1caa('0x35')]=_[_0x1caa('0x34')](_0x381af5[_0x1caa('0x30')],qs['fields'](_0x3f8c51[_0x1caa('0x31')][_0x1caa('0x36')]));_0x4b57b8[_0x1caa('0x35')]=_0x4b57b8[_0x1caa('0x35')]['length']?_0x4b57b8[_0x1caa('0x35')]:_0x381af5[_0x1caa('0x30')];if(_0x3f8c51[_0x1caa('0x31')][_0x1caa('0x43')]){_0x4b57b8['include']=[{'all':!![]}];}_0x4b57b8=_[_0x1caa('0x3f')]({},_0x4b57b8,_0x3f8c51[_0x1caa('0x41')]);return db[_0x1caa('0x42')][_0x1caa('0x48')](_0x4b57b8)[_0x1caa('0x26')](handleEntityNotFound(_0xd87dfc,null))['then'](respondWithResult(_0xd87dfc,null))[_0x1caa('0x46')](handleError(_0xd87dfc,null));};exports['create']=function(_0x354e5b,_0x6a4a77){return db[_0x1caa('0x42')]['create'](_0x354e5b[_0x1caa('0x49')],{})['then'](respondWithResult(_0x6a4a77,0xc9))[_0x1caa('0x46')](handleError(_0x6a4a77,null));};exports['update']=function(_0x599ec1,_0x231ecd){if(_0x599ec1[_0x1caa('0x49')]['id']){delete _0x599ec1[_0x1caa('0x49')]['id'];}return db[_0x1caa('0x42')][_0x1caa('0x48')]({'where':{'id':_0x599ec1[_0x1caa('0x4a')]['id']}})[_0x1caa('0x26')](handleEntityNotFound(_0x231ecd,null))[_0x1caa('0x26')](saveUpdates(_0x599ec1[_0x1caa('0x49')],null))[_0x1caa('0x26')](respondWithResult(_0x231ecd,null))[_0x1caa('0x46')](handleError(_0x231ecd,null));};exports[_0x1caa('0x27')]=function(_0x382fa7,_0x35f7e8){return db['UserProfileSection'][_0x1caa('0x48')]({'where':{'id':_0x382fa7[_0x1caa('0x4a')]['id']}})['then'](handleEntityNotFound(_0x35f7e8,null))[_0x1caa('0x26')](removeEntity(_0x35f7e8,null))[_0x1caa('0x46')](handleError(_0x35f7e8,null));};exports[_0x1caa('0x4b')]=function(_0x2fb825,_0x201e35){return db['UserProfileSection']['describe']()[_0x1caa('0x26')](respondWithResult(_0x201e35,null))[_0x1caa('0x46')](handleError(_0x201e35,null));}; \ No newline at end of file +var _0x5c35=['catch','show','params','length','UserProfileSection','find','create','body','describe','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','index','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x5c35,0x1f3));var _0x55c3=function(_0xd7e0a3,_0x4bd5a6){_0xd7e0a3=_0xd7e0a3-0x0;var _0x2e010d=_0x5c35[_0xd7e0a3];return _0x2e010d;};'use strict';var pdf=require(_0x55c3('0x0'));var emlformat=require(_0x55c3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x55c3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x55c3('0x3'));var moment=require('moment');var BPromise=require(_0x55c3('0x4'));var Mustache=require(_0x55c3('0x5'));var util=require(_0x55c3('0x6'));var path=require(_0x55c3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x55c3('0x8'));var fs=require('fs');var _=require(_0x55c3('0x9'));var squel=require(_0x55c3('0xa'));var crypto=require(_0x55c3('0xb'));var jsforce=require(_0x55c3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x55c3('0xd'));var querystring=require(_0x55c3('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x55c3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x55c3('0x10'))(_0x55c3('0x11'));var utils=require(_0x55c3('0x12'));var config=require(_0x55c3('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d223b,_0x125344){_0x125344=_0x125344||0xcc;return function(_0x237e5c){if(_0x237e5c){return _0x3d223b[_0x55c3('0x14')](_0x125344);}return _0x3d223b['status'](_0x125344)[_0x55c3('0x15')]();};}function respondWithResult(_0x338aaa,_0x2f6f17){_0x2f6f17=_0x2f6f17||0xc8;return function(_0x299e69){if(_0x299e69){return _0x338aaa['status'](_0x2f6f17)[_0x55c3('0x16')](_0x299e69);}};}function respondWithFilteredResult(_0x40bbf7,_0x31b2b3){return function(_0x5ee48f){if(_0x5ee48f){var _0x2b604b=_0x5ee48f[_0x55c3('0x17')],_0x5b9ebb=_0x31b2b3[_0x55c3('0x18')],_0x48c55a=_0x31b2b3[_0x55c3('0x18')]+_0x31b2b3['limit'],_0x31302d;if(_0x48c55a>=_0x2b604b){_0x48c55a=_0x2b604b;_0x31302d=0xc8;}else{_0x31302d=0xce;}_0x40bbf7[_0x55c3('0x19')](_0x31302d);return _0x40bbf7[_0x55c3('0x1a')](_0x55c3('0x1b'),_0x5b9ebb+'-'+_0x48c55a+'/'+_0x2b604b)[_0x55c3('0x16')](_0x5ee48f);}return null;};}function patchUpdates(_0x22cb5b){return function(_0x500050){try{jsonpatch[_0x55c3('0x1c')](_0x500050,_0x22cb5b,!![]);}catch(_0x1ab279){return BPromise[_0x55c3('0x1d')](_0x1ab279);}return _0x500050['save']();};}function saveUpdates(_0xb00ffb,_0x1cc816){return function(_0x44df62){if(_0x44df62){return _0x44df62[_0x55c3('0x1e')](_0xb00ffb)[_0x55c3('0x1f')](function(_0x459836){return _0x459836;});}return null;};}function removeEntity(_0x5ac074,_0x21c016){return function(_0x358491){if(_0x358491){return _0x358491[_0x55c3('0x20')]()[_0x55c3('0x1f')](function(){_0x5ac074[_0x55c3('0x19')](0xcc)[_0x55c3('0x15')]();});}};}function handleEntityNotFound(_0x456a50,_0x459f71){return function(_0x1b8df8){if(!_0x1b8df8){_0x456a50[_0x55c3('0x14')](0x194);}return _0x1b8df8;};}function handleError(_0x437339,_0x3046ce){_0x3046ce=_0x3046ce||0x1f4;return function(_0x2e4ee5){logger[_0x55c3('0x21')](_0x2e4ee5[_0x55c3('0x22')]);if(_0x2e4ee5['name']){delete _0x2e4ee5['name'];}_0x437339[_0x55c3('0x19')](_0x3046ce)['send'](_0x2e4ee5);};}exports[_0x55c3('0x23')]=function(_0x15201c,_0x29f036){var _0x26969d={},_0x402ba4={},_0x462823={'count':0x0,'rows':[]};var _0x131a71=_['map'](db['UserProfileSection'][_0x55c3('0x24')],function(_0x23a6c4){return{'name':_0x23a6c4[_0x55c3('0x25')],'type':_0x23a6c4[_0x55c3('0x26')]['key']};});_0x402ba4[_0x55c3('0x27')]=_[_0x55c3('0x28')](_0x131a71,_0x55c3('0x29'));_0x402ba4[_0x55c3('0x2a')]=_[_0x55c3('0x2b')](_0x15201c['query']);_0x402ba4[_0x55c3('0x2c')]=_[_0x55c3('0x2d')](_0x402ba4[_0x55c3('0x27')],_0x402ba4['query']);_0x26969d[_0x55c3('0x2e')]=_[_0x55c3('0x2d')](_0x402ba4[_0x55c3('0x27')],qs['fields'](_0x15201c['query'][_0x55c3('0x2f')]));_0x26969d[_0x55c3('0x2e')]=_0x26969d[_0x55c3('0x2e')]['length']?_0x26969d[_0x55c3('0x2e')]:_0x402ba4[_0x55c3('0x27')];if(!_0x15201c['query'][_0x55c3('0x30')]('nolimit')){_0x26969d[_0x55c3('0x31')]=qs['limit'](_0x15201c[_0x55c3('0x2a')][_0x55c3('0x31')]);_0x26969d[_0x55c3('0x18')]=qs[_0x55c3('0x18')](_0x15201c[_0x55c3('0x2a')][_0x55c3('0x18')]);}_0x26969d[_0x55c3('0x32')]=qs['sort'](_0x15201c[_0x55c3('0x2a')][_0x55c3('0x33')]);_0x26969d[_0x55c3('0x34')]=qs[_0x55c3('0x2c')](_[_0x55c3('0x35')](_0x15201c['query'],_0x402ba4[_0x55c3('0x2c')]),_0x131a71);if(_0x15201c[_0x55c3('0x2a')][_0x55c3('0x36')]){_0x26969d[_0x55c3('0x34')]=_['merge'](_0x26969d['where'],{'$or':_[_0x55c3('0x28')](_0x131a71,function(_0x3c0ed8){if(_0x3c0ed8[_0x55c3('0x26')]!==_0x55c3('0x37')){var _0x4a7569={};_0x4a7569[_0x3c0ed8[_0x55c3('0x29')]]={'$like':'%'+_0x15201c[_0x55c3('0x2a')][_0x55c3('0x36')]+'%'};return _0x4a7569;}})});}_0x26969d=_[_0x55c3('0x38')]({},_0x26969d,_0x15201c[_0x55c3('0x39')]);var _0x4175de={'where':_0x26969d['where']};return db['UserProfileSection'][_0x55c3('0x17')](_0x4175de)[_0x55c3('0x1f')](function(_0x32cabc){_0x462823[_0x55c3('0x17')]=_0x32cabc;if(_0x15201c[_0x55c3('0x2a')][_0x55c3('0x3a')]){_0x26969d[_0x55c3('0x3b')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x26969d);})[_0x55c3('0x1f')](function(_0xbce7f){_0x462823[_0x55c3('0x3c')]=_0xbce7f;return _0x462823;})['then'](respondWithFilteredResult(_0x29f036,_0x26969d))[_0x55c3('0x3d')](handleError(_0x29f036,null));};exports[_0x55c3('0x3e')]=function(_0xd8a442,_0x4298e2){var _0x785896={'raw':![],'where':{'id':_0xd8a442[_0x55c3('0x3f')]['id']}},_0x59d099={};_0x59d099[_0x55c3('0x27')]=_[_0x55c3('0x2b')](db['UserProfileSection'][_0x55c3('0x24')]);_0x59d099['query']=_['keys'](_0xd8a442[_0x55c3('0x2a')]);_0x59d099[_0x55c3('0x2c')]=_[_0x55c3('0x2d')](_0x59d099['model'],_0x59d099[_0x55c3('0x2a')]);_0x785896[_0x55c3('0x2e')]=_[_0x55c3('0x2d')](_0x59d099[_0x55c3('0x27')],qs[_0x55c3('0x2f')](_0xd8a442['query'][_0x55c3('0x2f')]));_0x785896['attributes']=_0x785896[_0x55c3('0x2e')][_0x55c3('0x40')]?_0x785896[_0x55c3('0x2e')]:_0x59d099[_0x55c3('0x27')];if(_0xd8a442[_0x55c3('0x2a')]['includeAll']){_0x785896['include']=[{'all':!![]}];}_0x785896=_['merge']({},_0x785896,_0xd8a442[_0x55c3('0x39')]);return db[_0x55c3('0x41')][_0x55c3('0x42')](_0x785896)[_0x55c3('0x1f')](handleEntityNotFound(_0x4298e2,null))[_0x55c3('0x1f')](respondWithResult(_0x4298e2,null))['catch'](handleError(_0x4298e2,null));};exports[_0x55c3('0x43')]=function(_0x8390ae,_0x2c4f56){return db[_0x55c3('0x41')]['create'](_0x8390ae[_0x55c3('0x44')],{})['then'](respondWithResult(_0x2c4f56,0xc9))[_0x55c3('0x3d')](handleError(_0x2c4f56,null));};exports[_0x55c3('0x1e')]=function(_0x1aff5f,_0x50f7a0){if(_0x1aff5f['body']['id']){delete _0x1aff5f['body']['id'];}return db[_0x55c3('0x41')][_0x55c3('0x42')]({'where':{'id':_0x1aff5f[_0x55c3('0x3f')]['id']}})[_0x55c3('0x1f')](handleEntityNotFound(_0x50f7a0,null))[_0x55c3('0x1f')](saveUpdates(_0x1aff5f[_0x55c3('0x44')],null))[_0x55c3('0x1f')](respondWithResult(_0x50f7a0,null))[_0x55c3('0x3d')](handleError(_0x50f7a0,null));};exports[_0x55c3('0x20')]=function(_0x4f5050,_0x12c395){return db[_0x55c3('0x41')][_0x55c3('0x42')]({'where':{'id':_0x4f5050[_0x55c3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x12c395,null))[_0x55c3('0x1f')](removeEntity(_0x12c395,null))[_0x55c3('0x3d')](handleError(_0x12c395,null));};exports[_0x55c3('0x45')]=function(_0x2468ae,_0x39c5cb){return db[_0x55c3('0x41')][_0x55c3('0x45')]()[_0x55c3('0x1f')](respondWithResult(_0x39c5cb,null))['catch'](handleError(_0x39c5cb,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 671d98c..de58855 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 _0x61d7=['../../config/logger','api','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','user_profile_has_sections','compositeIndex','sectionId','lodash'];(function(_0x52d61b,_0x430fb9){var _0x31b5f7=function(_0x3a7164){while(--_0x3a7164){_0x52d61b['push'](_0x52d61b['shift']());}};_0x31b5f7(++_0x430fb9);}(_0x61d7,0xef));var _0x761d=function(_0x17b2cd,_0x543996){_0x17b2cd=_0x17b2cd-0x0;var _0x539069=_0x61d7[_0x17b2cd];return _0x539069;};'use strict';var _=require(_0x761d('0x0'));var util=require('util');var logger=require(_0x761d('0x1'))(_0x761d('0x2'));var moment=require('moment');var BPromise=require(_0x761d('0x3'));var rp=require(_0x761d('0x4'));var fs=require('fs');var path=require(_0x761d('0x5'));var rimraf=require(_0x761d('0x6'));var config=require('../../config/environment');var attributes=require(_0x761d('0x7'));module[_0x761d('0x8')]=function(_0x17c295,_0x13e509){return _0x17c295['define']('UserProfileSection',attributes,{'tableName':_0x761d('0x9'),'paranoid':![],'indexes':[{'name':_0x761d('0xa'),'fields':[_0x761d('0xb'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x12c9=['UserProfileSection','user_profile_has_sections','sectionId','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define'];(function(_0x4c90bc,_0x3a595d){var _0x38ad08=function(_0x52b81f){while(--_0x52b81f){_0x4c90bc['push'](_0x4c90bc['shift']());}};_0x38ad08(++_0x3a595d);}(_0x12c9,0x9f));var _0x912c=function(_0x17aedb,_0x14aed6){_0x17aedb=_0x17aedb-0x0;var _0x39c744=_0x12c9[_0x17aedb];return _0x39c744;};'use strict';var _=require(_0x912c('0x0'));var util=require('util');var logger=require(_0x912c('0x1'))('api');var moment=require(_0x912c('0x2'));var BPromise=require('bluebird');var rp=require(_0x912c('0x3'));var fs=require('fs');var path=require(_0x912c('0x4'));var rimraf=require(_0x912c('0x5'));var config=require(_0x912c('0x6'));var attributes=require(_0x912c('0x7'));module[_0x912c('0x8')]=function(_0x572179,_0x5daa7d){return _0x572179[_0x912c('0x9')](_0x912c('0xa'),attributes,{'tableName':_0x912c('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x912c('0xc'),'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 0324707..1dba490 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 _0x6f76=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x55ac35,_0xe3de64){var _0x149f53=function(_0x458866){while(--_0x458866){_0x55ac35['push'](_0x55ac35['shift']());}};_0x149f53(++_0xe3de64);}(_0x6f76,0x14a));var _0x66f7=function(_0x326902,_0x31c562){_0x326902=_0x326902-0x0;var _0x3ec109=_0x6f76[_0x326902];return _0x3ec109;};'use strict';var _=require(_0x66f7('0x0'));var util=require('util');var moment=require(_0x66f7('0x1'));var BPromise=require('bluebird');var rs=require(_0x66f7('0x2'));var fs=require('fs');var Redis=require(_0x66f7('0x3'));var db=require(_0x66f7('0x4'))['db'];var utils=require(_0x66f7('0x5'));var logger=require(_0x66f7('0x6'))('rpc');var config=require(_0x66f7('0x7'));var jayson=require(_0x66f7('0x8'));var client=jayson[_0x66f7('0x9')][_0x66f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7c32a,_0x34d73f,_0x34cdb5){return new BPromise(function(_0x4cbf9d,_0x5693f5){return client['request'](_0x7c32a,_0x34cdb5)[_0x66f7('0xb')](function(_0x3e30a9){logger[_0x66f7('0xc')](_0x66f7('0xd'),_0x34d73f,_0x66f7('0xe'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x34d73f,_0x66f7('0xe'),JSON[_0x66f7('0xf')](_0x3e30a9));if(_0x3e30a9['error']){if(_0x3e30a9[_0x66f7('0x10')][_0x66f7('0x11')]===0x1f4){logger[_0x66f7('0x10')](_0x66f7('0xd'),_0x34d73f,_0x3e30a9[_0x66f7('0x10')]['message']);return _0x5693f5(_0x3e30a9[_0x66f7('0x10')][_0x66f7('0x12')]);}logger['error'](_0x66f7('0xd'),_0x34d73f,_0x3e30a9[_0x66f7('0x10')][_0x66f7('0x12')]);return _0x4cbf9d(_0x3e30a9[_0x66f7('0x10')]['message']);}else{logger['info'](_0x66f7('0xd'),_0x34d73f,'request\x20sent');_0x4cbf9d(_0x3e30a9[_0x66f7('0x13')]['message']);}})[_0x66f7('0x14')](function(_0x444f9f){logger[_0x66f7('0x10')](_0x66f7('0xd'),_0x34d73f,_0x444f9f);_0x5693f5(_0x444f9f);});});} \ No newline at end of file +var _0x6a82=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x1af22a,_0x53b914){var _0x4b47dc=function(_0x7ea822){while(--_0x7ea822){_0x1af22a['push'](_0x1af22a['shift']());}};_0x4b47dc(++_0x53b914);}(_0x6a82,0x1e4));var _0x26a8=function(_0x306891,_0x458e3a){_0x306891=_0x306891-0x0;var _0x2e223a=_0x6a82[_0x306891];return _0x2e223a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x26a8('0x0'));var BPromise=require(_0x26a8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26a8('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x26a8('0x3'))(_0x26a8('0x4'));var config=require(_0x26a8('0x5'));var jayson=require(_0x26a8('0x6'));var client=jayson[_0x26a8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3250d1,_0xd97eef,_0x4e7b30){return new BPromise(function(_0x2b8bdb,_0x1b2c2f){return client['request'](_0x3250d1,_0x4e7b30)[_0x26a8('0x8')](function(_0x469dd0){logger[_0x26a8('0x9')](_0x26a8('0xa'),_0xd97eef,_0x26a8('0xb'));logger[_0x26a8('0xc')](_0x26a8('0xd'),_0xd97eef,_0x26a8('0xb'),JSON[_0x26a8('0xe')](_0x469dd0));if(_0x469dd0[_0x26a8('0xf')]){if(_0x469dd0[_0x26a8('0xf')][_0x26a8('0x10')]===0x1f4){logger[_0x26a8('0xf')](_0x26a8('0xa'),_0xd97eef,_0x469dd0[_0x26a8('0xf')]['message']);return _0x1b2c2f(_0x469dd0[_0x26a8('0xf')][_0x26a8('0x11')]);}logger[_0x26a8('0xf')](_0x26a8('0xa'),_0xd97eef,_0x469dd0['error']['message']);return _0x2b8bdb(_0x469dd0[_0x26a8('0xf')][_0x26a8('0x11')]);}else{logger['info'](_0x26a8('0xa'),_0xd97eef,_0x26a8('0xb'));_0x2b8bdb(_0x469dd0['result'][_0x26a8('0x11')]);}})['catch'](function(_0x384767){logger[_0x26a8('0xf')](_0x26a8('0xa'),_0xd97eef,_0x384767);_0x1b2c2f(_0x384767);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 09ef26a..3c1d686 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 _0x2a40=['multer','util','path','connect-timeout','express','exports'];(function(_0x432169,_0x7ffbe9){var _0x28e745=function(_0x810c68){while(--_0x810c68){_0x432169['push'](_0x432169['shift']());}};_0x28e745(++_0x7ffbe9);}(_0x2a40,0x14a));var _0x02a4=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0x2a40[_0x3c22e0];return _0x215811;};'use strict';var multer=require(_0x02a4('0x0'));var util=require(_0x02a4('0x1'));var path=require(_0x02a4('0x2'));var timeout=require(_0x02a4('0x3'));var express=require(_0x02a4('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x02a4('0x5')]=router; \ No newline at end of file +var _0x5f2e=['../../components/auth/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2eedc9,_0xc4a51e){var _0x357a5c=function(_0x20173f){while(--_0x20173f){_0x2eedc9['push'](_0x2eedc9['shift']());}};_0x357a5c(++_0xc4a51e);}(_0x5f2e,0x18f));var _0xe5f2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5f2e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe5f2('0x0'));var util=require(_0xe5f2('0x1'));var path=require(_0xe5f2('0x2'));var timeout=require(_0xe5f2('0x3'));var express=require(_0xe5f2('0x4'));var router=express[_0xe5f2('0x5')]();var auth=require(_0xe5f2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe5f2('0x7'));module[_0xe5f2('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 69c324c..6ebbb4a 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 _0xbaf0=['exports','INTEGER'];(function(_0x1d8a5d,_0x59a110){var _0x54d59f=function(_0x54ce10){while(--_0x54ce10){_0x1d8a5d['push'](_0x1d8a5d['shift']());}};_0x54d59f(++_0x59a110);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x10bd3d,_0x478dfb){var _0x48d6fd=function(_0xdf597f){while(--_0xdf597f){_0x10bd3d['push'](_0x10bd3d['shift']());}};_0x48d6fd(++_0x478dfb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'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/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 9471312..667239d 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 _0x1cd0=['./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1cd0,0x100));var _0x01cd=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x1cd0[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x01cd('0x0'));var util=require(_0x01cd('0x1'));var logger=require(_0x01cd('0x2'))('api');var moment=require(_0x01cd('0x3'));var BPromise=require(_0x01cd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x01cd('0x5'));var rimraf=require(_0x01cd('0x6'));var config=require(_0x01cd('0x7'));var attributes=require(_0x01cd('0x8'));module[_0x01cd('0x9')]=function(_0x5717b3,_0x57ee49){return _0x5717b3['define'](_0x01cd('0xa'),attributes,{'tableName':_0x01cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ba3=['UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x29e4d4,_0x17c66e){var _0x4b62e0=function(_0x4e2ed2){while(--_0x4e2ed2){_0x29e4d4['push'](_0x29e4d4['shift']());}};_0x4b62e0(++_0x17c66e);}(_0x4ba3,0x1be));var _0x34ba=function(_0x2c6147,_0x30daee){_0x2c6147=_0x2c6147-0x0;var _0x4bdee8=_0x4ba3[_0x2c6147];return _0x4bdee8;};'use strict';var _=require(_0x34ba('0x0'));var util=require('util');var logger=require(_0x34ba('0x1'))(_0x34ba('0x2'));var moment=require(_0x34ba('0x3'));var BPromise=require(_0x34ba('0x4'));var rp=require(_0x34ba('0x5'));var fs=require('fs');var path=require(_0x34ba('0x6'));var rimraf=require('rimraf');var config=require(_0x34ba('0x7'));var attributes=require(_0x34ba('0x8'));module[_0x34ba('0x9')]=function(_0x177cbc,_0x33f131){return _0x177cbc['define'](_0x34ba('0xa'),attributes,{'tableName':_0x34ba('0xb'),'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 77a832e..af50f49 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 _0xe220=['../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4aeb08,_0x3096ab){var _0x22c98d=function(_0x40c75b){while(--_0x40c75b){_0x4aeb08['push'](_0x4aeb08['shift']());}};_0x22c98d(++_0x3096ab);}(_0xe220,0x19a));var _0x0e22=function(_0x401779,_0x4ebb68){_0x401779=_0x401779-0x0;var _0x5e28e4=_0xe220[_0x401779];return _0x5e28e4;};'use strict';var _=require(_0x0e22('0x0'));var util=require('util');var moment=require(_0x0e22('0x1'));var BPromise=require('bluebird');var rs=require(_0x0e22('0x2'));var fs=require('fs');var Redis=require(_0x0e22('0x3'));var db=require(_0x0e22('0x4'))['db'];var utils=require(_0x0e22('0x5'));var logger=require(_0x0e22('0x6'))(_0x0e22('0x7'));var config=require(_0x0e22('0x8'));var jayson=require(_0x0e22('0x9'));var client=jayson['client'][_0x0e22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e4a25,_0x2baafe,_0x4a236b){return new BPromise(function(_0x260256,_0x18b83a){return client[_0x0e22('0xb')](_0x1e4a25,_0x4a236b)[_0x0e22('0xc')](function(_0x9c4417){logger[_0x0e22('0xd')](_0x0e22('0xe'),_0x2baafe,_0x0e22('0xf'));logger[_0x0e22('0x10')](_0x0e22('0x11'),_0x2baafe,_0x0e22('0xf'),JSON[_0x0e22('0x12')](_0x9c4417));if(_0x9c4417['error']){if(_0x9c4417[_0x0e22('0x13')][_0x0e22('0x14')]===0x1f4){logger[_0x0e22('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x2baafe,_0x9c4417['error'][_0x0e22('0x15')]);return _0x18b83a(_0x9c4417['error'][_0x0e22('0x15')]);}logger[_0x0e22('0x13')](_0x0e22('0xe'),_0x2baafe,_0x9c4417['error'][_0x0e22('0x15')]);return _0x260256(_0x9c4417[_0x0e22('0x13')]['message']);}else{logger[_0x0e22('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x2baafe,'request\x20sent');_0x260256(_0x9c4417['result']['message']);}})['catch'](function(_0x5975fb){logger[_0x0e22('0x13')](_0x0e22('0xe'),_0x2baafe,_0x5975fb);_0x18b83a(_0x5975fb);});});} \ No newline at end of file +var _0x4bc0=['jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x4f6272,_0x53b79c){var _0x1b5ae5=function(_0x3099ef){while(--_0x3099ef){_0x4f6272['push'](_0x4f6272['shift']());}};_0x1b5ae5(++_0x53b79c);}(_0x4bc0,0x1b9));var _0x04bc=function(_0x4395a2,_0x32b172){_0x4395a2=_0x4395a2-0x0;var _0x220099=_0x4bc0[_0x4395a2];return _0x220099;};'use strict';var _=require(_0x04bc('0x0'));var util=require(_0x04bc('0x1'));var moment=require(_0x04bc('0x2'));var BPromise=require(_0x04bc('0x3'));var rs=require(_0x04bc('0x4'));var fs=require('fs');var Redis=require(_0x04bc('0x5'));var db=require(_0x04bc('0x6'))['db'];var utils=require(_0x04bc('0x7'));var logger=require('../../config/logger')(_0x04bc('0x8'));var config=require('../../config/environment');var jayson=require(_0x04bc('0x9'));var client=jayson[_0x04bc('0xa')][_0x04bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45aa30,_0x113c80,_0x550159){return new BPromise(function(_0x48dac3,_0x2e7552){return client[_0x04bc('0xc')](_0x45aa30,_0x550159)[_0x04bc('0xd')](function(_0x54d954){logger['info'](_0x04bc('0xe'),_0x113c80,_0x04bc('0xf'));logger[_0x04bc('0x10')](_0x04bc('0x11'),_0x113c80,'request\x20sent',JSON[_0x04bc('0x12')](_0x54d954));if(_0x54d954[_0x04bc('0x13')]){if(_0x54d954[_0x04bc('0x13')][_0x04bc('0x14')]===0x1f4){logger[_0x04bc('0x13')](_0x04bc('0xe'),_0x113c80,_0x54d954[_0x04bc('0x13')]['message']);return _0x2e7552(_0x54d954[_0x04bc('0x13')][_0x04bc('0x15')]);}logger['error'](_0x04bc('0xe'),_0x113c80,_0x54d954[_0x04bc('0x13')]['message']);return _0x48dac3(_0x54d954[_0x04bc('0x13')]['message']);}else{logger[_0x04bc('0x16')](_0x04bc('0xe'),_0x113c80,_0x04bc('0xf'));_0x48dac3(_0x54d954[_0x04bc('0x17')]['message']);}})[_0x04bc('0x18')](function(_0xd55d11){logger[_0x04bc('0x13')](_0x04bc('0xe'),_0x113c80,_0xd55d11);_0x2e7552(_0xd55d11);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 16b4714..3b0fb05 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 _0xc501=['express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x493b70,_0x168e73){var _0x4c2355=function(_0x1e0247){while(--_0x1e0247){_0x493b70['push'](_0x493b70['shift']());}};_0x4c2355(++_0x168e73);}(_0xc501,0x9d));var _0x1c50=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0xc501[_0x587693];return _0x510a1a;};'use strict';var multer=require(_0x1c50('0x0'));var util=require(_0x1c50('0x1'));var path=require(_0x1c50('0x2'));var timeout=require('connect-timeout');var express=require(_0x1c50('0x3'));var router=express[_0x1c50('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1c50('0x5'));var config=require(_0x1c50('0x6'));module[_0x1c50('0x7')]=router; \ No newline at end of file +var _0xe920=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','express','Router'];(function(_0x421ee1,_0x105733){var _0xce2fa0=function(_0x1780aa){while(--_0x1780aa){_0x421ee1['push'](_0x421ee1['shift']());}};_0xce2fa0(++_0x105733);}(_0xe920,0x11c));var _0x0e92=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0xe920[_0x2fee96];return _0x2e6ad1;};'use strict';var multer=require(_0x0e92('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0e92('0x1'));var router=express[_0x0e92('0x2')]();var auth=require(_0x0e92('0x3'));var interaction=require(_0x0e92('0x4'));var config=require(_0x0e92('0x5'));module[_0x0e92('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 60fe6d5..05998ba 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 _0xbaf0=['exports','INTEGER'];(function(_0xe7d655,_0x184955){var _0x3e4804=function(_0x5cebfb){while(--_0x5cebfb){_0xe7d655['push'](_0xe7d655['shift']());}};_0x3e4804(++_0x184955);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x5e305f,_0x1ea547){var _0x522802=function(_0x15d613){while(--_0x15d613){_0x5e305f['push'](_0x5e305f['shift']());}};_0x522802(++_0x1ea547);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'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 0ecfc2c..3983aae 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 _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x9a19,0x114));var _0x99a1=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x9a19[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe107=['define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0xe107,0xb3));var _0x7e10=function(_0x3c9c80,_0x418a0e){_0x3c9c80=_0x3c9c80-0x0;var _0x4a1d47=_0xe107[_0x3c9c80];return _0x4a1d47;};'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('path');var rimraf=require('rimraf');var config=require(_0x7e10('0x5'));var attributes=require(_0x7e10('0x6'));module[_0x7e10('0x7')]=function(_0x5be19f,_0x5f1edf){return _0x5be19f[_0x7e10('0x8')](_0x7e10('0x9'),attributes,{'tableName':_0x7e10('0xa'),'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 f5b5e58..5299ff9 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 _0xb9df=['info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x252328,_0x4c22f0){var _0xaa85b7=function(_0x2623d0){while(--_0x2623d0){_0x252328['push'](_0x252328['shift']());}};_0xaa85b7(++_0x4c22f0);}(_0xb9df,0x7e));var _0xfb9d=function(_0x38aa7e,_0x285604){_0x38aa7e=_0x38aa7e-0x0;var _0x5dc22a=_0xb9df[_0x38aa7e];return _0x5dc22a;};'use strict';var _=require(_0xfb9d('0x0'));var util=require(_0xfb9d('0x1'));var moment=require(_0xfb9d('0x2'));var BPromise=require(_0xfb9d('0x3'));var rs=require(_0xfb9d('0x4'));var fs=require('fs');var Redis=require(_0xfb9d('0x5'));var db=require(_0xfb9d('0x6'))['db'];var utils=require(_0xfb9d('0x7'));var logger=require(_0xfb9d('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfb9d('0x9'));var client=jayson[_0xfb9d('0xa')][_0xfb9d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5effa6,_0x2807bd,_0x30db38){return new BPromise(function(_0x117c96,_0x4bf30d){return client['request'](_0x5effa6,_0x30db38)['then'](function(_0x24d039){logger[_0xfb9d('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x2807bd,_0xfb9d('0xd'));logger[_0xfb9d('0xe')](_0xfb9d('0xf'),_0x2807bd,_0xfb9d('0xd'),JSON[_0xfb9d('0x10')](_0x24d039));if(_0x24d039['error']){if(_0x24d039[_0xfb9d('0x11')][_0xfb9d('0x12')]===0x1f4){logger[_0xfb9d('0x11')](_0xfb9d('0x13'),_0x2807bd,_0x24d039['error'][_0xfb9d('0x14')]);return _0x4bf30d(_0x24d039[_0xfb9d('0x11')][_0xfb9d('0x14')]);}logger['error'](_0xfb9d('0x13'),_0x2807bd,_0x24d039['error'][_0xfb9d('0x14')]);return _0x117c96(_0x24d039[_0xfb9d('0x11')][_0xfb9d('0x14')]);}else{logger[_0xfb9d('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x2807bd,_0xfb9d('0xd'));_0x117c96(_0x24d039[_0xfb9d('0x15')][_0xfb9d('0x14')]);}})[_0xfb9d('0x16')](function(_0x71ad65){logger[_0xfb9d('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x2807bd,_0x71ad65);_0x4bf30d(_0x71ad65);});});} \ No newline at end of file +var _0x0280=['info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request'];(function(_0x3f4f80,_0x258927){var _0x116313=function(_0x331463){while(--_0x331463){_0x3f4f80['push'](_0x3f4f80['shift']());}};_0x116313(++_0x258927);}(_0x0280,0xc4));var _0x0028=function(_0x31ded2,_0x2fb3e2){_0x31ded2=_0x31ded2-0x0;var _0xea9b55=_0x0280[_0x31ded2];return _0xea9b55;};'use strict';var _=require('lodash');var util=require(_0x0028('0x0'));var moment=require(_0x0028('0x1'));var BPromise=require('bluebird');var rs=require(_0x0028('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0028('0x3'))['db'];var utils=require(_0x0028('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x0028('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0028('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x366a07,_0x3ee407,_0x444647){return new BPromise(function(_0x571801,_0xb49837){return client[_0x0028('0x7')](_0x366a07,_0x444647)['then'](function(_0x1799e3){logger[_0x0028('0x8')](_0x0028('0x9'),_0x3ee407,_0x0028('0xa'));logger[_0x0028('0xb')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3ee407,_0x0028('0xa'),JSON['stringify'](_0x1799e3));if(_0x1799e3[_0x0028('0xc')]){if(_0x1799e3[_0x0028('0xc')][_0x0028('0xd')]===0x1f4){logger[_0x0028('0xc')](_0x0028('0x9'),_0x3ee407,_0x1799e3[_0x0028('0xc')][_0x0028('0xe')]);return _0xb49837(_0x1799e3[_0x0028('0xc')][_0x0028('0xe')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x3ee407,_0x1799e3['error']['message']);return _0x571801(_0x1799e3['error']['message']);}else{logger[_0x0028('0x8')](_0x0028('0x9'),_0x3ee407,_0x0028('0xa'));_0x571801(_0x1799e3[_0x0028('0xf')][_0x0028('0xe')]);}})[_0x0028('0x10')](function(_0x279d55){logger[_0x0028('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x3ee407,_0x279d55);_0xb49837(_0x279d55);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index da42269..a7cfe90 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 _0x833e=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x3bcf7b,_0x2c0854){var _0x5ac4ea=function(_0x4d713a){while(--_0x4d713a){_0x3bcf7b['push'](_0x3bcf7b['shift']());}};_0x5ac4ea(++_0x2c0854);}(_0x833e,0x189));var _0xe833=function(_0x1e08cb,_0x50f0bf){_0x1e08cb=_0x1e08cb-0x0;var _0x5abcd5=_0x833e[_0x1e08cb];return _0x5abcd5;};'use strict';var multer=require(_0xe833('0x0'));var util=require(_0xe833('0x1'));var path=require(_0xe833('0x2'));var timeout=require(_0xe833('0x3'));var express=require(_0xe833('0x4'));var router=express[_0xe833('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe833('0x6'));var config=require(_0xe833('0x7'));module[_0xe833('0x8')]=router; \ No newline at end of file +var _0xb37e=['../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x4f4fb9,_0x3798bc){var _0x1d9828=function(_0x526553){while(--_0x526553){_0x4f4fb9['push'](_0x4f4fb9['shift']());}};_0x1d9828(++_0x3798bc);}(_0xb37e,0x1cb));var _0xeb37=function(_0x42e9e8,_0x23da02){_0x42e9e8=_0x42e9e8-0x0;var _0x285381=_0xb37e[_0x42e9e8];return _0x285381;};'use strict';var multer=require(_0xeb37('0x0'));var util=require(_0xeb37('0x1'));var path=require('path');var timeout=require(_0xeb37('0x2'));var express=require(_0xeb37('0x3'));var router=express['Router']();var auth=require(_0xeb37('0x4'));var interaction=require(_0xeb37('0x5'));var config=require(_0xeb37('0x6'));module[_0xeb37('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index f6d1f8d..d9bcdcd 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 _0xf820=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0xf820,0x160));var _0x0f82=function(_0x29a30c,_0x1f8372){_0x29a30c=_0x29a30c-0x0;var _0x5865f6=_0xf820[_0x29a30c];return _0x5865f6;};'use strict';var Sequelize=require(_0x0f82('0x0'));module[_0x0f82('0x1')]={'uniqueid':{'type':Sequelize[_0x0f82('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0f82('0x3')},'membername':{'type':Sequelize[_0x0f82('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0f82('0x4')],'allowNull':![],'unique':_0x0f82('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x0f82('0x4')],'allowNull':![],'unique':_0x0f82('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x0f82('0x2')](0xb),'defaultValue':0x0,'comment':_0x0f82('0x3')},'paused':{'type':Sequelize[_0x0f82('0x2')](0xb),'defaultValue':0x0,'comment':_0x0f82('0x3')}}; \ No newline at end of file +var _0xd64a=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','exports'];(function(_0x5bafd3,_0x474626){var _0x4aeb83=function(_0x4ab61a){while(--_0x4ab61a){_0x5bafd3['push'](_0x5bafd3['shift']());}};_0x4aeb83(++_0x474626);}(_0xd64a,0x1a8));var _0xad64=function(_0x526886,_0x161ea4){_0x526886=_0x526886-0x0;var _0x3352ef=_0xd64a[_0x526886];return _0x3352ef;};'use strict';var Sequelize=require('sequelize');module[_0xad64('0x0')]={'uniqueid':{'type':Sequelize[_0xad64('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xad64('0x2')},'membername':{'type':Sequelize[_0xad64('0x3')],'allowNull':![],'comment':_0xad64('0x2')},'UserId':{'type':Sequelize[_0xad64('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xad64('0x3')],'allowNull':![],'unique':_0xad64('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xad64('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0xad64('0x2')},'penalty':{'type':Sequelize[_0xad64('0x1')](0xb),'defaultValue':0x0,'comment':_0xad64('0x2')},'paused':{'type':Sequelize[_0xad64('0x1')](0xb),'defaultValue':0x0,'comment':_0xad64('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 0c581bf..19bca98 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 _0xdd7e=['UserVoiceQueueRt','setMaxListeners','save','remove','emit','hook','events','../../mysqldb'];(function(_0x414c90,_0x1d0460){var _0x1eb68a=function(_0x45ab26){while(--_0x45ab26){_0x414c90['push'](_0x414c90['shift']());}};_0x1eb68a(++_0x1d0460);}(_0xdd7e,0x9e));var _0xedd7=function(_0x4b3f65,_0x58f149){_0x4b3f65=_0x4b3f65-0x0;var _0x2e75c9=_0xdd7e[_0x4b3f65];return _0x2e75c9;};'use strict';var EventEmitter=require(_0xedd7('0x0'));var UserVoiceQueueRt=require(_0xedd7('0x1'))['db'][_0xedd7('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xedd7('0x3')](0x0);var events={'afterCreate':_0xedd7('0x4'),'afterUpdate':'update','afterDestroy':_0xedd7('0x5')};function emitEvent(_0x478d10){return function(_0x2f6e90,_0x4c6497,_0x94488f){UserVoiceQueueRtEvents['emit'](_0x478d10+':'+_0x2f6e90['id'],_0x2f6e90);UserVoiceQueueRtEvents[_0xedd7('0x6')](_0x478d10,_0x2f6e90);_0x94488f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xedd7('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x950b=['emit','hasOwnProperty','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove'];(function(_0x31d3a3,_0x3767be){var _0x4b6dda=function(_0x4ef11b){while(--_0x4ef11b){_0x31d3a3['push'](_0x31d3a3['shift']());}};_0x4b6dda(++_0x3767be);}(_0x950b,0x18f));var _0xb950=function(_0x175a8c,_0x2d9212){_0x175a8c=_0x175a8c-0x0;var _0x37b0b0=_0x950b[_0x175a8c];return _0x37b0b0;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xb950('0x0'))['db'][_0xb950('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb950('0x2')](0x0);var events={'afterCreate':_0xb950('0x3'),'afterUpdate':_0xb950('0x4'),'afterDestroy':_0xb950('0x5')};function emitEvent(_0xa58456){return function(_0x97445e,_0x5b1893,_0x5a2027){UserVoiceQueueRtEvents[_0xb950('0x6')](_0xa58456+':'+_0x97445e['id'],_0x97445e);UserVoiceQueueRtEvents[_0xb950('0x6')](_0xa58456,_0x97445e);_0x5a2027(null);};}for(var e in events){if(events[_0xb950('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xb950('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 7d39051..3c8d06a 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 _0x9a43=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt'];(function(_0x2bae23,_0x3295e8){var _0x3aae9b=function(_0x1b57f4){while(--_0x1b57f4){_0x2bae23['push'](_0x2bae23['shift']());}};_0x3aae9b(++_0x3295e8);}(_0x9a43,0xb4));var _0x39a4=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x9a43[_0x2f87cd];return _0x5d7eda;};'use strict';var _=require('lodash');var util=require(_0x39a4('0x0'));var logger=require(_0x39a4('0x1'))(_0x39a4('0x2'));var moment=require(_0x39a4('0x3'));var BPromise=require('bluebird');var rp=require(_0x39a4('0x4'));var fs=require('fs');var path=require(_0x39a4('0x5'));var rimraf=require('rimraf');var config=require(_0x39a4('0x6'));var attributes=require(_0x39a4('0x7'));module['exports']=function(_0x221045,_0x5448ce){return _0x221045['define'](_0x39a4('0x8'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87ed=['../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','api','moment','bluebird','path','rimraf'];(function(_0x23717f,_0x3fd00a){var _0x882991=function(_0x2a23ab){while(--_0x2a23ab){_0x23717f['push'](_0x23717f['shift']());}};_0x882991(++_0x3fd00a);}(_0x87ed,0x186));var _0xd87e=function(_0x3a8585,_0x1643a8){_0x3a8585=_0x3a8585-0x0;var _0x5e41d4=_0x87ed[_0x3a8585];return _0x5e41d4;};'use strict';var _=require(_0xd87e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd87e('0x1'));var moment=require(_0xd87e('0x2'));var BPromise=require(_0xd87e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd87e('0x4'));var rimraf=require(_0xd87e('0x5'));var config=require(_0xd87e('0x6'));var attributes=require(_0xd87e('0x7'));module[_0xd87e('0x8')]=function(_0x1c6e33,_0x1126cc){return _0x1c6e33[_0xd87e('0x9')](_0xd87e('0xa'),attributes,{'tableName':_0xd87e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 3a7b315..dd3fcf5 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 _0x868f=['sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','UserVoiceQueueRt','findAll','options','raw','where'];(function(_0x5c0cc1,_0xe5a5b8){var _0x235a5e=function(_0x431069){while(--_0x431069){_0x5c0cc1['push'](_0x5c0cc1['shift']());}};_0x235a5e(++_0xe5a5b8);}(_0x868f,0xef));var _0xf868=function(_0x29386d,_0x2c069b){_0x29386d=_0x29386d-0x0;var _0x1c2754=_0x868f[_0x29386d];return _0x1c2754;};'use strict';var _=require(_0xf868('0x0'));var util=require(_0xf868('0x1'));var moment=require(_0xf868('0x2'));var BPromise=require('bluebird');var rs=require(_0xf868('0x3'));var fs=require('fs');var Redis=require(_0xf868('0x4'));var db=require(_0xf868('0x5'))['db'];var utils=require(_0xf868('0x6'));var logger=require(_0xf868('0x7'))(_0xf868('0x8'));var config=require(_0xf868('0x9'));var jayson=require(_0xf868('0xa'));var client=jayson['client'][_0xf868('0xb')]({'port':0x232a});config[_0xf868('0xc')]=_[_0xf868('0xd')](config[_0xf868('0xc')],{'host':_0xf868('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf868('0xc')]));require(_0xf868('0xf'))[_0xf868('0x10')](socket);function respondWithRpcPromise(_0x8fa4f4,_0xc05e08,_0x2cf84b){return new BPromise(function(_0x568b8a,_0x3bce63){return client[_0xf868('0x11')](_0x8fa4f4,_0x2cf84b)[_0xf868('0x12')](function(_0x4cb774){logger[_0xf868('0x13')](_0xf868('0x14'),_0xc05e08,_0xf868('0x15'));logger[_0xf868('0x16')](_0xf868('0x17'),_0xc05e08,_0xf868('0x15'),JSON[_0xf868('0x18')](_0x4cb774));if(_0x4cb774['error']){if(_0x4cb774['error'][_0xf868('0x19')]===0x1f4){logger[_0xf868('0x1a')](_0xf868('0x14'),_0xc05e08,_0x4cb774[_0xf868('0x1a')][_0xf868('0x1b')]);return _0x3bce63(_0x4cb774['error'][_0xf868('0x1b')]);}logger[_0xf868('0x1a')](_0xf868('0x14'),_0xc05e08,_0x4cb774[_0xf868('0x1a')][_0xf868('0x1b')]);return _0x568b8a(_0x4cb774[_0xf868('0x1a')][_0xf868('0x1b')]);}else{logger[_0xf868('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xc05e08,_0xf868('0x15'));_0x568b8a(_0x4cb774['result'][_0xf868('0x1b')]);}})[_0xf868('0x1c')](function(_0x18378f){logger[_0xf868('0x1a')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xc05e08,_0x18378f);_0x3bce63(_0x18378f);});});}exports['GetVoiceQueueRtPauses']=function(_0x3810c7){var _0x2b8a1b=this;return new Promise(function(_0x5dbba1,_0x4ff306){return db[_0xf868('0x1d')][_0xf868('0x1e')]({'raw':_0x3810c7[_0xf868('0x1f')]?_0x3810c7[_0xf868('0x1f')][_0xf868('0x20')]===undefined?!![]:![]:!![],'where':_0x3810c7[_0xf868('0x1f')]?_0x3810c7[_0xf868('0x1f')][_0xf868('0x21')]||null:null,'attributes':[[db[_0xf868('0x22')]['fn']('COUNT',db[_0xf868('0x22')]['fn']('IF',db['sequelize'][_0xf868('0x23')](_0xf868('0x24')))),_0xf868('0x25')]]})[_0xf868('0x12')](function(_0x423663){logger[_0xf868('0x13')](_0xf868('0x26'),_0x3810c7);logger['debug'](_0xf868('0x26'),_0x3810c7,JSON[_0xf868('0x18')](_0x423663));_0x5dbba1(_0x423663);})[_0xf868('0x1c')](function(_0x1dc4c9){logger[_0xf868('0x1a')](_0xf868('0x26'),_0x1dc4c9[_0xf868('0x1b')],_0x3810c7);_0x4ff306(_0x2b8a1b[_0xf868('0x1a')](0x1f4,_0x1dc4c9[_0xf868('0x1b')]));});});}; \ No newline at end of file +var _0xb0fe=['register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket'];(function(_0x149478,_0x380771){var _0x2bcd4d=function(_0x3fa152){while(--_0x3fa152){_0x149478['push'](_0x149478['shift']());}};_0x2bcd4d(++_0x380771);}(_0xb0fe,0x1de));var _0xeb0f=function(_0x337537,_0x4ea7b8){_0x337537=_0x337537-0x0;var _0x4fdd67=_0xb0fe[_0x337537];return _0x4fdd67;};'use strict';var _=require('lodash');var util=require(_0xeb0f('0x0'));var moment=require(_0xeb0f('0x1'));var BPromise=require(_0xeb0f('0x2'));var rs=require(_0xeb0f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb0f('0x4'))['db'];var utils=require(_0xeb0f('0x5'));var logger=require(_0xeb0f('0x6'))(_0xeb0f('0x7'));var config=require('../../config/environment');var jayson=require(_0xeb0f('0x8'));var client=jayson[_0xeb0f('0x9')][_0xeb0f('0xa')]({'port':0x232a});config[_0xeb0f('0xb')]=_[_0xeb0f('0xc')](config[_0xeb0f('0xb')],{'host':_0xeb0f('0xd'),'port':0x18eb});var socket=require(_0xeb0f('0xe'))(new Redis(config['redis']));require(_0xeb0f('0xf'))[_0xeb0f('0x10')](socket);function respondWithRpcPromise(_0x22fe81,_0xef9363,_0x8d9d21){return new BPromise(function(_0x2dc336,_0x133c24){return client[_0xeb0f('0x11')](_0x22fe81,_0x8d9d21)[_0xeb0f('0x12')](function(_0x51eb0c){logger[_0xeb0f('0x13')](_0xeb0f('0x14'),_0xef9363,'request\x20sent');logger[_0xeb0f('0x15')](_0xeb0f('0x16'),_0xef9363,_0xeb0f('0x17'),JSON[_0xeb0f('0x18')](_0x51eb0c));if(_0x51eb0c[_0xeb0f('0x19')]){if(_0x51eb0c[_0xeb0f('0x19')]['code']===0x1f4){logger['error'](_0xeb0f('0x14'),_0xef9363,_0x51eb0c['error'][_0xeb0f('0x1a')]);return _0x133c24(_0x51eb0c['error'][_0xeb0f('0x1a')]);}logger[_0xeb0f('0x19')](_0xeb0f('0x14'),_0xef9363,_0x51eb0c[_0xeb0f('0x19')][_0xeb0f('0x1a')]);return _0x2dc336(_0x51eb0c[_0xeb0f('0x19')]['message']);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0xef9363,_0xeb0f('0x17'));_0x2dc336(_0x51eb0c[_0xeb0f('0x1b')]['message']);}})[_0xeb0f('0x1c')](function(_0x5eb6f7){logger[_0xeb0f('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xef9363,_0x5eb6f7);_0x133c24(_0x5eb6f7);});});}exports[_0xeb0f('0x1d')]=function(_0x9c95f7){var _0x2ee33d=this;return new Promise(function(_0x553bd8,_0x9a8ba1){return db['UserVoiceQueueRt'][_0xeb0f('0x1e')]({'raw':_0x9c95f7[_0xeb0f('0x1f')]?_0x9c95f7['options'][_0xeb0f('0x20')]===undefined?!![]:![]:!![],'where':_0x9c95f7['options']?_0x9c95f7[_0xeb0f('0x1f')][_0xeb0f('0x21')]||null:null,'attributes':[[db[_0xeb0f('0x22')]['fn'](_0xeb0f('0x23'),db['sequelize']['fn']('IF',db[_0xeb0f('0x22')][_0xeb0f('0x24')]('`paused`\x20=\x201,\x201,\x20null'))),_0xeb0f('0x25')]]})['then'](function(_0x3d3091){logger[_0xeb0f('0x13')](_0xeb0f('0x1d'),_0x9c95f7);logger['debug'](_0xeb0f('0x1d'),_0x9c95f7,JSON[_0xeb0f('0x18')](_0x3d3091));_0x553bd8(_0x3d3091);})[_0xeb0f('0x1c')](function(_0x143f79){logger[_0xeb0f('0x19')]('GetVoiceQueueRtPauses',_0x143f79['message'],_0x9c95f7);_0x9a8ba1(_0x2ee33d[_0xeb0f('0x19')](0x1f4,_0x143f79[_0xeb0f('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 6c91faa..52f4f46 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 _0xa523=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x3a068f,_0x43e2c7){var _0x6aaabe=function(_0x158760){while(--_0x158760){_0x3a068f['push'](_0x3a068f['shift']());}};_0x6aaabe(++_0x43e2c7);}(_0xa523,0x1e3));var _0x3a52=function(_0x41cdf7,_0xa6abb5){_0x41cdf7=_0x41cdf7-0x0;var _0x2155d1=_0xa523[_0x41cdf7];return _0x2155d1;};'use strict';var UserVoiceQueueRtEvents=require(_0x3a52('0x0'));var events=[_0x3a52('0x1'),_0x3a52('0x2'),_0x3a52('0x3')];function createListener(_0x1d6b84,_0x1d665f){return function(_0x468e78){_0x1d665f[_0x3a52('0x4')](_0x1d6b84,_0x468e78);};}function removeListener(_0x145114,_0x3fef6d){return function(){UserVoiceQueueRtEvents[_0x3a52('0x5')](_0x145114,_0x3fef6d);};}exports[_0x3a52('0x6')]=function(_0x5f253d){for(var _0x10717f=0x0,_0x4ed213=events['length'];_0x10717f<_0x4ed213;_0x10717f++){var _0x711706=events[_0x10717f];var _0x1cade2=createListener(_0x3a52('0x7')+_0x711706,_0x5f253d);UserVoiceQueueRtEvents['on'](_0x711706,_0x1cade2);}}; \ No newline at end of file +var _0x193b=['emit','removeListener','register','length','save','remove'];(function(_0x45c137,_0x26616a){var _0x1bd932=function(_0x20bdd1){while(--_0x20bdd1){_0x45c137['push'](_0x45c137['shift']());}};_0x1bd932(++_0x26616a);}(_0x193b,0x1ea));var _0xb193=function(_0x368178,_0x2d5678){_0x368178=_0x368178-0x0;var _0x10a228=_0x193b[_0x368178];return _0x10a228;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xb193('0x0'),_0xb193('0x1'),'update'];function createListener(_0x311de4,_0x1c482a){return function(_0x590508){_0x1c482a[_0xb193('0x2')](_0x311de4,_0x590508);};}function removeListener(_0x42a61f,_0x3f1988){return function(){UserVoiceQueueRtEvents[_0xb193('0x3')](_0x42a61f,_0x3f1988);};}exports[_0xb193('0x4')]=function(_0x4ed954){for(var _0x3fea37=0x0,_0x461ca8=events[_0xb193('0x5')];_0x3fea37<_0x461ca8;_0x3fea37++){var _0x4ba122=events[_0x3fea37];var _0x5b14f5=createListener('userVoiceQueueRt:'+_0x4ba122,_0x4ed954);UserVoiceQueueRtEvents['on'](_0x4ba122,_0x5b14f5);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 4893ccf..889de05 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 _0x6615=['express','Router','../../components/auth/service','exports','multer','util','path','connect-timeout'];(function(_0x1b924a,_0x2d1442){var _0x5206bf=function(_0x4a1dae){while(--_0x4a1dae){_0x1b924a['push'](_0x1b924a['shift']());}};_0x5206bf(++_0x2d1442);}(_0x6615,0xec));var _0x5661=function(_0x21cd08,_0x16cd11){_0x21cd08=_0x21cd08-0x0;var _0x1d77ba=_0x6615[_0x21cd08];return _0x1d77ba;};'use strict';var multer=require(_0x5661('0x0'));var util=require(_0x5661('0x1'));var path=require(_0x5661('0x2'));var timeout=require(_0x5661('0x3'));var express=require(_0x5661('0x4'));var router=express[_0x5661('0x5')]();var auth=require(_0x5661('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x5661('0x7')]=router; \ No newline at end of file +var _0x3713=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4baaa6,_0xdb09b3){var _0x4154f0=function(_0x195950){while(--_0x195950){_0x4baaa6['push'](_0x4baaa6['shift']());}};_0x4154f0(++_0xdb09b3);}(_0x3713,0xe7));var _0x3371=function(_0x5cfa0b,_0x18096c){_0x5cfa0b=_0x5cfa0b-0x0;var _0x46e012=_0x3713[_0x5cfa0b];return _0x46e012;};'use strict';var multer=require(_0x3371('0x0'));var util=require('util');var path=require(_0x3371('0x1'));var timeout=require(_0x3371('0x2'));var express=require(_0x3371('0x3'));var router=express[_0x3371('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3371('0x5'));var config=require(_0x3371('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 96aeca5..ad64be3 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(_0x3866b4,_0x3b0e0d){var _0xb8c195=function(_0x5ecb1d){while(--_0x5ecb1d){_0x3866b4['push'](_0x3866b4['shift']());}};_0xb8c195(++_0x3b0e0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x53ce86,_0x4a29f1){var _0x509806=function(_0x4f09ca){while(--_0x4f09ca){_0x53ce86['push'](_0x53ce86['shift']());}};_0x509806(++_0x4a29f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 70350b3..68384d6 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 _0x36ee=['UserWhatsappQueue','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe36e('0x0'))('api');var moment=require(_0xe36e('0x1'));var BPromise=require(_0xe36e('0x2'));var rp=require(_0xe36e('0x3'));var fs=require('fs');var path=require(_0xe36e('0x4'));var rimraf=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var attributes=require(_0xe36e('0x7'));module[_0xe36e('0x8')]=function(_0x25a07d,_0x190404){return _0x25a07d[_0xe36e('0x9')](_0xe36e('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x056b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x26773e,_0x39aa63){var _0x7a5144=function(_0x459212){while(--_0x459212){_0x26773e['push'](_0x26773e['shift']());}};_0x7a5144(++_0x39aa63);}(_0x056b,0xb6));var _0xb056=function(_0xaa1cab,_0x5f54b2){_0xaa1cab=_0xaa1cab-0x0;var _0x48cbeb=_0x056b[_0xaa1cab];return _0x48cbeb;};'use strict';var _=require('lodash');var util=require(_0xb056('0x0'));var logger=require(_0xb056('0x1'))(_0xb056('0x2'));var moment=require(_0xb056('0x3'));var BPromise=require(_0xb056('0x4'));var rp=require(_0xb056('0x5'));var fs=require('fs');var path=require(_0xb056('0x6'));var rimraf=require(_0xb056('0x7'));var config=require(_0xb056('0x8'));var attributes=require(_0xb056('0x9'));module[_0xb056('0xa')]=function(_0x515612,_0x2d5e4f){return _0x515612[_0xb056('0xb')](_0xb056('0xc'),attributes,{'tableName':_0xb056('0xd'),'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 26615c5..5c4f7b6 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(_0x3367a8,_0xb20e68){var _0x4e4d44=function(_0x5891c0){while(--_0x5891c0){_0x3367a8['push'](_0x3367a8['shift']());}};_0x4e4d44(++_0xb20e68);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x3b7376,_0x5d4a6e){var _0x3c36b7=function(_0x167719){while(--_0x167719){_0x3b7376['push'](_0x3b7376['shift']());}};_0x3c36b7(++_0x5d4a6e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 5f1707a..6fd557e 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 _0x6cc0=['../../components/interaction/service','./variable.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x7414f7,_0x25e231){var _0x107e8d=function(_0x31987a){while(--_0x31987a){_0x7414f7['push'](_0x7414f7['shift']());}};_0x107e8d(++_0x25e231);}(_0x6cc0,0x12d));var _0x06cc=function(_0x2f2601,_0x10b8be){_0x2f2601=_0x2f2601-0x0;var _0x3c6e6=_0x6cc0[_0x2f2601];return _0x3c6e6;};'use strict';var multer=require(_0x06cc('0x0'));var util=require(_0x06cc('0x1'));var path=require(_0x06cc('0x2'));var timeout=require(_0x06cc('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x06cc('0x4'));var interaction=require(_0x06cc('0x5'));var config=require('../../config/environment');var controller=require(_0x06cc('0x6'));router[_0x06cc('0x7')]('/',auth['isAuthenticated'](),controller[_0x06cc('0x8')]);router[_0x06cc('0x7')](_0x06cc('0x9'),auth[_0x06cc('0xa')](),controller[_0x06cc('0xb')]);router[_0x06cc('0xc')]('/',auth[_0x06cc('0xa')](),controller[_0x06cc('0xd')]);router['put']('/:id',auth[_0x06cc('0xa')](),controller[_0x06cc('0xe')]);router[_0x06cc('0xf')](_0x06cc('0x9'),auth['isAuthenticated'](),controller[_0x06cc('0x10')]);module[_0x06cc('0x11')]=router; \ No newline at end of file +var _0x062a=['isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./variable.controller'];(function(_0x42bf10,_0x308d5d){var _0x3045d4=function(_0xc823e1){while(--_0xc823e1){_0x42bf10['push'](_0x42bf10['shift']());}};_0x3045d4(++_0x308d5d);}(_0x062a,0x199));var _0xa062=function(_0x42835a,_0x5259a7){_0x42835a=_0x42835a-0x0;var _0xa4f23b=_0x062a[_0x42835a];return _0xa4f23b;};'use strict';var multer=require(_0xa062('0x0'));var util=require(_0xa062('0x1'));var path=require(_0xa062('0x2'));var timeout=require(_0xa062('0x3'));var express=require('express');var router=express[_0xa062('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa062('0x5'));var controller=require(_0xa062('0x6'));router['get']('/',auth[_0xa062('0x7')](),controller[_0xa062('0x8')]);router['get'](_0xa062('0x9'),auth['isAuthenticated'](),controller[_0xa062('0xa')]);router['post']('/',auth[_0xa062('0x7')](),controller[_0xa062('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa062('0xc')]);router[_0xa062('0xd')](_0xa062('0x9'),auth[_0xa062('0x7')](),controller[_0xa062('0xe')]);module[_0xa062('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 0182643..c071c5a 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 _0xff3c=['STRING','name','sequelize','exports'];(function(_0x572fcf,_0x4022f3){var _0x30dda7=function(_0x51e3ca){while(--_0x51e3ca){_0x572fcf['push'](_0x572fcf['shift']());}};_0x30dda7(++_0x4022f3);}(_0xff3c,0xc2));var _0xcff3=function(_0x4cdf87,_0x200caf){_0x4cdf87=_0x4cdf87-0x0;var _0x14d49d=_0xff3c[_0x4cdf87];return _0x14d49d;};'use strict';var Sequelize=require(_0xcff3('0x0'));module[_0xcff3('0x1')]={'name':{'type':Sequelize[_0xcff3('0x2')],'unique':_0xcff3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcff3('0x2')]}}; \ No newline at end of file +var _0x3748=['exports','STRING','sequelize'];(function(_0x2c0447,_0x4b0fc3){var _0x401a19=function(_0x9d1466){while(--_0x9d1466){_0x2c0447['push'](_0x2c0447['shift']());}};_0x401a19(++_0x4b0fc3);}(_0x3748,0xbc));var _0x8374=function(_0x48cb61,_0x2cb0a9){_0x48cb61=_0x48cb61-0x0;var _0x80543f=_0x3748[_0x48cb61];return _0x80543f;};'use strict';var Sequelize=require(_0x8374('0x0'));module[_0x8374('0x1')]={'name':{'type':Sequelize[_0x8374('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8374('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 4d075cc..f5f99a3 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 _0xea97=['../../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','set','Content-Range','apply','reject','update','then','destroy','get','Variables','UserProfileResource','stack','name','index','map','Variable','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0xea97,0xeb));var _0x7ea9=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xea97[_0x2235bf];return _0x4c3a64;};'use strict';var pdf=require(_0x7ea9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7ea9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ea9('0x2'));var rp=require(_0x7ea9('0x3'));var moment=require(_0x7ea9('0x4'));var BPromise=require(_0x7ea9('0x5'));var Mustache=require('mustache');var util=require(_0x7ea9('0x6'));var path=require(_0x7ea9('0x7'));var sox=require('sox');var csv=require(_0x7ea9('0x8'));var ejs=require(_0x7ea9('0x9'));var fs=require('fs');var _=require(_0x7ea9('0xa'));var squel=require(_0x7ea9('0xb'));var crypto=require(_0x7ea9('0xc'));var jsforce=require(_0x7ea9('0xd'));var deskjs=require(_0x7ea9('0xe'));var toCsv=require(_0x7ea9('0x8'));var querystring=require(_0x7ea9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7ea9('0x10'));var qs=require(_0x7ea9('0x11'));var as=require(_0x7ea9('0x12'));var hardwareService=require(_0x7ea9('0x13'));var logger=require(_0x7ea9('0x14'))(_0x7ea9('0x15'));var utils=require(_0x7ea9('0x16'));var config=require(_0x7ea9('0x17'));var licenseUtil=require(_0x7ea9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e9d33,_0x492d88){_0x492d88=_0x492d88||0xcc;return function(_0x4541f7){if(_0x4541f7){return _0x1e9d33[_0x7ea9('0x19')](_0x492d88);}return _0x1e9d33[_0x7ea9('0x1a')](_0x492d88)[_0x7ea9('0x1b')]();};}function respondWithResult(_0x184dc2,_0x3dae7b){_0x3dae7b=_0x3dae7b||0xc8;return function(_0x2af29f){if(_0x2af29f){return _0x184dc2[_0x7ea9('0x1a')](_0x3dae7b)[_0x7ea9('0x1c')](_0x2af29f);}};}function respondWithFilteredResult(_0x3f793a,_0x59fcd8){return function(_0x35bc84){if(_0x35bc84){var _0x58a405=_0x35bc84[_0x7ea9('0x1d')],_0x2e2a7e=_0x59fcd8[_0x7ea9('0x1e')],_0x545ddd=_0x59fcd8[_0x7ea9('0x1e')]+_0x59fcd8[_0x7ea9('0x1f')],_0x20ecb8;if(_0x545ddd>=_0x58a405){_0x545ddd=_0x58a405;_0x20ecb8=0xc8;}else{_0x20ecb8=0xce;}_0x3f793a[_0x7ea9('0x1a')](_0x20ecb8);return _0x3f793a[_0x7ea9('0x20')](_0x7ea9('0x21'),_0x2e2a7e+'-'+_0x545ddd+'/'+_0x58a405)[_0x7ea9('0x1c')](_0x35bc84);}return null;};}function patchUpdates(_0x335b48){return function(_0x1e1c55){try{jsonpatch[_0x7ea9('0x22')](_0x1e1c55,_0x335b48,!![]);}catch(_0x2ef563){return BPromise[_0x7ea9('0x23')](_0x2ef563);}return _0x1e1c55['save']();};}function saveUpdates(_0x391169,_0x2baf50){return function(_0x28a67a){if(_0x28a67a){return _0x28a67a[_0x7ea9('0x24')](_0x391169)[_0x7ea9('0x25')](function(_0x445598){return _0x445598;});}return null;};}function removeEntity(_0xeb3051,_0x3562ad){return function(_0x53ef88){if(_0x53ef88){return _0x53ef88[_0x7ea9('0x26')]()[_0x7ea9('0x25')](function(){var _0x1b214d=_0x53ef88[_0x7ea9('0x27')]({'plain':!![]});var _0x531ca0=_0x7ea9('0x28');return db[_0x7ea9('0x29')][_0x7ea9('0x26')]({'where':{'type':_0x531ca0,'resourceId':_0x1b214d['id']}})['then'](function(){return _0x53ef88;});})[_0x7ea9('0x25')](function(){_0xeb3051[_0x7ea9('0x1a')](0xcc)[_0x7ea9('0x1b')]();});}};}function handleEntityNotFound(_0x1e11c6,_0x511946){return function(_0x9b1357){if(!_0x9b1357){_0x1e11c6[_0x7ea9('0x19')](0x194);}return _0x9b1357;};}function handleError(_0x3ab18f,_0x1878c3){_0x1878c3=_0x1878c3||0x1f4;return function(_0x5da73e){logger['error'](_0x5da73e[_0x7ea9('0x2a')]);if(_0x5da73e[_0x7ea9('0x2b')]){delete _0x5da73e[_0x7ea9('0x2b')];}_0x3ab18f[_0x7ea9('0x1a')](_0x1878c3)['send'](_0x5da73e);};}exports[_0x7ea9('0x2c')]=function(_0x29bb85,_0x221831){var _0x1f21ca={},_0x4955f2={},_0x151181={'count':0x0,'rows':[]};var _0x3ed5f8=_[_0x7ea9('0x2d')](db[_0x7ea9('0x2e')][_0x7ea9('0x2f')],function(_0x1adca2){return{'name':_0x1adca2['fieldName'],'type':_0x1adca2['type'][_0x7ea9('0x30')]};});_0x4955f2[_0x7ea9('0x31')]=_['map'](_0x3ed5f8,_0x7ea9('0x2b'));_0x4955f2[_0x7ea9('0x32')]=_[_0x7ea9('0x33')](_0x29bb85[_0x7ea9('0x32')]);_0x4955f2[_0x7ea9('0x34')]=_[_0x7ea9('0x35')](_0x4955f2['model'],_0x4955f2[_0x7ea9('0x32')]);_0x1f21ca['attributes']=_[_0x7ea9('0x35')](_0x4955f2[_0x7ea9('0x31')],qs[_0x7ea9('0x36')](_0x29bb85['query'][_0x7ea9('0x36')]));_0x1f21ca[_0x7ea9('0x37')]=_0x1f21ca[_0x7ea9('0x37')][_0x7ea9('0x38')]?_0x1f21ca[_0x7ea9('0x37')]:_0x4955f2[_0x7ea9('0x31')];if(!_0x29bb85[_0x7ea9('0x32')]['hasOwnProperty'](_0x7ea9('0x39'))){_0x1f21ca[_0x7ea9('0x1f')]=qs[_0x7ea9('0x1f')](_0x29bb85['query']['limit']);_0x1f21ca[_0x7ea9('0x1e')]=qs[_0x7ea9('0x1e')](_0x29bb85[_0x7ea9('0x32')][_0x7ea9('0x1e')]);}_0x1f21ca[_0x7ea9('0x3a')]=qs[_0x7ea9('0x3b')](_0x29bb85[_0x7ea9('0x32')][_0x7ea9('0x3b')]);_0x1f21ca[_0x7ea9('0x3c')]=qs['filters'](_[_0x7ea9('0x3d')](_0x29bb85[_0x7ea9('0x32')],_0x4955f2[_0x7ea9('0x34')]),_0x3ed5f8);if(_0x29bb85[_0x7ea9('0x32')]['filter']){_0x1f21ca[_0x7ea9('0x3c')]=_[_0x7ea9('0x3e')](_0x1f21ca[_0x7ea9('0x3c')],{'$or':_[_0x7ea9('0x2d')](_0x3ed5f8,function(_0x495b86){if(_0x495b86[_0x7ea9('0x3f')]!==_0x7ea9('0x40')){var _0x804e76={};_0x804e76[_0x495b86[_0x7ea9('0x2b')]]={'$like':'%'+_0x29bb85[_0x7ea9('0x32')][_0x7ea9('0x41')]+'%'};return _0x804e76;}})});}_0x1f21ca=_[_0x7ea9('0x3e')]({},_0x1f21ca,_0x29bb85[_0x7ea9('0x42')]);var _0x3320bc={'where':_0x1f21ca[_0x7ea9('0x3c')]};return db[_0x7ea9('0x2e')][_0x7ea9('0x1d')](_0x3320bc)[_0x7ea9('0x25')](function(_0x57991d){_0x151181[_0x7ea9('0x1d')]=_0x57991d;if(_0x29bb85[_0x7ea9('0x32')][_0x7ea9('0x43')]){_0x1f21ca[_0x7ea9('0x44')]=[{'all':!![]}];}return db['Variable'][_0x7ea9('0x45')](_0x1f21ca);})[_0x7ea9('0x25')](function(_0x5d71bd){_0x151181[_0x7ea9('0x46')]=_0x5d71bd;return _0x151181;})[_0x7ea9('0x25')](respondWithFilteredResult(_0x221831,_0x1f21ca))[_0x7ea9('0x47')](handleError(_0x221831,null));};exports[_0x7ea9('0x48')]=function(_0x107484,_0x8c27eb){var _0x316ca1={'raw':!![],'where':{'id':_0x107484[_0x7ea9('0x49')]['id']}},_0x2bef0f={};_0x2bef0f[_0x7ea9('0x31')]=_[_0x7ea9('0x33')](db[_0x7ea9('0x2e')][_0x7ea9('0x2f')]);_0x2bef0f['query']=_[_0x7ea9('0x33')](_0x107484['query']);_0x2bef0f['filters']=_[_0x7ea9('0x35')](_0x2bef0f[_0x7ea9('0x31')],_0x2bef0f[_0x7ea9('0x32')]);_0x316ca1[_0x7ea9('0x37')]=_[_0x7ea9('0x35')](_0x2bef0f[_0x7ea9('0x31')],qs[_0x7ea9('0x36')](_0x107484[_0x7ea9('0x32')]['fields']));_0x316ca1[_0x7ea9('0x37')]=_0x316ca1[_0x7ea9('0x37')]['length']?_0x316ca1[_0x7ea9('0x37')]:_0x2bef0f[_0x7ea9('0x31')];if(_0x107484[_0x7ea9('0x32')]['includeAll']){_0x316ca1[_0x7ea9('0x44')]=[{'all':!![]}];}_0x316ca1=_[_0x7ea9('0x3e')]({},_0x316ca1,_0x107484[_0x7ea9('0x42')]);return db[_0x7ea9('0x2e')][_0x7ea9('0x4a')](_0x316ca1)[_0x7ea9('0x25')](handleEntityNotFound(_0x8c27eb,null))[_0x7ea9('0x25')](respondWithResult(_0x8c27eb,null))[_0x7ea9('0x47')](handleError(_0x8c27eb,null));};exports[_0x7ea9('0x4b')]=function(_0x4cb1d0,_0x1bde8f){return db[_0x7ea9('0x2e')]['create'](_0x4cb1d0[_0x7ea9('0x4c')],{})[_0x7ea9('0x25')](function(_0x23abd3){var _0x36d310=_0x4cb1d0[_0x7ea9('0x4d')][_0x7ea9('0x27')]({'plain':!![]});if(!_0x36d310)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36d310[_0x7ea9('0x4e')]===_0x7ea9('0x4d')){var _0x3ea173=_0x23abd3[_0x7ea9('0x27')]({'plain':!![]});var _0x2646c3='Variables';return db[_0x7ea9('0x4f')][_0x7ea9('0x4a')]({'where':{'name':_0x2646c3,'userProfileId':_0x36d310[_0x7ea9('0x50')]},'raw':!![]})[_0x7ea9('0x25')](function(_0x16bd9f){if(_0x16bd9f&&_0x16bd9f[_0x7ea9('0x51')]===0x0){return db[_0x7ea9('0x29')]['create']({'name':_0x3ea173[_0x7ea9('0x2b')],'resourceId':_0x3ea173['id'],'type':_0x16bd9f['name'],'sectionId':_0x16bd9f['id']},{})[_0x7ea9('0x25')](function(){return _0x23abd3;});}else{return _0x23abd3;}})['catch'](function(_0x2a3417){logger[_0x7ea9('0x52')](_0x7ea9('0x53'),_0x2a3417);throw _0x2a3417;});}return _0x23abd3;})['then'](respondWithResult(_0x1bde8f,0xc9))[_0x7ea9('0x47')](handleError(_0x1bde8f,null));};exports[_0x7ea9('0x24')]=function(_0x2565d8,_0x4b48ff){if(_0x2565d8[_0x7ea9('0x4c')]['id']){delete _0x2565d8[_0x7ea9('0x4c')]['id'];}return db[_0x7ea9('0x2e')][_0x7ea9('0x4a')]({'where':{'id':_0x2565d8['params']['id']}})[_0x7ea9('0x25')](handleEntityNotFound(_0x4b48ff,null))[_0x7ea9('0x25')](saveUpdates(_0x2565d8[_0x7ea9('0x4c')],null))['then'](respondWithResult(_0x4b48ff,null))[_0x7ea9('0x47')](handleError(_0x4b48ff,null));};exports[_0x7ea9('0x26')]=function(_0x5e49ff,_0x3b3891){return db['Variable'][_0x7ea9('0x4a')]({'where':{'id':_0x5e49ff[_0x7ea9('0x49')]['id']}})[_0x7ea9('0x25')](handleEntityNotFound(_0x3b3891,null))[_0x7ea9('0x25')](removeEntity(_0x3b3891,null))['catch'](handleError(_0x3b3891,null));}; \ No newline at end of file +var _0x96db=['Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','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','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x2b716b,_0x9001ae){var _0x4b4499=function(_0x3faaea){while(--_0x3faaea){_0x2b716b['push'](_0x2b716b['shift']());}};_0x4b4499(++_0x9001ae);}(_0x96db,0x18c));var _0xb96d=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x96db[_0x44bcb0];return _0xfaf881;};'use strict';var pdf=require(_0xb96d('0x0'));var emlformat=require(_0xb96d('0x1'));var rimraf=require(_0xb96d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb96d('0x3'));var rp=require(_0xb96d('0x4'));var moment=require(_0xb96d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb96d('0x6'));var util=require(_0xb96d('0x7'));var path=require('path');var sox=require(_0xb96d('0x8'));var csv=require('to-csv');var ejs=require(_0xb96d('0x9'));var fs=require('fs');var _=require(_0xb96d('0xa'));var squel=require('squel');var crypto=require(_0xb96d('0xb'));var jsforce=require(_0xb96d('0xc'));var deskjs=require(_0xb96d('0xd'));var toCsv=require(_0xb96d('0xe'));var querystring=require(_0xb96d('0xf'));var Papa=require('papaparse');var Redis=require(_0xb96d('0x10'));var authService=require(_0xb96d('0x11'));var qs=require(_0xb96d('0x12'));var as=require(_0xb96d('0x13'));var hardwareService=require(_0xb96d('0x14'));var logger=require(_0xb96d('0x15'))(_0xb96d('0x16'));var utils=require(_0xb96d('0x17'));var config=require(_0xb96d('0x18'));var licenseUtil=require(_0xb96d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59c869,_0x39f983){_0x39f983=_0x39f983||0xcc;return function(_0x4a48cd){if(_0x4a48cd){return _0x59c869[_0xb96d('0x1a')](_0x39f983);}return _0x59c869[_0xb96d('0x1b')](_0x39f983)[_0xb96d('0x1c')]();};}function respondWithResult(_0x453007,_0x1d5453){_0x1d5453=_0x1d5453||0xc8;return function(_0x2aef07){if(_0x2aef07){return _0x453007[_0xb96d('0x1b')](_0x1d5453)[_0xb96d('0x1d')](_0x2aef07);}};}function respondWithFilteredResult(_0x42a8a0,_0x4f4647){return function(_0x535b02){if(_0x535b02){var _0x522601=_0x535b02[_0xb96d('0x1e')],_0x28bafc=_0x4f4647['offset'],_0x3cc4c5=_0x4f4647[_0xb96d('0x1f')]+_0x4f4647[_0xb96d('0x20')],_0x4146f5;if(_0x3cc4c5>=_0x522601){_0x3cc4c5=_0x522601;_0x4146f5=0xc8;}else{_0x4146f5=0xce;}_0x42a8a0[_0xb96d('0x1b')](_0x4146f5);return _0x42a8a0[_0xb96d('0x21')](_0xb96d('0x22'),_0x28bafc+'-'+_0x3cc4c5+'/'+_0x522601)[_0xb96d('0x1d')](_0x535b02);}return null;};}function patchUpdates(_0x5eaf9a){return function(_0x541e21){try{jsonpatch[_0xb96d('0x23')](_0x541e21,_0x5eaf9a,!![]);}catch(_0x68a637){return BPromise['reject'](_0x68a637);}return _0x541e21[_0xb96d('0x24')]();};}function saveUpdates(_0x2d17b2,_0x379aa8){return function(_0x37f8fb){if(_0x37f8fb){return _0x37f8fb[_0xb96d('0x25')](_0x2d17b2)[_0xb96d('0x26')](function(_0x5de0a7){return _0x5de0a7;});}return null;};}function removeEntity(_0xf6a878,_0x221162){return function(_0x86c2ff){if(_0x86c2ff){return _0x86c2ff[_0xb96d('0x27')]()[_0xb96d('0x26')](function(){var _0x8e667d=_0x86c2ff[_0xb96d('0x28')]({'plain':!![]});var _0x6346b6=_0xb96d('0x29');return db[_0xb96d('0x2a')][_0xb96d('0x27')]({'where':{'type':_0x6346b6,'resourceId':_0x8e667d['id']}})['then'](function(){return _0x86c2ff;});})[_0xb96d('0x26')](function(){_0xf6a878[_0xb96d('0x1b')](0xcc)[_0xb96d('0x1c')]();});}};}function handleEntityNotFound(_0x18b6d1,_0x2cda96){return function(_0xd9ef89){if(!_0xd9ef89){_0x18b6d1[_0xb96d('0x1a')](0x194);}return _0xd9ef89;};}function handleError(_0x5ae999,_0x507881){_0x507881=_0x507881||0x1f4;return function(_0x524e12){logger[_0xb96d('0x2b')](_0x524e12[_0xb96d('0x2c')]);if(_0x524e12[_0xb96d('0x2d')]){delete _0x524e12[_0xb96d('0x2d')];}_0x5ae999['status'](_0x507881)[_0xb96d('0x2e')](_0x524e12);};}exports[_0xb96d('0x2f')]=function(_0x328a41,_0x239fe9){var _0x2f8106={},_0x3d7707={},_0x4fecdb={'count':0x0,'rows':[]};var _0x373959=_[_0xb96d('0x30')](db[_0xb96d('0x31')][_0xb96d('0x32')],function(_0x3f3846){return{'name':_0x3f3846['fieldName'],'type':_0x3f3846['type'][_0xb96d('0x33')]};});_0x3d7707[_0xb96d('0x34')]=_[_0xb96d('0x30')](_0x373959,_0xb96d('0x2d'));_0x3d7707[_0xb96d('0x35')]=_[_0xb96d('0x36')](_0x328a41[_0xb96d('0x35')]);_0x3d7707[_0xb96d('0x37')]=_[_0xb96d('0x38')](_0x3d7707['model'],_0x3d7707[_0xb96d('0x35')]);_0x2f8106['attributes']=_[_0xb96d('0x38')](_0x3d7707['model'],qs[_0xb96d('0x39')](_0x328a41[_0xb96d('0x35')]['fields']));_0x2f8106['attributes']=_0x2f8106[_0xb96d('0x3a')][_0xb96d('0x3b')]?_0x2f8106[_0xb96d('0x3a')]:_0x3d7707[_0xb96d('0x34')];if(!_0x328a41[_0xb96d('0x35')][_0xb96d('0x3c')](_0xb96d('0x3d'))){_0x2f8106[_0xb96d('0x20')]=qs['limit'](_0x328a41[_0xb96d('0x35')][_0xb96d('0x20')]);_0x2f8106['offset']=qs[_0xb96d('0x1f')](_0x328a41['query'][_0xb96d('0x1f')]);}_0x2f8106[_0xb96d('0x3e')]=qs[_0xb96d('0x3f')](_0x328a41[_0xb96d('0x35')]['sort']);_0x2f8106[_0xb96d('0x40')]=qs[_0xb96d('0x37')](_[_0xb96d('0x41')](_0x328a41[_0xb96d('0x35')],_0x3d7707[_0xb96d('0x37')]),_0x373959);if(_0x328a41[_0xb96d('0x35')][_0xb96d('0x42')]){_0x2f8106[_0xb96d('0x40')]=_[_0xb96d('0x43')](_0x2f8106[_0xb96d('0x40')],{'$or':_[_0xb96d('0x30')](_0x373959,function(_0x11477c){if(_0x11477c[_0xb96d('0x44')]!==_0xb96d('0x45')){var _0x36f47c={};_0x36f47c[_0x11477c[_0xb96d('0x2d')]]={'$like':'%'+_0x328a41[_0xb96d('0x35')][_0xb96d('0x42')]+'%'};return _0x36f47c;}})});}_0x2f8106=_[_0xb96d('0x43')]({},_0x2f8106,_0x328a41[_0xb96d('0x46')]);var _0x1fa921={'where':_0x2f8106['where']};return db[_0xb96d('0x31')][_0xb96d('0x1e')](_0x1fa921)['then'](function(_0x396b6){_0x4fecdb['count']=_0x396b6;if(_0x328a41[_0xb96d('0x35')][_0xb96d('0x47')]){_0x2f8106['include']=[{'all':!![]}];}return db['Variable']['findAll'](_0x2f8106);})[_0xb96d('0x26')](function(_0x48f798){_0x4fecdb[_0xb96d('0x48')]=_0x48f798;return _0x4fecdb;})['then'](respondWithFilteredResult(_0x239fe9,_0x2f8106))[_0xb96d('0x49')](handleError(_0x239fe9,null));};exports[_0xb96d('0x4a')]=function(_0x302cba,_0x4815fb){var _0x5b1ef8={'raw':!![],'where':{'id':_0x302cba['params']['id']}},_0x19ce1c={};_0x19ce1c['model']=_[_0xb96d('0x36')](db[_0xb96d('0x31')][_0xb96d('0x32')]);_0x19ce1c[_0xb96d('0x35')]=_['keys'](_0x302cba['query']);_0x19ce1c[_0xb96d('0x37')]=_[_0xb96d('0x38')](_0x19ce1c[_0xb96d('0x34')],_0x19ce1c['query']);_0x5b1ef8['attributes']=_[_0xb96d('0x38')](_0x19ce1c[_0xb96d('0x34')],qs['fields'](_0x302cba[_0xb96d('0x35')]['fields']));_0x5b1ef8[_0xb96d('0x3a')]=_0x5b1ef8['attributes'][_0xb96d('0x3b')]?_0x5b1ef8[_0xb96d('0x3a')]:_0x19ce1c['model'];if(_0x302cba[_0xb96d('0x35')][_0xb96d('0x47')]){_0x5b1ef8[_0xb96d('0x4b')]=[{'all':!![]}];}_0x5b1ef8=_[_0xb96d('0x43')]({},_0x5b1ef8,_0x302cba['options']);return db['Variable'][_0xb96d('0x4c')](_0x5b1ef8)[_0xb96d('0x26')](handleEntityNotFound(_0x4815fb,null))[_0xb96d('0x26')](respondWithResult(_0x4815fb,null))[_0xb96d('0x49')](handleError(_0x4815fb,null));};exports['create']=function(_0x4a2ceb,_0x1bf6be){return db[_0xb96d('0x31')][_0xb96d('0x4d')](_0x4a2ceb['body'],{})[_0xb96d('0x26')](function(_0x19b2c3){var _0x795c41=_0x4a2ceb['user']['get']({'plain':!![]});if(!_0x795c41)throw new Error(_0xb96d('0x4e'));if(_0x795c41[_0xb96d('0x4f')]===_0xb96d('0x50')){var _0x376f10=_0x19b2c3[_0xb96d('0x28')]({'plain':!![]});var _0x239e19=_0xb96d('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x239e19,'userProfileId':_0x795c41[_0xb96d('0x51')]},'raw':!![]})[_0xb96d('0x26')](function(_0x1a3dae){if(_0x1a3dae&&_0x1a3dae[_0xb96d('0x52')]===0x0){return db[_0xb96d('0x2a')][_0xb96d('0x4d')]({'name':_0x376f10[_0xb96d('0x2d')],'resourceId':_0x376f10['id'],'type':_0x1a3dae[_0xb96d('0x2d')],'sectionId':_0x1a3dae['id']},{})[_0xb96d('0x26')](function(){return _0x19b2c3;});}else{return _0x19b2c3;}})[_0xb96d('0x49')](function(_0xbc9e50){logger[_0xb96d('0x2b')](_0xb96d('0x53'),_0xbc9e50);throw _0xbc9e50;});}return _0x19b2c3;})[_0xb96d('0x26')](respondWithResult(_0x1bf6be,0xc9))[_0xb96d('0x49')](handleError(_0x1bf6be,null));};exports[_0xb96d('0x25')]=function(_0x33858b,_0x28cbb4){if(_0x33858b[_0xb96d('0x54')]['id']){delete _0x33858b['body']['id'];}return db['Variable']['find']({'where':{'id':_0x33858b[_0xb96d('0x55')]['id']}})[_0xb96d('0x26')](handleEntityNotFound(_0x28cbb4,null))['then'](saveUpdates(_0x33858b['body'],null))[_0xb96d('0x26')](respondWithResult(_0x28cbb4,null))[_0xb96d('0x49')](handleError(_0x28cbb4,null));};exports[_0xb96d('0x27')]=function(_0x46b748,_0xd59fef){return db[_0xb96d('0x31')][_0xb96d('0x4c')]({'where':{'id':_0x46b748[_0xb96d('0x55')]['id']}})[_0xb96d('0x26')](handleEntityNotFound(_0xd59fef,null))[_0xb96d('0x26')](removeEntity(_0xd59fef,null))[_0xb96d('0x49')](handleError(_0xd59fef,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 5ff6a76..f9f2c3e 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 _0xe80c=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./variable.attributes','define','tools_variables','util'];(function(_0x35062a,_0x13683e){var _0x415190=function(_0x17d6be){while(--_0x17d6be){_0x35062a['push'](_0x35062a['shift']());}};_0x415190(++_0x13683e);}(_0xe80c,0x1c2));var _0xce80=function(_0x1bd57a,_0x2c8970){_0x1bd57a=_0x1bd57a-0x0;var _0x47ff4c=_0xe80c[_0x1bd57a];return _0x47ff4c;};'use strict';var _=require('lodash');var util=require(_0xce80('0x0'));var logger=require(_0xce80('0x1'))(_0xce80('0x2'));var moment=require(_0xce80('0x3'));var BPromise=require(_0xce80('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce80('0x5'));var rimraf=require(_0xce80('0x6'));var config=require(_0xce80('0x7'));var attributes=require(_0xce80('0x8'));module['exports']=function(_0xb10325,_0x150f6a){return _0xb10325[_0xce80('0x9')]('Variable',attributes,{'tableName':_0xce80('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6505=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','define','Variable','tools_variables'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6505,0x8c));var _0x5650=function(_0x1c167f,_0x4f4968){_0x1c167f=_0x1c167f-0x0;var _0x302985=_0x6505[_0x1c167f];return _0x302985;};'use strict';var _=require(_0x5650('0x0'));var util=require(_0x5650('0x1'));var logger=require(_0x5650('0x2'))(_0x5650('0x3'));var moment=require(_0x5650('0x4'));var BPromise=require(_0x5650('0x5'));var rp=require(_0x5650('0x6'));var fs=require('fs');var path=require(_0x5650('0x7'));var rimraf=require(_0x5650('0x8'));var config=require(_0x5650('0x9'));var attributes=require(_0x5650('0xa'));module['exports']=function(_0x36074c,_0x3f611a){return _0x36074c[_0x5650('0xb')](_0x5650('0xc'),attributes,{'tableName':_0x5650('0xd'),'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 e283362..3112223 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 _0x983a=['jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','include','map','model','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xa601e7,_0x403e5e){var _0x217d3b=function(_0x2c53f1){while(--_0x2c53f1){_0xa601e7['push'](_0xa601e7['shift']());}};_0x217d3b(++_0x403e5e);}(_0x983a,0x1ca));var _0xa983=function(_0x55608d,_0x14235b){_0x55608d=_0x55608d-0x0;var _0x3bc3d4=_0x983a[_0x55608d];return _0x3bc3d4;};'use strict';var _=require(_0xa983('0x0'));var util=require(_0xa983('0x1'));var moment=require(_0xa983('0x2'));var BPromise=require(_0xa983('0x3'));var rs=require(_0xa983('0x4'));var fs=require('fs');var Redis=require(_0xa983('0x5'));var db=require(_0xa983('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa983('0x7'));var client=jayson[_0xa983('0x8')][_0xa983('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31e953,_0x39e990,_0x3ece3e){return new BPromise(function(_0x44c8b1,_0x3fd748){return client[_0xa983('0xa')](_0x31e953,_0x3ece3e)['then'](function(_0x5cafba){logger[_0xa983('0xb')](_0xa983('0xc'),_0x39e990,_0xa983('0xd'));logger[_0xa983('0xe')](_0xa983('0xf'),_0x39e990,_0xa983('0xd'),JSON[_0xa983('0x10')](_0x5cafba));if(_0x5cafba[_0xa983('0x11')]){if(_0x5cafba[_0xa983('0x11')][_0xa983('0x12')]===0x1f4){logger[_0xa983('0x11')](_0xa983('0xc'),_0x39e990,_0x5cafba[_0xa983('0x11')][_0xa983('0x13')]);return _0x3fd748(_0x5cafba[_0xa983('0x11')][_0xa983('0x13')]);}logger[_0xa983('0x11')](_0xa983('0xc'),_0x39e990,_0x5cafba[_0xa983('0x11')]['message']);return _0x44c8b1(_0x5cafba[_0xa983('0x11')][_0xa983('0x13')]);}else{logger['info'](_0xa983('0xc'),_0x39e990,_0xa983('0xd'));_0x44c8b1(_0x5cafba[_0xa983('0x14')][_0xa983('0x13')]);}})[_0xa983('0x15')](function(_0x4cb156){logger[_0xa983('0x11')](_0xa983('0xc'),_0x39e990,_0x4cb156);_0x3fd748(_0x4cb156);});});}exports[_0xa983('0x16')]=function(_0x1930f4){var _0x2be3b2=this;return new Promise(function(_0x264d70,_0x391612){return db['Variable'][_0xa983('0x17')]({'raw':_0x1930f4[_0xa983('0x18')]?_0x1930f4[_0xa983('0x18')][_0xa983('0x19')]===undefined?!![]:![]:!![],'where':_0x1930f4[_0xa983('0x18')]?_0x1930f4['options']['where']||null:null,'attributes':_0x1930f4[_0xa983('0x18')]?_0x1930f4[_0xa983('0x18')]['attributes']||null:null,'include':_0x1930f4[_0xa983('0x18')]?_0x1930f4['options'][_0xa983('0x1a')]?_[_0xa983('0x1b')](_0x1930f4[_0xa983('0x18')][_0xa983('0x1a')],function(_0x265009){return{'model':db[_0x265009[_0xa983('0x1c')]],'as':_0x265009['as'],'attributes':_0x265009['attributes'],'include':_0x265009[_0xa983('0x1a')]?_['map'](_0x265009[_0xa983('0x1a')],function(_0x12f30c){return{'model':db[_0x12f30c[_0xa983('0x1c')]],'as':_0x12f30c['as'],'attributes':_0x12f30c[_0xa983('0x1d')],'include':_0x12f30c['include']?_['map'](_0x12f30c['include'],function(_0xc35931){return{'model':db[_0xc35931[_0xa983('0x1c')]],'as':_0xc35931['as'],'attributes':_0xc35931[_0xa983('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa983('0x1e')](function(_0x5c936d){logger[_0xa983('0xb')](_0xa983('0x16'),_0x1930f4);logger[_0xa983('0xe')]('ShowVariable',_0x1930f4,JSON['stringify'](_0x5c936d));_0x264d70(_0x5c936d);})['catch'](function(_0x12b72e){logger['error']('ShowVariable',_0x12b72e['message'],_0x1930f4);_0x391612(_0x2be3b2[_0xa983('0x11')](0x1f4,_0x12b72e['message']));});});}; \ No newline at end of file +var _0xadb6=['code','message','catch','ShowVariable','find','options','raw','where','attributes','include','map','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4b5006,_0x24203c){var _0x75c4a0=function(_0x101611){while(--_0x101611){_0x4b5006['push'](_0x4b5006['shift']());}};_0x75c4a0(++_0x24203c);}(_0xadb6,0x123));var _0x6adb=function(_0x55f9d4,_0x1f61ed){_0x55f9d4=_0x55f9d4-0x0;var _0x2d02fb=_0xadb6[_0x55f9d4];return _0x2d02fb;};'use strict';var _=require(_0x6adb('0x0'));var util=require(_0x6adb('0x1'));var moment=require(_0x6adb('0x2'));var BPromise=require(_0x6adb('0x3'));var rs=require(_0x6adb('0x4'));var fs=require('fs');var Redis=require(_0x6adb('0x5'));var db=require(_0x6adb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6adb('0x7'))(_0x6adb('0x8'));var config=require(_0x6adb('0x9'));var jayson=require(_0x6adb('0xa'));var client=jayson[_0x6adb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2304c1,_0x3f3df4,_0x54cdcb){return new BPromise(function(_0xf446b2,_0x41a4eb){return client[_0x6adb('0xc')](_0x2304c1,_0x54cdcb)[_0x6adb('0xd')](function(_0x5d7a4e){logger[_0x6adb('0xe')](_0x6adb('0xf'),_0x3f3df4,_0x6adb('0x10'));logger['debug']('Variable,\x20%s,\x20%s,\x20%s',_0x3f3df4,'request\x20sent',JSON[_0x6adb('0x11')](_0x5d7a4e));if(_0x5d7a4e[_0x6adb('0x12')]){if(_0x5d7a4e[_0x6adb('0x12')][_0x6adb('0x13')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x3f3df4,_0x5d7a4e['error'][_0x6adb('0x14')]);return _0x41a4eb(_0x5d7a4e['error'][_0x6adb('0x14')]);}logger[_0x6adb('0x12')](_0x6adb('0xf'),_0x3f3df4,_0x5d7a4e[_0x6adb('0x12')]['message']);return _0xf446b2(_0x5d7a4e[_0x6adb('0x12')]['message']);}else{logger['info'](_0x6adb('0xf'),_0x3f3df4,_0x6adb('0x10'));_0xf446b2(_0x5d7a4e['result']['message']);}})[_0x6adb('0x15')](function(_0x4b5f43){logger[_0x6adb('0x12')](_0x6adb('0xf'),_0x3f3df4,_0x4b5f43);_0x41a4eb(_0x4b5f43);});});}exports[_0x6adb('0x16')]=function(_0x24f5da){var _0x414be0=this;return new Promise(function(_0x3aa486,_0x59e7a3){return db['Variable'][_0x6adb('0x17')]({'raw':_0x24f5da[_0x6adb('0x18')]?_0x24f5da[_0x6adb('0x18')][_0x6adb('0x19')]===undefined?!![]:![]:!![],'where':_0x24f5da[_0x6adb('0x18')]?_0x24f5da[_0x6adb('0x18')][_0x6adb('0x1a')]||null:null,'attributes':_0x24f5da['options']?_0x24f5da['options'][_0x6adb('0x1b')]||null:null,'include':_0x24f5da[_0x6adb('0x18')]?_0x24f5da[_0x6adb('0x18')][_0x6adb('0x1c')]?_[_0x6adb('0x1d')](_0x24f5da['options'][_0x6adb('0x1c')],function(_0x279c6d){return{'model':db[_0x279c6d['model']],'as':_0x279c6d['as'],'attributes':_0x279c6d[_0x6adb('0x1b')],'include':_0x279c6d[_0x6adb('0x1c')]?_[_0x6adb('0x1d')](_0x279c6d[_0x6adb('0x1c')],function(_0x32a891){return{'model':db[_0x32a891['model']],'as':_0x32a891['as'],'attributes':_0x32a891[_0x6adb('0x1b')],'include':_0x32a891[_0x6adb('0x1c')]?_[_0x6adb('0x1d')](_0x32a891[_0x6adb('0x1c')],function(_0x17cdba){return{'model':db[_0x17cdba['model']],'as':_0x17cdba['as'],'attributes':_0x17cdba[_0x6adb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6adb('0xd')](function(_0x54eaad){logger[_0x6adb('0xe')]('ShowVariable',_0x24f5da);logger[_0x6adb('0x1e')](_0x6adb('0x16'),_0x24f5da,JSON['stringify'](_0x54eaad));_0x3aa486(_0x54eaad);})['catch'](function(_0x5d3f1c){logger['error'](_0x6adb('0x16'),_0x5d3f1c[_0x6adb('0x14')],_0x24f5da);_0x59e7a3(_0x414be0[_0x6adb('0x12')](0x1f4,_0x5d3f1c[_0x6adb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 59ded35..231bfd5 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 _0xcd57=['index','isAuthenticated','/reset','canUpdate','reset','/pull','/restart','restart','migrations','exports','Router','../../components/auth/service','./version.controller','get'];(function(_0x34bc89,_0x1d8652){var _0x38ad3f=function(_0x2b6215){while(--_0x2b6215){_0x34bc89['push'](_0x34bc89['shift']());}};_0x38ad3f(++_0x1d8652);}(_0xcd57,0x1ae));var _0x7cd5=function(_0x230951,_0x4dad52){_0x230951=_0x230951-0x0;var _0xeb26b1=_0xcd57[_0x230951];return _0xeb26b1;};'use strict';var express=require('express');var router=express[_0x7cd5('0x0')]();var auth=require(_0x7cd5('0x1'));var controller=require(_0x7cd5('0x2'));router[_0x7cd5('0x3')]('/',controller[_0x7cd5('0x4')]);router[_0x7cd5('0x3')]('/fetch',auth[_0x7cd5('0x5')](),auth['canUpdate'](),controller['fetch']);router[_0x7cd5('0x3')](_0x7cd5('0x6'),auth[_0x7cd5('0x5')](),auth[_0x7cd5('0x7')](),controller[_0x7cd5('0x8')]);router['get'](_0x7cd5('0x9'),auth[_0x7cd5('0x5')](),auth[_0x7cd5('0x7')](),controller['pull']);router[_0x7cd5('0x3')](_0x7cd5('0xa'),auth[_0x7cd5('0x5')](),controller[_0x7cd5('0xb')]);router[_0x7cd5('0x3')]('/migrations',controller[_0x7cd5('0xc')]);module[_0x7cd5('0xd')]=router; \ No newline at end of file +var _0x6f28=['express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','exports'];(function(_0x261abb,_0x341c07){var _0x13da52=function(_0xca5872){while(--_0xca5872){_0x261abb['push'](_0x261abb['shift']());}};_0x13da52(++_0x341c07);}(_0x6f28,0x130));var _0x86f2=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x6f28[_0x1eda20];return _0x31b953;};'use strict';var express=require(_0x86f2('0x0'));var router=express[_0x86f2('0x1')]();var auth=require(_0x86f2('0x2'));var controller=require(_0x86f2('0x3'));router[_0x86f2('0x4')]('/',controller[_0x86f2('0x5')]);router[_0x86f2('0x4')](_0x86f2('0x6'),auth[_0x86f2('0x7')](),auth[_0x86f2('0x8')](),controller[_0x86f2('0x9')]);router[_0x86f2('0x4')](_0x86f2('0xa'),auth[_0x86f2('0x7')](),auth['canUpdate'](),controller[_0x86f2('0xb')]);router[_0x86f2('0x4')](_0x86f2('0xc'),auth[_0x86f2('0x7')](),auth[_0x86f2('0x8')](),controller[_0x86f2('0xd')]);router[_0x86f2('0x4')](_0x86f2('0xe'),auth[_0x86f2('0x7')](),controller[_0x86f2('0xf')]);router[_0x86f2('0x4')](_0x86f2('0x10'),controller[_0x86f2('0x11')]);module[_0x86f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 8ad6249..72498cb 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 _0xe3da=['info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','push','sequelize','Migration','getQueryInterface','constructor','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','fetch','tags','2.0.0','status','json','origin','error'];(function(_0x888385,_0x9cdc66){var _0x22d5c2=function(_0x3b1599){while(--_0x3b1599){_0x888385['push'](_0x888385['shift']());}};_0x22d5c2(++_0x9cdc66);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var Umzug=require(_0xae3d('0x0'));var path=require(_0xae3d('0x1'));var fs=require('fs');var _=require(_0xae3d('0x2'));var pkginfo=require(_0xae3d('0x3'))(module,_0xae3d('0x4'));var compareVersions=require(_0xae3d('0x5'));var exec=require(_0xae3d('0x6'))[_0xae3d('0x7')];var db=require(_0xae3d('0x8'))['db'];var config=require(_0xae3d('0x9'));var pm2=require(_0xae3d('0xa'));var logger=require(_0xae3d('0xb'))(_0xae3d('0xc'));var git=require(_0xae3d('0xd'))(config[_0xae3d('0xe')]);exports[_0xae3d('0xf')]=function(_0x583b98,_0x2a5c45){var _0x3d6650={'current':module['exports']['version'],'phonebar':0x2};if(_0x583b98[_0xae3d('0x10')]&&_0x583b98[_0xae3d('0x10')][_0xae3d('0x11')]){return git[_0xae3d('0x12')]()[_0xae3d('0x13')](function(_0x15d6da,_0x4bd4ec){_0x3d6650[_0xae3d('0x11')]=(_0x15d6da?module['exports'][_0xae3d('0x4')]:_0x4bd4ec[_0xae3d('0x11')])||_0xae3d('0x14');return _0x2a5c45[_0xae3d('0x15')](0xc8)['json'](_0x3d6650);});}else{return _0x2a5c45[_0xae3d('0x15')](0xc8)[_0xae3d('0x16')](_0x3d6650);}};exports[_0xae3d('0x12')]=function(_0x1605ac,_0x2afdd3){return git[_0xae3d('0x12')]([_0xae3d('0x17'),'master'],function(_0x1fb7a9){if(_0x1fb7a9){logger[_0xae3d('0x18')](_0x1fb7a9);return _0x2afdd3[_0xae3d('0x15')](0x1f4)[_0xae3d('0x16')](_0x1fb7a9);}logger[_0xae3d('0x19')](_0xae3d('0x1a'));return _0x2afdd3['status'](0xc8)[_0xae3d('0x16')]({'output':_0xae3d('0x1b')});});};exports[_0xae3d('0x1c')]=function(_0x5303c2,_0x3f8cf9){return git[_0xae3d('0x1c')](['--hard','FETCH_HEAD'],function(_0x8a37cc){if(_0x8a37cc){logger[_0xae3d('0x18')](_0x8a37cc);return _0x3f8cf9[_0xae3d('0x15')](0x1f4)[_0xae3d('0x16')](_0x8a37cc);}logger[_0xae3d('0x19')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3f8cf9[_0xae3d('0x15')](0xc8)['json']({'output':_0xae3d('0x1d')});});};exports[_0xae3d('0x1e')]=function(_0x1415e8,_0x263b0e){exec(_0xae3d('0x1f'),function(_0x3e7afc,_0x26c419,_0x155099){logger[_0xae3d('0x19')](_0x26c419);logger[_0xae3d('0x19')](_0x155099);if(_0x3e7afc){logger[_0xae3d('0x18')](_0x3e7afc);return _0x263b0e[_0xae3d('0x15')](0x1f4)[_0xae3d('0x16')](_0x3e7afc);}return _0x263b0e[_0xae3d('0x15')](0xc8)[_0xae3d('0x16')]({'output':_0x26c419});});};exports[_0xae3d('0x20')]=function(_0xfb54f6,_0x21b608){return pm2[_0xae3d('0x20')](_0xae3d('0x21'))['then'](function(_0x16c014){logger[_0xae3d('0x19')](_0xae3d('0x22'),_0x16c014);return _0x21b608[_0xae3d('0x15')](0xc8)[_0xae3d('0x16')]({'output':_0xae3d('0x23')});})[_0xae3d('0x24')](function(_0x54c1e1){logger['error'](_0x54c1e1);return _0x21b608[_0xae3d('0x15')](0x1f4)[_0xae3d('0x16')](_0x54c1e1);});};exports[_0xae3d('0x25')]=function(_0x3114f9,_0xb69ec9){var _0x561371=fs[_0xae3d('0x26')](path[_0xae3d('0x27')](config['root'],_0xae3d('0x28'),_0xae3d('0x25')));var _0x2cf750=[];for(var _0x46f484=0x0;_0x46f484<_0x561371[_0xae3d('0x29')];_0x46f484++){var _0x6ef13c=_0x561371[_0x46f484]['replace']('.js','');if(compareVersions(module['exports'][_0xae3d('0x4')],_0x6ef13c)===-0x1){_0x2cf750[_0xae3d('0x2a')](_0x6ef13c);}}if(_0x2cf750[_0xae3d('0x29')]){var _0x270043=_0x2cf750['sort'](compareVersions);var _0x31af1b=new Umzug({'storage':_0xae3d('0x2b'),'storageOptions':{'model':db[_0xae3d('0x2c')],'modelName':_0xae3d('0x2c'),'columnName':_0xae3d('0x4')},'migrations':{'params':[db[_0xae3d('0x2b')][_0xae3d('0x2d')](),db['sequelize'][_0xae3d('0x2e')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config[_0xae3d('0xe')],'server',_0xae3d('0x25')),'pattern':/\.js$/}});_0x31af1b['up']({'migrations':_['map'](_0x270043,function(_0x59425f){return _0x59425f+_0xae3d('0x2f');})})[_0xae3d('0x30')](function(){return _0xb69ec9[_0xae3d('0x15')](0xc8)['json']({'output':_0xae3d('0x31')+module['exports'][_0xae3d('0x4')]+_0xae3d('0x32')+_[_0xae3d('0x33')](_0x270043),'migrations':_[_0xae3d('0x27')](_0x270043)});})[_0xae3d('0x24')](function(_0x3fc3c0){if(_0x3fc3c0 instanceof db[_0xae3d('0x2b')][_0xae3d('0x34')]){return _0xb69ec9[_0xae3d('0x15')](0xc8)[_0xae3d('0x16')]({'output':_0xae3d('0x35')});}else{return _0xb69ec9['status'](0x1f4)['json'](_0x3fc3c0);}});}else{return _0xb69ec9[_0xae3d('0x15')](0xc8)['json']({'output':_0xae3d('0x35')});}}; \ No newline at end of file +var _0xed20=['exec','../../mysqldb','../../config/environment','../../config/logger','update','root','index','exports','query','tags','latest','2.0.0','status','json','fetch','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard','pull','npm\x20install\x20--production','info','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','server','.js','push','sequelize','Migration','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','child_process'];(function(_0x2c0619,_0x26ac1a){var _0xf3bbe8=function(_0x296ebe){while(--_0x296ebe){_0x2c0619['push'](_0x2c0619['shift']());}};_0xf3bbe8(++_0x26ac1a);}(_0xed20,0xce));var _0x0ed2=function(_0x2a1f14,_0x333e89){_0x2a1f14=_0x2a1f14-0x0;var _0x58e849=_0xed20[_0x2a1f14];return _0x58e849;};'use strict';var Umzug=require(_0x0ed2('0x0'));var path=require(_0x0ed2('0x1'));var fs=require('fs');var _=require(_0x0ed2('0x2'));var pkginfo=require('pkginfo')(module,_0x0ed2('0x3'));var compareVersions=require(_0x0ed2('0x4'));var exec=require(_0x0ed2('0x5'))[_0x0ed2('0x6')];var db=require(_0x0ed2('0x7'))['db'];var config=require(_0x0ed2('0x8'));var pm2=require('../../config/pm2');var logger=require(_0x0ed2('0x9'))(_0x0ed2('0xa'));var git=require('simple-git')(config[_0x0ed2('0xb')]);exports[_0x0ed2('0xc')]=function(_0x65848d,_0x39498b){var _0x5c6c0c={'current':module[_0x0ed2('0xd')][_0x0ed2('0x3')],'phonebar':0x2};if(_0x65848d[_0x0ed2('0xe')]&&_0x65848d[_0x0ed2('0xe')]['latest']){return git['fetch']()[_0x0ed2('0xf')](function(_0x1a3885,_0x245e65){_0x5c6c0c[_0x0ed2('0x10')]=(_0x1a3885?module[_0x0ed2('0xd')][_0x0ed2('0x3')]:_0x245e65[_0x0ed2('0x10')])||_0x0ed2('0x11');return _0x39498b[_0x0ed2('0x12')](0xc8)[_0x0ed2('0x13')](_0x5c6c0c);});}else{return _0x39498b[_0x0ed2('0x12')](0xc8)[_0x0ed2('0x13')](_0x5c6c0c);}};exports['fetch']=function(_0x30e94e,_0x3b0f4b){return git[_0x0ed2('0x14')]([_0x0ed2('0x15'),_0x0ed2('0x16')],function(_0x4be1ad){if(_0x4be1ad){logger[_0x0ed2('0x17')](_0x4be1ad);return _0x3b0f4b[_0x0ed2('0x12')](0x1f4)[_0x0ed2('0x13')](_0x4be1ad);}logger['info'](_0x0ed2('0x18'));return _0x3b0f4b['status'](0xc8)[_0x0ed2('0x13')]({'output':_0x0ed2('0x19')});});};exports[_0x0ed2('0x1a')]=function(_0x4c2726,_0x50c142){return git[_0x0ed2('0x1a')]([_0x0ed2('0x1b'),'FETCH_HEAD'],function(_0x322e35){if(_0x322e35){logger['error'](_0x322e35);return _0x50c142[_0x0ed2('0x12')](0x1f4)[_0x0ed2('0x13')](_0x322e35);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x50c142['status'](0xc8)[_0x0ed2('0x13')]({'output':_0x0ed2('0x1c')});});};exports[_0x0ed2('0x1d')]=function(_0x1206e3,_0x4712e3){exec(_0x0ed2('0x1e'),function(_0x13d3b7,_0x56f511,_0x4c1dbd){logger[_0x0ed2('0x1f')](_0x56f511);logger[_0x0ed2('0x1f')](_0x4c1dbd);if(_0x13d3b7){logger[_0x0ed2('0x17')](_0x13d3b7);return _0x4712e3[_0x0ed2('0x12')](0x1f4)[_0x0ed2('0x13')](_0x13d3b7);}return _0x4712e3[_0x0ed2('0x12')](0xc8)[_0x0ed2('0x13')]({'output':_0x56f511});});};exports[_0x0ed2('0x20')]=function(_0x5f2660,_0x1da1a2){return pm2[_0x0ed2('0x20')](_0x0ed2('0x21'))[_0x0ed2('0x22')](function(_0x466b49){logger['info'](_0x0ed2('0x23'),_0x466b49);return _0x1da1a2[_0x0ed2('0x12')](0xc8)[_0x0ed2('0x13')]({'output':_0x0ed2('0x24')});})[_0x0ed2('0x25')](function(_0xe5cacc){logger[_0x0ed2('0x17')](_0xe5cacc);return _0x1da1a2[_0x0ed2('0x12')](0x1f4)[_0x0ed2('0x13')](_0xe5cacc);});};exports[_0x0ed2('0x26')]=function(_0x597c6e,_0x3bc558){var _0x5e9d4d=fs['readdirSync'](path[_0x0ed2('0x27')](config[_0x0ed2('0xb')],_0x0ed2('0x28'),_0x0ed2('0x26')));var _0x2a9b01=[];for(var _0xc0c69a=0x0;_0xc0c69a<_0x5e9d4d['length'];_0xc0c69a++){var _0x5d8394=_0x5e9d4d[_0xc0c69a]['replace'](_0x0ed2('0x29'),'');if(compareVersions(module[_0x0ed2('0xd')][_0x0ed2('0x3')],_0x5d8394)===-0x1){_0x2a9b01[_0x0ed2('0x2a')](_0x5d8394);}}if(_0x2a9b01['length']){var _0x2685f1=_0x2a9b01['sort'](compareVersions);var _0x43eb53=new Umzug({'storage':_0x0ed2('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':_0x0ed2('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0x0ed2('0x2b')][_0x0ed2('0x2d')](),db[_0x0ed2('0x2b')][_0x0ed2('0x2e')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x0ed2('0x27')](config[_0x0ed2('0xb')],'server',_0x0ed2('0x26')),'pattern':/\.js$/}});_0x43eb53['up']({'migrations':_[_0x0ed2('0x2f')](_0x2685f1,function(_0x4bcfec){return _0x4bcfec+_0x0ed2('0x29');})})[_0x0ed2('0x22')](function(){return _0x3bc558[_0x0ed2('0x12')](0xc8)[_0x0ed2('0x13')]({'output':_0x0ed2('0x30')+module[_0x0ed2('0xd')][_0x0ed2('0x3')]+_0x0ed2('0x31')+_[_0x0ed2('0x32')](_0x2685f1),'migrations':_['join'](_0x2685f1)});})['catch'](function(_0x11bb54){if(_0x11bb54 instanceof db['sequelize'][_0x0ed2('0x33')]){return _0x3bc558[_0x0ed2('0x12')](0xc8)[_0x0ed2('0x13')]({'output':_0x0ed2('0x34')});}else{return _0x3bc558[_0x0ed2('0x12')](0x1f4)['json'](_0x11bb54);}});}else{return _0x3bc558[_0x0ed2('0x12')](0xc8)[_0x0ed2('0x13')]({'output':_0x0ed2('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 3c1a705..d76775c 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 _0x012a=['../../config/environment','isAuthenticated','get','/describe','/:id','show','post','put','update','delete','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4097a6,_0x44c830){var _0xfed555=function(_0x3d7ae6){while(--_0x3d7ae6){_0x4097a6['push'](_0x4097a6['shift']());}};_0xfed555(++_0x44c830);}(_0x012a,0x1dc));var _0xa012=function(_0x15cf23,_0x4f90d5){_0x15cf23=_0x15cf23-0x0;var _0x19cf58=_0x012a[_0x15cf23];return _0x19cf58;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa012('0x0'));var express=require('express');var router=express[_0xa012('0x1')]();var auth=require(_0xa012('0x2'));var interaction=require(_0xa012('0x3'));var config=require(_0xa012('0x4'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0xa012('0x5')](),controller['index']);router[_0xa012('0x6')](_0xa012('0x7'),auth[_0xa012('0x5')](),controller['describe']);router[_0xa012('0x6')](_0xa012('0x8'),auth['isAuthenticated'](),controller[_0xa012('0x9')]);router[_0xa012('0xa')]('/',auth[_0xa012('0x5')](),controller['create']);router[_0xa012('0xb')]('/:id',auth[_0xa012('0x5')](),controller[_0xa012('0xc')]);router[_0xa012('0xd')]('/:id',auth[_0xa012('0x5')](),controller[_0xa012('0xe')]);module[_0xa012('0xf')]=router; \ No newline at end of file +var _0xa2cb=['../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5aa0a1,_0x58d7d4){var _0x38934b=function(_0x1d6776){while(--_0x1d6776){_0x5aa0a1['push'](_0x5aa0a1['shift']());}};_0x38934b(++_0x58d7d4);}(_0xa2cb,0x6b));var _0xba2c=function(_0x399f68,_0x598a83){_0x399f68=_0x399f68-0x0;var _0x12ba5c=_0xa2cb[_0x399f68];return _0x12ba5c;};'use strict';var multer=require(_0xba2c('0x0'));var util=require('util');var path=require(_0xba2c('0x1'));var timeout=require(_0xba2c('0x2'));var express=require(_0xba2c('0x3'));var router=express[_0xba2c('0x4')]();var auth=require(_0xba2c('0x5'));var interaction=require(_0xba2c('0x6'));var config=require(_0xba2c('0x7'));var controller=require(_0xba2c('0x8'));router[_0xba2c('0x9')]('/',auth[_0xba2c('0xa')](),controller[_0xba2c('0xb')]);router['get']('/describe',auth[_0xba2c('0xa')](),controller[_0xba2c('0xc')]);router['get'](_0xba2c('0xd'),auth[_0xba2c('0xa')](),controller['show']);router[_0xba2c('0xe')]('/',auth['isAuthenticated'](),controller[_0xba2c('0xf')]);router[_0xba2c('0x10')]('/:id',auth[_0xba2c('0xa')](),controller['update']);router[_0xba2c('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xba2c('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 5aa348c..ea68bf8 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 _0xe14b=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0xe14b,0x93));var _0xbe14=function(_0x407ffb,_0x5d6dbc){_0x407ffb=_0x407ffb-0x0;var _0x4d4206=_0xe14b[_0x407ffb];return _0x4d4206;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbe14('0x2')]},'calleridname':{'type':Sequelize[_0xbe14('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xbe14('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xbe14('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xbe14('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xbe14('0x3')]},'agentdumpAt':{'type':Sequelize[_0xbe14('0x3')]},'holdtime':{'type':Sequelize[_0xbe14('0x4')]},'agentcomplete':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbe14('0x4')]},'reason':{'type':Sequelize[_0xbe14('0x2')]},'lastevent':{'type':Sequelize[_0xbe14('0x2')]},'channel':{'type':Sequelize[_0xbe14('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xbe14('0x2')]},'connectedlinename':{'type':Sequelize[_0xbe14('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbe14('0x2')]},'context':{'type':Sequelize[_0xbe14('0x2')]},'exten':{'type':Sequelize[_0xbe14('0x2')]},'priority':{'type':Sequelize[_0xbe14('0x2')]},'destchannel':{'type':Sequelize[_0xbe14('0x2')]},'destchannelstate':{'type':Sequelize[_0xbe14('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xbe14('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbe14('0x2')]},'destcalleridname':{'type':Sequelize[_0xbe14('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbe14('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xbe14('0x2')]},'destlanguage':{'type':Sequelize[_0xbe14('0x2')]},'destaccountcode':{'type':Sequelize[_0xbe14('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xbe14('0x2')]},'destuniqueid':{'type':Sequelize[_0xbe14('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xbe14('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xbe14('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbe14('0x2')],'comment':_0xbe14('0x6')},'transferexten':{'type':Sequelize[_0xbe14('0x2')]},'transferuniqueid':{'type':Sequelize[_0xbe14('0x2')]},'agententerreason':{'type':Sequelize[_0xbe14('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8958=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE'];(function(_0x28faac,_0x59eea7){var _0x52abab=function(_0x5a1477){while(--_0x5a1477){_0x28faac['push'](_0x28faac['shift']());}};_0x52abab(++_0x59eea7);}(_0x8958,0x93));var _0x8895=function(_0x5d80af,_0x120f2d){_0x5d80af=_0x5d80af-0x0;var _0x35c72d=_0x8958[_0x5d80af];return _0x35c72d;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8895('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8895('0x1')]},'agentcalledAt':{'type':Sequelize[_0x8895('0x2')]},'agentconnectAt':{'type':Sequelize[_0x8895('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x8895('0x2')]},'agentdumpAt':{'type':Sequelize[_0x8895('0x2')]},'holdtime':{'type':Sequelize[_0x8895('0x3')]},'agentcomplete':{'type':Sequelize[_0x8895('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8895('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8895('0x3')]},'agentacw':{'type':Sequelize[_0x8895('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8895('0x3')]},'reason':{'type':Sequelize[_0x8895('0x1')]},'lastevent':{'type':Sequelize[_0x8895('0x1')]},'channel':{'type':Sequelize[_0x8895('0x1')]},'channelstate':{'type':Sequelize[_0x8895('0x3')]},'channelstatedesc':{'type':Sequelize[_0x8895('0x1')]},'connectedlinenum':{'type':Sequelize[_0x8895('0x1')]},'connectedlinename':{'type':Sequelize[_0x8895('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8895('0x1')]},'context':{'type':Sequelize[_0x8895('0x1')]},'exten':{'type':Sequelize[_0x8895('0x1')]},'priority':{'type':Sequelize[_0x8895('0x1')]},'destchannel':{'type':Sequelize[_0x8895('0x1')]},'destchannelstate':{'type':Sequelize[_0x8895('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x8895('0x1')]},'destcalleridname':{'type':Sequelize[_0x8895('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x8895('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x8895('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x8895('0x1')]},'destpriority':{'type':Sequelize[_0x8895('0x1')]},'destuniqueid':{'type':Sequelize[_0x8895('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8895('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x8895('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8895('0x1')],'comment':_0x8895('0x5')},'transferexten':{'type':Sequelize[_0x8895('0x1')]},'transferuniqueid':{'type':Sequelize[_0x8895('0x1')]},'agententerreason':{'type':Sequelize[_0x8895('0x3')],'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 f2606fd..6ac7069 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 _0x86d0=['rawAttributes','intersection','find','body','update','describe','html-pdf','request-promise','moment','path','to-csv','lodash','squel','crypto','jsforce','querystring','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','apply','save','then','destroy','error','stack','name','send','index','VoiceAgentReport','fieldName','type','key','model','keys','filters','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','VIRTUAL','options','include','rows','catch','show','params'];(function(_0x57c601,_0x3293a2){var _0x10d301=function(_0x37c889){while(--_0x37c889){_0x57c601['push'](_0x57c601['shift']());}};_0x10d301(++_0x3293a2);}(_0x86d0,0x1db));var _0x086d=function(_0x28bfdc,_0x50fd27){_0x28bfdc=_0x28bfdc-0x0;var _0x25bf45=_0x86d0[_0x28bfdc];return _0x25bf45;};'use strict';var pdf=require(_0x086d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x086d('0x1'));var moment=require(_0x086d('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x086d('0x3'));var sox=require('sox');var csv=require(_0x086d('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x086d('0x5'));var squel=require(_0x086d('0x6'));var crypto=require(_0x086d('0x7'));var jsforce=require(_0x086d('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x086d('0x9'));var Papa=require('papaparse');var Redis=require(_0x086d('0xa'));var authService=require(_0x086d('0xb'));var qs=require(_0x086d('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x086d('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x086d('0xe'));var config=require(_0x086d('0xf'));var licenseUtil=require(_0x086d('0x10'));var db=require(_0x086d('0x11'))['db'];function respondWithStatusCode(_0x5c7fed,_0x90ef23){_0x90ef23=_0x90ef23||0xcc;return function(_0x4e1197){if(_0x4e1197){return _0x5c7fed[_0x086d('0x12')](_0x90ef23);}return _0x5c7fed[_0x086d('0x13')](_0x90ef23)[_0x086d('0x14')]();};}function respondWithResult(_0x10ccb5,_0x108f71){_0x108f71=_0x108f71||0xc8;return function(_0x57fbeb){if(_0x57fbeb){return _0x10ccb5['status'](_0x108f71)[_0x086d('0x15')](_0x57fbeb);}};}function respondWithFilteredResult(_0x576538,_0x5cd610){return function(_0x17d9b9){if(_0x17d9b9){var _0x11c320=_0x17d9b9[_0x086d('0x16')],_0x3cdc99=_0x5cd610[_0x086d('0x17')],_0x4c5e70=_0x5cd610[_0x086d('0x17')]+_0x5cd610[_0x086d('0x18')],_0x4a107c;if(_0x4c5e70>=_0x11c320){_0x4c5e70=_0x11c320;_0x4a107c=0xc8;}else{_0x4a107c=0xce;}_0x576538[_0x086d('0x13')](_0x4a107c);return _0x576538[_0x086d('0x19')]('Content-Range',_0x3cdc99+'-'+_0x4c5e70+'/'+_0x11c320)[_0x086d('0x15')](_0x17d9b9);}return null;};}function patchUpdates(_0x4c80ff){return function(_0x30cae4){try{jsonpatch[_0x086d('0x1a')](_0x30cae4,_0x4c80ff,!![]);}catch(_0x163a96){return BPromise['reject'](_0x163a96);}return _0x30cae4[_0x086d('0x1b')]();};}function saveUpdates(_0x5346ba,_0x301f30){return function(_0x6e5b2c){if(_0x6e5b2c){return _0x6e5b2c['update'](_0x5346ba)[_0x086d('0x1c')](function(_0x387bf2){return _0x387bf2;});}return null;};}function removeEntity(_0x35bc4c,_0x5d41e8){return function(_0x4ea047){if(_0x4ea047){return _0x4ea047[_0x086d('0x1d')]()[_0x086d('0x1c')](function(){_0x35bc4c[_0x086d('0x13')](0xcc)[_0x086d('0x14')]();});}};}function handleEntityNotFound(_0x2c0e50,_0x33fa25){return function(_0x5759fc){if(!_0x5759fc){_0x2c0e50[_0x086d('0x12')](0x194);}return _0x5759fc;};}function handleError(_0x340a95,_0x37d244){_0x37d244=_0x37d244||0x1f4;return function(_0x447169){logger[_0x086d('0x1e')](_0x447169[_0x086d('0x1f')]);if(_0x447169[_0x086d('0x20')]){delete _0x447169[_0x086d('0x20')];}_0x340a95[_0x086d('0x13')](_0x37d244)[_0x086d('0x21')](_0x447169);};}exports[_0x086d('0x22')]=function(_0x1ef173,_0x1d794a){var _0x2a0cd3={},_0x5515ab={},_0x77170a={'count':0x0,'rows':[]};var _0xc34a3a=_['map'](db[_0x086d('0x23')]['rawAttributes'],function(_0xd1da74){return{'name':_0xd1da74[_0x086d('0x24')],'type':_0xd1da74[_0x086d('0x25')][_0x086d('0x26')]};});_0x5515ab[_0x086d('0x27')]=_['map'](_0xc34a3a,_0x086d('0x20'));_0x5515ab['query']=_[_0x086d('0x28')](_0x1ef173['query']);_0x5515ab[_0x086d('0x29')]=_['intersection'](_0x5515ab[_0x086d('0x27')],_0x5515ab['query']);_0x2a0cd3[_0x086d('0x2a')]=_['intersection'](_0x5515ab['model'],qs[_0x086d('0x2b')](_0x1ef173[_0x086d('0x2c')]['fields']));_0x2a0cd3[_0x086d('0x2a')]=_0x2a0cd3[_0x086d('0x2a')][_0x086d('0x2d')]?_0x2a0cd3[_0x086d('0x2a')]:_0x5515ab[_0x086d('0x27')];if(!_0x1ef173['query'][_0x086d('0x2e')](_0x086d('0x2f'))){_0x2a0cd3[_0x086d('0x18')]=qs[_0x086d('0x18')](_0x1ef173['query'][_0x086d('0x18')]);_0x2a0cd3[_0x086d('0x17')]=qs[_0x086d('0x17')](_0x1ef173['query'][_0x086d('0x17')]);}_0x2a0cd3[_0x086d('0x30')]=qs[_0x086d('0x31')](_0x1ef173[_0x086d('0x2c')][_0x086d('0x31')]);_0x2a0cd3['where']=qs['filters'](_[_0x086d('0x32')](_0x1ef173[_0x086d('0x2c')],_0x5515ab[_0x086d('0x29')]),_0xc34a3a);if(_0x1ef173[_0x086d('0x2c')]['filter']){_0x2a0cd3[_0x086d('0x33')]=_[_0x086d('0x34')](_0x2a0cd3[_0x086d('0x33')],{'$or':_[_0x086d('0x35')](_0xc34a3a,function(_0x26c02a){if(_0x26c02a[_0x086d('0x25')]!==_0x086d('0x36')){var _0x9e08fe={};_0x9e08fe[_0x26c02a['name']]={'$like':'%'+_0x1ef173['query']['filter']+'%'};return _0x9e08fe;}})});}_0x2a0cd3=_['merge']({},_0x2a0cd3,_0x1ef173[_0x086d('0x37')]);var _0x3d405a={'where':_0x2a0cd3[_0x086d('0x33')]};return db[_0x086d('0x23')]['count'](_0x3d405a)[_0x086d('0x1c')](function(_0x90c7af){_0x77170a[_0x086d('0x16')]=_0x90c7af;if(_0x1ef173[_0x086d('0x2c')]['includeAll']){_0x2a0cd3[_0x086d('0x38')]=[{'all':!![]}];}return db[_0x086d('0x23')]['findAll'](_0x2a0cd3);})[_0x086d('0x1c')](function(_0x2a5b7b){_0x77170a[_0x086d('0x39')]=_0x2a5b7b;return _0x77170a;})[_0x086d('0x1c')](respondWithFilteredResult(_0x1d794a,_0x2a0cd3))[_0x086d('0x3a')](handleError(_0x1d794a,null));};exports[_0x086d('0x3b')]=function(_0x319e9b,_0x4ec943){var _0x5b3199={'raw':![],'where':{'id':_0x319e9b[_0x086d('0x3c')]['id']}},_0x71ea92={};_0x71ea92[_0x086d('0x27')]=_[_0x086d('0x28')](db[_0x086d('0x23')][_0x086d('0x3d')]);_0x71ea92[_0x086d('0x2c')]=_[_0x086d('0x28')](_0x319e9b[_0x086d('0x2c')]);_0x71ea92[_0x086d('0x29')]=_[_0x086d('0x3e')](_0x71ea92[_0x086d('0x27')],_0x71ea92[_0x086d('0x2c')]);_0x5b3199[_0x086d('0x2a')]=_[_0x086d('0x3e')](_0x71ea92[_0x086d('0x27')],qs[_0x086d('0x2b')](_0x319e9b[_0x086d('0x2c')][_0x086d('0x2b')]));_0x5b3199['attributes']=_0x5b3199[_0x086d('0x2a')][_0x086d('0x2d')]?_0x5b3199[_0x086d('0x2a')]:_0x71ea92[_0x086d('0x27')];if(_0x319e9b[_0x086d('0x2c')]['includeAll']){_0x5b3199[_0x086d('0x38')]=[{'all':!![]}];}_0x5b3199=_[_0x086d('0x34')]({},_0x5b3199,_0x319e9b['options']);return db[_0x086d('0x23')][_0x086d('0x3f')](_0x5b3199)[_0x086d('0x1c')](handleEntityNotFound(_0x4ec943,null))[_0x086d('0x1c')](respondWithResult(_0x4ec943,null))['catch'](handleError(_0x4ec943,null));};exports['create']=function(_0xf5b990,_0x746a66){return db[_0x086d('0x23')]['create'](_0xf5b990[_0x086d('0x40')],{})[_0x086d('0x1c')](respondWithResult(_0x746a66,0xc9))[_0x086d('0x3a')](handleError(_0x746a66,null));};exports[_0x086d('0x41')]=function(_0x422305,_0x1d2e0b){if(_0x422305[_0x086d('0x40')]['id']){delete _0x422305['body']['id'];}return db[_0x086d('0x23')][_0x086d('0x3f')]({'where':{'id':_0x422305[_0x086d('0x3c')]['id']}})[_0x086d('0x1c')](handleEntityNotFound(_0x1d2e0b,null))[_0x086d('0x1c')](saveUpdates(_0x422305[_0x086d('0x40')],null))[_0x086d('0x1c')](respondWithResult(_0x1d2e0b,null))[_0x086d('0x3a')](handleError(_0x1d2e0b,null));};exports[_0x086d('0x1d')]=function(_0x3f1b7d,_0x1f2417){return db[_0x086d('0x23')][_0x086d('0x3f')]({'where':{'id':_0x3f1b7d[_0x086d('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1f2417,null))[_0x086d('0x1c')](removeEntity(_0x1f2417,null))['catch'](handleError(_0x1f2417,null));};exports[_0x086d('0x42')]=function(_0x604b44,_0x504e9c){return db[_0x086d('0x23')]['describe']()[_0x086d('0x1c')](respondWithResult(_0x504e9c,null))[_0x086d('0x3a')](handleError(_0x504e9c,null));}; \ No newline at end of file +var _0xecc8=['type','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','json','save','update','then','error','stack','name','send','index','map','VoiceAgentReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xecc8,0x124));var _0x8ecc=function(_0x210441,_0x3179d7){_0x210441=_0x210441-0x0;var _0x19ff3d=_0xecc8[_0x210441];return _0x19ff3d;};'use strict';var pdf=require(_0x8ecc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8ecc('0x1'));var zipdir=require(_0x8ecc('0x2'));var jsonpatch=require(_0x8ecc('0x3'));var rp=require('request-promise');var moment=require(_0x8ecc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8ecc('0x5'));var util=require(_0x8ecc('0x6'));var path=require('path');var sox=require(_0x8ecc('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8ecc('0x8'));var squel=require(_0x8ecc('0x9'));var crypto=require(_0x8ecc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8ecc('0xb'));var toCsv=require(_0x8ecc('0xc'));var querystring=require(_0x8ecc('0xd'));var Papa=require('papaparse');var Redis=require(_0x8ecc('0xe'));var authService=require(_0x8ecc('0xf'));var qs=require(_0x8ecc('0x10'));var as=require(_0x8ecc('0x11'));var hardwareService=require(_0x8ecc('0x12'));var logger=require('../../config/logger')(_0x8ecc('0x13'));var utils=require(_0x8ecc('0x14'));var config=require(_0x8ecc('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ecc('0x16'))['db'];function respondWithStatusCode(_0x44681d,_0x550a29){_0x550a29=_0x550a29||0xcc;return function(_0x4a7ce0){if(_0x4a7ce0){return _0x44681d[_0x8ecc('0x17')](_0x550a29);}return _0x44681d['status'](_0x550a29)[_0x8ecc('0x18')]();};}function respondWithResult(_0x4bbd69,_0x452b81){_0x452b81=_0x452b81||0xc8;return function(_0x4c3d51){if(_0x4c3d51){return _0x4bbd69[_0x8ecc('0x19')](_0x452b81)['json'](_0x4c3d51);}};}function respondWithFilteredResult(_0x3d0e57,_0x4598d6){return function(_0x1c9a11){if(_0x1c9a11){var _0x3c29fe=_0x1c9a11[_0x8ecc('0x1a')],_0x211fb5=_0x4598d6[_0x8ecc('0x1b')],_0x2832f6=_0x4598d6[_0x8ecc('0x1b')]+_0x4598d6[_0x8ecc('0x1c')],_0x2b2176;if(_0x2832f6>=_0x3c29fe){_0x2832f6=_0x3c29fe;_0x2b2176=0xc8;}else{_0x2b2176=0xce;}_0x3d0e57[_0x8ecc('0x19')](_0x2b2176);return _0x3d0e57[_0x8ecc('0x1d')]('Content-Range',_0x211fb5+'-'+_0x2832f6+'/'+_0x3c29fe)[_0x8ecc('0x1e')](_0x1c9a11);}return null;};}function patchUpdates(_0x32802){return function(_0x167077){try{jsonpatch['apply'](_0x167077,_0x32802,!![]);}catch(_0x170dfb){return BPromise['reject'](_0x170dfb);}return _0x167077[_0x8ecc('0x1f')]();};}function saveUpdates(_0x17308f,_0x3e44db){return function(_0x198dfa){if(_0x198dfa){return _0x198dfa[_0x8ecc('0x20')](_0x17308f)[_0x8ecc('0x21')](function(_0x49000){return _0x49000;});}return null;};}function removeEntity(_0x298667,_0xc0e874){return function(_0x4ed63c){if(_0x4ed63c){return _0x4ed63c['destroy']()[_0x8ecc('0x21')](function(){_0x298667[_0x8ecc('0x19')](0xcc)[_0x8ecc('0x18')]();});}};}function handleEntityNotFound(_0x5fe515,_0x4ebfd3){return function(_0x3916c5){if(!_0x3916c5){_0x5fe515[_0x8ecc('0x17')](0x194);}return _0x3916c5;};}function handleError(_0x4b599c,_0x34e64c){_0x34e64c=_0x34e64c||0x1f4;return function(_0x27c52d){logger[_0x8ecc('0x22')](_0x27c52d[_0x8ecc('0x23')]);if(_0x27c52d[_0x8ecc('0x24')]){delete _0x27c52d['name'];}_0x4b599c[_0x8ecc('0x19')](_0x34e64c)[_0x8ecc('0x25')](_0x27c52d);};}exports[_0x8ecc('0x26')]=function(_0x39171e,_0x5f275b){var _0x65126b={},_0x5d711e={},_0x51a0ea={'count':0x0,'rows':[]};var _0x25022f=_[_0x8ecc('0x27')](db[_0x8ecc('0x28')]['rawAttributes'],function(_0x2ddac1){return{'name':_0x2ddac1[_0x8ecc('0x29')],'type':_0x2ddac1['type'][_0x8ecc('0x2a')]};});_0x5d711e[_0x8ecc('0x2b')]=_[_0x8ecc('0x27')](_0x25022f,_0x8ecc('0x24'));_0x5d711e[_0x8ecc('0x2c')]=_[_0x8ecc('0x2d')](_0x39171e['query']);_0x5d711e[_0x8ecc('0x2e')]=_[_0x8ecc('0x2f')](_0x5d711e[_0x8ecc('0x2b')],_0x5d711e['query']);_0x65126b[_0x8ecc('0x30')]=_[_0x8ecc('0x2f')](_0x5d711e[_0x8ecc('0x2b')],qs[_0x8ecc('0x31')](_0x39171e['query'][_0x8ecc('0x31')]));_0x65126b[_0x8ecc('0x30')]=_0x65126b[_0x8ecc('0x30')][_0x8ecc('0x32')]?_0x65126b['attributes']:_0x5d711e[_0x8ecc('0x2b')];if(!_0x39171e[_0x8ecc('0x2c')][_0x8ecc('0x33')]('nolimit')){_0x65126b[_0x8ecc('0x1c')]=qs['limit'](_0x39171e[_0x8ecc('0x2c')][_0x8ecc('0x1c')]);_0x65126b[_0x8ecc('0x1b')]=qs[_0x8ecc('0x1b')](_0x39171e[_0x8ecc('0x2c')][_0x8ecc('0x1b')]);}_0x65126b[_0x8ecc('0x34')]=qs[_0x8ecc('0x35')](_0x39171e['query'][_0x8ecc('0x35')]);_0x65126b[_0x8ecc('0x36')]=qs[_0x8ecc('0x2e')](_[_0x8ecc('0x37')](_0x39171e[_0x8ecc('0x2c')],_0x5d711e[_0x8ecc('0x2e')]),_0x25022f);if(_0x39171e[_0x8ecc('0x2c')][_0x8ecc('0x38')]){_0x65126b[_0x8ecc('0x36')]=_[_0x8ecc('0x39')](_0x65126b['where'],{'$or':_[_0x8ecc('0x27')](_0x25022f,function(_0x2d38ea){if(_0x2d38ea[_0x8ecc('0x3a')]!==_0x8ecc('0x3b')){var _0x4d02c6={};_0x4d02c6[_0x2d38ea['name']]={'$like':'%'+_0x39171e[_0x8ecc('0x2c')][_0x8ecc('0x38')]+'%'};return _0x4d02c6;}})});}_0x65126b=_[_0x8ecc('0x39')]({},_0x65126b,_0x39171e[_0x8ecc('0x3c')]);var _0x4c25fa={'where':_0x65126b['where']};return db[_0x8ecc('0x28')][_0x8ecc('0x1a')](_0x4c25fa)[_0x8ecc('0x21')](function(_0x322cd1){_0x51a0ea[_0x8ecc('0x1a')]=_0x322cd1;if(_0x39171e[_0x8ecc('0x2c')][_0x8ecc('0x3d')]){_0x65126b[_0x8ecc('0x3e')]=[{'all':!![]}];}return db[_0x8ecc('0x28')]['findAll'](_0x65126b);})[_0x8ecc('0x21')](function(_0x362dd3){_0x51a0ea[_0x8ecc('0x3f')]=_0x362dd3;return _0x51a0ea;})[_0x8ecc('0x21')](respondWithFilteredResult(_0x5f275b,_0x65126b))[_0x8ecc('0x40')](handleError(_0x5f275b,null));};exports['show']=function(_0x42e34f,_0x2c49ad){var _0x401cb3={'raw':![],'where':{'id':_0x42e34f[_0x8ecc('0x41')]['id']}},_0x432bf2={};_0x432bf2[_0x8ecc('0x2b')]=_[_0x8ecc('0x2d')](db['VoiceAgentReport']['rawAttributes']);_0x432bf2[_0x8ecc('0x2c')]=_[_0x8ecc('0x2d')](_0x42e34f[_0x8ecc('0x2c')]);_0x432bf2[_0x8ecc('0x2e')]=_['intersection'](_0x432bf2[_0x8ecc('0x2b')],_0x432bf2[_0x8ecc('0x2c')]);_0x401cb3[_0x8ecc('0x30')]=_[_0x8ecc('0x2f')](_0x432bf2['model'],qs[_0x8ecc('0x31')](_0x42e34f['query'][_0x8ecc('0x31')]));_0x401cb3[_0x8ecc('0x30')]=_0x401cb3['attributes'][_0x8ecc('0x32')]?_0x401cb3[_0x8ecc('0x30')]:_0x432bf2[_0x8ecc('0x2b')];if(_0x42e34f[_0x8ecc('0x2c')][_0x8ecc('0x3d')]){_0x401cb3['include']=[{'all':!![]}];}_0x401cb3=_['merge']({},_0x401cb3,_0x42e34f['options']);return db[_0x8ecc('0x28')][_0x8ecc('0x42')](_0x401cb3)[_0x8ecc('0x21')](handleEntityNotFound(_0x2c49ad,null))[_0x8ecc('0x21')](respondWithResult(_0x2c49ad,null))[_0x8ecc('0x40')](handleError(_0x2c49ad,null));};exports[_0x8ecc('0x43')]=function(_0x581f17,_0x14fbcb){return db[_0x8ecc('0x28')]['create'](_0x581f17[_0x8ecc('0x44')],{})['then'](respondWithResult(_0x14fbcb,0xc9))['catch'](handleError(_0x14fbcb,null));};exports[_0x8ecc('0x20')]=function(_0x3bd2bf,_0x39fe5c){if(_0x3bd2bf[_0x8ecc('0x44')]['id']){delete _0x3bd2bf[_0x8ecc('0x44')]['id'];}return db['VoiceAgentReport']['find']({'where':{'id':_0x3bd2bf[_0x8ecc('0x41')]['id']}})['then'](handleEntityNotFound(_0x39fe5c,null))[_0x8ecc('0x21')](saveUpdates(_0x3bd2bf[_0x8ecc('0x44')],null))['then'](respondWithResult(_0x39fe5c,null))[_0x8ecc('0x40')](handleError(_0x39fe5c,null));};exports['destroy']=function(_0xa5433d,_0x3aec74){return db['VoiceAgentReport'][_0x8ecc('0x42')]({'where':{'id':_0xa5433d[_0x8ecc('0x41')]['id']}})[_0x8ecc('0x21')](handleEntityNotFound(_0x3aec74,null))[_0x8ecc('0x21')](removeEntity(_0x3aec74,null))[_0x8ecc('0x40')](handleError(_0x3aec74,null));};exports[_0x8ecc('0x45')]=function(_0x1c4a73,_0x21827c){return db[_0x8ecc('0x28')][_0x8ecc('0x45')]()[_0x8ecc('0x21')](respondWithResult(_0x21827c,null))[_0x8ecc('0x40')](handleError(_0x21827c,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index a3a2e9a..3e5dd76 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 _0xf249=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','api','moment'];(function(_0x394d90,_0xbac20e){var _0x4b6870=function(_0x9b45f7){while(--_0x9b45f7){_0x394d90['push'](_0x394d90['shift']());}};_0x4b6870(++_0xbac20e);}(_0xf249,0x172));var _0x9f24=function(_0xee4e16,_0x4a5df0){_0xee4e16=_0xee4e16-0x0;var _0x37570d=_0xf249[_0xee4e16];return _0x37570d;};'use strict';var _=require(_0x9f24('0x0'));var util=require(_0x9f24('0x1'));var logger=require('../../config/logger')(_0x9f24('0x2'));var moment=require(_0x9f24('0x3'));var BPromise=require(_0x9f24('0x4'));var rp=require(_0x9f24('0x5'));var fs=require('fs');var path=require(_0x9f24('0x6'));var rimraf=require(_0x9f24('0x7'));var config=require(_0x9f24('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0x9f24('0x9')]=function(_0x188fd9,_0x5ba79a){return _0x188fd9[_0x9f24('0xa')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4310=['bluebird','request-promise','path','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','lodash','util','../../config/logger','moment'];(function(_0x341c83,_0x2adfad){var _0x34ef0f=function(_0x59bb0f){while(--_0x59bb0f){_0x341c83['push'](_0x341c83['shift']());}};_0x34ef0f(++_0x2adfad);}(_0x4310,0x110));var _0x0431=function(_0x5774f2,_0x4905bb){_0x5774f2=_0x5774f2-0x0;var _0x483f77=_0x4310[_0x5774f2];return _0x483f77;};'use strict';var _=require(_0x0431('0x0'));var util=require(_0x0431('0x1'));var logger=require(_0x0431('0x2'))('api');var moment=require(_0x0431('0x3'));var BPromise=require(_0x0431('0x4'));var rp=require(_0x0431('0x5'));var fs=require('fs');var path=require(_0x0431('0x6'));var rimraf=require('rimraf');var config=require(_0x0431('0x7'));var attributes=require(_0x0431('0x8'));module[_0x0431('0x9')]=function(_0x20168a,_0x4fa14a){return _0x20168a[_0x0431('0xa')](_0x0431('0xb'),attributes,{'tableName':'report_agent','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 0c5ef71..116c161 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 _0xabca=['then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','UpdateVoiceAgentReport','where','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5b9b34,_0x41c0f2){var _0x2e1a4=function(_0x57c151){while(--_0x57c151){_0x5b9b34['push'](_0x5b9b34['shift']());}};_0x2e1a4(++_0x41c0f2);}(_0xabca,0x94));var _0xaabc=function(_0x53c279,_0x46f50d){_0x53c279=_0x53c279-0x0;var _0x3b3f03=_0xabca[_0x53c279];return _0x3b3f03;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaabc('0x0'));var BPromise=require(_0xaabc('0x1'));var rs=require(_0xaabc('0x2'));var fs=require('fs');var Redis=require(_0xaabc('0x3'));var db=require(_0xaabc('0x4'))['db'];var utils=require(_0xaabc('0x5'));var logger=require(_0xaabc('0x6'))(_0xaabc('0x7'));var config=require(_0xaabc('0x8'));var jayson=require(_0xaabc('0x9'));var client=jayson[_0xaabc('0xa')][_0xaabc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45c8de,_0x39f08e,_0x3c606e){return new BPromise(function(_0x360dde,_0x1b5348){return client['request'](_0x45c8de,_0x3c606e)[_0xaabc('0xc')](function(_0x4e7024){logger['info'](_0xaabc('0xd'),_0x39f08e,_0xaabc('0xe'));logger[_0xaabc('0xf')](_0xaabc('0x10'),_0x39f08e,_0xaabc('0xe'),JSON[_0xaabc('0x11')](_0x4e7024));if(_0x4e7024[_0xaabc('0x12')]){if(_0x4e7024[_0xaabc('0x12')][_0xaabc('0x13')]===0x1f4){logger[_0xaabc('0x12')](_0xaabc('0xd'),_0x39f08e,_0x4e7024[_0xaabc('0x12')][_0xaabc('0x14')]);return _0x1b5348(_0x4e7024['error'][_0xaabc('0x14')]);}logger[_0xaabc('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x39f08e,_0x4e7024[_0xaabc('0x12')][_0xaabc('0x14')]);return _0x360dde(_0x4e7024[_0xaabc('0x12')][_0xaabc('0x14')]);}else{logger[_0xaabc('0x15')](_0xaabc('0xd'),_0x39f08e,_0xaabc('0xe'));_0x360dde(_0x4e7024[_0xaabc('0x16')][_0xaabc('0x14')]);}})[_0xaabc('0x17')](function(_0x855233){logger[_0xaabc('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x39f08e,_0x855233);_0x1b5348(_0x855233);});});}exports[_0xaabc('0x18')]=function(_0x31820b){var _0xcf67f=this;return new Promise(function(_0x164c19,_0x1fa33a){return db[_0xaabc('0x19')][_0xaabc('0x1a')](_0x31820b[_0xaabc('0x1b')],{'raw':_0x31820b[_0xaabc('0x1c')]?_0x31820b['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x36dce2){logger[_0xaabc('0x15')](_0xaabc('0x18'),_0x31820b);logger[_0xaabc('0xf')](_0xaabc('0x18'),_0x31820b,JSON['stringify'](_0x36dce2));_0x164c19(_0x36dce2);})['catch'](function(_0x22d761){logger[_0xaabc('0x12')]('CreateVoiceAgentReport',_0x22d761[_0xaabc('0x14')],_0x31820b);_0x1fa33a(_0xcf67f[_0xaabc('0x12')](0x1f4,_0x22d761['message']));});});};exports[_0xaabc('0x1d')]=function(_0x5d489d){var _0xc5d9a1=this;return new Promise(function(_0x12a54a,_0x1289ca){return db[_0xaabc('0x19')]['update'](_0x5d489d[_0xaabc('0x1b')],{'raw':_0x5d489d[_0xaabc('0x1c')]?_0x5d489d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d489d['options']?_0x5d489d[_0xaabc('0x1c')][_0xaabc('0x1e')]||null:null,'attributes':_0x5d489d[_0xaabc('0x1c')]?_0x5d489d[_0xaabc('0x1c')]['attributes']||null:null,'limit':_0x5d489d[_0xaabc('0x1c')]?_0x5d489d['options'][_0xaabc('0x1f')]||null:null})[_0xaabc('0xc')](function(_0x58022c){logger[_0xaabc('0x15')]('UpdateVoiceAgentReport',_0x5d489d);logger[_0xaabc('0xf')]('UpdateVoiceAgentReport',_0x5d489d,JSON[_0xaabc('0x11')](_0x58022c));_0x12a54a(_0x58022c);})[_0xaabc('0x17')](function(_0x3a9ff6){logger['error'](_0xaabc('0x1d'),_0x3a9ff6['message'],_0x5d489d);_0x1289ca(_0xc5d9a1[_0xaabc('0x12')](0x1f4,_0x3a9ff6['message']));});});}; \ No newline at end of file +var _0x8dee=['update','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x8dee,0x17a));var _0xe8de=function(_0x5864fc,_0x46b33c){_0x5864fc=_0x5864fc-0x0;var _0x272cc6=_0x8dee[_0x5864fc];return _0x272cc6;};'use strict';var _=require(_0xe8de('0x0'));var util=require('util');var moment=require(_0xe8de('0x1'));var BPromise=require('bluebird');var rs=require(_0xe8de('0x2'));var fs=require('fs');var Redis=require(_0xe8de('0x3'));var db=require(_0xe8de('0x4'))['db'];var utils=require(_0xe8de('0x5'));var logger=require(_0xe8de('0x6'))(_0xe8de('0x7'));var config=require('../../config/environment');var jayson=require(_0xe8de('0x8'));var client=jayson[_0xe8de('0x9')][_0xe8de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x279aa1,_0x4127c3,_0x3cf8d9){return new BPromise(function(_0x148b29,_0x235dd3){return client[_0xe8de('0xb')](_0x279aa1,_0x3cf8d9)[_0xe8de('0xc')](function(_0x57d333){logger[_0xe8de('0xd')](_0xe8de('0xe'),_0x4127c3,'request\x20sent');logger[_0xe8de('0xf')](_0xe8de('0x10'),_0x4127c3,_0xe8de('0x11'),JSON[_0xe8de('0x12')](_0x57d333));if(_0x57d333[_0xe8de('0x13')]){if(_0x57d333[_0xe8de('0x13')]['code']===0x1f4){logger[_0xe8de('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x4127c3,_0x57d333[_0xe8de('0x13')][_0xe8de('0x14')]);return _0x235dd3(_0x57d333[_0xe8de('0x13')][_0xe8de('0x14')]);}logger[_0xe8de('0x13')](_0xe8de('0xe'),_0x4127c3,_0x57d333[_0xe8de('0x13')][_0xe8de('0x14')]);return _0x148b29(_0x57d333[_0xe8de('0x13')]['message']);}else{logger[_0xe8de('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x4127c3,_0xe8de('0x11'));_0x148b29(_0x57d333[_0xe8de('0x15')][_0xe8de('0x14')]);}})[_0xe8de('0x16')](function(_0x10e946){logger[_0xe8de('0x13')](_0xe8de('0xe'),_0x4127c3,_0x10e946);_0x235dd3(_0x10e946);});});}exports[_0xe8de('0x17')]=function(_0x2157d1){var _0x475d41=this;return new Promise(function(_0x91ad8f,_0x304902){return db[_0xe8de('0x18')][_0xe8de('0x19')](_0x2157d1[_0xe8de('0x1a')],{'raw':_0x2157d1['options']?_0x2157d1[_0xe8de('0x1b')][_0xe8de('0x1c')]===undefined?!![]:![]:!![]})[_0xe8de('0xc')](function(_0x4fa5b4){logger['info'](_0xe8de('0x17'),_0x2157d1);logger[_0xe8de('0xf')](_0xe8de('0x17'),_0x2157d1,JSON[_0xe8de('0x12')](_0x4fa5b4));_0x91ad8f(_0x4fa5b4);})[_0xe8de('0x16')](function(_0x29aa3a){logger[_0xe8de('0x13')](_0xe8de('0x17'),_0x29aa3a['message'],_0x2157d1);_0x304902(_0x475d41[_0xe8de('0x13')](0x1f4,_0x29aa3a[_0xe8de('0x14')]));});});};exports[_0xe8de('0x1d')]=function(_0x138376){var _0x4aa819=this;return new Promise(function(_0xf8b3a2,_0x32170e){return db[_0xe8de('0x18')][_0xe8de('0x1e')](_0x138376[_0xe8de('0x1a')],{'raw':_0x138376[_0xe8de('0x1b')]?_0x138376['options'][_0xe8de('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x138376[_0xe8de('0x1b')]?_0x138376[_0xe8de('0x1b')][_0xe8de('0x1f')]||null:null,'attributes':_0x138376['options']?_0x138376['options'][_0xe8de('0x20')]||null:null,'limit':_0x138376['options']?_0x138376[_0xe8de('0x1b')][_0xe8de('0x21')]||null:null})['then'](function(_0x2cebde){logger[_0xe8de('0xd')](_0xe8de('0x1d'),_0x138376);logger[_0xe8de('0xf')](_0xe8de('0x1d'),_0x138376,JSON['stringify'](_0x2cebde));_0xf8b3a2(_0x2cebde);})['catch'](function(_0x3fa80f){logger[_0xe8de('0x13')](_0xe8de('0x1d'),_0x3fa80f[_0xe8de('0x14')],_0x138376);_0x32170e(_0x4aa819[_0xe8de('0x13')](0x1f4,_0x3fa80f[_0xe8de('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 51ba35f..8c16799 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 _0xead8=['../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0xead8,0x173));var _0x8ead=function(_0x18a16d,_0x199976){_0x18a16d=_0x18a16d-0x0;var _0x21cf0c=_0xead8[_0x18a16d];return _0x21cf0c;};'use strict';var multer=require(_0x8ead('0x0'));var util=require(_0x8ead('0x1'));var path=require('path');var timeout=require(_0x8ead('0x2'));var express=require(_0x8ead('0x3'));var router=express[_0x8ead('0x4')]();var auth=require(_0x8ead('0x5'));var interaction=require(_0x8ead('0x6'));var config=require(_0x8ead('0x7'));var controller=require(_0x8ead('0x8'));router[_0x8ead('0x9')]('/',auth[_0x8ead('0xa')](),controller['index']);router[_0x8ead('0x9')](_0x8ead('0xb'),auth['isAuthenticated'](),controller[_0x8ead('0xc')]);router[_0x8ead('0x9')]('/:id',auth[_0x8ead('0xa')](),controller[_0x8ead('0xd')]);router[_0x8ead('0xe')]('/',auth[_0x8ead('0xa')](),controller[_0x8ead('0xf')]);router[_0x8ead('0x10')](_0x8ead('0x11'),auth['isAuthenticated'](),controller[_0x8ead('0x12')]);router[_0x8ead('0x13')](_0x8ead('0x11'),auth[_0x8ead('0xa')](),controller[_0x8ead('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1896=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','exports','multer','path'];(function(_0x5f54ba,_0x5c04a3){var _0x5db897=function(_0x4550eb){while(--_0x4550eb){_0x5f54ba['push'](_0x5f54ba['shift']());}};_0x5db897(++_0x5c04a3);}(_0x1896,0x83));var _0x6189=function(_0x375a47,_0x5602ee){_0x375a47=_0x375a47-0x0;var _0x4b03fd=_0x1896[_0x375a47];return _0x4b03fd;};'use strict';var multer=require(_0x6189('0x0'));var util=require('util');var path=require(_0x6189('0x1'));var timeout=require(_0x6189('0x2'));var express=require(_0x6189('0x3'));var router=express[_0x6189('0x4')]();var auth=require(_0x6189('0x5'));var interaction=require(_0x6189('0x6'));var config=require(_0x6189('0x7'));var controller=require(_0x6189('0x8'));router[_0x6189('0x9')]('/',auth[_0x6189('0xa')](),controller[_0x6189('0xb')]);router[_0x6189('0x9')](_0x6189('0xc'),auth[_0x6189('0xa')](),controller[_0x6189('0xd')]);router[_0x6189('0x9')](_0x6189('0xe'),auth[_0x6189('0xa')](),controller['show']);router[_0x6189('0xf')]('/',auth[_0x6189('0xa')](),controller['create']);router[_0x6189('0x10')]('/:id',auth[_0x6189('0xa')](),controller[_0x6189('0x11')]);router['delete'](_0x6189('0xe'),auth[_0x6189('0xa')](),controller['destroy']);module[_0x6189('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index ca8fd61..a761d61 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 _0x5fd1=['INTEGER','sequelize','STRING','ENUM','inbound','inbound-fax','outbound-fax','dialer','TEXT','DATE'];(function(_0x15ada9,_0x50f0a2){var _0x587361=function(_0x332a97){while(--_0x332a97){_0x15ada9['push'](_0x15ada9['shift']());}};_0x587361(++_0x50f0a2);}(_0x5fd1,0x155));var _0x15fd=function(_0x2f2c8a,_0x2e8530){_0x2f2c8a=_0x2f2c8a-0x0;var _0x257dcc=_0x5fd1[_0x2f2c8a];return _0x257dcc;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'type':{'type':Sequelize[_0x15fd('0x2')](_0x15fd('0x3'),'internal','outbound',_0x15fd('0x4'),_0x15fd('0x5'),_0x15fd('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'source':{'type':Sequelize[_0x15fd('0x1')]},'destination':{'type':Sequelize[_0x15fd('0x1')]},'destinationcontext':{'type':Sequelize[_0x15fd('0x1')]},'callerid':{'type':Sequelize[_0x15fd('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x15fd('0x1')]},'lastapplication':{'type':Sequelize[_0x15fd('0x1')]},'lastdata':{'type':Sequelize[_0x15fd('0x7')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x15fd('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x15fd('0x8')]},'duration':{'type':Sequelize[_0x15fd('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x15fd('0x1')]},'userfield':{'type':Sequelize[_0x15fd('0x1')]},'userDisposition':{'type':Sequelize[_0x15fd('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x15fd('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x15fd('0x1')]},'note':{'type':Sequelize[_0x15fd('0x1')]},'prefix':{'type':Sequelize[_0x15fd('0x1')]},'routeid':{'type':Sequelize[_0x15fd('0x9')]},'sipcallid':{'type':Sequelize[_0x15fd('0x1')]}}; \ No newline at end of file +var _0xb458=['exports','STRING','internal','outbound','inbound-fax','outbound-fax','TEXT','DATE','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb458,0x103));var _0x8b45=function(_0x25738b,_0x4c5218){_0x25738b=_0x25738b-0x0;var _0x4a8d51=_0xb458[_0x25738b];return _0x4a8d51;};'use strict';var Sequelize=require(_0x8b45('0x0'));module[_0x8b45('0x1')]={'uniqueid':{'type':Sequelize[_0x8b45('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x8b45('0x3'),_0x8b45('0x4'),_0x8b45('0x5'),_0x8b45('0x6'),'dialer')},'tag':{'type':Sequelize[_0x8b45('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x8b45('0x2')]},'destinationcontext':{'type':Sequelize[_0x8b45('0x2')]},'callerid':{'type':Sequelize[_0x8b45('0x2')]},'channel':{'type':Sequelize[_0x8b45('0x2')]},'destinationchannel':{'type':Sequelize[_0x8b45('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x8b45('0x7')]},'starttime':{'type':Sequelize[_0x8b45('0x8')]},'systemanswertime':{'type':Sequelize[_0x8b45('0x8')]},'answertime':{'type':Sequelize[_0x8b45('0x8')]},'endtime':{'type':Sequelize[_0x8b45('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x8b45('0x9')]},'mohtime':{'type':Sequelize[_0x8b45('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x8b45('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x8b45('0x2')]},'note':{'type':Sequelize[_0x8b45('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x8b45('0x9')]},'sipcallid':{'type':Sequelize[_0x8b45('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 81b10cb..571172f 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 c2e9b07..e75dcd9 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 _0xca37=['VoiceCallReport','report_call','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','exports'];(function(_0x190c49,_0x103457){var _0x475b9a=function(_0x44f13c){while(--_0x44f13c){_0x190c49['push'](_0x190c49['shift']());}};_0x475b9a(++_0x103457);}(_0xca37,0x160));var _0x7ca3=function(_0xf2d40,_0x4dafc0){_0xf2d40=_0xf2d40-0x0;var _0x4676bd=_0xca37[_0xf2d40];return _0x4676bd;};'use strict';var _=require(_0x7ca3('0x0'));var util=require('util');var logger=require(_0x7ca3('0x1'))(_0x7ca3('0x2'));var moment=require('moment');var BPromise=require(_0x7ca3('0x3'));var rp=require(_0x7ca3('0x4'));var fs=require('fs');var path=require(_0x7ca3('0x5'));var rimraf=require(_0x7ca3('0x6'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x7ca3('0x7')]=function(_0x278165,_0x40d6cf){return _0x278165['define'](_0x7ca3('0x8'),attributes,{'tableName':_0x7ca3('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d84=['define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x51d451,_0x129097){var _0x243d91=function(_0x2463e3){while(--_0x2463e3){_0x51d451['push'](_0x51d451['shift']());}};_0x243d91(++_0x129097);}(_0x4d84,0xe4));var _0x44d8=function(_0x4c79aa,_0x456fcd){_0x4c79aa=_0x4c79aa-0x0;var _0x28e73a=_0x4d84[_0x4c79aa];return _0x28e73a;};'use strict';var _=require(_0x44d8('0x0'));var util=require(_0x44d8('0x1'));var logger=require(_0x44d8('0x2'))(_0x44d8('0x3'));var moment=require(_0x44d8('0x4'));var BPromise=require(_0x44d8('0x5'));var rp=require(_0x44d8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x44d8('0x7'));var attributes=require(_0x44d8('0x8'));module[_0x44d8('0x9')]=function(_0x468e56,_0x1e855c){return _0x468e56[_0x44d8('0xa')](_0x44d8('0xb'),attributes,{'tableName':_0x44d8('0xc'),'paranoid':![],'indexes':[{'fields':[_0x44d8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 40af492..192657a 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 _0x9e3d=['CreateVoiceCallReport','UpdateVoiceCallReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','raw','options','where','attributes','limit','map','include','model','then','debug','VoiceCallReport','body'];(function(_0x31919d,_0x17512e){var _0x1ce999=function(_0xd277c0){while(--_0xd277c0){_0x31919d['push'](_0x31919d['shift']());}};_0x1ce999(++_0x17512e);}(_0x9e3d,0x1be));var _0xd9e3=function(_0x2e63ef,_0x150cba){_0x2e63ef=_0x2e63ef-0x0;var _0x582539=_0x9e3d[_0x2e63ef];return _0x582539;};'use strict';var _=require(_0xd9e3('0x0'));var util=require(_0xd9e3('0x1'));var moment=require('moment');var BPromise=require(_0xd9e3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9e3('0x3'));var db=require(_0xd9e3('0x4'))['db'];var utils=require(_0xd9e3('0x5'));var logger=require(_0xd9e3('0x6'))('rpc');var config=require(_0xd9e3('0x7'));var jayson=require(_0xd9e3('0x8'));var client=jayson['client'][_0xd9e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27e756,_0x5b035f,_0x5be4b9){return new BPromise(function(_0x570ddf,_0x93a9bb){return client[_0xd9e3('0xa')](_0x27e756,_0x5be4b9)['then'](function(_0x4635b8){logger[_0xd9e3('0xb')](_0xd9e3('0xc'),_0x5b035f,_0xd9e3('0xd'));logger['debug'](_0xd9e3('0xe'),_0x5b035f,_0xd9e3('0xd'),JSON[_0xd9e3('0xf')](_0x4635b8));if(_0x4635b8[_0xd9e3('0x10')]){if(_0x4635b8[_0xd9e3('0x10')][_0xd9e3('0x11')]===0x1f4){logger[_0xd9e3('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x5b035f,_0x4635b8['error'][_0xd9e3('0x12')]);return _0x93a9bb(_0x4635b8['error'][_0xd9e3('0x12')]);}logger[_0xd9e3('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x5b035f,_0x4635b8[_0xd9e3('0x10')][_0xd9e3('0x12')]);return _0x570ddf(_0x4635b8['error'][_0xd9e3('0x12')]);}else{logger[_0xd9e3('0xb')](_0xd9e3('0xc'),_0x5b035f,_0xd9e3('0xd'));_0x570ddf(_0x4635b8[_0xd9e3('0x13')][_0xd9e3('0x12')]);}})[_0xd9e3('0x14')](function(_0x31a97d){logger[_0xd9e3('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x5b035f,_0x31a97d);_0x93a9bb(_0x31a97d);});});}exports[_0xd9e3('0x15')]=function(_0x5c55d6){var _0x38e8e0=this;return new Promise(function(_0x38c9c2,_0x2efa34){return db['VoiceCallReport'][_0xd9e3('0x16')]({'raw':_0x5c55d6['options']?_0x5c55d6['options'][_0xd9e3('0x17')]===undefined?!![]:![]:!![],'where':_0x5c55d6['options']?_0x5c55d6[_0xd9e3('0x18')][_0xd9e3('0x19')]||null:null,'attributes':_0x5c55d6[_0xd9e3('0x18')]?_0x5c55d6[_0xd9e3('0x18')][_0xd9e3('0x1a')]||null:null,'limit':_0x5c55d6[_0xd9e3('0x18')]?_0x5c55d6[_0xd9e3('0x18')][_0xd9e3('0x1b')]||null:null,'include':_0x5c55d6['options']?_0x5c55d6[_0xd9e3('0x18')]['include']?_[_0xd9e3('0x1c')](_0x5c55d6[_0xd9e3('0x18')][_0xd9e3('0x1d')],function(_0x55cf93){return{'model':db[_0x55cf93[_0xd9e3('0x1e')]],'as':_0x55cf93['as'],'attributes':_0x55cf93[_0xd9e3('0x1a')],'include':_0x55cf93[_0xd9e3('0x1d')]?_['map'](_0x55cf93[_0xd9e3('0x1d')],function(_0x58c254){return{'model':db[_0x58c254[_0xd9e3('0x1e')]],'as':_0x58c254['as'],'attributes':_0x58c254[_0xd9e3('0x1a')],'include':_0x58c254['include']?_[_0xd9e3('0x1c')](_0x58c254[_0xd9e3('0x1d')],function(_0x28babc){return{'model':db[_0x28babc['model']],'as':_0x28babc['as'],'attributes':_0x28babc[_0xd9e3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd9e3('0x1f')](function(_0x1a46af){logger['info'](_0xd9e3('0x15'),_0x5c55d6);logger[_0xd9e3('0x20')](_0xd9e3('0x15'),_0x5c55d6,JSON[_0xd9e3('0xf')](_0x1a46af));_0x38c9c2(_0x1a46af);})[_0xd9e3('0x14')](function(_0x4c1845){logger[_0xd9e3('0x10')](_0xd9e3('0x15'),_0x4c1845[_0xd9e3('0x12')],_0x5c55d6);_0x2efa34(_0x38e8e0['error'](0x1f4,_0x4c1845['message']));});});};exports['CreateVoiceCallReport']=function(_0x1ce396){var _0x177150=this;return new Promise(function(_0x33533d,_0x22e643){return db[_0xd9e3('0x21')]['create'](_0x1ce396[_0xd9e3('0x22')],{'raw':_0x1ce396['options']?_0x1ce396[_0xd9e3('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xd9e3('0x1f')](function(_0x1d14ee){logger['info']('CreateVoiceCallReport',_0x1ce396);logger['debug'](_0xd9e3('0x23'),_0x1ce396,JSON[_0xd9e3('0xf')](_0x1d14ee));_0x33533d(_0x1d14ee);})[_0xd9e3('0x14')](function(_0x2c5e7f){logger['error']('CreateVoiceCallReport',_0x2c5e7f[_0xd9e3('0x12')],_0x1ce396);_0x22e643(_0x177150[_0xd9e3('0x10')](0x1f4,_0x2c5e7f[_0xd9e3('0x12')]));});});};exports[_0xd9e3('0x24')]=function(_0x105b8c){var _0x17e9a6=this;return new Promise(function(_0x3af597,_0x4f6282){return db[_0xd9e3('0x21')]['update'](_0x105b8c[_0xd9e3('0x22')],{'raw':_0x105b8c[_0xd9e3('0x18')]?_0x105b8c[_0xd9e3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x105b8c[_0xd9e3('0x18')]?_0x105b8c['options'][_0xd9e3('0x19')]||null:null,'attributes':_0x105b8c[_0xd9e3('0x18')]?_0x105b8c[_0xd9e3('0x18')][_0xd9e3('0x1a')]||null:null,'limit':_0x105b8c[_0xd9e3('0x18')]?_0x105b8c['options'][_0xd9e3('0x1b')]||null:null})['then'](function(_0x2c2f6f){logger[_0xd9e3('0xb')]('UpdateVoiceCallReport',_0x105b8c);logger[_0xd9e3('0x20')]('UpdateVoiceCallReport',_0x105b8c,JSON[_0xd9e3('0xf')](_0x2c2f6f));_0x3af597(_0x2c2f6f);})['catch'](function(_0x4a17ea){logger[_0xd9e3('0x10')](_0xd9e3('0x24'),_0x4a17ea[_0xd9e3('0x12')],_0x105b8c);_0x4f6282(_0x17e9a6['error'](0x1f4,_0x4a17ea[_0xd9e3('0x12')]));});});}; \ No newline at end of file +var _0x38a9=['catch','GetVoiceCallReport','options','limit','include','model','attributes','map','info','debug','VoiceCallReport','body','raw','CreateVoiceCallReport','UpdateVoiceCallReport','update','where','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','client','request','then','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result'];(function(_0x569397,_0xe36908){var _0x364485=function(_0x38bdc1){while(--_0x38bdc1){_0x569397['push'](_0x569397['shift']());}};_0x364485(++_0xe36908);}(_0x38a9,0x14c));var _0x938a=function(_0x4549f9,_0x143674){_0x4549f9=_0x4549f9-0x0;var _0x297902=_0x38a9[_0x4549f9];return _0x297902;};'use strict';var _=require(_0x938a('0x0'));var util=require(_0x938a('0x1'));var moment=require(_0x938a('0x2'));var BPromise=require(_0x938a('0x3'));var rs=require(_0x938a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x938a('0x5'));var logger=require('../../config/logger')(_0x938a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x938a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x904d1d,_0x1880b3,_0x5c51c2){return new BPromise(function(_0x1ea1ac,_0x4dc8ae){return client[_0x938a('0x8')](_0x904d1d,_0x5c51c2)[_0x938a('0x9')](function(_0x4f9139){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x1880b3,_0x938a('0xa'));logger['debug'](_0x938a('0xb'),_0x1880b3,_0x938a('0xa'),JSON[_0x938a('0xc')](_0x4f9139));if(_0x4f9139[_0x938a('0xd')]){if(_0x4f9139[_0x938a('0xd')][_0x938a('0xe')]===0x1f4){logger[_0x938a('0xd')](_0x938a('0xf'),_0x1880b3,_0x4f9139[_0x938a('0xd')]['message']);return _0x4dc8ae(_0x4f9139[_0x938a('0xd')]['message']);}logger['error'](_0x938a('0xf'),_0x1880b3,_0x4f9139[_0x938a('0xd')][_0x938a('0x10')]);return _0x1ea1ac(_0x4f9139[_0x938a('0xd')][_0x938a('0x10')]);}else{logger['info'](_0x938a('0xf'),_0x1880b3,_0x938a('0xa'));_0x1ea1ac(_0x4f9139[_0x938a('0x11')]['message']);}})[_0x938a('0x12')](function(_0x1f659f){logger[_0x938a('0xd')](_0x938a('0xf'),_0x1880b3,_0x1f659f);_0x4dc8ae(_0x1f659f);});});}exports[_0x938a('0x13')]=function(_0x585184){var _0x1a86ea=this;return new Promise(function(_0x4ebf88,_0x4c14ec){return db['VoiceCallReport']['findAll']({'raw':_0x585184[_0x938a('0x14')]?_0x585184['options']['raw']===undefined?!![]:![]:!![],'where':_0x585184[_0x938a('0x14')]?_0x585184[_0x938a('0x14')]['where']||null:null,'attributes':_0x585184[_0x938a('0x14')]?_0x585184[_0x938a('0x14')]['attributes']||null:null,'limit':_0x585184[_0x938a('0x14')]?_0x585184['options'][_0x938a('0x15')]||null:null,'include':_0x585184[_0x938a('0x14')]?_0x585184[_0x938a('0x14')][_0x938a('0x16')]?_['map'](_0x585184[_0x938a('0x14')][_0x938a('0x16')],function(_0x260c24){return{'model':db[_0x260c24[_0x938a('0x17')]],'as':_0x260c24['as'],'attributes':_0x260c24[_0x938a('0x18')],'include':_0x260c24['include']?_[_0x938a('0x19')](_0x260c24[_0x938a('0x16')],function(_0x16448f){return{'model':db[_0x16448f[_0x938a('0x17')]],'as':_0x16448f['as'],'attributes':_0x16448f[_0x938a('0x18')],'include':_0x16448f[_0x938a('0x16')]?_[_0x938a('0x19')](_0x16448f['include'],function(_0x437911){return{'model':db[_0x437911[_0x938a('0x17')]],'as':_0x437911['as'],'attributes':_0x437911[_0x938a('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x548472){logger[_0x938a('0x1a')](_0x938a('0x13'),_0x585184);logger[_0x938a('0x1b')]('GetVoiceCallReport',_0x585184,JSON[_0x938a('0xc')](_0x548472));_0x4ebf88(_0x548472);})[_0x938a('0x12')](function(_0x346e95){logger[_0x938a('0xd')](_0x938a('0x13'),_0x346e95[_0x938a('0x10')],_0x585184);_0x4c14ec(_0x1a86ea[_0x938a('0xd')](0x1f4,_0x346e95[_0x938a('0x10')]));});});};exports['CreateVoiceCallReport']=function(_0x5780c0){var _0x43968e=this;return new Promise(function(_0x182574,_0x3b3851){return db[_0x938a('0x1c')]['create'](_0x5780c0[_0x938a('0x1d')],{'raw':_0x5780c0[_0x938a('0x14')]?_0x5780c0[_0x938a('0x14')][_0x938a('0x1e')]===undefined?!![]:![]:!![]})[_0x938a('0x9')](function(_0xfcd563){logger['info'](_0x938a('0x1f'),_0x5780c0);logger[_0x938a('0x1b')](_0x938a('0x1f'),_0x5780c0,JSON[_0x938a('0xc')](_0xfcd563));_0x182574(_0xfcd563);})[_0x938a('0x12')](function(_0x5b8097){logger[_0x938a('0xd')](_0x938a('0x1f'),_0x5b8097[_0x938a('0x10')],_0x5780c0);_0x3b3851(_0x43968e['error'](0x1f4,_0x5b8097[_0x938a('0x10')]));});});};exports[_0x938a('0x20')]=function(_0x9e368a){var _0x359a99=this;return new Promise(function(_0x4605f4,_0x34d343){return db[_0x938a('0x1c')][_0x938a('0x21')](_0x9e368a[_0x938a('0x1d')],{'raw':_0x9e368a[_0x938a('0x14')]?_0x9e368a[_0x938a('0x14')][_0x938a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9e368a['options']?_0x9e368a[_0x938a('0x14')][_0x938a('0x22')]||null:null,'attributes':_0x9e368a[_0x938a('0x14')]?_0x9e368a['options'][_0x938a('0x18')]||null:null,'limit':_0x9e368a[_0x938a('0x14')]?_0x9e368a[_0x938a('0x14')][_0x938a('0x15')]||null:null})['then'](function(_0x4db2d3){logger[_0x938a('0x1a')](_0x938a('0x20'),_0x9e368a);logger['debug'](_0x938a('0x20'),_0x9e368a,JSON[_0x938a('0xc')](_0x4db2d3));_0x4605f4(_0x4db2d3);})[_0x938a('0x12')](function(_0x47a9e7){logger[_0x938a('0xd')](_0x938a('0x20'),_0x47a9e7[_0x938a('0x10')],_0x9e368a);_0x34d343(_0x359a99[_0x938a('0xd')](0x1f4,_0x47a9e7[_0x938a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index d962a8b..1cbf37b 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 _0x1caf=['destroy','multer','path','../../components/auth/service','../../config/environment','index','/:id','isAuthenticated','show','create','put','delete'];(function(_0x17256e,_0x48f146){var _0x44be7c=function(_0x36b851){while(--_0x36b851){_0x17256e['push'](_0x17256e['shift']());}};_0x44be7c(++_0x48f146);}(_0x1caf,0x1e1));var _0xf1ca=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x1caf[_0x2b7764];return _0x848dcb;};'use strict';var multer=require(_0xf1ca('0x0'));var util=require('util');var path=require(_0xf1ca('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xf1ca('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xf1ca('0x3'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf1ca('0x4')]);router['get'](_0xf1ca('0x5'),auth[_0xf1ca('0x6')](),controller[_0xf1ca('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf1ca('0x8')]);router[_0xf1ca('0x9')](_0xf1ca('0x5'),auth['isAuthenticated'](),controller['update']);router[_0xf1ca('0xa')](_0xf1ca('0x5'),auth[_0xf1ca('0x6')](),controller[_0xf1ca('0xb')]);module['exports']=router; \ No newline at end of file +var _0x36cd=['express','Router','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post','create','put','delete','exports','util'];(function(_0xe9e116,_0x433009){var _0x27d64f=function(_0x4c37b0){while(--_0x4c37b0){_0xe9e116['push'](_0xe9e116['shift']());}};_0x27d64f(++_0x433009);}(_0x36cd,0x1a3));var _0xd36c=function(_0x527ce8,_0x122695){_0x527ce8=_0x527ce8-0x0;var _0x2a8a56=_0x36cd[_0x527ce8];return _0x2a8a56;};'use strict';var multer=require('multer');var util=require(_0xd36c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd36c('0x1'));var router=express[_0xd36c('0x2')]();var auth=require(_0xd36c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd36c('0x4'));var controller=require(_0xd36c('0x5'));router[_0xd36c('0x6')]('/',auth[_0xd36c('0x7')](),controller['index']);router[_0xd36c('0x6')](_0xd36c('0x8'),auth[_0xd36c('0x7')](),controller[_0xd36c('0x9')]);router[_0xd36c('0xa')]('/',auth['isAuthenticated'](),controller[_0xd36c('0xb')]);router[_0xd36c('0xc')](_0xd36c('0x8'),auth[_0xd36c('0x7')](),controller['update']);router[_0xd36c('0xd')]('/:id',auth[_0xd36c('0x7')](),controller['destroy']);module[_0xd36c('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index ab281bf..1a19558 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 _0xc516=['BOOLEAN','sequelize','exports','STRING','setDataValue','join','getDataValue','options','split'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xc516,0x118));var _0x6c51=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0xc516[_0x5a7d5f];return _0x5dcded;};'use strict';var Sequelize=require(_0x6c51('0x0'));module[_0x6c51('0x1')]={'name':{'type':Sequelize[_0x6c51('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x6c51('0x2')],'set':function(_0xa93701){this[_0x6c51('0x3')]('options',_0xa93701?_0xa93701[_0x6c51('0x4')](''):[]);},'get':function(){return this[_0x6c51('0x5')](_0x6c51('0x6'))?this[_0x6c51('0x5')](_0x6c51('0x6'))[_0x6c51('0x7')](''):[];}},'auth':{'type':Sequelize[_0x6c51('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x6c51('0x2')]},'record':{'type':Sequelize[_0x6c51('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6c51('0x2')]}}; \ No newline at end of file +var _0x72f5=['name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x539094,_0x3a6b58){var _0x1533be=function(_0x362d14){while(--_0x362d14){_0x539094['push'](_0x539094['shift']());}};_0x1533be(++_0x3a6b58);}(_0x72f5,0x1dd));var _0x572f=function(_0x56e901,_0x38f75b){_0x56e901=_0x56e901-0x0;var _0x5415c2=_0x72f5[_0x56e901];return _0x5415c2;};'use strict';var Sequelize=require(_0x572f('0x0'));module[_0x572f('0x1')]={'name':{'type':Sequelize[_0x572f('0x2')]},'prefix':{'type':Sequelize[_0x572f('0x2')],'unique':_0x572f('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x572f('0x2')],'set':function(_0x34ee13){this[_0x572f('0x4')](_0x572f('0x5'),_0x34ee13?_0x34ee13[_0x572f('0x6')](''):[]);},'get':function(){return this[_0x572f('0x7')](_0x572f('0x5'))?this['getDataValue'](_0x572f('0x5'))[_0x572f('0x8')](''):[];}},'auth':{'type':Sequelize[_0x572f('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x572f('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 2dc1312..bde5766 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 _0x83cb=['index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceChanSpy','findAll','catch','params','intersection','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','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','ChanSpies','UserProfileResource','then','error','name','send'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0x83cb,0x11f));var _0xb83c=function(_0x488814,_0x3fec59){_0x488814=_0x488814-0x0;var _0x58138b=_0x83cb[_0x488814];return _0x58138b;};'use strict';var pdf=require(_0xb83c('0x0'));var emlformat=require(_0xb83c('0x1'));var rimraf=require(_0xb83c('0x2'));var zipdir=require(_0xb83c('0x3'));var jsonpatch=require(_0xb83c('0x4'));var rp=require(_0xb83c('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb83c('0x6'));var util=require('util');var path=require(_0xb83c('0x7'));var sox=require(_0xb83c('0x8'));var csv=require(_0xb83c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb83c('0xa'));var squel=require(_0xb83c('0xb'));var crypto=require(_0xb83c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb83c('0xd'));var toCsv=require(_0xb83c('0x9'));var querystring=require(_0xb83c('0xe'));var Papa=require('papaparse');var Redis=require(_0xb83c('0xf'));var authService=require(_0xb83c('0x10'));var qs=require(_0xb83c('0x11'));var as=require(_0xb83c('0x12'));var hardwareService=require(_0xb83c('0x13'));var logger=require(_0xb83c('0x14'))('api');var utils=require(_0xb83c('0x15'));var config=require(_0xb83c('0x16'));var licenseUtil=require(_0xb83c('0x17'));var db=require(_0xb83c('0x18'))['db'];function respondWithStatusCode(_0xc83411,_0x56e255){_0x56e255=_0x56e255||0xcc;return function(_0x49e1ce){if(_0x49e1ce){return _0xc83411[_0xb83c('0x19')](_0x56e255);}return _0xc83411[_0xb83c('0x1a')](_0x56e255)[_0xb83c('0x1b')]();};}function respondWithResult(_0x556366,_0x57d61d){_0x57d61d=_0x57d61d||0xc8;return function(_0x232101){if(_0x232101){return _0x556366['status'](_0x57d61d)[_0xb83c('0x1c')](_0x232101);}};}function respondWithFilteredResult(_0x1e9e31,_0x5f3cd1){return function(_0xfef76c){if(_0xfef76c){var _0x4f8d01=_0xfef76c[_0xb83c('0x1d')],_0xb2b5ae=_0x5f3cd1[_0xb83c('0x1e')],_0x5dbd58=_0x5f3cd1['offset']+_0x5f3cd1[_0xb83c('0x1f')],_0x1aff82;if(_0x5dbd58>=_0x4f8d01){_0x5dbd58=_0x4f8d01;_0x1aff82=0xc8;}else{_0x1aff82=0xce;}_0x1e9e31[_0xb83c('0x1a')](_0x1aff82);return _0x1e9e31[_0xb83c('0x20')](_0xb83c('0x21'),_0xb2b5ae+'-'+_0x5dbd58+'/'+_0x4f8d01)[_0xb83c('0x1c')](_0xfef76c);}return null;};}function patchUpdates(_0x5cb5d2){return function(_0x542cde){try{jsonpatch[_0xb83c('0x22')](_0x542cde,_0x5cb5d2,!![]);}catch(_0x4ace71){return BPromise[_0xb83c('0x23')](_0x4ace71);}return _0x542cde['save']();};}function saveUpdates(_0x3410aa,_0x435fcb){return function(_0x3dccfa){if(_0x3dccfa){return _0x3dccfa[_0xb83c('0x24')](_0x3410aa)['then'](function(_0x568f36){return _0x568f36;});}return null;};}function removeEntity(_0x4f21ef,_0x26b8c3){return function(_0x3aa25b){if(_0x3aa25b){return _0x3aa25b[_0xb83c('0x25')]()['then'](function(){var _0x592870=_0x3aa25b[_0xb83c('0x26')]({'plain':!![]});var _0xdf9e76=_0xb83c('0x27');return db[_0xb83c('0x28')][_0xb83c('0x25')]({'where':{'type':_0xdf9e76,'resourceId':_0x592870['id']}})[_0xb83c('0x29')](function(){return _0x3aa25b;});})['then'](function(){_0x4f21ef[_0xb83c('0x1a')](0xcc)[_0xb83c('0x1b')]();});}};}function handleEntityNotFound(_0x36fdd7,_0x1232e2){return function(_0x554c0c){if(!_0x554c0c){_0x36fdd7['sendStatus'](0x194);}return _0x554c0c;};}function handleError(_0x16c047,_0x3d6a9b){_0x3d6a9b=_0x3d6a9b||0x1f4;return function(_0x2d4ce7){logger[_0xb83c('0x2a')](_0x2d4ce7['stack']);if(_0x2d4ce7[_0xb83c('0x2b')]){delete _0x2d4ce7[_0xb83c('0x2b')];}_0x16c047[_0xb83c('0x1a')](_0x3d6a9b)[_0xb83c('0x2c')](_0x2d4ce7);};}exports[_0xb83c('0x2d')]=function(_0x1e0735,_0x5a4032){var _0x25ed3f={},_0x40b600={},_0x3e6e90={'count':0x0,'rows':[]};var _0x341cfd=_[_0xb83c('0x2e')](db['VoiceChanSpy'][_0xb83c('0x2f')],function(_0x4b7539){return{'name':_0x4b7539[_0xb83c('0x30')],'type':_0x4b7539[_0xb83c('0x31')][_0xb83c('0x32')]};});_0x40b600['model']=_['map'](_0x341cfd,'name');_0x40b600[_0xb83c('0x33')]=_[_0xb83c('0x34')](_0x1e0735['query']);_0x40b600[_0xb83c('0x35')]=_['intersection'](_0x40b600[_0xb83c('0x36')],_0x40b600[_0xb83c('0x33')]);_0x25ed3f[_0xb83c('0x37')]=_['intersection'](_0x40b600['model'],qs[_0xb83c('0x38')](_0x1e0735[_0xb83c('0x33')][_0xb83c('0x38')]));_0x25ed3f[_0xb83c('0x37')]=_0x25ed3f[_0xb83c('0x37')][_0xb83c('0x39')]?_0x25ed3f[_0xb83c('0x37')]:_0x40b600[_0xb83c('0x36')];if(!_0x1e0735['query']['hasOwnProperty'](_0xb83c('0x3a'))){_0x25ed3f[_0xb83c('0x1f')]=qs['limit'](_0x1e0735[_0xb83c('0x33')][_0xb83c('0x1f')]);_0x25ed3f[_0xb83c('0x1e')]=qs[_0xb83c('0x1e')](_0x1e0735[_0xb83c('0x33')][_0xb83c('0x1e')]);}_0x25ed3f['order']=qs[_0xb83c('0x3b')](_0x1e0735[_0xb83c('0x33')][_0xb83c('0x3b')]);_0x25ed3f[_0xb83c('0x3c')]=qs[_0xb83c('0x35')](_[_0xb83c('0x3d')](_0x1e0735[_0xb83c('0x33')],_0x40b600[_0xb83c('0x35')]),_0x341cfd);if(_0x1e0735[_0xb83c('0x33')][_0xb83c('0x3e')]){_0x25ed3f[_0xb83c('0x3c')]=_[_0xb83c('0x3f')](_0x25ed3f[_0xb83c('0x3c')],{'$or':_[_0xb83c('0x2e')](_0x341cfd,function(_0x9bbfb8){if(_0x9bbfb8[_0xb83c('0x31')]!==_0xb83c('0x40')){var _0xfd7c8b={};_0xfd7c8b[_0x9bbfb8[_0xb83c('0x2b')]]={'$like':'%'+_0x1e0735[_0xb83c('0x33')][_0xb83c('0x3e')]+'%'};return _0xfd7c8b;}})});}_0x25ed3f=_[_0xb83c('0x3f')]({},_0x25ed3f,_0x1e0735[_0xb83c('0x41')]);var _0x3c3384={'where':_0x25ed3f['where']};return db['VoiceChanSpy'][_0xb83c('0x1d')](_0x3c3384)[_0xb83c('0x29')](function(_0xeae298){_0x3e6e90[_0xb83c('0x1d')]=_0xeae298;if(_0x1e0735[_0xb83c('0x33')][_0xb83c('0x42')]){_0x25ed3f[_0xb83c('0x43')]=[{'all':!![]}];}return db[_0xb83c('0x44')][_0xb83c('0x45')](_0x25ed3f);})[_0xb83c('0x29')](function(_0x2ab5f0){_0x3e6e90['rows']=_0x2ab5f0;return _0x3e6e90;})['then'](respondWithFilteredResult(_0x5a4032,_0x25ed3f))[_0xb83c('0x46')](handleError(_0x5a4032,null));};exports['show']=function(_0xa6e6ec,_0x1805b4){var _0x1b0b1f={'raw':![],'where':{'id':_0xa6e6ec[_0xb83c('0x47')]['id']}},_0x114a60={};_0x114a60[_0xb83c('0x36')]=_[_0xb83c('0x34')](db['VoiceChanSpy']['rawAttributes']);_0x114a60[_0xb83c('0x33')]=_[_0xb83c('0x34')](_0xa6e6ec[_0xb83c('0x33')]);_0x114a60[_0xb83c('0x35')]=_['intersection'](_0x114a60[_0xb83c('0x36')],_0x114a60[_0xb83c('0x33')]);_0x1b0b1f[_0xb83c('0x37')]=_[_0xb83c('0x48')](_0x114a60['model'],qs[_0xb83c('0x38')](_0xa6e6ec['query'][_0xb83c('0x38')]));_0x1b0b1f[_0xb83c('0x37')]=_0x1b0b1f[_0xb83c('0x37')][_0xb83c('0x39')]?_0x1b0b1f[_0xb83c('0x37')]:_0x114a60[_0xb83c('0x36')];if(_0xa6e6ec['query'][_0xb83c('0x42')]){_0x1b0b1f[_0xb83c('0x43')]=[{'all':!![]}];}_0x1b0b1f=_[_0xb83c('0x3f')]({},_0x1b0b1f,_0xa6e6ec[_0xb83c('0x41')]);return db[_0xb83c('0x44')][_0xb83c('0x49')](_0x1b0b1f)[_0xb83c('0x29')](handleEntityNotFound(_0x1805b4,null))[_0xb83c('0x29')](respondWithResult(_0x1805b4,null))['catch'](handleError(_0x1805b4,null));};exports[_0xb83c('0x4a')]=function(_0x527f6c,_0x4be780){return db['VoiceChanSpy'][_0xb83c('0x4a')](_0x527f6c[_0xb83c('0x4b')],{})['then'](function(_0x3cce6b){var _0x5b2e8f=_0x527f6c[_0xb83c('0x4c')]['get']({'plain':!![]});if(!_0x5b2e8f)throw new Error(_0xb83c('0x4d'));if(_0x5b2e8f[_0xb83c('0x4e')]===_0xb83c('0x4c')){var _0x26cab8=_0x3cce6b['get']({'plain':!![]});var _0x3d9069=_0xb83c('0x27');return db[_0xb83c('0x4f')][_0xb83c('0x49')]({'where':{'name':_0x3d9069,'userProfileId':_0x5b2e8f[_0xb83c('0x50')]},'raw':!![]})['then'](function(_0x259dfd){if(_0x259dfd&&_0x259dfd[_0xb83c('0x51')]===0x0){return db[_0xb83c('0x28')][_0xb83c('0x4a')]({'name':_0x26cab8[_0xb83c('0x2b')],'resourceId':_0x26cab8['id'],'type':_0x259dfd['name'],'sectionId':_0x259dfd['id']},{})['then'](function(){return _0x3cce6b;});}else{return _0x3cce6b;}})[_0xb83c('0x46')](function(_0x2e8945){logger[_0xb83c('0x2a')](_0xb83c('0x52'),_0x2e8945);throw _0x2e8945;});}return _0x3cce6b;})[_0xb83c('0x29')](respondWithResult(_0x4be780,0xc9))[_0xb83c('0x46')](handleError(_0x4be780,null));};exports[_0xb83c('0x24')]=function(_0x3884a6,_0x27dbf6){if(_0x3884a6[_0xb83c('0x4b')]['id']){delete _0x3884a6['body']['id'];}return db[_0xb83c('0x44')][_0xb83c('0x49')]({'where':{'id':_0x3884a6['params']['id']}})[_0xb83c('0x29')](handleEntityNotFound(_0x27dbf6,null))['then'](saveUpdates(_0x3884a6[_0xb83c('0x4b')],null))[_0xb83c('0x29')](respondWithResult(_0x27dbf6,null))[_0xb83c('0x46')](handleError(_0x27dbf6,null));};exports[_0xb83c('0x25')]=function(_0x271478,_0x161ff3){return db[_0xb83c('0x44')][_0xb83c('0x49')]({'where':{'id':_0x271478[_0xb83c('0x47')]['id']}})[_0xb83c('0x29')](handleEntityNotFound(_0x161ff3,null))[_0xb83c('0x29')](removeEntity(_0x161ff3,null))[_0xb83c('0x46')](handleError(_0x161ff3,null));}; \ No newline at end of file +var _0x76f5=['get','ChanSpies','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','VoiceChanSpy','include','findAll','rows','catch','params','fields','includeAll','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','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x76f5,0xd9));var _0x576f=function(_0xb0ec4,_0x18431b){_0xb0ec4=_0xb0ec4-0x0;var _0x1af32f=_0x76f5[_0xb0ec4];return _0x1af32f;};'use strict';var pdf=require(_0x576f('0x0'));var emlformat=require(_0x576f('0x1'));var rimraf=require(_0x576f('0x2'));var zipdir=require(_0x576f('0x3'));var jsonpatch=require(_0x576f('0x4'));var rp=require(_0x576f('0x5'));var moment=require(_0x576f('0x6'));var BPromise=require(_0x576f('0x7'));var Mustache=require('mustache');var util=require(_0x576f('0x8'));var path=require(_0x576f('0x9'));var sox=require('sox');var csv=require(_0x576f('0xa'));var ejs=require(_0x576f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x576f('0xc'));var crypto=require(_0x576f('0xd'));var jsforce=require(_0x576f('0xe'));var deskjs=require(_0x576f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x576f('0x10'));var Papa=require(_0x576f('0x11'));var Redis=require(_0x576f('0x12'));var authService=require(_0x576f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x576f('0x14'));var hardwareService=require(_0x576f('0x15'));var logger=require(_0x576f('0x16'))(_0x576f('0x17'));var utils=require(_0x576f('0x18'));var config=require(_0x576f('0x19'));var licenseUtil=require(_0x576f('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23a57b,_0x428021){_0x428021=_0x428021||0xcc;return function(_0x5e30ad){if(_0x5e30ad){return _0x23a57b[_0x576f('0x1b')](_0x428021);}return _0x23a57b[_0x576f('0x1c')](_0x428021)[_0x576f('0x1d')]();};}function respondWithResult(_0x2a42d1,_0x44ab6c){_0x44ab6c=_0x44ab6c||0xc8;return function(_0x4aaca4){if(_0x4aaca4){return _0x2a42d1[_0x576f('0x1c')](_0x44ab6c)[_0x576f('0x1e')](_0x4aaca4);}};}function respondWithFilteredResult(_0x30b303,_0x3e4285){return function(_0xf09978){if(_0xf09978){var _0xdb73a2=_0xf09978[_0x576f('0x1f')],_0x2cc1fd=_0x3e4285[_0x576f('0x20')],_0x482223=_0x3e4285[_0x576f('0x20')]+_0x3e4285[_0x576f('0x21')],_0x288124;if(_0x482223>=_0xdb73a2){_0x482223=_0xdb73a2;_0x288124=0xc8;}else{_0x288124=0xce;}_0x30b303[_0x576f('0x1c')](_0x288124);return _0x30b303[_0x576f('0x22')](_0x576f('0x23'),_0x2cc1fd+'-'+_0x482223+'/'+_0xdb73a2)[_0x576f('0x1e')](_0xf09978);}return null;};}function patchUpdates(_0x152762){return function(_0x4a65f7){try{jsonpatch[_0x576f('0x24')](_0x4a65f7,_0x152762,!![]);}catch(_0x5dd6e0){return BPromise[_0x576f('0x25')](_0x5dd6e0);}return _0x4a65f7[_0x576f('0x26')]();};}function saveUpdates(_0x43c04f,_0x30333b){return function(_0x14f41b){if(_0x14f41b){return _0x14f41b[_0x576f('0x27')](_0x43c04f)[_0x576f('0x28')](function(_0x1f17f8){return _0x1f17f8;});}return null;};}function removeEntity(_0x36fd74,_0x1034ce){return function(_0x591301){if(_0x591301){return _0x591301['destroy']()[_0x576f('0x28')](function(){var _0x33b6fd=_0x591301[_0x576f('0x29')]({'plain':!![]});var _0x25d76b=_0x576f('0x2a');return db[_0x576f('0x2b')][_0x576f('0x2c')]({'where':{'type':_0x25d76b,'resourceId':_0x33b6fd['id']}})[_0x576f('0x28')](function(){return _0x591301;});})[_0x576f('0x28')](function(){_0x36fd74[_0x576f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2274b7,_0x51fbed){return function(_0x2c3142){if(!_0x2c3142){_0x2274b7[_0x576f('0x1b')](0x194);}return _0x2c3142;};}function handleError(_0x1be4bf,_0x2d8d4b){_0x2d8d4b=_0x2d8d4b||0x1f4;return function(_0x2b0d16){logger[_0x576f('0x2d')](_0x2b0d16[_0x576f('0x2e')]);if(_0x2b0d16[_0x576f('0x2f')]){delete _0x2b0d16[_0x576f('0x2f')];}_0x1be4bf[_0x576f('0x1c')](_0x2d8d4b)[_0x576f('0x30')](_0x2b0d16);};}exports['index']=function(_0x2c487f,_0xd03d30){var _0x5a1d3b={},_0x53182a={},_0x31d542={'count':0x0,'rows':[]};var _0x447ded=_[_0x576f('0x31')](db['VoiceChanSpy'][_0x576f('0x32')],function(_0x59638d){return{'name':_0x59638d['fieldName'],'type':_0x59638d[_0x576f('0x33')][_0x576f('0x34')]};});_0x53182a[_0x576f('0x35')]=_[_0x576f('0x31')](_0x447ded,_0x576f('0x2f'));_0x53182a[_0x576f('0x36')]=_[_0x576f('0x37')](_0x2c487f[_0x576f('0x36')]);_0x53182a[_0x576f('0x38')]=_[_0x576f('0x39')](_0x53182a['model'],_0x53182a[_0x576f('0x36')]);_0x5a1d3b['attributes']=_['intersection'](_0x53182a[_0x576f('0x35')],qs['fields'](_0x2c487f[_0x576f('0x36')]['fields']));_0x5a1d3b[_0x576f('0x3a')]=_0x5a1d3b['attributes'][_0x576f('0x3b')]?_0x5a1d3b[_0x576f('0x3a')]:_0x53182a[_0x576f('0x35')];if(!_0x2c487f[_0x576f('0x36')]['hasOwnProperty'](_0x576f('0x3c'))){_0x5a1d3b[_0x576f('0x21')]=qs['limit'](_0x2c487f['query'][_0x576f('0x21')]);_0x5a1d3b[_0x576f('0x20')]=qs[_0x576f('0x20')](_0x2c487f[_0x576f('0x36')][_0x576f('0x20')]);}_0x5a1d3b[_0x576f('0x3d')]=qs[_0x576f('0x3e')](_0x2c487f[_0x576f('0x36')][_0x576f('0x3e')]);_0x5a1d3b[_0x576f('0x3f')]=qs[_0x576f('0x38')](_['pick'](_0x2c487f[_0x576f('0x36')],_0x53182a[_0x576f('0x38')]),_0x447ded);if(_0x2c487f[_0x576f('0x36')][_0x576f('0x40')]){_0x5a1d3b['where']=_['merge'](_0x5a1d3b[_0x576f('0x3f')],{'$or':_[_0x576f('0x31')](_0x447ded,function(_0x2ff749){if(_0x2ff749[_0x576f('0x33')]!==_0x576f('0x41')){var _0x1af5fb={};_0x1af5fb[_0x2ff749[_0x576f('0x2f')]]={'$like':'%'+_0x2c487f['query'][_0x576f('0x40')]+'%'};return _0x1af5fb;}})});}_0x5a1d3b=_[_0x576f('0x42')]({},_0x5a1d3b,_0x2c487f[_0x576f('0x43')]);var _0x2d3eda={'where':_0x5a1d3b[_0x576f('0x3f')]};return db[_0x576f('0x44')][_0x576f('0x1f')](_0x2d3eda)['then'](function(_0x58e6d6){_0x31d542[_0x576f('0x1f')]=_0x58e6d6;if(_0x2c487f[_0x576f('0x36')]['includeAll']){_0x5a1d3b[_0x576f('0x45')]=[{'all':!![]}];}return db[_0x576f('0x44')][_0x576f('0x46')](_0x5a1d3b);})['then'](function(_0x4a101a){_0x31d542[_0x576f('0x47')]=_0x4a101a;return _0x31d542;})[_0x576f('0x28')](respondWithFilteredResult(_0xd03d30,_0x5a1d3b))[_0x576f('0x48')](handleError(_0xd03d30,null));};exports['show']=function(_0x41e968,_0x2ede55){var _0x16db2c={'raw':![],'where':{'id':_0x41e968[_0x576f('0x49')]['id']}},_0x9d38bd={};_0x9d38bd[_0x576f('0x35')]=_[_0x576f('0x37')](db[_0x576f('0x44')][_0x576f('0x32')]);_0x9d38bd[_0x576f('0x36')]=_[_0x576f('0x37')](_0x41e968[_0x576f('0x36')]);_0x9d38bd[_0x576f('0x38')]=_[_0x576f('0x39')](_0x9d38bd[_0x576f('0x35')],_0x9d38bd[_0x576f('0x36')]);_0x16db2c[_0x576f('0x3a')]=_[_0x576f('0x39')](_0x9d38bd[_0x576f('0x35')],qs['fields'](_0x41e968['query'][_0x576f('0x4a')]));_0x16db2c['attributes']=_0x16db2c['attributes'][_0x576f('0x3b')]?_0x16db2c[_0x576f('0x3a')]:_0x9d38bd[_0x576f('0x35')];if(_0x41e968[_0x576f('0x36')][_0x576f('0x4b')]){_0x16db2c[_0x576f('0x45')]=[{'all':!![]}];}_0x16db2c=_['merge']({},_0x16db2c,_0x41e968[_0x576f('0x43')]);return db[_0x576f('0x44')]['find'](_0x16db2c)[_0x576f('0x28')](handleEntityNotFound(_0x2ede55,null))[_0x576f('0x28')](respondWithResult(_0x2ede55,null))['catch'](handleError(_0x2ede55,null));};exports[_0x576f('0x4c')]=function(_0x58f82a,_0x322ee8){return db[_0x576f('0x44')][_0x576f('0x4c')](_0x58f82a[_0x576f('0x4d')],{})['then'](function(_0x21c658){var _0x11a7a9=_0x58f82a[_0x576f('0x4e')]['get']({'plain':!![]});if(!_0x11a7a9)throw new Error(_0x576f('0x4f'));if(_0x11a7a9[_0x576f('0x50')]===_0x576f('0x4e')){var _0x4b80d9=_0x21c658[_0x576f('0x29')]({'plain':!![]});var _0x381eb6='ChanSpies';return db[_0x576f('0x51')]['find']({'where':{'name':_0x381eb6,'userProfileId':_0x11a7a9[_0x576f('0x52')]},'raw':!![]})[_0x576f('0x28')](function(_0x2a9fd1){if(_0x2a9fd1&&_0x2a9fd1[_0x576f('0x53')]===0x0){return db[_0x576f('0x2b')][_0x576f('0x4c')]({'name':_0x4b80d9['name'],'resourceId':_0x4b80d9['id'],'type':_0x2a9fd1[_0x576f('0x2f')],'sectionId':_0x2a9fd1['id']},{})[_0x576f('0x28')](function(){return _0x21c658;});}else{return _0x21c658;}})[_0x576f('0x48')](function(_0x112e49){logger[_0x576f('0x2d')](_0x576f('0x54'),_0x112e49);throw _0x112e49;});}return _0x21c658;})[_0x576f('0x28')](respondWithResult(_0x322ee8,0xc9))['catch'](handleError(_0x322ee8,null));};exports['update']=function(_0x232dd6,_0x124786){if(_0x232dd6[_0x576f('0x4d')]['id']){delete _0x232dd6[_0x576f('0x4d')]['id'];}return db[_0x576f('0x44')][_0x576f('0x55')]({'where':{'id':_0x232dd6['params']['id']}})[_0x576f('0x28')](handleEntityNotFound(_0x124786,null))[_0x576f('0x28')](saveUpdates(_0x232dd6['body'],null))[_0x576f('0x28')](respondWithResult(_0x124786,null))[_0x576f('0x48')](handleError(_0x124786,null));};exports[_0x576f('0x2c')]=function(_0xc2e313,_0x173785){return db[_0x576f('0x44')][_0x576f('0x55')]({'where':{'id':_0xc2e313['params']['id']}})[_0x576f('0x28')](handleEntityNotFound(_0x173785,null))[_0x576f('0x28')](removeEntity(_0x173785,null))['catch'](handleError(_0x173785,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 1d1dd92..2cdf8d4 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 _0x682e=['Authenticate','password','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','push','merge','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','auth'];(function(_0x7df4cb,_0x5d824d){var _0x10b458=function(_0x16c220){while(--_0x16c220){_0x7df4cb['push'](_0x7df4cb['shift']());}};_0x10b458(++_0x5d824d);}(_0x682e,0x119));var _0xe682=function(_0x10d022,_0x584e10){_0x10d022=_0x10d022-0x0;var _0x1d72c7=_0x682e[_0x10d022];return _0x1d72c7;};'use strict';var _=require(_0xe682('0x0'));var util=require('util');var BPromise=require(_0xe682('0x1'));var attributes=require(_0xe682('0x2'));var getUserApplications=function(_0x19be16,_0x106a11,_0x449cca){var _0x2f6e97=0x1;var _0x24e27f=[];var _0x2b636c={'context':_0x106a11[_0xe682('0x3')]||_0xe682('0x4'),'exten':util[_0xe682('0x5')]('%s%s',_0x19be16[_0xe682('0x6')],_0x449cca),'type':_0xe682('0x7'),'isApp':![],'ChanSpyId':_0x19be16['id'],'UserId':_0x106a11['id']};_0x24e27f[_0xe682('0x8')](_[_0xe682('0x9')]({'app':'Set','appdata':util[_0xe682('0x5')](_0xe682('0xa'),_0xe682('0xb')),'priority':_0x2f6e97++},_0x2b636c));if(_0x19be16[_0xe682('0xc')]){_0x24e27f[_0xe682('0x8')](_[_0xe682('0x9')]({'app':'MixMonitor','appdata':util[_0xe682('0x5')](_0xe682('0xd'),_0x19be16['recordingFormat']),'priority':_0x2f6e97++},_0x2b636c));}if(_0x19be16[_0xe682('0xe')]){_0x24e27f[_0xe682('0x8')](_[_0xe682('0x9')]({'app':_0xe682('0xf'),'appdata':_0x19be16[_0xe682('0x10')],'priority':_0x2f6e97++},_0x2b636c));}_0x24e27f[_0xe682('0x8')](_[_0xe682('0x9')]({'app':'ChanSpy','appdata':util[_0xe682('0x5')](_0xe682('0x11'),_0x106a11[_0xe682('0x12')],_0x19be16[_0xe682('0x13')]?_0x19be16[_0xe682('0x13')][_0xe682('0x14')](''):''),'priority':_0x2f6e97++},_0x2b636c));if(_0x19be16[_0xe682('0xc')]){_0x24e27f['push'](_['merge']({'app':_0xe682('0x15'),'priority':_0x2f6e97++},_0x2b636c));}return _0x24e27f;};var getChanSpyApplications=function(_0xd0f68e,_0xaf406e){var _0x4df79a=[];for(var _0x11b0aa=0x0,_0x2c12ff=0x1;_0x11b0aa<_0xaf406e[_0xe682('0x16')];_0x11b0aa++,_0x2c12ff=0x1){_0x4df79a=_0x4df79a[_0xe682('0x17')](getUserApplications(_0xd0f68e,_0xaf406e[_0x11b0aa],_0xaf406e[_0x11b0aa]['internal']));if(_0xaf406e[_0x11b0aa][_0xe682('0x18')]!=_0xaf406e[_0x11b0aa][_0xe682('0x12')]){_0x4df79a=_0x4df79a['concat'](getUserApplications(_0xd0f68e,_0xaf406e[_0x11b0aa],_0xaf406e[_0x11b0aa]['name']));}}return _0x4df79a;};var getChanSpyPromise=function(_0x46b2f0,_0x3e824c){return new BPromise(function(_0x161f58,_0x2f3915){return _0x46b2f0[_0xe682('0x19')][_0xe682('0x1a')]({'attributes':['id','name',_0xe682('0x18')],'where':{'role':_0xe682('0x1b'),'chanspy':!![]},'raw':!![]})[_0xe682('0x1c')](function(_0x194c24){if(_0x194c24){return _0x161f58(getChanSpyApplications(_0x3e824c,_0x194c24));}return _0x161f58([]);})['catch'](function(_0x4d5bd4){_0x2f3915(_0x4d5bd4);});});};module[_0xe682('0x1d')]=function(_0x5456c3,_0x10ada7){var _0x3bc14c=_0x5456c3['models'];return _0x5456c3[_0xe682('0x1e')](_0xe682('0x1f'),attributes,{'tableName':_0xe682('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x380234,_0x549250,_0x4d2909){return getChanSpyPromise(_0x3bc14c,_0x380234)[_0xe682('0x1c')](function(_0x427a63){if(_0x427a63&&_0x427a63[_0xe682('0x16')]){return _0x3bc14c[_0xe682('0x21')][_0xe682('0x22')](_0x427a63);}})[_0xe682('0x1c')](function(){_0x4d2909();})[_0xe682('0x23')](function(_0x232f2d){_0x4d2909(_0x232f2d);});},'afterUpdate':function(_0x4f9a8d,_0x1edf45,_0x1b0818){return _0x3bc14c[_0xe682('0x21')]['destroy']({'where':{'ChanSpyId':_0x4f9a8d['id']}})['then'](function(){return getChanSpyPromise(_0x3bc14c,_0x4f9a8d);})[_0xe682('0x1c')](function(_0x2d5132){if(_0x2d5132&&_0x2d5132[_0xe682('0x16')]){return _0x3bc14c['VoiceExtension'][_0xe682('0x22')](_0x2d5132);}})[_0xe682('0x1c')](function(){_0x1b0818();})[_0xe682('0x23')](function(_0x5b4545){_0x1b0818(_0x5b4545);});},'afterDestroy':function(_0x4e057d,_0x513c7a,_0x5134ea){return _0x3bc14c['VoiceExtension'][_0xe682('0x24')]({'where':{'ChanSpyId':_0x4e057d['id']}})[_0xe682('0x1c')](function(){_0x5134ea();})[_0xe682('0x23')](function(_0xcd6b0){_0x5134ea(_0xcd6b0);});}}});}; \ No newline at end of file +var _0x51a1=['context','format','system','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','ChanSpy','SIP/%s,%s','options','join','concat','internal','name','User','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','length','destroy','bulkCreate','VoiceExtension','lodash','util','./voiceChanSpy.attributes'];(function(_0x49c517,_0x19728c){var _0x24f20f=function(_0x310f69){while(--_0x310f69){_0x49c517['push'](_0x49c517['shift']());}};_0x24f20f(++_0x19728c);}(_0x51a1,0x1b7));var _0x151a=function(_0x464065,_0x55f3c3){_0x464065=_0x464065-0x0;var _0x300b9b=_0x51a1[_0x464065];return _0x300b9b;};'use strict';var _=require(_0x151a('0x0'));var util=require(_0x151a('0x1'));var BPromise=require('bluebird');var attributes=require(_0x151a('0x2'));var getUserApplications=function(_0x1020f4,_0xe8b1a8,_0xb417c9){var _0x49dc38=0x1;var _0x348832=[];var _0x291fc1={'context':_0xe8b1a8[_0x151a('0x3')]||'from-sip','exten':util[_0x151a('0x4')]('%s%s',_0x1020f4['prefix'],_0xb417c9),'type':_0x151a('0x5'),'isApp':![],'ChanSpyId':_0x1020f4['id'],'UserId':_0xe8b1a8['id']};_0x348832[_0x151a('0x6')](_[_0x151a('0x7')]({'app':_0x151a('0x8'),'appdata':util[_0x151a('0x4')](_0x151a('0x9'),_0x151a('0xa')),'priority':_0x49dc38++},_0x291fc1));if(_0x1020f4[_0x151a('0xb')]){_0x348832[_0x151a('0x6')](_[_0x151a('0x7')]({'app':'MixMonitor','appdata':util[_0x151a('0x4')](_0x151a('0xc'),_0x1020f4['recordingFormat']),'priority':_0x49dc38++},_0x291fc1));}if(_0x1020f4['auth']){_0x348832['push'](_[_0x151a('0x7')]({'app':'Authenticate','appdata':_0x1020f4['password'],'priority':_0x49dc38++},_0x291fc1));}_0x348832[_0x151a('0x6')](_[_0x151a('0x7')]({'app':_0x151a('0xd'),'appdata':util[_0x151a('0x4')](_0x151a('0xe'),_0xe8b1a8['name'],_0x1020f4[_0x151a('0xf')]?_0x1020f4['options'][_0x151a('0x10')](''):''),'priority':_0x49dc38++},_0x291fc1));if(_0x1020f4['record']){_0x348832[_0x151a('0x6')](_[_0x151a('0x7')]({'app':'StopMixMonitor','priority':_0x49dc38++},_0x291fc1));}return _0x348832;};var getChanSpyApplications=function(_0x673e7e,_0x405585){var _0x56b71f=[];for(var _0x537078=0x0,_0x5000be=0x1;_0x537078<_0x405585['length'];_0x537078++,_0x5000be=0x1){_0x56b71f=_0x56b71f[_0x151a('0x11')](getUserApplications(_0x673e7e,_0x405585[_0x537078],_0x405585[_0x537078][_0x151a('0x12')]));if(_0x405585[_0x537078][_0x151a('0x12')]!=_0x405585[_0x537078][_0x151a('0x13')]){_0x56b71f=_0x56b71f[_0x151a('0x11')](getUserApplications(_0x673e7e,_0x405585[_0x537078],_0x405585[_0x537078][_0x151a('0x13')]));}}return _0x56b71f;};var getChanSpyPromise=function(_0xb82497,_0x5afb8e){return new BPromise(function(_0x5cad85,_0x4dda7f){return _0xb82497[_0x151a('0x14')][_0x151a('0x15')]({'attributes':['id',_0x151a('0x13'),_0x151a('0x12')],'where':{'role':_0x151a('0x16'),'chanspy':!![]},'raw':!![]})['then'](function(_0x4e3e53){if(_0x4e3e53){return _0x5cad85(getChanSpyApplications(_0x5afb8e,_0x4e3e53));}return _0x5cad85([]);})[_0x151a('0x17')](function(_0xb2d3b){_0x4dda7f(_0xb2d3b);});});};module[_0x151a('0x18')]=function(_0x7021ce,_0x1fbdad){var _0x435a5a=_0x7021ce[_0x151a('0x19')];return _0x7021ce[_0x151a('0x1a')](_0x151a('0x1b'),attributes,{'tableName':_0x151a('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x271ce3,_0x23aacd,_0x4f15a6){return getChanSpyPromise(_0x435a5a,_0x271ce3)[_0x151a('0x1d')](function(_0xd506f3){if(_0xd506f3&&_0xd506f3[_0x151a('0x1e')]){return _0x435a5a['VoiceExtension']['bulkCreate'](_0xd506f3);}})[_0x151a('0x1d')](function(){_0x4f15a6();})[_0x151a('0x17')](function(_0x447651){_0x4f15a6(_0x447651);});},'afterUpdate':function(_0x1e1510,_0x37fb8b,_0x314d68){return _0x435a5a['VoiceExtension'][_0x151a('0x1f')]({'where':{'ChanSpyId':_0x1e1510['id']}})['then'](function(){return getChanSpyPromise(_0x435a5a,_0x1e1510);})[_0x151a('0x1d')](function(_0x245dc3){if(_0x245dc3&&_0x245dc3[_0x151a('0x1e')]){return _0x435a5a['VoiceExtension'][_0x151a('0x20')](_0x245dc3);}})['then'](function(){_0x314d68();})[_0x151a('0x17')](function(_0x2fac5b){_0x314d68(_0x2fac5b);});},'afterDestroy':function(_0xa49974,_0x4a4785,_0x56b635){return _0x435a5a[_0x151a('0x21')][_0x151a('0x1f')]({'where':{'ChanSpyId':_0xa49974['id']}})['then'](function(){_0x56b635();})[_0x151a('0x17')](function(_0x3a9855){_0x56b635(_0x3a9855);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 6857e80..2e18868 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 _0x7ac2=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message'];(function(_0x585044,_0x1bee79){var _0x3ff468=function(_0x3220a4){while(--_0x3220a4){_0x585044['push'](_0x585044['shift']());}};_0x3ff468(++_0x1bee79);}(_0x7ac2,0xca));var _0x27ac=function(_0x283802,_0x29807b){_0x283802=_0x283802-0x0;var _0x3104b3=_0x7ac2[_0x283802];return _0x3104b3;};'use strict';var _=require(_0x27ac('0x0'));var util=require(_0x27ac('0x1'));var moment=require(_0x27ac('0x2'));var BPromise=require(_0x27ac('0x3'));var rs=require(_0x27ac('0x4'));var fs=require('fs');var Redis=require(_0x27ac('0x5'));var db=require(_0x27ac('0x6'))['db'];var utils=require(_0x27ac('0x7'));var logger=require(_0x27ac('0x8'))(_0x27ac('0x9'));var config=require('../../config/environment');var jayson=require(_0x27ac('0xa'));var client=jayson[_0x27ac('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54df41,_0x53ae29,_0x495049){return new BPromise(function(_0x349767,_0x3a47c0){return client[_0x27ac('0xc')](_0x54df41,_0x495049)[_0x27ac('0xd')](function(_0x1163d9){logger[_0x27ac('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x53ae29,_0x27ac('0xf'));logger[_0x27ac('0x10')](_0x27ac('0x11'),_0x53ae29,'request\x20sent',JSON[_0x27ac('0x12')](_0x1163d9));if(_0x1163d9[_0x27ac('0x13')]){if(_0x1163d9[_0x27ac('0x13')][_0x27ac('0x14')]===0x1f4){logger['error'](_0x27ac('0x15'),_0x53ae29,_0x1163d9[_0x27ac('0x13')]['message']);return _0x3a47c0(_0x1163d9[_0x27ac('0x13')]['message']);}logger[_0x27ac('0x13')](_0x27ac('0x15'),_0x53ae29,_0x1163d9[_0x27ac('0x13')][_0x27ac('0x16')]);return _0x349767(_0x1163d9['error']['message']);}else{logger[_0x27ac('0xe')](_0x27ac('0x15'),_0x53ae29,_0x27ac('0xf'));_0x349767(_0x1163d9[_0x27ac('0x17')][_0x27ac('0x16')]);}})[_0x27ac('0x18')](function(_0x51fbd4){logger[_0x27ac('0x13')](_0x27ac('0x15'),_0x53ae29,_0x51fbd4);_0x3a47c0(_0x51fbd4);});});} \ No newline at end of file +var _0xd569=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error'];(function(_0x2aea3c,_0x12094e){var _0x22e0cc=function(_0x4a7801){while(--_0x4a7801){_0x2aea3c['push'](_0x2aea3c['shift']());}};_0x22e0cc(++_0x12094e);}(_0xd569,0x1e3));var _0x9d56=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0xd569[_0x2b152a];return _0x2ad4c7;};'use strict';var _=require(_0x9d56('0x0'));var util=require(_0x9d56('0x1'));var moment=require(_0x9d56('0x2'));var BPromise=require(_0x9d56('0x3'));var rs=require(_0x9d56('0x4'));var fs=require('fs');var Redis=require(_0x9d56('0x5'));var db=require(_0x9d56('0x6'))['db'];var utils=require(_0x9d56('0x7'));var logger=require(_0x9d56('0x8'))(_0x9d56('0x9'));var config=require(_0x9d56('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9d56('0xb')][_0x9d56('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25e392,_0x10d2ad,_0x33e9f4){return new BPromise(function(_0x4c6de5,_0x1b8a0f){return client[_0x9d56('0xd')](_0x25e392,_0x33e9f4)[_0x9d56('0xe')](function(_0x3545ed){logger[_0x9d56('0xf')](_0x9d56('0x10'),_0x10d2ad,_0x9d56('0x11'));logger[_0x9d56('0x12')](_0x9d56('0x13'),_0x10d2ad,_0x9d56('0x11'),JSON['stringify'](_0x3545ed));if(_0x3545ed['error']){if(_0x3545ed[_0x9d56('0x14')][_0x9d56('0x15')]===0x1f4){logger[_0x9d56('0x14')](_0x9d56('0x10'),_0x10d2ad,_0x3545ed[_0x9d56('0x14')]['message']);return _0x1b8a0f(_0x3545ed[_0x9d56('0x14')]['message']);}logger[_0x9d56('0x14')](_0x9d56('0x10'),_0x10d2ad,_0x3545ed['error'][_0x9d56('0x16')]);return _0x4c6de5(_0x3545ed[_0x9d56('0x14')]['message']);}else{logger[_0x9d56('0xf')](_0x9d56('0x10'),_0x10d2ad,_0x9d56('0x11'));_0x4c6de5(_0x3545ed['result'][_0x9d56('0x16')]);}})[_0x9d56('0x17')](function(_0x204cf2){logger['error'](_0x9d56('0x10'),_0x10d2ad,_0x204cf2);_0x1b8a0f(_0x204cf2);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index e38e90e..2f76661 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 _0x2b32=['create','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show'];(function(_0x1e5ff4,_0x4e4d54){var _0x14a510=function(_0x11b30d){while(--_0x11b30d){_0x1e5ff4['push'](_0x1e5ff4['shift']());}};_0x14a510(++_0x4e4d54);}(_0x2b32,0x16f));var _0x22b3=function(_0x21cd08,_0x16cd11){_0x21cd08=_0x21cd08-0x0;var _0x1d77ba=_0x2b32[_0x21cd08];return _0x1d77ba;};'use strict';var multer=require(_0x22b3('0x0'));var util=require('util');var path=require(_0x22b3('0x1'));var timeout=require(_0x22b3('0x2'));var express=require(_0x22b3('0x3'));var router=express[_0x22b3('0x4')]();var auth=require(_0x22b3('0x5'));var interaction=require(_0x22b3('0x6'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x22b3('0x7')]('/',auth[_0x22b3('0x8')](),controller['index']);router[_0x22b3('0x7')](_0x22b3('0x9'),auth[_0x22b3('0x8')](),controller[_0x22b3('0xa')]);router['post']('/',auth[_0x22b3('0x8')](),controller[_0x22b3('0xb')]);router['put'](_0x22b3('0x9'),auth[_0x22b3('0x8')](),controller[_0x22b3('0xc')]);router['delete'](_0x22b3('0x9'),auth[_0x22b3('0x8')](),controller[_0x22b3('0xd')]);module['exports']=router; \ No newline at end of file +var _0xfcb9=['isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5ca34a,_0x28d5af){var _0x3ecd89=function(_0xeaa1b1){while(--_0xeaa1b1){_0x5ca34a['push'](_0x5ca34a['shift']());}};_0x3ecd89(++_0x28d5af);}(_0xfcb9,0xe1));var _0x9fcb=function(_0x7de823,_0x32fc8c){_0x7de823=_0x7de823-0x0;var _0x42d64a=_0xfcb9[_0x7de823];return _0x42d64a;};'use strict';var multer=require(_0x9fcb('0x0'));var util=require(_0x9fcb('0x1'));var path=require('path');var timeout=require(_0x9fcb('0x2'));var express=require(_0x9fcb('0x3'));var router=express[_0x9fcb('0x4')]();var auth=require(_0x9fcb('0x5'));var interaction=require(_0x9fcb('0x6'));var config=require(_0x9fcb('0x7'));var controller=require('./voiceContext.controller');router[_0x9fcb('0x8')]('/',auth[_0x9fcb('0x9')](),controller[_0x9fcb('0xa')]);router[_0x9fcb('0x8')](_0x9fcb('0xb'),auth[_0x9fcb('0x9')](),controller[_0x9fcb('0xc')]);router[_0x9fcb('0xd')]('/',auth['isAuthenticated'](),controller[_0x9fcb('0xe')]);router['put']('/:id',auth[_0x9fcb('0x9')](),controller[_0x9fcb('0xf')]);router[_0x9fcb('0x10')](_0x9fcb('0xb'),auth[_0x9fcb('0x9')](),controller['destroy']);module[_0x9fcb('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index efb88ce..8b8348a 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 _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x502cb2,_0x556594){var _0x12a5b7=function(_0x4a0754){while(--_0x4a0754){_0x502cb2['push'](_0x502cb2['shift']());}};_0x12a5b7(++_0x556594);}(_0x34e8,0x12c));var _0x834e=function(_0xc3a841,_0x55628d){_0xc3a841=_0xc3a841-0x0;var _0x1af893=_0x34e8[_0xc3a841];return _0x1af893;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x3bbc3e,_0x309c90){var _0xdff7e6=function(_0x2085c4){while(--_0x2085c4){_0x3bbc3e['push'](_0x3bbc3e['shift']());}};_0xdff7e6(++_0x309c90);}(_0x34e8,0x12c));var _0x834e=function(_0x2a4f52,_0x3cea63){_0x2a4f52=_0x2a4f52-0x0;var _0x51e86a=_0x34e8[_0x2a4f52];return _0x51e86a;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('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 b81bb62..a5fc2e7 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 _0x37b4=['fields','length','nolimit','limit','offset','order','sort','filters','pick','where','merge','VIRTUAL','filter','VoiceContext','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','readFileSync','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','utf8','join','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','sendStatus','status','end','json','count','Content-Range','reject','save','update','destroy','Contexts','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','intersection','attributes'];(function(_0x9d5738,_0x32a371){var _0x2ebe63=function(_0x323d7a){while(--_0x323d7a){_0x9d5738['push'](_0x9d5738['shift']());}};_0x2ebe63(++_0x32a371);}(_0x37b4,0xef));var _0x437b=function(_0x17c487,_0x2b72f1){_0x17c487=_0x17c487-0x0;var _0x3feeb8=_0x37b4[_0x17c487];return _0x3feeb8;};'use strict';var pdf=require(_0x437b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x437b('0x1'));var zipdir=require(_0x437b('0x2'));var jsonpatch=require(_0x437b('0x3'));var rp=require('request-promise');var moment=require(_0x437b('0x4'));var BPromise=require(_0x437b('0x5'));var Mustache=require(_0x437b('0x6'));var util=require(_0x437b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x437b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x437b('0x9'));var squel=require('squel');var crypto=require(_0x437b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x437b('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x437b('0xc'));var Redis=require(_0x437b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x437b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x437b('0xf'))(_0x437b('0x10'));var utils=require(_0x437b('0x11'));var config=require(_0x437b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x437b('0x13'))['db'];var jayson=require(_0x437b('0x14'));var client=jayson[_0x437b('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x90c515,_0x40c6ee,_0x42bcf9,_0x4d72ec){return new BPromise(function(_0x29b972,_0x56524c){var _0x368067=_0x4d72ec||client;return _0x368067[_0x437b('0x16')](_0x90c515,_0x42bcf9)[_0x437b('0x17')](function(_0x5f328b){logger[_0x437b('0x18')](_0x437b('0x19'),_0x40c6ee,_0x437b('0x1a'));logger[_0x437b('0x1b')](_0x437b('0x1c'),_0x40c6ee,_0x437b('0x1a'),JSON['stringify'](_0x5f328b));if(_0x5f328b[_0x437b('0x1d')]){if(_0x5f328b['error'][_0x437b('0x1e')]===0x1f4){logger[_0x437b('0x1d')](_0x437b('0x19'),_0x40c6ee,_0x5f328b[_0x437b('0x1d')]['message']);return _0x56524c(_0x5f328b['error']['message']);}logger['error'](_0x437b('0x19'),_0x40c6ee,_0x5f328b[_0x437b('0x1d')]['message']);return _0x29b972(_0x5f328b[_0x437b('0x1d')]['message']);}else{logger[_0x437b('0x18')](_0x437b('0x19'),_0x40c6ee,_0x437b('0x1a'));_0x29b972(_0x5f328b['result']['message']);}})['catch'](function(_0x46b278){logger[_0x437b('0x1d')](_0x437b('0x19'),_0x40c6ee,_0x46b278);_0x56524c(_0x46b278);});});}function respondWithStatusCode(_0x4440e6,_0x8c5852){_0x8c5852=_0x8c5852||0xcc;return function(_0xd95668){if(_0xd95668){return _0x4440e6[_0x437b('0x1f')](_0x8c5852);}return _0x4440e6[_0x437b('0x20')](_0x8c5852)[_0x437b('0x21')]();};}function respondWithResult(_0x3b9961,_0x258198){_0x258198=_0x258198||0xc8;return function(_0x5a0c38){if(_0x5a0c38){return _0x3b9961[_0x437b('0x20')](_0x258198)[_0x437b('0x22')](_0x5a0c38);}};}function respondWithFilteredResult(_0xce162e,_0x430be0){return function(_0x17092c){if(_0x17092c){var _0x586df9=_0x17092c[_0x437b('0x23')],_0x14f755=_0x430be0['offset'],_0x2dbeb6=_0x430be0['offset']+_0x430be0['limit'],_0x4a7d0b;if(_0x2dbeb6>=_0x586df9){_0x2dbeb6=_0x586df9;_0x4a7d0b=0xc8;}else{_0x4a7d0b=0xce;}_0xce162e[_0x437b('0x20')](_0x4a7d0b);return _0xce162e['set'](_0x437b('0x24'),_0x14f755+'-'+_0x2dbeb6+'/'+_0x586df9)[_0x437b('0x22')](_0x17092c);}return null;};}function patchUpdates(_0x2b2e4f){return function(_0x5885e1){try{jsonpatch['apply'](_0x5885e1,_0x2b2e4f,!![]);}catch(_0x2c9931){return BPromise[_0x437b('0x25')](_0x2c9931);}return _0x5885e1[_0x437b('0x26')]();};}function saveUpdates(_0x3b7302,_0x730a34){return function(_0x60af){if(_0x60af){return _0x60af[_0x437b('0x27')](_0x3b7302)[_0x437b('0x17')](function(_0xb4abd5){return _0xb4abd5;});}return null;};}function removeEntity(_0x210292,_0x12b542){return function(_0x5a6677){if(_0x5a6677){return _0x5a6677[_0x437b('0x28')]()[_0x437b('0x17')](function(){var _0x156773=_0x5a6677['get']({'plain':!![]});var _0x317bdf=_0x437b('0x29');return db[_0x437b('0x2a')]['destroy']({'where':{'type':_0x317bdf,'resourceId':_0x156773['id']}})[_0x437b('0x17')](function(){return _0x5a6677;});})['then'](function(){_0x210292[_0x437b('0x20')](0xcc)[_0x437b('0x21')]();});}};}function handleEntityNotFound(_0x163315,_0x425a9c){return function(_0x385a1d){if(!_0x385a1d){_0x163315[_0x437b('0x1f')](0x194);}return _0x385a1d;};}function handleError(_0x561dcc,_0x453306){_0x453306=_0x453306||0x1f4;return function(_0x43f35f){logger[_0x437b('0x1d')](_0x43f35f[_0x437b('0x2b')]);if(_0x43f35f[_0x437b('0x2c')]){delete _0x43f35f[_0x437b('0x2c')];}_0x561dcc[_0x437b('0x20')](_0x453306)[_0x437b('0x2d')](_0x43f35f);};}exports[_0x437b('0x2e')]=function(_0x1690f7,_0x2a8f23){var _0x4e7461={},_0x273b64={},_0x4e48f2={'count':0x0,'rows':[]};var _0x1ed9bf=_['map'](db['VoiceContext'][_0x437b('0x2f')],function(_0x1f169c){return{'name':_0x1f169c[_0x437b('0x30')],'type':_0x1f169c[_0x437b('0x31')]['key']};});_0x273b64[_0x437b('0x32')]=_[_0x437b('0x33')](_0x1ed9bf,_0x437b('0x2c'));_0x273b64[_0x437b('0x34')]=_['keys'](_0x1690f7['query']);_0x273b64['filters']=_[_0x437b('0x35')](_0x273b64[_0x437b('0x32')],_0x273b64[_0x437b('0x34')]);_0x4e7461[_0x437b('0x36')]=_[_0x437b('0x35')](_0x273b64[_0x437b('0x32')],qs['fields'](_0x1690f7[_0x437b('0x34')][_0x437b('0x37')]));_0x4e7461[_0x437b('0x36')]=_0x4e7461['attributes'][_0x437b('0x38')]?_0x4e7461[_0x437b('0x36')]:_0x273b64['model'];if(!_0x1690f7['query']['hasOwnProperty'](_0x437b('0x39'))){_0x4e7461[_0x437b('0x3a')]=qs['limit'](_0x1690f7['query'][_0x437b('0x3a')]);_0x4e7461['offset']=qs[_0x437b('0x3b')](_0x1690f7['query']['offset']);}_0x4e7461[_0x437b('0x3c')]=qs[_0x437b('0x3d')](_0x1690f7['query'][_0x437b('0x3d')]);_0x4e7461['where']=qs[_0x437b('0x3e')](_[_0x437b('0x3f')](_0x1690f7['query'],_0x273b64[_0x437b('0x3e')]),_0x1ed9bf);if(_0x1690f7[_0x437b('0x34')]['filter']){_0x4e7461[_0x437b('0x40')]=_[_0x437b('0x41')](_0x4e7461[_0x437b('0x40')],{'$or':_[_0x437b('0x33')](_0x1ed9bf,function(_0x5daa70){if(_0x5daa70[_0x437b('0x31')]!==_0x437b('0x42')){var _0x12c07e={};_0x12c07e[_0x5daa70['name']]={'$like':'%'+_0x1690f7['query'][_0x437b('0x43')]+'%'};return _0x12c07e;}})});}_0x4e7461=_['merge']({},_0x4e7461,_0x1690f7['options']);var _0x1c306a={'where':_0x4e7461[_0x437b('0x40')]};return db[_0x437b('0x44')][_0x437b('0x23')](_0x1c306a)[_0x437b('0x17')](function(_0x49b019){_0x4e48f2[_0x437b('0x23')]=_0x49b019;if(_0x1690f7[_0x437b('0x34')][_0x437b('0x45')]){_0x4e7461[_0x437b('0x46')]=[{'all':!![]}];}return db[_0x437b('0x44')][_0x437b('0x47')](_0x4e7461);})['then'](function(_0x481a57){_0x4e48f2[_0x437b('0x48')]=_0x481a57;return _0x4e48f2;})['then'](respondWithFilteredResult(_0x2a8f23,_0x4e7461))[_0x437b('0x49')](handleError(_0x2a8f23,null));};exports[_0x437b('0x4a')]=function(_0x4f8f76,_0x1aa7e1){var _0x1f0395={'raw':![],'where':{'id':_0x4f8f76[_0x437b('0x4b')]['id']}},_0x5ef10e={};_0x5ef10e[_0x437b('0x32')]=_[_0x437b('0x4c')](db[_0x437b('0x44')][_0x437b('0x2f')]);_0x5ef10e['query']=_[_0x437b('0x4c')](_0x4f8f76[_0x437b('0x34')]);_0x5ef10e['filters']=_[_0x437b('0x35')](_0x5ef10e[_0x437b('0x32')],_0x5ef10e['query']);_0x1f0395['attributes']=_[_0x437b('0x35')](_0x5ef10e[_0x437b('0x32')],qs[_0x437b('0x37')](_0x4f8f76[_0x437b('0x34')]['fields']));_0x1f0395[_0x437b('0x36')]=_0x1f0395[_0x437b('0x36')][_0x437b('0x38')]?_0x1f0395[_0x437b('0x36')]:_0x5ef10e[_0x437b('0x32')];if(_0x4f8f76[_0x437b('0x34')][_0x437b('0x45')]){_0x1f0395['include']=[{'all':!![]}];}_0x1f0395=_[_0x437b('0x41')]({},_0x1f0395,_0x4f8f76[_0x437b('0x4d')]);return db['VoiceContext'][_0x437b('0x4e')](_0x1f0395)[_0x437b('0x17')](handleEntityNotFound(_0x1aa7e1,null))['then'](respondWithResult(_0x1aa7e1,null))['catch'](handleError(_0x1aa7e1,null));};exports[_0x437b('0x4f')]=function(_0x546553,_0x356d3b,_0x582b1e){var _0x542ac9;return db['VoiceContext'][_0x437b('0x4f')](_0x546553[_0x437b('0x50')],{'raw':!![]})[_0x437b('0x17')](function(_0x26bab8){_0x542ac9=_0x26bab8;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x437b('0x17')](function(_0x598c9d){var _0x3817ba=fs[_0x437b('0x51')](path['join'](config['root'],_0x437b('0x52')),'utf8');var _0x3c25e2=ejs[_0x437b('0x53')](_0x3817ba,{'contexts':_0x598c9d||[]});fs[_0x437b('0x54')](_0x437b('0x55'),_0x3c25e2);})[_0x437b('0x17')](function(){return respondWithRpcPromise(_0x437b('0x56'),_0x437b('0x4f'),{'module':_0x437b('0x57')});})['then'](function(){var _0x218ea7=_0x546553[_0x437b('0x58')][_0x437b('0x59')]({'plain':!![]});if(!_0x218ea7)throw new Error(_0x437b('0x5a'));if(_0x218ea7[_0x437b('0x5b')]===_0x437b('0x58')){var _0x2bd48f=_0x542ac9['get']({'plain':!![]});return db[_0x437b('0x5c')]['find']({'where':{'name':_0x437b('0x29'),'userProfileId':_0x218ea7[_0x437b('0x5d')]},'raw':!![]})['then'](function(_0x36452f){if(_0x36452f&&_0x36452f['autoAssociation']===0x0){return db[_0x437b('0x2a')][_0x437b('0x4f')]({'name':_0x2bd48f[_0x437b('0x2c')],'resourceId':_0x2bd48f['id'],'type':_0x36452f[_0x437b('0x2c')],'sectionId':_0x36452f['id']},{})['then'](function(){return _0x542ac9;});}else{return _0x542ac9;}})[_0x437b('0x49')](function(_0x5e45f7){logger['error'](_0x437b('0x5e'),_0x5e45f7);throw _0x5e45f7;});}return _0x542ac9;})[_0x437b('0x17')](respondWithResult(_0x356d3b,0xc9))['catch'](handleError(_0x356d3b,null));};exports[_0x437b('0x27')]=function(_0x1eb81b,_0x50721c,_0xb1ab3a){var _0x2d15e5;return db[_0x437b('0x44')]['find']({'where':{'id':_0x1eb81b[_0x437b('0x4b')]['id']}})[_0x437b('0x17')](handleEntityNotFound(_0x50721c,null))['then'](saveUpdates(_0x1eb81b[_0x437b('0x50')],null))[_0x437b('0x17')](function(_0xf9cff){if(_0xf9cff){_0x2d15e5=_0xf9cff;return db[_0x437b('0x44')]['findAll']({'raw':!![]});}})[_0x437b('0x17')](function(_0x4eba08){var _0x30afd2=fs[_0x437b('0x51')](path['join'](config[_0x437b('0x5f')],_0x437b('0x52')),_0x437b('0x60'));var _0x3714f6=ejs[_0x437b('0x53')](_0x30afd2,{'contexts':_0x4eba08||[]});fs[_0x437b('0x54')](_0x437b('0x55'),_0x3714f6);})[_0x437b('0x17')](function(){return respondWithRpcPromise(_0x437b('0x56'),_0x437b('0x27'),{'module':_0x437b('0x57')});})[_0x437b('0x17')](function(){return _0x2d15e5;})[_0x437b('0x17')](respondWithResult(_0x50721c,null))[_0x437b('0x49')](handleError(_0x50721c,null));};exports[_0x437b('0x28')]=function(_0x1a905,_0x16de80,_0x118a2f){var _0x25cd54;return db['VoiceContext'][_0x437b('0x4e')]({'where':{'id':_0x1a905['params']['id']}})[_0x437b('0x17')](handleEntityNotFound(_0x16de80,null))[_0x437b('0x17')](removeEntity(_0x16de80,null))['then'](function(){return db[_0x437b('0x44')]['findAll']({'raw':!![]});})['then'](function(_0x53f5d1){var _0x2bcae5=fs['readFileSync'](path[_0x437b('0x61')](config[_0x437b('0x5f')],_0x437b('0x52')),_0x437b('0x60'));var _0x14c0aa=ejs[_0x437b('0x53')](_0x2bcae5,{'contexts':_0x53f5d1});fs[_0x437b('0x54')](_0x437b('0x55'),_0x14c0aa);return respondWithRpcPromise('Reload',_0x437b('0x28'),{'module':_0x437b('0x57')});})[_0x437b('0x49')](handleError(_0x16de80,null));}; \ No newline at end of file +var _0x3451=['type','VIRTUAL','options','includeAll','include','findAll','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','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','status','end','json','count','offset','apply','save','update','destroy','get','Contexts','UserProfileResource','stack','send','index','map','VoiceContext','model','name','query','keys','intersection','attributes','fields','nolimit','limit','sort','where','pick','filters','filter','merge'];(function(_0x454742,_0x29ff4c){var _0x52decb=function(_0x4010b3){while(--_0x4010b3){_0x454742['push'](_0x454742['shift']());}};_0x52decb(++_0x29ff4c);}(_0x3451,0x19a));var _0x1345=function(_0x13d4d2,_0xd2780f){_0x13d4d2=_0x13d4d2-0x0;var _0x4a2592=_0x3451[_0x13d4d2];return _0x4a2592;};'use strict';var pdf=require(_0x1345('0x0'));var emlformat=require(_0x1345('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1345('0x2'));var jsonpatch=require(_0x1345('0x3'));var rp=require(_0x1345('0x4'));var moment=require(_0x1345('0x5'));var BPromise=require(_0x1345('0x6'));var Mustache=require(_0x1345('0x7'));var util=require(_0x1345('0x8'));var path=require(_0x1345('0x9'));var sox=require(_0x1345('0xa'));var csv=require(_0x1345('0xb'));var ejs=require(_0x1345('0xc'));var fs=require('fs');var _=require(_0x1345('0xd'));var squel=require('squel');var crypto=require(_0x1345('0xe'));var jsforce=require(_0x1345('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1345('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1345('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1345('0x11'));var as=require(_0x1345('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1345('0x13'));var utils=require('../../config/utils');var config=require(_0x1345('0x14'));var licenseUtil=require(_0x1345('0x15'));var db=require(_0x1345('0x16'))['db'];var jayson=require(_0x1345('0x17'));var client=jayson['client'][_0x1345('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2cf05d,_0x19c7e9,_0x45c525,_0x4ea08a){return new BPromise(function(_0x181a2b,_0x426e00){var _0x51ad9f=_0x4ea08a||client;return _0x51ad9f[_0x1345('0x19')](_0x2cf05d,_0x45c525)[_0x1345('0x1a')](function(_0x959544){logger[_0x1345('0x1b')](_0x1345('0x1c'),_0x19c7e9,_0x1345('0x1d'));logger[_0x1345('0x1e')](_0x1345('0x1f'),_0x19c7e9,'request\x20sent',JSON['stringify'](_0x959544));if(_0x959544[_0x1345('0x20')]){if(_0x959544[_0x1345('0x20')][_0x1345('0x21')]===0x1f4){logger[_0x1345('0x20')]('VoiceContext,\x20%s,\x20%s',_0x19c7e9,_0x959544[_0x1345('0x20')][_0x1345('0x22')]);return _0x426e00(_0x959544[_0x1345('0x20')][_0x1345('0x22')]);}logger[_0x1345('0x20')](_0x1345('0x1c'),_0x19c7e9,_0x959544[_0x1345('0x20')][_0x1345('0x22')]);return _0x181a2b(_0x959544[_0x1345('0x20')][_0x1345('0x22')]);}else{logger[_0x1345('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x19c7e9,_0x1345('0x1d'));_0x181a2b(_0x959544[_0x1345('0x23')][_0x1345('0x22')]);}})[_0x1345('0x24')](function(_0x2ddf5c){logger[_0x1345('0x20')](_0x1345('0x1c'),_0x19c7e9,_0x2ddf5c);_0x426e00(_0x2ddf5c);});});}function respondWithStatusCode(_0x2fd7ca,_0x26c2a6){_0x26c2a6=_0x26c2a6||0xcc;return function(_0x339ea9){if(_0x339ea9){return _0x2fd7ca[_0x1345('0x25')](_0x26c2a6);}return _0x2fd7ca[_0x1345('0x26')](_0x26c2a6)[_0x1345('0x27')]();};}function respondWithResult(_0x4a5c44,_0x346054){_0x346054=_0x346054||0xc8;return function(_0x4a390c){if(_0x4a390c){return _0x4a5c44[_0x1345('0x26')](_0x346054)[_0x1345('0x28')](_0x4a390c);}};}function respondWithFilteredResult(_0x11827a,_0x32f9a3){return function(_0x44aa74){if(_0x44aa74){var _0x1b4b4f=_0x44aa74[_0x1345('0x29')],_0x3b891c=_0x32f9a3[_0x1345('0x2a')],_0x25b564=_0x32f9a3[_0x1345('0x2a')]+_0x32f9a3['limit'],_0x3dcf6c;if(_0x25b564>=_0x1b4b4f){_0x25b564=_0x1b4b4f;_0x3dcf6c=0xc8;}else{_0x3dcf6c=0xce;}_0x11827a[_0x1345('0x26')](_0x3dcf6c);return _0x11827a['set']('Content-Range',_0x3b891c+'-'+_0x25b564+'/'+_0x1b4b4f)[_0x1345('0x28')](_0x44aa74);}return null;};}function patchUpdates(_0x2e2b94){return function(_0x28b5dc){try{jsonpatch[_0x1345('0x2b')](_0x28b5dc,_0x2e2b94,!![]);}catch(_0x44bbba){return BPromise['reject'](_0x44bbba);}return _0x28b5dc[_0x1345('0x2c')]();};}function saveUpdates(_0x2b2be4,_0x96c944){return function(_0x49d8e8){if(_0x49d8e8){return _0x49d8e8[_0x1345('0x2d')](_0x2b2be4)['then'](function(_0x5b31ab){return _0x5b31ab;});}return null;};}function removeEntity(_0xee1b74,_0x1edcdc){return function(_0x7a1680){if(_0x7a1680){return _0x7a1680[_0x1345('0x2e')]()['then'](function(){var _0x81cc48=_0x7a1680[_0x1345('0x2f')]({'plain':!![]});var _0x160f80=_0x1345('0x30');return db[_0x1345('0x31')][_0x1345('0x2e')]({'where':{'type':_0x160f80,'resourceId':_0x81cc48['id']}})[_0x1345('0x1a')](function(){return _0x7a1680;});})[_0x1345('0x1a')](function(){_0xee1b74[_0x1345('0x26')](0xcc)[_0x1345('0x27')]();});}};}function handleEntityNotFound(_0x57ecf9,_0x55e3d0){return function(_0x422ac9){if(!_0x422ac9){_0x57ecf9[_0x1345('0x25')](0x194);}return _0x422ac9;};}function handleError(_0x2d382e,_0x2ee5fe){_0x2ee5fe=_0x2ee5fe||0x1f4;return function(_0xdff44a){logger['error'](_0xdff44a[_0x1345('0x32')]);if(_0xdff44a['name']){delete _0xdff44a['name'];}_0x2d382e[_0x1345('0x26')](_0x2ee5fe)[_0x1345('0x33')](_0xdff44a);};}exports[_0x1345('0x34')]=function(_0x5ae830,_0xaca35d){var _0x33ee2d={},_0x46a62c={},_0x2c49b9={'count':0x0,'rows':[]};var _0x3cf188=_[_0x1345('0x35')](db[_0x1345('0x36')]['rawAttributes'],function(_0x5df6a9){return{'name':_0x5df6a9['fieldName'],'type':_0x5df6a9['type']['key']};});_0x46a62c[_0x1345('0x37')]=_[_0x1345('0x35')](_0x3cf188,_0x1345('0x38'));_0x46a62c[_0x1345('0x39')]=_[_0x1345('0x3a')](_0x5ae830['query']);_0x46a62c['filters']=_[_0x1345('0x3b')](_0x46a62c[_0x1345('0x37')],_0x46a62c[_0x1345('0x39')]);_0x33ee2d[_0x1345('0x3c')]=_[_0x1345('0x3b')](_0x46a62c[_0x1345('0x37')],qs['fields'](_0x5ae830[_0x1345('0x39')][_0x1345('0x3d')]));_0x33ee2d[_0x1345('0x3c')]=_0x33ee2d[_0x1345('0x3c')]['length']?_0x33ee2d[_0x1345('0x3c')]:_0x46a62c[_0x1345('0x37')];if(!_0x5ae830[_0x1345('0x39')]['hasOwnProperty'](_0x1345('0x3e'))){_0x33ee2d[_0x1345('0x3f')]=qs[_0x1345('0x3f')](_0x5ae830['query'][_0x1345('0x3f')]);_0x33ee2d[_0x1345('0x2a')]=qs[_0x1345('0x2a')](_0x5ae830[_0x1345('0x39')][_0x1345('0x2a')]);}_0x33ee2d['order']=qs[_0x1345('0x40')](_0x5ae830[_0x1345('0x39')][_0x1345('0x40')]);_0x33ee2d[_0x1345('0x41')]=qs['filters'](_[_0x1345('0x42')](_0x5ae830[_0x1345('0x39')],_0x46a62c[_0x1345('0x43')]),_0x3cf188);if(_0x5ae830[_0x1345('0x39')][_0x1345('0x44')]){_0x33ee2d[_0x1345('0x41')]=_[_0x1345('0x45')](_0x33ee2d[_0x1345('0x41')],{'$or':_[_0x1345('0x35')](_0x3cf188,function(_0x1211ba){if(_0x1211ba[_0x1345('0x46')]!==_0x1345('0x47')){var _0x3b22d6={};_0x3b22d6[_0x1211ba[_0x1345('0x38')]]={'$like':'%'+_0x5ae830[_0x1345('0x39')][_0x1345('0x44')]+'%'};return _0x3b22d6;}})});}_0x33ee2d=_['merge']({},_0x33ee2d,_0x5ae830[_0x1345('0x48')]);var _0x8d3641={'where':_0x33ee2d[_0x1345('0x41')]};return db[_0x1345('0x36')][_0x1345('0x29')](_0x8d3641)[_0x1345('0x1a')](function(_0x3f3dd3){_0x2c49b9[_0x1345('0x29')]=_0x3f3dd3;if(_0x5ae830[_0x1345('0x39')][_0x1345('0x49')]){_0x33ee2d[_0x1345('0x4a')]=[{'all':!![]}];}return db[_0x1345('0x36')][_0x1345('0x4b')](_0x33ee2d);})['then'](function(_0x399d81){_0x2c49b9['rows']=_0x399d81;return _0x2c49b9;})[_0x1345('0x1a')](respondWithFilteredResult(_0xaca35d,_0x33ee2d))[_0x1345('0x24')](handleError(_0xaca35d,null));};exports['show']=function(_0x49b8fc,_0x27fc27){var _0x455b03={'raw':![],'where':{'id':_0x49b8fc['params']['id']}},_0x5f2677={};_0x5f2677['model']=_[_0x1345('0x3a')](db[_0x1345('0x36')]['rawAttributes']);_0x5f2677[_0x1345('0x39')]=_[_0x1345('0x3a')](_0x49b8fc['query']);_0x5f2677[_0x1345('0x43')]=_['intersection'](_0x5f2677[_0x1345('0x37')],_0x5f2677['query']);_0x455b03[_0x1345('0x3c')]=_[_0x1345('0x3b')](_0x5f2677['model'],qs[_0x1345('0x3d')](_0x49b8fc[_0x1345('0x39')]['fields']));_0x455b03['attributes']=_0x455b03[_0x1345('0x3c')]['length']?_0x455b03[_0x1345('0x3c')]:_0x5f2677[_0x1345('0x37')];if(_0x49b8fc[_0x1345('0x39')]['includeAll']){_0x455b03['include']=[{'all':!![]}];}_0x455b03=_['merge']({},_0x455b03,_0x49b8fc[_0x1345('0x48')]);return db[_0x1345('0x36')][_0x1345('0x4c')](_0x455b03)[_0x1345('0x1a')](handleEntityNotFound(_0x27fc27,null))['then'](respondWithResult(_0x27fc27,null))[_0x1345('0x24')](handleError(_0x27fc27,null));};exports['create']=function(_0x421d41,_0x1450ba,_0xadb7a6){var _0x79f14;return db[_0x1345('0x36')][_0x1345('0x4d')](_0x421d41[_0x1345('0x4e')],{'raw':!![]})[_0x1345('0x1a')](function(_0x439682){_0x79f14=_0x439682;return db[_0x1345('0x36')]['findAll']({'raw':!![]});})[_0x1345('0x1a')](function(_0x4668c9){var _0x45cd8c=fs[_0x1345('0x4f')](path[_0x1345('0x50')](config[_0x1345('0x51')],_0x1345('0x52')),_0x1345('0x53'));var _0x70489e=ejs[_0x1345('0x54')](_0x45cd8c,{'contexts':_0x4668c9||[]});fs[_0x1345('0x55')](_0x1345('0x56'),_0x70489e);})[_0x1345('0x1a')](function(){return respondWithRpcPromise(_0x1345('0x57'),_0x1345('0x4d'),{'module':_0x1345('0x58')});})['then'](function(){var _0x4224f7=_0x421d41[_0x1345('0x59')]['get']({'plain':!![]});if(!_0x4224f7)throw new Error(_0x1345('0x5a'));if(_0x4224f7[_0x1345('0x5b')]===_0x1345('0x59')){var _0x5c8cdc=_0x79f14[_0x1345('0x2f')]({'plain':!![]});return db[_0x1345('0x5c')][_0x1345('0x4c')]({'where':{'name':_0x1345('0x30'),'userProfileId':_0x4224f7[_0x1345('0x5d')]},'raw':!![]})[_0x1345('0x1a')](function(_0xbe9ef4){if(_0xbe9ef4&&_0xbe9ef4[_0x1345('0x5e')]===0x0){return db[_0x1345('0x31')][_0x1345('0x4d')]({'name':_0x5c8cdc[_0x1345('0x38')],'resourceId':_0x5c8cdc['id'],'type':_0xbe9ef4[_0x1345('0x38')],'sectionId':_0xbe9ef4['id']},{})[_0x1345('0x1a')](function(){return _0x79f14;});}else{return _0x79f14;}})[_0x1345('0x24')](function(_0x50b6ee){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50b6ee);throw _0x50b6ee;});}return _0x79f14;})[_0x1345('0x1a')](respondWithResult(_0x1450ba,0xc9))[_0x1345('0x24')](handleError(_0x1450ba,null));};exports[_0x1345('0x2d')]=function(_0x42a18e,_0x1f8369,_0x4738e8){var _0x442f01;return db[_0x1345('0x36')][_0x1345('0x4c')]({'where':{'id':_0x42a18e[_0x1345('0x5f')]['id']}})[_0x1345('0x1a')](handleEntityNotFound(_0x1f8369,null))[_0x1345('0x1a')](saveUpdates(_0x42a18e[_0x1345('0x4e')],null))['then'](function(_0x5e5679){if(_0x5e5679){_0x442f01=_0x5e5679;return db[_0x1345('0x36')][_0x1345('0x4b')]({'raw':!![]});}})['then'](function(_0x1fe87b){var _0xe4f7e9=fs['readFileSync'](path[_0x1345('0x50')](config[_0x1345('0x51')],_0x1345('0x52')),_0x1345('0x53'));var _0x502689=ejs[_0x1345('0x54')](_0xe4f7e9,{'contexts':_0x1fe87b||[]});fs[_0x1345('0x55')](_0x1345('0x56'),_0x502689);})[_0x1345('0x1a')](function(){return respondWithRpcPromise(_0x1345('0x57'),'update',{'module':'chan_sip.so'});})[_0x1345('0x1a')](function(){return _0x442f01;})[_0x1345('0x1a')](respondWithResult(_0x1f8369,null))[_0x1345('0x24')](handleError(_0x1f8369,null));};exports[_0x1345('0x2e')]=function(_0x5e93d0,_0x90a93b,_0x4b2d09){var _0x321f6c;return db['VoiceContext'][_0x1345('0x4c')]({'where':{'id':_0x5e93d0[_0x1345('0x5f')]['id']}})[_0x1345('0x1a')](handleEntityNotFound(_0x90a93b,null))['then'](removeEntity(_0x90a93b,null))[_0x1345('0x1a')](function(){return db[_0x1345('0x36')]['findAll']({'raw':!![]});})[_0x1345('0x1a')](function(_0x462dbe){var _0x174968=fs['readFileSync'](path['join'](config[_0x1345('0x51')],_0x1345('0x52')),'utf8');var _0xb007bb=ejs['render'](_0x174968,{'contexts':_0x462dbe});fs[_0x1345('0x55')](_0x1345('0x56'),_0xb007bb);return respondWithRpcPromise(_0x1345('0x57'),_0x1345('0x2e'),{'module':_0x1345('0x58')});})[_0x1345('0x24')](handleError(_0x90a93b,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index bd65ddc..2919a9b 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 _0xaf8b=['define','VoiceContext','voice_contexts','util','../../config/logger','path','rimraf','../../config/environment','./voiceContext.attributes'];(function(_0x4dade6,_0x16b01d){var _0x513270=function(_0x1d4a7f){while(--_0x1d4a7f){_0x4dade6['push'](_0x4dade6['shift']());}};_0x513270(++_0x16b01d);}(_0xaf8b,0xc0));var _0xbaf8=function(_0x3526e9,_0x21faf1){_0x3526e9=_0x3526e9-0x0;var _0x2d62de=_0xaf8b[_0x3526e9];return _0x2d62de;};'use strict';var _=require('lodash');var util=require(_0xbaf8('0x0'));var logger=require(_0xbaf8('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbaf8('0x2'));var rimraf=require(_0xbaf8('0x3'));var config=require(_0xbaf8('0x4'));var attributes=require(_0xbaf8('0x5'));module['exports']=function(_0x2f6d2a,_0x246627){return _0x2f6d2a[_0xbaf8('0x6')](_0xbaf8('0x7'),attributes,{'tableName':_0xbaf8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c00=['voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c00,0x187));var _0x05c0=function(_0x1b5fff,_0x4a7dad){_0x1b5fff=_0x1b5fff-0x0;var _0x31cc64=_0x5c00[_0x1b5fff];return _0x31cc64;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))(_0x05c0('0x3'));var moment=require(_0x05c0('0x4'));var BPromise=require(_0x05c0('0x5'));var rp=require(_0x05c0('0x6'));var fs=require('fs');var path=require(_0x05c0('0x7'));var rimraf=require(_0x05c0('0x8'));var config=require(_0x05c0('0x9'));var attributes=require(_0x05c0('0xa'));module[_0x05c0('0xb')]=function(_0x3ad25f,_0x1895c5){return _0x3ad25f[_0x05c0('0xc')](_0x05c0('0xd'),attributes,{'tableName':_0x05c0('0xe'),'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 cd2372c..6bc0775 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 _0x171d=['VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x456aa3,_0x198c86){var _0x328027=function(_0x557117){while(--_0x557117){_0x456aa3['push'](_0x456aa3['shift']());}};_0x328027(++_0x198c86);}(_0x171d,0x124));var _0xd171=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x171d[_0x46efd7];return _0x5637e4;};'use strict';var _=require(_0xd171('0x0'));var util=require(_0xd171('0x1'));var moment=require(_0xd171('0x2'));var BPromise=require(_0xd171('0x3'));var rs=require(_0xd171('0x4'));var fs=require('fs');var Redis=require(_0xd171('0x5'));var db=require(_0xd171('0x6'))['db'];var utils=require(_0xd171('0x7'));var logger=require('../../config/logger')(_0xd171('0x8'));var config=require(_0xd171('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd171('0xa')][_0xd171('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa2a5fd,_0x568798,_0x2dcdfa){return new BPromise(function(_0x513096,_0x47240f){return client['request'](_0xa2a5fd,_0x2dcdfa)[_0xd171('0xc')](function(_0x4668d5){logger[_0xd171('0xd')]('VoiceContext,\x20%s,\x20%s',_0x568798,_0xd171('0xe'));logger[_0xd171('0xf')](_0xd171('0x10'),_0x568798,_0xd171('0xe'),JSON[_0xd171('0x11')](_0x4668d5));if(_0x4668d5[_0xd171('0x12')]){if(_0x4668d5[_0xd171('0x12')][_0xd171('0x13')]===0x1f4){logger[_0xd171('0x12')](_0xd171('0x14'),_0x568798,_0x4668d5[_0xd171('0x12')][_0xd171('0x15')]);return _0x47240f(_0x4668d5[_0xd171('0x12')]['message']);}logger[_0xd171('0x12')](_0xd171('0x14'),_0x568798,_0x4668d5[_0xd171('0x12')]['message']);return _0x513096(_0x4668d5['error']['message']);}else{logger['info'](_0xd171('0x14'),_0x568798,'request\x20sent');_0x513096(_0x4668d5[_0xd171('0x16')][_0xd171('0x15')]);}})[_0xd171('0x17')](function(_0x10d8d9){logger[_0xd171('0x12')]('VoiceContext,\x20%s,\x20%s',_0x568798,_0x10d8d9);_0x47240f(_0x10d8d9);});});} \ No newline at end of file +var _0x2d26=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1e0620,_0x39239f){var _0x475285=function(_0x2cd7e1){while(--_0x2cd7e1){_0x1e0620['push'](_0x1e0620['shift']());}};_0x475285(++_0x39239f);}(_0x2d26,0xdb));var _0x62d2=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x2d26[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x62d2('0x0'));var util=require(_0x62d2('0x1'));var moment=require(_0x62d2('0x2'));var BPromise=require(_0x62d2('0x3'));var rs=require(_0x62d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62d2('0x5'))['db'];var utils=require(_0x62d2('0x6'));var logger=require(_0x62d2('0x7'))(_0x62d2('0x8'));var config=require(_0x62d2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x62d2('0xa')][_0x62d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f414f,_0x36a6fb,_0x49e79b){return new BPromise(function(_0x4def49,_0x231cfa){return client[_0x62d2('0xc')](_0x3f414f,_0x49e79b)[_0x62d2('0xd')](function(_0x59d3fb){logger['info'](_0x62d2('0xe'),_0x36a6fb,'request\x20sent');logger[_0x62d2('0xf')](_0x62d2('0x10'),_0x36a6fb,_0x62d2('0x11'),JSON[_0x62d2('0x12')](_0x59d3fb));if(_0x59d3fb[_0x62d2('0x13')]){if(_0x59d3fb['error'][_0x62d2('0x14')]===0x1f4){logger[_0x62d2('0x13')]('VoiceContext,\x20%s,\x20%s',_0x36a6fb,_0x59d3fb[_0x62d2('0x13')][_0x62d2('0x15')]);return _0x231cfa(_0x59d3fb[_0x62d2('0x13')][_0x62d2('0x15')]);}logger[_0x62d2('0x13')]('VoiceContext,\x20%s,\x20%s',_0x36a6fb,_0x59d3fb[_0x62d2('0x13')][_0x62d2('0x15')]);return _0x4def49(_0x59d3fb[_0x62d2('0x13')]['message']);}else{logger[_0x62d2('0x16')](_0x62d2('0xe'),_0x36a6fb,_0x62d2('0x11'));_0x4def49(_0x59d3fb[_0x62d2('0x17')]['message']);}})[_0x62d2('0x18')](function(_0x26f9a3){logger[_0x62d2('0x13')](_0x62d2('0xe'),_0x36a6fb,_0x26f9a3);_0x231cfa(_0x26f9a3);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a9177cd..a1d35b1 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 _0xa54f=['create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xa54f,0x142));var _0xfa54=function(_0x1aa832,_0x93f678){_0x1aa832=_0x1aa832-0x0;var _0x334378=_0xa54f[_0x1aa832];return _0x334378;};'use strict';var multer=require('multer');var util=require(_0xfa54('0x0'));var path=require(_0xfa54('0x1'));var timeout=require(_0xfa54('0x2'));var express=require(_0xfa54('0x3'));var router=express[_0xfa54('0x4')]();var auth=require(_0xfa54('0x5'));var interaction=require(_0xfa54('0x6'));var config=require(_0xfa54('0x7'));var controller=require('./voiceDialReport.controller');router[_0xfa54('0x8')]('/',auth[_0xfa54('0x9')](),controller[_0xfa54('0xa')]);router[_0xfa54('0x8')](_0xfa54('0xb'),auth[_0xfa54('0x9')](),controller[_0xfa54('0xc')]);router[_0xfa54('0x8')]('/:id',auth[_0xfa54('0x9')](),controller['show']);router[_0xfa54('0xd')]('/',auth['isAuthenticated'](),controller[_0xfa54('0xe')]);router[_0xfa54('0xf')](_0xfa54('0x10'),auth['isAuthenticated'](),controller[_0xfa54('0x11')]);router[_0xfa54('0x12')](_0xfa54('0x10'),auth[_0xfa54('0x9')](),controller[_0xfa54('0x13')]);module[_0xfa54('0x14')]=router; \ No newline at end of file +var _0x12b6=['get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller'];(function(_0x1e33d9,_0x32d413){var _0x58b7b3=function(_0x9e8751){while(--_0x9e8751){_0x1e33d9['push'](_0x1e33d9['shift']());}};_0x58b7b3(++_0x32d413);}(_0x12b6,0xd0));var _0x612b=function(_0x2ab25f,_0x371a39){_0x2ab25f=_0x2ab25f-0x0;var _0xe72614=_0x12b6[_0x2ab25f];return _0xe72614;};'use strict';var multer=require(_0x612b('0x0'));var util=require('util');var path=require(_0x612b('0x1'));var timeout=require(_0x612b('0x2'));var express=require(_0x612b('0x3'));var router=express[_0x612b('0x4')]();var auth=require(_0x612b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x612b('0x6'));var controller=require(_0x612b('0x7'));router[_0x612b('0x8')]('/',auth[_0x612b('0x9')](),controller[_0x612b('0xa')]);router[_0x612b('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x612b('0xb')]);router['get'](_0x612b('0xc'),auth[_0x612b('0x9')](),controller[_0x612b('0xd')]);router['post']('/',auth[_0x612b('0x9')](),controller[_0x612b('0xe')]);router[_0x612b('0xf')](_0x612b('0xc'),auth['isAuthenticated'](),controller[_0x612b('0x10')]);router[_0x612b('0x11')](_0x612b('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index ac0eb4b..2a1df9a 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 _0xbdf2=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x459511,_0x5dd714){var _0x27837b=function(_0x3b150e){while(--_0x3b150e){_0x459511['push'](_0x459511['shift']());}};_0x27837b(++_0x5dd714);}(_0xbdf2,0x68));var _0x2bdf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbdf2[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x2bdf('0x0')]={'privilege':{'type':Sequelize[_0x2bdf('0x1')]},'channel':{'type':Sequelize[_0x2bdf('0x1')]},'channelstate':{'type':Sequelize[_0x2bdf('0x2')]},'channelstatedesc':{'type':Sequelize[_0x2bdf('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2bdf('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2bdf('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2bdf('0x1')]},'context':{'type':Sequelize[_0x2bdf('0x1')]},'exten':{'type':Sequelize[_0x2bdf('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x2bdf('0x1')]},'linkedid':{'type':Sequelize[_0x2bdf('0x1')]},'destchannel':{'type':Sequelize[_0x2bdf('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x2bdf('0x1')]},'destcalleridnum':{'type':Sequelize[_0x2bdf('0x1')]},'destcalleridname':{'type':Sequelize[_0x2bdf('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x2bdf('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x2bdf('0x1')]},'destlanguage':{'type':Sequelize[_0x2bdf('0x1')]},'destaccountcode':{'type':Sequelize[_0x2bdf('0x1')]},'destcontext':{'type':Sequelize[_0x2bdf('0x1')]},'destexten':{'type':Sequelize[_0x2bdf('0x1')]},'destpriority':{'type':Sequelize[_0x2bdf('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x2bdf('0x1')]},'dialstatus':{'type':Sequelize[_0x2bdf('0x1')]},'starttime':{'type':Sequelize[_0x2bdf('0x3')]},'answertime':{'type':Sequelize[_0x2bdf('0x3')]},'endtime':{'type':Sequelize[_0x2bdf('0x3')]},'lastevent':{'type':Sequelize[_0x2bdf('0x1')],'comment':_0x2bdf('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x2bdf('0x2')]},'billableseconds':{'type':Sequelize[_0x2bdf('0x2')]}}; \ No newline at end of file +var _0xb12d=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x163f94,_0x1d0c28){var _0x3a7506=function(_0x210ecd){while(--_0x210ecd){_0x163f94['push'](_0x163f94['shift']());}};_0x3a7506(++_0x1d0c28);}(_0xb12d,0x80));var _0xdb12=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xb12d[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0xdb12('0x0')]},'channel':{'type':Sequelize[_0xdb12('0x0')]},'channelstate':{'type':Sequelize[_0xdb12('0x1')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdb12('0x0')]},'connectedlinenum':{'type':Sequelize[_0xdb12('0x0')]},'connectedlinename':{'type':Sequelize[_0xdb12('0x0')]},'language':{'type':Sequelize[_0xdb12('0x0')]},'accountcode':{'type':Sequelize[_0xdb12('0x0')]},'context':{'type':Sequelize[_0xdb12('0x0')]},'exten':{'type':Sequelize[_0xdb12('0x0')]},'priority':{'type':Sequelize[_0xdb12('0x1')]},'uniqueid':{'type':Sequelize[_0xdb12('0x0')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xdb12('0x0')]},'destchannelstate':{'type':Sequelize[_0xdb12('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0xdb12('0x0')]},'destcalleridnum':{'type':Sequelize[_0xdb12('0x0')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xdb12('0x0')]},'destconnectedlinename':{'type':Sequelize[_0xdb12('0x0')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xdb12('0x0')]},'destcontext':{'type':Sequelize[_0xdb12('0x0')]},'destexten':{'type':Sequelize[_0xdb12('0x0')]},'destpriority':{'type':Sequelize[_0xdb12('0x1')]},'destuniqueid':{'type':Sequelize[_0xdb12('0x0')]},'destlinkedid':{'type':Sequelize[_0xdb12('0x0')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdb12('0x2')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xdb12('0x2')]},'lastevent':{'type':Sequelize[_0xdb12('0x0')],'comment':_0xdb12('0x3')},'routeId':{'type':Sequelize[_0xdb12('0x1')]},'duration':{'type':Sequelize[_0xdb12('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 7cf57a0..06b4dd9 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 _0xe7b0=['order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','reject','then','destroy','end','error','name','index','map','VoiceDialReport','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xe7b0,0x183));var _0x0e7b=function(_0x3f48e0,_0x453a44){_0x3f48e0=_0x3f48e0-0x0;var _0x2333e1=_0xe7b0[_0x3f48e0];return _0x2333e1;};'use strict';var pdf=require(_0x0e7b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0e7b('0x1'));var zipdir=require(_0x0e7b('0x2'));var jsonpatch=require(_0x0e7b('0x3'));var rp=require(_0x0e7b('0x4'));var moment=require(_0x0e7b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0e7b('0x6'));var util=require(_0x0e7b('0x7'));var path=require(_0x0e7b('0x8'));var sox=require(_0x0e7b('0x9'));var csv=require(_0x0e7b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e7b('0xb'));var squel=require('squel');var crypto=require(_0x0e7b('0xc'));var jsforce=require(_0x0e7b('0xd'));var deskjs=require(_0x0e7b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0e7b('0xf'));var Papa=require(_0x0e7b('0x10'));var Redis=require(_0x0e7b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0e7b('0x12'));var as=require(_0x0e7b('0x13'));var hardwareService=require(_0x0e7b('0x14'));var logger=require(_0x0e7b('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0e7b('0x16'));var db=require(_0x0e7b('0x17'))['db'];function respondWithStatusCode(_0x3fee18,_0x1ff20e){_0x1ff20e=_0x1ff20e||0xcc;return function(_0x31a99b){if(_0x31a99b){return _0x3fee18[_0x0e7b('0x18')](_0x1ff20e);}return _0x3fee18[_0x0e7b('0x19')](_0x1ff20e)['end']();};}function respondWithResult(_0x2e5686,_0xe3cdf3){_0xe3cdf3=_0xe3cdf3||0xc8;return function(_0x50319d){if(_0x50319d){return _0x2e5686[_0x0e7b('0x19')](_0xe3cdf3)[_0x0e7b('0x1a')](_0x50319d);}};}function respondWithFilteredResult(_0xce805c,_0x5f0baa){return function(_0x3b645c){if(_0x3b645c){var _0x974e9d=_0x3b645c['count'],_0x1acc37=_0x5f0baa[_0x0e7b('0x1b')],_0xd03af4=_0x5f0baa[_0x0e7b('0x1b')]+_0x5f0baa[_0x0e7b('0x1c')],_0x22b373;if(_0xd03af4>=_0x974e9d){_0xd03af4=_0x974e9d;_0x22b373=0xc8;}else{_0x22b373=0xce;}_0xce805c[_0x0e7b('0x19')](_0x22b373);return _0xce805c[_0x0e7b('0x1d')]('Content-Range',_0x1acc37+'-'+_0xd03af4+'/'+_0x974e9d)[_0x0e7b('0x1a')](_0x3b645c);}return null;};}function patchUpdates(_0x324482){return function(_0x57b2a3){try{jsonpatch['apply'](_0x57b2a3,_0x324482,!![]);}catch(_0x501596){return BPromise[_0x0e7b('0x1e')](_0x501596);}return _0x57b2a3['save']();};}function saveUpdates(_0x65cc9c,_0x35106a){return function(_0x224d14){if(_0x224d14){return _0x224d14['update'](_0x65cc9c)[_0x0e7b('0x1f')](function(_0xc6da51){return _0xc6da51;});}return null;};}function removeEntity(_0x2a18c7,_0x1154d7){return function(_0x1e7f3b){if(_0x1e7f3b){return _0x1e7f3b[_0x0e7b('0x20')]()[_0x0e7b('0x1f')](function(){_0x2a18c7[_0x0e7b('0x19')](0xcc)[_0x0e7b('0x21')]();});}};}function handleEntityNotFound(_0x1ace0d,_0x49f3a){return function(_0xa18567){if(!_0xa18567){_0x1ace0d[_0x0e7b('0x18')](0x194);}return _0xa18567;};}function handleError(_0x47a77b,_0x1666c6){_0x1666c6=_0x1666c6||0x1f4;return function(_0x3d3130){logger[_0x0e7b('0x22')](_0x3d3130['stack']);if(_0x3d3130[_0x0e7b('0x23')]){delete _0x3d3130[_0x0e7b('0x23')];}_0x47a77b[_0x0e7b('0x19')](_0x1666c6)['send'](_0x3d3130);};}exports[_0x0e7b('0x24')]=function(_0x370f1a,_0x4013d3){var _0x9bf736={},_0x40d0a5={},_0x47bbf0={'count':0x0,'rows':[]};var _0x24f8f4=_[_0x0e7b('0x25')](db[_0x0e7b('0x26')]['rawAttributes'],function(_0x4056b4){return{'name':_0x4056b4[_0x0e7b('0x27')],'type':_0x4056b4[_0x0e7b('0x28')]['key']};});_0x40d0a5[_0x0e7b('0x29')]=_[_0x0e7b('0x25')](_0x24f8f4,_0x0e7b('0x23'));_0x40d0a5['query']=_[_0x0e7b('0x2a')](_0x370f1a[_0x0e7b('0x2b')]);_0x40d0a5[_0x0e7b('0x2c')]=_[_0x0e7b('0x2d')](_0x40d0a5['model'],_0x40d0a5[_0x0e7b('0x2b')]);_0x9bf736[_0x0e7b('0x2e')]=_[_0x0e7b('0x2d')](_0x40d0a5['model'],qs[_0x0e7b('0x2f')](_0x370f1a[_0x0e7b('0x2b')][_0x0e7b('0x2f')]));_0x9bf736[_0x0e7b('0x2e')]=_0x9bf736['attributes'][_0x0e7b('0x30')]?_0x9bf736[_0x0e7b('0x2e')]:_0x40d0a5[_0x0e7b('0x29')];if(!_0x370f1a[_0x0e7b('0x2b')][_0x0e7b('0x31')](_0x0e7b('0x32'))){_0x9bf736['limit']=qs[_0x0e7b('0x1c')](_0x370f1a[_0x0e7b('0x2b')][_0x0e7b('0x1c')]);_0x9bf736[_0x0e7b('0x1b')]=qs['offset'](_0x370f1a[_0x0e7b('0x2b')]['offset']);}_0x9bf736[_0x0e7b('0x33')]=qs[_0x0e7b('0x34')](_0x370f1a[_0x0e7b('0x2b')][_0x0e7b('0x34')]);_0x9bf736[_0x0e7b('0x35')]=qs[_0x0e7b('0x2c')](_[_0x0e7b('0x36')](_0x370f1a['query'],_0x40d0a5[_0x0e7b('0x2c')]),_0x24f8f4);if(_0x370f1a[_0x0e7b('0x2b')][_0x0e7b('0x37')]){_0x9bf736[_0x0e7b('0x35')]=_['merge'](_0x9bf736[_0x0e7b('0x35')],{'$or':_[_0x0e7b('0x25')](_0x24f8f4,function(_0x95c52a){if(_0x95c52a['type']!==_0x0e7b('0x38')){var _0xf238cf={};_0xf238cf[_0x95c52a[_0x0e7b('0x23')]]={'$like':'%'+_0x370f1a[_0x0e7b('0x2b')][_0x0e7b('0x37')]+'%'};return _0xf238cf;}})});}_0x9bf736=_[_0x0e7b('0x39')]({},_0x9bf736,_0x370f1a[_0x0e7b('0x3a')]);var _0x33cf67={'where':_0x9bf736['where']};return db[_0x0e7b('0x26')][_0x0e7b('0x3b')](_0x33cf67)[_0x0e7b('0x1f')](function(_0xcc3963){_0x47bbf0[_0x0e7b('0x3b')]=_0xcc3963;if(_0x370f1a['query'][_0x0e7b('0x3c')]){_0x9bf736['include']=[{'all':!![]}];}return db[_0x0e7b('0x26')][_0x0e7b('0x3d')](_0x9bf736);})[_0x0e7b('0x1f')](function(_0x1db0a2){_0x47bbf0[_0x0e7b('0x3e')]=_0x1db0a2;return _0x47bbf0;})[_0x0e7b('0x1f')](respondWithFilteredResult(_0x4013d3,_0x9bf736))[_0x0e7b('0x3f')](handleError(_0x4013d3,null));};exports[_0x0e7b('0x40')]=function(_0xc19d4a,_0x52f29a){var _0x5e7dee={'raw':!![],'where':{'id':_0xc19d4a[_0x0e7b('0x41')]['id']}},_0x44b3d8={};_0x44b3d8[_0x0e7b('0x29')]=_[_0x0e7b('0x2a')](db[_0x0e7b('0x26')][_0x0e7b('0x42')]);_0x44b3d8[_0x0e7b('0x2b')]=_[_0x0e7b('0x2a')](_0xc19d4a[_0x0e7b('0x2b')]);_0x44b3d8[_0x0e7b('0x2c')]=_['intersection'](_0x44b3d8[_0x0e7b('0x29')],_0x44b3d8[_0x0e7b('0x2b')]);_0x5e7dee[_0x0e7b('0x2e')]=_['intersection'](_0x44b3d8[_0x0e7b('0x29')],qs[_0x0e7b('0x2f')](_0xc19d4a['query'][_0x0e7b('0x2f')]));_0x5e7dee[_0x0e7b('0x2e')]=_0x5e7dee[_0x0e7b('0x2e')][_0x0e7b('0x30')]?_0x5e7dee[_0x0e7b('0x2e')]:_0x44b3d8[_0x0e7b('0x29')];if(_0xc19d4a[_0x0e7b('0x2b')][_0x0e7b('0x3c')]){_0x5e7dee[_0x0e7b('0x43')]=[{'all':!![]}];}_0x5e7dee=_['merge']({},_0x5e7dee,_0xc19d4a[_0x0e7b('0x3a')]);return db[_0x0e7b('0x26')][_0x0e7b('0x44')](_0x5e7dee)[_0x0e7b('0x1f')](handleEntityNotFound(_0x52f29a,null))[_0x0e7b('0x1f')](respondWithResult(_0x52f29a,null))[_0x0e7b('0x3f')](handleError(_0x52f29a,null));};exports['create']=function(_0x4daaca,_0x4424d3){return db[_0x0e7b('0x26')][_0x0e7b('0x45')](_0x4daaca[_0x0e7b('0x46')],{})[_0x0e7b('0x1f')](respondWithResult(_0x4424d3,0xc9))[_0x0e7b('0x3f')](handleError(_0x4424d3,null));};exports[_0x0e7b('0x47')]=function(_0x7191c3,_0x4c0452){if(_0x7191c3[_0x0e7b('0x46')]['id']){delete _0x7191c3[_0x0e7b('0x46')]['id'];}return db[_0x0e7b('0x26')][_0x0e7b('0x44')]({'where':{'id':_0x7191c3[_0x0e7b('0x41')]['id']}})[_0x0e7b('0x1f')](handleEntityNotFound(_0x4c0452,null))[_0x0e7b('0x1f')](saveUpdates(_0x7191c3['body'],null))['then'](respondWithResult(_0x4c0452,null))[_0x0e7b('0x3f')](handleError(_0x4c0452,null));};exports[_0x0e7b('0x20')]=function(_0x41733c,_0x455ed2){return db['VoiceDialReport']['find']({'where':{'id':_0x41733c[_0x0e7b('0x41')]['id']}})['then'](handleEntityNotFound(_0x455ed2,null))['then'](removeEntity(_0x455ed2,null))[_0x0e7b('0x3f')](handleError(_0x455ed2,null));};exports[_0x0e7b('0x48')]=function(_0x3db837,_0x45c8a5){return db['VoiceDialReport']['describe']()[_0x0e7b('0x1f')](respondWithResult(_0x45c8a5,null))[_0x0e7b('0x3f')](handleError(_0x45c8a5,null));}; \ No newline at end of file +var _0xfe7f=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','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','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','name','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','count','include','findAll','show','params','includeAll','find','catch','create','body','update','describe','html-pdf'];(function(_0x38aa3d,_0x5ed191){var _0x8936ba=function(_0x38d5b9){while(--_0x38d5b9){_0x38aa3d['push'](_0x38aa3d['shift']());}};_0x8936ba(++_0x5ed191);}(_0xfe7f,0x11f));var _0xffe7=function(_0x334c14,_0x1df988){_0x334c14=_0x334c14-0x0;var _0x1e7875=_0xfe7f[_0x334c14];return _0x1e7875;};'use strict';var pdf=require(_0xffe7('0x0'));var emlformat=require(_0xffe7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xffe7('0x2'));var jsonpatch=require(_0xffe7('0x3'));var rp=require(_0xffe7('0x4'));var moment=require(_0xffe7('0x5'));var BPromise=require(_0xffe7('0x6'));var Mustache=require('mustache');var util=require(_0xffe7('0x7'));var path=require(_0xffe7('0x8'));var sox=require(_0xffe7('0x9'));var csv=require(_0xffe7('0xa'));var ejs=require(_0xffe7('0xb'));var fs=require('fs');var _=require(_0xffe7('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xffe7('0xd'));var Redis=require(_0xffe7('0xe'));var authService=require(_0xffe7('0xf'));var qs=require(_0xffe7('0x10'));var as=require(_0xffe7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xffe7('0x12'))(_0xffe7('0x13'));var utils=require(_0xffe7('0x14'));var config=require(_0xffe7('0x15'));var licenseUtil=require(_0xffe7('0x16'));var db=require(_0xffe7('0x17'))['db'];function respondWithStatusCode(_0x3ec1ea,_0x150ab2){_0x150ab2=_0x150ab2||0xcc;return function(_0x1ba646){if(_0x1ba646){return _0x3ec1ea[_0xffe7('0x18')](_0x150ab2);}return _0x3ec1ea['status'](_0x150ab2)[_0xffe7('0x19')]();};}function respondWithResult(_0x2e6eb9,_0x337852){_0x337852=_0x337852||0xc8;return function(_0x1195a7){if(_0x1195a7){return _0x2e6eb9[_0xffe7('0x1a')](_0x337852)[_0xffe7('0x1b')](_0x1195a7);}};}function respondWithFilteredResult(_0x5a45d2,_0x978a4){return function(_0x458a7a){if(_0x458a7a){var _0x5d3e59=_0x458a7a['count'],_0x225b86=_0x978a4[_0xffe7('0x1c')],_0x5d4132=_0x978a4[_0xffe7('0x1c')]+_0x978a4[_0xffe7('0x1d')],_0x356fbe;if(_0x5d4132>=_0x5d3e59){_0x5d4132=_0x5d3e59;_0x356fbe=0xc8;}else{_0x356fbe=0xce;}_0x5a45d2['status'](_0x356fbe);return _0x5a45d2[_0xffe7('0x1e')](_0xffe7('0x1f'),_0x225b86+'-'+_0x5d4132+'/'+_0x5d3e59)[_0xffe7('0x1b')](_0x458a7a);}return null;};}function patchUpdates(_0x5bc53f){return function(_0x20e177){try{jsonpatch[_0xffe7('0x20')](_0x20e177,_0x5bc53f,!![]);}catch(_0x54d1ac){return BPromise[_0xffe7('0x21')](_0x54d1ac);}return _0x20e177[_0xffe7('0x22')]();};}function saveUpdates(_0x56af86,_0x504e9b){return function(_0x4cae2f){if(_0x4cae2f){return _0x4cae2f['update'](_0x56af86)['then'](function(_0x1820e5){return _0x1820e5;});}return null;};}function removeEntity(_0x575404,_0x154baa){return function(_0x484c41){if(_0x484c41){return _0x484c41[_0xffe7('0x23')]()[_0xffe7('0x24')](function(){_0x575404['status'](0xcc)[_0xffe7('0x19')]();});}};}function handleEntityNotFound(_0x4d2912,_0x252406){return function(_0x57e2e4){if(!_0x57e2e4){_0x4d2912['sendStatus'](0x194);}return _0x57e2e4;};}function handleError(_0x422d46,_0x5323a7){_0x5323a7=_0x5323a7||0x1f4;return function(_0xf05c1f){logger[_0xffe7('0x25')](_0xf05c1f['stack']);if(_0xf05c1f['name']){delete _0xf05c1f[_0xffe7('0x26')];}_0x422d46[_0xffe7('0x1a')](_0x5323a7)['send'](_0xf05c1f);};}exports['index']=function(_0x15dd5a,_0x52ba09){var _0x7af1ec={},_0x550da1={},_0x394001={'count':0x0,'rows':[]};var _0x490313=_[_0xffe7('0x27')](db[_0xffe7('0x28')][_0xffe7('0x29')],function(_0x50ca20){return{'name':_0x50ca20[_0xffe7('0x2a')],'type':_0x50ca20[_0xffe7('0x2b')][_0xffe7('0x2c')]};});_0x550da1[_0xffe7('0x2d')]=_['map'](_0x490313,_0xffe7('0x26'));_0x550da1[_0xffe7('0x2e')]=_[_0xffe7('0x2f')](_0x15dd5a[_0xffe7('0x2e')]);_0x550da1[_0xffe7('0x30')]=_[_0xffe7('0x31')](_0x550da1[_0xffe7('0x2d')],_0x550da1[_0xffe7('0x2e')]);_0x7af1ec['attributes']=_[_0xffe7('0x31')](_0x550da1[_0xffe7('0x2d')],qs[_0xffe7('0x32')](_0x15dd5a[_0xffe7('0x2e')][_0xffe7('0x32')]));_0x7af1ec[_0xffe7('0x33')]=_0x7af1ec[_0xffe7('0x33')][_0xffe7('0x34')]?_0x7af1ec[_0xffe7('0x33')]:_0x550da1[_0xffe7('0x2d')];if(!_0x15dd5a[_0xffe7('0x2e')][_0xffe7('0x35')]('nolimit')){_0x7af1ec['limit']=qs[_0xffe7('0x1d')](_0x15dd5a[_0xffe7('0x2e')]['limit']);_0x7af1ec['offset']=qs['offset'](_0x15dd5a[_0xffe7('0x2e')][_0xffe7('0x1c')]);}_0x7af1ec['order']=qs[_0xffe7('0x36')](_0x15dd5a[_0xffe7('0x2e')][_0xffe7('0x36')]);_0x7af1ec[_0xffe7('0x37')]=qs[_0xffe7('0x30')](_[_0xffe7('0x38')](_0x15dd5a[_0xffe7('0x2e')],_0x550da1[_0xffe7('0x30')]),_0x490313);if(_0x15dd5a['query'][_0xffe7('0x39')]){_0x7af1ec[_0xffe7('0x37')]=_[_0xffe7('0x3a')](_0x7af1ec[_0xffe7('0x37')],{'$or':_['map'](_0x490313,function(_0x2fec43){if(_0x2fec43[_0xffe7('0x2b')]!=='VIRTUAL'){var _0x8367b0={};_0x8367b0[_0x2fec43[_0xffe7('0x26')]]={'$like':'%'+_0x15dd5a[_0xffe7('0x2e')][_0xffe7('0x39')]+'%'};return _0x8367b0;}})});}_0x7af1ec=_['merge']({},_0x7af1ec,_0x15dd5a[_0xffe7('0x3b')]);var _0x1600eb={'where':_0x7af1ec[_0xffe7('0x37')]};return db['VoiceDialReport'][_0xffe7('0x3c')](_0x1600eb)[_0xffe7('0x24')](function(_0x496b05){_0x394001['count']=_0x496b05;if(_0x15dd5a['query']['includeAll']){_0x7af1ec[_0xffe7('0x3d')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xffe7('0x3e')](_0x7af1ec);})[_0xffe7('0x24')](function(_0x53ea9d){_0x394001['rows']=_0x53ea9d;return _0x394001;})['then'](respondWithFilteredResult(_0x52ba09,_0x7af1ec))['catch'](handleError(_0x52ba09,null));};exports[_0xffe7('0x3f')]=function(_0x32cfb4,_0x45abbe){var _0x236f73={'raw':!![],'where':{'id':_0x32cfb4[_0xffe7('0x40')]['id']}},_0x3c5139={};_0x3c5139['model']=_[_0xffe7('0x2f')](db['VoiceDialReport']['rawAttributes']);_0x3c5139[_0xffe7('0x2e')]=_[_0xffe7('0x2f')](_0x32cfb4[_0xffe7('0x2e')]);_0x3c5139[_0xffe7('0x30')]=_[_0xffe7('0x31')](_0x3c5139[_0xffe7('0x2d')],_0x3c5139[_0xffe7('0x2e')]);_0x236f73[_0xffe7('0x33')]=_[_0xffe7('0x31')](_0x3c5139[_0xffe7('0x2d')],qs[_0xffe7('0x32')](_0x32cfb4[_0xffe7('0x2e')]['fields']));_0x236f73[_0xffe7('0x33')]=_0x236f73[_0xffe7('0x33')][_0xffe7('0x34')]?_0x236f73[_0xffe7('0x33')]:_0x3c5139[_0xffe7('0x2d')];if(_0x32cfb4['query'][_0xffe7('0x41')]){_0x236f73[_0xffe7('0x3d')]=[{'all':!![]}];}_0x236f73=_[_0xffe7('0x3a')]({},_0x236f73,_0x32cfb4[_0xffe7('0x3b')]);return db['VoiceDialReport'][_0xffe7('0x42')](_0x236f73)[_0xffe7('0x24')](handleEntityNotFound(_0x45abbe,null))[_0xffe7('0x24')](respondWithResult(_0x45abbe,null))[_0xffe7('0x43')](handleError(_0x45abbe,null));};exports[_0xffe7('0x44')]=function(_0x4d0fac,_0x394525){return db[_0xffe7('0x28')][_0xffe7('0x44')](_0x4d0fac[_0xffe7('0x45')],{})['then'](respondWithResult(_0x394525,0xc9))[_0xffe7('0x43')](handleError(_0x394525,null));};exports[_0xffe7('0x46')]=function(_0x278e08,_0x35efec){if(_0x278e08[_0xffe7('0x45')]['id']){delete _0x278e08[_0xffe7('0x45')]['id'];}return db[_0xffe7('0x28')]['find']({'where':{'id':_0x278e08[_0xffe7('0x40')]['id']}})[_0xffe7('0x24')](handleEntityNotFound(_0x35efec,null))[_0xffe7('0x24')](saveUpdates(_0x278e08[_0xffe7('0x45')],null))[_0xffe7('0x24')](respondWithResult(_0x35efec,null))[_0xffe7('0x43')](handleError(_0x35efec,null));};exports[_0xffe7('0x23')]=function(_0x3b453b,_0x130e45){return db[_0xffe7('0x28')][_0xffe7('0x42')]({'where':{'id':_0x3b453b[_0xffe7('0x40')]['id']}})['then'](handleEntityNotFound(_0x130e45,null))[_0xffe7('0x24')](removeEntity(_0x130e45,null))['catch'](handleError(_0x130e45,null));};exports[_0xffe7('0x47')]=function(_0x2aef10,_0x10c87e){return db[_0xffe7('0x28')][_0xffe7('0x47')]()[_0xffe7('0x24')](respondWithResult(_0x10c87e,null))[_0xffe7('0x43')](handleError(_0x10c87e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 013f25d..bcf18c4 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 _0xfe24=['lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid'];(function(_0x422baa,_0x98d34a){var _0x31c810=function(_0xa554fe){while(--_0xa554fe){_0x422baa['push'](_0x422baa['shift']());}};_0x31c810(++_0x98d34a);}(_0xfe24,0x145));var _0x4fe2=function(_0x1986d6,_0x325bbf){_0x1986d6=_0x1986d6-0x0;var _0x51ba3c=_0xfe24[_0x1986d6];return _0x51ba3c;};'use strict';var _=require(_0x4fe2('0x0'));var util=require('util');var logger=require(_0x4fe2('0x1'))(_0x4fe2('0x2'));var moment=require('moment');var BPromise=require(_0x4fe2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fe2('0x4'));var rimraf=require(_0x4fe2('0x5'));var config=require(_0x4fe2('0x6'));var attributes=require(_0x4fe2('0x7'));module[_0x4fe2('0x8')]=function(_0x5ea0ae,_0x19f9fc){return _0x5ea0ae[_0x4fe2('0x9')](_0x4fe2('0xa'),attributes,{'tableName':_0x4fe2('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4fe2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60a5=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','uniqueid'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x60a5,0xcc));var _0x560a=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x60a5[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require('lodash');var util=require(_0x560a('0x0'));var logger=require(_0x560a('0x1'))(_0x560a('0x2'));var moment=require(_0x560a('0x3'));var BPromise=require(_0x560a('0x4'));var rp=require(_0x560a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x560a('0x6'));var config=require(_0x560a('0x7'));var attributes=require(_0x560a('0x8'));module['exports']=function(_0x4ae37e,_0x2bcab2){return _0x4ae37e[_0x560a('0x9')](_0x560a('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x560a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 6c955bc..0edf29d 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 _0xcb36=['options','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateVoiceDialReport','create','body','raw','debug','VoiceDialReport'];(function(_0x3d9740,_0x32dd79){var _0x58b687=function(_0x366584){while(--_0x366584){_0x3d9740['push'](_0x3d9740['shift']());}};_0x58b687(++_0x32dd79);}(_0xcb36,0x126));var _0x6cb3=function(_0x2aaebe,_0x7b241f){_0x2aaebe=_0x2aaebe-0x0;var _0x50c5ab=_0xcb36[_0x2aaebe];return _0x50c5ab;};'use strict';var _=require(_0x6cb3('0x0'));var util=require(_0x6cb3('0x1'));var moment=require(_0x6cb3('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6cb3('0x4'));var logger=require(_0x6cb3('0x5'))(_0x6cb3('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cb3('0x7'));var client=jayson[_0x6cb3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f6803,_0x9cce96,_0x5606fc){return new BPromise(function(_0x1fa4b9,_0x56ccc0){return client[_0x6cb3('0x9')](_0x4f6803,_0x5606fc)[_0x6cb3('0xa')](function(_0x5e21ea){logger[_0x6cb3('0xb')](_0x6cb3('0xc'),_0x9cce96,_0x6cb3('0xd'));logger['debug'](_0x6cb3('0xe'),_0x9cce96,_0x6cb3('0xd'),JSON[_0x6cb3('0xf')](_0x5e21ea));if(_0x5e21ea[_0x6cb3('0x10')]){if(_0x5e21ea['error']['code']===0x1f4){logger[_0x6cb3('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x9cce96,_0x5e21ea[_0x6cb3('0x10')][_0x6cb3('0x11')]);return _0x56ccc0(_0x5e21ea[_0x6cb3('0x10')][_0x6cb3('0x11')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x9cce96,_0x5e21ea[_0x6cb3('0x10')][_0x6cb3('0x11')]);return _0x1fa4b9(_0x5e21ea[_0x6cb3('0x10')][_0x6cb3('0x11')]);}else{logger[_0x6cb3('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x9cce96,_0x6cb3('0xd'));_0x1fa4b9(_0x5e21ea['result']['message']);}})[_0x6cb3('0x12')](function(_0x3539b5){logger[_0x6cb3('0x10')](_0x6cb3('0xc'),_0x9cce96,_0x3539b5);_0x56ccc0(_0x3539b5);});});}exports[_0x6cb3('0x13')]=function(_0x1bff16){var _0x572513=this;return new Promise(function(_0x4d05b6,_0x5bcc53){return db['VoiceDialReport'][_0x6cb3('0x14')](_0x1bff16[_0x6cb3('0x15')],{'raw':_0x1bff16['options']?_0x1bff16['options'][_0x6cb3('0x16')]===undefined?!![]:![]:!![]})[_0x6cb3('0xa')](function(_0x50870d){logger[_0x6cb3('0xb')](_0x6cb3('0x13'),_0x1bff16);logger[_0x6cb3('0x17')](_0x6cb3('0x13'),_0x1bff16,JSON[_0x6cb3('0xf')](_0x50870d));_0x4d05b6(_0x50870d);})[_0x6cb3('0x12')](function(_0x44c799){logger[_0x6cb3('0x10')](_0x6cb3('0x13'),_0x44c799[_0x6cb3('0x11')],_0x1bff16);_0x5bcc53(_0x572513[_0x6cb3('0x10')](0x1f4,_0x44c799[_0x6cb3('0x11')]));});});};exports['UpdateVoiceDialReport']=function(_0x1855b5){var _0x5e537d=this;return new Promise(function(_0x5009ba,_0x310dca){return db[_0x6cb3('0x18')]['update'](_0x1855b5['body'],{'raw':_0x1855b5[_0x6cb3('0x19')]?_0x1855b5[_0x6cb3('0x19')][_0x6cb3('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1855b5[_0x6cb3('0x19')]?_0x1855b5[_0x6cb3('0x19')]['where']||null:null,'attributes':_0x1855b5[_0x6cb3('0x19')]?_0x1855b5[_0x6cb3('0x19')][_0x6cb3('0x1a')]||null:null,'limit':_0x1855b5['options']?_0x1855b5[_0x6cb3('0x19')][_0x6cb3('0x1b')]||null:null})[_0x6cb3('0xa')](function(_0x4ef413){logger['info'](_0x6cb3('0x1c'),_0x1855b5);logger[_0x6cb3('0x17')](_0x6cb3('0x1c'),_0x1855b5,JSON['stringify'](_0x4ef413));_0x5009ba(_0x4ef413);})[_0x6cb3('0x12')](function(_0x1f9ed9){logger[_0x6cb3('0x10')](_0x6cb3('0x1c'),_0x1f9ed9['message'],_0x1855b5);_0x310dca(_0x5e537d['error'](0x1f4,_0x1f9ed9[_0x6cb3('0x11')]));});});}; \ No newline at end of file +var _0x570c=['body','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','UpdateVoiceDialReport','update'];(function(_0x1652bf,_0x3986c8){var _0x1f87b0=function(_0x5a1916){while(--_0x5a1916){_0x1652bf['push'](_0x1652bf['shift']());}};_0x1f87b0(++_0x3986c8);}(_0x570c,0x12c));var _0xc570=function(_0x3aa364,_0x1fc284){_0x3aa364=_0x3aa364-0x0;var _0x4f5b5f=_0x570c[_0x3aa364];return _0x4f5b5f;};'use strict';var _=require(_0xc570('0x0'));var util=require(_0xc570('0x1'));var moment=require('moment');var BPromise=require(_0xc570('0x2'));var rs=require(_0xc570('0x3'));var fs=require('fs');var Redis=require(_0xc570('0x4'));var db=require(_0xc570('0x5'))['db'];var utils=require(_0xc570('0x6'));var logger=require(_0xc570('0x7'))('rpc');var config=require(_0xc570('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc570('0x9')][_0xc570('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1de159,_0x2a82f2,_0xbf7ae6){return new BPromise(function(_0x5b26bb,_0xac2897){return client[_0xc570('0xb')](_0x1de159,_0xbf7ae6)[_0xc570('0xc')](function(_0x3e5b17){logger[_0xc570('0xd')](_0xc570('0xe'),_0x2a82f2,_0xc570('0xf'));logger[_0xc570('0x10')](_0xc570('0x11'),_0x2a82f2,_0xc570('0xf'),JSON[_0xc570('0x12')](_0x3e5b17));if(_0x3e5b17[_0xc570('0x13')]){if(_0x3e5b17[_0xc570('0x13')]['code']===0x1f4){logger[_0xc570('0x13')](_0xc570('0xe'),_0x2a82f2,_0x3e5b17['error']['message']);return _0xac2897(_0x3e5b17['error'][_0xc570('0x14')]);}logger['error'](_0xc570('0xe'),_0x2a82f2,_0x3e5b17['error'][_0xc570('0x14')]);return _0x5b26bb(_0x3e5b17[_0xc570('0x13')][_0xc570('0x14')]);}else{logger[_0xc570('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x2a82f2,_0xc570('0xf'));_0x5b26bb(_0x3e5b17[_0xc570('0x15')][_0xc570('0x14')]);}})[_0xc570('0x16')](function(_0x46d9c3){logger[_0xc570('0x13')](_0xc570('0xe'),_0x2a82f2,_0x46d9c3);_0xac2897(_0x46d9c3);});});}exports[_0xc570('0x17')]=function(_0x5ad004){var _0x46e968=this;return new Promise(function(_0x18b47f,_0x2dfda2){return db[_0xc570('0x18')][_0xc570('0x19')](_0x5ad004['body'],{'raw':_0x5ad004[_0xc570('0x1a')]?_0x5ad004[_0xc570('0x1a')][_0xc570('0x1b')]===undefined?!![]:![]:!![]})[_0xc570('0xc')](function(_0x662502){logger['info'](_0xc570('0x17'),_0x5ad004);logger[_0xc570('0x10')]('CreateVoiceDialReport',_0x5ad004,JSON['stringify'](_0x662502));_0x18b47f(_0x662502);})[_0xc570('0x16')](function(_0x123679){logger['error'](_0xc570('0x17'),_0x123679[_0xc570('0x14')],_0x5ad004);_0x2dfda2(_0x46e968[_0xc570('0x13')](0x1f4,_0x123679[_0xc570('0x14')]));});});};exports[_0xc570('0x1c')]=function(_0xf62dff){var _0x534aed=this;return new Promise(function(_0x17ae56,_0x3c8407){return db[_0xc570('0x18')][_0xc570('0x1d')](_0xf62dff[_0xc570('0x1e')],{'raw':_0xf62dff[_0xc570('0x1a')]?_0xf62dff[_0xc570('0x1a')][_0xc570('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf62dff['options']?_0xf62dff[_0xc570('0x1a')][_0xc570('0x1f')]||null:null,'attributes':_0xf62dff[_0xc570('0x1a')]?_0xf62dff[_0xc570('0x1a')]['attributes']||null:null,'limit':_0xf62dff[_0xc570('0x1a')]?_0xf62dff[_0xc570('0x1a')][_0xc570('0x20')]||null:null})['then'](function(_0x1129fa){logger[_0xc570('0xd')](_0xc570('0x1c'),_0xf62dff);logger['debug'](_0xc570('0x1c'),_0xf62dff,JSON['stringify'](_0x1129fa));_0x17ae56(_0x1129fa);})[_0xc570('0x16')](function(_0x20928b){logger[_0xc570('0x13')](_0xc570('0x1c'),_0x20928b[_0xc570('0x14')],_0xf62dff);_0x3c8407(_0x534aed[_0xc570('0x13')](0x1f4,_0x20928b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f4b8d0c..19d20cd 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 _0xa0c8=['addApplications','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','/:id/applications'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xa0c8,0xf2));var _0x8a0c=function(_0x3fbb91,_0x5ec106){_0x3fbb91=_0x3fbb91-0x0;var _0x3eb213=_0xa0c8[_0x3fbb91];return _0x3eb213;};'use strict';var multer=require(_0x8a0c('0x0'));var util=require(_0x8a0c('0x1'));var path=require('path');var timeout=require(_0x8a0c('0x2'));var express=require(_0x8a0c('0x3'));var router=express[_0x8a0c('0x4')]();var auth=require(_0x8a0c('0x5'));var interaction=require(_0x8a0c('0x6'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x8a0c('0x7')](),controller[_0x8a0c('0x8')]);router[_0x8a0c('0x9')](_0x8a0c('0xa'),auth[_0x8a0c('0x7')](),controller[_0x8a0c('0xb')]);router['post']('/',auth[_0x8a0c('0x7')](),controller['create']);router[_0x8a0c('0xc')](_0x8a0c('0xd'),auth[_0x8a0c('0x7')](),controller[_0x8a0c('0xe')]);router['put'](_0x8a0c('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8a0c('0x7')](),controller[_0x8a0c('0xf')]);module['exports']=router; \ No newline at end of file +var _0x593b=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','/:id/applications','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0x593b,0xba));var _0xb593=function(_0x150e66,_0x21eaf6){_0x150e66=_0x150e66-0x0;var _0x2d92c3=_0x593b[_0x150e66];return _0x2d92c3;};'use strict';var multer=require(_0xb593('0x0'));var util=require(_0xb593('0x1'));var path=require(_0xb593('0x2'));var timeout=require(_0xb593('0x3'));var express=require(_0xb593('0x4'));var router=express['Router']();var auth=require(_0xb593('0x5'));var interaction=require(_0xb593('0x6'));var config=require(_0xb593('0x7'));var controller=require('./voiceExtension.controller');router[_0xb593('0x8')]('/',auth[_0xb593('0x9')](),controller['index']);router[_0xb593('0x8')](_0xb593('0xa'),auth['isAuthenticated'](),controller[_0xb593('0xb')]);router[_0xb593('0xc')]('/',auth[_0xb593('0x9')](),controller[_0xb593('0xd')]);router[_0xb593('0xc')](_0xb593('0xe'),auth[_0xb593('0x9')](),controller['addApplications']);router[_0xb593('0xf')]('/:id',auth[_0xb593('0x9')](),controller[_0xb593('0x10')]);router['delete'](_0xb593('0xa'),auth['isAuthenticated'](),controller[_0xb593('0x11')]);module[_0xb593('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index bdfea73..105e060 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(_0x1b5c63,_0x5a08b2){var _0x25753e=function(_0x45a839){while(--_0x45a839){_0x1b5c63['push'](_0x1b5c63['shift']());}};_0x25753e(++_0x5a08b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x28713a,_0x1918d0){var _0x181c84=function(_0x27badd){while(--_0x27badd){_0x28713a['push'](_0x28713a['shift']());}};_0x181c84(++_0x1918d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 5b1f957..c1774b4 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 _0x283a=['InboundRoutes','OutboundRoutes','outbound','internal','filter','ignore','map','value','type','name','UserProfileResource','sendStatus','error','stack','send','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','where','merge','VIRTUAL','options','VoiceExtension','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','VoiceExtensionId','findAndCountAll','html-pdf','eml-format','zip-dir','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','count','offset','set','reject','save','update','then','destroy','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x283a,0x168));var _0xa283=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0x283a[_0x2bf888];return _0x3038d6;};'use strict';var pdf=require(_0xa283('0x0'));var emlformat=require(_0xa283('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa283('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa283('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa283('0x4'));var util=require(_0xa283('0x5'));var path=require(_0xa283('0x6'));var sox=require('sox');var csv=require(_0xa283('0x7'));var ejs=require(_0xa283('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa283('0x9'));var crypto=require(_0xa283('0xa'));var jsforce=require(_0xa283('0xb'));var deskjs=require(_0xa283('0xc'));var toCsv=require(_0xa283('0x7'));var querystring=require(_0xa283('0xd'));var Papa=require('papaparse');var Redis=require(_0xa283('0xe'));var authService=require(_0xa283('0xf'));var qs=require(_0xa283('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa283('0x11'));var logger=require(_0xa283('0x12'))(_0xa283('0x13'));var utils=require('../../config/utils');var config=require(_0xa283('0x14'));var licenseUtil=require(_0xa283('0x15'));var db=require(_0xa283('0x16'))['db'];config[_0xa283('0x17')]=_[_0xa283('0x18')](config['redis'],{'host':_0xa283('0x19'),'port':0x18eb});var socket=require(_0xa283('0x1a'))(new Redis(config[_0xa283('0x17')]));require('./voiceExtension.socket')[_0xa283('0x1b')](socket);function respondWithStatusCode(_0x51150c,_0x5cc910){_0x5cc910=_0x5cc910||0xcc;return function(_0xf5ff4c){if(_0xf5ff4c){return _0x51150c['sendStatus'](_0x5cc910);}return _0x51150c[_0xa283('0x1c')](_0x5cc910)[_0xa283('0x1d')]();};}function respondWithResult(_0x53154e,_0x42140f){_0x42140f=_0x42140f||0xc8;return function(_0x73dbe5){if(_0x73dbe5){return _0x53154e[_0xa283('0x1c')](_0x42140f)[_0xa283('0x1e')](_0x73dbe5);}};}function respondWithFilteredResult(_0x4ef539,_0xb54080){return function(_0x1e4c6a){if(_0x1e4c6a){var _0x8685f=_0x1e4c6a[_0xa283('0x1f')],_0x1d3ab7=_0xb54080[_0xa283('0x20')],_0x9cc0f3=_0xb54080[_0xa283('0x20')]+_0xb54080['limit'],_0x4fa55d;if(_0x9cc0f3>=_0x8685f){_0x9cc0f3=_0x8685f;_0x4fa55d=0xc8;}else{_0x4fa55d=0xce;}_0x4ef539[_0xa283('0x1c')](_0x4fa55d);return _0x4ef539[_0xa283('0x21')]('Content-Range',_0x1d3ab7+'-'+_0x9cc0f3+'/'+_0x8685f)['json'](_0x1e4c6a);}return null;};}function patchUpdates(_0x459188){return function(_0x4c6775){try{jsonpatch['apply'](_0x4c6775,_0x459188,!![]);}catch(_0x4dc653){return BPromise[_0xa283('0x22')](_0x4dc653);}return _0x4c6775[_0xa283('0x23')]();};}function saveUpdates(_0x461a38,_0x762e98){return function(_0x413578){if(_0x413578){return _0x413578[_0xa283('0x24')](_0x461a38)[_0xa283('0x25')](function(_0x2f37a8){return _0x2f37a8;});}return null;};}function removeEntity(_0x8cde70,_0x2a6567){return function(_0x42e0ae){if(_0x42e0ae){return _0x42e0ae[_0xa283('0x26')]()['then'](function(){var _0x5f41d0=_0x42e0ae[_0xa283('0x27')]({'plain':!![]});var _0x5e826a=[{'name':_0xa283('0x28'),'value':'inbound','ignore':![]},{'name':_0xa283('0x29'),'value':_0xa283('0x2a'),'ignore':![]},{'name':'InternalRoutes','value':_0xa283('0x2b'),'ignore':![]}];var _0x515889=_(_0x5e826a)[_0xa283('0x2c')](_0xa283('0x2d'))[_0xa283('0x2e')]('value')[_0xa283('0x2f')]();if(_['includes'](_0x515889,_0x5f41d0[_0xa283('0x30')])){return;}var _0x36c94c=_['find'](_0x5e826a,['value',_0x5f41d0[_0xa283('0x30')]])[_0xa283('0x31')];return db[_0xa283('0x32')][_0xa283('0x26')]({'where':{'type':_0x36c94c,'resourceId':_0x5f41d0['id']}})[_0xa283('0x25')](function(){return _0x42e0ae;});})[_0xa283('0x25')](function(){_0x8cde70[_0xa283('0x1c')](0xcc)[_0xa283('0x1d')]();});}};}function handleEntityNotFound(_0x3bd74c,_0x215105){return function(_0x18ffe1){if(!_0x18ffe1){_0x3bd74c[_0xa283('0x33')](0x194);}return _0x18ffe1;};}function handleError(_0x4f68fd,_0x3c53f9){_0x3c53f9=_0x3c53f9||0x1f4;return function(_0x21dace){logger[_0xa283('0x34')](_0x21dace[_0xa283('0x35')]);if(_0x21dace[_0xa283('0x31')]){delete _0x21dace[_0xa283('0x31')];}_0x4f68fd['status'](_0x3c53f9)[_0xa283('0x36')](_0x21dace);};}exports['index']=function(_0xb679ab,_0x2f343f){var _0x10d0f0={},_0x5bd797={},_0x5c4182={'count':0x0,'rows':[]};var _0x44342e=_[_0xa283('0x2e')](db['VoiceExtension']['rawAttributes'],function(_0x2444e6){return{'name':_0x2444e6['fieldName'],'type':_0x2444e6[_0xa283('0x30')]['key']};});_0x5bd797[_0xa283('0x37')]=_[_0xa283('0x2e')](_0x44342e,_0xa283('0x31'));_0x5bd797['query']=_['keys'](_0xb679ab[_0xa283('0x38')]);_0x5bd797['filters']=_[_0xa283('0x39')](_0x5bd797[_0xa283('0x37')],_0x5bd797['query']);_0x10d0f0[_0xa283('0x3a')]=_[_0xa283('0x39')](_0x5bd797[_0xa283('0x37')],qs['fields'](_0xb679ab[_0xa283('0x38')][_0xa283('0x3b')]));_0x10d0f0[_0xa283('0x3a')]=_0x10d0f0[_0xa283('0x3a')][_0xa283('0x3c')]?_0x10d0f0[_0xa283('0x3a')]:_0x5bd797[_0xa283('0x37')];if(!_0xb679ab[_0xa283('0x38')][_0xa283('0x3d')]('nolimit')){_0x10d0f0[_0xa283('0x3e')]=qs['limit'](_0xb679ab[_0xa283('0x38')][_0xa283('0x3e')]);_0x10d0f0[_0xa283('0x20')]=qs[_0xa283('0x20')](_0xb679ab['query'][_0xa283('0x20')]);}_0x10d0f0[_0xa283('0x3f')]=qs['sort'](_0xb679ab[_0xa283('0x38')][_0xa283('0x40')]);_0x10d0f0['where']=qs[_0xa283('0x41')](_['pick'](_0xb679ab[_0xa283('0x38')],_0x5bd797['filters']),_0x44342e);if(_0xb679ab[_0xa283('0x38')]['filter']){_0x10d0f0[_0xa283('0x42')]=_[_0xa283('0x43')](_0x10d0f0['where'],{'$or':_[_0xa283('0x2e')](_0x44342e,function(_0x131d9e){if(_0x131d9e['type']!==_0xa283('0x44')){var _0x435fc5={};_0x435fc5[_0x131d9e[_0xa283('0x31')]]={'$like':'%'+_0xb679ab[_0xa283('0x38')]['filter']+'%'};return _0x435fc5;}})});}_0x10d0f0=_['merge']({},_0x10d0f0,_0xb679ab[_0xa283('0x45')]);var _0x43071c={'where':_0x10d0f0[_0xa283('0x42')]};return db[_0xa283('0x46')][_0xa283('0x1f')](_0x43071c)[_0xa283('0x25')](function(_0x5234fb){_0x5c4182[_0xa283('0x1f')]=_0x5234fb;if(_0xb679ab[_0xa283('0x38')]['includeAll']){_0x10d0f0[_0xa283('0x47')]=[{'all':!![]}];}return db['VoiceExtension'][_0xa283('0x48')](_0x10d0f0);})[_0xa283('0x25')](function(_0x95c63b){_0x5c4182[_0xa283('0x49')]=_0x95c63b;return _0x5c4182;})[_0xa283('0x25')](respondWithFilteredResult(_0x2f343f,_0x10d0f0))[_0xa283('0x4a')](handleError(_0x2f343f,null));};exports[_0xa283('0x4b')]=function(_0x18e5de,_0x2975e4){var _0x51de34={'raw':![],'where':{'id':_0x18e5de[_0xa283('0x4c')]['id']}},_0x363aa0={};_0x363aa0['model']=_['keys'](db[_0xa283('0x46')][_0xa283('0x4d')]);_0x363aa0['query']=_['keys'](_0x18e5de[_0xa283('0x38')]);_0x363aa0['filters']=_[_0xa283('0x39')](_0x363aa0[_0xa283('0x37')],_0x363aa0[_0xa283('0x38')]);_0x51de34[_0xa283('0x3a')]=_[_0xa283('0x39')](_0x363aa0['model'],qs['fields'](_0x18e5de[_0xa283('0x38')][_0xa283('0x3b')]));_0x51de34[_0xa283('0x3a')]=_0x51de34['attributes'][_0xa283('0x3c')]?_0x51de34[_0xa283('0x3a')]:_0x363aa0[_0xa283('0x37')];if(_0x18e5de[_0xa283('0x38')][_0xa283('0x4e')]){_0x51de34[_0xa283('0x47')]=[{'all':!![]}];}_0x51de34=_[_0xa283('0x43')]({},_0x51de34,_0x18e5de['options']);return db[_0xa283('0x46')]['find'](_0x51de34)[_0xa283('0x25')](handleEntityNotFound(_0x2975e4,null))[_0xa283('0x25')](respondWithResult(_0x2975e4,null))[_0xa283('0x4a')](handleError(_0x2975e4,null));};exports[_0xa283('0x26')]=function(_0x2334fd,_0x34d7d5){return db['VoiceExtension']['find']({'where':{'id':_0x2334fd[_0xa283('0x4c')]['id']}})['then'](handleEntityNotFound(_0x34d7d5,null))['then'](removeEntity(_0x34d7d5,null))[_0xa283('0x4a')](handleError(_0x34d7d5,null));};exports[_0xa283('0x4f')]=function(_0x1ab106,_0xa25bfe){if(_0x1ab106[_0xa283('0x50')][_0xa283('0x30')]===_0xa283('0x2a')&&!_[_0xa283('0x51')](_0x1ab106['body'][_0xa283('0x52')],'_')){_0x1ab106[_0xa283('0x50')]['exten']='_'[_0xa283('0x53')](_0x1ab106[_0xa283('0x50')]['exten']);}return db['VoiceExtension']['create'](_0x1ab106[_0xa283('0x50')],{'raw':![]})['then'](function(_0x4eda32){var _0x58778f=_0x1ab106['user'][_0xa283('0x27')]({'plain':!![]});if(!_0x58778f)throw new Error(_0xa283('0x54'));if(_0x58778f[_0xa283('0x55')]==='user'){var _0x288b69=_0x4eda32[_0xa283('0x27')]({'plain':!![]});var _0x12a31b=[{'name':_0xa283('0x28'),'value':'inbound'},{'name':_0xa283('0x29'),'value':_0xa283('0x2a')},{'name':'InternalRoutes','value':_0xa283('0x2b')}];var _0x29a331=_[_0xa283('0x56')](_0x12a31b,[_0xa283('0x2f'),_0x288b69[_0xa283('0x30')]])[_0xa283('0x31')];return db[_0xa283('0x57')][_0xa283('0x56')]({'where':{'name':_0x29a331,'userProfileId':_0x58778f['userProfileId']},'raw':!![]})['then'](function(_0x3232d1){if(_0x3232d1&&_0x3232d1[_0xa283('0x58')]===0x0){return db[_0xa283('0x32')][_0xa283('0x4f')]({'name':_0x288b69['name'],'resourceId':_0x288b69['id'],'type':_0x3232d1['name'],'sectionId':_0x3232d1['id']},{})[_0xa283('0x25')](function(){return _0x4eda32;});}else{return _0x4eda32;}})[_0xa283('0x4a')](function(_0xfc3141){logger[_0xa283('0x34')](_0xa283('0x59'),_0xfc3141);throw _0xfc3141;});}return _0x4eda32;})[_0xa283('0x25')](respondWithResult(_0xa25bfe,0xc9))[_0xa283('0x4a')](handleError(_0xa25bfe,null));};exports[_0xa283('0x24')]=function(_0x5965a2,_0x211140){if(_0x5965a2['body']['id']){delete _0x5965a2[_0xa283('0x50')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x5965a2[_0xa283('0x4c')]['id']}})[_0xa283('0x25')](handleEntityNotFound(_0x211140,null))['then'](function(_0x3a16f1){if(_0x3a16f1){return db[_0xa283('0x46')][_0xa283('0x24')](_[_0xa283('0x5a')](_0x5965a2[_0xa283('0x50')],[_0xa283('0x52'),_0xa283('0x5b'),_0xa283('0x5c'),_0xa283('0x5d'),_0xa283('0x5e'),_0xa283('0x5f')]),{'where':{'context':_0x3a16f1[_0xa283('0x5b')],'exten':_0x3a16f1['exten']},'individualHooks':!![]})[_0xa283('0x25')](function(_0x449b68){return _0x449b68;});}return null;})['then'](respondWithStatusCode(_0x211140,null))[_0xa283('0x4a')](handleError(_0x211140,null));};exports[_0xa283('0x60')]=function(_0x4cd126,_0xf490a4,_0x32f912){return db[_0xa283('0x46')]['findOne']({'where':{'id':_0x4cd126[_0xa283('0x4c')]['id']}})['then'](handleEntityNotFound(_0xf490a4,null))['then'](function(_0xb8c1f6){if(_0xb8c1f6){return db[_0xa283('0x61')]['transaction'](function(_0x536c9d){return db[_0xa283('0x46')][_0xa283('0x26')]({'where':{'VoiceExtensionId':_0x4cd126[_0xa283('0x4c')]['id']},'transaction':_0x536c9d})['then'](function(_0x31d079){var _0x13e8da=_['map'](_0x4cd126[_0xa283('0x50')],function(_0x1eb625){_0x1eb625[_0xa283('0x62')]=_0x4cd126[_0xa283('0x4c')]['id'];return _0x1eb625;});return db[_0xa283('0x46')]['bulkCreate'](_0x13e8da,{'transaction':_0x536c9d});});})[_0xa283('0x25')](function(){return db[_0xa283('0x46')][_0xa283('0x63')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4cd126[_0xa283('0x4c')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xa283('0x25')](respondWithResult(_0xf490a4,null))['catch'](handleError(_0xf490a4,null));}; \ No newline at end of file +var _0x8ca4=['InboundRoutes','inbound','OutboundRoutes','InternalRoutes','filter','ignore','map','value','find','type','name','UserProfileResource','sendStatus','stack','send','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','count','include','findAll','rows','catch','show','params','includeAll','create','body','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','internal','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','end','status','json','offset','set','Content-Range','reject','save','then','destroy'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8ca4,0x192));var _0x48ca=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x8ca4[_0x30bd4d];return _0x306915;};'use strict';var pdf=require(_0x48ca('0x0'));var emlformat=require(_0x48ca('0x1'));var rimraf=require(_0x48ca('0x2'));var zipdir=require(_0x48ca('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x48ca('0x4'));var BPromise=require(_0x48ca('0x5'));var Mustache=require('mustache');var util=require(_0x48ca('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x48ca('0x7'));var ejs=require(_0x48ca('0x8'));var fs=require('fs');var _=require(_0x48ca('0x9'));var squel=require(_0x48ca('0xa'));var crypto=require(_0x48ca('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x48ca('0xc'));var toCsv=require(_0x48ca('0x7'));var querystring=require(_0x48ca('0xd'));var Papa=require(_0x48ca('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x48ca('0xf'));var as=require(_0x48ca('0x10'));var hardwareService=require(_0x48ca('0x11'));var logger=require(_0x48ca('0x12'))(_0x48ca('0x13'));var utils=require(_0x48ca('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x48ca('0x15'));var db=require(_0x48ca('0x16'))['db'];config[_0x48ca('0x17')]=_[_0x48ca('0x18')](config[_0x48ca('0x17')],{'host':_0x48ca('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x48ca('0x17')]));require(_0x48ca('0x1a'))[_0x48ca('0x1b')](socket);function respondWithStatusCode(_0x172ef0,_0x3352f5){_0x3352f5=_0x3352f5||0xcc;return function(_0xb8c781){if(_0xb8c781){return _0x172ef0['sendStatus'](_0x3352f5);}return _0x172ef0['status'](_0x3352f5)[_0x48ca('0x1c')]();};}function respondWithResult(_0x3339fa,_0x4ee6ef){_0x4ee6ef=_0x4ee6ef||0xc8;return function(_0x53b302){if(_0x53b302){return _0x3339fa[_0x48ca('0x1d')](_0x4ee6ef)[_0x48ca('0x1e')](_0x53b302);}};}function respondWithFilteredResult(_0x21d658,_0x2060a1){return function(_0x5a51b1){if(_0x5a51b1){var _0x112fdc=_0x5a51b1['count'],_0x877bd5=_0x2060a1[_0x48ca('0x1f')],_0x428734=_0x2060a1[_0x48ca('0x1f')]+_0x2060a1['limit'],_0x5f36ad;if(_0x428734>=_0x112fdc){_0x428734=_0x112fdc;_0x5f36ad=0xc8;}else{_0x5f36ad=0xce;}_0x21d658[_0x48ca('0x1d')](_0x5f36ad);return _0x21d658[_0x48ca('0x20')](_0x48ca('0x21'),_0x877bd5+'-'+_0x428734+'/'+_0x112fdc)['json'](_0x5a51b1);}return null;};}function patchUpdates(_0x131785){return function(_0x282276){try{jsonpatch['apply'](_0x282276,_0x131785,!![]);}catch(_0x1b8134){return BPromise[_0x48ca('0x22')](_0x1b8134);}return _0x282276[_0x48ca('0x23')]();};}function saveUpdates(_0x3ca971,_0x911343){return function(_0x1b1a84){if(_0x1b1a84){return _0x1b1a84['update'](_0x3ca971)[_0x48ca('0x24')](function(_0x1921ea){return _0x1921ea;});}return null;};}function removeEntity(_0xffe0f8,_0x415937){return function(_0x5edaa9){if(_0x5edaa9){return _0x5edaa9[_0x48ca('0x25')]()['then'](function(){var _0x1bf7cc=_0x5edaa9['get']({'plain':!![]});var _0x18b282=[{'name':_0x48ca('0x26'),'value':_0x48ca('0x27'),'ignore':![]},{'name':_0x48ca('0x28'),'value':'outbound','ignore':![]},{'name':_0x48ca('0x29'),'value':'internal','ignore':![]}];var _0x3c1922=_(_0x18b282)[_0x48ca('0x2a')](_0x48ca('0x2b'))[_0x48ca('0x2c')](_0x48ca('0x2d'))[_0x48ca('0x2d')]();if(_['includes'](_0x3c1922,_0x1bf7cc['type'])){return;}var _0x211e85=_[_0x48ca('0x2e')](_0x18b282,['value',_0x1bf7cc[_0x48ca('0x2f')]])[_0x48ca('0x30')];return db[_0x48ca('0x31')]['destroy']({'where':{'type':_0x211e85,'resourceId':_0x1bf7cc['id']}})['then'](function(){return _0x5edaa9;});})[_0x48ca('0x24')](function(){_0xffe0f8[_0x48ca('0x1d')](0xcc)[_0x48ca('0x1c')]();});}};}function handleEntityNotFound(_0x8dfaef,_0x3effc5){return function(_0x4a06bf){if(!_0x4a06bf){_0x8dfaef[_0x48ca('0x32')](0x194);}return _0x4a06bf;};}function handleError(_0x50afff,_0x2efef9){_0x2efef9=_0x2efef9||0x1f4;return function(_0x40f5f1){logger['error'](_0x40f5f1[_0x48ca('0x33')]);if(_0x40f5f1[_0x48ca('0x30')]){delete _0x40f5f1[_0x48ca('0x30')];}_0x50afff['status'](_0x2efef9)[_0x48ca('0x34')](_0x40f5f1);};}exports['index']=function(_0x59bfe6,_0x345ee0){var _0x45ca84={},_0x53dc53={},_0x3c1641={'count':0x0,'rows':[]};var _0x5e89f8=_['map'](db['VoiceExtension'][_0x48ca('0x35')],function(_0x59937d){return{'name':_0x59937d[_0x48ca('0x36')],'type':_0x59937d[_0x48ca('0x2f')][_0x48ca('0x37')]};});_0x53dc53[_0x48ca('0x38')]=_[_0x48ca('0x2c')](_0x5e89f8,'name');_0x53dc53[_0x48ca('0x39')]=_[_0x48ca('0x3a')](_0x59bfe6[_0x48ca('0x39')]);_0x53dc53[_0x48ca('0x3b')]=_[_0x48ca('0x3c')](_0x53dc53[_0x48ca('0x38')],_0x53dc53['query']);_0x45ca84[_0x48ca('0x3d')]=_[_0x48ca('0x3c')](_0x53dc53[_0x48ca('0x38')],qs['fields'](_0x59bfe6[_0x48ca('0x39')][_0x48ca('0x3e')]));_0x45ca84[_0x48ca('0x3d')]=_0x45ca84['attributes'][_0x48ca('0x3f')]?_0x45ca84[_0x48ca('0x3d')]:_0x53dc53['model'];if(!_0x59bfe6[_0x48ca('0x39')][_0x48ca('0x40')](_0x48ca('0x41'))){_0x45ca84['limit']=qs[_0x48ca('0x42')](_0x59bfe6[_0x48ca('0x39')][_0x48ca('0x42')]);_0x45ca84[_0x48ca('0x1f')]=qs[_0x48ca('0x1f')](_0x59bfe6[_0x48ca('0x39')][_0x48ca('0x1f')]);}_0x45ca84[_0x48ca('0x43')]=qs[_0x48ca('0x44')](_0x59bfe6[_0x48ca('0x39')][_0x48ca('0x44')]);_0x45ca84[_0x48ca('0x45')]=qs[_0x48ca('0x3b')](_[_0x48ca('0x46')](_0x59bfe6[_0x48ca('0x39')],_0x53dc53['filters']),_0x5e89f8);if(_0x59bfe6[_0x48ca('0x39')][_0x48ca('0x2a')]){_0x45ca84[_0x48ca('0x45')]=_[_0x48ca('0x47')](_0x45ca84[_0x48ca('0x45')],{'$or':_[_0x48ca('0x2c')](_0x5e89f8,function(_0x429cb8){if(_0x429cb8['type']!==_0x48ca('0x48')){var _0x529f2a={};_0x529f2a[_0x429cb8[_0x48ca('0x30')]]={'$like':'%'+_0x59bfe6[_0x48ca('0x39')][_0x48ca('0x2a')]+'%'};return _0x529f2a;}})});}_0x45ca84=_[_0x48ca('0x47')]({},_0x45ca84,_0x59bfe6[_0x48ca('0x49')]);var _0x552626={'where':_0x45ca84[_0x48ca('0x45')]};return db[_0x48ca('0x4a')][_0x48ca('0x4b')](_0x552626)[_0x48ca('0x24')](function(_0x412434){_0x3c1641['count']=_0x412434;if(_0x59bfe6[_0x48ca('0x39')]['includeAll']){_0x45ca84[_0x48ca('0x4c')]=[{'all':!![]}];}return db['VoiceExtension'][_0x48ca('0x4d')](_0x45ca84);})[_0x48ca('0x24')](function(_0x2ee676){_0x3c1641[_0x48ca('0x4e')]=_0x2ee676;return _0x3c1641;})[_0x48ca('0x24')](respondWithFilteredResult(_0x345ee0,_0x45ca84))[_0x48ca('0x4f')](handleError(_0x345ee0,null));};exports[_0x48ca('0x50')]=function(_0x144825,_0x333e5c){var _0x5d0590={'raw':![],'where':{'id':_0x144825[_0x48ca('0x51')]['id']}},_0x18481a={};_0x18481a[_0x48ca('0x38')]=_[_0x48ca('0x3a')](db[_0x48ca('0x4a')]['rawAttributes']);_0x18481a[_0x48ca('0x39')]=_[_0x48ca('0x3a')](_0x144825[_0x48ca('0x39')]);_0x18481a[_0x48ca('0x3b')]=_[_0x48ca('0x3c')](_0x18481a[_0x48ca('0x38')],_0x18481a['query']);_0x5d0590['attributes']=_[_0x48ca('0x3c')](_0x18481a[_0x48ca('0x38')],qs[_0x48ca('0x3e')](_0x144825[_0x48ca('0x39')]['fields']));_0x5d0590['attributes']=_0x5d0590[_0x48ca('0x3d')][_0x48ca('0x3f')]?_0x5d0590['attributes']:_0x18481a[_0x48ca('0x38')];if(_0x144825[_0x48ca('0x39')][_0x48ca('0x52')]){_0x5d0590['include']=[{'all':!![]}];}_0x5d0590=_[_0x48ca('0x47')]({},_0x5d0590,_0x144825[_0x48ca('0x49')]);return db[_0x48ca('0x4a')][_0x48ca('0x2e')](_0x5d0590)['then'](handleEntityNotFound(_0x333e5c,null))[_0x48ca('0x24')](respondWithResult(_0x333e5c,null))[_0x48ca('0x4f')](handleError(_0x333e5c,null));};exports[_0x48ca('0x25')]=function(_0x372560,_0x4cdf1c){return db[_0x48ca('0x4a')]['find']({'where':{'id':_0x372560[_0x48ca('0x51')]['id']}})['then'](handleEntityNotFound(_0x4cdf1c,null))[_0x48ca('0x24')](removeEntity(_0x4cdf1c,null))[_0x48ca('0x4f')](handleError(_0x4cdf1c,null));};exports[_0x48ca('0x53')]=function(_0x3bab41,_0x242f79){if(_0x3bab41[_0x48ca('0x54')][_0x48ca('0x2f')]==='outbound'&&!_['startsWith'](_0x3bab41[_0x48ca('0x54')][_0x48ca('0x55')],'_')){_0x3bab41[_0x48ca('0x54')][_0x48ca('0x55')]='_'[_0x48ca('0x56')](_0x3bab41[_0x48ca('0x54')][_0x48ca('0x55')]);}return db[_0x48ca('0x4a')][_0x48ca('0x53')](_0x3bab41['body'],{'raw':![]})[_0x48ca('0x24')](function(_0x577f62){var _0x5ae84d=_0x3bab41[_0x48ca('0x57')][_0x48ca('0x58')]({'plain':!![]});if(!_0x5ae84d)throw new Error(_0x48ca('0x59'));if(_0x5ae84d[_0x48ca('0x5a')]===_0x48ca('0x57')){var _0x4cedf0=_0x577f62[_0x48ca('0x58')]({'plain':!![]});var _0x4c4a6b=[{'name':'InboundRoutes','value':_0x48ca('0x27')},{'name':'OutboundRoutes','value':_0x48ca('0x5b')},{'name':_0x48ca('0x29'),'value':_0x48ca('0x5c')}];var _0x4aed62=_[_0x48ca('0x2e')](_0x4c4a6b,['value',_0x4cedf0[_0x48ca('0x2f')]])[_0x48ca('0x30')];return db[_0x48ca('0x5d')][_0x48ca('0x2e')]({'where':{'name':_0x4aed62,'userProfileId':_0x5ae84d[_0x48ca('0x5e')]},'raw':!![]})[_0x48ca('0x24')](function(_0x439f72){if(_0x439f72&&_0x439f72[_0x48ca('0x5f')]===0x0){return db[_0x48ca('0x31')]['create']({'name':_0x4cedf0['name'],'resourceId':_0x4cedf0['id'],'type':_0x439f72[_0x48ca('0x30')],'sectionId':_0x439f72['id']},{})['then'](function(){return _0x577f62;});}else{return _0x577f62;}})[_0x48ca('0x4f')](function(_0x4fb339){logger[_0x48ca('0x60')](_0x48ca('0x61'),_0x4fb339);throw _0x4fb339;});}return _0x577f62;})[_0x48ca('0x24')](respondWithResult(_0x242f79,0xc9))[_0x48ca('0x4f')](handleError(_0x242f79,null));};exports[_0x48ca('0x62')]=function(_0x4c6af4,_0x27b1f5){if(_0x4c6af4[_0x48ca('0x54')]['id']){delete _0x4c6af4[_0x48ca('0x54')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x4c6af4[_0x48ca('0x51')]['id']}})['then'](handleEntityNotFound(_0x27b1f5,null))['then'](function(_0x5be3b2){if(_0x5be3b2){return db[_0x48ca('0x4a')][_0x48ca('0x62')](_[_0x48ca('0x46')](_0x4c6af4[_0x48ca('0x54')],[_0x48ca('0x55'),_0x48ca('0x63'),_0x48ca('0x64'),'recordingFormat',_0x48ca('0x65'),_0x48ca('0x66')]),{'where':{'context':_0x5be3b2[_0x48ca('0x63')],'exten':_0x5be3b2[_0x48ca('0x55')]},'individualHooks':!![]})[_0x48ca('0x24')](function(_0x57dbd9){return _0x57dbd9;});}return null;})[_0x48ca('0x24')](respondWithStatusCode(_0x27b1f5,null))[_0x48ca('0x4f')](handleError(_0x27b1f5,null));};exports[_0x48ca('0x67')]=function(_0x2ff16a,_0x37e105,_0x3b140d){return db[_0x48ca('0x4a')]['findOne']({'where':{'id':_0x2ff16a[_0x48ca('0x51')]['id']}})[_0x48ca('0x24')](handleEntityNotFound(_0x37e105,null))[_0x48ca('0x24')](function(_0x199af6){if(_0x199af6){return db[_0x48ca('0x68')][_0x48ca('0x69')](function(_0x460fbb){return db[_0x48ca('0x4a')][_0x48ca('0x25')]({'where':{'VoiceExtensionId':_0x2ff16a[_0x48ca('0x51')]['id']},'transaction':_0x460fbb})['then'](function(_0x1e99fe){var _0x5e1180=_[_0x48ca('0x2c')](_0x2ff16a[_0x48ca('0x54')],function(_0x508640){_0x508640[_0x48ca('0x6a')]=_0x2ff16a[_0x48ca('0x51')]['id'];return _0x508640;});return db[_0x48ca('0x4a')][_0x48ca('0x6b')](_0x5e1180,{'transaction':_0x460fbb});});})[_0x48ca('0x24')](function(){return db[_0x48ca('0x4a')][_0x48ca('0x6c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2ff16a['params']['id']},'order':_0x48ca('0x6d')});});}})[_0x48ca('0x24')](respondWithResult(_0x37e105,null))[_0x48ca('0x4f')](handleError(_0x37e105,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 236d72d..ed28597 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 _0x36ee=['VoiceExtension','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xe36e('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe36e('0x1'),'afterUpdate':_0xe36e('0x2'),'afterDestroy':_0xe36e('0x3')};function emitEvent(_0xe3bee0){return function(_0x567a84,_0x1118af,_0x29e692){VoiceExtensionEvents[_0xe36e('0x4')](_0xe3bee0+':'+_0x567a84['id'],_0x567a84);VoiceExtensionEvents[_0xe36e('0x4')](_0xe3bee0,_0x567a84);_0x29e692(null);};}for(var e in events){if(events[_0xe36e('0x5')](e)){var event=events[e];VoiceExtension[_0xe36e('0x6')](e,emitEvent(event));}}module[_0xe36e('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x03fd=['exports','events','../../mysqldb','VoiceExtension','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x03fd,0x83));var _0xd03f=function(_0x37fad1,_0x1c595a){_0x37fad1=_0x37fad1-0x0;var _0x3c74b2=_0x03fd[_0x37fad1];return _0x3c74b2;};'use strict';var EventEmitter=require(_0xd03f('0x0'));var VoiceExtension=require(_0xd03f('0x1'))['db'][_0xd03f('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd03f('0x3'),'afterUpdate':_0xd03f('0x4'),'afterDestroy':_0xd03f('0x5')};function emitEvent(_0x5a2b26){return function(_0x2d7856,_0x3f75de,_0x127466){VoiceExtensionEvents[_0xd03f('0x6')](_0x5a2b26+':'+_0x2d7856['id'],_0x2d7856);VoiceExtensionEvents['emit'](_0x5a2b26,_0x2d7856);_0x127466(null);};}for(var e in events){if(events[_0xd03f('0x7')](e)){var event=events[e];VoiceExtension[_0xd03f('0x8')](e,emitEvent(event));}}module[_0xd03f('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index a3eee5e..71237ed 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 _0xd856=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','define'];(function(_0x315203,_0x440f52){var _0x28d70c=function(_0x12d61e){while(--_0x12d61e){_0x315203['push'](_0x315203['shift']());}};_0x28d70c(++_0x440f52);}(_0xd856,0xfc));var _0x6d85=function(_0x548fc3,_0xab9be9){_0x548fc3=_0x548fc3-0x0;var _0x3a2650=_0xd856[_0x548fc3];return _0x3a2650;};'use strict';var _=require(_0x6d85('0x0'));var util=require(_0x6d85('0x1'));var logger=require(_0x6d85('0x2'))(_0x6d85('0x3'));var moment=require(_0x6d85('0x4'));var BPromise=require('bluebird');var rp=require(_0x6d85('0x5'));var fs=require('fs');var path=require(_0x6d85('0x6'));var rimraf=require(_0x6d85('0x7'));var config=require(_0x6d85('0x8'));var attributes=require(_0x6d85('0x9'));module[_0x6d85('0xa')]=function(_0x24c175,_0x2a0a61){return _0x24c175[_0x6d85('0xb')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc561=['rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','voice_extensions','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2e3210,_0x555b54){var _0x399fad=function(_0x104a6d){while(--_0x104a6d){_0x2e3210['push'](_0x2e3210['shift']());}};_0x399fad(++_0x555b54);}(_0xc561,0x1a6));var _0x1c56=function(_0x105278,_0x774ed2){_0x105278=_0x105278-0x0;var _0x47b1f=_0xc561[_0x105278];return _0x47b1f;};'use strict';var _=require('lodash');var util=require(_0x1c56('0x0'));var logger=require(_0x1c56('0x1'))(_0x1c56('0x2'));var moment=require(_0x1c56('0x3'));var BPromise=require(_0x1c56('0x4'));var rp=require(_0x1c56('0x5'));var fs=require('fs');var path=require(_0x1c56('0x6'));var rimraf=require(_0x1c56('0x7'));var config=require(_0x1c56('0x8'));var attributes=require(_0x1c56('0x9'));module[_0x1c56('0xa')]=function(_0x5449a9,_0x38c024){return _0x5449a9['define'](_0x1c56('0xb'),attributes,{'tableName':_0x1c56('0xc'),'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 1ed54f4..0a39dd1 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 _0x78fc=['redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','map','model','include','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http'];(function(_0x7040e3,_0x56f4e5){var _0x35e343=function(_0x17f787){while(--_0x17f787){_0x7040e3['push'](_0x7040e3['shift']());}};_0x35e343(++_0x56f4e5);}(_0x78fc,0xd0));var _0xc78f=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x78fc[_0x420d8d];return _0x4865d7;};'use strict';var _=require(_0xc78f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc78f('0x1'));var rs=require(_0xc78f('0x2'));var fs=require('fs');var Redis=require(_0xc78f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc78f('0x4'));var logger=require(_0xc78f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc78f('0x6')][_0xc78f('0x7')]({'port':0x232a});config[_0xc78f('0x8')]=_[_0xc78f('0x9')](config['redis'],{'host':_0xc78f('0xa'),'port':0x18eb});var socket=require(_0xc78f('0xb'))(new Redis(config[_0xc78f('0x8')]));require(_0xc78f('0xc'))[_0xc78f('0xd')](socket);function respondWithRpcPromise(_0x23a9d1,_0x311222,_0x20245b){return new BPromise(function(_0xb847a3,_0x43b5de){return client[_0xc78f('0xe')](_0x23a9d1,_0x20245b)[_0xc78f('0xf')](function(_0x137aad){logger[_0xc78f('0x10')](_0xc78f('0x11'),_0x311222,'request\x20sent');logger[_0xc78f('0x12')](_0xc78f('0x13'),_0x311222,_0xc78f('0x14'),JSON[_0xc78f('0x15')](_0x137aad));if(_0x137aad[_0xc78f('0x16')]){if(_0x137aad[_0xc78f('0x16')][_0xc78f('0x17')]===0x1f4){logger['error'](_0xc78f('0x11'),_0x311222,_0x137aad['error'][_0xc78f('0x18')]);return _0x43b5de(_0x137aad[_0xc78f('0x16')][_0xc78f('0x18')]);}logger[_0xc78f('0x16')](_0xc78f('0x11'),_0x311222,_0x137aad[_0xc78f('0x16')][_0xc78f('0x18')]);return _0xb847a3(_0x137aad['error']['message']);}else{logger[_0xc78f('0x10')](_0xc78f('0x11'),_0x311222,_0xc78f('0x14'));_0xb847a3(_0x137aad[_0xc78f('0x19')][_0xc78f('0x18')]);}})['catch'](function(_0x3a52a4){logger['error'](_0xc78f('0x11'),_0x311222,_0x3a52a4);_0x43b5de(_0x3a52a4);});});}exports[_0xc78f('0x1a')]=function(_0x224f01){var _0x794f8e=this;return new Promise(function(_0x835a10,_0xc87646){return db[_0xc78f('0x1b')][_0xc78f('0x1c')]({'raw':_0x224f01[_0xc78f('0x1d')]?_0x224f01[_0xc78f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x224f01[_0xc78f('0x1d')]?_0x224f01[_0xc78f('0x1d')][_0xc78f('0x1e')]||null:null,'attributes':_0x224f01[_0xc78f('0x1d')]?_0x224f01[_0xc78f('0x1d')][_0xc78f('0x1f')]||null:null,'limit':_0x224f01['options']?_0x224f01[_0xc78f('0x1d')][_0xc78f('0x20')]||null:null,'include':_0x224f01[_0xc78f('0x1d')]?_0x224f01['options']['include']?_[_0xc78f('0x21')](_0x224f01['options']['include'],function(_0xd5a38c){return{'model':db[_0xd5a38c[_0xc78f('0x22')]],'as':_0xd5a38c['as'],'attributes':_0xd5a38c[_0xc78f('0x1f')],'include':_0xd5a38c[_0xc78f('0x23')]?_[_0xc78f('0x21')](_0xd5a38c['include'],function(_0x59a420){return{'model':db[_0x59a420[_0xc78f('0x22')]],'as':_0x59a420['as'],'attributes':_0x59a420[_0xc78f('0x1f')],'include':_0x59a420[_0xc78f('0x23')]?_[_0xc78f('0x21')](_0x59a420['include'],function(_0x19b181){return{'model':db[_0x19b181[_0xc78f('0x22')]],'as':_0x19b181['as'],'attributes':_0x19b181[_0xc78f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc78f('0xf')](function(_0x2662d0){logger[_0xc78f('0x10')](_0xc78f('0x1a'),_0x224f01);logger[_0xc78f('0x12')]('GetVoiceExtension',_0x224f01,JSON['stringify'](_0x2662d0));_0x835a10(_0x2662d0);})['catch'](function(_0x591aba){logger[_0xc78f('0x16')]('GetVoiceExtension',_0x591aba['message'],_0x224f01);_0xc87646(_0x794f8e[_0xc78f('0x16')](0x1f4,_0x591aba[_0xc78f('0x18')]));});});}; \ No newline at end of file +var _0x0b18=['limit','include','map','model','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','catch','GetVoiceExtension','findAll','options','raw','attributes'];(function(_0x5ec5df,_0x503ecf){var _0x2802b7=function(_0x46aedf){while(--_0x46aedf){_0x5ec5df['push'](_0x5ec5df['shift']());}};_0x2802b7(++_0x503ecf);}(_0x0b18,0xa9));var _0x80b1=function(_0xd13a88,_0x3c5269){_0xd13a88=_0xd13a88-0x0;var _0x1c993c=_0x0b18[_0xd13a88];return _0x1c993c;};'use strict';var _=require('lodash');var util=require(_0x80b1('0x0'));var moment=require('moment');var BPromise=require(_0x80b1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80b1('0x2'));var db=require(_0x80b1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x80b1('0x4'))(_0x80b1('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x80b1('0x6')]=_[_0x80b1('0x7')](config[_0x80b1('0x6')],{'host':_0x80b1('0x8'),'port':0x18eb});var socket=require(_0x80b1('0x9'))(new Redis(config[_0x80b1('0x6')]));require(_0x80b1('0xa'))[_0x80b1('0xb')](socket);function respondWithRpcPromise(_0x2faf6e,_0x586358,_0x4c56bb){return new BPromise(function(_0x16016c,_0x1db28d){return client[_0x80b1('0xc')](_0x2faf6e,_0x4c56bb)[_0x80b1('0xd')](function(_0x15d141){logger[_0x80b1('0xe')]('VoiceExtension,\x20%s,\x20%s',_0x586358,_0x80b1('0xf'));logger[_0x80b1('0x10')](_0x80b1('0x11'),_0x586358,_0x80b1('0xf'),JSON[_0x80b1('0x12')](_0x15d141));if(_0x15d141[_0x80b1('0x13')]){if(_0x15d141['error'][_0x80b1('0x14')]===0x1f4){logger[_0x80b1('0x13')](_0x80b1('0x15'),_0x586358,_0x15d141[_0x80b1('0x13')][_0x80b1('0x16')]);return _0x1db28d(_0x15d141[_0x80b1('0x13')][_0x80b1('0x16')]);}logger[_0x80b1('0x13')](_0x80b1('0x15'),_0x586358,_0x15d141[_0x80b1('0x13')][_0x80b1('0x16')]);return _0x16016c(_0x15d141[_0x80b1('0x13')][_0x80b1('0x16')]);}else{logger[_0x80b1('0xe')](_0x80b1('0x15'),_0x586358,_0x80b1('0xf'));_0x16016c(_0x15d141['result'][_0x80b1('0x16')]);}})[_0x80b1('0x17')](function(_0x2e0724){logger[_0x80b1('0x13')](_0x80b1('0x15'),_0x586358,_0x2e0724);_0x1db28d(_0x2e0724);});});}exports[_0x80b1('0x18')]=function(_0x1fabe9){var _0x236fcc=this;return new Promise(function(_0x3c06f2,_0x276a42){return db['VoiceExtension'][_0x80b1('0x19')]({'raw':_0x1fabe9[_0x80b1('0x1a')]?_0x1fabe9[_0x80b1('0x1a')][_0x80b1('0x1b')]===undefined?!![]:![]:!![],'where':_0x1fabe9[_0x80b1('0x1a')]?_0x1fabe9['options']['where']||null:null,'attributes':_0x1fabe9[_0x80b1('0x1a')]?_0x1fabe9[_0x80b1('0x1a')][_0x80b1('0x1c')]||null:null,'limit':_0x1fabe9[_0x80b1('0x1a')]?_0x1fabe9[_0x80b1('0x1a')][_0x80b1('0x1d')]||null:null,'include':_0x1fabe9[_0x80b1('0x1a')]?_0x1fabe9[_0x80b1('0x1a')][_0x80b1('0x1e')]?_[_0x80b1('0x1f')](_0x1fabe9['options'][_0x80b1('0x1e')],function(_0x5651d1){return{'model':db[_0x5651d1[_0x80b1('0x20')]],'as':_0x5651d1['as'],'attributes':_0x5651d1[_0x80b1('0x1c')],'include':_0x5651d1['include']?_[_0x80b1('0x1f')](_0x5651d1[_0x80b1('0x1e')],function(_0x4e4b28){return{'model':db[_0x4e4b28[_0x80b1('0x20')]],'as':_0x4e4b28['as'],'attributes':_0x4e4b28[_0x80b1('0x1c')],'include':_0x4e4b28[_0x80b1('0x1e')]?_[_0x80b1('0x1f')](_0x4e4b28[_0x80b1('0x1e')],function(_0x238af2){return{'model':db[_0x238af2[_0x80b1('0x20')]],'as':_0x238af2['as'],'attributes':_0x238af2['attributes']};}):[]};}):[]};}):[]:[]})[_0x80b1('0xd')](function(_0x2a4e93){logger[_0x80b1('0xe')]('GetVoiceExtension',_0x1fabe9);logger['debug'](_0x80b1('0x18'),_0x1fabe9,JSON['stringify'](_0x2a4e93));_0x3c06f2(_0x2a4e93);})[_0x80b1('0x17')](function(_0x2ab06b){logger[_0x80b1('0x13')]('GetVoiceExtension',_0x2ab06b[_0x80b1('0x16')],_0x1fabe9);_0x276a42(_0x236fcc[_0x80b1('0x13')](0x1f4,_0x2ab06b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index b1553dc..22abfd0 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 _0xf50b=['remove','update','register','length','./voiceExtension.events','save'];(function(_0x37039c,_0x3f4cf3){var _0x171602=function(_0x50ccdd){while(--_0x50ccdd){_0x37039c['push'](_0x37039c['shift']());}};_0x171602(++_0x3f4cf3);}(_0xf50b,0xd6));var _0xbf50=function(_0x5169c7,_0x325c9b){_0x5169c7=_0x5169c7-0x0;var _0x53a3cf=_0xf50b[_0x5169c7];return _0x53a3cf;};'use strict';var VoiceExtensionEvents=require(_0xbf50('0x0'));var events=[_0xbf50('0x1'),_0xbf50('0x2'),_0xbf50('0x3')];function createListener(_0x76a75d,_0x2056a3){return function(_0x145ae4){_0x2056a3['emit'](_0x76a75d,_0x145ae4);};}function removeListener(_0x25dca0,_0x5640b0){return function(){VoiceExtensionEvents['removeListener'](_0x25dca0,_0x5640b0);};}exports[_0xbf50('0x4')]=function(_0x445ee1){for(var _0x2a029a=0x0,_0x2a0cef=events[_0xbf50('0x5')];_0x2a029a<_0x2a0cef;_0x2a029a++){var _0x3233ef=events[_0x2a029a];var _0x401262=createListener('voiceExtension:'+_0x3233ef,_0x445ee1);VoiceExtensionEvents['on'](_0x3233ef,_0x401262);}}; \ No newline at end of file +var _0x6fe9=['save','remove','update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x4816bd,_0xc5b815){var _0x3328c9=function(_0x2c9860){while(--_0x2c9860){_0x4816bd['push'](_0x4816bd['shift']());}};_0x3328c9(++_0xc5b815);}(_0x6fe9,0xe7));var _0x96fe=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x6fe9[_0x3511d3];return _0x5d6321;};'use strict';var VoiceExtensionEvents=require(_0x96fe('0x0'));var events=[_0x96fe('0x1'),_0x96fe('0x2'),_0x96fe('0x3')];function createListener(_0x128a9a,_0x3406ed){return function(_0x58b3a7){_0x3406ed[_0x96fe('0x4')](_0x128a9a,_0x58b3a7);};}function removeListener(_0x4b50ac,_0x2a3076){return function(){VoiceExtensionEvents[_0x96fe('0x5')](_0x4b50ac,_0x2a3076);};}exports[_0x96fe('0x6')]=function(_0x43c14d){for(var _0x28251f=0x0,_0x869154=events[_0x96fe('0x7')];_0x28251f<_0x869154;_0x28251f++){var _0x25e0fb=events[_0x28251f];var _0x643b43=createListener('voiceExtension:'+_0x25e0fb,_0x43c14d);VoiceExtensionEvents['on'](_0x25e0fb,_0x643b43);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 4c535ca..10162e5 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 _0x9e2f=['post','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router','../../config/environment','./voiceMail.controller','get','show','isAuthenticated','getMessages'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x9e2f,0x170));var _0xf9e2=function(_0x1cff33,_0x32fb7b){_0x1cff33=_0x1cff33-0x0;var _0xf0becd=_0x9e2f[_0x1cff33];return _0xf0becd;};'use strict';var multer=require(_0xf9e2('0x0'));var util=require('util');var path=require(_0xf9e2('0x1'));var timeout=require('connect-timeout');var express=require(_0xf9e2('0x2'));var router=express[_0xf9e2('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf9e2('0x4'));var controller=require(_0xf9e2('0x5'));router[_0xf9e2('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf9e2('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xf9e2('0x7')]);router[_0xf9e2('0x6')]('/:id/messages',auth[_0xf9e2('0x8')](),controller[_0xf9e2('0x9')]);router[_0xf9e2('0xa')]('/',auth[_0xf9e2('0x8')](),controller[_0xf9e2('0xb')]);router[_0xf9e2('0xc')](_0xf9e2('0xd'),auth[_0xf9e2('0x8')](),controller[_0xf9e2('0xe')]);router[_0xf9e2('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xf9e2('0x10')]);module[_0xf9e2('0x11')]=router; \ No newline at end of file +var _0x0151=['./voiceMail.controller','isAuthenticated','get','/:id','/:id/messages','post','create','put','delete','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0151,0xd9));var _0x1015=function(_0x50982e,_0x106bf2){_0x50982e=_0x50982e-0x0;var _0xe3710d=_0x0151[_0x50982e];return _0xe3710d;};'use strict';var multer=require(_0x1015('0x0'));var util=require('util');var path=require(_0x1015('0x1'));var timeout=require(_0x1015('0x2'));var express=require('express');var router=express[_0x1015('0x3')]();var auth=require(_0x1015('0x4'));var interaction=require(_0x1015('0x5'));var config=require(_0x1015('0x6'));var controller=require(_0x1015('0x7'));router['get']('/',auth[_0x1015('0x8')](),controller['index']);router[_0x1015('0x9')](_0x1015('0xa'),auth[_0x1015('0x8')](),controller['show']);router[_0x1015('0x9')](_0x1015('0xb'),auth[_0x1015('0x8')](),controller['getMessages']);router[_0x1015('0xc')]('/',auth['isAuthenticated'](),controller[_0x1015('0xd')]);router[_0x1015('0xe')]('/:id',auth[_0x1015('0x8')](),controller['update']);router[_0x1015('0xf')](_0x1015('0xa'),auth[_0x1015('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index ecfa170..c4a9742 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 _0x878f=['contest_mailbox','string','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail'];(function(_0x2ed4ab,_0x263b99){var _0x488532=function(_0x42993f){while(--_0x42993f){_0x2ed4ab['push'](_0x2ed4ab['shift']());}};_0x488532(++_0x263b99);}(_0x878f,0x173));var _0xf878=function(_0x3de456,_0x359969){_0x3de456=_0x3de456-0x0;var _0x571f57=_0x878f[_0x3de456];return _0x571f57;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'customer_id':{'type':Sequelize[_0xf878('0x1')]},'context':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x2'),'unique':_0xf878('0x3')},'mailbox':{'type':Sequelize[_0xf878('0x1')],'defaultValue':'','allowNull':![],'unique':_0xf878('0x3')},'password':{'type':Sequelize[_0xf878('0x1')]},'fullname':{'type':Sequelize[_0xf878('0x1')]},'email':{'type':Sequelize[_0xf878('0x1')],'validate':{'isEmail':!![]},'set':function(_0x27ae4d){this['setDataValue']('email',typeof _0x27ae4d===_0xf878('0x4')&&_0x27ae4d[_0xf878('0x5')]()?_0x27ae4d['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xf878('0x6')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf878('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xf878('0x1')]},'callback':{'type':Sequelize[_0xf878('0x1')]},'review':{'type':Sequelize['ENUM'](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf878('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf878('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf878('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':_0xf878('0x7'),'allowNull':![]},'stamp':{'type':_0xf878('0xa')},'emailsubject':{'type':Sequelize[_0xf878('0x1')]},'emailbody':{'type':Sequelize[_0xf878('0x1')]},'maxsecs':{'type':Sequelize[_0xf878('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf878('0xc')],'get':function(){return this[_0xf878('0xd')](_0xf878('0xe'))+_0xf878('0xf')+this[_0xf878('0xd')](_0xf878('0x10'));}}}; \ No newline at end of file +var _0xf7b4=['from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','sequelize','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf7b4,0x152));var _0x4f7b=function(_0x1e5dc1,_0x5294b4){_0x1e5dc1=_0x1e5dc1-0x0;var _0x5b49e4=_0xf7b4[_0x1e5dc1];return _0x5b49e4;};'use strict';var Sequelize=require(_0x4f7b('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4f7b('0x1')],'defaultValue':_0x4f7b('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x4f7b('0x3')},'password':{'type':Sequelize[_0x4f7b('0x1')]},'fullname':{'type':Sequelize[_0x4f7b('0x1')]},'email':{'type':Sequelize[_0x4f7b('0x1')],'validate':{'isEmail':!![]},'set':function(_0xc39829){this[_0x4f7b('0x4')](_0x4f7b('0x5'),typeof _0xc39829===_0x4f7b('0x6')&&_0xc39829[_0x4f7b('0x7')]()?_0xc39829[_0x4f7b('0x7')]():null);}},'pager':{'type':Sequelize[_0x4f7b('0x1')]},'tz':{'type':Sequelize[_0x4f7b('0x1')],'defaultValue':_0x4f7b('0x8')},'attach':{'type':Sequelize['ENUM'](_0x4f7b('0x9'),'no'),'defaultValue':_0x4f7b('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x4f7b('0x9'),'no'),'defaultValue':_0x4f7b('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x4f7b('0x1')]},'callback':{'type':Sequelize[_0x4f7b('0x1')]},'review':{'type':Sequelize[_0x4f7b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x4f7b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x4f7b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x4f7b('0xa')](_0x4f7b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4f7b('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x4f7b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4f7b('0xa')](_0x4f7b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4f7b('0xa')](_0x4f7b('0x9'),'no'),'defaultValue':_0x4f7b('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4f7b('0xa')](_0x4f7b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4f7b('0xa')](_0x4f7b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4f7b('0xa')](_0x4f7b('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x4f7b('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x4f7b('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4f7b('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4f7b('0xe')](_0x4f7b('0xf'))+_0x4f7b('0x10')+this[_0x4f7b('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index f19975c..37ffbe8 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 _0xf4ce=['moment','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Voicemails','sendStatus','error','name','send','index','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','length','options','find','create','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','VoiceMailMessage','order','findAndCountAll','html-pdf','zip-dir','fast-json-patch','request-promise'];(function(_0x3fb48c,_0x22045a){var _0x4e05f8=function(_0x7559ae){while(--_0x7559ae){_0x3fb48c['push'](_0x3fb48c['shift']());}};_0x4e05f8(++_0x22045a);}(_0xf4ce,0xf2));var _0xef4c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf4ce[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0xef4c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xef4c('0x1'));var jsonpatch=require(_0xef4c('0x2'));var rp=require(_0xef4c('0x3'));var moment=require(_0xef4c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xef4c('0x5'));var ejs=require(_0xef4c('0x6'));var fs=require('fs');var _=require(_0xef4c('0x7'));var squel=require(_0xef4c('0x8'));var crypto=require(_0xef4c('0x9'));var jsforce=require(_0xef4c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xef4c('0x5'));var querystring=require(_0xef4c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xef4c('0xc'));var as=require(_0xef4c('0xd'));var hardwareService=require(_0xef4c('0xe'));var logger=require(_0xef4c('0xf'))('api');var utils=require(_0xef4c('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xef4c('0x11'))['db'];function respondWithStatusCode(_0x3bda49,_0x2bfe28){_0x2bfe28=_0x2bfe28||0xcc;return function(_0x6a1290){if(_0x6a1290){return _0x3bda49['sendStatus'](_0x2bfe28);}return _0x3bda49[_0xef4c('0x12')](_0x2bfe28)[_0xef4c('0x13')]();};}function respondWithResult(_0x12d7a6,_0x417f67){_0x417f67=_0x417f67||0xc8;return function(_0x2a2631){if(_0x2a2631){return _0x12d7a6[_0xef4c('0x12')](_0x417f67)[_0xef4c('0x14')](_0x2a2631);}};}function respondWithFilteredResult(_0x1c7633,_0x5dc6a3){return function(_0x55a7aa){if(_0x55a7aa){var _0x3637ce=_0x55a7aa[_0xef4c('0x15')],_0x40a344=_0x5dc6a3[_0xef4c('0x16')],_0x4141a0=_0x5dc6a3[_0xef4c('0x16')]+_0x5dc6a3[_0xef4c('0x17')],_0x18a238;if(_0x4141a0>=_0x3637ce){_0x4141a0=_0x3637ce;_0x18a238=0xc8;}else{_0x18a238=0xce;}_0x1c7633[_0xef4c('0x12')](_0x18a238);return _0x1c7633[_0xef4c('0x18')](_0xef4c('0x19'),_0x40a344+'-'+_0x4141a0+'/'+_0x3637ce)[_0xef4c('0x14')](_0x55a7aa);}return null;};}function patchUpdates(_0x2f309d){return function(_0x560486){try{jsonpatch[_0xef4c('0x1a')](_0x560486,_0x2f309d,!![]);}catch(_0x550011){return BPromise[_0xef4c('0x1b')](_0x550011);}return _0x560486[_0xef4c('0x1c')]();};}function saveUpdates(_0x46f556,_0xd4e0a){return function(_0x4d5888){if(_0x4d5888){return _0x4d5888[_0xef4c('0x1d')](_0x46f556)['then'](function(_0xd8c54e){return _0xd8c54e;});}return null;};}function removeEntity(_0x460860,_0x500bd3){return function(_0x251e29){if(_0x251e29){return _0x251e29[_0xef4c('0x1e')]()[_0xef4c('0x1f')](function(){var _0x4f4a3a=_0x251e29[_0xef4c('0x20')]({'plain':!![]});var _0x17c816=_0xef4c('0x21');return db['UserProfileResource'][_0xef4c('0x1e')]({'where':{'type':_0x17c816,'resourceId':_0x4f4a3a['id']}})[_0xef4c('0x1f')](function(){return _0x251e29;});})[_0xef4c('0x1f')](function(){_0x460860[_0xef4c('0x12')](0xcc)[_0xef4c('0x13')]();});}};}function handleEntityNotFound(_0x26f523,_0x4befda){return function(_0x7e3dd8){if(!_0x7e3dd8){_0x26f523[_0xef4c('0x22')](0x194);}return _0x7e3dd8;};}function handleError(_0x35f404,_0x20211f){_0x20211f=_0x20211f||0x1f4;return function(_0x53368d){logger[_0xef4c('0x23')](_0x53368d['stack']);if(_0x53368d[_0xef4c('0x24')]){delete _0x53368d['name'];}_0x35f404[_0xef4c('0x12')](_0x20211f)[_0xef4c('0x25')](_0x53368d);};}exports[_0xef4c('0x26')]=function(_0x13eb57,_0x8fe191){var _0xb10f30={},_0x539486={},_0x4d4c5d={'count':0x0,'rows':[]};var _0x5ae737=_['map'](db[_0xef4c('0x27')][_0xef4c('0x28')],function(_0x32ee4a){return{'name':_0x32ee4a[_0xef4c('0x29')],'type':_0x32ee4a[_0xef4c('0x2a')][_0xef4c('0x2b')]};});_0x539486[_0xef4c('0x2c')]=_[_0xef4c('0x2d')](_0x5ae737,_0xef4c('0x24'));_0x539486[_0xef4c('0x2e')]=_[_0xef4c('0x2f')](_0x13eb57[_0xef4c('0x2e')]);_0x539486['filters']=_['intersection'](_0x539486[_0xef4c('0x2c')],_0x539486[_0xef4c('0x2e')]);_0xb10f30['attributes']=_[_0xef4c('0x30')](_0x539486[_0xef4c('0x2c')],qs['fields'](_0x13eb57[_0xef4c('0x2e')][_0xef4c('0x31')]));_0xb10f30[_0xef4c('0x32')]=_0xb10f30[_0xef4c('0x32')]['length']?_0xb10f30[_0xef4c('0x32')]:_0x539486[_0xef4c('0x2c')];if(!_0x13eb57[_0xef4c('0x2e')][_0xef4c('0x33')](_0xef4c('0x34'))){_0xb10f30[_0xef4c('0x17')]=qs[_0xef4c('0x17')](_0x13eb57['query'][_0xef4c('0x17')]);_0xb10f30[_0xef4c('0x16')]=qs[_0xef4c('0x16')](_0x13eb57[_0xef4c('0x2e')][_0xef4c('0x16')]);}_0xb10f30['order']=qs['sort'](_0x13eb57[_0xef4c('0x2e')][_0xef4c('0x35')]);_0xb10f30[_0xef4c('0x36')]=qs[_0xef4c('0x37')](_[_0xef4c('0x38')](_0x13eb57[_0xef4c('0x2e')],_0x539486[_0xef4c('0x37')]),_0x5ae737);if(_0x13eb57[_0xef4c('0x2e')][_0xef4c('0x39')]){_0xb10f30['where']=_['merge'](_0xb10f30[_0xef4c('0x36')],{'$or':_[_0xef4c('0x2d')](_0x5ae737,function(_0x226c85){if(_0x226c85[_0xef4c('0x2a')]!==_0xef4c('0x3a')){var _0x145498={};_0x145498[_0x226c85[_0xef4c('0x24')]]={'$like':'%'+_0x13eb57[_0xef4c('0x2e')][_0xef4c('0x39')]+'%'};return _0x145498;}})});}_0xb10f30=_[_0xef4c('0x3b')]({},_0xb10f30,_0x13eb57['options']);var _0x5605ec={'where':_0xb10f30['where']};return db[_0xef4c('0x27')]['count'](_0x5605ec)['then'](function(_0x5a85fe){_0x4d4c5d['count']=_0x5a85fe;if(_0x13eb57['query']['includeAll']){_0xb10f30[_0xef4c('0x3c')]=[{'all':!![]}];}return db[_0xef4c('0x27')][_0xef4c('0x3d')](_0xb10f30);})[_0xef4c('0x1f')](function(_0x1335a7){_0x4d4c5d[_0xef4c('0x3e')]=_0x1335a7;return _0x4d4c5d;})['then'](respondWithFilteredResult(_0x8fe191,_0xb10f30))[_0xef4c('0x3f')](handleError(_0x8fe191,null));};exports[_0xef4c('0x40')]=function(_0x1ec099,_0x1f7a13){var _0x57f3d0={'raw':!![],'where':{'id':_0x1ec099[_0xef4c('0x41')]['id']}},_0x5520b5={};_0x5520b5[_0xef4c('0x2c')]=_[_0xef4c('0x2f')](db[_0xef4c('0x27')][_0xef4c('0x28')]);_0x5520b5[_0xef4c('0x2e')]=_[_0xef4c('0x2f')](_0x1ec099[_0xef4c('0x2e')]);_0x5520b5['filters']=_['intersection'](_0x5520b5[_0xef4c('0x2c')],_0x5520b5['query']);_0x57f3d0[_0xef4c('0x32')]=_[_0xef4c('0x30')](_0x5520b5[_0xef4c('0x2c')],qs[_0xef4c('0x31')](_0x1ec099[_0xef4c('0x2e')][_0xef4c('0x31')]));_0x57f3d0[_0xef4c('0x32')]=_0x57f3d0[_0xef4c('0x32')][_0xef4c('0x42')]?_0x57f3d0[_0xef4c('0x32')]:_0x5520b5[_0xef4c('0x2c')];if(_0x1ec099[_0xef4c('0x2e')]['includeAll']){_0x57f3d0[_0xef4c('0x3c')]=[{'all':!![]}];}_0x57f3d0=_[_0xef4c('0x3b')]({},_0x57f3d0,_0x1ec099[_0xef4c('0x43')]);return db[_0xef4c('0x27')][_0xef4c('0x44')](_0x57f3d0)[_0xef4c('0x1f')](handleEntityNotFound(_0x1f7a13,null))['then'](respondWithResult(_0x1f7a13,null))[_0xef4c('0x3f')](handleError(_0x1f7a13,null));};exports[_0xef4c('0x45')]=function(_0x1d921f,_0x1619b6){return db['VoiceMail'][_0xef4c('0x45')](_0x1d921f['body'],{})[_0xef4c('0x1f')](function(_0x2eb3ad){var _0x5e89de=_0x1d921f[_0xef4c('0x46')][_0xef4c('0x20')]({'plain':!![]});if(!_0x5e89de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e89de[_0xef4c('0x47')]===_0xef4c('0x46')){var _0x42ec1d=_0x2eb3ad['get']({'plain':!![]});var _0x225a9e=_0xef4c('0x21');return db[_0xef4c('0x48')][_0xef4c('0x44')]({'where':{'name':_0x225a9e,'userProfileId':_0x5e89de[_0xef4c('0x49')]},'raw':!![]})[_0xef4c('0x1f')](function(_0x46d41a){if(_0x46d41a&&_0x46d41a['autoAssociation']===0x0){return db[_0xef4c('0x4a')][_0xef4c('0x45')]({'name':_0x42ec1d[_0xef4c('0x24')],'resourceId':_0x42ec1d['id'],'type':_0x46d41a[_0xef4c('0x24')],'sectionId':_0x46d41a['id']},{})[_0xef4c('0x1f')](function(){return _0x2eb3ad;});}else{return _0x2eb3ad;}})[_0xef4c('0x3f')](function(_0x4ac496){logger[_0xef4c('0x23')](_0xef4c('0x4b'),_0x4ac496);throw _0x4ac496;});}return _0x2eb3ad;})[_0xef4c('0x1f')](respondWithResult(_0x1619b6,0xc9))['catch'](handleError(_0x1619b6,null));};exports[_0xef4c('0x1d')]=function(_0x5724a0,_0x2c0c34){if(_0x5724a0[_0xef4c('0x4c')]['id']){delete _0x5724a0[_0xef4c('0x4c')]['id'];}return db['VoiceMail'][_0xef4c('0x44')]({'where':{'id':_0x5724a0[_0xef4c('0x41')]['id']}})[_0xef4c('0x1f')](handleEntityNotFound(_0x2c0c34,null))[_0xef4c('0x1f')](saveUpdates(_0x5724a0[_0xef4c('0x4c')],null))['then'](respondWithResult(_0x2c0c34,null))[_0xef4c('0x3f')](handleError(_0x2c0c34,null));};exports[_0xef4c('0x1e')]=function(_0x2f5f94,_0xb4abe6){return db[_0xef4c('0x27')][_0xef4c('0x44')]({'where':{'id':_0x2f5f94[_0xef4c('0x41')]['id']}})[_0xef4c('0x1f')](handleEntityNotFound(_0xb4abe6,null))[_0xef4c('0x1f')](removeEntity(_0xb4abe6,null))[_0xef4c('0x3f')](handleError(_0xb4abe6,null));};exports[_0xef4c('0x4d')]=function(_0x73943e,_0x351bf6,_0x3f6a36){return db[_0xef4c('0x27')][_0xef4c('0x4e')]({'where':{'id':_0x73943e[_0xef4c('0x41')]['id']}})[_0xef4c('0x1f')](handleEntityNotFound(_0x351bf6,null))[_0xef4c('0x1f')](function(_0x2af46d){var _0x2f4fb1;var _0xc494d={},_0x25d8e8={};_0x25d8e8['model']=_[_0xef4c('0x2f')](db[_0xef4c('0x4f')][_0xef4c('0x28')]);_0x25d8e8[_0xef4c('0x2e')]=_['keys'](_0x73943e[_0xef4c('0x2e')]);_0x25d8e8['filters']=_[_0xef4c('0x30')](_0x25d8e8[_0xef4c('0x2c')],_0x25d8e8[_0xef4c('0x2e')]);_0xc494d[_0xef4c('0x32')]=_[_0xef4c('0x30')](_0x25d8e8[_0xef4c('0x2c')],qs['fields'](_0x73943e[_0xef4c('0x2e')][_0xef4c('0x31')]));_0xc494d[_0xef4c('0x32')]=_0xc494d[_0xef4c('0x32')][_0xef4c('0x42')]?_0xc494d[_0xef4c('0x32')]:_0x25d8e8['model'];if(!_0x73943e[_0xef4c('0x2e')]['hasOwnProperty'](_0xef4c('0x34'))){_0xc494d[_0xef4c('0x17')]=qs['limit'](_0x73943e[_0xef4c('0x2e')][_0xef4c('0x17')]);_0xc494d['offset']=qs['offset'](_0x73943e['query']['offset']);}_0xc494d[_0xef4c('0x50')]=qs['sort'](_0x73943e[_0xef4c('0x2e')][_0xef4c('0x35')]);_0xc494d[_0xef4c('0x36')]=qs[_0xef4c('0x37')](_[_0xef4c('0x38')](_0x73943e['query'],_0x25d8e8[_0xef4c('0x37')]));if(_0x73943e['query']['filter']){_0xc494d[_0xef4c('0x36')]=_[_0xef4c('0x3b')](_0xc494d[_0xef4c('0x36')],{'$or':_[_0xef4c('0x2d')](_0xc494d['attributes'],function(_0x3455c0){var _0x1e5732={};_0x1e5732[_0x3455c0]={'$like':'%'+_0x73943e['query'][_0xef4c('0x39')]+'%'};return _0x1e5732;})});}_0xc494d['where']=_['merge'](_0xc494d[_0xef4c('0x36')],{'mailboxuser':_0x2af46d['mailbox']});_0xc494d=_[_0xef4c('0x3b')]({},_0xc494d,_0x73943e['options']);return db[_0xef4c('0x4f')][_0xef4c('0x51')](_0xc494d)[_0xef4c('0x1f')](respondWithFilteredResult(_0x351bf6,_0xc494d));})[_0xef4c('0x3f')](handleError(_0x351bf6,null));}; \ No newline at end of file +var _0xc4d8=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','VoiceMail','include','rows','catch','show','params','intersection','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','length','findAndCountAll','html-pdf','rimraf','zip-dir','moment','util','path'];(function(_0x1a206c,_0x138be1){var _0x47e791=function(_0x5a259d){while(--_0x5a259d){_0x1a206c['push'](_0x1a206c['shift']());}};_0x47e791(++_0x138be1);}(_0xc4d8,0xa6));var _0x8c4d=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xc4d8[_0x160c73];return _0xd9302;};'use strict';var pdf=require(_0x8c4d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8c4d('0x1'));var zipdir=require(_0x8c4d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8c4d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8c4d('0x4'));var path=require(_0x8c4d('0x5'));var sox=require(_0x8c4d('0x6'));var csv=require(_0x8c4d('0x7'));var ejs=require(_0x8c4d('0x8'));var fs=require('fs');var _=require(_0x8c4d('0x9'));var squel=require(_0x8c4d('0xa'));var crypto=require(_0x8c4d('0xb'));var jsforce=require(_0x8c4d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8c4d('0x7'));var querystring=require(_0x8c4d('0xd'));var Papa=require(_0x8c4d('0xe'));var Redis=require(_0x8c4d('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8c4d('0x10'));var hardwareService=require(_0x8c4d('0x11'));var logger=require(_0x8c4d('0x12'))(_0x8c4d('0x13'));var utils=require(_0x8c4d('0x14'));var config=require(_0x8c4d('0x15'));var licenseUtil=require(_0x8c4d('0x16'));var db=require(_0x8c4d('0x17'))['db'];function respondWithStatusCode(_0x50de53,_0x21768d){_0x21768d=_0x21768d||0xcc;return function(_0x303bbc){if(_0x303bbc){return _0x50de53[_0x8c4d('0x18')](_0x21768d);}return _0x50de53[_0x8c4d('0x19')](_0x21768d)[_0x8c4d('0x1a')]();};}function respondWithResult(_0x207f67,_0x3d42f1){_0x3d42f1=_0x3d42f1||0xc8;return function(_0x220cfa){if(_0x220cfa){return _0x207f67['status'](_0x3d42f1)['json'](_0x220cfa);}};}function respondWithFilteredResult(_0x20ab4f,_0x1d410e){return function(_0x498e5d){if(_0x498e5d){var _0x355345=_0x498e5d[_0x8c4d('0x1b')],_0xe74783=_0x1d410e[_0x8c4d('0x1c')],_0x3e9b4c=_0x1d410e[_0x8c4d('0x1c')]+_0x1d410e[_0x8c4d('0x1d')],_0x4d8ded;if(_0x3e9b4c>=_0x355345){_0x3e9b4c=_0x355345;_0x4d8ded=0xc8;}else{_0x4d8ded=0xce;}_0x20ab4f[_0x8c4d('0x19')](_0x4d8ded);return _0x20ab4f['set'](_0x8c4d('0x1e'),_0xe74783+'-'+_0x3e9b4c+'/'+_0x355345)[_0x8c4d('0x1f')](_0x498e5d);}return null;};}function patchUpdates(_0x48b376){return function(_0x409568){try{jsonpatch[_0x8c4d('0x20')](_0x409568,_0x48b376,!![]);}catch(_0x2ad16e){return BPromise[_0x8c4d('0x21')](_0x2ad16e);}return _0x409568[_0x8c4d('0x22')]();};}function saveUpdates(_0x10ef16,_0x17c206){return function(_0x29b216){if(_0x29b216){return _0x29b216[_0x8c4d('0x23')](_0x10ef16)['then'](function(_0x30aa03){return _0x30aa03;});}return null;};}function removeEntity(_0x16ddc9,_0x33f0a2){return function(_0x663624){if(_0x663624){return _0x663624[_0x8c4d('0x24')]()[_0x8c4d('0x25')](function(){var _0x54d835=_0x663624[_0x8c4d('0x26')]({'plain':!![]});var _0x10ea9b='Voicemails';return db[_0x8c4d('0x27')]['destroy']({'where':{'type':_0x10ea9b,'resourceId':_0x54d835['id']}})[_0x8c4d('0x25')](function(){return _0x663624;});})['then'](function(){_0x16ddc9[_0x8c4d('0x19')](0xcc)[_0x8c4d('0x1a')]();});}};}function handleEntityNotFound(_0x3f428b,_0x34353a){return function(_0x3dec4b){if(!_0x3dec4b){_0x3f428b[_0x8c4d('0x18')](0x194);}return _0x3dec4b;};}function handleError(_0x33d5f1,_0x4c697b){_0x4c697b=_0x4c697b||0x1f4;return function(_0x4e63fb){logger[_0x8c4d('0x28')](_0x4e63fb[_0x8c4d('0x29')]);if(_0x4e63fb[_0x8c4d('0x2a')]){delete _0x4e63fb['name'];}_0x33d5f1[_0x8c4d('0x19')](_0x4c697b)[_0x8c4d('0x2b')](_0x4e63fb);};}exports[_0x8c4d('0x2c')]=function(_0x5dfb6f,_0x22f944){var _0x476266={},_0x2e4076={},_0xaf4fa3={'count':0x0,'rows':[]};var _0x2b1680=_[_0x8c4d('0x2d')](db['VoiceMail'][_0x8c4d('0x2e')],function(_0x36f9fe){return{'name':_0x36f9fe['fieldName'],'type':_0x36f9fe['type']['key']};});_0x2e4076[_0x8c4d('0x2f')]=_[_0x8c4d('0x2d')](_0x2b1680,_0x8c4d('0x2a'));_0x2e4076[_0x8c4d('0x30')]=_[_0x8c4d('0x31')](_0x5dfb6f['query']);_0x2e4076['filters']=_['intersection'](_0x2e4076[_0x8c4d('0x2f')],_0x2e4076[_0x8c4d('0x30')]);_0x476266[_0x8c4d('0x32')]=_['intersection'](_0x2e4076[_0x8c4d('0x2f')],qs['fields'](_0x5dfb6f[_0x8c4d('0x30')][_0x8c4d('0x33')]));_0x476266[_0x8c4d('0x32')]=_0x476266[_0x8c4d('0x32')]['length']?_0x476266[_0x8c4d('0x32')]:_0x2e4076[_0x8c4d('0x2f')];if(!_0x5dfb6f[_0x8c4d('0x30')][_0x8c4d('0x34')](_0x8c4d('0x35'))){_0x476266[_0x8c4d('0x1d')]=qs[_0x8c4d('0x1d')](_0x5dfb6f[_0x8c4d('0x30')]['limit']);_0x476266[_0x8c4d('0x1c')]=qs['offset'](_0x5dfb6f[_0x8c4d('0x30')][_0x8c4d('0x1c')]);}_0x476266[_0x8c4d('0x36')]=qs[_0x8c4d('0x37')](_0x5dfb6f[_0x8c4d('0x30')]['sort']);_0x476266[_0x8c4d('0x38')]=qs[_0x8c4d('0x39')](_[_0x8c4d('0x3a')](_0x5dfb6f[_0x8c4d('0x30')],_0x2e4076[_0x8c4d('0x39')]),_0x2b1680);if(_0x5dfb6f[_0x8c4d('0x30')][_0x8c4d('0x3b')]){_0x476266[_0x8c4d('0x38')]=_[_0x8c4d('0x3c')](_0x476266[_0x8c4d('0x38')],{'$or':_[_0x8c4d('0x2d')](_0x2b1680,function(_0x4f08dd){if(_0x4f08dd[_0x8c4d('0x3d')]!==_0x8c4d('0x3e')){var _0x4fc678={};_0x4fc678[_0x4f08dd['name']]={'$like':'%'+_0x5dfb6f[_0x8c4d('0x30')][_0x8c4d('0x3b')]+'%'};return _0x4fc678;}})});}_0x476266=_[_0x8c4d('0x3c')]({},_0x476266,_0x5dfb6f[_0x8c4d('0x3f')]);var _0x319f33={'where':_0x476266[_0x8c4d('0x38')]};return db[_0x8c4d('0x40')][_0x8c4d('0x1b')](_0x319f33)['then'](function(_0x388fb7){_0xaf4fa3[_0x8c4d('0x1b')]=_0x388fb7;if(_0x5dfb6f[_0x8c4d('0x30')]['includeAll']){_0x476266[_0x8c4d('0x41')]=[{'all':!![]}];}return db[_0x8c4d('0x40')]['findAll'](_0x476266);})[_0x8c4d('0x25')](function(_0x55ece9){_0xaf4fa3[_0x8c4d('0x42')]=_0x55ece9;return _0xaf4fa3;})[_0x8c4d('0x25')](respondWithFilteredResult(_0x22f944,_0x476266))[_0x8c4d('0x43')](handleError(_0x22f944,null));};exports[_0x8c4d('0x44')]=function(_0x5ed269,_0x3d95fd){var _0x1be236={'raw':!![],'where':{'id':_0x5ed269[_0x8c4d('0x45')]['id']}},_0x18730c={};_0x18730c['model']=_['keys'](db['VoiceMail'][_0x8c4d('0x2e')]);_0x18730c[_0x8c4d('0x30')]=_[_0x8c4d('0x31')](_0x5ed269['query']);_0x18730c['filters']=_[_0x8c4d('0x46')](_0x18730c[_0x8c4d('0x2f')],_0x18730c[_0x8c4d('0x30')]);_0x1be236['attributes']=_[_0x8c4d('0x46')](_0x18730c[_0x8c4d('0x2f')],qs[_0x8c4d('0x33')](_0x5ed269[_0x8c4d('0x30')][_0x8c4d('0x33')]));_0x1be236['attributes']=_0x1be236[_0x8c4d('0x32')]['length']?_0x1be236['attributes']:_0x18730c[_0x8c4d('0x2f')];if(_0x5ed269['query']['includeAll']){_0x1be236[_0x8c4d('0x41')]=[{'all':!![]}];}_0x1be236=_[_0x8c4d('0x3c')]({},_0x1be236,_0x5ed269[_0x8c4d('0x3f')]);return db[_0x8c4d('0x40')]['find'](_0x1be236)[_0x8c4d('0x25')](handleEntityNotFound(_0x3d95fd,null))[_0x8c4d('0x25')](respondWithResult(_0x3d95fd,null))['catch'](handleError(_0x3d95fd,null));};exports[_0x8c4d('0x47')]=function(_0x3aca1e,_0x134eb0){return db[_0x8c4d('0x40')][_0x8c4d('0x47')](_0x3aca1e['body'],{})[_0x8c4d('0x25')](function(_0x1b7801){var _0x3018e2=_0x3aca1e[_0x8c4d('0x48')]['get']({'plain':!![]});if(!_0x3018e2)throw new Error(_0x8c4d('0x49'));if(_0x3018e2[_0x8c4d('0x4a')]===_0x8c4d('0x48')){var _0x30f5fe=_0x1b7801[_0x8c4d('0x26')]({'plain':!![]});var _0x2a25ed=_0x8c4d('0x4b');return db[_0x8c4d('0x4c')][_0x8c4d('0x4d')]({'where':{'name':_0x2a25ed,'userProfileId':_0x3018e2[_0x8c4d('0x4e')]},'raw':!![]})[_0x8c4d('0x25')](function(_0x219533){if(_0x219533&&_0x219533[_0x8c4d('0x4f')]===0x0){return db[_0x8c4d('0x27')][_0x8c4d('0x47')]({'name':_0x30f5fe[_0x8c4d('0x2a')],'resourceId':_0x30f5fe['id'],'type':_0x219533[_0x8c4d('0x2a')],'sectionId':_0x219533['id']},{})[_0x8c4d('0x25')](function(){return _0x1b7801;});}else{return _0x1b7801;}})[_0x8c4d('0x43')](function(_0x3909b5){logger['error'](_0x8c4d('0x50'),_0x3909b5);throw _0x3909b5;});}return _0x1b7801;})[_0x8c4d('0x25')](respondWithResult(_0x134eb0,0xc9))['catch'](handleError(_0x134eb0,null));};exports[_0x8c4d('0x23')]=function(_0x369656,_0x292179){if(_0x369656[_0x8c4d('0x51')]['id']){delete _0x369656[_0x8c4d('0x51')]['id'];}return db[_0x8c4d('0x40')]['find']({'where':{'id':_0x369656['params']['id']}})['then'](handleEntityNotFound(_0x292179,null))['then'](saveUpdates(_0x369656['body'],null))['then'](respondWithResult(_0x292179,null))['catch'](handleError(_0x292179,null));};exports[_0x8c4d('0x24')]=function(_0x4e37ca,_0x53802f){return db[_0x8c4d('0x40')][_0x8c4d('0x4d')]({'where':{'id':_0x4e37ca[_0x8c4d('0x45')]['id']}})['then'](handleEntityNotFound(_0x53802f,null))[_0x8c4d('0x25')](removeEntity(_0x53802f,null))[_0x8c4d('0x43')](handleError(_0x53802f,null));};exports[_0x8c4d('0x52')]=function(_0x3b94b2,_0x36006d,_0x3c0123){return db['VoiceMail']['findOne']({'where':{'id':_0x3b94b2[_0x8c4d('0x45')]['id']}})[_0x8c4d('0x25')](handleEntityNotFound(_0x36006d,null))[_0x8c4d('0x25')](function(_0x9b7e0c){var _0x40fc8c;var _0x20ef3e={},_0x13f70a={};_0x13f70a[_0x8c4d('0x2f')]=_['keys'](db[_0x8c4d('0x53')][_0x8c4d('0x2e')]);_0x13f70a[_0x8c4d('0x30')]=_['keys'](_0x3b94b2[_0x8c4d('0x30')]);_0x13f70a['filters']=_[_0x8c4d('0x46')](_0x13f70a['model'],_0x13f70a[_0x8c4d('0x30')]);_0x20ef3e[_0x8c4d('0x32')]=_[_0x8c4d('0x46')](_0x13f70a[_0x8c4d('0x2f')],qs[_0x8c4d('0x33')](_0x3b94b2[_0x8c4d('0x30')]['fields']));_0x20ef3e[_0x8c4d('0x32')]=_0x20ef3e[_0x8c4d('0x32')][_0x8c4d('0x54')]?_0x20ef3e[_0x8c4d('0x32')]:_0x13f70a[_0x8c4d('0x2f')];if(!_0x3b94b2[_0x8c4d('0x30')]['hasOwnProperty'](_0x8c4d('0x35'))){_0x20ef3e[_0x8c4d('0x1d')]=qs[_0x8c4d('0x1d')](_0x3b94b2[_0x8c4d('0x30')]['limit']);_0x20ef3e[_0x8c4d('0x1c')]=qs['offset'](_0x3b94b2['query']['offset']);}_0x20ef3e[_0x8c4d('0x36')]=qs[_0x8c4d('0x37')](_0x3b94b2[_0x8c4d('0x30')][_0x8c4d('0x37')]);_0x20ef3e['where']=qs[_0x8c4d('0x39')](_[_0x8c4d('0x3a')](_0x3b94b2['query'],_0x13f70a[_0x8c4d('0x39')]));if(_0x3b94b2[_0x8c4d('0x30')][_0x8c4d('0x3b')]){_0x20ef3e[_0x8c4d('0x38')]=_['merge'](_0x20ef3e['where'],{'$or':_[_0x8c4d('0x2d')](_0x20ef3e[_0x8c4d('0x32')],function(_0x5dcd1a){var _0x3a0db2={};_0x3a0db2[_0x5dcd1a]={'$like':'%'+_0x3b94b2[_0x8c4d('0x30')][_0x8c4d('0x3b')]+'%'};return _0x3a0db2;})});}_0x20ef3e[_0x8c4d('0x38')]=_['merge'](_0x20ef3e[_0x8c4d('0x38')],{'mailboxuser':_0x9b7e0c['mailbox']});_0x20ef3e=_[_0x8c4d('0x3c')]({},_0x20ef3e,_0x3b94b2[_0x8c4d('0x3f')]);return db[_0x8c4d('0x53')][_0x8c4d('0x55')](_0x20ef3e)[_0x8c4d('0x25')](respondWithFilteredResult(_0x36006d,_0x20ef3e));})[_0x8c4d('0x43')](handleError(_0x36006d,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 88760a9..b9d7c27 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 _0xf4a9=['request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','context','lodash','util','api','moment'];(function(_0x4cb231,_0x3d3c5b){var _0x4d5063=function(_0x4af9d0){while(--_0x4af9d0){_0x4cb231['push'](_0x4cb231['shift']());}};_0x4d5063(++_0x3d3c5b);}(_0xf4a9,0x164));var _0x9f4a=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0xf4a9[_0x56e4e7];return _0x383618;};'use strict';var _=require(_0x9f4a('0x0'));var util=require(_0x9f4a('0x1'));var logger=require('../../config/logger')(_0x9f4a('0x2'));var moment=require(_0x9f4a('0x3'));var BPromise=require('bluebird');var rp=require(_0x9f4a('0x4'));var fs=require('fs');var path=require(_0x9f4a('0x5'));var rimraf=require(_0x9f4a('0x6'));var config=require(_0x9f4a('0x7'));var attributes=require(_0x9f4a('0x8'));module[_0x9f4a('0x9')]=function(_0x2b3b2c,_0x12aec2){return _0x2b3b2c[_0x9f4a('0xa')](_0x9f4a('0xb'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x9f4a('0xc'),'fields':[_0x9f4a('0xd'),_0x9f4a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc1c=['bluebird','path','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','api'];(function(_0x14a8bd,_0x2dcdcc){var _0x21f9e7=function(_0x2eb408){while(--_0x2eb408){_0x14a8bd['push'](_0x14a8bd['shift']());}};_0x21f9e7(++_0x2dcdcc);}(_0xbc1c,0x98));var _0xcbc1=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0xbc1c[_0x4314d7];return _0x5c599b;};'use strict';var _=require(_0xcbc1('0x0'));var util=require(_0xcbc1('0x1'));var logger=require(_0xcbc1('0x2'))(_0xcbc1('0x3'));var moment=require('moment');var BPromise=require(_0xcbc1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcbc1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcbc1('0x6'));module['exports']=function(_0x533988,_0x2e4f2b){return _0x533988[_0xcbc1('0x7')](_0xcbc1('0x8'),attributes,{'tableName':_0xcbc1('0x9'),'paranoid':![],'indexes':[{'name':_0xcbc1('0xa'),'fields':['mailbox',_0xcbc1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 8f81e1a..6a756f2 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 _0x2296=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4a249e,_0x30c270){var _0x4168a4=function(_0x21a830){while(--_0x21a830){_0x4a249e['push'](_0x4a249e['shift']());}};_0x4168a4(++_0x30c270);}(_0x2296,0x1bc));var _0x6229=function(_0x566b53,_0x25de30){_0x566b53=_0x566b53-0x0;var _0x29c174=_0x2296[_0x566b53];return _0x29c174;};'use strict';var _=require(_0x6229('0x0'));var util=require(_0x6229('0x1'));var moment=require('moment');var BPromise=require(_0x6229('0x2'));var rs=require(_0x6229('0x3'));var fs=require('fs');var Redis=require(_0x6229('0x4'));var db=require(_0x6229('0x5'))['db'];var utils=require(_0x6229('0x6'));var logger=require(_0x6229('0x7'))(_0x6229('0x8'));var config=require(_0x6229('0x9'));var jayson=require(_0x6229('0xa'));var client=jayson[_0x6229('0xb')][_0x6229('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ecb88,_0x1224ec,_0x16dba8){return new BPromise(function(_0x181818,_0x57ee81){return client[_0x6229('0xd')](_0x1ecb88,_0x16dba8)[_0x6229('0xe')](function(_0x265569){logger[_0x6229('0xf')](_0x6229('0x10'),_0x1224ec,_0x6229('0x11'));logger[_0x6229('0x12')](_0x6229('0x13'),_0x1224ec,_0x6229('0x11'),JSON[_0x6229('0x14')](_0x265569));if(_0x265569['error']){if(_0x265569[_0x6229('0x15')]['code']===0x1f4){logger[_0x6229('0x15')]('VoiceMail,\x20%s,\x20%s',_0x1224ec,_0x265569[_0x6229('0x15')][_0x6229('0x16')]);return _0x57ee81(_0x265569['error'][_0x6229('0x16')]);}logger[_0x6229('0x15')](_0x6229('0x10'),_0x1224ec,_0x265569['error']['message']);return _0x181818(_0x265569[_0x6229('0x15')]['message']);}else{logger[_0x6229('0xf')]('VoiceMail,\x20%s,\x20%s',_0x1224ec,_0x6229('0x11'));_0x181818(_0x265569[_0x6229('0x17')][_0x6229('0x16')]);}})[_0x6229('0x18')](function(_0x4ae43c){logger[_0x6229('0x15')](_0x6229('0x10'),_0x1224ec,_0x4ae43c);_0x57ee81(_0x4ae43c);});});} \ No newline at end of file +var _0xecdf=['http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client'];(function(_0x200960,_0x36ea91){var _0x188d9f=function(_0x2d1f4a){while(--_0x2d1f4a){_0x200960['push'](_0x200960['shift']());}};_0x188d9f(++_0x36ea91);}(_0xecdf,0x171));var _0xfecd=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xecdf[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xfecd('0x0'));var util=require(_0xfecd('0x1'));var moment=require(_0xfecd('0x2'));var BPromise=require(_0xfecd('0x3'));var rs=require(_0xfecd('0x4'));var fs=require('fs');var Redis=require(_0xfecd('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfecd('0x6'));var config=require(_0xfecd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfecd('0x8')][_0xfecd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb34130,_0x43878f,_0x5ddd80){return new BPromise(function(_0x1aaa81,_0x15f9d1){return client[_0xfecd('0xa')](_0xb34130,_0x5ddd80)[_0xfecd('0xb')](function(_0xc8100){logger['info'](_0xfecd('0xc'),_0x43878f,_0xfecd('0xd'));logger['debug'](_0xfecd('0xe'),_0x43878f,_0xfecd('0xd'),JSON[_0xfecd('0xf')](_0xc8100));if(_0xc8100[_0xfecd('0x10')]){if(_0xc8100[_0xfecd('0x10')][_0xfecd('0x11')]===0x1f4){logger[_0xfecd('0x10')]('VoiceMail,\x20%s,\x20%s',_0x43878f,_0xc8100['error'][_0xfecd('0x12')]);return _0x15f9d1(_0xc8100[_0xfecd('0x10')][_0xfecd('0x12')]);}logger[_0xfecd('0x10')](_0xfecd('0xc'),_0x43878f,_0xc8100[_0xfecd('0x10')][_0xfecd('0x12')]);return _0x1aaa81(_0xc8100['error'][_0xfecd('0x12')]);}else{logger[_0xfecd('0x13')](_0xfecd('0xc'),_0x43878f,'request\x20sent');_0x1aaa81(_0xc8100[_0xfecd('0x14')][_0xfecd('0x12')]);}})['catch'](function(_0x15dee8){logger[_0xfecd('0x10')](_0xfecd('0xc'),_0x43878f,_0x15dee8);_0x15f9d1(_0x15dee8);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 6e9d2d9..51cf77a 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 _0xc6ac=['show','download','post','create','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index'];(function(_0x1f31f8,_0x50eadd){var _0x4c3697=function(_0x10b075){while(--_0x10b075){_0x1f31f8['push'](_0x1f31f8['shift']());}};_0x4c3697(++_0x50eadd);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x5ecc3b,_0x597ddd){_0x5ecc3b=_0x5ecc3b-0x0;var _0xa6571d=_0xc6ac[_0x5ecc3b];return _0xa6571d;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var auth=require(_0xcc6a('0x6'));var interaction=require(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var controller=require(_0xcc6a('0x9'));router[_0xcc6a('0xa')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xc')]);router[_0xcc6a('0xa')]('/:id',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xd')]);router[_0xcc6a('0xa')]('/:id/download',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xe')]);router[_0xcc6a('0xf')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x10')]);router['put'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x12')]);router['delete'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x13')]);module['exports']=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(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x814b,0x1a2));var _0xb814=function(_0x1f16de,_0x548eb9){_0x1f16de=_0x1f16de-0x0;var _0x36cd80=_0x814b[_0x1f16de];return _0x36cd80;};'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 b448427..6a1760b 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 _0x2cb8=['VIRTUAL','getDataValue','INTEGER','STRING','sequelize','exports'];(function(_0x4eab61,_0x1a6e6d){var _0x342426=function(_0xc6338a){while(--_0xc6338a){_0x4eab61['push'](_0x4eab61['shift']());}};_0x342426(++_0x1a6e6d);}(_0x2cb8,0xa0));var _0x82cb=function(_0x23dbb6,_0x47d37e){_0x23dbb6=_0x23dbb6-0x0;var _0x437650=_0x2cb8[_0x23dbb6];return _0x437650;};'use strict';var Sequelize=require(_0x82cb('0x0'));module[_0x82cb('0x1')]={'name':{'type':Sequelize[_0x82cb('0x2')],'get':function(_0xbb5b15){return this[_0x82cb('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x82cb('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x82cb('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x82cb('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x82cb('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x82cb('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x82cb('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x82cb('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x82cb('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0xb86a=['VIRTUAL','INTEGER','STRING','BLOB','TIMESTAMP','sequelize','exports'];(function(_0x1733cf,_0x372cb7){var _0x47f476=function(_0x492521){while(--_0x492521){_0x1733cf['push'](_0x1733cf['shift']());}};_0x47f476(++_0x372cb7);}(_0xb86a,0x124));var _0xab86=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xb86a[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0xab86('0x0'));module[_0xab86('0x1')]={'name':{'type':Sequelize[_0xab86('0x2')],'get':function(_0x3fb0cb){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xab86('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xab86('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xab86('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xab86('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xab86('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xab86('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xab86('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xab86('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xab86('0x4')],'defaultValue':''},'stamp':{'type':_0xab86('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index d7a9fad..d037c35 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 _0xb6c7=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','update','then','sendStatus','error','name','send','index','map','VoiceMailMessage','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','show','find','create','body','catch','destroy','params','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','.wav\x22','html-pdf'];(function(_0x4a7193,_0x556c6a){var _0xc33d94=function(_0x3b7b34){while(--_0x3b7b34){_0x4a7193['push'](_0x4a7193['shift']());}};_0xc33d94(++_0x556c6a);}(_0xb6c7,0xf5));var _0x7b6c=function(_0x224148,_0x5ab314){_0x224148=_0x224148-0x0;var _0x6d0fbc=_0xb6c7[_0x224148];return _0x6d0fbc;};'use strict';var pdf=require(_0x7b6c('0x0'));var emlformat=require(_0x7b6c('0x1'));var rimraf=require(_0x7b6c('0x2'));var zipdir=require(_0x7b6c('0x3'));var jsonpatch=require(_0x7b6c('0x4'));var rp=require(_0x7b6c('0x5'));var moment=require('moment');var BPromise=require(_0x7b6c('0x6'));var Mustache=require(_0x7b6c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7b6c('0x8'));var csv=require('to-csv');var ejs=require(_0x7b6c('0x9'));var fs=require('fs');var _=require(_0x7b6c('0xa'));var squel=require(_0x7b6c('0xb'));var crypto=require(_0x7b6c('0xc'));var jsforce=require(_0x7b6c('0xd'));var deskjs=require(_0x7b6c('0xe'));var toCsv=require(_0x7b6c('0xf'));var querystring=require(_0x7b6c('0x10'));var Papa=require(_0x7b6c('0x11'));var Redis=require(_0x7b6c('0x12'));var authService=require(_0x7b6c('0x13'));var qs=require(_0x7b6c('0x14'));var as=require(_0x7b6c('0x15'));var hardwareService=require(_0x7b6c('0x16'));var logger=require(_0x7b6c('0x17'))('api');var utils=require(_0x7b6c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7b6c('0x19'));var db=require(_0x7b6c('0x1a'))['db'];function respondWithStatusCode(_0x2dbcf7,_0x5bab05){_0x5bab05=_0x5bab05||0xcc;return function(_0x3b3596){if(_0x3b3596){return _0x2dbcf7['sendStatus'](_0x5bab05);}return _0x2dbcf7[_0x7b6c('0x1b')](_0x5bab05)[_0x7b6c('0x1c')]();};}function respondWithResult(_0x2cdabb,_0x346a02){_0x346a02=_0x346a02||0xc8;return function(_0x325918){if(_0x325918){return _0x2cdabb[_0x7b6c('0x1b')](_0x346a02)['json'](_0x325918);}};}function respondWithFilteredResult(_0x42fb58,_0x2e2657){return function(_0x25d0cd){if(_0x25d0cd){var _0x5abc81=_0x25d0cd[_0x7b6c('0x1d')],_0x1eae3e=_0x2e2657[_0x7b6c('0x1e')],_0xe5c739=_0x2e2657[_0x7b6c('0x1e')]+_0x2e2657[_0x7b6c('0x1f')],_0x8df8f0;if(_0xe5c739>=_0x5abc81){_0xe5c739=_0x5abc81;_0x8df8f0=0xc8;}else{_0x8df8f0=0xce;}_0x42fb58['status'](_0x8df8f0);return _0x42fb58[_0x7b6c('0x20')](_0x7b6c('0x21'),_0x1eae3e+'-'+_0xe5c739+'/'+_0x5abc81)[_0x7b6c('0x22')](_0x25d0cd);}return null;};}function patchUpdates(_0x2f4b27){return function(_0x5299c4){try{jsonpatch['apply'](_0x5299c4,_0x2f4b27,!![]);}catch(_0x1ef1f2){return BPromise[_0x7b6c('0x23')](_0x1ef1f2);}return _0x5299c4['save']();};}function saveUpdates(_0x58586d,_0x1ee615){return function(_0x58ec7a){if(_0x58ec7a){return _0x58ec7a[_0x7b6c('0x24')](_0x58586d)[_0x7b6c('0x25')](function(_0x60b8c8){return _0x60b8c8;});}return null;};}function removeEntity(_0x1aabad,_0x39deb5){return function(_0xaa5b0){if(_0xaa5b0){return _0xaa5b0['destroy']()[_0x7b6c('0x25')](function(){_0x1aabad[_0x7b6c('0x1b')](0xcc)[_0x7b6c('0x1c')]();});}};}function handleEntityNotFound(_0x9c3d62,_0x4fa556){return function(_0xae220d){if(!_0xae220d){_0x9c3d62[_0x7b6c('0x26')](0x194);}return _0xae220d;};}function handleError(_0x114a21,_0x36dd7e){_0x36dd7e=_0x36dd7e||0x1f4;return function(_0x240aa0){logger[_0x7b6c('0x27')](_0x240aa0['stack']);if(_0x240aa0[_0x7b6c('0x28')]){delete _0x240aa0[_0x7b6c('0x28')];}_0x114a21[_0x7b6c('0x1b')](_0x36dd7e)[_0x7b6c('0x29')](_0x240aa0);};}exports[_0x7b6c('0x2a')]=function(_0x3051aa,_0x34d1e7){var _0x500d71={},_0x5a9800={},_0x2e373={'count':0x0,'rows':[]};var _0x4bfb63=_[_0x7b6c('0x2b')](db[_0x7b6c('0x2c')][_0x7b6c('0x2d')],function(_0x248055){return{'name':_0x248055['fieldName'],'type':_0x248055[_0x7b6c('0x2e')][_0x7b6c('0x2f')]};});_0x5a9800['model']=_['differenceBy'](_[_0x7b6c('0x2b')](_0x4bfb63,_0x7b6c('0x28')),[_0x7b6c('0x28')]);_0x5a9800[_0x7b6c('0x30')]=_[_0x7b6c('0x31')](_0x3051aa[_0x7b6c('0x30')]);_0x5a9800['filters']=_['intersection'](_0x5a9800[_0x7b6c('0x32')],_0x5a9800['query']);_0x500d71[_0x7b6c('0x33')]=_[_0x7b6c('0x34')](_0x5a9800[_0x7b6c('0x32')],qs[_0x7b6c('0x35')](_0x3051aa[_0x7b6c('0x30')][_0x7b6c('0x35')]));_0x500d71[_0x7b6c('0x33')]=_0x500d71['attributes'][_0x7b6c('0x36')]?_0x500d71[_0x7b6c('0x33')]:_0x5a9800[_0x7b6c('0x32')];if(!_0x3051aa['query'][_0x7b6c('0x37')]('nolimit')){_0x500d71[_0x7b6c('0x1f')]=qs[_0x7b6c('0x1f')](_0x3051aa[_0x7b6c('0x30')][_0x7b6c('0x1f')]);_0x500d71[_0x7b6c('0x1e')]=qs[_0x7b6c('0x1e')](_0x3051aa[_0x7b6c('0x30')][_0x7b6c('0x1e')]);}_0x500d71['order']=qs[_0x7b6c('0x38')](_0x3051aa['query'][_0x7b6c('0x38')]);_0x500d71['where']=qs[_0x7b6c('0x39')](_[_0x7b6c('0x3a')](_0x3051aa[_0x7b6c('0x30')],_0x5a9800[_0x7b6c('0x39')]),_0x4bfb63);if(_0x3051aa[_0x7b6c('0x30')][_0x7b6c('0x3b')]){_0x500d71[_0x7b6c('0x3c')]=_['merge'](_0x500d71[_0x7b6c('0x3c')],{'$or':_[_0x7b6c('0x2b')](_0x4bfb63,function(_0x572f70){if(_0x572f70['type']!==_0x7b6c('0x3d')){var _0x1fcbb9={};_0x1fcbb9[_0x572f70['name']]={'$like':'%'+_0x3051aa[_0x7b6c('0x30')][_0x7b6c('0x3b')]+'%'};return _0x1fcbb9;}})});}_0x500d71=_[_0x7b6c('0x3e')]({},_0x500d71,_0x3051aa[_0x7b6c('0x3f')]);var _0xa85169={'where':_0x500d71[_0x7b6c('0x3c')]};return db[_0x7b6c('0x2c')][_0x7b6c('0x1d')](_0xa85169)[_0x7b6c('0x25')](function(_0x1c767c){_0x2e373[_0x7b6c('0x1d')]=_0x1c767c;if(_0x3051aa[_0x7b6c('0x30')][_0x7b6c('0x40')]){_0x500d71[_0x7b6c('0x41')]=[{'all':!![]}];}return db[_0x7b6c('0x2c')]['findAll'](_0x500d71);})['then'](function(_0x56b8f4){_0x2e373[_0x7b6c('0x42')]=_0x56b8f4;return _0x2e373;})['then'](respondWithFilteredResult(_0x34d1e7,_0x500d71))['catch'](handleError(_0x34d1e7,null));};exports[_0x7b6c('0x43')]=function(_0x3aad48,_0x5b05fe){var _0x26e146={'raw':!![],'where':{'id':_0x3aad48['params']['id']}},_0x386967={};_0x386967[_0x7b6c('0x32')]=_[_0x7b6c('0x31')](db['VoiceMailMessage'][_0x7b6c('0x2d')]);_0x386967[_0x7b6c('0x30')]=_[_0x7b6c('0x31')](_0x3aad48[_0x7b6c('0x30')]);_0x386967['filters']=_[_0x7b6c('0x34')](_0x386967[_0x7b6c('0x32')],_0x386967[_0x7b6c('0x30')]);_0x26e146['attributes']=_[_0x7b6c('0x34')](_0x386967[_0x7b6c('0x32')],qs[_0x7b6c('0x35')](_0x3aad48[_0x7b6c('0x30')][_0x7b6c('0x35')]));_0x26e146[_0x7b6c('0x33')]=_0x26e146[_0x7b6c('0x33')][_0x7b6c('0x36')]?_0x26e146[_0x7b6c('0x33')]:_0x386967[_0x7b6c('0x32')];if(_0x3aad48['query'][_0x7b6c('0x40')]){_0x26e146[_0x7b6c('0x41')]=[{'all':!![]}];}_0x26e146=_[_0x7b6c('0x3e')]({},_0x26e146,_0x3aad48[_0x7b6c('0x3f')]);return db[_0x7b6c('0x2c')][_0x7b6c('0x44')](_0x26e146)[_0x7b6c('0x25')](handleEntityNotFound(_0x5b05fe,null))['then'](respondWithResult(_0x5b05fe,null))['catch'](handleError(_0x5b05fe,null));};exports[_0x7b6c('0x45')]=function(_0x2d027f,_0x5ee3bf){return db[_0x7b6c('0x2c')][_0x7b6c('0x45')](_0x2d027f[_0x7b6c('0x46')],{})[_0x7b6c('0x25')](respondWithResult(_0x5ee3bf,0xc9))[_0x7b6c('0x47')](handleError(_0x5ee3bf,null));};exports['update']=function(_0x37424b,_0x4dc04c){if(_0x37424b[_0x7b6c('0x46')]['id']){delete _0x37424b[_0x7b6c('0x46')]['id'];}return db['VoiceMailMessage'][_0x7b6c('0x44')]({'where':{'id':_0x37424b['params']['id']}})[_0x7b6c('0x25')](handleEntityNotFound(_0x4dc04c,null))[_0x7b6c('0x25')](saveUpdates(_0x37424b[_0x7b6c('0x46')],null))['then'](respondWithResult(_0x4dc04c,null))[_0x7b6c('0x47')](handleError(_0x4dc04c,null));};exports[_0x7b6c('0x48')]=function(_0x65105e,_0x143f67){return db[_0x7b6c('0x2c')][_0x7b6c('0x44')]({'where':{'id':_0x65105e[_0x7b6c('0x49')]['id']}})[_0x7b6c('0x25')](handleEntityNotFound(_0x143f67,null))[_0x7b6c('0x25')](removeEntity(_0x143f67,null))[_0x7b6c('0x47')](handleError(_0x143f67,null));};exports[_0x7b6c('0x4a')]=function(_0x1243cc,_0x530787,_0x3f1046){return db[_0x7b6c('0x2c')][_0x7b6c('0x44')]({'where':{'id':_0x1243cc[_0x7b6c('0x49')]['id']},'attributes':['id',_0x7b6c('0x4b'),_0x7b6c('0x4c')]})['then'](handleEntityNotFound(_0x530787,null))['then'](function(_0x50ac0b){if(_0x50ac0b){if(!_0x50ac0b[_0x7b6c('0x4b')]){throw new db[(_0x7b6c('0x4d'))]['ValidationError'](_0x7b6c('0x4e'));}var _0x1b9a65={'Content-Type':'audio/wav','Content-Disposition':_0x7b6c('0x4f')};if(_0x50ac0b[_0x7b6c('0x4c')]){_0x1b9a65[_0x7b6c('0x50')]='attachment;\x20filename=\x22'+_0x50ac0b[_0x7b6c('0x4c')]+_0x7b6c('0x51');}_0x530787['set'](_0x1b9a65);return _0x530787[_0x7b6c('0x29')](new Buffer(_0x50ac0b['recording']));}})['catch'](handleError(_0x530787,null));}; \ No newline at end of file +var _0x8d13=['jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','save','update','then','destroy','sendStatus','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','key','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','keys','filters','find','create','body','params','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8d13,0x18b));var _0x38d1=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8d13[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x38d1('0x0'));var emlformat=require(_0x38d1('0x1'));var rimraf=require(_0x38d1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38d1('0x3'));var rp=require(_0x38d1('0x4'));var moment=require(_0x38d1('0x5'));var BPromise=require(_0x38d1('0x6'));var Mustache=require(_0x38d1('0x7'));var util=require(_0x38d1('0x8'));var path=require(_0x38d1('0x9'));var sox=require(_0x38d1('0xa'));var csv=require('to-csv');var ejs=require(_0x38d1('0xb'));var fs=require('fs');var _=require(_0x38d1('0xc'));var squel=require(_0x38d1('0xd'));var crypto=require(_0x38d1('0xe'));var jsforce=require(_0x38d1('0xf'));var deskjs=require(_0x38d1('0x10'));var toCsv=require(_0x38d1('0x11'));var querystring=require(_0x38d1('0x12'));var Papa=require('papaparse');var Redis=require(_0x38d1('0x13'));var authService=require(_0x38d1('0x14'));var qs=require(_0x38d1('0x15'));var as=require(_0x38d1('0x16'));var hardwareService=require(_0x38d1('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x38d1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x38d1('0x19'));var db=require(_0x38d1('0x1a'))['db'];function respondWithStatusCode(_0x5c1379,_0x5558e8){_0x5558e8=_0x5558e8||0xcc;return function(_0x5e2745){if(_0x5e2745){return _0x5c1379['sendStatus'](_0x5558e8);}return _0x5c1379['status'](_0x5558e8)['end']();};}function respondWithResult(_0x41046c,_0x24870f){_0x24870f=_0x24870f||0xc8;return function(_0x39aa0c){if(_0x39aa0c){return _0x41046c[_0x38d1('0x1b')](_0x24870f)[_0x38d1('0x1c')](_0x39aa0c);}};}function respondWithFilteredResult(_0x27e3b7,_0x1b2f85){return function(_0x44d4e9){if(_0x44d4e9){var _0x2175ac=_0x44d4e9[_0x38d1('0x1d')],_0x4da010=_0x1b2f85[_0x38d1('0x1e')],_0x4bdfd3=_0x1b2f85[_0x38d1('0x1e')]+_0x1b2f85[_0x38d1('0x1f')],_0x47bdd1;if(_0x4bdfd3>=_0x2175ac){_0x4bdfd3=_0x2175ac;_0x47bdd1=0xc8;}else{_0x47bdd1=0xce;}_0x27e3b7[_0x38d1('0x1b')](_0x47bdd1);return _0x27e3b7[_0x38d1('0x20')](_0x38d1('0x21'),_0x4da010+'-'+_0x4bdfd3+'/'+_0x2175ac)['json'](_0x44d4e9);}return null;};}function patchUpdates(_0x589570){return function(_0x5cf642){try{jsonpatch['apply'](_0x5cf642,_0x589570,!![]);}catch(_0x3c8bec){return BPromise['reject'](_0x3c8bec);}return _0x5cf642[_0x38d1('0x22')]();};}function saveUpdates(_0x1c1f73,_0x50ae28){return function(_0x2c026f){if(_0x2c026f){return _0x2c026f[_0x38d1('0x23')](_0x1c1f73)[_0x38d1('0x24')](function(_0x2d5e41){return _0x2d5e41;});}return null;};}function removeEntity(_0x4a279c,_0x55ab84){return function(_0x234005){if(_0x234005){return _0x234005[_0x38d1('0x25')]()[_0x38d1('0x24')](function(){_0x4a279c[_0x38d1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26a835,_0x4caeaa){return function(_0x5870a1){if(!_0x5870a1){_0x26a835[_0x38d1('0x26')](0x194);}return _0x5870a1;};}function handleError(_0x275bb5,_0x53e06d){_0x53e06d=_0x53e06d||0x1f4;return function(_0x1e7870){logger['error'](_0x1e7870[_0x38d1('0x27')]);if(_0x1e7870[_0x38d1('0x28')]){delete _0x1e7870[_0x38d1('0x28')];}_0x275bb5[_0x38d1('0x1b')](_0x53e06d)[_0x38d1('0x29')](_0x1e7870);};}exports['index']=function(_0x5c8efc,_0x22640){var _0x362a93={},_0x3ad29c={},_0x11789d={'count':0x0,'rows':[]};var _0x16ed2f=_[_0x38d1('0x2a')](db[_0x38d1('0x2b')][_0x38d1('0x2c')],function(_0x22b365){return{'name':_0x22b365[_0x38d1('0x2d')],'type':_0x22b365['type'][_0x38d1('0x2e')]};});_0x3ad29c['model']=_['differenceBy'](_[_0x38d1('0x2a')](_0x16ed2f,_0x38d1('0x28')),[_0x38d1('0x28')]);_0x3ad29c[_0x38d1('0x2f')]=_['keys'](_0x5c8efc[_0x38d1('0x2f')]);_0x3ad29c['filters']=_[_0x38d1('0x30')](_0x3ad29c['model'],_0x3ad29c[_0x38d1('0x2f')]);_0x362a93[_0x38d1('0x31')]=_[_0x38d1('0x30')](_0x3ad29c['model'],qs[_0x38d1('0x32')](_0x5c8efc[_0x38d1('0x2f')]['fields']));_0x362a93['attributes']=_0x362a93['attributes'][_0x38d1('0x33')]?_0x362a93[_0x38d1('0x31')]:_0x3ad29c[_0x38d1('0x34')];if(!_0x5c8efc[_0x38d1('0x2f')][_0x38d1('0x35')](_0x38d1('0x36'))){_0x362a93[_0x38d1('0x1f')]=qs[_0x38d1('0x1f')](_0x5c8efc[_0x38d1('0x2f')][_0x38d1('0x1f')]);_0x362a93['offset']=qs[_0x38d1('0x1e')](_0x5c8efc['query']['offset']);}_0x362a93[_0x38d1('0x37')]=qs[_0x38d1('0x38')](_0x5c8efc[_0x38d1('0x2f')][_0x38d1('0x38')]);_0x362a93['where']=qs['filters'](_[_0x38d1('0x39')](_0x5c8efc[_0x38d1('0x2f')],_0x3ad29c['filters']),_0x16ed2f);if(_0x5c8efc[_0x38d1('0x2f')][_0x38d1('0x3a')]){_0x362a93[_0x38d1('0x3b')]=_[_0x38d1('0x3c')](_0x362a93[_0x38d1('0x3b')],{'$or':_['map'](_0x16ed2f,function(_0x45ff8a){if(_0x45ff8a['type']!=='VIRTUAL'){var _0x5d39bb={};_0x5d39bb[_0x45ff8a['name']]={'$like':'%'+_0x5c8efc[_0x38d1('0x2f')]['filter']+'%'};return _0x5d39bb;}})});}_0x362a93=_['merge']({},_0x362a93,_0x5c8efc['options']);var _0x3c0c6a={'where':_0x362a93[_0x38d1('0x3b')]};return db[_0x38d1('0x2b')][_0x38d1('0x1d')](_0x3c0c6a)[_0x38d1('0x24')](function(_0xe4f25f){_0x11789d['count']=_0xe4f25f;if(_0x5c8efc[_0x38d1('0x2f')][_0x38d1('0x3d')]){_0x362a93[_0x38d1('0x3e')]=[{'all':!![]}];}return db[_0x38d1('0x2b')][_0x38d1('0x3f')](_0x362a93);})[_0x38d1('0x24')](function(_0x1e3942){_0x11789d[_0x38d1('0x40')]=_0x1e3942;return _0x11789d;})[_0x38d1('0x24')](respondWithFilteredResult(_0x22640,_0x362a93))[_0x38d1('0x41')](handleError(_0x22640,null));};exports[_0x38d1('0x42')]=function(_0x8cdee5,_0xe44f02){var _0x1431f9={'raw':!![],'where':{'id':_0x8cdee5['params']['id']}},_0x5e47b6={};_0x5e47b6['model']=_['keys'](db['VoiceMailMessage'][_0x38d1('0x2c')]);_0x5e47b6[_0x38d1('0x2f')]=_[_0x38d1('0x43')](_0x8cdee5[_0x38d1('0x2f')]);_0x5e47b6[_0x38d1('0x44')]=_['intersection'](_0x5e47b6[_0x38d1('0x34')],_0x5e47b6[_0x38d1('0x2f')]);_0x1431f9[_0x38d1('0x31')]=_['intersection'](_0x5e47b6[_0x38d1('0x34')],qs[_0x38d1('0x32')](_0x8cdee5[_0x38d1('0x2f')][_0x38d1('0x32')]));_0x1431f9[_0x38d1('0x31')]=_0x1431f9[_0x38d1('0x31')][_0x38d1('0x33')]?_0x1431f9[_0x38d1('0x31')]:_0x5e47b6[_0x38d1('0x34')];if(_0x8cdee5['query'][_0x38d1('0x3d')]){_0x1431f9[_0x38d1('0x3e')]=[{'all':!![]}];}_0x1431f9=_['merge']({},_0x1431f9,_0x8cdee5['options']);return db[_0x38d1('0x2b')][_0x38d1('0x45')](_0x1431f9)[_0x38d1('0x24')](handleEntityNotFound(_0xe44f02,null))[_0x38d1('0x24')](respondWithResult(_0xe44f02,null))['catch'](handleError(_0xe44f02,null));};exports['create']=function(_0x135d27,_0x24b26f){return db['VoiceMailMessage'][_0x38d1('0x46')](_0x135d27[_0x38d1('0x47')],{})[_0x38d1('0x24')](respondWithResult(_0x24b26f,0xc9))['catch'](handleError(_0x24b26f,null));};exports[_0x38d1('0x23')]=function(_0x82319,_0x220d0f){if(_0x82319[_0x38d1('0x47')]['id']){delete _0x82319[_0x38d1('0x47')]['id'];}return db[_0x38d1('0x2b')][_0x38d1('0x45')]({'where':{'id':_0x82319[_0x38d1('0x48')]['id']}})['then'](handleEntityNotFound(_0x220d0f,null))[_0x38d1('0x24')](saveUpdates(_0x82319[_0x38d1('0x47')],null))[_0x38d1('0x24')](respondWithResult(_0x220d0f,null))[_0x38d1('0x41')](handleError(_0x220d0f,null));};exports[_0x38d1('0x25')]=function(_0x4bb13d,_0x174bfa){return db[_0x38d1('0x2b')]['find']({'where':{'id':_0x4bb13d[_0x38d1('0x48')]['id']}})['then'](handleEntityNotFound(_0x174bfa,null))[_0x38d1('0x24')](removeEntity(_0x174bfa,null))['catch'](handleError(_0x174bfa,null));};exports[_0x38d1('0x49')]=function(_0x28b711,_0x2c52e6,_0x5b0ad5){return db['VoiceMailMessage'][_0x38d1('0x45')]({'where':{'id':_0x28b711[_0x38d1('0x48')]['id']},'attributes':['id',_0x38d1('0x4a'),_0x38d1('0x4b')]})['then'](handleEntityNotFound(_0x2c52e6,null))['then'](function(_0x2c04ff){if(_0x2c04ff){if(!_0x2c04ff['recording']){throw new db['Sequelize'][(_0x38d1('0x4c'))](_0x38d1('0x4d'));}var _0x3f43f0={'Content-Type':_0x38d1('0x4e'),'Content-Disposition':_0x38d1('0x4f')};if(_0x2c04ff[_0x38d1('0x4b')]){_0x3f43f0['Content-Disposition']=_0x38d1('0x50')+_0x2c04ff[_0x38d1('0x4b')]+_0x38d1('0x51');}_0x2c52e6[_0x38d1('0x20')](_0x3f43f0);return _0x2c52e6[_0x38d1('0x29')](new Buffer(_0x2c04ff[_0x38d1('0x4a')]));}})[_0x38d1('0x41')](handleError(_0x2c52e6,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e0d5a2d..3a7f727 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 _0x67cf=['bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','define','voice_voicemail_messages','dir','lodash','util','api'];(function(_0x3d71f1,_0x28168d){var _0x22108d=function(_0x1bc86e){while(--_0x1bc86e){_0x3d71f1['push'](_0x3d71f1['shift']());}};_0x22108d(++_0x28168d);}(_0x67cf,0xad));var _0xf67c=function(_0x1f1fb4,_0x15a561){_0x1f1fb4=_0x1f1fb4-0x0;var _0x12fa15=_0x67cf[_0x1f1fb4];return _0x12fa15;};'use strict';var _=require(_0xf67c('0x0'));var util=require(_0xf67c('0x1'));var logger=require('../../config/logger')(_0xf67c('0x2'));var moment=require('moment');var BPromise=require(_0xf67c('0x3'));var rp=require(_0xf67c('0x4'));var fs=require('fs');var path=require(_0xf67c('0x5'));var rimraf=require(_0xf67c('0x6'));var config=require('../../config/environment');var attributes=require(_0xf67c('0x7'));module['exports']=function(_0x527b25,_0x1a4afe){return _0x527b25[_0xf67c('0x8')]('VoiceMailMessage',attributes,{'tableName':_0xf67c('0x9'),'paranoid':![],'indexes':[{'name':_0xf67c('0xa'),'fields':[_0xf67c('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5656=['rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5656,0x77));var _0x6565=function(_0x3b5a45,_0x410a8b){_0x3b5a45=_0x3b5a45-0x0;var _0x3ccd13=_0x5656[_0x3b5a45];return _0x3ccd13;};'use strict';var _=require(_0x6565('0x0'));var util=require(_0x6565('0x1'));var logger=require(_0x6565('0x2'))('api');var moment=require(_0x6565('0x3'));var BPromise=require(_0x6565('0x4'));var rp=require(_0x6565('0x5'));var fs=require('fs');var path=require(_0x6565('0x6'));var rimraf=require(_0x6565('0x7'));var config=require(_0x6565('0x8'));var attributes=require(_0x6565('0x9'));module[_0x6565('0xa')]=function(_0x573c41,_0x13e7e5){return _0x573c41[_0x6565('0xb')](_0x6565('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x6565('0xd'),'fields':[_0x6565('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index f2348a9..a17b2f6 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0xb78f74,_0x2548d1){var _0x465eb1=function(_0x590567){while(--_0x590567){_0xb78f74['push'](_0xb78f74['shift']());}};_0x465eb1(++_0x2548d1);}(_0x14a0,0x8e));var _0x014a=function(_0x485c75,_0x3cb4d7){_0x485c75=_0x485c75-0x0;var _0x44ff37=_0x14a0[_0x485c75];return _0x44ff37;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x5c17b7,_0x18a3c2){var _0x28bb2f=function(_0x51afe5){while(--_0x51afe5){_0x5c17b7['push'](_0x5c17b7['shift']());}};_0x28bb2f(++_0x18a3c2);}(_0x1a85,0x178));var _0x51a8=function(_0x2c10fb,_0x380e1b){_0x2c10fb=_0x2c10fb-0x0;var _0x23e4c0=_0x1a85[_0x2c10fb];return _0x23e4c0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index b11fe12..5ade8df 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 _0x66cd=['removeSound','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2'];(function(_0x1a31a8,_0x3b5148){var _0x3bf43d=function(_0x385a58){while(--_0x385a58){_0x1a31a8['push'](_0x1a31a8['shift']());}};_0x3bf43d(++_0x3b5148);}(_0x66cd,0x1b2));var _0xd66c=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x66cd[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0xd66c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd66c('0x1'));var express=require(_0xd66c('0x2'));var router=express[_0xd66c('0x3')]();var auth=require(_0xd66c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd66c('0x5'));var controller=require(_0xd66c('0x6'));router[_0xd66c('0x7')]('/',auth[_0xd66c('0x8')](),controller[_0xd66c('0x9')]);router['get'](_0xd66c('0xa'),auth[_0xd66c('0x8')](),controller[_0xd66c('0xb')]);router[_0xd66c('0x7')](_0xd66c('0xc'),auth['isAuthenticated'](),controller[_0xd66c('0xd')]);router[_0xd66c('0xe')]('/',auth[_0xd66c('0x8')](),controller[_0xd66c('0xf')]);router['post'](_0xd66c('0xc'),auth[_0xd66c('0x8')](),controller[_0xd66c('0x10')]);router[_0xd66c('0x11')](_0xd66c('0xa'),auth[_0xd66c('0x8')](),controller[_0xd66c('0x12')]);router[_0xd66c('0x13')](_0xd66c('0xa'),auth['isAuthenticated'](),controller[_0xd66c('0x14')]);router[_0xd66c('0x13')](_0xd66c('0x15'),auth[_0xd66c('0x8')](),controller[_0xd66c('0x16')]);module[_0xd66c('0x17')]=router; \ No newline at end of file +var _0xafd9=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds'];(function(_0x5c7e21,_0x55970c){var _0x476dc3=function(_0x45c03a){while(--_0x45c03a){_0x5c7e21['push'](_0x5c7e21['shift']());}};_0x476dc3(++_0x55970c);}(_0xafd9,0xd7));var _0x9afd=function(_0x260f7b,_0x364298){_0x260f7b=_0x260f7b-0x0;var _0x15893c=_0xafd9[_0x260f7b];return _0x15893c;};'use strict';var multer=require(_0x9afd('0x0'));var util=require(_0x9afd('0x1'));var path=require(_0x9afd('0x2'));var timeout=require(_0x9afd('0x3'));var express=require(_0x9afd('0x4'));var router=express[_0x9afd('0x5')]();var auth=require(_0x9afd('0x6'));var interaction=require(_0x9afd('0x7'));var config=require(_0x9afd('0x8'));var controller=require(_0x9afd('0x9'));router[_0x9afd('0xa')]('/',auth[_0x9afd('0xb')](),controller[_0x9afd('0xc')]);router[_0x9afd('0xa')]('/:id',auth[_0x9afd('0xb')](),controller[_0x9afd('0xd')]);router['get'](_0x9afd('0xe'),auth[_0x9afd('0xb')](),controller['getSounds']);router[_0x9afd('0xf')]('/',auth[_0x9afd('0xb')](),controller[_0x9afd('0x10')]);router['post'](_0x9afd('0xe'),auth[_0x9afd('0xb')](),controller['addSound']);router[_0x9afd('0x11')](_0x9afd('0x12'),auth[_0x9afd('0xb')](),controller[_0x9afd('0x13')]);router[_0x9afd('0x14')](_0x9afd('0x12'),auth[_0x9afd('0xb')](),controller[_0x9afd('0x15')]);router[_0x9afd('0x14')]('/:id/sounds/:id2',auth[_0x9afd('0xb')](),controller['removeSound']);module[_0x9afd('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 7b72a43..4201e3b 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 _0x2455=['alpha','BOOLEAN','sequelize','exports','STRING','name','files','mp3nb','quietmp3','mp3'];(function(_0x5b7fb9,_0x2204b3){var _0x104667=function(_0x546b83){while(--_0x546b83){_0x5b7fb9['push'](_0x5b7fb9['shift']());}};_0x104667(++_0x2204b3);}(_0x2455,0x19c));var _0x5245=function(_0x2defb5,_0x1cda14){_0x2defb5=_0x2defb5-0x0;var _0x229c53=_0x2455[_0x2defb5];return _0x229c53;};'use strict';var Sequelize=require(_0x5245('0x0'));module[_0x5245('0x1')]={'name':{'type':Sequelize[_0x5245('0x2')],'allowNull':![],'unique':_0x5245('0x3')},'mode':{'type':Sequelize['ENUM']('custom',_0x5245('0x4'),_0x5245('0x5'),'quietmp3nb',_0x5245('0x6'),_0x5245('0x7')),'allowNull':!![],'defaultValue':_0x5245('0x4')},'directory':{'type':Sequelize[_0x5245('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x5245('0x2')],'allowNull':!![],'defaultValue':_0x5245('0x8')},'format':{'type':Sequelize[_0x5245('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x5245('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6a47=['alpha','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x6a47,0x16d));var _0x76a4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x6a47[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x76a4('0x0'));module[_0x76a4('0x1')]={'name':{'type':Sequelize[_0x76a4('0x2')],'allowNull':![],'unique':_0x76a4('0x3')},'mode':{'type':Sequelize[_0x76a4('0x4')](_0x76a4('0x5'),_0x76a4('0x6'),_0x76a4('0x7'),'quietmp3nb',_0x76a4('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0x76a4('0x6')},'directory':{'type':Sequelize[_0x76a4('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x76a4('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x76a4('0x2')],'allowNull':!![],'defaultValue':_0x76a4('0x9')},'format':{'type':Sequelize[_0x76a4('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x76a4('0xa')],'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 ff634ce..371faf7 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 _0xd9e0=['UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','join','server/files/sounds/converted','format','basename','extname','%s.%s','symlinkSync','removeSound','id2','unlinkSync','getSounds','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','body','find','create','sequelize','transaction','mode','directory','root','server/files/moh','files','mkdirSync','0777','user','role'];(function(_0x4a720e,_0x935be0){var _0x54f945=function(_0x268f44){while(--_0x268f44){_0x4a720e['push'](_0x4a720e['shift']());}};_0x54f945(++_0x935be0);}(_0xd9e0,0xfa));var _0x0d9e=function(_0x39c48b,_0x7db13b){_0x39c48b=_0x39c48b-0x0;var _0x2dbb34=_0xd9e0[_0x39c48b];return _0x2dbb34;};'use strict';var pdf=require(_0x0d9e('0x0'));var emlformat=require(_0x0d9e('0x1'));var rimraf=require(_0x0d9e('0x2'));var zipdir=require(_0x0d9e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d9e('0x4'));var moment=require(_0x0d9e('0x5'));var BPromise=require(_0x0d9e('0x6'));var Mustache=require(_0x0d9e('0x7'));var util=require(_0x0d9e('0x8'));var path=require('path');var sox=require(_0x0d9e('0x9'));var csv=require(_0x0d9e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0d9e('0xb'));var squel=require(_0x0d9e('0xc'));var crypto=require(_0x0d9e('0xd'));var jsforce=require(_0x0d9e('0xe'));var deskjs=require(_0x0d9e('0xf'));var toCsv=require(_0x0d9e('0xa'));var querystring=require(_0x0d9e('0x10'));var Papa=require('papaparse');var Redis=require(_0x0d9e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0d9e('0x12'));var hardwareService=require(_0x0d9e('0x13'));var logger=require(_0x0d9e('0x14'))(_0x0d9e('0x15'));var utils=require(_0x0d9e('0x16'));var config=require(_0x0d9e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d9e('0x18'))['db'];function respondWithStatusCode(_0x3c03e1,_0x13fabd){_0x13fabd=_0x13fabd||0xcc;return function(_0x20086a){if(_0x20086a){return _0x3c03e1[_0x0d9e('0x19')](_0x13fabd);}return _0x3c03e1[_0x0d9e('0x1a')](_0x13fabd)[_0x0d9e('0x1b')]();};}function respondWithResult(_0x3f5dd9,_0x46cc1d){_0x46cc1d=_0x46cc1d||0xc8;return function(_0x4ac741){if(_0x4ac741){return _0x3f5dd9[_0x0d9e('0x1a')](_0x46cc1d)['json'](_0x4ac741);}};}function respondWithFilteredResult(_0x57a7d6,_0x46ff07){return function(_0x36ade0){if(_0x36ade0){var _0x3e68b6=_0x36ade0[_0x0d9e('0x1c')],_0x4bb709=_0x46ff07[_0x0d9e('0x1d')],_0x59ffe8=_0x46ff07[_0x0d9e('0x1d')]+_0x46ff07[_0x0d9e('0x1e')],_0xacd96a;if(_0x59ffe8>=_0x3e68b6){_0x59ffe8=_0x3e68b6;_0xacd96a=0xc8;}else{_0xacd96a=0xce;}_0x57a7d6['status'](_0xacd96a);return _0x57a7d6[_0x0d9e('0x1f')](_0x0d9e('0x20'),_0x4bb709+'-'+_0x59ffe8+'/'+_0x3e68b6)[_0x0d9e('0x21')](_0x36ade0);}return null;};}function patchUpdates(_0x56b8c7){return function(_0x3b3f32){try{jsonpatch['apply'](_0x3b3f32,_0x56b8c7,!![]);}catch(_0x120e1f){return BPromise[_0x0d9e('0x22')](_0x120e1f);}return _0x3b3f32[_0x0d9e('0x23')]();};}function saveUpdates(_0x2fb675,_0x2a0616){return function(_0x34f3b6){if(_0x34f3b6){return _0x34f3b6[_0x0d9e('0x24')](_0x2fb675)[_0x0d9e('0x25')](function(_0x2b39b9){return _0x2b39b9;});}return null;};}function removeEntity(_0x5d5a49,_0x483e02){return function(_0x448a00){if(_0x448a00){return _0x448a00['destroy']()[_0x0d9e('0x25')](function(){var _0x1f2a46=_0x448a00[_0x0d9e('0x26')]({'plain':!![]});var _0x56473d=_0x0d9e('0x27');return db[_0x0d9e('0x28')][_0x0d9e('0x29')]({'where':{'type':_0x56473d,'resourceId':_0x1f2a46['id']}})[_0x0d9e('0x25')](function(){return _0x448a00;});})['then'](function(){_0x5d5a49[_0x0d9e('0x1a')](0xcc)[_0x0d9e('0x1b')]();});}};}function handleEntityNotFound(_0x57b01d,_0x7711a1){return function(_0x5b0480){if(!_0x5b0480){_0x57b01d[_0x0d9e('0x19')](0x194);}return _0x5b0480;};}function handleError(_0x38768a,_0x179a10){_0x179a10=_0x179a10||0x1f4;return function(_0x16dd49){logger['error'](_0x16dd49[_0x0d9e('0x2a')]);if(_0x16dd49[_0x0d9e('0x2b')]){delete _0x16dd49[_0x0d9e('0x2b')];}_0x38768a[_0x0d9e('0x1a')](_0x179a10)[_0x0d9e('0x2c')](_0x16dd49);};}exports['index']=function(_0x34b103,_0x33a7f0){var _0x1678d5={},_0x324993={},_0x402b2f={'count':0x0,'rows':[]};var _0x103b10=_[_0x0d9e('0x2d')](db[_0x0d9e('0x2e')][_0x0d9e('0x2f')],function(_0x4f1401){return{'name':_0x4f1401[_0x0d9e('0x30')],'type':_0x4f1401[_0x0d9e('0x31')][_0x0d9e('0x32')]};});_0x324993[_0x0d9e('0x33')]=_[_0x0d9e('0x2d')](_0x103b10,_0x0d9e('0x2b'));_0x324993[_0x0d9e('0x34')]=_[_0x0d9e('0x35')](_0x34b103[_0x0d9e('0x34')]);_0x324993[_0x0d9e('0x36')]=_[_0x0d9e('0x37')](_0x324993[_0x0d9e('0x33')],_0x324993[_0x0d9e('0x34')]);_0x1678d5['attributes']=_[_0x0d9e('0x37')](_0x324993[_0x0d9e('0x33')],qs['fields'](_0x34b103['query'][_0x0d9e('0x38')]));_0x1678d5['attributes']=_0x1678d5[_0x0d9e('0x39')][_0x0d9e('0x3a')]?_0x1678d5[_0x0d9e('0x39')]:_0x324993[_0x0d9e('0x33')];if(!_0x34b103[_0x0d9e('0x34')][_0x0d9e('0x3b')](_0x0d9e('0x3c'))){_0x1678d5[_0x0d9e('0x1e')]=qs['limit'](_0x34b103[_0x0d9e('0x34')]['limit']);_0x1678d5[_0x0d9e('0x1d')]=qs[_0x0d9e('0x1d')](_0x34b103[_0x0d9e('0x34')][_0x0d9e('0x1d')]);}_0x1678d5[_0x0d9e('0x3d')]=qs[_0x0d9e('0x3e')](_0x34b103[_0x0d9e('0x34')][_0x0d9e('0x3e')]);_0x1678d5[_0x0d9e('0x3f')]=qs[_0x0d9e('0x36')](_[_0x0d9e('0x40')](_0x34b103[_0x0d9e('0x34')],_0x324993[_0x0d9e('0x36')]),_0x103b10);if(_0x34b103[_0x0d9e('0x34')][_0x0d9e('0x41')]){_0x1678d5[_0x0d9e('0x3f')]=_[_0x0d9e('0x42')](_0x1678d5[_0x0d9e('0x3f')],{'$or':_[_0x0d9e('0x2d')](_0x103b10,function(_0x3c9908){if(_0x3c9908[_0x0d9e('0x31')]!=='VIRTUAL'){var _0x2ffbc5={};_0x2ffbc5[_0x3c9908[_0x0d9e('0x2b')]]={'$like':'%'+_0x34b103[_0x0d9e('0x34')]['filter']+'%'};return _0x2ffbc5;}})});}_0x1678d5=_['merge']({},_0x1678d5,_0x34b103[_0x0d9e('0x43')]);var _0x22422f={'where':_0x1678d5[_0x0d9e('0x3f')]};return db[_0x0d9e('0x2e')][_0x0d9e('0x1c')](_0x22422f)['then'](function(_0xd577ba){_0x402b2f[_0x0d9e('0x1c')]=_0xd577ba;if(_0x34b103[_0x0d9e('0x34')][_0x0d9e('0x44')]){_0x1678d5[_0x0d9e('0x45')]=[{'all':!![]}];}return db[_0x0d9e('0x2e')][_0x0d9e('0x46')](_0x1678d5);})[_0x0d9e('0x25')](function(_0x343ff1){_0x402b2f[_0x0d9e('0x47')]=_0x343ff1;return _0x402b2f;})['then'](respondWithFilteredResult(_0x33a7f0,_0x1678d5))[_0x0d9e('0x48')](handleError(_0x33a7f0,null));};exports[_0x0d9e('0x49')]=function(_0xb9a0b3,_0x53ee9d){var _0x457c3b={'raw':![],'where':{'id':_0xb9a0b3[_0x0d9e('0x4a')]['id']}},_0x762434={};_0x762434[_0x0d9e('0x33')]=_[_0x0d9e('0x35')](db[_0x0d9e('0x2e')][_0x0d9e('0x2f')]);_0x762434[_0x0d9e('0x34')]=_[_0x0d9e('0x35')](_0xb9a0b3[_0x0d9e('0x34')]);_0x762434[_0x0d9e('0x36')]=_[_0x0d9e('0x37')](_0x762434[_0x0d9e('0x33')],_0x762434['query']);_0x457c3b['attributes']=_[_0x0d9e('0x37')](_0x762434[_0x0d9e('0x33')],qs['fields'](_0xb9a0b3[_0x0d9e('0x34')][_0x0d9e('0x38')]));_0x457c3b[_0x0d9e('0x39')]=_0x457c3b[_0x0d9e('0x39')][_0x0d9e('0x3a')]?_0x457c3b[_0x0d9e('0x39')]:_0x762434[_0x0d9e('0x33')];if(_0xb9a0b3[_0x0d9e('0x34')]['includeAll']){_0x457c3b[_0x0d9e('0x45')]=[{'all':!![]}];}_0x457c3b=_[_0x0d9e('0x42')]({},_0x457c3b,_0xb9a0b3['options']);return db[_0x0d9e('0x2e')]['find'](_0x457c3b)[_0x0d9e('0x25')](handleEntityNotFound(_0x53ee9d,null))[_0x0d9e('0x25')](respondWithResult(_0x53ee9d,null))[_0x0d9e('0x48')](handleError(_0x53ee9d,null));};exports[_0x0d9e('0x24')]=function(_0x590aa3,_0x784187){if(_0x590aa3[_0x0d9e('0x4b')]['id']){delete _0x590aa3[_0x0d9e('0x4b')]['id'];}return db[_0x0d9e('0x2e')][_0x0d9e('0x4c')]({'where':{'id':_0x590aa3[_0x0d9e('0x4a')]['id']}})[_0x0d9e('0x25')](handleEntityNotFound(_0x784187,null))[_0x0d9e('0x25')](saveUpdates(_0x590aa3[_0x0d9e('0x4b')],null))[_0x0d9e('0x25')](respondWithResult(_0x784187,null))[_0x0d9e('0x48')](handleError(_0x784187,null));};exports[_0x0d9e('0x4d')]=function(_0x47105d,_0x4084a8,_0x12230b){return db[_0x0d9e('0x4e')][_0x0d9e('0x4f')](function(_0x109385){if(_0x47105d[_0x0d9e('0x4b')][_0x0d9e('0x50')]==='files'){_0x47105d[_0x0d9e('0x4b')][_0x0d9e('0x51')]=path['join'](config[_0x0d9e('0x52')],_0x0d9e('0x53'),_0x47105d[_0x0d9e('0x4b')][_0x0d9e('0x2b')]);}return db[_0x0d9e('0x2e')][_0x0d9e('0x4d')](_0x47105d[_0x0d9e('0x4b')],{'transaction':_0x109385})[_0x0d9e('0x25')](function(_0x28c7ee){if(_0x47105d[_0x0d9e('0x4b')][_0x0d9e('0x50')]===_0x0d9e('0x54')){fs[_0x0d9e('0x55')](_0x28c7ee[_0x0d9e('0x51')],parseInt(_0x0d9e('0x56'),0x8));}var _0x87de99=_0x47105d[_0x0d9e('0x57')][_0x0d9e('0x26')]({'plain':!![]});if(!_0x87de99)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x87de99[_0x0d9e('0x58')]===_0x0d9e('0x57')){var _0x2ffb22=_0x28c7ee[_0x0d9e('0x26')]({'plain':!![]});return db[_0x0d9e('0x59')][_0x0d9e('0x4c')]({'where':{'name':'MusicOnHolds','userProfileId':_0x87de99['userProfileId']},'raw':!![]})[_0x0d9e('0x25')](function(_0x139760){if(_0x139760&&_0x139760['autoAssociation']===0x0){return db['UserProfileResource'][_0x0d9e('0x4d')]({'name':_0x2ffb22['name'],'resourceId':_0x2ffb22['id'],'type':_0x139760['name'],'sectionId':_0x139760['id']},{})[_0x0d9e('0x25')](function(){return _0x28c7ee;});}else{return _0x28c7ee;}})['catch'](function(_0x3e7606){logger[_0x0d9e('0x5a')](_0x0d9e('0x5b'),_0x3e7606);});}return _0x28c7ee;});})['then'](respondWithResult(_0x4084a8,0xc9))[_0x0d9e('0x48')](handleError(_0x4084a8,null));};exports[_0x0d9e('0x29')]=function(_0x430556,_0x414744,_0x5e2163){var _0x41024d;return db[_0x0d9e('0x2e')][_0x0d9e('0x4c')]({'where':{'id':_0x430556[_0x0d9e('0x4a')]['id']}})[_0x0d9e('0x25')](function(_0xc58ab6){if(_0xc58ab6){return db[_0x0d9e('0x4e')][_0x0d9e('0x4f')](function(_0x409e4f){return _0xc58ab6[_0x0d9e('0x29')]({'transaction':_0x409e4f,'raw':!![]})[_0x0d9e('0x25')](function(_0x319db2){if(_0x319db2[_0x0d9e('0x51')]){fs['readdirSync'](_0x319db2[_0x0d9e('0x51')])['forEach'](function(_0x2e6dd1){fs['unlinkSync'](path['join'](_0x319db2['directory'],_0x2e6dd1));});fs[_0x0d9e('0x5c')](_0x319db2[_0x0d9e('0x51')]);}return _0x319db2;});})['catch'](function(_0x5a76a6){throw new db[(_0x0d9e('0x5d'))][(_0x0d9e('0x5e'))](_0x5a76a6[_0x0d9e('0x5f')]);});}})[_0x0d9e('0x25')](handleEntityNotFound(_0x414744,null))[_0x0d9e('0x25')](removeEntity(_0x414744,null))['catch'](handleError(_0x414744,null));};exports[_0x0d9e('0x60')]=function(_0x356d62,_0x297b98,_0x9a94d6){return db[_0x0d9e('0x4e')][_0x0d9e('0x4f')](function(_0x2037ce){var _0x16c4d5;return db[_0x0d9e('0x2e')]['find']({'where':{'id':_0x356d62[_0x0d9e('0x4a')]['id']}})[_0x0d9e('0x25')](function(_0x1d8e3f){if(_0x1d8e3f){_0x16c4d5=_0x1d8e3f;return _0x1d8e3f[_0x0d9e('0x60')](_0x356d62[_0x0d9e('0x4b')]['id'],{'transaction':_0x2037ce});}})[_0x0d9e('0x25')](function(_0x4dabfe){if(_0x4dabfe){return db[_0x0d9e('0x61')][_0x0d9e('0x62')]({'where':{'id':_0x356d62[_0x0d9e('0x4b')]['id']},'attributes':['id',_0x0d9e('0x2b'),_0x0d9e('0x63'),_0x0d9e('0x64'),_0x0d9e('0x65')],'raw':!![]});}})[_0x0d9e('0x25')](function(_0x30c8a0){if(_0x30c8a0){var _0x10b54a=path[_0x0d9e('0x66')](config[_0x0d9e('0x52')],_0x0d9e('0x67'),util[_0x0d9e('0x68')]('%s.%s',path[_0x0d9e('0x69')](_0x30c8a0[_0x0d9e('0x63')],path[_0x0d9e('0x6a')](_0x30c8a0['save_name'])),_0x30c8a0[_0x0d9e('0x64')]));var _0x59dfa9=path[_0x0d9e('0x66')](config[_0x0d9e('0x52')],_0x0d9e('0x53'),_0x16c4d5[_0x0d9e('0x2b')],util[_0x0d9e('0x68')](_0x0d9e('0x6b'),_0x30c8a0[_0x0d9e('0x2b')],_0x30c8a0[_0x0d9e('0x64')]));fs[_0x0d9e('0x6c')](_0x10b54a,_0x59dfa9);return _0x30c8a0;}})[_0x0d9e('0x48')](function(_0x491a4b){throw new db[(_0x0d9e('0x5d'))][(_0x0d9e('0x5e'))](_0x491a4b['message']);});})['then'](handleEntityNotFound(_0x297b98,null))[_0x0d9e('0x25')](respondWithResult(_0x297b98,0xc9))[_0x0d9e('0x48')](handleError(_0x297b98,null));};exports[_0x0d9e('0x6d')]=function(_0x11c33b,_0x3e5954,_0x2a55a5){return db['sequelize']['transaction'](function(_0x117abe){var _0x4eb8e2;return db['VoiceMusicOnHold'][_0x0d9e('0x62')]({'where':{'id':_0x11c33b[_0x0d9e('0x4a')]['id']}})[_0x0d9e('0x25')](handleEntityNotFound(_0x3e5954,null))[_0x0d9e('0x25')](function(_0x3a15b2){if(_0x3a15b2){_0x4eb8e2=_0x3a15b2;return _0x3a15b2[_0x0d9e('0x6d')](_0x11c33b[_0x0d9e('0x4a')][_0x0d9e('0x6e')]);}})[_0x0d9e('0x25')](function(_0x3f7bb5){if(_0x3f7bb5){return db['Sound']['findOne']({'where':{'id':_0x11c33b[_0x0d9e('0x4a')][_0x0d9e('0x6e')]},'attributes':['id','name',_0x0d9e('0x63'),'converted_format',_0x0d9e('0x65')],'raw':!![]});}})[_0x0d9e('0x25')](function(_0x1ab7b5){if(_0x1ab7b5){fs[_0x0d9e('0x6f')](path['join'](_0x4eb8e2['directory'],util['format'](_0x0d9e('0x6b'),_0x1ab7b5[_0x0d9e('0x2b')],_0x1ab7b5[_0x0d9e('0x64')])));return _0x1ab7b5;}})[_0x0d9e('0x48')](function(_0x1f4963){throw new db[(_0x0d9e('0x5d'))]['ValidationError'](_0x1f4963['message']);});})['then'](handleEntityNotFound(_0x3e5954,null))['then'](respondWithStatusCode(_0x3e5954,0xcc))['catch'](handleError(_0x3e5954,null));};exports[_0x0d9e('0x70')]=function(_0x554a23,_0x3cec93,_0x304ce3){var _0x32d8c0={};var _0x2fcd54={};var _0x9ad5a5;var _0x511ff8;return db[_0x0d9e('0x2e')][_0x0d9e('0x62')]({'where':{'id':_0x554a23[_0x0d9e('0x4a')]['id']}})[_0x0d9e('0x25')](handleEntityNotFound(_0x3cec93,null))['then'](function(_0x2a5f51){if(_0x2a5f51){_0x9ad5a5=_0x2a5f51;_0x2fcd54[_0x0d9e('0x33')]=_[_0x0d9e('0x35')](db[_0x0d9e('0x61')][_0x0d9e('0x2f')]);_0x2fcd54['query']=_[_0x0d9e('0x35')](_0x554a23[_0x0d9e('0x34')]);_0x2fcd54[_0x0d9e('0x36')]=_[_0x0d9e('0x37')](_0x2fcd54[_0x0d9e('0x33')],_0x2fcd54[_0x0d9e('0x34')]);_0x32d8c0[_0x0d9e('0x39')]=_[_0x0d9e('0x37')](_0x2fcd54[_0x0d9e('0x33')],qs[_0x0d9e('0x38')](_0x554a23[_0x0d9e('0x34')]['fields']));_0x32d8c0[_0x0d9e('0x39')]=_0x32d8c0[_0x0d9e('0x39')]['length']?_0x32d8c0[_0x0d9e('0x39')]:_0x2fcd54[_0x0d9e('0x33')];_0x32d8c0[_0x0d9e('0x3d')]=qs['sort'](_0x554a23[_0x0d9e('0x34')][_0x0d9e('0x3e')]);_0x32d8c0[_0x0d9e('0x3f')]=qs[_0x0d9e('0x36')](_[_0x0d9e('0x40')](_0x554a23['query'],_0x2fcd54[_0x0d9e('0x36')]));if(_0x554a23[_0x0d9e('0x34')][_0x0d9e('0x41')]){_0x32d8c0[_0x0d9e('0x3f')]=_[_0x0d9e('0x42')](_0x32d8c0['where'],{'$or':_[_0x0d9e('0x2d')](_0x32d8c0[_0x0d9e('0x39')],function(_0x49b095){var _0x3ffcd4={};_0x3ffcd4[_0x49b095]={'$like':'%'+_0x554a23['query'][_0x0d9e('0x41')]+'%'};return _0x3ffcd4;})});}_0x32d8c0=_[_0x0d9e('0x42')]({},_0x32d8c0,_0x554a23[_0x0d9e('0x43')]);return _0x9ad5a5[_0x0d9e('0x70')](_0x32d8c0);}})[_0x0d9e('0x25')](function(_0x382812){if(_0x382812){_0x511ff8=_0x382812[_0x0d9e('0x3a')];if(!_0x554a23[_0x0d9e('0x34')][_0x0d9e('0x3b')](_0x0d9e('0x3c'))){_0x32d8c0[_0x0d9e('0x1e')]=qs[_0x0d9e('0x1e')](_0x554a23['query']['limit']);_0x32d8c0[_0x0d9e('0x1d')]=qs[_0x0d9e('0x1d')](_0x554a23[_0x0d9e('0x34')]['offset']);}return _0x9ad5a5[_0x0d9e('0x70')](_0x32d8c0);}})[_0x0d9e('0x25')](function(_0x392501){if(_0x392501){return _0x392501?{'count':_0x511ff8,'rows':_0x392501}:null;}})['then'](respondWithResult(_0x3cec93,null))['catch'](handleError(_0x3cec93,null));}; \ No newline at end of file +var _0x3367=['ValidationError','message','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','converted_format','symlinkSync','Sequelize','removeSound','id2','getSounds','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','save','destroy','then','get','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','root','server/files/moh','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','join'];(function(_0x30f020,_0x7d2cfa){var _0x3933c0=function(_0x563de3){while(--_0x563de3){_0x30f020['push'](_0x30f020['shift']());}};_0x3933c0(++_0x7d2cfa);}(_0x3367,0x1de));var _0x7336=function(_0x4954bf,_0x78a2e5){_0x4954bf=_0x4954bf-0x0;var _0x53ba01=_0x3367[_0x4954bf];return _0x53ba01;};'use strict';var pdf=require(_0x7336('0x0'));var emlformat=require(_0x7336('0x1'));var rimraf=require(_0x7336('0x2'));var zipdir=require(_0x7336('0x3'));var jsonpatch=require(_0x7336('0x4'));var rp=require(_0x7336('0x5'));var moment=require(_0x7336('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7336('0x7'));var util=require(_0x7336('0x8'));var path=require(_0x7336('0x9'));var sox=require(_0x7336('0xa'));var csv=require(_0x7336('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7336('0xc'));var squel=require(_0x7336('0xd'));var crypto=require('crypto');var jsforce=require(_0x7336('0xe'));var deskjs=require(_0x7336('0xf'));var toCsv=require(_0x7336('0xb'));var querystring=require(_0x7336('0x10'));var Papa=require('papaparse');var Redis=require(_0x7336('0x11'));var authService=require(_0x7336('0x12'));var qs=require(_0x7336('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7336('0x14'));var logger=require('../../config/logger')(_0x7336('0x15'));var utils=require(_0x7336('0x16'));var config=require(_0x7336('0x17'));var licenseUtil=require(_0x7336('0x18'));var db=require(_0x7336('0x19'))['db'];function respondWithStatusCode(_0x5cd337,_0x56a007){_0x56a007=_0x56a007||0xcc;return function(_0x509a57){if(_0x509a57){return _0x5cd337['sendStatus'](_0x56a007);}return _0x5cd337[_0x7336('0x1a')](_0x56a007)[_0x7336('0x1b')]();};}function respondWithResult(_0x5b8c01,_0x13f396){_0x13f396=_0x13f396||0xc8;return function(_0x2c6e58){if(_0x2c6e58){return _0x5b8c01[_0x7336('0x1a')](_0x13f396)['json'](_0x2c6e58);}};}function respondWithFilteredResult(_0x4863df,_0x73248){return function(_0x1ec025){if(_0x1ec025){var _0x3e218a=_0x1ec025[_0x7336('0x1c')],_0x416520=_0x73248['offset'],_0x4fb1d5=_0x73248[_0x7336('0x1d')]+_0x73248[_0x7336('0x1e')],_0x4983b4;if(_0x4fb1d5>=_0x3e218a){_0x4fb1d5=_0x3e218a;_0x4983b4=0xc8;}else{_0x4983b4=0xce;}_0x4863df[_0x7336('0x1a')](_0x4983b4);return _0x4863df[_0x7336('0x1f')](_0x7336('0x20'),_0x416520+'-'+_0x4fb1d5+'/'+_0x3e218a)[_0x7336('0x21')](_0x1ec025);}return null;};}function patchUpdates(_0x36c746){return function(_0x321119){try{jsonpatch[_0x7336('0x22')](_0x321119,_0x36c746,!![]);}catch(_0x1ef50d){return BPromise['reject'](_0x1ef50d);}return _0x321119[_0x7336('0x23')]();};}function saveUpdates(_0x54a0e5,_0x5077bf){return function(_0x4f4791){if(_0x4f4791){return _0x4f4791['update'](_0x54a0e5)['then'](function(_0x159682){return _0x159682;});}return null;};}function removeEntity(_0x251668,_0x16242b){return function(_0x15ab4b){if(_0x15ab4b){return _0x15ab4b[_0x7336('0x24')]()[_0x7336('0x25')](function(){var _0x5a9f14=_0x15ab4b[_0x7336('0x26')]({'plain':!![]});var _0x113667=_0x7336('0x27');return db[_0x7336('0x28')]['destroy']({'where':{'type':_0x113667,'resourceId':_0x5a9f14['id']}})[_0x7336('0x25')](function(){return _0x15ab4b;});})[_0x7336('0x25')](function(){_0x251668[_0x7336('0x1a')](0xcc)[_0x7336('0x1b')]();});}};}function handleEntityNotFound(_0x567100,_0x5a45f9){return function(_0x4b9ed8){if(!_0x4b9ed8){_0x567100[_0x7336('0x29')](0x194);}return _0x4b9ed8;};}function handleError(_0x532bb6,_0x4c5597){_0x4c5597=_0x4c5597||0x1f4;return function(_0x400f40){logger[_0x7336('0x2a')](_0x400f40[_0x7336('0x2b')]);if(_0x400f40[_0x7336('0x2c')]){delete _0x400f40[_0x7336('0x2c')];}_0x532bb6[_0x7336('0x1a')](_0x4c5597)[_0x7336('0x2d')](_0x400f40);};}exports[_0x7336('0x2e')]=function(_0x445360,_0x1b389c){var _0x2eb766={},_0x17833a={},_0x13705c={'count':0x0,'rows':[]};var _0x366f9f=_['map'](db[_0x7336('0x2f')][_0x7336('0x30')],function(_0x1e4e54){return{'name':_0x1e4e54[_0x7336('0x31')],'type':_0x1e4e54[_0x7336('0x32')][_0x7336('0x33')]};});_0x17833a['model']=_['map'](_0x366f9f,_0x7336('0x2c'));_0x17833a[_0x7336('0x34')]=_[_0x7336('0x35')](_0x445360[_0x7336('0x34')]);_0x17833a[_0x7336('0x36')]=_[_0x7336('0x37')](_0x17833a[_0x7336('0x38')],_0x17833a[_0x7336('0x34')]);_0x2eb766[_0x7336('0x39')]=_[_0x7336('0x37')](_0x17833a[_0x7336('0x38')],qs[_0x7336('0x3a')](_0x445360[_0x7336('0x34')]['fields']));_0x2eb766['attributes']=_0x2eb766[_0x7336('0x39')][_0x7336('0x3b')]?_0x2eb766[_0x7336('0x39')]:_0x17833a[_0x7336('0x38')];if(!_0x445360[_0x7336('0x34')]['hasOwnProperty'](_0x7336('0x3c'))){_0x2eb766['limit']=qs[_0x7336('0x1e')](_0x445360[_0x7336('0x34')][_0x7336('0x1e')]);_0x2eb766[_0x7336('0x1d')]=qs[_0x7336('0x1d')](_0x445360[_0x7336('0x34')][_0x7336('0x1d')]);}_0x2eb766[_0x7336('0x3d')]=qs[_0x7336('0x3e')](_0x445360[_0x7336('0x34')][_0x7336('0x3e')]);_0x2eb766['where']=qs[_0x7336('0x36')](_[_0x7336('0x3f')](_0x445360[_0x7336('0x34')],_0x17833a[_0x7336('0x36')]),_0x366f9f);if(_0x445360['query'][_0x7336('0x40')]){_0x2eb766['where']=_[_0x7336('0x41')](_0x2eb766[_0x7336('0x42')],{'$or':_['map'](_0x366f9f,function(_0x27055e){if(_0x27055e[_0x7336('0x32')]!=='VIRTUAL'){var _0x115803={};_0x115803[_0x27055e[_0x7336('0x2c')]]={'$like':'%'+_0x445360[_0x7336('0x34')]['filter']+'%'};return _0x115803;}})});}_0x2eb766=_['merge']({},_0x2eb766,_0x445360[_0x7336('0x43')]);var _0x338ff0={'where':_0x2eb766['where']};return db[_0x7336('0x2f')][_0x7336('0x1c')](_0x338ff0)['then'](function(_0x4794c4){_0x13705c[_0x7336('0x1c')]=_0x4794c4;if(_0x445360[_0x7336('0x34')][_0x7336('0x44')]){_0x2eb766[_0x7336('0x45')]=[{'all':!![]}];}return db[_0x7336('0x2f')][_0x7336('0x46')](_0x2eb766);})[_0x7336('0x25')](function(_0x3ce080){_0x13705c[_0x7336('0x47')]=_0x3ce080;return _0x13705c;})['then'](respondWithFilteredResult(_0x1b389c,_0x2eb766))[_0x7336('0x48')](handleError(_0x1b389c,null));};exports[_0x7336('0x49')]=function(_0x2f7873,_0x3b42ca){var _0x561185={'raw':![],'where':{'id':_0x2f7873[_0x7336('0x4a')]['id']}},_0x3c481d={};_0x3c481d[_0x7336('0x38')]=_[_0x7336('0x35')](db['VoiceMusicOnHold'][_0x7336('0x30')]);_0x3c481d[_0x7336('0x34')]=_[_0x7336('0x35')](_0x2f7873[_0x7336('0x34')]);_0x3c481d[_0x7336('0x36')]=_[_0x7336('0x37')](_0x3c481d[_0x7336('0x38')],_0x3c481d['query']);_0x561185[_0x7336('0x39')]=_['intersection'](_0x3c481d[_0x7336('0x38')],qs['fields'](_0x2f7873[_0x7336('0x34')]['fields']));_0x561185['attributes']=_0x561185['attributes'][_0x7336('0x3b')]?_0x561185[_0x7336('0x39')]:_0x3c481d['model'];if(_0x2f7873['query'][_0x7336('0x44')]){_0x561185[_0x7336('0x45')]=[{'all':!![]}];}_0x561185=_[_0x7336('0x41')]({},_0x561185,_0x2f7873[_0x7336('0x43')]);return db[_0x7336('0x2f')][_0x7336('0x4b')](_0x561185)[_0x7336('0x25')](handleEntityNotFound(_0x3b42ca,null))[_0x7336('0x25')](respondWithResult(_0x3b42ca,null))[_0x7336('0x48')](handleError(_0x3b42ca,null));};exports[_0x7336('0x4c')]=function(_0x3c802e,_0x30a551){if(_0x3c802e[_0x7336('0x4d')]['id']){delete _0x3c802e['body']['id'];}return db[_0x7336('0x2f')]['find']({'where':{'id':_0x3c802e[_0x7336('0x4a')]['id']}})[_0x7336('0x25')](handleEntityNotFound(_0x30a551,null))[_0x7336('0x25')](saveUpdates(_0x3c802e['body'],null))[_0x7336('0x25')](respondWithResult(_0x30a551,null))[_0x7336('0x48')](handleError(_0x30a551,null));};exports[_0x7336('0x4e')]=function(_0x31aede,_0x2779a6,_0x4aa64a){return db[_0x7336('0x4f')][_0x7336('0x50')](function(_0x55899e){if(_0x31aede[_0x7336('0x4d')][_0x7336('0x51')]===_0x7336('0x52')){_0x31aede[_0x7336('0x4d')][_0x7336('0x53')]=path['join'](config[_0x7336('0x54')],_0x7336('0x55'),_0x31aede['body'][_0x7336('0x2c')]);}return db[_0x7336('0x2f')][_0x7336('0x4e')](_0x31aede[_0x7336('0x4d')],{'transaction':_0x55899e})[_0x7336('0x25')](function(_0x42217f){if(_0x31aede[_0x7336('0x4d')][_0x7336('0x51')]===_0x7336('0x52')){fs[_0x7336('0x56')](_0x42217f[_0x7336('0x53')],parseInt('0777',0x8));}var _0x34c3ee=_0x31aede[_0x7336('0x57')][_0x7336('0x26')]({'plain':!![]});if(!_0x34c3ee)throw new Error(_0x7336('0x58'));if(_0x34c3ee[_0x7336('0x59')]==='user'){var _0x48914e=_0x42217f['get']({'plain':!![]});return db[_0x7336('0x5a')][_0x7336('0x4b')]({'where':{'name':_0x7336('0x27'),'userProfileId':_0x34c3ee[_0x7336('0x5b')]},'raw':!![]})[_0x7336('0x25')](function(_0x3d589a){if(_0x3d589a&&_0x3d589a[_0x7336('0x5c')]===0x0){return db[_0x7336('0x28')][_0x7336('0x4e')]({'name':_0x48914e[_0x7336('0x2c')],'resourceId':_0x48914e['id'],'type':_0x3d589a[_0x7336('0x2c')],'sectionId':_0x3d589a['id']},{})[_0x7336('0x25')](function(){return _0x42217f;});}else{return _0x42217f;}})[_0x7336('0x48')](function(_0x84d127){logger[_0x7336('0x2a')](_0x7336('0x5d'),_0x84d127);});}return _0x42217f;});})[_0x7336('0x25')](respondWithResult(_0x2779a6,0xc9))[_0x7336('0x48')](handleError(_0x2779a6,null));};exports[_0x7336('0x24')]=function(_0x30145a,_0x28a337,_0x22bfea){var _0x465115;return db['VoiceMusicOnHold'][_0x7336('0x4b')]({'where':{'id':_0x30145a[_0x7336('0x4a')]['id']}})['then'](function(_0x1b720a){if(_0x1b720a){return db[_0x7336('0x4f')][_0x7336('0x50')](function(_0x4dccea){return _0x1b720a[_0x7336('0x24')]({'transaction':_0x4dccea,'raw':!![]})[_0x7336('0x25')](function(_0x2e27a7){if(_0x2e27a7[_0x7336('0x53')]){fs['readdirSync'](_0x2e27a7[_0x7336('0x53')])[_0x7336('0x5e')](function(_0x1f6de0){fs[_0x7336('0x5f')](path[_0x7336('0x60')](_0x2e27a7[_0x7336('0x53')],_0x1f6de0));});fs['rmdirSync'](_0x2e27a7[_0x7336('0x53')]);}return _0x2e27a7;});})[_0x7336('0x48')](function(_0x15ef35){throw new db['Sequelize'][(_0x7336('0x61'))](_0x15ef35[_0x7336('0x62')]);});}})['then'](handleEntityNotFound(_0x28a337,null))[_0x7336('0x25')](removeEntity(_0x28a337,null))[_0x7336('0x48')](handleError(_0x28a337,null));};exports[_0x7336('0x63')]=function(_0x4fe8f9,_0x6bceb9,_0x285206){return db[_0x7336('0x4f')][_0x7336('0x50')](function(_0x21efd1){var _0x544bb6;return db[_0x7336('0x2f')][_0x7336('0x4b')]({'where':{'id':_0x4fe8f9['params']['id']}})[_0x7336('0x25')](function(_0x3f4033){if(_0x3f4033){_0x544bb6=_0x3f4033;return _0x3f4033['addSound'](_0x4fe8f9[_0x7336('0x4d')]['id'],{'transaction':_0x21efd1});}})[_0x7336('0x25')](function(_0x5188b4){if(_0x5188b4){return db[_0x7336('0x64')][_0x7336('0x65')]({'where':{'id':_0x4fe8f9['body']['id']},'attributes':['id',_0x7336('0x2c'),_0x7336('0x66'),'converted_format',_0x7336('0x67')],'raw':!![]});}})[_0x7336('0x25')](function(_0x5e42a4){if(_0x5e42a4){var _0x594c73=path[_0x7336('0x60')](config[_0x7336('0x54')],_0x7336('0x68'),util[_0x7336('0x69')](_0x7336('0x6a'),path[_0x7336('0x6b')](_0x5e42a4[_0x7336('0x66')],path['extname'](_0x5e42a4[_0x7336('0x66')])),_0x5e42a4[_0x7336('0x6c')]));var _0xc8472a=path[_0x7336('0x60')](config[_0x7336('0x54')],'server/files/moh',_0x544bb6[_0x7336('0x2c')],util[_0x7336('0x69')]('%s.%s',_0x5e42a4[_0x7336('0x2c')],_0x5e42a4[_0x7336('0x6c')]));fs[_0x7336('0x6d')](_0x594c73,_0xc8472a);return _0x5e42a4;}})[_0x7336('0x48')](function(_0x1d158e){throw new db[(_0x7336('0x6e'))][(_0x7336('0x61'))](_0x1d158e[_0x7336('0x62')]);});})[_0x7336('0x25')](handleEntityNotFound(_0x6bceb9,null))[_0x7336('0x25')](respondWithResult(_0x6bceb9,0xc9))[_0x7336('0x48')](handleError(_0x6bceb9,null));};exports[_0x7336('0x6f')]=function(_0x573cf8,_0x4c3763,_0xdbf458){return db[_0x7336('0x4f')][_0x7336('0x50')](function(_0x344ee2){var _0x22fcca;return db[_0x7336('0x2f')][_0x7336('0x65')]({'where':{'id':_0x573cf8['params']['id']}})[_0x7336('0x25')](handleEntityNotFound(_0x4c3763,null))[_0x7336('0x25')](function(_0x22d9f8){if(_0x22d9f8){_0x22fcca=_0x22d9f8;return _0x22d9f8[_0x7336('0x6f')](_0x573cf8[_0x7336('0x4a')][_0x7336('0x70')]);}})[_0x7336('0x25')](function(_0x5b05e4){if(_0x5b05e4){return db[_0x7336('0x64')][_0x7336('0x65')]({'where':{'id':_0x573cf8[_0x7336('0x4a')][_0x7336('0x70')]},'attributes':['id',_0x7336('0x2c'),'save_name',_0x7336('0x6c'),'createdAt'],'raw':!![]});}})[_0x7336('0x25')](function(_0x4b74a1){if(_0x4b74a1){fs['unlinkSync'](path[_0x7336('0x60')](_0x22fcca[_0x7336('0x53')],util[_0x7336('0x69')](_0x7336('0x6a'),_0x4b74a1[_0x7336('0x2c')],_0x4b74a1[_0x7336('0x6c')])));return _0x4b74a1;}})[_0x7336('0x48')](function(_0x1a25a0){throw new db['Sequelize'][(_0x7336('0x61'))](_0x1a25a0[_0x7336('0x62')]);});})[_0x7336('0x25')](handleEntityNotFound(_0x4c3763,null))[_0x7336('0x25')](respondWithStatusCode(_0x4c3763,0xcc))['catch'](handleError(_0x4c3763,null));};exports[_0x7336('0x71')]=function(_0x565f6f,_0x57c798,_0x59264c){var _0x1a0d2={};var _0x17b79e={};var _0x4eeaba;var _0xd8a4a4;return db[_0x7336('0x2f')][_0x7336('0x65')]({'where':{'id':_0x565f6f[_0x7336('0x4a')]['id']}})[_0x7336('0x25')](handleEntityNotFound(_0x57c798,null))[_0x7336('0x25')](function(_0x2f22ff){if(_0x2f22ff){_0x4eeaba=_0x2f22ff;_0x17b79e['model']=_[_0x7336('0x35')](db[_0x7336('0x64')][_0x7336('0x30')]);_0x17b79e[_0x7336('0x34')]=_[_0x7336('0x35')](_0x565f6f[_0x7336('0x34')]);_0x17b79e[_0x7336('0x36')]=_['intersection'](_0x17b79e[_0x7336('0x38')],_0x17b79e[_0x7336('0x34')]);_0x1a0d2[_0x7336('0x39')]=_[_0x7336('0x37')](_0x17b79e['model'],qs['fields'](_0x565f6f[_0x7336('0x34')][_0x7336('0x3a')]));_0x1a0d2[_0x7336('0x39')]=_0x1a0d2['attributes'][_0x7336('0x3b')]?_0x1a0d2['attributes']:_0x17b79e['model'];_0x1a0d2[_0x7336('0x3d')]=qs[_0x7336('0x3e')](_0x565f6f[_0x7336('0x34')]['sort']);_0x1a0d2[_0x7336('0x42')]=qs[_0x7336('0x36')](_[_0x7336('0x3f')](_0x565f6f[_0x7336('0x34')],_0x17b79e[_0x7336('0x36')]));if(_0x565f6f[_0x7336('0x34')][_0x7336('0x40')]){_0x1a0d2[_0x7336('0x42')]=_[_0x7336('0x41')](_0x1a0d2['where'],{'$or':_[_0x7336('0x72')](_0x1a0d2[_0x7336('0x39')],function(_0x3e0df2){var _0xd69f4e={};_0xd69f4e[_0x3e0df2]={'$like':'%'+_0x565f6f[_0x7336('0x34')][_0x7336('0x40')]+'%'};return _0xd69f4e;})});}_0x1a0d2=_[_0x7336('0x41')]({},_0x1a0d2,_0x565f6f[_0x7336('0x43')]);return _0x4eeaba[_0x7336('0x71')](_0x1a0d2);}})[_0x7336('0x25')](function(_0x41c838){if(_0x41c838){_0xd8a4a4=_0x41c838[_0x7336('0x3b')];if(!_0x565f6f['query']['hasOwnProperty'](_0x7336('0x3c'))){_0x1a0d2[_0x7336('0x1e')]=qs[_0x7336('0x1e')](_0x565f6f['query'][_0x7336('0x1e')]);_0x1a0d2[_0x7336('0x1d')]=qs[_0x7336('0x1d')](_0x565f6f['query'][_0x7336('0x1d')]);}return _0x4eeaba[_0x7336('0x71')](_0x1a0d2);}})[_0x7336('0x25')](function(_0x1514c2){if(_0x1514c2){return _0x1514c2?{'count':_0xd8a4a4,'rows':_0x1514c2}:null;}})['then'](respondWithResult(_0x57c798,null))[_0x7336('0x48')](handleError(_0x57c798,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 5f573d7..be5f55f 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 _0x7cdc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x7cdc,0x138));var _0xc7cd=function(_0x51de61,_0x3d76fe){_0x51de61=_0x51de61-0x0;var _0x519381=_0x7cdc[_0x51de61];return _0x519381;};'use strict';var _=require('lodash');var util=require(_0xc7cd('0x0'));var logger=require(_0xc7cd('0x1'))(_0xc7cd('0x2'));var moment=require(_0xc7cd('0x3'));var BPromise=require(_0xc7cd('0x4'));var rp=require(_0xc7cd('0x5'));var fs=require('fs');var path=require(_0xc7cd('0x6'));var rimraf=require(_0xc7cd('0x7'));var config=require('../../config/environment');var attributes=require(_0xc7cd('0x8'));module['exports']=function(_0x48eac5,_0x1af0fd){return _0x48eac5[_0xc7cd('0x9')](_0xc7cd('0xa'),attributes,{'tableName':_0xc7cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x286b=['VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x335efe,_0x501ef9){var _0x5d0321=function(_0x2e4f96){while(--_0x2e4f96){_0x335efe['push'](_0x335efe['shift']());}};_0x5d0321(++_0x501ef9);}(_0x286b,0x1ca));var _0xb286=function(_0x5925eb,_0x19c13c){_0x5925eb=_0x5925eb-0x0;var _0x57150b=_0x286b[_0x5925eb];return _0x57150b;};'use strict';var _=require(_0xb286('0x0'));var util=require(_0xb286('0x1'));var logger=require(_0xb286('0x2'))(_0xb286('0x3'));var moment=require(_0xb286('0x4'));var BPromise=require(_0xb286('0x5'));var rp=require(_0xb286('0x6'));var fs=require('fs');var path=require(_0xb286('0x7'));var rimraf=require('rimraf');var config=require(_0xb286('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x21dc32,_0x2fd31e){return _0x21dc32[_0xb286('0x9')](_0xb286('0xa'),attributes,{'tableName':_0xb286('0xb'),'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 f6eee00..e75967b 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 _0x06cd=['result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info'];(function(_0xeeb409,_0x47b3e8){var _0x10a59a=function(_0x3a80ef){while(--_0x3a80ef){_0xeeb409['push'](_0xeeb409['shift']());}};_0x10a59a(++_0x47b3e8);}(_0x06cd,0xde));var _0xd06c=function(_0x28c091,_0x136b63){_0x28c091=_0x28c091-0x0;var _0x3ed9ab=_0x06cd[_0x28c091];return _0x3ed9ab;};'use strict';var _=require(_0xd06c('0x0'));var util=require('util');var moment=require(_0xd06c('0x1'));var BPromise=require(_0xd06c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd06c('0x3'));var db=require(_0xd06c('0x4'))['db'];var utils=require(_0xd06c('0x5'));var logger=require(_0xd06c('0x6'))('rpc');var config=require(_0xd06c('0x7'));var jayson=require(_0xd06c('0x8'));var client=jayson[_0xd06c('0x9')][_0xd06c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47c4bd,_0x1b20f5,_0x419f78){return new BPromise(function(_0x31dd41,_0x9d6c57){return client[_0xd06c('0xb')](_0x47c4bd,_0x419f78)[_0xd06c('0xc')](function(_0x3d1e5b){logger['info'](_0xd06c('0xd'),_0x1b20f5,_0xd06c('0xe'));logger[_0xd06c('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x1b20f5,_0xd06c('0xe'),JSON[_0xd06c('0x10')](_0x3d1e5b));if(_0x3d1e5b['error']){if(_0x3d1e5b[_0xd06c('0x11')]['code']===0x1f4){logger[_0xd06c('0x11')](_0xd06c('0xd'),_0x1b20f5,_0x3d1e5b['error'][_0xd06c('0x12')]);return _0x9d6c57(_0x3d1e5b[_0xd06c('0x11')][_0xd06c('0x12')]);}logger[_0xd06c('0x11')](_0xd06c('0xd'),_0x1b20f5,_0x3d1e5b['error'][_0xd06c('0x12')]);return _0x31dd41(_0x3d1e5b['error'][_0xd06c('0x12')]);}else{logger[_0xd06c('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x1b20f5,_0xd06c('0xe'));_0x31dd41(_0x3d1e5b[_0xd06c('0x14')]['message']);}})[_0xd06c('0x15')](function(_0x57c22a){logger[_0xd06c('0x11')](_0xd06c('0xd'),_0x1b20f5,_0x57c22a);_0x9d6c57(_0x57c22a);});});} \ No newline at end of file +var _0xecd3=['request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http'];(function(_0x17de3a,_0x1cd871){var _0x1436d4=function(_0x127b23){while(--_0x127b23){_0x17de3a['push'](_0x17de3a['shift']());}};_0x1436d4(++_0x1cd871);}(_0xecd3,0x12d));var _0x3ecd=function(_0x132b66,_0x2d736b){_0x132b66=_0x132b66-0x0;var _0x46d343=_0xecd3[_0x132b66];return _0x46d343;};'use strict';var _=require(_0x3ecd('0x0'));var util=require(_0x3ecd('0x1'));var moment=require(_0x3ecd('0x2'));var BPromise=require(_0x3ecd('0x3'));var rs=require(_0x3ecd('0x4'));var fs=require('fs');var Redis=require(_0x3ecd('0x5'));var db=require(_0x3ecd('0x6'))['db'];var utils=require(_0x3ecd('0x7'));var logger=require(_0x3ecd('0x8'))(_0x3ecd('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3ecd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34c6a2,_0x9c6eea,_0x219821){return new BPromise(function(_0x1241f7,_0x132e9e){return client[_0x3ecd('0xb')](_0x34c6a2,_0x219821)[_0x3ecd('0xc')](function(_0x5aec18){logger[_0x3ecd('0xd')](_0x3ecd('0xe'),_0x9c6eea,_0x3ecd('0xf'));logger[_0x3ecd('0x10')](_0x3ecd('0x11'),_0x9c6eea,_0x3ecd('0xf'),JSON[_0x3ecd('0x12')](_0x5aec18));if(_0x5aec18[_0x3ecd('0x13')]){if(_0x5aec18[_0x3ecd('0x13')][_0x3ecd('0x14')]===0x1f4){logger[_0x3ecd('0x13')](_0x3ecd('0xe'),_0x9c6eea,_0x5aec18[_0x3ecd('0x13')][_0x3ecd('0x15')]);return _0x132e9e(_0x5aec18[_0x3ecd('0x13')][_0x3ecd('0x15')]);}logger['error'](_0x3ecd('0xe'),_0x9c6eea,_0x5aec18['error'][_0x3ecd('0x15')]);return _0x1241f7(_0x5aec18['error'][_0x3ecd('0x15')]);}else{logger[_0x3ecd('0xd')](_0x3ecd('0xe'),_0x9c6eea,_0x3ecd('0xf'));_0x1241f7(_0x5aec18[_0x3ecd('0x16')][_0x3ecd('0x15')]);}})[_0x3ecd('0x17')](function(_0x5c99d0){logger[_0x3ecd('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x9c6eea,_0x5c99d0);_0x132e9e(_0x5c99d0);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3ec7839..b9cb81f 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 _0xedba=['destroy','delete','removeAgents','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','/:id/users','getAgents','post','addAgents','put'];(function(_0x57a122,_0x5d6cc3){var _0xc3922b=function(_0x3869a9){while(--_0x3869a9){_0x57a122['push'](_0x57a122['shift']());}};_0xc3922b(++_0x5d6cc3);}(_0xedba,0x1bd));var _0xaedb=function(_0x51110c,_0x2ae398){_0x51110c=_0x51110c-0x0;var _0x4abf50=_0xedba[_0x51110c];return _0x4abf50;};'use strict';var multer=require(_0xaedb('0x0'));var util=require(_0xaedb('0x1'));var path=require('path');var timeout=require(_0xaedb('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xaedb('0x3'));var interaction=require(_0xaedb('0x4'));var config=require('../../config/environment');var controller=require(_0xaedb('0x5'));router[_0xaedb('0x6')]('/',auth[_0xaedb('0x7')](),controller[_0xaedb('0x8')]);router[_0xaedb('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xaedb('0x9')]);router[_0xaedb('0x6')](_0xaedb('0xa'),auth[_0xaedb('0x7')](),controller[_0xaedb('0xb')]);router['get'](_0xaedb('0xc'),auth[_0xaedb('0x7')](),controller[_0xaedb('0xd')]);router[_0xaedb('0xe')]('/',auth[_0xaedb('0x7')](),controller['create']);router[_0xaedb('0xe')]('/:id/users',auth[_0xaedb('0x7')](),controller[_0xaedb('0xf')]);router[_0xaedb('0x10')]('/:id',auth[_0xaedb('0x7')](),controller['update']);router['delete'](_0xaedb('0xa'),auth[_0xaedb('0x7')](),controller[_0xaedb('0x11')]);router[_0xaedb('0x12')](_0xaedb('0xc'),auth[_0xaedb('0x7')](),controller[_0xaedb('0x13')]);module[_0xaedb('0x14')]=router; \ No newline at end of file +var _0x9692=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/users','post','create','addAgents','update','delete'];(function(_0x166f43,_0x3bc8cb){var _0x43ae50=function(_0x5c562){while(--_0x5c562){_0x166f43['push'](_0x166f43['shift']());}};_0x43ae50(++_0x3bc8cb);}(_0x9692,0x152));var _0x2969=function(_0x242da6,_0x42f536){_0x242da6=_0x242da6-0x0;var _0x43093c=_0x9692[_0x242da6];return _0x43093c;};'use strict';var multer=require(_0x2969('0x0'));var util=require(_0x2969('0x1'));var path=require(_0x2969('0x2'));var timeout=require(_0x2969('0x3'));var express=require(_0x2969('0x4'));var router=express[_0x2969('0x5')]();var auth=require(_0x2969('0x6'));var interaction=require(_0x2969('0x7'));var config=require(_0x2969('0x8'));var controller=require('./voicePrefix.controller');router[_0x2969('0x9')]('/',auth['isAuthenticated'](),controller[_0x2969('0xa')]);router['get'](_0x2969('0xb'),auth[_0x2969('0xc')](),controller[_0x2969('0xd')]);router[_0x2969('0x9')](_0x2969('0xe'),auth[_0x2969('0xc')](),controller[_0x2969('0xf')]);router[_0x2969('0x9')](_0x2969('0x10'),auth[_0x2969('0xc')](),controller['getAgents']);router[_0x2969('0x11')]('/',auth[_0x2969('0xc')](),controller[_0x2969('0x12')]);router[_0x2969('0x11')](_0x2969('0x10'),auth[_0x2969('0xc')](),controller[_0x2969('0x13')]);router['put'](_0x2969('0xe'),auth['isAuthenticated'](),controller[_0x2969('0x14')]);router[_0x2969('0x15')](_0x2969('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x2969('0x15')]('/:id/users',auth[_0x2969('0xc')](),controller[_0x2969('0x16')]);module[_0x2969('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 89c616e..be326bc 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 _0x56f7=['name','VIRTUAL','getDataValue','STRING','INTEGER','sequelize'];(function(_0x110f5e,_0x371987){var _0x58a28d=function(_0x8c8c15){while(--_0x8c8c15){_0x110f5e['push'](_0x110f5e['shift']());}};_0x58a28d(++_0x371987);}(_0x56f7,0xcb));var _0x756f=function(_0x29b4cc,_0x5b9996){_0x29b4cc=_0x29b4cc-0x0;var _0x595f88=_0x56f7[_0x29b4cc];return _0x595f88;};'use strict';var Sequelize=require(_0x756f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x756f('0x1')},'prefix':{'type':Sequelize[_0x756f('0x2')],'get':function(_0x5c6aa7){return'system-'+this[_0x756f('0x3')](_0x756f('0x1'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x756f('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0x756f('0x5')]}}; \ No newline at end of file +var _0x5cd8=['name','VIRTUAL','getDataValue','INTEGER','sequelize','STRING'];(function(_0x2cfcbe,_0x245ab1){var _0xadef9b=function(_0x4e9064){while(--_0x4e9064){_0x2cfcbe['push'](_0x2cfcbe['shift']());}};_0xadef9b(++_0x245ab1);}(_0x5cd8,0x1d2));var _0x85cd=function(_0x2abc49,_0x202f2a){_0x2abc49=_0x2abc49-0x0;var _0x2f18ee=_0x5cd8[_0x2abc49];return _0x2f18ee;};'use strict';var Sequelize=require(_0x85cd('0x0'));module['exports']={'name':{'type':Sequelize[_0x85cd('0x1')],'allowNull':![],'unique':_0x85cd('0x2')},'prefix':{'type':Sequelize[_0x85cd('0x3')],'get':function(_0xd3df1c){return'system-'+this[_0x85cd('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0x85cd('0x1')]},'callerIdAll':{'type':Sequelize[_0x85cd('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x85cd('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5cd5f29..1ca9d9f 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 _0x9e54=['Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','transaction','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','hasOwnProperty','html-pdf','eml-format','request-promise','moment','bluebird','util','path','to-csv','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','name','index','VoicePrefix','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','describe','create','sequelize','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','context','exten','app','system','description','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push'];(function(_0x32f380,_0x65a1ea){var _0x2c5a0e=function(_0x49b821){while(--_0x49b821){_0x32f380['push'](_0x32f380['shift']());}};_0x2c5a0e(++_0x65a1ea);}(_0x9e54,0x88));var _0x49e5=function(_0x285260,_0x15f9ad){_0x285260=_0x285260-0x0;var _0xa73eb5=_0x9e54[_0x285260];return _0xa73eb5;};'use strict';var pdf=require(_0x49e5('0x0'));var emlformat=require(_0x49e5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x49e5('0x2'));var moment=require(_0x49e5('0x3'));var BPromise=require(_0x49e5('0x4'));var Mustache=require('mustache');var util=require(_0x49e5('0x5'));var path=require(_0x49e5('0x6'));var sox=require('sox');var csv=require(_0x49e5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x49e5('0x8'));var crypto=require('crypto');var jsforce=require(_0x49e5('0x9'));var deskjs=require(_0x49e5('0xa'));var toCsv=require(_0x49e5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x49e5('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x49e5('0xc'));var as=require(_0x49e5('0xd'));var hardwareService=require(_0x49e5('0xe'));var logger=require(_0x49e5('0xf'))(_0x49e5('0x10'));var utils=require('../../config/utils');var config=require(_0x49e5('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x49e5('0x12'))['db'];config[_0x49e5('0x13')]=_[_0x49e5('0x14')](config[_0x49e5('0x13')],{'host':_0x49e5('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x49e5('0x16'))[_0x49e5('0x17')](socket);function respondWithStatusCode(_0x5ea43e,_0x56ae34){_0x56ae34=_0x56ae34||0xcc;return function(_0x3b7cd4){if(_0x3b7cd4){return _0x5ea43e['sendStatus'](_0x56ae34);}return _0x5ea43e[_0x49e5('0x18')](_0x56ae34)['end']();};}function respondWithResult(_0x2cc353,_0x13bc7f){_0x13bc7f=_0x13bc7f||0xc8;return function(_0x375488){if(_0x375488){return _0x2cc353['status'](_0x13bc7f)[_0x49e5('0x19')](_0x375488);}};}function respondWithFilteredResult(_0x273023,_0x37c0d3){return function(_0x1e2723){if(_0x1e2723){var _0xfc4935=_0x1e2723[_0x49e5('0x1a')],_0xff869e=_0x37c0d3[_0x49e5('0x1b')],_0x3ba258=_0x37c0d3['offset']+_0x37c0d3[_0x49e5('0x1c')],_0x4dca4f;if(_0x3ba258>=_0xfc4935){_0x3ba258=_0xfc4935;_0x4dca4f=0xc8;}else{_0x4dca4f=0xce;}_0x273023['status'](_0x4dca4f);return _0x273023[_0x49e5('0x1d')](_0x49e5('0x1e'),_0xff869e+'-'+_0x3ba258+'/'+_0xfc4935)['json'](_0x1e2723);}return null;};}function patchUpdates(_0x136838){return function(_0x41c6d0){try{jsonpatch[_0x49e5('0x1f')](_0x41c6d0,_0x136838,!![]);}catch(_0x21ce13){return BPromise[_0x49e5('0x20')](_0x21ce13);}return _0x41c6d0[_0x49e5('0x21')]();};}function saveUpdates(_0x5e8569,_0x1a2f8e){return function(_0x5c3062){if(_0x5c3062){return _0x5c3062[_0x49e5('0x22')](_0x5e8569)[_0x49e5('0x23')](function(_0x1033ed){return _0x1033ed;});}return null;};}function removeEntity(_0x2d1d63,_0x25ecb9){return function(_0xe5b1ea){if(_0xe5b1ea){return _0xe5b1ea['destroy']()['then'](function(){var _0xd96520=_0xe5b1ea[_0x49e5('0x24')]({'plain':!![]});var _0x5531bf=_0x49e5('0x25');return db[_0x49e5('0x26')][_0x49e5('0x27')]({'where':{'type':_0x5531bf,'resourceId':_0xd96520['id']}})[_0x49e5('0x23')](function(){return _0xe5b1ea;});})[_0x49e5('0x23')](function(){_0x2d1d63[_0x49e5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xadf789,_0x18db07){return function(_0x3cb351){if(!_0x3cb351){_0xadf789['sendStatus'](0x194);}return _0x3cb351;};}function handleError(_0x300754,_0x4cab78){_0x4cab78=_0x4cab78||0x1f4;return function(_0x365aeb){logger[_0x49e5('0x28')](_0x365aeb['stack']);if(_0x365aeb['name']){delete _0x365aeb[_0x49e5('0x29')];}_0x300754[_0x49e5('0x18')](_0x4cab78)['send'](_0x365aeb);};}exports[_0x49e5('0x2a')]=function(_0x5c0cb8,_0x36d49e){var _0x1ce332={},_0x9408b6={},_0x3167c5={'count':0x0,'rows':[]};var _0x141cba=_['map'](db[_0x49e5('0x2b')][_0x49e5('0x2c')],function(_0x412d7f){return{'name':_0x412d7f[_0x49e5('0x2d')],'type':_0x412d7f[_0x49e5('0x2e')]['key']};});_0x9408b6[_0x49e5('0x2f')]=_[_0x49e5('0x30')](_0x141cba,'name');_0x9408b6[_0x49e5('0x31')]=_['keys'](_0x5c0cb8['query']);_0x9408b6[_0x49e5('0x32')]=_[_0x49e5('0x33')](_0x9408b6['model'],_0x9408b6['query']);_0x1ce332[_0x49e5('0x34')]=_['intersection'](_0x9408b6[_0x49e5('0x2f')],qs[_0x49e5('0x35')](_0x5c0cb8[_0x49e5('0x31')][_0x49e5('0x35')]));_0x1ce332[_0x49e5('0x34')]=_0x1ce332[_0x49e5('0x34')][_0x49e5('0x36')]?_0x1ce332[_0x49e5('0x34')]:_0x9408b6[_0x49e5('0x2f')];if(!_0x5c0cb8[_0x49e5('0x31')]['hasOwnProperty'](_0x49e5('0x37'))){_0x1ce332['limit']=qs['limit'](_0x5c0cb8[_0x49e5('0x31')][_0x49e5('0x1c')]);_0x1ce332[_0x49e5('0x1b')]=qs[_0x49e5('0x1b')](_0x5c0cb8[_0x49e5('0x31')][_0x49e5('0x1b')]);}_0x1ce332[_0x49e5('0x38')]=qs[_0x49e5('0x39')](_0x5c0cb8[_0x49e5('0x31')][_0x49e5('0x39')]);_0x1ce332[_0x49e5('0x3a')]=qs[_0x49e5('0x32')](_[_0x49e5('0x3b')](_0x5c0cb8[_0x49e5('0x31')],_0x9408b6[_0x49e5('0x32')]),_0x141cba);if(_0x5c0cb8['query'][_0x49e5('0x3c')]){_0x1ce332['where']=_[_0x49e5('0x3d')](_0x1ce332[_0x49e5('0x3a')],{'$or':_['map'](_0x141cba,function(_0x19d78f){if(_0x19d78f[_0x49e5('0x2e')]!=='VIRTUAL'){var _0xa2c50c={};_0xa2c50c[_0x19d78f['name']]={'$like':'%'+_0x5c0cb8[_0x49e5('0x31')][_0x49e5('0x3c')]+'%'};return _0xa2c50c;}})});}_0x1ce332=_[_0x49e5('0x3d')]({},_0x1ce332,_0x5c0cb8['options']);var _0x3f451f={'where':_0x1ce332[_0x49e5('0x3a')]};return db[_0x49e5('0x2b')]['count'](_0x3f451f)[_0x49e5('0x23')](function(_0x54d2a0){_0x3167c5[_0x49e5('0x1a')]=_0x54d2a0;if(_0x5c0cb8['query'][_0x49e5('0x3e')]){_0x1ce332[_0x49e5('0x3f')]=[{'all':!![]}];}return db[_0x49e5('0x2b')][_0x49e5('0x40')](_0x1ce332);})[_0x49e5('0x23')](function(_0x13fbb6){_0x3167c5[_0x49e5('0x41')]=_0x13fbb6;return _0x3167c5;})[_0x49e5('0x23')](respondWithFilteredResult(_0x36d49e,_0x1ce332))[_0x49e5('0x42')](handleError(_0x36d49e,null));};exports[_0x49e5('0x43')]=function(_0x5714b5,_0x29d769){var _0x227add={'raw':![],'where':{'id':_0x5714b5[_0x49e5('0x44')]['id']}},_0x56b617={};_0x56b617[_0x49e5('0x2f')]=_[_0x49e5('0x45')](db['VoicePrefix'][_0x49e5('0x2c')]);_0x56b617[_0x49e5('0x31')]=_['keys'](_0x5714b5[_0x49e5('0x31')]);_0x56b617[_0x49e5('0x32')]=_[_0x49e5('0x33')](_0x56b617['model'],_0x56b617[_0x49e5('0x31')]);_0x227add[_0x49e5('0x34')]=_[_0x49e5('0x33')](_0x56b617[_0x49e5('0x2f')],qs[_0x49e5('0x35')](_0x5714b5[_0x49e5('0x31')][_0x49e5('0x35')]));_0x227add[_0x49e5('0x34')]=_0x227add['attributes'][_0x49e5('0x36')]?_0x227add[_0x49e5('0x34')]:_0x56b617[_0x49e5('0x2f')];if(_0x5714b5[_0x49e5('0x31')][_0x49e5('0x3e')]){_0x227add[_0x49e5('0x3f')]=[{'all':!![]}];}_0x227add=_[_0x49e5('0x3d')]({},_0x227add,_0x5714b5[_0x49e5('0x46')]);return db[_0x49e5('0x2b')][_0x49e5('0x47')](_0x227add)[_0x49e5('0x23')](handleEntityNotFound(_0x29d769,null))[_0x49e5('0x23')](respondWithResult(_0x29d769,null))[_0x49e5('0x42')](handleError(_0x29d769,null));};exports['destroy']=function(_0x24a352,_0x46fef6){return db[_0x49e5('0x2b')][_0x49e5('0x47')]({'where':{'id':_0x24a352['params']['id']}})[_0x49e5('0x23')](handleEntityNotFound(_0x46fef6,null))[_0x49e5('0x23')](removeEntity(_0x46fef6,null))[_0x49e5('0x42')](handleError(_0x46fef6,null));};exports[_0x49e5('0x48')]=function(_0x56b43e,_0x464074){return db[_0x49e5('0x2b')][_0x49e5('0x48')]()[_0x49e5('0x23')](respondWithResult(_0x464074,null))['catch'](handleError(_0x464074,null));};exports[_0x49e5('0x49')]=function(_0x224984,_0x283cad){var _0x262e7d;return db[_0x49e5('0x4a')]['transaction'](function(_0x1c8ba7){return db[_0x49e5('0x2b')][_0x49e5('0x49')](_0x224984[_0x49e5('0x4b')],{'transaction':_0x1c8ba7})[_0x49e5('0x23')](function(_0x399c79){_0x262e7d=_0x399c79[_0x49e5('0x24')]({'plain':!![]});return db[_0x49e5('0x4c')]['find']({'where':{'id':_0x262e7d['VoiceExtensionId']},'raw':!![]})['then'](function(_0x15508e){return createVoicePrefixExtensions(_0x262e7d,_0x15508e,_0x1c8ba7);});});})['then'](function(){var _0x280c81=_0x224984[_0x49e5('0x4d')]['get']({'plain':!![]});if(!_0x280c81)throw new Error(_0x49e5('0x4e'));if(_0x280c81['role']===_0x49e5('0x4d')){var _0x474467=_0x262e7d;return db[_0x49e5('0x4f')][_0x49e5('0x47')]({'where':{'name':_0x49e5('0x25'),'userProfileId':_0x280c81[_0x49e5('0x50')]},'raw':!![]})[_0x49e5('0x23')](function(_0x5ea366){if(_0x5ea366&&_0x5ea366[_0x49e5('0x51')]===0x0){return db[_0x49e5('0x26')][_0x49e5('0x49')]({'name':_0x474467[_0x49e5('0x29')],'resourceId':_0x474467['id'],'type':_0x5ea366[_0x49e5('0x29')],'sectionId':_0x5ea366['id']},{})['then'](function(){return _0x262e7d;});}else{return _0x262e7d;}})[_0x49e5('0x42')](function(_0xf4d626){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf4d626);throw _0xf4d626;});}return _0x262e7d;})[_0x49e5('0x23')](respondWithResult(_0x283cad,null))['catch'](handleError(_0x283cad,null));};function Extension(_0x5dfc26,_0x176688,_0x34b19e,_0x264cb9){this[_0x49e5('0x52')]='from-sip';this[_0x49e5('0x53')]=_0x5dfc26;this[_0x49e5('0x54')]=_0x34b19e;this[_0x49e5('0x2e')]=_0x49e5('0x55');this[_0x49e5('0x56')]='Voice\x20Prefix\x20Extension';this['priority']=_0x176688;this['appdata']=_0x264cb9;}function createVoicePrefixExtensions(_0x5c362f,_0x5b1309,_0x489428){return new BPromise(function(_0x54f90a,_0x3ab15a){var _0x2cd700=new Extension(formatPrefixName(_0x5c362f[_0x49e5('0x57')]),0x1,_0x49e5('0x58'),_0x49e5('0x59'));_0x2cd700[_0x49e5('0x5a')]=_0x5c362f['id'];return db[_0x49e5('0x4c')][_0x49e5('0x49')](_0x2cd700,{'transaction':_0x489428})[_0x49e5('0x23')](function(_0x13841d){var _0x2428bd=_0x13841d[_0x49e5('0x24')]({'plain':!![]});var _0x13c2b3=_[_0x49e5('0x30')](addVoicePrefixExtensions(_0x5c362f,_0x5b1309),function(_0x12c926){_0x12c926['VoiceExtensionId']=_0x2428bd['id'];_0x12c926['VoicePrefixId']=_0x5c362f['id'];return _0x12c926;});return db[_0x49e5('0x4c')][_0x49e5('0x5b')](_0x13c2b3,{'transaction':_0x489428})[_0x49e5('0x23')](function(_0x56075c){if(!_0x56075c){return _0x3ab15a(_0x49e5('0x5c'));}else{return _0x54f90a(_0x56075c);}})[_0x49e5('0x42')](function(_0xb5e9d1){return _0x3ab15a(_0xb5e9d1);});});;});};function addVoicePrefixExtensions(_0x5ad8df,_0x1697a0){var _0x12286f=[];var _0x2c73de=formatPrefixName(_0x5ad8df[_0x49e5('0x57')]);_0x12286f[_0x49e5('0x5d')](new Extension(_0x2c73de,0x2,_0x49e5('0x5e'),_0x49e5('0x5f')+_0x5ad8df[_0x49e5('0x29')]));if(_0x5ad8df['callerIdAll']){_0x12286f[_0x49e5('0x5d')](new Extension(_0x2c73de,0x3,_0x49e5('0x5e'),_0x49e5('0x60')+_0x5ad8df[_0x49e5('0x61')]));}else{_0x12286f[_0x49e5('0x5d')](new Extension(_0x2c73de,0x3,_0x49e5('0x58'),_0x49e5('0x62')));}_0x12286f[_0x49e5('0x5d')](new Extension(_0x2c73de,0x4,_0x49e5('0x63'),_0x1697a0[_0x49e5('0x52')]+','+_0x49e5('0x64')+(0x8+_0x5ad8df[_0x49e5('0x29')][_0x49e5('0x36')])+'}'+','+0x1));return _0x12286f;}function formatPrefixName(_0xff2d12){var _0x292cbe='_';for(var _0x47e48c=0x0;_0x47e48c<_0xff2d12[_0x49e5('0x36')];_0x47e48c++){if(_0xff2d12[_0x49e5('0x65')](_0x47e48c)=='-'){_0x292cbe+=_0xff2d12[_0x49e5('0x65')](_0x47e48c);}else{_0x292cbe+='['+_0xff2d12[_0x49e5('0x65')](_0x47e48c)+']';}}_0x292cbe+='.';return _0x292cbe;}exports[_0x49e5('0x22')]=function(_0x211d57,_0x56a6ce,_0x3a8105){var _0xc57d21=_0x211d57['body'];_0xc57d21[_0x49e5('0x57')]=_0x49e5('0x66')+_0xc57d21[_0x49e5('0x29')]+'-';return db['sequelize'][_0x49e5('0x67')](function(_0x5311e6){return db[_0x49e5('0x2b')]['update'](_0xc57d21,{'where':{'id':_0xc57d21['id']},'transaction':_0x5311e6})['then'](function(){return db[_0x49e5('0x4c')][_0x49e5('0x27')]({'where':{'VoicePrefixId':_0xc57d21['id']},'transaction':_0x5311e6})['then'](function(){return db[_0x49e5('0x4c')][_0x49e5('0x47')]({'where':{'id':_0xc57d21['VoiceExtensionId']},'raw':!![]})['then'](function(_0x359de7){return createVoicePrefixExtensions(_0xc57d21,_0x359de7,_0x5311e6);});});});})[_0x49e5('0x23')](function(){return db[_0x49e5('0x2b')]['findById'](_0xc57d21['id']);})[_0x49e5('0x23')](respondWithResult(_0x56a6ce,null))[_0x49e5('0x42')](handleError(_0x56a6ce,null));};exports[_0x49e5('0x68')]=function(_0xc1f743,_0x552592,_0x45cb25){return db['VoicePrefix'][_0x49e5('0x47')]({'where':{'id':_0xc1f743['params']['id']}})[_0x49e5('0x23')](handleEntityNotFound(_0x552592,null))[_0x49e5('0x23')](function(_0x1d65f3){if(_0x1d65f3){return _0x1d65f3[_0x49e5('0x68')](_0xc1f743[_0x49e5('0x4b')][_0x49e5('0x69')],_['omit'](_0xc1f743[_0x49e5('0x4b')],[_0x49e5('0x69'),'id'])||{})[_0x49e5('0x6a')](function(_0x40c04e){for(var _0xb5149b=0x0;_0xb5149b<_0xc1f743[_0x49e5('0x4b')]['ids'][_0x49e5('0x36')];_0xb5149b+=0x1){socket[_0x49e5('0x6b')](_0x49e5('0x6c'),{'UserId':_0xc1f743[_0x49e5('0x4b')][_0x49e5('0x69')][_0xb5149b],'VoicePrefixId':_0xc1f743[_0x49e5('0x44')]['id']});}return _0x40c04e;});}})[_0x49e5('0x23')](respondWithResult(_0x552592,null))[_0x49e5('0x42')](handleError(_0x552592,null));};exports[_0x49e5('0x6d')]=function(_0x1b9c54,_0x473fd8,_0x24947c){return db[_0x49e5('0x2b')][_0x49e5('0x47')]({'where':{'id':_0x1b9c54['params']['id']}})['then'](handleEntityNotFound(_0x473fd8,null))[_0x49e5('0x23')](function(_0x434e25){if(_0x434e25){return _0x434e25['removeAgents'](_0x1b9c54[_0x49e5('0x31')][_0x49e5('0x69')])[_0x49e5('0x23')](function(){if(_[_0x49e5('0x6e')](_0x1b9c54[_0x49e5('0x31')][_0x49e5('0x69')])){for(var _0x5bd697=0x0;_0x5bd697<_0x1b9c54[_0x49e5('0x31')]['ids'][_0x49e5('0x36')];_0x5bd697+=0x1){socket[_0x49e5('0x6b')](_0x49e5('0x6f'),{'UserId':Number(_0x1b9c54[_0x49e5('0x31')]['ids'][_0x5bd697]),'VoicePrefixId':Number(_0x1b9c54[_0x49e5('0x44')]['id'])});}}else{socket[_0x49e5('0x6b')](_0x49e5('0x6f'),{'UserId':Number(_0x1b9c54[_0x49e5('0x31')]['ids']),'VoicePrefixId':Number(_0x1b9c54[_0x49e5('0x44')]['id'])});}});}})[_0x49e5('0x23')](respondWithStatusCode(_0x473fd8,null))['catch'](handleError(_0x473fd8,null));};exports[_0x49e5('0x70')]=function(_0x45adbb,_0x37cf49,_0x2de3af){var _0x552e46={};var _0x136fcb={};var _0x20fde5;var _0x40f03d;return db[_0x49e5('0x2b')][_0x49e5('0x71')]({'where':{'id':_0x45adbb[_0x49e5('0x44')]['id']}})[_0x49e5('0x23')](handleEntityNotFound(_0x37cf49,null))[_0x49e5('0x23')](function(_0x3bde6f){if(_0x3bde6f){_0x20fde5=_0x3bde6f;_0x136fcb[_0x49e5('0x2f')]=_[_0x49e5('0x45')](db['User'][_0x49e5('0x2c')]);_0x136fcb[_0x49e5('0x31')]=_['keys'](_0x45adbb[_0x49e5('0x31')]);_0x136fcb[_0x49e5('0x32')]=_['intersection'](_0x136fcb['model'],_0x136fcb[_0x49e5('0x31')]);_0x552e46['attributes']=_[_0x49e5('0x33')](_0x136fcb[_0x49e5('0x2f')],qs[_0x49e5('0x35')](_0x45adbb['query']['fields']));_0x552e46[_0x49e5('0x34')]=_0x552e46[_0x49e5('0x34')][_0x49e5('0x36')]?_0x552e46[_0x49e5('0x34')]:_0x136fcb[_0x49e5('0x2f')];_0x552e46['order']=qs[_0x49e5('0x39')](_0x45adbb[_0x49e5('0x31')][_0x49e5('0x39')]);_0x552e46[_0x49e5('0x3a')]=qs[_0x49e5('0x32')](_[_0x49e5('0x3b')](_0x45adbb[_0x49e5('0x31')],_0x136fcb[_0x49e5('0x32')]));if(_0x45adbb[_0x49e5('0x31')][_0x49e5('0x3c')]){_0x552e46[_0x49e5('0x3a')]=_[_0x49e5('0x3d')](_0x552e46[_0x49e5('0x3a')],{'$or':_[_0x49e5('0x30')](_0x552e46[_0x49e5('0x34')],function(_0x3a3da6){var _0x5aba07={};_0x5aba07[_0x3a3da6]={'$like':'%'+_0x45adbb['query']['filter']+'%'};return _0x5aba07;})});}_0x552e46=_['merge']({},_0x552e46,_0x45adbb['options']);return _0x20fde5[_0x49e5('0x70')](_0x552e46);}})['then'](function(_0x47c207){if(_0x47c207){_0x40f03d=_0x47c207['length'];if(!_0x45adbb[_0x49e5('0x31')][_0x49e5('0x72')](_0x49e5('0x37'))){_0x552e46[_0x49e5('0x1c')]=qs['limit'](_0x45adbb[_0x49e5('0x31')][_0x49e5('0x1c')]);_0x552e46[_0x49e5('0x1b')]=qs[_0x49e5('0x1b')](_0x45adbb[_0x49e5('0x31')]['offset']);}return _0x20fde5[_0x49e5('0x70')](_0x552e46);}})[_0x49e5('0x23')](function(_0x15187f){if(_0x15187f){return _0x15187f?{'count':_0x40f03d,'rows':_0x15187f}:null;}})['then'](respondWithResult(_0x37cf49,null))[_0x49e5('0x42')](handleError(_0x37cf49,null));}; \ No newline at end of file +var _0xcd05=['util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','keys','describe','transaction','create','get','VoiceExtension','find','VoiceExtensionId','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','Extensions\x20creation\x20failed','push','callerIdAll','Set','PREFIX-CALLERIDALL=','NoOp','No\x20callerid\x20available','${EXTEN:','charAt','update','body','system-','sequelize','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','findOne','getAgents','html-pdf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x174642,_0x4d31d6){var _0x3e1afe=function(_0x4341d8){while(--_0x4341d8){_0x174642['push'](_0x174642['shift']());}};_0x3e1afe(++_0x4d31d6);}(_0xcd05,0x163));var _0x5cd0=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0xcd05[_0x265003];return _0x33c743;};'use strict';var pdf=require(_0x5cd0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5cd0('0x1'));var rp=require(_0x5cd0('0x2'));var moment=require(_0x5cd0('0x3'));var BPromise=require(_0x5cd0('0x4'));var Mustache=require('mustache');var util=require(_0x5cd0('0x5'));var path=require(_0x5cd0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5cd0('0x7'));var squel=require(_0x5cd0('0x8'));var crypto=require(_0x5cd0('0x9'));var jsforce=require(_0x5cd0('0xa'));var deskjs=require(_0x5cd0('0xb'));var toCsv=require(_0x5cd0('0xc'));var querystring=require(_0x5cd0('0xd'));var Papa=require('papaparse');var Redis=require(_0x5cd0('0xe'));var authService=require(_0x5cd0('0xf'));var qs=require(_0x5cd0('0x10'));var as=require(_0x5cd0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cd0('0x12'))(_0x5cd0('0x13'));var utils=require(_0x5cd0('0x14'));var config=require(_0x5cd0('0x15'));var licenseUtil=require(_0x5cd0('0x16'));var db=require(_0x5cd0('0x17'))['db'];config[_0x5cd0('0x18')]=_[_0x5cd0('0x19')](config[_0x5cd0('0x18')],{'host':_0x5cd0('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voicePrefix.socket')[_0x5cd0('0x1b')](socket);function respondWithStatusCode(_0x426a68,_0x555d39){_0x555d39=_0x555d39||0xcc;return function(_0x170f58){if(_0x170f58){return _0x426a68['sendStatus'](_0x555d39);}return _0x426a68[_0x5cd0('0x1c')](_0x555d39)[_0x5cd0('0x1d')]();};}function respondWithResult(_0xf54ddb,_0x580500){_0x580500=_0x580500||0xc8;return function(_0x50aa7f){if(_0x50aa7f){return _0xf54ddb[_0x5cd0('0x1c')](_0x580500)[_0x5cd0('0x1e')](_0x50aa7f);}};}function respondWithFilteredResult(_0x156947,_0x49577b){return function(_0x57d81d){if(_0x57d81d){var _0x4b7dac=_0x57d81d[_0x5cd0('0x1f')],_0x1847dd=_0x49577b[_0x5cd0('0x20')],_0x106c1e=_0x49577b[_0x5cd0('0x20')]+_0x49577b[_0x5cd0('0x21')],_0x48ede8;if(_0x106c1e>=_0x4b7dac){_0x106c1e=_0x4b7dac;_0x48ede8=0xc8;}else{_0x48ede8=0xce;}_0x156947[_0x5cd0('0x1c')](_0x48ede8);return _0x156947[_0x5cd0('0x22')](_0x5cd0('0x23'),_0x1847dd+'-'+_0x106c1e+'/'+_0x4b7dac)[_0x5cd0('0x1e')](_0x57d81d);}return null;};}function patchUpdates(_0x199130){return function(_0xd270d8){try{jsonpatch[_0x5cd0('0x24')](_0xd270d8,_0x199130,!![]);}catch(_0x3fe03a){return BPromise[_0x5cd0('0x25')](_0x3fe03a);}return _0xd270d8[_0x5cd0('0x26')]();};}function saveUpdates(_0x5c2bd9,_0x4d111f){return function(_0x2e5fe0){if(_0x2e5fe0){return _0x2e5fe0['update'](_0x5c2bd9)[_0x5cd0('0x27')](function(_0x2e01b6){return _0x2e01b6;});}return null;};}function removeEntity(_0x1e8960,_0xa3cbb){return function(_0x3b2400){if(_0x3b2400){return _0x3b2400[_0x5cd0('0x28')]()[_0x5cd0('0x27')](function(){var _0x5385db=_0x3b2400['get']({'plain':!![]});var _0x2cd387=_0x5cd0('0x29');return db[_0x5cd0('0x2a')][_0x5cd0('0x28')]({'where':{'type':_0x2cd387,'resourceId':_0x5385db['id']}})['then'](function(){return _0x3b2400;});})[_0x5cd0('0x27')](function(){_0x1e8960[_0x5cd0('0x1c')](0xcc)[_0x5cd0('0x1d')]();});}};}function handleEntityNotFound(_0x53a6cf,_0x56d59a){return function(_0x403ff3){if(!_0x403ff3){_0x53a6cf[_0x5cd0('0x2b')](0x194);}return _0x403ff3;};}function handleError(_0x5a2123,_0x246525){_0x246525=_0x246525||0x1f4;return function(_0x4020d1){logger[_0x5cd0('0x2c')](_0x4020d1[_0x5cd0('0x2d')]);if(_0x4020d1[_0x5cd0('0x2e')]){delete _0x4020d1[_0x5cd0('0x2e')];}_0x5a2123[_0x5cd0('0x1c')](_0x246525)['send'](_0x4020d1);};}exports[_0x5cd0('0x2f')]=function(_0x1621f9,_0x1b88ac){var _0x3a4b2f={},_0x400148={},_0x2ac3ba={'count':0x0,'rows':[]};var _0x190901=_[_0x5cd0('0x30')](db[_0x5cd0('0x31')][_0x5cd0('0x32')],function(_0x4d4054){return{'name':_0x4d4054[_0x5cd0('0x33')],'type':_0x4d4054[_0x5cd0('0x34')]['key']};});_0x400148[_0x5cd0('0x35')]=_['map'](_0x190901,_0x5cd0('0x2e'));_0x400148[_0x5cd0('0x36')]=_['keys'](_0x1621f9[_0x5cd0('0x36')]);_0x400148['filters']=_[_0x5cd0('0x37')](_0x400148[_0x5cd0('0x35')],_0x400148[_0x5cd0('0x36')]);_0x3a4b2f['attributes']=_[_0x5cd0('0x37')](_0x400148['model'],qs[_0x5cd0('0x38')](_0x1621f9[_0x5cd0('0x36')]['fields']));_0x3a4b2f[_0x5cd0('0x39')]=_0x3a4b2f[_0x5cd0('0x39')][_0x5cd0('0x3a')]?_0x3a4b2f[_0x5cd0('0x39')]:_0x400148[_0x5cd0('0x35')];if(!_0x1621f9['query']['hasOwnProperty'](_0x5cd0('0x3b'))){_0x3a4b2f[_0x5cd0('0x21')]=qs['limit'](_0x1621f9[_0x5cd0('0x36')][_0x5cd0('0x21')]);_0x3a4b2f[_0x5cd0('0x20')]=qs[_0x5cd0('0x20')](_0x1621f9[_0x5cd0('0x36')]['offset']);}_0x3a4b2f[_0x5cd0('0x3c')]=qs[_0x5cd0('0x3d')](_0x1621f9[_0x5cd0('0x36')][_0x5cd0('0x3d')]);_0x3a4b2f[_0x5cd0('0x3e')]=qs[_0x5cd0('0x3f')](_[_0x5cd0('0x40')](_0x1621f9[_0x5cd0('0x36')],_0x400148[_0x5cd0('0x3f')]),_0x190901);if(_0x1621f9[_0x5cd0('0x36')][_0x5cd0('0x41')]){_0x3a4b2f[_0x5cd0('0x3e')]=_[_0x5cd0('0x42')](_0x3a4b2f[_0x5cd0('0x3e')],{'$or':_['map'](_0x190901,function(_0x48c7e9){if(_0x48c7e9[_0x5cd0('0x34')]!=='VIRTUAL'){var _0x2b3f00={};_0x2b3f00[_0x48c7e9['name']]={'$like':'%'+_0x1621f9[_0x5cd0('0x36')][_0x5cd0('0x41')]+'%'};return _0x2b3f00;}})});}_0x3a4b2f=_[_0x5cd0('0x42')]({},_0x3a4b2f,_0x1621f9[_0x5cd0('0x43')]);var _0x61246d={'where':_0x3a4b2f['where']};return db[_0x5cd0('0x31')]['count'](_0x61246d)['then'](function(_0x25f583){_0x2ac3ba[_0x5cd0('0x1f')]=_0x25f583;if(_0x1621f9[_0x5cd0('0x36')]['includeAll']){_0x3a4b2f[_0x5cd0('0x44')]=[{'all':!![]}];}return db['VoicePrefix'][_0x5cd0('0x45')](_0x3a4b2f);})['then'](function(_0x50b7ac){_0x2ac3ba[_0x5cd0('0x46')]=_0x50b7ac;return _0x2ac3ba;})[_0x5cd0('0x27')](respondWithFilteredResult(_0x1b88ac,_0x3a4b2f))[_0x5cd0('0x47')](handleError(_0x1b88ac,null));};exports[_0x5cd0('0x48')]=function(_0xc18579,_0x503851){var _0x3b489b={'raw':![],'where':{'id':_0xc18579[_0x5cd0('0x49')]['id']}},_0x44a10a={};_0x44a10a[_0x5cd0('0x35')]=_['keys'](db[_0x5cd0('0x31')][_0x5cd0('0x32')]);_0x44a10a[_0x5cd0('0x36')]=_[_0x5cd0('0x4a')](_0xc18579[_0x5cd0('0x36')]);_0x44a10a['filters']=_[_0x5cd0('0x37')](_0x44a10a[_0x5cd0('0x35')],_0x44a10a[_0x5cd0('0x36')]);_0x3b489b[_0x5cd0('0x39')]=_[_0x5cd0('0x37')](_0x44a10a['model'],qs[_0x5cd0('0x38')](_0xc18579[_0x5cd0('0x36')]['fields']));_0x3b489b['attributes']=_0x3b489b[_0x5cd0('0x39')][_0x5cd0('0x3a')]?_0x3b489b[_0x5cd0('0x39')]:_0x44a10a[_0x5cd0('0x35')];if(_0xc18579[_0x5cd0('0x36')]['includeAll']){_0x3b489b['include']=[{'all':!![]}];}_0x3b489b=_[_0x5cd0('0x42')]({},_0x3b489b,_0xc18579[_0x5cd0('0x43')]);return db[_0x5cd0('0x31')]['find'](_0x3b489b)[_0x5cd0('0x27')](handleEntityNotFound(_0x503851,null))['then'](respondWithResult(_0x503851,null))[_0x5cd0('0x47')](handleError(_0x503851,null));};exports[_0x5cd0('0x28')]=function(_0x2f2a70,_0x57f014){return db[_0x5cd0('0x31')]['find']({'where':{'id':_0x2f2a70[_0x5cd0('0x49')]['id']}})[_0x5cd0('0x27')](handleEntityNotFound(_0x57f014,null))[_0x5cd0('0x27')](removeEntity(_0x57f014,null))[_0x5cd0('0x47')](handleError(_0x57f014,null));};exports['describe']=function(_0x46853a,_0x5dbcf1){return db[_0x5cd0('0x31')][_0x5cd0('0x4b')]()[_0x5cd0('0x27')](respondWithResult(_0x5dbcf1,null))[_0x5cd0('0x47')](handleError(_0x5dbcf1,null));};exports['create']=function(_0x1c36fc,_0x1671b9){var _0x4e4d2f;return db['sequelize'][_0x5cd0('0x4c')](function(_0x2e363e){return db[_0x5cd0('0x31')][_0x5cd0('0x4d')](_0x1c36fc['body'],{'transaction':_0x2e363e})[_0x5cd0('0x27')](function(_0xfd43df){_0x4e4d2f=_0xfd43df[_0x5cd0('0x4e')]({'plain':!![]});return db[_0x5cd0('0x4f')][_0x5cd0('0x50')]({'where':{'id':_0x4e4d2f[_0x5cd0('0x51')]},'raw':!![]})[_0x5cd0('0x27')](function(_0x1818bc){return createVoicePrefixExtensions(_0x4e4d2f,_0x1818bc,_0x2e363e);});});})[_0x5cd0('0x27')](function(){var _0x200097=_0x1c36fc['user'][_0x5cd0('0x4e')]({'plain':!![]});if(!_0x200097)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x200097[_0x5cd0('0x52')]===_0x5cd0('0x53')){var _0x267e57=_0x4e4d2f;return db[_0x5cd0('0x54')][_0x5cd0('0x50')]({'where':{'name':'VoicePrefixes','userProfileId':_0x200097[_0x5cd0('0x55')]},'raw':!![]})[_0x5cd0('0x27')](function(_0x4d4746){if(_0x4d4746&&_0x4d4746[_0x5cd0('0x56')]===0x0){return db['UserProfileResource'][_0x5cd0('0x4d')]({'name':_0x267e57['name'],'resourceId':_0x267e57['id'],'type':_0x4d4746[_0x5cd0('0x2e')],'sectionId':_0x4d4746['id']},{})['then'](function(){return _0x4e4d2f;});}else{return _0x4e4d2f;}})[_0x5cd0('0x47')](function(_0xeb7597){logger[_0x5cd0('0x2c')](_0x5cd0('0x57'),_0xeb7597);throw _0xeb7597;});}return _0x4e4d2f;})['then'](respondWithResult(_0x1671b9,null))[_0x5cd0('0x47')](handleError(_0x1671b9,null));};function Extension(_0x2ed486,_0x2d823d,_0x26b377,_0xd2464b){this[_0x5cd0('0x58')]=_0x5cd0('0x59');this['exten']=_0x2ed486;this[_0x5cd0('0x5a')]=_0x26b377;this[_0x5cd0('0x34')]=_0x5cd0('0x5b');this[_0x5cd0('0x5c')]=_0x5cd0('0x5d');this[_0x5cd0('0x5e')]=_0x2d823d;this[_0x5cd0('0x5f')]=_0xd2464b;}function createVoicePrefixExtensions(_0x4f2f00,_0x14686d,_0x1c360d){return new BPromise(function(_0x2fb227,_0xc8cca9){var _0x360adf=new Extension(formatPrefixName(_0x4f2f00[_0x5cd0('0x60')]),0x1,'NoOp','Voice\x20Prefix');_0x360adf[_0x5cd0('0x61')]=_0x4f2f00['id'];return db['VoiceExtension'][_0x5cd0('0x4d')](_0x360adf,{'transaction':_0x1c360d})['then'](function(_0x460a9b){var _0x13f0cd=_0x460a9b['get']({'plain':!![]});var _0x16bbd2=_[_0x5cd0('0x30')](addVoicePrefixExtensions(_0x4f2f00,_0x14686d),function(_0x2243f2){_0x2243f2['VoiceExtensionId']=_0x13f0cd['id'];_0x2243f2[_0x5cd0('0x61')]=_0x4f2f00['id'];return _0x2243f2;});return db[_0x5cd0('0x4f')]['bulkCreate'](_0x16bbd2,{'transaction':_0x1c360d})[_0x5cd0('0x27')](function(_0x3a0a67){if(!_0x3a0a67){return _0xc8cca9(_0x5cd0('0x62'));}else{return _0x2fb227(_0x3a0a67);}})[_0x5cd0('0x47')](function(_0x3fe7c2){return _0xc8cca9(_0x3fe7c2);});});;});};function addVoicePrefixExtensions(_0x21d80d,_0x2206d4){var _0x2abc0a=[];var _0x49e8aa=formatPrefixName(_0x21d80d[_0x5cd0('0x60')]);_0x2abc0a[_0x5cd0('0x63')](new Extension(_0x49e8aa,0x2,'Set','CDR(prefix)='+_0x21d80d[_0x5cd0('0x2e')]));if(_0x21d80d[_0x5cd0('0x64')]){_0x2abc0a['push'](new Extension(_0x49e8aa,0x3,_0x5cd0('0x65'),_0x5cd0('0x66')+_0x21d80d[_0x5cd0('0x64')]));}else{_0x2abc0a[_0x5cd0('0x63')](new Extension(_0x49e8aa,0x3,_0x5cd0('0x67'),_0x5cd0('0x68')));}_0x2abc0a[_0x5cd0('0x63')](new Extension(_0x49e8aa,0x4,'goto',_0x2206d4[_0x5cd0('0x58')]+','+_0x5cd0('0x69')+(0x8+_0x21d80d[_0x5cd0('0x2e')]['length'])+'}'+','+0x1));return _0x2abc0a;}function formatPrefixName(_0x4694bd){var _0x38bdb7='_';for(var _0x357e1a=0x0;_0x357e1a<_0x4694bd[_0x5cd0('0x3a')];_0x357e1a++){if(_0x4694bd[_0x5cd0('0x6a')](_0x357e1a)=='-'){_0x38bdb7+=_0x4694bd[_0x5cd0('0x6a')](_0x357e1a);}else{_0x38bdb7+='['+_0x4694bd[_0x5cd0('0x6a')](_0x357e1a)+']';}}_0x38bdb7+='.';return _0x38bdb7;}exports[_0x5cd0('0x6b')]=function(_0x69880a,_0x471f51,_0x410ac7){var _0x1e0d5a=_0x69880a[_0x5cd0('0x6c')];_0x1e0d5a[_0x5cd0('0x60')]=_0x5cd0('0x6d')+_0x1e0d5a[_0x5cd0('0x2e')]+'-';return db[_0x5cd0('0x6e')][_0x5cd0('0x4c')](function(_0xd35b38){return db['VoicePrefix'][_0x5cd0('0x6b')](_0x1e0d5a,{'where':{'id':_0x1e0d5a['id']},'transaction':_0xd35b38})['then'](function(){return db[_0x5cd0('0x4f')][_0x5cd0('0x28')]({'where':{'VoicePrefixId':_0x1e0d5a['id']},'transaction':_0xd35b38})[_0x5cd0('0x27')](function(){return db[_0x5cd0('0x4f')]['find']({'where':{'id':_0x1e0d5a['VoiceExtensionId']},'raw':!![]})['then'](function(_0x836d8d){return createVoicePrefixExtensions(_0x1e0d5a,_0x836d8d,_0xd35b38);});});});})[_0x5cd0('0x27')](function(){return db['VoicePrefix']['findById'](_0x1e0d5a['id']);})[_0x5cd0('0x27')](respondWithResult(_0x471f51,null))[_0x5cd0('0x47')](handleError(_0x471f51,null));};exports[_0x5cd0('0x6f')]=function(_0x2a9c40,_0x53ffa6,_0x1098d9){return db[_0x5cd0('0x31')][_0x5cd0('0x50')]({'where':{'id':_0x2a9c40['params']['id']}})[_0x5cd0('0x27')](handleEntityNotFound(_0x53ffa6,null))['then'](function(_0x594995){if(_0x594995){return _0x594995[_0x5cd0('0x6f')](_0x2a9c40[_0x5cd0('0x6c')][_0x5cd0('0x70')],_['omit'](_0x2a9c40[_0x5cd0('0x6c')],[_0x5cd0('0x70'),'id'])||{})[_0x5cd0('0x71')](function(_0x156b8e){for(var _0x271b6c=0x0;_0x271b6c<_0x2a9c40[_0x5cd0('0x6c')]['ids'][_0x5cd0('0x3a')];_0x271b6c+=0x1){socket[_0x5cd0('0x72')](_0x5cd0('0x73'),{'UserId':_0x2a9c40[_0x5cd0('0x6c')][_0x5cd0('0x70')][_0x271b6c],'VoicePrefixId':_0x2a9c40[_0x5cd0('0x49')]['id']});}return _0x156b8e;});}})[_0x5cd0('0x27')](respondWithResult(_0x53ffa6,null))['catch'](handleError(_0x53ffa6,null));};exports[_0x5cd0('0x74')]=function(_0x51aab9,_0x51c432,_0x3f9944){return db[_0x5cd0('0x31')][_0x5cd0('0x50')]({'where':{'id':_0x51aab9[_0x5cd0('0x49')]['id']}})[_0x5cd0('0x27')](handleEntityNotFound(_0x51c432,null))[_0x5cd0('0x27')](function(_0x2a9b69){if(_0x2a9b69){return _0x2a9b69['removeAgents'](_0x51aab9[_0x5cd0('0x36')][_0x5cd0('0x70')])['then'](function(){if(_['isArray'](_0x51aab9[_0x5cd0('0x36')][_0x5cd0('0x70')])){for(var _0x1d8ab8=0x0;_0x1d8ab8<_0x51aab9['query']['ids'][_0x5cd0('0x3a')];_0x1d8ab8+=0x1){socket[_0x5cd0('0x72')](_0x5cd0('0x75'),{'UserId':Number(_0x51aab9['query'][_0x5cd0('0x70')][_0x1d8ab8]),'VoicePrefixId':Number(_0x51aab9['params']['id'])});}}else{socket[_0x5cd0('0x72')]('userVoicePrefix:remove',{'UserId':Number(_0x51aab9[_0x5cd0('0x36')][_0x5cd0('0x70')]),'VoicePrefixId':Number(_0x51aab9[_0x5cd0('0x49')]['id'])});}});}})[_0x5cd0('0x27')](respondWithStatusCode(_0x51c432,null))[_0x5cd0('0x47')](handleError(_0x51c432,null));};exports['getAgents']=function(_0xcc11bb,_0x2f0f9d,_0x11310a){var _0x488e6c={};var _0x2d1b95={};var _0x2a2a93;var _0x3678b1;return db[_0x5cd0('0x31')][_0x5cd0('0x76')]({'where':{'id':_0xcc11bb['params']['id']}})['then'](handleEntityNotFound(_0x2f0f9d,null))['then'](function(_0x21d86f){if(_0x21d86f){_0x2a2a93=_0x21d86f;_0x2d1b95[_0x5cd0('0x35')]=_[_0x5cd0('0x4a')](db['User'][_0x5cd0('0x32')]);_0x2d1b95[_0x5cd0('0x36')]=_['keys'](_0xcc11bb['query']);_0x2d1b95[_0x5cd0('0x3f')]=_[_0x5cd0('0x37')](_0x2d1b95['model'],_0x2d1b95['query']);_0x488e6c[_0x5cd0('0x39')]=_[_0x5cd0('0x37')](_0x2d1b95['model'],qs[_0x5cd0('0x38')](_0xcc11bb[_0x5cd0('0x36')][_0x5cd0('0x38')]));_0x488e6c[_0x5cd0('0x39')]=_0x488e6c['attributes'][_0x5cd0('0x3a')]?_0x488e6c['attributes']:_0x2d1b95[_0x5cd0('0x35')];_0x488e6c[_0x5cd0('0x3c')]=qs[_0x5cd0('0x3d')](_0xcc11bb[_0x5cd0('0x36')][_0x5cd0('0x3d')]);_0x488e6c[_0x5cd0('0x3e')]=qs[_0x5cd0('0x3f')](_[_0x5cd0('0x40')](_0xcc11bb['query'],_0x2d1b95[_0x5cd0('0x3f')]));if(_0xcc11bb[_0x5cd0('0x36')][_0x5cd0('0x41')]){_0x488e6c['where']=_[_0x5cd0('0x42')](_0x488e6c[_0x5cd0('0x3e')],{'$or':_[_0x5cd0('0x30')](_0x488e6c[_0x5cd0('0x39')],function(_0x257a26){var _0x4ccb65={};_0x4ccb65[_0x257a26]={'$like':'%'+_0xcc11bb[_0x5cd0('0x36')][_0x5cd0('0x41')]+'%'};return _0x4ccb65;})});}_0x488e6c=_[_0x5cd0('0x42')]({},_0x488e6c,_0xcc11bb['options']);return _0x2a2a93[_0x5cd0('0x77')](_0x488e6c);}})[_0x5cd0('0x27')](function(_0x5d291e){if(_0x5d291e){_0x3678b1=_0x5d291e[_0x5cd0('0x3a')];if(!_0xcc11bb['query']['hasOwnProperty'](_0x5cd0('0x3b'))){_0x488e6c[_0x5cd0('0x21')]=qs[_0x5cd0('0x21')](_0xcc11bb['query'][_0x5cd0('0x21')]);_0x488e6c[_0x5cd0('0x20')]=qs['offset'](_0xcc11bb[_0x5cd0('0x36')][_0x5cd0('0x20')]);}return _0x2a2a93[_0x5cd0('0x77')](_0x488e6c);}})[_0x5cd0('0x27')](function(_0x4e70a4){if(_0x4e70a4){return _0x4e70a4?{'count':_0x3678b1,'rows':_0x4e70a4}:null;}})[_0x5cd0('0x27')](respondWithResult(_0x2f0f9d,null))[_0x5cd0('0x47')](handleError(_0x2f0f9d,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 8478cc3..c000971 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(_0x3b7b72,_0x2f770d){var _0x5b1680=function(_0xcec6f6){while(--_0xcec6f6){_0x3b7b72['push'](_0x3b7b72['shift']());}};_0x5b1680(++_0x2f770d);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x417b6b,_0x1592c5){var _0x2b2569=function(_0x3e2b1c){while(--_0x3e2b1c){_0x417b6b['push'](_0x417b6b['shift']());}};_0x2b2569(++_0x1592c5);}(_0x008c,0x188));var _0xc008=function(_0x2dd62d,_0x128ccd){_0x2dd62d=_0x2dd62d-0x0;var _0x18e1a5=_0x008c[_0x2dd62d];return _0x18e1a5;};'use strict';var EventEmitter=require(_0xc008('0x0'));var VoicePrefix=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){VoicePrefixEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);VoicePrefixEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];VoicePrefix[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 0105239..8d67d20 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 _0x39fd=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes'];(function(_0x1a8396,_0x280126){var _0x29ce3=function(_0x2a205a){while(--_0x2a205a){_0x1a8396['push'](_0x1a8396['shift']());}};_0x29ce3(++_0x280126);}(_0x39fd,0x145));var _0xd39f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x39fd[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd39f('0x0'));var util=require(_0xd39f('0x1'));var logger=require('../../config/logger')(_0xd39f('0x2'));var moment=require(_0xd39f('0x3'));var BPromise=require(_0xd39f('0x4'));var rp=require(_0xd39f('0x5'));var fs=require('fs');var path=require(_0xd39f('0x6'));var rimraf=require(_0xd39f('0x7'));var config=require(_0xd39f('0x8'));var attributes=require(_0xd39f('0x9'));module['exports']=function(_0x12f99e,_0x421738){return _0x12f99e[_0xd39f('0xa')](_0xd39f('0xb'),attributes,{'tableName':_0xd39f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab25=['bluebird','request-promise','rimraf','../../config/environment','VoicePrefix','lodash','util','api','moment'];(function(_0x804c45,_0x1ebe6b){var _0x12c447=function(_0x5f7dc9){while(--_0x5f7dc9){_0x804c45['push'](_0x804c45['shift']());}};_0x12c447(++_0x1ebe6b);}(_0xab25,0x137));var _0x5ab2=function(_0x14f4b5,_0x3b064e){_0x14f4b5=_0x14f4b5-0x0;var _0x33fad3=_0xab25[_0x14f4b5];return _0x33fad3;};'use strict';var _=require(_0x5ab2('0x0'));var util=require(_0x5ab2('0x1'));var logger=require('../../config/logger')(_0x5ab2('0x2'));var moment=require(_0x5ab2('0x3'));var BPromise=require(_0x5ab2('0x4'));var rp=require(_0x5ab2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ab2('0x6'));var config=require(_0x5ab2('0x7'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x1334e0,_0x784bf9){return _0x1334e0['define'](_0x5ab2('0x8'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index a96271d..039c6ab 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 _0x0216=['client','http','defaults','localhost','socket.io-emitter','redis','register','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','VoicePrefix,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0xd3aca5,_0x36777f){var _0x302f8e=function(_0x51ba7f){while(--_0x51ba7f){_0xd3aca5['push'](_0xd3aca5['shift']());}};_0x302f8e(++_0x36777f);}(_0x0216,0x149));var _0x6021=function(_0x5b66ce,_0x4818ba){_0x5b66ce=_0x5b66ce-0x0;var _0x316e77=_0x0216[_0x5b66ce];return _0x316e77;};'use strict';var _=require(_0x6021('0x0'));var util=require(_0x6021('0x1'));var moment=require('moment');var BPromise=require(_0x6021('0x2'));var rs=require(_0x6021('0x3'));var fs=require('fs');var Redis=require(_0x6021('0x4'));var db=require(_0x6021('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6021('0x6'))(_0x6021('0x7'));var config=require(_0x6021('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6021('0x9')][_0x6021('0xa')]({'port':0x232a});config['redis']=_[_0x6021('0xb')](config['redis'],{'host':_0x6021('0xc'),'port':0x18eb});var socket=require(_0x6021('0xd'))(new Redis(config[_0x6021('0xe')]));require('./voicePrefix.socket')[_0x6021('0xf')](socket);function respondWithRpcPromise(_0x4e1073,_0x37b6a1,_0x35ecbd){return new BPromise(function(_0xf52738,_0x47cbe1){return client['request'](_0x4e1073,_0x35ecbd)[_0x6021('0x10')](function(_0x1a46a5){logger[_0x6021('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x37b6a1,_0x6021('0x12'));logger[_0x6021('0x13')](_0x6021('0x14'),_0x37b6a1,_0x6021('0x12'),JSON['stringify'](_0x1a46a5));if(_0x1a46a5['error']){if(_0x1a46a5[_0x6021('0x15')][_0x6021('0x16')]===0x1f4){logger[_0x6021('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x37b6a1,_0x1a46a5[_0x6021('0x15')]['message']);return _0x47cbe1(_0x1a46a5[_0x6021('0x15')][_0x6021('0x17')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x37b6a1,_0x1a46a5[_0x6021('0x15')][_0x6021('0x17')]);return _0xf52738(_0x1a46a5[_0x6021('0x15')]['message']);}else{logger['info'](_0x6021('0x18'),_0x37b6a1,'request\x20sent');_0xf52738(_0x1a46a5['result'][_0x6021('0x17')]);}})[_0x6021('0x19')](function(_0x35d076){logger[_0x6021('0x15')](_0x6021('0x18'),_0x37b6a1,_0x35d076);_0x47cbe1(_0x35d076);});});} \ No newline at end of file +var _0xfcf8=['../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3d6882,_0x32b28f){var _0x144acc=function(_0x48d6bf){while(--_0x48d6bf){_0x3d6882['push'](_0x3d6882['shift']());}};_0x144acc(++_0x32b28f);}(_0xfcf8,0x8f));var _0x8fcf=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xfcf8[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x8fcf('0x0'));var util=require(_0x8fcf('0x1'));var moment=require(_0x8fcf('0x2'));var BPromise=require(_0x8fcf('0x3'));var rs=require(_0x8fcf('0x4'));var fs=require('fs');var Redis=require(_0x8fcf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8fcf('0x6'));var logger=require(_0x8fcf('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8fcf('0x8'));var client=jayson['client'][_0x8fcf('0x9')]({'port':0x232a});config[_0x8fcf('0xa')]=_[_0x8fcf('0xb')](config[_0x8fcf('0xa')],{'host':_0x8fcf('0xc'),'port':0x18eb});var socket=require(_0x8fcf('0xd'))(new Redis(config[_0x8fcf('0xa')]));require('./voicePrefix.socket')[_0x8fcf('0xe')](socket);function respondWithRpcPromise(_0x29c383,_0x458217,_0x403bc6){return new BPromise(function(_0x4e65fd,_0x191e26){return client[_0x8fcf('0xf')](_0x29c383,_0x403bc6)['then'](function(_0x431c36){logger['info'](_0x8fcf('0x10'),_0x458217,_0x8fcf('0x11'));logger[_0x8fcf('0x12')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x458217,'request\x20sent',JSON[_0x8fcf('0x13')](_0x431c36));if(_0x431c36[_0x8fcf('0x14')]){if(_0x431c36[_0x8fcf('0x14')][_0x8fcf('0x15')]===0x1f4){logger[_0x8fcf('0x14')](_0x8fcf('0x10'),_0x458217,_0x431c36[_0x8fcf('0x14')][_0x8fcf('0x16')]);return _0x191e26(_0x431c36[_0x8fcf('0x14')][_0x8fcf('0x16')]);}logger[_0x8fcf('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x458217,_0x431c36[_0x8fcf('0x14')][_0x8fcf('0x16')]);return _0x4e65fd(_0x431c36[_0x8fcf('0x14')]['message']);}else{logger['info'](_0x8fcf('0x10'),_0x458217,_0x8fcf('0x11'));_0x4e65fd(_0x431c36[_0x8fcf('0x17')][_0x8fcf('0x16')]);}})[_0x8fcf('0x18')](function(_0x5618dc){logger[_0x8fcf('0x14')](_0x8fcf('0x10'),_0x458217,_0x5618dc);_0x191e26(_0x5618dc);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7bfe2f1..79efb49 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 _0xb358=['length','voicePrefix:','update','emit','removeListener','register'];(function(_0x5d54d0,_0x137acc){var _0x23840e=function(_0x2b9258){while(--_0x2b9258){_0x5d54d0['push'](_0x5d54d0['shift']());}};_0x23840e(++_0x137acc);}(_0xb358,0xda));var _0x8b35=function(_0x31661f,_0x11d5a1){_0x31661f=_0x31661f-0x0;var _0xab6fec=_0xb358[_0x31661f];return _0xab6fec;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save','remove',_0x8b35('0x0')];function createListener(_0xd8364a,_0x64e83d){return function(_0x526cd3){_0x64e83d[_0x8b35('0x1')](_0xd8364a,_0x526cd3);};}function removeListener(_0x5f2ca9,_0x49308a){return function(){VoicePrefixEvents[_0x8b35('0x2')](_0x5f2ca9,_0x49308a);};}exports[_0x8b35('0x3')]=function(_0x18e302){for(var _0x3947af=0x0,_0x56542c=events[_0x8b35('0x4')];_0x3947af<_0x56542c;_0x3947af++){var _0x5d7fd8=events[_0x3947af];var _0x108527=createListener(_0x8b35('0x5')+_0x5d7fd8,_0x18e302);VoicePrefixEvents['on'](_0x5d7fd8,_0x108527);}}; \ No newline at end of file +var _0x4f7e=['length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener','register'];(function(_0x4e6b5b,_0x3eaa7a){var _0x1e89ec=function(_0x556abc){while(--_0x556abc){_0x4e6b5b['push'](_0x4e6b5b['shift']());}};_0x1e89ec(++_0x3eaa7a);}(_0x4f7e,0x110));var _0xe4f7=function(_0x5b93d4,_0xae4167){_0x5b93d4=_0x5b93d4-0x0;var _0x3aa92a=_0x4f7e[_0x5b93d4];return _0x3aa92a;};'use strict';var VoicePrefixEvents=require(_0xe4f7('0x0'));var events=[_0xe4f7('0x1'),_0xe4f7('0x2'),_0xe4f7('0x3')];function createListener(_0x3883fa,_0x779ffd){return function(_0x1ce25d){_0x779ffd[_0xe4f7('0x4')](_0x3883fa,_0x1ce25d);};}function removeListener(_0x29becf,_0x1e0a6c){return function(){VoicePrefixEvents[_0xe4f7('0x5')](_0x29becf,_0x1e0a6c);};}exports[_0xe4f7('0x6')]=function(_0x2c31ab){for(var _0x252e9a=0x0,_0x4f6762=events[_0xe4f7('0x7')];_0x252e9a<_0x4f6762;_0x252e9a++){var _0x1436c9=events[_0x252e9a];var _0x4b338e=createListener(_0xe4f7('0x8')+_0x1436c9,_0x2c31ab);VoicePrefixEvents['on'](_0x1436c9,_0x4b338e);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 136005d..26e7f85 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 _0xc992=['getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/teams','getTeams','getAgents','/:id/members','getMembers','getLists','getBlackLists','post','/:id/clone','addTeams','addAgents','/:id/lists','/:id/blacklists','put','update','destroy','delete','removeTeams','/:id/users','removeAgents','removeBlackLists','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','get','/:id','/:id/hoppers'];(function(_0x1c73a4,_0x1c4858){var _0x402bc9=function(_0x443b1e){while(--_0x443b1e){_0x1c73a4['push'](_0x1c73a4['shift']());}};_0x402bc9(++_0x1c4858);}(_0xc992,0x93));var _0x2c99=function(_0x2b1975,_0x245d12){_0x2b1975=_0x2b1975-0x0;var _0x51a4e7=_0xc992[_0x2b1975];return _0x51a4e7;};'use strict';var multer=require('multer');var util=require(_0x2c99('0x0'));var path=require(_0x2c99('0x1'));var timeout=require(_0x2c99('0x2'));var express=require(_0x2c99('0x3'));var router=express[_0x2c99('0x4')]();var auth=require(_0x2c99('0x5'));var interaction=require(_0x2c99('0x6'));var config=require(_0x2c99('0x7'));var controller=require(_0x2c99('0x8'));router['get']('/',auth[_0x2c99('0x9')](),controller['index']);router[_0x2c99('0xa')](_0x2c99('0xb'),auth[_0x2c99('0x9')](),controller['show']);router[_0x2c99('0xa')](_0x2c99('0xc'),auth[_0x2c99('0x9')](),controller[_0x2c99('0xd')]);router[_0x2c99('0xa')](_0x2c99('0xe'),auth[_0x2c99('0x9')](),controller[_0x2c99('0xf')]);router[_0x2c99('0xa')](_0x2c99('0x10'),auth['isAuthenticated'](),controller[_0x2c99('0x11')]);router[_0x2c99('0xa')]('/:id/hopper_black',auth[_0x2c99('0x9')](),controller['getHopperBlacks']);router[_0x2c99('0xa')](_0x2c99('0x12'),auth[_0x2c99('0x9')](),controller[_0x2c99('0x13')]);router['get']('/:id/users',auth[_0x2c99('0x9')](),controller[_0x2c99('0x14')]);router[_0x2c99('0xa')](_0x2c99('0x15'),auth[_0x2c99('0x9')](),controller[_0x2c99('0x16')]);router[_0x2c99('0xa')]('/:id/lists',auth[_0x2c99('0x9')](),controller[_0x2c99('0x17')]);router[_0x2c99('0xa')]('/:id/blacklists',auth[_0x2c99('0x9')](),controller[_0x2c99('0x18')]);router[_0x2c99('0x19')]('/',auth[_0x2c99('0x9')](),controller['create']);router[_0x2c99('0x19')](_0x2c99('0x1a'),auth[_0x2c99('0x9')](),controller['clone']);router[_0x2c99('0x19')](_0x2c99('0x12'),auth[_0x2c99('0x9')](),controller[_0x2c99('0x1b')]);router['post']('/:id/users',auth[_0x2c99('0x9')](),controller[_0x2c99('0x1c')]);router['post'](_0x2c99('0x1d'),auth[_0x2c99('0x9')](),controller['addLists']);router['post'](_0x2c99('0x1e'),auth[_0x2c99('0x9')](),controller['addBlackLists']);router[_0x2c99('0x1f')](_0x2c99('0xb'),auth[_0x2c99('0x9')](),controller[_0x2c99('0x20')]);router['delete'](_0x2c99('0xb'),auth[_0x2c99('0x9')](),controller[_0x2c99('0x21')]);router[_0x2c99('0x22')](_0x2c99('0x12'),auth[_0x2c99('0x9')](),controller[_0x2c99('0x23')]);router[_0x2c99('0x22')](_0x2c99('0x24'),auth[_0x2c99('0x9')](),controller[_0x2c99('0x25')]);router[_0x2c99('0x22')](_0x2c99('0x1d'),auth['isAuthenticated'](),controller['removeLists']);router['delete']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x2c99('0x26')]);module[_0x2c99('0x27')]=router; \ No newline at end of file +var _0xc59c=['/:id/clone','clone','/:id/teams','/:id/users','addAgents','addLists','addBlackLists','update','delete','destroy','/:id/blacklists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','getTeams','getAgents','getMembers','/:id/lists','getLists','create','post'];(function(_0x1a0658,_0x26ddf7){var _0x35eb2d=function(_0x1fc249){while(--_0x1fc249){_0x1a0658['push'](_0x1a0658['shift']());}};_0x35eb2d(++_0x26ddf7);}(_0xc59c,0xf1));var _0xcc59=function(_0x588fd3,_0x40b0ac){_0x588fd3=_0x588fd3-0x0;var _0x396015=_0xc59c[_0x588fd3];return _0x396015;};'use strict';var multer=require(_0xcc59('0x0'));var util=require(_0xcc59('0x1'));var path=require(_0xcc59('0x2'));var timeout=require(_0xcc59('0x3'));var express=require(_0xcc59('0x4'));var router=express[_0xcc59('0x5')]();var auth=require(_0xcc59('0x6'));var interaction=require(_0xcc59('0x7'));var config=require(_0xcc59('0x8'));var controller=require(_0xcc59('0x9'));router[_0xcc59('0xa')]('/',auth[_0xcc59('0xb')](),controller[_0xcc59('0xc')]);router[_0xcc59('0xa')](_0xcc59('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xcc59('0xa')]('/:id/hoppers',auth[_0xcc59('0xb')](),controller['getHoppers']);router['get'](_0xcc59('0xe'),auth[_0xcc59('0xb')](),controller[_0xcc59('0xf')]);router[_0xcc59('0xa')]('/:id/hopper_finals',auth[_0xcc59('0xb')](),controller[_0xcc59('0x10')]);router[_0xcc59('0xa')]('/:id/hopper_black',auth[_0xcc59('0xb')](),controller[_0xcc59('0x11')]);router['get']('/:id/teams',auth[_0xcc59('0xb')](),controller[_0xcc59('0x12')]);router[_0xcc59('0xa')]('/:id/users',auth[_0xcc59('0xb')](),controller[_0xcc59('0x13')]);router['get']('/:id/members',auth[_0xcc59('0xb')](),controller[_0xcc59('0x14')]);router[_0xcc59('0xa')](_0xcc59('0x15'),auth[_0xcc59('0xb')](),controller[_0xcc59('0x16')]);router[_0xcc59('0xa')]('/:id/blacklists',auth[_0xcc59('0xb')](),controller['getBlackLists']);router['post']('/',auth[_0xcc59('0xb')](),controller[_0xcc59('0x17')]);router[_0xcc59('0x18')](_0xcc59('0x19'),auth[_0xcc59('0xb')](),controller[_0xcc59('0x1a')]);router['post'](_0xcc59('0x1b'),auth[_0xcc59('0xb')](),controller['addTeams']);router['post'](_0xcc59('0x1c'),auth[_0xcc59('0xb')](),controller[_0xcc59('0x1d')]);router[_0xcc59('0x18')](_0xcc59('0x15'),auth['isAuthenticated'](),controller[_0xcc59('0x1e')]);router[_0xcc59('0x18')]('/:id/blacklists',auth[_0xcc59('0xb')](),controller[_0xcc59('0x1f')]);router['put'](_0xcc59('0xd'),auth[_0xcc59('0xb')](),controller[_0xcc59('0x20')]);router[_0xcc59('0x21')]('/:id',auth['isAuthenticated'](),controller[_0xcc59('0x22')]);router[_0xcc59('0x21')](_0xcc59('0x1b'),auth[_0xcc59('0xb')](),controller['removeTeams']);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);router['delete']('/:id/lists',auth[_0xcc59('0xb')](),controller['removeLists']);router[_0xcc59('0x21')](_0xcc59('0x23'),auth[_0xcc59('0xb')](),controller[_0xcc59('0x24')]);module[_0xcc59('0x25')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index df716f4..94e8d32 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(_0x494dad,_0x2456ec){var _0x47d36a=function(_0x149b07){while(--_0x149b07){_0x494dad['push'](_0x494dad['shift']());}};_0x47d36a(++_0x2456ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x511d17,_0x9ad3ba){var _0x4f42e3=function(_0x5cc40f){while(--_0x5cc40f){_0x511d17['push'](_0x511d17['shift']());}};_0x4f42e3(++_0x9ad3ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 5e3572d..174b6e3 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 _0x91e3=['nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','VoiceQueue','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','role','getHoppers','findOne','CmHopper','order','VoiceQueueId','getHopperHistories','CmHopperHistory','options','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','flatMap','penalty','sequelize','addTeams','each','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','field','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','SELECT','every','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','push','getAgents','getMembers','CmList','getLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ListId','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','then','sendStatus','send','index','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x34f8ba,_0x2bb6a8){var _0xa5ed05=function(_0x497771){while(--_0x497771){_0x34f8ba['push'](_0x34f8ba['shift']());}};_0xa5ed05(++_0x2bb6a8);}(_0x91e3,0x132));var _0x391e=function(_0xe7d30b,_0x525bf2){_0xe7d30b=_0xe7d30b-0x0;var _0x2bf356=_0x91e3[_0xe7d30b];return _0x2bf356;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x391e('0x0'));var rimraf=require(_0x391e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x391e('0x2'));var rp=require(_0x391e('0x3'));var moment=require(_0x391e('0x4'));var BPromise=require(_0x391e('0x5'));var Mustache=require(_0x391e('0x6'));var util=require(_0x391e('0x7'));var path=require(_0x391e('0x8'));var sox=require(_0x391e('0x9'));var csv=require('to-csv');var ejs=require(_0x391e('0xa'));var fs=require('fs');var _=require(_0x391e('0xb'));var squel=require(_0x391e('0xc'));var crypto=require(_0x391e('0xd'));var jsforce=require(_0x391e('0xe'));var deskjs=require(_0x391e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x391e('0x10'));var Papa=require(_0x391e('0x11'));var Redis=require(_0x391e('0x12'));var authService=require(_0x391e('0x13'));var qs=require(_0x391e('0x14'));var as=require(_0x391e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x391e('0x16'))(_0x391e('0x17'));var utils=require(_0x391e('0x18'));var config=require(_0x391e('0x19'));var licenseUtil=require(_0x391e('0x1a'));var db=require(_0x391e('0x1b'))['db'];config[_0x391e('0x1c')]=_['defaults'](config[_0x391e('0x1c')],{'host':_0x391e('0x1d'),'port':0x18eb});var socket=require(_0x391e('0x1e'))(new Redis(config[_0x391e('0x1c')]));require(_0x391e('0x1f'))['register'](socket);function respondWithStatusCode(_0x83e07f,_0x265258){_0x265258=_0x265258||0xcc;return function(_0x538412){if(_0x538412){return _0x83e07f['sendStatus'](_0x265258);}return _0x83e07f['status'](_0x265258)[_0x391e('0x20')]();};}function respondWithResult(_0x5d958c,_0x4be201){_0x4be201=_0x4be201||0xc8;return function(_0x392dcd){if(_0x392dcd){return _0x5d958c[_0x391e('0x21')](_0x4be201)[_0x391e('0x22')](_0x392dcd);}};}function respondWithFilteredResult(_0x462a76,_0x228d6e){return function(_0x6cb4c7){if(_0x6cb4c7){var _0x30af10=_0x6cb4c7[_0x391e('0x23')],_0x4cde58=_0x228d6e[_0x391e('0x24')],_0x498289=_0x228d6e[_0x391e('0x24')]+_0x228d6e[_0x391e('0x25')],_0x2e2c6e;if(_0x498289>=_0x30af10){_0x498289=_0x30af10;_0x2e2c6e=0xc8;}else{_0x2e2c6e=0xce;}_0x462a76['status'](_0x2e2c6e);return _0x462a76[_0x391e('0x26')](_0x391e('0x27'),_0x4cde58+'-'+_0x498289+'/'+_0x30af10)[_0x391e('0x22')](_0x6cb4c7);}return null;};}function patchUpdates(_0x70e597){return function(_0x55d8dd){try{jsonpatch[_0x391e('0x28')](_0x55d8dd,_0x70e597,!![]);}catch(_0x62fc19){return BPromise[_0x391e('0x29')](_0x62fc19);}return _0x55d8dd[_0x391e('0x2a')]();};}function saveUpdates(_0x3ce1c5,_0x1fbd4c){return function(_0x46265d){if(_0x46265d){return _0x46265d[_0x391e('0x2b')](_0x3ce1c5)['then'](function(_0x48cd15){return _0x48cd15;});}return null;};}function removeEntity(_0x431b5f,_0x35b008){return function(_0x3aac2b){if(_0x3aac2b){return _0x3aac2b['destroy']()['then'](function(){var _0x27b65a=_0x3aac2b[_0x391e('0x2c')]({'plain':!![]});var _0x5d77f7=[{'name':_0x391e('0x2d'),'value':_0x391e('0x2e'),'ignore':![]},{'name':_0x391e('0x2f'),'value':_0x391e('0x30'),'ignore':![]}];var _0xe2e34a=_(_0x5d77f7)[_0x391e('0x31')](_0x391e('0x32'))[_0x391e('0x33')](_0x391e('0x34'))['value']();if(_[_0x391e('0x35')](_0xe2e34a,_0x27b65a[_0x391e('0x36')])){return;}var _0x49532c=_[_0x391e('0x37')](_0x5d77f7,[_0x391e('0x34'),_0x27b65a[_0x391e('0x36')]])[_0x391e('0x38')];return db[_0x391e('0x39')][_0x391e('0x3a')]({'where':{'type':_0x49532c,'resourceId':_0x27b65a['id']}})['then'](function(){return _0x3aac2b;});})[_0x391e('0x3b')](function(){_0x431b5f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47bd63,_0x41f55a){return function(_0x1225b8){if(!_0x1225b8){_0x47bd63[_0x391e('0x3c')](0x194);}return _0x1225b8;};}function handleError(_0x122d7a,_0x42d090){_0x42d090=_0x42d090||0x1f4;return function(_0xbfa1f3){logger['error'](_0xbfa1f3['stack']);if(_0xbfa1f3['name']){delete _0xbfa1f3[_0x391e('0x38')];}_0x122d7a[_0x391e('0x21')](_0x42d090)[_0x391e('0x3d')](_0xbfa1f3);};}exports[_0x391e('0x3e')]=function(_0x190758,_0x599745){var _0x451d9b={},_0x445c80={},_0x5ea82c={'count':0x0,'rows':[]};var _0xc5af4a=_[_0x391e('0x33')](db['VoiceQueue']['rawAttributes'],function(_0xa780e5){return{'name':_0xa780e5[_0x391e('0x3f')],'type':_0xa780e5[_0x391e('0x36')][_0x391e('0x40')]};});_0x445c80['model']=_['map'](_0xc5af4a,_0x391e('0x38'));_0x445c80['query']=_[_0x391e('0x41')](_0x190758[_0x391e('0x42')]);_0x445c80[_0x391e('0x43')]=_[_0x391e('0x44')](_0x445c80[_0x391e('0x45')],_0x445c80[_0x391e('0x42')]);_0x451d9b[_0x391e('0x46')]=_[_0x391e('0x44')](_0x445c80[_0x391e('0x45')],qs[_0x391e('0x47')](_0x190758[_0x391e('0x42')][_0x391e('0x47')]));_0x451d9b['attributes']=_0x451d9b[_0x391e('0x46')][_0x391e('0x48')]?_0x451d9b[_0x391e('0x46')]:_0x445c80['model'];if(!_0x190758[_0x391e('0x42')][_0x391e('0x49')](_0x391e('0x4a'))){_0x451d9b[_0x391e('0x25')]=qs['limit'](_0x190758[_0x391e('0x42')][_0x391e('0x25')]);_0x451d9b['offset']=qs[_0x391e('0x24')](_0x190758[_0x391e('0x42')][_0x391e('0x24')]);}_0x451d9b['order']=qs[_0x391e('0x4b')](_0x190758[_0x391e('0x42')][_0x391e('0x4b')]);_0x451d9b[_0x391e('0x4c')]=qs[_0x391e('0x43')](_[_0x391e('0x4d')](_0x190758[_0x391e('0x42')],_0x445c80[_0x391e('0x43')]),_0xc5af4a);if(_0x190758[_0x391e('0x42')][_0x391e('0x31')]){_0x451d9b[_0x391e('0x4c')]=_[_0x391e('0x4e')](_0x451d9b[_0x391e('0x4c')],{'$or':_[_0x391e('0x33')](_0xc5af4a,function(_0x2d8142){if(_0x2d8142[_0x391e('0x36')]!==_0x391e('0x4f')){var _0x5e3e49={};_0x5e3e49[_0x2d8142[_0x391e('0x38')]]={'$like':'%'+_0x190758[_0x391e('0x42')][_0x391e('0x31')]+'%'};return _0x5e3e49;}})});}_0x451d9b=_[_0x391e('0x4e')]({},_0x451d9b,_0x190758['options']);var _0x41f39c={'where':_0x451d9b[_0x391e('0x4c')]};return db['VoiceQueue'][_0x391e('0x23')](_0x41f39c)['then'](function(_0x4073b4){_0x5ea82c[_0x391e('0x23')]=_0x4073b4;if(_0x190758['query'][_0x391e('0x50')]){_0x451d9b[_0x391e('0x51')]=[{'all':!![]}];}return db[_0x391e('0x52')][_0x391e('0x53')](_0x451d9b);})['then'](function(_0xf2324c){_0x5ea82c[_0x391e('0x54')]=_0xf2324c;return _0x5ea82c;})['then'](respondWithFilteredResult(_0x599745,_0x451d9b))[_0x391e('0x55')](handleError(_0x599745,null));};exports[_0x391e('0x56')]=function(_0x265586,_0x51567){var _0x431227={'raw':![],'where':{'id':_0x265586[_0x391e('0x57')]['id']}},_0x24c270={};_0x24c270[_0x391e('0x45')]=_[_0x391e('0x41')](db[_0x391e('0x52')][_0x391e('0x58')]);_0x24c270['query']=_[_0x391e('0x41')](_0x265586['query']);_0x24c270[_0x391e('0x43')]=_[_0x391e('0x44')](_0x24c270['model'],_0x24c270[_0x391e('0x42')]);_0x431227['attributes']=_[_0x391e('0x44')](_0x24c270[_0x391e('0x45')],qs['fields'](_0x265586['query']['fields']));_0x431227['attributes']=_0x431227['attributes'][_0x391e('0x48')]?_0x431227[_0x391e('0x46')]:_0x24c270[_0x391e('0x45')];if(_0x265586[_0x391e('0x42')][_0x391e('0x50')]){_0x431227[_0x391e('0x51')]=[{'all':!![]}];}_0x431227=_['merge']({},_0x431227,_0x265586['options']);return db[_0x391e('0x52')]['find'](_0x431227)[_0x391e('0x3b')](handleEntityNotFound(_0x51567,null))[_0x391e('0x3b')](respondWithResult(_0x51567,null))[_0x391e('0x55')](handleError(_0x51567,null));};exports[_0x391e('0x59')]=function(_0x1adb23,_0x5f3c54){return db[_0x391e('0x52')][_0x391e('0x59')](_0x1adb23[_0x391e('0x5a')],{})[_0x391e('0x3b')](function(_0x3a0f80){var _0x357f7e=_0x1adb23[_0x391e('0x5b')][_0x391e('0x2c')]({'plain':!![]});if(!_0x357f7e)throw new Error(_0x391e('0x5c'));if(_0x357f7e['role']===_0x391e('0x5b')){var _0x4cedea=_0x3a0f80[_0x391e('0x2c')]({'plain':!![]});var _0x5f25a9=[{'name':_0x391e('0x2d'),'value':_0x391e('0x2e')},{'name':_0x391e('0x2f'),'value':_0x391e('0x30')}];var _0x3c9a6b=_[_0x391e('0x37')](_0x5f25a9,[_0x391e('0x34'),_0x4cedea[_0x391e('0x36')]])['name'];return db['UserProfileSection'][_0x391e('0x37')]({'where':{'name':_0x3c9a6b,'userProfileId':_0x357f7e[_0x391e('0x5d')]},'raw':!![]})[_0x391e('0x3b')](function(_0x11f301){if(_0x11f301&&_0x11f301[_0x391e('0x5e')]===0x0){return db[_0x391e('0x39')][_0x391e('0x59')]({'name':_0x4cedea[_0x391e('0x38')],'resourceId':_0x4cedea['id'],'type':_0x11f301[_0x391e('0x38')],'sectionId':_0x11f301['id']},{})[_0x391e('0x3b')](function(){return _0x3a0f80;});}else{return _0x3a0f80;}})[_0x391e('0x55')](function(_0x280224){logger[_0x391e('0x5f')](_0x391e('0x60'),_0x280224);throw _0x280224;});}return _0x3a0f80;})['then'](respondWithResult(_0x5f3c54,0xc9))[_0x391e('0x55')](handleError(_0x5f3c54,null));};exports[_0x391e('0x61')]=function(_0x418d64,_0x3cb59c){var _0xbd18ba={'where':{'id':_0x418d64[_0x391e('0x57')]['id']}},_0xd07466={};_0xd07466['model']=_[_0x391e('0x41')](db['VoiceQueue'][_0x391e('0x58')]);_0xbd18ba['attributes']=_[_0x391e('0x44')](_0xd07466[_0x391e('0x45')],qs['fields'](_0x418d64['query']['fields']));_0xbd18ba[_0x391e('0x46')]=_0xbd18ba[_0x391e('0x46')][_0x391e('0x48')]?_0xbd18ba['attributes']:_0xd07466[_0x391e('0x45')];if(_0x418d64[_0x391e('0x42')][_0x391e('0x50')]){_0xbd18ba[_0x391e('0x51')]=[{'all':!![]}];}_0xbd18ba=_[_0x391e('0x4e')]({},_0xbd18ba,_0x418d64['options']);return db[_0x391e('0x52')][_0x391e('0x37')](_0xbd18ba)['then'](handleEntityNotFound(_0x3cb59c,null))[_0x391e('0x3b')](function(_0xbb8ad3){if(_0xbb8ad3){var _0x31a846=_0xbb8ad3['get']({'plain':!![]});_0x31a846=qs['omit'](_0x31a846,['id',_0x391e('0x62'),_0x391e('0x63')]);_0x418d64[_0x391e('0x5a')]=_[_0x391e('0x64')](_0x418d64[_0x391e('0x5a')],['id',_0x391e('0x62'),_0x391e('0x63')]);return db['VoiceQueue'][_0x391e('0x59')](_[_0x391e('0x4e')](_0x31a846,_0x418d64[_0x391e('0x5a')]),{'include':_0x418d64[_0x391e('0x42')][_0x391e('0x50')]?[{'all':!![]}]:undefined})[_0x391e('0x3b')](function(_0x199a13){var _0x4c8c27=_0x418d64[_0x391e('0x5b')]['get']({'plain':!![]});if(!_0x4c8c27)throw new Error(_0x391e('0x5c'));if(_0x4c8c27[_0x391e('0x65')]==='user'){var _0xd2af40=_0x199a13[_0x391e('0x2c')]({'plain':!![]});var _0x1c7eac=[{'name':_0x391e('0x2d'),'value':_0x391e('0x2e')},{'name':'QueueCampaigns','value':_0x391e('0x30')}];var _0x596643=_[_0x391e('0x37')](_0x1c7eac,[_0x391e('0x34'),_0xd2af40[_0x391e('0x36')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x596643,'userProfileId':_0x4c8c27['userProfileId']},'raw':!![]})[_0x391e('0x3b')](function(_0x2f9e5a){if(_0x2f9e5a&&_0x2f9e5a[_0x391e('0x5e')]===0x0){return db[_0x391e('0x39')]['create']({'name':_0xd2af40[_0x391e('0x38')],'resourceId':_0xd2af40['id'],'type':_0x2f9e5a[_0x391e('0x38')],'sectionId':_0x2f9e5a['id']},{})[_0x391e('0x3b')](function(){return _0x199a13;});}else{return _0x199a13;}})[_0x391e('0x55')](function(_0x36e05c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36e05c);throw _0x36e05c;});}return _0x199a13;});}})['then'](respondWithResult(_0x3cb59c,0xc9))['catch'](handleError(_0x3cb59c,null));};exports[_0x391e('0x2b')]=function(_0xefec2b,_0x75bca8){if(_0xefec2b['body']['id']){delete _0xefec2b['body']['id'];}return db[_0x391e('0x52')][_0x391e('0x37')]({'where':{'id':_0xefec2b['params']['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x75bca8,null))[_0x391e('0x3b')](saveUpdates(_0xefec2b[_0x391e('0x5a')],null))[_0x391e('0x3b')](respondWithResult(_0x75bca8,null))[_0x391e('0x55')](handleError(_0x75bca8,null));};exports['destroy']=function(_0x334b6d,_0x4e028d){return db[_0x391e('0x52')][_0x391e('0x37')]({'where':{'id':_0x334b6d[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x4e028d,null))[_0x391e('0x3b')](removeEntity(_0x4e028d,null))['catch'](handleError(_0x4e028d,null));};exports[_0x391e('0x66')]=function(_0x5888b9,_0x280819,_0x5b49a1){var _0x38d3c3={'raw':![],'where':{}};var _0x3d28b6={};var _0x4725e1={'count':0x0,'rows':[]};return db[_0x391e('0x52')][_0x391e('0x67')]({'where':{'id':_0x5888b9[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x280819,null))[_0x391e('0x3b')](function(_0x3bbfa7){if(_0x3bbfa7){_0x3d28b6['model']=_[_0x391e('0x41')](db[_0x391e('0x68')]['rawAttributes']);_0x3d28b6[_0x391e('0x42')]=_[_0x391e('0x41')](_0x5888b9['query']);_0x3d28b6[_0x391e('0x43')]=_['intersection'](_0x3d28b6['model'],_0x3d28b6[_0x391e('0x42')]);_0x38d3c3[_0x391e('0x46')]=_[_0x391e('0x44')](_0x3d28b6[_0x391e('0x45')],qs[_0x391e('0x47')](_0x5888b9['query'][_0x391e('0x47')]));_0x38d3c3[_0x391e('0x46')]=_0x38d3c3['attributes'][_0x391e('0x48')]?_0x38d3c3[_0x391e('0x46')]:_0x3d28b6[_0x391e('0x45')];if(!_0x5888b9[_0x391e('0x42')][_0x391e('0x49')](_0x391e('0x4a'))){_0x38d3c3[_0x391e('0x25')]=qs[_0x391e('0x25')](_0x5888b9[_0x391e('0x42')]['limit']);_0x38d3c3[_0x391e('0x24')]=qs['offset'](_0x5888b9['query']['offset']);}_0x38d3c3[_0x391e('0x69')]=qs[_0x391e('0x4b')](_0x5888b9[_0x391e('0x42')][_0x391e('0x4b')]);_0x38d3c3[_0x391e('0x4c')]=qs[_0x391e('0x43')](_[_0x391e('0x4d')](_0x5888b9[_0x391e('0x42')],_0x3d28b6['filters']));_0x38d3c3[_0x391e('0x4c')][_0x391e('0x6a')]=_0x3bbfa7['id'];if(_0x5888b9[_0x391e('0x42')]['filter']){_0x38d3c3['where']=_['merge'](_0x38d3c3['where'],{'$or':_[_0x391e('0x33')](_0x38d3c3[_0x391e('0x46')],function(_0x435704){var _0x3fef45={};_0x3fef45[_0x435704]={'$like':'%'+_0x5888b9[_0x391e('0x42')][_0x391e('0x31')]+'%'};return _0x3fef45;})});}_0x38d3c3=_[_0x391e('0x4e')]({},_0x38d3c3,_0x5888b9['options']);return db[_0x391e('0x68')][_0x391e('0x23')]({'where':_0x38d3c3['where']})[_0x391e('0x3b')](function(_0x464722){_0x4725e1['count']=_0x464722;if(_0x5888b9[_0x391e('0x42')]['includeAll']){_0x38d3c3['include']=[{'all':!![]}];}return db['CmHopper'][_0x391e('0x53')](_0x38d3c3);})[_0x391e('0x3b')](function(_0xfac130){_0x4725e1[_0x391e('0x54')]=_0xfac130;return _0x4725e1;});}})[_0x391e('0x3b')](respondWithFilteredResult(_0x280819,_0x38d3c3))[_0x391e('0x55')](handleError(_0x280819,null));};exports[_0x391e('0x6b')]=function(_0x1d383d,_0x49fd4c,_0x32f7a8){var _0x50ed8b={'raw':!![],'where':{}};var _0x135520={};var _0x3fe131={'count':0x0,'rows':[]};return db[_0x391e('0x52')]['findOne']({'where':{'id':_0x1d383d[_0x391e('0x57')]['id']}})['then'](handleEntityNotFound(_0x49fd4c,null))[_0x391e('0x3b')](function(_0x52e1dd){if(_0x52e1dd){_0x135520[_0x391e('0x45')]=_[_0x391e('0x41')](db[_0x391e('0x6c')][_0x391e('0x58')]);_0x135520[_0x391e('0x42')]=_[_0x391e('0x41')](_0x1d383d[_0x391e('0x42')]);_0x135520[_0x391e('0x43')]=_[_0x391e('0x44')](_0x135520[_0x391e('0x45')],_0x135520[_0x391e('0x42')]);_0x50ed8b[_0x391e('0x46')]=_[_0x391e('0x44')](_0x135520[_0x391e('0x45')],qs['fields'](_0x1d383d[_0x391e('0x42')][_0x391e('0x47')]));_0x50ed8b[_0x391e('0x46')]=_0x50ed8b[_0x391e('0x46')][_0x391e('0x48')]?_0x50ed8b[_0x391e('0x46')]:_0x135520['model'];if(!_0x1d383d[_0x391e('0x42')][_0x391e('0x49')](_0x391e('0x4a'))){_0x50ed8b[_0x391e('0x25')]=qs[_0x391e('0x25')](_0x1d383d['query']['limit']);_0x50ed8b[_0x391e('0x24')]=qs[_0x391e('0x24')](_0x1d383d[_0x391e('0x42')]['offset']);}_0x50ed8b['order']=qs[_0x391e('0x4b')](_0x1d383d[_0x391e('0x42')][_0x391e('0x4b')]);_0x50ed8b['where']=qs['filters'](_['pick'](_0x1d383d[_0x391e('0x42')],_0x135520['filters']));_0x50ed8b[_0x391e('0x4c')][_0x391e('0x6a')]=_0x52e1dd['id'];if(_0x1d383d[_0x391e('0x42')][_0x391e('0x31')]){_0x50ed8b['where']=_['merge'](_0x50ed8b[_0x391e('0x4c')],{'$or':_[_0x391e('0x33')](_0x50ed8b[_0x391e('0x46')],function(_0x394d66){var _0x54544f={};_0x54544f[_0x394d66]={'$like':'%'+_0x1d383d['query'][_0x391e('0x31')]+'%'};return _0x54544f;})});}_0x50ed8b=_[_0x391e('0x4e')]({},_0x50ed8b,_0x1d383d[_0x391e('0x6d')]);return db[_0x391e('0x6c')][_0x391e('0x23')]({'where':_0x50ed8b['where']})[_0x391e('0x3b')](function(_0x2dfd44){_0x3fe131[_0x391e('0x23')]=_0x2dfd44;if(_0x1d383d[_0x391e('0x42')]['includeAll']){_0x50ed8b[_0x391e('0x51')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x391e('0x53')](_0x50ed8b);})[_0x391e('0x3b')](function(_0x1505f0){_0x3fe131['rows']=_0x1505f0;return _0x3fe131;});}})[_0x391e('0x3b')](respondWithFilteredResult(_0x49fd4c,_0x50ed8b))[_0x391e('0x55')](handleError(_0x49fd4c,null));};exports[_0x391e('0x6e')]=function(_0x159ca2,_0x24a293,_0x237582){var _0x38b217={'raw':!![],'where':{}};var _0x2188f4={};var _0x16ac44={'count':0x0,'rows':[]};return db[_0x391e('0x52')]['findOne']({'where':{'id':_0x159ca2[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x24a293,null))[_0x391e('0x3b')](function(_0x52fc4b){if(_0x52fc4b){_0x2188f4[_0x391e('0x45')]=_[_0x391e('0x41')](db[_0x391e('0x6f')][_0x391e('0x58')]);_0x2188f4[_0x391e('0x42')]=_[_0x391e('0x41')](_0x159ca2[_0x391e('0x42')]);_0x2188f4[_0x391e('0x43')]=_[_0x391e('0x44')](_0x2188f4[_0x391e('0x45')],_0x2188f4['query']);_0x38b217[_0x391e('0x46')]=_['intersection'](_0x2188f4[_0x391e('0x45')],qs[_0x391e('0x47')](_0x159ca2[_0x391e('0x42')][_0x391e('0x47')]));_0x38b217[_0x391e('0x46')]=_0x38b217[_0x391e('0x46')][_0x391e('0x48')]?_0x38b217[_0x391e('0x46')]:_0x2188f4[_0x391e('0x45')];if(!_0x159ca2[_0x391e('0x42')]['hasOwnProperty']('nolimit')){_0x38b217[_0x391e('0x25')]=qs[_0x391e('0x25')](_0x159ca2[_0x391e('0x42')][_0x391e('0x25')]);_0x38b217[_0x391e('0x24')]=qs[_0x391e('0x24')](_0x159ca2[_0x391e('0x42')][_0x391e('0x24')]);}_0x38b217[_0x391e('0x69')]=qs[_0x391e('0x4b')](_0x159ca2[_0x391e('0x42')][_0x391e('0x4b')]);_0x38b217[_0x391e('0x4c')]=qs[_0x391e('0x43')](_[_0x391e('0x4d')](_0x159ca2[_0x391e('0x42')],_0x2188f4[_0x391e('0x43')]));_0x38b217[_0x391e('0x4c')][_0x391e('0x6a')]=_0x52fc4b['id'];if(_0x159ca2['query'][_0x391e('0x31')]){_0x38b217[_0x391e('0x4c')]=_['merge'](_0x38b217['where'],{'$or':_[_0x391e('0x33')](_0x38b217['attributes'],function(_0x44d839){var _0x4d9e35={};_0x4d9e35[_0x44d839]={'$like':'%'+_0x159ca2[_0x391e('0x42')][_0x391e('0x31')]+'%'};return _0x4d9e35;})});}_0x38b217=_[_0x391e('0x4e')]({},_0x38b217,_0x159ca2[_0x391e('0x6d')]);return db[_0x391e('0x6f')][_0x391e('0x23')]({'where':_0x38b217[_0x391e('0x4c')]})[_0x391e('0x3b')](function(_0x3fb38d){_0x16ac44[_0x391e('0x23')]=_0x3fb38d;if(_0x159ca2['query'][_0x391e('0x50')]){_0x38b217[_0x391e('0x51')]=[{'all':!![]}];}return db[_0x391e('0x6f')][_0x391e('0x53')](_0x38b217);})[_0x391e('0x3b')](function(_0x5a7d9c){_0x16ac44[_0x391e('0x54')]=_0x5a7d9c;return _0x16ac44;});}})[_0x391e('0x3b')](respondWithFilteredResult(_0x24a293,_0x38b217))[_0x391e('0x55')](handleError(_0x24a293,null));};exports[_0x391e('0x70')]=function(_0x4fb3d9,_0x3b8123,_0x22f602){var _0x13a5be={'raw':!![],'where':{}};var _0xaf5785={};var _0x86737d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x391e('0x67')]({'where':{'id':_0x4fb3d9[_0x391e('0x57')]['id']}})['then'](handleEntityNotFound(_0x3b8123,null))[_0x391e('0x3b')](function(_0x2dcef1){if(_0x2dcef1){_0xaf5785['model']=_[_0x391e('0x41')](db['CmHopperBlack'][_0x391e('0x58')]);_0xaf5785[_0x391e('0x42')]=_[_0x391e('0x41')](_0x4fb3d9[_0x391e('0x42')]);_0xaf5785[_0x391e('0x43')]=_[_0x391e('0x44')](_0xaf5785[_0x391e('0x45')],_0xaf5785[_0x391e('0x42')]);_0x13a5be[_0x391e('0x46')]=_[_0x391e('0x44')](_0xaf5785[_0x391e('0x45')],qs[_0x391e('0x47')](_0x4fb3d9[_0x391e('0x42')]['fields']));_0x13a5be['attributes']=_0x13a5be[_0x391e('0x46')]['length']?_0x13a5be[_0x391e('0x46')]:_0xaf5785[_0x391e('0x45')];if(!_0x4fb3d9[_0x391e('0x42')][_0x391e('0x49')]('nolimit')){_0x13a5be[_0x391e('0x25')]=qs[_0x391e('0x25')](_0x4fb3d9[_0x391e('0x42')]['limit']);_0x13a5be[_0x391e('0x24')]=qs[_0x391e('0x24')](_0x4fb3d9[_0x391e('0x42')][_0x391e('0x24')]);}_0x13a5be[_0x391e('0x69')]=qs[_0x391e('0x4b')](_0x4fb3d9[_0x391e('0x42')]['sort']);_0x13a5be['where']=qs['filters'](_[_0x391e('0x4d')](_0x4fb3d9[_0x391e('0x42')],_0xaf5785[_0x391e('0x43')]));_0x13a5be[_0x391e('0x4c')][_0x391e('0x6a')]=_0x2dcef1['id'];if(_0x4fb3d9[_0x391e('0x42')][_0x391e('0x31')]){_0x13a5be[_0x391e('0x4c')]=_[_0x391e('0x4e')](_0x13a5be[_0x391e('0x4c')],{'$or':_[_0x391e('0x33')](_0x13a5be[_0x391e('0x46')],function(_0x593e2c){var _0x5cb687={};_0x5cb687[_0x593e2c]={'$like':'%'+_0x4fb3d9[_0x391e('0x42')][_0x391e('0x31')]+'%'};return _0x5cb687;})});}_0x13a5be=_[_0x391e('0x4e')]({},_0x13a5be,_0x4fb3d9['options']);return db[_0x391e('0x71')][_0x391e('0x23')]({'where':_0x13a5be[_0x391e('0x4c')]})[_0x391e('0x3b')](function(_0x483510){_0x86737d[_0x391e('0x23')]=_0x483510;if(_0x4fb3d9[_0x391e('0x42')][_0x391e('0x50')]){_0x13a5be[_0x391e('0x51')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x13a5be);})[_0x391e('0x3b')](function(_0x2f4ea0){_0x86737d[_0x391e('0x54')]=_0x2f4ea0;return _0x86737d;});}})['then'](respondWithFilteredResult(_0x3b8123,_0x13a5be))[_0x391e('0x55')](handleError(_0x3b8123,null));};exports['getTeams']=function(_0x5f1652,_0x364ead,_0x4691ca){var _0x372499={};var _0x20a5bd={};var _0x26f428;var _0x3b6d51;return db[_0x391e('0x52')][_0x391e('0x67')]({'where':{'id':_0x5f1652[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x364ead,null))[_0x391e('0x3b')](function(_0x2795ac){if(_0x2795ac){_0x26f428=_0x2795ac;_0x20a5bd[_0x391e('0x45')]=_[_0x391e('0x41')](db[_0x391e('0x72')][_0x391e('0x58')]);_0x20a5bd[_0x391e('0x42')]=_[_0x391e('0x41')](_0x5f1652[_0x391e('0x42')]);_0x20a5bd['filters']=_[_0x391e('0x44')](_0x20a5bd['model'],_0x20a5bd[_0x391e('0x42')]);_0x372499[_0x391e('0x46')]=_['intersection'](_0x20a5bd[_0x391e('0x45')],qs['fields'](_0x5f1652[_0x391e('0x42')]['fields']));_0x372499[_0x391e('0x46')]=_0x372499['attributes'][_0x391e('0x48')]?_0x372499[_0x391e('0x46')]:_0x20a5bd[_0x391e('0x45')];_0x372499['order']=qs[_0x391e('0x4b')](_0x5f1652[_0x391e('0x42')][_0x391e('0x4b')]);_0x372499[_0x391e('0x4c')]=qs[_0x391e('0x43')](_['pick'](_0x5f1652[_0x391e('0x42')],_0x20a5bd[_0x391e('0x43')]));if(_0x5f1652[_0x391e('0x42')][_0x391e('0x31')]){_0x372499['where']=_[_0x391e('0x4e')](_0x372499['where'],{'$or':_[_0x391e('0x33')](_0x372499['attributes'],function(_0x54309d){var _0x2a8d81={};_0x2a8d81[_0x54309d]={'$like':'%'+_0x5f1652[_0x391e('0x42')][_0x391e('0x31')]+'%'};return _0x2a8d81;})});}_0x372499=_['merge']({},_0x372499,_0x5f1652['options']);return _0x26f428[_0x391e('0x73')](_0x372499);}})[_0x391e('0x3b')](function(_0x2e387f){if(_0x2e387f){_0x3b6d51=_0x2e387f[_0x391e('0x48')];if(!_0x5f1652['query'][_0x391e('0x49')](_0x391e('0x4a'))){_0x372499[_0x391e('0x25')]=qs['limit'](_0x5f1652[_0x391e('0x42')][_0x391e('0x25')]);_0x372499[_0x391e('0x24')]=qs[_0x391e('0x24')](_0x5f1652[_0x391e('0x42')]['offset']);}return _0x26f428[_0x391e('0x73')](_0x372499);}})['then'](function(_0x6cfce6){if(_0x6cfce6){return _0x6cfce6?{'count':_0x3b6d51,'rows':_0x6cfce6}:null;}})[_0x391e('0x3b')](respondWithResult(_0x364ead,null))['catch'](handleError(_0x364ead,null));};exports['addTeams']=function(_0x417159,_0xbc433a,_0x561c17){var _0x1a7d2c=_0x417159['body'][_0x391e('0x74')];var _0xfbc0a5=_[_0x391e('0x33')](_0x1a7d2c,'id');return db[_0x391e('0x72')][_0x391e('0x53')]({'where':{'id':_0xfbc0a5},'attributes':['id'],'include':[{'model':db[_0x391e('0x75')],'as':_0x391e('0x76'),'attributes':['id','name',_0x391e('0x77'),_0x391e('0x78'),_0x391e('0x79')],'raw':!![]}]})[_0x391e('0x3b')](function(_0x5a70bc){if(_0x5a70bc){var _0x534aa6=_[_0x391e('0x7a')](_0x5a70bc,function(_0x47e86d){var _0x1eed4a=_0x47e86d['get']({'plain':!![]});_0x1eed4a[_0x391e('0x76')]['forEach'](function(_0x3bf713){_0x3bf713[_0x391e('0x7b')]=_['find'](_0x1a7d2c,{'id':_0x1eed4a['id']})[_0x391e('0x7b')];});return _0x1eed4a[_0x391e('0x76')];});return db['VoiceQueue'][_0x391e('0x37')]({'where':{'id':_0x417159[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](function(_0x50d822){return db[_0x391e('0x7c')]['transaction'](function(_0x2a6055){return _0x50d822[_0x391e('0x7d')](_0xfbc0a5,{'transaction':_0x2a6055})['then'](function(){return BPromise[_0x391e('0x7e')](_0x534aa6,function(_0x5f1ab2){return db['UserVoiceQueue'][_0x391e('0x7f')]({'where':{'UserId':_0x5f1ab2['id'],'VoiceQueueId':_0x417159[_0x391e('0x57')]['id']},'defaults':{'penalty':_0x5f1ab2[_0x391e('0x7b')]},'transaction':_0x2a6055});});})[_0x391e('0x3b')](function(){return BPromise[_0x391e('0x7e')](_['filter'](_0x534aa6,{'online':!![]}),function(_0x12963f){return db[_0x391e('0x80')][_0x391e('0x81')]({'membername':_0x12963f['name'],'UserId':_0x12963f['id'],'queue_name':_0x50d822[_0x391e('0x38')],'VoiceQueueId':_0x50d822['id'],'interface':_[_0x391e('0x82')](_0x12963f['interface'])?util[_0x391e('0x83')](_0x391e('0x84'),_0x12963f[_0x391e('0x38')]):_0x12963f['interface'],'paused':_0x12963f[_0x391e('0x78')]||![],'penalty':_0x12963f[_0x391e('0x7b')]},{'transaction':_0x2a6055});});})[_0x391e('0x3b')](function(){_0x534aa6[_0x391e('0x85')](function(_0x363818){socket[_0x391e('0x86')](_0x391e('0x87'),{'UserId':_0x363818['id'],'VoiceQueueId':_0x50d822['id']});});});});});}})['then'](respondWithStatusCode(_0xbc433a,null))['catch'](handleError(_0xbc433a,null));};exports[_0x391e('0x88')]=function(_0x1cedff,_0x203a5c,_0x300d5d){return db[_0x391e('0x72')][_0x391e('0x53')]({'where':{'id':_0x1cedff['query'][_0x391e('0x89')]},'attributes':['id'],'include':[{'model':db[_0x391e('0x75')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x203a5c,null))[_0x391e('0x3b')](function(_0x1fadf4){var _0x16a8b4=_[_0x391e('0x33')](_0x1fadf4,'id');var _0x4842a7=[];var _0x8355e3=[];var _0x4614ac=squel[_0x391e('0x8a')]();_0x4614ac[_0x391e('0x8b')]('tq.TeamId')['from'](_0x391e('0x8c'),'tq')[_0x391e('0x8d')](_0x391e('0x8e'),'ut',_0x391e('0x8f'))['where'](_0x391e('0x90'),_0x1cedff[_0x391e('0x57')]['id']);for(var _0x448d5f=0x0;_0x448d5f<_0x1fadf4[_0x391e('0x48')];_0x448d5f+=0x1){let _0x20333f=_0x1fadf4[_0x448d5f];for(var _0x1af784=0x0;_0x1af784<_0x20333f[_0x391e('0x76')][_0x391e('0x48')];_0x1af784+=0x1){let _0x532611=_0x20333f[_0x391e('0x76')][_0x1af784];var _0x43fb47=_0x4614ac[_0x391e('0x61')]();_0x43fb47[_0x391e('0x4c')](_0x391e('0x91'),_0x532611['id']);_0x8355e3['push'](db['sequelize']['query'](_0x43fb47['toString'](),{'type':db[_0x391e('0x7c')]['QueryTypes'][_0x391e('0x92')]})[_0x391e('0x3b')](function(_0x147d81){if(_0x147d81[_0x391e('0x48')]===0x1){return _0x532611['id'];}else{var _0x108c66=_[_0x391e('0x93')](_[_0x391e('0x33')](_0x147d81,'TeamId'),function(_0x5b4899){return _[_0x391e('0x35')](_0x16a8b4,_0x5b4899);});if(_0x108c66){return _0x532611['id'];}}}));}}return BPromise[_0x391e('0x94')](_0x8355e3)[_0x391e('0x3b')](function(_0xf6c6ec){_0x4842a7=_(_0x4842a7)[_0x391e('0x95')](_0xf6c6ec)[_0x391e('0x96')]()[_0x391e('0x34')]();return db['VoiceQueue'][_0x391e('0x37')]({'where':{'id':_0x1cedff[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](function(_0x50df4e){return db['sequelize'][_0x391e('0x97')](function(_0x4b494d){return _0x50df4e[_0x391e('0x88')](_0x1cedff[_0x391e('0x42')]['ids'],{'transaction':_0x4b494d})[_0x391e('0x3b')](function(){if(!_[_0x391e('0x98')](_0x4842a7)){return _0x50df4e[_0x391e('0x99')](_0x4842a7,{'transaction':_0x4b494d})[_0x391e('0x3b')](function(){return db[_0x391e('0x80')][_0x391e('0x3a')]({'where':{'VoiceQueueId':_0x1cedff['params']['id'],'UserId':_0x4842a7},'transaction':_0x4b494d});});}})[_0x391e('0x3b')](function(){_0x4842a7[_0x391e('0x85')](function(_0x361717){socket[_0x391e('0x86')](_0x391e('0x9a'),{'UserId':_0x361717,'VoiceQueueId':_0x50df4e['id']});});});});});});})[_0x391e('0x3b')](respondWithStatusCode(_0x203a5c,null))['catch'](handleError(_0x203a5c,null));};exports[_0x391e('0x9b')]=function(_0x5e0188,_0x2b237e,_0x420871){var _0x48cd2d,_0x5635bc;return db[_0x391e('0x52')][_0x391e('0x37')]({'where':{'id':_0x5e0188[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x2b237e,null))['then'](function(_0x5ba0d5){if(_0x5ba0d5){_0x5635bc=_0x5ba0d5;return _0x5ba0d5[_0x391e('0x9b')](_0x5e0188[_0x391e('0x5a')][_0x391e('0x89')],_[_0x391e('0x64')](_0x5e0188[_0x391e('0x5a')],[_0x391e('0x89'),'id'])||{})[_0x391e('0x9c')](function(_0x3d1b7e){for(var _0x2bbdca=0x0;_0x2bbdca<_0x5e0188[_0x391e('0x5a')][_0x391e('0x89')][_0x391e('0x48')];_0x2bbdca+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':_0x5e0188[_0x391e('0x5a')][_0x391e('0x89')][_0x2bbdca],'VoiceQueueId':_0x5e0188[_0x391e('0x57')]['id']});}return _0x3d1b7e;});}})[_0x391e('0x3b')](function(_0x4b90e7){_0x48cd2d=_0x4b90e7||[];if(_0x5635bc){return db[_0x391e('0x75')][_0x391e('0x53')]({'where':{'id':_0x5e0188[_0x391e('0x5a')][_0x391e('0x89')]},'attributes':['id','name',_0x391e('0x77'),_0x391e('0x78'),'interface'],'raw':!![]});}})[_0x391e('0x3b')](function(_0x32821d){if(!_[_0x391e('0x98')](_0x32821d)){var _0x4b5428=[];for(var _0x14cbc8=0x0;_0x14cbc8<_0x32821d[_0x391e('0x48')];_0x14cbc8++){if(_0x32821d[_0x14cbc8][_0x391e('0x77')]){_0x4b5428[_0x391e('0x9d')](db[_0x391e('0x80')][_0x391e('0x81')]({'membername':_0x32821d[_0x14cbc8][_0x391e('0x38')],'UserId':_0x32821d[_0x14cbc8]['id'],'queue_name':_0x5635bc[_0x391e('0x38')],'VoiceQueueId':_0x5635bc['id'],'interface':_['isNil'](_0x32821d[_0x14cbc8][_0x391e('0x79')])?util[_0x391e('0x83')](_0x391e('0x84'),_0x32821d[_0x14cbc8][_0x391e('0x38')]):_0x32821d[_0x14cbc8][_0x391e('0x79')],'paused':_0x32821d[_0x14cbc8]['voicePause']||![],'penalty':_0x5e0188['body'][_0x391e('0x7b')]||0x0}));}}return BPromise[_0x391e('0x94')](_0x4b5428);}})[_0x391e('0x3b')](function(){return _0x48cd2d;})['then'](respondWithResult(_0x2b237e,null))[_0x391e('0x55')](handleError(_0x2b237e,null));};exports[_0x391e('0x99')]=function(_0x4fd6b9,_0x3fe037,_0x17a2df){return db[_0x391e('0x52')]['find']({'where':{'id':_0x4fd6b9[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x3fe037,null))[_0x391e('0x3b')](function(_0x230a87){if(_0x230a87){return _0x230a87[_0x391e('0x99')](_0x4fd6b9['query'][_0x391e('0x89')])[_0x391e('0x3b')](function(){if(_['isArray'](_0x4fd6b9[_0x391e('0x42')]['ids'])){for(var _0x3c4f11=0x0;_0x3c4f11<_0x4fd6b9[_0x391e('0x42')][_0x391e('0x89')][_0x391e('0x48')];_0x3c4f11+=0x1){socket[_0x391e('0x86')](_0x391e('0x9a'),{'UserId':Number(_0x4fd6b9[_0x391e('0x42')][_0x391e('0x89')][_0x3c4f11]),'VoiceQueueId':Number(_0x4fd6b9['params']['id'])});}}else{socket[_0x391e('0x86')]('userVoiceQueue:remove',{'UserId':Number(_0x4fd6b9[_0x391e('0x42')][_0x391e('0x89')]),'VoiceQueueId':Number(_0x4fd6b9[_0x391e('0x57')]['id'])});}});}})[_0x391e('0x3b')](function(_0x42d239){return db[_0x391e('0x80')][_0x391e('0x3a')]({'where':{'VoiceQueueId':_0x4fd6b9[_0x391e('0x57')]['id'],'UserId':_0x4fd6b9[_0x391e('0x42')]['ids']}})[_0x391e('0x3b')](function(){return _0x42d239;});})[_0x391e('0x3b')](respondWithStatusCode(_0x3fe037,null))[_0x391e('0x55')](handleError(_0x3fe037,null));};exports['getAgents']=function(_0x4a14fa,_0x14ffc1,_0x545088){var _0x4d19c6={};var _0x5a1e1e={};var _0x307bbe;var _0xefb93b;return db[_0x391e('0x52')][_0x391e('0x67')]({'where':{'id':_0x4a14fa[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x14ffc1,null))[_0x391e('0x3b')](function(_0xe397){if(_0xe397){_0x307bbe=_0xe397;_0x5a1e1e[_0x391e('0x45')]=_[_0x391e('0x41')](db[_0x391e('0x75')][_0x391e('0x58')]);_0x5a1e1e[_0x391e('0x42')]=_[_0x391e('0x41')](_0x4a14fa[_0x391e('0x42')]);_0x5a1e1e[_0x391e('0x43')]=_[_0x391e('0x44')](_0x5a1e1e[_0x391e('0x45')],_0x5a1e1e['query']);_0x4d19c6[_0x391e('0x46')]=_['intersection'](_0x5a1e1e[_0x391e('0x45')],qs[_0x391e('0x47')](_0x4a14fa['query'][_0x391e('0x47')]));_0x4d19c6['attributes']=_0x4d19c6['attributes'][_0x391e('0x48')]?_0x4d19c6['attributes']:_0x5a1e1e[_0x391e('0x45')];_0x4d19c6[_0x391e('0x69')]=qs[_0x391e('0x4b')](_0x4a14fa[_0x391e('0x42')]['sort']);_0x4d19c6[_0x391e('0x4c')]=qs['filters'](_[_0x391e('0x4d')](_0x4a14fa[_0x391e('0x42')],_0x5a1e1e[_0x391e('0x43')]));if(_0x4a14fa[_0x391e('0x42')]['filter']){_0x4d19c6[_0x391e('0x4c')]=_['merge'](_0x4d19c6[_0x391e('0x4c')],{'$or':_[_0x391e('0x33')](_0x4d19c6[_0x391e('0x46')],function(_0x2f66b4){var _0x31af83={};_0x31af83[_0x2f66b4]={'$like':'%'+_0x4a14fa[_0x391e('0x42')][_0x391e('0x31')]+'%'};return _0x31af83;})});}_0x4d19c6=_[_0x391e('0x4e')]({},_0x4d19c6,_0x4a14fa[_0x391e('0x6d')]);return _0x307bbe[_0x391e('0x9e')](_0x4d19c6);}})['then'](function(_0x379755){if(_0x379755){_0xefb93b=_0x379755[_0x391e('0x48')];if(!_0x4a14fa[_0x391e('0x42')][_0x391e('0x49')](_0x391e('0x4a'))){_0x4d19c6[_0x391e('0x25')]=qs[_0x391e('0x25')](_0x4a14fa[_0x391e('0x42')][_0x391e('0x25')]);_0x4d19c6['offset']=qs[_0x391e('0x24')](_0x4a14fa[_0x391e('0x42')][_0x391e('0x24')]);}return _0x307bbe[_0x391e('0x9e')](_0x4d19c6);}})[_0x391e('0x3b')](function(_0x184210){if(_0x184210){return _0x184210?{'count':_0xefb93b,'rows':_0x184210}:null;}})[_0x391e('0x3b')](respondWithResult(_0x14ffc1,null))['catch'](handleError(_0x14ffc1,null));};exports[_0x391e('0x9f')]=function(_0x104268,_0x2583ed,_0x4f91cd){var _0x59ca35={};var _0x3eadfb={};var _0x892590;var _0x4982cc;return db[_0x391e('0x52')]['findOne']({'where':{'id':_0x104268[_0x391e('0x57')]['id']}})['then'](handleEntityNotFound(_0x2583ed,null))[_0x391e('0x3b')](function(_0x38ac22){if(_0x38ac22){_0x892590=_0x38ac22;_0x3eadfb['model']=_['keys'](db[_0x391e('0x80')][_0x391e('0x58')]);_0x3eadfb['query']=_[_0x391e('0x41')](_0x104268[_0x391e('0x42')]);_0x3eadfb[_0x391e('0x43')]=_[_0x391e('0x44')](_0x3eadfb[_0x391e('0x45')],_0x3eadfb[_0x391e('0x42')]);_0x59ca35[_0x391e('0x46')]=_[_0x391e('0x44')](_0x3eadfb['model'],qs['fields'](_0x104268[_0x391e('0x42')][_0x391e('0x47')]));_0x59ca35[_0x391e('0x46')]=_0x59ca35[_0x391e('0x46')][_0x391e('0x48')]?_0x59ca35[_0x391e('0x46')]:_0x3eadfb[_0x391e('0x45')];_0x59ca35[_0x391e('0x69')]=qs[_0x391e('0x4b')](_0x104268['query'][_0x391e('0x4b')]);_0x59ca35[_0x391e('0x4c')]=qs[_0x391e('0x43')](_[_0x391e('0x4d')](_0x104268[_0x391e('0x42')],_0x3eadfb[_0x391e('0x43')]));if(_0x104268['query'][_0x391e('0x31')]){_0x59ca35['where']=_[_0x391e('0x4e')](_0x59ca35[_0x391e('0x4c')],{'$or':_['map'](_0x59ca35[_0x391e('0x46')],function(_0x1234b8){var _0x57ee74={};_0x57ee74[_0x1234b8]={'$like':'%'+_0x104268[_0x391e('0x42')]['filter']+'%'};return _0x57ee74;})});}_0x59ca35=_[_0x391e('0x4e')]({},_0x59ca35,_0x104268['options']);return _0x892590[_0x391e('0x9f')](_0x59ca35);}})[_0x391e('0x3b')](function(_0x2fd246){if(_0x2fd246){_0x4982cc=_0x2fd246['length'];if(!_0x104268[_0x391e('0x42')][_0x391e('0x49')](_0x391e('0x4a'))){_0x59ca35[_0x391e('0x25')]=qs[_0x391e('0x25')](_0x104268[_0x391e('0x42')]['limit']);_0x59ca35['offset']=qs[_0x391e('0x24')](_0x104268[_0x391e('0x42')][_0x391e('0x24')]);}return _0x892590[_0x391e('0x9f')](_0x59ca35);}})[_0x391e('0x3b')](function(_0x59657f){return _0x59657f?{'count':_0x4982cc,'rows':_0x59657f}:null;})[_0x391e('0x3b')](respondWithResult(_0x2583ed,null))[_0x391e('0x55')](handleError(_0x2583ed,null));};exports['getLists']=function(_0x5d289d,_0x3786c8,_0x5be12d){var _0x596f40={};var _0x5d7b94={};var _0x47dfdd;var _0x4cc9b5;return db['VoiceQueue'][_0x391e('0x67')]({'where':{'id':_0x5d289d[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x3786c8,null))[_0x391e('0x3b')](function(_0x60676c){if(_0x60676c){_0x47dfdd=_0x60676c;_0x5d7b94[_0x391e('0x45')]=_[_0x391e('0x41')](db[_0x391e('0xa0')]['rawAttributes']);_0x5d7b94[_0x391e('0x42')]=_[_0x391e('0x41')](_0x5d289d[_0x391e('0x42')]);_0x5d7b94['filters']=_[_0x391e('0x44')](_0x5d7b94['model'],_0x5d7b94[_0x391e('0x42')]);_0x596f40['attributes']=_[_0x391e('0x44')](_0x5d7b94[_0x391e('0x45')],qs[_0x391e('0x47')](_0x5d289d[_0x391e('0x42')]['fields']));_0x596f40['attributes']=_0x596f40[_0x391e('0x46')][_0x391e('0x48')]?_0x596f40[_0x391e('0x46')]:_0x5d7b94[_0x391e('0x45')];_0x596f40[_0x391e('0x69')]=qs['sort'](_0x5d289d[_0x391e('0x42')][_0x391e('0x4b')]);_0x596f40[_0x391e('0x4c')]=qs[_0x391e('0x43')](_[_0x391e('0x4d')](_0x5d289d['query'],_0x5d7b94[_0x391e('0x43')]));if(_0x5d289d[_0x391e('0x42')][_0x391e('0x31')]){_0x596f40[_0x391e('0x4c')]=_[_0x391e('0x4e')](_0x596f40[_0x391e('0x4c')],{'$or':_[_0x391e('0x33')](_0x596f40[_0x391e('0x46')],function(_0x286be2){var _0x321e88={};_0x321e88[_0x286be2]={'$like':'%'+_0x5d289d['query'][_0x391e('0x31')]+'%'};return _0x321e88;})});}_0x596f40=_['merge']({},_0x596f40,_0x5d289d[_0x391e('0x6d')]);return _0x47dfdd['getLists'](_0x596f40);}})[_0x391e('0x3b')](function(_0x52542e){if(_0x52542e){_0x4cc9b5=_0x52542e[_0x391e('0x48')];if(!_0x5d289d[_0x391e('0x42')]['hasOwnProperty']('nolimit')){_0x596f40['limit']=qs[_0x391e('0x25')](_0x5d289d['query'][_0x391e('0x25')]);_0x596f40[_0x391e('0x24')]=qs[_0x391e('0x24')](_0x5d289d[_0x391e('0x42')][_0x391e('0x24')]);}return _0x47dfdd[_0x391e('0xa1')](_0x596f40);}})[_0x391e('0x3b')](function(_0xcf708b){if(_0xcf708b){return _0xcf708b?{'count':_0x4cc9b5,'rows':_0xcf708b}:null;}})['then'](respondWithResult(_0x3786c8,null))['catch'](handleError(_0x3786c8,null));};exports['addLists']=function(_0x4edf6c,_0x187536,_0x3ddbbb){var _0x5ee694,_0x40fa74;return db[_0x391e('0x52')][_0x391e('0x37')]({'where':{'id':_0x4edf6c[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x187536,null))[_0x391e('0x3b')](function(_0x1d3044){if(_0x1d3044){_0x40fa74=_0x1d3044;return _0x1d3044['addLists'](_0x4edf6c[_0x391e('0x5a')][_0x391e('0x89')],_[_0x391e('0x64')](_0x4edf6c[_0x391e('0x5a')],[_0x391e('0x89'),'id'])||{});}return null;})[_0x391e('0x9c')](function(_0x2cad68){var _0x3648af;_0x5ee694=_0x2cad68||[];var _0x1491db=[];if(_0x2cad68){for(var _0x1d25eb=0x0;_0x1d25eb<_0x2cad68[_0x391e('0x48')];_0x1d25eb+=0x1){var _0xd69dbb=_0x2cad68[_0x1d25eb][_0x391e('0x2c')]({'plain':!![]});_0x40fa74[_0x391e('0xa2')]=_0x4edf6c[_0x391e('0x5a')][_0x391e('0xa2')]?_0x4edf6c[_0x391e('0x5a')][_0x391e('0xa2')]:_0x40fa74[_0x391e('0xa2')];switch(_0x40fa74[_0x391e('0xa2')]){case _0x391e('0xa3'):_0x3648af=squel[_0x391e('0xa4')]()[_0x391e('0xa5')]('cm_hopper')[_0x391e('0xa6')]([_0x391e('0xa7'),_0x391e('0xa8'),'ContactId',_0x391e('0xa9'),_0x391e('0x6a'),_0x391e('0x62'),_0x391e('0x63')],squel['select']()[_0x391e('0x8b')](_0x391e('0xa7'),'phone')[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0xa8'))[_0x391e('0x8b')]('id',_0x391e('0xab'))['field'](_0xd69dbb[_0x391e('0xac')][_0x391e('0xad')](),_0x391e('0xa9'))[_0x391e('0x8b')](_0x4edf6c[_0x391e('0x57')]['id'][_0x391e('0xad')](),_0x391e('0x6a'))[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0x62'))[_0x391e('0x8b')]('NOW()',_0x391e('0x63'))[_0x391e('0xae')](_0x391e('0xaf'))['where'](_0x391e('0xb0'))[_0x391e('0x4c')](_0x391e('0xb1'),_0xd69dbb['CmListId']['toString']())[_0x391e('0x4c')]('phone\x20IS\x20NOT\x20NULL')[_0x391e('0x4c')](_0x391e('0xb2'),squel[_0x391e('0x8a')]()[_0x391e('0x8b')](_0x391e('0xb3'))[_0x391e('0xae')](_0x391e('0xb4'))[_0x391e('0x4c')]('VoiceQueueId\x20=\x20?',_0x4edf6c['params']['id'][_0x391e('0xad')]()))[_0x391e('0x4c')](_0x391e('0xb2'),squel[_0x391e('0x8a')]()['field'](_0x391e('0xb5'))['from'](_0x391e('0xb6'))[_0x391e('0x4c')](_0x391e('0x90'),_0x4edf6c['params']['id'][_0x391e('0xad')]())))['toString']();break;case _0x391e('0xb7'):_0x3648af=squel[_0x391e('0xa4')]()[_0x391e('0xa5')](_0x391e('0xb6'))[_0x391e('0xa6')]([_0x391e('0xa7'),'scheduledAt',_0x391e('0xab'),'ListId',_0x391e('0x6a'),_0x391e('0x62'),_0x391e('0x63')],squel[_0x391e('0x8a')]()[_0x391e('0x8b')]('phone',_0x391e('0xa7'))[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0xa8'))[_0x391e('0x8b')]('id',_0x391e('0xab'))['field'](_0xd69dbb[_0x391e('0xac')][_0x391e('0xad')](),_0x391e('0xa9'))[_0x391e('0x8b')](_0x4edf6c['params']['id']['toString'](),_0x391e('0x6a'))[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0x62'))[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0x63'))[_0x391e('0xae')](_0x391e('0xaf'))['where'](_0x391e('0xb0'))['where']('ListId\x20=\x20?',_0xd69dbb[_0x391e('0xac')][_0x391e('0xad')]())[_0x391e('0x4c')](_0x391e('0xb8'))[_0x391e('0x4c')](_0x391e('0xb2'),squel['select']()[_0x391e('0x8b')](_0x391e('0xb5'))[_0x391e('0xae')]('cm_hopper')[_0x391e('0x4c')](_0x391e('0x90'),_0x4edf6c[_0x391e('0x57')]['id'][_0x391e('0xad')]())))[_0x391e('0xad')]();break;default:_0x3648af=squel['insert']()[_0x391e('0xa5')](_0x391e('0xb6'))['fromQuery']([_0x391e('0xa7'),'scheduledAt',_0x391e('0xab'),'ListId',_0x391e('0x6a'),'createdAt',_0x391e('0x63')],squel[_0x391e('0x8a')]()[_0x391e('0x8b')](_0x391e('0xa7'),_0x391e('0xa7'))[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0xa8'))[_0x391e('0x8b')]('id',_0x391e('0xab'))[_0x391e('0x8b')](_0xd69dbb[_0x391e('0xac')][_0x391e('0xad')](),_0x391e('0xa9'))[_0x391e('0x8b')](_0x4edf6c[_0x391e('0x57')]['id'][_0x391e('0xad')](),_0x391e('0x6a'))[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0x62'))[_0x391e('0x8b')]('NOW()',_0x391e('0x63'))[_0x391e('0xae')]('cm_contacts')[_0x391e('0x4c')]('deletedAt\x20IS\x20NULL')[_0x391e('0x4c')](_0x391e('0xb1'),_0xd69dbb[_0x391e('0xac')][_0x391e('0xad')]())['where'](_0x391e('0xb8')))['toString']();}_0x1491db[_0x391e('0x9d')](db[_0x391e('0x7c')]['query'](_0x3648af));}return BPromise[_0x391e('0x94')](_0x1491db);}})[_0x391e('0x3b')](function(){return _0x5ee694;})[_0x391e('0x3b')](respondWithResult(_0x187536,null))['catch'](handleError(_0x187536,null));};exports[_0x391e('0xb9')]=function(_0x9897ed,_0x3af73c,_0x191d36){return db[_0x391e('0x52')][_0x391e('0x37')]({'where':{'id':_0x9897ed[_0x391e('0x57')]['id']}})['then'](handleEntityNotFound(_0x3af73c,null))['then'](function(_0x2fd264){if(_0x2fd264){return _0x2fd264[_0x391e('0xb9')](_0x9897ed[_0x391e('0x42')][_0x391e('0x89')]);}})[_0x391e('0x3b')](function(_0x3d4ed8){if(_0x3d4ed8){return db[_0x391e('0x68')][_0x391e('0x3a')]({'where':{'ListId':_0x9897ed[_0x391e('0x42')][_0x391e('0x89')],'VoiceQueueId':_0x9897ed[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](function(){return _0x3d4ed8;});}})[_0x391e('0x3b')](respondWithStatusCode(_0x3af73c,null))[_0x391e('0x55')](handleError(_0x3af73c,null));};exports['getBlackLists']=function(_0x9b81e5,_0x2f5316,_0x5f4f78){var _0x18d5f7={};var _0x4f09ec={};var _0x48ae75;var _0x3655bf;return db[_0x391e('0x52')][_0x391e('0x67')]({'where':{'id':_0x9b81e5['params']['id']}})['then'](handleEntityNotFound(_0x2f5316,null))[_0x391e('0x3b')](function(_0x14db6f){if(_0x14db6f){_0x48ae75=_0x14db6f;_0x4f09ec[_0x391e('0x45')]=_[_0x391e('0x41')](db[_0x391e('0xa0')][_0x391e('0x58')]);_0x4f09ec[_0x391e('0x42')]=_[_0x391e('0x41')](_0x9b81e5[_0x391e('0x42')]);_0x4f09ec[_0x391e('0x43')]=_['intersection'](_0x4f09ec['model'],_0x4f09ec[_0x391e('0x42')]);_0x18d5f7['attributes']=_[_0x391e('0x44')](_0x4f09ec[_0x391e('0x45')],qs['fields'](_0x9b81e5[_0x391e('0x42')][_0x391e('0x47')]));_0x18d5f7[_0x391e('0x46')]=_0x18d5f7['attributes'][_0x391e('0x48')]?_0x18d5f7[_0x391e('0x46')]:_0x4f09ec[_0x391e('0x45')];_0x18d5f7[_0x391e('0x69')]=qs['sort'](_0x9b81e5[_0x391e('0x42')][_0x391e('0x4b')]);_0x18d5f7[_0x391e('0x4c')]=qs[_0x391e('0x43')](_[_0x391e('0x4d')](_0x9b81e5[_0x391e('0x42')],_0x4f09ec['filters']));if(_0x9b81e5[_0x391e('0x42')][_0x391e('0x31')]){_0x18d5f7[_0x391e('0x4c')]=_[_0x391e('0x4e')](_0x18d5f7['where'],{'$or':_[_0x391e('0x33')](_0x18d5f7[_0x391e('0x46')],function(_0x42f36c){var _0x4a23bc={};_0x4a23bc[_0x42f36c]={'$like':'%'+_0x9b81e5[_0x391e('0x42')][_0x391e('0x31')]+'%'};return _0x4a23bc;})});}_0x18d5f7=_[_0x391e('0x4e')]({},_0x18d5f7,_0x9b81e5[_0x391e('0x6d')]);return _0x48ae75['getBlackLists'](_0x18d5f7);}})[_0x391e('0x3b')](function(_0x63433a){if(_0x63433a){_0x3655bf=_0x63433a[_0x391e('0x48')];if(!_0x9b81e5[_0x391e('0x42')]['hasOwnProperty'](_0x391e('0x4a'))){_0x18d5f7['limit']=qs['limit'](_0x9b81e5[_0x391e('0x42')]['limit']);_0x18d5f7[_0x391e('0x24')]=qs[_0x391e('0x24')](_0x9b81e5[_0x391e('0x42')][_0x391e('0x24')]);}return _0x48ae75[_0x391e('0xba')](_0x18d5f7);}})[_0x391e('0x3b')](function(_0xe7c266){if(_0xe7c266){return _0xe7c266?{'count':_0x3655bf,'rows':_0xe7c266}:null;}})[_0x391e('0x3b')](respondWithResult(_0x2f5316,null))[_0x391e('0x55')](handleError(_0x2f5316,null));};exports[_0x391e('0xbb')]=function(_0x50bea7,_0x1429df,_0x2dc57a){var _0x17a1b2,_0x35f467;return db['VoiceQueue'][_0x391e('0x37')]({'where':{'id':_0x50bea7[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x1429df,null))['then'](function(_0x4fe3a6){if(_0x4fe3a6){_0x35f467=_0x4fe3a6;return _0x4fe3a6[_0x391e('0xbb')](_0x50bea7['body'][_0x391e('0x89')],_[_0x391e('0x64')](_0x50bea7[_0x391e('0x5a')],[_0x391e('0x89'),'id'])||{});}return null;})[_0x391e('0x9c')](function(_0x4c42f1){var _0x5ce899;_0x17a1b2=_0x4c42f1||[];var _0x47dcbb=[];if(_0x4c42f1){for(var _0x35eaa9=0x0;_0x35eaa9<_0x4c42f1[_0x391e('0x48')];_0x35eaa9+=0x1){var _0x4a4e01=_0x4c42f1[_0x35eaa9][_0x391e('0x2c')]({'plain':!![]});_0x5ce899=squel[_0x391e('0xa4')]()[_0x391e('0xa5')](_0x391e('0xbc'))[_0x391e('0xa6')]([_0x391e('0xa7'),_0x391e('0xab'),'ListId',_0x391e('0x6a'),_0x391e('0x62'),'updatedAt'],squel[_0x391e('0x8a')]()[_0x391e('0x8b')](_0x391e('0xa7'),'phone')[_0x391e('0x8b')]('id',_0x391e('0xab'))[_0x391e('0x8b')](_0x4a4e01['CmListId'][_0x391e('0xad')](),_0x391e('0xa9'))['field'](_0x50bea7[_0x391e('0x57')]['id']['toString'](),'VoiceQueueId')[_0x391e('0x8b')](_0x391e('0xaa'),'createdAt')[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0x63'))[_0x391e('0xae')](_0x391e('0xaf'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x391e('0xb1'),_0x4a4e01[_0x391e('0xac')][_0x391e('0xad')]())[_0x391e('0x4c')]('phone\x20IS\x20NOT\x20NULL'))[_0x391e('0xad')]();_0x47dcbb['push'](db['sequelize'][_0x391e('0x42')](_0x5ce899));}return BPromise[_0x391e('0x94')](_0x47dcbb);}})[_0x391e('0x3b')](function(){return _0x17a1b2;})[_0x391e('0x3b')](respondWithResult(_0x1429df,null))['catch'](handleError(_0x1429df,null));};exports[_0x391e('0xbd')]=function(_0x16d56a,_0x15e3a3,_0x31442c){return db[_0x391e('0x52')]['find']({'where':{'id':_0x16d56a[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x15e3a3,null))[_0x391e('0x3b')](function(_0xe3b29f){if(_0xe3b29f){return _0xe3b29f[_0x391e('0xbd')](_0x16d56a[_0x391e('0x42')][_0x391e('0x89')]);}})[_0x391e('0x3b')](function(_0x585b22){if(_0x585b22){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x16d56a['query'][_0x391e('0x89')],'VoiceQueueId':_0x16d56a[_0x391e('0x57')]['id']}})['then'](function(){return _0x585b22;});}})[_0x391e('0x3b')](respondWithStatusCode(_0x15e3a3,null))['catch'](handleError(_0x15e3a3,null));}; \ No newline at end of file +var _0xf684=['QueryTypes','SELECT','every','TeamId','all','union','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','push','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','ListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','type','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','options','VoiceQueue','count','include','findAll','rows','catch','show','includeAll','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','params','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','voicePause','interface','flatMap','forEach','penalty','transaction','each','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','clone','sequelize'];(function(_0x2fcdeb,_0xb6504d){var _0x51c2af=function(_0x54e4a1){while(--_0x54e4a1){_0x2fcdeb['push'](_0x2fcdeb['shift']());}};_0x51c2af(++_0xb6504d);}(_0xf684,0x19f));var _0x4f68=function(_0x2c2544,_0x488761){_0x2c2544=_0x2c2544-0x0;var _0x1a68a0=_0xf684[_0x2c2544];return _0x1a68a0;};'use strict';var pdf=require(_0x4f68('0x0'));var emlformat=require(_0x4f68('0x1'));var rimraf=require(_0x4f68('0x2'));var zipdir=require(_0x4f68('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4f68('0x4'));var Mustache=require(_0x4f68('0x5'));var util=require(_0x4f68('0x6'));var path=require('path');var sox=require(_0x4f68('0x7'));var csv=require(_0x4f68('0x8'));var ejs=require(_0x4f68('0x9'));var fs=require('fs');var _=require(_0x4f68('0xa'));var squel=require('squel');var crypto=require(_0x4f68('0xb'));var jsforce=require(_0x4f68('0xc'));var deskjs=require(_0x4f68('0xd'));var toCsv=require(_0x4f68('0x8'));var querystring=require(_0x4f68('0xe'));var Papa=require(_0x4f68('0xf'));var Redis=require(_0x4f68('0x10'));var authService=require(_0x4f68('0x11'));var qs=require(_0x4f68('0x12'));var as=require(_0x4f68('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f68('0x14'))(_0x4f68('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f68('0x16'))['db'];config['redis']=_[_0x4f68('0x17')](config[_0x4f68('0x18')],{'host':_0x4f68('0x19'),'port':0x18eb});var socket=require(_0x4f68('0x1a'))(new Redis(config[_0x4f68('0x18')]));require(_0x4f68('0x1b'))[_0x4f68('0x1c')](socket);function respondWithStatusCode(_0x7f60e8,_0x33d95a){_0x33d95a=_0x33d95a||0xcc;return function(_0xe92398){if(_0xe92398){return _0x7f60e8[_0x4f68('0x1d')](_0x33d95a);}return _0x7f60e8[_0x4f68('0x1e')](_0x33d95a)[_0x4f68('0x1f')]();};}function respondWithResult(_0x3ca488,_0x5414d9){_0x5414d9=_0x5414d9||0xc8;return function(_0x6a47f7){if(_0x6a47f7){return _0x3ca488[_0x4f68('0x1e')](_0x5414d9)[_0x4f68('0x20')](_0x6a47f7);}};}function respondWithFilteredResult(_0x57e76b,_0x398272){return function(_0x33e818){if(_0x33e818){var _0x43e55d=_0x33e818['count'],_0x40dc2a=_0x398272[_0x4f68('0x21')],_0x526ec2=_0x398272[_0x4f68('0x21')]+_0x398272[_0x4f68('0x22')],_0x46a965;if(_0x526ec2>=_0x43e55d){_0x526ec2=_0x43e55d;_0x46a965=0xc8;}else{_0x46a965=0xce;}_0x57e76b[_0x4f68('0x1e')](_0x46a965);return _0x57e76b[_0x4f68('0x23')](_0x4f68('0x24'),_0x40dc2a+'-'+_0x526ec2+'/'+_0x43e55d)[_0x4f68('0x20')](_0x33e818);}return null;};}function patchUpdates(_0x1f4751){return function(_0x303caf){try{jsonpatch[_0x4f68('0x25')](_0x303caf,_0x1f4751,!![]);}catch(_0x2cf6a1){return BPromise[_0x4f68('0x26')](_0x2cf6a1);}return _0x303caf[_0x4f68('0x27')]();};}function saveUpdates(_0xcfac41,_0x5db7bc){return function(_0x139e25){if(_0x139e25){return _0x139e25[_0x4f68('0x28')](_0xcfac41)['then'](function(_0x43df58){return _0x43df58;});}return null;};}function removeEntity(_0x5a3258,_0x1fc91c){return function(_0x15e661){if(_0x15e661){return _0x15e661[_0x4f68('0x29')]()[_0x4f68('0x2a')](function(){var _0x2aba8f=_0x15e661['get']({'plain':!![]});var _0x2baba4=[{'name':_0x4f68('0x2b'),'value':_0x4f68('0x2c'),'ignore':![]},{'name':_0x4f68('0x2d'),'value':_0x4f68('0x2e'),'ignore':![]}];var _0x194a6b=_(_0x2baba4)[_0x4f68('0x2f')](_0x4f68('0x30'))['map'](_0x4f68('0x31'))[_0x4f68('0x31')]();if(_['includes'](_0x194a6b,_0x2aba8f[_0x4f68('0x32')])){return;}var _0x1b4c54=_['find'](_0x2baba4,[_0x4f68('0x31'),_0x2aba8f[_0x4f68('0x32')]])['name'];return db[_0x4f68('0x33')]['destroy']({'where':{'type':_0x1b4c54,'resourceId':_0x2aba8f['id']}})[_0x4f68('0x2a')](function(){return _0x15e661;});})[_0x4f68('0x2a')](function(){_0x5a3258[_0x4f68('0x1e')](0xcc)[_0x4f68('0x1f')]();});}};}function handleEntityNotFound(_0x3eca4f,_0x3eef50){return function(_0xae2342){if(!_0xae2342){_0x3eca4f['sendStatus'](0x194);}return _0xae2342;};}function handleError(_0x5c4729,_0x54017e){_0x54017e=_0x54017e||0x1f4;return function(_0x5f386b){logger[_0x4f68('0x34')](_0x5f386b[_0x4f68('0x35')]);if(_0x5f386b[_0x4f68('0x36')]){delete _0x5f386b[_0x4f68('0x36')];}_0x5c4729[_0x4f68('0x1e')](_0x54017e)[_0x4f68('0x37')](_0x5f386b);};}exports[_0x4f68('0x38')]=function(_0x4086b0,_0x2a62e0){var _0x44e64f={},_0x1b06df={},_0xb4c2db={'count':0x0,'rows':[]};var _0x4282c0=_[_0x4f68('0x39')](db['VoiceQueue'][_0x4f68('0x3a')],function(_0x5dbe54){return{'name':_0x5dbe54[_0x4f68('0x3b')],'type':_0x5dbe54[_0x4f68('0x32')][_0x4f68('0x3c')]};});_0x1b06df[_0x4f68('0x3d')]=_[_0x4f68('0x39')](_0x4282c0,'name');_0x1b06df[_0x4f68('0x3e')]=_[_0x4f68('0x3f')](_0x4086b0['query']);_0x1b06df['filters']=_['intersection'](_0x1b06df['model'],_0x1b06df[_0x4f68('0x3e')]);_0x44e64f[_0x4f68('0x40')]=_[_0x4f68('0x41')](_0x1b06df[_0x4f68('0x3d')],qs['fields'](_0x4086b0[_0x4f68('0x3e')][_0x4f68('0x42')]));_0x44e64f[_0x4f68('0x40')]=_0x44e64f[_0x4f68('0x40')][_0x4f68('0x43')]?_0x44e64f[_0x4f68('0x40')]:_0x1b06df['model'];if(!_0x4086b0[_0x4f68('0x3e')][_0x4f68('0x44')](_0x4f68('0x45'))){_0x44e64f['limit']=qs[_0x4f68('0x22')](_0x4086b0['query'][_0x4f68('0x22')]);_0x44e64f[_0x4f68('0x21')]=qs[_0x4f68('0x21')](_0x4086b0['query'][_0x4f68('0x21')]);}_0x44e64f[_0x4f68('0x46')]=qs[_0x4f68('0x47')](_0x4086b0[_0x4f68('0x3e')][_0x4f68('0x47')]);_0x44e64f['where']=qs[_0x4f68('0x48')](_[_0x4f68('0x49')](_0x4086b0[_0x4f68('0x3e')],_0x1b06df[_0x4f68('0x48')]),_0x4282c0);if(_0x4086b0[_0x4f68('0x3e')][_0x4f68('0x2f')]){_0x44e64f[_0x4f68('0x4a')]=_[_0x4f68('0x4b')](_0x44e64f['where'],{'$or':_['map'](_0x4282c0,function(_0x3d66a4){if(_0x3d66a4[_0x4f68('0x32')]!==_0x4f68('0x4c')){var _0x1bfb7f={};_0x1bfb7f[_0x3d66a4[_0x4f68('0x36')]]={'$like':'%'+_0x4086b0['query'][_0x4f68('0x2f')]+'%'};return _0x1bfb7f;}})});}_0x44e64f=_[_0x4f68('0x4b')]({},_0x44e64f,_0x4086b0[_0x4f68('0x4d')]);var _0x597bce={'where':_0x44e64f[_0x4f68('0x4a')]};return db[_0x4f68('0x4e')][_0x4f68('0x4f')](_0x597bce)[_0x4f68('0x2a')](function(_0x511f0f){_0xb4c2db[_0x4f68('0x4f')]=_0x511f0f;if(_0x4086b0[_0x4f68('0x3e')]['includeAll']){_0x44e64f[_0x4f68('0x50')]=[{'all':!![]}];}return db[_0x4f68('0x4e')][_0x4f68('0x51')](_0x44e64f);})[_0x4f68('0x2a')](function(_0x45c6bf){_0xb4c2db[_0x4f68('0x52')]=_0x45c6bf;return _0xb4c2db;})[_0x4f68('0x2a')](respondWithFilteredResult(_0x2a62e0,_0x44e64f))[_0x4f68('0x53')](handleError(_0x2a62e0,null));};exports[_0x4f68('0x54')]=function(_0xbeefca,_0x3ff84f){var _0x497b14={'raw':![],'where':{'id':_0xbeefca['params']['id']}},_0x402852={};_0x402852[_0x4f68('0x3d')]=_[_0x4f68('0x3f')](db['VoiceQueue'][_0x4f68('0x3a')]);_0x402852[_0x4f68('0x3e')]=_[_0x4f68('0x3f')](_0xbeefca[_0x4f68('0x3e')]);_0x402852[_0x4f68('0x48')]=_['intersection'](_0x402852[_0x4f68('0x3d')],_0x402852['query']);_0x497b14[_0x4f68('0x40')]=_['intersection'](_0x402852[_0x4f68('0x3d')],qs[_0x4f68('0x42')](_0xbeefca['query']['fields']));_0x497b14[_0x4f68('0x40')]=_0x497b14['attributes'][_0x4f68('0x43')]?_0x497b14['attributes']:_0x402852[_0x4f68('0x3d')];if(_0xbeefca[_0x4f68('0x3e')][_0x4f68('0x55')]){_0x497b14[_0x4f68('0x50')]=[{'all':!![]}];}_0x497b14=_[_0x4f68('0x4b')]({},_0x497b14,_0xbeefca[_0x4f68('0x4d')]);return db[_0x4f68('0x4e')][_0x4f68('0x56')](_0x497b14)[_0x4f68('0x2a')](handleEntityNotFound(_0x3ff84f,null))[_0x4f68('0x2a')](respondWithResult(_0x3ff84f,null))[_0x4f68('0x53')](handleError(_0x3ff84f,null));};exports[_0x4f68('0x57')]=function(_0xdbc46a,_0x4faa8d){return db[_0x4f68('0x4e')]['create'](_0xdbc46a[_0x4f68('0x58')],{})[_0x4f68('0x2a')](function(_0x3fe092){var _0x2a87d0=_0xdbc46a[_0x4f68('0x59')][_0x4f68('0x5a')]({'plain':!![]});if(!_0x2a87d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a87d0[_0x4f68('0x5b')]===_0x4f68('0x59')){var _0x6ec436=_0x3fe092['get']({'plain':!![]});var _0x2686dc=[{'name':_0x4f68('0x2b'),'value':'inbound'},{'name':_0x4f68('0x2d'),'value':'outbound'}];var _0x2f5945=_[_0x4f68('0x56')](_0x2686dc,[_0x4f68('0x31'),_0x6ec436[_0x4f68('0x32')]])['name'];return db[_0x4f68('0x5c')][_0x4f68('0x56')]({'where':{'name':_0x2f5945,'userProfileId':_0x2a87d0[_0x4f68('0x5d')]},'raw':!![]})['then'](function(_0x44a014){if(_0x44a014&&_0x44a014[_0x4f68('0x5e')]===0x0){return db[_0x4f68('0x33')][_0x4f68('0x57')]({'name':_0x6ec436[_0x4f68('0x36')],'resourceId':_0x6ec436['id'],'type':_0x44a014['name'],'sectionId':_0x44a014['id']},{})[_0x4f68('0x2a')](function(){return _0x3fe092;});}else{return _0x3fe092;}})[_0x4f68('0x53')](function(_0x177fc6){logger[_0x4f68('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x177fc6);throw _0x177fc6;});}return _0x3fe092;})[_0x4f68('0x2a')](respondWithResult(_0x4faa8d,0xc9))[_0x4f68('0x53')](handleError(_0x4faa8d,null));};exports['clone']=function(_0x1eecf2,_0x45f42d){var _0x3022c4={'where':{'id':_0x1eecf2[_0x4f68('0x5f')]['id']}},_0x4dc0b5={};_0x4dc0b5[_0x4f68('0x3d')]=_[_0x4f68('0x3f')](db['VoiceQueue'][_0x4f68('0x3a')]);_0x3022c4[_0x4f68('0x40')]=_[_0x4f68('0x41')](_0x4dc0b5['model'],qs[_0x4f68('0x42')](_0x1eecf2[_0x4f68('0x3e')][_0x4f68('0x42')]));_0x3022c4[_0x4f68('0x40')]=_0x3022c4['attributes'][_0x4f68('0x43')]?_0x3022c4[_0x4f68('0x40')]:_0x4dc0b5[_0x4f68('0x3d')];if(_0x1eecf2[_0x4f68('0x3e')][_0x4f68('0x55')]){_0x3022c4[_0x4f68('0x50')]=[{'all':!![]}];}_0x3022c4=_[_0x4f68('0x4b')]({},_0x3022c4,_0x1eecf2[_0x4f68('0x4d')]);return db[_0x4f68('0x4e')][_0x4f68('0x56')](_0x3022c4)[_0x4f68('0x2a')](handleEntityNotFound(_0x45f42d,null))[_0x4f68('0x2a')](function(_0x5f042d){if(_0x5f042d){var _0x49f310=_0x5f042d[_0x4f68('0x5a')]({'plain':!![]});_0x49f310=qs[_0x4f68('0x60')](_0x49f310,['id',_0x4f68('0x61'),_0x4f68('0x62')]);_0x1eecf2[_0x4f68('0x58')]=_[_0x4f68('0x60')](_0x1eecf2[_0x4f68('0x58')],['id',_0x4f68('0x61'),_0x4f68('0x62')]);return db[_0x4f68('0x4e')][_0x4f68('0x57')](_[_0x4f68('0x4b')](_0x49f310,_0x1eecf2[_0x4f68('0x58')]),{'include':_0x1eecf2[_0x4f68('0x3e')][_0x4f68('0x55')]?[{'all':!![]}]:undefined})['then'](function(_0x1d32af){var _0x13d773=_0x1eecf2[_0x4f68('0x59')]['get']({'plain':!![]});if(!_0x13d773)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13d773[_0x4f68('0x5b')]===_0x4f68('0x59')){var _0x57fa62=_0x1d32af['get']({'plain':!![]});var _0x1528bf=[{'name':_0x4f68('0x2b'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x4f68('0x2e')}];var _0x125855=_['find'](_0x1528bf,[_0x4f68('0x31'),_0x57fa62[_0x4f68('0x32')]])[_0x4f68('0x36')];return db['UserProfileSection']['find']({'where':{'name':_0x125855,'userProfileId':_0x13d773['userProfileId']},'raw':!![]})[_0x4f68('0x2a')](function(_0x13c851){if(_0x13c851&&_0x13c851[_0x4f68('0x5e')]===0x0){return db['UserProfileResource'][_0x4f68('0x57')]({'name':_0x57fa62[_0x4f68('0x36')],'resourceId':_0x57fa62['id'],'type':_0x13c851['name'],'sectionId':_0x13c851['id']},{})[_0x4f68('0x2a')](function(){return _0x1d32af;});}else{return _0x1d32af;}})[_0x4f68('0x53')](function(_0x2253b6){logger['error'](_0x4f68('0x63'),_0x2253b6);throw _0x2253b6;});}return _0x1d32af;});}})[_0x4f68('0x2a')](respondWithResult(_0x45f42d,0xc9))[_0x4f68('0x53')](handleError(_0x45f42d,null));};exports[_0x4f68('0x28')]=function(_0x9c3d61,_0x13c404){if(_0x9c3d61[_0x4f68('0x58')]['id']){delete _0x9c3d61[_0x4f68('0x58')]['id'];}return db[_0x4f68('0x4e')]['find']({'where':{'id':_0x9c3d61[_0x4f68('0x5f')]['id']}})[_0x4f68('0x2a')](handleEntityNotFound(_0x13c404,null))[_0x4f68('0x2a')](saveUpdates(_0x9c3d61[_0x4f68('0x58')],null))[_0x4f68('0x2a')](respondWithResult(_0x13c404,null))[_0x4f68('0x53')](handleError(_0x13c404,null));};exports[_0x4f68('0x29')]=function(_0x2c43b4,_0x110d44){return db[_0x4f68('0x4e')][_0x4f68('0x56')]({'where':{'id':_0x2c43b4[_0x4f68('0x5f')]['id']}})[_0x4f68('0x2a')](handleEntityNotFound(_0x110d44,null))[_0x4f68('0x2a')](removeEntity(_0x110d44,null))[_0x4f68('0x53')](handleError(_0x110d44,null));};exports['getHoppers']=function(_0x1381ca,_0x3799cb,_0x56387c){var _0x3e16c2={'raw':![],'where':{}};var _0x18d02c={};var _0x48cfc0={'count':0x0,'rows':[]};return db[_0x4f68('0x4e')][_0x4f68('0x64')]({'where':{'id':_0x1381ca['params']['id']}})[_0x4f68('0x2a')](handleEntityNotFound(_0x3799cb,null))[_0x4f68('0x2a')](function(_0x576efe){if(_0x576efe){_0x18d02c[_0x4f68('0x3d')]=_[_0x4f68('0x3f')](db[_0x4f68('0x65')][_0x4f68('0x3a')]);_0x18d02c[_0x4f68('0x3e')]=_[_0x4f68('0x3f')](_0x1381ca[_0x4f68('0x3e')]);_0x18d02c[_0x4f68('0x48')]=_[_0x4f68('0x41')](_0x18d02c[_0x4f68('0x3d')],_0x18d02c[_0x4f68('0x3e')]);_0x3e16c2[_0x4f68('0x40')]=_[_0x4f68('0x41')](_0x18d02c[_0x4f68('0x3d')],qs['fields'](_0x1381ca[_0x4f68('0x3e')][_0x4f68('0x42')]));_0x3e16c2[_0x4f68('0x40')]=_0x3e16c2['attributes'][_0x4f68('0x43')]?_0x3e16c2[_0x4f68('0x40')]:_0x18d02c[_0x4f68('0x3d')];if(!_0x1381ca['query'][_0x4f68('0x44')](_0x4f68('0x45'))){_0x3e16c2[_0x4f68('0x22')]=qs[_0x4f68('0x22')](_0x1381ca['query'][_0x4f68('0x22')]);_0x3e16c2[_0x4f68('0x21')]=qs[_0x4f68('0x21')](_0x1381ca[_0x4f68('0x3e')][_0x4f68('0x21')]);}_0x3e16c2[_0x4f68('0x46')]=qs[_0x4f68('0x47')](_0x1381ca[_0x4f68('0x3e')]['sort']);_0x3e16c2['where']=qs[_0x4f68('0x48')](_[_0x4f68('0x49')](_0x1381ca['query'],_0x18d02c[_0x4f68('0x48')]));_0x3e16c2['where'][_0x4f68('0x66')]=_0x576efe['id'];if(_0x1381ca[_0x4f68('0x3e')][_0x4f68('0x2f')]){_0x3e16c2[_0x4f68('0x4a')]=_['merge'](_0x3e16c2[_0x4f68('0x4a')],{'$or':_[_0x4f68('0x39')](_0x3e16c2[_0x4f68('0x40')],function(_0x5ef939){var _0x441f20={};_0x441f20[_0x5ef939]={'$like':'%'+_0x1381ca[_0x4f68('0x3e')][_0x4f68('0x2f')]+'%'};return _0x441f20;})});}_0x3e16c2=_[_0x4f68('0x4b')]({},_0x3e16c2,_0x1381ca[_0x4f68('0x4d')]);return db[_0x4f68('0x65')]['count']({'where':_0x3e16c2[_0x4f68('0x4a')]})[_0x4f68('0x2a')](function(_0x3cf677){_0x48cfc0[_0x4f68('0x4f')]=_0x3cf677;if(_0x1381ca[_0x4f68('0x3e')]['includeAll']){_0x3e16c2[_0x4f68('0x50')]=[{'all':!![]}];}return db['CmHopper'][_0x4f68('0x51')](_0x3e16c2);})[_0x4f68('0x2a')](function(_0x2eb481){_0x48cfc0['rows']=_0x2eb481;return _0x48cfc0;});}})[_0x4f68('0x2a')](respondWithFilteredResult(_0x3799cb,_0x3e16c2))[_0x4f68('0x53')](handleError(_0x3799cb,null));};exports[_0x4f68('0x67')]=function(_0x3265d1,_0x1eb7da,_0x19c977){var _0x455b5a={'raw':!![],'where':{}};var _0x3f93af={};var _0x4e4517={'count':0x0,'rows':[]};return db[_0x4f68('0x4e')][_0x4f68('0x64')]({'where':{'id':_0x3265d1['params']['id']}})[_0x4f68('0x2a')](handleEntityNotFound(_0x1eb7da,null))[_0x4f68('0x2a')](function(_0xbf83bd){if(_0xbf83bd){_0x3f93af[_0x4f68('0x3d')]=_[_0x4f68('0x3f')](db[_0x4f68('0x68')][_0x4f68('0x3a')]);_0x3f93af['query']=_[_0x4f68('0x3f')](_0x3265d1[_0x4f68('0x3e')]);_0x3f93af['filters']=_[_0x4f68('0x41')](_0x3f93af[_0x4f68('0x3d')],_0x3f93af[_0x4f68('0x3e')]);_0x455b5a[_0x4f68('0x40')]=_['intersection'](_0x3f93af[_0x4f68('0x3d')],qs['fields'](_0x3265d1['query'][_0x4f68('0x42')]));_0x455b5a[_0x4f68('0x40')]=_0x455b5a[_0x4f68('0x40')][_0x4f68('0x43')]?_0x455b5a[_0x4f68('0x40')]:_0x3f93af['model'];if(!_0x3265d1[_0x4f68('0x3e')][_0x4f68('0x44')]('nolimit')){_0x455b5a[_0x4f68('0x22')]=qs['limit'](_0x3265d1['query']['limit']);_0x455b5a['offset']=qs[_0x4f68('0x21')](_0x3265d1[_0x4f68('0x3e')]['offset']);}_0x455b5a[_0x4f68('0x46')]=qs[_0x4f68('0x47')](_0x3265d1[_0x4f68('0x3e')][_0x4f68('0x47')]);_0x455b5a['where']=qs[_0x4f68('0x48')](_[_0x4f68('0x49')](_0x3265d1[_0x4f68('0x3e')],_0x3f93af['filters']));_0x455b5a[_0x4f68('0x4a')]['VoiceQueueId']=_0xbf83bd['id'];if(_0x3265d1[_0x4f68('0x3e')][_0x4f68('0x2f')]){_0x455b5a[_0x4f68('0x4a')]=_[_0x4f68('0x4b')](_0x455b5a['where'],{'$or':_[_0x4f68('0x39')](_0x455b5a[_0x4f68('0x40')],function(_0x463d2d){var _0x22abc5={};_0x22abc5[_0x463d2d]={'$like':'%'+_0x3265d1['query'][_0x4f68('0x2f')]+'%'};return _0x22abc5;})});}_0x455b5a=_['merge']({},_0x455b5a,_0x3265d1[_0x4f68('0x4d')]);return db[_0x4f68('0x68')]['count']({'where':_0x455b5a['where']})[_0x4f68('0x2a')](function(_0x3bfb27){_0x4e4517[_0x4f68('0x4f')]=_0x3bfb27;if(_0x3265d1[_0x4f68('0x3e')][_0x4f68('0x55')]){_0x455b5a['include']=[{'all':!![]}];}return db[_0x4f68('0x68')][_0x4f68('0x51')](_0x455b5a);})[_0x4f68('0x2a')](function(_0x1f46a6){_0x4e4517['rows']=_0x1f46a6;return _0x4e4517;});}})[_0x4f68('0x2a')](respondWithFilteredResult(_0x1eb7da,_0x455b5a))[_0x4f68('0x53')](handleError(_0x1eb7da,null));};exports['getHopperFinals']=function(_0x5ee82d,_0x291f38,_0x3dc9de){var _0x45c059={'raw':!![],'where':{}};var _0x3ef1c2={};var _0x35af3b={'count':0x0,'rows':[]};return db[_0x4f68('0x4e')][_0x4f68('0x64')]({'where':{'id':_0x5ee82d[_0x4f68('0x5f')]['id']}})[_0x4f68('0x2a')](handleEntityNotFound(_0x291f38,null))[_0x4f68('0x2a')](function(_0x3b9e69){if(_0x3b9e69){_0x3ef1c2[_0x4f68('0x3d')]=_[_0x4f68('0x3f')](db[_0x4f68('0x69')][_0x4f68('0x3a')]);_0x3ef1c2[_0x4f68('0x3e')]=_['keys'](_0x5ee82d[_0x4f68('0x3e')]);_0x3ef1c2['filters']=_[_0x4f68('0x41')](_0x3ef1c2[_0x4f68('0x3d')],_0x3ef1c2[_0x4f68('0x3e')]);_0x45c059[_0x4f68('0x40')]=_[_0x4f68('0x41')](_0x3ef1c2[_0x4f68('0x3d')],qs[_0x4f68('0x42')](_0x5ee82d[_0x4f68('0x3e')][_0x4f68('0x42')]));_0x45c059['attributes']=_0x45c059[_0x4f68('0x40')][_0x4f68('0x43')]?_0x45c059['attributes']:_0x3ef1c2[_0x4f68('0x3d')];if(!_0x5ee82d[_0x4f68('0x3e')][_0x4f68('0x44')](_0x4f68('0x45'))){_0x45c059[_0x4f68('0x22')]=qs['limit'](_0x5ee82d['query'][_0x4f68('0x22')]);_0x45c059['offset']=qs[_0x4f68('0x21')](_0x5ee82d[_0x4f68('0x3e')][_0x4f68('0x21')]);}_0x45c059['order']=qs[_0x4f68('0x47')](_0x5ee82d[_0x4f68('0x3e')][_0x4f68('0x47')]);_0x45c059['where']=qs[_0x4f68('0x48')](_[_0x4f68('0x49')](_0x5ee82d['query'],_0x3ef1c2[_0x4f68('0x48')]));_0x45c059[_0x4f68('0x4a')][_0x4f68('0x66')]=_0x3b9e69['id'];if(_0x5ee82d[_0x4f68('0x3e')][_0x4f68('0x2f')]){_0x45c059[_0x4f68('0x4a')]=_[_0x4f68('0x4b')](_0x45c059[_0x4f68('0x4a')],{'$or':_['map'](_0x45c059[_0x4f68('0x40')],function(_0x18d7f5){var _0x44da0b={};_0x44da0b[_0x18d7f5]={'$like':'%'+_0x5ee82d[_0x4f68('0x3e')][_0x4f68('0x2f')]+'%'};return _0x44da0b;})});}_0x45c059=_['merge']({},_0x45c059,_0x5ee82d[_0x4f68('0x4d')]);return db[_0x4f68('0x69')][_0x4f68('0x4f')]({'where':_0x45c059[_0x4f68('0x4a')]})[_0x4f68('0x2a')](function(_0x42426f){_0x35af3b[_0x4f68('0x4f')]=_0x42426f;if(_0x5ee82d['query'][_0x4f68('0x55')]){_0x45c059[_0x4f68('0x50')]=[{'all':!![]}];}return db[_0x4f68('0x69')][_0x4f68('0x51')](_0x45c059);})[_0x4f68('0x2a')](function(_0xb85e0d){_0x35af3b[_0x4f68('0x52')]=_0xb85e0d;return _0x35af3b;});}})[_0x4f68('0x2a')](respondWithFilteredResult(_0x291f38,_0x45c059))[_0x4f68('0x53')](handleError(_0x291f38,null));};exports['getHopperBlacks']=function(_0x338e65,_0x2677c3,_0x2235ce){var _0x4db406={'raw':!![],'where':{}};var _0x49551c={};var _0x3f2928={'count':0x0,'rows':[]};return db[_0x4f68('0x4e')]['findOne']({'where':{'id':_0x338e65[_0x4f68('0x5f')]['id']}})[_0x4f68('0x2a')](handleEntityNotFound(_0x2677c3,null))['then'](function(_0x57d100){if(_0x57d100){_0x49551c[_0x4f68('0x3d')]=_['keys'](db[_0x4f68('0x6a')][_0x4f68('0x3a')]);_0x49551c[_0x4f68('0x3e')]=_[_0x4f68('0x3f')](_0x338e65[_0x4f68('0x3e')]);_0x49551c[_0x4f68('0x48')]=_[_0x4f68('0x41')](_0x49551c[_0x4f68('0x3d')],_0x49551c[_0x4f68('0x3e')]);_0x4db406['attributes']=_['intersection'](_0x49551c[_0x4f68('0x3d')],qs[_0x4f68('0x42')](_0x338e65[_0x4f68('0x3e')][_0x4f68('0x42')]));_0x4db406[_0x4f68('0x40')]=_0x4db406[_0x4f68('0x40')][_0x4f68('0x43')]?_0x4db406['attributes']:_0x49551c['model'];if(!_0x338e65[_0x4f68('0x3e')][_0x4f68('0x44')](_0x4f68('0x45'))){_0x4db406[_0x4f68('0x22')]=qs['limit'](_0x338e65['query']['limit']);_0x4db406[_0x4f68('0x21')]=qs[_0x4f68('0x21')](_0x338e65[_0x4f68('0x3e')][_0x4f68('0x21')]);}_0x4db406['order']=qs[_0x4f68('0x47')](_0x338e65[_0x4f68('0x3e')][_0x4f68('0x47')]);_0x4db406[_0x4f68('0x4a')]=qs[_0x4f68('0x48')](_['pick'](_0x338e65['query'],_0x49551c[_0x4f68('0x48')]));_0x4db406[_0x4f68('0x4a')][_0x4f68('0x66')]=_0x57d100['id'];if(_0x338e65[_0x4f68('0x3e')][_0x4f68('0x2f')]){_0x4db406[_0x4f68('0x4a')]=_['merge'](_0x4db406[_0x4f68('0x4a')],{'$or':_[_0x4f68('0x39')](_0x4db406[_0x4f68('0x40')],function(_0x4ea9c4){var _0x2693a4={};_0x2693a4[_0x4ea9c4]={'$like':'%'+_0x338e65[_0x4f68('0x3e')][_0x4f68('0x2f')]+'%'};return _0x2693a4;})});}_0x4db406=_[_0x4f68('0x4b')]({},_0x4db406,_0x338e65[_0x4f68('0x4d')]);return db[_0x4f68('0x6a')]['count']({'where':_0x4db406[_0x4f68('0x4a')]})[_0x4f68('0x2a')](function(_0x3168d8){_0x3f2928['count']=_0x3168d8;if(_0x338e65[_0x4f68('0x3e')][_0x4f68('0x55')]){_0x4db406[_0x4f68('0x50')]=[{'all':!![]}];}return db[_0x4f68('0x6a')]['findAll'](_0x4db406);})[_0x4f68('0x2a')](function(_0x174199){_0x3f2928['rows']=_0x174199;return _0x3f2928;});}})['then'](respondWithFilteredResult(_0x2677c3,_0x4db406))[_0x4f68('0x53')](handleError(_0x2677c3,null));};exports[_0x4f68('0x6b')]=function(_0x3e8927,_0x324ca1,_0x3d07c9){var _0x461198={};var _0x5c0d59={};var _0xcc5b0b;var _0x4f4eab;return db[_0x4f68('0x4e')]['findOne']({'where':{'id':_0x3e8927[_0x4f68('0x5f')]['id']}})[_0x4f68('0x2a')](handleEntityNotFound(_0x324ca1,null))[_0x4f68('0x2a')](function(_0x107382){if(_0x107382){_0xcc5b0b=_0x107382;_0x5c0d59[_0x4f68('0x3d')]=_[_0x4f68('0x3f')](db[_0x4f68('0x6c')][_0x4f68('0x3a')]);_0x5c0d59[_0x4f68('0x3e')]=_[_0x4f68('0x3f')](_0x3e8927[_0x4f68('0x3e')]);_0x5c0d59[_0x4f68('0x48')]=_[_0x4f68('0x41')](_0x5c0d59[_0x4f68('0x3d')],_0x5c0d59['query']);_0x461198[_0x4f68('0x40')]=_['intersection'](_0x5c0d59[_0x4f68('0x3d')],qs[_0x4f68('0x42')](_0x3e8927[_0x4f68('0x3e')]['fields']));_0x461198[_0x4f68('0x40')]=_0x461198[_0x4f68('0x40')][_0x4f68('0x43')]?_0x461198[_0x4f68('0x40')]:_0x5c0d59[_0x4f68('0x3d')];_0x461198['order']=qs[_0x4f68('0x47')](_0x3e8927[_0x4f68('0x3e')][_0x4f68('0x47')]);_0x461198[_0x4f68('0x4a')]=qs[_0x4f68('0x48')](_[_0x4f68('0x49')](_0x3e8927[_0x4f68('0x3e')],_0x5c0d59['filters']));if(_0x3e8927['query'][_0x4f68('0x2f')]){_0x461198[_0x4f68('0x4a')]=_[_0x4f68('0x4b')](_0x461198[_0x4f68('0x4a')],{'$or':_[_0x4f68('0x39')](_0x461198[_0x4f68('0x40')],function(_0xca6b17){var _0x506698={};_0x506698[_0xca6b17]={'$like':'%'+_0x3e8927[_0x4f68('0x3e')][_0x4f68('0x2f')]+'%'};return _0x506698;})});}_0x461198=_[_0x4f68('0x4b')]({},_0x461198,_0x3e8927[_0x4f68('0x4d')]);return _0xcc5b0b[_0x4f68('0x6b')](_0x461198);}})[_0x4f68('0x2a')](function(_0x12e0cf){if(_0x12e0cf){_0x4f4eab=_0x12e0cf['length'];if(!_0x3e8927[_0x4f68('0x3e')]['hasOwnProperty']('nolimit')){_0x461198[_0x4f68('0x22')]=qs[_0x4f68('0x22')](_0x3e8927[_0x4f68('0x3e')]['limit']);_0x461198[_0x4f68('0x21')]=qs[_0x4f68('0x21')](_0x3e8927[_0x4f68('0x3e')][_0x4f68('0x21')]);}return _0xcc5b0b[_0x4f68('0x6b')](_0x461198);}})[_0x4f68('0x2a')](function(_0x237575){if(_0x237575){return _0x237575?{'count':_0x4f4eab,'rows':_0x237575}:null;}})[_0x4f68('0x2a')](respondWithResult(_0x324ca1,null))['catch'](handleError(_0x324ca1,null));};exports[_0x4f68('0x6d')]=function(_0x3c8c17,_0x2b3036,_0x29bd08){var _0x5950ed=_0x3c8c17[_0x4f68('0x58')][_0x4f68('0x6e')];var _0x58062a=_[_0x4f68('0x39')](_0x5950ed,'id');return db[_0x4f68('0x6c')][_0x4f68('0x51')]({'where':{'id':_0x58062a},'attributes':['id'],'include':[{'model':db[_0x4f68('0x6f')],'as':_0x4f68('0x70'),'attributes':['id',_0x4f68('0x36'),'online',_0x4f68('0x71'),_0x4f68('0x72')],'raw':!![]}]})[_0x4f68('0x2a')](function(_0x1e9fbd){if(_0x1e9fbd){var _0x11eb4e=_[_0x4f68('0x73')](_0x1e9fbd,function(_0xe4ecb1){var _0x3ff4b1=_0xe4ecb1[_0x4f68('0x5a')]({'plain':!![]});_0x3ff4b1[_0x4f68('0x70')][_0x4f68('0x74')](function(_0x44b915){_0x44b915[_0x4f68('0x75')]=_['find'](_0x5950ed,{'id':_0x3ff4b1['id']})[_0x4f68('0x75')];});return _0x3ff4b1[_0x4f68('0x70')];});return db[_0x4f68('0x4e')][_0x4f68('0x56')]({'where':{'id':_0x3c8c17['params']['id']}})[_0x4f68('0x2a')](function(_0x86bd88){return db['sequelize'][_0x4f68('0x76')](function(_0x41d465){return _0x86bd88[_0x4f68('0x6d')](_0x58062a,{'transaction':_0x41d465})['then'](function(){return BPromise[_0x4f68('0x77')](_0x11eb4e,function(_0x520946){return db['UserVoiceQueue'][_0x4f68('0x78')]({'where':{'UserId':_0x520946['id'],'VoiceQueueId':_0x3c8c17['params']['id']},'defaults':{'penalty':_0x520946[_0x4f68('0x75')]},'transaction':_0x41d465});});})[_0x4f68('0x2a')](function(){return BPromise['each'](_[_0x4f68('0x2f')](_0x11eb4e,{'online':!![]}),function(_0x48eec4){return db[_0x4f68('0x79')][_0x4f68('0x7a')]({'membername':_0x48eec4[_0x4f68('0x36')],'UserId':_0x48eec4['id'],'queue_name':_0x86bd88['name'],'VoiceQueueId':_0x86bd88['id'],'interface':_[_0x4f68('0x7b')](_0x48eec4['interface'])?util[_0x4f68('0x7c')](_0x4f68('0x7d'),_0x48eec4[_0x4f68('0x36')]):_0x48eec4[_0x4f68('0x72')],'paused':_0x48eec4[_0x4f68('0x71')]||![],'penalty':_0x48eec4['penalty']},{'transaction':_0x41d465});});})['then'](function(){_0x11eb4e[_0x4f68('0x74')](function(_0x31cb05){socket[_0x4f68('0x7e')](_0x4f68('0x7f'),{'UserId':_0x31cb05['id'],'VoiceQueueId':_0x86bd88['id']});});});});});}})[_0x4f68('0x2a')](respondWithStatusCode(_0x2b3036,null))[_0x4f68('0x53')](handleError(_0x2b3036,null));};exports[_0x4f68('0x80')]=function(_0x3363b1,_0x8ca77e,_0x577f47){return db[_0x4f68('0x6c')][_0x4f68('0x51')]({'where':{'id':_0x3363b1['query'][_0x4f68('0x81')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4f68('0x70'),'attributes':['id'],'raw':!![]}]})[_0x4f68('0x2a')](handleEntityNotFound(_0x8ca77e,null))['then'](function(_0x4fedf1){var _0x4236bb=_[_0x4f68('0x39')](_0x4fedf1,'id');var _0x18d2b6=[];var _0x4f4ba2=[];var _0x4cedcd=squel[_0x4f68('0x82')]();_0x4cedcd[_0x4f68('0x83')](_0x4f68('0x84'))[_0x4f68('0x85')](_0x4f68('0x86'),'tq')[_0x4f68('0x87')](_0x4f68('0x88'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4f68('0x4a')](_0x4f68('0x89'),_0x3363b1[_0x4f68('0x5f')]['id']);for(var _0x6d5968=0x0;_0x6d5968<_0x4fedf1[_0x4f68('0x43')];_0x6d5968+=0x1){let _0x2cda35=_0x4fedf1[_0x6d5968];for(var _0x31ac20=0x0;_0x31ac20<_0x2cda35['Agents']['length'];_0x31ac20+=0x1){let _0x3bdafe=_0x2cda35[_0x4f68('0x70')][_0x31ac20];var _0x267448=_0x4cedcd[_0x4f68('0x8a')]();_0x267448[_0x4f68('0x4a')]('ut.UserId\x20=\x20?',_0x3bdafe['id']);_0x4f4ba2['push'](db[_0x4f68('0x8b')][_0x4f68('0x3e')](_0x267448['toString'](),{'type':db[_0x4f68('0x8b')][_0x4f68('0x8c')][_0x4f68('0x8d')]})[_0x4f68('0x2a')](function(_0x2264f3){if(_0x2264f3[_0x4f68('0x43')]===0x1){return _0x3bdafe['id'];}else{var _0x33dcc3=_[_0x4f68('0x8e')](_[_0x4f68('0x39')](_0x2264f3,_0x4f68('0x8f')),function(_0x111205){return _['includes'](_0x4236bb,_0x111205);});if(_0x33dcc3){return _0x3bdafe['id'];}}}));}}return BPromise[_0x4f68('0x90')](_0x4f4ba2)[_0x4f68('0x2a')](function(_0x30116e){_0x18d2b6=_(_0x18d2b6)[_0x4f68('0x91')](_0x30116e)['compact']()['value']();return db[_0x4f68('0x4e')]['find']({'where':{'id':_0x3363b1[_0x4f68('0x5f')]['id']}})[_0x4f68('0x2a')](function(_0x4e86b5){return db[_0x4f68('0x8b')]['transaction'](function(_0x57abf8){return _0x4e86b5[_0x4f68('0x80')](_0x3363b1[_0x4f68('0x3e')][_0x4f68('0x81')],{'transaction':_0x57abf8})[_0x4f68('0x2a')](function(){if(!_[_0x4f68('0x92')](_0x18d2b6)){return _0x4e86b5[_0x4f68('0x93')](_0x18d2b6,{'transaction':_0x57abf8})[_0x4f68('0x2a')](function(){return db[_0x4f68('0x79')][_0x4f68('0x29')]({'where':{'VoiceQueueId':_0x3363b1[_0x4f68('0x5f')]['id'],'UserId':_0x18d2b6},'transaction':_0x57abf8});});}})[_0x4f68('0x2a')](function(){_0x18d2b6['forEach'](function(_0x2f4ecc){socket[_0x4f68('0x7e')](_0x4f68('0x94'),{'UserId':_0x2f4ecc,'VoiceQueueId':_0x4e86b5['id']});});});});});});})[_0x4f68('0x2a')](respondWithStatusCode(_0x8ca77e,null))['catch'](handleError(_0x8ca77e,null));};exports[_0x4f68('0x95')]=function(_0x1532c7,_0x394127,_0x2235f0){var _0x565879,_0xcc3989;return db[_0x4f68('0x4e')]['find']({'where':{'id':_0x1532c7[_0x4f68('0x5f')]['id']}})[_0x4f68('0x2a')](handleEntityNotFound(_0x394127,null))[_0x4f68('0x2a')](function(_0x23a00d){if(_0x23a00d){_0xcc3989=_0x23a00d;return _0x23a00d[_0x4f68('0x95')](_0x1532c7['body'][_0x4f68('0x81')],_[_0x4f68('0x60')](_0x1532c7['body'],['ids','id'])||{})[_0x4f68('0x96')](function(_0x2d5074){for(var _0x53587b=0x0;_0x53587b<_0x1532c7[_0x4f68('0x58')][_0x4f68('0x81')]['length'];_0x53587b+=0x1){socket[_0x4f68('0x7e')](_0x4f68('0x7f'),{'UserId':_0x1532c7[_0x4f68('0x58')]['ids'][_0x53587b],'VoiceQueueId':_0x1532c7['params']['id']});}return _0x2d5074;});}})['then'](function(_0x17b77a){_0x565879=_0x17b77a||[];if(_0xcc3989){return db[_0x4f68('0x6f')]['findAll']({'where':{'id':_0x1532c7[_0x4f68('0x58')][_0x4f68('0x81')]},'attributes':['id',_0x4f68('0x36'),_0x4f68('0x97'),_0x4f68('0x71'),_0x4f68('0x72')],'raw':!![]});}})[_0x4f68('0x2a')](function(_0x2d4016){if(!_['isEmpty'](_0x2d4016)){var _0xceb0e9=[];for(var _0x1d511d=0x0;_0x1d511d<_0x2d4016['length'];_0x1d511d++){if(_0x2d4016[_0x1d511d][_0x4f68('0x97')]){_0xceb0e9[_0x4f68('0x98')](db[_0x4f68('0x79')][_0x4f68('0x7a')]({'membername':_0x2d4016[_0x1d511d]['name'],'UserId':_0x2d4016[_0x1d511d]['id'],'queue_name':_0xcc3989[_0x4f68('0x36')],'VoiceQueueId':_0xcc3989['id'],'interface':_['isNil'](_0x2d4016[_0x1d511d][_0x4f68('0x72')])?util['format'](_0x4f68('0x7d'),_0x2d4016[_0x1d511d][_0x4f68('0x36')]):_0x2d4016[_0x1d511d]['interface'],'paused':_0x2d4016[_0x1d511d][_0x4f68('0x71')]||![],'penalty':_0x1532c7[_0x4f68('0x58')][_0x4f68('0x75')]||0x0}));}}return BPromise[_0x4f68('0x90')](_0xceb0e9);}})[_0x4f68('0x2a')](function(){return _0x565879;})[_0x4f68('0x2a')](respondWithResult(_0x394127,null))[_0x4f68('0x53')](handleError(_0x394127,null));};exports[_0x4f68('0x93')]=function(_0x5d2cb6,_0x40d789,_0x528c10){return db[_0x4f68('0x4e')][_0x4f68('0x56')]({'where':{'id':_0x5d2cb6['params']['id']}})[_0x4f68('0x2a')](handleEntityNotFound(_0x40d789,null))[_0x4f68('0x2a')](function(_0x200007){if(_0x200007){return _0x200007[_0x4f68('0x93')](_0x5d2cb6[_0x4f68('0x3e')][_0x4f68('0x81')])['then'](function(){if(_[_0x4f68('0x99')](_0x5d2cb6['query'][_0x4f68('0x81')])){for(var _0x2af79e=0x0;_0x2af79e<_0x5d2cb6[_0x4f68('0x3e')]['ids'][_0x4f68('0x43')];_0x2af79e+=0x1){socket['emit'](_0x4f68('0x94'),{'UserId':Number(_0x5d2cb6['query'][_0x4f68('0x81')][_0x2af79e]),'VoiceQueueId':Number(_0x5d2cb6[_0x4f68('0x5f')]['id'])});}}else{socket[_0x4f68('0x7e')]('userVoiceQueue:remove',{'UserId':Number(_0x5d2cb6[_0x4f68('0x3e')][_0x4f68('0x81')]),'VoiceQueueId':Number(_0x5d2cb6[_0x4f68('0x5f')]['id'])});}});}})['then'](function(_0x298ac8){return db[_0x4f68('0x79')][_0x4f68('0x29')]({'where':{'VoiceQueueId':_0x5d2cb6['params']['id'],'UserId':_0x5d2cb6[_0x4f68('0x3e')][_0x4f68('0x81')]}})[_0x4f68('0x2a')](function(){return _0x298ac8;});})[_0x4f68('0x2a')](respondWithStatusCode(_0x40d789,null))[_0x4f68('0x53')](handleError(_0x40d789,null));};exports['getAgents']=function(_0x125eea,_0x33336b,_0x400554){var _0x25cc69={};var _0x3a22fc={};var _0x19a4e2;var _0x530087;return db['VoiceQueue']['findOne']({'where':{'id':_0x125eea['params']['id']}})[_0x4f68('0x2a')](handleEntityNotFound(_0x33336b,null))['then'](function(_0x46b5a9){if(_0x46b5a9){_0x19a4e2=_0x46b5a9;_0x3a22fc[_0x4f68('0x3d')]=_['keys'](db['User']['rawAttributes']);_0x3a22fc['query']=_[_0x4f68('0x3f')](_0x125eea['query']);_0x3a22fc['filters']=_[_0x4f68('0x41')](_0x3a22fc[_0x4f68('0x3d')],_0x3a22fc[_0x4f68('0x3e')]);_0x25cc69[_0x4f68('0x40')]=_[_0x4f68('0x41')](_0x3a22fc[_0x4f68('0x3d')],qs[_0x4f68('0x42')](_0x125eea[_0x4f68('0x3e')][_0x4f68('0x42')]));_0x25cc69[_0x4f68('0x40')]=_0x25cc69[_0x4f68('0x40')]['length']?_0x25cc69[_0x4f68('0x40')]:_0x3a22fc[_0x4f68('0x3d')];_0x25cc69[_0x4f68('0x46')]=qs[_0x4f68('0x47')](_0x125eea['query']['sort']);_0x25cc69['where']=qs['filters'](_[_0x4f68('0x49')](_0x125eea[_0x4f68('0x3e')],_0x3a22fc['filters']));if(_0x125eea[_0x4f68('0x3e')][_0x4f68('0x2f')]){_0x25cc69[_0x4f68('0x4a')]=_['merge'](_0x25cc69['where'],{'$or':_['map'](_0x25cc69['attributes'],function(_0x3fe2e0){var _0x4c7d84={};_0x4c7d84[_0x3fe2e0]={'$like':'%'+_0x125eea[_0x4f68('0x3e')][_0x4f68('0x2f')]+'%'};return _0x4c7d84;})});}_0x25cc69=_[_0x4f68('0x4b')]({},_0x25cc69,_0x125eea[_0x4f68('0x4d')]);return _0x19a4e2['getAgents'](_0x25cc69);}})['then'](function(_0x1dcf5a){if(_0x1dcf5a){_0x530087=_0x1dcf5a[_0x4f68('0x43')];if(!_0x125eea['query'][_0x4f68('0x44')](_0x4f68('0x45'))){_0x25cc69[_0x4f68('0x22')]=qs[_0x4f68('0x22')](_0x125eea[_0x4f68('0x3e')]['limit']);_0x25cc69[_0x4f68('0x21')]=qs['offset'](_0x125eea[_0x4f68('0x3e')][_0x4f68('0x21')]);}return _0x19a4e2[_0x4f68('0x9a')](_0x25cc69);}})[_0x4f68('0x2a')](function(_0x5d288d){if(_0x5d288d){return _0x5d288d?{'count':_0x530087,'rows':_0x5d288d}:null;}})[_0x4f68('0x2a')](respondWithResult(_0x33336b,null))[_0x4f68('0x53')](handleError(_0x33336b,null));};exports['getMembers']=function(_0x51c1a7,_0xc994a9,_0x330f12){var _0xd0ddd5={};var _0x9013fc={};var _0x1b09a6;var _0x25e1b7;return db[_0x4f68('0x4e')][_0x4f68('0x64')]({'where':{'id':_0x51c1a7[_0x4f68('0x5f')]['id']}})[_0x4f68('0x2a')](handleEntityNotFound(_0xc994a9,null))[_0x4f68('0x2a')](function(_0x3d7bc4){if(_0x3d7bc4){_0x1b09a6=_0x3d7bc4;_0x9013fc[_0x4f68('0x3d')]=_['keys'](db[_0x4f68('0x79')][_0x4f68('0x3a')]);_0x9013fc[_0x4f68('0x3e')]=_[_0x4f68('0x3f')](_0x51c1a7[_0x4f68('0x3e')]);_0x9013fc[_0x4f68('0x48')]=_['intersection'](_0x9013fc[_0x4f68('0x3d')],_0x9013fc[_0x4f68('0x3e')]);_0xd0ddd5['attributes']=_[_0x4f68('0x41')](_0x9013fc[_0x4f68('0x3d')],qs[_0x4f68('0x42')](_0x51c1a7[_0x4f68('0x3e')]['fields']));_0xd0ddd5[_0x4f68('0x40')]=_0xd0ddd5[_0x4f68('0x40')][_0x4f68('0x43')]?_0xd0ddd5[_0x4f68('0x40')]:_0x9013fc[_0x4f68('0x3d')];_0xd0ddd5[_0x4f68('0x46')]=qs[_0x4f68('0x47')](_0x51c1a7[_0x4f68('0x3e')][_0x4f68('0x47')]);_0xd0ddd5['where']=qs[_0x4f68('0x48')](_['pick'](_0x51c1a7['query'],_0x9013fc[_0x4f68('0x48')]));if(_0x51c1a7['query'][_0x4f68('0x2f')]){_0xd0ddd5[_0x4f68('0x4a')]=_[_0x4f68('0x4b')](_0xd0ddd5[_0x4f68('0x4a')],{'$or':_[_0x4f68('0x39')](_0xd0ddd5[_0x4f68('0x40')],function(_0x4e3815){var _0x5cfebd={};_0x5cfebd[_0x4e3815]={'$like':'%'+_0x51c1a7[_0x4f68('0x3e')][_0x4f68('0x2f')]+'%'};return _0x5cfebd;})});}_0xd0ddd5=_[_0x4f68('0x4b')]({},_0xd0ddd5,_0x51c1a7[_0x4f68('0x4d')]);return _0x1b09a6[_0x4f68('0x9b')](_0xd0ddd5);}})[_0x4f68('0x2a')](function(_0x35b015){if(_0x35b015){_0x25e1b7=_0x35b015[_0x4f68('0x43')];if(!_0x51c1a7[_0x4f68('0x3e')][_0x4f68('0x44')](_0x4f68('0x45'))){_0xd0ddd5[_0x4f68('0x22')]=qs[_0x4f68('0x22')](_0x51c1a7['query']['limit']);_0xd0ddd5[_0x4f68('0x21')]=qs['offset'](_0x51c1a7[_0x4f68('0x3e')][_0x4f68('0x21')]);}return _0x1b09a6['getMembers'](_0xd0ddd5);}})[_0x4f68('0x2a')](function(_0x4380b9){return _0x4380b9?{'count':_0x25e1b7,'rows':_0x4380b9}:null;})[_0x4f68('0x2a')](respondWithResult(_0xc994a9,null))[_0x4f68('0x53')](handleError(_0xc994a9,null));};exports[_0x4f68('0x9c')]=function(_0x369b0c,_0x5ef45b,_0x3fd2b4){var _0x5a3ef7={};var _0x6fdb18={};var _0x5b5550;var _0x206ea2;return db[_0x4f68('0x4e')][_0x4f68('0x64')]({'where':{'id':_0x369b0c[_0x4f68('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5ef45b,null))[_0x4f68('0x2a')](function(_0x18ff3a){if(_0x18ff3a){_0x5b5550=_0x18ff3a;_0x6fdb18[_0x4f68('0x3d')]=_['keys'](db[_0x4f68('0x9d')]['rawAttributes']);_0x6fdb18[_0x4f68('0x3e')]=_[_0x4f68('0x3f')](_0x369b0c[_0x4f68('0x3e')]);_0x6fdb18[_0x4f68('0x48')]=_[_0x4f68('0x41')](_0x6fdb18[_0x4f68('0x3d')],_0x6fdb18[_0x4f68('0x3e')]);_0x5a3ef7[_0x4f68('0x40')]=_[_0x4f68('0x41')](_0x6fdb18[_0x4f68('0x3d')],qs[_0x4f68('0x42')](_0x369b0c[_0x4f68('0x3e')][_0x4f68('0x42')]));_0x5a3ef7[_0x4f68('0x40')]=_0x5a3ef7[_0x4f68('0x40')][_0x4f68('0x43')]?_0x5a3ef7[_0x4f68('0x40')]:_0x6fdb18[_0x4f68('0x3d')];_0x5a3ef7[_0x4f68('0x46')]=qs[_0x4f68('0x47')](_0x369b0c[_0x4f68('0x3e')]['sort']);_0x5a3ef7[_0x4f68('0x4a')]=qs[_0x4f68('0x48')](_[_0x4f68('0x49')](_0x369b0c['query'],_0x6fdb18[_0x4f68('0x48')]));if(_0x369b0c[_0x4f68('0x3e')][_0x4f68('0x2f')]){_0x5a3ef7[_0x4f68('0x4a')]=_['merge'](_0x5a3ef7[_0x4f68('0x4a')],{'$or':_[_0x4f68('0x39')](_0x5a3ef7['attributes'],function(_0x461503){var _0x407f56={};_0x407f56[_0x461503]={'$like':'%'+_0x369b0c[_0x4f68('0x3e')][_0x4f68('0x2f')]+'%'};return _0x407f56;})});}_0x5a3ef7=_[_0x4f68('0x4b')]({},_0x5a3ef7,_0x369b0c[_0x4f68('0x4d')]);return _0x5b5550[_0x4f68('0x9c')](_0x5a3ef7);}})['then'](function(_0x31a107){if(_0x31a107){_0x206ea2=_0x31a107['length'];if(!_0x369b0c['query'][_0x4f68('0x44')](_0x4f68('0x45'))){_0x5a3ef7[_0x4f68('0x22')]=qs[_0x4f68('0x22')](_0x369b0c[_0x4f68('0x3e')][_0x4f68('0x22')]);_0x5a3ef7['offset']=qs['offset'](_0x369b0c[_0x4f68('0x3e')][_0x4f68('0x21')]);}return _0x5b5550[_0x4f68('0x9c')](_0x5a3ef7);}})[_0x4f68('0x2a')](function(_0x47ebdf){if(_0x47ebdf){return _0x47ebdf?{'count':_0x206ea2,'rows':_0x47ebdf}:null;}})[_0x4f68('0x2a')](respondWithResult(_0x5ef45b,null))[_0x4f68('0x53')](handleError(_0x5ef45b,null));};exports['addLists']=function(_0x37578e,_0x27c521,_0x3a2417){var _0x489b3b,_0x2752fe;return db[_0x4f68('0x4e')][_0x4f68('0x56')]({'where':{'id':_0x37578e[_0x4f68('0x5f')]['id']}})[_0x4f68('0x2a')](handleEntityNotFound(_0x27c521,null))[_0x4f68('0x2a')](function(_0xb7bfb1){if(_0xb7bfb1){_0x2752fe=_0xb7bfb1;return _0xb7bfb1[_0x4f68('0x9e')](_0x37578e[_0x4f68('0x58')][_0x4f68('0x81')],_[_0x4f68('0x60')](_0x37578e[_0x4f68('0x58')],['ids','id'])||{});}return null;})[_0x4f68('0x96')](function(_0x19cdce){var _0x4c5f25;_0x489b3b=_0x19cdce||[];var _0xfe8f52=[];if(_0x19cdce){for(var _0x2d4d89=0x0;_0x2d4d89<_0x19cdce[_0x4f68('0x43')];_0x2d4d89+=0x1){var _0x5c088f=_0x19cdce[_0x2d4d89][_0x4f68('0x5a')]({'plain':!![]});_0x2752fe[_0x4f68('0x9f')]=_0x37578e[_0x4f68('0x58')]['dialCheckDuplicateType']?_0x37578e[_0x4f68('0x58')]['dialCheckDuplicateType']:_0x2752fe[_0x4f68('0x9f')];switch(_0x2752fe[_0x4f68('0x9f')]){case'always':_0x4c5f25=squel[_0x4f68('0xa0')]()[_0x4f68('0xa1')](_0x4f68('0xa2'))[_0x4f68('0xa3')]([_0x4f68('0xa4'),_0x4f68('0xa5'),_0x4f68('0xa6'),'ListId',_0x4f68('0x66'),'createdAt',_0x4f68('0x62')],squel['select']()['field'](_0x4f68('0xa4'),_0x4f68('0xa4'))['field'](_0x4f68('0xa7'),_0x4f68('0xa5'))[_0x4f68('0x83')]('id',_0x4f68('0xa6'))['field'](_0x5c088f[_0x4f68('0xa8')]['toString'](),_0x4f68('0xa9'))[_0x4f68('0x83')](_0x37578e[_0x4f68('0x5f')]['id'][_0x4f68('0xaa')](),_0x4f68('0x66'))[_0x4f68('0x83')](_0x4f68('0xa7'),_0x4f68('0x61'))[_0x4f68('0x83')](_0x4f68('0xa7'),_0x4f68('0x62'))[_0x4f68('0x85')](_0x4f68('0xab'))[_0x4f68('0x4a')](_0x4f68('0xac'))[_0x4f68('0x4a')](_0x4f68('0xad'),_0x5c088f[_0x4f68('0xa8')][_0x4f68('0xaa')]())[_0x4f68('0x4a')](_0x4f68('0xae'))['where'](_0x4f68('0xaf'),squel[_0x4f68('0x82')]()[_0x4f68('0x83')](_0x4f68('0xb0'))['from'](_0x4f68('0xb1'))[_0x4f68('0x4a')]('VoiceQueueId\x20=\x20?',_0x37578e['params']['id'][_0x4f68('0xaa')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x4f68('0x82')]()[_0x4f68('0x83')](_0x4f68('0xb2'))['from']('cm_hopper')[_0x4f68('0x4a')](_0x4f68('0x89'),_0x37578e[_0x4f68('0x5f')]['id'][_0x4f68('0xaa')]())))[_0x4f68('0xaa')]();break;case _0x4f68('0xb3'):_0x4c5f25=squel['insert']()[_0x4f68('0xa1')](_0x4f68('0xa2'))[_0x4f68('0xa3')]([_0x4f68('0xa4'),'scheduledAt','ContactId',_0x4f68('0xa9'),_0x4f68('0x66'),_0x4f68('0x61'),'updatedAt'],squel[_0x4f68('0x82')]()[_0x4f68('0x83')](_0x4f68('0xa4'),_0x4f68('0xa4'))[_0x4f68('0x83')](_0x4f68('0xa7'),_0x4f68('0xa5'))['field']('id','ContactId')[_0x4f68('0x83')](_0x5c088f[_0x4f68('0xa8')][_0x4f68('0xaa')](),_0x4f68('0xa9'))['field'](_0x37578e[_0x4f68('0x5f')]['id'][_0x4f68('0xaa')](),_0x4f68('0x66'))[_0x4f68('0x83')]('NOW()',_0x4f68('0x61'))[_0x4f68('0x83')](_0x4f68('0xa7'),_0x4f68('0x62'))['from'](_0x4f68('0xab'))['where'](_0x4f68('0xac'))[_0x4f68('0x4a')](_0x4f68('0xad'),_0x5c088f[_0x4f68('0xa8')]['toString']())[_0x4f68('0x4a')](_0x4f68('0xae'))['where'](_0x4f68('0xaf'),squel[_0x4f68('0x82')]()[_0x4f68('0x83')]('COALESCE(phone,\x27\x27)')[_0x4f68('0x85')](_0x4f68('0xa2'))[_0x4f68('0x4a')]('VoiceQueueId\x20=\x20?',_0x37578e[_0x4f68('0x5f')]['id'][_0x4f68('0xaa')]())))[_0x4f68('0xaa')]();break;default:_0x4c5f25=squel['insert']()[_0x4f68('0xa1')](_0x4f68('0xa2'))['fromQuery']([_0x4f68('0xa4'),_0x4f68('0xa5'),_0x4f68('0xa6'),_0x4f68('0xa9'),'VoiceQueueId','createdAt',_0x4f68('0x62')],squel[_0x4f68('0x82')]()[_0x4f68('0x83')]('phone',_0x4f68('0xa4'))[_0x4f68('0x83')](_0x4f68('0xa7'),_0x4f68('0xa5'))[_0x4f68('0x83')]('id',_0x4f68('0xa6'))[_0x4f68('0x83')](_0x5c088f[_0x4f68('0xa8')]['toString'](),_0x4f68('0xa9'))[_0x4f68('0x83')](_0x37578e['params']['id']['toString'](),_0x4f68('0x66'))[_0x4f68('0x83')](_0x4f68('0xa7'),_0x4f68('0x61'))[_0x4f68('0x83')]('NOW()',_0x4f68('0x62'))[_0x4f68('0x85')](_0x4f68('0xab'))[_0x4f68('0x4a')](_0x4f68('0xac'))[_0x4f68('0x4a')]('ListId\x20=\x20?',_0x5c088f[_0x4f68('0xa8')][_0x4f68('0xaa')]())[_0x4f68('0x4a')](_0x4f68('0xae')))[_0x4f68('0xaa')]();}_0xfe8f52['push'](db[_0x4f68('0x8b')][_0x4f68('0x3e')](_0x4c5f25));}return BPromise[_0x4f68('0x90')](_0xfe8f52);}})[_0x4f68('0x2a')](function(){return _0x489b3b;})[_0x4f68('0x2a')](respondWithResult(_0x27c521,null))['catch'](handleError(_0x27c521,null));};exports['removeLists']=function(_0x5dd06d,_0x19fd0c,_0x11b74a){return db['VoiceQueue'][_0x4f68('0x56')]({'where':{'id':_0x5dd06d[_0x4f68('0x5f')]['id']}})['then'](handleEntityNotFound(_0x19fd0c,null))[_0x4f68('0x2a')](function(_0x427ac1){if(_0x427ac1){return _0x427ac1[_0x4f68('0xb4')](_0x5dd06d[_0x4f68('0x3e')][_0x4f68('0x81')]);}})[_0x4f68('0x2a')](function(_0x195f7d){if(_0x195f7d){return db[_0x4f68('0x65')][_0x4f68('0x29')]({'where':{'ListId':_0x5dd06d[_0x4f68('0x3e')][_0x4f68('0x81')],'VoiceQueueId':_0x5dd06d[_0x4f68('0x5f')]['id']}})[_0x4f68('0x2a')](function(){return _0x195f7d;});}})[_0x4f68('0x2a')](respondWithStatusCode(_0x19fd0c,null))['catch'](handleError(_0x19fd0c,null));};exports[_0x4f68('0xb5')]=function(_0x4a43b2,_0x1eb1ee,_0x4b6ca6){var _0x5a185d={};var _0x3bcc58={};var _0x15ac3a;var _0x2cb126;return db[_0x4f68('0x4e')][_0x4f68('0x64')]({'where':{'id':_0x4a43b2[_0x4f68('0x5f')]['id']}})[_0x4f68('0x2a')](handleEntityNotFound(_0x1eb1ee,null))[_0x4f68('0x2a')](function(_0x54aceb){if(_0x54aceb){_0x15ac3a=_0x54aceb;_0x3bcc58['model']=_[_0x4f68('0x3f')](db[_0x4f68('0x9d')][_0x4f68('0x3a')]);_0x3bcc58[_0x4f68('0x3e')]=_[_0x4f68('0x3f')](_0x4a43b2[_0x4f68('0x3e')]);_0x3bcc58[_0x4f68('0x48')]=_[_0x4f68('0x41')](_0x3bcc58[_0x4f68('0x3d')],_0x3bcc58[_0x4f68('0x3e')]);_0x5a185d[_0x4f68('0x40')]=_[_0x4f68('0x41')](_0x3bcc58[_0x4f68('0x3d')],qs[_0x4f68('0x42')](_0x4a43b2[_0x4f68('0x3e')][_0x4f68('0x42')]));_0x5a185d[_0x4f68('0x40')]=_0x5a185d[_0x4f68('0x40')][_0x4f68('0x43')]?_0x5a185d[_0x4f68('0x40')]:_0x3bcc58[_0x4f68('0x3d')];_0x5a185d[_0x4f68('0x46')]=qs[_0x4f68('0x47')](_0x4a43b2[_0x4f68('0x3e')][_0x4f68('0x47')]);_0x5a185d[_0x4f68('0x4a')]=qs[_0x4f68('0x48')](_[_0x4f68('0x49')](_0x4a43b2[_0x4f68('0x3e')],_0x3bcc58[_0x4f68('0x48')]));if(_0x4a43b2[_0x4f68('0x3e')][_0x4f68('0x2f')]){_0x5a185d[_0x4f68('0x4a')]=_[_0x4f68('0x4b')](_0x5a185d[_0x4f68('0x4a')],{'$or':_[_0x4f68('0x39')](_0x5a185d[_0x4f68('0x40')],function(_0x298bcd){var _0x4c67c0={};_0x4c67c0[_0x298bcd]={'$like':'%'+_0x4a43b2[_0x4f68('0x3e')][_0x4f68('0x2f')]+'%'};return _0x4c67c0;})});}_0x5a185d=_[_0x4f68('0x4b')]({},_0x5a185d,_0x4a43b2[_0x4f68('0x4d')]);return _0x15ac3a[_0x4f68('0xb5')](_0x5a185d);}})[_0x4f68('0x2a')](function(_0xfc4664){if(_0xfc4664){_0x2cb126=_0xfc4664['length'];if(!_0x4a43b2['query'][_0x4f68('0x44')](_0x4f68('0x45'))){_0x5a185d[_0x4f68('0x22')]=qs['limit'](_0x4a43b2[_0x4f68('0x3e')][_0x4f68('0x22')]);_0x5a185d['offset']=qs['offset'](_0x4a43b2[_0x4f68('0x3e')][_0x4f68('0x21')]);}return _0x15ac3a['getBlackLists'](_0x5a185d);}})[_0x4f68('0x2a')](function(_0x594551){if(_0x594551){return _0x594551?{'count':_0x2cb126,'rows':_0x594551}:null;}})[_0x4f68('0x2a')](respondWithResult(_0x1eb1ee,null))[_0x4f68('0x53')](handleError(_0x1eb1ee,null));};exports[_0x4f68('0xb6')]=function(_0x5537e7,_0x146db6,_0x2fc767){var _0xd1e3e7,_0x1e60cf;return db[_0x4f68('0x4e')][_0x4f68('0x56')]({'where':{'id':_0x5537e7[_0x4f68('0x5f')]['id']}})[_0x4f68('0x2a')](handleEntityNotFound(_0x146db6,null))[_0x4f68('0x2a')](function(_0x2259af){if(_0x2259af){_0x1e60cf=_0x2259af;return _0x2259af[_0x4f68('0xb6')](_0x5537e7[_0x4f68('0x58')]['ids'],_[_0x4f68('0x60')](_0x5537e7['body'],[_0x4f68('0x81'),'id'])||{});}return null;})[_0x4f68('0x96')](function(_0x3553cf){var _0x3a318d;_0xd1e3e7=_0x3553cf||[];var _0x44bfbb=[];if(_0x3553cf){for(var _0x3802d3=0x0;_0x3802d3<_0x3553cf[_0x4f68('0x43')];_0x3802d3+=0x1){var _0x442ff4=_0x3553cf[_0x3802d3]['get']({'plain':!![]});_0x3a318d=squel[_0x4f68('0xa0')]()[_0x4f68('0xa1')](_0x4f68('0xb7'))[_0x4f68('0xa3')]([_0x4f68('0xa4'),'ContactId',_0x4f68('0xa9'),_0x4f68('0x66'),'createdAt',_0x4f68('0x62')],squel[_0x4f68('0x82')]()['field'](_0x4f68('0xa4'),_0x4f68('0xa4'))[_0x4f68('0x83')]('id',_0x4f68('0xa6'))['field'](_0x442ff4['CmListId'][_0x4f68('0xaa')](),_0x4f68('0xa9'))[_0x4f68('0x83')](_0x5537e7['params']['id'][_0x4f68('0xaa')](),'VoiceQueueId')[_0x4f68('0x83')](_0x4f68('0xa7'),_0x4f68('0x61'))[_0x4f68('0x83')](_0x4f68('0xa7'),'updatedAt')['from'](_0x4f68('0xab'))[_0x4f68('0x4a')](_0x4f68('0xac'))[_0x4f68('0x4a')]('ListId\x20=\x20?',_0x442ff4['CmListId'][_0x4f68('0xaa')]())[_0x4f68('0x4a')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x44bfbb['push'](db[_0x4f68('0x8b')][_0x4f68('0x3e')](_0x3a318d));}return BPromise[_0x4f68('0x90')](_0x44bfbb);}})[_0x4f68('0x2a')](function(){return _0xd1e3e7;})[_0x4f68('0x2a')](respondWithResult(_0x146db6,null))[_0x4f68('0x53')](handleError(_0x146db6,null));};exports[_0x4f68('0xb8')]=function(_0x276a03,_0xb6a06a,_0x5316b1){return db[_0x4f68('0x4e')][_0x4f68('0x56')]({'where':{'id':_0x276a03[_0x4f68('0x5f')]['id']}})[_0x4f68('0x2a')](handleEntityNotFound(_0xb6a06a,null))[_0x4f68('0x2a')](function(_0x5838e8){if(_0x5838e8){return _0x5838e8[_0x4f68('0xb8')](_0x276a03[_0x4f68('0x3e')]['ids']);}})[_0x4f68('0x2a')](function(_0x2ad0f9){if(_0x2ad0f9){return db[_0x4f68('0x6a')]['destroy']({'where':{'ListId':_0x276a03[_0x4f68('0x3e')][_0x4f68('0x81')],'VoiceQueueId':_0x276a03['params']['id']}})[_0x4f68('0x2a')](function(){return _0x2ad0f9;});}})[_0x4f68('0x2a')](respondWithStatusCode(_0xb6a06a,null))[_0x4f68('0x53')](handleError(_0xb6a06a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 790f1ca..f9dfdd6 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 _0x6d6c=['save','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x19c047,_0x4eaad9){var _0x5b3a25=function(_0x165158){while(--_0x165158){_0x19c047['push'](_0x19c047['shift']());}};_0x5b3a25(++_0x4eaad9);}(_0x6d6c,0xa5));var _0xc6d6=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0x6d6c[_0x31b5a5];return _0x364cc9;};'use strict';var EventEmitter=require(_0xc6d6('0x0'));var VoiceQueue=require(_0xc6d6('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xc6d6('0x2')](0x0);var events={'afterCreate':_0xc6d6('0x3'),'afterUpdate':'update','afterDestroy':_0xc6d6('0x4')};function emitEvent(_0x585ceb){return function(_0x53d5f2,_0x3a02e4,_0x30ac79){VoiceQueueEvents[_0xc6d6('0x5')](_0x585ceb+':'+_0x53d5f2['id'],_0x53d5f2);VoiceQueueEvents[_0xc6d6('0x5')](_0x585ceb,_0x53d5f2);_0x30ac79(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xc6d6('0x6')](e,emitEvent(event));}}module[_0xc6d6('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x7feb=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7feb,0x16f));var _0xb7fe=function(_0x154473,_0x2ea95e){_0x154473=_0x154473-0x0;var _0x24cee4=_0x7feb[_0x154473];return _0x24cee4;};'use strict';var EventEmitter=require(_0xb7fe('0x0'));var VoiceQueue=require(_0xb7fe('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xb7fe('0x2')](0x0);var events={'afterCreate':_0xb7fe('0x3'),'afterUpdate':_0xb7fe('0x4'),'afterDestroy':_0xb7fe('0x5')};function emitEvent(_0x532e8d){return function(_0x93f632,_0x1d322c,_0x71251f){VoiceQueueEvents['emit'](_0x532e8d+':'+_0x93f632['id'],_0x93f632);VoiceQueueEvents[_0xb7fe('0x6')](_0x532e8d,_0x93f632);_0x71251f(null);};}for(var e in events){if(events[_0xb7fe('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index e7fa4e6..1a70dc0 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 _0x8a0e=['./voiceQueue.attributes','define','VoiceQueue','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x354a87,_0x248b8a){var _0x37c23a=function(_0x3e4fc0){while(--_0x3e4fc0){_0x354a87['push'](_0x354a87['shift']());}};_0x37c23a(++_0x248b8a);}(_0x8a0e,0xfd));var _0xe8a0=function(_0x270c56,_0x43be30){_0x270c56=_0x270c56-0x0;var _0x3b47ee=_0x8a0e[_0x270c56];return _0x3b47ee;};'use strict';var _=require(_0xe8a0('0x0'));var util=require('util');var logger=require(_0xe8a0('0x1'))('api');var moment=require(_0xe8a0('0x2'));var BPromise=require(_0xe8a0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8a0('0x4'));var rimraf=require(_0xe8a0('0x5'));var config=require(_0xe8a0('0x6'));var attributes=require(_0xe8a0('0x7'));module['exports']=function(_0x3cc156,_0x3b2fa9){return _0x3cc156[_0xe8a0('0x8')](_0xe8a0('0x9'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf122=['exports','VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5be30d,_0x1947a9){var _0x446176=function(_0x292563){while(--_0x292563){_0x5be30d['push'](_0x5be30d['shift']());}};_0x446176(++_0x1947a9);}(_0xf122,0xc6));var _0x2f12=function(_0x3f449d,_0x1c460c){_0x3f449d=_0x3f449d-0x0;var _0x2aacab=_0xf122[_0x3f449d];return _0x2aacab;};'use strict';var _=require(_0x2f12('0x0'));var util=require(_0x2f12('0x1'));var logger=require(_0x2f12('0x2'))(_0x2f12('0x3'));var moment=require(_0x2f12('0x4'));var BPromise=require(_0x2f12('0x5'));var rp=require(_0x2f12('0x6'));var fs=require('fs');var path=require(_0x2f12('0x7'));var rimraf=require(_0x2f12('0x8'));var config=require(_0x2f12('0x9'));var attributes=require('./voiceQueue.attributes');module[_0x2f12('0xa')]=function(_0x105a25,_0x5ebd53){return _0x105a25['define'](_0x2f12('0xb'),attributes,{'tableName':_0x2f12('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 1990b30..b6cc8a9 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 _0x69a4=['find','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceQueue','findAll','raw','options','where','limit','map','include','model','attributes','GetVoiceQueue','ShowVoiceQueue'];(function(_0x45be7a,_0x150ca7){var _0x4a9234=function(_0x59f220){while(--_0x59f220){_0x45be7a['push'](_0x45be7a['shift']());}};_0x4a9234(++_0x150ca7);}(_0x69a4,0x76));var _0x469a=function(_0x3be169,_0x2f4727){_0x3be169=_0x3be169-0x0;var _0x4849d8=_0x69a4[_0x3be169];return _0x4849d8;};'use strict';var _=require('lodash');var util=require(_0x469a('0x0'));var moment=require(_0x469a('0x1'));var BPromise=require('bluebird');var rs=require(_0x469a('0x2'));var fs=require('fs');var Redis=require(_0x469a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x469a('0x4'))(_0x469a('0x5'));var config=require('../../config/environment');var jayson=require(_0x469a('0x6'));var client=jayson[_0x469a('0x7')][_0x469a('0x8')]({'port':0x232a});config[_0x469a('0x9')]=_[_0x469a('0xa')](config[_0x469a('0x9')],{'host':_0x469a('0xb'),'port':0x18eb});var socket=require(_0x469a('0xc'))(new Redis(config[_0x469a('0x9')]));require('./voiceQueue.socket')[_0x469a('0xd')](socket);function respondWithRpcPromise(_0x1a26a3,_0x4de19f,_0x49d74a){return new BPromise(function(_0xd3fcce,_0x8aa78){return client[_0x469a('0xe')](_0x1a26a3,_0x49d74a)[_0x469a('0xf')](function(_0xc3dc5e){logger[_0x469a('0x10')](_0x469a('0x11'),_0x4de19f,_0x469a('0x12'));logger[_0x469a('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x4de19f,'request\x20sent',JSON[_0x469a('0x14')](_0xc3dc5e));if(_0xc3dc5e[_0x469a('0x15')]){if(_0xc3dc5e[_0x469a('0x15')][_0x469a('0x16')]===0x1f4){logger[_0x469a('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x4de19f,_0xc3dc5e['error'][_0x469a('0x17')]);return _0x8aa78(_0xc3dc5e[_0x469a('0x15')][_0x469a('0x17')]);}logger[_0x469a('0x15')](_0x469a('0x11'),_0x4de19f,_0xc3dc5e['error'][_0x469a('0x17')]);return _0xd3fcce(_0xc3dc5e['error'][_0x469a('0x17')]);}else{logger[_0x469a('0x10')](_0x469a('0x11'),_0x4de19f,_0x469a('0x12'));_0xd3fcce(_0xc3dc5e[_0x469a('0x18')]['message']);}})[_0x469a('0x19')](function(_0x440040){logger[_0x469a('0x15')](_0x469a('0x11'),_0x4de19f,_0x440040);_0x8aa78(_0x440040);});});}exports['GetVoiceQueue']=function(_0x524a77){var _0x126c5=this;return new Promise(function(_0x4ab05a,_0x5f122a){return db[_0x469a('0x1a')][_0x469a('0x1b')]({'raw':_0x524a77['options']?_0x524a77['options'][_0x469a('0x1c')]===undefined?!![]:![]:!![],'where':_0x524a77[_0x469a('0x1d')]?_0x524a77[_0x469a('0x1d')][_0x469a('0x1e')]||null:null,'attributes':_0x524a77['options']?_0x524a77[_0x469a('0x1d')]['attributes']||null:null,'limit':_0x524a77['options']?_0x524a77[_0x469a('0x1d')][_0x469a('0x1f')]||null:null,'include':_0x524a77[_0x469a('0x1d')]?_0x524a77[_0x469a('0x1d')]['include']?_[_0x469a('0x20')](_0x524a77[_0x469a('0x1d')][_0x469a('0x21')],function(_0x40555c){return{'model':db[_0x40555c[_0x469a('0x22')]],'as':_0x40555c['as'],'attributes':_0x40555c[_0x469a('0x23')],'include':_0x40555c['include']?_[_0x469a('0x20')](_0x40555c['include'],function(_0x103497){return{'model':db[_0x103497[_0x469a('0x22')]],'as':_0x103497['as'],'attributes':_0x103497[_0x469a('0x23')],'include':_0x103497[_0x469a('0x21')]?_[_0x469a('0x20')](_0x103497[_0x469a('0x21')],function(_0x4de8b0){return{'model':db[_0x4de8b0[_0x469a('0x22')]],'as':_0x4de8b0['as'],'attributes':_0x4de8b0[_0x469a('0x23')]};}):[]};}):[]};}):[]:[]})[_0x469a('0xf')](function(_0x414fca){logger[_0x469a('0x10')]('GetVoiceQueue',_0x524a77);logger[_0x469a('0x13')](_0x469a('0x24'),_0x524a77,JSON[_0x469a('0x14')](_0x414fca));_0x4ab05a(_0x414fca);})[_0x469a('0x19')](function(_0xdf9336){logger['error'](_0x469a('0x24'),_0xdf9336['message'],_0x524a77);_0x5f122a(_0x126c5[_0x469a('0x15')](0x1f4,_0xdf9336[_0x469a('0x17')]));});});};exports[_0x469a('0x25')]=function(_0x4deb07){var _0x557240=this;return new Promise(function(_0x1ed10b,_0x38154a){return db[_0x469a('0x1a')][_0x469a('0x26')]({'raw':_0x4deb07[_0x469a('0x1d')]?_0x4deb07[_0x469a('0x1d')][_0x469a('0x1c')]===undefined?!![]:![]:!![],'where':_0x4deb07[_0x469a('0x1d')]?_0x4deb07['options'][_0x469a('0x1e')]||null:null,'attributes':_0x4deb07[_0x469a('0x1d')]?_0x4deb07['options'][_0x469a('0x23')]||null:null,'include':_0x4deb07['options']?_0x4deb07['options'][_0x469a('0x21')]?_[_0x469a('0x20')](_0x4deb07[_0x469a('0x1d')][_0x469a('0x21')],function(_0x3f9a9a){return{'model':db[_0x3f9a9a[_0x469a('0x22')]],'as':_0x3f9a9a['as'],'attributes':_0x3f9a9a[_0x469a('0x23')],'include':_0x3f9a9a['include']?_[_0x469a('0x20')](_0x3f9a9a['include'],function(_0x21a3d2){return{'model':db[_0x21a3d2[_0x469a('0x22')]],'as':_0x21a3d2['as'],'attributes':_0x21a3d2[_0x469a('0x23')],'include':_0x21a3d2[_0x469a('0x21')]?_[_0x469a('0x20')](_0x21a3d2['include'],function(_0x22b43d){return{'model':db[_0x22b43d[_0x469a('0x22')]],'as':_0x22b43d['as'],'attributes':_0x22b43d[_0x469a('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x233eb2){logger['info'](_0x469a('0x25'),_0x4deb07);logger[_0x469a('0x13')](_0x469a('0x25'),_0x4deb07,JSON['stringify'](_0x233eb2));_0x1ed10b(_0x233eb2);})['catch'](function(_0x35bbe6){logger['error'](_0x469a('0x25'),_0x35bbe6[_0x469a('0x17')],_0x4deb07);_0x38154a(_0x557240[_0x469a('0x15')](0x1f4,_0x35bbe6[_0x469a('0x17')]));});});}; \ No newline at end of file +var _0xaf03=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voiceQueue.socket','register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','include','map','model','attributes','stringify','catch','ShowVoiceQueue'];(function(_0x12d8c7,_0xe7f3df){var _0x17e75c=function(_0x2bf1c7){while(--_0x2bf1c7){_0x12d8c7['push'](_0x12d8c7['shift']());}};_0x17e75c(++_0xe7f3df);}(_0xaf03,0x109));var _0x3af0=function(_0x448f4a,_0xd40401){_0x448f4a=_0x448f4a-0x0;var _0x2fed4d=_0xaf03[_0x448f4a];return _0x2fed4d;};'use strict';var _=require(_0x3af0('0x0'));var util=require(_0x3af0('0x1'));var moment=require(_0x3af0('0x2'));var BPromise=require(_0x3af0('0x3'));var rs=require(_0x3af0('0x4'));var fs=require('fs');var Redis=require(_0x3af0('0x5'));var db=require(_0x3af0('0x6'))['db'];var utils=require(_0x3af0('0x7'));var logger=require(_0x3af0('0x8'))(_0x3af0('0x9'));var config=require(_0x3af0('0xa'));var jayson=require(_0x3af0('0xb'));var client=jayson[_0x3af0('0xc')][_0x3af0('0xd')]({'port':0x232a});config['redis']=_[_0x3af0('0xe')](config[_0x3af0('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x3af0('0x10'))(new Redis(config[_0x3af0('0xf')]));require(_0x3af0('0x11'))[_0x3af0('0x12')](socket);function respondWithRpcPromise(_0x3b6260,_0x44ab40,_0x3923c0){return new BPromise(function(_0x3bbd75,_0x59ee4e){return client['request'](_0x3b6260,_0x3923c0)[_0x3af0('0x13')](function(_0x495273){logger['info'](_0x3af0('0x14'),_0x44ab40,_0x3af0('0x15'));logger[_0x3af0('0x16')](_0x3af0('0x17'),_0x44ab40,_0x3af0('0x15'),JSON['stringify'](_0x495273));if(_0x495273[_0x3af0('0x18')]){if(_0x495273[_0x3af0('0x18')][_0x3af0('0x19')]===0x1f4){logger[_0x3af0('0x18')](_0x3af0('0x14'),_0x44ab40,_0x495273['error']['message']);return _0x59ee4e(_0x495273[_0x3af0('0x18')]['message']);}logger[_0x3af0('0x18')](_0x3af0('0x14'),_0x44ab40,_0x495273['error'][_0x3af0('0x1a')]);return _0x3bbd75(_0x495273[_0x3af0('0x18')][_0x3af0('0x1a')]);}else{logger[_0x3af0('0x1b')](_0x3af0('0x14'),_0x44ab40,_0x3af0('0x15'));_0x3bbd75(_0x495273[_0x3af0('0x1c')]['message']);}})['catch'](function(_0x5cc16){logger[_0x3af0('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x44ab40,_0x5cc16);_0x59ee4e(_0x5cc16);});});}exports[_0x3af0('0x1d')]=function(_0x444ac2){var _0x16960a=this;return new Promise(function(_0x4f13a4,_0x2b15a9){return db[_0x3af0('0x1e')][_0x3af0('0x1f')]({'raw':_0x444ac2['options']?_0x444ac2[_0x3af0('0x20')][_0x3af0('0x21')]===undefined?!![]:![]:!![],'where':_0x444ac2['options']?_0x444ac2['options'][_0x3af0('0x22')]||null:null,'attributes':_0x444ac2[_0x3af0('0x20')]?_0x444ac2[_0x3af0('0x20')]['attributes']||null:null,'limit':_0x444ac2[_0x3af0('0x20')]?_0x444ac2['options'][_0x3af0('0x23')]||null:null,'include':_0x444ac2[_0x3af0('0x20')]?_0x444ac2[_0x3af0('0x20')][_0x3af0('0x24')]?_[_0x3af0('0x25')](_0x444ac2[_0x3af0('0x20')][_0x3af0('0x24')],function(_0x5e600f){return{'model':db[_0x5e600f[_0x3af0('0x26')]],'as':_0x5e600f['as'],'attributes':_0x5e600f[_0x3af0('0x27')],'include':_0x5e600f[_0x3af0('0x24')]?_['map'](_0x5e600f[_0x3af0('0x24')],function(_0x36e471){return{'model':db[_0x36e471['model']],'as':_0x36e471['as'],'attributes':_0x36e471[_0x3af0('0x27')],'include':_0x36e471[_0x3af0('0x24')]?_[_0x3af0('0x25')](_0x36e471['include'],function(_0x22b8ed){return{'model':db[_0x22b8ed['model']],'as':_0x22b8ed['as'],'attributes':_0x22b8ed[_0x3af0('0x27')]};}):[]};}):[]};}):[]:[]})[_0x3af0('0x13')](function(_0x11b512){logger['info'](_0x3af0('0x1d'),_0x444ac2);logger['debug'](_0x3af0('0x1d'),_0x444ac2,JSON[_0x3af0('0x28')](_0x11b512));_0x4f13a4(_0x11b512);})[_0x3af0('0x29')](function(_0x27e72a){logger['error'](_0x3af0('0x1d'),_0x27e72a['message'],_0x444ac2);_0x2b15a9(_0x16960a[_0x3af0('0x18')](0x1f4,_0x27e72a[_0x3af0('0x1a')]));});});};exports[_0x3af0('0x2a')]=function(_0x2f3834){var _0x1e1024=this;return new Promise(function(_0x8d3cbf,_0x12d2e6){return db[_0x3af0('0x1e')][_0x3af0('0x2b')]({'raw':_0x2f3834[_0x3af0('0x20')]?_0x2f3834[_0x3af0('0x20')][_0x3af0('0x21')]===undefined?!![]:![]:!![],'where':_0x2f3834[_0x3af0('0x20')]?_0x2f3834[_0x3af0('0x20')][_0x3af0('0x22')]||null:null,'attributes':_0x2f3834[_0x3af0('0x20')]?_0x2f3834['options'][_0x3af0('0x27')]||null:null,'include':_0x2f3834[_0x3af0('0x20')]?_0x2f3834[_0x3af0('0x20')][_0x3af0('0x24')]?_[_0x3af0('0x25')](_0x2f3834[_0x3af0('0x20')][_0x3af0('0x24')],function(_0x20e104){return{'model':db[_0x20e104[_0x3af0('0x26')]],'as':_0x20e104['as'],'attributes':_0x20e104[_0x3af0('0x27')],'include':_0x20e104[_0x3af0('0x24')]?_[_0x3af0('0x25')](_0x20e104['include'],function(_0x47f7e2){return{'model':db[_0x47f7e2[_0x3af0('0x26')]],'as':_0x47f7e2['as'],'attributes':_0x47f7e2['attributes'],'include':_0x47f7e2[_0x3af0('0x24')]?_[_0x3af0('0x25')](_0x47f7e2['include'],function(_0x5a7da8){return{'model':db[_0x5a7da8['model']],'as':_0x5a7da8['as'],'attributes':_0x5a7da8['attributes']};}):[]};}):[]};}):[]:[]})[_0x3af0('0x13')](function(_0x214476){logger['info']('ShowVoiceQueue',_0x2f3834);logger[_0x3af0('0x16')](_0x3af0('0x2a'),_0x2f3834,JSON['stringify'](_0x214476));_0x8d3cbf(_0x214476);})['catch'](function(_0x104990){logger['error']('ShowVoiceQueue',_0x104990[_0x3af0('0x1a')],_0x2f3834);_0x12d2e6(_0x1e1024[_0x3af0('0x18')](0x1f4,_0x104990[_0x3af0('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 165127e..7533696 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 _0xc5ab=['register','length','voiceQueue:','save','remove','removeListener'];(function(_0x477c8a,_0x3cc6a7){var _0x584721=function(_0x3efcb3){while(--_0x3efcb3){_0x477c8a['push'](_0x477c8a['shift']());}};_0x584721(++_0x3cc6a7);}(_0xc5ab,0x19b));var _0xbc5a=function(_0x5a6e35,_0x557945){_0x5a6e35=_0x5a6e35-0x0;var _0x1d63c6=_0xc5ab[_0x5a6e35];return _0x1d63c6;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xbc5a('0x0'),_0xbc5a('0x1'),'update'];function createListener(_0x1dc817,_0x118552){return function(_0x13612b){_0x118552['emit'](_0x1dc817,_0x13612b);};}function removeListener(_0x1debfa,_0x178d65){return function(){VoiceQueueEvents[_0xbc5a('0x2')](_0x1debfa,_0x178d65);};}exports[_0xbc5a('0x3')]=function(_0x57f412){for(var _0x4433f5=0x0,_0x1702ba=events[_0xbc5a('0x4')];_0x4433f5<_0x1702ba;_0x4433f5++){var _0x53d940=events[_0x4433f5];var _0xb600e0=createListener(_0xbc5a('0x5')+_0x53d940,_0x57f412);VoiceQueueEvents['on'](_0x53d940,_0xb600e0);}}; \ No newline at end of file +var _0x97e7=['voiceQueue:','./voiceQueue.events','save','remove','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97e7,0x1a1));var _0x797e=function(_0x3a6646,_0x1b6a6b){_0x3a6646=_0x3a6646-0x0;var _0x72f366=_0x97e7[_0x3a6646];return _0x72f366;};'use strict';var VoiceQueueEvents=require(_0x797e('0x0'));var events=[_0x797e('0x1'),_0x797e('0x2'),'update'];function createListener(_0x2faa2d,_0x2996c0){return function(_0x13b749){_0x2996c0[_0x797e('0x3')](_0x2faa2d,_0x13b749);};}function removeListener(_0x14d12b,_0x3ba40d){return function(){VoiceQueueEvents[_0x797e('0x4')](_0x14d12b,_0x3ba40d);};}exports[_0x797e('0x5')]=function(_0x445e60){for(var _0x204c83=0x0,_0x460f22=events[_0x797e('0x6')];_0x204c83<_0x460f22;_0x204c83++){var _0x5db8f6=events[_0x204c83];var _0x2fed68=createListener(_0x797e('0x7')+_0x5db8f6,_0x445e60);VoiceQueueEvents['on'](_0x5db8f6,_0x2fed68);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index a50317b..b4f729e 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 _0x1261=['/index','isAuthenticated','getVoiceQueuesReport','/:id','show','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','/describe','describe'];(function(_0x237a99,_0x3e4ff9){var _0x2ae3ca=function(_0x27efc1){while(--_0x27efc1){_0x237a99['push'](_0x237a99['shift']());}};_0x2ae3ca(++_0x3e4ff9);}(_0x1261,0x144));var _0x1126=function(_0x188bfe,_0x2517cc){_0x188bfe=_0x188bfe-0x0;var _0x1a9efa=_0x1261[_0x188bfe];return _0x1a9efa;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1126('0x9')](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0xb')]);router[_0x1126('0x9')](_0x1126('0xc'),auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router['get'](_0x1126('0xf'),auth[_0x1126('0xd')](),controller[_0x1126('0x10')]);router['post']('/',auth[_0x1126('0xd')](),controller['create']);router['put'](_0x1126('0xf'),auth['isAuthenticated'](),controller[_0x1126('0x11')]);router[_0x1126('0x12')](_0x1126('0xf'),auth[_0x1126('0xd')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0x6050=['getVoiceQueuesReport','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','/index','isAuthenticated'];(function(_0x3dc8dd,_0x2d3663){var _0x374983=function(_0x3711e7){while(--_0x3711e7){_0x3dc8dd['push'](_0x3dc8dd['shift']());}};_0x374983(++_0x2d3663);}(_0x6050,0x196));var _0x0605=function(_0x477ad1,_0x28d328){_0x477ad1=_0x477ad1-0x0;var _0x3e5eb8=_0x6050[_0x477ad1];return _0x3e5eb8;};'use strict';var multer=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var path=require(_0x0605('0x2'));var timeout=require(_0x0605('0x3'));var express=require(_0x0605('0x4'));var router=express[_0x0605('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0605('0x6'));var config=require(_0x0605('0x7'));var controller=require(_0x0605('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0605('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0605('0x9')](_0x0605('0xa'),auth[_0x0605('0xb')](),controller[_0x0605('0xc')]);router[_0x0605('0x9')]('/:id',auth[_0x0605('0xb')](),controller[_0x0605('0xd')]);router[_0x0605('0xe')]('/',auth[_0x0605('0xb')](),controller[_0x0605('0xf')]);router[_0x0605('0x10')](_0x0605('0x11'),auth[_0x0605('0xb')](),controller[_0x0605('0x12')]);router[_0x0605('0x13')](_0x0605('0x11'),auth[_0x0605('0xb')](),controller[_0x0605('0x14')]);module[_0x0605('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 163a72e..111115d 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 _0xb7e7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x6ed5fb,_0x4f8459){var _0x113009=function(_0x2f14a5){while(--_0x2f14a5){_0x6ed5fb['push'](_0x6ed5fb['shift']());}};_0x113009(++_0x4f8459);}(_0xb7e7,0x121));var _0x7b7e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb7e7[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7b7e('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7b7e('0x3')],'set':function(_0x1d9384){var _0x52047f=moment(_0x1d9384);var _0x53ed64=moment(this[_0x7b7e('0x4')](_0x7b7e('0x5')))[_0x7b7e('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x42b871=_0x52047f[_0x7b7e('0x7')](_0x53ed64,_0x7b7e('0x8'));this[_0x7b7e('0x9')](_0x7b7e('0xa'),_0x1d9384);this[_0x7b7e('0x9')](_0x7b7e('0xb'),_0x42b871||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x7b7e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7b7e('0x2')],'comment':_0x7b7e('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b7e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7b7e('0x2')]},'holdtime':{'type':Sequelize[_0x7b7e('0xc')]},'mohtime':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b7e('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7b7e('0xf')},'transferexten':{'type':Sequelize[_0x7b7e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize[_0x7b7e('0x2')]},'secondDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0713=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x38c21f,_0x5d27a5){var _0x2e1b03=function(_0x70cc69){while(--_0x70cc69){_0x38c21f['push'](_0x38c21f['shift']());}};_0x2e1b03(++_0x5d27a5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'type':{'type':Sequelize[_0x3071('0x1')]},'uniqueid':{'type':Sequelize[_0x3071('0x1')]},'calleridnum':{'type':Sequelize[_0x3071('0x1')]},'calleridname':{'type':Sequelize[_0x3071('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x3071('0x2')],'set':function(_0x33a70c){var _0x3137c8=moment(_0x33a70c);var _0xabd7b6=moment(this[_0x3071('0x3')](_0x3071('0x4')))[_0x3071('0x5')](_0x3071('0x6'));var _0x22274c=_0x3137c8[_0x3071('0x7')](_0xabd7b6,_0x3071('0x8'));this[_0x3071('0x9')]('queuecallerleaveAt',_0x33a70c);this[_0x3071('0x9')](_0x3071('0xa'),_0x22274c||null);}},'position':{'type':Sequelize[_0x3071('0xb')]},'count':{'type':Sequelize[_0x3071('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x3071('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3071('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3071('0x1')]},'accountcode':{'type':Sequelize[_0x3071('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3071('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3071('0xb')]},'mohtime':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3071('0x1')]},'transfer':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3071('0x1')],'comment':_0x3071('0xd')},'transferexten':{'type':Sequelize[_0x3071('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3071('0x1')]},'disposition':{'type':Sequelize[_0x3071('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3071('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index fdacf56..7ced6a2 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(_0xe01c24,_0x508d50){var _0x18c6fe=function(_0x5b2f67){while(--_0x5b2f67){_0xe01c24['push'](_0xe01c24['shift']());}};_0x18c6fe(++_0x508d50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x5bac50,_0x540d00){var _0x28afd5=function(_0x25b25d){while(--_0x25b25d){_0x5bac50['push'](_0x5bac50['shift']());}};_0x28afd5(++_0x540d00);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 338f473..c51fb95 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 _0xa467=['update','remove','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x4d8789,_0x3fdff1){var _0x404e41=function(_0x33d5a6){while(--_0x33d5a6){_0x4d8789['push'](_0x4d8789['shift']());}};_0x404e41(++_0x3fdff1);}(_0xa467,0x6b));var _0x7a46=function(_0x1c4d05,_0x43815e){_0x1c4d05=_0x1c4d05-0x0;var _0x58ae23=_0xa467[_0x1c4d05];return _0x58ae23;};'use strict';var EventEmitter=require(_0x7a46('0x0'));var VoiceQueueReport=require(_0x7a46('0x1'))['db'][_0x7a46('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7a46('0x3')](0x0);var events={'afterCreate':_0x7a46('0x4'),'afterUpdate':_0x7a46('0x5'),'afterDestroy':_0x7a46('0x6')};function emitEvent(_0x15f50e){return function(_0x268e52,_0xbe9c62,_0x563dee){VoiceQueueReportEvents['emit'](_0x15f50e+':'+_0x268e52['id'],_0x268e52);VoiceQueueReportEvents['emit'](_0x15f50e,_0x268e52);_0x563dee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x7a46('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x94c4=['setMaxListeners','save','remove','emit','hasOwnProperty','events','VoiceQueueReport'];(function(_0x338224,_0x1fb425){var _0x1d5fc5=function(_0x27cc96){while(--_0x27cc96){_0x338224['push'](_0x338224['shift']());}};_0x1d5fc5(++_0x1fb425);}(_0x94c4,0x6e));var _0x494c=function(_0x430a3a,_0x1fc29f){_0x430a3a=_0x430a3a-0x0;var _0x16df95=_0x94c4[_0x430a3a];return _0x16df95;};'use strict';var EventEmitter=require(_0x494c('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x494c('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x494c('0x2')](0x0);var events={'afterCreate':_0x494c('0x3'),'afterUpdate':'update','afterDestroy':_0x494c('0x4')};function emitEvent(_0x2e6d32){return function(_0x4d6307,_0x272105,_0x27cf12){VoiceQueueReportEvents[_0x494c('0x5')](_0x2e6d32+':'+_0x4d6307['id'],_0x4d6307);VoiceQueueReportEvents['emit'](_0x2e6d32,_0x4d6307);_0x27cf12(null);};}for(var e in events){if(events[_0x494c('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 61ef420..faa8426 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 _0x0b0e=['calleridnum','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','uniqueid'];(function(_0x5a3bc1,_0x3d289a){var _0xbe775c=function(_0x4fd858){while(--_0x4fd858){_0x5a3bc1['push'](_0x5a3bc1['shift']());}};_0xbe775c(++_0x3d289a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0x0b0e[_0x5774be];return _0x4914b4;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe0b0('0xb')]},{'fields':[_0xe0b0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x58d8d7,_0x108377){var _0x339d20=function(_0x45849e){while(--_0x45849e){_0x58d8d7['push'](_0x58d8d7['shift']());}};_0x339d20(++_0x108377);}(_0xb10b,0x12a));var _0xbb10=function(_0x37a902,_0x50579a){_0x37a902=_0x37a902-0x0;var _0x566d4f=_0xb10b[_0x37a902];return _0x566d4f;};'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')]('VoiceQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbb10('0xc')]},{'fields':[_0xbb10('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index e691463..a025358 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 _0xed42=['redis','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','findAll','options','where','limit','include','map','model','attributes','CreateVoiceQueueReport','VoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3cecd4,_0xb0bcf6){var _0x3d3577=function(_0x10a3fe){while(--_0x10a3fe){_0x3cecd4['push'](_0x3cecd4['shift']());}};_0x3d3577(++_0xb0bcf6);}(_0xed42,0xc9));var _0x2ed4=function(_0x121e52,_0x48e0d2){_0x121e52=_0x121e52-0x0;var _0x5b6f18=_0xed42[_0x121e52];return _0x5b6f18;};'use strict';var _=require(_0x2ed4('0x0'));var util=require(_0x2ed4('0x1'));var moment=require('moment');var BPromise=require(_0x2ed4('0x2'));var rs=require(_0x2ed4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2ed4('0x4'));var logger=require(_0x2ed4('0x5'))(_0x2ed4('0x6'));var config=require(_0x2ed4('0x7'));var jayson=require(_0x2ed4('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x2ed4('0x9')]=_['defaults'](config[_0x2ed4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ed4('0xa'))(new Redis(config[_0x2ed4('0x9')]));require(_0x2ed4('0xb'))[_0x2ed4('0xc')](socket);function respondWithRpcPromise(_0x4dc77c,_0x53ea89,_0x2274f6){return new BPromise(function(_0x2d0d5b,_0x368109){return client[_0x2ed4('0xd')](_0x4dc77c,_0x2274f6)[_0x2ed4('0xe')](function(_0x2143a6){logger[_0x2ed4('0xf')](_0x2ed4('0x10'),_0x53ea89,_0x2ed4('0x11'));logger[_0x2ed4('0x12')](_0x2ed4('0x13'),_0x53ea89,_0x2ed4('0x11'),JSON[_0x2ed4('0x14')](_0x2143a6));if(_0x2143a6[_0x2ed4('0x15')]){if(_0x2143a6[_0x2ed4('0x15')][_0x2ed4('0x16')]===0x1f4){logger[_0x2ed4('0x15')](_0x2ed4('0x10'),_0x53ea89,_0x2143a6[_0x2ed4('0x15')][_0x2ed4('0x17')]);return _0x368109(_0x2143a6[_0x2ed4('0x15')]['message']);}logger[_0x2ed4('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x53ea89,_0x2143a6['error'][_0x2ed4('0x17')]);return _0x2d0d5b(_0x2143a6[_0x2ed4('0x15')][_0x2ed4('0x17')]);}else{logger[_0x2ed4('0xf')](_0x2ed4('0x10'),_0x53ea89,_0x2ed4('0x11'));_0x2d0d5b(_0x2143a6[_0x2ed4('0x18')][_0x2ed4('0x17')]);}})[_0x2ed4('0x19')](function(_0x517e7a){logger[_0x2ed4('0x15')](_0x2ed4('0x10'),_0x53ea89,_0x517e7a);_0x368109(_0x517e7a);});});}exports[_0x2ed4('0x1a')]=function(_0x46c8a0){var _0x2548bc=this;return new Promise(function(_0x23625e,_0x37631f){return db['VoiceQueueReport'][_0x2ed4('0x1b')]({'raw':_0x46c8a0['options']?_0x46c8a0[_0x2ed4('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x46c8a0[_0x2ed4('0x1c')]?_0x46c8a0[_0x2ed4('0x1c')][_0x2ed4('0x1d')]||null:null,'attributes':_0x46c8a0['options']?_0x46c8a0[_0x2ed4('0x1c')]['attributes']||null:null,'limit':_0x46c8a0[_0x2ed4('0x1c')]?_0x46c8a0[_0x2ed4('0x1c')][_0x2ed4('0x1e')]||null:null,'include':_0x46c8a0['options']?_0x46c8a0[_0x2ed4('0x1c')][_0x2ed4('0x1f')]?_[_0x2ed4('0x20')](_0x46c8a0['options']['include'],function(_0x26c49b){return{'model':db[_0x26c49b[_0x2ed4('0x21')]],'as':_0x26c49b['as'],'attributes':_0x26c49b[_0x2ed4('0x22')],'include':_0x26c49b[_0x2ed4('0x1f')]?_['map'](_0x26c49b[_0x2ed4('0x1f')],function(_0x2c2bdc){return{'model':db[_0x2c2bdc[_0x2ed4('0x21')]],'as':_0x2c2bdc['as'],'attributes':_0x2c2bdc[_0x2ed4('0x22')],'include':_0x2c2bdc[_0x2ed4('0x1f')]?_[_0x2ed4('0x20')](_0x2c2bdc[_0x2ed4('0x1f')],function(_0x3b3f64){return{'model':db[_0x3b3f64['model']],'as':_0x3b3f64['as'],'attributes':_0x3b3f64[_0x2ed4('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41ce5b){logger[_0x2ed4('0xf')](_0x2ed4('0x1a'),_0x46c8a0);logger[_0x2ed4('0x12')](_0x2ed4('0x1a'),_0x46c8a0,JSON[_0x2ed4('0x14')](_0x41ce5b));_0x23625e(_0x41ce5b);})[_0x2ed4('0x19')](function(_0x5d1ae5){logger[_0x2ed4('0x15')](_0x2ed4('0x1a'),_0x5d1ae5[_0x2ed4('0x17')],_0x46c8a0);_0x37631f(_0x2548bc[_0x2ed4('0x15')](0x1f4,_0x5d1ae5['message']));});});};exports[_0x2ed4('0x23')]=function(_0x16255c){var _0x2075a2=this;return new Promise(function(_0x1d5f35,_0x418671){return db[_0x2ed4('0x24')][_0x2ed4('0x25')](_0x16255c[_0x2ed4('0x26')],{'raw':_0x16255c['options']?_0x16255c[_0x2ed4('0x1c')][_0x2ed4('0x27')]===undefined?!![]:![]:!![]})[_0x2ed4('0xe')](function(_0x4f5949){logger[_0x2ed4('0xf')](_0x2ed4('0x23'),_0x16255c);logger[_0x2ed4('0x12')](_0x2ed4('0x23'),_0x16255c,JSON[_0x2ed4('0x14')](_0x4f5949));_0x1d5f35(_0x4f5949);})[_0x2ed4('0x19')](function(_0x805d54){logger[_0x2ed4('0x15')](_0x2ed4('0x23'),_0x805d54[_0x2ed4('0x17')],_0x16255c);_0x418671(_0x2075a2[_0x2ed4('0x15')](0x1f4,_0x805d54[_0x2ed4('0x17')]));});});};exports[_0x2ed4('0x28')]=function(_0xd47ce5){var _0x2c08de=this;return new Promise(function(_0x5f2b74,_0xe56427){return db[_0x2ed4('0x24')][_0x2ed4('0x29')](_0xd47ce5[_0x2ed4('0x26')],{'raw':_0xd47ce5['options']?_0xd47ce5[_0x2ed4('0x1c')][_0x2ed4('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd47ce5['options']?_0xd47ce5[_0x2ed4('0x1c')][_0x2ed4('0x1d')]||null:null,'attributes':_0xd47ce5[_0x2ed4('0x1c')]?_0xd47ce5[_0x2ed4('0x1c')][_0x2ed4('0x22')]||null:null,'limit':_0xd47ce5[_0x2ed4('0x1c')]?_0xd47ce5['options'][_0x2ed4('0x1e')]||null:null})[_0x2ed4('0xe')](function(_0xeeb042){logger[_0x2ed4('0xf')]('UpdateVoiceQueueReport',_0xd47ce5);logger['debug'](_0x2ed4('0x28'),_0xd47ce5,JSON['stringify'](_0xeeb042));_0x5f2b74(_0xeeb042);})['catch'](function(_0x4e7e62){logger[_0x2ed4('0x15')](_0x2ed4('0x28'),_0x4e7e62[_0x2ed4('0x17')],_0xd47ce5);_0xe56427(_0x2c08de[_0x2ed4('0x15')](0x1f4,_0x4e7e62['message']));});});}; \ No newline at end of file +var _0xe44d=['map','then','debug','CreateVoiceQueueReport','VoiceQueueReport','body','UpdateVoiceQueueReport','update','lodash','util','bluebird','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','./voiceQueueReport.socket','register','request','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model'];(function(_0x16fe3b,_0x3dacc0){var _0xb63f99=function(_0x2c6985){while(--_0x2c6985){_0x16fe3b['push'](_0x16fe3b['shift']());}};_0xb63f99(++_0x3dacc0);}(_0xe44d,0x138));var _0xde44=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe44d[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xde44('0x0'));var util=require(_0xde44('0x1'));var moment=require('moment');var BPromise=require(_0xde44('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde44('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xde44('0x4'));var jayson=require(_0xde44('0x5'));var client=jayson[_0xde44('0x6')][_0xde44('0x7')]({'port':0x232a});config[_0xde44('0x8')]=_['defaults'](config[_0xde44('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde44('0x8')]));require(_0xde44('0x9'))[_0xde44('0xa')](socket);function respondWithRpcPromise(_0x2f8e76,_0x4fd605,_0x2475ec){return new BPromise(function(_0x245b42,_0x3f2ecd){return client[_0xde44('0xb')](_0x2f8e76,_0x2475ec)['then'](function(_0x3ffb6e){logger['info'](_0xde44('0xc'),_0x4fd605,'request\x20sent');logger['debug'](_0xde44('0xd'),_0x4fd605,'request\x20sent',JSON[_0xde44('0xe')](_0x3ffb6e));if(_0x3ffb6e[_0xde44('0xf')]){if(_0x3ffb6e[_0xde44('0xf')][_0xde44('0x10')]===0x1f4){logger[_0xde44('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x4fd605,_0x3ffb6e[_0xde44('0xf')][_0xde44('0x11')]);return _0x3f2ecd(_0x3ffb6e[_0xde44('0xf')]['message']);}logger['error'](_0xde44('0xc'),_0x4fd605,_0x3ffb6e['error'][_0xde44('0x11')]);return _0x245b42(_0x3ffb6e['error'][_0xde44('0x11')]);}else{logger[_0xde44('0x12')](_0xde44('0xc'),_0x4fd605,_0xde44('0x13'));_0x245b42(_0x3ffb6e['result']['message']);}})[_0xde44('0x14')](function(_0x538e14){logger[_0xde44('0xf')](_0xde44('0xc'),_0x4fd605,_0x538e14);_0x3f2ecd(_0x538e14);});});}exports[_0xde44('0x15')]=function(_0x36486f){var _0x3ccb62=this;return new Promise(function(_0x337663,_0x1bac2c){return db['VoiceQueueReport'][_0xde44('0x16')]({'raw':_0x36486f[_0xde44('0x17')]?_0x36486f[_0xde44('0x17')][_0xde44('0x18')]===undefined?!![]:![]:!![],'where':_0x36486f[_0xde44('0x17')]?_0x36486f['options'][_0xde44('0x19')]||null:null,'attributes':_0x36486f[_0xde44('0x17')]?_0x36486f[_0xde44('0x17')][_0xde44('0x1a')]||null:null,'limit':_0x36486f['options']?_0x36486f[_0xde44('0x17')][_0xde44('0x1b')]||null:null,'include':_0x36486f[_0xde44('0x17')]?_0x36486f['options'][_0xde44('0x1c')]?_['map'](_0x36486f['options'][_0xde44('0x1c')],function(_0xd6f721){return{'model':db[_0xd6f721[_0xde44('0x1d')]],'as':_0xd6f721['as'],'attributes':_0xd6f721[_0xde44('0x1a')],'include':_0xd6f721[_0xde44('0x1c')]?_[_0xde44('0x1e')](_0xd6f721[_0xde44('0x1c')],function(_0x561209){return{'model':db[_0x561209[_0xde44('0x1d')]],'as':_0x561209['as'],'attributes':_0x561209[_0xde44('0x1a')],'include':_0x561209[_0xde44('0x1c')]?_[_0xde44('0x1e')](_0x561209[_0xde44('0x1c')],function(_0x862277){return{'model':db[_0x862277[_0xde44('0x1d')]],'as':_0x862277['as'],'attributes':_0x862277['attributes']};}):[]};}):[]};}):[]:[]})[_0xde44('0x1f')](function(_0x48679c){logger[_0xde44('0x12')](_0xde44('0x15'),_0x36486f);logger[_0xde44('0x20')](_0xde44('0x15'),_0x36486f,JSON[_0xde44('0xe')](_0x48679c));_0x337663(_0x48679c);})[_0xde44('0x14')](function(_0x52ba26){logger[_0xde44('0xf')](_0xde44('0x15'),_0x52ba26['message'],_0x36486f);_0x1bac2c(_0x3ccb62[_0xde44('0xf')](0x1f4,_0x52ba26[_0xde44('0x11')]));});});};exports[_0xde44('0x21')]=function(_0x282972){var _0x3f6fc9=this;return new Promise(function(_0x37e96a,_0x2bd89d){return db[_0xde44('0x22')]['create'](_0x282972[_0xde44('0x23')],{'raw':_0x282972[_0xde44('0x17')]?_0x282972[_0xde44('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xde44('0x1f')](function(_0x386203){logger[_0xde44('0x12')]('CreateVoiceQueueReport',_0x282972);logger['debug'](_0xde44('0x21'),_0x282972,JSON[_0xde44('0xe')](_0x386203));_0x37e96a(_0x386203);})[_0xde44('0x14')](function(_0x3bbd1d){logger[_0xde44('0xf')](_0xde44('0x21'),_0x3bbd1d[_0xde44('0x11')],_0x282972);_0x2bd89d(_0x3f6fc9[_0xde44('0xf')](0x1f4,_0x3bbd1d[_0xde44('0x11')]));});});};exports[_0xde44('0x24')]=function(_0x5ab109){var _0x5c760d=this;return new Promise(function(_0x45b6fc,_0x6d8475){return db['VoiceQueueReport'][_0xde44('0x25')](_0x5ab109[_0xde44('0x23')],{'raw':_0x5ab109[_0xde44('0x17')]?_0x5ab109[_0xde44('0x17')][_0xde44('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ab109[_0xde44('0x17')]?_0x5ab109[_0xde44('0x17')][_0xde44('0x19')]||null:null,'attributes':_0x5ab109[_0xde44('0x17')]?_0x5ab109[_0xde44('0x17')][_0xde44('0x1a')]||null:null,'limit':_0x5ab109[_0xde44('0x17')]?_0x5ab109[_0xde44('0x17')][_0xde44('0x1b')]||null:null})[_0xde44('0x1f')](function(_0xe5e3f3){logger[_0xde44('0x12')](_0xde44('0x24'),_0x5ab109);logger[_0xde44('0x20')]('UpdateVoiceQueueReport',_0x5ab109,JSON[_0xde44('0xe')](_0xe5e3f3));_0x45b6fc(_0xe5e3f3);})['catch'](function(_0x2e73d1){logger[_0xde44('0xf')]('UpdateVoiceQueueReport',_0x2e73d1[_0xde44('0x11')],_0x5ab109);_0x6d8475(_0x5c760d['error'](0x1f4,_0x2e73d1[_0xde44('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ad240b4..b8bfd54 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 _0xfe5f=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x133c36,_0xecec59){var _0x507a82=function(_0x3fe923){while(--_0x3fe923){_0x133c36['push'](_0x133c36['shift']());}};_0x507a82(++_0xecec59);}(_0xfe5f,0x1b5));var _0xffe5=function(_0x4a931d,_0x1846f9){_0x4a931d=_0x4a931d-0x0;var _0x56ab49=_0xfe5f[_0x4a931d];return _0x56ab49;};'use strict';var VoiceQueueReportEvents=require(_0xffe5('0x0'));var events=[_0xffe5('0x1'),_0xffe5('0x2'),_0xffe5('0x3')];function createListener(_0x3fa311,_0x336a9e){return function(_0x4fa8e5){_0x336a9e['emit'](_0x3fa311,_0x4fa8e5);};}function removeListener(_0x172b77,_0x4ac03c){return function(){VoiceQueueReportEvents['removeListener'](_0x172b77,_0x4ac03c);};}exports[_0xffe5('0x4')]=function(_0x5e8689){for(var _0x10f39c=0x0,_0x48d8a6=events[_0xffe5('0x5')];_0x10f39c<_0x48d8a6;_0x10f39c++){var _0x1cba76=events[_0x10f39c];var _0x25484b=createListener(_0xffe5('0x6')+_0x1cba76,_0x5e8689);VoiceQueueReportEvents['on'](_0x1cba76,_0x25484b);}}; \ No newline at end of file +var _0x105a=['update','removeListener','register','length','voiceQueueReport:','save','remove'];(function(_0x1e1fe5,_0x4e9448){var _0x52af67=function(_0x5c0285){while(--_0x5c0285){_0x1e1fe5['push'](_0x1e1fe5['shift']());}};_0x52af67(++_0x4e9448);}(_0x105a,0xd7));var _0xa105=function(_0x3c7a07,_0x52cd9a){_0x3c7a07=_0x3c7a07-0x0;var _0x4144eb=_0x105a[_0x3c7a07];return _0x4144eb;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xa105('0x0'),_0xa105('0x1'),_0xa105('0x2')];function createListener(_0x327585,_0x43ca1e){return function(_0x2284c2){_0x43ca1e['emit'](_0x327585,_0x2284c2);};}function removeListener(_0x16610a,_0x3a1850){return function(){VoiceQueueReportEvents[_0xa105('0x3')](_0x16610a,_0x3a1850);};}exports[_0xa105('0x4')]=function(_0x1d4f36){for(var _0x307255=0x0,_0x2c68b2=events[_0xa105('0x5')];_0x307255<_0x2c68b2;_0x307255++){var _0x43c807=events[_0x307255];var _0x1d11f9=createListener(_0xa105('0x6')+_0x43c807,_0x1d4f36);VoiceQueueReportEvents['on'](_0x43c807,_0x1d11f9);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 079932a..ed5a69e 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 _0xc431=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc431,0x15c));var _0x1c43=function(_0x5e2d7d,_0x3ed5f9){_0x5e2d7d=_0x5e2d7d-0x0;var _0x1d5e07=_0xc431[_0x5e2d7d];return _0x1d5e07;};'use strict';var multer=require(_0x1c43('0x0'));var util=require(_0x1c43('0x1'));var path=require(_0x1c43('0x2'));var timeout=require(_0x1c43('0x3'));var express=require('express');var router=express[_0x1c43('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1c43('0x5'));var config=require(_0x1c43('0x6'));var controller=require(_0x1c43('0x7'));router['get']('/',auth[_0x1c43('0x8')](),controller[_0x1c43('0x9')]);router[_0x1c43('0xa')](_0x1c43('0xb'),auth[_0x1c43('0x8')](),controller[_0x1c43('0xc')]);router['post']('/',auth[_0x1c43('0x8')](),controller[_0x1c43('0xd')]);router[_0x1c43('0xe')](_0x1c43('0xb'),auth['isAuthenticated'](),controller[_0x1c43('0xf')]);router[_0x1c43('0x10')](_0x1c43('0xb'),auth[_0x1c43('0x8')](),controller[_0x1c43('0x11')]);module[_0x1c43('0x12')]=router; \ No newline at end of file +var _0xd54c=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','create','put','delete','destroy'];(function(_0x7b12e3,_0x3071aa){var _0xf4d241=function(_0x24287f){while(--_0x24287f){_0x7b12e3['push'](_0x7b12e3['shift']());}};_0xf4d241(++_0x3071aa);}(_0xd54c,0x171));var _0xcd54=function(_0x55ca52,_0x5896aa){_0x55ca52=_0x55ca52-0x0;var _0x53116c=_0xd54c[_0x55ca52];return _0x53116c;};'use strict';var multer=require(_0xcd54('0x0'));var util=require('util');var path=require(_0xcd54('0x1'));var timeout=require(_0xcd54('0x2'));var express=require(_0xcd54('0x3'));var router=express['Router']();var auth=require(_0xcd54('0x4'));var interaction=require(_0xcd54('0x5'));var config=require('../../config/environment');var controller=require(_0xcd54('0x6'));router[_0xcd54('0x7')]('/',auth[_0xcd54('0x8')](),controller['index']);router[_0xcd54('0x7')](_0xcd54('0x9'),auth[_0xcd54('0x8')](),controller[_0xcd54('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcd54('0xb')]);router[_0xcd54('0xc')](_0xcd54('0x9'),auth[_0xcd54('0x8')](),controller['update']);router[_0xcd54('0xd')]('/:id',auth[_0xcd54('0x8')](),controller[_0xcd54('0xe')]);module[_0xcd54('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index e4da767..e42c8be 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 _0x43e7=['sequelize','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x43e7,0x1e8));var _0x743e=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0x43e7[_0xd816e2];return _0x1f5924;};'use strict';var Sequelize=require(_0x743e('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x743e('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x743e('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x743e('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x743e('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x743e('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x743e('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x743e('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x743e('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x743e('0x2')],'allowNull':![],'defaultValue':moment()['format'](_0x743e('0x3'))}}; \ No newline at end of file +var _0xdb04=['STRING','format','moment','exports'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xdb04,0x106));var _0x4db0=function(_0x509abd,_0x33be8f){_0x509abd=_0x509abd-0x0;var _0x3d1e51=_0xdb04[_0x509abd];return _0x3d1e51;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4db0('0x0'));module[_0x4db0('0x1')]={'time':{'type':Sequelize[_0x4db0('0x2')]},'callid':{'type':Sequelize[_0x4db0('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4db0('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4db0('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4db0('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4db0('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4db0('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x4db0('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x4db0('0x3')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4190084..550e5f7 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 _0x1a23=['Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','VoiceQueuesLog','findAll','catch','show','rawAttributes','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set'];(function(_0x47f2ce,_0x1ec3f6){var _0x3d4480=function(_0x385f7d){while(--_0x385f7d){_0x47f2ce['push'](_0x47f2ce['shift']());}};_0x3d4480(++_0x1ec3f6);}(_0x1a23,0xc3));var _0x31a2=function(_0x5be1a6,_0x469fda){_0x5be1a6=_0x5be1a6-0x0;var _0x5b40f1=_0x1a23[_0x5be1a6];return _0x5b40f1;};'use strict';var pdf=require(_0x31a2('0x0'));var emlformat=require(_0x31a2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x31a2('0x2'));var jsonpatch=require(_0x31a2('0x3'));var rp=require(_0x31a2('0x4'));var moment=require(_0x31a2('0x5'));var BPromise=require(_0x31a2('0x6'));var Mustache=require(_0x31a2('0x7'));var util=require(_0x31a2('0x8'));var path=require(_0x31a2('0x9'));var sox=require(_0x31a2('0xa'));var csv=require(_0x31a2('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x31a2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x31a2('0xd'));var deskjs=require(_0x31a2('0xe'));var toCsv=require(_0x31a2('0xb'));var querystring=require(_0x31a2('0xf'));var Papa=require(_0x31a2('0x10'));var Redis=require(_0x31a2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x31a2('0x12'));var as=require(_0x31a2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x31a2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x31a2('0x15'));var db=require(_0x31a2('0x16'))['db'];function respondWithStatusCode(_0x1a4c7b,_0x486380){_0x486380=_0x486380||0xcc;return function(_0x37dc47){if(_0x37dc47){return _0x1a4c7b['sendStatus'](_0x486380);}return _0x1a4c7b[_0x31a2('0x17')](_0x486380)[_0x31a2('0x18')]();};}function respondWithResult(_0xae4d1a,_0x6491ff){_0x6491ff=_0x6491ff||0xc8;return function(_0x465e32){if(_0x465e32){return _0xae4d1a['status'](_0x6491ff)[_0x31a2('0x19')](_0x465e32);}};}function respondWithFilteredResult(_0x39d206,_0x4e6959){return function(_0x1937bf){if(_0x1937bf){var _0x719991=_0x1937bf[_0x31a2('0x1a')],_0x1fef77=_0x4e6959[_0x31a2('0x1b')],_0x498ca6=_0x4e6959[_0x31a2('0x1b')]+_0x4e6959[_0x31a2('0x1c')],_0x4cb0e4;if(_0x498ca6>=_0x719991){_0x498ca6=_0x719991;_0x4cb0e4=0xc8;}else{_0x4cb0e4=0xce;}_0x39d206[_0x31a2('0x17')](_0x4cb0e4);return _0x39d206[_0x31a2('0x1d')](_0x31a2('0x1e'),_0x1fef77+'-'+_0x498ca6+'/'+_0x719991)[_0x31a2('0x19')](_0x1937bf);}return null;};}function patchUpdates(_0x7d8857){return function(_0x411496){try{jsonpatch[_0x31a2('0x1f')](_0x411496,_0x7d8857,!![]);}catch(_0xccae86){return BPromise[_0x31a2('0x20')](_0xccae86);}return _0x411496[_0x31a2('0x21')]();};}function saveUpdates(_0x236e39,_0x331376){return function(_0x4720b9){if(_0x4720b9){return _0x4720b9[_0x31a2('0x22')](_0x236e39)['then'](function(_0xee928a){return _0xee928a;});}return null;};}function removeEntity(_0x48b681,_0x160031){return function(_0x829f49){if(_0x829f49){return _0x829f49[_0x31a2('0x23')]()[_0x31a2('0x24')](function(){_0x48b681[_0x31a2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c6d96,_0x3d2e35){return function(_0x1a2661){if(!_0x1a2661){_0x1c6d96[_0x31a2('0x25')](0x194);}return _0x1a2661;};}function handleError(_0x45a161,_0x306aa6){_0x306aa6=_0x306aa6||0x1f4;return function(_0x3b5aa3){logger[_0x31a2('0x26')](_0x3b5aa3[_0x31a2('0x27')]);if(_0x3b5aa3[_0x31a2('0x28')]){delete _0x3b5aa3['name'];}_0x45a161[_0x31a2('0x17')](_0x306aa6)[_0x31a2('0x29')](_0x3b5aa3);};}exports[_0x31a2('0x2a')]=function(_0x12af55,_0x5d478f){var _0x43d0e7={},_0x18d9b0={},_0x208ebe={'count':0x0,'rows':[]};var _0x25256d=_[_0x31a2('0x2b')](db['VoiceQueuesLog']['rawAttributes'],function(_0x110ba2){return{'name':_0x110ba2[_0x31a2('0x2c')],'type':_0x110ba2[_0x31a2('0x2d')][_0x31a2('0x2e')]};});_0x18d9b0[_0x31a2('0x2f')]=_[_0x31a2('0x2b')](_0x25256d,_0x31a2('0x28'));_0x18d9b0[_0x31a2('0x30')]=_[_0x31a2('0x31')](_0x12af55[_0x31a2('0x30')]);_0x18d9b0['filters']=_[_0x31a2('0x32')](_0x18d9b0[_0x31a2('0x2f')],_0x18d9b0[_0x31a2('0x30')]);_0x43d0e7['attributes']=_[_0x31a2('0x32')](_0x18d9b0['model'],qs[_0x31a2('0x33')](_0x12af55[_0x31a2('0x30')][_0x31a2('0x33')]));_0x43d0e7[_0x31a2('0x34')]=_0x43d0e7[_0x31a2('0x34')]['length']?_0x43d0e7[_0x31a2('0x34')]:_0x18d9b0[_0x31a2('0x2f')];if(!_0x12af55[_0x31a2('0x30')][_0x31a2('0x35')](_0x31a2('0x36'))){_0x43d0e7['limit']=qs[_0x31a2('0x1c')](_0x12af55[_0x31a2('0x30')][_0x31a2('0x1c')]);_0x43d0e7[_0x31a2('0x1b')]=qs[_0x31a2('0x1b')](_0x12af55[_0x31a2('0x30')][_0x31a2('0x1b')]);}_0x43d0e7[_0x31a2('0x37')]=qs[_0x31a2('0x38')](_0x12af55[_0x31a2('0x30')][_0x31a2('0x38')]);_0x43d0e7[_0x31a2('0x39')]=qs[_0x31a2('0x3a')](_[_0x31a2('0x3b')](_0x12af55[_0x31a2('0x30')],_0x18d9b0[_0x31a2('0x3a')]),_0x25256d);if(_0x12af55[_0x31a2('0x30')][_0x31a2('0x3c')]){_0x43d0e7[_0x31a2('0x39')]=_['merge'](_0x43d0e7['where'],{'$or':_['map'](_0x25256d,function(_0x4cfe1a){if(_0x4cfe1a[_0x31a2('0x2d')]!==_0x31a2('0x3d')){var _0x19614e={};_0x19614e[_0x4cfe1a[_0x31a2('0x28')]]={'$like':'%'+_0x12af55[_0x31a2('0x30')][_0x31a2('0x3c')]+'%'};return _0x19614e;}})});}_0x43d0e7=_[_0x31a2('0x3e')]({},_0x43d0e7,_0x12af55[_0x31a2('0x3f')]);var _0xc100={'where':_0x43d0e7[_0x31a2('0x39')]};return db['VoiceQueuesLog'][_0x31a2('0x1a')](_0xc100)[_0x31a2('0x24')](function(_0x401b58){_0x208ebe[_0x31a2('0x1a')]=_0x401b58;if(_0x12af55[_0x31a2('0x30')][_0x31a2('0x40')]){_0x43d0e7[_0x31a2('0x41')]=[{'all':!![]}];}return db[_0x31a2('0x42')][_0x31a2('0x43')](_0x43d0e7);})['then'](function(_0x3da238){_0x208ebe['rows']=_0x3da238;return _0x208ebe;})[_0x31a2('0x24')](respondWithFilteredResult(_0x5d478f,_0x43d0e7))[_0x31a2('0x44')](handleError(_0x5d478f,null));};exports[_0x31a2('0x45')]=function(_0x148b79,_0x383db7){var _0x84bc84={'raw':!![],'where':{'id':_0x148b79['params']['id']}},_0x5308cd={};_0x5308cd[_0x31a2('0x2f')]=_[_0x31a2('0x31')](db['VoiceQueuesLog'][_0x31a2('0x46')]);_0x5308cd[_0x31a2('0x30')]=_['keys'](_0x148b79[_0x31a2('0x30')]);_0x5308cd[_0x31a2('0x3a')]=_[_0x31a2('0x32')](_0x5308cd[_0x31a2('0x2f')],_0x5308cd['query']);_0x84bc84[_0x31a2('0x34')]=_['intersection'](_0x5308cd[_0x31a2('0x2f')],qs[_0x31a2('0x33')](_0x148b79['query'][_0x31a2('0x33')]));_0x84bc84[_0x31a2('0x34')]=_0x84bc84[_0x31a2('0x34')]['length']?_0x84bc84[_0x31a2('0x34')]:_0x5308cd['model'];if(_0x148b79[_0x31a2('0x30')]['includeAll']){_0x84bc84['include']=[{'all':!![]}];}_0x84bc84=_[_0x31a2('0x3e')]({},_0x84bc84,_0x148b79[_0x31a2('0x3f')]);return db[_0x31a2('0x42')][_0x31a2('0x47')](_0x84bc84)[_0x31a2('0x24')](handleEntityNotFound(_0x383db7,null))['then'](respondWithResult(_0x383db7,null))[_0x31a2('0x44')](handleError(_0x383db7,null));};exports[_0x31a2('0x48')]=function(_0x2df850,_0x15349f){return db[_0x31a2('0x42')][_0x31a2('0x48')](_0x2df850['body'],{})[_0x31a2('0x24')](respondWithResult(_0x15349f,0xc9))[_0x31a2('0x44')](handleError(_0x15349f,null));};exports[_0x31a2('0x22')]=function(_0x35e509,_0x52edd7){if(_0x35e509[_0x31a2('0x49')]['id']){delete _0x35e509[_0x31a2('0x49')]['id'];}return db['VoiceQueuesLog'][_0x31a2('0x47')]({'where':{'id':_0x35e509['params']['id']}})[_0x31a2('0x24')](handleEntityNotFound(_0x52edd7,null))[_0x31a2('0x24')](saveUpdates(_0x35e509[_0x31a2('0x49')],null))[_0x31a2('0x24')](respondWithResult(_0x52edd7,null))['catch'](handleError(_0x52edd7,null));};exports['destroy']=function(_0x5558a9,_0x4554b2){return db['VoiceQueuesLog'][_0x31a2('0x47')]({'where':{'id':_0x5558a9[_0x31a2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4554b2,null))[_0x31a2('0x24')](removeEntity(_0x4554b2,null))['catch'](handleError(_0x4554b2,null));}; \ No newline at end of file +var _0x0c67=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../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','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','fieldName','type','key','query','keys','filters','attributes','model','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','include','show','params','rawAttributes','intersection','includeAll','catch','create','body','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0xeb1ce7,_0x51d6ca){var _0x57bf4f=function(_0x579d9c){while(--_0x579d9c){_0xeb1ce7['push'](_0xeb1ce7['shift']());}};_0x57bf4f(++_0x51d6ca);}(_0x0c67,0x8d));var _0x70c6=function(_0x1b2763,_0x522478){_0x1b2763=_0x1b2763-0x0;var _0x920916=_0x0c67[_0x1b2763];return _0x920916;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x70c6('0x0'));var zipdir=require(_0x70c6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x70c6('0x2'));var moment=require(_0x70c6('0x3'));var BPromise=require(_0x70c6('0x4'));var Mustache=require(_0x70c6('0x5'));var util=require(_0x70c6('0x6'));var path=require(_0x70c6('0x7'));var sox=require('sox');var csv=require(_0x70c6('0x8'));var ejs=require(_0x70c6('0x9'));var fs=require('fs');var _=require(_0x70c6('0xa'));var squel=require(_0x70c6('0xb'));var crypto=require(_0x70c6('0xc'));var jsforce=require(_0x70c6('0xd'));var deskjs=require(_0x70c6('0xe'));var toCsv=require(_0x70c6('0x8'));var querystring=require(_0x70c6('0xf'));var Papa=require(_0x70c6('0x10'));var Redis=require(_0x70c6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x70c6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70c6('0x13'));var logger=require(_0x70c6('0x14'))('api');var utils=require(_0x70c6('0x15'));var config=require(_0x70c6('0x16'));var licenseUtil=require(_0x70c6('0x17'));var db=require(_0x70c6('0x18'))['db'];function respondWithStatusCode(_0x1ff433,_0x584aae){_0x584aae=_0x584aae||0xcc;return function(_0x136984){if(_0x136984){return _0x1ff433[_0x70c6('0x19')](_0x584aae);}return _0x1ff433[_0x70c6('0x1a')](_0x584aae)[_0x70c6('0x1b')]();};}function respondWithResult(_0x4e0637,_0x29f3ac){_0x29f3ac=_0x29f3ac||0xc8;return function(_0x3130e4){if(_0x3130e4){return _0x4e0637['status'](_0x29f3ac)[_0x70c6('0x1c')](_0x3130e4);}};}function respondWithFilteredResult(_0x5c3dce,_0x4fd15f){return function(_0x5a6554){if(_0x5a6554){var _0x4eabaf=_0x5a6554[_0x70c6('0x1d')],_0x228d2f=_0x4fd15f[_0x70c6('0x1e')],_0x2fafbb=_0x4fd15f[_0x70c6('0x1e')]+_0x4fd15f[_0x70c6('0x1f')],_0x166909;if(_0x2fafbb>=_0x4eabaf){_0x2fafbb=_0x4eabaf;_0x166909=0xc8;}else{_0x166909=0xce;}_0x5c3dce[_0x70c6('0x1a')](_0x166909);return _0x5c3dce[_0x70c6('0x20')](_0x70c6('0x21'),_0x228d2f+'-'+_0x2fafbb+'/'+_0x4eabaf)['json'](_0x5a6554);}return null;};}function patchUpdates(_0x1cd1bb){return function(_0x4d00a1){try{jsonpatch[_0x70c6('0x22')](_0x4d00a1,_0x1cd1bb,!![]);}catch(_0x2fa62e){return BPromise[_0x70c6('0x23')](_0x2fa62e);}return _0x4d00a1[_0x70c6('0x24')]();};}function saveUpdates(_0x136c1e,_0x5513ff){return function(_0x10a118){if(_0x10a118){return _0x10a118[_0x70c6('0x25')](_0x136c1e)[_0x70c6('0x26')](function(_0x2b464d){return _0x2b464d;});}return null;};}function removeEntity(_0xd40ded,_0x5219a4){return function(_0x501958){if(_0x501958){return _0x501958[_0x70c6('0x27')]()[_0x70c6('0x26')](function(){_0xd40ded['status'](0xcc)[_0x70c6('0x1b')]();});}};}function handleEntityNotFound(_0x6eb8df,_0x363c6b){return function(_0x52457e){if(!_0x52457e){_0x6eb8df['sendStatus'](0x194);}return _0x52457e;};}function handleError(_0x26c7fc,_0x18b189){_0x18b189=_0x18b189||0x1f4;return function(_0x488b8a){logger[_0x70c6('0x28')](_0x488b8a[_0x70c6('0x29')]);if(_0x488b8a[_0x70c6('0x2a')]){delete _0x488b8a[_0x70c6('0x2a')];}_0x26c7fc[_0x70c6('0x1a')](_0x18b189)[_0x70c6('0x2b')](_0x488b8a);};}exports[_0x70c6('0x2c')]=function(_0x3a91e9,_0x1fcab4){var _0xed285b={},_0x2a2c36={},_0x3755b7={'count':0x0,'rows':[]};var _0xd73cbc=_[_0x70c6('0x2d')](db[_0x70c6('0x2e')]['rawAttributes'],function(_0x6569a1){return{'name':_0x6569a1[_0x70c6('0x2f')],'type':_0x6569a1[_0x70c6('0x30')][_0x70c6('0x31')]};});_0x2a2c36['model']=_[_0x70c6('0x2d')](_0xd73cbc,_0x70c6('0x2a'));_0x2a2c36[_0x70c6('0x32')]=_[_0x70c6('0x33')](_0x3a91e9['query']);_0x2a2c36[_0x70c6('0x34')]=_['intersection'](_0x2a2c36['model'],_0x2a2c36[_0x70c6('0x32')]);_0xed285b[_0x70c6('0x35')]=_['intersection'](_0x2a2c36[_0x70c6('0x36')],qs['fields'](_0x3a91e9[_0x70c6('0x32')][_0x70c6('0x37')]));_0xed285b['attributes']=_0xed285b['attributes'][_0x70c6('0x38')]?_0xed285b['attributes']:_0x2a2c36['model'];if(!_0x3a91e9['query']['hasOwnProperty'](_0x70c6('0x39'))){_0xed285b[_0x70c6('0x1f')]=qs[_0x70c6('0x1f')](_0x3a91e9[_0x70c6('0x32')][_0x70c6('0x1f')]);_0xed285b[_0x70c6('0x1e')]=qs['offset'](_0x3a91e9[_0x70c6('0x32')][_0x70c6('0x1e')]);}_0xed285b[_0x70c6('0x3a')]=qs[_0x70c6('0x3b')](_0x3a91e9[_0x70c6('0x32')][_0x70c6('0x3b')]);_0xed285b['where']=qs['filters'](_['pick'](_0x3a91e9['query'],_0x2a2c36['filters']),_0xd73cbc);if(_0x3a91e9[_0x70c6('0x32')][_0x70c6('0x3c')]){_0xed285b['where']=_['merge'](_0xed285b[_0x70c6('0x3d')],{'$or':_[_0x70c6('0x2d')](_0xd73cbc,function(_0x379ee5){if(_0x379ee5['type']!==_0x70c6('0x3e')){var _0x55bedd={};_0x55bedd[_0x379ee5[_0x70c6('0x2a')]]={'$like':'%'+_0x3a91e9[_0x70c6('0x32')][_0x70c6('0x3c')]+'%'};return _0x55bedd;}})});}_0xed285b=_[_0x70c6('0x3f')]({},_0xed285b,_0x3a91e9[_0x70c6('0x40')]);var _0x5df890={'where':_0xed285b[_0x70c6('0x3d')]};return db[_0x70c6('0x2e')][_0x70c6('0x1d')](_0x5df890)[_0x70c6('0x26')](function(_0x4cb680){_0x3755b7[_0x70c6('0x1d')]=_0x4cb680;if(_0x3a91e9['query']['includeAll']){_0xed285b[_0x70c6('0x41')]=[{'all':!![]}];}return db[_0x70c6('0x2e')]['findAll'](_0xed285b);})['then'](function(_0x2a38be){_0x3755b7['rows']=_0x2a38be;return _0x3755b7;})['then'](respondWithFilteredResult(_0x1fcab4,_0xed285b))['catch'](handleError(_0x1fcab4,null));};exports[_0x70c6('0x42')]=function(_0x3d1d81,_0xa97c59){var _0x2e942f={'raw':!![],'where':{'id':_0x3d1d81[_0x70c6('0x43')]['id']}},_0x400746={};_0x400746[_0x70c6('0x36')]=_[_0x70c6('0x33')](db[_0x70c6('0x2e')][_0x70c6('0x44')]);_0x400746['query']=_[_0x70c6('0x33')](_0x3d1d81['query']);_0x400746['filters']=_[_0x70c6('0x45')](_0x400746['model'],_0x400746[_0x70c6('0x32')]);_0x2e942f[_0x70c6('0x35')]=_[_0x70c6('0x45')](_0x400746[_0x70c6('0x36')],qs[_0x70c6('0x37')](_0x3d1d81[_0x70c6('0x32')][_0x70c6('0x37')]));_0x2e942f[_0x70c6('0x35')]=_0x2e942f[_0x70c6('0x35')][_0x70c6('0x38')]?_0x2e942f[_0x70c6('0x35')]:_0x400746[_0x70c6('0x36')];if(_0x3d1d81['query'][_0x70c6('0x46')]){_0x2e942f['include']=[{'all':!![]}];}_0x2e942f=_[_0x70c6('0x3f')]({},_0x2e942f,_0x3d1d81[_0x70c6('0x40')]);return db[_0x70c6('0x2e')]['find'](_0x2e942f)[_0x70c6('0x26')](handleEntityNotFound(_0xa97c59,null))[_0x70c6('0x26')](respondWithResult(_0xa97c59,null))[_0x70c6('0x47')](handleError(_0xa97c59,null));};exports['create']=function(_0x55a949,_0x230ff0){return db['VoiceQueuesLog'][_0x70c6('0x48')](_0x55a949[_0x70c6('0x49')],{})[_0x70c6('0x26')](respondWithResult(_0x230ff0,0xc9))[_0x70c6('0x47')](handleError(_0x230ff0,null));};exports[_0x70c6('0x25')]=function(_0x775e86,_0x429916){if(_0x775e86[_0x70c6('0x49')]['id']){delete _0x775e86[_0x70c6('0x49')]['id'];}return db[_0x70c6('0x2e')][_0x70c6('0x4a')]({'where':{'id':_0x775e86[_0x70c6('0x43')]['id']}})[_0x70c6('0x26')](handleEntityNotFound(_0x429916,null))[_0x70c6('0x26')](saveUpdates(_0x775e86[_0x70c6('0x49')],null))[_0x70c6('0x26')](respondWithResult(_0x429916,null))['catch'](handleError(_0x429916,null));};exports[_0x70c6('0x27')]=function(_0x4c3d24,_0x3fa6d6){return db[_0x70c6('0x2e')][_0x70c6('0x4a')]({'where':{'id':_0x4c3d24['params']['id']}})[_0x70c6('0x26')](handleEntityNotFound(_0x3fa6d6,null))[_0x70c6('0x26')](removeEntity(_0x3fa6d6,null))[_0x70c6('0x47')](handleError(_0x3fa6d6,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 8213fe1..26f1c6e 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 _0x1a59=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x358c86,_0x38a8a2){var _0x52edc5=function(_0x560096){while(--_0x560096){_0x358c86['push'](_0x358c86['shift']());}};_0x52edc5(++_0x38a8a2);}(_0x1a59,0x124));var _0x91a5=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0x1a59[_0x5a7112];return _0x3147f7;};'use strict';var _=require(_0x91a5('0x0'));var util=require(_0x91a5('0x1'));var logger=require(_0x91a5('0x2'))('api');var moment=require(_0x91a5('0x3'));var BPromise=require(_0x91a5('0x4'));var rp=require(_0x91a5('0x5'));var fs=require('fs');var path=require(_0x91a5('0x6'));var rimraf=require(_0x91a5('0x7'));var config=require('../../config/environment');var attributes=require(_0x91a5('0x8'));module[_0x91a5('0x9')]=function(_0x3d3fa7,_0x1be1bc){return _0x3d3fa7[_0x91a5('0xa')](_0x91a5('0xb'),attributes,{'tableName':_0x91a5('0xc'),'paranoid':![],'indexes':[{'name':_0x91a5('0xd'),'fields':[_0x91a5('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x2717=['moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api'];(function(_0x123da1,_0x574b5a){var _0x5506cf=function(_0xf429b6){while(--_0xf429b6){_0x123da1['push'](_0x123da1['shift']());}};_0x5506cf(++_0x574b5a);}(_0x2717,0x150));var _0x7271=function(_0x5d5023,_0x13039e){_0x5d5023=_0x5d5023-0x0;var _0x36e17d=_0x2717[_0x5d5023];return _0x36e17d;};'use strict';var _=require(_0x7271('0x0'));var util=require(_0x7271('0x1'));var logger=require(_0x7271('0x2'))(_0x7271('0x3'));var moment=require(_0x7271('0x4'));var BPromise=require(_0x7271('0x5'));var rp=require(_0x7271('0x6'));var fs=require('fs');var path=require(_0x7271('0x7'));var rimraf=require(_0x7271('0x8'));var config=require('../../config/environment');var attributes=require(_0x7271('0x9'));module[_0x7271('0xa')]=function(_0x33e7b6,_0x3510af){return _0x33e7b6[_0x7271('0xb')](_0x7271('0xc'),attributes,{'tableName':_0x7271('0xd'),'paranoid':![],'indexes':[{'name':_0x7271('0xe'),'fields':[_0x7271('0xf'),_0x7271('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index f8bf5c9..31282c7 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 _0x2547=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util'];(function(_0x2891d1,_0x2ddd3e){var _0x486948=function(_0x13fa0f){while(--_0x13fa0f){_0x2891d1['push'](_0x2891d1['shift']());}};_0x486948(++_0x2ddd3e);}(_0x2547,0x1cd));var _0x7254=function(_0x4e81d0,_0x15b3c0){_0x4e81d0=_0x4e81d0-0x0;var _0x3523f8=_0x2547[_0x4e81d0];return _0x3523f8;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var moment=require(_0x7254('0x1'));var BPromise=require(_0x7254('0x2'));var rs=require(_0x7254('0x3'));var fs=require('fs');var Redis=require(_0x7254('0x4'));var db=require(_0x7254('0x5'))['db'];var utils=require(_0x7254('0x6'));var logger=require(_0x7254('0x7'))('rpc');var config=require(_0x7254('0x8'));var jayson=require(_0x7254('0x9'));var client=jayson[_0x7254('0xa')][_0x7254('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b845f,_0x253b1e,_0x6e3d84){return new BPromise(function(_0x395913,_0x5da1ec){return client[_0x7254('0xc')](_0x4b845f,_0x6e3d84)['then'](function(_0x50925f){logger['info'](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));logger[_0x7254('0xf')](_0x7254('0x10'),_0x253b1e,_0x7254('0xe'),JSON[_0x7254('0x11')](_0x50925f));if(_0x50925f['error']){if(_0x50925f[_0x7254('0x12')]['code']===0x1f4){logger[_0x7254('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x5da1ec(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x395913(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}else{logger[_0x7254('0x14')](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));_0x395913(_0x50925f['result'][_0x7254('0x13')]);}})[_0x7254('0x15')](function(_0xf47255){logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0xf47255);_0x5da1ec(_0xf47255);});});} \ No newline at end of file +var _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x523546,_0x3e353b){var _0x3735aa=function(_0x32b26b){while(--_0x32b26b){_0x523546['push'](_0x523546['shift']());}};_0x3735aa(++_0x3e353b);}(_0x2032,0xd9));var _0x2203=function(_0x2f2e22,_0x4406fb){_0x2f2e22=_0x2f2e22-0x0;var _0x1876be=_0x2032[_0x2f2e22];return _0x1876be;};'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')]('VoiceQueuesLog,\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')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('VoiceQueuesLog,\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 diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 24f4b3e..1451806 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 _0x49c6=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x654345,_0x4d01b5){var _0x3cf347=function(_0x104f52){while(--_0x104f52){_0x654345['push'](_0x654345['shift']());}};_0x3cf347(++_0x4d01b5);}(_0x49c6,0x140));var _0x649c=function(_0x5356b6,_0x4d16c9){_0x5356b6=_0x5356b6-0x0;var _0x2e4285=_0x49c6[_0x5356b6];return _0x2e4285;};'use strict';var multer=require(_0x649c('0x0'));var util=require('util');var path=require(_0x649c('0x1'));var timeout=require(_0x649c('0x2'));var express=require(_0x649c('0x3'));var router=express[_0x649c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x649c('0x5'));var config=require(_0x649c('0x6'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x649c('0x7')](),controller[_0x649c('0x8')]);router[_0x649c('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x649c('0xa')]);router[_0x649c('0x9')]('/:id',auth[_0x649c('0x7')](),controller['show']);router[_0x649c('0x9')](_0x649c('0xb'),auth[_0x649c('0x7')](),controller[_0x649c('0xc')]);router['get'](_0x649c('0xd'),controller[_0x649c('0xe')]);router['get'](_0x649c('0xf'),auth[_0x649c('0x7')](),controller[_0x649c('0x10')]);router[_0x649c('0x11')]('/',auth[_0x649c('0x7')](),controller[_0x649c('0x12')]);router[_0x649c('0x11')](_0x649c('0xf'),auth[_0x649c('0x7')](),controller[_0x649c('0x13')]);router[_0x649c('0x14')](_0x649c('0x15'),auth['isAuthenticated'](),controller[_0x649c('0x16')]);router[_0x649c('0x17')](_0x649c('0x15'),auth['isAuthenticated'](),controller[_0x649c('0x18')]);module['exports']=router; \ No newline at end of file +var _0xe99b=['util','express','Router','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','/:id','delete','destroy','exports','multer'];(function(_0x516cc8,_0xfc6c86){var _0x97a26c=function(_0x34fe6e){while(--_0x34fe6e){_0x516cc8['push'](_0x516cc8['shift']());}};_0x97a26c(++_0xfc6c86);}(_0xe99b,0x7c));var _0xbe99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe99b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbe99('0x0'));var util=require(_0xbe99('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe99('0x2'));var router=express[_0xbe99('0x3')]();var auth=require(_0xbe99('0x4'));var interaction=require(_0xbe99('0x5'));var config=require('../../config/environment');var controller=require(_0xbe99('0x6'));router[_0xbe99('0x7')]('/',auth['isAuthenticated'](),controller[_0xbe99('0x8')]);router[_0xbe99('0x7')](_0xbe99('0x9'),auth[_0xbe99('0xa')](),controller[_0xbe99('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xbe99('0xc'),auth[_0xbe99('0xa')](),controller[_0xbe99('0xd')]);router[_0xbe99('0x7')](_0xbe99('0xe'),controller[_0xbe99('0xf')]);router[_0xbe99('0x7')](_0xbe99('0x10'),auth[_0xbe99('0xa')](),controller[_0xbe99('0x11')]);router[_0xbe99('0x12')]('/',auth[_0xbe99('0xa')](),controller['create']);router[_0xbe99('0x12')](_0xbe99('0x10'),auth['isAuthenticated'](),controller[_0xbe99('0x13')]);router[_0xbe99('0x14')](_0xbe99('0x15'),auth['isAuthenticated'](),controller['update']);router[_0xbe99('0x16')]('/:id',auth[_0xbe99('0xa')](),controller[_0xbe99('0x17')]);module[_0xbe99('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 9801b41..005b081 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 _0xbde7=['channel','setDataValue','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','createdAt','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt','format','sequelize','exports','VIRTUAL','getDataValue','value','extname','STRING'];(function(_0x5aa966,_0x3f694f){var _0x48a4a0=function(_0x576452){while(--_0x576452){_0x5aa966['push'](_0x5aa966['shift']());}};_0x48a4a0(++_0x3f694f);}(_0xbde7,0x1b1));var _0x7bde=function(_0x380e21,_0x3782a7){_0x380e21=_0x380e21-0x0;var _0x46b982=_0xbde7[_0x380e21];return _0x46b982;};'use strict';var Sequelize=require(_0x7bde('0x0'));var moment=require('moment');var path=require('path');module[_0x7bde('0x1')]={'format':{'type':Sequelize[_0x7bde('0x2')],'get':function(){return this[_0x7bde('0x3')](_0x7bde('0x4'))?path[_0x7bde('0x5')](this[_0x7bde('0x3')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0x7bde('0x6')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x147d5e){if(_0x147d5e){this['setDataValue'](_0x7bde('0x7'),_0x147d5e);this[_0x7bde('0x8')](_0x7bde('0x9'),_0x147d5e[_0x7bde('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x7bde('0x6')]},'calleridnum':{'type':Sequelize[_0x7bde('0x6')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7bde('0x6')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7bde('0x6')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x7bde('0x6')]},'type':{'type':Sequelize[_0x7bde('0x6')]},'rating':{'type':Sequelize[_0x7bde('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x7bde('0x6')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x7bde('0x6')]},'location':{'type':Sequelize[_0x7bde('0xc')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x7bde('0x6')],'defaultValue':_0x7bde('0xd')},'fileUri':{'type':Sequelize[_0x7bde('0xc')]},'fileText':{'type':Sequelize[_0x7bde('0xc')]},'failureReason':{'type':Sequelize[_0x7bde('0xc')]},'sentiment':{'type':Sequelize[_0x7bde('0x6')]},'sPositive':{'type':Sequelize[_0x7bde('0xe')]},'sNegative':{'type':Sequelize[_0x7bde('0xe')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x7bde('0xe')]},'tempSentiment':{'type':Sequelize[_0x7bde('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x7bde('0x10')))['format'](_0x7bde('0x11'))[_0x7bde('0x12')]();}},'updatedAt':{'type':Sequelize[_0x7bde('0x13')],'get':function(){return moment(this['getDataValue'](_0x7bde('0x14')))[_0x7bde('0x15')]('MM-DD-YYYY\x20HH:mm')[_0x7bde('0x12')]();}}}; \ No newline at end of file +var _0x44cb=['split','INTEGER','NEW','TEXT','FLOAT','BOOLEAN','createdAt','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt','format','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','STRING','setDataValue','channel','membername'];(function(_0x331c23,_0x4d736e){var _0x71e7f9=function(_0x21a2c1){while(--_0x21a2c1){_0x331c23['push'](_0x331c23['shift']());}};_0x71e7f9(++_0x4d736e);}(_0x44cb,0x137));var _0xb44c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x44cb[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb44c('0x0'));var moment=require(_0xb44c('0x1'));var path=require(_0xb44c('0x2'));module[_0xb44c('0x3')]={'format':{'type':Sequelize[_0xb44c('0x4')],'get':function(){return this[_0xb44c('0x5')](_0xb44c('0x6'))?path['extname'](this[_0xb44c('0x5')](_0xb44c('0x6'))):undefined;}},'uniqueid':{'type':Sequelize[_0xb44c('0x7')]},'channel':{'type':Sequelize[_0xb44c('0x7')],'set':function(_0x5eb8f6){if(_0x5eb8f6){this[_0xb44c('0x8')](_0xb44c('0x9'),_0x5eb8f6);this[_0xb44c('0x8')](_0xb44c('0xa'),_0x5eb8f6[_0xb44c('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xb44c('0x7')]},'calleridnum':{'type':Sequelize[_0xb44c('0x7')]},'calleridname':{'type':Sequelize[_0xb44c('0x7')]},'connectedlinenum':{'type':Sequelize[_0xb44c('0x7')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb44c('0x7')]},'context':{'type':Sequelize[_0xb44c('0x7')]},'exten':{'type':Sequelize[_0xb44c('0x7')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb44c('0x7')]},'rating':{'type':Sequelize[_0xb44c('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xb44c('0x7')]},'userDisposition':{'type':Sequelize[_0xb44c('0x7')]},'userSecondDisposition':{'type':Sequelize[_0xb44c('0x7')]},'userThirdDisposition':{'type':Sequelize[_0xb44c('0x7')]},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0xb44c('0x7')]},'transcribeStatus':{'type':Sequelize[_0xb44c('0x7')],'defaultValue':_0xb44c('0xd')},'fileUri':{'type':Sequelize[_0xb44c('0xe')]},'fileText':{'type':Sequelize[_0xb44c('0xe')]},'failureReason':{'type':Sequelize[_0xb44c('0xe')]},'sentiment':{'type':Sequelize[_0xb44c('0x7')]},'sPositive':{'type':Sequelize[_0xb44c('0xf')]},'sNegative':{'type':Sequelize[_0xb44c('0xf')]},'sNeutral':{'type':Sequelize[_0xb44c('0xf')]},'sMixed':{'type':Sequelize[_0xb44c('0xf')]},'tempSentiment':{'type':Sequelize[_0xb44c('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb44c('0x5')](_0xb44c('0x11')))['format'](_0xb44c('0x12'))[_0xb44c('0x13')]();}},'updatedAt':{'type':Sequelize[_0xb44c('0x14')],'get':function(){return moment(this['getDataValue'](_0xb44c('0x15')))[_0xb44c('0x16')](_0xb44c('0x12'))[_0xb44c('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 59a4f0f..cab4368 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 _0x5f9a=['language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','desk.js','to-csv','papaparse','aws-sdk','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','VoiceRecording','fieldName','type','model','differenceBy','map','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','findAll','rows','rawAttributes','include','find','catch','create','body','params','describe','../../components/encryptor','uniqueid','existsSync','decryptFile','secrets','recording','value','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','downloads','sequelize','col','token','push','$and','%s.cypher','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','info','createBucket','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x5f9a,0x1dc));var _0xa5f9=function(_0x44daef,_0x203b11){_0x44daef=_0x44daef-0x0;var _0x6af5fe=_0x5f9a[_0x44daef];return _0x6af5fe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa5f9('0x0'));var rimraf=require(_0xa5f9('0x1'));var zipdir=require(_0xa5f9('0x2'));var jsonpatch=require(_0xa5f9('0x3'));var rp=require('request-promise');var moment=require(_0xa5f9('0x4'));var BPromise=require(_0xa5f9('0x5'));var Mustache=require(_0xa5f9('0x6'));var util=require(_0xa5f9('0x7'));var path=require('path');var sox=require(_0xa5f9('0x8'));var csv=require('to-csv');var ejs=require(_0xa5f9('0x9'));var fs=require('fs');var _=require(_0xa5f9('0xa'));var squel=require(_0xa5f9('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa5f9('0xc'));var toCsv=require(_0xa5f9('0xd'));var querystring=require('querystring');var Papa=require(_0xa5f9('0xe'));var AWS=require(_0xa5f9('0xf'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0xa5f9('0x10'));var qs=require(_0xa5f9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5f9('0x12'));var logger=require(_0xa5f9('0x13'))(_0xa5f9('0x14'));var utils=require(_0xa5f9('0x15'));var config=require(_0xa5f9('0x16'));var licenseUtil=require(_0xa5f9('0x17'));var db=require(_0xa5f9('0x18'))['db'];function respondWithStatusCode(_0x320c0f,_0x4f274a){_0x4f274a=_0x4f274a||0xcc;return function(_0x433a8e){if(_0x433a8e){return _0x320c0f[_0xa5f9('0x19')](_0x4f274a);}return _0x320c0f[_0xa5f9('0x1a')](_0x4f274a)['end']();};}function respondWithResult(_0x42c023,_0xd2d62){_0xd2d62=_0xd2d62||0xc8;return function(_0x218a5d){if(_0x218a5d){return _0x42c023[_0xa5f9('0x1a')](_0xd2d62)[_0xa5f9('0x1b')](_0x218a5d);}};}function respondWithFilteredResult(_0x3b4078,_0x102a0b){return function(_0x2dab95){if(_0x2dab95){var _0x31f069=_0x2dab95[_0xa5f9('0x1c')],_0x3ab0a7=_0x102a0b[_0xa5f9('0x1d')],_0x176046=_0x102a0b[_0xa5f9('0x1d')]+_0x102a0b[_0xa5f9('0x1e')],_0x3c620e;if(_0x176046>=_0x31f069){_0x176046=_0x31f069;_0x3c620e=0xc8;}else{_0x3c620e=0xce;}_0x3b4078['status'](_0x3c620e);return _0x3b4078[_0xa5f9('0x1f')](_0xa5f9('0x20'),_0x3ab0a7+'-'+_0x176046+'/'+_0x31f069)[_0xa5f9('0x1b')](_0x2dab95);}return null;};}function patchUpdates(_0x2fcb5e){return function(_0x5392c2){try{jsonpatch[_0xa5f9('0x21')](_0x5392c2,_0x2fcb5e,!![]);}catch(_0x492e51){return BPromise[_0xa5f9('0x22')](_0x492e51);}return _0x5392c2['save']();};}function saveUpdates(_0x71a374,_0x1935a7){return function(_0x5a9f59){if(_0x5a9f59){return _0x5a9f59[_0xa5f9('0x23')](_0x71a374)[_0xa5f9('0x24')](function(_0xddc408){return _0xddc408;});}return null;};}function removeEntity(_0x57f87c,_0x260a91){return function(_0x5b1fad){if(_0x5b1fad){return _0x5b1fad[_0xa5f9('0x25')]()[_0xa5f9('0x24')](function(){_0x57f87c[_0xa5f9('0x1a')](0xcc)[_0xa5f9('0x26')]();});}};}function handleEntityNotFound(_0x57355f,_0x4caec8){return function(_0x5f7766){if(!_0x5f7766){_0x57355f[_0xa5f9('0x19')](0x194);}return _0x5f7766;};}function handleError(_0x2e710d,_0x417cae){_0x417cae=_0x417cae||0x1f4;return function(_0x3c90fe){logger[_0xa5f9('0x27')](_0x3c90fe[_0xa5f9('0x28')]);if(_0x3c90fe[_0xa5f9('0x29')]){delete _0x3c90fe[_0xa5f9('0x29')];}_0x2e710d[_0xa5f9('0x1a')](_0x417cae)['send'](_0x3c90fe);};}exports[_0xa5f9('0x2a')]=function(_0x3e0732,_0x45b84e){var _0x59aa16={},_0x5675db={},_0x47712e={'count':0x0,'rows':[]};var _0x2f1d44=_['map'](db[_0xa5f9('0x2b')]['rawAttributes'],function(_0x1b3158){return{'name':_0x1b3158[_0xa5f9('0x2c')],'type':_0x1b3158[_0xa5f9('0x2d')]['key']};});_0x5675db[_0xa5f9('0x2e')]=_[_0xa5f9('0x2f')](_[_0xa5f9('0x30')](_0x2f1d44,'name'),[_0xa5f9('0x31')]);_0x5675db[_0xa5f9('0x32')]=_[_0xa5f9('0x33')](_0x3e0732[_0xa5f9('0x32')]);_0x5675db['filters']=_[_0xa5f9('0x34')](_0x5675db[_0xa5f9('0x2e')],_0x5675db[_0xa5f9('0x32')]);_0x59aa16[_0xa5f9('0x35')]=_[_0xa5f9('0x34')](_0x5675db[_0xa5f9('0x2e')],qs[_0xa5f9('0x36')](_0x3e0732[_0xa5f9('0x32')][_0xa5f9('0x36')]));_0x59aa16['attributes']=_0x59aa16[_0xa5f9('0x35')][_0xa5f9('0x37')]?_0x59aa16[_0xa5f9('0x35')]:_0x5675db[_0xa5f9('0x2e')];if(!_0x3e0732['query'][_0xa5f9('0x38')](_0xa5f9('0x39'))){_0x59aa16['limit']=qs[_0xa5f9('0x1e')](_0x3e0732[_0xa5f9('0x32')]['limit']);_0x59aa16[_0xa5f9('0x1d')]=qs[_0xa5f9('0x1d')](_0x3e0732[_0xa5f9('0x32')][_0xa5f9('0x1d')]);}_0x59aa16['order']=qs[_0xa5f9('0x3a')](_0x3e0732['query'][_0xa5f9('0x3a')]);_0x59aa16[_0xa5f9('0x3b')]=qs[_0xa5f9('0x3c')](_['pick'](_0x3e0732['query'],_0x5675db[_0xa5f9('0x3c')]),_0x2f1d44);if(_0x3e0732[_0xa5f9('0x32')][_0xa5f9('0x3d')]){_0x59aa16[_0xa5f9('0x3b')]=_[_0xa5f9('0x3e')](_0x59aa16['where'],{'$or':_[_0xa5f9('0x30')](_0x2f1d44,function(_0x159408){if(_0x159408[_0xa5f9('0x2d')]!=='VIRTUAL'){var _0x135092={};_0x135092[_0x159408['name']]={'$like':'%'+_0x3e0732[_0xa5f9('0x32')]['filter']+'%'};return _0x135092;}})});}_0x59aa16=_['merge']({},_0x59aa16,_0x3e0732[_0xa5f9('0x3f')]);var _0x49d9b3={'where':_0x59aa16[_0xa5f9('0x3b')]};return db[_0xa5f9('0x2b')][_0xa5f9('0x1c')](_0x49d9b3)[_0xa5f9('0x24')](function(_0x355858){_0x47712e[_0xa5f9('0x1c')]=_0x355858;if(_0x3e0732[_0xa5f9('0x32')][_0xa5f9('0x40')]){_0x59aa16['include']=[{'all':!![]}];}return db[_0xa5f9('0x2b')][_0xa5f9('0x41')](_0x59aa16);})[_0xa5f9('0x24')](function(_0x3ca86a){_0x47712e[_0xa5f9('0x42')]=_0x3ca86a;return _0x47712e;})[_0xa5f9('0x24')](respondWithFilteredResult(_0x45b84e,_0x59aa16))['catch'](handleError(_0x45b84e,null));};exports['show']=function(_0x404ab7,_0x1b7ab4){var _0x5211cf={'raw':![],'where':{'id':_0x404ab7['params']['id']}},_0x2bde2e={};_0x2bde2e[_0xa5f9('0x2e')]=_[_0xa5f9('0x33')](db[_0xa5f9('0x2b')][_0xa5f9('0x43')]);_0x2bde2e[_0xa5f9('0x32')]=_[_0xa5f9('0x33')](_0x404ab7[_0xa5f9('0x32')]);_0x2bde2e['filters']=_[_0xa5f9('0x34')](_0x2bde2e[_0xa5f9('0x2e')],_0x2bde2e['query']);_0x5211cf['attributes']=_[_0xa5f9('0x34')](_0x2bde2e[_0xa5f9('0x2e')],qs[_0xa5f9('0x36')](_0x404ab7[_0xa5f9('0x32')][_0xa5f9('0x36')]));_0x5211cf['attributes']=_0x5211cf['attributes'][_0xa5f9('0x37')]?_0x5211cf[_0xa5f9('0x35')]:_0x2bde2e[_0xa5f9('0x2e')];if(_0x404ab7[_0xa5f9('0x32')][_0xa5f9('0x40')]){_0x5211cf[_0xa5f9('0x44')]=[{'all':!![]}];}_0x5211cf=_[_0xa5f9('0x3e')]({},_0x5211cf,_0x404ab7[_0xa5f9('0x3f')]);return db[_0xa5f9('0x2b')][_0xa5f9('0x45')](_0x5211cf)[_0xa5f9('0x24')](handleEntityNotFound(_0x1b7ab4,null))['then'](respondWithResult(_0x1b7ab4,null))[_0xa5f9('0x46')](handleError(_0x1b7ab4,null));};exports[_0xa5f9('0x47')]=function(_0x6a34b0,_0x12d089){return db[_0xa5f9('0x2b')][_0xa5f9('0x47')](_0x6a34b0['body'],{})['then'](respondWithResult(_0x12d089,0xc9))[_0xa5f9('0x46')](handleError(_0x12d089,null));};exports[_0xa5f9('0x23')]=function(_0xbaf9fd,_0x5504bb){if(_0xbaf9fd['body']['id']){delete _0xbaf9fd[_0xa5f9('0x48')]['id'];}return db[_0xa5f9('0x2b')][_0xa5f9('0x45')]({'where':{'id':_0xbaf9fd[_0xa5f9('0x49')]['id']}})[_0xa5f9('0x24')](handleEntityNotFound(_0x5504bb,null))['then'](saveUpdates(_0xbaf9fd[_0xa5f9('0x48')],null))[_0xa5f9('0x24')](respondWithResult(_0x5504bb,null))[_0xa5f9('0x46')](handleError(_0x5504bb,null));};exports[_0xa5f9('0x4a')]=function(_0x2d9213,_0x15a202){return db[_0xa5f9('0x2b')][_0xa5f9('0x4a')]()[_0xa5f9('0x24')](respondWithResult(_0x15a202,null))[_0xa5f9('0x46')](handleError(_0x15a202,null));};exports['download']=function(_0xdc07cf,_0x5ec2a3,_0x4413a3){var _0x200099=require(_0xa5f9('0x4b'));var _0x5b547a=![];var _0x3ca7c5={};if(_0xdc07cf[_0xa5f9('0x32')][_0xa5f9('0x2d')]&&_0xdc07cf[_0xa5f9('0x32')]['type']===_0xa5f9('0x4c')){_0x3ca7c5[_0xa5f9('0x4c')]=_0xdc07cf[_0xa5f9('0x49')]['id'];}else{_0x3ca7c5['id']=_0xdc07cf[_0xa5f9('0x49')]['id'];}return db[_0xa5f9('0x2b')][_0xa5f9('0x45')]({'where':_0x3ca7c5,'attributes':['id','value'],'raw':!![]})[_0xa5f9('0x24')](handleEntityNotFound(_0x5ec2a3,null))[_0xa5f9('0x24')](function(_0x5dada3){if(_0x5dada3){var _0x37de1b=_0x5dada3['value'];var _0x2ab298=util['format']('%s.cypher',_0x37de1b);if(fs[_0xa5f9('0x4d')](_0x2ab298)){_0x5b547a=!![];return _0x200099[_0xa5f9('0x4e')](_0x2ab298,_0x37de1b,config[_0xa5f9('0x4f')][_0xa5f9('0x50')])[_0xa5f9('0x24')](function(){return _0x5dada3;});}return _0x5dada3;}})[_0xa5f9('0x24')](function(_0x3977a0){if(_0x3977a0){var _0x2b1904=_0x3977a0[_0xa5f9('0x51')];if(!fs['existsSync'](_0x2b1904)){throw new db[(_0xa5f9('0x52'))][(_0xa5f9('0x53'))](_0xa5f9('0x54'));}if(_0x3977a0[_0xa5f9('0x55')]){return _0x5ec2a3[_0xa5f9('0x56')](_0x2b1904,_0x3977a0[_0xa5f9('0x55')]+path[_0xa5f9('0x57')](_0x2b1904),function(){if(_0x5b547a){fs[_0xa5f9('0x58')](_0x2b1904);}});}else{return _0x5ec2a3[_0xa5f9('0x56')](_0x2b1904,function(_0x2b0e16){if(_0x5b547a){fs['unlink'](_0x2b1904);}});}}})[_0xa5f9('0x46')](function(_0x103979){if(_0x103979[_0xa5f9('0x59')]===_0xa5f9('0x54')){_0x5ec2a3[_0xa5f9('0x1a')](0x194)['send'](_0xa5f9('0x5a'));}else{return handleError(_0x5ec2a3,null);}});};exports[_0xa5f9('0x5b')]=function(_0x51ca19,_0x4de90e,_0x39826d){var _0x18977e=require(_0xa5f9('0x4b'));var _0x5127aa=![];var _0x42f0d2={'$and':[db[_0xa5f9('0x5c')][_0xa5f9('0x3b')](db[_0xa5f9('0x5c')]['fn']('MD5',db['sequelize'][_0xa5f9('0x5d')](_0xa5f9('0x4c'))),_0x51ca19[_0xa5f9('0x32')][_0xa5f9('0x5e')])]};if(_0x51ca19[_0xa5f9('0x32')][_0xa5f9('0x2d')]&&_0x51ca19[_0xa5f9('0x32')]['type']===_0xa5f9('0x4c')){_0x42f0d2['$and'][_0xa5f9('0x5f')]({'uniqueid':_0x51ca19[_0xa5f9('0x49')]['id']});}else{_0x42f0d2[_0xa5f9('0x60')][_0xa5f9('0x5f')]({'id':_0x51ca19[_0xa5f9('0x49')]['id']});}return db['VoiceRecording'][_0xa5f9('0x45')]({'where':_0x42f0d2,'attributes':['id',_0xa5f9('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x4de90e,null))[_0xa5f9('0x24')](function(_0x47bab7){if(_0x47bab7){var _0x5d1b67=util[_0xa5f9('0x31')](_0xa5f9('0x61'),_0x47bab7[_0xa5f9('0x51')]);if(fs[_0xa5f9('0x4d')](_0x5d1b67)){_0x5127aa=!![];return _0x18977e[_0xa5f9('0x4e')](_0x5d1b67,_0x47bab7[_0xa5f9('0x51')],config[_0xa5f9('0x4f')][_0xa5f9('0x50')])[_0xa5f9('0x24')](function(){return _0x47bab7;});}return _0x47bab7;}})[_0xa5f9('0x24')](function(_0x16f808){if(_0x16f808){if(!fs[_0xa5f9('0x4d')](_0x16f808[_0xa5f9('0x51')])){throw new db['Sequelize'][(_0xa5f9('0x53'))]('VoiceRecording\x20not\x20found');}if(_0x16f808[_0xa5f9('0x55')]){return _0x4de90e[_0xa5f9('0x56')](_0x16f808[_0xa5f9('0x51')],_0x16f808['filename']+path[_0xa5f9('0x57')](_0x16f808[_0xa5f9('0x51')]),function(){if(_0x5127aa){fs[_0xa5f9('0x58')](_0x16f808[_0xa5f9('0x51')]);}});}else{return _0x4de90e[_0xa5f9('0x56')](_0x16f808[_0xa5f9('0x51')],function(_0x23c5d0){if(_0x5127aa){fs[_0xa5f9('0x58')](_0x16f808[_0xa5f9('0x51')]);}});}}})[_0xa5f9('0x46')](handleError(_0x4de90e,null));};exports['destroy']=function(_0x3ff35f,_0x45af2c){return db[_0xa5f9('0x2b')][_0xa5f9('0x45')]({'where':{'id':_0x3ff35f[_0xa5f9('0x49')]['id']}})[_0xa5f9('0x24')](function(_0x4692da){if(!_0x4692da)throw new ReferenceError(_0xa5f9('0x62'));return _0x4692da;})[_0xa5f9('0x24')](function(_0x5f4d0d){var _0x17e689=_0x5f4d0d[_0xa5f9('0x51')];logger['info'](_0xa5f9('0x63'),_0x17e689);if(!_[_0xa5f9('0x64')](_0x5f4d0d['value'])&&fs[_0xa5f9('0x4d')](_0x17e689)){logger['info'](_0xa5f9('0x65')+_0x17e689+_0xa5f9('0x66'));fs[_0xa5f9('0x67')](_0x17e689);}_0x17e689=_0x17e689+'.cypher';if(!_[_0xa5f9('0x64')](_0x5f4d0d[_0xa5f9('0x51')])&&fs[_0xa5f9('0x4d')](_0x17e689)){logger[_0xa5f9('0x68')](_0xa5f9('0x65')+_0x17e689+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa5f9('0x67')](_0x17e689);}return _0x5f4d0d;})[_0xa5f9('0x24')](function(_0x3e45cd){if(!_0x3e45cd)throw new InternalError();return _0x3e45cd[_0xa5f9('0x25')]();})['then'](function(){_0x45af2c[_0xa5f9('0x1a')](0xcc)[_0xa5f9('0x26')]();})['catch'](handleError(_0x45af2c,null));};function getBucketslist(_0x5d391a,_0x272f07,_0x5b75b6){return new Promise(function(_0x236b7c,_0x49e506){var _0x17303e=new AWS['S3']({'accessKeyId':_0x272f07,'secretAccessKey':_0x5d391a,'region':_0x5b75b6});_0x17303e['listBuckets']({},function(_0x294037,_0x8ca735){if(_0x294037){return _0x49e506(_0x294037);}else{return _0x236b7c(_0x8ca735);}});});}function createBucket(_0x1cb61e,_0x398b5a,_0x5c4f58,_0x1b9ee9){return new Promise(function(_0x24f505,_0x53308f){var _0x3a1b75=new AWS['S3']({'accessKeyId':_0x398b5a,'secretAccessKey':_0x1cb61e,'region':_0x5c4f58});_0x3a1b75[_0xa5f9('0x69')]({'Bucket':_0x1b9ee9},function(_0x5d4e32,_0x1c9404){if(_0x5d4e32){return _0x53308f(_0x5d4e32);}else{return _0x24f505(_0x1c9404);}});});}function uploadFile(_0x3eb878,_0x1095da,_0xd9b6eb,_0x478a0b,_0xbd46bd,_0x151c8e){return new Promise(function(_0x56b332,_0x13c8bb){var _0x2686a3=new AWS['S3']({'accessKeyId':_0x1095da,'secretAccessKey':_0x3eb878,'region':_0xd9b6eb});_0x2686a3['upload']({'Bucket':_0x478a0b,'Key':_0xbd46bd,'Body':_0x151c8e},function(_0x497810,_0x25f004){if(_0x497810){return _0x13c8bb(_0x497810);}else{return _0x56b332(_0x25f004);}});});}function startTranscribe(_0x79a5ae,_0x4f439f,_0x59bbd4,_0x43938a,_0x557533,_0x2ec1d3){return new Promise(function(_0x17414a,_0x2e997b){var _0x5f032c=new AWS[(_0xa5f9('0x6a'))]({'accessKeyId':_0x4f439f,'secretAccessKey':_0x79a5ae,'region':_0x59bbd4});_0x5f032c[_0xa5f9('0x6b')]({'TranscriptionJobName':_0x43938a,'LanguageCode':_0x557533,'Media':{'MediaFileUri':_0x2ec1d3}},function(_0x2546ae,_0x1471c7){if(_0x2546ae){return _0x2e997b(_0x2546ae);}else{return _0x17414a(_0x1471c7);}});});}function transcribe(_0x2e801d,_0x34a70e,_0x4cfcda,_0x4fd0b3,_0xb7495,_0x28484c,_0x3d992c){return new Promise(function(_0x205c56,_0x1f6366){var _0x41e10a={};logger['info'](util[_0xa5f9('0x31')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x2e801d,_0xb7495));return uploadFile(_0x34a70e,_0x4cfcda,_0x4fd0b3,_0xb7495,path[_0xa5f9('0x6c')](_0x28484c),fs[_0xa5f9('0x6d')](_0x28484c))['then'](function(_0x2082eb){logger['info'](util[_0xa5f9('0x31')](_0xa5f9('0x6e'),_0x2e801d,_0xb7495,_0x2082eb[_0xa5f9('0x6f')]));_0x41e10a['bucket']=_0x2082eb[_0xa5f9('0x70')];_0x41e10a[_0xa5f9('0x71')]=_0x2082eb[_0xa5f9('0x6f')];logger['info'](util[_0xa5f9('0x31')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x2e801d));return startTranscribe(_0x34a70e,_0x4cfcda,_0x4fd0b3,uuidv4(),_0x3d992c,_0x2082eb[_0xa5f9('0x6f')]);})['then'](function(_0x3c50b8){logger[_0xa5f9('0x68')](util[_0xa5f9('0x31')](_0xa5f9('0x72'),_0x2e801d,_0x3c50b8[_0xa5f9('0x73')][_0xa5f9('0x74')]));_0x41e10a[_0xa5f9('0x75')]=_0x3c50b8[_0xa5f9('0x73')][_0xa5f9('0x74')];_0x41e10a[_0xa5f9('0x76')]=_0x3c50b8[_0xa5f9('0x73')]['TranscriptionJobStatus'];return _0x205c56(_0x41e10a);})[_0xa5f9('0x46')](function(_0x8a93e0){return _0x1f6366(_0x8a93e0);});});}exports[_0xa5f9('0x77')]=function(_0x4fbb0a,_0x1d1b6d,_0x41ce46){var _0x285975;var _0x2f4473;var _0x3675dd;var _0x149c6b=require(_0xa5f9('0x4b'));return db[_0xa5f9('0x2b')]['findOne']({'where':{'id':_0x4fbb0a[_0xa5f9('0x49')]['id']}})[_0xa5f9('0x24')](function(_0x1f967a){if(_0x1f967a){var _0x4a15fb=util['format'](_0xa5f9('0x61'),_0x1f967a[_0xa5f9('0x51')]);if(fs['existsSync'](_0x4a15fb)){cypher=!![];return _0x149c6b[_0xa5f9('0x4e')](_0x4a15fb,_0x1f967a[_0xa5f9('0x51')],config['secrets'][_0xa5f9('0x50')])[_0xa5f9('0x24')](function(){return _0x1f967a;});}return _0x1f967a;}})[_0xa5f9('0x24')](function(_0xf84d4a){if(!_0xf84d4a){throw new db[(_0xa5f9('0x52'))][(_0xa5f9('0x53'))](_0xa5f9('0x78'));}_0x2f4473=_0xf84d4a;return db[_0xa5f9('0x79')][_0xa5f9('0x7a')]({'where':{'id':0x1}});})[_0xa5f9('0x24')](handleEntityNotFound(_0x1d1b6d,null))['then'](function(_0x461b9d){if(_0x461b9d){_0x285975=_0x461b9d;if(!_0x285975[_0xa5f9('0x7b')]||!_0x285975['transcribeAccountId']||!_0x285975['transcribeRegion']||!_0x285975[_0xa5f9('0x7c')]||!_0x285975[_0xa5f9('0x7d')]){throw new db[(_0xa5f9('0x52'))][(_0xa5f9('0x53'))](_0xa5f9('0x7e'));}if(_0x4fbb0a['body'][_0xa5f9('0x7f')]&&(!_0x285975[_0xa5f9('0x80')]||!_0x285975[_0xa5f9('0x81')]||!_0x285975[_0xa5f9('0x82')]||!_0x285975['language']||!_0x285975[_0xa5f9('0x7d')])){throw new db[(_0xa5f9('0x52'))][(_0xa5f9('0x53'))](_0xa5f9('0x83'));}return db['CloudProvider'][_0xa5f9('0x7a')]({'where':{'id':_0x285975[_0xa5f9('0x84')]}});}})['then'](function(_0x409a4d){if(!_0x409a4d){throw new db[(_0xa5f9('0x52'))][(_0xa5f9('0x53'))](_0xa5f9('0x85'));}if(!_0x409a4d[_0xa5f9('0x86')]||!_0x409a4d['data2']){throw new db[(_0xa5f9('0x52'))][(_0xa5f9('0x53'))](_0xa5f9('0x87'));}_0x3675dd=_0x409a4d;return getBucketslist(_0x3675dd[_0xa5f9('0x86')],_0x3675dd['data2'],_0x285975[_0xa5f9('0x88')]);})['then'](function(_0x217d97){if(_0x217d97&&_0x217d97[_0xa5f9('0x89')]){var _0x1441b6=_['find'](_0x217d97['Buckets'],function(_0x3bdcbc){return _0x3bdcbc[_0xa5f9('0x8a')]===_0x285975[_0xa5f9('0x7d')];});if(!_0x1441b6){logger[_0xa5f9('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x4fbb0a[_0xa5f9('0x49')]['id'],_0x285975['bucket']));return createBucket(_0x3675dd[_0xa5f9('0x86')],_0x3675dd[_0xa5f9('0x8b')],_0x285975[_0xa5f9('0x88')],_0x285975[_0xa5f9('0x7d')]);}logger[_0xa5f9('0x68')](util['format'](_0xa5f9('0x8c'),_0x4fbb0a[_0xa5f9('0x49')]['id'],_0x285975[_0xa5f9('0x7d')]));return;}})['then'](function(_0x5b15b2){if(_0x2f4473[_0xa5f9('0x76')]===_0xa5f9('0x8d')){return transcribe(_0x4fbb0a[_0xa5f9('0x49')]['id'],_0x3675dd['data1'],_0x3675dd[_0xa5f9('0x8b')],_0x285975[_0xa5f9('0x88')],_0x285975[_0xa5f9('0x7d')],_0x2f4473[_0xa5f9('0x51')],_0x285975[_0xa5f9('0x7c')]);}else{logger['info'](util['format'](_0xa5f9('0x8e'),_0x4fbb0a['params']['id']));return{'transcribeStatus':_0xa5f9('0x8f')};}})[_0xa5f9('0x24')](function(_0x37ee33){if(_0x37ee33){_0x37ee33['tempSentiment']=_0x4fbb0a[_0xa5f9('0x48')][_0xa5f9('0x7f')];return _0x2f4473[_0xa5f9('0x90')](_0x37ee33);}})[_0xa5f9('0x24')](respondWithResult(_0x1d1b6d,null))[_0xa5f9('0x46')](handleError(_0x1d1b6d,null));};function writeFile(_0x1e6c06,_0x1975b8){return new Promise(function(_0x3fc970,_0x2493de){fs[_0xa5f9('0x91')](_0x1975b8,_0x1e6c06,function(_0x35aebf,_0x574390){if(_0x35aebf){return _0x2493de(_0x35aebf);}else{return _0x3fc970(_0x574390);}});});}exports['downloadTranscribe']=function(_0x4a2d4b,_0x4ba17b,_0x1eeac3){return db[_0xa5f9('0x2b')][_0xa5f9('0x7a')]({'where':{'id':_0x4a2d4b[_0xa5f9('0x49')]['id']}})[_0xa5f9('0x24')](handleEntityNotFound(_0x4ba17b))[_0xa5f9('0x24')](function(_0x3bd6d0){if(_0x3bd6d0&&_0x3bd6d0['fileText']){var _0x5103cf=_0x3bd6d0[_0xa5f9('0x92')];var _0x23a702=config[_0xa5f9('0x93')]+_0xa5f9('0x94')+_0x3bd6d0['id']+'.txt';if(fs['existsSync'](_0x23a702)){return _0x23a702;}return writeFile(_0x5103cf,_0x23a702)[_0xa5f9('0x24')](function(){return _0x23a702;});}else{throw new db[(_0xa5f9('0x52'))][(_0xa5f9('0x53'))](_0xa5f9('0x95'));}})[_0xa5f9('0x24')](function(_0x292775){return _0x4ba17b['download'](_0x292775);})[_0xa5f9('0x46')](handleError(_0x4ba17b));}; \ No newline at end of file +var _0x4490=['[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','destroy','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','catch','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','col','$and','push','Sequelize','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available'];(function(_0x2ff127,_0x3d6e2b){var _0x53af48=function(_0x4a0c47){while(--_0x4a0c47){_0x2ff127['push'](_0x2ff127['shift']());}};_0x53af48(++_0x3d6e2b);}(_0x4490,0x13f));var _0x0449=function(_0x29b75e,_0x1944d5){_0x29b75e=_0x29b75e-0x0;var _0x154b73=_0x4490[_0x29b75e];return _0x154b73;};'use strict';var pdf=require(_0x0449('0x0'));var emlformat=require(_0x0449('0x1'));var rimraf=require(_0x0449('0x2'));var zipdir=require(_0x0449('0x3'));var jsonpatch=require(_0x0449('0x4'));var rp=require('request-promise');var moment=require(_0x0449('0x5'));var BPromise=require(_0x0449('0x6'));var Mustache=require(_0x0449('0x7'));var util=require(_0x0449('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0449('0x9'));var ejs=require(_0x0449('0xa'));var fs=require('fs');var _=require(_0x0449('0xb'));var squel=require(_0x0449('0xc'));var crypto=require(_0x0449('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0449('0xe'));var toCsv=require(_0x0449('0x9'));var querystring=require('querystring');var Papa=require(_0x0449('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0x0449('0x10'));var Redis=require(_0x0449('0x11'));var authService=require(_0x0449('0x12'));var qs=require(_0x0449('0x13'));var as=require(_0x0449('0x14'));var hardwareService=require(_0x0449('0x15'));var logger=require(_0x0449('0x16'))(_0x0449('0x17'));var utils=require('../../config/utils');var config=require(_0x0449('0x18'));var licenseUtil=require(_0x0449('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53e3e2,_0x53fc74){_0x53fc74=_0x53fc74||0xcc;return function(_0x5ac74d){if(_0x5ac74d){return _0x53e3e2[_0x0449('0x1a')](_0x53fc74);}return _0x53e3e2[_0x0449('0x1b')](_0x53fc74)[_0x0449('0x1c')]();};}function respondWithResult(_0x1e1160,_0x5a76d0){_0x5a76d0=_0x5a76d0||0xc8;return function(_0x35e6f1){if(_0x35e6f1){return _0x1e1160[_0x0449('0x1b')](_0x5a76d0)[_0x0449('0x1d')](_0x35e6f1);}};}function respondWithFilteredResult(_0x3f58ef,_0x2aea9c){return function(_0x5a140f){if(_0x5a140f){var _0x362dc1=_0x5a140f[_0x0449('0x1e')],_0x37bd71=_0x2aea9c[_0x0449('0x1f')],_0x1cc2a9=_0x2aea9c[_0x0449('0x1f')]+_0x2aea9c[_0x0449('0x20')],_0x246cb6;if(_0x1cc2a9>=_0x362dc1){_0x1cc2a9=_0x362dc1;_0x246cb6=0xc8;}else{_0x246cb6=0xce;}_0x3f58ef[_0x0449('0x1b')](_0x246cb6);return _0x3f58ef['set'](_0x0449('0x21'),_0x37bd71+'-'+_0x1cc2a9+'/'+_0x362dc1)[_0x0449('0x1d')](_0x5a140f);}return null;};}function patchUpdates(_0x159f66){return function(_0x4b89fb){try{jsonpatch[_0x0449('0x22')](_0x4b89fb,_0x159f66,!![]);}catch(_0x4f4259){return BPromise['reject'](_0x4f4259);}return _0x4b89fb['save']();};}function saveUpdates(_0x2607cf,_0x4d9b15){return function(_0x48c5c7){if(_0x48c5c7){return _0x48c5c7[_0x0449('0x23')](_0x2607cf)[_0x0449('0x24')](function(_0x422342){return _0x422342;});}return null;};}function removeEntity(_0x1da3c4,_0x3fb131){return function(_0x14358d){if(_0x14358d){return _0x14358d[_0x0449('0x25')]()[_0x0449('0x24')](function(){_0x1da3c4[_0x0449('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd95d62,_0x4c28f5){return function(_0x1e186c){if(!_0x1e186c){_0xd95d62[_0x0449('0x1a')](0x194);}return _0x1e186c;};}function handleError(_0x5a9a5b,_0x435377){_0x435377=_0x435377||0x1f4;return function(_0x4884ba){logger[_0x0449('0x26')](_0x4884ba['stack']);if(_0x4884ba[_0x0449('0x27')]){delete _0x4884ba[_0x0449('0x27')];}_0x5a9a5b[_0x0449('0x1b')](_0x435377)[_0x0449('0x28')](_0x4884ba);};}exports[_0x0449('0x29')]=function(_0x2ba3f8,_0x3c064e){var _0x8362e={},_0x1eccab={},_0x1a998c={'count':0x0,'rows':[]};var _0x3703d3=_[_0x0449('0x2a')](db[_0x0449('0x2b')][_0x0449('0x2c')],function(_0x11e4e6){return{'name':_0x11e4e6[_0x0449('0x2d')],'type':_0x11e4e6[_0x0449('0x2e')]['key']};});_0x1eccab[_0x0449('0x2f')]=_[_0x0449('0x30')](_[_0x0449('0x2a')](_0x3703d3,_0x0449('0x27')),[_0x0449('0x31')]);_0x1eccab[_0x0449('0x32')]=_[_0x0449('0x33')](_0x2ba3f8[_0x0449('0x32')]);_0x1eccab[_0x0449('0x34')]=_[_0x0449('0x35')](_0x1eccab[_0x0449('0x2f')],_0x1eccab['query']);_0x8362e[_0x0449('0x36')]=_[_0x0449('0x35')](_0x1eccab[_0x0449('0x2f')],qs[_0x0449('0x37')](_0x2ba3f8['query'][_0x0449('0x37')]));_0x8362e[_0x0449('0x36')]=_0x8362e['attributes'][_0x0449('0x38')]?_0x8362e[_0x0449('0x36')]:_0x1eccab[_0x0449('0x2f')];if(!_0x2ba3f8[_0x0449('0x32')][_0x0449('0x39')]('nolimit')){_0x8362e[_0x0449('0x20')]=qs[_0x0449('0x20')](_0x2ba3f8[_0x0449('0x32')][_0x0449('0x20')]);_0x8362e[_0x0449('0x1f')]=qs[_0x0449('0x1f')](_0x2ba3f8[_0x0449('0x32')]['offset']);}_0x8362e[_0x0449('0x3a')]=qs[_0x0449('0x3b')](_0x2ba3f8['query']['sort']);_0x8362e['where']=qs[_0x0449('0x34')](_[_0x0449('0x3c')](_0x2ba3f8[_0x0449('0x32')],_0x1eccab[_0x0449('0x34')]),_0x3703d3);if(_0x2ba3f8[_0x0449('0x32')]['filter']){_0x8362e['where']=_[_0x0449('0x3d')](_0x8362e[_0x0449('0x3e')],{'$or':_[_0x0449('0x2a')](_0x3703d3,function(_0x1c0ad4){if(_0x1c0ad4[_0x0449('0x2e')]!==_0x0449('0x3f')){var _0x1705bc={};_0x1705bc[_0x1c0ad4[_0x0449('0x27')]]={'$like':'%'+_0x2ba3f8[_0x0449('0x32')][_0x0449('0x40')]+'%'};return _0x1705bc;}})});}_0x8362e=_[_0x0449('0x3d')]({},_0x8362e,_0x2ba3f8[_0x0449('0x41')]);var _0x3ac8c3={'where':_0x8362e[_0x0449('0x3e')]};return db[_0x0449('0x2b')][_0x0449('0x1e')](_0x3ac8c3)[_0x0449('0x24')](function(_0x1970cb){_0x1a998c[_0x0449('0x1e')]=_0x1970cb;if(_0x2ba3f8[_0x0449('0x32')][_0x0449('0x42')]){_0x8362e[_0x0449('0x43')]=[{'all':!![]}];}return db[_0x0449('0x2b')][_0x0449('0x44')](_0x8362e);})[_0x0449('0x24')](function(_0x4eaadf){_0x1a998c[_0x0449('0x45')]=_0x4eaadf;return _0x1a998c;})['then'](respondWithFilteredResult(_0x3c064e,_0x8362e))['catch'](handleError(_0x3c064e,null));};exports[_0x0449('0x46')]=function(_0xdce384,_0x497239){var _0x14222c={'raw':![],'where':{'id':_0xdce384[_0x0449('0x47')]['id']}},_0x3bd582={};_0x3bd582[_0x0449('0x2f')]=_[_0x0449('0x33')](db['VoiceRecording']['rawAttributes']);_0x3bd582[_0x0449('0x32')]=_[_0x0449('0x33')](_0xdce384[_0x0449('0x32')]);_0x3bd582['filters']=_[_0x0449('0x35')](_0x3bd582['model'],_0x3bd582[_0x0449('0x32')]);_0x14222c[_0x0449('0x36')]=_[_0x0449('0x35')](_0x3bd582[_0x0449('0x2f')],qs[_0x0449('0x37')](_0xdce384[_0x0449('0x32')][_0x0449('0x37')]));_0x14222c['attributes']=_0x14222c['attributes'][_0x0449('0x38')]?_0x14222c[_0x0449('0x36')]:_0x3bd582['model'];if(_0xdce384['query'][_0x0449('0x42')]){_0x14222c['include']=[{'all':!![]}];}_0x14222c=_[_0x0449('0x3d')]({},_0x14222c,_0xdce384[_0x0449('0x41')]);return db[_0x0449('0x2b')]['find'](_0x14222c)[_0x0449('0x24')](handleEntityNotFound(_0x497239,null))[_0x0449('0x24')](respondWithResult(_0x497239,null))[_0x0449('0x48')](handleError(_0x497239,null));};exports['create']=function(_0x40ccd6,_0x230fbc){return db['VoiceRecording']['create'](_0x40ccd6[_0x0449('0x49')],{})['then'](respondWithResult(_0x230fbc,0xc9))[_0x0449('0x48')](handleError(_0x230fbc,null));};exports['update']=function(_0x7312c1,_0x5c3e2a){if(_0x7312c1[_0x0449('0x49')]['id']){delete _0x7312c1[_0x0449('0x49')]['id'];}return db[_0x0449('0x2b')][_0x0449('0x4a')]({'where':{'id':_0x7312c1[_0x0449('0x47')]['id']}})['then'](handleEntityNotFound(_0x5c3e2a,null))[_0x0449('0x24')](saveUpdates(_0x7312c1[_0x0449('0x49')],null))[_0x0449('0x24')](respondWithResult(_0x5c3e2a,null))[_0x0449('0x48')](handleError(_0x5c3e2a,null));};exports[_0x0449('0x4b')]=function(_0x1fd441,_0x594455){return db['VoiceRecording'][_0x0449('0x4b')]()[_0x0449('0x24')](respondWithResult(_0x594455,null))[_0x0449('0x48')](handleError(_0x594455,null));};exports[_0x0449('0x4c')]=function(_0x337df0,_0x352e4a,_0x2a4dc5){var _0x168703=require(_0x0449('0x4d'));var _0x16a109=![];var _0x3df924={};if(_0x337df0[_0x0449('0x32')]['type']&&_0x337df0[_0x0449('0x32')][_0x0449('0x2e')]===_0x0449('0x4e')){_0x3df924['uniqueid']=_0x337df0[_0x0449('0x47')]['id'];}else{_0x3df924['id']=_0x337df0[_0x0449('0x47')]['id'];}return db['VoiceRecording'][_0x0449('0x4a')]({'where':_0x3df924,'attributes':['id',_0x0449('0x4f')],'raw':!![]})[_0x0449('0x24')](handleEntityNotFound(_0x352e4a,null))[_0x0449('0x24')](function(_0x26a64e){if(_0x26a64e){var _0x496b86=_0x26a64e[_0x0449('0x4f')];var _0x25246f=util['format'](_0x0449('0x50'),_0x496b86);if(fs[_0x0449('0x51')](_0x25246f)){_0x16a109=!![];return _0x168703[_0x0449('0x52')](_0x25246f,_0x496b86,config[_0x0449('0x53')][_0x0449('0x54')])[_0x0449('0x24')](function(){return _0x26a64e;});}return _0x26a64e;}})[_0x0449('0x24')](function(_0xbec7a3){if(_0xbec7a3){var _0x1bf65f=_0xbec7a3[_0x0449('0x4f')];if(!fs['existsSync'](_0x1bf65f)){throw new db['Sequelize'][(_0x0449('0x55'))](_0x0449('0x56'));}if(_0xbec7a3['filename']){return _0x352e4a[_0x0449('0x4c')](_0x1bf65f,_0xbec7a3[_0x0449('0x57')]+path[_0x0449('0x58')](_0x1bf65f),function(){if(_0x16a109){fs[_0x0449('0x59')](_0x1bf65f);}});}else{return _0x352e4a['download'](_0x1bf65f,function(_0x6fefdc){if(_0x16a109){fs['unlink'](_0x1bf65f);}});}}})[_0x0449('0x48')](function(_0x253a50){if(_0x253a50[_0x0449('0x5a')]===_0x0449('0x56')){_0x352e4a[_0x0449('0x1b')](0x194)['send'](_0x0449('0x5b'));}else{return handleError(_0x352e4a,null);}});};exports['downloads']=function(_0x4d1ec6,_0x4bceb9,_0x2176cb){var _0x38d2c1=require('../../components/encryptor');var _0x4190f4=![];var _0x416bce={'$and':[db[_0x0449('0x5c')][_0x0449('0x3e')](db[_0x0449('0x5c')]['fn']('MD5',db[_0x0449('0x5c')][_0x0449('0x5d')](_0x0449('0x4e'))),_0x4d1ec6['query']['token'])]};if(_0x4d1ec6[_0x0449('0x32')][_0x0449('0x2e')]&&_0x4d1ec6[_0x0449('0x32')][_0x0449('0x2e')]===_0x0449('0x4e')){_0x416bce[_0x0449('0x5e')][_0x0449('0x5f')]({'uniqueid':_0x4d1ec6[_0x0449('0x47')]['id']});}else{_0x416bce['$and'][_0x0449('0x5f')]({'id':_0x4d1ec6[_0x0449('0x47')]['id']});}return db[_0x0449('0x2b')]['find']({'where':_0x416bce,'attributes':['id',_0x0449('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x4bceb9,null))[_0x0449('0x24')](function(_0x2be221){if(_0x2be221){var _0x2219bc=util['format'](_0x0449('0x50'),_0x2be221[_0x0449('0x4f')]);if(fs[_0x0449('0x51')](_0x2219bc)){_0x4190f4=!![];return _0x38d2c1['decryptFile'](_0x2219bc,_0x2be221['value'],config['secrets'][_0x0449('0x54')])[_0x0449('0x24')](function(){return _0x2be221;});}return _0x2be221;}})[_0x0449('0x24')](function(_0x54e141){if(_0x54e141){if(!fs['existsSync'](_0x54e141['value'])){throw new db[(_0x0449('0x60'))][(_0x0449('0x55'))](_0x0449('0x56'));}if(_0x54e141[_0x0449('0x57')]){return _0x4bceb9[_0x0449('0x4c')](_0x54e141[_0x0449('0x4f')],_0x54e141[_0x0449('0x57')]+path[_0x0449('0x58')](_0x54e141[_0x0449('0x4f')]),function(){if(_0x4190f4){fs[_0x0449('0x59')](_0x54e141[_0x0449('0x4f')]);}});}else{return _0x4bceb9[_0x0449('0x4c')](_0x54e141[_0x0449('0x4f')],function(_0x598e43){if(_0x4190f4){fs[_0x0449('0x59')](_0x54e141[_0x0449('0x4f')]);}});}}})[_0x0449('0x48')](handleError(_0x4bceb9,null));};exports[_0x0449('0x25')]=function(_0x1ba290,_0x32227a){return db[_0x0449('0x2b')][_0x0449('0x4a')]({'where':{'id':_0x1ba290[_0x0449('0x47')]['id']}})[_0x0449('0x24')](function(_0x147050){if(!_0x147050)throw new ReferenceError(_0x0449('0x61'));return _0x147050;})[_0x0449('0x24')](function(_0x3e24d3){var _0x389876=_0x3e24d3[_0x0449('0x4f')];logger['info'](_0x0449('0x62'),_0x389876);if(!_[_0x0449('0x63')](_0x3e24d3[_0x0449('0x4f')])&&fs['existsSync'](_0x389876)){logger[_0x0449('0x64')](_0x0449('0x65')+_0x389876+_0x0449('0x66'));fs[_0x0449('0x67')](_0x389876);}_0x389876=_0x389876+_0x0449('0x68');if(!_[_0x0449('0x63')](_0x3e24d3[_0x0449('0x4f')])&&fs[_0x0449('0x51')](_0x389876)){logger[_0x0449('0x64')]('File:\x20\x22'+_0x389876+_0x0449('0x66'));fs[_0x0449('0x67')](_0x389876);}return _0x3e24d3;})['then'](function(_0xbc03af){if(!_0xbc03af)throw new InternalError();return _0xbc03af[_0x0449('0x25')]();})[_0x0449('0x24')](function(){_0x32227a[_0x0449('0x1b')](0xcc)[_0x0449('0x1c')]();})[_0x0449('0x48')](handleError(_0x32227a,null));};function getBucketslist(_0x27968e,_0xac7315,_0x7691dc){return new Promise(function(_0x46158f,_0x5b0858){var _0x1e9c4a=new AWS['S3']({'accessKeyId':_0xac7315,'secretAccessKey':_0x27968e,'region':_0x7691dc});_0x1e9c4a[_0x0449('0x69')]({},function(_0x2ab9c4,_0xdbf69b){if(_0x2ab9c4){return _0x5b0858(_0x2ab9c4);}else{return _0x46158f(_0xdbf69b);}});});}function createBucket(_0x505b56,_0xd621ce,_0xfb7315,_0x3a312b){return new Promise(function(_0x5a6809,_0x381ab9){var _0x1ca211=new AWS['S3']({'accessKeyId':_0xd621ce,'secretAccessKey':_0x505b56,'region':_0xfb7315});_0x1ca211[_0x0449('0x6a')]({'Bucket':_0x3a312b},function(_0x59a328,_0x133dda){if(_0x59a328){return _0x381ab9(_0x59a328);}else{return _0x5a6809(_0x133dda);}});});}function uploadFile(_0x3de146,_0x1629f1,_0x3f178c,_0x30c223,_0x43a837,_0x2b8c12){return new Promise(function(_0x3c7157,_0x2a3d2b){var _0x1804d3=new AWS['S3']({'accessKeyId':_0x1629f1,'secretAccessKey':_0x3de146,'region':_0x3f178c});_0x1804d3[_0x0449('0x6b')]({'Bucket':_0x30c223,'Key':_0x43a837,'Body':_0x2b8c12},function(_0x2d0883,_0x15b2cc){if(_0x2d0883){return _0x2a3d2b(_0x2d0883);}else{return _0x3c7157(_0x15b2cc);}});});}function startTranscribe(_0x26aa7b,_0x3f8ec5,_0x36f428,_0x1a6bf3,_0x4e46c3,_0xffdb3a){return new Promise(function(_0x50cfb0,_0x175776){var _0x2237ce=new AWS[(_0x0449('0x6c'))]({'accessKeyId':_0x3f8ec5,'secretAccessKey':_0x26aa7b,'region':_0x36f428});_0x2237ce['startTranscriptionJob']({'TranscriptionJobName':_0x1a6bf3,'LanguageCode':_0x4e46c3,'Media':{'MediaFileUri':_0xffdb3a}},function(_0x106fdf,_0x4fdee9){if(_0x106fdf){return _0x175776(_0x106fdf);}else{return _0x50cfb0(_0x4fdee9);}});});}function transcribe(_0x110b65,_0x298f92,_0x5950f3,_0x49d3d4,_0x303ad9,_0x55c4c0,_0x208b09){return new Promise(function(_0x9f26a2,_0x1ed370){var _0x3e74db={};logger[_0x0449('0x64')](util[_0x0449('0x31')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x110b65,_0x303ad9));return uploadFile(_0x298f92,_0x5950f3,_0x49d3d4,_0x303ad9,path[_0x0449('0x6d')](_0x55c4c0),fs[_0x0449('0x6e')](_0x55c4c0))[_0x0449('0x24')](function(_0x41408b){logger[_0x0449('0x64')](util[_0x0449('0x31')](_0x0449('0x6f'),_0x110b65,_0x303ad9,_0x41408b[_0x0449('0x70')]));_0x3e74db[_0x0449('0x71')]=_0x41408b[_0x0449('0x72')];_0x3e74db['location']=_0x41408b['Location'];logger[_0x0449('0x64')](util[_0x0449('0x31')](_0x0449('0x73'),_0x110b65));return startTranscribe(_0x298f92,_0x5950f3,_0x49d3d4,uuidv4(),_0x208b09,_0x41408b['Location']);})[_0x0449('0x24')](function(_0x31e640){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x110b65,_0x31e640[_0x0449('0x74')][_0x0449('0x75')]));_0x3e74db[_0x0449('0x76')]=_0x31e640[_0x0449('0x74')][_0x0449('0x75')];_0x3e74db[_0x0449('0x77')]=_0x31e640[_0x0449('0x74')][_0x0449('0x78')];return _0x9f26a2(_0x3e74db);})[_0x0449('0x48')](function(_0x2b1fd7){return _0x1ed370(_0x2b1fd7);});});}exports[_0x0449('0x79')]=function(_0x28db45,_0x121436,_0x455f9d){var _0x2aa98b;var _0xc3f168;var _0x4c6502;var _0x453053=require('../../components/encryptor');return db[_0x0449('0x2b')][_0x0449('0x7a')]({'where':{'id':_0x28db45[_0x0449('0x47')]['id']}})[_0x0449('0x24')](function(_0x31e6ab){if(_0x31e6ab){var _0x486722=util['format'](_0x0449('0x50'),_0x31e6ab[_0x0449('0x4f')]);if(fs['existsSync'](_0x486722)){cypher=!![];return _0x453053[_0x0449('0x52')](_0x486722,_0x31e6ab[_0x0449('0x4f')],config[_0x0449('0x53')][_0x0449('0x54')])['then'](function(){return _0x31e6ab;});}return _0x31e6ab;}})[_0x0449('0x24')](function(_0x47e712){if(!_0x47e712){throw new db[(_0x0449('0x60'))][(_0x0449('0x55'))]('Voice\x20Recording\x20not\x20found');}_0xc3f168=_0x47e712;return db['Setting'][_0x0449('0x7a')]({'where':{'id':0x1}});})[_0x0449('0x24')](handleEntityNotFound(_0x121436,null))['then'](function(_0x191de1){if(_0x191de1){_0x2aa98b=_0x191de1;if(!_0x2aa98b[_0x0449('0x7b')]||!_0x2aa98b[_0x0449('0x7c')]||!_0x2aa98b[_0x0449('0x7d')]||!_0x2aa98b[_0x0449('0x7e')]||!_0x2aa98b[_0x0449('0x71')]){throw new db[(_0x0449('0x60'))][(_0x0449('0x55'))](_0x0449('0x7f'));}if(_0x28db45['body'][_0x0449('0x80')]&&(!_0x2aa98b[_0x0449('0x81')]||!_0x2aa98b[_0x0449('0x82')]||!_0x2aa98b[_0x0449('0x83')]||!_0x2aa98b[_0x0449('0x7e')]||!_0x2aa98b['bucket'])){throw new db[(_0x0449('0x60'))][(_0x0449('0x55'))](_0x0449('0x84'));}return db[_0x0449('0x85')]['findOne']({'where':{'id':_0x2aa98b[_0x0449('0x7c')]}});}})[_0x0449('0x24')](function(_0xde66dd){if(!_0xde66dd){throw new db[(_0x0449('0x60'))][(_0x0449('0x55'))](_0x0449('0x86'));}if(!_0xde66dd[_0x0449('0x87')]||!_0xde66dd[_0x0449('0x88')]){throw new db[(_0x0449('0x60'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x4c6502=_0xde66dd;return getBucketslist(_0x4c6502['data1'],_0x4c6502[_0x0449('0x88')],_0x2aa98b[_0x0449('0x7d')]);})[_0x0449('0x24')](function(_0x451a63){if(_0x451a63&&_0x451a63[_0x0449('0x89')]){var _0x1c0be5=_['find'](_0x451a63['Buckets'],function(_0x467d77){return _0x467d77[_0x0449('0x8a')]===_0x2aa98b[_0x0449('0x71')];});if(!_0x1c0be5){logger[_0x0449('0x64')](util[_0x0449('0x31')](_0x0449('0x8b'),_0x28db45[_0x0449('0x47')]['id'],_0x2aa98b['bucket']));return createBucket(_0x4c6502[_0x0449('0x87')],_0x4c6502[_0x0449('0x88')],_0x2aa98b[_0x0449('0x7d')],_0x2aa98b[_0x0449('0x71')]);}logger['info'](util[_0x0449('0x31')](_0x0449('0x8c'),_0x28db45['params']['id'],_0x2aa98b[_0x0449('0x71')]));return;}})[_0x0449('0x24')](function(_0x27daec){if(_0xc3f168['transcribeStatus']===_0x0449('0x8d')){return transcribe(_0x28db45[_0x0449('0x47')]['id'],_0x4c6502[_0x0449('0x87')],_0x4c6502['data2'],_0x2aa98b[_0x0449('0x7d')],_0x2aa98b[_0x0449('0x71')],_0xc3f168[_0x0449('0x4f')],_0x2aa98b[_0x0449('0x7e')]);}else{logger[_0x0449('0x64')](util[_0x0449('0x31')](_0x0449('0x8e'),_0x28db45['params']['id']));return{'transcribeStatus':_0x0449('0x8f')};}})['then'](function(_0xb1f805){if(_0xb1f805){_0xb1f805[_0x0449('0x90')]=_0x28db45[_0x0449('0x49')][_0x0449('0x80')];return _0xc3f168[_0x0449('0x91')](_0xb1f805);}})[_0x0449('0x24')](respondWithResult(_0x121436,null))[_0x0449('0x48')](handleError(_0x121436,null));};function writeFile(_0x5138d6,_0x381def){return new Promise(function(_0x548a22,_0x127e3b){fs[_0x0449('0x92')](_0x381def,_0x5138d6,function(_0x3f5f51,_0x23031f){if(_0x3f5f51){return _0x127e3b(_0x3f5f51);}else{return _0x548a22(_0x23031f);}});});}exports[_0x0449('0x93')]=function(_0x48d8c5,_0x11c464,_0x287ae0){return db[_0x0449('0x2b')][_0x0449('0x7a')]({'where':{'id':_0x48d8c5[_0x0449('0x47')]['id']}})[_0x0449('0x24')](handleEntityNotFound(_0x11c464))['then'](function(_0x4c5439){if(_0x4c5439&&_0x4c5439['fileText']){var _0x1c4e71=_0x4c5439[_0x0449('0x94')];var _0x58fd55=config[_0x0449('0x95')]+_0x0449('0x96')+_0x4c5439['id']+_0x0449('0x97');if(fs[_0x0449('0x51')](_0x58fd55)){return _0x58fd55;}return writeFile(_0x1c4e71,_0x58fd55)[_0x0449('0x24')](function(){return _0x58fd55;});}else{throw new db[(_0x0449('0x60'))][(_0x0449('0x55'))](_0x0449('0x98'));}})['then'](function(_0x448afe){return _0x11c464['download'](_0x448afe);})[_0x0449('0x48')](handleError(_0x11c464));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 2cfd937..eb81927 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 _0x1660=['exports','define','VoiceRecording','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes'];(function(_0x472ba6,_0x30c67d){var _0x2fb0b4=function(_0x5acb17){while(--_0x5acb17){_0x472ba6['push'](_0x472ba6['shift']());}};_0x2fb0b4(++_0x30c67d);}(_0x1660,0x189));var _0x0166=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x1660[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0x0166('0x0'));var util=require(_0x0166('0x1'));var logger=require(_0x0166('0x2'))('api');var moment=require(_0x0166('0x3'));var BPromise=require(_0x0166('0x4'));var rp=require(_0x0166('0x5'));var fs=require('fs');var path=require(_0x0166('0x6'));var rimraf=require(_0x0166('0x7'));var config=require(_0x0166('0x8'));var attributes=require(_0x0166('0x9'));module[_0x0166('0xa')]=function(_0x4c8c31,_0x5bb43a){return _0x4c8c31[_0x0166('0xb')](_0x0166('0xc'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x81ab=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x27d3aa,_0x33d3c1){var _0x2af2fa=function(_0x4e50ab){while(--_0x4e50ab){_0x27d3aa['push'](_0x27d3aa['shift']());}};_0x2af2fa(++_0x33d3c1);}(_0x81ab,0x1db));var _0xb81a=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0x81ab[_0x37b7b6];return _0x10c4c3;};'use strict';var _=require(_0xb81a('0x0'));var util=require(_0xb81a('0x1'));var logger=require(_0xb81a('0x2'))(_0xb81a('0x3'));var moment=require(_0xb81a('0x4'));var BPromise=require(_0xb81a('0x5'));var rp=require(_0xb81a('0x6'));var fs=require('fs');var path=require(_0xb81a('0x7'));var rimraf=require(_0xb81a('0x8'));var config=require(_0xb81a('0x9'));var attributes=require(_0xb81a('0xa'));module[_0xb81a('0xb')]=function(_0xe6ef07,_0x104724){return _0xe6ef07['define'](_0xb81a('0xc'),attributes,{'tableName':_0xb81a('0xd'),'paranoid':![],'indexes':[{'name':_0xb81a('0xe'),'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 056cd4f..98196aa 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(_0x167295,_0x555a81){var _0x400be6=function(_0x1edcba){while(--_0x1edcba){_0x167295['push'](_0x167295['shift']());}};_0x400be6(++_0x555a81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x3c9c05,_0x31f740){var _0x2f1d51=function(_0x123a10){while(--_0x123a10){_0x3c9c05['push'](_0x3c9c05['shift']());}};_0x2f1d51(++_0x31f740);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 e72d59c..760d1da 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 _0x187d=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x84847d,_0x2d9e2b){var _0x1abffa=function(_0x3c112f){while(--_0x3c112f){_0x84847d['push'](_0x84847d['shift']());}};_0x1abffa(++_0x2d9e2b);}(_0x187d,0x93));var _0xd187=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x187d[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var auth=require(_0xd187('0x5'));var interaction=require(_0xd187('0x6'));var config=require('../../config/environment');var controller=require(_0xd187('0x7'));router[_0xd187('0x8')]('/',auth['isAuthenticated'](),controller[_0xd187('0x9')]);router[_0xd187('0x8')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xc')]);router[_0xd187('0xd')]('/',auth[_0xd187('0xb')](),controller[_0xd187('0xe')]);router['put'](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller['destroy']);module[_0xd187('0x11')]=router; \ No newline at end of file +var _0x0295=['delete','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','put'];(function(_0x486130,_0x5c2e01){var _0x353877=function(_0x5bcf64){while(--_0x5bcf64){_0x486130['push'](_0x486130['shift']());}};_0x353877(++_0x5c2e01);}(_0x0295,0x1f0));var _0x5029=function(_0x32f05c,_0x273aef){_0x32f05c=_0x32f05c-0x0;var _0x4307ed=_0x0295[_0x32f05c];return _0x4307ed;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x5029('0x2'));var interaction=require(_0x5029('0x3'));var config=require(_0x5029('0x4'));var controller=require(_0x5029('0x5'));router[_0x5029('0x6')]('/',auth[_0x5029('0x7')](),controller[_0x5029('0x8')]);router[_0x5029('0x6')](_0x5029('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x5029('0x7')](),controller['create']);router[_0x5029('0xa')]('/:id',auth[_0x5029('0x7')](),controller['update']);router[_0x5029('0xb')](_0x5029('0x9'),auth[_0x5029('0x7')](),controller['destroy']);module[_0x5029('0xc')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b9411fc..7f888c6 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 _0xb977=['exports','ENUM','attended','STRING','Yes'];(function(_0x23c993,_0x253858){var _0x4b24e6=function(_0xf39a57){while(--_0xf39a57){_0x23c993['push'](_0x23c993['shift']());}};_0x4b24e6(++_0x253858);}(_0xb977,0x113));var _0x7b97=function(_0x546807,_0x474398){_0x546807=_0x546807-0x0;var _0x37fe4a=_0xb977[_0x546807];return _0x37fe4a;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x7b97('0x0')]={'type':{'type':Sequelize[_0x7b97('0x1')]('blind',_0x7b97('0x2'))},'result':{'type':Sequelize[_0x7b97('0x3')]},'transfererchannel':{'type':Sequelize[_0x7b97('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x7b97('0x3')]},'transferercalleridname':{'type':Sequelize[_0x7b97('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x7b97('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x7b97('0x3')]},'transferercontext':{'type':Sequelize[_0x7b97('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x7b97('0x3')]},'transfereechannel':{'type':Sequelize[_0x7b97('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x7b97('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x7b97('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x7b97('0x3')]},'isexternal':{'type':Sequelize[_0x7b97('0x1')](_0x7b97('0x4'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x69de=['sequelize','moment','ENUM','attended','STRING','Yes'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x69de,0x1ce));var _0xe69d=function(_0x49c68e,_0x1c1673){_0x49c68e=_0x49c68e-0x0;var _0x33032b=_0x69de[_0x49c68e];return _0x33032b;};'use strict';var Sequelize=require(_0xe69d('0x0'));var moment=require(_0xe69d('0x1'));module['exports']={'type':{'type':Sequelize[_0xe69d('0x2')]('blind',_0xe69d('0x3'))},'result':{'type':Sequelize[_0xe69d('0x4')]},'transfererchannel':{'type':Sequelize[_0xe69d('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xe69d('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xe69d('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xe69d('0x4')]},'transfererexten':{'type':Sequelize[_0xe69d('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xe69d('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xe69d('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xe69d('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe69d('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe69d('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xe69d('0x4')]},'transfereecontext':{'type':Sequelize[_0xe69d('0x4')]},'transfereeexten':{'type':Sequelize[_0xe69d('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xe69d('0x2')](_0xe69d('0x5'),'No')},'context':{'type':Sequelize[_0xe69d('0x4')]},'extension':{'type':Sequelize[_0xe69d('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index ab2e950..201e4ce 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 _0xe617=['rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','include','rows','catch','params','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','stack','name','index','map','VoiceTransferReport'];(function(_0x775002,_0x5aa509){var _0x1d7e19=function(_0x29a628){while(--_0x29a628){_0x775002['push'](_0x775002['shift']());}};_0x1d7e19(++_0x5aa509);}(_0xe617,0x1ef));var _0x7e61=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe617[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7e61('0x0'));var zipdir=require(_0x7e61('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e61('0x2'));var moment=require(_0x7e61('0x3'));var BPromise=require(_0x7e61('0x4'));var Mustache=require(_0x7e61('0x5'));var util=require(_0x7e61('0x6'));var path=require('path');var sox=require(_0x7e61('0x7'));var csv=require(_0x7e61('0x8'));var ejs=require(_0x7e61('0x9'));var fs=require('fs');var _=require(_0x7e61('0xa'));var squel=require(_0x7e61('0xb'));var crypto=require('crypto');var jsforce=require(_0x7e61('0xc'));var deskjs=require(_0x7e61('0xd'));var toCsv=require(_0x7e61('0x8'));var querystring=require(_0x7e61('0xe'));var Papa=require(_0x7e61('0xf'));var Redis=require(_0x7e61('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7e61('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e61('0x12'))(_0x7e61('0x13'));var utils=require(_0x7e61('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7e61('0x15'));var db=require(_0x7e61('0x16'))['db'];function respondWithStatusCode(_0x17e51f,_0x53c6b0){_0x53c6b0=_0x53c6b0||0xcc;return function(_0x54b368){if(_0x54b368){return _0x17e51f[_0x7e61('0x17')](_0x53c6b0);}return _0x17e51f[_0x7e61('0x18')](_0x53c6b0)[_0x7e61('0x19')]();};}function respondWithResult(_0x78d7c1,_0xdba8f3){_0xdba8f3=_0xdba8f3||0xc8;return function(_0x41979e){if(_0x41979e){return _0x78d7c1[_0x7e61('0x18')](_0xdba8f3)[_0x7e61('0x1a')](_0x41979e);}};}function respondWithFilteredResult(_0x4d9dcf,_0x5b1b9b){return function(_0x4c1721){if(_0x4c1721){var _0x570efa=_0x4c1721[_0x7e61('0x1b')],_0x4426f2=_0x5b1b9b[_0x7e61('0x1c')],_0x143917=_0x5b1b9b['offset']+_0x5b1b9b[_0x7e61('0x1d')],_0x2721aa;if(_0x143917>=_0x570efa){_0x143917=_0x570efa;_0x2721aa=0xc8;}else{_0x2721aa=0xce;}_0x4d9dcf[_0x7e61('0x18')](_0x2721aa);return _0x4d9dcf[_0x7e61('0x1e')](_0x7e61('0x1f'),_0x4426f2+'-'+_0x143917+'/'+_0x570efa)['json'](_0x4c1721);}return null;};}function patchUpdates(_0x3c53dc){return function(_0x2b7c22){try{jsonpatch[_0x7e61('0x20')](_0x2b7c22,_0x3c53dc,!![]);}catch(_0x3ba82d){return BPromise['reject'](_0x3ba82d);}return _0x2b7c22['save']();};}function saveUpdates(_0x7e8a3e,_0xca0816){return function(_0x376d53){if(_0x376d53){return _0x376d53[_0x7e61('0x21')](_0x7e8a3e)['then'](function(_0x238990){return _0x238990;});}return null;};}function removeEntity(_0x36d3bd,_0x45e20b){return function(_0xde6a3f){if(_0xde6a3f){return _0xde6a3f[_0x7e61('0x22')]()[_0x7e61('0x23')](function(){_0x36d3bd[_0x7e61('0x18')](0xcc)[_0x7e61('0x19')]();});}};}function handleEntityNotFound(_0x45d25b,_0x1baf8f){return function(_0x282c90){if(!_0x282c90){_0x45d25b[_0x7e61('0x17')](0x194);}return _0x282c90;};}function handleError(_0x28e944,_0x26529a){_0x26529a=_0x26529a||0x1f4;return function(_0x241cab){logger['error'](_0x241cab[_0x7e61('0x24')]);if(_0x241cab[_0x7e61('0x25')]){delete _0x241cab[_0x7e61('0x25')];}_0x28e944[_0x7e61('0x18')](_0x26529a)['send'](_0x241cab);};}exports[_0x7e61('0x26')]=function(_0x139a07,_0x202938){var _0x2f5a2a={},_0x466438={},_0x13145a={'count':0x0,'rows':[]};var _0x870518=_[_0x7e61('0x27')](db[_0x7e61('0x28')][_0x7e61('0x29')],function(_0x1ec8dd){return{'name':_0x1ec8dd[_0x7e61('0x2a')],'type':_0x1ec8dd['type']['key']};});_0x466438[_0x7e61('0x2b')]=_[_0x7e61('0x27')](_0x870518,_0x7e61('0x25'));_0x466438[_0x7e61('0x2c')]=_[_0x7e61('0x2d')](_0x139a07[_0x7e61('0x2c')]);_0x466438[_0x7e61('0x2e')]=_[_0x7e61('0x2f')](_0x466438[_0x7e61('0x2b')],_0x466438['query']);_0x2f5a2a['attributes']=_[_0x7e61('0x2f')](_0x466438['model'],qs[_0x7e61('0x30')](_0x139a07['query'][_0x7e61('0x30')]));_0x2f5a2a[_0x7e61('0x31')]=_0x2f5a2a['attributes'][_0x7e61('0x32')]?_0x2f5a2a[_0x7e61('0x31')]:_0x466438[_0x7e61('0x2b')];if(!_0x139a07[_0x7e61('0x2c')]['hasOwnProperty'](_0x7e61('0x33'))){_0x2f5a2a[_0x7e61('0x1d')]=qs['limit'](_0x139a07['query'][_0x7e61('0x1d')]);_0x2f5a2a[_0x7e61('0x1c')]=qs['offset'](_0x139a07[_0x7e61('0x2c')]['offset']);}_0x2f5a2a['order']=qs[_0x7e61('0x34')](_0x139a07[_0x7e61('0x2c')][_0x7e61('0x34')]);_0x2f5a2a['where']=qs[_0x7e61('0x2e')](_[_0x7e61('0x35')](_0x139a07[_0x7e61('0x2c')],_0x466438[_0x7e61('0x2e')]),_0x870518);if(_0x139a07[_0x7e61('0x2c')][_0x7e61('0x36')]){_0x2f5a2a[_0x7e61('0x37')]=_[_0x7e61('0x38')](_0x2f5a2a[_0x7e61('0x37')],{'$or':_[_0x7e61('0x27')](_0x870518,function(_0x319dc4){if(_0x319dc4[_0x7e61('0x39')]!==_0x7e61('0x3a')){var _0x22a1d8={};_0x22a1d8[_0x319dc4[_0x7e61('0x25')]]={'$like':'%'+_0x139a07[_0x7e61('0x2c')][_0x7e61('0x36')]+'%'};return _0x22a1d8;}})});}_0x2f5a2a=_['merge']({},_0x2f5a2a,_0x139a07[_0x7e61('0x3b')]);var _0x49a916={'where':_0x2f5a2a[_0x7e61('0x37')]};return db[_0x7e61('0x28')][_0x7e61('0x1b')](_0x49a916)['then'](function(_0x3efc17){_0x13145a['count']=_0x3efc17;if(_0x139a07[_0x7e61('0x2c')]['includeAll']){_0x2f5a2a[_0x7e61('0x3c')]=[{'all':!![]}];}return db[_0x7e61('0x28')]['findAll'](_0x2f5a2a);})['then'](function(_0x5120cd){_0x13145a[_0x7e61('0x3d')]=_0x5120cd;return _0x13145a;})['then'](respondWithFilteredResult(_0x202938,_0x2f5a2a))[_0x7e61('0x3e')](handleError(_0x202938,null));};exports['show']=function(_0x1178fb,_0x3bbaf9){var _0x24a0f5={'raw':!![],'where':{'id':_0x1178fb[_0x7e61('0x3f')]['id']}},_0x3f50e0={};_0x3f50e0[_0x7e61('0x2b')]=_['keys'](db[_0x7e61('0x28')]['rawAttributes']);_0x3f50e0[_0x7e61('0x2c')]=_[_0x7e61('0x2d')](_0x1178fb[_0x7e61('0x2c')]);_0x3f50e0[_0x7e61('0x2e')]=_[_0x7e61('0x2f')](_0x3f50e0[_0x7e61('0x2b')],_0x3f50e0['query']);_0x24a0f5[_0x7e61('0x31')]=_[_0x7e61('0x2f')](_0x3f50e0[_0x7e61('0x2b')],qs[_0x7e61('0x30')](_0x1178fb[_0x7e61('0x2c')][_0x7e61('0x30')]));_0x24a0f5[_0x7e61('0x31')]=_0x24a0f5['attributes'][_0x7e61('0x32')]?_0x24a0f5['attributes']:_0x3f50e0[_0x7e61('0x2b')];if(_0x1178fb['query']['includeAll']){_0x24a0f5[_0x7e61('0x3c')]=[{'all':!![]}];}_0x24a0f5=_[_0x7e61('0x38')]({},_0x24a0f5,_0x1178fb['options']);return db[_0x7e61('0x28')][_0x7e61('0x40')](_0x24a0f5)[_0x7e61('0x23')](handleEntityNotFound(_0x3bbaf9,null))[_0x7e61('0x23')](respondWithResult(_0x3bbaf9,null))[_0x7e61('0x3e')](handleError(_0x3bbaf9,null));};exports['create']=function(_0x39d975,_0x538e67){return db[_0x7e61('0x28')][_0x7e61('0x41')](_0x39d975[_0x7e61('0x42')],{})[_0x7e61('0x23')](respondWithResult(_0x538e67,0xc9))[_0x7e61('0x3e')](handleError(_0x538e67,null));};exports[_0x7e61('0x21')]=function(_0x1c3246,_0x15a9da){if(_0x1c3246[_0x7e61('0x42')]['id']){delete _0x1c3246[_0x7e61('0x42')]['id'];}return db['VoiceTransferReport'][_0x7e61('0x40')]({'where':{'id':_0x1c3246[_0x7e61('0x3f')]['id']}})['then'](handleEntityNotFound(_0x15a9da,null))[_0x7e61('0x23')](saveUpdates(_0x1c3246[_0x7e61('0x42')],null))[_0x7e61('0x23')](respondWithResult(_0x15a9da,null))[_0x7e61('0x3e')](handleError(_0x15a9da,null));};exports[_0x7e61('0x22')]=function(_0x25c954,_0x43dd35){return db[_0x7e61('0x28')][_0x7e61('0x40')]({'where':{'id':_0x25c954[_0x7e61('0x3f')]['id']}})['then'](handleEntityNotFound(_0x43dd35,null))['then'](removeEntity(_0x43dd35,null))[_0x7e61('0x3e')](handleError(_0x43dd35,null));}; \ No newline at end of file +var _0xc5f3=['sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','VoiceTransferReport','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','params','rawAttributes','length','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x46edab,_0x18062f){var _0xea7ffc=function(_0x314b6d){while(--_0x314b6d){_0x46edab['push'](_0x46edab['shift']());}};_0xea7ffc(++_0x18062f);}(_0xc5f3,0x1b3));var _0x3c5f=function(_0x14135c,_0x35bd89){_0x14135c=_0x14135c-0x0;var _0x2f6f6e=_0xc5f3[_0x14135c];return _0x2f6f6e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3c5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c5f('0x1'));var jsonpatch=require(_0x3c5f('0x2'));var rp=require('request-promise');var moment=require(_0x3c5f('0x3'));var BPromise=require(_0x3c5f('0x4'));var Mustache=require(_0x3c5f('0x5'));var util=require(_0x3c5f('0x6'));var path=require(_0x3c5f('0x7'));var sox=require(_0x3c5f('0x8'));var csv=require(_0x3c5f('0x9'));var ejs=require(_0x3c5f('0xa'));var fs=require('fs');var _=require(_0x3c5f('0xb'));var squel=require(_0x3c5f('0xc'));var crypto=require(_0x3c5f('0xd'));var jsforce=require(_0x3c5f('0xe'));var deskjs=require(_0x3c5f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3c5f('0x10'));var Papa=require(_0x3c5f('0x11'));var Redis=require(_0x3c5f('0x12'));var authService=require(_0x3c5f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3c5f('0x14'));var hardwareService=require(_0x3c5f('0x15'));var logger=require(_0x3c5f('0x16'))(_0x3c5f('0x17'));var utils=require(_0x3c5f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3c5f('0x19'));var db=require(_0x3c5f('0x1a'))['db'];function respondWithStatusCode(_0x11ab97,_0x3d9411){_0x3d9411=_0x3d9411||0xcc;return function(_0xb95e55){if(_0xb95e55){return _0x11ab97[_0x3c5f('0x1b')](_0x3d9411);}return _0x11ab97[_0x3c5f('0x1c')](_0x3d9411)[_0x3c5f('0x1d')]();};}function respondWithResult(_0x569cb8,_0x286bc7){_0x286bc7=_0x286bc7||0xc8;return function(_0xbc453f){if(_0xbc453f){return _0x569cb8[_0x3c5f('0x1c')](_0x286bc7)['json'](_0xbc453f);}};}function respondWithFilteredResult(_0x110e89,_0x2ea50d){return function(_0x1c8a7a){if(_0x1c8a7a){var _0x5b0a46=_0x1c8a7a[_0x3c5f('0x1e')],_0x4881b2=_0x2ea50d[_0x3c5f('0x1f')],_0x504f2a=_0x2ea50d[_0x3c5f('0x1f')]+_0x2ea50d[_0x3c5f('0x20')],_0x539bad;if(_0x504f2a>=_0x5b0a46){_0x504f2a=_0x5b0a46;_0x539bad=0xc8;}else{_0x539bad=0xce;}_0x110e89[_0x3c5f('0x1c')](_0x539bad);return _0x110e89[_0x3c5f('0x21')](_0x3c5f('0x22'),_0x4881b2+'-'+_0x504f2a+'/'+_0x5b0a46)[_0x3c5f('0x23')](_0x1c8a7a);}return null;};}function patchUpdates(_0x3da87c){return function(_0x10581c){try{jsonpatch[_0x3c5f('0x24')](_0x10581c,_0x3da87c,!![]);}catch(_0x30c7ed){return BPromise[_0x3c5f('0x25')](_0x30c7ed);}return _0x10581c['save']();};}function saveUpdates(_0x3d0bb8,_0x31fbbd){return function(_0x444ede){if(_0x444ede){return _0x444ede[_0x3c5f('0x26')](_0x3d0bb8)[_0x3c5f('0x27')](function(_0x4280d5){return _0x4280d5;});}return null;};}function removeEntity(_0x4d5b00,_0x38f13e){return function(_0x2135f8){if(_0x2135f8){return _0x2135f8[_0x3c5f('0x28')]()[_0x3c5f('0x27')](function(){_0x4d5b00[_0x3c5f('0x1c')](0xcc)[_0x3c5f('0x1d')]();});}};}function handleEntityNotFound(_0x26eeee,_0x3684b0){return function(_0x246ac2){if(!_0x246ac2){_0x26eeee['sendStatus'](0x194);}return _0x246ac2;};}function handleError(_0x5c5419,_0x49370c){_0x49370c=_0x49370c||0x1f4;return function(_0x54ed23){logger[_0x3c5f('0x29')](_0x54ed23[_0x3c5f('0x2a')]);if(_0x54ed23[_0x3c5f('0x2b')]){delete _0x54ed23[_0x3c5f('0x2b')];}_0x5c5419[_0x3c5f('0x1c')](_0x49370c)[_0x3c5f('0x2c')](_0x54ed23);};}exports[_0x3c5f('0x2d')]=function(_0xc631df,_0x46ab06){var _0x3a9355={},_0x32281e={},_0x6c7c2c={'count':0x0,'rows':[]};var _0x464e72=_['map'](db[_0x3c5f('0x2e')]['rawAttributes'],function(_0x58f736){return{'name':_0x58f736[_0x3c5f('0x2f')],'type':_0x58f736['type']['key']};});_0x32281e[_0x3c5f('0x30')]=_['map'](_0x464e72,_0x3c5f('0x2b'));_0x32281e[_0x3c5f('0x31')]=_[_0x3c5f('0x32')](_0xc631df[_0x3c5f('0x31')]);_0x32281e[_0x3c5f('0x33')]=_['intersection'](_0x32281e[_0x3c5f('0x30')],_0x32281e['query']);_0x3a9355[_0x3c5f('0x34')]=_[_0x3c5f('0x35')](_0x32281e[_0x3c5f('0x30')],qs[_0x3c5f('0x36')](_0xc631df[_0x3c5f('0x31')][_0x3c5f('0x36')]));_0x3a9355[_0x3c5f('0x34')]=_0x3a9355[_0x3c5f('0x34')]['length']?_0x3a9355[_0x3c5f('0x34')]:_0x32281e[_0x3c5f('0x30')];if(!_0xc631df['query'][_0x3c5f('0x37')](_0x3c5f('0x38'))){_0x3a9355[_0x3c5f('0x20')]=qs[_0x3c5f('0x20')](_0xc631df['query'][_0x3c5f('0x20')]);_0x3a9355[_0x3c5f('0x1f')]=qs[_0x3c5f('0x1f')](_0xc631df[_0x3c5f('0x31')]['offset']);}_0x3a9355[_0x3c5f('0x39')]=qs[_0x3c5f('0x3a')](_0xc631df[_0x3c5f('0x31')]['sort']);_0x3a9355[_0x3c5f('0x3b')]=qs[_0x3c5f('0x33')](_[_0x3c5f('0x3c')](_0xc631df[_0x3c5f('0x31')],_0x32281e['filters']),_0x464e72);if(_0xc631df[_0x3c5f('0x31')]['filter']){_0x3a9355['where']=_[_0x3c5f('0x3d')](_0x3a9355[_0x3c5f('0x3b')],{'$or':_['map'](_0x464e72,function(_0x40cd00){if(_0x40cd00[_0x3c5f('0x3e')]!==_0x3c5f('0x3f')){var _0xe04b84={};_0xe04b84[_0x40cd00[_0x3c5f('0x2b')]]={'$like':'%'+_0xc631df[_0x3c5f('0x31')][_0x3c5f('0x40')]+'%'};return _0xe04b84;}})});}_0x3a9355=_['merge']({},_0x3a9355,_0xc631df[_0x3c5f('0x41')]);var _0x54284c={'where':_0x3a9355[_0x3c5f('0x3b')]};return db[_0x3c5f('0x2e')][_0x3c5f('0x1e')](_0x54284c)[_0x3c5f('0x27')](function(_0x149ef7){_0x6c7c2c[_0x3c5f('0x1e')]=_0x149ef7;if(_0xc631df['query']['includeAll']){_0x3a9355[_0x3c5f('0x42')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x3c5f('0x43')](_0x3a9355);})[_0x3c5f('0x27')](function(_0x1dfa77){_0x6c7c2c[_0x3c5f('0x44')]=_0x1dfa77;return _0x6c7c2c;})[_0x3c5f('0x27')](respondWithFilteredResult(_0x46ab06,_0x3a9355))[_0x3c5f('0x45')](handleError(_0x46ab06,null));};exports['show']=function(_0x5cdeec,_0x44e563){var _0x2967df={'raw':!![],'where':{'id':_0x5cdeec[_0x3c5f('0x46')]['id']}},_0x3af9f5={};_0x3af9f5[_0x3c5f('0x30')]=_['keys'](db[_0x3c5f('0x2e')][_0x3c5f('0x47')]);_0x3af9f5[_0x3c5f('0x31')]=_[_0x3c5f('0x32')](_0x5cdeec[_0x3c5f('0x31')]);_0x3af9f5[_0x3c5f('0x33')]=_['intersection'](_0x3af9f5[_0x3c5f('0x30')],_0x3af9f5[_0x3c5f('0x31')]);_0x2967df[_0x3c5f('0x34')]=_['intersection'](_0x3af9f5['model'],qs[_0x3c5f('0x36')](_0x5cdeec[_0x3c5f('0x31')]['fields']));_0x2967df[_0x3c5f('0x34')]=_0x2967df[_0x3c5f('0x34')][_0x3c5f('0x48')]?_0x2967df[_0x3c5f('0x34')]:_0x3af9f5['model'];if(_0x5cdeec[_0x3c5f('0x31')][_0x3c5f('0x49')]){_0x2967df['include']=[{'all':!![]}];}_0x2967df=_[_0x3c5f('0x3d')]({},_0x2967df,_0x5cdeec[_0x3c5f('0x41')]);return db['VoiceTransferReport'][_0x3c5f('0x4a')](_0x2967df)['then'](handleEntityNotFound(_0x44e563,null))[_0x3c5f('0x27')](respondWithResult(_0x44e563,null))[_0x3c5f('0x45')](handleError(_0x44e563,null));};exports[_0x3c5f('0x4b')]=function(_0x2f2e1d,_0x81e3c0){return db[_0x3c5f('0x2e')][_0x3c5f('0x4b')](_0x2f2e1d['body'],{})[_0x3c5f('0x27')](respondWithResult(_0x81e3c0,0xc9))[_0x3c5f('0x45')](handleError(_0x81e3c0,null));};exports[_0x3c5f('0x26')]=function(_0x502afe,_0x41edff){if(_0x502afe[_0x3c5f('0x4c')]['id']){delete _0x502afe[_0x3c5f('0x4c')]['id'];}return db['VoiceTransferReport'][_0x3c5f('0x4a')]({'where':{'id':_0x502afe['params']['id']}})[_0x3c5f('0x27')](handleEntityNotFound(_0x41edff,null))[_0x3c5f('0x27')](saveUpdates(_0x502afe[_0x3c5f('0x4c')],null))[_0x3c5f('0x27')](respondWithResult(_0x41edff,null))['catch'](handleError(_0x41edff,null));};exports['destroy']=function(_0x21cbe9,_0x2a4e4f){return db[_0x3c5f('0x2e')][_0x3c5f('0x4a')]({'where':{'id':_0x21cbe9[_0x3c5f('0x46')]['id']}})[_0x3c5f('0x27')](handleEntityNotFound(_0x2a4e4f,null))['then'](removeEntity(_0x2a4e4f,null))[_0x3c5f('0x45')](handleError(_0x2a4e4f,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index b64fbff..1418355 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 _0x061a=['path','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13a3b4,_0x4cc510){var _0x480775=function(_0x2d516c){while(--_0x2d516c){_0x13a3b4['push'](_0x13a3b4['shift']());}};_0x480775(++_0x4cc510);}(_0x061a,0x13e));var _0xa061=function(_0x168fb5,_0x167bb8){_0x168fb5=_0x168fb5-0x0;var _0x3bde51=_0x061a[_0x168fb5];return _0x3bde51;};'use strict';var _=require(_0xa061('0x0'));var util=require(_0xa061('0x1'));var logger=require(_0xa061('0x2'))(_0xa061('0x3'));var moment=require(_0xa061('0x4'));var BPromise=require(_0xa061('0x5'));var rp=require(_0xa061('0x6'));var fs=require('fs');var path=require(_0xa061('0x7'));var rimraf=require('rimraf');var config=require(_0xa061('0x8'));var attributes=require(_0xa061('0x9'));module['exports']=function(_0xa0e0b4,_0x31a2c4){return _0xa0e0b4[_0xa061('0xa')](_0xa061('0xb'),attributes,{'tableName':_0xa061('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda04=['../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','../../config/logger','api','request-promise','path','rimraf'];(function(_0x3c53ef,_0x5b3b8a){var _0x4948b4=function(_0x967b4d){while(--_0x967b4d){_0x3c53ef['push'](_0x3c53ef['shift']());}};_0x4948b4(++_0x5b3b8a);}(_0xda04,0x1be));var _0x4da0=function(_0x19f9e6,_0x4f59a6){_0x19f9e6=_0x19f9e6-0x0;var _0x45c862=_0xda04[_0x19f9e6];return _0x45c862;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4da0('0x0'))(_0x4da0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4da0('0x2'));var fs=require('fs');var path=require(_0x4da0('0x3'));var rimraf=require(_0x4da0('0x4'));var config=require(_0x4da0('0x5'));var attributes=require(_0x4da0('0x6'));module[_0x4da0('0x7')]=function(_0x3dbecb,_0x138233){return _0x3dbecb[_0x4da0('0x8')](_0x4da0('0x9'),attributes,{'tableName':_0x4da0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 21b0c6f..ca4e666 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 _0xf0a3=['info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','VoiceTransferReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x431a00,_0x4ec75f){var _0x50c633=function(_0x820657){while(--_0x820657){_0x431a00['push'](_0x431a00['shift']());}};_0x50c633(++_0x4ec75f);}(_0xf0a3,0xe1));var _0x3f0a=function(_0x39666d,_0x31b50d){_0x39666d=_0x39666d-0x0;var _0x2f8e05=_0xf0a3[_0x39666d];return _0x2f8e05;};'use strict';var _=require(_0x3f0a('0x0'));var util=require(_0x3f0a('0x1'));var moment=require(_0x3f0a('0x2'));var BPromise=require(_0x3f0a('0x3'));var rs=require(_0x3f0a('0x4'));var fs=require('fs');var Redis=require(_0x3f0a('0x5'));var db=require(_0x3f0a('0x6'))['db'];var utils=require(_0x3f0a('0x7'));var logger=require(_0x3f0a('0x8'))(_0x3f0a('0x9'));var config=require(_0x3f0a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3f0a('0xb')][_0x3f0a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a21e8,_0x4ea112,_0x468a2c){return new BPromise(function(_0x241efa,_0x3e4475){return client[_0x3f0a('0xd')](_0x1a21e8,_0x468a2c)[_0x3f0a('0xe')](function(_0x38173d){logger[_0x3f0a('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x4ea112,_0x3f0a('0x10'));logger['debug'](_0x3f0a('0x11'),_0x4ea112,'request\x20sent',JSON[_0x3f0a('0x12')](_0x38173d));if(_0x38173d['error']){if(_0x38173d[_0x3f0a('0x13')][_0x3f0a('0x14')]===0x1f4){logger[_0x3f0a('0x13')](_0x3f0a('0x15'),_0x4ea112,_0x38173d[_0x3f0a('0x13')][_0x3f0a('0x16')]);return _0x3e4475(_0x38173d['error'][_0x3f0a('0x16')]);}logger[_0x3f0a('0x13')](_0x3f0a('0x15'),_0x4ea112,_0x38173d[_0x3f0a('0x13')][_0x3f0a('0x16')]);return _0x241efa(_0x38173d[_0x3f0a('0x13')][_0x3f0a('0x16')]);}else{logger[_0x3f0a('0xf')](_0x3f0a('0x15'),_0x4ea112,'request\x20sent');_0x241efa(_0x38173d[_0x3f0a('0x17')][_0x3f0a('0x16')]);}})[_0x3f0a('0x18')](function(_0x43103c){logger[_0x3f0a('0x13')](_0x3f0a('0x15'),_0x4ea112,_0x43103c);_0x3e4475(_0x43103c);});});}exports['CreateVoiceTransferReport']=function(_0x449c70){var _0x2de44c=this;return new Promise(function(_0x38a73c,_0x42f388){return db[_0x3f0a('0x19')][_0x3f0a('0x1a')](_0x449c70[_0x3f0a('0x1b')],{'raw':_0x449c70['options']?_0x449c70[_0x3f0a('0x1c')][_0x3f0a('0x1d')]===undefined?!![]:![]:!![]})[_0x3f0a('0xe')](function(_0x5621f8){logger[_0x3f0a('0xf')]('CreateVoiceTransferReport',_0x449c70);logger['debug']('CreateVoiceTransferReport',_0x449c70,JSON['stringify'](_0x5621f8));_0x38a73c(_0x5621f8);})[_0x3f0a('0x18')](function(_0x35ba09){logger['error']('CreateVoiceTransferReport',_0x35ba09[_0x3f0a('0x16')],_0x449c70);_0x42f388(_0x2de44c['error'](0x1f4,_0x35ba09[_0x3f0a('0x16')]));});});}; \ No newline at end of file +var _0x516b=['raw','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x516b,0x1dd));var _0xb516=function(_0x57fcc0,_0x585004){_0x57fcc0=_0x57fcc0-0x0;var _0x5270df=_0x516b[_0x57fcc0];return _0x5270df;};'use strict';var _=require(_0xb516('0x0'));var util=require('util');var moment=require(_0xb516('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb516('0x2'));var db=require(_0xb516('0x3'))['db'];var utils=require(_0xb516('0x4'));var logger=require(_0xb516('0x5'))(_0xb516('0x6'));var config=require(_0xb516('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb516('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44d416,_0x1051da,_0x55063f){return new BPromise(function(_0xa5c4a5,_0x1172b6){return client[_0xb516('0x9')](_0x44d416,_0x55063f)[_0xb516('0xa')](function(_0x30cbc4){logger[_0xb516('0xb')](_0xb516('0xc'),_0x1051da,_0xb516('0xd'));logger[_0xb516('0xe')](_0xb516('0xf'),_0x1051da,_0xb516('0xd'),JSON[_0xb516('0x10')](_0x30cbc4));if(_0x30cbc4[_0xb516('0x11')]){if(_0x30cbc4['error'][_0xb516('0x12')]===0x1f4){logger[_0xb516('0x11')](_0xb516('0xc'),_0x1051da,_0x30cbc4[_0xb516('0x11')][_0xb516('0x13')]);return _0x1172b6(_0x30cbc4[_0xb516('0x11')][_0xb516('0x13')]);}logger[_0xb516('0x11')](_0xb516('0xc'),_0x1051da,_0x30cbc4[_0xb516('0x11')][_0xb516('0x13')]);return _0xa5c4a5(_0x30cbc4[_0xb516('0x11')]['message']);}else{logger[_0xb516('0xb')](_0xb516('0xc'),_0x1051da,_0xb516('0xd'));_0xa5c4a5(_0x30cbc4[_0xb516('0x14')][_0xb516('0x13')]);}})[_0xb516('0x15')](function(_0x419510){logger[_0xb516('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x1051da,_0x419510);_0x1172b6(_0x419510);});});}exports[_0xb516('0x16')]=function(_0x6466e8){var _0x44b432=this;return new Promise(function(_0x1b32d6,_0x40cebe){return db[_0xb516('0x17')][_0xb516('0x18')](_0x6466e8[_0xb516('0x19')],{'raw':_0x6466e8[_0xb516('0x1a')]?_0x6466e8[_0xb516('0x1a')][_0xb516('0x1b')]===undefined?!![]:![]:!![]})[_0xb516('0xa')](function(_0xbef853){logger[_0xb516('0xb')]('CreateVoiceTransferReport',_0x6466e8);logger[_0xb516('0xe')](_0xb516('0x16'),_0x6466e8,JSON[_0xb516('0x10')](_0xbef853));_0x1b32d6(_0xbef853);})[_0xb516('0x15')](function(_0x14e644){logger[_0xb516('0x11')](_0xb516('0x16'),_0x14e644['message'],_0x6466e8);_0x40cebe(_0x44b432[_0xb516('0x11')](0x1f4,_0x14e644[_0xb516('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 900f0ac..9973a3e 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 _0xb790=['/hold','/unhold','unhold','/transfer','exports','Router','/originate','originate','post','isAuthenticated','canUpdate','hangup','/answer','answer'];(function(_0x2b1b0c,_0xf718d2){var _0x4cdbb4=function(_0x32ba68){while(--_0x32ba68){_0x2b1b0c['push'](_0x2b1b0c['shift']());}};_0x4cdbb4(++_0xf718d2);}(_0xb790,0xe5));var _0x0b79=function(_0x3d8812,_0x24b648){_0x3d8812=_0x3d8812-0x0;var _0x3aa4ee=_0xb790[_0x3d8812];return _0x3aa4ee;};'use strict';var express=require('express');var router=express[_0x0b79('0x0')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0x0b79('0x1'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x0b79('0x2')]);router[_0x0b79('0x3')]('/hangup',auth[_0x0b79('0x4')](),auth[_0x0b79('0x5')](),controller[_0x0b79('0x6')]);router[_0x0b79('0x3')](_0x0b79('0x7'),auth[_0x0b79('0x4')](),auth[_0x0b79('0x5')](),controller[_0x0b79('0x8')]);router[_0x0b79('0x3')](_0x0b79('0x9'),auth[_0x0b79('0x4')](),auth[_0x0b79('0x5')](),controller['hold']);router['post'](_0x0b79('0xa'),auth[_0x0b79('0x4')](),auth[_0x0b79('0x5')](),controller[_0x0b79('0xb')]);router[_0x0b79('0x3')]('/calls',auth[_0x0b79('0x4')](),auth[_0x0b79('0x5')](),controller['calls']);router[_0x0b79('0x3')](_0x0b79('0xc'),auth[_0x0b79('0x4')](),auth[_0x0b79('0x5')](),controller['transfer']);module[_0x0b79('0xd')]=router; \ No newline at end of file +var _0xcf1c=['./webbar.controller','post','/originate','isAuthenticated','/hangup','canUpdate','hangup','/answer','answer','/hold','hold','/unhold','unhold','calls','/transfer','transfer','exports','express','Router'];(function(_0x8a9ca8,_0x1e8a2b){var _0x13785f=function(_0x8e2f5b){while(--_0x8e2f5b){_0x8a9ca8['push'](_0x8a9ca8['shift']());}};_0x13785f(++_0x1e8a2b);}(_0xcf1c,0x18d));var _0xccf1=function(_0x9d9343,_0x494c83){_0x9d9343=_0x9d9343-0x0;var _0x2abcd2=_0xcf1c[_0x9d9343];return _0x2abcd2;};'use strict';var express=require(_0xccf1('0x0'));var router=express[_0xccf1('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xccf1('0x2'));router[_0xccf1('0x3')](_0xccf1('0x4'),auth[_0xccf1('0x5')](),auth['canUpdate'](),controller['originate']);router['post'](_0xccf1('0x6'),auth['isAuthenticated'](),auth[_0xccf1('0x7')](),controller[_0xccf1('0x8')]);router[_0xccf1('0x3')](_0xccf1('0x9'),auth[_0xccf1('0x5')](),auth[_0xccf1('0x7')](),controller[_0xccf1('0xa')]);router[_0xccf1('0x3')](_0xccf1('0xb'),auth[_0xccf1('0x5')](),auth[_0xccf1('0x7')](),controller[_0xccf1('0xc')]);router[_0xccf1('0x3')](_0xccf1('0xd'),auth[_0xccf1('0x5')](),auth[_0xccf1('0x7')](),controller[_0xccf1('0xe')]);router['post']('/calls',auth[_0xccf1('0x5')](),auth[_0xccf1('0x7')](),controller[_0xccf1('0xf')]);router[_0xccf1('0x3')](_0xccf1('0x10'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xccf1('0x11')]);module[_0xccf1('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 12f3f7b..02d58e3 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 _0xbf04=['then','code','message','result','catch','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','userId','callerId','callbackUrl','entityFound:','format','user:%s','json','originate\x20executed!','hangup','hangup\x20fired:','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','../../config/logger','webbarapi','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','handleError:','error','stack','name','status','send','NotFound'];(function(_0x9077a4,_0x41748c){var _0x204bdc=function(_0x1c611e){while(--_0x1c611e){_0x9077a4['push'](_0x9077a4['shift']());}};_0x204bdc(++_0x41748c);}(_0xbf04,0xc1));var _0x4bf0=function(_0x33fa54,_0x749f02){_0x33fa54=_0x33fa54-0x0;var _0x4f517a=_0xbf04[_0x33fa54];return _0x4f517a;};'use strict';var path=require(_0x4bf0('0x0'));var fs=require('fs');var _=require(_0x4bf0('0x1'));var db=require(_0x4bf0('0x2'))['db'];var config=require(_0x4bf0('0x3'));var util=require('util');var BPromise=require(_0x4bf0('0x4'));var jayson=require(_0x4bf0('0x5'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0x4bf0('0x6'))(_0x4bf0('0x7'));var Redis=require('ioredis');config[_0x4bf0('0x8')]=_[_0x4bf0('0x9')](config[_0x4bf0('0x8')],{'host':_0x4bf0('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4bf0('0x8')]));var Schema=require(_0x4bf0('0xb'));var originateValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],_0x4bf0('0xd')]},'callNumber':{'type':_0x4bf0('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x4bf0('0xe')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],_0x4bf0('0xd')]},'sessionId':{'type':_0x4bf0('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4bf0('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4bf0('0xe'),'required':[!![],_0x4bf0('0xf')]},'transferNumber':{'type':_0x4bf0('0xe'),'required':[!![],_0x4bf0('0x10')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],_0x4bf0('0xd')]},'sessionId':{'type':_0x4bf0('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],_0x4bf0('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],_0x4bf0('0xd')]}});function emit(_0x56c73a,_0x11e0fb,_0x5e678c){logger['info'](_0x56c73a,_0x11e0fb,JSON[_0x4bf0('0x11')](_0x5e678c));io['to'](_0x56c73a)['emit'](_0x11e0fb,_0x5e678c);}function handleError(_0x8d8802){return function(_0x365e72){console[_0x4bf0('0x12')](_0x4bf0('0x13'),_0x365e72,_0x365e72 instanceof RangeError);logger[_0x4bf0('0x14')](_0x365e72[_0x4bf0('0x15')]);if(_0x365e72 instanceof RangeError){if(_0x365e72['name']){delete _0x365e72[_0x4bf0('0x16')];}_0x8d8802[_0x4bf0('0x17')](0x194)[_0x4bf0('0x18')](_0x365e72);}else{if(_0x365e72['name']){delete _0x365e72['name'];}_0x8d8802[_0x4bf0('0x17')](0x1f4)['send'](_0x365e72);}};}function checkError(){return function(_0x25a1d1){if(!_0x25a1d1){throw new RangeError(_0x4bf0('0x19'));}return _0x25a1d1;};}function respondWithRpcPromise(_0x5e3fdd,_0x1c269c){return new BPromise(function(_0x488b71,_0x4a5be8){var _0x35cbee=amiClient;return _0x35cbee['request'](_0x5e3fdd,_0x1c269c)[_0x4bf0('0x1a')](function(_0x4c2835){if(_0x4c2835[_0x4bf0('0x14')]){if(_0x4c2835[_0x4bf0('0x14')][_0x4bf0('0x1b')]===0x1f4){return _0x4a5be8(_0x4c2835['error'][_0x4bf0('0x1c')]);}return _0x488b71(_0x4c2835[_0x4bf0('0x14')][_0x4bf0('0x1c')]);}else{_0x488b71(_0x4c2835[_0x4bf0('0x1d')]);}})[_0x4bf0('0x1e')](function(_0x2ec628){_0x4a5be8(_0x2ec628);});});}function getAgent(_0x3b535f){return db[_0x4bf0('0x1f')][_0x4bf0('0x20')]({'where':{'id':_0x3b535f,'role':'agent'}})[_0x4bf0('0x1a')](checkError());}function getAgentCheckSession(_0xd86467,_0x4af1cd){return new BPromise(function(_0x1d4e37,_0x4d8e60){var _0x2773da=respondWithRpcPromise(_0x4bf0('0x21'));var _0x4de014=getAgent(_0xd86467);Promise[_0x4bf0('0x22')]([_0x2773da,_0x4de014])[_0x4bf0('0x1a')](function(_0x479cdf){var _0x4e53f2=_0x479cdf[0x0];var _0x5dda42=_0x479cdf[0x1];var _0x332a66=_[_0x4bf0('0x23')](_0x4e53f2[_0x4bf0('0x24')],function(_0x25909){return _0x25909[_0x4bf0('0x25')]==_0x5dda42['id']&&_0x25909[_0x4bf0('0x26')]==_0x4af1cd;});if(_0x332a66[_0x4bf0('0x27')]==0x1){_0x1d4e37(_0x5dda42);}else{_0x4d8e60(new RangeError(_0x4bf0('0x28')+_0x4af1cd+_0x4bf0('0x29')));}});});}exports['originate']=function(_0x2abc1e,_0x1868e4){logger[_0x4bf0('0x2a')](_0x4bf0('0x2b'),_0x2abc1e[_0x4bf0('0x2c')]);var _0x522b80=originateValidation[_0x4bf0('0xb')](_0x2abc1e[_0x4bf0('0x2c')]);if(_0x522b80[_0x4bf0('0x27')]>0x0){return _0x1868e4[_0x4bf0('0x17')](0x190)['json'](_0x522b80);}var _0x18c916=_0x2abc1e[_0x4bf0('0x2c')][_0x4bf0('0x2d')];var _0x22ad76=_0x2abc1e['body']['callNumber'];var _0x5f4b85=_0x2abc1e[_0x4bf0('0x2c')][_0x4bf0('0x2e')];var _0x3cdf5f=_0x2abc1e[_0x4bf0('0x2c')][_0x4bf0('0x2f')];return getAgent(_0x18c916)[_0x4bf0('0x1a')](function(_0x2c6d89){logger['info'](_0x4bf0('0x30'),_0x2c6d89[_0x4bf0('0x16')]);emit(util[_0x4bf0('0x31')](_0x4bf0('0x32'),_0x2c6d89[_0x4bf0('0x16')]),'webbar:originate',{'callNumber':_0x22ad76,'callerId':_0x5f4b85,'callbackUrl':_0x3cdf5f});return _0x1868e4[_0x4bf0('0x17')](0xc8)[_0x4bf0('0x33')]({'error':![],'message':_0x4bf0('0x34')});})['catch'](handleError(_0x1868e4));};exports[_0x4bf0('0x35')]=function(_0x2ba575,_0x578ca9){logger[_0x4bf0('0x2a')](_0x4bf0('0x36'),_0x2ba575['body']);var _0x34f478=hangupValidation['validate'](_0x2ba575['body']);if(_0x34f478[_0x4bf0('0x27')]>0x0){return _0x578ca9['status'](0x190)[_0x4bf0('0x33')](_0x34f478);}var _0x59bb06=_0x2ba575[_0x4bf0('0x2c')][_0x4bf0('0x2d')];var _0x218c32=_0x2ba575[_0x4bf0('0x2c')]['sessionId'];return getAgent(_0x59bb06)[_0x4bf0('0x1a')](function(_0x493da4){logger['info'](_0x4bf0('0x30'),_0x493da4[_0x4bf0('0x16')]);emit(util['format'](_0x4bf0('0x32'),_0x493da4[_0x4bf0('0x16')]),'webbar:hangup',{'sessionId':_0x218c32});return _0x578ca9[_0x4bf0('0x17')](0xc8)['json']({'error':![],'message':_0x4bf0('0x37')});})[_0x4bf0('0x1e')](handleError(_0x578ca9));};exports[_0x4bf0('0x38')]=function(_0xc31c13,_0x13ca49){logger['info']('answer\x20fired:',_0xc31c13['body']);var _0x458911=answerValidation['validate'](_0xc31c13[_0x4bf0('0x2c')]);if(_0x458911[_0x4bf0('0x27')]>0x0){return _0x13ca49['status'](0x190)[_0x4bf0('0x33')](_0x458911);}var _0x564c5a=_0xc31c13[_0x4bf0('0x2c')][_0x4bf0('0x2d')];var _0x3b02c5=_0xc31c13[_0x4bf0('0x2c')][_0x4bf0('0x26')];return getAgent(_0x564c5a)[_0x4bf0('0x1a')](function(_0x422b63){logger[_0x4bf0('0x2a')](_0x4bf0('0x30'),_0x422b63[_0x4bf0('0x16')]);emit(util[_0x4bf0('0x31')]('user:%s',_0x422b63[_0x4bf0('0x16')]),_0x4bf0('0x39'),{'sessionId':_0x3b02c5});return _0x13ca49[_0x4bf0('0x17')](0xc8)[_0x4bf0('0x33')]({'error':![],'message':_0x4bf0('0x3a')});})[_0x4bf0('0x1e')](handleError(_0x13ca49));};exports[_0x4bf0('0x3b')]=function(_0x3ed00b,_0x47521f){logger[_0x4bf0('0x2a')]('hold\x20fired:',_0x3ed00b[_0x4bf0('0x2c')]);var _0x622e4b=holdValidation[_0x4bf0('0xb')](_0x3ed00b[_0x4bf0('0x2c')]);if(_0x622e4b[_0x4bf0('0x27')]>0x0){return _0x47521f[_0x4bf0('0x17')](0x190)[_0x4bf0('0x33')](_0x622e4b);}var _0x5c5157=_0x3ed00b[_0x4bf0('0x2c')]['userId'];var _0x254a8d=_0x3ed00b[_0x4bf0('0x2c')][_0x4bf0('0x26')];return getAgent(_0x5c5157)[_0x4bf0('0x1a')](function(_0x52dc0){logger['info'](_0x4bf0('0x30'),_0x52dc0['name']);emit(util[_0x4bf0('0x31')](_0x4bf0('0x32'),_0x52dc0[_0x4bf0('0x16')]),_0x4bf0('0x3c'),{'sessionId':_0x254a8d});return _0x47521f[_0x4bf0('0x17')](0xc8)[_0x4bf0('0x33')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x47521f));};exports[_0x4bf0('0x3d')]=function(_0x4209a5,_0xd3611c){logger[_0x4bf0('0x2a')](_0x4bf0('0x3e'),_0x4209a5['body']);var _0x566fe9=unholdValidation[_0x4bf0('0xb')](_0x4209a5['body']);if(_0x566fe9[_0x4bf0('0x27')]>0x0){return _0xd3611c[_0x4bf0('0x17')](0x190)[_0x4bf0('0x33')](_0x566fe9);}var _0x24af84=_0x4209a5[_0x4bf0('0x2c')][_0x4bf0('0x2d')];var _0x274a31=_0x4209a5[_0x4bf0('0x2c')]['sessionId'];return getAgent(_0x24af84)[_0x4bf0('0x1a')](function(_0x3e4755){logger[_0x4bf0('0x2a')](_0x4bf0('0x30'),_0x3e4755[_0x4bf0('0x16')]);emit(util[_0x4bf0('0x31')](_0x4bf0('0x32'),_0x3e4755[_0x4bf0('0x16')]),_0x4bf0('0x3f'),{'sessionId':_0x274a31});return _0xd3611c['status'](0xc8)[_0x4bf0('0x33')]({'error':![],'message':'unhold\x20executed!'});})[_0x4bf0('0x1e')](handleError(_0xd3611c));};exports['calls']=function(_0x1f3df3,_0x5150c0){logger[_0x4bf0('0x2a')](_0x4bf0('0x40'),_0x5150c0[_0x4bf0('0x2c')]);var _0x311ad4=callsValidation[_0x4bf0('0xb')](_0x1f3df3['body']);if(_0x311ad4['length']>0x0){return _0x5150c0[_0x4bf0('0x17')](0x190)['json'](_0x311ad4);}var _0x3c26b5=_0x1f3df3['body']['userId'];var _0x2a4550=respondWithRpcPromise('VoiceChannels');var _0x560064=getAgent(_0x3c26b5);return Promise[_0x4bf0('0x22')]([_0x2a4550,_0x560064])['then'](function(_0x243527){var _0x293ff0=_0x243527[0x0];var _0x502bfa=_0x243527[0x1];var _0x57b45f=_[_0x4bf0('0x23')](_0x293ff0[_0x4bf0('0x24')],function(_0xbf04f7){return _0xbf04f7['UserId']==_0x502bfa['id'];});return _0x5150c0[_0x4bf0('0x17')](0xc8)[_0x4bf0('0x33')]({'count':_0x57b45f[_0x4bf0('0x27')],'rows':_0x57b45f});})['catch'](handleError(_0x5150c0));};exports[_0x4bf0('0x41')]=function(_0x1a625a,_0x3d4863){logger[_0x4bf0('0x2a')](_0x4bf0('0x42'),_0x1a625a[_0x4bf0('0x2c')]);var _0x3a1b0b=conferenceValidation[_0x4bf0('0xb')](_0x1a625a['body']);if(_0x3a1b0b['length']>0x0){return _0x3d4863[_0x4bf0('0x17')](0x190)[_0x4bf0('0x33')](_0x3a1b0b);}var _0x33834c=_0x1a625a[_0x4bf0('0x2c')][_0x4bf0('0x2d')];return getAgent(_0x33834c)['then'](function(_0x164288){logger[_0x4bf0('0x2a')](_0x4bf0('0x30'),_0x164288['name']);emit(util[_0x4bf0('0x31')](_0x4bf0('0x32'),_0x164288['name']),_0x4bf0('0x43'));return _0x3d4863[_0x4bf0('0x17')](0xc8)['json']({'error':![],'message':_0x4bf0('0x44')});})[_0x4bf0('0x1e')](handleError(_0x3d4863));};exports[_0x4bf0('0x45')]=function(_0x4ec516,_0x23afd1){logger[_0x4bf0('0x2a')](_0x4bf0('0x46'),_0x4ec516[_0x4bf0('0x2c')]);var _0x2cdee4=transferValidation[_0x4bf0('0xb')](_0x4ec516['body']);if(_0x2cdee4['length']>0x0){return _0x23afd1[_0x4bf0('0x17')](0x190)[_0x4bf0('0x33')](_0x2cdee4);}var _0x531808=_0x4ec516[_0x4bf0('0x2c')][_0x4bf0('0x2d')];var _0x37aef7=_0x4ec516[_0x4bf0('0x2c')][_0x4bf0('0x26')];var _0x1d8843=_0x4ec516[_0x4bf0('0x2c')]['transferNumber'];return getAgent(_0x531808)[_0x4bf0('0x1a')](function(_0x3ba6c5){logger[_0x4bf0('0x2a')]('entityFound:',_0x3ba6c5['name']);emit(util['format'](_0x4bf0('0x32'),_0x3ba6c5[_0x4bf0('0x16')]),_0x4bf0('0x47'),{'sessionId':_0x37aef7,'transferNumber':_0x1d8843});return _0x23afd1['status'](0xc8)[_0x4bf0('0x33')]({'error':![],'message':_0x4bf0('0x48')});})[_0x4bf0('0x1e')](handleError(_0x23afd1));}; \ No newline at end of file +var _0x93eb=['name','status','send','NotFound','request','code','message','result','catch','User','agent','then','VoiceChannels','all','filter','UserId','length','sessionId\x20','\x20not\x20found!','originate','info','body','json','userId','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','sessionId','entityFound:','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20executed!','calls\x20fired:','rows','conference','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','log','handleError:','error','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93eb,0x7d));var _0xb93e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x93eb[_0x46e363];return _0x3fb059;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xb93e('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0xb93e('0x1'));var util=require(_0xb93e('0x2'));var BPromise=require(_0xb93e('0x3'));var jayson=require(_0xb93e('0x4'));var amiClient=jayson[_0xb93e('0x5')]['http']({'port':0x232a});var logger=require(_0xb93e('0x6'))('webbarapi');var Redis=require(_0xb93e('0x7'));config[_0xb93e('0x8')]=_[_0xb93e('0x9')](config[_0xb93e('0x8')],{'host':_0xb93e('0xa'),'port':0x18eb});var io=require(_0xb93e('0xb'))(new Redis(config[_0xb93e('0x8')]));var Schema=require(_0xb93e('0xc'));var originateValidation=new Schema({'userId':{'type':_0xb93e('0xd'),'required':[!![],_0xb93e('0xe')]},'callNumber':{'type':_0xb93e('0xf'),'required':[!![],_0xb93e('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xb93e('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xb93e('0xd'),'required':[!![],_0xb93e('0xe')]},'sessionId':{'type':_0xb93e('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xb93e('0xd'),'required':[!![],_0xb93e('0xe')]},'sessionId':{'type':_0xb93e('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xb93e('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xb93e('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xb93e('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xb93e('0xd'),'required':[!![],_0xb93e('0xe')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xb93e('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xb93e('0xd'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xb93e('0xd'),'required':[!![],_0xb93e('0xe')]}});function emit(_0xf89e25,_0x59bbb1,_0x20e43c){logger['info'](_0xf89e25,_0x59bbb1,JSON['stringify'](_0x20e43c));io['to'](_0xf89e25)['emit'](_0x59bbb1,_0x20e43c);}function handleError(_0x30741c){return function(_0x374cd8){console[_0xb93e('0x11')](_0xb93e('0x12'),_0x374cd8,_0x374cd8 instanceof RangeError);logger[_0xb93e('0x13')](_0x374cd8[_0xb93e('0x14')]);if(_0x374cd8 instanceof RangeError){if(_0x374cd8['name']){delete _0x374cd8[_0xb93e('0x15')];}_0x30741c[_0xb93e('0x16')](0x194)[_0xb93e('0x17')](_0x374cd8);}else{if(_0x374cd8[_0xb93e('0x15')]){delete _0x374cd8[_0xb93e('0x15')];}_0x30741c['status'](0x1f4)['send'](_0x374cd8);}};}function checkError(){return function(_0x8927f1){if(!_0x8927f1){throw new RangeError(_0xb93e('0x18'));}return _0x8927f1;};}function respondWithRpcPromise(_0x10fdb9,_0x5c6408){return new BPromise(function(_0x450c02,_0x5a0f28){var _0x9c7232=amiClient;return _0x9c7232[_0xb93e('0x19')](_0x10fdb9,_0x5c6408)['then'](function(_0x1d0052){if(_0x1d0052['error']){if(_0x1d0052['error'][_0xb93e('0x1a')]===0x1f4){return _0x5a0f28(_0x1d0052[_0xb93e('0x13')][_0xb93e('0x1b')]);}return _0x450c02(_0x1d0052[_0xb93e('0x13')][_0xb93e('0x1b')]);}else{_0x450c02(_0x1d0052[_0xb93e('0x1c')]);}})[_0xb93e('0x1d')](function(_0xcd0301){_0x5a0f28(_0xcd0301);});});}function getAgent(_0x483a88){return db[_0xb93e('0x1e')]['findOne']({'where':{'id':_0x483a88,'role':_0xb93e('0x1f')}})[_0xb93e('0x20')](checkError());}function getAgentCheckSession(_0x562bfe,_0x543b9e){return new BPromise(function(_0x406e67,_0x34133b){var _0x377774=respondWithRpcPromise(_0xb93e('0x21'));var _0x12fb12=getAgent(_0x562bfe);Promise[_0xb93e('0x22')]([_0x377774,_0x12fb12])[_0xb93e('0x20')](function(_0x26bd9e){var _0x2f5ba0=_0x26bd9e[0x0];var _0x2bfc64=_0x26bd9e[0x1];var _0x39b928=_[_0xb93e('0x23')](_0x2f5ba0['rows'],function(_0x2032a6){return _0x2032a6[_0xb93e('0x24')]==_0x2bfc64['id']&&_0x2032a6['sessionId']==_0x543b9e;});if(_0x39b928[_0xb93e('0x25')]==0x1){_0x406e67(_0x2bfc64);}else{_0x34133b(new RangeError(_0xb93e('0x26')+_0x543b9e+_0xb93e('0x27')));}});});}exports[_0xb93e('0x28')]=function(_0x50ad16,_0x409f59){logger[_0xb93e('0x29')]('originate\x20fired:',_0x50ad16[_0xb93e('0x2a')]);var _0x29f63d=originateValidation[_0xb93e('0xc')](_0x50ad16['body']);if(_0x29f63d['length']>0x0){return _0x409f59['status'](0x190)[_0xb93e('0x2b')](_0x29f63d);}var _0x2f085d=_0x50ad16[_0xb93e('0x2a')][_0xb93e('0x2c')];var _0x4f40c2=_0x50ad16[_0xb93e('0x2a')]['callNumber'];var _0x51d502=_0x50ad16[_0xb93e('0x2a')][_0xb93e('0x2d')];var _0x24aaf2=_0x50ad16[_0xb93e('0x2a')][_0xb93e('0x2e')];return getAgent(_0x2f085d)[_0xb93e('0x20')](function(_0x226bbc){logger['info']('entityFound:',_0x226bbc[_0xb93e('0x15')]);emit(util[_0xb93e('0x2f')](_0xb93e('0x30'),_0x226bbc[_0xb93e('0x15')]),_0xb93e('0x31'),{'callNumber':_0x4f40c2,'callerId':_0x51d502,'callbackUrl':_0x24aaf2});return _0x409f59['status'](0xc8)[_0xb93e('0x2b')]({'error':![],'message':_0xb93e('0x32')});})[_0xb93e('0x1d')](handleError(_0x409f59));};exports[_0xb93e('0x33')]=function(_0x5b41a1,_0x2985b7){logger[_0xb93e('0x29')](_0xb93e('0x34'),_0x5b41a1['body']);var _0x225461=hangupValidation['validate'](_0x5b41a1[_0xb93e('0x2a')]);if(_0x225461['length']>0x0){return _0x2985b7[_0xb93e('0x16')](0x190)[_0xb93e('0x2b')](_0x225461);}var _0x2de30d=_0x5b41a1[_0xb93e('0x2a')][_0xb93e('0x2c')];var _0x1ad69c=_0x5b41a1[_0xb93e('0x2a')][_0xb93e('0x35')];return getAgent(_0x2de30d)[_0xb93e('0x20')](function(_0x47d5e9){logger[_0xb93e('0x29')](_0xb93e('0x36'),_0x47d5e9[_0xb93e('0x15')]);emit(util[_0xb93e('0x2f')]('user:%s',_0x47d5e9[_0xb93e('0x15')]),_0xb93e('0x37'),{'sessionId':_0x1ad69c});return _0x2985b7[_0xb93e('0x16')](0xc8)['json']({'error':![],'message':_0xb93e('0x38')});})[_0xb93e('0x1d')](handleError(_0x2985b7));};exports[_0xb93e('0x39')]=function(_0x4dd794,_0x52d427){logger['info']('answer\x20fired:',_0x4dd794[_0xb93e('0x2a')]);var _0x46cdd5=answerValidation[_0xb93e('0xc')](_0x4dd794[_0xb93e('0x2a')]);if(_0x46cdd5[_0xb93e('0x25')]>0x0){return _0x52d427[_0xb93e('0x16')](0x190)[_0xb93e('0x2b')](_0x46cdd5);}var _0x4c787c=_0x4dd794[_0xb93e('0x2a')]['userId'];var _0x46b416=_0x4dd794[_0xb93e('0x2a')][_0xb93e('0x35')];return getAgent(_0x4c787c)[_0xb93e('0x20')](function(_0x4c2541){logger[_0xb93e('0x29')](_0xb93e('0x36'),_0x4c2541['name']);emit(util['format'](_0xb93e('0x30'),_0x4c2541['name']),_0xb93e('0x3a'),{'sessionId':_0x46b416});return _0x52d427[_0xb93e('0x16')](0xc8)[_0xb93e('0x2b')]({'error':![],'message':_0xb93e('0x3b')});})[_0xb93e('0x1d')](handleError(_0x52d427));};exports[_0xb93e('0x3c')]=function(_0x211010,_0x33cf89){logger[_0xb93e('0x29')](_0xb93e('0x3d'),_0x211010[_0xb93e('0x2a')]);var _0x44ff8d=holdValidation[_0xb93e('0xc')](_0x211010[_0xb93e('0x2a')]);if(_0x44ff8d[_0xb93e('0x25')]>0x0){return _0x33cf89[_0xb93e('0x16')](0x190)[_0xb93e('0x2b')](_0x44ff8d);}var _0xb5565f=_0x211010[_0xb93e('0x2a')][_0xb93e('0x2c')];var _0x57e352=_0x211010[_0xb93e('0x2a')]['sessionId'];return getAgent(_0xb5565f)[_0xb93e('0x20')](function(_0x389df0){logger[_0xb93e('0x29')](_0xb93e('0x36'),_0x389df0[_0xb93e('0x15')]);emit(util[_0xb93e('0x2f')]('user:%s',_0x389df0[_0xb93e('0x15')]),'webbar:hold',{'sessionId':_0x57e352});return _0x33cf89[_0xb93e('0x16')](0xc8)['json']({'error':![],'message':_0xb93e('0x3e')});})[_0xb93e('0x1d')](handleError(_0x33cf89));};exports[_0xb93e('0x3f')]=function(_0x1f6ddf,_0x1f8dc9){logger[_0xb93e('0x29')]('unhold\x20fired:',_0x1f6ddf[_0xb93e('0x2a')]);var _0x5cd7d6=unholdValidation[_0xb93e('0xc')](_0x1f6ddf['body']);if(_0x5cd7d6[_0xb93e('0x25')]>0x0){return _0x1f8dc9[_0xb93e('0x16')](0x190)[_0xb93e('0x2b')](_0x5cd7d6);}var _0x2d6f12=_0x1f6ddf[_0xb93e('0x2a')]['userId'];var _0x27ff36=_0x1f6ddf['body'][_0xb93e('0x35')];return getAgent(_0x2d6f12)[_0xb93e('0x20')](function(_0x595369){logger['info'](_0xb93e('0x36'),_0x595369[_0xb93e('0x15')]);emit(util[_0xb93e('0x2f')]('user:%s',_0x595369[_0xb93e('0x15')]),'webbar:unhold',{'sessionId':_0x27ff36});return _0x1f8dc9[_0xb93e('0x16')](0xc8)[_0xb93e('0x2b')]({'error':![],'message':_0xb93e('0x40')});})[_0xb93e('0x1d')](handleError(_0x1f8dc9));};exports['calls']=function(_0x54a072,_0x307a55){logger[_0xb93e('0x29')](_0xb93e('0x41'),_0x307a55[_0xb93e('0x2a')]);var _0x162637=callsValidation[_0xb93e('0xc')](_0x54a072[_0xb93e('0x2a')]);if(_0x162637[_0xb93e('0x25')]>0x0){return _0x307a55[_0xb93e('0x16')](0x190)[_0xb93e('0x2b')](_0x162637);}var _0x2d1c93=_0x54a072[_0xb93e('0x2a')][_0xb93e('0x2c')];var _0x4e0fa6=respondWithRpcPromise(_0xb93e('0x21'));var _0x31b223=getAgent(_0x2d1c93);return Promise[_0xb93e('0x22')]([_0x4e0fa6,_0x31b223])[_0xb93e('0x20')](function(_0x57994f){var _0x4f5487=_0x57994f[0x0];var _0x378b12=_0x57994f[0x1];var _0x51d571=_[_0xb93e('0x23')](_0x4f5487[_0xb93e('0x42')],function(_0x1a4940){return _0x1a4940[_0xb93e('0x24')]==_0x378b12['id'];});return _0x307a55[_0xb93e('0x16')](0xc8)[_0xb93e('0x2b')]({'count':_0x51d571[_0xb93e('0x25')],'rows':_0x51d571});})[_0xb93e('0x1d')](handleError(_0x307a55));};exports[_0xb93e('0x43')]=function(_0x40a276,_0xb1e5ac){logger[_0xb93e('0x29')]('conference\x20fired:',_0x40a276[_0xb93e('0x2a')]);var _0x1eea41=conferenceValidation[_0xb93e('0xc')](_0x40a276['body']);if(_0x1eea41['length']>0x0){return _0xb1e5ac['status'](0x190)[_0xb93e('0x2b')](_0x1eea41);}var _0x2627c9=_0x40a276[_0xb93e('0x2a')][_0xb93e('0x2c')];return getAgent(_0x2627c9)[_0xb93e('0x20')](function(_0x1217f3){logger[_0xb93e('0x29')](_0xb93e('0x36'),_0x1217f3['name']);emit(util[_0xb93e('0x2f')](_0xb93e('0x30'),_0x1217f3[_0xb93e('0x15')]),_0xb93e('0x44'));return _0xb1e5ac['status'](0xc8)[_0xb93e('0x2b')]({'error':![],'message':_0xb93e('0x45')});})[_0xb93e('0x1d')](handleError(_0xb1e5ac));};exports['transfer']=function(_0x2a665c,_0x3a3d37){logger[_0xb93e('0x29')](_0xb93e('0x46'),_0x2a665c['body']);var _0x2daa3c=transferValidation[_0xb93e('0xc')](_0x2a665c[_0xb93e('0x2a')]);if(_0x2daa3c[_0xb93e('0x25')]>0x0){return _0x3a3d37[_0xb93e('0x16')](0x190)[_0xb93e('0x2b')](_0x2daa3c);}var _0x12be76=_0x2a665c[_0xb93e('0x2a')][_0xb93e('0x2c')];var _0x118cf5=_0x2a665c['body']['sessionId'];var _0x1a137f=_0x2a665c[_0xb93e('0x2a')][_0xb93e('0x47')];return getAgent(_0x12be76)[_0xb93e('0x20')](function(_0x209f54){logger[_0xb93e('0x29')](_0xb93e('0x36'),_0x209f54[_0xb93e('0x15')]);emit(util[_0xb93e('0x2f')](_0xb93e('0x30'),_0x209f54[_0xb93e('0x15')]),_0xb93e('0x48'),{'sessionId':_0x118cf5,'transferNumber':_0x1a137f});return _0x3a3d37[_0xb93e('0x16')](0xc8)[_0xb93e('0x2b')]({'error':![],'message':'transfer\x20executed!'});})[_0xb93e('0x1d')](handleError(_0x3a3d37));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 2d77bfc..504e9dd 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 _0xe1e3=['/:id/applications','addApplications','/:id/notify','send','put','delete','removeAgents','exports','multer','util','connect-timeout','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getApplications','create','post','/:id/dispositions','addAnswer'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x12bfb4,_0x21b6d9){_0x12bfb4=_0x12bfb4-0x0;var _0x41ec50=_0xe1e3[_0x12bfb4];return _0x41ec50;};'use strict';var multer=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var path=require('path');var timeout=require(_0x3e1e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3e1e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3e1e('0x4'));var controller=require(_0x3e1e('0x5'));router[_0x3e1e('0x6')]('/',auth[_0x3e1e('0x7')](),controller[_0x3e1e('0x8')]);router[_0x3e1e('0x6')]('/describe',auth[_0x3e1e('0x7')](),controller[_0x3e1e('0x9')]);router[_0x3e1e('0x6')](_0x3e1e('0xa'),auth[_0x3e1e('0x7')](),controller[_0x3e1e('0xb')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3e1e('0xc')]);router['get'](_0x3e1e('0xd'),auth[_0x3e1e('0x7')](),controller[_0x3e1e('0xe')]);router['get'](_0x3e1e('0xf'),auth['isAuthenticated'](),controller['getAgents']);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0x3e1e('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3e1e('0x11')]);router[_0x3e1e('0x12')](_0x3e1e('0x13'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x3e1e('0x12')](_0x3e1e('0xd'),auth['isAuthenticated'](),controller[_0x3e1e('0x14')]);router[_0x3e1e('0x12')]('/:id/users',auth[_0x3e1e('0x7')](),controller['addAgents']);router[_0x3e1e('0x12')](_0x3e1e('0x15'),auth[_0x3e1e('0x7')](),controller[_0x3e1e('0x16')]);router[_0x3e1e('0x12')](_0x3e1e('0x17'),controller['notify']);router['post']('/:id/send',auth[_0x3e1e('0x7')](),controller[_0x3e1e('0x18')]);router[_0x3e1e('0x19')]('/:id',auth[_0x3e1e('0x7')](),controller['update']);router[_0x3e1e('0x1a')](_0x3e1e('0xa'),auth[_0x3e1e('0x7')](),controller['destroy']);router[_0x3e1e('0x1a')](_0x3e1e('0x13'),auth[_0x3e1e('0x7')](),controller['removeDispositions']);router['delete'](_0x3e1e('0xd'),auth[_0x3e1e('0x7')](),controller['removeAnswers']);router[_0x3e1e('0x1a')](_0x3e1e('0xf'),auth[_0x3e1e('0x7')](),controller[_0x3e1e('0x1b')]);module[_0x3e1e('0x1c')]=router; \ No newline at end of file +var _0x1775=['getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addAgents','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers'];(function(_0x3372c5,_0xffce3f){var _0x3fcc44=function(_0x16651f){while(--_0x16651f){_0x3372c5['push'](_0x3372c5['shift']());}};_0x3fcc44(++_0xffce3f);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var auth=require(_0x5177('0x5'));var interaction=require(_0x5177('0x6'));var config=require(_0x5177('0x7'));var controller=require(_0x5177('0x8'));router[_0x5177('0x9')]('/',auth[_0x5177('0xa')](),controller[_0x5177('0xb')]);router[_0x5177('0x9')](_0x5177('0xc'),auth[_0x5177('0xa')](),controller[_0x5177('0xd')]);router[_0x5177('0x9')](_0x5177('0xe'),auth[_0x5177('0xa')](),controller[_0x5177('0xf')]);router[_0x5177('0x9')](_0x5177('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x5177('0x9')](_0x5177('0x11'),auth[_0x5177('0xa')](),controller[_0x5177('0x12')]);router[_0x5177('0x9')]('/:id/users',auth[_0x5177('0xa')](),controller[_0x5177('0x13')]);router[_0x5177('0x9')](_0x5177('0x14'),auth[_0x5177('0xa')](),controller[_0x5177('0x15')]);router[_0x5177('0x16')]('/',auth[_0x5177('0xa')](),controller[_0x5177('0x17')]);router[_0x5177('0x16')](_0x5177('0x10'),auth[_0x5177('0xa')](),controller[_0x5177('0x18')]);router[_0x5177('0x16')](_0x5177('0x11'),auth[_0x5177('0xa')](),controller[_0x5177('0x19')]);router[_0x5177('0x16')](_0x5177('0x1a'),auth['isAuthenticated'](),controller[_0x5177('0x1b')]);router[_0x5177('0x16')](_0x5177('0x14'),auth[_0x5177('0xa')](),controller['addApplications']);router[_0x5177('0x16')](_0x5177('0x1c'),controller[_0x5177('0x1d')]);router['post'](_0x5177('0x1e'),auth['isAuthenticated'](),controller[_0x5177('0x1f')]);router[_0x5177('0x20')](_0x5177('0xe'),auth[_0x5177('0xa')](),controller[_0x5177('0x21')]);router[_0x5177('0x22')](_0x5177('0xe'),auth[_0x5177('0xa')](),controller[_0x5177('0x23')]);router[_0x5177('0x22')](_0x5177('0x10'),auth[_0x5177('0xa')](),controller['removeDispositions']);router[_0x5177('0x22')]('/:id/canned_answers',auth[_0x5177('0xa')](),controller[_0x5177('0x24')]);router[_0x5177('0x22')](_0x5177('0x1a'),auth['isAuthenticated'](),controller[_0x5177('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 6a2105a..6ea7012 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 _0x8a5c=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8a5c,0x103));var _0xc8a5=function(_0xb6c692,_0x4faa5e){_0xb6c692=_0xb6c692-0x0;var _0x16b7f0=_0x8a5c[_0xb6c692];return _0x16b7f0;};'use strict';var Sequelize=require(_0xc8a5('0x0'));var rs=require(_0xc8a5('0x1'));module[_0xc8a5('0x2')]={'name':{'type':Sequelize[_0xc8a5('0x3')],'unique':_0xc8a5('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xc8a5('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xc8a5('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xc8a5('0x3')],'defaultValue':function(){return rs[_0xc8a5('0x5')]();}},'phone':{'type':Sequelize[_0xc8a5('0x3')]},'type':{'type':Sequelize[_0xc8a5('0x6')](_0xc8a5('0x7'))},'accountSid':{'type':Sequelize[_0xc8a5('0x3')]},'authToken':{'type':Sequelize[_0xc8a5('0x3')]},'notificationTemplate':{'type':Sequelize[_0xc8a5('0x8')],'defaultValue':function(){return _0xc8a5('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xc8a5('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc8a5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc8a5('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc8a5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc8a5('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc8a5('0xb')],'comment':_0xc8a5('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xc8a5('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x57562f){if(!_0x57562f){this[_0xc8a5('0xd')](_0xc8a5('0xe'),null);}this[_0xc8a5('0xd')]('mandatoryDisposition',_0x57562f);}},'description':{'type':Sequelize[_0xc8a5('0x3')]}}; \ No newline at end of file +var _0xfd92=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','generate','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xfd92,0x89));var _0x2fd9=function(_0x35c561,_0x1ade37){_0x35c561=_0x35c561-0x0;var _0x3c3f89=_0xfd92[_0x35c561];return _0x3c3f89;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x2fd9('0x0')]={'name':{'type':Sequelize[_0x2fd9('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x2fd9('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x2fd9('0x2')]();}},'phone':{'type':Sequelize[_0x2fd9('0x1')]},'type':{'type':Sequelize[_0x2fd9('0x3')]('twilio')},'accountSid':{'type':Sequelize[_0x2fd9('0x1')]},'authToken':{'type':Sequelize[_0x2fd9('0x1')]},'notificationTemplate':{'type':Sequelize[_0x2fd9('0x4')],'defaultValue':function(){return _0x2fd9('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x2fd9('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2fd9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2fd9('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2fd9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2fd9('0x7')],'comment':_0x2fd9('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x2fd9('0x6')],'defaultValue':![],'comment':_0x2fd9('0x9'),'set':function(_0x29b428){if(!_0x29b428){this[_0x2fd9('0xa')](_0x2fd9('0xb'),null);}this['setDataValue'](_0x2fd9('0xc'),_0x29b428);}},'description':{'type':Sequelize[_0x2fd9('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index ffc3f17..4a9a145 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 _0xded3=['order','sort','where','filters','filter','merge','type','VIRTUAL','options','WhatsappAccount','count','includeAll','findAll','rows','show','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','pick','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','priority','getApplications','whatsapp','account','orderBy','Applications','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','Sequelize','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','contact','WhatsappInteraction','interaction','created','autoclose','applications','close','unmanaged','WhatsappMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','List','defaults','out','Messages','dataValues','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','limit','Content-Range','reject','update','then','destroy','get','WhatsappAccounts','stack','name','send','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0xded3,0x75));var _0x3ded=function(_0x4ca538,_0xe09873){_0x4ca538=_0x4ca538-0x0;var _0x3c2324=_0xded3[_0x4ca538];return _0x3c2324;};'use strict';var pdf=require(_0x3ded('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3ded('0x1'));var zipdir=require(_0x3ded('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ded('0x3'));var moment=require(_0x3ded('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3ded('0x5'));var util=require(_0x3ded('0x6'));var path=require(_0x3ded('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3ded('0x8'));var fs=require('fs');var _=require(_0x3ded('0x9'));var squel=require(_0x3ded('0xa'));var crypto=require(_0x3ded('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3ded('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3ded('0xd'));var Papa=require(_0x3ded('0xe'));var Redis=require(_0x3ded('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3ded('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ded('0x11'));var logger=require(_0x3ded('0x12'))(_0x3ded('0x13'));var utils=require(_0x3ded('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3ded('0x15'));var db=require(_0x3ded('0x16'))['db'];config[_0x3ded('0x17')]=_['defaults'](config[_0x3ded('0x17')],{'host':_0x3ded('0x18'),'port':0x18eb});var socket=require(_0x3ded('0x19'))(new Redis(config[_0x3ded('0x17')]));require('./whatsappAccount.socket')[_0x3ded('0x1a')](socket);var jayson=require(_0x3ded('0x1b'));var client=jayson[_0x3ded('0x1c')][_0x3ded('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x17cbf8,_0x3b4da3,_0x1f0ff8,_0x3591eb){return new BPromise(function(_0x58b133,_0x1d6c11){var _0x3371c6=_0x3591eb||client;return _0x3371c6[_0x3ded('0x1e')](_0x17cbf8,_0x1f0ff8)['then'](function(_0x3034a8){logger[_0x3ded('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x3b4da3,'request\x20sent');logger['debug'](_0x3ded('0x20'),_0x3b4da3,_0x3ded('0x21'),JSON['stringify'](_0x3034a8));if(_0x3034a8[_0x3ded('0x22')]){if(_0x3034a8[_0x3ded('0x22')][_0x3ded('0x23')]===0x1f4){logger[_0x3ded('0x22')](_0x3ded('0x24'),_0x3b4da3,_0x3034a8['error'][_0x3ded('0x25')]);return _0x1d6c11(_0x3034a8[_0x3ded('0x22')]['message']);}logger['error'](_0x3ded('0x24'),_0x3b4da3,_0x3034a8[_0x3ded('0x22')][_0x3ded('0x25')]);return _0x58b133(_0x3034a8[_0x3ded('0x22')][_0x3ded('0x25')]);}else{logger[_0x3ded('0x1f')](_0x3ded('0x24'),_0x3b4da3,'request\x20sent');_0x58b133(_0x3034a8[_0x3ded('0x26')][_0x3ded('0x25')]);}})[_0x3ded('0x27')](function(_0x511ab5){logger['error'](_0x3ded('0x24'),_0x3b4da3,_0x511ab5);_0x1d6c11(_0x511ab5);});});}function respondWithStatusCode(_0x29217a,_0x59367a){_0x59367a=_0x59367a||0xcc;return function(_0xea3add){if(_0xea3add){return _0x29217a['sendStatus'](_0x59367a);}return _0x29217a[_0x3ded('0x28')](_0x59367a)[_0x3ded('0x29')]();};}function respondWithResult(_0x3e0b78,_0x1d1c45){_0x1d1c45=_0x1d1c45||0xc8;return function(_0x89b1f9){if(_0x89b1f9){return _0x3e0b78[_0x3ded('0x28')](_0x1d1c45)[_0x3ded('0x2a')](_0x89b1f9);}};}function respondWithFilteredResult(_0x1229b0,_0x53ad47){return function(_0x5be6bf){if(_0x5be6bf){var _0x5b524a=_0x5be6bf['count'],_0x2b008e=_0x53ad47[_0x3ded('0x2b')],_0x2cbf98=_0x53ad47[_0x3ded('0x2b')]+_0x53ad47[_0x3ded('0x2c')],_0x284285;if(_0x2cbf98>=_0x5b524a){_0x2cbf98=_0x5b524a;_0x284285=0xc8;}else{_0x284285=0xce;}_0x1229b0['status'](_0x284285);return _0x1229b0['set'](_0x3ded('0x2d'),_0x2b008e+'-'+_0x2cbf98+'/'+_0x5b524a)[_0x3ded('0x2a')](_0x5be6bf);}return null;};}function patchUpdates(_0x41b797){return function(_0x4728ff){try{jsonpatch['apply'](_0x4728ff,_0x41b797,!![]);}catch(_0x2e3293){return BPromise[_0x3ded('0x2e')](_0x2e3293);}return _0x4728ff['save']();};}function saveUpdates(_0x3a22ee,_0xf57f41){return function(_0x255e61){if(_0x255e61){return _0x255e61[_0x3ded('0x2f')](_0x3a22ee)[_0x3ded('0x30')](function(_0x564244){return _0x564244;});}return null;};}function removeEntity(_0x5056c4,_0xc4d763){return function(_0x43b50b){if(_0x43b50b){return _0x43b50b[_0x3ded('0x31')]()[_0x3ded('0x30')](function(){var _0x17c381=_0x43b50b[_0x3ded('0x32')]({'plain':!![]});var _0x5d217a=_0x3ded('0x33');return db['UserProfileResource'][_0x3ded('0x31')]({'where':{'type':_0x5d217a,'resourceId':_0x17c381['id']}})[_0x3ded('0x30')](function(){return _0x43b50b;});})[_0x3ded('0x30')](function(){_0x5056c4[_0x3ded('0x28')](0xcc)[_0x3ded('0x29')]();});}};}function handleEntityNotFound(_0x43ea6b,_0x290313){return function(_0x5f0814){if(!_0x5f0814){_0x43ea6b['sendStatus'](0x194);}return _0x5f0814;};}function handleError(_0x15db66,_0x156621){_0x156621=_0x156621||0x1f4;return function(_0x11f89b){logger['error'](_0x11f89b[_0x3ded('0x34')]);if(_0x11f89b[_0x3ded('0x35')]){delete _0x11f89b[_0x3ded('0x35')];}_0x15db66[_0x3ded('0x28')](_0x156621)[_0x3ded('0x36')](_0x11f89b);};}exports['index']=function(_0x26edc5,_0x261627){var _0x306be4={'include':[{'model':db['Pause'],'as':_0x3ded('0x37')}]},_0x37b36e={},_0x4f6634={'count':0x0,'rows':[]};var _0x109386=_[_0x3ded('0x38')](db['WhatsappAccount'][_0x3ded('0x39')],function(_0xe43cbc){return{'name':_0xe43cbc[_0x3ded('0x3a')],'type':_0xe43cbc['type'][_0x3ded('0x3b')]};});_0x37b36e[_0x3ded('0x3c')]=_['map'](_0x109386,_0x3ded('0x35'));_0x37b36e[_0x3ded('0x3d')]=_[_0x3ded('0x3e')](_0x26edc5[_0x3ded('0x3d')]);_0x37b36e['filters']=_[_0x3ded('0x3f')](_0x37b36e[_0x3ded('0x3c')],_0x37b36e[_0x3ded('0x3d')]);_0x306be4[_0x3ded('0x40')]=_[_0x3ded('0x3f')](_0x37b36e[_0x3ded('0x3c')],qs[_0x3ded('0x41')](_0x26edc5['query']['fields']));_0x306be4[_0x3ded('0x40')]=_0x306be4[_0x3ded('0x40')][_0x3ded('0x42')]?_0x306be4[_0x3ded('0x40')]:_0x37b36e['model'];if(!_0x26edc5[_0x3ded('0x3d')][_0x3ded('0x43')]('nolimit')){_0x306be4[_0x3ded('0x2c')]=qs[_0x3ded('0x2c')](_0x26edc5['query']['limit']);_0x306be4[_0x3ded('0x2b')]=qs[_0x3ded('0x2b')](_0x26edc5[_0x3ded('0x3d')][_0x3ded('0x2b')]);}_0x306be4[_0x3ded('0x44')]=qs[_0x3ded('0x45')](_0x26edc5[_0x3ded('0x3d')][_0x3ded('0x45')]);_0x306be4[_0x3ded('0x46')]=qs[_0x3ded('0x47')](_['pick'](_0x26edc5[_0x3ded('0x3d')],_0x37b36e[_0x3ded('0x47')]),_0x109386);if(_0x26edc5[_0x3ded('0x3d')][_0x3ded('0x48')]){_0x306be4['where']=_[_0x3ded('0x49')](_0x306be4[_0x3ded('0x46')],{'$or':_[_0x3ded('0x38')](_0x109386,function(_0x2368a7){if(_0x2368a7[_0x3ded('0x4a')]!==_0x3ded('0x4b')){var _0x31718f={};_0x31718f[_0x2368a7[_0x3ded('0x35')]]={'$like':'%'+_0x26edc5[_0x3ded('0x3d')][_0x3ded('0x48')]+'%'};return _0x31718f;}})});}_0x306be4=_[_0x3ded('0x49')]({},_0x306be4,_0x26edc5[_0x3ded('0x4c')]);var _0x1571d8={'where':_0x306be4[_0x3ded('0x46')]};return db[_0x3ded('0x4d')]['count'](_0x1571d8)[_0x3ded('0x30')](function(_0xb8c308){_0x4f6634[_0x3ded('0x4e')]=_0xb8c308;if(_0x26edc5[_0x3ded('0x3d')][_0x3ded('0x4f')]){_0x306be4['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x3ded('0x50')](_0x306be4);})[_0x3ded('0x30')](function(_0x4fc0f8){_0x4f6634[_0x3ded('0x51')]=_0x4fc0f8;return _0x4f6634;})[_0x3ded('0x30')](respondWithFilteredResult(_0x261627,_0x306be4))[_0x3ded('0x27')](handleError(_0x261627,null));};exports[_0x3ded('0x52')]=function(_0x3bd6d4,_0x1ebe33){var _0xf7861b={'raw':![],'where':{'id':_0x3bd6d4[_0x3ded('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0x3ded('0x37')}]},_0x5cb0c8={};_0x5cb0c8[_0x3ded('0x3c')]=_['keys'](db[_0x3ded('0x4d')][_0x3ded('0x39')]);_0x5cb0c8['query']=_[_0x3ded('0x3e')](_0x3bd6d4[_0x3ded('0x3d')]);_0x5cb0c8[_0x3ded('0x47')]=_['intersection'](_0x5cb0c8['model'],_0x5cb0c8[_0x3ded('0x3d')]);_0xf7861b[_0x3ded('0x40')]=_[_0x3ded('0x3f')](_0x5cb0c8[_0x3ded('0x3c')],qs['fields'](_0x3bd6d4[_0x3ded('0x3d')][_0x3ded('0x41')]));_0xf7861b['attributes']=_0xf7861b[_0x3ded('0x40')][_0x3ded('0x42')]?_0xf7861b[_0x3ded('0x40')]:_0x5cb0c8[_0x3ded('0x3c')];if(_0x3bd6d4[_0x3ded('0x3d')]['includeAll']){_0xf7861b['include']=[{'all':!![]}];}_0xf7861b=_[_0x3ded('0x49')]({},_0xf7861b,_0x3bd6d4['options']);return db[_0x3ded('0x4d')][_0x3ded('0x54')](_0xf7861b)[_0x3ded('0x30')](handleEntityNotFound(_0x1ebe33,null))[_0x3ded('0x30')](respondWithResult(_0x1ebe33,null))['catch'](handleError(_0x1ebe33,null));};exports['create']=function(_0x4c4c1a,_0x32cf1b){return db[_0x3ded('0x4d')][_0x3ded('0x55')](_0x4c4c1a['body'],{})['then'](function(_0xdba0e0){var _0x36837e=_0x4c4c1a[_0x3ded('0x56')]['get']({'plain':!![]});if(!_0x36837e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36837e[_0x3ded('0x57')]===_0x3ded('0x56')){var _0x33fd89=_0xdba0e0[_0x3ded('0x32')]({'plain':!![]});var _0x452828='WhatsappAccounts';return db[_0x3ded('0x58')]['find']({'where':{'name':_0x452828,'userProfileId':_0x36837e[_0x3ded('0x59')]},'raw':!![]})[_0x3ded('0x30')](function(_0x5835a6){if(_0x5835a6&&_0x5835a6[_0x3ded('0x5a')]===0x0){return db[_0x3ded('0x5b')]['create']({'name':_0x33fd89[_0x3ded('0x35')],'resourceId':_0x33fd89['id'],'type':_0x5835a6['name'],'sectionId':_0x5835a6['id']},{})[_0x3ded('0x30')](function(){return _0xdba0e0;});}else{return _0xdba0e0;}})['catch'](function(_0x579f78){logger[_0x3ded('0x22')](_0x3ded('0x5c'),_0x579f78);throw _0x579f78;});}return _0xdba0e0;})[_0x3ded('0x30')](respondWithResult(_0x32cf1b,0xc9))[_0x3ded('0x27')](handleError(_0x32cf1b,null));};exports[_0x3ded('0x2f')]=function(_0x2f2459,_0x159059){if(_0x2f2459[_0x3ded('0x5d')]['id']){delete _0x2f2459['body']['id'];}return db[_0x3ded('0x4d')][_0x3ded('0x54')]({'where':{'id':_0x2f2459[_0x3ded('0x53')]['id']},'include':[{'model':db[_0x3ded('0x5e')],'as':_0x3ded('0x37')}]})[_0x3ded('0x30')](handleEntityNotFound(_0x159059,null))[_0x3ded('0x30')](saveUpdates(_0x2f2459[_0x3ded('0x5d')],null))[_0x3ded('0x30')](respondWithResult(_0x159059,null))['catch'](handleError(_0x159059,null));};exports[_0x3ded('0x31')]=function(_0x6161da,_0x34c5a9){return db[_0x3ded('0x4d')][_0x3ded('0x54')]({'where':{'id':_0x6161da[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x34c5a9,null))[_0x3ded('0x30')](removeEntity(_0x34c5a9,null))['catch'](handleError(_0x34c5a9,null));};exports[_0x3ded('0x5f')]=function(_0x28330e,_0x4d2647){return db[_0x3ded('0x4d')][_0x3ded('0x5f')]()[_0x3ded('0x30')](respondWithResult(_0x4d2647,null))['catch'](handleError(_0x4d2647,null));};exports[_0x3ded('0x60')]=function(_0x5d6482,_0x4de14f,_0x12002a){if(_0x5d6482[_0x3ded('0x5d')]['id']){delete _0x5d6482['body']['id'];}return db[_0x3ded('0x4d')][_0x3ded('0x54')]({'where':{'id':_0x5d6482[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x4de14f,null))[_0x3ded('0x30')](function(_0x4f3576){if(_0x4f3576){_0x5d6482[_0x3ded('0x5d')][_0x3ded('0x61')]=_0x4f3576['id'];return db['Disposition']['create'](_0x5d6482[_0x3ded('0x5d')]);}})[_0x3ded('0x30')](respondWithResult(_0x4de14f,null))['catch'](handleError(_0x4de14f,null));};exports[_0x3ded('0x62')]=function(_0x57ecf2,_0x57f1f1,_0x5e1e25){var _0x3524a0={'raw':![],'where':{}};var _0x4159d1={};var _0xc7596d={'count':0x0,'rows':[]};return db[_0x3ded('0x4d')][_0x3ded('0x63')]({'where':{'id':_0x57ecf2[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x57f1f1,null))['then'](function(_0x53d5f0){if(_0x53d5f0){_0x4159d1['model']=_[_0x3ded('0x3e')](db[_0x3ded('0x64')][_0x3ded('0x39')]);_0x4159d1[_0x3ded('0x3d')]=_[_0x3ded('0x3e')](_0x57ecf2[_0x3ded('0x3d')]);_0x4159d1[_0x3ded('0x47')]=_[_0x3ded('0x3f')](_0x4159d1['model'],_0x4159d1['query']);_0x3524a0[_0x3ded('0x40')]=_[_0x3ded('0x3f')](_0x4159d1[_0x3ded('0x3c')],qs[_0x3ded('0x41')](_0x57ecf2['query']['fields']));_0x3524a0[_0x3ded('0x40')]=_0x3524a0['attributes'][_0x3ded('0x42')]?_0x3524a0[_0x3ded('0x40')]:_0x4159d1[_0x3ded('0x3c')];if(!_0x57ecf2[_0x3ded('0x3d')][_0x3ded('0x43')]('nolimit')){_0x3524a0[_0x3ded('0x2c')]=qs['limit'](_0x57ecf2[_0x3ded('0x3d')]['limit']);_0x3524a0['offset']=qs['offset'](_0x57ecf2[_0x3ded('0x3d')]['offset']);}_0x3524a0[_0x3ded('0x44')]=qs['sort'](_0x57ecf2[_0x3ded('0x3d')]['sort']);_0x3524a0['where']=qs[_0x3ded('0x47')](_[_0x3ded('0x65')](_0x57ecf2['query'],_0x4159d1[_0x3ded('0x47')]));_0x3524a0[_0x3ded('0x46')]['WhatsappAccountId']=_0x53d5f0['id'];if(_0x57ecf2[_0x3ded('0x3d')][_0x3ded('0x48')]){_0x3524a0[_0x3ded('0x46')]=_[_0x3ded('0x49')](_0x3524a0[_0x3ded('0x46')],{'$or':_[_0x3ded('0x38')](_0x3524a0[_0x3ded('0x40')],function(_0x1fd6d1){var _0x5c68f1={};_0x5c68f1[_0x1fd6d1]={'$like':'%'+_0x57ecf2[_0x3ded('0x3d')]['filter']+'%'};return _0x5c68f1;})});}_0x3524a0=_[_0x3ded('0x49')]({},_0x3524a0,_0x57ecf2[_0x3ded('0x4c')]);return db['Disposition']['count']({'where':_0x3524a0['where']})[_0x3ded('0x30')](function(_0x5846f6){_0xc7596d[_0x3ded('0x4e')]=_0x5846f6;if(_0x57ecf2['query'][_0x3ded('0x4f')]){_0x3524a0[_0x3ded('0x66')]=[{'all':!![]}];}return db[_0x3ded('0x64')][_0x3ded('0x50')](_0x3524a0);})[_0x3ded('0x30')](function(_0xa28714){_0xc7596d['rows']=_0xa28714;return _0xc7596d;});}})[_0x3ded('0x30')](respondWithFilteredResult(_0x57f1f1,_0x3524a0))['catch'](handleError(_0x57f1f1,null));};exports[_0x3ded('0x67')]=function(_0x576ca2,_0x25e818,_0x69003d){return db['WhatsappAccount'][_0x3ded('0x54')]({'where':{'id':_0x576ca2[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x25e818,null))[_0x3ded('0x30')](function(_0x237071){if(_0x237071){return _0x237071[_0x3ded('0x67')](_0x576ca2['query'][_0x3ded('0x68')]);}})['then'](respondWithStatusCode(_0x25e818,null))[_0x3ded('0x27')](handleError(_0x25e818,null));};exports[_0x3ded('0x69')]=function(_0x1e23b2,_0x3f8059,_0x2938e9){if(_0x1e23b2[_0x3ded('0x5d')]['id']){delete _0x1e23b2[_0x3ded('0x5d')]['id'];}return db['WhatsappAccount'][_0x3ded('0x54')]({'where':{'id':_0x1e23b2['params']['id']}})['then'](handleEntityNotFound(_0x3f8059,null))['then'](function(_0x1565fd){if(_0x1565fd){_0x1e23b2['body']['WhatsappAccountId']=_0x1565fd['id'];return db[_0x3ded('0x6a')][_0x3ded('0x55')](_0x1e23b2[_0x3ded('0x5d')]);}})['then'](respondWithResult(_0x3f8059,null))[_0x3ded('0x27')](handleError(_0x3f8059,null));};exports[_0x3ded('0x6b')]=function(_0x238b8d,_0x59a426,_0x1b879f){var _0x5b1ade={'raw':![],'where':{}};var _0x11cfef={};var _0x2ba577={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3ded('0x63')]({'where':{'id':_0x238b8d[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x59a426,null))[_0x3ded('0x30')](function(_0xf3a323){if(_0xf3a323){_0x11cfef['model']=_[_0x3ded('0x3e')](db[_0x3ded('0x6a')][_0x3ded('0x39')]);_0x11cfef[_0x3ded('0x3d')]=_[_0x3ded('0x3e')](_0x238b8d[_0x3ded('0x3d')]);_0x11cfef['filters']=_['intersection'](_0x11cfef[_0x3ded('0x3c')],_0x11cfef[_0x3ded('0x3d')]);_0x5b1ade[_0x3ded('0x40')]=_['intersection'](_0x11cfef[_0x3ded('0x3c')],qs[_0x3ded('0x41')](_0x238b8d[_0x3ded('0x3d')][_0x3ded('0x41')]));_0x5b1ade['attributes']=_0x5b1ade[_0x3ded('0x40')]['length']?_0x5b1ade['attributes']:_0x11cfef[_0x3ded('0x3c')];if(!_0x238b8d[_0x3ded('0x3d')][_0x3ded('0x43')](_0x3ded('0x6c'))){_0x5b1ade[_0x3ded('0x2c')]=qs[_0x3ded('0x2c')](_0x238b8d[_0x3ded('0x3d')]['limit']);_0x5b1ade[_0x3ded('0x2b')]=qs[_0x3ded('0x2b')](_0x238b8d[_0x3ded('0x3d')][_0x3ded('0x2b')]);}_0x5b1ade[_0x3ded('0x44')]=qs[_0x3ded('0x45')](_0x238b8d[_0x3ded('0x3d')][_0x3ded('0x45')]);_0x5b1ade['where']=qs['filters'](_['pick'](_0x238b8d['query'],_0x11cfef['filters']));_0x5b1ade[_0x3ded('0x46')][_0x3ded('0x61')]=_0xf3a323['id'];if(_0x238b8d['query'][_0x3ded('0x48')]){_0x5b1ade[_0x3ded('0x46')]=_[_0x3ded('0x49')](_0x5b1ade[_0x3ded('0x46')],{'$or':_[_0x3ded('0x38')](_0x5b1ade['attributes'],function(_0x3d59a7){var _0x1c456c={};_0x1c456c[_0x3d59a7]={'$like':'%'+_0x238b8d['query']['filter']+'%'};return _0x1c456c;})});}_0x5b1ade=_['merge']({},_0x5b1ade,_0x238b8d[_0x3ded('0x4c')]);return db[_0x3ded('0x6a')]['count']({'where':_0x5b1ade['where']})[_0x3ded('0x30')](function(_0x4aed63){_0x2ba577['count']=_0x4aed63;if(_0x238b8d[_0x3ded('0x3d')]['includeAll']){_0x5b1ade[_0x3ded('0x66')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3ded('0x50')](_0x5b1ade);})[_0x3ded('0x30')](function(_0x29af19){_0x2ba577[_0x3ded('0x51')]=_0x29af19;return _0x2ba577;});}})[_0x3ded('0x30')](respondWithFilteredResult(_0x59a426,_0x5b1ade))[_0x3ded('0x27')](handleError(_0x59a426,null));};exports[_0x3ded('0x6d')]=function(_0x2a3891,_0x435aa5,_0x19434){return db[_0x3ded('0x4d')][_0x3ded('0x54')]({'where':{'id':_0x2a3891[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x435aa5,null))['then'](function(_0x268a19){if(_0x268a19){return _0x268a19[_0x3ded('0x6d')](_0x2a3891[_0x3ded('0x3d')]['ids']);}})['then'](respondWithStatusCode(_0x435aa5,null))['catch'](handleError(_0x435aa5,null));};exports[_0x3ded('0x6e')]=function(_0xbb1a15,_0x2641d0,_0x2a9aa7){return db[_0x3ded('0x4d')][_0x3ded('0x54')]({'where':{'id':_0xbb1a15[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x2641d0,null))['then'](function(_0xd546b7){if(_0xd546b7){return _0xd546b7[_0x3ded('0x6e')](_0xbb1a15['body'][_0x3ded('0x68')],_[_0x3ded('0x6f')](_0xbb1a15['body'],['ids','id'])||{})[_0x3ded('0x70')](function(_0x153179){for(var _0xc46bca=0x0;_0xc46bca<_0xbb1a15[_0x3ded('0x5d')]['ids'][_0x3ded('0x42')];_0xc46bca+=0x1){socket[_0x3ded('0x71')](_0x3ded('0x72'),{'UserId':_0xbb1a15['body'][_0x3ded('0x68')][_0xc46bca],'WhatsappAccountId':_0xbb1a15[_0x3ded('0x53')]['id']});}return _0x153179;});}})[_0x3ded('0x30')](respondWithResult(_0x2641d0,null))[_0x3ded('0x27')](handleError(_0x2641d0,null));};exports['removeAgents']=function(_0x441cb2,_0x40ea57,_0x5e40af){return db[_0x3ded('0x4d')][_0x3ded('0x54')]({'where':{'id':_0x441cb2[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x40ea57,null))['then'](function(_0x1fa03c){if(_0x1fa03c){return _0x1fa03c[_0x3ded('0x73')](_0x441cb2[_0x3ded('0x3d')][_0x3ded('0x68')])[_0x3ded('0x30')](function(){if(_['isArray'](_0x441cb2[_0x3ded('0x3d')][_0x3ded('0x68')])){for(var _0x370744=0x0;_0x370744<_0x441cb2[_0x3ded('0x3d')][_0x3ded('0x68')]['length'];_0x370744+=0x1){socket[_0x3ded('0x71')](_0x3ded('0x74'),{'UserId':Number(_0x441cb2[_0x3ded('0x3d')][_0x3ded('0x68')][_0x370744]),'WhatsappAccountId':Number(_0x441cb2['params']['id'])});}}else{socket[_0x3ded('0x71')](_0x3ded('0x74'),{'UserId':Number(_0x441cb2[_0x3ded('0x3d')][_0x3ded('0x68')]),'WhatsappAccountId':Number(_0x441cb2['params']['id'])});}});}})[_0x3ded('0x30')](respondWithStatusCode(_0x40ea57,null))[_0x3ded('0x27')](handleError(_0x40ea57,null));};exports['getAgents']=function(_0x11ad5d,_0x29d829,_0x47fb00){var _0x341c84={};var _0x164aa9={};var _0x257a79;var _0x126a04;return db[_0x3ded('0x4d')][_0x3ded('0x63')]({'where':{'id':_0x11ad5d['params']['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x29d829,null))[_0x3ded('0x30')](function(_0x36a0ad){if(_0x36a0ad){_0x257a79=_0x36a0ad;_0x164aa9[_0x3ded('0x3c')]=_[_0x3ded('0x3e')](db['User']['rawAttributes']);_0x164aa9['query']=_[_0x3ded('0x3e')](_0x11ad5d[_0x3ded('0x3d')]);_0x164aa9['filters']=_[_0x3ded('0x3f')](_0x164aa9['model'],_0x164aa9[_0x3ded('0x3d')]);_0x341c84[_0x3ded('0x40')]=_[_0x3ded('0x3f')](_0x164aa9['model'],qs[_0x3ded('0x41')](_0x11ad5d[_0x3ded('0x3d')]['fields']));_0x341c84[_0x3ded('0x40')]=_0x341c84[_0x3ded('0x40')][_0x3ded('0x42')]?_0x341c84[_0x3ded('0x40')]:_0x164aa9[_0x3ded('0x3c')];_0x341c84[_0x3ded('0x44')]=qs[_0x3ded('0x45')](_0x11ad5d[_0x3ded('0x3d')][_0x3ded('0x45')]);_0x341c84[_0x3ded('0x46')]=qs[_0x3ded('0x47')](_[_0x3ded('0x65')](_0x11ad5d[_0x3ded('0x3d')],_0x164aa9[_0x3ded('0x47')]));if(_0x11ad5d[_0x3ded('0x3d')]['filter']){_0x341c84['where']=_[_0x3ded('0x49')](_0x341c84[_0x3ded('0x46')],{'$or':_[_0x3ded('0x38')](_0x341c84[_0x3ded('0x40')],function(_0x41e98d){var _0x9d62d2={};_0x9d62d2[_0x41e98d]={'$like':'%'+_0x11ad5d[_0x3ded('0x3d')][_0x3ded('0x48')]+'%'};return _0x9d62d2;})});}_0x341c84=_[_0x3ded('0x49')]({},_0x341c84,_0x11ad5d['options']);return _0x257a79[_0x3ded('0x75')](_0x341c84);}})[_0x3ded('0x30')](function(_0x21f7b0){if(_0x21f7b0){_0x126a04=_0x21f7b0[_0x3ded('0x42')];if(!_0x11ad5d['query']['hasOwnProperty']('nolimit')){_0x341c84[_0x3ded('0x2c')]=qs['limit'](_0x11ad5d[_0x3ded('0x3d')][_0x3ded('0x2c')]);_0x341c84[_0x3ded('0x2b')]=qs[_0x3ded('0x2b')](_0x11ad5d['query'][_0x3ded('0x2b')]);}return _0x257a79['getAgents'](_0x341c84);}})[_0x3ded('0x30')](function(_0x22b059){if(_0x22b059){return _0x22b059?{'count':_0x126a04,'rows':_0x22b059}:null;}})[_0x3ded('0x30')](respondWithResult(_0x29d829,null))[_0x3ded('0x27')](handleError(_0x29d829,null));};exports[_0x3ded('0x76')]=function(_0x49a7a6,_0x4b1267,_0x59a252){return db[_0x3ded('0x4d')][_0x3ded('0x63')]({'where':{'id':_0x49a7a6[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x4b1267,null))['then'](function(_0x4142bc){if(_0x4142bc){return db[_0x3ded('0x77')][_0x3ded('0x78')](function(_0xe18939){return db['WhatsappApplication'][_0x3ded('0x31')]({'where':{'WhatsappAccountId':_0x49a7a6[_0x3ded('0x53')]['id']},'transaction':_0xe18939})[_0x3ded('0x30')](function(_0x508855){var _0x23305d=_['map'](_0x49a7a6[_0x3ded('0x5d')],function(_0x20f330){_0x20f330[_0x3ded('0x61')]=_0x49a7a6['params']['id'];return _0x20f330;});return db[_0x3ded('0x79')]['bulkCreate'](_0x23305d,{'transaction':_0xe18939});});})[_0x3ded('0x30')](function(){return db[_0x3ded('0x79')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x49a7a6['params']['id']},'order':_0x3ded('0x7a')});});}})['then'](respondWithResult(_0x4b1267,null))[_0x3ded('0x27')](handleError(_0x4b1267,null));};exports['getApplications']=function(_0x6ec866,_0x1e924d,_0x539ec9){var _0x688429={};var _0x4b959b={};var _0x50692f;var _0x3f1b85;return db[_0x3ded('0x4d')][_0x3ded('0x63')]({'where':{'id':_0x6ec866['params']['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x1e924d,null))['then'](function(_0x457ff5){if(_0x457ff5){_0x50692f=_0x457ff5;_0x4b959b[_0x3ded('0x3c')]=_['keys'](db['WhatsappApplication']['rawAttributes']);_0x4b959b[_0x3ded('0x3d')]=_[_0x3ded('0x3e')](_0x6ec866['query']);_0x4b959b[_0x3ded('0x47')]=_['intersection'](_0x4b959b[_0x3ded('0x3c')],_0x4b959b[_0x3ded('0x3d')]);_0x688429[_0x3ded('0x40')]=_[_0x3ded('0x3f')](_0x4b959b['model'],qs[_0x3ded('0x41')](_0x6ec866[_0x3ded('0x3d')]['fields']));_0x688429[_0x3ded('0x40')]=_0x688429[_0x3ded('0x40')]['length']?_0x688429['attributes']:_0x4b959b[_0x3ded('0x3c')];_0x688429[_0x3ded('0x44')]=qs['sort'](_0x6ec866['query'][_0x3ded('0x45')]);_0x688429['where']=qs[_0x3ded('0x47')](_[_0x3ded('0x65')](_0x6ec866[_0x3ded('0x3d')],_0x4b959b['filters']));if(_0x6ec866[_0x3ded('0x3d')][_0x3ded('0x48')]){_0x688429['where']=_['merge'](_0x688429[_0x3ded('0x46')],{'$or':_[_0x3ded('0x38')](_0x688429[_0x3ded('0x40')],function(_0x78ddcb){var _0x3cca00={};_0x3cca00[_0x78ddcb]={'$like':'%'+_0x6ec866[_0x3ded('0x3d')][_0x3ded('0x48')]+'%'};return _0x3cca00;})});}_0x688429=_[_0x3ded('0x49')]({},_0x688429,_0x6ec866[_0x3ded('0x4c')]);return _0x50692f[_0x3ded('0x7b')](_0x688429);}})['then'](function(_0x1e2241){if(_0x1e2241){_0x3f1b85=_0x1e2241[_0x3ded('0x42')];if(!_0x6ec866[_0x3ded('0x3d')][_0x3ded('0x43')](_0x3ded('0x6c'))){_0x688429[_0x3ded('0x2c')]=qs[_0x3ded('0x2c')](_0x6ec866['query'][_0x3ded('0x2c')]);_0x688429[_0x3ded('0x2b')]=qs[_0x3ded('0x2b')](_0x6ec866[_0x3ded('0x3d')]['offset']);}return _0x50692f[_0x3ded('0x7b')](_0x688429);}})[_0x3ded('0x30')](function(_0x382440){if(_0x382440){return _0x382440?{'count':_0x3f1b85,'rows':_0x382440}:null;}})[_0x3ded('0x30')](respondWithResult(_0x1e924d,null))[_0x3ded('0x27')](handleError(_0x1e924d,null));};exports['notify']=function(_0x2c86f4,_0x31dfc2,_0x1d6cc5){var _0x2dd494={'channel':_0x3ded('0x7c')};var _0x9e4ee=[];var _0x19e274=[];var _0x33a10b={};return db['WhatsappAccount'][_0x3ded('0x54')]({'where':{'id':_0x2c86f4[_0x3ded('0x53')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x3ded('0x30')](handleEntityNotFound(_0x31dfc2,null))[_0x3ded('0x30')](function(_0xac8b7b){_0x2dd494[_0x3ded('0x7d')]=_0xac8b7b;_0x2dd494['applications']=_[_0x3ded('0x7e')](_0xac8b7b[_0x3ded('0x7f')],[_0x3ded('0x7a')],[_0x3ded('0x80')]);if(_0x2dd494[_0x3ded('0x7d')][_0x3ded('0x7f')]){delete _0x2dd494[_0x3ded('0x7d')][_0x3ded('0x7f')];}return db[_0x3ded('0x81')]['describe']();})[_0x3ded('0x30')](function(_0x4eb617){if(!_0x4eb617){throw new db['Sequelize'][(_0x3ded('0x82'))](_0x3ded('0x83'));}_0x9e4ee=_[_0x3ded('0x84')](_['keys'](_0x4eb617),[_0x3ded('0x85'),_0x3ded('0x86')]);_0x19e274=_[_0x3ded('0x84')](_[_0x3ded('0x3e')](_0x4eb617),[_0x3ded('0x85'),_0x3ded('0x86'),_0x3ded('0x87'),_0x3ded('0x88')]);_0x2dd494[_0x3ded('0x5d')]={'mapKey':_0x3ded('0x89')};if(_0x2dd494[_0x3ded('0x7d')][_0x3ded('0x4a')]&&_0x2dd494[_0x3ded('0x7d')][_0x3ded('0x4a')]===_0x3ded('0x8a')){_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x8b')]=_0x2c86f4[_0x3ded('0x5d')][_0x3ded('0x8c')][_0x3ded('0x8d')](_0x3ded('0x8e'),'');_0x2dd494[_0x3ded('0x5d')]['body']=_0x2c86f4[_0x3ded('0x5d')][_0x3ded('0x8f')];_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x90')]=_0x2c86f4[_0x3ded('0x5d')][_0x3ded('0x91')];}if(_0x2dd494['body']['id']){delete _0x2dd494[_0x3ded('0x5d')]['id'];}if(_['isNil'](_0x2dd494['body'][_0x3ded('0x8b')])){throw new db[(_0x3ded('0x92'))][(_0x3ded('0x82'))](_0x3ded('0x93'));}if(_[_0x3ded('0x94')](_0x2dd494['body'][_0x3ded('0x5d')])||_0x2dd494[_0x3ded('0x5d')]['body']===''){throw new db[(_0x3ded('0x92'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2dd494['body']['mapKey'])){throw new db['Sequelize'][(_0x3ded('0x82'))](_0x3ded('0x95')+_0x19e274);}if(!_[_0x3ded('0x96')](_0x19e274,_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x97')])){throw new db[(_0x3ded('0x92'))][(_0x3ded('0x82'))](_0x3ded('0x98')+_0x19e274);}_0x33a10b[_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x97')]]=_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x8b')];return db[_0x3ded('0x99')][_0x3ded('0x54')]({'where':{'id':_0x2dd494[_0x3ded('0x7d')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x3ded('0x9a'),'where':_0x33a10b,'limit':0x1,'order':[['updatedAt',_0x3ded('0x9b')]]}]});})[_0x3ded('0x30')](handleEntityNotFound(_0x31dfc2,null))['then'](function(_0x515a9b){if(_0x515a9b){_0x2dd494['list']=_[_0x3ded('0x6f')](_0x515a9b,[_0x3ded('0x9a')]);if(_0x515a9b[_0x3ded('0x9a')][_0x3ded('0x42')]){return _0x515a9b['Contacts'][0x0];}var _0x1a9afd=_['defaults'](_0x2dd494[_0x3ded('0x5d')],{'firstName':_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x8b')],'ListId':_0x515a9b['id']});_0x1a9afd[_0x2dd494[_0x3ded('0x5d')]['mapKey']]=_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x8b')];return db[_0x3ded('0x81')][_0x3ded('0x55')](_0x1a9afd,{'fields':_0x9e4ee,'raw':!![]});}})['then'](handleEntityNotFound(_0x31dfc2,null))[_0x3ded('0x30')](function(_0x4d3a16){if(_0x4d3a16){_0x2dd494[_0x3ded('0x9c')]=_0x4d3a16;var _0x3de40a={'ContactId':_0x4d3a16['id'],'phone':_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x8b')],'WhatsappAccountId':_0x2c86f4[_0x3ded('0x53')]['id']};var _0x59f4e9={'ContactId':_0x4d3a16['id'],'WhatsappAccountId':_0x2c86f4[_0x3ded('0x53')]['id'],'closed':![]};return db[_0x3ded('0x9d')][_0x3ded('0x54')]({'where':_0x59f4e9})[_0x3ded('0x30')](function(_0x3a8c02){if(_0x3a8c02){return[_0x3a8c02,![]];}return db[_0x3ded('0x9d')][_0x3ded('0x55')](_0x3de40a)[_0x3ded('0x30')](function(_0x18151a){return[_0x18151a,!![]];});});}})[_0x3ded('0x70')](function(_0x5715c7,_0x964556){_0x2dd494['interaction']=_0x5715c7[_0x3ded('0x32')]({'plain':!![]});_0x2dd494[_0x3ded('0x9e')][_0x3ded('0x9f')]=![];if(_0x964556){if(_0x2dd494['account'][_0x3ded('0xa0')]){_0x2dd494[_0x3ded('0xa1')]['push']({'id':0x0,'priority':_0x2dd494[_0x3ded('0xa1')][_0x3ded('0x42')]+0x1,'app':_0x3ded('0xa2'),'appdata':_0x3ded('0xa3'),'interval':'*,*,*,*'});}_0x2dd494[_0x3ded('0x9e')][_0x3ded('0x9f')]=!![];}return db[_0x3ded('0xa4')]['create']({'phone':_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x8b')],'messageId':_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x90')],'body':_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x5d')],'WhatsappAccountId':_0x2c86f4[_0x3ded('0x53')]['id'],'WhatsappInteractionId':_0x5715c7['id'],'direction':'in','ContactId':_0x5715c7['ContactId'],'AttachmentId':_0x2dd494[_0x3ded('0x5d')][_0x3ded('0xa5')]});})[_0x3ded('0x30')](function(_0x28c54c){_0x2dd494[_0x3ded('0x25')]=_0x28c54c;if(_0x2dd494[_0x3ded('0x9e')]['UserId']){return db[_0x3ded('0xa6')][_0x3ded('0x54')]({'attributes':['id',_0x3ded('0x35')],'where':{'id':_0x2dd494[_0x3ded('0x9e')][_0x3ded('0xa7')]}})['then'](function(_0x2cf480){if(_0x2cf480){_0x2dd494['applications'][_0x3ded('0xa8')]({'id':0x0,'priority':0x0,'app':_0x3ded('0xa9'),'appdata':_0x2cf480[_0x3ded('0x35')]+','+(_0x2dd494[_0x3ded('0x7d')][_0x3ded('0xaa')]||0xa),'interval':_0x3ded('0xab')});}return respondWithRpcPromise(_0x3ded('0xac'),_0x3ded('0xad'),_0x2dd494);});}return respondWithRpcPromise('Start',_0x3ded('0xad'),_0x2dd494);})[_0x3ded('0x30')](function(_0x1b69cf){if(_0x1b69cf){var _0x211426=0xc8;var _0x1e0581=_0x3ded('0xae');logger[_0x3ded('0x1f')](_0x3ded('0x20'),_0x1e0581,_0x211426,_0x3ded('0xaf'));logger['debug'](_0x3ded('0xb0'),_0x1e0581,_0x211426,_0x3ded('0xaf'),JSON['stringify'](_0x1b69cf));if(_0x2dd494[_0x3ded('0x7d')]['type']===_0x3ded('0x8a')){return _0x31dfc2['status'](_0x211426)[_0x3ded('0xb1')]('Content-Type','text/xml')[_0x3ded('0x36')](_0x3ded('0xb2'));}else{return _0x31dfc2[_0x3ded('0x28')](_0x211426)[_0x3ded('0x2a')](_0x1b69cf);}}})[_0x3ded('0x27')](handleError(_0x31dfc2,null));};exports[_0x3ded('0x36')]=function(_0x3e6972,_0x34a525,_0x381e01){var _0xffab00,_0x46a5e7,_0x353c30;if(_[_0x3ded('0x94')](_0x3e6972[_0x3ded('0x5d')][_0x3ded('0x5d')])||_0x3e6972[_0x3ded('0x5d')][_0x3ded('0x5d')]===''){throw new db['Sequelize'][(_0x3ded('0x82'))](_0x3ded('0xb3'));}if(_[_0x3ded('0x94')](_0x3e6972[_0x3ded('0x5d')]['to'])){throw new db[(_0x3ded('0x92'))][(_0x3ded('0x82'))]('to\x20is\x20mandatory');}_0xffab00=_0x3e6972[_0x3ded('0x5d')]['to'];return db[_0x3ded('0x4d')][_0x3ded('0x54')]({'where':{'id':_0x3e6972[_0x3ded('0x53')]['id']},'include':[{'model':db['CmList'],'as':_0x3ded('0xb4'),'include':[{'model':db[_0x3ded('0x81')],'as':_0x3ded('0x9a'),'where':{'mobile':_0xffab00},'limit':0x1,'order':[[_0x3ded('0x86'),'DESC']]}]}]})[_0x3ded('0x30')](handleEntityNotFound(_0x34a525,null))['then'](function(_0x480ad5){if(_0x480ad5&&_0x480ad5[_0x3ded('0xb4')]){_0x46a5e7=_0x480ad5[_0x3ded('0x32')]({'plain':!![]});if(_0x46a5e7[_0x3ded('0xb4')]&&_0x46a5e7[_0x3ded('0xb4')][_0x3ded('0x9a')]['length']){return _0x46a5e7['List'][_0x3ded('0x9a')][0x0];}return db[_0x3ded('0x81')]['create'](_[_0x3ded('0xb5')](_0x3e6972[_0x3ded('0x5d')],{'firstName':_0xffab00,'mobile':_0xffab00,'phone':_0xffab00,'ListId':_0x46a5e7[_0x3ded('0x88')]}));}})[_0x3ded('0x30')](handleEntityNotFound(_0x34a525,null))['then'](function(_0x4d7032){if(_0x4d7032){_0x353c30=_0x4d7032;return db[_0x3ded('0x9d')]['find']({'where':{'ContactId':_0x353c30['id'],'closed':![],'WhatsappAccountId':_0x46a5e7['id']}})[_0x3ded('0x30')](function(_0x20246f){if(_0x20246f){return[_0x20246f,![]];}return db[_0x3ded('0x9d')][_0x3ded('0x55')]({'UserId':_0x3e6972['user']['id'],'ContactId':_0x353c30['id'],'WhatsappAccountId':_0x46a5e7['id'],'phone':_0xffab00,'firstMsgDirection':_0x3ded('0xb6'),'Messages':[_[_0x3ded('0x49')](_0x3e6972['body'],{'read':![],'body':_0x3e6972['body'][_0x3ded('0x5d')],'phone':_0xffab00,'WhatsappAccountId':_0x46a5e7['id'],'UserId':_0x3e6972[_0x3ded('0x56')]['id'],'ContactId':_0x353c30['id']})]},{'include':[{'model':db[_0x3ded('0xa4')],'as':_0x3ded('0xb7')}]})['then'](function(_0x2d57d2){return[_0x2d57d2,!![]];});});}})[_0x3ded('0x70')](function(_0x55a679,_0x4a00ec){if(_0x4a00ec){return _0x55a679;}return db[_0x3ded('0xa4')][_0x3ded('0x55')](_[_0x3ded('0x49')](_0x3e6972[_0x3ded('0x5d')],{'read':![],'body':_0x3e6972[_0x3ded('0x5d')][_0x3ded('0x5d')],'phone':_0xffab00,'WhatsappAccountId':_0x46a5e7['id'],'WhatsappInteractionId':_0x55a679['id'],'UserId':_0x3e6972['user']['id'],'ContactId':_0x353c30['id']}))[_0x3ded('0x30')](function(_0x29a65a){_0x55a679[_0x3ded('0xb8')][_0x3ded('0xb7')]=[];_0x55a679[_0x3ded('0xb8')][_0x3ded('0xb7')]['push'](_0x29a65a['dataValues']);return _0x55a679;});})['then'](respondWithResult(_0x34a525,null))[_0x3ded('0x27')](handleError(_0x34a525,null));}; \ No newline at end of file +var _0x2307=['UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','findOne','order','WhatsappAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','hasOwnProperty','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','transaction','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','applications','asc','account','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','twilio','From','replace','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','from','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','debug','\x0a','to\x20is\x20mandatory','List','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','update','then','destroy','get','WhatsappAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','nolimit','sort','pick','where','merge','VIRTUAL','filter','WhatsappAccount','count','includeAll','include','findAll','rows','show','params','keys','length','options','create','role','user'];(function(_0x5430c8,_0x277376){var _0x4833a1=function(_0x33c6eb){while(--_0x33c6eb){_0x5430c8['push'](_0x5430c8['shift']());}};_0x4833a1(++_0x277376);}(_0x2307,0x1c1));var _0x7230=function(_0xee55d8,_0x31a01e){_0xee55d8=_0xee55d8-0x0;var _0x1e3ed3=_0x2307[_0xee55d8];return _0x1e3ed3;};'use strict';var pdf=require(_0x7230('0x0'));var emlformat=require(_0x7230('0x1'));var rimraf=require(_0x7230('0x2'));var zipdir=require(_0x7230('0x3'));var jsonpatch=require(_0x7230('0x4'));var rp=require(_0x7230('0x5'));var moment=require(_0x7230('0x6'));var BPromise=require(_0x7230('0x7'));var Mustache=require(_0x7230('0x8'));var util=require(_0x7230('0x9'));var path=require(_0x7230('0xa'));var sox=require(_0x7230('0xb'));var csv=require(_0x7230('0xc'));var ejs=require(_0x7230('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7230('0xe'));var crypto=require('crypto');var jsforce=require(_0x7230('0xf'));var deskjs=require(_0x7230('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7230('0x11'));var Redis=require(_0x7230('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7230('0x13'));var hardwareService=require(_0x7230('0x14'));var logger=require(_0x7230('0x15'))(_0x7230('0x16'));var utils=require('../../config/utils');var config=require(_0x7230('0x17'));var licenseUtil=require(_0x7230('0x18'));var db=require(_0x7230('0x19'))['db'];config[_0x7230('0x1a')]=_[_0x7230('0x1b')](config[_0x7230('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x7230('0x1c'))(new Redis(config[_0x7230('0x1a')]));require(_0x7230('0x1d'))[_0x7230('0x1e')](socket);var jayson=require(_0x7230('0x1f'));var client=jayson[_0x7230('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0xa9da93,_0x1e5c37,_0x1175a5,_0x3a5d57){return new BPromise(function(_0x330071,_0x58f8e8){var _0x144163=_0x3a5d57||client;return _0x144163[_0x7230('0x21')](_0xa9da93,_0x1175a5)['then'](function(_0x1b583f){logger[_0x7230('0x22')](_0x7230('0x23'),_0x1e5c37,_0x7230('0x24'));logger['debug'](_0x7230('0x25'),_0x1e5c37,_0x7230('0x24'),JSON[_0x7230('0x26')](_0x1b583f));if(_0x1b583f['error']){if(_0x1b583f['error'][_0x7230('0x27')]===0x1f4){logger[_0x7230('0x28')](_0x7230('0x23'),_0x1e5c37,_0x1b583f[_0x7230('0x28')][_0x7230('0x29')]);return _0x58f8e8(_0x1b583f[_0x7230('0x28')]['message']);}logger[_0x7230('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x1e5c37,_0x1b583f[_0x7230('0x28')][_0x7230('0x29')]);return _0x330071(_0x1b583f[_0x7230('0x28')][_0x7230('0x29')]);}else{logger[_0x7230('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x1e5c37,_0x7230('0x24'));_0x330071(_0x1b583f['result'][_0x7230('0x29')]);}})[_0x7230('0x2a')](function(_0x9734a2){logger[_0x7230('0x28')](_0x7230('0x23'),_0x1e5c37,_0x9734a2);_0x58f8e8(_0x9734a2);});});}function respondWithStatusCode(_0x28ed2e,_0x303cae){_0x303cae=_0x303cae||0xcc;return function(_0x336b90){if(_0x336b90){return _0x28ed2e[_0x7230('0x2b')](_0x303cae);}return _0x28ed2e[_0x7230('0x2c')](_0x303cae)[_0x7230('0x2d')]();};}function respondWithResult(_0x1de596,_0x5987db){_0x5987db=_0x5987db||0xc8;return function(_0x1bdd9d){if(_0x1bdd9d){return _0x1de596[_0x7230('0x2c')](_0x5987db)['json'](_0x1bdd9d);}};}function respondWithFilteredResult(_0x38c569,_0x4c5087){return function(_0x198e4d){if(_0x198e4d){var _0x33f6a9=_0x198e4d['count'],_0x1b2f51=_0x4c5087[_0x7230('0x2e')],_0x400d6c=_0x4c5087[_0x7230('0x2e')]+_0x4c5087[_0x7230('0x2f')],_0x3efe23;if(_0x400d6c>=_0x33f6a9){_0x400d6c=_0x33f6a9;_0x3efe23=0xc8;}else{_0x3efe23=0xce;}_0x38c569[_0x7230('0x2c')](_0x3efe23);return _0x38c569[_0x7230('0x30')](_0x7230('0x31'),_0x1b2f51+'-'+_0x400d6c+'/'+_0x33f6a9)[_0x7230('0x32')](_0x198e4d);}return null;};}function patchUpdates(_0x1c2870){return function(_0x1b206e){try{jsonpatch['apply'](_0x1b206e,_0x1c2870,!![]);}catch(_0xf78bde){return BPromise['reject'](_0xf78bde);}return _0x1b206e['save']();};}function saveUpdates(_0x1e4452,_0x32c93e){return function(_0x2db2ab){if(_0x2db2ab){return _0x2db2ab[_0x7230('0x33')](_0x1e4452)[_0x7230('0x34')](function(_0x1dcebc){return _0x1dcebc;});}return null;};}function removeEntity(_0x54f8e2,_0x2db102){return function(_0x42ca75){if(_0x42ca75){return _0x42ca75[_0x7230('0x35')]()['then'](function(){var _0x46d806=_0x42ca75[_0x7230('0x36')]({'plain':!![]});var _0x23815b=_0x7230('0x37');return db['UserProfileResource'][_0x7230('0x35')]({'where':{'type':_0x23815b,'resourceId':_0x46d806['id']}})[_0x7230('0x34')](function(){return _0x42ca75;});})[_0x7230('0x34')](function(){_0x54f8e2[_0x7230('0x2c')](0xcc)[_0x7230('0x2d')]();});}};}function handleEntityNotFound(_0x53c261,_0x427a4a){return function(_0x12b4f4){if(!_0x12b4f4){_0x53c261['sendStatus'](0x194);}return _0x12b4f4;};}function handleError(_0x1cfe6a,_0x39453e){_0x39453e=_0x39453e||0x1f4;return function(_0x13be24){logger['error'](_0x13be24[_0x7230('0x38')]);if(_0x13be24[_0x7230('0x39')]){delete _0x13be24[_0x7230('0x39')];}_0x1cfe6a['status'](_0x39453e)[_0x7230('0x3a')](_0x13be24);};}exports[_0x7230('0x3b')]=function(_0x22d3a6,_0x5ecc91){var _0x344ad0={'include':[{'model':db[_0x7230('0x3c')],'as':_0x7230('0x3d')}]},_0x1a56ee={},_0x16d386={'count':0x0,'rows':[]};var _0x5c1bc8=_[_0x7230('0x3e')](db['WhatsappAccount'][_0x7230('0x3f')],function(_0x48fbc6){return{'name':_0x48fbc6[_0x7230('0x40')],'type':_0x48fbc6[_0x7230('0x41')][_0x7230('0x42')]};});_0x1a56ee['model']=_[_0x7230('0x3e')](_0x5c1bc8,'name');_0x1a56ee[_0x7230('0x43')]=_['keys'](_0x22d3a6[_0x7230('0x43')]);_0x1a56ee[_0x7230('0x44')]=_[_0x7230('0x45')](_0x1a56ee[_0x7230('0x46')],_0x1a56ee['query']);_0x344ad0['attributes']=_['intersection'](_0x1a56ee['model'],qs['fields'](_0x22d3a6['query'][_0x7230('0x47')]));_0x344ad0['attributes']=_0x344ad0[_0x7230('0x48')]['length']?_0x344ad0[_0x7230('0x48')]:_0x1a56ee[_0x7230('0x46')];if(!_0x22d3a6[_0x7230('0x43')]['hasOwnProperty'](_0x7230('0x49'))){_0x344ad0[_0x7230('0x2f')]=qs[_0x7230('0x2f')](_0x22d3a6[_0x7230('0x43')][_0x7230('0x2f')]);_0x344ad0['offset']=qs['offset'](_0x22d3a6[_0x7230('0x43')][_0x7230('0x2e')]);}_0x344ad0['order']=qs['sort'](_0x22d3a6[_0x7230('0x43')][_0x7230('0x4a')]);_0x344ad0['where']=qs[_0x7230('0x44')](_[_0x7230('0x4b')](_0x22d3a6['query'],_0x1a56ee['filters']),_0x5c1bc8);if(_0x22d3a6['query']['filter']){_0x344ad0[_0x7230('0x4c')]=_[_0x7230('0x4d')](_0x344ad0[_0x7230('0x4c')],{'$or':_[_0x7230('0x3e')](_0x5c1bc8,function(_0x281913){if(_0x281913['type']!==_0x7230('0x4e')){var _0x33f3b6={};_0x33f3b6[_0x281913[_0x7230('0x39')]]={'$like':'%'+_0x22d3a6[_0x7230('0x43')][_0x7230('0x4f')]+'%'};return _0x33f3b6;}})});}_0x344ad0=_[_0x7230('0x4d')]({},_0x344ad0,_0x22d3a6['options']);var _0x16f960={'where':_0x344ad0[_0x7230('0x4c')]};return db[_0x7230('0x50')][_0x7230('0x51')](_0x16f960)['then'](function(_0x5f5abb){_0x16d386[_0x7230('0x51')]=_0x5f5abb;if(_0x22d3a6[_0x7230('0x43')][_0x7230('0x52')]){_0x344ad0[_0x7230('0x53')]=[{'all':!![]}];}return db[_0x7230('0x50')][_0x7230('0x54')](_0x344ad0);})[_0x7230('0x34')](function(_0x79a344){_0x16d386[_0x7230('0x55')]=_0x79a344;return _0x16d386;})['then'](respondWithFilteredResult(_0x5ecc91,_0x344ad0))[_0x7230('0x2a')](handleError(_0x5ecc91,null));};exports[_0x7230('0x56')]=function(_0x3af8e0,_0x283846){var _0x54eda5={'raw':![],'where':{'id':_0x3af8e0[_0x7230('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x7230('0x3d')}]},_0x3c7e1={};_0x3c7e1[_0x7230('0x46')]=_[_0x7230('0x58')](db['WhatsappAccount']['rawAttributes']);_0x3c7e1[_0x7230('0x43')]=_['keys'](_0x3af8e0['query']);_0x3c7e1[_0x7230('0x44')]=_[_0x7230('0x45')](_0x3c7e1[_0x7230('0x46')],_0x3c7e1[_0x7230('0x43')]);_0x54eda5['attributes']=_[_0x7230('0x45')](_0x3c7e1[_0x7230('0x46')],qs['fields'](_0x3af8e0[_0x7230('0x43')][_0x7230('0x47')]));_0x54eda5[_0x7230('0x48')]=_0x54eda5['attributes'][_0x7230('0x59')]?_0x54eda5[_0x7230('0x48')]:_0x3c7e1[_0x7230('0x46')];if(_0x3af8e0['query']['includeAll']){_0x54eda5['include']=[{'all':!![]}];}_0x54eda5=_[_0x7230('0x4d')]({},_0x54eda5,_0x3af8e0[_0x7230('0x5a')]);return db[_0x7230('0x50')]['find'](_0x54eda5)[_0x7230('0x34')](handleEntityNotFound(_0x283846,null))[_0x7230('0x34')](respondWithResult(_0x283846,null))['catch'](handleError(_0x283846,null));};exports['create']=function(_0x51a621,_0x3e9b64){return db[_0x7230('0x50')][_0x7230('0x5b')](_0x51a621['body'],{})[_0x7230('0x34')](function(_0x527805){var _0xcfbdf2=_0x51a621['user'][_0x7230('0x36')]({'plain':!![]});if(!_0xcfbdf2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcfbdf2[_0x7230('0x5c')]===_0x7230('0x5d')){var _0x359c6b=_0x527805[_0x7230('0x36')]({'plain':!![]});var _0xf363f5=_0x7230('0x37');return db[_0x7230('0x5e')][_0x7230('0x5f')]({'where':{'name':_0xf363f5,'userProfileId':_0xcfbdf2[_0x7230('0x60')]},'raw':!![]})['then'](function(_0xd8caac){if(_0xd8caac&&_0xd8caac['autoAssociation']===0x0){return db[_0x7230('0x61')][_0x7230('0x5b')]({'name':_0x359c6b['name'],'resourceId':_0x359c6b['id'],'type':_0xd8caac[_0x7230('0x39')],'sectionId':_0xd8caac['id']},{})['then'](function(){return _0x527805;});}else{return _0x527805;}})[_0x7230('0x2a')](function(_0x2c3bf2){logger[_0x7230('0x28')](_0x7230('0x62'),_0x2c3bf2);throw _0x2c3bf2;});}return _0x527805;})['then'](respondWithResult(_0x3e9b64,0xc9))[_0x7230('0x2a')](handleError(_0x3e9b64,null));};exports['update']=function(_0x1e04b3,_0x41f30e){if(_0x1e04b3[_0x7230('0x63')]['id']){delete _0x1e04b3[_0x7230('0x63')]['id'];}return db['WhatsappAccount'][_0x7230('0x5f')]({'where':{'id':_0x1e04b3[_0x7230('0x57')]['id']},'include':[{'model':db[_0x7230('0x3c')],'as':_0x7230('0x3d')}]})['then'](handleEntityNotFound(_0x41f30e,null))[_0x7230('0x34')](saveUpdates(_0x1e04b3[_0x7230('0x63')],null))[_0x7230('0x34')](respondWithResult(_0x41f30e,null))[_0x7230('0x2a')](handleError(_0x41f30e,null));};exports['destroy']=function(_0x491579,_0x39945f){return db[_0x7230('0x50')][_0x7230('0x5f')]({'where':{'id':_0x491579[_0x7230('0x57')]['id']}})[_0x7230('0x34')](handleEntityNotFound(_0x39945f,null))['then'](removeEntity(_0x39945f,null))[_0x7230('0x2a')](handleError(_0x39945f,null));};exports[_0x7230('0x64')]=function(_0x58fd48,_0x19bea2){return db[_0x7230('0x50')][_0x7230('0x64')]()['then'](respondWithResult(_0x19bea2,null))['catch'](handleError(_0x19bea2,null));};exports[_0x7230('0x65')]=function(_0x31f8c2,_0x31ccbf,_0x1f0ba7){if(_0x31f8c2[_0x7230('0x63')]['id']){delete _0x31f8c2[_0x7230('0x63')]['id'];}return db[_0x7230('0x50')][_0x7230('0x5f')]({'where':{'id':_0x31f8c2['params']['id']}})[_0x7230('0x34')](handleEntityNotFound(_0x31ccbf,null))[_0x7230('0x34')](function(_0x281937){if(_0x281937){_0x31f8c2[_0x7230('0x63')]['WhatsappAccountId']=_0x281937['id'];return db['Disposition'][_0x7230('0x5b')](_0x31f8c2['body']);}})[_0x7230('0x34')](respondWithResult(_0x31ccbf,null))[_0x7230('0x2a')](handleError(_0x31ccbf,null));};exports['getDispositions']=function(_0x1fab79,_0x2d049b,_0x5ddccd){var _0x2bcf83={'raw':![],'where':{}};var _0x5471d0={};var _0xe919a4={'count':0x0,'rows':[]};return db[_0x7230('0x50')][_0x7230('0x66')]({'where':{'id':_0x1fab79[_0x7230('0x57')]['id']}})[_0x7230('0x34')](handleEntityNotFound(_0x2d049b,null))[_0x7230('0x34')](function(_0x524b67){if(_0x524b67){_0x5471d0[_0x7230('0x46')]=_[_0x7230('0x58')](db['Disposition'][_0x7230('0x3f')]);_0x5471d0[_0x7230('0x43')]=_[_0x7230('0x58')](_0x1fab79[_0x7230('0x43')]);_0x5471d0[_0x7230('0x44')]=_[_0x7230('0x45')](_0x5471d0['model'],_0x5471d0[_0x7230('0x43')]);_0x2bcf83[_0x7230('0x48')]=_[_0x7230('0x45')](_0x5471d0[_0x7230('0x46')],qs[_0x7230('0x47')](_0x1fab79[_0x7230('0x43')][_0x7230('0x47')]));_0x2bcf83['attributes']=_0x2bcf83[_0x7230('0x48')][_0x7230('0x59')]?_0x2bcf83[_0x7230('0x48')]:_0x5471d0[_0x7230('0x46')];if(!_0x1fab79['query']['hasOwnProperty'](_0x7230('0x49'))){_0x2bcf83['limit']=qs[_0x7230('0x2f')](_0x1fab79[_0x7230('0x43')][_0x7230('0x2f')]);_0x2bcf83[_0x7230('0x2e')]=qs[_0x7230('0x2e')](_0x1fab79[_0x7230('0x43')]['offset']);}_0x2bcf83[_0x7230('0x67')]=qs[_0x7230('0x4a')](_0x1fab79[_0x7230('0x43')]['sort']);_0x2bcf83['where']=qs[_0x7230('0x44')](_[_0x7230('0x4b')](_0x1fab79[_0x7230('0x43')],_0x5471d0[_0x7230('0x44')]));_0x2bcf83['where'][_0x7230('0x68')]=_0x524b67['id'];if(_0x1fab79['query'][_0x7230('0x4f')]){_0x2bcf83['where']=_['merge'](_0x2bcf83['where'],{'$or':_[_0x7230('0x3e')](_0x2bcf83[_0x7230('0x48')],function(_0x9d9c30){var _0x439375={};_0x439375[_0x9d9c30]={'$like':'%'+_0x1fab79[_0x7230('0x43')][_0x7230('0x4f')]+'%'};return _0x439375;})});}_0x2bcf83=_[_0x7230('0x4d')]({},_0x2bcf83,_0x1fab79['options']);return db[_0x7230('0x69')][_0x7230('0x51')]({'where':_0x2bcf83[_0x7230('0x4c')]})[_0x7230('0x34')](function(_0x22ea95){_0xe919a4['count']=_0x22ea95;if(_0x1fab79[_0x7230('0x43')][_0x7230('0x52')]){_0x2bcf83['include']=[{'all':!![]}];}return db[_0x7230('0x69')][_0x7230('0x54')](_0x2bcf83);})[_0x7230('0x34')](function(_0x201808){_0xe919a4['rows']=_0x201808;return _0xe919a4;});}})[_0x7230('0x34')](respondWithFilteredResult(_0x2d049b,_0x2bcf83))[_0x7230('0x2a')](handleError(_0x2d049b,null));};exports[_0x7230('0x6a')]=function(_0x3ad6c2,_0x474661,_0x53327c){return db[_0x7230('0x50')][_0x7230('0x5f')]({'where':{'id':_0x3ad6c2[_0x7230('0x57')]['id']}})[_0x7230('0x34')](handleEntityNotFound(_0x474661,null))[_0x7230('0x34')](function(_0x1c8bd4){if(_0x1c8bd4){return _0x1c8bd4[_0x7230('0x6a')](_0x3ad6c2[_0x7230('0x43')][_0x7230('0x6b')]);}})[_0x7230('0x34')](respondWithStatusCode(_0x474661,null))['catch'](handleError(_0x474661,null));};exports[_0x7230('0x6c')]=function(_0x670c26,_0x38b554,_0x50643c){if(_0x670c26[_0x7230('0x63')]['id']){delete _0x670c26[_0x7230('0x63')]['id'];}return db[_0x7230('0x50')][_0x7230('0x5f')]({'where':{'id':_0x670c26[_0x7230('0x57')]['id']}})[_0x7230('0x34')](handleEntityNotFound(_0x38b554,null))[_0x7230('0x34')](function(_0x34db1f){if(_0x34db1f){_0x670c26[_0x7230('0x63')][_0x7230('0x68')]=_0x34db1f['id'];return db[_0x7230('0x6d')][_0x7230('0x5b')](_0x670c26[_0x7230('0x63')]);}})[_0x7230('0x34')](respondWithResult(_0x38b554,null))[_0x7230('0x2a')](handleError(_0x38b554,null));};exports['getAnswers']=function(_0x167623,_0x3772ab,_0x487424){var _0xfe80a5={'raw':![],'where':{}};var _0x43a905={};var _0x3d8b3f={'count':0x0,'rows':[]};return db[_0x7230('0x50')][_0x7230('0x66')]({'where':{'id':_0x167623[_0x7230('0x57')]['id']}})['then'](handleEntityNotFound(_0x3772ab,null))[_0x7230('0x34')](function(_0x163efe){if(_0x163efe){_0x43a905[_0x7230('0x46')]=_['keys'](db[_0x7230('0x6d')][_0x7230('0x3f')]);_0x43a905[_0x7230('0x43')]=_[_0x7230('0x58')](_0x167623[_0x7230('0x43')]);_0x43a905[_0x7230('0x44')]=_[_0x7230('0x45')](_0x43a905[_0x7230('0x46')],_0x43a905[_0x7230('0x43')]);_0xfe80a5[_0x7230('0x48')]=_[_0x7230('0x45')](_0x43a905[_0x7230('0x46')],qs[_0x7230('0x47')](_0x167623[_0x7230('0x43')][_0x7230('0x47')]));_0xfe80a5[_0x7230('0x48')]=_0xfe80a5['attributes'][_0x7230('0x59')]?_0xfe80a5['attributes']:_0x43a905['model'];if(!_0x167623[_0x7230('0x43')][_0x7230('0x6e')](_0x7230('0x49'))){_0xfe80a5['limit']=qs[_0x7230('0x2f')](_0x167623[_0x7230('0x43')][_0x7230('0x2f')]);_0xfe80a5[_0x7230('0x2e')]=qs[_0x7230('0x2e')](_0x167623[_0x7230('0x43')][_0x7230('0x2e')]);}_0xfe80a5[_0x7230('0x67')]=qs['sort'](_0x167623[_0x7230('0x43')][_0x7230('0x4a')]);_0xfe80a5[_0x7230('0x4c')]=qs['filters'](_['pick'](_0x167623[_0x7230('0x43')],_0x43a905[_0x7230('0x44')]));_0xfe80a5[_0x7230('0x4c')][_0x7230('0x68')]=_0x163efe['id'];if(_0x167623[_0x7230('0x43')][_0x7230('0x4f')]){_0xfe80a5['where']=_[_0x7230('0x4d')](_0xfe80a5[_0x7230('0x4c')],{'$or':_[_0x7230('0x3e')](_0xfe80a5[_0x7230('0x48')],function(_0x4b31f4){var _0x1a4ced={};_0x1a4ced[_0x4b31f4]={'$like':'%'+_0x167623[_0x7230('0x43')]['filter']+'%'};return _0x1a4ced;})});}_0xfe80a5=_['merge']({},_0xfe80a5,_0x167623[_0x7230('0x5a')]);return db[_0x7230('0x6d')][_0x7230('0x51')]({'where':_0xfe80a5[_0x7230('0x4c')]})[_0x7230('0x34')](function(_0x527b5d){_0x3d8b3f[_0x7230('0x51')]=_0x527b5d;if(_0x167623['query'][_0x7230('0x52')]){_0xfe80a5[_0x7230('0x53')]=[{'all':!![]}];}return db[_0x7230('0x6d')]['findAll'](_0xfe80a5);})[_0x7230('0x34')](function(_0x58d28c){_0x3d8b3f[_0x7230('0x55')]=_0x58d28c;return _0x3d8b3f;});}})[_0x7230('0x34')](respondWithFilteredResult(_0x3772ab,_0xfe80a5))[_0x7230('0x2a')](handleError(_0x3772ab,null));};exports[_0x7230('0x6f')]=function(_0x57989d,_0x5be66b,_0x2336d6){return db[_0x7230('0x50')][_0x7230('0x5f')]({'where':{'id':_0x57989d['params']['id']}})[_0x7230('0x34')](handleEntityNotFound(_0x5be66b,null))['then'](function(_0x12ce9b){if(_0x12ce9b){return _0x12ce9b['removeAnswers'](_0x57989d[_0x7230('0x43')][_0x7230('0x6b')]);}})[_0x7230('0x34')](respondWithStatusCode(_0x5be66b,null))[_0x7230('0x2a')](handleError(_0x5be66b,null));};exports[_0x7230('0x70')]=function(_0x36595e,_0x33db80,_0xe959a4){return db['WhatsappAccount'][_0x7230('0x5f')]({'where':{'id':_0x36595e['params']['id']}})['then'](handleEntityNotFound(_0x33db80,null))['then'](function(_0x4920f1){if(_0x4920f1){return _0x4920f1[_0x7230('0x70')](_0x36595e[_0x7230('0x63')][_0x7230('0x6b')],_[_0x7230('0x71')](_0x36595e[_0x7230('0x63')],[_0x7230('0x6b'),'id'])||{})[_0x7230('0x72')](function(_0x336c96){for(var _0x21306c=0x0;_0x21306c<_0x36595e[_0x7230('0x63')][_0x7230('0x6b')][_0x7230('0x59')];_0x21306c+=0x1){socket[_0x7230('0x73')](_0x7230('0x74'),{'UserId':_0x36595e[_0x7230('0x63')][_0x7230('0x6b')][_0x21306c],'WhatsappAccountId':_0x36595e[_0x7230('0x57')]['id']});}return _0x336c96;});}})[_0x7230('0x34')](respondWithResult(_0x33db80,null))[_0x7230('0x2a')](handleError(_0x33db80,null));};exports[_0x7230('0x75')]=function(_0x3d4989,_0x56dde9,_0x34b9ef){return db[_0x7230('0x50')][_0x7230('0x5f')]({'where':{'id':_0x3d4989[_0x7230('0x57')]['id']}})[_0x7230('0x34')](handleEntityNotFound(_0x56dde9,null))[_0x7230('0x34')](function(_0x4afcfb){if(_0x4afcfb){return _0x4afcfb['removeAgents'](_0x3d4989[_0x7230('0x43')][_0x7230('0x6b')])[_0x7230('0x34')](function(){if(_[_0x7230('0x76')](_0x3d4989[_0x7230('0x43')][_0x7230('0x6b')])){for(var _0x4f4917=0x0;_0x4f4917<_0x3d4989[_0x7230('0x43')][_0x7230('0x6b')][_0x7230('0x59')];_0x4f4917+=0x1){socket[_0x7230('0x73')](_0x7230('0x77'),{'UserId':Number(_0x3d4989['query'][_0x7230('0x6b')][_0x4f4917]),'WhatsappAccountId':Number(_0x3d4989[_0x7230('0x57')]['id'])});}}else{socket[_0x7230('0x73')](_0x7230('0x77'),{'UserId':Number(_0x3d4989[_0x7230('0x43')]['ids']),'WhatsappAccountId':Number(_0x3d4989['params']['id'])});}});}})[_0x7230('0x34')](respondWithStatusCode(_0x56dde9,null))[_0x7230('0x2a')](handleError(_0x56dde9,null));};exports[_0x7230('0x78')]=function(_0x21b8df,_0x4ada4b,_0x556ab6){var _0x20d576={};var _0x93a1fe={};var _0x4ea13d;var _0x17a02c;return db[_0x7230('0x50')][_0x7230('0x66')]({'where':{'id':_0x21b8df[_0x7230('0x57')]['id']}})['then'](handleEntityNotFound(_0x4ada4b,null))['then'](function(_0x43ef2b){if(_0x43ef2b){_0x4ea13d=_0x43ef2b;_0x93a1fe[_0x7230('0x46')]=_[_0x7230('0x58')](db['User']['rawAttributes']);_0x93a1fe[_0x7230('0x43')]=_[_0x7230('0x58')](_0x21b8df['query']);_0x93a1fe['filters']=_[_0x7230('0x45')](_0x93a1fe[_0x7230('0x46')],_0x93a1fe[_0x7230('0x43')]);_0x20d576[_0x7230('0x48')]=_[_0x7230('0x45')](_0x93a1fe[_0x7230('0x46')],qs[_0x7230('0x47')](_0x21b8df[_0x7230('0x43')][_0x7230('0x47')]));_0x20d576[_0x7230('0x48')]=_0x20d576[_0x7230('0x48')][_0x7230('0x59')]?_0x20d576[_0x7230('0x48')]:_0x93a1fe['model'];_0x20d576[_0x7230('0x67')]=qs[_0x7230('0x4a')](_0x21b8df['query'][_0x7230('0x4a')]);_0x20d576[_0x7230('0x4c')]=qs['filters'](_[_0x7230('0x4b')](_0x21b8df[_0x7230('0x43')],_0x93a1fe[_0x7230('0x44')]));if(_0x21b8df[_0x7230('0x43')]['filter']){_0x20d576['where']=_[_0x7230('0x4d')](_0x20d576[_0x7230('0x4c')],{'$or':_[_0x7230('0x3e')](_0x20d576[_0x7230('0x48')],function(_0x1529d0){var _0x1fd020={};_0x1fd020[_0x1529d0]={'$like':'%'+_0x21b8df[_0x7230('0x43')][_0x7230('0x4f')]+'%'};return _0x1fd020;})});}_0x20d576=_['merge']({},_0x20d576,_0x21b8df[_0x7230('0x5a')]);return _0x4ea13d['getAgents'](_0x20d576);}})['then'](function(_0x2212cc){if(_0x2212cc){_0x17a02c=_0x2212cc[_0x7230('0x59')];if(!_0x21b8df[_0x7230('0x43')][_0x7230('0x6e')](_0x7230('0x49'))){_0x20d576[_0x7230('0x2f')]=qs[_0x7230('0x2f')](_0x21b8df[_0x7230('0x43')][_0x7230('0x2f')]);_0x20d576['offset']=qs[_0x7230('0x2e')](_0x21b8df[_0x7230('0x43')][_0x7230('0x2e')]);}return _0x4ea13d[_0x7230('0x78')](_0x20d576);}})['then'](function(_0x1067fb){if(_0x1067fb){return _0x1067fb?{'count':_0x17a02c,'rows':_0x1067fb}:null;}})[_0x7230('0x34')](respondWithResult(_0x4ada4b,null))['catch'](handleError(_0x4ada4b,null));};exports[_0x7230('0x79')]=function(_0x2dafbb,_0x5596f7,_0x5ebfd2){return db[_0x7230('0x50')]['findOne']({'where':{'id':_0x2dafbb['params']['id']}})[_0x7230('0x34')](handleEntityNotFound(_0x5596f7,null))[_0x7230('0x34')](function(_0x51ba2a){if(_0x51ba2a){return db['sequelize'][_0x7230('0x7a')](function(_0x3fe34d){return db['WhatsappApplication'][_0x7230('0x35')]({'where':{'WhatsappAccountId':_0x2dafbb[_0x7230('0x57')]['id']},'transaction':_0x3fe34d})[_0x7230('0x34')](function(_0x174355){var _0xf30e05=_['map'](_0x2dafbb['body'],function(_0x4a2899){_0x4a2899[_0x7230('0x68')]=_0x2dafbb[_0x7230('0x57')]['id'];return _0x4a2899;});return db[_0x7230('0x7b')][_0x7230('0x7c')](_0xf30e05,{'transaction':_0x3fe34d});});})[_0x7230('0x34')](function(){return db[_0x7230('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2dafbb[_0x7230('0x57')]['id']},'order':_0x7230('0x7d')});});}})[_0x7230('0x34')](respondWithResult(_0x5596f7,null))[_0x7230('0x2a')](handleError(_0x5596f7,null));};exports[_0x7230('0x7e')]=function(_0x500e95,_0x5c9eb6,_0x43bc1c){var _0x16c37c={};var _0x329f31={};var _0x59b16a;var _0x50ec7e;return db[_0x7230('0x50')][_0x7230('0x66')]({'where':{'id':_0x500e95[_0x7230('0x57')]['id']}})[_0x7230('0x34')](handleEntityNotFound(_0x5c9eb6,null))[_0x7230('0x34')](function(_0x3e5a3f){if(_0x3e5a3f){_0x59b16a=_0x3e5a3f;_0x329f31[_0x7230('0x46')]=_[_0x7230('0x58')](db[_0x7230('0x7b')][_0x7230('0x3f')]);_0x329f31[_0x7230('0x43')]=_[_0x7230('0x58')](_0x500e95['query']);_0x329f31[_0x7230('0x44')]=_[_0x7230('0x45')](_0x329f31[_0x7230('0x46')],_0x329f31[_0x7230('0x43')]);_0x16c37c[_0x7230('0x48')]=_[_0x7230('0x45')](_0x329f31['model'],qs['fields'](_0x500e95[_0x7230('0x43')][_0x7230('0x47')]));_0x16c37c[_0x7230('0x48')]=_0x16c37c['attributes']['length']?_0x16c37c[_0x7230('0x48')]:_0x329f31['model'];_0x16c37c['order']=qs[_0x7230('0x4a')](_0x500e95['query'][_0x7230('0x4a')]);_0x16c37c['where']=qs[_0x7230('0x44')](_[_0x7230('0x4b')](_0x500e95[_0x7230('0x43')],_0x329f31[_0x7230('0x44')]));if(_0x500e95[_0x7230('0x43')][_0x7230('0x4f')]){_0x16c37c['where']=_['merge'](_0x16c37c['where'],{'$or':_[_0x7230('0x3e')](_0x16c37c['attributes'],function(_0xf89e1c){var _0x5b18e1={};_0x5b18e1[_0xf89e1c]={'$like':'%'+_0x500e95[_0x7230('0x43')][_0x7230('0x4f')]+'%'};return _0x5b18e1;})});}_0x16c37c=_[_0x7230('0x4d')]({},_0x16c37c,_0x500e95['options']);return _0x59b16a[_0x7230('0x7e')](_0x16c37c);}})[_0x7230('0x34')](function(_0x56639f){if(_0x56639f){_0x50ec7e=_0x56639f[_0x7230('0x59')];if(!_0x500e95[_0x7230('0x43')][_0x7230('0x6e')]('nolimit')){_0x16c37c[_0x7230('0x2f')]=qs[_0x7230('0x2f')](_0x500e95[_0x7230('0x43')]['limit']);_0x16c37c[_0x7230('0x2e')]=qs['offset'](_0x500e95[_0x7230('0x43')]['offset']);}return _0x59b16a[_0x7230('0x7e')](_0x16c37c);}})['then'](function(_0x1fa696){if(_0x1fa696){return _0x1fa696?{'count':_0x50ec7e,'rows':_0x1fa696}:null;}})[_0x7230('0x34')](respondWithResult(_0x5c9eb6,null))[_0x7230('0x2a')](handleError(_0x5c9eb6,null));};exports[_0x7230('0x7f')]=function(_0xc6613a,_0x159193,_0x1e78c5){var _0x184bbc={'channel':_0x7230('0x80')};var _0x1a9e12=[];var _0x235ecd=[];var _0x492008={};return db[_0x7230('0x50')]['find']({'where':{'id':_0xc6613a[_0x7230('0x57')]['id']},'include':[{'model':db[_0x7230('0x7b')],'as':_0x7230('0x81')}]})[_0x7230('0x34')](handleEntityNotFound(_0x159193,null))['then'](function(_0xff129){_0x184bbc['account']=_0xff129;_0x184bbc[_0x7230('0x82')]=_['orderBy'](_0xff129[_0x7230('0x81')],[_0x7230('0x7d')],[_0x7230('0x83')]);if(_0x184bbc[_0x7230('0x84')][_0x7230('0x81')]){delete _0x184bbc[_0x7230('0x84')]['Applications'];}return db['CmContact'][_0x7230('0x64')]();})[_0x7230('0x34')](function(_0x28632b){if(!_0x28632b){throw new db[(_0x7230('0x85'))][(_0x7230('0x86'))](_0x7230('0x87'));}_0x1a9e12=_['difference'](_['keys'](_0x28632b),[_0x7230('0x88'),_0x7230('0x89')]);_0x235ecd=_[_0x7230('0x8a')](_['keys'](_0x28632b),[_0x7230('0x88'),'updatedAt',_0x7230('0x8b'),_0x7230('0x8c')]);_0x184bbc[_0x7230('0x63')]={'mapKey':'mobile'};if(_0x184bbc['account'][_0x7230('0x41')]&&_0x184bbc['account']['type']===_0x7230('0x8d')){_0x184bbc[_0x7230('0x63')]['from']=_0xc6613a['body'][_0x7230('0x8e')][_0x7230('0x8f')]('whatsapp:','');_0x184bbc[_0x7230('0x63')]['body']=_0xc6613a[_0x7230('0x63')][_0x7230('0x90')];_0x184bbc[_0x7230('0x63')][_0x7230('0x91')]=_0xc6613a[_0x7230('0x63')][_0x7230('0x92')];}if(_0x184bbc[_0x7230('0x63')]['id']){delete _0x184bbc['body']['id'];}if(_[_0x7230('0x93')](_0x184bbc[_0x7230('0x63')]['from'])){throw new db['Sequelize'][(_0x7230('0x86'))](_0x7230('0x94'));}if(_[_0x7230('0x93')](_0x184bbc[_0x7230('0x63')]['body'])||_0x184bbc['body']['body']===''){throw new db['Sequelize']['ValidationError'](_0x7230('0x95'));}if(_[_0x7230('0x93')](_0x184bbc[_0x7230('0x63')][_0x7230('0x96')])){throw new db[(_0x7230('0x85'))][(_0x7230('0x86'))](_0x7230('0x97')+_0x235ecd);}if(!_['includes'](_0x235ecd,_0x184bbc[_0x7230('0x63')]['mapKey'])){throw new db[(_0x7230('0x85'))][(_0x7230('0x86'))](_0x7230('0x98')+_0x235ecd);}_0x492008[_0x184bbc[_0x7230('0x63')][_0x7230('0x96')]]=_0x184bbc[_0x7230('0x63')]['from'];return db[_0x7230('0x99')][_0x7230('0x5f')]({'where':{'id':_0x184bbc[_0x7230('0x84')][_0x7230('0x8c')]},'include':[{'model':db[_0x7230('0x9a')],'as':_0x7230('0x9b'),'where':_0x492008,'limit':0x1,'order':[['updatedAt',_0x7230('0x9c')]]}]});})[_0x7230('0x34')](handleEntityNotFound(_0x159193,null))[_0x7230('0x34')](function(_0x1bf555){if(_0x1bf555){_0x184bbc['list']=_[_0x7230('0x71')](_0x1bf555,[_0x7230('0x9b')]);if(_0x1bf555[_0x7230('0x9b')][_0x7230('0x59')]){return _0x1bf555['Contacts'][0x0];}var _0x29bbd5=_[_0x7230('0x1b')](_0x184bbc['body'],{'firstName':_0x184bbc[_0x7230('0x63')][_0x7230('0x9d')],'ListId':_0x1bf555['id']});_0x29bbd5[_0x184bbc[_0x7230('0x63')]['mapKey']]=_0x184bbc[_0x7230('0x63')]['from'];return db['CmContact'][_0x7230('0x5b')](_0x29bbd5,{'fields':_0x1a9e12,'raw':!![]});}})['then'](handleEntityNotFound(_0x159193,null))[_0x7230('0x34')](function(_0x214ba9){if(_0x214ba9){_0x184bbc[_0x7230('0x9e')]=_0x214ba9;var _0x3995d8={'ContactId':_0x214ba9['id'],'phone':_0x184bbc[_0x7230('0x63')][_0x7230('0x9d')],'WhatsappAccountId':_0xc6613a[_0x7230('0x57')]['id']};var _0x5a59db={'ContactId':_0x214ba9['id'],'WhatsappAccountId':_0xc6613a[_0x7230('0x57')]['id'],'closed':![]};return db[_0x7230('0x9f')][_0x7230('0x5f')]({'where':_0x5a59db})[_0x7230('0x34')](function(_0x15f3b9){if(_0x15f3b9){return[_0x15f3b9,![]];}return db[_0x7230('0x9f')]['create'](_0x3995d8)[_0x7230('0x34')](function(_0x357c57){return[_0x357c57,!![]];});});}})[_0x7230('0x72')](function(_0x4c6511,_0x19f679){_0x184bbc[_0x7230('0xa0')]=_0x4c6511[_0x7230('0x36')]({'plain':!![]});_0x184bbc[_0x7230('0xa0')][_0x7230('0xa1')]=![];if(_0x19f679){if(_0x184bbc[_0x7230('0x84')][_0x7230('0xa2')]){_0x184bbc[_0x7230('0x82')][_0x7230('0xa3')]({'id':0x0,'priority':_0x184bbc[_0x7230('0x82')]['length']+0x1,'app':_0x7230('0xa4'),'appdata':_0x7230('0xa5'),'interval':_0x7230('0xa6')});}_0x184bbc['interaction'][_0x7230('0xa1')]=!![];}return db[_0x7230('0xa7')][_0x7230('0x5b')]({'phone':_0x184bbc[_0x7230('0x63')][_0x7230('0x9d')],'messageId':_0x184bbc[_0x7230('0x63')][_0x7230('0x91')],'body':_0x184bbc[_0x7230('0x63')]['body'],'WhatsappAccountId':_0xc6613a[_0x7230('0x57')]['id'],'WhatsappInteractionId':_0x4c6511['id'],'direction':'in','ContactId':_0x4c6511['ContactId'],'AttachmentId':_0x184bbc[_0x7230('0x63')]['AttachmentId']});})[_0x7230('0x34')](function(_0x2f2235){_0x184bbc[_0x7230('0x29')]=_0x2f2235;if(_0x184bbc[_0x7230('0xa0')][_0x7230('0xa8')]){return db['User'][_0x7230('0x5f')]({'attributes':['id',_0x7230('0x39')],'where':{'id':_0x184bbc[_0x7230('0xa0')]['UserId']}})[_0x7230('0x34')](function(_0x518ad8){if(_0x518ad8){_0x184bbc['applications'][_0x7230('0xa9')]({'id':0x0,'priority':0x0,'app':_0x7230('0xaa'),'appdata':_0x518ad8['name']+','+(_0x184bbc['account'][_0x7230('0xab')]||0xa),'interval':_0x7230('0xa6')});}return respondWithRpcPromise('Start','startRouting',_0x184bbc);});}return respondWithRpcPromise(_0x7230('0xac'),_0x7230('0xad'),_0x184bbc);})[_0x7230('0x34')](function(_0x11e7aa){if(_0x11e7aa){var _0x24d77e=0xc8;var _0x3456f8='receiveMessage';logger[_0x7230('0x22')](_0x7230('0x25'),_0x3456f8,_0x24d77e,_0x7230('0xae'));logger[_0x7230('0xaf')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3456f8,_0x24d77e,_0x7230('0xae'),JSON[_0x7230('0x26')](_0x11e7aa));if(_0x184bbc[_0x7230('0x84')][_0x7230('0x41')]===_0x7230('0x8d')){return _0x159193[_0x7230('0x2c')](_0x24d77e)['set']('Content-Type','text/xml')[_0x7230('0x3a')](_0x7230('0xb0'));}else{return _0x159193['status'](_0x24d77e)[_0x7230('0x32')](_0x11e7aa);}}})[_0x7230('0x2a')](handleError(_0x159193,null));};exports['send']=function(_0x2fbb9e,_0x1f6a15,_0x25ba1a){var _0x5ab5de,_0x4e89a0,_0x5beaed;if(_[_0x7230('0x93')](_0x2fbb9e[_0x7230('0x63')]['body'])||_0x2fbb9e['body'][_0x7230('0x63')]===''){throw new db['Sequelize']['ValidationError'](_0x7230('0x95'));}if(_[_0x7230('0x93')](_0x2fbb9e[_0x7230('0x63')]['to'])){throw new db[(_0x7230('0x85'))]['ValidationError'](_0x7230('0xb1'));}_0x5ab5de=_0x2fbb9e['body']['to'];return db[_0x7230('0x50')][_0x7230('0x5f')]({'where':{'id':_0x2fbb9e['params']['id']},'include':[{'model':db['CmList'],'as':_0x7230('0xb2'),'include':[{'model':db[_0x7230('0x9a')],'as':_0x7230('0x9b'),'where':{'mobile':_0x5ab5de},'limit':0x1,'order':[[_0x7230('0x89'),_0x7230('0x9c')]]}]}]})['then'](handleEntityNotFound(_0x1f6a15,null))['then'](function(_0x44f1b9){if(_0x44f1b9&&_0x44f1b9[_0x7230('0xb2')]){_0x4e89a0=_0x44f1b9[_0x7230('0x36')]({'plain':!![]});if(_0x4e89a0[_0x7230('0xb2')]&&_0x4e89a0['List']['Contacts'][_0x7230('0x59')]){return _0x4e89a0[_0x7230('0xb2')]['Contacts'][0x0];}return db[_0x7230('0x9a')][_0x7230('0x5b')](_[_0x7230('0x1b')](_0x2fbb9e[_0x7230('0x63')],{'firstName':_0x5ab5de,'mobile':_0x5ab5de,'phone':_0x5ab5de,'ListId':_0x4e89a0[_0x7230('0x8c')]}));}})[_0x7230('0x34')](handleEntityNotFound(_0x1f6a15,null))[_0x7230('0x34')](function(_0x26d64d){if(_0x26d64d){_0x5beaed=_0x26d64d;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x5beaed['id'],'closed':![],'WhatsappAccountId':_0x4e89a0['id']}})[_0x7230('0x34')](function(_0x584fa0){if(_0x584fa0){return[_0x584fa0,![]];}return db['WhatsappInteraction'][_0x7230('0x5b')]({'UserId':_0x2fbb9e['user']['id'],'ContactId':_0x5beaed['id'],'WhatsappAccountId':_0x4e89a0['id'],'phone':_0x5ab5de,'firstMsgDirection':'out','Messages':[_['merge'](_0x2fbb9e[_0x7230('0x63')],{'read':![],'body':_0x2fbb9e[_0x7230('0x63')]['body'],'phone':_0x5ab5de,'WhatsappAccountId':_0x4e89a0['id'],'UserId':_0x2fbb9e[_0x7230('0x5d')]['id'],'ContactId':_0x5beaed['id']})]},{'include':[{'model':db[_0x7230('0xa7')],'as':_0x7230('0xb3')}]})['then'](function(_0x37f70c){return[_0x37f70c,!![]];});});}})[_0x7230('0x72')](function(_0x3c1a11,_0x59a7b6){if(_0x59a7b6){return _0x3c1a11;}return db[_0x7230('0xa7')][_0x7230('0x5b')](_[_0x7230('0x4d')](_0x2fbb9e['body'],{'read':![],'body':_0x2fbb9e[_0x7230('0x63')]['body'],'phone':_0x5ab5de,'WhatsappAccountId':_0x4e89a0['id'],'WhatsappInteractionId':_0x3c1a11['id'],'UserId':_0x2fbb9e[_0x7230('0x5d')]['id'],'ContactId':_0x5beaed['id']}))['then'](function(_0x3a29e3){_0x3c1a11['dataValues'][_0x7230('0xb3')]=[];_0x3c1a11[_0x7230('0xb4')][_0x7230('0xb3')][_0x7230('0xa3')](_0x3a29e3[_0x7230('0xb4')]);return _0x3c1a11;});})[_0x7230('0x34')](respondWithResult(_0x1f6a15,null))['catch'](handleError(_0x1f6a15,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 4a95cb4..ab7a2d7 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 _0x9a5a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove'];(function(_0x2eac4f,_0x5173f9){var _0x58f73b=function(_0x529f28){while(--_0x529f28){_0x2eac4f['push'](_0x2eac4f['shift']());}};_0x58f73b(++_0x5173f9);}(_0x9a5a,0x194));var _0xa9a5=function(_0x4a9fe1,_0x223e97){_0x4a9fe1=_0x4a9fe1-0x0;var _0x538d1b=_0x9a5a[_0x4a9fe1];return _0x538d1b;};'use strict';var EventEmitter=require(_0xa9a5('0x0'));var WhatsappAccount=require(_0xa9a5('0x1'))['db'][_0xa9a5('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xa9a5('0x3')](0x0);var events={'afterCreate':_0xa9a5('0x4'),'afterUpdate':'update','afterDestroy':_0xa9a5('0x5')};function emitEvent(_0x1e6fb1){return function(_0x230710,_0x1080a9,_0x31e823){WhatsappAccountEvents[_0xa9a5('0x6')](_0x1e6fb1+':'+_0x230710['id'],_0x230710);WhatsappAccountEvents['emit'](_0x1e6fb1,_0x230710);_0x31e823(null);};}for(var e in events){if(events[_0xa9a5('0x7')](e)){var event=events[e];WhatsappAccount[_0xa9a5('0x8')](e,emitEvent(event));}}module[_0xa9a5('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x7880=['../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x527dea,_0x4e82c2){var _0x5cafb7=function(_0x4e8951){while(--_0x4e8951){_0x527dea['push'](_0x527dea['shift']());}};_0x5cafb7(++_0x4e82c2);}(_0x7880,0x1f4));var _0x0788=function(_0x4f484c,_0x9bccb4){_0x4f484c=_0x4f484c-0x0;var _0x276e95=_0x7880[_0x4f484c];return _0x276e95;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x0788('0x0'))['db'][_0x0788('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0788('0x2')](0x0);var events={'afterCreate':_0x0788('0x3'),'afterUpdate':_0x0788('0x4'),'afterDestroy':_0x0788('0x5')};function emitEvent(_0x5c29f7){return function(_0x3925a6,_0x1e0814,_0x317885){WhatsappAccountEvents[_0x0788('0x6')](_0x5c29f7+':'+_0x3925a6['id'],_0x3925a6);WhatsappAccountEvents[_0x0788('0x6')](_0x5c29f7,_0x3925a6);_0x317885(null);};}for(var e in events){if(events[_0x0788('0x7')](e)){var event=events[e];WhatsappAccount[_0x0788('0x8')](e,emitEvent(event));}}module[_0x0788('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index bd1cfa8..5078b39 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 _0xf9e5=['api','moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x4c085e,_0x32fb7b){var _0x379b1f=function(_0x4667c9){while(--_0x4667c9){_0x4c085e['push'](_0x4c085e['shift']());}};_0x379b1f(++_0x32fb7b);}(_0xf9e5,0x1a1));var _0x5f9e=function(_0x32fb9b,_0x17db74){_0x32fb9b=_0x32fb9b-0x0;var _0x28f534=_0xf9e5[_0x32fb9b];return _0x28f534;};'use strict';var _=require(_0x5f9e('0x0'));var util=require(_0x5f9e('0x1'));var logger=require(_0x5f9e('0x2'))(_0x5f9e('0x3'));var moment=require(_0x5f9e('0x4'));var BPromise=require('bluebird');var rp=require(_0x5f9e('0x5'));var fs=require('fs');var path=require(_0x5f9e('0x6'));var rimraf=require(_0x5f9e('0x7'));var config=require(_0x5f9e('0x8'));var attributes=require(_0x5f9e('0x9'));module[_0x5f9e('0xa')]=function(_0x2ada6e,_0x5f5061){return _0x2ada6e[_0x5f9e('0xb')](_0x5f9e('0xc'),attributes,{'tableName':_0x5f9e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2602=['../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','util','moment','request-promise','path','rimraf'];(function(_0x26f3a3,_0x1d2291){var _0x4d3f03=function(_0x37072b){while(--_0x37072b){_0x26f3a3['push'](_0x26f3a3['shift']());}};_0x4d3f03(++_0x1d2291);}(_0x2602,0x119));var _0x2260=function(_0x471aa6,_0x5ec092){_0x471aa6=_0x471aa6-0x0;var _0x5c87b5=_0x2602[_0x471aa6];return _0x5c87b5;};'use strict';var _=require('lodash');var util=require(_0x2260('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x2260('0x1'));var BPromise=require('bluebird');var rp=require(_0x2260('0x2'));var fs=require('fs');var path=require(_0x2260('0x3'));var rimraf=require(_0x2260('0x4'));var config=require(_0x2260('0x5'));var attributes=require(_0x2260('0x6'));module[_0x2260('0x7')]=function(_0xf13210,_0x1983cf){return _0xf13210[_0x2260('0x8')](_0x2260('0x9'),attributes,{'tableName':_0x2260('0xa'),'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 dbf99a2..e182e05 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 _0x7f3c=['request','then','info','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','map','model','attributes','moment','randomstring','../../mysqldb','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./whatsappAccount.socket','register'];(function(_0x14c340,_0x26308e){var _0x4717f1=function(_0x23d6b2){while(--_0x23d6b2){_0x14c340['push'](_0x14c340['shift']());}};_0x4717f1(++_0x26308e);}(_0x7f3c,0x1d3));var _0xc7f3=function(_0xbe0bad,_0x242e22){_0xbe0bad=_0xbe0bad-0x0;var _0x2a18cc=_0x7f3c[_0xbe0bad];return _0x2a18cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc7f3('0x0'));var BPromise=require('bluebird');var rs=require(_0xc7f3('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7f3('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc7f3('0x3'));var config=require(_0xc7f3('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xc7f3('0x5')][_0xc7f3('0x6')]({'port':0x232a});config['redis']=_[_0xc7f3('0x7')](config['redis'],{'host':_0xc7f3('0x8'),'port':0x18eb});var socket=require(_0xc7f3('0x9'))(new Redis(config[_0xc7f3('0xa')]));require(_0xc7f3('0xb'))[_0xc7f3('0xc')](socket);function respondWithRpcPromise(_0x156e9a,_0x3c93ce,_0xa17e6a){return new BPromise(function(_0x187fac,_0x18f348){return client[_0xc7f3('0xd')](_0x156e9a,_0xa17e6a)[_0xc7f3('0xe')](function(_0x563661){logger[_0xc7f3('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x3c93ce,_0xc7f3('0x10'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3c93ce,_0xc7f3('0x10'),JSON[_0xc7f3('0x11')](_0x563661));if(_0x563661[_0xc7f3('0x12')]){if(_0x563661['error']['code']===0x1f4){logger['error'](_0xc7f3('0x13'),_0x3c93ce,_0x563661['error'][_0xc7f3('0x14')]);return _0x18f348(_0x563661[_0xc7f3('0x12')][_0xc7f3('0x14')]);}logger[_0xc7f3('0x12')](_0xc7f3('0x13'),_0x3c93ce,_0x563661['error'][_0xc7f3('0x14')]);return _0x187fac(_0x563661[_0xc7f3('0x12')][_0xc7f3('0x14')]);}else{logger[_0xc7f3('0xf')](_0xc7f3('0x13'),_0x3c93ce,_0xc7f3('0x10'));_0x187fac(_0x563661['result'][_0xc7f3('0x14')]);}})[_0xc7f3('0x15')](function(_0x576cb5){logger[_0xc7f3('0x12')](_0xc7f3('0x13'),_0x3c93ce,_0x576cb5);_0x18f348(_0x576cb5);});});}exports[_0xc7f3('0x16')]=function(_0x3c8979){var _0x3609c5=this;return new Promise(function(_0x2668de,_0x4efee9){return db[_0xc7f3('0x17')][_0xc7f3('0x18')]({'raw':_0x3c8979['options']?_0x3c8979[_0xc7f3('0x19')][_0xc7f3('0x1a')]===undefined?!![]:![]:!![],'where':_0x3c8979['options']?_0x3c8979[_0xc7f3('0x19')][_0xc7f3('0x1b')]||null:null,'attributes':_0x3c8979[_0xc7f3('0x19')]?_0x3c8979[_0xc7f3('0x19')]['attributes']||null:null,'include':_0x3c8979[_0xc7f3('0x19')]?_0x3c8979[_0xc7f3('0x19')][_0xc7f3('0x1c')]?_[_0xc7f3('0x1d')](_0x3c8979[_0xc7f3('0x19')][_0xc7f3('0x1c')],function(_0x28202a){return{'model':db[_0x28202a[_0xc7f3('0x1e')]],'as':_0x28202a['as'],'attributes':_0x28202a[_0xc7f3('0x1f')],'include':_0x28202a[_0xc7f3('0x1c')]?_['map'](_0x28202a[_0xc7f3('0x1c')],function(_0x17211f){return{'model':db[_0x17211f[_0xc7f3('0x1e')]],'as':_0x17211f['as'],'attributes':_0x17211f['attributes'],'include':_0x17211f[_0xc7f3('0x1c')]?_['map'](_0x17211f[_0xc7f3('0x1c')],function(_0x4a6aad){return{'model':db[_0x4a6aad['model']],'as':_0x4a6aad['as'],'attributes':_0x4a6aad[_0xc7f3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc7f3('0xe')](function(_0x1c32df){logger['info']('ShowWhatsappAccount',_0x3c8979);logger['debug'](_0xc7f3('0x16'),_0x3c8979,JSON[_0xc7f3('0x11')](_0x1c32df));_0x2668de(_0x1c32df);})[_0xc7f3('0x15')](function(_0x3566a3){logger['error']('ShowWhatsappAccount',_0x3566a3[_0xc7f3('0x14')],_0x3c8979);_0x4efee9(_0x3609c5[_0xc7f3('0x12')](0x1f4,_0x3566a3['message']));});});}; \ No newline at end of file +var _0x431c=['defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','redis'];(function(_0x331257,_0x2133a6){var _0x311d60=function(_0x21f1fa){while(--_0x21f1fa){_0x331257['push'](_0x331257['shift']());}};_0x311d60(++_0x2133a6);}(_0x431c,0x1e8));var _0xc431=function(_0x373775,_0x4cc2ee){_0x373775=_0x373775-0x0;var _0x54cedc=_0x431c[_0x373775];return _0x54cedc;};'use strict';var _=require('lodash');var util=require(_0xc431('0x0'));var moment=require('moment');var BPromise=require(_0xc431('0x1'));var rs=require(_0xc431('0x2'));var fs=require('fs');var Redis=require(_0xc431('0x3'));var db=require(_0xc431('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc431('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xc431('0x6')]=_[_0xc431('0x7')](config[_0xc431('0x6')],{'host':_0xc431('0x8'),'port':0x18eb});var socket=require(_0xc431('0x9'))(new Redis(config[_0xc431('0x6')]));require(_0xc431('0xa'))['register'](socket);function respondWithRpcPromise(_0x5b35da,_0x122b49,_0x29a612){return new BPromise(function(_0x3ef3ef,_0x498766){return client[_0xc431('0xb')](_0x5b35da,_0x29a612)['then'](function(_0x5f08be){logger[_0xc431('0xc')](_0xc431('0xd'),_0x122b49,_0xc431('0xe'));logger[_0xc431('0xf')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x122b49,_0xc431('0xe'),JSON[_0xc431('0x10')](_0x5f08be));if(_0x5f08be[_0xc431('0x11')]){if(_0x5f08be[_0xc431('0x11')][_0xc431('0x12')]===0x1f4){logger[_0xc431('0x11')](_0xc431('0xd'),_0x122b49,_0x5f08be[_0xc431('0x11')][_0xc431('0x13')]);return _0x498766(_0x5f08be[_0xc431('0x11')]['message']);}logger[_0xc431('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x122b49,_0x5f08be[_0xc431('0x11')]['message']);return _0x3ef3ef(_0x5f08be['error'][_0xc431('0x13')]);}else{logger[_0xc431('0xc')](_0xc431('0xd'),_0x122b49,'request\x20sent');_0x3ef3ef(_0x5f08be[_0xc431('0x14')][_0xc431('0x13')]);}})[_0xc431('0x15')](function(_0x22abe8){logger['error'](_0xc431('0xd'),_0x122b49,_0x22abe8);_0x498766(_0x22abe8);});});}exports[_0xc431('0x16')]=function(_0x11eb02){var _0x1f36ac=this;return new Promise(function(_0x40c77a,_0x449bed){return db[_0xc431('0x17')][_0xc431('0x18')]({'raw':_0x11eb02[_0xc431('0x19')]?_0x11eb02[_0xc431('0x19')][_0xc431('0x1a')]===undefined?!![]:![]:!![],'where':_0x11eb02['options']?_0x11eb02[_0xc431('0x19')][_0xc431('0x1b')]||null:null,'attributes':_0x11eb02[_0xc431('0x19')]?_0x11eb02[_0xc431('0x19')][_0xc431('0x1c')]||null:null,'include':_0x11eb02['options']?_0x11eb02[_0xc431('0x19')][_0xc431('0x1d')]?_[_0xc431('0x1e')](_0x11eb02['options'][_0xc431('0x1d')],function(_0x39d836){return{'model':db[_0x39d836[_0xc431('0x1f')]],'as':_0x39d836['as'],'attributes':_0x39d836[_0xc431('0x1c')],'include':_0x39d836['include']?_[_0xc431('0x1e')](_0x39d836['include'],function(_0x581c6b){return{'model':db[_0x581c6b[_0xc431('0x1f')]],'as':_0x581c6b['as'],'attributes':_0x581c6b[_0xc431('0x1c')],'include':_0x581c6b[_0xc431('0x1d')]?_[_0xc431('0x1e')](_0x581c6b[_0xc431('0x1d')],function(_0x37441d){return{'model':db[_0x37441d[_0xc431('0x1f')]],'as':_0x37441d['as'],'attributes':_0x37441d['attributes']};}):[]};}):[]};}):[]:[]})[_0xc431('0x20')](function(_0x1d1f0f){logger[_0xc431('0xc')](_0xc431('0x16'),_0x11eb02);logger[_0xc431('0xf')]('ShowWhatsappAccount',_0x11eb02,JSON[_0xc431('0x10')](_0x1d1f0f));_0x40c77a(_0x1d1f0f);})[_0xc431('0x15')](function(_0x135e76){logger[_0xc431('0x11')]('ShowWhatsappAccount',_0x135e76['message'],_0x11eb02);_0x449bed(_0x1f36ac[_0xc431('0x11')](0x1f4,_0x135e76['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index dae1fc2..bd6d04d 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 _0xa3e1=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit'];(function(_0x20393d,_0x2b030e){var _0x5dd080=function(_0x1dd4a8){while(--_0x1dd4a8){_0x20393d['push'](_0x20393d['shift']());}};_0x5dd080(++_0x2b030e);}(_0xa3e1,0xe5));var _0x1a3e=function(_0x59e1b8,_0x3906af){_0x59e1b8=_0x59e1b8-0x0;var _0xdcbac8=_0xa3e1[_0x59e1b8];return _0xdcbac8;};'use strict';var WhatsappAccountEvents=require(_0x1a3e('0x0'));var events=[_0x1a3e('0x1'),_0x1a3e('0x2'),_0x1a3e('0x3')];function createListener(_0x242e22,_0x42b363){return function(_0x42995d){_0x42b363[_0x1a3e('0x4')](_0x242e22,_0x42995d);};}function removeListener(_0x328cd9,_0x348444){return function(){WhatsappAccountEvents[_0x1a3e('0x5')](_0x328cd9,_0x348444);};}exports[_0x1a3e('0x6')]=function(_0x1f6a65){for(var _0x58f266=0x0,_0x5ad7e2=events[_0x1a3e('0x7')];_0x58f266<_0x5ad7e2;_0x58f266++){var _0x348da8=events[_0x58f266];var _0x19a859=createListener(_0x1a3e('0x8')+_0x348da8,_0x1f6a65);WhatsappAccountEvents['on'](_0x348da8,_0x19a859);}}; \ No newline at end of file +var _0x80c0=['emit','removeListener','register','./whatsappAccount.events','save','remove','update'];(function(_0x3b3a82,_0x53b5e0){var _0x267063=function(_0x5aaf3d){while(--_0x5aaf3d){_0x3b3a82['push'](_0x3b3a82['shift']());}};_0x267063(++_0x53b5e0);}(_0x80c0,0xf8));var _0x080c=function(_0x220e7d,_0xcbb04a){_0x220e7d=_0x220e7d-0x0;var _0x1c887d=_0x80c0[_0x220e7d];return _0x1c887d;};'use strict';var WhatsappAccountEvents=require(_0x080c('0x0'));var events=[_0x080c('0x1'),_0x080c('0x2'),_0x080c('0x3')];function createListener(_0x32aeec,_0x5d73c6){return function(_0x1feae0){_0x5d73c6[_0x080c('0x4')](_0x32aeec,_0x1feae0);};}function removeListener(_0xb59c0,_0x10a6bd){return function(){WhatsappAccountEvents[_0x080c('0x5')](_0xb59c0,_0x10a6bd);};}exports[_0x080c('0x6')]=function(_0x5cf6cc){for(var _0x409dd1=0x0,_0x1f92bd=events['length'];_0x409dd1<_0x1f92bd;_0x409dd1++){var _0x41bb49=events[_0x409dd1];var _0x47058e=createListener('whatsappAccount:'+_0x41bb49,_0x5cf6cc);WhatsappAccountEvents['on'](_0x41bb49,_0x47058e);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index b8b0c35..049cf17 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 _0x4747=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','post','create','/:id','delete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4747,0x1a0));var _0x7474=function(_0x5b0208,_0x58666d){_0x5b0208=_0x5b0208-0x0;var _0x5800b4=_0x4747[_0x5b0208];return _0x5800b4;};'use strict';var multer=require(_0x7474('0x0'));var util=require(_0x7474('0x1'));var path=require(_0x7474('0x2'));var timeout=require(_0x7474('0x3'));var express=require('express');var router=express[_0x7474('0x4')]();var auth=require(_0x7474('0x5'));var interaction=require(_0x7474('0x6'));var config=require(_0x7474('0x7'));var controller=require(_0x7474('0x8'));router[_0x7474('0x9')]('/',auth[_0x7474('0xa')](),controller[_0x7474('0xb')]);router[_0x7474('0x9')]('/:id',auth[_0x7474('0xa')](),controller['show']);router[_0x7474('0xc')]('/',auth['isAuthenticated'](),controller[_0x7474('0xd')]);router['put'](_0x7474('0xe'),auth[_0x7474('0xa')](),controller['update']);router[_0x7474('0xf')](_0x7474('0xe'),auth[_0x7474('0xa')](),controller[_0x7474('0x10')]);module[_0x7474('0x11')]=router; \ No newline at end of file +var _0x0f86=['post','put','update','delete','multer','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x3fe306,_0x29434a){var _0x8e53e8=function(_0x22372a){while(--_0x22372a){_0x3fe306['push'](_0x3fe306['shift']());}};_0x8e53e8(++_0x29434a);}(_0x0f86,0x1a8));var _0x60f8=function(_0x281bc5,_0x586ff3){_0x281bc5=_0x281bc5-0x0;var _0x438185=_0x0f86[_0x281bc5];return _0x438185;};'use strict';var multer=require(_0x60f8('0x0'));var util=require('util');var path=require(_0x60f8('0x1'));var timeout=require('connect-timeout');var express=require(_0x60f8('0x2'));var router=express[_0x60f8('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x60f8('0x4'));var config=require(_0x60f8('0x5'));var controller=require('./whatsappApplication.controller');router[_0x60f8('0x6')]('/',auth[_0x60f8('0x7')](),controller[_0x60f8('0x8')]);router[_0x60f8('0x6')](_0x60f8('0x9'),auth[_0x60f8('0x7')](),controller[_0x60f8('0xa')]);router[_0x60f8('0xb')]('/',auth[_0x60f8('0x7')](),controller['create']);router[_0x60f8('0xc')](_0x60f8('0x9'),auth[_0x60f8('0x7')](),controller[_0x60f8('0xd')]);router[_0x60f8('0xe')](_0x60f8('0x9'),auth[_0x60f8('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 3f3e48b..cae9e9f 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 _0x790c=['noop','sequelize','exports','INTEGER','STRING'];(function(_0x4e6a4f,_0x204514){var _0x18a324=function(_0x5dded6){while(--_0x5dded6){_0x4e6a4f['push'](_0x4e6a4f['shift']());}};_0x18a324(++_0x204514);}(_0x790c,0x6f));var _0xc790=function(_0x5ef9ea,_0x217535){_0x5ef9ea=_0x5ef9ea-0x0;var _0x1d1f90=_0x790c[_0x5ef9ea];return _0x1d1f90;};'use strict';var Sequelize=require(_0xc790('0x0'));module[_0xc790('0x1')]={'priority':{'type':Sequelize[_0xc790('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc790('0x3')],'allowNull':![],'defaultValue':_0xc790('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc790('0x3')]},'interval':{'type':Sequelize[_0xc790('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2aa4=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2aa4,0xb9));var _0x42aa=function(_0x1db46b,_0x5af30d){_0x1db46b=_0x1db46b-0x0;var _0x36cd09=_0x2aa4[_0x1db46b];return _0x36cd09;};'use strict';var Sequelize=require(_0x42aa('0x0'));module[_0x42aa('0x1')]={'priority':{'type':Sequelize[_0x42aa('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x42aa('0x3')],'allowNull':![],'defaultValue':_0x42aa('0x4')},'appdata':{'type':Sequelize[_0x42aa('0x5')]()},'description':{'type':Sequelize[_0x42aa('0x3')]},'interval':{'type':Sequelize[_0x42aa('0x3')],'defaultValue':_0x42aa('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 53681c3..2272d38 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 _0xad6a=['key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','intersection','merge','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','index','map','WhatsappApplication','rawAttributes','fieldName'];(function(_0x3e0191,_0x1d4b20){var _0xf2ae83=function(_0x277210){while(--_0x277210){_0x3e0191['push'](_0x3e0191['shift']());}};_0xf2ae83(++_0x1d4b20);}(_0xad6a,0x18e));var _0xaad6=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xad6a[_0x725b8e];return _0x43ac45;};'use strict';var pdf=require(_0xaad6('0x0'));var emlformat=require(_0xaad6('0x1'));var rimraf=require(_0xaad6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaad6('0x3'));var rp=require(_0xaad6('0x4'));var moment=require(_0xaad6('0x5'));var BPromise=require(_0xaad6('0x6'));var Mustache=require(_0xaad6('0x7'));var util=require(_0xaad6('0x8'));var path=require('path');var sox=require(_0xaad6('0x9'));var csv=require(_0xaad6('0xa'));var ejs=require(_0xaad6('0xb'));var fs=require('fs');var _=require(_0xaad6('0xc'));var squel=require('squel');var crypto=require(_0xaad6('0xd'));var jsforce=require(_0xaad6('0xe'));var deskjs=require(_0xaad6('0xf'));var toCsv=require(_0xaad6('0xa'));var querystring=require(_0xaad6('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaad6('0x11'));var qs=require(_0xaad6('0x12'));var as=require(_0xaad6('0x13'));var hardwareService=require(_0xaad6('0x14'));var logger=require(_0xaad6('0x15'))(_0xaad6('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaad6('0x17'));var db=require(_0xaad6('0x18'))['db'];function respondWithStatusCode(_0x15000a,_0x498ff8){_0x498ff8=_0x498ff8||0xcc;return function(_0x114adf){if(_0x114adf){return _0x15000a[_0xaad6('0x19')](_0x498ff8);}return _0x15000a[_0xaad6('0x1a')](_0x498ff8)[_0xaad6('0x1b')]();};}function respondWithResult(_0x5c160e,_0x50d615){_0x50d615=_0x50d615||0xc8;return function(_0xcf3ba0){if(_0xcf3ba0){return _0x5c160e[_0xaad6('0x1a')](_0x50d615)[_0xaad6('0x1c')](_0xcf3ba0);}};}function respondWithFilteredResult(_0x262303,_0x51cb88){return function(_0x4f6a47){if(_0x4f6a47){var _0x2403fb=_0x4f6a47[_0xaad6('0x1d')],_0x18cbea=_0x51cb88[_0xaad6('0x1e')],_0x284a8c=_0x51cb88[_0xaad6('0x1e')]+_0x51cb88[_0xaad6('0x1f')],_0x50a1cc;if(_0x284a8c>=_0x2403fb){_0x284a8c=_0x2403fb;_0x50a1cc=0xc8;}else{_0x50a1cc=0xce;}_0x262303[_0xaad6('0x1a')](_0x50a1cc);return _0x262303[_0xaad6('0x20')](_0xaad6('0x21'),_0x18cbea+'-'+_0x284a8c+'/'+_0x2403fb)[_0xaad6('0x1c')](_0x4f6a47);}return null;};}function patchUpdates(_0x296da2){return function(_0xb72a60){try{jsonpatch[_0xaad6('0x22')](_0xb72a60,_0x296da2,!![]);}catch(_0x3b5133){return BPromise[_0xaad6('0x23')](_0x3b5133);}return _0xb72a60[_0xaad6('0x24')]();};}function saveUpdates(_0x3d16c8,_0x1b5c1c){return function(_0x407cbc){if(_0x407cbc){return _0x407cbc[_0xaad6('0x25')](_0x3d16c8)['then'](function(_0x36d3b0){return _0x36d3b0;});}return null;};}function removeEntity(_0x3b27ec,_0x5c9d6c){return function(_0x3e6d9f){if(_0x3e6d9f){return _0x3e6d9f[_0xaad6('0x26')]()[_0xaad6('0x27')](function(){_0x3b27ec[_0xaad6('0x1a')](0xcc)[_0xaad6('0x1b')]();});}};}function handleEntityNotFound(_0x46bef9,_0x193900){return function(_0x278be7){if(!_0x278be7){_0x46bef9[_0xaad6('0x19')](0x194);}return _0x278be7;};}function handleError(_0x1660cb,_0x519853){_0x519853=_0x519853||0x1f4;return function(_0x6e68df){logger['error'](_0x6e68df['stack']);if(_0x6e68df['name']){delete _0x6e68df[_0xaad6('0x28')];}_0x1660cb[_0xaad6('0x1a')](_0x519853)['send'](_0x6e68df);};}exports[_0xaad6('0x29')]=function(_0x2b512b,_0x1f564b){var _0x2324be={},_0x1c3e68={},_0x175ba3={'count':0x0,'rows':[]};var _0x149e91=_[_0xaad6('0x2a')](db[_0xaad6('0x2b')][_0xaad6('0x2c')],function(_0x56d6b6){return{'name':_0x56d6b6[_0xaad6('0x2d')],'type':_0x56d6b6['type'][_0xaad6('0x2e')]};});_0x1c3e68[_0xaad6('0x2f')]=_[_0xaad6('0x2a')](_0x149e91,_0xaad6('0x28'));_0x1c3e68[_0xaad6('0x30')]=_[_0xaad6('0x31')](_0x2b512b[_0xaad6('0x30')]);_0x1c3e68[_0xaad6('0x32')]=_['intersection'](_0x1c3e68['model'],_0x1c3e68[_0xaad6('0x30')]);_0x2324be['attributes']=_['intersection'](_0x1c3e68[_0xaad6('0x2f')],qs['fields'](_0x2b512b[_0xaad6('0x30')][_0xaad6('0x33')]));_0x2324be[_0xaad6('0x34')]=_0x2324be[_0xaad6('0x34')][_0xaad6('0x35')]?_0x2324be['attributes']:_0x1c3e68[_0xaad6('0x2f')];if(!_0x2b512b[_0xaad6('0x30')][_0xaad6('0x36')](_0xaad6('0x37'))){_0x2324be['limit']=qs['limit'](_0x2b512b['query']['limit']);_0x2324be[_0xaad6('0x1e')]=qs[_0xaad6('0x1e')](_0x2b512b[_0xaad6('0x30')][_0xaad6('0x1e')]);}_0x2324be[_0xaad6('0x38')]=qs['sort'](_0x2b512b[_0xaad6('0x30')][_0xaad6('0x39')]);_0x2324be[_0xaad6('0x3a')]=qs[_0xaad6('0x32')](_['pick'](_0x2b512b[_0xaad6('0x30')],_0x1c3e68[_0xaad6('0x32')]),_0x149e91);if(_0x2b512b['query'][_0xaad6('0x3b')]){_0x2324be['where']=_['merge'](_0x2324be[_0xaad6('0x3a')],{'$or':_[_0xaad6('0x2a')](_0x149e91,function(_0x5c1a29){if(_0x5c1a29[_0xaad6('0x3c')]!==_0xaad6('0x3d')){var _0x25f37f={};_0x25f37f[_0x5c1a29['name']]={'$like':'%'+_0x2b512b[_0xaad6('0x30')]['filter']+'%'};return _0x25f37f;}})});}_0x2324be=_['merge']({},_0x2324be,_0x2b512b[_0xaad6('0x3e')]);var _0xaaf607={'where':_0x2324be[_0xaad6('0x3a')]};return db[_0xaad6('0x2b')][_0xaad6('0x1d')](_0xaaf607)['then'](function(_0x3e5631){_0x175ba3['count']=_0x3e5631;if(_0x2b512b[_0xaad6('0x30')][_0xaad6('0x3f')]){_0x2324be[_0xaad6('0x40')]=[{'all':!![]}];}return db[_0xaad6('0x2b')][_0xaad6('0x41')](_0x2324be);})[_0xaad6('0x27')](function(_0x6f037f){_0x175ba3['rows']=_0x6f037f;return _0x175ba3;})[_0xaad6('0x27')](respondWithFilteredResult(_0x1f564b,_0x2324be))[_0xaad6('0x42')](handleError(_0x1f564b,null));};exports[_0xaad6('0x43')]=function(_0xbf008,_0x2e3641){var _0x201f5b={'raw':!![],'where':{'id':_0xbf008[_0xaad6('0x44')]['id']}},_0x152a40={};_0x152a40[_0xaad6('0x2f')]=_[_0xaad6('0x31')](db[_0xaad6('0x2b')][_0xaad6('0x2c')]);_0x152a40[_0xaad6('0x30')]=_[_0xaad6('0x31')](_0xbf008[_0xaad6('0x30')]);_0x152a40['filters']=_[_0xaad6('0x45')](_0x152a40[_0xaad6('0x2f')],_0x152a40[_0xaad6('0x30')]);_0x201f5b['attributes']=_[_0xaad6('0x45')](_0x152a40[_0xaad6('0x2f')],qs[_0xaad6('0x33')](_0xbf008[_0xaad6('0x30')][_0xaad6('0x33')]));_0x201f5b['attributes']=_0x201f5b[_0xaad6('0x34')][_0xaad6('0x35')]?_0x201f5b['attributes']:_0x152a40[_0xaad6('0x2f')];if(_0xbf008[_0xaad6('0x30')][_0xaad6('0x3f')]){_0x201f5b[_0xaad6('0x40')]=[{'all':!![]}];}_0x201f5b=_[_0xaad6('0x46')]({},_0x201f5b,_0xbf008[_0xaad6('0x3e')]);return db[_0xaad6('0x2b')][_0xaad6('0x47')](_0x201f5b)[_0xaad6('0x27')](handleEntityNotFound(_0x2e3641,null))[_0xaad6('0x27')](respondWithResult(_0x2e3641,null))['catch'](handleError(_0x2e3641,null));};exports[_0xaad6('0x48')]=function(_0x581a18,_0x53ebea){return db[_0xaad6('0x2b')][_0xaad6('0x48')](_0x581a18[_0xaad6('0x49')],{})[_0xaad6('0x27')](respondWithResult(_0x53ebea,0xc9))['catch'](handleError(_0x53ebea,null));};exports['update']=function(_0x3717b4,_0x4aefb9){if(_0x3717b4['body']['id']){delete _0x3717b4[_0xaad6('0x49')]['id'];}return db[_0xaad6('0x2b')]['find']({'where':{'id':_0x3717b4['params']['id']}})['then'](handleEntityNotFound(_0x4aefb9,null))['then'](saveUpdates(_0x3717b4['body'],null))[_0xaad6('0x27')](respondWithResult(_0x4aefb9,null))[_0xaad6('0x42')](handleError(_0x4aefb9,null));};exports[_0xaad6('0x26')]=function(_0x21021c,_0x51a0f1){return db[_0xaad6('0x2b')]['find']({'where':{'id':_0x21021c[_0xaad6('0x44')]['id']}})[_0xaad6('0x27')](handleEntityNotFound(_0x51a0f1,null))[_0xaad6('0x27')](removeEntity(_0x51a0f1,null))['catch'](handleError(_0x51a0f1,null));}; \ No newline at end of file +var _0xe1bc=['attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','keys','length','find','create','update','body','params','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','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','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','sendStatus','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','intersection','model','fields'];(function(_0x397123,_0x4c8508){var _0x4f4949=function(_0x1db9ab){while(--_0x1db9ab){_0x397123['push'](_0x397123['shift']());}};_0x4f4949(++_0x4c8508);}(_0xe1bc,0x68));var _0xce1b=function(_0x5a3ab1,_0x306739){_0x5a3ab1=_0x5a3ab1-0x0;var _0x55967d=_0xe1bc[_0x5a3ab1];return _0x55967d;};'use strict';var pdf=require(_0xce1b('0x0'));var emlformat=require(_0xce1b('0x1'));var rimraf=require(_0xce1b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce1b('0x3'));var rp=require('request-promise');var moment=require(_0xce1b('0x4'));var BPromise=require(_0xce1b('0x5'));var Mustache=require(_0xce1b('0x6'));var util=require(_0xce1b('0x7'));var path=require('path');var sox=require(_0xce1b('0x8'));var csv=require(_0xce1b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xce1b('0xa'));var squel=require(_0xce1b('0xb'));var crypto=require(_0xce1b('0xc'));var jsforce=require(_0xce1b('0xd'));var deskjs=require(_0xce1b('0xe'));var toCsv=require(_0xce1b('0x9'));var querystring=require(_0xce1b('0xf'));var Papa=require('papaparse');var Redis=require(_0xce1b('0x10'));var authService=require(_0xce1b('0x11'));var qs=require(_0xce1b('0x12'));var as=require(_0xce1b('0x13'));var hardwareService=require(_0xce1b('0x14'));var logger=require(_0xce1b('0x15'))(_0xce1b('0x16'));var utils=require(_0xce1b('0x17'));var config=require(_0xce1b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xce1b('0x19'))['db'];function respondWithStatusCode(_0xcd2987,_0x4d0a5f){_0x4d0a5f=_0x4d0a5f||0xcc;return function(_0x48bd2f){if(_0x48bd2f){return _0xcd2987['sendStatus'](_0x4d0a5f);}return _0xcd2987[_0xce1b('0x1a')](_0x4d0a5f)[_0xce1b('0x1b')]();};}function respondWithResult(_0x7ffea1,_0x14fa7c){_0x14fa7c=_0x14fa7c||0xc8;return function(_0x2a8305){if(_0x2a8305){return _0x7ffea1[_0xce1b('0x1a')](_0x14fa7c)[_0xce1b('0x1c')](_0x2a8305);}};}function respondWithFilteredResult(_0x348435,_0x10bb6e){return function(_0x2008ff){if(_0x2008ff){var _0x2da21a=_0x2008ff[_0xce1b('0x1d')],_0x5dae8f=_0x10bb6e[_0xce1b('0x1e')],_0x28f90e=_0x10bb6e[_0xce1b('0x1e')]+_0x10bb6e[_0xce1b('0x1f')],_0x3f05cf;if(_0x28f90e>=_0x2da21a){_0x28f90e=_0x2da21a;_0x3f05cf=0xc8;}else{_0x3f05cf=0xce;}_0x348435['status'](_0x3f05cf);return _0x348435[_0xce1b('0x20')](_0xce1b('0x21'),_0x5dae8f+'-'+_0x28f90e+'/'+_0x2da21a)[_0xce1b('0x1c')](_0x2008ff);}return null;};}function patchUpdates(_0x1ca99c){return function(_0x2055b1){try{jsonpatch[_0xce1b('0x22')](_0x2055b1,_0x1ca99c,!![]);}catch(_0x4fb3ee){return BPromise[_0xce1b('0x23')](_0x4fb3ee);}return _0x2055b1[_0xce1b('0x24')]();};}function saveUpdates(_0x1ef17b,_0x3bf904){return function(_0x505d27){if(_0x505d27){return _0x505d27['update'](_0x1ef17b)['then'](function(_0x31bcfb){return _0x31bcfb;});}return null;};}function removeEntity(_0x5b3765,_0x25d760){return function(_0x3ff489){if(_0x3ff489){return _0x3ff489[_0xce1b('0x25')]()['then'](function(){_0x5b3765['status'](0xcc)[_0xce1b('0x1b')]();});}};}function handleEntityNotFound(_0x1e2757,_0x194519){return function(_0x27c3ab){if(!_0x27c3ab){_0x1e2757[_0xce1b('0x26')](0x194);}return _0x27c3ab;};}function handleError(_0x319020,_0x5eb979){_0x5eb979=_0x5eb979||0x1f4;return function(_0x591619){logger[_0xce1b('0x27')](_0x591619[_0xce1b('0x28')]);if(_0x591619[_0xce1b('0x29')]){delete _0x591619[_0xce1b('0x29')];}_0x319020[_0xce1b('0x1a')](_0x5eb979)[_0xce1b('0x2a')](_0x591619);};}exports[_0xce1b('0x2b')]=function(_0x2d4b2c,_0x3f8b22){var _0x2b519d={},_0x5cefa3={},_0x83c2d6={'count':0x0,'rows':[]};var _0x16aeb4=_[_0xce1b('0x2c')](db[_0xce1b('0x2d')][_0xce1b('0x2e')],function(_0x3dc74b){return{'name':_0x3dc74b[_0xce1b('0x2f')],'type':_0x3dc74b[_0xce1b('0x30')][_0xce1b('0x31')]};});_0x5cefa3['model']=_[_0xce1b('0x2c')](_0x16aeb4,'name');_0x5cefa3[_0xce1b('0x32')]=_['keys'](_0x2d4b2c[_0xce1b('0x32')]);_0x5cefa3['filters']=_[_0xce1b('0x33')](_0x5cefa3[_0xce1b('0x34')],_0x5cefa3['query']);_0x2b519d['attributes']=_['intersection'](_0x5cefa3[_0xce1b('0x34')],qs[_0xce1b('0x35')](_0x2d4b2c[_0xce1b('0x32')][_0xce1b('0x35')]));_0x2b519d[_0xce1b('0x36')]=_0x2b519d[_0xce1b('0x36')]['length']?_0x2b519d[_0xce1b('0x36')]:_0x5cefa3[_0xce1b('0x34')];if(!_0x2d4b2c[_0xce1b('0x32')][_0xce1b('0x37')](_0xce1b('0x38'))){_0x2b519d[_0xce1b('0x1f')]=qs['limit'](_0x2d4b2c[_0xce1b('0x32')][_0xce1b('0x1f')]);_0x2b519d['offset']=qs[_0xce1b('0x1e')](_0x2d4b2c['query'][_0xce1b('0x1e')]);}_0x2b519d[_0xce1b('0x39')]=qs[_0xce1b('0x3a')](_0x2d4b2c[_0xce1b('0x32')]['sort']);_0x2b519d[_0xce1b('0x3b')]=qs[_0xce1b('0x3c')](_['pick'](_0x2d4b2c['query'],_0x5cefa3[_0xce1b('0x3c')]),_0x16aeb4);if(_0x2d4b2c[_0xce1b('0x32')][_0xce1b('0x3d')]){_0x2b519d[_0xce1b('0x3b')]=_[_0xce1b('0x3e')](_0x2b519d['where'],{'$or':_[_0xce1b('0x2c')](_0x16aeb4,function(_0x5f1afe){if(_0x5f1afe[_0xce1b('0x30')]!==_0xce1b('0x3f')){var _0x5ba037={};_0x5ba037[_0x5f1afe[_0xce1b('0x29')]]={'$like':'%'+_0x2d4b2c[_0xce1b('0x32')][_0xce1b('0x3d')]+'%'};return _0x5ba037;}})});}_0x2b519d=_[_0xce1b('0x3e')]({},_0x2b519d,_0x2d4b2c[_0xce1b('0x40')]);var _0x57d7ac={'where':_0x2b519d['where']};return db[_0xce1b('0x2d')]['count'](_0x57d7ac)[_0xce1b('0x41')](function(_0x1c4321){_0x83c2d6[_0xce1b('0x1d')]=_0x1c4321;if(_0x2d4b2c[_0xce1b('0x32')][_0xce1b('0x42')]){_0x2b519d[_0xce1b('0x43')]=[{'all':!![]}];}return db[_0xce1b('0x2d')][_0xce1b('0x44')](_0x2b519d);})[_0xce1b('0x41')](function(_0x6e3e73){_0x83c2d6[_0xce1b('0x45')]=_0x6e3e73;return _0x83c2d6;})['then'](respondWithFilteredResult(_0x3f8b22,_0x2b519d))[_0xce1b('0x46')](handleError(_0x3f8b22,null));};exports[_0xce1b('0x47')]=function(_0x29691d,_0x17c748){var _0x5da5b2={'raw':!![],'where':{'id':_0x29691d['params']['id']}},_0x243c86={};_0x243c86[_0xce1b('0x34')]=_[_0xce1b('0x48')](db[_0xce1b('0x2d')][_0xce1b('0x2e')]);_0x243c86[_0xce1b('0x32')]=_[_0xce1b('0x48')](_0x29691d[_0xce1b('0x32')]);_0x243c86[_0xce1b('0x3c')]=_[_0xce1b('0x33')](_0x243c86[_0xce1b('0x34')],_0x243c86['query']);_0x5da5b2['attributes']=_[_0xce1b('0x33')](_0x243c86['model'],qs['fields'](_0x29691d[_0xce1b('0x32')][_0xce1b('0x35')]));_0x5da5b2['attributes']=_0x5da5b2[_0xce1b('0x36')][_0xce1b('0x49')]?_0x5da5b2[_0xce1b('0x36')]:_0x243c86[_0xce1b('0x34')];if(_0x29691d[_0xce1b('0x32')][_0xce1b('0x42')]){_0x5da5b2[_0xce1b('0x43')]=[{'all':!![]}];}_0x5da5b2=_['merge']({},_0x5da5b2,_0x29691d[_0xce1b('0x40')]);return db[_0xce1b('0x2d')][_0xce1b('0x4a')](_0x5da5b2)[_0xce1b('0x41')](handleEntityNotFound(_0x17c748,null))[_0xce1b('0x41')](respondWithResult(_0x17c748,null))[_0xce1b('0x46')](handleError(_0x17c748,null));};exports[_0xce1b('0x4b')]=function(_0x75fdb4,_0x34521b){return db['WhatsappApplication'][_0xce1b('0x4b')](_0x75fdb4['body'],{})[_0xce1b('0x41')](respondWithResult(_0x34521b,0xc9))['catch'](handleError(_0x34521b,null));};exports[_0xce1b('0x4c')]=function(_0x529b1e,_0x854274){if(_0x529b1e[_0xce1b('0x4d')]['id']){delete _0x529b1e[_0xce1b('0x4d')]['id'];}return db[_0xce1b('0x2d')][_0xce1b('0x4a')]({'where':{'id':_0x529b1e['params']['id']}})[_0xce1b('0x41')](handleEntityNotFound(_0x854274,null))[_0xce1b('0x41')](saveUpdates(_0x529b1e[_0xce1b('0x4d')],null))['then'](respondWithResult(_0x854274,null))['catch'](handleError(_0x854274,null));};exports[_0xce1b('0x25')]=function(_0x5e0685,_0x395025){return db[_0xce1b('0x2d')][_0xce1b('0x4a')]({'where':{'id':_0x5e0685[_0xce1b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x395025,null))[_0xce1b('0x41')](removeEntity(_0x395025,null))[_0xce1b('0x46')](handleError(_0x395025,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index d2893ed..429d5fd 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 _0xd642=['rimraf','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x525b28,_0x5cf5a0){var _0x180178=function(_0x43e066){while(--_0x43e066){_0x525b28['push'](_0x525b28['shift']());}};_0x180178(++_0x5cf5a0);}(_0xd642,0x89));var _0x2d64=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xd642[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x2d64('0x0'));var util=require(_0x2d64('0x1'));var logger=require(_0x2d64('0x2'))(_0x2d64('0x3'));var moment=require('moment');var BPromise=require(_0x2d64('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d64('0x5'));var rimraf=require(_0x2d64('0x6'));var config=require('../../config/environment');var attributes=require(_0x2d64('0x7'));module[_0x2d64('0x8')]=function(_0x4cdeca,_0x476c05){return _0x4cdeca[_0x2d64('0x9')]('WhatsappApplication',attributes,{'tableName':_0x2d64('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d64('0xb'),'collate':_0x2d64('0xc')});}; \ No newline at end of file +var _0x9209=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','WhatsappApplication','whatsapp_applications'];(function(_0x1c4d84,_0xc6f48f){var _0x1eb568=function(_0x42be9f){while(--_0x42be9f){_0x1c4d84['push'](_0x1c4d84['shift']());}};_0x1eb568(++_0xc6f48f);}(_0x9209,0x152));var _0x9920=function(_0x356103,_0x4ac2a3){_0x356103=_0x356103-0x0;var _0x338598=_0x9209[_0x356103];return _0x338598;};'use strict';var _=require(_0x9920('0x0'));var util=require(_0x9920('0x1'));var logger=require(_0x9920('0x2'))(_0x9920('0x3'));var moment=require(_0x9920('0x4'));var BPromise=require('bluebird');var rp=require(_0x9920('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9920('0x6'));var config=require(_0x9920('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0x9920('0x8')]=function(_0x4fcb20,_0x7891e5){return _0x4fcb20[_0x9920('0x9')](_0x9920('0xa'),attributes,{'tableName':_0x9920('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9920('0xc'),'collate':_0x9920('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index d806bdd..b304945 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 _0x7ed1=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x5216e0,_0x4f8cb9){var _0x5b3f40=function(_0x30c832){while(--_0x30c832){_0x5216e0['push'](_0x5216e0['shift']());}};_0x5b3f40(++_0x4f8cb9);}(_0x7ed1,0xca));var _0x17ed=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x7ed1[_0x28aea5];return _0x6a55f9;};'use strict';var _=require(_0x17ed('0x0'));var util=require('util');var moment=require(_0x17ed('0x1'));var BPromise=require(_0x17ed('0x2'));var rs=require(_0x17ed('0x3'));var fs=require('fs');var Redis=require(_0x17ed('0x4'));var db=require(_0x17ed('0x5'))['db'];var utils=require(_0x17ed('0x6'));var logger=require('../../config/logger')(_0x17ed('0x7'));var config=require(_0x17ed('0x8'));var jayson=require(_0x17ed('0x9'));var client=jayson[_0x17ed('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x566a07,_0x3f6dca,_0x408fc2){return new BPromise(function(_0xcd3d39,_0x6e2d89){return client['request'](_0x566a07,_0x408fc2)[_0x17ed('0xb')](function(_0x321cd2){logger[_0x17ed('0xc')](_0x17ed('0xd'),_0x3f6dca,_0x17ed('0xe'));logger[_0x17ed('0xf')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x3f6dca,_0x17ed('0xe'),JSON['stringify'](_0x321cd2));if(_0x321cd2['error']){if(_0x321cd2[_0x17ed('0x10')][_0x17ed('0x11')]===0x1f4){logger[_0x17ed('0x10')](_0x17ed('0xd'),_0x3f6dca,_0x321cd2[_0x17ed('0x10')]['message']);return _0x6e2d89(_0x321cd2[_0x17ed('0x10')][_0x17ed('0x12')]);}logger[_0x17ed('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x3f6dca,_0x321cd2[_0x17ed('0x10')]['message']);return _0xcd3d39(_0x321cd2['error'][_0x17ed('0x12')]);}else{logger['info'](_0x17ed('0xd'),_0x3f6dca,_0x17ed('0xe'));_0xcd3d39(_0x321cd2[_0x17ed('0x13')][_0x17ed('0x12')]);}})['catch'](function(_0x897d4b){logger[_0x17ed('0x10')](_0x17ed('0xd'),_0x3f6dca,_0x897d4b);_0x6e2d89(_0x897d4b);});});} \ No newline at end of file +var _0x5334=['http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0xcb4e2a,_0x3edaa5){var _0x2f859f=function(_0x478fc3){while(--_0x478fc3){_0xcb4e2a['push'](_0xcb4e2a['shift']());}};_0x2f859f(++_0x3edaa5);}(_0x5334,0x84));var _0x4533=function(_0x57aafb,_0x54d8dd){_0x57aafb=_0x57aafb-0x0;var _0x498b26=_0x5334[_0x57aafb];return _0x498b26;};'use strict';var _=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var moment=require(_0x4533('0x2'));var BPromise=require(_0x4533('0x3'));var rs=require(_0x4533('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4533('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4533('0x6'))(_0x4533('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4533('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dea06,_0x4d89e7,_0x487906){return new BPromise(function(_0x3fbdc3,_0x42f94b){return client[_0x4533('0x9')](_0x4dea06,_0x487906)[_0x4533('0xa')](function(_0x31018b){logger[_0x4533('0xb')](_0x4533('0xc'),_0x4d89e7,'request\x20sent');logger[_0x4533('0xd')](_0x4533('0xe'),_0x4d89e7,_0x4533('0xf'),JSON[_0x4533('0x10')](_0x31018b));if(_0x31018b['error']){if(_0x31018b[_0x4533('0x11')]['code']===0x1f4){logger[_0x4533('0x11')](_0x4533('0xc'),_0x4d89e7,_0x31018b[_0x4533('0x11')][_0x4533('0x12')]);return _0x42f94b(_0x31018b['error'][_0x4533('0x12')]);}logger[_0x4533('0x11')](_0x4533('0xc'),_0x4d89e7,_0x31018b[_0x4533('0x11')]['message']);return _0x3fbdc3(_0x31018b[_0x4533('0x11')]['message']);}else{logger['info'](_0x4533('0xc'),_0x4d89e7,_0x4533('0xf'));_0x3fbdc3(_0x31018b['result'][_0x4533('0x12')]);}})[_0x4533('0x13')](function(_0x2a9877){logger['error'](_0x4533('0xc'),_0x4d89e7,_0x2a9877);_0x42f94b(_0x2a9877);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 81efecd..b91b050 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 _0x52c3=['post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','multer','path','connect-timeout','Router','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download'];(function(_0x2219a2,_0x37d194){var _0x3e4a29=function(_0x1da431){while(--_0x1da431){_0x2219a2['push'](_0x2219a2['shift']());}};_0x3e4a29(++_0x37d194);}(_0x52c3,0x151));var _0x352c=function(_0x27c068,_0x342981){_0x27c068=_0x27c068-0x0;var _0xe5a67f=_0x52c3[_0x27c068];return _0xe5a67f;};'use strict';var multer=require(_0x352c('0x0'));var util=require('util');var path=require(_0x352c('0x1'));var timeout=require(_0x352c('0x2'));var express=require('express');var router=express[_0x352c('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x352c('0x4'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0x352c('0x5')](),controller[_0x352c('0x6')]);router['get']('/describe',auth[_0x352c('0x5')](),controller['describe']);router[_0x352c('0x7')](_0x352c('0x8'),auth['isAuthenticated'](),controller[_0x352c('0x9')]);router[_0x352c('0x7')](_0x352c('0xa'),auth[_0x352c('0x5')](),controller[_0x352c('0xb')]);router['get'](_0x352c('0xc'),auth[_0x352c('0x5')](),controller[_0x352c('0xd')]);router[_0x352c('0xe')]('/',auth[_0x352c('0x5')](),controller[_0x352c('0xf')]);router[_0x352c('0xe')](_0x352c('0xa'),auth[_0x352c('0x5')](),controller[_0x352c('0x10')]);router[_0x352c('0xe')](_0x352c('0x11'),auth[_0x352c('0x5')](),interaction[_0x352c('0x12')]('whatsapp',_0x352c('0x13')),controller[_0x352c('0x14')]);router['put']('/:id',auth[_0x352c('0x5')](),interaction[_0x352c('0x12')](_0x352c('0x15'),_0x352c('0x16')),controller[_0x352c('0x17')]);router['delete'](_0x352c('0x8'),auth[_0x352c('0x5')](),interaction['tracked'](_0x352c('0x15'),_0x352c('0x18')),controller[_0x352c('0x19')]);router[_0x352c('0x1a')]('/:id/tags',auth[_0x352c('0x5')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x3b47=['destroy','removeTags','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','index','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','post','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','whatsapp','update','delete','whatsappinteraction:destroy'];(function(_0x545202,_0x26000b){var _0x1103cd=function(_0x23d5bc){while(--_0x23d5bc){_0x545202['push'](_0x545202['shift']());}};_0x1103cd(++_0x26000b);}(_0x3b47,0x18b));var _0x73b4=function(_0x888f6d,_0x5e7153){_0x888f6d=_0x888f6d-0x0;var _0x224322=_0x3b47[_0x888f6d];return _0x224322;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x73b4('0x0'));var timeout=require(_0x73b4('0x1'));var express=require(_0x73b4('0x2'));var router=express[_0x73b4('0x3')]();var auth=require(_0x73b4('0x4'));var interaction=require(_0x73b4('0x5'));var config=require(_0x73b4('0x6'));var controller=require(_0x73b4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x73b4('0x8')]);router[_0x73b4('0x9')]('/describe',auth[_0x73b4('0xa')](),controller[_0x73b4('0xb')]);router[_0x73b4('0x9')](_0x73b4('0xc'),auth[_0x73b4('0xa')](),controller[_0x73b4('0xd')]);router[_0x73b4('0x9')](_0x73b4('0xe'),auth[_0x73b4('0xa')](),controller[_0x73b4('0xf')]);router[_0x73b4('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x73b4('0x10')]('/',auth[_0x73b4('0xa')](),controller['create']);router[_0x73b4('0x10')](_0x73b4('0xe'),auth['isAuthenticated'](),controller[_0x73b4('0x11')]);router['post'](_0x73b4('0x12'),auth[_0x73b4('0xa')](),interaction[_0x73b4('0x13')]('whatsapp',_0x73b4('0x14')),controller['addTags']);router['put'](_0x73b4('0xc'),auth[_0x73b4('0xa')](),interaction[_0x73b4('0x13')](_0x73b4('0x15'),'whatsappinteraction:update'),controller[_0x73b4('0x16')]);router[_0x73b4('0x17')](_0x73b4('0xc'),auth[_0x73b4('0xa')](),interaction['tracked']('whatsapp',_0x73b4('0x18')),controller[_0x73b4('0x19')]);router[_0x73b4('0x17')]('/:id/tags',auth[_0x73b4('0xa')](),controller[_0x73b4('0x1a')]);module[_0x73b4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index be9f061..958b1da 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 _0x5aba=['ENUM','sequelize','BOOLEAN','STRING'];(function(_0x427697,_0x2a395c){var _0x159793=function(_0x5d9152){while(--_0x5d9152){_0x427697['push'](_0x427697['shift']());}};_0x159793(++_0x2a395c);}(_0x5aba,0x69));var _0xa5ab=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x5aba[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0xa5ab('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xa5ab('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa5ab('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa5ab('0x2')]},'note':{'type':Sequelize[_0xa5ab('0x2')]},'phone':{'type':Sequelize[_0xa5ab('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xa5ab('0x3')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3624=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x3807bb,_0x4b3e7f){var _0x131dca=function(_0x21b8b5){while(--_0x21b8b5){_0x3807bb['push'](_0x3807bb['shift']());}};_0x131dca(++_0x4b3e7f);}(_0x3624,0x152));var _0x4362=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x3624[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x4362('0x0'));var moment=require(_0x4362('0x1'));module[_0x4362('0x2')]={'closed':{'type':Sequelize[_0x4362('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4362('0x4')]},'disposition':{'type':Sequelize[_0x4362('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4362('0x5')]},'note':{'type':Sequelize[_0x4362('0x5')]},'phone':{'type':Sequelize[_0x4362('0x5')]},'read1stAt':{'type':Sequelize[_0x4362('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x4362('0x6')]('in',_0x4362('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4362('0x6')]('in','out'),'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 9fd7b9c..186c695 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 _0xf8e3=['CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getWhatsappAccounts','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','unreadMessages','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','rows','show','params','include','options','create','describe','addMessage','WhatsappMessage','ids','findOne','hasOwnProperty','sort','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','emit','removeTags','download','unix','join','root','server','files','attachments','CmContact','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','\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','YYYY-MM-DD','Whatsapp','N.A.','closed','closedAt','disposition','basename','existsSync','pipe','createWriteStream','out','System','direction','renderFile','views','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','name','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','WhatsappInteraction','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','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','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','Contact','operator','$substring','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User'];(function(_0x54425a,_0x174718){var _0x1c796e=function(_0xd089bf){while(--_0xd089bf){_0x54425a['push'](_0x54425a['shift']());}};_0x1c796e(++_0x174718);}(_0xf8e3,0x83));var _0x3f8e=function(_0x530804,_0x44e860){_0x530804=_0x530804-0x0;var _0x3c0f69=_0xf8e3[_0x530804];return _0x3c0f69;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3f8e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3f8e('0x1'));var rp=require(_0x3f8e('0x2'));var moment=require(_0x3f8e('0x3'));var BPromise=require(_0x3f8e('0x4'));var Mustache=require(_0x3f8e('0x5'));var util=require(_0x3f8e('0x6'));var path=require('path');var sox=require(_0x3f8e('0x7'));var csv=require(_0x3f8e('0x8'));var ejs=require(_0x3f8e('0x9'));var fs=require('fs');var _=require(_0x3f8e('0xa'));var squel=require(_0x3f8e('0xb'));var crypto=require('crypto');var jsforce=require(_0x3f8e('0xc'));var deskjs=require(_0x3f8e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3f8e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3f8e('0xf'));var as=require(_0x3f8e('0x10'));var hardwareService=require(_0x3f8e('0x11'));var logger=require(_0x3f8e('0x12'))(_0x3f8e('0x13'));var utils=require('../../config/utils');var config=require(_0x3f8e('0x14'));var licenseUtil=require(_0x3f8e('0x15'));var db=require('../../mysqldb')['db'];config[_0x3f8e('0x16')]=_[_0x3f8e('0x17')](config['redis'],{'host':_0x3f8e('0x18'),'port':0x18eb});var socket=require(_0x3f8e('0x19'))(new Redis(config[_0x3f8e('0x16')]));require(_0x3f8e('0x1a'))[_0x3f8e('0x1b')](socket);function respondWithStatusCode(_0x518965,_0x32fd67){_0x32fd67=_0x32fd67||0xcc;return function(_0x21a815){if(_0x21a815){return _0x518965[_0x3f8e('0x1c')](_0x32fd67);}return _0x518965[_0x3f8e('0x1d')](_0x32fd67)[_0x3f8e('0x1e')]();};}function respondWithResult(_0x36c583,_0x35f276){_0x35f276=_0x35f276||0xc8;return function(_0x243951){if(_0x243951){return _0x36c583['status'](_0x35f276)[_0x3f8e('0x1f')](_0x243951);}};}function respondWithFilteredResult(_0x4770ba,_0x32e43d){return function(_0x3a3c42){if(_0x3a3c42){var _0x16096e=_0x3a3c42[_0x3f8e('0x20')],_0x345a2c=_0x32e43d[_0x3f8e('0x21')],_0x56a3d0=_0x32e43d[_0x3f8e('0x21')]+_0x32e43d[_0x3f8e('0x22')],_0x24a612;if(_0x56a3d0>=_0x16096e){_0x56a3d0=_0x16096e;_0x24a612=0xc8;}else{_0x24a612=0xce;}_0x4770ba[_0x3f8e('0x1d')](_0x24a612);return _0x4770ba['set'](_0x3f8e('0x23'),_0x345a2c+'-'+_0x56a3d0+'/'+_0x16096e)['json'](_0x3a3c42);}return null;};}function patchUpdates(_0xbafb82){return function(_0x1c68bd){try{jsonpatch[_0x3f8e('0x24')](_0x1c68bd,_0xbafb82,!![]);}catch(_0x72cc86){return BPromise[_0x3f8e('0x25')](_0x72cc86);}return _0x1c68bd[_0x3f8e('0x26')]();};}function saveUpdates(_0xb66f95,_0x5279f9){return function(_0x14d778){if(_0x14d778){return _0x14d778[_0x3f8e('0x27')](_0xb66f95)['then'](function(_0x4970c7){return _0x4970c7;});}return null;};}function removeEntity(_0x5ad075,_0x224b2c){return function(_0x470b7c){if(_0x470b7c){return _0x470b7c[_0x3f8e('0x28')]()[_0x3f8e('0x29')](function(){_0x5ad075['status'](0xcc)[_0x3f8e('0x1e')]();});}};}function handleEntityNotFound(_0x1c38f9,_0x15c176){return function(_0x16281f){if(!_0x16281f){_0x1c38f9['sendStatus'](0x194);}return _0x16281f;};}function handleError(_0x466755,_0x599295){_0x599295=_0x599295||0x1f4;return function(_0x424d38){logger[_0x3f8e('0x2a')](_0x424d38['stack']);if(_0x424d38['name']){delete _0x424d38[_0x3f8e('0x2b')];}_0x466755[_0x3f8e('0x1d')](_0x599295)['send'](_0x424d38);};}function getInteractionUsers(_0x488f99,_0x1fe098){return new BPromise(function(_0x5daf74,_0x26c2cc){try{if(_0x1fe098[_0x488f99['id']]){_0x488f99[_0x3f8e('0x2c')]=_[_0x3f8e('0x2d')](_0x1fe098[_0x488f99['id']],function(_0x3eb7b1){return{'id':_0x3eb7b1['id'],'fullname':_0x3eb7b1[_0x3f8e('0x2e')]};});}}catch(_0x1ca409){_0x26c2cc(_0x1ca409);}_0x5daf74(_0x488f99);});}function getInteractionTags(_0x210ae7,_0x4123ba){return new BPromise(function(_0x5bd1a7,_0xbef04d){try{if(_0x210ae7[_0x3f8e('0x2f')]){_0x210ae7[_0x3f8e('0x30')]=[];_0x210ae7[_0x3f8e('0x2f')][_0x3f8e('0x31')](',')[_0x3f8e('0x32')](function(_0x43654b){_0x210ae7[_0x3f8e('0x30')]['push'](_0x4123ba[_0x43654b]);});}delete _0x210ae7[_0x3f8e('0x2f')];}catch(_0x180b4a){_0xbef04d(_0x180b4a);}_0x5bd1a7(_0x210ae7);});}function updateWhatsappInteraction(_0x1568ff,_0x3cef7c,_0x1b2362){return new BPromise(function(_0x417420,_0x4aa42a){return getInteractionUsers(_0x1568ff,_0x1b2362)[_0x3f8e('0x29')](function(_0x3b7cb7){return getInteractionTags(_0x3b7cb7,_0x3cef7c);})['then'](function(_0x490000){_0x417420(_0x490000);})[_0x3f8e('0x33')](function(_0x158d28){_0x4aa42a(_0x158d28);});});}exports[_0x3f8e('0x34')]=function(_0xae122e,_0x217a39){var _0x5e1335={},_0x2946ec={},_0x14cfb7={'count':0x0,'rows':[]};var _0x1ad255=_[_0x3f8e('0x2d')](db[_0x3f8e('0x35')][_0x3f8e('0x36')],function(_0x3dd9b3){return{'name':_0x3dd9b3[_0x3f8e('0x37')],'type':_0x3dd9b3['type'][_0x3f8e('0x38')]};});_0x2946ec['model']=_[_0x3f8e('0x2d')](_0x1ad255,_0x3f8e('0x2b'));_0x2946ec[_0x3f8e('0x39')]=_[_0x3f8e('0x3a')](_0xae122e[_0x3f8e('0x39')]);_0x2946ec[_0x3f8e('0x3b')]=_['intersection'](_0x2946ec[_0x3f8e('0x3c')],_0x2946ec[_0x3f8e('0x39')]);_0x5e1335['attributes']=_[_0x3f8e('0x3d')](_0x2946ec[_0x3f8e('0x3c')],qs[_0x3f8e('0x3e')](_0xae122e['query'][_0x3f8e('0x3e')]));_0x5e1335[_0x3f8e('0x3f')]=_0x5e1335[_0x3f8e('0x3f')][_0x3f8e('0x40')]?_0x5e1335[_0x3f8e('0x3f')]:_0x2946ec[_0x3f8e('0x3c')];if(!_0xae122e['query']['hasOwnProperty'](_0x3f8e('0x41'))){_0x5e1335[_0x3f8e('0x22')]=qs[_0x3f8e('0x22')](_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x22')]);_0x5e1335[_0x3f8e('0x21')]=qs[_0x3f8e('0x21')](_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x21')]);}_0x5e1335[_0x3f8e('0x42')]=qs['sort'](_0xae122e[_0x3f8e('0x39')]['sort']);_0x5e1335[_0x3f8e('0x43')]=qs[_0x3f8e('0x3b')](_[_0x3f8e('0x44')](_0xae122e[_0x3f8e('0x39')],_0x2946ec[_0x3f8e('0x3b')]),_0x1ad255);var _0xbf0642=[];var _0x3ec5c3=squel['select']()[_0x3f8e('0x45')]('id')[_0x3f8e('0x45')](_0x3f8e('0x2b'))[_0x3f8e('0x45')](_0x3f8e('0x46'))[_0x3f8e('0x47')](_0x3f8e('0x48'));var _0x279fc4=squel[_0x3f8e('0x49')]()['field'](_0x3f8e('0x4a'))[_0x3f8e('0x45')](_0x3f8e('0x4b'))[_0x3f8e('0x45')](_0x3f8e('0x4c'))[_0x3f8e('0x47')](_0x3f8e('0x4d'),'ui')[_0x3f8e('0x4e')](_0x3f8e('0x4f'),'u',_0x3f8e('0x50'));var _0x249d53=squel[_0x3f8e('0x49')]()[_0x3f8e('0x47')](_0x3f8e('0x51'),'i')[_0x3f8e('0x4e')](_0x3f8e('0x52'),'c',_0x3f8e('0x53'))[_0x3f8e('0x4e')](_0x3f8e('0x4f'),'o',_0x3f8e('0x54'))[_0x3f8e('0x4e')](_0x3f8e('0x55'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x3f8e('0x4e')](_0x3f8e('0x56'),'me',_0x3f8e('0x57'))[_0x3f8e('0x4e')]('whatsapp_interaction_has_tags','it',_0x3f8e('0x58'))[_0x3f8e('0x4e')]('tools_tags','t',_0x3f8e('0x59'));var _0x1d2176=squel[_0x3f8e('0x5a')]();var _0xb78474=[];var _0x50af9c=squel['expr']();var _0x29ac98;if(_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x5b')]){_0x29ac98=as[_0x3f8e('0x5c')](_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x5b')]);var _0x3d56dd=_0x29ac98[_0x3f8e('0x5d')];for(var _0x32cb6d=0x0;_0x32cb6d<_0x29ac98[_0x3f8e('0x5e')][_0x3f8e('0x40')];_0x32cb6d++){var _0xd9b06=_0x29ac98[_0x3f8e('0x5e')][_0x32cb6d];var _0x2d61ac='i';var _0xa56151=_[_0x3f8e('0x5f')](_0x1ad255,[_0x3f8e('0x2b'),_0xd9b06['field']]);if(!_0xa56151){switch(_0xd9b06[_0x3f8e('0x45')]){case'unreadMessages':if(_0xd9b06['value']==0x1){_0x249d53[_0x3f8e('0x60')]('`'+_0xd9b06[_0x3f8e('0x45')]+_0x3f8e('0x61'));}else{_0x249d53[_0x3f8e('0x60')]('`'+_0xd9b06['field']+'`\x20>\x200');}break;case _0x3f8e('0x62'):if(_0xd9b06[_0x3f8e('0x63')]===_0x3f8e('0x64')){if(_0xd9b06['value'][_0x3f8e('0x31')]('\x20')['length']>0x1){_0x1d2176[_0x3d56dd]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3f8e('0x65')](_0xd9b06[_0x3f8e('0x66')]),null);}else{var _0x25fa94='%'+_0xd9b06[_0x3f8e('0x66')]+'%';_0x1d2176[_0x3d56dd](_0x3f8e('0x67'),_0x25fa94,_0x25fa94,_0x25fa94);}}else{_0xa56151=_[_0x3f8e('0x5f')](_0x1ad255,[_0x3f8e('0x2b'),_0x3f8e('0x68')]);_0xd9b06['field']='ContactId';_0x13c657=as['buildExpression'](_0x2d61ac,_0xa56151[_0x3f8e('0x69')],_0xd9b06);_0x1d2176[_0x3d56dd](_0x13c657['text'],_0x13c657[_0x3f8e('0x66')][_0x3f8e('0x6a')],_0x13c657[_0x3f8e('0x66')]['end']);}break;case _0x3f8e('0x6b'):var _0x744c56=_0xd9b06[_0x3f8e('0x66')]['split'](',')[_0x3f8e('0x2d')](function(_0x49126b){return Number(_0x49126b);});_0x744c56[_0x3f8e('0x32')](function(_0xb1704f){_0x50af9c['or'](_0x3f8e('0x6c'),'%,'+_0xb1704f+',%');});_0xb78474=_['union'](_0xb78474,_0x744c56);break;case _0x3f8e('0x6d'):if(_0xd9b06[_0x3f8e('0x63')]===_0x3f8e('0x64')){_0x1d2176[_0x3d56dd](_0x3f8e('0x6e'),'%'+_0xd9b06[_0x3f8e('0x66')]+'%',null);}else{_0xa56151=_['find'](_0x1ad255,[_0x3f8e('0x2b'),_0x3f8e('0x6f')]);_0xd9b06[_0x3f8e('0x45')]=_0x3f8e('0x6f');_0x13c657=as['buildExpression'](_0x2d61ac,_0xa56151[_0x3f8e('0x69')],_0xd9b06);_0x1d2176[_0x3d56dd](_0x13c657[_0x3f8e('0x70')],_0x13c657[_0x3f8e('0x66')][_0x3f8e('0x6a')],_0x13c657[_0x3f8e('0x66')]['end']);}break;case _0x3f8e('0x71'):_0x13c657=as['buildExpression']('me',null,_0xd9b06);_0x1d2176[_0x3d56dd](_0x13c657['text'],_0x13c657[_0x3f8e('0x66')][_0x3f8e('0x6a')],_0x13c657[_0x3f8e('0x66')][_0x3f8e('0x1e')]);break;}}else{var _0x13c657=as['buildExpression'](_0x2d61ac,_0xa56151['type'],_0xd9b06);_0x1d2176[_0x3d56dd](_0x13c657[_0x3f8e('0x70')],_0x13c657[_0x3f8e('0x66')]['start'],_0x13c657[_0x3f8e('0x66')]['end']);}}}else{var _0x25c8a5=_(_0xae122e[_0x3f8e('0x39')])[_0x3f8e('0x3a')]()[_0x3f8e('0x2d')](function(_0x100cae){return _[_0x3f8e('0x72')](_0x1ad255,[_0x3f8e('0x2b'),_0x100cae])?_0x100cae:undefined;})[_0x3f8e('0x73')]()['value']();if(!_[_0x3f8e('0x74')](_0x25c8a5)){_0x25c8a5[_0x3f8e('0x32')](function(_0x394ef4){if(_0x394ef4===_0x3f8e('0x75')){_0x249d53[_0x3f8e('0x43')]('i.WhatsappAccountId\x20IN\x20?',[][_0x3f8e('0x76')](_0xae122e[_0x3f8e('0x39')][_0x394ef4]));}else if(_0x394ef4===_0x3f8e('0x77')){var _0x4953b4=JSON[_0x3f8e('0x78')](_0xae122e[_0x3f8e('0x39')][_0x394ef4])[_0x3f8e('0x79')];var _0x31a4a3=JSON[_0x3f8e('0x78')](_0xae122e['query'][_0x394ef4])['$lte'];_0x249d53[_0x3f8e('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4953b4,_0x31a4a3);}else{if(_0xae122e['query'][_0x394ef4]===_0x3f8e('0x7a')){_0x249d53[_0x3f8e('0x43')]('i.'+_0x394ef4+_0x3f8e('0x7b'));}else{_0x249d53[_0x3f8e('0x43')]('i.'+_0x394ef4+_0x3f8e('0x7c'),_0xae122e[_0x3f8e('0x39')][_0x394ef4]);}}});}if(_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x7d')]){if(_0xae122e['query']['read']==0x1){_0x249d53['having'](_0x3f8e('0x7e'));}else{_0x249d53[_0x3f8e('0x60')](_0x3f8e('0x7f'));}}if(_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x80')]){_0xb78474=_[_0x3f8e('0x81')](_0xae122e[_0x3f8e('0x39')]['tag'])?_0xae122e['query'][_0x3f8e('0x80')]:new Array(_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x80')]);_0xb78474[_0x3f8e('0x32')](function(_0x403c6c){_0x50af9c['or'](_0x3f8e('0x6c'),'%,'+_0x403c6c+',%');});}if(_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x82')]){var _0x2faf02=_0xae122e['query'][_0x3f8e('0x82')][_0x3f8e('0x83')]('\x5c','\x5c\x5c')[_0x3f8e('0x83')](/'/g,'\x27\x27');if(qs[_0x3f8e('0x84')](_0x2faf02)){_0x1d2176['or'](_0x3f8e('0x85'),_0x2faf02+'%')['or'](_0x3f8e('0x86'),_0x2faf02+'%');}else{_0x1d2176['or'](_0x3f8e('0x87'),qs[_0x3f8e('0x65')](_0x2faf02))['or'](_0x3f8e('0x88'),_0x2faf02+'%');}}}_0x249d53[_0x3f8e('0x43')](_0x1d2176);_0x249d53[_0x3f8e('0x89')](_0x3f8e('0x8a'));var _0x18b8c4={'type':db[_0x3f8e('0x8b')][_0x3f8e('0x8c')][_0x3f8e('0x8d')],'raw':!![]};var _0x1ecc3b=_0x249d53[_0x3f8e('0x8e')]();_0x1ecc3b[_0x3f8e('0x45')](_0x3f8e('0x8a'));_0x1ecc3b['field'](_0x3f8e('0x8f'),'unreadMessages');if(_0x5e1335['order']){_0x5e1335['order'][_0x3f8e('0x32')](function(_0x116686){var _0x106e91=_0x116686[0x0]===_0x3f8e('0x90')?_0x116686[0x0]:'i.'+_0x116686[0x0];_0x249d53[_0x3f8e('0x42')](_0x106e91,_0x116686[0x1]===_0x3f8e('0x91')?![]:!![]);});}if(!_[_0x3f8e('0x74')](_0xb78474)){_0x249d53[_0x3f8e('0x60')](_0x50af9c);_0x1ecc3b[_0x3f8e('0x43')]('t.id\x20IN\x20?',_0xb78474);}BPromise[_0x3f8e('0x92')]()[_0x3f8e('0x29')](function(){if(!_0x29ac98){if(_0xae122e['query'][_0x3f8e('0x75')]||_0xae122e['query']['journey'])return;_0x1ecc3b[_0x3f8e('0x43')](_0x3f8e('0x93'));_0x249d53[_0x3f8e('0x43')](_0x3f8e('0x93'));return;}if(_0xae122e['user'][_0x3f8e('0x94')]!==_0x3f8e('0x95'))return;return _0xae122e[_0x3f8e('0x96')][_0x3f8e('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4082d6){if(_[_0x3f8e('0x74')](_0x4082d6)){_0x1ecc3b[_0x3f8e('0x43')]('i.WhatsappAccountId\x20IS\x20NULL');_0x249d53[_0x3f8e('0x43')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x1ecc3b[_0x3f8e('0x43')](_0x3f8e('0x98'),_[_0x3f8e('0x2d')](_0x4082d6,'id'));_0x249d53[_0x3f8e('0x43')](_0x3f8e('0x98'),_[_0x3f8e('0x2d')](_0x4082d6,'id'));}});})[_0x3f8e('0x29')](function(){if(_0xae122e[_0x3f8e('0x96')][_0x3f8e('0x94')]==='agent'&&!_0x29ac98&&!_0xae122e['query'][_0x3f8e('0x75')])return[];return db[_0x3f8e('0x99')][_0x3f8e('0x39')](_0x1ecc3b['toString'](),_0x18b8c4);})[_0x3f8e('0x29')](function(_0x3c1ae1){_0x14cfb7['count']=_0x3c1ae1['length'];if(_0x14cfb7[_0x3f8e('0x20')]===0x0)return[];return db[_0x3f8e('0x99')][_0x3f8e('0x39')](_0x3ec5c3[_0x3f8e('0x9a')](),_0x18b8c4)[_0x3f8e('0x29')](function(_0x1da4f7){_0xbf0642=_[_0x3f8e('0x9b')](_0x1da4f7,'id');_0x18b8c4=_[_0x3f8e('0x9c')](_0x18b8c4,{'model':db[_0x3f8e('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xae122e['query'][_0x3f8e('0x3e')]){_0x5e1335[_0x3f8e('0x3f')][_0x3f8e('0x32')](function(_0x376441){_0x249d53[_0x3f8e('0x45')]('i.'+_0x376441);});}else{_0x249d53['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3f8e('0x9d'));_0x249d53[_0x3f8e('0x45')]('a.key',_0x3f8e('0x9e'));_0x249d53['field'](_0x3f8e('0x9f'),_0x3f8e('0xa0'));_0x249d53[_0x3f8e('0x45')]('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',_0x3f8e('0x90'));_0x249d53['field']('i.*');_0x249d53[_0x3f8e('0x45')](_0x3f8e('0xa1'),_0x3f8e('0xa2'));_0x249d53['field'](_0x3f8e('0xa3'),_0x3f8e('0xa4'));_0x249d53[_0x3f8e('0x45')]('c.email',_0x3f8e('0xa5'));_0x249d53[_0x3f8e('0x45')](_0x3f8e('0xa6'),_0x3f8e('0xa7'));_0x249d53[_0x3f8e('0x45')](_0x3f8e('0xa8'),_0x3f8e('0xa9'));_0x249d53[_0x3f8e('0x45')](_0x3f8e('0xaa'),_0x3f8e('0xab'));_0x249d53['field'](_0x3f8e('0xac'),_0x3f8e('0xad'));_0x249d53[_0x3f8e('0x45')](_0x3f8e('0xae'),'Owner.internal');_0x249d53[_0x3f8e('0x45')](_0x3f8e('0xaf'),_0x3f8e('0x2f'));}if(_0x5e1335[_0x3f8e('0x22')])_0x249d53[_0x3f8e('0x22')](_0x5e1335[_0x3f8e('0x22')]);if(_0x5e1335[_0x3f8e('0x21')])_0x249d53[_0x3f8e('0x21')](_0x5e1335[_0x3f8e('0x21')]);return db[_0x3f8e('0x99')][_0x3f8e('0x39')](_0x249d53[_0x3f8e('0x9a')](),_0x18b8c4);})['then'](function(_0x29ea44){_0x279fc4[_0x3f8e('0x43')](_0x3f8e('0xb0'),_[_0x3f8e('0x2d')](_0x29ea44,'id'));return db['sequelize']['query'](_0x279fc4[_0x3f8e('0x9a')](),_0x18b8c4)['then'](function(_0x2b0bf0){var _0x4ce817=_[_0x3f8e('0xb1')](_0x2b0bf0,_0x3f8e('0xb2'));var _0xedcb4e=[];_0x29ea44[_0x3f8e('0x32')](function(_0x22ba30){_0xedcb4e[_0x3f8e('0xb3')](updateWhatsappInteraction(_0x22ba30,_0xbf0642,_0x4ce817));});return BPromise[_0x3f8e('0xb4')](_0xedcb4e);});});})['then'](function(_0x1c957d){_0x14cfb7[_0x3f8e('0xb5')]=_0x1c957d;return _0x14cfb7;})[_0x3f8e('0x29')](respondWithFilteredResult(_0x217a39,_0x5e1335))[_0x3f8e('0x33')](handleError(_0x217a39,null));};exports[_0x3f8e('0xb6')]=function(_0x472e49,_0x207672){var _0x57fe2f={'raw':![],'where':{'id':_0x472e49[_0x3f8e('0xb7')]['id']}},_0x15b0f6={};_0x15b0f6[_0x3f8e('0x3c')]=_[_0x3f8e('0x3a')](db[_0x3f8e('0x35')]['rawAttributes']);_0x15b0f6['query']=_[_0x3f8e('0x3a')](_0x472e49[_0x3f8e('0x39')]);_0x15b0f6[_0x3f8e('0x3b')]=_[_0x3f8e('0x3d')](_0x15b0f6[_0x3f8e('0x3c')],_0x15b0f6[_0x3f8e('0x39')]);_0x57fe2f['attributes']=_[_0x3f8e('0x3d')](_0x15b0f6[_0x3f8e('0x3c')],qs['fields'](_0x472e49['query'][_0x3f8e('0x3e')]));_0x57fe2f[_0x3f8e('0x3f')]=_0x57fe2f['attributes']['length']?_0x57fe2f['attributes']:_0x15b0f6[_0x3f8e('0x3c')];if(_0x472e49['query']['includeAll']){_0x57fe2f[_0x3f8e('0xb8')]=[{'all':!![]}];}_0x57fe2f=_[_0x3f8e('0x9c')]({},_0x57fe2f,_0x472e49[_0x3f8e('0xb9')]);return db[_0x3f8e('0x35')][_0x3f8e('0x5f')](_0x57fe2f)[_0x3f8e('0x29')](handleEntityNotFound(_0x207672,null))[_0x3f8e('0x29')](respondWithResult(_0x207672,null))[_0x3f8e('0x33')](handleError(_0x207672,null));};exports[_0x3f8e('0xba')]=function(_0x3db161,_0x189a2a){return db[_0x3f8e('0x35')]['create'](_0x3db161[_0x3f8e('0x71')],{})[_0x3f8e('0x29')](respondWithResult(_0x189a2a,0xc9))[_0x3f8e('0x33')](handleError(_0x189a2a,null));};exports[_0x3f8e('0x27')]=function(_0x54fd58,_0x1f7ad7){if(_0x54fd58[_0x3f8e('0x71')]['id']){delete _0x54fd58[_0x3f8e('0x71')]['id'];}return db[_0x3f8e('0x35')]['find']({'where':{'id':_0x54fd58[_0x3f8e('0xb7')]['id']}})[_0x3f8e('0x29')](handleEntityNotFound(_0x1f7ad7,null))[_0x3f8e('0x29')](saveUpdates(_0x54fd58[_0x3f8e('0x71')],null))[_0x3f8e('0x29')](respondWithResult(_0x1f7ad7,null))[_0x3f8e('0x33')](handleError(_0x1f7ad7,null));};exports[_0x3f8e('0x28')]=function(_0x3ac5d0,_0x332e8c){return db[_0x3f8e('0x35')][_0x3f8e('0x5f')]({'where':{'id':_0x3ac5d0[_0x3f8e('0xb7')]['id']}})[_0x3f8e('0x29')](handleEntityNotFound(_0x332e8c,null))[_0x3f8e('0x29')](removeEntity(_0x332e8c,null))[_0x3f8e('0x33')](handleError(_0x332e8c,null));};exports[_0x3f8e('0xbb')]=function(_0x57312c,_0x5cd592){return db[_0x3f8e('0x35')][_0x3f8e('0xbb')]()[_0x3f8e('0x29')](respondWithResult(_0x5cd592,null))[_0x3f8e('0x33')](handleError(_0x5cd592,null));};exports[_0x3f8e('0xbc')]=function(_0x1879b6,_0x13e537,_0xb982ae){return db[_0x3f8e('0xbd')]['find']({'where':{'id':_0x1879b6[_0x3f8e('0xb7')]['id']}})[_0x3f8e('0x29')](handleEntityNotFound(_0x13e537,null))[_0x3f8e('0x29')](function(_0x5509fb){if(_0x5509fb){return _0x5509fb[_0x3f8e('0xbc')](_0x1879b6[_0x3f8e('0x71')][_0x3f8e('0xbe')],_['omit'](_0x1879b6[_0x3f8e('0x71')],[_0x3f8e('0xbe'),'id'])||{});}})['then'](respondWithResult(_0x13e537,null))['catch'](handleError(_0x13e537,null));};exports['getMessages']=function(_0x43f69b,_0x577fdf,_0x207a86){var _0x4c5f8b={'raw':![],'where':{}};var _0x4447c9={};var _0x2d9ca6={'count':0x0,'rows':[]};return db[_0x3f8e('0x35')][_0x3f8e('0xbf')]({'where':{'id':_0x43f69b[_0x3f8e('0xb7')]['id']}})[_0x3f8e('0x29')](handleEntityNotFound(_0x577fdf,null))[_0x3f8e('0x29')](function(_0x318023){if(_0x318023){_0x4447c9['model']=_['keys'](db[_0x3f8e('0xbd')][_0x3f8e('0x36')]);_0x4447c9['query']=_[_0x3f8e('0x3a')](_0x43f69b[_0x3f8e('0x39')]);_0x4447c9['filters']=_[_0x3f8e('0x3d')](_0x4447c9['model'],_0x4447c9['query']);_0x4c5f8b[_0x3f8e('0x3f')]=_[_0x3f8e('0x3d')](_0x4447c9[_0x3f8e('0x3c')],qs[_0x3f8e('0x3e')](_0x43f69b[_0x3f8e('0x39')][_0x3f8e('0x3e')]));_0x4c5f8b[_0x3f8e('0x3f')]=_0x4c5f8b['attributes'][_0x3f8e('0x40')]?_0x4c5f8b[_0x3f8e('0x3f')]:_0x4447c9['model'];if(!_0x43f69b[_0x3f8e('0x39')][_0x3f8e('0xc0')](_0x3f8e('0x41'))){_0x4c5f8b[_0x3f8e('0x22')]=qs[_0x3f8e('0x22')](_0x43f69b[_0x3f8e('0x39')][_0x3f8e('0x22')]);_0x4c5f8b[_0x3f8e('0x21')]=qs[_0x3f8e('0x21')](_0x43f69b['query'][_0x3f8e('0x21')]);}_0x4c5f8b[_0x3f8e('0x42')]=qs[_0x3f8e('0xc1')](_0x43f69b[_0x3f8e('0x39')][_0x3f8e('0xc1')]);_0x4c5f8b[_0x3f8e('0x43')]=qs['filters'](_[_0x3f8e('0x44')](_0x43f69b['query'],_0x4447c9[_0x3f8e('0x3b')]));_0x4c5f8b[_0x3f8e('0x43')][_0x3f8e('0xb2')]=_0x318023['id'];if(_0x43f69b['query'][_0x3f8e('0x82')]){_0x4c5f8b[_0x3f8e('0x43')]=_[_0x3f8e('0x9c')](_0x4c5f8b['where'],{'$or':_['map'](_0x4c5f8b[_0x3f8e('0x3f')],function(_0x113ba6){var _0x360f66={};_0x360f66[_0x113ba6]={'$like':'%'+_0x43f69b['query'][_0x3f8e('0x82')]+'%'};return _0x360f66;})});}if(_0x43f69b[_0x3f8e('0x39')][_0x3f8e('0x79')]){var _0x5cf2c4=_0x43f69b['query']['$gte'][_0x3f8e('0x31')](',');var _0x3f0df5={};_0x3f0df5[_0x5cf2c4[0x0]]={'$gte':moment(_0x5cf2c4[0x1])[_0x3f8e('0xc2')](_0x3f8e('0xc3'))};_0x4c5f8b['where']=_['merge'](_0x4c5f8b[_0x3f8e('0x43')],_0x3f0df5);}_0x4c5f8b=_[_0x3f8e('0x9c')]({},_0x4c5f8b,_0x43f69b[_0x3f8e('0xb9')]);return db[_0x3f8e('0xbd')][_0x3f8e('0x20')]({'where':_0x4c5f8b[_0x3f8e('0x43')]})[_0x3f8e('0x29')](function(_0x5cd932){_0x2d9ca6['count']=_0x5cd932;if(_0x43f69b[_0x3f8e('0x39')]['includeAll']){_0x4c5f8b[_0x3f8e('0xb8')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x3f8e('0xc4')](_0x4c5f8b);})[_0x3f8e('0x29')](function(_0x1bdc37){_0x2d9ca6[_0x3f8e('0xb5')]=_0x1bdc37;return _0x2d9ca6;});}})[_0x3f8e('0x29')](respondWithFilteredResult(_0x577fdf,_0x4c5f8b))['catch'](handleError(_0x577fdf,null));};exports['addTags']=function(_0x4cd174,_0x3dca0a,_0xa30b97){return db[_0x3f8e('0x35')]['find']({'where':{'id':_0x4cd174['params']['id']}})[_0x3f8e('0x29')](handleEntityNotFound(_0x3dca0a,null))['then'](function(_0x579cc4){if(_0x579cc4){return _0x579cc4[_0x3f8e('0xc5')](_0x4cd174[_0x3f8e('0x71')][_0x3f8e('0xbe')],_['omit'](_0x4cd174[_0x3f8e('0x71')],[_0x3f8e('0xbe'),'id'])||{})[_0x3f8e('0xc6')](function(){return db[_0x3f8e('0x6b')][_0x3f8e('0xc4')]({'attributes':['id',_0x3f8e('0x2b'),_0x3f8e('0x46')],'where':{'id':_0x4cd174[_0x3f8e('0x71')][_0x3f8e('0xbe')]}});})[_0x3f8e('0x29')](function(_0x39e959){socket[_0x3f8e('0xc7')]('whatsappInteractionTags:save',{'id':Number(_0x4cd174[_0x3f8e('0xb7')]['id']),'tags':_0x39e959||[]});return{'id':Number(_0x4cd174['params']['id']),'tags':_0x39e959||[]};});}})[_0x3f8e('0x29')](respondWithResult(_0x3dca0a,null))['catch'](handleError(_0x3dca0a,null));};exports[_0x3f8e('0xc8')]=function(_0xcd2964,_0x41edca,_0x14db1b){return db[_0x3f8e('0x35')][_0x3f8e('0x5f')]({'where':{'id':_0xcd2964['params']['id']}})[_0x3f8e('0x29')](handleEntityNotFound(_0x41edca,null))[_0x3f8e('0x29')](function(_0x5dc63e){if(_0x5dc63e){return _0x5dc63e[_0x3f8e('0xc8')](_0xcd2964[_0x3f8e('0x39')]['ids']);}})[_0x3f8e('0x29')](respondWithStatusCode(_0x41edca,null))[_0x3f8e('0x33')](handleError(_0x41edca,null));};exports[_0x3f8e('0xc9')]=function(_0x11b5c6,_0x5a56f0){var _0x59f9c2=moment()[_0x3f8e('0xca')]()[_0x3f8e('0x9a')]();var _0x4cf742=path[_0x3f8e('0xcb')](config[_0x3f8e('0xcc')],_0x3f8e('0xcd'),_0x3f8e('0xce'),'tmp');var _0x8f09f=path['join'](config[_0x3f8e('0xcc')],_0x3f8e('0xcd'),_0x3f8e('0xce'),_0x3f8e('0xcf'));var _0x25595b=path[_0x3f8e('0xcb')](_0x4cf742,_0x59f9c2);var _0x531d6c=util[_0x3f8e('0xc2')]('transcript-%d-%s.zip',_0x11b5c6[_0x3f8e('0xb7')]['id'],_0x59f9c2);var _0x2d92e2=path['join'](_0x4cf742,_0x531d6c);var _0x1f4e21=[];_0x1f4e21[_0x3f8e('0xb3')]({'model':db[_0x3f8e('0x6d')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1f4e21['push']({'model':db[_0x3f8e('0xd0')],'as':'Contact','attributes':['id',_0x3f8e('0xd1'),_0x3f8e('0xd2')],'raw':!![]});if(_0x11b5c6[_0x3f8e('0x39')][_0x3f8e('0xcf')]){_0x1f4e21['push']({'model':db[_0x3f8e('0xd3')],'as':_0x3f8e('0xd3'),'raw':!![]});}var _0xbd2502=[{'model':db[_0x3f8e('0xbd')],'as':_0x3f8e('0xd4'),'attributes':['id',_0x3f8e('0x71'),_0x3f8e('0x77'),'direction',_0x3f8e('0xd5'),_0x3f8e('0x7d')],'include':_0x1f4e21}];_0xbd2502[_0x3f8e('0xb3')]({'model':db[_0x3f8e('0xd6')],'as':_0x3f8e('0xd7'),'attributes':['id',_0x3f8e('0x2b')]});_0xbd2502[_0x3f8e('0xb3')]({'model':db['User'],'as':_0x3f8e('0xd8'),'attributes':['id',_0x3f8e('0x2e')]});return db[_0x3f8e('0x35')]['find']({'where':{'id':_0x11b5c6[_0x3f8e('0xb7')]['id']},'include':_0xbd2502})['then'](handleEntityNotFound(_0x5a56f0,null))[_0x3f8e('0x29')](function(_0x24e31f){if(_0x24e31f){var _0x337811=_0x24e31f['get']({'plain':!![]});fs['mkdirSync'](_0x25595b);var _0x23ba79={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x3f8e('0xd9')}},'footer':{'height':_0x3f8e('0xda'),'contents':{'default':util[_0x3f8e('0xc2')](_0x3f8e('0xdb'),util['format']('%s\x20#%d','Whatsapp',_0x337811['id']),moment()[_0x3f8e('0xc2')](_0x3f8e('0xdc'))[_0x3f8e('0x9a')]())}}};var _0x102f33={'channel':_0x3f8e('0xdd'),'account':_0x337811[_0x3f8e('0xd7')][_0x3f8e('0x2b')],'agent':_0x337811[_0x3f8e('0xd8')]?_0x337811[_0x3f8e('0xd8')][_0x3f8e('0x2e')]:_0x3f8e('0xde'),'createdAt':moment(_0x337811[_0x3f8e('0x77')])[_0x3f8e('0xc2')](_0x3f8e('0xc3'))[_0x3f8e('0x9a')](),'closedAt':_0x337811[_0x3f8e('0xdf')]?moment(_0x337811[_0x3f8e('0xe0')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3f8e('0x9a')]():'','disposition':_0x337811[_0x3f8e('0xe1')],'messages':_(_0x337811[_0x3f8e('0xd4')])[_0x3f8e('0x82')]({'secret':![]})[_0x3f8e('0x2d')](function(_0x277b49){if(_0x277b49['Attachment']){var _0x4dc35f=path[_0x3f8e('0xcb')](_0x8f09f,_0x277b49['Attachment'][_0x3f8e('0xe2')]);if(fs[_0x3f8e('0xe3')](_0x4dc35f)){fs['createReadStream'](_0x4dc35f)[_0x3f8e('0xe4')](fs[_0x3f8e('0xe5')](path['join'](_0x25595b,_0x277b49['Attachment'][_0x3f8e('0xe2')])));}}return{'date':moment(_0x277b49[_0x3f8e('0x77')])[_0x3f8e('0xc2')](_0x3f8e('0xc3'))[_0x3f8e('0x9a')](),'sender':_0x277b49['direction']===_0x3f8e('0xe6')?_0x277b49[_0x3f8e('0x6d')]?_0x277b49['User'][_0x3f8e('0x2e')]:_0x3f8e('0xe7'):_0x277b49['Contact'][_0x3f8e('0xd1')]+(_0x277b49[_0x3f8e('0x62')][_0x3f8e('0xd2')]?'\x20'+_0x277b49['Contact'][_0x3f8e('0xd2')]:''),'body':_0x277b49['Attachment']?_0x277b49[_0x3f8e('0xd3')]['basename']:_0x277b49[_0x3f8e('0x71')],'direction':_0x277b49[_0x3f8e('0xe8')]===_0x3f8e('0xe6')?'A':'C','secret':_0x277b49[_0x3f8e('0xd5')],'read':_0x277b49[_0x3f8e('0x7d')],'attachment':_0x277b49[_0x3f8e('0xd3')]};})[_0x3f8e('0x66')]()};return ejs[_0x3f8e('0xe9')](path[_0x3f8e('0xcb')](config['root'],_0x3f8e('0xcd'),_0x3f8e('0xea'),_0x3f8e('0xeb')),{'interaction':_0x102f33})['then'](function(_0x1426ed){return new BPromise(function(_0x597df9,_0x207ae7){pdf[_0x3f8e('0xba')](_0x1426ed,_0x23ba79)['toFile'](path[_0x3f8e('0xcb')](_0x25595b,_0x3f8e('0xec')+_0x337811['id']+'-'+_0x59f9c2+_0x3f8e('0xed')),function(_0x5a01c2,_0x122f73){if(_0x5a01c2)return _0x207ae7(_0x5a01c2);_0x597df9(_0x122f73);});});})[_0x3f8e('0x29')](function(){return new BPromise(function(_0x5b2778,_0x510434){zipdir(_0x25595b,{'saveTo':_0x2d92e2},function(_0x587cdf,_0x33f00b){if(_0x587cdf)return _0x510434(_0x587cdf);return _0x5b2778(_0x33f00b);});})[_0x3f8e('0x29')](function(){return new BPromise(function(_0xa971e4,_0x5c9c4f){rimraf(_0x25595b,function(_0x494505){if(_0x494505)_0x5c9c4f(_0x494505);return _0xa971e4();});});})[_0x3f8e('0x29')](function(){return _0x5a56f0[_0x3f8e('0xc9')](_0x2d92e2,_0x531d6c,function(_0x262f0a){if(_0x262f0a){console[_0x3f8e('0xee')](_0x3f8e('0xef'),_0x262f0a);}else{fs[_0x3f8e('0xf0')](_0x2d92e2);}});});});}else{return _0x5a56f0[_0x3f8e('0x1c')](0xc8);}})[_0x3f8e('0x33')](handleError(_0x5a56f0,null));}; \ No newline at end of file +var _0x6b0c=['some','isEmpty','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','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','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','WhatsappAccountId','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','push','all','rows','params','includeAll','include','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','sort','filters','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','firstName','Attachment','direction','secret','WhatsappAccount','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','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','Messages','basename','existsSync','pipe','createWriteStream','out','System','lastName','renderFile','downloadInteraction.html','.pdf','log','err','unlinkSync','sendStatus','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','defaults','redis','localhost','./whatsappInteraction.socket','register','end','json','offset','limit','set','apply','save','update','then','destroy','status','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','WhatsappInteraction','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','select','field','color','u.id','u.fullname','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body'];(function(_0x1e3604,_0x34fe59){var _0x419cac=function(_0x21ba0a){while(--_0x21ba0a){_0x1e3604['push'](_0x1e3604['shift']());}};_0x419cac(++_0x34fe59);}(_0x6b0c,0x175));var _0xc6b0=function(_0x3e5532,_0x3cca14){_0x3e5532=_0x3e5532-0x0;var _0x45418c=_0x6b0c[_0x3e5532];return _0x45418c;};'use strict';var pdf=require(_0xc6b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc6b0('0x1'));var zipdir=require(_0xc6b0('0x2'));var jsonpatch=require(_0xc6b0('0x3'));var rp=require(_0xc6b0('0x4'));var moment=require(_0xc6b0('0x5'));var BPromise=require(_0xc6b0('0x6'));var Mustache=require(_0xc6b0('0x7'));var util=require(_0xc6b0('0x8'));var path=require(_0xc6b0('0x9'));var sox=require('sox');var csv=require(_0xc6b0('0xa'));var ejs=require(_0xc6b0('0xb'));var fs=require('fs');var _=require(_0xc6b0('0xc'));var squel=require(_0xc6b0('0xd'));var crypto=require(_0xc6b0('0xe'));var jsforce=require(_0xc6b0('0xf'));var deskjs=require(_0xc6b0('0x10'));var toCsv=require(_0xc6b0('0xa'));var querystring=require(_0xc6b0('0x11'));var Papa=require('papaparse');var Redis=require(_0xc6b0('0x12'));var authService=require(_0xc6b0('0x13'));var qs=require(_0xc6b0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6b0('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xc6b0('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc6b0('0x17'))['db'];config['redis']=_[_0xc6b0('0x18')](config[_0xc6b0('0x19')],{'host':_0xc6b0('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc6b0('0x19')]));require(_0xc6b0('0x1b'))[_0xc6b0('0x1c')](socket);function respondWithStatusCode(_0xcf95a3,_0x5e11a0){_0x5e11a0=_0x5e11a0||0xcc;return function(_0x2efd09){if(_0x2efd09){return _0xcf95a3['sendStatus'](_0x5e11a0);}return _0xcf95a3['status'](_0x5e11a0)[_0xc6b0('0x1d')]();};}function respondWithResult(_0x3d20cb,_0x3b5de6){_0x3b5de6=_0x3b5de6||0xc8;return function(_0xde697f){if(_0xde697f){return _0x3d20cb['status'](_0x3b5de6)[_0xc6b0('0x1e')](_0xde697f);}};}function respondWithFilteredResult(_0x2d87b8,_0x32c910){return function(_0x22caa4){if(_0x22caa4){var _0x4e7896=_0x22caa4['count'],_0x1726a2=_0x32c910[_0xc6b0('0x1f')],_0x280b60=_0x32c910['offset']+_0x32c910[_0xc6b0('0x20')],_0x36a74f;if(_0x280b60>=_0x4e7896){_0x280b60=_0x4e7896;_0x36a74f=0xc8;}else{_0x36a74f=0xce;}_0x2d87b8['status'](_0x36a74f);return _0x2d87b8[_0xc6b0('0x21')]('Content-Range',_0x1726a2+'-'+_0x280b60+'/'+_0x4e7896)['json'](_0x22caa4);}return null;};}function patchUpdates(_0x565c55){return function(_0x19bd4a){try{jsonpatch[_0xc6b0('0x22')](_0x19bd4a,_0x565c55,!![]);}catch(_0x2826bb){return BPromise['reject'](_0x2826bb);}return _0x19bd4a[_0xc6b0('0x23')]();};}function saveUpdates(_0x3b6130,_0x41e443){return function(_0x42d180){if(_0x42d180){return _0x42d180[_0xc6b0('0x24')](_0x3b6130)[_0xc6b0('0x25')](function(_0x3bb242){return _0x3bb242;});}return null;};}function removeEntity(_0x3f635a,_0x56543e){return function(_0x1efd92){if(_0x1efd92){return _0x1efd92[_0xc6b0('0x26')]()[_0xc6b0('0x25')](function(){_0x3f635a[_0xc6b0('0x27')](0xcc)[_0xc6b0('0x1d')]();});}};}function handleEntityNotFound(_0x4a99ca,_0x163ac0){return function(_0x1fb9ce){if(!_0x1fb9ce){_0x4a99ca['sendStatus'](0x194);}return _0x1fb9ce;};}function handleError(_0x1c5ec6,_0xe529d8){_0xe529d8=_0xe529d8||0x1f4;return function(_0xf91123){logger['error'](_0xf91123[_0xc6b0('0x28')]);if(_0xf91123['name']){delete _0xf91123[_0xc6b0('0x29')];}_0x1c5ec6[_0xc6b0('0x27')](_0xe529d8)[_0xc6b0('0x2a')](_0xf91123);};}function getInteractionUsers(_0x3d61da,_0xc710a4){return new BPromise(function(_0x4c88a3,_0x1e2616){try{if(_0xc710a4[_0x3d61da['id']]){_0x3d61da[_0xc6b0('0x2b')]=_[_0xc6b0('0x2c')](_0xc710a4[_0x3d61da['id']],function(_0x6aee4a){return{'id':_0x6aee4a['id'],'fullname':_0x6aee4a[_0xc6b0('0x2d')]};});}}catch(_0x5c40f5){_0x1e2616(_0x5c40f5);}_0x4c88a3(_0x3d61da);});}function getInteractionTags(_0x1d277b,_0x297ba9){return new BPromise(function(_0x52f755,_0x59bbac){try{if(_0x1d277b[_0xc6b0('0x2e')]){_0x1d277b[_0xc6b0('0x2f')]=[];_0x1d277b[_0xc6b0('0x2e')][_0xc6b0('0x30')](',')[_0xc6b0('0x31')](function(_0xa2ac65){_0x1d277b[_0xc6b0('0x2f')]['push'](_0x297ba9[_0xa2ac65]);});}delete _0x1d277b[_0xc6b0('0x2e')];}catch(_0x4f9b86){_0x59bbac(_0x4f9b86);}_0x52f755(_0x1d277b);});}function updateWhatsappInteraction(_0xbf9616,_0x2f3201,_0x1cf2af){return new BPromise(function(_0x174f29,_0x5d358d){return getInteractionUsers(_0xbf9616,_0x1cf2af)[_0xc6b0('0x25')](function(_0x50a0bc){return getInteractionTags(_0x50a0bc,_0x2f3201);})['then'](function(_0x2d0ccc){_0x174f29(_0x2d0ccc);})[_0xc6b0('0x32')](function(_0x32cc9d){_0x5d358d(_0x32cc9d);});});}exports[_0xc6b0('0x33')]=function(_0x7a27e8,_0x4912df){var _0x2641c7={},_0x36e587={},_0x5f1f30={'count':0x0,'rows':[]};var _0x15c47d=_['map'](db[_0xc6b0('0x34')][_0xc6b0('0x35')],function(_0x3c0b44){return{'name':_0x3c0b44[_0xc6b0('0x36')],'type':_0x3c0b44['type'][_0xc6b0('0x37')]};});_0x36e587['model']=_[_0xc6b0('0x2c')](_0x15c47d,_0xc6b0('0x29'));_0x36e587[_0xc6b0('0x38')]=_[_0xc6b0('0x39')](_0x7a27e8[_0xc6b0('0x38')]);_0x36e587['filters']=_[_0xc6b0('0x3a')](_0x36e587[_0xc6b0('0x3b')],_0x36e587[_0xc6b0('0x38')]);_0x2641c7[_0xc6b0('0x3c')]=_['intersection'](_0x36e587[_0xc6b0('0x3b')],qs[_0xc6b0('0x3d')](_0x7a27e8[_0xc6b0('0x38')]['fields']));_0x2641c7[_0xc6b0('0x3c')]=_0x2641c7['attributes'][_0xc6b0('0x3e')]?_0x2641c7[_0xc6b0('0x3c')]:_0x36e587[_0xc6b0('0x3b')];if(!_0x7a27e8[_0xc6b0('0x38')][_0xc6b0('0x3f')](_0xc6b0('0x40'))){_0x2641c7[_0xc6b0('0x20')]=qs[_0xc6b0('0x20')](_0x7a27e8[_0xc6b0('0x38')][_0xc6b0('0x20')]);_0x2641c7['offset']=qs[_0xc6b0('0x1f')](_0x7a27e8['query'][_0xc6b0('0x1f')]);}_0x2641c7[_0xc6b0('0x41')]=qs['sort'](_0x7a27e8[_0xc6b0('0x38')]['sort']);_0x2641c7[_0xc6b0('0x42')]=qs['filters'](_[_0xc6b0('0x43')](_0x7a27e8[_0xc6b0('0x38')],_0x36e587['filters']),_0x15c47d);var _0x2799ef=[];var _0x1d9aa9=squel[_0xc6b0('0x44')]()[_0xc6b0('0x45')]('id')[_0xc6b0('0x45')]('name')[_0xc6b0('0x45')](_0xc6b0('0x46'))['from']('tools_tags');var _0xdfa9ef=squel['select']()['field'](_0xc6b0('0x47'))[_0xc6b0('0x45')](_0xc6b0('0x48'))[_0xc6b0('0x45')]('ui.WhatsappInteractionId')['from'](_0xc6b0('0x49'),'ui')['left_join'](_0xc6b0('0x4a'),'u',_0xc6b0('0x4b'));var _0x1b45ff=squel[_0xc6b0('0x44')]()['from'](_0xc6b0('0x4c'),'i')['left_join'](_0xc6b0('0x4d'),'c',_0xc6b0('0x4e'))[_0xc6b0('0x4f')](_0xc6b0('0x4a'),'o',_0xc6b0('0x50'))[_0xc6b0('0x4f')](_0xc6b0('0x51'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xc6b0('0x4f')](_0xc6b0('0x52'),'me',_0xc6b0('0x53'))[_0xc6b0('0x4f')](_0xc6b0('0x54'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xc6b0('0x4f')](_0xc6b0('0x55'),'t',_0xc6b0('0x56'));var _0xc3e4ee=squel[_0xc6b0('0x57')]();var _0x42929f=[];var _0x940b6=squel[_0xc6b0('0x57')]();var _0x19152d;if(_0x7a27e8[_0xc6b0('0x38')][_0xc6b0('0x58')]){_0x19152d=as[_0xc6b0('0x59')](_0x7a27e8[_0xc6b0('0x38')][_0xc6b0('0x58')]);var _0x9a42ff=_0x19152d[_0xc6b0('0x5a')];for(var _0x5dff7e=0x0;_0x5dff7e<_0x19152d['conditions'][_0xc6b0('0x3e')];_0x5dff7e++){var _0x210daf=_0x19152d[_0xc6b0('0x5b')][_0x5dff7e];var _0x57b2d8='i';var _0x10b2b3=_['find'](_0x15c47d,[_0xc6b0('0x29'),_0x210daf[_0xc6b0('0x45')]]);if(!_0x10b2b3){switch(_0x210daf[_0xc6b0('0x45')]){case _0xc6b0('0x5c'):if(_0x210daf[_0xc6b0('0x5d')]==0x1){_0x1b45ff[_0xc6b0('0x5e')]('`'+_0x210daf[_0xc6b0('0x45')]+_0xc6b0('0x5f'));}else{_0x1b45ff[_0xc6b0('0x5e')]('`'+_0x210daf[_0xc6b0('0x45')]+'`\x20>\x200');}break;case _0xc6b0('0x60'):if(_0x210daf[_0xc6b0('0x61')]===_0xc6b0('0x62')){if(_0x210daf[_0xc6b0('0x5d')][_0xc6b0('0x30')]('\x20')[_0xc6b0('0x3e')]>0x1){_0xc3e4ee[_0x9a42ff](_0xc6b0('0x63'),qs['getFullTextValue'](_0x210daf[_0xc6b0('0x5d')]),null);}else{var _0x2207d4='%'+_0x210daf[_0xc6b0('0x5d')]+'%';_0xc3e4ee[_0x9a42ff](_0xc6b0('0x64'),_0x2207d4,_0x2207d4,_0x2207d4);}}else{_0x10b2b3=_[_0xc6b0('0x65')](_0x15c47d,[_0xc6b0('0x29'),_0xc6b0('0x66')]);_0x210daf[_0xc6b0('0x45')]=_0xc6b0('0x66');_0x58807a=as[_0xc6b0('0x67')](_0x57b2d8,_0x10b2b3[_0xc6b0('0x68')],_0x210daf);_0xc3e4ee[_0x9a42ff](_0x58807a[_0xc6b0('0x69')],_0x58807a[_0xc6b0('0x5d')][_0xc6b0('0x6a')],_0x58807a[_0xc6b0('0x5d')]['end']);}break;case _0xc6b0('0x6b'):var _0x3e87de=_0x210daf[_0xc6b0('0x5d')][_0xc6b0('0x30')](',')[_0xc6b0('0x2c')](function(_0x261dab){return Number(_0x261dab);});_0x3e87de['forEach'](function(_0x4724b3){_0x940b6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4724b3+',%');});_0x42929f=_[_0xc6b0('0x6c')](_0x42929f,_0x3e87de);break;case _0xc6b0('0x6d'):if(_0x210daf[_0xc6b0('0x61')]===_0xc6b0('0x62')){_0xc3e4ee[_0x9a42ff](_0xc6b0('0x6e'),'%'+_0x210daf[_0xc6b0('0x5d')]+'%',null);}else{_0x10b2b3=_[_0xc6b0('0x65')](_0x15c47d,[_0xc6b0('0x29'),_0xc6b0('0x6f')]);_0x210daf['field']=_0xc6b0('0x6f');_0x58807a=as[_0xc6b0('0x67')](_0x57b2d8,_0x10b2b3['type'],_0x210daf);_0xc3e4ee[_0x9a42ff](_0x58807a['text'],_0x58807a['value'][_0xc6b0('0x6a')],_0x58807a[_0xc6b0('0x5d')][_0xc6b0('0x1d')]);}break;case _0xc6b0('0x70'):_0x58807a=as[_0xc6b0('0x67')]('me',null,_0x210daf);_0xc3e4ee[_0x9a42ff](_0x58807a[_0xc6b0('0x69')],_0x58807a[_0xc6b0('0x5d')]['start'],_0x58807a[_0xc6b0('0x5d')]['end']);break;}}else{var _0x58807a=as['buildExpression'](_0x57b2d8,_0x10b2b3['type'],_0x210daf);_0xc3e4ee[_0x9a42ff](_0x58807a[_0xc6b0('0x69')],_0x58807a['value'][_0xc6b0('0x6a')],_0x58807a[_0xc6b0('0x5d')][_0xc6b0('0x1d')]);}}}else{var _0x2d9621=_(_0x7a27e8[_0xc6b0('0x38')])['keys']()[_0xc6b0('0x2c')](function(_0x2ec169){return _[_0xc6b0('0x71')](_0x15c47d,[_0xc6b0('0x29'),_0x2ec169])?_0x2ec169:undefined;})['compact']()[_0xc6b0('0x5d')]();if(!_[_0xc6b0('0x72')](_0x2d9621)){_0x2d9621['forEach'](function(_0x27b43f){if(_0x27b43f==='WhatsappAccountId'){_0x1b45ff['where']('i.WhatsappAccountId\x20IN\x20?',[][_0xc6b0('0x73')](_0x7a27e8[_0xc6b0('0x38')][_0x27b43f]));}else if(_0x27b43f===_0xc6b0('0x74')){var _0x3321bd=JSON[_0xc6b0('0x75')](_0x7a27e8[_0xc6b0('0x38')][_0x27b43f])[_0xc6b0('0x76')];var _0x2c42dd=JSON[_0xc6b0('0x75')](_0x7a27e8[_0xc6b0('0x38')][_0x27b43f])['$lte'];_0x1b45ff[_0xc6b0('0x42')](_0xc6b0('0x77'),_0x3321bd,_0x2c42dd);}else{if(_0x7a27e8['query'][_0x27b43f]===_0xc6b0('0x78')){_0x1b45ff[_0xc6b0('0x42')]('i.'+_0x27b43f+_0xc6b0('0x79'));}else{_0x1b45ff[_0xc6b0('0x42')]('i.'+_0x27b43f+_0xc6b0('0x7a'),_0x7a27e8['query'][_0x27b43f]);}}});}if(_0x7a27e8[_0xc6b0('0x38')]['read']){if(_0x7a27e8[_0xc6b0('0x38')][_0xc6b0('0x7b')]==0x1){_0x1b45ff[_0xc6b0('0x5e')](_0xc6b0('0x7c'));}else{_0x1b45ff[_0xc6b0('0x5e')]('`unreadMessages`\x20>\x200');}}if(_0x7a27e8[_0xc6b0('0x38')][_0xc6b0('0x7d')]){_0x42929f=_[_0xc6b0('0x7e')](_0x7a27e8[_0xc6b0('0x38')][_0xc6b0('0x7d')])?_0x7a27e8[_0xc6b0('0x38')]['tag']:new Array(_0x7a27e8[_0xc6b0('0x38')]['tag']);_0x42929f[_0xc6b0('0x31')](function(_0x111a6b){_0x940b6['or'](_0xc6b0('0x7f'),'%,'+_0x111a6b+',%');});}if(_0x7a27e8[_0xc6b0('0x38')][_0xc6b0('0x80')]){var _0x53f97d=_0x7a27e8['query']['filter'][_0xc6b0('0x81')]('\x5c','\x5c\x5c')[_0xc6b0('0x81')](/'/g,'\x27\x27');if(qs[_0xc6b0('0x82')](_0x53f97d)){_0xc3e4ee['or'](_0xc6b0('0x83'),_0x53f97d+'%')['or'](_0xc6b0('0x84'),_0x53f97d+'%');}else{_0xc3e4ee['or'](_0xc6b0('0x85'),qs[_0xc6b0('0x86')](_0x53f97d))['or'](_0xc6b0('0x87'),_0x53f97d+'%');}}}_0x1b45ff[_0xc6b0('0x42')](_0xc3e4ee);_0x1b45ff[_0xc6b0('0x88')](_0xc6b0('0x89'));var _0x582b2b={'type':db[_0xc6b0('0x8a')][_0xc6b0('0x8b')][_0xc6b0('0x8c')],'raw':!![]};var _0x44bde2=_0x1b45ff['clone']();_0x44bde2['field'](_0xc6b0('0x89'));_0x44bde2[_0xc6b0('0x45')](_0xc6b0('0x8d'),_0xc6b0('0x5c'));if(_0x2641c7[_0xc6b0('0x41')]){_0x2641c7[_0xc6b0('0x41')][_0xc6b0('0x31')](function(_0x2c1950){var _0xc60a64=_0x2c1950[0x0]===_0xc6b0('0x8e')?_0x2c1950[0x0]:'i.'+_0x2c1950[0x0];_0x1b45ff[_0xc6b0('0x41')](_0xc60a64,_0x2c1950[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc6b0('0x72')](_0x42929f)){_0x1b45ff[_0xc6b0('0x5e')](_0x940b6);_0x44bde2[_0xc6b0('0x42')](_0xc6b0('0x8f'),_0x42929f);}BPromise[_0xc6b0('0x90')]()['then'](function(){if(!_0x19152d){if(_0x7a27e8[_0xc6b0('0x38')][_0xc6b0('0x91')]||_0x7a27e8[_0xc6b0('0x38')][_0xc6b0('0x92')])return;_0x44bde2[_0xc6b0('0x42')](_0xc6b0('0x93'));_0x1b45ff[_0xc6b0('0x42')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x7a27e8[_0xc6b0('0x94')][_0xc6b0('0x95')]!==_0xc6b0('0x96'))return;return _0x7a27e8[_0xc6b0('0x94')][_0xc6b0('0x97')]({'attributes':['id'],'raw':!![]})[_0xc6b0('0x25')](function(_0x2b6458){if(_[_0xc6b0('0x72')](_0x2b6458)){_0x44bde2[_0xc6b0('0x42')](_0xc6b0('0x98'));_0x1b45ff[_0xc6b0('0x42')](_0xc6b0('0x98'));}else{_0x44bde2[_0xc6b0('0x42')]('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x2b6458,'id'));_0x1b45ff['where']('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x2b6458,'id'));}});})[_0xc6b0('0x25')](function(){if(_0x7a27e8['user'][_0xc6b0('0x95')]==='agent'&&!_0x19152d&&!_0x7a27e8[_0xc6b0('0x38')]['WhatsappAccountId'])return[];return db[_0xc6b0('0x99')][_0xc6b0('0x38')](_0x44bde2[_0xc6b0('0x9a')](),_0x582b2b);})[_0xc6b0('0x25')](function(_0x4e1afb){_0x5f1f30[_0xc6b0('0x9b')]=_0x4e1afb[_0xc6b0('0x3e')];if(_0x5f1f30[_0xc6b0('0x9b')]===0x0)return[];return db[_0xc6b0('0x99')]['query'](_0x1d9aa9[_0xc6b0('0x9a')](),_0x582b2b)[_0xc6b0('0x25')](function(_0x99aa4b){_0x2799ef=_[_0xc6b0('0x9c')](_0x99aa4b,'id');_0x582b2b=_[_0xc6b0('0x9d')](_0x582b2b,{'model':db[_0xc6b0('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7a27e8[_0xc6b0('0x38')][_0xc6b0('0x3d')]){_0x2641c7['attributes']['forEach'](function(_0x377347){_0x1b45ff[_0xc6b0('0x45')]('i.'+_0x377347);});}else{_0x1b45ff[_0xc6b0('0x45')](_0xc6b0('0x8d'),_0xc6b0('0x5c'));_0x1b45ff[_0xc6b0('0x45')](_0xc6b0('0x9e'),_0xc6b0('0x9f'));_0x1b45ff[_0xc6b0('0x45')](_0xc6b0('0xa0'),_0xc6b0('0xa1'));_0x1b45ff[_0xc6b0('0x45')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x1b45ff['field'](_0xc6b0('0xa2'));_0x1b45ff[_0xc6b0('0x45')](_0xc6b0('0xa3'),'Contact.firstName');_0x1b45ff[_0xc6b0('0x45')](_0xc6b0('0xa4'),_0xc6b0('0xa5'));_0x1b45ff[_0xc6b0('0x45')](_0xc6b0('0xa6'),'Contact.email');_0x1b45ff[_0xc6b0('0x45')](_0xc6b0('0xa7'),_0xc6b0('0xa8'));_0x1b45ff[_0xc6b0('0x45')](_0xc6b0('0xa9'),_0xc6b0('0xaa'));_0x1b45ff['field']('c.fax',_0xc6b0('0xab'));_0x1b45ff[_0xc6b0('0x45')]('o.fullname',_0xc6b0('0xac'));_0x1b45ff['field'](_0xc6b0('0xad'),_0xc6b0('0xae'));_0x1b45ff[_0xc6b0('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc6b0('0x2e'));}if(_0x2641c7[_0xc6b0('0x20')])_0x1b45ff[_0xc6b0('0x20')](_0x2641c7[_0xc6b0('0x20')]);if(_0x2641c7[_0xc6b0('0x1f')])_0x1b45ff['offset'](_0x2641c7[_0xc6b0('0x1f')]);return db['sequelize'][_0xc6b0('0x38')](_0x1b45ff['toString'](),_0x582b2b);})[_0xc6b0('0x25')](function(_0x1e4ccb){_0xdfa9ef[_0xc6b0('0x42')](_0xc6b0('0xaf'),_[_0xc6b0('0x2c')](_0x1e4ccb,'id'));return db[_0xc6b0('0x99')]['query'](_0xdfa9ef[_0xc6b0('0x9a')](),_0x582b2b)[_0xc6b0('0x25')](function(_0x230083){var _0x751600=_[_0xc6b0('0xb0')](_0x230083,'WhatsappInteractionId');var _0x3bdbb7=[];_0x1e4ccb[_0xc6b0('0x31')](function(_0x4f8943){_0x3bdbb7[_0xc6b0('0xb1')](updateWhatsappInteraction(_0x4f8943,_0x2799ef,_0x751600));});return BPromise[_0xc6b0('0xb2')](_0x3bdbb7);});});})[_0xc6b0('0x25')](function(_0xedc0b0){_0x5f1f30[_0xc6b0('0xb3')]=_0xedc0b0;return _0x5f1f30;})[_0xc6b0('0x25')](respondWithFilteredResult(_0x4912df,_0x2641c7))[_0xc6b0('0x32')](handleError(_0x4912df,null));};exports['show']=function(_0xfa3704,_0x3a832e){var _0x452128={'raw':![],'where':{'id':_0xfa3704[_0xc6b0('0xb4')]['id']}},_0x144e72={};_0x144e72[_0xc6b0('0x3b')]=_[_0xc6b0('0x39')](db[_0xc6b0('0x34')][_0xc6b0('0x35')]);_0x144e72[_0xc6b0('0x38')]=_[_0xc6b0('0x39')](_0xfa3704['query']);_0x144e72['filters']=_[_0xc6b0('0x3a')](_0x144e72['model'],_0x144e72[_0xc6b0('0x38')]);_0x452128[_0xc6b0('0x3c')]=_['intersection'](_0x144e72[_0xc6b0('0x3b')],qs[_0xc6b0('0x3d')](_0xfa3704['query']['fields']));_0x452128[_0xc6b0('0x3c')]=_0x452128['attributes']['length']?_0x452128[_0xc6b0('0x3c')]:_0x144e72[_0xc6b0('0x3b')];if(_0xfa3704[_0xc6b0('0x38')][_0xc6b0('0xb5')]){_0x452128[_0xc6b0('0xb6')]=[{'all':!![]}];}_0x452128=_['merge']({},_0x452128,_0xfa3704['options']);return db[_0xc6b0('0x34')]['find'](_0x452128)[_0xc6b0('0x25')](handleEntityNotFound(_0x3a832e,null))[_0xc6b0('0x25')](respondWithResult(_0x3a832e,null))[_0xc6b0('0x32')](handleError(_0x3a832e,null));};exports[_0xc6b0('0xb7')]=function(_0x3ad2c8,_0x23ac7d){return db[_0xc6b0('0x34')][_0xc6b0('0xb7')](_0x3ad2c8['body'],{})[_0xc6b0('0x25')](respondWithResult(_0x23ac7d,0xc9))[_0xc6b0('0x32')](handleError(_0x23ac7d,null));};exports[_0xc6b0('0x24')]=function(_0x3ad90f,_0x20e300){if(_0x3ad90f['body']['id']){delete _0x3ad90f[_0xc6b0('0x70')]['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x3ad90f['params']['id']}})[_0xc6b0('0x25')](handleEntityNotFound(_0x20e300,null))[_0xc6b0('0x25')](saveUpdates(_0x3ad90f[_0xc6b0('0x70')],null))['then'](respondWithResult(_0x20e300,null))[_0xc6b0('0x32')](handleError(_0x20e300,null));};exports[_0xc6b0('0x26')]=function(_0x56733a,_0x11359f){return db[_0xc6b0('0x34')][_0xc6b0('0x65')]({'where':{'id':_0x56733a[_0xc6b0('0xb4')]['id']}})[_0xc6b0('0x25')](handleEntityNotFound(_0x11359f,null))[_0xc6b0('0x25')](removeEntity(_0x11359f,null))[_0xc6b0('0x32')](handleError(_0x11359f,null));};exports['describe']=function(_0x4ed2ca,_0x92f780){return db['WhatsappInteraction'][_0xc6b0('0xb8')]()[_0xc6b0('0x25')](respondWithResult(_0x92f780,null))[_0xc6b0('0x32')](handleError(_0x92f780,null));};exports[_0xc6b0('0xb9')]=function(_0x53c519,_0x4bbaf8,_0x117d1b){return db[_0xc6b0('0xba')][_0xc6b0('0x65')]({'where':{'id':_0x53c519[_0xc6b0('0xb4')]['id']}})[_0xc6b0('0x25')](handleEntityNotFound(_0x4bbaf8,null))['then'](function(_0x105799){if(_0x105799){return _0x105799[_0xc6b0('0xb9')](_0x53c519[_0xc6b0('0x70')][_0xc6b0('0xbb')],_[_0xc6b0('0xbc')](_0x53c519['body'],['ids','id'])||{});}})[_0xc6b0('0x25')](respondWithResult(_0x4bbaf8,null))[_0xc6b0('0x32')](handleError(_0x4bbaf8,null));};exports[_0xc6b0('0xbd')]=function(_0x2faf10,_0x4f7c57,_0x354a2e){var _0x1101ff={'raw':![],'where':{}};var _0xc8e193={};var _0x31c780={'count':0x0,'rows':[]};return db[_0xc6b0('0x34')][_0xc6b0('0xbe')]({'where':{'id':_0x2faf10['params']['id']}})[_0xc6b0('0x25')](handleEntityNotFound(_0x4f7c57,null))[_0xc6b0('0x25')](function(_0x2808c4){if(_0x2808c4){_0xc8e193[_0xc6b0('0x3b')]=_[_0xc6b0('0x39')](db[_0xc6b0('0xba')][_0xc6b0('0x35')]);_0xc8e193[_0xc6b0('0x38')]=_[_0xc6b0('0x39')](_0x2faf10['query']);_0xc8e193['filters']=_[_0xc6b0('0x3a')](_0xc8e193[_0xc6b0('0x3b')],_0xc8e193[_0xc6b0('0x38')]);_0x1101ff[_0xc6b0('0x3c')]=_['intersection'](_0xc8e193[_0xc6b0('0x3b')],qs[_0xc6b0('0x3d')](_0x2faf10[_0xc6b0('0x38')]['fields']));_0x1101ff[_0xc6b0('0x3c')]=_0x1101ff[_0xc6b0('0x3c')][_0xc6b0('0x3e')]?_0x1101ff[_0xc6b0('0x3c')]:_0xc8e193[_0xc6b0('0x3b')];if(!_0x2faf10[_0xc6b0('0x38')][_0xc6b0('0x3f')](_0xc6b0('0x40'))){_0x1101ff[_0xc6b0('0x20')]=qs[_0xc6b0('0x20')](_0x2faf10[_0xc6b0('0x38')]['limit']);_0x1101ff[_0xc6b0('0x1f')]=qs[_0xc6b0('0x1f')](_0x2faf10[_0xc6b0('0x38')][_0xc6b0('0x1f')]);}_0x1101ff[_0xc6b0('0x41')]=qs['sort'](_0x2faf10[_0xc6b0('0x38')][_0xc6b0('0xbf')]);_0x1101ff['where']=qs[_0xc6b0('0xc0')](_['pick'](_0x2faf10['query'],_0xc8e193[_0xc6b0('0xc0')]));_0x1101ff[_0xc6b0('0x42')]['WhatsappInteractionId']=_0x2808c4['id'];if(_0x2faf10[_0xc6b0('0x38')][_0xc6b0('0x80')]){_0x1101ff[_0xc6b0('0x42')]=_[_0xc6b0('0x9d')](_0x1101ff[_0xc6b0('0x42')],{'$or':_[_0xc6b0('0x2c')](_0x1101ff['attributes'],function(_0x60e2b8){var _0x2ee358={};_0x2ee358[_0x60e2b8]={'$like':'%'+_0x2faf10[_0xc6b0('0x38')][_0xc6b0('0x80')]+'%'};return _0x2ee358;})});}if(_0x2faf10[_0xc6b0('0x38')][_0xc6b0('0x76')]){var _0x5f198c=_0x2faf10['query'][_0xc6b0('0x76')][_0xc6b0('0x30')](',');var _0x22e7cc={};_0x22e7cc[_0x5f198c[0x0]]={'$gte':moment(_0x5f198c[0x1])[_0xc6b0('0xc1')](_0xc6b0('0xc2'))};_0x1101ff[_0xc6b0('0x42')]=_['merge'](_0x1101ff[_0xc6b0('0x42')],_0x22e7cc);}_0x1101ff=_[_0xc6b0('0x9d')]({},_0x1101ff,_0x2faf10['options']);return db[_0xc6b0('0xba')][_0xc6b0('0x9b')]({'where':_0x1101ff[_0xc6b0('0x42')]})[_0xc6b0('0x25')](function(_0x272090){_0x31c780['count']=_0x272090;if(_0x2faf10[_0xc6b0('0x38')][_0xc6b0('0xb5')]){_0x1101ff[_0xc6b0('0xb6')]=[{'all':!![]}];}return db[_0xc6b0('0xba')][_0xc6b0('0xc3')](_0x1101ff);})[_0xc6b0('0x25')](function(_0x3a8fa4){_0x31c780[_0xc6b0('0xb3')]=_0x3a8fa4;return _0x31c780;});}})['then'](respondWithFilteredResult(_0x4f7c57,_0x1101ff))[_0xc6b0('0x32')](handleError(_0x4f7c57,null));};exports[_0xc6b0('0xc4')]=function(_0x2aee8b,_0x2b6050,_0xd1df5e){return db['WhatsappInteraction'][_0xc6b0('0x65')]({'where':{'id':_0x2aee8b['params']['id']}})[_0xc6b0('0x25')](handleEntityNotFound(_0x2b6050,null))['then'](function(_0x356a88){if(_0x356a88){return _0x356a88[_0xc6b0('0xc5')](_0x2aee8b[_0xc6b0('0x70')][_0xc6b0('0xbb')],_[_0xc6b0('0xbc')](_0x2aee8b[_0xc6b0('0x70')],[_0xc6b0('0xbb'),'id'])||{})['spread'](function(){return db[_0xc6b0('0x6b')][_0xc6b0('0xc3')]({'attributes':['id',_0xc6b0('0x29'),'color'],'where':{'id':_0x2aee8b[_0xc6b0('0x70')][_0xc6b0('0xbb')]}});})['then'](function(_0x5957ae){socket[_0xc6b0('0xc6')](_0xc6b0('0xc7'),{'id':Number(_0x2aee8b[_0xc6b0('0xb4')]['id']),'tags':_0x5957ae||[]});return{'id':Number(_0x2aee8b[_0xc6b0('0xb4')]['id']),'tags':_0x5957ae||[]};});}})['then'](respondWithResult(_0x2b6050,null))[_0xc6b0('0x32')](handleError(_0x2b6050,null));};exports[_0xc6b0('0xc8')]=function(_0x67b390,_0x2fe1aa,_0x341e07){return db[_0xc6b0('0x34')][_0xc6b0('0x65')]({'where':{'id':_0x67b390[_0xc6b0('0xb4')]['id']}})['then'](handleEntityNotFound(_0x2fe1aa,null))['then'](function(_0x320dda){if(_0x320dda){return _0x320dda[_0xc6b0('0xc8')](_0x67b390['query'][_0xc6b0('0xbb')]);}})[_0xc6b0('0x25')](respondWithStatusCode(_0x2fe1aa,null))[_0xc6b0('0x32')](handleError(_0x2fe1aa,null));};exports[_0xc6b0('0xc9')]=function(_0x3bf43e,_0x15c9d1){var _0x4751f3=moment()[_0xc6b0('0xca')]()[_0xc6b0('0x9a')]();var _0x216e70=path[_0xc6b0('0xcb')](config[_0xc6b0('0xcc')],'server',_0xc6b0('0xcd'),_0xc6b0('0xce'));var _0x45a2f5=path[_0xc6b0('0xcb')](config[_0xc6b0('0xcc')],_0xc6b0('0xcf'),'files',_0xc6b0('0xd0'));var _0x120441=path[_0xc6b0('0xcb')](_0x216e70,_0x4751f3);var _0x2c4d62=util[_0xc6b0('0xc1')](_0xc6b0('0xd1'),_0x3bf43e[_0xc6b0('0xb4')]['id'],_0x4751f3);var _0x3f486b=path[_0xc6b0('0xcb')](_0x216e70,_0x2c4d62);var _0x6a373a=[];_0x6a373a[_0xc6b0('0xb1')]({'model':db[_0xc6b0('0x6d')],'as':_0xc6b0('0x6d'),'attributes':['id',_0xc6b0('0x2d')],'raw':!![]});_0x6a373a['push']({'model':db['CmContact'],'as':_0xc6b0('0x60'),'attributes':['id',_0xc6b0('0xd2'),'lastName'],'raw':!![]});if(_0x3bf43e['query']['attachments']){_0x6a373a[_0xc6b0('0xb1')]({'model':db[_0xc6b0('0xd3')],'as':_0xc6b0('0xd3'),'raw':!![]});}var _0x5ef305=[{'model':db[_0xc6b0('0xba')],'as':'Messages','attributes':['id',_0xc6b0('0x70'),'createdAt',_0xc6b0('0xd4'),_0xc6b0('0xd5'),_0xc6b0('0x7b')],'include':_0x6a373a}];_0x5ef305[_0xc6b0('0xb1')]({'model':db[_0xc6b0('0xd6')],'as':_0xc6b0('0xd7'),'attributes':['id',_0xc6b0('0x29')]});_0x5ef305[_0xc6b0('0xb1')]({'model':db['User'],'as':'Owner','attributes':['id',_0xc6b0('0x2d')]});return db[_0xc6b0('0x34')][_0xc6b0('0x65')]({'where':{'id':_0x3bf43e[_0xc6b0('0xb4')]['id']},'include':_0x5ef305})[_0xc6b0('0x25')](handleEntityNotFound(_0x15c9d1,null))['then'](function(_0x54e435){if(_0x54e435){var _0x3efd27=_0x54e435[_0xc6b0('0xd8')]({'plain':!![]});fs['mkdirSync'](_0x120441);var _0x1e0407={'format':'A4','border':_0xc6b0('0xd9'),'header':{'height':'40px','contents':{'first':_0xc6b0('0xda')}},'footer':{'height':_0xc6b0('0xdb'),'contents':{'default':util[_0xc6b0('0xc1')](_0xc6b0('0xdc'),util[_0xc6b0('0xc1')]('%s\x20#%d',_0xc6b0('0xdd'),_0x3efd27['id']),moment()[_0xc6b0('0xc1')](_0xc6b0('0xde'))['toString']())}}};var _0x3c42f8={'channel':_0xc6b0('0xdd'),'account':_0x3efd27[_0xc6b0('0xd7')][_0xc6b0('0x29')],'agent':_0x3efd27[_0xc6b0('0xdf')]?_0x3efd27[_0xc6b0('0xdf')]['fullname']:_0xc6b0('0xe0'),'createdAt':moment(_0x3efd27[_0xc6b0('0x74')])[_0xc6b0('0xc1')](_0xc6b0('0xc2'))[_0xc6b0('0x9a')](),'closedAt':_0x3efd27[_0xc6b0('0xe1')]?moment(_0x3efd27[_0xc6b0('0xe2')])[_0xc6b0('0xc1')](_0xc6b0('0xc2'))[_0xc6b0('0x9a')]():'','disposition':_0x3efd27[_0xc6b0('0xe3')],'messages':_(_0x3efd27[_0xc6b0('0xe4')])[_0xc6b0('0x80')]({'secret':![]})[_0xc6b0('0x2c')](function(_0x48af91){if(_0x48af91[_0xc6b0('0xd3')]){var _0x3b1d21=path[_0xc6b0('0xcb')](_0x45a2f5,_0x48af91[_0xc6b0('0xd3')][_0xc6b0('0xe5')]);if(fs[_0xc6b0('0xe6')](_0x3b1d21)){fs['createReadStream'](_0x3b1d21)[_0xc6b0('0xe7')](fs[_0xc6b0('0xe8')](path[_0xc6b0('0xcb')](_0x120441,_0x48af91[_0xc6b0('0xd3')][_0xc6b0('0xe5')])));}}return{'date':moment(_0x48af91[_0xc6b0('0x74')])[_0xc6b0('0xc1')](_0xc6b0('0xc2'))[_0xc6b0('0x9a')](),'sender':_0x48af91[_0xc6b0('0xd4')]===_0xc6b0('0xe9')?_0x48af91[_0xc6b0('0x6d')]?_0x48af91[_0xc6b0('0x6d')][_0xc6b0('0x2d')]:_0xc6b0('0xea'):_0x48af91[_0xc6b0('0x60')]['firstName']+(_0x48af91[_0xc6b0('0x60')]['lastName']?'\x20'+_0x48af91[_0xc6b0('0x60')][_0xc6b0('0xeb')]:''),'body':_0x48af91[_0xc6b0('0xd3')]?_0x48af91['Attachment'][_0xc6b0('0xe5')]:_0x48af91[_0xc6b0('0x70')],'direction':_0x48af91[_0xc6b0('0xd4')]===_0xc6b0('0xe9')?'A':'C','secret':_0x48af91['secret'],'read':_0x48af91[_0xc6b0('0x7b')],'attachment':_0x48af91[_0xc6b0('0xd3')]};})[_0xc6b0('0x5d')]()};return ejs[_0xc6b0('0xec')](path[_0xc6b0('0xcb')](config['root'],_0xc6b0('0xcf'),'views',_0xc6b0('0xed')),{'interaction':_0x3c42f8})[_0xc6b0('0x25')](function(_0x13aa42){return new BPromise(function(_0x10969f,_0x3854e5){pdf[_0xc6b0('0xb7')](_0x13aa42,_0x1e0407)['toFile'](path['join'](_0x120441,'transcript-'+_0x3efd27['id']+'-'+_0x4751f3+_0xc6b0('0xee')),function(_0x2c75ac,_0x512f8b){if(_0x2c75ac)return _0x3854e5(_0x2c75ac);_0x10969f(_0x512f8b);});});})[_0xc6b0('0x25')](function(){return new BPromise(function(_0x31b322,_0x331cd0){zipdir(_0x120441,{'saveTo':_0x3f486b},function(_0xc65131,_0x27fe65){if(_0xc65131)return _0x331cd0(_0xc65131);return _0x31b322(_0x27fe65);});})[_0xc6b0('0x25')](function(){return new BPromise(function(_0x3a8b19,_0xd8feef){rimraf(_0x120441,function(_0xb8b4de){if(_0xb8b4de)_0xd8feef(_0xb8b4de);return _0x3a8b19();});});})[_0xc6b0('0x25')](function(){return _0x15c9d1[_0xc6b0('0xc9')](_0x3f486b,_0x2c4d62,function(_0x2b6632){if(_0x2b6632){console[_0xc6b0('0xef')](_0xc6b0('0xf0'),_0x2b6632);}else{fs[_0xc6b0('0xf1')](_0x3f486b);}});});});}else{return _0x15c9d1[_0xc6b0('0xf2')](0xc8);}})['catch'](handleError(_0x15c9d1,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d7042a5..429eea4 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 _0xac69=['events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xac69,0xcc));var _0x9ac6=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xac69[_0x23e7c1];return _0x1add43;};'use strict';var EventEmitter=require(_0x9ac6('0x0'));var WhatsappInteraction=require(_0x9ac6('0x1'))['db'][_0x9ac6('0x2')];var WhatsappMessage=require(_0x9ac6('0x1'))['db'][_0x9ac6('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9ac6('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9ac6('0x5'),'afterDestroy':_0x9ac6('0x6')};function emitEvent(_0x55a675){return function(_0x3e9fd7,_0x207789,_0x4eda2f){_0x3e9fd7[_0x9ac6('0x7')]({'attributes':['id'],'raw':!![]})[_0x9ac6('0x8')](function(_0x4ed153){_0x3e9fd7[_0x9ac6('0x9')]('Users',_0x4ed153[_0x9ac6('0xa')](function(_0x4a1c44){return{'id':_0x4a1c44['id']};}));return WhatsappMessage[_0x9ac6('0xb')]({'where':{'WhatsappInteractionId':_0x3e9fd7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x297a91){_0x3e9fd7[_0x9ac6('0x9')](_0x9ac6('0xc'),_0x297a91['length']);WhatsappInteractionEvents[_0x9ac6('0xd')](_0x55a675+':'+_0x3e9fd7['id'],_0x3e9fd7);WhatsappInteractionEvents[_0x9ac6('0xd')](_0x55a675,_0x3e9fd7);_0x4eda2f(null);})[_0x9ac6('0xe')](_0x4eda2f(null));};}for(var e in events){if(events[_0x9ac6('0xf')](e)){var event=events[e];WhatsappInteraction[_0x9ac6('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xf6db=['hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch'];(function(_0x25e2bc,_0x27d1ef){var _0x5152d3=function(_0x354708){while(--_0x354708){_0x25e2bc['push'](_0x25e2bc['shift']());}};_0x5152d3(++_0x27d1ef);}(_0xf6db,0xec));var _0xbf6d=function(_0x448422,_0x362248){_0x448422=_0x448422-0x0;var _0xcc0afd=_0xf6db[_0x448422];return _0xcc0afd;};'use strict';var EventEmitter=require(_0xbf6d('0x0'));var WhatsappInteraction=require(_0xbf6d('0x1'))['db'][_0xbf6d('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbf6d('0x3')](0x0);var events={'afterCreate':_0xbf6d('0x4'),'afterUpdate':_0xbf6d('0x5'),'afterDestroy':_0xbf6d('0x6')};function emitEvent(_0x6eb9ed){return function(_0x5c1fea,_0x428a89,_0x142103){_0x5c1fea[_0xbf6d('0x7')]({'attributes':['id'],'raw':!![]})[_0xbf6d('0x8')](function(_0x5140dd){_0x5c1fea[_0xbf6d('0x9')](_0xbf6d('0xa'),_0x5140dd[_0xbf6d('0xb')](function(_0x239722){return{'id':_0x239722['id']};}));return WhatsappMessage[_0xbf6d('0xc')]({'where':{'WhatsappInteractionId':_0x5c1fea['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbf6d('0x8')](function(_0xe7c6a6){_0x5c1fea[_0xbf6d('0x9')](_0xbf6d('0xd'),_0xe7c6a6['length']);WhatsappInteractionEvents[_0xbf6d('0xe')](_0x6eb9ed+':'+_0x5c1fea['id'],_0x5c1fea);WhatsappInteractionEvents[_0xbf6d('0xe')](_0x6eb9ed,_0x5c1fea);_0x142103(null);})[_0xbf6d('0xf')](_0x142103(null));};}for(var e in events){if(events[_0xbf6d('0x10')](e)){var event=events[e];WhatsappInteraction[_0xbf6d('0x11')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 6f21999..2e41c74 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 _0xead0=['closed','closedAt','format','lodash','../../config/logger','api','request-promise','path','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed'];(function(_0x150fe7,_0x114149){var _0x56114c=function(_0x5d0b06){while(--_0x5d0b06){_0x150fe7['push'](_0x150fe7['shift']());}};_0x56114c(++_0x114149);}(_0xead0,0x73));var _0x0ead=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0xead0[_0x2ca2d0];return _0x521c23;};'use strict';var _=require(_0x0ead('0x0'));var util=require('util');var logger=require(_0x0ead('0x1'))(_0x0ead('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0ead('0x3'));var fs=require('fs');var path=require(_0x0ead('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ead('0x5'));module[_0x0ead('0x6')]=function(_0x381661,_0x565a32){return _0x381661[_0x0ead('0x7')](_0x0ead('0x8'),attributes,{'tableName':_0x0ead('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e7725,_0x39842b,_0x53e61e){if(_0x1e7725[_0x0ead('0xa')](_0x0ead('0xb'))){_0x1e7725[_0x0ead('0xc')]=moment()[_0x0ead('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x53e61e(null,_0x1e7725);}}});}; \ No newline at end of file +var _0xafcd=['whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction'];(function(_0x90ca61,_0x3db651){var _0x27a394=function(_0x37c738){while(--_0x37c738){_0x90ca61['push'](_0x90ca61['shift']());}};_0x27a394(++_0x3db651);}(_0xafcd,0xd2));var _0xdafc=function(_0x4d316c,_0xfee14d){_0x4d316c=_0x4d316c-0x0;var _0x59a7a0=_0xafcd[_0x4d316c];return _0x59a7a0;};'use strict';var _=require(_0xdafc('0x0'));var util=require(_0xdafc('0x1'));var logger=require(_0xdafc('0x2'))(_0xdafc('0x3'));var moment=require('moment');var BPromise=require(_0xdafc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdafc('0x5'));var rimraf=require(_0xdafc('0x6'));var config=require(_0xdafc('0x7'));var attributes=require(_0xdafc('0x8'));module[_0xdafc('0x9')]=function(_0x1aa091,_0x3ac354){return _0x1aa091['define'](_0xdafc('0xa'),attributes,{'tableName':_0xdafc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30135b,_0x4d963f,_0x12fe5f){if(_0x30135b[_0xdafc('0xc')](_0xdafc('0xd'))){_0x30135b[_0xdafc('0xe')]=moment()[_0xdafc('0xf')](_0xdafc('0x10'));}_0x12fe5f(null,_0x30135b);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index f22f1dc..53e679f 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 _0xa281=['debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','code','WhatsappInteraction,\x20%s,\x20%s','error','message','result','update','body','options','where','attributes','UpdateWhatsappInteraction','catch','WhatsappInteraction','addTags','ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent'];(function(_0x469da2,_0xf6297e){var _0x1573b8=function(_0x27190f){while(--_0x27190f){_0x469da2['push'](_0x469da2['shift']());}};_0x1573b8(++_0xf6297e);}(_0xa281,0x186));var _0x1a28=function(_0x4fc11f,_0x165b8a){_0x4fc11f=_0x4fc11f-0x0;var _0x30380e=_0xa281[_0x4fc11f];return _0x30380e;};'use strict';var _=require(_0x1a28('0x0'));var util=require(_0x1a28('0x1'));var moment=require(_0x1a28('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a28('0x3'));var db=require(_0x1a28('0x4'))['db'];var utils=require(_0x1a28('0x5'));var logger=require(_0x1a28('0x6'))(_0x1a28('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1a28('0x8')]({'port':0x232a});config[_0x1a28('0x9')]=_[_0x1a28('0xa')](config['redis'],{'host':_0x1a28('0xb'),'port':0x18eb});var socket=require(_0x1a28('0xc'))(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x642c99,_0x3001e6,_0x56050d){return new BPromise(function(_0x1179ca,_0x3ca233){return client[_0x1a28('0xd')](_0x642c99,_0x56050d)[_0x1a28('0xe')](function(_0x1282b8){logger[_0x1a28('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x3001e6,_0x1a28('0x10'));logger[_0x1a28('0x11')](_0x1a28('0x12'),_0x3001e6,_0x1a28('0x10'),JSON[_0x1a28('0x13')](_0x1282b8));if(_0x1282b8['error']){if(_0x1282b8['error'][_0x1a28('0x14')]===0x1f4){logger['error'](_0x1a28('0x15'),_0x3001e6,_0x1282b8[_0x1a28('0x16')]['message']);return _0x3ca233(_0x1282b8[_0x1a28('0x16')][_0x1a28('0x17')]);}logger['error'](_0x1a28('0x15'),_0x3001e6,_0x1282b8['error'][_0x1a28('0x17')]);return _0x1179ca(_0x1282b8[_0x1a28('0x16')][_0x1a28('0x17')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x3001e6,_0x1a28('0x10'));_0x1179ca(_0x1282b8[_0x1a28('0x18')]['message']);}})['catch'](function(_0x44ec5c){logger[_0x1a28('0x16')](_0x1a28('0x15'),_0x3001e6,_0x44ec5c);_0x3ca233(_0x44ec5c);});});}exports['UpdateWhatsappInteraction']=function(_0x2f3742){var _0x41b7ca=this;return new Promise(function(_0x1c0496,_0x4b2d1d){return db['WhatsappInteraction'][_0x1a28('0x19')](_0x2f3742[_0x1a28('0x1a')],{'raw':_0x2f3742[_0x1a28('0x1b')]?_0x2f3742['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f3742[_0x1a28('0x1b')]?_0x2f3742[_0x1a28('0x1b')][_0x1a28('0x1c')]||null:null,'attributes':_0x2f3742['options']?_0x2f3742[_0x1a28('0x1b')][_0x1a28('0x1d')]||null:null,'limit':_0x2f3742['options']?_0x2f3742[_0x1a28('0x1b')]['limit']||null:null})[_0x1a28('0xe')](function(_0x3c15d4){logger[_0x1a28('0xf')](_0x1a28('0x1e'),_0x2f3742);logger[_0x1a28('0x11')](_0x1a28('0x1e'),_0x2f3742,JSON['stringify'](_0x3c15d4));_0x1c0496(_0x3c15d4);})[_0x1a28('0x1f')](function(_0x437a5b){logger[_0x1a28('0x16')]('UpdateWhatsappInteraction',_0x437a5b['message'],_0x2f3742);_0x4b2d1d(_0x41b7ca[_0x1a28('0x16')](0x1f4,_0x437a5b[_0x1a28('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x33eded){return new Promise(function(_0x101612,_0xf1b82f){return db[_0x1a28('0x20')]['find']({'where':_0x33eded[_0x1a28('0x1b')]?_0x33eded[_0x1a28('0x1b')][_0x1a28('0x1c')]||null:null})[_0x1a28('0xe')](function(_0x5118c1){if(_0x5118c1){return _0x5118c1[_0x1a28('0x21')](_0x33eded[_0x1a28('0x1a')]['ids'],_['omit'](_0x33eded[_0x1a28('0x1a')],[_0x1a28('0x22'),'id'])||{});}})[_0x1a28('0x23')](function(_0x5d3f7f){logger[_0x1a28('0xf')](_0x1a28('0x24'),_0x33eded);logger[_0x1a28('0x11')](_0x1a28('0x24'),_0x33eded,JSON[_0x1a28('0x13')](_0x5d3f7f));_0x101612(_0x5d3f7f);})['catch'](function(_0x2fea58){logger['error'](_0x1a28('0x24'),_0x2fea58['message'],_0x33eded);_0xf1b82f(_this[_0x1a28('0x16')](0x1f4,_0x2fea58['message']));});});}; \ No newline at end of file +var _0x9c01=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','UpdateWhatsappInteraction','update','body','options','raw','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','where','addTags','ids','omit','spread','AddTags','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9c01,0x192));var _0x19c0=function(_0x498a94,_0x5bedf6){_0x498a94=_0x498a94-0x0;var _0x2d0440=_0x9c01[_0x498a94];return _0x2d0440;};'use strict';var _=require('lodash');var util=require(_0x19c0('0x0'));var moment=require('moment');var BPromise=require(_0x19c0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x19c0('0x2'));var db=require(_0x19c0('0x3'))['db'];var utils=require(_0x19c0('0x4'));var logger=require(_0x19c0('0x5'))(_0x19c0('0x6'));var config=require(_0x19c0('0x7'));var jayson=require(_0x19c0('0x8'));var client=jayson[_0x19c0('0x9')][_0x19c0('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x19c0('0xb')],{'host':_0x19c0('0xc'),'port':0x18eb});var socket=require(_0x19c0('0xd'))(new Redis(config[_0x19c0('0xb')]));require(_0x19c0('0xe'))[_0x19c0('0xf')](socket);function respondWithRpcPromise(_0x147e37,_0x873d2f,_0x40cd76){return new BPromise(function(_0x39ee4f,_0x529b4d){return client['request'](_0x147e37,_0x40cd76)[_0x19c0('0x10')](function(_0x54815d){logger[_0x19c0('0x11')](_0x19c0('0x12'),_0x873d2f,_0x19c0('0x13'));logger[_0x19c0('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x873d2f,'request\x20sent',JSON[_0x19c0('0x15')](_0x54815d));if(_0x54815d[_0x19c0('0x16')]){if(_0x54815d[_0x19c0('0x16')][_0x19c0('0x17')]===0x1f4){logger['error'](_0x19c0('0x12'),_0x873d2f,_0x54815d[_0x19c0('0x16')][_0x19c0('0x18')]);return _0x529b4d(_0x54815d[_0x19c0('0x16')][_0x19c0('0x18')]);}logger[_0x19c0('0x16')](_0x19c0('0x12'),_0x873d2f,_0x54815d[_0x19c0('0x16')][_0x19c0('0x18')]);return _0x39ee4f(_0x54815d[_0x19c0('0x16')]['message']);}else{logger[_0x19c0('0x11')](_0x19c0('0x12'),_0x873d2f,_0x19c0('0x13'));_0x39ee4f(_0x54815d['result'][_0x19c0('0x18')]);}})['catch'](function(_0x5e96e9){logger[_0x19c0('0x16')](_0x19c0('0x12'),_0x873d2f,_0x5e96e9);_0x529b4d(_0x5e96e9);});});}exports[_0x19c0('0x19')]=function(_0x5dd390){var _0x5066ed=this;return new Promise(function(_0x4a5543,_0x22a70f){return db['WhatsappInteraction'][_0x19c0('0x1a')](_0x5dd390[_0x19c0('0x1b')],{'raw':_0x5dd390['options']?_0x5dd390[_0x19c0('0x1c')][_0x19c0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dd390[_0x19c0('0x1c')]?_0x5dd390[_0x19c0('0x1c')]['where']||null:null,'attributes':_0x5dd390[_0x19c0('0x1c')]?_0x5dd390[_0x19c0('0x1c')]['attributes']||null:null,'limit':_0x5dd390['options']?_0x5dd390[_0x19c0('0x1c')][_0x19c0('0x1e')]||null:null})['then'](function(_0x384998){logger[_0x19c0('0x11')]('UpdateWhatsappInteraction',_0x5dd390);logger[_0x19c0('0x14')](_0x19c0('0x19'),_0x5dd390,JSON[_0x19c0('0x15')](_0x384998));_0x4a5543(_0x384998);})['catch'](function(_0x25ba20){logger[_0x19c0('0x16')]('UpdateWhatsappInteraction',_0x25ba20[_0x19c0('0x18')],_0x5dd390);_0x22a70f(_0x5066ed[_0x19c0('0x16')](0x1f4,_0x25ba20[_0x19c0('0x18')]));});});};exports[_0x19c0('0x1f')]=function(_0x370592){return new Promise(function(_0x383d57,_0x4b57b9){return db[_0x19c0('0x20')][_0x19c0('0x21')]({'where':_0x370592[_0x19c0('0x1c')]?_0x370592[_0x19c0('0x1c')][_0x19c0('0x22')]||null:null})['then'](function(_0x48b46e){if(_0x48b46e){return _0x48b46e[_0x19c0('0x23')](_0x370592[_0x19c0('0x1b')][_0x19c0('0x24')],_[_0x19c0('0x25')](_0x370592[_0x19c0('0x1b')],[_0x19c0('0x24'),'id'])||{});}})[_0x19c0('0x26')](function(_0x39bcd5){logger[_0x19c0('0x11')]('AddTags',_0x370592);logger['debug'](_0x19c0('0x27'),_0x370592,JSON[_0x19c0('0x15')](_0x39bcd5));_0x383d57(_0x39bcd5);})[_0x19c0('0x28')](function(_0x1bb46e){logger[_0x19c0('0x16')]('AddTags',_0x1bb46e[_0x19c0('0x18')],_0x370592);_0x4b57b9(_this[_0x19c0('0x16')](0x1f4,_0x1bb46e[_0x19c0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index d0b807a..3d422d4 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 _0xe676=['save','remove','update','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x53c645,_0x264b02){var _0x42208a=function(_0x2dd8c2){while(--_0x2dd8c2){_0x53c645['push'](_0x53c645['shift']());}};_0x42208a(++_0x264b02);}(_0xe676,0x137));var _0x6e67=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0xe676[_0x5e8eae];return _0xdd09cd;};'use strict';var WhatsappInteractionEvents=require(_0x6e67('0x0'));var events=[_0x6e67('0x1'),_0x6e67('0x2'),_0x6e67('0x3')];function createListener(_0x3dfb3e,_0x37d79b){return function(_0x8e5f7c){_0x37d79b['emit'](_0x3dfb3e,_0x8e5f7c);};}function removeListener(_0x1f4850,_0x150be3){return function(){WhatsappInteractionEvents[_0x6e67('0x4')](_0x1f4850,_0x150be3);};}exports[_0x6e67('0x5')]=function(_0x81843){for(var _0x4509b6=0x0,_0x128427=events[_0x6e67('0x6')];_0x4509b6<_0x128427;_0x4509b6++){var _0x2d91da=events[_0x4509b6];var _0x3bacd4=createListener(_0x6e67('0x7')+_0x2d91da,_0x81843);WhatsappInteractionEvents['on'](_0x2d91da,_0x3bacd4);}}; \ No newline at end of file +var _0x991d=['removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit'];(function(_0x38c9e7,_0x3f9513){var _0x2dbf10=function(_0x3aea13){while(--_0x3aea13){_0x38c9e7['push'](_0x38c9e7['shift']());}};_0x2dbf10(++_0x3f9513);}(_0x991d,0x1a3));var _0xd991=function(_0x67a1a9,_0x320178){_0x67a1a9=_0x67a1a9-0x0;var _0x3304db=_0x991d[_0x67a1a9];return _0x3304db;};'use strict';var WhatsappInteractionEvents=require(_0xd991('0x0'));var events=[_0xd991('0x1'),_0xd991('0x2'),_0xd991('0x3')];function createListener(_0x3e242f,_0x573126){return function(_0x512146){_0x573126[_0xd991('0x4')](_0x3e242f,_0x512146);};}function removeListener(_0x66c6a6,_0x549911){return function(){WhatsappInteractionEvents[_0xd991('0x5')](_0x66c6a6,_0x549911);};}exports['register']=function(_0x4d2937){for(var _0x560ad4=0x0,_0x219494=events[_0xd991('0x6')];_0x560ad4<_0x219494;_0x560ad4++){var _0x125ec2=events[_0x560ad4];var _0x369dd3=createListener(_0xd991('0x7')+_0x125ec2,_0x4d2937);WhatsappInteractionEvents['on'](_0x125ec2,_0x369dd3);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 5de9c3d..7ce1796 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 _0xb3e0=['reject','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept'];(function(_0x4453d3,_0x2f5ae8){var _0xd83d3=function(_0x1954d0){while(--_0x1954d0){_0x4453d3['push'](_0x4453d3['shift']());}};_0xd83d3(++_0x2f5ae8);}(_0xb3e0,0x19a));var _0x0b3e=function(_0x11e6d6,_0x93cb1){_0x11e6d6=_0x11e6d6-0x0;var _0x4df6bb=_0xb3e0[_0x11e6d6];return _0x4df6bb;};'use strict';var multer=require(_0x0b3e('0x0'));var util=require('util');var path=require(_0x0b3e('0x1'));var timeout=require(_0x0b3e('0x2'));var express=require(_0x0b3e('0x3'));var router=express['Router']();var auth=require(_0x0b3e('0x4'));var interaction=require(_0x0b3e('0x5'));var config=require(_0x0b3e('0x6'));var controller=require(_0x0b3e('0x7'));router[_0x0b3e('0x8')]('/',auth[_0x0b3e('0x9')](),controller[_0x0b3e('0xa')]);router[_0x0b3e('0x8')](_0x0b3e('0xb'),auth[_0x0b3e('0x9')](),controller[_0x0b3e('0xc')]);router['get'](_0x0b3e('0xd'),auth[_0x0b3e('0x9')](),controller['show']);router[_0x0b3e('0xe')]('/',auth[_0x0b3e('0x9')](),interaction[_0x0b3e('0xf')](_0x0b3e('0x10'),_0x0b3e('0x11')),controller[_0x0b3e('0x12')]);router['post'](_0x0b3e('0x13'),controller[_0x0b3e('0x14')]);router[_0x0b3e('0x15')](_0x0b3e('0xd'),auth[_0x0b3e('0x9')](),controller[_0x0b3e('0x16')]);router[_0x0b3e('0x15')](_0x0b3e('0x17'),auth[_0x0b3e('0x9')](),controller[_0x0b3e('0x18')]);router['put']('/:id/reject',auth[_0x0b3e('0x9')](),controller[_0x0b3e('0x19')]);router[_0x0b3e('0x1a')](_0x0b3e('0xd'),auth[_0x0b3e('0x9')](),controller[_0x0b3e('0x1b')]);module[_0x0b3e('0x1c')]=router; \ No newline at end of file +var _0x410c=['/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','path','express','Router','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','post','tracked','whatsappmessage:create'];(function(_0x5ac4b6,_0x4d9360){var _0x29ced8=function(_0x4fdcb6){while(--_0x4fdcb6){_0x5ac4b6['push'](_0x5ac4b6['shift']());}};_0x29ced8(++_0x4d9360);}(_0x410c,0x1b2));var _0xc410=function(_0xf131f0,_0x43fa7f){_0xf131f0=_0xf131f0-0x0;var _0x3289ff=_0x410c[_0xf131f0];return _0x3289ff;};'use strict';var multer=require(_0xc410('0x0'));var util=require(_0xc410('0x1'));var path=require(_0xc410('0x2'));var timeout=require('connect-timeout');var express=require(_0xc410('0x3'));var router=express[_0xc410('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc410('0x5'));var controller=require(_0xc410('0x6'));router['get']('/',auth[_0xc410('0x7')](),controller[_0xc410('0x8')]);router[_0xc410('0x9')](_0xc410('0xa'),auth['isAuthenticated'](),controller[_0xc410('0xb')]);router[_0xc410('0x9')](_0xc410('0xc'),auth[_0xc410('0x7')](),controller['show']);router[_0xc410('0xd')]('/',auth[_0xc410('0x7')](),interaction[_0xc410('0xe')]('whatsapp',_0xc410('0xf')),controller['create']);router[_0xc410('0xd')](_0xc410('0x10'),controller[_0xc410('0x11')]);router[_0xc410('0x12')](_0xc410('0xc'),auth[_0xc410('0x7')](),controller[_0xc410('0x13')]);router['put'](_0xc410('0x14'),auth[_0xc410('0x7')](),controller[_0xc410('0x15')]);router[_0xc410('0x12')](_0xc410('0x16'),auth[_0xc410('0x7')](),controller[_0xc410('0x17')]);router[_0xc410('0x18')]('/:id',auth[_0xc410('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index b2eb5e8..4ea6c80 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 _0xdd3b=['BOOLEAN','out','STRING','DATE','exports','TEXT'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xdd3b,0x1d8));var _0xbdd3=function(_0x22bf47,_0x5b3cfd){_0x22bf47=_0x22bf47-0x0;var _0x63e280=_0xdd3b[_0x22bf47];return _0x63e280;};'use strict';var Sequelize=require('sequelize');module[_0xbdd3('0x0')]={'body':{'type':Sequelize[_0xbdd3('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbdd3('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbdd3('0x3')),'defaultValue':_0xbdd3('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xbdd3('0x4')]},'readAt':{'type':Sequelize[_0xbdd3('0x5')]},'secret':{'type':Sequelize[_0xbdd3('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbdd3('0x4')]},'providerResponse':{'type':Sequelize[_0xbdd3('0x1')]}}; \ No newline at end of file +var _0x7e1e=['STRING','BOOLEAN','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x348461,_0x3abc96){var _0x5c0593=function(_0x19dacd){while(--_0x19dacd){_0x348461['push'](_0x348461['shift']());}};_0x5c0593(++_0x3abc96);}(_0x7e1e,0x19a));var _0xe7e1=function(_0x3d477b,_0x551ab6){_0x3d477b=_0x3d477b-0x0;var _0x582dbc=_0x7e1e[_0x3d477b];return _0x582dbc;};'use strict';var Sequelize=require(_0xe7e1('0x0'));module[_0xe7e1('0x1')]={'body':{'type':Sequelize[_0xe7e1('0x2')](_0xe7e1('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe7e1('0x4')]('in',_0xe7e1('0x5')),'defaultValue':_0xe7e1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe7e1('0x6')](0xbe)},'phone':{'type':Sequelize[_0xe7e1('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xe7e1('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe7e1('0x6')]},'providerResponse':{'type':Sequelize[_0xe7e1('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 6eeb6bc..7cba04b 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 _0xda2d=['WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','reject','destroy','end','stack','send','index','map','rawAttributes','key','model','name','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','WhatsappMessage','rows','keys','includeAll','include','find','create','update','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','params','Contact','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','role','acceptMessage','interface','SIP/%s','channel','EventManager','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','event','rejectmessage','WhatsappAccount'];(function(_0x1046ae,_0x3bcbee){var _0xb213a8=function(_0x485e2c){while(--_0x485e2c){_0x1046ae['push'](_0x1046ae['shift']());}};_0xb213a8(++_0x3bcbee);}(_0xda2d,0x102));var _0xdda2=function(_0x33e47e,_0x17f834){_0x33e47e=_0x33e47e-0x0;var _0x470eb6=_0xda2d[_0x33e47e];return _0x470eb6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdda2('0x0'));var rimraf=require(_0xdda2('0x1'));var zipdir=require(_0xdda2('0x2'));var jsonpatch=require(_0xdda2('0x3'));var rp=require(_0xdda2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdda2('0x5'));var path=require(_0xdda2('0x6'));var sox=require(_0xdda2('0x7'));var csv=require(_0xdda2('0x8'));var ejs=require(_0xdda2('0x9'));var fs=require('fs');var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xdda2('0x19')](config[_0xdda2('0x1a')],{'host':_0xdda2('0x1b'),'port':0x18eb});var socket=require(_0xdda2('0x1c'))(new Redis(config[_0xdda2('0x1a')]));require(_0xdda2('0x1d'))[_0xdda2('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdda2('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xdda2('0x1f')][_0xdda2('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3553d5,_0x457764,_0x1922b1,_0x5d8a83){return new BPromise(function(_0x55d674,_0x43f67b){var _0x518c6d=_0x5d8a83||client;return _0x518c6d[_0xdda2('0x21')](_0x3553d5,_0x1922b1)[_0xdda2('0x22')](function(_0x335fb5){logger[_0xdda2('0x23')](_0xdda2('0x24'),_0x457764,_0xdda2('0x25'));logger[_0xdda2('0x26')](_0xdda2('0x27'),_0x457764,_0xdda2('0x25'),JSON[_0xdda2('0x28')](_0x335fb5));if(_0x335fb5[_0xdda2('0x29')]){if(_0x335fb5[_0xdda2('0x29')]['code']===0x1f4){logger[_0xdda2('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x457764,_0x335fb5[_0xdda2('0x29')][_0xdda2('0x2a')]);return _0x43f67b(_0x335fb5[_0xdda2('0x29')]['message']);}logger[_0xdda2('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x457764,_0x335fb5[_0xdda2('0x29')][_0xdda2('0x2a')]);return _0x55d674(_0x335fb5['error'][_0xdda2('0x2a')]);}else{logger[_0xdda2('0x23')](_0xdda2('0x24'),_0x457764,_0xdda2('0x25'));_0x55d674(_0x335fb5[_0xdda2('0x2b')]['message']);}})[_0xdda2('0x2c')](function(_0x4be5ea){logger[_0xdda2('0x29')](_0xdda2('0x24'),_0x457764,_0x4be5ea);_0x43f67b(_0x4be5ea);});});}function respondWithStatusCode(_0x5436d1,_0x4e97dc){_0x4e97dc=_0x4e97dc||0xcc;return function(_0x28da54){if(_0x28da54){return _0x5436d1[_0xdda2('0x2d')](_0x4e97dc);}return _0x5436d1[_0xdda2('0x2e')](_0x4e97dc)['end']();};}function respondWithResult(_0x90d919,_0x5d26ae){_0x5d26ae=_0x5d26ae||0xc8;return function(_0x2e755b){if(_0x2e755b){return _0x90d919[_0xdda2('0x2e')](_0x5d26ae)[_0xdda2('0x2f')](_0x2e755b);}};}function respondWithFilteredResult(_0x91b41a,_0x4bb8a4){return function(_0x24c37d){if(_0x24c37d){var _0x255bbc=_0x24c37d[_0xdda2('0x30')],_0x53acb5=_0x4bb8a4[_0xdda2('0x31')],_0x45e800=_0x4bb8a4['offset']+_0x4bb8a4[_0xdda2('0x32')],_0x2cfaca;if(_0x45e800>=_0x255bbc){_0x45e800=_0x255bbc;_0x2cfaca=0xc8;}else{_0x2cfaca=0xce;}_0x91b41a[_0xdda2('0x2e')](_0x2cfaca);return _0x91b41a['set'](_0xdda2('0x33'),_0x53acb5+'-'+_0x45e800+'/'+_0x255bbc)['json'](_0x24c37d);}return null;};}function patchUpdates(_0x2b8cd6){return function(_0x55809a){try{jsonpatch['apply'](_0x55809a,_0x2b8cd6,!![]);}catch(_0x510b7b){return BPromise[_0xdda2('0x34')](_0x510b7b);}return _0x55809a['save']();};}function saveUpdates(_0x1b13f4,_0x508664){return function(_0x5cba58){if(_0x5cba58){return _0x5cba58['update'](_0x1b13f4)[_0xdda2('0x22')](function(_0x567717){return _0x567717;});}return null;};}function removeEntity(_0xca6046,_0x2fd592){return function(_0x12e96d){if(_0x12e96d){return _0x12e96d[_0xdda2('0x35')]()[_0xdda2('0x22')](function(){_0xca6046[_0xdda2('0x2e')](0xcc)[_0xdda2('0x36')]();});}};}function handleEntityNotFound(_0x2bcf47,_0x4a32ea){return function(_0x461621){if(!_0x461621){_0x2bcf47[_0xdda2('0x2d')](0x194);}return _0x461621;};}function handleError(_0x2f8674,_0x3d510c){_0x3d510c=_0x3d510c||0x1f4;return function(_0x392373){logger[_0xdda2('0x29')](_0x392373[_0xdda2('0x37')]);if(_0x392373['name']){delete _0x392373['name'];}_0x2f8674[_0xdda2('0x2e')](_0x3d510c)[_0xdda2('0x38')](_0x392373);};}exports[_0xdda2('0x39')]=function(_0x4811d2,_0x54e211){var _0x871054={},_0x35a0f6={},_0x2d7a21={'count':0x0,'rows':[]};var _0x11f1f6=_[_0xdda2('0x3a')](db['WhatsappMessage'][_0xdda2('0x3b')],function(_0x21fc6d){return{'name':_0x21fc6d['fieldName'],'type':_0x21fc6d['type'][_0xdda2('0x3c')]};});_0x35a0f6[_0xdda2('0x3d')]=_[_0xdda2('0x3a')](_0x11f1f6,_0xdda2('0x3e'));_0x35a0f6[_0xdda2('0x3f')]=_['keys'](_0x4811d2[_0xdda2('0x3f')]);_0x35a0f6[_0xdda2('0x40')]=_[_0xdda2('0x41')](_0x35a0f6[_0xdda2('0x3d')],_0x35a0f6['query']);_0x871054['attributes']=_[_0xdda2('0x41')](_0x35a0f6[_0xdda2('0x3d')],qs[_0xdda2('0x42')](_0x4811d2['query'][_0xdda2('0x42')]));_0x871054['attributes']=_0x871054[_0xdda2('0x43')]['length']?_0x871054[_0xdda2('0x43')]:_0x35a0f6[_0xdda2('0x3d')];if(!_0x4811d2[_0xdda2('0x3f')][_0xdda2('0x44')]('nolimit')){_0x871054[_0xdda2('0x32')]=qs['limit'](_0x4811d2[_0xdda2('0x3f')]['limit']);_0x871054[_0xdda2('0x31')]=qs[_0xdda2('0x31')](_0x4811d2[_0xdda2('0x3f')][_0xdda2('0x31')]);}_0x871054[_0xdda2('0x45')]=qs['sort'](_0x4811d2[_0xdda2('0x3f')][_0xdda2('0x46')]);_0x871054['where']=qs[_0xdda2('0x40')](_['pick'](_0x4811d2[_0xdda2('0x3f')],_0x35a0f6[_0xdda2('0x40')]),_0x11f1f6);if(_0x4811d2[_0xdda2('0x3f')][_0xdda2('0x47')]){_0x871054[_0xdda2('0x48')]=_[_0xdda2('0x49')](_0x871054[_0xdda2('0x48')],{'$or':_[_0xdda2('0x3a')](_0x11f1f6,function(_0xff55){if(_0xff55[_0xdda2('0x4a')]!==_0xdda2('0x4b')){var _0x224eac={};_0x224eac[_0xff55[_0xdda2('0x3e')]]={'$like':'%'+_0x4811d2['query']['filter']+'%'};return _0x224eac;}})});}_0x871054=_['merge']({},_0x871054,_0x4811d2[_0xdda2('0x4c')]);var _0x383536={'where':_0x871054['where']};return db[_0xdda2('0x4d')][_0xdda2('0x30')](_0x383536)[_0xdda2('0x22')](function(_0x5e56a8){_0x2d7a21[_0xdda2('0x30')]=_0x5e56a8;if(_0x4811d2[_0xdda2('0x3f')]['includeAll']){_0x871054['include']=[{'all':!![]}];}return db[_0xdda2('0x4d')]['findAll'](_0x871054);})[_0xdda2('0x22')](function(_0x4b778b){_0x2d7a21[_0xdda2('0x4e')]=_0x4b778b;return _0x2d7a21;})[_0xdda2('0x22')](respondWithFilteredResult(_0x54e211,_0x871054))['catch'](handleError(_0x54e211,null));};exports['show']=function(_0x3506ff,_0x413f8a){var _0x375741={'raw':!![],'where':{'id':_0x3506ff['params']['id']}},_0x33f0b4={};_0x33f0b4[_0xdda2('0x3d')]=_[_0xdda2('0x4f')](db[_0xdda2('0x4d')][_0xdda2('0x3b')]);_0x33f0b4[_0xdda2('0x3f')]=_['keys'](_0x3506ff[_0xdda2('0x3f')]);_0x33f0b4[_0xdda2('0x40')]=_['intersection'](_0x33f0b4[_0xdda2('0x3d')],_0x33f0b4[_0xdda2('0x3f')]);_0x375741[_0xdda2('0x43')]=_[_0xdda2('0x41')](_0x33f0b4[_0xdda2('0x3d')],qs[_0xdda2('0x42')](_0x3506ff['query'][_0xdda2('0x42')]));_0x375741['attributes']=_0x375741[_0xdda2('0x43')]['length']?_0x375741[_0xdda2('0x43')]:_0x33f0b4['model'];if(_0x3506ff[_0xdda2('0x3f')][_0xdda2('0x50')]){_0x375741[_0xdda2('0x51')]=[{'all':!![]}];}_0x375741=_[_0xdda2('0x49')]({},_0x375741,_0x3506ff[_0xdda2('0x4c')]);return db[_0xdda2('0x4d')][_0xdda2('0x52')](_0x375741)[_0xdda2('0x22')](handleEntityNotFound(_0x413f8a,null))['then'](respondWithResult(_0x413f8a,null))[_0xdda2('0x2c')](handleError(_0x413f8a,null));};exports[_0xdda2('0x53')]=function(_0x1b24f2,_0x560f20){return db[_0xdda2('0x4d')][_0xdda2('0x53')](_0x1b24f2['body'],{})[_0xdda2('0x22')](respondWithResult(_0x560f20,0xc9))['catch'](handleError(_0x560f20,null));};exports[_0xdda2('0x54')]=function(_0x10fbac,_0x378704){if(_0x10fbac[_0xdda2('0x55')]['id']){delete _0x10fbac[_0xdda2('0x55')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x10fbac['params']['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x378704,null))[_0xdda2('0x22')](saveUpdates(_0x10fbac['body'],null))[_0xdda2('0x22')](respondWithResult(_0x378704,null))[_0xdda2('0x2c')](handleError(_0x378704,null));};exports[_0xdda2('0x35')]=function(_0x4b067e,_0x3fd76c){return db[_0xdda2('0x4d')][_0xdda2('0x52')]({'where':{'id':_0x4b067e['params']['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x3fd76c,null))[_0xdda2('0x22')](removeEntity(_0x3fd76c,null))[_0xdda2('0x2c')](handleError(_0x3fd76c,null));};exports[_0xdda2('0x56')]=function(_0x5d8602,_0x4645f8){return db['WhatsappMessage']['describe']()['then'](respondWithResult(_0x4645f8,null))[_0xdda2('0x2c')](handleError(_0x4645f8,null));};var interaction_log=require(_0xdda2('0x15'))(_0xdda2('0x57'));exports[_0xdda2('0x58')]=function(_0x3f511d,_0x16cc37,_0x29a739){var _0x3ac33a={'channel':_0xdda2('0x59')};if(_0x3f511d[_0xdda2('0x55')]['id']){delete _0x3f511d[_0xdda2('0x55')]['id'];}_0x3f511d['body'][_0xdda2('0x5a')]=!![];_0x3f511d[_0xdda2('0x55')][_0xdda2('0x5b')]=moment()[_0xdda2('0x5c')](_0xdda2('0x5d'));_0x3f511d[_0xdda2('0x55')][_0xdda2('0x5e')]=_0x3f511d['body'][_0xdda2('0x5e')]||_0x3f511d[_0xdda2('0x5f')]['id'];return db[_0xdda2('0x4d')][_0xdda2('0x52')]({'where':{'id':_0x3f511d[_0xdda2('0x60')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xdda2('0x61')}]})[_0xdda2('0x22')](handleEntityNotFound(_0x16cc37,null))[_0xdda2('0x22')](saveUpdates(_0x3f511d[_0xdda2('0x55')],null))[_0xdda2('0x22')](function(_0x4a6f28){if(_0x4a6f28){_0x3ac33a[_0xdda2('0x2a')]=_0x4a6f28[_0xdda2('0x62')]({'plain':!![]});return db[_0xdda2('0x63')][_0xdda2('0x52')]({'where':{'id':_0x4a6f28[_0xdda2('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x16cc37,null))[_0xdda2('0x22')](function(_0x3d7951){if(_0x3d7951){return _0x3d7951[_0xdda2('0x54')]({'UserId':_0x3f511d['body'][_0xdda2('0x5e')],'read1stAt':_['isNil'](_0x3d7951[_0xdda2('0x65')])?moment()[_0xdda2('0x5c')](_0xdda2('0x5d')):undefined});}return null;})['then'](function(_0x28ee2b){if(_0x28ee2b){_0x3ac33a[_0xdda2('0x66')]=_0x28ee2b['get']({'plain':!![]});interaction_log[_0xdda2('0x23')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3f511d[_0xdda2('0x5f')]['id'],_0x3f511d[_0xdda2('0x5f')][_0xdda2('0x3e')],_0x3f511d[_0xdda2('0x5f')][_0xdda2('0x67')],_0x3ac33a['interaction']['id'],_0x3f511d['body']?JSON[_0xdda2('0x28')](_0x3f511d[_0xdda2('0x55')]):'null');return respondWithRpcPromise('AcceptMessage',_0xdda2('0x68'),_0x3ac33a);}return null;})['then'](function(_0x12a052){if(_0x12a052){if(_0x3f511d[_0xdda2('0x55')]['manual']){_0x3ac33a[_0xdda2('0x2a')][_0xdda2('0x69')]=util[_0xdda2('0x5c')](_0xdda2('0x6a'),_0x3f511d[_0xdda2('0x5f')][_0xdda2('0x3e')]);_0x3ac33a['message'][_0xdda2('0x6b')]=_0x3ac33a[_0xdda2('0x6b')];_0x3ac33a[_0xdda2('0x2a')]['event']=_0xdda2('0x58');return respondWithRpcPromise(_0xdda2('0x6c'),'EventManager',{'event':'acceptmessage','message':_0x3ac33a[_0xdda2('0x2a')]},client9002)[_0xdda2('0x22')](function(){return _0x3ac33a;});}return _0x3ac33a;}return null;})[_0xdda2('0x22')](respondWithResult(_0x16cc37,null))['catch'](handleError(_0x16cc37,null));};var interaction_log=require('../../config/logger')(_0xdda2('0x57'));exports['reject']=function(_0x18edab,_0x150dcd,_0x19d92e){var _0x12fd67={'agent':{},'channel':_0xdda2('0x59')};if(_0x18edab[_0xdda2('0x55')]['id']){delete _0x18edab['body']['id'];}_0x18edab['body'][_0xdda2('0x5e')]=_0x18edab['body'][_0xdda2('0x5e')]||_0x18edab[_0xdda2('0x5f')]['id'];_0x12fd67[_0xdda2('0x6d')]['id']=_0x18edab[_0xdda2('0x55')][_0xdda2('0x5e')];return db[_0xdda2('0x4d')][_0xdda2('0x52')]({'where':{'id':_0x18edab[_0xdda2('0x60')]['id'],'UserId':null}})[_0xdda2('0x22')](handleEntityNotFound(_0x150dcd,null))['then'](function(_0x152b1c){if(_0x152b1c){_0x12fd67[_0xdda2('0x2a')]=_0x152b1c[_0xdda2('0x62')]({'plain':!![]});return db[_0xdda2('0x63')]['find']({'where':{'id':_0x152b1c[_0xdda2('0x64')]}});}return null;})[_0xdda2('0x22')](handleEntityNotFound(_0x150dcd,null))[_0xdda2('0x22')](function(_0x34a8ee){if(_0x34a8ee){_0x12fd67['interaction']=_0x34a8ee['get']({'plain':!![]});interaction_log[_0xdda2('0x23')](_0xdda2('0x6e'),_0x18edab[_0xdda2('0x5f')]['id'],_0x18edab[_0xdda2('0x5f')]['name'],_0x18edab[_0xdda2('0x5f')][_0xdda2('0x67')],_0x12fd67[_0xdda2('0x66')]['id'],_0x18edab[_0xdda2('0x55')]?JSON[_0xdda2('0x28')](_0x18edab[_0xdda2('0x55')]):_0xdda2('0x6f'));return respondWithRpcPromise(_0xdda2('0x70'),_0xdda2('0x71'),_0x12fd67);}return null;})[_0xdda2('0x22')](function(_0x12ff97){if(_0x12ff97){_0x12ff97[_0xdda2('0x2a')][_0xdda2('0x69')]=util[_0xdda2('0x5c')](_0xdda2('0x6a'),_0x18edab['user'][_0xdda2('0x3e')]);_0x12ff97[_0xdda2('0x2a')]['channel']=_0x12fd67['channel'];_0x12ff97[_0xdda2('0x2a')][_0xdda2('0x72')]=_0xdda2('0x34');respondWithRpcPromise(_0xdda2('0x6c'),_0xdda2('0x6c'),{'event':_0xdda2('0x73'),'message':_0x12ff97['message']},client9002);return _0x12fd67;}return null;})[_0xdda2('0x22')](respondWithResult(_0x150dcd,null))[_0xdda2('0x2c')](handleError(_0x150dcd,null));};exports[_0xdda2('0x2e')]=function(_0x2bb4f3,_0x563be8,_0xbf1248){if(_0x2bb4f3['body']['id']){delete _0x2bb4f3[_0xdda2('0x55')]['id'];}var _0x6b6dad;return db['WhatsappMessage'][_0xdda2('0x52')]({'where':{'id':_0x2bb4f3[_0xdda2('0x60')]['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x563be8,null))[_0xdda2('0x22')](function(_0x222099){if(_0x222099){_0x6b6dad=_0x222099;return db[_0xdda2('0x74')][_0xdda2('0x52')]({'where':{'id':_0x222099[_0xdda2('0x75')]}});}})[_0xdda2('0x22')](handleEntityNotFound(_0x563be8,null))[_0xdda2('0x22')](function(_0xb875f6){if(_0xb875f6){logger['debug'](_0xdda2('0x76'),_0xdda2('0x2e'),_0xdda2('0x77'),_0xb875f6[_0xdda2('0x4a')],util[_0xdda2('0x78')](_0x2bb4f3['body'],{'showHidden':![],'depth':null}));switch(_0xb875f6[_0xdda2('0x4a')]){case _0xdda2('0x79'):if(_0x2bb4f3['body'][_0xdda2('0x7a')]&&_0x2bb4f3[_0xdda2('0x55')]['MessageSid']===_0x6b6dad['messageId']&&_0x2bb4f3[_0xdda2('0x55')][_0xdda2('0x7b')]&&_0x2bb4f3[_0xdda2('0x55')][_0xdda2('0x7b')]===_0xdda2('0x5a')){return _0x6b6dad[_0xdda2('0x54')]({'read':!![]});}else{logger['error'](_0xdda2('0x7c'),_0xdda2('0x2e'),'twilio',util[_0xdda2('0x78')](_0x2bb4f3[_0xdda2('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x6b6dad;}})['then'](respondWithResult(_0x563be8,null))[_0xdda2('0x2c')](handleError(_0x563be8,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(_0x5cc4bd,_0x59cfd3){var _0x30e33f=function(_0x5092f6){while(--_0x5092f6){_0x5cc4bd['push'](_0x5cc4bd['shift']());}};_0x30e33f(++_0x59cfd3);}(_0xadb5,0xad));var _0x5adb=function(_0x254c26,_0x2ab420){_0x254c26=_0x254c26-0x0;var _0x1d6275=_0xadb5[_0x254c26];return _0x1d6275;};'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 a53e51d..407ef19 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x3930e0,_0x2ab4b8){var _0x365e8f=function(_0x1200c2){while(--_0x1200c2){_0x3930e0['push'](_0x3930e0['shift']());}};_0x365e8f(++_0x2ab4b8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x320000,_0x2d4067){_0x320000=_0x320000-0x0;var _0x1f6901=_0x5f2f[_0x320000];return _0x1f6901;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0xaecbba,_0x19cf24){var _0xa7b3c1=function(_0x109e04){while(--_0x109e04){_0xaecbba['push'](_0xaecbba['shift']());}};_0xa7b3c1(++_0x19cf24);}(_0xb10b,0x12a));var _0xbb10=function(_0x35e083,_0x2a67b7){_0x35e083=_0x35e083-0x0;var _0x4c1d88=_0xb10b[_0x35e083];return _0x4c1d88;};'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 3f85c4d..65bad0f 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 _0x2643=['accountSid','create','whatsapp:','/api/whatsapp/messages/','/status?token=','sid','update','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio'];(function(_0x3cc72f,_0x1c8617){var _0x45031e=function(_0x426639){while(--_0x426639){_0x3cc72f['push'](_0x3cc72f['shift']());}};_0x45031e(++_0x1c8617);}(_0x2643,0x197));var _0x3264=function(_0xd26128,_0x34ef84){_0xd26128=_0xd26128-0x0;var _0x4b492f=_0x2643[_0xd26128];return _0x4b492f;};'use strict';var _=require(_0x3264('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3264('0x1'));var moment=require(_0x3264('0x2'));var BPromise=require(_0x3264('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3264('0x4'));var rimraf=require(_0x3264('0x5'));var config=require(_0x3264('0x6'));var attributes=require(_0x3264('0x7'));module[_0x3264('0x8')]=function(_0x1dfbb7,_0x28f0aa){return _0x1dfbb7['define'](_0x3264('0x9'),attributes,{'tableName':_0x3264('0xa'),'paranoid':![],'indexes':[{'name':_0x3264('0xb'),'fields':[_0x3264('0xb')]},{'name':_0x3264('0xc'),'fields':[_0x3264('0xd')],'type':_0x3264('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x9432f6,_0x4e0255,_0x33a632){var _0x40bd7d=_0x1dfbb7[_0x3264('0xf')];var _0x184f8a=_0x9432f6[_0x3264('0x10')]({'plain':!![]});if(_0x184f8a[_0x3264('0x11')][_0x3264('0x12')]()==='in'||_0x184f8a[_0x3264('0x11')][_0x3264('0x12')]()===_0x3264('0x13')&&!_0x184f8a[_0x3264('0x14')]&&!_[_0x3264('0x15')](_0x184f8a[_0x3264('0x16')])){_0x40bd7d[_0x3264('0x17')][_0x3264('0x18')]({'where':{'id':_0x184f8a[_0x3264('0x19')]}})[_0x3264('0x1a')](function(_0x517b43){if(_0x517b43){_0x517b43['update']({'lastMsgAt':_0x184f8a[_0x3264('0x1b')],'lastMsgDirection':_0x184f8a[_0x3264('0x11')][_0x3264('0x12')]()});}})[_0x3264('0x1c')](function(_0x12cc49){console['error'](_0x12cc49);});}if(_0x184f8a['direction']===_0x3264('0x13')&&!_0x184f8a[_0x3264('0x14')]){var _0x13e6c4;_0x40bd7d[_0x3264('0x1d')][_0x3264('0x1e')]({'where':{'id':_0x184f8a[_0x3264('0x1f')]},'raw':!![]})[_0x3264('0x1a')](function(_0x4b2398){_0x13e6c4=_0x4b2398;if(_0x13e6c4&&_0x13e6c4[_0x3264('0x20')]){switch(_0x13e6c4['type']){case _0x3264('0x21'):var _0x3d0f3f=require(_0x3264('0x21'));if(_0x13e6c4[_0x3264('0x22')]&&_0x13e6c4['authToken']&&_0x13e6c4['phone']){var _0x291589=new _0x3d0f3f(_0x13e6c4[_0x3264('0x22')],_0x13e6c4['authToken']);_0x291589['messages'][_0x3264('0x23')]({'body':_0x184f8a[_0x3264('0xd')],'to':_0x3264('0x24')+_0x184f8a['phone'],'from':'whatsapp:'+_0x13e6c4['phone'],'statusCallback':_0x13e6c4['remote']+_0x3264('0x25')+_0x184f8a['id']+_0x3264('0x26')+_0x13e6c4['token']})[_0x3264('0x1a')](function(_0x42d775){if(_0x42d775[_0x3264('0x27')]){return _0x9432f6[_0x3264('0x28')]({'messageId':_0x42d775[_0x3264('0x27')]});}})['catch'](function(_0x365b3b){logger[_0x3264('0x29')](_0x3264('0x2a'),_0x3264('0x2b'),'twilio',util[_0x3264('0x2c')](_0x365b3b,{'showHidden':![],'depth':null}));});}else{logger[_0x3264('0x29')](_0x3264('0x2a'),_0x3264('0x2b'),_0x3264('0x21'),_0x3264('0x2d'));}break;}}})[_0x3264('0x2e')](function(){_0x33a632();});}else{_0x33a632();}}},'charset':_0x3264('0x2f'),'collate':_0x3264('0x30')});}; \ No newline at end of file +var _0xd8fe=['path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','toLowerCase','out','secret','isNil','findOne','then','update','createdAt','direction','catch','find','WhatsappAccountId','type','authToken','phone','accountSid','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','error','twilio','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird'];(function(_0x3b22e9,_0x354406){var _0x230314=function(_0x29ae96){while(--_0x29ae96){_0x3b22e9['push'](_0x3b22e9['shift']());}};_0x230314(++_0x354406);}(_0xd8fe,0x174));var _0xed8f=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xd8fe[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xed8f('0x0'));var util=require('util');var logger=require(_0xed8f('0x1'))('api');var moment=require(_0xed8f('0x2'));var BPromise=require(_0xed8f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed8f('0x4'));var rimraf=require(_0xed8f('0x5'));var config=require(_0xed8f('0x6'));var attributes=require(_0xed8f('0x7'));module[_0xed8f('0x8')]=function(_0x5efbc6,_0x277599){return _0x5efbc6[_0xed8f('0x9')](_0xed8f('0xa'),attributes,{'tableName':_0xed8f('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xed8f('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0xed8f('0xd')],'type':_0xed8f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x45b060,_0x5cce49,_0x5337a5){var _0x941804=_0x5efbc6[_0xed8f('0xf')];var _0xd04753=_0x45b060[_0xed8f('0x10')]({'plain':!![]});if(_0xd04753['direction']['toLowerCase']()==='in'||_0xd04753['direction'][_0xed8f('0x11')]()===_0xed8f('0x12')&&!_0xd04753[_0xed8f('0x13')]&&!_[_0xed8f('0x14')](_0xd04753['UserId'])){_0x941804['WhatsappInteraction'][_0xed8f('0x15')]({'where':{'id':_0xd04753['WhatsappInteractionId']}})[_0xed8f('0x16')](function(_0x2f9c43){if(_0x2f9c43){_0x2f9c43[_0xed8f('0x17')]({'lastMsgAt':_0xd04753[_0xed8f('0x18')],'lastMsgDirection':_0xd04753[_0xed8f('0x19')][_0xed8f('0x11')]()});}})[_0xed8f('0x1a')](function(_0xc3ba12){console['error'](_0xc3ba12);});}if(_0xd04753[_0xed8f('0x19')]===_0xed8f('0x12')&&!_0xd04753[_0xed8f('0x13')]){var _0x29eea4;_0x941804['WhatsappAccount'][_0xed8f('0x1b')]({'where':{'id':_0xd04753[_0xed8f('0x1c')]},'raw':!![]})[_0xed8f('0x16')](function(_0x5e0cf8){_0x29eea4=_0x5e0cf8;if(_0x29eea4&&_0x29eea4['type']){switch(_0x29eea4[_0xed8f('0x1d')]){case'twilio':var _0x57c3d9=require('twilio');if(_0x29eea4['accountSid']&&_0x29eea4[_0xed8f('0x1e')]&&_0x29eea4[_0xed8f('0x1f')]){var _0x36472d=new _0x57c3d9(_0x29eea4[_0xed8f('0x20')],_0x29eea4[_0xed8f('0x1e')]);_0x36472d[_0xed8f('0x21')][_0xed8f('0x22')]({'body':_0xd04753[_0xed8f('0xd')],'to':_0xed8f('0x23')+_0xd04753[_0xed8f('0x1f')],'from':'whatsapp:'+_0x29eea4[_0xed8f('0x1f')],'statusCallback':_0x29eea4[_0xed8f('0x24')]+_0xed8f('0x25')+_0xd04753['id']+'/status?token='+_0x29eea4[_0xed8f('0x26')]})[_0xed8f('0x16')](function(_0x3aeaed){if(_0x3aeaed['sid']){return _0x45b060['update']({'messageId':_0x3aeaed['sid']});}})['catch'](function(_0x2b4ac8){logger[_0xed8f('0x27')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xed8f('0x28'),util[_0xed8f('0x29')](_0x2b4ac8,{'showHidden':![],'depth':null}));});}else{logger[_0xed8f('0x27')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xed8f('0x2a'),'twilio',_0xed8f('0x2b'));}break;}}})[_0xed8f('0x2c')](function(){_0x5337a5();});}else{_0x5337a5();}}},'charset':_0xed8f('0x2d'),'collate':_0xed8f('0x2e')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 44a444b..fd10e04 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 _0x6fe3=['../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./whatsappMessage.socket','register','then','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x171ac7,_0x339c8d){var _0x94478d=function(_0xedf6e6){while(--_0xedf6e6){_0x171ac7['push'](_0x171ac7['shift']());}};_0x94478d(++_0x339c8d);}(_0x6fe3,0xb3));var _0x36fe=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x6fe3[_0x11a220];return _0x20d8fe;};'use strict';var _=require(_0x36fe('0x0'));var util=require(_0x36fe('0x1'));var moment=require(_0x36fe('0x2'));var BPromise=require(_0x36fe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36fe('0x4'))['db'];var utils=require(_0x36fe('0x5'));var logger=require('../../config/logger')(_0x36fe('0x6'));var config=require(_0x36fe('0x7'));var jayson=require(_0x36fe('0x8'));var client=jayson[_0x36fe('0x9')][_0x36fe('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x36fe('0xb'),'port':0x18eb});var socket=require(_0x36fe('0xc'))(new Redis(config[_0x36fe('0xd')]));require(_0x36fe('0xe'))[_0x36fe('0xf')](socket);function respondWithRpcPromise(_0x2dc081,_0x50b39d,_0x452d27){return new BPromise(function(_0x2057ee,_0x4fca1b){return client['request'](_0x2dc081,_0x452d27)[_0x36fe('0x10')](function(_0x1afa00){logger['info'](_0x36fe('0x11'),_0x50b39d,'request\x20sent');logger[_0x36fe('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x50b39d,_0x36fe('0x13'),JSON[_0x36fe('0x14')](_0x1afa00));if(_0x1afa00['error']){if(_0x1afa00[_0x36fe('0x15')][_0x36fe('0x16')]===0x1f4){logger[_0x36fe('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x50b39d,_0x1afa00['error'][_0x36fe('0x17')]);return _0x4fca1b(_0x1afa00['error'][_0x36fe('0x17')]);}logger[_0x36fe('0x15')](_0x36fe('0x11'),_0x50b39d,_0x1afa00[_0x36fe('0x15')][_0x36fe('0x17')]);return _0x2057ee(_0x1afa00['error']['message']);}else{logger[_0x36fe('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x50b39d,_0x36fe('0x13'));_0x2057ee(_0x1afa00['result'][_0x36fe('0x17')]);}})[_0x36fe('0x19')](function(_0x369743){logger['error'](_0x36fe('0x11'),_0x50b39d,_0x369743);_0x4fca1b(_0x369743);});});}exports[_0x36fe('0x1a')]=function(_0x15c89c){var _0x46ba7c=this;return new Promise(function(_0xb902f1,_0x597223){return db[_0x36fe('0x1b')][_0x36fe('0x1c')](_0x15c89c['body'],{'raw':_0x15c89c[_0x36fe('0x1d')]?_0x15c89c[_0x36fe('0x1d')][_0x36fe('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x375489){logger['info'](_0x36fe('0x1a'),_0x15c89c);logger[_0x36fe('0x12')](_0x36fe('0x1a'),_0x15c89c,JSON[_0x36fe('0x14')](_0x375489));_0xb902f1(_0x375489);})[_0x36fe('0x19')](function(_0x20a705){logger[_0x36fe('0x15')](_0x36fe('0x1a'),_0x20a705[_0x36fe('0x17')],_0x15c89c);_0x597223(_0x46ba7c[_0x36fe('0x15')](0x1f4,_0x20a705['message']));});});}; \ No newline at end of file +var _0x5d29=['CreateWhatsappMessage','create','body','options','raw','lodash','util','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','defaults','redis','socket.io-emitter','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x47b233,_0x589800){var _0xb2f8fd=function(_0x599474){while(--_0x599474){_0x47b233['push'](_0x47b233['shift']());}};_0xb2f8fd(++_0x589800);}(_0x5d29,0x1c5));var _0x95d2=function(_0x1d374d,_0x489b01){_0x1d374d=_0x1d374d-0x0;var _0x4b4830=_0x5d29[_0x1d374d];return _0x4b4830;};'use strict';var _=require(_0x95d2('0x0'));var util=require(_0x95d2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x95d2('0x2'));var fs=require('fs');var Redis=require(_0x95d2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x95d2('0x4'))(_0x95d2('0x5'));var config=require('../../config/environment');var jayson=require(_0x95d2('0x6'));var client=jayson[_0x95d2('0x7')]['http']({'port':0x232a});config['redis']=_[_0x95d2('0x8')](config[_0x95d2('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x95d2('0xa'))(new Redis(config['redis']));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x49df6d,_0x49896f,_0x53bd24){return new BPromise(function(_0x3c16dd,_0x145598){return client[_0x95d2('0xb')](_0x49df6d,_0x53bd24)[_0x95d2('0xc')](function(_0x2ac84c){logger[_0x95d2('0xd')](_0x95d2('0xe'),_0x49896f,'request\x20sent');logger[_0x95d2('0xf')](_0x95d2('0x10'),_0x49896f,_0x95d2('0x11'),JSON[_0x95d2('0x12')](_0x2ac84c));if(_0x2ac84c['error']){if(_0x2ac84c[_0x95d2('0x13')]['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x49896f,_0x2ac84c[_0x95d2('0x13')][_0x95d2('0x14')]);return _0x145598(_0x2ac84c[_0x95d2('0x13')][_0x95d2('0x14')]);}logger['error'](_0x95d2('0xe'),_0x49896f,_0x2ac84c[_0x95d2('0x13')][_0x95d2('0x14')]);return _0x3c16dd(_0x2ac84c['error'][_0x95d2('0x14')]);}else{logger['info'](_0x95d2('0xe'),_0x49896f,_0x95d2('0x11'));_0x3c16dd(_0x2ac84c[_0x95d2('0x15')][_0x95d2('0x14')]);}})[_0x95d2('0x16')](function(_0x30cfb5){logger[_0x95d2('0x13')](_0x95d2('0xe'),_0x49896f,_0x30cfb5);_0x145598(_0x30cfb5);});});}exports[_0x95d2('0x17')]=function(_0x55c202){var _0x56679e=this;return new Promise(function(_0x1a8e05,_0x1b9c46){return db['WhatsappMessage'][_0x95d2('0x18')](_0x55c202[_0x95d2('0x19')],{'raw':_0x55c202[_0x95d2('0x1a')]?_0x55c202[_0x95d2('0x1a')][_0x95d2('0x1b')]===undefined?!![]:![]:!![]})[_0x95d2('0xc')](function(_0x2b5588){logger[_0x95d2('0xd')]('CreateWhatsappMessage',_0x55c202);logger[_0x95d2('0xf')](_0x95d2('0x17'),_0x55c202,JSON[_0x95d2('0x12')](_0x2b5588));_0x1a8e05(_0x2b5588);})['catch'](function(_0x25f7e5){logger[_0x95d2('0x13')](_0x95d2('0x17'),_0x25f7e5[_0x95d2('0x14')],_0x55c202);_0x1b9c46(_0x56679e['error'](0x1f4,_0x25f7e5[_0x95d2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 1d67946..c47fb30 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 _0x3abc=['update','emit','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x3abc,0x1ef));var _0xc3ab=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x3abc[_0x376b45];return _0x2341b3;};'use strict';var WhatsappMessageEvents=require(_0xc3ab('0x0'));var events=[_0xc3ab('0x1'),'remove',_0xc3ab('0x2')];function createListener(_0x29fb65,_0x5de433){return function(_0x525868){_0x5de433[_0xc3ab('0x3')](_0x29fb65,_0x525868);};}function removeListener(_0x362dd4,_0x2b0b8a){return function(){WhatsappMessageEvents['removeListener'](_0x362dd4,_0x2b0b8a);};}exports[_0xc3ab('0x4')]=function(_0x37ddaa){for(var _0x4195fe=0x0,_0x5d993f=events[_0xc3ab('0x5')];_0x4195fe<_0x5d993f;_0x4195fe++){var _0x5d5b14=events[_0x4195fe];var _0x22e6c2=createListener(_0xc3ab('0x6')+_0x5d5b14,_0x37ddaa);WhatsappMessageEvents['on'](_0x5d5b14,_0x22e6c2);}}; \ No newline at end of file +var _0x2144=['length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x2144,0xfa));var _0x4214=function(_0x282916,_0x29c453){_0x282916=_0x282916-0x0;var _0x317b39=_0x2144[_0x282916];return _0x317b39;};'use strict';var WhatsappMessageEvents=require(_0x4214('0x0'));var events=[_0x4214('0x1'),_0x4214('0x2'),_0x4214('0x3')];function createListener(_0x244725,_0x2839e1){return function(_0x29c814){_0x2839e1[_0x4214('0x4')](_0x244725,_0x29c814);};}function removeListener(_0xb74f5,_0x40d444){return function(){WhatsappMessageEvents[_0x4214('0x5')](_0xb74f5,_0x40d444);};}exports['register']=function(_0x537148){for(var _0x218206=0x0,_0x310069=events[_0x4214('0x6')];_0x218206<_0x310069;_0x218206++){var _0x128f6c=events[_0x218206];var _0xb07e13=createListener(_0x4214('0x7')+_0x128f6c,_0x537148);WhatsappMessageEvents['on'](_0x128f6c,_0xb07e13);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 01c5533..16bc893 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 _0x0db4=['isAuthenticated','index','get','/describe','describe','/:id','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller'];(function(_0xc4038f,_0xdb8b49){var _0x780c5b=function(_0x14caa4){while(--_0x14caa4){_0xc4038f['push'](_0xc4038f['shift']());}};_0x780c5b(++_0xdb8b49);}(_0x0db4,0x118));var _0x40db=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0x0db4[_0x3b5049];return _0x12454e;};'use strict';var multer=require('multer');var util=require(_0x40db('0x0'));var path=require('path');var timeout=require(_0x40db('0x1'));var express=require(_0x40db('0x2'));var router=express['Router']();var auth=require(_0x40db('0x3'));var interaction=require(_0x40db('0x4'));var config=require('../../config/environment');var controller=require(_0x40db('0x5'));router['get']('/',auth[_0x40db('0x6')](),controller[_0x40db('0x7')]);router[_0x40db('0x8')](_0x40db('0x9'),auth[_0x40db('0x6')](),controller[_0x40db('0xa')]);router[_0x40db('0x8')](_0x40db('0xb'),auth[_0x40db('0x6')](),controller['show']);router['get'](_0x40db('0xc'),auth[_0x40db('0x6')](),controller['getMembers']);router[_0x40db('0x8')]('/:id/teams',auth[_0x40db('0x6')](),controller[_0x40db('0xd')]);router['get'](_0x40db('0xe'),auth[_0x40db('0x6')](),controller[_0x40db('0xf')]);router[_0x40db('0x10')]('/',auth[_0x40db('0x6')](),controller[_0x40db('0x11')]);router[_0x40db('0x10')](_0x40db('0x12'),auth[_0x40db('0x6')](),controller[_0x40db('0x13')]);router[_0x40db('0x10')](_0x40db('0xe'),auth[_0x40db('0x6')](),controller[_0x40db('0x14')]);router[_0x40db('0x15')](_0x40db('0xb'),auth[_0x40db('0x6')](),controller['update']);router[_0x40db('0x16')](_0x40db('0xb'),auth['isAuthenticated'](),controller[_0x40db('0x17')]);router[_0x40db('0x16')]('/:id/teams',auth[_0x40db('0x6')](),controller[_0x40db('0x18')]);router[_0x40db('0x16')](_0x40db('0xe'),auth[_0x40db('0x6')](),controller[_0x40db('0x19')]);module['exports']=router; \ No newline at end of file +var _0xb96f=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x22f7aa,_0x5c01d8){var _0x9f6274=function(_0x17cbc1){while(--_0x17cbc1){_0x22f7aa['push'](_0x22f7aa['shift']());}};_0x9f6274(++_0x5c01d8);}(_0xb96f,0x1dc));var _0xfb96=function(_0x48426e,_0x3b3815){_0x48426e=_0x48426e-0x0;var _0x16e4d6=_0xb96f[_0x48426e];return _0x16e4d6;};'use strict';var multer=require(_0xfb96('0x0'));var util=require(_0xfb96('0x1'));var path=require(_0xfb96('0x2'));var timeout=require(_0xfb96('0x3'));var express=require(_0xfb96('0x4'));var router=express[_0xfb96('0x5')]();var auth=require(_0xfb96('0x6'));var interaction=require(_0xfb96('0x7'));var config=require(_0xfb96('0x8'));var controller=require('./whatsappQueue.controller');router[_0xfb96('0x9')]('/',auth[_0xfb96('0xa')](),controller['index']);router['get'](_0xfb96('0xb'),auth[_0xfb96('0xa')](),controller[_0xfb96('0xc')]);router['get'](_0xfb96('0xd'),auth['isAuthenticated'](),controller[_0xfb96('0xe')]);router[_0xfb96('0x9')](_0xfb96('0xf'),auth['isAuthenticated'](),controller[_0xfb96('0x10')]);router[_0xfb96('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0xfb96('0x11')]);router[_0xfb96('0x9')](_0xfb96('0x12'),auth[_0xfb96('0xa')](),controller[_0xfb96('0x13')]);router[_0xfb96('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfb96('0x14')]('/:id/teams',auth[_0xfb96('0xa')](),controller[_0xfb96('0x15')]);router['post'](_0xfb96('0x12'),auth[_0xfb96('0xa')](),controller[_0xfb96('0x16')]);router[_0xfb96('0x17')](_0xfb96('0xd'),auth[_0xfb96('0xa')](),controller[_0xfb96('0x18')]);router['delete'](_0xfb96('0xd'),auth[_0xfb96('0xa')](),controller[_0xfb96('0x19')]);router['delete']('/:id/teams',auth[_0xfb96('0xa')](),controller[_0xfb96('0x1a')]);router[_0xfb96('0x1b')]('/:id/users',auth[_0xfb96('0xa')](),controller[_0xfb96('0x1c')]);module[_0xfb96('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index f6a9a9f..b476a1f 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 _0x5e33=['exports','STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x252782,_0x5b7839){var _0x5123ea=function(_0xbace4b){while(--_0xbace4b){_0x252782['push'](_0x252782['shift']());}};_0x5123ea(++_0x5b7839);}(_0x5e33,0x17f));var _0x35e3=function(_0x5c88be,_0x50952e){_0x5c88be=_0x5c88be-0x0;var _0x4f9281=_0x5e33[_0x5c88be];return _0x4f9281;};'use strict';var Sequelize=require(_0x35e3('0x0'));module[_0x35e3('0x1')]={'name':{'type':Sequelize[_0x35e3('0x2')],'unique':_0x35e3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x35e3('0x4')](_0x35e3('0x5'),_0x35e3('0x6'),_0x35e3('0x7'))},'description':{'type':Sequelize[_0x35e3('0x2')]}}; \ No newline at end of file +var _0x333e=['ENUM','rrmemory','beepall','sequelize','exports','STRING','INTEGER'];(function(_0x5e465a,_0x1aac73){var _0x451108=function(_0x51c6d1){while(--_0x51c6d1){_0x5e465a['push'](_0x5e465a['shift']());}};_0x451108(++_0x1aac73);}(_0x333e,0x161));var _0xe333=function(_0x4eb42d,_0x195d5c){_0x4eb42d=_0x4eb42d-0x0;var _0x46c92c=_0x333e[_0x4eb42d];return _0x46c92c;};'use strict';var Sequelize=require(_0xe333('0x0'));module[_0xe333('0x1')]={'name':{'type':Sequelize[_0xe333('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xe333('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe333('0x4')](_0xe333('0x5'),_0xe333('0x6'),'roundrobin')},'description':{'type':Sequelize[_0xe333('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 29b9db6..1ff9246 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 _0x5a28=['./whatsappQueue.socket','register','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','error','send','index','map','WhatsappQueue','rawAttributes','fieldName','model','name','query','filters','attributes','intersection','fields','length','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','User','agent','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','findAll','Agents','online','voicePause','interface','sequelize','transaction','each','emit','userWhatsappQueue:save','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','value','removeTeams','isEmpty','removeAgents','addAgents','spread','isArray','userWhatsappQueue:remove','getAgents','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0xb18948,_0x44499c){var _0x3eb80e=function(_0x1c09bb){while(--_0x1c09bb){_0xb18948['push'](_0xb18948['shift']());}};_0x3eb80e(++_0x44499c);}(_0x5a28,0x184));var _0x85a2=function(_0x24d711,_0x3cdb28){_0x24d711=_0x24d711-0x0;var _0x3491b4=_0x5a28[_0x24d711];return _0x3491b4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x85a2('0x0'));var rimraf=require(_0x85a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x85a2('0x2'));var rp=require(_0x85a2('0x3'));var moment=require(_0x85a2('0x4'));var BPromise=require(_0x85a2('0x5'));var Mustache=require(_0x85a2('0x6'));var util=require(_0x85a2('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x85a2('0x8'));var ejs=require(_0x85a2('0x9'));var fs=require('fs');var _=require(_0x85a2('0xa'));var squel=require('squel');var crypto=require(_0x85a2('0xb'));var jsforce=require(_0x85a2('0xc'));var deskjs=require(_0x85a2('0xd'));var toCsv=require(_0x85a2('0x8'));var querystring=require(_0x85a2('0xe'));var Papa=require(_0x85a2('0xf'));var Redis=require('ioredis');var authService=require(_0x85a2('0x10'));var qs=require(_0x85a2('0x11'));var as=require(_0x85a2('0x12'));var hardwareService=require(_0x85a2('0x13'));var logger=require(_0x85a2('0x14'))(_0x85a2('0x15'));var utils=require(_0x85a2('0x16'));var config=require(_0x85a2('0x17'));var licenseUtil=require(_0x85a2('0x18'));var db=require(_0x85a2('0x19'))['db'];config[_0x85a2('0x1a')]=_[_0x85a2('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x85a2('0x1c'))(new Redis(config['redis']));require(_0x85a2('0x1d'))[_0x85a2('0x1e')](socket);function respondWithStatusCode(_0x5a0144,_0x231a04){_0x231a04=_0x231a04||0xcc;return function(_0x79d1a2){if(_0x79d1a2){return _0x5a0144[_0x85a2('0x1f')](_0x231a04);}return _0x5a0144[_0x85a2('0x20')](_0x231a04)[_0x85a2('0x21')]();};}function respondWithResult(_0x4ccc94,_0x1a1856){_0x1a1856=_0x1a1856||0xc8;return function(_0x26530d){if(_0x26530d){return _0x4ccc94[_0x85a2('0x20')](_0x1a1856)['json'](_0x26530d);}};}function respondWithFilteredResult(_0x4dd91b,_0x2d2716){return function(_0xab09f7){if(_0xab09f7){var _0x2640c6=_0xab09f7[_0x85a2('0x22')],_0x19df45=_0x2d2716[_0x85a2('0x23')],_0x2ad6cb=_0x2d2716[_0x85a2('0x23')]+_0x2d2716['limit'],_0x1888e0;if(_0x2ad6cb>=_0x2640c6){_0x2ad6cb=_0x2640c6;_0x1888e0=0xc8;}else{_0x1888e0=0xce;}_0x4dd91b[_0x85a2('0x20')](_0x1888e0);return _0x4dd91b[_0x85a2('0x24')](_0x85a2('0x25'),_0x19df45+'-'+_0x2ad6cb+'/'+_0x2640c6)['json'](_0xab09f7);}return null;};}function patchUpdates(_0x10bffa){return function(_0x41b75f){try{jsonpatch[_0x85a2('0x26')](_0x41b75f,_0x10bffa,!![]);}catch(_0x2d4a12){return BPromise[_0x85a2('0x27')](_0x2d4a12);}return _0x41b75f[_0x85a2('0x28')]();};}function saveUpdates(_0x18a872,_0x2b2baf){return function(_0x5c6df9){if(_0x5c6df9){return _0x5c6df9[_0x85a2('0x29')](_0x18a872)['then'](function(_0x5757e7){return _0x5757e7;});}return null;};}function removeEntity(_0x1f5300,_0x206606){return function(_0x43da56){if(_0x43da56){return _0x43da56[_0x85a2('0x2a')]()['then'](function(){var _0x32346e=_0x43da56[_0x85a2('0x2b')]({'plain':!![]});var _0x44714d='WhatsappQueues';return db[_0x85a2('0x2c')][_0x85a2('0x2a')]({'where':{'type':_0x44714d,'resourceId':_0x32346e['id']}})[_0x85a2('0x2d')](function(){return _0x43da56;});})[_0x85a2('0x2d')](function(){_0x1f5300[_0x85a2('0x20')](0xcc)[_0x85a2('0x21')]();});}};}function handleEntityNotFound(_0x5d6642,_0x2e0de9){return function(_0x3564ae){if(!_0x3564ae){_0x5d6642[_0x85a2('0x1f')](0x194);}return _0x3564ae;};}function handleError(_0x17b435,_0xfd771b){_0xfd771b=_0xfd771b||0x1f4;return function(_0x5c38a9){logger[_0x85a2('0x2e')](_0x5c38a9['stack']);if(_0x5c38a9['name']){delete _0x5c38a9['name'];}_0x17b435[_0x85a2('0x20')](_0xfd771b)[_0x85a2('0x2f')](_0x5c38a9);};}exports[_0x85a2('0x30')]=function(_0x3287e2,_0x2b4631){var _0x3f0e6c={},_0x3d36e4={},_0x45986a={'count':0x0,'rows':[]};var _0x537058=_[_0x85a2('0x31')](db[_0x85a2('0x32')][_0x85a2('0x33')],function(_0xc4bd86){return{'name':_0xc4bd86[_0x85a2('0x34')],'type':_0xc4bd86['type']['key']};});_0x3d36e4[_0x85a2('0x35')]=_[_0x85a2('0x31')](_0x537058,_0x85a2('0x36'));_0x3d36e4['query']=_['keys'](_0x3287e2[_0x85a2('0x37')]);_0x3d36e4[_0x85a2('0x38')]=_['intersection'](_0x3d36e4[_0x85a2('0x35')],_0x3d36e4[_0x85a2('0x37')]);_0x3f0e6c[_0x85a2('0x39')]=_[_0x85a2('0x3a')](_0x3d36e4[_0x85a2('0x35')],qs[_0x85a2('0x3b')](_0x3287e2[_0x85a2('0x37')][_0x85a2('0x3b')]));_0x3f0e6c[_0x85a2('0x39')]=_0x3f0e6c[_0x85a2('0x39')][_0x85a2('0x3c')]?_0x3f0e6c[_0x85a2('0x39')]:_0x3d36e4['model'];if(!_0x3287e2[_0x85a2('0x37')]['hasOwnProperty']('nolimit')){_0x3f0e6c[_0x85a2('0x3d')]=qs[_0x85a2('0x3d')](_0x3287e2[_0x85a2('0x37')][_0x85a2('0x3d')]);_0x3f0e6c['offset']=qs[_0x85a2('0x23')](_0x3287e2[_0x85a2('0x37')][_0x85a2('0x23')]);}_0x3f0e6c[_0x85a2('0x3e')]=qs[_0x85a2('0x3f')](_0x3287e2[_0x85a2('0x37')][_0x85a2('0x3f')]);_0x3f0e6c[_0x85a2('0x40')]=qs[_0x85a2('0x38')](_[_0x85a2('0x41')](_0x3287e2[_0x85a2('0x37')],_0x3d36e4[_0x85a2('0x38')]),_0x537058);if(_0x3287e2['query'][_0x85a2('0x42')]){_0x3f0e6c[_0x85a2('0x40')]=_[_0x85a2('0x43')](_0x3f0e6c[_0x85a2('0x40')],{'$or':_[_0x85a2('0x31')](_0x537058,function(_0x2485c5){if(_0x2485c5[_0x85a2('0x44')]!==_0x85a2('0x45')){var _0x3f8bae={};_0x3f8bae[_0x2485c5[_0x85a2('0x36')]]={'$like':'%'+_0x3287e2[_0x85a2('0x37')][_0x85a2('0x42')]+'%'};return _0x3f8bae;}})});}_0x3f0e6c=_['merge']({},_0x3f0e6c,_0x3287e2[_0x85a2('0x46')]);var _0x57266={'where':_0x3f0e6c[_0x85a2('0x40')]};return db[_0x85a2('0x32')][_0x85a2('0x22')](_0x57266)[_0x85a2('0x2d')](function(_0x21aa30){_0x45986a[_0x85a2('0x22')]=_0x21aa30;if(_0x3287e2[_0x85a2('0x37')][_0x85a2('0x47')]){_0x3f0e6c[_0x85a2('0x48')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x3f0e6c);})[_0x85a2('0x2d')](function(_0x311851){_0x45986a[_0x85a2('0x49')]=_0x311851;return _0x45986a;})[_0x85a2('0x2d')](respondWithFilteredResult(_0x2b4631,_0x3f0e6c))[_0x85a2('0x4a')](handleError(_0x2b4631,null));};exports[_0x85a2('0x4b')]=function(_0x902fcc,_0x43bf8e){var _0x29c098={'raw':!![],'where':{'id':_0x902fcc['params']['id']}},_0xf5b22a={};_0xf5b22a[_0x85a2('0x35')]=_[_0x85a2('0x4c')](db[_0x85a2('0x32')][_0x85a2('0x33')]);_0xf5b22a[_0x85a2('0x37')]=_[_0x85a2('0x4c')](_0x902fcc[_0x85a2('0x37')]);_0xf5b22a['filters']=_['intersection'](_0xf5b22a[_0x85a2('0x35')],_0xf5b22a[_0x85a2('0x37')]);_0x29c098['attributes']=_[_0x85a2('0x3a')](_0xf5b22a[_0x85a2('0x35')],qs['fields'](_0x902fcc[_0x85a2('0x37')]['fields']));_0x29c098[_0x85a2('0x39')]=_0x29c098[_0x85a2('0x39')][_0x85a2('0x3c')]?_0x29c098[_0x85a2('0x39')]:_0xf5b22a[_0x85a2('0x35')];if(_0x902fcc[_0x85a2('0x37')][_0x85a2('0x47')]){_0x29c098[_0x85a2('0x48')]=[{'all':!![]}];}_0x29c098=_[_0x85a2('0x43')]({},_0x29c098,_0x902fcc['options']);return db['WhatsappQueue'][_0x85a2('0x4d')](_0x29c098)[_0x85a2('0x2d')](handleEntityNotFound(_0x43bf8e,null))[_0x85a2('0x2d')](respondWithResult(_0x43bf8e,null))[_0x85a2('0x4a')](handleError(_0x43bf8e,null));};exports[_0x85a2('0x4e')]=function(_0xb8a8d4,_0x17a3ed){return db['WhatsappQueue']['create'](_0xb8a8d4[_0x85a2('0x4f')],{})[_0x85a2('0x2d')](function(_0x5596f2){var _0x4ae12c=_0xb8a8d4[_0x85a2('0x50')][_0x85a2('0x2b')]({'plain':!![]});if(!_0x4ae12c)throw new Error(_0x85a2('0x51'));if(_0x4ae12c[_0x85a2('0x52')]===_0x85a2('0x50')){var _0x985a9=_0x5596f2[_0x85a2('0x2b')]({'plain':!![]});var _0x507e3d=_0x85a2('0x53');return db[_0x85a2('0x54')]['find']({'where':{'name':_0x507e3d,'userProfileId':_0x4ae12c[_0x85a2('0x55')]},'raw':!![]})[_0x85a2('0x2d')](function(_0x47bc28){if(_0x47bc28&&_0x47bc28[_0x85a2('0x56')]===0x0){return db[_0x85a2('0x2c')][_0x85a2('0x4e')]({'name':_0x985a9[_0x85a2('0x36')],'resourceId':_0x985a9['id'],'type':_0x47bc28['name'],'sectionId':_0x47bc28['id']},{})['then'](function(){return _0x5596f2;});}else{return _0x5596f2;}})[_0x85a2('0x4a')](function(_0x29dd5a){logger['error'](_0x85a2('0x57'),_0x29dd5a);throw _0x29dd5a;});}return _0x5596f2;})[_0x85a2('0x2d')](respondWithResult(_0x17a3ed,0xc9))[_0x85a2('0x4a')](handleError(_0x17a3ed,null));};exports[_0x85a2('0x29')]=function(_0x37132f,_0x1962d5){if(_0x37132f[_0x85a2('0x4f')]['id']){delete _0x37132f[_0x85a2('0x4f')]['id'];}return db['WhatsappQueue'][_0x85a2('0x4d')]({'where':{'id':_0x37132f['params']['id']}})[_0x85a2('0x2d')](handleEntityNotFound(_0x1962d5,null))[_0x85a2('0x2d')](saveUpdates(_0x37132f[_0x85a2('0x4f')],null))[_0x85a2('0x2d')](respondWithResult(_0x1962d5,null))['catch'](handleError(_0x1962d5,null));};exports[_0x85a2('0x2a')]=function(_0xa4cbcb,_0x116f11){return db[_0x85a2('0x32')]['find']({'where':{'id':_0xa4cbcb[_0x85a2('0x58')]['id']}})[_0x85a2('0x2d')](handleEntityNotFound(_0x116f11,null))[_0x85a2('0x2d')](removeEntity(_0x116f11,null))[_0x85a2('0x4a')](handleError(_0x116f11,null));};exports[_0x85a2('0x59')]=function(_0x10609a,_0x92b580){return db['WhatsappQueue'][_0x85a2('0x59')]()[_0x85a2('0x2d')](respondWithResult(_0x92b580,null))[_0x85a2('0x4a')](handleError(_0x92b580,null));};exports[_0x85a2('0x5a')]=function(_0x7eaab5,_0x2bfbd5,_0x31fe7b){var _0xf917c={'raw':!![],'where':{}},_0x1871cb={},_0x5dc220;return db['WhatsappQueue'][_0x85a2('0x5b')]({'where':{'id':_0x7eaab5[_0x85a2('0x58')]['id']}})[_0x85a2('0x2d')](handleEntityNotFound(_0x2bfbd5,null))['then'](function(_0x1d634e){if(_0x1d634e){_0x5dc220=_0x1d634e['get']({'plain':!![]});_0x1871cb[_0x85a2('0x35')]=_[_0x85a2('0x4c')](db[_0x85a2('0x5c')][_0x85a2('0x33')]);_0x1871cb[_0x85a2('0x37')]=_[_0x85a2('0x4c')](_0x7eaab5['query']);_0x1871cb[_0x85a2('0x38')]=_[_0x85a2('0x3a')](_0x1871cb[_0x85a2('0x35')],_0x1871cb[_0x85a2('0x37')]);_0xf917c[_0x85a2('0x39')]=_[_0x85a2('0x3a')](_0x1871cb[_0x85a2('0x35')],qs[_0x85a2('0x3b')](_0x7eaab5[_0x85a2('0x37')]['fields']));_0xf917c[_0x85a2('0x39')]=_0xf917c['attributes'][_0x85a2('0x3c')]?_0xf917c['attributes']:_0x1871cb[_0x85a2('0x35')];if(!_0x7eaab5[_0x85a2('0x37')][_0x85a2('0x5d')]('nolimit')){_0xf917c[_0x85a2('0x3d')]=qs['limit'](_0x7eaab5[_0x85a2('0x37')][_0x85a2('0x3d')]);_0xf917c[_0x85a2('0x23')]=qs[_0x85a2('0x23')](_0x7eaab5[_0x85a2('0x37')]['offset']);}_0xf917c[_0x85a2('0x3e')]=qs[_0x85a2('0x3f')](_0x7eaab5['query'][_0x85a2('0x3f')]);_0xf917c[_0x85a2('0x40')]=qs[_0x85a2('0x38')](_[_0x85a2('0x41')](_0x7eaab5[_0x85a2('0x37')],_0x1871cb[_0x85a2('0x38')]));_0xf917c[_0x85a2('0x40')][_0x85a2('0x5e')]=_0x1d634e['id'];if(_0x7eaab5[_0x85a2('0x37')][_0x85a2('0x42')]){_0xf917c[_0x85a2('0x40')]=_[_0x85a2('0x43')](_0xf917c[_0x85a2('0x40')],{'$or':_['map'](_0xf917c['attributes'],function(_0x26ed1a){var _0x48da5c={};_0x48da5c[_0x26ed1a]={'$like':'%'+_0x7eaab5[_0x85a2('0x37')]['filter']+'%'};return _0x48da5c;})});}_0xf917c=_['merge']({},_0xf917c,_0x7eaab5['options']);return db['UserWhatsappQueue']['findAll'](_0xf917c);}})[_0x85a2('0x2d')](function(_0x21ca17){if(_0x21ca17){return db[_0x85a2('0x5f')]['findAndCountAll']({'where':{'id':_[_0x85a2('0x31')](_0x21ca17,'UserId'),'role':_0x85a2('0x60')},'attributes':['id',_0x85a2('0x36'),'whatsappPause',_0x85a2('0x61'),_0x85a2('0x62')]});}})['then'](function(_0x5d221d){if(_0x5d221d){return{'count':_0x5d221d[_0x85a2('0x22')],'rows':_['map'](_0x5d221d[_0x85a2('0x49')],function(_0x15d3c3){return{'membername':_0x15d3c3['name'],'UserId':_0x15d3c3['id'],'queue_name':_0x5dc220['name'],'WhatsappQueueId':_0x5dc220['id'],'interface':util['format'](_0x85a2('0x63'),_0x85a2('0x64'),_0x15d3c3[_0x85a2('0x36')]),'penalty':0x0,'paused':_0x15d3c3['whatsappPause'],'createdAt':_0x15d3c3[_0x85a2('0x62')],'updatedAt':_0x15d3c3[_0x85a2('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2bfbd5,_0xf917c))[_0x85a2('0x4a')](handleError(_0x2bfbd5,null));};exports[_0x85a2('0x65')]=function(_0x355661,_0x31a7f6,_0x376cad){var _0x53346c={};var _0x25d43f={};var _0x38ff2c;var _0x2e66e6;return db['WhatsappQueue'][_0x85a2('0x5b')]({'where':{'id':_0x355661['params']['id']}})[_0x85a2('0x2d')](handleEntityNotFound(_0x31a7f6,null))[_0x85a2('0x2d')](function(_0x40015d){if(_0x40015d){_0x38ff2c=_0x40015d;_0x25d43f[_0x85a2('0x35')]=_[_0x85a2('0x4c')](db['Team']['rawAttributes']);_0x25d43f['query']=_['keys'](_0x355661[_0x85a2('0x37')]);_0x25d43f[_0x85a2('0x38')]=_[_0x85a2('0x3a')](_0x25d43f[_0x85a2('0x35')],_0x25d43f[_0x85a2('0x37')]);_0x53346c['attributes']=_['intersection'](_0x25d43f[_0x85a2('0x35')],qs[_0x85a2('0x3b')](_0x355661['query'][_0x85a2('0x3b')]));_0x53346c[_0x85a2('0x39')]=_0x53346c[_0x85a2('0x39')][_0x85a2('0x3c')]?_0x53346c['attributes']:_0x25d43f[_0x85a2('0x35')];_0x53346c[_0x85a2('0x3e')]=qs['sort'](_0x355661[_0x85a2('0x37')]['sort']);_0x53346c['where']=qs[_0x85a2('0x38')](_['pick'](_0x355661[_0x85a2('0x37')],_0x25d43f[_0x85a2('0x38')]));if(_0x355661[_0x85a2('0x37')][_0x85a2('0x42')]){_0x53346c[_0x85a2('0x40')]=_[_0x85a2('0x43')](_0x53346c['where'],{'$or':_[_0x85a2('0x31')](_0x53346c['attributes'],function(_0x7c3781){var _0x146112={};_0x146112[_0x7c3781]={'$like':'%'+_0x355661['query'][_0x85a2('0x42')]+'%'};return _0x146112;})});}_0x53346c=_[_0x85a2('0x43')]({},_0x53346c,_0x355661['options']);return _0x38ff2c['getTeams'](_0x53346c);}})[_0x85a2('0x2d')](function(_0x59bff7){if(_0x59bff7){_0x2e66e6=_0x59bff7[_0x85a2('0x3c')];if(!_0x355661[_0x85a2('0x37')][_0x85a2('0x5d')]('nolimit')){_0x53346c['limit']=qs['limit'](_0x355661[_0x85a2('0x37')][_0x85a2('0x3d')]);_0x53346c[_0x85a2('0x23')]=qs[_0x85a2('0x23')](_0x355661['query'][_0x85a2('0x23')]);}return _0x38ff2c[_0x85a2('0x65')](_0x53346c);}})['then'](function(_0x50a3ce){if(_0x50a3ce){return _0x50a3ce?{'count':_0x2e66e6,'rows':_0x50a3ce}:null;}})[_0x85a2('0x2d')](respondWithResult(_0x31a7f6,null))[_0x85a2('0x4a')](handleError(_0x31a7f6,null));};exports[_0x85a2('0x66')]=function(_0x26803b,_0x508b18,_0x38a7d2){var _0x12a5fb=_0x26803b['body'][_0x85a2('0x67')];return db[_0x85a2('0x68')][_0x85a2('0x69')]({'where':{'id':_0x12a5fb},'attributes':['id'],'include':[{'model':db[_0x85a2('0x5f')],'as':_0x85a2('0x6a'),'attributes':['id',_0x85a2('0x36'),_0x85a2('0x6b'),_0x85a2('0x6c'),_0x85a2('0x6d')],'raw':!![]}]})['then'](function(_0x1bde20){if(_0x1bde20){var _0x3b89e2=_['flatMap'](_0x1bde20,function(_0x486b9a){var _0x41d329=_0x486b9a[_0x85a2('0x2b')]({'plain':!![]});return _0x41d329['Agents'];});return db[_0x85a2('0x32')][_0x85a2('0x4d')]({'where':{'id':_0x26803b[_0x85a2('0x58')]['id']}})[_0x85a2('0x2d')](function(_0x38c146){return db[_0x85a2('0x6e')][_0x85a2('0x6f')](function(_0x395ed7){return _0x38c146[_0x85a2('0x66')](_0x12a5fb,{'transaction':_0x395ed7})[_0x85a2('0x2d')](function(){return BPromise[_0x85a2('0x70')](_0x3b89e2,function(_0x1b8d3d){return db[_0x85a2('0x5c')]['findOrCreate']({'where':{'UserId':_0x1b8d3d['id'],'WhatsappQueueId':_0x26803b[_0x85a2('0x58')]['id']},'transaction':_0x395ed7});});})[_0x85a2('0x2d')](function(){_0x3b89e2['forEach'](function(_0x5de65b){socket[_0x85a2('0x71')](_0x85a2('0x72'),{'UserId':_0x5de65b['id'],'WhatsappQueueId':_0x38c146['id']});});});});});}})[_0x85a2('0x2d')](respondWithStatusCode(_0x508b18,null))[_0x85a2('0x4a')](handleError(_0x508b18,null));};exports['removeTeams']=function(_0x386f4e,_0x453d96,_0x261dee){return db[_0x85a2('0x68')]['findAll']({'where':{'id':_0x386f4e[_0x85a2('0x37')][_0x85a2('0x67')]},'attributes':['id'],'include':[{'model':db[_0x85a2('0x5f')],'as':_0x85a2('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x453d96,null))['then'](function(_0x2e04ca){var _0x2c497a=_[_0x85a2('0x31')](_0x2e04ca,'id');var _0x500def=[];var _0x562223=[];var _0x385e73=squel['select']();_0x385e73['field'](_0x85a2('0x73'))[_0x85a2('0x74')](_0x85a2('0x75'),'tq')['join'](_0x85a2('0x76'),'ut',_0x85a2('0x77'))[_0x85a2('0x40')](_0x85a2('0x78'),_0x386f4e[_0x85a2('0x58')]['id']);for(var _0x4db411=0x0;_0x4db411<_0x2e04ca[_0x85a2('0x3c')];_0x4db411+=0x1){let _0x32dcb0=_0x2e04ca[_0x4db411];for(var _0x45efe3=0x0;_0x45efe3<_0x32dcb0[_0x85a2('0x6a')][_0x85a2('0x3c')];_0x45efe3+=0x1){let _0x5ed006=_0x32dcb0[_0x85a2('0x6a')][_0x45efe3];var _0x4c72f0=_0x385e73[_0x85a2('0x79')]();_0x4c72f0[_0x85a2('0x40')](_0x85a2('0x7a'),_0x5ed006['id']);_0x562223[_0x85a2('0x7b')](db[_0x85a2('0x6e')][_0x85a2('0x37')](_0x4c72f0['toString'](),{'type':db[_0x85a2('0x6e')][_0x85a2('0x7c')]['SELECT']})[_0x85a2('0x2d')](function(_0x1c623f){if(_0x1c623f['length']===0x1){return _0x5ed006['id'];}else{var _0x225698=_[_0x85a2('0x7d')](_[_0x85a2('0x31')](_0x1c623f,_0x85a2('0x7e')),function(_0x2b8655){return _[_0x85a2('0x7f')](_0x2c497a,_0x2b8655);});if(_0x225698){return _0x5ed006['id'];}}}));}}return BPromise[_0x85a2('0x80')](_0x562223)['then'](function(_0x490cc2){_0x500def=_(_0x500def)['union'](_0x490cc2)['compact']()[_0x85a2('0x81')]();return db[_0x85a2('0x32')][_0x85a2('0x4d')]({'where':{'id':_0x386f4e[_0x85a2('0x58')]['id']}})['then'](function(_0x4a304d){return db['sequelize']['transaction'](function(_0x350f16){return _0x4a304d[_0x85a2('0x82')](_0x386f4e[_0x85a2('0x37')]['ids'],{'transaction':_0x350f16})[_0x85a2('0x2d')](function(){if(!_[_0x85a2('0x83')](_0x500def)){return _0x4a304d[_0x85a2('0x84')](_0x500def,{'transaction':_0x350f16});}})[_0x85a2('0x2d')](function(){_0x500def['forEach'](function(_0x1c4795){socket[_0x85a2('0x71')]('userWhatsappQueue:remove',{'UserId':_0x1c4795,'WhatsappQueueId':_0x4a304d['id']});});});});});});})['then'](respondWithStatusCode(_0x453d96,null))[_0x85a2('0x4a')](handleError(_0x453d96,null));};exports[_0x85a2('0x85')]=function(_0x17e8bd,_0x13a2be,_0x2ed1a1){return db['WhatsappQueue'][_0x85a2('0x4d')]({'where':{'id':_0x17e8bd[_0x85a2('0x58')]['id']}})['then'](handleEntityNotFound(_0x13a2be,null))[_0x85a2('0x2d')](function(_0x3b71d1){if(_0x3b71d1){return _0x3b71d1[_0x85a2('0x85')](_0x17e8bd[_0x85a2('0x4f')][_0x85a2('0x67')],_['omit'](_0x17e8bd[_0x85a2('0x4f')],[_0x85a2('0x67'),'id'])||{})[_0x85a2('0x86')](function(_0x19ac87){for(var _0x1670d8=0x0;_0x1670d8<_0x17e8bd['body'][_0x85a2('0x67')][_0x85a2('0x3c')];_0x1670d8+=0x1){socket[_0x85a2('0x71')]('userWhatsappQueue:save',{'UserId':_0x17e8bd['body'][_0x85a2('0x67')][_0x1670d8],'WhatsappQueueId':_0x17e8bd[_0x85a2('0x58')]['id']});}return _0x19ac87;});}})[_0x85a2('0x2d')](respondWithResult(_0x13a2be,null))[_0x85a2('0x4a')](handleError(_0x13a2be,null));};exports[_0x85a2('0x84')]=function(_0xb6b4d8,_0x1c2356,_0x283aeb){return db['WhatsappQueue'][_0x85a2('0x4d')]({'where':{'id':_0xb6b4d8['params']['id']}})[_0x85a2('0x2d')](handleEntityNotFound(_0x1c2356,null))[_0x85a2('0x2d')](function(_0x3cfa9f){if(_0x3cfa9f){return _0x3cfa9f[_0x85a2('0x84')](_0xb6b4d8[_0x85a2('0x37')][_0x85a2('0x67')])[_0x85a2('0x2d')](function(){if(_[_0x85a2('0x87')](_0xb6b4d8[_0x85a2('0x37')][_0x85a2('0x67')])){for(var _0x1b4862=0x0;_0x1b4862<_0xb6b4d8[_0x85a2('0x37')][_0x85a2('0x67')][_0x85a2('0x3c')];_0x1b4862+=0x1){socket[_0x85a2('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0xb6b4d8['query'][_0x85a2('0x67')][_0x1b4862]),'WhatsappQueueId':Number(_0xb6b4d8['params']['id'])});}}else{socket[_0x85a2('0x71')](_0x85a2('0x88'),{'UserId':Number(_0xb6b4d8[_0x85a2('0x37')][_0x85a2('0x67')]),'WhatsappQueueId':Number(_0xb6b4d8['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1c2356,null))['catch'](handleError(_0x1c2356,null));};exports[_0x85a2('0x89')]=function(_0x16c59a,_0xb43c1a,_0x2c1440){var _0x4eba39={};var _0x18232f={};var _0xbac13e;var _0x3df49e;return db[_0x85a2('0x32')][_0x85a2('0x5b')]({'where':{'id':_0x16c59a[_0x85a2('0x58')]['id']}})[_0x85a2('0x2d')](handleEntityNotFound(_0xb43c1a,null))[_0x85a2('0x2d')](function(_0x3a9c24){if(_0x3a9c24){_0xbac13e=_0x3a9c24;_0x18232f[_0x85a2('0x35')]=_[_0x85a2('0x4c')](db['User'][_0x85a2('0x33')]);_0x18232f[_0x85a2('0x37')]=_[_0x85a2('0x4c')](_0x16c59a['query']);_0x18232f[_0x85a2('0x38')]=_[_0x85a2('0x3a')](_0x18232f[_0x85a2('0x35')],_0x18232f[_0x85a2('0x37')]);_0x4eba39[_0x85a2('0x39')]=_[_0x85a2('0x3a')](_0x18232f[_0x85a2('0x35')],qs[_0x85a2('0x3b')](_0x16c59a['query'][_0x85a2('0x3b')]));_0x4eba39['attributes']=_0x4eba39[_0x85a2('0x39')][_0x85a2('0x3c')]?_0x4eba39[_0x85a2('0x39')]:_0x18232f[_0x85a2('0x35')];_0x4eba39['order']=qs[_0x85a2('0x3f')](_0x16c59a['query'][_0x85a2('0x3f')]);_0x4eba39['where']=qs[_0x85a2('0x38')](_['pick'](_0x16c59a[_0x85a2('0x37')],_0x18232f[_0x85a2('0x38')]));if(_0x16c59a[_0x85a2('0x37')][_0x85a2('0x42')]){_0x4eba39[_0x85a2('0x40')]=_[_0x85a2('0x43')](_0x4eba39['where'],{'$or':_['map'](_0x4eba39[_0x85a2('0x39')],function(_0x3a77c7){var _0x1d933a={};_0x1d933a[_0x3a77c7]={'$like':'%'+_0x16c59a[_0x85a2('0x37')][_0x85a2('0x42')]+'%'};return _0x1d933a;})});}_0x4eba39=_[_0x85a2('0x43')]({},_0x4eba39,_0x16c59a[_0x85a2('0x46')]);return _0xbac13e[_0x85a2('0x89')](_0x4eba39);}})['then'](function(_0x5eebba){if(_0x5eebba){_0x3df49e=_0x5eebba[_0x85a2('0x3c')];if(!_0x16c59a[_0x85a2('0x37')][_0x85a2('0x5d')](_0x85a2('0x8a'))){_0x4eba39['limit']=qs[_0x85a2('0x3d')](_0x16c59a['query'][_0x85a2('0x3d')]);_0x4eba39[_0x85a2('0x23')]=qs[_0x85a2('0x23')](_0x16c59a[_0x85a2('0x37')][_0x85a2('0x23')]);}return _0xbac13e[_0x85a2('0x89')](_0x4eba39);}})[_0x85a2('0x2d')](function(_0x4d194b){if(_0x4d194b){return _0x4d194b?{'count':_0x3df49e,'rows':_0x4d194b}:null;}})[_0x85a2('0x2d')](respondWithResult(_0xb43c1a,null))[_0x85a2('0x4a')](handleError(_0xb43c1a,null));}; \ No newline at end of file +var _0x430c=['name','send','index','WhatsappQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','find','create','body','user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','params','destroy','describe','getMembers','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','SIP','whatsappPause','getTeams','findOne','Team','order','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','union','compact','value','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','error','stack'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x430c,0x177));var _0xc430=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0x430c[_0x4cd690];return _0x4a74a9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc430('0x1'));var jsonpatch=require(_0xc430('0x2'));var rp=require(_0xc430('0x3'));var moment=require(_0xc430('0x4'));var BPromise=require(_0xc430('0x5'));var Mustache=require(_0xc430('0x6'));var util=require(_0xc430('0x7'));var path=require('path');var sox=require(_0xc430('0x8'));var csv=require('to-csv');var ejs=require(_0xc430('0x9'));var fs=require('fs');var _=require(_0xc430('0xa'));var squel=require(_0xc430('0xb'));var crypto=require(_0xc430('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc430('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc430('0xe'));var Redis=require('ioredis');var authService=require(_0xc430('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0x10'));var hardwareService=require(_0xc430('0x11'));var logger=require('../../config/logger')(_0xc430('0x12'));var utils=require(_0xc430('0x13'));var config=require(_0xc430('0x14'));var licenseUtil=require(_0xc430('0x15'));var db=require(_0xc430('0x16'))['db'];config['redis']=_[_0xc430('0x17')](config[_0xc430('0x18')],{'host':_0xc430('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc430('0x18')]));require('./whatsappQueue.socket')[_0xc430('0x1a')](socket);function respondWithStatusCode(_0x24cc14,_0x385d8e){_0x385d8e=_0x385d8e||0xcc;return function(_0x173c53){if(_0x173c53){return _0x24cc14[_0xc430('0x1b')](_0x385d8e);}return _0x24cc14[_0xc430('0x1c')](_0x385d8e)[_0xc430('0x1d')]();};}function respondWithResult(_0x213097,_0x587111){_0x587111=_0x587111||0xc8;return function(_0x12f7aa){if(_0x12f7aa){return _0x213097[_0xc430('0x1c')](_0x587111)[_0xc430('0x1e')](_0x12f7aa);}};}function respondWithFilteredResult(_0x55f614,_0x2a23e0){return function(_0x30e539){if(_0x30e539){var _0x4cd465=_0x30e539[_0xc430('0x1f')],_0x1f06e2=_0x2a23e0[_0xc430('0x20')],_0x2cb762=_0x2a23e0[_0xc430('0x20')]+_0x2a23e0[_0xc430('0x21')],_0x2d37f2;if(_0x2cb762>=_0x4cd465){_0x2cb762=_0x4cd465;_0x2d37f2=0xc8;}else{_0x2d37f2=0xce;}_0x55f614[_0xc430('0x1c')](_0x2d37f2);return _0x55f614[_0xc430('0x22')](_0xc430('0x23'),_0x1f06e2+'-'+_0x2cb762+'/'+_0x4cd465)['json'](_0x30e539);}return null;};}function patchUpdates(_0x4df122){return function(_0x1a4343){try{jsonpatch[_0xc430('0x24')](_0x1a4343,_0x4df122,!![]);}catch(_0x17eb1d){return BPromise[_0xc430('0x25')](_0x17eb1d);}return _0x1a4343[_0xc430('0x26')]();};}function saveUpdates(_0x25af75,_0x26e1a9){return function(_0x750f90){if(_0x750f90){return _0x750f90[_0xc430('0x27')](_0x25af75)['then'](function(_0x1e71a2){return _0x1e71a2;});}return null;};}function removeEntity(_0x209448,_0xccb922){return function(_0x1cd091){if(_0x1cd091){return _0x1cd091['destroy']()[_0xc430('0x28')](function(){var _0x4c6729=_0x1cd091[_0xc430('0x29')]({'plain':!![]});var _0x223d3b='WhatsappQueues';return db[_0xc430('0x2a')]['destroy']({'where':{'type':_0x223d3b,'resourceId':_0x4c6729['id']}})[_0xc430('0x28')](function(){return _0x1cd091;});})[_0xc430('0x28')](function(){_0x209448[_0xc430('0x1c')](0xcc)[_0xc430('0x1d')]();});}};}function handleEntityNotFound(_0x124468,_0x369471){return function(_0x239deb){if(!_0x239deb){_0x124468[_0xc430('0x1b')](0x194);}return _0x239deb;};}function handleError(_0x1808d7,_0x324ef5){_0x324ef5=_0x324ef5||0x1f4;return function(_0x3ca64a){logger[_0xc430('0x2b')](_0x3ca64a[_0xc430('0x2c')]);if(_0x3ca64a[_0xc430('0x2d')]){delete _0x3ca64a[_0xc430('0x2d')];}_0x1808d7[_0xc430('0x1c')](_0x324ef5)[_0xc430('0x2e')](_0x3ca64a);};}exports[_0xc430('0x2f')]=function(_0x539557,_0x631e72){var _0x558f8f={},_0x46aa37={},_0x4a2c08={'count':0x0,'rows':[]};var _0x16a614=_['map'](db[_0xc430('0x30')][_0xc430('0x31')],function(_0x3fe59d){return{'name':_0x3fe59d[_0xc430('0x32')],'type':_0x3fe59d[_0xc430('0x33')]['key']};});_0x46aa37[_0xc430('0x34')]=_[_0xc430('0x35')](_0x16a614,'name');_0x46aa37[_0xc430('0x36')]=_[_0xc430('0x37')](_0x539557[_0xc430('0x36')]);_0x46aa37[_0xc430('0x38')]=_['intersection'](_0x46aa37['model'],_0x46aa37[_0xc430('0x36')]);_0x558f8f[_0xc430('0x39')]=_[_0xc430('0x3a')](_0x46aa37[_0xc430('0x34')],qs['fields'](_0x539557[_0xc430('0x36')][_0xc430('0x3b')]));_0x558f8f['attributes']=_0x558f8f[_0xc430('0x39')]['length']?_0x558f8f[_0xc430('0x39')]:_0x46aa37['model'];if(!_0x539557['query']['hasOwnProperty'](_0xc430('0x3c'))){_0x558f8f[_0xc430('0x21')]=qs[_0xc430('0x21')](_0x539557['query'][_0xc430('0x21')]);_0x558f8f[_0xc430('0x20')]=qs['offset'](_0x539557[_0xc430('0x36')][_0xc430('0x20')]);}_0x558f8f['order']=qs[_0xc430('0x3d')](_0x539557[_0xc430('0x36')][_0xc430('0x3d')]);_0x558f8f[_0xc430('0x3e')]=qs[_0xc430('0x38')](_[_0xc430('0x3f')](_0x539557[_0xc430('0x36')],_0x46aa37[_0xc430('0x38')]),_0x16a614);if(_0x539557[_0xc430('0x36')]['filter']){_0x558f8f[_0xc430('0x3e')]=_[_0xc430('0x40')](_0x558f8f[_0xc430('0x3e')],{'$or':_[_0xc430('0x35')](_0x16a614,function(_0x5a891b){if(_0x5a891b[_0xc430('0x33')]!==_0xc430('0x41')){var _0x5c68e1={};_0x5c68e1[_0x5a891b[_0xc430('0x2d')]]={'$like':'%'+_0x539557[_0xc430('0x36')]['filter']+'%'};return _0x5c68e1;}})});}_0x558f8f=_[_0xc430('0x40')]({},_0x558f8f,_0x539557[_0xc430('0x42')]);var _0x44b674={'where':_0x558f8f[_0xc430('0x3e')]};return db['WhatsappQueue'][_0xc430('0x1f')](_0x44b674)['then'](function(_0x1add98){_0x4a2c08['count']=_0x1add98;if(_0x539557['query'][_0xc430('0x43')]){_0x558f8f['include']=[{'all':!![]}];}return db['WhatsappQueue'][_0xc430('0x44')](_0x558f8f);})[_0xc430('0x28')](function(_0x3c8ba4){_0x4a2c08[_0xc430('0x45')]=_0x3c8ba4;return _0x4a2c08;})[_0xc430('0x28')](respondWithFilteredResult(_0x631e72,_0x558f8f))[_0xc430('0x46')](handleError(_0x631e72,null));};exports[_0xc430('0x47')]=function(_0x81eb6b,_0x348be0){var _0x431b21={'raw':!![],'where':{'id':_0x81eb6b['params']['id']}},_0x3e9577={};_0x3e9577[_0xc430('0x34')]=_[_0xc430('0x37')](db['WhatsappQueue']['rawAttributes']);_0x3e9577['query']=_[_0xc430('0x37')](_0x81eb6b[_0xc430('0x36')]);_0x3e9577[_0xc430('0x38')]=_['intersection'](_0x3e9577[_0xc430('0x34')],_0x3e9577[_0xc430('0x36')]);_0x431b21[_0xc430('0x39')]=_[_0xc430('0x3a')](_0x3e9577[_0xc430('0x34')],qs['fields'](_0x81eb6b[_0xc430('0x36')][_0xc430('0x3b')]));_0x431b21[_0xc430('0x39')]=_0x431b21['attributes'][_0xc430('0x48')]?_0x431b21[_0xc430('0x39')]:_0x3e9577[_0xc430('0x34')];if(_0x81eb6b[_0xc430('0x36')][_0xc430('0x43')]){_0x431b21[_0xc430('0x49')]=[{'all':!![]}];}_0x431b21=_[_0xc430('0x40')]({},_0x431b21,_0x81eb6b[_0xc430('0x42')]);return db[_0xc430('0x30')][_0xc430('0x4a')](_0x431b21)[_0xc430('0x28')](handleEntityNotFound(_0x348be0,null))['then'](respondWithResult(_0x348be0,null))['catch'](handleError(_0x348be0,null));};exports[_0xc430('0x4b')]=function(_0x15760f,_0x39619f){return db[_0xc430('0x30')]['create'](_0x15760f[_0xc430('0x4c')],{})[_0xc430('0x28')](function(_0x43d05a){var _0x112c10=_0x15760f[_0xc430('0x4d')][_0xc430('0x29')]({'plain':!![]});if(!_0x112c10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x112c10[_0xc430('0x4e')]==='user'){var _0x22d14c=_0x43d05a['get']({'plain':!![]});var _0xa2b3ce=_0xc430('0x4f');return db[_0xc430('0x50')]['find']({'where':{'name':_0xa2b3ce,'userProfileId':_0x112c10[_0xc430('0x51')]},'raw':!![]})[_0xc430('0x28')](function(_0x458b6a){if(_0x458b6a&&_0x458b6a[_0xc430('0x52')]===0x0){return db[_0xc430('0x2a')][_0xc430('0x4b')]({'name':_0x22d14c[_0xc430('0x2d')],'resourceId':_0x22d14c['id'],'type':_0x458b6a[_0xc430('0x2d')],'sectionId':_0x458b6a['id']},{})[_0xc430('0x28')](function(){return _0x43d05a;});}else{return _0x43d05a;}})[_0xc430('0x46')](function(_0x59c9be){logger[_0xc430('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59c9be);throw _0x59c9be;});}return _0x43d05a;})[_0xc430('0x28')](respondWithResult(_0x39619f,0xc9))['catch'](handleError(_0x39619f,null));};exports[_0xc430('0x27')]=function(_0xc577cc,_0x53d389){if(_0xc577cc[_0xc430('0x4c')]['id']){delete _0xc577cc[_0xc430('0x4c')]['id'];}return db[_0xc430('0x30')][_0xc430('0x4a')]({'where':{'id':_0xc577cc[_0xc430('0x53')]['id']}})[_0xc430('0x28')](handleEntityNotFound(_0x53d389,null))[_0xc430('0x28')](saveUpdates(_0xc577cc[_0xc430('0x4c')],null))[_0xc430('0x28')](respondWithResult(_0x53d389,null))[_0xc430('0x46')](handleError(_0x53d389,null));};exports[_0xc430('0x54')]=function(_0x556f02,_0xfb0902){return db[_0xc430('0x30')]['find']({'where':{'id':_0x556f02['params']['id']}})[_0xc430('0x28')](handleEntityNotFound(_0xfb0902,null))[_0xc430('0x28')](removeEntity(_0xfb0902,null))[_0xc430('0x46')](handleError(_0xfb0902,null));};exports[_0xc430('0x55')]=function(_0x6e9426,_0xeae4d9){return db[_0xc430('0x30')]['describe']()[_0xc430('0x28')](respondWithResult(_0xeae4d9,null))[_0xc430('0x46')](handleError(_0xeae4d9,null));};exports[_0xc430('0x56')]=function(_0x4955e9,_0x1785b0,_0xd37d4d){var _0x48017c={'raw':!![],'where':{}},_0x41bce2={},_0x4a2034;return db['WhatsappQueue']['findOne']({'where':{'id':_0x4955e9['params']['id']}})['then'](handleEntityNotFound(_0x1785b0,null))[_0xc430('0x28')](function(_0x3abe68){if(_0x3abe68){_0x4a2034=_0x3abe68['get']({'plain':!![]});_0x41bce2[_0xc430('0x34')]=_[_0xc430('0x37')](db[_0xc430('0x57')]['rawAttributes']);_0x41bce2['query']=_[_0xc430('0x37')](_0x4955e9[_0xc430('0x36')]);_0x41bce2[_0xc430('0x38')]=_[_0xc430('0x3a')](_0x41bce2[_0xc430('0x34')],_0x41bce2['query']);_0x48017c[_0xc430('0x39')]=_[_0xc430('0x3a')](_0x41bce2[_0xc430('0x34')],qs[_0xc430('0x3b')](_0x4955e9['query'][_0xc430('0x3b')]));_0x48017c[_0xc430('0x39')]=_0x48017c['attributes'][_0xc430('0x48')]?_0x48017c['attributes']:_0x41bce2[_0xc430('0x34')];if(!_0x4955e9[_0xc430('0x36')][_0xc430('0x58')]('nolimit')){_0x48017c[_0xc430('0x21')]=qs[_0xc430('0x21')](_0x4955e9['query']['limit']);_0x48017c[_0xc430('0x20')]=qs['offset'](_0x4955e9[_0xc430('0x36')]['offset']);}_0x48017c['order']=qs['sort'](_0x4955e9['query'][_0xc430('0x3d')]);_0x48017c[_0xc430('0x3e')]=qs[_0xc430('0x38')](_[_0xc430('0x3f')](_0x4955e9['query'],_0x41bce2[_0xc430('0x38')]));_0x48017c['where'][_0xc430('0x59')]=_0x3abe68['id'];if(_0x4955e9[_0xc430('0x36')][_0xc430('0x5a')]){_0x48017c['where']=_[_0xc430('0x40')](_0x48017c[_0xc430('0x3e')],{'$or':_[_0xc430('0x35')](_0x48017c['attributes'],function(_0x50cda1){var _0xa139a7={};_0xa139a7[_0x50cda1]={'$like':'%'+_0x4955e9[_0xc430('0x36')][_0xc430('0x5a')]+'%'};return _0xa139a7;})});}_0x48017c=_[_0xc430('0x40')]({},_0x48017c,_0x4955e9[_0xc430('0x42')]);return db[_0xc430('0x57')]['findAll'](_0x48017c);}})[_0xc430('0x28')](function(_0x1a68e6){if(_0x1a68e6){return db[_0xc430('0x5b')][_0xc430('0x5c')]({'where':{'id':_['map'](_0x1a68e6,_0xc430('0x5d')),'role':_0xc430('0x5e')},'attributes':['id',_0xc430('0x2d'),'whatsappPause',_0xc430('0x5f'),'createdAt']});}})[_0xc430('0x28')](function(_0x1a9169){if(_0x1a9169){return{'count':_0x1a9169[_0xc430('0x1f')],'rows':_[_0xc430('0x35')](_0x1a9169[_0xc430('0x45')],function(_0x31e1eb){return{'membername':_0x31e1eb['name'],'UserId':_0x31e1eb['id'],'queue_name':_0x4a2034[_0xc430('0x2d')],'WhatsappQueueId':_0x4a2034['id'],'interface':util[_0xc430('0x60')](_0xc430('0x61'),_0xc430('0x62'),_0x31e1eb[_0xc430('0x2d')]),'penalty':0x0,'paused':_0x31e1eb[_0xc430('0x63')],'createdAt':_0x31e1eb['createdAt'],'updatedAt':_0x31e1eb[_0xc430('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc430('0x28')](respondWithFilteredResult(_0x1785b0,_0x48017c))[_0xc430('0x46')](handleError(_0x1785b0,null));};exports[_0xc430('0x64')]=function(_0x555d16,_0x303218,_0x3b7498){var _0x534bf2={};var _0x3d8c0e={};var _0x41f385;var _0x2757c2;return db['WhatsappQueue'][_0xc430('0x65')]({'where':{'id':_0x555d16[_0xc430('0x53')]['id']}})[_0xc430('0x28')](handleEntityNotFound(_0x303218,null))[_0xc430('0x28')](function(_0xc3b415){if(_0xc3b415){_0x41f385=_0xc3b415;_0x3d8c0e[_0xc430('0x34')]=_[_0xc430('0x37')](db[_0xc430('0x66')][_0xc430('0x31')]);_0x3d8c0e['query']=_[_0xc430('0x37')](_0x555d16[_0xc430('0x36')]);_0x3d8c0e[_0xc430('0x38')]=_[_0xc430('0x3a')](_0x3d8c0e[_0xc430('0x34')],_0x3d8c0e['query']);_0x534bf2['attributes']=_[_0xc430('0x3a')](_0x3d8c0e[_0xc430('0x34')],qs[_0xc430('0x3b')](_0x555d16['query'][_0xc430('0x3b')]));_0x534bf2[_0xc430('0x39')]=_0x534bf2['attributes'][_0xc430('0x48')]?_0x534bf2['attributes']:_0x3d8c0e[_0xc430('0x34')];_0x534bf2[_0xc430('0x67')]=qs['sort'](_0x555d16[_0xc430('0x36')][_0xc430('0x3d')]);_0x534bf2[_0xc430('0x3e')]=qs[_0xc430('0x38')](_[_0xc430('0x3f')](_0x555d16[_0xc430('0x36')],_0x3d8c0e[_0xc430('0x38')]));if(_0x555d16[_0xc430('0x36')][_0xc430('0x5a')]){_0x534bf2['where']=_[_0xc430('0x40')](_0x534bf2[_0xc430('0x3e')],{'$or':_[_0xc430('0x35')](_0x534bf2['attributes'],function(_0x372881){var _0x52a6ae={};_0x52a6ae[_0x372881]={'$like':'%'+_0x555d16['query']['filter']+'%'};return _0x52a6ae;})});}_0x534bf2=_[_0xc430('0x40')]({},_0x534bf2,_0x555d16['options']);return _0x41f385['getTeams'](_0x534bf2);}})['then'](function(_0x758027){if(_0x758027){_0x2757c2=_0x758027[_0xc430('0x48')];if(!_0x555d16['query']['hasOwnProperty'](_0xc430('0x3c'))){_0x534bf2['limit']=qs[_0xc430('0x21')](_0x555d16[_0xc430('0x36')][_0xc430('0x21')]);_0x534bf2[_0xc430('0x20')]=qs['offset'](_0x555d16[_0xc430('0x36')][_0xc430('0x20')]);}return _0x41f385['getTeams'](_0x534bf2);}})['then'](function(_0x544943){if(_0x544943){return _0x544943?{'count':_0x2757c2,'rows':_0x544943}:null;}})[_0xc430('0x28')](respondWithResult(_0x303218,null))['catch'](handleError(_0x303218,null));};exports[_0xc430('0x68')]=function(_0x12ad1e,_0x78951d,_0x2020cb){var _0x33eae4=_0x12ad1e[_0xc430('0x4c')][_0xc430('0x69')];return db[_0xc430('0x66')][_0xc430('0x44')]({'where':{'id':_0x33eae4},'attributes':['id'],'include':[{'model':db[_0xc430('0x5b')],'as':_0xc430('0x6a'),'attributes':['id','name',_0xc430('0x6b'),_0xc430('0x6c'),_0xc430('0x6d')],'raw':!![]}]})[_0xc430('0x28')](function(_0xcb655e){if(_0xcb655e){var _0x2c3625=_[_0xc430('0x6e')](_0xcb655e,function(_0x6672d1){var _0x148761=_0x6672d1['get']({'plain':!![]});return _0x148761[_0xc430('0x6a')];});return db[_0xc430('0x30')][_0xc430('0x4a')]({'where':{'id':_0x12ad1e[_0xc430('0x53')]['id']}})[_0xc430('0x28')](function(_0xa29777){return db[_0xc430('0x6f')][_0xc430('0x70')](function(_0x3051aa){return _0xa29777[_0xc430('0x68')](_0x33eae4,{'transaction':_0x3051aa})[_0xc430('0x28')](function(){return BPromise[_0xc430('0x71')](_0x2c3625,function(_0x4894f4){return db[_0xc430('0x57')][_0xc430('0x72')]({'where':{'UserId':_0x4894f4['id'],'WhatsappQueueId':_0x12ad1e[_0xc430('0x53')]['id']},'transaction':_0x3051aa});});})['then'](function(){_0x2c3625['forEach'](function(_0x30ab4a){socket[_0xc430('0x73')](_0xc430('0x74'),{'UserId':_0x30ab4a['id'],'WhatsappQueueId':_0xa29777['id']});});});});});}})[_0xc430('0x28')](respondWithStatusCode(_0x78951d,null))[_0xc430('0x46')](handleError(_0x78951d,null));};exports[_0xc430('0x75')]=function(_0x1c25cd,_0x56d451,_0x1c6980){return db[_0xc430('0x66')][_0xc430('0x44')]({'where':{'id':_0x1c25cd[_0xc430('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc430('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc430('0x28')](handleEntityNotFound(_0x56d451,null))[_0xc430('0x28')](function(_0x405926){var _0x3e29d4=_[_0xc430('0x35')](_0x405926,'id');var _0x293bfc=[];var _0x443b68=[];var _0x6c6cb2=squel['select']();_0x6c6cb2[_0xc430('0x76')](_0xc430('0x77'))[_0xc430('0x78')]('team_has_whatsapp_queues','tq')['join'](_0xc430('0x79'),'ut',_0xc430('0x7a'))['where'](_0xc430('0x7b'),_0x1c25cd[_0xc430('0x53')]['id']);for(var _0x347632=0x0;_0x347632<_0x405926[_0xc430('0x48')];_0x347632+=0x1){let _0x34bc0a=_0x405926[_0x347632];for(var _0x4a527c=0x0;_0x4a527c<_0x34bc0a[_0xc430('0x6a')][_0xc430('0x48')];_0x4a527c+=0x1){let _0x26301f=_0x34bc0a[_0xc430('0x6a')][_0x4a527c];var _0x131dcf=_0x6c6cb2['clone']();_0x131dcf[_0xc430('0x3e')]('ut.UserId\x20=\x20?',_0x26301f['id']);_0x443b68[_0xc430('0x7c')](db[_0xc430('0x6f')][_0xc430('0x36')](_0x131dcf[_0xc430('0x7d')](),{'type':db[_0xc430('0x6f')][_0xc430('0x7e')]['SELECT']})[_0xc430('0x28')](function(_0x2f3a75){if(_0x2f3a75['length']===0x1){return _0x26301f['id'];}else{var _0x37b24a=_['every'](_['map'](_0x2f3a75,_0xc430('0x7f')),function(_0x21db2b){return _[_0xc430('0x80')](_0x3e29d4,_0x21db2b);});if(_0x37b24a){return _0x26301f['id'];}}}));}}return BPromise[_0xc430('0x81')](_0x443b68)['then'](function(_0x40440d){_0x293bfc=_(_0x293bfc)[_0xc430('0x82')](_0x40440d)[_0xc430('0x83')]()[_0xc430('0x84')]();return db[_0xc430('0x30')][_0xc430('0x4a')]({'where':{'id':_0x1c25cd[_0xc430('0x53')]['id']}})['then'](function(_0x16393e){return db[_0xc430('0x6f')][_0xc430('0x70')](function(_0x2acd46){return _0x16393e['removeTeams'](_0x1c25cd[_0xc430('0x36')][_0xc430('0x69')],{'transaction':_0x2acd46})['then'](function(){if(!_['isEmpty'](_0x293bfc)){return _0x16393e[_0xc430('0x85')](_0x293bfc,{'transaction':_0x2acd46});}})[_0xc430('0x28')](function(){_0x293bfc[_0xc430('0x86')](function(_0x47f97c){socket[_0xc430('0x73')](_0xc430('0x87'),{'UserId':_0x47f97c,'WhatsappQueueId':_0x16393e['id']});});});});});});})[_0xc430('0x28')](respondWithStatusCode(_0x56d451,null))[_0xc430('0x46')](handleError(_0x56d451,null));};exports[_0xc430('0x88')]=function(_0x5ab76d,_0x3ef0e4,_0x532d10){return db[_0xc430('0x30')]['find']({'where':{'id':_0x5ab76d[_0xc430('0x53')]['id']}})[_0xc430('0x28')](handleEntityNotFound(_0x3ef0e4,null))[_0xc430('0x28')](function(_0x54f04f){if(_0x54f04f){return _0x54f04f[_0xc430('0x88')](_0x5ab76d['body'][_0xc430('0x69')],_[_0xc430('0x89')](_0x5ab76d[_0xc430('0x4c')],[_0xc430('0x69'),'id'])||{})[_0xc430('0x8a')](function(_0x341257){for(var _0x10e4eb=0x0;_0x10e4eb<_0x5ab76d[_0xc430('0x4c')][_0xc430('0x69')][_0xc430('0x48')];_0x10e4eb+=0x1){socket['emit'](_0xc430('0x74'),{'UserId':_0x5ab76d['body'][_0xc430('0x69')][_0x10e4eb],'WhatsappQueueId':_0x5ab76d[_0xc430('0x53')]['id']});}return _0x341257;});}})[_0xc430('0x28')](respondWithResult(_0x3ef0e4,null))[_0xc430('0x46')](handleError(_0x3ef0e4,null));};exports[_0xc430('0x85')]=function(_0x200460,_0x1dc38c,_0xef9079){return db[_0xc430('0x30')][_0xc430('0x4a')]({'where':{'id':_0x200460[_0xc430('0x53')]['id']}})[_0xc430('0x28')](handleEntityNotFound(_0x1dc38c,null))['then'](function(_0x3f5fd8){if(_0x3f5fd8){return _0x3f5fd8['removeAgents'](_0x200460[_0xc430('0x36')]['ids'])[_0xc430('0x28')](function(){if(_['isArray'](_0x200460[_0xc430('0x36')][_0xc430('0x69')])){for(var _0x81fe9c=0x0;_0x81fe9c<_0x200460[_0xc430('0x36')][_0xc430('0x69')][_0xc430('0x48')];_0x81fe9c+=0x1){socket[_0xc430('0x73')](_0xc430('0x87'),{'UserId':Number(_0x200460[_0xc430('0x36')][_0xc430('0x69')][_0x81fe9c]),'WhatsappQueueId':Number(_0x200460[_0xc430('0x53')]['id'])});}}else{socket['emit'](_0xc430('0x87'),{'UserId':Number(_0x200460[_0xc430('0x36')][_0xc430('0x69')]),'WhatsappQueueId':Number(_0x200460[_0xc430('0x53')]['id'])});}});}})[_0xc430('0x28')](respondWithStatusCode(_0x1dc38c,null))[_0xc430('0x46')](handleError(_0x1dc38c,null));};exports['getAgents']=function(_0x1385be,_0x3bf573,_0x10c14e){var _0x36a375={};var _0x2b3ef9={};var _0x174e5b;var _0x53e20b;return db[_0xc430('0x30')][_0xc430('0x65')]({'where':{'id':_0x1385be[_0xc430('0x53')]['id']}})[_0xc430('0x28')](handleEntityNotFound(_0x3bf573,null))[_0xc430('0x28')](function(_0x460a77){if(_0x460a77){_0x174e5b=_0x460a77;_0x2b3ef9[_0xc430('0x34')]=_['keys'](db[_0xc430('0x5b')][_0xc430('0x31')]);_0x2b3ef9[_0xc430('0x36')]=_[_0xc430('0x37')](_0x1385be[_0xc430('0x36')]);_0x2b3ef9[_0xc430('0x38')]=_[_0xc430('0x3a')](_0x2b3ef9[_0xc430('0x34')],_0x2b3ef9[_0xc430('0x36')]);_0x36a375[_0xc430('0x39')]=_[_0xc430('0x3a')](_0x2b3ef9['model'],qs[_0xc430('0x3b')](_0x1385be[_0xc430('0x36')][_0xc430('0x3b')]));_0x36a375['attributes']=_0x36a375[_0xc430('0x39')][_0xc430('0x48')]?_0x36a375[_0xc430('0x39')]:_0x2b3ef9[_0xc430('0x34')];_0x36a375[_0xc430('0x67')]=qs[_0xc430('0x3d')](_0x1385be[_0xc430('0x36')][_0xc430('0x3d')]);_0x36a375['where']=qs[_0xc430('0x38')](_[_0xc430('0x3f')](_0x1385be['query'],_0x2b3ef9[_0xc430('0x38')]));if(_0x1385be[_0xc430('0x36')][_0xc430('0x5a')]){_0x36a375[_0xc430('0x3e')]=_['merge'](_0x36a375[_0xc430('0x3e')],{'$or':_[_0xc430('0x35')](_0x36a375[_0xc430('0x39')],function(_0x1d7980){var _0x241d13={};_0x241d13[_0x1d7980]={'$like':'%'+_0x1385be[_0xc430('0x36')]['filter']+'%'};return _0x241d13;})});}_0x36a375=_['merge']({},_0x36a375,_0x1385be[_0xc430('0x42')]);return _0x174e5b['getAgents'](_0x36a375);}})[_0xc430('0x28')](function(_0x37baa1){if(_0x37baa1){_0x53e20b=_0x37baa1[_0xc430('0x48')];if(!_0x1385be[_0xc430('0x36')][_0xc430('0x58')](_0xc430('0x3c'))){_0x36a375[_0xc430('0x21')]=qs['limit'](_0x1385be[_0xc430('0x36')][_0xc430('0x21')]);_0x36a375['offset']=qs[_0xc430('0x20')](_0x1385be[_0xc430('0x36')][_0xc430('0x20')]);}return _0x174e5b[_0xc430('0x8b')](_0x36a375);}})[_0xc430('0x28')](function(_0x4a02c3){if(_0x4a02c3){return _0x4a02c3?{'count':_0x53e20b,'rows':_0x4a02c3}:null;}})[_0xc430('0x28')](respondWithResult(_0x3bf573,null))['catch'](handleError(_0x3bf573,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 85a9578..9b6fbce 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 _0xa610=['hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove','emit'];(function(_0x35000d,_0xc8945c){var _0x2b856f=function(_0x3d8eb2){while(--_0x3d8eb2){_0x35000d['push'](_0x35000d['shift']());}};_0x2b856f(++_0xc8945c);}(_0xa610,0x1b2));var _0x0a61=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa610[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x0a61('0x0'));var WhatsappQueue=require(_0x0a61('0x1'))['db'][_0x0a61('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x0a61('0x3')](0x0);var events={'afterCreate':_0x0a61('0x4'),'afterUpdate':'update','afterDestroy':_0x0a61('0x5')};function emitEvent(_0x34a816){return function(_0x13a09f,_0x54e640,_0x2fce0b){WhatsappQueueEvents[_0x0a61('0x6')](_0x34a816+':'+_0x13a09f['id'],_0x13a09f);WhatsappQueueEvents['emit'](_0x34a816,_0x13a09f);_0x2fce0b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x0a61('0x7')](e,emitEvent(event));}}module[_0x0a61('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x4d7c=['exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4d7c,0x15f));var _0xc4d7=function(_0x4926cb,_0x314ad5){_0x4926cb=_0x4926cb-0x0;var _0x5cbc1e=_0x4d7c[_0x4926cb];return _0x5cbc1e;};'use strict';var EventEmitter=require(_0xc4d7('0x0'));var WhatsappQueue=require(_0xc4d7('0x1'))['db'][_0xc4d7('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xc4d7('0x3')](0x0);var events={'afterCreate':_0xc4d7('0x4'),'afterUpdate':_0xc4d7('0x5'),'afterDestroy':'remove'};function emitEvent(_0x359ea8){return function(_0x4a2e51,_0x3c363b,_0x1bb2d9){WhatsappQueueEvents[_0xc4d7('0x6')](_0x359ea8+':'+_0x4a2e51['id'],_0x4a2e51);WhatsappQueueEvents[_0xc4d7('0x6')](_0x359ea8,_0x4a2e51);_0x1bb2d9(null);};}for(var e in events){if(events[_0xc4d7('0x7')](e)){var event=events[e];WhatsappQueue[_0xc4d7('0x8')](e,emitEvent(event));}}module[_0xc4d7('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index a043122..a696261 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 _0xcbc5=['define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','request-promise','path','../../config/environment','exports'];(function(_0x55db20,_0x4bee7b){var _0x41b374=function(_0x59c3be){while(--_0x59c3be){_0x55db20['push'](_0x55db20['shift']());}};_0x41b374(++_0x4bee7b);}(_0xcbc5,0x8f));var _0x5cbc=function(_0x501336,_0x3dfa0e){_0x501336=_0x501336-0x0;var _0x1767c0=_0xcbc5[_0x501336];return _0x1767c0;};'use strict';var _=require(_0x5cbc('0x0'));var util=require(_0x5cbc('0x1'));var logger=require(_0x5cbc('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5cbc('0x3'));var fs=require('fs');var path=require(_0x5cbc('0x4'));var rimraf=require('rimraf');var config=require(_0x5cbc('0x5'));var attributes=require('./whatsappQueue.attributes');module[_0x5cbc('0x6')]=function(_0x24a8cf,_0x2f7bf3){return _0x24a8cf[_0x5cbc('0x7')](_0x5cbc('0x8'),attributes,{'tableName':_0x5cbc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2946=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x7a6dc0,_0x28722a){var _0x2755a5=function(_0x4ee290){while(--_0x4ee290){_0x7a6dc0['push'](_0x7a6dc0['shift']());}};_0x2755a5(++_0x28722a);}(_0x2946,0xb5));var _0x6294=function(_0x2f915d,_0x1ddb10){_0x2f915d=_0x2f915d-0x0;var _0x476637=_0x2946[_0x2f915d];return _0x476637;};'use strict';var _=require(_0x6294('0x0'));var util=require(_0x6294('0x1'));var logger=require(_0x6294('0x2'))(_0x6294('0x3'));var moment=require(_0x6294('0x4'));var BPromise=require(_0x6294('0x5'));var rp=require(_0x6294('0x6'));var fs=require('fs');var path=require(_0x6294('0x7'));var rimraf=require(_0x6294('0x8'));var config=require(_0x6294('0x9'));var attributes=require('./whatsappQueue.attributes');module[_0x6294('0xa')]=function(_0x3f28d6,_0x8a138b){return _0x3f28d6[_0x6294('0xb')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','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 7a69579..03abc9c 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 _0x151f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','WhatsappQueue','findAll','options','raw','attributes','limit','include','model','map','GetWhatsappQueue','ShowWhatsappQueue','find','lodash'];(function(_0x3af12a,_0x4b60cd){var _0x53013a=function(_0x10b77c){while(--_0x10b77c){_0x3af12a['push'](_0x3af12a['shift']());}};_0x53013a(++_0x4b60cd);}(_0x151f,0xe0));var _0xf151=function(_0x446beb,_0x983a02){_0x446beb=_0x446beb-0x0;var _0x4f8260=_0x151f[_0x446beb];return _0x4f8260;};'use strict';var _=require(_0xf151('0x0'));var util=require(_0xf151('0x1'));var moment=require(_0xf151('0x2'));var BPromise=require(_0xf151('0x3'));var rs=require(_0xf151('0x4'));var fs=require('fs');var Redis=require(_0xf151('0x5'));var db=require(_0xf151('0x6'))['db'];var utils=require(_0xf151('0x7'));var logger=require(_0xf151('0x8'))(_0xf151('0x9'));var config=require(_0xf151('0xa'));var jayson=require(_0xf151('0xb'));var client=jayson[_0xf151('0xc')][_0xf151('0xd')]({'port':0x232a});config['redis']=_[_0xf151('0xe')](config[_0xf151('0xf')],{'host':_0xf151('0x10'),'port':0x18eb});var socket=require(_0xf151('0x11'))(new Redis(config[_0xf151('0xf')]));require(_0xf151('0x12'))[_0xf151('0x13')](socket);function respondWithRpcPromise(_0x23f979,_0x1e74df,_0x1ad9ac){return new BPromise(function(_0x446083,_0x4258ac){return client[_0xf151('0x14')](_0x23f979,_0x1ad9ac)[_0xf151('0x15')](function(_0x10ba9c){logger['info'](_0xf151('0x16'),_0x1e74df,_0xf151('0x17'));logger[_0xf151('0x18')](_0xf151('0x19'),_0x1e74df,_0xf151('0x17'),JSON[_0xf151('0x1a')](_0x10ba9c));if(_0x10ba9c[_0xf151('0x1b')]){if(_0x10ba9c[_0xf151('0x1b')][_0xf151('0x1c')]===0x1f4){logger[_0xf151('0x1b')]('WhatsappQueue,\x20%s,\x20%s',_0x1e74df,_0x10ba9c['error'][_0xf151('0x1d')]);return _0x4258ac(_0x10ba9c['error']['message']);}logger[_0xf151('0x1b')](_0xf151('0x16'),_0x1e74df,_0x10ba9c[_0xf151('0x1b')][_0xf151('0x1d')]);return _0x446083(_0x10ba9c[_0xf151('0x1b')][_0xf151('0x1d')]);}else{logger[_0xf151('0x1e')]('WhatsappQueue,\x20%s,\x20%s',_0x1e74df,_0xf151('0x17'));_0x446083(_0x10ba9c[_0xf151('0x1f')][_0xf151('0x1d')]);}})[_0xf151('0x20')](function(_0x5b4ff4){logger[_0xf151('0x1b')](_0xf151('0x16'),_0x1e74df,_0x5b4ff4);_0x4258ac(_0x5b4ff4);});});}exports['GetWhatsappQueue']=function(_0x44466f){var _0x3900a7=this;return new Promise(function(_0x4f5861,_0x14518d){return db[_0xf151('0x21')][_0xf151('0x22')]({'raw':_0x44466f['options']?_0x44466f[_0xf151('0x23')][_0xf151('0x24')]===undefined?!![]:![]:!![],'where':_0x44466f[_0xf151('0x23')]?_0x44466f[_0xf151('0x23')]['where']||null:null,'attributes':_0x44466f['options']?_0x44466f[_0xf151('0x23')][_0xf151('0x25')]||null:null,'limit':_0x44466f[_0xf151('0x23')]?_0x44466f['options'][_0xf151('0x26')]||null:null,'include':_0x44466f[_0xf151('0x23')]?_0x44466f[_0xf151('0x23')][_0xf151('0x27')]?_['map'](_0x44466f['options'][_0xf151('0x27')],function(_0xb3664e){return{'model':db[_0xb3664e[_0xf151('0x28')]],'as':_0xb3664e['as'],'attributes':_0xb3664e['attributes'],'include':_0xb3664e[_0xf151('0x27')]?_[_0xf151('0x29')](_0xb3664e['include'],function(_0x1d8bda){return{'model':db[_0x1d8bda['model']],'as':_0x1d8bda['as'],'attributes':_0x1d8bda[_0xf151('0x25')],'include':_0x1d8bda[_0xf151('0x27')]?_['map'](_0x1d8bda[_0xf151('0x27')],function(_0x4a3337){return{'model':db[_0x4a3337['model']],'as':_0x4a3337['as'],'attributes':_0x4a3337[_0xf151('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24b980){logger[_0xf151('0x1e')](_0xf151('0x2a'),_0x44466f);logger[_0xf151('0x18')](_0xf151('0x2a'),_0x44466f,JSON[_0xf151('0x1a')](_0x24b980));_0x4f5861(_0x24b980);})['catch'](function(_0xb3b9d9){logger['error'](_0xf151('0x2a'),_0xb3b9d9[_0xf151('0x1d')],_0x44466f);_0x14518d(_0x3900a7['error'](0x1f4,_0xb3b9d9['message']));});});};exports[_0xf151('0x2b')]=function(_0x2daa74){var _0x428484=this;return new Promise(function(_0x10d342,_0x38ca93){return db[_0xf151('0x21')][_0xf151('0x2c')]({'raw':_0x2daa74['options']?_0x2daa74[_0xf151('0x23')][_0xf151('0x24')]===undefined?!![]:![]:!![],'where':_0x2daa74[_0xf151('0x23')]?_0x2daa74[_0xf151('0x23')]['where']||null:null,'attributes':_0x2daa74['options']?_0x2daa74[_0xf151('0x23')]['attributes']||null:null,'include':_0x2daa74[_0xf151('0x23')]?_0x2daa74[_0xf151('0x23')][_0xf151('0x27')]?_[_0xf151('0x29')](_0x2daa74[_0xf151('0x23')][_0xf151('0x27')],function(_0x5cd1e5){return{'model':db[_0x5cd1e5[_0xf151('0x28')]],'as':_0x5cd1e5['as'],'attributes':_0x5cd1e5[_0xf151('0x25')],'include':_0x5cd1e5[_0xf151('0x27')]?_[_0xf151('0x29')](_0x5cd1e5[_0xf151('0x27')],function(_0x2bedf7){return{'model':db[_0x2bedf7[_0xf151('0x28')]],'as':_0x2bedf7['as'],'attributes':_0x2bedf7[_0xf151('0x25')],'include':_0x2bedf7[_0xf151('0x27')]?_['map'](_0x2bedf7['include'],function(_0xddcb37){return{'model':db[_0xddcb37[_0xf151('0x28')]],'as':_0xddcb37['as'],'attributes':_0xddcb37['attributes']};}):[]};}):[]};}):[]:[]})[_0xf151('0x15')](function(_0x227019){logger[_0xf151('0x1e')]('ShowWhatsappQueue',_0x2daa74);logger['debug'](_0xf151('0x2b'),_0x2daa74,JSON[_0xf151('0x1a')](_0x227019));_0x10d342(_0x227019);})[_0xf151('0x20')](function(_0x3f694c){logger[_0xf151('0x1b')](_0xf151('0x2b'),_0x3f694c[_0xf151('0x1d')],_0x2daa74);_0x38ca93(_0x428484['error'](0x1f4,_0x3f694c[_0xf151('0x1d')]));});});}; \ No newline at end of file +var _0x86c8=['code','message','catch','findAll','options','where','attributes','limit','include','map','model','then','info','GetWhatsappQueue','ShowWhatsappQueue','WhatsappQueue','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./whatsappQueue.socket','register','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x12adab,_0x1cabe5){var _0x4d38c6=function(_0x5d4d5d){while(--_0x5d4d5d){_0x12adab['push'](_0x12adab['shift']());}};_0x4d38c6(++_0x1cabe5);}(_0x86c8,0x83));var _0x886c=function(_0xcf927e,_0x4becbc){_0xcf927e=_0xcf927e-0x0;var _0x165129=_0x86c8[_0xcf927e];return _0x165129;};'use strict';var _=require(_0x886c('0x0'));var util=require(_0x886c('0x1'));var moment=require(_0x886c('0x2'));var BPromise=require(_0x886c('0x3'));var rs=require(_0x886c('0x4'));var fs=require('fs');var Redis=require(_0x886c('0x5'));var db=require(_0x886c('0x6'))['db'];var utils=require(_0x886c('0x7'));var logger=require('../../config/logger')(_0x886c('0x8'));var config=require(_0x886c('0x9'));var jayson=require(_0x886c('0xa'));var client=jayson['client'][_0x886c('0xb')]({'port':0x232a});config[_0x886c('0xc')]=_['defaults'](config[_0x886c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x886c('0xd'))(new Redis(config[_0x886c('0xc')]));require(_0x886c('0xe'))[_0x886c('0xf')](socket);function respondWithRpcPromise(_0x9071f3,_0x3d4834,_0x4792ed){return new BPromise(function(_0x1b1998,_0x48fb11){return client['request'](_0x9071f3,_0x4792ed)['then'](function(_0x120b72){logger['info'](_0x886c('0x10'),_0x3d4834,_0x886c('0x11'));logger[_0x886c('0x12')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3d4834,_0x886c('0x11'),JSON[_0x886c('0x13')](_0x120b72));if(_0x120b72[_0x886c('0x14')]){if(_0x120b72[_0x886c('0x14')][_0x886c('0x15')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x3d4834,_0x120b72[_0x886c('0x14')][_0x886c('0x16')]);return _0x48fb11(_0x120b72['error'][_0x886c('0x16')]);}logger[_0x886c('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x3d4834,_0x120b72[_0x886c('0x14')][_0x886c('0x16')]);return _0x1b1998(_0x120b72[_0x886c('0x14')][_0x886c('0x16')]);}else{logger['info'](_0x886c('0x10'),_0x3d4834,'request\x20sent');_0x1b1998(_0x120b72['result'][_0x886c('0x16')]);}})[_0x886c('0x17')](function(_0x3fc10c){logger[_0x886c('0x14')](_0x886c('0x10'),_0x3d4834,_0x3fc10c);_0x48fb11(_0x3fc10c);});});}exports['GetWhatsappQueue']=function(_0x297c3f){var _0x51cb5f=this;return new Promise(function(_0x6e8cdd,_0x5314a9){return db['WhatsappQueue'][_0x886c('0x18')]({'raw':_0x297c3f[_0x886c('0x19')]?_0x297c3f[_0x886c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x297c3f[_0x886c('0x19')]?_0x297c3f[_0x886c('0x19')][_0x886c('0x1a')]||null:null,'attributes':_0x297c3f[_0x886c('0x19')]?_0x297c3f[_0x886c('0x19')][_0x886c('0x1b')]||null:null,'limit':_0x297c3f['options']?_0x297c3f[_0x886c('0x19')][_0x886c('0x1c')]||null:null,'include':_0x297c3f['options']?_0x297c3f['options'][_0x886c('0x1d')]?_['map'](_0x297c3f[_0x886c('0x19')][_0x886c('0x1d')],function(_0x2800b7){return{'model':db[_0x2800b7['model']],'as':_0x2800b7['as'],'attributes':_0x2800b7[_0x886c('0x1b')],'include':_0x2800b7['include']?_[_0x886c('0x1e')](_0x2800b7['include'],function(_0x27a5f7){return{'model':db[_0x27a5f7[_0x886c('0x1f')]],'as':_0x27a5f7['as'],'attributes':_0x27a5f7[_0x886c('0x1b')],'include':_0x27a5f7[_0x886c('0x1d')]?_[_0x886c('0x1e')](_0x27a5f7[_0x886c('0x1d')],function(_0x435014){return{'model':db[_0x435014[_0x886c('0x1f')]],'as':_0x435014['as'],'attributes':_0x435014[_0x886c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x886c('0x20')](function(_0x39eb94){logger[_0x886c('0x21')](_0x886c('0x22'),_0x297c3f);logger[_0x886c('0x12')](_0x886c('0x22'),_0x297c3f,JSON[_0x886c('0x13')](_0x39eb94));_0x6e8cdd(_0x39eb94);})[_0x886c('0x17')](function(_0x3828ae){logger[_0x886c('0x14')]('GetWhatsappQueue',_0x3828ae['message'],_0x297c3f);_0x5314a9(_0x51cb5f[_0x886c('0x14')](0x1f4,_0x3828ae['message']));});});};exports[_0x886c('0x23')]=function(_0x5ac607){var _0x2d1a2b=this;return new Promise(function(_0xbceaeb,_0x29996e){return db[_0x886c('0x24')]['find']({'raw':_0x5ac607[_0x886c('0x19')]?_0x5ac607[_0x886c('0x19')][_0x886c('0x25')]===undefined?!![]:![]:!![],'where':_0x5ac607[_0x886c('0x19')]?_0x5ac607[_0x886c('0x19')][_0x886c('0x1a')]||null:null,'attributes':_0x5ac607[_0x886c('0x19')]?_0x5ac607[_0x886c('0x19')]['attributes']||null:null,'include':_0x5ac607[_0x886c('0x19')]?_0x5ac607['options'][_0x886c('0x1d')]?_['map'](_0x5ac607[_0x886c('0x19')][_0x886c('0x1d')],function(_0x3d0437){return{'model':db[_0x3d0437[_0x886c('0x1f')]],'as':_0x3d0437['as'],'attributes':_0x3d0437[_0x886c('0x1b')],'include':_0x3d0437[_0x886c('0x1d')]?_['map'](_0x3d0437[_0x886c('0x1d')],function(_0x585f12){return{'model':db[_0x585f12[_0x886c('0x1f')]],'as':_0x585f12['as'],'attributes':_0x585f12[_0x886c('0x1b')],'include':_0x585f12[_0x886c('0x1d')]?_[_0x886c('0x1e')](_0x585f12[_0x886c('0x1d')],function(_0x5d6843){return{'model':db[_0x5d6843[_0x886c('0x1f')]],'as':_0x5d6843['as'],'attributes':_0x5d6843[_0x886c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x886c('0x20')](function(_0x139fcf){logger[_0x886c('0x21')](_0x886c('0x23'),_0x5ac607);logger['debug'](_0x886c('0x23'),_0x5ac607,JSON[_0x886c('0x13')](_0x139fcf));_0xbceaeb(_0x139fcf);})['catch'](function(_0x1affbc){logger[_0x886c('0x14')](_0x886c('0x23'),_0x1affbc[_0x886c('0x16')],_0x5ac607);_0x29996e(_0x2d1a2b['error'](0x1f4,_0x1affbc[_0x886c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 9bc94ae..0b2197b 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 _0xd219=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener'];(function(_0x103fbc,_0xebf843){var _0x5c9228=function(_0x308c0d){while(--_0x308c0d){_0x103fbc['push'](_0x103fbc['shift']());}};_0x5c9228(++_0xebf843);}(_0xd219,0x13e));var _0x9d21=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd219[_0x14add3];return _0x4a174f;};'use strict';var WhatsappQueueEvents=require(_0x9d21('0x0'));var events=[_0x9d21('0x1'),_0x9d21('0x2'),_0x9d21('0x3')];function createListener(_0x3cc760,_0x792c13){return function(_0x309bdc){_0x792c13[_0x9d21('0x4')](_0x3cc760,_0x309bdc);};}function removeListener(_0xcd4745,_0x53f77d){return function(){WhatsappQueueEvents[_0x9d21('0x5')](_0xcd4745,_0x53f77d);};}exports[_0x9d21('0x6')]=function(_0x5974f2){for(var _0x302b27=0x0,_0x4c3f0f=events[_0x9d21('0x7')];_0x302b27<_0x4c3f0f;_0x302b27++){var _0x1ffe1b=events[_0x302b27];var _0xf9866b=createListener(_0x9d21('0x8')+_0x1ffe1b,_0x5974f2);WhatsappQueueEvents['on'](_0x1ffe1b,_0xf9866b);}}; \ No newline at end of file +var _0xdcdc=['removeListener','register','whatsappQueue:','save','remove','update','emit'];(function(_0x31cc0e,_0x24ba4c){var _0x144862=function(_0x4d236e){while(--_0x4d236e){_0x31cc0e['push'](_0x31cc0e['shift']());}};_0x144862(++_0x24ba4c);}(_0xdcdc,0x8f));var _0xcdcd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdcdc[_0xa464c9];return _0x3d73c4;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xcdcd('0x0'),_0xcdcd('0x1'),_0xcdcd('0x2')];function createListener(_0x1780fa,_0x136b41){return function(_0x171191){_0x136b41[_0xcdcd('0x3')](_0x1780fa,_0x171191);};}function removeListener(_0x37f157,_0x1e92ad){return function(){WhatsappQueueEvents[_0xcdcd('0x4')](_0x37f157,_0x1e92ad);};}exports[_0xcdcd('0x5')]=function(_0x6a3dd5){for(var _0x8b0f0d=0x0,_0x4c7f91=events['length'];_0x8b0f0d<_0x4c7f91;_0x8b0f0d++){var _0x2b1a7b=events[_0x8b0f0d];var _0x16dd19=createListener(_0xcdcd('0x6')+_0x2b1a7b,_0x6a3dd5);WhatsappQueueEvents['on'](_0x2b1a7b,_0x16dd19);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 99936e1..9cc5df1 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 _0x1410=['multer','util','path','connect-timeout','Router','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x1410,0x130));var _0x0141=function(_0x682d41,_0x555e2c){_0x682d41=_0x682d41-0x0;var _0x5f6daf=_0x1410[_0x682d41];return _0x5f6daf;};'use strict';var multer=require(_0x0141('0x0'));var util=require(_0x0141('0x1'));var path=require(_0x0141('0x2'));var timeout=require(_0x0141('0x3'));var express=require('express');var router=express[_0x0141('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0141('0x5'));var config=require('../../config/environment');var controller=require(_0x0141('0x6'));router[_0x0141('0x7')]('/',auth[_0x0141('0x8')](),controller[_0x0141('0x9')]);router[_0x0141('0x7')](_0x0141('0xa'),auth[_0x0141('0x8')](),controller[_0x0141('0xb')]);router[_0x0141('0x7')]('/:id',auth[_0x0141('0x8')](),controller[_0x0141('0xc')]);router[_0x0141('0xd')]('/',auth[_0x0141('0x8')](),controller[_0x0141('0xe')]);router[_0x0141('0xf')](_0x0141('0x10'),auth[_0x0141('0x8')](),controller['update']);router[_0x0141('0x11')](_0x0141('0x10'),auth[_0x0141('0x8')](),controller[_0x0141('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2bb6=['put','update','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','create'];(function(_0x10626c,_0x56d540){var _0x3f60ad=function(_0x26a0a0){while(--_0x26a0a0){_0x10626c['push'](_0x10626c['shift']());}};_0x3f60ad(++_0x56d540);}(_0x2bb6,0x146));var _0x62bb=function(_0x3a5df2,_0x2b5517){_0x3a5df2=_0x3a5df2-0x0;var _0x3a65b6=_0x2bb6[_0x3a5df2];return _0x3a65b6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x62bb('0x0'));var timeout=require('connect-timeout');var express=require(_0x62bb('0x1'));var router=express[_0x62bb('0x2')]();var auth=require(_0x62bb('0x3'));var interaction=require(_0x62bb('0x4'));var config=require(_0x62bb('0x5'));var controller=require(_0x62bb('0x6'));router[_0x62bb('0x7')]('/',auth[_0x62bb('0x8')](),controller['index']);router[_0x62bb('0x7')]('/describe',auth[_0x62bb('0x8')](),controller[_0x62bb('0x9')]);router[_0x62bb('0x7')](_0x62bb('0xa'),auth['isAuthenticated'](),controller[_0x62bb('0xb')]);router[_0x62bb('0xc')]('/',auth['isAuthenticated'](),controller[_0x62bb('0xd')]);router[_0x62bb('0xe')](_0x62bb('0xa'),auth[_0x62bb('0x8')](),controller[_0x62bb('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x62bb('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 728931d..5e82e68 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(_0xcce71d,_0x379a75){var _0x468904=function(_0x13782d){while(--_0x13782d){_0xcce71d['push'](_0xcce71d['shift']());}};_0x468904(++_0x379a75);}(_0x34e8,0x12c));var _0x834e=function(_0x1d0911,_0x1f7b03){_0x1d0911=_0x1d0911-0x0;var _0x46b27b=_0x34e8[_0x1d0911];return _0x46b27b;};'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 _0x008c=['sequelize','exports','STRING','DATE'];(function(_0x2a16f8,_0x3cfeec){var _0x2d901a=function(_0x417ade){while(--_0x417ade){_0x2a16f8['push'](_0x2a16f8['shift']());}};_0x2d901a(++_0x3cfeec);}(_0x008c,0x188));var _0xc008=function(_0x5bc0f9,_0x1de7b0){_0x5bc0f9=_0x5bc0f9-0x0;var _0x50c294=_0x008c[_0x5bc0f9];return _0x50c294;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'uniqueid':{'type':Sequelize[_0xc008('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc008('0x2')]},'joinAt':{'type':Sequelize[_0xc008('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc008('0x3')]},'exitAt':{'type':Sequelize[_0xc008('0x3')]},'reason':{'type':Sequelize[_0xc008('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 6f37e4f..146ff60 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 _0x64ba=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','name','send','index','map','WhatsappQueueReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','fast-json-patch'];(function(_0x1ee4c6,_0x1212c3){var _0x19edfe=function(_0x369afc){while(--_0x369afc){_0x1ee4c6['push'](_0x1ee4c6['shift']());}};_0x19edfe(++_0x1212c3);}(_0x64ba,0x125));var _0xa64b=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x64ba[_0x4e7d25];return _0x526fe6;};'use strict';var pdf=require(_0xa64b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa64b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa64b('0x2'));var rp=require(_0xa64b('0x3'));var moment=require(_0xa64b('0x4'));var BPromise=require(_0xa64b('0x5'));var Mustache=require(_0xa64b('0x6'));var util=require(_0xa64b('0x7'));var path=require(_0xa64b('0x8'));var sox=require(_0xa64b('0x9'));var csv=require('to-csv');var ejs=require(_0xa64b('0xa'));var fs=require('fs');var _=require(_0xa64b('0xb'));var squel=require(_0xa64b('0xc'));var crypto=require(_0xa64b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa64b('0xe'));var Redis=require(_0xa64b('0xf'));var authService=require(_0xa64b('0x10'));var qs=require(_0xa64b('0x11'));var as=require(_0xa64b('0x12'));var hardwareService=require(_0xa64b('0x13'));var logger=require(_0xa64b('0x14'))(_0xa64b('0x15'));var utils=require(_0xa64b('0x16'));var config=require(_0xa64b('0x17'));var licenseUtil=require(_0xa64b('0x18'));var db=require(_0xa64b('0x19'))['db'];function respondWithStatusCode(_0xa42f44,_0x280d72){_0x280d72=_0x280d72||0xcc;return function(_0x3a5ecc){if(_0x3a5ecc){return _0xa42f44[_0xa64b('0x1a')](_0x280d72);}return _0xa42f44[_0xa64b('0x1b')](_0x280d72)['end']();};}function respondWithResult(_0x4991da,_0x1a9a32){_0x1a9a32=_0x1a9a32||0xc8;return function(_0x43433b){if(_0x43433b){return _0x4991da['status'](_0x1a9a32)['json'](_0x43433b);}};}function respondWithFilteredResult(_0x131c04,_0x497ca3){return function(_0x24c417){if(_0x24c417){var _0x580cbd=_0x24c417[_0xa64b('0x1c')],_0x83c0f3=_0x497ca3[_0xa64b('0x1d')],_0x121a9b=_0x497ca3[_0xa64b('0x1d')]+_0x497ca3[_0xa64b('0x1e')],_0x5b231f;if(_0x121a9b>=_0x580cbd){_0x121a9b=_0x580cbd;_0x5b231f=0xc8;}else{_0x5b231f=0xce;}_0x131c04[_0xa64b('0x1b')](_0x5b231f);return _0x131c04[_0xa64b('0x1f')](_0xa64b('0x20'),_0x83c0f3+'-'+_0x121a9b+'/'+_0x580cbd)[_0xa64b('0x21')](_0x24c417);}return null;};}function patchUpdates(_0x86861d){return function(_0x391e0e){try{jsonpatch['apply'](_0x391e0e,_0x86861d,!![]);}catch(_0xbac339){return BPromise[_0xa64b('0x22')](_0xbac339);}return _0x391e0e[_0xa64b('0x23')]();};}function saveUpdates(_0x2be111,_0x172c5c){return function(_0x54ce09){if(_0x54ce09){return _0x54ce09[_0xa64b('0x24')](_0x2be111)[_0xa64b('0x25')](function(_0x31b3a3){return _0x31b3a3;});}return null;};}function removeEntity(_0x28a22d,_0x3e0c51){return function(_0x4c9393){if(_0x4c9393){return _0x4c9393[_0xa64b('0x26')]()[_0xa64b('0x25')](function(){_0x28a22d[_0xa64b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x267a0a,_0x2720b9){return function(_0x536151){if(!_0x536151){_0x267a0a['sendStatus'](0x194);}return _0x536151;};}function handleError(_0x3a2e95,_0x11b067){_0x11b067=_0x11b067||0x1f4;return function(_0x568e75){logger['error'](_0x568e75['stack']);if(_0x568e75[_0xa64b('0x27')]){delete _0x568e75[_0xa64b('0x27')];}_0x3a2e95[_0xa64b('0x1b')](_0x11b067)[_0xa64b('0x28')](_0x568e75);};}exports[_0xa64b('0x29')]=function(_0x9e94f2,_0x42c0d5){var _0x47fca5={},_0x3b7da1={},_0x4b805b={'count':0x0,'rows':[]};var _0x380cfc=_[_0xa64b('0x2a')](db[_0xa64b('0x2b')]['rawAttributes'],function(_0x30a272){return{'name':_0x30a272['fieldName'],'type':_0x30a272[_0xa64b('0x2c')][_0xa64b('0x2d')]};});_0x3b7da1[_0xa64b('0x2e')]=_[_0xa64b('0x2a')](_0x380cfc,_0xa64b('0x27'));_0x3b7da1[_0xa64b('0x2f')]=_[_0xa64b('0x30')](_0x9e94f2[_0xa64b('0x2f')]);_0x3b7da1[_0xa64b('0x31')]=_[_0xa64b('0x32')](_0x3b7da1['model'],_0x3b7da1[_0xa64b('0x2f')]);_0x47fca5['attributes']=_[_0xa64b('0x32')](_0x3b7da1[_0xa64b('0x2e')],qs[_0xa64b('0x33')](_0x9e94f2[_0xa64b('0x2f')]['fields']));_0x47fca5['attributes']=_0x47fca5[_0xa64b('0x34')][_0xa64b('0x35')]?_0x47fca5[_0xa64b('0x34')]:_0x3b7da1[_0xa64b('0x2e')];if(!_0x9e94f2[_0xa64b('0x2f')][_0xa64b('0x36')](_0xa64b('0x37'))){_0x47fca5[_0xa64b('0x1e')]=qs[_0xa64b('0x1e')](_0x9e94f2['query'][_0xa64b('0x1e')]);_0x47fca5[_0xa64b('0x1d')]=qs[_0xa64b('0x1d')](_0x9e94f2[_0xa64b('0x2f')][_0xa64b('0x1d')]);}_0x47fca5['order']=qs[_0xa64b('0x38')](_0x9e94f2[_0xa64b('0x2f')][_0xa64b('0x38')]);_0x47fca5['where']=qs['filters'](_[_0xa64b('0x39')](_0x9e94f2[_0xa64b('0x2f')],_0x3b7da1[_0xa64b('0x31')]),_0x380cfc);if(_0x9e94f2['query']['filter']){_0x47fca5['where']=_['merge'](_0x47fca5[_0xa64b('0x3a')],{'$or':_[_0xa64b('0x2a')](_0x380cfc,function(_0x52a5c2){if(_0x52a5c2[_0xa64b('0x2c')]!==_0xa64b('0x3b')){var _0x170641={};_0x170641[_0x52a5c2[_0xa64b('0x27')]]={'$like':'%'+_0x9e94f2['query']['filter']+'%'};return _0x170641;}})});}_0x47fca5=_[_0xa64b('0x3c')]({},_0x47fca5,_0x9e94f2[_0xa64b('0x3d')]);var _0x57ebc6={'where':_0x47fca5[_0xa64b('0x3a')]};return db['WhatsappQueueReport'][_0xa64b('0x1c')](_0x57ebc6)[_0xa64b('0x25')](function(_0x16747f){_0x4b805b[_0xa64b('0x1c')]=_0x16747f;if(_0x9e94f2['query'][_0xa64b('0x3e')]){_0x47fca5[_0xa64b('0x3f')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xa64b('0x40')](_0x47fca5);})[_0xa64b('0x25')](function(_0x4ad06d){_0x4b805b[_0xa64b('0x41')]=_0x4ad06d;return _0x4b805b;})[_0xa64b('0x25')](respondWithFilteredResult(_0x42c0d5,_0x47fca5))[_0xa64b('0x42')](handleError(_0x42c0d5,null));};exports[_0xa64b('0x43')]=function(_0x14e85d,_0x94cf91){var _0x196480={'raw':!![],'where':{'id':_0x14e85d[_0xa64b('0x44')]['id']}},_0xf7e8d1={};_0xf7e8d1[_0xa64b('0x2e')]=_['keys'](db[_0xa64b('0x2b')][_0xa64b('0x45')]);_0xf7e8d1[_0xa64b('0x2f')]=_[_0xa64b('0x30')](_0x14e85d['query']);_0xf7e8d1[_0xa64b('0x31')]=_[_0xa64b('0x32')](_0xf7e8d1['model'],_0xf7e8d1[_0xa64b('0x2f')]);_0x196480[_0xa64b('0x34')]=_[_0xa64b('0x32')](_0xf7e8d1[_0xa64b('0x2e')],qs[_0xa64b('0x33')](_0x14e85d[_0xa64b('0x2f')]['fields']));_0x196480[_0xa64b('0x34')]=_0x196480[_0xa64b('0x34')][_0xa64b('0x35')]?_0x196480[_0xa64b('0x34')]:_0xf7e8d1[_0xa64b('0x2e')];if(_0x14e85d[_0xa64b('0x2f')][_0xa64b('0x3e')]){_0x196480[_0xa64b('0x3f')]=[{'all':!![]}];}_0x196480=_[_0xa64b('0x3c')]({},_0x196480,_0x14e85d[_0xa64b('0x3d')]);return db[_0xa64b('0x2b')][_0xa64b('0x46')](_0x196480)[_0xa64b('0x25')](handleEntityNotFound(_0x94cf91,null))[_0xa64b('0x25')](respondWithResult(_0x94cf91,null))[_0xa64b('0x42')](handleError(_0x94cf91,null));};exports[_0xa64b('0x47')]=function(_0x8c6c89,_0x1db163){return db['WhatsappQueueReport']['create'](_0x8c6c89[_0xa64b('0x48')],{})[_0xa64b('0x25')](respondWithResult(_0x1db163,0xc9))[_0xa64b('0x42')](handleError(_0x1db163,null));};exports['update']=function(_0x571c62,_0x141fdc){if(_0x571c62[_0xa64b('0x48')]['id']){delete _0x571c62[_0xa64b('0x48')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x571c62[_0xa64b('0x44')]['id']}})[_0xa64b('0x25')](handleEntityNotFound(_0x141fdc,null))['then'](saveUpdates(_0x571c62[_0xa64b('0x48')],null))[_0xa64b('0x25')](respondWithResult(_0x141fdc,null))[_0xa64b('0x42')](handleError(_0x141fdc,null));};exports[_0xa64b('0x26')]=function(_0x49703c,_0xfda60){return db[_0xa64b('0x2b')][_0xa64b('0x46')]({'where':{'id':_0x49703c['params']['id']}})[_0xa64b('0x25')](handleEntityNotFound(_0xfda60,null))[_0xa64b('0x25')](removeEntity(_0xfda60,null))['catch'](handleError(_0xfda60,null));};exports[_0xa64b('0x49')]=function(_0x4c5b2d,_0x533f90){return db[_0xa64b('0x2b')]['describe']()[_0xa64b('0x25')](respondWithResult(_0x533f90,null))['catch'](handleError(_0x533f90,null));}; \ No newline at end of file +var _0x8d99=['lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','count','offset','limit','set','Content-Range','update','then','destroy','status','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','model','query','intersection','attributes','fields','length','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','sox','to-csv','ejs'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x8d99,0x179));var _0x98d9=function(_0x1cdbea,_0x43e0ae){_0x1cdbea=_0x1cdbea-0x0;var _0x514834=_0x8d99[_0x1cdbea];return _0x514834;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x98d9('0x0'));var rimraf=require(_0x98d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x98d9('0x2'));var rp=require('request-promise');var moment=require(_0x98d9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x98d9('0x4'));var csv=require(_0x98d9('0x5'));var ejs=require(_0x98d9('0x6'));var fs=require('fs');var _=require(_0x98d9('0x7'));var squel=require(_0x98d9('0x8'));var crypto=require('crypto');var jsforce=require(_0x98d9('0x9'));var deskjs=require(_0x98d9('0xa'));var toCsv=require(_0x98d9('0x5'));var querystring=require(_0x98d9('0xb'));var Papa=require('papaparse');var Redis=require(_0x98d9('0xc'));var authService=require(_0x98d9('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x98d9('0xe'))(_0x98d9('0xf'));var utils=require(_0x98d9('0x10'));var config=require(_0x98d9('0x11'));var licenseUtil=require(_0x98d9('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe3b243,_0x7ed281){_0x7ed281=_0x7ed281||0xcc;return function(_0x553186){if(_0x553186){return _0xe3b243[_0x98d9('0x13')](_0x7ed281);}return _0xe3b243['status'](_0x7ed281)['end']();};}function respondWithResult(_0x13eb98,_0x109d29){_0x109d29=_0x109d29||0xc8;return function(_0x31a9aa){if(_0x31a9aa){return _0x13eb98['status'](_0x109d29)[_0x98d9('0x14')](_0x31a9aa);}};}function respondWithFilteredResult(_0x2f7162,_0x495013){return function(_0x4c8664){if(_0x4c8664){var _0x2fb3f3=_0x4c8664[_0x98d9('0x15')],_0x1c70b8=_0x495013[_0x98d9('0x16')],_0x452a89=_0x495013[_0x98d9('0x16')]+_0x495013[_0x98d9('0x17')],_0x21ff1d;if(_0x452a89>=_0x2fb3f3){_0x452a89=_0x2fb3f3;_0x21ff1d=0xc8;}else{_0x21ff1d=0xce;}_0x2f7162['status'](_0x21ff1d);return _0x2f7162[_0x98d9('0x18')](_0x98d9('0x19'),_0x1c70b8+'-'+_0x452a89+'/'+_0x2fb3f3)['json'](_0x4c8664);}return null;};}function patchUpdates(_0x5a9963){return function(_0x44c7dd){try{jsonpatch['apply'](_0x44c7dd,_0x5a9963,!![]);}catch(_0x19e4b5){return BPromise['reject'](_0x19e4b5);}return _0x44c7dd['save']();};}function saveUpdates(_0x4cafa4,_0xb7bc4b){return function(_0x20080c){if(_0x20080c){return _0x20080c[_0x98d9('0x1a')](_0x4cafa4)[_0x98d9('0x1b')](function(_0x55c6ab){return _0x55c6ab;});}return null;};}function removeEntity(_0x1bbd7e,_0x3fa76e){return function(_0x111749){if(_0x111749){return _0x111749[_0x98d9('0x1c')]()[_0x98d9('0x1b')](function(){_0x1bbd7e[_0x98d9('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x180fb9,_0x295f6f){return function(_0x3f402e){if(!_0x3f402e){_0x180fb9['sendStatus'](0x194);}return _0x3f402e;};}function handleError(_0x2a138c,_0x238409){_0x238409=_0x238409||0x1f4;return function(_0x68d7e6){logger['error'](_0x68d7e6[_0x98d9('0x1e')]);if(_0x68d7e6['name']){delete _0x68d7e6[_0x98d9('0x1f')];}_0x2a138c[_0x98d9('0x1d')](_0x238409)[_0x98d9('0x20')](_0x68d7e6);};}exports[_0x98d9('0x21')]=function(_0xf6dd35,_0x2b2290){var _0x30786e={},_0x19b747={},_0x353735={'count':0x0,'rows':[]};var _0x15a082=_[_0x98d9('0x22')](db[_0x98d9('0x23')][_0x98d9('0x24')],function(_0x54c9cd){return{'name':_0x54c9cd['fieldName'],'type':_0x54c9cd['type']['key']};});_0x19b747[_0x98d9('0x25')]=_[_0x98d9('0x22')](_0x15a082,_0x98d9('0x1f'));_0x19b747[_0x98d9('0x26')]=_['keys'](_0xf6dd35[_0x98d9('0x26')]);_0x19b747['filters']=_[_0x98d9('0x27')](_0x19b747['model'],_0x19b747[_0x98d9('0x26')]);_0x30786e[_0x98d9('0x28')]=_[_0x98d9('0x27')](_0x19b747[_0x98d9('0x25')],qs[_0x98d9('0x29')](_0xf6dd35[_0x98d9('0x26')][_0x98d9('0x29')]));_0x30786e['attributes']=_0x30786e[_0x98d9('0x28')][_0x98d9('0x2a')]?_0x30786e[_0x98d9('0x28')]:_0x19b747['model'];if(!_0xf6dd35[_0x98d9('0x26')]['hasOwnProperty']('nolimit')){_0x30786e['limit']=qs[_0x98d9('0x17')](_0xf6dd35[_0x98d9('0x26')]['limit']);_0x30786e['offset']=qs[_0x98d9('0x16')](_0xf6dd35[_0x98d9('0x26')][_0x98d9('0x16')]);}_0x30786e[_0x98d9('0x2b')]=qs[_0x98d9('0x2c')](_0xf6dd35[_0x98d9('0x26')][_0x98d9('0x2c')]);_0x30786e['where']=qs[_0x98d9('0x2d')](_[_0x98d9('0x2e')](_0xf6dd35[_0x98d9('0x26')],_0x19b747[_0x98d9('0x2d')]),_0x15a082);if(_0xf6dd35[_0x98d9('0x26')][_0x98d9('0x2f')]){_0x30786e['where']=_[_0x98d9('0x30')](_0x30786e[_0x98d9('0x31')],{'$or':_['map'](_0x15a082,function(_0x1be200){if(_0x1be200[_0x98d9('0x32')]!==_0x98d9('0x33')){var _0x479882={};_0x479882[_0x1be200[_0x98d9('0x1f')]]={'$like':'%'+_0xf6dd35[_0x98d9('0x26')][_0x98d9('0x2f')]+'%'};return _0x479882;}})});}_0x30786e=_[_0x98d9('0x30')]({},_0x30786e,_0xf6dd35[_0x98d9('0x34')]);var _0x357dda={'where':_0x30786e[_0x98d9('0x31')]};return db[_0x98d9('0x23')][_0x98d9('0x15')](_0x357dda)[_0x98d9('0x1b')](function(_0x14145e){_0x353735[_0x98d9('0x15')]=_0x14145e;if(_0xf6dd35[_0x98d9('0x26')][_0x98d9('0x35')]){_0x30786e['include']=[{'all':!![]}];}return db[_0x98d9('0x23')][_0x98d9('0x36')](_0x30786e);})[_0x98d9('0x1b')](function(_0x34d11f){_0x353735['rows']=_0x34d11f;return _0x353735;})['then'](respondWithFilteredResult(_0x2b2290,_0x30786e))[_0x98d9('0x37')](handleError(_0x2b2290,null));};exports[_0x98d9('0x38')]=function(_0x29d4d6,_0x10101b){var _0x3e88c7={'raw':!![],'where':{'id':_0x29d4d6[_0x98d9('0x39')]['id']}},_0x3bb302={};_0x3bb302[_0x98d9('0x25')]=_[_0x98d9('0x3a')](db[_0x98d9('0x23')]['rawAttributes']);_0x3bb302[_0x98d9('0x26')]=_[_0x98d9('0x3a')](_0x29d4d6['query']);_0x3bb302[_0x98d9('0x2d')]=_['intersection'](_0x3bb302[_0x98d9('0x25')],_0x3bb302[_0x98d9('0x26')]);_0x3e88c7[_0x98d9('0x28')]=_['intersection'](_0x3bb302[_0x98d9('0x25')],qs[_0x98d9('0x29')](_0x29d4d6[_0x98d9('0x26')]['fields']));_0x3e88c7[_0x98d9('0x28')]=_0x3e88c7[_0x98d9('0x28')][_0x98d9('0x2a')]?_0x3e88c7['attributes']:_0x3bb302[_0x98d9('0x25')];if(_0x29d4d6[_0x98d9('0x26')][_0x98d9('0x35')]){_0x3e88c7[_0x98d9('0x3b')]=[{'all':!![]}];}_0x3e88c7=_['merge']({},_0x3e88c7,_0x29d4d6[_0x98d9('0x34')]);return db[_0x98d9('0x23')][_0x98d9('0x3c')](_0x3e88c7)['then'](handleEntityNotFound(_0x10101b,null))[_0x98d9('0x1b')](respondWithResult(_0x10101b,null))['catch'](handleError(_0x10101b,null));};exports[_0x98d9('0x3d')]=function(_0x2fedc4,_0x83c1f1){return db[_0x98d9('0x23')][_0x98d9('0x3d')](_0x2fedc4[_0x98d9('0x3e')],{})['then'](respondWithResult(_0x83c1f1,0xc9))[_0x98d9('0x37')](handleError(_0x83c1f1,null));};exports['update']=function(_0x51d2db,_0x1cd892){if(_0x51d2db[_0x98d9('0x3e')]['id']){delete _0x51d2db['body']['id'];}return db[_0x98d9('0x23')][_0x98d9('0x3c')]({'where':{'id':_0x51d2db[_0x98d9('0x39')]['id']}})[_0x98d9('0x1b')](handleEntityNotFound(_0x1cd892,null))[_0x98d9('0x1b')](saveUpdates(_0x51d2db[_0x98d9('0x3e')],null))['then'](respondWithResult(_0x1cd892,null))[_0x98d9('0x37')](handleError(_0x1cd892,null));};exports[_0x98d9('0x1c')]=function(_0x26e9b2,_0x3a5183){return db[_0x98d9('0x23')][_0x98d9('0x3c')]({'where':{'id':_0x26e9b2[_0x98d9('0x39')]['id']}})[_0x98d9('0x1b')](handleEntityNotFound(_0x3a5183,null))['then'](removeEntity(_0x3a5183,null))[_0x98d9('0x37')](handleError(_0x3a5183,null));};exports[_0x98d9('0x3f')]=function(_0x34042a,_0x333979){return db[_0x98d9('0x23')][_0x98d9('0x3f')]()[_0x98d9('0x1b')](respondWithResult(_0x333979,null))[_0x98d9('0x37')](handleError(_0x333979,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index a75f8cf..2a46c0b 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 _0xb9f8=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappQueueReport.attributes','exports','uniqueid','util'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb9f8,0x8b));var _0x8b9f=function(_0x4c9699,_0x1c98f8){_0x4c9699=_0x4c9699-0x0;var _0x43bca1=_0xb9f8[_0x4c9699];return _0x43bca1;};'use strict';var _=require('lodash');var util=require(_0x8b9f('0x0'));var logger=require(_0x8b9f('0x1'))(_0x8b9f('0x2'));var moment=require(_0x8b9f('0x3'));var BPromise=require(_0x8b9f('0x4'));var rp=require(_0x8b9f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b9f('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b9f('0x7'));module[_0x8b9f('0x8')]=function(_0x3a8639,_0x296065){return _0x3a8639['define']('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x8b9f('0x9'),'fields':[_0x8b9f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9cb9=['uniqueid','lodash','util','../../config/logger','api','moment','path','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x9cb9,0x1a5));var _0x99cb=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9cb9[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x99cb('0x0'));var util=require(_0x99cb('0x1'));var logger=require(_0x99cb('0x2'))(_0x99cb('0x3'));var moment=require(_0x99cb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x99cb('0x5'));var rimraf=require('rimraf');var config=require(_0x99cb('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x99cb('0x7')]=function(_0x3a2ec8,_0x51384a){return _0x3a2ec8[_0x99cb('0x8')](_0x99cb('0x9'),attributes,{'tableName':_0x99cb('0xa'),'paranoid':![],'indexes':[{'name':_0x99cb('0xb'),'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 436b529..04d7376 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 _0xdd54=['code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','info','stringify','UpdateWhatsappQueueReport','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x20e882,_0x16185c){var _0x3e0dbe=function(_0x3d0129){while(--_0x3d0129){_0x20e882['push'](_0x20e882['shift']());}};_0x3e0dbe(++_0x16185c);}(_0xdd54,0x159));var _0x4dd5=function(_0x4093bb,_0x12d5d8){_0x4093bb=_0x4093bb-0x0;var _0x349327=_0xdd54[_0x4093bb];return _0x349327;};'use strict';var _=require(_0x4dd5('0x0'));var util=require(_0x4dd5('0x1'));var moment=require(_0x4dd5('0x2'));var BPromise=require(_0x4dd5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4dd5('0x4'));var db=require(_0x4dd5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4dd5('0x6'));var config=require(_0x4dd5('0x7'));var jayson=require(_0x4dd5('0x8'));var client=jayson[_0x4dd5('0x9')][_0x4dd5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x447b6c,_0x3df13a,_0x51f586){return new BPromise(function(_0x146965,_0x1e3094){return client[_0x4dd5('0xb')](_0x447b6c,_0x51f586)[_0x4dd5('0xc')](function(_0x2122da){logger['info'](_0x4dd5('0xd'),_0x3df13a,_0x4dd5('0xe'));logger[_0x4dd5('0xf')](_0x4dd5('0x10'),_0x3df13a,_0x4dd5('0xe'),JSON['stringify'](_0x2122da));if(_0x2122da[_0x4dd5('0x11')]){if(_0x2122da['error'][_0x4dd5('0x12')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x3df13a,_0x2122da['error']['message']);return _0x1e3094(_0x2122da[_0x4dd5('0x11')]['message']);}logger[_0x4dd5('0x11')](_0x4dd5('0xd'),_0x3df13a,_0x2122da['error'][_0x4dd5('0x13')]);return _0x146965(_0x2122da[_0x4dd5('0x11')]['message']);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x3df13a,_0x4dd5('0xe'));_0x146965(_0x2122da[_0x4dd5('0x14')][_0x4dd5('0x13')]);}})[_0x4dd5('0x15')](function(_0x5d41a4){logger[_0x4dd5('0x11')](_0x4dd5('0xd'),_0x3df13a,_0x5d41a4);_0x1e3094(_0x5d41a4);});});}exports[_0x4dd5('0x16')]=function(_0x1dc77b){var _0x38840b=this;return new Promise(function(_0x4125cb,_0x310641){return db[_0x4dd5('0x17')][_0x4dd5('0x18')](_0x1dc77b[_0x4dd5('0x19')],{'raw':_0x1dc77b[_0x4dd5('0x1a')]?_0x1dc77b['options'][_0x4dd5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x532092){logger[_0x4dd5('0x1c')]('CreateWhatsappQueueReport',_0x1dc77b);logger['debug']('CreateWhatsappQueueReport',_0x1dc77b,JSON[_0x4dd5('0x1d')](_0x532092));_0x4125cb(_0x532092);})[_0x4dd5('0x15')](function(_0x47d3fa){logger[_0x4dd5('0x11')](_0x4dd5('0x16'),_0x47d3fa[_0x4dd5('0x13')],_0x1dc77b);_0x310641(_0x38840b[_0x4dd5('0x11')](0x1f4,_0x47d3fa[_0x4dd5('0x13')]));});});};exports[_0x4dd5('0x1e')]=function(_0x3152b2){var _0x518d28=this;return new Promise(function(_0x1cbda0,_0x2abf17){return db['WhatsappQueueReport']['update'](_0x3152b2[_0x4dd5('0x19')],{'raw':_0x3152b2[_0x4dd5('0x1a')]?_0x3152b2[_0x4dd5('0x1a')][_0x4dd5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3152b2[_0x4dd5('0x1a')]?_0x3152b2['options']['where']||null:null,'attributes':_0x3152b2['options']?_0x3152b2[_0x4dd5('0x1a')][_0x4dd5('0x1f')]||null:null,'limit':_0x3152b2[_0x4dd5('0x1a')]?_0x3152b2[_0x4dd5('0x1a')][_0x4dd5('0x20')]||null:null})[_0x4dd5('0xc')](function(_0x28b622){logger[_0x4dd5('0x1c')](_0x4dd5('0x1e'),_0x3152b2);logger['debug']('UpdateWhatsappQueueReport',_0x3152b2,JSON[_0x4dd5('0x1d')](_0x28b622));_0x1cbda0(_0x28b622);})[_0x4dd5('0x15')](function(_0x23143c){logger[_0x4dd5('0x11')](_0x4dd5('0x1e'),_0x23143c[_0x4dd5('0x13')],_0x3152b2);_0x2abf17(_0x518d28[_0x4dd5('0x11')](0x1f4,_0x23143c[_0x4dd5('0x13')]));});});}; \ No newline at end of file +var _0xfc16=['../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappQueueReport','create','body','options','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','raw','where','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x207efe,_0x37e1a8){var _0x1aad20=function(_0x44dae6){while(--_0x44dae6){_0x207efe['push'](_0x207efe['shift']());}};_0x1aad20(++_0x37e1a8);}(_0xfc16,0x76));var _0x6fc1=function(_0x8d68ce,_0x135a7f){_0x8d68ce=_0x8d68ce-0x0;var _0x2e1f64=_0xfc16[_0x8d68ce];return _0x2e1f64;};'use strict';var _=require(_0x6fc1('0x0'));var util=require(_0x6fc1('0x1'));var moment=require(_0x6fc1('0x2'));var BPromise=require('bluebird');var rs=require(_0x6fc1('0x3'));var fs=require('fs');var Redis=require(_0x6fc1('0x4'));var db=require(_0x6fc1('0x5'))['db'];var utils=require(_0x6fc1('0x6'));var logger=require('../../config/logger')(_0x6fc1('0x7'));var config=require(_0x6fc1('0x8'));var jayson=require(_0x6fc1('0x9'));var client=jayson[_0x6fc1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a75f4,_0x67e1e7,_0x465c01){return new BPromise(function(_0x1137cd,_0x61e92a){return client['request'](_0x5a75f4,_0x465c01)[_0x6fc1('0xb')](function(_0x15bf13){logger[_0x6fc1('0xc')](_0x6fc1('0xd'),_0x67e1e7,_0x6fc1('0xe'));logger[_0x6fc1('0xf')](_0x6fc1('0x10'),_0x67e1e7,_0x6fc1('0xe'),JSON[_0x6fc1('0x11')](_0x15bf13));if(_0x15bf13[_0x6fc1('0x12')]){if(_0x15bf13[_0x6fc1('0x12')][_0x6fc1('0x13')]===0x1f4){logger['error'](_0x6fc1('0xd'),_0x67e1e7,_0x15bf13['error']['message']);return _0x61e92a(_0x15bf13[_0x6fc1('0x12')]['message']);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x67e1e7,_0x15bf13[_0x6fc1('0x12')][_0x6fc1('0x14')]);return _0x1137cd(_0x15bf13[_0x6fc1('0x12')][_0x6fc1('0x14')]);}else{logger[_0x6fc1('0xc')](_0x6fc1('0xd'),_0x67e1e7,_0x6fc1('0xe'));_0x1137cd(_0x15bf13['result']['message']);}})[_0x6fc1('0x15')](function(_0x54f36e){logger[_0x6fc1('0x12')](_0x6fc1('0xd'),_0x67e1e7,_0x54f36e);_0x61e92a(_0x54f36e);});});}exports['CreateWhatsappQueueReport']=function(_0xb2af4e){var _0x423fa2=this;return new Promise(function(_0x16aaf9,_0xb69b48){return db[_0x6fc1('0x16')][_0x6fc1('0x17')](_0xb2af4e[_0x6fc1('0x18')],{'raw':_0xb2af4e[_0x6fc1('0x19')]?_0xb2af4e['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x49f9d9){logger[_0x6fc1('0xc')](_0x6fc1('0x1a'),_0xb2af4e);logger[_0x6fc1('0xf')]('CreateWhatsappQueueReport',_0xb2af4e,JSON[_0x6fc1('0x11')](_0x49f9d9));_0x16aaf9(_0x49f9d9);})[_0x6fc1('0x15')](function(_0x4b8bf8){logger[_0x6fc1('0x12')](_0x6fc1('0x1a'),_0x4b8bf8[_0x6fc1('0x14')],_0xb2af4e);_0xb69b48(_0x423fa2[_0x6fc1('0x12')](0x1f4,_0x4b8bf8[_0x6fc1('0x14')]));});});};exports[_0x6fc1('0x1b')]=function(_0x24f360){var _0x463c01=this;return new Promise(function(_0x1fe7cf,_0x98018c){return db[_0x6fc1('0x16')]['update'](_0x24f360[_0x6fc1('0x18')],{'raw':_0x24f360[_0x6fc1('0x19')]?_0x24f360[_0x6fc1('0x19')][_0x6fc1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24f360[_0x6fc1('0x19')]?_0x24f360[_0x6fc1('0x19')][_0x6fc1('0x1d')]||null:null,'attributes':_0x24f360[_0x6fc1('0x19')]?_0x24f360['options']['attributes']||null:null,'limit':_0x24f360[_0x6fc1('0x19')]?_0x24f360[_0x6fc1('0x19')][_0x6fc1('0x1e')]||null:null})[_0x6fc1('0xb')](function(_0x28496a){logger['info']('UpdateWhatsappQueueReport',_0x24f360);logger[_0x6fc1('0xf')](_0x6fc1('0x1b'),_0x24f360,JSON[_0x6fc1('0x11')](_0x28496a));_0x1fe7cf(_0x28496a);})[_0x6fc1('0x15')](function(_0x1cbc55){logger[_0x6fc1('0x12')](_0x6fc1('0x1b'),_0x1cbc55[_0x6fc1('0x14')],_0x24f360);_0x98018c(_0x463c01[_0x6fc1('0x12')](0x1f4,_0x1cbc55[_0x6fc1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index c544e64..674a7f4 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 _0x6c2c=['/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x6c2c,0x158));var _0xc6c2=function(_0x5756c5,_0x339a9f){_0x5756c5=_0x5756c5-0x0;var _0x47a8eb=_0x6c2c[_0x5756c5];return _0x47a8eb;};'use strict';var multer=require('multer');var util=require(_0xc6c2('0x0'));var path=require(_0xc6c2('0x1'));var timeout=require(_0xc6c2('0x2'));var express=require(_0xc6c2('0x3'));var router=express[_0xc6c2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc6c2('0x5'));var config=require(_0xc6c2('0x6'));var controller=require(_0xc6c2('0x7'));router[_0xc6c2('0x8')]('/',auth[_0xc6c2('0x9')](),controller[_0xc6c2('0xa')]);router[_0xc6c2('0x8')](_0xc6c2('0xb'),auth[_0xc6c2('0x9')](),controller[_0xc6c2('0xc')]);router['get'](_0xc6c2('0xd'),auth[_0xc6c2('0x9')](),controller[_0xc6c2('0xe')]);router[_0xc6c2('0xf')]('/',auth[_0xc6c2('0x9')](),controller[_0xc6c2('0x10')]);router[_0xc6c2('0x11')](_0xc6c2('0xd'),auth[_0xc6c2('0x9')](),controller[_0xc6c2('0x12')]);router[_0xc6c2('0x13')]('/:id',auth[_0xc6c2('0x9')](),controller[_0xc6c2('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf188=['create','put','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post'];(function(_0x349005,_0x338496){var _0x43b145=function(_0x5aed80){while(--_0x5aed80){_0x349005['push'](_0x349005['shift']());}};_0x43b145(++_0x338496);}(_0xf188,0xfd));var _0x8f18=function(_0x3e6843,_0x297371){_0x3e6843=_0x3e6843-0x0;var _0x290174=_0xf188[_0x3e6843];return _0x290174;};'use strict';var multer=require('multer');var util=require(_0x8f18('0x0'));var path=require(_0x8f18('0x1'));var timeout=require(_0x8f18('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x8f18('0x3'));var interaction=require(_0x8f18('0x4'));var config=require('../../config/environment');var controller=require(_0x8f18('0x5'));router['get']('/',auth[_0x8f18('0x6')](),controller[_0x8f18('0x7')]);router[_0x8f18('0x8')](_0x8f18('0x9'),auth[_0x8f18('0x6')](),controller[_0x8f18('0xa')]);router[_0x8f18('0x8')](_0x8f18('0xb'),auth[_0x8f18('0x6')](),controller['show']);router[_0x8f18('0xc')]('/',auth['isAuthenticated'](),controller[_0x8f18('0xd')]);router[_0x8f18('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8f18('0xf')]);router[_0x8f18('0x10')]('/:id',auth[_0x8f18('0x6')](),controller[_0x8f18('0x11')]);module[_0x8f18('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 92f47de..f9bad88 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 _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file +var _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb10b,0x12a));var _0xbb10=function(_0x4ca3b4,_0x2450bc){_0x4ca3b4=_0x4ca3b4-0x0;var _0x51ea64=_0xb10b[_0x4ca3b4];return _0x51ea64;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 3620ec2..7b556bc 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 _0x0d47=['end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','index','map','WhatsappTransferReport','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','update','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x55beab,_0x75a2cc){var _0x3fe0e8=function(_0x5b3cb0){while(--_0x5b3cb0){_0x55beab['push'](_0x55beab['shift']());}};_0x3fe0e8(++_0x75a2cc);}(_0x0d47,0x1b9));var _0x70d4=function(_0x59e8fa,_0xeaef9f){_0x59e8fa=_0x59e8fa-0x0;var _0x2a9e1b=_0x0d47[_0x59e8fa];return _0x2a9e1b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x70d4('0x0'));var zipdir=require(_0x70d4('0x1'));var jsonpatch=require(_0x70d4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x70d4('0x3'));var Mustache=require(_0x70d4('0x4'));var util=require('util');var path=require('path');var sox=require(_0x70d4('0x5'));var csv=require('to-csv');var ejs=require(_0x70d4('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x70d4('0x7'));var crypto=require(_0x70d4('0x8'));var jsforce=require(_0x70d4('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x70d4('0xa'));var Papa=require(_0x70d4('0xb'));var Redis=require(_0x70d4('0xc'));var authService=require(_0x70d4('0xd'));var qs=require(_0x70d4('0xe'));var as=require(_0x70d4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x70d4('0x10'));var licenseUtil=require(_0x70d4('0x11'));var db=require(_0x70d4('0x12'))['db'];function respondWithStatusCode(_0x726ebc,_0x2b3c50){_0x2b3c50=_0x2b3c50||0xcc;return function(_0x146ef4){if(_0x146ef4){return _0x726ebc[_0x70d4('0x13')](_0x2b3c50);}return _0x726ebc[_0x70d4('0x14')](_0x2b3c50)[_0x70d4('0x15')]();};}function respondWithResult(_0x10e8b1,_0x58e9d1){_0x58e9d1=_0x58e9d1||0xc8;return function(_0x321c6d){if(_0x321c6d){return _0x10e8b1['status'](_0x58e9d1)[_0x70d4('0x16')](_0x321c6d);}};}function respondWithFilteredResult(_0x2fa3d9,_0x10e1a1){return function(_0x4a99b4){if(_0x4a99b4){var _0x2cae9e=_0x4a99b4[_0x70d4('0x17')],_0x4b162a=_0x10e1a1[_0x70d4('0x18')],_0x3ed329=_0x10e1a1[_0x70d4('0x18')]+_0x10e1a1[_0x70d4('0x19')],_0xd2a542;if(_0x3ed329>=_0x2cae9e){_0x3ed329=_0x2cae9e;_0xd2a542=0xc8;}else{_0xd2a542=0xce;}_0x2fa3d9[_0x70d4('0x14')](_0xd2a542);return _0x2fa3d9[_0x70d4('0x1a')]('Content-Range',_0x4b162a+'-'+_0x3ed329+'/'+_0x2cae9e)['json'](_0x4a99b4);}return null;};}function patchUpdates(_0xa50a73){return function(_0x208490){try{jsonpatch[_0x70d4('0x1b')](_0x208490,_0xa50a73,!![]);}catch(_0x583b9e){return BPromise[_0x70d4('0x1c')](_0x583b9e);}return _0x208490[_0x70d4('0x1d')]();};}function saveUpdates(_0x3b37dc,_0x303c3e){return function(_0x4e9db8){if(_0x4e9db8){return _0x4e9db8['update'](_0x3b37dc)[_0x70d4('0x1e')](function(_0x18aa92){return _0x18aa92;});}return null;};}function removeEntity(_0x136fb2,_0x4776b4){return function(_0x700961){if(_0x700961){return _0x700961[_0x70d4('0x1f')]()[_0x70d4('0x1e')](function(){_0x136fb2[_0x70d4('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54de89,_0x41ebb4){return function(_0x290295){if(!_0x290295){_0x54de89[_0x70d4('0x13')](0x194);}return _0x290295;};}function handleError(_0x2da15e,_0x25c46c){_0x25c46c=_0x25c46c||0x1f4;return function(_0x5f510d){logger[_0x70d4('0x20')](_0x5f510d[_0x70d4('0x21')]);if(_0x5f510d[_0x70d4('0x22')]){delete _0x5f510d[_0x70d4('0x22')];}_0x2da15e[_0x70d4('0x14')](_0x25c46c)['send'](_0x5f510d);};}exports[_0x70d4('0x23')]=function(_0x2866e9,_0xac6c52){var _0x3c3f96={},_0x34856e={},_0x2cc500={'count':0x0,'rows':[]};var _0x421e31=_[_0x70d4('0x24')](db[_0x70d4('0x25')]['rawAttributes'],function(_0x1e734f){return{'name':_0x1e734f[_0x70d4('0x26')],'type':_0x1e734f[_0x70d4('0x27')]['key']};});_0x34856e[_0x70d4('0x28')]=_['map'](_0x421e31,_0x70d4('0x22'));_0x34856e['query']=_['keys'](_0x2866e9[_0x70d4('0x29')]);_0x34856e[_0x70d4('0x2a')]=_['intersection'](_0x34856e[_0x70d4('0x28')],_0x34856e[_0x70d4('0x29')]);_0x3c3f96[_0x70d4('0x2b')]=_[_0x70d4('0x2c')](_0x34856e[_0x70d4('0x28')],qs[_0x70d4('0x2d')](_0x2866e9[_0x70d4('0x29')][_0x70d4('0x2d')]));_0x3c3f96[_0x70d4('0x2b')]=_0x3c3f96[_0x70d4('0x2b')][_0x70d4('0x2e')]?_0x3c3f96[_0x70d4('0x2b')]:_0x34856e[_0x70d4('0x28')];if(!_0x2866e9[_0x70d4('0x29')][_0x70d4('0x2f')](_0x70d4('0x30'))){_0x3c3f96[_0x70d4('0x19')]=qs['limit'](_0x2866e9[_0x70d4('0x29')]['limit']);_0x3c3f96[_0x70d4('0x18')]=qs[_0x70d4('0x18')](_0x2866e9[_0x70d4('0x29')][_0x70d4('0x18')]);}_0x3c3f96['order']=qs[_0x70d4('0x31')](_0x2866e9[_0x70d4('0x29')][_0x70d4('0x31')]);_0x3c3f96[_0x70d4('0x32')]=qs[_0x70d4('0x2a')](_['pick'](_0x2866e9['query'],_0x34856e[_0x70d4('0x2a')]),_0x421e31);if(_0x2866e9[_0x70d4('0x29')]['filter']){_0x3c3f96[_0x70d4('0x32')]=_[_0x70d4('0x33')](_0x3c3f96[_0x70d4('0x32')],{'$or':_['map'](_0x421e31,function(_0x58a98b){if(_0x58a98b[_0x70d4('0x27')]!==_0x70d4('0x34')){var _0xfb0043={};_0xfb0043[_0x58a98b[_0x70d4('0x22')]]={'$like':'%'+_0x2866e9[_0x70d4('0x29')][_0x70d4('0x35')]+'%'};return _0xfb0043;}})});}_0x3c3f96=_[_0x70d4('0x33')]({},_0x3c3f96,_0x2866e9[_0x70d4('0x36')]);var _0x6bff61={'where':_0x3c3f96[_0x70d4('0x32')]};return db[_0x70d4('0x25')]['count'](_0x6bff61)[_0x70d4('0x1e')](function(_0x2fc010){_0x2cc500[_0x70d4('0x17')]=_0x2fc010;if(_0x2866e9['query'][_0x70d4('0x37')]){_0x3c3f96[_0x70d4('0x38')]=[{'all':!![]}];}return db[_0x70d4('0x25')][_0x70d4('0x39')](_0x3c3f96);})[_0x70d4('0x1e')](function(_0x3e3215){_0x2cc500[_0x70d4('0x3a')]=_0x3e3215;return _0x2cc500;})[_0x70d4('0x1e')](respondWithFilteredResult(_0xac6c52,_0x3c3f96))[_0x70d4('0x3b')](handleError(_0xac6c52,null));};exports[_0x70d4('0x3c')]=function(_0xaf661d,_0x54d258){var _0x33c563={'raw':!![],'where':{'id':_0xaf661d[_0x70d4('0x3d')]['id']}},_0x453bee={};_0x453bee[_0x70d4('0x28')]=_[_0x70d4('0x3e')](db[_0x70d4('0x25')]['rawAttributes']);_0x453bee[_0x70d4('0x29')]=_[_0x70d4('0x3e')](_0xaf661d[_0x70d4('0x29')]);_0x453bee['filters']=_[_0x70d4('0x2c')](_0x453bee[_0x70d4('0x28')],_0x453bee['query']);_0x33c563[_0x70d4('0x2b')]=_[_0x70d4('0x2c')](_0x453bee['model'],qs['fields'](_0xaf661d[_0x70d4('0x29')][_0x70d4('0x2d')]));_0x33c563[_0x70d4('0x2b')]=_0x33c563['attributes']['length']?_0x33c563[_0x70d4('0x2b')]:_0x453bee[_0x70d4('0x28')];if(_0xaf661d[_0x70d4('0x29')][_0x70d4('0x37')]){_0x33c563['include']=[{'all':!![]}];}_0x33c563=_[_0x70d4('0x33')]({},_0x33c563,_0xaf661d[_0x70d4('0x36')]);return db[_0x70d4('0x25')][_0x70d4('0x3f')](_0x33c563)['then'](handleEntityNotFound(_0x54d258,null))[_0x70d4('0x1e')](respondWithResult(_0x54d258,null))[_0x70d4('0x3b')](handleError(_0x54d258,null));};exports['create']=function(_0x574b4a,_0x43299b){return db[_0x70d4('0x25')]['create'](_0x574b4a[_0x70d4('0x40')],{})['then'](respondWithResult(_0x43299b,0xc9))['catch'](handleError(_0x43299b,null));};exports[_0x70d4('0x41')]=function(_0x5eb136,_0x4fb899){if(_0x5eb136['body']['id']){delete _0x5eb136['body']['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x5eb136['params']['id']}})[_0x70d4('0x1e')](handleEntityNotFound(_0x4fb899,null))[_0x70d4('0x1e')](saveUpdates(_0x5eb136[_0x70d4('0x40')],null))[_0x70d4('0x1e')](respondWithResult(_0x4fb899,null))[_0x70d4('0x3b')](handleError(_0x4fb899,null));};exports['destroy']=function(_0x4fad89,_0x270066){return db['WhatsappTransferReport'][_0x70d4('0x3f')]({'where':{'id':_0x4fad89['params']['id']}})['then'](handleEntityNotFound(_0x270066,null))[_0x70d4('0x1e')](removeEntity(_0x270066,null))[_0x70d4('0x3b')](handleError(_0x270066,null));};exports['describe']=function(_0x48b966,_0x24a971){return db[_0x70d4('0x25')]['describe']()[_0x70d4('0x1e')](respondWithResult(_0x24a971,null))[_0x70d4('0x3b')](handleError(_0x24a971,null));}; \ No newline at end of file +var _0xf825=['offset','limit','set','json','apply','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','WhatsappTransferReport','findAll','rows','catch','show','params','length','options','find','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count'];(function(_0x4a5da0,_0xcdeb16){var _0x5901e4=function(_0x23ae19){while(--_0x23ae19){_0x4a5da0['push'](_0x4a5da0['shift']());}};_0x5901e4(++_0xcdeb16);}(_0xf825,0xc3));var _0x5f82=function(_0x15316b,_0x1cff0a){_0x15316b=_0x15316b-0x0;var _0x1b04b2=_0xf825[_0x15316b];return _0x1b04b2;};'use strict';var pdf=require(_0x5f82('0x0'));var emlformat=require(_0x5f82('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5f82('0x2'));var rp=require(_0x5f82('0x3'));var moment=require(_0x5f82('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5f82('0x5'));var util=require('util');var path=require(_0x5f82('0x6'));var sox=require(_0x5f82('0x7'));var csv=require(_0x5f82('0x8'));var ejs=require(_0x5f82('0x9'));var fs=require('fs');var _=require(_0x5f82('0xa'));var squel=require('squel');var crypto=require(_0x5f82('0xb'));var jsforce=require(_0x5f82('0xc'));var deskjs=require(_0x5f82('0xd'));var toCsv=require(_0x5f82('0x8'));var querystring=require(_0x5f82('0xe'));var Papa=require(_0x5f82('0xf'));var Redis=require('ioredis');var authService=require(_0x5f82('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5f82('0x11'));var hardwareService=require(_0x5f82('0x12'));var logger=require(_0x5f82('0x13'))('api');var utils=require(_0x5f82('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5f82('0x15'));var db=require(_0x5f82('0x16'))['db'];function respondWithStatusCode(_0x401cfa,_0x20cf39){_0x20cf39=_0x20cf39||0xcc;return function(_0x1651c3){if(_0x1651c3){return _0x401cfa[_0x5f82('0x17')](_0x20cf39);}return _0x401cfa[_0x5f82('0x18')](_0x20cf39)[_0x5f82('0x19')]();};}function respondWithResult(_0xaddd09,_0x3fdfb3){_0x3fdfb3=_0x3fdfb3||0xc8;return function(_0x531e6b){if(_0x531e6b){return _0xaddd09[_0x5f82('0x18')](_0x3fdfb3)['json'](_0x531e6b);}};}function respondWithFilteredResult(_0x57a68c,_0x90c551){return function(_0x3dbc9f){if(_0x3dbc9f){var _0x23d50e=_0x3dbc9f[_0x5f82('0x1a')],_0x30d941=_0x90c551[_0x5f82('0x1b')],_0x2fc663=_0x90c551[_0x5f82('0x1b')]+_0x90c551[_0x5f82('0x1c')],_0x136902;if(_0x2fc663>=_0x23d50e){_0x2fc663=_0x23d50e;_0x136902=0xc8;}else{_0x136902=0xce;}_0x57a68c[_0x5f82('0x18')](_0x136902);return _0x57a68c[_0x5f82('0x1d')]('Content-Range',_0x30d941+'-'+_0x2fc663+'/'+_0x23d50e)[_0x5f82('0x1e')](_0x3dbc9f);}return null;};}function patchUpdates(_0x24248c){return function(_0x2aca7e){try{jsonpatch[_0x5f82('0x1f')](_0x2aca7e,_0x24248c,!![]);}catch(_0x54df06){return BPromise['reject'](_0x54df06);}return _0x2aca7e[_0x5f82('0x20')]();};}function saveUpdates(_0x2c1974,_0x53ef1f){return function(_0x18cf3b){if(_0x18cf3b){return _0x18cf3b[_0x5f82('0x21')](_0x2c1974)[_0x5f82('0x22')](function(_0x4051d4){return _0x4051d4;});}return null;};}function removeEntity(_0x58523c,_0x1724dd){return function(_0x8eb803){if(_0x8eb803){return _0x8eb803[_0x5f82('0x23')]()[_0x5f82('0x22')](function(){_0x58523c[_0x5f82('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4503ee,_0x48509a){return function(_0x5b552d){if(!_0x5b552d){_0x4503ee[_0x5f82('0x17')](0x194);}return _0x5b552d;};}function handleError(_0x5c515b,_0x24c975){_0x24c975=_0x24c975||0x1f4;return function(_0x6f2c63){logger[_0x5f82('0x24')](_0x6f2c63['stack']);if(_0x6f2c63[_0x5f82('0x25')]){delete _0x6f2c63[_0x5f82('0x25')];}_0x5c515b['status'](_0x24c975)[_0x5f82('0x26')](_0x6f2c63);};}exports['index']=function(_0x1c7daa,_0x591b15){var _0x5c5cb0={},_0x252d50={},_0x5c0126={'count':0x0,'rows':[]};var _0x4ca0cc=_[_0x5f82('0x27')](db['WhatsappTransferReport'][_0x5f82('0x28')],function(_0x4448f4){return{'name':_0x4448f4[_0x5f82('0x29')],'type':_0x4448f4[_0x5f82('0x2a')][_0x5f82('0x2b')]};});_0x252d50[_0x5f82('0x2c')]=_['map'](_0x4ca0cc,_0x5f82('0x25'));_0x252d50[_0x5f82('0x2d')]=_[_0x5f82('0x2e')](_0x1c7daa[_0x5f82('0x2d')]);_0x252d50[_0x5f82('0x2f')]=_[_0x5f82('0x30')](_0x252d50['model'],_0x252d50['query']);_0x5c5cb0['attributes']=_[_0x5f82('0x30')](_0x252d50[_0x5f82('0x2c')],qs[_0x5f82('0x31')](_0x1c7daa[_0x5f82('0x2d')][_0x5f82('0x31')]));_0x5c5cb0['attributes']=_0x5c5cb0[_0x5f82('0x32')]['length']?_0x5c5cb0[_0x5f82('0x32')]:_0x252d50['model'];if(!_0x1c7daa[_0x5f82('0x2d')][_0x5f82('0x33')](_0x5f82('0x34'))){_0x5c5cb0[_0x5f82('0x1c')]=qs['limit'](_0x1c7daa[_0x5f82('0x2d')]['limit']);_0x5c5cb0[_0x5f82('0x1b')]=qs[_0x5f82('0x1b')](_0x1c7daa['query'][_0x5f82('0x1b')]);}_0x5c5cb0[_0x5f82('0x35')]=qs[_0x5f82('0x36')](_0x1c7daa[_0x5f82('0x2d')]['sort']);_0x5c5cb0[_0x5f82('0x37')]=qs['filters'](_[_0x5f82('0x38')](_0x1c7daa[_0x5f82('0x2d')],_0x252d50[_0x5f82('0x2f')]),_0x4ca0cc);if(_0x1c7daa['query'][_0x5f82('0x39')]){_0x5c5cb0[_0x5f82('0x37')]=_[_0x5f82('0x3a')](_0x5c5cb0['where'],{'$or':_['map'](_0x4ca0cc,function(_0x5612d3){if(_0x5612d3[_0x5f82('0x2a')]!==_0x5f82('0x3b')){var _0x1343b4={};_0x1343b4[_0x5612d3['name']]={'$like':'%'+_0x1c7daa['query'][_0x5f82('0x39')]+'%'};return _0x1343b4;}})});}_0x5c5cb0=_['merge']({},_0x5c5cb0,_0x1c7daa['options']);var _0x11badc={'where':_0x5c5cb0['where']};return db['WhatsappTransferReport']['count'](_0x11badc)[_0x5f82('0x22')](function(_0x45b371){_0x5c0126['count']=_0x45b371;if(_0x1c7daa[_0x5f82('0x2d')][_0x5f82('0x3c')]){_0x5c5cb0[_0x5f82('0x3d')]=[{'all':!![]}];}return db[_0x5f82('0x3e')][_0x5f82('0x3f')](_0x5c5cb0);})['then'](function(_0x1a70e0){_0x5c0126[_0x5f82('0x40')]=_0x1a70e0;return _0x5c0126;})[_0x5f82('0x22')](respondWithFilteredResult(_0x591b15,_0x5c5cb0))[_0x5f82('0x41')](handleError(_0x591b15,null));};exports[_0x5f82('0x42')]=function(_0x20d1c4,_0x667d17){var _0x536ad5={'raw':!![],'where':{'id':_0x20d1c4[_0x5f82('0x43')]['id']}},_0x586093={};_0x586093[_0x5f82('0x2c')]=_[_0x5f82('0x2e')](db[_0x5f82('0x3e')][_0x5f82('0x28')]);_0x586093[_0x5f82('0x2d')]=_[_0x5f82('0x2e')](_0x20d1c4[_0x5f82('0x2d')]);_0x586093[_0x5f82('0x2f')]=_[_0x5f82('0x30')](_0x586093[_0x5f82('0x2c')],_0x586093[_0x5f82('0x2d')]);_0x536ad5[_0x5f82('0x32')]=_[_0x5f82('0x30')](_0x586093[_0x5f82('0x2c')],qs[_0x5f82('0x31')](_0x20d1c4['query'][_0x5f82('0x31')]));_0x536ad5[_0x5f82('0x32')]=_0x536ad5[_0x5f82('0x32')][_0x5f82('0x44')]?_0x536ad5['attributes']:_0x586093[_0x5f82('0x2c')];if(_0x20d1c4[_0x5f82('0x2d')][_0x5f82('0x3c')]){_0x536ad5[_0x5f82('0x3d')]=[{'all':!![]}];}_0x536ad5=_[_0x5f82('0x3a')]({},_0x536ad5,_0x20d1c4[_0x5f82('0x45')]);return db[_0x5f82('0x3e')][_0x5f82('0x46')](_0x536ad5)['then'](handleEntityNotFound(_0x667d17,null))['then'](respondWithResult(_0x667d17,null))['catch'](handleError(_0x667d17,null));};exports[_0x5f82('0x47')]=function(_0x34ddb9,_0x233dfd){return db[_0x5f82('0x3e')][_0x5f82('0x47')](_0x34ddb9[_0x5f82('0x48')],{})[_0x5f82('0x22')](respondWithResult(_0x233dfd,0xc9))[_0x5f82('0x41')](handleError(_0x233dfd,null));};exports[_0x5f82('0x21')]=function(_0x304551,_0x1c7da1){if(_0x304551[_0x5f82('0x48')]['id']){delete _0x304551[_0x5f82('0x48')]['id'];}return db[_0x5f82('0x3e')]['find']({'where':{'id':_0x304551[_0x5f82('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c7da1,null))[_0x5f82('0x22')](saveUpdates(_0x304551[_0x5f82('0x48')],null))[_0x5f82('0x22')](respondWithResult(_0x1c7da1,null))[_0x5f82('0x41')](handleError(_0x1c7da1,null));};exports[_0x5f82('0x23')]=function(_0xbcbd9a,_0x39318f){return db[_0x5f82('0x3e')][_0x5f82('0x46')]({'where':{'id':_0xbcbd9a['params']['id']}})[_0x5f82('0x22')](handleEntityNotFound(_0x39318f,null))['then'](removeEntity(_0x39318f,null))[_0x5f82('0x41')](handleError(_0x39318f,null));};exports[_0x5f82('0x49')]=function(_0x49ccca,_0x5be3be){return db['WhatsappTransferReport'][_0x5f82('0x49')]()['then'](respondWithResult(_0x5be3be,null))[_0x5f82('0x41')](handleError(_0x5be3be,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index fc2c239..0ef0057 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 _0xc2bf=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc2bf,0xb4));var _0xfc2b=function(_0x4c878d,_0x3b8ab1){_0x4c878d=_0x4c878d-0x0;var _0x3f51e2=_0xc2bf[_0x4c878d];return _0x3f51e2;};'use strict';var _=require(_0xfc2b('0x0'));var util=require(_0xfc2b('0x1'));var logger=require(_0xfc2b('0x2'))(_0xfc2b('0x3'));var moment=require('moment');var BPromise=require(_0xfc2b('0x4'));var rp=require(_0xfc2b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc2b('0x6'));var config=require(_0xfc2b('0x7'));var attributes=require(_0xfc2b('0x8'));module[_0xfc2b('0x9')]=function(_0x4d423b,_0x2e7d7b){return _0x4d423b[_0xfc2b('0xa')](_0xfc2b('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xfc2b('0xc'),'fields':[_0xfc2b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e19=['bluebird','request-promise','../../config/environment','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment'];(function(_0x337d23,_0x1485a6){var _0x2b940c=function(_0xd4508d){while(--_0xd4508d){_0x337d23['push'](_0x337d23['shift']());}};_0x2b940c(++_0x1485a6);}(_0x3e19,0x11c));var _0x93e1=function(_0x574ce3,_0x59eef4){_0x574ce3=_0x574ce3-0x0;var _0x3447a0=_0x3e19[_0x574ce3];return _0x3447a0;};'use strict';var _=require('lodash');var util=require(_0x93e1('0x0'));var logger=require(_0x93e1('0x1'))(_0x93e1('0x2'));var moment=require(_0x93e1('0x3'));var BPromise=require(_0x93e1('0x4'));var rp=require(_0x93e1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x93e1('0x6'));var attributes=require(_0x93e1('0x7'));module[_0x93e1('0x8')]=function(_0x30470e,_0x44747f){return _0x30470e[_0x93e1('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x93e1('0xa'),'paranoid':![],'indexes':[{'name':_0x93e1('0xb'),'fields':[_0x93e1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index b790ea1..061d5b8 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(_0x107188,_0x15ac60){var _0x251c9=function(_0x4c182c){while(--_0x4c182c){_0x107188['push'](_0x107188['shift']());}};_0x251c9(++_0x15ac60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x27e68c,_0x4ac489){var _0x344f85=function(_0x2ada45){while(--_0x2ada45){_0x27e68c['push'](_0x27e68c['shift']());}};_0x344f85(++_0x4ac489);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 ce6c307..d0b20a2 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd49=['status','online','seedDB','./config/seedDB','default','./config/license','catch','error','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sync','then','info','start','Online\x20apps:','map','filter','name','join'];(function(_0x599b66,_0x31d795){var _0x4bf02d=function(_0x46e6f2){while(--_0x46e6f2){_0x599b66['push'](_0x599b66['shift']());}};_0x4bf02d(++_0x31d795);}(_0xfd49,0x121));var _0x9fd4=function(_0xbae42,_0x56a807){_0xbae42=_0xbae42-0x0;var _0x1e681e=_0xfd49[_0xbae42];return _0x1e681e;};'use strict';var _=require(_0x9fd4('0x0'));var mysqldb=require(_0x9fd4('0x1'));var rpc=require(_0x9fd4('0x2'));var config=require(_0x9fd4('0x3'));var logger=require(_0x9fd4('0x4'))('app');var pm2=require(_0x9fd4('0x5'));var pm2Config=require(_0x9fd4('0x6'));var schedule=require(_0x9fd4('0x7'));var chat=require(_0x9fd4('0x8'));var whatsapp=require(_0x9fd4('0x9'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize'][_0x9fd4('0xa')]()['then'](function(){return rpc['listen']();})[_0x9fd4('0xb')](function(_0x5aa18c){logger[_0x9fd4('0xc')](_0x5aa18c);return chat['start']();})[_0x9fd4('0xb')](function(){return whatsapp[_0x9fd4('0xd')]();})['then'](function(){return schedule[_0x9fd4('0xd')]();})[_0x9fd4('0xb')](function(){return transcribe[_0x9fd4('0xd')]();})['then'](function(_0x165ebb){logger[_0x9fd4('0xc')](_0x165ebb);return pm2[_0x9fd4('0xd')](pm2Config);})[_0x9fd4('0xb')](function(_0x35e15a){logger[_0x9fd4('0xc')](_0x9fd4('0xe'),_[_0x9fd4('0xf')](_[_0x9fd4('0x10')](_0x35e15a,{'status':'online'}),_0x9fd4('0x11'))[_0x9fd4('0x12')]());logger[_0x9fd4('0xc')]('Offline\x20apps:',_[_0x9fd4('0xf')](_[_0x9fd4('0x10')](_0x35e15a,function(_0x1a609a){return _0x1a609a[_0x9fd4('0x13')]!==_0x9fd4('0x14');}),'name')['join']()||'None');config[_0x9fd4('0x15')]&&require(_0x9fd4('0x16'))[_0x9fd4('0x17')]();require(_0x9fd4('0x18'))[_0x9fd4('0x17')]();})[_0x9fd4('0x19')](function(_0x33e2f4){logger[_0x9fd4('0x1a')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x33e2f4);process[_0x9fd4('0x1b')](0x1);});}main(); \ No newline at end of file +var _0xbc48=['./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','then','start','info','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status','seedDB','default','./config/license','error','exit','lodash','./mysqldb'];(function(_0x5d1193,_0x35ec05){var _0x388a6b=function(_0x500b6c){while(--_0x500b6c){_0x5d1193['push'](_0x5d1193['shift']());}};_0x388a6b(++_0x35ec05);}(_0xbc48,0x111));var _0x8bc4=function(_0x221e48,_0x442db9){_0x221e48=_0x221e48-0x0;var _0x284b6e=_0xbc48[_0x221e48];return _0x284b6e;};'use strict';var _=require(_0x8bc4('0x0'));var mysqldb=require(_0x8bc4('0x1'));var rpc=require(_0x8bc4('0x2'));var config=require(_0x8bc4('0x3'));var logger=require('./config/logger')(_0x8bc4('0x4'));var pm2=require(_0x8bc4('0x5'));var pm2Config=require(_0x8bc4('0x6'));var schedule=require(_0x8bc4('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x8bc4('0x8'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize']['sync']()[_0x8bc4('0x9')](function(){return rpc['listen']();})['then'](function(_0x19c07e){logger['info'](_0x19c07e);return chat[_0x8bc4('0xa')]();})[_0x8bc4('0x9')](function(){return whatsapp[_0x8bc4('0xa')]();})[_0x8bc4('0x9')](function(){return schedule['start']();})[_0x8bc4('0x9')](function(){return transcribe[_0x8bc4('0xa')]();})[_0x8bc4('0x9')](function(_0x2c194e){logger[_0x8bc4('0xb')](_0x2c194e);return pm2[_0x8bc4('0xa')](pm2Config);})[_0x8bc4('0x9')](function(_0x6049b3){logger[_0x8bc4('0xb')](_0x8bc4('0xc'),_[_0x8bc4('0xd')](_[_0x8bc4('0xe')](_0x6049b3,{'status':_0x8bc4('0xf')}),_0x8bc4('0x10'))[_0x8bc4('0x11')]());logger['info'](_0x8bc4('0x12'),_[_0x8bc4('0xd')](_[_0x8bc4('0xe')](_0x6049b3,function(_0xca2e4b){return _0xca2e4b[_0x8bc4('0x13')]!==_0x8bc4('0xf');}),'name')['join']()||'None');config[_0x8bc4('0x14')]&&require('./config/seedDB')[_0x8bc4('0x15')]();require(_0x8bc4('0x16'))[_0x8bc4('0x15')]();})['catch'](function(_0x13348c){logger[_0x8bc4('0x17')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x13348c);process[_0x8bc4('0x18')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 5819872..36d9580 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 _0x8e9d=['authenticate','pass','Unknown\x20authorization\x20format','query','getUuid','User','sub','Setting','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','redirect','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','apikey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','unshift','encryptString','join','promisify','options','verify','secrets','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','express-jwt','basic-auth','crypto','bluebird','util','session','name','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','userProfileId','user','findOne','params','disposition','then','closed','status','unmanaged','json','Forbidden.','catch','isAuthenticated','use','startsWith','headers','authorization','Basic','find'];(function(_0x3ffc40,_0xe319f0){var _0x575992=function(_0x5d43a1){while(--_0x5d43a1){_0x3ffc40['push'](_0x3ffc40['shift']());}};_0x575992(++_0xe319f0);}(_0x8e9d,0x123));var _0xd8e9=function(_0x2c293a,_0x305cc3){_0x2c293a=_0x2c293a-0x0;var _0x131bf8=_0x8e9d[_0x2c293a];return _0x131bf8;};'use strict';var db=require(_0xd8e9('0x0'))['db'];var config=require(_0xd8e9('0x1'));var hardwareConf=require(_0xd8e9('0x2'));var licenseUtil=require(_0xd8e9('0x3'));var encryptor=require(_0xd8e9('0x4'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0xd8e9('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0xd8e9('0x6'));var crypto=require(_0xd8e9('0x7'));var BPromise=require(_0xd8e9('0x8'));var util=require(_0xd8e9('0x9'));var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets'][_0xd8e9('0xa')]});var userAttributes=['id','role','fullname',_0xd8e9('0xb'),_0xd8e9('0xc'),_0xd8e9('0xd'),_0xd8e9('0xe'),_0xd8e9('0xf'),'md5secret',_0xd8e9('0x10'),_0xd8e9('0x11'),_0xd8e9('0x12'),_0xd8e9('0x13'),_0xd8e9('0x14'),'openchannelPause','pauseType',_0xd8e9('0x15'),_0xd8e9('0x16'),_0xd8e9('0x17'),'crudPermissions',_0xd8e9('0x18'),'passwordResetAt',_0xd8e9('0x19'),_0xd8e9('0x1a'),'phoneBarAutoAnswerDelay',_0xd8e9('0x1b'),_0xd8e9('0x1c'),_0xd8e9('0x1d'),_0xd8e9('0x1e'),_0xd8e9('0x1f'),_0xd8e9('0x20'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0xd8e9('0x21'),_0xd8e9('0x22'),_0xd8e9('0x23'),'settingsEnabled'];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])['use'](function(_0x593f51,_0x4fd02e,_0x4b0e5e){if(_0x593f51[_0xd8e9('0x24')]){_0x4b0e5e();}else{return db['ChatInteraction'][_0xd8e9('0x25')]({'where':{'id':_0x593f51[_0xd8e9('0x26')]['id']},'attributes':['id','closed',_0xd8e9('0x27')],'raw':!![]})[_0xd8e9('0x28')](function(_0x4ab95c){if(_0x4ab95c&&_0x4ab95c[_0xd8e9('0x29')]){return _0x4fd02e[_0xd8e9('0x2a')](_0x4ab95c[_0xd8e9('0x27')]===_0xd8e9('0x2b')?0x195:0x193)[_0xd8e9('0x2c')]({'message':_0x4ab95c[_0xd8e9('0x27')]===_0xd8e9('0x2b')?'Unmanaged.':_0xd8e9('0x2d')});}else{_0x4b0e5e();}})[_0xd8e9('0x2e')](function(_0x3a40c7){_0x4b0e5e(_0x3a40c7);});}});};exports[_0xd8e9('0x2f')]=function isAuthenticated(_0x1a44a9){return compose()[_0xd8e9('0x30')](function(_0x1f1a67,_0x203d30,_0xbfb79e){var _0x510a5f;if(_0x1f1a67['headers']['authorization']){if(_[_0xd8e9('0x31')](_0x1f1a67[_0xd8e9('0x32')][_0xd8e9('0x33')],_0xd8e9('0x34'))){var _0x2e986a=basicAuth(_0x1f1a67);db['User'][_0xd8e9('0x35')]({'where':{'name':_0x2e986a['name']}})['then'](function(_0x413093){if(!_0x413093||!_0x413093[_0xd8e9('0x36')](_0x2e986a[_0xd8e9('0x37')])){return _0x203d30['status'](0x191)[_0xd8e9('0x2c')]({'message':'Wrong\x20credentials.'});}_0x1f1a67['user']={'id':_0x413093['id']};_0xbfb79e();})[_0xd8e9('0x2e')](function(_0x9d8ae){_0xbfb79e(_0x9d8ae);});}else if(_[_0xd8e9('0x31')](_0x1f1a67['headers'][_0xd8e9('0x33')],'Bearer')){validateJwt(_0x1f1a67,_0x203d30,_0xbfb79e);}else{if(_0x1a44a9){_0xbfb79e();}else{return _0x203d30[_0xd8e9('0x2a')](0x193)['json']({'message':_0xd8e9('0x38')});}}}else if(_0x1f1a67[_0xd8e9('0x39')]['apikey']){try{var _0x4942a1={'audience':hardwareConf[_0xd8e9('0x3a')](),'issuer':hardwareConf[_0xd8e9('0x3a')]()};verifyJwt(_0x1f1a67['query']['apikey'],_0x4942a1)[_0xd8e9('0x28')](function(_0x3fd380){return db[_0xd8e9('0x3b')][_0xd8e9('0x35')]({'where':{'id':_0x3fd380[_0xd8e9('0x3c')]}})['then'](function(_0x38a403){_0x510a5f=_0x38a403;return db[_0xd8e9('0x3d')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xd8e9('0x3e')],'raw':!![]});})[_0xd8e9('0x28')](function(_0x5e31f2){if(!_0x510a5f||!_[_0xd8e9('0x3f')](_0x510a5f['apiKeyNonce'],_0x3fd380[_0xd8e9('0x40')])){return _0x203d30[_0xd8e9('0x2a')](0x191)[_0xd8e9('0x2c')]({'message':_0xd8e9('0x41')});}if(_0x510a5f[_0xd8e9('0x42')]){return _0x203d30[_0xd8e9('0x2a')](0x191)[_0xd8e9('0x2c')]({'message':_0xd8e9('0x43')});}if(_0x510a5f[_0xd8e9('0x44')]){if(_0x5e31f2[_0xd8e9('0x3e')]>0x0){if(moment(_0x510a5f[_0xd8e9('0x45')])[_0xd8e9('0x46')](_0x5e31f2[_0xd8e9('0x3e')],_0xd8e9('0x47'))>moment()){return _0x203d30['status'](0x191)[_0xd8e9('0x2c')]({'message':_0xd8e9('0x43')});}}else{return _0x203d30[_0xd8e9('0x2a')](0x191)[_0xd8e9('0x2c')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x1f1a67['user']={'id':_0x510a5f['id']};_0xbfb79e();});})[_0xd8e9('0x2e')](function(){return _0x203d30[_0xd8e9('0x2a')](0x191)[_0xd8e9('0x2c')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x23364e){_0xbfb79e(_0x23364e);}}else if(_0x1a44a9){_0xbfb79e();}else{return _0x203d30['status'](0x193)['json']({'message':_0xd8e9('0x38')});}})['use'](function(_0x41c548,_0x1b3449,_0x18dfec){if(_0x41c548[_0xd8e9('0x24')]){db[_0xd8e9('0x3b')][_0xd8e9('0x35')]({'where':{'id':_0x41c548[_0xd8e9('0x24')]['id']},'attributes':userAttributes})[_0xd8e9('0x28')](function(_0x3a22bf){if(!_0x3a22bf){return _0x1b3449['status'](0x194)['json']({'message':'User\x20not\x20found.'});}_0x41c548['user']=_0x3a22bf;_0x18dfec();})[_0xd8e9('0x2e')](function(_0x1aa240){_0x18dfec(_0x1aa240);});}else if(_0x1a44a9){_0x18dfec();}else{return _0x1b3449[_0xd8e9('0x2a')](0x194)[_0xd8e9('0x2c')]({'message':_0xd8e9('0x48')});}});};exports[_0xd8e9('0x49')]=function canUpdate(){return compose()[_0xd8e9('0x30')](function(_0x223264,_0x52084c,_0x5aae5b){return licenseUtil[_0xd8e9('0x4a')]()[_0xd8e9('0x28')](function(_0xb91cbf){if(_0xb91cbf[_0xd8e9('0x4b')]){_0x5aae5b();}else{return _0x52084c[_0xd8e9('0x2a')](0x193)[_0xd8e9('0x2c')]({'message':_0xd8e9('0x4c')});}})['catch'](function(_0x3ddb86){_0x5aae5b(_0x3ddb86);});});};exports[_0xd8e9('0x4d')]=function(_0x3e1109,_0x38cf30,_0xc708dd){_0x3e1109[_0xd8e9('0x4d')]=!![];return _0xc708dd();};exports[_0xd8e9('0x4e')]=function signToken(_0x2be491){return signJwt(_0x2be491);};exports[_0xd8e9('0x4f')]=function(_0x54a860,_0x12939a){if(!_0x54a860['user']){return _0x12939a['status'](0x194)[_0xd8e9('0x2c')]({'message':_0xd8e9('0x50')});}var _0x19f43f={'payload':{'id':_0x54a860[_0xd8e9('0x24')]['id'],'role':_0x54a860['user'][_0xd8e9('0x51')]},'options':{'expiresIn':0x15180}};return signJwt(_0x19f43f)[_0xd8e9('0x28')](function(_0x16afe2){_0x12939a[_0xd8e9('0x52')]('motion.token',_0x16afe2);_0x12939a[_0xd8e9('0x53')](_0xd8e9('0x54'));})['catch'](function(_0x1226ef){return _0x12939a['status'](0x1f4)[_0xd8e9('0x55')](_0x1226ef);});};exports['retrieveApiKey']=function(_0xdd0109){if(_[_0xd8e9('0x56')](_0xdd0109[_0xd8e9('0x57')])||_[_0xd8e9('0x56')](_0xdd0109[_0xd8e9('0x58')])){return null;}else{return createJwt(_0xdd0109);}};exports[_0xd8e9('0x59')]=function(_0x2e46ad){_0x2e46ad[_0xd8e9('0x57')]=generateNonce();_0x2e46ad[_0xd8e9('0x58')]=generateIssuedAt();return createJwt(_0x2e46ad);};exports[_0xd8e9('0x5a')]=function(_0x405a7d,_0x2696b5){var _0x482c15=_0x405a7d[_0xd8e9('0x39')][_0xd8e9('0x5b')];if(_0x482c15){var _0x195932={'nonce':_0x2696b5[_0xd8e9('0x57')],'iat':_0x2696b5['apiKeyIat'],'audience':hardwareConf[_0xd8e9('0x3a')](),'issuer':hardwareConf[_0xd8e9('0x3a')]()};return verifyJwt(_0x482c15,_0x195932)[_0xd8e9('0x28')](function(){return generateApiKey(_0x2696b5);});}else{throw{'message':_0xd8e9('0x5c')};}};exports[_0xd8e9('0x5d')]=function(_0x2ace89){var _0x3bcb95=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3bcb95[_0xd8e9('0x5e')](_0x2ace89))throw new db[(_0xd8e9('0x5f'))][(_0xd8e9('0x60'))](_0xd8e9('0x61'));return;};exports['validatePasswordHistory']=function(_0x8d86f8,_0x11b061,_0x10cdab){var _0x13a145=encryptor['decryptString'](_0x11b061)['split'](',');for(var _0x5c11e7=0x0;_0x5c11e7<_0x10cdab;_0x5c11e7++){if(!_0x13a145[_0x5c11e7])break;if(_0x8d86f8[_0xd8e9('0x62')]()===_0x13a145[_0x5c11e7][_0xd8e9('0x62')]()){var _0x492643=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x10cdab);if(_0x10cdab===0x1){_0x492643=_0xd8e9('0x63');}throw new db[(_0xd8e9('0x5f'))]['ValidationError'](_0x492643);}}return;};exports[_0xd8e9('0x64')]=function(_0x4e529d,_0x28fefe){var _0x22c72f=_0x28fefe?encryptor[_0xd8e9('0x65')](_0x28fefe)['split'](','):[];if(_0x22c72f['length']===0x5){_0x22c72f['splice'](-0x1,0x1);}_0x22c72f[_0xd8e9('0x66')](_0x4e529d);return encryptor[_0xd8e9('0x67')](_0x22c72f[_0xd8e9('0x68')](','));};function signJwt(_0x3b420b){var _0xabf1a=BPromise[_0xd8e9('0x69')](jwt['sign'],{'context':jwt});var _0x4b9b61=_0x3b420b['secret']||config['secrets'][_0xd8e9('0xa')];return new BPromise(function(_0x197e60,_0x11bc6a){_0xabf1a(_0x3b420b['payload'],_0x4b9b61,_0x3b420b[_0xd8e9('0x6a')])['then'](function(_0x3b2df9){_0x197e60(_0x3b2df9);})[_0xd8e9('0x2e')](function(_0x1359e1){_0x11bc6a(_0x1359e1);});});}function verifyJwt(_0x338ca3,_0x26e8a9,_0x5b3465){var _0xc41fb8=BPromise['promisify'](jwt[_0xd8e9('0x6b')],{'context':jwt});var _0x495e91=_0x5b3465||config[_0xd8e9('0x6c')][_0xd8e9('0xa')];return new BPromise(function(_0x48345c,_0x28dc5b){_0xc41fb8(_0x338ca3,_0x495e91,_0x26e8a9)[_0xd8e9('0x28')](function(_0xdf33d0){_0x48345c(_0xdf33d0);})[_0xd8e9('0x2e')](function(_0x17b376){_0x28dc5b(_0x17b376);});});}function generateNonce(){return crypto[_0xd8e9('0x6d')](0x10)[_0xd8e9('0x6e')](_0xd8e9('0x6f'));}function generateIssuedAt(){return Math[_0xd8e9('0x70')](Date[_0xd8e9('0x71')]()/0x3e8)['toString']();}function createJwt(_0xbb22c2){var _0x49caed={'payload':{'iat':_0xbb22c2[_0xd8e9('0x58')],'nonce':_0xbb22c2[_0xd8e9('0x57')]},'options':{'algorithm':_0xd8e9('0x72'),'subject':_0xbb22c2['id'][_0xd8e9('0x6e')](),'issuer':hardwareConf[_0xd8e9('0x3a')](),'audience':hardwareConf[_0xd8e9('0x3a')]()}};return signJwt(_0x49caed)[_0xd8e9('0x28')](function(_0x5b1c4e){return{'iat':_0xbb22c2['apiKeyIat'],'nonce':_0xbb22c2['apiKeyNonce'],'token':_0x5b1c4e};});} \ No newline at end of file +var _0x66d3=['openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','then','status','disposition','json','Unmanaged.','Forbidden.','catch','headers','startsWith','Basic','find','authenticate','pass','Wrong\x20credentials.','authorization','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','encryptString','promisify','sign','secret','payload','verify','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','basic-auth','bluebird','util','moment','secrets','session','role','fullname','name','internal','email','permissions','voicePause','mailPause','faxPause','smsPause'];(function(_0x488876,_0x4e0103){var _0x2d72cc=function(_0x3554fe){while(--_0x3554fe){_0x488876['push'](_0x488876['shift']());}};_0x2d72cc(++_0x4e0103);}(_0x66d3,0x64));var _0x366d=function(_0x3a8900,_0x34a720){_0x3a8900=_0x3a8900-0x0;var _0x36d343=_0x66d3[_0x3a8900];return _0x36d343;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x366d('0x0'));var hardwareConf=require(_0x366d('0x1'));var licenseUtil=require(_0x366d('0x2'));var encryptor=require('../encryptor');var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0x366d('0x3'));var crypto=require('crypto');var BPromise=require(_0x366d('0x4'));var util=require(_0x366d('0x5'));var moment=require(_0x366d('0x6'));var validateJwt=expressJwt({'secret':config[_0x366d('0x7')][_0x366d('0x8')]});var userAttributes=['id',_0x366d('0x9'),_0x366d('0xa'),_0x366d('0xb'),_0x366d('0xc'),_0x366d('0xd'),'userpic',_0x366d('0xe'),'md5secret',_0x366d('0xf'),'chatPause',_0x366d('0x10'),_0x366d('0x11'),_0x366d('0x12'),_0x366d('0x13'),_0x366d('0x14'),_0x366d('0x15'),'lastLoginAt',_0x366d('0x16'),_0x366d('0x17'),_0x366d('0x18'),_0x366d('0x19'),_0x366d('0x1a'),_0x366d('0x1b'),'phoneBarAutoAnswerDelay',_0x366d('0x1c'),_0x366d('0x1d'),'phoneBarEnableDtmfTone',_0x366d('0x1e'),'phoneBarExpires','phoneBarPrefixRequired',_0x366d('0x1f'),'phoneBarRemoteControlPort',_0x366d('0x20'),_0x366d('0x21'),_0x366d('0x22'),_0x366d('0x23')];exports[_0x366d('0x24')]=function(){return this[_0x366d('0x25')](!![])[_0x366d('0x26')](function(_0x2e8113,_0x401c03,_0x2d416a){if(_0x2e8113[_0x366d('0x27')]){_0x2d416a();}else{return db[_0x366d('0x28')][_0x366d('0x29')]({'where':{'id':_0x2e8113[_0x366d('0x2a')]['id']},'attributes':['id',_0x366d('0x2b'),'disposition'],'raw':!![]})[_0x366d('0x2c')](function(_0x5f55a5){if(_0x5f55a5&&_0x5f55a5[_0x366d('0x2b')]){return _0x401c03[_0x366d('0x2d')](_0x5f55a5[_0x366d('0x2e')]==='unmanaged'?0x195:0x193)[_0x366d('0x2f')]({'message':_0x5f55a5['disposition']==='unmanaged'?_0x366d('0x30'):_0x366d('0x31')});}else{_0x2d416a();}})[_0x366d('0x32')](function(_0x1ba954){_0x2d416a(_0x1ba954);});}});};exports[_0x366d('0x25')]=function isAuthenticated(_0x4df192){return compose()[_0x366d('0x26')](function(_0x202368,_0x4a5ba9,_0x20e383){var _0x33a9a4;if(_0x202368[_0x366d('0x33')]['authorization']){if(_[_0x366d('0x34')](_0x202368[_0x366d('0x33')]['authorization'],_0x366d('0x35'))){var _0x286a37=basicAuth(_0x202368);db['User'][_0x366d('0x36')]({'where':{'name':_0x286a37['name']}})[_0x366d('0x2c')](function(_0x5948f6){if(!_0x5948f6||!_0x5948f6[_0x366d('0x37')](_0x286a37[_0x366d('0x38')])){return _0x4a5ba9['status'](0x191)['json']({'message':_0x366d('0x39')});}_0x202368[_0x366d('0x27')]={'id':_0x5948f6['id']};_0x20e383();})['catch'](function(_0x33295d){_0x20e383(_0x33295d);});}else if(_[_0x366d('0x34')](_0x202368[_0x366d('0x33')][_0x366d('0x3a')],_0x366d('0x3b'))){validateJwt(_0x202368,_0x4a5ba9,_0x20e383);}else{if(_0x4df192){_0x20e383();}else{return _0x4a5ba9[_0x366d('0x2d')](0x193)[_0x366d('0x2f')]({'message':_0x366d('0x3c')});}}}else if(_0x202368[_0x366d('0x3d')][_0x366d('0x3e')]){try{var _0x49004f={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x366d('0x3f')]()};verifyJwt(_0x202368[_0x366d('0x3d')][_0x366d('0x3e')],_0x49004f)[_0x366d('0x2c')](function(_0x1c594f){return db[_0x366d('0x40')][_0x366d('0x36')]({'where':{'id':_0x1c594f['sub']}})[_0x366d('0x2c')](function(_0x299188){_0x33a9a4=_0x299188;return db[_0x366d('0x41')]['findOne']({'where':{'id':0x1},'attributes':[_0x366d('0x42'),'blockDuration'],'raw':!![]});})[_0x366d('0x2c')](function(_0x5aaf97){if(!_0x33a9a4||!_[_0x366d('0x43')](_0x33a9a4[_0x366d('0x44')],_0x1c594f[_0x366d('0x45')])){return _0x4a5ba9['status'](0x191)[_0x366d('0x2f')]({'message':_0x366d('0x46')});}if(_0x33a9a4[_0x366d('0x47')]){return _0x4a5ba9[_0x366d('0x2d')](0x191)[_0x366d('0x2f')]({'message':_0x366d('0x48')});}if(_0x33a9a4[_0x366d('0x49')]){if(_0x5aaf97[_0x366d('0x4a')]>0x0){if(moment(_0x33a9a4[_0x366d('0x4b')])[_0x366d('0x4c')](_0x5aaf97[_0x366d('0x4a')],_0x366d('0x4d'))>moment()){return _0x4a5ba9['status'](0x191)[_0x366d('0x2f')]({'message':_0x366d('0x48')});}}else{return _0x4a5ba9[_0x366d('0x2d')](0x191)[_0x366d('0x2f')]({'message':_0x366d('0x48')});}}_0x202368[_0x366d('0x27')]={'id':_0x33a9a4['id']};_0x20e383();});})[_0x366d('0x32')](function(){return _0x4a5ba9[_0x366d('0x2d')](0x191)[_0x366d('0x2f')]({'message':_0x366d('0x48')});});}catch(_0x2bc34b){_0x20e383(_0x2bc34b);}}else if(_0x4df192){_0x20e383();}else{return _0x4a5ba9[_0x366d('0x2d')](0x193)[_0x366d('0x2f')]({'message':_0x366d('0x3c')});}})[_0x366d('0x26')](function(_0x141791,_0x477801,_0x22392a){if(_0x141791['user']){db[_0x366d('0x40')]['find']({'where':{'id':_0x141791[_0x366d('0x27')]['id']},'attributes':userAttributes})['then'](function(_0x532ad9){if(!_0x532ad9){return _0x477801[_0x366d('0x2d')](0x194)[_0x366d('0x2f')]({'message':_0x366d('0x4e')});}_0x141791['user']=_0x532ad9;_0x22392a();})[_0x366d('0x32')](function(_0x459ccf){_0x22392a(_0x459ccf);});}else if(_0x4df192){_0x22392a();}else{return _0x477801['status'](0x194)[_0x366d('0x2f')]({'message':_0x366d('0x4f')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x366d('0x26')](function(_0x172c45,_0x31ea9e,_0x7e2bd0){return licenseUtil[_0x366d('0x50')]()[_0x366d('0x2c')](function(_0xb6e9b1){if(_0xb6e9b1['update']){_0x7e2bd0();}else{return _0x31ea9e[_0x366d('0x2d')](0x193)[_0x366d('0x2f')]({'message':'Forbidden'});}})['catch'](function(_0x51cc08){_0x7e2bd0(_0x51cc08);});});};exports[_0x366d('0x51')]=function(_0x54a0ec,_0x3721fc,_0xd7d118){_0x54a0ec[_0x366d('0x51')]=!![];return _0xd7d118();};exports[_0x366d('0x52')]=function signToken(_0x4fb783){return signJwt(_0x4fb783);};exports[_0x366d('0x53')]=function(_0x45425b,_0x16cfd1){if(!_0x45425b['user']){return _0x16cfd1[_0x366d('0x2d')](0x194)[_0x366d('0x2f')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x579e95={'payload':{'id':_0x45425b[_0x366d('0x27')]['id'],'role':_0x45425b[_0x366d('0x27')][_0x366d('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x579e95)[_0x366d('0x2c')](function(_0x263782){_0x16cfd1[_0x366d('0x54')](_0x366d('0x55'),_0x263782);_0x16cfd1[_0x366d('0x56')](_0x366d('0x57'));})['catch'](function(_0x40df6e){return _0x16cfd1[_0x366d('0x2d')](0x1f4)[_0x366d('0x58')](_0x40df6e);});};exports['retrieveApiKey']=function(_0x1a8c76){if(_[_0x366d('0x59')](_0x1a8c76['apiKeyNonce'])||_['isNil'](_0x1a8c76[_0x366d('0x5a')])){return null;}else{return createJwt(_0x1a8c76);}};exports[_0x366d('0x5b')]=function(_0x205bca){_0x205bca[_0x366d('0x44')]=generateNonce();_0x205bca[_0x366d('0x5a')]=generateIssuedAt();return createJwt(_0x205bca);};exports['regenerateApiKey']=function(_0x2dae4e,_0x361b05){var _0xfd292d=_0x2dae4e[_0x366d('0x3d')][_0x366d('0x3e')];if(_0xfd292d){var _0x1aa693={'nonce':_0x361b05[_0x366d('0x44')],'iat':_0x361b05[_0x366d('0x5a')],'audience':hardwareConf[_0x366d('0x3f')](),'issuer':hardwareConf[_0x366d('0x3f')]()};return verifyJwt(_0xfd292d,_0x1aa693)['then'](function(){return generateApiKey(_0x361b05);});}else{throw{'message':_0x366d('0x5c')};}};exports[_0x366d('0x5d')]=function(_0x110217){var _0x5c84f1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5c84f1[_0x366d('0x5e')](_0x110217))throw new db[(_0x366d('0x5f'))][(_0x366d('0x60'))](_0x366d('0x61'));return;};exports['validatePasswordHistory']=function(_0x53555c,_0x92f5df,_0xd0289d){var _0x3fea53=encryptor[_0x366d('0x62')](_0x92f5df)[_0x366d('0x63')](',');for(var _0x1ccb85=0x0;_0x1ccb85<_0xd0289d;_0x1ccb85++){if(!_0x3fea53[_0x1ccb85])break;if(_0x53555c[_0x366d('0x64')]()===_0x3fea53[_0x1ccb85][_0x366d('0x64')]()){var _0x772690=util[_0x366d('0x65')](_0x366d('0x66'),_0xd0289d);if(_0xd0289d===0x1){_0x772690=_0x366d('0x67');}throw new db[(_0x366d('0x5f'))][(_0x366d('0x60'))](_0x772690);}}return;};exports[_0x366d('0x68')]=function(_0x5631b4,_0x333770){var _0x246582=_0x333770?encryptor[_0x366d('0x62')](_0x333770)[_0x366d('0x63')](','):[];if(_0x246582[_0x366d('0x69')]===0x5){_0x246582[_0x366d('0x6a')](-0x1,0x1);}_0x246582['unshift'](_0x5631b4);return encryptor[_0x366d('0x6b')](_0x246582['join'](','));};function signJwt(_0x583331){var _0x434356=BPromise[_0x366d('0x6c')](jwt[_0x366d('0x6d')],{'context':jwt});var _0x12ca1b=_0x583331[_0x366d('0x6e')]||config['secrets'][_0x366d('0x8')];return new BPromise(function(_0xb26d5e,_0x424315){_0x434356(_0x583331[_0x366d('0x6f')],_0x12ca1b,_0x583331['options'])[_0x366d('0x2c')](function(_0x56cae9){_0xb26d5e(_0x56cae9);})[_0x366d('0x32')](function(_0x2c878c){_0x424315(_0x2c878c);});});}function verifyJwt(_0x3499ef,_0x44eb66,_0x408f84){var _0x507301=BPromise[_0x366d('0x6c')](jwt[_0x366d('0x70')],{'context':jwt});var _0x46676a=_0x408f84||config[_0x366d('0x7')]['session'];return new BPromise(function(_0x338edd,_0x6b048d){_0x507301(_0x3499ef,_0x46676a,_0x44eb66)[_0x366d('0x2c')](function(_0x371123){_0x338edd(_0x371123);})['catch'](function(_0x5795d3){_0x6b048d(_0x5795d3);});});}function generateNonce(){return crypto[_0x366d('0x71')](0x10)[_0x366d('0x72')](_0x366d('0x73'));}function generateIssuedAt(){return Math[_0x366d('0x74')](Date[_0x366d('0x75')]()/0x3e8)[_0x366d('0x72')]();}function createJwt(_0x310c26){var _0x58f12c={'payload':{'iat':_0x310c26[_0x366d('0x5a')],'nonce':_0x310c26[_0x366d('0x44')]},'options':{'algorithm':_0x366d('0x76'),'subject':_0x310c26['id']['toString'](),'issuer':hardwareConf[_0x366d('0x3f')](),'audience':hardwareConf[_0x366d('0x3f')]()}};return signJwt(_0x58f12c)[_0x366d('0x2c')](function(_0x5980ac){return{'iat':_0x310c26[_0x366d('0x5a')],'nonce':_0x310c26[_0x366d('0x44')],'token':_0x5980ac};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 2f18129..3bfaf83 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 _0xf494=['final','end','close','unlink','decryptFile','data','update','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','../../config/environment','session','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','binary','write'];(function(_0x2ace72,_0x814809){var _0x33d102=function(_0x505fd1){while(--_0x505fd1){_0x2ace72['push'](_0x2ace72['shift']());}};_0x33d102(++_0x814809);}(_0xf494,0x1c6));var _0x4f49=function(_0x67c05b,_0x366c79){_0x67c05b=_0x67c05b-0x0;var _0x252a3c=_0xf494[_0x67c05b];return _0x252a3c;};'use strict';var crypto=require(_0x4f49('0x0'));var fs=require('fs');var BPromise=require(_0x4f49('0x1'));var config=require(_0x4f49('0x2'));const stringOptions={'secret':config['secrets'][_0x4f49('0x3')],'algorithm':_0x4f49('0x4')};const fileOptions={'algorithm':_0x4f49('0x5')};function combineOptions(_0x25677c){var _0x20c0d7={};for(var _0x2a15fb in fileOptions){if(fileOptions[_0x4f49('0x6')](_0x2a15fb)){_0x20c0d7[_0x2a15fb]=fileOptions[_0x2a15fb];}}if(_0x25677c){for(var _0x790e8b in _0x25677c){if(_0x25677c[_0x4f49('0x6')](_0x790e8b)){_0x20c0d7[_0x790e8b]=_0x25677c[_0x790e8b];}}}return _0x20c0d7;}exports[_0x4f49('0x7')]=function(_0x42b0e8,_0x5eb186,_0x58e9a0,_0x169c95){return new BPromise(function(_0x327bd5,_0x31a725){_0x169c95=combineOptions(_0x169c95);var _0x30ca57=new Buffer(_0x58e9a0);var _0x185174=fs[_0x4f49('0x8')](_0x42b0e8);var _0x151d8c=fs[_0x4f49('0x9')](_0x5eb186);var _0x53ee74=crypto[_0x4f49('0xa')](_0x169c95[_0x4f49('0xb')],_0x30ca57);_0x185174['on']('data',function(_0x15e7a1){var _0x5bbc75=new Buffer(_0x53ee74['update'](_0x15e7a1),_0x4f49('0xc'));_0x151d8c[_0x4f49('0xd')](_0x5bbc75);});_0x185174['on']('end',function(){try{var _0x1e1c37=new Buffer(_0x53ee74[_0x4f49('0xe')](_0x4f49('0xc')),_0x4f49('0xc'));_0x151d8c[_0x4f49('0xd')](_0x1e1c37);_0x151d8c[_0x4f49('0xf')]();_0x151d8c['on'](_0x4f49('0x10'),function(){return _0x327bd5(_0x5eb186);});}catch(_0x5c373e){fs[_0x4f49('0x11')](_0x5eb186);return _0x31a725(_0x5c373e);}});});};exports[_0x4f49('0x12')]=function(_0x415e83,_0x5878f4,_0x5bdfaf,_0x2f0a0d){return new BPromise(function(_0x2ecaaa,_0x74886e){_0x2f0a0d=combineOptions(_0x2f0a0d);var _0x5cb79c=new Buffer(_0x5bdfaf);var _0x1dccfd=fs[_0x4f49('0x8')](_0x415e83);var _0x4e85df=fs['createWriteStream'](_0x5878f4);var _0x5bb23b=crypto['createDecipher'](_0x2f0a0d['algorithm'],_0x5cb79c);_0x1dccfd['on'](_0x4f49('0x13'),function(_0x1834f4){var _0x1c2d70=new Buffer(_0x5bb23b[_0x4f49('0x14')](_0x1834f4),'binary');_0x4e85df[_0x4f49('0xd')](_0x1c2d70);});_0x1dccfd['on'](_0x4f49('0xf'),function(){try{var _0x197a49=new Buffer(_0x5bb23b[_0x4f49('0xe')](_0x4f49('0xc')),'binary');_0x4e85df[_0x4f49('0xd')](_0x197a49);_0x4e85df[_0x4f49('0xf')]();_0x4e85df['on'](_0x4f49('0x10'),function(){return _0x2ecaaa(_0x5878f4);});}catch(_0x53b57d){fs[_0x4f49('0x11')](_0x5878f4);return _0x74886e(_0x53b57d);}});});};exports[_0x4f49('0x15')]=function(_0x32ca7b,_0x43c458,_0x9d30aa){var _0x36187b=_0x9d30aa||stringOptions['algorithm'];var _0x4e9041=_0x43c458||stringOptions[_0x4f49('0x16')];var _0x429de7=crypto['createCipher'](_0x36187b,_0x4e9041);var _0x408552=_0x429de7[_0x4f49('0x14')](_0x32ca7b,_0x4f49('0x17'),'base64');_0x408552+=_0x429de7[_0x4f49('0xe')](_0x4f49('0x18'));return _0x408552;};exports[_0x4f49('0x19')]=function(_0x148153,_0xfefbab,_0x122404){var _0x4915af=_0x122404||stringOptions['algorithm'];var _0x239f44=_0xfefbab||stringOptions[_0x4f49('0x16')];var _0x605c91=crypto['createDecipher'](_0x4915af,_0x239f44);var _0x3cbfbd=_0x605c91[_0x4f49('0x14')](_0x148153,_0x4f49('0x18'),'utf8');_0x3cbfbd+=_0x605c91['final'](_0x4f49('0x17'));return _0x3cbfbd;}; \ No newline at end of file +var _0xf006=['secret','utf8','base64','decryptString','../../config/environment','secrets','aes-256-ctr','hasOwnProperty','createReadStream','createWriteStream','createCipher','algorithm','data','update','binary','write','end','final','close','unlink','decryptFile','createDecipher','encryptString'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xf006,0x146));var _0x6f00=function(_0x4a432e,_0x207d0b){_0x4a432e=_0x4a432e-0x0;var _0x303cea=_0xf006[_0x4a432e];return _0x303cea;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var config=require(_0x6f00('0x0'));const stringOptions={'secret':config[_0x6f00('0x1')]['session'],'algorithm':_0x6f00('0x2')};const fileOptions={'algorithm':'aes192'};function combineOptions(_0x1c7a9e){var _0x4f4466={};for(var _0x5039fb in fileOptions){if(fileOptions[_0x6f00('0x3')](_0x5039fb)){_0x4f4466[_0x5039fb]=fileOptions[_0x5039fb];}}if(_0x1c7a9e){for(var _0x402677 in _0x1c7a9e){if(_0x1c7a9e[_0x6f00('0x3')](_0x402677)){_0x4f4466[_0x402677]=_0x1c7a9e[_0x402677];}}}return _0x4f4466;}exports['encryptFile']=function(_0x3c29ff,_0x4f918f,_0x3875fb,_0x3001b1){return new BPromise(function(_0x185728,_0x2d2c55){_0x3001b1=combineOptions(_0x3001b1);var _0x286d32=new Buffer(_0x3875fb);var _0x3001c6=fs[_0x6f00('0x4')](_0x3c29ff);var _0x1e0720=fs[_0x6f00('0x5')](_0x4f918f);var _0x3e6a41=crypto[_0x6f00('0x6')](_0x3001b1[_0x6f00('0x7')],_0x286d32);_0x3001c6['on'](_0x6f00('0x8'),function(_0x4ff833){var _0x1e684a=new Buffer(_0x3e6a41[_0x6f00('0x9')](_0x4ff833),_0x6f00('0xa'));_0x1e0720[_0x6f00('0xb')](_0x1e684a);});_0x3001c6['on'](_0x6f00('0xc'),function(){try{var _0x5e3264=new Buffer(_0x3e6a41[_0x6f00('0xd')]('binary'),_0x6f00('0xa'));_0x1e0720['write'](_0x5e3264);_0x1e0720[_0x6f00('0xc')]();_0x1e0720['on'](_0x6f00('0xe'),function(){return _0x185728(_0x4f918f);});}catch(_0x327e10){fs[_0x6f00('0xf')](_0x4f918f);return _0x2d2c55(_0x327e10);}});});};exports[_0x6f00('0x10')]=function(_0x411203,_0x46bc2c,_0x4d8aee,_0x342c7f){return new BPromise(function(_0x4bfac3,_0x14b15d){_0x342c7f=combineOptions(_0x342c7f);var _0x5085f0=new Buffer(_0x4d8aee);var _0x534275=fs[_0x6f00('0x4')](_0x411203);var _0x6cf83f=fs[_0x6f00('0x5')](_0x46bc2c);var _0x340f78=crypto[_0x6f00('0x11')](_0x342c7f[_0x6f00('0x7')],_0x5085f0);_0x534275['on'](_0x6f00('0x8'),function(_0x295640){var _0x9844bf=new Buffer(_0x340f78[_0x6f00('0x9')](_0x295640),_0x6f00('0xa'));_0x6cf83f[_0x6f00('0xb')](_0x9844bf);});_0x534275['on']('end',function(){try{var _0x4f3031=new Buffer(_0x340f78['final'](_0x6f00('0xa')),_0x6f00('0xa'));_0x6cf83f[_0x6f00('0xb')](_0x4f3031);_0x6cf83f['end']();_0x6cf83f['on'](_0x6f00('0xe'),function(){return _0x4bfac3(_0x46bc2c);});}catch(_0x9066ff){fs[_0x6f00('0xf')](_0x46bc2c);return _0x14b15d(_0x9066ff);}});});};exports[_0x6f00('0x12')]=function(_0x388983,_0x1cbf1c,_0x90d74c){var _0x1ea061=_0x90d74c||stringOptions['algorithm'];var _0x3c05ef=_0x1cbf1c||stringOptions[_0x6f00('0x13')];var _0x1fd40b=crypto['createCipher'](_0x1ea061,_0x3c05ef);var _0x37f062=_0x1fd40b['update'](_0x388983,_0x6f00('0x14'),'base64');_0x37f062+=_0x1fd40b[_0x6f00('0xd')](_0x6f00('0x15'));return _0x37f062;};exports[_0x6f00('0x16')]=function(_0x1f84a6,_0x375d76,_0x49eb87){var _0x23a346=_0x49eb87||stringOptions[_0x6f00('0x7')];var _0x35c16c=_0x375d76||stringOptions[_0x6f00('0x13')];var _0x2671fe=crypto[_0x6f00('0x11')](_0x23a346,_0x35c16c);var _0xff36ce=_0x2671fe[_0x6f00('0x9')](_0x1f84a6,_0x6f00('0x15'),_0x6f00('0x14'));_0xff36ce+=_0x2671fe[_0x6f00('0xd')](_0x6f00('0x14'));return _0xff36ce;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 0666ca3..01cf929 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 _0xbd50=['Failed','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect'];(function(_0x4c7e8e,_0x3c5035){var _0x503c3f=function(_0x5a0659){while(--_0x5a0659){_0x4c7e8e['push'](_0x4c7e8e['shift']());}};_0x503c3f(++_0x3c5035);}(_0xbd50,0x196));var _0x0bd5=function(_0x3b0c35,_0x19bcbe){_0x3b0c35=_0x3b0c35-0x0;var _0x3e1971=_0xbd50[_0x3b0c35];return _0x3e1971;};'use strict';var util=require(_0x0bd5('0x0'));var path=require(_0x0bd5('0x1'));var _=require(_0x0bd5('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x0bd5('0x3'));var zipdir=require(_0x0bd5('0x4'));var rimraf=require(_0x0bd5('0x5'));var db=require(_0x0bd5('0x6'))['db'];var dbH=require(_0x0bd5('0x6'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x0bd5('0x7')][0x2]);var QUERY=process[_0x0bd5('0x7')][0x3];var PATH=process[_0x0bd5('0x7')][0x4];function analyticExtractedReport(_0x2c0db1,_0x1b99f3){var _0x5ebe64={'status':_0x2c0db1};var _0x47e78d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b99f3){_0x5ebe64[_0x0bd5('0x8')]=_0x1b99f3;}return db[_0x0bd5('0x9')][_0x0bd5('0xa')](_0x5ebe64,_0x47e78d);}function main(){var _0x5f5a0c=0x1388;var _0xa98f54;logger[_0x0bd5('0xb')](util['format'](_0x0bd5('0xc'),EXTRACTED_REPORT_ID,_0x0bd5('0xd')));return db['Setting'][_0x0bd5('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0bd5('0xf'),_0x0bd5('0x10')]})['then'](function(_0x2f7a0c){if(_0x2f7a0c){_0xa98f54=_0x2f7a0c;_0x5f5a0c=_0xa98f54[_0x0bd5('0x10')]||0x1388;}})[_0x0bd5('0x11')](function(){return dbH[_0x0bd5('0x12')][_0x0bd5('0x13')](util[_0x0bd5('0x14')](_0x0bd5('0x15'),QUERY),{'type':dbH[_0x0bd5('0x12')]['QueryTypes'][_0x0bd5('0x16')]});})[_0x0bd5('0x11')](function(_0x574315){if(!_0x574315[0x0][_0x0bd5('0x17')]){return analyticExtractedReport(_0x0bd5('0x18'));}var _0x3a34e4=[];var _0xc22553=0x0;var _0x55d565=!![];if(_0x574315&&_0x574315[_0x0bd5('0x19')]){var _0x2e4f36=_0x574315[0x0][_0x0bd5('0x17')]%(_0xc22553+_0x5f5a0c);if(_0xa98f54[_0x0bd5('0xf')]){for(;_0x55d565;_0xc22553+=_0x5f5a0c,_0x2e4f36=_0x574315[0x0][_0x0bd5('0x17')]%(_0xc22553+_0x5f5a0c)){if(_0x2e4f36==0x0||_0x2e4f36==_0x574315[0x0][_0x0bd5('0x17')]){_0x55d565=![];}_0x3a34e4[_0x0bd5('0x1a')](dbH[_0x0bd5('0x12')][_0x0bd5('0x13')](util[_0x0bd5('0x14')](_0x0bd5('0x1b'),QUERY,_0x5f5a0c,_0xc22553),{'type':dbH[_0x0bd5('0x12')][_0x0bd5('0x1c')][_0x0bd5('0x16')]}));}}else{_0x3a34e4['push'](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x0bd5('0x16')]}));}}var _0x86381d=path[_0x0bd5('0x1d')](PATH);var _0x4a6910=path[_0x0bd5('0x1e')](PATH,'.csv');var _0x440f85=_0xa98f54[_0x0bd5('0xf')]&&_0x3a34e4[_0x0bd5('0x19')]>0x1;var _0x5a8139=[];if(!fs[_0x0bd5('0x1f')](path['join'](_0x86381d,_0x4a6910))&&_0x440f85){fs['mkdirSync'](path[_0x0bd5('0x20')](_0x86381d,_0x4a6910));}return BPromise[_0x0bd5('0x21')](_0x3a34e4,function(_0x184db3){_0x5a8139['push'](_0x184db3);})[_0x0bd5('0x11')](function(){for(var _0x5eab3e=0x0;_0x5eab3e<_0x5a8139[_0x0bd5('0x19')];_0x5eab3e+=0x1){var _0x3ffb08;var _0x18cec3=_0x5a8139[_0x5eab3e];if(_0x440f85){_0x3ffb08=path[_0x0bd5('0x20')](_0x86381d,_0x4a6910,util[_0x0bd5('0x14')](_0x0bd5('0x22'),_0x4a6910,_0x5eab3e,_0x0bd5('0x23')));}else{_0x3ffb08=path[_0x0bd5('0x20')](_0x86381d,util[_0x0bd5('0x14')](_0x0bd5('0x24'),_0x4a6910,_0x0bd5('0x23')));}fs[_0x0bd5('0x25')](_0x3ffb08,csv(_0x18cec3));}})[_0x0bd5('0x11')](function(){if(_0x440f85){zipdir(path[_0x0bd5('0x20')](_0x86381d,_0x4a6910),{'saveTo':path['join'](_0x86381d,util[_0x0bd5('0x14')](_0x0bd5('0x24'),_0x4a6910,'zip'))},function(_0x20e6c3,_0x8eccc9){});rimraf(path['join'](_0x86381d,_0x4a6910),function(){});}})[_0x0bd5('0x11')](function(){logger[_0x0bd5('0xb')](util[_0x0bd5('0x14')](_0x0bd5('0x26'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x0bd5('0x27'),_0x440f85?util[_0x0bd5('0x14')](_0x0bd5('0x24'),_0x4a6910,_0x440f85?_0x0bd5('0x28'):_0x0bd5('0x23')):null);});})[_0x0bd5('0x29')](function(_0x58de46){logger[_0x0bd5('0xb')](util['format'](_0x0bd5('0x2a'),EXTRACTED_REPORT_ID,_0x0bd5('0xd')),util[_0x0bd5('0x2b')](_0x58de46,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0bd5('0x2c'));});}main(); \ No newline at end of file +var _0xa8a8=['SELECT','Empty','length','num','push','query','dirname','basename','.csv','split','existsSync','mkdirSync','join','each','csv','writeFileSync','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','format','CSV','Setting','find','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x474d8c,_0xde2001){var _0x2d0b55=function(_0x1d76c4){while(--_0x1d76c4){_0x474d8c['push'](_0x474d8c['shift']());}};_0x2d0b55(++_0xde2001);}(_0xa8a8,0xec));var _0x8a8a=function(_0x504221,_0x1621a5){_0x504221=_0x504221-0x0;var _0x1e2367=_0xa8a8[_0x504221];return _0x1e2367;};'use strict';var util=require(_0x8a8a('0x0'));var path=require(_0x8a8a('0x1'));var _=require(_0x8a8a('0x2'));var csv=require(_0x8a8a('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x8a8a('0x4'));var rimraf=require(_0x8a8a('0x5'));var db=require(_0x8a8a('0x6'))['db'];var dbH=require(_0x8a8a('0x6'))[_0x8a8a('0x7')];var logger=require(_0x8a8a('0x8'))(_0x8a8a('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x8a8a('0xa')][0x2]);var QUERY=process[_0x8a8a('0xa')][0x3];var PATH=process[_0x8a8a('0xa')][0x4];function analyticExtractedReport(_0x1d7121,_0x8e7aa0){var _0x4225b9={'status':_0x1d7121};var _0xecaa6f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8e7aa0){_0x4225b9[_0x8a8a('0xb')]=_0x8e7aa0;}return db['AnalyticExtractedReport']['update'](_0x4225b9,_0xecaa6f);}function main(){var _0x3c01cd=0x1388;var _0x497b8a;logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8a8a('0xe')));return db[_0x8a8a('0xf')][_0x8a8a('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8a8a('0x11')]})[_0x8a8a('0x12')](function(_0x330796){if(_0x330796){_0x497b8a=_0x330796;_0x3c01cd=_0x497b8a[_0x8a8a('0x11')]||0x1388;}})['then'](function(){return dbH[_0x8a8a('0x13')]['query'](util[_0x8a8a('0xd')](_0x8a8a('0x14'),QUERY),{'type':dbH[_0x8a8a('0x13')][_0x8a8a('0x15')][_0x8a8a('0x16')]});})[_0x8a8a('0x12')](function(_0x16d38d){if(!_0x16d38d[0x0]['num']){return analyticExtractedReport(_0x8a8a('0x17'));}var _0x568b83=[];var _0x1f36b6=0x0;var _0x3046ae=!![];if(_0x16d38d&&_0x16d38d[_0x8a8a('0x18')]){var _0x4291e9=_0x16d38d[0x0][_0x8a8a('0x19')]%(_0x1f36b6+_0x3c01cd);if(_0x497b8a['split']){for(;_0x3046ae;_0x1f36b6+=_0x3c01cd,_0x4291e9=_0x16d38d[0x0][_0x8a8a('0x19')]%(_0x1f36b6+_0x3c01cd)){if(_0x4291e9==0x0||_0x4291e9==_0x16d38d[0x0][_0x8a8a('0x19')]){_0x3046ae=![];}_0x568b83[_0x8a8a('0x1a')](dbH[_0x8a8a('0x13')][_0x8a8a('0x1b')](util[_0x8a8a('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3c01cd,_0x1f36b6),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}else{_0x568b83['push'](dbH[_0x8a8a('0x13')][_0x8a8a('0x1b')](QUERY,{'type':dbH[_0x8a8a('0x13')][_0x8a8a('0x15')][_0x8a8a('0x16')]}));}}var _0x2f6af2=path[_0x8a8a('0x1c')](PATH);var _0xe0321c=path[_0x8a8a('0x1d')](PATH,_0x8a8a('0x1e'));var _0xb9db78=_0x497b8a[_0x8a8a('0x1f')]&&_0x568b83[_0x8a8a('0x18')]>0x1;var _0x625c1b=[];if(!fs[_0x8a8a('0x20')](path['join'](_0x2f6af2,_0xe0321c))&&_0xb9db78){fs[_0x8a8a('0x21')](path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c));}return BPromise[_0x8a8a('0x23')](_0x568b83,function(_0x7662e){_0x625c1b[_0x8a8a('0x1a')](_0x7662e);})[_0x8a8a('0x12')](function(){for(var _0x3aa46d=0x0;_0x3aa46d<_0x625c1b['length'];_0x3aa46d+=0x1){var _0x31d21a;var _0x38c1e0=_0x625c1b[_0x3aa46d];if(_0xb9db78){_0x31d21a=path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c,util['format']('%s%d.%s',_0xe0321c,_0x3aa46d,_0x8a8a('0x24')));}else{_0x31d21a=path[_0x8a8a('0x22')](_0x2f6af2,util['format']('%s.%s',_0xe0321c,'csv'));}fs[_0x8a8a('0x25')](_0x31d21a,csv(_0x38c1e0));}})['then'](function(){if(_0xb9db78){zipdir(path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c),{'saveTo':path[_0x8a8a('0x22')](_0x2f6af2,util['format'](_0x8a8a('0x26'),_0xe0321c,_0x8a8a('0x27')))},function(_0x250852,_0x8df0cb){});rimraf(path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c),function(){});}})[_0x8a8a('0x12')](function(){logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0xb9db78?util[_0x8a8a('0xd')](_0x8a8a('0x26'),_0xe0321c,_0xb9db78?'zip':_0x8a8a('0x24')):null);});})[_0x8a8a('0x28')](function(_0x481e92){logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')](_0x8a8a('0x29'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x481e92,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x8a8a('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 0675f4f..c4db012 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 _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x3eff5b,_0x45d958){var _0x49fb48=function(_0x2eaf68){while(--_0x2eaf68){_0x3eff5b['push'](_0x3eff5b['shift']());}};_0x49fb48(++_0x45d958);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file +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(_0xefdc6c,_0xad5e40){var _0x377341=function(_0x501905){while(--_0x501905){_0xefdc6c['push'](_0xefdc6c['shift']());}};_0x377341(++_0xad5e40);}(_0xb10b,0x12a));var _0xbb10=function(_0x1cbc47,_0x58b1e4){_0x1cbc47=_0x1cbc47-0x0;var _0x2759ff=_0xb10b[_0x1cbc47];return _0x2759ff;};'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 bfcaf0a..19c8010 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 _0xb06b=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','join','mkdirSync','each','xlsx','writeFileSync','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','inspect','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize'];(function(_0x2c3ae4,_0x46cc27){var _0x336def=function(_0x667e17){while(--_0x667e17){_0x2c3ae4['push'](_0x2c3ae4['shift']());}};_0x336def(++_0x46cc27);}(_0xb06b,0x1b6));var _0xbb06=function(_0x2cbf99,_0x587c11){_0x2cbf99=_0x2cbf99-0x0;var _0x44c3bb=_0xb06b[_0x2cbf99];return _0x44c3bb;};'use strict';var util=require(_0xbb06('0x0'));var path=require(_0xbb06('0x1'));var _=require(_0xbb06('0x2'));var fs=require('fs');var json2xls=require(_0xbb06('0x3'));var BPromise=require('bluebird');var zipdir=require(_0xbb06('0x4'));var rimraf=require(_0xbb06('0x5'));var db=require(_0xbb06('0x6'))['db'];var dbH=require(_0xbb06('0x6'))[_0xbb06('0x7')];var logger=require(_0xbb06('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb06('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xbb06('0x9')][0x4];function analyticExtractedReport(_0x4864ab,_0x1a80db){var _0x36077b={'status':_0x4864ab};var _0x3e95ac={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1a80db){_0x36077b[_0xbb06('0xa')]=_0x1a80db;}return db[_0xbb06('0xb')][_0xbb06('0xc')](_0x36077b,_0x3e95ac);}function main(){var _0x501a15=0x1388;var _0x1eef3e;logger[_0xbb06('0xd')](util[_0xbb06('0xe')](_0xbb06('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xbb06('0x10')][_0xbb06('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb06('0x12'),_0xbb06('0x13')]})['then'](function(_0x20a052){if(_0x20a052){_0x1eef3e=_0x20a052;_0x501a15=_0x1eef3e['splitSizeXlsx']||0x1388;}})[_0xbb06('0x14')](function(){return dbH[_0xbb06('0x15')]['query'](util[_0xbb06('0xe')](_0xbb06('0x16'),QUERY),{'type':dbH['sequelize'][_0xbb06('0x17')][_0xbb06('0x18')]});})[_0xbb06('0x14')](function(_0xfa1e4a){if(!_0xfa1e4a[0x0]['num']){return analyticExtractedReport(_0xbb06('0x19'));}var _0x717137=[];var _0x29a785=0x0;var _0x2e08e8=!![];if(_0x1eef3e[_0xbb06('0x12')]){if(_0xfa1e4a&&_0xfa1e4a[_0xbb06('0x1a')]){var _0x4f49d5=_0xfa1e4a[0x0][_0xbb06('0x1b')]%(_0x29a785+_0x501a15);for(;_0x2e08e8;_0x29a785+=_0x501a15,_0x4f49d5=_0xfa1e4a[0x0][_0xbb06('0x1b')]%(_0x29a785+_0x501a15)){if(_0x4f49d5==0x0||_0x4f49d5==_0xfa1e4a[0x0][_0xbb06('0x1b')]){_0x2e08e8=![];}_0x717137[_0xbb06('0x1c')](dbH[_0xbb06('0x15')][_0xbb06('0x1d')](util[_0xbb06('0xe')](_0xbb06('0x1e'),QUERY,_0x501a15,_0x29a785),{'type':dbH[_0xbb06('0x15')][_0xbb06('0x17')][_0xbb06('0x18')]}));}}}else{_0x717137[_0xbb06('0x1c')](dbH[_0xbb06('0x15')][_0xbb06('0x1d')](QUERY,{'type':dbH[_0xbb06('0x15')][_0xbb06('0x17')][_0xbb06('0x18')]}));}var _0x3067d2=path['dirname'](PATH);var _0x5b02fd=path[_0xbb06('0x1f')](PATH,_0xbb06('0x20'));var _0x1585ea=_0x1eef3e[_0xbb06('0x12')]&&_0x717137[_0xbb06('0x1a')]>0x1;var _0x2d8319=[];if(!fs['existsSync'](path[_0xbb06('0x21')](_0x3067d2,_0x5b02fd))&&_0x1585ea){fs[_0xbb06('0x22')](path['join'](_0x3067d2,_0x5b02fd));}return BPromise[_0xbb06('0x23')](_0x717137,function(_0x3935a2){_0x2d8319[_0xbb06('0x1c')](_0x3935a2);})['then'](function(){for(var _0x2d03a3=0x0;_0x2d03a3<_0x2d8319[_0xbb06('0x1a')];_0x2d03a3+=0x1){var _0x4148f8;var _0x2b07e8=_0x2d8319[_0x2d03a3];if(_0x1585ea){_0x4148f8=path['join'](_0x3067d2,_0x5b02fd,util['format']('%s%d.%s',_0x5b02fd,_0x2d03a3,'xlsx'));}else{_0x4148f8=path[_0xbb06('0x21')](_0x3067d2,util[_0xbb06('0xe')]('%s.%s',_0x5b02fd,_0xbb06('0x24')));}fs[_0xbb06('0x25')](_0x4148f8,json2xls(_0x2b07e8),_0xbb06('0x26'));}})[_0xbb06('0x14')](function(){if(_0x1585ea){zipdir(path[_0xbb06('0x21')](_0x3067d2,_0x5b02fd),{'saveTo':path[_0xbb06('0x21')](_0x3067d2,util[_0xbb06('0xe')](_0xbb06('0x27'),_0x5b02fd,_0xbb06('0x28')))},function(_0x1c9e78,_0x88f761){});rimraf(path['join'](_0x3067d2,_0x5b02fd),function(){});}})[_0xbb06('0x14')](function(){logger[_0xbb06('0xd')](util[_0xbb06('0xe')](_0xbb06('0x29'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xbb06('0x2a'),_0x1585ea?util['format'](_0xbb06('0x27'),_0x5b02fd,_0x1585ea?_0xbb06('0x28'):_0xbb06('0x24')):null);});})['catch'](function(_0x29daf2){logger[_0xbb06('0xd')](util[_0xbb06('0xe')](_0xbb06('0x2b'),EXTRACTED_REPORT_ID,_0xbb06('0x2c')),util[_0xbb06('0x2d')](_0x29daf2,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0x17bb=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','xlsx','writeFileSync','%s.%s','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','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeXlsx','then','sequelize','query'];(function(_0x17a67f,_0x1189f5){var _0x266389=function(_0x184708){while(--_0x184708){_0x17a67f['push'](_0x17a67f['shift']());}};_0x266389(++_0x1189f5);}(_0x17bb,0x188));var _0xb17b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x17bb[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0xb17b('0x0'));var path=require(_0xb17b('0x1'));var _=require(_0xb17b('0x2'));var fs=require('fs');var json2xls=require(_0xb17b('0x3'));var BPromise=require(_0xb17b('0x4'));var zipdir=require(_0xb17b('0x5'));var rimraf=require('rimraf');var db=require(_0xb17b('0x6'))['db'];var dbH=require(_0xb17b('0x6'))[_0xb17b('0x7')];var logger=require(_0xb17b('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xb17b('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xb17b('0x9')][0x4];function analyticExtractedReport(_0x2fb79a,_0x8e2647){var _0x500f96={'status':_0x2fb79a};var _0x30604f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8e2647){_0x500f96[_0xb17b('0xa')]=_0x8e2647;}return db[_0xb17b('0xb')][_0xb17b('0xc')](_0x500f96,_0x30604f);}function main(){var _0x420689=0x1388;var _0x32a3ab;logger[_0xb17b('0xd')](util[_0xb17b('0xe')](_0xb17b('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xb17b('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb17b('0x11'),_0xb17b('0x12')]})[_0xb17b('0x13')](function(_0x5ce3a2){if(_0x5ce3a2){_0x32a3ab=_0x5ce3a2;_0x420689=_0x32a3ab['splitSizeXlsx']||0x1388;}})[_0xb17b('0x13')](function(){return dbH[_0xb17b('0x14')][_0xb17b('0x15')](util[_0xb17b('0xe')](_0xb17b('0x16'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})['then'](function(_0x4b3086){if(!_0x4b3086[0x0][_0xb17b('0x17')]){return analyticExtractedReport('Empty');}var _0x428426=[];var _0x56b821=0x0;var _0x40c600=!![];if(_0x32a3ab[_0xb17b('0x11')]){if(_0x4b3086&&_0x4b3086[_0xb17b('0x18')]){var _0x2ffc42=_0x4b3086[0x0]['num']%(_0x56b821+_0x420689);for(;_0x40c600;_0x56b821+=_0x420689,_0x2ffc42=_0x4b3086[0x0][_0xb17b('0x17')]%(_0x56b821+_0x420689)){if(_0x2ffc42==0x0||_0x2ffc42==_0x4b3086[0x0][_0xb17b('0x17')]){_0x40c600=![];}_0x428426[_0xb17b('0x19')](dbH[_0xb17b('0x14')][_0xb17b('0x15')](util[_0xb17b('0xe')](_0xb17b('0x1a'),QUERY,_0x420689,_0x56b821),{'type':dbH[_0xb17b('0x14')][_0xb17b('0x1b')][_0xb17b('0x1c')]}));}}}else{_0x428426[_0xb17b('0x19')](dbH[_0xb17b('0x14')]['query'](QUERY,{'type':dbH[_0xb17b('0x14')]['QueryTypes'][_0xb17b('0x1c')]}));}var _0x47e135=path[_0xb17b('0x1d')](PATH);var _0xc8558c=path[_0xb17b('0x1e')](PATH,_0xb17b('0x1f'));var _0x4ece21=_0x32a3ab[_0xb17b('0x11')]&&_0x428426[_0xb17b('0x18')]>0x1;var _0x28efa1=[];if(!fs[_0xb17b('0x20')](path[_0xb17b('0x21')](_0x47e135,_0xc8558c))&&_0x4ece21){fs[_0xb17b('0x22')](path[_0xb17b('0x21')](_0x47e135,_0xc8558c));}return BPromise[_0xb17b('0x23')](_0x428426,function(_0x35f25b){_0x28efa1[_0xb17b('0x19')](_0x35f25b);})[_0xb17b('0x13')](function(){for(var _0x48533c=0x0;_0x48533c<_0x28efa1[_0xb17b('0x18')];_0x48533c+=0x1){var _0x2387ea;var _0x4ddf27=_0x28efa1[_0x48533c];if(_0x4ece21){_0x2387ea=path[_0xb17b('0x21')](_0x47e135,_0xc8558c,util[_0xb17b('0xe')]('%s%d.%s',_0xc8558c,_0x48533c,_0xb17b('0x24')));}else{_0x2387ea=path['join'](_0x47e135,util[_0xb17b('0xe')]('%s.%s',_0xc8558c,_0xb17b('0x24')));}fs[_0xb17b('0x25')](_0x2387ea,json2xls(_0x4ddf27),'binary');}})[_0xb17b('0x13')](function(){if(_0x4ece21){zipdir(path[_0xb17b('0x21')](_0x47e135,_0xc8558c),{'saveTo':path[_0xb17b('0x21')](_0x47e135,util[_0xb17b('0xe')](_0xb17b('0x26'),_0xc8558c,_0xb17b('0x27')))},function(_0x38e1c7,_0x306548){});rimraf(path[_0xb17b('0x21')](_0x47e135,_0xc8558c),function(){});}})[_0xb17b('0x13')](function(){logger[_0xb17b('0xd')](util['format'](_0xb17b('0x28'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xb17b('0x29'),_0x4ece21?util['format'](_0xb17b('0x26'),_0xc8558c,_0x4ece21?_0xb17b('0x27'):_0xb17b('0x24')):null);});})[_0xb17b('0x2a')](function(_0x50ce89){logger['info'](util[_0xb17b('0xe')](_0xb17b('0x2b'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xb17b('0x2c')](_0x50ce89,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xb17b('0x2d'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 1717874..3bcb80c 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 _0x2b51=['_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','length','createdAt','updatedAt','interval','*,*,*,*','map','tag','callerID','indexOf','app','toLowerCase','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','destroy','catch','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','IntervalId','then','uniq','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','outbound','extension','CDR(destination)=','cutdigits','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x2b51,0x1c5));var _0x12b5=function(_0x1ebef9,_0x286e04){_0x1ebef9=_0x1ebef9-0x0;var _0x212cfd=_0x2b51[_0x1ebef9];return _0x212cfd;};'use strict';var _=require(_0x12b5('0x0'));var util=require(_0x12b5('0x1'));function rewrite(_0x2fe8a8,_0x21a927){var _0x17f329=this;return _0x2fe8a8[_0x12b5('0x2')]['Interval'][_0x12b5('0x3')]({'raw':!![]})['then'](function(_0x5b65f8){_0x17f329[_0x12b5('0x4')]=_0x5b65f8;return _0x2fe8a8[_0x12b5('0x2')][_0x12b5('0x5')][_0x12b5('0x3')]({'where':{'IntervalId':_0x21a927[_0x12b5('0x6')]},'raw':!![]});})[_0x12b5('0x7')](function(_0x22f2e0){return _0x2fe8a8[_0x12b5('0x2')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0x12b5('0x8')](_['map'](_0x22f2e0,_0x12b5('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x12b5('0x7')](function(_0x127cb7){var _0x279b6f=_[_0x12b5('0xa')](_0x127cb7,{'priority':'1'});var _0x37b421=_[_0x12b5('0xa')](_0x127cb7,{'isApp':0x1});var _0x4ef85e=_[_0x12b5('0xb')](_0x37b421,'exten');var _0x5e8c62=[_0x12b5('0xc'),_0x12b5('0xd')];var _0x28e1bc=[];var _0x16fcba=[];for(var _0x20ac1b in _0x4ef85e){if(_0x4ef85e[_0x12b5('0xe')](_0x20ac1b)){_0x17f329[_0x12b5('0xf')]=0x2;_0x17f329['extensions']=[];_0x17f329['extension']=_['find'](_0x279b6f,{'exten':_0x4ef85e[_0x20ac1b][0x0]['exten']});_0x17f329[_0x12b5('0x10')][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':util[_0x12b5('0x14')](_0x12b5('0x15'),_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')]),'context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0]['exten'],'priority':_0x17f329['priority']++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});if(_0x4ef85e[_0x20ac1b][0x0]['type']===_0x12b5('0x18')){if(_0x17f329[_0x12b5('0x19')]){_0x17f329[_0x12b5('0x10')]['push']({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':_0x12b5('0x1a')+(_0x17f329['extension'][_0x12b5('0x1b')]?'${EXTEN:'+_0x17f329[_0x12b5('0x19')][_0x12b5('0x1b')]+'}':'${EXTEN}'),'context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'priority':_0x17f329[_0x12b5('0xf')]++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});}_0x17f329[_0x12b5('0x10')][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':'CDR(routeid)='+_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')],'context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'priority':_0x17f329[_0x12b5('0xf')]++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});var _0x24f52c=_0x17f329['priority']++;_0x17f329['extensions']['push']({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x1c'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x24f52c+0x2)+'):Goto('+(_0x24f52c+0x1)+')','context':_0x4ef85e[_0x20ac1b][0x0]['context'],'exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'priority':_0x24f52c,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});if(_0x17f329[_0x12b5('0x19')]){_0x17f329['extensions']['push']({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':_0x17f329[_0x12b5('0x19')][_0x12b5('0x1b')]?_0x12b5('0x1d')+_0x17f329['extension']['cutdigits']+'}':_0x12b5('0x1e'),'context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0]['exten'],'priority':_0x17f329[_0x12b5('0xf')]++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0]['VoiceExtensionId']});}_0x17f329['extensions'][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':_0x12b5('0x1f')+_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')],'context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0]['exten'],'priority':_0x17f329['priority']++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});if(_0x17f329['extension']&&_0x17f329['extension'][_0x12b5('0xe')]('recordingFormat')&&_0x17f329[_0x12b5('0x19')][_0x12b5('0x20')]!==_0x12b5('0x21')){_0x17f329[_0x12b5('0x10')][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':_0x12b5('0x22'),'context':_0x4ef85e[_0x20ac1b][0x0]['context'],'exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'priority':_0x17f329['priority']++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0]['VoiceExtensionId']});_0x17f329[_0x12b5('0x10')][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':_0x12b5('0x23')+_0x17f329[_0x12b5('0x19')]['recordingFormat']||'wav','context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'priority':_0x17f329['priority']++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});}}_0x17f329[_0x12b5('0x10')][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':_0x12b5('0x24'),'context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0]['exten'],'priority':_0x17f329[_0x12b5('0xf')]++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});_0x17f329[_0x12b5('0x10')][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'priority':_0x17f329[_0x12b5('0xf')]++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});_0x17f329['extensions'][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'priority':_0x17f329['priority']++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0]['VoiceExtensionId']});for(var _0x5774fb=0x0,_0x3d41f9=0x0;_0x5774fb<_0x4ef85e[_0x20ac1b][_0x12b5('0x25')];_0x5774fb+=0x1,_0x3d41f9=0x0){var _0x494b80=_0x4ef85e[_0x20ac1b][_0x5774fb];if(_0x494b80[_0x12b5('0x12')]){_0x494b80[_0x12b5('0x12')]=_0x494b80[_0x12b5('0x12')]['toLowerCase']();}var _0x57d702=[];var _0xcddbe2=[];delete _0x494b80['id'];delete _0x494b80[_0x12b5('0x26')];delete _0x494b80[_0x12b5('0x27')];var _0x109f28=_0x494b80[_0x12b5('0x28')]!==_0x12b5('0x29')?[_0x494b80['interval']]:_0x494b80['IntervalId']?_[_0x12b5('0x2a')](_[_0x12b5('0xa')](_0x17f329[_0x12b5('0x4')],{'IntervalId':_0x494b80[_0x12b5('0x6')]}),_0x12b5('0x28')):[];if(_0x494b80[_0x12b5('0xe')](_0x12b5('0x2b'))){if(_0x494b80[_0x12b5('0x2b')]&&_0x494b80[_0x12b5('0x2b')]!=='--'){_0x57d702[_0x12b5('0x11')]({'type':_0x494b80[_0x12b5('0x12')],'app':'Set','appdata':'CDR(tag)='+_0x494b80[_0x12b5('0x2b')],'context':_0x494b80[_0x12b5('0x16')],'exten':_0x494b80['exten'],'priority':_0x109f28[_0x12b5('0x25')]+_0x17f329[_0x12b5('0xf')]+_0x3d41f9++,'VoiceExtensionId':_0x494b80[_0x12b5('0x17')]});}}if(_0x494b80[_0x12b5('0x12')]===_0x12b5('0x18')&&_0x494b80['hasOwnProperty'](_0x12b5('0x2c'))){if(_0x494b80[_0x12b5('0x2c')]){_0x57d702[_0x12b5('0x11')]({'type':_0x494b80[_0x12b5('0x12')],'app':_0x12b5('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x494b80[_0x12b5('0x2c')]+')','context':_0x494b80[_0x12b5('0x16')],'exten':_0x494b80['exten'],'priority':_0x109f28['length']+_0x17f329['priority']+_0x3d41f9++,'VoiceExtensionId':_0x494b80['VoiceExtensionId']});}else{_0x57d702[_0x12b5('0x11')]({'type':_0x494b80[_0x12b5('0x12')],'app':_0x12b5('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x494b80['context'],'exten':_0x494b80[_0x12b5('0x9')],'priority':_0x109f28[_0x12b5('0x25')]+_0x17f329['priority']+_0x3d41f9++,'VoiceExtensionId':_0x494b80[_0x12b5('0x17')]});}}if(_0x494b80[_0x12b5('0xe')]('answer')){if(_0x5e8c62[_0x12b5('0x2d')](_0x494b80[_0x12b5('0x2e')][_0x12b5('0x2f')]())>=0x0&&_0x494b80[_0x12b5('0x30')]!=='custom'){if(_0x494b80['answer']){_0x57d702['push']({'type':_0x494b80['type'],'app':_0x12b5('0x1c'),'appdata':_0x12b5('0x31'),'context':_0x494b80['context'],'exten':_0x494b80[_0x12b5('0x9')],'priority':_0x109f28[_0x12b5('0x25')]+_0x17f329[_0x12b5('0xf')]+_0x3d41f9++,'VoiceExtensionId':_0x494b80[_0x12b5('0x17')]});_0x57d702[_0x12b5('0x11')]({'type':_0x494b80[_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':_0x12b5('0x32'),'context':_0x494b80[_0x12b5('0x16')],'exten':_0x494b80[_0x12b5('0x9')],'priority':_0x109f28[_0x12b5('0x25')]+_0x17f329[_0x12b5('0xf')]+_0x3d41f9++,'VoiceExtensionId':_0x494b80[_0x12b5('0x17')]});}else{_0x57d702['push']({'type':_0x494b80['type'],'app':_0x12b5('0x1c'),'appdata':_0x12b5('0x33'),'context':_0x494b80['context'],'exten':_0x494b80[_0x12b5('0x9')],'priority':_0x109f28[_0x12b5('0x25')]+_0x17f329['priority']+_0x3d41f9++,'VoiceExtensionId':_0x494b80[_0x12b5('0x17')]});_0x57d702['push']({'type':_0x494b80[_0x12b5('0x12')],'app':'Set','appdata':_0x12b5('0x34'),'context':_0x494b80['context'],'exten':_0x494b80[_0x12b5('0x9')],'priority':_0x109f28[_0x12b5('0x25')]+_0x17f329['priority']+_0x3d41f9++,'VoiceExtensionId':_0x494b80['VoiceExtensionId']});}}}for(var _0x269a8d=0x0;_0x269a8d<_0x109f28[_0x12b5('0x25')];_0x269a8d+=0x1){var _0xac595a=_0x17f329[_0x12b5('0xf')]+_0x109f28['length'];var _0x3b0ca8=_0x269a8d===_0x109f28['length']-0x1?_0x17f329[_0x12b5('0xf')]+_0x57d702[_0x12b5('0x25')]+_0xcddbe2['length']+0x2:_0x17f329['priority']+_0x269a8d+0x1;_0x57d702[_0x12b5('0x35')](_0x269a8d,0x0,{'type':_0x494b80[_0x12b5('0x12')],'app':_0x12b5('0x36'),'appdata':_0x109f28[_0x269a8d]+'?'+_0x494b80[_0x12b5('0x16')]+_0x12b5('0x37')+_0xac595a+':'+_0x494b80[_0x12b5('0x16')]+',${EXTEN},'+_0x3b0ca8,'exten':_0x494b80[_0x12b5('0x9')],'context':_0x494b80[_0x12b5('0x16')],'priority':_0x17f329[_0x12b5('0xf')]+_0x269a8d,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0]['VoiceExtensionId']});}_0x494b80['priority']=_0x57d702[_0x12b5('0x25')]?_[_0x12b5('0x38')](_0x57d702)[_0x12b5('0xf')]+0x1:_0x17f329['priority'];_0x17f329[_0x12b5('0xf')]=(_0xcddbe2[_0x12b5('0x25')]?_[_0x12b5('0x38')](_0xcddbe2)[_0x12b5('0xf')]:_0x494b80[_0x12b5('0xf')])+0x1;_0x17f329[_0x12b5('0x10')]=_[_0x12b5('0x39')](_0x17f329[_0x12b5('0x10')],_0x57d702,[_0x494b80],_0xcddbe2);}_0x17f329[_0x12b5('0x10')][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0]['type'],'app':'Hangup','exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'priority':_0x17f329[_0x12b5('0xf')],'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});_0x28e1bc[_0x12b5('0x11')](_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]);_0x16fcba=_[_0x12b5('0x39')](_0x16fcba,_0x17f329['extensions']);}}return _0x2fe8a8['transaction'](function(_0x41f3f9){return _0x2fe8a8[_0x12b5('0x2')]['VoiceExtension'][_0x12b5('0x3a')]({'where':{'VoiceExtensionId':{'$in':_0x28e1bc}},'transaction':_0x41f3f9})[_0x12b5('0x7')](function(_0xa7d971){return _0x2fe8a8[_0x12b5('0x2')][_0x12b5('0x5')]['bulkCreate'](_['sortBy'](_0x16fcba,_0x12b5('0xf')),{'transaction':_0x41f3f9});});});})[_0x12b5('0x3b')](function(_0x27139c){console['error'](_0x27139c);});}exports[_0x12b5('0x3c')]=rewrite; \ No newline at end of file +var _0xa40b=['format','CDR(type)=%s','outbound','push','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','context','VoiceExtensionId','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','app','appType','answer','$[${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','sortBy','catch','error','rewrite','util','findAll','then','intervals','VoiceExtension','IntervalId','models','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','playback','hasOwnProperty','priority','extension','find','extensions','type','Set'];(function(_0x291b35,_0x4ed56a){var _0x98c16a=function(_0x4d7377){while(--_0x4d7377){_0x291b35['push'](_0x291b35['shift']());}};_0x98c16a(++_0x4ed56a);}(_0xa40b,0x15e));var _0xba40=function(_0x4c304e,_0x67e33b){_0x4c304e=_0x4c304e-0x0;var _0x347aea=_0xa40b[_0x4c304e];return _0x347aea;};'use strict';var _=require('lodash');var util=require(_0xba40('0x0'));function rewrite(_0x5d7806,_0x16f053){var _0x2a7066=this;return _0x5d7806['models']['Interval'][_0xba40('0x1')]({'raw':!![]})[_0xba40('0x2')](function(_0x110f89){_0x2a7066[_0xba40('0x3')]=_0x110f89;return _0x5d7806['models'][_0xba40('0x4')]['findAll']({'where':{'IntervalId':_0x16f053[_0xba40('0x5')]},'raw':!![]});})[_0xba40('0x2')](function(_0x1fb831){return _0x5d7806[_0xba40('0x6')][_0xba40('0x4')][_0xba40('0x1')]({'where':{'exten':{'$in':_['uniq'](_[_0xba40('0x7')](_0x1fb831,'exten'))}},'order':[{'raw':_0xba40('0x8')}],'raw':!![]});})[_0xba40('0x2')](function(_0x22e714){var _0x4ef7e7=_['filter'](_0x22e714,{'priority':'1'});var _0x1f03b4=_[_0xba40('0x9')](_0x22e714,{'isApp':0x1});var _0x22ca3c=_[_0xba40('0xa')](_0x1f03b4,_0xba40('0xb'));var _0x6b2cb4=['queue',_0xba40('0xc')];var _0x43c8b8=[];var _0x12865e=[];for(var _0x257d79 in _0x22ca3c){if(_0x22ca3c[_0xba40('0xd')](_0x257d79)){_0x2a7066[_0xba40('0xe')]=0x2;_0x2a7066['extensions']=[];_0x2a7066[_0xba40('0xf')]=_[_0xba40('0x10')](_0x4ef7e7,{'exten':_0x22ca3c[_0x257d79][0x0][_0xba40('0xb')]});_0x2a7066[_0xba40('0x11')]['push']({'type':_0x22ca3c[_0x257d79][0x0][_0xba40('0x12')],'app':_0xba40('0x13'),'appdata':util[_0xba40('0x14')](_0xba40('0x15'),_0x22ca3c[_0x257d79][0x0][_0xba40('0x12')]),'context':_0x22ca3c[_0x257d79][0x0]['context'],'exten':_0x22ca3c[_0x257d79][0x0][_0xba40('0xb')],'priority':_0x2a7066[_0xba40('0xe')]++,'VoiceExtensionId':_0x22ca3c[_0x257d79][0x0]['VoiceExtensionId']});if(_0x22ca3c[_0x257d79][0x0]['type']===_0xba40('0x16')){if(_0x2a7066[_0xba40('0xf')]){_0x2a7066['extensions'][_0xba40('0x17')]({'type':_0x22ca3c[_0x257d79][0x0][_0xba40('0x12')],'app':_0xba40('0x13'),'appdata':_0xba40('0x18')+(_0x2a7066[_0xba40('0xf')][_0xba40('0x19')]?_0xba40('0x1a')+_0x2a7066[_0xba40('0xf')][_0xba40('0x19')]+'}':_0xba40('0x1b')),'context':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1c')],'exten':_0x22ca3c[_0x257d79][0x0][_0xba40('0xb')],'priority':_0x2a7066['priority']++,'VoiceExtensionId':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1d')]});}_0x2a7066[_0xba40('0x11')][_0xba40('0x17')]({'type':_0x22ca3c[_0x257d79][0x0]['type'],'app':_0xba40('0x13'),'appdata':_0xba40('0x1e')+_0x22ca3c[_0x257d79][0x0][_0xba40('0x1d')],'context':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1c')],'exten':_0x22ca3c[_0x257d79][0x0][_0xba40('0xb')],'priority':_0x2a7066[_0xba40('0xe')]++,'VoiceExtensionId':_0x22ca3c[_0x257d79][0x0]['VoiceExtensionId']});var _0x23a5e5=_0x2a7066[_0xba40('0xe')]++;_0x2a7066[_0xba40('0x11')][_0xba40('0x17')]({'type':_0x22ca3c[_0x257d79][0x0][_0xba40('0x12')],'app':_0xba40('0x1f'),'appdata':_0xba40('0x20')+(_0x23a5e5+0x2)+_0xba40('0x21')+(_0x23a5e5+0x1)+')','context':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1c')],'exten':_0x22ca3c[_0x257d79][0x0][_0xba40('0xb')],'priority':_0x23a5e5,'VoiceExtensionId':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1d')]});if(_0x2a7066[_0xba40('0xf')]){_0x2a7066['extensions'][_0xba40('0x17')]({'type':_0x22ca3c[_0x257d79][0x0][_0xba40('0x12')],'app':_0xba40('0x13'),'appdata':_0x2a7066[_0xba40('0xf')]['cutdigits']?_0xba40('0x22')+_0x2a7066[_0xba40('0xf')][_0xba40('0x19')]+'}':_0xba40('0x23'),'context':_0x22ca3c[_0x257d79][0x0]['context'],'exten':_0x22ca3c[_0x257d79][0x0]['exten'],'priority':_0x2a7066[_0xba40('0xe')]++,'VoiceExtensionId':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1d')]});}_0x2a7066[_0xba40('0x11')][_0xba40('0x17')]({'type':_0x22ca3c[_0x257d79][0x0][_0xba40('0x12')],'app':_0xba40('0x13'),'appdata':_0xba40('0x24')+_0x22ca3c[_0x257d79][0x0][_0xba40('0x1d')],'context':_0x22ca3c[_0x257d79][0x0]['context'],'exten':_0x22ca3c[_0x257d79][0x0]['exten'],'priority':_0x2a7066['priority']++,'VoiceExtensionId':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1d')]});if(_0x2a7066[_0xba40('0xf')]&&_0x2a7066[_0xba40('0xf')][_0xba40('0xd')](_0xba40('0x25'))&&_0x2a7066[_0xba40('0xf')][_0xba40('0x25')]!==_0xba40('0x26')){_0x2a7066['extensions'][_0xba40('0x17')]({'type':_0x22ca3c[_0x257d79][0x0][_0xba40('0x12')],'app':_0xba40('0x13'),'appdata':_0xba40('0x27'),'context':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1c')],'exten':_0x22ca3c[_0x257d79][0x0][_0xba40('0xb')],'priority':_0x2a7066[_0xba40('0xe')]++,'VoiceExtensionId':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1d')]});_0x2a7066[_0xba40('0x11')][_0xba40('0x17')]({'type':_0x22ca3c[_0x257d79][0x0]['type'],'app':'Set','appdata':_0xba40('0x28')+_0x2a7066[_0xba40('0xf')][_0xba40('0x25')]||_0xba40('0x29'),'context':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1c')],'exten':_0x22ca3c[_0x257d79][0x0][_0xba40('0xb')],'priority':_0x2a7066[_0xba40('0xe')]++,'VoiceExtensionId':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1d')]});}}_0x2a7066[_0xba40('0x11')][_0xba40('0x17')]({'type':_0x22ca3c[_0x257d79][0x0][_0xba40('0x12')],'app':_0xba40('0x13'),'appdata':_0xba40('0x2a'),'context':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1c')],'exten':_0x22ca3c[_0x257d79][0x0][_0xba40('0xb')],'priority':_0x2a7066[_0xba40('0xe')]++,'VoiceExtensionId':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1d')]});_0x2a7066['extensions']['push']({'type':_0x22ca3c[_0x257d79][0x0][_0xba40('0x12')],'app':_0xba40('0x13'),'appdata':_0xba40('0x2b'),'context':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1c')],'exten':_0x22ca3c[_0x257d79][0x0]['exten'],'priority':_0x2a7066[_0xba40('0xe')]++,'VoiceExtensionId':_0x22ca3c[_0x257d79][0x0]['VoiceExtensionId']});_0x2a7066[_0xba40('0x11')][_0xba40('0x17')]({'type':_0x22ca3c[_0x257d79][0x0][_0xba40('0x12')],'app':_0xba40('0x13'),'appdata':_0xba40('0x2c'),'context':_0x22ca3c[_0x257d79][0x0]['context'],'exten':_0x22ca3c[_0x257d79][0x0][_0xba40('0xb')],'priority':_0x2a7066[_0xba40('0xe')]++,'VoiceExtensionId':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1d')]});for(var _0x343a8b=0x0,_0xc0f4c6=0x0;_0x343a8b<_0x22ca3c[_0x257d79]['length'];_0x343a8b+=0x1,_0xc0f4c6=0x0){var _0x45dbc2=_0x22ca3c[_0x257d79][_0x343a8b];if(_0x45dbc2[_0xba40('0x12')]){_0x45dbc2[_0xba40('0x12')]=_0x45dbc2['type'][_0xba40('0x2d')]();}var _0x5d0d55=[];var _0x47f746=[];delete _0x45dbc2['id'];delete _0x45dbc2[_0xba40('0x2e')];delete _0x45dbc2[_0xba40('0x2f')];var _0x4a2dae=_0x45dbc2['interval']!==_0xba40('0x30')?[_0x45dbc2[_0xba40('0x31')]]:_0x45dbc2[_0xba40('0x5')]?_[_0xba40('0x7')](_[_0xba40('0x9')](_0x2a7066['intervals'],{'IntervalId':_0x45dbc2[_0xba40('0x5')]}),_0xba40('0x31')):[];if(_0x45dbc2['hasOwnProperty'](_0xba40('0x32'))){if(_0x45dbc2['tag']&&_0x45dbc2[_0xba40('0x32')]!=='--'){_0x5d0d55['push']({'type':_0x45dbc2['type'],'app':_0xba40('0x13'),'appdata':_0xba40('0x33')+_0x45dbc2[_0xba40('0x32')],'context':_0x45dbc2[_0xba40('0x1c')],'exten':_0x45dbc2[_0xba40('0xb')],'priority':_0x4a2dae[_0xba40('0x34')]+_0x2a7066[_0xba40('0xe')]+_0xc0f4c6++,'VoiceExtensionId':_0x45dbc2[_0xba40('0x1d')]});}}if(_0x45dbc2[_0xba40('0x12')]===_0xba40('0x16')&&_0x45dbc2[_0xba40('0xd')](_0xba40('0x35'))){if(_0x45dbc2['callerID']){_0x5d0d55['push']({'type':_0x45dbc2[_0xba40('0x12')],'app':_0xba40('0x1f'),'appdata':_0xba40('0x36')+_0x45dbc2['callerID']+')','context':_0x45dbc2[_0xba40('0x1c')],'exten':_0x45dbc2['exten'],'priority':_0x4a2dae[_0xba40('0x34')]+_0x2a7066[_0xba40('0xe')]+_0xc0f4c6++,'VoiceExtensionId':_0x45dbc2[_0xba40('0x1d')]});}else{_0x5d0d55['push']({'type':_0x45dbc2[_0xba40('0x12')],'app':_0xba40('0x1f'),'appdata':_0xba40('0x37'),'context':_0x45dbc2[_0xba40('0x1c')],'exten':_0x45dbc2['exten'],'priority':_0x4a2dae[_0xba40('0x34')]+_0x2a7066['priority']+_0xc0f4c6++,'VoiceExtensionId':_0x45dbc2[_0xba40('0x1d')]});}}if(_0x45dbc2[_0xba40('0xd')]('answer')){if(_0x6b2cb4['indexOf'](_0x45dbc2[_0xba40('0x38')][_0xba40('0x2d')]())>=0x0&&_0x45dbc2[_0xba40('0x39')]!=='custom'){if(_0x45dbc2[_0xba40('0x3a')]){_0x5d0d55[_0xba40('0x17')]({'type':_0x45dbc2[_0xba40('0x12')],'app':_0xba40('0x1f'),'appdata':_0xba40('0x3b'),'context':_0x45dbc2[_0xba40('0x1c')],'exten':_0x45dbc2[_0xba40('0xb')],'priority':_0x4a2dae[_0xba40('0x34')]+_0x2a7066[_0xba40('0xe')]+_0xc0f4c6++,'VoiceExtensionId':_0x45dbc2[_0xba40('0x1d')]});_0x5d0d55[_0xba40('0x17')]({'type':_0x45dbc2[_0xba40('0x12')],'app':_0xba40('0x13'),'appdata':_0xba40('0x3c'),'context':_0x45dbc2['context'],'exten':_0x45dbc2[_0xba40('0xb')],'priority':_0x4a2dae['length']+_0x2a7066[_0xba40('0xe')]+_0xc0f4c6++,'VoiceExtensionId':_0x45dbc2[_0xba40('0x1d')]});}else{_0x5d0d55[_0xba40('0x17')]({'type':_0x45dbc2[_0xba40('0x12')],'app':'ExecIf','appdata':_0xba40('0x3d'),'context':_0x45dbc2[_0xba40('0x1c')],'exten':_0x45dbc2['exten'],'priority':_0x4a2dae[_0xba40('0x34')]+_0x2a7066[_0xba40('0xe')]+_0xc0f4c6++,'VoiceExtensionId':_0x45dbc2[_0xba40('0x1d')]});_0x5d0d55['push']({'type':_0x45dbc2[_0xba40('0x12')],'app':_0xba40('0x13'),'appdata':_0xba40('0x3e'),'context':_0x45dbc2[_0xba40('0x1c')],'exten':_0x45dbc2[_0xba40('0xb')],'priority':_0x4a2dae['length']+_0x2a7066[_0xba40('0xe')]+_0xc0f4c6++,'VoiceExtensionId':_0x45dbc2['VoiceExtensionId']});}}}for(var _0x47ed97=0x0;_0x47ed97<_0x4a2dae[_0xba40('0x34')];_0x47ed97+=0x1){var _0x422cef=_0x2a7066[_0xba40('0xe')]+_0x4a2dae[_0xba40('0x34')];var _0x162fd5=_0x47ed97===_0x4a2dae['length']-0x1?_0x2a7066['priority']+_0x5d0d55[_0xba40('0x34')]+_0x47f746['length']+0x2:_0x2a7066['priority']+_0x47ed97+0x1;_0x5d0d55[_0xba40('0x3f')](_0x47ed97,0x0,{'type':_0x45dbc2['type'],'app':_0xba40('0x40'),'appdata':_0x4a2dae[_0x47ed97]+'?'+_0x45dbc2[_0xba40('0x1c')]+_0xba40('0x41')+_0x422cef+':'+_0x45dbc2[_0xba40('0x1c')]+_0xba40('0x41')+_0x162fd5,'exten':_0x45dbc2[_0xba40('0xb')],'context':_0x45dbc2[_0xba40('0x1c')],'priority':_0x2a7066[_0xba40('0xe')]+_0x47ed97,'VoiceExtensionId':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1d')]});}_0x45dbc2[_0xba40('0xe')]=_0x5d0d55['length']?_[_0xba40('0x42')](_0x5d0d55)[_0xba40('0xe')]+0x1:_0x2a7066['priority'];_0x2a7066['priority']=(_0x47f746[_0xba40('0x34')]?_[_0xba40('0x42')](_0x47f746)[_0xba40('0xe')]:_0x45dbc2[_0xba40('0xe')])+0x1;_0x2a7066['extensions']=_[_0xba40('0x43')](_0x2a7066[_0xba40('0x11')],_0x5d0d55,[_0x45dbc2],_0x47f746);}_0x2a7066[_0xba40('0x11')][_0xba40('0x17')]({'type':_0x22ca3c[_0x257d79][0x0][_0xba40('0x12')],'app':_0xba40('0x44'),'exten':_0x22ca3c[_0x257d79][0x0][_0xba40('0xb')],'context':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1c')],'priority':_0x2a7066['priority'],'VoiceExtensionId':_0x22ca3c[_0x257d79][0x0][_0xba40('0x1d')]});_0x43c8b8[_0xba40('0x17')](_0x22ca3c[_0x257d79][0x0][_0xba40('0x1d')]);_0x12865e=_[_0xba40('0x43')](_0x12865e,_0x2a7066[_0xba40('0x11')]);}}return _0x5d7806[_0xba40('0x45')](function(_0x267850){return _0x5d7806[_0xba40('0x6')][_0xba40('0x4')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x43c8b8}},'transaction':_0x267850})[_0xba40('0x2')](function(_0x1a0789){return _0x5d7806[_0xba40('0x6')][_0xba40('0x4')]['bulkCreate'](_[_0xba40('0x46')](_0x12865e,'priority'),{'transaction':_0x267850});});});})[_0xba40('0x47')](function(_0x4a2852){console[_0xba40('0x48')](_0x4a2852);});}exports[_0xba40('0x49')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 35a3575..ad4e9f9 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x16eecb,_0x2fbbc6){var _0x3c9482=function(_0x586a57){while(--_0x586a57){_0x16eecb['push'](_0x16eecb['shift']());}};_0x3c9482(++_0x2fbbc6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +var _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x2fc6a0,_0x574599){var _0x270862=function(_0x4dbbc7){while(--_0x4dbbc7){_0x2fc6a0['push'](_0x2fc6a0['shift']());}};_0x270862(++_0x574599);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x356127,_0x4873ac){_0x356127=_0x356127-0x0;var _0x5d4c75=_0xcb91[_0x356127];return _0x5d4c75;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);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(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){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))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 13ab7c7..23c6826 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 _0xdc91=['firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.id','cm_contacts.ListId','cm_hopper_black','select','cm_contacts','ListId\x20=\x20?','\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','code','query','spread','send','binding','socket_timestamp','server/files/tmp','.csv','keys','header','writeFileSync','parse','createReadStream','length','rows','data','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','then','affectedRows','unlink','catch','complete','argv','arguments\x20\x20\x20','root','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory'];(function(_0x261b08,_0x563d91){var _0xeeaf84=function(_0x5aeb4b){while(--_0x5aeb4b){_0x261b08['push'](_0x261b08['shift']());}};_0xeeaf84(++_0x563d91);}(_0xdc91,0x8b));var _0x1dc9=function(_0x1110db,_0x38b211){_0x1110db=_0x1110db-0x0;var _0x39652c=_0xdc91[_0x1110db];return _0x39652c;};'use strict';var fs=require('fs');var path=require(_0x1dc9('0x0'));var _=require(_0x1dc9('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x1dc9('0x2'));var Redis=require(_0x1dc9('0x3'));var db=require(_0x1dc9('0x4'))['db'];var config=require(_0x1dc9('0x5'));var logger=require(_0x1dc9('0x6'))(_0x1dc9('0x7'));config[_0x1dc9('0x8')]=_[_0x1dc9('0x9')](config['redis'],{'host':_0x1dc9('0xa'),'port':0x18eb});var socket=require(_0x1dc9('0xb'))(new Redis(config[_0x1dc9('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x1dc9('0xc')](_0x1dc9('0xd'));function isEmail(_0x22bf3f){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))*$/[_0x1dc9('0xe')](_0x22bf3f);}function selectNotIn(_0x2e2e69,_0x32a428,_0x107459,_0x5ab573,_0x356525){return squel['select']()[_0x1dc9('0xf')]('phone')[_0x1dc9('0x10')](_0x5ab573)[_0x1dc9('0x11')](_0x32a428,null,_0x32a428+_0x1dc9('0x12')+_0x5ab573+'.'+_0x107459)[_0x1dc9('0x13')](_0x5ab573+'.'+_0x107459+'\x20=\x20'+_0x2e2e69+'.'+_0x107459)[_0x1dc9('0x13')](_0x32a428+_0x1dc9('0x14')+_0x356525['join']()+')');}function insertCmHopper(_0x41c335,_0x39919e,_0x4fb23f,_0x5daaec,_0x8257d3){var _0x197488=[_0x1dc9('0x15'),_0x1dc9('0x16'),'cm_contacts.id','cm_contacts.ListId',_0x39919e+'.'+_0x5daaec,_0x1dc9('0x17'),_0x1dc9('0x18'),'cm_contacts.priority',_0x1dc9('0x19'),'\x22'+_0x8257d3+'\x22'];return squel[_0x1dc9('0x1a')]()[_0x1dc9('0x1b')](_0x1dc9('0x1c'))[_0x1dc9('0x1d')]([_0x1dc9('0x1e'),_0x1dc9('0x1f'),_0x1dc9('0x20'),_0x1dc9('0x21'),_0x5daaec,_0x1dc9('0x22'),_0x1dc9('0x23'),_0x1dc9('0x24'),_0x1dc9('0x25'),'recallme'],squel['select']()[_0x1dc9('0x26')](_0x197488)['from'](_0x39919e)['join']('cm_contacts',null,_0x1dc9('0x27')+_0x39919e+_0x1dc9('0x28'))[_0x1dc9('0x11')](_0x4fb23f,null,_0x4fb23f+_0x1dc9('0x12')+_0x39919e+'.'+_0x5daaec)[_0x1dc9('0x13')](_0x39919e+_0x1dc9('0x29'),_0x41c335)[_0x1dc9('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x1dc9('0x13')](_0x1dc9('0x2a'),selectNotIn(_0x39919e,_0x4fb23f,_0x5daaec,_0x1dc9('0x1c'),['\x22always\x22',_0x1dc9('0x2b')]))[_0x1dc9('0x13')](_0x1dc9('0x2a'),selectNotIn(_0x39919e,_0x4fb23f,_0x5daaec,_0x1dc9('0x1c'),[_0x1dc9('0x2c')])))[_0x1dc9('0x2d')]();}function insertCmHopperBlack(_0x179498,_0x152b48,_0x3e70c3,_0x59f588){var _0x5635e5=[_0x1dc9('0x15'),_0x1dc9('0x2e'),_0x1dc9('0x2f'),_0x152b48+'.'+_0x59f588,_0x1dc9('0x17'),_0x1dc9('0x18')];return squel[_0x1dc9('0x1a')]()[_0x1dc9('0x1b')](_0x1dc9('0x30'))[_0x1dc9('0x1d')](['phone',_0x1dc9('0x20'),_0x1dc9('0x21'),_0x59f588,_0x1dc9('0x22'),_0x1dc9('0x23')],squel[_0x1dc9('0x31')]()[_0x1dc9('0x26')](_0x5635e5)['from'](_0x152b48)['join'](_0x1dc9('0x32'),null,_0x1dc9('0x27')+_0x152b48+'.CmListId')[_0x1dc9('0x11')](_0x3e70c3,null,_0x3e70c3+_0x1dc9('0x12')+_0x152b48+'.'+_0x59f588)[_0x1dc9('0x13')](_0x152b48+'.CmListId\x20=\x20?',_0x179498)[_0x1dc9('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x1dc9('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x1dc9('0xf')](_0x1dc9('0x1e'))[_0x1dc9('0x10')](_0x1dc9('0x30'))['where'](_0x1dc9('0x33'),_0x179498)['where'](_0x59f588+_0x1dc9('0x34'),_0x152b48+'.'+_0x59f588)))[_0x1dc9('0x2d')]();}function insertCmContact(_0x16ba99,_0xf69724,_0x1d6bee,_0x2d3b0b){var _0x40bd50=_[_0x1dc9('0x35')](_['keys'](_0x2d3b0b),['ListId',_0x1dc9('0x36'),_0x1dc9('0x22'),_0x1dc9('0x23')]);return squel[_0x1dc9('0x1a')]()['into'](_0x1dc9('0x32'))['fromQuery'](_0x40bd50,squel[_0x1dc9('0x31')]()[_0x1dc9('0x26')](_0x40bd50)[_0x1dc9('0x10')](_0xf69724)[_0x1dc9('0x13')]('('+_0x1d6bee[_0x1dc9('0x11')](',')+_0x1dc9('0x37'),squel['select']()[_0x1dc9('0x26')](_0x1d6bee)[_0x1dc9('0x10')](_0x1dc9('0x32'))[_0x1dc9('0x13')](_0x1dc9('0x33'),_0x16ba99)[_0x1dc9('0x13')]('deletedAt\x20IS\x20NULL'))[_0x1dc9('0x13')](_0x1dc9('0x38'),squel[_0x1dc9('0x31')]()[_0x1dc9('0xf')]('MIN(id)',_0x1dc9('0x39'))[_0x1dc9('0x10')](_0xf69724)[_0x1dc9('0x3a')](_0x1d6bee[_0x1dc9('0x11')](','))))[_0x1dc9('0x2d')]();}function handleStop(){logger[_0x1dc9('0x3b')](_0x1dc9('0x3c'));stopped=!![];}function handleUncaughtException(_0x1a23c1){logger[_0x1dc9('0x3d')](_0x1a23c1[_0x1dc9('0x3e')]);process[_0x1dc9('0x3f')](0x1);}function handleError(_0x38832d,_0x19b0c2){stats[_0x1dc9('0x40')][_0x1dc9('0x41')]({'name':_0x19b0c2[_0x1dc9('0x42')],'message':_0x19b0c2[_0x1dc9('0x3e')],'row':_0x38832d});}function handleQuery(_0x3188cb){logger[_0x1dc9('0x3b')](_0x3188cb);return db['sequelize'][_0x1dc9('0x43')](_0x3188cb)[_0x1dc9('0x44')](function(_0x3a3033){results[_0x1dc9('0x41')](_0x3a3033);})['catch'](function(_0x44ac64){logger[_0x1dc9('0x3d')](_0x44ac64[_0x1dc9('0x3e')]);});}function main(_0x2a2d42,_0x24aff4,_0x437436,_0x145a17){logger[_0x1dc9('0x3b')]('main',_0x2a2d42,JSON['stringify'](_0x24aff4));process[_0x1dc9('0x45')]('start');var _0xab8eb1=_0x24aff4[_0x1dc9('0x46')];var _0x51943d=_0x24aff4[_0x1dc9('0x47')];var _0x4613f0=path[_0x1dc9('0x11')](config['root'],_0x1dc9('0x48'),_0x51943d+_0x1dc9('0x49'));var _0x2f38ad=_[_0x1dc9('0x4a')](_0xab8eb1)[_0x1dc9('0x11')]();logger[_0x1dc9('0x3b')](_0x1dc9('0x4b'),_0x2f38ad);fs[_0x1dc9('0x4c')](_0x4613f0,_0x2f38ad+'\x0a');Papa[_0x1dc9('0x4d')](fs[_0x1dc9('0x4e')](_0x2a2d42),{'header':!![],'skipEmptyLines':!![],'step':function(_0x51bc90,_0x419ee3){try{for(var _0x4780c2=0x0,_0x27ac48=[];_0x4780c2<_0x51bc90['data'][_0x1dc9('0x4f')];_0x4780c2++){stats[_0x1dc9('0x50')]+=0x1;if(_0x51bc90[_0x1dc9('0x40')][_0x4780c2]){handleError(_0x51bc90[_0x1dc9('0x51')][_0x4780c2],_0x51bc90[_0x1dc9('0x40')][_0x4780c2]);}else{var _0x1f2916=[];for(var _0x170253 in _0xab8eb1){if(_0xab8eb1['hasOwnProperty'](_0x170253)){if(_0x51bc90[_0x1dc9('0x51')][_0x4780c2][_0xab8eb1[_0x170253]]){var _0x120f26=_[_0x1dc9('0x52')](_0x51bc90['data'][_0x4780c2][_0xab8eb1[_0x170253]][_0x1dc9('0x53')](/"/g,'\x27'));switch(_0x170253){case'scheduledat':var _0x46b74b=moment(_0x120f26,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x46b74b['isValid']()){_0x27ac48[_0x1dc9('0x41')]('\x22'+_0x120f26+'\x22');}else{_0x1f2916[_0x1dc9('0x41')](_0x1dc9('0x54'));}break;case _0x1dc9('0x24'):var _0x3b5284=parseInt(_0x120f26);_0x120f26=_['isNaN'](_0x3b5284)||_0x3b5284<0x0||_0x3b5284>0x4?_0x145a17?0x3:0x2:_0x3b5284;_0x27ac48[_0x1dc9('0x41')]('\x22'+_0x120f26+'\x22');break;case _0x1dc9('0x25'):var _0x1d7462=parseInt(_0x120f26);if(_[_0x1dc9('0x55')](_0x1d7462)&&_[_0x1dc9('0x56')](_0x437436,_0x1d7462)){_0x27ac48['push']('\x22'+_0x1d7462+'\x22');}else{_0x1f2916['push']('agent\x20not\x20exists');}break;case _0x1dc9('0x57'):if(isEmail(_0x120f26)){_0x27ac48['push']('\x22'+_0x120f26+'\x22');}else{_0x1f2916[_0x1dc9('0x41')](_0x1dc9('0x58'));}break;case _0x1dc9('0x59'):var _0x45fe79=moment(_0x120f26,_0x1dc9('0x5a'),!![]);if(_0x45fe79['isValid']()){_0x27ac48[_0x1dc9('0x41')]('\x22'+_0x120f26+'\x22');}else{_0x1f2916[_0x1dc9('0x41')](_0x1dc9('0x5b'));}break;default:_0x27ac48['push']('\x22'+_0x120f26+'\x22');}}else{switch(_0x170253){case _0x1dc9('0x5c'):case _0x1dc9('0x1e'):_0x1f2916[_0x1dc9('0x41')](_0x170253+'\x20not\x20specified');break;default:_0x27ac48[_0x1dc9('0x41')]('\x22\x22');}}}}if(_0x1f2916[_0x1dc9('0x4f')]){handleError(_0x51bc90['data'][_0x4780c2],{'code':_0x1dc9('0x5d'),'message':_0x1f2916[_0x1dc9('0x11')]()});}else{fs[_0x1dc9('0x5e')](_0x4613f0,_0x27ac48[_0x1dc9('0x11')]()+'\x0a');}_0x27ac48=[];}if(!(stats[_0x1dc9('0x50')]%0xc8)){socket[_0x1dc9('0x5f')](_0x1dc9('0x60')+_0x51943d,stats);stats['errors']=[];}}if(stopped){logger[_0x1dc9('0x3b')]('Abort\x20parser');_0x419ee3[_0x1dc9('0x61')]();}}catch(_0x720949){handleError(_0x51bc90[_0x1dc9('0x51')][_0x4780c2],{'code':_0x1dc9('0x62'),'message':_0x720949['message']});logger[_0x1dc9('0x3d')](_0x1dc9('0x63'),_0x720949[_0x1dc9('0x3e')]);}},'complete':function(){try{var _0x26cc02=[];var _0x373f22='cm_contacts';if(_0x24aff4[_0x1dc9('0x64')]&&_0x24aff4['duplicates']['length']){_0x373f22=_0x1dc9('0x65')+_0x51943d;_0x26cc02[_0x1dc9('0x41')]('CREATE\x20TABLE\x20'+_0x373f22+_0x1dc9('0x66'));}var _0x5ca806=util[_0x1dc9('0xc')](_0x1dc9('0x67'),_0x4613f0,_0x373f22,_0x2f38ad,_0x24aff4[_0x1dc9('0x21')],_0x24aff4[_0x1dc9('0x36')]||null,NOW,NOW);if(_[_0x1dc9('0x68')](_0xab8eb1[_0x1dc9('0x1f')])){_0x5ca806+=',\x20scheduledAt\x20=\x20NOW()';}_0x26cc02[_0x1dc9('0x41')](_0x5ca806);if(_0x24aff4['duplicates']&&_0x24aff4[_0x1dc9('0x64')][_0x1dc9('0x4f')]){_0x26cc02[_0x1dc9('0x41')](insertCmContact(_0x24aff4[_0x1dc9('0x21')],_0x373f22,_0x24aff4[_0x1dc9('0x64')],_0xab8eb1));_0x26cc02[_0x1dc9('0x41')](_0x1dc9('0x69')+_0x373f22+';');}_0x26cc02[_0x1dc9('0x41')](insertCmHopper(_0x24aff4['ListId'],_0x1dc9('0x6a'),_0x1dc9('0x6b'),_0x1dc9('0x6c'),_0x145a17));_0x26cc02[_0x1dc9('0x41')](insertCmHopperBlack(_0x24aff4[_0x1dc9('0x21')],_0x1dc9('0x6d'),_0x1dc9('0x6b'),_0x1dc9('0x6c')));_0x26cc02[_0x1dc9('0x41')](insertCmHopper(_0x24aff4['ListId'],_0x1dc9('0x6e'),'campaigns',_0x1dc9('0x6f'),_0x145a17));_0x26cc02[_0x1dc9('0x41')](insertCmHopperBlack(_0x24aff4[_0x1dc9('0x21')],_0x1dc9('0x70'),_0x1dc9('0x71'),'CampaignId'));BPromise['each'](_0x26cc02,handleQuery)[_0x1dc9('0x72')](function(_0x2155e4){stats['finish']=!![];stats[_0x1dc9('0x73')]=_0x24aff4[_0x1dc9('0x64')]&&_0x24aff4['duplicates'][_0x1dc9('0x4f')]?results[0x2][_0x1dc9('0x73')]:results[0x0][_0x1dc9('0x73')];socket[_0x1dc9('0x5f')](_0x1dc9('0x60')+_0x51943d,stats);fs[_0x1dc9('0x74')](_0x2a2d42);fs[_0x1dc9('0x74')](_0x4613f0);process[_0x1dc9('0x3f')](0x0);})[_0x1dc9('0x75')](function(_0x5ad8b1){logger[_0x1dc9('0x3d')](_0x5ad8b1[_0x1dc9('0x3e')]);process[_0x1dc9('0x3f')](0x1);});}catch(_0xa3e3eb){logger[_0x1dc9('0x3d')](_0x1dc9('0x76'),_0xa3e3eb[_0x1dc9('0x3e')]);process[_0x1dc9('0x3f')](0x1);}},'error':function(_0x4e179c,_0x439bbd,_0x21ec3a,_0x56f1ff){throw new Error(_0x56f1ff);}});}function validate(){if(process[_0x1dc9('0x77')]&&process['argv']['length']<0x4){throw new Error(_0x1dc9('0x78'));}var _0x4059eb=path[_0x1dc9('0x11')](config[_0x1dc9('0x79')],_0x1dc9('0x48'),process['argv'][0x2]);if(!fs['existsSync'](_0x4059eb)){throw new Error(_0x1dc9('0x7a'));}var _0xa321a1={};try{_0xa321a1=JSON[_0x1dc9('0x4d')](process[_0x1dc9('0x77')][0x3]);if(!_0xa321a1[_0x1dc9('0x46')]){throw new Error(_0x1dc9('0x7b'));}if(!_0xa321a1[_0x1dc9('0x46')][_0x1dc9('0x1e')]){throw new Error(_0x1dc9('0x7c'));}if(!_0xa321a1[_0x1dc9('0x46')]['firstName']){throw new Error(_0x1dc9('0x7d'));}var _0xeefa0f=0x0;if(_0xa321a1[_0x1dc9('0x46')][_0x1dc9('0x25')]){_0xeefa0f=0x1;}if(!_0xa321a1[_0x1dc9('0x21')]){throw new Error(_0x1dc9('0x7e'));}}catch(_0x244423){throw new Error(_0x1dc9('0x7f'));}var _0x57ac35=[];try{_0x57ac35=_[_0x1dc9('0x80')](JSON[_0x1dc9('0x4d')](process['argv'][0x4]),'id');}catch(_0x5948d9){logger[_0x1dc9('0x3b')](_0x1dc9('0x81'));}main(_0x4059eb,_0xa321a1,_0x57ac35,_0xeefa0f);}validate();process['on'](_0x1dc9('0x82'),handleStop);process['on'](_0x1dc9('0x83'),handleUncaughtException); \ No newline at end of file +var _0xccd4=['field','phone','from','.id\x20=\x20','where','join','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_hopper_black','\x20=\x20?','keys','CompanyId','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','error','message','exit','errors','push','spread','catch','stringify','send','start','socket_timestamp','root','server/files/tmp','header','writeFileSync','data','rows','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','length','SystemRow','appendFileSync','contact:import:','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','format','test','select'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xccd4,0xe9));var _0x4ccd=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xccd4[_0x487b0c];return _0x1adbdc;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x4ccd('0x0'));var Papa=require(_0x4ccd('0x1'));var util=require(_0x4ccd('0x2'));var BPromise=require(_0x4ccd('0x3'));var moment=require(_0x4ccd('0x4'));var squel=require(_0x4ccd('0x5'));var Redis=require(_0x4ccd('0x6'));var db=require(_0x4ccd('0x7'))['db'];var config=require(_0x4ccd('0x8'));var logger=require(_0x4ccd('0x9'))(_0x4ccd('0xa'));config[_0x4ccd('0xb')]=_[_0x4ccd('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4ccd('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x4ccd('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x9ccf8){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))*$/[_0x4ccd('0xf')](_0x9ccf8);}function selectNotIn(_0x378711,_0x566d6a,_0x3ebd46,_0x42bd24,_0x2678a5){return squel[_0x4ccd('0x10')]()[_0x4ccd('0x11')](_0x4ccd('0x12'))[_0x4ccd('0x13')](_0x42bd24)['join'](_0x566d6a,null,_0x566d6a+_0x4ccd('0x14')+_0x42bd24+'.'+_0x3ebd46)[_0x4ccd('0x15')](_0x42bd24+'.'+_0x3ebd46+'\x20=\x20'+_0x378711+'.'+_0x3ebd46)['where'](_0x566d6a+'.dialCheckDuplicateType\x20IN\x20('+_0x2678a5[_0x4ccd('0x16')]()+')');}function insertCmHopper(_0x2b8c58,_0xa2e937,_0x3d467c,_0x42c649,_0x4e4c82){var _0x368665=[_0x4ccd('0x17'),'cm_contacts.scheduledat','cm_contacts.id',_0x4ccd('0x18'),_0xa2e937+'.'+_0x42c649,_0x4ccd('0x19'),_0x4ccd('0x1a'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x4e4c82+'\x22'];return squel[_0x4ccd('0x1b')]()[_0x4ccd('0x1c')](_0x4ccd('0x1d'))[_0x4ccd('0x1e')]([_0x4ccd('0x12'),_0x4ccd('0x1f'),_0x4ccd('0x20'),_0x4ccd('0x21'),_0x42c649,_0x4ccd('0x22'),_0x4ccd('0x23'),'priority','UserId',_0x4ccd('0x24')],squel[_0x4ccd('0x10')]()[_0x4ccd('0x25')](_0x368665)[_0x4ccd('0x13')](_0xa2e937)[_0x4ccd('0x16')](_0x4ccd('0x26'),null,_0x4ccd('0x27')+_0xa2e937+_0x4ccd('0x28'))[_0x4ccd('0x16')](_0x3d467c,null,_0x3d467c+_0x4ccd('0x14')+_0xa2e937+'.'+_0x42c649)[_0x4ccd('0x15')](_0xa2e937+_0x4ccd('0x29'),_0x2b8c58)[_0x4ccd('0x15')](_0x4ccd('0x2a'),NOW)['where'](_0x4ccd('0x2b'),selectNotIn(_0xa2e937,_0x3d467c,_0x42c649,_0x4ccd('0x1d'),['\x22always\x22',_0x4ccd('0x2c')]))['where'](_0x4ccd('0x2b'),selectNotIn(_0xa2e937,_0x3d467c,_0x42c649,_0x4ccd('0x1d'),['\x22always\x22'])))[_0x4ccd('0x2d')]();}function insertCmHopperBlack(_0x29adba,_0x4a5aa6,_0x4c9308,_0x298fce){var _0x19365f=[_0x4ccd('0x17'),'cm_contacts.id','cm_contacts.ListId',_0x4a5aa6+'.'+_0x298fce,'cm_contacts.createdAt',_0x4ccd('0x1a')];return squel[_0x4ccd('0x1b')]()[_0x4ccd('0x1c')](_0x4ccd('0x2e'))['fromQuery'](['phone',_0x4ccd('0x20'),_0x4ccd('0x21'),_0x298fce,_0x4ccd('0x22'),_0x4ccd('0x23')],squel['select']()[_0x4ccd('0x25')](_0x19365f)[_0x4ccd('0x13')](_0x4a5aa6)[_0x4ccd('0x16')](_0x4ccd('0x26'),null,_0x4ccd('0x27')+_0x4a5aa6+_0x4ccd('0x28'))[_0x4ccd('0x16')](_0x4c9308,null,_0x4c9308+'.id\x20=\x20'+_0x4a5aa6+'.'+_0x298fce)['where'](_0x4a5aa6+_0x4ccd('0x29'),_0x29adba)[_0x4ccd('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x4ccd('0x15')](_0x4ccd('0x2b'),squel[_0x4ccd('0x10')]()['field']('phone')[_0x4ccd('0x13')]('cm_hopper_black')[_0x4ccd('0x15')]('ListId\x20=\x20?',_0x29adba)[_0x4ccd('0x15')](_0x298fce+_0x4ccd('0x2f'),_0x4a5aa6+'.'+_0x298fce)))[_0x4ccd('0x2d')]();}function insertCmContact(_0x115100,_0x49e5cc,_0x3aa2b9,_0x474ab5){var _0xf08ef6=_['concat'](_[_0x4ccd('0x30')](_0x474ab5),['ListId',_0x4ccd('0x31'),_0x4ccd('0x22'),'updatedAt']);return squel['insert']()['into'](_0x4ccd('0x26'))['fromQuery'](_0xf08ef6,squel['select']()['fields'](_0xf08ef6)[_0x4ccd('0x13')](_0x49e5cc)[_0x4ccd('0x15')]('('+_0x3aa2b9[_0x4ccd('0x16')](',')+')\x20NOT\x20IN\x20?',squel[_0x4ccd('0x10')]()[_0x4ccd('0x25')](_0x3aa2b9)[_0x4ccd('0x13')](_0x4ccd('0x26'))[_0x4ccd('0x15')](_0x4ccd('0x32'),_0x115100)[_0x4ccd('0x15')](_0x4ccd('0x33')))['where'](_0x4ccd('0x34'),squel[_0x4ccd('0x10')]()[_0x4ccd('0x11')](_0x4ccd('0x35'),'min_id')[_0x4ccd('0x13')](_0x49e5cc)['group'](_0x3aa2b9[_0x4ccd('0x16')](','))))[_0x4ccd('0x2d')]();}function handleStop(){logger[_0x4ccd('0x36')](_0x4ccd('0x37'));stopped=!![];}function handleUncaughtException(_0x1ff62e){logger[_0x4ccd('0x38')](_0x1ff62e[_0x4ccd('0x39')]);process[_0x4ccd('0x3a')](0x1);}function handleError(_0x38f423,_0x5c68ad){stats[_0x4ccd('0x3b')][_0x4ccd('0x3c')]({'name':_0x5c68ad['code'],'message':_0x5c68ad[_0x4ccd('0x39')],'row':_0x38f423});}function handleQuery(_0x2a8433){logger[_0x4ccd('0x36')](_0x2a8433);return db['sequelize']['query'](_0x2a8433)[_0x4ccd('0x3d')](function(_0x43d9f3){results[_0x4ccd('0x3c')](_0x43d9f3);})[_0x4ccd('0x3e')](function(_0x530eae){logger[_0x4ccd('0x38')](_0x530eae[_0x4ccd('0x39')]);});}function main(_0x2ae817,_0x3d7bc7,_0x4aa1e8,_0x4eb013){logger[_0x4ccd('0x36')]('main',_0x2ae817,JSON[_0x4ccd('0x3f')](_0x3d7bc7));process[_0x4ccd('0x40')](_0x4ccd('0x41'));var _0x3381f2=_0x3d7bc7['binding'];var _0x191820=_0x3d7bc7[_0x4ccd('0x42')];var _0x1c1895=path[_0x4ccd('0x16')](config[_0x4ccd('0x43')],_0x4ccd('0x44'),_0x191820+'.csv');var _0x1558cc=_[_0x4ccd('0x30')](_0x3381f2)['join']();logger[_0x4ccd('0x36')](_0x4ccd('0x45'),_0x1558cc);fs[_0x4ccd('0x46')](_0x1c1895,_0x1558cc+'\x0a');Papa['parse'](fs['createReadStream'](_0x2ae817),{'header':!![],'skipEmptyLines':!![],'step':function(_0x368deb,_0x33300b){try{for(var _0x1a07b5=0x0,_0xb0720a=[];_0x1a07b5<_0x368deb[_0x4ccd('0x47')]['length'];_0x1a07b5++){stats[_0x4ccd('0x48')]+=0x1;if(_0x368deb[_0x4ccd('0x3b')][_0x1a07b5]){handleError(_0x368deb[_0x4ccd('0x47')][_0x1a07b5],_0x368deb['errors'][_0x1a07b5]);}else{var _0x270606=[];for(var _0x1b06c1 in _0x3381f2){if(_0x3381f2[_0x4ccd('0x49')](_0x1b06c1)){if(_0x368deb['data'][_0x1a07b5][_0x3381f2[_0x1b06c1]]){var _0x266d26=_[_0x4ccd('0x4a')](_0x368deb[_0x4ccd('0x47')][_0x1a07b5][_0x3381f2[_0x1b06c1]][_0x4ccd('0x4b')](/"/g,'\x27'));switch(_0x1b06c1){case _0x4ccd('0x1f'):var _0x11d4a1=moment(_0x266d26,_0x4ccd('0x4c'),!![]);if(_0x11d4a1[_0x4ccd('0x4d')]()){_0xb0720a[_0x4ccd('0x3c')]('\x22'+_0x266d26+'\x22');}else{_0x270606['push'](_0x4ccd('0x4e'));}break;case _0x4ccd('0x4f'):var _0xe35b1d=parseInt(_0x266d26);_0x266d26=_[_0x4ccd('0x50')](_0xe35b1d)||_0xe35b1d<0x0||_0xe35b1d>0x4?_0x4eb013?0x3:0x2:_0xe35b1d;_0xb0720a[_0x4ccd('0x3c')]('\x22'+_0x266d26+'\x22');break;case _0x4ccd('0x51'):var _0x2706fb=parseInt(_0x266d26);if(_[_0x4ccd('0x52')](_0x2706fb)&&_[_0x4ccd('0x53')](_0x4aa1e8,_0x2706fb)){_0xb0720a['push']('\x22'+_0x2706fb+'\x22');}else{_0x270606[_0x4ccd('0x3c')](_0x4ccd('0x54'));}break;case _0x4ccd('0x55'):if(isEmail(_0x266d26)){_0xb0720a['push']('\x22'+_0x266d26+'\x22');}else{_0x270606['push'](_0x4ccd('0x56'));}break;case'dateOfBirth':var _0x52a209=moment(_0x266d26,_0x4ccd('0x57'),!![]);if(_0x52a209[_0x4ccd('0x4d')]()){_0xb0720a[_0x4ccd('0x3c')]('\x22'+_0x266d26+'\x22');}else{_0x270606[_0x4ccd('0x3c')](_0x4ccd('0x58'));}break;default:_0xb0720a[_0x4ccd('0x3c')]('\x22'+_0x266d26+'\x22');}}else{switch(_0x1b06c1){case _0x4ccd('0x59'):case _0x4ccd('0x12'):_0x270606['push'](_0x1b06c1+_0x4ccd('0x5a'));break;default:_0xb0720a[_0x4ccd('0x3c')]('\x22\x22');}}}}if(_0x270606[_0x4ccd('0x5b')]){handleError(_0x368deb[_0x4ccd('0x47')][_0x1a07b5],{'code':_0x4ccd('0x5c'),'message':_0x270606[_0x4ccd('0x16')]()});}else{fs[_0x4ccd('0x5d')](_0x1c1895,_0xb0720a['join']()+'\x0a');}_0xb0720a=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x4ccd('0x5e')+_0x191820,stats);stats[_0x4ccd('0x3b')]=[];}}if(stopped){logger[_0x4ccd('0x36')]('Abort\x20parser');_0x33300b[_0x4ccd('0x5f')]();}}catch(_0x35bb99){handleError(_0x368deb[_0x4ccd('0x47')][_0x1a07b5],{'code':_0x4ccd('0x60'),'message':_0x35bb99[_0x4ccd('0x39')]});logger['error'](_0x4ccd('0x61'),_0x35bb99['message']);}},'complete':function(){try{var _0x3a39fb=[];var _0x208134='cm_contacts';if(_0x3d7bc7[_0x4ccd('0x62')]&&_0x3d7bc7[_0x4ccd('0x62')][_0x4ccd('0x5b')]){_0x208134='cm_contacts_'+_0x191820;_0x3a39fb[_0x4ccd('0x3c')](_0x4ccd('0x63')+_0x208134+_0x4ccd('0x64'));}var _0x50d88b=util[_0x4ccd('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',_0x1c1895,_0x208134,_0x1558cc,_0x3d7bc7[_0x4ccd('0x21')],_0x3d7bc7[_0x4ccd('0x31')]||null,NOW,NOW);if(_[_0x4ccd('0x65')](_0x3381f2[_0x4ccd('0x1f')])){_0x50d88b+=_0x4ccd('0x66');}_0x3a39fb[_0x4ccd('0x3c')](_0x50d88b);if(_0x3d7bc7['duplicates']&&_0x3d7bc7[_0x4ccd('0x62')][_0x4ccd('0x5b')]){_0x3a39fb[_0x4ccd('0x3c')](insertCmContact(_0x3d7bc7[_0x4ccd('0x21')],_0x208134,_0x3d7bc7[_0x4ccd('0x62')],_0x3381f2));_0x3a39fb[_0x4ccd('0x3c')](_0x4ccd('0x67')+_0x208134+';');}_0x3a39fb['push'](insertCmHopper(_0x3d7bc7[_0x4ccd('0x21')],_0x4ccd('0x68'),_0x4ccd('0x69'),'VoiceQueueId',_0x4eb013));_0x3a39fb[_0x4ccd('0x3c')](insertCmHopperBlack(_0x3d7bc7[_0x4ccd('0x21')],_0x4ccd('0x6a'),_0x4ccd('0x69'),_0x4ccd('0x6b')));_0x3a39fb[_0x4ccd('0x3c')](insertCmHopper(_0x3d7bc7[_0x4ccd('0x21')],'campaigns_has_cm_lists','campaigns',_0x4ccd('0x6c'),_0x4eb013));_0x3a39fb[_0x4ccd('0x3c')](insertCmHopperBlack(_0x3d7bc7['ListId'],_0x4ccd('0x6d'),'campaigns',_0x4ccd('0x6c')));BPromise['each'](_0x3a39fb,handleQuery)['then'](function(_0x257b19){stats[_0x4ccd('0x6e')]=!![];stats[_0x4ccd('0x6f')]=_0x3d7bc7[_0x4ccd('0x62')]&&_0x3d7bc7['duplicates'][_0x4ccd('0x5b')]?results[0x2][_0x4ccd('0x6f')]:results[0x0][_0x4ccd('0x6f')];socket['emit'](_0x4ccd('0x5e')+_0x191820,stats);fs[_0x4ccd('0x70')](_0x2ae817);fs['unlink'](_0x1c1895);process[_0x4ccd('0x3a')](0x0);})[_0x4ccd('0x3e')](function(_0x258487){logger[_0x4ccd('0x38')](_0x258487[_0x4ccd('0x39')]);process[_0x4ccd('0x3a')](0x1);});}catch(_0x3390a1){logger[_0x4ccd('0x38')](_0x4ccd('0x71'),_0x3390a1['message']);process[_0x4ccd('0x3a')](0x1);}},'error':function(_0x927bcb,_0x37b7ff,_0x1ef1cb,_0x12b07c){throw new Error(_0x12b07c);}});}function validate(){if(process[_0x4ccd('0x72')]&&process[_0x4ccd('0x72')]['length']<0x4){throw new Error('arguments\x20\x20\x20');}var _0x12ea49=path['join'](config['root'],_0x4ccd('0x44'),process[_0x4ccd('0x72')][0x2]);if(!fs[_0x4ccd('0x73')](_0x12ea49)){throw new Error(_0x4ccd('0x74'));}var _0xfbc250={};try{_0xfbc250=JSON[_0x4ccd('0x75')](process[_0x4ccd('0x72')][0x3]);if(!_0xfbc250['binding']){throw new Error(_0x4ccd('0x76'));}if(!_0xfbc250[_0x4ccd('0x77')][_0x4ccd('0x12')]){throw new Error(_0x4ccd('0x78'));}if(!_0xfbc250[_0x4ccd('0x77')]['firstName']){throw new Error('firstName\x20is\x20mandatory');}var _0x366b76=0x0;if(_0xfbc250[_0x4ccd('0x77')][_0x4ccd('0x51')]){_0x366b76=0x1;}if(!_0xfbc250[_0x4ccd('0x21')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x4ea535){throw new Error(_0x4ccd('0x79'));}var _0x1f41f2=[];try{_0x1f41f2=_[_0x4ccd('0x7a')](JSON[_0x4ccd('0x75')](process[_0x4ccd('0x72')][0x4]),'id');}catch(_0x2c1a77){logger['info']('No\x20agent\x20available');}main(_0x12ea49,_0xfbc250,_0x1f41f2,_0x366b76);}validate();process['on'](_0x4ccd('0x7b'),handleStop);process['on'](_0x4ccd('0x7c'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 9396b63..5ec2a67 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 _0x0e2a=['sequelize','query','select\x20*\x20from\x20','spread','isNil','phone','AdditionalPhones','push','all','then','catch','error','message','split','length','filter','findOne','CmContactHasItem','update','updated','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.createdAt','cm_contacts.priority','into','cm_hopper','scheduledat','ListId','createdAt','UserId','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_contacts.id','cm_contacts.ListId','fromQuery','updatedAt','fields','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','toString','cm_contact_has_items.item','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','errors','code','main','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','body','findAll','name','parse','createReadStream','data','rows','find','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','SystemRow','appendFileSync','contact:import:','Abort\x20parser','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','each','contactId','contactTypeId','orderBy','finish','affectedRows','emit','unlink','exit','argv','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','uncaughtException','lodash','util','moment','squel','ioredis','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join'];(function(_0x42a151,_0x3f4007){var _0x324bd1=function(_0x2f72e2){while(--_0x2f72e2){_0x42a151['push'](_0x42a151['shift']());}};_0x324bd1(++_0x3f4007);}(_0x0e2a,0x7f));var _0xa0e2=function(_0x58ee19,_0xdf0765){_0x58ee19=_0x58ee19-0x0;var _0x49af25=_0x0e2a[_0x58ee19];return _0x49af25;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xa0e2('0x0'));var Papa=require('papaparse');var util=require(_0xa0e2('0x1'));var BPromise=require('bluebird');var moment=require(_0xa0e2('0x2'));var squel=require(_0xa0e2('0x3'));var Redis=require(_0xa0e2('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xa0e2('0x5'));var logger=require('../../../config/logger')(_0xa0e2('0x6'));config[_0xa0e2('0x7')]=_[_0xa0e2('0x8')](config[_0xa0e2('0x7')],{'host':_0xa0e2('0x9'),'port':0x18eb});var socket=require(_0xa0e2('0xa'))(new Redis(config['redis']));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()[_0xa0e2('0xb')](_0xa0e2('0xc'));var tempTableName=_0xa0e2('0xd')+moment()[_0xa0e2('0xb')](_0xa0e2('0xe'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x1fa20a){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))*$/[_0xa0e2('0xf')](_0x1fa20a);}function selectNotIn(_0x69d9b8,_0x4706ee,_0x59668c,_0xe3d7e1,_0x37d947){return squel[_0xa0e2('0x10')]()[_0xa0e2('0x11')]('phone')[_0xa0e2('0x12')](_0xe3d7e1)['join'](_0x4706ee,null,_0x4706ee+_0xa0e2('0x13')+_0xe3d7e1+'.'+_0x59668c)[_0xa0e2('0x14')](_0xe3d7e1+'.'+_0x59668c+_0xa0e2('0x15')+_0x69d9b8+'.'+_0x59668c)[_0xa0e2('0x14')](_0x4706ee+_0xa0e2('0x16')+_0x37d947[_0xa0e2('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2e06e2,_0x46e70e){promisesAdditionalPhones=[];promisesContact=[];return db[_0xa0e2('0x18')][_0xa0e2('0x19')](_0xa0e2('0x1a')+tempTableName)[_0xa0e2('0x1b')](function(_0x567c7c){if(_0x567c7c!==null){var _0x19c3d8=[];for(var _0x53f17a=0x0;_0x53f17a<_0x567c7c['length'];_0x53f17a++){var _0x38abb4=_0x567c7c[_0x53f17a];if(!_[_0xa0e2('0x1c')](_0x38abb4[_0xa0e2('0x1d')])){if(!_[_0xa0e2('0x1c')](_0x38abb4[_0xa0e2('0x1e')]))_0x19c3d8['push'](insertAdditionalPhones(_0x38abb4));promisesContact[_0xa0e2('0x1f')]({'contact':_0x38abb4});}}}Promise[_0xa0e2('0x20')](_0x19c3d8)[_0xa0e2('0x21')](function(){_0x2e06e2({'val':0x1});});})[_0xa0e2('0x22')](function(_0x3a56fd){logger[_0xa0e2('0x23')](_0x3a56fd[_0xa0e2('0x24')]);});});}function insertAdditionalPhones(_0x12bb5f){return new Promise(function(_0x1ff3e8,_0x8b2d11){var _0x59f64d=_0x12bb5f[_0xa0e2('0x1e')];if(_[_0xa0e2('0x1c')](_0x59f64d))_0x8b2d11({'val':0x0});else{var _0x2ad1d9=_0x59f64d[_0xa0e2('0x25')](';');var _0x4f9981=[];orderBy=0x0;for(var _0x367e85=0x0;_0x367e85<_0x2ad1d9['length'];_0x367e85++){_0x4f9981['push'](splitAdditionalPhone(_0x12bb5f['id'],_0x2ad1d9[_0x367e85]));}Promise['all'](_0x4f9981)[_0xa0e2('0x21')](function(){_0x1ff3e8({'val':_0x2ad1d9[_0xa0e2('0x26')]});});}});}function splitAdditionalPhone(_0x3a301c,_0x311215){return new Promise(function(_0x464e4c,_0x2a0d29){var _0x3ddaf2=_0x311215[_0xa0e2('0x25')](':');var _0x1815e3=_0x3ddaf2[0x0];var _0x292240=_0x3ddaf2[0x1];if(_0x292240!==''){var _0x4801a2=_0x292240[_0xa0e2('0x25')]('|');var _0x306614=[];for(var _0x955c1a=0x0;_0x955c1a<_0x4801a2[_0xa0e2('0x26')];_0x955c1a++){if(_0x4801a2[_0x955c1a]!==''){var _0x5daadc=_[_0xa0e2('0x27')](promisesAdditionalPhones,{'contactId':_0x3a301c,'phone':_0x4801a2[_0x955c1a]});if(_0x5daadc[_0xa0e2('0x26')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3a301c,'contactTypeId':_0x1815e3,'phone':_0x4801a2[_0x955c1a],'orderBy':orderBy});}}}_0x464e4c({'ok':0x1});}else _0x464e4c({'res':0x0});});}function createAdditionalPhone(_0x4c59ef,_0x582ac8,_0x1996b1,_0x37cbbb){return new Promise(function(_0x37c09d,_0x513168){return db['CmContactHasItem'][_0xa0e2('0x28')]({'where':{'CmContactId':_0x4c59ef,'item':_0x1996b1}})[_0xa0e2('0x21')](function(_0xe0f954){if(_0xe0f954){return db[_0xa0e2('0x29')][_0xa0e2('0x2a')]({'ItemTypeId':_0x582ac8,'OrderBy':_0x37cbbb},{'where':{'CmContactId':_0x4c59ef,'item':_0x1996b1}})[_0xa0e2('0x21')](function(_0x5c06e2){_0x37c09d({'res':_0xa0e2('0x2b')});});}else{return db[_0xa0e2('0x29')][_0xa0e2('0x2c')]({'CmContactId':_0x4c59ef,'item':_0x1996b1,'ItemTypeId':_0x582ac8,'OrderBy':_0x37cbbb,'ItemClass':'PHONE'})[_0xa0e2('0x21')](function(_0x10f61b){_0x37c09d({'res':_0xa0e2('0x2d')});});}});});}function updateContact(_0x1c5831){return new Promise(function(_0x40b1fd,_0xe34d80){var _0x78ab0e=_0x1c5831['id'];delete _0x1c5831['id'];return db[_0xa0e2('0x2e')][_0xa0e2('0x2a')](_0x1c5831,{'where':{'id':_0x78ab0e}})['then'](function(_0x169364){updatedRows+=0x1;return db[_0xa0e2('0x2f')]['update']({'phone':_0x1c5831[_0xa0e2('0x1d')]},{'where':{'ContactId':_0x78ab0e}})[_0xa0e2('0x21')](function(_0x3752df){_0x40b1fd({'ret':'OK'});});});});}function insertCmHopper(_0x32700a,_0xc1ccbf,_0x55e237,_0x27d0ea,_0x113297){var _0x2afa6e=[_0xa0e2('0x30'),'cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId',_0xc1ccbf+'.'+_0x27d0ea,_0xa0e2('0x31'),'cm_contacts.updatedAt',_0xa0e2('0x32'),'cm_contacts.UserId','\x22'+_0x113297+'\x22'];return squel['insert']()[_0xa0e2('0x33')](_0xa0e2('0x34'))['fromQuery']([_0xa0e2('0x1d'),_0xa0e2('0x35'),'ContactId',_0xa0e2('0x36'),_0x27d0ea,_0xa0e2('0x37'),'updatedAt','priority',_0xa0e2('0x38'),'recallme'],squel[_0xa0e2('0x10')]()['fields'](_0x2afa6e)['from'](_0xc1ccbf)[_0xa0e2('0x17')](_0xa0e2('0x39'),null,_0xa0e2('0x3a')+_0xc1ccbf+_0xa0e2('0x3b'))[_0xa0e2('0x17')](_0x55e237,null,_0x55e237+_0xa0e2('0x13')+_0xc1ccbf+'.'+_0x27d0ea)[_0xa0e2('0x14')](_0xc1ccbf+_0xa0e2('0x3c'),_0x32700a)['where'](_0xa0e2('0x3d'),NOW)[_0xa0e2('0x14')](_0xa0e2('0x3e'),selectNotIn(_0xc1ccbf,_0x55e237,_0x27d0ea,_0xa0e2('0x34'),[_0xa0e2('0x3f'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xc1ccbf,_0x55e237,_0x27d0ea,_0xa0e2('0x34'),[_0xa0e2('0x3f')])))['toString']();}function insertCmHopperBlack(_0x2c69d1,_0x164cf9,_0x4dbe91,_0x31a6c3){var _0x284a44=[_0xa0e2('0x30'),_0xa0e2('0x40'),_0xa0e2('0x41'),_0x164cf9+'.'+_0x31a6c3,_0xa0e2('0x31'),'cm_contacts.updatedAt'];return squel['insert']()['into']('cm_hopper_black')[_0xa0e2('0x42')]([_0xa0e2('0x1d'),'ContactId',_0xa0e2('0x36'),_0x31a6c3,_0xa0e2('0x37'),_0xa0e2('0x43')],squel[_0xa0e2('0x10')]()[_0xa0e2('0x44')](_0x284a44)[_0xa0e2('0x12')](_0x164cf9)[_0xa0e2('0x17')](_0xa0e2('0x39'),null,_0xa0e2('0x3a')+_0x164cf9+_0xa0e2('0x3b'))[_0xa0e2('0x17')](_0x4dbe91,null,_0x4dbe91+_0xa0e2('0x13')+_0x164cf9+'.'+_0x31a6c3)[_0xa0e2('0x14')](_0x164cf9+_0xa0e2('0x3c'),_0x2c69d1)[_0xa0e2('0x14')](_0xa0e2('0x3d'),NOW)[_0xa0e2('0x14')](_0xa0e2('0x3e'),squel[_0xa0e2('0x10')]()['field'](_0xa0e2('0x1d'))['from'](_0xa0e2('0x45'))[_0xa0e2('0x14')](_0xa0e2('0x46'),_0x2c69d1)[_0xa0e2('0x14')](_0x31a6c3+_0xa0e2('0x47'),_0x164cf9+'.'+_0x31a6c3)))[_0xa0e2('0x48')]();}function insertCmHopperAdditionalPhones(_0x5ee8b1){var _0x37efda=['cm_hopper.id',_0xa0e2('0x49'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xa0e2('0x4a')]()[_0xa0e2('0x33')](_0xa0e2('0x4b'))['fromQuery']([_0xa0e2('0x4c'),_0xa0e2('0x1d'),_0xa0e2('0x4d'),'createdAt','updatedAt'],squel[_0xa0e2('0x10')]()['fields'](_0x37efda)[_0xa0e2('0x12')]('cm_hopper')[_0xa0e2('0x17')](_0xa0e2('0x39'),null,_0xa0e2('0x4e'))['join']('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where']('cm_hopper.ListId\x20=\x20?',_0x5ee8b1)[_0xa0e2('0x14')](_0xa0e2('0x3d'),NOW))[_0xa0e2('0x48')]();}function insertCmContact(_0x7f1c7d,_0x1daf9e,_0x561664,_0x54fe72){var _0xd59471=_[_0xa0e2('0x4f')](_[_0xa0e2('0x50')](_0x54fe72),['ListId',_0xa0e2('0x51'),_0xa0e2('0x37'),_0xa0e2('0x43')]);return squel[_0xa0e2('0x4a')]()[_0xa0e2('0x33')](_0xa0e2('0x39'))[_0xa0e2('0x42')](_0xd59471,squel[_0xa0e2('0x10')]()['fields'](_0xd59471)[_0xa0e2('0x12')](_0x1daf9e)[_0xa0e2('0x14')]('('+_0x561664['join'](',')+_0xa0e2('0x52'),squel['select']()[_0xa0e2('0x44')](_0x561664)[_0xa0e2('0x12')](_0xa0e2('0x39'))[_0xa0e2('0x14')](_0xa0e2('0x46'),_0x7f1c7d))[_0xa0e2('0x14')](_0xa0e2('0x53'),squel[_0xa0e2('0x10')]()['field'](_0xa0e2('0x54'),_0xa0e2('0x55'))[_0xa0e2('0x12')](_0x1daf9e)[_0xa0e2('0x56')](_0x561664[_0xa0e2('0x17')](','))))[_0xa0e2('0x48')]();}function handleStop(){logger[_0xa0e2('0x57')](_0xa0e2('0x58'));stopped=!![];}function handleUncaughtException(_0x4ba045){logger[_0xa0e2('0x23')](_0x4ba045[_0xa0e2('0x24')]);process['exit'](0x1);}function handleError(_0x15b5d5,_0x5cf1d8){stats[_0xa0e2('0x59')]['push']({'name':_0x5cf1d8[_0xa0e2('0x5a')],'message':_0x5cf1d8[_0xa0e2('0x24')],'row':_0x15b5d5});}function handleQuery(_0x102125){logger['info'](_0x102125);return db[_0xa0e2('0x18')]['query'](_0x102125)[_0xa0e2('0x1b')](function(_0x58f5e5){results[_0xa0e2('0x1f')](_0x58f5e5);})['catch'](function(_0x1b54df){logger[_0xa0e2('0x23')](_0x1b54df[_0xa0e2('0x24')]);});}function main(_0x1240ad,_0x141b18,_0x4eb6d8,_0x9466cd){logger[_0xa0e2('0x57')](_0xa0e2('0x5b'),_0x1240ad,JSON[_0xa0e2('0x5c')](_0x141b18));process[_0xa0e2('0x5d')](_0xa0e2('0x5e'));var _0x3ab717=_0x141b18[_0xa0e2('0x5f')];var _0x421b2c=_[_0xa0e2('0x60')](_0x3ab717);var _0x3af302=_0x141b18[_0xa0e2('0x61')];var _0xca1bce=path[_0xa0e2('0x17')](config['root'],_0xa0e2('0x62'),_0x3af302+_0xa0e2('0x63'));logger[_0xa0e2('0x57')](_0xa0e2('0x64'),_0x141b18);db['ContactItemType'][_0xa0e2('0x65')]({'raw':!![],'attributes':['id',_0xa0e2('0x66')]})['then'](function(_0x352936){for(var _0x2d0a30=0x0;_0x2d0a30<_0x352936[_0xa0e2('0x26')];_0x2d0a30++){if(_0x352936[_0x2d0a30][_0xa0e2('0x66')]in _0x3ab717){contactItemTypes['push'](_0x352936[_0x2d0a30]);delete _0x421b2c[_0x352936[_0x2d0a30][_0xa0e2('0x66')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x421b2c[_0xa0e2('0x1e')]='';var _0xa76fb9=_[_0xa0e2('0x50')](_0x421b2c)[_0xa0e2('0x17')]();logger['info']('header',_0xa76fb9);fs['writeFileSync'](_0xca1bce,_0xa76fb9+'\x0a');Papa[_0xa0e2('0x67')](fs[_0xa0e2('0x68')](_0x1240ad),{'header':!![],'skipEmptyLines':!![],'step':function(_0x590f17,_0x646a07){try{for(var _0x493ddb=0x0,_0x5463b4=[];_0x493ddb<_0x590f17[_0xa0e2('0x69')][_0xa0e2('0x26')];_0x493ddb++){stats[_0xa0e2('0x6a')]+=0x1;if(_0x590f17[_0xa0e2('0x59')][_0x493ddb]){handleError(_0x590f17[_0xa0e2('0x69')][_0x493ddb],_0x590f17[_0xa0e2('0x59')][_0x493ddb]);}else{var _0x10f84a=[];var _0x5450f5=[];for(var _0x16e454 in _0x3ab717){let _0x1c8b17=contactItemTypes[_0xa0e2('0x6b')](_0x201370=>_0x201370[_0xa0e2('0x66')]===_0x16e454);if(_[_0xa0e2('0x1c')](_0x1c8b17)){if(_0x3ab717[_0xa0e2('0x6c')](_0x16e454)){if(_0x590f17['data'][_0x493ddb][_0x3ab717[_0x16e454]]){var _0x2cd31d=_[_0xa0e2('0x6d')](_0x590f17[_0xa0e2('0x69')][_0x493ddb][_0x3ab717[_0x16e454]]['replace'](/"/g,'\x27'));switch(_0x16e454){case _0xa0e2('0x35'):var _0x29df54=moment(_0x2cd31d,_0xa0e2('0xc'),!![]);if(_0x29df54[_0xa0e2('0x6e')]()){_0x5463b4[_0xa0e2('0x1f')]('\x22'+_0x2cd31d+'\x22');}else{_0x10f84a['push'](_0xa0e2('0x6f'));}break;case _0xa0e2('0x70'):var _0x23fe76=parseInt(_0x2cd31d);_0x2cd31d=_[_0xa0e2('0x71')](_0x23fe76)||_0x23fe76<0x0||_0x23fe76>0x4?_0x9466cd?0x3:0x2:_0x23fe76;_0x5463b4[_0xa0e2('0x1f')]('\x22'+_0x2cd31d+'\x22');break;case _0xa0e2('0x38'):var _0x2d4051=parseInt(_0x2cd31d);if(_[_0xa0e2('0x72')](_0x2d4051)&&_[_0xa0e2('0x73')](_0x4eb6d8,_0x2d4051)){_0x5463b4[_0xa0e2('0x1f')]('\x22'+_0x2d4051+'\x22');}else{_0x10f84a[_0xa0e2('0x1f')]('agent\x20not\x20exists');}break;case _0xa0e2('0x74'):if(isEmail(_0x2cd31d)){_0x5463b4[_0xa0e2('0x1f')]('\x22'+_0x2cd31d+'\x22');}else{_0x10f84a[_0xa0e2('0x1f')](_0xa0e2('0x75'));}break;case'dateOfBirth':var _0x56b0a6=moment(_0x2cd31d,_0xa0e2('0x76'),!![]);if(_0x56b0a6['isValid']()){_0x5463b4[_0xa0e2('0x1f')]('\x22'+_0x2cd31d+'\x22');}else{_0x10f84a[_0xa0e2('0x1f')](_0xa0e2('0x77'));}break;default:_0x5463b4[_0xa0e2('0x1f')]('\x22'+_0x2cd31d+'\x22');}}else{switch(_0x16e454){case _0xa0e2('0x78'):case _0xa0e2('0x1d'):_0x10f84a[_0xa0e2('0x1f')](_0x16e454+_0xa0e2('0x79'));break;default:_0x5463b4['push']('\x22\x22');}}}}else{var _0x35ce69='';for(var _0xb5c299=0x0;_0xb5c299<_0x3ab717[_0x16e454][_0xa0e2('0x26')];_0xb5c299++){var _0x2cd31d=_['trim'](_0x590f17[_0xa0e2('0x69')][_0x493ddb][_0x3ab717[_0x16e454][_0xb5c299]][_0xa0e2('0x7a')](/"/g,'\x27'));if(_0x35ce69=='')_0x35ce69=_0x2cd31d;else _0x35ce69+='|'+_0x2cd31d;}_0x5450f5[_0xa0e2('0x1f')](_0x1c8b17['id']+':'+_0x35ce69);}}if(hasAdditionalPhones){_0x5463b4[_0xa0e2('0x1f')]('\x22'+_0x5450f5[_0xa0e2('0x17')](';')+'\x22');}if(_0x10f84a[_0xa0e2('0x26')]){handleError(_0x590f17['data'][_0x493ddb],{'code':_0xa0e2('0x7b'),'message':_0x10f84a[_0xa0e2('0x17')]()});}else{fs[_0xa0e2('0x7c')](_0xca1bce,_0x5463b4[_0xa0e2('0x17')]()+'\x0a');}_0x5463b4=[];}if(!(stats[_0xa0e2('0x6a')]%0xc8)){socket['emit'](_0xa0e2('0x7d')+_0x3af302,stats);stats['errors']=[];}}if(stopped){logger[_0xa0e2('0x57')](_0xa0e2('0x7e'));_0x646a07['abort']();}}catch(_0x4ad75f){handleError(_0x590f17[_0xa0e2('0x69')][_0x493ddb],{'code':_0xa0e2('0x7f'),'message':_0x4ad75f[_0xa0e2('0x24')]});logger[_0xa0e2('0x23')](_0xa0e2('0x80'),_0x4ad75f[_0xa0e2('0x24')]);}},'complete':function(){try{var _0x57bdc1=[];var _0x4a58fa=tempTableName;_0x57bdc1['push'](_0xa0e2('0x81')+_0x4a58fa+_0xa0e2('0x82'));logger[_0xa0e2('0x57')](_0xa0e2('0x83'),contactItemTypes[_0xa0e2('0x26')]);var _0x1eb047=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0xca1bce,_0x4a58fa,_0xa76fb9,_0x141b18[_0xa0e2('0x36')],_0x141b18[_0xa0e2('0x51')]||null,NOW,NOW);if(_[_0xa0e2('0x1c')](_0x3ab717[_0xa0e2('0x35')])){_0x1eb047+=_0xa0e2('0x84');}_0x57bdc1[_0xa0e2('0x1f')](_0x1eb047);BPromise[_0xa0e2('0x85')](_0x57bdc1,handleQuery)[_0xa0e2('0x21')](function(_0x3389d6){BPromise[_0xa0e2('0x20')]([handleAdditionalPhones()])[_0xa0e2('0x21')](function(){_0x57bdc1=[];for(var _0x56d5e8=0x0;_0x56d5e8\x20\x20');}var _0x10fc22=path[_0xa0e2('0x17')](config[_0xa0e2('0x8f')],_0xa0e2('0x62'),process[_0xa0e2('0x8e')][0x2]);if(!fs[_0xa0e2('0x90')](_0x10fc22)){throw new Error(_0xa0e2('0x91'));}var _0x32bb99={};try{_0x32bb99=JSON[_0xa0e2('0x67')](process['argv'][0x3]);if(!_0x32bb99['binding']){throw new Error(_0xa0e2('0x92'));}var _0x9ee784=0x0;if(_0x32bb99[_0xa0e2('0x5f')][_0xa0e2('0x38')]){_0x9ee784=0x1;}if(!_0x32bb99[_0xa0e2('0x36')]){throw new Error(_0xa0e2('0x93'));}}catch(_0x10b5d9){throw new Error(_0xa0e2('0x94'));}var _0x30e2b4=[];try{_0x30e2b4=_[_0xa0e2('0x95')](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x244b46){logger[_0xa0e2('0x57')]('No\x20agent\x20available');}main(_0x10fc22,_0x32bb99,_0x30e2b4,_0x9ee784);}validate();process['on']('SIGINT',handleStop);process['on'](_0xa0e2('0x96'),handleUncaughtException); \ No newline at end of file +var _0xc015=['push','all','then','catch','message','AdditionalPhones','length','split','filter','CmContactHasItem','updated','create','PHONE','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.updatedAt','cm_hopper_black','select','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','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','CompanyId','ListId\x20=\x20?','MIN(id)','group','info','error','code','start','binding','socket_timestamp','root','.csv','ContactItemType','findAll','name','keys','header','writeFileSync','parse','createReadStream','rows','errors','data','find','hasOwnProperty','trim','scheduledat','isValid','UserId','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','finish','unlink','exit','complete','argv','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','../../../mysqldb','../../../config/environment','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','isNil'];(function(_0x194741,_0x475089){var _0x5ede07=function(_0x499ff9){while(--_0x499ff9){_0x194741['push'](_0x194741['shift']());}};_0x5ede07(++_0x475089);}(_0xc015,0x78));var _0x5c01=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xc015[_0x2dea24];return _0x309d58;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x5c01('0x0'));var Papa=require(_0x5c01('0x1'));var util=require(_0x5c01('0x2'));var BPromise=require(_0x5c01('0x3'));var moment=require(_0x5c01('0x4'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0x5c01('0x5'))['db'];var config=require(_0x5c01('0x6'));var logger=require('../../../config/logger')(_0x5c01('0x7'));config['redis']=_['defaults'](config[_0x5c01('0x8')],{'host':_0x5c01('0x9'),'port':0x18eb});var socket=require(_0x5c01('0xa'))(new Redis(config[_0x5c01('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()[_0x5c01('0xb')](_0x5c01('0xc'));var tempTableName=_0x5c01('0xd')+moment()['format'](_0x5c01('0xe'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x5f8dd0){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))*$/[_0x5c01('0xf')](_0x5f8dd0);}function selectNotIn(_0x4a0a2c,_0x177bbb,_0x220184,_0x1b13ea,_0x117ff6){return squel['select']()[_0x5c01('0x10')](_0x5c01('0x11'))[_0x5c01('0x12')](_0x1b13ea)[_0x5c01('0x13')](_0x177bbb,null,_0x177bbb+_0x5c01('0x14')+_0x1b13ea+'.'+_0x220184)[_0x5c01('0x15')](_0x1b13ea+'.'+_0x220184+_0x5c01('0x16')+_0x4a0a2c+'.'+_0x220184)[_0x5c01('0x15')](_0x177bbb+_0x5c01('0x17')+_0x117ff6[_0x5c01('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3ddbe9,_0x1093f1){promisesAdditionalPhones=[];promisesContact=[];return db[_0x5c01('0x18')][_0x5c01('0x19')](_0x5c01('0x1a')+tempTableName)[_0x5c01('0x1b')](function(_0x296495){if(_0x296495!==null){var _0x2fea6b=[];for(var _0x5547b3=0x0;_0x5547b3<_0x296495['length'];_0x5547b3++){var _0x481aa9=_0x296495[_0x5547b3];if(!_[_0x5c01('0x1c')](_0x481aa9[_0x5c01('0x11')])){if(!_[_0x5c01('0x1c')](_0x481aa9['AdditionalPhones']))_0x2fea6b['push'](insertAdditionalPhones(_0x481aa9));promisesContact[_0x5c01('0x1d')]({'contact':_0x481aa9});}}}Promise[_0x5c01('0x1e')](_0x2fea6b)[_0x5c01('0x1f')](function(){_0x3ddbe9({'val':0x1});});})[_0x5c01('0x20')](function(_0x59d1e3){logger['error'](_0x59d1e3[_0x5c01('0x21')]);});});}function insertAdditionalPhones(_0x3278d7){return new Promise(function(_0x3cfbef,_0x34b948){var _0x464568=_0x3278d7[_0x5c01('0x22')];if(_['isNil'](_0x464568))_0x34b948({'val':0x0});else{var _0x5dd11f=_0x464568['split'](';');var _0x370b40=[];orderBy=0x0;for(var _0xccd976=0x0;_0xccd976<_0x5dd11f[_0x5c01('0x23')];_0xccd976++){_0x370b40[_0x5c01('0x1d')](splitAdditionalPhone(_0x3278d7['id'],_0x5dd11f[_0xccd976]));}Promise[_0x5c01('0x1e')](_0x370b40)[_0x5c01('0x1f')](function(){_0x3cfbef({'val':_0x5dd11f[_0x5c01('0x23')]});});}});}function splitAdditionalPhone(_0x54f9b5,_0x4375cb){return new Promise(function(_0x2edf71,_0x176d3a){var _0x261949=_0x4375cb['split'](':');var _0x160bbb=_0x261949[0x0];var _0x1ead07=_0x261949[0x1];if(_0x1ead07!==''){var _0x1d5782=_0x1ead07[_0x5c01('0x24')]('|');var _0x16854b=[];for(var _0x9215ea=0x0;_0x9215ea<_0x1d5782[_0x5c01('0x23')];_0x9215ea++){if(_0x1d5782[_0x9215ea]!==''){var _0x1b1964=_[_0x5c01('0x25')](promisesAdditionalPhones,{'contactId':_0x54f9b5,'phone':_0x1d5782[_0x9215ea]});if(_0x1b1964[_0x5c01('0x23')]==0x0){orderBy++;promisesAdditionalPhones[_0x5c01('0x1d')]({'contactId':_0x54f9b5,'contactTypeId':_0x160bbb,'phone':_0x1d5782[_0x9215ea],'orderBy':orderBy});}}}_0x2edf71({'ok':0x1});}else _0x2edf71({'res':0x0});});}function createAdditionalPhone(_0x472067,_0x54b380,_0x1838d9,_0xff1148){return new Promise(function(_0x3c70c6,_0xa0c119){return db[_0x5c01('0x26')]['findOne']({'where':{'CmContactId':_0x472067,'item':_0x1838d9}})[_0x5c01('0x1f')](function(_0x336b46){if(_0x336b46){return db[_0x5c01('0x26')]['update']({'ItemTypeId':_0x54b380,'OrderBy':_0xff1148},{'where':{'CmContactId':_0x472067,'item':_0x1838d9}})[_0x5c01('0x1f')](function(_0x3c1063){_0x3c70c6({'res':_0x5c01('0x27')});});}else{return db[_0x5c01('0x26')][_0x5c01('0x28')]({'CmContactId':_0x472067,'item':_0x1838d9,'ItemTypeId':_0x54b380,'OrderBy':_0xff1148,'ItemClass':_0x5c01('0x29')})['then'](function(_0x56f807){_0x3c70c6({'res':'inserted'});});}});});}function updateContact(_0x4b3af0){return new Promise(function(_0x5ef1c7,_0x2359cb){var _0x178e26=_0x4b3af0['id'];delete _0x4b3af0['id'];return db[_0x5c01('0x2a')][_0x5c01('0x2b')](_0x4b3af0,{'where':{'id':_0x178e26}})[_0x5c01('0x1f')](function(_0x21807a){updatedRows+=0x1;return db[_0x5c01('0x2c')][_0x5c01('0x2b')]({'phone':_0x4b3af0[_0x5c01('0x11')]},{'where':{'ContactId':_0x178e26}})[_0x5c01('0x1f')](function(_0x206bbd){_0x5ef1c7({'ret':'OK'});});});});}function insertCmHopper(_0x5cc4b1,_0x50b6c2,_0x3bfce2,_0x543305,_0x11ddf0){var _0x10370f=[_0x5c01('0x2d'),_0x5c01('0x2e'),_0x5c01('0x2f'),_0x5c01('0x30'),_0x50b6c2+'.'+_0x543305,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority',_0x5c01('0x31'),'\x22'+_0x11ddf0+'\x22'];return squel[_0x5c01('0x32')]()[_0x5c01('0x33')](_0x5c01('0x34'))[_0x5c01('0x35')]([_0x5c01('0x11'),'scheduledat',_0x5c01('0x36'),_0x5c01('0x37'),_0x543305,_0x5c01('0x38'),_0x5c01('0x39'),_0x5c01('0x3a'),'UserId',_0x5c01('0x3b')],squel['select']()[_0x5c01('0x3c')](_0x10370f)[_0x5c01('0x12')](_0x50b6c2)['join'](_0x5c01('0x3d'),null,_0x5c01('0x3e')+_0x50b6c2+_0x5c01('0x3f'))['join'](_0x3bfce2,null,_0x3bfce2+_0x5c01('0x14')+_0x50b6c2+'.'+_0x543305)['where'](_0x50b6c2+_0x5c01('0x40'),_0x5cc4b1)['where'](_0x5c01('0x41'),NOW)[_0x5c01('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x50b6c2,_0x3bfce2,_0x543305,_0x5c01('0x34'),[_0x5c01('0x42'),'\x22onlyIfOpen\x22']))[_0x5c01('0x15')](_0x5c01('0x43'),selectNotIn(_0x50b6c2,_0x3bfce2,_0x543305,_0x5c01('0x34'),['\x22always\x22'])))[_0x5c01('0x44')]();}function insertCmHopperBlack(_0x2d9a28,_0x3408e0,_0x204068,_0x63c984){var _0x176c70=['cm_contacts.phone',_0x5c01('0x2f'),_0x5c01('0x30'),_0x3408e0+'.'+_0x63c984,'cm_contacts.createdAt',_0x5c01('0x45')];return squel['insert']()['into'](_0x5c01('0x46'))[_0x5c01('0x35')]([_0x5c01('0x11'),_0x5c01('0x36'),_0x5c01('0x37'),_0x63c984,'createdAt',_0x5c01('0x39')],squel[_0x5c01('0x47')]()['fields'](_0x176c70)[_0x5c01('0x12')](_0x3408e0)[_0x5c01('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x3408e0+_0x5c01('0x3f'))['join'](_0x204068,null,_0x204068+'.id\x20=\x20'+_0x3408e0+'.'+_0x63c984)[_0x5c01('0x15')](_0x3408e0+_0x5c01('0x40'),_0x2d9a28)[_0x5c01('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5c01('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x5c01('0x47')]()['field'](_0x5c01('0x11'))['from']('cm_hopper_black')[_0x5c01('0x15')]('ListId\x20=\x20?',_0x2d9a28)[_0x5c01('0x15')](_0x63c984+_0x5c01('0x48'),_0x3408e0+'.'+_0x63c984)))[_0x5c01('0x44')]();}function insertCmHopperAdditionalPhones(_0x2cffb1){var _0x3af29f=[_0x5c01('0x49'),_0x5c01('0x4a'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x5c01('0x4b')];return squel[_0x5c01('0x32')]()[_0x5c01('0x33')](_0x5c01('0x4c'))['fromQuery']([_0x5c01('0x4d'),_0x5c01('0x11'),_0x5c01('0x4e'),_0x5c01('0x38'),_0x5c01('0x39')],squel[_0x5c01('0x47')]()[_0x5c01('0x3c')](_0x3af29f)[_0x5c01('0x12')]('cm_hopper')[_0x5c01('0x13')](_0x5c01('0x3d'),null,_0x5c01('0x4f'))[_0x5c01('0x13')](_0x5c01('0x50'),null,_0x5c01('0x51'))[_0x5c01('0x15')](_0x5c01('0x52'),_0x2cffb1)[_0x5c01('0x15')](_0x5c01('0x41'),NOW))[_0x5c01('0x44')]();}function insertCmContact(_0x17337e,_0x102b76,_0x690e0e,_0x58aa87){var _0x57496c=_[_0x5c01('0x53')](_['keys'](_0x58aa87),[_0x5c01('0x37'),_0x5c01('0x54'),_0x5c01('0x38'),'updatedAt']);return squel[_0x5c01('0x32')]()[_0x5c01('0x33')](_0x5c01('0x3d'))['fromQuery'](_0x57496c,squel[_0x5c01('0x47')]()[_0x5c01('0x3c')](_0x57496c)[_0x5c01('0x12')](_0x102b76)[_0x5c01('0x15')]('('+_0x690e0e[_0x5c01('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0x5c01('0x47')]()['fields'](_0x690e0e)[_0x5c01('0x12')]('cm_contacts')[_0x5c01('0x15')](_0x5c01('0x55'),_0x17337e))['where']('id\x20IN\x20?',squel[_0x5c01('0x47')]()[_0x5c01('0x10')](_0x5c01('0x56'),'min_id')['from'](_0x102b76)[_0x5c01('0x57')](_0x690e0e[_0x5c01('0x13')](','))))[_0x5c01('0x44')]();}function handleStop(){logger[_0x5c01('0x58')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2d954f){logger[_0x5c01('0x59')](_0x2d954f['message']);process['exit'](0x1);}function handleError(_0x5b5fe8,_0x3ed7fe){stats['errors'][_0x5c01('0x1d')]({'name':_0x3ed7fe[_0x5c01('0x5a')],'message':_0x3ed7fe[_0x5c01('0x21')],'row':_0x5b5fe8});}function handleQuery(_0x524617){logger[_0x5c01('0x58')](_0x524617);return db[_0x5c01('0x18')][_0x5c01('0x19')](_0x524617)[_0x5c01('0x1b')](function(_0x4b5716){results[_0x5c01('0x1d')](_0x4b5716);})[_0x5c01('0x20')](function(_0x1a780e){logger[_0x5c01('0x59')](_0x1a780e['message']);});}function main(_0x2e5021,_0x3c6234,_0x59ff04,_0x1d5f34){logger[_0x5c01('0x58')]('main',_0x2e5021,JSON['stringify'](_0x3c6234));process['send'](_0x5c01('0x5b'));var _0x1afe19=_0x3c6234[_0x5c01('0x5c')];var _0x8384b8=_['clone'](_0x1afe19);var _0x51f257=_0x3c6234[_0x5c01('0x5d')];var _0x5908e5=path[_0x5c01('0x13')](config[_0x5c01('0x5e')],'server/files/tmp',_0x51f257+_0x5c01('0x5f'));logger[_0x5c01('0x58')]('body',_0x3c6234);db[_0x5c01('0x60')][_0x5c01('0x61')]({'raw':!![],'attributes':['id',_0x5c01('0x62')]})[_0x5c01('0x1f')](function(_0x275508){for(var _0x12b9a6=0x0;_0x12b9a6<_0x275508[_0x5c01('0x23')];_0x12b9a6++){if(_0x275508[_0x12b9a6][_0x5c01('0x62')]in _0x1afe19){contactItemTypes[_0x5c01('0x1d')](_0x275508[_0x12b9a6]);delete _0x8384b8[_0x275508[_0x12b9a6][_0x5c01('0x62')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x8384b8['AdditionalPhones']='';var _0x2b0462=_[_0x5c01('0x63')](_0x8384b8)[_0x5c01('0x13')]();logger['info'](_0x5c01('0x64'),_0x2b0462);fs[_0x5c01('0x65')](_0x5908e5,_0x2b0462+'\x0a');Papa[_0x5c01('0x66')](fs[_0x5c01('0x67')](_0x2e5021),{'header':!![],'skipEmptyLines':!![],'step':function(_0x398662,_0xb5ae7d){try{for(var _0x2c8675=0x0,_0x50ffbb=[];_0x2c8675<_0x398662['data'][_0x5c01('0x23')];_0x2c8675++){stats[_0x5c01('0x68')]+=0x1;if(_0x398662[_0x5c01('0x69')][_0x2c8675]){handleError(_0x398662[_0x5c01('0x6a')][_0x2c8675],_0x398662[_0x5c01('0x69')][_0x2c8675]);}else{var _0x32f11b=[];var _0x4274bf=[];for(var _0x232d3b in _0x1afe19){let _0x3d2c76=contactItemTypes[_0x5c01('0x6b')](_0x22eff1=>_0x22eff1[_0x5c01('0x62')]===_0x232d3b);if(_[_0x5c01('0x1c')](_0x3d2c76)){if(_0x1afe19[_0x5c01('0x6c')](_0x232d3b)){if(_0x398662[_0x5c01('0x6a')][_0x2c8675][_0x1afe19[_0x232d3b]]){var _0x419009=_[_0x5c01('0x6d')](_0x398662['data'][_0x2c8675][_0x1afe19[_0x232d3b]]['replace'](/"/g,'\x27'));switch(_0x232d3b){case _0x5c01('0x6e'):var _0x833597=moment(_0x419009,_0x5c01('0xc'),!![]);if(_0x833597[_0x5c01('0x6f')]()){_0x50ffbb['push']('\x22'+_0x419009+'\x22');}else{_0x32f11b[_0x5c01('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x5c01('0x3a'):var _0x2eae20=parseInt(_0x419009);_0x419009=_['isNaN'](_0x2eae20)||_0x2eae20<0x0||_0x2eae20>0x4?_0x1d5f34?0x3:0x2:_0x2eae20;_0x50ffbb[_0x5c01('0x1d')]('\x22'+_0x419009+'\x22');break;case _0x5c01('0x70'):var _0x3c1c36=parseInt(_0x419009);if(_['isNumber'](_0x3c1c36)&&_[_0x5c01('0x71')](_0x59ff04,_0x3c1c36)){_0x50ffbb[_0x5c01('0x1d')]('\x22'+_0x3c1c36+'\x22');}else{_0x32f11b['push'](_0x5c01('0x72'));}break;case _0x5c01('0x73'):if(isEmail(_0x419009)){_0x50ffbb[_0x5c01('0x1d')]('\x22'+_0x419009+'\x22');}else{_0x32f11b['push'](_0x5c01('0x74'));}break;case _0x5c01('0x75'):var _0x468e38=moment(_0x419009,_0x5c01('0x76'),!![]);if(_0x468e38['isValid']()){_0x50ffbb[_0x5c01('0x1d')]('\x22'+_0x419009+'\x22');}else{_0x32f11b[_0x5c01('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x50ffbb['push']('\x22'+_0x419009+'\x22');}}else{switch(_0x232d3b){case _0x5c01('0x77'):case _0x5c01('0x11'):_0x32f11b['push'](_0x232d3b+_0x5c01('0x78'));break;default:_0x50ffbb[_0x5c01('0x1d')]('\x22\x22');}}}}else{var _0x554e82='';for(var _0x535182=0x0;_0x535182<_0x1afe19[_0x232d3b][_0x5c01('0x23')];_0x535182++){var _0x419009=_[_0x5c01('0x6d')](_0x398662[_0x5c01('0x6a')][_0x2c8675][_0x1afe19[_0x232d3b][_0x535182]]['replace'](/"/g,'\x27'));if(_0x554e82=='')_0x554e82=_0x419009;else _0x554e82+='|'+_0x419009;}_0x4274bf['push'](_0x3d2c76['id']+':'+_0x554e82);}}if(hasAdditionalPhones){_0x50ffbb[_0x5c01('0x1d')]('\x22'+_0x4274bf[_0x5c01('0x13')](';')+'\x22');}if(_0x32f11b['length']){handleError(_0x398662[_0x5c01('0x6a')][_0x2c8675],{'code':'SystemRow','message':_0x32f11b[_0x5c01('0x13')]()});}else{fs[_0x5c01('0x79')](_0x5908e5,_0x50ffbb[_0x5c01('0x13')]()+'\x0a');}_0x50ffbb=[];}if(!(stats[_0x5c01('0x68')]%0xc8)){socket[_0x5c01('0x7a')](_0x5c01('0x7b')+_0x51f257,stats);stats[_0x5c01('0x69')]=[];}}if(stopped){logger[_0x5c01('0x58')](_0x5c01('0x7c'));_0xb5ae7d[_0x5c01('0x7d')]();}}catch(_0x250280){handleError(_0x398662[_0x5c01('0x6a')][_0x2c8675],{'code':'SystemError','message':_0x250280[_0x5c01('0x21')]});logger[_0x5c01('0x59')](_0x5c01('0x7e'),_0x250280[_0x5c01('0x21')]);}},'complete':function(){try{var _0x2665bf=[];var _0x27b183=tempTableName;_0x2665bf[_0x5c01('0x1d')](_0x5c01('0x7f')+_0x27b183+_0x5c01('0x80'));logger[_0x5c01('0x58')](_0x5c01('0x81'),contactItemTypes[_0x5c01('0x23')]);var _0x5862ca=util[_0x5c01('0xb')](_0x5c01('0x82'),_0x5908e5,_0x27b183,_0x2b0462,_0x3c6234[_0x5c01('0x37')],_0x3c6234['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x1afe19[_0x5c01('0x6e')])){_0x5862ca+=_0x5c01('0x83');}_0x2665bf['push'](_0x5862ca);BPromise[_0x5c01('0x84')](_0x2665bf,handleQuery)[_0x5c01('0x1f')](function(_0x517233){BPromise[_0x5c01('0x1e')]([handleAdditionalPhones()])[_0x5c01('0x1f')](function(){_0x2665bf=[];for(var _0xf0a05a=0x0;_0xf0a05a\x20\x20');}var _0x2b8ffc=path[_0x5c01('0x13')](config[_0x5c01('0x5e')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x5c01('0x8e')](_0x2b8ffc)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x483560={};try{_0x483560=JSON[_0x5c01('0x66')](process['argv'][0x3]);if(!_0x483560['binding']){throw new Error(_0x5c01('0x8f'));}var _0x2d3449=0x0;if(_0x483560[_0x5c01('0x5c')][_0x5c01('0x70')]){_0x2d3449=0x1;}if(!_0x483560[_0x5c01('0x37')]){throw new Error(_0x5c01('0x90'));}}catch(_0x4601d9){throw new Error('body\x20id\x20mandatory');}var _0x2e4c50=[];try{_0x2e4c50=_[_0x5c01('0x91')](JSON[_0x5c01('0x66')](process[_0x5c01('0x8d')][0x4]),'id');}catch(_0x2ece76){logger[_0x5c01('0x58')](_0x5c01('0x92'));}main(_0x2b8ffc,_0x483560,_0x2e4c50,_0x2d3449);}validate();process['on'](_0x5c01('0x93'),handleStop);process['on'](_0x5c01('0x94'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index a9913bb..3973e71 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 _0x8a5c=['destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','queue','UniqueId','Date','agentcalledAt','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','uniqueid','Answer\x20Time','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','push','variable','calleridnum','outbound','Outbound\x20Call'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x8a5c,0x136));var _0xc8a5=function(_0x1b70ad,_0x3c10ce){_0x1b70ad=_0x1b70ad-0x0;var _0x502a3c=_0x8a5c[_0x1b70ad];return _0x502a3c;};'use strict';exports[_0xc8a5('0x0')]=function(_0x19d1ad,_0x2a8a8d){var _0xb0db76=[{'type':_0xc8a5('0x1'),'content':_0xc8a5('0x2'),'variableName':null}];switch(_0x19d1ad[_0xc8a5('0x3')]()){case _0xc8a5('0x4'):switch(_0x2a8a8d[_0xc8a5('0x3')]()){case'inbound':_0xb0db76[_0xc8a5('0x5')]({'type':_0xc8a5('0x6'),'content':'','variableName':'queue'});_0xb0db76[_0xc8a5('0x5')]({'type':_0xc8a5('0x6'),'content':'','variableName':_0xc8a5('0x7')});break;case _0xc8a5('0x8'):_0xb0db76['push']({'type':_0xc8a5('0x1'),'content':_0xc8a5('0x9'),'variableName':null});_0xb0db76[_0xc8a5('0x5')]({'type':_0xc8a5('0x6'),'content':'','variableName':_0xc8a5('0xa')});break;}}return _0xb0db76;};exports[_0xc8a5('0xb')]=function(_0x136146,_0x16fd9a){var _0xea6d98=[];switch(_0x136146['toLowerCase']()){case'voice':switch(_0x16fd9a[_0xc8a5('0x3')]()){case'inbound':_0xea6d98=[{'type':_0xc8a5('0x1'),'content':_0xc8a5('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0xe'),'keyType':_0xc8a5('0x6'),'variableName':'calleridnum'},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0xf'),'keyType':'variable','variableName':_0xc8a5('0x10')},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x11'),'keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0x12')},{'type':_0xc8a5('0xd'),'content':'','key':'Queue','keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0x13')},{'type':'keyValue','content':'','key':_0xc8a5('0x14'),'keyType':_0xc8a5('0x6'),'variableName':'uniqueid'},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x15'),'keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0x16')},{'type':_0xc8a5('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xc8a5('0xd'),'content':'','key':'Agent\x20Name','keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0x17')},{'type':'keyValue','content':'','key':'Agent\x20Number','keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0xa')},{'type':_0xc8a5('0x1'),'content':_0xc8a5('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xc8a5('0xd'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0xc8a5('0x16')},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x19'),'keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0x1a')},{'type':_0xc8a5('0xd'),'content':'','key':'Agent\x20Complete','keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0x1b')},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x1c'),'keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0x1d')},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x1e'),'keyType':_0xc8a5('0x6'),'variableName':'talktime'}];break;case _0xc8a5('0x8'):_0xea6d98=[{'type':_0xc8a5('0x1'),'content':_0xc8a5('0xc'),'variableName':null},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x1f'),'keyType':_0xc8a5('0x6'),'keyContent':'','variableName':_0xc8a5('0xa')},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':_0xc8a5('0x6'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':_0xc8a5('0x14'),'keyType':_0xc8a5('0x6'),'keyContent':'','variableName':_0xc8a5('0x20')},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x15'),'keyType':_0xc8a5('0x6'),'keyContent':'','variableName':'starttime'},{'type':_0xc8a5('0x1'),'content':_0xc8a5('0x18')},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x21'),'keyType':_0xc8a5('0x6'),'keyContent':'','variableName':_0xc8a5('0x22')},{'type':'keyValue','content':'','key':_0xc8a5('0x23'),'keyType':_0xc8a5('0x6'),'keyContent':'','variableName':_0xc8a5('0x24')},{'type':_0xc8a5('0xd'),'content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':_0xc8a5('0x25')},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x26'),'keyType':_0xc8a5('0x6'),'keyContent':'','variableName':_0xc8a5('0x27')}];break;}}return _0xea6d98;}; \ No newline at end of file +var _0x1eba=['Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','billableseconds','getSubjects','string','voice','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','destcalleridnum','***\x20Call\x20Info\x20***','keyValue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x3bf925,_0x4dd8e4){_0x3bf925=_0x3bf925-0x0;var _0x2128a1=_0x1eba[_0x3bf925];return _0x2128a1;};'use strict';exports[_0xa1eb('0x0')]=function(_0x2b1355,_0x406a58){var _0x2158d5=[{'type':_0xa1eb('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x2b1355['toLowerCase']()){case _0xa1eb('0x2'):switch(_0x406a58[_0xa1eb('0x3')]()){case _0xa1eb('0x4'):_0x2158d5[_0xa1eb('0x5')]({'type':_0xa1eb('0x6'),'content':'','variableName':_0xa1eb('0x7')});_0x2158d5[_0xa1eb('0x5')]({'type':_0xa1eb('0x6'),'content':'','variableName':_0xa1eb('0x8')});break;case _0xa1eb('0x9'):_0x2158d5[_0xa1eb('0x5')]({'type':_0xa1eb('0x1'),'content':'Outbound\x20Call','variableName':null});_0x2158d5[_0xa1eb('0x5')]({'type':'variable','content':'','variableName':_0xa1eb('0xa')});break;}}return _0x2158d5;};exports['getDescriptions']=function(_0x3f53ff,_0x5d7101){var _0x41a7bc=[];switch(_0x3f53ff['toLowerCase']()){case _0xa1eb('0x2'):switch(_0x5d7101[_0xa1eb('0x3')]()){case _0xa1eb('0x4'):_0x41a7bc=[{'type':'string','content':_0xa1eb('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xa1eb('0xc'),'content':'','key':'Caller\x20Number','keyType':_0xa1eb('0x6'),'variableName':'calleridnum'},{'type':'keyValue','content':'','key':_0xa1eb('0xd'),'keyType':'variable','variableName':_0xa1eb('0xe')},{'type':_0xa1eb('0xc'),'content':'','key':_0xa1eb('0xf'),'keyType':_0xa1eb('0x6'),'variableName':_0xa1eb('0x10')},{'type':_0xa1eb('0xc'),'content':'','key':_0xa1eb('0x11'),'keyType':_0xa1eb('0x6'),'variableName':_0xa1eb('0x7')},{'type':'keyValue','content':'','key':_0xa1eb('0x12'),'keyType':'variable','variableName':_0xa1eb('0x13')},{'type':_0xa1eb('0xc'),'content':'','key':_0xa1eb('0x14'),'keyType':_0xa1eb('0x6'),'variableName':'agentcalledAt'},{'type':_0xa1eb('0x1'),'content':_0xa1eb('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xa1eb('0xc'),'content':'','key':_0xa1eb('0x16'),'keyType':_0xa1eb('0x6'),'variableName':_0xa1eb('0x17')},{'type':_0xa1eb('0xc'),'content':'','key':_0xa1eb('0x18'),'keyType':'variable','variableName':_0xa1eb('0xa')},{'type':'string','content':_0xa1eb('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xa1eb('0xc'),'content':'','key':_0xa1eb('0x1a'),'keyType':_0xa1eb('0x6'),'variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':_0xa1eb('0x1b'),'keyType':_0xa1eb('0x6'),'variableName':'agentconnectAt'},{'type':_0xa1eb('0xc'),'content':'','key':_0xa1eb('0x1c'),'keyType':_0xa1eb('0x6'),'variableName':_0xa1eb('0x1d')},{'type':_0xa1eb('0xc'),'content':'','key':_0xa1eb('0x1e'),'keyType':_0xa1eb('0x6'),'variableName':_0xa1eb('0x1f')},{'type':_0xa1eb('0xc'),'content':'','key':_0xa1eb('0x20'),'keyType':_0xa1eb('0x6'),'variableName':_0xa1eb('0x21')}];break;case'outbound':_0x41a7bc=[{'type':_0xa1eb('0x1'),'content':_0xa1eb('0xb'),'variableName':null},{'type':'keyValue','content':'','key':_0xa1eb('0x22'),'keyType':'variable','keyContent':'','variableName':_0xa1eb('0xa')},{'type':_0xa1eb('0xc'),'content':'','key':'Member\x20Name','keyType':_0xa1eb('0x6'),'keyContent':'','variableName':_0xa1eb('0x23')},{'type':_0xa1eb('0xc'),'content':'','key':'UniqueId','keyType':_0xa1eb('0x6'),'keyContent':'','variableName':_0xa1eb('0x13')},{'type':'keyValue','content':'','key':_0xa1eb('0x14'),'keyType':_0xa1eb('0x6'),'keyContent':'','variableName':_0xa1eb('0x24')},{'type':_0xa1eb('0x1'),'content':_0xa1eb('0x19')},{'type':'keyValue','content':'','key':_0xa1eb('0x25'),'keyType':_0xa1eb('0x6'),'keyContent':'','variableName':_0xa1eb('0x26')},{'type':_0xa1eb('0xc'),'content':'','key':_0xa1eb('0x27'),'keyType':_0xa1eb('0x6'),'keyContent':'','variableName':_0xa1eb('0x28')},{'type':_0xa1eb('0xc'),'content':'','key':_0xa1eb('0x29'),'keyType':_0xa1eb('0x6'),'keyContent':'','variableName':_0xa1eb('0x2a')},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0xa1eb('0x6'),'keyContent':'','variableName':_0xa1eb('0x2b')}];break;}}return _0x41a7bc;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 9095dd3..5ac0ff4 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 _0x2f42=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','findOne','then','update','info','catch','error','user','query','clone','body','omit','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase'];(function(_0x5a123f,_0x14cb93){var _0x40f3e8=function(_0x19fb34){while(--_0x19fb34){_0x5a123f['push'](_0x5a123f['shift']());}};_0x40f3e8(++_0x14cb93);}(_0x2f42,0x90));var _0x22f4=function(_0x13fcbc,_0x3daa3c){_0x13fcbc=_0x13fcbc-0x0;var _0x1420ab=_0x2f42[_0x13fcbc];return _0x1420ab;};'use strict';var _=require(_0x22f4('0x0'));var db=require(_0x22f4('0x1'))['db'];var loggers={'openchannel':require(_0x22f4('0x2'))('openchannel-interactions'),'mail':require(_0x22f4('0x2'))('mail-interactions'),'fax':require('../../config/logger')(_0x22f4('0x3')),'sms':require('../../config/logger')(_0x22f4('0x4')),'chat':require(_0x22f4('0x2'))(_0x22f4('0x5')),'whatsapp':require(_0x22f4('0x2'))(_0x22f4('0x6'))};function getInteractionId(_0x224410,_0x27259e,_0xac64d1){if(_0x224410&&_0x224410[_[_0x22f4('0x7')](_0xac64d1)+'InteractionId']){return _0x224410[_[_0x22f4('0x7')](_0xac64d1)+_0x22f4('0x8')];}else if(_0x224410&&_0x224410['id']){return _0x224410['id'];}else if(_0x27259e&&_0x27259e['id']){return _0x27259e['id'];}else{return _0x22f4('0x9');}}function log(_0x7d4608,_0x3010aa,_0x2f018b,_0x4d948d,_0x4cf2b9,_0x4d977f){loggers[_0x4cf2b9[_0x22f4('0xa')]()][_0x7d4608](_0x22f4('0xb'),_0x4d977f[_0x22f4('0xc')](),_0x3010aa?_0x3010aa['id']:null,_0x3010aa?_0x3010aa[_0x22f4('0xd')]:null,_0x3010aa?_0x3010aa['role']:null,getInteractionId(_0x2f018b,_0x4d948d,_0x4cf2b9),_0x2f018b?JSON[_0x22f4('0xe')](_0x2f018b):_0x22f4('0xf'));}function updateUser(_0x3d97c8,_0x1a229f,_0x4a0c3e,_0x314f97,_0x27dc54){db[_[_0x22f4('0x7')](_0x314f97)+'Interaction'][_0x22f4('0x10')]({'where':{'id':getInteractionId(_0x1a229f,_0x4a0c3e,_0x314f97)}})[_0x22f4('0x11')](function(_0xb0ed34){if(_0xb0ed34){return _0xb0ed34[_0x22f4('0x12')]({'UserId':_0x3d97c8?_0x3d97c8['id']:null});}})[_0x22f4('0x11')](function(_0x3bdc78){if(_0x3bdc78){log(_0x22f4('0x13'),_0x3d97c8,_0x1a229f,_0x4a0c3e,_0x314f97,_0x27dc54);}})[_0x22f4('0x14')](function(){log(_0x22f4('0x15'),_0x3d97c8,_0x1a229f,_0x4a0c3e,_0x314f97,_0x27dc54);});}exports['tracked']=function(_0x304d60,_0x5b0301){return function(_0xa3e335,_0x4edf25,_0x2a7178){var _0x3e405a=_0xa3e335[_0x22f4('0x16')];var _0x58f285={};var _0x307bf3=_0xa3e335[_0x22f4('0x17')];if(_0x58f285){_0x58f285=_[_0x22f4('0x18')](_0xa3e335[_0x22f4('0x19')]);_0x58f285=_[_0x22f4('0x1a')](_0x58f285,[_0x22f4('0x19'),_0x22f4('0x1b'),_0x22f4('0x1c'),_0x22f4('0x1d'),_0x22f4('0x1e')]);}updateUser(_0x3e405a,_0x58f285,_0x307bf3,_0x304d60,_0x5b0301);_0x2a7178(null);};}; \ No newline at end of file +var _0xb383=['then','update','info','catch','error','tracked','user','query','clone','body','omit','html','phone','fax','mobile','lodash','../../mysqldb','openchannel-interactions','mail-interactions','../../config/logger','sms-interactions','chat-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','null','Interaction','findOne'];(function(_0x27ad2b,_0x140b42){var _0x6dc4eb=function(_0x4314c4){while(--_0x4314c4){_0x27ad2b['push'](_0x27ad2b['shift']());}};_0x6dc4eb(++_0x140b42);}(_0xb383,0x87));var _0x3b38=function(_0x38f53d,_0x92410){_0x38f53d=_0x38f53d-0x0;var _0xa050e7=_0xb383[_0x38f53d];return _0xa050e7;};'use strict';var _=require(_0x3b38('0x0'));var db=require(_0x3b38('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x3b38('0x2')),'mail':require('../../config/logger')(_0x3b38('0x3')),'fax':require(_0x3b38('0x4'))('fax-interactions'),'sms':require('../../config/logger')(_0x3b38('0x5')),'chat':require(_0x3b38('0x4'))(_0x3b38('0x6')),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getInteractionId(_0x2669ab,_0x28cc34,_0x5c77d6){if(_0x2669ab&&_0x2669ab[_[_0x3b38('0x7')](_0x5c77d6)+'InteractionId']){return _0x2669ab[_[_0x3b38('0x7')](_0x5c77d6)+_0x3b38('0x8')];}else if(_0x2669ab&&_0x2669ab['id']){return _0x2669ab['id'];}else if(_0x28cc34&&_0x28cc34['id']){return _0x28cc34['id'];}else{return'unknown';}}function log(_0x216945,_0x490db0,_0x1d3b38,_0x7f4e,_0x1bf074,_0xa6aea1){loggers[_0x1bf074[_0x3b38('0x9')]()][_0x216945](_0x3b38('0xa'),_0xa6aea1[_0x3b38('0xb')](),_0x490db0?_0x490db0['id']:null,_0x490db0?_0x490db0['name']:null,_0x490db0?_0x490db0['role']:null,getInteractionId(_0x1d3b38,_0x7f4e,_0x1bf074),_0x1d3b38?JSON['stringify'](_0x1d3b38):_0x3b38('0xc'));}function updateUser(_0xa844ff,_0x334bbc,_0x58960a,_0x1afc36,_0x1a97e9){db[_[_0x3b38('0x7')](_0x1afc36)+_0x3b38('0xd')][_0x3b38('0xe')]({'where':{'id':getInteractionId(_0x334bbc,_0x58960a,_0x1afc36)}})[_0x3b38('0xf')](function(_0x7efe5f){if(_0x7efe5f){return _0x7efe5f[_0x3b38('0x10')]({'UserId':_0xa844ff?_0xa844ff['id']:null});}})['then'](function(_0x4bfc43){if(_0x4bfc43){log(_0x3b38('0x11'),_0xa844ff,_0x334bbc,_0x58960a,_0x1afc36,_0x1a97e9);}})[_0x3b38('0x12')](function(){log(_0x3b38('0x13'),_0xa844ff,_0x334bbc,_0x58960a,_0x1afc36,_0x1a97e9);});}exports[_0x3b38('0x14')]=function(_0x4672e9,_0x5e0965){return function(_0x4beb84,_0x37c6b3,_0x5dda95){var _0x8152e4=_0x4beb84[_0x3b38('0x15')];var _0x18e02a={};var _0x481b8c=_0x4beb84[_0x3b38('0x16')];if(_0x18e02a){_0x18e02a=_[_0x3b38('0x17')](_0x4beb84[_0x3b38('0x18')]);_0x18e02a=_[_0x3b38('0x19')](_0x18e02a,[_0x3b38('0x18'),_0x3b38('0x1a'),_0x3b38('0x1b'),_0x3b38('0x1c'),_0x3b38('0x1d')]);}updateUser(_0x8152e4,_0x18e02a,_0x481b8c,_0x4672e9,_0x5e0965);_0x5dda95(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 0d224d5..5a66753 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 _0x1723=['isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','findOne','then','status','json','catch','users','User','admin','user'];(function(_0x4d6e55,_0x59afcc){var _0x2184c6=function(_0x59729b){while(--_0x59729b){_0x4d6e55['push'](_0x4d6e55['shift']());}};_0x2184c6(++_0x59afcc);}(_0x1723,0xb7));var _0x3172=function(_0x18039c,_0x5a4428){_0x18039c=_0x18039c-0x0;var _0x6cd389=_0x1723[_0x18039c];return _0x6cd389;};'use strict';var crypto=require(_0x3172('0x0'));var util=require(_0x3172('0x1'));var compose=require(_0x3172('0x2'));var db=require(_0x3172('0x3'))['db'];var config=require(_0x3172('0x4'));function getValueFromLicense(_0x49bfdf,_0x182eb5){if(_0x49bfdf&&_0x182eb5){if(_0x182eb5['data1']&&_0x182eb5[_0x3172('0x5')]){var _0x53d0ca=_0x182eb5[_0x3172('0x6')];var _0x3dea17=_0x182eb5[_0x3172('0x5')];var _0x609273=_0x53d0ca['split']('-')[0x4];var _0x30fb17=_0x53d0ca[_0x3172('0x7')]('-')[0x0];var _0x57874b=crypto[_0x3172('0x8')](_0x3172('0x9'),util[_0x3172('0xa')](_0x3172('0xb'),_0x609273,_0x53d0ca,_0x30fb17));var _0x2d4bcc=_0x57874b[_0x3172('0xc')](_0x3dea17,_0x3172('0xd'),_0x3172('0xe'));_0x2d4bcc+=_0x57874b['final'](_0x3172('0xe'));var _0x3c72ba=JSON[_0x3172('0xf')](_0x2d4bcc);return _0x3c72ba['hasOwnProperty'](_0x49bfdf)?_0x3c72ba[_0x49bfdf]:null;}}return null;}function isLimit(_0x3f506a,_0x5865f7,_0x1c6e1a,_0x16eb51){var _0x2126d4=_0x5865f7;return compose()['use'](function(_0x1f1c82,_0x518952,_0x518518){return db['License'][_0x3172('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x3172('0x11')](function(_0x471ca8){var _0x4331f0=getValueFromLicense(_0x3f506a,_0x471ca8);return _0x4331f0?_0x4331f0:_0x2126d4;})['then'](function(_0x371b3a){_0x2126d4=_0x371b3a;return _0x1c6e1a['count'](_0x16eb51);})[_0x3172('0x11')](function(_0xf1bd08){if(_0xf1bd08>=_0x2126d4){return _0x518952[_0x3172('0x12')](0x193)[_0x3172('0x13')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x3f506a)});}_0x518518();})[_0x3172('0x14')](function(_0x41cf83){_0x518518(_0x41cf83);});});}function isUserLimit(){return isLimit(_0x3172('0x15'),0x1,db[_0x3172('0x16')],{'where':{'$or':[{'role':_0x3172('0x17')},{'role':_0x3172('0x18')}]}});}exports[_0x3172('0x19')]=isUserLimit; \ No newline at end of file +var _0xeb21=['User','admin','user','util','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xeb21,0x8a));var _0x1eb2=function(_0x1fa841,_0x37a70c){_0x1fa841=_0x1fa841-0x0;var _0x384b67=_0xeb21[_0x1fa841];return _0x384b67;};'use strict';var crypto=require('crypto');var util=require(_0x1eb2('0x0'));var compose=require('composable-middleware');var db=require(_0x1eb2('0x1'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0xe5cec4,_0x244681){if(_0xe5cec4&&_0x244681){if(_0x244681[_0x1eb2('0x2')]&&_0x244681[_0x1eb2('0x3')]){var _0x2d5553=_0x244681[_0x1eb2('0x2')];var _0x646811=_0x244681[_0x1eb2('0x3')];var _0x386120=_0x2d5553[_0x1eb2('0x4')]('-')[0x4];var _0x486a5e=_0x2d5553[_0x1eb2('0x4')]('-')[0x0];var _0x2687e1=crypto[_0x1eb2('0x5')](_0x1eb2('0x6'),util[_0x1eb2('0x7')](_0x1eb2('0x8'),_0x386120,_0x2d5553,_0x486a5e));var _0x3e3888=_0x2687e1[_0x1eb2('0x9')](_0x646811,_0x1eb2('0xa'),_0x1eb2('0xb'));_0x3e3888+=_0x2687e1[_0x1eb2('0xc')]('utf8');var _0x5314c3=JSON[_0x1eb2('0xd')](_0x3e3888);return _0x5314c3[_0x1eb2('0xe')](_0xe5cec4)?_0x5314c3[_0xe5cec4]:null;}}return null;}function isLimit(_0x1bdd84,_0x386da2,_0x15336e,_0x2fed1c){var _0x5862fb=_0x386da2;return compose()[_0x1eb2('0xf')](function(_0x2d1ea9,_0x3e882c,_0x442ff0){return db[_0x1eb2('0x10')][_0x1eb2('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x1eb2('0x12')](function(_0x15ea44){var _0x4389e6=getValueFromLicense(_0x1bdd84,_0x15ea44);return _0x4389e6?_0x4389e6:_0x5862fb;})[_0x1eb2('0x12')](function(_0x3b2b7e){_0x5862fb=_0x3b2b7e;return _0x15336e[_0x1eb2('0x13')](_0x2fed1c);})[_0x1eb2('0x12')](function(_0x11a9ec){if(_0x11a9ec>=_0x5862fb){return _0x3e882c[_0x1eb2('0x14')](0x193)[_0x1eb2('0x15')]({'message':util[_0x1eb2('0x7')](_0x1eb2('0x16'),_0x1bdd84)});}_0x442ff0();})[_0x1eb2('0x17')](function(_0x47d46b){_0x442ff0(_0x47d46b);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x1eb2('0x18')],{'where':{'$or':[{'role':_0x1eb2('0x19')},{'role':_0x1eb2('0x1a')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index ddf9fc6..378a36c 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 _0xccf2=['match','filter','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','add','days','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','pop','format','utcOffset','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','length','forEach','split','shift'];(function(_0x41a537,_0x4d36df){var _0x34b004=function(_0x36c356){while(--_0x36c356){_0x41a537['push'](_0x41a537['shift']());}};_0x34b004(++_0x4d36df);}(_0xccf2,0x1e3));var _0x2ccf=function(_0x43fa05,_0x3fa44d){_0x43fa05=_0x43fa05-0x0;var _0x2eb8d0=_0xccf2[_0x43fa05];return _0x2eb8d0;};'use strict';var _=require(_0x2ccf('0x0'));var moment=require(_0x2ccf('0x1'));exports[_0x2ccf('0x2')]=function(_0x30d02c){var _0x7caf19={'conditions':[]};_0x7caf19[_0x2ccf('0x3')]=_[_0x2ccf('0x4')](_0x30d02c,_0x2ccf('0x5'))?'or':'and';var _0x286650=_0x30d02c[_0x2ccf('0x6')](_0x2ccf('0x7'),'')[_0x2ccf('0x6')](_0x2ccf('0x5'),'')['split']('||');for(var _0x1eb8fe=0x0;_0x1eb8fe<_0x286650[_0x2ccf('0x8')];_0x1eb8fe++){var _0x372f33=_0x286650[_0x1eb8fe]['split'](':=');var _0x402c33=_0x372f33[0x0];var _0x3773ae=_0x372f33['slice'](0x1);_0x3773ae[_0x2ccf('0x9')](function(_0x57ed07){var _0x4e9c5e=_0x57ed07[_0x2ccf('0xa')]('[')[_0x2ccf('0xb')]();var _0x31f2a8=_0x57ed07[_0x2ccf('0xc')](/\[(.*?)\]/g);_0x31f2a8[_0x2ccf('0x9')](function(_0x267d9a){var _0x11694d=_0x267d9a[_0x2ccf('0xa')]('[')[_0x2ccf('0xd')](function(_0x442c65){return _0x442c65['indexOf'](']')>-0x1;})['map'](function(_0xdbc357){return _0xdbc357[_0x2ccf('0xa')](']')[0x0];})[0x0];_0x7caf19[_0x2ccf('0xe')][_0x2ccf('0xf')]({'field':_0x402c33,'operator':_0x4e9c5e,'value':_0x11694d});});});}return _0x7caf19;};exports[_0x2ccf('0x10')]=function(_0x424c70,_0x4b1801,_0x3097e6){var _0x5a2641={};if(_0x4b1801===_0x2ccf('0x11')){if(_0x3097e6[_0x2ccf('0x12')]===_0x2ccf('0x13')){_0x3097e6['operator']='$between';_0x3097e6[_0x2ccf('0x14')]+=','+_0x3097e6['value'];}else if(_[_0x2ccf('0x15')]([_0x2ccf('0x16'),_0x2ccf('0x17')],_0x3097e6[_0x2ccf('0x12')])){_0x3097e6[_0x2ccf('0x14')]=moment(_0x3097e6[_0x2ccf('0x14')])[_0x2ccf('0x18')](0x1,_0x2ccf('0x19'))['format']('YYYY-MM-DD');}}if(_0x3097e6[_0x2ccf('0x1a')]){_0x4b1801=_0x3097e6[_0x2ccf('0x1a')];_0x5a2641[_0x2ccf('0x1b')]='CAST('+_0x424c70+'.'+_0x3097e6[_0x2ccf('0x1c')]+_0x2ccf('0x1d')+_0x3097e6[_0x2ccf('0x1a')]+')\x20'+parseOperator(_0x3097e6['operator']);}else{_0x5a2641[_0x2ccf('0x1b')]=_0x424c70+'.'+_0x3097e6[_0x2ccf('0x1c')]+'\x20'+parseOperator(_0x3097e6[_0x2ccf('0x12')]);}if(_['includes']([_0x2ccf('0x1e'),_0x2ccf('0x1f')],_0x3097e6['operator']))_0x5a2641[_0x2ccf('0x1b')]='('+_0x5a2641[_0x2ccf('0x1b')]+_0x2ccf('0x20')+_0x424c70+'.'+_0x3097e6[_0x2ccf('0x1c')]+'\x20IS\x20NULL)';_0x5a2641[_0x2ccf('0x14')]=parseValue(_0x4b1801,_0x3097e6['operator'],_0x3097e6[_0x2ccf('0x14')]);return _0x5a2641;};function parseOperator(_0x42c6ed){var _0x57613d;switch(_0x42c6ed){case _0x2ccf('0x21'):_0x57613d=_0x2ccf('0x22');break;case'$notIn':_0x57613d=_0x2ccf('0x23');break;case'$eq':_0x57613d=_0x2ccf('0x24');break;case'$ne':_0x57613d=_0x2ccf('0x25');break;case _0x2ccf('0x26'):case _0x2ccf('0x27'):case _0x2ccf('0x28'):_0x57613d='LIKE\x20?';break;case _0x2ccf('0x29'):_0x57613d=_0x2ccf('0x2a');break;case _0x2ccf('0x16'):_0x57613d=_0x2ccf('0x2b');break;case _0x2ccf('0x17'):_0x57613d=_0x2ccf('0x2c');break;case _0x2ccf('0x2d'):_0x57613d=_0x2ccf('0x2e');break;case _0x2ccf('0x2f'):_0x57613d=_0x2ccf('0x30');break;}return _0x57613d;}function parseValue(_0x1bf9c3,_0x25e012,_0x26f596){var _0x1d57a9={'start':undefined,'end':undefined};switch(_0x25e012){case _0x2ccf('0x21'):case _0x2ccf('0x1f'):_0x1d57a9[_0x2ccf('0x31')]=_0x26f596[_0x2ccf('0xa')](',');break;case _0x2ccf('0x26'):_0x1d57a9[_0x2ccf('0x31')]='%'+_0x26f596+'%';break;case _0x2ccf('0x27'):_0x1d57a9[_0x2ccf('0x31')]=_0x26f596+'%';break;case'$endsWith':_0x1d57a9[_0x2ccf('0x31')]='%'+_0x26f596;break;case'$between':var _0x165675=_0x26f596['split'](',');var _0x26f596=_0x165675[_0x2ccf('0xb')]();var _0x333620=_0x165675[_0x2ccf('0x32')]();if(_0x1bf9c3===_0x2ccf('0x11')){_0x26f596=moment(_0x26f596)['utcOffset'](0x0,!![])[_0x2ccf('0x33')]();_0x333620=moment(_0x333620)[_0x2ccf('0x34')](0x0,!![])['add'](0x17,_0x2ccf('0x35'))['add'](0x3b,_0x2ccf('0x36'))[_0x2ccf('0x18')](0x3b,'seconds')[_0x2ccf('0x33')]();}_0x1d57a9={'start':_0x26f596,'end':_0x333620};break;default:_0x1d57a9[_0x2ccf('0x31')]=_0x26f596;break;}return _0x1d57a9;} \ No newline at end of file +var _0xc5ee=['field','\x20AS\x20','text','$ne','\x20IS\x20NULL)','$in','$notIn','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','start','format','utcOffset','hours','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','slice','shift','match','filter','indexOf','map','conditions','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','YYYY-MM-DD','castTo','CAST('];(function(_0x5a6325,_0x4731ef){var _0x5a3875=function(_0x131e24){while(--_0x131e24){_0x5a6325['push'](_0x5a6325['shift']());}};_0x5a3875(++_0x4731ef);}(_0xc5ee,0x15d));var _0xec5e=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0xc5ee[_0x5179a5];return _0x15c8ce;};'use strict';var _=require('lodash');var moment=require(_0xec5e('0x0'));exports[_0xec5e('0x1')]=function(_0x2739fd){var _0x357439={'conditions':[]};_0x357439[_0xec5e('0x2')]=_[_0xec5e('0x3')](_0x2739fd,_0xec5e('0x4'))?'or':_0xec5e('0x5');var _0x1d5f89=_0x2739fd['replace'](_0xec5e('0x6'),'')[_0xec5e('0x7')](_0xec5e('0x4'),'')[_0xec5e('0x8')]('||');for(var _0x3b20e8=0x0;_0x3b20e8<_0x1d5f89[_0xec5e('0x9')];_0x3b20e8++){var _0x354408=_0x1d5f89[_0x3b20e8][_0xec5e('0x8')](':=');var _0x308acb=_0x354408[0x0];var _0x7dbc94=_0x354408[_0xec5e('0xa')](0x1);_0x7dbc94['forEach'](function(_0x36ca77){var _0x5de872=_0x36ca77['split']('[')[_0xec5e('0xb')]();var _0x882a46=_0x36ca77[_0xec5e('0xc')](/\[(.*?)\]/g);_0x882a46['forEach'](function(_0x36f4aa){var _0x1b923d=_0x36f4aa[_0xec5e('0x8')]('[')[_0xec5e('0xd')](function(_0x554f81){return _0x554f81[_0xec5e('0xe')](']')>-0x1;})[_0xec5e('0xf')](function(_0xc143a3){return _0xc143a3['split'](']')[0x0];})[0x0];_0x357439[_0xec5e('0x10')]['push']({'field':_0x308acb,'operator':_0x5de872,'value':_0x1b923d});});});}return _0x357439;};exports['buildExpression']=function(_0xe8d0d4,_0x3bbacf,_0x10cb6d){var _0x5046bb={};if(_0x3bbacf===_0xec5e('0x11')){if(_0x10cb6d[_0xec5e('0x12')]===_0xec5e('0x13')){_0x10cb6d[_0xec5e('0x12')]=_0xec5e('0x14');_0x10cb6d['value']+=','+_0x10cb6d[_0xec5e('0x15')];}else if(_[_0xec5e('0x16')]([_0xec5e('0x17'),_0xec5e('0x18')],_0x10cb6d[_0xec5e('0x12')])){_0x10cb6d['value']=moment(_0x10cb6d[_0xec5e('0x15')])[_0xec5e('0x19')](0x1,'days')['format'](_0xec5e('0x1a'));}}if(_0x10cb6d[_0xec5e('0x1b')]){_0x3bbacf=_0x10cb6d[_0xec5e('0x1b')];_0x5046bb['text']=_0xec5e('0x1c')+_0xe8d0d4+'.'+_0x10cb6d[_0xec5e('0x1d')]+_0xec5e('0x1e')+_0x10cb6d[_0xec5e('0x1b')]+')\x20'+parseOperator(_0x10cb6d['operator']);}else{_0x5046bb[_0xec5e('0x1f')]=_0xe8d0d4+'.'+_0x10cb6d[_0xec5e('0x1d')]+'\x20'+parseOperator(_0x10cb6d[_0xec5e('0x12')]);}if(_[_0xec5e('0x16')]([_0xec5e('0x20'),'$notIn'],_0x10cb6d[_0xec5e('0x12')]))_0x5046bb[_0xec5e('0x1f')]='('+_0x5046bb[_0xec5e('0x1f')]+'\x20OR\x20'+_0xe8d0d4+'.'+_0x10cb6d['field']+_0xec5e('0x21');_0x5046bb['value']=parseValue(_0x3bbacf,_0x10cb6d[_0xec5e('0x12')],_0x10cb6d[_0xec5e('0x15')]);return _0x5046bb;};function parseOperator(_0x174604){var _0x37557a;switch(_0x174604){case _0xec5e('0x22'):_0x37557a='IN\x20?';break;case _0xec5e('0x23'):_0x37557a=_0xec5e('0x24');break;case _0xec5e('0x13'):_0x37557a=_0xec5e('0x25');break;case'$ne':_0x37557a=_0xec5e('0x26');break;case _0xec5e('0x27'):case _0xec5e('0x28'):case _0xec5e('0x29'):_0x37557a=_0xec5e('0x2a');break;case _0xec5e('0x2b'):_0x37557a=_0xec5e('0x2c');break;case'$gt':_0x37557a=_0xec5e('0x2d');break;case _0xec5e('0x18'):_0x37557a=_0xec5e('0x2e');break;case'$gte':_0x37557a=_0xec5e('0x2f');break;case _0xec5e('0x14'):_0x37557a='BETWEEN\x20?\x20AND\x20?';break;}return _0x37557a;}function parseValue(_0x262595,_0x3cb890,_0xb0cf49){var _0xc4f2f7={'start':undefined,'end':undefined};switch(_0x3cb890){case'$in':case _0xec5e('0x23'):_0xc4f2f7[_0xec5e('0x30')]=_0xb0cf49[_0xec5e('0x8')](',');break;case _0xec5e('0x27'):_0xc4f2f7['start']='%'+_0xb0cf49+'%';break;case'$startsWith':_0xc4f2f7[_0xec5e('0x30')]=_0xb0cf49+'%';break;case _0xec5e('0x29'):_0xc4f2f7[_0xec5e('0x30')]='%'+_0xb0cf49;break;case _0xec5e('0x14'):var _0x2c1bd3=_0xb0cf49['split'](',');var _0xb0cf49=_0x2c1bd3['shift']();var _0x611d5e=_0x2c1bd3['pop']();if(_0x262595===_0xec5e('0x11')){_0xb0cf49=moment(_0xb0cf49)['utcOffset'](0x0,!![])[_0xec5e('0x31')]();_0x611d5e=moment(_0x611d5e)[_0xec5e('0x32')](0x0,!![])[_0xec5e('0x19')](0x17,_0xec5e('0x33'))[_0xec5e('0x19')](0x3b,_0xec5e('0x34'))['add'](0x3b,_0xec5e('0x35'))[_0xec5e('0x31')]();}_0xc4f2f7={'start':_0xb0cf49,'end':_0x611d5e};break;default:_0xc4f2f7['start']=_0xb0cf49;break;}return _0xc4f2f7;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index a561aae..f1004a1 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 _0x6611=['utc','$lte','YYYY-MM-DD','subtract','isArray','limit','sort','indexOf','priority','cast','col','unsigned','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isEmail','match','getFullTextValue','forEach','replace','push','join','sequelize','moment','fields','split','filters','isEmpty','forOwn','find','DATE','isPlainObject','parse','$gte','format'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x6611,0xe3));var _0x1661=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6611[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var sequelize=require(_0x1661('0x0'));var moment=require(_0x1661('0x1'));var LIMIT_VALUE=0xfa;exports[_0x1661('0x2')]=function(_0x5a3761){var _0x1d9c72=null;if(_0x5a3761){_0x1d9c72=_0x5a3761[_0x1661('0x3')](',');}return _0x1d9c72;};exports[_0x1661('0x4')]=function(_0x58f9f1,_0x1891e6){var _0x178551={};if(!_[_0x1661('0x5')](_0x58f9f1)){_[_0x1661('0x6')](_0x58f9f1,function(_0x25823b,_0x55fa83){try{if(_0x1891e6){var _0x263728=_[_0x1661('0x7')](_0x1891e6,{'name':_0x55fa83})||{};if(_0x263728['type']===_0x1661('0x8')&&_[_0x1661('0x9')](_0x25823b)){var _0x4b8358=JSON[_0x1661('0xa')](_0x25823b);var _0x11a867={'$gte':moment(moment(_0x4b8358[_0x1661('0xb')])[_0x1661('0xc')]('YYYY-MM-DD'))[_0x1661('0xd')]()[_0x1661('0xc')](),'$lte':moment(moment(_0x4b8358[_0x1661('0xe')])['format'](_0x1661('0xf')))[_0x1661('0xd')]()[_0x1661('0x10')](0x1,'s')[_0x1661('0xc')]()};_0x178551[_0x55fa83]=_0x11a867;}else{_0x178551[_0x55fa83]=_[_0x1661('0x11')](_0x25823b)?_0x25823b:JSON['parse'](_0x25823b);}}else{_0x178551[_0x55fa83]=_['isArray'](_0x25823b)?_0x25823b:JSON['parse'](_0x25823b);}}catch(_0x2a8300){_0x178551[_0x55fa83]=_0x25823b[_0x1661('0x3')](',');}});}return _0x178551;};exports[_0x1661('0x12')]=function(_0x2f69b2){_0x2f69b2=parseInt(_0x2f69b2,0xa);if(!_0x2f69b2||_0x2f69b2<0x0){_0x2f69b2=LIMIT_VALUE;}return _0x2f69b2;};exports['offset']=function(_0x47f045){_0x47f045=parseInt(_0x47f045,0xa);if(!_0x47f045||_0x47f045<0x0){_0x47f045=0x0;}return _0x47f045;};exports[_0x1661('0x13')]=function(_0xee393d){var _0x2986a5,_0xeee42f=null;if(_0xee393d){_0x2986a5=_0xee393d[_0x1661('0x3')](',');_0xeee42f=_['map'](_0x2986a5,function(_0x452307){if(_0x452307[_0x1661('0x14')]('-')===0x0){return[_0x452307===_0x1661('0x15')?sequelize[_0x1661('0x16')](sequelize[_0x1661('0x17')]('priority'),_0x1661('0x18')):_0x452307['substr'](0x1),_0x1661('0x19')];}else{return[_0x452307==='priority'?sequelize[_0x1661('0x16')](sequelize['col'](_0x1661('0x15')),_0x1661('0x18')):_0x452307,_0x1661('0x1a')];}});}return _0xeee42f;};exports[_0x1661('0x1b')]=function(_0x1800f7,_0x5ca146){if(_[_0x1661('0x5')](_0x1800f7)){return _0x1800f7;}if(_['isArray'](_0x1800f7)){for(var _0x459a01=0x0;_0x459a01<_0x1800f7[_0x1661('0x1c')];_0x459a01+=0x1){_0x1800f7[_0x459a01]=this[_0x1661('0x1b')](_0x1800f7[_0x459a01],_0x5ca146);}return _0x1800f7;}if(!_[_0x1661('0x1d')](_0x1800f7)){return _0x1800f7;}if(_[_0x1661('0x1e')](_0x5ca146)){_0x5ca146=[_0x5ca146];}if(!_['isArray'](_0x5ca146)){return _0x1800f7;}for(var _0x5e7d1e=0x0;_0x5e7d1e<_0x5ca146[_0x1661('0x1c')];_0x5e7d1e+=0x1){_[_0x1661('0x1f')](_0x1800f7,_0x5ca146[_0x5e7d1e]);}for(var _0x618ce8 in _0x1800f7){if(_0x1800f7[_0x1661('0x20')](_0x618ce8)){_0x1800f7[_0x618ce8]=this['omit'](_0x1800f7[_0x618ce8],_0x5ca146);}}return _0x1800f7;};exports['isNumeric']=function(_0x1b8f14){return _0x1b8f14['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x1661('0x21')]=function(_0xdf1cb0){return _0xdf1cb0[_0x1661('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x1661('0x23')]=function(_0x58deae){var _0xf3a309=[];_0x58deae['split'](/[ ,]+/)[_0x1661('0x24')](function(_0x13e4bf){_0x13e4bf=_0x13e4bf[_0x1661('0x25')](/([^:]")"+/g,'$1');_0x13e4bf='+'+_0x13e4bf+'*';if(_0x13e4bf['includes']('@'))_0x13e4bf='\x22'+_0x13e4bf+'\x22';_0xf3a309[_0x1661('0x26')](_0x13e4bf);});return _0xf3a309[_0x1661('0x27')]('\x20');}; \ No newline at end of file +var _0x22e5=['omit','isEmpty','length','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','includes','join','lodash','moment','fields','split','filters','find','DATE','isPlainObject','parse','$gte','YYYY-MM-DD','utc','format','$lte','isArray','limit','offset','sort','map','priority','col','substr','cast','unsigned','ASC'];(function(_0x121330,_0x53eeb9){var _0x401cb4=function(_0x27eab6){while(--_0x27eab6){_0x121330['push'](_0x121330['shift']());}};_0x401cb4(++_0x53eeb9);}(_0x22e5,0x87));var _0x522e=function(_0x159528,_0x57555d){_0x159528=_0x159528-0x0;var _0x27fc15=_0x22e5[_0x159528];return _0x27fc15;};'use strict';var _=require(_0x522e('0x0'));var sequelize=require('sequelize');var moment=require(_0x522e('0x1'));var LIMIT_VALUE=0xfa;exports[_0x522e('0x2')]=function(_0x42c862){var _0x230f47=null;if(_0x42c862){_0x230f47=_0x42c862[_0x522e('0x3')](',');}return _0x230f47;};exports[_0x522e('0x4')]=function(_0x18fe3b,_0x4bcdf5){var _0x15128c={};if(!_['isEmpty'](_0x18fe3b)){_['forOwn'](_0x18fe3b,function(_0x2a9772,_0x59d956){try{if(_0x4bcdf5){var _0x506212=_[_0x522e('0x5')](_0x4bcdf5,{'name':_0x59d956})||{};if(_0x506212['type']===_0x522e('0x6')&&_[_0x522e('0x7')](_0x2a9772)){var _0x2392b2=JSON[_0x522e('0x8')](_0x2a9772);var _0x383bb7={'$gte':moment(moment(_0x2392b2[_0x522e('0x9')])['format'](_0x522e('0xa')))[_0x522e('0xb')]()[_0x522e('0xc')](),'$lte':moment(moment(_0x2392b2[_0x522e('0xd')])[_0x522e('0xc')](_0x522e('0xa')))[_0x522e('0xb')]()['subtract'](0x1,'s')['format']()};_0x15128c[_0x59d956]=_0x383bb7;}else{_0x15128c[_0x59d956]=_['isArray'](_0x2a9772)?_0x2a9772:JSON[_0x522e('0x8')](_0x2a9772);}}else{_0x15128c[_0x59d956]=_[_0x522e('0xe')](_0x2a9772)?_0x2a9772:JSON[_0x522e('0x8')](_0x2a9772);}}catch(_0x219e8a){_0x15128c[_0x59d956]=_0x2a9772[_0x522e('0x3')](',');}});}return _0x15128c;};exports[_0x522e('0xf')]=function(_0x2b29f2){_0x2b29f2=parseInt(_0x2b29f2,0xa);if(!_0x2b29f2||_0x2b29f2<0x0){_0x2b29f2=LIMIT_VALUE;}return _0x2b29f2;};exports[_0x522e('0x10')]=function(_0x4c9623){_0x4c9623=parseInt(_0x4c9623,0xa);if(!_0x4c9623||_0x4c9623<0x0){_0x4c9623=0x0;}return _0x4c9623;};exports[_0x522e('0x11')]=function(_0x636801){var _0x364a2c,_0x16a12e=null;if(_0x636801){_0x364a2c=_0x636801[_0x522e('0x3')](',');_0x16a12e=_[_0x522e('0x12')](_0x364a2c,function(_0x2a4810){if(_0x2a4810['indexOf']('-')===0x0){return[_0x2a4810===_0x522e('0x13')?sequelize['cast'](sequelize[_0x522e('0x14')](_0x522e('0x13')),'unsigned'):_0x2a4810[_0x522e('0x15')](0x1),'DESC'];}else{return[_0x2a4810===_0x522e('0x13')?sequelize[_0x522e('0x16')](sequelize['col'](_0x522e('0x13')),_0x522e('0x17')):_0x2a4810,_0x522e('0x18')];}});}return _0x16a12e;};exports[_0x522e('0x19')]=function(_0x390a99,_0x14ba35){if(_[_0x522e('0x1a')](_0x390a99)){return _0x390a99;}if(_[_0x522e('0xe')](_0x390a99)){for(var _0x17e465=0x0;_0x17e465<_0x390a99[_0x522e('0x1b')];_0x17e465+=0x1){_0x390a99[_0x17e465]=this[_0x522e('0x19')](_0x390a99[_0x17e465],_0x14ba35);}return _0x390a99;}if(!_[_0x522e('0x1c')](_0x390a99)){return _0x390a99;}if(_[_0x522e('0x1d')](_0x14ba35)){_0x14ba35=[_0x14ba35];}if(!_['isArray'](_0x14ba35)){return _0x390a99;}for(var _0x12f786=0x0;_0x12f786<_0x14ba35[_0x522e('0x1b')];_0x12f786+=0x1){_['unset'](_0x390a99,_0x14ba35[_0x12f786]);}for(var _0x45aa3a in _0x390a99){if(_0x390a99[_0x522e('0x1e')](_0x45aa3a)){_0x390a99[_0x45aa3a]=this[_0x522e('0x19')](_0x390a99[_0x45aa3a],_0x14ba35);}}return _0x390a99;};exports[_0x522e('0x1f')]=function(_0x243b04){return _0x243b04[_0x522e('0x20')](RegExp(_0x522e('0x21')))?!![]:![];};exports[_0x522e('0x22')]=function(_0x30eaa9){return _0x30eaa9['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x522e('0x23')]=function(_0x234aed){var _0x56159d=[];_0x234aed['split'](/[ ,]+/)[_0x522e('0x24')](function(_0x688454){_0x688454=_0x688454[_0x522e('0x25')](/([^:]")"+/g,'$1');_0x688454='+'+_0x688454+'*';if(_0x688454[_0x522e('0x26')]('@'))_0x688454='\x22'+_0x688454+'\x22';_0x56159d['push'](_0x688454);});return _0x56159d[_0x522e('0x27')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index ed28e62..7ef79e7 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f32=['initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','cors','moment','./environment','../mysqldb','default','get','env','production','set','appPath','join','public','development','test','root','client','json\x20replacer','toISOString','use','static','views','engine','ejs','renderFile','view\x20engine','json','50mb'];(function(_0x4ba1d0,_0x2e64ab){var _0xb50d33=function(_0x117b1e){while(--_0x117b1e){_0x4ba1d0['push'](_0x4ba1d0['shift']());}};_0xb50d33(++_0x2e64ab);}(_0x8f32,0x1eb));var _0x28f3=function(_0x27e78b,_0x39d982){_0x27e78b=_0x27e78b-0x0;var _0x4cf4e4=_0x8f32[_0x27e78b];return _0x4cf4e4;};'use strict';var express=require(_0x28f3('0x0'));var favicon=require(_0x28f3('0x1'));var bodyParser=require(_0x28f3('0x2'));var methodOverride=require(_0x28f3('0x3'));var cookieParser=require(_0x28f3('0x4'));var errorHandler=require(_0x28f3('0x5'));var path=require(_0x28f3('0x6'));var passport=require('passport');var cors=require(_0x28f3('0x7'));var moment=require(_0x28f3('0x8'));var config=require(_0x28f3('0x9'));var db=require(_0x28f3('0xa'))['db'];exports[_0x28f3('0xb')]=function(_0x4e336c){var _0x32c37b=_0x4e336c[_0x28f3('0xc')](_0x28f3('0xd'));if(_0x32c37b===_0x28f3('0xe')){_0x4e336c[_0x28f3('0xf')](_0x28f3('0x10'),path[_0x28f3('0x11')](config['root'],_0x28f3('0x12')));}if(_0x32c37b===_0x28f3('0x13')||_0x32c37b===_0x28f3('0x14')){_0x4e336c[_0x28f3('0xf')](_0x28f3('0x10'),path[_0x28f3('0x11')](config[_0x28f3('0x15')],_0x28f3('0x16')));_0x4e336c['use'](errorHandler());}_0x4e336c[_0x28f3('0xf')](_0x28f3('0x17'),function(_0x1e6654,_0x46f551){if(this[_0x1e6654]instanceof Date){_0x46f551=this[_0x1e6654][_0x28f3('0x18')]()['split']('.')[0x0]+'Z';}return _0x46f551;});_0x4e336c[_0x28f3('0x19')](express[_0x28f3('0x1a')](_0x4e336c[_0x28f3('0xc')](_0x28f3('0x10'))));_0x4e336c['set'](_0x28f3('0x1b'),config['root']+'/server/views');_0x4e336c[_0x28f3('0x1c')]('html',require(_0x28f3('0x1d'))[_0x28f3('0x1e')]);_0x4e336c[_0x28f3('0xf')](_0x28f3('0x1f'),'html');_0x4e336c[_0x28f3('0x19')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x4e336c[_0x28f3('0x19')](bodyParser[_0x28f3('0x20')]({'limit':_0x28f3('0x21')}));_0x4e336c['use'](cors());_0x4e336c[_0x28f3('0x19')](methodOverride());_0x4e336c['use'](cookieParser());_0x4e336c[_0x28f3('0x19')](passport[_0x28f3('0x22')]());}; \ No newline at end of file +var _0xac65=['initialize','express','body-parser','method-override','cookie-parser','path','passport','moment','./environment','../mysqldb','default','get','production','set','appPath','root','public','development','test','join','use','json\x20replacer','toISOString','static','views','/server/views','html','renderFile','view\x20engine','50mb','json'];(function(_0x16ea64,_0x427bc6){var _0x3ec313=function(_0x21df63){while(--_0x21df63){_0x16ea64['push'](_0x16ea64['shift']());}};_0x3ec313(++_0x427bc6);}(_0xac65,0x156));var _0x5ac6=function(_0x2f9802,_0x6a0d){_0x2f9802=_0x2f9802-0x0;var _0x368dff=_0xac65[_0x2f9802];return _0x368dff;};'use strict';var express=require(_0x5ac6('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x5ac6('0x1'));var methodOverride=require(_0x5ac6('0x2'));var cookieParser=require(_0x5ac6('0x3'));var errorHandler=require('errorhandler');var path=require(_0x5ac6('0x4'));var passport=require(_0x5ac6('0x5'));var cors=require('cors');var moment=require(_0x5ac6('0x6'));var config=require(_0x5ac6('0x7'));var db=require(_0x5ac6('0x8'))['db'];exports[_0x5ac6('0x9')]=function(_0x28980d){var _0xecf30=_0x28980d[_0x5ac6('0xa')]('env');if(_0xecf30===_0x5ac6('0xb')){_0x28980d[_0x5ac6('0xc')](_0x5ac6('0xd'),path['join'](config[_0x5ac6('0xe')],_0x5ac6('0xf')));}if(_0xecf30===_0x5ac6('0x10')||_0xecf30===_0x5ac6('0x11')){_0x28980d[_0x5ac6('0xc')](_0x5ac6('0xd'),path[_0x5ac6('0x12')](config[_0x5ac6('0xe')],'client'));_0x28980d[_0x5ac6('0x13')](errorHandler());}_0x28980d[_0x5ac6('0xc')](_0x5ac6('0x14'),function(_0x1a4470,_0x1f2bf4){if(this[_0x1a4470]instanceof Date){_0x1f2bf4=this[_0x1a4470][_0x5ac6('0x15')]()['split']('.')[0x0]+'Z';}return _0x1f2bf4;});_0x28980d['use'](express[_0x5ac6('0x16')](_0x28980d[_0x5ac6('0xa')](_0x5ac6('0xd'))));_0x28980d['set'](_0x5ac6('0x17'),config[_0x5ac6('0xe')]+_0x5ac6('0x18'));_0x28980d['engine'](_0x5ac6('0x19'),require('ejs')[_0x5ac6('0x1a')]);_0x28980d[_0x5ac6('0xc')](_0x5ac6('0x1b'),_0x5ac6('0x19'));_0x28980d[_0x5ac6('0x13')](bodyParser['urlencoded']({'limit':_0x5ac6('0x1c'),'extended':!![]}));_0x28980d[_0x5ac6('0x13')](bodyParser[_0x5ac6('0x1d')]({'limit':'50mb'}));_0x28980d[_0x5ac6('0x13')](cors());_0x28980d[_0x5ac6('0x13')](methodOverride());_0x28980d[_0x5ac6('0x13')](cookieParser());_0x28980d[_0x5ac6('0x13')](passport[_0x5ac6('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index c7da744..9e1f202 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 _0x1354=['crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','length','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','cpus','model','join','createHash','md5','update','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','ipAddress','digest','substring','lodash'];(function(_0x555c79,_0x1c383b){var _0x4c1889=function(_0x5d43d1){while(--_0x5d43d1){_0x555c79['push'](_0x555c79['shift']());}};_0x4c1889(++_0x1c383b);}(_0x1354,0x95));var _0x4135=function(_0x1f83a5,_0x59843f){_0x1f83a5=_0x1f83a5-0x0;var _0x45edf0=_0x1354[_0x1f83a5];return _0x45edf0;};'use strict';var _=require(_0x4135('0x0'));var os=require('os');var crypto=require(_0x4135('0x1'));var machine=require(_0x4135('0x2'));var exec=require(_0x4135('0x3'))[_0x4135('0x4')];function getInterfaces(){var _0x435d5e=[];var _0x102fec=os['networkInterfaces']();var _0x2c75a3=_[_0x4135('0x5')](_[_0x4135('0x6')](_0x102fec));for(var _0x4a8e27=0x0;_0x4a8e27<_0x2c75a3[_0x4135('0x7')];_0x4a8e27++){var _0x2bcd68=_0x102fec[_0x2c75a3[_0x4a8e27]]['filter'](function(_0x419ad4){return _0x419ad4[_0x4135('0x8')]===_0x4135('0x9')&&_0x419ad4['internal']===![];});_0x435d5e=_0x435d5e[_0x4135('0xa')](_0x2bcd68);}return _0x435d5e;}function getFirstInterface(){var _0x4bc745=_[_0x4135('0xb')](getInterfaces());return{'macAddress':_0x4bc745&&_0x4bc745[_0x4135('0xc')]?_0x4bc745[_0x4135('0xc')]:_0x4135('0xd'),'ipAddress':_0x4bc745&&_0x4bc745['address']?_0x4bc745[_0x4135('0xe')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x73c55f=_[_0x4135('0x5')](os[_0x4135('0xf')]()['map'](function(_0x307e6f){return _0x307e6f[_0x4135('0x10')];}))[_0x4135('0x11')](':');return crypto[_0x4135('0x12')](_0x4135('0x13'))[_0x4135('0x14')](_0x73c55f)['digest']('hex');}exports[_0x4135('0x15')]=function(){switch(os[_0x4135('0x16')]()){case _0x4135('0x17'):return exec(_0x4135('0x18'),{'encoding':'utf8'})[_0x4135('0x19')]('\x0d\x0a','');default:var _0x2e8733=getFirstInterface();var _0x5d3eba=getCPUhash();var _0x590108=_0x5d3eba+'|'+os[_0x4135('0x1a')]()+'|'+_0x2e8733['macAddress']+'|'+_0x2e8733[_0x4135('0x1b')];var _0x5382ea=crypto['createHash']('md5')['update'](_0x590108)[_0x4135('0x1c')]('hex');return _0x5382ea[_0x4135('0x1d')](0x0,0x8)+'-'+_0x5382ea[_0x4135('0x1d')](0x8,0xc)+'-'+_0x5382ea[_0x4135('0x1d')](0xc,0x10)+'-'+_0x5382ea['substring'](0x10,0x14)+'-'+_0x5382ea[_0x4135('0x1d')](0x14);}}; \ No newline at end of file +var _0x37c5=['execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','address','getFirstInterface','cpus','map','model','join','createHash','md5','update','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','digest','substring','crypto','bimedia-machine-uuid','child_process'];(function(_0x335228,_0x48e8b6){var _0x39693a=function(_0x27233e){while(--_0x27233e){_0x335228['push'](_0x335228['shift']());}};_0x39693a(++_0x48e8b6);}(_0x37c5,0xa7));var _0x537c=function(_0x5be068,_0x5cb871){_0x5be068=_0x5be068-0x0;var _0x6fd1d=_0x37c5[_0x5be068];return _0x6fd1d;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x537c('0x0'));var machine=require(_0x537c('0x1'));var exec=require(_0x537c('0x2'))[_0x537c('0x3')];function getInterfaces(){var _0x1c5b5f=[];var _0x183b59=os[_0x537c('0x4')]();var _0x42bd15=_[_0x537c('0x5')](_[_0x537c('0x6')](_0x183b59));for(var _0x564f9c=0x0;_0x564f9c<_0x42bd15[_0x537c('0x7')];_0x564f9c++){var _0x1156f4=_0x183b59[_0x42bd15[_0x564f9c]][_0x537c('0x8')](function(_0x57666f){return _0x57666f[_0x537c('0x9')]===_0x537c('0xa')&&_0x57666f[_0x537c('0xb')]===![];});_0x1c5b5f=_0x1c5b5f[_0x537c('0xc')](_0x1156f4);}return _0x1c5b5f;}function getFirstInterface(){var _0x478797=_[_0x537c('0xd')](getInterfaces());return{'macAddress':_0x478797&&_0x478797[_0x537c('0xe')]?_0x478797[_0x537c('0xe')]:'00:00:00:00:00:00','ipAddress':_0x478797&&_0x478797[_0x537c('0xf')]?_0x478797['address']:'127.0.0.1'};}exports[_0x537c('0x10')]=getFirstInterface;function getCPUhash(){var _0x53004e=_[_0x537c('0x5')](os[_0x537c('0x11')]()[_0x537c('0x12')](function(_0x473606){return _0x473606[_0x537c('0x13')];}))[_0x537c('0x14')](':');return crypto[_0x537c('0x15')](_0x537c('0x16'))[_0x537c('0x17')](_0x53004e)['digest'](_0x537c('0x18'));}exports[_0x537c('0x19')]=function(){switch(os[_0x537c('0x1a')]()){case _0x537c('0x1b'):return exec(_0x537c('0x1c'),{'encoding':_0x537c('0x1d')})[_0x537c('0x1e')]('\x0d\x0a','');default:var _0x3776c3=getFirstInterface();var _0x445763=getCPUhash();var _0x5bd4c9=_0x445763+'|'+os[_0x537c('0x1f')]()+'|'+_0x3776c3['macAddress']+'|'+_0x3776c3['ipAddress'];var _0x4767d7=crypto[_0x537c('0x15')](_0x537c('0x16'))['update'](_0x5bd4c9)[_0x537c('0x20')](_0x537c('0x18'));return _0x4767d7['substring'](0x0,0x8)+'-'+_0x4767d7['substring'](0x8,0xc)+'-'+_0x4767d7[_0x537c('0x21')](0xc,0x10)+'-'+_0x4767d7['substring'](0x10,0x14)+'-'+_0x4767d7['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7e4e004..1416972 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 _0x7ccb=['Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','finally','License','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','pkginfo','version','./hardware','../logger','../../api/jira/jira.controller','process','format','%s/api/servers/%s/check?version=%s','exports','GET','then','||FIELD||VALUE||\x0a','User','admin','email','|reason|','|machineUuid|','|name|','fullname','|email|','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','active','license','data2','info','update','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x7ccb,0x77));var _0xb7cc=function(_0x3572b3,_0x593ffe){_0x3572b3=_0x3572b3-0x0;var _0x55e4aa=_0x7ccb[_0x3572b3];return _0x55e4aa;};'use strict';var util=require(_0xb7cc('0x0'));var moment=require(_0xb7cc('0x1'));var rp=require(_0xb7cc('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0xb7cc('0x3'))(module,_0xb7cc('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xb7cc('0x5'));var logger=require(_0xb7cc('0x6'))('license');var jira=require(_0xb7cc('0x7'));const {config}=require(_0xb7cc('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x3497d9){return new BPromise(function(_0x162fac,_0x234554){var _0x2fba5c=util[_0xb7cc('0x9')](_0xb7cc('0xa'),HOST,_0x3497d9,module[_0xb7cc('0xb')][_0xb7cc('0x4')]);if(oldToken){_0x2fba5c=util[_0xb7cc('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x3497d9,module[_0xb7cc('0xb')][_0xb7cc('0x4')],oldToken);}var _0x1642ff={'uri':_0x2fba5c,'method':_0xb7cc('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x1642ff)[_0xb7cc('0xd')](function(_0x22bff0){_0x162fac(_0x22bff0);})['catch'](function(_0x2d0e02){_0x234554(_0x2d0e02);});});}function sendJiraAlert(_0x3147fc,_0x3c2944,_0x163466){var _0x200ef2=_0xb7cc('0xe');return db[_0xb7cc('0xf')]['findOne']({'where':{'role':_0xb7cc('0x10')},'attributes':['fullname',_0xb7cc('0x11')],'raw':!![]})[_0xb7cc('0xd')](function(_0x5e78da){ADMIN=_0x5e78da;_0x200ef2+=_0xb7cc('0x12')+_0x163466+'|\x0a';_0x200ef2+='|uuid|'+_0x3147fc+'|\x0a';_0x200ef2+=_0xb7cc('0x13')+_0x3c2944+'|\x0a';_0x200ef2+=_0xb7cc('0x14')+ADMIN[_0xb7cc('0x15')]+'|\x0a';_0x200ef2+=_0xb7cc('0x16')+ADMIN[_0xb7cc('0x11')]+'|\x0a';return _0x200ef2;})[_0xb7cc('0xd')](function(_0x1a77a3){var _0x42dd93=hardware['getFirstInterface']()[_0xb7cc('0x17')];return jira[_0xb7cc('0x18')]({'key':_0xb7cc('0x19'),'summary':_0xb7cc('0x1a'),'description':_0x1a77a3,'issuetype':'Alert','oldToken':_0x3147fc,'newToken':_0x3c2944,'email':ADMIN[_0xb7cc('0x11')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x42dd93});});}function manageLicense(_0x2f9bae,_0x3392b0){var _0xe4d505=_0x3392b0['get']({'plain':!![]});httpRequest(_0x2f9bae)['then'](function(_0x1b7c99){if(oldToken){oldToken=undefined;}if(_0x1b7c99[_0xb7cc('0x1b')]){if(!_0xe4d505['license']&&_0xe4d505['license']!=_0x1b7c99[_0xb7cc('0x1c')]||_0xe4d505[_0xb7cc('0x1c')]&&_0xe4d505[_0xb7cc('0x1d')]){logger[_0xb7cc('0x1e')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0xe4d505[_0xb7cc('0x1c')]&&!_0xe4d505[_0xb7cc('0x1d')]&&_0xe4d505[_0xb7cc('0x1c')]!=_0x1b7c99[_0xb7cc('0x1c')]){logger[_0xb7cc('0x1e')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0xe4d505[_0xb7cc('0x1c')]&&!_0xe4d505[_0xb7cc('0x1d')]&&_0xe4d505['license']==_0x1b7c99[_0xb7cc('0x1c')]){return _0x3392b0;}return _0x3392b0[_0xb7cc('0x1f')]({'data1':_0x2f9bae,'data2':null,'license':_0x1b7c99[_0xb7cc('0x1c')]});}else{if(_0x1b7c99['license']||_0xe4d505[_0xb7cc('0x1c')]){if(!_0xe4d505[_0xb7cc('0x1d')]){if(_0xe4d505[_0xb7cc('0x20')]==_0x2f9bae){GRAY_PERIOD_REASON='Disabled';logger[_0xb7cc('0x1e')](_0xb7cc('0x21'));}else{GRAY_PERIOD_REASON=_0xb7cc('0x22');oldToken=_0xe4d505['data1'];logger[_0xb7cc('0x1e')](_0xb7cc('0x23'),_0xe4d505[_0xb7cc('0x20')],_0x2f9bae);}sendJiraAlert(_0xe4d505['data1'],_0x1b7c99[_0xb7cc('0x24')],GRAY_PERIOD_REASON);logger[_0xb7cc('0x1e')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xb7cc('0x25')](),moment()[_0xb7cc('0x9')](_0xb7cc('0x26')));return _0x3392b0['update']({'data2':encryptor[_0xb7cc('0x27')](moment()['format'](_0xb7cc('0x26')))});}else{if(moment()[_0xb7cc('0x28')](encryptor[_0xb7cc('0x29')](_0xe4d505[_0xb7cc('0x1d')]),_0xb7cc('0x2a'))>DAYS){logger['info'](_0xb7cc('0x2b'),moment()[_0xb7cc('0x9')](_0xb7cc('0x26')));return _0x3392b0['update']({'data1':_0x2f9bae,'data2':null,'license':null});}}}else{if(_0xe4d505['data1']!=_0x2f9bae){logger[_0xb7cc('0x1e')](_0xb7cc('0x23'),_0xe4d505[_0xb7cc('0x20')],_0x2f9bae);return _0x3392b0[_0xb7cc('0x1f')]({'data1':_0x2f9bae,'data2':null,'license':null});}}}return _0x3392b0;})['then'](function(_0x47d322){_0x3392b0=_0x47d322;})[_0xb7cc('0x2c')](function(_0x1965b6){logger[_0xb7cc('0x2d')](_0x1965b6['message']);})[_0xb7cc('0x2e')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x3392b0);},TIME);});}function defaultLicense(){var _0x36dcc0=hardware['getUuid']();if(_0x36dcc0){return db[_0xb7cc('0x2f')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x36dcc0}})['spread'](function(_0x3316d8,_0x3b344b){logger['info'](_0xb7cc('0x30'),_0x36dcc0);manageLicense(_0x36dcc0,_0x3316d8);})[_0xb7cc('0x2c')](function(_0x308539){logger[_0xb7cc('0x2d')](_0x308539[_0xb7cc('0x31')]);});}}exports[_0xb7cc('0x32')]=defaultLicense; \ No newline at end of file +var _0xd963=['default','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../logger','format','GET','then','catch','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','|reason|','|uuid|','|machineUuid|','|name|','|email|','email','getFirstInterface','ipAddress','openIssue','Motion\x20License\x20Alert','Alert','get','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data2','update','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s'];(function(_0x150b6b,_0x4d05dd){var _0x398415=function(_0x10553c){while(--_0x10553c){_0x150b6b['push'](_0x150b6b['shift']());}};_0x398415(++_0x4d05dd);}(_0xd963,0xa3));var _0x3d96=function(_0x371d15,_0xd98587){_0x371d15=_0x371d15-0x0;var _0x32afdf=_0xd963[_0x371d15];return _0x32afdf;};'use strict';var util=require('util');var moment=require(_0x3d96('0x0'));var rp=require(_0x3d96('0x1'));var BPromise=require(_0x3d96('0x2'));var pkginfo=require(_0x3d96('0x3'))(module,_0x3d96('0x4'));var db=require(_0x3d96('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0x3d96('0x6'))('license');var jira=require('../../api/jira/jira.controller');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(_0x2dd443){return new BPromise(function(_0x49e310,_0x20d61c){var _0x38d434=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x2dd443,module['exports'][_0x3d96('0x4')]);if(oldToken){_0x38d434=util[_0x3d96('0x7')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x2dd443,module['exports'][_0x3d96('0x4')],oldToken);}var _0x57ba62={'uri':_0x38d434,'method':_0x3d96('0x8'),'timeout':0xea60,'json':!![]};return rp(_0x57ba62)[_0x3d96('0x9')](function(_0xf79f7d){_0x49e310(_0xf79f7d);})[_0x3d96('0xa')](function(_0x1a8ec1){_0x20d61c(_0x1a8ec1);});});}function sendJiraAlert(_0x4c8bf3,_0x2ad605,_0x519928){var _0x2e54d7=_0x3d96('0xb');return db[_0x3d96('0xc')][_0x3d96('0xd')]({'where':{'role':_0x3d96('0xe')},'attributes':[_0x3d96('0xf'),'email'],'raw':!![]})['then'](function(_0x59c63d){ADMIN=_0x59c63d;_0x2e54d7+=_0x3d96('0x10')+_0x519928+'|\x0a';_0x2e54d7+=_0x3d96('0x11')+_0x4c8bf3+'|\x0a';_0x2e54d7+=_0x3d96('0x12')+_0x2ad605+'|\x0a';_0x2e54d7+=_0x3d96('0x13')+ADMIN['fullname']+'|\x0a';_0x2e54d7+=_0x3d96('0x14')+ADMIN[_0x3d96('0x15')]+'|\x0a';return _0x2e54d7;})[_0x3d96('0x9')](function(_0x4143b9){var _0x5c0086=hardware[_0x3d96('0x16')]()[_0x3d96('0x17')];return jira[_0x3d96('0x18')]({'key':'MOTLICENSE','summary':_0x3d96('0x19'),'description':_0x4143b9,'issuetype':_0x3d96('0x1a'),'oldToken':_0x4c8bf3,'newToken':_0x2ad605,'email':ADMIN[_0x3d96('0x15')],'name':ADMIN[_0x3d96('0xf')],'reason':GRAY_PERIOD_REASON,'ip':_0x5c0086});});}function manageLicense(_0x5b1115,_0x202f1b){var _0x3f1730=_0x202f1b[_0x3d96('0x1b')]({'plain':!![]});httpRequest(_0x5b1115)[_0x3d96('0x9')](function(_0x4d39ff){if(oldToken){oldToken=undefined;}if(_0x4d39ff[_0x3d96('0x1c')]){if(!_0x3f1730['license']&&_0x3f1730[_0x3d96('0x1d')]!=_0x4d39ff[_0x3d96('0x1d')]||_0x3f1730[_0x3d96('0x1d')]&&_0x3f1730['data2']){logger[_0x3d96('0x1e')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x3f1730[_0x3d96('0x1d')]&&!_0x3f1730['data2']&&_0x3f1730[_0x3d96('0x1d')]!=_0x4d39ff[_0x3d96('0x1d')]){logger[_0x3d96('0x1e')](_0x3d96('0x1f'));}if(_0x3f1730[_0x3d96('0x1d')]&&!_0x3f1730[_0x3d96('0x20')]&&_0x3f1730['license']==_0x4d39ff[_0x3d96('0x1d')]){return _0x202f1b;}return _0x202f1b[_0x3d96('0x21')]({'data1':_0x5b1115,'data2':null,'license':_0x4d39ff[_0x3d96('0x1d')]});}else{if(_0x4d39ff[_0x3d96('0x1d')]||_0x3f1730[_0x3d96('0x1d')]){if(!_0x3f1730[_0x3d96('0x20')]){if(_0x3f1730[_0x3d96('0x22')]==_0x5b1115){GRAY_PERIOD_REASON=_0x3d96('0x23');logger[_0x3d96('0x1e')](_0x3d96('0x24'));}else{GRAY_PERIOD_REASON=_0x3d96('0x25');oldToken=_0x3f1730[_0x3d96('0x22')];logger['info'](_0x3d96('0x26'),_0x3f1730[_0x3d96('0x22')],_0x5b1115);}sendJiraAlert(_0x3f1730['data1'],_0x4d39ff[_0x3d96('0x27')],GRAY_PERIOD_REASON);logger[_0x3d96('0x1e')](_0x3d96('0x28'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x3d96('0x7')](_0x3d96('0x29')));return _0x202f1b[_0x3d96('0x21')]({'data2':encryptor[_0x3d96('0x2a')](moment()[_0x3d96('0x7')](_0x3d96('0x29')))});}else{if(moment()[_0x3d96('0x2b')](encryptor[_0x3d96('0x2c')](_0x3f1730[_0x3d96('0x20')]),'days')>DAYS){logger[_0x3d96('0x1e')](_0x3d96('0x2d'),moment()[_0x3d96('0x7')](_0x3d96('0x29')));return _0x202f1b[_0x3d96('0x21')]({'data1':_0x5b1115,'data2':null,'license':null});}}}else{if(_0x3f1730[_0x3d96('0x22')]!=_0x5b1115){logger[_0x3d96('0x1e')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3f1730[_0x3d96('0x22')],_0x5b1115);return _0x202f1b[_0x3d96('0x21')]({'data1':_0x5b1115,'data2':null,'license':null});}}}return _0x202f1b;})[_0x3d96('0x9')](function(_0x411eff){_0x202f1b=_0x411eff;})[_0x3d96('0xa')](function(_0x55e3b8){logger[_0x3d96('0x2e')](_0x55e3b8[_0x3d96('0x2f')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x3d96('0x30')](),_0x202f1b);},TIME);});}function defaultLicense(){var _0x226898=hardware[_0x3d96('0x30')]();if(_0x226898){return db[_0x3d96('0x31')][_0x3d96('0x32')]({'where':{'id':0x1},'defaults':{'data1':_0x226898}})[_0x3d96('0x33')](function(_0x2b24e5,_0x16d237){logger['info'](_0x3d96('0x34'),_0x226898);manageLicense(_0x226898,_0x2b24e5);})[_0x3d96('0xa')](function(_0x2cf2a8){logger[_0x3d96('0x2e')](_0x2cf2a8[_0x3d96('0x2f')]);});}}exports[_0x3d96('0x35')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 9bebda7..08076b3 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 _0xb2ab=['find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','message','User','role','sequelize','COUNT','col','count','admin','user','telephone','users','forEach','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb2ab,0x1ef));var _0xbb2a=function(_0x101803,_0x5ee4d9){_0x101803=_0x101803-0x0;var _0x55d59c=_0xb2ab[_0x101803];return _0x55d59c;};'use strict';var util=require(_0xbb2a('0x0'));var _=require(_0xbb2a('0x1'));var moment=require(_0xbb2a('0x2'));var BPromise=require(_0xbb2a('0x3'));var hardware=require(_0xbb2a('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0xbb2a('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbb2a('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xbb2a('0x7'),'machineUuid':hardware[_0xbb2a('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbb2a('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xbb2a('0x9'),'machineUuid':hardware[_0xbb2a('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x359601){return new BPromise(function(_0x43273f,_0x238b60){return db[_0xbb2a('0xa')][_0xbb2a('0xb')](_[_0xbb2a('0xc')](_0x359601,{'raw':!![],'where':{'id':0x1}}))[_0xbb2a('0xd')](function(_0x4be9e0){return checkLicense(_0x4be9e0,null);})[_0xbb2a('0xd')](function(_0x558b74){_0x43273f(_0x558b74);return;})[_0xbb2a('0xe')](function(_0x223c85){_0x238b60(_0x223c85);});});}function checkLicense(_0x5be922,_0x3db2b0){if(!_0x5be922){demoLicense[_0xbb2a('0xf')]=_0x5be922[_0xbb2a('0x10')];return demoLicense;}try{var _0x17ddfd=_0x3db2b0||_0x5be922[_0xbb2a('0x11')];if(_[_0xbb2a('0x12')](_0x17ddfd)){throw new Error(_0xbb2a('0x13'));}var _0x31dfa7=_0x5be922[_0xbb2a('0x10')];var _0x626bf7=_0x5be922[_0xbb2a('0x14')];var _0x31f0d9=_0x31dfa7['split']('-')[0x4];var _0x45ba1c=_0x31dfa7['split']('-')[0x0];var _0x271f28=encryptor[_0xbb2a('0x15')](_0x17ddfd,util[_0xbb2a('0x16')](_0xbb2a('0x17'),_0x31f0d9,_0x31dfa7,_0x45ba1c));var _0x459aa8=JSON[_0xbb2a('0x18')](_0x271f28);_0x459aa8[_0xbb2a('0x19')]=![];_0x459aa8[_0xbb2a('0xf')]=_0x31dfa7;_0x459aa8[_0xbb2a('0x1a')]=hardware[_0xbb2a('0x8')]();if(_0x626bf7){var _0x1b919a=encryptor[_0xbb2a('0x15')](_0x626bf7);_0x459aa8[_0xbb2a('0x1b')]=_0x1b919a;_0x459aa8[_0xbb2a('0x1c')]=moment(_0x1b919a)[_0xbb2a('0x1d')](0x7,'days')['format']();_0x459aa8['grayReason']=_0x459aa8[_0xbb2a('0xf')]!=_0x459aa8['machineUuid']?'changed':'disabled';}return _0x459aa8;}catch(_0x1933bb){breakingLicense['uuid']=_0x5be922[_0xbb2a('0x10')];breakingLicense[_0xbb2a('0x1e')]=_0x1933bb[_0xbb2a('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xe5a9a2,_0x2921b6){getLicense()[_0xbb2a('0xd')](function(_0x1f57f2){return db[_0xbb2a('0x1f')]['findAll']({'attributes':[_0xbb2a('0x20'),[db[_0xbb2a('0x21')]['fn'](_0xbb2a('0x22'),db[_0xbb2a('0x21')][_0xbb2a('0x23')](_0xbb2a('0x20'))),_0xbb2a('0x24')]],'group':'role','where':{'role':{'$or':[_0xbb2a('0x25'),_0xbb2a('0x26'),_0xbb2a('0x27')]}},'raw':!![]})[_0xbb2a('0xd')](function(_0xe10277){var _0x5b366a={'user':_0x1f57f2[_0xbb2a('0x28')]||0x0,'telephone':_0x1f57f2['telephones']||0x0};_0xe10277[_0xbb2a('0x29')](function(_0x59c0a4){var _0x1c9d89=_0x59c0a4[_0xbb2a('0x20')]===_0xbb2a('0x25')?_0xbb2a('0x26'):_0x59c0a4[_0xbb2a('0x20')];_0x5b366a[_0x1c9d89]-=_0x59c0a4[_0xbb2a('0x24')];if(_0x5b366a[_0x1c9d89]<0x0)_0x5b366a[_0x1c9d89]=0x0;});_0xe5a9a2(_0x5b366a);return;});})[_0xbb2a('0xe')](function(_0x58e203){_0x2921b6(_0x58e203);});});}function checkUserLimits(_0x5301f5){return new BPromise(function(_0x1d2377,_0xc3749e){getLimits()['then'](function(_0x2a1dba){var _0x5a8ea3=_[_0xbb2a('0x2a')](_['countBy'](_0x5301f5,_0xbb2a('0x20')),['admin',_0xbb2a('0x26'),_0xbb2a('0x27')]);var _0x21a391=(_0x5a8ea3[_0xbb2a('0x25')]||0x0)+(_0x5a8ea3[_0xbb2a('0x26')]||0x0);var _0xa20baa=_0x5a8ea3[_0xbb2a('0x27')]||0x0;if(_0x21a391>_0x2a1dba[_0xbb2a('0x26')])return _0xc3749e(_0xbb2a('0x2b'));if(_0xa20baa>_0x2a1dba[_0xbb2a('0x27')])return _0xc3749e(_0xbb2a('0x2c'));return _0x1d2377();})['catch'](function(_0x4e9b50){_0xc3749e(_0x4e9b50);});});}module[_0xbb2a('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x9ed9=['sequelize','role','count','admin','telephone','telephones','forEach','catch','pick','countBy','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','getUuid','License','find','defaults','then','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','format','%s:%s:%s','demo','machineUuid','decryptString','gray','deadline','days','grayReason','changed','disabled','message'];(function(_0x283bd0,_0x4ea670){var _0x32f854=function(_0x137582){while(--_0x137582){_0x283bd0['push'](_0x283bd0['shift']());}};_0x32f854(++_0x4ea670);}(_0x9ed9,0x92));var _0x99ed=function(_0x3d456f,_0x312ccb){_0x3d456f=_0x3d456f-0x0;var _0x3c61b9=_0x9ed9[_0x3d456f];return _0x3c61b9;};'use strict';var util=require('util');var _=require(_0x99ed('0x0'));var moment=require(_0x99ed('0x1'));var BPromise=require(_0x99ed('0x2'));var hardware=require(_0x99ed('0x3'));var encryptor=require(_0x99ed('0x4'));var db=require(_0x99ed('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':'Demo\x20license','machineUuid':hardware[_0x99ed('0x6')](),'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['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2bab36){return new BPromise(function(_0x25548e,_0x4a6215){return db[_0x99ed('0x7')][_0x99ed('0x8')](_[_0x99ed('0x9')](_0x2bab36,{'raw':!![],'where':{'id':0x1}}))[_0x99ed('0xa')](function(_0x50040a){return checkLicense(_0x50040a,null);})[_0x99ed('0xa')](function(_0x1b85ac){_0x25548e(_0x1b85ac);return;})['catch'](function(_0x12eb51){_0x4a6215(_0x12eb51);});});}function checkLicense(_0x481b96,_0x128c64){if(!_0x481b96){demoLicense[_0x99ed('0xb')]=_0x481b96['data1'];return demoLicense;}try{var _0x37bc6f=_0x128c64||_0x481b96[_0x99ed('0xc')];if(_[_0x99ed('0xd')](_0x37bc6f)){throw new Error(_0x99ed('0xe'));}var _0x370977=_0x481b96[_0x99ed('0xf')];var _0x30b2b0=_0x481b96[_0x99ed('0x10')];var _0x3873cc=_0x370977[_0x99ed('0x11')]('-')[0x4];var _0x3c017f=_0x370977['split']('-')[0x0];var _0x133442=encryptor['decryptString'](_0x37bc6f,util[_0x99ed('0x12')](_0x99ed('0x13'),_0x3873cc,_0x370977,_0x3c017f));var _0x43d1f9=JSON['parse'](_0x133442);_0x43d1f9[_0x99ed('0x14')]=![];_0x43d1f9['uuid']=_0x370977;_0x43d1f9[_0x99ed('0x15')]=hardware[_0x99ed('0x6')]();if(_0x30b2b0){var _0x786009=encryptor[_0x99ed('0x16')](_0x30b2b0);_0x43d1f9[_0x99ed('0x17')]=_0x786009;_0x43d1f9[_0x99ed('0x18')]=moment(_0x786009)['add'](0x7,_0x99ed('0x19'))[_0x99ed('0x12')]();_0x43d1f9[_0x99ed('0x1a')]=_0x43d1f9[_0x99ed('0xb')]!=_0x43d1f9[_0x99ed('0x15')]?_0x99ed('0x1b'):_0x99ed('0x1c');}return _0x43d1f9;}catch(_0x37a8d0){breakingLicense[_0x99ed('0xb')]=_0x481b96[_0x99ed('0xf')];breakingLicense[_0x99ed('0x1d')]=_0x37a8d0['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x252c6b,_0x1047c4){getLicense()[_0x99ed('0xa')](function(_0x3f0246){return db['User']['findAll']({'attributes':['role',[db[_0x99ed('0x1e')]['fn']('COUNT',db[_0x99ed('0x1e')]['col'](_0x99ed('0x1f'))),_0x99ed('0x20')]],'group':'role','where':{'role':{'$or':[_0x99ed('0x21'),'user',_0x99ed('0x22')]}},'raw':!![]})[_0x99ed('0xa')](function(_0x8095a5){var _0x25d6df={'user':_0x3f0246['users']||0x0,'telephone':_0x3f0246[_0x99ed('0x23')]||0x0};_0x8095a5[_0x99ed('0x24')](function(_0x11da81){var _0x2c49a3=_0x11da81['role']==='admin'?'user':_0x11da81[_0x99ed('0x1f')];_0x25d6df[_0x2c49a3]-=_0x11da81[_0x99ed('0x20')];if(_0x25d6df[_0x2c49a3]<0x0)_0x25d6df[_0x2c49a3]=0x0;});_0x252c6b(_0x25d6df);return;});})[_0x99ed('0x25')](function(_0x1ef0e7){_0x1047c4(_0x1ef0e7);});});}function checkUserLimits(_0x3d5fbb){return new BPromise(function(_0x4f992f,_0x193776){getLimits()[_0x99ed('0xa')](function(_0x2c3454){var _0xc0938a=_[_0x99ed('0x26')](_[_0x99ed('0x27')](_0x3d5fbb,_0x99ed('0x1f')),[_0x99ed('0x21'),_0x99ed('0x28'),'telephone']);var _0x54c0a0=(_0xc0938a[_0x99ed('0x21')]||0x0)+(_0xc0938a[_0x99ed('0x28')]||0x0);var _0x157fd9=_0xc0938a[_0x99ed('0x22')]||0x0;if(_0x54c0a0>_0x2c3454['user'])return _0x193776(_0x99ed('0x29'));if(_0x157fd9>_0x2c3454[_0x99ed('0x22')])return _0x193776(_0x99ed('0x2a'));return _0x4f992f();})['catch'](function(_0x5a3bf6){_0x193776(_0x5a3bf6);});});}module[_0x99ed('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index d298039..d2657a8 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 _0xc8ce=['myappanuglar-secret','app-id','exports'];(function(_0x57eaa0,_0x32aae5){var _0x9d53d2=function(_0x3c6ccd){while(--_0x3c6ccd){_0x57eaa0['push'](_0x57eaa0['shift']());}};_0x9d53d2(++_0x32aae5);}(_0xc8ce,0x176));var _0xec8c=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0xc8ce[_0x56740a];return _0x257144;};'use strict';module[_0xec8c('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xec8c('0x1'),'GOOGLE_ID':_0xec8c('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xecbd=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x48d12f,_0x5b66db){var _0x47fadc=function(_0x408a80){while(--_0x408a80){_0x48d12f['push'](_0x48d12f['shift']());}};_0x47fadc(++_0x5b66db);}(_0xecbd,0x1a7));var _0xdecb=function(_0x530371,_0x155bd9){_0x530371=_0x530371-0x0;var _0x3d28b2=_0xecbd[_0x530371];return _0x3d28b2;};'use strict';module[_0xdecb('0x0')]={'DOMAIN':_0xdecb('0x1'),'SESSION_SECRET':_0xdecb('0x2'),'GOOGLE_ID':_0xdecb('0x3'),'GOOGLE_SECRET':_0xdecb('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 71ec3ba..fd24418 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc782=['format','[%s]\x20[%s]\x20%s\x20-\x20%s','toUpperCase','exports','transports','%s-%s','error','File','Console','env','debugLevel','moment','winston','util','/var','log','xcally','%s-%s.log','message','replace','}}}'];(function(_0xf680c2,_0x5d30d2){var _0x2baa0e=function(_0x51e5c3){while(--_0x51e5c3){_0xf680c2['push'](_0xf680c2['shift']());}};_0x2baa0e(++_0x5d30d2);}(_0xc782,0x1af));var _0x2c78=function(_0x1b3ddb,_0x190f99){_0x1b3ddb=_0x1b3ddb-0x0;var _0x3b952d=_0xc782[_0x1b3ddb];return _0x3b952d;};'use strict';var moment=require(_0x2c78('0x0'));var winston=require(_0x2c78('0x1'));var util=require(_0x2c78('0x2'));var path=require('path');var debugLevel='INFO';function filename(_0x44d25e,_0x34c0c9){return path['join'](_0x2c78('0x3'),_0x2c78('0x4'),_0x2c78('0x5'),util['format'](_0x2c78('0x6'),_0x44d25e,_0x34c0c9));}function formatter(_0x198a88,_0x2e7242){_0x2e7242['message']=_0x2e7242[_0x2c78('0x7')][_0x2c78('0x8')](/@@{/g,'{{{')[_0x2c78('0x8')](/}@@/g,_0x2c78('0x9'))[_0x2c78('0x8')](/@{/g,'{{')[_0x2c78('0x8')](/}@/g,'}}');return util[_0x2c78('0xa')](_0x2c78('0xb'),moment()[_0x2c78('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),_0x2e7242['level'][_0x2c78('0xc')](),_0x198a88,_0x2e7242[_0x2c78('0x7')]);}module[_0x2c78('0xd')]=function(_0x39ad2a){return new winston['Logger']({'transports':[new winston[(_0x2c78('0xe'))]['File']({'name':util[_0x2c78('0xa')](_0x2c78('0xf'),_0x39ad2a,'error'),'filename':filename(_0x39ad2a,_0x2c78('0x10')),'level':_0x2c78('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x7f8a3){return formatter(_0x39ad2a,_0x7f8a3);}}),new winston[(_0x2c78('0xe'))][(_0x2c78('0x11'))]({'name':util[_0x2c78('0xa')](_0x2c78('0xf'),_0x39ad2a,'info'),'filename':filename(_0x39ad2a,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x274398){return formatter(_0x39ad2a,_0x274398);}}),new winston[(_0x2c78('0xe'))][(_0x2c78('0x12'))]({'level':process[_0x2c78('0x13')][_0x2c78('0x14')]||debugLevel,'json':![],'formatter':function(_0x1c7e4b){return formatter(_0x39ad2a,_0x1c7e4b);}})]});}; \ No newline at end of file +var _0xe6d0=['%s-%s.log','replace','{{{','}}}','toUpperCase','message','exports','Logger','transports','%s-%s','error','File','info','Console','debugLevel','moment','winston','util','INFO','/var','log','xcally','format'];(function(_0x2d138b,_0x58825f){var _0x1fe5a8=function(_0x1a4f61){while(--_0x1a4f61){_0x2d138b['push'](_0x2d138b['shift']());}};_0x1fe5a8(++_0x58825f);}(_0xe6d0,0x1db));var _0x0e6d=function(_0x5b0208,_0x58666d){_0x5b0208=_0x5b0208-0x0;var _0x5800b4=_0xe6d0[_0x5b0208];return _0x5800b4;};'use strict';var moment=require(_0x0e6d('0x0'));var winston=require(_0x0e6d('0x1'));var util=require(_0x0e6d('0x2'));var path=require('path');var debugLevel=_0x0e6d('0x3');function filename(_0x287de9,_0x1d9902){return path['join'](_0x0e6d('0x4'),_0x0e6d('0x5'),_0x0e6d('0x6'),util[_0x0e6d('0x7')](_0x0e6d('0x8'),_0x287de9,_0x1d9902));}function formatter(_0x1078d5,_0x43b6de){_0x43b6de['message']=_0x43b6de['message'][_0x0e6d('0x9')](/@@{/g,_0x0e6d('0xa'))['replace'](/}@@/g,_0x0e6d('0xb'))[_0x0e6d('0x9')](/@{/g,'{{')[_0x0e6d('0x9')](/}@/g,'}}');return util[_0x0e6d('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x43b6de['level'][_0x0e6d('0xc')](),_0x1078d5,_0x43b6de[_0x0e6d('0xd')]);}module[_0x0e6d('0xe')]=function(_0x540d5f){return new winston[(_0x0e6d('0xf'))]({'transports':[new winston[(_0x0e6d('0x10'))]['File']({'name':util[_0x0e6d('0x7')](_0x0e6d('0x11'),_0x540d5f,'error'),'filename':filename(_0x540d5f,_0x0e6d('0x12')),'level':_0x0e6d('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2889d2){return formatter(_0x540d5f,_0x2889d2);}}),new winston[(_0x0e6d('0x10'))][(_0x0e6d('0x13'))]({'name':util[_0x0e6d('0x7')](_0x0e6d('0x11'),_0x540d5f,_0x0e6d('0x14')),'filename':filename(_0x540d5f,_0x0e6d('0x14')),'level':_0x0e6d('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x44b879){return formatter(_0x540d5f,_0x44b879);}}),new winston['transports'][(_0x0e6d('0x15'))]({'level':process['env'][_0x0e6d('0x16')]||debugLevel,'json':![],'formatter':function(_0x249657){return formatter(_0x540d5f,_0x249657);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 1d98b84..2e93c10 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 _0x32b3=['routing','xdr','../../services/xdr/index.js','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x5e97d7,_0xb16c6f){var _0x528559=function(_0x27b3ed){while(--_0x27b3ed){_0x5e97d7['push'](_0x5e97d7['shift']());}};_0x528559(++_0xb16c6f);}(_0x32b3,0x1c5));var _0x332b=function(_0x59f6be,_0x472a09){_0x59f6be=_0x59f6be-0x0;var _0x2aef59=_0x32b3[_0x59f6be];return _0x2aef59;};'use strict';var path=require(_0x332b('0x0'));var os=require('os');var config={'apps':[{'name':_0x332b('0x1'),'script':path[_0x332b('0x2')](__dirname,_0x332b('0x3'))},{'name':_0x332b('0x4'),'script':path[_0x332b('0x2')](__dirname,_0x332b('0x5'))},{'name':_0x332b('0x6'),'script':path[_0x332b('0x2')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x332b('0x7'),'script':path[_0x332b('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x332b('0x8'),'script':path[_0x332b('0x2')](__dirname,_0x332b('0x9'))}]};module['exports']=config; \ No newline at end of file +var _0xe0e1=['../../services/routing/index.js','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','agi','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x1ca62b,_0x599fe6){var _0x316cb4=function(_0x5108e0){while(--_0x5108e0){_0x1ca62b['push'](_0x1ca62b['shift']());}};_0x316cb4(++_0x599fe6);}(_0xe0e1,0xc3));var _0x1e0e=function(_0x3388a0,_0x4bd8f4){_0x3388a0=_0x3388a0-0x0;var _0x1ce043=_0xe0e1[_0x3388a0];return _0x1ce043;};'use strict';var path=require(_0x1e0e('0x0'));var os=require('os');var config={'apps':[{'name':_0x1e0e('0x1'),'script':path[_0x1e0e('0x2')](__dirname,_0x1e0e('0x3'))},{'name':_0x1e0e('0x4'),'script':path['join'](__dirname,'../../services/ami/index.js')},{'name':_0x1e0e('0x5'),'script':path[_0x1e0e('0x2')](__dirname,_0x1e0e('0x6'))},{'name':_0x1e0e('0x7'),'script':path[_0x1e0e('0x2')](__dirname,_0x1e0e('0x8'))},{'name':'routing','script':path[_0x1e0e('0x2')](__dirname,_0x1e0e('0x9'))},{'name':'xdr','script':path[_0x1e0e('0x2')](__dirname,_0x1e0e('0xa'))}]};module[_0x1e0e('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 9c2d518..d97608c 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 _0x3912=['saved','pm2','bluebird','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump'];(function(_0x145c3b,_0x51de15){var _0x2ba2e1=function(_0x488cd8){while(--_0x488cd8){_0x145c3b['push'](_0x145c3b['shift']());}};_0x2ba2e1(++_0x51de15);}(_0x3912,0xa9));var _0x2391=function(_0x28de14,_0x3033b6){_0x28de14=_0x28de14-0x0;var _0x16f202=_0x3912[_0x28de14];return _0x16f202;};'use strict';var pm2=require(_0x2391('0x0'));var BPromise=require(_0x2391('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x5b719f,_0x3837ce){return pm2[_0x2391('0x2')](function(_0x186bf8){if(_0x186bf8){return _0x3837ce(_0x186bf8);}return _0x5b719f(_0x2391('0x3'));});});};exports[_0x2391('0x4')]=function(_0x22e7fd){return connect()[_0x2391('0x5')](function(){return new BPromise(function(_0xd5a969,_0x79b197){return pm2[_0x2391('0x4')](_0x22e7fd,function(_0x10cf7f,_0x463e84){if(_0x10cf7f){return _0x79b197(_0x10cf7f);}pm2[_0x2391('0x6')]();return _0xd5a969(_0x463e84);});});});};exports[_0x2391('0x7')]=function(_0x8d7719){return connect()[_0x2391('0x5')](function(){return new BPromise(function(_0x9a061,_0x231b20){return pm2[_0x2391('0x7')](_0x8d7719,function(_0x237cd8,_0x4974a9){if(_0x237cd8){return _0x231b20(_0x237cd8);}pm2[_0x2391('0x6')]();return _0x9a061(_0x4974a9);});});});};exports[_0x2391('0x8')]=function(_0x1795c6){return connect()[_0x2391('0x5')](function(){return new BPromise(function(_0x10b4f4,_0x42bdcf){return pm2[_0x2391('0x8')](_0x1795c6,function(_0x1cbc31,_0x264296){if(_0x1cbc31){return _0x42bdcf(_0x1cbc31);}pm2['disconnect']();return _0x10b4f4(_0x264296);});});});};exports[_0x2391('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x158884,_0x45fd64){return pm2[_0x2391('0x9')](function(_0x1d3d24,_0x5f27bd){if(_0x1d3d24){return _0x45fd64(_0x1d3d24);}pm2['disconnect']();return _0x158884(_0x5f27bd);});});});};exports[_0x2391('0xa')]=function(_0x1770ff){return connect()['then'](function(){return new BPromise(function(_0x2ff9ed,_0xe46b89){return pm2['describe'](_0x1770ff,function(_0x28ca95,_0x2e870f){if(_0x28ca95){return _0xe46b89(_0x28ca95);}pm2['disconnect']();return _0x2ff9ed(_0x2e870f);});});});};exports['delete']=function(_0x3143f){return connect()[_0x2391('0x5')](function(){return new BPromise(function(_0xb47893,_0x52e5a6){return pm2[_0x2391('0xb')](_0x3143f,function(_0x588557,_0x3af205){if(_0x588557){return _0x52e5a6(_0x588557);}pm2[_0x2391('0x6')]();return _0xb47893(_0x3af205);});});});};exports[_0x2391('0xc')]=function(){return connect()[_0x2391('0x5')](function(){return new BPromise(function(_0x55640b,_0x3c6b17){return pm2['dump'](function(_0x43ee25){if(_0x43ee25){return _0x3c6b17(_0x43ee25);}return _0x55640b(_0x2391('0xd'));});});});}; \ No newline at end of file +var _0x43a2=['connect','connected','start','then','stop','restart','disconnect','list','describe','delete','dump','saved','bluebird','./config'];(function(_0x1fa387,_0x40e45f){var _0x2f0101=function(_0x55e833){while(--_0x55e833){_0x1fa387['push'](_0x1fa387['shift']());}};_0x2f0101(++_0x40e45f);}(_0x43a2,0xd0));var _0x243a=function(_0x1dfdaf,_0x5df9d7){_0x1dfdaf=_0x1dfdaf-0x0;var _0x1b81c7=_0x43a2[_0x1dfdaf];return _0x1b81c7;};'use strict';var pm2=require('pm2');var BPromise=require(_0x243a('0x0'));var config=require(_0x243a('0x1'));function connect(){return new BPromise(function(_0x9f58d,_0x559c6f){return pm2[_0x243a('0x2')](function(_0x48fe2f){if(_0x48fe2f){return _0x559c6f(_0x48fe2f);}return _0x9f58d(_0x243a('0x3'));});});};exports[_0x243a('0x4')]=function(_0x3da3b5){return connect()[_0x243a('0x5')](function(){return new BPromise(function(_0x58a35a,_0x1e0a5f){return pm2['start'](_0x3da3b5,function(_0x5c9192,_0x5e151a){if(_0x5c9192){return _0x1e0a5f(_0x5c9192);}pm2['disconnect']();return _0x58a35a(_0x5e151a);});});});};exports['stop']=function(_0x339c47){return connect()[_0x243a('0x5')](function(){return new BPromise(function(_0xe7ee78,_0x28a88a){return pm2[_0x243a('0x6')](_0x339c47,function(_0x41a114,_0x5a1f51){if(_0x41a114){return _0x28a88a(_0x41a114);}pm2['disconnect']();return _0xe7ee78(_0x5a1f51);});});});};exports[_0x243a('0x7')]=function(_0x2e675c){return connect()[_0x243a('0x5')](function(){return new BPromise(function(_0x372eb8,_0x92d6a7){return pm2[_0x243a('0x7')](_0x2e675c,function(_0x2c9b5f,_0x31155f){if(_0x2c9b5f){return _0x92d6a7(_0x2c9b5f);}pm2[_0x243a('0x8')]();return _0x372eb8(_0x31155f);});});});};exports[_0x243a('0x9')]=function(){return connect()[_0x243a('0x5')](function(){return new BPromise(function(_0x2879aa,_0x13b5a1){return pm2[_0x243a('0x9')](function(_0x105551,_0x52caa8){if(_0x105551){return _0x13b5a1(_0x105551);}pm2[_0x243a('0x8')]();return _0x2879aa(_0x52caa8);});});});};exports[_0x243a('0xa')]=function(_0x37201d){return connect()['then'](function(){return new BPromise(function(_0xacaa10,_0x420aa0){return pm2[_0x243a('0xa')](_0x37201d,function(_0x3965e8,_0x505bf2){if(_0x3965e8){return _0x420aa0(_0x3965e8);}pm2['disconnect']();return _0xacaa10(_0x505bf2);});});});};exports[_0x243a('0xb')]=function(_0x44a110){return connect()[_0x243a('0x5')](function(){return new BPromise(function(_0x563201,_0x149b21){return pm2[_0x243a('0xb')](_0x44a110,function(_0xf4cdb8,_0x274d13){if(_0xf4cdb8){return _0x149b21(_0xf4cdb8);}pm2[_0x243a('0x8')]();return _0x563201(_0x274d13);});});});};exports[_0x243a('0xc')]=function(){return connect()[_0x243a('0x5')](function(){return new BPromise(function(_0x3b4d17,_0x2dbefd){return pm2[_0x243a('0xc')](function(_0x30e4f5){if(_0x30e4f5){return _0x2dbefd(_0x30e4f5);}return _0x3b4d17(_0x243a('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 970d6d3..754ae4b 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 _0x14bc=['defaults','localhost','socket.io-emitter','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','length','info','join','update','system','timeout','format','emit','chatInteraction:update','catch','inspect','start','moment','ioredis','util','../../config/environment','../logger','schedule','redis'];(function(_0x90d794,_0xf3931b){var _0x1b05a5=function(_0x169299){while(--_0x169299){_0x90d794['push'](_0x90d794['shift']());}};_0x1b05a5(++_0xf3931b);}(_0x14bc,0x19d));var _0xc14b=function(_0x405c7e,_0x264502){_0x405c7e=_0x405c7e-0x0;var _0x3fa7d9=_0x14bc[_0x405c7e];return _0x3fa7d9;};'use strict';var _=require('lodash');var moment=require(_0xc14b('0x0'));var Redis=require(_0xc14b('0x1'));var util=require(_0xc14b('0x2'));var config=require(_0xc14b('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xc14b('0x4'))(_0xc14b('0x5'));config[_0xc14b('0x6')]=_[_0xc14b('0x7')](config['redis'],{'host':_0xc14b('0x8'),'port':0x18eb});var io=require(_0xc14b('0x9'))(new Redis(config[_0xc14b('0x6')]));function closeInteractions(){var _0x5e361a=0x0;var _0xf44f69=[];return db['Setting'][_0xc14b('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xc14b('0xb')](function(_0x4afdbd){_0x5e361a=_0x4afdbd[_0xc14b('0xc')];if(_0x5e361a){return db[_0xc14b('0xd')][_0xc14b('0xe')]({'raw':!![],'attributes':['id',_0xc14b('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x4afdbd['chatTimeout'],'minutes')}}});}else{return[];}})[_0xc14b('0xb')](function(_0x3f0020){if(_0x3f0020&&_0x3f0020[_0xc14b('0x10')]){_0xf44f69=_['map'](_0x3f0020||[],'id');logger[_0xc14b('0x11')]('[CHAT]\x20Interactions\x20to\x20close:',_0xf44f69[_0xc14b('0x12')]());return db['ChatInteraction'][_0xc14b('0x13')]({'closeReason':_0xc14b('0x14'),'disposition':_0xc14b('0x15'),'closed':!![],'closedAt':moment()[_0xc14b('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xf44f69}});}})[_0xc14b('0xb')](function(){if(_0xf44f69&&_0xf44f69[_0xc14b('0x10')]){logger[_0xc14b('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0xf44f69[_0xc14b('0x12')]());for(var _0x14e368=0x0;_0x14e368<_0xf44f69[_0xc14b('0x10')];_0x14e368++){io[_0xc14b('0x17')](_0xc14b('0x18'),{'id':_0xf44f69[_0x14e368],'closed':!![]});}}})[_0xc14b('0x19')](function(_0xca1581){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0xca1581?util[_0xc14b('0x1a')](_0xca1581,{'showHidden':![],'depth':null}):'');});}exports[_0xc14b('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9da6=['system','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','findAll','lastMsgAt','subtract','then','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update'];(function(_0x5341d6,_0x40ce28){var _0x5719b4=function(_0x11bb53){while(--_0x11bb53){_0x5341d6['push'](_0x5341d6['shift']());}};_0x5719b4(++_0x40ce28);}(_0x9da6,0x18d));var _0x69da=function(_0x1dedde,_0x575a81){_0x1dedde=_0x1dedde-0x0;var _0x3290af=_0x9da6[_0x1dedde];return _0x3290af;};'use strict';var _=require(_0x69da('0x0'));var moment=require(_0x69da('0x1'));var Redis=require(_0x69da('0x2'));var util=require(_0x69da('0x3'));var config=require(_0x69da('0x4'));var db=require(_0x69da('0x5'))['db'];var logger=require(_0x69da('0x6'))(_0x69da('0x7'));config[_0x69da('0x8')]=_[_0x69da('0x9')](config[_0x69da('0x8')],{'host':_0x69da('0xa'),'port':0x18eb});var io=require(_0x69da('0xb'))(new Redis(config['redis']));function closeInteractions(){var _0x4ed2a5=0x0;var _0x51a0cf=[];return db[_0x69da('0xc')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x4bc9f0){_0x4ed2a5=_0x4bc9f0[_0x69da('0xd')];if(_0x4ed2a5){return db['ChatInteraction'][_0x69da('0xe')]({'raw':!![],'attributes':['id',_0x69da('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x69da('0x10')](_0x4bc9f0['chatTimeout'],'minutes')}}});}else{return[];}})[_0x69da('0x11')](function(_0x19e323){if(_0x19e323&&_0x19e323['length']){_0x51a0cf=_[_0x69da('0x12')](_0x19e323||[],'id');logger[_0x69da('0x13')](_0x69da('0x14'),_0x51a0cf[_0x69da('0x15')]());return db['ChatInteraction'][_0x69da('0x16')]({'closeReason':_0x69da('0x17'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x69da('0x18')](_0x69da('0x19'))},{'where':{'id':_0x51a0cf}});}})[_0x69da('0x11')](function(){if(_0x51a0cf&&_0x51a0cf[_0x69da('0x1a')]){logger['info'](_0x69da('0x1b'),_0x51a0cf['join']());for(var _0x3b8429=0x0;_0x3b8429<_0x51a0cf['length'];_0x3b8429++){io[_0x69da('0x1c')](_0x69da('0x1d'),{'id':_0x51a0cf[_0x3b8429],'closed':!![]});}}})[_0x69da('0x1e')](function(_0x456f0e){logger[_0x69da('0x1f')](_0x69da('0x20'),_0x456f0e?util[_0x69da('0x21')](_0x456f0e,{'showHidden':![],'depth':null}):'');});}exports[_0x69da('0x22')]=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 6020071..800c4d4 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 _0x0e8f=['active','isBetween','startAt','add','start','stop','stop\x20cron','update','run','path','lodash','moment','cron-job-manager','jayson/promise','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','join','../../files/reports','%s.%s','basename','existsSync','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','map','toString','keyBy','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x0e8f,0x66));var _0xf0e8=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x0e8f[_0xa6cc5c];return _0x44803d;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xf0e8('0x0'));var _=require(_0xf0e8('0x1'));var moment=require(_0xf0e8('0x2'));var CronJobManager=require(_0xf0e8('0x3'));var jayson=require(_0xf0e8('0x4'));var BPromise=require('bluebird');var logger=require('../logger')(_0xf0e8('0x5'));var db=require(_0xf0e8('0x6'))['db'];var analyticCustomReportController=require(_0xf0e8('0x7'));var analyticDefaultReportController=require(_0xf0e8('0x8'));var client=jayson['client'][_0xf0e8('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1abfad,_0x3e7577){return function(){logger[_0xf0e8('0xa')](_0xf0e8('0xb'),_0x1abfad[_0xf0e8('0xc')]);var _0x34eb40=!![];var _0x2a7af4={'tls':{'rejectUnauthorized':![]}};if(_0x1abfad[_0xf0e8('0xd')][_0xf0e8('0xe')][_0xf0e8('0xf')]){_0x2a7af4[_0xf0e8('0xf')]=_0x1abfad[_0xf0e8('0xd')][_0xf0e8('0xe')][_0xf0e8('0xf')];}else{_0x2a7af4[_0xf0e8('0x10')]=_0x1abfad[_0xf0e8('0xd')][_0xf0e8('0xe')][_0xf0e8('0x10')];_0x2a7af4[_0xf0e8('0x11')]=_0x1abfad[_0xf0e8('0xd')]['Smtp'][_0xf0e8('0x11')];_0x2a7af4[_0xf0e8('0x12')]=_0x1abfad[_0xf0e8('0xd')][_0xf0e8('0xe')]['secure'];}if(_0x1abfad[_0xf0e8('0xd')][_0xf0e8('0xe')][_0xf0e8('0x13')]){_0x2a7af4[_0xf0e8('0x14')]={'user':_0x1abfad[_0xf0e8('0xd')][_0xf0e8('0xe')][_0xf0e8('0x15')],'pass':_0x1abfad[_0xf0e8('0xd')]['Smtp'][_0xf0e8('0x16')]};}var _0x11f23e={'account':_0x2a7af4,'message':{'from':util[_0xf0e8('0x17')](_0xf0e8('0x18'),_0x1abfad[_0xf0e8('0xd')]['name'],_0x1abfad['MailAccount']['email']||_0x1abfad[_0xf0e8('0xd')][_0xf0e8('0xe')][_0xf0e8('0x15')]),'to':_0x1abfad[_0xf0e8('0xc')],'cc':_0x1abfad['cc'],'bcc':_0x1abfad[_0xf0e8('0x19')],'subject':util[_0xf0e8('0x17')](_0xf0e8('0x1a'),_0x3e7577[_0xf0e8('0x1b')],_0x1abfad['subtractNumber'],_0x1abfad[_0xf0e8('0x1c')])}};var _0xc4e05e=path[_0xf0e8('0x1d')](__dirname,_0xf0e8('0x1e'));var _0x290fab=_0x3e7577['savename'];var _0x19619d=util['format'](_0xf0e8('0x1f'),path[_0xf0e8('0x20')](_0x3e7577['savename'],path['extname'](_0x3e7577['savename'])),'zip');var _0x422a8d=path[_0xf0e8('0x1d')](_0xc4e05e,_0x290fab);var _0x510018=path[_0xf0e8('0x1d')](_0xc4e05e,_0x19619d);if(fs[_0xf0e8('0x21')](_0x422a8d)){_0x3e7577[_0xf0e8('0x22')]='Sent';_0x11f23e[_0xf0e8('0x23')][_0xf0e8('0x24')]=[{'filename':_0x290fab,'path':_0x422a8d}];_0x11f23e['message'][_0xf0e8('0x25')]=util['format'](_0xf0e8('0x26'),JSON[_0xf0e8('0x27')](_0x3e7577,null,0x2));}else if(fs[_0xf0e8('0x21')](_0x510018)){_0x3e7577[_0xf0e8('0x22')]=_0xf0e8('0x28');_0x11f23e[_0xf0e8('0x23')][_0xf0e8('0x24')]=[{'filename':_0x19619d,'path':_0x510018}];}else{_0x11f23e[_0xf0e8('0x23')]['text']=_0xf0e8('0x29');if(!_0x1abfad[_0xf0e8('0x2a')]){_0x34eb40=![];logger['info'](_0xf0e8('0x2b'));}}if(_0x34eb40){return client[_0xf0e8('0x2c')](_0xf0e8('0x2d'),_0x11f23e)[_0xf0e8('0x2e')](function(_0x206dc8){if(_0x206dc8['error']){return logger[_0xf0e8('0x2f')](_0xf0e8('0x30'),JSON[_0xf0e8('0x27')](_0x206dc8));}return logger['info'](_0xf0e8('0x31'));})[_0xf0e8('0x32')](function(_0x1ebc87){return logger['error']('error\x20mail',JSON[_0xf0e8('0x27')](_0x1ebc87));});}};}function handleError(){return function(_0x248582){return logger['error'](JSON[_0xf0e8('0x27')](_0x248582));};}function handleResult(_0x2cd15d){return function(_0x267aa5){logger[_0xf0e8('0xa')](_0xf0e8('0x33'),JSON[_0xf0e8('0x27')](_0x267aa5));if(_0x2cd15d[_0xf0e8('0xd')]&&_0x2cd15d[_0xf0e8('0xd')][_0xf0e8('0xe')]&&!_[_0xf0e8('0x34')](_0x2cd15d[_0xf0e8('0xc')])){setTimeout(handleSendEmail(_0x2cd15d,_0x267aa5),0x3c*0x3e8);}};}function handleJob(_0x4981a0){return function(){try{if(_[_0xf0e8('0x34')](_0x4981a0[_0xf0e8('0x35')])){return logger[_0xf0e8('0xa')](_0xf0e8('0x36'));}if(_['isNil'](_0x4981a0['subtractUnit'])){return logger[_0xf0e8('0xa')](_0xf0e8('0x37'));}var _0x3c66f3={'startDate':moment()['subtract'](_0x4981a0['subtractNumber'],_0x4981a0[_0xf0e8('0x1c')])['format'](_0xf0e8('0x38')),'endDate':moment()[_0xf0e8('0x17')](_0xf0e8('0x38')),'type':_0xf0e8('0x39'),'output':_0x4981a0[_0xf0e8('0x3a')],'name':_0x4981a0[_0xf0e8('0x1b')]};if(!_[_0xf0e8('0x34')](_0x4981a0[_0xf0e8('0x3b')])){logger[_0xf0e8('0xa')](_0xf0e8('0x3c'),_0x4981a0[_0xf0e8('0x3b')]);return analyticDefaultReportController[_0xf0e8('0x3d')]({'id':_0x4981a0['DefaultReportId']},_0x3c66f3)[_0xf0e8('0x2e')](handleResult(_0x4981a0))[_0xf0e8('0x32')](handleError());}if(!_[_0xf0e8('0x34')](_0x4981a0[_0xf0e8('0x3e')])){logger['info'](_0xf0e8('0x3f'),_0x4981a0['CustomReportId']);return analyticCustomReportController[_0xf0e8('0x3d')]({'id':_0x4981a0[_0xf0e8('0x3e')]},_0x3c66f3)[_0xf0e8('0x2e')](handleResult(_0x4981a0))['catch'](handleError());}}catch(_0x783fe9){logger[_0xf0e8('0x2f')](JSON[_0xf0e8('0x27')](_0x783fe9));}return logger['info'](_0xf0e8('0x40'));};}function getJobs(_0x46ea95){var _0x1b4388={};if(_0x46ea95){_0x1b4388['id']=_0x46ea95;}return db[_0xf0e8('0x41')][_0xf0e8('0x42')]({'where':_0x1b4388,'include':[{'model':db[_0xf0e8('0xd')],'attributes':['id',_0xf0e8('0x1b'),'email'],'include':[{'model':db[_0xf0e8('0x43')],'as':_0xf0e8('0xe')}]}]})[_0xf0e8('0x2e')](function(_0x2961a4){var _0xbbea66=_[_0xf0e8('0x44')](manager['jobs']);var _0x9439b6=_[_0xf0e8('0x45')](_0x2961a4,function(_0xba145a){return _0xba145a['id'][_0xf0e8('0x46')]();});var _0x454d14=_[_0xf0e8('0x47')](_0x2961a4,function(_0x4f633a){return _0x4f633a['id'][_0xf0e8('0x46')]();});var _0x622467=_0x46ea95?_0x9439b6:_[_0xf0e8('0x48')](_0x9439b6,_0xbbea66);var _0x27ebba=_[_0xf0e8('0x49')](_0x9439b6,_0xbbea66);var _0x4742f9=_['difference'](_0xbbea66,_0x9439b6);var _0x16a208;var _0x706b42;for(_0x16a208=0x0;_0x16a208<_0x4742f9[_0xf0e8('0x4a')]&&!_0x46ea95;_0x16a208+=0x1){_0x706b42=_0x4742f9[_0x16a208]['toString']();if(manager[_0xf0e8('0x4b')](_0x706b42)){manager['stop'](_0x706b42);manager[_0xf0e8('0x4c')](_0x706b42);logger[_0xf0e8('0xa')](_0xf0e8('0x4d'),_0x706b42);}}logger[_0xf0e8('0xa')](_0xf0e8('0x4e'),JSON[_0xf0e8('0x27')](_0x622467));for(_0x16a208=0x0;_0x16a208<_0x622467[_0xf0e8('0x4a')];_0x16a208+=0x1){_0x706b42=_0x622467[_0x16a208][_0xf0e8('0x46')]();logger['info'](_0xf0e8('0x4f'),_0x706b42);if(_0x46ea95){logger[_0xf0e8('0xa')](_0xf0e8('0x50'),_0x46ea95);logger[_0xf0e8('0xa')](JSON[_0xf0e8('0x27')](_0x454d14[_0x706b42]));BPromise[_0xf0e8('0x51')]()['then'](handleJob(_0x454d14[_0x706b42]));logger['info'](_0xf0e8('0x52'),_0x454d14[_0x706b42][_0xf0e8('0x1b')],_0x454d14[_0x706b42][_0xf0e8('0x53')]);}else if(_0x454d14[_0x706b42][_0xf0e8('0x53')]&&_0x454d14[_0x706b42][_0xf0e8('0x54')]&&moment()[_0xf0e8('0x55')](_0x454d14[_0x706b42][_0xf0e8('0x56')],_0x454d14[_0x706b42]['endAt'])){manager[_0xf0e8('0x57')](_0x706b42,_0x454d14[_0x706b42][_0xf0e8('0x53')],handleJob(_0x454d14[_0x706b42]));manager[_0xf0e8('0x58')](_0x706b42);logger[_0xf0e8('0xa')]('add\x20cron',_0x454d14[_0x706b42][_0xf0e8('0x1b')],_0x454d14[_0x706b42][_0xf0e8('0x53')]);}else if(manager[_0xf0e8('0x4b')](_0x706b42)){manager[_0xf0e8('0x59')](_0x706b42);manager[_0xf0e8('0x4c')](_0x706b42);logger[_0xf0e8('0xa')](_0xf0e8('0x5a'),_0x454d14[_0x706b42][_0xf0e8('0x1b')],_0x454d14[_0x706b42]['cron']);}}for(_0x16a208=0x0,_0x706b42;_0x16a208<_0x27ebba[_0xf0e8('0x4a')]&&!_0x46ea95;_0x16a208+=0x1){_0x706b42=_0x27ebba[_0x16a208][_0xf0e8('0x46')]();if(manager[_0xf0e8('0x4b')](_0x706b42)){if(_0x454d14[_0x706b42][_0xf0e8('0x53')]&&_0x454d14[_0x706b42]['active']&&moment()['isBetween'](_0x454d14[_0x706b42][_0xf0e8('0x56')],_0x454d14[_0x706b42]['endAt'])){manager[_0xf0e8('0x5b')](_0x706b42,_0x454d14[_0x706b42][_0xf0e8('0x53')],handleJob(_0x454d14[_0x706b42]));logger[_0xf0e8('0xa')]('update\x20cron',_0x454d14[_0x706b42][_0xf0e8('0x1b')],_0x454d14[_0x706b42][_0xf0e8('0x53')]);}else{manager[_0xf0e8('0x59')](_0x706b42);manager[_0xf0e8('0x4c')](_0x706b42);logger['info'](_0xf0e8('0x5a'),_0x454d14[_0x706b42][_0xf0e8('0x1b')],_0x454d14[_0x706b42][_0xf0e8('0x53')]);}}}})[_0xf0e8('0x32')](function(_0x272ead){logger[_0xf0e8('0x2f')](JSON['stringify'](_0x272ead));});}exports[_0xf0e8('0x5c')]=function(_0x4744af){return getJobs(_0x4744af);};exports[_0xf0e8('0x58')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xca9c=['add','start','add\x20cron','deleteJob','stop\x20cron','update','catch','path','lodash','moment','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','email','service','MailAccount','Smtp','host','port','secure','authentication','auth','user','name','bcc','format','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','keyBy','toString','intersection','difference','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt'];(function(_0x221053,_0x3bd47d){var _0x1e49fc=function(_0x52f31f){while(--_0x52f31f){_0x221053['push'](_0x221053['shift']());}};_0x1e49fc(++_0x3bd47d);}(_0xca9c,0x10f));var _0xcca9=function(_0x420c6b,_0x5b0c40){_0x420c6b=_0x420c6b-0x0;var _0x3d3080=_0xca9c[_0x420c6b];return _0x3d3080;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xcca9('0x0'));var _=require(_0xcca9('0x1'));var moment=require(_0xcca9('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xcca9('0x3'));var BPromise=require(_0xcca9('0x4'));var logger=require('../logger')(_0xcca9('0x5'));var db=require(_0xcca9('0x6'))['db'];var analyticCustomReportController=require(_0xcca9('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xcca9('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xa0c212,_0x372033){return function(){logger['info'](_0xcca9('0x9'),_0xa0c212[_0xcca9('0xa')]);var _0x15d6e2=!![];var _0x4a2af2={'tls':{'rejectUnauthorized':![]}};if(_0xa0c212['MailAccount']['Smtp']['service']){_0x4a2af2[_0xcca9('0xb')]=_0xa0c212[_0xcca9('0xc')][_0xcca9('0xd')]['service'];}else{_0x4a2af2[_0xcca9('0xe')]=_0xa0c212['MailAccount'][_0xcca9('0xd')][_0xcca9('0xe')];_0x4a2af2[_0xcca9('0xf')]=_0xa0c212[_0xcca9('0xc')][_0xcca9('0xd')][_0xcca9('0xf')];_0x4a2af2[_0xcca9('0x10')]=_0xa0c212[_0xcca9('0xc')]['Smtp']['secure'];}if(_0xa0c212[_0xcca9('0xc')][_0xcca9('0xd')][_0xcca9('0x11')]){_0x4a2af2[_0xcca9('0x12')]={'user':_0xa0c212[_0xcca9('0xc')]['Smtp'][_0xcca9('0x13')],'pass':_0xa0c212[_0xcca9('0xc')][_0xcca9('0xd')]['pass']};}var _0x7f5e87={'account':_0x4a2af2,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0xa0c212[_0xcca9('0xc')][_0xcca9('0x14')],_0xa0c212['MailAccount'][_0xcca9('0xa')]||_0xa0c212[_0xcca9('0xc')][_0xcca9('0xd')][_0xcca9('0x13')]),'to':_0xa0c212[_0xcca9('0xa')],'cc':_0xa0c212['cc'],'bcc':_0xa0c212[_0xcca9('0x15')],'subject':util[_0xcca9('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x372033['name'],_0xa0c212[_0xcca9('0x17')],_0xa0c212[_0xcca9('0x18')])}};var _0x847a9=path[_0xcca9('0x19')](__dirname,_0xcca9('0x1a'));var _0x52b332=_0x372033[_0xcca9('0x1b')];var _0x5390d2=util[_0xcca9('0x16')](_0xcca9('0x1c'),path[_0xcca9('0x1d')](_0x372033['savename'],path[_0xcca9('0x1e')](_0x372033[_0xcca9('0x1b')])),_0xcca9('0x1f'));var _0xe6d950=path[_0xcca9('0x19')](_0x847a9,_0x52b332);var _0x83cc3b=path[_0xcca9('0x19')](_0x847a9,_0x5390d2);if(fs[_0xcca9('0x20')](_0xe6d950)){_0x372033[_0xcca9('0x21')]='Sent';_0x7f5e87[_0xcca9('0x22')][_0xcca9('0x23')]=[{'filename':_0x52b332,'path':_0xe6d950}];_0x7f5e87['message'][_0xcca9('0x24')]=util[_0xcca9('0x16')](_0xcca9('0x25'),JSON[_0xcca9('0x26')](_0x372033,null,0x2));}else if(fs[_0xcca9('0x20')](_0x83cc3b)){_0x372033['status']='Sent';_0x7f5e87['message']['attachments']=[{'filename':_0x5390d2,'path':_0x83cc3b}];}else{_0x7f5e87[_0xcca9('0x22')][_0xcca9('0x24')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xa0c212[_0xcca9('0x27')]){_0x15d6e2=![];logger[_0xcca9('0x28')](_0xcca9('0x29'));}}if(_0x15d6e2){return client[_0xcca9('0x2a')]('SendMail',_0x7f5e87)[_0xcca9('0x2b')](function(_0x2d3c9d){if(_0x2d3c9d[_0xcca9('0x2c')]){return logger[_0xcca9('0x2c')](_0xcca9('0x2d'),JSON[_0xcca9('0x26')](_0x2d3c9d));}return logger[_0xcca9('0x28')]('email\x20sent');})['catch'](function(_0x496632){return logger[_0xcca9('0x2c')](_0xcca9('0x2d'),JSON[_0xcca9('0x26')](_0x496632));});}};}function handleError(){return function(_0x41ad7b){return logger['error'](JSON[_0xcca9('0x26')](_0x41ad7b));};}function handleResult(_0x22bd3e){return function(_0x2323fc){logger[_0xcca9('0x28')](_0xcca9('0x2e'),JSON[_0xcca9('0x26')](_0x2323fc));if(_0x22bd3e['MailAccount']&&_0x22bd3e['MailAccount']['Smtp']&&!_[_0xcca9('0x2f')](_0x22bd3e[_0xcca9('0xa')])){setTimeout(handleSendEmail(_0x22bd3e,_0x2323fc),0x3c*0x3e8);}};}function handleJob(_0x1009c5){return function(){try{if(_['isNil'](_0x1009c5[_0xcca9('0x17')])){return logger[_0xcca9('0x28')](_0xcca9('0x30'));}if(_['isNil'](_0x1009c5[_0xcca9('0x18')])){return logger[_0xcca9('0x28')](_0xcca9('0x31'));}var _0x166fa4={'startDate':moment()[_0xcca9('0x32')](_0x1009c5[_0xcca9('0x17')],_0x1009c5[_0xcca9('0x18')])['format'](_0xcca9('0x33')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x1009c5['output'],'name':_0x1009c5[_0xcca9('0x14')]};if(!_['isNil'](_0x1009c5['DefaultReportId'])){logger['info'](_0xcca9('0x34'),_0x1009c5['DefaultReportId']);return analyticDefaultReportController[_0xcca9('0x35')]({'id':_0x1009c5[_0xcca9('0x36')]},_0x166fa4)['then'](handleResult(_0x1009c5))['catch'](handleError());}if(!_['isNil'](_0x1009c5[_0xcca9('0x37')])){logger[_0xcca9('0x28')](_0xcca9('0x38'),_0x1009c5[_0xcca9('0x37')]);return analyticCustomReportController['runReport']({'id':_0x1009c5[_0xcca9('0x37')]},_0x166fa4)['then'](handleResult(_0x1009c5))['catch'](handleError());}}catch(_0x4dcdd1){logger[_0xcca9('0x2c')](JSON[_0xcca9('0x26')](_0x4dcdd1));}return logger[_0xcca9('0x28')](_0xcca9('0x39'));};}function getJobs(_0x1dec32){var _0x571a28={};if(_0x1dec32){_0x571a28['id']=_0x1dec32;}return db[_0xcca9('0x3a')][_0xcca9('0x3b')]({'where':_0x571a28,'include':[{'model':db[_0xcca9('0xc')],'attributes':['id',_0xcca9('0x14'),_0xcca9('0xa')],'include':[{'model':db[_0xcca9('0x3c')],'as':'Smtp'}]}]})['then'](function(_0x237a96){var _0x4a62de=_['keys'](manager[_0xcca9('0x3d')]);var _0x18457e=_[_0xcca9('0x3e')](_0x237a96,function(_0x5c0ed7){return _0x5c0ed7['id']['toString']();});var _0x2b00f0=_[_0xcca9('0x3f')](_0x237a96,function(_0x36b7ab){return _0x36b7ab['id'][_0xcca9('0x40')]();});var _0x47aca0=_0x1dec32?_0x18457e:_['difference'](_0x18457e,_0x4a62de);var _0x85f1b4=_[_0xcca9('0x41')](_0x18457e,_0x4a62de);var _0x35b85c=_[_0xcca9('0x42')](_0x4a62de,_0x18457e);var _0x5dbb7e;var _0x57dcae;for(_0x5dbb7e=0x0;_0x5dbb7e<_0x35b85c[_0xcca9('0x43')]&&!_0x1dec32;_0x5dbb7e+=0x1){_0x57dcae=_0x35b85c[_0x5dbb7e][_0xcca9('0x40')]();if(manager[_0xcca9('0x44')](_0x57dcae)){manager[_0xcca9('0x45')](_0x57dcae);manager['deleteJob'](_0x57dcae);logger[_0xcca9('0x28')](_0xcca9('0x46'),_0x57dcae);}}logger['info'](_0xcca9('0x47'),JSON[_0xcca9('0x26')](_0x47aca0));for(_0x5dbb7e=0x0;_0x5dbb7e<_0x47aca0['length'];_0x5dbb7e+=0x1){_0x57dcae=_0x47aca0[_0x5dbb7e][_0xcca9('0x40')]();logger['info'](_0xcca9('0x48'),_0x57dcae);if(_0x1dec32){logger[_0xcca9('0x28')](_0xcca9('0x49'),_0x1dec32);logger[_0xcca9('0x28')](JSON[_0xcca9('0x26')](_0x2b00f0[_0x57dcae]));BPromise[_0xcca9('0x4a')]()[_0xcca9('0x2b')](handleJob(_0x2b00f0[_0x57dcae]));logger[_0xcca9('0x28')](_0xcca9('0x4b'),_0x2b00f0[_0x57dcae]['name'],_0x2b00f0[_0x57dcae][_0xcca9('0x4c')]);}else if(_0x2b00f0[_0x57dcae][_0xcca9('0x4c')]&&_0x2b00f0[_0x57dcae][_0xcca9('0x4d')]&&moment()[_0xcca9('0x4e')](_0x2b00f0[_0x57dcae][_0xcca9('0x4f')],_0x2b00f0[_0x57dcae][_0xcca9('0x50')])){manager[_0xcca9('0x51')](_0x57dcae,_0x2b00f0[_0x57dcae][_0xcca9('0x4c')],handleJob(_0x2b00f0[_0x57dcae]));manager[_0xcca9('0x52')](_0x57dcae);logger[_0xcca9('0x28')](_0xcca9('0x53'),_0x2b00f0[_0x57dcae][_0xcca9('0x14')],_0x2b00f0[_0x57dcae][_0xcca9('0x4c')]);}else if(manager['exists'](_0x57dcae)){manager[_0xcca9('0x45')](_0x57dcae);manager[_0xcca9('0x54')](_0x57dcae);logger[_0xcca9('0x28')](_0xcca9('0x55'),_0x2b00f0[_0x57dcae][_0xcca9('0x14')],_0x2b00f0[_0x57dcae][_0xcca9('0x4c')]);}}for(_0x5dbb7e=0x0,_0x57dcae;_0x5dbb7e<_0x85f1b4['length']&&!_0x1dec32;_0x5dbb7e+=0x1){_0x57dcae=_0x85f1b4[_0x5dbb7e][_0xcca9('0x40')]();if(manager[_0xcca9('0x44')](_0x57dcae)){if(_0x2b00f0[_0x57dcae]['cron']&&_0x2b00f0[_0x57dcae]['active']&&moment()['isBetween'](_0x2b00f0[_0x57dcae][_0xcca9('0x4f')],_0x2b00f0[_0x57dcae][_0xcca9('0x50')])){manager[_0xcca9('0x56')](_0x57dcae,_0x2b00f0[_0x57dcae][_0xcca9('0x4c')],handleJob(_0x2b00f0[_0x57dcae]));logger[_0xcca9('0x28')]('update\x20cron',_0x2b00f0[_0x57dcae][_0xcca9('0x14')],_0x2b00f0[_0x57dcae][_0xcca9('0x4c')]);}else{manager['stop'](_0x57dcae);manager['deleteJob'](_0x57dcae);logger[_0xcca9('0x28')](_0xcca9('0x55'),_0x2b00f0[_0x57dcae]['name'],_0x2b00f0[_0x57dcae][_0xcca9('0x4c')]);}}}})[_0xcca9('0x57')](function(_0x4b9876){logger['error'](JSON[_0xcca9('0x26')](_0x4b9876));});}exports['run']=function(_0x1f1ade){return getJobs(_0x1f1ade);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 06d7c1f..1bd4153 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 _0xbee3=['[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Sequelize','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','Sentiment','SentimentScore','Positive','Negative','FAILED','FailureReason','resolve','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Mixed','Neutral','name','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','all','catch','SequelizeValidationError','error','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then'];(function(_0x41b29b,_0x1e9f85){var _0x30bba7=function(_0x1247dc){while(--_0x1247dc){_0x41b29b['push'](_0x41b29b['shift']());}};_0x30bba7(++_0x1e9f85);}(_0xbee3,0x110));var _0x3bee=function(_0x46923f,_0x503b17){_0x46923f=_0x46923f-0x0;var _0x2de413=_0xbee3[_0x46923f];return _0x2de413;};var _=require('lodash');var AWS=require(_0x3bee('0x0'));var rp=require(_0x3bee('0x1'));var util=require(_0x3bee('0x2'));var BPromise=require(_0x3bee('0x3'));var db=require(_0x3bee('0x4'))['db'];var logger=require(_0x3bee('0x5'))(_0x3bee('0x6'));function getTranscriptionJob(_0x295be7,_0x51f36a,_0x58999d,_0x102d87){return new Promise(function(_0x5d4141,_0x1511b4){var _0x44718d=new AWS['TranscribeService']({'accessKeyId':_0x51f36a,'secretAccessKey':_0x295be7,'region':_0x58999d});_0x44718d[_0x3bee('0x7')]({'TranscriptionJobName':_0x102d87},function(_0x15d9fd,_0x335984){if(_0x15d9fd){return _0x1511b4(_0x15d9fd);}else{return _0x5d4141(_0x335984);}});});}function sentiment(_0x40e138,_0x3a991e,_0x36ed05,_0x4066e9,_0x2a0f8b){return new Promise(function(_0x37d0f5,_0x208fe3){var _0x47ea92=new AWS['Comprehend']({'accessKeyId':_0x3a991e,'secretAccessKey':_0x40e138,'region':_0x36ed05});_0x47ea92[_0x3bee('0x8')]({'Text':_0x4066e9,'LanguageCode':_0x2a0f8b['substring'](0x0,0x2)},function(_0x6f9dc4,_0x1644f5){if(_0x6f9dc4){return _0x208fe3(_0x6f9dc4);}else{return _0x37d0f5(_0x1644f5);}});});}function checkTranscribeJob(_0x1ed3a8,_0x4f3a63,_0x2d4eae){var _0x4c3018;return new BPromise(function(_0x406af1,_0x3242db){logger[_0x3bee('0x9')](util[_0x3bee('0xa')](_0x3bee('0xb'),_0x1ed3a8['id'],_0x1ed3a8[_0x3bee('0xc')]));return getTranscriptionJob(_0x2d4eae[_0x3bee('0xd')],_0x2d4eae[_0x3bee('0xe')],_0x4f3a63['transcribeRegion'],_0x1ed3a8[_0x3bee('0xc')])[_0x3bee('0xf')](function(_0xc81f7f){logger[_0x3bee('0x9')](util[_0x3bee('0xa')](_0x3bee('0x10'),_0x1ed3a8['id'],_0x1ed3a8[_0x3bee('0xc')],_0xc81f7f[_0x3bee('0x11')][_0x3bee('0x12')]));if(!_0x1ed3a8[_0x3bee('0x13')]){switch(_0xc81f7f[_0x3bee('0x11')][_0x3bee('0x12')]){case _0x3bee('0x14'):var _0x17fffc={'transcribeStatus':_0xc81f7f['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0xc81f7f[_0x3bee('0x11')][_0x3bee('0x15')][_0x3bee('0x16')]};logger[_0x3bee('0x9')](util['format'](_0x3bee('0x17'),_0x1ed3a8['id']));return rp({'uri':_0xc81f7f[_0x3bee('0x11')][_0x3bee('0x15')][_0x3bee('0x16')],'json':!![]})[_0x3bee('0xf')](function(_0x1a0fbb){logger[_0x3bee('0x9')](util[_0x3bee('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x1ed3a8['id']));if(_0x1a0fbb&&_0x1a0fbb[_0x3bee('0x18')]&&_0x1a0fbb['results']['transcripts']&&_0x1a0fbb[_0x3bee('0x18')][_0x3bee('0x19')][_0x3bee('0x1a')]){_0x17fffc[_0x3bee('0x13')]='';for(var _0x142d53=0x0;_0x142d53<_0x1a0fbb['results']['transcripts'][_0x3bee('0x1a')];_0x142d53++){_0x17fffc['fileText']+=_0x1a0fbb[_0x3bee('0x18')][_0x3bee('0x19')][_0x142d53][_0x3bee('0x1b')]+'';}}return _0x1ed3a8[_0x3bee('0x1c')](_0x17fffc);})[_0x3bee('0xf')](function(){logger[_0x3bee('0x9')](util['format'](_0x3bee('0x1d'),_0x1ed3a8['id']));if(!_0x1ed3a8[_0x3bee('0x1e')]){throw new db['Sequelize'][(_0x3bee('0x1f'))](_0x3bee('0x20'));}if(!_0x4f3a63[_0x3bee('0x21')]||!_0x4f3a63[_0x3bee('0x22')]||!_0x4f3a63[_0x3bee('0x23')]||!_0x4f3a63['language']||!_0x4f3a63['bucket']){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x17fffc[_0x3bee('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x4f3a63[_0x3bee('0x22')]===_0x2d4eae['id']){return _0x2d4eae;}else{return db[_0x3bee('0x24')][_0x3bee('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3bee('0xf')](function(_0x39144f){if(!_0x39144f){throw new db['Sequelize'][(_0x3bee('0x1f'))](_0x3bee('0x26'));}if(!_0x39144f['data1']||!_0x39144f[_0x3bee('0xe')]){throw new db[(_0x3bee('0x27'))]['ValidationError'](_0x3bee('0x28'));}_0x4c3018=_0x39144f;logger['info'](util['format'](_0x3bee('0x29'),_0x1ed3a8['id']));return sentiment(_0x4c3018[_0x3bee('0xd')],_0x4c3018[_0x3bee('0xe')],_0x4f3a63['sentimentRegion'],_0x17fffc[_0x3bee('0x13')],_0x4f3a63[_0x3bee('0x2a')]);})['then'](function(_0x1f89ee){logger[_0x3bee('0x9')](util[_0x3bee('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1ed3a8['id']));return _0x1ed3a8['update']({'sentiment':_0x1f89ee[_0x3bee('0x2b')],'sPositive':_0x1f89ee[_0x3bee('0x2c')][_0x3bee('0x2d')],'sNegative':_0x1f89ee[_0x3bee('0x2c')][_0x3bee('0x2e')],'sMixed':_0x1f89ee['SentimentScore']['Mixed'],'sNeutral':_0x1f89ee[_0x3bee('0x2c')]['Neutral']});})['then'](function(){logger[_0x3bee('0x9')](util[_0x3bee('0xa')](_0x3bee('0x1d'),_0x1ed3a8['id']));_0x406af1();});case _0x3bee('0x2f'):return _0x1ed3a8[_0x3bee('0x1c')]({'transcribeStatus':_0x3bee('0x2f'),'failureReason':_0xc81f7f[_0x3bee('0x11')][_0x3bee('0x30')]})['then'](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1ed3a8['id']));_0x406af1();});default:logger[_0x3bee('0x9')](util[_0x3bee('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x1ed3a8['id']));break;}}else{return BPromise[_0x3bee('0x31')]()[_0x3bee('0xf')](function(){if(!_0x1ed3a8[_0x3bee('0x1e')]){throw new db[(_0x3bee('0x27'))][(_0x3bee('0x1f'))](_0x3bee('0x20'));}if(!_0x4f3a63[_0x3bee('0x21')]||!_0x4f3a63['sentimentAccountId']||!_0x4f3a63['sentimentRegion']||!_0x4f3a63[_0x3bee('0x2a')]||!_0x4f3a63[_0x3bee('0x32')]){throw new db[(_0x3bee('0x27'))][(_0x3bee('0x1f'))](_0x3bee('0x33'));}if(!_0x1ed3a8['fileText']){throw new Error(_0x3bee('0x34'));}if(_0x4f3a63[_0x3bee('0x22')]===_0x2d4eae['id']){return _0x2d4eae;}else{return db['CloudProvider'][_0x3bee('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x402930){if(!_0x402930){throw new db[(_0x3bee('0x27'))][(_0x3bee('0x1f'))](_0x3bee('0x26'));}if(!_0x402930[_0x3bee('0xd')]||!_0x402930[_0x3bee('0xe')]){throw new db[(_0x3bee('0x27'))]['ValidationError'](_0x3bee('0x28'));}_0x4c3018=_0x402930;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1ed3a8['id']));return sentiment(_0x4c3018[_0x3bee('0xd')],_0x4c3018[_0x3bee('0xe')],_0x4f3a63['sentimentRegion'],_0x1ed3a8[_0x3bee('0x13')],_0x4f3a63[_0x3bee('0x2a')]);})[_0x3bee('0xf')](function(_0x1ce7ae){logger['info'](util['format'](_0x3bee('0x35'),_0x1ed3a8['id']));return _0x1ed3a8[_0x3bee('0x1c')]({'sentiment':_0x1ce7ae[_0x3bee('0x2b')],'sPositive':_0x1ce7ae[_0x3bee('0x2c')][_0x3bee('0x2d')],'sNegative':_0x1ce7ae[_0x3bee('0x2c')][_0x3bee('0x2e')],'sMixed':_0x1ce7ae[_0x3bee('0x2c')][_0x3bee('0x36')],'sNeutral':_0x1ce7ae[_0x3bee('0x2c')][_0x3bee('0x37')],'transcribeStatus':_0x3bee('0x14')});})[_0x3bee('0xf')](function(){logger[_0x3bee('0x9')](util['format'](_0x3bee('0x1d'),_0x1ed3a8['id']));_0x406af1();});}})['catch'](function(_0x99c415){if(_0x99c415){if(!_0x99c415[_0x3bee('0x38')]||_0x99c415[_0x3bee('0x38')]!=='SequelizeValidationError'){logger['error'](util[_0x3bee('0xa')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x1ed3a8['id']),util[_0x3bee('0x39')](_0x99c415,{'showHidden':![],'depth':null}));}}_0x406af1();});});}function checkTranscribe(){var _0x3a4209;var _0x5911c9;var _0x2f216f;return db[_0x3bee('0x3a')][_0x3bee('0x3b')]({'where':{'transcribeStatus':_0x3bee('0x3c')}})[_0x3bee('0xf')](function(_0x4e6b2d){if(!_0x4e6b2d||!_0x4e6b2d['length']){throw new db[(_0x3bee('0x27'))][(_0x3bee('0x1f'))](_0x3bee('0x3d'));}_0x3a4209=_0x4e6b2d;return db[_0x3bee('0x3e')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x5e7bb8){if(!_0x5e7bb8){throw new db[(_0x3bee('0x27'))][(_0x3bee('0x1f'))](_0x3bee('0x3f'));}_0x5911c9=_0x5e7bb8;if(!_0x5911c9[_0x3bee('0x6')]||!_0x5911c9[_0x3bee('0x40')]||!_0x5911c9[_0x3bee('0x41')]||!_0x5911c9[_0x3bee('0x2a')]||!_0x5911c9['bucket']){throw new db[(_0x3bee('0x27'))][(_0x3bee('0x1f'))](_0x3bee('0x42'));}return db[_0x3bee('0x24')][_0x3bee('0x25')]({'where':{'id':_0x5911c9['transcribeAccountId']}});})['then'](function(_0x4d0b69){if(!_0x4d0b69){throw new db[(_0x3bee('0x27'))][(_0x3bee('0x1f'))](_0x3bee('0x26'));}if(!_0x4d0b69[_0x3bee('0xd')]||!_0x4d0b69[_0x3bee('0xe')]){throw new db[(_0x3bee('0x27'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x2f216f=_0x4d0b69;var _0x1231cb=[];_0x3a4209['forEach'](function(_0x10ac40){_0x1231cb['push'](checkTranscribeJob(_0x10ac40,_0x5911c9,_0x2f216f));});return BPromise[_0x3bee('0x43')](_0x1231cb);})[_0x3bee('0x44')](function(_0x1adeec){if(_0x1adeec){if(!_0x1adeec['name']||_0x1adeec[_0x3bee('0x38')]!==_0x3bee('0x45')){logger[_0x3bee('0x46')](util[_0x3bee('0x39')](_0x1adeec,{'showHidden':![],'depth':null}));}}});}exports[_0x3bee('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xe91d=['info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentimentRegion','language','bucket','ValidationError','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Sentiment\x20Analysis\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','Neutral','catch','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20configured','forEach','push','all','name','start','request-promise','util','bluebird','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then'];(function(_0x4eafde,_0x42e36b){var _0xeb7a07=function(_0x55a2c4){while(--_0x55a2c4){_0x4eafde['push'](_0x4eafde['shift']());}};_0xeb7a07(++_0x42e36b);}(_0xe91d,0x159));var _0xde91=function(_0x10a187,_0xd916cd){_0x10a187=_0x10a187-0x0;var _0x505e94=_0xe91d[_0x10a187];return _0x505e94;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0xde91('0x0'));var util=require(_0xde91('0x1'));var BPromise=require(_0xde91('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xde91('0x3'));function getTranscriptionJob(_0x56e454,_0x890eb,_0x1f1844,_0x50971b){return new Promise(function(_0x38ba48,_0x56267b){var _0x368bb7=new AWS[(_0xde91('0x4'))]({'accessKeyId':_0x890eb,'secretAccessKey':_0x56e454,'region':_0x1f1844});_0x368bb7[_0xde91('0x5')]({'TranscriptionJobName':_0x50971b},function(_0x2109e2,_0x3711b8){if(_0x2109e2){return _0x56267b(_0x2109e2);}else{return _0x38ba48(_0x3711b8);}});});}function sentiment(_0x1a2e94,_0x4c3446,_0x45bea3,_0x35bd5e,_0x409ee0){return new Promise(function(_0x3c9b8e,_0x5f7f13){var _0x1283f5=new AWS[(_0xde91('0x6'))]({'accessKeyId':_0x4c3446,'secretAccessKey':_0x1a2e94,'region':_0x45bea3});_0x1283f5[_0xde91('0x7')]({'Text':_0x35bd5e,'LanguageCode':_0x409ee0['substring'](0x0,0x2)},function(_0xcd000b,_0x555e85){if(_0xcd000b){return _0x5f7f13(_0xcd000b);}else{return _0x3c9b8e(_0x555e85);}});});}function checkTranscribeJob(_0x6356e7,_0x3a09ef,_0x182514){var _0x2e4ba3;return new BPromise(function(_0x216b3c,_0x4d60c2){logger['info'](util[_0xde91('0x8')](_0xde91('0x9'),_0x6356e7['id'],_0x6356e7[_0xde91('0xa')]));return getTranscriptionJob(_0x182514[_0xde91('0xb')],_0x182514[_0xde91('0xc')],_0x3a09ef[_0xde91('0xd')],_0x6356e7[_0xde91('0xa')])[_0xde91('0xe')](function(_0x4abcef){logger[_0xde91('0xf')](util[_0xde91('0x8')](_0xde91('0x10'),_0x6356e7['id'],_0x6356e7[_0xde91('0xa')],_0x4abcef[_0xde91('0x11')][_0xde91('0x12')]));if(!_0x6356e7[_0xde91('0x13')]){switch(_0x4abcef[_0xde91('0x11')]['TranscriptionJobStatus']){case'COMPLETED':var _0x1aa20d={'transcribeStatus':_0x4abcef['TranscriptionJob'][_0xde91('0x12')],'fileUri':_0x4abcef[_0xde91('0x11')][_0xde91('0x14')][_0xde91('0x15')]};logger[_0xde91('0xf')](util['format'](_0xde91('0x16'),_0x6356e7['id']));return rp({'uri':_0x4abcef[_0xde91('0x11')][_0xde91('0x14')][_0xde91('0x15')],'json':!![]})[_0xde91('0xe')](function(_0x4cd437){logger[_0xde91('0xf')](util[_0xde91('0x8')](_0xde91('0x17'),_0x6356e7['id']));if(_0x4cd437&&_0x4cd437[_0xde91('0x18')]&&_0x4cd437[_0xde91('0x18')][_0xde91('0x19')]&&_0x4cd437['results']['transcripts'][_0xde91('0x1a')]){_0x1aa20d[_0xde91('0x13')]='';for(var _0x1a3889=0x0;_0x1a3889<_0x4cd437[_0xde91('0x18')][_0xde91('0x19')]['length'];_0x1a3889++){_0x1aa20d[_0xde91('0x13')]+=_0x4cd437['results'][_0xde91('0x19')][_0x1a3889][_0xde91('0x1b')]+'';}}return _0x6356e7[_0xde91('0x1c')](_0x1aa20d);})['then'](function(){logger[_0xde91('0xf')](util[_0xde91('0x8')](_0xde91('0x1d'),_0x6356e7['id']));if(!_0x6356e7[_0xde91('0x1e')]){throw new db[(_0xde91('0x1f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3a09ef['sentiment']||!_0x3a09ef['sentimentAccountId']||!_0x3a09ef[_0xde91('0x20')]||!_0x3a09ef[_0xde91('0x21')]||!_0x3a09ef[_0xde91('0x22')]){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1aa20d[_0xde91('0x13')]){throw new Error(_0xde91('0x24'));}if(_0x3a09ef[_0xde91('0x25')]===_0x182514['id']){return _0x182514;}else{return db[_0xde91('0x26')][_0xde91('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xde91('0xe')](function(_0x584348){if(!_0x584348){throw new db['Sequelize'][(_0xde91('0x23'))](_0xde91('0x28'));}if(!_0x584348[_0xde91('0xb')]||!_0x584348['data2']){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x2e4ba3=_0x584348;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x6356e7['id']));return sentiment(_0x2e4ba3['data1'],_0x2e4ba3['data2'],_0x3a09ef['sentimentRegion'],_0x1aa20d[_0xde91('0x13')],_0x3a09ef[_0xde91('0x21')]);})[_0xde91('0xe')](function(_0x3d31ae){logger[_0xde91('0xf')](util[_0xde91('0x8')](_0xde91('0x29'),_0x6356e7['id']));return _0x6356e7['update']({'sentiment':_0x3d31ae['Sentiment'],'sPositive':_0x3d31ae[_0xde91('0x2a')][_0xde91('0x2b')],'sNegative':_0x3d31ae[_0xde91('0x2a')][_0xde91('0x2c')],'sMixed':_0x3d31ae[_0xde91('0x2a')][_0xde91('0x2d')],'sNeutral':_0x3d31ae[_0xde91('0x2a')]['Neutral']});})[_0xde91('0xe')](function(){logger['info'](util['format'](_0xde91('0x1d'),_0x6356e7['id']));_0x216b3c();});case _0xde91('0x2e'):return _0x6356e7['update']({'transcribeStatus':_0xde91('0x2e'),'failureReason':_0x4abcef[_0xde91('0x11')]['FailureReason']})[_0xde91('0xe')](function(){logger[_0xde91('0xf')](util[_0xde91('0x8')](_0xde91('0x1d'),_0x6356e7['id']));_0x216b3c();});default:logger[_0xde91('0xf')](util[_0xde91('0x8')](_0xde91('0x2f'),_0x6356e7['id']));break;}}else{return BPromise[_0xde91('0x30')]()[_0xde91('0xe')](function(){if(!_0x6356e7['tempSentiment']){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))](_0xde91('0x31'));}if(!_0x3a09ef['sentiment']||!_0x3a09ef[_0xde91('0x25')]||!_0x3a09ef[_0xde91('0x20')]||!_0x3a09ef['language']||!_0x3a09ef[_0xde91('0x22')]){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))](_0xde91('0x32'));}if(!_0x6356e7[_0xde91('0x13')]){throw new Error(_0xde91('0x24'));}if(_0x3a09ef[_0xde91('0x25')]===_0x182514['id']){return _0x182514;}else{return db[_0xde91('0x26')]['findOne']({'where':{'id':_settings[_0xde91('0x25')]}});}})[_0xde91('0xe')](function(_0x26e68b){if(!_0x26e68b){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x26e68b[_0xde91('0xb')]||!_0x26e68b[_0xde91('0xc')]){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x2e4ba3=_0x26e68b;logger[_0xde91('0xf')](util[_0xde91('0x8')](_0xde91('0x33'),_0x6356e7['id']));return sentiment(_0x2e4ba3[_0xde91('0xb')],_0x2e4ba3[_0xde91('0xc')],_0x3a09ef[_0xde91('0x20')],_0x6356e7[_0xde91('0x13')],_0x3a09ef[_0xde91('0x21')]);})[_0xde91('0xe')](function(_0x4d392c){logger['info'](util[_0xde91('0x8')](_0xde91('0x29'),_0x6356e7['id']));return _0x6356e7[_0xde91('0x1c')]({'sentiment':_0x4d392c[_0xde91('0x34')],'sPositive':_0x4d392c[_0xde91('0x2a')][_0xde91('0x2b')],'sNegative':_0x4d392c[_0xde91('0x2a')][_0xde91('0x2c')],'sMixed':_0x4d392c[_0xde91('0x2a')][_0xde91('0x2d')],'sNeutral':_0x4d392c[_0xde91('0x2a')][_0xde91('0x35')],'transcribeStatus':'COMPLETED'});})[_0xde91('0xe')](function(){logger[_0xde91('0xf')](util['format'](_0xde91('0x1d'),_0x6356e7['id']));_0x216b3c();});}})[_0xde91('0x36')](function(_0x22275d){if(_0x22275d){if(!_0x22275d['name']||_0x22275d['name']!==_0xde91('0x37')){logger[_0xde91('0x38')](util[_0xde91('0x8')](_0xde91('0x39'),_0x6356e7['id']),util[_0xde91('0x3a')](_0x22275d,{'showHidden':![],'depth':null}));}}_0x216b3c();});});}function checkTranscribe(){var _0x445e86;var _0xdd7222;var _0x2bbfb1;return db['VoiceRecording'][_0xde91('0x3b')]({'where':{'transcribeStatus':_0xde91('0x3c')}})[_0xde91('0xe')](function(_0x1dcc8e){if(!_0x1dcc8e||!_0x1dcc8e['length']){throw new db['Sequelize']['ValidationError'](_0xde91('0x3d'));}_0x445e86=_0x1dcc8e;return db[_0xde91('0x3e')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x511dbb){if(!_0x511dbb){throw new db['Sequelize'][(_0xde91('0x23'))](_0xde91('0x3f'));}_0xdd7222=_0x511dbb;if(!_0xdd7222[_0xde91('0x3')]||!_0xdd7222['transcribeAccountId']||!_0xdd7222['transcribeRegion']||!_0xdd7222['language']||!_0xdd7222['bucket']){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))](_0xde91('0x40'));}return db[_0xde91('0x26')][_0xde91('0x27')]({'where':{'id':_0xdd7222[_0xde91('0x41')]}});})['then'](function(_0x102557){if(!_0x102557){throw new db['Sequelize'][(_0xde91('0x23'))](_0xde91('0x28'));}if(!_0x102557[_0xde91('0xb')]||!_0x102557[_0xde91('0xc')]){throw new db[(_0xde91('0x1f'))][(_0xde91('0x23'))](_0xde91('0x42'));}_0x2bbfb1=_0x102557;var _0x3b5eae=[];_0x445e86[_0xde91('0x43')](function(_0x308193){_0x3b5eae[_0xde91('0x44')](checkTranscribeJob(_0x308193,_0xdd7222,_0x2bbfb1));});return BPromise[_0xde91('0x45')](_0x3b5eae);})[_0xde91('0x36')](function(_0x548743){if(_0x548743){if(!_0x548743[_0xde91('0x46')]||_0x548743[_0xde91('0x46')]!==_0xde91('0x37')){logger['error'](util['inspect'](_0x548743,{'showHidden':![],'depth':null}));}}});}exports[_0xde91('0x47')]=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 20b323d..a83c8e5 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 _0xb237=['emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','then','map','info','join','update','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xb237,0x1d0));var _0x7b23=function(_0x33199a,_0xcd7e98){_0x33199a=_0x33199a-0x0;var _0x17c3d=_0xb237[_0x33199a];return _0x17c3d;};'use strict';var _=require(_0x7b23('0x0'));var moment=require(_0x7b23('0x1'));var Redis=require(_0x7b23('0x2'));var util=require('util');var config=require(_0x7b23('0x3'));var db=require(_0x7b23('0x4'))['db'];var logger=require(_0x7b23('0x5'))(_0x7b23('0x6'));config[_0x7b23('0x7')]=_[_0x7b23('0x8')](config[_0x7b23('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x7b23('0x9'))(new Redis(config[_0x7b23('0x7')]));function closeInteractions(){var _0x529959=[];return db[_0x7b23('0xa')][_0x7b23('0xb')]({'raw':!![],'attributes':['id',_0x7b23('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7b23('0xd')](0x18,'hours')}}})[_0x7b23('0xe')](function(_0x449b76){if(_0x449b76&&_0x449b76['length']){_0x529959=_[_0x7b23('0xf')](_0x449b76||[],'id');logger[_0x7b23('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x529959[_0x7b23('0x11')]());return db['WhatsappInteraction'][_0x7b23('0x12')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x7b23('0x13')](_0x7b23('0x14'))},{'where':{'id':_0x529959}});}})[_0x7b23('0xe')](function(){if(_0x529959&&_0x529959['length']){logger[_0x7b23('0x10')](_0x7b23('0x15'),_0x529959[_0x7b23('0x11')]());for(var _0x4fc1fa=0x0;_0x4fc1fa<_0x529959['length'];_0x4fc1fa++){io[_0x7b23('0x16')](_0x7b23('0x17'),{'id':_0x529959[_0x4fc1fa],'closed':!![]});}}})['catch'](function(_0x20ad6d){logger[_0x7b23('0x18')](_0x7b23('0x19'),_0x20ad6d?util[_0x7b23('0x1a')](_0x20ad6d,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8318=['[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt','subtract','hours','then','length','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error'];(function(_0x40d466,_0x1d5a89){var _0x324e69=function(_0x156506){while(--_0x156506){_0x40d466['push'](_0x40d466['shift']());}};_0x324e69(++_0x1d5a89);}(_0x8318,0xc6));var _0x8831=function(_0x303be1,_0x11dcfc){_0x303be1=_0x303be1-0x0;var _0x3e0191=_0x8318[_0x303be1];return _0x3e0191;};'use strict';var _=require(_0x8831('0x0'));var moment=require(_0x8831('0x1'));var Redis=require('ioredis');var util=require(_0x8831('0x2'));var config=require(_0x8831('0x3'));var db=require(_0x8831('0x4'))['db'];var logger=require(_0x8831('0x5'))(_0x8831('0x6'));config[_0x8831('0x7')]=_[_0x8831('0x8')](config[_0x8831('0x7')],{'host':_0x8831('0x9'),'port':0x18eb});var io=require(_0x8831('0xa'))(new Redis(config[_0x8831('0x7')]));function closeInteractions(){var _0xa8e9e1=[];return db['WhatsappInteraction'][_0x8831('0xb')]({'raw':!![],'attributes':['id',_0x8831('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8831('0xd')](0x18,_0x8831('0xe'))}}})[_0x8831('0xf')](function(_0xd95c25){if(_0xd95c25&&_0xd95c25[_0x8831('0x10')]){_0xa8e9e1=_['map'](_0xd95c25||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0xa8e9e1[_0x8831('0x11')]());return db['WhatsappInteraction'][_0x8831('0x12')]({'closeReason':'system','disposition':_0x8831('0x13'),'closed':!![],'closedAt':moment()[_0x8831('0x14')](_0x8831('0x15'))},{'where':{'id':_0xa8e9e1}});}})['then'](function(){if(_0xa8e9e1&&_0xa8e9e1[_0x8831('0x10')]){logger['info'](_0x8831('0x16'),_0xa8e9e1[_0x8831('0x11')]());for(var _0x41ac18=0x0;_0x41ac18<_0xa8e9e1['length'];_0x41ac18++){io[_0x8831('0x17')]('whatsappInteraction:update',{'id':_0xa8e9e1[_0x41ac18],'closed':!![]});}}})[_0x8831('0x18')](function(_0x326d1b){logger[_0x8831('0x19')](_0x8831('0x1a'),_0x326d1b?util['inspect'](_0x326d1b,{'showHidden':![],'depth':null}):'');});}exports[_0x8831('0x1b')]=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 dbc4103..dabdbf9 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb87d=['hopper1','contacts2','hopper2','catch','util','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','push','CmContact','destroy','log','finished\x20populating','contacts1','then','CmHopper','bulkCreate'];(function(_0x310a70,_0x306f74){var _0x232326=function(_0x312ff9){while(--_0x312ff9){_0x310a70['push'](_0x310a70['shift']());}};_0x232326(++_0x306f74);}(_0xb87d,0x180));var _0xdb87=function(_0x1cca2e,_0x2eb56c){_0x1cca2e=_0x1cca2e-0x0;var _0x1531dd=_0xb87d[_0x1cca2e];return _0x1531dd;};'use strict';var util=require(_0xdb87('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xdb87('0x1')+i,'lastName':_0xdb87('0x2')+i,'phone':0xf879fb460+i,'email':_0xdb87('0x3')+i+_0xdb87('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xdb87('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xdb87('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xdb87('0x6')]({'id':i,'firstName':_0xdb87('0x1')+i,'lastName':_0xdb87('0x2')+i,'phone':0xf879fb460+i,'email':_0xdb87('0x3')+i+_0xdb87('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xdb87('0x6')]({'id':i,'active':![],'scheduledat':Date[_0xdb87('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xdb87('0x5')](),'updatedAt':Date[_0xdb87('0x5')]()});}db[_0xdb87('0x7')][_0xdb87('0x8')]({'where':{}})['then'](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console[_0xdb87('0x9')](_0xdb87('0xa'),_0xdb87('0xb'));return db['CmHopper']['destroy']({'where':{}});})[_0xdb87('0xc')](function(){return db[_0xdb87('0xd')][_0xdb87('0xe')](hopper);})[_0xdb87('0xc')](function(){console[_0xdb87('0x9')](_0xdb87('0xa'),_0xdb87('0xf'));return db[_0xdb87('0x7')][_0xdb87('0xe')](contacts2);})[_0xdb87('0xc')](function(){console['log']('finished\x20populating',_0xdb87('0x10'));return db[_0xdb87('0xd')]['bulkCreate'](hopper2);})[_0xdb87('0xc')](function(){console[_0xdb87('0x9')](_0xdb87('0xa'),_0xdb87('0x11'));})[_0xdb87('0x12')](function(_0x3ea57a){console['log'](_0x3ea57a);}); \ No newline at end of file +var _0x3ba6=['Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact','destroy','bulkCreate','then','log','finished\x20populating','CmHopper','hopper1','../mysqldb','push'];(function(_0xdf4521,_0x355f6b){var _0x5db0f1=function(_0x489933){while(--_0x489933){_0xdf4521['push'](_0xdf4521['shift']());}};_0x5db0f1(++_0x355f6b);}(_0x3ba6,0xfd));var _0x63ba=function(_0x313df3,_0x4fca45){_0x313df3=_0x313df3-0x0;var _0x241d59=_0x3ba6[_0x313df3];return _0x241d59;};'use strict';var util=require('util');var db=require(_0x63ba('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x63ba('0x1')]({'id':i,'firstName':_0x63ba('0x2')+i,'lastName':_0x63ba('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x63ba('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x63ba('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x63ba('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x63ba('0x1')]({'id':i,'firstName':_0x63ba('0x2')+i,'lastName':_0x63ba('0x3')+i,'phone':0xf879fb460+i,'email':_0x63ba('0x6')+i+_0x63ba('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x63ba('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x63ba('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x63ba('0x5')](),'updatedAt':Date['now']()});}db[_0x63ba('0x7')][_0x63ba('0x8')]({'where':{}})['then'](function(){return db[_0x63ba('0x7')][_0x63ba('0x9')](contacts);})[_0x63ba('0xa')](function(){console[_0x63ba('0xb')](_0x63ba('0xc'),'contacts1');return db[_0x63ba('0xd')][_0x63ba('0x8')]({'where':{}});})[_0x63ba('0xa')](function(){return db[_0x63ba('0xd')][_0x63ba('0x9')](hopper);})[_0x63ba('0xa')](function(){console[_0x63ba('0xb')](_0x63ba('0xc'),_0x63ba('0xe'));return db[_0x63ba('0x7')]['bulkCreate'](contacts2);})[_0x63ba('0xa')](function(){console[_0x63ba('0xb')](_0x63ba('0xc'),'contacts2');return db[_0x63ba('0xd')][_0x63ba('0x9')](hopper2);})[_0x63ba('0xa')](function(){console[_0x63ba('0xb')](_0x63ba('0xc'),'hopper2');})['catch'](function(_0x83bac7){console[_0x63ba('0xb')](_0x83bac7);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index eef6143..3669bf2 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1aab=['ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','bulkCreate','then','log','add\x20user','%s%s','agent','format','%s%s@xcally.com','password','wss','all'];(function(_0x59cdec,_0xd2be16){var _0x1f8369=function(_0xc38bf5){while(--_0xc38bf5){_0x59cdec['push'](_0x59cdec['shift']());}};_0x1f8369(++_0xd2be16);}(_0x1aab,0x139));var _0xb1aa=function(_0x1dc3ef,_0x440625){_0x1dc3ef=_0x1dc3ef-0x0;var _0xe54c21=_0x1aab[_0x1dc3ef];return _0xe54c21;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xb1aa('0x0'),_0xb1aa('0x1'),i),'fullname':util['format'](_0xb1aa('0x0'),'agent',i),'email':util[_0xb1aa('0x2')](_0xb1aa('0x3'),'agent',i),'role':_0xb1aa('0x1'),'password':_0xb1aa('0x4'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0xb1aa('0x5')],'disallow':[_0xb1aa('0x6')],'allow':[_0xb1aa('0x7')],'defaultuser':util[_0xb1aa('0x2')](_0xb1aa('0x0'),'agent',i),'encryption':_0xb1aa('0x8'),'avpf':_0xb1aa('0x8'),'force_avp':_0xb1aa('0x8'),'icesupport':_0xb1aa('0x8'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xb1aa('0x9'),'dtlsprivatekey':_0xb1aa('0xa'),'dtlssetup':_0xb1aa('0xb'),'callerid':util[_0xb1aa('0x2')]('\x22%s\x22\x20<%s>',util[_0xb1aa('0x2')](_0xb1aa('0x0'),_0xb1aa('0x1'),i),0xfa0+i)});}db['User'][_0xb1aa('0xc')](users)[_0xb1aa('0xd')](function(){console[_0xb1aa('0xe')](_0xb1aa('0xf'));})['catch'](function(_0xc2e01d){console[_0xb1aa('0xe')](_0xc2e01d);}); \ No newline at end of file +var _0x7862=['format','%s%s','agent','%s%s@xcally.com','friend','udp','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','catch','util','push'];(function(_0x589968,_0x273d2e){var _0x3efa59=function(_0x3aca09){while(--_0x3aca09){_0x589968['push'](_0x589968['shift']());}};_0x3efa59(++_0x273d2e);}(_0x7862,0x154));var _0x2786=function(_0x2c992d,_0x4b98fb){_0x2c992d=_0x2c992d-0x0;var _0xdedaed=_0x7862[_0x2c992d];return _0xdedaed;};'use strict';var util=require(_0x2786('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2786('0x1')]({'name':util[_0x2786('0x2')](_0x2786('0x3'),_0x2786('0x4'),i),'fullname':util[_0x2786('0x2')](_0x2786('0x3'),_0x2786('0x4'),i),'email':util['format'](_0x2786('0x5'),_0x2786('0x4'),i),'role':_0x2786('0x4'),'password':'password','internal':0xfa0+i,'type':_0x2786('0x6'),'transport':[_0x2786('0x7'),'ws','wss'],'disallow':[_0x2786('0x8')],'allow':['ulaw'],'defaultuser':util[_0x2786('0x2')](_0x2786('0x3'),_0x2786('0x4'),i),'encryption':_0x2786('0x9'),'avpf':_0x2786('0x9'),'force_avp':'yes','icesupport':_0x2786('0x9'),'dtlsenable':_0x2786('0x9'),'dtlsverify':'no','dtlscertfile':_0x2786('0xa'),'dtlsprivatekey':_0x2786('0xb'),'dtlssetup':_0x2786('0xc'),'callerid':util['format'](_0x2786('0xd'),util[_0x2786('0x2')](_0x2786('0x3'),'agent',i),0xfa0+i)});}db[_0x2786('0xe')][_0x2786('0xf')](users)['then'](function(){console[_0x2786('0x10')](_0x2786('0x11'));})[_0x2786('0x12')](function(_0x4a6c86){console[_0x2786('0x10')](_0x4a6c86);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 8ec8e24..1c55c2c 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcdd8=['openchannel','campaign:%s:%s','leave','map','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','catch','join','default','connection','address','request','remoteAddress','remotePort','SocketIO\x20','disconnect','log','CONNECTED','lodash','util','bluebird','name','Agents','User','role','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','telephone','where','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','MailQueues','WhatsappQueues','Campaign','agent','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','fax','mail'];(function(_0x5d72da,_0xb7ce32){var _0x43ebe7=function(_0x503755){while(--_0x503755){_0x5d72da['push'](_0x5d72da['shift']());}};_0x43ebe7(++_0xb7ce32);}(_0xcdd8,0x19d));var _0x8cdd=function(_0x57aad9,_0x23f445){_0x57aad9=_0x57aad9-0x0;var _0x5f1486=_0xcdd8[_0x57aad9];return _0x5f1486;};'use strict';var _=require(_0x8cdd('0x0'));var util=require(_0x8cdd('0x1'));var BPromise=require(_0x8cdd('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x8cdd('0x3')],'include':[{'as':_0x8cdd('0x4'),'model':db[_0x8cdd('0x5')],'attributes':['id',_0x8cdd('0x3'),_0x8cdd('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8cdd('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x8cdd('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x8cdd('0x7')],'where':{'type':_0x8cdd('0x8')}};function getAssociatedResources(_0x425959,_0x7a82a0,_0x2ce77f){return db[_0x8cdd('0x9')][_0x8cdd('0xa')]({'where':{'name':_0x425959,'userProfileId':_0x7a82a0},'raw':!![]})[_0x8cdd('0xb')](function(_0x2a2373){if(_0x2a2373){if(_0x2a2373[_0x8cdd('0xc')]){switch(_0x425959){case'VoiceQueues':case _0x8cdd('0xd'):case _0x8cdd('0xe'):case _0x8cdd('0xf'):case'MailQueues':case _0x8cdd('0x10'):case'WhatsappQueues':return db[_0x2ce77f][_0x8cdd('0x11')](queryQueues);case _0x8cdd('0x12'):return db[_0x2ce77f][_0x8cdd('0x11')](queryTelephones);case _0x8cdd('0x13'):return db[_0x2ce77f]['findAll'](queryTrunks);case _0x8cdd('0x14'):return db[_0x2ce77f][_0x8cdd('0x11')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0x8cdd('0x15')],'where':{'sectionId':_0x2a2373['id']},'raw':!![]})[_0x8cdd('0xb')](function(_0x232de3){if(_0x232de3){var _0x48f976={'where':{'id':_['map'](_0x232de3,_0x8cdd('0x15'))},'raw':!![]};switch(_0x2ce77f){case'User':_0x48f976['where'][_0x8cdd('0x6')]=_0x8cdd('0x16');break;case'Campaign':_0x48f976[_0x8cdd('0x17')][_0x8cdd('0x7')]=_0x8cdd('0x8');break;}return db[_0x2ce77f]['findAll'](_0x48f976);}else{return[];}});}}else{return[];}})[_0x8cdd('0xb')](function(_0xa99920){return _0xa99920;});}function joinOrLeaveQueues(_0x4bde99,_0xe77929,_0x42b9,_0x51e304){_0x4bde99[_0xe77929](util[_0x8cdd('0x18')](_0x8cdd('0x19'),_0x42b9,_0x51e304[_0x8cdd('0x3')]));if(_0x51e304[_0x8cdd('0x4')]){for(var _0x5bf44e=0x0;_0x5bf44e<_0x51e304[_0x8cdd('0x4')][_0x8cdd('0x1a')];_0x5bf44e+=0x1){_0x4bde99[_0xe77929](util[_0x8cdd('0x18')](_0x8cdd('0x1b'),_0x51e304[_0x8cdd('0x4')][_0x5bf44e]['name']));}}}function joinOrLeave(_0x202d37,_0x57eb77,_0x1843ba){var _0x366c05;if(_0x202d37[_0x8cdd('0x1c')][_0x8cdd('0x1d')]['id']){db[_0x8cdd('0x5')][_0x8cdd('0x1e')]({'attributes':['id',_0x8cdd('0x3'),_0x8cdd('0x6'),_0x8cdd('0x1f')],'where':{'id':_0x202d37[_0x8cdd('0x1c')][_0x8cdd('0x1d')]['id']},'include':[{'model':db[_0x8cdd('0x20')],'as':_0x8cdd('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x8cdd('0x22')],'as':_0x8cdd('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x8cdd('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8cdd('0x25')],'as':_0x8cdd('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x8cdd('0x27')],'as':_0x8cdd('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x8cdd('0x29')],'as':_0x8cdd('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x8cdd('0xb')](function(_0x8d50b4){if(_0x8d50b4){_0x366c05=_0x8d50b4;_0x202d37[_0x57eb77](util['format'](_0x8cdd('0x1b'),_0x8d50b4[_0x8cdd('0x3')]));var _0x25bc45=[];switch(_0x8d50b4[_0x8cdd('0x6')]){case _0x8cdd('0x2b'):_0x202d37[_0x57eb77](_0x8cdd('0x2c'));_0x202d37[_0x57eb77](_0x8cdd('0x2d'));if(queryQueues[_0x8cdd('0x2e')]('include')){delete queryQueues[_0x8cdd('0x2f')];}_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x31')][_0x8cdd('0x11')](queryQueues));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x32')][_0x8cdd('0x11')](queryQueues));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x33')][_0x8cdd('0x11')](queryQueues));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x34')]['findAll'](queryQueues));_0x25bc45['push'](db[_0x8cdd('0x35')][_0x8cdd('0x11')](queryQueues));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x36')]['findAll'](queryQueues));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x37')][_0x8cdd('0x11')](queryQueues));_0x25bc45[_0x8cdd('0x30')](db['User'][_0x8cdd('0x11')](queryTelephones));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x38')]['findAll'](queryTrunks));_0x25bc45[_0x8cdd('0x30')](db['Campaign'][_0x8cdd('0x11')](queryCampaigns));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x5')][_0x8cdd('0x11')](queryAgents));break;case _0x8cdd('0x39'):_0x202d37[_0x57eb77](_0x8cdd('0x2c'));_0x202d37[_0x57eb77](_0x8cdd('0x2d'));_0x25bc45[_0x8cdd('0x30')](getAssociatedResources(_0x8cdd('0x3a'),_0x8d50b4['userProfileId'],_0x8cdd('0x31')));_0x25bc45['push'](getAssociatedResources(_0x8cdd('0xd'),_0x8d50b4[_0x8cdd('0x1f')],_0x8cdd('0x32')));_0x25bc45[_0x8cdd('0x30')](getAssociatedResources('FaxQueues',_0x8d50b4['userProfileId'],'FaxQueue'));_0x25bc45['push'](getAssociatedResources('SmsQueues',_0x8d50b4['userProfileId'],_0x8cdd('0x34')));_0x25bc45[_0x8cdd('0x30')](getAssociatedResources(_0x8cdd('0x3b'),_0x8d50b4['userProfileId'],_0x8cdd('0x35')));_0x25bc45['push'](getAssociatedResources(_0x8cdd('0x10'),_0x8d50b4['userProfileId'],_0x8cdd('0x36')));_0x25bc45[_0x8cdd('0x30')](getAssociatedResources(_0x8cdd('0x3c'),_0x8d50b4[_0x8cdd('0x1f')],'WhatsappQueue'));_0x25bc45[_0x8cdd('0x30')](getAssociatedResources(_0x8cdd('0x12'),_0x8d50b4[_0x8cdd('0x1f')],'User'));_0x25bc45[_0x8cdd('0x30')](getAssociatedResources(_0x8cdd('0x13'),_0x8d50b4[_0x8cdd('0x1f')],_0x8cdd('0x38')));_0x25bc45[_0x8cdd('0x30')](getAssociatedResources(_0x8cdd('0x14'),_0x8d50b4[_0x8cdd('0x1f')],_0x8cdd('0x3d')));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x5')][_0x8cdd('0x11')](queryAgents));break;case _0x8cdd('0x3e'):_0x202d37[_0x57eb77](_0x8cdd('0x2c'));_0x202d37[_0x57eb77](_0x8cdd('0x2d'));_0x25bc45[_0x8cdd('0x30')](_0x8d50b4['getVoiceQueues']({'attributes':['id',_0x8cdd('0x3')]}));_0x25bc45[_0x8cdd('0x30')](_0x8d50b4[_0x8cdd('0x3f')]({'attributes':['id',_0x8cdd('0x3')]}));_0x25bc45['push'](_0x8d50b4[_0x8cdd('0x40')]({'attributes':['id','name']}));_0x25bc45[_0x8cdd('0x30')](_0x8d50b4[_0x8cdd('0x41')]({'attributes':['id',_0x8cdd('0x3')]}));_0x25bc45[_0x8cdd('0x30')](_0x8d50b4[_0x8cdd('0x42')]({'attributes':['id',_0x8cdd('0x3')]}));_0x25bc45[_0x8cdd('0x30')](_0x8d50b4[_0x8cdd('0x43')]({'attributes':['id',_0x8cdd('0x3')]}));_0x25bc45['push'](_0x8d50b4[_0x8cdd('0x44')]({'attributes':['id','name']}));break;}return BPromise[_0x8cdd('0x45')](_0x25bc45);}})[_0x8cdd('0xb')](function(_0x4d21a7){if(_0x4d21a7&&_0x4d21a7[_0x8cdd('0x1a')]){for(var _0x7314c4=0x0;_0x7314c4<_0x4d21a7[_0x8cdd('0x1a')];_0x7314c4+=0x1){for(var _0x2f9069=0x0;_0x2f9069<_0x4d21a7[_0x7314c4][_0x8cdd('0x1a')];_0x2f9069+=0x1){switch(_0x7314c4){case 0x0:joinOrLeaveQueues(_0x202d37,_0x57eb77,'voice',_0x4d21a7[_0x7314c4][_0x2f9069]);break;case 0x1:joinOrLeaveQueues(_0x202d37,_0x57eb77,'chat',_0x4d21a7[_0x7314c4][_0x2f9069]);break;case 0x2:joinOrLeaveQueues(_0x202d37,_0x57eb77,_0x8cdd('0x46'),_0x4d21a7[_0x7314c4][_0x2f9069]);break;case 0x3:joinOrLeaveQueues(_0x202d37,_0x57eb77,'sms',_0x4d21a7[_0x7314c4][_0x2f9069]);break;case 0x4:joinOrLeaveQueues(_0x202d37,_0x57eb77,_0x8cdd('0x47'),_0x4d21a7[_0x7314c4][_0x2f9069]);break;case 0x5:joinOrLeaveQueues(_0x202d37,_0x57eb77,_0x8cdd('0x48'),_0x4d21a7[_0x7314c4][_0x2f9069]);break;case 0x6:joinOrLeaveQueues(_0x202d37,_0x57eb77,'whatsapp',_0x4d21a7[_0x7314c4][_0x2f9069]);break;case 0x7:_0x202d37[_0x57eb77](util[_0x8cdd('0x18')]('telephone:%s',_0x4d21a7[_0x7314c4][_0x2f9069][_0x8cdd('0x3')]));break;case 0x8:_0x202d37[_0x57eb77](util[_0x8cdd('0x18')]('trunk:%s',_0x4d21a7[_0x7314c4][_0x2f9069]['name']));break;case 0x9:_0x202d37[_0x57eb77](util[_0x8cdd('0x18')](_0x8cdd('0x49'),_0x4d21a7[_0x7314c4][_0x2f9069]['type'],_0x4d21a7[_0x7314c4][_0x2f9069]['name']));break;case 0xa:_0x202d37[_0x57eb77](util[_0x8cdd('0x18')](_0x8cdd('0x1b'),_0x4d21a7[_0x7314c4][_0x2f9069][_0x8cdd('0x3')]));break;}}}}})['then'](function(){if(_0x57eb77===_0x8cdd('0x4a')){var _0x4e45ab=_[_0x8cdd('0x4b')](_0x366c05['ChatInteractions'],'id');return _0x366c05['removeChatInteractions'](_0x4e45ab)[_0x8cdd('0xb')](function(){for(var _0xd037c6=0x0;_0xd037c6<_0x4e45ab['length'];_0xd037c6+=0x1){_0x1843ba[_0x8cdd('0x4c')](_0x8cdd('0x4d'),{'ChatInteractionId':Number(_0x4e45ab[_0xd037c6]),'UserId':Number(_0x366c05['id'])});}});}})['then'](function(){if(_0x57eb77===_0x8cdd('0x4a')){var _0x2d5b1a=_[_0x8cdd('0x4b')](_0x366c05[_0x8cdd('0x23')],'id');return _0x366c05[_0x8cdd('0x4e')](_0x2d5b1a)[_0x8cdd('0xb')](function(){for(var _0x11beba=0x0;_0x11beba<_0x2d5b1a[_0x8cdd('0x1a')];_0x11beba+=0x1){_0x1843ba[_0x8cdd('0x4c')](_0x8cdd('0x4f'),{'MailInteractionId':Number(_0x2d5b1a[_0x11beba]),'UserId':Number(_0x366c05['id'])});}});}})[_0x8cdd('0xb')](function(){if(_0x57eb77==='leave'){var _0x4da206=_[_0x8cdd('0x4b')](_0x366c05[_0x8cdd('0x50')],'id');return _0x366c05[_0x8cdd('0x51')](_0x4da206)[_0x8cdd('0xb')](function(){for(var _0x520e0b=0x0;_0x520e0b<_0x4da206[_0x8cdd('0x1a')];_0x520e0b+=0x1){_0x1843ba[_0x8cdd('0x4c')](_0x8cdd('0x52'),{'FaxInteractionId':Number(_0x4da206[_0x520e0b]),'UserId':Number(_0x366c05['id'])});}});}})['then'](function(){if(_0x57eb77===_0x8cdd('0x4a')){var _0x5a3fa5=_[_0x8cdd('0x4b')](_0x366c05[_0x8cdd('0x26')],'id');return _0x366c05[_0x8cdd('0x53')](_0x5a3fa5)[_0x8cdd('0xb')](function(){for(var _0x21b2ba=0x0;_0x21b2ba<_0x5a3fa5['length'];_0x21b2ba+=0x1){_0x1843ba[_0x8cdd('0x4c')](_0x8cdd('0x54'),{'SmsInteractionId':Number(_0x5a3fa5[_0x21b2ba]),'UserId':Number(_0x366c05['id'])});}});}})[_0x8cdd('0xb')](function(){if(_0x57eb77===_0x8cdd('0x4a')){var _0x4af325=_['map'](_0x366c05[_0x8cdd('0x28')],'id');return _0x366c05['removeOpenchannelInteractions'](_0x4af325)['then'](function(){for(var _0x49a700=0x0;_0x49a700<_0x4af325[_0x8cdd('0x1a')];_0x49a700+=0x1){_0x1843ba[_0x8cdd('0x4c')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x4af325[_0x49a700]),'UserId':Number(_0x366c05['id'])});}});}})[_0x8cdd('0xb')](function(){if(_0x57eb77===_0x8cdd('0x4a')){var _0x55d2eb=_[_0x8cdd('0x4b')](_0x366c05['WhatsappInteractions'],'id');return _0x366c05['removeWhatsappInteractions'](_0x55d2eb)[_0x8cdd('0xb')](function(){for(var _0x133a68=0x0;_0x133a68<_0x55d2eb[_0x8cdd('0x1a')];_0x133a68+=0x1){_0x1843ba[_0x8cdd('0x4c')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x55d2eb[_0x133a68]),'UserId':Number(_0x366c05['id'])});}});}})[_0x8cdd('0x55')](function(_0x3260dc){_0x202d37['log'](_0x3260dc);});}}function onDisconnect(_0x9db4d,_0x2f0dff){joinOrLeave(_0x9db4d,_0x8cdd('0x4a'),_0x2f0dff);}function onConnect(_0x46ee0d){joinOrLeave(_0x46ee0d,_0x8cdd('0x56'));}exports[_0x8cdd('0x57')]=function(_0x7f919b){_0x7f919b['on'](_0x8cdd('0x58'),function(_0xe73803){_0xe73803['setMaxListeners'](0x0);_0xe73803[_0x8cdd('0x59')]=_0xe73803[_0x8cdd('0x5a')][_0x8cdd('0x58')][_0x8cdd('0x5b')]+':'+_0xe73803[_0x8cdd('0x5a')][_0x8cdd('0x58')][_0x8cdd('0x5c')];_0xe73803['connectedAt']=new Date();_0xe73803['log']=function(_0x2e1855){console['log'](_0x8cdd('0x5d')+_0xe73803['nsp']['name']+'['+_0xe73803[_0x8cdd('0x59')]+']',_0x2e1855);};_0xe73803['on'](_0x8cdd('0x5e'),function(){onDisconnect(_0xe73803,_0x7f919b);_0xe73803[_0x8cdd('0x5f')]('DISCONNECTED');});onConnect(_0xe73803);_0xe73803['log'](_0x8cdd('0x60'));});}; \ No newline at end of file +var _0x7b51=['MailQueue','Trunk','user','VoiceQueues','ChatQueues','OpenchannelQueue','getVoiceQueues','getFaxQueues','getMailQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','type','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','MailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue'];(function(_0x4c67d9,_0x351438){var _0x26f975=function(_0x43f193){while(--_0x43f193){_0x4c67d9['push'](_0x4c67d9['shift']());}};_0x26f975(++_0x351438);}(_0x7b51,0x162));var _0x17b5=function(_0x1b96c6,_0x45e55a){_0x1b96c6=_0x1b96c6-0x0;var _0x4a20fa=_0x7b51[_0x1b96c6];return _0x4a20fa;};'use strict';var _=require(_0x17b5('0x0'));var util=require(_0x17b5('0x1'));var BPromise=require(_0x17b5('0x2'));var db=require(_0x17b5('0x3'))['db'];var config=require(_0x17b5('0x4'));var queryQueues={'attributes':['id',_0x17b5('0x5')],'include':[{'as':_0x17b5('0x6'),'model':db[_0x17b5('0x7')],'attributes':['id','name',_0x17b5('0x8')],'raw':!![],'where':{'role':_0x17b5('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x17b5('0x5')],'where':{'role':_0x17b5('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x17b5('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x17b5('0x5')],'where':{'role':_0x17b5('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x17b5('0x5'),'type'],'where':{'type':_0x17b5('0xb')}};function getAssociatedResources(_0x23c025,_0xb8bf61,_0x369bc6){return db[_0x17b5('0xc')][_0x17b5('0xd')]({'where':{'name':_0x23c025,'userProfileId':_0xb8bf61},'raw':!![]})[_0x17b5('0xe')](function(_0x345860){if(_0x345860){if(_0x345860[_0x17b5('0xf')]){switch(_0x23c025){case'VoiceQueues':case'ChatQueues':case'FaxQueues':case _0x17b5('0x10'):case'MailQueues':case _0x17b5('0x11'):case _0x17b5('0x12'):return db[_0x369bc6]['findAll'](queryQueues);case'Telephones':return db[_0x369bc6][_0x17b5('0x13')](queryTelephones);case _0x17b5('0x14'):return db[_0x369bc6][_0x17b5('0x13')](queryTrunks);case _0x17b5('0x15'):return db[_0x369bc6]['findAll'](queryCampaigns);}}else{return db[_0x17b5('0x16')][_0x17b5('0x13')]({'attributes':[_0x17b5('0x17')],'where':{'sectionId':_0x345860['id']},'raw':!![]})[_0x17b5('0xe')](function(_0x2126d1){if(_0x2126d1){var _0x397c9f={'where':{'id':_[_0x17b5('0x18')](_0x2126d1,_0x17b5('0x17'))},'raw':!![]};switch(_0x369bc6){case _0x17b5('0x7'):_0x397c9f[_0x17b5('0x19')][_0x17b5('0x8')]=_0x17b5('0xa');break;case _0x17b5('0x1a'):_0x397c9f[_0x17b5('0x19')]['type']=_0x17b5('0xb');break;}return db[_0x369bc6][_0x17b5('0x13')](_0x397c9f);}else{return[];}});}}else{return[];}})[_0x17b5('0xe')](function(_0x69994d){return _0x69994d;});}function joinOrLeaveQueues(_0x788bd5,_0x200e6f,_0x225de4,_0x58604c){_0x788bd5[_0x200e6f](util[_0x17b5('0x1b')](_0x17b5('0x1c'),_0x225de4,_0x58604c['name']));if(_0x58604c['Agents']){for(var _0x16d9b6=0x0;_0x16d9b6<_0x58604c[_0x17b5('0x6')][_0x17b5('0x1d')];_0x16d9b6+=0x1){_0x788bd5[_0x200e6f](util[_0x17b5('0x1b')](_0x17b5('0x1e'),_0x58604c[_0x17b5('0x6')][_0x16d9b6][_0x17b5('0x5')]));}}}function joinOrLeave(_0x275699,_0x5b07e7,_0x1db91d){var _0x2749f8;if(_0x275699['handshake'][_0x17b5('0x1f')]['id']){db[_0x17b5('0x7')][_0x17b5('0x20')]({'attributes':['id',_0x17b5('0x5'),_0x17b5('0x8'),_0x17b5('0x21')],'where':{'id':_0x275699[_0x17b5('0x22')][_0x17b5('0x1f')]['id']},'include':[{'model':db[_0x17b5('0x23')],'as':_0x17b5('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x17b5('0x25')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x17b5('0x26')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x17b5('0x27')],'as':_0x17b5('0x28'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x17b5('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x17b5('0x2a')],'as':_0x17b5('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x17b5('0xe')](function(_0x1a1994){if(_0x1a1994){_0x2749f8=_0x1a1994;_0x275699[_0x5b07e7](util[_0x17b5('0x1b')](_0x17b5('0x1e'),_0x1a1994['name']));var _0x1da73f=[];switch(_0x1a1994['role']){case _0x17b5('0x2c'):_0x275699[_0x5b07e7](_0x17b5('0x2d'));_0x275699[_0x5b07e7](_0x17b5('0x2e'));if(queryQueues[_0x17b5('0x2f')](_0x17b5('0x30'))){delete queryQueues['include'];}_0x1da73f[_0x17b5('0x31')](db[_0x17b5('0x32')]['findAll'](queryQueues));_0x1da73f['push'](db[_0x17b5('0x33')][_0x17b5('0x13')](queryQueues));_0x1da73f[_0x17b5('0x31')](db[_0x17b5('0x34')][_0x17b5('0x13')](queryQueues));_0x1da73f[_0x17b5('0x31')](db[_0x17b5('0x35')][_0x17b5('0x13')](queryQueues));_0x1da73f[_0x17b5('0x31')](db[_0x17b5('0x36')]['findAll'](queryQueues));_0x1da73f[_0x17b5('0x31')](db['OpenchannelQueue'][_0x17b5('0x13')](queryQueues));_0x1da73f[_0x17b5('0x31')](db['WhatsappQueue'][_0x17b5('0x13')](queryQueues));_0x1da73f[_0x17b5('0x31')](db['User']['findAll'](queryTelephones));_0x1da73f[_0x17b5('0x31')](db[_0x17b5('0x37')][_0x17b5('0x13')](queryTrunks));_0x1da73f[_0x17b5('0x31')](db[_0x17b5('0x1a')][_0x17b5('0x13')](queryCampaigns));_0x1da73f[_0x17b5('0x31')](db[_0x17b5('0x7')][_0x17b5('0x13')](queryAgents));break;case _0x17b5('0x38'):_0x275699[_0x5b07e7]('voice:inbound');_0x275699[_0x5b07e7](_0x17b5('0x2e'));_0x1da73f[_0x17b5('0x31')](getAssociatedResources(_0x17b5('0x39'),_0x1a1994[_0x17b5('0x21')],'VoiceQueue'));_0x1da73f[_0x17b5('0x31')](getAssociatedResources(_0x17b5('0x3a'),_0x1a1994['userProfileId'],_0x17b5('0x33')));_0x1da73f[_0x17b5('0x31')](getAssociatedResources('FaxQueues',_0x1a1994[_0x17b5('0x21')],_0x17b5('0x34')));_0x1da73f['push'](getAssociatedResources(_0x17b5('0x10'),_0x1a1994['userProfileId'],'SmsQueue'));_0x1da73f[_0x17b5('0x31')](getAssociatedResources('MailQueues',_0x1a1994[_0x17b5('0x21')],'MailQueue'));_0x1da73f[_0x17b5('0x31')](getAssociatedResources(_0x17b5('0x11'),_0x1a1994[_0x17b5('0x21')],_0x17b5('0x3b')));_0x1da73f['push'](getAssociatedResources(_0x17b5('0x12'),_0x1a1994[_0x17b5('0x21')],'WhatsappQueue'));_0x1da73f[_0x17b5('0x31')](getAssociatedResources('Telephones',_0x1a1994['userProfileId'],_0x17b5('0x7')));_0x1da73f['push'](getAssociatedResources(_0x17b5('0x14'),_0x1a1994[_0x17b5('0x21')],'Trunk'));_0x1da73f[_0x17b5('0x31')](getAssociatedResources(_0x17b5('0x15'),_0x1a1994[_0x17b5('0x21')],'Campaign'));_0x1da73f[_0x17b5('0x31')](db[_0x17b5('0x7')][_0x17b5('0x13')](queryAgents));break;case _0x17b5('0x9'):_0x275699[_0x5b07e7](_0x17b5('0x2d'));_0x275699[_0x5b07e7](_0x17b5('0x2e'));_0x1da73f['push'](_0x1a1994[_0x17b5('0x3c')]({'attributes':['id','name']}));_0x1da73f['push'](_0x1a1994['getChatQueues']({'attributes':['id','name']}));_0x1da73f['push'](_0x1a1994[_0x17b5('0x3d')]({'attributes':['id','name']}));_0x1da73f[_0x17b5('0x31')](_0x1a1994['getSmsQueues']({'attributes':['id',_0x17b5('0x5')]}));_0x1da73f[_0x17b5('0x31')](_0x1a1994[_0x17b5('0x3e')]({'attributes':['id','name']}));_0x1da73f[_0x17b5('0x31')](_0x1a1994['getOpenchannelQueues']({'attributes':['id',_0x17b5('0x5')]}));_0x1da73f[_0x17b5('0x31')](_0x1a1994[_0x17b5('0x3f')]({'attributes':['id',_0x17b5('0x5')]}));break;}return BPromise[_0x17b5('0x40')](_0x1da73f);}})[_0x17b5('0xe')](function(_0x3edf1b){if(_0x3edf1b&&_0x3edf1b['length']){for(var _0x3886d4=0x0;_0x3886d4<_0x3edf1b[_0x17b5('0x1d')];_0x3886d4+=0x1){for(var _0x122284=0x0;_0x122284<_0x3edf1b[_0x3886d4]['length'];_0x122284+=0x1){switch(_0x3886d4){case 0x0:joinOrLeaveQueues(_0x275699,_0x5b07e7,_0x17b5('0x41'),_0x3edf1b[_0x3886d4][_0x122284]);break;case 0x1:joinOrLeaveQueues(_0x275699,_0x5b07e7,_0x17b5('0x42'),_0x3edf1b[_0x3886d4][_0x122284]);break;case 0x2:joinOrLeaveQueues(_0x275699,_0x5b07e7,_0x17b5('0x43'),_0x3edf1b[_0x3886d4][_0x122284]);break;case 0x3:joinOrLeaveQueues(_0x275699,_0x5b07e7,_0x17b5('0x44'),_0x3edf1b[_0x3886d4][_0x122284]);break;case 0x4:joinOrLeaveQueues(_0x275699,_0x5b07e7,_0x17b5('0x45'),_0x3edf1b[_0x3886d4][_0x122284]);break;case 0x5:joinOrLeaveQueues(_0x275699,_0x5b07e7,_0x17b5('0x46'),_0x3edf1b[_0x3886d4][_0x122284]);break;case 0x6:joinOrLeaveQueues(_0x275699,_0x5b07e7,_0x17b5('0x47'),_0x3edf1b[_0x3886d4][_0x122284]);break;case 0x7:_0x275699[_0x5b07e7](util[_0x17b5('0x1b')]('telephone:%s',_0x3edf1b[_0x3886d4][_0x122284]['name']));break;case 0x8:_0x275699[_0x5b07e7](util[_0x17b5('0x1b')](_0x17b5('0x48'),_0x3edf1b[_0x3886d4][_0x122284][_0x17b5('0x5')]));break;case 0x9:_0x275699[_0x5b07e7](util[_0x17b5('0x1b')]('campaign:%s:%s',_0x3edf1b[_0x3886d4][_0x122284][_0x17b5('0x49')],_0x3edf1b[_0x3886d4][_0x122284]['name']));break;case 0xa:_0x275699[_0x5b07e7](util['format']('user:%s',_0x3edf1b[_0x3886d4][_0x122284][_0x17b5('0x5')]));break;}}}}})[_0x17b5('0xe')](function(){if(_0x5b07e7==='leave'){var _0x523255=_['map'](_0x2749f8[_0x17b5('0x24')],'id');return _0x2749f8[_0x17b5('0x4a')](_0x523255)[_0x17b5('0xe')](function(){for(var _0x18c100=0x0;_0x18c100<_0x523255[_0x17b5('0x1d')];_0x18c100+=0x1){_0x1db91d[_0x17b5('0x4b')](_0x17b5('0x4c'),{'ChatInteractionId':Number(_0x523255[_0x18c100]),'UserId':Number(_0x2749f8['id'])});}});}})[_0x17b5('0xe')](function(){if(_0x5b07e7===_0x17b5('0x4d')){var _0x5a083d=_[_0x17b5('0x18')](_0x2749f8[_0x17b5('0x4e')],'id');return _0x2749f8['removeMailInteractions'](_0x5a083d)['then'](function(){for(var _0x580d43=0x0;_0x580d43<_0x5a083d[_0x17b5('0x1d')];_0x580d43+=0x1){_0x1db91d[_0x17b5('0x4b')](_0x17b5('0x4f'),{'MailInteractionId':Number(_0x5a083d[_0x580d43]),'UserId':Number(_0x2749f8['id'])});}});}})[_0x17b5('0xe')](function(){if(_0x5b07e7===_0x17b5('0x4d')){var _0x198d62=_['map'](_0x2749f8[_0x17b5('0x50')],'id');return _0x2749f8[_0x17b5('0x51')](_0x198d62)['then'](function(){for(var _0x3c464a=0x0;_0x3c464a<_0x198d62['length'];_0x3c464a+=0x1){_0x1db91d['emit'](_0x17b5('0x52'),{'FaxInteractionId':Number(_0x198d62[_0x3c464a]),'UserId':Number(_0x2749f8['id'])});}});}})['then'](function(){if(_0x5b07e7==='leave'){var _0x124835=_[_0x17b5('0x18')](_0x2749f8[_0x17b5('0x28')],'id');return _0x2749f8[_0x17b5('0x53')](_0x124835)[_0x17b5('0xe')](function(){for(var _0x403ee0=0x0;_0x403ee0<_0x124835['length'];_0x403ee0+=0x1){_0x1db91d[_0x17b5('0x4b')](_0x17b5('0x54'),{'SmsInteractionId':Number(_0x124835[_0x403ee0]),'UserId':Number(_0x2749f8['id'])});}});}})[_0x17b5('0xe')](function(){if(_0x5b07e7===_0x17b5('0x4d')){var _0x4a7e22=_[_0x17b5('0x18')](_0x2749f8[_0x17b5('0x29')],'id');return _0x2749f8['removeOpenchannelInteractions'](_0x4a7e22)['then'](function(){for(var _0x4b24d7=0x0;_0x4b24d7<_0x4a7e22['length'];_0x4b24d7+=0x1){_0x1db91d[_0x17b5('0x4b')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x4a7e22[_0x4b24d7]),'UserId':Number(_0x2749f8['id'])});}});}})['then'](function(){if(_0x5b07e7==='leave'){var _0x266422=_['map'](_0x2749f8[_0x17b5('0x2b')],'id');return _0x2749f8[_0x17b5('0x55')](_0x266422)[_0x17b5('0xe')](function(){for(var _0x29b7cf=0x0;_0x29b7cf<_0x266422[_0x17b5('0x1d')];_0x29b7cf+=0x1){_0x1db91d['emit'](_0x17b5('0x56'),{'WhatsappInteractionId':Number(_0x266422[_0x29b7cf]),'UserId':Number(_0x2749f8['id'])});}});}})[_0x17b5('0x57')](function(_0x44e112){_0x275699[_0x17b5('0x58')](_0x44e112);});}}function onDisconnect(_0x4379f1,_0x179142){joinOrLeave(_0x4379f1,_0x17b5('0x4d'),_0x179142);}function onConnect(_0x1a1e56){joinOrLeave(_0x1a1e56,_0x17b5('0x59'));}exports[_0x17b5('0x5a')]=function(_0x310950){_0x310950['on'](_0x17b5('0x5b'),function(_0x38bda7){_0x38bda7[_0x17b5('0x5c')](0x0);_0x38bda7[_0x17b5('0x5d')]=_0x38bda7['request']['connection'][_0x17b5('0x5e')]+':'+_0x38bda7[_0x17b5('0x5f')][_0x17b5('0x5b')][_0x17b5('0x60')];_0x38bda7[_0x17b5('0x61')]=new Date();_0x38bda7[_0x17b5('0x58')]=function(_0xfcb10d){console[_0x17b5('0x58')](_0x17b5('0x62')+_0x38bda7['nsp']['name']+'['+_0x38bda7[_0x17b5('0x5d')]+']',_0xfcb10d);};_0x38bda7['on'](_0x17b5('0x63'),function(){onDisconnect(_0x38bda7,_0x310950);_0x38bda7[_0x17b5('0x58')](_0x17b5('0x64'));});onConnect(_0x38bda7);_0x38bda7[_0x17b5('0x58')](_0x17b5('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index f42a19b..29d3138 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 _0x7dbc=['channel','incomingmessage','catch','outgoingmessage','opened','changed','closed','default','length','hasOwnProperty','model','hook','callback','toLowerCase','util','../../mysqldb','../logger','client','http','Chat','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','Openchannel','OpenchannelInteraction','request','EventManager','then','info','Trigger,\x20%s','error','get','event','direction','UserId','User','find','name','interface','format','SIP/%s'];(function(_0x13867b,_0x78fef2){var _0x42c7cb=function(_0x13f5c8){while(--_0x13f5c8){_0x13867b['push'](_0x13867b['shift']());}};_0x42c7cb(++_0x78fef2);}(_0x7dbc,0x152));var _0xc7db=function(_0x2d8e56,_0xfbc90d){_0x2d8e56=_0x2d8e56-0x0;var _0x1cabfd=_0x7dbc[_0x2d8e56];return _0x1cabfd;};'use strict';var util=require(_0xc7db('0x0'));var db=require(_0xc7db('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0xc7db('0x2'))('triggers');var client=jayson[_0xc7db('0x3')][_0xc7db('0x4')]({'port':0x232a});var triggers=[{'channel':_0xc7db('0x5'),'model':'ChatInteraction','event':_0xc7db('0x6'),'condition':_0xc7db('0x7'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':_0xc7db('0x8'),'condition':_0xc7db('0x9'),'callback':afterUpdate},{'channel':_0xc7db('0x5'),'model':_0xc7db('0xa'),'event':_0xc7db('0x6'),'condition':_0xc7db('0xb'),'callback':afterCreateMessage},{'channel':_0xc7db('0xc'),'model':_0xc7db('0xd'),'event':_0xc7db('0x6'),'condition':_0xc7db('0x7'),'callback':afterCreate},{'channel':_0xc7db('0xc'),'model':'SmsInteraction','event':_0xc7db('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':_0xc7db('0xe'),'event':_0xc7db('0x6'),'condition':_0xc7db('0xb'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0xc7db('0x6'),'condition':_0xc7db('0x7'),'callback':afterCreate},{'channel':_0xc7db('0xf'),'model':_0xc7db('0x10'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xc7db('0xf'),'model':_0xc7db('0x11'),'event':'afterCreate','condition':_0xc7db('0xb'),'callback':afterCreateMessage},{'channel':_0xc7db('0x12'),'model':_0xc7db('0x13'),'event':_0xc7db('0x6'),'condition':_0xc7db('0x7'),'callback':afterCreate},{'channel':_0xc7db('0x12'),'model':_0xc7db('0x13'),'event':_0xc7db('0x8'),'condition':_0xc7db('0x9'),'callback':afterUpdate},{'channel':_0xc7db('0x12'),'model':'FaxMessage','event':'afterCreate','condition':_0xc7db('0xb'),'callback':afterCreateMessage},{'channel':_0xc7db('0x14'),'model':_0xc7db('0x15'),'event':_0xc7db('0x6'),'condition':_0xc7db('0x7'),'callback':afterCreate},{'channel':'Mail','model':_0xc7db('0x15'),'event':_0xc7db('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':_0xc7db('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xc7db('0x16'),'model':_0xc7db('0x17'),'event':_0xc7db('0x6'),'condition':_0xc7db('0x7'),'callback':afterCreate},{'channel':'Openchannel','model':_0xc7db('0x17'),'event':_0xc7db('0x8'),'condition':_0xc7db('0x9'),'callback':afterUpdate},{'channel':_0xc7db('0x16'),'model':'OpenchannelMessage','event':_0xc7db('0x6'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x299876){return client[_0xc7db('0x18')](_0xc7db('0x19'),_0x299876)[_0xc7db('0x1a')](function(_0x55969f){logger[_0xc7db('0x1b')](_0xc7db('0x1c'),_0xc7db('0x19'),_0x55969f);if(_0x55969f['error']){if(_0x55969f[_0xc7db('0x1d')]['code']===0x1f4){logger[_0xc7db('0x1d')]('Trigger,\x20%s',_0xc7db('0x19'),_0x55969f[_0xc7db('0x1d')]);}}})['catch'](function(_0xe80eb6){logger['error'](_0xc7db('0x1c'),'EventManager',_0xe80eb6);});}function afterCreateMessage(_0x6676ec,_0x39da1f){return function(_0x56e06e,_0x13c80a){_0x56e06e=_0x56e06e[_0xc7db('0x1e')]({'plain':!![]});_0x56e06e['channel']=_0x6676ec;_0x56e06e[_0xc7db('0x1f')]=_0x56e06e[_0xc7db('0x20')];if(_0x56e06e[_0xc7db('0x21')]){return db[_0xc7db('0x22')][_0xc7db('0x23')]({'where':{'id':_0x56e06e[_0xc7db('0x21')]},'attributes':['id',_0xc7db('0x24')],'raw':!![]})[_0xc7db('0x1a')](function(_0x767b7b){_0x56e06e[_0xc7db('0x25')]=util[_0xc7db('0x26')](_0xc7db('0x27'),_0x767b7b[_0xc7db('0x24')]);_0x56e06e[_0xc7db('0x28')]=_0x6676ec;return request({'event':_0xc7db('0x29'),'message':_0x56e06e});})[_0xc7db('0x2a')](function(_0x1acdb9){console[_0xc7db('0x1d')](_0x1acdb9);});}else{return request({'event':_0xc7db('0x2b'),'message':_0x56e06e});}};}function afterCreate(_0x5e2189,_0x5209db){return function(_0x3740db,_0x1021ca){_0x3740db=_0x3740db['get']({'plain':!![]});_0x3740db['channel']=_0x5e2189;_0x3740db[_0xc7db('0x1f')]=_0xc7db('0x2c');return request({'event':_0x5209db,'message':_0x3740db});};}function afterUpdate(_0x3d13de,_0x14a5fb){return function(_0x1e72ed,_0x22140c){if(_0x1e72ed[_0xc7db('0x2d')](_0xc7db('0x2e'))&&_0x1e72ed['closed']){_0x1e72ed=_0x1e72ed[_0xc7db('0x1e')]({'plain':!![]});_0x1e72ed[_0xc7db('0x28')]=_0x3d13de;_0x1e72ed[_0xc7db('0x1f')]='closed';if(_0x1e72ed[_0xc7db('0x21')]){return db[_0xc7db('0x22')][_0xc7db('0x23')]({'where':{'id':_0x1e72ed['UserId']},'attributes':['id',_0xc7db('0x24')],'raw':!![]})[_0xc7db('0x1a')](function(_0x3e7e31){_0x1e72ed[_0xc7db('0x25')]=util[_0xc7db('0x26')](_0xc7db('0x27'),_0x3e7e31[_0xc7db('0x24')]);return request({'event':_0x14a5fb,'message':_0x1e72ed});})[_0xc7db('0x2a')](function(_0x15a54f){console[_0xc7db('0x1d')](_0x15a54f);});}else{return request({'event':_0x14a5fb,'message':_0x1e72ed});}}};}exports[_0xc7db('0x2f')]=function(){for(var _0x2a3db6=0x0;_0x2a3db6=_0xbb5220[_0xe6b2('0x13')]){throw Error(_0xe6b2('0x14'));}_0x11232c(_0x1c5e96);})[_0xe6b2('0x15')](function(_0x50b8fe){_0x551c66(_0x50b8fe);});});}; \ No newline at end of file +var _0x3040=['sms','whatsapp','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','User','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','voice','fax'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3040,0x87));var _0x0304=function(_0x3d4d41,_0x2ee486){_0x3d4d41=_0x3d4d41-0x0;var _0x20d879=_0x3040[_0x3d4d41];return _0x20d879;};'use strict';var _=require(_0x0304('0x0'));var BPromise=require(_0x0304('0x1'));var db=require(_0x0304('0x2'))['db'];var util=require('./license/util');var channels=[_0x0304('0x3'),'mail','chat',_0x0304('0x4'),_0x0304('0x5'),_0x0304('0x6'),'openchannel'];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x5e78a2){_0x5e78a2=_0x5e78a2[_0x0304('0x7')]();return _['includes'](channels,_0x5e78a2);};exports[_0x0304('0x8')]=function(_0x448c72,_0x52b951,_0x4c82eb,_0x8376c9){var _0x5844bf={'loginAttempts':_0x52b951,'blocked':_0x4c82eb};if(!_[_0x0304('0x9')](_0x8376c9)){_0x5844bf[_0x0304('0xa')]=_0x8376c9;}return _0x448c72[_0x0304('0xb')](_0x5844bf);};exports[_0x0304('0xc')]=function(_0x1375ab){return new BPromise(function(_0x31276f,_0x272f1c){var _0x24f4eb=0x0;if(_0x1375ab['role']!=='agent'){_0x31276f(_0x1375ab);}db[_0x0304('0xd')][_0x0304('0xe')]({'where':{'role':_0x0304('0xf'),'online':!![],'id':{'$ne':_0x1375ab['id']}}})[_0x0304('0x10')](function(_0xfc4e67){_0x24f4eb=_0xfc4e67;return util[_0x0304('0xc')]();})[_0x0304('0x10')](function(_0x331d88){if(_0x331d88&&_0x331d88[_0x0304('0x11')]&&_0x24f4eb>=_0x331d88[_0x0304('0x11')]){throw Error(_0x0304('0x12'));}_0x31276f(_0x1375ab);})[_0x0304('0x13')](function(_0x36097c){_0x272f1c(_0x36097c);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 371bb74..b191efe 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9587=['404','status','render','exports'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x9587,0x173));var _0x7958=function(_0x305c8f,_0xc5f7fb){_0x305c8f=_0x305c8f-0x0;var _0x5ddc30=_0x9587[_0x305c8f];return _0x5ddc30;};'use strict';module[_0x7958('0x0')][0x194]=function pageNotFound(_0x9c388d,_0x3d7c41){var _0x645fa9=_0x7958('0x1');var _0x152bab=0x194;var _0x176cd1={'status':_0x152bab};_0x3d7c41[_0x7958('0x2')](_0x176cd1['status']);_0x3d7c41[_0x7958('0x3')](_0x645fa9,{},function(_0x2e8f13,_0x59e816){if(_0x2e8f13){return _0x3d7c41[_0x7958('0x2')](_0x176cd1[_0x7958('0x2')])['json'](_0x176cd1);}_0x3d7c41['send'](_0x59e816);});}; \ No newline at end of file +var _0xd0e6=['404','status','json','exports'];(function(_0x2944b1,_0x41311c){var _0x838697=function(_0x5754f2){while(--_0x5754f2){_0x2944b1['push'](_0x2944b1['shift']());}};_0x838697(++_0x41311c);}(_0xd0e6,0xb7));var _0x6d0e=function(_0x2bd20f,_0x4d6277){_0x2bd20f=_0x2bd20f-0x0;var _0x613789=_0xd0e6[_0x2bd20f];return _0x613789;};'use strict';module[_0x6d0e('0x0')][0x194]=function pageNotFound(_0x2338ee,_0x188e62){var _0x3c07f6=_0x6d0e('0x1');var _0xee4a6e=0x194;var _0x2d8453={'status':_0xee4a6e};_0x188e62[_0x6d0e('0x2')](_0x2d8453['status']);_0x188e62['render'](_0x3c07f6,{},function(_0x5398c7,_0x447c09){if(_0x5398c7){return _0x188e62['status'](_0x2d8453[_0x6d0e('0x2')])[_0x6d0e('0x3')](_0x2d8453);}_0x188e62['send'](_0x447c09);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index ff0deae..4d6f434 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa8d=['DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','CmList','../api/cmList/cmList.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','../api/notification/notification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','hasOne','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','ChatInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueue','ChatQueues','UserChatQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueue','Members','VoiceQueueId','CmHopperBlack','HopperBlacks','JscriptySessionReport','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','UserVoiceQueue','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','mailbox','mailboxuser','QueueCalls','uniqueid','AgentReports','ContactId','MailServerIn','Imap','Smtp','Dispositions','MailAccountId','CannedAnswer','Interactions','ListId','TemplateId','Agents','team_has_mail_queues','Messages','Account','Contact','Owner','Tag','mail_interaction_has_tags','Tags','Interaction','MailInteractionId','MailApplication','restrict','TagId','MailQueueReport','List','Items','FaxAccountId','Answers','Exntensions','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','Users','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsite','ChatWebsiteId','ProactiveActions','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','CompanyId','Hoppers','HopperHistories','JscriptySessions','Company','cm_contact_has_tags','OwnerId','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','MailApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','sms_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','Field','VariableId','DescriptionId','SugarcrmAccount','DeskField','int_desk_configuration_has_tags','ZendeskField','int_zendesk_configuration_has_tags','FreshsalesAccount','FromId','ToId','SessionId','SmsQueueReport','ProjectId','MailQueues','TrunkBackupId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAgent','FromChatWebsiteId','FromAccount','FromUserId','ToChatQueueId','ToQueue','ToAccount','FaxTransferReport','ToUserId','ToAgent','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','UserProfileSection','UserProfileSections','Resources','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','path','../config/environment','sequelize','lodash','jstz','motion2','xcall','127.0.0.1','utf8mb4','sequelizeHistory','xC@LL1234','mysql','name','password','options','database','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../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','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model'];(function(_0x5b8968,_0x2a599a){var _0x26526d=function(_0x478e34){while(--_0x478e34){_0x5b8968['push'](_0x5b8968['shift']());}};_0x26526d(++_0x2a599a);}(_0xaa8d,0x147));var _0xdaa8=function(_0x3c3982,_0x163010){_0x3c3982=_0x3c3982-0x0;var _0x66448f=_0xaa8d[_0x3c3982];return _0x66448f;};'use strict';var path=require(_0xdaa8('0x0'));var config=require(_0xdaa8('0x1'));var Sequelize=require(_0xdaa8('0x2'));var _=require(_0xdaa8('0x3'));var jstz=require(_0xdaa8('0x4'));var timezone=jstz['determine']();config[_0xdaa8('0x2')]=_['defaultsDeep'](config[_0xdaa8('0x2')],{'database':_0xdaa8('0x5'),'username':_0xdaa8('0x6'),'password':'xC@LL1234','options':{'host':_0xdaa8('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xdaa8('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config['sequelizeHistory']=_['defaultsDeep'](config[_0xdaa8('0x9')],{'database':_0xdaa8('0x5'),'username':'xcall','password':_0xdaa8('0xa'),'options':{'host':_0xdaa8('0x7'),'port':0xcea,'dialect':_0xdaa8('0xb'),'dialectOptions':{'charset':_0xdaa8('0x8')},'logging':![],'timezone':timezone[_0xdaa8('0xc')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xdaa8('0x2')]['database'],config[_0xdaa8('0x2')]['username'],config['sequelize'][_0xdaa8('0xd')],config[_0xdaa8('0x2')][_0xdaa8('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xdaa8('0x9')][_0xdaa8('0xf')],config[_0xdaa8('0x9')][_0xdaa8('0x10')],config['sequelizeHistory'][_0xdaa8('0xd')],config[_0xdaa8('0x9')][_0xdaa8('0xe')])};db[_0xdaa8('0x11')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x13'));db[_0xdaa8('0x14')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x15'));db[_0xdaa8('0x16')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x17'));db['VoiceExtension']=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x18'));db[_0xdaa8('0x19')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x1a'));db['VoiceQueue']=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x1b'));db['VoiceRecording']=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x1c'));db[_0xdaa8('0x1d')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x1e'));db[_0xdaa8('0x1f')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x20'));db[_0xdaa8('0x21')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x22'));db[_0xdaa8('0x23')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/voiceCallReport/voiceCallReport.model');db[_0xdaa8('0x24')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x25'));db[_0xdaa8('0x26')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x27'));db[_0xdaa8('0x28')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x29'));db['MemberReport']=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/memberReport/memberReport.model');db[_0xdaa8('0x2a')]=db[_0xdaa8('0x2')]['import']('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x2b'));db[_0xdaa8('0x2c')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x2d'));db['UserVoiceQueue']=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x2e'));db['UserChatQueue']=db['sequelize'][_0xdaa8('0x12')]('../api/userChatQueue/userChatQueue.model');db[_0xdaa8('0x2f')]=db['sequelize']['import'](_0xdaa8('0x30'));db[_0xdaa8('0x31')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x32'));db[_0xdaa8('0x33')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x34'));db[_0xdaa8('0x35')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x36'));db[_0xdaa8('0x37')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db['sequelize']['import']('../api/mailServerIn/mailServerIn.model');db[_0xdaa8('0x38')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x39'));db[_0xdaa8('0x3a')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x3b'));db['MailQueue']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x3c'));db['MailSubstatus']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x3d'));db[_0xdaa8('0x3e')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x3f'));db[_0xdaa8('0x40')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x41'));db['MailApplication']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x42'));db['MailQueueReport']=db['sequelize']['import'](_0xdaa8('0x43'));db['Dashboard']=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x44'));db[_0xdaa8('0x45')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x46'));db[_0xdaa8('0x47')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/faxAccount/faxAccount.model');db[_0xdaa8('0x48')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x49'));db['FaxInteraction']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x4a'));db[_0xdaa8('0x4b')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x4c'));db[_0xdaa8('0x4d')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x4e'));db[_0xdaa8('0x4f')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x50'));db[_0xdaa8('0x51')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x52'));db[_0xdaa8('0x53')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x54'));db[_0xdaa8('0x55')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x56'));db[_0xdaa8('0x57')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x58'));db[_0xdaa8('0x59')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x5a'));db[_0xdaa8('0x5b')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/openchannelAccount/openchannelAccount.model');db[_0xdaa8('0x5c')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x5d'));db[_0xdaa8('0x5e')]=db[_0xdaa8('0x2')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0xdaa8('0x5f')]=db[_0xdaa8('0x2')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0xdaa8('0x60')]=db['sequelize']['import'](_0xdaa8('0x61'));db['ChatWebsite']=db[_0xdaa8('0x2')]['import']('../api/chatWebsite/chatWebsite.model');db[_0xdaa8('0x62')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xdaa8('0x63')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x64'));db[_0xdaa8('0x65')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x66'));db[_0xdaa8('0x67')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x68'));db['ChatOfflineMessage']=db['sequelize'][_0xdaa8('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xdaa8('0x69')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x6a'));db[_0xdaa8('0x6b')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x6c'));db[_0xdaa8('0x6d')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x6e'));db['CmCompany']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x6f'));db[_0xdaa8('0x70')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x71'));db[_0xdaa8('0x72')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x73'));db['CmHopperBlack']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x74'));db[_0xdaa8('0x75')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x76'));db[_0xdaa8('0x77')]=db[_0xdaa8('0x2')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0xdaa8('0x78')]=db['sequelize'][_0xdaa8('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xdaa8('0x79')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x7a'));db['Action']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x7b'));db[_0xdaa8('0x7c')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x7d'));db['CannedAnswer']=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x7e'));db[_0xdaa8('0x7f')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x80'));db[_0xdaa8('0x81')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x82'));db[_0xdaa8('0x83')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/interval/interval.model');db[_0xdaa8('0x84')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x85'));db[_0xdaa8('0x86')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x87'));db[_0xdaa8('0x88')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x89'));db['Schedule']=db['sequelize']['import'](_0xdaa8('0x8a'));db[_0xdaa8('0x8b')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x8c'));db['Tag']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x8d'));db[_0xdaa8('0x8e')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/template/template.model');db[_0xdaa8('0x8f')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x90'));db[_0xdaa8('0x91')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x92'));db[_0xdaa8('0x93')]=db[_0xdaa8('0x2')]['import']('../api/integration/integration.model');db[_0xdaa8('0x94')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/integrationReport/integrationReport.model');db[_0xdaa8('0x95')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x96'));db[_0xdaa8('0x97')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x98'));db[_0xdaa8('0x99')]=db['sequelize']['import'](_0xdaa8('0x9a'));db[_0xdaa8('0x9b')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x9c'));db['AnalyticFieldReport']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x9d'));db[_0xdaa8('0x9e')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x9f'));db[_0xdaa8('0xa0')]=db[_0xdaa8('0x2')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xdaa8('0xa1')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xdaa8('0xa2')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xa3'));db['SugarcrmAccount']=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xa4'));db[_0xdaa8('0xa5')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xa6'));db[_0xdaa8('0xa7')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xa8'));db[_0xdaa8('0xa9')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xaa'));db[_0xdaa8('0xab')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xac'));db['DeskField']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xad'));db[_0xdaa8('0xae')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xaf'));db[_0xdaa8('0xb0')]=db['sequelize']['import'](_0xdaa8('0xb1'));db[_0xdaa8('0xb2')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xb3'));db[_0xdaa8('0xb4')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xb5'));db[_0xdaa8('0xb6')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xb7'));db['ZendeskField']=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/intZendeskField/intZendeskField.model');db[_0xdaa8('0xb8')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xb9'));db[_0xdaa8('0xba')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xbb'));db[_0xdaa8('0xbc')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xbd'));db[_0xdaa8('0xbe')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xdaa8('0xbf')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xc0'));db[_0xdaa8('0xc1')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xc2'));db[_0xdaa8('0xc3')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xc4'));db[_0xdaa8('0xc5')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xc6'));db[_0xdaa8('0xc7')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0xdaa8('0xc8')]=db['sequelize'][_0xdaa8('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xdaa8('0xc9')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xca'));db[_0xdaa8('0xcb')]=db['sequelize']['import'](_0xdaa8('0xcc'));db['FreshsalesAccount']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xcd'));db[_0xdaa8('0xce')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xcf'));db[_0xdaa8('0xd0')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xd1'));db[_0xdaa8('0x93')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xd2'));db['Network']=db['sequelize']['import']('../api/network/network.model');db[_0xdaa8('0xd3')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xd4'));db[_0xdaa8('0xd5')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xd6'));db[_0xdaa8('0xd7')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xd8'));db[_0xdaa8('0xd9')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xda'));db['JscriptySessionReport']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xdb'));db['SmsQueueReport']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xdc'));db[_0xdaa8('0xdd')]=db['sequelize']['import'](_0xdaa8('0xde'));db['SquareDetailsReport']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xdf'));db[_0xdaa8('0xe0')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/jscriptyProject/jscriptyProject.model');db[_0xdaa8('0xe1')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xe2'));db['SquareOdbc']=db['sequelize'][_0xdaa8('0x12')]('../api/squareOdbc/squareOdbc.model');db[_0xdaa8('0xe3')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xe4'));db['SquareRecording']=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xe5'));db[_0xdaa8('0xe6')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xe7'));db[_0xdaa8('0xe8')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xe9'));db['License']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xea'));db[_0xdaa8('0xeb')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xec'));db[_0xdaa8('0xed')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xee'));db[_0xdaa8('0xef')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/attachment/attachment.model');db[_0xdaa8('0xf0')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xf1'));db[_0xdaa8('0xf2')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xf3'));db[_0xdaa8('0xf4')]=db['sequelize'][_0xdaa8('0x12')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xf5'));db[_0xdaa8('0xf6')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0xdaa8('0x2')]['import']('../api/smsTransferReport/smsTransferReport.model');db[_0xdaa8('0xf7')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xf8'));db['VoicePrefix']=db['sequelize']['import']('../api/voicePrefix/voicePrefix.model');db[_0xdaa8('0xf9')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xfa'));db['UserProfileSection']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xfb'));db[_0xdaa8('0xfc')]=db['sequelize'][_0xdaa8('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0xdaa8('0xfd')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xfe'));db[_0xdaa8('0xff')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/whatsappAccount/whatsappAccount.model');db[_0xdaa8('0x100')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x101'));db[_0xdaa8('0x102')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x103'));db['WhatsappMessage']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x104'));db[_0xdaa8('0x105')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x106'));db[_0xdaa8('0x107')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x108'));db[_0xdaa8('0x109')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x10a'));db[_0xdaa8('0x10b')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/cloudProvider/cloudProvider.model');db[_0xdaa8('0x11')][_0xdaa8('0x10c')](db[_0xdaa8('0x1f')],{'as':_0xdaa8('0x1f'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x10e')});db['User'][_0xdaa8('0x10f')](db[_0xdaa8('0x110')],{'as':_0xdaa8('0x111'),'foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x11')]['hasMany'](db[_0xdaa8('0x2c')],{'as':_0xdaa8('0x112'),'foreignKey':'UserId'});db[_0xdaa8('0x11')]['hasMany'](db[_0xdaa8('0x113')],{'as':_0xdaa8('0x114'),'onDelete':_0xdaa8('0x10d'),'hooks':!![]});db['User'][_0xdaa8('0x10f')](db[_0xdaa8('0x75')],{'as':_0xdaa8('0x115'),'foreignKey':'UserId'});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db['CmHopperHistory'],{'as':_0xdaa8('0x116'),'foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db[_0xdaa8('0x78')],{'as':'ReportAgentPreview','foreignKey':_0xdaa8('0x10e')});db['User'][_0xdaa8('0x10f')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db[_0xdaa8('0x65')],{'as':_0xdaa8('0x117'),'foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db[_0xdaa8('0x118')],{'as':_0xdaa8('0x119'),'foreignKey':'UserId'});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db[_0xdaa8('0x3e')],{'as':_0xdaa8('0x11a'),'foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db[_0xdaa8('0x102')],{'as':_0xdaa8('0x11b'),'foreignKey':'UserId'});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db['Notification'],{'as':_0xdaa8('0x11c'),'foreignKey':_0xdaa8('0x11d')});db[_0xdaa8('0x11')][_0xdaa8('0x11e')](db[_0xdaa8('0xf9')],{'as':_0xdaa8('0xf9'),'foreignKey':_0xdaa8('0x11f')});db['User'][_0xdaa8('0x120')](db[_0xdaa8('0x6b')],{'as':_0xdaa8('0x121'),'through':_0xdaa8('0x122')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['CmContact'],{'as':_0xdaa8('0x123'),'through':_0xdaa8('0x124')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['CmList'],{'as':_0xdaa8('0x125'),'through':_0xdaa8('0x126')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0xe8')],{'through':'user_has_teams'});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0x3e')],{'as':_0xdaa8('0x11a'),'through':_0xdaa8('0x127')});db['User']['belongsToMany'](db[_0xdaa8('0x65')],{'as':_0xdaa8('0x117'),'through':_0xdaa8('0x128')});db[_0xdaa8('0x11')]['belongsToMany'](db[_0xdaa8('0x118')],{'as':_0xdaa8('0x119'),'through':_0xdaa8('0x129')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0x55')],{'as':_0xdaa8('0x12a'),'through':_0xdaa8('0x12b')});db[_0xdaa8('0x11')]['belongsToMany'](db[_0xdaa8('0x5e')],{'as':_0xdaa8('0x12c'),'through':_0xdaa8('0x12d')});db[_0xdaa8('0x11')]['belongsToMany'](db[_0xdaa8('0x102')],{'as':'WhatsappInteractions','through':_0xdaa8('0x12e')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['VoiceQueue'],{'as':_0xdaa8('0x12f'),'through':'UserVoiceQueue','required':![]});db['User'][_0xdaa8('0x120')](db[_0xdaa8('0x130')],{'as':'MailQueues','through':_0xdaa8('0x2f'),'required':![]});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['ChatQueue'],{'as':_0xdaa8('0x131'),'through':_0xdaa8('0x132'),'required':![],'hooks':!![]});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['FaxQueue'],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['SmsQueue'],{'as':_0xdaa8('0x133'),'through':_0xdaa8('0x33'),'required':![]});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['OpenchannelQueue'],{'as':_0xdaa8('0x134'),'through':_0xdaa8('0x35'),'required':![]});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0x109')],{'as':_0xdaa8('0x135'),'through':_0xdaa8('0x37'),'required':![]});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0xf7')],{'through':'cm_user_has_lists'});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0x136')],{'as':_0xdaa8('0x137'),'through':_0xdaa8('0x138'),'required':![]});db[_0xdaa8('0x11')]['belongsToMany'](db['ChatWebsite'],{'as':_0xdaa8('0x139'),'through':_0xdaa8('0x13a')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0x47')],{'as':_0xdaa8('0x13b'),'through':_0xdaa8('0x13c')});db['User'][_0xdaa8('0x120')](db['MailAccount'],{'as':_0xdaa8('0x13d'),'through':_0xdaa8('0x13e')});db['User']['belongsToMany'](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0xdaa8('0x13f')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['SmsAccount'],{'as':_0xdaa8('0x140'),'through':_0xdaa8('0x141')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['WhatsappAccount'],{'as':_0xdaa8('0x142'),'through':_0xdaa8('0x143')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0xe3')],{'as':_0xdaa8('0x144'),'through':_0xdaa8('0x145')});db[_0xdaa8('0x14')][_0xdaa8('0x10f')](db[_0xdaa8('0x113')],{'as':_0xdaa8('0x146'),'onDelete':'cascade','foreignKey':_0xdaa8('0x147')});db[_0xdaa8('0x16')]['hasMany'](db[_0xdaa8('0x113')],{'onDelete':'cascade'});db[_0xdaa8('0x113')][_0xdaa8('0x10f')](db[_0xdaa8('0x113')],{'as':_0xdaa8('0x148'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x19')][_0xdaa8('0x120')](db[_0xdaa8('0x8b')],{'as':_0xdaa8('0x149'),'through':_0xdaa8('0x14a')});db[_0xdaa8('0x14b')][_0xdaa8('0x10f')](db[_0xdaa8('0x2c')],{'as':_0xdaa8('0x14c'),'foreignKey':_0xdaa8('0x14d')});db[_0xdaa8('0x14b')][_0xdaa8('0x10f')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xdaa8('0x14d')});db[_0xdaa8('0x14b')][_0xdaa8('0x10f')](db['CmHopperFinal'],{'as':_0xdaa8('0x115'),'foreignKey':_0xdaa8('0x14d')});db[_0xdaa8('0x14b')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0xdaa8('0x14b')]['hasMany'](db['ReportAgentPreview'],{'as':_0xdaa8('0x78'),'foreignKey':'VoiceQueueId'});db[_0xdaa8('0x14b')]['hasMany'](db[_0xdaa8('0x14e')],{'as':_0xdaa8('0x14f'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xdaa8('0x10f')](db[_0xdaa8('0x150')],{'as':'JscriptySessions','foreignKey':_0xdaa8('0x14d')});db['VoiceQueue']['belongsTo'](db[_0xdaa8('0x2a')],{'as':_0xdaa8('0x2a'),'foreignKey':'TrunkId'});db[_0xdaa8('0x14b')][_0xdaa8('0x11e')](db[_0xdaa8('0x2a')],{'as':_0xdaa8('0x151'),'foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0xdaa8('0x11e')](db[_0xdaa8('0x83')],{'as':_0xdaa8('0x83'),'foreignKey':_0xdaa8('0x152')});db[_0xdaa8('0x14b')][_0xdaa8('0x11e')](db['Pause'],{'as':_0xdaa8('0x153'),'foreignKey':_0xdaa8('0x154')});db[_0xdaa8('0x14b')][_0xdaa8('0x120')](db[_0xdaa8('0xf7')],{'as':'Lists','through':_0xdaa8('0x155')});db[_0xdaa8('0x14b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xdaa8('0x156')});db['VoiceQueue'][_0xdaa8('0x120')](db[_0xdaa8('0xe8')],{'as':_0xdaa8('0x157'),'through':_0xdaa8('0x158')});db[_0xdaa8('0x14b')][_0xdaa8('0x120')](db['CmList'],{'as':_0xdaa8('0x159'),'through':_0xdaa8('0x15a')});db['VoiceRecording'][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x11'),'foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x1d')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':'User','foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x1f')][_0xdaa8('0x10f')](db[_0xdaa8('0x21')],{'as':'Messages','onDelete':_0xdaa8('0x10d'),'foreignKey':'mailboxuser','sourceKey':_0xdaa8('0x15b')});db[_0xdaa8('0x21')]['belongsTo'](db[_0xdaa8('0x1f')],{'foreignKey':_0xdaa8('0x15c'),'targetKey':'mailbox'});db[_0xdaa8('0x23')][_0xdaa8('0x10f')](db[_0xdaa8('0x28')],{'as':_0xdaa8('0x15d'),'foreignKey':_0xdaa8('0x15e'),'constraints':![]});db[_0xdaa8('0x23')][_0xdaa8('0x10f')](db['VoiceAgentReport'],{'as':_0xdaa8('0x15f'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0xdaa8('0x11')],{'as':'User','foreignKey':'UserId'});db[_0xdaa8('0x23')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':'Contact','foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x161')][_0xdaa8('0x11e')](db['MailAccount'],{'as':_0xdaa8('0x3a'),'foreignKey':'MailAccountId'});db[_0xdaa8('0x38')][_0xdaa8('0x11e')](db[_0xdaa8('0x3a')],{'as':_0xdaa8('0x3a'),'foreignKey':'MailAccountId'});db[_0xdaa8('0x3a')]['hasOne'](db['MailServerIn'],{'as':_0xdaa8('0x162'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x3a')][_0xdaa8('0x10c')](db['MailServerOut'],{'as':_0xdaa8('0x163'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x3a')]['hasMany'](db['Disposition'],{'as':_0xdaa8('0x164'),'foreignKey':_0xdaa8('0x165')});db[_0xdaa8('0x3a')]['hasMany'](db[_0xdaa8('0x166')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0xdaa8('0x3a')]['hasMany'](db[_0xdaa8('0x40')],{'as':'Messages','foreignKey':_0xdaa8('0x165')});db[_0xdaa8('0x3a')]['hasMany'](db[_0xdaa8('0x3e')],{'as':_0xdaa8('0x167')});db['MailAccount'][_0xdaa8('0x10f')](db['MailApplication'],{'as':'Applications'});db['MailAccount']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xdaa8('0x168')});db['MailAccount'][_0xdaa8('0x11e')](db['Template'],{'as':_0xdaa8('0x8e'),'foreignKey':_0xdaa8('0x169')});db[_0xdaa8('0x3a')][_0xdaa8('0x11e')](db[_0xdaa8('0x84')],{'as':_0xdaa8('0x153'),'foreignKey':_0xdaa8('0x154')});db['MailAccount']['belongsToMany'](db['User'],{'as':_0xdaa8('0x16a'),'through':'user_has_mail_accounts'});db[_0xdaa8('0x130')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':'Agents','through':_0xdaa8('0x2f')});db[_0xdaa8('0x130')]['belongsToMany'](db[_0xdaa8('0xe8')],{'through':_0xdaa8('0x16b'),'as':_0xdaa8('0x157')});db[_0xdaa8('0x3e')][_0xdaa8('0x10f')](db['MailMessage'],{'as':_0xdaa8('0x16c'),'onDelete':_0xdaa8('0x10d'),'foreignKey':'MailInteractionId'});db[_0xdaa8('0x3e')][_0xdaa8('0x11e')](db['MailAccount'],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x165')});db[_0xdaa8('0x3e')]['belongsTo'](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x3e')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16f'),'foreignKey':_0xdaa8('0x10e')});db['MailInteraction'][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x171'),'as':_0xdaa8('0x172')});db[_0xdaa8('0x3e')][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x171'),'as':'ThroughTags'});db['MailInteraction'][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':'Users','through':_0xdaa8('0x127'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0xdaa8('0x10f')](db[_0xdaa8('0xef')],{'as':'Attachments','onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x40')][_0xdaa8('0x11e')](db['User'],{'as':_0xdaa8('0x11')});db[_0xdaa8('0x40')]['belongsTo'](db[_0xdaa8('0x70')],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x16e')});db['MailMessage'][_0xdaa8('0x11e')](db[_0xdaa8('0x3e')],{'as':_0xdaa8('0x173'),'foreignKey':_0xdaa8('0x174')});db['MailMessage']['belongsTo'](db['MailAccount'],{'as':'Account','foreignKey':'MailAccountId'});db[_0xdaa8('0x175')]['belongsTo'](db[_0xdaa8('0x11')],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x175')][_0xdaa8('0x11e')](db[_0xdaa8('0x130')],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x175')][_0xdaa8('0x11e')](db[_0xdaa8('0x3a')],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x175')]['belongsTo'](db[_0xdaa8('0x83')],{'onDelete':'restrict','foreignKey':_0xdaa8('0x152')});db['MailApplication'][_0xdaa8('0x11e')](db[_0xdaa8('0x170')],{'onDelete':_0xdaa8('0x176'),'foreignKey':_0xdaa8('0x177')});db[_0xdaa8('0x178')][_0xdaa8('0x11e')](db['MailAccount'],{});db[_0xdaa8('0x178')][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':'ListId'});db[_0xdaa8('0x178')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x178')][_0xdaa8('0x11e')](db[_0xdaa8('0x3e')],{});db[_0xdaa8('0x178')][_0xdaa8('0x11e')](db[_0xdaa8('0x40')],{});db['MailQueueReport'][_0xdaa8('0x11e')](db['User'],{});db[_0xdaa8('0x178')][_0xdaa8('0x11e')](db[_0xdaa8('0x130')],{});db['Dashboard'][_0xdaa8('0x10f')](db[_0xdaa8('0x45')],{'as':_0xdaa8('0x17a'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x47')][_0xdaa8('0x10f')](db[_0xdaa8('0x7f')],{'as':_0xdaa8('0x164'),'foreignKey':_0xdaa8('0x17b')});db[_0xdaa8('0x47')][_0xdaa8('0x10f')](db[_0xdaa8('0x166')],{'as':_0xdaa8('0x17c'),'foreignKey':_0xdaa8('0x17b')});db['FaxAccount']['hasMany'](db[_0xdaa8('0x118')],{'as':_0xdaa8('0x167')});db[_0xdaa8('0x47')][_0xdaa8('0x10f')](db[_0xdaa8('0x48')],{'as':_0xdaa8('0x148')});db[_0xdaa8('0x47')]['hasMany'](db[_0xdaa8('0x113')],{'as':_0xdaa8('0x17d'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x47')][_0xdaa8('0x10f')](db[_0xdaa8('0x4b')],{'as':_0xdaa8('0x16c')});db['FaxAccount'][_0xdaa8('0x11e')](db[_0xdaa8('0x2a')],{'as':_0xdaa8('0x2a')});db['FaxAccount'][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0x47')][_0xdaa8('0x11e')](db[_0xdaa8('0x84')],{'as':_0xdaa8('0x153'),'foreignKey':_0xdaa8('0x154')});db[_0xdaa8('0x47')]['belongsToMany'](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16a'),'through':_0xdaa8('0x13c')});db[_0xdaa8('0x48')][_0xdaa8('0x11e')](db['User'],{'onDelete':_0xdaa8('0x176')});db['FaxApplication']['belongsTo'](db['FaxQueue'],{'onDelete':'restrict'});db['FaxApplication'][_0xdaa8('0x11e')](db[_0xdaa8('0x47')],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x48')][_0xdaa8('0x11e')](db['Tag'],{'onDelete':_0xdaa8('0x176'),'foreignKey':_0xdaa8('0x177')});db[_0xdaa8('0x118')][_0xdaa8('0x10f')](db[_0xdaa8('0x4b')],{'as':_0xdaa8('0x16c'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x17e')});db[_0xdaa8('0x118')]['belongsTo'](db[_0xdaa8('0x47')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xdaa8('0x118')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x118')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16f'),'foreignKey':_0xdaa8('0x10e')});db['FaxInteraction'][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':'fax_interaction_has_tags','as':_0xdaa8('0x172')});db['FaxInteraction'][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x17f'),'as':_0xdaa8('0x180')});db['FaxInteraction']['belongsToMany'](db[_0xdaa8('0x11')],{'as':'Users','through':_0xdaa8('0x129'),'foreignKey':_0xdaa8('0x17e')});db['FaxMessage'][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x11')});db[_0xdaa8('0x4b')][_0xdaa8('0x11e')](db[_0xdaa8('0x118')],{'as':_0xdaa8('0x173'),'foreignKey':_0xdaa8('0x17e')});db[_0xdaa8('0x4b')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x16e')});db['FaxMessage'][_0xdaa8('0x11e')](db[_0xdaa8('0xef')],{'as':_0xdaa8('0xef'),'foreignKey':_0xdaa8('0x181')});db[_0xdaa8('0x4b')][_0xdaa8('0x11e')](db[_0xdaa8('0x47')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x17b')});db[_0xdaa8('0x4d')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16a'),'through':_0xdaa8('0x31')});db[_0xdaa8('0x4d')][_0xdaa8('0x120')](db[_0xdaa8('0xe8')],{'through':_0xdaa8('0x182'),'as':_0xdaa8('0x157')});db[_0xdaa8('0x4f')][_0xdaa8('0x11e')](db[_0xdaa8('0x47')],{});db['FaxQueueReport'][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0x4f')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db['FaxQueueReport'][_0xdaa8('0x11e')](db['FaxInteraction'],{});db[_0xdaa8('0x4f')][_0xdaa8('0x11e')](db[_0xdaa8('0x4b')],{});db['FaxQueueReport'][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{});db[_0xdaa8('0x4f')][_0xdaa8('0x11e')](db['FaxQueue'],{});db[_0xdaa8('0x51')][_0xdaa8('0x10f')](db[_0xdaa8('0x7f')],{'as':'Dispositions','foreignKey':_0xdaa8('0x183')});db[_0xdaa8('0x51')]['hasMany'](db[_0xdaa8('0x166')],{'as':'Answers','foreignKey':_0xdaa8('0x183')});db[_0xdaa8('0x51')][_0xdaa8('0x10f')](db[_0xdaa8('0x57')],{'as':_0xdaa8('0x16c'),'foreignKey':'SmsAccountId'});db[_0xdaa8('0x51')][_0xdaa8('0x10f')](db['SmsInteraction'],{'as':_0xdaa8('0x167')});db[_0xdaa8('0x51')][_0xdaa8('0x10f')](db[_0xdaa8('0x53')],{'as':_0xdaa8('0x148')});db[_0xdaa8('0x51')][_0xdaa8('0x11e')](db['CmList'],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0x51')][_0xdaa8('0x11e')](db[_0xdaa8('0x84')],{'as':_0xdaa8('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xdaa8('0x51')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':'Agents','through':'user_has_sms_accounts'});db[_0xdaa8('0x53')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x53')][_0xdaa8('0x11e')](db[_0xdaa8('0x59')],{'onDelete':_0xdaa8('0x176')});db['SmsApplication'][_0xdaa8('0x11e')](db['SmsAccount'],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x53')][_0xdaa8('0x11e')](db[_0xdaa8('0x83')],{'onDelete':_0xdaa8('0x176'),'foreignKey':_0xdaa8('0x152')});db['SmsApplication']['belongsTo'](db['Tag'],{'onDelete':_0xdaa8('0x176'),'foreignKey':_0xdaa8('0x177')});db['SmsInteraction'][_0xdaa8('0x10f')](db[_0xdaa8('0x57')],{'as':_0xdaa8('0x16c'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0xdaa8('0x11e')](db[_0xdaa8('0x51')],{'as':'Account','foreignKey':_0xdaa8('0x183')});db['SmsInteraction'][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':'Contact','foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x55')]['belongsTo'](db[_0xdaa8('0x11')],{'as':'Owner','foreignKey':_0xdaa8('0x10e')});db['SmsInteraction']['belongsToMany'](db[_0xdaa8('0x170')],{'through':'sms_interaction_has_tags','as':_0xdaa8('0x172')});db[_0xdaa8('0x55')]['belongsToMany'](db[_0xdaa8('0x170')],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db['SmsInteraction']['belongsToMany'](db[_0xdaa8('0x11')],{'as':'Users','through':_0xdaa8('0x12b'),'foreignKey':'SmsInteractionId'});db[_0xdaa8('0x57')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x11')});db[_0xdaa8('0x57')][_0xdaa8('0x11e')](db['CmContact'],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x16e')});db[_0xdaa8('0x57')][_0xdaa8('0x11e')](db[_0xdaa8('0x55')],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x173'),'foreignKey':_0xdaa8('0x184')});db[_0xdaa8('0x57')][_0xdaa8('0x11e')](db[_0xdaa8('0x51')],{'as':_0xdaa8('0x16d'),'foreignKey':'SmsAccountId'});db[_0xdaa8('0x59')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':'Agents','through':_0xdaa8('0x33'),'foreignKey':_0xdaa8('0x185')});db['SmsQueue'][_0xdaa8('0x120')](db[_0xdaa8('0xe8')],{'through':_0xdaa8('0x186'),'as':_0xdaa8('0x157')});db['OpenchannelAccount'][_0xdaa8('0x10f')](db[_0xdaa8('0x7f')],{'as':_0xdaa8('0x164'),'foreignKey':_0xdaa8('0x187')});db[_0xdaa8('0x5b')][_0xdaa8('0x10f')](db[_0xdaa8('0x166')],{'as':_0xdaa8('0x17c'),'foreignKey':'OpenchannelAccountId'});db[_0xdaa8('0x5b')][_0xdaa8('0x10f')](db[_0xdaa8('0x5e')],{'as':_0xdaa8('0x167'),'foreignKey':_0xdaa8('0x187')});db[_0xdaa8('0x5b')][_0xdaa8('0x10f')](db['OpenchannelMessage'],{'as':_0xdaa8('0x16c'),'foreignKey':_0xdaa8('0x187')});db[_0xdaa8('0x5b')][_0xdaa8('0x10f')](db[_0xdaa8('0x5c')],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['belongsTo'](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0x5b')][_0xdaa8('0x11e')](db[_0xdaa8('0x84')],{'as':_0xdaa8('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xdaa8('0x5b')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':'Agents','through':_0xdaa8('0x13f')});db[_0xdaa8('0x5c')][_0xdaa8('0x11e')](db['User'],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x5c')][_0xdaa8('0x11e')](db[_0xdaa8('0x60')],{'onDelete':_0xdaa8('0x176'),'foreignKey':'OpenchannelQueueId'});db[_0xdaa8('0x5c')][_0xdaa8('0x11e')](db[_0xdaa8('0x5b')],{'onDelete':_0xdaa8('0x176'),'foreignKey':_0xdaa8('0x187')});db[_0xdaa8('0x5c')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0xdaa8('0x152')});db[_0xdaa8('0x5c')][_0xdaa8('0x11e')](db[_0xdaa8('0x170')],{'onDelete':_0xdaa8('0x176'),'foreignKey':_0xdaa8('0x177')});db[_0xdaa8('0x5e')][_0xdaa8('0x10f')](db[_0xdaa8('0x5f')],{'as':_0xdaa8('0x16c'),'onDelete':'cascade','foreignKey':_0xdaa8('0x188')});db[_0xdaa8('0x5e')][_0xdaa8('0x11e')](db[_0xdaa8('0x5b')],{'as':_0xdaa8('0x16d'),'foreignKey':'OpenchannelAccountId'});db[_0xdaa8('0x5e')]['belongsTo'](db['CmContact'],{'as':_0xdaa8('0x16e'),'foreignKey':'ContactId'});db[_0xdaa8('0x5e')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16f'),'foreignKey':'UserId'});db[_0xdaa8('0x5e')][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x189'),'as':'Tags'});db['OpenchannelInteraction'][_0xdaa8('0x120')](db['Tag'],{'through':_0xdaa8('0x189'),'as':'ThroughTags'});db[_0xdaa8('0x5e')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x18a'),'through':_0xdaa8('0x12d'),'foreignKey':_0xdaa8('0x188')});db[_0xdaa8('0x5f')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x11')});db[_0xdaa8('0x5f')][_0xdaa8('0x11e')](db['CmContact'],{'onDelete':_0xdaa8('0x10d'),'as':'Contact'});db['OpenchannelMessage'][_0xdaa8('0x11e')](db[_0xdaa8('0x5e')],{'onDelete':'cascade','as':_0xdaa8('0x173'),'foreignKey':_0xdaa8('0x188')});db[_0xdaa8('0x5f')][_0xdaa8('0x11e')](db['Attachment'],{'as':_0xdaa8('0xef'),'foreignKey':_0xdaa8('0x181')});db[_0xdaa8('0x5f')][_0xdaa8('0x11e')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0xdaa8('0x187')});db[_0xdaa8('0x60')][_0xdaa8('0x120')](db['User'],{'as':'Agents','through':_0xdaa8('0x35'),'foreignKey':_0xdaa8('0x18b')});db[_0xdaa8('0x60')][_0xdaa8('0x120')](db[_0xdaa8('0xe8')],{'through':_0xdaa8('0x18c'),'as':_0xdaa8('0x157')});db[_0xdaa8('0x18d')][_0xdaa8('0x10f')](db[_0xdaa8('0x7f')],{'as':_0xdaa8('0x164'),'foreignKey':_0xdaa8('0x18e')});db['ChatWebsite']['hasMany'](db[_0xdaa8('0x166')],{'as':_0xdaa8('0x17c'),'foreignKey':_0xdaa8('0x18e')});db[_0xdaa8('0x18d')][_0xdaa8('0x10f')](db['ChatProactiveAction'],{'as':_0xdaa8('0x18f')});db[_0xdaa8('0x18d')]['hasMany'](db[_0xdaa8('0x65')],{'as':_0xdaa8('0x167')});db[_0xdaa8('0x18d')][_0xdaa8('0x10f')](db[_0xdaa8('0x63')],{'as':_0xdaa8('0x148')});db[_0xdaa8('0x18d')]['hasMany'](db['ChatMessage'],{'as':_0xdaa8('0x16c')});db[_0xdaa8('0x18d')][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':'List','foreignKey':'ListId'});db[_0xdaa8('0x18d')]['belongsTo'](db[_0xdaa8('0x83')],{'as':'Interval','foreignKey':_0xdaa8('0x152')});db[_0xdaa8('0x18d')][_0xdaa8('0x11e')](db[_0xdaa8('0x84')],{'as':_0xdaa8('0x153'),'foreignKey':_0xdaa8('0x154')});db[_0xdaa8('0x18d')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16a'),'through':'user_has_chat_websites'});db[_0xdaa8('0x62')][_0xdaa8('0x11e')](db[_0xdaa8('0x5b')],{});db[_0xdaa8('0x62')][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0x62')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':'ContactId'});db[_0xdaa8('0x62')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0xdaa8('0x62')]['belongsTo'](db[_0xdaa8('0x5f')],{});db[_0xdaa8('0x62')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{});db[_0xdaa8('0x62')][_0xdaa8('0x11e')](db['OpenchannelQueue'],{});db[_0xdaa8('0x63')]['belongsTo'](db['User'],{'as':_0xdaa8('0x190'),'foreignKey':_0xdaa8('0x10e'),'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x63')]['belongsTo'](db[_0xdaa8('0x69')],{'as':_0xdaa8('0x191'),'foreignKey':'ChatQueueId','onDelete':_0xdaa8('0x176')});db['ChatApplication'][_0xdaa8('0x11e')](db[_0xdaa8('0x18d')],{'as':_0xdaa8('0x192'),'foreignKey':_0xdaa8('0x18e'),'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x63')][_0xdaa8('0x11e')](db[_0xdaa8('0x170')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xdaa8('0x65')]['hasMany'](db[_0xdaa8('0x67')],{'as':_0xdaa8('0x16c'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x193')});db['ChatInteraction'][_0xdaa8('0x11e')](db[_0xdaa8('0x18d')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x18e')});db[_0xdaa8('0x65')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db['ChatInteraction'][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':'Owner','foreignKey':'UserId'});db[_0xdaa8('0x65')][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x194'),'as':_0xdaa8('0x172')});db[_0xdaa8('0x65')][_0xdaa8('0x120')](db['Tag'],{'through':_0xdaa8('0x194'),'as':'ThroughTags'});db[_0xdaa8('0x65')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x18a'),'through':_0xdaa8('0x128'),'foreignKey':_0xdaa8('0x193')});db['ChatMessage'][_0xdaa8('0x11e')](db['User'],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x11')});db['ChatMessage'][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'onDelete':'cascade','as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x67')][_0xdaa8('0x11e')](db[_0xdaa8('0x65')],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x173'),'foreignKey':'ChatInteractionId'});db[_0xdaa8('0x67')]['belongsTo'](db[_0xdaa8('0xef')],{'as':'Attachment','foreignKey':_0xdaa8('0x181')});db[_0xdaa8('0x67')][_0xdaa8('0x11e')](db[_0xdaa8('0x18d')],{'as':_0xdaa8('0x16d'),'foreignKey':'ChatWebsiteId'});db[_0xdaa8('0x195')][_0xdaa8('0x11e')](db['CmContact'],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x16e'),'foreignKey':'ContactId'});db[_0xdaa8('0x195')][_0xdaa8('0x11e')](db[_0xdaa8('0x18d')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x18e')});db[_0xdaa8('0x69')]['belongsToMany'](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16a'),'through':'UserChatQueue','hooks':!![]});db[_0xdaa8('0x69')][_0xdaa8('0x120')](db['Team'],{'through':_0xdaa8('0x196'),'as':'Teams'});db[_0xdaa8('0x6b')][_0xdaa8('0x10f')](db[_0xdaa8('0xd5')],{'as':_0xdaa8('0x16c'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0xdaa8('0x6b')][_0xdaa8('0x120')](db['User'],{'as':_0xdaa8('0x14c'),'through':_0xdaa8('0x122')});db[_0xdaa8('0x6d')][_0xdaa8('0x11e')](db['ChatWebsite'],{'as':_0xdaa8('0x192'),'foreignKey':_0xdaa8('0x18e')});db['CmCompany']['hasMany'](db['CmContact'],{'as':'Contacts','foreignKey':_0xdaa8('0x197')});db[_0xdaa8('0x70')][_0xdaa8('0x10f')](db[_0xdaa8('0x72')],{'as':_0xdaa8('0x198'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x70')][_0xdaa8('0x10f')](db[_0xdaa8('0x75')],{'as':_0xdaa8('0x115'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x70')]['hasMany'](db[_0xdaa8('0x77')],{'as':_0xdaa8('0x199'),'foreignKey':'ContactId'});db['CmContact'][_0xdaa8('0x10f')](db[_0xdaa8('0x78')],{'as':_0xdaa8('0x78'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x70')]['hasMany'](db[_0xdaa8('0x150')],{'as':_0xdaa8('0x19a'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db['OpenchannelInteraction'],{'as':_0xdaa8('0x12c'),'foreignKey':_0xdaa8('0x160'),'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x70')][_0xdaa8('0x10f')](db[_0xdaa8('0x65')],{'as':'ChatInteractions','foreignKey':_0xdaa8('0x160'),'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x70')][_0xdaa8('0x10f')](db[_0xdaa8('0x55')],{'as':_0xdaa8('0x12a'),'foreignKey':'ContactId','onDelete':_0xdaa8('0x176')});db['CmContact'][_0xdaa8('0x10f')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x70')]['hasMany'](db[_0xdaa8('0x3e')],{'as':_0xdaa8('0x11a'),'foreignKey':'ContactId','onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x70')]['belongsTo'](db['CmCompany'],{'as':_0xdaa8('0x19b'),'foreignKey':_0xdaa8('0x197')});db[_0xdaa8('0x70')][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x70')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x18a'),'through':'cm_user_has_contacts'});db[_0xdaa8('0x70')][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'as':_0xdaa8('0x172'),'through':_0xdaa8('0x19c')});db[_0xdaa8('0x70')][_0xdaa8('0x120')](db['Tag'],{'through':_0xdaa8('0x19c'),'as':'ThroughTags'});db[_0xdaa8('0x72')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160'),'onDelete':'cascade'});db[_0xdaa8('0x72')][_0xdaa8('0x11e')](db['CmList'],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x72')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':'Agent','foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x72')][_0xdaa8('0x11e')](db[_0xdaa8('0x14b')],{'as':'Queue','foreignKey':_0xdaa8('0x14d'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x72')][_0xdaa8('0x11e')](db[_0xdaa8('0xeb')],{'as':_0xdaa8('0xeb'),'foreignKey':'CampaignId','onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x72')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':'Owner','foreignKey':_0xdaa8('0x19d')});db['CmHopperBlack'][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x14e')][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168'),'onDelete':_0xdaa8('0x10d')});db['CmHopperBlack']['belongsTo'](db[_0xdaa8('0x14b')],{'as':_0xdaa8('0x191'),'foreignKey':'VoiceQueueId','onDelete':_0xdaa8('0x10d')});db['CmHopperBlack'][_0xdaa8('0x11e')](db[_0xdaa8('0xeb')],{'as':_0xdaa8('0xeb'),'foreignKey':_0xdaa8('0x19e'),'onDelete':_0xdaa8('0x10d')});db['Automation'][_0xdaa8('0x10f')](db[_0xdaa8('0x81')],{'as':{'plural':_0xdaa8('0x19f'),'singular':_0xdaa8('0x1a0')},'foreignKey':_0xdaa8('0x1a1'),'onDelete':_0xdaa8('0x10d'),'hooks':!![]});db['Automation'][_0xdaa8('0x10f')](db['Condition'],{'as':{'plural':_0xdaa8('0x1a2'),'singular':_0xdaa8('0x1a3')},'foreignKey':_0xdaa8('0x1a4'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xdaa8('0x10f')](db['Action'],{'as':_0xdaa8('0x1a5'),'foreignKey':'AutomationId','onDelete':_0xdaa8('0x10d'),'hooks':!![]});db[_0xdaa8('0x7f')][_0xdaa8('0x10f')](db[_0xdaa8('0x7f')],{'as':_0xdaa8('0x164'),'foreignKey':_0xdaa8('0x1a6'),'onDelete':'cascade'});db['Interval'][_0xdaa8('0x10f')](db[_0xdaa8('0x83')],{'as':'Intervals','foreignKey':_0xdaa8('0x152'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xdaa8('0x83')]['hasMany'](db[_0xdaa8('0x113')],{'as':'Extensions','foreignKey':_0xdaa8('0x152'),'onDelete':_0xdaa8('0x176')});db['Interval'][_0xdaa8('0x10f')](db[_0xdaa8('0x175')],{'as':_0xdaa8('0x1a7'),'foreignKey':'IntervalId'});db[_0xdaa8('0x83')]['hasMany'](db[_0xdaa8('0x63')],{'as':'ChatApplications','foreignKey':_0xdaa8('0x152')});db[_0xdaa8('0x83')][_0xdaa8('0x10f')](db[_0xdaa8('0x48')],{'as':_0xdaa8('0x1a8'),'foreignKey':'IntervalId'});db[_0xdaa8('0x83')][_0xdaa8('0x10f')](db[_0xdaa8('0x53')],{'as':_0xdaa8('0x1a9'),'foreignKey':'IntervalId'});db[_0xdaa8('0x1aa')][_0xdaa8('0x11e')](db[_0xdaa8('0x3a')],{});db[_0xdaa8('0x1aa')][_0xdaa8('0x11e')](db['AnalyticDefaultReport'],{'foreignKey':_0xdaa8('0x1ab')});db[_0xdaa8('0x1aa')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0xdaa8('0x1ac')});db['Sound'][_0xdaa8('0x120')](db['VoiceMusicOnHold'],{'as':_0xdaa8('0x1ad'),'through':'moh_has_sounds','onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x170')][_0xdaa8('0x120')](db[_0xdaa8('0x70')],{'through':_0xdaa8('0x19c')});db[_0xdaa8('0x170')]['belongsToMany'](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db['Tag']['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0xdaa8('0x170')][_0xdaa8('0x120')](db['SmsInteraction'],{'through':_0xdaa8('0x1ae')});db[_0xdaa8('0x170')][_0xdaa8('0x120')](db[_0xdaa8('0x118')],{'through':_0xdaa8('0x17f')});db[_0xdaa8('0x170')][_0xdaa8('0x120')](db[_0xdaa8('0x5e')],{'through':'openchannel_interaction_has_tags'});db[_0xdaa8('0x170')][_0xdaa8('0x120')](db[_0xdaa8('0x102')],{'through':_0xdaa8('0x1af')});db[_0xdaa8('0x8f')][_0xdaa8('0x10f')](db[_0xdaa8('0x81')],{'as':{'plural':_0xdaa8('0x1b0'),'singular':_0xdaa8('0x1b1')},'foreignKey':_0xdaa8('0x1b2'),'onDelete':_0xdaa8('0x10d'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xdaa8('0x81')],{'as':{'plural':_0xdaa8('0x1b3'),'singular':'AnyCondition'},'foreignKey':_0xdaa8('0x1b4'),'onDelete':'cascade','hooks':!![]});db[_0xdaa8('0x8f')][_0xdaa8('0x10f')](db['Action'],{'as':_0xdaa8('0x1a5'),'foreignKey':'TriggerId','onDelete':_0xdaa8('0x10d'),'hooks':!![]});db[_0xdaa8('0x95')][_0xdaa8('0x10f')](db[_0xdaa8('0x1b5')],{'as':'Fields','onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1ac'),'hooks':!![]});db[_0xdaa8('0x97')][_0xdaa8('0x10f')](db['AnalyticFieldReport'],{'as':_0xdaa8('0x1b6'),'onDelete':'cascade','foreignKey':_0xdaa8('0x1ab')});db[_0xdaa8('0x9b')][_0xdaa8('0x10f')](db['AnalyticFieldReport'],{'as':_0xdaa8('0x1b6'),'onDelete':_0xdaa8('0x10d'),'foreignKey':'MetricId'});db[_0xdaa8('0x1b5')][_0xdaa8('0x11e')](db[_0xdaa8('0x9b')],{'foreignKey':_0xdaa8('0x1b7')});db[_0xdaa8('0xa0')][_0xdaa8('0x10f')](db[_0xdaa8('0xa1')],{'as':_0xdaa8('0x1b8'),'onDelete':'cascade','foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xa1')]['hasMany'](db[_0xdaa8('0xa2')],{'as':_0xdaa8('0x1ba'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xa1')][_0xdaa8('0x10f')](db[_0xdaa8('0xa2')],{'as':_0xdaa8('0x1bc'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xdaa8('0xa1')][_0xdaa8('0x10f')](db[_0xdaa8('0xa2')],{'as':'Fields','onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xa1')]['belongsTo'](db['SalesforceAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xdaa8('0xa2')][_0xdaa8('0x10f')](db[_0xdaa8('0xa2')],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xa2')][_0xdaa8('0x10f')](db[_0xdaa8('0xa2')],{'as':_0xdaa8('0x1bf'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0xdaa8('0x10f')](db['SalesforceField'],{'as':_0xdaa8('0x1c0'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xa2')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xdaa8('0x1c1')});db['SugarcrmAccount'][_0xdaa8('0x10f')](db[_0xdaa8('0xa5')],{'as':_0xdaa8('0x1b8'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xa5')][_0xdaa8('0x10f')](db[_0xdaa8('0xa7')],{'as':_0xdaa8('0x1ba'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xa5')][_0xdaa8('0x10f')](db[_0xdaa8('0xa7')],{'as':_0xdaa8('0x1bc'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xa5')][_0xdaa8('0x10f')](db['SugarcrmField'],{'as':_0xdaa8('0x1b6'),'onDelete':'cascade','foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xa5')][_0xdaa8('0x11e')](db[_0xdaa8('0x1c3')],{'as':'Account','foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xa7')][_0xdaa8('0x10f')](db[_0xdaa8('0xa7')],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xa7')]['hasMany'](db[_0xdaa8('0xa7')],{'as':_0xdaa8('0x1bf'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xa7')][_0xdaa8('0x10f')](db[_0xdaa8('0xa7')],{'as':_0xdaa8('0x1c0'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xa7')][_0xdaa8('0x11e')](db[_0xdaa8('0x91')],{'as':_0xdaa8('0x91'),'foreignKey':_0xdaa8('0x1c1')});db[_0xdaa8('0xa9')][_0xdaa8('0x10f')](db[_0xdaa8('0xab')],{'as':_0xdaa8('0x1b8'),'onDelete':'cascade','foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xab')][_0xdaa8('0x10f')](db[_0xdaa8('0x1c4')],{'as':_0xdaa8('0x1ba'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xdaa8('0xab')][_0xdaa8('0x10f')](db['DeskField'],{'as':'Descriptions','onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xab')][_0xdaa8('0x10f')](db['DeskField'],{'as':'Fields','onDelete':_0xdaa8('0x10d'),'foreignKey':'FieldId'});db[_0xdaa8('0xab')][_0xdaa8('0x11e')](db[_0xdaa8('0xa9')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x1b9')});db['DeskConfiguration'][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x1c5')});db['DeskField']['hasMany'](db['DeskField'],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0x1c4')][_0xdaa8('0x10f')](db[_0xdaa8('0x1c4')],{'as':'Description','foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0x1c4')][_0xdaa8('0x10f')](db[_0xdaa8('0x1c4')],{'as':_0xdaa8('0x1c0'),'foreignKey':'FieldId'});db[_0xdaa8('0x1c4')][_0xdaa8('0x11e')](db[_0xdaa8('0x91')],{'as':_0xdaa8('0x91'),'foreignKey':_0xdaa8('0x1c1')});db[_0xdaa8('0xae')][_0xdaa8('0x10f')](db[_0xdaa8('0xb0')],{'as':'Configurations','onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xb0')][_0xdaa8('0x10f')](db[_0xdaa8('0xb2')],{'as':_0xdaa8('0x1ba'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xdaa8('0xb0')]['hasMany'](db[_0xdaa8('0xb2')],{'as':'Descriptions','onDelete':_0xdaa8('0x10d'),'foreignKey':'DescriptionId'});db[_0xdaa8('0xb0')][_0xdaa8('0x10f')](db[_0xdaa8('0xb2')],{'as':_0xdaa8('0x1b6'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xb0')]['belongsTo'](db[_0xdaa8('0xae')],{'as':'Account','foreignKey':'AccountId'});db['ZohoField'][_0xdaa8('0x10f')](db[_0xdaa8('0xb2')],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db['ZohoField']['hasMany'](db[_0xdaa8('0xb2')],{'as':_0xdaa8('0x1bf'),'foreignKey':_0xdaa8('0x1c2')});db['ZohoField'][_0xdaa8('0x10f')](db[_0xdaa8('0xb2')],{'as':'Field','foreignKey':'FieldId'});db['ZohoField'][_0xdaa8('0x11e')](db['Variable'],{'as':'Variable','foreignKey':_0xdaa8('0x1c1')});db[_0xdaa8('0xb4')][_0xdaa8('0x10f')](db[_0xdaa8('0xb6')],{'as':'Configurations','onDelete':_0xdaa8('0x10d'),'foreignKey':'AccountId'});db[_0xdaa8('0xb6')][_0xdaa8('0x10f')](db[_0xdaa8('0x1c6')],{'as':_0xdaa8('0x1ba'),'foreignKey':'SubjectId'});db[_0xdaa8('0xb6')][_0xdaa8('0x10f')](db[_0xdaa8('0x1c6')],{'as':_0xdaa8('0x1bc'),'foreignKey':_0xdaa8('0x1c2')});db['ZendeskConfiguration'][_0xdaa8('0x10f')](db[_0xdaa8('0x1c6')],{'as':'Fields','foreignKey':'FieldId'});db[_0xdaa8('0xb6')][_0xdaa8('0x11e')](db[_0xdaa8('0xb4')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xb6')]['belongsToMany'](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x1c7')});db['ZendeskField'][_0xdaa8('0x10f')](db[_0xdaa8('0x1c6')],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db['ZendeskField'][_0xdaa8('0x10f')](db[_0xdaa8('0x1c6')],{'as':_0xdaa8('0x1bf'),'foreignKey':'DescriptionId'});db[_0xdaa8('0x1c6')][_0xdaa8('0x10f')](db[_0xdaa8('0x1c6')],{'as':_0xdaa8('0x1c0'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0x1c6')][_0xdaa8('0x11e')](db['Variable'],{'as':'Variable','foreignKey':_0xdaa8('0x1c1')});db[_0xdaa8('0xb8')][_0xdaa8('0x10f')](db[_0xdaa8('0xba')],{'as':_0xdaa8('0x1b8'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xba')][_0xdaa8('0x10f')](db[_0xdaa8('0xbc')],{'as':_0xdaa8('0x1ba'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xba')][_0xdaa8('0x10f')](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xba')][_0xdaa8('0x10f')](db['FreshdeskField'],{'as':_0xdaa8('0x1b6'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1bd')});db['FreshdeskConfiguration'][_0xdaa8('0x11e')](db[_0xdaa8('0xb8')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xba')][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xdaa8('0xbc')][_0xdaa8('0x10f')](db[_0xdaa8('0xbc')],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db['FreshdeskField'][_0xdaa8('0x10f')](db['FreshdeskField'],{'as':_0xdaa8('0x1bf'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xbc')]['hasMany'](db['FreshdeskField'],{'as':_0xdaa8('0x1c0'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xbc')][_0xdaa8('0x11e')](db[_0xdaa8('0x91')],{'as':_0xdaa8('0x91'),'foreignKey':_0xdaa8('0x1c1')});db[_0xdaa8('0xbe')][_0xdaa8('0x10f')](db[_0xdaa8('0xbf')],{'as':_0xdaa8('0x1b8'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xbf')][_0xdaa8('0x10f')](db['VtigerField'],{'as':_0xdaa8('0x1ba'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xbf')]['hasMany'](db['VtigerField'],{'as':_0xdaa8('0x1bc'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xbf')][_0xdaa8('0x10f')](db[_0xdaa8('0xc1')],{'as':_0xdaa8('0x1b6'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xbf')][_0xdaa8('0x11e')](db[_0xdaa8('0xbe')],{'as':'Account','foreignKey':_0xdaa8('0x1b9')});db['VtigerField'][_0xdaa8('0x10f')](db['VtigerField'],{'as':_0xdaa8('0x1be'),'foreignKey':'SubjectId'});db[_0xdaa8('0xc1')][_0xdaa8('0x10f')](db['VtigerField'],{'as':_0xdaa8('0x1bf'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xc1')][_0xdaa8('0x10f')](db['VtigerField'],{'as':'Field','foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db['Variable'],{'as':_0xdaa8('0x91'),'foreignKey':_0xdaa8('0x1c1')});db[_0xdaa8('0xc3')][_0xdaa8('0x10f')](db[_0xdaa8('0xc5')],{'as':'Configurations','onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xc5')][_0xdaa8('0x10f')](db[_0xdaa8('0xc7')],{'as':'Subjects','foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xc5')][_0xdaa8('0x10f')](db[_0xdaa8('0xc7')],{'as':_0xdaa8('0x1bc'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xc5')][_0xdaa8('0x10f')](db['ServicenowField'],{'as':_0xdaa8('0x1b6'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xc5')][_0xdaa8('0x11e')](db[_0xdaa8('0xc3')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xc7')][_0xdaa8('0x10f')](db[_0xdaa8('0xc7')],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xc7')]['hasMany'](db[_0xdaa8('0xc7')],{'as':_0xdaa8('0x1bf'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xc7')][_0xdaa8('0x10f')](db[_0xdaa8('0xc7')],{'as':_0xdaa8('0x1c0'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xc7')][_0xdaa8('0x11e')](db[_0xdaa8('0x91')],{'as':_0xdaa8('0x91'),'foreignKey':_0xdaa8('0x1c1')});db['Dynamics365Account'][_0xdaa8('0x10f')](db['Dynamics365Configuration'],{'as':_0xdaa8('0x1b8'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1b9')});db['Dynamics365Configuration'][_0xdaa8('0x10f')](db[_0xdaa8('0xcb')],{'as':_0xdaa8('0x1ba'),'onDelete':_0xdaa8('0x10d'),'foreignKey':'SubjectId'});db[_0xdaa8('0xc9')][_0xdaa8('0x10f')](db[_0xdaa8('0xcb')],{'as':_0xdaa8('0x1bc'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xc9')][_0xdaa8('0x10f')](db['Dynamics365Field'],{'as':_0xdaa8('0x1b6'),'onDelete':_0xdaa8('0x10d'),'foreignKey':'FieldId'});db[_0xdaa8('0xc9')][_0xdaa8('0x11e')](db[_0xdaa8('0xc8')],{'as':'Account','foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xcb')][_0xdaa8('0x10f')](db[_0xdaa8('0xcb')],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xcb')][_0xdaa8('0x10f')](db[_0xdaa8('0xcb')],{'as':_0xdaa8('0x1bf'),'foreignKey':'DescriptionId'});db['Dynamics365Field']['hasMany'](db[_0xdaa8('0xcb')],{'as':_0xdaa8('0x1c0'),'foreignKey':'FieldId'});db[_0xdaa8('0xcb')]['belongsTo'](db[_0xdaa8('0x91')],{'as':_0xdaa8('0x91'),'foreignKey':'VariableId'});db[_0xdaa8('0x1c8')][_0xdaa8('0x10f')](db[_0xdaa8('0xce')],{'as':_0xdaa8('0x1b8'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1b9')});db['FreshsalesConfiguration'][_0xdaa8('0x10f')](db['FreshsalesField'],{'as':_0xdaa8('0x1ba'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xce')][_0xdaa8('0x10f')](db['FreshsalesField'],{'as':_0xdaa8('0x1bc'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xce')]['hasMany'](db[_0xdaa8('0xd0')],{'as':_0xdaa8('0x1b6'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xce')][_0xdaa8('0x11e')](db[_0xdaa8('0x1c8')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xd0')][_0xdaa8('0x10f')](db[_0xdaa8('0xd0')],{'as':_0xdaa8('0x1be'),'foreignKey':'SubjectId'});db[_0xdaa8('0xd0')]['hasMany'](db[_0xdaa8('0xd0')],{'as':_0xdaa8('0x1bf'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xd0')][_0xdaa8('0x10f')](db[_0xdaa8('0xd0')],{'as':_0xdaa8('0x1c0'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xd0')][_0xdaa8('0x11e')](db['Variable'],{'as':_0xdaa8('0x91'),'foreignKey':_0xdaa8('0x1c1')});db[_0xdaa8('0xd3')][_0xdaa8('0x11e')](db[_0xdaa8('0x18d')],{});db[_0xdaa8('0xd3')][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0xd3')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':'Contact','foreignKey':'ContactId'});db[_0xdaa8('0xd3')][_0xdaa8('0x11e')](db[_0xdaa8('0x65')],{});db[_0xdaa8('0xd3')]['belongsTo'](db[_0xdaa8('0x67')],{});db[_0xdaa8('0xd3')][_0xdaa8('0x11e')](db['User'],{});db[_0xdaa8('0xd3')][_0xdaa8('0x11e')](db[_0xdaa8('0x69')],{});db[_0xdaa8('0xd5')]['belongsTo'](db[_0xdaa8('0x11')],{'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1c9')});db[_0xdaa8('0xd5')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1ca')});db[_0xdaa8('0x150')][_0xdaa8('0x10f')](db[_0xdaa8('0xd9')],{'foreignKey':_0xdaa8('0x1cb'),'onDelete':'cascade'});db['JscriptySessionReport'][_0xdaa8('0x10f')](db[_0xdaa8('0xd7')],{'foreignKey':'SessionId','onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x1cc')][_0xdaa8('0x11e')](db['SmsAccount'],{});db[_0xdaa8('0x1cc')][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0x1cc')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':'Contact','foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x1cc')][_0xdaa8('0x11e')](db[_0xdaa8('0x55')],{});db[_0xdaa8('0x1cc')][_0xdaa8('0x11e')](db[_0xdaa8('0x57')],{});db[_0xdaa8('0x1cc')]['belongsTo'](db[_0xdaa8('0x11')],{});db[_0xdaa8('0x1cc')][_0xdaa8('0x11e')](db['SmsQueue'],{});db[_0xdaa8('0xe0')]['hasMany'](db[_0xdaa8('0x150')],{'foreignKey':'ProjectId'});db[_0xdaa8('0xe0')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0xdaa8('0x1cd')});db[_0xdaa8('0xe0')][_0xdaa8('0x10f')](db[_0xdaa8('0xd7')],{'foreignKey':_0xdaa8('0x1cd')});db[_0xdaa8('0xe3')]['belongsToMany'](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x18a'),'through':_0xdaa8('0x145')});db[_0xdaa8('0xe8')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':'Agents','through':'user_has_teams'});db[_0xdaa8('0xe8')][_0xdaa8('0x120')](db[_0xdaa8('0x14b')],{'through':_0xdaa8('0x158'),'as':'VoiceQueues'});db[_0xdaa8('0xe8')][_0xdaa8('0x120')](db[_0xdaa8('0x130')],{'through':'team_has_mail_queues','as':_0xdaa8('0x1ce')});db[_0xdaa8('0xe8')]['belongsToMany'](db[_0xdaa8('0x69')],{'through':_0xdaa8('0x196'),'as':_0xdaa8('0x131')});db[_0xdaa8('0xe8')][_0xdaa8('0x120')](db[_0xdaa8('0x4d')],{'through':_0xdaa8('0x182'),'as':'FaxQueues'});db[_0xdaa8('0xe8')][_0xdaa8('0x120')](db[_0xdaa8('0x59')],{'through':_0xdaa8('0x186'),'as':_0xdaa8('0x133')});db[_0xdaa8('0xe8')][_0xdaa8('0x120')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0xdaa8('0x134')});db[_0xdaa8('0xe8')][_0xdaa8('0x120')](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':_0xdaa8('0x135')});db[_0xdaa8('0xeb')]['hasMany'](db[_0xdaa8('0x72')],{'as':'Hoppers','foreignKey':'CampaignId'});db['Campaign'][_0xdaa8('0x10f')](db[_0xdaa8('0x75')],{'as':_0xdaa8('0x115'),'foreignKey':_0xdaa8('0x19e')});db[_0xdaa8('0xeb')][_0xdaa8('0x10f')](db[_0xdaa8('0x77')],{'as':_0xdaa8('0x199'),'foreignKey':_0xdaa8('0x19e')});db['Campaign'][_0xdaa8('0x10f')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xdaa8('0x19e')});db[_0xdaa8('0xeb')][_0xdaa8('0x11e')](db[_0xdaa8('0x2a')],{'as':_0xdaa8('0x2a'),'foreignKey':'TrunkId'});db['Campaign'][_0xdaa8('0x11e')](db[_0xdaa8('0x2a')],{'as':'TrunkBackup','foreignKey':_0xdaa8('0x1cf')});db[_0xdaa8('0xeb')]['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0xdaa8('0xeb')][_0xdaa8('0x11e')](db[_0xdaa8('0xe3')],{'as':_0xdaa8('0xe3'),'foreignKey':_0xdaa8('0x1d0')});db[_0xdaa8('0xeb')]['belongsToMany'](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x125'),'through':'campaigns_has_cm_lists'});db[_0xdaa8('0xeb')][_0xdaa8('0x120')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x159'),'through':_0xdaa8('0x1d1')});db['MailTransferReport']['belongsTo'](db[_0xdaa8('0x40')],{});db['MailTransferReport'][_0xdaa8('0x11e')](db[_0xdaa8('0x3e')],{});db['MailTransferReport']['belongsTo'](db[_0xdaa8('0x3a')],{'foreignKey':_0xdaa8('0x1d2'),'as':'FromAccount'});db[_0xdaa8('0xf2')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':'FromUserId','as':_0xdaa8('0x1d3')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xdaa8('0xf2')]['belongsTo'](db[_0xdaa8('0x130')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0xdaa8('0xf2')][_0xdaa8('0x11e')](db[_0xdaa8('0x3a')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0xdaa8('0xf4')][_0xdaa8('0x11e')](db[_0xdaa8('0x67')],{});db['ChatTransferReport'][_0xdaa8('0x11e')](db[_0xdaa8('0x65')],{});db['ChatTransferReport']['belongsTo'](db[_0xdaa8('0x18d')],{'foreignKey':_0xdaa8('0x1d4'),'as':_0xdaa8('0x1d5')});db['ChatTransferReport'][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':_0xdaa8('0x1d6'),'as':'FromAgent'});db[_0xdaa8('0xf4')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xdaa8('0xf4')][_0xdaa8('0x11e')](db['ChatQueue'],{'foreignKey':_0xdaa8('0x1d7'),'as':_0xdaa8('0x1d8')});db[_0xdaa8('0xf4')][_0xdaa8('0x11e')](db[_0xdaa8('0x18d')],{'foreignKey':'ToChatWebsiteId','as':_0xdaa8('0x1d9')});db['FaxTransferReport'][_0xdaa8('0x11e')](db[_0xdaa8('0x4b')],{});db[_0xdaa8('0x1da')][_0xdaa8('0x11e')](db[_0xdaa8('0x118')],{});db[_0xdaa8('0x1da')][_0xdaa8('0x11e')](db[_0xdaa8('0x47')],{'foreignKey':'FromFaxAccountId','as':_0xdaa8('0x1d5')});db[_0xdaa8('0x1da')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':_0xdaa8('0x1d6'),'as':'FromAgent'});db[_0xdaa8('0x1da')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':_0xdaa8('0x1db'),'as':_0xdaa8('0x1dc')});db[_0xdaa8('0x1da')][_0xdaa8('0x11e')](db[_0xdaa8('0x4d')],{'foreignKey':_0xdaa8('0x1dd'),'as':'ToQueue'});db['FaxTransferReport'][_0xdaa8('0x11e')](db[_0xdaa8('0x47')],{'foreignKey':_0xdaa8('0x1de'),'as':'ToAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0xdaa8('0x5f')],{});db[_0xdaa8('0xf6')]['belongsTo'](db[_0xdaa8('0x5e')],{});db['OpenchannelTransferReport'][_0xdaa8('0x11e')](db[_0xdaa8('0x5b')],{'foreignKey':'FromOpenchannelAccountId','as':_0xdaa8('0x1d5')});db[_0xdaa8('0xf6')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':_0xdaa8('0x1d6'),'as':_0xdaa8('0x1d3')});db[_0xdaa8('0xf6')][_0xdaa8('0x11e')](db['User'],{'foreignKey':_0xdaa8('0x1db'),'as':_0xdaa8('0x1dc')});db[_0xdaa8('0xf6')][_0xdaa8('0x11e')](db[_0xdaa8('0x60')],{'foreignKey':_0xdaa8('0x1df'),'as':_0xdaa8('0x1d8')});db['OpenchannelTransferReport']['belongsTo'](db[_0xdaa8('0x5b')],{'foreignKey':_0xdaa8('0x1e0'),'as':_0xdaa8('0x1d9')});db[_0xdaa8('0x1e1')][_0xdaa8('0x11e')](db['SmsMessage'],{});db[_0xdaa8('0x1e1')][_0xdaa8('0x11e')](db[_0xdaa8('0x55')],{});db[_0xdaa8('0x1e1')][_0xdaa8('0x11e')](db[_0xdaa8('0x51')],{'foreignKey':_0xdaa8('0x1e2'),'as':_0xdaa8('0x1d5')});db[_0xdaa8('0x1e1')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':_0xdaa8('0x1d6'),'as':_0xdaa8('0x1d3')});db[_0xdaa8('0x1e1')]['belongsTo'](db[_0xdaa8('0x11')],{'foreignKey':_0xdaa8('0x1db'),'as':_0xdaa8('0x1dc')});db[_0xdaa8('0x1e1')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0xdaa8('0x1e3'),'as':'ToQueue'});db[_0xdaa8('0x1e1')][_0xdaa8('0x11e')](db[_0xdaa8('0x51')],{'foreignKey':_0xdaa8('0x1e4'),'as':_0xdaa8('0x1d9')});db[_0xdaa8('0xf7')]['hasMany'](db[_0xdaa8('0x7f')],{'as':'Dispositions','foreignKey':'ListId'});db[_0xdaa8('0xf7')][_0xdaa8('0x10f')](db[_0xdaa8('0x79')],{'as':'CustomFields','foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0xf7')][_0xdaa8('0x10f')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x123'),'onDelete':'cascade','foreignKey':_0xdaa8('0x168')});db['CmList'][_0xdaa8('0x10f')](db[_0xdaa8('0x75')],{'as':'HopperFinals','foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0xf7')]['hasMany'](db[_0xdaa8('0x77')],{'as':_0xdaa8('0x116'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0xf7')]['hasMany'](db['ReportAgentPreview'],{'as':_0xdaa8('0x78'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0xf7')]['belongsToMany'](db[_0xdaa8('0x14b')],{'as':_0xdaa8('0x1e5'),'through':_0xdaa8('0x155')});db['CmList'][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':'Agents','through':_0xdaa8('0x126')});db[_0xdaa8('0x136')][_0xdaa8('0x10f')](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade'});db[_0xdaa8('0x136')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16a'),'through':_0xdaa8('0x138')});db['UserProfile'][_0xdaa8('0x10f')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x18a'),'foreignKey':_0xdaa8('0x11f')});db['UserProfile'][_0xdaa8('0x10f')](db[_0xdaa8('0x1e6')],{'as':_0xdaa8('0x1e7'),'foreignKey':_0xdaa8('0x11f'),'onDelete':'cascade'});db['UserProfileSection'][_0xdaa8('0x10f')](db[_0xdaa8('0xfc')],{'as':_0xdaa8('0x1e8'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0xdaa8('0xff')][_0xdaa8('0x10f')](db[_0xdaa8('0x7f')],{'as':_0xdaa8('0x164'),'foreignKey':_0xdaa8('0x1e9')});db[_0xdaa8('0xff')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xdaa8('0x1e9')});db[_0xdaa8('0xff')][_0xdaa8('0x10f')](db[_0xdaa8('0x1ea')],{'as':_0xdaa8('0x16c'),'foreignKey':_0xdaa8('0x1e9')});db[_0xdaa8('0xff')]['hasMany'](db[_0xdaa8('0x102')],{'as':_0xdaa8('0x167')});db[_0xdaa8('0xff')][_0xdaa8('0x10f')](db[_0xdaa8('0x100')],{'as':'Applications'});db[_0xdaa8('0xff')]['belongsTo'](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0xff')][_0xdaa8('0x11e')](db['Pause'],{'as':_0xdaa8('0x153'),'foreignKey':_0xdaa8('0x154')});db['WhatsappAccount'][_0xdaa8('0x120')](db['User'],{'as':_0xdaa8('0x16a'),'through':_0xdaa8('0x143')});db['WhatsappApplication']['belongsTo'](db[_0xdaa8('0x11')],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x100')][_0xdaa8('0x11e')](db['WhatsappQueue'],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x100')]['belongsTo'](db[_0xdaa8('0xff')],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x100')][_0xdaa8('0x11e')](db['Interval'],{'onDelete':_0xdaa8('0x176'),'foreignKey':'IntervalId'});db['WhatsappApplication'][_0xdaa8('0x11e')](db[_0xdaa8('0x170')],{'onDelete':_0xdaa8('0x176'),'foreignKey':_0xdaa8('0x177')});db[_0xdaa8('0x102')]['hasMany'](db[_0xdaa8('0x1ea')],{'as':_0xdaa8('0x16c'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1eb')});db['WhatsappInteraction'][_0xdaa8('0x11e')](db['WhatsappAccount'],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x1e9')});db[_0xdaa8('0x102')][_0xdaa8('0x11e')](db['CmContact'],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db['WhatsappInteraction'][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':'Owner','foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x102')][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':'whatsapp_interaction_has_tags','as':_0xdaa8('0x172')});db[_0xdaa8('0x102')][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x1af'),'as':_0xdaa8('0x180')});db[_0xdaa8('0x102')]['belongsToMany'](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x18a'),'through':_0xdaa8('0x12e'),'foreignKey':'WhatsappInteractionId'});db[_0xdaa8('0x1ea')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x11')});db[_0xdaa8('0x1ea')][_0xdaa8('0x11e')](db['CmContact'],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x16e')});db[_0xdaa8('0x1ea')][_0xdaa8('0x11e')](db[_0xdaa8('0x102')],{'onDelete':_0xdaa8('0x10d'),'as':'Interaction','foreignKey':_0xdaa8('0x1eb')});db[_0xdaa8('0x1ea')]['belongsTo'](db[_0xdaa8('0xff')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x1e9')});db[_0xdaa8('0x105')][_0xdaa8('0x11e')](db[_0xdaa8('0xff')],{});db[_0xdaa8('0x105')]['belongsTo'](db['CmList'],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0x105')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x105')][_0xdaa8('0x11e')](db['WhatsappInteraction'],{});db[_0xdaa8('0x105')][_0xdaa8('0x11e')](db[_0xdaa8('0x109')],{});db[_0xdaa8('0x105')][_0xdaa8('0x11e')](db[_0xdaa8('0x1ea')],{});db[_0xdaa8('0x105')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{});db[_0xdaa8('0x107')][_0xdaa8('0x11e')](db[_0xdaa8('0x1ea')],{});db[_0xdaa8('0x107')][_0xdaa8('0x11e')](db[_0xdaa8('0x102')],{});db['WhatsappTransferReport'][_0xdaa8('0x11e')](db[_0xdaa8('0xff')],{'foreignKey':'FromWhatsappAccountId','as':_0xdaa8('0x1d5')});db[_0xdaa8('0x107')][_0xdaa8('0x11e')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':_0xdaa8('0x1d9')});db[_0xdaa8('0x107')][_0xdaa8('0x11e')](db[_0xdaa8('0x109')],{'foreignKey':_0xdaa8('0x1ec'),'as':_0xdaa8('0x1d8')});db[_0xdaa8('0x107')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':'FromUserId','as':_0xdaa8('0x1d3')});db[_0xdaa8('0x107')][_0xdaa8('0x11e')](db['User'],{'foreignKey':_0xdaa8('0x1db'),'as':_0xdaa8('0x1dc')});db['WhatsappQueue'][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16a'),'through':'UserWhatsappQueue','foreignKey':_0xdaa8('0x1ed')});db[_0xdaa8('0x109')]['belongsToMany'](db[_0xdaa8('0xe8')],{'through':_0xdaa8('0x1ee'),'as':_0xdaa8('0x157')});module[_0xdaa8('0x1ef')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xf78f=['Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','ZendeskField','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Integration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','WhatsappAccount','../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','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','UserId','VoiceRecording','Recordings','hasMany','VoiceQueuesRt','Extensions','cascade','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','WhatsappInteractions','Notifications','belongsTo','userProfileId','belongsToMany','CmContact','Lists','Team','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','VoiceQueues','MailQueues','ChatQueues','UserChatQueue','FaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_square_projects','SpiedAgents','ChanSpyId','moh_has_sounds','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','VoiceCallReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','MailApplication','Applications','ListId','TemplateId','team_has_mail_queues','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','restrict','TagId','List','Dashboard','Items','Answers','FaxAccountId','Interactions','Exntensions','FaxMessage','FaxInteractionId','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','OpenchannelQueueReport','Agent','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','Members','Contacts','CompanyId','cm_user_has_contacts','cm_contact_has_tags','CmHopper','Queue','CampaignId','Automation','All','OneAll','AutomationAllId','Any','Actions','AutomationId','ParentId','Intervals','ChatApplications','SmsApplications','DefaultReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','CustomReportId','MetricId','SalesforceField','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Description','Variable','VariableId','Configurations','Subjects','Field','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','Dynamics365Account','Dynamics365Field','FreshsalesAccount','ToId','SessionId','ProjectId','FaxQueues','team_has_whatsapp_queues','SquareProject','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ChatTransferReport','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToAgent','ToFaxQueueId','ToAccount','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','Resources','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','ToQueueId','exports','path','sequelize','lodash','jstz','determine','defaultsDeep','xC@LL1234','mysql','utf8mb4','name','utf8','sequelizeHistory','motion2','xcall','127.0.0.1','utf8_general_ci','database','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model'];(function(_0x327d82,_0x551167){var _0x78153d=function(_0x36b556){while(--_0x36b556){_0x327d82['push'](_0x327d82['shift']());}};_0x78153d(++_0x551167);}(_0xf78f,0x168));var _0xff78=function(_0x3ea849,_0x1d0eb0){_0x3ea849=_0x3ea849-0x0;var _0x5ccdb2=_0xf78f[_0x3ea849];return _0x5ccdb2;};'use strict';var path=require(_0xff78('0x0'));var config=require('../config/environment');var Sequelize=require(_0xff78('0x1'));var _=require(_0xff78('0x2'));var jstz=require(_0xff78('0x3'));var timezone=jstz[_0xff78('0x4')]();config['sequelize']=_[_0xff78('0x5')](config['sequelize'],{'database':'motion2','username':'xcall','password':_0xff78('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xff78('0x7'),'dialectOptions':{'charset':_0xff78('0x8')},'logging':![],'timezone':timezone[_0xff78('0x9')](),'define':{'charset':_0xff78('0xa'),'collate':'utf8_general_ci'}}});config[_0xff78('0xb')]=_[_0xff78('0x5')](config[_0xff78('0xb')],{'database':_0xff78('0xc'),'username':_0xff78('0xd'),'password':_0xff78('0x6'),'options':{'host':_0xff78('0xe'),'port':0xcea,'dialect':_0xff78('0x7'),'dialectOptions':{'charset':_0xff78('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xff78('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xff78('0x1')][_0xff78('0x10')],config[_0xff78('0x1')]['username'],config[_0xff78('0x1')][_0xff78('0x11')],config[_0xff78('0x1')][_0xff78('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xff78('0xb')][_0xff78('0x10')],config[_0xff78('0xb')]['username'],config[_0xff78('0xb')][_0xff78('0x11')],config[_0xff78('0xb')]['options'])};db[_0xff78('0x13')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x15'));db[_0xff78('0x16')]=db['sequelize'][_0xff78('0x14')](_0xff78('0x17'));db[_0xff78('0x18')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x19'));db[_0xff78('0x1a')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x1b'));db[_0xff78('0x1c')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x1d'));db[_0xff78('0x1e')]=db[_0xff78('0x1')]['import'](_0xff78('0x1f'));db['VoiceRecording']=db['sequelize'][_0xff78('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0xff78('0x20')]=db['sequelize']['import'](_0xff78('0x21'));db[_0xff78('0x22')]=db['sequelize'][_0xff78('0x14')](_0xff78('0x23'));db[_0xff78('0x24')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x25'));db['VoiceCallReport']=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x26'));db[_0xff78('0x27')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x28'));db[_0xff78('0x29')]=db['sequelize'][_0xff78('0x14')](_0xff78('0x2a'));db[_0xff78('0x2b')]=db['sequelize']['import'](_0xff78('0x2c'));db[_0xff78('0x2d')]=db['sequelize']['import'](_0xff78('0x2e'));db[_0xff78('0x2f')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x30'));db[_0xff78('0x31')]=db[_0xff78('0x1')][_0xff78('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xff78('0x32')]=db[_0xff78('0x1')]['import'](_0xff78('0x33'));db[_0xff78('0x34')]=db['sequelize'][_0xff78('0x14')](_0xff78('0x35'));db['UserChatQueue']=db['sequelize'][_0xff78('0x14')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x36'));db[_0xff78('0x37')]=db[_0xff78('0x1')][_0xff78('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0xff78('0x38')]=db[_0xff78('0x1')][_0xff78('0x14')]('../api/userSmsQueue/userSmsQueue.model');db[_0xff78('0x39')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x3a'));db[_0xff78('0x3b')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x3c'));db[_0xff78('0x3d')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x3e'));db[_0xff78('0x3f')]=db['sequelize']['import']('../api/mailServerOut/mailServerOut.model');db[_0xff78('0x40')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x41'));db[_0xff78('0x42')]=db[_0xff78('0x1')]['import'](_0xff78('0x43'));db[_0xff78('0x44')]=db[_0xff78('0x1')]['import'](_0xff78('0x45'));db[_0xff78('0x46')]=db['sequelize']['import']('../api/mailInteraction/mailInteraction.model');db[_0xff78('0x47')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x48'));db['MailApplication']=db['sequelize']['import'](_0xff78('0x49'));db[_0xff78('0x4a')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x4b'));db['Dashboard']=db[_0xff78('0x1')]['import'](_0xff78('0x4c'));db[_0xff78('0x4d')]=db[_0xff78('0x1')][_0xff78('0x14')]('../api/dashboardItem/dashboardItem.model');db[_0xff78('0x4e')]=db[_0xff78('0x1')][_0xff78('0x14')]('../api/faxAccount/faxAccount.model');db[_0xff78('0x4f')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x50'));db['FaxInteraction']=db['sequelize']['import'](_0xff78('0x51'));db['FaxMessage']=db['sequelize']['import'](_0xff78('0x52'));db['FaxQueue']=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x53'));db[_0xff78('0x54')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x55'));db[_0xff78('0x56')]=db[_0xff78('0x1')][_0xff78('0x14')]('../api/smsAccount/smsAccount.model');db[_0xff78('0x57')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x58'));db[_0xff78('0x59')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x5a'));db[_0xff78('0x5b')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x5c'));db[_0xff78('0x5d')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x5e'));db[_0xff78('0x5f')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x60'));db['OpenchannelApplication']=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x61'));db['OpenchannelInteraction']=db[_0xff78('0x1')][_0xff78('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xff78('0x62')]=db[_0xff78('0x1')]['import'](_0xff78('0x63'));db[_0xff78('0x64')]=db[_0xff78('0x1')]['import'](_0xff78('0x65'));db[_0xff78('0x66')]=db[_0xff78('0x1')]['import'](_0xff78('0x67'));db['OpenchannelQueueReport']=db[_0xff78('0x1')]['import'](_0xff78('0x68'));db[_0xff78('0x69')]=db[_0xff78('0x1')]['import'](_0xff78('0x6a'));db[_0xff78('0x6b')]=db[_0xff78('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0xff78('0x6c')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x6d'));db[_0xff78('0x6e')]=db[_0xff78('0x1')][_0xff78('0x14')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xff78('0x6f')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x70'));db[_0xff78('0x71')]=db[_0xff78('0x1')][_0xff78('0x14')]('../api/chatGroup/chatGroup.model');db[_0xff78('0x72')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x73'));db[_0xff78('0x74')]=db[_0xff78('0x1')]['import'](_0xff78('0x75'));db['CmContact']=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x76'));db['CmHopper']=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x77'));db[_0xff78('0x78')]=db['sequelize'][_0xff78('0x14')](_0xff78('0x79'));db[_0xff78('0x7a')]=db[_0xff78('0x1')]['import'](_0xff78('0x7b'));db['CmHopperHistory']=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x7c'));db[_0xff78('0x7d')]=db['sequelize'][_0xff78('0x14')](_0xff78('0x7e'));db[_0xff78('0x7f')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x80'));db[_0xff78('0x81')]=db[_0xff78('0x1')]['import']('../api/action/action.model');db['Automation']=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x82'));db[_0xff78('0x83')]=db[_0xff78('0x1')]['import'](_0xff78('0x84'));db[_0xff78('0x85')]=db[_0xff78('0x1')]['import'](_0xff78('0x86'));db[_0xff78('0x87')]=db[_0xff78('0x1')]['import'](_0xff78('0x88'));db[_0xff78('0x89')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x8a'));db[_0xff78('0x8b')]=db[_0xff78('0x1')]['import']('../api/pause/pause.model');db[_0xff78('0x8c')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x8d'));db['VoiceQueuesLog']=db[_0xff78('0x1')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xff78('0x8e')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x8f'));db[_0xff78('0x90')]=db['sequelize'][_0xff78('0x14')](_0xff78('0x91'));db[_0xff78('0x92')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x93'));db[_0xff78('0x94')]=db['sequelize'][_0xff78('0x14')]('../api/template/template.model');db['Trigger']=db[_0xff78('0x1')]['import']('../api/trigger/trigger.model');db['Variable']=db[_0xff78('0x1')]['import'](_0xff78('0x95'));db['Integration']=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x96'));db[_0xff78('0x97')]=db['sequelize'][_0xff78('0x14')](_0xff78('0x98'));db[_0xff78('0x99')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x9a'));db[_0xff78('0x9b')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x9c'));db[_0xff78('0x9d')]=db[_0xff78('0x1')]['import'](_0xff78('0x9e'));db[_0xff78('0x9f')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xa0'));db[_0xff78('0xa1')]=db[_0xff78('0x1')][_0xff78('0x14')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xff78('0xa2')]=db[_0xff78('0x1')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0xff78('0xa3')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xa4'));db[_0xff78('0xa5')]=db['sequelize'][_0xff78('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xa6'));db[_0xff78('0xa7')]=db['sequelize']['import'](_0xff78('0xa8'));db[_0xff78('0xa9')]=db[_0xff78('0x1')]['import'](_0xff78('0xaa'));db[_0xff78('0xab')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xac'));db[_0xff78('0xad')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xae'));db[_0xff78('0xaf')]=db[_0xff78('0x1')]['import'](_0xff78('0xb0'));db[_0xff78('0xb1')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xb2'));db[_0xff78('0xb3')]=db[_0xff78('0x1')]['import']('../api/intZohoAccount/intZohoAccount.model');db[_0xff78('0xb4')]=db[_0xff78('0x1')]['import'](_0xff78('0xb5'));db[_0xff78('0xb6')]=db['sequelize'][_0xff78('0x14')](_0xff78('0xb7'));db[_0xff78('0xb8')]=db[_0xff78('0x1')][_0xff78('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xff78('0xb9')]=db[_0xff78('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xff78('0xba')]=db[_0xff78('0x1')][_0xff78('0x14')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0xff78('0x1')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xff78('0xbb')]=db[_0xff78('0x1')][_0xff78('0x14')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xff78('0xbc')]=db['sequelize'][_0xff78('0x14')](_0xff78('0xbd'));db[_0xff78('0xbe')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xbf'));db['VtigerConfiguration']=db[_0xff78('0x1')][_0xff78('0x14')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xff78('0xc0')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xc1'));db['ServicenowAccount']=db['sequelize'][_0xff78('0x14')](_0xff78('0xc2'));db[_0xff78('0xc3')]=db[_0xff78('0x1')]['import'](_0xff78('0xc4'));db[_0xff78('0xc5')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xc6'));db['Dynamics365Account']=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xc7'));db[_0xff78('0xc8')]=db[_0xff78('0x1')][_0xff78('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xc9'));db['FreshsalesAccount']=db[_0xff78('0x1')]['import'](_0xff78('0xca'));db[_0xff78('0xcb')]=db['sequelize'][_0xff78('0x14')](_0xff78('0xcc'));db[_0xff78('0xcd')]=db[_0xff78('0x1')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db[_0xff78('0xce')]=db[_0xff78('0x1')]['import']('../api/integration/integration.model');db[_0xff78('0xcf')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xd0'));db[_0xff78('0xd1')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xd2'));db[_0xff78('0xd3')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xd4'));db[_0xff78('0xd5')]=db[_0xff78('0x1')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xff78('0xd6')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xd7'));db[_0xff78('0xd8')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xd9'));db[_0xff78('0xda')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xdb'));db[_0xff78('0xdc')]=db['sequelize']['import']('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db['sequelize']['import']('../api/squareReportDetail/squareReportDetail.model');db[_0xff78('0xdd')]=db[_0xff78('0x1')]['import'](_0xff78('0xde'));db[_0xff78('0xdf')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xe0'));db[_0xff78('0xe1')]=db[_0xff78('0x1')]['import']('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db[_0xff78('0x1')]['import'](_0xff78('0xe2'));db[_0xff78('0xe3')]=db['sequelize'][_0xff78('0x14')](_0xff78('0xe4'));db[_0xff78('0xe5')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xe6'));db['Team']=db[_0xff78('0x1')]['import']('../api/team/team.model');db['License']=db['sequelize']['import'](_0xff78('0xe7'));db[_0xff78('0xe8')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xe9'));db['Migration']=db['sequelize'][_0xff78('0x14')](_0xff78('0xea'));db[_0xff78('0xeb')]=db['sequelize'][_0xff78('0x14')]('../api/attachment/attachment.model');db['Plugin']=db[_0xff78('0x1')]['import']('../api/plugin/plugin.model');db['MailTransferReport']=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xec'));db['ChatTransferReport']=db[_0xff78('0x1')]['import'](_0xff78('0xed'));db[_0xff78('0xee')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xef'));db[_0xff78('0xf0')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xf1'));db['SmsTransferReport']=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xf2'));db[_0xff78('0xf3')]=db[_0xff78('0x1')]['import'](_0xff78('0xf4'));db[_0xff78('0xf5')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xf6'));db[_0xff78('0xf7')]=db[_0xff78('0x1')][_0xff78('0x14')]('../api/userProfile/userProfile.model');db[_0xff78('0xf8')]=db[_0xff78('0x1')]['import'](_0xff78('0xf9'));db[_0xff78('0xfa')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xfb'));db[_0xff78('0xfc')]=db[_0xff78('0x1')][_0xff78('0x14')]('../api/notification/notification.model');db[_0xff78('0xfd')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0xfe'));db[_0xff78('0xff')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x100'));db[_0xff78('0x101')]=db['sequelize'][_0xff78('0x14')](_0xff78('0x102'));db[_0xff78('0x103')]=db['sequelize'][_0xff78('0x14')](_0xff78('0x104'));db[_0xff78('0x105')]=db['sequelize'][_0xff78('0x14')](_0xff78('0x106'));db[_0xff78('0x107')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x108'));db[_0xff78('0x109')]=db['sequelize'][_0xff78('0x14')](_0xff78('0x10a'));db[_0xff78('0x10b')]=db[_0xff78('0x1')][_0xff78('0x14')](_0xff78('0x10c'));db[_0xff78('0x13')]['hasOne'](db[_0xff78('0x22')],{'as':_0xff78('0x22'),'onDelete':'cascade','foreignKey':_0xff78('0x10d')});db[_0xff78('0x13')]['hasMany'](db[_0xff78('0x10e')],{'as':_0xff78('0x10f'),'foreignKey':'UserId'});db[_0xff78('0x13')][_0xff78('0x110')](db[_0xff78('0x32')],{'as':_0xff78('0x111'),'foreignKey':_0xff78('0x10d')});db['User']['hasMany'](db[_0xff78('0x1a')],{'as':_0xff78('0x112'),'onDelete':_0xff78('0x113'),'hooks':!![]});db[_0xff78('0x13')][_0xff78('0x110')](db[_0xff78('0x7a')],{'as':_0xff78('0x114'),'foreignKey':'UserId'});db['User'][_0xff78('0x110')](db[_0xff78('0x115')],{'as':_0xff78('0x116'),'foreignKey':_0xff78('0x10d')});db[_0xff78('0x13')][_0xff78('0x110')](db['ReportAgentPreview'],{'as':_0xff78('0x7d'),'foreignKey':_0xff78('0x10d')});db[_0xff78('0x13')]['hasMany'](db[_0xff78('0x117')],{'as':_0xff78('0x118'),'foreignKey':_0xff78('0x10d')});db[_0xff78('0x13')][_0xff78('0x110')](db['ChatInteraction'],{'as':_0xff78('0x119'),'foreignKey':_0xff78('0x10d')});db['User']['hasMany'](db[_0xff78('0x59')],{'as':_0xff78('0x11a'),'foreignKey':_0xff78('0x10d')});db[_0xff78('0x13')][_0xff78('0x110')](db[_0xff78('0x11b')],{'as':_0xff78('0x11c'),'foreignKey':'UserId'});db[_0xff78('0x13')]['hasMany'](db[_0xff78('0x46')],{'as':'MailInteractions','foreignKey':_0xff78('0x10d')});db[_0xff78('0x13')]['hasMany'](db[_0xff78('0x101')],{'as':_0xff78('0x11d'),'foreignKey':_0xff78('0x10d')});db['User'][_0xff78('0x110')](db[_0xff78('0xfc')],{'as':_0xff78('0x11e'),'foreignKey':'SenderId'});db['User'][_0xff78('0x11f')](db[_0xff78('0xf7')],{'as':_0xff78('0xf7'),'foreignKey':_0xff78('0x120')});db[_0xff78('0x13')]['belongsToMany'](db['ChatGroup'],{'as':'Groups','through':'chat_group_has_users'});db[_0xff78('0x13')][_0xff78('0x121')](db[_0xff78('0x122')],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0xff78('0x13')][_0xff78('0x121')](db[_0xff78('0xf3')],{'as':_0xff78('0x123'),'through':'cm_user_has_lists'});db['User'][_0xff78('0x121')](db[_0xff78('0x124')],{'through':_0xff78('0x125')});db['User'][_0xff78('0x121')](db[_0xff78('0x46')],{'as':_0xff78('0x126'),'through':_0xff78('0x127')});db[_0xff78('0x13')][_0xff78('0x121')](db[_0xff78('0x6b')],{'as':_0xff78('0x119'),'through':_0xff78('0x128')});db['User'][_0xff78('0x121')](db[_0xff78('0x11b')],{'as':'FaxInteractions','through':_0xff78('0x129')});db[_0xff78('0x13')][_0xff78('0x121')](db[_0xff78('0x59')],{'as':'SmsInteractions','through':_0xff78('0x12a')});db[_0xff78('0x13')][_0xff78('0x121')](db[_0xff78('0x117')],{'as':_0xff78('0x118'),'through':'user_has_openchannel_interactions'});db[_0xff78('0x13')][_0xff78('0x121')](db[_0xff78('0x101')],{'as':_0xff78('0x11d'),'through':'user_has_whatsapp_interactions'});db[_0xff78('0x13')][_0xff78('0x121')](db['VoiceQueue'],{'as':_0xff78('0x12b'),'through':'UserVoiceQueue','required':![]});db['User']['belongsToMany'](db[_0xff78('0x42')],{'as':_0xff78('0x12c'),'through':'UserMailQueue','required':![]});db[_0xff78('0x13')][_0xff78('0x121')](db[_0xff78('0x6f')],{'as':_0xff78('0x12d'),'through':_0xff78('0x12e'),'required':![],'hooks':!![]});db['User'][_0xff78('0x121')](db[_0xff78('0x12f')],{'as':'FaxQueues','through':_0xff78('0x37'),'required':![]});db['User'][_0xff78('0x121')](db[_0xff78('0x5d')],{'as':_0xff78('0x130'),'through':_0xff78('0x38'),'required':![]});db[_0xff78('0x13')][_0xff78('0x121')](db[_0xff78('0x64')],{'as':_0xff78('0x131'),'through':_0xff78('0x39'),'required':![]});db[_0xff78('0x13')][_0xff78('0x121')](db['WhatsappQueue'],{'as':_0xff78('0x132'),'through':_0xff78('0x3b'),'required':![]});db[_0xff78('0x13')][_0xff78('0x121')](db[_0xff78('0xf3')],{'through':_0xff78('0x133')});db[_0xff78('0x13')][_0xff78('0x121')](db[_0xff78('0xf5')],{'as':_0xff78('0x134'),'through':_0xff78('0x135'),'required':![]});db[_0xff78('0x13')][_0xff78('0x121')](db[_0xff78('0x66')],{'as':_0xff78('0x136'),'through':_0xff78('0x137')});db[_0xff78('0x13')][_0xff78('0x121')](db[_0xff78('0x4e')],{'as':_0xff78('0x138'),'through':_0xff78('0x139')});db['User']['belongsToMany'](db[_0xff78('0x40')],{'as':'MailAccounts','through':_0xff78('0x13a')});db[_0xff78('0x13')]['belongsToMany'](db[_0xff78('0x5f')],{'as':_0xff78('0x13b'),'through':_0xff78('0x13c')});db[_0xff78('0x13')][_0xff78('0x121')](db[_0xff78('0x56')],{'as':_0xff78('0x13d'),'through':'user_has_sms_accounts'});db[_0xff78('0x13')][_0xff78('0x121')](db['WhatsappAccount'],{'as':_0xff78('0x13e'),'through':'user_has_whatsapp_accounts'});db['User']['belongsToMany'](db['SquareProject'],{'as':'SquareProjects','through':_0xff78('0x13f')});db['VoiceChanSpy'][_0xff78('0x110')](db[_0xff78('0x1a')],{'as':_0xff78('0x140'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x141')});db[_0xff78('0x18')][_0xff78('0x110')](db[_0xff78('0x1a')],{'onDelete':_0xff78('0x113')});db[_0xff78('0x1a')]['hasMany'](db[_0xff78('0x1a')],{'as':'Applications','onDelete':_0xff78('0x113')});db[_0xff78('0x1c')][_0xff78('0x121')](db[_0xff78('0x90')],{'as':'Sounds','through':_0xff78('0x142')});db[_0xff78('0x1e')][_0xff78('0x110')](db[_0xff78('0x32')],{'as':'Members','foreignKey':_0xff78('0x143')});db[_0xff78('0x1e')]['hasMany'](db['CmHopper'],{'as':_0xff78('0x144'),'foreignKey':_0xff78('0x143')});db[_0xff78('0x1e')]['hasMany'](db[_0xff78('0x7a')],{'as':'HopperFinals','foreignKey':_0xff78('0x143')});db[_0xff78('0x1e')][_0xff78('0x110')](db[_0xff78('0x115')],{'as':_0xff78('0x145'),'foreignKey':_0xff78('0x143')});db[_0xff78('0x1e')][_0xff78('0x110')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0xff78('0x1e')]['hasMany'](db[_0xff78('0x78')],{'as':_0xff78('0x146'),'foreignKey':_0xff78('0x143')});db[_0xff78('0x1e')]['hasMany'](db['JscriptySessionReport'],{'as':_0xff78('0x147'),'foreignKey':_0xff78('0x143')});db[_0xff78('0x1e')][_0xff78('0x11f')](db[_0xff78('0x2f')],{'as':_0xff78('0x2f'),'foreignKey':_0xff78('0x148')});db[_0xff78('0x1e')]['belongsTo'](db['Trunk'],{'as':_0xff78('0x149'),'foreignKey':_0xff78('0x14a')});db[_0xff78('0x1e')][_0xff78('0x11f')](db[_0xff78('0x89')],{'as':_0xff78('0x89'),'foreignKey':_0xff78('0x14b')});db[_0xff78('0x1e')][_0xff78('0x11f')](db[_0xff78('0x8b')],{'as':_0xff78('0x14c'),'foreignKey':_0xff78('0x14d')});db[_0xff78('0x1e')][_0xff78('0x121')](db[_0xff78('0xf3')],{'as':_0xff78('0x123'),'through':_0xff78('0x14e')});db[_0xff78('0x1e')]['belongsToMany'](db[_0xff78('0x13')],{'as':_0xff78('0x14f'),'through':_0xff78('0x34')});db[_0xff78('0x1e')][_0xff78('0x121')](db[_0xff78('0x124')],{'as':_0xff78('0x150'),'through':_0xff78('0x151')});db['VoiceQueue']['belongsToMany'](db[_0xff78('0xf3')],{'as':_0xff78('0x152'),'through':_0xff78('0x153')});db[_0xff78('0x10e')][_0xff78('0x11f')](db['User'],{'as':_0xff78('0x13'),'foreignKey':_0xff78('0x10d')});db[_0xff78('0x20')][_0xff78('0x11f')](db[_0xff78('0x13')],{'as':'User','foreignKey':_0xff78('0x10d')});db[_0xff78('0x22')]['hasMany'](db['VoiceMailMessage'],{'as':_0xff78('0x154'),'onDelete':_0xff78('0x113'),'foreignKey':'mailboxuser','sourceKey':_0xff78('0x155')});db[_0xff78('0x24')][_0xff78('0x11f')](db[_0xff78('0x22')],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db[_0xff78('0x156')][_0xff78('0x110')](db['VoiceQueueReport'],{'as':_0xff78('0x157'),'foreignKey':_0xff78('0x158'),'constraints':![]});db[_0xff78('0x156')][_0xff78('0x110')](db['VoiceAgentReport'],{'as':_0xff78('0x159'),'foreignKey':_0xff78('0x158'),'constraints':![]});db['VoiceCallReport'][_0xff78('0x11f')](db[_0xff78('0x13')],{'as':_0xff78('0x13'),'foreignKey':_0xff78('0x10d')});db[_0xff78('0x156')][_0xff78('0x11f')](db['CmContact'],{'as':_0xff78('0x15a'),'foreignKey':_0xff78('0x15b')});db[_0xff78('0x3d')][_0xff78('0x11f')](db[_0xff78('0x40')],{'as':'MailAccount','foreignKey':_0xff78('0x15c')});db[_0xff78('0x3f')][_0xff78('0x11f')](db[_0xff78('0x40')],{'as':_0xff78('0x40'),'foreignKey':'MailAccountId'});db['MailAccount']['hasOne'](db[_0xff78('0x3d')],{'as':_0xff78('0x15d'),'onDelete':_0xff78('0x113')});db[_0xff78('0x40')]['hasOne'](db[_0xff78('0x3f')],{'as':_0xff78('0x15e'),'onDelete':_0xff78('0x113')});db[_0xff78('0x40')]['hasMany'](db[_0xff78('0x85')],{'as':_0xff78('0x15f'),'foreignKey':_0xff78('0x15c')});db[_0xff78('0x40')][_0xff78('0x110')](db['CannedAnswer'],{'as':'Answers','foreignKey':'MailAccountId'});db[_0xff78('0x40')][_0xff78('0x110')](db['MailMessage'],{'as':_0xff78('0x154'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xff78('0x110')](db[_0xff78('0x46')],{'as':'Interactions'});db[_0xff78('0x40')][_0xff78('0x110')](db[_0xff78('0x160')],{'as':_0xff78('0x161')});db[_0xff78('0x40')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xff78('0x162')});db[_0xff78('0x40')]['belongsTo'](db[_0xff78('0x94')],{'as':'Template','foreignKey':_0xff78('0x163')});db[_0xff78('0x40')]['belongsTo'](db[_0xff78('0x8b')],{'as':_0xff78('0x14c'),'foreignKey':_0xff78('0x14d')});db[_0xff78('0x40')][_0xff78('0x121')](db['User'],{'as':'Agents','through':_0xff78('0x13a')});db[_0xff78('0x42')][_0xff78('0x121')](db['User'],{'as':_0xff78('0x14f'),'through':'UserMailQueue'});db['MailQueue'][_0xff78('0x121')](db[_0xff78('0x124')],{'through':_0xff78('0x164'),'as':_0xff78('0x150')});db[_0xff78('0x46')]['hasMany'](db[_0xff78('0x47')],{'as':_0xff78('0x154'),'onDelete':_0xff78('0x113'),'foreignKey':'MailInteractionId'});db[_0xff78('0x46')][_0xff78('0x11f')](db[_0xff78('0x40')],{'as':_0xff78('0x165'),'foreignKey':'MailAccountId'});db[_0xff78('0x46')][_0xff78('0x11f')](db[_0xff78('0x122')],{'as':_0xff78('0x15a'),'foreignKey':_0xff78('0x15b')});db[_0xff78('0x46')][_0xff78('0x11f')](db[_0xff78('0x13')],{'as':_0xff78('0x166'),'foreignKey':'UserId'});db[_0xff78('0x46')][_0xff78('0x121')](db[_0xff78('0x92')],{'through':_0xff78('0x167'),'as':_0xff78('0x168')});db['MailInteraction']['belongsToMany'](db[_0xff78('0x92')],{'through':_0xff78('0x167'),'as':_0xff78('0x169')});db['MailInteraction'][_0xff78('0x121')](db[_0xff78('0x13')],{'as':_0xff78('0x16a'),'through':_0xff78('0x127'),'foreignKey':_0xff78('0x16b')});db[_0xff78('0x47')]['hasMany'](db[_0xff78('0xeb')],{'as':_0xff78('0x16c'),'onDelete':_0xff78('0x113')});db[_0xff78('0x47')]['belongsTo'](db[_0xff78('0x13')],{'as':_0xff78('0x13')});db[_0xff78('0x47')][_0xff78('0x11f')](db[_0xff78('0x122')],{'onDelete':_0xff78('0x113'),'as':'Contact'});db['MailMessage'][_0xff78('0x11f')](db['MailInteraction'],{'as':'Interaction','foreignKey':'MailInteractionId'});db['MailMessage'][_0xff78('0x11f')](db[_0xff78('0x40')],{'as':'Account','foreignKey':_0xff78('0x15c')});db[_0xff78('0x160')][_0xff78('0x11f')](db['User'],{'onDelete':'restrict'});db[_0xff78('0x160')][_0xff78('0x11f')](db['MailQueue'],{'onDelete':_0xff78('0x16d')});db[_0xff78('0x160')][_0xff78('0x11f')](db[_0xff78('0x40')],{'onDelete':_0xff78('0x16d')});db[_0xff78('0x160')]['belongsTo'](db[_0xff78('0x89')],{'onDelete':'restrict','foreignKey':_0xff78('0x14b')});db[_0xff78('0x160')]['belongsTo'](db['Tag'],{'onDelete':_0xff78('0x16d'),'foreignKey':_0xff78('0x16e')});db[_0xff78('0x4a')][_0xff78('0x11f')](db[_0xff78('0x40')],{});db[_0xff78('0x4a')][_0xff78('0x11f')](db['CmList'],{'as':_0xff78('0x16f'),'foreignKey':_0xff78('0x162')});db[_0xff78('0x4a')]['belongsTo'](db[_0xff78('0x122')],{'as':_0xff78('0x15a'),'foreignKey':_0xff78('0x15b')});db[_0xff78('0x4a')][_0xff78('0x11f')](db[_0xff78('0x46')],{});db[_0xff78('0x4a')][_0xff78('0x11f')](db['MailMessage'],{});db[_0xff78('0x4a')][_0xff78('0x11f')](db[_0xff78('0x13')],{});db[_0xff78('0x4a')][_0xff78('0x11f')](db[_0xff78('0x42')],{});db[_0xff78('0x170')][_0xff78('0x110')](db[_0xff78('0x4d')],{'as':_0xff78('0x171'),'onDelete':'cascade'});db[_0xff78('0x4e')][_0xff78('0x110')](db[_0xff78('0x85')],{'as':_0xff78('0x15f'),'foreignKey':'FaxAccountId'});db[_0xff78('0x4e')][_0xff78('0x110')](db['CannedAnswer'],{'as':_0xff78('0x172'),'foreignKey':_0xff78('0x173')});db[_0xff78('0x4e')][_0xff78('0x110')](db[_0xff78('0x11b')],{'as':_0xff78('0x174')});db['FaxAccount'][_0xff78('0x110')](db['FaxApplication'],{'as':'Applications'});db[_0xff78('0x4e')]['hasMany'](db[_0xff78('0x1a')],{'as':_0xff78('0x175'),'onDelete':_0xff78('0x113')});db[_0xff78('0x4e')][_0xff78('0x110')](db[_0xff78('0x176')],{'as':_0xff78('0x154')});db[_0xff78('0x4e')][_0xff78('0x11f')](db[_0xff78('0x2f')],{'as':_0xff78('0x2f')});db['FaxAccount'][_0xff78('0x11f')](db[_0xff78('0xf3')],{'as':_0xff78('0x16f'),'foreignKey':'ListId'});db[_0xff78('0x4e')]['belongsTo'](db[_0xff78('0x8b')],{'as':_0xff78('0x14c'),'foreignKey':_0xff78('0x14d')});db[_0xff78('0x4e')][_0xff78('0x121')](db['User'],{'as':'Agents','through':_0xff78('0x139')});db[_0xff78('0x4f')][_0xff78('0x11f')](db[_0xff78('0x13')],{'onDelete':_0xff78('0x16d')});db['FaxApplication'][_0xff78('0x11f')](db[_0xff78('0x12f')],{'onDelete':'restrict'});db[_0xff78('0x4f')][_0xff78('0x11f')](db['FaxAccount'],{'onDelete':_0xff78('0x16d')});db[_0xff78('0x4f')]['belongsTo'](db[_0xff78('0x92')],{'onDelete':_0xff78('0x16d'),'foreignKey':'TagId'});db[_0xff78('0x11b')][_0xff78('0x110')](db[_0xff78('0x176')],{'as':_0xff78('0x154'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db[_0xff78('0x11b')][_0xff78('0x11f')](db['FaxAccount'],{'as':'Account','foreignKey':_0xff78('0x173')});db[_0xff78('0x11b')][_0xff78('0x11f')](db['CmContact'],{'as':_0xff78('0x15a'),'foreignKey':_0xff78('0x15b')});db[_0xff78('0x11b')][_0xff78('0x11f')](db[_0xff78('0x13')],{'as':_0xff78('0x166'),'foreignKey':_0xff78('0x10d')});db[_0xff78('0x11b')][_0xff78('0x121')](db[_0xff78('0x92')],{'through':'fax_interaction_has_tags','as':_0xff78('0x168')});db['FaxInteraction'][_0xff78('0x121')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0xff78('0x169')});db[_0xff78('0x11b')][_0xff78('0x121')](db[_0xff78('0x13')],{'as':'Users','through':_0xff78('0x129'),'foreignKey':_0xff78('0x177')});db[_0xff78('0x176')]['belongsTo'](db['User'],{'onDelete':'cascade','as':_0xff78('0x13')});db[_0xff78('0x176')][_0xff78('0x11f')](db[_0xff78('0x11b')],{'as':_0xff78('0x178'),'foreignKey':_0xff78('0x177')});db[_0xff78('0x176')][_0xff78('0x11f')](db[_0xff78('0x122')],{'onDelete':_0xff78('0x113'),'as':_0xff78('0x15a')});db[_0xff78('0x176')][_0xff78('0x11f')](db[_0xff78('0xeb')],{'as':_0xff78('0xeb'),'foreignKey':_0xff78('0x179')});db[_0xff78('0x176')][_0xff78('0x11f')](db[_0xff78('0x4e')],{'as':_0xff78('0x165'),'foreignKey':_0xff78('0x173')});db[_0xff78('0x12f')][_0xff78('0x121')](db['User'],{'as':_0xff78('0x14f'),'through':'UserFaxQueue'});db[_0xff78('0x12f')]['belongsToMany'](db[_0xff78('0x124')],{'through':_0xff78('0x17a'),'as':_0xff78('0x150')});db[_0xff78('0x54')]['belongsTo'](db[_0xff78('0x4e')],{});db['FaxQueueReport'][_0xff78('0x11f')](db[_0xff78('0xf3')],{'as':_0xff78('0x16f'),'foreignKey':_0xff78('0x162')});db[_0xff78('0x54')][_0xff78('0x11f')](db[_0xff78('0x122')],{'as':_0xff78('0x15a'),'foreignKey':_0xff78('0x15b')});db[_0xff78('0x54')]['belongsTo'](db[_0xff78('0x11b')],{});db[_0xff78('0x54')][_0xff78('0x11f')](db[_0xff78('0x176')],{});db[_0xff78('0x54')][_0xff78('0x11f')](db['User'],{});db[_0xff78('0x54')][_0xff78('0x11f')](db[_0xff78('0x12f')],{});db['SmsAccount'][_0xff78('0x110')](db['Disposition'],{'as':_0xff78('0x15f'),'foreignKey':'SmsAccountId'});db[_0xff78('0x56')][_0xff78('0x110')](db[_0xff78('0x83')],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0xff78('0x56')][_0xff78('0x110')](db[_0xff78('0x5b')],{'as':'Messages','foreignKey':_0xff78('0x17b')});db[_0xff78('0x56')][_0xff78('0x110')](db['SmsInteraction'],{'as':_0xff78('0x174')});db['SmsAccount'][_0xff78('0x110')](db['SmsApplication'],{'as':_0xff78('0x161')});db[_0xff78('0x56')]['belongsTo'](db['CmList'],{'as':_0xff78('0x16f'),'foreignKey':_0xff78('0x162')});db['SmsAccount'][_0xff78('0x11f')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xff78('0x14d')});db['SmsAccount'][_0xff78('0x121')](db[_0xff78('0x13')],{'as':_0xff78('0x14f'),'through':_0xff78('0x17c')});db[_0xff78('0x57')][_0xff78('0x11f')](db[_0xff78('0x13')],{'onDelete':_0xff78('0x16d')});db[_0xff78('0x57')][_0xff78('0x11f')](db['SmsQueue'],{'onDelete':_0xff78('0x16d')});db['SmsApplication'][_0xff78('0x11f')](db['SmsAccount'],{'onDelete':_0xff78('0x16d')});db[_0xff78('0x57')][_0xff78('0x11f')](db[_0xff78('0x89')],{'onDelete':_0xff78('0x16d'),'foreignKey':_0xff78('0x14b')});db[_0xff78('0x57')][_0xff78('0x11f')](db['Tag'],{'onDelete':_0xff78('0x16d'),'foreignKey':_0xff78('0x16e')});db[_0xff78('0x59')][_0xff78('0x110')](db[_0xff78('0x5b')],{'as':_0xff78('0x154'),'onDelete':_0xff78('0x113'),'foreignKey':'SmsInteractionId'});db[_0xff78('0x59')][_0xff78('0x11f')](db['SmsAccount'],{'as':'Account','foreignKey':_0xff78('0x17b')});db[_0xff78('0x59')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xff78('0x15b')});db[_0xff78('0x59')][_0xff78('0x11f')](db[_0xff78('0x13')],{'as':_0xff78('0x166'),'foreignKey':'UserId'});db[_0xff78('0x59')][_0xff78('0x121')](db[_0xff78('0x92')],{'through':_0xff78('0x17d'),'as':_0xff78('0x168')});db[_0xff78('0x59')]['belongsToMany'](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xff78('0x169')});db[_0xff78('0x59')][_0xff78('0x121')](db['User'],{'as':_0xff78('0x16a'),'through':_0xff78('0x12a'),'foreignKey':'SmsInteractionId'});db[_0xff78('0x5b')]['belongsTo'](db[_0xff78('0x13')],{'as':'User'});db[_0xff78('0x5b')][_0xff78('0x11f')](db['CmContact'],{'onDelete':_0xff78('0x113'),'as':'Contact'});db['SmsMessage'][_0xff78('0x11f')](db[_0xff78('0x59')],{'onDelete':_0xff78('0x113'),'as':_0xff78('0x178'),'foreignKey':_0xff78('0x17e')});db[_0xff78('0x5b')][_0xff78('0x11f')](db[_0xff78('0x56')],{'as':_0xff78('0x165'),'foreignKey':_0xff78('0x17b')});db[_0xff78('0x5d')][_0xff78('0x121')](db['User'],{'as':_0xff78('0x14f'),'through':_0xff78('0x38'),'foreignKey':_0xff78('0x17f')});db[_0xff78('0x5d')][_0xff78('0x121')](db[_0xff78('0x124')],{'through':_0xff78('0x180'),'as':'Teams'});db['OpenchannelAccount'][_0xff78('0x110')](db['Disposition'],{'as':_0xff78('0x15f'),'foreignKey':_0xff78('0x181')});db[_0xff78('0x5f')][_0xff78('0x110')](db['CannedAnswer'],{'as':_0xff78('0x172'),'foreignKey':_0xff78('0x181')});db[_0xff78('0x5f')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xff78('0x174'),'foreignKey':_0xff78('0x181')});db[_0xff78('0x5f')][_0xff78('0x110')](db[_0xff78('0x62')],{'as':_0xff78('0x154'),'foreignKey':_0xff78('0x181')});db[_0xff78('0x5f')]['hasMany'](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0xff78('0x181')});db[_0xff78('0x5f')][_0xff78('0x11f')](db['CmList'],{'as':'List','foreignKey':_0xff78('0x162')});db[_0xff78('0x5f')]['belongsTo'](db[_0xff78('0x8b')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xff78('0x5f')][_0xff78('0x121')](db[_0xff78('0x13')],{'as':_0xff78('0x14f'),'through':_0xff78('0x13c')});db[_0xff78('0x182')]['belongsTo'](db[_0xff78('0x13')],{'onDelete':_0xff78('0x16d')});db[_0xff78('0x182')][_0xff78('0x11f')](db['OpenchannelQueue'],{'onDelete':_0xff78('0x16d'),'foreignKey':_0xff78('0x183')});db[_0xff78('0x182')][_0xff78('0x11f')](db['OpenchannelAccount'],{'onDelete':_0xff78('0x16d'),'foreignKey':_0xff78('0x181')});db[_0xff78('0x182')][_0xff78('0x11f')](db[_0xff78('0x89')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xff78('0x182')][_0xff78('0x11f')](db['Tag'],{'onDelete':_0xff78('0x16d'),'foreignKey':_0xff78('0x16e')});db['OpenchannelInteraction']['hasMany'](db['OpenchannelMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xff78('0x184')});db[_0xff78('0x117')][_0xff78('0x11f')](db[_0xff78('0x5f')],{'as':_0xff78('0x165'),'foreignKey':_0xff78('0x181')});db['OpenchannelInteraction'][_0xff78('0x11f')](db['CmContact'],{'as':_0xff78('0x15a'),'foreignKey':_0xff78('0x15b')});db['OpenchannelInteraction'][_0xff78('0x11f')](db['User'],{'as':'Owner','foreignKey':_0xff78('0x10d')});db[_0xff78('0x117')]['belongsToMany'](db[_0xff78('0x92')],{'through':_0xff78('0x185'),'as':'Tags'});db[_0xff78('0x117')][_0xff78('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0xff78('0x169')});db[_0xff78('0x117')][_0xff78('0x121')](db['User'],{'as':'Users','through':_0xff78('0x186'),'foreignKey':_0xff78('0x184')});db[_0xff78('0x62')][_0xff78('0x11f')](db[_0xff78('0x13')],{'onDelete':'cascade','as':'User'});db[_0xff78('0x62')][_0xff78('0x11f')](db[_0xff78('0x122')],{'onDelete':_0xff78('0x113'),'as':_0xff78('0x15a')});db[_0xff78('0x62')][_0xff78('0x11f')](db[_0xff78('0x117')],{'onDelete':_0xff78('0x113'),'as':_0xff78('0x178'),'foreignKey':_0xff78('0x184')});db[_0xff78('0x62')][_0xff78('0x11f')](db[_0xff78('0xeb')],{'as':_0xff78('0xeb'),'foreignKey':'AttachmentId'});db[_0xff78('0x62')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xff78('0x165'),'foreignKey':_0xff78('0x181')});db[_0xff78('0x64')][_0xff78('0x121')](db[_0xff78('0x13')],{'as':'Agents','through':_0xff78('0x39'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue'][_0xff78('0x121')](db[_0xff78('0x124')],{'through':_0xff78('0x187'),'as':_0xff78('0x150')});db[_0xff78('0x66')][_0xff78('0x110')](db[_0xff78('0x85')],{'as':_0xff78('0x15f'),'foreignKey':'ChatWebsiteId'});db[_0xff78('0x66')][_0xff78('0x110')](db[_0xff78('0x83')],{'as':'Answers','foreignKey':_0xff78('0x188')});db[_0xff78('0x66')][_0xff78('0x110')](db[_0xff78('0x72')],{'as':_0xff78('0x189')});db['ChatWebsite']['hasMany'](db[_0xff78('0x6b')],{'as':'Interactions'});db['ChatWebsite']['hasMany'](db[_0xff78('0x69')],{'as':_0xff78('0x161')});db[_0xff78('0x66')][_0xff78('0x110')](db[_0xff78('0x6c')],{'as':_0xff78('0x154')});db[_0xff78('0x66')]['belongsTo'](db[_0xff78('0xf3')],{'as':_0xff78('0x16f'),'foreignKey':_0xff78('0x162')});db[_0xff78('0x66')][_0xff78('0x11f')](db[_0xff78('0x89')],{'as':_0xff78('0x89'),'foreignKey':_0xff78('0x14b')});db[_0xff78('0x66')][_0xff78('0x11f')](db[_0xff78('0x8b')],{'as':'mandatoryDispositionPause','foreignKey':_0xff78('0x14d')});db[_0xff78('0x66')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xff78('0x137')});db[_0xff78('0x18a')][_0xff78('0x11f')](db['OpenchannelAccount'],{});db[_0xff78('0x18a')][_0xff78('0x11f')](db[_0xff78('0xf3')],{'as':_0xff78('0x16f'),'foreignKey':_0xff78('0x162')});db[_0xff78('0x18a')][_0xff78('0x11f')](db[_0xff78('0x122')],{'as':'Contact','foreignKey':'ContactId'});db[_0xff78('0x18a')][_0xff78('0x11f')](db[_0xff78('0x117')],{});db[_0xff78('0x18a')]['belongsTo'](db[_0xff78('0x62')],{});db[_0xff78('0x18a')][_0xff78('0x11f')](db[_0xff78('0x13')],{});db['OpenchannelQueueReport'][_0xff78('0x11f')](db['OpenchannelQueue'],{});db[_0xff78('0x69')]['belongsTo'](db[_0xff78('0x13')],{'as':_0xff78('0x18b'),'foreignKey':_0xff78('0x10d'),'onDelete':_0xff78('0x16d')});db[_0xff78('0x69')][_0xff78('0x11f')](db[_0xff78('0x6f')],{'as':'Queue','foreignKey':_0xff78('0x18c'),'onDelete':_0xff78('0x16d')});db[_0xff78('0x69')][_0xff78('0x11f')](db[_0xff78('0x66')],{'as':_0xff78('0x18d'),'foreignKey':_0xff78('0x188'),'onDelete':'restrict'});db[_0xff78('0x69')][_0xff78('0x11f')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xff78('0x16e')});db[_0xff78('0x6b')][_0xff78('0x110')](db[_0xff78('0x6c')],{'as':_0xff78('0x154'),'onDelete':_0xff78('0x113'),'foreignKey':'ChatInteractionId'});db[_0xff78('0x6b')][_0xff78('0x11f')](db[_0xff78('0x66')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xff78('0x6b')][_0xff78('0x11f')](db[_0xff78('0x122')],{'as':'Contact','foreignKey':_0xff78('0x15b')});db[_0xff78('0x6b')][_0xff78('0x11f')](db[_0xff78('0x13')],{'as':_0xff78('0x166'),'foreignKey':_0xff78('0x10d')});db[_0xff78('0x6b')]['belongsToMany'](db[_0xff78('0x92')],{'through':_0xff78('0x18e'),'as':_0xff78('0x168')});db[_0xff78('0x6b')]['belongsToMany'](db['Tag'],{'through':'chat_interaction_has_tags','as':_0xff78('0x169')});db['ChatInteraction'][_0xff78('0x121')](db[_0xff78('0x13')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0xff78('0x18f')});db[_0xff78('0x6c')][_0xff78('0x11f')](db[_0xff78('0x13')],{'onDelete':_0xff78('0x113'),'as':_0xff78('0x13')});db[_0xff78('0x6c')][_0xff78('0x11f')](db[_0xff78('0x122')],{'onDelete':_0xff78('0x113'),'as':_0xff78('0x15a'),'foreignKey':_0xff78('0x15b')});db[_0xff78('0x6c')][_0xff78('0x11f')](db[_0xff78('0x6b')],{'onDelete':_0xff78('0x113'),'as':_0xff78('0x178'),'foreignKey':_0xff78('0x18f')});db[_0xff78('0x6c')][_0xff78('0x11f')](db['Attachment'],{'as':_0xff78('0xeb'),'foreignKey':_0xff78('0x179')});db[_0xff78('0x6c')][_0xff78('0x11f')](db[_0xff78('0x66')],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0xff78('0x11f')](db[_0xff78('0x122')],{'onDelete':_0xff78('0x113'),'as':_0xff78('0x15a'),'foreignKey':_0xff78('0x15b')});db['ChatOfflineMessage'][_0xff78('0x11f')](db[_0xff78('0x66')],{'as':_0xff78('0x165'),'foreignKey':_0xff78('0x188')});db[_0xff78('0x6f')][_0xff78('0x121')](db[_0xff78('0x13')],{'as':_0xff78('0x14f'),'through':'UserChatQueue','hooks':!![]});db[_0xff78('0x6f')][_0xff78('0x121')](db['Team'],{'through':_0xff78('0x190'),'as':_0xff78('0x150')});db[_0xff78('0x71')]['hasMany'](db[_0xff78('0xd3')],{'as':'Messages','foreignKey':_0xff78('0x191'),'onDelete':_0xff78('0x113')});db[_0xff78('0x71')][_0xff78('0x121')](db['User'],{'as':_0xff78('0x192'),'through':'chat_group_has_users'});db['ChatProactiveAction'][_0xff78('0x11f')](db[_0xff78('0x66')],{'as':_0xff78('0x18d'),'foreignKey':'ChatWebsiteId'});db[_0xff78('0x74')]['hasMany'](db[_0xff78('0x122')],{'as':_0xff78('0x193'),'foreignKey':_0xff78('0x194')});db[_0xff78('0x122')]['hasMany'](db['CmHopper'],{'as':_0xff78('0x144'),'foreignKey':_0xff78('0x15b')});db[_0xff78('0x122')]['hasMany'](db['CmHopperFinal'],{'as':_0xff78('0x114'),'foreignKey':'ContactId'});db[_0xff78('0x122')][_0xff78('0x110')](db['CmHopperHistory'],{'as':_0xff78('0x145'),'foreignKey':_0xff78('0x15b')});db[_0xff78('0x122')][_0xff78('0x110')](db[_0xff78('0x7d')],{'as':'ReportAgentPreview','foreignKey':_0xff78('0x15b')});db['CmContact'][_0xff78('0x110')](db[_0xff78('0xd8')],{'as':_0xff78('0x147'),'foreignKey':_0xff78('0x15b')});db[_0xff78('0x122')]['hasMany'](db[_0xff78('0x117')],{'as':_0xff78('0x118'),'foreignKey':_0xff78('0x15b'),'onDelete':_0xff78('0x16d')});db[_0xff78('0x122')]['hasMany'](db['ChatInteraction'],{'as':_0xff78('0x119'),'foreignKey':_0xff78('0x15b'),'onDelete':_0xff78('0x16d')});db[_0xff78('0x122')][_0xff78('0x110')](db[_0xff78('0x59')],{'as':_0xff78('0x11a'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xff78('0x122')]['hasMany'](db[_0xff78('0x11b')],{'as':_0xff78('0x11c'),'foreignKey':_0xff78('0x15b'),'onDelete':_0xff78('0x16d')});db[_0xff78('0x122')]['hasMany'](db[_0xff78('0x46')],{'as':'MailInteractions','foreignKey':_0xff78('0x15b'),'onDelete':_0xff78('0x16d')});db[_0xff78('0x122')][_0xff78('0x11f')](db['CmCompany'],{'as':'Company','foreignKey':_0xff78('0x194')});db[_0xff78('0x122')][_0xff78('0x11f')](db[_0xff78('0xf3')],{'as':_0xff78('0x16f'),'foreignKey':_0xff78('0x162'),'onDelete':_0xff78('0x113')});db[_0xff78('0x122')][_0xff78('0x121')](db['User'],{'as':'Users','through':_0xff78('0x195')});db[_0xff78('0x122')][_0xff78('0x121')](db['Tag'],{'as':_0xff78('0x168'),'through':_0xff78('0x196')});db[_0xff78('0x122')][_0xff78('0x121')](db[_0xff78('0x92')],{'through':_0xff78('0x196'),'as':_0xff78('0x169')});db[_0xff78('0x197')][_0xff78('0x11f')](db[_0xff78('0x122')],{'as':_0xff78('0x15a'),'foreignKey':_0xff78('0x15b'),'onDelete':'cascade'});db[_0xff78('0x197')][_0xff78('0x11f')](db[_0xff78('0xf3')],{'as':'List','foreignKey':_0xff78('0x162'),'onDelete':_0xff78('0x113')});db[_0xff78('0x197')]['belongsTo'](db['User'],{'as':_0xff78('0x18b'),'foreignKey':_0xff78('0x10d')});db[_0xff78('0x197')][_0xff78('0x11f')](db[_0xff78('0x1e')],{'as':_0xff78('0x198'),'foreignKey':'VoiceQueueId','onDelete':_0xff78('0x113')});db[_0xff78('0x197')][_0xff78('0x11f')](db['Campaign'],{'as':'Campaign','foreignKey':_0xff78('0x199'),'onDelete':_0xff78('0x113')});db[_0xff78('0x197')][_0xff78('0x11f')](db[_0xff78('0x13')],{'as':_0xff78('0x166'),'foreignKey':'OwnerId'});db[_0xff78('0x78')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xff78('0x15b'),'onDelete':_0xff78('0x113')});db[_0xff78('0x78')][_0xff78('0x11f')](db[_0xff78('0xf3')],{'as':_0xff78('0x16f'),'foreignKey':'ListId','onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db['VoiceQueue'],{'as':_0xff78('0x198'),'foreignKey':'VoiceQueueId','onDelete':_0xff78('0x113')});db[_0xff78('0x78')][_0xff78('0x11f')](db[_0xff78('0xe8')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0xff78('0x113')});db[_0xff78('0x19a')][_0xff78('0x110')](db['Condition'],{'as':{'plural':_0xff78('0x19b'),'singular':_0xff78('0x19c')},'foreignKey':_0xff78('0x19d'),'onDelete':_0xff78('0x113'),'hooks':!![]});db[_0xff78('0x19a')][_0xff78('0x110')](db[_0xff78('0x87')],{'as':{'plural':_0xff78('0x19e'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0xff78('0x113'),'hooks':!![]});db[_0xff78('0x19a')]['hasMany'](db['Action'],{'as':_0xff78('0x19f'),'foreignKey':_0xff78('0x1a0'),'onDelete':_0xff78('0x113'),'hooks':!![]});db['Disposition'][_0xff78('0x110')](db[_0xff78('0x85')],{'as':_0xff78('0x15f'),'foreignKey':_0xff78('0x1a1'),'onDelete':'cascade'});db[_0xff78('0x89')][_0xff78('0x110')](db[_0xff78('0x89')],{'as':_0xff78('0x1a2'),'foreignKey':'IntervalId','onDelete':_0xff78('0x113'),'hooks':!![],'required':![]});db[_0xff78('0x89')][_0xff78('0x110')](db['VoiceExtension'],{'as':_0xff78('0x112'),'foreignKey':'IntervalId','onDelete':_0xff78('0x16d')});db[_0xff78('0x89')][_0xff78('0x110')](db[_0xff78('0x160')],{'as':'MailApplications','foreignKey':_0xff78('0x14b')});db['Interval']['hasMany'](db[_0xff78('0x69')],{'as':_0xff78('0x1a3'),'foreignKey':_0xff78('0x14b')});db[_0xff78('0x89')][_0xff78('0x110')](db[_0xff78('0x4f')],{'as':'FaxApplications','foreignKey':_0xff78('0x14b')});db[_0xff78('0x89')][_0xff78('0x110')](db[_0xff78('0x57')],{'as':_0xff78('0x1a4'),'foreignKey':_0xff78('0x14b')});db[_0xff78('0x8e')][_0xff78('0x11f')](db[_0xff78('0x40')],{});db[_0xff78('0x8e')][_0xff78('0x11f')](db['AnalyticDefaultReport'],{'foreignKey':_0xff78('0x1a5')});db[_0xff78('0x8e')]['belongsTo'](db[_0xff78('0x99')],{'foreignKey':'CustomReportId'});db[_0xff78('0x90')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0xff78('0x1a6'),'through':'moh_has_sounds','onDelete':_0xff78('0x16d')});db[_0xff78('0x92')][_0xff78('0x121')](db[_0xff78('0x122')],{'through':_0xff78('0x196')});db['Tag'][_0xff78('0x121')](db['ChatInteraction'],{'through':_0xff78('0x18e')});db[_0xff78('0x92')][_0xff78('0x121')](db[_0xff78('0x46')],{'through':_0xff78('0x167')});db['Tag'][_0xff78('0x121')](db[_0xff78('0x59')],{'through':'sms_interaction_has_tags'});db[_0xff78('0x92')][_0xff78('0x121')](db[_0xff78('0x11b')],{'through':'fax_interaction_has_tags'});db[_0xff78('0x92')][_0xff78('0x121')](db['OpenchannelInteraction'],{'through':_0xff78('0x185')});db[_0xff78('0x92')][_0xff78('0x121')](db[_0xff78('0x101')],{'through':_0xff78('0x1a7')});db[_0xff78('0x1a8')][_0xff78('0x110')](db[_0xff78('0x87')],{'as':{'plural':_0xff78('0x1a9'),'singular':_0xff78('0x1aa')},'foreignKey':_0xff78('0x1ab'),'onDelete':_0xff78('0x113'),'hooks':!![]});db['Trigger'][_0xff78('0x110')](db[_0xff78('0x87')],{'as':{'plural':_0xff78('0x1ac'),'singular':_0xff78('0x1ad')},'foreignKey':_0xff78('0x1ae'),'onDelete':_0xff78('0x113'),'hooks':!![]});db['Trigger'][_0xff78('0x110')](db[_0xff78('0x81')],{'as':_0xff78('0x19f'),'foreignKey':'TriggerId','onDelete':_0xff78('0x113'),'hooks':!![]});db[_0xff78('0x99')][_0xff78('0x110')](db['AnalyticFieldReport'],{'as':_0xff78('0x1af'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b0'),'hooks':!![]});db[_0xff78('0x9b')][_0xff78('0x110')](db[_0xff78('0xa1')],{'as':_0xff78('0x1af'),'onDelete':_0xff78('0x113'),'foreignKey':'DefaultReportId'});db[_0xff78('0x9f')][_0xff78('0x110')](db[_0xff78('0xa1')],{'as':_0xff78('0x1af'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b1')});db['AnalyticFieldReport']['belongsTo'](db[_0xff78('0x9f')],{'foreignKey':_0xff78('0x1b1')});db[_0xff78('0xa3')][_0xff78('0x110')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0xff78('0x113'),'foreignKey':'AccountId'});db['SalesforceConfiguration']['hasMany'](db[_0xff78('0x1b2')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xff78('0x1b3')});db['SalesforceConfiguration'][_0xff78('0x110')](db[_0xff78('0x1b2')],{'as':_0xff78('0x1b4'),'onDelete':'cascade','foreignKey':_0xff78('0x1b5')});db[_0xff78('0xa5')][_0xff78('0x110')](db[_0xff78('0x1b2')],{'as':_0xff78('0x1af'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b6')});db[_0xff78('0xa5')][_0xff78('0x11f')](db[_0xff78('0xa3')],{'as':_0xff78('0x165'),'foreignKey':_0xff78('0x1b7')});db[_0xff78('0x1b2')][_0xff78('0x110')](db[_0xff78('0x1b2')],{'as':_0xff78('0x1b8'),'foreignKey':_0xff78('0x1b3')});db[_0xff78('0x1b2')][_0xff78('0x110')](db[_0xff78('0x1b2')],{'as':_0xff78('0x1b9'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0xff78('0x110')](db['SalesforceField'],{'as':'Field','foreignKey':'FieldId'});db[_0xff78('0x1b2')][_0xff78('0x11f')](db['Variable'],{'as':_0xff78('0x1ba'),'foreignKey':_0xff78('0x1bb')});db[_0xff78('0xa7')][_0xff78('0x110')](db['SugarcrmConfiguration'],{'as':_0xff78('0x1bc'),'onDelete':'cascade','foreignKey':_0xff78('0x1b7')});db[_0xff78('0xa9')][_0xff78('0x110')](db['SugarcrmField'],{'as':_0xff78('0x1bd'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b3')});db[_0xff78('0xa9')][_0xff78('0x110')](db[_0xff78('0xab')],{'as':_0xff78('0x1b4'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b5')});db[_0xff78('0xa9')]['hasMany'](db['SugarcrmField'],{'as':_0xff78('0x1af'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b6')});db[_0xff78('0xa9')][_0xff78('0x11f')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0xff78('0x1b7')});db[_0xff78('0xab')]['hasMany'](db[_0xff78('0xab')],{'as':_0xff78('0x1b8'),'foreignKey':_0xff78('0x1b3')});db[_0xff78('0xab')]['hasMany'](db['SugarcrmField'],{'as':_0xff78('0x1b9'),'foreignKey':_0xff78('0x1b5')});db[_0xff78('0xab')][_0xff78('0x110')](db[_0xff78('0xab')],{'as':_0xff78('0x1be'),'foreignKey':'FieldId'});db['SugarcrmField']['belongsTo'](db[_0xff78('0x1ba')],{'as':_0xff78('0x1ba'),'foreignKey':_0xff78('0x1bb')});db[_0xff78('0xad')][_0xff78('0x110')](db[_0xff78('0xaf')],{'as':_0xff78('0x1bc'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b7')});db[_0xff78('0xaf')][_0xff78('0x110')](db['DeskField'],{'as':_0xff78('0x1bd'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b3')});db['DeskConfiguration'][_0xff78('0x110')](db[_0xff78('0xb1')],{'as':_0xff78('0x1b4'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b5')});db['DeskConfiguration'][_0xff78('0x110')](db['DeskField'],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0xff78('0xaf')][_0xff78('0x11f')](db[_0xff78('0xad')],{'as':_0xff78('0x165'),'foreignKey':'AccountId'});db[_0xff78('0xaf')][_0xff78('0x121')](db[_0xff78('0x92')],{'through':_0xff78('0x1bf')});db[_0xff78('0xb1')]['hasMany'](db['DeskField'],{'as':'Subject','foreignKey':_0xff78('0x1b3')});db[_0xff78('0xb1')][_0xff78('0x110')](db[_0xff78('0xb1')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xff78('0xb1')][_0xff78('0x110')](db[_0xff78('0xb1')],{'as':_0xff78('0x1be'),'foreignKey':_0xff78('0x1b6')});db[_0xff78('0xb1')]['belongsTo'](db[_0xff78('0x1ba')],{'as':_0xff78('0x1ba'),'foreignKey':'VariableId'});db[_0xff78('0xb3')]['hasMany'](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b7')});db['ZohoConfiguration']['hasMany'](db[_0xff78('0xb6')],{'as':_0xff78('0x1bd'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b3')});db['ZohoConfiguration']['hasMany'](db[_0xff78('0xb6')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xff78('0x1b5')});db[_0xff78('0xb4')][_0xff78('0x110')](db[_0xff78('0xb6')],{'as':'Fields','onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b6')});db[_0xff78('0xb4')][_0xff78('0x11f')](db[_0xff78('0xb3')],{'as':_0xff78('0x165'),'foreignKey':_0xff78('0x1b7')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':'Subject','foreignKey':_0xff78('0x1b3')});db[_0xff78('0xb6')][_0xff78('0x110')](db[_0xff78('0xb6')],{'as':_0xff78('0x1b9'),'foreignKey':_0xff78('0x1b5')});db[_0xff78('0xb6')][_0xff78('0x110')](db[_0xff78('0xb6')],{'as':_0xff78('0x1be'),'foreignKey':_0xff78('0x1b6')});db['ZohoField'][_0xff78('0x11f')](db[_0xff78('0x1ba')],{'as':'Variable','foreignKey':_0xff78('0x1bb')});db['ZendeskAccount']['hasMany'](db[_0xff78('0xb9')],{'as':_0xff78('0x1bc'),'onDelete':'cascade','foreignKey':_0xff78('0x1b7')});db[_0xff78('0xb9')]['hasMany'](db['ZendeskField'],{'as':_0xff78('0x1bd'),'foreignKey':'SubjectId'});db[_0xff78('0xb9')][_0xff78('0x110')](db[_0xff78('0xba')],{'as':_0xff78('0x1b4'),'foreignKey':_0xff78('0x1b5')});db[_0xff78('0xb9')]['hasMany'](db[_0xff78('0xba')],{'as':_0xff78('0x1af'),'foreignKey':'FieldId'});db[_0xff78('0xb9')][_0xff78('0x11f')](db[_0xff78('0xb8')],{'as':_0xff78('0x165'),'foreignKey':'AccountId'});db[_0xff78('0xb9')][_0xff78('0x121')](db[_0xff78('0x92')],{'through':_0xff78('0x1c0')});db[_0xff78('0xba')][_0xff78('0x110')](db[_0xff78('0xba')],{'as':_0xff78('0x1b8'),'foreignKey':'SubjectId'});db[_0xff78('0xba')][_0xff78('0x110')](db[_0xff78('0xba')],{'as':'Description','foreignKey':'DescriptionId'});db['ZendeskField'][_0xff78('0x110')](db['ZendeskField'],{'as':_0xff78('0x1be'),'foreignKey':'FieldId'});db['ZendeskField'][_0xff78('0x11f')](db[_0xff78('0x1ba')],{'as':_0xff78('0x1ba'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0xff78('0x110')](db[_0xff78('0xbb')],{'as':_0xff78('0x1bc'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b7')});db['FreshdeskConfiguration'][_0xff78('0x110')](db[_0xff78('0xbc')],{'as':_0xff78('0x1bd'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b3')});db['FreshdeskConfiguration'][_0xff78('0x110')](db[_0xff78('0xbc')],{'as':'Descriptions','onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b5')});db[_0xff78('0xbb')][_0xff78('0x110')](db[_0xff78('0xbc')],{'as':'Fields','onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b6')});db['FreshdeskConfiguration'][_0xff78('0x11f')](db[_0xff78('0x1c1')],{'as':'Account','foreignKey':_0xff78('0x1b7')});db['FreshdeskConfiguration'][_0xff78('0x121')](db[_0xff78('0x92')],{'through':_0xff78('0x1c2')});db[_0xff78('0xbc')][_0xff78('0x110')](db[_0xff78('0xbc')],{'as':_0xff78('0x1b8'),'foreignKey':'SubjectId'});db[_0xff78('0xbc')][_0xff78('0x110')](db[_0xff78('0xbc')],{'as':'Description','foreignKey':_0xff78('0x1b5')});db['FreshdeskField'][_0xff78('0x110')](db[_0xff78('0xbc')],{'as':_0xff78('0x1be'),'foreignKey':_0xff78('0x1b6')});db[_0xff78('0xbc')][_0xff78('0x11f')](db[_0xff78('0x1ba')],{'as':'Variable','foreignKey':_0xff78('0x1bb')});db[_0xff78('0xbe')]['hasMany'](db[_0xff78('0x1c3')],{'as':_0xff78('0x1bc'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b7')});db[_0xff78('0x1c3')][_0xff78('0x110')](db['VtigerField'],{'as':_0xff78('0x1bd'),'foreignKey':'SubjectId'});db[_0xff78('0x1c3')][_0xff78('0x110')](db[_0xff78('0xc0')],{'as':_0xff78('0x1b4'),'foreignKey':_0xff78('0x1b5')});db[_0xff78('0x1c3')][_0xff78('0x110')](db[_0xff78('0xc0')],{'as':'Fields','foreignKey':_0xff78('0x1b6')});db[_0xff78('0x1c3')][_0xff78('0x11f')](db['VtigerAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xff78('0xc0')]['hasMany'](db[_0xff78('0xc0')],{'as':_0xff78('0x1b8'),'foreignKey':_0xff78('0x1b3')});db[_0xff78('0xc0')][_0xff78('0x110')](db['VtigerField'],{'as':_0xff78('0x1b9'),'foreignKey':_0xff78('0x1b5')});db[_0xff78('0xc0')][_0xff78('0x110')](db[_0xff78('0xc0')],{'as':_0xff78('0x1be'),'foreignKey':'FieldId'});db['VtigerField'][_0xff78('0x11f')](db['Variable'],{'as':_0xff78('0x1ba'),'foreignKey':_0xff78('0x1bb')});db[_0xff78('0x1c4')][_0xff78('0x110')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b7')});db[_0xff78('0xc3')][_0xff78('0x110')](db[_0xff78('0xc5')],{'as':_0xff78('0x1bd'),'foreignKey':'SubjectId'});db[_0xff78('0xc3')][_0xff78('0x110')](db[_0xff78('0xc5')],{'as':'Descriptions','foreignKey':_0xff78('0x1b5')});db[_0xff78('0xc3')]['hasMany'](db[_0xff78('0xc5')],{'as':'Fields','foreignKey':_0xff78('0x1b6')});db[_0xff78('0xc3')]['belongsTo'](db['ServicenowAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xff78('0xc5')][_0xff78('0x110')](db[_0xff78('0xc5')],{'as':'Subject','foreignKey':_0xff78('0x1b3')});db['ServicenowField'][_0xff78('0x110')](db[_0xff78('0xc5')],{'as':_0xff78('0x1b9'),'foreignKey':_0xff78('0x1b5')});db['ServicenowField']['hasMany'](db[_0xff78('0xc5')],{'as':_0xff78('0x1be'),'foreignKey':_0xff78('0x1b6')});db[_0xff78('0xc5')][_0xff78('0x11f')](db[_0xff78('0x1ba')],{'as':'Variable','foreignKey':'VariableId'});db[_0xff78('0x1c5')][_0xff78('0x110')](db[_0xff78('0xc8')],{'as':_0xff78('0x1bc'),'onDelete':_0xff78('0x113'),'foreignKey':'AccountId'});db['Dynamics365Configuration'][_0xff78('0x110')](db[_0xff78('0x1c6')],{'as':'Subjects','onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b3')});db[_0xff78('0xc8')][_0xff78('0x110')](db['Dynamics365Field'],{'as':_0xff78('0x1b4'),'onDelete':_0xff78('0x113'),'foreignKey':'DescriptionId'});db[_0xff78('0xc8')]['hasMany'](db[_0xff78('0x1c6')],{'as':_0xff78('0x1af'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b6')});db['Dynamics365Configuration'][_0xff78('0x11f')](db[_0xff78('0x1c5')],{'as':_0xff78('0x165'),'foreignKey':_0xff78('0x1b7')});db[_0xff78('0x1c6')][_0xff78('0x110')](db[_0xff78('0x1c6')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xff78('0x1c6')][_0xff78('0x110')](db[_0xff78('0x1c6')],{'as':_0xff78('0x1b9'),'foreignKey':'DescriptionId'});db[_0xff78('0x1c6')][_0xff78('0x110')](db[_0xff78('0x1c6')],{'as':'Field','foreignKey':_0xff78('0x1b6')});db[_0xff78('0x1c6')]['belongsTo'](db[_0xff78('0x1ba')],{'as':_0xff78('0x1ba'),'foreignKey':_0xff78('0x1bb')});db[_0xff78('0x1c7')][_0xff78('0x110')](db['FreshsalesConfiguration'],{'as':_0xff78('0x1bc'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1b7')});db[_0xff78('0xcb')][_0xff78('0x110')](db[_0xff78('0xcd')],{'as':_0xff78('0x1bd'),'foreignKey':_0xff78('0x1b3')});db[_0xff78('0xcb')][_0xff78('0x110')](db[_0xff78('0xcd')],{'as':_0xff78('0x1b4'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0xff78('0x110')](db[_0xff78('0xcd')],{'as':'Fields','foreignKey':_0xff78('0x1b6')});db['FreshsalesConfiguration'][_0xff78('0x11f')](db[_0xff78('0x1c7')],{'as':'Account','foreignKey':'AccountId'});db[_0xff78('0xcd')][_0xff78('0x110')](db['FreshsalesField'],{'as':_0xff78('0x1b8'),'foreignKey':_0xff78('0x1b3')});db['FreshsalesField'][_0xff78('0x110')](db[_0xff78('0xcd')],{'as':_0xff78('0x1b9'),'foreignKey':_0xff78('0x1b5')});db[_0xff78('0xcd')]['hasMany'](db[_0xff78('0xcd')],{'as':_0xff78('0x1be'),'foreignKey':_0xff78('0x1b6')});db['FreshsalesField'][_0xff78('0x11f')](db[_0xff78('0x1ba')],{'as':_0xff78('0x1ba'),'foreignKey':_0xff78('0x1bb')});db[_0xff78('0xd1')]['belongsTo'](db[_0xff78('0x66')],{});db[_0xff78('0xd1')][_0xff78('0x11f')](db[_0xff78('0xf3')],{'as':_0xff78('0x16f'),'foreignKey':_0xff78('0x162')});db[_0xff78('0xd1')][_0xff78('0x11f')](db[_0xff78('0x122')],{'as':'Contact','foreignKey':'ContactId'});db[_0xff78('0xd1')]['belongsTo'](db[_0xff78('0x6b')],{});db[_0xff78('0xd1')][_0xff78('0x11f')](db[_0xff78('0x6c')],{});db[_0xff78('0xd1')][_0xff78('0x11f')](db[_0xff78('0x13')],{});db['ChatQueueReport'][_0xff78('0x11f')](db[_0xff78('0x6f')],{});db[_0xff78('0xd3')][_0xff78('0x11f')](db['User'],{'onDelete':_0xff78('0x113'),'foreignKey':'FromId'});db[_0xff78('0xd3')][_0xff78('0x11f')](db[_0xff78('0x13')],{'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1c8')});db['JscriptySessionReport'][_0xff78('0x110')](db[_0xff78('0xd6')],{'foreignKey':_0xff78('0x1c9'),'onDelete':_0xff78('0x113')});db['JscriptySessionReport']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0xff78('0x1c9'),'onDelete':_0xff78('0x113')});db[_0xff78('0xda')][_0xff78('0x11f')](db[_0xff78('0x56')],{});db[_0xff78('0xda')]['belongsTo'](db[_0xff78('0xf3')],{'as':_0xff78('0x16f'),'foreignKey':_0xff78('0x162')});db[_0xff78('0xda')][_0xff78('0x11f')](db[_0xff78('0x122')],{'as':_0xff78('0x15a'),'foreignKey':_0xff78('0x15b')});db[_0xff78('0xda')][_0xff78('0x11f')](db['SmsInteraction'],{});db['SmsQueueReport'][_0xff78('0x11f')](db[_0xff78('0x5b')],{});db['SmsQueueReport'][_0xff78('0x11f')](db['User'],{});db[_0xff78('0xda')][_0xff78('0x11f')](db[_0xff78('0x5d')],{});db['JscriptyProject'][_0xff78('0x110')](db[_0xff78('0xd8')],{'foreignKey':_0xff78('0x1ca')});db[_0xff78('0xdd')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0xff78('0x1ca')});db[_0xff78('0xdd')][_0xff78('0x110')](db[_0xff78('0xd5')],{'foreignKey':_0xff78('0x1ca')});db['SquareProject'][_0xff78('0x121')](db[_0xff78('0x13')],{'as':_0xff78('0x16a'),'through':_0xff78('0x13f')});db['Team'][_0xff78('0x121')](db['User'],{'as':'Agents','through':_0xff78('0x125')});db[_0xff78('0x124')][_0xff78('0x121')](db[_0xff78('0x1e')],{'through':_0xff78('0x151'),'as':_0xff78('0x12b')});db[_0xff78('0x124')][_0xff78('0x121')](db[_0xff78('0x42')],{'through':'team_has_mail_queues','as':_0xff78('0x12c')});db[_0xff78('0x124')]['belongsToMany'](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0xff78('0x12d')});db[_0xff78('0x124')][_0xff78('0x121')](db[_0xff78('0x12f')],{'through':_0xff78('0x17a'),'as':_0xff78('0x1cb')});db[_0xff78('0x124')][_0xff78('0x121')](db['SmsQueue'],{'through':_0xff78('0x180'),'as':_0xff78('0x130')});db['Team'][_0xff78('0x121')](db[_0xff78('0x64')],{'through':'team_has_openchannel_queues','as':_0xff78('0x131')});db[_0xff78('0x124')]['belongsToMany'](db[_0xff78('0x109')],{'through':_0xff78('0x1cc'),'as':_0xff78('0x132')});db['Campaign'][_0xff78('0x110')](db['CmHopper'],{'as':_0xff78('0x144'),'foreignKey':_0xff78('0x199')});db[_0xff78('0xe8')]['hasMany'](db[_0xff78('0x7a')],{'as':_0xff78('0x114'),'foreignKey':_0xff78('0x199')});db[_0xff78('0xe8')][_0xff78('0x110')](db[_0xff78('0x115')],{'as':_0xff78('0x145'),'foreignKey':_0xff78('0x199')});db[_0xff78('0xe8')]['hasMany'](db[_0xff78('0x78')],{'as':_0xff78('0x146'),'foreignKey':'CampaignId'});db[_0xff78('0xe8')][_0xff78('0x11f')](db[_0xff78('0x2f')],{'as':_0xff78('0x2f'),'foreignKey':_0xff78('0x148')});db[_0xff78('0xe8')][_0xff78('0x11f')](db[_0xff78('0x2f')],{'as':_0xff78('0x149'),'foreignKey':'TrunkBackupId'});db[_0xff78('0xe8')][_0xff78('0x11f')](db[_0xff78('0x89')],{'as':_0xff78('0x89'),'foreignKey':_0xff78('0x14b')});db[_0xff78('0xe8')]['belongsTo'](db[_0xff78('0x1cd')],{'as':_0xff78('0x1cd'),'foreignKey':_0xff78('0x1ce')});db[_0xff78('0xe8')][_0xff78('0x121')](db[_0xff78('0xf3')],{'as':_0xff78('0x123'),'through':_0xff78('0x1cf')});db[_0xff78('0xe8')][_0xff78('0x121')](db['CmList'],{'as':'BlackLists','through':_0xff78('0x1d0')});db[_0xff78('0x1d1')][_0xff78('0x11f')](db[_0xff78('0x47')],{});db[_0xff78('0x1d1')][_0xff78('0x11f')](db['MailInteraction'],{});db[_0xff78('0x1d1')][_0xff78('0x11f')](db[_0xff78('0x40')],{'foreignKey':_0xff78('0x1d2'),'as':_0xff78('0x1d3')});db[_0xff78('0x1d1')][_0xff78('0x11f')](db[_0xff78('0x13')],{'foreignKey':_0xff78('0x1d4'),'as':_0xff78('0x1d5')});db[_0xff78('0x1d1')]['belongsTo'](db[_0xff78('0x13')],{'foreignKey':_0xff78('0x1d6'),'as':'ToAgent'});db[_0xff78('0x1d1')][_0xff78('0x11f')](db[_0xff78('0x42')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db['MailTransferReport']['belongsTo'](db[_0xff78('0x40')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db['ChatTransferReport']['belongsTo'](db[_0xff78('0x6c')],{});db['ChatTransferReport'][_0xff78('0x11f')](db[_0xff78('0x6b')],{});db[_0xff78('0x1d7')][_0xff78('0x11f')](db[_0xff78('0x66')],{'foreignKey':'FromChatWebsiteId','as':_0xff78('0x1d3')});db['ChatTransferReport'][_0xff78('0x11f')](db[_0xff78('0x13')],{'foreignKey':_0xff78('0x1d4'),'as':_0xff78('0x1d5')});db[_0xff78('0x1d7')][_0xff78('0x11f')](db[_0xff78('0x13')],{'foreignKey':_0xff78('0x1d6'),'as':'ToAgent'});db[_0xff78('0x1d7')]['belongsTo'](db[_0xff78('0x6f')],{'foreignKey':_0xff78('0x1d8'),'as':_0xff78('0x1d9')});db['ChatTransferReport'][_0xff78('0x11f')](db[_0xff78('0x66')],{'foreignKey':_0xff78('0x1da'),'as':'ToAccount'});db[_0xff78('0xee')][_0xff78('0x11f')](db[_0xff78('0x176')],{});db[_0xff78('0xee')]['belongsTo'](db[_0xff78('0x11b')],{});db['FaxTransferReport'][_0xff78('0x11f')](db['FaxAccount'],{'foreignKey':_0xff78('0x1db'),'as':_0xff78('0x1d3')});db[_0xff78('0xee')][_0xff78('0x11f')](db[_0xff78('0x13')],{'foreignKey':_0xff78('0x1d4'),'as':_0xff78('0x1d5')});db[_0xff78('0xee')][_0xff78('0x11f')](db[_0xff78('0x13')],{'foreignKey':_0xff78('0x1d6'),'as':_0xff78('0x1dc')});db['FaxTransferReport'][_0xff78('0x11f')](db['FaxQueue'],{'foreignKey':_0xff78('0x1dd'),'as':_0xff78('0x1d9')});db['FaxTransferReport']['belongsTo'](db[_0xff78('0x4e')],{'foreignKey':'ToFaxAccountId','as':_0xff78('0x1de')});db[_0xff78('0xf0')][_0xff78('0x11f')](db[_0xff78('0x62')],{});db['OpenchannelTransferReport'][_0xff78('0x11f')](db[_0xff78('0x117')],{});db[_0xff78('0xf0')]['belongsTo'](db[_0xff78('0x5f')],{'foreignKey':_0xff78('0x1df'),'as':_0xff78('0x1d3')});db[_0xff78('0xf0')][_0xff78('0x11f')](db['User'],{'foreignKey':_0xff78('0x1d4'),'as':_0xff78('0x1d5')});db[_0xff78('0xf0')][_0xff78('0x11f')](db['User'],{'foreignKey':_0xff78('0x1d6'),'as':_0xff78('0x1dc')});db[_0xff78('0xf0')][_0xff78('0x11f')](db['OpenchannelQueue'],{'foreignKey':_0xff78('0x1e0'),'as':'ToQueue'});db[_0xff78('0xf0')][_0xff78('0x11f')](db[_0xff78('0x5f')],{'foreignKey':_0xff78('0x1e1'),'as':_0xff78('0x1de')});db['SmsTransferReport'][_0xff78('0x11f')](db[_0xff78('0x5b')],{});db[_0xff78('0x1e2')][_0xff78('0x11f')](db[_0xff78('0x59')],{});db[_0xff78('0x1e2')][_0xff78('0x11f')](db[_0xff78('0x56')],{'foreignKey':_0xff78('0x1e3'),'as':_0xff78('0x1d3')});db[_0xff78('0x1e2')][_0xff78('0x11f')](db[_0xff78('0x13')],{'foreignKey':_0xff78('0x1d4'),'as':_0xff78('0x1d5')});db[_0xff78('0x1e2')][_0xff78('0x11f')](db['User'],{'foreignKey':_0xff78('0x1d6'),'as':_0xff78('0x1dc')});db[_0xff78('0x1e2')][_0xff78('0x11f')](db[_0xff78('0x5d')],{'foreignKey':_0xff78('0x1e4'),'as':_0xff78('0x1d9')});db[_0xff78('0x1e2')]['belongsTo'](db[_0xff78('0x56')],{'foreignKey':_0xff78('0x1e5'),'as':'ToAccount'});db['CmList'][_0xff78('0x110')](db[_0xff78('0x85')],{'as':_0xff78('0x15f'),'foreignKey':_0xff78('0x162')});db['CmList'][_0xff78('0x110')](db['CmCustomField'],{'as':_0xff78('0x1e6'),'foreignKey':'ListId'});db[_0xff78('0xf3')][_0xff78('0x110')](db[_0xff78('0x122')],{'as':_0xff78('0x193'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x162')});db['CmList'][_0xff78('0x110')](db[_0xff78('0x7a')],{'as':'HopperFinals','foreignKey':_0xff78('0x162')});db[_0xff78('0xf3')][_0xff78('0x110')](db['CmHopperHistory'],{'as':_0xff78('0x116'),'foreignKey':_0xff78('0x162')});db[_0xff78('0xf3')]['hasMany'](db[_0xff78('0x7d')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0xff78('0xf3')]['belongsToMany'](db[_0xff78('0x1e')],{'as':_0xff78('0x1e7'),'through':'voice_queues_has_cm_lists'});db[_0xff78('0xf3')]['belongsToMany'](db[_0xff78('0x13')],{'as':_0xff78('0x14f'),'through':_0xff78('0x133')});db[_0xff78('0xf5')][_0xff78('0x110')](db[_0xff78('0x1a')],{'as':'Extensions','onDelete':_0xff78('0x113')});db['VoicePrefix'][_0xff78('0x121')](db['User'],{'as':_0xff78('0x14f'),'through':_0xff78('0x135')});db[_0xff78('0xf7')][_0xff78('0x110')](db['User'],{'as':_0xff78('0x16a'),'foreignKey':_0xff78('0x120')});db[_0xff78('0xf7')]['hasMany'](db[_0xff78('0xf8')],{'as':_0xff78('0x1e8'),'foreignKey':_0xff78('0x120'),'onDelete':_0xff78('0x113')});db[_0xff78('0xf8')]['hasMany'](db[_0xff78('0xfa')],{'as':_0xff78('0x1e9'),'foreignKey':'sectionId','onDelete':'cascade'});db['WhatsappAccount']['hasMany'](db[_0xff78('0x85')],{'as':_0xff78('0x15f'),'foreignKey':_0xff78('0x1ea')});db['WhatsappAccount'][_0xff78('0x110')](db[_0xff78('0x83')],{'as':_0xff78('0x172'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xff78('0x110')](db['WhatsappMessage'],{'as':_0xff78('0x154'),'foreignKey':_0xff78('0x1ea')});db[_0xff78('0xfd')][_0xff78('0x110')](db['WhatsappInteraction'],{'as':_0xff78('0x174')});db[_0xff78('0xfd')][_0xff78('0x110')](db[_0xff78('0xff')],{'as':_0xff78('0x161')});db['WhatsappAccount'][_0xff78('0x11f')](db[_0xff78('0xf3')],{'as':'List','foreignKey':_0xff78('0x162')});db['WhatsappAccount']['belongsTo'](db[_0xff78('0x8b')],{'as':_0xff78('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xff78('0xfd')][_0xff78('0x121')](db['User'],{'as':_0xff78('0x14f'),'through':_0xff78('0x1eb')});db[_0xff78('0xff')][_0xff78('0x11f')](db[_0xff78('0x13')],{'onDelete':_0xff78('0x16d')});db['WhatsappApplication'][_0xff78('0x11f')](db['WhatsappQueue'],{'onDelete':_0xff78('0x16d')});db[_0xff78('0xff')][_0xff78('0x11f')](db[_0xff78('0xfd')],{'onDelete':'restrict'});db[_0xff78('0xff')][_0xff78('0x11f')](db[_0xff78('0x89')],{'onDelete':_0xff78('0x16d'),'foreignKey':_0xff78('0x14b')});db[_0xff78('0xff')][_0xff78('0x11f')](db[_0xff78('0x92')],{'onDelete':'restrict','foreignKey':_0xff78('0x16e')});db['WhatsappInteraction'][_0xff78('0x110')](db['WhatsappMessage'],{'as':_0xff78('0x154'),'onDelete':_0xff78('0x113'),'foreignKey':_0xff78('0x1ec')});db[_0xff78('0x101')][_0xff78('0x11f')](db[_0xff78('0xfd')],{'as':_0xff78('0x165'),'foreignKey':_0xff78('0x1ea')});db[_0xff78('0x101')][_0xff78('0x11f')](db[_0xff78('0x122')],{'as':'Contact','foreignKey':_0xff78('0x15b')});db[_0xff78('0x101')][_0xff78('0x11f')](db[_0xff78('0x13')],{'as':_0xff78('0x166'),'foreignKey':'UserId'});db[_0xff78('0x101')]['belongsToMany'](db[_0xff78('0x92')],{'through':_0xff78('0x1a7'),'as':'Tags'});db['WhatsappInteraction'][_0xff78('0x121')](db[_0xff78('0x92')],{'through':'whatsapp_interaction_has_tags','as':_0xff78('0x169')});db[_0xff78('0x101')][_0xff78('0x121')](db[_0xff78('0x13')],{'as':_0xff78('0x16a'),'through':'user_has_whatsapp_interactions','foreignKey':_0xff78('0x1ec')});db['WhatsappMessage'][_0xff78('0x11f')](db[_0xff78('0x13')],{'as':_0xff78('0x13')});db[_0xff78('0x103')][_0xff78('0x11f')](db[_0xff78('0x122')],{'onDelete':'cascade','as':_0xff78('0x15a')});db[_0xff78('0x103')][_0xff78('0x11f')](db[_0xff78('0x101')],{'onDelete':_0xff78('0x113'),'as':'Interaction','foreignKey':_0xff78('0x1ec')});db['WhatsappMessage'][_0xff78('0x11f')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0xff78('0x1ea')});db[_0xff78('0x105')][_0xff78('0x11f')](db[_0xff78('0xfd')],{});db['WhatsappQueueReport'][_0xff78('0x11f')](db[_0xff78('0xf3')],{'as':_0xff78('0x16f'),'foreignKey':'ListId'});db[_0xff78('0x105')][_0xff78('0x11f')](db[_0xff78('0x122')],{'as':_0xff78('0x15a'),'foreignKey':_0xff78('0x15b')});db[_0xff78('0x105')][_0xff78('0x11f')](db[_0xff78('0x101')],{});db['WhatsappQueueReport'][_0xff78('0x11f')](db[_0xff78('0x109')],{});db['WhatsappQueueReport'][_0xff78('0x11f')](db['WhatsappMessage'],{});db[_0xff78('0x105')][_0xff78('0x11f')](db[_0xff78('0x13')],{});db[_0xff78('0x107')][_0xff78('0x11f')](db['WhatsappMessage'],{});db[_0xff78('0x107')]['belongsTo'](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0xff78('0x11f')](db[_0xff78('0xfd')],{'foreignKey':'FromWhatsappAccountId','as':_0xff78('0x1d3')});db[_0xff78('0x107')]['belongsTo'](db[_0xff78('0xfd')],{'foreignKey':'ToWhatsappAccountId','as':_0xff78('0x1de')});db[_0xff78('0x107')][_0xff78('0x11f')](db['WhatsappQueue'],{'foreignKey':_0xff78('0x1ed'),'as':_0xff78('0x1d9')});db[_0xff78('0x107')][_0xff78('0x11f')](db[_0xff78('0x13')],{'foreignKey':_0xff78('0x1d4'),'as':_0xff78('0x1d5')});db[_0xff78('0x107')]['belongsTo'](db[_0xff78('0x13')],{'foreignKey':_0xff78('0x1d6'),'as':_0xff78('0x1dc')});db[_0xff78('0x109')][_0xff78('0x121')](db[_0xff78('0x13')],{'as':'Agents','through':_0xff78('0x3b'),'foreignKey':'WhatsappQueueId'});db[_0xff78('0x109')][_0xff78('0x121')](db[_0xff78('0x124')],{'through':'team_has_whatsapp_queues','as':'Teams'});module[_0xff78('0x1ee')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 098a692..49c4266 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','join','root','/apidoc','/www','static','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','username','newPassword','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','secret','registry','length','isPlainObject','isString','replace','path','express','./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','format','method','headers','x-forwarded-for','responseTime','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','remoteAddress','statusCode','name','agent_id','agent_name','url','/api/voice/chanspy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany'];(function(_0x2ed078,_0x15ac92){var _0x5b35e5=function(_0x16994b){while(--_0x16994b){_0x2ed078['push'](_0x2ed078['shift']());}};_0x5b35e5(++_0x15ac92);}(_0x757a,0xde));var _0xa757=function(_0x3c1c22,_0x58e925){_0x3c1c22=_0x3c1c22-0x0;var _0x1425cd=_0x757a[_0x3c1c22];return _0x1425cd;};'use strict';var _=require('lodash');var path=require(_0xa757('0x0'));var express=require(_0xa757('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require('./errors');var config=require(_0xa757('0x2'));var logger=require(_0xa757('0x3'))(_0xa757('0x4'));var authLogger=require(_0xa757('0x3'))(_0xa757('0x5'));exports[_0xa757('0x6')]=function(_0x5edca8){_0x5edca8[_0xa757('0x7')](ewinston[_0xa757('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x53be0e,_0x2930fa){var _0x2f7793=_0xa757('0x9');if(!_[_0xa757('0xa')](_0x53be0e[_0xa757('0xb')])){_0x2f7793+='\x20body=%s';var _0x89c630=_0x53be0e[_0xa757('0xb')];maskSensitiveData(_0x89c630);}return util[_0xa757('0xc')](_0x2f7793,_0x53be0e[_0xa757('0xd')],_0x53be0e[_0xa757('0xe')][_0xa757('0xf')]?_0x53be0e[_0xa757('0xe')]['x-forwarded-for']:_0x53be0e['connection']['remoteAddress']||_0x53be0e['ip'],_0x53be0e['url'],_0x2930fa['statusCode'],_0x2930fa[_0xa757('0x10')],_0x53be0e['user']?_0x53be0e['user']['id']:null,_0x53be0e[_0xa757('0x11')]?_0x53be0e['user']['name']:null,_0x53be0e[_0xa757('0x11')]?_0x53be0e[_0xa757('0x11')][_0xa757('0x12')]:null,_0x89c630?util[_0xa757('0x13')](_0x89c630,![],null):'');}}));_0x5edca8[_0xa757('0x7')](ewinston[_0xa757('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xf12b68,_0x2f7947){var _0x185011=_0xa757('0x14');if(_0xf12b68['body']&&_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]&&_0xf12b68[_0xa757('0xb')]['agent_id']){_0x185011='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xa757('0xc')](_0x185011,_0xf12b68[_0xa757('0xd')],_0xf12b68[_0xa757('0xe')][_0xa757('0xf')]?_0xf12b68[_0xa757('0xe')][_0xa757('0xf')]:_0xf12b68['connection'][_0xa757('0x16')]||_0xf12b68['ip'],_0xf12b68['url'],_0x2f7947[_0xa757('0x17')],_0x2f7947[_0xa757('0x10')],_0xf12b68[_0xa757('0x11')]?_0xf12b68[_0xa757('0x11')]['id']:null,_0xf12b68['user']?_0xf12b68['user'][_0xa757('0x18')]:null,_0xf12b68[_0xa757('0x11')]?_0xf12b68[_0xa757('0x11')][_0xa757('0x12')]:null,_0xf12b68[_0xa757('0xb')]&&_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]?_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]:'other',_0xf12b68[_0xa757('0xb')]&&_0xf12b68['body'][_0xa757('0x19')]?_0xf12b68['body'][_0xa757('0x19')]:'',_0xf12b68[_0xa757('0xb')]&&_0xf12b68[_0xa757('0xb')]['agent_name']?_0xf12b68[_0xa757('0xb')][_0xa757('0x1a')]:'');},'ignoreRoute':function(_0x471e84){var _0x3bf7f3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3bf7f3['test'](_0x471e84[_0xa757('0x1b')]);}}));_0x5edca8['use']('/api/users',require('./api/user'));_0x5edca8['use'](_0xa757('0x1c'),require('./api/voiceChanSpy'));_0x5edca8[_0xa757('0x7')](_0xa757('0x1d'),require('./api/voiceContext'));_0x5edca8[_0xa757('0x7')]('/api/voice/extensions',require(_0xa757('0x1e')));_0x5edca8[_0xa757('0x7')]('/api/voice/mohs',require(_0xa757('0x1f')));_0x5edca8['use'](_0xa757('0x20'),require(_0xa757('0x21')));_0x5edca8[_0xa757('0x7')](_0xa757('0x22'),require(_0xa757('0x23')));_0x5edca8[_0xa757('0x7')](_0xa757('0x24'),require(_0xa757('0x25')));_0x5edca8[_0xa757('0x7')](_0xa757('0x26'),require(_0xa757('0x27')));_0x5edca8[_0xa757('0x7')](_0xa757('0x28'),require(_0xa757('0x29')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2a'),require(_0xa757('0x2b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2c'),require(_0xa757('0x2d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2e'),require(_0xa757('0x2f')));_0x5edca8[_0xa757('0x7')]('/api/voice/queues/reports',require(_0xa757('0x30')));_0x5edca8[_0xa757('0x7')](_0xa757('0x31'),require(_0xa757('0x32')));_0x5edca8[_0xa757('0x7')]('/api/trunks',require(_0xa757('0x33')));_0x5edca8[_0xa757('0x7')](_0xa757('0x34'),require(_0xa757('0x35')));_0x5edca8[_0xa757('0x7')](_0xa757('0x36'),require('./api/mailServerOut'));_0x5edca8[_0xa757('0x7')](_0xa757('0x37'),require(_0xa757('0x38')));_0x5edca8[_0xa757('0x7')](_0xa757('0x39'),require(_0xa757('0x3a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x3b'),require(_0xa757('0x3c')));_0x5edca8['use'](_0xa757('0x3d'),require(_0xa757('0x3e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x3f'),require(_0xa757('0x40')));_0x5edca8[_0xa757('0x7')]('/api/mail/applications',require(_0xa757('0x41')));_0x5edca8[_0xa757('0x7')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x42'),require('./api/dashboard'));_0x5edca8['use'](_0xa757('0x43'),require(_0xa757('0x44')));_0x5edca8[_0xa757('0x7')]('/api/fax/accounts',require(_0xa757('0x45')));_0x5edca8[_0xa757('0x7')](_0xa757('0x46'),require(_0xa757('0x47')));_0x5edca8[_0xa757('0x7')]('/api/fax/interactions',require(_0xa757('0x48')));_0x5edca8['use']('/api/fax/messages',require(_0xa757('0x49')));_0x5edca8[_0xa757('0x7')](_0xa757('0x4a'),require(_0xa757('0x4b')));_0x5edca8[_0xa757('0x7')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x4c'),require(_0xa757('0x4d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x4e'),require(_0xa757('0x4f')));_0x5edca8['use'](_0xa757('0x50'),require(_0xa757('0x51')));_0x5edca8['use'](_0xa757('0x52'),require('./api/smsMessage'));_0x5edca8[_0xa757('0x7')](_0xa757('0x53'),require('./api/smsQueue'));_0x5edca8[_0xa757('0x7')](_0xa757('0x54'),require('./api/openchannelAccount'));_0x5edca8[_0xa757('0x7')](_0xa757('0x55'),require(_0xa757('0x56')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/interactions',require(_0xa757('0x57')));_0x5edca8[_0xa757('0x7')](_0xa757('0x58'),require(_0xa757('0x59')));_0x5edca8['use'](_0xa757('0x5a'),require('./api/openchannelQueue'));_0x5edca8['use'](_0xa757('0x5b'),require(_0xa757('0x5c')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/reports/queue',require(_0xa757('0x5d')));_0x5edca8['use'](_0xa757('0x5e'),require(_0xa757('0x5f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x60'),require(_0xa757('0x61')));_0x5edca8[_0xa757('0x7')](_0xa757('0x62'),require(_0xa757('0x63')));_0x5edca8['use'](_0xa757('0x64'),require(_0xa757('0x65')));_0x5edca8[_0xa757('0x7')](_0xa757('0x66'),require(_0xa757('0x67')));_0x5edca8[_0xa757('0x7')](_0xa757('0x68'),require(_0xa757('0x69')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6a'),require(_0xa757('0x6b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6c'),require(_0xa757('0x6d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6e'),require('./api/cmContact'));_0x5edca8[_0xa757('0x7')]('/api/cm/hopper',require(_0xa757('0x6f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x70'),require(_0xa757('0x71')));_0x5edca8['use'](_0xa757('0x72'),require(_0xa757('0x73')));_0x5edca8[_0xa757('0x7')](_0xa757('0x74'),require('./api/cmHopperHistory'));_0x5edca8[_0xa757('0x7')](_0xa757('0x75'),require(_0xa757('0x76')));_0x5edca8[_0xa757('0x7')](_0xa757('0x77'),require(_0xa757('0x78')));_0x5edca8['use']('/api/automations',require('./api/automation'));_0x5edca8['use'](_0xa757('0x79'),require(_0xa757('0x7a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x7b'),require(_0xa757('0x7c')));_0x5edca8[_0xa757('0x7')]('/api/conditions',require(_0xa757('0x7d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x7e'),require(_0xa757('0x7f')));_0x5edca8['use'](_0xa757('0x80'),require(_0xa757('0x81')));_0x5edca8['use'](_0xa757('0x82'),require('./api/cdr'));_0x5edca8[_0xa757('0x7')]('/api/voiceQueuesLog',require(_0xa757('0x83')));_0x5edca8['use']('/api/schedules',require(_0xa757('0x84')));_0x5edca8[_0xa757('0x7')](_0xa757('0x85'),require(_0xa757('0x86')));_0x5edca8[_0xa757('0x7')](_0xa757('0x87'),require('./api/tag'));_0x5edca8['use'](_0xa757('0x88'),require(_0xa757('0x89')));_0x5edca8[_0xa757('0x7')]('/api/triggers',require('./api/trigger'));_0x5edca8[_0xa757('0x7')](_0xa757('0x8a'),require(_0xa757('0x8b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x8c'),require(_0xa757('0x8d')));_0x5edca8['use'](_0xa757('0x8e'),require(_0xa757('0x8f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x90'),require(_0xa757('0x91')));_0x5edca8[_0xa757('0x7')](_0xa757('0x92'),require(_0xa757('0x93')));_0x5edca8[_0xa757('0x7')](_0xa757('0x94'),require('./api/analyticExtractedReport'));_0x5edca8[_0xa757('0x7')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x5edca8[_0xa757('0x7')](_0xa757('0x95'),require(_0xa757('0x96')));_0x5edca8[_0xa757('0x7')](_0xa757('0x97'),require(_0xa757('0x98')));_0x5edca8[_0xa757('0x7')](_0xa757('0x99'),require(_0xa757('0x9a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x9b'),require('./api/intSalesforceConfiguration'));_0x5edca8[_0xa757('0x7')](_0xa757('0x9c'),require('./api/intSalesforceField'));_0x5edca8[_0xa757('0x7')](_0xa757('0x9d'),require(_0xa757('0x9e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x9f'),require(_0xa757('0xa0')));_0x5edca8['use'](_0xa757('0xa1'),require('./api/intSugarcrmField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xa2'),require(_0xa757('0xa3')));_0x5edca8[_0xa757('0x7')](_0xa757('0xa4'),require('./api/intDeskConfiguration'));_0x5edca8['use'](_0xa757('0xa5'),require(_0xa757('0xa6')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zoho/accounts',require(_0xa757('0xa7')));_0x5edca8['use'](_0xa757('0xa8'),require(_0xa757('0xa9')));_0x5edca8[_0xa757('0x7')](_0xa757('0xaa'),require(_0xa757('0xab')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zendesk/accounts',require(_0xa757('0xac')));_0x5edca8[_0xa757('0x7')](_0xa757('0xad'),require(_0xa757('0xae')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zendesk/fields',require(_0xa757('0xaf')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb0'),require(_0xa757('0xb1')));_0x5edca8[_0xa757('0x7')]('/api/integrations/freshdesk/configurations',require(_0xa757('0xb2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb3'),require('./api/intFreshdeskField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xb4'),require(_0xa757('0xb5')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb6'),require(_0xa757('0xb7')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb8'),require(_0xa757('0xb9')));_0x5edca8[_0xa757('0x7')](_0xa757('0xba'),require(_0xa757('0xbb')));_0x5edca8[_0xa757('0x7')](_0xa757('0xbc'),require('./api/intServicenowConfiguration'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbd'),require('./api/intServicenowField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbe'),require('./api/intDynamics365Account'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbf'),require(_0xa757('0xc0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc1'),require(_0xa757('0xc2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc3'),require(_0xa757('0xc4')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc5'),require(_0xa757('0xc6')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc7'),require(_0xa757('0xc8')));_0x5edca8[_0xa757('0x7')]('/api/networks',require(_0xa757('0xc9')));_0x5edca8['use'](_0xa757('0xca'),require(_0xa757('0xcb')));_0x5edca8[_0xa757('0x7')](_0xa757('0xcc'),require(_0xa757('0xcd')));_0x5edca8['use'](_0xa757('0xce'),require(_0xa757('0xcf')));_0x5edca8[_0xa757('0x7')]('/api/jscripty/questions/reports',require(_0xa757('0xd0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd1'),require('./api/jscriptySessionReport'));_0x5edca8['use'](_0xa757('0xd2'),require(_0xa757('0xd3')));_0x5edca8[_0xa757('0x7')]('/api/square/reports',require(_0xa757('0xd4')));_0x5edca8['use']('/api/square/details/reports',require(_0xa757('0xd5')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd6'),require('./api/jscriptyProject'));_0x5edca8[_0xa757('0x7')](_0xa757('0xd7'),require(_0xa757('0xd8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd9'),require(_0xa757('0xda')));_0x5edca8[_0xa757('0x7')](_0xa757('0xdb'),require(_0xa757('0xdc')));_0x5edca8[_0xa757('0x7')](_0xa757('0xdd'),require(_0xa757('0xde')));_0x5edca8['use'](_0xa757('0xdf'),require(_0xa757('0xe0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe1'),require(_0xa757('0xe2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe3'),require(_0xa757('0xe4')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe5'),require(_0xa757('0xe6')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe7'),require(_0xa757('0xe8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe9'),require(_0xa757('0xea')));_0x5edca8[_0xa757('0x7')](_0xa757('0xeb'),require(_0xa757('0xec')));_0x5edca8[_0xa757('0x7')](_0xa757('0xed'),require('./api/mailTransferReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0xee'),require('./api/chatTransferReport'));_0x5edca8[_0xa757('0x7')]('/api/fax/reports/transfer',require(_0xa757('0xef')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/reports/transfer',require(_0xa757('0xf0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xf1'),require(_0xa757('0xf2')));_0x5edca8['use'](_0xa757('0xf3'),require(_0xa757('0xf4')));_0x5edca8['use'](_0xa757('0xf5'),require(_0xa757('0xf6')));_0x5edca8['use'](_0xa757('0xf7'),require(_0xa757('0xf8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xf9'),require(_0xa757('0xfa')));_0x5edca8[_0xa757('0x7')](_0xa757('0xfb'),require(_0xa757('0xfc')));_0x5edca8[_0xa757('0x7')]('/api/notifications',require('./api/notification'));_0x5edca8[_0xa757('0x7')](_0xa757('0xfd'),require(_0xa757('0xfe')));_0x5edca8[_0xa757('0x7')](_0xa757('0xff'),require(_0xa757('0x100')));_0x5edca8[_0xa757('0x7')]('/api/whatsapp/interactions',require(_0xa757('0x101')));_0x5edca8['use'](_0xa757('0x102'),require(_0xa757('0x103')));_0x5edca8[_0xa757('0x7')](_0xa757('0x104'),require(_0xa757('0x105')));_0x5edca8['use'](_0xa757('0x106'),require('./api/whatsappTransferReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x107'),require(_0xa757('0x108')));_0x5edca8[_0xa757('0x7')]('/api/cloudProviders',require(_0xa757('0x109')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10a'),require(_0xa757('0x10b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10c'),require(_0xa757('0x10d')));_0x5edca8[_0xa757('0x7')]('/api/jira',require(_0xa757('0x10e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10f'),require(_0xa757('0x110')));_0x5edca8['use'](_0xa757('0x111'),require(_0xa757('0x112')));_0x5edca8[_0xa757('0x7')](_0xa757('0x113'),require(_0xa757('0x114')));_0x5edca8[_0xa757('0x7')](_0xa757('0x115'),require('./api/pm2'));_0x5edca8['use'](_0xa757('0x116'),require('./api/webbar'));_0x5edca8[_0xa757('0x7')]('/apidoc',express['static'](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x119'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x11a'),express[_0xa757('0x11b')](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x11a'))));_0x5edca8[_0xa757('0x7')]('/demo',express[_0xa757('0x11b')](path['join'](config[_0xa757('0x118')],_0xa757('0x11c'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x11d'),express['static'](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x11e'),_0xa757('0x11f'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x120'),express[_0xa757('0x11b')](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x121'))));_0x5edca8[_0xa757('0x122')](_0xa757('0x123'))[_0xa757('0x124')](errors[0x194]);_0x5edca8[_0xa757('0x122')]('/*')[_0xa757('0x124')](function(_0x56a060,_0x4af060){_0x4af060[_0xa757('0x125')](path['resolve'](_0x5edca8[_0xa757('0x124')](_0xa757('0x126'))+_0xa757('0x127')));});};var sensitiveFields=[_0xa757('0x128'),'password',_0xa757('0x129'),_0xa757('0x12a'),_0xa757('0x12b'),_0xa757('0x12c'),_0xa757('0x12d'),_0xa757('0x12e'),'mobile',_0xa757('0x12f'),_0xa757('0x130'),_0xa757('0x131'),_0xa757('0x132'),_0xa757('0x133'),'code','accessKey',_0xa757('0x134'),'token',_0xa757('0x135'),'accessToken',_0xa757('0x136'),_0xa757('0x137'),_0xa757('0x138'),_0xa757('0x139'),_0xa757('0x13a'),_0xa757('0x13b'),_0xa757('0x13c'),_0xa757('0x13d'),_0xa757('0x13e'),_0xa757('0x13f'),_0xa757('0x140'),'accesskeyid',_0xa757('0x141'),_0xa757('0x142'),_0xa757('0x11'),_0xa757('0x143'),_0xa757('0x144'),_0xa757('0x145'),'dsn',_0xa757('0x146'),_0xa757('0x147'),'oldPassword'];function maskSensitiveData(_0x133f0c){var _0x68a80b=/(?!^)[\s\S](?!$)/g;for(var _0x1f4782 in _0x133f0c){if(_['isArray'](_0x133f0c[_0x1f4782])){for(var _0x3ae3bf=0x0;_0x3ae3bf<_0x133f0c[_0x1f4782][_0xa757('0x148')];_0x3ae3bf++){maskSensitiveData(_0x133f0c[_0x1f4782][_0x3ae3bf]);}}else if(_[_0xa757('0x149')](_0x133f0c[_0x1f4782])){maskSensitiveData(_0x133f0c[_0x1f4782]);}else if(_[_0xa757('0x14a')](_0x133f0c[_0x1f4782])){_0x133f0c[_0x1f4782]=_0x133f0c[_0x1f4782][_0xa757('0x14b')](/{{{/g,'@@{')[_0xa757('0x14b')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa757('0x14b')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x1f4782)){_0x133f0c[_0x1f4782]=_0x133f0c[_0x1f4782]['replace'](_0x68a80b,'*');}}}} \ No newline at end of file +var _0x757a=['/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','join','root','/apidoc','/www','static','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','username','newPassword','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','secret','registry','length','isPlainObject','isString','replace','path','express','./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','format','method','headers','x-forwarded-for','responseTime','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','remoteAddress','statusCode','name','agent_id','agent_name','url','/api/voice/chanspy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany'];(function(_0x1880cf,_0x25ef12){var _0x48ecb7=function(_0x4422dc){while(--_0x4422dc){_0x1880cf['push'](_0x1880cf['shift']());}};_0x48ecb7(++_0x25ef12);}(_0x757a,0xde));var _0xa757=function(_0x1abe88,_0x364fb0){_0x1abe88=_0x1abe88-0x0;var _0x2b6141=_0x757a[_0x1abe88];return _0x2b6141;};'use strict';var _=require('lodash');var path=require(_0xa757('0x0'));var express=require(_0xa757('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require('./errors');var config=require(_0xa757('0x2'));var logger=require(_0xa757('0x3'))(_0xa757('0x4'));var authLogger=require(_0xa757('0x3'))(_0xa757('0x5'));exports[_0xa757('0x6')]=function(_0x5edca8){_0x5edca8[_0xa757('0x7')](ewinston[_0xa757('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x53be0e,_0x2930fa){var _0x2f7793=_0xa757('0x9');if(!_[_0xa757('0xa')](_0x53be0e[_0xa757('0xb')])){_0x2f7793+='\x20body=%s';var _0x89c630=_0x53be0e[_0xa757('0xb')];maskSensitiveData(_0x89c630);}return util[_0xa757('0xc')](_0x2f7793,_0x53be0e[_0xa757('0xd')],_0x53be0e[_0xa757('0xe')][_0xa757('0xf')]?_0x53be0e[_0xa757('0xe')]['x-forwarded-for']:_0x53be0e['connection']['remoteAddress']||_0x53be0e['ip'],_0x53be0e['url'],_0x2930fa['statusCode'],_0x2930fa[_0xa757('0x10')],_0x53be0e['user']?_0x53be0e['user']['id']:null,_0x53be0e[_0xa757('0x11')]?_0x53be0e['user']['name']:null,_0x53be0e[_0xa757('0x11')]?_0x53be0e[_0xa757('0x11')][_0xa757('0x12')]:null,_0x89c630?util[_0xa757('0x13')](_0x89c630,![],null):'');}}));_0x5edca8[_0xa757('0x7')](ewinston[_0xa757('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xf12b68,_0x2f7947){var _0x185011=_0xa757('0x14');if(_0xf12b68['body']&&_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]&&_0xf12b68[_0xa757('0xb')]['agent_id']){_0x185011='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xa757('0xc')](_0x185011,_0xf12b68[_0xa757('0xd')],_0xf12b68[_0xa757('0xe')][_0xa757('0xf')]?_0xf12b68[_0xa757('0xe')][_0xa757('0xf')]:_0xf12b68['connection'][_0xa757('0x16')]||_0xf12b68['ip'],_0xf12b68['url'],_0x2f7947[_0xa757('0x17')],_0x2f7947[_0xa757('0x10')],_0xf12b68[_0xa757('0x11')]?_0xf12b68[_0xa757('0x11')]['id']:null,_0xf12b68['user']?_0xf12b68['user'][_0xa757('0x18')]:null,_0xf12b68[_0xa757('0x11')]?_0xf12b68[_0xa757('0x11')][_0xa757('0x12')]:null,_0xf12b68[_0xa757('0xb')]&&_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]?_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]:'other',_0xf12b68[_0xa757('0xb')]&&_0xf12b68['body'][_0xa757('0x19')]?_0xf12b68['body'][_0xa757('0x19')]:'',_0xf12b68[_0xa757('0xb')]&&_0xf12b68[_0xa757('0xb')]['agent_name']?_0xf12b68[_0xa757('0xb')][_0xa757('0x1a')]:'');},'ignoreRoute':function(_0x471e84){var _0x3bf7f3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3bf7f3['test'](_0x471e84[_0xa757('0x1b')]);}}));_0x5edca8['use']('/api/users',require('./api/user'));_0x5edca8['use'](_0xa757('0x1c'),require('./api/voiceChanSpy'));_0x5edca8[_0xa757('0x7')](_0xa757('0x1d'),require('./api/voiceContext'));_0x5edca8[_0xa757('0x7')]('/api/voice/extensions',require(_0xa757('0x1e')));_0x5edca8[_0xa757('0x7')]('/api/voice/mohs',require(_0xa757('0x1f')));_0x5edca8['use'](_0xa757('0x20'),require(_0xa757('0x21')));_0x5edca8[_0xa757('0x7')](_0xa757('0x22'),require(_0xa757('0x23')));_0x5edca8[_0xa757('0x7')](_0xa757('0x24'),require(_0xa757('0x25')));_0x5edca8[_0xa757('0x7')](_0xa757('0x26'),require(_0xa757('0x27')));_0x5edca8[_0xa757('0x7')](_0xa757('0x28'),require(_0xa757('0x29')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2a'),require(_0xa757('0x2b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2c'),require(_0xa757('0x2d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2e'),require(_0xa757('0x2f')));_0x5edca8[_0xa757('0x7')]('/api/voice/queues/reports',require(_0xa757('0x30')));_0x5edca8[_0xa757('0x7')](_0xa757('0x31'),require(_0xa757('0x32')));_0x5edca8[_0xa757('0x7')]('/api/trunks',require(_0xa757('0x33')));_0x5edca8[_0xa757('0x7')](_0xa757('0x34'),require(_0xa757('0x35')));_0x5edca8[_0xa757('0x7')](_0xa757('0x36'),require('./api/mailServerOut'));_0x5edca8[_0xa757('0x7')](_0xa757('0x37'),require(_0xa757('0x38')));_0x5edca8[_0xa757('0x7')](_0xa757('0x39'),require(_0xa757('0x3a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x3b'),require(_0xa757('0x3c')));_0x5edca8['use'](_0xa757('0x3d'),require(_0xa757('0x3e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x3f'),require(_0xa757('0x40')));_0x5edca8[_0xa757('0x7')]('/api/mail/applications',require(_0xa757('0x41')));_0x5edca8[_0xa757('0x7')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x42'),require('./api/dashboard'));_0x5edca8['use'](_0xa757('0x43'),require(_0xa757('0x44')));_0x5edca8[_0xa757('0x7')]('/api/fax/accounts',require(_0xa757('0x45')));_0x5edca8[_0xa757('0x7')](_0xa757('0x46'),require(_0xa757('0x47')));_0x5edca8[_0xa757('0x7')]('/api/fax/interactions',require(_0xa757('0x48')));_0x5edca8['use']('/api/fax/messages',require(_0xa757('0x49')));_0x5edca8[_0xa757('0x7')](_0xa757('0x4a'),require(_0xa757('0x4b')));_0x5edca8[_0xa757('0x7')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x4c'),require(_0xa757('0x4d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x4e'),require(_0xa757('0x4f')));_0x5edca8['use'](_0xa757('0x50'),require(_0xa757('0x51')));_0x5edca8['use'](_0xa757('0x52'),require('./api/smsMessage'));_0x5edca8[_0xa757('0x7')](_0xa757('0x53'),require('./api/smsQueue'));_0x5edca8[_0xa757('0x7')](_0xa757('0x54'),require('./api/openchannelAccount'));_0x5edca8[_0xa757('0x7')](_0xa757('0x55'),require(_0xa757('0x56')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/interactions',require(_0xa757('0x57')));_0x5edca8[_0xa757('0x7')](_0xa757('0x58'),require(_0xa757('0x59')));_0x5edca8['use'](_0xa757('0x5a'),require('./api/openchannelQueue'));_0x5edca8['use'](_0xa757('0x5b'),require(_0xa757('0x5c')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/reports/queue',require(_0xa757('0x5d')));_0x5edca8['use'](_0xa757('0x5e'),require(_0xa757('0x5f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x60'),require(_0xa757('0x61')));_0x5edca8[_0xa757('0x7')](_0xa757('0x62'),require(_0xa757('0x63')));_0x5edca8['use'](_0xa757('0x64'),require(_0xa757('0x65')));_0x5edca8[_0xa757('0x7')](_0xa757('0x66'),require(_0xa757('0x67')));_0x5edca8[_0xa757('0x7')](_0xa757('0x68'),require(_0xa757('0x69')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6a'),require(_0xa757('0x6b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6c'),require(_0xa757('0x6d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6e'),require('./api/cmContact'));_0x5edca8[_0xa757('0x7')]('/api/cm/hopper',require(_0xa757('0x6f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x70'),require(_0xa757('0x71')));_0x5edca8['use'](_0xa757('0x72'),require(_0xa757('0x73')));_0x5edca8[_0xa757('0x7')](_0xa757('0x74'),require('./api/cmHopperHistory'));_0x5edca8[_0xa757('0x7')](_0xa757('0x75'),require(_0xa757('0x76')));_0x5edca8[_0xa757('0x7')](_0xa757('0x77'),require(_0xa757('0x78')));_0x5edca8['use']('/api/automations',require('./api/automation'));_0x5edca8['use'](_0xa757('0x79'),require(_0xa757('0x7a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x7b'),require(_0xa757('0x7c')));_0x5edca8[_0xa757('0x7')]('/api/conditions',require(_0xa757('0x7d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x7e'),require(_0xa757('0x7f')));_0x5edca8['use'](_0xa757('0x80'),require(_0xa757('0x81')));_0x5edca8['use'](_0xa757('0x82'),require('./api/cdr'));_0x5edca8[_0xa757('0x7')]('/api/voiceQueuesLog',require(_0xa757('0x83')));_0x5edca8['use']('/api/schedules',require(_0xa757('0x84')));_0x5edca8[_0xa757('0x7')](_0xa757('0x85'),require(_0xa757('0x86')));_0x5edca8[_0xa757('0x7')](_0xa757('0x87'),require('./api/tag'));_0x5edca8['use'](_0xa757('0x88'),require(_0xa757('0x89')));_0x5edca8[_0xa757('0x7')]('/api/triggers',require('./api/trigger'));_0x5edca8[_0xa757('0x7')](_0xa757('0x8a'),require(_0xa757('0x8b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x8c'),require(_0xa757('0x8d')));_0x5edca8['use'](_0xa757('0x8e'),require(_0xa757('0x8f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x90'),require(_0xa757('0x91')));_0x5edca8[_0xa757('0x7')](_0xa757('0x92'),require(_0xa757('0x93')));_0x5edca8[_0xa757('0x7')](_0xa757('0x94'),require('./api/analyticExtractedReport'));_0x5edca8[_0xa757('0x7')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x5edca8[_0xa757('0x7')](_0xa757('0x95'),require(_0xa757('0x96')));_0x5edca8[_0xa757('0x7')](_0xa757('0x97'),require(_0xa757('0x98')));_0x5edca8[_0xa757('0x7')](_0xa757('0x99'),require(_0xa757('0x9a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x9b'),require('./api/intSalesforceConfiguration'));_0x5edca8[_0xa757('0x7')](_0xa757('0x9c'),require('./api/intSalesforceField'));_0x5edca8[_0xa757('0x7')](_0xa757('0x9d'),require(_0xa757('0x9e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x9f'),require(_0xa757('0xa0')));_0x5edca8['use'](_0xa757('0xa1'),require('./api/intSugarcrmField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xa2'),require(_0xa757('0xa3')));_0x5edca8[_0xa757('0x7')](_0xa757('0xa4'),require('./api/intDeskConfiguration'));_0x5edca8['use'](_0xa757('0xa5'),require(_0xa757('0xa6')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zoho/accounts',require(_0xa757('0xa7')));_0x5edca8['use'](_0xa757('0xa8'),require(_0xa757('0xa9')));_0x5edca8[_0xa757('0x7')](_0xa757('0xaa'),require(_0xa757('0xab')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zendesk/accounts',require(_0xa757('0xac')));_0x5edca8[_0xa757('0x7')](_0xa757('0xad'),require(_0xa757('0xae')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zendesk/fields',require(_0xa757('0xaf')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb0'),require(_0xa757('0xb1')));_0x5edca8[_0xa757('0x7')]('/api/integrations/freshdesk/configurations',require(_0xa757('0xb2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb3'),require('./api/intFreshdeskField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xb4'),require(_0xa757('0xb5')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb6'),require(_0xa757('0xb7')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb8'),require(_0xa757('0xb9')));_0x5edca8[_0xa757('0x7')](_0xa757('0xba'),require(_0xa757('0xbb')));_0x5edca8[_0xa757('0x7')](_0xa757('0xbc'),require('./api/intServicenowConfiguration'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbd'),require('./api/intServicenowField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbe'),require('./api/intDynamics365Account'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbf'),require(_0xa757('0xc0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc1'),require(_0xa757('0xc2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc3'),require(_0xa757('0xc4')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc5'),require(_0xa757('0xc6')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc7'),require(_0xa757('0xc8')));_0x5edca8[_0xa757('0x7')]('/api/networks',require(_0xa757('0xc9')));_0x5edca8['use'](_0xa757('0xca'),require(_0xa757('0xcb')));_0x5edca8[_0xa757('0x7')](_0xa757('0xcc'),require(_0xa757('0xcd')));_0x5edca8['use'](_0xa757('0xce'),require(_0xa757('0xcf')));_0x5edca8[_0xa757('0x7')]('/api/jscripty/questions/reports',require(_0xa757('0xd0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd1'),require('./api/jscriptySessionReport'));_0x5edca8['use'](_0xa757('0xd2'),require(_0xa757('0xd3')));_0x5edca8[_0xa757('0x7')]('/api/square/reports',require(_0xa757('0xd4')));_0x5edca8['use']('/api/square/details/reports',require(_0xa757('0xd5')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd6'),require('./api/jscriptyProject'));_0x5edca8[_0xa757('0x7')](_0xa757('0xd7'),require(_0xa757('0xd8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd9'),require(_0xa757('0xda')));_0x5edca8[_0xa757('0x7')](_0xa757('0xdb'),require(_0xa757('0xdc')));_0x5edca8[_0xa757('0x7')](_0xa757('0xdd'),require(_0xa757('0xde')));_0x5edca8['use'](_0xa757('0xdf'),require(_0xa757('0xe0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe1'),require(_0xa757('0xe2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe3'),require(_0xa757('0xe4')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe5'),require(_0xa757('0xe6')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe7'),require(_0xa757('0xe8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe9'),require(_0xa757('0xea')));_0x5edca8[_0xa757('0x7')](_0xa757('0xeb'),require(_0xa757('0xec')));_0x5edca8[_0xa757('0x7')](_0xa757('0xed'),require('./api/mailTransferReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0xee'),require('./api/chatTransferReport'));_0x5edca8[_0xa757('0x7')]('/api/fax/reports/transfer',require(_0xa757('0xef')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/reports/transfer',require(_0xa757('0xf0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xf1'),require(_0xa757('0xf2')));_0x5edca8['use'](_0xa757('0xf3'),require(_0xa757('0xf4')));_0x5edca8['use'](_0xa757('0xf5'),require(_0xa757('0xf6')));_0x5edca8['use'](_0xa757('0xf7'),require(_0xa757('0xf8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xf9'),require(_0xa757('0xfa')));_0x5edca8[_0xa757('0x7')](_0xa757('0xfb'),require(_0xa757('0xfc')));_0x5edca8[_0xa757('0x7')]('/api/notifications',require('./api/notification'));_0x5edca8[_0xa757('0x7')](_0xa757('0xfd'),require(_0xa757('0xfe')));_0x5edca8[_0xa757('0x7')](_0xa757('0xff'),require(_0xa757('0x100')));_0x5edca8[_0xa757('0x7')]('/api/whatsapp/interactions',require(_0xa757('0x101')));_0x5edca8['use'](_0xa757('0x102'),require(_0xa757('0x103')));_0x5edca8[_0xa757('0x7')](_0xa757('0x104'),require(_0xa757('0x105')));_0x5edca8['use'](_0xa757('0x106'),require('./api/whatsappTransferReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x107'),require(_0xa757('0x108')));_0x5edca8[_0xa757('0x7')]('/api/cloudProviders',require(_0xa757('0x109')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10a'),require(_0xa757('0x10b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10c'),require(_0xa757('0x10d')));_0x5edca8[_0xa757('0x7')]('/api/jira',require(_0xa757('0x10e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10f'),require(_0xa757('0x110')));_0x5edca8['use'](_0xa757('0x111'),require(_0xa757('0x112')));_0x5edca8[_0xa757('0x7')](_0xa757('0x113'),require(_0xa757('0x114')));_0x5edca8[_0xa757('0x7')](_0xa757('0x115'),require('./api/pm2'));_0x5edca8['use'](_0xa757('0x116'),require('./api/webbar'));_0x5edca8[_0xa757('0x7')]('/apidoc',express['static'](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x119'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x11a'),express[_0xa757('0x11b')](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x11a'))));_0x5edca8[_0xa757('0x7')]('/demo',express[_0xa757('0x11b')](path['join'](config[_0xa757('0x118')],_0xa757('0x11c'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x11d'),express['static'](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x11e'),_0xa757('0x11f'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x120'),express[_0xa757('0x11b')](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x121'))));_0x5edca8[_0xa757('0x122')](_0xa757('0x123'))[_0xa757('0x124')](errors[0x194]);_0x5edca8[_0xa757('0x122')]('/*')[_0xa757('0x124')](function(_0x56a060,_0x4af060){_0x4af060[_0xa757('0x125')](path['resolve'](_0x5edca8[_0xa757('0x124')](_0xa757('0x126'))+_0xa757('0x127')));});};var sensitiveFields=[_0xa757('0x128'),'password',_0xa757('0x129'),_0xa757('0x12a'),_0xa757('0x12b'),_0xa757('0x12c'),_0xa757('0x12d'),_0xa757('0x12e'),'mobile',_0xa757('0x12f'),_0xa757('0x130'),_0xa757('0x131'),_0xa757('0x132'),_0xa757('0x133'),'code','accessKey',_0xa757('0x134'),'token',_0xa757('0x135'),'accessToken',_0xa757('0x136'),_0xa757('0x137'),_0xa757('0x138'),_0xa757('0x139'),_0xa757('0x13a'),_0xa757('0x13b'),_0xa757('0x13c'),_0xa757('0x13d'),_0xa757('0x13e'),_0xa757('0x13f'),_0xa757('0x140'),'accesskeyid',_0xa757('0x141'),_0xa757('0x142'),_0xa757('0x11'),_0xa757('0x143'),_0xa757('0x144'),_0xa757('0x145'),'dsn',_0xa757('0x146'),_0xa757('0x147'),'oldPassword'];function maskSensitiveData(_0x133f0c){var _0x68a80b=/(?!^)[\s\S](?!$)/g;for(var _0x1f4782 in _0x133f0c){if(_['isArray'](_0x133f0c[_0x1f4782])){for(var _0x3ae3bf=0x0;_0x3ae3bf<_0x133f0c[_0x1f4782][_0xa757('0x148')];_0x3ae3bf++){maskSensitiveData(_0x133f0c[_0x1f4782][_0x3ae3bf]);}}else if(_[_0xa757('0x149')](_0x133f0c[_0x1f4782])){maskSensitiveData(_0x133f0c[_0x1f4782]);}else if(_[_0xa757('0x14a')](_0x133f0c[_0x1f4782])){_0x133f0c[_0x1f4782]=_0x133f0c[_0x1f4782][_0xa757('0x14b')](/{{{/g,'@@{')[_0xa757('0x14b')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa757('0x14b')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x1f4782)){_0x133f0c[_0x1f4782]=_0x133f0c[_0x1f4782]['replace'](_0x68a80b,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index f5e7ccf..1b36858 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07dd=['../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc'];(function(_0x5712f8,_0x17156b){var _0x14a364=function(_0x1da9de){while(--_0x1da9de){_0x5712f8['push'](_0x5712f8['shift']());}};_0x14a364(++_0x17156b);}(_0x07dd,0xfb));var _0xd07d=function(_0x52f52c,_0x1fcf9a){_0x52f52c=_0x52f52c-0x0;var _0x143fc8=_0x07dd[_0x52f52c];return _0x143fc8;};'use strict';var jayson=require(_0xd07d('0x0'));var BPromise=require('bluebird');var _=require(_0xd07d('0x1'));var config=require(_0xd07d('0x2'));exports[_0xd07d('0x3')]=function(){return new BPromise(function(_0x18e53a,_0x1007ff){var _0x1d758f={};_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/user/user.rpc'));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x5')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/voiceQueue/voiceQueue.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/voiceRecording/voiceRecording.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x6')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x7')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x8')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x9')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0xa')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0xb')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0xc')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/mailAccount/mailAccount.rpc'));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0xd')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/mailInteraction/mailInteraction.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0xe')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0xf')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x10')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/faxAccount/faxAccount.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x11')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x12')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x13')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x14')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x15')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/smsAccount/smsAccount.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x16')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x17')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x18')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x19')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x1a')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x1b')));_0x1d758f=_['merge'](_0x1d758f,require('../api/chatInteraction/chatInteraction.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/chatMessage/chatMessage.rpc'));_0x1d758f=_['merge'](_0x1d758f,require('../api/chatQueue/chatQueue.rpc'));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x1c')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x1d')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x1e')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x1f')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x20')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/pause/pause.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x21')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x22')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x23')));_0x1d758f=_['merge'](_0x1d758f,require('../api/variable/variable.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x24')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x25')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x26')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x27')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x28')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x29')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x2a')));_0x1d758f=_['merge'](_0x1d758f,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x2b')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x2c')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x2d')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x2e')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x2f')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x30')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/campaign/campaign.rpc'));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x31')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x32')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x33')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x34')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x35')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x36')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x37')));var _0xadeba5=jayson[_0xd07d('0x38')](_0x1d758f)[_0xd07d('0x39')]();var _0x4a32ff=config[_0xd07d('0x3a')][_0xd07d('0x3b')]||config[_0xd07d('0x3b')]+0x1;var _0xd0a054=config[_0xd07d('0x3a')]['ip']||'localhost';_0xadeba5['on'](_0xd07d('0x3c'),function(_0x1b374a){return _0x1007ff(_0x1b374a);});_0xadeba5[_0xd07d('0x3')](_0x4a32ff,_0xd0a054,function(){console[_0xd07d('0x3d')](_0xd07d('0x3e'),_0xd0a054,_0x4a32ff);require(_0xd07d('0x3f'))[_0xd07d('0x40')]();return _0x18e53a(_0xd07d('0x41')+_0xd0a054+':'+_0x4a32ff);});});}; \ No newline at end of file +var _0xf414=['../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.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/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc'];(function(_0xe5f10c,_0x1549ce){var _0x519f93=function(_0x149b04){while(--_0x149b04){_0xe5f10c['push'](_0xe5f10c['shift']());}};_0x519f93(++_0x1549ce);}(_0xf414,0xd7));var _0x4f41=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0xf414[_0x350343];return _0x9afc1c;};'use strict';var jayson=require(_0x4f41('0x0'));var BPromise=require(_0x4f41('0x1'));var _=require(_0x4f41('0x2'));var config=require(_0x4f41('0x3'));exports[_0x4f41('0x4')]=function(){return new BPromise(function(_0x32fdc9,_0x5576df){var _0x1a856d={};_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x6')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require('../api/voiceExtension/voiceExtension.rpc'));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x7')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x8')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x9')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0xa')));_0x1a856d=_['merge'](_0x1a856d,require(_0x4f41('0xb')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0xc')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0xd')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0xe')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0xf')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x10')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x11')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x12')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require('../api/mailQueue/mailQueue.rpc'));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require('../api/mailInteraction/mailInteraction.rpc'));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x13')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x14')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x15')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x16')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require('../api/faxApplication/faxApplication.rpc'));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x17')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x18')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x19')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x1a')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require('../api/smsAccount/smsAccount.rpc'));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x1b')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require('../api/smsMessage/smsMessage.rpc'));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require('../api/smsQueue/smsQueue.rpc'));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x1c')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x1d')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x1e')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x1f')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x20')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x21')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x22')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x23')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x24')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x25')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x26')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x1a856d=_['merge'](_0x1a856d,require(_0x4f41('0x27')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x28')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require('../api/pause/pause.rpc'));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x29')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x2a')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x2b')));_0x1a856d=_['merge'](_0x1a856d,require(_0x4f41('0x2c')));_0x1a856d=_['merge'](_0x1a856d,require(_0x4f41('0x2d')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x1a856d=_['merge'](_0x1a856d,require(_0x4f41('0x2e')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x2f')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x30')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x31')));_0x1a856d=_['merge'](_0x1a856d,require(_0x4f41('0x32')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x33')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x34')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x35')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x36')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x37')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x38')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x39')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x3a')));_0x1a856d=_['merge'](_0x1a856d,require(_0x4f41('0x3b')));_0x1a856d=_['merge'](_0x1a856d,require(_0x4f41('0x3c')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x3d')));_0x1a856d=_['merge'](_0x1a856d,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x3e')));_0x1a856d=_['merge'](_0x1a856d,require(_0x4f41('0x3f')));_0x1a856d=_[_0x4f41('0x5')](_0x1a856d,require(_0x4f41('0x40')));var _0x4f1224=jayson[_0x4f41('0x41')](_0x1a856d)[_0x4f41('0x42')]();var _0x5b62a8=config[_0x4f41('0x43')][_0x4f41('0x44')]||config[_0x4f41('0x44')]+0x1;var _0x39a779=config[_0x4f41('0x43')]['ip']||_0x4f41('0x45');_0x4f1224['on'](_0x4f41('0x46'),function(_0x10060d){return _0x5576df(_0x10060d);});_0x4f1224[_0x4f41('0x4')](_0x5b62a8,_0x39a779,function(){console[_0x4f41('0x47')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x39a779,_0x5b62a8);require(_0x4f41('0x48'))[_0x4f41('0x49')]();return _0x32fdc9(_0x4f41('0x4a')+_0x39a779+':'+_0x5b62a8);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index c4f370f..17a3bf9 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(_0x4f3b2d,_0x3bbf46){var _0x3dddfa=function(_0xb8179a){while(--_0xb8179a){_0x4f3b2d['push'](_0x4f3b2d['shift']());}};_0x3dddfa(++_0x3bbf46);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x367361,_0x311488){_0x367361=_0x367361-0x0;var _0x195d2d=_0xcb91[_0x367361];return _0x195d2d;};'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 _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index f36a226..fe6ace3 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 _0xf429=['format','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','push'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0xf429,0xd4));var _0x9f42=function(_0x237c45,_0x55cf99){_0x237c45=_0x237c45-0x0;var _0x2942f6=_0xf429[_0x237c45];return _0x2942f6;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x9f42('0x0'),'E_AGI_ARGUMENT_PORT':_0x9f42('0x1'),'E_AGI_SERVER_ERROR':_0x9f42('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x9f42('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x9f42('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x9f42('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x9f42('0x6'),'E_AGI_COMMAND_EMPTY':_0x9f42('0x7'),'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(_0x874a2b){var _0x874a2b=_0x874a2b||null,_0x4329bf=_0x4329bf||[],_0x108fcb=0x1,_0x484ccd='';if(!error[_0x874a2b]){_0x874a2b='E_AGI_UNDEFINED';}_0x4329bf[_0x9f42('0x8')](error[_0x874a2b]);while(arguments[_0x108fcb]){_0x4329bf['push'](arguments[_0x108fcb]);_0x108fcb++;}_0x484ccd=util[_0x9f42('0x9')]['apply'](util,_0x4329bf);this[_0x9f42('0xa')]=_0x484ccd;this[_0x9f42('0xb')]=_0x874a2b;}module[_0x9f42('0xc')]=AGIError; \ No newline at end of file +var _0xd58c=['apply','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x188ede,_0x157bd5){var _0x2792c8=function(_0x182b61){while(--_0x182b61){_0x188ede['push'](_0x188ede['shift']());}};_0x2792c8(++_0x157bd5);}(_0xd58c,0xb6));var _0xcd58=function(_0x4bc21e,_0x54a1a){_0x4bc21e=_0x4bc21e-0x0;var _0x110e93=_0xd58c[_0x4bc21e];return _0x110e93;};'use strict';var util=require(_0xcd58('0x0'));var error={'E_AGI_UNDEFINED':_0xcd58('0x1'),'E_AGI_ARGUMENT_PORT':_0xcd58('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xcd58('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xcd58('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xcd58('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xcd58('0x6'),'E_AGI_COMMAND_EMPTY':_0xcd58('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xcd58('0x8'),'E_AGI_IVR_ENTRY':_0xcd58('0x9')};function AGIError(_0x599c02){var _0x599c02=_0x599c02||null,_0x3f2c97=_0x3f2c97||[],_0x31bf4e=0x1,_0x43a501='';if(!error[_0x599c02]){_0x599c02=_0xcd58('0xa');}_0x3f2c97[_0xcd58('0xb')](error[_0x599c02]);while(arguments[_0x31bf4e]){_0x3f2c97['push'](arguments[_0x31bf4e]);_0x31bf4e++;}_0x43a501=util[_0xcd58('0xc')][_0xcd58('0xd')](util,_0x3f2c97);this['message']=_0x43a501;this[_0xcd58('0xe')]=_0x599c02;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 6d34170..f444d00 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 _0x97c1=['../../../config/logger','menu','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','split','vswitch','target','default','agicommand','invalid','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash'];(function(_0xa8854b,_0x398a99){var _0x39f90e=function(_0x48024b){while(--_0x48024b){_0xa8854b['push'](_0xa8854b['shift']());}};_0x39f90e(++_0x398a99);}(_0x97c1,0xdf));var _0x197c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x97c1[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x197c('0x0'));var logger=require(_0x197c('0x1'))('agi');var verticesWithRetry=[_0x197c('0x2'),'getdigits','getsecretdigits'];var Graph=function(){this[_0x197c('0x3')]={};this[_0x197c('0x4')]={};this[_0x197c('0x5')]=0x0;};Graph[_0x197c('0x6')][_0x197c('0x7')]=function(_0x4a6f09){this['vertices'][_0x4a6f09['id']]=_0x4a6f09;this[_0x197c('0x4')][_0x4a6f09['id']]=[];};Graph[_0x197c('0x6')][_0x197c('0x8')]=function(_0xfcee35,_0x5cf5cb,_0x5d42c5){this[_0x197c('0x4')][_0xfcee35]['push']({'target':_0x5cf5cb,'condition':_0x5d42c5});this[_0x197c('0x5')]+=0x1;};Graph[_0x197c('0x6')][_0x197c('0x9')]=function(){return _[_0x197c('0x9')](this['vertices']);};Graph[_0x197c('0x6')][_0x197c('0xa')]=function(){return this[_0x197c('0x5')];};Graph[_0x197c('0x6')][_0x197c('0xb')]=function(_0x58c7b0){return this[_0x197c('0x3')][_0x58c7b0];};Graph[_0x197c('0x6')][_0x197c('0xc')]=function(_0x1adcfa,_0x567658){if(!this[_0x197c('0x3')][_0x1adcfa]){return logger[_0x197c('0xd')](_0x197c('0xe'));}var _0xf735ce=_0x567658(this[_0x197c('0x3')][_0x1adcfa]);if(!_0xf735ce){return logger[_0x197c('0xd')]('stop\x20traverse');}if(this['edges'][_0x1adcfa][_0x197c('0xf')]===0x0){return logger[_0x197c('0xd')](_0x197c('0x10'));}for(var _0x24901f=0x0,_0x33f8d3=[],_0x7e302f=![];_0x24901f\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','target','source','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','variables','stringify','close','timeout','evtHangup','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','gotoc','context','extension','priority','response','code','result','isUndefined','toString','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults','error','stack','log'];(function(_0x247502,_0x565e72){var _0x39297d=function(_0x3caa80){while(--_0x3caa80){_0x247502['push'](_0x247502['shift']());}};_0x39297d(++_0x565e72);}(_0x32ef,0xf9));var _0xf32e=function(_0x5a032b,_0x42fc7a){_0x5a032b=_0x5a032b-0x0;var _0x3517aa=_0x32ef[_0x5a032b];return _0x3517aa;};'use strict';var parser=require(_0xf32e('0x0'));var _=require(_0xf32e('0x1'));var syncho=require(_0xf32e('0x2'));var util=require(_0xf32e('0x3'));var moment=require(_0xf32e('0x4'));var config=require(_0xf32e('0x5'));var logger=require('../../config/logger')(_0xf32e('0x6'));var utilLicense=require(_0xf32e('0x7'));var rpc=require('./rpc');var mailRpc=require(_0xf32e('0x8'));var Graph=require(_0xf32e('0x9'));var Vertices=require(_0xf32e('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xf32e('0x6')]=_[_0xf32e('0xb')](config[_0xf32e('0x6')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0xdac5e){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0xdac5e);agiHandler(_0xdac5e);}catch(_0x384f27){logger[_0xf32e('0xc')](_0x384f27[_0xf32e('0xd')]);}});});}function listeningHandler(){console[_0xf32e('0xe')](_0xf32e('0xf'),config['agi'][_0xf32e('0x10')]);logger[_0xf32e('0x11')](util[_0xf32e('0x12')](_0xf32e('0x13'),config[_0xf32e('0x6')]['ip'],config[_0xf32e('0x6')][_0xf32e('0x10')]));}function errorHandler(_0x303d4d){if(_0x303d4d&&_0x303d4d[_0xf32e('0x14')]&&_0x303d4d[_0xf32e('0x15')]){logger[_0xf32e('0xc')](util['format'](_0xf32e('0x16'),_0x303d4d[_0xf32e('0x14')],_0x303d4d[_0xf32e('0x15')]));}else{logger[_0xf32e('0xc')](util[_0xf32e('0x12')](_0xf32e('0x17'),_0x303d4d['stack']));}}function closeHandler(){logger[_0xf32e('0x11')](util[_0xf32e('0x12')](_0xf32e('0x18'),this[_0xf32e('0x19')],this[_0xf32e('0x1a')],this[_0xf32e('0x1b')],this[_0xf32e('0x1c')],this[_0xf32e('0x1d')]));try{createSquareReport(this);}catch(_0x21aa73){logger['error'](_0x21aa73[_0xf32e('0xd')]);}}function timeoutHandler(){logger[_0xf32e('0x11')](util[_0xf32e('0x12')](_0xf32e('0x1e'),this[_0xf32e('0x19')],this[_0xf32e('0x1a')],this[_0xf32e('0x1b')],this[_0xf32e('0x1c')],this[_0xf32e('0x1d')]));}function hangupHandler(){logger[_0xf32e('0x11')](util[_0xf32e('0x12')](_0xf32e('0x1f'),this[_0xf32e('0x19')],this[_0xf32e('0x1a')],this[_0xf32e('0x1b')],this['dnid'],this[_0xf32e('0x1d')]));this['evtHangup']=!![];}function getRoot(_0x27b92c){return parser[_0xf32e('0x20')](_0x27b92c,{'object':!![]})[_0xf32e('0x21')][_0xf32e('0x22')];}function addVertex(_0x35e34c,_0x5409b4,_0x227405){_0x5409b4[_0xf32e('0x23')]=_0x227405;if(_0x5409b4[_0xf32e('0x24')](_0xf32e('0x25'))){_0x5409b4['maxRetry']=parseInt(_0x5409b4[_0xf32e('0x25')],0xa);}_0x35e34c[_0xf32e('0x26')](_[_0xf32e('0x27')](_0x5409b4,_0xf32e('0x28')));}function initGraph(_0xb3ee4b,_0x15103f){var _0x2f925b=new Graph();for(var _0x1eb42e in _0xb3ee4b){if(_0xb3ee4b[_0xf32e('0x24')](_0x1eb42e)){if(_[_0xf32e('0x29')](_0xb3ee4b[_0x1eb42e])){for(var _0x488489=0x0;_0x488489<_0xb3ee4b[_0x1eb42e][_0xf32e('0x2a')];_0x488489+=0x1){addVertex(_0x2f925b,_0xb3ee4b[_0x1eb42e][_0x488489],_0x1eb42e);}}else{addVertex(_0x2f925b,_0xb3ee4b[_0x1eb42e],_0x1eb42e);}}}for(var _0x88eaa5=0x0;_0x88eaa5<_0x15103f[_0xf32e('0x2a')];_0x88eaa5+=0x1){if(_0x15103f[_0x88eaa5]['source']&&_0x15103f[_0x88eaa5][_0xf32e('0x2b')]){_0x2f925b['addEdge'](_0x15103f[_0x88eaa5][_0xf32e('0x2c')],_0x15103f[_0x88eaa5]['target'],_0x15103f[_0x88eaa5][_0xf32e('0x2d')]);}}return _0x2f925b;}function getSquareProject(_0x39965e,_0x3e42ac){rpc[_0xf32e('0x2e')](_0x39965e)[_0xf32e('0x2f')](function(_0x4e64d4){_0x3e42ac(null,_0x4e64d4);})[_0xf32e('0x30')](function(_0x1d3c7a){_0x3e42ac(null,_0x1d3c7a);});}function createSquareReport(_0x175096,_0x498c9c){rpc[_0xf32e('0x31')](_0x175096)[_0xf32e('0x2f')](function(_0x2d0d31){if(_0x498c9c){_0x498c9c(null,_0x2d0d31);}})[_0xf32e('0x30')](function(_0x3e0c1e){if(_0x498c9c){_0x498c9c(null,_0x3e0c1e);}});}function setChannelVariables(_0x3f4362){for(var _0x146b52 in _0x3f4362){if(_0x3f4362[_0xf32e('0x24')](_0x146b52)){if(_0x146b52[_0xf32e('0x32')](_0xf32e('0x33'))===0x0){_0x3f4362[_0x146b52[_0xf32e('0x34')](0x4)]=_0x3f4362[_0x146b52];delete _0x3f4362[_0x146b52];}}}}function getLogFromObject(_0x45524d){return util[_0xf32e('0x35')](_0x45524d,{'showHidden':![],'depth':null});}function agiHandler(_0x5c04ae){var _0x7b643e,_0x5232de,_0x576446,_0x529b70,_0x565552;logger[_0xf32e('0x36')](_0xf32e('0x37'),JSON[_0xf32e('0x38')](_0x5c04ae,null,0x2));logger[_0xf32e('0x11')](util[_0xf32e('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5c04ae[_0xf32e('0x19')],_0x5c04ae[_0xf32e('0x1a')],_0x5c04ae[_0xf32e('0x1b')],_0x5c04ae[_0xf32e('0x1c')],_0x5c04ae['uniqueid']));_0x5c04ae['on'](_0xf32e('0xc'),errorHandler);_0x5c04ae['on'](_0xf32e('0x39'),closeHandler);_0x5c04ae['on'](_0xf32e('0x3a'),timeoutHandler);_0x5c04ae[_0xf32e('0x3b')]=![];_0x5c04ae['on'](_0xf32e('0x3c'),hangupHandler);var _0x576f37=getSquareProject[_0xf32e('0x3d')](null,_0x5c04ae[_0xf32e('0x19')]);if(_0x576f37){if(_0x576f37[_0xf32e('0x3e')]){_0x7b643e=getRoot(_0x576f37['production']);if(_0x7b643e&&_0x7b643e[_0xf32e('0x3f')]){logger['debug'](_0xf32e('0x22'),JSON[_0xf32e('0x38')](_0x7b643e,null,0x2));_0x5c04ae[_0xf32e('0x40')]=moment()['format'](_0xf32e('0x41'));_0x5232de=initGraph(_[_0xf32e('0x27')](_0x7b643e,_0xf32e('0x28')),_0x7b643e[_0xf32e('0x28')]);_0x576446=new Vertices(_0x5c04ae,rpc,mailRpc);logger[_0xf32e('0x11')](util[_0xf32e('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5c04ae[_0xf32e('0x19')],_0x5c04ae[_0xf32e('0x1a')],_0x5c04ae[_0xf32e('0x1b')],_0x5c04ae[_0xf32e('0x1c')],_0x5c04ae[_0xf32e('0x1d')]));_0x5232de[_0xf32e('0x42')](_0x7b643e[_0xf32e('0x3f')]['id'],function(_0x56bf88){try{_0x56bf88=_0x576446[_0xf32e('0x43')](_0x56bf88);logger[_0xf32e('0x36')](_0xf32e('0x44'),JSON[_0xf32e('0x38')](_0x56bf88,null,0x2));if(_0x56bf88[_0xf32e('0x23')]===_0xf32e('0x45')){logger[_0xf32e('0x11')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5c04ae[_0xf32e('0x46')]=_0x56bf88[_0xf32e('0x46')]||_0x5c04ae[_0xf32e('0x46')];_0x5c04ae[_0xf32e('0x47')]=_0x56bf88[_0xf32e('0x47')];_0x5c04ae[_0xf32e('0x48')]=_0x56bf88[_0xf32e('0x48')]?_0x56bf88[_0xf32e('0x48')]-0x1:0x1;return null;}else if(_0x56bf88&&_0x576446[_0x56bf88[_0xf32e('0x23')]]){_0x565552=_0x576446[_0x56bf88[_0xf32e('0x23')]](_0x56bf88);logger['info'](_0xf32e('0x49'),JSON[_0xf32e('0x38')](_0x565552,null,0x2));if(_0x565552&&_0x565552[_0xf32e('0x4a')]===AGI_CODE_SUCCESS&&_0x565552[_0xf32e('0x4b')]!==AGI_RESULT_ERROR&&!_0x5c04ae[_0xf32e('0x3b')]){logger[_0xf32e('0x36')]('response',getLogFromObject(_0x565552));return _[_0xf32e('0x4c')](_0x565552[_0xf32e('0x4b')])?null:_0x565552[_0xf32e('0x4b')][_0xf32e('0x4d')]();}else{logger[_0xf32e('0xc')]('response',getLogFromObject(_0x565552));return null;}}else{logger[_0xf32e('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0xd81744){logger[_0xf32e('0xc')](_0xd81744['stack']);return null;}});if(_0x7b643e[_0xf32e('0x4e')]){logger['info'](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5c04ae[_0xf32e('0x19')],_0x5c04ae[_0xf32e('0x1a')],_0x5c04ae[_0xf32e('0x1b')],_0x5c04ae[_0xf32e('0x1c')],_0x5c04ae[_0xf32e('0x1d')]));_0x5232de[_0xf32e('0x42')](_0x7b643e[_0xf32e('0x4e')]['id'],function(_0x40fedb){try{_0x40fedb=_0x576446[_0xf32e('0x43')](_0x40fedb);logger[_0xf32e('0x36')](_0xf32e('0x44'),JSON[_0xf32e('0x38')](_0x40fedb,null,0x2));if(_0x40fedb&&_0x576446[_0x40fedb[_0xf32e('0x23')]]){_0x565552=_0x576446[_0x40fedb[_0xf32e('0x23')]](_0x40fedb);if(_0x565552){logger['debug'](_0xf32e('0x49'),getLogFromObject(_0x565552));return _[_0xf32e('0x4c')](_0x565552[_0xf32e('0x4b')])?null:_0x565552['result']['toString']();}else{logger['error'](_0xf32e('0x49'),getLogFromObject(_0x565552));return null;}}else{logger[_0xf32e('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x436b8a){logger[_0xf32e('0xc')](_0x436b8a['stack']);return null;}});}logger[_0xf32e('0x11')](util[_0xf32e('0x12')](_0xf32e('0x4f'),_0x5c04ae[_0xf32e('0x19')],_0x5c04ae[_0xf32e('0x1a')],_0x5c04ae[_0xf32e('0x1b')],_0x5c04ae['dnid'],_0x5c04ae[_0xf32e('0x1d')]));logger[_0xf32e('0x11')](util[_0xf32e('0x12')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5c04ae[_0xf32e('0x46')],_0x5c04ae[_0xf32e('0x47')],parseInt(_0x5c04ae[_0xf32e('0x48')],0xa)+0x1));_0x5c04ae['continueAt'](_0x5c04ae['context'],_0x5c04ae['extension'],parseInt(_0x5c04ae[_0xf32e('0x48')],0xa)+0x1);_0x5c04ae[_0xf32e('0x39')]();}}else{logger[_0xf32e('0xc')](util[_0xf32e('0x12')]('Project\x20%s\x20not\x20published',_0x5c04ae[_0xf32e('0x19')]));_0x5c04ae[_0xf32e('0x50')](_0x5c04ae[_0xf32e('0x46')],_0x5c04ae[_0xf32e('0x47')],parseInt(_0x5c04ae[_0xf32e('0x48')],0xa)+0x1);_0x5c04ae['close']();}}else{logger[_0xf32e('0xc')](util[_0xf32e('0x12')](_0xf32e('0x51'),_0x5c04ae[_0xf32e('0x19')]));_0x5c04ae['continueAt'](_0x5c04ae[_0xf32e('0x46')],_0x5c04ae['extension'],parseInt(_0x5c04ae['priority'],0xa)+0x1);_0x5c04ae[_0xf32e('0x39')]();}}function main(){var _0x1954e1;return utilLicense[_0xf32e('0x52')]()[_0xf32e('0x2f')](function(_0x1d58fa){if(_0x1d58fa){if(_0x1d58fa[_0xf32e('0x53')]){if(_0x1d58fa[_0xf32e('0x54')]&&_0x1d58fa[_0xf32e('0x54')]>0x0){logger[_0xf32e('0x11')](util[_0xf32e('0x12')](_0xf32e('0x55'),_0x1d58fa[_0xf32e('0x54')]));_0x1954e1=_0x1d58fa['callysquare'];}else{logger[_0xf32e('0x11')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xf32e('0x11')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1954e1=-0x1;}}})[_0xf32e('0x30')](function(_0x2b179e){logger[_0xf32e('0xc')]('[LICENSE]',_0x2b179e[_0xf32e('0xd')]);})[_0xf32e('0x4e')](function(){var _0x500bfb=require('./server')(config['agi'][_0xf32e('0x10')],config[_0xf32e('0x6')]['ip'],_0x1954e1);_0x500bfb['on'](_0xf32e('0xc'),errorHandler);_0x500bfb['on'](_0xf32e('0x56'),listeningHandler);_0x500bfb['on'](_0xf32e('0x57'),connectionHandler);_0x500bfb['on'](_0xf32e('0x39'),closeHandler);});}main(); \ No newline at end of file +var _0x7f42=['[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','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','then','createSquareReport','indexOf','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','root','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','start','clear','vertex','context','extension','priority','response','isUndefined','result','toString','finally','agicommand\x20not\x20found','[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','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','connection','xml2json','syncho','util','../../config/environment','agi','./rpc','./graph','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s'];(function(_0x54180a,_0x5c4772){var _0x3f1418=function(_0x463709){while(--_0x463709){_0x54180a['push'](_0x54180a['shift']());}};_0x3f1418(++_0x5c4772);}(_0x7f42,0x1dd));var _0x27f4=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x7f42[_0x46e363];return _0x3fb059;};'use strict';var parser=require(_0x27f4('0x0'));var _=require('lodash');var syncho=require(_0x27f4('0x1'));var util=require(_0x27f4('0x2'));var moment=require('moment');var config=require(_0x27f4('0x3'));var logger=require('../../config/logger')(_0x27f4('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0x27f4('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x27f4('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x27f4('0x4')]=_[_0x27f4('0x7')](config[_0x27f4('0x4')],{'ip':_0x27f4('0x8'),'port':0x11dd});function connectionHandler(_0x2a4b6f){process[_0x27f4('0x9')](function(){syncho(function(){try{setChannelVariables(_0x2a4b6f);agiHandler(_0x2a4b6f);}catch(_0x458687){logger[_0x27f4('0xa')](_0x458687[_0x27f4('0xb')]);}});});}function listeningHandler(){console[_0x27f4('0xc')](_0x27f4('0xd'),config[_0x27f4('0x4')][_0x27f4('0xe')]);logger[_0x27f4('0xf')](util[_0x27f4('0x10')](_0x27f4('0x11'),config[_0x27f4('0x4')]['ip'],config[_0x27f4('0x4')]['port']));}function errorHandler(_0x523255){if(_0x523255&&_0x523255[_0x27f4('0x12')]&&_0x523255[_0x27f4('0x13')]){logger[_0x27f4('0xa')](util[_0x27f4('0x10')](_0x27f4('0x14'),_0x523255[_0x27f4('0x12')],_0x523255[_0x27f4('0x13')]));}else{logger[_0x27f4('0xa')](util['format']('[ERROR]\x20%s',_0x523255[_0x27f4('0xb')]));}}function closeHandler(){logger[_0x27f4('0xf')](util[_0x27f4('0x10')](_0x27f4('0x15'),this['arg_1'],this[_0x27f4('0x16')],this[_0x27f4('0x17')],this[_0x27f4('0x18')],this['uniqueid']));try{createSquareReport(this);}catch(_0x3203af){logger[_0x27f4('0xa')](_0x3203af[_0x27f4('0xb')]);}}function timeoutHandler(){logger['info'](util[_0x27f4('0x10')](_0x27f4('0x19'),this['arg_1'],this['calleridname'],this[_0x27f4('0x17')],this[_0x27f4('0x18')],this[_0x27f4('0x1a')]));}function hangupHandler(){logger[_0x27f4('0xf')](util[_0x27f4('0x10')](_0x27f4('0x1b'),this[_0x27f4('0x1c')],this[_0x27f4('0x16')],this[_0x27f4('0x17')],this[_0x27f4('0x18')],this[_0x27f4('0x1a')]));this[_0x27f4('0x1d')]=!![];}function getRoot(_0x22f794){return parser[_0x27f4('0x1e')](_0x22f794,{'object':!![]})[_0x27f4('0x1f')]['root'];}function addVertex(_0xe69de0,_0x112803,_0x202e8f){_0x112803[_0x27f4('0x20')]=_0x202e8f;if(_0x112803[_0x27f4('0x21')](_0x27f4('0x22'))){_0x112803[_0x27f4('0x23')]=parseInt(_0x112803[_0x27f4('0x22')],0xa);}_0xe69de0[_0x27f4('0x24')](_[_0x27f4('0x25')](_0x112803,_0x27f4('0x26')));}function initGraph(_0x1e24c3,_0x167574){var _0x400d8d=new Graph();for(var _0x2b9e38 in _0x1e24c3){if(_0x1e24c3[_0x27f4('0x21')](_0x2b9e38)){if(_[_0x27f4('0x27')](_0x1e24c3[_0x2b9e38])){for(var _0x56b2c6=0x0;_0x56b2c6<_0x1e24c3[_0x2b9e38][_0x27f4('0x28')];_0x56b2c6+=0x1){addVertex(_0x400d8d,_0x1e24c3[_0x2b9e38][_0x56b2c6],_0x2b9e38);}}else{addVertex(_0x400d8d,_0x1e24c3[_0x2b9e38],_0x2b9e38);}}}for(var _0x566d28=0x0;_0x566d28<_0x167574[_0x27f4('0x28')];_0x566d28+=0x1){if(_0x167574[_0x566d28][_0x27f4('0x29')]&&_0x167574[_0x566d28][_0x27f4('0x2a')]){_0x400d8d['addEdge'](_0x167574[_0x566d28][_0x27f4('0x29')],_0x167574[_0x566d28][_0x27f4('0x2a')],_0x167574[_0x566d28]['value']);}}return _0x400d8d;}function getSquareProject(_0x350767,_0x26a2c2){rpc['getSquareProject'](_0x350767)[_0x27f4('0x2b')](function(_0x2079fb){_0x26a2c2(null,_0x2079fb);})['catch'](function(_0x37f6a3){_0x26a2c2(null,_0x37f6a3);});}function createSquareReport(_0x11b1c2,_0x4ed387){rpc[_0x27f4('0x2c')](_0x11b1c2)[_0x27f4('0x2b')](function(_0x1f2f16){if(_0x4ed387){_0x4ed387(null,_0x1f2f16);}})['catch'](function(_0x5d3bc6){if(_0x4ed387){_0x4ed387(null,_0x5d3bc6);}});}function setChannelVariables(_0x50e6be){for(var _0x522bc8 in _0x50e6be){if(_0x50e6be[_0x27f4('0x21')](_0x522bc8)){if(_0x522bc8[_0x27f4('0x2d')](_0x27f4('0x2e'))===0x0){_0x50e6be[_0x522bc8[_0x27f4('0x2f')](0x4)]=_0x50e6be[_0x522bc8];delete _0x50e6be[_0x522bc8];}}}}function getLogFromObject(_0x2ce23e){return util[_0x27f4('0x30')](_0x2ce23e,{'showHidden':![],'depth':null});}function agiHandler(_0x237f44){var _0x1b3beb,_0x34b875,_0x3d0865,_0x280b2a,_0x4b32fa;logger[_0x27f4('0x31')](_0x27f4('0x32'),JSON[_0x27f4('0x33')](_0x237f44,null,0x2));logger['info'](util[_0x27f4('0x10')](_0x27f4('0x34'),_0x237f44[_0x27f4('0x1c')],_0x237f44[_0x27f4('0x16')],_0x237f44[_0x27f4('0x17')],_0x237f44[_0x27f4('0x18')],_0x237f44[_0x27f4('0x1a')]));_0x237f44['on'](_0x27f4('0xa'),errorHandler);_0x237f44['on'](_0x27f4('0x35'),closeHandler);_0x237f44['on'](_0x27f4('0x36'),timeoutHandler);_0x237f44[_0x27f4('0x1d')]=![];_0x237f44['on'](_0x27f4('0x37'),hangupHandler);var _0x63c4f2=getSquareProject[_0x27f4('0x38')](null,_0x237f44[_0x27f4('0x1c')]);if(_0x63c4f2){if(_0x63c4f2[_0x27f4('0x39')]){_0x1b3beb=getRoot(_0x63c4f2['production']);if(_0x1b3beb&&_0x1b3beb['start']){logger[_0x27f4('0x31')](_0x27f4('0x3a'),JSON[_0x27f4('0x33')](_0x1b3beb,null,0x2));_0x237f44['joinAt']=moment()[_0x27f4('0x10')](_0x27f4('0x3b'));_0x34b875=initGraph(_[_0x27f4('0x25')](_0x1b3beb,'mxCell'),_0x1b3beb[_0x27f4('0x26')]);_0x3d0865=new Vertices(_0x237f44,rpc,mailRpc);logger[_0x27f4('0xf')](util['format'](_0x27f4('0x3c'),_0x237f44[_0x27f4('0x1c')],_0x237f44[_0x27f4('0x16')],_0x237f44[_0x27f4('0x17')],_0x237f44[_0x27f4('0x18')],_0x237f44['uniqueid']));_0x34b875[_0x27f4('0x3d')](_0x1b3beb[_0x27f4('0x3e')]['id'],function(_0x441a1b){try{_0x441a1b=_0x3d0865[_0x27f4('0x3f')](_0x441a1b);logger['debug'](_0x27f4('0x40'),JSON[_0x27f4('0x33')](_0x441a1b,null,0x2));if(_0x441a1b[_0x27f4('0x20')]==='gotoc'){logger[_0x27f4('0xf')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x237f44[_0x27f4('0x41')]=_0x441a1b[_0x27f4('0x41')]||_0x237f44[_0x27f4('0x41')];_0x237f44[_0x27f4('0x42')]=_0x441a1b['extension'];_0x237f44[_0x27f4('0x43')]=_0x441a1b[_0x27f4('0x43')]?_0x441a1b[_0x27f4('0x43')]-0x1:0x1;return null;}else if(_0x441a1b&&_0x3d0865[_0x441a1b[_0x27f4('0x20')]]){_0x4b32fa=_0x3d0865[_0x441a1b[_0x27f4('0x20')]](_0x441a1b);logger['info'](_0x27f4('0x44'),JSON['stringify'](_0x4b32fa,null,0x2));if(_0x4b32fa&&_0x4b32fa['code']===AGI_CODE_SUCCESS&&_0x4b32fa['result']!==AGI_RESULT_ERROR&&!_0x237f44[_0x27f4('0x1d')]){logger[_0x27f4('0x31')](_0x27f4('0x44'),getLogFromObject(_0x4b32fa));return _[_0x27f4('0x45')](_0x4b32fa['result'])?null:_0x4b32fa[_0x27f4('0x46')][_0x27f4('0x47')]();}else{logger[_0x27f4('0xa')](_0x27f4('0x44'),getLogFromObject(_0x4b32fa));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x19e3b8){logger[_0x27f4('0xa')](_0x19e3b8[_0x27f4('0xb')]);return null;}});if(_0x1b3beb[_0x27f4('0x48')]){logger['info'](util[_0x27f4('0x10')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x237f44['arg_1'],_0x237f44['calleridname'],_0x237f44[_0x27f4('0x17')],_0x237f44['dnid'],_0x237f44[_0x27f4('0x1a')]));_0x34b875[_0x27f4('0x3d')](_0x1b3beb['finally']['id'],function(_0x1c35fc){try{_0x1c35fc=_0x3d0865[_0x27f4('0x3f')](_0x1c35fc);logger['debug'](_0x27f4('0x40'),JSON[_0x27f4('0x33')](_0x1c35fc,null,0x2));if(_0x1c35fc&&_0x3d0865[_0x1c35fc[_0x27f4('0x20')]]){_0x4b32fa=_0x3d0865[_0x1c35fc[_0x27f4('0x20')]](_0x1c35fc);if(_0x4b32fa){logger[_0x27f4('0x31')](_0x27f4('0x44'),getLogFromObject(_0x4b32fa));return _[_0x27f4('0x45')](_0x4b32fa[_0x27f4('0x46')])?null:_0x4b32fa['result'][_0x27f4('0x47')]();}else{logger['error'](_0x27f4('0x44'),getLogFromObject(_0x4b32fa));return null;}}else{logger[_0x27f4('0xa')](_0x27f4('0x49'));return null;}}catch(_0x5b4da8){logger['error'](_0x5b4da8[_0x27f4('0xb')]);return null;}});}logger[_0x27f4('0xf')](util['format'](_0x27f4('0x4a'),_0x237f44['arg_1'],_0x237f44[_0x27f4('0x16')],_0x237f44[_0x27f4('0x17')],_0x237f44[_0x27f4('0x18')],_0x237f44[_0x27f4('0x1a')]));logger[_0x27f4('0xf')](util[_0x27f4('0x10')](_0x27f4('0x4b'),_0x237f44['context'],_0x237f44['extension'],parseInt(_0x237f44[_0x27f4('0x43')],0xa)+0x1));_0x237f44['continueAt'](_0x237f44[_0x27f4('0x41')],_0x237f44[_0x27f4('0x42')],parseInt(_0x237f44['priority'],0xa)+0x1);_0x237f44[_0x27f4('0x35')]();}}else{logger[_0x27f4('0xa')](util[_0x27f4('0x10')](_0x27f4('0x4c'),_0x237f44[_0x27f4('0x1c')]));_0x237f44[_0x27f4('0x4d')](_0x237f44[_0x27f4('0x41')],_0x237f44[_0x27f4('0x42')],parseInt(_0x237f44[_0x27f4('0x43')],0xa)+0x1);_0x237f44[_0x27f4('0x35')]();}}else{logger[_0x27f4('0xa')](util[_0x27f4('0x10')](_0x27f4('0x4e'),_0x237f44[_0x27f4('0x1c')]));_0x237f44[_0x27f4('0x4d')](_0x237f44['context'],_0x237f44[_0x27f4('0x42')],parseInt(_0x237f44[_0x27f4('0x43')],0xa)+0x1);_0x237f44['close']();}}function main(){var _0x46b658;return utilLicense['getLicense']()['then'](function(_0x2de7ac){if(_0x2de7ac){if(_0x2de7ac['voice']){if(_0x2de7ac['callysquare']&&_0x2de7ac['callysquare']>0x0){logger['info'](util[_0x27f4('0x10')]('[LICENSE]\x20CHANNELS:\x20%s',_0x2de7ac[_0x27f4('0x4f')]));_0x46b658=_0x2de7ac['callysquare'];}else{logger[_0x27f4('0xf')](_0x27f4('0x50'));}}else{logger[_0x27f4('0xf')](_0x27f4('0x51'));_0x46b658=-0x1;}}})['catch'](function(_0xcf003d){logger[_0x27f4('0xa')]('[LICENSE]',_0xcf003d[_0x27f4('0xb')]);})[_0x27f4('0x48')](function(){var _0x4a3bcb=require('./server')(config[_0x27f4('0x4')][_0x27f4('0xe')],config['agi']['ip'],_0x46b658);_0x4a3bcb['on'](_0x27f4('0xa'),errorHandler);_0x4a3bcb['on']('listening',listeningHandler);_0x4a3bcb['on'](_0x27f4('0x52'),connectionHandler);_0x4a3bcb['on'](_0x27f4('0x35'),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 d5e1bbb..294dee9 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(_0x128b60,_0x55b192){var _0x2135db=function(_0x233544){while(--_0x233544){_0x128b60['push'](_0x128b60['shift']());}};_0x2135db(++_0x55b192);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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(_0x44a819,_0x5dee54){var _0x20af93=function(_0x255331){while(--_0x255331){_0x44a819['push'](_0x44a819['shift']());}};_0x20af93(++_0x5dee54);}(_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 diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 989931f..f8ce01a 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 _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(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0xb10b,0x12a));var _0xbb10=function(_0x49d7c8,_0x52d9a3){_0x49d7c8=_0x49d7c8-0x0;var _0x450089=_0xb10b[_0x49d7c8];return _0x450089;};'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 +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(_0x19159d,_0x3d05c8){var _0x35884a=function(_0xe419f8){while(--_0xe419f8){_0x19159d['push'](_0x19159d['shift']());}};_0x35884a(++_0x3d05c8);}(_0xb10b,0x12a));var _0xbb10=function(_0x131bb1,_0x5c91cc){_0x131bb1=_0x131bb1-0x0;var _0x4b006b=_0xb10b[_0x131bb1];return _0x4b006b;};'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 5bb6027..372c6a4 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 _0x7d1f=['ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','client','request','error','result','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0x7d1f,0x10f));var _0xf7d1=function(_0x391714,_0x249b14){_0x391714=_0x391714-0x0;var _0xf29811=_0x7d1f[_0x391714];return _0xf29811;};'use strict';var BPromise=require(_0xf7d1('0x0'));var moment=require(_0xf7d1('0x1'));var _=require(_0xf7d1('0x2'));var util=require(_0xf7d1('0x3'));var jayson=require('jayson/promise');var client=jayson[_0xf7d1('0x4')]['http']({'port':0x2329});function request(_0x2dc23e,_0x547da2){return new BPromise(function(_0x5bcef6,_0xe6e78){return client[_0xf7d1('0x5')](_0x2dc23e,_0x547da2)['then'](function(_0x5edc59){if(_0x5edc59[_0xf7d1('0x6')]){return _0xe6e78(_0x5edc59['error']['message']);}else{return _0x5bcef6(_0x5edc59[_0xf7d1('0x7')]);}})['catch'](function(_0x486cf5){return _0xe6e78(_0x486cf5);});});}exports[_0xf7d1('0x8')]=function(_0x38e386){return request(_0xf7d1('0x9'),{'options':{'raw':![],'where':{'name':_0x38e386},'attributes':['production']}});};exports[_0xf7d1('0xa')]=function(_0x46120b){return request(_0xf7d1('0xb'),{'options':{'raw':![],'where':{'id':_0x46120b},'include':[{'model':_0xf7d1('0xc'),'as':_0xf7d1('0xd')}],'attributes':['id',_0xf7d1('0xe'),_0xf7d1('0xf')]}});};exports[_0xf7d1('0x10')]=function(_0x1f3dc6){return request(_0xf7d1('0x9'),{'options':{'where':{'id':_0x1f3dc6},'attributes':[_0xf7d1('0xe')]}});};exports['getVoiceQueueById']=function(_0x98fb45){return request(_0xf7d1('0x11'),{'options':{'where':{'id':_0x98fb45},'attributes':[_0xf7d1('0xe')]}});};exports[_0xf7d1('0x12')]=function(_0x31fe26){return request(_0xf7d1('0x13'),{'options':{'where':{'id':_0x31fe26},'attributes':[_0xf7d1('0xe')]}});};exports[_0xf7d1('0x14')]=function(_0x4bc028){return request(_0xf7d1('0x15'),{'options':{'where':{'id':_0x4bc028},'attributes':[_0xf7d1('0x16')]}});};exports[_0xf7d1('0x17')]=function(_0x4c8e4d){return request(_0xf7d1('0x18'),{'options':{'where':{'id':_0x4c8e4d},'attributes':[_0xf7d1('0xe')]}});};exports[_0xf7d1('0x19')]=function(_0x399d92){return request(_0xf7d1('0x1a'),{'options':{'where':{'id':_0x399d92},'attributes':[_0xf7d1('0xe')]}});};exports[_0xf7d1('0x1b')]=function(_0x38106c){return request(_0xf7d1('0x1c'),{'options':{'where':{'id':_0x38106c},'attributes':[_0xf7d1('0x1d')]}});};exports[_0xf7d1('0x1e')]=function(_0xdd2b10){return request(_0xf7d1('0x1f'),{'options':{'raw':![],'where':{'id':_0xdd2b10},'include':[{'model':_0xf7d1('0x20'),'as':_0xf7d1('0x21')}]}});};exports[_0xf7d1('0x22')]=function(_0x30419d){return request(_0xf7d1('0x23'),{'options':{'where':{'id':_0x30419d},'attributes':['id','name']}});};exports[_0xf7d1('0x24')]=function(_0x5b5848){return request(_0xf7d1('0x25'),{'body':_0x5b5848});};exports[_0xf7d1('0x26')]=function(_0x499980){return request('CreateSquareDetailsReport',{'body':_0x499980});};exports[_0xf7d1('0x27')]=function(_0x38ecf2){return request(_0xf7d1('0x28'),{'body':_[_0xf7d1('0x29')](_0x38ecf2,{'project_name':_0x38ecf2[_0xf7d1('0x2a')],'prev_project_name':_0x38ecf2[_0xf7d1('0x2b')]||'','is_subproject':_0x38ecf2[_0xf7d1('0x2b')]?!![]:![],'leaveAt':moment()[_0xf7d1('0x2c')](_0xf7d1('0x2d'))})});};exports[_0xf7d1('0x2e')]=function(_0x2f90bc){return request(_0xf7d1('0x2f'),{'body':_0x2f90bc});};exports['createSquareMessage']=function(_0x313f61){return request(_0xf7d1('0x30'),{'body':_0x313f61});};exports[_0xf7d1('0x31')]=function(_0x692ca9){return request(_0xf7d1('0x32'),{'options':{'raw':![],'where':{'phone':_0x692ca9['phone'],'ListId':_0x692ca9['ListId']}}})['then'](function(_0x431827){if(_0x431827){return _0x431827;}return request(_0xf7d1('0x33'),{'body':_0x692ca9});});};exports['getPauseById']=function(_0x2dace7){return request('ShowPause',{'options':{'where':{'id':_0x2dace7},'attributes':[_0xf7d1('0xe')]}});};exports[_0xf7d1('0x34')]=function(_0x1d93b9,_0x54b3e1){return request(_0xf7d1('0x35'),{'body':{'interface':_0x54b3e1},'options':{'where':_0x1d93b9}});};exports['agentPause']=function(_0x4c6cc4,_0x109344,_0x5bdfeb){return request(_0xf7d1('0x36'),{'body':{'type':_0x109344,'uniqueid':_0x5bdfeb},'options':{'where':_0x4c6cc4}});};exports[_0xf7d1('0x37')]=function(_0xbf915a){return request(_0xf7d1('0x38'),{'body':{},'options':{'where':_0xbf915a}});};exports[_0xf7d1('0x39')]=function(_0x54d91e){return request(_0xf7d1('0x3a'),{'body':{},'options':{'where':_0x54d91e}});}; \ No newline at end of file +var _0x2c15=['error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','jayson/promise','client','http','request','then'];(function(_0x296754,_0x5befe9){var _0x1d9f1d=function(_0x3f033e){while(--_0x3f033e){_0x296754['push'](_0x296754['shift']());}};_0x1d9f1d(++_0x5befe9);}(_0x2c15,0x6e));var _0x52c1=function(_0x2e2ddf,_0x11a7f2){_0x2e2ddf=_0x2e2ddf-0x0;var _0x2bccf1=_0x2c15[_0x2e2ddf];return _0x2bccf1;};'use strict';var BPromise=require('bluebird');var moment=require(_0x52c1('0x0'));var _=require(_0x52c1('0x1'));var util=require(_0x52c1('0x2'));var jayson=require(_0x52c1('0x3'));var client=jayson[_0x52c1('0x4')][_0x52c1('0x5')]({'port':0x2329});function request(_0x2562fd,_0x388ed5){return new BPromise(function(_0x4a4537,_0x230cd5){return client[_0x52c1('0x6')](_0x2562fd,_0x388ed5)[_0x52c1('0x7')](function(_0x3ab776){if(_0x3ab776[_0x52c1('0x8')]){return _0x230cd5(_0x3ab776[_0x52c1('0x8')][_0x52c1('0x9')]);}else{return _0x4a4537(_0x3ab776[_0x52c1('0xa')]);}})[_0x52c1('0xb')](function(_0x473297){return _0x230cd5(_0x473297);});});}exports[_0x52c1('0xc')]=function(_0x4935e8){return request(_0x52c1('0xd'),{'options':{'raw':![],'where':{'name':_0x4935e8},'attributes':[_0x52c1('0xe')]}});};exports[_0x52c1('0xf')]=function(_0x3d2109){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3d2109},'include':[{'model':_0x52c1('0x10'),'as':_0x52c1('0x11')}],'attributes':['id',_0x52c1('0x12'),_0x52c1('0x13')]}});};exports['getSquareProjectById']=function(_0x231d58){return request(_0x52c1('0xd'),{'options':{'where':{'id':_0x231d58},'attributes':[_0x52c1('0x12')]}});};exports[_0x52c1('0x14')]=function(_0x12a41b){return request(_0x52c1('0x15'),{'options':{'where':{'id':_0x12a41b},'attributes':[_0x52c1('0x12')]}});};exports[_0x52c1('0x16')]=function(_0x1fb667){return request('ShowVariable',{'options':{'where':{'id':_0x1fb667},'attributes':[_0x52c1('0x12')]}});};exports[_0x52c1('0x17')]=function(_0x1bc77f){return request(_0x52c1('0x18'),{'options':{'where':{'id':_0x1bc77f},'attributes':[_0x52c1('0x19')]}});};exports[_0x52c1('0x1a')]=function(_0x1bd9ca){return request(_0x52c1('0x1b'),{'options':{'where':{'id':_0x1bd9ca},'attributes':[_0x52c1('0x12')]}});};exports[_0x52c1('0x1c')]=function(_0x1aad5e){return request('ShowTrunk',{'options':{'where':{'id':_0x1aad5e},'attributes':[_0x52c1('0x12')]}});};exports[_0x52c1('0x1d')]=function(_0x388bc9){return request(_0x52c1('0x1e'),{'options':{'where':{'id':_0x388bc9},'attributes':[_0x52c1('0x1f')]}});};exports[_0x52c1('0x20')]=function(_0x2d5524){return request(_0x52c1('0x21'),{'options':{'raw':![],'where':{'id':_0x2d5524},'include':[{'model':_0x52c1('0x22'),'as':_0x52c1('0x23')}]}});};exports['getSmsAccountById']=function(_0x1af4ea){return request(_0x52c1('0x24'),{'options':{'where':{'id':_0x1af4ea},'attributes':['id',_0x52c1('0x12')]}});};exports[_0x52c1('0x25')]=function(_0x1b2840){return request('CreateSmsMessage',{'body':_0x1b2840});};exports[_0x52c1('0x26')]=function(_0x387550){return request('CreateSquareDetailsReport',{'body':_0x387550});};exports[_0x52c1('0x27')]=function(_0x34b385){return request(_0x52c1('0x28'),{'body':_[_0x52c1('0x29')](_0x34b385,{'project_name':_0x34b385['arg_1'],'prev_project_name':_0x34b385['arg_2']||'','is_subproject':_0x34b385[_0x52c1('0x2a')]?!![]:![],'leaveAt':moment()[_0x52c1('0x2b')](_0x52c1('0x2c'))})});};exports[_0x52c1('0x2d')]=function(_0x413df9){return request(_0x52c1('0x2e'),{'body':_0x413df9});};exports[_0x52c1('0x2f')]=function(_0x241e32){return request(_0x52c1('0x30'),{'body':_0x241e32});};exports[_0x52c1('0x31')]=function(_0x485ab7){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x485ab7['phone'],'ListId':_0x485ab7['ListId']}}})[_0x52c1('0x7')](function(_0x44bf23){if(_0x44bf23){return _0x44bf23;}return request('CreateCmContact',{'body':_0x485ab7});});};exports['getPauseById']=function(_0x3d1aed){return request(_0x52c1('0x32'),{'options':{'where':{'id':_0x3d1aed},'attributes':[_0x52c1('0x12')]}});};exports[_0x52c1('0x33')]=function(_0x145fca,_0x1cd33a){return request(_0x52c1('0x34'),{'body':{'interface':_0x1cd33a},'options':{'where':_0x145fca}});};exports[_0x52c1('0x35')]=function(_0x14190c,_0x398c93,_0x389ea4){return request(_0x52c1('0x36'),{'body':{'type':_0x398c93,'uniqueid':_0x389ea4},'options':{'where':_0x14190c}});};exports[_0x52c1('0x37')]=function(_0x374be4){return request(_0x52c1('0x38'),{'body':{},'options':{'where':_0x374be4}});};exports[_0x52c1('0x39')]=function(_0x190b26){return request(_0x52c1('0x3a'),{'body':{},'options':{'where':_0x190b26}});}; \ 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 37e6ae8..c2ecd7a 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 _0xcb99=['exports','./polly'];(function(_0x1fdaff,_0x13e5bb){var _0x20cf91=function(_0xbb93b9){while(--_0xbb93b9){_0x1fdaff['push'](_0x1fdaff['shift']());}};_0x20cf91(++_0x13e5bb);}(_0xcb99,0x8b));var _0x9cb9=function(_0x36a073,_0x2ce3ce){_0x36a073=_0x36a073-0x0;var _0xc9762b=_0xcb99[_0x36a073];return _0xc9762b;};var polly=require(_0x9cb9('0x0'));var lex=require('./lex');module[_0x9cb9('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xedd9=['./lex','exports'];(function(_0xa2d42e,_0x174142){var _0x5a3cc7=function(_0x4ad8e7){while(--_0x4ad8e7){_0xa2d42e['push'](_0xa2d42e['shift']());}};_0x5a3cc7(++_0x174142);}(_0xedd9,0xfc));var _0x9edd=function(_0xb53f83,_0x39d004){_0xb53f83=_0xb53f83-0x0;var _0x52cf5=_0xedd9[_0xb53f83];return _0x52cf5;};var polly=require('./polly');var lex=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 9d51372..19249a0 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8eeb=['./lib/api'];(function(_0x202cf2,_0x175408){var _0x4c9388=function(_0x2dd09e){while(--_0x2dd09e){_0x202cf2['push'](_0x202cf2['shift']());}};_0x4c9388(++_0x175408);}(_0x8eeb,0x183));var _0xb8ee=function(_0x498411,_0x29bae3){_0x498411=_0x498411-0x0;var _0x4a9f68=_0x8eeb[_0x498411];return _0x4a9f68;};'use strict';var lex=require(_0xb8ee('0x0'));module['exports']=function(_0x464dec,_0x2b3ac1,_0x4cb601,_0x29c63e,_0x2ca97d,_0x42df81){return lex(_0x464dec,_0x2b3ac1,_0x4cb601,_0x29c63e,_0x2ca97d,_0x42df81);}; \ No newline at end of file +var _0x32ef=['exports','./lib/api'];(function(_0x488b52,_0x1d0575){var _0x48acb9=function(_0x4069e5){while(--_0x4069e5){_0x488b52['push'](_0x488b52['shift']());}};_0x48acb9(++_0x1d0575);}(_0x32ef,0xf9));var _0xf32e=function(_0x47381a,_0xd1e1f9){_0x47381a=_0x47381a-0x0;var _0x416b80=_0x32ef[_0x47381a];return _0x416b80;};'use strict';var lex=require(_0xf32e('0x0'));module[_0xf32e('0x1')]=function(_0x1ec4de,_0x2aaadd,_0x286041,_0x82113b,_0x5da060,_0x232ead){return lex(_0x1ec4de,_0x2aaadd,_0x286041,_0x82113b,_0x5da060,_0x232ead);}; \ 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 24d6a00..efff01e 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 _0x084b=['exports','LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x45513e,_0x433f83){var _0x59331f=function(_0x3d2c8c){while(--_0x3d2c8c){_0x45513e['push'](_0x45513e['shift']());}};_0x59331f(++_0x433f83);}(_0x084b,0x7a));var _0xb084=function(_0x570878,_0x4fc7de){_0x570878=_0x570878-0x0;var _0x43397a=_0x084b[_0x570878];return _0x43397a;};'use strict';var BPromise=require(_0xb084('0x0'));var AWS=require(_0xb084('0x1'));function lexResult(_0x46a9e7,_0x522ed8){return new BPromise(function(_0x20472d,_0x2a0eb9){_0x46a9e7['postText'](_0x522ed8,function(_0xd67cfe,_0x105298){if(_0xd67cfe){_0x2a0eb9(_0xd67cfe);}if(_0x105298[_0xb084('0x2')]){for(const _0x306dc2 in _0x105298['slots']){if(_0x105298['slots'][_0xb084('0x3')](_0x306dc2)){var _0x26bbb1=_0x105298[_0xb084('0x2')][_0x306dc2];_0x105298['slot_'+_0x306dc2]=_0x26bbb1;}}}_0x20472d(_0x105298);});});}module[_0xb084('0x4')]=function(_0x5e61db,_0x34ab47,_0x387c72,_0x4c664e,_0x2e763d,_0x3e8630){var _0x459de6=new AWS[(_0xb084('0x5'))]({'accessKeyId':_0x34ab47,'secretAccessKey':_0x387c72,'region':_0x4c664e});var _0x293799={'botAlias':'$LATEST','botName':_0x3e8630,'inputText':_0x2e763d,'userId':_0x5e61db};return lexResult(_0x459de6,_0x293799);}; \ No newline at end of file +var _0x0228=['LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots','hasOwnProperty','slot_'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x0228,0xf2));var _0x8022=function(_0x32062c,_0x43ee1f){_0x32062c=_0x32062c-0x0;var _0xa8ccf1=_0x0228[_0x32062c];return _0xa8ccf1;};'use strict';var BPromise=require(_0x8022('0x0'));var AWS=require(_0x8022('0x1'));function lexResult(_0x149a05,_0x4dc5af){return new BPromise(function(_0x45e3f9,_0x39572c){_0x149a05[_0x8022('0x2')](_0x4dc5af,function(_0x4a0a32,_0x14c120){if(_0x4a0a32){_0x39572c(_0x4a0a32);}if(_0x14c120[_0x8022('0x3')]){for(const _0x4959f7 in _0x14c120[_0x8022('0x3')]){if(_0x14c120[_0x8022('0x3')][_0x8022('0x4')](_0x4959f7)){var _0x15008d=_0x14c120[_0x8022('0x3')][_0x4959f7];_0x14c120[_0x8022('0x5')+_0x4959f7]=_0x15008d;}}}_0x45e3f9(_0x14c120);});});}module['exports']=function(_0x399ceb,_0x2b9f9b,_0x372b2f,_0x5498af,_0x259080,_0x434762){var _0x5970fe=new AWS[(_0x8022('0x6'))]({'accessKeyId':_0x2b9f9b,'secretAccessKey':_0x372b2f,'region':_0x5498af});var _0x43eac3={'botAlias':_0x8022('0x7'),'botName':_0x434762,'inputText':_0x259080,'userId':_0x399ceb};return lexResult(_0x5970fe,_0x43eac3);}; \ 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 2a18762..94e561e 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 _0xa092=['./lib/api','exports'];(function(_0x4d3835,_0x4f5f50){var _0x823439=function(_0x25a5c6){while(--_0x25a5c6){_0x4d3835['push'](_0x4d3835['shift']());}};_0x823439(++_0x4f5f50);}(_0xa092,0xbe));var _0x2a09=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xa092[_0x35885a];return _0xe86249;};'use strict';var polly=require(_0x2a09('0x0'));module[_0x2a09('0x1')]=function(_0x550da2,_0xcea217,_0x3e9ad4,_0x4c61d8,_0x5db3bf,_0x546fe7,_0x54f2f5){return polly(_0x550da2,_0xcea217,_0x3e9ad4,_0x4c61d8,_0x5db3bf,_0x546fe7,_0x54f2f5);}; \ No newline at end of file +var _0x865b=['./lib/api'];(function(_0x587f88,_0x299a03){var _0x306efa=function(_0x20f319){while(--_0x20f319){_0x587f88['push'](_0x587f88['shift']());}};_0x306efa(++_0x299a03);}(_0x865b,0xae));var _0xb865=function(_0x12feee,_0x59315d){_0x12feee=_0x12feee-0x0;var _0x3ad092=_0x865b[_0x12feee];return _0x3ad092;};'use strict';var polly=require(_0xb865('0x0'));module['exports']=function(_0x52ee21,_0x55b855,_0x3ec3bd,_0x37fc85,_0x378d1a,_0x490c99,_0xc12220){return polly(_0x52ee21,_0x55b855,_0x3ec3bd,_0x37fc85,_0x378d1a,_0x490c99,_0xc12220);}; \ 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 09ec76b..a1afcc3 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 _0xb7d9=['exports','Polly','text','mp3','bluebird','randomstring','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x32cce8,_0x18762f){var _0x4a732b=function(_0x5a3a21){while(--_0x5a3a21){_0x32cce8['push'](_0x32cce8['shift']());}};_0x4a732b(++_0x18762f);}(_0xb7d9,0xd5));var _0x9b7d=function(_0x26236f,_0x36916c){_0x26236f=_0x26236f-0x0;var _0x11c59f=_0xb7d9[_0x26236f];return _0x11c59f;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x9b7d('0x0'));var rs=require(_0x9b7d('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x5160f1,_0x3053f8,_0x4a9931){return new BPromise(function(_0x594a78,_0x545888){_0x5160f1[_0x9b7d('0x2')](_0x3053f8,function(_0x106750,_0x4a54ad){if(_0x106750){_0x545888(_0x106750);}else if(_0x4a54ad){if(_0x4a54ad['AudioStream']instanceof Buffer){fs[_0x9b7d('0x3')](_0x4a9931,_0x4a54ad[_0x9b7d('0x4')],function(_0x3a5a03){if(_0x3a5a03){_0x545888(_0x3a5a03);}else{_0x594a78();}});}else{_0x545888(new Error(_0x9b7d('0x5')));}}else{_0x545888(new Error(_0x9b7d('0x6')));}});});}module[_0x9b7d('0x7')]=function(_0xf3a8fc,_0x1e769b,_0x4110e4,_0x2b03c6,_0x13ca00,_0x2423b2,_0x74eca3){var _0xf2a9e7=new AWS[(_0x9b7d('0x8'))]({'accessKeyId':_0xf3a8fc,'secretAccessKey':_0x1e769b,'region':_0x4110e4});var _0x137174={'Text':_0x13ca00,'TextType':_0x2423b2||_0x9b7d('0x9'),'OutputFormat':_0x9b7d('0xa'),'VoiceId':_0x2b03c6};return pollyResult(_0xf2a9e7,_0x137174,_0x74eca3);}; \ No newline at end of file +var _0x982e=['aws-sdk','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','randomstring'];(function(_0x211bc3,_0x5860c8){var _0x34c9a2=function(_0x4bfa37){while(--_0x4bfa37){_0x211bc3['push'](_0x211bc3['shift']());}};_0x34c9a2(++_0x5860c8);}(_0x982e,0x197));var _0xe982=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x982e[_0x321bb2];return _0x9c12ed;};'use strict';var fs=require('fs');var path=require(_0xe982('0x0'));var BPromise=require(_0xe982('0x1'));var rs=require(_0xe982('0x2'));var AWS=require(_0xe982('0x3'));function pollyResult(_0x4abafc,_0x5dc795,_0x1de930){return new BPromise(function(_0x5e6838,_0x5cca1a){_0x4abafc['synthesizeSpeech'](_0x5dc795,function(_0x3bee30,_0x2159cc){if(_0x3bee30){_0x5cca1a(_0x3bee30);}else if(_0x2159cc){if(_0x2159cc['AudioStream']instanceof Buffer){fs[_0xe982('0x4')](_0x1de930,_0x2159cc[_0xe982('0x5')],function(_0x55705e){if(_0x55705e){_0x5cca1a(_0x55705e);}else{_0x5e6838();}});}else{_0x5cca1a(new Error(_0xe982('0x6')));}}else{_0x5cca1a(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xe982('0x7')]=function(_0x423b5b,_0x16be39,_0x57f885,_0x3ed60f,_0x26af1e,_0xde58c4,_0x52e405){var _0x10070a=new AWS['Polly']({'accessKeyId':_0x423b5b,'secretAccessKey':_0x16be39,'region':_0x57f885});var _0xa280b={'Text':_0x26af1e,'TextType':_0xde58c4||_0xe982('0x8'),'OutputFormat':_0xe982('0x9'),'VoiceId':_0x3ed60f};return pollyResult(_0x10070a,_0xa280b,_0x52e405);}; \ 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 d08e8a0..6adbb55 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 _0x61ee=['./lib/api','exports'];(function(_0x5514eb,_0x49abef){var _0x44b07d=function(_0x4a57cf){while(--_0x4a57cf){_0x5514eb['push'](_0x5514eb['shift']());}};_0x44b07d(++_0x49abef);}(_0x61ee,0x1ac));var _0xe61e=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x61ee[_0x59ae8f];return _0x3900b5;};'use strict';var asr=require(_0xe61e('0x0'));module[_0xe61e('0x1')]=function(_0x5c030c,_0x383898,_0x58768d,_0x126e67){return asr(_0x5c030c,_0x383898,_0x58768d);}; \ No newline at end of file +var _0xf09e=['exports','./lib/api'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xf09e,0x8b));var _0xef09=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf09e[_0x2be8c2];return _0x97f531;};'use strict';var asr=require(_0xef09('0x0'));module[_0xef09('0x1')]=function(_0x3425b2,_0x3464b3,_0x134aeb,_0x116e74){return asr(_0x3425b2,_0x3464b3,_0x134aeb);}; \ 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 a9ed9e2..c56b167 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 _0xa609=['readFileSync','toString','base64','POST','8000','bluebird','string','length','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0xa609,0x7d));var _0x9a60=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa609[_0x502c7d];return _0x30b7ed;};'use strict';var url=require('url');var BPromise=require(_0x9a60('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x3c9d1a,_0x35cd5e,_0x5dedd0){return new BPromise(function(_0x466d4a,_0x167441){var _0x4b7f2d;if(typeof _0x3c9d1a!==_0x9a60('0x1')||_0x3c9d1a[_0x9a60('0x2')]===0x0){return _0x167441('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x35cd5e!==_0x9a60('0x1')||_0x35cd5e['length']===0x0){return _0x167441('key\x20should\x20be\x20a\x20string');}if(typeof _0x5dedd0!==_0x9a60('0x3')&&(typeof _0x5dedd0!==_0x9a60('0x1')||_0x5dedd0[_0x9a60('0x2')]===0x0)){return _0x167441(_0x9a60('0x4'));}try{_0x4b7f2d=fs[_0x9a60('0x5')](_0x3c9d1a)[_0x9a60('0x6')](_0x9a60('0x7'));}catch(_0x54bc3b){return _0x167441(_0x54bc3b);}return _0x466d4a({'method':_0x9a60('0x8'),'uri':host+'/v1/speech:recognize?key='+_0x35cd5e,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x9a60('0x9'),'languageCode':_0x5dedd0},'audio':{'content':_0x4b7f2d}},'json':!![]});});}; \ No newline at end of file +var _0x85f2=['length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','base64','POST','/v1/speech:recognize?key=','url','bluebird','https://speech.googleapis.com','exports','string'];(function(_0x450311,_0x525cc3){var _0x3921e4=function(_0x521cb8){while(--_0x521cb8){_0x450311['push'](_0x450311['shift']());}};_0x3921e4(++_0x525cc3);}(_0x85f2,0x11b));var _0x285f=function(_0x2a18b7,_0x5041c8){_0x2a18b7=_0x2a18b7-0x0;var _0x45e74e=_0x85f2[_0x2a18b7];return _0x45e74e;};'use strict';var url=require(_0x285f('0x0'));var BPromise=require(_0x285f('0x1'));var fs=require('fs');var host=_0x285f('0x2');module[_0x285f('0x3')]=function(_0x2739dc,_0x30f6c1,_0x546dd3){return new BPromise(function(_0x311f69,_0x4fc976){var _0x492ea6;if(typeof _0x2739dc!==_0x285f('0x4')||_0x2739dc[_0x285f('0x5')]===0x0){return _0x4fc976('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x30f6c1!=='string'||_0x30f6c1[_0x285f('0x5')]===0x0){return _0x4fc976(_0x285f('0x6'));}if(typeof _0x546dd3!==_0x285f('0x7')&&(typeof _0x546dd3!==_0x285f('0x4')||_0x546dd3[_0x285f('0x5')]===0x0)){return _0x4fc976(_0x285f('0x8'));}try{_0x492ea6=fs['readFileSync'](_0x2739dc)['toString'](_0x285f('0x9'));}catch(_0x38eeec){return _0x4fc976(_0x38eeec);}return _0x311f69({'method':_0x285f('0xa'),'uri':host+_0x285f('0xb')+_0x30f6c1,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x546dd3},'audio':{'content':_0x492ea6}},'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 c8cb640..4f4fa2d 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 _0xeb3b=['./asr','exports'];(function(_0x47a73a,_0x47c476){var _0x493c3f=function(_0x2cec8e){while(--_0x2cec8e){_0x47a73a['push'](_0x47a73a['shift']());}};_0x493c3f(++_0x47c476);}(_0xeb3b,0x19e));var _0xbeb3=function(_0xb4e2df,_0x1cbb7c){_0xb4e2df=_0xb4e2df-0x0;var _0x5e95ba=_0xeb3b[_0xb4e2df];return _0x5e95ba;};var asr=require(_0xbeb3('0x0'));module[_0xbeb3('0x1')]={'asr':asr}; \ No newline at end of file +var _0x742b=['./asr','exports'];(function(_0x5bed5e,_0x27d338){var _0x8020e7=function(_0x57fc8c){while(--_0x57fc8c){_0x5bed5e['push'](_0x5bed5e['shift']());}};_0x8020e7(++_0x27d338);}(_0x742b,0xb4));var _0xb742=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x742b[_0x13d07a];return _0x5ee0ee;};var asr=require(_0xb742('0x0'));module[_0xb742('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 bdce46c..7a81e51 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 _0x29d7=['metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','awsPolly','polly','awsLex','lex','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','md5','querystring','request-promise','randomstring','sox','google-tts-api','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','path','WHAT_EVER','get','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','finish','info','finish\x20download\x20file','close','error','unlink','pipe','end','protocol','request\x20to\x20','data','transcode','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','then','chmodSync','777','split','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','MP3','POST','resolve','from','audioContent','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','en-US','null','generic','slice','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','uri','map','alternatives','transcript','join','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','speech','score','status'];(function(_0x57ae34,_0x1e8647){var _0x55b4b1=function(_0x4e8e53){while(--_0x4e8e53){_0x57ae34['push'](_0x57ae34['shift']());}};_0x55b4b1(++_0x1e8647);}(_0x29d7,0x1c9));var _0x729d=function(_0x35b793,_0x36e20d){_0x35b793=_0x35b793-0x0;var _0x402572=_0x29d7[_0x35b793];return _0x402572;};'use strict';var apiai=require(_0x729d('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x729d('0x1'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x729d('0x2'));var path=require('path');var querystring=require(_0x729d('0x3'));var rp=require(_0x729d('0x4'));var rs=require(_0x729d('0x5'));var sox=require(_0x729d('0x6'));var tts=require(_0x729d('0x7'));var urlParse=require('url')['parse'];var util=require(_0x729d('0x8'));var aws=require(_0x729d('0x9'));var google=require(_0x729d('0xa'));var sestek=require(_0x729d('0xb'));var tilde=require(_0x729d('0xc'));var logger=require(_0x729d('0xd'))(_0x729d('0xe'));var ISPEECH_API=_0x729d('0xf');function downloadFile(_0x424d54,_0x4b65b6){return new BPromise(function(_0x112fd4,_0xe6e2dc){var _0x59c441=urlParse(_0x424d54);var _0x520272=_0x59c441['protocol']===_0x729d('0x10')?https:http;var _0x3fa53c={'host':_0x59c441['host'],'path':_0x59c441[_0x729d('0x11')],'headers':{'user-agent':_0x729d('0x12')}};_0x520272[_0x729d('0x13')](_0x3fa53c,function(_0x2e8ef4){if(_0x2e8ef4[_0x729d('0x14')]!==0xc8){logger['error']('request\x20to\x20'+_0x424d54+'\x20failed,\x20status\x20code\x20=\x20'+_0x2e8ef4[_0x729d('0x14')]+'\x20('+_0x2e8ef4[_0x729d('0x15')]+')');_0xe6e2dc(new Error('request\x20to\x20'+_0x424d54+_0x729d('0x16')+_0x2e8ef4['statusCode']+'\x20('+_0x2e8ef4['statusMessage']+')'));return;}var _0xe64479=fs['createWriteStream'](_0x4b65b6);_0xe64479['on'](_0x729d('0x17'),function(){logger[_0x729d('0x18')](_0x729d('0x19'));_0xe64479[_0x729d('0x1a')](_0x112fd4);});_0xe64479['on'](_0x729d('0x1b'),function(_0x56250e){fs[_0x729d('0x1c')](_0x4b65b6);logger['error']('download\x20error',_0x56250e);_0xe6e2dc(_0x56250e);});_0x2e8ef4[_0x729d('0x1d')](_0xe64479);})['on'](_0x729d('0x1b'),function(_0x14a4a3){logger[_0x729d('0x1b')](_0x14a4a3);_0xe6e2dc(_0x14a4a3);})[_0x729d('0x1e')]();});}function uploadFile(_0x1f848a){return new BPromise(function(_0x4fead7,_0x1a3d9a){var _0x2f79c7=urlParse(_0x1f848a);var _0x2550c3=_0x2f79c7[_0x729d('0x1f')]===_0x729d('0x10')?https:http;var _0x410032={'host':_0x2f79c7['host'],'path':_0x2f79c7[_0x729d('0x11')],'headers':{'user-agent':_0x729d('0x12')}};_0x2550c3['get'](_0x410032,function(_0x282cd6){if(_0x282cd6[_0x729d('0x14')]!==0xc8){_0x1a3d9a(new Error(_0x729d('0x20')+_0x1f848a+_0x729d('0x16')+_0x282cd6['statusCode']+'\x20('+_0x282cd6['statusMessage']+')'));return;}var _0x442f67='';_0x282cd6['on'](_0x729d('0x21'),function(_0x33cf22){_0x442f67+=_0x33cf22;});_0x282cd6['on']('end',function(){_0x4fead7(_0x442f67);});})['on'](_0x729d('0x1b'),function(_0x15035c){_0x1a3d9a(_0x15035c);})[_0x729d('0x1e')]();});}function convertFile(_0x51b399,_0x2cd0e3){return new BPromise(function(_0x1c6e40,_0x5d97db){var _0x53277a=sox[_0x729d('0x22')](_0x51b399,_0x2cd0e3,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x53277a['on'](_0x729d('0x1b'),function(_0x5d3192){logger[_0x729d('0x1b')](_0x729d('0x23'),_0x5d3192);_0x5d97db(_0x5d3192);});_0x53277a['on']('end',function(){logger[_0x729d('0x18')](_0x729d('0x24'));_0x1c6e40();});_0x53277a[_0x729d('0x25')]();});}function base64Decode(_0x489335,_0x28b19b){var _0x52bdff=path['resolve'](__dirname,_0x729d('0x26'),rs[_0x729d('0x27')](0x4)+_0x729d('0x28'));fs[_0x729d('0x29')](_0x52bdff,_0x489335,'base64');return convertFile(_0x52bdff,_0x28b19b)[_0x729d('0x2a')](function(){try{fs[_0x729d('0x1c')](_0x52bdff);fs[_0x729d('0x2b')](_0x28b19b,_0x729d('0x2c'));}catch(_0x3c1c9d){logger[_0x729d('0x1b')](_0x3c1c9d);}return _0x28b19b[_0x729d('0x2d')]('.')[0x0];});}function base64Encode(_0xf07f12){var _0x47cf9b=fs['readFileSync'](_0xf07f12);return new Buffer(_0x47cf9b)['toString'](_0x729d('0x2e'));}exports[_0x729d('0x2f')]=function(_0xaad33b,_0x4177cf,_0x248efa,_0x2f64b5,_0x376d91,_0x2d3efd){var _0xdd463c,_0x54008f;var _0x44ba89=_0x729d('0x30');var _0x5b1d67=_0x729d('0x31')+_0xaad33b;var _0x17b70f={};if(_0x4177cf==='ssml'){_0x17b70f[_0x729d('0x32')]={'ssml':_0x248efa};}else{_0x17b70f[_0x729d('0x32')]={'text':_0x248efa};};_0x17b70f[_0x729d('0x33')]={'languageCode':_0x2f64b5,'ssmlGender':_0x376d91};_0x17b70f['audioConfig']={'audioEncoding':_0x729d('0x34'),'sampleRateHertz':0x1f40};var _0xa1eed1={'url':_0x44ba89+'text:synthesize'+_0x5b1d67,'method':_0x729d('0x35'),'json':!![],'body':_0x17b70f};return rp(_0xa1eed1)[_0x729d('0x2a')](function(_0x315676){return new BPromise(function(_0x4307c9,_0x1672f5){_0xdd463c=path[_0x729d('0x36')](__dirname,'tmp',rs[_0x729d('0x27')](0x4)+'.mp3');var _0x24ed98=Buffer[_0x729d('0x37')](_0x315676[_0x729d('0x38')],_0x729d('0x2e'));return fs[_0x729d('0x39')](_0xdd463c,_0x24ed98,function(_0x2a2df8){_0x1672f5(_0x2a2df8);},function(_0x2a081d){fs['chmodSync'](_0xdd463c,'777');_0x4307c9(_0x2a081d);});});})[_0x729d('0x2a')](function(_0x38f4dd){_0x54008f=path[_0x729d('0x36')](__dirname,_0x729d('0x26'),rs['generate'](0x4)+_0x729d('0x28'));return convertFile(_0xdd463c,_0x54008f);})[_0x729d('0x2a')](function(){try{fs[_0x729d('0x1c')](_0xdd463c);fs[_0x729d('0x2b')](_0x54008f,_0x729d('0x2c'));}catch(_0x9e0490){logger[_0x729d('0x1b')](_0x9e0490);}logger[_0x729d('0x18')](_0x729d('0x3a'),_0x54008f[_0x729d('0x2d')]('.')[0x0]);return _0x54008f['split']('.')[0x0];});};exports['googleTTS']=function(_0x5226bb,_0x3703c8){var _0x3b030c=_0x729d('0x3b');var _0x3f8d54,_0x38988a;var _0x350241;var _0x2d7c9b={'encoding':_0x729d('0x3c'),'method':_0x729d('0x35'),'timeout':0x2710,'url':_0x3b030c,'headers':{'Content-Type':_0x729d('0x3d')},'body':_0x729d('0x3e')+encodeURIComponent(JSON[_0x729d('0x3f')]([[['jQ1olc',JSON['stringify']([_0x5226bb,_0x3703c8||_0x729d('0x40'),![],_0x729d('0x41')]),null,_0x729d('0x42')]]]))};return rp(_0x2d7c9b)['then'](function(_0x499aa3){try{_0x350241=eval(_0x499aa3[_0x729d('0x43')](0x5))[0x0][0x2];}catch(_0x37bf39){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}if(!_0x350241){throw new Error(_0x729d('0x44')+lang+_0x729d('0x45'));}try{_0x350241=eval(_0x350241)[0x0];}catch(_0x219899){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x729d('0x21')]);}const _0x3a9acc=_0x350241;_0x3f8d54=path[_0x729d('0x36')](__dirname,_0x729d('0x26'),rs['generate'](0x4)+_0x729d('0x46'));fs[_0x729d('0x29')](_0x3f8d54,_0x350241,{'encoding':_0x729d('0x2e')});_0x38988a=path['resolve'](__dirname,'tmp',rs[_0x729d('0x27')](0x4)+_0x729d('0x28'));return convertFile(_0x3f8d54,_0x38988a);})['then'](function(){try{fs[_0x729d('0x1c')](_0x3f8d54);fs['chmodSync'](_0x38988a,_0x729d('0x2c'));}catch(_0x1457f7){logger[_0x729d('0x1b')](_0x1457f7);}logger[_0x729d('0x18')](_0x729d('0x47'),_0x38988a['split']('.')[0x0]);return _0x38988a['split']('.')[0x0];});};exports[_0x729d('0x48')]=function(_0x4ccf81,_0x5bbf63,_0x2b1b13){return google['asr'](_0x4ccf81,_0x5bbf63,_0x2b1b13)['then'](function(_0x279edf){logger['info'](_0x279edf[_0x729d('0x49')]);return rp(_0x279edf);})[_0x729d('0x2a')](function(_0x33f5b2){var _0x54c6c5='';var _0x2cc1a8=0x0;try{fs[_0x729d('0x1c')](_0x4ccf81);}catch(_0x14f3b2){logger[_0x729d('0x1b')](_0x14f3b2);}if(_0x33f5b2&&_0x33f5b2['results']){_0x54c6c5=_0x33f5b2['results'][_0x729d('0x4a')](function(_0x202cfe){return _0x202cfe&&_0x202cfe[_0x729d('0x4b')][0x0]&&_0x202cfe['alternatives'][0x0][_0x729d('0x4c')]?_0x202cfe[_0x729d('0x4b')][0x0][_0x729d('0x4c')]:'';})[_0x729d('0x4d')]('\x0a');_0x2cc1a8=_0x33f5b2['results']['map'](function(_0x276fc7){return _0x276fc7&&_0x276fc7[_0x729d('0x4b')][0x0]&&_0x276fc7[_0x729d('0x4b')][0x0]['confidence']?_0x276fc7[_0x729d('0x4b')][0x0]['confidence']:0x0;})[_0x729d('0x4d')]('\x0a');}logger[_0x729d('0x18')](_0x729d('0x4e'),_0x54c6c5);logger['info'](_0x729d('0x4f'),_0x2cc1a8);return{'transcript':_0x54c6c5,'confidence':_0x2cc1a8};})['catch'](function(_0x3bbb71){logger[_0x729d('0x1b')](_0x729d('0x50'),_0x3bbb71[_0x729d('0x14')],_0x3bbb71['name'],_0x3bbb71[_0x729d('0x51')]);});};exports[_0x729d('0x52')]=function(_0x3a961c,_0x3f2ea9,_0x4c8d31,_0xf28294){var _0x408d28=apiai(_0x3f2ea9,{'language':_0xf28294||'en'});return _0x408d28[_0x729d('0x53')](_0x4c8d31,{'sessionId':md5(_0x3a961c)})[_0x729d('0x2a')](function(_0x19a367){logger['info'](JSON['stringify'](_0x19a367));return{'source':_0x19a367[_0x729d('0x54')][_0x729d('0x55')],'resolvedQuery':_0x19a367[_0x729d('0x54')][_0x729d('0x56')],'action':_0x19a367[_0x729d('0x54')]['action'],'actionIncomplete':_0x19a367[_0x729d('0x54')][_0x729d('0x57')],'speech':_0x19a367[_0x729d('0x54')]['fulfillment'][_0x729d('0x58')],'score':_0x19a367[_0x729d('0x54')][_0x729d('0x59')],'statusCode':_0x19a367[_0x729d('0x5a')]['code'],'endConversation':_0x19a367[_0x729d('0x54')][_0x729d('0x5b')][_0x729d('0x5c')]||![],'isFallbackIntent':_0x19a367[_0x729d('0x54')][_0x729d('0x5b')][_0x729d('0x5d')]};});};exports[_0x729d('0x5e')]=function(_0x4fda93,_0x3ebebd,_0x16adc6,_0x5249dc,_0x1ecd3c,_0xd94c5f){var _0x3383dd=_0x5249dc[_0x729d('0x5f')](/\\n/g,'\x0a');var _0x47a748={'credentials':{'private_key':_0x3383dd,'client_email':_0x16adc6}};var _0x2da01c=new dialogflow[(_0x729d('0x60'))](_0x47a748);var _0x37fa7f=_0x2da01c[_0x729d('0x61')](_0x3ebebd,md5(_0x4fda93));var _0x20c993={'session':_0x37fa7f,'queryInput':{'text':{'text':_0x1ecd3c,'languageCode':_0xd94c5f}}};return _0x2da01c['detectIntent'](_0x20c993)[_0x729d('0x2a')](function(_0x5e6d36){if(_0x5e6d36&&_0x5e6d36[_0x729d('0x62')]){logger[_0x729d('0x18')](_0x729d('0x63'),JSON[_0x729d('0x3f')](_0x5e6d36));var _0x18a045=_0x5e6d36[0x0];if(_0x18a045){var _0x37257a={'action':_0x18a045[_0x729d('0x64')]['action'],'allRequiredParamsPresent':_0x18a045['queryResult'][_0x729d('0x65')],'endConversation':_0x18a045[_0x729d('0x64')][_0x729d('0x66')]&&_0x18a045[_0x729d('0x64')][_0x729d('0x66')][_0x729d('0x67')]?_0x18a045['queryResult'][_0x729d('0x66')]['fields'][_0x729d('0x68')][_0x729d('0x69')]:![],'fulfillmentText':_0x18a045[_0x729d('0x64')][_0x729d('0x6a')],'intentName':_0x18a045[_0x729d('0x64')][_0x729d('0x6b')][_0x729d('0x6c')],'intentDisplayName':_0x18a045[_0x729d('0x64')][_0x729d('0x6b')]['displayName'],'isFallbackIntent':_0x18a045[_0x729d('0x64')][_0x729d('0x6b')][_0x729d('0x6d')],'languageCode':_0x18a045[_0x729d('0x64')][_0x729d('0x6e')],'queryText':_0x18a045['queryResult'][_0x729d('0x6f')],'responseId':_0x18a045[_0x729d('0x70')],'score':_0x18a045[_0x729d('0x64')][_0x729d('0x71')],'speech':_0x18a045[_0x729d('0x64')][_0x729d('0x6a')],'providerResponse':JSON[_0x729d('0x3f')](_0x5e6d36)};return _0x37257a;}}});};exports[_0x729d('0x72')]=function(_0x44220a,_0x54dda7,_0x44a757,_0x214d73){return tilde['asr'](_0x44220a,_0x54dda7,_0x44a757,_0x214d73)['then'](function(_0x226562){try{fs['unlink'](_0x44220a);}catch(_0x4d0561){logger[_0x729d('0x1b')](_0x4d0561);}logger[_0x729d('0x18')](_0x729d('0x73'),_0x226562[_0x729d('0x4c')]);logger[_0x729d('0x18')](_0x729d('0x74'),_0x226562[_0x729d('0x75')]);return _0x226562;});};exports[_0x729d('0x76')]=function(_0x4a33bf,_0x336120,_0x31c46d,_0x452018,_0x4de96b,_0x474762){var _0x16c338=path[_0x729d('0x36')](__dirname,_0x729d('0x26'),rs[_0x729d('0x27')](0x4)+_0x729d('0x46'));var _0x4f9070;return aws[_0x729d('0x77')](_0x4a33bf,_0x336120,_0x31c46d,_0x452018,_0x4de96b,_0x474762,_0x16c338)[_0x729d('0x2a')](function(){_0x4f9070=path[_0x729d('0x36')](__dirname,_0x729d('0x26'),rs[_0x729d('0x27')](0x4)+'.wav');return convertFile(_0x16c338,_0x4f9070);})['then'](function(){try{fs[_0x729d('0x1c')](_0x16c338);fs[_0x729d('0x2b')](_0x4f9070,_0x729d('0x2c'));}catch(_0x4d4428){logger[_0x729d('0x1b')](_0x4d4428);}return _0x4f9070[_0x729d('0x2d')]('.')[0x0];});};exports[_0x729d('0x78')]=function(_0x577dc1,_0x335c1a,_0x2264e5,_0x1e4030,_0x4105e8,_0x23d899){return aws[_0x729d('0x79')](_0x577dc1,_0x335c1a,_0x2264e5,_0x1e4030,_0x4105e8,_0x23d899)[_0x729d('0x2a')](function(_0x398c43){logger[_0x729d('0x18')](JSON['stringify'](_0x398c43));return _0x398c43;});};exports['ispeechTTS']=function(_0xa620dc,_0x26edb2,_0x3a7a1d,_0x2c7fef){var _0x5903a3=util[_0x729d('0x7a')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0xa620dc,encodeURIComponent(_0x26edb2),_0x3a7a1d,_0x2c7fef);var _0x324223=path[_0x729d('0x36')](__dirname,'tmp',rs[_0x729d('0x27')](0x4)+_0x729d('0x46'));var _0x944483;return downloadFile(_0x5903a3,_0x324223)['then'](function(){_0x944483=path['resolve'](__dirname,_0x729d('0x26'),rs['generate'](0x4)+_0x729d('0x28'));return convertFile(_0x324223,_0x944483);})[_0x729d('0x2a')](function(){try{fs[_0x729d('0x1c')](_0x324223);fs[_0x729d('0x2b')](_0x944483,_0x729d('0x2c'));}catch(_0x4f491f){logger['error'](_0x4f491f);}return _0x944483[_0x729d('0x2d')]('.')[0x0];});};exports[_0x729d('0x7b')]=function(_0x238425,_0x4447dc,_0x17717e,_0x77fa11){var _0x3085fd=util[_0x729d('0x7a')](_0x729d('0x7c'),ISPEECH_API,_0x4447dc,_0x17717e,base64Encode(_0x238425),_0x77fa11?util[_0x729d('0x7a')](_0x729d('0x7d'),encodeURIComponent(_0x77fa11)):'freeform=3');return uploadFile(_0x3085fd)['then'](function(_0xc3f982){return querystring[_0x729d('0x7e')](_0xc3f982);});};exports[_0x729d('0x7f')]=function(_0x4bf501,_0x3eacf3){return sestek[_0x729d('0x80')](_0x4bf501,_0x3eacf3)[_0x729d('0x2a')](function(_0x2957d9){logger[_0x729d('0x18')](JSON['stringify'](_0x2957d9));var _0x1409a2={'speech':_0x2957d9[_0x729d('0x81')],'action':_0x2957d9[_0x729d('0x82')]?_0x2957d9['channelData'][_0x729d('0x83')]:undefined,'actiondata':_0x2957d9[_0x729d('0x82')]?_0x2957d9[_0x729d('0x82')][_0x729d('0x84')]:undefined};if(_0x2957d9['channelData']&&_0x2957d9[_0x729d('0x82')][_0x729d('0x85')]){return base64Decode(_0x2957d9[_0x729d('0x82')][_0x729d('0x85')][_0x729d('0x86')],path[_0x729d('0x36')](__dirname,_0x729d('0x26'),rs[_0x729d('0x27')](0x4)+_0x729d('0x28')))[_0x729d('0x2a')](function(_0x56e8e5){_0x1409a2[_0x729d('0x87')]=_0x56e8e5;return _0x1409a2;});}return _0x1409a2;});};exports[_0x729d('0x88')]=function(){return __dirname;}; \ No newline at end of file +var _0x5b10=['parse\x20response\x20failed:\x0a','lang\x20\x22','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','actionIncomplete','speech','score','status','code','metadata','isFallbackIntent','replace','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','name','displayName','isFallback','languageCode','queryText','responseId','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','channelData','CustomAction','CustomActionData','Data','audiofile','apiai-promise','bluebird','dialogflow','http','querystring','request-promise','sox','url','util','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','pipe','https:','path','request\x20to\x20','data','end','transcode','wav','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','then','.mp3','from','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','jQ1olc','en-US','null','generic','slice'];(function(_0x46460e,_0x4a6c5e){var _0x4c36a3=function(_0x676dfe){while(--_0x676dfe){_0x46460e['push'](_0x46460e['shift']());}};_0x4c36a3(++_0x4a6c5e);}(_0x5b10,0x155));var _0x05b1=function(_0x140492,_0x1c9dbe){_0x140492=_0x140492-0x0;var _0x480a36=_0x5b10[_0x140492];return _0x480a36;};'use strict';var apiai=require(_0x05b1('0x0'));var BPromise=require(_0x05b1('0x1'));var dialogflow=require(_0x05b1('0x2'));var fs=require('fs');var http=require(_0x05b1('0x3'));var https=require('https');var md5=require('md5');var path=require('path');var querystring=require(_0x05b1('0x4'));var rp=require(_0x05b1('0x5'));var rs=require('randomstring');var sox=require(_0x05b1('0x6'));var tts=require('google-tts-api');var urlParse=require(_0x05b1('0x7'))['parse'];var util=require(_0x05b1('0x8'));var aws=require('./aws');var google=require(_0x05b1('0x9'));var sestek=require(_0x05b1('0xa'));var tilde=require(_0x05b1('0xb'));var logger=require(_0x05b1('0xc'))('agi');var ISPEECH_API=_0x05b1('0xd');function downloadFile(_0x454a62,_0x500f7d){return new BPromise(function(_0x53484a,_0x5aa025){var _0x46f689=urlParse(_0x454a62);var _0x435af0=_0x46f689[_0x05b1('0xe')]==='https:'?https:http;var _0x72b1e1={'host':_0x46f689[_0x05b1('0xf')],'path':_0x46f689['path'],'headers':{'user-agent':_0x05b1('0x10')}};_0x435af0[_0x05b1('0x11')](_0x72b1e1,function(_0x203055){if(_0x203055[_0x05b1('0x12')]!==0xc8){logger[_0x05b1('0x13')]('request\x20to\x20'+_0x454a62+'\x20failed,\x20status\x20code\x20=\x20'+_0x203055[_0x05b1('0x12')]+'\x20('+_0x203055['statusMessage']+')');_0x5aa025(new Error('request\x20to\x20'+_0x454a62+_0x05b1('0x14')+_0x203055[_0x05b1('0x12')]+'\x20('+_0x203055[_0x05b1('0x15')]+')'));return;}var _0x344ebf=fs[_0x05b1('0x16')](_0x500f7d);_0x344ebf['on'](_0x05b1('0x17'),function(){logger[_0x05b1('0x18')](_0x05b1('0x19'));_0x344ebf['close'](_0x53484a);});_0x344ebf['on'](_0x05b1('0x13'),function(_0x197458){fs[_0x05b1('0x1a')](_0x500f7d);logger[_0x05b1('0x13')]('download\x20error',_0x197458);_0x5aa025(_0x197458);});_0x203055[_0x05b1('0x1b')](_0x344ebf);})['on']('error',function(_0x4da891){logger[_0x05b1('0x13')](_0x4da891);_0x5aa025(_0x4da891);})['end']();});}function uploadFile(_0x3982bb){return new BPromise(function(_0x833f02,_0x1fbf3e){var _0x7d12ca=urlParse(_0x3982bb);var _0xffe600=_0x7d12ca[_0x05b1('0xe')]===_0x05b1('0x1c')?https:http;var _0xc5926c={'host':_0x7d12ca[_0x05b1('0xf')],'path':_0x7d12ca[_0x05b1('0x1d')],'headers':{'user-agent':_0x05b1('0x10')}};_0xffe600[_0x05b1('0x11')](_0xc5926c,function(_0x1e6ece){if(_0x1e6ece[_0x05b1('0x12')]!==0xc8){_0x1fbf3e(new Error(_0x05b1('0x1e')+_0x3982bb+_0x05b1('0x14')+_0x1e6ece[_0x05b1('0x12')]+'\x20('+_0x1e6ece['statusMessage']+')'));return;}var _0x44593c='';_0x1e6ece['on'](_0x05b1('0x1f'),function(_0x16a44f){_0x44593c+=_0x16a44f;});_0x1e6ece['on'](_0x05b1('0x20'),function(){_0x833f02(_0x44593c);});})['on'](_0x05b1('0x13'),function(_0x227815){_0x1fbf3e(_0x227815);})[_0x05b1('0x20')]();});}function convertFile(_0x35e874,_0xdeda63){return new BPromise(function(_0x4f3b0a,_0x4ae06a){var _0x499856=sox[_0x05b1('0x21')](_0x35e874,_0xdeda63,{'sampleRate':0x1f40,'format':_0x05b1('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x499856['on'](_0x05b1('0x13'),function(_0x2c36e8){logger['error']('error\x20convert',_0x2c36e8);_0x4ae06a(_0x2c36e8);});_0x499856['on'](_0x05b1('0x20'),function(){logger['info']('finish\x20to\x20convert');_0x4f3b0a();});_0x499856[_0x05b1('0x23')]();});}function base64Decode(_0xa26dbb,_0x39e89c){var _0x45a3fe=path[_0x05b1('0x24')](__dirname,_0x05b1('0x25'),rs[_0x05b1('0x26')](0x4)+_0x05b1('0x27'));fs[_0x05b1('0x28')](_0x45a3fe,_0xa26dbb,_0x05b1('0x29'));return convertFile(_0x45a3fe,_0x39e89c)['then'](function(){try{fs[_0x05b1('0x1a')](_0x45a3fe);fs[_0x05b1('0x2a')](_0x39e89c,_0x05b1('0x2b'));}catch(_0x354ce1){logger['error'](_0x354ce1);}return _0x39e89c[_0x05b1('0x2c')]('.')[0x0];});}function base64Encode(_0x53d819){var _0x3a0f1c=fs[_0x05b1('0x2d')](_0x53d819);return new Buffer(_0x3a0f1c)[_0x05b1('0x2e')]('base64');}exports['googleCloudTTS']=function(_0x3e4ab9,_0xf6d7f7,_0x488da2,_0xd3d12f,_0x12e358,_0x414c1e){var _0x4ec3b0,_0x3143c6;var _0x20d5f7=_0x05b1('0x2f');var _0x5ad9b6=_0x05b1('0x30')+_0x3e4ab9;var _0x2d0917={};if(_0xf6d7f7===_0x05b1('0x31')){_0x2d0917[_0x05b1('0x32')]={'ssml':_0x488da2};}else{_0x2d0917[_0x05b1('0x32')]={'text':_0x488da2};};_0x2d0917[_0x05b1('0x33')]={'languageCode':_0xd3d12f,'ssmlGender':_0x12e358};_0x2d0917[_0x05b1('0x34')]={'audioEncoding':_0x05b1('0x35'),'sampleRateHertz':0x1f40};var _0x3f575d={'url':_0x20d5f7+_0x05b1('0x36')+_0x5ad9b6,'method':_0x05b1('0x37'),'json':!![],'body':_0x2d0917};return rp(_0x3f575d)[_0x05b1('0x38')](function(_0x2570d8){return new BPromise(function(_0x292dca,_0x37729b){_0x4ec3b0=path[_0x05b1('0x24')](__dirname,'tmp',rs[_0x05b1('0x26')](0x4)+_0x05b1('0x39'));var _0x528798=Buffer[_0x05b1('0x3a')](_0x2570d8['audioContent'],_0x05b1('0x29'));return fs[_0x05b1('0x3b')](_0x4ec3b0,_0x528798,function(_0x291563){_0x37729b(_0x291563);},function(_0x5d94e5){fs['chmodSync'](_0x4ec3b0,_0x05b1('0x2b'));_0x292dca(_0x5d94e5);});});})[_0x05b1('0x38')](function(_0x23d029){_0x3143c6=path['resolve'](__dirname,_0x05b1('0x25'),rs['generate'](0x4)+'.wav');return convertFile(_0x4ec3b0,_0x3143c6);})[_0x05b1('0x38')](function(){try{fs[_0x05b1('0x1a')](_0x4ec3b0);fs[_0x05b1('0x2a')](_0x3143c6,_0x05b1('0x2b'));}catch(_0x409308){logger[_0x05b1('0x13')](_0x409308);}logger[_0x05b1('0x18')](_0x05b1('0x3c'),_0x3143c6[_0x05b1('0x2c')]('.')[0x0]);return _0x3143c6[_0x05b1('0x2c')]('.')[0x0];});};exports[_0x05b1('0x3d')]=function(_0x216e2d,_0x5f0f79){var _0x519d06=_0x05b1('0x3e');var _0x4829f8,_0xe93c61;var _0x42008f;var _0x5e351e={'encoding':'utf8','method':_0x05b1('0x37'),'timeout':0x2710,'url':_0x519d06,'headers':{'Content-Type':_0x05b1('0x3f')},'body':_0x05b1('0x40')+encodeURIComponent(JSON['stringify']([[[_0x05b1('0x41'),JSON['stringify']([_0x216e2d,_0x5f0f79||_0x05b1('0x42'),![],_0x05b1('0x43')]),null,_0x05b1('0x44')]]]))};return rp(_0x5e351e)[_0x05b1('0x38')](function(_0x1bd012){try{_0x42008f=eval(_0x1bd012[_0x05b1('0x45')](0x5))[0x0][0x2];}catch(_0x53a26a){throw new Error(_0x05b1('0x46')+res[_0x05b1('0x1f')]);}if(!_0x42008f){throw new Error(_0x05b1('0x47')+lang+'\x22\x20might\x20not\x20exist');}try{_0x42008f=eval(_0x42008f)[0x0];}catch(_0x2fabe2){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x2fd836=_0x42008f;_0x4829f8=path[_0x05b1('0x24')](__dirname,_0x05b1('0x25'),rs['generate'](0x4)+_0x05b1('0x39'));fs[_0x05b1('0x28')](_0x4829f8,_0x42008f,{'encoding':_0x05b1('0x29')});_0xe93c61=path[_0x05b1('0x24')](__dirname,_0x05b1('0x25'),rs[_0x05b1('0x26')](0x4)+'.wav');return convertFile(_0x4829f8,_0xe93c61);})[_0x05b1('0x38')](function(){try{fs[_0x05b1('0x1a')](_0x4829f8);fs[_0x05b1('0x2a')](_0xe93c61,_0x05b1('0x2b'));}catch(_0x22c396){logger[_0x05b1('0x13')](_0x22c396);}logger[_0x05b1('0x18')](_0x05b1('0x48'),_0xe93c61[_0x05b1('0x2c')]('.')[0x0]);return _0xe93c61[_0x05b1('0x2c')]('.')[0x0];});};exports[_0x05b1('0x49')]=function(_0x122e96,_0x34ff5a,_0xa6708){return google[_0x05b1('0x4a')](_0x122e96,_0x34ff5a,_0xa6708)[_0x05b1('0x38')](function(_0x13eace){logger[_0x05b1('0x18')](_0x13eace[_0x05b1('0x4b')]);return rp(_0x13eace);})[_0x05b1('0x38')](function(_0x588736){var _0x4e4abe='';var _0x6b06e5=0x0;try{fs['unlink'](_0x122e96);}catch(_0x2ba1a3){logger['error'](_0x2ba1a3);}if(_0x588736&&_0x588736[_0x05b1('0x4c')]){_0x4e4abe=_0x588736[_0x05b1('0x4c')][_0x05b1('0x4d')](function(_0x411ded){return _0x411ded&&_0x411ded[_0x05b1('0x4e')][0x0]&&_0x411ded['alternatives'][0x0]['transcript']?_0x411ded['alternatives'][0x0][_0x05b1('0x4f')]:'';})[_0x05b1('0x50')]('\x0a');_0x6b06e5=_0x588736['results']['map'](function(_0x55a79a){return _0x55a79a&&_0x55a79a[_0x05b1('0x4e')][0x0]&&_0x55a79a['alternatives'][0x0][_0x05b1('0x51')]?_0x55a79a[_0x05b1('0x4e')][0x0]['confidence']:0x0;})[_0x05b1('0x50')]('\x0a');}logger[_0x05b1('0x18')](_0x05b1('0x52'),_0x4e4abe);logger['info'](_0x05b1('0x53'),_0x6b06e5);return{'transcript':_0x4e4abe,'confidence':_0x6b06e5};})['catch'](function(_0x2735e2){logger[_0x05b1('0x13')](_0x05b1('0x54'),_0x2735e2[_0x05b1('0x12')],_0x2735e2['name'],_0x2735e2[_0x05b1('0x55')]);});};exports[_0x05b1('0x56')]=function(_0xbfbbb6,_0x152790,_0x9fb014,_0x174efe){var _0x104d0c=apiai(_0x152790,{'language':_0x174efe||'en'});return _0x104d0c[_0x05b1('0x57')](_0x9fb014,{'sessionId':md5(_0xbfbbb6)})[_0x05b1('0x38')](function(_0x5c8949){logger['info'](JSON[_0x05b1('0x58')](_0x5c8949));return{'source':_0x5c8949[_0x05b1('0x59')][_0x05b1('0x5a')],'resolvedQuery':_0x5c8949['result'][_0x05b1('0x5b')],'action':_0x5c8949['result']['action'],'actionIncomplete':_0x5c8949[_0x05b1('0x59')][_0x05b1('0x5c')],'speech':_0x5c8949[_0x05b1('0x59')]['fulfillment'][_0x05b1('0x5d')],'score':_0x5c8949[_0x05b1('0x59')][_0x05b1('0x5e')],'statusCode':_0x5c8949[_0x05b1('0x5f')][_0x05b1('0x60')],'endConversation':_0x5c8949[_0x05b1('0x59')][_0x05b1('0x61')]['endConversation']||![],'isFallbackIntent':_0x5c8949[_0x05b1('0x59')][_0x05b1('0x61')][_0x05b1('0x62')]};});};exports['googleDialogflowV2']=function(_0xaccbfa,_0x5e8e04,_0x86a6fb,_0x41da7b,_0x4db816,_0x28414e){var _0x45f9eb=_0x41da7b[_0x05b1('0x63')](/\\n/g,'\x0a');var _0x3df998={'credentials':{'private_key':_0x45f9eb,'client_email':_0x86a6fb}};var _0x28b117=new dialogflow[(_0x05b1('0x64'))](_0x3df998);var _0x4c2e69=_0x28b117['sessionPath'](_0x5e8e04,md5(_0xaccbfa));var _0x31dc81={'session':_0x4c2e69,'queryInput':{'text':{'text':_0x4db816,'languageCode':_0x28414e}}};return _0x28b117[_0x05b1('0x65')](_0x31dc81)[_0x05b1('0x38')](function(_0x5b616e){if(_0x5b616e&&_0x5b616e[_0x05b1('0x66')]){logger[_0x05b1('0x18')](_0x05b1('0x67'),JSON['stringify'](_0x5b616e));var _0x3ba86c=_0x5b616e[0x0];if(_0x3ba86c){var _0x10ce08={'action':_0x3ba86c[_0x05b1('0x68')]['action'],'allRequiredParamsPresent':_0x3ba86c[_0x05b1('0x68')][_0x05b1('0x69')],'endConversation':_0x3ba86c[_0x05b1('0x68')][_0x05b1('0x6a')]&&_0x3ba86c[_0x05b1('0x68')]['diagnosticInfo'][_0x05b1('0x6b')]?_0x3ba86c[_0x05b1('0x68')]['diagnosticInfo'][_0x05b1('0x6b')][_0x05b1('0x6c')]['boolValue']:![],'fulfillmentText':_0x3ba86c['queryResult']['fulfillmentText'],'intentName':_0x3ba86c[_0x05b1('0x68')][_0x05b1('0x6d')][_0x05b1('0x6e')],'intentDisplayName':_0x3ba86c['queryResult'][_0x05b1('0x6d')][_0x05b1('0x6f')],'isFallbackIntent':_0x3ba86c[_0x05b1('0x68')]['intent'][_0x05b1('0x70')],'languageCode':_0x3ba86c[_0x05b1('0x68')][_0x05b1('0x71')],'queryText':_0x3ba86c[_0x05b1('0x68')][_0x05b1('0x72')],'responseId':_0x3ba86c[_0x05b1('0x73')],'score':_0x3ba86c['queryResult']['intentDetectionConfidence'],'speech':_0x3ba86c[_0x05b1('0x68')][_0x05b1('0x74')],'providerResponse':JSON[_0x05b1('0x58')](_0x5b616e)};return _0x10ce08;}}});};exports[_0x05b1('0x75')]=function(_0x287d86,_0x483fb6,_0x54d976,_0x5bc551){return tilde[_0x05b1('0x4a')](_0x287d86,_0x483fb6,_0x54d976,_0x5bc551)[_0x05b1('0x38')](function(_0x4e3580){try{fs[_0x05b1('0x1a')](_0x287d86);}catch(_0x3fd299){logger[_0x05b1('0x13')](_0x3fd299);}logger[_0x05b1('0x18')](_0x05b1('0x76'),_0x4e3580[_0x05b1('0x4f')]);logger[_0x05b1('0x18')](_0x05b1('0x77'),_0x4e3580[_0x05b1('0x51')]);return _0x4e3580;});};exports[_0x05b1('0x78')]=function(_0x3a0ae1,_0x14af00,_0x1a5183,_0x226186,_0x596b44,_0x306a30){var _0x1e9211=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x05b1('0x39'));var _0x4b0a76;return aws[_0x05b1('0x79')](_0x3a0ae1,_0x14af00,_0x1a5183,_0x226186,_0x596b44,_0x306a30,_0x1e9211)['then'](function(){_0x4b0a76=path[_0x05b1('0x24')](__dirname,'tmp',rs[_0x05b1('0x26')](0x4)+_0x05b1('0x27'));return convertFile(_0x1e9211,_0x4b0a76);})['then'](function(){try{fs[_0x05b1('0x1a')](_0x1e9211);fs[_0x05b1('0x2a')](_0x4b0a76,_0x05b1('0x2b'));}catch(_0x7ef2b6){logger[_0x05b1('0x13')](_0x7ef2b6);}return _0x4b0a76[_0x05b1('0x2c')]('.')[0x0];});};exports['awsLex']=function(_0x324885,_0x2a31f7,_0xf0e470,_0x5d4514,_0x14862f,_0x426e3f){return aws[_0x05b1('0x7a')](_0x324885,_0x2a31f7,_0xf0e470,_0x5d4514,_0x14862f,_0x426e3f)[_0x05b1('0x38')](function(_0xfc7047){logger['info'](JSON['stringify'](_0xfc7047));return _0xfc7047;});};exports[_0x05b1('0x7b')]=function(_0x192554,_0x284d53,_0x5c4c28,_0x32653e){var _0x1b42d9=util[_0x05b1('0x7c')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x192554,encodeURIComponent(_0x284d53),_0x5c4c28,_0x32653e);var _0x3f8c67=path[_0x05b1('0x24')](__dirname,_0x05b1('0x25'),rs[_0x05b1('0x26')](0x4)+_0x05b1('0x39'));var _0x1d584c;return downloadFile(_0x1b42d9,_0x3f8c67)[_0x05b1('0x38')](function(){_0x1d584c=path[_0x05b1('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0x05b1('0x27'));return convertFile(_0x3f8c67,_0x1d584c);})[_0x05b1('0x38')](function(){try{fs[_0x05b1('0x1a')](_0x3f8c67);fs[_0x05b1('0x2a')](_0x1d584c,'777');}catch(_0x1f4ee9){logger[_0x05b1('0x13')](_0x1f4ee9);}return _0x1d584c[_0x05b1('0x2c')]('.')[0x0];});};exports[_0x05b1('0x7d')]=function(_0x46d7b1,_0x5b1218,_0x106a68,_0x20225e){var _0xcd621b=util[_0x05b1('0x7c')](_0x05b1('0x7e'),ISPEECH_API,_0x5b1218,_0x106a68,base64Encode(_0x46d7b1),_0x20225e?util['format'](_0x05b1('0x7f'),encodeURIComponent(_0x20225e)):_0x05b1('0x80'));return uploadFile(_0xcd621b)['then'](function(_0x57871d){return querystring[_0x05b1('0x81')](_0x57871d);});};exports[_0x05b1('0x82')]=function(_0x515c27,_0x5c679a){return sestek[_0x05b1('0x83')](_0x515c27,_0x5c679a)[_0x05b1('0x38')](function(_0x285c6d){logger['info'](JSON['stringify'](_0x285c6d));var _0x3bcbf6={'speech':_0x285c6d['text'],'action':_0x285c6d[_0x05b1('0x84')]?_0x285c6d[_0x05b1('0x84')][_0x05b1('0x85')]:undefined,'actiondata':_0x285c6d[_0x05b1('0x84')]?_0x285c6d[_0x05b1('0x84')][_0x05b1('0x86')]:undefined};if(_0x285c6d[_0x05b1('0x84')]&&_0x285c6d[_0x05b1('0x84')]['AudioFromTts']){return base64Decode(_0x285c6d['channelData']['AudioFromTts'][_0x05b1('0x87')],path[_0x05b1('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0x05b1('0x27')))[_0x05b1('0x38')](function(_0x436a2e){_0x3bcbf6[_0x05b1('0x88')]=_0x436a2e;return _0x3bcbf6;});}return _0x3bcbf6;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 4657107..8f34e03 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 _0xc90d=['./nda','exports'];(function(_0x1d1550,_0x147fc4){var _0x2a6f1d=function(_0x94f31e){while(--_0x94f31e){_0x1d1550['push'](_0x1d1550['shift']());}};_0x2a6f1d(++_0x147fc4);}(_0xc90d,0xf8));var _0xdc90=function(_0x143cc6,_0xf94536){_0x143cc6=_0x143cc6-0x0;var _0x2cedba=_0xc90d[_0x143cc6];return _0x2cedba;};var nda=require(_0xdc90('0x0'));module[_0xdc90('0x1')]={'nda':nda}; \ No newline at end of file +var nda=require('./nda');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 0322db0..b46aa22 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 _0xf014=['ndauth_url','/token','username','password','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','custom_action_data','CustomActionData','url','../../../../../config/logger','agi','exports','POST'];(function(_0x1bb0b8,_0x24add2){var _0x22fc67=function(_0x2e051d){while(--_0x2e051d){_0x1bb0b8['push'](_0x1bb0b8['shift']());}};_0x22fc67(++_0x24add2);}(_0xf014,0x1ad));var _0x4f01=function(_0x4b4154,_0x38a122){_0x4b4154=_0x4b4154-0x0;var _0x340ed7=_0xf014[_0x4b4154];return _0x340ed7;};'use strict';var rp=require('request-promise');var url=require(_0x4f01('0x0'));var logger=require(_0x4f01('0x1'))(_0x4f01('0x2'));module[_0x4f01('0x3')]=function(_0x3a2ff2,_0x29f7da){var _0x282740={'method':_0x4f01('0x4'),'uri':url['resolve'](_0x29f7da[_0x4f01('0x5')],_0x4f01('0x6')),'form':{'grant_type':'password','username':_0x29f7da[_0x4f01('0x7')],'password':_0x29f7da[_0x4f01('0x8')]},'json':!![]};return rp(_0x282740)[_0x4f01('0x9')](function(_0xea6b68){var _0x3d63dd={'method':_0x4f01('0x4'),'uri':url[_0x4f01('0xa')](_0x29f7da[_0x4f01('0xb')],_0x4f01('0xc')),'body':{'type':_0x29f7da[_0x4f01('0xd')]||_0x4f01('0xe'),'channelId':'Nda','conversation':{'id':_0x3a2ff2[_0x4f01('0xf')]},'from':{'id':_0x3a2ff2[_0x4f01('0x10')],'name':_0x3a2ff2[_0x4f01('0x11')]},'recipient':{'id':_0x3a2ff2[_0x4f01('0x12')],'name':_0x3a2ff2['extension']},'text':_0x29f7da[_0x4f01('0x13')],'channelData':{}},'headers':{'Authorization':_0x4f01('0x14')+_0xea6b68[_0x4f01('0x15')]},'json':!![]};if(_0x29f7da[_0x4f01('0x16')]){_0x3d63dd[_0x4f01('0x17')][_0x4f01('0x18')][_0x4f01('0x19')]=_0x29f7da['project'];}if(_0x29f7da[_0x4f01('0x1a')]=='1'){_0x3d63dd[_0x4f01('0x17')][_0x4f01('0x18')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4f01('0x1b')};}if(_0x29f7da[_0x4f01('0x1c')]){_0x3d63dd[_0x4f01('0x17')][_0x4f01('0x18')]['CustomAction']=_0x29f7da[_0x4f01('0x1c')];if(_0x29f7da[_0x4f01('0x1d')]){_0x3d63dd[_0x4f01('0x17')][_0x4f01('0x18')][_0x4f01('0x1e')]=_0x29f7da['custom_action_data'];}}logger['info'](JSON['stringify'](_0x3d63dd));return rp(_0x3d63dd);});}; \ No newline at end of file +var _0x840a=['ndaactivity_type','message','uniqueid','calleridname','extension','text','Bearer\x20','project','channelData','ndagenerate_audio','body','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x4e6ce7,_0x17a05d){var _0x304c80=function(_0x28afd4){while(--_0x28afd4){_0x4e6ce7['push'](_0x4e6ce7['shift']());}};_0x304c80(++_0x17a05d);}(_0x840a,0x88));var _0xa840=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x840a[_0x2641f9];return _0x585741;};'use strict';var rp=require(_0xa840('0x0'));var url=require(_0xa840('0x1'));var logger=require(_0xa840('0x2'))(_0xa840('0x3'));module[_0xa840('0x4')]=function(_0x3a007e,_0x56445b){var _0x516b46={'method':_0xa840('0x5'),'uri':url[_0xa840('0x6')](_0x56445b[_0xa840('0x7')],_0xa840('0x8')),'form':{'grant_type':_0xa840('0x9'),'username':_0x56445b[_0xa840('0xa')],'password':_0x56445b[_0xa840('0x9')]},'json':!![]};return rp(_0x516b46)[_0xa840('0xb')](function(_0x4eda7d){var _0x4505ff={'method':_0xa840('0x5'),'uri':url['resolve'](_0x56445b[_0xa840('0xc')],_0xa840('0xd')),'body':{'type':_0x56445b[_0xa840('0xe')]||_0xa840('0xf'),'channelId':'Nda','conversation':{'id':_0x3a007e[_0xa840('0x10')]},'from':{'id':_0x3a007e['callerid'],'name':_0x3a007e[_0xa840('0x11')]},'recipient':{'id':_0x3a007e['dnid'],'name':_0x3a007e[_0xa840('0x12')]},'text':_0x56445b[_0xa840('0x13')],'channelData':{}},'headers':{'Authorization':_0xa840('0x14')+_0x4eda7d['access_token']},'json':!![]};if(_0x56445b[_0xa840('0x15')]){_0x4505ff['body'][_0xa840('0x16')]['ProjectName']=_0x56445b[_0xa840('0x15')];}if(_0x56445b[_0xa840('0x17')]=='1'){_0x4505ff[_0xa840('0x18')][_0xa840('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x56445b[_0xa840('0x19')]){_0x4505ff[_0xa840('0x18')][_0xa840('0x16')][_0xa840('0x1a')]=_0x56445b[_0xa840('0x19')];if(_0x56445b[_0xa840('0x1b')]){_0x4505ff[_0xa840('0x18')][_0xa840('0x16')]['CustomActionData']=_0x56445b['custom_action_data'];}}logger[_0xa840('0x1c')](JSON[_0xa840('0x1d')](_0x4505ff));return rp(_0x4505ff);});}; \ 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 d433c74..f4a57e9 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 _0x5e05=['exports','./lib/api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5e05,0x12b));var _0x55e0=function(_0x2159b8,_0x2621fa){_0x2159b8=_0x2159b8-0x0;var _0x342a67=_0x5e05[_0x2159b8];return _0x342a67;};'use strict';var asr=require(_0x55e0('0x0'));module[_0x55e0('0x1')]=function(_0x1fcec4,_0xc5c577,_0x1d7d80,_0x176f03){return asr(_0x1fcec4,_0xc5c577,_0x1d7d80,_0x176f03);}; \ No newline at end of file +var _0xb140=['exports','./lib/api'];(function(_0x305b58,_0x5e06e6){var _0x1491a5=function(_0x606b85){while(--_0x606b85){_0x305b58['push'](_0x305b58['shift']());}};_0x1491a5(++_0x5e06e6);}(_0xb140,0xed));var _0x0b14=function(_0x1f0c26,_0x365f93){_0x1f0c26=_0x1f0c26-0x0;var _0x2ebbc6=_0xb140[_0x1f0c26];return _0x2ebbc6;};'use strict';var asr=require(_0x0b14('0x0'));module[_0x0b14('0x1')]=function(_0x5886a2,_0x1e1f9a,_0x5334e9,_0x5efb20){return asr(_0x5886a2,_0x1e1f9a,_0x5334e9,_0x5efb20);}; \ 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 77a6627..48bd046 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 _0xce08=['result','info','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','close','EOS','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xce08,0xb4));var _0x8ce0=function(_0x3ad21f,_0x42387f){_0x3ad21f=_0x3ad21f-0x0;var _0x3262c6=_0xce08[_0x3ad21f];return _0x3262c6;};'use strict';var BPromise=require(_0x8ce0('0x0'));var _=require(_0x8ce0('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8ce0('0x2'));var crypto=require(_0x8ce0('0x3'));var logger=require(_0x8ce0('0x4'))(_0x8ce0('0x5'));module[_0x8ce0('0x6')]=function(_0x280d96,_0x4aa3f3,_0x297dfc,_0x5d70ab){return new BPromise(function(_0x3fe981,_0x198da8){logger['info']('Tilde\x20URI',_0x5d70ab||_0x8ce0('0x7'));var _0x66dc09=new WebSocket(_0x5d70ab||_0x8ce0('0x7'),{'perMessageDeflate':![]});var _0x1aa771='';var _0xbd08b6='0';var _0x733de3='1';var _0x2b5fa9=_0x8ce0('0x8');function _0x1596eb(_0x12a296){var _0x57133f=crypto[_0x8ce0('0x9')](_0x8ce0('0xa'));_0x57133f[_0x8ce0('0xb')](_0x12a296);return _0x57133f[_0x8ce0('0xc')](_0x8ce0('0xd'));}function _0xa81ef8(){try{logger['info'](_0x8ce0('0xe'));var _0x88801f=moment()[_0x8ce0('0xf')]();var _0x598be5=_0x1596eb(_0x88801f+_0x4aa3f3+_0x297dfc);_0x66dc09[_0x8ce0('0x10')](JSON['stringify']({'appID':_0x4aa3f3,'timestamp':_0x88801f,'appKey':_0x598be5}));var _0x1a467e=fs[_0x8ce0('0x11')](_0x280d96);_0x1a467e['on']('data',function(_0x88e0ff){_0x66dc09[_0x8ce0('0x10')](_0x88e0ff);});_0x1a467e['on'](_0x8ce0('0x12'),function(){_0x66dc09[_0x8ce0('0x10')](_0x8ce0('0x13'));});}catch(_0x168892){logger['error'](_0x8ce0('0x14'),JSON[_0x8ce0('0x15')](_0x168892));_0x66dc09[_0x8ce0('0x16')]();}}function _0xac064d(_0x8817ed){try{if(_0x8817ed){var _0x2742d6=JSON[_0x8ce0('0x17')](_0x8817ed);switch(_0x2742d6[_0x8ce0('0x18')]){case 0x0:if(_0x2742d6[_0x8ce0('0x19')]){if(_0x2742d6[_0x8ce0('0x19')]['final']){logger[_0x8ce0('0x1a')](_0x8ce0('0x1b'),JSON[_0x8ce0('0x15')](_0x2742d6[_0x8ce0('0x19')][_0x8ce0('0x1c')]));_0x1aa771=_0x2742d6[_0x8ce0('0x19')][_0x8ce0('0x1c')][0x0][_0x8ce0('0x1d')];_0xbd08b6=_0x2742d6[_0x8ce0('0x19')][_0x8ce0('0x1c')][0x0]['likelihood'];_0x733de3='0';_0x2b5fa9=_0x8ce0('0x1e');_0x66dc09[_0x8ce0('0x16')]();}}break;case 0x1:logger[_0x8ce0('0x1a')](_0x8ce0('0x8'));_0x733de3='1';_0x2b5fa9=_0x8ce0('0x8');break;case 0x2:logger['info'](_0x8ce0('0x1f'));_0x733de3='2';_0x2b5fa9=_0x8ce0('0x1f');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x733de3='9';_0x2b5fa9=_0x8ce0('0x20');break;case 0xa:logger[_0x8ce0('0x1a')](_0x8ce0('0x21'));_0x733de3='10';_0x2b5fa9=_0x8ce0('0x21');break;case 0xb:logger[_0x8ce0('0x1a')](_0x8ce0('0x22'));_0x733de3='11';_0x2b5fa9=_0x8ce0('0x22');}}}catch(_0x33f132){logger[_0x8ce0('0x23')](_0x8ce0('0x24'),JSON[_0x8ce0('0x15')](_0x33f132));_0x66dc09['terminate']();}}function _0xbea614(){logger[_0x8ce0('0x1a')]('Close\x20Tilde\x20ASR\x20socket');_0x3fe981({'transcript':_0x1aa771,'confidence':_0xbd08b6,'status':_0x733de3,'status_message':_0x2b5fa9});}function _0x462fac(_0x30ba20){logger['error'](_0x8ce0('0x25'));if(!_[_0x8ce0('0x26')](_0x30ba20)){logger[_0x8ce0('0x23')](_['isObject'](_0x30ba20)?JSON[_0x8ce0('0x15')](_0x30ba20):_0x30ba20);}}_0x66dc09['on'](_0x8ce0('0x27'),_0xa81ef8);_0x66dc09['on'](_0x8ce0('0x28'),_0xac064d);_0x66dc09['on']('close',_0xbea614);_0x66dc09['on'](_0x8ce0('0x23'),_0x462fac);});}; \ No newline at end of file +var _0xce33=['bluebird','lodash','moment','crypto','../../../../../../config/logger','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','info','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message'];(function(_0x1d25e9,_0x5292e6){var _0x1a348d=function(_0x5b568e){while(--_0x5b568e){_0x1d25e9['push'](_0x1d25e9['shift']());}};_0x1a348d(++_0x5292e6);}(_0xce33,0x171));var _0x3ce3=function(_0x1afa30,_0xc036d5){_0x1afa30=_0x1afa30-0x0;var _0x45e4e6=_0xce33[_0x1afa30];return _0x45e4e6;};'use strict';var BPromise=require(_0x3ce3('0x0'));var _=require(_0x3ce3('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x3ce3('0x2'));var crypto=require(_0x3ce3('0x3'));var logger=require(_0x3ce3('0x4'))('agi');module['exports']=function(_0x27eb66,_0x3ba47d,_0x2b219e,_0x2af402){return new BPromise(function(_0x43deac,_0x25fcac){logger['info'](_0x3ce3('0x5'),_0x2af402||_0x3ce3('0x6'));var _0x504006=new WebSocket(_0x2af402||_0x3ce3('0x6'),{'perMessageDeflate':![]});var _0x15d4a0='';var _0x3883aa='0';var _0x537cca='1';var _0x361237='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x3d92b8(_0x3157b6){var _0x5d1d94=crypto[_0x3ce3('0x7')](_0x3ce3('0x8'));_0x5d1d94[_0x3ce3('0x9')](_0x3157b6);return _0x5d1d94[_0x3ce3('0xa')](_0x3ce3('0xb'));}function _0x173b47(){try{logger['info'](_0x3ce3('0xc'));var _0x41ab91=moment()[_0x3ce3('0xd')]();var _0x2ca275=_0x3d92b8(_0x41ab91+_0x3ba47d+_0x2b219e);_0x504006[_0x3ce3('0xe')](JSON['stringify']({'appID':_0x3ba47d,'timestamp':_0x41ab91,'appKey':_0x2ca275}));var _0x46f15d=fs[_0x3ce3('0xf')](_0x27eb66);_0x46f15d['on']('data',function(_0x4c3bee){_0x504006[_0x3ce3('0xe')](_0x4c3bee);});_0x46f15d['on'](_0x3ce3('0x10'),function(){_0x504006[_0x3ce3('0xe')](_0x3ce3('0x11'));});}catch(_0x3403a0){logger[_0x3ce3('0x12')](_0x3ce3('0x13'),JSON['stringify'](_0x3403a0));_0x504006[_0x3ce3('0x14')]();}}function _0xb3146(_0x30d350){try{if(_0x30d350){var _0x5a96e1=JSON[_0x3ce3('0x15')](_0x30d350);switch(_0x5a96e1['status']){case 0x0:if(_0x5a96e1['result']){if(_0x5a96e1[_0x3ce3('0x16')]['final']){logger[_0x3ce3('0x17')](_0x3ce3('0x18'),JSON[_0x3ce3('0x19')](_0x5a96e1['result'][_0x3ce3('0x1a')]));_0x15d4a0=_0x5a96e1['result'][_0x3ce3('0x1a')][0x0]['transcript'];_0x3883aa=_0x5a96e1[_0x3ce3('0x16')][_0x3ce3('0x1a')][0x0][_0x3ce3('0x1b')];_0x537cca='0';_0x361237=_0x3ce3('0x1c');_0x504006[_0x3ce3('0x14')]();}}break;case 0x1:logger['info'](_0x3ce3('0x1d'));_0x537cca='1';_0x361237='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x3ce3('0x17')](_0x3ce3('0x1e'));_0x537cca='2';_0x361237=_0x3ce3('0x1e');break;case 0x9:logger[_0x3ce3('0x17')](_0x3ce3('0x1f'));_0x537cca='9';_0x361237=_0x3ce3('0x1f');break;case 0xa:logger['info']('Authentication\x20failed.');_0x537cca='10';_0x361237=_0x3ce3('0x20');break;case 0xb:logger[_0x3ce3('0x17')](_0x3ce3('0x21'));_0x537cca='11';_0x361237=_0x3ce3('0x21');}}}catch(_0x57344d){logger['error'](_0x3ce3('0x22'),JSON['stringify'](_0x57344d));_0x504006['terminate']();}}function _0x138b0b(){logger[_0x3ce3('0x17')](_0x3ce3('0x23'));_0x43deac({'transcript':_0x15d4a0,'confidence':_0x3883aa,'status':_0x537cca,'status_message':_0x361237});}function _0x169914(_0x3cc131){logger['error'](_0x3ce3('0x24'));if(!_[_0x3ce3('0x25')](_0x3cc131)){logger[_0x3ce3('0x12')](_[_0x3ce3('0x26')](_0x3cc131)?JSON[_0x3ce3('0x19')](_0x3cc131):_0x3cc131);}}_0x504006['on'](_0x3ce3('0x27'),_0x173b47);_0x504006['on'](_0x3ce3('0x28'),_0xb3146);_0x504006['on'](_0x3ce3('0x10'),_0x138b0b);_0x504006['on']('error',_0x169914);});}; \ 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 cae4b41..52f19c7 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 _0xaf9f=['./asr'];(function(_0x391fc8,_0xdaf8fd){var _0x320291=function(_0x1f0ae2){while(--_0x1f0ae2){_0x391fc8['push'](_0x391fc8['shift']());}};_0x320291(++_0xdaf8fd);}(_0xaf9f,0x1b4));var _0xfaf9=function(_0x150fa2,_0x156632){_0x150fa2=_0x150fa2-0x0;var _0x88e6ba=_0xaf9f[_0x150fa2];return _0x88e6ba;};var asr=require(_0xfaf9('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x8ef3=['exports','./asr'];(function(_0x10c630,_0xb36f90){var _0x1af020=function(_0x5cf0ed){while(--_0x5cf0ed){_0x10c630['push'](_0x10c630['shift']());}};_0x1af020(++_0xb36f90);}(_0x8ef3,0xcb));var _0x38ef=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ef3[_0x14add3];return _0x4a174f;};var asr=require(_0x38ef('0x0'));module[_0x38ef('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 60336fc..eb1ab7d 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 _0x4f17=['E_AGI_SERVER_MAXCONNECTION','code','close','nextTick','inherits','exports','util','events','EventEmitter','./channel','127.0.0.1','emit','error','createServer','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x21af57,_0x14fa55){var _0x2bb0d5=function(_0xd45987){while(--_0xd45987){_0x21af57['push'](_0x21af57['shift']());}};_0x2bb0d5(++_0x14fa55);}(_0x4f17,0x9e));var _0x74f1=function(_0x57ee1d,_0x54111b){_0x57ee1d=_0x57ee1d-0x0;var _0x12a933=_0x4f17[_0x57ee1d];return _0x12a933;};'use strict';var util=require(_0x74f1('0x0'));var net=require('net');var EventEmitter=require(_0x74f1('0x1'))[_0x74f1('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x74f1('0x3'));var AGIServer=function(_0x4694a1,_0x3f16b2,_0x62251d){var _0x2d1ff2=this,_0x4694a1=_0x4694a1||0x11dd,_0x3f16b2=_0x3f16b2||_0x74f1('0x4'),_0x3f65bb=null,_0x4b894a=0x0;EventEmitter['call'](_0x2d1ff2);function _0x34ec03(){if(!_0x4694a1){_0x2d1ff2[_0x74f1('0x5')](_0x74f1('0x6'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x3f65bb=net[_0x74f1('0x7')]();_0x3f65bb['listen'](_0x4694a1,_0x3f16b2);_0x3f65bb['on'](_0x74f1('0x8'),function(){_0x2d1ff2['emit'](_0x74f1('0x8'));});_0x3f65bb['on'](_0x74f1('0x9'),function(_0x57e775){_0x3f65bb['getConnections'](function(_0x28307c,_0x14484a){if(_0x28307c){_0x2d1ff2[_0x74f1('0x5')](_0x74f1('0x6'),new AGIError(_0x74f1('0xa'),_0x28307c));}else if(_0x62251d&&_0x62251d<0x0){_0x2d1ff2[_0x74f1('0x5')](_0x74f1('0x6'),new AGIError(_0x74f1('0xb')));_0x57e775[_0x74f1('0xc')]();}else if(_0x62251d&&_0x62251d>0x0&&_0x62251d<_0x14484a){_0x4b894a+=0x1;_0x2d1ff2[_0x74f1('0x5')]('error',new AGIError(_0x74f1('0xd'),_0x4b894a));_0x57e775['destroy']();}else{var _0x41488b=new AGIChannel(_0x57e775);_0x41488b['on']('ready',function(){_0x2d1ff2[_0x74f1('0x5')](_0x74f1('0x9'),_0x41488b);});}});});_0x3f65bb['on'](_0x74f1('0x6'),function(_0x1016a7){_0x2d1ff2[_0x74f1('0x5')]('error',new AGIError(_0x74f1('0xa'),_0x1016a7[_0x74f1('0xe')]));});_0x3f65bb['on']('close',function(){_0x2d1ff2[_0x74f1('0x5')](_0x74f1('0xf'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x74f1('0x10')](function(){_0x34ec03();});};util[_0x74f1('0x11')](AGIServer,EventEmitter);module[_0x74f1('0x12')]=function(_0x1e5cf1,_0x174051,_0x4a10ab){return new AGIServer(_0x1e5cf1,_0x174051,_0x4a10ab);}; \ No newline at end of file +var _0x758e=['getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','EventEmitter','./error','./channel','127.0.0.1','call','error','emit','listening','connection'];(function(_0x524e68,_0x22f5f4){var _0x40f99c=function(_0x51d33f){while(--_0x51d33f){_0x524e68['push'](_0x524e68['shift']());}};_0x40f99c(++_0x22f5f4);}(_0x758e,0x1af));var _0xe758=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x758e[_0x1035c1];return _0x308d67;};'use strict';var util=require(_0xe758('0x0'));var net=require('net');var EventEmitter=require('events')[_0xe758('0x1')];var AGIError=require(_0xe758('0x2'));var AGIChannel=require(_0xe758('0x3'));var AGIServer=function(_0x4b7512,_0x5e7714,_0x31641f){var _0x232ca8=this,_0x4b7512=_0x4b7512||0x11dd,_0x5e7714=_0x5e7714||_0xe758('0x4'),_0x5a2226=null,_0x2cdf89=0x0;EventEmitter[_0xe758('0x5')](_0x232ca8);function _0x5357cf(){if(!_0x4b7512){_0x232ca8['emit'](_0xe758('0x6'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x5a2226=net['createServer']();_0x5a2226['listen'](_0x4b7512,_0x5e7714);_0x5a2226['on']('listening',function(){_0x232ca8[_0xe758('0x7')](_0xe758('0x8'));});_0x5a2226['on'](_0xe758('0x9'),function(_0x4cdd20){_0x5a2226[_0xe758('0xa')](function(_0x55e39d,_0x3db28b){if(_0x55e39d){_0x232ca8[_0xe758('0x7')](_0xe758('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x55e39d));}else if(_0x31641f&&_0x31641f<0x0){_0x232ca8[_0xe758('0x7')]('error',new AGIError(_0xe758('0xb')));_0x4cdd20[_0xe758('0xc')]();}else if(_0x31641f&&_0x31641f>0x0&&_0x31641f<_0x3db28b){_0x2cdf89+=0x1;_0x232ca8[_0xe758('0x7')](_0xe758('0x6'),new AGIError(_0xe758('0xd'),_0x2cdf89));_0x4cdd20[_0xe758('0xc')]();}else{var _0xea5ea3=new AGIChannel(_0x4cdd20);_0xea5ea3['on'](_0xe758('0xe'),function(){_0x232ca8[_0xe758('0x7')]('connection',_0xea5ea3);});}});});_0x5a2226['on'](_0xe758('0x6'),function(_0x551700){_0x232ca8['emit'](_0xe758('0x6'),new AGIError(_0xe758('0xf'),_0x551700['code']));});_0x5a2226['on']('close',function(){_0x232ca8[_0xe758('0x7')](_0xe758('0x10'),new AGIError(_0xe758('0x11')));});}process[_0xe758('0x12')](function(){_0x5357cf();});};util[_0xe758('0x13')](AGIServer,EventEmitter);module[_0xe758('0x14')]=function(_0x5a5674,_0x5aaea2,_0x44a6db){return new AGIServer(_0x5a5674,_0x5aaea2,_0x44a6db);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index c2994f5..bf45dbf 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 _0xb730=['generate','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','googleASR','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','no\x20find\x20by\x20configured','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','subject','service','host','port','secure','auth','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','AGI','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','util','lodash','odbc','randomstring','request-promise','../../config/logger','../../config/environment','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','isNil','agentUnpause','agent','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','url','method','timeout','number','includes','POST','toUpperCase','body','parse','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','tildeASR','appid','appsecret','clear','clone','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','isString','saveRestApiResult','hasOwnProperty','%s.%s','setVariable','replaceObjectAllVariables','split','length','replaceAll','getVariable','extra','toString','getAndSetVariable','maxRetry','retry','isConfigured','noop','no\x20text\x20configured','MRCPSynth','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','agi','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','minutes','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DIALOGFLOW_%s','dialogflowV2','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit'];(function(_0x2ec7e4,_0x3cac0c){var _0x1d1056=function(_0x1a6380){while(--_0x1a6380){_0x2ec7e4['push'](_0x2ec7e4['shift']());}};_0x1d1056(++_0x3cac0c);}(_0xb730,0xac));var _0x0b73=function(_0x2f0998,_0x1f674a){_0x2f0998=_0x2f0998-0x0;var _0x2b78af=_0xb730[_0x2f0998];return _0x2b78af;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x0b73('0x0'));var _=require(_0x0b73('0x1'));var sh=require('shelljs');var odbc=require(_0x0b73('0x2'))();var rs=require(_0x0b73('0x3'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0x0b73('0x4'));var logger=require(_0x0b73('0x5'))('agi');var config=require(_0x0b73('0x6'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x0b73('0x7')];var verticesWithRetry=[_0x0b73('0x8'),_0x0b73('0x9'),_0x0b73('0xa')];var AGIVertices=function(_0x372d11,_0x46176f,_0x590783){this[_0x0b73('0xb')]=_0x372d11;this[_0x0b73('0xc')]=_0x46176f;this['mailRpc']=_0x590783;};AGIVertices[_0x0b73('0xd')]['getVariable']=function(_0x5998b7,_0x4de446){this[_0x0b73('0xc')][_0x0b73('0xe')](_0x5998b7)[_0x0b73('0xf')](function(_0x46230a){_0x4de446(null,_0x46230a?_0x46230a[_0x0b73('0x10')]:![]);})[_0x0b73('0x11')](function(_0x2b180c){_0x4de446(_0x2b180c);});};AGIVertices['prototype'][_0x0b73('0x12')]=function(_0x16827b,_0x505938){this[_0x0b73('0xc')][_0x0b73('0x13')](_0x16827b)[_0x0b73('0xf')](function(_0xcdadfb){_0x505938(null,_0xcdadfb?_0xcdadfb[_0x0b73('0x10')]:![]);})[_0x0b73('0x11')](function(_0xa0fffe){_0x505938(_0xa0fffe);});};AGIVertices[_0x0b73('0xd')]['getSquareProject']=function(_0x19e27d,_0x2be6e8){this[_0x0b73('0xc')]['getSquareProjectById'](_0x19e27d)[_0x0b73('0xf')](function(_0x784d39){_0x2be6e8(null,_0x784d39?_0x784d39['name']:![]);})['catch'](function(_0x45d7a1){_0x2be6e8(_0x45d7a1);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x14')]=function(_0xc5c4,_0x4947e3){this[_0x0b73('0xc')][_0x0b73('0x15')](_0xc5c4)['then'](function(_0x30dd76){_0x4947e3(null,_0x30dd76?_0x30dd76['dsn']:![]);})[_0x0b73('0x11')](function(_0x165b98){_0x4947e3(_0x165b98);});};AGIVertices['prototype'][_0x0b73('0x16')]=function(_0x4a77e3,_0x3992da){this[_0x0b73('0xc')][_0x0b73('0x17')](_0x4a77e3)[_0x0b73('0xf')](function(_0x24184e){_0x3992da(null,_0x24184e?_0x24184e[_0x0b73('0x10')]:![]);})[_0x0b73('0x11')](function(_0x59edce){_0x3992da(_0x59edce);});};AGIVertices['prototype']['getTrunk']=function(_0x28321a,_0x15e748){this['rpc'][_0x0b73('0x18')](_0x28321a)['then'](function(_0x53f3df){_0x15e748(null,_0x53f3df?_0x53f3df[_0x0b73('0x10')]:![]);})[_0x0b73('0x11')](function(_0x24bd43){_0x15e748(_0x24bd43);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x19')]=function(_0x32f655,_0x16be94){var _0x28b25c=this;this[_0x0b73('0xc')][_0x0b73('0x1a')](_0x32f655)[_0x0b73('0xf')](function(_0x189cf9){_0x16be94(null,_0x189cf9?_0x28b25c[_0x0b73('0x1b')](_0x189cf9[_0x0b73('0x1c')]):![]);})[_0x0b73('0x11')](function(_0x146ad8){_0x16be94(_0x146ad8);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1d')]=function(_0x531a89,_0xb268c){this[_0x0b73('0xc')]['getMailAccountById'](_0x531a89)[_0x0b73('0xf')](function(_0x1da1a0){_0xb268c(null,_0x1da1a0?_0x1da1a0:![]);})['catch'](function(_0x1038cb){_0xb268c(_0x1038cb);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1e')]=function(_0x490449,_0x3556fe,_0x128913){this['mailRpc'][_0x0b73('0x1e')](_0x490449,_0x3556fe)[_0x0b73('0xf')](function(){_0x128913(null);})[_0x0b73('0x11')](function(_0x502d17){_0x128913(_0x502d17);});};AGIVertices['prototype'][_0x0b73('0x1f')]=function(_0x5e5726,_0x518d67){this['rpc'][_0x0b73('0x20')](_0x5e5726)['then'](function(_0x10b66b){if(_0x10b66b){if(_0x10b66b[_0x0b73('0x21')]){_0x518d67(null,[_0x10b66b[_0x0b73('0x22')]]);}else{_0x518d67(null,_[_0x0b73('0x23')](_0x10b66b['Intervals'],'interval'));}}else{_0x518d67(null,![]);}})['catch'](function(_0x387f56){_0x518d67(_0x387f56);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1b')]=function(_0x547a9f){return util[_0x0b73('0x24')](_0x0b73('0x25'),FILES_PATH,_0x547a9f);};AGIVertices[_0x0b73('0xd')][_0x0b73('0x26')]=function(_0x4c9fe4,_0x3ccee6,_0x1a4e48){odbc[_0x0b73('0x27')](_0x4c9fe4,function(_0x270131){if(_0x270131){logger[_0x0b73('0x28')](_0x0b73('0x29'),_0x270131);_0x1a4e48(_0x270131);}else{logger['info'](_0x0b73('0x2a'));odbc[_0x0b73('0x2b')](_0x3ccee6,function(_0x2b0711,_0x59f108){if(_0x2b0711){logger[_0x0b73('0x2c')](_0x0b73('0x2d'),_0x3ccee6);_0x1a4e48(_0x2b0711);}else{logger['info'](_0x0b73('0x2e'),_0x3ccee6);odbc[_0x0b73('0x2f')](function(_0x7ffde7){if(_0x7ffde7){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x7ffde7);}_0x1a4e48(null,_0x59f108);});}});}});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x30')]=function(_0x2ad18a,_0x21021e){this[_0x0b73('0xc')][_0x0b73('0x31')](_0x2ad18a)[_0x0b73('0xf')](function(_0x1e6afb){_0x21021e(null,_0x1e6afb?_0x1e6afb:![]);})[_0x0b73('0x11')](function(_0x993d0d){_0x21021e(_0x993d0d);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x32')]=function(_0x1f887d,_0x476dfb){this[_0x0b73('0xc')]['createSmsMessage'](_0x1f887d)[_0x0b73('0xf')](function(_0x2b7ad8){_0x476dfb(null,_0x2b7ad8);})['catch'](function(_0x354e40){_0x476dfb(_0x354e40);});};AGIVertices['prototype'][_0x0b73('0x33')]=function(_0x64461d,_0x11fc39,_0x3239fe){this['rpc'][_0x0b73('0x33')]({'uniqueid':this[_0x0b73('0xb')][_0x0b73('0x34')],'node':_0x64461d[_0x0b73('0x35')],'application':_0x64461d[_0x0b73('0x36')],'data':_0x11fc39||null,'project_name':this[_0x0b73('0xb')][_0x0b73('0x37')],'callerid':this[_0x0b73('0xb')][_0x0b73('0x38')]})['then'](function(_0x502d95){if(_0x3239fe){_0x3239fe(null,_0x502d95);}})[_0x0b73('0x11')](function(_0x5e3774){if(_0x3239fe){_0x3239fe(_0x5e3774);}});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x39')]=function(_0x11f676,_0x2db1e3,_0x140a4e,_0x368220){this[_0x0b73('0xc')][_0x0b73('0x39')]({'uniqueid':this[_0x0b73('0xb')][_0x0b73('0x34')],'callerid':this[_0x0b73('0xb')][_0x0b73('0x38')],'calleridname':this[_0x0b73('0xb')]['calleridname'],'context':this[_0x0b73('0xb')][_0x0b73('0x3a')],'extension':this[_0x0b73('0xb')][_0x0b73('0x3b')],'priority':this[_0x0b73('0xb')][_0x0b73('0x3c')],'accountcode':this['channel'][_0x0b73('0x3d')],'dnid':this['channel']['dnid'],'projectName':this['channel'][_0x0b73('0x37')],'saveName':_0x2db1e3,'filename':_0x11f676[_0x0b73('0x3e')]||_0x2db1e3,'savePath':_0x140a4e})['then'](function(_0x15ae6c){_0x368220(null,_0x15ae6c);})[_0x0b73('0x11')](function(_0x5d1266){_0x368220(_0x5d1266);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x3f')]=function(_0x5af0ec,_0x39ef14,_0x13e01f,_0x1a4e1f,_0x1d1ced){this[_0x0b73('0xc')][_0x0b73('0x3f')]({'uniqueid':this[_0x0b73('0xb')]['uniqueid'],'body':_0x5af0ec,'direction':_0x39ef14,'providerName':_0x13e01f,'providerResponse':_0x1a4e1f})[_0x0b73('0xf')](function(_0x1b1e2b){if(_0x1d1ced){_0x1d1ced(null,_0x1b1e2b);}})['catch'](function(_0x1cc690){if(_0x1d1ced){_0x1d1ced(_0x1cc690);}});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x40')]=function(_0x4a0aeb,_0x38c4ba){this[_0x0b73('0xc')][_0x0b73('0x40')]({'firstName':_[_0x0b73('0x41')](_0x4a0aeb['name'])||_['isNil'](_0x4a0aeb['name'])?_0x0b73('0x42')+Math[_0x0b73('0x43')]():_0x4a0aeb['name'],'lastName':_[_0x0b73('0x41')](_0x4a0aeb[_0x0b73('0x44')])||_['isNil'](_0x4a0aeb['lastName'])?null:_0x4a0aeb['lastName'],'phone':_0x4a0aeb[_0x0b73('0x45')],'ListId':_0x4a0aeb[_0x0b73('0x46')],'scheduledat':_0x4a0aeb[_0x0b73('0x47')],'callbackUniqueid':this[_0x0b73('0xb')]['uniqueid'],'tags':_0x0b73('0x48'),'description':_0x0b73('0x49')+_0x4a0aeb[_0x0b73('0x47')]['toString'](),'priority':_0x4a0aeb[_0x0b73('0x4a')]})[_0x0b73('0xf')](function(_0x2d31ec){_0x38c4ba(null,_0x2d31ec);})[_0x0b73('0x11')](function(_0xc12d78){_0x38c4ba(_0xc12d78);});};AGIVertices['prototype'][_0x0b73('0x4b')]=function(_0x25d6c7,_0x17e45b){this[_0x0b73('0xc')][_0x0b73('0x4c')](_0x25d6c7)['then'](function(_0x5e0525){_0x17e45b(null,_0x5e0525?_0x5e0525[_0x0b73('0x10')]:![]);})[_0x0b73('0x11')](function(_0x4e7e13){_0x17e45b(_0x4e7e13);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x4d')]=function(_0x268780,_0x2d3b82,_0x1c9872){var _0x1a18b2={'role':'agent'};_0x1a18b2[_0x268780]=this[_0x0b73('0xb')][_0x0b73('0x38')];this[_0x0b73('0xc')][_0x0b73('0x4d')](_0x1a18b2,_0x2d3b82,this[_0x0b73('0xb')][_0x0b73('0x34')])[_0x0b73('0xf')](function(_0x9ff7b0){_0x1c9872(null,_[_0x0b73('0x4e')](_0x9ff7b0)?![]:!![]);})[_0x0b73('0x11')](function(_0x4ced5f){logger[_0x0b73('0x28')](_0x4ced5f);_0x1c9872(null,![]);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x4f')]=function(_0x56cc12,_0x4f82cc){var _0x31b6b3={'role':_0x0b73('0x50')};_0x31b6b3[_0x56cc12]=this[_0x0b73('0xb')][_0x0b73('0x38')];this[_0x0b73('0xc')][_0x0b73('0x4f')](_0x31b6b3)[_0x0b73('0xf')](function(_0x2528b4){_0x4f82cc(null,_[_0x0b73('0x4e')](_0x2528b4)?![]:!![]);})['catch'](function(_0x473ce9){logger['error'](_0x473ce9);_0x4f82cc(null,![]);});};AGIVertices[_0x0b73('0xd')]['agentLogout']=function(_0x34004e,_0x1718a1){var _0x50f701={'role':_0x0b73('0x50')};_0x50f701[_0x34004e]=this['channel'][_0x0b73('0x38')];this['rpc']['agentLogout'](_0x50f701)['then'](function(_0x18808c){_0x1718a1(null,_[_0x0b73('0x4e')](_0x18808c)?![]:!![]);})[_0x0b73('0x11')](function(_0x259c2b){logger[_0x0b73('0x28')](_0x259c2b);_0x1718a1(null,![]);});};AGIVertices['prototype'][_0x0b73('0x51')]=function(_0x1d7218,_0x14cccc){var _0x10ebba={'role':_0x0b73('0x50')};_0x10ebba[_0x1d7218]=this[_0x0b73('0xb')]['callerid'];var _0x10b2b6=_0x1d7218!='internal'?util[_0x0b73('0x24')](_0x0b73('0x52'),_0x0b73('0x53'),this[_0x0b73('0xb')]['callerid']):undefined;this[_0x0b73('0xc')][_0x0b73('0x51')](_0x10ebba,_0x10b2b6)[_0x0b73('0xf')](function(_0x350141){_0x14cccc(null,_[_0x0b73('0x4e')](_0x350141)?![]:!![]);})['catch'](function(_0x3ec8d8){logger[_0x0b73('0x28')](_0x3ec8d8);_0x14cccc(null,![]);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x54')]=function(_0x544b0b,_0x523cfd){sh[_0x0b73('0x55')](_[_0x0b73('0x56')](_0x544b0b),function(_0x2af97d,_0x3fa891){var _0x432ecf=_0x3fa891[_0x0b73('0x57')](/(\r\n|\n|\r)/gm,'');_0x523cfd(null,_0x432ecf);});};AGIVertices['prototype'][_0x0b73('0x58')]=function(_0x77907d,_0x48174a){scripts[_0x0b73('0x58')](_0x77907d['apiKey'],_0x77907d[_0x0b73('0x59')]||_0x0b73('0x5a'),_0x77907d[_0x0b73('0x5a')],_0x77907d[_0x0b73('0x5b')]||_0x0b73('0x5c'),_0x77907d['ssmlGender']||_0x0b73('0x5d'),_0x77907d[_0x0b73('0x5e')]||_0x0b73('0x5f'))[_0x0b73('0xf')](function(_0x11237c){_0x48174a(null,_0x11237c);})[_0x0b73('0x11')](function(_0x15922c){_0x48174a(_0x15922c);});};AGIVertices['prototype']['googleTTS']=function(_0x2bf9c6,_0x2c6da0){scripts[_0x0b73('0x60')](_0x2bf9c6[_0x0b73('0x5a')],_0x2bf9c6['google_tts_language']||'en',0x1)[_0x0b73('0xf')](function(_0x4443fa){_0x2c6da0(null,_0x4443fa);})[_0x0b73('0x11')](function(_0x244405){_0x2c6da0(_0x244405);});};AGIVertices[_0x0b73('0xd')]['restAPI']=function(_0x4e5414,_0x1ee0d1){var _0xd9f97f={'uri':_0x4e5414[_0x0b73('0x61')],'method':_0x4e5414[_0x0b73('0x62')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4e5414[_0x0b73('0x63')])===_0x0b73('0x64')&&parseInt(_0x4e5414[_0x0b73('0x63')])>=0x1?parseInt(_0x4e5414[_0x0b73('0x63')])*0x3e8:0x5*0x3e8};if(_[_0x0b73('0x65')]([_0x0b73('0x66'),'PUT'],_0xd9f97f[_0x0b73('0x62')][_0x0b73('0x67')]())){try{_0xd9f97f[_0x0b73('0x68')]=_0x4e5414[_0x0b73('0x7')]?JSON[_0x0b73('0x69')](_0x4e5414[_0x0b73('0x7')]):{};}catch(_0x7fb9a7){logger[_0x0b73('0x28')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x7fb9a7);}}try{_0xd9f97f[_0x0b73('0x6a')]=_0x4e5414[_0x0b73('0x6b')]?JSON[_0x0b73('0x69')](_0x4e5414[_0x0b73('0x6b')]):{};}catch(_0x220963){logger['error'](_0x0b73('0x6c'),_0x220963);}if(_0x4e5414[_0x0b73('0x6d')]){try{var _0x2efaf2=require(_0x4e5414[_0x0b73('0x6d')])['sync'](this,_0xd9f97f);_0xd9f97f[_0x0b73('0x6e')]=Mustache[_0x0b73('0x6f')](_0x4e5414['url'],_0x2efaf2,{},['$$','$$']);if(_0xd9f97f['headers']){_0xd9f97f[_0x0b73('0x6a')]=JSON[_0x0b73('0x69')](Mustache[_0x0b73('0x6f')](JSON[_0x0b73('0x70')](_0xd9f97f[_0x0b73('0x6a')]),_0x2efaf2,{},['$$','$$']));}if(_0xd9f97f['body']){_0xd9f97f[_0x0b73('0x68')]=JSON[_0x0b73('0x69')](Mustache[_0x0b73('0x6f')](JSON[_0x0b73('0x70')](_0xd9f97f['body']),_0x2efaf2,{},['$$','$$']));}}catch(_0x1f42c3){logger[_0x0b73('0x28')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1f42c3);}}rp(_0xd9f97f)[_0x0b73('0xf')](function(_0x47db9a){var _0x233f63={'statusCode':_0x47db9a['statusCode']||0xc8,'statusMessage':_0x47db9a[_0x0b73('0x71')]||'OK','headers':_0x47db9a[_0x0b73('0x6a')]||{},'body':_0x47db9a[_0x0b73('0x68')]||{}};_0x1ee0d1(null,_0x233f63);})[_0x0b73('0x11')](function(_0x39b4ae){var _0xbfe1fe={'statusCode':_0x39b4ae[_0x0b73('0x72')]||0x1f4,'statusMessage':_0x39b4ae[_0x0b73('0x73')]||_0x0b73('0x74'),'headers':_0x39b4ae[_0x0b73('0x75')][_0x0b73('0x6a')]||{},'body':_0x39b4ae[_0x0b73('0x75')][_0x0b73('0x68')]||{}};_0x1ee0d1(null,_0xbfe1fe);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x76')]=function(_0x1b6809,_0x14890c){scripts[_0x0b73('0x76')](this[_0x0b73('0xb')]['uniqueid'],_0x1b6809[_0x0b73('0x77')],_0x1b6809['text'],_0x1b6809['dialogflow_language']||'en')[_0x0b73('0xf')](function(_0x46825a){_0x14890c(null,_0x46825a);})[_0x0b73('0x11')](function(_0x54ca79){_0x14890c(_0x54ca79);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x78')]=function(_0x5cb6f2,_0x563ede){scripts[_0x0b73('0x78')](this[_0x0b73('0xb')]['uniqueid'],_0x5cb6f2['dialogflowV2_project_id'],_0x5cb6f2[_0x0b73('0x79')],_0x5cb6f2[_0x0b73('0x7a')],_0x5cb6f2[_0x0b73('0x5a')],_0x5cb6f2[_0x0b73('0x7b')]||'en')[_0x0b73('0xf')](function(_0xf99141){_0x563ede(null,_0xf99141);})[_0x0b73('0x11')](function(_0xf2dba4){_0x563ede(_0xf2dba4);});};AGIVertices['prototype'][_0x0b73('0x7c')]=function(_0x30c4cb,_0x59bf4b){scripts[_0x0b73('0x7c')](this[_0x0b73('0xb')],_0x30c4cb)[_0x0b73('0xf')](function(_0xfc891f){_0x59bf4b(null,_0xfc891f);})[_0x0b73('0x11')](function(_0x4a1c74){_0x59bf4b(_0x4a1c74);});};AGIVertices[_0x0b73('0xd')]['ispeechTTS']=function(_0x1b15ec,_0x48f5bf){scripts[_0x0b73('0x7d')](_0x1b15ec[_0x0b73('0x77')],_0x1b15ec['text'],_0x1b15ec['ispeech_tts_language']||_0x0b73('0x5c'),_0x1b15ec[_0x0b73('0x7e')])[_0x0b73('0xf')](function(_0x124045){_0x48f5bf(null,_0x124045);})[_0x0b73('0x11')](function(_0x43f0c4){_0x48f5bf(_0x43f0c4);});};AGIVertices['prototype'][_0x0b73('0x7f')]=function(_0xce8882,_0x5505ee,_0x1a1507){scripts['ispeechASR'](_0x5505ee,_0xce8882['key'],_0xce8882['ispeech_asr_language']||'en-US',this['isConfigured'](_0xce8882[_0x0b73('0x80')])?_0xce8882[_0x0b73('0x80')]:undefined)['then'](function(_0x446500){_0x1a1507(null,_0x446500);})[_0x0b73('0x11')](function(_0x374d41){_0x1a1507(_0x374d41);});};AGIVertices['prototype']['awsPolly']=function(_0x20779b,_0xf6e4ed){scripts[_0x0b73('0x81')](_0x20779b['aws_access_key_id'],_0x20779b[_0x0b73('0x82')],_0x20779b[_0x0b73('0x83')],_0x20779b[_0x0b73('0x84')]||'Amy',_0x20779b[_0x0b73('0x5a')],_0x20779b[_0x0b73('0x85')]||_0x0b73('0x5a'))[_0x0b73('0xf')](function(_0x5babf9){_0xf6e4ed(null,_0x5babf9);})[_0x0b73('0x11')](function(_0x309089){_0xf6e4ed(_0x309089);});};AGIVertices['prototype'][_0x0b73('0x86')]=function(_0x2c4b17,_0x42b120){scripts['awsLex'](this['channel'][_0x0b73('0x34')],_0x2c4b17['aws_access_key_id'],_0x2c4b17[_0x0b73('0x82')],_0x2c4b17[_0x0b73('0x87')],_0x2c4b17[_0x0b73('0x5a')],_0x2c4b17[_0x0b73('0x88')])[_0x0b73('0xf')](function(_0xddfd7b){_0x42b120(null,_0xddfd7b);})[_0x0b73('0x11')](function(_0x1e08f6){_0x42b120(_0x1e08f6);});};AGIVertices['prototype']['googleASR']=function(_0xa59a96,_0x376d5c,_0x1dc6aa){scripts['googleASR'](_0x376d5c,_0xa59a96[_0x0b73('0x77')],_0xa59a96['google_asr_language']||'en-US')['then'](function(_0x5f2478){_0x1dc6aa(null,_0x5f2478);})[_0x0b73('0x11')](function(_0x16eec0){_0x1dc6aa(_0x16eec0);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x89')]=function(_0x30493f,_0x3f6255,_0x317758){scripts['tildeASR'](_0x3f6255,_0x30493f[_0x0b73('0x8a')],_0x30493f[_0x0b73('0x8b')],_0x30493f[_0x0b73('0x6e')])[_0x0b73('0xf')](function(_0x36ea93){_0x317758(null,_0x36ea93);})['catch'](function(_0x17c07a){_0x317758(_0x17c07a);});};AGIVertices['prototype'][_0x0b73('0x8c')]=function(_0x1042c8){var _0x5e6fd4=_[_0x0b73('0x65')](verticesWithRetry,_0x1042c8[_0x0b73('0x36')])?_0x1042c8:_[_0x0b73('0x8d')](_0x1042c8);for(var _0x128786 in _0x5e6fd4){if(_0x5e6fd4['hasOwnProperty'](_0x128786)){if(_0x5e6fd4[_0x128786]&&_['isString'](_0x5e6fd4[_0x128786])){if(_[_0x0b73('0x65')](recursiveMapAttributes,_0x128786)){_0x5e6fd4[_0x128786]=this['replaceObjectAllVariables'](_0x5e6fd4[_0x128786]);}else{_0x5e6fd4[_0x128786]=this[_0x0b73('0x8e')](_0x5e6fd4[_0x128786]);}}}}return _0x5e6fd4;};AGIVertices['prototype'][_0x0b73('0x8f')]=function(_0x737638){for(var _0x4acd8c in _0x737638){if(_0x737638['hasOwnProperty'](_0x4acd8c)){if(_[_0x0b73('0x90')](_0x737638[_0x4acd8c])){this[_0x0b73('0x8f')](_0x737638[_0x4acd8c]);}else if(_[_0x0b73('0x91')](_0x737638[_0x4acd8c])){for(var _0x1c5309=0x0;_0x1c5309<_0x737638[_0x4acd8c]['length'];_0x1c5309++){this[_0x0b73('0x8f')](_0x737638[_0x4acd8c][_0x1c5309]);}}else if(_[_0x0b73('0x92')](_0x737638[_0x4acd8c])){_0x737638[_0x4acd8c]=this[_0x0b73('0x8e')](_0x737638[_0x4acd8c]);}}}};AGIVertices[_0x0b73('0xd')][_0x0b73('0x93')]=function(_0x291048,_0x2cfa70){for(var _0x1a2015 in _0x291048){if(_0x291048[_0x0b73('0x94')](_0x1a2015)){if(_['isPlainObject'](_0x291048[_0x1a2015])){if(!_[_0x0b73('0x41')](_0x291048[_0x1a2015])){this[_0x0b73('0x93')](_0x291048[_0x1a2015],util['format'](_0x0b73('0x95'),_0x2cfa70,_0x1a2015));}}else if(_[_0x0b73('0x91')](_0x291048[_0x1a2015])){for(var _0x29621a=0x0;_0x29621a<_0x291048[_0x1a2015]['length'];_0x29621a++){this[_0x0b73('0x93')](_0x291048[_0x1a2015][_0x29621a],util[_0x0b73('0x24')](_0x0b73('0x95'),_0x2cfa70,_0x1a2015+'['+_0x29621a+']'));}}else{if(!_[_0x0b73('0x4e')](_0x291048[_0x1a2015])){this[_0x0b73('0xb')][_0x0b73('0x96')](util[_0x0b73('0x24')]('%s.%s',_0x2cfa70,_0x1a2015),_0x291048[_0x1a2015]);}}}}};AGIVertices[_0x0b73('0xd')][_0x0b73('0x97')]=function(_0x31ca0c){try{var _0x4932f0=JSON['parse'](_0x31ca0c);this[_0x0b73('0x8f')](_0x4932f0);return JSON['stringify'](_0x4932f0);}catch(_0x2932a0){return this[_0x0b73('0x8e')](_0x31ca0c);}};AGIVertices[_0x0b73('0xd')][_0x0b73('0x8e')]=function(_0xd950f4){var _0x67b492=_0xd950f4[_0x0b73('0x98')]('{');for(var _0x5ac1a4=0x1;_0x5ac1a4<_0x67b492[_0x0b73('0x99')];_0x5ac1a4+=0x1){var _0x12f8b4=_0x67b492[_0x5ac1a4][_0x0b73('0x98')]('}');if(_0x12f8b4[_0x0b73('0x99')]>0x1){_0xd950f4=_0xd950f4[_0x0b73('0x9a')]('{'+_0x12f8b4[0x0]+'}',this[_0x0b73('0xb')][_0x0b73('0x9b')](_0x12f8b4[0x0])[_0x0b73('0x9c')]||_0x12f8b4[0x0]);}}if(_0x67b492[_0x0b73('0x99')]===0x1){return _0xd950f4[_0x0b73('0x9d')]();}return this['replaceAllVariables'](_0xd950f4);};AGIVertices[_0x0b73('0xd')][_0x0b73('0x9e')]=function(_0x569126,_0x11f282){var _0x95f2bd=this[_0x0b73('0xb')][_0x0b73('0x9b')](_0x569126);if(_0x95f2bd['result']===-0x1){return _0x95f2bd;}logger['info'](util[_0x0b73('0x24')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x11f282,_0x95f2bd[_0x0b73('0x9c')]));return this[_0x0b73('0xb')][_0x0b73('0x96')](_0x11f282,_0x95f2bd[_0x0b73('0x9c')]);};AGIVertices['prototype']['isConfigured']=function(_0x54316d){return _0x54316d&&_0x54316d!=='0'&&_0x54316d!=='-1'&&_0x54316d!=='';};AGIVertices[_0x0b73('0xd')][_0x0b73('0x9f')]=function(_0x5b18d6){this[_0x0b73('0x33')]['sync'](this,_0x5b18d6,'-');_0x5b18d6[_0x0b73('0xa0')]=_0x5b18d6[_0x0b73('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0b73('0xd')]['mrcpsynth']=function(_0x28ec06){logger['info'](util[_0x0b73('0x24')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x28ec06[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x28ec06[_0x0b73('0x5a')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xa3'));}var _0x3178cd='\x22'+_0x28ec06[_0x0b73('0x5a')]+'\x22';if(this[_0x0b73('0xa1')](_0x28ec06[_0x0b73('0x75')])){_0x3178cd+=','+_0x28ec06[_0x0b73('0x75')];}var _0x96e807=this[_0x0b73('0xb')][_0x0b73('0x55')](_0x0b73('0xa4'),_0x3178cd);if(_0x96e807[_0x0b73('0xa5')]===-0x1){return _0x96e807;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3178cd));};AGIVertices[_0x0b73('0xd')][_0x0b73('0xa6')]=function(_0x1808b5){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0xa7'),_0x1808b5[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x1808b5[_0x0b73('0xa8')])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0xa9'));}var _0x140661=_0x1808b5[_0x0b73('0xa8')];if(this['isConfigured'](_0x1808b5['options'])){_0x140661+=','+_0x1808b5[_0x0b73('0x75')];}var _0x26e28a=this[_0x0b73('0xb')][_0x0b73('0x55')](_0x0b73('0xaa'),_0x140661);if(_0x26e28a[_0x0b73('0xa5')]===-0x1){return _0x26e28a;}var _0x3a42aa=this[_0x0b73('0x9e')](_0x0b73('0xab'),_0x0b73('0xac'));if(_0x3a42aa[_0x0b73('0xa5')]===-0x1){return _0x3a42aa;}var _0x3fe64e=this['getAndSetVariable'](_0x0b73('0xad'),'MRCP_RECOG_TRANSCRIPT');if(_0x3fe64e[_0x0b73('0xa5')]===-0x1){return _0x3fe64e;}var _0x5597bb=this[_0x0b73('0x9e')](_0x0b73('0xae'),_0x0b73('0xaf'));if(_0x5597bb[_0x0b73('0xa5')]===-0x1){return _0x5597bb;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format'](_0x0b73('0xb0'),_0x140661));};AGIVertices[_0x0b73('0xd')]['agi']=function(_0xfd3bcf){logger['info'](util[_0x0b73('0x24')](_0x0b73('0xb1'),_0xfd3bcf['label']));return this[_0x0b73('0xb')][_0x0b73('0xb2')]([_0xfd3bcf[_0x0b73('0xb3')],_0xfd3bcf[_0x0b73('0xb4')]]);};AGIVertices[_0x0b73('0xd')][_0x0b73('0xb5')]=function(_0x132302){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0xb6'),_0x132302[_0x0b73('0x35')]));if(this['isConfigured'](_0x132302[_0x0b73('0x63')])){logger['info'](util[_0x0b73('0x24')](_0x0b73('0xb7'),_0x132302[_0x0b73('0x63')]));var _0x35da33=this['channel'][_0x0b73('0xb8')](_0x132302[_0x0b73('0x63')]);if(_0x35da33[_0x0b73('0xa5')]===-0x1){return _0x35da33;}}return this[_0x0b73('0xb')][_0x0b73('0xb5')]();};AGIVertices['prototype'][_0x0b73('0x48')]=function(_0xb30ee8){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0xb9'),_0xb30ee8[_0x0b73('0x35')]));if(!this['isConfigured'](_0xb30ee8[_0x0b73('0x46')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0xb30ee8,_0x0b73('0xba'));}_0xb30ee8[_0x0b73('0x47')]=moment();if(this[_0x0b73('0xa1')](_0xb30ee8[_0x0b73('0xbb')])){_0xb30ee8[_0x0b73('0x47')]=moment()[_0x0b73('0xbc')](_0xb30ee8[_0x0b73('0xbb')],_0x0b73('0xbd'));}if(!this[_0x0b73('0xa1')](_0xb30ee8[_0x0b73('0x4a')])){_0xb30ee8[_0x0b73('0x4a')]=0x2;}this[_0x0b73('0x40')][_0x0b73('0xbe')](this,_0xb30ee8);return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xbf'),_0xb30ee8[_0x0b73('0x45')],_0xb30ee8[_0x0b73('0x46')],_0xb30ee8[_0x0b73('0x47')]));};AGIVertices[_0x0b73('0xd')][_0x0b73('0xc0')]=function(_0x43000e){logger['info'](util[_0x0b73('0x24')](_0x0b73('0xc1'),_0x43000e[_0x0b73('0x35')]));var _0xd1ba=this['channel'][_0x0b73('0x55')](_0x43000e[_0x0b73('0xc2')],_0x43000e[_0x0b73('0x75')]);if(_0xd1ba[_0x0b73('0xa5')]===-0x1){return _0xd1ba;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xc3'),_0x43000e[_0x0b73('0xc2')],_0x43000e[_0x0b73('0x75')]));};AGIVertices[_0x0b73('0xd')][_0x0b73('0xc4')]=function(_0x4eb3fc){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0xc5'),_0x4eb3fc['label']));if(!this[_0x0b73('0xa1')](_0x4eb3fc[_0x0b73('0x5a')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0xa3'));}var _0x211e42='\x22'+_0x4eb3fc[_0x0b73('0x5a')]+'\x22';if(this[_0x0b73('0xa1')](_0x4eb3fc[_0x0b73('0x75')])){_0x211e42+=','+_0x4eb3fc['options'];}var _0x2967e6=this[_0x0b73('0xb')][_0x0b73('0x55')](_0x0b73('0xa4'),_0x211e42);if(_0x2967e6['result']===-0x1){return _0x2967e6;}return this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')]('Executed\x20command\x20MRCPSynth\x20%s',_0x211e42));};AGIVertices['prototype'][_0x0b73('0xc6')]=function(_0xd1bfe5){logger['info'](util[_0x0b73('0x24')](_0x0b73('0xc7'),_0xd1bfe5[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0xd1bfe5[_0x0b73('0x5a')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0xa3'));}var _0x3241df='\x22'+_0xd1bfe5[_0x0b73('0x5a')]+'\x22';if(this[_0x0b73('0xa1')](_0xd1bfe5['options'])){_0x3241df+=','+_0xd1bfe5['options'];}var _0x5c5be1=this[_0x0b73('0xb')]['exec']('MRCPSynth',_0x3241df);if(_0x5c5be1['result']===-0x1){return _0x5c5be1;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xc8'),_0x3241df));};AGIVertices[_0x0b73('0xd')][_0x0b73('0xc9')]=function(_0x20da14){logger['info'](util[_0x0b73('0x24')](_0x0b73('0xca'),_0x20da14['label']));if(!this['isConfigured'](_0x20da14[_0x0b73('0xa8')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xa9'));}var _0x5c9cec=_0x20da14[_0x0b73('0xa8')];if(this[_0x0b73('0xa1')](_0x20da14[_0x0b73('0x75')])){_0x5c9cec+=','+_0x20da14[_0x0b73('0x75')];}var _0x261c3a=this[_0x0b73('0xb')][_0x0b73('0x55')](_0x0b73('0xaa'),_0x5c9cec);if(_0x261c3a[_0x0b73('0xa5')]===-0x1){return _0x261c3a;}var _0x1e67fd=this[_0x0b73('0x9e')](_0x0b73('0xab'),_0x0b73('0xcb'));if(_0x1e67fd[_0x0b73('0xa5')]===-0x1){return _0x1e67fd;}var _0x27e18d=this[_0x0b73('0x9e')](_0x0b73('0xad'),_0x0b73('0xcc'));if(_0x27e18d[_0x0b73('0xa5')]===-0x1){return _0x27e18d;}var _0x55caad=this['getAndSetVariable'](_0x0b73('0xae'),_0x0b73('0xcd'));if(_0x55caad[_0x0b73('0xa5')]===-0x1){return _0x55caad;}return this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')](_0x0b73('0xb0'),_0x5c9cec));};AGIVertices[_0x0b73('0xd')]['sestekasr']=function(_0x115c34){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0xce'),_0x115c34[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x115c34['grammar'])){return this[_0x0b73('0xb')][_0x0b73('0xa2')]('no\x20grammar\x20configured');}var _0x562bb8=_0x115c34[_0x0b73('0xa8')];if(this[_0x0b73('0xa1')](_0x115c34['options'])){_0x562bb8+=','+_0x115c34[_0x0b73('0x75')];}var _0x3cb432=this['channel'][_0x0b73('0x55')](_0x0b73('0xaa'),_0x562bb8);if(_0x3cb432[_0x0b73('0xa5')]===-0x1){return _0x3cb432;}var _0x42b530=this['getAndSetVariable'](_0x0b73('0xab'),_0x0b73('0xcf'));if(_0x42b530[_0x0b73('0xa5')]===-0x1){return _0x42b530;}var _0x24079b=this[_0x0b73('0x9e')](_0x0b73('0xad'),_0x0b73('0xd0'));if(_0x24079b['result']===-0x1){return _0x24079b;}var _0x3951f8=this[_0x0b73('0x9e')](_0x0b73('0xae'),_0x0b73('0xd1'));if(_0x3951f8[_0x0b73('0xa5')]===-0x1){return _0x3951f8;}return this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')](_0x0b73('0xb0'),_0x562bb8));};AGIVertices[_0x0b73('0xd')][_0x0b73('0xd2')]=function(_0x17c35b){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0xd3'),_0x17c35b[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x17c35b[_0x0b73('0xd4')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x17c35b,_0x0b73('0xd5'));}var _0x51bf0c=this['getSquareOdbc'][_0x0b73('0xbe')](this,_0x17c35b[_0x0b73('0xd4')]);if(!_0x51bf0c){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x17c35b,'no\x20odbc\x20database\x20found');}if(!this[_0x0b73('0xa1')](_0x17c35b[_0x0b73('0x2b')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x17c35b,_0x0b73('0xd6'));}var _0x26358e=_0x17c35b[_0x0b73('0x2b')][_0x0b73('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')]('query:\x20%s',_0x26358e));var _0x585960=this[_0x0b73('0x26')][_0x0b73('0xbe')](this,_0x51bf0c,_0x26358e);this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x17c35b,_0x26358e);if(!this[_0x0b73('0xa1')](_0x17c35b[_0x0b73('0xd7')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xd8'));}var _0x3882b8=this[_0x0b73('0x9b')][_0x0b73('0xbe')](this,_0x17c35b[_0x0b73('0xd7')]);if(!_0x3882b8){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x17c35b,_0x0b73('0xd9'));}var _0x4e5c49=this;_0x585960[_0x0b73('0xda')](function(_0x56071c,_0x3224f2){Object[_0x0b73('0xdb')](_0x56071c)[_0x0b73('0xda')](function(_0x4c9f65){_0x4e5c49[_0x0b73('0xb')]['setVariable'](util[_0x0b73('0x24')]('%s[%s][%s]',_0x3882b8,_0x3224f2,_0x4c9f65),_0x56071c[_0x4c9f65]);});});this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0xdc'),_0x3882b8),_0x585960[_0x0b73('0x99')]);return this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xdd'),_0x3882b8));};AGIVertices['prototype'][_0x0b73('0xde')]=function(_0x4743ce){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x4743ce[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x4743ce[_0x0b73('0xdf')])){return this['channel'][_0x0b73('0x28')](_0x4743ce,_0x0b73('0xe0'));}var _0x444c35=this[_0x0b73('0x16')][_0x0b73('0xbe')](this,_0x4743ce[_0x0b73('0xdf')]);if(!_0x444c35){return this['channel'][_0x0b73('0x28')](_0x4743ce,_0x0b73('0xe1'));}var _0x19d1d7=this['channel'][_0x0b73('0x55')]('DIAL',[util[_0x0b73('0x24')](_0x0b73('0xe2'),_0x444c35),_0x4743ce[_0x0b73('0x63')],_0x4743ce[_0x0b73('0xe3')],_0x4743ce[_0x0b73('0x61')]]);if(_0x19d1d7[_0x0b73('0xa5')]===-0x1){return _0x19d1d7;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xe4'),'DIAL'));};AGIVertices[_0x0b73('0xd')][_0x0b73('0xe5')]=function(_0x1e5780){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0xe6'),_0x1e5780[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x1e5780[_0x0b73('0x77')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xe7'));}if(!this['isConfigured'](_0x1e5780[_0x0b73('0x5a')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0xa3'));}this[_0x0b73('0xb')][_0x0b73('0xe8')]=!![];this[_0x0b73('0x33')](_0x1e5780);this[_0x0b73('0x3f')](_0x1e5780[_0x0b73('0x5a')],'in','','');this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format'](_0x0b73('0xe9'),_0x1e5780[_0x0b73('0x5a')]));var _0x1133c3=this[_0x0b73('0x76')]['sync'](this,_0x1e5780);if(_0x1133c3){for(var _0xa229c0 in _0x1133c3){if(_0x1133c3[_0x0b73('0x94')](_0xa229c0)){this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')]('DIALOGFLOW_%s',_0xa229c0['toUpperCase']()),_0x1133c3[_0xa229c0]);}}this[_0x0b73('0x3f')](_0x1133c3['speech'],_0x0b73('0xea'),'dialogflow','');return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xeb'),_0x1133c3[_0x0b73('0xec')]));}return this[_0x0b73('0xb')]['error'](_0x1e5780,_0x0b73('0xed'));};AGIVertices[_0x0b73('0xd')]['dialogflowV2']=function(_0x5633d3){logger['info'](util[_0x0b73('0x24')](_0x0b73('0xee'),_0x5633d3[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x5633d3['dialogflowV2_project_id'])){return this[_0x0b73('0xb')][_0x0b73('0xa2')]('no\x20project_id\x20configured');}if(!this[_0x0b73('0xa1')](_0x5633d3[_0x0b73('0x79')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xef'));}if(!this[_0x0b73('0xa1')](_0x5633d3[_0x0b73('0x7a')])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0xf0'));}if(!this[_0x0b73('0xa1')](_0x5633d3[_0x0b73('0x7b')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0xf1'));}if(!this[_0x0b73('0xa1')](_0x5633d3['text'])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xa3'));}this[_0x0b73('0xb')][_0x0b73('0xe8')]=!![];this[_0x0b73('0x33')](_0x5633d3);this[_0x0b73('0x3f')](_0x5633d3[_0x0b73('0x5a')],'in','','');this['channel']['noop'](util[_0x0b73('0x24')]('Trying\x20DialogflowV2:\x20%s',_0x5633d3[_0x0b73('0x5a')]));var _0x31b875=this[_0x0b73('0x78')]['sync'](this,_0x5633d3);if(_0x31b875){for(var _0x4eb11e in _0x31b875){if(_0x31b875['hasOwnProperty'](_0x4eb11e)){if(_0x4eb11e!==_0x0b73('0xf2')){this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0xf3'),_0x4eb11e['toUpperCase']()),_0x31b875[_0x4eb11e]);}}}this['createSquareMessage'](_0x31b875['speech'],_0x0b73('0xea'),_0x0b73('0xf4'),_0x31b875[_0x0b73('0xf2')]);return this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')]('DialogflowV2\x20Result\x20%s',_0x31b875[_0x0b73('0xec')]));}return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x5633d3,_0x0b73('0xf5'));};AGIVertices[_0x0b73('0xd')][_0x0b73('0xf6')]=function(_0x46aa15){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0xf7'),_0x46aa15[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x46aa15[_0x0b73('0xf8')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xf9'));}if(!this[_0x0b73('0xa1')](_0x46aa15[_0x0b73('0xfa')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')]('no\x20username\x20configured');}if(!this[_0x0b73('0xa1')](_0x46aa15[_0x0b73('0xfb')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xfc'));}if(!this[_0x0b73('0xa1')](_0x46aa15[_0x0b73('0xfd')])){return this[_0x0b73('0xb')]['noop']('no\x20text\x20configured');}this[_0x0b73('0xb')]['bot']=!![];this[_0x0b73('0x33')](_0x46aa15);this['createSquareMessage'](_0x46aa15[_0x0b73('0x5a')],'in','','');this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')]('Trying\x20SestekNDA:\x20%s',_0x46aa15[_0x0b73('0x5a')]));var _0x3a90f0=this['sestekNDA'][_0x0b73('0xbe')](this,_0x46aa15);if(_0x3a90f0){for(var _0xaf359c in _0x3a90f0){if(_0x3a90f0['hasOwnProperty'](_0xaf359c)){this[_0x0b73('0xb')][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0xfe'),_0xaf359c[_0x0b73('0x67')]()),_0x3a90f0[_0xaf359c]);}}this[_0x0b73('0x3f')](_0x3a90f0[_0x0b73('0xec')],_0x0b73('0xea'),'sesteknda','');if(_0x3a90f0[_0x0b73('0xff')]){this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x3a90f0[_0x0b73('0xff')]));var _0x2072b8=this[_0x0b73('0xb')][_0x0b73('0x100')](_0x3a90f0[_0x0b73('0xff')]);try{fs[_0x0b73('0x101')](_0x3a90f0[_0x0b73('0xff')]+'.wav');}catch(_0xa4ad4d){logger['error'](_0xa4ad4d);}return _0x2072b8;}else{return this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')](_0x0b73('0x102'),_0x3a90f0[_0x0b73('0xec')]));}}return this['channel'][_0x0b73('0x28')](_0x46aa15,_0x0b73('0x103'));};AGIVertices['prototype']['end']=function(_0x1e24db){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x104'),_0x1e24db[_0x0b73('0x35')]));return this['channel']['noop'](_0x0b73('0x105'));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x106')]=function(_0x352b10){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x352b10[_0x0b73('0x35')]));var _0x523cb3='';if(_0x352b10['trunk_id']){if(!this[_0x0b73('0xa1')](_0x352b10[_0x0b73('0x107')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x352b10,'no\x20trunk\x20selected');}else{var _0xaefd80=parseInt(_0x352b10['trunk_id'],0xa);if(isNaN(_0xaefd80)){_0x523cb3=_0x352b10['trunk_id'];}else{_0x523cb3=this[_0x0b73('0x108')][_0x0b73('0xbe')](this,_0x352b10[_0x0b73('0x107')]);if(!_0x523cb3){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x352b10,_0x0b73('0x109'));}}}}else if(_0x352b10[_0x0b73('0x10a')]){_0x523cb3=_0x352b10[_0x0b73('0x10a')];}else{return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x352b10,'no\x20trunk\x20selected');}var _0x57cd25=this['channel'][_0x0b73('0x55')]('DIAL',[util[_0x0b73('0x24')]('SIP/%s/%s',_0x523cb3,_0x352b10[_0x0b73('0x45')]),_0x352b10['timeout'],_0x352b10[_0x0b73('0xe3')],_0x352b10[_0x0b73('0x61')]]);if(_0x57cd25[_0x0b73('0xa5')]===-0x1){return _0x57cd25;}return this['channel'][_0x0b73('0xa2')](util['format'](_0x0b73('0xe4'),'DIAL'));};AGIVertices['prototype'][_0x0b73('0x10b')]=function(_0x17d8ff){logger[_0x0b73('0x2c')](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x17d8ff['label']));return this[_0x0b73('0xb')][_0x0b73('0xa2')]('finally');};AGIVertices['prototype']['getdigits']=function(_0x3ceca1){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x10c'),_0x3ceca1['label']));if(_0x3ceca1[_0x0b73('0xa0')]===0x0){return this['maxRetry'](_0x3ceca1);}_0x3ceca1[_0x0b73('0xa0')]-=0x1;if(!this[_0x0b73('0xa1')](_0x3ceca1[_0x0b73('0x10d')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x3ceca1,_0x0b73('0x10e'));}var _0x51eff0=this[_0x0b73('0x19')][_0x0b73('0xbe')](this,_0x3ceca1[_0x0b73('0x10d')]);if(!_0x51eff0){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x3ceca1,_0x0b73('0x10f'));}if(!this[_0x0b73('0xa1')](_0x3ceca1[_0x0b73('0xd7')])){return this[_0x0b73('0xb')][_0x0b73('0x28')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x53f8ae=this[_0x0b73('0xb')][_0x0b73('0x110')](_0x51eff0,_0x3ceca1[_0x0b73('0x111')],_0x3ceca1['maxdigit']);var _0x5b094d=_0x53f8ae[_0x0b73('0xa5')]?_0x53f8ae[_0x0b73('0xa5')][_0x0b73('0x9d')]():'';logger['info'](_0x0b73('0x112'),JSON[_0x0b73('0x70')](_0x53f8ae));if(_0x53f8ae[_0x0b73('0xa5')]===-0x1){this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x3ceca1,_0x5b094d);return _0x53f8ae;}else if(_0x53f8ae[_0x0b73('0x9c')]===_0x0b73('0x63')){_0x53f8ae[_0x0b73('0xa5')]=_0x5b094d[_0x0b73('0x99')]>=parseInt(_0x3ceca1[_0x0b73('0x113')])?'x':'i';}else{_0x53f8ae[_0x0b73('0xa5')]=_0x5b094d[_0x0b73('0x99')]>=parseInt(_0x3ceca1[_0x0b73('0x113')])&&_0x5b094d[_0x0b73('0x99')]<=parseInt(_0x3ceca1[_0x0b73('0x114')])?'x':'i';}var _0x43366a=this['getVariable'][_0x0b73('0xbe')](this,_0x3ceca1[_0x0b73('0xd7')]);if(!_0x43366a){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x3ceca1,_0x0b73('0xd9'));}this['channel']['setVariable'](_0x43366a,_0x5b094d);if(this['isConfigured'](_0x3ceca1['hiddendigitsnum'])){var _0x41a88a=parseInt(_0x3ceca1['hiddendigitsnum'],0xa);var _0x40f92b=rs[_0x0b73('0x115')]({'charset':'*','length':_0x41a88a});var _0x211221=_0x5b094d[_0x0b73('0x99')];if(_0x211221>0x0){if(_0x211221>_0x41a88a){this[_0x0b73('0x33')]['sync'](this,_0x3ceca1,_0x3ceca1['hiddendigitspos']==='first'?_0x40f92b+_0x5b094d[_0x0b73('0x116')](_0x41a88a):_0x5b094d[_0x0b73('0x116')](0x0,_0x211221-_0x41a88a)+_0x40f92b);}else{this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x3ceca1,rs[_0x0b73('0x115')]({'charset':'*','length':_0x211221}));}}else{this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x3ceca1,'');}}else{this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x3ceca1,_0x5b094d);}return _0x53f8ae;};AGIVertices['prototype']['getsecretdigits']=function(_0x166416){logger[_0x0b73('0x2c')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x166416[_0x0b73('0x35')]));return this[_0x0b73('0x9')](_0x166416);};AGIVertices[_0x0b73('0xd')][_0x0b73('0x117')]=function(_0x5a49f0){logger['info'](util[_0x0b73('0x24')](_0x0b73('0x118'),_0x5a49f0[_0x0b73('0x35')]));this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x5a49f0,_0x5a49f0['goalname']);return this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')](_0x0b73('0x119'),_0x5a49f0[_0x0b73('0x11a')]));};AGIVertices[_0x0b73('0xd')]['awspolly']=function(_0xcbd953){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x11b'),_0xcbd953[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0xcbd953[_0x0b73('0x11c')])||!this[_0x0b73('0xa1')](_0xcbd953[_0x0b73('0x82')])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0x11d'));}if(!this[_0x0b73('0xa1')](_0xcbd953[_0x0b73('0x5a')])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0xa3'));}this['channel'][_0x0b73('0xa2')](util['format']('Trying\x20aws\x20Polly\x20%s',_0xcbd953[_0x0b73('0x5a')]));var _0x37488a=this[_0x0b73('0x81')][_0x0b73('0xbe')](this,_0xcbd953);if(_0x37488a){this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x11e'),_0x37488a));var _0x1eff8c=this[_0x0b73('0xb')][_0x0b73('0x100')](_0x37488a);try{fs[_0x0b73('0x101')](_0x37488a+_0x0b73('0x11f'));}catch(_0x554a12){logger[_0x0b73('0x28')](_0x554a12);}return _0x1eff8c;}return this[_0x0b73('0xb')][_0x0b73('0x28')](_0xcbd953,_0x0b73('0x120'));};AGIVertices[_0x0b73('0xd')]['awslex']=function(_0x65c16c){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x121'),_0x65c16c['label']));if(!this[_0x0b73('0xa1')](_0x65c16c[_0x0b73('0x11c')])||!this[_0x0b73('0xa1')](_0x65c16c['aws_secret_access_key'])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0x11d'));}if(!this['isConfigured'](_0x65c16c['aws_bot_name'])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x122'));}if(!this[_0x0b73('0xa1')](_0x65c16c[_0x0b73('0x5a')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xa3'));}this['channel']['bot']=!![];this[_0x0b73('0x33')](_0x65c16c);this[_0x0b73('0x3f')](_0x65c16c[_0x0b73('0x5a')],'in','','');this['channel']['noop'](util['format'](_0x0b73('0x123'),_0x65c16c[_0x0b73('0x5a')]));var _0x20c24f=this['awsLex']['sync'](this,_0x65c16c);if(_0x20c24f){for(var _0x7af1af in _0x20c24f){if(_0x20c24f['hasOwnProperty'](_0x7af1af)&&_[_0x0b73('0x92')](_0x20c24f[_0x7af1af])){this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0x124'),_0x7af1af['toUpperCase']()),_0x20c24f[_0x7af1af]);}}if(_[_0x0b73('0x4e')](_0x20c24f[_0x0b73('0x73')])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0x125'));}else{this[_0x0b73('0x3f')](_0x20c24f[_0x0b73('0x73')],_0x0b73('0xea'),_0x0b73('0x126'),'');return this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')]('Amazon\x20Lex\x20Result\x20%s',_0x20c24f[_0x0b73('0x73')]));}}return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x65c16c,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x0b73('0xd')][_0x0b73('0x127')]=function(_0x2bcadb){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x128'),_0x2bcadb[_0x0b73('0x35')],_0x2bcadb[_0x0b73('0x63')]));if(!this['isConfigured'](_0x2bcadb[_0x0b73('0x77')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0xe7'));}var _0x54c950=_0x0b73('0x129');var _0x44324a=util['format'](_0x0b73('0x12a'),FILES_PATH,rs['generate'](0x4));var _0x4a9cf3=util[_0x0b73('0x24')]('%s.%s',_0x44324a,_0x54c950);var _0x384200=!![];if(_0x2bcadb[_0x0b73('0x12b')]===_0x0b73('0x12c')){_0x384200=![];}var _0x1114b6=this[_0x0b73('0xb')][_0x0b73('0x12d')](_0x44324a,_0x54c950,_0x2bcadb[_0x0b73('0x12e')],_0x2bcadb['timeout'],undefined,_0x384200);if(_0x1114b6[_0x0b73('0xa5')]!==-0x1){this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')]('google\x20%s\x20file\x20created',_0x4a9cf3));var _0x225778=this[_0x0b73('0x12f')][_0x0b73('0xbe')](this,_0x2bcadb,_0x4a9cf3);if(_0x225778){for(var _0x436cdc in _0x225778){if(_0x225778[_0x0b73('0x94')](_0x436cdc)){this[_0x0b73('0xb')][_0x0b73('0x96')](util['format'](_0x0b73('0x130'),_0x436cdc['toUpperCase']()),_0x225778[_0x436cdc]);}}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x131'),JSON[_0x0b73('0x70')](_0x225778)));}}return _0x1114b6;};AGIVertices[_0x0b73('0xd')][_0x0b73('0x132')]=function(_0xd2f7c9){logger['info'](util[_0x0b73('0x24')](_0x0b73('0x133'),_0xd2f7c9[_0x0b73('0x35')]));if(!this['isConfigured'](_0xd2f7c9[_0x0b73('0x8a')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0x134'));}if(!this[_0x0b73('0xa1')](_0xd2f7c9[_0x0b73('0x8b')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x135'));}var _0x2d82ce=_0x0b73('0x129');var _0x564eaf=util[_0x0b73('0x24')](_0x0b73('0x12a'),FILES_PATH,rs[_0x0b73('0x115')](0x4));var _0x1cacda=util['format'](_0x0b73('0x95'),_0x564eaf,_0x2d82ce);var _0x12e176=!![];if(_0xd2f7c9[_0x0b73('0x12b')]===_0x0b73('0x12c')){_0x12e176=![];}var _0x25be7b=this[_0x0b73('0xb')][_0x0b73('0x12d')](_0x564eaf,_0x2d82ce,_0xd2f7c9[_0x0b73('0x12e')],_0xd2f7c9[_0x0b73('0x63')],undefined,_0x12e176);if(_0x25be7b[_0x0b73('0xa5')]!==-0x1){this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')]('tilde\x20%s\x20file\x20created',_0x1cacda));var _0x3ed7e3=this[_0x0b73('0x89')]['sync'](this,_0xd2f7c9,_0x1cacda);if(_0x3ed7e3){for(var _0x15c46b in _0x3ed7e3){if(_0x3ed7e3['hasOwnProperty'](_0x15c46b)){this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0x136'),_0x15c46b[_0x0b73('0x67')]()),_0x3ed7e3[_0x15c46b]);}}return this[_0x0b73('0xb')]['noop'](util['format'](_0x0b73('0x137'),JSON['stringify'](_0x3ed7e3)));}}return _0x25be7b;};AGIVertices[_0x0b73('0xd')][_0x0b73('0x138')]=function(_0x5a4c50){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x139'),_0x5a4c50[_0x0b73('0x35')]));return this['channel'][_0x0b73('0x13a')](_0x5a4c50[_0x0b73('0x3a')],_0x5a4c50[_0x0b73('0x3b')],_0x5a4c50[_0x0b73('0x3c')]);};AGIVertices[_0x0b73('0xd')][_0x0b73('0x13b')]=function(_0x1dec68){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x13c'),_0x1dec68['label']));if(!this['isConfigured'](_0x1dec68[_0x0b73('0x13d')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x1dec68,_0x0b73('0x13e'));}try{var _0x5ae746=eval(_0x1dec68[_0x0b73('0x13d')])?_0x0b73('0x13f'):_0x0b73('0x140');this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')](_0x0b73('0x141'),_0x1dec68[_0x0b73('0x13d')],_0x5ae746));return{'code':0xc8,'result':_0x5ae746};}catch(_0x13ceb3){return{'code':0xc8,'result':_0x0b73('0x140')};}};AGIVertices[_0x0b73('0xd')][_0x0b73('0x142')]=function(_0x438980){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x143'),_0x438980[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x438980[_0x0b73('0x144')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x438980,_0x0b73('0x145'));}var _0x1f79ab=this[_0x0b73('0x1f')][_0x0b73('0xbe')](this,_0x438980[_0x0b73('0x144')]);if(!_0x1f79ab){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x438980,_0x0b73('0x146'));}for(var _0x50144e=0x0;_0x50144e<_0x1f79ab[_0x0b73('0x99')];_0x50144e+=0x1){var _0x12ccdc=this[_0x0b73('0xb')]['getVariable'](util[_0x0b73('0x24')](_0x0b73('0x147'),_0x1f79ab[_0x50144e]));if(_0x12ccdc[_0x0b73('0xa5')]===-0x1){return _0x12ccdc;}logger['info'](util[_0x0b73('0x24')](_0x0b73('0x148'),_0x1f79ab[_0x50144e],_0x12ccdc[_0x0b73('0x9c')]));if(_0x12ccdc[_0x0b73('0x9c')]===_0x0b73('0x13f')){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x148'),_0x1f79ab[_0x50144e],_0x0b73('0x13f')));this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x148'),_0x1f79ab[_0x50144e],_0x0b73('0x13f')));return{'code':0xc8,'result':'true'};}else{logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x148'),_0x1f79ab[_0x50144e],_0x0b73('0x140')));this['channel']['noop'](util['format']('IFTIME\x20%s\x20%s',_0x1f79ab[_0x50144e],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x0b73('0xd')][_0x0b73('0x149')]=function(_0x592ec4){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x14a'),_0x592ec4['label']));return this[_0x0b73('0xb')][_0x0b73('0x149')]();};AGIVertices[_0x0b73('0xd')][_0x0b73('0x14b')]=function(_0x118551){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x14c'),_0x118551[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x118551[_0x0b73('0x77')])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0xe7'));}var _0x22d3f6=_0x0b73('0x129');var _0x1dca35=util[_0x0b73('0x24')](_0x0b73('0x12a'),FILES_PATH,rs[_0x0b73('0x115')](0x4));var _0x4e82f2=util[_0x0b73('0x24')](_0x0b73('0x95'),_0x1dca35,_0x22d3f6);var _0x21e1e3=!![];if(_0x118551[_0x0b73('0x12b')]===_0x0b73('0x12c')){_0x21e1e3=![];}var _0x3605d4=this[_0x0b73('0xb')][_0x0b73('0x12d')](_0x1dca35,_0x22d3f6,_0x118551[_0x0b73('0x12e')],_0x118551['timeout'],undefined,_0x21e1e3);if(_0x3605d4[_0x0b73('0xa5')]!==-0x1){this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format']('ispeech\x20%s\x20file\x20created',_0x4e82f2));var _0x5e1f2d=this[_0x0b73('0x7f')][_0x0b73('0xbe')](this,_0x118551,_0x4e82f2);if(_0x5e1f2d){for(var _0x7d251b in _0x5e1f2d){if(_0x5e1f2d[_0x0b73('0x94')](_0x7d251b)){this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')]('ISPEECH_ASR_%s',_0x7d251b['toUpperCase']()),_0x5e1f2d[_0x7d251b]);}}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x14d'),JSON[_0x0b73('0x70')](_0x5e1f2d)));}}return _0x3605d4;};AGIVertices[_0x0b73('0xd')]['ispeechtts']=function(_0x47e83b){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x14e'),_0x47e83b[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x47e83b[_0x0b73('0x77')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')]('no\x20key\x20configured');}if(!this[_0x0b73('0xa1')](_0x47e83b[_0x0b73('0x5a')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0xa3'));}this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x14f'),_0x47e83b['text']));var _0x46d5a0=this[_0x0b73('0x7d')][_0x0b73('0xbe')](this,_0x47e83b);if(_0x46d5a0){this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format']('ispeech\x20%s\x20file\x20created',_0x46d5a0));var _0x14add4=this[_0x0b73('0xb')][_0x0b73('0x100')](_0x46d5a0,_0x47e83b[_0x0b73('0x12e')]);try{fs[_0x0b73('0x101')](_0x46d5a0+_0x0b73('0x11f'));}catch(_0x1afae1){logger[_0x0b73('0x28')](_0x1afae1);}return _0x14add4;}return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x47e83b,_0x0b73('0x150'));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x151')]=function(_0x4eff9b){logger['info'](util[_0x0b73('0x24')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x4eff9b['label']));if(!this['isConfigured'](_0x4eff9b[_0x0b73('0x152')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x4eff9b,'no\x20find\x20by\x20configured');}logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x153'),this[_0x0b73('0xb')]['callerid'],_0x4eff9b[_0x0b73('0x152')]));var _0x3cf3c4=this[_0x0b73('0x51')][_0x0b73('0xbe')](this,_0x4eff9b[_0x0b73('0x152')]);if(_0x3cf3c4){logger['info'](util[_0x0b73('0x24')](_0x0b73('0x154'),this['channel'][_0x0b73('0x38')],_0x4eff9b['findBy']));this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x0b73('0x38')],_0x4eff9b[_0x0b73('0x152')]));return{'code':0xc8,'result':_0x0b73('0x155')};}else{logger['info'](util[_0x0b73('0x24')](_0x0b73('0x156'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x4eff9b[_0x0b73('0x152')]));this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x156'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x4eff9b[_0x0b73('0x152')]));return{'code':0xc8,'result':_0x0b73('0x157')};}};AGIVertices[_0x0b73('0xd')][_0x0b73('0x158')]=function(_0x545664){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x545664[_0x0b73('0x35')]));if(!this['isConfigured'](_0x545664[_0x0b73('0x152')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x545664,_0x0b73('0x159'));}logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x153'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x545664['findBy']));var _0x487b8a=this['agentLogout']['sync'](this,_0x545664['findBy']);if(_0x487b8a){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x154'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x545664[_0x0b73('0x152')]));this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0b73('0xb')][_0x0b73('0x38')],_0x545664[_0x0b73('0x152')]));return{'code':0xc8,'result':_0x0b73('0x155')};}else{logger['info'](util[_0x0b73('0x24')](_0x0b73('0x156'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x545664[_0x0b73('0x152')]));this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x156'),this['channel']['callerid'],_0x545664[_0x0b73('0x152')]));return{'code':0xc8,'result':_0x0b73('0x157')};}};AGIVertices[_0x0b73('0xd')]['math']=function(_0x1b6c03){logger[_0x0b73('0x2c')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x1b6c03[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x1b6c03[_0x0b73('0x15a')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x1b6c03,_0x0b73('0x15b'));}this['channel'][_0x0b73('0xa2')](util['format'](_0x0b73('0x15c'),_0x1b6c03[_0x0b73('0x15a')]));var _0x238dc3=eval(_0x1b6c03[_0x0b73('0x15a')]);if(!this['isConfigured'](_0x1b6c03['variable_id'])){return this[_0x0b73('0xb')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3b4cac=this['getVariable']['sync'](this,_0x1b6c03['variable_id']);if(!_0x3b4cac){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x1b6c03,_0x0b73('0xd9'));}if(_[_0x0b73('0x91')](_0x238dc3)){var _0xff7759=this;_0x238dc3[_0x0b73('0xda')](function(_0x2f52a5,_0x5c8333){_0xff7759['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0x15d'),_0x3b4cac,_0x5c8333),_0x2f52a5);});return this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format'](_0x0b73('0x15e'),_0x3b4cac));}else{return this['channel']['setVariable'](_0x3b4cac,_0x238dc3);}};AGIVertices[_0x0b73('0xd')]['menu']=function(_0x92dfda){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x15f'),_0x92dfda['label']));if(_0x92dfda[_0x0b73('0xa0')]===0x0){return this[_0x0b73('0x9f')](_0x92dfda);}_0x92dfda[_0x0b73('0xa0')]-=0x1;if(!this['isConfigured'](_0x92dfda[_0x0b73('0x10d')])){return this[_0x0b73('0xb')]['error'](_0x92dfda,_0x0b73('0x10e'));}var _0x509c34=this['getSound'][_0x0b73('0xbe')](this,_0x92dfda['file_id']);if(!_0x509c34){return this['channel']['error'](_0x92dfda,_0x0b73('0x10f'));}var _0x32dfbf=this[_0x0b73('0xb')][_0x0b73('0x110')](_0x509c34,_0x92dfda['response'],_0x92dfda[_0x0b73('0x160')]);var _0x5acbcd=_0x32dfbf['result'];if(_0x32dfbf[_0x0b73('0xa5')]===-0x1){this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x92dfda,'-1');return _0x32dfbf;}else if(_0x32dfbf['extra']===_0x0b73('0x63')){_0x32dfbf[_0x0b73('0xa5')]=_0x32dfbf[_0x0b73('0xa5')][_0x0b73('0x99')]>0x0?_0x32dfbf[_0x0b73('0xa5')]:'t';}else if(_[_0x0b73('0x41')](_0x32dfbf['result'])){_0x32dfbf[_0x0b73('0xa5')]='#';_0x5acbcd='#';}if(!this[_0x0b73('0xa1')](_0x92dfda[_0x0b73('0xd7')])){this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xd8'));}else{var _0x5e1c81=this['getVariable']['sync'](this,_0x92dfda[_0x0b73('0xd7')]);if(!_0x5e1c81){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x92dfda,_0x0b73('0xd9'));}this[_0x0b73('0xb')]['setVariable'](_0x5e1c81,_0x5acbcd);}this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x92dfda,_0x5acbcd);return _0x32dfbf;};AGIVertices[_0x0b73('0xd')][_0x0b73('0xa2')]=function(_0x10b9a4){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x161'),_0x10b9a4[_0x0b73('0x35')]));return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x10b9a4[_0x0b73('0x162')]||_0x10b9a4['label']);};AGIVertices[_0x0b73('0xd')][_0x0b73('0x163')]=function(_0x45c895){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x164'),_0x45c895['label']));if(!this[_0x0b73('0xa1')](_0x45c895['findBy'])){return this[_0x0b73('0xb')]['error'](_0x45c895,'no\x20find\x20by\x20configured');}logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x153'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x45c895['findBy']));var _0x10d409=this[_0x0b73('0x4b')]['sync'](this,_0x45c895[_0x0b73('0x165')]);var _0xa5fbc8=this[_0x0b73('0x4d')][_0x0b73('0xbe')](this,_0x45c895[_0x0b73('0x152')],_0x10d409);if(_0xa5fbc8){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x154'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x45c895[_0x0b73('0x152')]));this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x154'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x45c895['findBy']));return{'code':0xc8,'result':_0x0b73('0x155')};}else{logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x156'),this['channel'][_0x0b73('0x38')],_0x45c895[_0x0b73('0x152')]));this['channel'][_0x0b73('0xa2')](util['format'](_0x0b73('0x154'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x45c895[_0x0b73('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0b73('0xd')][_0x0b73('0x166')]=function(_0x7813dc){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x7813dc['label']));if(!this[_0x0b73('0xa1')](_0x7813dc[_0x0b73('0x10d')])){return this[_0x0b73('0xb')]['error'](_0x7813dc,'no\x20file\x20audio\x20selected');}var _0x3be651=this['getSound'][_0x0b73('0xbe')](this,_0x7813dc[_0x0b73('0x10d')]);if(!_0x3be651){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x7813dc,_0x0b73('0x10f'));}var _0x79dfec=this['channel'][_0x0b73('0x55')]('PLAYBACK',[_0x3be651,_0x7813dc['opts']]);if(_0x79dfec['result']===-0x1){return _0x79dfec;}return this['channel'][_0x0b73('0xa2')](util['format']('Executed\x20command\x20%s\x20%s',_0x0b73('0x167'),_0x3be651));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x168')]=function(_0x3c09da){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x169'),_0x3c09da[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x3c09da['queue_id'])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x3c09da,_0x0b73('0x16a'));}var _0x1a406c='';var _0x1fd819=parseInt(_0x3c09da['queue_id'],0xa);if(isNaN(_0x1fd819)){_0x1a406c=_0x3c09da[_0x0b73('0x16b')];}else{_0x1a406c=this[_0x0b73('0x12')][_0x0b73('0xbe')](this,_0x3c09da[_0x0b73('0x16b')]);if(!_0x1a406c){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x3c09da,_0x0b73('0x16c'));}}var _0x24f8e4='';if(this[_0x0b73('0xa1')](_0x3c09da[_0x0b73('0x10d')])){var _0x5f592c=this[_0x0b73('0x19')][_0x0b73('0xbe')](this,_0x3c09da[_0x0b73('0x10d')]);if(_0x5f592c){_0x24f8e4=_0x5f592c;}}this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x3c09da,_0x1a406c);if(_0x3c09da[_0x0b73('0xe3')][_0x0b73('0x16d')]('x')<0x0){_0x3c09da[_0x0b73('0xe3')]+='x';}if(_0x3c09da['opts'][_0x0b73('0x16d')]('X')<0x0){_0x3c09da[_0x0b73('0xe3')]+='X';}this[_0x0b73('0xb')]['setVariable'](_0x0b73('0x16e'),_0x1a406c?_0x1a406c[_0x0b73('0x16f')]():'');var _0x10afd5=this['channel'][_0x0b73('0x55')](_0x0b73('0x170'),[_0x1a406c,_0x3c09da['opts'],_0x3c09da[_0x0b73('0x61')],_0x24f8e4,_0x3c09da[_0x0b73('0x63')],_0x3c09da[_0x0b73('0xb2')],_0x3c09da['macro'],_0x3c09da['gosub'],'',_0x3c09da[_0x0b73('0x171')]]);if(_0x10afd5['result']===-0x1){return _0x10afd5;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xc3'),_0x0b73('0x170'),_0x1a406c));};AGIVertices[_0x0b73('0xd')]['record']=function(_0x1bd33b){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x172'),_0x1bd33b['label']));var _0x10c67f=_0x1bd33b['recordingFormat']||_0x0b73('0x129');var _0x332fb0=util[_0x0b73('0x24')](_0x0b73('0x173'),this[_0x0b73('0xb')][_0x0b73('0x34')],rs[_0x0b73('0x115')](0x5));var _0x56923b=util[_0x0b73('0x24')](_0x0b73('0x174'),FILES_PATH,_0x332fb0,_0x10c67f);var _0x3de250=util[_0x0b73('0x24')]('%s/recordings/%s',FILES_PATH,_0x332fb0);this[_0x0b73('0x39')][_0x0b73('0xbe')](this,_0x1bd33b,_0x332fb0,_0x56923b);this[_0x0b73('0xb')]['setVariable'](_0x0b73('0x175'),_0x332fb0);logger[_0x0b73('0x2c')](_0x0b73('0x176'),_0x3de250,_0x10c67f,_0x1bd33b[_0x0b73('0x177')],_0x1bd33b[_0x0b73('0x63')]);return this['channel'][_0x0b73('0x12d')](_0x3de250,_0x10c67f,_0x1bd33b[_0x0b73('0x177')],_0x1bd33b[_0x0b73('0x63')],undefined,!![]);};AGIVertices[_0x0b73('0xd')][_0x0b73('0x178')]=function(_0x59ec5a){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x179'),_0x59ec5a[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x59ec5a['url'])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0x17a'));}var _0x4be3b0=this[_0x0b73('0x17b')]['sync'](this,_0x59ec5a);logger[_0x0b73('0x2c')](util[_0x0b73('0x24')]('Response:',util['inspect'](_0x4be3b0,{'showHidden':![],'depth':null})));if(!this[_0x0b73('0xa1')](_0x59ec5a['variable_id'])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x17c'));}var _0x3096d2=this[_0x0b73('0x9b')][_0x0b73('0xbe')](this,_0x59ec5a['variable_id']);if(!_0x3096d2){return this[_0x0b73('0xb')]['error'](_0x59ec5a,_0x0b73('0xd9'));}this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0x17d'),_0x3096d2),_0x4be3b0[_0x0b73('0x72')]?_0x4be3b0[_0x0b73('0x72')]:'200');this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0x17e'),_0x3096d2),_0x4be3b0[_0x0b73('0x71')]?_0x4be3b0[_0x0b73('0x71')]:'OK');if(_0x4be3b0[_0x0b73('0x68')]){try{this[_0x0b73('0x93')](_0x4be3b0[_0x0b73('0x68')],_0x3096d2);}catch(_0xd2e16){logger[_0x0b73('0x28')](util['format'](_0x0b73('0x17f'),_0x3096d2));}}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format'](_0x0b73('0xdd'),_0x3096d2));};AGIVertices['prototype']['saydigits']=function(_0x160b1a){logger[_0x0b73('0x2c')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x160b1a[_0x0b73('0x35')]));return this[_0x0b73('0xb')][_0x0b73('0x180')](_0x160b1a[_0x0b73('0x181')]['replace'](/\s+/g,''),_0x160b1a[_0x0b73('0x177')]);};AGIVertices['prototype'][_0x0b73('0x182')]=function(_0x3de5c7){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x183'),_0x3de5c7[_0x0b73('0x35')]));return this[_0x0b73('0xb')][_0x0b73('0x184')](_0x3de5c7[_0x0b73('0x64')][_0x0b73('0x57')](/\s+/g,''),_0x3de5c7[_0x0b73('0x177')]);};AGIVertices['prototype']['sayphonetic']=function(_0x584ace){logger['info'](util[_0x0b73('0x24')](_0x0b73('0x185'),_0x584ace[_0x0b73('0x35')]));return this['channel']['sayPhonetic'](_0x584ace[_0x0b73('0x5a')],_0x584ace[_0x0b73('0x177')]);};AGIVertices[_0x0b73('0xd')]['sendMail']=function(_0x318799){logger['info'](util[_0x0b73('0x24')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x318799[_0x0b73('0x35')]));if(!this['isConfigured'](_0x318799[_0x0b73('0x186')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x187'));}var _0x288215=this['getMailAccount'][_0x0b73('0xbe')](this,_0x318799[_0x0b73('0x186')]);if(!_0x288215||!_0x288215[_0x0b73('0x188')]){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x318799,_0x0b73('0x189'));}var _0x43bf56={'from':util[_0x0b73('0x24')]('\x22%s\x22\x20<%s>',_0x288215[_0x0b73('0x10')],_0x288215[_0x0b73('0x18a')]||_0x288215[_0x0b73('0x188')][_0x0b73('0x18b')]),'to':_0x318799['to']||'','cc':_0x318799['cc']||'','bcc':_0x318799['bcc']||'','subject':_0x318799[_0x0b73('0x18c')],'html':_0x318799[_0x0b73('0x5a')],'text':_0x318799[_0x0b73('0x5a')]};var _0x1a2f0d={'tls':{'rejectUnauthorized':![]}};if(_0x288215[_0x0b73('0x188')][_0x0b73('0x18d')]){_0x1a2f0d[_0x0b73('0x18d')]=_0x288215[_0x0b73('0x188')][_0x0b73('0x18d')];}else{_0x1a2f0d[_0x0b73('0x18e')]=_0x288215[_0x0b73('0x188')][_0x0b73('0x18e')];_0x1a2f0d[_0x0b73('0x18f')]=_0x288215[_0x0b73('0x188')][_0x0b73('0x18f')];_0x1a2f0d['secure']=_0x288215[_0x0b73('0x188')][_0x0b73('0x190')];}if(_0x288215['Smtp']['authentication']){_0x1a2f0d[_0x0b73('0x191')]={'user':_0x288215[_0x0b73('0x188')][_0x0b73('0x18b')],'pass':_0x288215[_0x0b73('0x188')]['pass']};}if(this['isConfigured'](_0x318799[_0x0b73('0x192')])){}logger['debug'](_0x0b73('0x193'),JSON['stringify'](_0x43bf56));this['createSquareDetailsReport']['sync'](this,_0x318799,_0x318799[_0x0b73('0x186')]);this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x288215['name']));this[_0x0b73('0x1e')][_0x0b73('0xbe')](this,_0x1a2f0d,_0x43bf56);return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x194'));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x195')]=function(_0x2431e6){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x196'),_0x2431e6[_0x0b73('0x35')]));return this['channel'][_0x0b73('0xa2')](_0x0b73('0x197'));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x198')]=function(_0x4fe567){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x199'),_0x4fe567[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x4fe567[_0x0b73('0x19a')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0x19b'));}var _0x4b1917=this[_0x0b73('0x30')][_0x0b73('0xbe')](this,_0x4fe567[_0x0b73('0x19a')]);if(!_0x4b1917){return this['channel'][_0x0b73('0x28')](_0x4fe567,_0x0b73('0x19c'));}var _0x96bc54={'body':_0x4fe567[_0x0b73('0x19d')],'phone':_0x4fe567['to']||'','SmsAccountId':_0x4b1917['id']};logger['debug'](_0x0b73('0x19e'),JSON[_0x0b73('0x70')](_0x96bc54));this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x4fe567,_0x4fe567[_0x0b73('0x19a')]);this[_0x0b73('0xb')]['noop'](util['format'](_0x0b73('0x19f'),_0x4b1917['name']));this['createSmsMessage'][_0x0b73('0xbe')](this,_0x96bc54);return this['channel'][_0x0b73('0xa2')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1a0')]=function(_0x38fd24){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x1a1'),_0x38fd24[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x38fd24[_0x0b73('0xd7')])){return this['channel'][_0x0b73('0x28')](_0x38fd24,_0x0b73('0x1a2'));}var _0x38cf12=this['getVariable']['sync'](this,_0x38fd24[_0x0b73('0xd7')]);if(!_0x38cf12){return this['channel'][_0x0b73('0x28')](_0x38fd24,_0x0b73('0xd9'));}return this[_0x0b73('0xb')][_0x0b73('0x96')](_0x38cf12,_0x38fd24[_0x0b73('0x1a3')]);};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1a4')]=function(_0x17862e){logger['info'](util['format'](_0x0b73('0x1a5'),_0x17862e['label']));this['channel'][_0x0b73('0xa2')](_0x0b73('0x1a6'));if(_0x17862e['answer']===_0x0b73('0x1a7')){this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x1a8'));return this[_0x0b73('0xb')][_0x0b73('0xb5')]();}return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x1a9'));};AGIVertices[_0x0b73('0xd')]['subproject']=function(_0x6e8b93){logger['info'](util['format'](_0x0b73('0x1aa'),_0x6e8b93[_0x0b73('0x35')]));if(!this['isConfigured'](_0x6e8b93[_0x0b73('0x1ab')])){return this[_0x0b73('0xb')]['error'](_0x6e8b93,_0x0b73('0x1ac'));}var _0x3ebd46=this[_0x0b73('0x1ad')][_0x0b73('0xbe')](this,_0x6e8b93['project_id']);if(!this['isConfigured'](_0x3ebd46)){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x6e8b93,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x6e8b93['project_id']));}if(_0x3ebd46===this[_0x0b73('0xb')][_0x0b73('0x37')]){return this['channel'][_0x0b73('0x28')](_0x6e8b93,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x6e8b93,_0x3ebd46);var _0x50ff61=this['channel'][_0x0b73('0x55')](_0x0b73('0x1ae'),util[_0x0b73('0x24')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x0b73('0xb2')]['host']||_0x0b73('0x1af'),_0x3ebd46,this[_0x0b73('0xb')][_0x0b73('0x37')]));if(_0x50ff61[_0x0b73('0xa5')]===-0x1){return _0x50ff61;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xc3'),'AGI',_0x3ebd46));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1b0')]=function(_0xe82e29){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0xe82e29['label']));var _0x3a500a=this['shellCommand']['sync'](this,_0xe82e29[_0x0b73('0xb3')]);this['createSquareDetailsReport'][_0x0b73('0xbe')](this,_0xe82e29,_0xe82e29['command']);if(this[_0x0b73('0xa1')](_0xe82e29[_0x0b73('0xd7')])){var _0x314361=this['getVariable'][_0x0b73('0xbe')](this,_0xe82e29[_0x0b73('0xd7')]);if(_0x314361){this[_0x0b73('0xb')][_0x0b73('0x96')](_0x314361,_0x3a500a);return this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0xe82e29[_0x0b73('0xb3')],_0x314361));}}return this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x1b1'),_0xe82e29[_0x0b73('0xb3')]));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1b2')]=function(_0x5154b2){logger['info'](util[_0x0b73('0x24')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x5154b2[_0x0b73('0x35')]));_0x5154b2[_0x0b73('0x5a')]=_0x5154b2[_0x0b73('0x5a')][_0x0b73('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5154b2['apiKey'])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x1b3'));}if(!this['isConfigured'](_0x5154b2[_0x0b73('0x5a')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')]('no\x20text\x20configured');}this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')](_0x0b73('0x1b4'),_0x5154b2['text']));var _0x113def=this[_0x0b73('0x58')][_0x0b73('0xbe')](this,_0x5154b2);if(_0x113def){this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format'](_0x0b73('0x1b5'),_0x113def));var _0x273795=this[_0x0b73('0xb')][_0x0b73('0x100')](_0x113def);try{fs[_0x0b73('0x101')](_0x113def+_0x0b73('0x11f'));}catch(_0x416db0){logger['error'](_0x416db0);}return _0x273795;}return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x5154b2,_0x0b73('0x1b6'));};AGIVertices[_0x0b73('0xd')]['tts']=function(_0x381f86){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x1b7'),_0x381f86['label']));_0x381f86['text']=_0x381f86[_0x0b73('0x5a')][_0x0b73('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x381f86['text'])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xa3'));}this['channel'][_0x0b73('0xa2')](util['format'](_0x0b73('0x1b8'),_0x381f86[_0x0b73('0x5a')]));var _0x1ac1ac=this[_0x0b73('0x60')][_0x0b73('0xbe')](this,_0x381f86);if(_0x1ac1ac){this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')](_0x0b73('0x1b9'),_0x1ac1ac));var _0x532baf=this[_0x0b73('0xb')]['streamFile'](_0x1ac1ac);try{fs[_0x0b73('0x101')](_0x1ac1ac+_0x0b73('0x11f'));}catch(_0x381580){logger[_0x0b73('0x28')](_0x381580);}return _0x532baf;}return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x381f86,_0x0b73('0x1ba'));};AGIVertices['prototype']['unpause']=function(_0x28410e){logger['info'](util[_0x0b73('0x24')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x28410e[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x28410e[_0x0b73('0x152')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x28410e,_0x0b73('0x159'));}logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x153'),this['channel'][_0x0b73('0x38')],_0x28410e[_0x0b73('0x152')]));var _0x122453=this[_0x0b73('0x4f')][_0x0b73('0xbe')](this,_0x28410e[_0x0b73('0x152')]);if(_0x122453){logger['info'](util[_0x0b73('0x24')](_0x0b73('0x154'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x28410e[_0x0b73('0x152')]));this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x0b73('0x38')],_0x28410e['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x156'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x28410e[_0x0b73('0x152')]));this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x156'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x28410e['findBy']));return{'code':0xc8,'result':_0x0b73('0x157')};}};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1bb')]=function(_0x2b3e09){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x1bc'),_0x2b3e09[_0x0b73('0x35')]));var _0x2e9920=this[_0x0b73('0xb')][_0x0b73('0x55')](_0x0b73('0x1bd'),[_0x2b3e09[_0x0b73('0x1be')],_0x2b3e09[_0x0b73('0x75')]]);if(_0x2e9920[_0x0b73('0xa5')]===-0x1){return _0x2e9920;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xc3'),_0x0b73('0x1bd'),_0x2b3e09[_0x0b73('0x1be')]));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1bf')]=function(_0x3812a4){logger['info'](util[_0x0b73('0x24')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3812a4['label']));if(!this[_0x0b73('0xa1')](_0x3812a4['variable_id'])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x3812a4,_0x0b73('0x1a2'));}var _0x215af4=this['getVariable']['sync'](this,_0x3812a4[_0x0b73('0xd7')]);if(!_0x215af4){return this['channel'][_0x0b73('0x28')](_0x3812a4,_0x0b73('0xd9'));}var _0x550968=this[_0x0b73('0xb')][_0x0b73('0x9b')](_0x215af4);return{'code':0xc8,'result':_0x550968[_0x0b73('0x9c')]?_0x550968['extra']:'-'};};String[_0x0b73('0xd')][_0x0b73('0x9a')]=function(_0x5e9204,_0x4ba61b){return this['split'](_0x5e9204)[_0x0b73('0x1c0')](_0x4ba61b);};module['exports']=AGIVertices; \ No newline at end of file +var _0xb40f=['Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','appid','appsecret','clear','agicommand','clone','hasOwnProperty','isString','recursiveNodeIndex','isPlainObject','length','replaceAllVariables','saveRestApiResult','isArray','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','getAndSetVariable','result','info','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','options','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','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','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','database','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','SIP/%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','opts','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','intKey','tildeASR','TildeASR\x20Result\x20%s','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','getIntervals','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','url','macro','gosub','record','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','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','service','host','port','secure','authentication','auth','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','google_cloud_tts','apiKey','no\x20apiKey\x20configured','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','map','format','%s/sounds/converted/%s','getQueryOdbc','open','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','text','languageCode','ssmlGender','MP3','googleTTS','google_tts_language','timeout','includes','POST','PUT','method','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region'];(function(_0x355b24,_0x4e5143){var _0x484649=function(_0x28b191){while(--_0x28b191){_0x355b24['push'](_0x355b24['shift']());}};_0x484649(++_0x4e5143);}(_0xb40f,0x148));var _0xfb40=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0xb40f[_0x3b150c];return _0x5cd414;};'use strict';var fs=require('fs');var path=require(_0xfb40('0x0'));var util=require('util');var _=require(_0xfb40('0x1'));var sh=require(_0xfb40('0x2'));var odbc=require(_0xfb40('0x3'))();var rs=require('randomstring');var moment=require(_0xfb40('0x4'));var Mustache=require(_0xfb40('0x5'));var rp=require(_0xfb40('0x6'));var logger=require(_0xfb40('0x7'))('agi');var config=require('../../config/environment');var scripts=require(_0xfb40('0x8'));var FILES_PATH=_0xfb40('0x9');var recursiveMapAttributes=[_0xfb40('0xa'),'rawBody'];var verticesWithRetry=['menu',_0xfb40('0xb'),_0xfb40('0xc')];var AGIVertices=function(_0x3f3abe,_0x3cf071,_0x4bb087){this[_0xfb40('0xd')]=_0x3f3abe;this[_0xfb40('0xe')]=_0x3cf071;this[_0xfb40('0xf')]=_0x4bb087;};AGIVertices[_0xfb40('0x10')][_0xfb40('0x11')]=function(_0x119f36,_0x154680){this[_0xfb40('0xe')]['getVariableById'](_0x119f36)[_0xfb40('0x12')](function(_0x51ae18){_0x154680(null,_0x51ae18?_0x51ae18[_0xfb40('0x13')]:![]);})['catch'](function(_0x2dc5e7){_0x154680(_0x2dc5e7);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x14')]=function(_0x311cf2,_0x1238c5){this['rpc'][_0xfb40('0x15')](_0x311cf2)[_0xfb40('0x12')](function(_0x1694bb){_0x1238c5(null,_0x1694bb?_0x1694bb[_0xfb40('0x13')]:![]);})[_0xfb40('0x16')](function(_0xc02252){_0x1238c5(_0xc02252);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x17')]=function(_0xb6ab10,_0x6a79d2){this['rpc'][_0xfb40('0x18')](_0xb6ab10)['then'](function(_0x5fcf6d){_0x6a79d2(null,_0x5fcf6d?_0x5fcf6d[_0xfb40('0x13')]:![]);})[_0xfb40('0x16')](function(_0x53a97d){_0x6a79d2(_0x53a97d);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x19')]=function(_0x30a06e,_0x2a5875){this[_0xfb40('0xe')][_0xfb40('0x1a')](_0x30a06e)[_0xfb40('0x12')](function(_0x40bbc9){_0x2a5875(null,_0x40bbc9?_0x40bbc9[_0xfb40('0x1b')]:![]);})[_0xfb40('0x16')](function(_0x20bfe4){_0x2a5875(_0x20bfe4);});};AGIVertices[_0xfb40('0x10')]['getUser']=function(_0x2ca3bb,_0x151764){this[_0xfb40('0xe')][_0xfb40('0x1c')](_0x2ca3bb)[_0xfb40('0x12')](function(_0x566947){_0x151764(null,_0x566947?_0x566947[_0xfb40('0x13')]:![]);})[_0xfb40('0x16')](function(_0x1eff37){_0x151764(_0x1eff37);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x1d')]=function(_0x7f1ccb,_0x3a1a8c){this[_0xfb40('0xe')]['getTrunkById'](_0x7f1ccb)[_0xfb40('0x12')](function(_0x114f8f){_0x3a1a8c(null,_0x114f8f?_0x114f8f[_0xfb40('0x13')]:![]);})[_0xfb40('0x16')](function(_0x5bd0a1){_0x3a1a8c(_0x5bd0a1);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x1e')]=function(_0x126dc2,_0x23406b){var _0x57c4d8=this;this['rpc'][_0xfb40('0x1f')](_0x126dc2)[_0xfb40('0x12')](function(_0x448e23){_0x23406b(null,_0x448e23?_0x57c4d8[_0xfb40('0x20')](_0x448e23[_0xfb40('0x21')]):![]);})[_0xfb40('0x16')](function(_0x2c1602){_0x23406b(_0x2c1602);});};AGIVertices[_0xfb40('0x10')]['getMailAccount']=function(_0x55053d,_0x534c54){this[_0xfb40('0xe')][_0xfb40('0x22')](_0x55053d)[_0xfb40('0x12')](function(_0x32d255){_0x534c54(null,_0x32d255?_0x32d255:![]);})[_0xfb40('0x16')](function(_0x25e51d){_0x534c54(_0x25e51d);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x23')]=function(_0x4dfb29,_0x278165,_0x2710dc){this[_0xfb40('0xf')]['sendMailMessage'](_0x4dfb29,_0x278165)[_0xfb40('0x12')](function(){_0x2710dc(null);})[_0xfb40('0x16')](function(_0x26f22b){_0x2710dc(_0x26f22b);});};AGIVertices[_0xfb40('0x10')]['getIntervals']=function(_0xa42fb8,_0x906ce7){this[_0xfb40('0xe')]['getIntervalById'](_0xa42fb8)[_0xfb40('0x12')](function(_0x51afd6){if(_0x51afd6){if(_0x51afd6['IntervalId']){_0x906ce7(null,[_0x51afd6['interval']]);}else{_0x906ce7(null,_[_0xfb40('0x24')](_0x51afd6['Intervals'],'interval'));}}else{_0x906ce7(null,![]);}})[_0xfb40('0x16')](function(_0x35fd69){_0x906ce7(_0x35fd69);});};AGIVertices[_0xfb40('0x10')]['getSoundPath']=function(_0x5c284d){return util[_0xfb40('0x25')](_0xfb40('0x26'),FILES_PATH,_0x5c284d);};AGIVertices[_0xfb40('0x10')][_0xfb40('0x27')]=function(_0x25f031,_0x398a2a,_0x41e23c){odbc[_0xfb40('0x28')](_0x25f031,function(_0x13c543){if(_0x13c543){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x13c543);_0x41e23c(_0x13c543);}else{logger['info'](_0xfb40('0x29'));odbc['query'](_0x398a2a,function(_0x38d46e,_0x33493e){if(_0x38d46e){logger['info'](_0xfb40('0x2a'),_0x398a2a);_0x41e23c(_0x38d46e);}else{logger['info'](_0xfb40('0x2b'),_0x398a2a);odbc[_0xfb40('0x2c')](function(_0x1deea6){if(_0x1deea6){logger[_0xfb40('0x2d')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1deea6);}_0x41e23c(null,_0x33493e);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x9e7b3f,_0x3f7922){this['rpc'][_0xfb40('0x2e')](_0x9e7b3f)[_0xfb40('0x12')](function(_0x369fef){_0x3f7922(null,_0x369fef?_0x369fef:![]);})[_0xfb40('0x16')](function(_0x20ab70){_0x3f7922(_0x20ab70);});};AGIVertices[_0xfb40('0x10')]['createSmsMessage']=function(_0x478de4,_0x1429ed){this[_0xfb40('0xe')][_0xfb40('0x2f')](_0x478de4)[_0xfb40('0x12')](function(_0x2efe93){_0x1429ed(null,_0x2efe93);})['catch'](function(_0x540f49){_0x1429ed(_0x540f49);});};AGIVertices['prototype'][_0xfb40('0x30')]=function(_0x837b4c,_0x19734a,_0xc69fbc){this['rpc'][_0xfb40('0x30')]({'uniqueid':this[_0xfb40('0xd')][_0xfb40('0x31')],'node':_0x837b4c[_0xfb40('0x32')],'application':_0x837b4c['agicommand'],'data':_0x19734a||null,'project_name':this[_0xfb40('0xd')][_0xfb40('0x33')],'callerid':this['channel'][_0xfb40('0x34')]})[_0xfb40('0x12')](function(_0x5d55af){if(_0xc69fbc){_0xc69fbc(null,_0x5d55af);}})[_0xfb40('0x16')](function(_0x52d8c8){if(_0xc69fbc){_0xc69fbc(_0x52d8c8);}});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x35')]=function(_0x24c142,_0x5a25f9,_0x365704,_0x42b9d1){this[_0xfb40('0xe')]['createSquareRecording']({'uniqueid':this[_0xfb40('0xd')][_0xfb40('0x31')],'callerid':this[_0xfb40('0xd')][_0xfb40('0x34')],'calleridname':this[_0xfb40('0xd')][_0xfb40('0x36')],'context':this['channel']['context'],'extension':this[_0xfb40('0xd')][_0xfb40('0x37')],'priority':this[_0xfb40('0xd')][_0xfb40('0x38')],'accountcode':this[_0xfb40('0xd')][_0xfb40('0x39')],'dnid':this[_0xfb40('0xd')]['dnid'],'projectName':this[_0xfb40('0xd')][_0xfb40('0x33')],'saveName':_0x5a25f9,'filename':_0x24c142[_0xfb40('0x3a')]||_0x5a25f9,'savePath':_0x365704})['then'](function(_0x20a0d9){_0x42b9d1(null,_0x20a0d9);})[_0xfb40('0x16')](function(_0x256616){_0x42b9d1(_0x256616);});};AGIVertices[_0xfb40('0x10')]['createSquareMessage']=function(_0x5c141e,_0x35f8e4,_0x1f7805,_0x573dbd,_0x549ecc){this[_0xfb40('0xe')][_0xfb40('0x3b')]({'uniqueid':this[_0xfb40('0xd')][_0xfb40('0x31')],'body':_0x5c141e,'direction':_0x35f8e4,'providerName':_0x1f7805,'providerResponse':_0x573dbd})[_0xfb40('0x12')](function(_0x597e48){if(_0x549ecc){_0x549ecc(null,_0x597e48);}})[_0xfb40('0x16')](function(_0x3e15c7){if(_0x549ecc){_0x549ecc(_0x3e15c7);}});};AGIVertices['prototype'][_0xfb40('0x3c')]=function(_0x4076a4,_0x5b1e4f){this[_0xfb40('0xe')]['createCmContact']({'firstName':_[_0xfb40('0x3d')](_0x4076a4[_0xfb40('0x13')])||_[_0xfb40('0x3e')](_0x4076a4['name'])?_0xfb40('0x3f')+Math[_0xfb40('0x40')]():_0x4076a4[_0xfb40('0x13')],'lastName':_[_0xfb40('0x3d')](_0x4076a4[_0xfb40('0x41')])||_['isNil'](_0x4076a4[_0xfb40('0x41')])?null:_0x4076a4[_0xfb40('0x41')],'phone':_0x4076a4[_0xfb40('0x42')],'ListId':_0x4076a4['list_id'],'scheduledat':_0x4076a4[_0xfb40('0x43')],'callbackUniqueid':this['channel'][_0xfb40('0x31')],'tags':'callback','description':_0xfb40('0x44')+_0x4076a4[_0xfb40('0x43')][_0xfb40('0x45')](),'priority':_0x4076a4[_0xfb40('0x46')]})['then'](function(_0x615c42){_0x5b1e4f(null,_0x615c42);})[_0xfb40('0x16')](function(_0x4a3b05){_0x5b1e4f(_0x4a3b05);});};AGIVertices[_0xfb40('0x10')]['getPause']=function(_0x59df65,_0x4fcbb7){this['rpc']['getPauseById'](_0x59df65)[_0xfb40('0x12')](function(_0x5d0901){_0x4fcbb7(null,_0x5d0901?_0x5d0901[_0xfb40('0x13')]:![]);})[_0xfb40('0x16')](function(_0xfd58ab){_0x4fcbb7(_0xfd58ab);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x47')]=function(_0x553784,_0x4776c5,_0x5ab522){var _0x5e4466={'role':_0xfb40('0x48')};_0x5e4466[_0x553784]=this['channel'][_0xfb40('0x34')];this[_0xfb40('0xe')][_0xfb40('0x47')](_0x5e4466,_0x4776c5,this[_0xfb40('0xd')][_0xfb40('0x31')])[_0xfb40('0x12')](function(_0x58c0dc){_0x5ab522(null,_['isNil'](_0x58c0dc)?![]:!![]);})['catch'](function(_0x36592f){logger[_0xfb40('0x2d')](_0x36592f);_0x5ab522(null,![]);});};AGIVertices['prototype'][_0xfb40('0x49')]=function(_0x22b37a,_0x496bf0){var _0x32e259={'role':_0xfb40('0x48')};_0x32e259[_0x22b37a]=this['channel'][_0xfb40('0x34')];this[_0xfb40('0xe')][_0xfb40('0x49')](_0x32e259)[_0xfb40('0x12')](function(_0x31636e){_0x496bf0(null,_[_0xfb40('0x3e')](_0x31636e)?![]:!![]);})[_0xfb40('0x16')](function(_0x53bdac){logger[_0xfb40('0x2d')](_0x53bdac);_0x496bf0(null,![]);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x4a')]=function(_0xabf719,_0xed560d){var _0x49dbbd={'role':_0xfb40('0x48')};_0x49dbbd[_0xabf719]=this['channel']['callerid'];this[_0xfb40('0xe')][_0xfb40('0x4a')](_0x49dbbd)[_0xfb40('0x12')](function(_0x537e25){_0xed560d(null,_[_0xfb40('0x3e')](_0x537e25)?![]:!![]);})[_0xfb40('0x16')](function(_0x52761b){logger[_0xfb40('0x2d')](_0x52761b);_0xed560d(null,![]);});};AGIVertices['prototype'][_0xfb40('0x4b')]=function(_0x583238,_0x2aed9c){var _0x44e0b1={'role':'agent'};_0x44e0b1[_0x583238]=this[_0xfb40('0xd')][_0xfb40('0x34')];var _0x58663a=_0x583238!=_0xfb40('0x4c')?util[_0xfb40('0x25')](_0xfb40('0x4d'),'LOCAL',this['channel'][_0xfb40('0x34')]):undefined;this[_0xfb40('0xe')][_0xfb40('0x4b')](_0x44e0b1,_0x58663a)[_0xfb40('0x12')](function(_0x407b77){_0x2aed9c(null,_[_0xfb40('0x3e')](_0x407b77)?![]:!![]);})['catch'](function(_0x402c4b){logger['error'](_0x402c4b);_0x2aed9c(null,![]);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x4e')]=function(_0x597316,_0x3c57f2){sh[_0xfb40('0x4f')](_[_0xfb40('0x50')](_0x597316),function(_0x3dc166,_0x37e2e4){var _0x4bbc19=_0x37e2e4[_0xfb40('0x51')](/(\r\n|\n|\r)/gm,'');_0x3c57f2(null,_0x4bbc19);});};AGIVertices[_0xfb40('0x10')]['googleCloudTTS']=function(_0x4d37fc,_0x41e8b7){scripts[_0xfb40('0x52')](_0x4d37fc['apiKey'],_0x4d37fc['google_cloud_tts_text_type']||'text',_0x4d37fc[_0xfb40('0x53')],_0x4d37fc[_0xfb40('0x54')]||'en-US',_0x4d37fc[_0xfb40('0x55')]||'MALE',_0x4d37fc['audioEncoding']||_0xfb40('0x56'))['then'](function(_0x2027be){_0x41e8b7(null,_0x2027be);})[_0xfb40('0x16')](function(_0x41c15e){_0x41e8b7(_0x41c15e);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x57')]=function(_0xfb9a2c,_0x4ee4af){scripts[_0xfb40('0x57')](_0xfb9a2c['text'],_0xfb9a2c[_0xfb40('0x58')]||'en',0x1)[_0xfb40('0x12')](function(_0x5deb7f){_0x4ee4af(null,_0x5deb7f);})['catch'](function(_0x34fe38){_0x4ee4af(_0x34fe38);});};AGIVertices[_0xfb40('0x10')]['restAPI']=function(_0x5a9b56,_0x1c2ac7){var _0x2ac3a7={'uri':_0x5a9b56['url'],'method':_0x5a9b56['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5a9b56[_0xfb40('0x59')])==='number'&&parseInt(_0x5a9b56[_0xfb40('0x59')])>=0x1?parseInt(_0x5a9b56[_0xfb40('0x59')])*0x3e8:0x5*0x3e8};if(_[_0xfb40('0x5a')]([_0xfb40('0x5b'),_0xfb40('0x5c')],_0x2ac3a7[_0xfb40('0x5d')][_0xfb40('0x5e')]())){try{_0x2ac3a7[_0xfb40('0x5f')]=_0x5a9b56[_0xfb40('0x60')]?JSON[_0xfb40('0x61')](_0x5a9b56[_0xfb40('0x60')]):{};}catch(_0x3d4c6c){logger['error'](_0xfb40('0x62'),_0x3d4c6c);}}try{_0x2ac3a7[_0xfb40('0x63')]=_0x5a9b56[_0xfb40('0xa')]?JSON['parse'](_0x5a9b56[_0xfb40('0xa')]):{};}catch(_0x142565){logger[_0xfb40('0x2d')](_0xfb40('0x64'),_0x142565);}if(_0x5a9b56['computedVariables']){try{var _0x4d622d=require(_0x5a9b56['computedVariables'])[_0xfb40('0x65')](this,_0x2ac3a7);_0x2ac3a7[_0xfb40('0x66')]=Mustache[_0xfb40('0x67')](_0x5a9b56['url'],_0x4d622d,{},['$$','$$']);if(_0x2ac3a7[_0xfb40('0x63')]){_0x2ac3a7[_0xfb40('0x63')]=JSON[_0xfb40('0x61')](Mustache[_0xfb40('0x67')](JSON['stringify'](_0x2ac3a7[_0xfb40('0x63')]),_0x4d622d,{},['$$','$$']));}if(_0x2ac3a7[_0xfb40('0x5f')]){_0x2ac3a7['body']=JSON[_0xfb40('0x61')](Mustache[_0xfb40('0x67')](JSON[_0xfb40('0x68')](_0x2ac3a7[_0xfb40('0x5f')]),_0x4d622d,{},['$$','$$']));}}catch(_0x16c423){logger[_0xfb40('0x2d')](_0xfb40('0x69'),_0x16c423);}}rp(_0x2ac3a7)[_0xfb40('0x12')](function(_0x5a8d3e){var _0x3007d6={'statusCode':_0x5a8d3e[_0xfb40('0x6a')]||0xc8,'statusMessage':_0x5a8d3e[_0xfb40('0x6b')]||'OK','headers':_0x5a8d3e['headers']||{},'body':_0x5a8d3e[_0xfb40('0x5f')]||{}};_0x1c2ac7(null,_0x3007d6);})[_0xfb40('0x16')](function(_0x3a4184){var _0x2a4bed={'statusCode':_0x3a4184[_0xfb40('0x6a')]||0x1f4,'statusMessage':_0x3a4184[_0xfb40('0x6c')]||_0xfb40('0x6d'),'headers':_0x3a4184['options'][_0xfb40('0x63')]||{},'body':_0x3a4184['options'][_0xfb40('0x5f')]||{}};_0x1c2ac7(null,_0x2a4bed);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x6e')]=function(_0x355d9c,_0x447d10){scripts[_0xfb40('0x6e')](this['channel']['uniqueid'],_0x355d9c['key'],_0x355d9c[_0xfb40('0x53')],_0x355d9c[_0xfb40('0x6f')]||'en')[_0xfb40('0x12')](function(_0x12d0b9){_0x447d10(null,_0x12d0b9);})[_0xfb40('0x16')](function(_0x3588ca){_0x447d10(_0x3588ca);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x70')]=function(_0x556ca6,_0x186026){scripts[_0xfb40('0x70')](this[_0xfb40('0xd')][_0xfb40('0x31')],_0x556ca6['dialogflowV2_project_id'],_0x556ca6['client_email'],_0x556ca6['private_key'],_0x556ca6[_0xfb40('0x53')],_0x556ca6[_0xfb40('0x71')]||'en')[_0xfb40('0x12')](function(_0x2b6256){_0x186026(null,_0x2b6256);})[_0xfb40('0x16')](function(_0x3c6a5e){_0x186026(_0x3c6a5e);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x72')]=function(_0x4f1e3d,_0x26db28){scripts[_0xfb40('0x72')](this[_0xfb40('0xd')],_0x4f1e3d)[_0xfb40('0x12')](function(_0x1a9a7a){_0x26db28(null,_0x1a9a7a);})['catch'](function(_0x31ece5){_0x26db28(_0x31ece5);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x73')]=function(_0x341218,_0x5bb8e5){scripts[_0xfb40('0x73')](_0x341218[_0xfb40('0x74')],_0x341218['text'],_0x341218['ispeech_tts_language']||'en-US',_0x341218['speed'])[_0xfb40('0x12')](function(_0x1cafb2){_0x5bb8e5(null,_0x1cafb2);})[_0xfb40('0x16')](function(_0x4b35ef){_0x5bb8e5(_0x4b35ef);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x75')]=function(_0x1d5032,_0x281d1f,_0x5b2610){scripts[_0xfb40('0x75')](_0x281d1f,_0x1d5032['key'],_0x1d5032[_0xfb40('0x76')]||_0xfb40('0x77'),this[_0xfb40('0x78')](_0x1d5032['model'])?_0x1d5032[_0xfb40('0x79')]:undefined)[_0xfb40('0x12')](function(_0x12af30){_0x5b2610(null,_0x12af30);})[_0xfb40('0x16')](function(_0x329a12){_0x5b2610(_0x329a12);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x7a')]=function(_0x505319,_0x38b5bb){scripts['awsPolly'](_0x505319[_0xfb40('0x7b')],_0x505319[_0xfb40('0x7c')],_0x505319[_0xfb40('0x7d')],_0x505319['aws_polly_voice']||_0xfb40('0x7e'),_0x505319[_0xfb40('0x53')],_0x505319[_0xfb40('0x7f')]||_0xfb40('0x53'))[_0xfb40('0x12')](function(_0x1884bf){_0x38b5bb(null,_0x1884bf);})['catch'](function(_0x5e0e0f){_0x38b5bb(_0x5e0e0f);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x80')]=function(_0xc555c,_0x18976c){scripts[_0xfb40('0x80')](this[_0xfb40('0xd')][_0xfb40('0x31')],_0xc555c[_0xfb40('0x7b')],_0xc555c['aws_secret_access_key'],_0xc555c['aws_lex_region'],_0xc555c[_0xfb40('0x53')],_0xc555c[_0xfb40('0x81')])[_0xfb40('0x12')](function(_0x5d1707){_0x18976c(null,_0x5d1707);})[_0xfb40('0x16')](function(_0x54548a){_0x18976c(_0x54548a);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x82')]=function(_0x5d5c66,_0x4a83b3,_0x51e49a){scripts[_0xfb40('0x82')](_0x4a83b3,_0x5d5c66[_0xfb40('0x74')],_0x5d5c66[_0xfb40('0x83')]||'en-US')['then'](function(_0x138b52){_0x51e49a(null,_0x138b52);})[_0xfb40('0x16')](function(_0x6441e0){_0x51e49a(_0x6441e0);});};AGIVertices[_0xfb40('0x10')]['tildeASR']=function(_0x19edcd,_0x208b53,_0xc0bb72){scripts['tildeASR'](_0x208b53,_0x19edcd[_0xfb40('0x84')],_0x19edcd[_0xfb40('0x85')],_0x19edcd[_0xfb40('0x66')])[_0xfb40('0x12')](function(_0x82881e){_0xc0bb72(null,_0x82881e);})['catch'](function(_0x386fdc){_0xc0bb72(_0x386fdc);});};AGIVertices[_0xfb40('0x10')][_0xfb40('0x86')]=function(_0x35101c){var _0x1926f1=_['includes'](verticesWithRetry,_0x35101c[_0xfb40('0x87')])?_0x35101c:_[_0xfb40('0x88')](_0x35101c);for(var _0x554efe in _0x1926f1){if(_0x1926f1[_0xfb40('0x89')](_0x554efe)){if(_0x1926f1[_0x554efe]&&_[_0xfb40('0x8a')](_0x1926f1[_0x554efe])){if(_[_0xfb40('0x5a')](recursiveMapAttributes,_0x554efe)){_0x1926f1[_0x554efe]=this['replaceObjectAllVariables'](_0x1926f1[_0x554efe]);}else{_0x1926f1[_0x554efe]=this['replaceAllVariables'](_0x1926f1[_0x554efe]);}}}}return _0x1926f1;};AGIVertices[_0xfb40('0x10')][_0xfb40('0x8b')]=function(_0x589668){for(var _0x2ef124 in _0x589668){if(_0x589668[_0xfb40('0x89')](_0x2ef124)){if(_[_0xfb40('0x8c')](_0x589668[_0x2ef124])){this[_0xfb40('0x8b')](_0x589668[_0x2ef124]);}else if(_['isArray'](_0x589668[_0x2ef124])){for(var _0x1bc45d=0x0;_0x1bc45d<_0x589668[_0x2ef124][_0xfb40('0x8d')];_0x1bc45d++){this['recursiveNodeIndex'](_0x589668[_0x2ef124][_0x1bc45d]);}}else if(_[_0xfb40('0x8a')](_0x589668[_0x2ef124])){_0x589668[_0x2ef124]=this[_0xfb40('0x8e')](_0x589668[_0x2ef124]);}}}};AGIVertices[_0xfb40('0x10')][_0xfb40('0x8f')]=function(_0x6e3d9d,_0x30943b){for(var _0xa11af8 in _0x6e3d9d){if(_0x6e3d9d[_0xfb40('0x89')](_0xa11af8)){if(_[_0xfb40('0x8c')](_0x6e3d9d[_0xa11af8])){if(!_['isEmpty'](_0x6e3d9d[_0xa11af8])){this[_0xfb40('0x8f')](_0x6e3d9d[_0xa11af8],util[_0xfb40('0x25')]('%s.%s',_0x30943b,_0xa11af8));}}else if(_[_0xfb40('0x90')](_0x6e3d9d[_0xa11af8])){for(var _0x4fc06f=0x0;_0x4fc06f<_0x6e3d9d[_0xa11af8][_0xfb40('0x8d')];_0x4fc06f++){this[_0xfb40('0x8f')](_0x6e3d9d[_0xa11af8][_0x4fc06f],util[_0xfb40('0x25')](_0xfb40('0x91'),_0x30943b,_0xa11af8+'['+_0x4fc06f+']'));}}else{if(!_[_0xfb40('0x3e')](_0x6e3d9d[_0xa11af8])){this[_0xfb40('0xd')][_0xfb40('0x92')](util[_0xfb40('0x25')](_0xfb40('0x91'),_0x30943b,_0xa11af8),_0x6e3d9d[_0xa11af8]);}}}}};AGIVertices[_0xfb40('0x10')][_0xfb40('0x93')]=function(_0x2b3651){try{var _0x2bec7b=JSON[_0xfb40('0x61')](_0x2b3651);this[_0xfb40('0x8b')](_0x2bec7b);return JSON[_0xfb40('0x68')](_0x2bec7b);}catch(_0x5765a1){return this[_0xfb40('0x8e')](_0x2b3651);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x607b17){var _0x140f8d=_0x607b17['split']('{');for(var _0x18e872=0x1;_0x18e872<_0x140f8d[_0xfb40('0x8d')];_0x18e872+=0x1){var _0xff07d8=_0x140f8d[_0x18e872][_0xfb40('0x94')]('}');if(_0xff07d8['length']>0x1){_0x607b17=_0x607b17[_0xfb40('0x95')]('{'+_0xff07d8[0x0]+'}',this[_0xfb40('0xd')][_0xfb40('0x11')](_0xff07d8[0x0])['extra']||_0xff07d8[0x0]);}}if(_0x140f8d['length']===0x1){return _0x607b17['toString']();}return this['replaceAllVariables'](_0x607b17);};AGIVertices[_0xfb40('0x10')][_0xfb40('0x96')]=function(_0xdad582,_0x59973a){var _0x5b35da=this[_0xfb40('0xd')][_0xfb40('0x11')](_0xdad582);if(_0x5b35da[_0xfb40('0x97')]===-0x1){return _0x5b35da;}logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x99'),_0x59973a,_0x5b35da[_0xfb40('0x9a')]));return this[_0xfb40('0xd')]['setVariable'](_0x59973a,_0x5b35da[_0xfb40('0x9a')]);};AGIVertices[_0xfb40('0x10')][_0xfb40('0x78')]=function(_0x1d2d1c){return _0x1d2d1c&&_0x1d2d1c!=='0'&&_0x1d2d1c!=='-1'&&_0x1d2d1c!=='';};AGIVertices['prototype'][_0xfb40('0x9b')]=function(_0x5a940d){this[_0xfb40('0x30')][_0xfb40('0x65')](this,_0x5a940d,'-');_0x5a940d[_0xfb40('0x9c')]=_0x5a940d['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xfb40('0x10')][_0xfb40('0x9d')]=function(_0x390a4c){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x9e'),_0x390a4c['label']));if(!this[_0xfb40('0x78')](_0x390a4c['text'])){return this[_0xfb40('0xd')]['noop'](_0xfb40('0x9f'));}var _0x9cef20='\x22'+_0x390a4c[_0xfb40('0x53')]+'\x22';if(this['isConfigured'](_0x390a4c[_0xfb40('0xa0')])){_0x9cef20+=','+_0x390a4c[_0xfb40('0xa0')];}var _0x576988=this[_0xfb40('0xd')][_0xfb40('0x4f')]('MRCPSynth',_0x9cef20);if(_0x576988['result']===-0x1){return _0x576988;}return this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0xa2'),_0x9cef20));};AGIVertices['prototype'][_0xfb40('0xa3')]=function(_0x1931ee){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0xa4'),_0x1931ee['label']));if(!this[_0xfb40('0x78')](_0x1931ee[_0xfb40('0xa5')])){return this[_0xfb40('0xd')]['noop'](_0xfb40('0xa6'));}var _0x1c5141=_0x1931ee[_0xfb40('0xa5')];if(this['isConfigured'](_0x1931ee[_0xfb40('0xa0')])){_0x1c5141+=','+_0x1931ee['options'];}var _0x362493=this[_0xfb40('0xd')]['exec'](_0xfb40('0xa7'),_0x1c5141);if(_0x362493[_0xfb40('0x97')]===-0x1){return _0x362493;}var _0x26ee88=this[_0xfb40('0x96')](_0xfb40('0xa8'),'MRCP_RECOG_CONFIDENCE');if(_0x26ee88[_0xfb40('0x97')]===-0x1){return _0x26ee88;}var _0x3c659c=this['getAndSetVariable'](_0xfb40('0xa9'),_0xfb40('0xaa'));if(_0x3c659c[_0xfb40('0x97')]===-0x1){return _0x3c659c;}var _0x4cb79c=this[_0xfb40('0x96')](_0xfb40('0xab'),'MRCP_RECOG_INSTANCE');if(_0x4cb79c['result']===-0x1){return _0x4cb79c;}return this[_0xfb40('0xd')][_0xfb40('0xa1')](util['format'](_0xfb40('0xac'),_0x1c5141));};AGIVertices[_0xfb40('0x10')][_0xfb40('0xad')]=function(_0x4cf807){logger[_0xfb40('0x98')](util['format'](_0xfb40('0xae'),_0x4cf807[_0xfb40('0x32')]));return this[_0xfb40('0xd')][_0xfb40('0xad')]([_0x4cf807[_0xfb40('0xaf')],_0x4cf807[_0xfb40('0xb0')]]);};AGIVertices['prototype']['answer']=function(_0x479296){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0xb1'),_0x479296['label']));if(this[_0xfb40('0x78')](_0x479296['timeout'])){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0xb2'),_0x479296[_0xfb40('0x59')]));var _0x16f9cc=this['channel'][_0xfb40('0xb3')](_0x479296[_0xfb40('0x59')]);if(_0x16f9cc['result']===-0x1){return _0x16f9cc;}}return this[_0xfb40('0xd')][_0xfb40('0xb4')]();};AGIVertices[_0xfb40('0x10')][_0xfb40('0xb5')]=function(_0x5bb8e7){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0xb6'),_0x5bb8e7[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0x5bb8e7[_0xfb40('0xb7')])){return this[_0xfb40('0xd')]['error'](_0x5bb8e7,_0xfb40('0xb8'));}_0x5bb8e7['scheduledAt']=moment();if(this[_0xfb40('0x78')](_0x5bb8e7['delay'])){_0x5bb8e7['scheduledAt']=moment()[_0xfb40('0xb9')](_0x5bb8e7[_0xfb40('0xba')],_0xfb40('0xbb'));}if(!this['isConfigured'](_0x5bb8e7[_0xfb40('0x46')])){_0x5bb8e7[_0xfb40('0x46')]=0x2;}this[_0xfb40('0x3c')][_0xfb40('0x65')](this,_0x5bb8e7);return this[_0xfb40('0xd')]['noop'](util[_0xfb40('0x25')](_0xfb40('0xbc'),_0x5bb8e7['phone'],_0x5bb8e7[_0xfb40('0xb7')],_0x5bb8e7['scheduledAt']));};AGIVertices['prototype'][_0xfb40('0xbd')]=function(_0x8ec533){logger[_0xfb40('0x98')](util['format'](_0xfb40('0xbe'),_0x8ec533[_0xfb40('0x32')]));var _0x161a31=this[_0xfb40('0xd')][_0xfb40('0x4f')](_0x8ec533[_0xfb40('0xbf')],_0x8ec533['options']);if(_0x161a31[_0xfb40('0x97')]===-0x1){return _0x161a31;}return this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0xc0'),_0x8ec533['application'],_0x8ec533[_0xfb40('0xa0')]));};AGIVertices['prototype'][_0xfb40('0xc1')]=function(_0x496d98){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0xc2'),_0x496d98['label']));if(!this[_0xfb40('0x78')](_0x496d98[_0xfb40('0x53')])){return this[_0xfb40('0xd')][_0xfb40('0xa1')]('no\x20text\x20configured');}var _0x8830a2='\x22'+_0x496d98[_0xfb40('0x53')]+'\x22';if(this[_0xfb40('0x78')](_0x496d98[_0xfb40('0xa0')])){_0x8830a2+=','+_0x496d98['options'];}var _0x18d226=this[_0xfb40('0xd')][_0xfb40('0x4f')]('MRCPSynth',_0x8830a2);if(_0x18d226['result']===-0x1){return _0x18d226;}return this[_0xfb40('0xd')]['noop'](util[_0xfb40('0x25')](_0xfb40('0xa2'),_0x8830a2));};AGIVertices[_0xfb40('0x10')]['sestektts']=function(_0x26c9e0){logger['info'](util['format'](_0xfb40('0xc3'),_0x26c9e0[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0x26c9e0[_0xfb40('0x53')])){return this[_0xfb40('0xd')]['noop']('no\x20text\x20configured');}var _0x263137='\x22'+_0x26c9e0[_0xfb40('0x53')]+'\x22';if(this[_0xfb40('0x78')](_0x26c9e0[_0xfb40('0xa0')])){_0x263137+=','+_0x26c9e0[_0xfb40('0xa0')];}var _0x12595f=this[_0xfb40('0xd')][_0xfb40('0x4f')](_0xfb40('0xc4'),_0x263137);if(_0x12595f[_0xfb40('0x97')]===-0x1){return _0x12595f;}return this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0xa2'),_0x263137));};AGIVertices[_0xfb40('0x10')][_0xfb40('0xc5')]=function(_0xb826a){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0xc6'),_0xb826a[_0xfb40('0x32')]));if(!this['isConfigured'](_0xb826a[_0xfb40('0xa5')])){return this['channel']['noop'](_0xfb40('0xa6'));}var _0x5a7d56=_0xb826a[_0xfb40('0xa5')];if(this[_0xfb40('0x78')](_0xb826a[_0xfb40('0xa0')])){_0x5a7d56+=','+_0xb826a[_0xfb40('0xa0')];}var _0x280d75=this[_0xfb40('0xd')][_0xfb40('0x4f')]('MRCPRecog',_0x5a7d56);if(_0x280d75[_0xfb40('0x97')]===-0x1){return _0x280d75;}var _0x2dfb83=this['getAndSetVariable'](_0xfb40('0xa8'),_0xfb40('0xc7'));if(_0x2dfb83['result']===-0x1){return _0x2dfb83;}var _0x515b7c=this[_0xfb40('0x96')]('RECOG_INPUT()',_0xfb40('0xc8'));if(_0x515b7c[_0xfb40('0x97')]===-0x1){return _0x515b7c;}var _0x9c777=this[_0xfb40('0x96')](_0xfb40('0xab'),'LUMENVOX_ASR_INSTANCE');if(_0x9c777['result']===-0x1){return _0x9c777;}return this[_0xfb40('0xd')][_0xfb40('0xa1')](util['format'](_0xfb40('0xac'),_0x5a7d56));};AGIVertices[_0xfb40('0x10')][_0xfb40('0xc9')]=function(_0x930dd8){logger['info'](util[_0xfb40('0x25')](_0xfb40('0xca'),_0x930dd8[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0x930dd8[_0xfb40('0xa5')])){return this[_0xfb40('0xd')]['noop'](_0xfb40('0xa6'));}var _0x37c7de=_0x930dd8['grammar'];if(this[_0xfb40('0x78')](_0x930dd8[_0xfb40('0xa0')])){_0x37c7de+=','+_0x930dd8[_0xfb40('0xa0')];}var _0x16de4f=this[_0xfb40('0xd')][_0xfb40('0x4f')](_0xfb40('0xa7'),_0x37c7de);if(_0x16de4f[_0xfb40('0x97')]===-0x1){return _0x16de4f;}var _0x23d9ff=this['getAndSetVariable'](_0xfb40('0xa8'),_0xfb40('0xcb'));if(_0x23d9ff[_0xfb40('0x97')]===-0x1){return _0x23d9ff;}var _0x4b8635=this[_0xfb40('0x96')](_0xfb40('0xa9'),'SESTEK_ASR_TRANSCRIPT');if(_0x4b8635[_0xfb40('0x97')]===-0x1){return _0x4b8635;}var _0x36897e=this['getAndSetVariable'](_0xfb40('0xab'),'SESTEK_ASR_INSTANCE');if(_0x36897e[_0xfb40('0x97')]===-0x1){return _0x36897e;}return this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x37c7de));};AGIVertices[_0xfb40('0x10')][_0xfb40('0xcc')]=function(_0x42a6b3){logger['info'](util[_0xfb40('0x25')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x42a6b3[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0x42a6b3['odbc_id'])){return this['channel'][_0xfb40('0x2d')](_0x42a6b3,_0xfb40('0xcd'));}var _0x253574=this[_0xfb40('0x19')]['sync'](this,_0x42a6b3['odbc_id']);if(!_0x253574){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x42a6b3,_0xfb40('0xce'));}if(!this[_0xfb40('0x78')](_0x42a6b3['query'])){return this['channel']['error'](_0x42a6b3,'no\x20query\x20configured');}var _0x529552=_0x42a6b3[_0xfb40('0xcf')][_0xfb40('0x51')](/(\r\n|\n|\r)/gm,'\x20');this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')]('query:\x20%s',_0x529552));var _0xd978f8=this[_0xfb40('0x27')][_0xfb40('0x65')](this,_0x253574,_0x529552);this[_0xfb40('0x30')][_0xfb40('0x65')](this,_0x42a6b3,_0x529552);if(!this[_0xfb40('0x78')](_0x42a6b3[_0xfb40('0xd0')])){return this[_0xfb40('0xd')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x232534=this[_0xfb40('0x11')][_0xfb40('0x65')](this,_0x42a6b3['variable_id']);if(!_0x232534){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x42a6b3,_0xfb40('0xd1'));}var _0x5a3250=this;_0xd978f8[_0xfb40('0xd2')](function(_0x4e432c,_0x32c46d){Object['keys'](_0x4e432c)[_0xfb40('0xd2')](function(_0x4ccd3f){_0x5a3250[_0xfb40('0xd')][_0xfb40('0x92')](util['format'](_0xfb40('0xd3'),_0x232534,_0x32c46d,_0x4ccd3f),_0x4e432c[_0x4ccd3f]);});});this['channel'][_0xfb40('0x92')](util[_0xfb40('0x25')](_0xfb40('0xd4'),_0x232534),_0xd978f8['length']);return this[_0xfb40('0xd')][_0xfb40('0xa1')](util['format'](_0xfb40('0xd5'),_0x232534));};AGIVertices[_0xfb40('0x10')][_0xfb40('0xd6')]=function(_0xc72c00){logger['debug'](util[_0xfb40('0x25')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0xc72c00[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0xc72c00[_0xfb40('0xd7')])){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0xc72c00,_0xfb40('0xd8'));}var _0x1619a4=this[_0xfb40('0xd9')][_0xfb40('0x65')](this,_0xc72c00[_0xfb40('0xd7')]);if(!_0x1619a4){return this['channel']['error'](_0xc72c00,_0xfb40('0xda'));}var _0x25f401=this[_0xfb40('0xd')][_0xfb40('0x4f')]('DIAL',[util[_0xfb40('0x25')](_0xfb40('0xdb'),_0x1619a4),_0xc72c00[_0xfb40('0x59')],_0xc72c00['opts'],_0xc72c00['url']]);if(_0x25f401[_0xfb40('0x97')]===-0x1){return _0x25f401;}return this[_0xfb40('0xd')][_0xfb40('0xa1')](util['format']('Executed\x20command\x20%s',_0xfb40('0xdc')));};AGIVertices[_0xfb40('0x10')][_0xfb40('0xdd')]=function(_0x325b50){logger[_0xfb40('0x98')](util['format'](_0xfb40('0xde'),_0x325b50['label']));if(!this['isConfigured'](_0x325b50[_0xfb40('0x74')])){return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0xdf'));}if(!this[_0xfb40('0x78')](_0x325b50['text'])){return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0x9f'));}this[_0xfb40('0xd')]['bot']=!![];this[_0xfb40('0x30')](_0x325b50);this[_0xfb40('0x3b')](_0x325b50[_0xfb40('0x53')],'in','','');this['channel'][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0xe0'),_0x325b50[_0xfb40('0x53')]));var _0xa9b4fe=this['googleDialogflow'][_0xfb40('0x65')](this,_0x325b50);if(_0xa9b4fe){for(var _0x4ae86e in _0xa9b4fe){if(_0xa9b4fe['hasOwnProperty'](_0x4ae86e)){this['channel'][_0xfb40('0x92')](util[_0xfb40('0x25')](_0xfb40('0xe1'),_0x4ae86e[_0xfb40('0x5e')]()),_0xa9b4fe[_0x4ae86e]);}}this[_0xfb40('0x3b')](_0xa9b4fe[_0xfb40('0xe2')],_0xfb40('0xe3'),'dialogflow','');return this[_0xfb40('0xd')][_0xfb40('0xa1')](util['format']('Dialogflow\x20Result\x20%s',_0xa9b4fe['speech']));}return this[_0xfb40('0xd')]['error'](_0x325b50,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xfb40('0x10')][_0xfb40('0xe4')]=function(_0x3a6582){logger[_0xfb40('0x98')](util[_0xfb40('0x25')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3a6582[_0xfb40('0x32')]));if(!this['isConfigured'](_0x3a6582[_0xfb40('0xe5')])){return this['channel'][_0xfb40('0xa1')](_0xfb40('0xe6'));}if(!this[_0xfb40('0x78')](_0x3a6582[_0xfb40('0xe7')])){return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0xe8'));}if(!this[_0xfb40('0x78')](_0x3a6582['private_key'])){return this[_0xfb40('0xd')]['noop'](_0xfb40('0xe9'));}if(!this[_0xfb40('0x78')](_0x3a6582[_0xfb40('0x71')])){return this[_0xfb40('0xd')]['noop'](_0xfb40('0xea'));}if(!this[_0xfb40('0x78')](_0x3a6582['text'])){return this['channel'][_0xfb40('0xa1')](_0xfb40('0x9f'));}this[_0xfb40('0xd')][_0xfb40('0xeb')]=!![];this[_0xfb40('0x30')](_0x3a6582);this[_0xfb40('0x3b')](_0x3a6582['text'],'in','','');this['channel'][_0xfb40('0xa1')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x3a6582['text']));var _0x436fda=this[_0xfb40('0x70')][_0xfb40('0x65')](this,_0x3a6582);if(_0x436fda){for(var _0x597769 in _0x436fda){if(_0x436fda['hasOwnProperty'](_0x597769)){if(_0x597769!==_0xfb40('0xec')){this['channel']['setVariable'](util[_0xfb40('0x25')]('DIALOGFLOW_%s',_0x597769[_0xfb40('0x5e')]()),_0x436fda[_0x597769]);}}}this[_0xfb40('0x3b')](_0x436fda[_0xfb40('0xe2')],_0xfb40('0xe3'),'dialogflowV2',_0x436fda[_0xfb40('0xec')]);return this['channel'][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0xed'),_0x436fda[_0xfb40('0xe2')]));}return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x3a6582,_0xfb40('0xee'));};AGIVertices[_0xfb40('0x10')][_0xfb40('0xef')]=function(_0x1646eb){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0xf0'),_0x1646eb[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0x1646eb['ndauth_url'])){return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0xf1'));}if(!this[_0xfb40('0x78')](_0x1646eb['username'])){return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0xf2'));}if(!this[_0xfb40('0x78')](_0x1646eb[_0xfb40('0xf3')])){return this[_0xfb40('0xd')]['noop'](_0xfb40('0xf4'));}if(!this[_0xfb40('0x78')](_0x1646eb[_0xfb40('0xf5')])){return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0x9f'));}this[_0xfb40('0xd')][_0xfb40('0xeb')]=!![];this[_0xfb40('0x30')](_0x1646eb);this[_0xfb40('0x3b')](_0x1646eb[_0xfb40('0x53')],'in','','');this['channel'][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0xf6'),_0x1646eb[_0xfb40('0x53')]));var _0x269096=this[_0xfb40('0x72')][_0xfb40('0x65')](this,_0x1646eb);if(_0x269096){for(var _0x34b2c6 in _0x269096){if(_0x269096[_0xfb40('0x89')](_0x34b2c6)){this[_0xfb40('0xd')][_0xfb40('0x92')](util['format'](_0xfb40('0xf7'),_0x34b2c6[_0xfb40('0x5e')]()),_0x269096[_0x34b2c6]);}}this[_0xfb40('0x3b')](_0x269096[_0xfb40('0xe2')],'out',_0xfb40('0xef'),'');if(_0x269096[_0xfb40('0xf8')]){this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0xf9'),_0x269096[_0xfb40('0xf8')]));var _0x14e3c7=this[_0xfb40('0xd')][_0xfb40('0xfa')](_0x269096[_0xfb40('0xf8')]);try{fs[_0xfb40('0xfb')](_0x269096['audiofile']+_0xfb40('0xfc'));}catch(_0x591a90){logger['error'](_0x591a90);}return _0x14e3c7;}else{return this['channel']['noop'](util[_0xfb40('0x25')](_0xfb40('0xfd'),_0x269096[_0xfb40('0xe2')]));}}return this['channel'][_0xfb40('0x2d')](_0x1646eb,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0xfb40('0xfe')]=function(_0x232ad7){logger[_0xfb40('0x98')](util['format'](_0xfb40('0xff'),_0x232ad7[_0xfb40('0x32')]));return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0xfe'));};AGIVertices[_0xfb40('0x10')][_0xfb40('0x100')]=function(_0x18263a){logger['info'](util[_0xfb40('0x25')](_0xfb40('0x101'),_0x18263a['label']));var _0x17ef91='';if(_0x18263a[_0xfb40('0x102')]){if(!this[_0xfb40('0x78')](_0x18263a[_0xfb40('0x102')])){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x18263a,'no\x20trunk\x20selected');}else{var _0x49bcaa=parseInt(_0x18263a[_0xfb40('0x102')],0xa);if(isNaN(_0x49bcaa)){_0x17ef91=_0x18263a['trunk_id'];}else{_0x17ef91=this['getTrunk'][_0xfb40('0x65')](this,_0x18263a[_0xfb40('0x102')]);if(!_0x17ef91){return this['channel'][_0xfb40('0x2d')](_0x18263a,_0xfb40('0x103'));}}}}else if(_0x18263a[_0xfb40('0x104')]){_0x17ef91=_0x18263a[_0xfb40('0x104')];}else{return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x18263a,_0xfb40('0x105'));}var _0x1c5daf=this['channel'][_0xfb40('0x4f')]('DIAL',[util[_0xfb40('0x25')]('SIP/%s/%s',_0x17ef91,_0x18263a['phone']),_0x18263a[_0xfb40('0x59')],_0x18263a[_0xfb40('0x106')],_0x18263a['url']]);if(_0x1c5daf[_0xfb40('0x97')]===-0x1){return _0x1c5daf;}return this[_0xfb40('0xd')]['noop'](util[_0xfb40('0x25')](_0xfb40('0x107'),_0xfb40('0xdc')));};AGIVertices[_0xfb40('0x10')][_0xfb40('0x108')]=function(_0x1e0cc8){logger['info'](util[_0xfb40('0x25')](_0xfb40('0x109'),_0x1e0cc8[_0xfb40('0x32')]));return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0x108'));};AGIVertices[_0xfb40('0x10')][_0xfb40('0xb')]=function(_0x4f3287){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x10a'),_0x4f3287[_0xfb40('0x32')]));if(_0x4f3287[_0xfb40('0x9c')]===0x0){return this[_0xfb40('0x9b')](_0x4f3287);}_0x4f3287[_0xfb40('0x9c')]-=0x1;if(!this[_0xfb40('0x78')](_0x4f3287[_0xfb40('0x10b')])){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x4f3287,_0xfb40('0x10c'));}var _0x416770=this[_0xfb40('0x1e')]['sync'](this,_0x4f3287[_0xfb40('0x10b')]);if(!_0x416770){return this[_0xfb40('0xd')]['error'](_0x4f3287,_0xfb40('0x10d'));}if(!this[_0xfb40('0x78')](_0x4f3287[_0xfb40('0xd0')])){return this[_0xfb40('0xd')]['error'](_0xfb40('0x10e'));}var _0x1bb14f=this['channel'][_0xfb40('0x10f')](_0x416770,_0x4f3287['response'],_0x4f3287[_0xfb40('0x110')]);var _0x37e9cf=_0x1bb14f['result']?_0x1bb14f[_0xfb40('0x97')][_0xfb40('0x45')]():'';logger[_0xfb40('0x98')](_0xfb40('0x111'),JSON[_0xfb40('0x68')](_0x1bb14f));if(_0x1bb14f[_0xfb40('0x97')]===-0x1){this[_0xfb40('0x30')][_0xfb40('0x65')](this,_0x4f3287,_0x37e9cf);return _0x1bb14f;}else if(_0x1bb14f[_0xfb40('0x9a')]===_0xfb40('0x59')){_0x1bb14f[_0xfb40('0x97')]=_0x37e9cf[_0xfb40('0x8d')]>=parseInt(_0x4f3287[_0xfb40('0x112')])?'x':'i';}else{_0x1bb14f[_0xfb40('0x97')]=_0x37e9cf[_0xfb40('0x8d')]>=parseInt(_0x4f3287[_0xfb40('0x112')])&&_0x37e9cf[_0xfb40('0x8d')]<=parseInt(_0x4f3287[_0xfb40('0x110')])?'x':'i';}var _0x4a55fd=this['getVariable']['sync'](this,_0x4f3287[_0xfb40('0xd0')]);if(!_0x4a55fd){return this[_0xfb40('0xd')]['error'](_0x4f3287,_0xfb40('0xd1'));}this[_0xfb40('0xd')][_0xfb40('0x92')](_0x4a55fd,_0x37e9cf);if(this[_0xfb40('0x78')](_0x4f3287[_0xfb40('0x113')])){var _0x4daefa=parseInt(_0x4f3287[_0xfb40('0x113')],0xa);var _0x3f0a25=rs['generate']({'charset':'*','length':_0x4daefa});var _0x2bdf55=_0x37e9cf[_0xfb40('0x8d')];if(_0x2bdf55>0x0){if(_0x2bdf55>_0x4daefa){this['createSquareDetailsReport'][_0xfb40('0x65')](this,_0x4f3287,_0x4f3287[_0xfb40('0x114')]===_0xfb40('0x115')?_0x3f0a25+_0x37e9cf['substr'](_0x4daefa):_0x37e9cf[_0xfb40('0x116')](0x0,_0x2bdf55-_0x4daefa)+_0x3f0a25);}else{this[_0xfb40('0x30')][_0xfb40('0x65')](this,_0x4f3287,rs[_0xfb40('0x117')]({'charset':'*','length':_0x2bdf55}));}}else{this[_0xfb40('0x30')][_0xfb40('0x65')](this,_0x4f3287,'');}}else{this[_0xfb40('0x30')][_0xfb40('0x65')](this,_0x4f3287,_0x37e9cf);}return _0x1bb14f;};AGIVertices[_0xfb40('0x10')][_0xfb40('0xc')]=function(_0x495d51){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x118'),_0x495d51[_0xfb40('0x32')]));return this[_0xfb40('0xb')](_0x495d51);};AGIVertices[_0xfb40('0x10')][_0xfb40('0x119')]=function(_0x4f735e){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x11a'),_0x4f735e[_0xfb40('0x32')]));this['createSquareDetailsReport'][_0xfb40('0x65')](this,_0x4f735e,_0x4f735e[_0xfb40('0x11b')]);return this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0x11c'),_0x4f735e['goalname']));};AGIVertices[_0xfb40('0x10')]['awspolly']=function(_0xb3ec70){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x11d'),_0xb3ec70[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0xb3ec70[_0xfb40('0x7b')])||!this['isConfigured'](_0xb3ec70[_0xfb40('0x7c')])){return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0x11e'));}if(!this[_0xfb40('0x78')](_0xb3ec70[_0xfb40('0x53')])){return this['channel'][_0xfb40('0xa1')](_0xfb40('0x9f'));}this[_0xfb40('0xd')][_0xfb40('0xa1')](util['format'](_0xfb40('0x11f'),_0xb3ec70[_0xfb40('0x53')]));var _0x1a9e2a=this[_0xfb40('0x7a')]['sync'](this,_0xb3ec70);if(_0x1a9e2a){this[_0xfb40('0xd')]['noop'](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x1a9e2a));var _0x2f24dc=this[_0xfb40('0xd')][_0xfb40('0xfa')](_0x1a9e2a);try{fs[_0xfb40('0xfb')](_0x1a9e2a+'.wav');}catch(_0x3fec95){logger[_0xfb40('0x2d')](_0x3fec95);}return _0x2f24dc;}return this[_0xfb40('0xd')]['error'](_0xb3ec70,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xfb40('0x10')][_0xfb40('0x120')]=function(_0x36c82c){logger[_0xfb40('0x98')](util['format'](_0xfb40('0x121'),_0x36c82c[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0x36c82c['aws_access_key_id'])||!this[_0xfb40('0x78')](_0x36c82c[_0xfb40('0x7c')])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xfb40('0x78')](_0x36c82c[_0xfb40('0x81')])){return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0x122'));}if(!this[_0xfb40('0x78')](_0x36c82c[_0xfb40('0x53')])){return this[_0xfb40('0xd')]['noop'](_0xfb40('0x9f'));}this[_0xfb40('0xd')][_0xfb40('0xeb')]=!![];this[_0xfb40('0x30')](_0x36c82c);this['createSquareMessage'](_0x36c82c[_0xfb40('0x53')],'in','','');this[_0xfb40('0xd')][_0xfb40('0xa1')](util['format'](_0xfb40('0x123'),_0x36c82c[_0xfb40('0x53')]));var _0x529f21=this['awsLex'][_0xfb40('0x65')](this,_0x36c82c);if(_0x529f21){for(var _0x418cdb in _0x529f21){if(_0x529f21[_0xfb40('0x89')](_0x418cdb)&&_[_0xfb40('0x8a')](_0x529f21[_0x418cdb])){this[_0xfb40('0xd')][_0xfb40('0x92')](util[_0xfb40('0x25')](_0xfb40('0x124'),_0x418cdb[_0xfb40('0x5e')]()),_0x529f21[_0x418cdb]);}}if(_[_0xfb40('0x3e')](_0x529f21[_0xfb40('0x6c')])){return this[_0xfb40('0xd')]['noop'](_0xfb40('0x125'));}else{this[_0xfb40('0x3b')](_0x529f21[_0xfb40('0x6c')],_0xfb40('0xe3'),_0xfb40('0x126'),'');return this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0x127'),_0x529f21['message']));}}return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x36c82c,_0xfb40('0x128'));};AGIVertices[_0xfb40('0x10')][_0xfb40('0x129')]=function(_0xd38b9a){logger[_0xfb40('0x98')](util[_0xfb40('0x25')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0xd38b9a[_0xfb40('0x32')],_0xd38b9a[_0xfb40('0x59')]));if(!this[_0xfb40('0x78')](_0xd38b9a[_0xfb40('0x74')])){return this[_0xfb40('0xd')]['noop']('no\x20key\x20configured');}var _0x2bc82c=_0xfb40('0x12a');var _0xfb2e97=util[_0xfb40('0x25')](_0xfb40('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x223f94=util[_0xfb40('0x25')]('%s.%s',_0xfb2e97,_0x2bc82c);var _0x8ac198=!![];if(_0xd38b9a[_0xfb40('0x12c')]==='NOBEEP'){_0x8ac198=![];}var _0x639304=this['channel'][_0xfb40('0x12d')](_0xfb2e97,_0x2bc82c,_0xd38b9a['intKey'],_0xd38b9a[_0xfb40('0x59')],undefined,_0x8ac198);if(_0x639304[_0xfb40('0x97')]!==-0x1){this['channel'][_0xfb40('0xa1')](util['format'](_0xfb40('0x12e'),_0x223f94));var _0x2ded45=this[_0xfb40('0x82')][_0xfb40('0x65')](this,_0xd38b9a,_0x223f94);if(_0x2ded45){for(var _0x283dec in _0x2ded45){if(_0x2ded45['hasOwnProperty'](_0x283dec)){this['channel'][_0xfb40('0x92')](util['format'](_0xfb40('0x12f'),_0x283dec[_0xfb40('0x5e')]()),_0x2ded45[_0x283dec]);}}return this[_0xfb40('0xd')]['noop'](util[_0xfb40('0x25')](_0xfb40('0x130'),JSON['stringify'](_0x2ded45)));}}return _0x639304;};AGIVertices[_0xfb40('0x10')]['tildeasr']=function(_0x129f44){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x131'),_0x129f44['label']));if(!this[_0xfb40('0x78')](_0x129f44[_0xfb40('0x84')])){return this[_0xfb40('0xd')]['noop'](_0xfb40('0x132'));}if(!this[_0xfb40('0x78')](_0x129f44['appsecret'])){return this[_0xfb40('0xd')][_0xfb40('0xa1')]('no\x20appsecret\x20configured');}var _0x40ab4e=_0xfb40('0x12a');var _0x4a7b20=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xfb40('0x117')](0x4));var _0x1e6bc1=util[_0xfb40('0x25')](_0xfb40('0x91'),_0x4a7b20,_0x40ab4e);var _0x40f6ae=!![];if(_0x129f44[_0xfb40('0x12c')]==='NOBEEP'){_0x40f6ae=![];}var _0x444540=this[_0xfb40('0xd')][_0xfb40('0x12d')](_0x4a7b20,_0x40ab4e,_0x129f44[_0xfb40('0x133')],_0x129f44[_0xfb40('0x59')],undefined,_0x40f6ae);if(_0x444540['result']!==-0x1){this['channel'][_0xfb40('0xa1')](util[_0xfb40('0x25')]('tilde\x20%s\x20file\x20created',_0x1e6bc1));var _0x1c9d0c=this[_0xfb40('0x134')][_0xfb40('0x65')](this,_0x129f44,_0x1e6bc1);if(_0x1c9d0c){for(var _0x5a8925 in _0x1c9d0c){if(_0x1c9d0c[_0xfb40('0x89')](_0x5a8925)){this[_0xfb40('0xd')]['setVariable'](util[_0xfb40('0x25')]('TILDE_ASR_%s',_0x5a8925[_0xfb40('0x5e')]()),_0x1c9d0c[_0x5a8925]);}}return this['channel'][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0x135'),JSON['stringify'](_0x1c9d0c)));}}return _0x444540;};AGIVertices[_0xfb40('0x10')]['gotoc']=function(_0x1a7e43){logger[_0xfb40('0x98')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x1a7e43[_0xfb40('0x32')]));return this[_0xfb40('0xd')][_0xfb40('0x136')](_0x1a7e43[_0xfb40('0x137')],_0x1a7e43[_0xfb40('0x37')],_0x1a7e43[_0xfb40('0x38')]);};AGIVertices[_0xfb40('0x10')][_0xfb40('0x138')]=function(_0xefb892){logger[_0xfb40('0x98')](util['format'](_0xfb40('0x139'),_0xefb892[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0xefb892[_0xfb40('0x13a')])){return this['channel'][_0xfb40('0x2d')](_0xefb892,_0xfb40('0x13b'));}try{var _0x59334e=eval(_0xefb892[_0xfb40('0x13a')])?'true':'false';this[_0xfb40('0xd')]['noop'](util[_0xfb40('0x25')]('EVAL\x20CONDITION\x20%s\x20%s',_0xefb892[_0xfb40('0x13a')],_0x59334e));return{'code':0xc8,'result':_0x59334e};}catch(_0x97da0d){return{'code':0xc8,'result':_0xfb40('0x13c')};}};AGIVertices[_0xfb40('0x10')][_0xfb40('0x13d')]=function(_0x49474d){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x13e'),_0x49474d[_0xfb40('0x32')]));if(!this['isConfigured'](_0x49474d['interval_id'])){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x49474d,_0xfb40('0x13f'));}var _0x761cd4=this[_0xfb40('0x140')][_0xfb40('0x65')](this,_0x49474d[_0xfb40('0x141')]);if(!_0x761cd4){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x49474d,'no\x20intervals\x20found');}for(var _0x1c2688=0x0;_0x1c2688<_0x761cd4[_0xfb40('0x8d')];_0x1c2688+=0x1){var _0x37ae97=this['channel']['getVariable'](util[_0xfb40('0x25')](_0xfb40('0x142'),_0x761cd4[_0x1c2688]));if(_0x37ae97[_0xfb40('0x97')]===-0x1){return _0x37ae97;}logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x143'),_0x761cd4[_0x1c2688],_0x37ae97[_0xfb40('0x9a')]));if(_0x37ae97[_0xfb40('0x9a')]===_0xfb40('0x144')){logger['info'](util[_0xfb40('0x25')](_0xfb40('0x143'),_0x761cd4[_0x1c2688],'true'));this[_0xfb40('0xd')]['noop'](util[_0xfb40('0x25')](_0xfb40('0x143'),_0x761cd4[_0x1c2688],_0xfb40('0x144')));return{'code':0xc8,'result':_0xfb40('0x144')};}else{logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x143'),_0x761cd4[_0x1c2688],_0xfb40('0x13c')));this[_0xfb40('0xd')]['noop'](util['format'](_0xfb40('0x143'),_0x761cd4[_0x1c2688],'false'));}}return{'code':0xc8,'result':_0xfb40('0x13c')};};AGIVertices['prototype'][_0xfb40('0x145')]=function(_0x23be4c){logger[_0xfb40('0x98')](util['format'](_0xfb40('0x146'),_0x23be4c['label']));return this[_0xfb40('0xd')]['hangup']();};AGIVertices['prototype'][_0xfb40('0x147')]=function(_0x38f2cb){logger[_0xfb40('0x98')](util[_0xfb40('0x25')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x38f2cb[_0xfb40('0x32')]));if(!this['isConfigured'](_0x38f2cb[_0xfb40('0x74')])){return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0xdf'));}var _0x1f7325=_0xfb40('0x12a');var _0x5388c9=util[_0xfb40('0x25')](_0xfb40('0x12b'),FILES_PATH,rs[_0xfb40('0x117')](0x4));var _0x2f513a=util[_0xfb40('0x25')](_0xfb40('0x91'),_0x5388c9,_0x1f7325);var _0x10ef38=!![];if(_0x38f2cb[_0xfb40('0x12c')]===_0xfb40('0x148')){_0x10ef38=![];}var _0x29a73c=this[_0xfb40('0xd')][_0xfb40('0x12d')](_0x5388c9,_0x1f7325,_0x38f2cb['intKey'],_0x38f2cb[_0xfb40('0x59')],undefined,_0x10ef38);if(_0x29a73c[_0xfb40('0x97')]!==-0x1){this['channel'][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0x149'),_0x2f513a));var _0x509fb0=this[_0xfb40('0x75')][_0xfb40('0x65')](this,_0x38f2cb,_0x2f513a);if(_0x509fb0){for(var _0x29d9d8 in _0x509fb0){if(_0x509fb0[_0xfb40('0x89')](_0x29d9d8)){this[_0xfb40('0xd')]['setVariable'](util[_0xfb40('0x25')](_0xfb40('0x14a'),_0x29d9d8[_0xfb40('0x5e')]()),_0x509fb0[_0x29d9d8]);}}return this[_0xfb40('0xd')]['noop'](util[_0xfb40('0x25')](_0xfb40('0x14b'),JSON[_0xfb40('0x68')](_0x509fb0)));}}return _0x29a73c;};AGIVertices[_0xfb40('0x10')][_0xfb40('0x14c')]=function(_0x2b7228){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x14d'),_0x2b7228[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0x2b7228[_0xfb40('0x74')])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0xfb40('0x78')](_0x2b7228['text'])){return this[_0xfb40('0xd')]['noop'](_0xfb40('0x9f'));}this['channel'][_0xfb40('0xa1')](util[_0xfb40('0x25')]('Trying\x20ispeech\x20TTS\x20%s',_0x2b7228['text']));var _0x11dc86=this['ispeechTTS'][_0xfb40('0x65')](this,_0x2b7228);if(_0x11dc86){this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')]('ispeech\x20%s\x20file\x20created',_0x11dc86));var _0x5190c8=this['channel'][_0xfb40('0xfa')](_0x11dc86,_0x2b7228[_0xfb40('0x133')]);try{fs[_0xfb40('0xfb')](_0x11dc86+_0xfb40('0xfc'));}catch(_0x32a6bd){logger[_0xfb40('0x2d')](_0x32a6bd);}return _0x5190c8;}return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x2b7228,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xfb40('0x10')]['login']=function(_0x4bd92c){logger[_0xfb40('0x98')](util['format'](_0xfb40('0x14e'),_0x4bd92c[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0x4bd92c[_0xfb40('0x14f')])){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x4bd92c,_0xfb40('0x150'));}logger[_0xfb40('0x98')](util[_0xfb40('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xfb40('0x34')],_0x4bd92c['findBy']));var _0x8b05a2=this[_0xfb40('0x4b')][_0xfb40('0x65')](this,_0x4bd92c[_0xfb40('0x14f')]);if(_0x8b05a2){logger[_0xfb40('0x98')](util[_0xfb40('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xfb40('0xd')][_0xfb40('0x34')],_0x4bd92c[_0xfb40('0x14f')]));this[_0xfb40('0xd')][_0xfb40('0xa1')](util['format'](_0xfb40('0x151'),this[_0xfb40('0xd')][_0xfb40('0x34')],_0x4bd92c['findBy']));return{'code':0xc8,'result':_0xfb40('0x152')};}else{logger[_0xfb40('0x98')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xfb40('0x34')],_0x4bd92c[_0xfb40('0x14f')]));this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0x153'),this[_0xfb40('0xd')]['callerid'],_0x4bd92c[_0xfb40('0x14f')]));return{'code':0xc8,'result':_0xfb40('0x154')};}};AGIVertices[_0xfb40('0x10')]['logout']=function(_0xac2712){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x155'),_0xac2712[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0xac2712[_0xfb40('0x14f')])){return this['channel']['error'](_0xac2712,_0xfb40('0x150'));}logger[_0xfb40('0x98')](util['format'](_0xfb40('0x156'),this[_0xfb40('0xd')][_0xfb40('0x34')],_0xac2712[_0xfb40('0x14f')]));var _0x311b25=this[_0xfb40('0x4a')][_0xfb40('0x65')](this,_0xac2712[_0xfb40('0x14f')]);if(_0x311b25){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x151'),this[_0xfb40('0xd')]['callerid'],_0xac2712['findBy']));this[_0xfb40('0xd')]['noop'](util[_0xfb40('0x25')](_0xfb40('0x151'),this[_0xfb40('0xd')][_0xfb40('0x34')],_0xac2712[_0xfb40('0x14f')]));return{'code':0xc8,'result':_0xfb40('0x152')};}else{logger[_0xfb40('0x98')](util['format'](_0xfb40('0x153'),this[_0xfb40('0xd')]['callerid'],_0xac2712[_0xfb40('0x14f')]));this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0x153'),this[_0xfb40('0xd')][_0xfb40('0x34')],_0xac2712[_0xfb40('0x14f')]));return{'code':0xc8,'result':_0xfb40('0x154')};}};AGIVertices[_0xfb40('0x10')][_0xfb40('0x157')]=function(_0x4ac521){logger[_0xfb40('0x98')](util[_0xfb40('0x25')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x4ac521[_0xfb40('0x32')]));if(!this['isConfigured'](_0x4ac521['operation'])){return this[_0xfb40('0xd')]['error'](_0x4ac521,'no\x20operation\x20configured');}this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')]('math\x20%s',_0x4ac521[_0xfb40('0x158')]));var _0x7d0f27=eval(_0x4ac521[_0xfb40('0x158')]);if(!this[_0xfb40('0x78')](_0x4ac521['variable_id'])){return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0x10e'));}var _0x60806f=this[_0xfb40('0x11')][_0xfb40('0x65')](this,_0x4ac521[_0xfb40('0xd0')]);if(!_0x60806f){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x4ac521,'no\x20variable\x20found');}if(_[_0xfb40('0x90')](_0x7d0f27)){var _0x204f5a=this;_0x7d0f27[_0xfb40('0xd2')](function(_0x288f17,_0x39e084){_0x204f5a[_0xfb40('0xd')][_0xfb40('0x92')](util[_0xfb40('0x25')](_0xfb40('0x159'),_0x60806f,_0x39e084),_0x288f17);});return this[_0xfb40('0xd')]['noop'](util[_0xfb40('0x25')](_0xfb40('0x15a'),_0x60806f));}else{return this[_0xfb40('0xd')]['setVariable'](_0x60806f,_0x7d0f27);}};AGIVertices[_0xfb40('0x10')]['menu']=function(_0x38a9e5){logger['info'](util[_0xfb40('0x25')](_0xfb40('0x15b'),_0x38a9e5['label']));if(_0x38a9e5[_0xfb40('0x9c')]===0x0){return this[_0xfb40('0x9b')](_0x38a9e5);}_0x38a9e5[_0xfb40('0x9c')]-=0x1;if(!this[_0xfb40('0x78')](_0x38a9e5[_0xfb40('0x10b')])){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x38a9e5,_0xfb40('0x10c'));}var _0x22bc09=this['getSound']['sync'](this,_0x38a9e5[_0xfb40('0x10b')]);if(!_0x22bc09){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x38a9e5,_0xfb40('0x10d'));}var _0x2d2a3e=this['channel']['getData'](_0x22bc09,_0x38a9e5[_0xfb40('0x15c')],_0x38a9e5[_0xfb40('0x15d')]);var _0x38ad91=_0x2d2a3e[_0xfb40('0x97')];if(_0x2d2a3e[_0xfb40('0x97')]===-0x1){this[_0xfb40('0x30')][_0xfb40('0x65')](this,_0x38a9e5,'-1');return _0x2d2a3e;}else if(_0x2d2a3e[_0xfb40('0x9a')]===_0xfb40('0x59')){_0x2d2a3e[_0xfb40('0x97')]=_0x2d2a3e[_0xfb40('0x97')][_0xfb40('0x8d')]>0x0?_0x2d2a3e[_0xfb40('0x97')]:'t';}else if(_[_0xfb40('0x3d')](_0x2d2a3e[_0xfb40('0x97')])){_0x2d2a3e[_0xfb40('0x97')]='#';_0x38ad91='#';}if(!this[_0xfb40('0x78')](_0x38a9e5[_0xfb40('0xd0')])){this[_0xfb40('0xd')]['noop'](_0xfb40('0x10e'));}else{var _0x5c0863=this['getVariable'][_0xfb40('0x65')](this,_0x38a9e5[_0xfb40('0xd0')]);if(!_0x5c0863){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x38a9e5,'no\x20variable\x20found');}this[_0xfb40('0xd')][_0xfb40('0x92')](_0x5c0863,_0x38ad91);}this[_0xfb40('0x30')]['sync'](this,_0x38a9e5,_0x38ad91);return _0x2d2a3e;};AGIVertices['prototype'][_0xfb40('0xa1')]=function(_0x3e07c6){logger[_0xfb40('0x98')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x3e07c6['label']));return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0x3e07c6['output']||_0x3e07c6['label']);};AGIVertices[_0xfb40('0x10')][_0xfb40('0x15e')]=function(_0x4f5088){logger['info'](util['format'](_0xfb40('0x15f'),_0x4f5088['label']));if(!this['isConfigured'](_0x4f5088[_0xfb40('0x14f')])){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x4f5088,_0xfb40('0x150'));}logger['info'](util[_0xfb40('0x25')](_0xfb40('0x156'),this['channel'][_0xfb40('0x34')],_0x4f5088['findBy']));var _0xf0ffec=this['getPause']['sync'](this,_0x4f5088[_0xfb40('0x160')]);var _0x28b6b4=this[_0xfb40('0x47')][_0xfb40('0x65')](this,_0x4f5088[_0xfb40('0x14f')],_0xf0ffec);if(_0x28b6b4){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x151'),this[_0xfb40('0xd')][_0xfb40('0x34')],_0x4f5088['findBy']));this['channel'][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0x151'),this[_0xfb40('0xd')][_0xfb40('0x34')],_0x4f5088[_0xfb40('0x14f')]));return{'code':0xc8,'result':'success'};}else{logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x153'),this[_0xfb40('0xd')]['callerid'],_0x4f5088['findBy']));this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0x151'),this[_0xfb40('0xd')][_0xfb40('0x34')],_0x4f5088[_0xfb40('0x14f')]));return{'code':0xc8,'result':_0xfb40('0x154')};}};AGIVertices[_0xfb40('0x10')][_0xfb40('0x161')]=function(_0x38531d){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x162'),_0x38531d['label']));if(!this[_0xfb40('0x78')](_0x38531d[_0xfb40('0x10b')])){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x38531d,_0xfb40('0x10c'));}var _0x3f5068=this[_0xfb40('0x1e')][_0xfb40('0x65')](this,_0x38531d[_0xfb40('0x10b')]);if(!_0x3f5068){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x38531d,_0xfb40('0x10d'));}var _0x21963c=this['channel'][_0xfb40('0x4f')](_0xfb40('0x163'),[_0x3f5068,_0x38531d[_0xfb40('0x106')]]);if(_0x21963c[_0xfb40('0x97')]===-0x1){return _0x21963c;}return this['channel']['noop'](util[_0xfb40('0x25')](_0xfb40('0xc0'),_0xfb40('0x163'),_0x3f5068));};AGIVertices['prototype']['queue']=function(_0x1646f3){logger['info'](util[_0xfb40('0x25')](_0xfb40('0x164'),_0x1646f3[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0x1646f3['queue_id'])){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x1646f3,_0xfb40('0x165'));}var _0x4755df='';var _0x244fd7=parseInt(_0x1646f3['queue_id'],0xa);if(isNaN(_0x244fd7)){_0x4755df=_0x1646f3[_0xfb40('0x166')];}else{_0x4755df=this['getVoiceQueue'][_0xfb40('0x65')](this,_0x1646f3['queue_id']);if(!_0x4755df){return this['channel'][_0xfb40('0x2d')](_0x1646f3,_0xfb40('0x167'));}}var _0x1411f6='';if(this[_0xfb40('0x78')](_0x1646f3[_0xfb40('0x10b')])){var _0x2663ef=this[_0xfb40('0x1e')][_0xfb40('0x65')](this,_0x1646f3[_0xfb40('0x10b')]);if(_0x2663ef){_0x1411f6=_0x2663ef;}}this[_0xfb40('0x30')][_0xfb40('0x65')](this,_0x1646f3,_0x4755df);if(_0x1646f3['opts']['indexOf']('x')<0x0){_0x1646f3[_0xfb40('0x106')]+='x';}if(_0x1646f3['opts'][_0xfb40('0x168')]('X')<0x0){_0x1646f3[_0xfb40('0x106')]+='X';}this['channel']['setVariable'](_0xfb40('0x169'),_0x4755df?_0x4755df[_0xfb40('0x16a')]():'');var _0x518ef0=this['channel'][_0xfb40('0x4f')](_0xfb40('0x16b'),[_0x4755df,_0x1646f3[_0xfb40('0x106')],_0x1646f3[_0xfb40('0x16c')],_0x1411f6,_0x1646f3[_0xfb40('0x59')],_0x1646f3[_0xfb40('0xad')],_0x1646f3[_0xfb40('0x16d')],_0x1646f3[_0xfb40('0x16e')],'',_0x1646f3['position']]);if(_0x518ef0[_0xfb40('0x97')]===-0x1){return _0x518ef0;}return this['channel']['noop'](util[_0xfb40('0x25')](_0xfb40('0xc0'),_0xfb40('0x16b'),_0x4755df));};AGIVertices[_0xfb40('0x10')][_0xfb40('0x16f')]=function(_0x16d4fa){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x170'),_0x16d4fa[_0xfb40('0x32')]));var _0x263707=_0x16d4fa[_0xfb40('0x171')]||'wav';var _0x1cdb73=util[_0xfb40('0x25')](_0xfb40('0x172'),this[_0xfb40('0xd')][_0xfb40('0x31')],rs['generate'](0x5));var _0x52a6a2=util[_0xfb40('0x25')](_0xfb40('0x173'),FILES_PATH,_0x1cdb73,_0x263707);var _0x5d4eb4=util['format'](_0xfb40('0x12b'),FILES_PATH,_0x1cdb73);this['createSquareRecording'][_0xfb40('0x65')](this,_0x16d4fa,_0x1cdb73,_0x52a6a2);this[_0xfb40('0xd')][_0xfb40('0x92')]('RECORDING_SAVENAME',_0x1cdb73);logger[_0xfb40('0x98')](_0xfb40('0x174'),_0x5d4eb4,_0x263707,_0x16d4fa[_0xfb40('0x175')],_0x16d4fa[_0xfb40('0x59')]);return this['channel'][_0xfb40('0x12d')](_0x5d4eb4,_0x263707,_0x16d4fa[_0xfb40('0x175')],_0x16d4fa['timeout'],undefined,!![]);};AGIVertices[_0xfb40('0x10')][_0xfb40('0x176')]=function(_0x923449){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x177'),_0x923449['label']));if(!this[_0xfb40('0x78')](_0x923449[_0xfb40('0x16c')])){return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0x178'));}var _0x58385f=this[_0xfb40('0x179')][_0xfb40('0x65')](this,_0x923449);logger[_0xfb40('0x98')](util[_0xfb40('0x25')]('Response:',util[_0xfb40('0x17a')](_0x58385f,{'showHidden':![],'depth':null})));if(!this[_0xfb40('0x78')](_0x923449['variable_id'])){return this[_0xfb40('0xd')]['noop'](_0xfb40('0x17b'));}var _0x3532d9=this[_0xfb40('0x11')][_0xfb40('0x65')](this,_0x923449[_0xfb40('0xd0')]);if(!_0x3532d9){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x923449,_0xfb40('0xd1'));}this[_0xfb40('0xd')][_0xfb40('0x92')](util[_0xfb40('0x25')]('%s_STATUS_CODE',_0x3532d9),_0x58385f[_0xfb40('0x6a')]?_0x58385f['statusCode']:_0xfb40('0x17c'));this[_0xfb40('0xd')][_0xfb40('0x92')](util[_0xfb40('0x25')]('%s_STATUS_MESSAGE',_0x3532d9),_0x58385f[_0xfb40('0x6b')]?_0x58385f[_0xfb40('0x6b')]:'OK');if(_0x58385f[_0xfb40('0x5f')]){try{this[_0xfb40('0x8f')](_0x58385f[_0xfb40('0x5f')],_0x3532d9);}catch(_0x761d59){logger[_0xfb40('0x2d')](util[_0xfb40('0x25')](_0xfb40('0x17d'),_0x3532d9));}}return this['channel'][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0xd5'),_0x3532d9));};AGIVertices[_0xfb40('0x10')][_0xfb40('0x17e')]=function(_0xe10e09){logger[_0xfb40('0x98')](util['format'](_0xfb40('0x17f'),_0xe10e09[_0xfb40('0x32')]));return this[_0xfb40('0xd')][_0xfb40('0x180')](_0xe10e09[_0xfb40('0x181')][_0xfb40('0x51')](/\s+/g,''),_0xe10e09[_0xfb40('0x175')]);};AGIVertices[_0xfb40('0x10')]['saynumber']=function(_0x4a2a10){logger['info'](util[_0xfb40('0x25')](_0xfb40('0x182'),_0x4a2a10[_0xfb40('0x32')]));return this['channel']['sayNumber'](_0x4a2a10[_0xfb40('0x183')][_0xfb40('0x51')](/\s+/g,''),_0x4a2a10[_0xfb40('0x175')]);};AGIVertices[_0xfb40('0x10')]['sayphonetic']=function(_0x1f6658){logger['info'](util[_0xfb40('0x25')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1f6658['label']));return this[_0xfb40('0xd')][_0xfb40('0x184')](_0x1f6658[_0xfb40('0x53')],_0x1f6658[_0xfb40('0x175')]);};AGIVertices[_0xfb40('0x10')][_0xfb40('0x185')]=function(_0x8579b5){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x186'),_0x8579b5[_0xfb40('0x32')]));if(!this['isConfigured'](_0x8579b5[_0xfb40('0x187')])){return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0x188'));}var _0x3002b2=this[_0xfb40('0x189')][_0xfb40('0x65')](this,_0x8579b5[_0xfb40('0x187')]);if(!_0x3002b2||!_0x3002b2[_0xfb40('0x18a')]){return this[_0xfb40('0xd')]['error'](_0x8579b5,_0xfb40('0x18b'));}var _0x58b434={'from':util[_0xfb40('0x25')](_0xfb40('0x18c'),_0x3002b2[_0xfb40('0x13')],_0x3002b2['email']||_0x3002b2[_0xfb40('0x18a')][_0xfb40('0x18d')]),'to':_0x8579b5['to']||'','cc':_0x8579b5['cc']||'','bcc':_0x8579b5[_0xfb40('0x18e')]||'','subject':_0x8579b5[_0xfb40('0x18f')],'html':_0x8579b5[_0xfb40('0x53')],'text':_0x8579b5['text']};var _0x43b090={'tls':{'rejectUnauthorized':![]}};if(_0x3002b2[_0xfb40('0x18a')][_0xfb40('0x190')]){_0x43b090[_0xfb40('0x190')]=_0x3002b2[_0xfb40('0x18a')][_0xfb40('0x190')];}else{_0x43b090['host']=_0x3002b2[_0xfb40('0x18a')][_0xfb40('0x191')];_0x43b090[_0xfb40('0x192')]=_0x3002b2['Smtp'][_0xfb40('0x192')];_0x43b090[_0xfb40('0x193')]=_0x3002b2['Smtp'][_0xfb40('0x193')];}if(_0x3002b2['Smtp'][_0xfb40('0x194')]){_0x43b090[_0xfb40('0x195')]={'user':_0x3002b2['Smtp'][_0xfb40('0x18d')],'pass':_0x3002b2[_0xfb40('0x18a')]['pass']};}if(this[_0xfb40('0x78')](_0x8579b5[_0xfb40('0x196')])){}logger[_0xfb40('0x197')](_0xfb40('0x198'),JSON[_0xfb40('0x68')](_0x58b434));this[_0xfb40('0x30')][_0xfb40('0x65')](this,_0x8579b5,_0x8579b5[_0xfb40('0x187')]);this[_0xfb40('0xd')]['noop'](util['format'](_0xfb40('0x199'),_0x3002b2[_0xfb40('0x13')]));this['sendMailMessage'][_0xfb40('0x65')](this,_0x43b090,_0x58b434);return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0x19a'));};AGIVertices[_0xfb40('0x10')][_0xfb40('0x19b')]=function(_0x4de1d8){logger[_0xfb40('0x98')](util['format'](_0xfb40('0x19c'),_0x4de1d8['label']));return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0x19d'));};AGIVertices['prototype']['sendSMS']=function(_0xf64363){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x19e'),_0xf64363[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0xf64363[_0xfb40('0x19f')])){return this[_0xfb40('0xd')]['noop'](_0xfb40('0x1a0'));}var _0x5ebdfd=this[_0xfb40('0x1a1')][_0xfb40('0x65')](this,_0xf64363['sms_account_id']);if(!_0x5ebdfd){return this[_0xfb40('0xd')]['error'](_0xf64363,_0xfb40('0x1a2'));}var _0x54529b={'body':_0xf64363[_0xfb40('0x1a3')],'phone':_0xf64363['to']||'','SmsAccountId':_0x5ebdfd['id']};logger[_0xfb40('0x197')](_0xfb40('0x1a4'),JSON[_0xfb40('0x68')](_0x54529b));this[_0xfb40('0x30')][_0xfb40('0x65')](this,_0xf64363,_0xf64363[_0xfb40('0x19f')]);this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0x1a5'),_0x5ebdfd[_0xfb40('0x13')]));this[_0xfb40('0x2f')][_0xfb40('0x65')](this,_0x54529b);return this[_0xfb40('0xd')][_0xfb40('0xa1')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['set']=function(_0x5cf10f){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x1a6'),_0x5cf10f[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0x5cf10f[_0xfb40('0xd0')])){return this['channel'][_0xfb40('0x2d')](_0x5cf10f,_0xfb40('0x1a7'));}var _0x1cd555=this[_0xfb40('0x11')][_0xfb40('0x65')](this,_0x5cf10f[_0xfb40('0xd0')]);if(!_0x1cd555){return this[_0xfb40('0xd')]['error'](_0x5cf10f,'no\x20variable\x20found');}return this[_0xfb40('0xd')][_0xfb40('0x92')](_0x1cd555,_0x5cf10f[_0xfb40('0x1a8')]);};AGIVertices[_0xfb40('0x10')][_0xfb40('0x1a9')]=function(_0x391be0){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x1aa'),_0x391be0[_0xfb40('0x32')]));this[_0xfb40('0xd')]['noop'](_0xfb40('0x1ab'));if(_0x391be0[_0xfb40('0xb4')]===_0xfb40('0x1ac')){this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0x1ad'));return this[_0xfb40('0xd')][_0xfb40('0xb4')]();}return this['channel'][_0xfb40('0xa1')](_0xfb40('0x1ae'));};AGIVertices[_0xfb40('0x10')][_0xfb40('0x1af')]=function(_0x4b0321){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x1b0'),_0x4b0321[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0x4b0321[_0xfb40('0x1b1')])){return this['channel'][_0xfb40('0x2d')](_0x4b0321,'no\x20subproject\x20selected');}var _0x882f97=this['getSquareProject'][_0xfb40('0x65')](this,_0x4b0321[_0xfb40('0x1b1')]);if(!this[_0xfb40('0x78')](_0x882f97)){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x4b0321,util[_0xfb40('0x25')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x4b0321[_0xfb40('0x1b1')]));}if(_0x882f97===this[_0xfb40('0xd')][_0xfb40('0x33')]){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x4b0321,_0xfb40('0x1b2'));}this[_0xfb40('0x30')][_0xfb40('0x65')](this,_0x4b0321,_0x882f97);var _0x1125ff=this[_0xfb40('0xd')]['exec']('AGI',util['format'](_0xfb40('0x1b3'),config['agi']['host']||_0xfb40('0x1b4'),_0x882f97,this['channel'][_0xfb40('0x33')]));if(_0x1125ff['result']===-0x1){return _0x1125ff;}return this['channel']['noop'](util[_0xfb40('0x25')](_0xfb40('0xc0'),'AGI',_0x882f97));};AGIVertices[_0xfb40('0x10')]['system']=function(_0x298226){logger['info'](util[_0xfb40('0x25')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x298226[_0xfb40('0x32')]));var _0x5cbde3=this['shellCommand']['sync'](this,_0x298226[_0xfb40('0xaf')]);this[_0xfb40('0x30')][_0xfb40('0x65')](this,_0x298226,_0x298226[_0xfb40('0xaf')]);if(this[_0xfb40('0x78')](_0x298226[_0xfb40('0xd0')])){var _0x46019e=this[_0xfb40('0x11')]['sync'](this,_0x298226['variable_id']);if(_0x46019e){this[_0xfb40('0xd')][_0xfb40('0x92')](_0x46019e,_0x5cbde3);return this[_0xfb40('0xd')]['noop'](util[_0xfb40('0x25')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x298226[_0xfb40('0xaf')],_0x46019e));}}return this[_0xfb40('0xd')]['noop'](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x298226[_0xfb40('0xaf')]));};AGIVertices['prototype'][_0xfb40('0x1b5')]=function(_0x3b440c){logger[_0xfb40('0x98')](util[_0xfb40('0x25')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3b440c[_0xfb40('0x32')]));_0x3b440c['text']=_0x3b440c['text'][_0xfb40('0x51')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xfb40('0x78')](_0x3b440c[_0xfb40('0x1b6')])){return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0x1b7'));}if(!this[_0xfb40('0x78')](_0x3b440c['text'])){return this[_0xfb40('0xd')][_0xfb40('0xa1')](_0xfb40('0x9f'));}this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x3b440c['text']));var _0x4c5b69=this[_0xfb40('0x52')][_0xfb40('0x65')](this,_0x3b440c);if(_0x4c5b69){this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x4c5b69));var _0x446943=this['channel']['streamFile'](_0x4c5b69);try{fs[_0xfb40('0xfb')](_0x4c5b69+_0xfb40('0xfc'));}catch(_0x5006b2){logger[_0xfb40('0x2d')](_0x5006b2);}return _0x446943;}return this[_0xfb40('0xd')]['error'](_0x3b440c,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xfb40('0x10')][_0xfb40('0x1b8')]=function(_0x375989){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x1b9'),_0x375989[_0xfb40('0x32')]));_0x375989[_0xfb40('0x53')]=_0x375989[_0xfb40('0x53')][_0xfb40('0x51')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xfb40('0x78')](_0x375989['text'])){return this[_0xfb40('0xd')][_0xfb40('0xa1')]('no\x20text\x20configured');}this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0x1ba'),_0x375989[_0xfb40('0x53')]));var _0x11a823=this[_0xfb40('0x57')][_0xfb40('0x65')](this,_0x375989);if(_0x11a823){this[_0xfb40('0xd')]['noop'](util[_0xfb40('0x25')](_0xfb40('0x1bb'),_0x11a823));var _0x4a83ce=this[_0xfb40('0xd')][_0xfb40('0xfa')](_0x11a823);try{fs[_0xfb40('0xfb')](_0x11a823+'.wav');}catch(_0x4c9179){logger['error'](_0x4c9179);}return _0x4a83ce;}return this['channel'][_0xfb40('0x2d')](_0x375989,_0xfb40('0x1bc'));};AGIVertices[_0xfb40('0x10')][_0xfb40('0x1bd')]=function(_0x54fe8f){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x1be'),_0x54fe8f[_0xfb40('0x32')]));if(!this['isConfigured'](_0x54fe8f[_0xfb40('0x14f')])){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x54fe8f,_0xfb40('0x150'));}logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x156'),this[_0xfb40('0xd')]['callerid'],_0x54fe8f[_0xfb40('0x14f')]));var _0x378455=this[_0xfb40('0x49')][_0xfb40('0x65')](this,_0x54fe8f[_0xfb40('0x14f')]);if(_0x378455){logger[_0xfb40('0x98')](util[_0xfb40('0x25')](_0xfb40('0x151'),this[_0xfb40('0xd')][_0xfb40('0x34')],_0x54fe8f['findBy']));this[_0xfb40('0xd')][_0xfb40('0xa1')](util['format'](_0xfb40('0x151'),this[_0xfb40('0xd')][_0xfb40('0x34')],_0x54fe8f[_0xfb40('0x14f')]));return{'code':0xc8,'result':_0xfb40('0x152')};}else{logger['info'](util['format'](_0xfb40('0x153'),this[_0xfb40('0xd')]['callerid'],_0x54fe8f[_0xfb40('0x14f')]));this[_0xfb40('0xd')][_0xfb40('0xa1')](util[_0xfb40('0x25')](_0xfb40('0x153'),this[_0xfb40('0xd')][_0xfb40('0x34')],_0x54fe8f['findBy']));return{'code':0xc8,'result':_0xfb40('0x154')};}};AGIVertices[_0xfb40('0x10')][_0xfb40('0x1bf')]=function(_0x8a97cb){logger[_0xfb40('0x98')](util[_0xfb40('0x25')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x8a97cb[_0xfb40('0x32')]));var _0x3389ed=this[_0xfb40('0xd')][_0xfb40('0x4f')](_0xfb40('0x1c0'),[_0x8a97cb[_0xfb40('0x1c1')],_0x8a97cb[_0xfb40('0xa0')]]);if(_0x3389ed[_0xfb40('0x97')]===-0x1){return _0x3389ed;}return this['channel'][_0xfb40('0xa1')](util[_0xfb40('0x25')]('Executed\x20command\x20%s\x20%s',_0xfb40('0x1c0'),_0x8a97cb[_0xfb40('0x1c1')]));};AGIVertices[_0xfb40('0x10')][_0xfb40('0x1c2')]=function(_0x22225d){logger[_0xfb40('0x98')](util['format'](_0xfb40('0x1c3'),_0x22225d[_0xfb40('0x32')]));if(!this[_0xfb40('0x78')](_0x22225d[_0xfb40('0xd0')])){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x22225d,_0xfb40('0x1a7'));}var _0x112ad6=this[_0xfb40('0x11')][_0xfb40('0x65')](this,_0x22225d[_0xfb40('0xd0')]);if(!_0x112ad6){return this[_0xfb40('0xd')][_0xfb40('0x2d')](_0x22225d,_0xfb40('0xd1'));}var _0x28e3bb=this['channel'][_0xfb40('0x11')](_0x112ad6);return{'code':0xc8,'result':_0x28e3bb[_0xfb40('0x9a')]?_0x28e3bb['extra']:'-'};};String[_0xfb40('0x10')][_0xfb40('0x95')]=function(_0x5c3740,_0x32d050){return this[_0xfb40('0x94')](_0x5c3740)[_0xfb40('0x1c4')](_0x32d050);};module[_0xfb40('0x1c5')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 0d23457..8c561b0 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 _0xa41a=['[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','interface','queue','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','attended','destlinkedid','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer'];(function(_0x2fe9da,_0x296bb5){var _0x188fdf=function(_0x19d114){while(--_0x19d114){_0x2fe9da['push'](_0x2fe9da['shift']());}};_0x188fdf(++_0x296bb5);}(_0xa41a,0x6b));var _0xaa41=function(_0x4db03f,_0x195454){_0x4db03f=_0x4db03f-0x0;var _0x662f56=_0xa41a[_0x4db03f];return _0x662f56;};'use strict';var util=require(_0xaa41('0x0'));var _=require(_0xaa41('0x1'));var moment=require('moment');var ami=require(_0xaa41('0x2'));var logger=require(_0xaa41('0x3'))(_0xaa41('0x4'));var RpcUser=require(_0xaa41('0x5'));var RpcVoiceAgentReport=require(_0xaa41('0x6'));function Acw(_0x3168be){this[_0xaa41('0x7')]=_0x3168be[_0xaa41('0x7')];this['agents']=_0x3168be[_0xaa41('0x8')];this[_0xaa41('0x9')]=_0x3168be['timers'];this['channels']={};ami['on'](_0xaa41('0xa'),this[_0xaa41('0xb')]['bind'](this));ami['on'](_0xaa41('0xc'),this[_0xaa41('0xd')][_0xaa41('0xe')](this));ami['on'](_0xaa41('0xf'),this[_0xaa41('0x10')][_0xaa41('0xe')](this));ami['on'](_0xaa41('0x11'),this[_0xaa41('0x12')][_0xaa41('0xe')](this));ami['on']('attendedtransfer',this[_0xaa41('0x13')][_0xaa41('0xe')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xaa41('0xe')](this));ami['on']('custom:agentConnectPreview',this[_0xaa41('0x14')][_0xaa41('0xe')](this));}function getDiff(_0x2f64bc){var _0x889d44=moment()[_0xaa41('0x15')](0x0);var _0x4eaf81=moment(_0x2f64bc)[_0xaa41('0x15')](0x0);return _0x889d44[_0xaa41('0x16')](_0x4eaf81,_0xaa41('0x17'));}Acw[_0xaa41('0x18')][_0xaa41('0x19')]=function(_0x2005ae){try{var _0x1e1e02=this;var _0x550ad5=this[_0xaa41('0x1a')][_0x2005ae][_0xaa41('0x1b')];var _0x4210fa=this[_0xaa41('0x1a')][_0x2005ae][_0xaa41('0x1c')];var _0xd20ddf=this[_0xaa41('0x7')][_0x4210fa];var _0x46e6d3=![];var _0x150ddf='ACW';if(_0xd20ddf['mandatoryDisposition']){if(_0xd20ddf[_0xaa41('0x1d')][_0xaa41('0x1e')]){_0x46e6d3=!![];_0x150ddf=_0xd20ddf[_0xaa41('0x1d')]['name'];}}ami[_0xaa41('0x1f')]({'action':_0xaa41('0x20'),'interface':_0x550ad5,'paused':!![],'reason':_0x150ddf})['then'](function(_0x513c61){if(_0x1e1e02[_0xaa41('0x8')][_0x550ad5]){return RpcUser['getAgent'](_0x1e1e02[_0xaa41('0x8')][_0x550ad5]['id'])[_0xaa41('0x21')](function(_0x3e2175){if(_0x3e2175&&!_0x3e2175[_0xaa41('0x22')]){logger[_0xaa41('0x23')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x2005ae,_0x550ad5,_0x4210fa);var _0x43c430=_0x1e1e02[_0xaa41('0x1a')][_0x2005ae][_0xaa41('0x24')]&&_0x1e1e02[_0xaa41('0x1a')][_0x2005ae][_0xaa41('0x25')]?_0x1e1e02[_0xaa41('0x1a')][_0x2005ae]['destlinkedid']:_0x2005ae;return RpcUser['savePause'](_0x1e1e02[_0xaa41('0x8')][_0x550ad5],_0x150ddf,_0x43c430)['then'](function(_0x493a10){if(!_0x46e6d3){_0x1e1e02[_0xaa41('0x9')][_0x550ad5]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2005ae,_0x1e1e02[_0xaa41('0x7')][_0x4210fa][_0xaa41('0x26')],_0x550ad5,_0x4210fa);_0x1e1e02[_0xaa41('0x9')][_0x550ad5][_0xaa41('0x27')]=setTimeout(_0x1e1e02[_0xaa41('0x28')][_0xaa41('0xe')](_0x1e1e02,_0x550ad5),_0x1e1e02['voiceQueues'][_0x4210fa][_0xaa41('0x26')]*0x3e8);_0x1e1e02[_0xaa41('0x9')][_0x550ad5][_0xaa41('0x29')]=moment()[_0xaa41('0x2a')](_0xaa41('0x2b'));_0x1e1e02[_0xaa41('0x9')][_0x550ad5][_0xaa41('0x2c')]=_0x2005ae;_0x1e1e02[_0xaa41('0x9')][_0x550ad5]['queue']=_0x4210fa;_0x1e1e02[_0xaa41('0x9')][_0x550ad5]['updateAcw']=function(){var _0x5dad80=getDiff(_0x1e1e02[_0xaa41('0x9')][_0x550ad5][_0xaa41('0x29')]);clearTimeout(_0x1e1e02['timers'][_0x550ad5][_0xaa41('0x27')]);_0x1e1e02[_0xaa41('0x9')][_0x550ad5]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x5dad80},_0x1e1e02['timers'][_0x550ad5][_0xaa41('0x2c')],_0x550ad5)[_0xaa41('0x21')](function(_0x2a186e){logger[_0xaa41('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x2005ae,_0x5dad80,_0x2a186e);})[_0xaa41('0x2d')](function(_0x45c8fe){logger[_0xaa41('0x2e')]('[%s][UPDATE][ERRORS:%s]',_0x2005ae,_0x45c8fe);});delete _0x1e1e02[_0xaa41('0x9')][_0x550ad5];};}});}else{logger[_0xaa41('0x23')](_0xaa41('0x2f'),_0x2005ae,_0x550ad5,_0x4210fa);}});}})['catch'](function(_0x252c62){logger[_0xaa41('0x2e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2005ae,_0x1e1e02[_0xaa41('0x7')][_0x4210fa][_0xaa41('0x26')],_0x550ad5,_0x4210fa);})[_0xaa41('0x30')](function(){delete _0x1e1e02['channels'][_0x2005ae];});}catch(_0x22b272){logger['error'](_0xaa41('0x31'),_0x22b272[_0xaa41('0x32')]);}};Acw[_0xaa41('0x18')]['stopAcw']=function(_0x526377){try{var _0x4cdd42=this;if(_0x4cdd42[_0xaa41('0x9')][_0x526377]){_0x4cdd42[_0xaa41('0x9')][_0x526377][_0xaa41('0x27')]=![];var _0x224eb3=_0x4cdd42['timers'][_0x526377]['uniqueid'];var _0x267999=_0x4cdd42[_0xaa41('0x9')][_0x526377][_0xaa41('0x1c')];var _0x4e8d2e=_0x4cdd42[_0xaa41('0x7')][_0x267999][_0xaa41('0x26')];logger[_0xaa41('0x23')]('[TIMER][STOP][AGENT:%s]',_0x526377);RpcUser[_0xaa41('0x33')](this[_0xaa41('0x8')][_0x526377]);RpcVoiceAgentReport[_0xaa41('0x34')]({'acwtime':_0x4e8d2e,'agentacw':!![]},_0x224eb3,_0x526377)[_0xaa41('0x21')](function(_0x57f1bf){logger['info'](_0xaa41('0x35'),_0x224eb3,_0x4e8d2e,_0x57f1bf);})[_0xaa41('0x2d')](function(_0x5eae08){logger[_0xaa41('0x2e')]('[%s][UPDATE][ERRORS:%s]',_0x224eb3,_0x5eae08);});}else{logger[_0xaa41('0x2e')](_0xaa41('0x36'),_0x526377);if(_0x4cdd42[_0xaa41('0x9')]){logger[_0xaa41('0x23')](_0xaa41('0x37'),JSON[_0xaa41('0x38')](_0x4cdd42[_0xaa41('0x9')]));}}}catch(_0x21f204){logger['error'](_0xaa41('0x39'),_0x21f204[_0xaa41('0x32')]);}};Acw[_0xaa41('0x18')][_0xaa41('0xb')]=function(_0xc84fb8){try{if(this[_0xaa41('0x7')][_0xc84fb8['queue']]&&(this['voiceQueues'][_0xc84fb8[_0xaa41('0x1c')]]['acw']||this[_0xaa41('0x7')][_0xc84fb8[_0xaa41('0x1c')]][_0xaa41('0x3a')])){if(this[_0xaa41('0x8')][_0xc84fb8[_0xaa41('0x1b')]]){this[_0xaa41('0x1a')][_0xc84fb8[_0xaa41('0x2c')]]={'queue':_0xc84fb8['queue'],'interface':_0xc84fb8[_0xaa41('0x1b')],'destlinkedid':_0xc84fb8['destlinkedid']};}}}catch(_0x4dd842){logger[_0xaa41('0x2e')]('[ACW][syncAgentConnect]\x20%s',_0x4dd842['message']);}};Acw['prototype'][_0xaa41('0x14')]=function(_0x525b09){try{if(this[_0xaa41('0x7')][_0x525b09[_0xaa41('0x1c')]]&&(this['voiceQueues'][_0x525b09['queue']][_0xaa41('0x4')]||this[_0xaa41('0x7')][_0x525b09[_0xaa41('0x1c')]][_0xaa41('0x3a')])){if(this[_0xaa41('0x8')][_0x525b09[_0xaa41('0x1b')]]){this[_0xaa41('0x1a')][_0x525b09[_0xaa41('0x2c')]]={'queue':_0x525b09[_0xaa41('0x1c')],'interface':_0x525b09['interface']};}}}catch(_0x2eec35){logger[_0xaa41('0x2e')](_0xaa41('0x3b'),_0x2eec35[_0xaa41('0x32')]);}};Acw[_0xaa41('0x18')][_0xaa41('0xd')]=function(_0x538b12){try{if(this[_0xaa41('0x1a')][_0x538b12[_0xaa41('0x2c')]]&&_[_0xaa41('0x3c')](this[_0xaa41('0x1a')][_0x538b12['uniqueid']][_0xaa41('0x24')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x538b12[_0xaa41('0x2c')]);this[_0xaa41('0x19')](_0x538b12[_0xaa41('0x2c')]);}else if(this['channels'][_0x538b12[_0xaa41('0x3d')]]&&_[_0xaa41('0x3c')](this[_0xaa41('0x1a')][_0x538b12['linkedid']][_0xaa41('0x24')])){logger[_0xaa41('0x23')](_0xaa41('0x3e'),_0x538b12[_0xaa41('0x3d')]);this[_0xaa41('0x19')](_0x538b12[_0xaa41('0x3d')]);}}catch(_0x333a9f){logger[_0xaa41('0x2e')]('[ACW][syncHangupRequest]\x20%s',_0x333a9f[_0xaa41('0x32')]);}};Acw['prototype']['syncHangup']=function(_0x1bdcd6){try{if(this[_0xaa41('0x1a')][_0x1bdcd6[_0xaa41('0x2c')]]&&this[_0xaa41('0x1a')][_0x1bdcd6[_0xaa41('0x2c')]][_0xaa41('0x24')]){logger[_0xaa41('0x23')](_0xaa41('0x3f'),_0x1bdcd6['uniqueid']);this[_0xaa41('0x19')](_0x1bdcd6[_0xaa41('0x2c')]);}else if(this[_0xaa41('0x1a')][_0x1bdcd6['linkedid']]&&this[_0xaa41('0x1a')][_0x1bdcd6[_0xaa41('0x3d')]]['attended']){logger[_0xaa41('0x23')](_0xaa41('0x40'),_0x1bdcd6[_0xaa41('0x3d')]);this['startAcw'](_0x1bdcd6[_0xaa41('0x3d')]);}}catch(_0xc8e626){logger['error']('[ACW][syncHangup]\x20%s',_0xc8e626[_0xaa41('0x32')]);}};Acw[_0xaa41('0x18')][_0xaa41('0x13')]=function(_0x4d20c6){try{if(!_[_0xaa41('0x41')](this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x42')]])){this[_0xaa41('0x19')](_0x4d20c6[_0xaa41('0x42')]);if(this['channels'][_0x4d20c6[_0xaa41('0x43')]]){this['channels'][_0x4d20c6['secondtransfereruniqueid']][_0xaa41('0x24')]=!![];this['channels'][_0x4d20c6[_0xaa41('0x44')]]=this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x43')]];delete this['channels'][_0x4d20c6[_0xaa41('0x43')]];}}else if(!_[_0xaa41('0x41')](this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x44')]])){this[_0xaa41('0x19')](_0x4d20c6[_0xaa41('0x44')]);if(this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x45')]]){this[_0xaa41('0x1a')][_0x4d20c6['origtransfereruniqueid']][_0xaa41('0x24')]=!![];this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x42')]]=this['channels'][_0x4d20c6[_0xaa41('0x45')]];delete this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x45')]];}}}catch(_0x134579){logger[_0xaa41('0x2e')](_0xaa41('0x46'),_0x134579[_0xaa41('0x32')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x5cb34d){try{if(this['channels'][_0x5cb34d['transfereruniqueid']]){logger['info'](_0xaa41('0x47'),JSON['stringify'](_0x5cb34d['transfereruniqueid']));this[_0xaa41('0x19')](_0x5cb34d[_0xaa41('0x48')]);}else if(this[_0xaa41('0x1a')][_0x5cb34d[_0xaa41('0x49')]]){logger['info'](_0xaa41('0x4a'),JSON[_0xaa41('0x38')](_0x5cb34d[_0xaa41('0x49')]));this[_0xaa41('0x19')](_0x5cb34d[_0xaa41('0x49')]);}}catch(_0x41ca40){logger[_0xaa41('0x2e')](_0xaa41('0x4b'),_0x41ca40[_0xaa41('0x32')]);}};Acw['prototype'][_0xaa41('0x12')]=function(_0x2d2af8){try{if(this['voiceQueues'][_0x2d2af8['queue']]&&this['voiceQueues'][_0x2d2af8[_0xaa41('0x1c')]]['autopause']===_0xaa41('0x4c')){if(this['agents'][_0x2d2af8[_0xaa41('0x1b')]]){logger[_0xaa41('0x23')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x2d2af8[_0xaa41('0x2c')],_0x2d2af8[_0xaa41('0x1b')],_0x2d2af8[_0xaa41('0x1c')]);return RpcUser[_0xaa41('0x4d')](this['agents'][_0x2d2af8['interface']],_0xaa41('0x4e'),_0x2d2af8[_0xaa41('0x2c')]);}}}catch(_0x4d6d0c){logger['error'](_0xaa41('0x4f'),_0x4d6d0c[_0xaa41('0x32')]);}};module[_0xaa41('0x50')]=Acw; \ No newline at end of file +var _0x55ca=['error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','stopAcw','[TIMER][STOP][AGENT:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','message','destlinkedid','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','attended','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','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:%]','Auto-Pause','util','lodash','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','syncHangup','bind','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','catch'];(function(_0x359c5e,_0x2e7689){var _0xf0e435=function(_0xd0cd88){while(--_0xd0cd88){_0x359c5e['push'](_0x359c5e['shift']());}};_0xf0e435(++_0x2e7689);}(_0x55ca,0x126));var _0xa55c=function(_0x39e4a1,_0x4edcc5){_0x39e4a1=_0x39e4a1-0x0;var _0x55b30e=_0x55ca[_0x39e4a1];return _0x55b30e;};'use strict';var util=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require('../../../config/logger')(_0xa55c('0x2'));var RpcUser=require(_0xa55c('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3b478a){this[_0xa55c('0x4')]=_0x3b478a[_0xa55c('0x4')];this[_0xa55c('0x5')]=_0x3b478a[_0xa55c('0x5')];this[_0xa55c('0x6')]=_0x3b478a[_0xa55c('0x6')];this['channels']={};ami['on'](_0xa55c('0x7'),this[_0xa55c('0x8')]['bind'](this));ami['on'](_0xa55c('0x9'),this[_0xa55c('0xa')]['bind'](this));ami['on']('hangup',this[_0xa55c('0xb')][_0xa55c('0xc')](this));ami['on'](_0xa55c('0xd'),this[_0xa55c('0xe')][_0xa55c('0xc')](this));ami['on'](_0xa55c('0xf'),this[_0xa55c('0x10')][_0xa55c('0xc')](this));ami['on'](_0xa55c('0x11'),this[_0xa55c('0x12')]['bind'](this));ami['on']('custom:agentConnectPreview',this[_0xa55c('0x13')]['bind'](this));}function getDiff(_0x5a3672){var _0x59ea8d=moment()[_0xa55c('0x14')](0x0);var _0x3930e4=moment(_0x5a3672)[_0xa55c('0x14')](0x0);return _0x59ea8d[_0xa55c('0x15')](_0x3930e4,_0xa55c('0x16'));}Acw[_0xa55c('0x17')]['startAcw']=function(_0x3ccf65){try{var _0x3dcf4f=this;var _0x25934f=this[_0xa55c('0x18')][_0x3ccf65][_0xa55c('0x19')];var _0x3ae86b=this[_0xa55c('0x18')][_0x3ccf65][_0xa55c('0x1a')];var _0x24783b=this['voiceQueues'][_0x3ae86b];var _0x3d4c9e=![];var _0x104a99=_0xa55c('0x1b');if(_0x24783b[_0xa55c('0x1c')]){if(_0x24783b[_0xa55c('0x1d')][_0xa55c('0x1e')]){_0x3d4c9e=!![];_0x104a99=_0x24783b['mandatoryDispositionPause']['name'];}}ami[_0xa55c('0x1f')]({'action':_0xa55c('0x20'),'interface':_0x25934f,'paused':!![],'reason':_0x104a99})[_0xa55c('0x21')](function(_0x4cfe10){if(_0x3dcf4f[_0xa55c('0x5')][_0x25934f]){return RpcUser[_0xa55c('0x22')](_0x3dcf4f['agents'][_0x25934f]['id'])[_0xa55c('0x21')](function(_0x133096){if(_0x133096&&!_0x133096[_0xa55c('0x23')]){logger[_0xa55c('0x24')](_0xa55c('0x25'),_0x3ccf65,_0x25934f,_0x3ae86b);var _0x49ed04=_0x3dcf4f[_0xa55c('0x18')][_0x3ccf65]['attended']&&_0x3dcf4f['channels'][_0x3ccf65]['destlinkedid']?_0x3dcf4f[_0xa55c('0x18')][_0x3ccf65]['destlinkedid']:_0x3ccf65;return RpcUser[_0xa55c('0x26')](_0x3dcf4f[_0xa55c('0x5')][_0x25934f],_0x104a99,_0x49ed04)[_0xa55c('0x21')](function(_0xf0e574){if(!_0x3d4c9e){_0x3dcf4f[_0xa55c('0x6')][_0x25934f]={};logger[_0xa55c('0x24')](_0xa55c('0x27'),_0x3ccf65,_0x3dcf4f[_0xa55c('0x4')][_0x3ae86b][_0xa55c('0x28')],_0x25934f,_0x3ae86b);_0x3dcf4f[_0xa55c('0x6')][_0x25934f][_0xa55c('0x29')]=setTimeout(_0x3dcf4f['stopAcw'][_0xa55c('0xc')](_0x3dcf4f,_0x25934f),_0x3dcf4f[_0xa55c('0x4')][_0x3ae86b][_0xa55c('0x28')]*0x3e8);_0x3dcf4f[_0xa55c('0x6')][_0x25934f]['lastPauseAt']=moment()[_0xa55c('0x2a')](_0xa55c('0x2b'));_0x3dcf4f[_0xa55c('0x6')][_0x25934f][_0xa55c('0x2c')]=_0x3ccf65;_0x3dcf4f[_0xa55c('0x6')][_0x25934f][_0xa55c('0x1a')]=_0x3ae86b;_0x3dcf4f['timers'][_0x25934f][_0xa55c('0x2d')]=function(){var _0x490b7d=getDiff(_0x3dcf4f[_0xa55c('0x6')][_0x25934f][_0xa55c('0x2e')]);clearTimeout(_0x3dcf4f[_0xa55c('0x6')][_0x25934f][_0xa55c('0x29')]);_0x3dcf4f['timers'][_0x25934f][_0xa55c('0x29')]=![];RpcVoiceAgentReport[_0xa55c('0x2f')]({'acwtime':_0x490b7d},_0x3dcf4f[_0xa55c('0x6')][_0x25934f][_0xa55c('0x2c')],_0x25934f)[_0xa55c('0x21')](function(_0x1225c3){logger[_0xa55c('0x24')](_0xa55c('0x30'),_0x3ccf65,_0x490b7d,_0x1225c3);})[_0xa55c('0x31')](function(_0xcbaf2e){logger[_0xa55c('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x3ccf65,_0xcbaf2e);});delete _0x3dcf4f['timers'][_0x25934f];};}});}else{logger[_0xa55c('0x24')](_0xa55c('0x33'),_0x3ccf65,_0x25934f,_0x3ae86b);}});}})['catch'](function(_0x30fadd){logger[_0xa55c('0x32')](_0xa55c('0x27'),_0x3ccf65,_0x3dcf4f[_0xa55c('0x4')][_0x3ae86b][_0xa55c('0x28')],_0x25934f,_0x3ae86b);})[_0xa55c('0x34')](function(){delete _0x3dcf4f[_0xa55c('0x18')][_0x3ccf65];});}catch(_0x222d4b){logger[_0xa55c('0x32')]('[ACW][START]\x20%s',_0x222d4b['message']);}};Acw['prototype'][_0xa55c('0x35')]=function(_0x18e00e){try{var _0x2bb4f0=this;if(_0x2bb4f0['timers'][_0x18e00e]){_0x2bb4f0[_0xa55c('0x6')][_0x18e00e]['timer']=![];var _0x119220=_0x2bb4f0['timers'][_0x18e00e][_0xa55c('0x2c')];var _0x39267c=_0x2bb4f0[_0xa55c('0x6')][_0x18e00e]['queue'];var _0x7c4a47=_0x2bb4f0[_0xa55c('0x4')][_0x39267c]['acwTimeout'];logger[_0xa55c('0x24')](_0xa55c('0x36'),_0x18e00e);RpcUser['saveUnpause'](this['agents'][_0x18e00e]);RpcVoiceAgentReport[_0xa55c('0x2f')]({'acwtime':_0x7c4a47,'agentacw':!![]},_0x119220,_0x18e00e)['then'](function(_0x1e75dc){logger[_0xa55c('0x24')]('[%s][UPDATE][ACWTIME:%s]',_0x119220,_0x7c4a47,_0x1e75dc);})['catch'](function(_0x5e50b6){logger['error'](_0xa55c('0x37'),_0x119220,_0x5e50b6);});}else{logger[_0xa55c('0x32')](_0xa55c('0x38'),_0x18e00e);if(_0x2bb4f0[_0xa55c('0x6')]){logger[_0xa55c('0x24')]('[ACW][TIMERS]',JSON[_0xa55c('0x39')](_0x2bb4f0[_0xa55c('0x6')]));}}}catch(_0x77d623){logger[_0xa55c('0x32')](_0xa55c('0x3a'),_0x77d623[_0xa55c('0x3b')]);}};Acw['prototype'][_0xa55c('0x8')]=function(_0x5ee63d){try{if(this['voiceQueues'][_0x5ee63d[_0xa55c('0x1a')]]&&(this[_0xa55c('0x4')][_0x5ee63d['queue']][_0xa55c('0x2')]||this['voiceQueues'][_0x5ee63d['queue']][_0xa55c('0x1c')])){if(this[_0xa55c('0x5')][_0x5ee63d[_0xa55c('0x19')]]){this['channels'][_0x5ee63d[_0xa55c('0x2c')]]={'queue':_0x5ee63d[_0xa55c('0x1a')],'interface':_0x5ee63d['interface'],'destlinkedid':_0x5ee63d[_0xa55c('0x3c')]};}}}catch(_0x514661){logger[_0xa55c('0x32')](_0xa55c('0x3d'),_0x514661['message']);}};Acw[_0xa55c('0x17')][_0xa55c('0x13')]=function(_0x5d834d){try{if(this[_0xa55c('0x4')][_0x5d834d[_0xa55c('0x1a')]]&&(this[_0xa55c('0x4')][_0x5d834d['queue']][_0xa55c('0x2')]||this['voiceQueues'][_0x5d834d[_0xa55c('0x1a')]][_0xa55c('0x1c')])){if(this[_0xa55c('0x5')][_0x5d834d['interface']]){this[_0xa55c('0x18')][_0x5d834d[_0xa55c('0x2c')]]={'queue':_0x5d834d['queue'],'interface':_0x5d834d[_0xa55c('0x19')]};}}}catch(_0x931907){logger['error'](_0xa55c('0x3e'),_0x931907[_0xa55c('0x3b')]);}};Acw['prototype'][_0xa55c('0xa')]=function(_0x81cee8){try{if(this[_0xa55c('0x18')][_0x81cee8[_0xa55c('0x2c')]]&&_['isUndefined'](this[_0xa55c('0x18')][_0x81cee8['uniqueid']][_0xa55c('0x3f')])){logger[_0xa55c('0x24')](_0xa55c('0x40'),_0x81cee8['uniqueid']);this[_0xa55c('0x41')](_0x81cee8[_0xa55c('0x2c')]);}else if(this['channels'][_0x81cee8[_0xa55c('0x42')]]&&_[_0xa55c('0x43')](this[_0xa55c('0x18')][_0x81cee8[_0xa55c('0x42')]][_0xa55c('0x3f')])){logger[_0xa55c('0x24')](_0xa55c('0x44'),_0x81cee8[_0xa55c('0x42')]);this[_0xa55c('0x41')](_0x81cee8[_0xa55c('0x42')]);}}catch(_0x4fc0a9){logger[_0xa55c('0x32')](_0xa55c('0x45'),_0x4fc0a9[_0xa55c('0x3b')]);}};Acw['prototype'][_0xa55c('0xb')]=function(_0x35bf0a){try{if(this['channels'][_0x35bf0a[_0xa55c('0x2c')]]&&this['channels'][_0x35bf0a[_0xa55c('0x2c')]][_0xa55c('0x3f')]){logger[_0xa55c('0x24')](_0xa55c('0x46'),_0x35bf0a[_0xa55c('0x2c')]);this['startAcw'](_0x35bf0a[_0xa55c('0x2c')]);}else if(this[_0xa55c('0x18')][_0x35bf0a['linkedid']]&&this[_0xa55c('0x18')][_0x35bf0a[_0xa55c('0x42')]][_0xa55c('0x3f')]){logger[_0xa55c('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x35bf0a['linkedid']);this[_0xa55c('0x41')](_0x35bf0a[_0xa55c('0x42')]);}}catch(_0x3ca5b8){logger[_0xa55c('0x32')]('[ACW][syncHangup]\x20%s',_0x3ca5b8[_0xa55c('0x3b')]);}};Acw['prototype'][_0xa55c('0x10')]=function(_0x437ced){try{if(!_[_0xa55c('0x47')](this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x48')]])){this['startAcw'](_0x437ced[_0xa55c('0x48')]);if(this['channels'][_0x437ced[_0xa55c('0x49')]]){this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x49')]][_0xa55c('0x3f')]=!![];this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x4a')]]=this[_0xa55c('0x18')][_0x437ced['secondtransfereruniqueid']];delete this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x49')]];}}else if(!_[_0xa55c('0x47')](this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x4a')]])){this['startAcw'](_0x437ced[_0xa55c('0x4a')]);if(this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x4b')]]){this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x4b')]]['attended']=!![];this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x48')]]=this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x4b')]];delete this[_0xa55c('0x18')][_0x437ced['origtransfereruniqueid']];}}}catch(_0x419fc3){logger['error'](_0xa55c('0x4c'),_0x419fc3['message']);}};Acw[_0xa55c('0x17')]['syncBlindTransfer']=function(_0x34edc5){try{if(this[_0xa55c('0x18')][_0x34edc5[_0xa55c('0x4d')]]){logger[_0xa55c('0x24')](_0xa55c('0x4e'),JSON[_0xa55c('0x39')](_0x34edc5[_0xa55c('0x4d')]));this[_0xa55c('0x41')](_0x34edc5[_0xa55c('0x4d')]);}else if(this[_0xa55c('0x18')][_0x34edc5['transfererlinkedid']]){logger[_0xa55c('0x24')](_0xa55c('0x4f'),JSON['stringify'](_0x34edc5[_0xa55c('0x50')]));this[_0xa55c('0x41')](_0x34edc5[_0xa55c('0x50')]);}}catch(_0x9fe234){logger[_0xa55c('0x32')](_0xa55c('0x51'),_0x9fe234[_0xa55c('0x3b')]);}};Acw[_0xa55c('0x17')]['syncAgentRingNoAnswer']=function(_0x1dfaf7){try{if(this[_0xa55c('0x4')][_0x1dfaf7[_0xa55c('0x1a')]]&&this[_0xa55c('0x4')][_0x1dfaf7[_0xa55c('0x1a')]][_0xa55c('0x52')]===_0xa55c('0x53')){if(this[_0xa55c('0x5')][_0x1dfaf7[_0xa55c('0x19')]]){logger['info'](_0xa55c('0x54'),_0x1dfaf7[_0xa55c('0x2c')],_0x1dfaf7[_0xa55c('0x19')],_0x1dfaf7[_0xa55c('0x1a')]);return RpcUser[_0xa55c('0x26')](this[_0xa55c('0x5')][_0x1dfaf7[_0xa55c('0x19')]],_0xa55c('0x55'),_0x1dfaf7[_0xa55c('0x2c')]);}}}catch(_0x3178a6){logger[_0xa55c('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x3178a6[_0xa55c('0x3b')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index c0c63f8..0e85ef7 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 _0xc21f=['asterisk','port','password','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','fullybooted','resolve','then','actionSipShowRegistry','actionCoreShowChannels','catch','log','close','exports','asterisk-manager','util','lodash','../../config/logger','ami'];(function(_0x4e8ac0,_0x45d5d9){var _0x1ce292=function(_0xc1741f){while(--_0xc1741f){_0x4e8ac0['push'](_0x4e8ac0['shift']());}};_0x1ce292(++_0x45d5d9);}(_0xc21f,0x1dc));var _0xfc21=function(_0x40c1e3,_0xbcea04){_0x40c1e3=_0x40c1e3-0x0;var _0x17cd43=_0xc21f[_0x40c1e3];return _0x17cd43;};'use strict';var Manager=require(_0xfc21('0x0'));var BPromise=require('bluebird');var moment=require('moment');var util=require(_0xfc21('0x1'));var _=require(_0xfc21('0x2'));var logger=require(_0xfc21('0x3'))(_0xfc21('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0xfc21('0x5')][_0xfc21('0x6')],config[_0xfc21('0x5')]['ip'],config['asterisk']['username'],config[_0xfc21('0x5')][_0xfc21('0x7')],!![]);ami['keepConnected']();ami['Action']=BPromise['promisify'](ami[_0xfc21('0x8')]);function error(_0x14b5b4){logger[_0xfc21('0x9')](util[_0xfc21('0xa')](_0xfc21('0xb'),config[_0xfc21('0x5')][_0xfc21('0xc')],config['asterisk']['ip'],config[_0xfc21('0x5')][_0xfc21('0x6')],util[_0xfc21('0xd')](_0x14b5b4,![],null)));}function close(){logger[_0xfc21('0x9')](util['format'](_0xfc21('0xe'),config[_0xfc21('0x5')][_0xfc21('0xc')],config[_0xfc21('0x5')]['ip'],config[_0xfc21('0x5')][_0xfc21('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xfc21('0xf')]({'action':_0xfc21('0x10')});};};ami[_0xfc21('0x11')]=function(){return function(){return ami[_0xfc21('0xf')]({'action':_0xfc21('0x12')});};};ami[_0xfc21('0x13')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0xfc21('0x14')]=function(){return function(){return ami['Action']({'action':_0xfc21('0x15')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xfc21('0xf')]({'action':_0xfc21('0x16')});};};function connect(_0xb8d540){logger[_0xfc21('0x17')](util[_0xfc21('0xa')](_0xfc21('0x18'),config[_0xfc21('0x5')][_0xfc21('0xc')],config[_0xfc21('0x5')]['ip'],config[_0xfc21('0x5')]['port']));ami[_0xfc21('0x19')]('error',error);ami[_0xfc21('0x19')]('close',close);}ami['on'](_0xfc21('0x1a'),connect);ami['on'](_0xfc21('0x1b'),function(_0x2730d9){logger[_0xfc21('0x17')](util[_0xfc21('0xa')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xfc21('0xc')],config['asterisk']['ip'],config['asterisk'][_0xfc21('0x6')],util[_0xfc21('0xd')](_0x2730d9,![],null)));});ami['on'](_0xfc21('0x1c'),function(_0x39112e){logger[_0xfc21('0x17')](util[_0xfc21('0xa')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config[_0xfc21('0x5')]['ip'],config[_0xfc21('0x5')][_0xfc21('0x6')]));return BPromise[_0xfc21('0x1d')]()[_0xfc21('0x1e')](ami[_0xfc21('0x1f')]())['then'](ami[_0xfc21('0x11')]())[_0xfc21('0x1e')](ami[_0xfc21('0x13')]())[_0xfc21('0x1e')](ami[_0xfc21('0x14')]())[_0xfc21('0x1e')](ami[_0xfc21('0x20')]())[_0xfc21('0x21')](function(_0x3150c3){console[_0xfc21('0x22')](_0x3150c3);});});ami[_0xfc21('0x19')]('error',error);ami['once'](_0xfc21('0x23'),close);module[_0xfc21('0x24')]=ami; \ No newline at end of file +var _0x91dd=['../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log','close','exports','asterisk-manager','bluebird','util','lodash'];(function(_0x2502e8,_0x4f7dc3){var _0x106d73=function(_0x364060){while(--_0x364060){_0x2502e8['push'](_0x2502e8['shift']());}};_0x106d73(++_0x4f7dc3);}(_0x91dd,0xf8));var _0xd91d=function(_0x5e0a83,_0x8f4ff8){_0x5e0a83=_0x5e0a83-0x0;var _0x4b0c77=_0x91dd[_0x5e0a83];return _0x4b0c77;};'use strict';var Manager=require(_0xd91d('0x0'));var BPromise=require(_0xd91d('0x1'));var moment=require('moment');var util=require(_0xd91d('0x2'));var _=require(_0xd91d('0x3'));var logger=require(_0xd91d('0x4'))(_0xd91d('0x5'));var config=require(_0xd91d('0x6'));var ami=new Manager(config[_0xd91d('0x7')][_0xd91d('0x8')],config[_0xd91d('0x7')]['ip'],config['asterisk'][_0xd91d('0x9')],config['asterisk'][_0xd91d('0xa')],!![]);ami[_0xd91d('0xb')]();ami[_0xd91d('0xc')]=BPromise['promisify'](ami['action']);function error(_0x43dd11){logger[_0xd91d('0xd')](util[_0xd91d('0xe')](_0xd91d('0xf'),config[_0xd91d('0x7')][_0xd91d('0x9')],config['asterisk']['ip'],config[_0xd91d('0x7')][_0xd91d('0x8')],util['inspect'](_0x43dd11,![],null)));}function close(){logger[_0xd91d('0xd')](util[_0xd91d('0xe')](_0xd91d('0x10'),config['asterisk'][_0xd91d('0x9')],config[_0xd91d('0x7')]['ip'],config[_0xd91d('0x7')]['port']));}ami[_0xd91d('0x11')]=function(){return function(){return ami['Action']({'action':_0xd91d('0x12')});};};ami[_0xd91d('0x13')]=function(){return function(){return ami[_0xd91d('0xc')]({'action':'devicestatelist'});};};ami[_0xd91d('0x14')]=function(){return function(){return ami[_0xd91d('0xc')]({'action':_0xd91d('0x15')});};};ami[_0xd91d('0x16')]=function(){return function(){return ami[_0xd91d('0xc')]({'action':_0xd91d('0x17')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xd91d('0xc')]({'action':_0xd91d('0x18')});};};function connect(_0x2a9096){logger[_0xd91d('0x19')](util['format'](_0xd91d('0x1a'),config[_0xd91d('0x7')]['username'],config[_0xd91d('0x7')]['ip'],config['asterisk'][_0xd91d('0x8')]));ami[_0xd91d('0x1b')]('error',error);ami[_0xd91d('0x1b')]('close',close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x5c90db){logger[_0xd91d('0x19')](util[_0xd91d('0xe')](_0xd91d('0x1c'),config[_0xd91d('0x7')]['username'],config[_0xd91d('0x7')]['ip'],config[_0xd91d('0x7')][_0xd91d('0x8')],util[_0xd91d('0x1d')](_0x5c90db,![],null)));});ami['on']('fullybooted',function(_0x8eb8d5){logger['info'](util['format'](_0xd91d('0x1e'),config[_0xd91d('0x7')][_0xd91d('0x9')],config[_0xd91d('0x7')]['ip'],config[_0xd91d('0x7')][_0xd91d('0x8')]));return BPromise[_0xd91d('0x1f')]()[_0xd91d('0x20')](ami[_0xd91d('0x11')]())[_0xd91d('0x20')](ami[_0xd91d('0x13')]())[_0xd91d('0x20')](ami[_0xd91d('0x14')]())['then'](ami[_0xd91d('0x16')]())[_0xd91d('0x20')](ami['actionCoreShowChannels']())['catch'](function(_0x2473e8){console[_0xd91d('0x21')](_0x2473e8);});});ami[_0xd91d('0x1b')](_0xd91d('0xd'),error);ami[_0xd91d('0x1b')](_0xd91d('0x22'),close);module[_0xd91d('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index e761e6e..9ebdb31 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 _0x3f44=['bluebird','../../config/logger','ami','client','http','request','memberReport','error','rpc','message','catch'];(function(_0x502598,_0x1e95c8){var _0xbdee21=function(_0x140feb){while(--_0x140feb){_0x502598['push'](_0x502598['shift']());}};_0xbdee21(++_0x1e95c8);}(_0x3f44,0xe7));var _0x43f4=function(_0x571cb8,_0x495cad){_0x571cb8=_0x571cb8-0x0;var _0x59fd5c=_0x3f44[_0x571cb8];return _0x59fd5c;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x43f4('0x0'));var logger=require(_0x43f4('0x1'))(_0x43f4('0x2'));var client=jayson[_0x43f4('0x3')][_0x43f4('0x4')]({'port':0x2329});client['Request']=function(_0x4c082b,_0x19ffc5){return new BPromise(function(_0x549eb3,_0x5a561a){return client[_0x43f4('0x5')](_0x4c082b,_0x19ffc5)['then'](function(_0x544c65){logger['debug']('rpc',_0x43f4('0x6'),_0x4c082b,_0x19ffc5,_0x544c65);if(_0x544c65[_0x43f4('0x7')]){logger[_0x43f4('0x7')](_0x43f4('0x8'),_0x43f4('0x6'),_0x4c082b,_0x544c65[_0x43f4('0x7')][_0x43f4('0x9')],_0x19ffc5);return _0x5a561a(_0x544c65['error'][_0x43f4('0x9')]);}else{return _0x549eb3(_0x544c65['result']);}})[_0x43f4('0xa')](function(_0x724fa2){logger[_0x43f4('0x7')](_0x43f4('0x8'),'memberReport',_0x4c082b,_0x724fa2,_0x19ffc5);return _0x5a561a(_0x724fa2);});});};module['exports']=client; \ No newline at end of file +var _0xb87f=['client','Request','request','rpc','memberReport','error','message','catch','exports','jayson/promise','bluebird','../../config/logger','ami'];(function(_0x4c7cc9,_0x816b07){var _0x19560b=function(_0x26673e){while(--_0x26673e){_0x4c7cc9['push'](_0x4c7cc9['shift']());}};_0x19560b(++_0x816b07);}(_0xb87f,0x19c));var _0xfb87=function(_0x41e71c,_0x55715c){_0x41e71c=_0x41e71c-0x0;var _0x47e34f=_0xb87f[_0x41e71c];return _0x47e34f;};'use strict';var jayson=require(_0xfb87('0x0'));var BPromise=require(_0xfb87('0x1'));var logger=require(_0xfb87('0x2'))(_0xfb87('0x3'));var client=jayson[_0xfb87('0x4')]['http']({'port':0x2329});client[_0xfb87('0x5')]=function(_0x245859,_0xff8143){return new BPromise(function(_0x32d72e,_0x13bdad){return client[_0xfb87('0x6')](_0x245859,_0xff8143)['then'](function(_0x3e32b2){logger['debug'](_0xfb87('0x7'),_0xfb87('0x8'),_0x245859,_0xff8143,_0x3e32b2);if(_0x3e32b2['error']){logger[_0xfb87('0x9')](_0xfb87('0x7'),'memberReport',_0x245859,_0x3e32b2[_0xfb87('0x9')][_0xfb87('0xa')],_0xff8143);return _0x13bdad(_0x3e32b2[_0xfb87('0x9')][_0xfb87('0xa')]);}else{return _0x32d72e(_0x3e32b2['result']);}})[_0xfb87('0xb')](function(_0x4071d5){logger[_0xfb87('0x9')](_0xfb87('0x7'),_0xfb87('0x8'),_0x245859,_0x4071d5,_0xff8143);return _0x13bdad(_0x4071d5);});});};module[_0xfb87('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 97c850c..a09dff8 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 _0xaf4c=['string','isNil','voiceQueue','uniqueid','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','prototype','getQueue','exports','lodash','moment'];(function(_0x40444c,_0x114482){var _0x53d773=function(_0xa7432a){while(--_0xa7432a){_0x40444c['push'](_0x40444c['shift']());}};_0x53d773(++_0x114482);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x388810,_0x3ea1bb){_0x388810=_0x388810-0x0;var _0x331d29=_0xaf4c[_0x388810];return _0x331d29;};'use strict';var util=require('util');var _=require(_0xcaf4('0x0'));var moment=require(_0xcaf4('0x1'));function checkNameSurname(_0x4cd268,_0x10c20a,_0x453ce8){var _0x19adc9='';if(!_['isNil'](_0x10c20a)&&_0xcaf4('0x2')===typeof _0x10c20a){_0x19adc9+=_0x10c20a;}if(!_[_0xcaf4('0x3')](_0x453ce8)&&_0xcaf4('0x2')===typeof _0x453ce8){_0x19adc9+='\x20'+_0x453ce8;}if(_0x19adc9!==''){return _0x19adc9;}return _0x4cd268;}function Action(_0x4fddcf,_0x21ad95,_0x548527){this[_0xcaf4('0x4')]=_0x4fddcf;this[_0xcaf4('0x5')]=_0x548527||undefined;this[_0xcaf4('0x6')]=checkNameSurname(_0x21ad95[_0xcaf4('0x7')][_0xcaf4('0x8')],_0x21ad95[_0xcaf4('0x7')]['firstName'],_0x21ad95['Contact'][_0xcaf4('0x9')]);this[_0xcaf4('0xa')]=_0x21ad95[_0xcaf4('0x7')][_0xcaf4('0x8')];this[_0xcaf4('0xb')]=_0x4fddcf[_0xcaf4('0x6')];this[_0xcaf4('0xc')]=_0x21ad95[_0xcaf4('0xc')]||![];this[_0xcaf4('0xd')]=_0x4fddcf['type'];this[_0xcaf4('0xe')]=_0x4fddcf[_0xcaf4('0xe')]||0x3;this['scheduledat']=_0x21ad95[_0xcaf4('0xf')];this[_0xcaf4('0x10')]=_0x21ad95[_0xcaf4('0x10')];this['countcongestionretry']=_0x21ad95[_0xcaf4('0x11')];this[_0xcaf4('0x12')]=_0x21ad95['countnoanswerretry'];this[_0xcaf4('0x13')]=_0x21ad95['countnosuchnumberretry'];this[_0xcaf4('0x14')]=_0x21ad95[_0xcaf4('0x14')];this[_0xcaf4('0x15')]=_0x21ad95[_0xcaf4('0x15')];this[_0xcaf4('0x16')]=_0x21ad95[_0xcaf4('0x16')];this['countagentrejectretry']=_0x21ad95[_0xcaf4('0x17')];this['ContactId']=_0x21ad95[_0xcaf4('0x18')];this['ListId']=_0x21ad95[_0xcaf4('0x19')];this[_0xcaf4('0x1a')]=_0x21ad95[_0xcaf4('0x1a')];this['VoiceQueueId']=_0x21ad95['VoiceQueueId'];this[_0xcaf4('0x1b')]=_0x21ad95[_0xcaf4('0x1b')];this[_0xcaf4('0x1c')]=_0x21ad95['id'];this[_0xcaf4('0x1d')]=_0x21ad95[_0xcaf4('0x7')]['firstName']||'';this[_0xcaf4('0x1e')]=moment()[_0xcaf4('0x1f')](_0xcaf4('0x20'));this['callback']=_0x21ad95[_0xcaf4('0x21')];this[_0xcaf4('0x22')]=_0x21ad95[_0xcaf4('0x22')];this['callbackat']=_0x21ad95[_0xcaf4('0x23')];this['recallme']=_0x21ad95[_0xcaf4('0x24')];this[_0xcaf4('0x25')]='';this[_0xcaf4('0x26')]='';}Action['prototype'][_0xcaf4('0x27')]=function(){return util[_0xcaf4('0x1f')](_0xcaf4('0x28'),this[_0xcaf4('0x6')],this['voiceQueue'][_0xcaf4('0x29')]>0x0?this[_0xcaf4('0xa')]['substring'](this[_0xcaf4('0x4')][_0xcaf4('0x29')]):this[_0xcaf4('0xa')]);};Action[_0xcaf4('0x2a')][_0xcaf4('0x2b')]=function(){return this[_0xcaf4('0xb')];};module[_0xcaf4('0x2c')]=Action; \ No newline at end of file +var _0xb50d=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','substring','dialCutDigit','getQueue','exports','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb50d,0xf5));var _0xdb50=function(_0x3fc774,_0x3de456){_0x3fc774=_0x3fc774-0x0;var _0x3252ad=_0xb50d[_0x3fc774];return _0x3252ad;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xdb50('0x0'));function checkNameSurname(_0xa37b5a,_0x5042f7,_0x404c57){var _0x12d72e='';if(!_[_0xdb50('0x1')](_0x5042f7)&&_0xdb50('0x2')===typeof _0x5042f7){_0x12d72e+=_0x5042f7;}if(!_[_0xdb50('0x1')](_0x404c57)&&'string'===typeof _0x404c57){_0x12d72e+='\x20'+_0x404c57;}if(_0x12d72e!==''){return _0x12d72e;}return _0xa37b5a;}function Action(_0x48ed37,_0x44bfbc,_0xe3c447){this[_0xdb50('0x3')]=_0x48ed37;this[_0xdb50('0x4')]=_0xe3c447||undefined;this[_0xdb50('0x5')]=checkNameSurname(_0x44bfbc[_0xdb50('0x6')]['phone'],_0x44bfbc[_0xdb50('0x6')][_0xdb50('0x7')],_0x44bfbc[_0xdb50('0x6')][_0xdb50('0x8')]);this['number']=_0x44bfbc[_0xdb50('0x6')][_0xdb50('0x9')];this[_0xdb50('0xa')]=_0x48ed37[_0xdb50('0x5')];this[_0xdb50('0xb')]=_0x44bfbc[_0xdb50('0xb')]||![];this[_0xdb50('0xc')]=_0x48ed37['type'];this[_0xdb50('0xd')]=_0x48ed37[_0xdb50('0xd')]||0x3;this[_0xdb50('0xe')]=_0x44bfbc[_0xdb50('0xe')];this[_0xdb50('0xf')]=_0x44bfbc['countbusyretry'];this[_0xdb50('0x10')]=_0x44bfbc[_0xdb50('0x10')];this[_0xdb50('0x11')]=_0x44bfbc[_0xdb50('0x11')];this['countnosuchnumberretry']=_0x44bfbc[_0xdb50('0x12')];this[_0xdb50('0x13')]=_0x44bfbc[_0xdb50('0x13')];this[_0xdb50('0x14')]=_0x44bfbc[_0xdb50('0x14')];this[_0xdb50('0x15')]=_0x44bfbc['countmachineretry'];this[_0xdb50('0x16')]=_0x44bfbc[_0xdb50('0x16')];this['ContactId']=_0x44bfbc['ContactId'];this[_0xdb50('0x17')]=_0x44bfbc[_0xdb50('0x17')];this[_0xdb50('0x18')]=_0x44bfbc[_0xdb50('0x18')];this['VoiceQueueId']=_0x44bfbc['VoiceQueueId'];this[_0xdb50('0x19')]=_0x44bfbc['CampaignId'];this[_0xdb50('0x1a')]=_0x44bfbc['id'];this[_0xdb50('0x1b')]=_0x44bfbc['Contact'][_0xdb50('0x7')]||'';this[_0xdb50('0x1c')]=moment()[_0xdb50('0x1d')](_0xdb50('0x1e'));this[_0xdb50('0x1f')]=_0x44bfbc['callback'];this[_0xdb50('0x20')]=_0x44bfbc[_0xdb50('0x20')];this[_0xdb50('0x21')]=_0x44bfbc[_0xdb50('0x21')];this[_0xdb50('0x22')]=_0x44bfbc[_0xdb50('0x22')];this[_0xdb50('0x23')]='';this['originatecalleridname']='';}Action[_0xdb50('0x24')][_0xdb50('0x25')]=function(){return util[_0xdb50('0x1d')](_0xdb50('0x26'),this[_0xdb50('0x5')],this['voiceQueue']['dialCutDigit']>0x0?this[_0xdb50('0x27')][_0xdb50('0x28')](this[_0xdb50('0x3')][_0xdb50('0x29')]):this[_0xdb50('0x27')]);};Action['prototype'][_0xdb50('0x2a')]=function(){return this[_0xdb50('0xa')];};module[_0xdb50('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 1ec1e57..62e66b0 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 _0xf5c2=['countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','queue'];(function(_0x488814,_0x3fec59){var _0x58138b=function(_0x575c59){while(--_0x575c59){_0x488814['push'](_0x488814['shift']());}};_0x58138b(++_0x3fec59);}(_0xf5c2,0x1ee));var _0x2f5c=function(_0x196dc5,_0x50be9d){_0x196dc5=_0x196dc5-0x0;var _0x56458e=_0xf5c2[_0x196dc5];return _0x56458e;};'use strict';var util=require(_0x2f5c('0x0'));var _=require(_0x2f5c('0x1'));var moment=require(_0x2f5c('0x2'));function getSeconds(_0x4ddb31,_0x53f58f){var _0x5b89eb=moment(_0x4ddb31)['milliseconds'](0x0);var _0x46178f=moment(_0x53f58f)[_0x2f5c('0x3')](0x0);return _0x5b89eb[_0x2f5c('0x4')](_0x46178f,_0x2f5c('0x5'));}function AdditionalPhone(_0x261b6f){this['uniqueid']=_0x261b6f[_0x2f5c('0x6')];this[_0x2f5c('0x7')]=_0x261b6f[_0x2f5c('0x7')]||undefined;this['type']=_0x261b6f[_0x2f5c('0x8')];this['campaigntype']=_0x261b6f[_0x2f5c('0x8')]==='outbound'?_0x2f5c('0x9'):_0x261b6f['type'];this[_0x2f5c('0xa')]=_0x261b6f['countbusyretry'];this['countcongestionretry']=_0x261b6f[_0x2f5c('0xb')];this[_0x2f5c('0xc')]=_0x261b6f[_0x2f5c('0xc')];this['countglobal']=_0x261b6f['countbusyretry']+_0x261b6f[_0x2f5c('0xb')]+_0x261b6f[_0x2f5c('0xc')]+_0x261b6f['countnosuchnumberretry']+_0x261b6f[_0x2f5c('0xd')]+_0x261b6f[_0x2f5c('0xe')]+_0x261b6f[_0x2f5c('0xf')]+_0x261b6f['countagentrejectretry'];this[_0x2f5c('0x10')]=_0x261b6f[_0x2f5c('0x10')];this[_0x2f5c('0xd')]=_0x261b6f['countdropretry'];this[_0x2f5c('0xe')]=_0x261b6f['countabandonedretry'];this[_0x2f5c('0xf')]=_0x261b6f['countmachineretry'];this[_0x2f5c('0x11')]=_0x261b6f[_0x2f5c('0x11')];this[_0x2f5c('0x9')]=_0x261b6f[_0x2f5c('0x9')];this[_0x2f5c('0x12')]=_0x261b6f[_0x2f5c('0x13')];this[_0x2f5c('0x14')]=_0x261b6f['number'];this[_0x2f5c('0x15')]=_0x261b6f[_0x2f5c('0x15')];this['responsetime']=_0x261b6f[_0x2f5c('0x16')];this[_0x2f5c('0x17')]=_0x261b6f[_0x2f5c('0x16')];this[_0x2f5c('0x18')]=getSeconds(_0x261b6f['responsetime'],_0x261b6f[_0x2f5c('0x15')]);this[_0x2f5c('0x19')]=0x0;this[_0x2f5c('0x1a')]=0x0;this[_0x2f5c('0x1b')]=_0x261b6f['callback'];this['callbackuniqueid']=_0x261b6f['callbackuniqueid'];this[_0x2f5c('0x1c')]=_0x261b6f[_0x2f5c('0x1c')];this['recallme']=_0x261b6f[_0x2f5c('0x1d')];this[_0x2f5c('0x1e')]=_0x261b6f['ContactId'];this[_0x2f5c('0x1f')]=_0x261b6f[_0x2f5c('0x1f')];this[_0x2f5c('0x20')]=_0x261b6f[_0x2f5c('0x20')];this['VoiceQueueId']=_0x261b6f['VoiceQueueId'];this[_0x2f5c('0x21')]=_0x261b6f[_0x2f5c('0x21')];this[_0x2f5c('0x22')]=_0x261b6f[_0x2f5c('0x22')]||'';this['originatecalleridname']=_0x261b6f['originatecalleridname']||'';}module[_0x2f5c('0x23')]=History; \ No newline at end of file +var _0xdda1=['countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridname','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xdda1,0x10d));var _0x1dda=function(_0x5de7e6,_0x14af8e){_0x5de7e6=_0x5de7e6-0x0;var _0x503df2=_0xdda1[_0x5de7e6];return _0x503df2;};'use strict';var util=require(_0x1dda('0x0'));var _=require(_0x1dda('0x1'));var moment=require('moment');function getSeconds(_0x1349fe,_0x149ca6){var _0x2b63d6=moment(_0x1349fe)[_0x1dda('0x2')](0x0);var _0x5d8824=moment(_0x149ca6)[_0x1dda('0x2')](0x0);return _0x2b63d6['diff'](_0x5d8824,_0x1dda('0x3'));}function AdditionalPhone(_0x41e0cd){this[_0x1dda('0x4')]=_0x41e0cd[_0x1dda('0x4')];this[_0x1dda('0x5')]=_0x41e0cd[_0x1dda('0x5')]||undefined;this[_0x1dda('0x6')]=_0x41e0cd[_0x1dda('0x6')];this[_0x1dda('0x7')]=_0x41e0cd[_0x1dda('0x6')]===_0x1dda('0x8')?'queue':_0x41e0cd[_0x1dda('0x6')];this[_0x1dda('0x9')]=_0x41e0cd[_0x1dda('0x9')];this[_0x1dda('0xa')]=_0x41e0cd[_0x1dda('0xa')];this[_0x1dda('0xb')]=_0x41e0cd['countnoanswerretry'];this[_0x1dda('0xc')]=_0x41e0cd['countbusyretry']+_0x41e0cd[_0x1dda('0xa')]+_0x41e0cd['countnoanswerretry']+_0x41e0cd['countnosuchnumberretry']+_0x41e0cd[_0x1dda('0xd')]+_0x41e0cd[_0x1dda('0xe')]+_0x41e0cd[_0x1dda('0xf')]+_0x41e0cd[_0x1dda('0x10')];this['countnosuchnumberretry']=_0x41e0cd[_0x1dda('0x11')];this[_0x1dda('0xd')]=_0x41e0cd[_0x1dda('0xd')];this[_0x1dda('0xe')]=_0x41e0cd['countabandonedretry'];this[_0x1dda('0xf')]=_0x41e0cd[_0x1dda('0xf')];this[_0x1dda('0x10')]=_0x41e0cd[_0x1dda('0x10')];this['queue']=_0x41e0cd[_0x1dda('0x12')];this[_0x1dda('0x13')]=_0x41e0cd['name'];this['calleridnum']=_0x41e0cd['number'];this['starttime']=_0x41e0cd[_0x1dda('0x14')];this[_0x1dda('0x15')]=_0x41e0cd['responsetime'];this[_0x1dda('0x16')]=_0x41e0cd[_0x1dda('0x15')];this['ringtime']=getSeconds(_0x41e0cd[_0x1dda('0x15')],_0x41e0cd['starttime']);this[_0x1dda('0x17')]=0x0;this[_0x1dda('0x18')]=0x0;this[_0x1dda('0x19')]=_0x41e0cd[_0x1dda('0x19')];this[_0x1dda('0x1a')]=_0x41e0cd[_0x1dda('0x1a')];this[_0x1dda('0x1b')]=_0x41e0cd['callbackat'];this[_0x1dda('0x1c')]=_0x41e0cd[_0x1dda('0x1c')];this['ContactId']=_0x41e0cd['ContactId'];this['ListId']=_0x41e0cd[_0x1dda('0x1d')];this['UserId']=_0x41e0cd[_0x1dda('0x1e')];this['VoiceQueueId']=_0x41e0cd[_0x1dda('0x1f')];this[_0x1dda('0x20')]=_0x41e0cd[_0x1dda('0x20')];this['originatecalleridnum']=_0x41e0cd[_0x1dda('0x21')]||'';this[_0x1dda('0x22')]=_0x41e0cd[_0x1dda('0x22')]||'';}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 4784e27..3a99723 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 _0x3c21=['exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x385331,_0x17c181){var _0x8a2653=function(_0x255dd2){while(--_0x255dd2){_0x385331['push'](_0x385331['shift']());}};_0x8a2653(++_0x17c181);}(_0x3c21,0x1f0));var _0x13c2=function(_0x3a0355,_0x52ef8e){_0x3a0355=_0x3a0355-0x0;var _0x1d924d=_0x3c21[_0x3a0355];return _0x1d924d;};'use strict';var util=require(_0x13c2('0x0'));var _=require(_0x13c2('0x1'));var moment=require(_0x13c2('0x2'));function getSeconds(_0x25f609,_0x5e4386){var _0xd4dca9=moment(_0x25f609)['milliseconds'](0x0);var _0x3b465f=moment(_0x5e4386)[_0x13c2('0x3')](0x0);return _0xd4dca9[_0x13c2('0x4')](_0x3b465f,'seconds');}function AgentComplete(_0x3b87ab,_0x38365d){this[_0x13c2('0x5')]=0x4;this[_0x13c2('0x6')]=_0x13c2('0x7');this[_0x13c2('0x8')]=_0x3b87ab[_0x13c2('0x8')];this[_0x13c2('0x9')]=_0x3b87ab[_0x13c2('0x9')];this['campaigntype']=_0x3b87ab['type']===_0x13c2('0xa')?_0x13c2('0xb'):_0x3b87ab['type'];this[_0x13c2('0xc')]=_0x3b87ab[_0x13c2('0xc')];this[_0x13c2('0xd')]=_0x3b87ab[_0x13c2('0xd')];this[_0x13c2('0xe')]=_0x3b87ab[_0x13c2('0xe')];this[_0x13c2('0xf')]=_0x3b87ab[_0x13c2('0xc')]+_0x3b87ab[_0x13c2('0xd')]+_0x3b87ab['countnoanswerretry']+_0x3b87ab[_0x13c2('0x10')]+_0x3b87ab[_0x13c2('0x11')]+_0x3b87ab[_0x13c2('0x12')]+_0x3b87ab['countmachineretry']+_0x3b87ab['countagentrejectretry'];this['countnosuchnumberretry']=_0x3b87ab['countnosuchnumberretry'];this[_0x13c2('0x11')]=_0x3b87ab[_0x13c2('0x11')];this[_0x13c2('0x12')]=_0x3b87ab[_0x13c2('0x12')];this['countmachineretry']=_0x3b87ab[_0x13c2('0x13')];this[_0x13c2('0x14')]=_0x3b87ab[_0x13c2('0x14')];this[_0x13c2('0x15')]=_0x38365d[_0x13c2('0x15')];this['calleridname']=_0x3b87ab['name'];this[_0x13c2('0x16')]=_0x3b87ab[_0x13c2('0x17')];this['starttime']=_0x3b87ab[_0x13c2('0x18')];this[_0x13c2('0x19')]=_0x3b87ab[_0x13c2('0x19')];this[_0x13c2('0x1a')]=_0x3b87ab[_0x13c2('0x1a')];this[_0x13c2('0x1b')]=moment()['format'](_0x13c2('0x1c'));this[_0x13c2('0x1d')]=getSeconds(_0x3b87ab[_0x13c2('0x19')],_0x3b87ab[_0x13c2('0x18')]);this['holdtime']=getSeconds(_0x3b87ab[_0x13c2('0x1a')],_0x3b87ab[_0x13c2('0x19')]);this[_0x13c2('0x1e')]=getSeconds(this[_0x13c2('0x1b')],_0x3b87ab['answertime']);this[_0x13c2('0xb')]=_0x38365d[_0x13c2('0xb')];this[_0x13c2('0x1f')]=_0x38365d['membername'];this[_0x13c2('0x20')]=_0x38365d[_0x13c2('0x20')];this[_0x13c2('0x21')]=_0x3b87ab[_0x13c2('0x21')];this['callbackuniqueid']=_0x3b87ab[_0x13c2('0x22')];this['callbackat']=_0x3b87ab[_0x13c2('0x23')];this[_0x13c2('0x24')]=_0x3b87ab['recallme'];this[_0x13c2('0x25')]=_0x3b87ab[_0x13c2('0x25')];this[_0x13c2('0x26')]=_0x3b87ab[_0x13c2('0x26')];this[_0x13c2('0x27')]=_0x3b87ab[_0x13c2('0x27')];this[_0x13c2('0x28')]=_0x3b87ab[_0x13c2('0x28')];this['CampaignId']=_0x3b87ab[_0x13c2('0x29')];this['originatecalleridnum']=_0x3b87ab[_0x13c2('0x2a')]||'';this[_0x13c2('0x2b')]=_0x3b87ab[_0x13c2('0x2b')]||'';}module[_0x13c2('0x2c')]=AgentComplete; \ No newline at end of file +var _0x4964=['starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','diff','statedesc','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number'];(function(_0x54e8e7,_0x2a6e03){var _0x3af2c6=function(_0x264c48){while(--_0x264c48){_0x54e8e7['push'](_0x54e8e7['shift']());}};_0x3af2c6(++_0x2a6e03);}(_0x4964,0x9b));var _0x4496=function(_0x4a41d7,_0x50660b){_0x4a41d7=_0x4a41d7-0x0;var _0x345e83=_0x4964[_0x4a41d7];return _0x345e83;};'use strict';var util=require(_0x4496('0x0'));var _=require(_0x4496('0x1'));var moment=require('moment');function getSeconds(_0x2b2bbe,_0x2348b3){var _0x2e3241=moment(_0x2b2bbe)['milliseconds'](0x0);var _0x9747fa=moment(_0x2348b3)['milliseconds'](0x0);return _0x2e3241[_0x4496('0x2')](_0x9747fa,'seconds');}function AgentComplete(_0x468919,_0x342c57){this['state']=0x4;this[_0x4496('0x3')]=_0x4496('0x4');this[_0x4496('0x5')]=_0x468919[_0x4496('0x5')];this[_0x4496('0x6')]=_0x468919[_0x4496('0x6')];this[_0x4496('0x7')]=_0x468919[_0x4496('0x6')]==='outbound'?'queue':_0x468919[_0x4496('0x6')];this['countbusyretry']=_0x468919[_0x4496('0x8')];this[_0x4496('0x9')]=_0x468919[_0x4496('0x9')];this[_0x4496('0xa')]=_0x468919[_0x4496('0xa')];this[_0x4496('0xb')]=_0x468919[_0x4496('0x8')]+_0x468919[_0x4496('0x9')]+_0x468919['countnoanswerretry']+_0x468919[_0x4496('0xc')]+_0x468919[_0x4496('0xd')]+_0x468919[_0x4496('0xe')]+_0x468919[_0x4496('0xf')]+_0x468919['countagentrejectretry'];this[_0x4496('0xc')]=_0x468919[_0x4496('0xc')];this[_0x4496('0xd')]=_0x468919[_0x4496('0xd')];this[_0x4496('0xe')]=_0x468919[_0x4496('0xe')];this[_0x4496('0xf')]=_0x468919[_0x4496('0xf')];this[_0x4496('0x10')]=_0x468919[_0x4496('0x10')];this[_0x4496('0x11')]=_0x342c57[_0x4496('0x11')];this[_0x4496('0x12')]=_0x468919[_0x4496('0x13')];this['calleridnum']=_0x468919[_0x4496('0x14')];this[_0x4496('0x15')]=_0x468919[_0x4496('0x15')];this[_0x4496('0x16')]=_0x468919['responsetime'];this[_0x4496('0x17')]=_0x468919[_0x4496('0x17')];this[_0x4496('0x18')]=moment()[_0x4496('0x19')](_0x4496('0x1a'));this[_0x4496('0x1b')]=getSeconds(_0x468919[_0x4496('0x16')],_0x468919[_0x4496('0x15')]);this[_0x4496('0x1c')]=getSeconds(_0x468919['answertime'],_0x468919['responsetime']);this[_0x4496('0x1d')]=getSeconds(this[_0x4496('0x18')],_0x468919[_0x4496('0x17')]);this[_0x4496('0x1e')]=_0x342c57[_0x4496('0x1e')];this[_0x4496('0x1f')]=_0x342c57['membername'];this[_0x4496('0x20')]=_0x342c57[_0x4496('0x20')];this[_0x4496('0x21')]=_0x468919[_0x4496('0x21')];this['callbackuniqueid']=_0x468919[_0x4496('0x22')];this[_0x4496('0x23')]=_0x468919[_0x4496('0x23')];this[_0x4496('0x24')]=_0x468919['recallme'];this[_0x4496('0x25')]=_0x468919[_0x4496('0x25')];this[_0x4496('0x26')]=_0x468919[_0x4496('0x26')];this[_0x4496('0x27')]=_0x468919[_0x4496('0x27')];this[_0x4496('0x28')]=_0x468919[_0x4496('0x28')];this[_0x4496('0x29')]=_0x468919[_0x4496('0x29')];this[_0x4496('0x2a')]=_0x468919[_0x4496('0x2a')]||'';this['originatecalleridname']=_0x468919[_0x4496('0x2b')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 987a478..e8aecf6 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 _0x2a43=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridnum','starttime','responsetime','endtime'];(function(_0x4ace03,_0x68babb){var _0x3c6fc1=function(_0x4c95c1){while(--_0x4c95c1){_0x4ace03['push'](_0x4ace03['shift']());}};_0x3c6fc1(++_0x68babb);}(_0x2a43,0x11c));var _0x32a4=function(_0x32c49b,_0x444f09){_0x32c49b=_0x32c49b-0x0;var _0x1acc02=_0x2a43[_0x32c49b];return _0x1acc02;};'use strict';var util=require('util');var _=require(_0x32a4('0x0'));var moment=require('moment');function getSeconds(_0x24e97c,_0x51186f){var _0x4eaed1=moment(_0x24e97c)[_0x32a4('0x1')](0x0);var _0x66957f=moment(_0x51186f)[_0x32a4('0x1')](0x0);return _0x4eaed1[_0x32a4('0x2')](_0x66957f,_0x32a4('0x3'));}function Final(_0x340444){this[_0x32a4('0x4')]=_0x340444[_0x32a4('0x4')];this[_0x32a4('0x5')]=_0x340444[_0x32a4('0x5')];this[_0x32a4('0x6')]=_0x340444[_0x32a4('0x6')];this[_0x32a4('0x7')]=_0x340444[_0x32a4('0x6')]===_0x32a4('0x8')?'queue':_0x340444[_0x32a4('0x6')];this[_0x32a4('0x9')]=_0x340444[_0x32a4('0x9')];this[_0x32a4('0xa')]=_0x340444[_0x32a4('0xa')];this['countnoanswerretry']=_0x340444[_0x32a4('0xb')];this[_0x32a4('0xc')]=_0x340444[_0x32a4('0x9')]+_0x340444[_0x32a4('0xa')]+_0x340444['countnoanswerretry']+_0x340444[_0x32a4('0xd')]+_0x340444[_0x32a4('0xe')]+_0x340444[_0x32a4('0xf')]+_0x340444['countmachineretry']+_0x340444[_0x32a4('0x10')];this[_0x32a4('0xd')]=_0x340444['countnosuchnumberretry'];this[_0x32a4('0xe')]=_0x340444[_0x32a4('0xe')];this['countabandonedretry']=_0x340444[_0x32a4('0xf')];this[_0x32a4('0x11')]=_0x340444['countmachineretry'];this[_0x32a4('0x10')]=_0x340444[_0x32a4('0x10')];this['queue']=_0x340444['queue'];this['calleridname']=_0x340444['calleridname'];this[_0x32a4('0x12')]=_0x340444[_0x32a4('0x12')];this[_0x32a4('0x13')]=_0x340444[_0x32a4('0x13')];this[_0x32a4('0x14')]=_0x340444[_0x32a4('0x14')];this[_0x32a4('0x15')]=_0x340444['responsetime'];this['ringtime']=_0x340444['ringtime']||0x0;this[_0x32a4('0x16')]=_0x340444['holdtime']||0x0;this[_0x32a4('0x17')]=_0x340444[_0x32a4('0x17')]||0x0;this[_0x32a4('0x18')]=_0x340444[_0x32a4('0x18')];this[_0x32a4('0x19')]=_0x340444[_0x32a4('0x19')];this[_0x32a4('0x1a')]=_0x340444[_0x32a4('0x1a')];this[_0x32a4('0x1b')]=_0x340444['recallme'];this['ContactId']=_0x340444[_0x32a4('0x1c')];this['ListId']=_0x340444['ListId'];this[_0x32a4('0x1d')]=_0x340444['UserId'];this[_0x32a4('0x1e')]=_0x340444[_0x32a4('0x1e')];this['CampaignId']=_0x340444[_0x32a4('0x1f')];this[_0x32a4('0x20')]=_0x340444['originatecalleridnum']||'';this['originatecalleridname']=_0x340444['originatecalleridname']||'';}module[_0x32a4('0x21')]=Final; \ No newline at end of file +var _0x9818=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x1f85fa,_0x197458){var _0x54b9aa=function(_0x23a99d){while(--_0x23a99d){_0x1f85fa['push'](_0x1f85fa['shift']());}};_0x54b9aa(++_0x197458);}(_0x9818,0x92));var _0x8981=function(_0x30c081,_0x4cd0a9){_0x30c081=_0x30c081-0x0;var _0xf9f26d=_0x9818[_0x30c081];return _0xf9f26d;};'use strict';var util=require(_0x8981('0x0'));var _=require(_0x8981('0x1'));var moment=require('moment');function getSeconds(_0x24dad3,_0x39c3ec){var _0x1b39a6=moment(_0x24dad3)[_0x8981('0x2')](0x0);var _0x321920=moment(_0x39c3ec)[_0x8981('0x2')](0x0);return _0x1b39a6[_0x8981('0x3')](_0x321920,_0x8981('0x4'));}function Final(_0x4b1b24){this[_0x8981('0x5')]=_0x4b1b24['uniqueid'];this[_0x8981('0x6')]=_0x4b1b24['scheduledat'];this[_0x8981('0x7')]=_0x4b1b24[_0x8981('0x7')];this[_0x8981('0x8')]=_0x4b1b24[_0x8981('0x7')]===_0x8981('0x9')?_0x8981('0xa'):_0x4b1b24[_0x8981('0x7')];this[_0x8981('0xb')]=_0x4b1b24[_0x8981('0xb')];this[_0x8981('0xc')]=_0x4b1b24[_0x8981('0xc')];this[_0x8981('0xd')]=_0x4b1b24[_0x8981('0xd')];this[_0x8981('0xe')]=_0x4b1b24['countbusyretry']+_0x4b1b24[_0x8981('0xc')]+_0x4b1b24[_0x8981('0xd')]+_0x4b1b24[_0x8981('0xf')]+_0x4b1b24[_0x8981('0x10')]+_0x4b1b24[_0x8981('0x11')]+_0x4b1b24['countmachineretry']+_0x4b1b24[_0x8981('0x12')];this[_0x8981('0xf')]=_0x4b1b24['countnosuchnumberretry'];this[_0x8981('0x10')]=_0x4b1b24[_0x8981('0x10')];this[_0x8981('0x11')]=_0x4b1b24[_0x8981('0x11')];this[_0x8981('0x13')]=_0x4b1b24[_0x8981('0x13')];this[_0x8981('0x12')]=_0x4b1b24[_0x8981('0x12')];this['queue']=_0x4b1b24[_0x8981('0xa')];this['calleridname']=_0x4b1b24[_0x8981('0x14')];this[_0x8981('0x15')]=_0x4b1b24['calleridnum'];this[_0x8981('0x16')]=_0x4b1b24[_0x8981('0x16')];this[_0x8981('0x17')]=_0x4b1b24[_0x8981('0x17')];this[_0x8981('0x18')]=_0x4b1b24[_0x8981('0x17')];this[_0x8981('0x19')]=_0x4b1b24[_0x8981('0x19')]||0x0;this[_0x8981('0x1a')]=_0x4b1b24['holdtime']||0x0;this['talktime']=_0x4b1b24[_0x8981('0x1b')]||0x0;this[_0x8981('0x1c')]=_0x4b1b24['callback'];this[_0x8981('0x1d')]=_0x4b1b24[_0x8981('0x1d')];this[_0x8981('0x1e')]=_0x4b1b24[_0x8981('0x1e')];this[_0x8981('0x1f')]=_0x4b1b24[_0x8981('0x1f')];this[_0x8981('0x20')]=_0x4b1b24[_0x8981('0x20')];this['ListId']=_0x4b1b24[_0x8981('0x21')];this[_0x8981('0x22')]=_0x4b1b24[_0x8981('0x22')];this[_0x8981('0x23')]=_0x4b1b24[_0x8981('0x23')];this[_0x8981('0x24')]=_0x4b1b24[_0x8981('0x24')];this[_0x8981('0x25')]=_0x4b1b24[_0x8981('0x25')]||'';this['originatecalleridname']=_0x4b1b24[_0x8981('0x26')]||'';}module[_0x8981('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 1b9c6fb..9f52861 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 _0x8e0c=['seconds','state','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue','membername','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','milliseconds','diff'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8e0c,0xf9));var _0xc8e0=function(_0x5cc8e1,_0x113e9a){_0x5cc8e1=_0x5cc8e1-0x0;var _0x311b10=_0x8e0c[_0x5cc8e1];return _0x311b10;};'use strict';var util=require(_0xc8e0('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x473070,_0x27a8c0){var _0x2466e6=moment(_0x473070)['milliseconds'](0x0);var _0x59c89e=moment(_0x27a8c0)[_0xc8e0('0x1')](0x0);return _0x2466e6[_0xc8e0('0x2')](_0x59c89e,_0xc8e0('0x3'));}function Hangup(_0x2859a4,_0x59cc8d){this[_0xc8e0('0x4')]=0x4;this['statedesc']=_0xc8e0('0x5');this[_0xc8e0('0x6')]=_0x2859a4[_0xc8e0('0x6')];this[_0xc8e0('0x7')]=_0x2859a4[_0xc8e0('0x7')];this[_0xc8e0('0x8')]=_0x2859a4[_0xc8e0('0x7')]===_0xc8e0('0x9')?'queue':_0x2859a4[_0xc8e0('0x7')];this[_0xc8e0('0xa')]=_0x2859a4[_0xc8e0('0xa')];this['countcongestionretry']=_0x2859a4[_0xc8e0('0xb')];this[_0xc8e0('0xc')]=_0x2859a4[_0xc8e0('0xc')];this[_0xc8e0('0xd')]=_0x2859a4[_0xc8e0('0xa')]+_0x2859a4[_0xc8e0('0xb')]+_0x2859a4[_0xc8e0('0xc')]+_0x2859a4['countnosuchnumberretry']+_0x2859a4[_0xc8e0('0xe')]+_0x2859a4[_0xc8e0('0xf')]+_0x2859a4['countmachineretry']+_0x2859a4['countagentrejectretry'];this[_0xc8e0('0x10')]=_0x2859a4[_0xc8e0('0x10')];this[_0xc8e0('0xe')]=_0x2859a4['countdropretry'];this[_0xc8e0('0xf')]=_0x2859a4[_0xc8e0('0xf')];this[_0xc8e0('0x11')]=_0x2859a4[_0xc8e0('0x11')];this['countagentrejectretry']=_0x2859a4[_0xc8e0('0x12')];this[_0xc8e0('0x13')]=_0x59cc8d[_0xc8e0('0x13')];this[_0xc8e0('0x14')]=_0x2859a4[_0xc8e0('0x15')];this[_0xc8e0('0x16')]=_0x2859a4['number'];this[_0xc8e0('0x17')]=_0x2859a4[_0xc8e0('0x17')];this[_0xc8e0('0x18')]=_0x2859a4[_0xc8e0('0x18')];this[_0xc8e0('0x19')]=moment()[_0xc8e0('0x1a')](_0xc8e0('0x1b'));this[_0xc8e0('0x1c')]=getSeconds(_0x2859a4['responsetime'],_0x2859a4[_0xc8e0('0x17')]);this['holdtime']=0x0;this[_0xc8e0('0x1d')]=getSeconds(this[_0xc8e0('0x19')],_0x2859a4['responsetime']);this['queue']=_0x2859a4[_0xc8e0('0x1e')];this[_0xc8e0('0x1f')]='IVR';this['reason']=_0x59cc8d[_0xc8e0('0x20')];this['callback']=_0x2859a4['callback'];this[_0xc8e0('0x21')]=_0x2859a4[_0xc8e0('0x21')];this[_0xc8e0('0x22')]=_0x2859a4[_0xc8e0('0x22')];this[_0xc8e0('0x23')]=_0x2859a4['recallme'];this[_0xc8e0('0x24')]=_0x2859a4[_0xc8e0('0x24')];this[_0xc8e0('0x25')]=_0x2859a4[_0xc8e0('0x25')];this[_0xc8e0('0x26')]=_0x2859a4[_0xc8e0('0x26')];this['VoiceQueueId']=_0x2859a4[_0xc8e0('0x27')];this[_0xc8e0('0x28')]=_0x2859a4[_0xc8e0('0x28')];}module[_0xc8e0('0x29')]=Hangup; \ No newline at end of file +var _0x2b15=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue'];(function(_0x1e7563,_0x2ad814){var _0x974cae=function(_0x1041c2){while(--_0x1041c2){_0x1e7563['push'](_0x1e7563['shift']());}};_0x974cae(++_0x2ad814);}(_0x2b15,0xa8));var _0x52b1=function(_0x5f5512,_0x4e17fe){_0x5f5512=_0x5f5512-0x0;var _0x11a869=_0x2b15[_0x5f5512];return _0x11a869;};'use strict';var util=require('util');var _=require(_0x52b1('0x0'));var moment=require(_0x52b1('0x1'));function getSeconds(_0x490317,_0x365310){var _0x397a3c=moment(_0x490317)[_0x52b1('0x2')](0x0);var _0x20fa5c=moment(_0x365310)['milliseconds'](0x0);return _0x397a3c[_0x52b1('0x3')](_0x20fa5c,_0x52b1('0x4'));}function Hangup(_0x8acad6,_0x10961c){this[_0x52b1('0x5')]=0x4;this[_0x52b1('0x6')]=_0x52b1('0x7');this[_0x52b1('0x8')]=_0x8acad6[_0x52b1('0x8')];this[_0x52b1('0x9')]=_0x8acad6[_0x52b1('0x9')];this['campaigntype']=_0x8acad6[_0x52b1('0x9')]===_0x52b1('0xa')?_0x52b1('0xb'):_0x8acad6[_0x52b1('0x9')];this[_0x52b1('0xc')]=_0x8acad6[_0x52b1('0xc')];this[_0x52b1('0xd')]=_0x8acad6['countcongestionretry'];this[_0x52b1('0xe')]=_0x8acad6[_0x52b1('0xe')];this[_0x52b1('0xf')]=_0x8acad6['countbusyretry']+_0x8acad6[_0x52b1('0xd')]+_0x8acad6['countnoanswerretry']+_0x8acad6[_0x52b1('0x10')]+_0x8acad6['countdropretry']+_0x8acad6['countabandonedretry']+_0x8acad6[_0x52b1('0x11')]+_0x8acad6['countagentrejectretry'];this['countnosuchnumberretry']=_0x8acad6[_0x52b1('0x10')];this['countdropretry']=_0x8acad6[_0x52b1('0x12')];this[_0x52b1('0x13')]=_0x8acad6['countabandonedretry'];this[_0x52b1('0x11')]=_0x8acad6[_0x52b1('0x11')];this['countagentrejectretry']=_0x8acad6['countagentrejectretry'];this[_0x52b1('0x14')]=_0x10961c[_0x52b1('0x14')];this[_0x52b1('0x15')]=_0x8acad6[_0x52b1('0x16')];this[_0x52b1('0x17')]=_0x8acad6[_0x52b1('0x18')];this['starttime']=_0x8acad6[_0x52b1('0x19')];this[_0x52b1('0x1a')]=_0x8acad6['responsetime'];this[_0x52b1('0x1b')]=moment()[_0x52b1('0x1c')](_0x52b1('0x1d'));this[_0x52b1('0x1e')]=getSeconds(_0x8acad6[_0x52b1('0x1a')],_0x8acad6[_0x52b1('0x19')]);this['holdtime']=0x0;this[_0x52b1('0x1f')]=getSeconds(this[_0x52b1('0x1b')],_0x8acad6[_0x52b1('0x1a')]);this[_0x52b1('0xb')]=_0x8acad6[_0x52b1('0xb')];this[_0x52b1('0x20')]='IVR';this[_0x52b1('0x21')]=_0x10961c[_0x52b1('0x22')];this[_0x52b1('0x23')]=_0x8acad6[_0x52b1('0x23')];this[_0x52b1('0x24')]=_0x8acad6[_0x52b1('0x24')];this[_0x52b1('0x25')]=_0x8acad6[_0x52b1('0x25')];this['recallme']=_0x8acad6[_0x52b1('0x26')];this[_0x52b1('0x27')]=_0x8acad6[_0x52b1('0x27')];this[_0x52b1('0x28')]=_0x8acad6[_0x52b1('0x28')];this[_0x52b1('0x29')]=_0x8acad6[_0x52b1('0x29')];this[_0x52b1('0x2a')]=_0x8acad6[_0x52b1('0x2a')];this['CampaignId']=_0x8acad6[_0x52b1('0x2b')];}module[_0x52b1('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 0da4bbd..8b152fe 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 _0xafa8=['countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x2753ca,_0x57c477){var _0x4306cc=function(_0x40ae24){while(--_0x40ae24){_0x2753ca['push'](_0x2753ca['shift']());}};_0x4306cc(++_0x57c477);}(_0xafa8,0x135));var _0x8afa=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0xafa8[_0x56740a];return _0x257144;};'use strict';var util=require('util');var _=require(_0x8afa('0x0'));var moment=require(_0x8afa('0x1'));function getSeconds(_0xe901e8,_0x221aec){var _0x198d41=moment(_0xe901e8)[_0x8afa('0x2')](0x0);var _0x144520=moment(_0x221aec)['milliseconds'](0x0);return _0x198d41[_0x8afa('0x3')](_0x144520,'seconds');}function History(_0x1912b1){this['uniqueid']=_0x1912b1['uniqueid'];this[_0x8afa('0x4')]=_0x1912b1[_0x8afa('0x4')]||undefined;this[_0x8afa('0x5')]=_0x1912b1[_0x8afa('0x5')];this['campaigntype']=_0x1912b1[_0x8afa('0x5')]===_0x8afa('0x6')?_0x8afa('0x7'):_0x1912b1[_0x8afa('0x5')];this[_0x8afa('0x8')]=_0x1912b1[_0x8afa('0x8')];this[_0x8afa('0x9')]=_0x1912b1[_0x8afa('0x9')];this[_0x8afa('0xa')]=_0x1912b1['countnoanswerretry'];this[_0x8afa('0xb')]=_0x1912b1[_0x8afa('0x8')]+_0x1912b1[_0x8afa('0x9')]+_0x1912b1[_0x8afa('0xa')]+_0x1912b1[_0x8afa('0xc')]+_0x1912b1[_0x8afa('0xd')]+_0x1912b1[_0x8afa('0xe')]+_0x1912b1[_0x8afa('0xf')]+_0x1912b1[_0x8afa('0x10')];this['countnosuchnumberretry']=_0x1912b1[_0x8afa('0xc')];this['countdropretry']=_0x1912b1[_0x8afa('0xd')];this[_0x8afa('0xe')]=_0x1912b1[_0x8afa('0xe')];this['countmachineretry']=_0x1912b1[_0x8afa('0xf')];this[_0x8afa('0x10')]=_0x1912b1[_0x8afa('0x10')];this[_0x8afa('0x7')]=_0x1912b1['queue'];this[_0x8afa('0x11')]=_0x1912b1[_0x8afa('0x12')];this[_0x8afa('0x13')]=_0x1912b1['number'];this[_0x8afa('0x14')]=_0x1912b1[_0x8afa('0x14')];this[_0x8afa('0x15')]=_0x1912b1[_0x8afa('0x15')];this[_0x8afa('0x16')]=_0x1912b1[_0x8afa('0x15')];this[_0x8afa('0x17')]=getSeconds(_0x1912b1['responsetime'],_0x1912b1[_0x8afa('0x14')]);this[_0x8afa('0x18')]=0x0;this[_0x8afa('0x19')]=0x0;this[_0x8afa('0x1a')]=_0x1912b1[_0x8afa('0x1a')];this['callbackuniqueid']=_0x1912b1['callbackuniqueid'];this[_0x8afa('0x1b')]=_0x1912b1['callbackat'];this[_0x8afa('0x1c')]=_0x1912b1[_0x8afa('0x1c')];this['ContactId']=_0x1912b1[_0x8afa('0x1d')];this[_0x8afa('0x1e')]=_0x1912b1[_0x8afa('0x1e')];this[_0x8afa('0x1f')]=_0x1912b1['UserId'];this[_0x8afa('0x20')]=_0x1912b1['VoiceQueueId'];this[_0x8afa('0x21')]=_0x1912b1[_0x8afa('0x21')];this[_0x8afa('0x22')]=_0x1912b1['originatecalleridnum']||'';this[_0x8afa('0x23')]=_0x1912b1['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file +var _0x7fd4=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0x7fd4,0x117));var _0x47fd=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0x7fd4[_0x40822a];return _0x357420;};'use strict';var util=require(_0x47fd('0x0'));var _=require(_0x47fd('0x1'));var moment=require('moment');function getSeconds(_0x849953,_0x45f820){var _0xddab3e=moment(_0x849953)[_0x47fd('0x2')](0x0);var _0x1bb7a0=moment(_0x45f820)[_0x47fd('0x2')](0x0);return _0xddab3e['diff'](_0x1bb7a0,_0x47fd('0x3'));}function History(_0x956a04){this[_0x47fd('0x4')]=_0x956a04[_0x47fd('0x4')];this[_0x47fd('0x5')]=_0x956a04[_0x47fd('0x5')]||undefined;this[_0x47fd('0x6')]=_0x956a04[_0x47fd('0x6')];this[_0x47fd('0x7')]=_0x956a04['type']===_0x47fd('0x8')?_0x47fd('0x9'):_0x956a04[_0x47fd('0x6')];this[_0x47fd('0xa')]=_0x956a04[_0x47fd('0xa')];this[_0x47fd('0xb')]=_0x956a04[_0x47fd('0xb')];this[_0x47fd('0xc')]=_0x956a04[_0x47fd('0xc')];this[_0x47fd('0xd')]=_0x956a04['countbusyretry']+_0x956a04[_0x47fd('0xb')]+_0x956a04[_0x47fd('0xc')]+_0x956a04[_0x47fd('0xe')]+_0x956a04['countdropretry']+_0x956a04[_0x47fd('0xf')]+_0x956a04[_0x47fd('0x10')]+_0x956a04[_0x47fd('0x11')];this[_0x47fd('0xe')]=_0x956a04[_0x47fd('0xe')];this[_0x47fd('0x12')]=_0x956a04[_0x47fd('0x12')];this[_0x47fd('0xf')]=_0x956a04[_0x47fd('0xf')];this[_0x47fd('0x10')]=_0x956a04['countmachineretry'];this[_0x47fd('0x11')]=_0x956a04[_0x47fd('0x11')];this[_0x47fd('0x9')]=_0x956a04[_0x47fd('0x9')];this[_0x47fd('0x13')]=_0x956a04['name'];this['calleridnum']=_0x956a04[_0x47fd('0x14')];this['starttime']=_0x956a04[_0x47fd('0x15')];this[_0x47fd('0x16')]=_0x956a04[_0x47fd('0x16')];this[_0x47fd('0x17')]=_0x956a04[_0x47fd('0x16')];this[_0x47fd('0x18')]=getSeconds(_0x956a04['responsetime'],_0x956a04[_0x47fd('0x15')]);this[_0x47fd('0x19')]=0x0;this[_0x47fd('0x1a')]=0x0;this[_0x47fd('0x1b')]=_0x956a04[_0x47fd('0x1b')];this[_0x47fd('0x1c')]=_0x956a04[_0x47fd('0x1c')];this[_0x47fd('0x1d')]=_0x956a04[_0x47fd('0x1d')];this['recallme']=_0x956a04[_0x47fd('0x1e')];this[_0x47fd('0x1f')]=_0x956a04[_0x47fd('0x1f')];this[_0x47fd('0x20')]=_0x956a04[_0x47fd('0x20')];this['UserId']=_0x956a04[_0x47fd('0x21')];this[_0x47fd('0x22')]=_0x956a04[_0x47fd('0x22')];this[_0x47fd('0x23')]=_0x956a04['CampaignId'];this[_0x47fd('0x24')]=_0x956a04[_0x47fd('0x24')]||'';this[_0x47fd('0x25')]=_0x956a04[_0x47fd('0x25')]||'';}module[_0x47fd('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index ccb3c83..0cca549 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 _0x08af=['_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','Action','iftime\x20%s,%s','interval','timezones','content','indexOf','true','command','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','checkIfTime','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','dialAbandonedMaxRetry','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','ACTIVE','emptyContact','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Error','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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]','m\x20=\x20','Umin\x20=\x20','exports','lodash','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./hangup','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','name','message','NOT_ACTIVE','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','format','ivr','campaign:ivr:%s','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','clearZombieChannels','[uniqueid]','[actions]','sequence','isNil','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','checkIsBlackList','resolve','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','saveInDb','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','reachable','SIP/%s','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerCallsDay','membername','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','value','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countnoanswerretry','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','cause-txt','[syncHangupIvr]','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','endtime','calleridname','calleridnum','Abandoned','dropreason','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','actions','actionid','locked','paused','stateinterface','strategy','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','[unlock][syncQueueStatusComplete]'];(function(_0x391baa,_0x23308b){var _0x450dde=function(_0x3f63d3){while(--_0x3f63d3){_0x391baa['push'](_0x391baa['shift']());}};_0x450dde(++_0x23308b);}(_0x08af,0xff));var _0xf08a=function(_0x2aaf0c,_0x120301){_0x2aaf0c=_0x2aaf0c-0x0;var _0x2ccbed=_0x08af[_0x2aaf0c];return _0x2ccbed;};'use strict';var util=require('util');var _=require(_0xf08a('0x0'));var BPromise=require(_0xf08a('0x1'));var uuid=require('uuid');var moment=require(_0xf08a('0x2'));var rr=require('rr');var md5=require(_0xf08a('0x3'));var Redis=require(_0xf08a('0x4'));var ut=require(_0xf08a('0x5'));var config=require(_0xf08a('0x6'));var logger=require(_0xf08a('0x7'))('dialer');var loggerBooked=require(_0xf08a('0x7'))(_0xf08a('0x8'));var loggerPredictive=require(_0xf08a('0x7'))(_0xf08a('0x9'));var loggerPredictiveCalls=require(_0xf08a('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xf08a('0x7'))(_0xf08a('0xa'));var ami=require(_0xf08a('0xb'));config['redis']=_[_0xf08a('0xc')](config[_0xf08a('0xd')],{'host':_0xf08a('0xe'),'port':0x18eb});var io=require(_0xf08a('0xf'))(new Redis(config[_0xf08a('0xd')]));var cmHopper=require(_0xf08a('0x10'));var cmHopperHistory=require(_0xf08a('0x11'));var cmHopperBlack=require(_0xf08a('0x12'));var voiceQueueRt=require(_0xf08a('0x13'));var Action=require(_0xf08a('0x14'));var History=require('./history');var Final=require(_0xf08a('0x15'));var AgentComplete=require(_0xf08a('0x16'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xf08a('0x17'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0xf08a('0x18');var strategy={'rrmemory':_0xf08a('0x19'),'roundrobin':_0xf08a('0x1a')};var Sequence=function(){};Sequence[_0xf08a('0x1b')][_0xf08a('0x1c')]=function(_0x2fe7df){this['tail']=this[_0xf08a('0x1d')]?this[_0xf08a('0x1d')][_0xf08a('0x1e')](_0x2fe7df):_0x2fe7df();};function Dialer(_0x248567,_0x587ead){this['sequence']=new Sequence();this[_0xf08a('0x1f')]=_0x587ead;this[_0xf08a('0x20')]=_0x248567['voiceQueues'];this[_0xf08a('0x21')]=_0x248567[_0xf08a('0x21')];this['agents']=_0x248567[_0xf08a('0x22')];this['trunks']=_0x248567[_0xf08a('0x23')];this['maxNumberOriginate']=config[_0xf08a('0x24')]||0x2;this[_0xf08a('0x25')]={};this['actions']={};this[_0xf08a('0x26')]={};this[_0xf08a('0x27')]={};this[_0xf08a('0x28')]={};this[_0xf08a('0x29')]={};this['startProgressive']={};this[_0xf08a('0x2a')]={};this[_0xf08a('0x2b')]={};this[_0xf08a('0x2c')]={};ami['on'](_0xf08a('0x2d'),this['syncAgentConnect'][_0xf08a('0x2e')](this));ami['on'](_0xf08a('0x2f'),this['syncQueueCallerAbandon'][_0xf08a('0x2e')](this));ami['on'](_0xf08a('0x30'),this['syncOriginateResponse'][_0xf08a('0x2e')](this));ami['on'](_0xf08a('0x31'),this[_0xf08a('0x32')]['bind'](this));ami['on'](_0xf08a('0x33'),this[_0xf08a('0xa')][_0xf08a('0x2e')](this));ami['on']('hangup',this['syncHangup'][_0xf08a('0x2e')](this));ami['on'](_0xf08a('0x34'),this[_0xf08a('0x35')][_0xf08a('0x2e')](this));ami['on']('varset',this[_0xf08a('0x36')][_0xf08a('0x2e')](this));ami['on'](_0xf08a('0x37'),this[_0xf08a('0x38')][_0xf08a('0x2e')](this));ami['on'](_0xf08a('0x39'),this[_0xf08a('0x3a')][_0xf08a('0x2e')](this));this['loopCampaigns']();this[_0xf08a('0x3b')]();}function isNotNull(_0x28604d){return _0x28604d!==null&&!_[_0xf08a('0x3c')](_0x28604d);}function checkIsLoggedIn(_0x3cc493,_0x32d261){return function(){if(_0x32d261<=0x0){_0x3cc493['message']='AGENTS_NOT_LOGGED';throw _0x3cc493[_0xf08a('0x3d')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x3d24d0){return _0x3d24d0;}function checkIsActive(_0x4a54ca,_0x370efc){return function(){if(!isActive(_0x370efc)){_0x4a54ca[_0xf08a('0x3e')]=_0xf08a('0x3f');throw _0x4a54ca[_0xf08a('0x3d')]+'\x20NOT\x20Active';}};}function checkInterval(_0x42e4de){return function(){if(!isNotNull(_0x42e4de[_0xf08a('0x40')])){_0x42e4de['message']='INTERVAL_IS_NULL';throw _0x42e4de[_0xf08a('0x3d')]+_0xf08a('0x41');}if(!isNotNull(_0x42e4de[_0xf08a('0x40')][_0xf08a('0x42')])){_0x42e4de['message']=_0xf08a('0x43');throw _0x42e4de[_0xf08a('0x3d')]+_0xf08a('0x41');}if(!isNotNull(_[_0xf08a('0x44')](_0x42e4de[_0xf08a('0x40')][_0xf08a('0x42')]))){_0x42e4de[_0xf08a('0x3e')]='INTERVAL_IS_NULL';throw _0x42e4de[_0xf08a('0x3d')]+_0xf08a('0x41');}};}function msgResponse(_0x3eae0e,_0x32a8b9,_0x1f3a7f){return{'action':_0x3eae0e,'response':_0x32a8b9,'message':_0x1f3a7f,'stack':_0x1f3a7f};}function myreject(_0x4e72c9){return function(_0x89b3d6){return _0x4e72c9(msgResponse(_0xf08a('0x45'),'Error',JSON[_0xf08a('0x46')](_0x89b3d6)));};}function getSeconds(_0x47a235,_0x27d3e7){var _0x1199be=moment(_0x47a235)[_0xf08a('0x47')](0x0);var _0x271f2a=moment(_0x27d3e7)['milliseconds'](0x0);return _0x1199be[_0xf08a('0x48')](_0x271f2a,_0xf08a('0x49'));}function emit(_0x27397d,_0x1cc8c7,_0x5368f6){io['to'](_0x27397d)[_0xf08a('0x4a')](_0x1cc8c7,_0x5368f6);}function emitVoiceQueueSummary(_0xd28adc){if(_0xd28adc[_0xf08a('0x4b')]===_0xf08a('0x4c')){var _0x555aea={'id':_0xd28adc['id'],'name':_0xd28adc[_0xf08a('0x3d')],'strategy':_0xd28adc['strategy'],'answered':_0xd28adc[_0xf08a('0x4d')],'available':_0xd28adc[_0xf08a('0x4e')],'loggedIn':_0xd28adc[_0xf08a('0x4f')],'pTalking':_0xd28adc[_0xf08a('0x50')],'sumBillable':_0xd28adc[_0xf08a('0x51')],'sumDuration':_0xd28adc[_0xf08a('0x52')],'sumHoldTime':_0xd28adc[_0xf08a('0x53')]||0x0,'talking':_0xd28adc[_0xf08a('0x54')],'total':_0xd28adc['total'],'type':_0xd28adc[_0xf08a('0x4b')],'unmanaged':_0xd28adc[_0xf08a('0x55')],'abandoned':_0xd28adc[_0xf08a('0x56')],'waiting':_0xd28adc[_0xf08a('0x57')],'loggedInDb':_0xd28adc[_0xf08a('0x58')],'dialActive':_0xd28adc[_0xf08a('0x59')],'dialMethod':_0xd28adc[_0xf08a('0x5a')],'dialOriginateCallerIdName':_0xd28adc[_0xf08a('0x5b')],'dialOriginateCallerIdNumber':_0xd28adc['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0xd28adc[_0xf08a('0x5c')],'dialPrefix':_0xd28adc['dialPrefix'],'outboundAnswerAgiCallsDay':_0xd28adc[_0xf08a('0x5d')],'outboundAnswerCallsDay':_0xd28adc['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0xd28adc[_0xf08a('0x5e')],'outboundBusyCallsDay':_0xd28adc[_0xf08a('0x5f')],'outboundCongestionCallsDay':_0xd28adc['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0xd28adc[_0xf08a('0x60')],'outboundDropCallsDayCallersExit':_0xd28adc[_0xf08a('0x61')],'outboundDropCallsDayTimeout':_0xd28adc[_0xf08a('0x62')],'outboundNoAnswerCallsDay':_0xd28adc['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xd28adc[_0xf08a('0x63')],'outboundOriginateFailureCallsDay':_0xd28adc[_0xf08a('0x64')],'outboundReCallsDay':_0xd28adc[_0xf08a('0x65')],'outboundRejectCallsDay':_0xd28adc[_0xf08a('0x66')],'outboundUnknownCallsDay':_0xd28adc[_0xf08a('0x67')],'predictiveIntervalAnsweredCalls':_0xd28adc['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xd28adc[_0xf08a('0x68')],'predictiveIntervalAvgTalktime':_0xd28adc['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0xd28adc[_0xf08a('0x69')],'predictiveIntervalDroppedCallsTimeout':_0xd28adc[_0xf08a('0x6a')],'predictiveIntervalErlangCalls':_0xd28adc[_0xf08a('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0xd28adc[_0xf08a('0x6c')],'predictiveIntervalHitRate':_0xd28adc[_0xf08a('0x6d')],'predictiveIntervalMultiplicativeFactor':_0xd28adc[_0xf08a('0x6e')],'predictiveIntervalPauses':_0xd28adc[_0xf08a('0x6f')],'predictiveIntervalAvailable':_0xd28adc[_0xf08a('0x70')],'predictiveIntervalTotalCalls':_0xd28adc[_0xf08a('0x71')],'message':_0xd28adc['message'],'originated':_0xd28adc[_0xf08a('0x72')],'erlangCalls':_0xd28adc[_0xf08a('0x73')],'erlangCallToSecond':_0xd28adc['erlangCallToSecond'],'erlangAbandonmentRate':_0xd28adc[_0xf08a('0x74')],'erlangBusyFactor':_0xd28adc[_0xf08a('0x75')],'startPredictive':_0xd28adc[_0xf08a('0x29')],'startProgressive':_0xd28adc[_0xf08a('0x76')]};if(_0xd28adc[_0xf08a('0x77')]){_0x555aea[_0xf08a('0x77')]={'id':_0xd28adc[_0xf08a('0x77')]['id'],'name':_0xd28adc[_0xf08a('0x77')][_0xf08a('0x3d')],'active':_0xd28adc['Trunk'][_0xf08a('0x78')],'callerid':_0xd28adc['Trunk']['callerid']};}if(_0xd28adc['Interval']){_0x555aea[_0xf08a('0x40')]={'id':_0xd28adc['Interval']['id'],'name':_0xd28adc['Interval'][_0xf08a('0x3d')]};}var _0x48d015=md5(JSON[_0xf08a('0x46')](_0x555aea));if(_0xd28adc['md5']!==_0x48d015){_0xd28adc[_0xf08a('0x3')]=_0x48d015;emit(util[_0xf08a('0x79')]('voice:queue:%s',_0x555aea[_0xf08a('0x3d')]),'voice_queue:save',_0x555aea);}}}function emitCampaignSummary(_0xf6ea45){if(_0xf6ea45[_0xf08a('0x4b')]===_0xf08a('0x7a')){emit(util[_0xf08a('0x79')](_0xf08a('0x7b'),_0xf6ea45['name']),'campaign:save',_0xf6ea45);}}function checkGetDataPredictive(_0x174faa){if(isNotNull(_0x174faa)&&!_[_0xf08a('0x44')](_0x174faa)){loggerPredictive[_0xf08a('0x7c')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xf08a('0x7c')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x174faa[_0xf08a('0x71')]);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x7d'),_0x174faa[_0xf08a('0x7e')]);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x7f'),_0x174faa[_0xf08a('0x6a')]);loggerPredictive[_0xf08a('0x7c')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x174faa[_0xf08a('0x69')]);loggerPredictive['info'](_0xf08a('0x80'),_0x174faa[_0xf08a('0x68')]);loggerPredictive['info'](_0xf08a('0x81'),_0x174faa[_0xf08a('0x82')]);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x83'));if(_0x174faa[_0xf08a('0x71')]>0x0){if(!_['isUndefined'](_0x174faa[_0xf08a('0x82')])&&_0x174faa[_0xf08a('0x82')]>0x0){return!![];}loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x84'));if(!_[_0xf08a('0x3c')](_0x174faa[_0xf08a('0x68')])&&_0x174faa[_0xf08a('0x68')]>0x0){return!![];}loggerPredictive['info'](_0xf08a('0x85'));}else{loggerPredictive['info'](_0xf08a('0x86'));}}else{loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x87'));}return![];}function mergeDataErlangB(_0xa5b6ce){return function(_0x453ee8){loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x88'));loggerPredictive[_0xf08a('0x7c')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x453ee8['erlangCalls']);loggerPredictive[_0xf08a('0x7c')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x453ee8[_0xf08a('0x89')]);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x8a'),_0x453ee8[_0xf08a('0x74')]);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x8b'),_0x453ee8[_0xf08a('0x75')]);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x8a'),_0x453ee8[_0xf08a('0x74')]);loggerPredictive['info']('---------------------------');_[_0xf08a('0x8c')](_0xa5b6ce,_0x453ee8);};}function getDiff(_0x22b89e){var _0x595550=moment()[_0xf08a('0x47')](0x0);var _0x21491c=moment(_0x22b89e)[_0xf08a('0x47')](0x0);return _0x595550[_0xf08a('0x48')](_0x21491c,_0xf08a('0x49'));}function ifInterval(_0xa68a38,_0x6020b8){if(_[_0xf08a('0x3c')](_0x6020b8)){return![];}return getDiff(_0x6020b8)<_0xa68a38*0x3c;}function freeVariablesPredictive(_0x3e330a){if(isNotNull(_0x3e330a)){if(!_[_0xf08a('0x3c')](_0x3e330a[_0xf08a('0x76')])){_0x3e330a[_0xf08a('0x76')]=undefined;loggerPredictive[_0xf08a('0x7c')](_0x3e330a[_0xf08a('0x3d')],_0xf08a('0x8d'));}if(!_['isUndefined'](_0x3e330a['startPredictive'])){_0x3e330a[_0xf08a('0x29')]=undefined;loggerPredictive[_0xf08a('0x7c')](_0x3e330a['name'],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x3e330a[_0xf08a('0x8e')])){clearInterval(_0x3e330a['handlePredictive']);_0x3e330a[_0xf08a('0x8e')]=undefined;loggerPredictive[_0xf08a('0x7c')](_0x3e330a['name'],_0xf08a('0x8f'));}}}function erlangb(_0x56d443,_0x10dd60){if(_0x10dd60===0x0){return 0x0;}var _0x3958e2=0x1;for(var _0x24d104=0x1;_0x24d104<=_0x10dd60;_0x24d104+=0x1){_0x3958e2=0x1+_0x3958e2*_0x24d104/_0x56d443;}return 0x1/_0x3958e2;}function isVoiceQueueOutbound(_0x2bb760){return _0x2bb760===_0xf08a('0x4c');}function isNotPreview(_0x5e6dcd){return _0x5e6dcd!==_0xf08a('0x1f');}function isCampaignIvr(_0x57dafb){return _0x57dafb===_0xf08a('0x7a');}function getCallerId(_0x521b5c,_0x4acf4d,_0x2861ae){if(!_[_0xf08a('0x3c')](_0x2861ae)&&typeof _0x2861ae===_0xf08a('0x90')&&!_[_0xf08a('0x44')](_0x2861ae)){if(!_[_0xf08a('0x3c')](_0x4acf4d)&&typeof _0x4acf4d==='string'&&!_['isEmpty'](_0x4acf4d)){return util[_0xf08a('0x79')](_0xf08a('0x91'),_0x4acf4d,_0x2861ae);}return util[_0xf08a('0x79')](_0xf08a('0x91'),_0x2861ae,_0x2861ae);}if(!_[_0xf08a('0x3c')](_0x521b5c)&&typeof _0x521b5c===_0xf08a('0x90')&&!_[_0xf08a('0x44')](_0x521b5c)){return _0x521b5c;}return _0xf08a('0x92');}function loggerCatchQueueSummary(_0x53da84,_0x5ad2f9){return function(_0x13e0bb){freeVariablesPredictive(_0x5ad2f9);emitVoiceQueueSummary(_0x5ad2f9);emitCampaignSummary(_0x5ad2f9);loggerSyncQueueSummary[_0xf08a('0x93')](_0x53da84,util[_0xf08a('0x94')](_0x13e0bb,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x708ae1,_0x4dc551){return function(_0x573f8f){loggerPredictive[_0xf08a('0x93')](_0x4dc551['name'],_0x708ae1);loggerPredictive[_0xf08a('0x93')](_0x573f8f[_0xf08a('0x95')]);freeVariablesPredictive(_0x4dc551);};}function loggerCatch(_0x34ce76){return function(_0x34373d){logger[_0xf08a('0x93')](_0x34ce76,util[_0xf08a('0x94')](_0x34373d,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xbbb288){return _0xbbb288&&!_['isUndefined'](_0xbbb288)&&_0xbbb288[_0xf08a('0x96')]>0x0;}function decremetOriginate(_0x359459){if(!_[_0xf08a('0x3c')](_0x359459)&&_0x359459!==null){if(typeof _0x359459['originated']!==_0xf08a('0x97')){if(_0x359459['originated']>0x0){_0x359459[_0xf08a('0x72')]-=0x1;}else{logger[_0xf08a('0x93')](_0xf08a('0x98'));}}}else{logger[_0xf08a('0x93')](_0xf08a('0x99'));}}function checkContactLowerLimitOriginate(_0x515457,_0x21c111,_0x436512){if(_0x21c111>_0x436512){for(var _0x428584=0x0;_0x428584<_0x21c111-_0x436512;_0x428584+=0x1){decremetOriginate(_0x515457);}}}function loggerGetContactDialer(_0x435945,_0x3519cb,_0x4c0f6b){return function(_0x54e1be){checkContactLowerLimitOriginate(_0x3519cb,_0x4c0f6b,0x0);logger['error'](_0x435945,util[_0xf08a('0x94')](_0x54e1be,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x589788){return function(_0x445f4c){if(isNotNull(_0x445f4c)&&isNotNull(_0x445f4c[0x0])){if(_0x445f4c[0x0][_0xf08a('0x9a')]>0x0){_0x589788[_0xf08a('0x3e')]=_0xf08a('0x9b');logger[_0xf08a('0x7c')](_0xf08a('0x9c')+_0x589788[_0xf08a('0x3d')],_0x445f4c[0x0]['contactsRescheduled'],_0xf08a('0x9d'));}else{_0x589788['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xf08a('0x7c')](_0xf08a('0x9e')+_0x589788[_0xf08a('0x3d')]);}}};}function notSendMessagesQueue(_0x38112b){if(_0x38112b[_0xf08a('0x9f')]){freeVariablesPredictive(_0x38112b);if(_0x38112b[_0xf08a('0x72')]===0x0&&_0x38112b[_0xf08a('0x54')]===0x0&&_0x38112b[_0xf08a('0x57')]===0x0&&(_0x38112b['pTalking']||0x0)===0x0){_0x38112b[_0xf08a('0x9f')]=![];_0x38112b[_0xf08a('0x4e')]=0x0;_0x38112b[_0xf08a('0x3e')]=_0xf08a('0x3f');loggerSyncQueueSummary['error'](_0xf08a('0xa0'),_0x38112b[_0xf08a('0x3d')],_0xf08a('0xa1'));}else{_0x38112b[_0xf08a('0x3e')]=_0xf08a('0xa2');loggerSyncQueueSummary[_0xf08a('0x93')](_0xf08a('0xa0'),_0x38112b[_0xf08a('0x3d')],_0xf08a('0xa3'));}emitVoiceQueueSummary(_0x38112b);}}function notSendMessagesCampaign(_0x2a3626){if(_0x2a3626[_0xf08a('0x9f')]){if(_0x2a3626[_0xf08a('0x72')]===0x0){_0x2a3626[_0xf08a('0x9f')]=![];_0x2a3626[_0xf08a('0x3e')]=_0xf08a('0x3f');loggerSyncQueueSummary[_0xf08a('0x93')](_0xf08a('0xa4'),_0x2a3626[_0xf08a('0x3d')],_0xf08a('0xa1'));}else{_0x2a3626[_0xf08a('0x3e')]=_0xf08a('0xa2');loggerSyncQueueSummary[_0xf08a('0x93')](_0xf08a('0xa4'),_0x2a3626[_0xf08a('0x3d')],_0xf08a('0xa3'));}emitCampaignSummary(_0x2a3626);}}function createObjHistory(_0x40adb4,_0x4e93be,_0x18f3de,_0x25507a,_0x565c4f){_0x40adb4[_0xf08a('0x3e')]=_0x18f3de;var _0x3d1fe1=new Action(_0x40adb4,_0x4e93be);var _0x3a955c=new History(_0x3d1fe1);_0x3a955c[_0xf08a('0xa5')]=_0x25507a;_0x3a955c[_0xf08a('0xa6')]=_0x565c4f;_0x3a955c['endtime']=_0x3d1fe1['starttime'];return _0x3a955c;}Dialer[_0xf08a('0x1b')][_0xf08a('0x3b')]=function(){var _0x421fa7=this;setInterval(function(){_0x421fa7[_0xf08a('0xa7')](_0x421fa7[_0xf08a('0x27')],_0xf08a('0xa8'));_0x421fa7[_0xf08a('0xa7')](_0x421fa7['actions'],_0xf08a('0xa9'));},0x32c8);};Dialer[_0xf08a('0x1b')][_0xf08a('0xa7')]=function(_0x4dcfc9,_0x47626d){var _0x2ed842=this;for(var _0x4cea49 in _0x4dcfc9){if(typeof _0x4dcfc9[_0x4cea49]!=='undefined'){this[_0xf08a('0xaa')][_0xf08a('0x1c')](function(){if(!_[_0xf08a('0xab')](_0x4dcfc9[_0x4cea49])){return ami['Action']({'action':_0xf08a('0xac'),'channel':_0x4dcfc9[_0x4cea49][_0xf08a('0xad')]})[_0xf08a('0xae')](function(_0x466bf3){if(_0x466bf3[_0xf08a('0x3e')]===_0xf08a('0xaf')){setTimeout(function(){if(_0x4dcfc9[_0x4cea49]&&_0x4dcfc9[_0x4cea49][_0xf08a('0x4b')]!==_0xf08a('0x7a')){_0x2ed842['updateOriginated'](_0x2ed842[_0xf08a('0x20')][_0x4dcfc9[_0x4cea49][_0xf08a('0xb0')]]);logger[_0xf08a('0x93')](_0xf08a('0xb1'),_0x47626d,_0x4cea49,_0x4dcfc9[_0x4cea49][_0xf08a('0xb0')]);delete _0x4dcfc9[_0x4cea49];}if(_0x4dcfc9[_0x4cea49]&&_0x4dcfc9[_0x4cea49]['type']===_0xf08a('0x7a')){_0x2ed842[_0xf08a('0xb2')](_0x2ed842['campaigns'][_0x4dcfc9[_0x4cea49]['queue']]);logger[_0xf08a('0x93')](_0xf08a('0xb3'),_0x47626d,_0x4cea49,_0x4dcfc9[_0x4cea49][_0xf08a('0xb0')]);delete _0x4dcfc9[_0x4cea49];}},0x2328);}});}});}}};Dialer[_0xf08a('0x1b')]['countReScheduled']=function(_0x58db0c){return BPromise['resolve']()['then'](cmHopper['countReScheduled'](_0x58db0c))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0xf08a('0xb4')]=function(_0x453bd3){return BPromise[_0xf08a('0xb5')]()[_0xf08a('0xb6')](cmHopperBlack['checkIsBlackList'](_0x453bd3))['catch'](loggerCatch(_0xf08a('0xb7')));};Dialer[_0xf08a('0x1b')][_0xf08a('0xb8')]=function(_0x350309){return BPromise['resolve']()[_0xf08a('0xb6')](cmHopperBlack[_0xf08a('0xb8')](_0x350309))[_0xf08a('0xae')](loggerCatch(_0xf08a('0xb9')));};Dialer['prototype'][_0xf08a('0xba')]=function(_0xe87736){return BPromise[_0xf08a('0xb5')]()[_0xf08a('0xb6')](cmHopperHistory['avgHandleTime'](_0xe87736))[_0xf08a('0xae')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xf08a('0x1b')][_0xf08a('0xbb')]=function(_0x593708){return BPromise['resolve']()[_0xf08a('0xb6')](cmHopper[_0xf08a('0xbb')](_0x593708))[_0xf08a('0xae')](loggerCatch(_0xf08a('0xbc')));};Dialer[_0xf08a('0x1b')][_0xf08a('0xbd')]=function(_0x4db368,_0x3385d4,_0x17e705){return BPromise['resolve']()[_0xf08a('0xb6')](cmHopper[_0xf08a('0xbd')](_0x4db368,_0x3385d4,_0x17e705))[_0xf08a('0xae')](loggerCatch(_0xf08a('0xbe')));};Dialer[_0xf08a('0x1b')][_0xf08a('0xbf')]=function(_0x51b193,_0x162447,_0x4dc693,_0x35deec){return BPromise['resolve']()[_0xf08a('0xb6')](cmHopper['getContactDialer'](_0x51b193,_0x162447,_0x4dc693,_0x35deec))[_0xf08a('0xae')](loggerCatch('[getContactDialer]\x20'));};Dialer['prototype'][_0xf08a('0xc0')]=function(_0x53fbd9,_0x11ae27,_0x58c58d){return BPromise['resolve']()[_0xf08a('0xb6')](cmHopper[_0xf08a('0xc0')](_0x53fbd9,_0x11ae27,_0x58c58d))[_0xf08a('0xae')](loggerCatch(_0xf08a('0xc1')));};Dialer[_0xf08a('0x1b')][_0xf08a('0xc2')]=function(_0x591e2b){return BPromise[_0xf08a('0xb5')]()[_0xf08a('0xb6')](voiceQueueRt['getVoiceQueueRtPauses'](_0x591e2b))[_0xf08a('0xae')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0xf08a('0xc3')]=function(_0xcc47ed){return BPromise[_0xf08a('0xb5')]()['then'](cmHopper['moveContactManagedDialer'](_0xcc47ed))[_0xf08a('0xae')](loggerCatch(_0xf08a('0xc4')));};Dialer['prototype'][_0xf08a('0xc5')]=function(_0x5711c6){return BPromise[_0xf08a('0xb5')]()[_0xf08a('0xb6')](cmHopperHistory['createHistory'](_0x5711c6))['catch'](loggerCatch(_0xf08a('0xc6')));};Dialer[_0xf08a('0x1b')][_0xf08a('0xb2')]=function(_0x191fcf){if(!_[_0xf08a('0x3c')](_0x191fcf)&&_0x191fcf!==null){if(typeof _0x191fcf[_0xf08a('0x72')]!=='undefined'){if(_0x191fcf[_0xf08a('0x72')]>0x0){_0x191fcf[_0xf08a('0x72')]-=0x1;}else{logger[_0xf08a('0x93')](_0xf08a('0xc7'));}}}else{logger[_0xf08a('0x93')](_0xf08a('0xc8'));}};Dialer[_0xf08a('0x1b')][_0xf08a('0xc9')]=function(_0x572498,_0x389859){var _0x43f36b=this;return function(_0x250d41){_0x43f36b[_0xf08a('0xb2')](_0x389859);logger['error'](_0x572498,util[_0xf08a('0x94')](_0x250d41,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x2d8eb7,_0x317c4c,_0x209042){var _0x53db20={'state':0x19,'statedesc':'notFound'};this[_0xf08a('0xb2')](_0x317c4c);this[_0xf08a('0xca')](_['merge'](_0x53db20,_[_0xf08a('0xcb')](_0x209042,[_0xf08a('0xcc'),_0xf08a('0xcd'),_0xf08a('0xce'),'VoiceQueueId',_0xf08a('0xcf')])),_0xf08a('0xd0'),_0xf08a('0xd1'));logger[_0xf08a('0x93')](_0x2d8eb7);};Dialer[_0xf08a('0x1b')][_0xf08a('0xd2')]=function(_0x4b0847){return _0x4b0847===_0xf08a('0xd3');};Dialer[_0xf08a('0x1b')]['isTrunkReachable']=function(_0x29c5f5){return!_[_0xf08a('0x3c')](_0x29c5f5)&&_0x29c5f5&&!_[_0xf08a('0x3c')](_0x29c5f5['name'])&&!_['isUndefined'](_0x29c5f5[_0xf08a('0x78')])&&_0x29c5f5[_0xf08a('0x78')]&&(this[_0xf08a('0x23')][util[_0xf08a('0x79')]('SIP/%s',_0x29c5f5[_0xf08a('0x3d')])]['status']===_0xf08a('0xd4')||this[_0xf08a('0x23')][util['format'](_0xf08a('0xd5'),_0x29c5f5[_0xf08a('0x3d')])][_0xf08a('0xac')]==='unmonitored');};Dialer[_0xf08a('0x1b')][_0xf08a('0xca')]=function(_0x2536ea,_0x2e0a4e,_0x29111f){this[_0xf08a('0xc5')](_0x2536ea)[_0xf08a('0xae')](loggerCatch(_0x2e0a4e));this[_0xf08a('0xc3')](_0x2536ea)[_0xf08a('0xae')](loggerCatch(_0x29111f));};Dialer['prototype'][_0xf08a('0x36')]=function(_0x3f7815){var _0x5b9a0a=this[_0xf08a('0x27')][_0x3f7815[_0xf08a('0xd6')]];var _0xc5842e;if(!_['isNil'](_0x3f7815)&&!_[_0xf08a('0xab')](_0x3f7815['variable'])&&!_[_0xf08a('0xab')](_0x3f7815[_0xf08a('0xd7')]['amdstatus'])&&_0x3f7815[_0xf08a('0xd8')]===_0xf08a('0xd9')&&_0x5b9a0a){if(_0x5b9a0a[_0xf08a('0x4b')]!=='ivr'&&this['voiceQueues'][_0x5b9a0a[_0xf08a('0xb0')]][_0xf08a('0xda')]&&_0x3f7815['value']===_0xf08a('0xdb')){delete this[_0xf08a('0x27')][_0x3f7815[_0xf08a('0xd6')]];this[_0xf08a('0xb2')](this[_0xf08a('0x20')][_0x5b9a0a[_0xf08a('0xb0')]]);this['voiceQueues'][_0x5b9a0a[_0xf08a('0xb0')]][_0xf08a('0xdc')]+=0x1;this[_0xf08a('0x20')][_0x5b9a0a['queue']][_0xf08a('0x5d')]+=0x1;_0xc5842e=new Hangup(_0x5b9a0a,_0x3f7815);_0xc5842e[_0xf08a('0xa5')]=0x12;_0xc5842e['statedesc']='HangupInAMD';_0xc5842e[_0xf08a('0xdd')]='AMD';this[_0xf08a('0xca')](_0xc5842e,'[syncHangupInAMD][createHistory]',_0xf08a('0xde'));}if(_0x5b9a0a[_0xf08a('0x4b')]!==_0xf08a('0x7a')&&this[_0xf08a('0x20')][_0x5b9a0a[_0xf08a('0xb0')]][_0xf08a('0xda')]&&_0x3f7815['value']===_0xf08a('0xdf')){var _0x459388=this;return new BPromise(function(_0x39dec8,_0x113b81){delete _0x459388[_0xf08a('0x27')][_0x3f7815[_0xf08a('0xd6')]];_0x459388[_0xf08a('0xb2')](_0x459388['voiceQueues'][_0x5b9a0a[_0xf08a('0xb0')]]);_0x459388['voiceQueues'][_0x5b9a0a[_0xf08a('0xb0')]][_0xf08a('0xdc')]+=0x1;_0x459388[_0xf08a('0x20')][_0x5b9a0a[_0xf08a('0xb0')]][_0xf08a('0x5d')]+=0x1;var _0x2f3bb8=_0x459388[_0xf08a('0x20')][_0x5b9a0a[_0xf08a('0xb0')]];var _0xf5c4f8=new Hangup(_0x5b9a0a,_0x3f7815);_0xf5c4f8['state']=0x13;_0xf5c4f8[_0xf08a('0xa6')]=_0xf08a('0xe0');_0xf5c4f8[_0xf08a('0xdd')]='AMD';_0xf5c4f8[_0xf08a('0xe1')]+=0x1;_0xf5c4f8[_0xf08a('0xe2')]+=0x1;_0xf5c4f8[_0xf08a('0xe3')]=!![];_0x459388[_0xf08a('0xc5')](_0xf5c4f8)[_0xf08a('0xae')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xf5c4f8[_0xf08a('0xe4')]+_0xf5c4f8[_0xf08a('0xe5')]+_0xf5c4f8['countnoanswerretry']+_0xf5c4f8[_0xf08a('0xe6')]+_0xf5c4f8[_0xf08a('0xe7')]+_0xf5c4f8[_0xf08a('0xe8')]+_0xf5c4f8[_0xf08a('0xe1')]+_0xf5c4f8[_0xf08a('0xe9')]>=_0x2f3bb8[_0xf08a('0xea')]){_0x459388[_0xf08a('0xeb')](_0xf5c4f8,_0x39dec8,_0x113b81,_0xf08a('0xec'));}else{if(_0xf5c4f8[_0xf08a('0xe1')]>=_0x2f3bb8[_0xf08a('0xed')]){_0x459388['createStateFinal'](_0xf5c4f8,_0x39dec8,_0x113b81,_0xf08a('0xee'));}else{_0x459388[_0xf08a('0xbb')]({'active':![],'countmachineretry':_0xf5c4f8[_0xf08a('0xe1')],'scheduledat':moment()[_0xf08a('0xef')](_0x2f3bb8[_0xf08a('0xf0')],_0xf08a('0xf1'))[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0xf5c4f8[_0xf08a('0xcc')],'ListId':_0xf5c4f8['ListId'],'VoiceQueueId':_0xf5c4f8[_0xf08a('0xf3')]||undefined,'CampaignId':_0xf5c4f8[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0xf4')));_0x39dec8({'reschedule':0x1});}}});}if(_0x5b9a0a['type']===_0xf08a('0x7a')&&this[_0xf08a('0x21')][_0x5b9a0a['queue']][_0xf08a('0xda')]&&_0x3f7815[_0xf08a('0xf5')]===_0xf08a('0xdb')){delete this[_0xf08a('0x27')][_0x3f7815[_0xf08a('0xd6')]];this[_0xf08a('0xb2')](this[_0xf08a('0x21')][_0x5b9a0a[_0xf08a('0xb0')]]);_0xc5842e=new Hangup(_0x5b9a0a,_0x3f7815);_0xc5842e[_0xf08a('0xa5')]=0x12;_0xc5842e['statedesc']=_0xf08a('0xf6');_0xc5842e['membername']='AMD';this[_0xf08a('0xca')](_0xc5842e,_0xf08a('0xf7'),_0xf08a('0xf8'));}if(_0x5b9a0a[_0xf08a('0x4b')]==='ivr'&&this[_0xf08a('0x21')][_0x5b9a0a[_0xf08a('0xb0')]]['dialAMDActive']&&_0x3f7815[_0xf08a('0xf5')]===_0xf08a('0xdf')){var _0x459388=this;return new BPromise(function(_0xad66c9,_0x29dc38){delete _0x459388[_0xf08a('0x27')][_0x3f7815[_0xf08a('0xd6')]];_0x459388[_0xf08a('0xb2')](_0x459388[_0xf08a('0x21')][_0x5b9a0a[_0xf08a('0xb0')]]);_0x459388[_0xf08a('0x21')][_0x5b9a0a[_0xf08a('0xb0')]][_0xf08a('0xdc')]+=0x1;_0x459388['campaigns'][_0x5b9a0a[_0xf08a('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3a82fe=_0x459388['campaigns'][_0x5b9a0a[_0xf08a('0xb0')]];var _0x58b85e=new Hangup(_0x5b9a0a,_0x3f7815);_0x58b85e[_0xf08a('0xa5')]=0x13;_0x58b85e[_0xf08a('0xa6')]=_0xf08a('0xe0');_0x58b85e[_0xf08a('0xdd')]='AMD';_0x58b85e[_0xf08a('0xe1')]+=0x1;_0x58b85e[_0xf08a('0xe2')]+=0x1;_0x58b85e['amd']=!![];_0x459388[_0xf08a('0xc5')](_0x58b85e)['catch'](loggerCatch(_0xf08a('0xf9')));if(_0x58b85e['countbusyretry']+_0x58b85e['countcongestionretry']+_0x58b85e[_0xf08a('0xfa')]+_0x58b85e['countnosuchnumberretry']+_0x58b85e[_0xf08a('0xe7')]+_0x58b85e[_0xf08a('0xe8')]+_0x58b85e[_0xf08a('0xe1')]+_0x58b85e[_0xf08a('0xe9')]>=_0x3a82fe[_0xf08a('0xea')]){_0x459388[_0xf08a('0xeb')](_0x58b85e,_0xad66c9,_0x29dc38,_0xf08a('0xec'));}else{if(_0x58b85e[_0xf08a('0xe1')]>=_0x3a82fe[_0xf08a('0xed')]){_0x459388[_0xf08a('0xfb')](_0x58b85e,_0xad66c9,_0x29dc38,_0xf08a('0xee'));}else{_0x459388[_0xf08a('0xbb')]({'active':![],'countmachineretry':_0x58b85e[_0xf08a('0xe1')],'scheduledat':moment()[_0xf08a('0xef')](_0x3a82fe[_0xf08a('0xf0')],'minutes')[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x58b85e[_0xf08a('0xcc')],'ListId':_0x58b85e[_0xf08a('0xcd')],'VoiceQueueId':_0x58b85e[_0xf08a('0xf3')]||undefined,'CampaignId':_0x58b85e[_0xf08a('0xcf')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0xad66c9({'reschedule':0x1});}}});}}};Dialer[_0xf08a('0x1b')]['syncHangup']=function(_0x774592){var _0x2ae533=this[_0xf08a('0x27')][_0x774592[_0xf08a('0xd6')]];var _0x39be66=this;var _0x1566fb;if(_0x2ae533&&_0x2ae533['type']===_0xf08a('0x7a')){delete this['uniqueId'][_0x774592[_0xf08a('0xd6')]];this[_0xf08a('0xb2')](this[_0xf08a('0x21')][_0x2ae533['queue']]);this[_0xf08a('0x21')][_0x2ae533['queue']][_0xf08a('0xfc')]+=0x1;_0x1566fb=new Hangup(_0x2ae533,_0x774592);this[_0xf08a('0xc5')](_0x1566fb)[_0xf08a('0xae')](loggerCatch(_0xf08a('0xfd')));this[_0xf08a('0xc3')](_0x1566fb)[_0xf08a('0xae')](loggerCatch('[syncHangupIvr]'));}if(_0x2ae533&&_0x2ae533[_0xf08a('0x4b')]!=='ivr'&&isNotNull(this[_0xf08a('0x20')][_0x2ae533[_0xf08a('0xb0')]][_0xf08a('0xfe')])){delete this[_0xf08a('0x27')][_0x774592['uniqueid']];this[_0xf08a('0xb2')](this[_0xf08a('0x20')][_0x2ae533[_0xf08a('0xb0')]]);this['voiceQueues'][_0x2ae533['queue']][_0xf08a('0xdc')]+=0x1;this[_0xf08a('0x20')][_0x2ae533[_0xf08a('0xb0')]][_0xf08a('0x5d')]+=0x1;_0x1566fb=new Hangup(_0x2ae533,_0x774592);_0x1566fb['state']=0x10;_0x1566fb[_0xf08a('0xa6')]=_0xf08a('0xff');_0x1566fb['membername']=_0xf08a('0x100');this[_0xf08a('0xc5')](_0x1566fb)[_0xf08a('0xae')](loggerCatch(_0xf08a('0xfd')));this[_0xf08a('0xc3')](_0x1566fb)[_0xf08a('0xae')](loggerCatch('[syncHangupIvr]'));}if(_0x2ae533&&_0x2ae533[_0xf08a('0x4b')]!=='ivr'&&!isNotNull(this[_0xf08a('0x20')][_0x2ae533[_0xf08a('0xb0')]][_0xf08a('0xfe')])){delete this[_0xf08a('0x27')][_0x774592[_0xf08a('0xd6')]];this[_0xf08a('0xb2')](this['voiceQueues'][_0x2ae533['queue']]);this[_0xf08a('0x20')][_0x2ae533[_0xf08a('0xb0')]]['outboundUnknownCallsDay']+=0x1;_0x1566fb=new Hangup(_0x2ae533,_0x774592);_0x1566fb[_0xf08a('0xa5')]=0xc;_0x1566fb[_0xf08a('0xa6')]=_0x774592[_0xf08a('0x101')];_0x1566fb[_0xf08a('0xdd')]='Unknow';this[_0xf08a('0xc5')](_0x1566fb)[_0xf08a('0xae')](loggerCatch(_0xf08a('0xfd')));this[_0xf08a('0xc3')](_0x1566fb)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x102')));}};Dialer[_0xf08a('0x1b')][_0xf08a('0x32')]=function(_0x2e885b){var _0x4aaee3=this[_0xf08a('0x27')][_0x2e885b['uniqueid']];var _0x1ce140=this;if(this[_0xf08a('0x20')][_0x2e885b[_0xf08a('0xb0')]]){if(_0x4aaee3&&_0x4aaee3[_0xf08a('0x4b')]!==_0xf08a('0x7a')){delete this[_0xf08a('0x27')][_0x2e885b[_0xf08a('0xd6')]];this[_0xf08a('0x20')][_0x2e885b[_0xf08a('0xb0')]][_0xf08a('0xdc')]+=0x1;var _0x2bef5c=new AgentComplete(_0x4aaee3,_0x2e885b);if(_0x2e885b[_0xf08a('0x103')]==='agent'){_0x2bef5c[_0xf08a('0x104')]=this['voiceQueues'][_0x2e885b[_0xf08a('0xb0')]][_0xf08a('0x105')]&&this[_0xf08a('0x20')][_0x2e885b[_0xf08a('0xb0')]][_0xf08a('0x106')]?moment()[_0xf08a('0x79')](_0xf08a('0xf2')):undefined;}this['createHistory'](_0x2bef5c)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x107')));this[_0xf08a('0xc3')](_0x2bef5c)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x108')));}}};Dialer[_0xf08a('0x1b')]['syncAgentConnect']=function(_0x722335){if(this[_0xf08a('0x20')][_0x722335['queue']]){if(this[_0xf08a('0x27')][_0x722335[_0xf08a('0xd6')]]&&this['uniqueId'][_0x722335['uniqueid']]['type']!==_0xf08a('0x7a')){this[_0xf08a('0xb2')](this['voiceQueues'][_0x722335[_0xf08a('0xb0')]]);this[_0xf08a('0x27')][_0x722335[_0xf08a('0xd6')]][_0xf08a('0x109')]=moment()['format'](_0xf08a('0xf2'));}}};Dialer['prototype'][_0xf08a('0x10a')]=function(_0xdfd2ca){this['createHistory'](_0xdfd2ca)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xf08a('0xc3')](_0xdfd2ca)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x10b')));};Dialer[_0xf08a('0x1b')][_0xf08a('0x10c')]=function(_0x209716){var _0x477e8c=this[_0xf08a('0x27')][_0x209716[_0xf08a('0xd6')]];var _0x57bfd6=this;if(this[_0xf08a('0x20')][_0x209716['queue']]){if(_0x477e8c&&_0x477e8c[_0xf08a('0x4b')]!=='ivr'){delete this[_0xf08a('0x27')][_0x209716[_0xf08a('0xd6')]];this[_0xf08a('0xb2')](this['voiceQueues'][_0x209716[_0xf08a('0xb0')]]);_0x477e8c[_0xf08a('0x10d')]=moment()[_0xf08a('0x79')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4b788a=new QueueCallerAbandon(_0x477e8c,_0x209716);if(getSeconds(_0x477e8c[_0xf08a('0x10d')],_0x477e8c[_0xf08a('0x10e')])>=_0x477e8c[_0xf08a('0x10f')]){this['voiceQueues'][_0x209716['queue']][_0xf08a('0x6a')]+=0x1;this['voiceQueues'][_0x209716[_0xf08a('0xb0')]][_0xf08a('0x62')]+=0x1;this[_0xf08a('0x20')][_0x209716[_0xf08a('0xb0')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4b788a[_0xf08a('0xa5')]=0xa;_0x4b788a[_0xf08a('0xa6')]=_0xf08a('0x110');_0x4b788a['dropreason']=_0xf08a('0x111');_0x4b788a[_0xf08a('0x104')]=this['voiceQueues'][_0x209716['queue']][_0xf08a('0x105')]?moment()[_0xf08a('0x79')](_0xf08a('0xf2')):undefined;_0x4b788a[_0xf08a('0xe7')]+=0x1;_0x4b788a[_0xf08a('0xe2')]+=0x1;if(_0x4b788a[_0xf08a('0xe7')]>=this[_0xf08a('0x20')][_0x209716['queue']][_0xf08a('0x112')]){this[_0xf08a('0x10a')](_0x4b788a);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x4b788a['countdropretry'],'scheduledat':moment()['add'](this[_0xf08a('0x20')][_0x209716[_0xf08a('0xb0')]][_0xf08a('0x113')],_0xf08a('0xf1'))[_0xf08a('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x477e8c[_0xf08a('0xcc')],'ListId':_0x477e8c[_0xf08a('0xcd')],'VoiceQueueId':_0x477e8c[_0xf08a('0xf3')]||undefined,'CampaignId':_0x477e8c[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x114')));var _0x3fdc52=new History(_0x4b788a);_0x3fdc52[_0xf08a('0xa5')]=0xa;_0x3fdc52['statedesc']=_0xf08a('0x110');_0x3fdc52[_0xf08a('0x115')]=moment()[_0xf08a('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x3fdc52[_0xf08a('0x116')]=_0x3fdc52['starttime'];_0x3fdc52[_0xf08a('0x117')]=_0x4b788a[_0xf08a('0x117')];_0x3fdc52['calleridnum']=_0x4b788a[_0xf08a('0x118')];this[_0xf08a('0xc5')](_0x3fdc52)[_0xf08a('0xae')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xf08a('0x20')][_0x209716[_0xf08a('0xb0')]][_0xf08a('0x69')]+=0x1;this[_0xf08a('0x20')][_0x209716[_0xf08a('0xb0')]][_0xf08a('0x61')]+=0x1;_0x4b788a[_0xf08a('0xa5')]=0xb;_0x4b788a[_0xf08a('0xa6')]=_0xf08a('0x119');_0x4b788a[_0xf08a('0x11a')]='CALLEREXIT';_0x4b788a[_0xf08a('0xe8')]+=0x1;_0x4b788a[_0xf08a('0xe2')]+=0x1;if(_0x4b788a[_0xf08a('0xe8')]>=this[_0xf08a('0x20')][_0x209716[_0xf08a('0xb0')]]['dialAbandonedMaxRetry']){this[_0xf08a('0x10a')](_0x4b788a);}else{this[_0xf08a('0xbb')]({'active':![],'countabandonedretry':_0x4b788a[_0xf08a('0xe8')],'scheduledat':moment()['add'](this[_0xf08a('0x20')][_0x209716[_0xf08a('0xb0')]][_0xf08a('0x11b')],'minutes')[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x477e8c[_0xf08a('0xcc')],'ListId':_0x477e8c[_0xf08a('0xcd')],'VoiceQueueId':_0x477e8c[_0xf08a('0xf3')]||undefined,'CampaignId':_0x477e8c[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x11c')));var _0x3fdc52=new History(_0x4b788a);_0x3fdc52['state']=0xb;_0x3fdc52[_0xf08a('0xa6')]='Abandoned';_0x3fdc52[_0xf08a('0x115')]=moment()[_0xf08a('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x3fdc52[_0xf08a('0x116')]=_0x3fdc52[_0xf08a('0x115')];_0x3fdc52[_0xf08a('0x117')]=_0x4b788a[_0xf08a('0x117')];_0x3fdc52[_0xf08a('0x118')]=_0x4b788a[_0xf08a('0x118')];this[_0xf08a('0xc5')](_0x3fdc52)[_0xf08a('0xae')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0xf08a('0x1b')][_0xf08a('0x35')]=function(_0x223ac6){if(this['actions'][_0x223ac6[_0xf08a('0xd6')]]){this['actions'][_0x223ac6['uniqueid']][_0xf08a('0xad')]=_0x223ac6[_0xf08a('0xad')];}if(this[_0xf08a('0x27')][_0x223ac6[_0xf08a('0xd6')]]){this[_0xf08a('0x27')][_0x223ac6[_0xf08a('0xd6')]][_0xf08a('0xad')]=_0x223ac6[_0xf08a('0xad')];}};Dialer[_0xf08a('0x1b')][_0xf08a('0x38')]=function(_0x34b1b8){if(strategy[this[_0xf08a('0x20')][this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]['queue']]['strategy']]==='roundrobin'){if(this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]&&_[_0xf08a('0xab')](this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]][_0xf08a('0x11f')])&&_0x34b1b8['status']==='1'&&_0x34b1b8[_0xf08a('0x120')]==='0'){if(this['agents'][_0x34b1b8[_0xf08a('0x121')]]){if(!this[_0xf08a('0x22')][_0x34b1b8[_0xf08a('0x121')]][_0xf08a('0x11f')]){this[_0xf08a('0x22')][_0x34b1b8[_0xf08a('0x121')]][_0xf08a('0x11f')]=!![];this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]['locked']=!![];this['actions'][_0x34b1b8[_0xf08a('0x11e')]][_0xf08a('0x121')]=_0x34b1b8[_0xf08a('0x121')];}}}}else if((strategy[this[_0xf08a('0x20')][this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]['queue']][_0xf08a('0x122')]]||'rrmemory')==='rrmemory'){if(this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]){if(this[_0xf08a('0x22')][_0x34b1b8[_0xf08a('0x121')]]){this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]['stateinterface']=_0x34b1b8[_0xf08a('0x121')];if(_['isNil'](this[_0xf08a('0x2b')][this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]['queue']])){this[_0xf08a('0x2b')][this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]['queue']]=[];}this['queueBooked'][this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]][_0xf08a('0xb0')]][_0xf08a('0x123')](_[_0xf08a('0x8c')](_[_0xf08a('0xcb')](this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]],[_0xf08a('0x124'),_0xf08a('0x121')]),{'status':_0x34b1b8[_0xf08a('0xac')],'paused':_0x34b1b8[_0xf08a('0x120')]}));}}}};function unlockQueueStatus(_0x5254e0,_0x51d4bd){setTimeout(function(){if(_[_0xf08a('0x3c')](_0x5254e0[_0xf08a('0x125')])){loggerBooked[_0xf08a('0x93')]('[unlockQueueStatus][undefined]',_0x51d4bd);}_0x5254e0[_0xf08a('0x125')]=!![];loggerBooked[_0xf08a('0x7c')](_0xf08a('0x126'),_0x51d4bd,JSON[_0xf08a('0x46')](_[_0xf08a('0xcb')](_0x5254e0,[_0xf08a('0x3d'),_0xf08a('0x125')])));},0x1f3);}Dialer['prototype'][_0xf08a('0x3a')]=function(_0xdfc99){var _0x434c91=this;var _0x22f823=_0x434c91[_0xf08a('0x20')][_0x434c91[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xb0')]];if(strategy[this[_0xf08a('0x20')][this['actions'][_0xdfc99['actionid']][_0xf08a('0xb0')]][_0xf08a('0x122')]]===_0xf08a('0x1a')){if(this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]]&&this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0x121')]){this[_0xf08a('0x1f')]['run'](this['actions'][_0xdfc99[_0xf08a('0x11e')]]['idHopper'],this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0x121')])[_0xf08a('0xae')](function(_0xf73b23){logger[_0xf08a('0x93')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0xf73b23,{'showHidden':![],'depth':null}));})['finally'](function(){_0x434c91[_0xf08a('0xb2')](_0x434c91[_0xf08a('0x20')][_0x434c91['actions'][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xb0')]]);_0x434c91[_0xf08a('0x22')][_0x434c91[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0x121')]]['locked']=![];delete _0x434c91[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]];unlockQueueStatus(_0x22f823);});}else{this[_0xf08a('0xb2')](this['voiceQueues'][this['actions'][_0xdfc99['actionid']]['queue']]);this[_0xf08a('0xbb')]({'active':![],'ContactId':this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]]['ContactId'],'ListId':this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xcd')],'VoiceQueueId':this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x127')));delete this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]];unlockQueueStatus(_0x22f823);}}else if((strategy[this[_0xf08a('0x20')][this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xb0')]][_0xf08a('0x122')]]||_0xf08a('0x19'))===_0xf08a('0x19')){var _0x453209;if(this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]]&&!_['isEmpty'](this['queueBooked'][this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xb0')]])){if(this[_0xf08a('0x2c')][_0x434c91['actions'][_0xdfc99['actionid']]['queue']]){this[_0xf08a('0x2c')][_0x434c91['actions'][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xb0')]]=this[_0xf08a('0x2c')][this[_0xf08a('0x11d')][_0xdfc99['actionid']][_0xf08a('0xb0')]]?this[_0xf08a('0x2c')][this['actions'][_0xdfc99['actionid']][_0xf08a('0xb0')]]:this[_0xf08a('0x2b')][this[_0xf08a('0x11d')][_0xdfc99['actionid']][_0xf08a('0xb0')]]?this[_0xf08a('0x2b')][this['actions'][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xb0')]][_0xf08a('0x128')]||0x0:0x0;}this['queueBooked'][this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]]['queue']][_0xf08a('0x128')]=this[_0xf08a('0x2c')][this[_0xf08a('0x11d')][_0xdfc99['actionid']]['queue']];for(var _0x5a7d66=0x0;_0x5a7d66=0x0;})[_0xf08a('0xae')](myreject(_0x483d28)));}}else{_0x3e9eca[_0xf08a('0x123')](ami['Action']({'action':_0xf08a('0x148'),'command':util[_0xf08a('0x79')]('iftime\x20%s,%s',_0x214cd8,!_['isUndefined'](config[_0xf08a('0x144')][_0x2948a2])?_0x2948a2:'')})[_0xf08a('0xb6')](function(_0x3d61b3){return _0x3d61b3[_0xf08a('0x145')]['indexOf'](_0xf08a('0x147'))>=0x0;})[_0xf08a('0xae')](myreject(_0x483d28)));}BPromise[_0xf08a('0x149')](_0x3e9eca)['then'](function(_0x155f35){var _0x5e7487=_[_0xf08a('0x14a')](_0x155f35);if(_0x5e7487){return _0x20c503(_0x5e7487);}else{_0x2023f7[_0xf08a('0x3e')]=_0x203f0c?'GLOBAL_INTERVAL_IS_OVERTIME':_0xf08a('0x14b');return _0x483d28(msgResponse(_0xf08a('0x14c'),_0xf08a('0x13d'),_0xf08a('0x14d')+_0x203f0c+'\x20'+_0x361855+_0xf08a('0x14e')+util[_0xf08a('0x94')](_0x214cd8,{'showHidden':![],'depth':null})+_0xf08a('0x14f')+_0x2948a2));}})[_0xf08a('0xae')](function(_0x5672d1){return _0x483d28(msgResponse(_0xf08a('0x13b'),_0xf08a('0x13d'),JSON['stringify'](_0x5672d1)));});});};Dialer[_0xf08a('0x1b')]['checkDialMethod']=function(_0x3326c5){var _0xfba845=this;return function(){switch(_0x3326c5['dialMethod']){case'progressive':freeVariablesPredictive(_0x3326c5);_0xfba845[_0xf08a('0x150')](_0x3326c5,0x1);break;case _0xf08a('0x151'):freeVariablesPredictive(_0x3326c5);_0xfba845['handlePower'](_0x3326c5,_0x3326c5[_0xf08a('0x152')]);break;case _0xf08a('0x9'):_0xfba845[_0xf08a('0x9')](_0x3326c5);break;case _0xf08a('0x8'):freeVariablesPredictive(_0x3326c5);_0xfba845[_0xf08a('0x150')](_0x3326c5,0x1);break;default:freeVariablesPredictive(_0x3326c5);logger[_0xf08a('0x93')](_0xf08a('0x153'),_0x3326c5['name'],_0xf08a('0x154'));}};};Dialer[_0xf08a('0x1b')][_0xf08a('0x155')]=function(_0x7f0952){var _0x41d6da=this;return function(){_0x41d6da[_0xf08a('0x156')](_0x7f0952);};};Dialer['prototype'][_0xf08a('0xa')]=function(_0x129cd8){var _0x556231=this;if(isNotPreview(_0x129cd8[_0xf08a('0x5a')])){if(isVoiceQueueOutbound(_0x129cd8[_0xf08a('0x4b')])&&isActive(_0x129cd8[_0xf08a('0x59')])){_0x129cd8['sendMessageOneNotActive']=!![];BPromise[_0xf08a('0xb5')]()[_0xf08a('0xb6')](checkIsLoggedIn(_0x129cd8,_0x129cd8[_0xf08a('0x4f')]))['then'](checkIsActive(_0x129cd8,_0x129cd8['dialActive']))[_0xf08a('0xb6')](checkInterval(_0x129cd8))[_0xf08a('0xb6')](_0x556231['checkIsTrunkReachable'](_0x129cd8))[_0xf08a('0xb6')](_0x556231['checkIfTime'](_0x129cd8[_0xf08a('0x157')],_0x129cd8[_0xf08a('0x158')],_0x129cd8['name'],_0x129cd8))[_0xf08a('0xb6')](_0x556231[_0xf08a('0x13c')](_0x129cd8[_0xf08a('0x40')],_0x129cd8[_0xf08a('0x158')],_0x129cd8['name'],_0x129cd8))[_0xf08a('0xb6')](_0x556231[_0xf08a('0x159')](_0x129cd8))['catch'](loggerCatchQueueSummary(_0xf08a('0x15a'),_0x129cd8));}else{notSendMessagesQueue(_0x129cd8);}}else{freeVariablesPredictive(_0x129cd8);}};Dialer[_0xf08a('0x1b')][_0xf08a('0x136')]=function(){var _0x5c1f27=this;var _0x20f425;for(var _0x5a77e0 in this[_0xf08a('0x21')]){if(typeof this['campaigns'][_0x5a77e0]!==_0xf08a('0x97')){_0x20f425=this[_0xf08a('0x21')][_0x5a77e0];if(isCampaignIvr(_0x20f425['type'])&&isActive(_0x20f425[_0xf08a('0x78')])){_0x20f425['sendMessageOneNotActive']=!![];BPromise[_0xf08a('0xb5')]()[_0xf08a('0xb6')](checkIsActive(_0x20f425,_0x20f425[_0xf08a('0x78')]))[_0xf08a('0xb6')](checkInterval(_0x20f425))[_0xf08a('0xb6')](_0x5c1f27[_0xf08a('0x137')](_0x20f425))[_0xf08a('0xb6')](_0x5c1f27[_0xf08a('0x15b')](_0x20f425[_0xf08a('0x157')],_0x20f425[_0xf08a('0x158')],_0x20f425[_0xf08a('0x3d')],_0x20f425))[_0xf08a('0xb6')](_0x5c1f27['checkIfTimeIntervals'](_0x20f425[_0xf08a('0x40')],_0x20f425[_0xf08a('0x158')],_0x20f425[_0xf08a('0x3d')],_0x20f425))[_0xf08a('0xb6')](_0x5c1f27[_0xf08a('0x155')](_0x20f425))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x20f425));}else{notSendMessagesCampaign(_0x20f425);}}}};function getCallerIdRandom(_0x4e6dd5,_0x3aac11){var _0x206018;var _0xce1136;var _0x3be4bd;if(_0x3aac11<=0x0){_0x3aac11=0x1;}_0x206018=new RegExp(_0xf08a('0x15c')+_0x3aac11+'}$');_0xce1136=Math[_0xf08a('0x15d')](0xa,_0x3aac11-0x1);_0x3be4bd=Math['pow'](0xa,_0x3aac11)-0x1;return util[_0xf08a('0x79')]('%s',_[_0xf08a('0x15e')](_0x4e6dd5,_0x206018,_[_0xf08a('0x15f')](_0xce1136,_0x3be4bd)));}function extractCalleridName(_0x4fc400){var _0x3cab0c=_0x4fc400['match'](/"(.*?)"/);return _0x3cab0c?_0x3cab0c[0x1]:_0x4fc400;}function extractCalleridNumber(_0x44ec57){var _0x415ca8=_0x44ec57[_0xf08a('0x160')](/<(.*?)>/);return _0x415ca8?_0x415ca8[0x1]:_0x44ec57;}Dialer['prototype'][_0xf08a('0x161')]=function(_0x44d69a,_0x3da716){var _0xc5f6d6=this;var _0x2f1b1c=uuid['v4']();this['actions'][_0x2f1b1c]=new Action(_0x44d69a,_0x3da716,_0x2f1b1c);return new BPromise(function(_0xbe122,_0x52edd2){if(_[_0xf08a('0x3c')](_0x44d69a)&&typeof _0x44d69a!==_0xf08a('0x162')){return _0x52edd2(msgResponse(_0xf08a('0x163'),_0xf08a('0x13d'),_0xf08a('0x164')));}if(_[_0xf08a('0x3c')](_0x3da716[_0xf08a('0x165')][_0xf08a('0x166')])||_0x3da716['Contact'][_0xf08a('0x166')]===null){return _0x52edd2(msgResponse(_0xf08a('0x163'),_0xf08a('0x13d'),'contact\x20is\x20undefine'));}var _0x36c7c7={'XMD-CALLERID':_0xc5f6d6[_0xf08a('0x11d')][_0x2f1b1c][_0xf08a('0x167')](),'XMD-AGI':_0x44d69a[_0xf08a('0xfe')]?util[_0xf08a('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x44d69a[_0xf08a('0xfe')]):_0xf08a('0x168'),'XMD-AGIAFTER':_0x44d69a['dialQueueProject2']?util['format'](_0xf08a('0x169'),ipAgi,_0x44d69a[_0xf08a('0x105')]):'NONE','XMD-QUEUE':_0x44d69a['type']===_0xf08a('0x4c')?util[_0xf08a('0x79')](_0xf08a('0x16a'),_0x44d69a[_0xf08a('0x3d')],_0x44d69a[_0xf08a('0x16b')]||'',_0x44d69a[_0xf08a('0x106')]?'c':'',_0x44d69a[_0xf08a('0x10f')]||0x3):'NONE','XMD-CONTACTID':_0x3da716[_0xf08a('0xcc')],'XMD-CDRTYPE':_0xf08a('0x16c'),'CALLERID(all)':_0xc5f6d6[_0xf08a('0x11d')][_0x2f1b1c][_0xf08a('0x167')](),'XMD-AMD':_0x44d69a[_0xf08a('0xda')]?'ACTIVE':_0xf08a('0x168'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x44d69a[_0xf08a('0xda')]){_0x36c7c7[_0xf08a('0x16d')]=_0x44d69a[_0xf08a('0x16e')]||0x9c4;_0x36c7c7[_0xf08a('0x16f')]=_0x44d69a[_0xf08a('0x170')]||0x5dc;_0x36c7c7['XMD-AMDAFTERGREETINGSILENCE']=_0x44d69a[_0xf08a('0x171')]||0x320;_0x36c7c7[_0xf08a('0x172')]=_0x44d69a[_0xf08a('0x173')]||0x1388;_0x36c7c7[_0xf08a('0x174')]=_0x44d69a[_0xf08a('0x175')]||0x64;_0x36c7c7[_0xf08a('0x176')]=_0x44d69a[_0xf08a('0x177')]||0x32;_0x36c7c7[_0xf08a('0x178')]=_0x44d69a['dialAMDMaximumNumberOfWords']||0x3;_0x36c7c7[_0xf08a('0x179')]=_0x44d69a[_0xf08a('0x17a')]||0x100;_0x36c7c7['XMD-AMDMAXIMUMWORDLENGTH']=_0x44d69a[_0xf08a('0x17b')]||0x1388;}if(_0x44d69a['type']===_0xf08a('0x4c')){_0x36c7c7[_0xf08a('0x17c')]=_0x3da716[_0xf08a('0xf3')];}else{_0x36c7c7[_0xf08a('0x17d')]=_0x3da716[_0xf08a('0xcf')];}for(var _0x47381a in _0x3da716[_0xf08a('0x165')]){if(typeof _0x3da716['Contact'][_0x47381a]!==_0xf08a('0x97')){if(isNotNull(_0x3da716[_0xf08a('0x165')][_0x47381a])&&_0x47381a!=='id'&&_0x47381a!==_0xf08a('0x17e')&&_0x47381a!=='createdAt'&&_0x47381a!==_0xf08a('0x17f')){_0x36c7c7[util[_0xf08a('0x79')](_0xf08a('0x180'),_0xf08a('0x181'),_['toUpper'](_0x47381a))]=_0x3da716['Contact'][_0x47381a];}}}var _0x2dab29=_0xc5f6d6['isTrunkReachable'](_0x44d69a['Trunk'])?getCallerId(_0x44d69a[_0xf08a('0x77')]['callerid'],_0x44d69a[_0xf08a('0x5b')],_0x44d69a[_0xf08a('0x182')]>0x0?getCallerIdRandom(_0x44d69a[_0xf08a('0x183')],_0x44d69a[_0xf08a('0x182')]):_0x44d69a['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x44d69a[_0xf08a('0x184')])?_0x44d69a[_0xf08a('0x77')]['callerid']:_0x44d69a['TrunkBackup']['callerid'],_0x44d69a['dialOriginateCallerIdName'],_0x44d69a[_0xf08a('0x182')]>0x0?getCallerIdRandom(_0x44d69a[_0xf08a('0x183')],_0x44d69a[_0xf08a('0x182')]):_0x44d69a[_0xf08a('0x183')]);if(_0x2dab29){_0x36c7c7[_0xf08a('0x185')]=_0xc5f6d6['actions'][_0x2f1b1c][_0xf08a('0x186')]=extractCalleridName(_0x2dab29);_0x36c7c7[_0xf08a('0x187')]=_0xc5f6d6['actions'][_0x2f1b1c][_0xf08a('0x188')]=extractCalleridNumber(_0x2dab29);}return ami['Action']({'actionid':_0x2f1b1c,'action':_0xf08a('0x163'),'channel':_0xc5f6d6[_0xf08a('0x138')](_0x44d69a[_0xf08a('0x77')])?util['format'](_0xf08a('0x189'),_0x44d69a[_0xf08a('0x77')][_0xf08a('0x3d')],isNotNull(_0x44d69a[_0xf08a('0x18a')])?_0x44d69a[_0xf08a('0x18a')][_0xf08a('0x18b')]()||'':'',_0x44d69a['dialCutDigit']>0x0?_0x3da716[_0xf08a('0x165')][_0xf08a('0x166')][_0xf08a('0x18c')](_0x44d69a[_0xf08a('0x18d')]):_0x3da716[_0xf08a('0x165')][_0xf08a('0x166')]):util['format'](_0xf08a('0x189'),_[_0xf08a('0xab')](_0x44d69a[_0xf08a('0x184')])?_0x44d69a[_0xf08a('0x77')]['name']:_0x44d69a['TrunkBackup'][_0xf08a('0x3d')],isNotNull(_0x44d69a[_0xf08a('0x18a')])?_0x44d69a['dialPrefix'][_0xf08a('0x18b')]()||'':'',_0x44d69a['dialCutDigit']>0x0?_0x3da716[_0xf08a('0x165')][_0xf08a('0x166')][_0xf08a('0x18c')](_0x44d69a['dialCutDigit']):_0x3da716[_0xf08a('0x165')][_0xf08a('0x166')]),'callerid':_0x2dab29,'Exten':_0xf08a('0xd9'),'Context':_0xf08a('0x18e'),'Priority':'1','variable':_0x36c7c7,'timeout':(_0x44d69a[_0xf08a('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2f1b1c})[_0xf08a('0xb6')](function(_0x2b9dd2){return _0xbe122(_0x2b9dd2);})[_0xf08a('0xae')](function(_0x700c03){_0x44d69a[_0xf08a('0x64')]+=0x1;var _0x10bf58=new History(_0xc5f6d6[_0xf08a('0x11d')][_0x2f1b1c]);logger[_0xf08a('0x93')](util[_0xf08a('0x79')]('[originateError]:\x20%s',JSON['stringify'](_0x700c03)));_0x10bf58['state']=0xe;_0x10bf58[_0xf08a('0xa6')]=_0xf08a('0x18f');_0x10bf58[_0xf08a('0x115')]=moment()[_0xf08a('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x10bf58[_0xf08a('0x116')]=_0x10bf58[_0xf08a('0x115')];_0xc5f6d6[_0xf08a('0xc5')](_0x10bf58)[_0xf08a('0xae')](loggerCatch('[originate][error]'));_0xc5f6d6[_0xf08a('0xc3')](_0x10bf58)['catch'](loggerCatch(_0xf08a('0x190')))[_0xf08a('0x1e')](function(){delete _0xc5f6d6[_0xf08a('0x11d')][_0x2f1b1c];return _0x52edd2(msgResponse(_0xf08a('0x163'),'Error',_0xf08a('0x191')));});});});};Dialer[_0xf08a('0x1b')][_0xf08a('0x192')]=function(_0x515b73){var _0x3cc279=this['actions'][_0x515b73[_0xf08a('0x11e')]];if(_0x3cc279){delete this['actions'][_0x515b73[_0xf08a('0x11e')]];_0x3cc279[_0xf08a('0x10e')]=moment()[_0xf08a('0x79')]('YYYY-MM-DD\x20HH:mm:ss');var _0x337259=_0x3cc279[_0xf08a('0x4b')]===_0xf08a('0x7a')?this[_0xf08a('0x21')][_0x3cc279[_0xf08a('0xb0')]]:this[_0xf08a('0x20')][_0x3cc279['getQueue']()];if(!this['isSuccess'](_0x515b73[_0xf08a('0x193')])){this[_0xf08a('0xb2')](_0x337259);return this[_0xf08a('0x194')](_0x3cc279,_0x337259,_0x515b73)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x195')));}this['uniqueId'][_0x515b73['uniqueid']]=_0x3cc279;}};Dialer[_0xf08a('0x1b')][_0xf08a('0x196')]=function(_0x5f116b,_0xc549e3,_0x501de9){var _0x592307=new History(_0xc549e3);if(_0x592307[_0xf08a('0xe4')]+_0x592307[_0xf08a('0xe5')]+_0x592307[_0xf08a('0xfa')]+_0x592307[_0xf08a('0xe6')]+_0x592307[_0xf08a('0xe7')]+_0x592307[_0xf08a('0xe8')]+_0x592307[_0xf08a('0xe1')]+_0x592307[_0xf08a('0xe9')]>=_0x501de9[_0xf08a('0xea')]-0x1){return!![];}switch(_0x5f116b){case 0x3:if(_0x592307[_0xf08a('0xfa')]>=_0x501de9[_0xf08a('0x197')]-0x1){return!![];}this[_0xf08a('0xbb')]({'active':![],'countnoanswerretry':_0x592307[_0xf08a('0xfa')]+=0x1,'scheduledat':moment()[_0xf08a('0xef')](_0x501de9[_0xf08a('0x198')],_0xf08a('0xf1'))[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x592307[_0xf08a('0xcc')],'ListId':_0x592307[_0xf08a('0xcd')],'VoiceQueueId':_0x592307['VoiceQueueId']||undefined,'CampaignId':_0x592307['CampaignId']||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x199')));break;case 0x5:if(_0x592307['countbusyretry']>=_0x501de9[_0xf08a('0x19a')]-0x1){return!![];}this[_0xf08a('0xbb')]({'active':![],'countbusyretry':_0x592307[_0xf08a('0xe4')]+=0x1,'scheduledat':moment()['add'](_0x501de9[_0xf08a('0x19b')],_0xf08a('0xf1'))[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x592307[_0xf08a('0xcc')],'ListId':_0x592307['ListId'],'VoiceQueueId':_0x592307['VoiceQueueId']||undefined,'CampaignId':_0x592307[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x19c')));break;case 0x8:if(_0x592307['countcongestionretry']>=_0x501de9[_0xf08a('0x19d')]-0x1){return!![];}this[_0xf08a('0xbb')]({'active':![],'countcongestionretry':_0x592307['countcongestionretry']+=0x1,'scheduledat':moment()[_0xf08a('0xef')](_0x501de9[_0xf08a('0x19e')],_0xf08a('0xf1'))[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x592307[_0xf08a('0xcc')],'ListId':_0x592307[_0xf08a('0xcd')],'VoiceQueueId':_0x592307[_0xf08a('0xf3')]||undefined,'CampaignId':_0x592307[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x19f')));break;case 0x0:if(_0x592307[_0xf08a('0xe6')]>=_0x501de9[_0xf08a('0x1a0')]-0x1){return!![];}else{this[_0xf08a('0xbb')]({'active':![],'countnosuchnumberretry':_0x592307['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x501de9[_0xf08a('0x1a1')],_0xf08a('0xf1'))[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x592307[_0xf08a('0xcc')],'ListId':_0x592307[_0xf08a('0xcd')],'VoiceQueueId':_0x592307[_0xf08a('0xf3')]||undefined,'CampaignId':_0x592307['CampaignId']||undefined})[_0xf08a('0xae')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x592307[_0xf08a('0xe7')]>=_0x501de9[_0xf08a('0x112')]-0x1){return!![];}this[_0xf08a('0xbb')]({'active':![],'countdropretry':_0x592307[_0xf08a('0xe7')]+=0x1,'scheduledat':moment()[_0xf08a('0xef')](_0x501de9[_0xf08a('0x113')],_0xf08a('0xf1'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x592307[_0xf08a('0xcc')],'ListId':_0x592307[_0xf08a('0xcd')],'VoiceQueueId':_0x592307[_0xf08a('0xf3')]||undefined,'CampaignId':_0x592307['CampaignId']||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x114')));break;case 0xb:if(_0x592307[_0xf08a('0xe8')]>=_0x501de9['dialAbandonedMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x592307[_0xf08a('0xe8')]+=0x1,'scheduledat':moment()[_0xf08a('0xef')](_0x501de9['dialAbandonedRetryFrequency'],_0xf08a('0xf1'))[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x592307['ContactId'],'ListId':_0x592307[_0xf08a('0xcd')],'VoiceQueueId':_0x592307['VoiceQueueId']||undefined,'CampaignId':_0x592307[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x11c')));break;case 0x13:if(_0x592307['countmachineretry']>=_0x501de9[_0xf08a('0xed')]-0x1){return!![];}this[_0xf08a('0xbb')]({'active':![],'countmachineretry':_0x592307[_0xf08a('0xe1')]+=0x1,'scheduledat':moment()['add'](_0x501de9['dialMachineRetryFrequency'],'minutes')[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x592307[_0xf08a('0xcc')],'ListId':_0x592307[_0xf08a('0xcd')],'VoiceQueueId':_0x592307[_0xf08a('0xf3')]||undefined,'CampaignId':_0x592307[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x592307[_0xf08a('0xe9')]>=_0x501de9[_0xf08a('0x1a2')]-0x1){return!![];}this[_0xf08a('0xbb')]({'active':![],'countagentrejectretry':_0x592307[_0xf08a('0xe9')]+=0x1,'scheduledat':moment()[_0xf08a('0xef')](_0x501de9[_0xf08a('0x1a3')],_0xf08a('0xf1'))[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x592307['ContactId'],'ListId':_0x592307[_0xf08a('0xcd')],'VoiceQueueId':_0x592307[_0xf08a('0xf3')]||undefined,'CampaignId':_0x592307['CampaignId']||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1a4')));break;default:return!![];}};Dialer[_0xf08a('0x1b')]['callProgressDetecting']=function(_0x1c16a3,_0x1537e5,_0x5899b4){var _0x331c50=this;var _0xa56156=new History(_0x1c16a3);return new BPromise(function(_0x44601e,_0x15e818){if(_[_0xf08a('0x3c')](_0x1537e5)&&typeof _0x1537e5!==_0xf08a('0x162')){return _0x15e818(msgResponse(_0xf08a('0x1a5'),_0xf08a('0x13d'),_0xf08a('0x1a6')));}if(_[_0xf08a('0x3c')](_0x5899b4)&&typeof _0x5899b4!=='object'){return _0x15e818(msgResponse('[callProgressDetecting]','Failure',_0xf08a('0x1a7')));}switch(_0x5899b4[_0xf08a('0x103')]){case'0':_0x1537e5[_0xf08a('0x63')]+=0x1;_0xa56156[_0xf08a('0xa5')]=0x0;_0xa56156[_0xf08a('0xa6')]=_0xf08a('0x1a8');_0xa56156[_0xf08a('0xe6')]+=0x1;_0xa56156[_0xf08a('0xe2')]+=0x1;ami[_0xf08a('0x4a')](_0xf08a('0x1a9'),ut[_0xf08a('0x1aa')](_0x1c16a3,_0xf08a('0x1ab')));_0x331c50[_0xf08a('0xc5')](_0xa56156)[_0xf08a('0xae')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x331c50[_0xf08a('0x196')](0x0,_0x1c16a3,_0x1537e5)){if(_0xa56156[_0xf08a('0xe6')]>=_0x1537e5[_0xf08a('0x1a0')]){_0x331c50['createStateFinal'](_0xa56156,_0x44601e,_0x15e818,'reason\x200\x20no\x20such\x20number....');}else{_0x331c50[_0xf08a('0xeb')](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1ac'));}}break;case'3':_0x1537e5[_0xf08a('0x1ad')]+=0x1;_0xa56156['state']=0x3;_0xa56156['statedesc']=_0xf08a('0x1ae');_0xa56156[_0xf08a('0xfa')]+=0x1;_0xa56156[_0xf08a('0xe2')]+=0x1;ami[_0xf08a('0x4a')](_0xf08a('0x1af'),ut[_0xf08a('0x1aa')](_0x1c16a3,_0xf08a('0x1b0')));_0x331c50[_0xf08a('0xc5')](_0xa56156)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1b1')));if(_0x331c50[_0xf08a('0x196')](0x3,_0x1c16a3,_0x1537e5)){if(_0xa56156['countnoanswerretry']>=_0x1537e5[_0xf08a('0x197')]){_0x331c50[_0xf08a('0xfb')](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1b2'));}else{_0x331c50[_0xf08a('0xeb')](_0xa56156,_0x44601e,_0x15e818,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x1537e5[_0xf08a('0x5f')]+=0x1;_0xa56156[_0xf08a('0xa5')]=0x5;_0xa56156[_0xf08a('0xa6')]=_0xf08a('0x1b3');_0xa56156[_0xf08a('0xe4')]+=0x1;_0xa56156[_0xf08a('0xe2')]+=0x1;ami[_0xf08a('0x4a')](_0xf08a('0x1b4'),ut[_0xf08a('0x1aa')](_0x1c16a3,_0xf08a('0x1b5')));_0x331c50[_0xf08a('0xc5')](_0xa56156)['catch'](loggerCatch(_0xf08a('0x1b6')));if(_0x331c50['checkRetriveMax'](0x5,_0x1c16a3,_0x1537e5)){if(_0xa56156[_0xf08a('0xe4')]>=_0x1537e5[_0xf08a('0x19a')]){_0x331c50[_0xf08a('0xfb')](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1b7'));}else{_0x331c50['stateGlobal'](_0xa56156,_0x44601e,_0x15e818,'reason\x205\x20busy');}}break;case'8':_0x1537e5[_0xf08a('0x1b8')]+=0x1;_0xa56156['state']=0x8;_0xa56156['statedesc']=_0xf08a('0x1b9');_0xa56156[_0xf08a('0xe5')]+=0x1;_0xa56156[_0xf08a('0xe2')]+=0x1;ami[_0xf08a('0x4a')](_0xf08a('0x1ba'),ut[_0xf08a('0x1aa')](_0x1c16a3,_0xf08a('0x1bb')));_0x331c50[_0xf08a('0xc5')](_0xa56156)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1bc')));if(_0x331c50[_0xf08a('0x196')](0x8,_0x1c16a3,_0x1537e5)){if(_0xa56156[_0xf08a('0xe5')]>=_0x1537e5[_0xf08a('0x19d')]){_0x331c50[_0xf08a('0xfb')](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1bd'));}else{_0x331c50[_0xf08a('0xeb')](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1bd'));}}break;case'11':_0x1537e5['outboundAbandonedCallsDay']+=0x1;_0xa56156[_0xf08a('0xa5')]=0xb;_0xa56156[_0xf08a('0xa6')]=_0xf08a('0x119');_0xa56156[_0xf08a('0xe8')]+=0x1;_0xa56156[_0xf08a('0xe2')]+=0x1;_0x331c50['createHistory'](_0xa56156)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1be')));if(_0x331c50[_0xf08a('0x196')](0xb,_0x1c16a3,_0x1537e5)){if(_0xa56156[_0xf08a('0xe8')]>=_0x1537e5[_0xf08a('0x1bf')]){_0x331c50[_0xf08a('0xfb')](_0xa56156,_0x44601e,_0x15e818,'reason\x2011\x20abandoned');}else{_0x331c50[_0xf08a('0xeb')](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1c0'));}}break;case'20':_0x1537e5[_0xf08a('0x66')]+=0x1;_0xa56156['state']=0x14;_0xa56156[_0xf08a('0xa6')]='AgentReject';_0xa56156[_0xf08a('0xe9')]+=0x1;_0xa56156[_0xf08a('0xe2')]+=0x1;ami[_0xf08a('0x4a')](_0xf08a('0x1c1'),ut[_0xf08a('0x1aa')](_0x1c16a3,_0xf08a('0x1c2')));_0x331c50[_0xf08a('0xc5')](_0xa56156)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1c3')));if(_0x331c50[_0xf08a('0x196')](0x14,_0x1c16a3,_0x1537e5)){if(_0xa56156[_0xf08a('0xe9')]>=_0x1537e5[_0xf08a('0x1a2')]){_0x331c50[_0xf08a('0xfb')](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1c4'));}else{_0x331c50['stateGlobal'](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1c4'));}}break;default:_0x1537e5[_0xf08a('0x67')]+=0x1;_0xa56156[_0xf08a('0xa5')]=0xc;_0xa56156[_0xf08a('0xa6')]=_0x5899b4['reason'];_0x331c50[_0xf08a('0xc5')](_0xa56156)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1c5')));if(_0x331c50[_0xf08a('0x196')](_0x5899b4[_0xf08a('0x103')],_0x1c16a3,_0x1537e5)){if(_0xa56156['countbusyretry']+_0xa56156[_0xf08a('0xe5')]+_0xa56156[_0xf08a('0xfa')]+_0xa56156[_0xf08a('0xe6')]+_0xa56156['countdropretry']+_0xa56156[_0xf08a('0xe8')]+_0xa56156[_0xf08a('0xe1')]+_0xa56156[_0xf08a('0xe9')]>=_0x1537e5[_0xf08a('0xea')]){_0x331c50[_0xf08a('0xeb')](_0xa56156,_0x44601e,_0x15e818,_0x5899b4[_0xf08a('0x103')]);}else{_0x331c50[_0xf08a('0xfb')](_0xa56156,_0x44601e,_0x15e818,_0x5899b4['reason']);}}}});};Dialer[_0xf08a('0x1b')][_0xf08a('0xeb')]=function(_0x18f3e4,_0x2e731e,_0x8c6cd2,_0x393de5){var _0x4a401c=new Final(_0x18f3e4);_0x4a401c[_0xf08a('0xa5')]=0xf;_0x4a401c[_0xf08a('0xa6')]=_0xf08a('0x1c6');this[_0xf08a('0xfb')](_0x4a401c,_0x2e731e,_0x8c6cd2,_0x393de5);};Dialer[_0xf08a('0x1b')][_0xf08a('0xfb')]=function(_0x336bc6,_0x4fab0f,_0x3f7765,_0xb9f769){this['moveContactManagedDialer'](_0x336bc6)[_0xf08a('0xb6')](function(){return _0x4fab0f(msgResponse(_0xf08a('0x1a5'),'Success',_0xb9f769));})[_0xf08a('0xae')](function(){return _0x3f7765(msgResponse(_0xf08a('0x1c7'),_0xf08a('0x13d'),_0xf08a('0x1c8')));});};Dialer[_0xf08a('0x1b')][_0xf08a('0x9')]=function(_0x470e59){var _0x258b46=_0x470e59[_0xf08a('0x1c9')]/0x64;var _0x5f1743=_0x470e59[_0xf08a('0x62')]/(_0x470e59[_0xf08a('0x62')]+_0x470e59[_0xf08a('0xdc')]);var _0x2c3b90=Math[_0xf08a('0x1ca')](_0x470e59[_0xf08a('0x70')]*(_0x470e59[_0xf08a('0x1cb')]/0x64));var _0x45db29=Math['round'](_0x470e59[_0xf08a('0x70')]*(_0x470e59['predictiveIntervalMinThreshold']/0x64));var _0x3ecbf9=_0x470e59[_0xf08a('0x4e')]+_0x470e59[_0xf08a('0x54')];var _0x1ad705=Math[_0xf08a('0x1cc')](_0x470e59['erlangCalls']*_0x470e59['erlangAbandonmentRate']*_0x470e59[_0xf08a('0x6d')]*_0x470e59[_0xf08a('0x6e')]);if(_[_0xf08a('0x3c')](_0x470e59[_0xf08a('0x76')])){if(!_[_0xf08a('0x3c')](_0x470e59['startPredictive'])){_0x470e59[_0xf08a('0x29')]=undefined;loggerPredictive[_0xf08a('0x93')](_0xf08a('0x1cd'),_0xf08a('0x1ce'));}if(!_[_0xf08a('0x3c')](_0x470e59['handlePredictive'])){loggerPredictive[_0xf08a('0x93')](_0xf08a('0x1cd'),_0xf08a('0x1cf'));clearInterval(_0x470e59['handlePredictive']);_0x470e59[_0xf08a('0x8e')]=undefined;}_0x470e59[_0xf08a('0x76')]=moment()[_0xf08a('0x79')](_0xf08a('0xf2'));loggerPredictive[_0xf08a('0x7c')](_0x470e59[_0xf08a('0x3d')],_0xf08a('0x1d0'),_0x470e59[_0xf08a('0x76')]);this['handlePower'](_0x470e59,0x1);}else if(ifInterval(_0x470e59[_0xf08a('0x1d1')],_0x470e59[_0xf08a('0x76')])){this[_0xf08a('0x150')](_0x470e59,0x1);loggerPredictiveCalls['info'](_0xf08a('0x1d2'),_0x470e59['startProgressive'],_0x470e59[_0xf08a('0x3d')]);_0x470e59['erlangCalls']=0x0;_0x470e59[_0xf08a('0x6c')]=0x0;}else if(_0x258b46<_0x5f1743&&_0x470e59[_0xf08a('0x1d3')]===_0xf08a('0x1d4')){freeVariablesPredictive(_0x470e59);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x1d5'),_0xf08a('0x1d6'),_0x5f1743,'startProgressive',_0x470e59[_0xf08a('0x3d')]);}else if(_0x1ad705<_0x470e59[_0xf08a('0x6c')]&&_0x470e59[_0xf08a('0x1d3')]===_0xf08a('0x1d4')){freeVariablesPredictive(_0x470e59);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x1d7'),_0xf08a('0x1d8'),_0x1ad705,_0xf08a('0x1d9'),_0x470e59[_0xf08a('0x6c')],_0xf08a('0x76'),_0x470e59[_0xf08a('0x3d')]);}else if(!ifInterval(_0x470e59[_0xf08a('0x1d1')],_0x470e59[_0xf08a('0x76')])&&_[_0xf08a('0x3c')](_0x470e59[_0xf08a('0x29')])&&!_['isUndefined'](_0x470e59[_0xf08a('0x76')])){_0x470e59[_0xf08a('0x29')]=moment()[_0xf08a('0x79')](_0xf08a('0xf2'));loggerPredictive[_0xf08a('0x7c')](_0x470e59['name'],_0xf08a('0x1da'),_0x470e59[_0xf08a('0x29')]);this[_0xf08a('0xba')](_0x470e59[_0xf08a('0x1d1')])[_0xf08a('0xb6')](this['getDataPredictive'](_0x470e59))[_0xf08a('0xb6')](mergeDataErlangB(_0x470e59))[_0xf08a('0xb6')](this[_0xf08a('0x1db')](_0x470e59))[_0xf08a('0xae')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x470e59));}else if(!ifInterval(_0x470e59['dialPredictiveInterval'],_0x470e59[_0xf08a('0x29')])){_0x470e59[_0xf08a('0x6c')]=0x0;_0x470e59['startPredictive']=moment()[_0xf08a('0x79')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xf08a('0x7c')](_0x470e59['name'],_0xf08a('0x1dc'),_0x470e59[_0xf08a('0x29')]);clearInterval(_0x470e59[_0xf08a('0x8e')]);_0x470e59['handlePredictive']=undefined;this[_0xf08a('0xba')](_0x470e59[_0xf08a('0x1d1')])[_0xf08a('0xb6')](this[_0xf08a('0x1dd')](_0x470e59))[_0xf08a('0xb6')](mergeDataErlangB(_0x470e59))[_0xf08a('0xb6')](this['startMethodPredictive'](_0x470e59))[_0xf08a('0xae')](loggerCatchPredictive(_0xf08a('0x1de'),_0x470e59));}else if(_0x470e59[_0xf08a('0x70')]&&_0x3ecbf9<_0x470e59[_0xf08a('0x70')]-_0x45db29){freeVariablesPredictive(_0x470e59);loggerPredictive[_0xf08a('0x7c')](_0x470e59[_0xf08a('0x3d')],_0xf08a('0x1df'),_0x3ecbf9,_0xf08a('0x1e0'),_0x470e59[_0xf08a('0x70')],'-',_0x45db29,'=',_0x470e59['predictiveIntervalAvailable']-_0x45db29,')');}else if(_0x470e59[_0xf08a('0x70')]&&_0x3ecbf9>_0x470e59[_0xf08a('0x70')]+_0x2c3b90){freeVariablesPredictive(_0x470e59);loggerPredictive[_0xf08a('0x7c')](_0x470e59[_0xf08a('0x3d')],_0xf08a('0x1df'),_0x3ecbf9,_0xf08a('0x1e1'),_0x470e59[_0xf08a('0x70')],'+',_0x2c3b90,'=',_0x470e59[_0xf08a('0x70')]+_0x2c3b90,')');}};Dialer['prototype'][_0xf08a('0x1dd')]=function(_0x59502a){var _0x2a56c1=this;return function(_0x3647da){return new BPromise(function(_0x2a72eb,_0x228294){_['merge'](_0x59502a,_0x3647da[0x0]);if(checkGetDataPredictive(_0x3647da[0x0])){var _0x1576ce=_0x59502a[_0xf08a('0x70')]=_0x59502a[_0xf08a('0x54')]+_0x59502a[_0xf08a('0x4e')];var _0x5d9271=_0x59502a[_0xf08a('0x1d1')]*0x3c;var _0x34ceef=_0x3647da[0x0]['predictiveIntervalAvgTalktime']+_0x3647da[0x0]['predictiveIntervalAvgHoldtime'];var _0x59f545=(_0x3647da[0x0][_0xf08a('0x7e')]+_0x3647da[0x0][_0xf08a('0x6a')]+_0x3647da[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3647da[0x0][_0xf08a('0x71')];_0x59502a[_0xf08a('0x6d')]=_0x59f545>0x0?_0x59f545:0x1;switch(_0x59502a[_0xf08a('0x1d3')]){case _0xf08a('0x1d4'):var _0x2d5b88=_0x59502a[_0xf08a('0x1c9')]/0x64;return _0x2a56c1[_0xf08a('0x1e2')](_0x1576ce,_0x5d9271,_0x34ceef,_0x59f545,_0x2d5b88)['then'](function(_0xa125b7){return _0x2a72eb(_0xa125b7);});case _0xf08a('0x1e3'):var _0x360191=_0x59502a[_0xf08a('0x1c9')]/0x64;return _0x2a56c1[_0xf08a('0x1e4')](_0x1576ce,_0x5d9271,_0x34ceef,_0x59f545,_0x360191)[_0xf08a('0xb6')](function(_0xc962e6){return _0x2a72eb(_0xc962e6);});default:return _0x228294(msgResponse(_0xf08a('0x1e5'),_0xf08a('0x13d'),'Unknown\x20Predictive'));}}else{return _0x228294(msgResponse(_0xf08a('0x1e5'),_0xf08a('0x13d'),_0xf08a('0x1e6')));}});};};Dialer[_0xf08a('0x1b')][_0xf08a('0x1e7')]=function(_0x496026){var _0x151359=this;return function(_0x19a7dc){return new BPromise(function(_0x1d4521,_0x163cb1){_[_0xf08a('0x8c')](_0x496026,_0x19a7dc[0x0]);if(checkGetDataPredictive(_0x19a7dc[0x0])){loggerPredictive[_0xf08a('0x7c')](JSON[_0xf08a('0x46')](_0x19a7dc[0x0]));if(_0x496026['dialPredictiveOptimization']===_0xf08a('0x1d4')){return _0x151359[_0xf08a('0xc2')](_0x496026['id'])[_0xf08a('0xb6')](function(_0x470162){var _0x356092=_0x496026[_0xf08a('0x4f')]-_0x470162[0x0][_0xf08a('0x1e8')];var _0x2c49fc=_0x496026[_0xf08a('0x1d1')]*0x3c;var _0x3094aa=_0x19a7dc[0x0]['predictiveIntervalAvgTalktime']+_0x19a7dc[0x0][_0xf08a('0x68')];var _0x3dca7c=(_0x19a7dc[0x0][_0xf08a('0x7e')]+_0x19a7dc[0x0][_0xf08a('0x6a')]+_0x19a7dc[0x0][_0xf08a('0x69')])/_0x19a7dc[0x0][_0xf08a('0x71')];var _0x149685=_0x496026[_0xf08a('0x1c9')]/0x64;_0x496026[_0xf08a('0x6f')]=_0x470162[0x0][_0xf08a('0x1e8')]||0x0;_0x496026[_0xf08a('0x6d')]=_0x3dca7c>0x0?_0x3dca7c:0x1;return _0x151359[_0xf08a('0x1e2')](_0x356092,_0x2c49fc,_0x3094aa,_0x3dca7c,_0x149685);})[_0xf08a('0xb6')](function(_0x351625){return _0x1d4521(_0x351625);})['catch'](function(_0x4a0a8b){return _0x163cb1(msgResponse('[CatchErlangB]',_0xf08a('0x13d'),JSON[_0xf08a('0x46')](_0x4a0a8b)));});}if(_0x496026[_0xf08a('0x1d3')]==='agentBusyFactor'){return _0x151359[_0xf08a('0xc2')](_0x496026['id'])[_0xf08a('0xb6')](function(_0x11ad90){var _0x2cd809=_0x496026[_0xf08a('0x4f')]-_0x11ad90[0x0][_0xf08a('0x1e8')];var _0x523245=_0x496026[_0xf08a('0x1d1')]*0x3c;var _0x47b6cf=_0x19a7dc[0x0][_0xf08a('0x82')]+_0x19a7dc[0x0][_0xf08a('0x68')];var _0x20ea86=(_0x19a7dc[0x0][_0xf08a('0x7e')]+_0x19a7dc[0x0][_0xf08a('0x6a')]+_0x19a7dc[0x0][_0xf08a('0x69')])/_0x19a7dc[0x0][_0xf08a('0x71')];var _0x4fc6fb=_0x496026[_0xf08a('0x1c9')]/0x64;_0x496026[_0xf08a('0x6f')]=_0x11ad90[0x0][_0xf08a('0x1e8')]||0x0;_0x496026[_0xf08a('0x6d')]=_0x20ea86>0x0?_0x20ea86:0x1;return _0x151359[_0xf08a('0x1e4')](_0x2cd809,_0x523245,_0x47b6cf,_0x20ea86,_0x4fc6fb);})['then'](function(_0x36f195){return _0x1d4521(_0x36f195);})[_0xf08a('0xae')](function(_0x44a029){return _0x163cb1(msgResponse(_0xf08a('0x1e9'),_0xf08a('0x13d'),JSON[_0xf08a('0x46')](_0x44a029)));});}}else{return _0x163cb1(msgResponse(_0xf08a('0x1e5'),_0xf08a('0x13d'),_0xf08a('0x1e6')));}});};};Dialer[_0xf08a('0x1b')][_0xf08a('0x1db')]=function(_0xb7e655){var _0x51000a=this;return function(){var _0x7306fa=0x0;var _0x9c5de9=Math[_0xf08a('0x1cc')](_0xb7e655[_0xf08a('0x89')]*0x3e8);if(_0x9c5de9>0x0){_0x9c5de9=_0x9c5de9<0x64?0x64:_0x9c5de9;loggerPredictive[_0xf08a('0x7c')](_0xb7e655[_0xf08a('0x3d')],_0xf08a('0x1ea'),_0x9c5de9,_0xf08a('0x47'));_0xb7e655[_0xf08a('0x8e')]=setInterval(function(){_0x51000a[_0xf08a('0x8e')](_0xb7e655);loggerPredictiveCalls[_0xf08a('0x7c')]('[handlePredictive]',_0x7306fa+=0x1);},_0x9c5de9);}else{loggerPredictive[_0xf08a('0x7c')](_0xb7e655[_0xf08a('0x3d')],_0xf08a('0x1eb'));}};};Dialer[_0xf08a('0x1b')]['checkContactBlack']=function(_0x29f935,_0x4d1058){var _0x2064d1=this;return function(_0x324ae0){if(_[_0xf08a('0x44')](_0x324ae0)){if(_[_0xf08a('0xab')](_0x4d1058[_0xf08a('0xce')])||!_0x4d1058[_0xf08a('0x1ec')]){if(_0x29f935['dialMethod']===_0xf08a('0x8')){_0x29f935['queueStatusComplete']=_[_0xf08a('0x3c')](_0x29f935[_0xf08a('0x125')])?!![]:_0x29f935[_0xf08a('0x125')];var _0x7abb2b=uuid['v4']();_0x2064d1[_0xf08a('0x11d')][_0x7abb2b]=new Action(_0x29f935,_0x4d1058,_0x7abb2b);loggerBooked[_0xf08a('0x7c')](_0xf08a('0x1ed'),_0x7abb2b,_0xf08a('0x1ee'),JSON[_0xf08a('0x46')](_0x29f935[_0xf08a('0x125')]),_0xf08a('0x1ef'),_0x29f935['name']);if(_0x29f935[_0xf08a('0x125')]){_0x29f935['queueStatusComplete']=![];_0x2064d1[_0xf08a('0x2b')][_0x2064d1['actions'][_0x7abb2b][_0xf08a('0xb0')]]=[];ami[_0xf08a('0x141')]({'actionid':_0x7abb2b,'action':_0xf08a('0x1f0'),'queue':_0x29f935[_0xf08a('0x3d')]})['catch'](function(){_0x2064d1[_0xf08a('0xb2')](_0x29f935);_0x2064d1[_0xf08a('0xbb')]({'active':![],'ContactId':_0x2064d1[_0xf08a('0x11d')][_0x7abb2b][_0xf08a('0xcc')],'ListId':_0x2064d1[_0xf08a('0x11d')][_0x7abb2b]['ListId'],'VoiceQueueId':_0x2064d1['actions'][_0x7abb2b][_0xf08a('0xf3')]||undefined,'CampaignId':_0x2064d1[_0xf08a('0x11d')][_0x7abb2b][_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1f1')));delete _0x2064d1['actions'][_0x7abb2b];});}else{loggerBooked[_0xf08a('0x7c')]('[booked][checkContactBlack][else]',JSON[_0xf08a('0x46')](_0x29f935['queueStatusComplete']),_0xf08a('0x1ef'),_0x29f935[_0xf08a('0x3d')]);_0x2064d1[_0xf08a('0xb2')](_0x29f935);_0x2064d1[_0xf08a('0xbb')]({'active':![],'ContactId':_0x2064d1[_0xf08a('0x11d')][_0x7abb2b][_0xf08a('0xcc')],'ListId':_0x2064d1[_0xf08a('0x11d')][_0x7abb2b]['ListId'],'VoiceQueueId':_0x2064d1[_0xf08a('0x11d')][_0x7abb2b][_0xf08a('0xf3')]||undefined,'CampaignId':_0x2064d1['actions'][_0x7abb2b][_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1f1')));delete _0x2064d1[_0xf08a('0x11d')][_0x7abb2b];}}else{return _0x2064d1[_0xf08a('0x161')](_0x29f935,_0x4d1058);}}else{if(getDiff(_0x4d1058[_0xf08a('0x1f2')])<_0x29f935[_0xf08a('0x1f3')]*0x3c){if(_0x4d1058['Agent']&&!_0x4d1058[_0xf08a('0x1f4')]['voicePause']){_0x2064d1['preview']['run'](_0x4d1058['id'])[_0xf08a('0x1e')](function(){_0x2064d1['updateOriginated'](_0x29f935);});}else{_0x2064d1['unlockContact']({'active':![]},_0x4d1058['id'],0x1)['finally'](function(){_0x2064d1['updateOriginated'](_0x29f935);});}}else{_0x29f935[_0xf08a('0x65')]+=0x1;_0x2064d1[_0xf08a('0xb2')](_0x29f935);if(_0x29f935[_0xf08a('0x1f5')]){_0x2064d1['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4d1058[_0xf08a('0xcc')],'ListId':_0x4d1058[_0xf08a('0xcd')],'VoiceQueueId':_0x4d1058[_0xf08a('0xf3')]||undefined,'CampaignId':_0x4d1058[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1f6')));_0x2064d1[_0xf08a('0xc5')](createObjHistory(_0x29f935,_0x4d1058,_0xf08a('0x1f7'),0x17,_0xf08a('0x1f8')))[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1f9')));}else{_0x2064d1['saveInDb'](createObjHistory(_0x29f935,_0x4d1058,_0xf08a('0x1fa'),0x16,_0xf08a('0x1fb')),_0xf08a('0x1fc'),_0xf08a('0x1fd'));}}}}else{_0x29f935[_0xf08a('0x5e')]+=0x1;_0x2064d1[_0xf08a('0xca')](createObjHistory(_0x29f935,_0x4d1058,'BLACKLIST',0xd,'Blacklist'),_0xf08a('0x1fe'),_0xf08a('0x1ff'));throw _0xf08a('0x200');}};};Dialer[_0xf08a('0x1b')][_0xf08a('0x156')]=function(_0x4d46cc){var _0x36c962=this;var _0x3dbec9=_0x4d46cc[_0xf08a('0x201')]-_0x4d46cc[_0xf08a('0x72')]-_0x4d46cc[_0xf08a('0x202')];emitCampaignSummary(_0x4d46cc);if(_0x3dbec9>0x0){if(_0x3dbec9>this[_0xf08a('0x24')]){_0x3dbec9=this[_0xf08a('0x24')];}_0x4d46cc[_0xf08a('0x202')]+=_0x3dbec9;this[_0xf08a('0xc0')](_0x4d46cc['id'],_0x3dbec9,_0x4d46cc[_0xf08a('0x203')])[_0xf08a('0xb6')](function(_0x4c3249){_0x4d46cc[_0xf08a('0x202')]-=_0x3dbec9;_0x4d46cc[_0xf08a('0x202')]=_0x4d46cc[_0xf08a('0x202')]>0x0?_0x4d46cc[_0xf08a('0x202')]:0x0;if(!checkContactEmpty(_0x4c3249)){_0x4d46cc[_0xf08a('0x3e')]=_0xf08a('0x204');logger[_0xf08a('0x7c')](_0xf08a('0x205')+_0x4d46cc[_0xf08a('0x3d')]);}else{_0x4d46cc[_0xf08a('0x72')]+=_0x4c3249['length'];_0x4d46cc[_0xf08a('0x3e')]='RUNNING';for(var _0x1572fd=0x0;_0x1572fd<_0x4c3249[_0xf08a('0x96')];_0x1572fd+=0x1){_0x4d46cc[_0xf08a('0x206')]+=0x1;if(_[_0xf08a('0xab')](_0x4c3249[_0x1572fd])||_['isNil'](_0x4c3249[_0x1572fd][_0xf08a('0x165')])||_['isNil'](_0x4c3249[_0x1572fd]['Contact'][_0xf08a('0x166')])){_0x36c962['emptyContact'](_0xf08a('0x207'),_0x4d46cc,_0x4c3249[_0x1572fd]);}else{_0x36c962[_0xf08a('0xb8')](_['pick'](_0x4c3249[_0x1572fd],[_0xf08a('0xcf'),_0xf08a('0x208')]))[_0xf08a('0xb6')](_0x36c962[_0xf08a('0x209')](_0x4d46cc,_0x4c3249[_0x1572fd]))[_0xf08a('0xae')](_0x36c962['loggerHandler'](_0xf08a('0x20a'),_0x4d46cc));}}}})[_0xf08a('0xae')](loggerGetContactDialer(_0xf08a('0x20b'),_0x4d46cc,_0x3dbec9));}};Dialer[_0xf08a('0x1b')]['handlePower']=function(_0x473802,_0x372eec){var _0x2d78f3=this;var _0x48688e=[];var _0x30c955=_0x372eec>=0x1?_0x372eec:0x1;if(_0x473802[_0xf08a('0x5a')]==='booked'){_0x30c955=0x1;}var _0x25a44e=Math[_0xf08a('0x1cc')](_0x473802['available']*_0x30c955)-_0x473802[_0xf08a('0x72')]-_0x473802[_0xf08a('0x202')];emitVoiceQueueSummary(_0x473802);if(_0x473802[_0xf08a('0x20c')]>0x0){var _0x3ddf53=_0x473802[_0xf08a('0x20c')]-_0x473802[_0xf08a('0x72')]-_0x473802[_0xf08a('0x54')]-_0x473802[_0xf08a('0x202')]-_0x473802['pTalking'];if(_0x25a44e>_0x3ddf53){_0x25a44e=_0x3ddf53;}}if(_0x25a44e>0x0){if(_0x473802[_0xf08a('0x5a')]===_0xf08a('0x8')){_0x25a44e=0x1;}if(_0x25a44e>this[_0xf08a('0x24')]){_0x25a44e=this[_0xf08a('0x24')];}_0x473802['temp']+=_0x25a44e;for(var _0x5278c4 in this[_0xf08a('0x22')]){if(typeof this['agents'][_0x5278c4]!==_0xf08a('0x97')){if(this[_0xf08a('0x22')][_0x5278c4][_0xf08a('0xa5')]===_0xf08a('0x20d')&&this['agents'][_0x5278c4][_0xf08a('0xac')]===_0xf08a('0xd4')){_0x48688e[_0xf08a('0x123')](this[_0xf08a('0x22')][_0x5278c4]['id']);}}}this[_0xf08a('0xbf')](_0x473802['id'],_0x48688e,_0x25a44e,_0x473802[_0xf08a('0x203')])[_0xf08a('0xb6')](function(_0x40d3dc){_0x473802[_0xf08a('0x202')]-=_0x25a44e;_0x473802[_0xf08a('0x202')]=_0x473802[_0xf08a('0x202')]>0x0?_0x473802[_0xf08a('0x202')]:0x0;if(!checkContactEmpty(_0x40d3dc)){_0x2d78f3['countReScheduled'](_0x473802)[_0xf08a('0xb6')](sendMessageReschedule(_0x473802))['catch'](loggerCatch(_0xf08a('0x20e')));}else{_0x473802[_0xf08a('0x72')]+=_0x40d3dc[_0xf08a('0x96')];_0x473802[_0xf08a('0x3e')]=_0x473802[_0xf08a('0x5a')]===_0xf08a('0x8')?_0xf08a('0x20f'):'RUNNING';for(var _0x92c406=0x0;_0x92c406<_0x40d3dc[_0xf08a('0x96')];_0x92c406+=0x1){if(_[_0xf08a('0xab')](_0x40d3dc[_0x92c406])||_['isNil'](_0x40d3dc[_0x92c406][_0xf08a('0x165')])||_['isNil'](_0x40d3dc[_0x92c406][_0xf08a('0x165')][_0xf08a('0x166')])){_0x2d78f3[_0xf08a('0x210')]('[actionOriginate]\x20',_0x473802,_0x40d3dc[_0x92c406]);}else{_0x2d78f3['checkIsBlackList'](_[_0xf08a('0xcb')](_0x40d3dc[_0x92c406],[_0xf08a('0xf3'),_0xf08a('0x208')]))[_0xf08a('0xb6')](_0x2d78f3[_0xf08a('0x209')](_0x473802,_0x40d3dc[_0x92c406]))['catch'](_0x2d78f3[_0xf08a('0xc9')](_0xf08a('0x207'),_0x473802));}}}})['catch'](loggerGetContactDialer(_0xf08a('0x211'),_0x473802,_0x25a44e));}};Dialer[_0xf08a('0x1b')]['handlePredictive']=function(_0x3276a9){if(_0x3276a9[_0xf08a('0x20c')]>0x0){var _0x372832=_0x3276a9['dialLimitQueue']-_0x3276a9['originated']-_0x3276a9[_0xf08a('0x54')];if(_0x372832>0x0){this['tryOriginatePredictive'](_0x3276a9);}else{loggerPredictiveCalls[_0xf08a('0x7c')](_0xf08a('0x212'));}}else{this['tryOriginatePredictive'](_0x3276a9);}};Dialer[_0xf08a('0x1b')][_0xf08a('0x213')]=function(_0x2fb107){var _0x50bf1d=this;var _0x444a3b=[];_0x2fb107[_0xf08a('0x72')]+=0x1;for(var _0x577215 in this[_0xf08a('0x22')]){if(typeof this[_0xf08a('0x22')][_0x577215]!==_0xf08a('0x97')){if(this[_0xf08a('0x22')][_0x577215][_0xf08a('0xa5')]===_0xf08a('0x20d')&&this['agents'][_0x577215][_0xf08a('0xac')]==='reachable'){_0x444a3b['push'](this[_0xf08a('0x22')][_0x577215]['id']);}}}this[_0xf08a('0xbf')](_0x2fb107['id'],_0x444a3b,0x1,_0x2fb107[_0xf08a('0x203')])[_0xf08a('0xb6')](function(_0x2a3c35){if(!checkContactEmpty(_0x2a3c35)){checkContactLowerLimitOriginate(_0x2fb107,0x1,0x0);_0x50bf1d['countReScheduled'](_0x2fb107)[_0xf08a('0xb6')](sendMessageReschedule(_0x2fb107))[_0xf08a('0xae')](loggerCatch('[countReScheduled]\x20'));}else{_0x2fb107[_0xf08a('0x3e')]='RUNNING';if(_['isNil'](_0x2a3c35[0x0])||_['isNil'](_0x2a3c35[0x0][_0xf08a('0x165')])||_[_0xf08a('0xab')](_0x2a3c35[0x0][_0xf08a('0x165')][_0xf08a('0x166')])){_0x50bf1d[_0xf08a('0x210')]('[actionOriginate]\x20',_0x2fb107,_0x2a3c35[0x0]);}else{_0x50bf1d[_0xf08a('0xb4')](_[_0xf08a('0xcb')](_0x2a3c35[0x0],[_0xf08a('0xf3'),_0xf08a('0x208')]))[_0xf08a('0xb6')](_0x50bf1d[_0xf08a('0x209')](_0x2fb107,_0x2a3c35[0x0]))[_0xf08a('0xae')](_0x50bf1d[_0xf08a('0xc9')](_0xf08a('0x214'),_0x2fb107));}}})[_0xf08a('0xae')](loggerGetContactDialer(_0xf08a('0x215'),_0x2fb107,0x1));emitVoiceQueueSummary(_0x2fb107);};Dialer[_0xf08a('0x1b')][_0xf08a('0x1e2')]=function(_0x3cd281,_0x11ce90,_0x1586d1,_0x5e8b59,_0x4ec832,_0x443440){loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x216'));loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x217'),_0x3cd281);loggerPredictive[_0xf08a('0x7c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x11ce90);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x218'),_0x1586d1);loggerPredictive[_0xf08a('0x7c')]('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',_0x5e8b59);loggerPredictive['info'](_0xf08a('0x219'),_0x4ec832);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x83'));return new BPromise(function(_0x3fc9f7,_0x5315c5){if(_0x3cd281<=0x0||isNaN(_0x3cd281)){return _0x5315c5(msgResponse(_0xf08a('0x21a'),_0xf08a('0x21b'),'m\x20=\x20'+_0x3cd281));}if(_0x1586d1<=0x0||isNaN(_0x1586d1)){return _0x5315c5(msgResponse(_0xf08a('0x21a'),_0xf08a('0x21b'),_0xf08a('0x21c')+_0x1586d1));}if(_0x5e8b59<=0x0||isNaN(_0x5e8b59)){return _0x5315c5(msgResponse(_0xf08a('0x21a'),_0xf08a('0x21b'),_0xf08a('0x21d')+_0x5e8b59));}if(_0x11ce90<=0x0||isNaN(_0x11ce90)){return _0x5315c5(msgResponse(_0xf08a('0x21a'),'Error',_0xf08a('0x21e')+_0x11ce90));}if(_0x4ec832<=0x0||isNaN(_0x4ec832)){return _0x5315c5(msgResponse(_0xf08a('0x21a'),'Error','Amax\x20=\x20'+_0x4ec832));}_0x443440=_0x443440||0x0;var _0x4646bb=0x1/_0x1586d1;var _0x2daae5=0x0;var _0x50146b=0x0;var _0x51b0b1=0x0;var _0x1df102=0x0;for(var _0x21c600=0x0;_0x51b0b1<_0x4ec832;_0x21c600+=0x1){_0x50146b=_0x21c600/_0x11ce90;_0x2daae5=(_0x5e8b59*_0x50146b+_0x443440)/_0x4646bb;_0x51b0b1=erlangb(_0x2daae5,_0x3cd281);_0x1df102=_0x2daae5/_0x3cd281*(0x1-erlangb(_0x2daae5,_0x3cd281));}return _0x3fc9f7({'erlangCalls':_0x21c600,'erlangCallToSecond':_0x11ce90/_0x21c600,'erlangAbandonmentRate':_0x51b0b1,'erlangBusyFactor':_0x1df102});});};Dialer[_0xf08a('0x1b')][_0xf08a('0x1e4')]=function(_0x374f2f,_0x118cdd,_0x38df52,_0x7c9204,_0x21d9f2,_0x3bb55b){loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x21f'));loggerPredictive['info'](_0xf08a('0x217'),_0x374f2f);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x220'),_0x118cdd);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x218'),_0x38df52);loggerPredictive['info'](_0xf08a('0x221'),_0x7c9204);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x222'),_0x21d9f2);loggerPredictive['info'](_0xf08a('0x83'));return new BPromise(function(_0x5336f8,_0x357ffd){if(_0x374f2f<=0x0||isNaN(_0x374f2f)){return _0x357ffd(msgResponse(_0xf08a('0x223'),_0xf08a('0x21b'),_0xf08a('0x224')+_0x374f2f));}if(_0x38df52<=0x0||isNaN(_0x38df52)){return _0x357ffd(msgResponse(_0xf08a('0x223'),_0xf08a('0x21b'),_0xf08a('0x21c')+_0x38df52));}if(_0x7c9204<=0x0||isNaN(_0x7c9204)){return _0x357ffd(msgResponse('[busyFactor]',_0xf08a('0x21b'),_0xf08a('0x21d')+_0x7c9204));}if(_0x118cdd<=0x0||isNaN(_0x118cdd)){return _0x357ffd(msgResponse(_0xf08a('0x223'),'Error',_0xf08a('0x21e')+_0x118cdd));}if(_0x21d9f2<=0x0||isNaN(_0x21d9f2)){return _0x357ffd(msgResponse(_0xf08a('0x223'),_0xf08a('0x21b'),_0xf08a('0x225')+_0x21d9f2));}_0x3bb55b=_0x3bb55b||0x0;var _0x479bae=0x1/_0x38df52;var _0x2e884c=0x0;var _0x3fb125=0x0;var _0x43e2cf=0x0;var _0x4823c0=0x0;for(var _0x416aab=0x0;_0x4823c0<_0x21d9f2;_0x416aab+=0x1){_0x3fb125=_0x416aab/_0x118cdd;_0x2e884c=(_0x7c9204*_0x3fb125+_0x3bb55b)/_0x479bae;_0x43e2cf=erlangb(_0x2e884c,_0x374f2f);_0x4823c0=_0x2e884c/_0x374f2f*(0x1-erlangb(_0x2e884c,_0x374f2f));}return _0x5336f8({'erlangCalls':_0x416aab,'erlangCallToSecond':_0x118cdd/_0x416aab,'erlangAbandonmentRate':_0x43e2cf,'erlangBusyFactor':_0x4823c0});});};module[_0xf08a('0x226')]=Dialer; \ No newline at end of file +var _0x8bc9=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','NoAnswer','custom:agentnoanswer','buildObj','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','congestion','checkRetriveMax','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','predictiveIntervalAnsweredCalls','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','Agent','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','dialOrderByScheduledAt','ACTIVE','RUNNING','tryOriginatePredictive','not_inuse','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','lodash','uuid','moment','md5','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','localhost','redis','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','milliseconds','diff','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','IS_DISACTIVED','state','endtime','prototype','clearZombieChannels','uniqueId','[uniqueid]','isNil','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','status','reachable','SIP/%s','unmonitored','uniqueid','variable','amdstatus','exten','dialAMDActive','value','HANGUP','statedesc','HangupInAMD','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','countbusyretry','countcongestionretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','AMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','membername','countnoanswerretry','countnosuchnumberretry','VoiceQueueId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','predictiveIntervalDroppedCallsCallersExit','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','roundrobin','locked','paused','stateinterface','push','pick','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','timezones','\x20Timezone\x20unknow\x20','isArray','Action','command','interval','content','indexOf','true','iftime\x20%s,%s','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','Queue','handleIvr','dialMethod','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','syncCampaigns','launchHandleIvr','pow','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','xcally-motion-dialer','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originate][error]','responsetime','getQueue','response','callProgressDetecting'];(function(_0x11e1b5,_0x170d84){var _0x9bd7c1=function(_0x3f728a){while(--_0x3f728a){_0x11e1b5['push'](_0x11e1b5['shift']());}};_0x9bd7c1(++_0x170d84);}(_0x8bc9,0x89));var _0x98bc=function(_0x57a379,_0x4424d5){_0x57a379=_0x57a379-0x0;var _0x39bb1f=_0x8bc9[_0x57a379];return _0x39bb1f;};'use strict';var util=require('util');var _=require(_0x98bc('0x0'));var BPromise=require('bluebird');var uuid=require(_0x98bc('0x1'));var moment=require(_0x98bc('0x2'));var rr=require('rr');var md5=require(_0x98bc('0x3'));var Redis=require('ioredis');var ut=require(_0x98bc('0x4'));var config=require(_0x98bc('0x5'));var logger=require('../../../config/logger')(_0x98bc('0x6'));var loggerBooked=require(_0x98bc('0x7'))(_0x98bc('0x8'));var loggerPredictive=require(_0x98bc('0x7'))(_0x98bc('0x9'));var loggerPredictiveCalls=require(_0x98bc('0x7'))(_0x98bc('0xa'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x98bc('0xb'));var ami=require(_0x98bc('0xc'));config['redis']=_[_0x98bc('0xd')](config['redis'],{'host':_0x98bc('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x98bc('0xf')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x98bc('0x10'));var voiceQueueRt=require(_0x98bc('0x11'));var Action=require(_0x98bc('0x12'));var History=require(_0x98bc('0x13'));var Final=require(_0x98bc('0x14'));var AgentComplete=require(_0x98bc('0x15'));var QueueCallerAbandon=require(_0x98bc('0x16'));var Hangup=require(_0x98bc('0x17'));var ipAgi=process[_0x98bc('0x18')]['XCALLY_IP_AGI']||_0x98bc('0x19');var strategy={'rrmemory':_0x98bc('0x1a'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence['prototype'][_0x98bc('0x1b')]=function(_0x4279b4){this['tail']=this['tail']?this[_0x98bc('0x1c')][_0x98bc('0x1d')](_0x4279b4):_0x4279b4();};function Dialer(_0x2f9595,_0x59b55a){this[_0x98bc('0x1e')]=new Sequence();this['preview']=_0x59b55a;this[_0x98bc('0x1f')]=_0x2f9595[_0x98bc('0x1f')];this[_0x98bc('0x20')]=_0x2f9595['campaigns'];this['agents']=_0x2f9595[_0x98bc('0x21')];this['trunks']=_0x2f9595[_0x98bc('0x22')];this[_0x98bc('0x23')]=config[_0x98bc('0x23')]||0x2;this[_0x98bc('0x24')]={};this[_0x98bc('0x25')]={};this[_0x98bc('0x26')]={};this['uniqueId']={};this[_0x98bc('0x27')]={};this[_0x98bc('0x28')]={};this[_0x98bc('0x29')]={};this[_0x98bc('0x2a')]={};this[_0x98bc('0x2b')]={};this[_0x98bc('0x2c')]={};ami['on'](_0x98bc('0x2d'),this[_0x98bc('0x2e')][_0x98bc('0x2f')](this));ami['on'](_0x98bc('0x30'),this['syncQueueCallerAbandon']['bind'](this));ami['on']('originateresponse',this[_0x98bc('0x31')][_0x98bc('0x2f')](this));ami['on'](_0x98bc('0x32'),this['syncAgentComplete']['bind'](this));ami['on']('custom:queuesummary',this[_0x98bc('0xb')][_0x98bc('0x2f')](this));ami['on'](_0x98bc('0x33'),this[_0x98bc('0x34')]['bind'](this));ami['on'](_0x98bc('0x35'),this[_0x98bc('0x36')][_0x98bc('0x2f')](this));ami['on']('varset',this[_0x98bc('0x37')]['bind'](this));ami['on'](_0x98bc('0x38'),this['syncQueueMember'][_0x98bc('0x2f')](this));ami['on'](_0x98bc('0x39'),this[_0x98bc('0x3a')][_0x98bc('0x2f')](this));this[_0x98bc('0x3b')]();this[_0x98bc('0x3c')]();}function isNotNull(_0x1a2232){return _0x1a2232!==null&&!_[_0x98bc('0x3d')](_0x1a2232);}function checkIsLoggedIn(_0x249967,_0x495a18){return function(){if(_0x495a18<=0x0){_0x249967[_0x98bc('0x3e')]=_0x98bc('0x3f');throw _0x249967[_0x98bc('0x40')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x4386bf){return _0x4386bf;}function checkIsActive(_0x329068,_0x11b0ed){return function(){if(!isActive(_0x11b0ed)){_0x329068['message']=_0x98bc('0x41');throw _0x329068['name']+_0x98bc('0x42');}};}function checkInterval(_0x5607cc){return function(){if(!isNotNull(_0x5607cc[_0x98bc('0x43')])){_0x5607cc[_0x98bc('0x3e')]='INTERVAL_IS_NULL';throw _0x5607cc['name']+_0x98bc('0x44');}if(!isNotNull(_0x5607cc[_0x98bc('0x43')][_0x98bc('0x45')])){_0x5607cc[_0x98bc('0x3e')]=_0x98bc('0x46');throw _0x5607cc[_0x98bc('0x40')]+_0x98bc('0x44');}if(!isNotNull(_[_0x98bc('0x47')](_0x5607cc[_0x98bc('0x43')][_0x98bc('0x45')]))){_0x5607cc['message']=_0x98bc('0x46');throw _0x5607cc['name']+_0x98bc('0x44');}};}function msgResponse(_0x23e3ae,_0x21e4eb,_0x28a7e3){return{'action':_0x23e3ae,'response':_0x21e4eb,'message':_0x28a7e3,'stack':_0x28a7e3};}function myreject(_0x2eb670){return function(_0x5adcfb){return _0x2eb670(msgResponse(_0x98bc('0x48'),_0x98bc('0x49'),JSON[_0x98bc('0x4a')](_0x5adcfb)));};}function getSeconds(_0xcfb0fa,_0x46aa5f){var _0x2eb12b=moment(_0xcfb0fa)['milliseconds'](0x0);var _0xa7ef1d=moment(_0x46aa5f)['milliseconds'](0x0);return _0x2eb12b['diff'](_0xa7ef1d,_0x98bc('0x4b'));}function emit(_0x381c13,_0x552e89,_0x22d324){io['to'](_0x381c13)[_0x98bc('0x4c')](_0x552e89,_0x22d324);}function emitVoiceQueueSummary(_0x1096ed){if(_0x1096ed[_0x98bc('0x4d')]===_0x98bc('0x4e')){var _0x2552d7={'id':_0x1096ed['id'],'name':_0x1096ed[_0x98bc('0x40')],'strategy':_0x1096ed[_0x98bc('0x4f')],'answered':_0x1096ed[_0x98bc('0x50')],'available':_0x1096ed[_0x98bc('0x51')],'loggedIn':_0x1096ed[_0x98bc('0x52')],'pTalking':_0x1096ed[_0x98bc('0x53')],'sumBillable':_0x1096ed[_0x98bc('0x54')],'sumDuration':_0x1096ed[_0x98bc('0x55')],'sumHoldTime':_0x1096ed[_0x98bc('0x56')]||0x0,'talking':_0x1096ed[_0x98bc('0x57')],'total':_0x1096ed[_0x98bc('0x58')],'type':_0x1096ed[_0x98bc('0x4d')],'unmanaged':_0x1096ed['unmanaged'],'abandoned':_0x1096ed[_0x98bc('0x59')],'waiting':_0x1096ed[_0x98bc('0x5a')],'loggedInDb':_0x1096ed[_0x98bc('0x5b')],'dialActive':_0x1096ed[_0x98bc('0x5c')],'dialMethod':_0x1096ed['dialMethod'],'dialOriginateCallerIdName':_0x1096ed[_0x98bc('0x5d')],'dialOriginateCallerIdNumber':_0x1096ed[_0x98bc('0x5e')],'dialOriginateTimeout':_0x1096ed[_0x98bc('0x5f')],'dialPrefix':_0x1096ed[_0x98bc('0x60')],'outboundAnswerAgiCallsDay':_0x1096ed[_0x98bc('0x61')],'outboundAnswerCallsDay':_0x1096ed[_0x98bc('0x62')],'outboundBlacklistCallsDay':_0x1096ed[_0x98bc('0x63')],'outboundBusyCallsDay':_0x1096ed['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1096ed[_0x98bc('0x64')],'outboundDropCallsDayACS':_0x1096ed[_0x98bc('0x65')],'outboundDropCallsDayCallersExit':_0x1096ed[_0x98bc('0x66')],'outboundDropCallsDayTimeout':_0x1096ed[_0x98bc('0x67')],'outboundNoAnswerCallsDay':_0x1096ed[_0x98bc('0x68')],'outboundNoSuchCallsDay':_0x1096ed['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1096ed['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x1096ed[_0x98bc('0x69')],'outboundRejectCallsDay':_0x1096ed[_0x98bc('0x6a')],'outboundUnknownCallsDay':_0x1096ed['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x1096ed['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x1096ed['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1096ed['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x1096ed['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1096ed[_0x98bc('0x6b')],'predictiveIntervalErlangCalls':_0x1096ed['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1096ed['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x1096ed[_0x98bc('0x6c')],'predictiveIntervalMultiplicativeFactor':_0x1096ed['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x1096ed[_0x98bc('0x6d')],'predictiveIntervalAvailable':_0x1096ed['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x1096ed[_0x98bc('0x6e')],'message':_0x1096ed[_0x98bc('0x3e')],'originated':_0x1096ed[_0x98bc('0x6f')],'erlangCalls':_0x1096ed['erlangCalls'],'erlangCallToSecond':_0x1096ed[_0x98bc('0x70')],'erlangAbandonmentRate':_0x1096ed[_0x98bc('0x71')],'erlangBusyFactor':_0x1096ed[_0x98bc('0x72')],'startPredictive':_0x1096ed[_0x98bc('0x28')],'startProgressive':_0x1096ed[_0x98bc('0x29')]};if(_0x1096ed[_0x98bc('0x73')]){_0x2552d7['Trunk']={'id':_0x1096ed['Trunk']['id'],'name':_0x1096ed[_0x98bc('0x73')][_0x98bc('0x40')],'active':_0x1096ed['Trunk'][_0x98bc('0x74')],'callerid':_0x1096ed[_0x98bc('0x73')]['callerid']};}if(_0x1096ed[_0x98bc('0x43')]){_0x2552d7['Interval']={'id':_0x1096ed['Interval']['id'],'name':_0x1096ed['Interval'][_0x98bc('0x40')]};}var _0x22764d=md5(JSON[_0x98bc('0x4a')](_0x2552d7));if(_0x1096ed['md5']!==_0x22764d){_0x1096ed[_0x98bc('0x3')]=_0x22764d;emit(util['format'](_0x98bc('0x75'),_0x2552d7[_0x98bc('0x40')]),_0x98bc('0x76'),_0x2552d7);}}}function emitCampaignSummary(_0x48d42b){if(_0x48d42b[_0x98bc('0x4d')]===_0x98bc('0x77')){emit(util[_0x98bc('0x78')](_0x98bc('0x79'),_0x48d42b[_0x98bc('0x40')]),_0x98bc('0x7a'),_0x48d42b);}}function checkGetDataPredictive(_0xf5e560){if(isNotNull(_0xf5e560)&&!_[_0x98bc('0x47')](_0xf5e560)){loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x7c'));loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x7d'),_0xf5e560[_0x98bc('0x6e')]);loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x7e'),_0xf5e560['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x7f'),_0xf5e560['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x98bc('0x7b')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf5e560['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x98bc('0x7b')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf5e560[_0x98bc('0x80')]);loggerPredictive['info'](_0x98bc('0x81'),_0xf5e560[_0x98bc('0x82')]);loggerPredictive['info'](_0x98bc('0x83'));if(_0xf5e560[_0x98bc('0x6e')]>0x0){if(!_[_0x98bc('0x3d')](_0xf5e560['predictiveIntervalAvgTalktime'])&&_0xf5e560[_0x98bc('0x82')]>0x0){return!![];}loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x84'));if(!_[_0x98bc('0x3d')](_0xf5e560['predictiveIntervalAvgHoldtime'])&&_0xf5e560[_0x98bc('0x80')]>0x0){return!![];}loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x85'));}else{loggerPredictive['info'](_0x98bc('0x86'));}}else{loggerPredictive[_0x98bc('0x7b')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2b998c){return function(_0x272a3c){loggerPredictive['info'](_0x98bc('0x87'));loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x88'),_0x272a3c[_0x98bc('0x89')]);loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x8a'),_0x272a3c[_0x98bc('0x70')]);loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x8b'),_0x272a3c[_0x98bc('0x71')]);loggerPredictive['info'](_0x98bc('0x8c'),_0x272a3c[_0x98bc('0x72')]);loggerPredictive[_0x98bc('0x7b')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x272a3c[_0x98bc('0x71')]);loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x83'));_[_0x98bc('0x8d')](_0x2b998c,_0x272a3c);};}function getDiff(_0x1675df){var _0x4253b9=moment()[_0x98bc('0x8e')](0x0);var _0x314272=moment(_0x1675df)[_0x98bc('0x8e')](0x0);return _0x4253b9[_0x98bc('0x8f')](_0x314272,'seconds');}function ifInterval(_0x21e24a,_0x1aad83){if(_[_0x98bc('0x3d')](_0x1aad83)){return![];}return getDiff(_0x1aad83)<_0x21e24a*0x3c;}function freeVariablesPredictive(_0x22d389){if(isNotNull(_0x22d389)){if(!_[_0x98bc('0x3d')](_0x22d389['startProgressive'])){_0x22d389['startProgressive']=undefined;loggerPredictive[_0x98bc('0x7b')](_0x22d389[_0x98bc('0x40')],_0x98bc('0x90'));}if(!_[_0x98bc('0x3d')](_0x22d389[_0x98bc('0x28')])){_0x22d389[_0x98bc('0x28')]=undefined;loggerPredictive[_0x98bc('0x7b')](_0x22d389[_0x98bc('0x40')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x22d389[_0x98bc('0x91')])){clearInterval(_0x22d389[_0x98bc('0x91')]);_0x22d389['handlePredictive']=undefined;loggerPredictive[_0x98bc('0x7b')](_0x22d389[_0x98bc('0x40')],_0x98bc('0x92'));}}}function erlangb(_0x7675e,_0x1ece3a){if(_0x1ece3a===0x0){return 0x0;}var _0x123712=0x1;for(var _0x5301e=0x1;_0x5301e<=_0x1ece3a;_0x5301e+=0x1){_0x123712=0x1+_0x123712*_0x5301e/_0x7675e;}return 0x1/_0x123712;}function isVoiceQueueOutbound(_0x2f2728){return _0x2f2728==='outbound';}function isNotPreview(_0x3de4b3){return _0x3de4b3!==_0x98bc('0x93');}function isCampaignIvr(_0x5a944d){return _0x5a944d===_0x98bc('0x77');}function getCallerId(_0x3ef9f7,_0x26f26c,_0x26ca09){if(!_[_0x98bc('0x3d')](_0x26ca09)&&typeof _0x26ca09==='string'&&!_['isEmpty'](_0x26ca09)){if(!_[_0x98bc('0x3d')](_0x26f26c)&&typeof _0x26f26c===_0x98bc('0x94')&&!_[_0x98bc('0x47')](_0x26f26c)){return util[_0x98bc('0x78')](_0x98bc('0x95'),_0x26f26c,_0x26ca09);}return util[_0x98bc('0x78')](_0x98bc('0x95'),_0x26ca09,_0x26ca09);}if(!_[_0x98bc('0x3d')](_0x3ef9f7)&&typeof _0x3ef9f7===_0x98bc('0x94')&&!_[_0x98bc('0x47')](_0x3ef9f7)){return _0x3ef9f7;}return _0x98bc('0x96');}function loggerCatchQueueSummary(_0x1046f6,_0x3fe852){return function(_0x3947c1){freeVariablesPredictive(_0x3fe852);emitVoiceQueueSummary(_0x3fe852);emitCampaignSummary(_0x3fe852);loggerSyncQueueSummary[_0x98bc('0x97')](_0x1046f6,util[_0x98bc('0x98')](_0x3947c1,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xed82e6,_0x2dd1db){return function(_0x34c916){loggerPredictive[_0x98bc('0x97')](_0x2dd1db[_0x98bc('0x40')],_0xed82e6);loggerPredictive[_0x98bc('0x97')](_0x34c916[_0x98bc('0x99')]);freeVariablesPredictive(_0x2dd1db);};}function loggerCatch(_0x1f164d){return function(_0x5f3930){logger[_0x98bc('0x97')](_0x1f164d,util['inspect'](_0x5f3930,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x53ff21){return _0x53ff21&&!_[_0x98bc('0x3d')](_0x53ff21)&&_0x53ff21['length']>0x0;}function decremetOriginate(_0x2118f9){if(!_[_0x98bc('0x3d')](_0x2118f9)&&_0x2118f9!==null){if(typeof _0x2118f9[_0x98bc('0x6f')]!==_0x98bc('0x9a')){if(_0x2118f9['originated']>0x0){_0x2118f9[_0x98bc('0x6f')]-=0x1;}else{logger[_0x98bc('0x97')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x98bc('0x9b'));}}function checkContactLowerLimitOriginate(_0x2e7f03,_0x464cab,_0x5e9a6f){if(_0x464cab>_0x5e9a6f){for(var _0x36549d=0x0;_0x36549d<_0x464cab-_0x5e9a6f;_0x36549d+=0x1){decremetOriginate(_0x2e7f03);}}}function loggerGetContactDialer(_0x158b2f,_0x7592aa,_0x32c106){return function(_0xfa8dd9){checkContactLowerLimitOriginate(_0x7592aa,_0x32c106,0x0);logger['error'](_0x158b2f,util[_0x98bc('0x98')](_0xfa8dd9,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3c565e){return function(_0x4f9399){if(isNotNull(_0x4f9399)&&isNotNull(_0x4f9399[0x0])){if(_0x4f9399[0x0]['contactsRescheduled']>0x0){_0x3c565e[_0x98bc('0x3e')]='RESCHEDULED_CONTACTS';logger[_0x98bc('0x7b')](_0x98bc('0x9c')+_0x3c565e[_0x98bc('0x40')],_0x4f9399[0x0][_0x98bc('0x9d')],'contacts');}else{_0x3c565e[_0x98bc('0x3e')]=_0x98bc('0x9e');logger['info'](_0x98bc('0x9f')+_0x3c565e[_0x98bc('0x40')]);}}};}function notSendMessagesQueue(_0xe8b125){if(_0xe8b125['sendMessageOneNotActive']){freeVariablesPredictive(_0xe8b125);if(_0xe8b125['originated']===0x0&&_0xe8b125[_0x98bc('0x57')]===0x0&&_0xe8b125[_0x98bc('0x5a')]===0x0&&(_0xe8b125['pTalking']||0x0)===0x0){_0xe8b125[_0x98bc('0xa0')]=![];_0xe8b125[_0x98bc('0x51')]=0x0;_0xe8b125['message']=_0x98bc('0x41');loggerSyncQueueSummary['error'](_0x98bc('0xa1'),_0xe8b125[_0x98bc('0x40')],'is\x20not\x20active');}else{_0xe8b125['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x98bc('0x97')](_0x98bc('0xa1'),_0xe8b125['name'],_0x98bc('0xa2'));}emitVoiceQueueSummary(_0xe8b125);}}function notSendMessagesCampaign(_0x5b0cc4){if(_0x5b0cc4[_0x98bc('0xa0')]){if(_0x5b0cc4[_0x98bc('0x6f')]===0x0){_0x5b0cc4[_0x98bc('0xa0')]=![];_0x5b0cc4[_0x98bc('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x98bc('0x97')](_0x98bc('0xa3'),_0x5b0cc4[_0x98bc('0x40')],_0x98bc('0xa4'));}else{_0x5b0cc4['message']=_0x98bc('0xa5');loggerSyncQueueSummary[_0x98bc('0x97')](_0x98bc('0xa3'),_0x5b0cc4[_0x98bc('0x40')],_0x98bc('0xa2'));}emitCampaignSummary(_0x5b0cc4);}}function createObjHistory(_0x33e5b2,_0x2ddbd9,_0x48ad72,_0x1c9ff9,_0xd9357a){_0x33e5b2['message']=_0x48ad72;var _0x2422d9=new Action(_0x33e5b2,_0x2ddbd9);var _0x1fd8bb=new History(_0x2422d9);_0x1fd8bb[_0x98bc('0xa6')]=_0x1c9ff9;_0x1fd8bb['statedesc']=_0xd9357a;_0x1fd8bb[_0x98bc('0xa7')]=_0x2422d9['starttime'];return _0x1fd8bb;}Dialer[_0x98bc('0xa8')][_0x98bc('0x3c')]=function(){var _0x5554da=this;setInterval(function(){_0x5554da[_0x98bc('0xa9')](_0x5554da[_0x98bc('0xaa')],_0x98bc('0xab'));_0x5554da[_0x98bc('0xa9')](_0x5554da[_0x98bc('0x25')],'[actions]');},0x32c8);};Dialer[_0x98bc('0xa8')][_0x98bc('0xa9')]=function(_0x31bace,_0xf1c71b){var _0x3f4091=this;for(var _0x14c4bf in _0x31bace){if(typeof _0x31bace[_0x14c4bf]!==_0x98bc('0x9a')){this['sequence'][_0x98bc('0x1b')](function(){if(!_[_0x98bc('0xac')](_0x31bace[_0x14c4bf])){return ami['Action']({'action':'status','channel':_0x31bace[_0x14c4bf]['channel']})[_0x98bc('0xad')](function(_0x651939){if(_0x651939[_0x98bc('0x3e')]===_0x98bc('0xae')){setTimeout(function(){if(_0x31bace[_0x14c4bf]&&_0x31bace[_0x14c4bf][_0x98bc('0x4d')]!==_0x98bc('0x77')){_0x3f4091[_0x98bc('0xaf')](_0x3f4091['voiceQueues'][_0x31bace[_0x14c4bf][_0x98bc('0xb0')]]);logger[_0x98bc('0x97')](_0x98bc('0xb1'),_0xf1c71b,_0x14c4bf,_0x31bace[_0x14c4bf]['queue']);delete _0x31bace[_0x14c4bf];}if(_0x31bace[_0x14c4bf]&&_0x31bace[_0x14c4bf]['type']===_0x98bc('0x77')){_0x3f4091[_0x98bc('0xaf')](_0x3f4091[_0x98bc('0x20')][_0x31bace[_0x14c4bf][_0x98bc('0xb0')]]);logger[_0x98bc('0x97')]('[Dialer][checkChannel][ivr]',_0xf1c71b,_0x14c4bf,_0x31bace[_0x14c4bf][_0x98bc('0xb0')]);delete _0x31bace[_0x14c4bf];}},0x2328);}});}});}}};Dialer['prototype'][_0x98bc('0xb2')]=function(_0xb9740c){return BPromise[_0x98bc('0xb3')]()['then'](cmHopper[_0x98bc('0xb2')](_0xb9740c))[_0x98bc('0xad')](loggerCatch(_0x98bc('0xb4')));};Dialer[_0x98bc('0xa8')][_0x98bc('0xb5')]=function(_0x28b68b){return BPromise[_0x98bc('0xb3')]()[_0x98bc('0xb6')](cmHopperBlack[_0x98bc('0xb5')](_0x28b68b))[_0x98bc('0xad')](loggerCatch(_0x98bc('0xb7')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x2e62d6){return BPromise[_0x98bc('0xb3')]()[_0x98bc('0xb6')](cmHopperBlack[_0x98bc('0xb8')](_0x2e62d6))[_0x98bc('0xad')](loggerCatch(_0x98bc('0xb9')));};Dialer[_0x98bc('0xa8')][_0x98bc('0xba')]=function(_0x250843){return BPromise[_0x98bc('0xb3')]()[_0x98bc('0xb6')](cmHopperHistory[_0x98bc('0xbb')](_0x250843))[_0x98bc('0xad')](loggerCatch(_0x98bc('0xbc')));};Dialer['prototype'][_0x98bc('0xbd')]=function(_0x3de2a2){return BPromise[_0x98bc('0xb3')]()['then'](cmHopper[_0x98bc('0xbd')](_0x3de2a2))[_0x98bc('0xad')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x98bc('0xa8')]['unlockContact']=function(_0x5da30a,_0x2df147,_0x2515e8){return BPromise['resolve']()[_0x98bc('0xb6')](cmHopper[_0x98bc('0xbe')](_0x5da30a,_0x2df147,_0x2515e8))[_0x98bc('0xad')](loggerCatch(_0x98bc('0xbf')));};Dialer['prototype'][_0x98bc('0xc0')]=function(_0x4bb8fb,_0x51339c,_0x2faf50,_0x240603){return BPromise[_0x98bc('0xb3')]()['then'](cmHopper[_0x98bc('0xc0')](_0x4bb8fb,_0x51339c,_0x2faf50,_0x240603))[_0x98bc('0xad')](loggerCatch(_0x98bc('0xc1')));};Dialer[_0x98bc('0xa8')][_0x98bc('0xc2')]=function(_0x3bb557,_0x21f7ae,_0x42377c){return BPromise[_0x98bc('0xb3')]()[_0x98bc('0xb6')](cmHopper[_0x98bc('0xc2')](_0x3bb557,_0x21f7ae,_0x42377c))[_0x98bc('0xad')](loggerCatch(_0x98bc('0xc1')));};Dialer['prototype'][_0x98bc('0xc3')]=function(_0x37637a){return BPromise[_0x98bc('0xb3')]()[_0x98bc('0xb6')](voiceQueueRt['getVoiceQueueRtPauses'](_0x37637a))['catch'](loggerCatch(_0x98bc('0xc4')));};Dialer[_0x98bc('0xa8')][_0x98bc('0xc5')]=function(_0x3237f0){return BPromise['resolve']()['then'](cmHopper['moveContactManagedDialer'](_0x3237f0))[_0x98bc('0xad')](loggerCatch(_0x98bc('0xc6')));};Dialer[_0x98bc('0xa8')][_0x98bc('0xc7')]=function(_0x1611de){return BPromise[_0x98bc('0xb3')]()[_0x98bc('0xb6')](cmHopperHistory['createHistory'](_0x1611de))[_0x98bc('0xad')](loggerCatch('[createHistory]\x20'));};Dialer[_0x98bc('0xa8')][_0x98bc('0xaf')]=function(_0x5604b4){if(!_[_0x98bc('0x3d')](_0x5604b4)&&_0x5604b4!==null){if(typeof _0x5604b4[_0x98bc('0x6f')]!=='undefined'){if(_0x5604b4[_0x98bc('0x6f')]>0x0){_0x5604b4['originated']-=0x1;}else{logger[_0x98bc('0x97')](_0x98bc('0xc8'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x98bc('0xa8')][_0x98bc('0xc9')]=function(_0x59a4b7,_0x292bda){var _0x401dfd=this;return function(_0x236e26){_0x401dfd['updateOriginated'](_0x292bda);logger[_0x98bc('0x97')](_0x59a4b7,util[_0x98bc('0x98')](_0x236e26,{'showHidden':![],'depth':null}));};};Dialer[_0x98bc('0xa8')][_0x98bc('0xca')]=function(_0x338f83,_0x3f0187,_0x1cf24e){var _0x485ed1={'state':0x19,'statedesc':_0x98bc('0xcb')};this[_0x98bc('0xaf')](_0x3f0187);this[_0x98bc('0xcc')](_['merge'](_0x485ed1,_['pick'](_0x1cf24e,[_0x98bc('0xcd'),_0x98bc('0xce'),_0x98bc('0xcf'),'VoiceQueueId',_0x98bc('0xd0')])),_0x98bc('0xd1'),_0x98bc('0xd2'));logger[_0x98bc('0x97')](_0x338f83);};Dialer[_0x98bc('0xa8')]['isSuccess']=function(_0x1da0f8){return _0x1da0f8===_0x98bc('0xd3');};Dialer['prototype'][_0x98bc('0xd4')]=function(_0x49efe0){return!_['isUndefined'](_0x49efe0)&&_0x49efe0&&!_['isUndefined'](_0x49efe0[_0x98bc('0x40')])&&!_[_0x98bc('0x3d')](_0x49efe0[_0x98bc('0x74')])&&_0x49efe0[_0x98bc('0x74')]&&(this[_0x98bc('0x22')][util[_0x98bc('0x78')]('SIP/%s',_0x49efe0[_0x98bc('0x40')])][_0x98bc('0xd5')]===_0x98bc('0xd6')||this['trunks'][util['format'](_0x98bc('0xd7'),_0x49efe0[_0x98bc('0x40')])]['status']===_0x98bc('0xd8'));};Dialer[_0x98bc('0xa8')]['saveInDb']=function(_0xf48ec2,_0x545a9a,_0x169fd7){this['createHistory'](_0xf48ec2)[_0x98bc('0xad')](loggerCatch(_0x545a9a));this[_0x98bc('0xc5')](_0xf48ec2)[_0x98bc('0xad')](loggerCatch(_0x169fd7));};Dialer[_0x98bc('0xa8')][_0x98bc('0x37')]=function(_0x2b7100){var _0x52bd3d=this[_0x98bc('0xaa')][_0x2b7100[_0x98bc('0xd9')]];var _0x18cac;if(!_['isNil'](_0x2b7100)&&!_[_0x98bc('0xac')](_0x2b7100[_0x98bc('0xda')])&&!_[_0x98bc('0xac')](_0x2b7100[_0x98bc('0xda')][_0x98bc('0xdb')])&&_0x2b7100[_0x98bc('0xdc')]==='xcally-motion-dialer'&&_0x52bd3d){if(_0x52bd3d['type']!==_0x98bc('0x77')&&this[_0x98bc('0x1f')][_0x52bd3d['queue']][_0x98bc('0xdd')]&&_0x2b7100[_0x98bc('0xde')]===_0x98bc('0xdf')){delete this[_0x98bc('0xaa')][_0x2b7100[_0x98bc('0xd9')]];this[_0x98bc('0xaf')](this[_0x98bc('0x1f')][_0x52bd3d[_0x98bc('0xb0')]]);this['voiceQueues'][_0x52bd3d['queue']][_0x98bc('0x62')]+=0x1;this[_0x98bc('0x1f')][_0x52bd3d[_0x98bc('0xb0')]][_0x98bc('0x61')]+=0x1;_0x18cac=new Hangup(_0x52bd3d,_0x2b7100);_0x18cac[_0x98bc('0xa6')]=0x12;_0x18cac[_0x98bc('0xe0')]=_0x98bc('0xe1');_0x18cac['membername']='AMD';this[_0x98bc('0xcc')](_0x18cac,'[syncHangupInAMD][createHistory]',_0x98bc('0xe2'));}if(_0x52bd3d['type']!=='ivr'&&this['voiceQueues'][_0x52bd3d[_0x98bc('0xb0')]][_0x98bc('0xdd')]&&_0x2b7100[_0x98bc('0xde')]===_0x98bc('0xe3')){var _0x59dae9=this;return new BPromise(function(_0x567f8a,_0x28d338){delete _0x59dae9[_0x98bc('0xaa')][_0x2b7100[_0x98bc('0xd9')]];_0x59dae9[_0x98bc('0xaf')](_0x59dae9[_0x98bc('0x1f')][_0x52bd3d[_0x98bc('0xb0')]]);_0x59dae9[_0x98bc('0x1f')][_0x52bd3d['queue']][_0x98bc('0x62')]+=0x1;_0x59dae9[_0x98bc('0x1f')][_0x52bd3d[_0x98bc('0xb0')]][_0x98bc('0x61')]+=0x1;var _0x59c81c=_0x59dae9[_0x98bc('0x1f')][_0x52bd3d[_0x98bc('0xb0')]];var _0x16fd50=new Hangup(_0x52bd3d,_0x2b7100);_0x16fd50[_0x98bc('0xa6')]=0x13;_0x16fd50[_0x98bc('0xe0')]=_0x98bc('0xe4');_0x16fd50['membername']='AMD';_0x16fd50[_0x98bc('0xe5')]+=0x1;_0x16fd50[_0x98bc('0xe6')]+=0x1;_0x16fd50[_0x98bc('0xe7')]=!![];_0x59dae9[_0x98bc('0xc7')](_0x16fd50)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x16fd50[_0x98bc('0xe8')]+_0x16fd50[_0x98bc('0xe9')]+_0x16fd50['countnoanswerretry']+_0x16fd50['countnosuchnumberretry']+_0x16fd50[_0x98bc('0xea')]+_0x16fd50[_0x98bc('0xeb')]+_0x16fd50[_0x98bc('0xe5')]+_0x16fd50[_0x98bc('0xec')]>=_0x59c81c[_0x98bc('0xed')]){_0x59dae9[_0x98bc('0xee')](_0x16fd50,_0x567f8a,_0x28d338,_0x98bc('0xef'));}else{if(_0x16fd50[_0x98bc('0xe5')]>=_0x59c81c[_0x98bc('0xf0')]){_0x59dae9[_0x98bc('0xf1')](_0x16fd50,_0x567f8a,_0x28d338,'reason\x2019\x20machine....');}else{_0x59dae9[_0x98bc('0xbd')]({'active':![],'countmachineretry':_0x16fd50[_0x98bc('0xe5')],'scheduledat':moment()[_0x98bc('0xf2')](_0x59c81c[_0x98bc('0xf3')],_0x98bc('0xf4'))[_0x98bc('0x78')](_0x98bc('0xf5')),'ContactId':_0x16fd50['ContactId'],'ListId':_0x16fd50[_0x98bc('0xce')],'VoiceQueueId':_0x16fd50['VoiceQueueId']||undefined,'CampaignId':_0x16fd50['CampaignId']||undefined})[_0x98bc('0xad')](loggerCatch(_0x98bc('0xf6')));_0x567f8a({'reschedule':0x1});}}});}if(_0x52bd3d[_0x98bc('0x4d')]===_0x98bc('0x77')&&this[_0x98bc('0x20')][_0x52bd3d[_0x98bc('0xb0')]][_0x98bc('0xdd')]&&_0x2b7100['value']===_0x98bc('0xdf')){delete this['uniqueId'][_0x2b7100['uniqueid']];this[_0x98bc('0xaf')](this[_0x98bc('0x20')][_0x52bd3d[_0x98bc('0xb0')]]);_0x18cac=new Hangup(_0x52bd3d,_0x2b7100);_0x18cac['state']=0x12;_0x18cac['statedesc']=_0x98bc('0xe1');_0x18cac['membername']=_0x98bc('0xf7');this['saveInDb'](_0x18cac,_0x98bc('0xf8'),_0x98bc('0xf9'));}if(_0x52bd3d[_0x98bc('0x4d')]===_0x98bc('0x77')&&this[_0x98bc('0x20')][_0x52bd3d['queue']][_0x98bc('0xdd')]&&_0x2b7100[_0x98bc('0xde')]===_0x98bc('0xe3')){var _0x59dae9=this;return new BPromise(function(_0x186f74,_0x1aba6e){delete _0x59dae9[_0x98bc('0xaa')][_0x2b7100[_0x98bc('0xd9')]];_0x59dae9['updateOriginated'](_0x59dae9['campaigns'][_0x52bd3d[_0x98bc('0xb0')]]);_0x59dae9[_0x98bc('0x20')][_0x52bd3d[_0x98bc('0xb0')]][_0x98bc('0x62')]+=0x1;_0x59dae9[_0x98bc('0x20')][_0x52bd3d[_0x98bc('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0xec57b6=_0x59dae9[_0x98bc('0x20')][_0x52bd3d['queue']];var _0x22af67=new Hangup(_0x52bd3d,_0x2b7100);_0x22af67[_0x98bc('0xa6')]=0x13;_0x22af67[_0x98bc('0xe0')]='Machine';_0x22af67[_0x98bc('0xfa')]=_0x98bc('0xf7');_0x22af67[_0x98bc('0xe5')]+=0x1;_0x22af67[_0x98bc('0xe6')]+=0x1;_0x22af67['amd']=!![];_0x59dae9['createHistory'](_0x22af67)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x22af67[_0x98bc('0xe8')]+_0x22af67[_0x98bc('0xe9')]+_0x22af67[_0x98bc('0xfb')]+_0x22af67[_0x98bc('0xfc')]+_0x22af67['countdropretry']+_0x22af67['countabandonedretry']+_0x22af67[_0x98bc('0xe5')]+_0x22af67[_0x98bc('0xec')]>=_0xec57b6[_0x98bc('0xed')]){_0x59dae9['stateGlobal'](_0x22af67,_0x186f74,_0x1aba6e,'reason19\x20machine....');}else{if(_0x22af67['countmachineretry']>=_0xec57b6[_0x98bc('0xf0')]){_0x59dae9['createStateFinal'](_0x22af67,_0x186f74,_0x1aba6e,'reason\x2019\x20machine....');}else{_0x59dae9[_0x98bc('0xbd')]({'active':![],'countmachineretry':_0x22af67[_0x98bc('0xe5')],'scheduledat':moment()[_0x98bc('0xf2')](_0xec57b6[_0x98bc('0xf3')],_0x98bc('0xf4'))['format'](_0x98bc('0xf5')),'ContactId':_0x22af67[_0x98bc('0xcd')],'ListId':_0x22af67[_0x98bc('0xce')],'VoiceQueueId':_0x22af67[_0x98bc('0xfd')]||undefined,'CampaignId':_0x22af67['CampaignId']||undefined})[_0x98bc('0xad')](loggerCatch(_0x98bc('0xf6')));_0x186f74({'reschedule':0x1});}}});}}};Dialer[_0x98bc('0xa8')][_0x98bc('0x34')]=function(_0xc4ffff){var _0x4d876e=this['uniqueId'][_0xc4ffff['uniqueid']];var _0x30ae5e=this;var _0x19ae17;if(_0x4d876e&&_0x4d876e[_0x98bc('0x4d')]===_0x98bc('0x77')){delete this[_0x98bc('0xaa')][_0xc4ffff[_0x98bc('0xd9')]];this[_0x98bc('0xaf')](this[_0x98bc('0x20')][_0x4d876e[_0x98bc('0xb0')]]);this['campaigns'][_0x4d876e[_0x98bc('0xb0')]][_0x98bc('0xfe')]+=0x1;_0x19ae17=new Hangup(_0x4d876e,_0xc4ffff);this[_0x98bc('0xc7')](_0x19ae17)['catch'](loggerCatch(_0x98bc('0xff')));this[_0x98bc('0xc5')](_0x19ae17)['catch'](loggerCatch(_0x98bc('0x100')));}if(_0x4d876e&&_0x4d876e[_0x98bc('0x4d')]!==_0x98bc('0x77')&&isNotNull(this[_0x98bc('0x1f')][_0x4d876e['queue']][_0x98bc('0x101')])){delete this[_0x98bc('0xaa')][_0xc4ffff[_0x98bc('0xd9')]];this[_0x98bc('0xaf')](this[_0x98bc('0x1f')][_0x4d876e[_0x98bc('0xb0')]]);this[_0x98bc('0x1f')][_0x4d876e[_0x98bc('0xb0')]][_0x98bc('0x62')]+=0x1;this[_0x98bc('0x1f')][_0x4d876e['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x19ae17=new Hangup(_0x4d876e,_0xc4ffff);_0x19ae17['state']=0x10;_0x19ae17[_0x98bc('0xe0')]=_0x98bc('0x102');_0x19ae17[_0x98bc('0xfa')]=_0x98bc('0x103');this['createHistory'](_0x19ae17)['catch'](loggerCatch(_0x98bc('0xff')));this[_0x98bc('0xc5')](_0x19ae17)[_0x98bc('0xad')](loggerCatch(_0x98bc('0x100')));}if(_0x4d876e&&_0x4d876e[_0x98bc('0x4d')]!==_0x98bc('0x77')&&!isNotNull(this['voiceQueues'][_0x4d876e['queue']][_0x98bc('0x101')])){delete this[_0x98bc('0xaa')][_0xc4ffff[_0x98bc('0xd9')]];this[_0x98bc('0xaf')](this[_0x98bc('0x1f')][_0x4d876e[_0x98bc('0xb0')]]);this[_0x98bc('0x1f')][_0x4d876e[_0x98bc('0xb0')]]['outboundUnknownCallsDay']+=0x1;_0x19ae17=new Hangup(_0x4d876e,_0xc4ffff);_0x19ae17[_0x98bc('0xa6')]=0xc;_0x19ae17[_0x98bc('0xe0')]=_0xc4ffff[_0x98bc('0x104')];_0x19ae17[_0x98bc('0xfa')]=_0x98bc('0x105');this[_0x98bc('0xc7')](_0x19ae17)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x98bc('0xc5')](_0x19ae17)[_0x98bc('0xad')](loggerCatch(_0x98bc('0x100')));}};Dialer[_0x98bc('0xa8')][_0x98bc('0x106')]=function(_0x45d3ff){var _0x113857=this[_0x98bc('0xaa')][_0x45d3ff['uniqueid']];var _0x12c472=this;if(this[_0x98bc('0x1f')][_0x45d3ff[_0x98bc('0xb0')]]){if(_0x113857&&_0x113857[_0x98bc('0x4d')]!=='ivr'){delete this['uniqueId'][_0x45d3ff[_0x98bc('0xd9')]];this['voiceQueues'][_0x45d3ff[_0x98bc('0xb0')]]['outboundAnswerCallsDay']+=0x1;var _0x148f62=new AgentComplete(_0x113857,_0x45d3ff);if(_0x45d3ff[_0x98bc('0x107')]===_0x98bc('0x108')){_0x148f62[_0x98bc('0x109')]=this[_0x98bc('0x1f')][_0x45d3ff[_0x98bc('0xb0')]][_0x98bc('0x10a')]&&this[_0x98bc('0x1f')][_0x45d3ff[_0x98bc('0xb0')]][_0x98bc('0x10b')]?moment()[_0x98bc('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x98bc('0xc7')](_0x148f62)[_0x98bc('0xad')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x98bc('0xc5')](_0x148f62)[_0x98bc('0xad')](loggerCatch(_0x98bc('0x10c')));}}};Dialer[_0x98bc('0xa8')][_0x98bc('0x2e')]=function(_0x56bf62){if(this[_0x98bc('0x1f')][_0x56bf62[_0x98bc('0xb0')]]){if(this[_0x98bc('0xaa')][_0x56bf62[_0x98bc('0xd9')]]&&this[_0x98bc('0xaa')][_0x56bf62[_0x98bc('0xd9')]][_0x98bc('0x4d')]!=='ivr'){this[_0x98bc('0xaf')](this[_0x98bc('0x1f')][_0x56bf62[_0x98bc('0xb0')]]);this[_0x98bc('0xaa')][_0x56bf62['uniqueid']][_0x98bc('0x10d')]=moment()[_0x98bc('0x78')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x98bc('0xa8')]['queueCallerAbandonCreateState']=function(_0x2c21f7){this[_0x98bc('0xc7')](_0x2c21f7)['catch'](loggerCatch(_0x98bc('0x10e')));this[_0x98bc('0xc5')](_0x2c21f7)['catch'](loggerCatch(_0x98bc('0x10f')));};Dialer[_0x98bc('0xa8')][_0x98bc('0x110')]=function(_0x2baf35){var _0xadc83f=this[_0x98bc('0xaa')][_0x2baf35['uniqueid']];var _0x50c378=this;if(this[_0x98bc('0x1f')][_0x2baf35[_0x98bc('0xb0')]]){if(_0xadc83f&&_0xadc83f[_0x98bc('0x4d')]!=='ivr'){delete this[_0x98bc('0xaa')][_0x2baf35['uniqueid']];this[_0x98bc('0xaf')](this[_0x98bc('0x1f')][_0x2baf35[_0x98bc('0xb0')]]);_0xadc83f[_0x98bc('0x111')]=moment()[_0x98bc('0x78')](_0x98bc('0xf5'));var _0x18fc52=new QueueCallerAbandon(_0xadc83f,_0x2baf35);if(getSeconds(_0xadc83f[_0x98bc('0x111')],_0xadc83f['responsetime'])>=_0xadc83f[_0x98bc('0x112')]){this['voiceQueues'][_0x2baf35['queue']][_0x98bc('0x6b')]+=0x1;this[_0x98bc('0x1f')][_0x2baf35['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0x98bc('0x1f')][_0x2baf35[_0x98bc('0xb0')]][_0x98bc('0x113')]+=0x1;_0x18fc52[_0x98bc('0xa6')]=0xa;_0x18fc52[_0x98bc('0xe0')]=_0x98bc('0x114');_0x18fc52['dropreason']=_0x98bc('0x115');_0x18fc52[_0x98bc('0x109')]=this['voiceQueues'][_0x2baf35[_0x98bc('0xb0')]][_0x98bc('0x10a')]?moment()[_0x98bc('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x18fc52[_0x98bc('0xea')]+=0x1;_0x18fc52[_0x98bc('0xe6')]+=0x1;if(_0x18fc52['countdropretry']>=this[_0x98bc('0x1f')][_0x2baf35['queue']]['dialDropMaxRetry']){this['queueCallerAbandonCreateState'](_0x18fc52);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x18fc52[_0x98bc('0xea')],'scheduledat':moment()['add'](this[_0x98bc('0x1f')][_0x2baf35['queue']][_0x98bc('0x116')],'minutes')[_0x98bc('0x78')](_0x98bc('0xf5')),'ContactId':_0xadc83f['ContactId'],'ListId':_0xadc83f[_0x98bc('0xce')],'VoiceQueueId':_0xadc83f[_0x98bc('0xfd')]||undefined,'CampaignId':_0xadc83f[_0x98bc('0xd0')]||undefined})[_0x98bc('0xad')](loggerCatch(_0x98bc('0x117')));var _0x14d27e=new History(_0x18fc52);_0x14d27e['state']=0xa;_0x14d27e['statedesc']=_0x98bc('0x114');_0x14d27e[_0x98bc('0x118')]=moment()['format'](_0x98bc('0xf5'));_0x14d27e['endtime']=_0x14d27e[_0x98bc('0x118')];_0x14d27e[_0x98bc('0x119')]=_0x18fc52[_0x98bc('0x119')];_0x14d27e['calleridnum']=_0x18fc52[_0x98bc('0x11a')];this['createHistory'](_0x14d27e)[_0x98bc('0xad')](loggerCatch(_0x98bc('0x11b')));}}else{this['voiceQueues'][_0x2baf35[_0x98bc('0xb0')]][_0x98bc('0x11c')]+=0x1;this[_0x98bc('0x1f')][_0x2baf35['queue']][_0x98bc('0x66')]+=0x1;_0x18fc52['state']=0xb;_0x18fc52[_0x98bc('0xe0')]=_0x98bc('0x11d');_0x18fc52[_0x98bc('0x11e')]=_0x98bc('0x11f');_0x18fc52[_0x98bc('0xeb')]+=0x1;_0x18fc52[_0x98bc('0xe6')]+=0x1;if(_0x18fc52[_0x98bc('0xeb')]>=this[_0x98bc('0x1f')][_0x2baf35[_0x98bc('0xb0')]][_0x98bc('0x120')]){this['queueCallerAbandonCreateState'](_0x18fc52);}else{this[_0x98bc('0xbd')]({'active':![],'countabandonedretry':_0x18fc52[_0x98bc('0xeb')],'scheduledat':moment()['add'](this[_0x98bc('0x1f')][_0x2baf35['queue']][_0x98bc('0x121')],_0x98bc('0xf4'))[_0x98bc('0x78')](_0x98bc('0xf5')),'ContactId':_0xadc83f[_0x98bc('0xcd')],'ListId':_0xadc83f[_0x98bc('0xce')],'VoiceQueueId':_0xadc83f[_0x98bc('0xfd')]||undefined,'CampaignId':_0xadc83f[_0x98bc('0xd0')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x14d27e=new History(_0x18fc52);_0x14d27e[_0x98bc('0xa6')]=0xb;_0x14d27e[_0x98bc('0xe0')]=_0x98bc('0x11d');_0x14d27e[_0x98bc('0x118')]=moment()[_0x98bc('0x78')](_0x98bc('0xf5'));_0x14d27e[_0x98bc('0xa7')]=_0x14d27e[_0x98bc('0x118')];_0x14d27e['calleridname']=_0x18fc52[_0x98bc('0x119')];_0x14d27e[_0x98bc('0x11a')]=_0x18fc52[_0x98bc('0x11a')];this[_0x98bc('0xc7')](_0x14d27e)[_0x98bc('0xad')](loggerCatch(_0x98bc('0x122')));}}}}};Dialer[_0x98bc('0xa8')][_0x98bc('0x36')]=function(_0x59578c){if(this[_0x98bc('0x25')][_0x59578c['uniqueid']]){this[_0x98bc('0x25')][_0x59578c['uniqueid']]['channel']=_0x59578c[_0x98bc('0x123')];}if(this['uniqueId'][_0x59578c[_0x98bc('0xd9')]]){this['uniqueId'][_0x59578c[_0x98bc('0xd9')]][_0x98bc('0x123')]=_0x59578c[_0x98bc('0x123')];}};Dialer[_0x98bc('0xa8')][_0x98bc('0x124')]=function(_0xb50017){if(strategy[this[_0x98bc('0x1f')][this[_0x98bc('0x25')][_0xb50017[_0x98bc('0x125')]]['queue']][_0x98bc('0x4f')]]===_0x98bc('0x126')){if(this['actions'][_0xb50017[_0x98bc('0x125')]]&&_[_0x98bc('0xac')](this[_0x98bc('0x25')][_0xb50017[_0x98bc('0x125')]][_0x98bc('0x127')])&&_0xb50017['status']==='1'&&_0xb50017[_0x98bc('0x128')]==='0'){if(this['agents'][_0xb50017['stateinterface']]){if(!this[_0x98bc('0x21')][_0xb50017['stateinterface']]['locked']){this[_0x98bc('0x21')][_0xb50017['stateinterface']][_0x98bc('0x127')]=!![];this[_0x98bc('0x25')][_0xb50017[_0x98bc('0x125')]][_0x98bc('0x127')]=!![];this[_0x98bc('0x25')][_0xb50017[_0x98bc('0x125')]][_0x98bc('0x129')]=_0xb50017[_0x98bc('0x129')];}}}}else if((strategy[this[_0x98bc('0x1f')][this['actions'][_0xb50017[_0x98bc('0x125')]][_0x98bc('0xb0')]][_0x98bc('0x4f')]]||_0x98bc('0x1a'))===_0x98bc('0x1a')){if(this[_0x98bc('0x25')][_0xb50017[_0x98bc('0x125')]]){if(this[_0x98bc('0x21')][_0xb50017['stateinterface']]){this['actions'][_0xb50017[_0x98bc('0x125')]][_0x98bc('0x129')]=_0xb50017[_0x98bc('0x129')];if(_[_0x98bc('0xac')](this['queueBooked'][this['actions'][_0xb50017[_0x98bc('0x125')]][_0x98bc('0xb0')]])){this[_0x98bc('0x2b')][this['actions'][_0xb50017[_0x98bc('0x125')]][_0x98bc('0xb0')]]=[];}this[_0x98bc('0x2b')][this[_0x98bc('0x25')][_0xb50017[_0x98bc('0x125')]][_0x98bc('0xb0')]][_0x98bc('0x12a')](_[_0x98bc('0x8d')](_[_0x98bc('0x12b')](this[_0x98bc('0x25')][_0xb50017[_0x98bc('0x125')]],[_0x98bc('0x12c'),_0x98bc('0x129')]),{'status':_0xb50017[_0x98bc('0xd5')],'paused':_0xb50017[_0x98bc('0x128')]}));}}}};function unlockQueueStatus(_0xaaaa61,_0x52bb0a){setTimeout(function(){if(_['isUndefined'](_0xaaaa61['queueStatusComplete'])){loggerBooked['error'](_0x98bc('0x12d'),_0x52bb0a);}_0xaaaa61[_0x98bc('0x12e')]=!![];loggerBooked[_0x98bc('0x7b')](_0x98bc('0x12f'),_0x52bb0a,JSON[_0x98bc('0x4a')](_[_0x98bc('0x12b')](_0xaaaa61,['name',_0x98bc('0x12e')])));},0x1f3);}Dialer[_0x98bc('0xa8')]['syncQueueStatusComplete']=function(_0x2d79ff){var _0xa5c4c5=this;var _0x5422c9=_0xa5c4c5['voiceQueues'][_0xa5c4c5[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]]['queue']];if(strategy[this[_0x98bc('0x1f')][this[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]]['queue']][_0x98bc('0x4f')]]===_0x98bc('0x126')){if(this[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]]&&this[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]][_0x98bc('0x129')]){this[_0x98bc('0x93')][_0x98bc('0x130')](this[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]]['idHopper'],this['actions'][_0x2d79ff['actionid']][_0x98bc('0x129')])[_0x98bc('0xad')](function(_0x426fae){logger[_0x98bc('0x97')](_0x98bc('0x131'),util[_0x98bc('0x98')](_0x426fae,{'showHidden':![],'depth':null}));})[_0x98bc('0x1d')](function(){_0xa5c4c5[_0x98bc('0xaf')](_0xa5c4c5[_0x98bc('0x1f')][_0xa5c4c5[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]]['queue']]);_0xa5c4c5['agents'][_0xa5c4c5[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]][_0x98bc('0x129')]]['locked']=![];delete _0xa5c4c5['actions'][_0x2d79ff[_0x98bc('0x125')]];unlockQueueStatus(_0x5422c9);});}else{this['updateOriginated'](this['voiceQueues'][this[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]][_0x98bc('0xb0')]]);this[_0x98bc('0xbd')]({'active':![],'ContactId':this[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]][_0x98bc('0xcd')],'ListId':this[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]][_0x98bc('0xce')],'VoiceQueueId':this[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]][_0x98bc('0xfd')]||undefined,'CampaignId':this[_0x98bc('0x25')][_0x2d79ff['actionid']][_0x98bc('0xd0')]||undefined})['catch'](loggerCatch(_0x98bc('0x132')));delete this[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]];unlockQueueStatus(_0x5422c9);}}else if((strategy[this[_0x98bc('0x1f')][this[_0x98bc('0x25')][_0x2d79ff['actionid']][_0x98bc('0xb0')]][_0x98bc('0x4f')]]||_0x98bc('0x1a'))===_0x98bc('0x1a')){var _0x2a40c2;if(this[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]]&&!_['isEmpty'](this[_0x98bc('0x2b')][this[_0x98bc('0x25')][_0x2d79ff['actionid']][_0x98bc('0xb0')]])){if(this[_0x98bc('0x2c')][_0xa5c4c5[_0x98bc('0x25')][_0x2d79ff['actionid']]['queue']]){this[_0x98bc('0x2c')][_0xa5c4c5[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]][_0x98bc('0xb0')]]=this[_0x98bc('0x2c')][this[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]][_0x98bc('0xb0')]]?this[_0x98bc('0x2c')][this[_0x98bc('0x25')][_0x2d79ff['actionid']]['queue']]:this[_0x98bc('0x2b')][this[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]][_0x98bc('0xb0')]]?this[_0x98bc('0x2b')][this['actions'][_0x2d79ff[_0x98bc('0x125')]][_0x98bc('0xb0')]][_0x98bc('0x133')]||0x0:0x0;}this[_0x98bc('0x2b')][this[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]]['queue']][_0x98bc('0x133')]=this['queueBookedRR'][this[_0x98bc('0x25')][_0x2d79ff[_0x98bc('0x125')]][_0x98bc('0xb0')]];for(var _0x1e4682=0x0;_0x1e4682=0x0;})[_0x98bc('0xad')](myreject(_0x253d27)));}}else{_0x4c3172[_0x98bc('0x12a')](ami[_0x98bc('0x149')]({'action':_0x98bc('0x14a'),'command':util[_0x98bc('0x78')](_0x98bc('0x14f'),_0x45296c,!_[_0x98bc('0x3d')](config[_0x98bc('0x146')][_0x3a39b7])?_0x3a39b7:'')})[_0x98bc('0xb6')](function(_0x4f2be5){return _0x4f2be5[_0x98bc('0x14c')][_0x98bc('0x14d')](_0x98bc('0x14e'))>=0x0;})['catch'](myreject(_0x253d27)));}BPromise[_0x98bc('0x150')](_0x4c3172)[_0x98bc('0xb6')](function(_0xee406c){var _0x569c13=_[_0x98bc('0x151')](_0xee406c);if(_0x569c13){return _0xdbf2d5(_0x569c13);}else{_0x26d900[_0x98bc('0x3e')]=_0x14089d?_0x98bc('0x152'):_0x98bc('0x153');return _0x253d27(msgResponse(_0x98bc('0x154'),_0x98bc('0x144'),_0x98bc('0x155')+_0x14089d+'\x20'+_0x364dfa+_0x98bc('0x156')+util[_0x98bc('0x98')](_0x45296c,{'showHidden':![],'depth':null})+_0x98bc('0x157')+_0x3a39b7));}})['catch'](function(_0x19df2d){return _0x253d27(msgResponse('ifTime','Failure',JSON[_0x98bc('0x4a')](_0x19df2d)));});});};Dialer[_0x98bc('0xa8')]['checkDialMethod']=function(_0x70c6f0){var _0x25b93b=this;return function(){switch(_0x70c6f0['dialMethod']){case _0x98bc('0x158'):freeVariablesPredictive(_0x70c6f0);_0x25b93b[_0x98bc('0x159')](_0x70c6f0,0x1);break;case _0x98bc('0x15a'):freeVariablesPredictive(_0x70c6f0);_0x25b93b['handlePower'](_0x70c6f0,_0x70c6f0[_0x98bc('0x15b')]);break;case _0x98bc('0x9'):_0x25b93b[_0x98bc('0x9')](_0x70c6f0);break;case _0x98bc('0x8'):freeVariablesPredictive(_0x70c6f0);_0x25b93b[_0x98bc('0x159')](_0x70c6f0,0x1);break;default:freeVariablesPredictive(_0x70c6f0);logger[_0x98bc('0x97')](_0x98bc('0x15c'),_0x70c6f0[_0x98bc('0x40')],'method\x20not\x20recognized');}};};Dialer[_0x98bc('0xa8')]['launchHandleIvr']=function(_0x2e2ec5){var _0x1154cd=this;return function(){_0x1154cd[_0x98bc('0x15d')](_0x2e2ec5);};};Dialer[_0x98bc('0xa8')][_0x98bc('0xb')]=function(_0x56acc2){var _0x28762d=this;if(isNotPreview(_0x56acc2[_0x98bc('0x15e')])){if(isVoiceQueueOutbound(_0x56acc2[_0x98bc('0x4d')])&&isActive(_0x56acc2['dialActive'])){_0x56acc2[_0x98bc('0xa0')]=!![];BPromise[_0x98bc('0xb3')]()[_0x98bc('0xb6')](checkIsLoggedIn(_0x56acc2,_0x56acc2['loggedIn']))['then'](checkIsActive(_0x56acc2,_0x56acc2[_0x98bc('0x5c')]))['then'](checkInterval(_0x56acc2))[_0x98bc('0xb6')](_0x28762d[_0x98bc('0x15f')](_0x56acc2))[_0x98bc('0xb6')](_0x28762d[_0x98bc('0x141')](_0x56acc2[_0x98bc('0x160')],_0x56acc2[_0x98bc('0x161')],_0x56acc2[_0x98bc('0x40')],_0x56acc2))[_0x98bc('0xb6')](_0x28762d[_0x98bc('0x143')](_0x56acc2[_0x98bc('0x43')],_0x56acc2[_0x98bc('0x161')],_0x56acc2['name'],_0x56acc2))[_0x98bc('0xb6')](_0x28762d['checkDialMethod'](_0x56acc2))[_0x98bc('0xad')](loggerCatchQueueSummary('[syncQueueSummary]',_0x56acc2));}else{notSendMessagesQueue(_0x56acc2);}}else{freeVariablesPredictive(_0x56acc2);}};Dialer[_0x98bc('0xa8')][_0x98bc('0x162')]=function(){var _0x26a4ee=this;var _0x1fc09c;for(var _0x597eb9 in this[_0x98bc('0x20')]){if(typeof this['campaigns'][_0x597eb9]!==_0x98bc('0x9a')){_0x1fc09c=this[_0x98bc('0x20')][_0x597eb9];if(isCampaignIvr(_0x1fc09c[_0x98bc('0x4d')])&&isActive(_0x1fc09c[_0x98bc('0x74')])){_0x1fc09c['sendMessageOneNotActive']=!![];BPromise[_0x98bc('0xb3')]()[_0x98bc('0xb6')](checkIsActive(_0x1fc09c,_0x1fc09c[_0x98bc('0x74')]))['then'](checkInterval(_0x1fc09c))[_0x98bc('0xb6')](_0x26a4ee[_0x98bc('0x15f')](_0x1fc09c))[_0x98bc('0xb6')](_0x26a4ee[_0x98bc('0x141')](_0x1fc09c[_0x98bc('0x160')],_0x1fc09c[_0x98bc('0x161')],_0x1fc09c['name'],_0x1fc09c))['then'](_0x26a4ee[_0x98bc('0x143')](_0x1fc09c[_0x98bc('0x43')],_0x1fc09c['dialTimezone'],_0x1fc09c[_0x98bc('0x40')],_0x1fc09c))['then'](_0x26a4ee[_0x98bc('0x163')](_0x1fc09c))[_0x98bc('0xad')](loggerCatchQueueSummary('[syncCampaigns]',_0x1fc09c));}else{notSendMessagesCampaign(_0x1fc09c);}}}};function getCallerIdRandom(_0x3e7a2d,_0x40d9dd){var _0x8aa905;var _0x5ee06b;var _0x36180a;if(_0x40d9dd<=0x0){_0x40d9dd=0x1;}_0x8aa905=new RegExp('\x5cw{0,'+_0x40d9dd+'}$');_0x5ee06b=Math[_0x98bc('0x164')](0xa,_0x40d9dd-0x1);_0x36180a=Math['pow'](0xa,_0x40d9dd)-0x1;return util[_0x98bc('0x78')]('%s',_['replace'](_0x3e7a2d,_0x8aa905,_['random'](_0x5ee06b,_0x36180a)));}function extractCalleridName(_0x207423){var _0x331d88=_0x207423[_0x98bc('0x165')](/"(.*?)"/);return _0x331d88?_0x331d88[0x1]:_0x207423;}function extractCalleridNumber(_0x7b3844){var _0x2ec225=_0x7b3844[_0x98bc('0x165')](/<(.*?)>/);return _0x2ec225?_0x2ec225[0x1]:_0x7b3844;}Dialer[_0x98bc('0xa8')][_0x98bc('0x166')]=function(_0xc4990c,_0x184ff1){var _0x263138=this;var _0x756549=uuid['v4']();this['actions'][_0x756549]=new Action(_0xc4990c,_0x184ff1,_0x756549);return new BPromise(function(_0x1d290b,_0x4f1348){if(_[_0x98bc('0x3d')](_0xc4990c)&&typeof _0xc4990c!==_0x98bc('0x167')){return _0x4f1348(msgResponse('originate','Failure',_0x98bc('0x168')));}if(_['isUndefined'](_0x184ff1[_0x98bc('0x169')][_0x98bc('0x16a')])||_0x184ff1[_0x98bc('0x169')]['phone']===null){return _0x4f1348(msgResponse(_0x98bc('0x16b'),_0x98bc('0x144'),_0x98bc('0x16c')));}var _0x1c767a={'XMD-CALLERID':_0x263138[_0x98bc('0x25')][_0x756549]['getCaller'](),'XMD-AGI':_0xc4990c[_0x98bc('0x101')]?util[_0x98bc('0x78')](_0x98bc('0x16d'),ipAgi,_0xc4990c[_0x98bc('0x101')]):'NONE','XMD-AGIAFTER':_0xc4990c[_0x98bc('0x10a')]?util[_0x98bc('0x78')]('\x22agi://%s/square,%s\x22',ipAgi,_0xc4990c[_0x98bc('0x10a')]):_0x98bc('0x16e'),'XMD-QUEUE':_0xc4990c[_0x98bc('0x4d')]==='outbound'?util['format'](_0x98bc('0x16f'),_0xc4990c[_0x98bc('0x40')],_0xc4990c[_0x98bc('0x170')]||'',_0xc4990c[_0x98bc('0x10b')]?'c':'',_0xc4990c[_0x98bc('0x112')]||0x3):_0x98bc('0x16e'),'XMD-CONTACTID':_0x184ff1[_0x98bc('0xcd')],'XMD-CDRTYPE':_0x98bc('0x6'),'CALLERID(all)':_0x263138[_0x98bc('0x25')][_0x756549][_0x98bc('0x171')](),'XMD-AMD':_0xc4990c[_0x98bc('0xdd')]?'ACTIVE':_0x98bc('0x16e'),'XMD-DESTINATION':_0x98bc('0x172')};if(_0xc4990c[_0x98bc('0xdd')]){_0x1c767a['XMD-AMDINITIALSILENCE']=_0xc4990c[_0x98bc('0x173')]||0x9c4;_0x1c767a['XMD-AMDGREETING']=_0xc4990c[_0x98bc('0x174')]||0x5dc;_0x1c767a[_0x98bc('0x175')]=_0xc4990c[_0x98bc('0x176')]||0x320;_0x1c767a[_0x98bc('0x177')]=_0xc4990c[_0x98bc('0x178')]||0x1388;_0x1c767a[_0x98bc('0x179')]=_0xc4990c[_0x98bc('0x17a')]||0x64;_0x1c767a['XMD-AMDBETWEENWORDSSILENCE']=_0xc4990c[_0x98bc('0x17b')]||0x32;_0x1c767a[_0x98bc('0x17c')]=_0xc4990c[_0x98bc('0x17d')]||0x3;_0x1c767a[_0x98bc('0x17e')]=_0xc4990c[_0x98bc('0x17f')]||0x100;_0x1c767a['XMD-AMDMAXIMUMWORDLENGTH']=_0xc4990c[_0x98bc('0x180')]||0x1388;}if(_0xc4990c[_0x98bc('0x4d')]===_0x98bc('0x4e')){_0x1c767a[_0x98bc('0x181')]=_0x184ff1[_0x98bc('0xfd')];}else{_0x1c767a[_0x98bc('0x182')]=_0x184ff1[_0x98bc('0xd0')];}for(var _0x21fd7b in _0x184ff1[_0x98bc('0x169')]){if(typeof _0x184ff1[_0x98bc('0x169')][_0x21fd7b]!==_0x98bc('0x9a')){if(isNotNull(_0x184ff1[_0x98bc('0x169')][_0x21fd7b])&&_0x21fd7b!=='id'&&_0x21fd7b!==_0x98bc('0x183')&&_0x21fd7b!==_0x98bc('0x184')&&_0x21fd7b!==_0x98bc('0x185')){_0x1c767a[util[_0x98bc('0x78')](_0x98bc('0x186'),_0x98bc('0x187'),_[_0x98bc('0x188')](_0x21fd7b))]=_0x184ff1['Contact'][_0x21fd7b];}}}var _0x31dd69=_0x263138[_0x98bc('0xd4')](_0xc4990c['Trunk'])?getCallerId(_0xc4990c['Trunk']['callerid'],_0xc4990c['dialOriginateCallerIdName'],_0xc4990c[_0x98bc('0x189')]>0x0?getCallerIdRandom(_0xc4990c['dialOriginateCallerIdNumber'],_0xc4990c[_0x98bc('0x189')]):_0xc4990c['dialOriginateCallerIdNumber']):getCallerId(_[_0x98bc('0xac')](_0xc4990c[_0x98bc('0x13f')])?_0xc4990c[_0x98bc('0x73')][_0x98bc('0x18a')]:_0xc4990c[_0x98bc('0x13f')][_0x98bc('0x18a')],_0xc4990c[_0x98bc('0x5d')],_0xc4990c[_0x98bc('0x189')]>0x0?getCallerIdRandom(_0xc4990c[_0x98bc('0x5e')],_0xc4990c['dialRandomLastDigitCallerIdNumber']):_0xc4990c[_0x98bc('0x5e')]);if(_0x31dd69){_0x1c767a[_0x98bc('0x18b')]=_0x263138[_0x98bc('0x25')][_0x756549][_0x98bc('0x18c')]=extractCalleridName(_0x31dd69);_0x1c767a['XMD-ORIGINATECALLERIDNUM']=_0x263138[_0x98bc('0x25')][_0x756549][_0x98bc('0x18d')]=extractCalleridNumber(_0x31dd69);}return ami[_0x98bc('0x149')]({'actionid':_0x756549,'action':_0x98bc('0x16b'),'channel':_0x263138[_0x98bc('0xd4')](_0xc4990c[_0x98bc('0x73')])?util[_0x98bc('0x78')](_0x98bc('0x18e'),_0xc4990c[_0x98bc('0x73')][_0x98bc('0x40')],isNotNull(_0xc4990c['dialPrefix'])?_0xc4990c[_0x98bc('0x60')][_0x98bc('0x18f')]()||'':'',_0xc4990c[_0x98bc('0x190')]>0x0?_0x184ff1['Contact'][_0x98bc('0x16a')][_0x98bc('0x191')](_0xc4990c[_0x98bc('0x190')]):_0x184ff1[_0x98bc('0x169')][_0x98bc('0x16a')]):util[_0x98bc('0x78')](_0x98bc('0x18e'),_[_0x98bc('0xac')](_0xc4990c[_0x98bc('0x13f')])?_0xc4990c[_0x98bc('0x73')][_0x98bc('0x40')]:_0xc4990c['TrunkBackup'][_0x98bc('0x40')],isNotNull(_0xc4990c[_0x98bc('0x60')])?_0xc4990c[_0x98bc('0x60')]['trim']()||'':'',_0xc4990c[_0x98bc('0x190')]>0x0?_0x184ff1['Contact'][_0x98bc('0x16a')][_0x98bc('0x191')](_0xc4990c['dialCutDigit']):_0x184ff1['Contact'][_0x98bc('0x16a')]),'callerid':_0x31dd69,'Exten':_0x98bc('0x172'),'Context':_0x98bc('0x192'),'Priority':'1','variable':_0x1c767a,'timeout':(_0xc4990c[_0x98bc('0x5f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x756549})['then'](function(_0x5e9d96){return _0x1d290b(_0x5e9d96);})[_0x98bc('0xad')](function(_0x1fbb99){_0xc4990c[_0x98bc('0x193')]+=0x1;var _0x7187b1=new History(_0x263138[_0x98bc('0x25')][_0x756549]);logger[_0x98bc('0x97')](util[_0x98bc('0x78')]('[originateError]:\x20%s',JSON[_0x98bc('0x4a')](_0x1fbb99)));_0x7187b1[_0x98bc('0xa6')]=0xe;_0x7187b1[_0x98bc('0xe0')]='OriginateError';_0x7187b1[_0x98bc('0x118')]=moment()[_0x98bc('0x78')](_0x98bc('0xf5'));_0x7187b1[_0x98bc('0xa7')]=_0x7187b1[_0x98bc('0x118')];_0x263138['createHistory'](_0x7187b1)['catch'](loggerCatch(_0x98bc('0x194')));_0x263138[_0x98bc('0xc5')](_0x7187b1)[_0x98bc('0xad')](loggerCatch('[originate][error]'))[_0x98bc('0x1d')](function(){delete _0x263138[_0x98bc('0x25')][_0x756549];return _0x4f1348(msgResponse('originate',_0x98bc('0x49'),'originate\x20action\x20Error'));});});});};Dialer[_0x98bc('0xa8')][_0x98bc('0x31')]=function(_0x22df7c){var _0x45fd56=this['actions'][_0x22df7c[_0x98bc('0x125')]];if(_0x45fd56){delete this[_0x98bc('0x25')][_0x22df7c[_0x98bc('0x125')]];_0x45fd56[_0x98bc('0x195')]=moment()['format'](_0x98bc('0xf5'));var _0x28fabd=_0x45fd56[_0x98bc('0x4d')]==='ivr'?this[_0x98bc('0x20')][_0x45fd56['queue']]:this['voiceQueues'][_0x45fd56[_0x98bc('0x196')]()];if(!this['isSuccess'](_0x22df7c[_0x98bc('0x197')])){this[_0x98bc('0xaf')](_0x28fabd);return this[_0x98bc('0x198')](_0x45fd56,_0x28fabd,_0x22df7c)[_0x98bc('0xad')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x98bc('0xaa')][_0x22df7c[_0x98bc('0xd9')]]=_0x45fd56;}};Dialer[_0x98bc('0xa8')]['checkRetriveMax']=function(_0x2f7b1f,_0x3ed009,_0x393662){var _0x479a89=new History(_0x3ed009);if(_0x479a89[_0x98bc('0xe8')]+_0x479a89['countcongestionretry']+_0x479a89[_0x98bc('0xfb')]+_0x479a89[_0x98bc('0xfc')]+_0x479a89['countdropretry']+_0x479a89[_0x98bc('0xeb')]+_0x479a89[_0x98bc('0xe5')]+_0x479a89[_0x98bc('0xec')]>=_0x393662[_0x98bc('0xed')]-0x1){return!![];}switch(_0x2f7b1f){case 0x3:if(_0x479a89[_0x98bc('0xfb')]>=_0x393662[_0x98bc('0x199')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x479a89['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x98bc('0xf2')](_0x393662[_0x98bc('0x19a')],'minutes')[_0x98bc('0x78')](_0x98bc('0xf5')),'ContactId':_0x479a89[_0x98bc('0xcd')],'ListId':_0x479a89[_0x98bc('0xce')],'VoiceQueueId':_0x479a89[_0x98bc('0xfd')]||undefined,'CampaignId':_0x479a89[_0x98bc('0xd0')]||undefined})['catch'](loggerCatch(_0x98bc('0x19b')));break;case 0x5:if(_0x479a89['countbusyretry']>=_0x393662['dialBusyMaxRetry']-0x1){return!![];}this[_0x98bc('0xbd')]({'active':![],'countbusyretry':_0x479a89['countbusyretry']+=0x1,'scheduledat':moment()[_0x98bc('0xf2')](_0x393662[_0x98bc('0x19c')],_0x98bc('0xf4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x479a89[_0x98bc('0xcd')],'ListId':_0x479a89[_0x98bc('0xce')],'VoiceQueueId':_0x479a89['VoiceQueueId']||undefined,'CampaignId':_0x479a89[_0x98bc('0xd0')]||undefined})[_0x98bc('0xad')](loggerCatch(_0x98bc('0x19d')));break;case 0x8:if(_0x479a89['countcongestionretry']>=_0x393662['dialCongestionMaxRetry']-0x1){return!![];}this[_0x98bc('0xbd')]({'active':![],'countcongestionretry':_0x479a89['countcongestionretry']+=0x1,'scheduledat':moment()[_0x98bc('0xf2')](_0x393662['dialCongestionRetryFrequency'],_0x98bc('0xf4'))[_0x98bc('0x78')](_0x98bc('0xf5')),'ContactId':_0x479a89[_0x98bc('0xcd')],'ListId':_0x479a89[_0x98bc('0xce')],'VoiceQueueId':_0x479a89[_0x98bc('0xfd')]||undefined,'CampaignId':_0x479a89[_0x98bc('0xd0')]||undefined})[_0x98bc('0xad')](loggerCatch(_0x98bc('0x19e')));break;case 0x0:if(_0x479a89['countnosuchnumberretry']>=_0x393662[_0x98bc('0x19f')]-0x1){return!![];}else{this[_0x98bc('0xbd')]({'active':![],'countnosuchnumberretry':_0x479a89[_0x98bc('0xfc')]+=0x1,'scheduledat':moment()[_0x98bc('0xf2')](_0x393662[_0x98bc('0x1a0')],_0x98bc('0xf4'))[_0x98bc('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x479a89[_0x98bc('0xcd')],'ListId':_0x479a89[_0x98bc('0xce')],'VoiceQueueId':_0x479a89['VoiceQueueId']||undefined,'CampaignId':_0x479a89['CampaignId']||undefined})[_0x98bc('0xad')](loggerCatch(_0x98bc('0x1a1')));}break;case 0xa:if(_0x479a89[_0x98bc('0xea')]>=_0x393662[_0x98bc('0x1a2')]-0x1){return!![];}this[_0x98bc('0xbd')]({'active':![],'countdropretry':_0x479a89[_0x98bc('0xea')]+=0x1,'scheduledat':moment()[_0x98bc('0xf2')](_0x393662['dialDropRetryFrequency'],_0x98bc('0xf4'))['format'](_0x98bc('0xf5')),'ContactId':_0x479a89[_0x98bc('0xcd')],'ListId':_0x479a89['ListId'],'VoiceQueueId':_0x479a89['VoiceQueueId']||undefined,'CampaignId':_0x479a89[_0x98bc('0xd0')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x479a89[_0x98bc('0xeb')]>=_0x393662['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x98bc('0xbd')]({'active':![],'countabandonedretry':_0x479a89[_0x98bc('0xeb')]+=0x1,'scheduledat':moment()[_0x98bc('0xf2')](_0x393662['dialAbandonedRetryFrequency'],_0x98bc('0xf4'))[_0x98bc('0x78')](_0x98bc('0xf5')),'ContactId':_0x479a89[_0x98bc('0xcd')],'ListId':_0x479a89[_0x98bc('0xce')],'VoiceQueueId':_0x479a89[_0x98bc('0xfd')]||undefined,'CampaignId':_0x479a89[_0x98bc('0xd0')]||undefined})[_0x98bc('0xad')](loggerCatch(_0x98bc('0x1a3')));break;case 0x13:if(_0x479a89[_0x98bc('0xe5')]>=_0x393662[_0x98bc('0xf0')]-0x1){return!![];}this[_0x98bc('0xbd')]({'active':![],'countmachineretry':_0x479a89[_0x98bc('0xe5')]+=0x1,'scheduledat':moment()[_0x98bc('0xf2')](_0x393662[_0x98bc('0xf3')],_0x98bc('0xf4'))[_0x98bc('0x78')](_0x98bc('0xf5')),'ContactId':_0x479a89['ContactId'],'ListId':_0x479a89['ListId'],'VoiceQueueId':_0x479a89[_0x98bc('0xfd')]||undefined,'CampaignId':_0x479a89[_0x98bc('0xd0')]||undefined})[_0x98bc('0xad')](loggerCatch(_0x98bc('0xf6')));break;case 0x14:if(_0x479a89[_0x98bc('0xec')]>=_0x393662[_0x98bc('0x1a4')]-0x1){return!![];}this[_0x98bc('0xbd')]({'active':![],'countagentrejectretry':_0x479a89[_0x98bc('0xec')]+=0x1,'scheduledat':moment()['add'](_0x393662[_0x98bc('0x1a5')],_0x98bc('0xf4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x479a89[_0x98bc('0xcd')],'ListId':_0x479a89[_0x98bc('0xce')],'VoiceQueueId':_0x479a89['VoiceQueueId']||undefined,'CampaignId':_0x479a89[_0x98bc('0xd0')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x98bc('0xa8')]['callProgressDetecting']=function(_0x5a9de5,_0x476ba4,_0x1361b2){var _0x63a7ea=this;var _0x6dc28e=new History(_0x5a9de5);return new BPromise(function(_0x150bdd,_0x14e2a8){if(_[_0x98bc('0x3d')](_0x476ba4)&&typeof _0x476ba4!==_0x98bc('0x167')){return _0x14e2a8(msgResponse(_0x98bc('0x1a6'),_0x98bc('0x144'),_0x98bc('0x1a7')));}if(_[_0x98bc('0x3d')](_0x1361b2)&&typeof _0x1361b2!==_0x98bc('0x167')){return _0x14e2a8(msgResponse(_0x98bc('0x1a6'),_0x98bc('0x144'),_0x98bc('0x1a8')));}switch(_0x1361b2['reason']){case'0':_0x476ba4[_0x98bc('0x1a9')]+=0x1;_0x6dc28e['state']=0x0;_0x6dc28e['statedesc']=_0x98bc('0x1aa');_0x6dc28e['countnosuchnumberretry']+=0x1;_0x6dc28e[_0x98bc('0xe6')]+=0x1;ami[_0x98bc('0x4c')](_0x98bc('0x1ab'),ut['buildObj'](_0x5a9de5,_0x98bc('0x1ac')));_0x63a7ea['createHistory'](_0x6dc28e)[_0x98bc('0xad')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x63a7ea['checkRetriveMax'](0x0,_0x5a9de5,_0x476ba4)){if(_0x6dc28e[_0x98bc('0xfc')]>=_0x476ba4[_0x98bc('0x19f')]){_0x63a7ea[_0x98bc('0xf1')](_0x6dc28e,_0x150bdd,_0x14e2a8,'reason\x200\x20no\x20such\x20number....');}else{_0x63a7ea[_0x98bc('0xee')](_0x6dc28e,_0x150bdd,_0x14e2a8,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x476ba4['outboundNoAnswerCallsDay']+=0x1;_0x6dc28e['state']=0x3;_0x6dc28e[_0x98bc('0xe0')]=_0x98bc('0x1ad');_0x6dc28e[_0x98bc('0xfb')]+=0x1;_0x6dc28e['countglobal']+=0x1;ami[_0x98bc('0x4c')](_0x98bc('0x1ae'),ut[_0x98bc('0x1af')](_0x5a9de5,_0x98bc('0x1b0')));_0x63a7ea[_0x98bc('0xc7')](_0x6dc28e)[_0x98bc('0xad')](loggerCatch(_0x98bc('0x1b1')));if(_0x63a7ea['checkRetriveMax'](0x3,_0x5a9de5,_0x476ba4)){if(_0x6dc28e[_0x98bc('0xfb')]>=_0x476ba4[_0x98bc('0x199')]){_0x63a7ea['createStateFinal'](_0x6dc28e,_0x150bdd,_0x14e2a8,_0x98bc('0x1b2'));}else{_0x63a7ea[_0x98bc('0xee')](_0x6dc28e,_0x150bdd,_0x14e2a8,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x476ba4[_0x98bc('0x1b3')]+=0x1;_0x6dc28e[_0x98bc('0xa6')]=0x5;_0x6dc28e[_0x98bc('0xe0')]=_0x98bc('0x1b4');_0x6dc28e[_0x98bc('0xe8')]+=0x1;_0x6dc28e['countglobal']+=0x1;ami[_0x98bc('0x4c')](_0x98bc('0x1b5'),ut[_0x98bc('0x1af')](_0x5a9de5,'busy'));_0x63a7ea[_0x98bc('0xc7')](_0x6dc28e)[_0x98bc('0xad')](loggerCatch(_0x98bc('0x1b6')));if(_0x63a7ea['checkRetriveMax'](0x5,_0x5a9de5,_0x476ba4)){if(_0x6dc28e['countbusyretry']>=_0x476ba4[_0x98bc('0x1b7')]){_0x63a7ea['createStateFinal'](_0x6dc28e,_0x150bdd,_0x14e2a8,_0x98bc('0x1b8'));}else{_0x63a7ea['stateGlobal'](_0x6dc28e,_0x150bdd,_0x14e2a8,_0x98bc('0x1b8'));}}break;case'8':_0x476ba4[_0x98bc('0x64')]+=0x1;_0x6dc28e[_0x98bc('0xa6')]=0x8;_0x6dc28e[_0x98bc('0xe0')]=_0x98bc('0x1b9');_0x6dc28e[_0x98bc('0xe9')]+=0x1;_0x6dc28e[_0x98bc('0xe6')]+=0x1;ami[_0x98bc('0x4c')]('custom:agentcongestion',ut['buildObj'](_0x5a9de5,_0x98bc('0x1ba')));_0x63a7ea['createHistory'](_0x6dc28e)[_0x98bc('0xad')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x63a7ea[_0x98bc('0x1bb')](0x8,_0x5a9de5,_0x476ba4)){if(_0x6dc28e[_0x98bc('0xe9')]>=_0x476ba4[_0x98bc('0x1bc')]){_0x63a7ea[_0x98bc('0xf1')](_0x6dc28e,_0x150bdd,_0x14e2a8,_0x98bc('0x1bd'));}else{_0x63a7ea['stateGlobal'](_0x6dc28e,_0x150bdd,_0x14e2a8,_0x98bc('0x1bd'));}}break;case'11':_0x476ba4['outboundAbandonedCallsDay']+=0x1;_0x6dc28e[_0x98bc('0xa6')]=0xb;_0x6dc28e['statedesc']=_0x98bc('0x11d');_0x6dc28e[_0x98bc('0xeb')]+=0x1;_0x6dc28e[_0x98bc('0xe6')]+=0x1;_0x63a7ea['createHistory'](_0x6dc28e)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x63a7ea[_0x98bc('0x1bb')](0xb,_0x5a9de5,_0x476ba4)){if(_0x6dc28e[_0x98bc('0xeb')]>=_0x476ba4[_0x98bc('0x120')]){_0x63a7ea['createStateFinal'](_0x6dc28e,_0x150bdd,_0x14e2a8,'reason\x2011\x20abandoned');}else{_0x63a7ea[_0x98bc('0xee')](_0x6dc28e,_0x150bdd,_0x14e2a8,_0x98bc('0x1be'));}}break;case'20':_0x476ba4['outboundRejectCallsDay']+=0x1;_0x6dc28e[_0x98bc('0xa6')]=0x14;_0x6dc28e[_0x98bc('0xe0')]=_0x98bc('0x1bf');_0x6dc28e[_0x98bc('0xec')]+=0x1;_0x6dc28e['countglobal']+=0x1;ami[_0x98bc('0x4c')](_0x98bc('0x1c0'),ut[_0x98bc('0x1af')](_0x5a9de5,_0x98bc('0x1c1')));_0x63a7ea[_0x98bc('0xc7')](_0x6dc28e)[_0x98bc('0xad')](loggerCatch(_0x98bc('0x1c2')));if(_0x63a7ea[_0x98bc('0x1bb')](0x14,_0x5a9de5,_0x476ba4)){if(_0x6dc28e['countagentrejectretry']>=_0x476ba4['dialAgentRejectMaxRetry']){_0x63a7ea['createStateFinal'](_0x6dc28e,_0x150bdd,_0x14e2a8,_0x98bc('0x1c3'));}else{_0x63a7ea[_0x98bc('0xee')](_0x6dc28e,_0x150bdd,_0x14e2a8,_0x98bc('0x1c3'));}}break;default:_0x476ba4[_0x98bc('0x1c4')]+=0x1;_0x6dc28e['state']=0xc;_0x6dc28e[_0x98bc('0xe0')]=_0x1361b2['reason'];_0x63a7ea[_0x98bc('0xc7')](_0x6dc28e)[_0x98bc('0xad')](loggerCatch(_0x98bc('0x1c5')));if(_0x63a7ea[_0x98bc('0x1bb')](_0x1361b2['reason'],_0x5a9de5,_0x476ba4)){if(_0x6dc28e['countbusyretry']+_0x6dc28e['countcongestionretry']+_0x6dc28e['countnoanswerretry']+_0x6dc28e[_0x98bc('0xfc')]+_0x6dc28e['countdropretry']+_0x6dc28e[_0x98bc('0xeb')]+_0x6dc28e[_0x98bc('0xe5')]+_0x6dc28e['countagentrejectretry']>=_0x476ba4[_0x98bc('0xed')]){_0x63a7ea['stateGlobal'](_0x6dc28e,_0x150bdd,_0x14e2a8,_0x1361b2[_0x98bc('0x107')]);}else{_0x63a7ea['createStateFinal'](_0x6dc28e,_0x150bdd,_0x14e2a8,_0x1361b2['reason']);}}}});};Dialer[_0x98bc('0xa8')][_0x98bc('0xee')]=function(_0x263a20,_0x46e6ce,_0x248f08,_0x36de5d){var _0x53f59e=new Final(_0x263a20);_0x53f59e['state']=0xf;_0x53f59e[_0x98bc('0xe0')]=_0x98bc('0x1c6');this[_0x98bc('0xf1')](_0x53f59e,_0x46e6ce,_0x248f08,_0x36de5d);};Dialer[_0x98bc('0xa8')][_0x98bc('0xf1')]=function(_0x5cad7b,_0x14dd56,_0x5be293,_0x54e621){this['moveContactManagedDialer'](_0x5cad7b)['then'](function(){return _0x14dd56(msgResponse('[callProgressDetecting]',_0x98bc('0xd3'),_0x54e621));})[_0x98bc('0xad')](function(){return _0x5be293(msgResponse(_0x98bc('0x1c7'),_0x98bc('0x144'),_0x98bc('0x1c8')));});};Dialer['prototype'][_0x98bc('0x9')]=function(_0x16e20d){var _0x5ec49b=_0x16e20d['dialPredictiveOptimizationPercentage']/0x64;var _0x26ab68=_0x16e20d['outboundDropCallsDayTimeout']/(_0x16e20d[_0x98bc('0x67')]+_0x16e20d[_0x98bc('0x62')]);var _0x576546=Math[_0x98bc('0x1c9')](_0x16e20d['predictiveIntervalAvailable']*(_0x16e20d[_0x98bc('0x1ca')]/0x64));var _0x3c0b44=Math[_0x98bc('0x1c9')](_0x16e20d[_0x98bc('0x1cb')]*(_0x16e20d[_0x98bc('0x1cc')]/0x64));var _0x288ae5=_0x16e20d[_0x98bc('0x51')]+_0x16e20d[_0x98bc('0x57')];var _0x23b320=Math[_0x98bc('0x1cd')](_0x16e20d[_0x98bc('0x89')]*_0x16e20d[_0x98bc('0x71')]*_0x16e20d[_0x98bc('0x6c')]*_0x16e20d[_0x98bc('0x1ce')]);if(_[_0x98bc('0x3d')](_0x16e20d[_0x98bc('0x29')])){if(!_['isUndefined'](_0x16e20d[_0x98bc('0x28')])){_0x16e20d[_0x98bc('0x28')]=undefined;loggerPredictive[_0x98bc('0x97')](_0x98bc('0x1cf'),_0x98bc('0x1d0'));}if(!_[_0x98bc('0x3d')](_0x16e20d[_0x98bc('0x91')])){loggerPredictive['error'](_0x98bc('0x1cf'),_0x98bc('0x1d1'));clearInterval(_0x16e20d['handlePredictive']);_0x16e20d[_0x98bc('0x91')]=undefined;}_0x16e20d[_0x98bc('0x29')]=moment()[_0x98bc('0x78')](_0x98bc('0xf5'));loggerPredictive[_0x98bc('0x7b')](_0x16e20d[_0x98bc('0x40')],_0x98bc('0x1d2'),_0x16e20d[_0x98bc('0x29')]);this['handlePower'](_0x16e20d,0x1);}else if(ifInterval(_0x16e20d['dialPredictiveInterval'],_0x16e20d[_0x98bc('0x29')])){this[_0x98bc('0x159')](_0x16e20d,0x1);loggerPredictiveCalls[_0x98bc('0x7b')](_0x98bc('0x1d3'),_0x16e20d[_0x98bc('0x29')],_0x16e20d['name']);_0x16e20d[_0x98bc('0x89')]=0x0;_0x16e20d[_0x98bc('0x113')]=0x0;}else if(_0x5ec49b<_0x26ab68&&_0x16e20d[_0x98bc('0x1d4')]==='dropRate'){freeVariablesPredictive(_0x16e20d);loggerPredictive['info'](_0x98bc('0x1d5'),_0x98bc('0x1d6'),_0x26ab68,_0x98bc('0x29'),_0x16e20d[_0x98bc('0x40')]);}else if(_0x23b320<_0x16e20d['predictiveIntervalErlangCallsDroppedCalls']&&_0x16e20d[_0x98bc('0x1d4')]===_0x98bc('0x1d7')){freeVariablesPredictive(_0x16e20d);loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x1d8'),_0x98bc('0x1d9'),_0x23b320,_0x98bc('0x1da'),_0x16e20d[_0x98bc('0x113')],_0x98bc('0x29'),_0x16e20d[_0x98bc('0x40')]);}else if(!ifInterval(_0x16e20d[_0x98bc('0x1db')],_0x16e20d[_0x98bc('0x29')])&&_[_0x98bc('0x3d')](_0x16e20d['startPredictive'])&&!_[_0x98bc('0x3d')](_0x16e20d[_0x98bc('0x29')])){_0x16e20d['startPredictive']=moment()['format'](_0x98bc('0xf5'));loggerPredictive['info'](_0x16e20d['name'],'started\x20in\x20predictive\x20at',_0x16e20d[_0x98bc('0x28')]);this[_0x98bc('0xba')](_0x16e20d[_0x98bc('0x1db')])[_0x98bc('0xb6')](this['getDataPredictive'](_0x16e20d))['then'](mergeDataErlangB(_0x16e20d))[_0x98bc('0xb6')](this[_0x98bc('0x1dc')](_0x16e20d))[_0x98bc('0xad')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x16e20d));}else if(!ifInterval(_0x16e20d[_0x98bc('0x1db')],_0x16e20d[_0x98bc('0x28')])){_0x16e20d[_0x98bc('0x113')]=0x0;_0x16e20d['startPredictive']=moment()[_0x98bc('0x78')](_0x98bc('0xf5'));loggerPredictive[_0x98bc('0x7b')](_0x16e20d[_0x98bc('0x40')],_0x98bc('0x1dd'),_0x16e20d[_0x98bc('0x28')]);clearInterval(_0x16e20d[_0x98bc('0x91')]);_0x16e20d['handlePredictive']=undefined;this[_0x98bc('0xba')](_0x16e20d['dialPredictiveInterval'])[_0x98bc('0xb6')](this['getDataPredictive'](_0x16e20d))[_0x98bc('0xb6')](mergeDataErlangB(_0x16e20d))['then'](this[_0x98bc('0x1dc')](_0x16e20d))['catch'](loggerCatchPredictive(_0x98bc('0x1de'),_0x16e20d));}else if(_0x16e20d[_0x98bc('0x1cb')]&&_0x288ae5<_0x16e20d[_0x98bc('0x1cb')]-_0x3c0b44){freeVariablesPredictive(_0x16e20d);loggerPredictive[_0x98bc('0x7b')](_0x16e20d[_0x98bc('0x40')],_0x98bc('0x1df'),_0x288ae5,_0x98bc('0x1e0'),_0x16e20d['predictiveIntervalAvailable'],'-',_0x3c0b44,'=',_0x16e20d[_0x98bc('0x1cb')]-_0x3c0b44,')');}else if(_0x16e20d['predictiveIntervalAvailable']&&_0x288ae5>_0x16e20d[_0x98bc('0x1cb')]+_0x576546){freeVariablesPredictive(_0x16e20d);loggerPredictive[_0x98bc('0x7b')](_0x16e20d['name'],_0x98bc('0x1df'),_0x288ae5,_0x98bc('0x1e1'),_0x16e20d['predictiveIntervalAvailable'],'+',_0x576546,'=',_0x16e20d[_0x98bc('0x1cb')]+_0x576546,')');}};Dialer[_0x98bc('0xa8')][_0x98bc('0x1e2')]=function(_0x41b615){var _0x212a1a=this;return function(_0x40dd73){return new BPromise(function(_0x2e9a35,_0x4018cf){_['merge'](_0x41b615,_0x40dd73[0x0]);if(checkGetDataPredictive(_0x40dd73[0x0])){var _0x25dbcf=_0x41b615[_0x98bc('0x1cb')]=_0x41b615[_0x98bc('0x57')]+_0x41b615['available'];var _0x56d779=_0x41b615[_0x98bc('0x1db')]*0x3c;var _0x40f06d=_0x40dd73[0x0]['predictiveIntervalAvgTalktime']+_0x40dd73[0x0][_0x98bc('0x80')];var _0x1a56a0=(_0x40dd73[0x0]['predictiveIntervalAnsweredCalls']+_0x40dd73[0x0][_0x98bc('0x6b')]+_0x40dd73[0x0][_0x98bc('0x11c')])/_0x40dd73[0x0][_0x98bc('0x6e')];_0x41b615[_0x98bc('0x6c')]=_0x1a56a0>0x0?_0x1a56a0:0x1;switch(_0x41b615[_0x98bc('0x1d4')]){case _0x98bc('0x1d7'):var _0x171b1a=_0x41b615['dialPredictiveOptimizationPercentage']/0x64;return _0x212a1a[_0x98bc('0x1e3')](_0x25dbcf,_0x56d779,_0x40f06d,_0x1a56a0,_0x171b1a)[_0x98bc('0xb6')](function(_0x23a06a){return _0x2e9a35(_0x23a06a);});case _0x98bc('0x1e4'):var _0x2c1d70=_0x41b615[_0x98bc('0x1e5')]/0x64;return _0x212a1a[_0x98bc('0x1e6')](_0x25dbcf,_0x56d779,_0x40f06d,_0x1a56a0,_0x2c1d70)[_0x98bc('0xb6')](function(_0x3b2278){return _0x2e9a35(_0x3b2278);});default:return _0x4018cf(msgResponse('[getDataPredictive]',_0x98bc('0x144'),_0x98bc('0x1e7')));}}else{return _0x4018cf(msgResponse(_0x98bc('0x1e8'),_0x98bc('0x144'),_0x98bc('0x1e9')));}});};};Dialer[_0x98bc('0xa8')][_0x98bc('0x1ea')]=function(_0x5bf8ca){var _0x9b72ec=this;return function(_0x24ef05){return new BPromise(function(_0x448ea9,_0x172f93){_[_0x98bc('0x8d')](_0x5bf8ca,_0x24ef05[0x0]);if(checkGetDataPredictive(_0x24ef05[0x0])){loggerPredictive['info'](JSON[_0x98bc('0x4a')](_0x24ef05[0x0]));if(_0x5bf8ca[_0x98bc('0x1d4')]===_0x98bc('0x1d7')){return _0x9b72ec[_0x98bc('0xc3')](_0x5bf8ca['id'])[_0x98bc('0xb6')](function(_0x4035c0){var _0x28ba79=_0x5bf8ca[_0x98bc('0x52')]-_0x4035c0[0x0][_0x98bc('0x1eb')];var _0x837c5=_0x5bf8ca[_0x98bc('0x1db')]*0x3c;var _0x2a68cf=_0x24ef05[0x0][_0x98bc('0x82')]+_0x24ef05[0x0][_0x98bc('0x80')];var _0x381b5a=(_0x24ef05[0x0]['predictiveIntervalAnsweredCalls']+_0x24ef05[0x0][_0x98bc('0x6b')]+_0x24ef05[0x0][_0x98bc('0x11c')])/_0x24ef05[0x0][_0x98bc('0x6e')];var _0x19f32c=_0x5bf8ca[_0x98bc('0x1e5')]/0x64;_0x5bf8ca[_0x98bc('0x6d')]=_0x4035c0[0x0][_0x98bc('0x1eb')]||0x0;_0x5bf8ca[_0x98bc('0x6c')]=_0x381b5a>0x0?_0x381b5a:0x1;return _0x9b72ec[_0x98bc('0x1e3')](_0x28ba79,_0x837c5,_0x2a68cf,_0x381b5a,_0x19f32c);})[_0x98bc('0xb6')](function(_0x34d77f){return _0x448ea9(_0x34d77f);})['catch'](function(_0x94ecea){return _0x172f93(msgResponse(_0x98bc('0x1ec'),_0x98bc('0x144'),JSON[_0x98bc('0x4a')](_0x94ecea)));});}if(_0x5bf8ca[_0x98bc('0x1d4')]===_0x98bc('0x1e4')){return _0x9b72ec[_0x98bc('0xc3')](_0x5bf8ca['id'])[_0x98bc('0xb6')](function(_0xe73dc4){var _0x5ac6f7=_0x5bf8ca[_0x98bc('0x52')]-_0xe73dc4[0x0][_0x98bc('0x1eb')];var _0x417d65=_0x5bf8ca[_0x98bc('0x1db')]*0x3c;var _0x39317c=_0x24ef05[0x0]['predictiveIntervalAvgTalktime']+_0x24ef05[0x0]['predictiveIntervalAvgHoldtime'];var _0x280871=(_0x24ef05[0x0][_0x98bc('0x1ed')]+_0x24ef05[0x0][_0x98bc('0x6b')]+_0x24ef05[0x0][_0x98bc('0x11c')])/_0x24ef05[0x0]['predictiveIntervalTotalCalls'];var _0x2a7b8c=_0x5bf8ca[_0x98bc('0x1e5')]/0x64;_0x5bf8ca[_0x98bc('0x6d')]=_0xe73dc4[0x0][_0x98bc('0x1eb')]||0x0;_0x5bf8ca[_0x98bc('0x6c')]=_0x280871>0x0?_0x280871:0x1;return _0x9b72ec[_0x98bc('0x1e6')](_0x5ac6f7,_0x417d65,_0x39317c,_0x280871,_0x2a7b8c);})[_0x98bc('0xb6')](function(_0x25efed){return _0x448ea9(_0x25efed);})['catch'](function(_0x49d27f){return _0x172f93(msgResponse(_0x98bc('0x1ec'),_0x98bc('0x144'),JSON[_0x98bc('0x4a')](_0x49d27f)));});}}else{return _0x172f93(msgResponse(_0x98bc('0x1e8'),_0x98bc('0x144'),_0x98bc('0x1e9')));}});};};Dialer[_0x98bc('0xa8')][_0x98bc('0x1dc')]=function(_0x32c75a){var _0x2bb709=this;return function(){var _0x4cadd4=0x0;var _0xd1120a=Math[_0x98bc('0x1cd')](_0x32c75a[_0x98bc('0x70')]*0x3e8);if(_0xd1120a>0x0){_0xd1120a=_0xd1120a<0x64?0x64:_0xd1120a;loggerPredictive[_0x98bc('0x7b')](_0x32c75a[_0x98bc('0x40')],_0x98bc('0x1ee'),_0xd1120a,_0x98bc('0x8e'));_0x32c75a['handlePredictive']=setInterval(function(){_0x2bb709['handlePredictive'](_0x32c75a);loggerPredictiveCalls['info'](_0x98bc('0x1ef'),_0x4cadd4+=0x1);},_0xd1120a);}else{loggerPredictive[_0x98bc('0x7b')](_0x32c75a[_0x98bc('0x40')],_0x98bc('0x1f0'));}};};Dialer[_0x98bc('0xa8')][_0x98bc('0x1f1')]=function(_0x287de4,_0x1c6027){var _0x4f2fe6=this;return function(_0x379110){if(_[_0x98bc('0x47')](_0x379110)){if(_['isNil'](_0x1c6027[_0x98bc('0xcf')])||!_0x1c6027[_0x98bc('0x1f2')]){if(_0x287de4[_0x98bc('0x15e')]===_0x98bc('0x8')){_0x287de4[_0x98bc('0x12e')]=_[_0x98bc('0x3d')](_0x287de4[_0x98bc('0x12e')])?!![]:_0x287de4[_0x98bc('0x12e')];var _0x465fd0=uuid['v4']();_0x4f2fe6['actions'][_0x465fd0]=new Action(_0x287de4,_0x1c6027,_0x465fd0);loggerBooked[_0x98bc('0x7b')](_0x98bc('0x1f3'),_0x465fd0,_0x98bc('0x1f4'),JSON[_0x98bc('0x4a')](_0x287de4[_0x98bc('0x12e')]),_0x98bc('0x1f5'),_0x287de4[_0x98bc('0x40')]);if(_0x287de4[_0x98bc('0x12e')]){_0x287de4[_0x98bc('0x12e')]=![];_0x4f2fe6['queueBooked'][_0x4f2fe6[_0x98bc('0x25')][_0x465fd0][_0x98bc('0xb0')]]=[];ami[_0x98bc('0x149')]({'actionid':_0x465fd0,'action':'queuestatus','queue':_0x287de4[_0x98bc('0x40')]})[_0x98bc('0xad')](function(){_0x4f2fe6['updateOriginated'](_0x287de4);_0x4f2fe6[_0x98bc('0xbd')]({'active':![],'ContactId':_0x4f2fe6[_0x98bc('0x25')][_0x465fd0]['ContactId'],'ListId':_0x4f2fe6[_0x98bc('0x25')][_0x465fd0][_0x98bc('0xce')],'VoiceQueueId':_0x4f2fe6[_0x98bc('0x25')][_0x465fd0][_0x98bc('0xfd')]||undefined,'CampaignId':_0x4f2fe6[_0x98bc('0x25')][_0x465fd0][_0x98bc('0xd0')]||undefined})[_0x98bc('0xad')](loggerCatch(_0x98bc('0x1f6')));delete _0x4f2fe6[_0x98bc('0x25')][_0x465fd0];});}else{loggerBooked[_0x98bc('0x7b')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x287de4[_0x98bc('0x12e')]),_0x98bc('0x1f5'),_0x287de4['name']);_0x4f2fe6[_0x98bc('0xaf')](_0x287de4);_0x4f2fe6[_0x98bc('0xbd')]({'active':![],'ContactId':_0x4f2fe6[_0x98bc('0x25')][_0x465fd0][_0x98bc('0xcd')],'ListId':_0x4f2fe6[_0x98bc('0x25')][_0x465fd0][_0x98bc('0xce')],'VoiceQueueId':_0x4f2fe6[_0x98bc('0x25')][_0x465fd0][_0x98bc('0xfd')]||undefined,'CampaignId':_0x4f2fe6[_0x98bc('0x25')][_0x465fd0][_0x98bc('0xd0')]||undefined})[_0x98bc('0xad')](loggerCatch(_0x98bc('0x1f6')));delete _0x4f2fe6[_0x98bc('0x25')][_0x465fd0];}}else{return _0x4f2fe6[_0x98bc('0x166')](_0x287de4,_0x1c6027);}}else{if(getDiff(_0x1c6027[_0x98bc('0x1f7')])<_0x287de4['dialRecallMeTimeout']*0x3c){if(_0x1c6027[_0x98bc('0x1f8')]&&!_0x1c6027[_0x98bc('0x1f8')]['voicePause']){_0x4f2fe6[_0x98bc('0x93')][_0x98bc('0x130')](_0x1c6027['id'])['finally'](function(){_0x4f2fe6['updateOriginated'](_0x287de4);});}else{_0x4f2fe6[_0x98bc('0xbe')]({'active':![]},_0x1c6027['id'],0x1)[_0x98bc('0x1d')](function(){_0x4f2fe6[_0x98bc('0xaf')](_0x287de4);});}}else{_0x287de4[_0x98bc('0x69')]+=0x1;_0x4f2fe6[_0x98bc('0xaf')](_0x287de4);if(_0x287de4['dialRecallInQueue']){_0x4f2fe6[_0x98bc('0xbd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1c6027[_0x98bc('0xcd')],'ListId':_0x1c6027[_0x98bc('0xce')],'VoiceQueueId':_0x1c6027[_0x98bc('0xfd')]||undefined,'CampaignId':_0x1c6027['CampaignId']||undefined})[_0x98bc('0xad')](loggerCatch(_0x98bc('0x1f9')));_0x4f2fe6[_0x98bc('0xc7')](createObjHistory(_0x287de4,_0x1c6027,_0x98bc('0x1fa'),0x17,_0x98bc('0x1fb')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x4f2fe6[_0x98bc('0xcc')](createObjHistory(_0x287de4,_0x1c6027,_0x98bc('0x1fc'),0x16,'RecallFailedTimeout'),_0x98bc('0x1fd'),_0x98bc('0x1fe'));}}}}else{_0x287de4['outboundBlacklistCallsDay']+=0x1;_0x4f2fe6[_0x98bc('0xcc')](createObjHistory(_0x287de4,_0x1c6027,_0x98bc('0x1ff'),0xd,_0x98bc('0x200')),_0x98bc('0x201'),_0x98bc('0x202'));throw _0x98bc('0x203');}};};Dialer['prototype'][_0x98bc('0x15d')]=function(_0x1d2bc3){var _0x46f51d=this;var _0x473e8a=_0x1d2bc3['limitCalls']-_0x1d2bc3[_0x98bc('0x6f')]-_0x1d2bc3[_0x98bc('0x204')];emitCampaignSummary(_0x1d2bc3);if(_0x473e8a>0x0){if(_0x473e8a>this[_0x98bc('0x23')]){_0x473e8a=this[_0x98bc('0x23')];}_0x1d2bc3['temp']+=_0x473e8a;this['getContactDialerIvr'](_0x1d2bc3['id'],_0x473e8a,_0x1d2bc3['dialOrderByScheduledAt'])[_0x98bc('0xb6')](function(_0x7cbf56){_0x1d2bc3['temp']-=_0x473e8a;_0x1d2bc3[_0x98bc('0x204')]=_0x1d2bc3[_0x98bc('0x204')]>0x0?_0x1d2bc3[_0x98bc('0x204')]:0x0;if(!checkContactEmpty(_0x7cbf56)){_0x1d2bc3['message']=_0x98bc('0x9e');logger[_0x98bc('0x7b')](_0x98bc('0x205')+_0x1d2bc3[_0x98bc('0x40')]);}else{_0x1d2bc3[_0x98bc('0x6f')]+=_0x7cbf56[_0x98bc('0x134')];_0x1d2bc3[_0x98bc('0x3e')]='RUNNING';for(var _0x5efd57=0x0;_0x5efd57<_0x7cbf56[_0x98bc('0x134')];_0x5efd57+=0x1){_0x1d2bc3[_0x98bc('0x206')]+=0x1;if(_[_0x98bc('0xac')](_0x7cbf56[_0x5efd57])||_[_0x98bc('0xac')](_0x7cbf56[_0x5efd57][_0x98bc('0x169')])||_[_0x98bc('0xac')](_0x7cbf56[_0x5efd57][_0x98bc('0x169')][_0x98bc('0x16a')])){_0x46f51d[_0x98bc('0xca')](_0x98bc('0x207'),_0x1d2bc3,_0x7cbf56[_0x5efd57]);}else{_0x46f51d[_0x98bc('0xb8')](_['pick'](_0x7cbf56[_0x5efd57],[_0x98bc('0xd0'),_0x98bc('0x208')]))[_0x98bc('0xb6')](_0x46f51d[_0x98bc('0x1f1')](_0x1d2bc3,_0x7cbf56[_0x5efd57]))['catch'](_0x46f51d[_0x98bc('0xc9')](_0x98bc('0x209'),_0x1d2bc3));}}}})['catch'](loggerGetContactDialer(_0x98bc('0x20a'),_0x1d2bc3,_0x473e8a));}};Dialer[_0x98bc('0xa8')][_0x98bc('0x159')]=function(_0x5609a9,_0x5398f3){var _0xfd3ae6=this;var _0x55cc4f=[];var _0x2c0bac=_0x5398f3>=0x1?_0x5398f3:0x1;if(_0x5609a9[_0x98bc('0x15e')]===_0x98bc('0x8')){_0x2c0bac=0x1;}var _0xf695f=Math[_0x98bc('0x1cd')](_0x5609a9['available']*_0x2c0bac)-_0x5609a9[_0x98bc('0x6f')]-_0x5609a9[_0x98bc('0x204')];emitVoiceQueueSummary(_0x5609a9);if(_0x5609a9[_0x98bc('0x20b')]>0x0){var _0x260d66=_0x5609a9[_0x98bc('0x20b')]-_0x5609a9['originated']-_0x5609a9[_0x98bc('0x57')]-_0x5609a9['temp']-_0x5609a9['pTalking'];if(_0xf695f>_0x260d66){_0xf695f=_0x260d66;}}if(_0xf695f>0x0){if(_0x5609a9[_0x98bc('0x15e')]==='booked'){_0xf695f=0x1;}if(_0xf695f>this[_0x98bc('0x23')]){_0xf695f=this['maxNumberOriginate'];}_0x5609a9[_0x98bc('0x204')]+=_0xf695f;for(var _0x52285a in this[_0x98bc('0x21')]){if(typeof this['agents'][_0x52285a]!==_0x98bc('0x9a')){if(this[_0x98bc('0x21')][_0x52285a][_0x98bc('0xa6')]==='not_inuse'&&this['agents'][_0x52285a]['status']===_0x98bc('0xd6')){_0x55cc4f['push'](this[_0x98bc('0x21')][_0x52285a]['id']);}}}this['getContactDialer'](_0x5609a9['id'],_0x55cc4f,_0xf695f,_0x5609a9[_0x98bc('0x20c')])[_0x98bc('0xb6')](function(_0x3b4e1f){_0x5609a9[_0x98bc('0x204')]-=_0xf695f;_0x5609a9[_0x98bc('0x204')]=_0x5609a9[_0x98bc('0x204')]>0x0?_0x5609a9[_0x98bc('0x204')]:0x0;if(!checkContactEmpty(_0x3b4e1f)){_0xfd3ae6[_0x98bc('0xb2')](_0x5609a9)['then'](sendMessageReschedule(_0x5609a9))[_0x98bc('0xad')](loggerCatch(_0x98bc('0xb4')));}else{_0x5609a9[_0x98bc('0x6f')]+=_0x3b4e1f['length'];_0x5609a9['message']=_0x5609a9[_0x98bc('0x15e')]==='booked'?_0x98bc('0x20d'):_0x98bc('0x20e');for(var _0x2fedea=0x0;_0x2fedea<_0x3b4e1f[_0x98bc('0x134')];_0x2fedea+=0x1){if(_['isNil'](_0x3b4e1f[_0x2fedea])||_['isNil'](_0x3b4e1f[_0x2fedea][_0x98bc('0x169')])||_[_0x98bc('0xac')](_0x3b4e1f[_0x2fedea][_0x98bc('0x169')][_0x98bc('0x16a')])){_0xfd3ae6[_0x98bc('0xca')](_0x98bc('0x207'),_0x5609a9,_0x3b4e1f[_0x2fedea]);}else{_0xfd3ae6[_0x98bc('0xb5')](_['pick'](_0x3b4e1f[_0x2fedea],[_0x98bc('0xfd'),'Contact.phone']))[_0x98bc('0xb6')](_0xfd3ae6[_0x98bc('0x1f1')](_0x5609a9,_0x3b4e1f[_0x2fedea]))['catch'](_0xfd3ae6['loggerHandler'](_0x98bc('0x207'),_0x5609a9));}}}})[_0x98bc('0xad')](loggerGetContactDialer('[getContactDialer2]',_0x5609a9,_0xf695f));}};Dialer[_0x98bc('0xa8')][_0x98bc('0x91')]=function(_0xdc5185){if(_0xdc5185[_0x98bc('0x20b')]>0x0){var _0x17f400=_0xdc5185['dialLimitQueue']-_0xdc5185['originated']-_0xdc5185[_0x98bc('0x57')];if(_0x17f400>0x0){this['tryOriginatePredictive'](_0xdc5185);}else{loggerPredictiveCalls[_0x98bc('0x7b')]('[handlePredictive][limitChannel]');}}else{this[_0x98bc('0x20f')](_0xdc5185);}};Dialer[_0x98bc('0xa8')][_0x98bc('0x20f')]=function(_0x3fca4a){var _0x3dfd22=this;var _0x203b78=[];_0x3fca4a[_0x98bc('0x6f')]+=0x1;for(var _0x41268c in this['agents']){if(typeof this['agents'][_0x41268c]!=='undefined'){if(this[_0x98bc('0x21')][_0x41268c][_0x98bc('0xa6')]===_0x98bc('0x210')&&this[_0x98bc('0x21')][_0x41268c][_0x98bc('0xd5')]===_0x98bc('0xd6')){_0x203b78[_0x98bc('0x12a')](this[_0x98bc('0x21')][_0x41268c]['id']);}}}this[_0x98bc('0xc0')](_0x3fca4a['id'],_0x203b78,0x1,_0x3fca4a[_0x98bc('0x20c')])['then'](function(_0x288a4a){if(!checkContactEmpty(_0x288a4a)){checkContactLowerLimitOriginate(_0x3fca4a,0x1,0x0);_0x3dfd22[_0x98bc('0xb2')](_0x3fca4a)[_0x98bc('0xb6')](sendMessageReschedule(_0x3fca4a))[_0x98bc('0xad')](loggerCatch(_0x98bc('0xb4')));}else{_0x3fca4a['message']=_0x98bc('0x20e');if(_[_0x98bc('0xac')](_0x288a4a[0x0])||_['isNil'](_0x288a4a[0x0][_0x98bc('0x169')])||_['isNil'](_0x288a4a[0x0][_0x98bc('0x169')][_0x98bc('0x16a')])){_0x3dfd22['emptyContact']('[actionOriginate]\x20',_0x3fca4a,_0x288a4a[0x0]);}else{_0x3dfd22[_0x98bc('0xb5')](_[_0x98bc('0x12b')](_0x288a4a[0x0],[_0x98bc('0xfd'),_0x98bc('0x208')]))[_0x98bc('0xb6')](_0x3dfd22[_0x98bc('0x1f1')](_0x3fca4a,_0x288a4a[0x0]))[_0x98bc('0xad')](_0x3dfd22[_0x98bc('0xc9')]('[actionOriginatePredictive]\x20',_0x3fca4a));}}})[_0x98bc('0xad')](loggerGetContactDialer(_0x98bc('0x211'),_0x3fca4a,0x1));emitVoiceQueueSummary(_0x3fca4a);};Dialer[_0x98bc('0xa8')][_0x98bc('0x1e3')]=function(_0x2fcde8,_0x38ce67,_0x3b1194,_0x16c469,_0x115694,_0x4291dc){loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x212'));loggerPredictive['info']('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',_0x2fcde8);loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x213'),_0x38ce67);loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x214'),_0x3b1194);loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x215'),_0x16c469);loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x216'),_0x115694);loggerPredictive[_0x98bc('0x7b')]('---------------------------');return new BPromise(function(_0x1afaea,_0x1a59ca){if(_0x2fcde8<=0x0||isNaN(_0x2fcde8)){return _0x1a59ca(msgResponse(_0x98bc('0x217'),_0x98bc('0x49'),_0x98bc('0x218')+_0x2fcde8));}if(_0x3b1194<=0x0||isNaN(_0x3b1194)){return _0x1a59ca(msgResponse('[abandonmentRate]',_0x98bc('0x49'),_0x98bc('0x219')+_0x3b1194));}if(_0x16c469<=0x0||isNaN(_0x16c469)){return _0x1a59ca(msgResponse(_0x98bc('0x217'),_0x98bc('0x49'),_0x98bc('0x21a')+_0x16c469));}if(_0x38ce67<=0x0||isNaN(_0x38ce67)){return _0x1a59ca(msgResponse('[abandonmentRate]',_0x98bc('0x49'),_0x98bc('0x21b')+_0x38ce67));}if(_0x115694<=0x0||isNaN(_0x115694)){return _0x1a59ca(msgResponse(_0x98bc('0x217'),'Error',_0x98bc('0x21c')+_0x115694));}_0x4291dc=_0x4291dc||0x0;var _0x4a7f93=0x1/_0x3b1194;var _0x41e691=0x0;var _0x2eae79=0x0;var _0xe9da0c=0x0;var _0x6cfbc0=0x0;for(var _0xbd31fc=0x0;_0xe9da0c<_0x115694;_0xbd31fc+=0x1){_0x2eae79=_0xbd31fc/_0x38ce67;_0x41e691=(_0x16c469*_0x2eae79+_0x4291dc)/_0x4a7f93;_0xe9da0c=erlangb(_0x41e691,_0x2fcde8);_0x6cfbc0=_0x41e691/_0x2fcde8*(0x1-erlangb(_0x41e691,_0x2fcde8));}return _0x1afaea({'erlangCalls':_0xbd31fc,'erlangCallToSecond':_0x38ce67/_0xbd31fc,'erlangAbandonmentRate':_0xe9da0c,'erlangBusyFactor':_0x6cfbc0});});};Dialer[_0x98bc('0xa8')][_0x98bc('0x1e6')]=function(_0x32cfe3,_0x2e92e4,_0x4a4a91,_0x449779,_0x4c60b3,_0x5e2313){loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x21d'));loggerPredictive[_0x98bc('0x7b')](_0x98bc('0x21e'),_0x32cfe3);loggerPredictive['info'](_0x98bc('0x213'),_0x2e92e4);loggerPredictive[_0x98bc('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',_0x4a4a91);loggerPredictive[_0x98bc('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',_0x449779);loggerPredictive['info'](_0x98bc('0x21f'),_0x4c60b3);loggerPredictive['info'](_0x98bc('0x83'));return new BPromise(function(_0x49ea5c,_0x32911d){if(_0x32cfe3<=0x0||isNaN(_0x32cfe3)){return _0x32911d(msgResponse('[busyFactor]','Error',_0x98bc('0x218')+_0x32cfe3));}if(_0x4a4a91<=0x0||isNaN(_0x4a4a91)){return _0x32911d(msgResponse(_0x98bc('0x220'),_0x98bc('0x49'),_0x98bc('0x219')+_0x4a4a91));}if(_0x449779<=0x0||isNaN(_0x449779)){return _0x32911d(msgResponse('[busyFactor]','Error','p\x20=\x20'+_0x449779));}if(_0x2e92e4<=0x0||isNaN(_0x2e92e4)){return _0x32911d(msgResponse(_0x98bc('0x220'),_0x98bc('0x49'),_0x98bc('0x21b')+_0x2e92e4));}if(_0x4c60b3<=0x0||isNaN(_0x4c60b3)){return _0x32911d(msgResponse('[busyFactor]',_0x98bc('0x49'),'Umin\x20=\x20'+_0x4c60b3));}_0x5e2313=_0x5e2313||0x0;var _0x5b6b45=0x1/_0x4a4a91;var _0x5ca662=0x0;var _0x5a7e11=0x0;var _0x3638f7=0x0;var _0x676f74=0x0;for(var _0x561e08=0x0;_0x676f74<_0x4c60b3;_0x561e08+=0x1){_0x5a7e11=_0x561e08/_0x2e92e4;_0x5ca662=(_0x449779*_0x5a7e11+_0x5e2313)/_0x5b6b45;_0x3638f7=erlangb(_0x5ca662,_0x32cfe3);_0x676f74=_0x5ca662/_0x32cfe3*(0x1-erlangb(_0x5ca662,_0x32cfe3));}return _0x49ea5c({'erlangCalls':_0x561e08,'erlangCallToSecond':_0x2e92e4/_0x561e08,'erlangAbandonmentRate':_0x3638f7,'erlangBusyFactor':_0x676f74});});};module[_0x98bc('0x221')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 88c3a33..661a3ff 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 _0xf2be=['type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum','number','responsetime','droptime','endtime','ringtime','starttime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat'];(function(_0x312b02,_0x5a4c99){var _0x34a298=function(_0x992e5a){while(--_0x992e5a){_0x312b02['push'](_0x312b02['shift']());}};_0x34a298(++_0x5a4c99);}(_0xf2be,0xf5));var _0xef2b=function(_0x16a142,_0xc2c144){_0x16a142=_0x16a142-0x0;var _0x5e28c0=_0xf2be[_0x16a142];return _0x5e28c0;};'use strict';var util=require(_0xef2b('0x0'));var _=require(_0xef2b('0x1'));var moment=require(_0xef2b('0x2'));function getSeconds(_0x3e7b9f,_0x2d1b5d){var _0x23390d=moment(_0x3e7b9f)[_0xef2b('0x3')](0x0);var _0x2bcb6f=moment(_0x2d1b5d)[_0xef2b('0x3')](0x0);return _0x23390d[_0xef2b('0x4')](_0x2bcb6f,_0xef2b('0x5'));}function QueueCallerAbandon(_0x5aa5bb,_0x980bcc){this[_0xef2b('0x6')]=_0x5aa5bb['scheduledat'];this[_0xef2b('0x7')]=_0x5aa5bb[_0xef2b('0x7')];this[_0xef2b('0x8')]=_0x5aa5bb['type']==='outbound'?_0xef2b('0x9'):_0x5aa5bb[_0xef2b('0x7')];this['countbusyretry']=_0x5aa5bb[_0xef2b('0xa')];this['countcongestionretry']=_0x5aa5bb[_0xef2b('0xb')];this[_0xef2b('0xc')]=_0x5aa5bb[_0xef2b('0xc')];this[_0xef2b('0xd')]=_0x5aa5bb['countbusyretry']+_0x5aa5bb[_0xef2b('0xb')]+_0x5aa5bb[_0xef2b('0xc')]+_0x5aa5bb['countnosuchnumberretry']+_0x5aa5bb[_0xef2b('0xe')]+_0x5aa5bb[_0xef2b('0xf')]+_0x5aa5bb[_0xef2b('0x10')]+_0x5aa5bb[_0xef2b('0x11')];this['countnosuchnumberretry']=_0x5aa5bb[_0xef2b('0x12')];this[_0xef2b('0xe')]=_0x5aa5bb[_0xef2b('0xe')];this[_0xef2b('0xf')]=_0x5aa5bb[_0xef2b('0xf')];this[_0xef2b('0x10')]=_0x5aa5bb[_0xef2b('0x10')];this[_0xef2b('0x11')]=_0x5aa5bb[_0xef2b('0x11')];this[_0xef2b('0x13')]=_0x980bcc[_0xef2b('0x13')];this['calleridname']=_0x5aa5bb[_0xef2b('0x14')];this[_0xef2b('0x15')]=_0x5aa5bb[_0xef2b('0x16')];this['starttime']=_0x5aa5bb['starttime'];this[_0xef2b('0x17')]=_0x5aa5bb[_0xef2b('0x17')];this[_0xef2b('0x18')]=_0x5aa5bb[_0xef2b('0x18')];this[_0xef2b('0x19')]=this[_0xef2b('0x18')];this[_0xef2b('0x1a')]=getSeconds(_0x5aa5bb[_0xef2b('0x17')],_0x5aa5bb[_0xef2b('0x1b')]);this['holdtime']=getSeconds(this[_0xef2b('0x18')],_0x5aa5bb[_0xef2b('0x17')]);this[_0xef2b('0x1c')]=0x0;this['queue']=_0x980bcc['queue'];this[_0xef2b('0x1d')]=_0x980bcc[_0xef2b('0x1e')];this[_0xef2b('0x1f')]=_0x980bcc[_0xef2b('0x1f')];this[_0xef2b('0x20')]=_0x5aa5bb[_0xef2b('0x20')];this['callbackuniqueid']=_0x5aa5bb[_0xef2b('0x21')];this[_0xef2b('0x22')]=_0x5aa5bb['callbackat'];this[_0xef2b('0x23')]=_0x5aa5bb['recallme'];this['ContactId']=_0x5aa5bb[_0xef2b('0x24')];this[_0xef2b('0x25')]=_0x5aa5bb[_0xef2b('0x25')];this[_0xef2b('0x26')]=_0x5aa5bb['UserId'];this['VoiceQueueId']=_0x5aa5bb['VoiceQueueId'];this[_0xef2b('0x27')]=_0x5aa5bb[_0xef2b('0x27')];this[_0xef2b('0x28')]=_0x5aa5bb[_0xef2b('0x28')]||'';this['originatecalleridname']=_0x5aa5bb['originatecalleridname']||'';}module[_0xef2b('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x37c7=['countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x37c7,0x127));var _0x737c=function(_0x44976e,_0x311385){_0x44976e=_0x44976e-0x0;var _0x4852b2=_0x37c7[_0x44976e];return _0x4852b2;};'use strict';var util=require(_0x737c('0x0'));var _=require(_0x737c('0x1'));var moment=require(_0x737c('0x2'));function getSeconds(_0x5d047d,_0x44af78){var _0x3a9618=moment(_0x5d047d)['milliseconds'](0x0);var _0x4ebe40=moment(_0x44af78)[_0x737c('0x3')](0x0);return _0x3a9618[_0x737c('0x4')](_0x4ebe40,_0x737c('0x5'));}function QueueCallerAbandon(_0x5499e2,_0x125dca){this[_0x737c('0x6')]=_0x5499e2[_0x737c('0x6')];this['type']=_0x5499e2[_0x737c('0x7')];this[_0x737c('0x8')]=_0x5499e2[_0x737c('0x7')]===_0x737c('0x9')?_0x737c('0xa'):_0x5499e2['type'];this[_0x737c('0xb')]=_0x5499e2[_0x737c('0xb')];this['countcongestionretry']=_0x5499e2['countcongestionretry'];this['countnoanswerretry']=_0x5499e2[_0x737c('0xc')];this[_0x737c('0xd')]=_0x5499e2[_0x737c('0xb')]+_0x5499e2[_0x737c('0xe')]+_0x5499e2[_0x737c('0xc')]+_0x5499e2[_0x737c('0xf')]+_0x5499e2[_0x737c('0x10')]+_0x5499e2['countabandonedretry']+_0x5499e2['countmachineretry']+_0x5499e2['countagentrejectretry'];this[_0x737c('0xf')]=_0x5499e2[_0x737c('0xf')];this[_0x737c('0x10')]=_0x5499e2[_0x737c('0x10')];this[_0x737c('0x11')]=_0x5499e2[_0x737c('0x11')];this['countmachineretry']=_0x5499e2[_0x737c('0x12')];this[_0x737c('0x13')]=_0x5499e2[_0x737c('0x13')];this[_0x737c('0x14')]=_0x125dca[_0x737c('0x14')];this[_0x737c('0x15')]=_0x5499e2['name'];this[_0x737c('0x16')]=_0x5499e2[_0x737c('0x17')];this[_0x737c('0x18')]=_0x5499e2[_0x737c('0x18')];this[_0x737c('0x19')]=_0x5499e2[_0x737c('0x19')];this[_0x737c('0x1a')]=_0x5499e2[_0x737c('0x1a')];this[_0x737c('0x1b')]=this['droptime'];this[_0x737c('0x1c')]=getSeconds(_0x5499e2[_0x737c('0x19')],_0x5499e2['starttime']);this[_0x737c('0x1d')]=getSeconds(this[_0x737c('0x1a')],_0x5499e2[_0x737c('0x19')]);this['talktime']=0x0;this['queue']=_0x125dca['queue'];this[_0x737c('0x1e')]=_0x125dca['connectedlinename'];this[_0x737c('0x1f')]=_0x125dca[_0x737c('0x1f')];this[_0x737c('0x20')]=_0x5499e2[_0x737c('0x20')];this[_0x737c('0x21')]=_0x5499e2[_0x737c('0x21')];this[_0x737c('0x22')]=_0x5499e2['callbackat'];this[_0x737c('0x23')]=_0x5499e2[_0x737c('0x23')];this['ContactId']=_0x5499e2[_0x737c('0x24')];this[_0x737c('0x25')]=_0x5499e2['ListId'];this[_0x737c('0x26')]=_0x5499e2['UserId'];this[_0x737c('0x27')]=_0x5499e2[_0x737c('0x27')];this[_0x737c('0x28')]=_0x5499e2[_0x737c('0x28')];this[_0x737c('0x29')]=_0x5499e2[_0x737c('0x29')]||'';this['originatecalleridname']=_0x5499e2[_0x737c('0x2a')]||'';}module[_0x737c('0x2b')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 267d1ca..81d59a8 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 _0x0f19=['localstationid','headerinfo','path','AttachmentId','moment','channel','%s/%s/%s','tech','Trunk','fax'];(function(_0xa83433,_0x223c0e){var _0x52f418=function(_0x7bd1c5){while(--_0x7bd1c5){_0xa83433['push'](_0xa83433['shift']());}};_0x52f418(++_0x223c0e);}(_0x0f19,0x194));var _0x90f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f19[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x90f1('0x0'));function Action(_0x589565,_0x310ec5,_0x53458d){this['uniqueid']=_0x589565||undefined;this[_0x90f1('0x1')]=util['format'](_0x90f1('0x2'),_0x310ec5[_0x90f1('0x3')],_0x310ec5[_0x90f1('0x4')]['name'],_0x53458d[_0x90f1('0x5')]);this[_0x90f1('0x6')]=_0x310ec5[_0x90f1('0x6')];this['headerinfo']=_0x310ec5[_0x90f1('0x7')];this['path']=_0x53458d[_0x90f1('0x8')];this[_0x90f1('0x9')]=_0x53458d[_0x90f1('0x9')];}module['exports']=Action; \ No newline at end of file +var _0xfc5b=['util','moment','format','%s/%s/%s','tech','Trunk','name','fax','localstationid','path','AttachmentId'];(function(_0x17ae4f,_0x30a379){var _0x309577=function(_0x38003a){while(--_0x38003a){_0x17ae4f['push'](_0x17ae4f['shift']());}};_0x309577(++_0x30a379);}(_0xfc5b,0x1a2));var _0xbfc5=function(_0x19da5c,_0x577d13){_0x19da5c=_0x19da5c-0x0;var _0x57252a=_0xfc5b[_0x19da5c];return _0x57252a;};'use strict';var util=require(_0xbfc5('0x0'));var _=require('lodash');var moment=require(_0xbfc5('0x1'));function Action(_0x2299aa,_0xde5e87,_0x4f7277){this['uniqueid']=_0x2299aa||undefined;this['channel']=util[_0xbfc5('0x2')](_0xbfc5('0x3'),_0xde5e87[_0xbfc5('0x4')],_0xde5e87[_0xbfc5('0x5')][_0xbfc5('0x6')],_0x4f7277[_0xbfc5('0x7')]);this[_0xbfc5('0x8')]=_0xde5e87[_0xbfc5('0x8')];this['headerinfo']=_0xde5e87['headerinfo'];this[_0xbfc5('0x9')]=_0x4f7277['path'];this[_0xbfc5('0xa')]=_0x4f7277[_0xbfc5('0xa')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 30980e8..7f8a17c 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 _0x4a9a=['channel','name','info','\x20syncNewchannel\x20','uniqueid','prototype','variable','hasOwnProperty','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','actions','merge','pick','response','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','%s/%s.tif','XMF-PATH','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','lodash','bluebird','uuid','moment','tiff2pdf','./util/gs','fax','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','bind','varset','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','localstationid'];(function(_0x89ec8e,_0x432d5b){var _0x3e5cab=function(_0x997c71){while(--_0x997c71){_0x89ec8e['push'](_0x89ec8e['shift']());}};_0x3e5cab(++_0x432d5b);}(_0x4a9a,0x1b0));var _0xa4a9=function(_0x56e857,_0x49ea58){_0x56e857=_0x56e857-0x0;var _0x79a466=_0x4a9a[_0x56e857];return _0x79a466;};'use strict';var util=require('util');var _=require(_0xa4a9('0x0'));var BPromise=require(_0xa4a9('0x1'));var uuid=require(_0xa4a9('0x2'));var moment=require(_0xa4a9('0x3'));var path=require('path');var tiff2pdf=require(_0xa4a9('0x4'));var gs=require(_0xa4a9('0x5'));var logger=require('../../../config/logger')(_0xa4a9('0x6'));var ami=require('../ami');var rpcDb=require(_0xa4a9('0x7'));var Channel=require(_0xa4a9('0x8'));var ut=require(_0xa4a9('0x9'));var Action=require('./action');var faxAccount=require(_0xa4a9('0xa'));var attachment=require(_0xa4a9('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x6bef86){this[_0xa4a9('0xc')]={};this[_0xa4a9('0xd')]=_0x6bef86['faxAccounts'];this['trunks']=_0x6bef86[_0xa4a9('0xe')];this['actions']={};ami['on'](_0xa4a9('0xf'),this['syncNewchannel'][_0xa4a9('0x10')](this));ami['on'](_0xa4a9('0x11'),this['syncVarSet'][_0xa4a9('0x10')](this));ami['on'](_0xa4a9('0x12'),this[_0xa4a9('0x13')][_0xa4a9('0x10')](this));ami['on'](_0xa4a9('0x14'),this['syncNewExten'][_0xa4a9('0x10')](this));ami['on'](_0xa4a9('0x15'),this[_0xa4a9('0x16')]['bind'](this));ami['on'](_0xa4a9('0x17'),this[_0xa4a9('0x18')][_0xa4a9('0x10')](this));ami['on'](_0xa4a9('0x19'),this[_0xa4a9('0x1a')][_0xa4a9('0x10')](this));ami['on'](_0xa4a9('0x1b'),this[_0xa4a9('0x1c')][_0xa4a9('0x10')](this));}Fax['prototype']['syncNewchannel']=function(_0x9e360f){if(_0x9e360f[_0xa4a9('0x1d')]===_0xa4a9('0x1e')){for(var _0x5849d1 in this[_0xa4a9('0xd')]){if(this[_0xa4a9('0xd')]['hasOwnProperty'](_0x5849d1)){if(_0x9e360f['exten']===this[_0xa4a9('0xd')][_0x5849d1][_0xa4a9('0x1f')]){this['channels'][_0x9e360f['uniqueid']]={};this[_0xa4a9('0xc')][_0x9e360f['uniqueid']][_0xa4a9('0x20')]=_0x9e360f[_0xa4a9('0x20')];this[_0xa4a9('0xc')][_0x9e360f['uniqueid']]['id']=this[_0xa4a9('0xd')][_0x5849d1]['id'];this[_0xa4a9('0xc')][_0x9e360f['uniqueid']][_0xa4a9('0x21')]=this[_0xa4a9('0xd')][_0x5849d1][_0xa4a9('0x21')];logger[_0xa4a9('0x22')](_0x9e360f['uniqueid'],_0xa4a9('0x23'));}}}}if(this['actions'][_0x9e360f[_0xa4a9('0x24')]]){this[_0xa4a9('0xc')][_0x9e360f[_0xa4a9('0x24')]]={};this[_0xa4a9('0xc')][_0x9e360f[_0xa4a9('0x24')]][_0xa4a9('0x20')]=_0x9e360f['channel'];logger['info'](_0x9e360f[_0xa4a9('0x24')],'\x20syncNewchannel\x20');}};Fax[_0xa4a9('0x25')]['syncVarSet']=function(_0x4c0ae0){if(this[_0xa4a9('0xc')][_0x4c0ae0[_0xa4a9('0x24')]]){for(var _0x33dfa1 in _0x4c0ae0[_0xa4a9('0x26')]){if(_0x4c0ae0[_0xa4a9('0x26')][_0xa4a9('0x27')](_0x33dfa1)){this[_0xa4a9('0xc')][_0x4c0ae0[_0xa4a9('0x24')]][_0x33dfa1]=_0x4c0ae0[_0xa4a9('0x28')];}}}};Fax[_0xa4a9('0x25')][_0xa4a9('0x13')]=function(_0x287c31){if(this[_0xa4a9('0xc')][_0x287c31[_0xa4a9('0x24')]]){this[_0xa4a9('0xc')][_0x287c31[_0xa4a9('0x24')]][_0xa4a9('0x29')]=_0x287c31[_0xa4a9('0x29')];this[_0xa4a9('0xc')][_0x287c31[_0xa4a9('0x24')]][_0xa4a9('0x2a')]=_0x287c31['channelstatedesc'];}};Fax['prototype'][_0xa4a9('0x2b')]=function(_0x5eb43b){if(this[_0xa4a9('0xc')][_0x5eb43b['uniqueid']]){for(var _0x5d507b in _0x5eb43b[_0xa4a9('0x26')]){if(_0x5eb43b[_0xa4a9('0x26')]['hasOwnProperty'](_0x5d507b)){this[_0xa4a9('0xc')][_0x5eb43b[_0xa4a9('0x24')]][_0x5d507b]=_0x5eb43b[_0xa4a9('0x28')];}}}};Fax[_0xa4a9('0x25')][_0xa4a9('0x16')]=function(_0x381779){if(this['channels'][_0x381779[_0xa4a9('0x24')]]){this['channels'][_0x381779[_0xa4a9('0x24')]][_0xa4a9('0x2c')]=_0x381779[_0xa4a9('0x2c')];this['channels'][_0x381779[_0xa4a9('0x24')]][_0xa4a9('0x2d')]=_0x381779['status'];this[_0xa4a9('0xc')][_0x381779[_0xa4a9('0x24')]][_0xa4a9('0x1f')]=_0x381779[_0xa4a9('0x1f')];this[_0xa4a9('0xc')][_0x381779[_0xa4a9('0x24')]][_0xa4a9('0x2e')]=_0x381779['filename'];logger[_0xa4a9('0x22')](_0x381779['uniqueid'],_0xa4a9('0x2f'));}};Fax[_0xa4a9('0x25')]['syncReceiveFax']=function(_0x1fb8e9){var _0x4e840f=this;if(this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]]){var _0x455ef2=this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]]['id'];this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]][_0xa4a9('0x30')]=_0x1fb8e9[_0xa4a9('0x30')];this['channels'][_0x1fb8e9[_0xa4a9('0x24')]]['pagestransferred']=_0x1fb8e9['pagestransferred'];this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]][_0xa4a9('0x1f')]=_0x1fb8e9['localstationid'];this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]][_0xa4a9('0x31')]=_0x1fb8e9[_0xa4a9('0x31')];this[_0xa4a9('0xc')][_0x1fb8e9['uniqueid']][_0xa4a9('0x32')]=_0x1fb8e9[_0xa4a9('0x32')];this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]][_0xa4a9('0x2e')]=_0x1fb8e9['filename'];this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]]['calleridnum']=_0x1fb8e9[_0xa4a9('0x33')];if(this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0x1fb8e9[_0xa4a9('0x2e')],_0xa4a9('0x34'),function(_0xdf950b){logger['info'](_0x1fb8e9[_0xa4a9('0x24')],'\x20result\x20conversion\x20file\x20',_0xdf950b[_0xa4a9('0x35')]);attachment[_0xa4a9('0x36')]({'name':path[_0xa4a9('0x37')](_0x1fb8e9[_0xa4a9('0x2e')])[_0xa4a9('0x21')],'basename':path['parse'](_0x1fb8e9[_0xa4a9('0x2e')])[_0xa4a9('0x21')]+_0xa4a9('0x38'),'type':_0xa4a9('0x39')})[_0xa4a9('0x3a')](function(_0x5c9d){faxAccount[_0xa4a9('0x3b')](_0x455ef2,{'from':_0x1fb8e9['calleridnum'],'mapKey':'fax','body':path[_0xa4a9('0x37')](_0x1fb8e9[_0xa4a9('0x2e')])[_0xa4a9('0x21')]+'.pdf','AttachmentId':_0x5c9d['id']})[_0xa4a9('0x3c')](function(_0x44bd5c){logger[_0xa4a9('0x3d')](_0x1fb8e9[_0xa4a9('0x24')],_0xa4a9('0x3e'),JSON['stringify'](_0x44bd5c));});})[_0xa4a9('0x3c')](function(_0x5432bc){logger[_0xa4a9('0x3d')](_0x1fb8e9[_0xa4a9('0x24')],_0xa4a9('0x3f'),JSON[_0xa4a9('0x40')](_0x5432bc));});});}logger[_0xa4a9('0x22')](_0x1fb8e9[_0xa4a9('0x24')],_0xa4a9('0x3f'));}};Fax['prototype'][_0xa4a9('0x1c')]=function(_0xa41045){if(this[_0xa4a9('0x41')][_0xa41045[_0xa4a9('0x24')]]){_[_0xa4a9('0x42')](this['channels'][_0xa41045[_0xa4a9('0x24')]],_[_0xa4a9('0x43')](_0xa41045,[_0xa4a9('0x44'),'reason']));}};function updateStatus(_0x3d6def){if(_0x3d6def[_0xa4a9('0x45')]){faxMessage[_0xa4a9('0x46')](_0x3d6def['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x3adec3){ut['logger']('[Fax][Message][Error][Updated]',_0x3adec3);})[_0xa4a9('0x3c')](function(_0x3b92f9){ut[_0xa4a9('0x47')](_0xa4a9('0x48'),_0x3b92f9);});}else{ut[_0xa4a9('0x47')](_0xa4a9('0x49'));}}Fax[_0xa4a9('0x25')][_0xa4a9('0x4a')]=function(_0x116617,_0x5186a0,_0x36460c){var _0x4a5499=this;var _0x5a1968={};if(_0x5186a0){_0x5a1968={'read':_0x5186a0};}else{_0x5a1968={'failMessage':_0x36460c};}if(this['actions'][_0x116617][_0xa4a9('0x45')]){faxMessage[_0xa4a9('0x46')](this[_0xa4a9('0x41')][_0x116617][_0xa4a9('0x45')],_0x5a1968)[_0xa4a9('0x3a')](function(_0x281630){ut['logger']('[Fax][Message][Updated]',_0x281630);})[_0xa4a9('0x3c')](function(_0x59554f){ut[_0xa4a9('0x47')](_0xa4a9('0x4b'),_0x59554f);})[_0xa4a9('0x4c')](function(){delete _0x4a5499[_0xa4a9('0xc')][_0x116617];delete _0x4a5499['actions'][_0x116617];});}else{ut[_0xa4a9('0x47')](_0xa4a9('0x4d'));delete this['channels'][_0x116617];delete this['actions'][_0x116617];}};Fax['prototype'][_0xa4a9('0x1a')]=function(_0x215341){var _0x30c1de=this;if(this['channels'][_0x215341['uniqueid']]){if(this['actions'][_0x215341['uniqueid']]){this[_0xa4a9('0xc')][_0x215341[_0xa4a9('0x24')]]['id']=this[_0xa4a9('0x41')][_0x215341['uniqueid']]['id'];this[_0xa4a9('0xc')][_0x215341[_0xa4a9('0x24')]][_0xa4a9('0x21')]=this[_0xa4a9('0x41')][_0x215341[_0xa4a9('0x24')]][_0xa4a9('0x21')];}logger[_0xa4a9('0x22')](_0x215341[_0xa4a9('0x24')],this[_0xa4a9('0x41')][_0x215341[_0xa4a9('0x24')]]?_0xa4a9('0x4e'):_0xa4a9('0x4f'),JSON['stringify'](this[_0xa4a9('0xc')][_0x215341['uniqueid']]));if(this[_0xa4a9('0x41')][_0x215341[_0xa4a9('0x24')]]){if(this[_0xa4a9('0xc')][_0x215341[_0xa4a9('0x24')]][_0xa4a9('0x50')]>0x0&&this[_0xa4a9('0xc')][_0x215341[_0xa4a9('0x24')]][_0xa4a9('0x15')]===_0xa4a9('0x51')){this[_0xa4a9('0x4a')](_0x215341[_0xa4a9('0x24')],!![]);}else{this[_0xa4a9('0x4a')](_0x215341[_0xa4a9('0x24')],![],this[_0xa4a9('0xc')][_0x215341[_0xa4a9('0x24')]]['faxstatusstring']?_0xa4a9('0x52')+this[_0xa4a9('0xc')][_0x215341['uniqueid']][_0xa4a9('0x53')]:_0xa4a9('0x54'));}}}};Fax[_0xa4a9('0x25')][_0xa4a9('0x55')]=function(_0x45b11f){var _0x49b712=this;return new BPromise(function(_0x1de673,_0x50e244){_0x49b712[_0xa4a9('0x56')](_0x45b11f,_0x49b712['faxAccounts'][_0x45b11f[_0xa4a9('0x57')]])[_0xa4a9('0x3a')](function(_0x288b5b){ut[_0xa4a9('0x47')]('[Fax][execOriginate][success]',_0x288b5b);_0x1de673(ut[_0xa4a9('0x35')](_0xa4a9('0x58')));})[_0xa4a9('0x3c')](function(_0x5b364e){ut[_0xa4a9('0x47')](_0xa4a9('0x59'),_0x5b364e);updateStatus(_0x45b11f);_0x50e244(ut[_0xa4a9('0x35')](_0xa4a9('0x5a')));});});};Fax['prototype']['checkAfterSend']=function(_0x221ac0){var _0xf30284=this;return new BPromise(function(_0x29a421,_0x13d655){var _0xc82ecf=_0xf30284[_0xa4a9('0x5b')](_0xf30284[_0xa4a9('0xd')][_0x221ac0[_0xa4a9('0x57')]][_0xa4a9('0x5c')],_0x221ac0);if(_0xc82ecf[_0xa4a9('0x5d')]){_0x29a421(ut['message'](_0xa4a9('0x5e')));}else{_0x13d655(ut[_0xa4a9('0x35')](_0xc82ecf[_0xa4a9('0x35')]));}});};function originate(_0x36314b,_0x43bd8f,_0x2be0ca){return new BPromise(function(_0x32e0ee,_0x20add8){if(_0x2be0ca){var _0x57998f=util[_0xa4a9('0x5f')](_0xa4a9('0x60'),path[_0xa4a9('0x37')](_0x36314b[_0xa4a9('0x61')])[_0xa4a9('0x21')],_0x36314b[_0xa4a9('0x61')]);gs['execute'](_0x57998f)[_0xa4a9('0x3a')](function(){_0x36314b[_0xa4a9('0x61')]=util[_0xa4a9('0x5f')](_0xa4a9('0x62'),path['parse'](_0x36314b['path'])['dir'],path[_0xa4a9('0x37')](_0x36314b['path'])[_0xa4a9('0x21')]);_0x43bd8f[_0xa4a9('0x63')]=_0x36314b[_0xa4a9('0x61')];ut[_0xa4a9('0x47')]('Convert\x20pdf\x20to\x20tif','');ami[_0xa4a9('0x64')](ut[_0xa4a9('0x65')](_0x36314b,_0x43bd8f))[_0xa4a9('0x3a')](function(_0x2673b6){_0x32e0ee(_0x2673b6);})[_0xa4a9('0x3c')](function(_0x5eaf86){_0x20add8(_0x5eaf86);});})[_0xa4a9('0x3c')](function(_0x2e98c9){_0x20add8(_0x2e98c9);});}else{ami[_0xa4a9('0x64')](ut[_0xa4a9('0x65')](_0x36314b,_0x43bd8f))[_0xa4a9('0x3a')](function(_0x3df6ec){_0x32e0ee(_0x3df6ec);})[_0xa4a9('0x3c')](function(_0x45653f){_0x20add8(_0x45653f);});}});}Fax[_0xa4a9('0x25')][_0xa4a9('0x56')]=function(_0xe5ee11,_0x5902d1){var _0x482a71=this;return new BPromise(function(_0x264b67,_0x3b2b52){var _0xdc6797=uuid['v4']();var _0x2c97b8=ut[_0xa4a9('0x66')](_0xe5ee11,_0x5902d1);_0x482a71[_0xa4a9('0x41')][_0xdc6797]=new Action(_0xdc6797,_0x5902d1,_0xe5ee11);var _0x49ed9e=_0x482a71[_0xa4a9('0x41')][_0xdc6797];if(path[_0xa4a9('0x37')](_0xe5ee11[_0xa4a9('0x61')])[_0xa4a9('0x67')]===_0xa4a9('0x38')){originate(_0x49ed9e,_0x2c97b8,!![])[_0xa4a9('0x3a')](function(_0x5c4fac){_0x264b67(_0x5c4fac);})['catch'](function(_0x2b028b){_0x3b2b52(_0x2b028b);});}else{originate(_0x49ed9e,_0x2c97b8,![])[_0xa4a9('0x3a')](function(_0x79930a){_0x264b67(_0x79930a);})[_0xa4a9('0x3c')](function(_0x183488){_0x3b2b52(_0x183488);});}});};Fax[_0xa4a9('0x25')][_0xa4a9('0x68')]=function(_0x40b95e){return!_[_0xa4a9('0x69')](_0x40b95e)&&!_[_0xa4a9('0x69')](_0x40b95e['name'])&&!_[_0xa4a9('0x69')](_0x40b95e[_0xa4a9('0x6a')])&&_0x40b95e[_0xa4a9('0x6a')]&&!_['isNil'](this['trunks'][util['format'](_0xa4a9('0x6b'),_0x40b95e[_0xa4a9('0x21')])])&&!_[_0xa4a9('0x69')](this[_0xa4a9('0xe')][util['format'](_0xa4a9('0x6b'),_0x40b95e[_0xa4a9('0x21')])][_0xa4a9('0x2d')])&&(this[_0xa4a9('0xe')][util[_0xa4a9('0x5f')](_0xa4a9('0x6b'),_0x40b95e[_0xa4a9('0x21')])][_0xa4a9('0x2d')]===_0xa4a9('0x6c')||this['trunks'][util['format'](_0xa4a9('0x6b'),_0x40b95e[_0xa4a9('0x21')])][_0xa4a9('0x2d')]===_0xa4a9('0x6d'));};Fax[_0xa4a9('0x25')][_0xa4a9('0x5b')]=function(_0x301d93,_0x1e47b9){if(!this[_0xa4a9('0x68')](_0x301d93)){ut['logger'](_0xa4a9('0x6e'),_['isNil'](_0x301d93)?'':_0x301d93['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xa4a9('0x6f')};}if(_[_0xa4a9('0x69')](_0x1e47b9[_0xa4a9('0x6')])){ut[_0xa4a9('0x47')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xa4a9('0x40')](_0x1e47b9));return{'isValid':![],'message':_0xa4a9('0x70')};}if(_[_0xa4a9('0x69')](_0x1e47b9[_0xa4a9('0x61')])){ut['logger'](_0xa4a9('0x71'),JSON['stringify'](_0x1e47b9));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xa4a9('0x72')};};module[_0xa4a9('0x73')]=Fax; \ No newline at end of file +var _0x06a1=['syncNewchannel','varset','syncVarSet','bind','syncNewState','newexten','syncReceiveFax','hangup','originateresponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','catch','error','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','then','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','Trunk\x20Reachable','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','format','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','Empty\x20path','Is\x20Valid','util','lodash','uuid','moment','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel'];(function(_0x1e2cda,_0x2c8320){var _0x49c9a5=function(_0x5d5d86){while(--_0x5d5d86){_0x1e2cda['push'](_0x1e2cda['shift']());}};_0x49c9a5(++_0x2c8320);}(_0x06a1,0x14d));var _0x106a=function(_0x34949e,_0x3e7624){_0x34949e=_0x34949e-0x0;var _0x27e3fc=_0x06a1[_0x34949e];return _0x27e3fc;};'use strict';var util=require(_0x106a('0x0'));var _=require(_0x106a('0x1'));var BPromise=require('bluebird');var uuid=require(_0x106a('0x2'));var moment=require(_0x106a('0x3'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x106a('0x4'));var logger=require(_0x106a('0x5'))(_0x106a('0x6'));var ami=require(_0x106a('0x7'));var rpcDb=require(_0x106a('0x8'));var Channel=require(_0x106a('0x9'));var ut=require(_0x106a('0xa'));var Action=require(_0x106a('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x106a('0xc'));var faxMessage=require(_0x106a('0xd'));function Fax(_0x4f44f9){this['channels']={};this['faxAccounts']=_0x4f44f9[_0x106a('0xe')];this['trunks']=_0x4f44f9[_0x106a('0xf')];this[_0x106a('0x10')]={};ami['on'](_0x106a('0x11'),this[_0x106a('0x12')]['bind'](this));ami['on'](_0x106a('0x13'),this[_0x106a('0x14')][_0x106a('0x15')](this));ami['on']('newstate',this[_0x106a('0x16')][_0x106a('0x15')](this));ami['on'](_0x106a('0x17'),this['syncNewExten'][_0x106a('0x15')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0x106a('0x15')](this));ami['on']('receivefax',this[_0x106a('0x18')][_0x106a('0x15')](this));ami['on'](_0x106a('0x19'),this['syncHangup'][_0x106a('0x15')](this));ami['on'](_0x106a('0x1a'),this['syncOriginateResponse'][_0x106a('0x15')](this));}Fax[_0x106a('0x1b')][_0x106a('0x12')]=function(_0x3b0267){if(_0x3b0267['context']===_0x106a('0x1c')){for(var _0x4c8c6d in this[_0x106a('0xe')]){if(this[_0x106a('0xe')][_0x106a('0x1d')](_0x4c8c6d)){if(_0x3b0267[_0x106a('0x1e')]===this[_0x106a('0xe')][_0x4c8c6d][_0x106a('0x1f')]){this[_0x106a('0x20')][_0x3b0267[_0x106a('0x21')]]={};this['channels'][_0x3b0267[_0x106a('0x21')]][_0x106a('0x22')]=_0x3b0267[_0x106a('0x22')];this[_0x106a('0x20')][_0x3b0267[_0x106a('0x21')]]['id']=this[_0x106a('0xe')][_0x4c8c6d]['id'];this[_0x106a('0x20')][_0x3b0267[_0x106a('0x21')]][_0x106a('0x23')]=this['faxAccounts'][_0x4c8c6d][_0x106a('0x23')];logger[_0x106a('0x24')](_0x3b0267[_0x106a('0x21')],_0x106a('0x25'));}}}}if(this['actions'][_0x3b0267[_0x106a('0x21')]]){this[_0x106a('0x20')][_0x3b0267[_0x106a('0x21')]]={};this['channels'][_0x3b0267[_0x106a('0x21')]]['channel']=_0x3b0267[_0x106a('0x22')];logger[_0x106a('0x24')](_0x3b0267[_0x106a('0x21')],_0x106a('0x25'));}};Fax[_0x106a('0x1b')][_0x106a('0x14')]=function(_0x56ed4f){if(this['channels'][_0x56ed4f['uniqueid']]){for(var _0x1d39cb in _0x56ed4f['variable']){if(_0x56ed4f[_0x106a('0x26')]['hasOwnProperty'](_0x1d39cb)){this['channels'][_0x56ed4f[_0x106a('0x21')]][_0x1d39cb]=_0x56ed4f[_0x106a('0x27')];}}}};Fax[_0x106a('0x1b')]['syncNewState']=function(_0x3763ce){if(this['channels'][_0x3763ce['uniqueid']]){this['channels'][_0x3763ce[_0x106a('0x21')]]['channelstate']=_0x3763ce[_0x106a('0x28')];this[_0x106a('0x20')][_0x3763ce['uniqueid']][_0x106a('0x29')]=_0x3763ce[_0x106a('0x29')];}};Fax[_0x106a('0x1b')][_0x106a('0x2a')]=function(_0x26c920){if(this['channels'][_0x26c920[_0x106a('0x21')]]){for(var _0x2d8883 in _0x26c920[_0x106a('0x26')]){if(_0x26c920['variable'][_0x106a('0x1d')](_0x2d8883)){this[_0x106a('0x20')][_0x26c920['uniqueid']][_0x2d8883]=_0x26c920['value'];}}}};Fax[_0x106a('0x1b')][_0x106a('0x2b')]=function(_0x2d3781){if(this[_0x106a('0x20')][_0x2d3781['uniqueid']]){this['channels'][_0x2d3781[_0x106a('0x21')]][_0x106a('0x2c')]=_0x2d3781[_0x106a('0x2c')];this[_0x106a('0x20')][_0x2d3781[_0x106a('0x21')]]['status']=_0x2d3781[_0x106a('0x2d')];this[_0x106a('0x20')][_0x2d3781[_0x106a('0x21')]]['localstationid']=_0x2d3781['localstationid'];this[_0x106a('0x20')][_0x2d3781[_0x106a('0x21')]][_0x106a('0x2e')]=_0x2d3781[_0x106a('0x2e')];logger[_0x106a('0x24')](_0x2d3781[_0x106a('0x21')],_0x106a('0x2f'));}};Fax[_0x106a('0x1b')][_0x106a('0x18')]=function(_0x38e27a){var _0x54801f=this;if(this[_0x106a('0x20')][_0x38e27a['uniqueid']]){var _0x3b57dd=this['channels'][_0x38e27a['uniqueid']]['id'];this[_0x106a('0x20')][_0x38e27a[_0x106a('0x21')]][_0x106a('0x30')]=_0x38e27a[_0x106a('0x30')];this[_0x106a('0x20')][_0x38e27a[_0x106a('0x21')]][_0x106a('0x31')]=_0x38e27a[_0x106a('0x31')];this[_0x106a('0x20')][_0x38e27a[_0x106a('0x21')]][_0x106a('0x1f')]=_0x38e27a[_0x106a('0x1f')];this[_0x106a('0x20')][_0x38e27a[_0x106a('0x21')]][_0x106a('0x32')]=_0x38e27a[_0x106a('0x32')];this[_0x106a('0x20')][_0x38e27a[_0x106a('0x21')]][_0x106a('0x33')]=_0x38e27a[_0x106a('0x33')];this['channels'][_0x38e27a['uniqueid']][_0x106a('0x2e')]=_0x38e27a[_0x106a('0x2e')];this['channels'][_0x38e27a['uniqueid']]['calleridnum']=_0x38e27a[_0x106a('0x34')];if(this[_0x106a('0x20')][_0x38e27a[_0x106a('0x21')]]['pagestransferred']>0x0){tiff2pdf(_0x38e27a[_0x106a('0x2e')],_0x106a('0x35'),function(_0x32dda3){logger[_0x106a('0x24')](_0x38e27a[_0x106a('0x21')],_0x106a('0x36'),_0x32dda3[_0x106a('0x37')]);attachment[_0x106a('0x38')]({'name':path[_0x106a('0x39')](_0x38e27a[_0x106a('0x2e')])[_0x106a('0x23')],'basename':path[_0x106a('0x39')](_0x38e27a[_0x106a('0x2e')])[_0x106a('0x23')]+_0x106a('0x3a'),'type':_0x106a('0x3b')})['then'](function(_0xcd8917){faxAccount[_0x106a('0x3c')](_0x3b57dd,{'from':_0x38e27a[_0x106a('0x34')],'mapKey':_0x106a('0x6'),'body':path['parse'](_0x38e27a[_0x106a('0x2e')])[_0x106a('0x23')]+'.pdf','AttachmentId':_0xcd8917['id']})[_0x106a('0x3d')](function(_0x9aed57){logger[_0x106a('0x3e')](_0x38e27a[_0x106a('0x21')],'\x20notify\x20',JSON[_0x106a('0x3f')](_0x9aed57));});})[_0x106a('0x3d')](function(_0x374a7a){logger['error'](_0x38e27a[_0x106a('0x21')],_0x106a('0x40'),JSON[_0x106a('0x3f')](_0x374a7a));});});}logger['info'](_0x38e27a[_0x106a('0x21')],_0x106a('0x40'));}};Fax[_0x106a('0x1b')][_0x106a('0x41')]=function(_0x1b1119){if(this[_0x106a('0x10')][_0x1b1119[_0x106a('0x21')]]){_[_0x106a('0x42')](this[_0x106a('0x20')][_0x1b1119[_0x106a('0x21')]],_[_0x106a('0x43')](_0x1b1119,[_0x106a('0x44'),'reason']));}};function updateStatus(_0xa9c6f0){if(_0xa9c6f0[_0x106a('0x45')]){faxMessage[_0x106a('0x46')](_0xa9c6f0[_0x106a('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x1d1891){ut[_0x106a('0x47')](_0x106a('0x48'),_0x1d1891);})[_0x106a('0x3d')](function(_0x16e49b){ut[_0x106a('0x47')](_0x106a('0x49'),_0x16e49b);});}else{ut['logger'](_0x106a('0x4a'));}}Fax[_0x106a('0x1b')][_0x106a('0x4b')]=function(_0x4c906c,_0x275c73,_0x4f4706){var _0x4790f7=this;var _0x333b14={};if(_0x275c73){_0x333b14={'read':_0x275c73};}else{_0x333b14={'failMessage':_0x4f4706};}if(this[_0x106a('0x10')][_0x4c906c][_0x106a('0x45')]){faxMessage['update'](this['actions'][_0x4c906c]['AttachmentId'],_0x333b14)[_0x106a('0x4c')](function(_0x2ef17d){ut['logger'](_0x106a('0x4d'),_0x2ef17d);})[_0x106a('0x3d')](function(_0x7d3dfd){ut[_0x106a('0x47')](_0x106a('0x4e'),_0x7d3dfd);})[_0x106a('0x4f')](function(){delete _0x4790f7['channels'][_0x4c906c];delete _0x4790f7[_0x106a('0x10')][_0x4c906c];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this['channels'][_0x4c906c];delete this[_0x106a('0x10')][_0x4c906c];}};Fax[_0x106a('0x1b')][_0x106a('0x50')]=function(_0x51a14c){var _0x8119a0=this;if(this[_0x106a('0x20')][_0x51a14c[_0x106a('0x21')]]){if(this[_0x106a('0x10')][_0x51a14c['uniqueid']]){this[_0x106a('0x20')][_0x51a14c[_0x106a('0x21')]]['id']=this[_0x106a('0x10')][_0x51a14c['uniqueid']]['id'];this[_0x106a('0x20')][_0x51a14c[_0x106a('0x21')]][_0x106a('0x23')]=this[_0x106a('0x10')][_0x51a14c['uniqueid']][_0x106a('0x23')];}logger[_0x106a('0x24')](_0x51a14c['uniqueid'],this[_0x106a('0x10')][_0x51a14c[_0x106a('0x21')]]?_0x106a('0x51'):_0x106a('0x52'),JSON['stringify'](this[_0x106a('0x20')][_0x51a14c[_0x106a('0x21')]]));if(this['actions'][_0x51a14c[_0x106a('0x21')]]){if(this[_0x106a('0x20')][_0x51a14c[_0x106a('0x21')]][_0x106a('0x53')]>0x0&&this[_0x106a('0x20')][_0x51a14c[_0x106a('0x21')]][_0x106a('0x54')]===_0x106a('0x55')){this[_0x106a('0x4b')](_0x51a14c[_0x106a('0x21')],!![]);}else{this['updateStatus'](_0x51a14c[_0x106a('0x21')],![],this['channels'][_0x51a14c[_0x106a('0x21')]][_0x106a('0x56')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x51a14c[_0x106a('0x21')]]['faxstatusstring']:_0x106a('0x57'));}}}};Fax['prototype'][_0x106a('0x58')]=function(_0x126e52){var _0x262802=this;return new BPromise(function(_0x23d300,_0x5c9410){_0x262802[_0x106a('0x59')](_0x126e52,_0x262802[_0x106a('0xe')][_0x126e52[_0x106a('0x5a')]])['then'](function(_0x29c542){ut[_0x106a('0x47')](_0x106a('0x5b'),_0x29c542);_0x23d300(ut[_0x106a('0x37')](_0x106a('0x5c')));})[_0x106a('0x3d')](function(_0xf40d0b){ut[_0x106a('0x47')](_0x106a('0x5d'),_0xf40d0b);updateStatus(_0x126e52);_0x5c9410(ut[_0x106a('0x37')](_0x106a('0x5e')));});});};Fax['prototype']['checkAfterSend']=function(_0x4f450d){var _0x4b3e12=this;return new BPromise(function(_0x191c4c,_0x4bc7b4){var _0x51b89a=_0x4b3e12[_0x106a('0x5f')](_0x4b3e12[_0x106a('0xe')][_0x4f450d[_0x106a('0x5a')]][_0x106a('0x60')],_0x4f450d);if(_0x51b89a['isValid']){_0x191c4c(ut['message'](_0x106a('0x61')));}else{_0x4bc7b4(ut[_0x106a('0x37')](_0x51b89a[_0x106a('0x37')]));}});};function originate(_0x53ff0c,_0x5ab17b,_0x17c83e){return new BPromise(function(_0x3074bc,_0x32f29f){if(_0x17c83e){var _0x433366=util['format'](_0x106a('0x62'),path[_0x106a('0x39')](_0x53ff0c[_0x106a('0x63')])['name'],_0x53ff0c[_0x106a('0x63')]);gs[_0x106a('0x64')](_0x433366)[_0x106a('0x4c')](function(){_0x53ff0c[_0x106a('0x63')]=util[_0x106a('0x65')]('%s/%s.tif',path[_0x106a('0x39')](_0x53ff0c['path'])[_0x106a('0x66')],path['parse'](_0x53ff0c[_0x106a('0x63')])[_0x106a('0x23')]);_0x5ab17b[_0x106a('0x67')]=_0x53ff0c['path'];ut[_0x106a('0x47')]('Convert\x20pdf\x20to\x20tif','');ami[_0x106a('0x68')](ut[_0x106a('0x69')](_0x53ff0c,_0x5ab17b))[_0x106a('0x4c')](function(_0x782a35){_0x3074bc(_0x782a35);})[_0x106a('0x3d')](function(_0x8a8885){_0x32f29f(_0x8a8885);});})['catch'](function(_0x12c139){_0x32f29f(_0x12c139);});}else{ami[_0x106a('0x68')](ut['variablesAction'](_0x53ff0c,_0x5ab17b))[_0x106a('0x4c')](function(_0xefab1f){_0x3074bc(_0xefab1f);})[_0x106a('0x3d')](function(_0x38dfaa){_0x32f29f(_0x38dfaa);});}});}Fax[_0x106a('0x1b')]['execOriginate']=function(_0x5c9df8,_0x3069f4){var _0x324e11=this;return new BPromise(function(_0x306ddc,_0x3cbf4a){var _0x4db3e3=uuid['v4']();var _0x2a5529=ut[_0x106a('0x6a')](_0x5c9df8,_0x3069f4);_0x324e11[_0x106a('0x10')][_0x4db3e3]=new Action(_0x4db3e3,_0x3069f4,_0x5c9df8);var _0x5d517e=_0x324e11[_0x106a('0x10')][_0x4db3e3];if(path[_0x106a('0x39')](_0x5c9df8[_0x106a('0x63')])[_0x106a('0x6b')]===_0x106a('0x3a')){originate(_0x5d517e,_0x2a5529,!![])[_0x106a('0x4c')](function(_0x31ebfd){_0x306ddc(_0x31ebfd);})['catch'](function(_0x35c910){_0x3cbf4a(_0x35c910);});}else{originate(_0x5d517e,_0x2a5529,![])[_0x106a('0x4c')](function(_0x4ede2a){_0x306ddc(_0x4ede2a);})[_0x106a('0x3d')](function(_0x57e21e){_0x3cbf4a(_0x57e21e);});}});};Fax[_0x106a('0x1b')][_0x106a('0x6c')]=function(_0x22736a){return!_[_0x106a('0x6d')](_0x22736a)&&!_[_0x106a('0x6d')](_0x22736a[_0x106a('0x23')])&&!_[_0x106a('0x6d')](_0x22736a[_0x106a('0x6e')])&&_0x22736a[_0x106a('0x6e')]&&!_[_0x106a('0x6d')](this[_0x106a('0xf')][util['format'](_0x106a('0x6f'),_0x22736a['name'])])&&!_[_0x106a('0x6d')](this[_0x106a('0xf')][util['format'](_0x106a('0x6f'),_0x22736a[_0x106a('0x23')])][_0x106a('0x2d')])&&(this[_0x106a('0xf')][util['format'](_0x106a('0x6f'),_0x22736a['name'])][_0x106a('0x2d')]===_0x106a('0x70')||this[_0x106a('0xf')][util[_0x106a('0x65')](_0x106a('0x6f'),_0x22736a[_0x106a('0x23')])][_0x106a('0x2d')]==='unmonitored');};Fax[_0x106a('0x1b')][_0x106a('0x5f')]=function(_0x23eaa7,_0x2a3ce1){if(!this['isTrunkReachable'](_0x23eaa7)){ut[_0x106a('0x47')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x106a('0x6d')](_0x23eaa7)?'':_0x23eaa7['name']+_0x106a('0x71'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x106a('0x6d')](_0x2a3ce1['fax'])){ut[_0x106a('0x47')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x106a('0x3f')](_0x2a3ce1));return{'isValid':![],'message':_0x106a('0x72')};}if(_[_0x106a('0x6d')](_0x2a3ce1['path'])){ut[_0x106a('0x47')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x106a('0x3f')](_0x2a3ce1));return{'isValid':![],'message':_0x106a('0x73')};}return{'isValid':!![],'message':_0x106a('0x74')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 8cd8bc1..87c8670 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 _0x400e=['preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x3cb664,_0x29edc3){var _0x2eaff0=function(_0x181825){while(--_0x181825){_0x3cb664['push'](_0x3cb664['shift']());}};_0x2eaff0(++_0x29edc3);}(_0x400e,0x195));var _0xe400=function(_0x3f9584,_0x5ab12c){_0x3f9584=_0x3f9584-0x0;var _0x9d54c=_0x400e[_0x3f9584];return _0x9d54c;};'use strict';var util=require(_0xe400('0x0'));var BPromise=require(_0xe400('0x1'));var logger=require(_0xe400('0x2'))(_0xe400('0x3'));var _=require(_0xe400('0x4'));var faxAccount=require(_0xe400('0x5'));function loggerCatch(_0x32d24a){return function(_0x575cb7){logger[_0xe400('0x6')](_0x32d24a,util[_0xe400('0x7')](_0x575cb7,{'showHidden':![],'depth':null}));};}exports[_0xe400('0x8')]=function(_0x59b6ae,_0x50fcea){return BPromise[_0xe400('0x9')]()['then'](faxAccount[_0xe400('0x8')](_0x59b6ae,_0x50fcea))[_0xe400('0xa')](loggerCatch(_0xe400('0xb')));}; \ No newline at end of file +var _0xd52a=['bluebird','../../../config/logger','preview','lodash','error','resolve','notify','[Notify]\x20','util'];(function(_0xbb1361,_0x21a9b6){var _0x3362a3=function(_0x5d6e61){while(--_0x5d6e61){_0xbb1361['push'](_0xbb1361['shift']());}};_0x3362a3(++_0x21a9b6);}(_0xd52a,0xa1));var _0xad52=function(_0x1530f2,_0x30b5bc){_0x1530f2=_0x1530f2-0x0;var _0x34930a=_0xd52a[_0x1530f2];return _0x34930a;};'use strict';var util=require(_0xad52('0x0'));var BPromise=require(_0xad52('0x1'));var logger=require(_0xad52('0x2'))(_0xad52('0x3'));var _=require(_0xad52('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x259727){return function(_0x386d98){logger[_0xad52('0x5')](_0x259727,util['inspect'](_0x386d98,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x5683ff,_0x295385){return BPromise[_0xad52('0x6')]()['then'](faxAccount[_0xad52('0x7')](_0x5683ff,_0x295385))['catch'](loggerCatch(_0xad52('0x8')));}; \ 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 93fbea9..82308a2 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 _0x3ef1=['exec','execute','Exec\x20gs','inspect','util','fax','bluebird'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x3ef1,0x11c));var _0x13ef=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x3ef1[_0x42245d];return _0x4b211a;};'use strict';var util=require(_0x13ef('0x0'));var logger=require('../../../../config/logger')(_0x13ef('0x1'));var BPromise=require(_0x13ef('0x2'));var exec=require('child_process')[_0x13ef('0x3')];exports[_0x13ef('0x4')]=function(_0x4408c1){return new BPromise(function(_0x321baf,_0x869490){exec(_0x4408c1,function(_0x21aee8,_0x5519ab,_0x52ae49){logger['info'](_0x13ef('0x5'),_0x5519ab);if(_0x21aee8){logger['info']('Exec\x20gs','\x20Error\x20:',util[_0x13ef('0x6')](_0x21aee8,{'showHidden':![],'depth':null}),_0x5519ab,_0x52ae49);_0x869490(_0x21aee8);}_0x321baf(_0x5519ab);});});}; \ No newline at end of file +var _0xa8c7=['child_process','exec','info','Exec\x20gs','inspect','fax','bluebird'];(function(_0x5ca842,_0x56a902){var _0x4c4083=function(_0x2e51a6){while(--_0x2e51a6){_0x5ca842['push'](_0x5ca842['shift']());}};_0x4c4083(++_0x56a902);}(_0xa8c7,0x155));var _0x7a8c=function(_0x1f1bfd,_0x51584d){_0x1f1bfd=_0x1f1bfd-0x0;var _0x375323=_0xa8c7[_0x1f1bfd];return _0x375323;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x7a8c('0x0'));var BPromise=require(_0x7a8c('0x1'));var exec=require(_0x7a8c('0x2'))[_0x7a8c('0x3')];exports['execute']=function(_0x1ad850){return new BPromise(function(_0x54d094,_0x27aa64){exec(_0x1ad850,function(_0x55cde5,_0x45f3ba,_0x38342d){logger[_0x7a8c('0x4')]('Exec\x20gs',_0x45f3ba);if(_0x55cde5){logger[_0x7a8c('0x4')](_0x7a8c('0x5'),'\x20Error\x20:',util[_0x7a8c('0x6')](_0x55cde5,{'showHidden':![],'depth':null}),_0x45f3ba,_0x38342d);_0x27aa64(_0x55cde5);}_0x54d094(_0x45f3ba);});});}; \ 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 e0dab67..e901ce8 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 _0xb821=['format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','moment','message','info','inspect','ecm','headerinfo','minrate','maxrate'];(function(_0x1c37a5,_0x59ee51){var _0x389d03=function(_0x51b4f4){while(--_0x51b4f4){_0x1c37a5['push'](_0x1c37a5['shift']());}};_0x389d03(++_0x59ee51);}(_0xb821,0xa7));var _0x1b82=function(_0x21f7bf,_0x16f7e0){_0x21f7bf=_0x21f7bf-0x0;var _0x14c5ed=_0xb821[_0x21f7bf];return _0x14c5ed;};'use strict';var util=require('util');var _=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var logger=require('../../../../config/logger')('fax');exports[_0x1b82('0x2')]=function(_0x578a10){return{'message':_0x578a10};};exports['logger']=function(_0x3b1d14,_0x1403ab){logger[_0x1b82('0x3')](_0x3b1d14,util[_0x1b82('0x4')](_0x1403ab,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3e27c4,_0x192434){var _0x202a5f={'XMF-ECM':_0x192434[_0x1b82('0x5')],'XMF-HEADERINFO':_0x192434[_0x1b82('0x6')],'XMF-MINRATE':_0x192434[_0x1b82('0x7')],'XMF-MAXRATE':_0x192434[_0x1b82('0x8')],'XMF-MODEM':util[_0x1b82('0x9')](_0x1b82('0xa'),_0x192434['modem']),'XMF-GATEWAY':_0x192434[_0x1b82('0xb')],'XMF-FAXDETECT':_0x192434[_0x1b82('0xc')],'XMF-T38TIMEOUT':_0x192434[_0x1b82('0xd')],'XMF-LOCALSTATIONID':_0x192434[_0x1b82('0xe')],'XMF-PATH':_0x3e27c4[_0x1b82('0xf')]};return _0x202a5f;};exports[_0x1b82('0x10')]=function(_0x739f99,_0x1ce719){return{'actionid':_0x739f99['uniqueid'],'action':_0x1b82('0x11'),'channel':_0x739f99[_0x1b82('0x12')],'Exten':_0x1b82('0x13'),'Context':_0x1b82('0x14'),'Priority':'1','callerid':util['format'](_0x1b82('0x15'),_0x739f99['headerinfo']?_0x739f99['headerinfo']:'',_0x739f99[_0x1b82('0xe')]),'variable':_0x1ce719,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x739f99['uniqueid']};}; \ No newline at end of file +var _0x7af2=['info','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','faxdetect','path','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid','uniqueid','lodash','moment','../../../../config/logger','fax','logger'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x7af2,0x119));var _0x27af=function(_0x18b9a8,_0x1770b6){_0x18b9a8=_0x18b9a8-0x0;var _0x4a0a8f=_0x7af2[_0x18b9a8];return _0x4a0a8f;};'use strict';var util=require('util');var _=require(_0x27af('0x0'));var moment=require(_0x27af('0x1'));var logger=require(_0x27af('0x2'))(_0x27af('0x3'));exports['message']=function(_0x8556d){return{'message':_0x8556d};};exports[_0x27af('0x4')]=function(_0x709cb6,_0x2a542f){logger[_0x27af('0x5')](_0x709cb6,util[_0x27af('0x6')](_0x2a542f,{'showHidden':![],'depth':null}));};exports[_0x27af('0x7')]=function(_0x184630,_0x2193c6){var _0x572219={'XMF-ECM':_0x2193c6[_0x27af('0x8')],'XMF-HEADERINFO':_0x2193c6[_0x27af('0x9')],'XMF-MINRATE':_0x2193c6[_0x27af('0xa')],'XMF-MAXRATE':_0x2193c6['maxrate'],'XMF-MODEM':util[_0x27af('0xb')](_0x27af('0xc'),_0x2193c6[_0x27af('0xd')]),'XMF-GATEWAY':_0x2193c6['gateway'],'XMF-FAXDETECT':_0x2193c6[_0x27af('0xe')],'XMF-T38TIMEOUT':_0x2193c6['t38timeout'],'XMF-LOCALSTATIONID':_0x2193c6['localstationid'],'XMF-PATH':_0x184630[_0x27af('0xf')]};return _0x572219;};exports['variablesAction']=function(_0x50fe01,_0x184e25){return{'actionid':_0x50fe01['uniqueid'],'action':_0x27af('0x10'),'channel':_0x50fe01['channel'],'Exten':_0x27af('0x11'),'Context':_0x27af('0x12'),'Priority':'1','callerid':util[_0x27af('0xb')](_0x27af('0x13'),_0x50fe01[_0x27af('0x9')]?_0x50fe01[_0x27af('0x9')]:'',_0x50fe01[_0x27af('0x14')]),'variable':_0x184e25,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x50fe01[_0x27af('0x15')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 47bf011..44563ca 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 _0xfde9=['sync','bluebird','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch'];(function(_0x803309,_0x273077){var _0x2d5337=function(_0x24167c){while(--_0x24167c){_0x803309['push'](_0x803309['shift']());}};_0x2d5337(++_0x273077);}(_0xfde9,0x141));var _0x9fde=function(_0x4cf0b7,_0x560029){_0x4cf0b7=_0x4cf0b7-0x0;var _0x545f10=_0xfde9[_0x4cf0b7];return _0x545f10;};'use strict';var BPromise=require(_0x9fde('0x0'));var util=require('util');var moment=require(_0x9fde('0x1'));var server=require(_0x9fde('0x2'));var Realtime=require(_0x9fde('0x3'));var Report=require(_0x9fde('0x4'));var Acw=require(_0x9fde('0x5'));var Trigger=require(_0x9fde('0x6'));var Dialer=require(_0x9fde('0x7'));var Preview=require(_0x9fde('0x8'));var Fax=require('./fax');var user=require(_0x9fde('0x9'));var voiceQueue=require(_0x9fde('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x9fde('0xb'));var trunk=require(_0x9fde('0xc'));var trigger=require(_0x9fde('0xd'));var template=require(_0x9fde('0xe'));var cmHopperHistory=require(_0x9fde('0xf'));var campaign=require(_0x9fde('0x10'));var voiceExtension=require(_0x9fde('0x11'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x9fde('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x9fde('0x13'));var desk=require(_0x9fde('0x14'));var zoho=require(_0x9fde('0x15'));var vtiger=require(_0x9fde('0x16'));var freshsales=require(_0x9fde('0x17'));var servicenow=require(_0x9fde('0x18'));var dynamics365=require(_0x9fde('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x9fde('0x1a')](_0x9fde('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x9fde('0x1a')](_0x9fde('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x9fde('0x1c')]()[_0x9fde('0x1d')](user[_0x9fde('0x1e')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x1f')]())['then'](user[_0x9fde('0x20')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x21')]())[_0x9fde('0x1d')](trunk[_0x9fde('0x22')]())['then'](realtime[_0x9fde('0x23')]())['then'](voiceQueue[_0x9fde('0x24')]())[_0x9fde('0x1d')](realtime['initVoiceQueues']())[_0x9fde('0x1d')](trigger[_0x9fde('0x25')]())[_0x9fde('0x1d')](realtime['initTriggers']())[_0x9fde('0x1d')](template['getTemplates']())[_0x9fde('0x1d')](realtime['initTemplates']())[_0x9fde('0x1d')](zendesk['getZendeskAccounts']())[_0x9fde('0x1d')](realtime[_0x9fde('0x26')]())[_0x9fde('0x1d')](salesforce[_0x9fde('0x27')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x28')]())[_0x9fde('0x1d')](sugarcrm[_0x9fde('0x29')]())[_0x9fde('0x1d')](realtime['initSugarcrmAccounts']())[_0x9fde('0x1d')](freshdesk[_0x9fde('0x2a')]())[_0x9fde('0x1d')](realtime['initFreshdeskAccounts']())[_0x9fde('0x1d')](desk[_0x9fde('0x2b')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x2c')]())[_0x9fde('0x1d')](zoho['getZohoAccounts']())[_0x9fde('0x1d')](realtime[_0x9fde('0x2d')]())['then'](vtiger[_0x9fde('0x2e')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x2f')]())['then'](freshsales['getFreshsalesAccounts']())[_0x9fde('0x1d')](realtime[_0x9fde('0x30')]())['then'](servicenow[_0x9fde('0x31')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x32')]())[_0x9fde('0x1d')](dynamics365[_0x9fde('0x33')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x34')]())['then'](campaign['getCampaigns']())[_0x9fde('0x1d')](realtime['initCampaigns']())['then'](voiceExtension[_0x9fde('0x35')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x36')]())['then'](faxAccount[_0x9fde('0x37')]())['then'](realtime[_0x9fde('0x38')]())[_0x9fde('0x1d')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x9fde('0x1d')](voiceQueueReport[_0x9fde('0x39')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x3a')]())[_0x9fde('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x9fde('0x1d')](realtime[_0x9fde('0x3b')]())[_0x9fde('0x1d')](cmHopperHistory['getCampaignHopperHistory']())[_0x9fde('0x1d')](realtime[_0x9fde('0x3c')]())['then'](voiceCallReport[_0x9fde('0x3d')]())['then'](realtime['initVoiceCallReports']())[_0x9fde('0x1d')](function(_0x3595a5){})[_0x9fde('0x3e')](function(_0x4ba1cf){console['log'](_0x4ba1cf);});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x46ecee){return initRealtime();})[_0x9fde('0x1d')](function(){return initParams();})[_0x9fde('0x1d')](function(){report[_0x9fde('0x3f')]();setInterval(initRealtime,0x1388);})[_0x9fde('0x3e')](function(_0x5c07b8){console['log'](_0x5c07b8);});}main(); \ No newline at end of file +var _0x23a6=['getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','initCampaignHopperHistory','initVoiceCallReports','catch','log','sync','util','./server','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initTelephones','getTrunks','initTrunks','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts'];(function(_0x586f52,_0xec748d){var _0x3eee79=function(_0x2081a3){while(--_0x2081a3){_0x586f52['push'](_0x586f52['shift']());}};_0x3eee79(++_0xec748d);}(_0x23a6,0xdc));var _0x623a=function(_0x30f033,_0x57fb7f){_0x30f033=_0x30f033-0x0;var _0x2b6f63=_0x23a6[_0x30f033];return _0x2b6f63;};'use strict';var BPromise=require('bluebird');var util=require(_0x623a('0x0'));var moment=require('moment');var server=require(_0x623a('0x1'));var Realtime=require(_0x623a('0x2'));var Report=require('./report');var Acw=require(_0x623a('0x3'));var Trigger=require(_0x623a('0x4'));var Dialer=require(_0x623a('0x5'));var Preview=require(_0x623a('0x6'));var Fax=require(_0x623a('0x7'));var user=require(_0x623a('0x8'));var voiceQueue=require(_0x623a('0x9'));var voiceQueueReport=require(_0x623a('0xa'));var voiceCallReport=require(_0x623a('0xb'));var trunk=require(_0x623a('0xc'));var trigger=require(_0x623a('0xd'));var template=require(_0x623a('0xe'));var cmHopperHistory=require(_0x623a('0xf'));var campaign=require(_0x623a('0x10'));var voiceExtension=require(_0x623a('0x11'));var faxAccount=require(_0x623a('0x12'));var zendesk=require(_0x623a('0x13'));var salesforce=require(_0x623a('0x14'));var sugarcrm=require(_0x623a('0x15'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0x623a('0x16'));var vtiger=require(_0x623a('0x17'));var freshsales=require(_0x623a('0x18'));var servicenow=require(_0x623a('0x19'));var dynamics365=require(_0x623a('0x1a'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x623a('0x1b')](_0x623a('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x623a('0x1b')](_0x623a('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x623a('0x1d')]()[_0x623a('0x1e')](user[_0x623a('0x1f')]())[_0x623a('0x1e')](realtime['initAgents']())[_0x623a('0x1e')](user['getTelephones']())['then'](realtime[_0x623a('0x20')]())[_0x623a('0x1e')](trunk[_0x623a('0x21')]())[_0x623a('0x1e')](realtime[_0x623a('0x22')]())[_0x623a('0x1e')](voiceQueue['getVoiceQueues']())[_0x623a('0x1e')](realtime['initVoiceQueues']())['then'](trigger['getTriggers']())[_0x623a('0x1e')](realtime['initTriggers']())[_0x623a('0x1e')](template[_0x623a('0x23')]())[_0x623a('0x1e')](realtime[_0x623a('0x24')]())[_0x623a('0x1e')](zendesk[_0x623a('0x25')]())['then'](realtime['initZendeskAccounts']())[_0x623a('0x1e')](salesforce[_0x623a('0x26')]())['then'](realtime[_0x623a('0x27')]())[_0x623a('0x1e')](sugarcrm[_0x623a('0x28')]())[_0x623a('0x1e')](realtime[_0x623a('0x29')]())['then'](freshdesk[_0x623a('0x2a')]())[_0x623a('0x1e')](realtime[_0x623a('0x2b')]())[_0x623a('0x1e')](desk[_0x623a('0x2c')]())[_0x623a('0x1e')](realtime['initDeskAccounts']())[_0x623a('0x1e')](zoho[_0x623a('0x2d')]())[_0x623a('0x1e')](realtime['initZohoAccounts']())[_0x623a('0x1e')](vtiger[_0x623a('0x2e')]())[_0x623a('0x1e')](realtime[_0x623a('0x2f')]())[_0x623a('0x1e')](freshsales[_0x623a('0x30')]())[_0x623a('0x1e')](realtime[_0x623a('0x31')]())[_0x623a('0x1e')](servicenow[_0x623a('0x32')]())[_0x623a('0x1e')](realtime[_0x623a('0x33')]())[_0x623a('0x1e')](dynamics365[_0x623a('0x34')]())[_0x623a('0x1e')](realtime[_0x623a('0x35')]())[_0x623a('0x1e')](campaign[_0x623a('0x36')]())[_0x623a('0x1e')](realtime[_0x623a('0x37')]())[_0x623a('0x1e')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x623a('0x38')]())[_0x623a('0x1e')](faxAccount[_0x623a('0x39')]())[_0x623a('0x1e')](realtime[_0x623a('0x3a')]())[_0x623a('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0x623a('0x1d')]()['then'](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x623a('0x3b')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x623a('0x1e')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x623a('0x1e')](realtime[_0x623a('0x3c')]())[_0x623a('0x1e')](voiceCallReport['getVoiceCallReports']())[_0x623a('0x1e')](realtime[_0x623a('0x3d')]())[_0x623a('0x1e')](function(_0x2f4498){})[_0x623a('0x3e')](function(_0xf35fa0){console[_0x623a('0x3f')](_0xf35fa0);});}function main(){return server['listen'](realtime,preview,fax)[_0x623a('0x1e')](function(_0x1a55af){return initRealtime();})['then'](function(){return initParams();})[_0x623a('0x1e')](function(){report[_0x623a('0x40')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x139ba8){console[_0x623a('0x3f')](_0x139ba8);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 6af2ae6..07bd968 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 _0x5b55=['state','toLowerCase','not_inuse','idle','talking','statePause','voiceStatusTime','toNumber','format','interface','onhold','stringify','user:%s','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','name','email','accountcode','fullname','stateTime','status','address','phone','mobile','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime'];(function(_0x20c8c5,_0x28e1ee){var _0x3309b0=function(_0x264c43){while(--_0x264c43){_0x20c8c5['push'](_0x20c8c5['shift']());}};_0x3309b0(++_0x28e1ee);}(_0x5b55,0x18a));var _0x55b5=function(_0x18175b,_0x4d7376){_0x18175b=_0x18175b-0x0;var _0x210d45=_0x5b55[_0x18175b];return _0x210d45;};'use strict';var _=require(_0x55b5('0x0'));var util=require(_0x55b5('0x1'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x55b5('0x2'));var config=require(_0x55b5('0x3'));config['redis']=_[_0x55b5('0x4')](config[_0x55b5('0x5')],{'host':_0x55b5('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x55b5('0x5')]));function Agent(_0x5640d0){this['id']=_0x5640d0['id']||0x0;this[_0x55b5('0x7')]=_0x5640d0[_0x55b5('0x7')]||'';this['email']=_0x5640d0[_0x55b5('0x8')]||'';this[_0x55b5('0x9')]=_0x5640d0[_0x55b5('0x9')]||'';this['fullname']=_0x5640d0[_0x55b5('0xa')]||'';this['state']='unknown';this[_0x55b5('0xb')]=0x0;this[_0x55b5('0xc')]='unknown';this[_0x55b5('0xd')]='';this[_0x55b5('0xe')]='';this[_0x55b5('0xf')]='';this['interface']='';this[_0x55b5('0x10')]=_0x5640d0['online']||![];this[_0x55b5('0x11')]='unknown';this['voiceStatusTime']=0x0;this[_0x55b5('0x12')]='';this[_0x55b5('0x13')]='';this['onhold']=![];this[_0x55b5('0x14')]=![];this[_0x55b5('0x15')]='';}Agent[_0x55b5('0x16')][_0x55b5('0x17')]=function(_0x2e37fe){var _0x2bb2d3;if(_0x2e37fe&&_0x2e37fe[_0x55b5('0x18')]){_0x2bb2d3=_0x2e37fe[_0x55b5('0x18')][_0x55b5('0x19')]();switch(_0x2bb2d3){case _0x55b5('0x1a'):_0x2bb2d3=_0x55b5('0x1b');break;case'inuse':_0x2bb2d3=_0x55b5('0x1c');break;}}if(_0x2bb2d3&&this['voiceStatus']!==_0x2bb2d3||_0x2e37fe[_0x55b5('0x1d')]){this[_0x55b5('0x1e')]=_[_0x55b5('0x1f')](moment()[_0x55b5('0x20')]('x'));}if(_0x2bb2d3){this['voiceStatus']=_0x2bb2d3;}var _0x1add5d={'id':this['id'],'name':this[_0x55b5('0x7')],'email':this[_0x55b5('0x8')],'accountcode':this[_0x55b5('0x9')],'fullname':this['fullname'],'state':this[_0x55b5('0x18')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x55b5('0xd')],'online':this[_0x55b5('0x10')],'voiceStatus':this[_0x55b5('0x11')],'voiceStatusTime':this[_0x55b5('0x1e')],'voiceStatusCallerIdNumber':this[_0x55b5('0x12')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x55b5('0x21')],'onhold':this[_0x55b5('0x22')]};var _0x457d4d=md5(JSON[_0x55b5('0x23')](_0x1add5d));if(this['md5']!==_0x457d4d){this['md5']=_0x457d4d;io['to'](util[_0x55b5('0x20')](_0x55b5('0x24'),_0x1add5d['name']))['emit']('user:save',_0x1add5d);}};module[_0x55b5('0x25')]=Agent; \ No newline at end of file +var _0x8454=['user:save','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','state','status','address','phone','mobile','interface','online','voiceStatus','unknown','voiceStatusTime','voiceStatusQueue','onhold','prototype','updateStatusRealtime','not_inuse','idle','inuse','statePause','format','fullname','stateTime','voiceStatusCallerIdNumber','user:%s','emit'];(function(_0x4323d4,_0x1c38df){var _0x1c3864=function(_0x29beb0){while(--_0x29beb0){_0x4323d4['push'](_0x4323d4['shift']());}};_0x1c3864(++_0x1c38df);}(_0x8454,0x1a4));var _0x4845=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8454[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x4845('0x0'));var util=require(_0x4845('0x1'));var moment=require(_0x4845('0x2'));var md5=require(_0x4845('0x3'));var Redis=require(_0x4845('0x4'));var config=require(_0x4845('0x5'));config[_0x4845('0x6')]=_['defaults'](config[_0x4845('0x6')],{'host':_0x4845('0x7'),'port':0x18eb});var io=require(_0x4845('0x8'))(new Redis(config[_0x4845('0x6')]));function Agent(_0x5304c9){this['id']=_0x5304c9['id']||0x0;this['name']=_0x5304c9[_0x4845('0x9')]||'';this[_0x4845('0xa')]=_0x5304c9['email']||'';this[_0x4845('0xb')]=_0x5304c9[_0x4845('0xb')]||'';this['fullname']=_0x5304c9['fullname']||'';this[_0x4845('0xc')]='unknown';this['stateTime']=0x0;this[_0x4845('0xd')]='unknown';this[_0x4845('0xe')]='';this[_0x4845('0xf')]='';this[_0x4845('0x10')]='';this[_0x4845('0x11')]='';this[_0x4845('0x12')]=_0x5304c9[_0x4845('0x12')]||![];this[_0x4845('0x13')]=_0x4845('0x14');this[_0x4845('0x15')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x4845('0x16')]='';this[_0x4845('0x17')]=![];this['local']=![];this[_0x4845('0x3')]='';}Agent[_0x4845('0x18')][_0x4845('0x19')]=function(_0x2f9b02){var _0x5ec8e3;if(_0x2f9b02&&_0x2f9b02[_0x4845('0xc')]){_0x5ec8e3=_0x2f9b02[_0x4845('0xc')]['toLowerCase']();switch(_0x5ec8e3){case _0x4845('0x1a'):_0x5ec8e3=_0x4845('0x1b');break;case _0x4845('0x1c'):_0x5ec8e3='talking';break;}}if(_0x5ec8e3&&this[_0x4845('0x13')]!==_0x5ec8e3||_0x2f9b02[_0x4845('0x1d')]){this[_0x4845('0x15')]=_['toNumber'](moment()[_0x4845('0x1e')]('x'));}if(_0x5ec8e3){this[_0x4845('0x13')]=_0x5ec8e3;}var _0xa15689={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0x4845('0xb')],'fullname':this[_0x4845('0x1f')],'state':this[_0x4845('0xc')],'stateTime':this[_0x4845('0x20')],'status':this[_0x4845('0xd')],'address':this[_0x4845('0xe')],'online':this[_0x4845('0x12')],'voiceStatus':this[_0x4845('0x13')],'voiceStatusTime':this[_0x4845('0x15')],'voiceStatusCallerIdNumber':this[_0x4845('0x21')],'voiceStatusQueue':this[_0x4845('0x16')],'interface':this['interface'],'onhold':this[_0x4845('0x17')]};var _0x7eac8e=md5(JSON['stringify'](_0xa15689));if(this[_0x4845('0x3')]!==_0x7eac8e){this[_0x4845('0x3')]=_0x7eac8e;io['to'](util[_0x4845('0x1e')](_0x4845('0x22'),_0xa15689['name']))[_0x4845('0x23')](_0x4845('0x24'),_0xa15689);}};module[_0x4845('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 5d78e45..3e06ba6 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 _0x3017=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x582f72,_0x886d8){var _0x4cd5fe=function(_0x4ac1c7){while(--_0x4ac1c7){_0x582f72['push'](_0x582f72['shift']());}};_0x4cd5fe(++_0x886d8);}(_0x3017,0x1ba));var _0x7301=function(_0x5ebafc,_0x3fd116){_0x5ebafc=_0x5ebafc-0x0;var _0x227d5e=_0x3017[_0x5ebafc];return _0x227d5e;};'use strict';function Campaign(_0x539209){this['id']=_0x539209['id']||0x0;this['name']=_0x539209[_0x7301('0x0')]||'';this[_0x7301('0x1')]=_0x539209[_0x7301('0x1')]||_0x7301('0x2');this[_0x7301('0x3')]=0x0;this[_0x7301('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x7301('0x5')]=0x0;this[_0x7301('0x6')]='';this[_0x7301('0x7')]=!![];this[_0x7301('0x8')]=_0x539209[_0x7301('0x8')];this['limitCalls']=_0x539209[_0x7301('0x9')];this[_0x7301('0xa')]=_0x539209[_0x7301('0xa')]||null;this[_0x7301('0xb')]=_0x539209['dialGlobalInterval']?_0x539209['dialGlobalInterval']:null;this[_0x7301('0xc')]=_0x539209[_0x7301('0xc')];this['dialOriginateCallerIdNumber']=_0x539209[_0x7301('0xd')];this[_0x7301('0xe')]=_0x539209['dialOriginateTimeout']||0x1e;this[_0x7301('0xf')]=_0x539209['dialCongestionMaxRetry'];this[_0x7301('0x10')]=_0x539209[_0x7301('0x10')];this[_0x7301('0x11')]=_0x539209[_0x7301('0x11')];this[_0x7301('0x12')]=_0x539209[_0x7301('0x12')];this[_0x7301('0x13')]=_0x539209[_0x7301('0x13')];this[_0x7301('0x14')]=_0x539209['dialNoAnswerRetryFrequency'];this[_0x7301('0x15')]=_0x539209[_0x7301('0x15')];this['dialNoSuchNumberMaxRetry']=_0x539209[_0x7301('0x16')]||0x3;this[_0x7301('0x17')]=_0x539209[_0x7301('0x17')]||0x96;this[_0x7301('0x18')]=_0x539209[_0x7301('0x18')]||0x3;this[_0x7301('0x19')]=_0x539209[_0x7301('0x19')]||0x96;this[_0x7301('0x1a')]=_0x539209[_0x7301('0x1a')]||0x3;this['dialAbandonedRetryFrequency']=_0x539209['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x539209['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x539209[_0x7301('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x539209[_0x7301('0x1c')]||0x3;this[_0x7301('0x1d')]=_0x539209['dialAgentRejectRetryFrequency']||0x96;this[_0x7301('0x1e')]=_0x539209['dialOrderByScheduledAt']||_0x7301('0x1f');this[_0x7301('0x20')]=_0x539209[_0x7301('0x20')]||undefined;this[_0x7301('0x21')]=_0x539209[_0x7301('0x21')]||undefined;this['dialCutDigit']=_0x539209[_0x7301('0x22')]||undefined;this['TrunkBackup']=_0x539209[_0x7301('0x23')]?_0x539209[_0x7301('0x23')]:undefined;this['Trunk']=_0x539209[_0x7301('0x24')]?_0x539209['Trunk']:undefined;this['Interval']=_0x539209[_0x7301('0x25')]?_0x539209[_0x7301('0x25')]:undefined;this[_0x7301('0x26')]=_0x539209[_0x7301('0x26')]?_0x539209['SquareProject']:undefined;this[_0x7301('0x27')]=_0x539209[_0x7301('0x26')]?_0x539209['SquareProject'][_0x7301('0x0')]:undefined;this[_0x7301('0x28')]=_0x539209[_0x7301('0x28')]||![];this[_0x7301('0x29')]=_0x539209[_0x7301('0x29')];this[_0x7301('0x2a')]=_0x539209[_0x7301('0x2a')];this[_0x7301('0x2b')]=_0x539209[_0x7301('0x2b')];this[_0x7301('0x2c')]=_0x539209[_0x7301('0x2c')];this[_0x7301('0x2d')]=_0x539209[_0x7301('0x2d')];this['dialAMDBetweenWordsSilence']=_0x539209[_0x7301('0x2e')];this[_0x7301('0x2f')]=_0x539209[_0x7301('0x2f')];this[_0x7301('0x30')]=_0x539209[_0x7301('0x30')];this[_0x7301('0x31')]=_0x539209[_0x7301('0x31')];}module[_0x7301('0x32')]=Campaign; \ No newline at end of file +var _0xdcf9=['DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt'];(function(_0x4d13a6,_0xf86ffa){var _0x5795fe=function(_0x4fd9a1){while(--_0x4fd9a1){_0x4d13a6['push'](_0x4d13a6['shift']());}};_0x5795fe(++_0xf86ffa);}(_0xdcf9,0x101));var _0x9dcf=function(_0x496c25,_0x45deb0){_0x496c25=_0x496c25-0x0;var _0x457f3c=_0xdcf9[_0x496c25];return _0x457f3c;};'use strict';function Campaign(_0x167a02){this['id']=_0x167a02['id']||0x0;this[_0x9dcf('0x0')]=_0x167a02[_0x9dcf('0x0')]||'';this[_0x9dcf('0x1')]=_0x167a02[_0x9dcf('0x1')]||_0x9dcf('0x2');this[_0x9dcf('0x3')]=0x0;this[_0x9dcf('0x4')]=0x0;this[_0x9dcf('0x5')]=0x0;this[_0x9dcf('0x6')]=0x0;this[_0x9dcf('0x7')]='';this[_0x9dcf('0x8')]=!![];this[_0x9dcf('0x9')]=_0x167a02['active'];this['limitCalls']=_0x167a02['limitCalls'];this[_0x9dcf('0xa')]=_0x167a02[_0x9dcf('0xa')]||null;this[_0x9dcf('0xb')]=_0x167a02[_0x9dcf('0xb')]?_0x167a02[_0x9dcf('0xb')]:null;this['dialOriginateCallerIdName']=_0x167a02[_0x9dcf('0xc')];this['dialOriginateCallerIdNumber']=_0x167a02['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x167a02[_0x9dcf('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x167a02[_0x9dcf('0xe')];this[_0x9dcf('0xf')]=_0x167a02['dialCongestionRetryFrequency'];this[_0x9dcf('0x10')]=_0x167a02[_0x9dcf('0x10')];this[_0x9dcf('0x11')]=_0x167a02['dialBusyRetryFrequency'];this[_0x9dcf('0x12')]=_0x167a02['dialNoAnswerMaxRetry'];this[_0x9dcf('0x13')]=_0x167a02['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x167a02['dialGlobalMaxRetry'];this[_0x9dcf('0x14')]=_0x167a02[_0x9dcf('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x167a02[_0x9dcf('0x15')]||0x96;this['dialDropMaxRetry']=_0x167a02[_0x9dcf('0x16')]||0x3;this[_0x9dcf('0x17')]=_0x167a02[_0x9dcf('0x17')]||0x96;this[_0x9dcf('0x18')]=_0x167a02[_0x9dcf('0x18')]||0x3;this[_0x9dcf('0x19')]=_0x167a02['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x167a02[_0x9dcf('0x1a')]||0x3;this[_0x9dcf('0x1b')]=_0x167a02[_0x9dcf('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x167a02[_0x9dcf('0x1c')]||0x3;this[_0x9dcf('0x1d')]=_0x167a02[_0x9dcf('0x1d')]||0x96;this[_0x9dcf('0x1e')]=_0x167a02[_0x9dcf('0x1e')]||_0x9dcf('0x1f');this[_0x9dcf('0x20')]=_0x167a02[_0x9dcf('0x20')]||undefined;this[_0x9dcf('0x21')]=_0x167a02[_0x9dcf('0x21')]||undefined;this[_0x9dcf('0x22')]=_0x167a02[_0x9dcf('0x22')]||undefined;this['TrunkBackup']=_0x167a02[_0x9dcf('0x23')]?_0x167a02['TrunkBackup']:undefined;this['Trunk']=_0x167a02['Trunk']?_0x167a02['Trunk']:undefined;this[_0x9dcf('0x24')]=_0x167a02['Interval']?_0x167a02[_0x9dcf('0x24')]:undefined;this[_0x9dcf('0x25')]=_0x167a02['SquareProject']?_0x167a02[_0x9dcf('0x25')]:undefined;this[_0x9dcf('0x26')]=_0x167a02['SquareProject']?_0x167a02[_0x9dcf('0x25')][_0x9dcf('0x0')]:undefined;this[_0x9dcf('0x27')]=_0x167a02[_0x9dcf('0x27')]||![];this['dialAMDInitialSilence']=_0x167a02[_0x9dcf('0x28')];this[_0x9dcf('0x29')]=_0x167a02[_0x9dcf('0x29')];this[_0x9dcf('0x2a')]=_0x167a02[_0x9dcf('0x2a')];this['dialAMDTotalAnalysisTime']=_0x167a02['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x167a02['dialAMDMinWordLength'];this[_0x9dcf('0x2b')]=_0x167a02[_0x9dcf('0x2b')];this[_0x9dcf('0x2c')]=_0x167a02[_0x9dcf('0x2c')];this[_0x9dcf('0x2d')]=_0x167a02[_0x9dcf('0x2d')];this[_0x9dcf('0x2e')]=_0x167a02[_0x9dcf('0x2e')];}module[_0x9dcf('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index a7019cc..5ac8bbc 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 _0x9f89=['linkedid','exten','answered','answertime','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','type','tag','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x9f89,0x13d));var _0x99f8=function(_0x556e5c,_0x4194d1){_0x556e5c=_0x556e5c-0x0;var _0x3fdaac=_0x9f89[_0x556e5c];return _0x3fdaac;};'use strict';function Channel(){this['starttime']=null;this[_0x99f8('0x0')]='';this['destinationchannel']='';this[_0x99f8('0x1')]=0x0;this[_0x99f8('0x2')]='';this[_0x99f8('0x3')]=undefined;this[_0x99f8('0x4')]=undefined;this[_0x99f8('0x5')]=0x0;this['context']='';this[_0x99f8('0x6')]=0x0;this[_0x99f8('0x7')]=0x0;this[_0x99f8('0x8')]=0x0;this[_0x99f8('0x9')]=![];this[_0x99f8('0xa')]=null;this[_0x99f8('0xb')]=null;this[_0x99f8('0xc')]=![];this['abandoned']=![];this[_0x99f8('0xd')]='';this[_0x99f8('0xe')]='';this[_0x99f8('0xf')]=0x0;this[_0x99f8('0x10')]=0x0;this['holdtime']=0x0;this[_0x99f8('0x11')]=null;this[_0x99f8('0x12')]=null;this[_0x99f8('0x13')]=null;this[_0x99f8('0x14')]=![];this['monitorFilename']=null;this[_0x99f8('0x15')]=null;this[_0x99f8('0x16')]=[];this[_0x99f8('0x17')]=undefined;this[_0x99f8('0x18')]=undefined;this[_0x99f8('0x19')]=0x0;}module[_0x99f8('0x1a')]=Channel; \ No newline at end of file +var _0x639a=['monitor','queue','monitors','transferconnectedlinenum','mohtime','starttime','channel','calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','disposition'];(function(_0x3a3a6a,_0x5eb6a9){var _0xa89294=function(_0x55d78c){while(--_0x55d78c){_0x3a3a6a['push'](_0x3a3a6a['shift']());}};_0xa89294(++_0x5eb6a9);}(_0x639a,0x1e8));var _0xa639=function(_0x22bb96,_0x3eb342){_0x22bb96=_0x22bb96-0x0;var _0x1b14cd=_0x639a[_0x22bb96];return _0x1b14cd;};'use strict';function Channel(){this[_0xa639('0x0')]=null;this[_0xa639('0x1')]='';this['destinationchannel']='';this['calleridnum']=0x0;this[_0xa639('0x2')]='';this[_0xa639('0x3')]=undefined;this['connectedlinename']=undefined;this[_0xa639('0x4')]=0x0;this[_0xa639('0x5')]='';this[_0xa639('0x6')]=0x0;this[_0xa639('0x7')]=0x0;this['exten']=0x0;this[_0xa639('0x8')]=![];this['answertime']=null;this[_0xa639('0x9')]=null;this[_0xa639('0xa')]=![];this[_0xa639('0xb')]=![];this[_0xa639('0xc')]='';this[_0xa639('0xd')]='';this['duration']=0x0;this[_0xa639('0xe')]=0x0;this[_0xa639('0xf')]=0x0;this[_0xa639('0x10')]=null;this['tag']=null;this[_0xa639('0x11')]=null;this[_0xa639('0x12')]=![];this['monitorFilename']=null;this[_0xa639('0x13')]=null;this[_0xa639('0x14')]=[];this['transfercalleridnum']=undefined;this[_0xa639('0x15')]=undefined;this[_0xa639('0x16')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index dc01399..fa40c38 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 _0xc5c7=['tokenSecret','type','Configurations','name','username','remoteUri','authType','password','consumerKey','token'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x2443b5,_0x3be475){_0x2443b5=_0x2443b5-0x0;var _0x1acfc6=_0xc5c7[_0x2443b5];return _0x1acfc6;};'use strict';function DeskAccount(_0x191cba){this['id']=_0x191cba['id']||0x0;this[_0x7c5c('0x0')]=_0x191cba[_0x7c5c('0x0')]||'';this[_0x7c5c('0x1')]=_0x191cba[_0x7c5c('0x1')]||'';this[_0x7c5c('0x2')]=_0x191cba[_0x7c5c('0x2')]||'';this['authType']=_0x191cba[_0x7c5c('0x3')]||'';this[_0x7c5c('0x4')]=_0x191cba[_0x7c5c('0x4')]||'';this[_0x7c5c('0x5')]=_0x191cba[_0x7c5c('0x5')]||'';this['consumerSecret']=_0x191cba['consumerSecret']||'';this[_0x7c5c('0x6')]=_0x191cba['token']||'';this[_0x7c5c('0x7')]=_0x191cba['tokenSecret']||'';this[_0x7c5c('0x8')]=_0x191cba[_0x7c5c('0x8')]||'';this['serverUrl']=_0x191cba['serverUrl']||'';this[_0x7c5c('0x9')]=_0x191cba[_0x7c5c('0x9')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xf2e0=['consumerKey','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x459356,_0x2bd203){var _0xd431d7=function(_0x2423c8){while(--_0x2423c8){_0x459356['push'](_0x459356['shift']());}};_0xd431d7(++_0x2bd203);}(_0xf2e0,0xc7));var _0x0f2e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xf2e0[_0x6c993a];return _0x27f547;};'use strict';function DeskAccount(_0x3bf0f1){this['id']=_0x3bf0f1['id']||0x0;this[_0x0f2e('0x0')]=_0x3bf0f1['name']||'';this[_0x0f2e('0x1')]=_0x3bf0f1[_0x0f2e('0x1')]||'';this['remoteUri']=_0x3bf0f1[_0x0f2e('0x2')]||'';this[_0x0f2e('0x3')]=_0x3bf0f1[_0x0f2e('0x3')]||'';this['password']=_0x3bf0f1[_0x0f2e('0x4')]||'';this[_0x0f2e('0x5')]=_0x3bf0f1[_0x0f2e('0x5')]||'';this['consumerSecret']=_0x3bf0f1['consumerSecret']||'';this[_0x0f2e('0x6')]=_0x3bf0f1['token']||'';this[_0x0f2e('0x7')]=_0x3bf0f1[_0x0f2e('0x7')]||'';this[_0x0f2e('0x8')]=_0x3bf0f1['type']||'';this[_0x0f2e('0x9')]=_0x3bf0f1[_0x0f2e('0x9')]||'';this[_0x0f2e('0xa')]=_0x3bf0f1['Configurations']||{};}module[_0x0f2e('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 5d3ac57..102fa28 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 _0x1fdc=['clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1fdc,0xf4));var _0xc1fd=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x1fdc[_0x8b8564];return _0x360c61;};'use strict';function Dynamics365Account(_0x1ed9a9){this['id']=_0x1ed9a9['id']||0x0;this[_0xc1fd('0x0')]=_0x1ed9a9['name']||'';this['username']=_0x1ed9a9[_0xc1fd('0x1')]||'';this[_0xc1fd('0x2')]=_0x1ed9a9[_0xc1fd('0x2')]||'';this[_0xc1fd('0x3')]=_0x1ed9a9[_0xc1fd('0x3')]||'';this[_0xc1fd('0x4')]=_0x1ed9a9[_0xc1fd('0x4')]||'';this[_0xc1fd('0x5')]=_0x1ed9a9[_0xc1fd('0x5')]||'';this['clientSecret']=_0x1ed9a9[_0xc1fd('0x6')]||{};this[_0xc1fd('0x7')]=_0x1ed9a9['serverUrl']||'';this[_0xc1fd('0x8')]=_0x1ed9a9[_0xc1fd('0x8')]||{};}module[_0xc1fd('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xec24=['Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x1fb4b5,_0x3fec2a){var _0x25a3db=function(_0x57021a){while(--_0x57021a){_0x1fb4b5['push'](_0x1fb4b5['shift']());}};_0x25a3db(++_0x3fec2a);}(_0xec24,0xfc));var _0x4ec2=function(_0x2abc8c,_0x381759){_0x2abc8c=_0x2abc8c-0x0;var _0x2eba36=_0xec24[_0x2abc8c];return _0x2eba36;};'use strict';function Dynamics365Account(_0x3134e2){this['id']=_0x3134e2['id']||0x0;this[_0x4ec2('0x0')]=_0x3134e2[_0x4ec2('0x0')]||'';this[_0x4ec2('0x1')]=_0x3134e2[_0x4ec2('0x1')]||'';this[_0x4ec2('0x2')]=_0x3134e2[_0x4ec2('0x2')]||'';this['remoteUri']=_0x3134e2[_0x4ec2('0x3')]||'';this[_0x4ec2('0x4')]=_0x3134e2[_0x4ec2('0x4')]||'';this[_0x4ec2('0x5')]=_0x3134e2[_0x4ec2('0x5')]||'';this[_0x4ec2('0x6')]=_0x3134e2[_0x4ec2('0x6')]||{};this[_0x4ec2('0x7')]=_0x3134e2[_0x4ec2('0x7')]||'';this[_0x4ec2('0x8')]=_0x3134e2[_0x4ec2('0x8')]||{};}module[_0x4ec2('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index fc33f01..7a07cae 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 _0xcaf2=['maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0xf858e,_0x51b0f1){var _0x5344d8=function(_0x5219d6){while(--_0x5219d6){_0xf858e['push'](_0xf858e['shift']());}};_0x5344d8(++_0x51b0f1);}(_0xcaf2,0x8a));var _0x2caf=function(_0x40a107,_0x5acc82){_0x40a107=_0x40a107-0x0;var _0x4beb59=_0xcaf2[_0x40a107];return _0x4beb59;};'use strict';function FaxAccount(_0x3ee093){this['id']=_0x3ee093['id']||0x0;this['name']=_0x3ee093[_0x2caf('0x0')]||'';this[_0x2caf('0x1')]=_0x3ee093['description'];this[_0x2caf('0x2')]=_0x3ee093[_0x2caf('0x2')];this['headerinfo']=_0x3ee093[_0x2caf('0x3')];this['localstationid']=_0x3ee093[_0x2caf('0x4')];this[_0x2caf('0x5')]=_0x3ee093[_0x2caf('0x5')]||0x960;this['maxrate']=_0x3ee093[_0x2caf('0x6')]||0x3840;this[_0x2caf('0x7')]=_0x3ee093[_0x2caf('0x7')]||_0x2caf('0x8');this['gateway']=_0x3ee093[_0x2caf('0x9')]||'no';this[_0x2caf('0xa')]=_0x3ee093[_0x2caf('0xa')]||'no';this[_0x2caf('0xb')]=_0x3ee093[_0x2caf('0xb')]||0x1388;this[_0x2caf('0xc')]=_0x3ee093[_0x2caf('0xc')]||_0x2caf('0xd');this[_0x2caf('0xe')]=_0x3ee093['Trunk']?_0x3ee093[_0x2caf('0xe')]:undefined;this[_0x2caf('0xf')]=_0x3ee093[_0x2caf('0xf')];this[_0x2caf('0x10')]=_0x3ee093[_0x2caf('0x10')];}module[_0x2caf('0x11')]=FaxAccount; \ No newline at end of file +var _0x256e=['t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x1bc10c,_0x4b5d84){var _0x502203=function(_0x5e41d7){while(--_0x5e41d7){_0x1bc10c['push'](_0x1bc10c['shift']());}};_0x502203(++_0x4b5d84);}(_0x256e,0x105));var _0xe256=function(_0x4f67bd,_0x162b71){_0x4f67bd=_0x4f67bd-0x0;var _0x2deb00=_0x256e[_0x4f67bd];return _0x2deb00;};'use strict';function FaxAccount(_0x2d9212){this['id']=_0x2d9212['id']||0x0;this[_0xe256('0x0')]=_0x2d9212[_0xe256('0x0')]||'';this[_0xe256('0x1')]=_0x2d9212['description'];this[_0xe256('0x2')]=_0x2d9212[_0xe256('0x2')];this[_0xe256('0x3')]=_0x2d9212['headerinfo'];this['localstationid']=_0x2d9212[_0xe256('0x4')];this[_0xe256('0x5')]=_0x2d9212[_0xe256('0x5')]||0x960;this[_0xe256('0x6')]=_0x2d9212[_0xe256('0x6')]||0x3840;this[_0xe256('0x7')]=_0x2d9212[_0xe256('0x7')]||_0xe256('0x8');this[_0xe256('0x9')]=_0x2d9212['gateway']||'no';this[_0xe256('0xa')]=_0x2d9212[_0xe256('0xa')]||'no';this[_0xe256('0xb')]=_0x2d9212[_0xe256('0xb')]||0x1388;this[_0xe256('0xc')]=_0x2d9212[_0xe256('0xc')]||_0xe256('0xd');this[_0xe256('0xe')]=_0x2d9212[_0xe256('0xe')]?_0x2d9212[_0xe256('0xe')]:undefined;this[_0xe256('0xf')]=_0x2d9212[_0xe256('0xf')];this['key']=_0x2d9212[_0xe256('0x10')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 9ea1a5a..1af51e2 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 _0x2e2c=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x2e2c,0xb0));var _0xc2e2=function(_0xf1603b,_0x257c11){_0xf1603b=_0xf1603b-0x0;var _0x298fab=_0x2e2c[_0xf1603b];return _0x298fab;};'use strict';function FreshdeskAccount(_0x4b9d0b){this['id']=_0x4b9d0b['id']||0x0;this['name']=_0x4b9d0b[_0xc2e2('0x0')]||'';this[_0xc2e2('0x1')]=_0x4b9d0b[_0xc2e2('0x1')]||'';this['apiKey']=_0x4b9d0b[_0xc2e2('0x2')]||'';this[_0xc2e2('0x3')]=_0x4b9d0b[_0xc2e2('0x3')]||'';this[_0xc2e2('0x4')]=_0x4b9d0b[_0xc2e2('0x4')]||'';this[_0xc2e2('0x5')]=_0x4b9d0b[_0xc2e2('0x5')]||{};}module[_0xc2e2('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xfdec=['name','username','remoteUri','serverUrl','exports'];(function(_0xf82311,_0x29504b){var _0x39d8fa=function(_0x27c1d2){while(--_0x27c1d2){_0xf82311['push'](_0xf82311['shift']());}};_0x39d8fa(++_0x29504b);}(_0xfdec,0xfa));var _0xcfde=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0xfdec[_0x817d9b];return _0x2752e1;};'use strict';function FreshdeskAccount(_0x38d5ce){this['id']=_0x38d5ce['id']||0x0;this[_0xcfde('0x0')]=_0x38d5ce[_0xcfde('0x0')]||'';this[_0xcfde('0x1')]=_0x38d5ce[_0xcfde('0x1')]||'';this['apiKey']=_0x38d5ce['token']||'';this[_0xcfde('0x2')]=_0x38d5ce[_0xcfde('0x2')]||'';this[_0xcfde('0x3')]=_0x38d5ce['serverUrl']||'';this['Configurations']=_0x38d5ce['Configurations']||{};}module[_0xcfde('0x4')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 7e8ff2f..35097d4 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 _0x2f30=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4e8f22,_0x2b6646){var _0x44afeb=function(_0x2dd80f){while(--_0x2dd80f){_0x4e8f22['push'](_0x4e8f22['shift']());}};_0x44afeb(++_0x2b6646);}(_0x2f30,0xe6));var _0x02f3=function(_0x586ca0,_0x85e206){_0x586ca0=_0x586ca0-0x0;var _0x19e129=_0x2f30[_0x586ca0];return _0x19e129;};'use strict';function FreshsalesAccount(_0x26d156){this['id']=_0x26d156['id']||0x0;this[_0x02f3('0x0')]=_0x26d156[_0x02f3('0x0')]||'';this[_0x02f3('0x1')]=_0x26d156['username']||'';this['apiKey']=_0x26d156[_0x02f3('0x2')]||'';this[_0x02f3('0x3')]=_0x26d156[_0x02f3('0x3')]||'';this[_0x02f3('0x4')]=_0x26d156[_0x02f3('0x4')]||'';this[_0x02f3('0x5')]=_0x26d156['Configurations']||{};}module[_0x02f3('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x43be=['Configurations','exports','name','username','token','remoteUri','serverUrl'];(function(_0x1b765a,_0x47b086){var _0x5c66ff=function(_0x2f32fb){while(--_0x2f32fb){_0x1b765a['push'](_0x1b765a['shift']());}};_0x5c66ff(++_0x47b086);}(_0x43be,0x152));var _0xe43b=function(_0x2a7b37,_0x487c1a){_0x2a7b37=_0x2a7b37-0x0;var _0x2df1e0=_0x43be[_0x2a7b37];return _0x2df1e0;};'use strict';function FreshsalesAccount(_0x1c93dc){this['id']=_0x1c93dc['id']||0x0;this[_0xe43b('0x0')]=_0x1c93dc[_0xe43b('0x0')]||'';this[_0xe43b('0x1')]=_0x1c93dc[_0xe43b('0x1')]||'';this['apiKey']=_0x1c93dc[_0xe43b('0x2')]||'';this[_0xe43b('0x3')]=_0x1c93dc['remoteUri']||'';this[_0xe43b('0x4')]=_0x1c93dc[_0xe43b('0x4')]||'';this['Configurations']=_0x1c93dc[_0xe43b('0x5')]||{};}module[_0xe43b('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 9d6db8b..816eb0e 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 _0x9f87=['assigned','mohtime','variables','type','inbound','calleridnum','queuecallerjoinAt','queuecallerleaveAt','count','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','accountcode','context','exten','priority'];(function(_0x522cd8,_0x44ffa1){var _0x1342af=function(_0x3c332f){while(--_0x3c332f){_0x522cd8['push'](_0x522cd8['shift']());}};_0x1342af(++_0x44ffa1);}(_0x9f87,0xae));var _0x79f8=function(_0x181b70,_0x88e45f){_0x181b70=_0x181b70-0x0;var _0x170400=_0x9f87[_0x181b70];return _0x170400;};'use strict';function QueueReport(){this[_0x79f8('0x0')]=_0x79f8('0x1');this['uniqueid']='';this[_0x79f8('0x2')]='';this['calleridname']='';this['queue']='';this[_0x79f8('0x3')]=null;this[_0x79f8('0x4')]=null;this['position']=0x1;this[_0x79f8('0x5')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0x79f8('0x6')]=![];this[_0x79f8('0x7')]=null;this[_0x79f8('0x8')]=![];this[_0x79f8('0x9')]=null;this[_0x79f8('0xa')]=0x1;this[_0x79f8('0xb')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0x79f8('0xc')]='';this[_0x79f8('0xd')]='';this[_0x79f8('0xe')]='';this[_0x79f8('0xf')]='';this['holdtime']=0x0;this[_0x79f8('0x10')]=![];this['lastAssignedTo']='';this[_0x79f8('0x11')]=0x0;this[_0x79f8('0x12')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x2314=['queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','exten','priority','holdtime','assigned','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x2314,0x133));var _0x4231=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2314[_0x3ab51d];return _0x29a04e;};'use strict';function QueueReport(){this[_0x4231('0x0')]=_0x4231('0x1');this['uniqueid']='';this[_0x4231('0x2')]='';this[_0x4231('0x3')]='';this[_0x4231('0x4')]='';this[_0x4231('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x4231('0x6')]=0x1;this[_0x4231('0x7')]=0x1;this[_0x4231('0x8')]=![];this[_0x4231('0x9')]=null;this['queuecallercomplete']=![];this[_0x4231('0xa')]=null;this[_0x4231('0xb')]=![];this[_0x4231('0xc')]=null;this[_0x4231('0xd')]=0x1;this[_0x4231('0xe')]='';this[_0x4231('0xf')]='';this[_0x4231('0x10')]='';this['accountcode']='';this['context']='';this[_0x4231('0x11')]='';this[_0x4231('0x12')]='';this[_0x4231('0x13')]=0x0;this[_0x4231('0x14')]=![];this['lastAssignedTo']='';this[_0x4231('0x15')]=0x0;this[_0x4231('0x16')]={};}module[_0x4231('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 2da7666..efb4806 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 _0x6d88=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','name'];(function(_0x1f3127,_0xc73a0b){var _0x2cf9cd=function(_0x4ff434){while(--_0x4ff434){_0x1f3127['push'](_0x1f3127['shift']());}};_0x2cf9cd(++_0xc73a0b);}(_0x6d88,0x18f));var _0x86d8=function(_0x656650,_0x5412fb){_0x656650=_0x656650-0x0;var _0x4a9198=_0x6d88[_0x656650];return _0x4a9198;};'use strict';function SalesforceAccount(_0x106c3e){this['id']=_0x106c3e['id']||0x0;this[_0x86d8('0x0')]=_0x106c3e[_0x86d8('0x0')]||'';this[_0x86d8('0x1')]=_0x106c3e['username']||'';this[_0x86d8('0x2')]=_0x106c3e[_0x86d8('0x2')]||'';this[_0x86d8('0x3')]=_0x106c3e[_0x86d8('0x3')]||'';this[_0x86d8('0x4')]=_0x106c3e['clientId']||'';this[_0x86d8('0x5')]=_0x106c3e['clientSecret']||'';this[_0x86d8('0x6')]=_0x106c3e[_0x86d8('0x6')]||'';this[_0x86d8('0x7')]=_0x106c3e[_0x86d8('0x7')]||_0x86d8('0x8');this['serverUrl']=_0x106c3e[_0x86d8('0x9')]||'';this['Configurations']=_0x106c3e['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x517f=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0x517f,0x1d8));var _0xf517=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x517f[_0x1a36a5];return _0x746243;};'use strict';function SalesforceAccount(_0x3b41d3){this['id']=_0x3b41d3['id']||0x0;this[_0xf517('0x0')]=_0x3b41d3[_0xf517('0x0')]||'';this[_0xf517('0x1')]=_0x3b41d3[_0xf517('0x1')]||'';this[_0xf517('0x2')]=_0x3b41d3[_0xf517('0x2')]||'';this['password']=_0x3b41d3[_0xf517('0x3')]||'';this[_0xf517('0x4')]=_0x3b41d3[_0xf517('0x4')]||'';this[_0xf517('0x5')]=_0x3b41d3['clientSecret']||'';this[_0xf517('0x6')]=_0x3b41d3['securityToken']||'';this[_0xf517('0x7')]=_0x3b41d3[_0xf517('0x7')]||_0xf517('0x8');this[_0xf517('0x9')]=_0x3b41d3[_0xf517('0x9')]||'';this[_0xf517('0xa')]=_0x3b41d3[_0xf517('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 74722cb..901d8d1 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 _0x4de1=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x5b1c36,_0x5357a7){var _0x571aea=function(_0x4247fd){while(--_0x4247fd){_0x5b1c36['push'](_0x5b1c36['shift']());}};_0x571aea(++_0x5357a7);}(_0x4de1,0x16d));var _0x14de=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x4de1[_0x2932cf];return _0x1711dd;};'use strict';function ServicenowAccount(_0x2d449f){this['id']=_0x2d449f['id']||0x0;this[_0x14de('0x0')]=_0x2d449f['name']||'';this[_0x14de('0x1')]=_0x2d449f[_0x14de('0x1')]||'';this[_0x14de('0x2')]=_0x2d449f[_0x14de('0x2')]||'';this[_0x14de('0x3')]=_0x2d449f[_0x14de('0x3')]||'';this[_0x14de('0x4')]=_0x2d449f[_0x14de('0x4')]||'';this['Configurations']=_0x2d449f[_0x14de('0x5')]||{};}module[_0x14de('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x8823=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x312e5b,_0x188724){var _0x58e84d=function(_0x2b91bd){while(--_0x2b91bd){_0x312e5b['push'](_0x312e5b['shift']());}};_0x58e84d(++_0x188724);}(_0x8823,0x98));var _0x3882=function(_0x48801b,_0x5995c2){_0x48801b=_0x48801b-0x0;var _0x36f57d=_0x8823[_0x48801b];return _0x36f57d;};'use strict';function ServicenowAccount(_0x592d87){this['id']=_0x592d87['id']||0x0;this['name']=_0x592d87[_0x3882('0x0')]||'';this[_0x3882('0x1')]=_0x592d87['username']||'';this[_0x3882('0x2')]=_0x592d87['password']||'';this[_0x3882('0x3')]=_0x592d87['remoteUri']||'';this[_0x3882('0x4')]=_0x592d87[_0x3882('0x4')]||'';this[_0x3882('0x5')]=_0x592d87[_0x3882('0x5')]||{};}module[_0x3882('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 51f218b..5486d8b 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 _0x1f49=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x5b1fcc,_0x128850){var _0x31a903=function(_0x1233f6){while(--_0x1233f6){_0x5b1fcc['push'](_0x5b1fcc['shift']());}};_0x31a903(++_0x128850);}(_0x1f49,0x1ac));var _0x91f4=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x1f49[_0x3207aa];return _0x51758f;};'use strict';function SugarcrmAccount(_0x179f71){this['id']=_0x179f71['id']||0x0;this[_0x91f4('0x0')]=_0x179f71[_0x91f4('0x0')]||'';this[_0x91f4('0x1')]=_0x179f71[_0x91f4('0x1')]||'';this[_0x91f4('0x2')]=_0x179f71['password']||'';this[_0x91f4('0x3')]=_0x179f71[_0x91f4('0x3')]||'';this[_0x91f4('0x4')]=_0x179f71[_0x91f4('0x4')]||'';this['Configurations']=_0x179f71[_0x91f4('0x5')]||{};}module[_0x91f4('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xd083=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x3a6f31,_0x53e5f5){var _0x3dd2c6=function(_0x54aec8){while(--_0x54aec8){_0x3a6f31['push'](_0x3a6f31['shift']());}};_0x3dd2c6(++_0x53e5f5);}(_0xd083,0x10c));var _0x3d08=function(_0x14476b,_0xd1a7a4){_0x14476b=_0x14476b-0x0;var _0x24e2e8=_0xd083[_0x14476b];return _0x24e2e8;};'use strict';function SugarcrmAccount(_0x3cfd9d){this['id']=_0x3cfd9d['id']||0x0;this[_0x3d08('0x0')]=_0x3cfd9d[_0x3d08('0x0')]||'';this['username']=_0x3cfd9d[_0x3d08('0x1')]||'';this[_0x3d08('0x2')]=_0x3cfd9d[_0x3d08('0x2')]||'';this[_0x3d08('0x3')]=_0x3cfd9d[_0x3d08('0x3')]||'';this[_0x3d08('0x4')]=_0x3cfd9d[_0x3d08('0x4')]||'';this[_0x3d08('0x5')]=_0x3cfd9d[_0x3d08('0x5')]||{};}module[_0x3d08('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 2386de2..b7c1880 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 _0xa747=['exports','name','accountcode','state','stateTime','status','unknown','address'];(function(_0x196d22,_0xed536a){var _0x554a53=function(_0x1a4b1d){while(--_0x1a4b1d){_0x196d22['push'](_0x196d22['shift']());}};_0x554a53(++_0xed536a);}(_0xa747,0x99));var _0x7a74=function(_0x3a95d8,_0x335365){_0x3a95d8=_0x3a95d8-0x0;var _0x2cbdb7=_0xa747[_0x3a95d8];return _0x2cbdb7;};'use strict';function Telephone(_0x57b5c5){this['id']=_0x57b5c5['id']||0x0;this[_0x7a74('0x0')]=_0x57b5c5[_0x7a74('0x0')]||'';this[_0x7a74('0x1')]=_0x57b5c5['accountcode']||'';this[_0x7a74('0x2')]='unknown';this[_0x7a74('0x3')]=0x0;this[_0x7a74('0x4')]=_0x7a74('0x5');this[_0x7a74('0x6')]='';}module[_0x7a74('0x7')]=Telephone; \ No newline at end of file +var _0x8654=['status','unknown','exports','name','accountcode','state'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x8654,0x153));var _0x4865=function(_0xe64497,_0x3a2fb8){_0xe64497=_0xe64497-0x0;var _0x5e3c9a=_0x8654[_0xe64497];return _0x5e3c9a;};'use strict';function Telephone(_0x88a5ab){this['id']=_0x88a5ab['id']||0x0;this[_0x4865('0x0')]=_0x88a5ab[_0x4865('0x0')]||'';this[_0x4865('0x1')]=_0x88a5ab[_0x4865('0x1')]||'';this[_0x4865('0x2')]='unknown';this['stateTime']=0x0;this[_0x4865('0x3')]=_0x4865('0x4');this['address']='';}module[_0x4865('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 10e7e14..08ddaec 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 _0xe67e=['exports','name','html'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0xe67e,0x142));var _0xee67=function(_0xbe6f0,_0x18e5e2){_0xbe6f0=_0xbe6f0-0x0;var _0x5e2b92=_0xe67e[_0xbe6f0];return _0x5e2b92;};'use strict';function template(_0x3e3c49){this['id']=_0x3e3c49['id']||0x0;this[_0xee67('0x0')]=_0x3e3c49[_0xee67('0x0')]||'';this['html']=_0x3e3c49[_0xee67('0x1')]||'';}module[_0xee67('0x2')]=template; \ No newline at end of file +var _0x1e7c=['name','html','exports'];(function(_0x2e3425,_0x1280bc){var _0x160d7b=function(_0x30946e){while(--_0x30946e){_0x2e3425['push'](_0x2e3425['shift']());}};_0x160d7b(++_0x1280bc);}(_0x1e7c,0x1e3));var _0xc1e7=function(_0x58357f,_0x536ba5){_0x58357f=_0x58357f-0x0;var _0x3dd506=_0x1e7c[_0x58357f];return _0x3dd506;};'use strict';function template(_0xda0f52){this['id']=_0xda0f52['id']||0x0;this[_0xc1e7('0x0')]=_0xda0f52['name']||'';this[_0xc1e7('0x1')]=_0xda0f52[_0xc1e7('0x1')]||'';}module[_0xc1e7('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 89b8406..31beede 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 _0x8ef6=['status','AllConditions','AnyConditions','exports','name','channel','voice'];(function(_0x21ba9e,_0x36882b){var _0x1ff3b6=function(_0x38598a){while(--_0x38598a){_0x21ba9e['push'](_0x21ba9e['shift']());}};_0x1ff3b6(++_0x36882b);}(_0x8ef6,0xf2));var _0x68ef=function(_0x12ae36,_0x226cd0){_0x12ae36=_0x12ae36-0x0;var _0x3312fd=_0x8ef6[_0x12ae36];return _0x3312fd;};'use strict';function Trigger(_0x58ecc7){this['id']=_0x58ecc7['id']||0x0;this[_0x68ef('0x0')]=_0x58ecc7[_0x68ef('0x0')]||'';this[_0x68ef('0x1')]=_0x58ecc7[_0x68ef('0x1')]||_0x68ef('0x2');this[_0x68ef('0x3')]=_0x58ecc7['status']||![];this[_0x68ef('0x4')]=_0x58ecc7[_0x68ef('0x4')]||[];this[_0x68ef('0x5')]=_0x58ecc7[_0x68ef('0x5')]||[];this['Actions']=_0x58ecc7['Actions']||[];}module[_0x68ef('0x6')]=Trigger; \ No newline at end of file +var _0x008c=['name','channel','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x83b4e,_0x47c407){var _0x2beec8=function(_0x48848f){while(--_0x48848f){_0x83b4e['push'](_0x83b4e['shift']());}};_0x2beec8(++_0x47c407);}(_0x008c,0x188));var _0xc008=function(_0x205852,_0x184d90){_0x205852=_0x205852-0x0;var _0x491d8d=_0x008c[_0x205852];return _0x491d8d;};'use strict';function Trigger(_0x2be4ba){this['id']=_0x2be4ba['id']||0x0;this[_0xc008('0x0')]=_0x2be4ba[_0xc008('0x0')]||'';this[_0xc008('0x1')]=_0x2be4ba[_0xc008('0x1')]||'voice';this[_0xc008('0x2')]=_0x2be4ba[_0xc008('0x2')]||![];this[_0xc008('0x3')]=_0x2be4ba[_0xc008('0x3')]||[];this[_0xc008('0x4')]=_0x2be4ba[_0xc008('0x4')]||[];this[_0xc008('0x5')]=_0x2be4ba[_0xc008('0x5')]||[];}module[_0xc008('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 b25c3a0..7fb62b0 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 _0xc73a=['stateTime','registry','split','host','port','domain','domainport','refresh','registrationtime','exports','active','name','unknown'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc73a,0x1c4));var _0xac73=function(_0x3d7771,_0x1f2047){_0x3d7771=_0x3d7771-0x0;var _0x3cdbb9=_0xc73a[_0x3d7771];return _0x3cdbb9;};'use strict';function Trunk(_0x316990){this['id']=_0x316990['id']||0x0;this['active']=_0x316990[_0xac73('0x0')]||![];this[_0xac73('0x1')]=_0x316990[_0xac73('0x1')]||'';this['state']=_0xac73('0x2');this[_0xac73('0x3')]=0x0;this['status']='unknown';this[_0xac73('0x4')]=_0x316990[_0xac73('0x4')]&&_0x316990[_0xac73('0x4')]['indexOf'](':')?_0x316990[_0xac73('0x4')][_0xac73('0x5')](':')[0x0]:'';this[_0xac73('0x6')]='';this[_0xac73('0x7')]='';this[_0xac73('0x8')]='';this[_0xac73('0x9')]='';this[_0xac73('0xa')]='';this['stateRegistry']=_0xac73('0x2');this[_0xac73('0xb')]='';this['address']='';}module[_0xac73('0xc')]=Trunk; \ No newline at end of file +var _0x5d6d=['status','registry','indexOf','split','host','domain','domainport','refresh','registrationtime','address','active','name','state','unknown','stateTime'];(function(_0x435ba5,_0x55875f){var _0x5af51d=function(_0x35b1ed){while(--_0x35b1ed){_0x435ba5['push'](_0x435ba5['shift']());}};_0x5af51d(++_0x55875f);}(_0x5d6d,0xa0));var _0xd5d6=function(_0x100ae3,_0x3c03f0){_0x100ae3=_0x100ae3-0x0;var _0x1a627b=_0x5d6d[_0x100ae3];return _0x1a627b;};'use strict';function Trunk(_0x2cccb4){this['id']=_0x2cccb4['id']||0x0;this[_0xd5d6('0x0')]=_0x2cccb4[_0xd5d6('0x0')]||![];this['name']=_0x2cccb4[_0xd5d6('0x1')]||'';this[_0xd5d6('0x2')]=_0xd5d6('0x3');this[_0xd5d6('0x4')]=0x0;this[_0xd5d6('0x5')]='unknown';this['registry']=_0x2cccb4[_0xd5d6('0x6')]&&_0x2cccb4[_0xd5d6('0x6')][_0xd5d6('0x7')](':')?_0x2cccb4[_0xd5d6('0x6')][_0xd5d6('0x8')](':')[0x0]:'';this[_0xd5d6('0x9')]='';this['port']='';this[_0xd5d6('0xa')]='';this[_0xd5d6('0xb')]='';this[_0xd5d6('0xc')]='';this['stateRegistry']='unknown';this[_0xd5d6('0xd')]='';this[_0xd5d6('0xe')]='';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 2dd1323..0de7fef 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 _0x1565=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x1bb2d1,_0x21fa4b){var _0x38e89a=function(_0x138bcc){while(--_0x138bcc){_0x1bb2d1['push'](_0x1bb2d1['shift']());}};_0x38e89a(++_0x21fa4b);}(_0x1565,0x1bc));var _0x5156=function(_0x51a13c,_0x1e6e34){_0x51a13c=_0x51a13c-0x0;var _0x300f02=_0x1565[_0x51a13c];return _0x300f02;};'use strict';function voiceExtension(_0x6efa29){this['id']=_0x6efa29['id']||0x0;this[_0x5156('0x0')]=_0x6efa29['exten']||'';this[_0x5156('0x1')]=_0x6efa29[_0x5156('0x1')]||_0x5156('0x2');this[_0x5156('0x3')]=_0x6efa29[_0x5156('0x3')]||![];}module[_0x5156('0x4')]=voiceExtension; \ No newline at end of file +var _0xde39=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x3dd184,_0x1d0d71){var _0x987835=function(_0x4036b9){while(--_0x4036b9){_0x3dd184['push'](_0x3dd184['shift']());}};_0x987835(++_0x1d0d71);}(_0xde39,0xae));var _0x9de3=function(_0x2d126e,_0x1e8257){_0x2d126e=_0x2d126e-0x0;var _0xcb04d3=_0xde39[_0x2d126e];return _0xcb04d3;};'use strict';function voiceExtension(_0x1e15a7){this['id']=_0x1e15a7['id']||0x0;this[_0x9de3('0x0')]=_0x1e15a7[_0x9de3('0x0')]||'';this[_0x9de3('0x1')]=_0x1e15a7[_0x9de3('0x1')]||_0x9de3('0x2');this['mandatoryDisposition']=_0x1e15a7[_0x9de3('0x3')]||![];}module[_0x9de3('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index ec3bc97..cfe6f87 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 _0x25f2=['dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','wav49','gsm','roundrobin','name','monitor_format','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber'];(function(_0x11bc68,_0x4f4b90){var _0x499c81=function(_0x1727b3){while(--_0x1727b3){_0x11bc68['push'](_0x11bc68['shift']());}};_0x499c81(++_0x4f4b90);}(_0x25f2,0x1a0));var _0x225f=function(_0x1d0713,_0x1e69e8){_0x1d0713=_0x1d0713-0x0;var _0x201805=_0x25f2[_0x1d0713];return _0x201805;};'use strict';var statusDesc=[_0x225f('0x0'),_0x225f('0x1'),_0x225f('0x2'),_0x225f('0x3'),'invalid',_0x225f('0x4'),_0x225f('0x5'),_0x225f('0x6'),_0x225f('0x7')];var monitorFormat={'wav':'wav','wav49':_0x225f('0x8'),'gsm':_0x225f('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x225f('0xa')};function VoiceQueue(_0x44c0d2){this['id']=_0x44c0d2['id']||0x0;this[_0x225f('0xb')]=_0x44c0d2[_0x225f('0xb')]||'';this[_0x225f('0xc')]=_0x44c0d2[_0x225f('0xc')]||'';this['type']=_0x44c0d2['type']||'inbound';this['waiting']=0x0;this['talking']=0x0;this[_0x225f('0xd')]=0x0;this[_0x225f('0xe')]=0x0;this[_0x225f('0xf')]=0x0;this[_0x225f('0x10')]=0x0;this[_0x225f('0x11')]=0x0;this['unmanaged']=0x0;this[_0x225f('0x12')]=0x0;this[_0x225f('0x13')]=0x0;this[_0x225f('0x14')]=0x0;this[_0x225f('0x15')]=_0x44c0d2[_0x225f('0x15')]||![];this[_0x225f('0x16')]=_0x44c0d2['acwTimeout']||0xa;this[_0x225f('0x17')]=_0x44c0d2[_0x225f('0x17')]||'no';this[_0x225f('0x18')]=!![];this[_0x225f('0x19')]='';this[_0x225f('0x1a')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x44c0d2['dialTimezone']||null;this['dialGlobalInterval']=_0x44c0d2['dialGlobalInterval']?_0x44c0d2[_0x225f('0x1b')]:null;this[_0x225f('0x1c')]=_0x44c0d2[_0x225f('0x1c')];this['dialMethod']=_0x44c0d2[_0x225f('0x1d')]||_0x225f('0x1e');this[_0x225f('0x1f')]=_0x44c0d2[_0x225f('0x1f')]||0x0;this[_0x225f('0x20')]=_0x44c0d2[_0x225f('0x20')]||0x0;this[_0x225f('0x21')]=_0x44c0d2['dialPowerLevel']||0x1;this[_0x225f('0x22')]=_0x44c0d2[_0x225f('0x22')]||_0x225f('0x23');this[_0x225f('0x24')]=_0x44c0d2[_0x225f('0x24')]||0.03;this[_0x225f('0x25')]=_0x44c0d2[_0x225f('0x25')]||0x258;this[_0x225f('0x26')]=_0x44c0d2['dialOriginateCallerIdName']||_0x225f('0x27');this[_0x225f('0x28')]=_0x44c0d2[_0x225f('0x28')]||_0x225f('0x27');this['dialOriginateTimeout']=_0x44c0d2['dialOriginateTimeout']||0x1e;this[_0x225f('0x29')]=_0x44c0d2[_0x225f('0x29')]||_0x225f('0x2a');this['dialQueueTimeout']=_0x44c0d2[_0x225f('0x2b')]||0x3;this[_0x225f('0x2c')]=_0x44c0d2[_0x225f('0x2c')]||undefined;this[_0x225f('0x2d')]=_0x44c0d2[_0x225f('0x2d')]||0x3;this[_0x225f('0x2e')]=_0x44c0d2['dialCongestionRetryFrequency']||0x96;this[_0x225f('0x2f')]=_0x44c0d2[_0x225f('0x2f')]||0x3;this['dialBusyRetryFrequency']=_0x44c0d2[_0x225f('0x30')]||0x96;this['dialNoAnswerMaxRetry']=_0x44c0d2[_0x225f('0x31')]||0x3;this['dialNoAnswerRetryFrequency']=_0x44c0d2['dialNoAnswerRetryFrequency']||0x96;this[_0x225f('0x32')]=_0x44c0d2[_0x225f('0x32')]||0x3;this[_0x225f('0x33')]=_0x44c0d2[_0x225f('0x33')]||0x96;this[_0x225f('0x34')]=_0x44c0d2['dialDropMaxRetry']||0x3;this[_0x225f('0x35')]=_0x44c0d2['dialDropRetryFrequency']||0x96;this[_0x225f('0x36')]=_0x44c0d2['dialAbandonedMaxRetry']||0x3;this[_0x225f('0x37')]=_0x44c0d2['dialAbandonedRetryFrequency']||0x96;this[_0x225f('0x38')]=_0x44c0d2['dialMachineMaxRetry']||0x3;this[_0x225f('0x39')]=_0x44c0d2[_0x225f('0x39')]||0x96;this['dialAgentRejectMaxRetry']=_0x44c0d2[_0x225f('0x3a')]||0x3;this[_0x225f('0x3b')]=_0x44c0d2[_0x225f('0x3b')]||0x96;this[_0x225f('0x3c')]=_0x44c0d2[_0x225f('0x3c')]||0x4;this['Trunk']=_0x44c0d2[_0x225f('0x3d')]?_0x44c0d2[_0x225f('0x3d')]:undefined;this['TrunkBackup']=_0x44c0d2[_0x225f('0x3e')]?_0x44c0d2[_0x225f('0x3e')]:undefined;this[_0x225f('0x3f')]=_0x44c0d2[_0x225f('0x3f')]||undefined;this[_0x225f('0x40')]=_0x44c0d2[_0x225f('0x40')]?_0x44c0d2[_0x225f('0x40')]:undefined;this[_0x225f('0x41')]=_0x44c0d2[_0x225f('0x41')]||_0x225f('0x42');this[_0x225f('0x43')]=_0x44c0d2['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x225f('0x44')]=_0x44c0d2[_0x225f('0x44')]||undefined;this[_0x225f('0x45')]=strategy[_0x44c0d2[_0x225f('0x45')]]||_0x225f('0x46');this[_0x225f('0x47')]=!![];this[_0x225f('0x48')]=_0x44c0d2[_0x225f('0x48')]||![];this[_0x225f('0x49')]=_0x44c0d2[_0x225f('0x49')];this[_0x225f('0x4a')]=_0x44c0d2[_0x225f('0x4a')];this[_0x225f('0x4b')]=_0x44c0d2[_0x225f('0x4b')];this[_0x225f('0x4c')]=_0x44c0d2['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x44c0d2['dialAMDMinWordLength'];this[_0x225f('0x4d')]=_0x44c0d2[_0x225f('0x4d')];this[_0x225f('0x4e')]=_0x44c0d2[_0x225f('0x4e')];this[_0x225f('0x4f')]=_0x44c0d2[_0x225f('0x4f')];this['dialAMDMaximumWordLength']=_0x44c0d2[_0x225f('0x50')];this[_0x225f('0x51')]=0x0;this[_0x225f('0x52')]=0x0;this[_0x225f('0x53')]=_0x44c0d2[_0x225f('0x53')];this[_0x225f('0x54')]=0x0;this[_0x225f('0x55')]=0x0;this[_0x225f('0x56')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x225f('0x57')]=0x0;this[_0x225f('0x58')]=0x0;this[_0x225f('0x59')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x225f('0x5a')]=0x0;this[_0x225f('0x5b')]=0x0;this[_0x225f('0x5c')]=0x0;this[_0x225f('0x5d')]=0x0;this[_0x225f('0x5e')]=0x0;this[_0x225f('0x5f')]=0x0;this[_0x225f('0x60')]=undefined;this[_0x225f('0x61')]=undefined;this[_0x225f('0x62')]=undefined;this[_0x225f('0x63')]=1.05;this[_0x225f('0x64')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x225f('0x65')]=0x0;this[_0x225f('0x66')]=0x0;this[_0x225f('0x67')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x225f('0x68')]=0x0;this[_0x225f('0x69')]=0x0;this[_0x225f('0x6a')]=_0x44c0d2[_0x225f('0x6b')]||0x14;this[_0x225f('0x6c')]=_0x44c0d2['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x225f('0x6d')]=0x0;this[_0x225f('0x6e')]=0x1;this[_0x225f('0x6f')]=0x0;this[_0x225f('0x70')]=0x0;this[_0x225f('0x71')]=0x0;this['erlangBusyFactor']=0x0;this[_0x225f('0x72')]=_0x44c0d2['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x44c0d2[_0x225f('0x73')]||![];this['dialQueueProject2']=_0x44c0d2[_0x225f('0x74')]||undefined;this[_0x225f('0x75')]=_0x44c0d2[_0x225f('0x75')]||![];this['dialAgiAfterHangupAgent']=_0x44c0d2[_0x225f('0x76')]||![];this[_0x225f('0xc')]=monitorFormat[_0x44c0d2[_0x225f('0xc')]]?monitorFormat[_0x44c0d2[_0x225f('0xc')]]:undefined;this['mandatoryDisposition']=_0x44c0d2['mandatoryDisposition']||![];this[_0x225f('0x77')]=_0x44c0d2[_0x225f('0x77')]?_0x44c0d2[_0x225f('0x77')]:undefined;}module[_0x225f('0x78')]=VoiceQueue; \ No newline at end of file +var _0x1cfb=['dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','inuse','busy','unavailable','ringing','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','answered','sumDuration','sumBillable','abandoned','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangAbandonmentRate'];(function(_0x41c7b9,_0x393db1){var _0x5da2b7=function(_0x351edd){while(--_0x351edd){_0x41c7b9['push'](_0x41c7b9['shift']());}};_0x5da2b7(++_0x393db1);}(_0x1cfb,0x152));var _0xb1cf=function(_0x42835a,_0x5259a7){_0x42835a=_0x42835a-0x0;var _0xa4f23b=_0x1cfb[_0x42835a];return _0xa4f23b;};'use strict';var statusDesc=['unknown','not_inuse',_0xb1cf('0x0'),_0xb1cf('0x1'),'invalid',_0xb1cf('0x2'),_0xb1cf('0x3'),'ringinuse','onhold'];var monitorFormat={'wav':_0xb1cf('0x4'),'wav49':_0xb1cf('0x5'),'gsm':'gsm'};var strategy={'rrmemory':_0xb1cf('0x6'),'roundrobin':_0xb1cf('0x7')};function VoiceQueue(_0x20bf8f){this['id']=_0x20bf8f['id']||0x0;this[_0xb1cf('0x8')]=_0x20bf8f[_0xb1cf('0x8')]||'';this[_0xb1cf('0x9')]=_0x20bf8f[_0xb1cf('0x9')]||'';this[_0xb1cf('0xa')]=_0x20bf8f[_0xb1cf('0xa')]||_0xb1cf('0xb');this['waiting']=0x0;this['talking']=0x0;this['total']=0x0;this[_0xb1cf('0xc')]=0x0;this[_0xb1cf('0xd')]=0x0;this['sumHoldTime']=0x0;this[_0xb1cf('0xe')]=0x0;this['unmanaged']=0x0;this[_0xb1cf('0xf')]=0x0;this['loggedIn']=0x0;this['available']=0x0;this['acw']=_0x20bf8f['acw']||![];this[_0xb1cf('0x10')]=_0x20bf8f[_0xb1cf('0x10')]||0xa;this[_0xb1cf('0x11')]=_0x20bf8f[_0xb1cf('0x11')]||'no';this[_0xb1cf('0x12')]=!![];this[_0xb1cf('0x13')]='';this[_0xb1cf('0x14')]=0x0;this[_0xb1cf('0x15')]=0x0;this[_0xb1cf('0x16')]=_0x20bf8f['dialTimezone']||null;this[_0xb1cf('0x17')]=_0x20bf8f['dialGlobalInterval']?_0x20bf8f[_0xb1cf('0x17')]:null;this[_0xb1cf('0x18')]=_0x20bf8f[_0xb1cf('0x18')];this['dialMethod']=_0x20bf8f['dialMethod']||'progressive';this[_0xb1cf('0x19')]=_0x20bf8f[_0xb1cf('0x19')]||0x0;this['dialLimitQueue']=_0x20bf8f['dialLimitQueue']||0x0;this[_0xb1cf('0x1a')]=_0x20bf8f['dialPowerLevel']||0x1;this[_0xb1cf('0x1b')]=_0x20bf8f[_0xb1cf('0x1b')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x20bf8f[_0xb1cf('0x1c')]||0.03;this['dialPredictiveInterval']=_0x20bf8f['dialPredictiveInterval']||0x258;this[_0xb1cf('0x1d')]=_0x20bf8f[_0xb1cf('0x1d')]||_0xb1cf('0x1e');this[_0xb1cf('0x1f')]=_0x20bf8f[_0xb1cf('0x1f')]||_0xb1cf('0x1e');this[_0xb1cf('0x20')]=_0x20bf8f[_0xb1cf('0x20')]||0x1e;this['dialQueueOptions']=_0x20bf8f['dialQueueOptions']||_0xb1cf('0x21');this[_0xb1cf('0x22')]=_0x20bf8f[_0xb1cf('0x22')]||0x3;this[_0xb1cf('0x23')]=_0x20bf8f[_0xb1cf('0x23')]||undefined;this[_0xb1cf('0x24')]=_0x20bf8f[_0xb1cf('0x24')]||0x3;this[_0xb1cf('0x25')]=_0x20bf8f[_0xb1cf('0x25')]||0x96;this[_0xb1cf('0x26')]=_0x20bf8f['dialBusyMaxRetry']||0x3;this[_0xb1cf('0x27')]=_0x20bf8f['dialBusyRetryFrequency']||0x96;this[_0xb1cf('0x28')]=_0x20bf8f[_0xb1cf('0x28')]||0x3;this[_0xb1cf('0x29')]=_0x20bf8f[_0xb1cf('0x29')]||0x96;this[_0xb1cf('0x2a')]=_0x20bf8f[_0xb1cf('0x2a')]||0x3;this[_0xb1cf('0x2b')]=_0x20bf8f[_0xb1cf('0x2b')]||0x96;this[_0xb1cf('0x2c')]=_0x20bf8f['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x20bf8f[_0xb1cf('0x2d')]||0x96;this[_0xb1cf('0x2e')]=_0x20bf8f[_0xb1cf('0x2e')]||0x3;this[_0xb1cf('0x2f')]=_0x20bf8f[_0xb1cf('0x2f')]||0x96;this[_0xb1cf('0x30')]=_0x20bf8f[_0xb1cf('0x30')]||0x3;this[_0xb1cf('0x31')]=_0x20bf8f[_0xb1cf('0x31')]||0x96;this[_0xb1cf('0x32')]=_0x20bf8f['dialAgentRejectMaxRetry']||0x3;this[_0xb1cf('0x33')]=_0x20bf8f['dialAgentRejectRetryFrequency']||0x96;this[_0xb1cf('0x34')]=_0x20bf8f[_0xb1cf('0x34')]||0x4;this['Trunk']=_0x20bf8f['Trunk']?_0x20bf8f['Trunk']:undefined;this[_0xb1cf('0x35')]=_0x20bf8f[_0xb1cf('0x35')]?_0x20bf8f['TrunkBackup']:undefined;this['dialPrefix']=_0x20bf8f[_0xb1cf('0x36')]||undefined;this['Interval']=_0x20bf8f['Interval']?_0x20bf8f[_0xb1cf('0x37')]:undefined;this[_0xb1cf('0x38')]=_0x20bf8f[_0xb1cf('0x38')]||_0xb1cf('0x39');this[_0xb1cf('0x3a')]=_0x20bf8f[_0xb1cf('0x3a')]||undefined;this[_0xb1cf('0x3b')]=_0x20bf8f['dialCutDigit']||undefined;this[_0xb1cf('0x3c')]=strategy[_0x20bf8f[_0xb1cf('0x3c')]]||_0xb1cf('0x6');this[_0xb1cf('0x3d')]=!![];this['dialAMDActive']=_0x20bf8f['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x20bf8f[_0xb1cf('0x3e')];this[_0xb1cf('0x3f')]=_0x20bf8f[_0xb1cf('0x3f')];this[_0xb1cf('0x40')]=_0x20bf8f[_0xb1cf('0x40')];this[_0xb1cf('0x41')]=_0x20bf8f[_0xb1cf('0x41')];this['dialAMDMinWordLength']=_0x20bf8f[_0xb1cf('0x42')];this['dialAMDBetweenWordsSilence']=_0x20bf8f[_0xb1cf('0x43')];this[_0xb1cf('0x44')]=_0x20bf8f[_0xb1cf('0x44')];this[_0xb1cf('0x45')]=_0x20bf8f[_0xb1cf('0x45')];this[_0xb1cf('0x46')]=_0x20bf8f[_0xb1cf('0x46')];this[_0xb1cf('0x47')]=0x0;this[_0xb1cf('0x48')]=0x0;this[_0xb1cf('0x49')]=_0x20bf8f[_0xb1cf('0x49')];this[_0xb1cf('0x4a')]=0x0;this[_0xb1cf('0x4b')]=0x0;this[_0xb1cf('0x4c')]=0x0;this[_0xb1cf('0x4d')]=0x0;this[_0xb1cf('0x4e')]=0x0;this[_0xb1cf('0x4f')]=0x0;this[_0xb1cf('0x50')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xb1cf('0x51')]=0x0;this[_0xb1cf('0x52')]=0x0;this[_0xb1cf('0x53')]=0x0;this[_0xb1cf('0x54')]=0x0;this[_0xb1cf('0x55')]=0x0;this[_0xb1cf('0x56')]=0x0;this[_0xb1cf('0x57')]=undefined;this[_0xb1cf('0x58')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xb1cf('0x59')]=0x0;this[_0xb1cf('0x5a')]=0x0;this[_0xb1cf('0x5b')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xb1cf('0x5c')]=0x0;this[_0xb1cf('0x5d')]=0x0;this[_0xb1cf('0x5e')]=0x0;this[_0xb1cf('0x5f')]=0x0;this[_0xb1cf('0x60')]=_0x20bf8f[_0xb1cf('0x61')]||0x14;this['predictiveIntervalMinThreshold']=_0x20bf8f['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xb1cf('0x62')]=0x0;this[_0xb1cf('0x63')]=0x0;this[_0xb1cf('0x64')]=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0xb1cf('0x65')]=0x0;this['erlangBusyFactor']=0x0;this[_0xb1cf('0x66')]=_0x20bf8f[_0xb1cf('0x66')]||0x1e;this[_0xb1cf('0x67')]=_0x20bf8f[_0xb1cf('0x67')]||![];this['dialQueueProject2']=_0x20bf8f[_0xb1cf('0x68')]||undefined;this[_0xb1cf('0x69')]=_0x20bf8f[_0xb1cf('0x69')]||![];this['dialAgiAfterHangupAgent']=_0x20bf8f[_0xb1cf('0x6a')]||![];this['monitor_format']=monitorFormat[_0x20bf8f[_0xb1cf('0x9')]]?monitorFormat[_0x20bf8f['monitor_format']]:undefined;this[_0xb1cf('0x6b')]=_0x20bf8f[_0xb1cf('0x6b')]||![];this[_0xb1cf('0x6c')]=_0x20bf8f[_0xb1cf('0x6c')]?_0x20bf8f[_0xb1cf('0x6c')]:undefined;}module[_0xb1cf('0x6d')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 5d65040..b29bef7 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 _0xfaa8=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x58a4af,_0x4eac03){var _0x4c4539=function(_0x4e2c0b){while(--_0x4e2c0b){_0x58a4af['push'](_0x58a4af['shift']());}};_0x4c4539(++_0x4eac03);}(_0xfaa8,0xec));var _0x8faa=function(_0x466157,_0x5769b5){_0x466157=_0x466157-0x0;var _0xd6688=_0xfaa8[_0x466157];return _0xd6688;};'use strict';function VtigerAccount(_0x5408cb){this['id']=_0x5408cb['id']||0x0;this['name']=_0x5408cb[_0x8faa('0x0')]||'';this[_0x8faa('0x1')]=_0x5408cb['username']||'';this[_0x8faa('0x2')]=_0x5408cb[_0x8faa('0x2')]||'';this[_0x8faa('0x3')]=_0x5408cb['remoteUri']||'';this[_0x8faa('0x4')]=_0x5408cb[_0x8faa('0x4')]||'';this[_0x8faa('0x5')]=_0x5408cb[_0x8faa('0x5')]||{};}module[_0x8faa('0x6')]=VtigerAccount; \ No newline at end of file +var _0xf35b=['name','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x106061,_0x5c2ec6){var _0x250904=function(_0x698b64){while(--_0x698b64){_0x106061['push'](_0x106061['shift']());}};_0x250904(++_0x5c2ec6);}(_0xf35b,0x1e5));var _0xbf35=function(_0x299967,_0x50e860){_0x299967=_0x299967-0x0;var _0xb9c80a=_0xf35b[_0x299967];return _0xb9c80a;};'use strict';function VtigerAccount(_0x55fdc1){this['id']=_0x55fdc1['id']||0x0;this[_0xbf35('0x0')]=_0x55fdc1['name']||'';this['username']=_0x55fdc1['username']||'';this[_0xbf35('0x1')]=_0x55fdc1[_0xbf35('0x1')]||'';this[_0xbf35('0x2')]=_0x55fdc1[_0xbf35('0x2')]||'';this[_0xbf35('0x3')]=_0x55fdc1[_0xbf35('0x3')]||'';this['Configurations']=_0x55fdc1[_0xbf35('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index d921500..50c7b32 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 _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x48f6d6,_0x518af9){var _0x3dca9c=function(_0x1d4983){while(--_0x1d4983){_0x48f6d6['push'](_0x48f6d6['shift']());}};_0x3dca9c(++_0x518af9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3a446d,_0x590154){_0x3a446d=_0x3a446d-0x0;var _0x149eb8=_0x5f2f[_0x3a446d];return _0x149eb8;};'use strict';function ZendeskAccount(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||'';this[_0xf5f2('0x2')]=_0x7c86d8[_0xf5f2('0x2')]||'';this[_0xf5f2('0x3')]=_0x7c86d8['token']||'';this['remoteUri']=_0x7c86d8[_0xf5f2('0x4')]||'';this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||'';this[_0xf5f2('0x6')]=_0x7c86d8[_0xf5f2('0x6')]||_0xf5f2('0x7');this['serverUrl']=_0x7c86d8[_0xf5f2('0x8')]||'';this[_0xf5f2('0x9')]=_0x7c86d8[_0xf5f2('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x2d3030,_0x46d52b){_0x2d3030=_0x2d3030-0x0;var _0x53b2d6=_0xdb28[_0x2d3030];return _0x53b2d6;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index ecf418e..b331e19 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 _0x0f42=['zone','clientId','clientSecret','serverUrl','code','Configurations','name','description','host'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0x0f42,0x126));var _0x20f4=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x0f42[_0x13d07a];return _0x5ee0ee;};'use strict';function ZohoAccount(_0x2b9c18){this['id']=_0x2b9c18['id']||0x0;this[_0x20f4('0x0')]=_0x2b9c18[_0x20f4('0x0')]||'';this[_0x20f4('0x1')]=_0x2b9c18['description']||'';this[_0x20f4('0x2')]=_0x2b9c18['host']||'';this[_0x20f4('0x3')]=_0x2b9c18['zone']||'';this[_0x20f4('0x4')]=_0x2b9c18[_0x20f4('0x4')]||'';this[_0x20f4('0x5')]=_0x2b9c18['clientSecret']||'';this[_0x20f4('0x6')]=_0x2b9c18[_0x20f4('0x6')]||'';this['code']=_0x2b9c18[_0x20f4('0x7')]||'';this['refreshToken']=_0x2b9c18['refreshToken']||'';this['Configurations']=_0x2b9c18[_0x20f4('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x8f4c=['clientSecret','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x4eec36,_0x4f20cf){var _0x4bca37=function(_0x43667e){while(--_0x43667e){_0x4eec36['push'](_0x4eec36['shift']());}};_0x4bca37(++_0x4f20cf);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3fbbd0,_0x269a1f){_0x3fbbd0=_0x3fbbd0-0x0;var _0x135c98=_0x8f4c[_0x3fbbd0];return _0x135c98;};'use strict';function ZohoAccount(_0x56f041){this['id']=_0x56f041['id']||0x0;this[_0xc8f4('0x0')]=_0x56f041[_0xc8f4('0x0')]||'';this[_0xc8f4('0x1')]=_0x56f041[_0xc8f4('0x1')]||'';this[_0xc8f4('0x2')]=_0x56f041['host']||'';this[_0xc8f4('0x3')]=_0x56f041[_0xc8f4('0x3')]||'';this[_0xc8f4('0x4')]=_0x56f041['clientId']||'';this[_0xc8f4('0x5')]=_0x56f041['clientSecret']||'';this['serverUrl']=_0x56f041['serverUrl']||'';this[_0xc8f4('0x6')]=_0x56f041['code']||'';this[_0xc8f4('0x7')]=_0x56f041[_0xc8f4('0x7')]||'';this[_0xc8f4('0x8')]=_0x56f041[_0xc8f4('0x8')]||{};}module[_0xc8f4('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 33a330b..b1a8659 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 _0x110d=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','exports','lodash','isNil','string','uniqueid','queue','name','type','campaigntype','membername','Agent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry'];(function(_0x87d357,_0xf5fe0b){var _0x479c89=function(_0xcc6200){while(--_0xcc6200){_0x87d357['push'](_0x87d357['shift']());}};_0x479c89(++_0xf5fe0b);}(_0x110d,0x12b));var _0xd110=function(_0x1abbb8,_0x3638d7){_0x1abbb8=_0x1abbb8-0x0;var _0x388130=_0x110d[_0x1abbb8];return _0x388130;};'use strict';var util=require('util');var _=require(_0xd110('0x0'));var moment=require('moment');function checkNameSurname(_0xe9c4cf,_0x2682b7,_0x817a5d){var _0x53be79='';if(!_[_0xd110('0x1')](_0x2682b7)&&_0xd110('0x2')===typeof _0x2682b7){_0x53be79+=_0x2682b7;}if(!_[_0xd110('0x1')](_0x817a5d)&&_0xd110('0x2')===typeof _0x817a5d){_0x53be79+='\x20'+_0x817a5d;}if(_0x53be79!==''){return _0x53be79;}return _0xe9c4cf;}function Action(_0xdc8d38,_0xee93c1,_0x29abd9,_0x68effc,_0x1a3f29){this[_0xd110('0x3')]=_0x29abd9||undefined;this['idContact']=_0xdc8d38['id'];this[_0xd110('0x4')]=_0xee93c1[_0xd110('0x5')];this[_0xd110('0x6')]=_0xee93c1[_0xd110('0x6')];this[_0xd110('0x7')]=_0xd110('0x4');this['dialAnswer']=![];this[_0xd110('0x8')]=_[_0xd110('0x1')](_0xdc8d38[_0xd110('0x9')])?undefined:_0xdc8d38['Agent'][_0xd110('0x5')];this['channelAgent']=this[_0xd110('0x8')]?util[_0xd110('0xa')](_0xd110('0xb'),this[_0xd110('0x8')]):_0x68effc||undefined;this[_0xd110('0xc')]=checkNameSurname(_0xdc8d38[_0xd110('0xd')][_0xd110('0xe')],_0xdc8d38[_0xd110('0xd')][_0xd110('0xf')],_0xdc8d38[_0xd110('0xd')][_0xd110('0x10')]);this[_0xd110('0x11')]=_0xdc8d38[_0xd110('0x11')]||![];this['calleridnum']=_0xdc8d38['Contact']['phone'];this[_0xd110('0x12')]=_0xdc8d38['scheduledat'];this[_0xd110('0x13')]=_0xdc8d38['countbusyretry']||0x0;this['countcongestionretry']=_0xdc8d38[_0xd110('0x14')]||0x0;this[_0xd110('0x15')]=_0xdc8d38[_0xd110('0x15')]||0x0;this[_0xd110('0x16')]=(_0xdc8d38['countbusyretry']||0x0)+(_0xdc8d38['countcongestionretry']||0x0)+(_0xdc8d38[_0xd110('0x15')]||0x0)+(_0xdc8d38[_0xd110('0x17')]||0x0)+(_0xdc8d38[_0xd110('0x18')]||0x0)+(_0xdc8d38['countabandonedretry']||0x0)+(_0xdc8d38['countmachineretry']||0x0)+(_0xdc8d38['countagentrejectretry']||0x0);this[_0xd110('0x17')]=_0xdc8d38[_0xd110('0x17')]||0x0;this['countdropretry']=_0xdc8d38[_0xd110('0x18')]||0x0;this['countabandonedretry']=_0xdc8d38['countabandonedretry']||0x0;this['countmachineretry']=_0xdc8d38[_0xd110('0x19')]||0x0;this[_0xd110('0x1a')]=_0xdc8d38[_0xd110('0x1a')]||0x0;this[_0xd110('0x1b')]=_0xdc8d38[_0xd110('0x1b')];this[_0xd110('0x1c')]=_0xdc8d38[_0xd110('0x1c')];this[_0xd110('0x1d')]=_0xdc8d38['callbackat'];this['recallme']=_0xdc8d38[_0xd110('0x1e')];this[_0xd110('0x1f')]=_0xdc8d38[_0xd110('0x1f')];this[_0xd110('0x20')]=_0xdc8d38['ListId'];this['UserId']=_['isNil'](_0xdc8d38['Agent'])?_0xdc8d38[_0xd110('0x21')]:_0xdc8d38[_0xd110('0x9')]['id'];this[_0xd110('0x22')]=_0xdc8d38[_0xd110('0x22')];this[_0xd110('0x23')]='';this[_0xd110('0x24')]='';}Action[_0xd110('0x25')]['getCaller']=function(){return util[_0xd110('0xa')](_0xd110('0x26'),this['calleridname'],this['number']);};module[_0xd110('0x27')]=Action; \ No newline at end of file +var _0x6ea6=['Agent','channelAgent','membername','format','SIP/%s','phone','firstName','Contact','lastName','active','calleridnum','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','util','lodash','isNil','string','uniqueid','idContact','queue','name','type','campaigntype'];(function(_0x281959,_0x3a32f5){var _0x811bd=function(_0x4efc3b){while(--_0x4efc3b){_0x281959['push'](_0x281959['shift']());}};_0x811bd(++_0x3a32f5);}(_0x6ea6,0x186));var _0x66ea=function(_0x3124f8,_0x1a8b23){_0x3124f8=_0x3124f8-0x0;var _0x5bab5f=_0x6ea6[_0x3124f8];return _0x5bab5f;};'use strict';var util=require(_0x66ea('0x0'));var _=require(_0x66ea('0x1'));var moment=require('moment');function checkNameSurname(_0x41ae8b,_0x28ee91,_0x1ed9db){var _0x3ff5f6='';if(!_[_0x66ea('0x2')](_0x28ee91)&&_0x66ea('0x3')===typeof _0x28ee91){_0x3ff5f6+=_0x28ee91;}if(!_[_0x66ea('0x2')](_0x1ed9db)&&_0x66ea('0x3')===typeof _0x1ed9db){_0x3ff5f6+='\x20'+_0x1ed9db;}if(_0x3ff5f6!==''){return _0x3ff5f6;}return _0x41ae8b;}function Action(_0x4788d3,_0x27c6e9,_0x75d3fb,_0x8393ec,_0x2d643a){this[_0x66ea('0x4')]=_0x75d3fb||undefined;this[_0x66ea('0x5')]=_0x4788d3['id'];this[_0x66ea('0x6')]=_0x27c6e9[_0x66ea('0x7')];this[_0x66ea('0x8')]=_0x27c6e9[_0x66ea('0x8')];this[_0x66ea('0x9')]=_0x66ea('0x6');this['dialAnswer']=![];this['membername']=_[_0x66ea('0x2')](_0x4788d3['Agent'])?undefined:_0x4788d3[_0x66ea('0xa')]['name'];this[_0x66ea('0xb')]=this[_0x66ea('0xc')]?util[_0x66ea('0xd')](_0x66ea('0xe'),this[_0x66ea('0xc')]):_0x8393ec||undefined;this['calleridname']=checkNameSurname(_0x4788d3['Contact'][_0x66ea('0xf')],_0x4788d3['Contact'][_0x66ea('0x10')],_0x4788d3[_0x66ea('0x11')][_0x66ea('0x12')]);this[_0x66ea('0x13')]=_0x4788d3[_0x66ea('0x13')]||![];this[_0x66ea('0x14')]=_0x4788d3[_0x66ea('0x11')]['phone'];this['scheduledat']=_0x4788d3['scheduledat'];this['countbusyretry']=_0x4788d3[_0x66ea('0x15')]||0x0;this['countcongestionretry']=_0x4788d3['countcongestionretry']||0x0;this[_0x66ea('0x16')]=_0x4788d3[_0x66ea('0x16')]||0x0;this[_0x66ea('0x17')]=(_0x4788d3[_0x66ea('0x15')]||0x0)+(_0x4788d3[_0x66ea('0x18')]||0x0)+(_0x4788d3[_0x66ea('0x16')]||0x0)+(_0x4788d3[_0x66ea('0x19')]||0x0)+(_0x4788d3[_0x66ea('0x1a')]||0x0)+(_0x4788d3[_0x66ea('0x1b')]||0x0)+(_0x4788d3[_0x66ea('0x1c')]||0x0)+(_0x4788d3[_0x66ea('0x1d')]||0x0);this[_0x66ea('0x19')]=_0x4788d3[_0x66ea('0x19')]||0x0;this[_0x66ea('0x1a')]=_0x4788d3[_0x66ea('0x1a')]||0x0;this[_0x66ea('0x1b')]=_0x4788d3[_0x66ea('0x1b')]||0x0;this[_0x66ea('0x1c')]=_0x4788d3[_0x66ea('0x1c')]||0x0;this[_0x66ea('0x1d')]=_0x4788d3[_0x66ea('0x1d')]||0x0;this['callback']=_0x4788d3[_0x66ea('0x1e')];this[_0x66ea('0x1f')]=_0x4788d3[_0x66ea('0x1f')];this['callbackat']=_0x4788d3['callbackat'];this[_0x66ea('0x20')]=_0x4788d3[_0x66ea('0x20')];this[_0x66ea('0x21')]=_0x4788d3[_0x66ea('0x21')];this['ListId']=_0x4788d3[_0x66ea('0x22')];this['UserId']=_['isNil'](_0x4788d3['Agent'])?_0x4788d3['UserId']:_0x4788d3[_0x66ea('0xa')]['id'];this[_0x66ea('0x23')]=_0x4788d3['VoiceQueueId'];this[_0x66ea('0x24')]='';this[_0x66ea('0x25')]='';}Action['prototype'][_0x66ea('0x26')]=function(){return util[_0x66ea('0xd')](_0x66ea('0x27'),this['calleridname'],this['number']);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 0307863..06593f1 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 _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(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0a9e('0x3'));var Redis=require('ioredis');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var ami=require('../ami');var rpcDb=require(_0x0a9e('0x8'));var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));config['redis']=_['defaults'](config[_0x0a9e('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xb')]));var Sequence=function(){};Sequence[_0x0a9e('0xc')][_0x0a9e('0xd')]=function(_0x3ab53f){this[_0x0a9e('0xe')]=this[_0x0a9e('0xe')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0xf')]=_0x527cdd[_0x0a9e('0x10')];this[_0x0a9e('0x11')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]={};this[_0x0a9e('0x13')]=_0x527cdd['agents'];this[_0x0a9e('0x14')]=0x0;ami['on'](_0x0a9e('0x15'),this[_0x0a9e('0x16')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x18'),this[_0x0a9e('0x19')]['bind'](this));ami['on'](_0x0a9e('0x1a'),this['syncHangupRequest'][_0x0a9e('0x17')](this));ami['on']('dialend',this[_0x0a9e('0x1b')][_0x0a9e('0x17')](this));ami['on']('newexten',this[_0x0a9e('0x1c')]['bind'](this));ami['on'](_0x0a9e('0x1d'),this[_0x0a9e('0x1e')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x1f'),this[_0x0a9e('0x20')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x21'),this[_0x0a9e('0x22')][_0x0a9e('0x17')](this));this[_0x0a9e('0x23')](this[_0x0a9e('0xf')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x24')](_0x4bb1e3,_0x2c3407);}function emitCampaignPreview(_0x53682f){if(_0x53682f[_0x0a9e('0x25')]==='outbound'){var _0x588269={'id':_0x53682f['id'],'name':_0x53682f[_0x0a9e('0x26')],'strategy':_0x53682f[_0x0a9e('0x27')],'answered':_0x53682f[_0x0a9e('0x28')],'available':_0x53682f[_0x0a9e('0x29')],'loggedIn':_0x53682f['loggedIn'],'pTalking':_0x53682f[_0x0a9e('0x2a')],'sumBillable':_0x53682f[_0x0a9e('0x2b')],'sumDuration':_0x53682f[_0x0a9e('0x2c')],'sumHoldTime':_0x53682f[_0x0a9e('0x2d')]||0x0,'talking':_0x53682f[_0x0a9e('0x2e')],'total':_0x53682f[_0x0a9e('0x2f')],'type':_0x53682f[_0x0a9e('0x25')],'unmanaged':_0x53682f['unmanaged'],'abandoned':_0x53682f['abandoned'],'waiting':_0x53682f[_0x0a9e('0x30')],'loggedInDb':_0x53682f[_0x0a9e('0x31')],'dialActive':_0x53682f[_0x0a9e('0x32')],'dialMethod':_0x53682f[_0x0a9e('0x33')],'dialOriginateCallerIdName':_0x53682f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x53682f[_0x0a9e('0x34')],'dialOriginateTimeout':_0x53682f['dialOriginateTimeout'],'dialPrefix':_0x53682f[_0x0a9e('0x35')],'outboundAnswerAgiCallsDay':_0x53682f['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x53682f[_0x0a9e('0x36')],'outboundBlacklistCallsDay':_0x53682f[_0x0a9e('0x37')],'outboundBusyCallsDay':_0x53682f[_0x0a9e('0x38')],'outboundCongestionCallsDay':_0x53682f[_0x0a9e('0x39')],'outboundDropCallsDayACS':_0x53682f[_0x0a9e('0x3a')],'outboundDropCallsDayCallersExit':_0x53682f[_0x0a9e('0x3b')],'outboundDropCallsDayTimeout':_0x53682f[_0x0a9e('0x3c')],'outboundNoAnswerCallsDay':_0x53682f[_0x0a9e('0x3d')],'outboundNoSuchCallsDay':_0x53682f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x53682f[_0x0a9e('0x3e')],'outboundReCallsDay':_0x53682f[_0x0a9e('0x3f')],'outboundRejectCallsDay':_0x53682f[_0x0a9e('0x40')],'outboundUnknownCallsDay':_0x53682f[_0x0a9e('0x41')],'outboundAbandonedCallsDay':_0x53682f['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x53682f[_0x0a9e('0x42')],'predictiveIntervalAvgHoldtime':_0x53682f[_0x0a9e('0x43')],'predictiveIntervalAvgTalktime':_0x53682f[_0x0a9e('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x53682f[_0x0a9e('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x53682f[_0x0a9e('0x46')],'predictiveIntervalErlangCalls':_0x53682f[_0x0a9e('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x53682f[_0x0a9e('0x48')],'predictiveIntervalHitRate':_0x53682f[_0x0a9e('0x49')],'predictiveIntervalMultiplicativeFactor':_0x53682f[_0x0a9e('0x4a')],'predictiveIntervalPauses':_0x53682f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x53682f[_0x0a9e('0x4b')],'predictiveIntervalTotalCalls':_0x53682f['predictiveIntervalTotalCalls'],'message':_0x53682f[_0x0a9e('0x4c')],'originated':_0x53682f[_0x0a9e('0x4d')],'erlangCalls':_0x53682f[_0x0a9e('0x4e')],'erlangCallToSecond':_0x53682f[_0x0a9e('0x4f')],'erlangAbandonmentRate':_0x53682f[_0x0a9e('0x50')],'erlangBusyFactor':_0x53682f['erlangBusyFactor'],'startPredictive':_0x53682f[_0x0a9e('0x51')],'startProgressive':_0x53682f[_0x0a9e('0x52')]};if(_0x53682f[_0x0a9e('0x53')]){_0x588269[_0x0a9e('0x53')]={'id':_0x53682f[_0x0a9e('0x53')]['id'],'name':_0x53682f[_0x0a9e('0x53')][_0x0a9e('0x26')],'active':_0x53682f[_0x0a9e('0x53')]['active'],'callerid':_0x53682f[_0x0a9e('0x53')]['callerid']};}if(_0x53682f[_0x0a9e('0x54')]){_0x588269[_0x0a9e('0x54')]={'id':_0x53682f[_0x0a9e('0x54')]['id'],'name':_0x53682f[_0x0a9e('0x54')]['name']};}var _0x191e91=md5(JSON[_0x0a9e('0x55')](_0x588269));if(_0x53682f[_0x0a9e('0x3')]!==_0x191e91){_0x53682f[_0x0a9e('0x3')]=_0x191e91;emit(util['format']('voice:queue:%s',_0x588269[_0x0a9e('0x26')]),'voice_queue:save',_0x588269);}}}function emitVoiceQueueChannelRemove(_0x24936a){logger[_0x0a9e('0x56')](_0x0a9e('0x57'),JSON[_0x0a9e('0x55')](_0x24936a));emit(util['format'](_0x0a9e('0x58'),_0x24936a[_0x0a9e('0x26')]),_0x0a9e('0x59'),_0x24936a);}function notSendMessagesQueue(_0x533942){if(_0x533942[_0x0a9e('0x5a')]){if(_0x533942[_0x0a9e('0x4d')]===0x0&&_0x533942[_0x0a9e('0x2a')]===0x0){_0x533942['sendMessageOneNotActive']=![];_0x533942['available']=0x0;_0x533942[_0x0a9e('0x5b')]=0x0;_0x533942[_0x0a9e('0x4c')]='NOT_ACTIVE';ut[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x533942[_0x0a9e('0x26')]+_0x0a9e('0x5e'));}else{_0x533942['message']='IS_DISACTIVED';ut[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x533942['name']+_0x0a9e('0x5f'));}emitCampaignPreview(_0x533942);}}Preview[_0x0a9e('0xc')][_0x0a9e('0x23')]=function(){var _0x5b4f5e=this;setInterval(function(){_0x5b4f5e[_0x0a9e('0x60')]();},0x7cf);};Preview[_0x0a9e('0xc')][_0x0a9e('0x60')]=function(){var _0x43dd5b=this[_0x0a9e('0xf')];this[_0x0a9e('0x14')]+=0x1;for(var _0x2881b3 in _0x43dd5b){if(_0x43dd5b[_0x0a9e('0x61')](_0x2881b3)&&(_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x6')||_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x62'))&&_0x43dd5b[_0x2881b3][_0x0a9e('0x25')]===_0x0a9e('0x63')){if(this[_0x0a9e('0x14')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x43dd5b[_0x0a9e('0x61')](_0x2881b3)&&_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x6')&&_0x43dd5b[_0x2881b3][_0x0a9e('0x25')]===_0x0a9e('0x63')){if(_0x43dd5b[_0x2881b3][_0x0a9e('0x32')]){this[_0x0a9e('0x64')](_0x43dd5b[_0x2881b3]);this[_0x0a9e('0x65')](_0x43dd5b[_0x2881b3]);}else{notSendMessagesQueue(_0x43dd5b[_0x2881b3]);}}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x66')]=function(_0x2c2cb0){var _0x35ed4a=this;this['sequence'][_0x0a9e('0xd')](function(){if(!_[_0x0a9e('0x67')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0])){loggerAction[_0x0a9e('0x56')](_0x0a9e('0x68'),_0x2c2cb0,_0x0a9e('0x69'),_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')],'originated:\x20',JSON[_0x0a9e('0x55')](_0x35ed4a['campaignsPreview'][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]][_0x0a9e('0x4d')]),'pTalking:\x20',JSON[_0x0a9e('0x55')](_0x35ed4a[_0x0a9e('0xf')][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]][_0x0a9e('0x2a')]),JSON[_0x0a9e('0x55')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]['dialAnswer']),JSON[_0x0a9e('0x55')](_[_0x0a9e('0x6b')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0],[_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),_0x0a9e('0x6f')])));return ami[_0x0a9e('0x70')]({'action':_0x0a9e('0x71'),'channel':_0x35ed4a['actions'][_0x2c2cb0][_0x0a9e('0x72')]})[_0x0a9e('0x73')](function(_0x4f7240){if(_0x4f7240['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]){ut[_0x0a9e('0x74')](_0x35ed4a[_0x0a9e('0xf')][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]],_0x0a9e('0x75'));if(_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x76')]===!![]){ut['decrementTalkink'](_0x35ed4a['campaignsPreview'][_0x35ed4a['actions'][_0x2c2cb0][_0x0a9e('0x6a')]],_0x0a9e('0x75'));ut[_0x0a9e('0x77')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2c2cb0,_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x2c2cb0,_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]['queue']);delete _0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0];}},0x2328);}});}});};Preview['prototype'][_0x0a9e('0x78')]=function(){var _0x3c20b2=this;loggerAction[_0x0a9e('0x56')]('[action]',_[_0x0a9e('0x79')](this[_0x0a9e('0x12')]));for(var _0x508b47 in this['actions']){if(_0x3c20b2[_0x0a9e('0x12')][_0x0a9e('0x61')](_0x508b47)){_0x3c20b2['clearZombieChannel'](_0x508b47);}}};Preview[_0x0a9e('0xc')]['recallMe']=function(_0x211ef9){var _0x523cd2=this;rpcDb[_0x0a9e('0x7a')](_0x211ef9['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x2da03c){if(!_['isNil'](_0x2da03c)){for(var _0x2f7092=0x0;_0x2f7092<_0x2da03c[_0x0a9e('0x7b')];_0x2f7092+=0x1){if(ut[_0x0a9e('0x7c')](_0x2da03c[_0x2f7092][_0x0a9e('0x7d')])<_0x211ef9[_0x0a9e('0x7e')]*0x3c){if(_0x2da03c[_0x2f7092][_0x0a9e('0x7f')]&&!_0x2da03c[_0x2f7092][_0x0a9e('0x7f')][_0x0a9e('0x80')]){_0x523cd2['run'](_0x2da03c[_0x2f7092]['id'])[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x0a9e('0x83')))[_0x0a9e('0x73')](ut[_0x0a9e('0x82')](_0x0a9e('0x83')));}else{rpcDb['disableContact'](_0x2da03c[_0x2f7092]['id']);}}else{var _0x956fbe=new Action(_0x2da03c[_0x2f7092],_0x211ef9);_0x956fbe[_0x0a9e('0x84')]=moment()['format'](_0x0a9e('0x85'));_0x211ef9['outboundReCallsDay']+=0x1;ut[_0x0a9e('0x86')](_0x956fbe,0x17,'RecallInQueue');if(_0x211ef9['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x0a9e('0x87')](_0x2da03c[_0x2f7092]));rpcDb['createCustomerHistory'](_0x956fbe,_0x0a9e('0x88'));}else{ut[_0x0a9e('0x86')](_0x956fbe,0x16,_0x0a9e('0x89'));rpcDb[_0x0a9e('0x8a')](_0x956fbe,_0x0a9e('0x8b'));rpcDb[_0x0a9e('0x8c')](_0x956fbe,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x73')](ut['logger2'](_0x0a9e('0x8d')));};Preview[_0x0a9e('0xc')][_0x0a9e('0x64')]=function(_0x5adf8f){_0x5adf8f[_0x0a9e('0x5a')]=!![];if(ut[_0x0a9e('0x8e')](_0x5adf8f[_0x0a9e('0x8f')])){_0x5adf8f[_0x0a9e('0x4c')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x0a9e('0x90')](_0x5adf8f[_0x0a9e('0x32')])){_0x5adf8f['message']=_0x0a9e('0x91');}else if(!this[_0x0a9e('0x92')](_0x5adf8f[_0x0a9e('0x53')])){if(!this[_0x0a9e('0x92')](_0x5adf8f[_0x0a9e('0x93')])){_0x5adf8f['message']=_0x0a9e('0x94');}else{_0x5adf8f[_0x0a9e('0x4c')]=_0x0a9e('0x95');}}else{_0x5adf8f['message']=_0x0a9e('0x95');}emitCampaignPreview(_0x5adf8f);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x242745,_0x4556c5,_0x9375fb){var _0x19c995=this;var _0x186f39=this[_0x0a9e('0x12')][_0x4556c5];var _0x387489=this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]];var _0x1cc4f3;if(_0x387489){switch(_0x9375fb){case'1':_0x387489[_0x0a9e('0x96')]+=0x1;_0x186f39[_0x0a9e('0x97')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x0,_0x0a9e('0x9a'));ami[_0x0a9e('0x24')](_0x0a9e('0x9b'),ut['buildObj'](_0x186f39,_0x0a9e('0x9c')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0x9d'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,'Global');rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xa0'));}else{if(_0x186f39[_0x0a9e('0x97')]>=_0x387489[_0x0a9e('0xa1')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x186f39,_0x0a9e('0x97'),_0x387489[_0x0a9e('0xa2')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];break;case _0x0a9e('0xa6'):var _0x1a0677=moment()['format'](_0x0a9e('0x85'));_0x186f39[_0x0a9e('0xa7')]=_0x1a0677;_0x186f39[_0x0a9e('0xa8')]=_0x1a0677;_0x186f39['dialAnswer']=!![];_0x387489[_0x0a9e('0x2a')]+=0x1;logger['info'](_0x0a9e('0xa9'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489[_0x0a9e('0x26')],_0x0a9e('0xab'),_0x387489[_0x0a9e('0x2a')]);ami[_0x0a9e('0x24')]('custom:agentconnect',ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xad'),this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]]));if(_0x387489['acw']){ami[_0x0a9e('0x24')](_0x0a9e('0xae'),ut[_0x0a9e('0xaf')](_0x186f39));}break;case'16':ami[_0x0a9e('0x24')]('custom:agentcomplete',ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xb0'),this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xb0')));_0x387489[_0x0a9e('0x36')]+=0x1;_0x387489[_0x0a9e('0x2f')]+=0x1;_0x387489[_0x0a9e('0x28')]+=0x1;ut[_0x0a9e('0xb1')](_0x387489,_0x0a9e('0xb2'));_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x4,'Answer');rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xb3'));rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x0a9e('0xb4')](_0x186f39);_0x387489[_0x0a9e('0x2c')]+=_0x186f39[_0x0a9e('0xb5')];_0x387489[_0x0a9e('0x2b')]+=_0x186f39['talktime'];logger['info'](_0x0a9e('0xb6'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489[_0x0a9e('0x26')],'pTalking:\x20',_0x387489[_0x0a9e('0x2a')]);delete this[_0x0a9e('0x12')][_0x242745['linkedid']];break;case _0x0a9e('0xb7'):_0x387489[_0x0a9e('0x38')]+=0x1;_0x186f39[_0x0a9e('0xb8')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x5,_0x0a9e('0xb9'));ami['emit'](_0x0a9e('0xba'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xbb')));rpcDb[_0x0a9e('0x8a')](_0x186f39,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x0a9e('0x99')](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb['createCustomerFinal'](_0x1cc4f3,_0x0a9e('0xbd'));}else{if(_0x186f39[_0x0a9e('0xb8')]>=_0x387489[_0x0a9e('0xbe')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xb8'),_0x387489[_0x0a9e('0xc0')]),_0x186f39['unlockAgent'],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xc1'):_0x387489['outboundNoAnswerCallsDay']+=0x1;_0x186f39['countnoanswerretry']+=0x1;_0x186f39[_0x0a9e('0x98')]=ut['totalGlobal'](_0x186f39);ut['logCustomer'](_0x186f39,0x3,'NoAnswer');ami[_0x0a9e('0x24')](_0x0a9e('0xc2'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xc3')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xc4'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xc5'));}else{if(_0x186f39[_0x0a9e('0xc6')]>=_0x387489['dialNoAnswerMaxRetry']){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xc4'));}else{rpcDb[_0x0a9e('0xc7')](ut['scheduledAt'](_0x186f39,_0x0a9e('0xc6'),_0x387489[_0x0a9e('0xc8')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xc9'):_0x387489[_0x0a9e('0x39')]+=0x1;_0x186f39[_0x0a9e('0xca')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut['totalGlobal'](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x8,_0x0a9e('0xcb'));ami['emit'](_0x0a9e('0xcc'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xcd')));rpcDb['createCustomerHistory'](_0x186f39,_0x0a9e('0xce'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xcf'));}else{if(_0x186f39[_0x0a9e('0xca')]>=_0x387489[_0x0a9e('0xd0')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x0a9e('0xc7')](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xca'),_0x387489[_0x0a9e('0xc0')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xd1'):_0x387489[_0x0a9e('0x40')]+=0x1;_0x186f39[_0x0a9e('0xd2')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x14,_0x0a9e('0xd3'));ami['emit'](_0x0a9e('0xd4'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xd5')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xd6'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0x14,'AgentReject');rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x186f39[_0x0a9e('0xd2')]>=_0x387489[_0x0a9e('0xd7')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xd8'));}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xbf')](_0x186f39,'countagentrejectretry',_0x387489[_0x0a9e('0xd9')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39['activeContact']);}}break;case _0x0a9e('0xda'):_0x387489[_0x0a9e('0xdb')]+=0x1;_0x186f39[_0x0a9e('0xdc')]+=0x1;_0x186f39['countglobal']=ut['totalGlobal'](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0xb,_0x0a9e('0xdd'));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xde'));if(ut[_0x0a9e('0x99')](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x186f39[_0x0a9e('0xdf')]>=_0x387489['dialAbandonedMaxRety']){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xde'));}else{rpcDb[_0x0a9e('0xc7')](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xdc'),_0x387489['dialAbandonedRetryFrequency']),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;default:if(_0x186f39[_0x0a9e('0x76')]){ut[_0x0a9e('0xb1')](_0x387489,_0x0a9e('0xe0'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x387489[_0x0a9e('0x26')],_0x242745);}_0x387489['outboundUnknownCallsDay']+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0xc,_0x242745[_0x0a9e('0xe1')]||_0x242745[_0x0a9e('0xe2')]);rpcDb[_0x0a9e('0x8a')](_0x186f39,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb['createCustomerFinal'](_0x1cc4f3,_0x0a9e('0xe3'));}else{rpcDb['createCustomerFinal'](_0x186f39,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];}if(!(_0x186f39['dialAnswer']&&_0x9375fb==='16')){ut[_0x0a9e('0x74')](_0x387489,_0x0a9e('0xe4'));logger[_0x0a9e('0x56')](_0x0a9e('0xe5'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489['name'],_0x0a9e('0xe6'),_0x387489[_0x0a9e('0x4d')]);}if(_0x9375fb!==_0x0a9e('0xa6')){delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];delete this['actions'][_0x242745[_0x0a9e('0xe7')]];}}};Preview[_0x0a9e('0xc')]['callProgressDetectingAgent']=function(_0x3c313d,_0x19fd11,_0xcacabb){if(_[_0x0a9e('0xe8')](_0x19fd11)&&_0x0a9e('0xe9')!==typeof _0x19fd11){return;}if(_[_0x0a9e('0xe8')](_0xcacabb)&&_0x0a9e('0xe9')!==typeof _0xcacabb){return;}switch(_0xcacabb[_0x0a9e('0xea')]){case'0':ut[_0x0a9e('0xeb')](_0x3c313d,0x0,_0x0a9e('0x9a'));rpcDb['createAgentHistory'](_0x3c313d,_0x0a9e('0xec'));break;case'3':ut[_0x0a9e('0xeb')](_0x3c313d,0x3,_0x0a9e('0xed'));rpcDb[_0x0a9e('0xee')](_0x3c313d,_0x0a9e('0xef'));break;case'5':ut['logAgent'](_0x3c313d,0x5,'Busy');rpcDb[_0x0a9e('0xee')](_0x3c313d,_0x0a9e('0xf0'));break;case'8':ut[_0x0a9e('0xeb')](_0x3c313d,0x8,_0x0a9e('0xcb'));rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x0a9e('0xeb')](_0x3c313d,0x16,_0x0a9e('0xf1'));rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x0a9e('0xeb')](_0x3c313d,0xc,_0xcacabb['reason']);rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logCongestion]');}ut[_0x0a9e('0x74')](_0x19fd11,_0x0a9e('0xf2'));logger[_0x0a9e('0x56')]('[originated][decrement][callProgressDetectingAgent]',_0x3c313d[_0x0a9e('0xaa')],'\x20Queue',_0x19fd11[_0x0a9e('0x26')],_0x0a9e('0xe6'),_0x19fd11[_0x0a9e('0x4d')]);delete this[_0x0a9e('0x12')][_0x3c313d[_0x0a9e('0xaa')]];};Preview[_0x0a9e('0xc')][_0x0a9e('0xf3')]=function(_0xe89aaa,_0x2aaf07,_0x27d1f5,_0x4262d0,_0xc876d4){var _0x2415fe=this;return new BPromise(function(_0x399def,_0x98c62c){if(_[_0x0a9e('0x67')](_0x2aaf07)||_['isNil'](_0x2aaf07['Contact'])||_[_0x0a9e('0x67')](_0x2aaf07['Contact'][_0x0a9e('0xf4')])||_[_0x0a9e('0x67')](_0x2aaf07['VoiceQueueId'])){_0x98c62c(ut[_0x0a9e('0x4c')](_0x0a9e('0xf5'),_0x4262d0,_0xc876d4));return;}var _0x387bbe=uuid['v4']();var _0x18adc8=_0x2415fe['campaignsPreview'][_0x2aaf07[_0x0a9e('0x69')][_0x0a9e('0x26')]];var _0x374f0b=_0x27d1f5?_0x2415fe[_0x0a9e('0x13')][_0x27d1f5]['id']:undefined;_0x2415fe['actions'][_0x387bbe]=new Action(_0x2aaf07,_0x18adc8,_0x387bbe,_0x27d1f5,_0x374f0b);var _0x19e9ed=_0x2415fe[_0x0a9e('0x12')][_0x387bbe];_0x19e9ed[_0x0a9e('0xa3')]=_0x4262d0;_0x19e9ed['activeContact']=_0xc876d4;_0x19e9ed[_0x0a9e('0xf6')]=_0x27d1f5;if(_[_0x0a9e('0xf7')](_0xe89aaa)){_0x2415fe[_0x0a9e('0xf8')](_0x19e9ed,_0x18adc8,_0x2aaf07,_0x27d1f5)['then'](function(_0x303f75){logger[_0x0a9e('0x56')](_0x0a9e('0xf9'),_0x0a9e('0xfa')+_0x19e9ed[_0x0a9e('0x6a')]+'\x20IdHopper:\x20'+_0x19e9ed[_0x0a9e('0xfb')],JSON[_0x0a9e('0x55')](_0x303f75));ami['emit'](_0x0a9e('0xfc'),ut[_0x0a9e('0xac')](_0x19e9ed,_0x0a9e('0xfd'),_0x2415fe['campaignsPreview'][_0x19e9ed['queue']]));_0x399def(ut['message'](_0x0a9e('0xfe')));})[_0x0a9e('0x73')](function(_0x55f91a){ut[_0x0a9e('0x5c')](_0x0a9e('0xff'),_0x55f91a);_0x98c62c(ut[_0x0a9e('0x4c')]('Call\x20failed',_0x4262d0,_0xc876d4));});}else{_0x18adc8[_0x0a9e('0x37')]+=0x1;ut[_0x0a9e('0x100')](_0x19e9ed);rpcDb[_0x0a9e('0x101')](_0x19e9ed,_0x0a9e('0x102'));delete _0x2415fe[_0x0a9e('0x12')][_0x387bbe];_0x98c62c(ut[_0x0a9e('0x4c')](_0x0a9e('0x103'),_0x4262d0,_0xc876d4));}});};Preview[_0x0a9e('0xc')][_0x0a9e('0x92')]=function(_0x5a1848){return!_[_0x0a9e('0x67')](_0x5a1848)&&!_['isNil'](_0x5a1848[_0x0a9e('0x26')])&&!_[_0x0a9e('0x67')](_0x5a1848[_0x0a9e('0x104')])&&_0x5a1848[_0x0a9e('0x104')]&&!_[_0x0a9e('0x67')](this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])])&&!_[_0x0a9e('0x67')](this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')])&&(this[_0x0a9e('0x11')][util[_0x0a9e('0x106')](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')]===_0x0a9e('0x107')||this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')]===_0x0a9e('0x108'));};Preview[_0x0a9e('0xc')][_0x0a9e('0x109')]=function(_0x2895c5,_0x20ae21){var _0x566b90=this;return new BPromise(function(_0x3b581c,_0xd2391){_0x566b90[_0x0a9e('0x10a')](_0x2895c5,_0x20ae21)['then'](function(_0x1402c7){_0x3b581c(_[_0x0a9e('0x6b')](_0x1402c7,[_0x0a9e('0x4c')]));})[_0x0a9e('0x73')](function(_0x370b5e){if(_0x370b5e[_0x0a9e('0x10b')]){rpcDb[_0x0a9e('0x10c')](_0x2895c5);}if(_0x370b5e[_0x0a9e('0x104')]){rpcDb[_0x0a9e('0x10d')](_0x2895c5);}_0xd2391(_[_0x0a9e('0x6b')](_0x370b5e,['message']));});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x10a')]=function(_0x15a9ed,_0x3db98f){var _0x2b624e=this;return new BPromise(function(_0x3942fd,_0x5cb48d){var _0x382687,_0x4f854b;rpcDb['getContactPreview'](_0x15a9ed)['then'](function(_0x19e4e6){if(!_[_0x0a9e('0x67')](_0x19e4e6[0x0])){_0x4f854b=_0x19e4e6[0x0][_0x0a9e('0x10e')]?![]:!![];_0x382687=_0x19e4e6[0x0][_0x0a9e('0x10e')]?!![]:![];_0x382687=_0x3db98f?!![]:_0x382687;}var _0x4d99a8=_0x2b624e[_0x0a9e('0x10f')](_0x19e4e6);if(_0x4d99a8[_0x0a9e('0x110')]){rpcDb[_0x0a9e('0x111')](_[_0x0a9e('0x6b')](_0x19e4e6[0x0],[_0x0a9e('0x6e'),'Contact.phone']))['then'](function(_0x9484c8){_0x2b624e[_0x0a9e('0xf3')](_0x9484c8,_0x19e4e6[0x0],_0x3db98f,_0x4f854b,_0x382687)[_0x0a9e('0x81')](function(_0x5e85d0){_0x3942fd(_0x5e85d0);})[_0x0a9e('0x73')](function(_0x248a9a){_0x5cb48d(_0x248a9a);});})[_0x0a9e('0x73')](function(_0x4cee8c){ut[_0x0a9e('0x5c')](_0x0a9e('0x112'),_0x4cee8c);_0x5cb48d(ut[_0x0a9e('0x4c')]('Call\x20unsuccessful',_0x4f854b,_0x382687));});}else{_0x5cb48d(ut[_0x0a9e('0x4c')](_0x4d99a8[_0x0a9e('0x4c')],_0x4f854b,_0x382687));}})[_0x0a9e('0x73')](function(_0x549e03){ut['logger']('[Preview][getContactPreview]',_0x549e03);_0x5cb48d(ut[_0x0a9e('0x4c')](_0x0a9e('0x113'),![],!![]));});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x10f')]=function(_0x5d83fd){if(_[_0x0a9e('0x67')](_0x5d83fd)||_['isEmpty'](_0x5d83fd)||!_[_0x0a9e('0x67')](_0x5d83fd[0x0][_0x0a9e('0x7f')])&&_[_0x0a9e('0x67')](_0x5d83fd[0x0]['Agent'][_0x0a9e('0x26')])){ut[_0x0a9e('0x5c')](_0x0a9e('0x114'),_0x5d83fd);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x40eb5d=this['campaignsPreview'][_0x5d83fd[0x0][_0x0a9e('0x69')]['name']];_0x40eb5d[_0x0a9e('0x4c')]='ACTIVE';if(_[_0x0a9e('0x67')](_0x40eb5d)){ut[_0x0a9e('0x5c')](_0x0a9e('0x115'),_0x40eb5d);return{'isValid':![],'message':_0x0a9e('0x116')};}if(!this[_0x0a9e('0x92')](_0x40eb5d[_0x0a9e('0x53')])){ut[_0x0a9e('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x0a9e('0x117')+_0x40eb5d[_0x0a9e('0x26')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x0a9e('0x92')](_0x40eb5d[_0x0a9e('0x93')])){ut['logger'](_0x0a9e('0x118'),_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x119'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x0a9e('0x90')](_0x40eb5d[_0x0a9e('0x32')])){ut[_0x0a9e('0x5c')](_0x0a9e('0x11a'),_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x11b'));return{'isValid':![],'message':_0x0a9e('0x117')+_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x11b')};}return{'isValid':!![],'message':_0x0a9e('0x11c')};};Preview['prototype'][_0x0a9e('0xf8')]=function(_0x53c7de,_0x3c9854,_0x2968e2,_0x5b9c76){var _0x315e31=this;return new BPromise(function(_0x5d577b,_0x2d45db){var _0x5691ac=_0x53c7de[_0x0a9e('0xaa')];var _0x469035=_0x315e31[_0x0a9e('0x92')](_0x3c9854['Trunk'])?util[_0x0a9e('0x106')](_0x0a9e('0x11d'),_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x26')],_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x35')])?'':_0x3c9854[_0x0a9e('0x35')]['trim']()||'',_0x3c9854[_0x0a9e('0x11e')]>0x0?_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')][_0x0a9e('0x120')](_0x3c9854[_0x0a9e('0x11e')]):_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')]):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x93')])?_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x26')]:_0x3c9854[_0x0a9e('0x93')][_0x0a9e('0x26')],_[_0x0a9e('0x67')](_0x3c9854['dialPrefix'])?'':_0x3c9854[_0x0a9e('0x35')][_0x0a9e('0x121')]()||'',_0x3c9854[_0x0a9e('0x11e')]>0x0?_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')][_0x0a9e('0x120')](_0x3c9854[_0x0a9e('0x11e')]):_0x2968e2['Contact'][_0x0a9e('0xf4')]);var _0x294310=_0x315e31[_0x0a9e('0x92')](_0x3c9854['Trunk'])?ut[_0x0a9e('0x122')](_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x123')],_0x3c9854[_0x0a9e('0x124')],_0x3c9854['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0a9e('0x125')](_0x3c9854[_0x0a9e('0x34')],_0x3c9854[_0x0a9e('0x126')]):_0x3c9854[_0x0a9e('0x34')]):ut[_0x0a9e('0x122')](_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x93')])?_0x3c9854[_0x0a9e('0x53')]['callerid']:_0x3c9854[_0x0a9e('0x93')][_0x0a9e('0x123')],_0x3c9854[_0x0a9e('0x124')],_0x3c9854[_0x0a9e('0x126')]>0x0?ut['getCallerIdRandom'](_0x3c9854['dialOriginateCallerIdNumber'],_0x3c9854[_0x0a9e('0x126')]):_0x3c9854[_0x0a9e('0x34')]);if(_0x294310){_0x53c7de[_0x0a9e('0x127')]=ut['extractCalleridName'](_0x294310);_0x53c7de[_0x0a9e('0x128')]=ut[_0x0a9e('0x129')](_0x294310);}var _0x4d8a67=ut[_0x0a9e('0x12a')](_0x3c9854,_0x2968e2,_0x469035,_0x294310,_0x5691ac,_0x53c7de);_['merge'](_0x53c7de,ut[_0x0a9e('0x12b')](_0x4d8a67));_0x53c7de['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0a9e('0x70')](ut[_0x0a9e('0x12c')](_0x53c7de,_0x3c9854,_0x4d8a67,_0x53c7de[_0x0a9e('0xa4')],_0x5b9c76))[_0x0a9e('0x81')](function(_0x7d59a9){_0x3c9854[_0x0a9e('0x4d')]+=0x1;logger['info'](_0x0a9e('0x12d'),_0x5691ac,_0x0a9e('0x12e'),_0x3c9854[_0x0a9e('0x26')],_0x0a9e('0xe6'),_0x3c9854[_0x0a9e('0x4d')]);_0x5d577b(_0x7d59a9);})[_0x0a9e('0x73')](function(_0x31c937){ut['logAgent'](_0x53c7de,0xe,'OriginateError');rpcDb[_0x0a9e('0xee')](_0x53c7de,'[originateFailure][logOriginateFailure]');_0x2d45db(_0x31c937);});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x1c')]=function(_0x1f0318){if(this[_0x0a9e('0x12')][_0x1f0318[_0x0a9e('0xa5')]]){this[_0x0a9e('0x12')][_0x1f0318['linkedid']][_0x0a9e('0x72')]=_0x1f0318['channel'];}};Preview['prototype'][_0x0a9e('0x16')]=function(_0x593f9e){var _0x38dceb=this;var _0x5dc978=this['actions'][_0x593f9e[_0x0a9e('0x12f')]];if(_0x5dc978){if(_0x5dc978['lookAgent']&&this[_0x0a9e('0x13')][_0x5dc978[_0x0a9e('0xf6')]]){ut[_0x0a9e('0x130')](_0x5dc978,this['agents'][_0x5dc978[_0x0a9e('0xf6')]][_0x0a9e('0x26')],this[_0x0a9e('0x13')][_0x5dc978['lookAgent']]['id']);}var _0x5236c9=_[_0x0a9e('0x131')](_0x5dc978);_0x5236c9[_0x0a9e('0xa7')]=moment()[_0x0a9e('0x106')](_0x0a9e('0x85'));var _0x3b0db2=_0x38dceb[_0x0a9e('0xf')][_0x5dc978[_0x0a9e('0x6a')]];if(ut[_0x0a9e('0x132')](_0x593f9e[_0x0a9e('0x133')])){if(_0x5dc978[_0x0a9e('0xa3')]){rpcDb['unlockContact'](_0x5dc978['idContact']);}if(_0x5dc978['activeContact']){rpcDb[_0x0a9e('0x10d')](_0x5dc978[_0x0a9e('0xfb')]);}ami[_0x0a9e('0x24')](_0x0a9e('0x134'),ut[_0x0a9e('0xac')](_0x5dc978,_0x0a9e('0x135'),this[_0x0a9e('0xf')][_0x5dc978[_0x0a9e('0x6a')]]));this['callProgressDetectingAgent'](_0x5236c9,_0x3b0db2,_0x593f9e);}else{_0x5dc978['starttime']=moment()[_0x0a9e('0x106')](_0x0a9e('0x85'));ut['logAgent'](_0x5236c9,0x4,_0x0a9e('0x136'));rpcDb[_0x0a9e('0xee')](_0x5236c9,_0x0a9e('0x137'));}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x19')]=function(_0x2683ad){var _0x167196=this;var _0x262281=this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]];var _0xbd1af3;if(_0x262281){_0xbd1af3=this[_0x0a9e('0xf')][_0x262281['queue']];logger[_0x0a9e('0x56')](_0x0a9e('0x138'),_0x2683ad[_0x0a9e('0xa5')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);}if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]]&&_0x2683ad[_0x0a9e('0xa5')]!==_0x2683ad[_0x0a9e('0xaa')]){if(_0x2683ad[_0x0a9e('0x139')]==='16'&&this['actions'][_0x2683ad['linkedid']][_0x0a9e('0x76')]){this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}else if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){logger['info'](_0x0a9e('0x13b'),_0x2683ad['linkedid'],_0x2683ad[_0x0a9e('0x139')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}}else if(_0x262281&&_[_0x0a9e('0x67')](_0x262281[_0x0a9e('0x13c')])&&_0xbd1af3[_0x0a9e('0x13d')]&&_0x2683ad[_0x0a9e('0xa5')]===_0x2683ad[_0x0a9e('0xaa')]&&_[_0x0a9e('0x67')](_0x2683ad[_0x0a9e('0xea')])&&_0x2683ad[_0x0a9e('0x139')]==='16'&&_0x2683ad['channelstate']==='6'&&_['isUndefined'](_0x262281[_0x0a9e('0x13e')])){if(_0x262281[_0x0a9e('0xa3')]){rpcDb['unlockContact'](_0x262281['idContact']);}if(_0x262281[_0x0a9e('0xa4')]){rpcDb[_0x0a9e('0x10d')](_0x262281[_0x0a9e('0xfb')]);}_0x2683ad['reason']='22';this[_0x0a9e('0x13f')](_0x262281,_0xbd1af3,_0x2683ad);}else if(_0x262281&&_0x262281['transfer']){if(_0x2683ad[_0x0a9e('0x139')]==='16'&&this['actions'][_0x2683ad[_0x0a9e('0xa5')]]['dialAnswer']){logger[_0x0a9e('0x56')](_0x0a9e('0x140'),_0x2683ad[_0x0a9e('0xa5')],_0x2683ad['cause'],_0x0a9e('0x12e'),_0xbd1af3['name'],'pTalking:\x20',_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}else if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){logger[_0x0a9e('0x56')](_0x0a9e('0x13b'),_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}}};Preview[_0x0a9e('0xc')]['syncDialEnd']=function(_0x233e48){if(this[_0x0a9e('0x12')][_0x233e48[_0x0a9e('0xe7')]]&&_0x233e48[_0x0a9e('0xe7')]!==_0x233e48['destuniqueid']){this['callProgressDetectingCustomer'](_0x233e48,_0x233e48['destlinkedid'],_0x233e48[_0x0a9e('0xe2')]);}};Preview['prototype'][_0x0a9e('0x141')]=function(_0x1fafc2){if(this[_0x0a9e('0x12')][_0x1fafc2[_0x0a9e('0xa5')]]&&_0x1fafc2[_0x0a9e('0xa5')]!==_0x1fafc2[_0x0a9e('0xaa')]&&!this[_0x0a9e('0x12')][_0x1fafc2[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){if(_0x1fafc2[_0x0a9e('0x139')]==='1'){this['callProgressDetectingCustomer'](_0x1fafc2,_0x1fafc2[_0x0a9e('0xa5')],_0x1fafc2['cause']);}}};Preview[_0x0a9e('0xc')]['addVariable']=function(_0xf4de86,_0x2c5385,_0x216791){if(this['actions'][_0xf4de86]){if(_[_0x0a9e('0x67')](this[_0x0a9e('0x12')][_0xf4de86]['variables'])){this['actions'][_0xf4de86][_0x0a9e('0x142')]={};}this[_0x0a9e('0x12')][_0xf4de86][_0x0a9e('0x142')][_0x2c5385]=_0x216791;}};Preview['prototype']['syncVarSet']=function(_0x4869c1){try{if(!_[_0x0a9e('0x67')](_0x4869c1)){if(ut[_0x0a9e('0x143')](_[_0x0a9e('0x144')](_0x4869c1[_0x0a9e('0x145')])[0x0])){this[_0x0a9e('0x146')](_0x4869c1[_0x0a9e('0xaa')],_[_0x0a9e('0x144')](_0x4869c1[_0x0a9e('0x145')])[0x0],_0x4869c1[_0x0a9e('0x147')]);}}}catch(_0x18e38b){logger[_0x0a9e('0x148')](_0x0a9e('0x149'),util[_0x0a9e('0x14a')](_0x18e38b,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xc')][_0x0a9e('0x20')]=function(_0x1a74c4){if(_0x1a74c4){if(this[_0x0a9e('0x12')][_0x1a74c4[_0x0a9e('0x14b')]]){this['actions'][_0x1a74c4[_0x0a9e('0x14b')]][_0x0a9e('0x13e')]=!![];}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x22')]=function(_0x4790f7){if(_0x4790f7){if(this[_0x0a9e('0x12')][_0x4790f7['transfererlinkedid']]){this[_0x0a9e('0x12')][_0x4790f7[_0x0a9e('0x14c')]][_0x0a9e('0x13e')]=!![];}}};module[_0x0a9e('0x14d')]=Preview; \ No newline at end of file +var _0x34e8=['type','outbound','strategy','answered','loggedIn','pTalking','sumDuration','sumHoldTime','talking','unmanaged','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','voice:queue:%s','name','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice_queue_channel:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialActive','setMessage','recallMe','clearZombieChannel','actions','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','emit','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','Global','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','isNil','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','run','execRun','unlock','active','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','originated:\x20','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','responsetime','isFailure','response','unlockContact','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','callProgressDetectingCustomer','[syncHangup][talking][cause]','cause','dialQueueProject','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','exports','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34e8,0x12c));var _0x834e=function(_0x34bdde,_0x1dfaa0){_0x34bdde=_0x34bdde-0x0;var _0x4b1907=_0x34e8[_0x34bdde];return _0x4b1907;};'use strict';var util=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var uuid=require(_0x834e('0x3'));var moment=require('moment');var md5=require(_0x834e('0x4'));var Redis=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var loggerAction=require(_0x834e('0x7'))(_0x834e('0x9'));var ami=require('../ami');var rpcDb=require(_0x834e('0xa'));var Action=require('./action');var ut=require(_0x834e('0xb'));config[_0x834e('0xc')]=_[_0x834e('0xd')](config[_0x834e('0xc')],{'host':_0x834e('0xe'),'port':0x18eb});var io=require(_0x834e('0xf'))(new Redis(config[_0x834e('0xc')]));var Sequence=function(){};Sequence[_0x834e('0x10')][_0x834e('0x11')]=function(_0x186b3b){this[_0x834e('0x12')]=this[_0x834e('0x12')]?this[_0x834e('0x12')][_0x834e('0x13')](_0x186b3b):_0x186b3b();};function Preview(_0x293514){this[_0x834e('0x14')]=new Sequence();this[_0x834e('0x15')]=_0x293514['voiceQueues'];this[_0x834e('0x16')]=_0x293514[_0x834e('0x16')];this['actions']={};this[_0x834e('0x17')]=_0x293514[_0x834e('0x17')];this[_0x834e('0x18')]=0x0;ami['on'](_0x834e('0x19'),this['syncOriginateResponse'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1b'),this['syncHangup'][_0x834e('0x1a')](this));ami['on']('hanguprequest',this[_0x834e('0x1c')][_0x834e('0x1a')](this));ami['on']('dialend',this[_0x834e('0x1d')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1e'),this['syncNewExten'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1f'),this[_0x834e('0x20')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x21'),this[_0x834e('0x22')][_0x834e('0x1a')](this));ami['on']('blindtransfer',this[_0x834e('0x23')][_0x834e('0x1a')](this));this[_0x834e('0x24')](this[_0x834e('0x15')]);}function emit(_0x4ab05d,_0x45a630,_0x62f8f1){io['to'](_0x4ab05d)['emit'](_0x45a630,_0x62f8f1);}function emitCampaignPreview(_0x1b4bdf){if(_0x1b4bdf[_0x834e('0x25')]===_0x834e('0x26')){var _0x5c55ca={'id':_0x1b4bdf['id'],'name':_0x1b4bdf['name'],'strategy':_0x1b4bdf[_0x834e('0x27')],'answered':_0x1b4bdf[_0x834e('0x28')],'available':_0x1b4bdf['available'],'loggedIn':_0x1b4bdf[_0x834e('0x29')],'pTalking':_0x1b4bdf[_0x834e('0x2a')],'sumBillable':_0x1b4bdf['sumBillable'],'sumDuration':_0x1b4bdf[_0x834e('0x2b')],'sumHoldTime':_0x1b4bdf[_0x834e('0x2c')]||0x0,'talking':_0x1b4bdf[_0x834e('0x2d')],'total':_0x1b4bdf['total'],'type':_0x1b4bdf[_0x834e('0x25')],'unmanaged':_0x1b4bdf[_0x834e('0x2e')],'abandoned':_0x1b4bdf['abandoned'],'waiting':_0x1b4bdf['waiting'],'loggedInDb':_0x1b4bdf[_0x834e('0x2f')],'dialActive':_0x1b4bdf['dialActive'],'dialMethod':_0x1b4bdf[_0x834e('0x30')],'dialOriginateCallerIdName':_0x1b4bdf[_0x834e('0x31')],'dialOriginateCallerIdNumber':_0x1b4bdf[_0x834e('0x32')],'dialOriginateTimeout':_0x1b4bdf[_0x834e('0x33')],'dialPrefix':_0x1b4bdf[_0x834e('0x34')],'outboundAnswerAgiCallsDay':_0x1b4bdf[_0x834e('0x35')],'outboundAnswerCallsDay':_0x1b4bdf['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x1b4bdf['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1b4bdf['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1b4bdf['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1b4bdf[_0x834e('0x36')],'outboundDropCallsDayCallersExit':_0x1b4bdf[_0x834e('0x37')],'outboundDropCallsDayTimeout':_0x1b4bdf[_0x834e('0x38')],'outboundNoAnswerCallsDay':_0x1b4bdf['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1b4bdf[_0x834e('0x39')],'outboundOriginateFailureCallsDay':_0x1b4bdf[_0x834e('0x3a')],'outboundReCallsDay':_0x1b4bdf[_0x834e('0x3b')],'outboundRejectCallsDay':_0x1b4bdf[_0x834e('0x3c')],'outboundUnknownCallsDay':_0x1b4bdf[_0x834e('0x3d')],'outboundAbandonedCallsDay':_0x1b4bdf[_0x834e('0x3e')],'predictiveIntervalAnsweredCalls':_0x1b4bdf[_0x834e('0x3f')],'predictiveIntervalAvgHoldtime':_0x1b4bdf[_0x834e('0x40')],'predictiveIntervalAvgTalktime':_0x1b4bdf[_0x834e('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x1b4bdf['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1b4bdf[_0x834e('0x42')],'predictiveIntervalErlangCalls':_0x1b4bdf['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1b4bdf[_0x834e('0x43')],'predictiveIntervalHitRate':_0x1b4bdf[_0x834e('0x44')],'predictiveIntervalMultiplicativeFactor':_0x1b4bdf[_0x834e('0x45')],'predictiveIntervalPauses':_0x1b4bdf[_0x834e('0x46')],'predictiveIntervalAvailable':_0x1b4bdf[_0x834e('0x47')],'predictiveIntervalTotalCalls':_0x1b4bdf[_0x834e('0x48')],'message':_0x1b4bdf[_0x834e('0x49')],'originated':_0x1b4bdf[_0x834e('0x4a')],'erlangCalls':_0x1b4bdf[_0x834e('0x4b')],'erlangCallToSecond':_0x1b4bdf[_0x834e('0x4c')],'erlangAbandonmentRate':_0x1b4bdf['erlangAbandonmentRate'],'erlangBusyFactor':_0x1b4bdf[_0x834e('0x4d')],'startPredictive':_0x1b4bdf[_0x834e('0x4e')],'startProgressive':_0x1b4bdf[_0x834e('0x4f')]};if(_0x1b4bdf[_0x834e('0x50')]){_0x5c55ca['Trunk']={'id':_0x1b4bdf[_0x834e('0x50')]['id'],'name':_0x1b4bdf[_0x834e('0x50')]['name'],'active':_0x1b4bdf['Trunk']['active'],'callerid':_0x1b4bdf[_0x834e('0x50')][_0x834e('0x51')]};}if(_0x1b4bdf[_0x834e('0x52')]){_0x5c55ca[_0x834e('0x52')]={'id':_0x1b4bdf[_0x834e('0x52')]['id'],'name':_0x1b4bdf[_0x834e('0x52')]['name']};}var _0x2c2d94=md5(JSON['stringify'](_0x5c55ca));if(_0x1b4bdf[_0x834e('0x4')]!==_0x2c2d94){_0x1b4bdf[_0x834e('0x4')]=_0x2c2d94;emit(util['format'](_0x834e('0x53'),_0x5c55ca[_0x834e('0x54')]),'voice_queue:save',_0x5c55ca);}}}function emitVoiceQueueChannelRemove(_0x481f70){logger[_0x834e('0x55')](_0x834e('0x56'),JSON[_0x834e('0x57')](_0x481f70));emit(util[_0x834e('0x58')](_0x834e('0x53'),_0x481f70['name']),_0x834e('0x59'),_0x481f70);}function notSendMessagesQueue(_0x548d1d){if(_0x548d1d['sendMessageOneNotActive']){if(_0x548d1d[_0x834e('0x4a')]===0x0&&_0x548d1d['pTalking']===0x0){_0x548d1d[_0x834e('0x5a')]=![];_0x548d1d[_0x834e('0x5b')]=0x0;_0x548d1d[_0x834e('0x5c')]=0x0;_0x548d1d[_0x834e('0x49')]=_0x834e('0x5d');ut['logger'](_0x834e('0x5e'),_0x548d1d[_0x834e('0x54')]+_0x834e('0x5f'));}else{_0x548d1d['message']=_0x834e('0x60');ut[_0x834e('0x61')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x548d1d[_0x834e('0x54')]+'\x20is\x20disactive');}emitCampaignPreview(_0x548d1d);}}Preview[_0x834e('0x10')][_0x834e('0x24')]=function(){var _0x4a18bb=this;setInterval(function(){_0x4a18bb['syncCampaigns']();},0x7cf);};Preview[_0x834e('0x10')][_0x834e('0x62')]=function(){var _0x3bcbf4=this[_0x834e('0x15')];this[_0x834e('0x18')]+=0x1;for(var _0x23feea in _0x3bcbf4){if(_0x3bcbf4[_0x834e('0x63')](_0x23feea)&&(_0x3bcbf4[_0x23feea]['dialMethod']===_0x834e('0x8')||_0x3bcbf4[_0x23feea]['dialMethod']===_0x834e('0x64'))&&_0x3bcbf4[_0x23feea]['type']===_0x834e('0x26')){if(this['clockClearZombieChannels']>0x7){this[_0x834e('0x18')]=0x0;this[_0x834e('0x65')]();}}if(_0x3bcbf4['hasOwnProperty'](_0x23feea)&&_0x3bcbf4[_0x23feea][_0x834e('0x30')]===_0x834e('0x8')&&_0x3bcbf4[_0x23feea][_0x834e('0x25')]===_0x834e('0x26')){if(_0x3bcbf4[_0x23feea][_0x834e('0x66')]){this[_0x834e('0x67')](_0x3bcbf4[_0x23feea]);this[_0x834e('0x68')](_0x3bcbf4[_0x23feea]);}else{notSendMessagesQueue(_0x3bcbf4[_0x23feea]);}}}};Preview[_0x834e('0x10')][_0x834e('0x69')]=function(_0x279ea1){var _0x5f3943=this;this[_0x834e('0x14')][_0x834e('0x11')](function(){if(!_['isNil'](_0x5f3943[_0x834e('0x6a')][_0x279ea1])){loggerAction[_0x834e('0x55')](_0x834e('0x6b'),_0x279ea1,_0x834e('0x6c'),_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')],'originated:\x20',JSON['stringify'](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]][_0x834e('0x4a')]),_0x834e('0x6e'),JSON[_0x834e('0x57')](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]][_0x834e('0x2a')]),JSON[_0x834e('0x57')](_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6f')]),JSON[_0x834e('0x57')](_[_0x834e('0x70')](_0x5f3943[_0x834e('0x6a')][_0x279ea1],[_0x834e('0x71'),_0x834e('0x72'),_0x834e('0x73'),_0x834e('0x74')])));return ami['Action']({'action':_0x834e('0x75'),'channel':_0x5f3943[_0x834e('0x6a')][_0x279ea1]['channel']})[_0x834e('0x76')](function(_0x3b0988){if(_0x3b0988['message']===_0x834e('0x77')){setTimeout(function(){if(_0x5f3943[_0x834e('0x6a')][_0x279ea1]){ut[_0x834e('0x78')](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]],_0x834e('0x79'));if(_0x5f3943['actions'][_0x279ea1][_0x834e('0x6f')]===!![]){ut[_0x834e('0x7a')](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]],_0x834e('0x79'));ut[_0x834e('0x7b')](_0x834e('0x7c')+_0x279ea1,_0x5f3943['actions'][_0x279ea1][_0x834e('0x6d')]);}ut['loggerError'](_0x834e('0x7d')+_0x279ea1,_0x5f3943['actions'][_0x279ea1][_0x834e('0x6d')]);delete _0x5f3943['actions'][_0x279ea1];}},0x2328);}});}});};Preview['prototype'][_0x834e('0x65')]=function(){var _0x3e1bee=this;loggerAction['info']('[action]',_[_0x834e('0x7e')](this[_0x834e('0x6a')]));for(var _0x138ed2 in this[_0x834e('0x6a')]){if(_0x3e1bee[_0x834e('0x6a')][_0x834e('0x63')](_0x138ed2)){_0x3e1bee[_0x834e('0x69')](_0x138ed2);}}};Preview[_0x834e('0x10')]['recallMe']=function(_0x142334){var _0x3c70bf=this;rpcDb['getContactRecallMe'](_0x142334['id'],ut[_0x834e('0x7f')](this['agents']))[_0x834e('0x80')](function(_0x45eceb){if(!_['isNil'](_0x45eceb)){for(var _0x41ef86=0x0;_0x41ef86<_0x45eceb[_0x834e('0x81')];_0x41ef86+=0x1){if(ut[_0x834e('0x82')](_0x45eceb[_0x41ef86][_0x834e('0x83')])<_0x142334['dialRecallMeTimeout']*0x3c){if(_0x45eceb[_0x41ef86][_0x834e('0x84')]&&!_0x45eceb[_0x41ef86][_0x834e('0x84')][_0x834e('0x85')]){_0x3c70bf['run'](_0x45eceb[_0x41ef86]['id'])[_0x834e('0x80')](ut[_0x834e('0x86')](_0x834e('0x87')))[_0x834e('0x76')](ut[_0x834e('0x86')](_0x834e('0x87')));}else{rpcDb[_0x834e('0x88')](_0x45eceb[_0x41ef86]['id']);}}else{var _0x1def00=new Action(_0x45eceb[_0x41ef86],_0x142334);_0x1def00[_0x834e('0x89')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));_0x142334[_0x834e('0x3b')]+=0x1;ut[_0x834e('0x8b')](_0x1def00,0x17,_0x834e('0x8c'));if(_0x142334[_0x834e('0x8d')]){rpcDb[_0x834e('0x8e')](ut[_0x834e('0x8f')](_0x45eceb[_0x41ef86]));rpcDb[_0x834e('0x90')](_0x1def00,_0x834e('0x91'));}else{ut[_0x834e('0x8b')](_0x1def00,0x16,_0x834e('0x92'));rpcDb[_0x834e('0x90')](_0x1def00,'[HistoryRecallClose]');rpcDb[_0x834e('0x93')](_0x1def00,_0x834e('0x94'));}}}}})[_0x834e('0x76')](ut[_0x834e('0x86')]('[getContactRecallMe]'));};Preview[_0x834e('0x10')]['setMessage']=function(_0x56a152){_0x56a152[_0x834e('0x5a')]=!![];if(ut[_0x834e('0x95')](_0x56a152[_0x834e('0x29')])){_0x56a152[_0x834e('0x49')]=_0x834e('0x96');}else if(!ut[_0x834e('0x97')](_0x56a152[_0x834e('0x66')])){_0x56a152[_0x834e('0x49')]='NOT_ACTIVE';}else if(!this[_0x834e('0x98')](_0x56a152['Trunk'])){if(!this[_0x834e('0x98')](_0x56a152[_0x834e('0x99')])){_0x56a152['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x56a152[_0x834e('0x49')]=_0x834e('0x9a');}}else{_0x56a152[_0x834e('0x49')]=_0x834e('0x9a');}emitCampaignPreview(_0x56a152);};Preview[_0x834e('0x10')]['callProgressDetectingCustomer']=function(_0x2b0d93,_0x15018f,_0x2df64f){var _0x228a60=this;var _0x3181af=this[_0x834e('0x6a')][_0x15018f];var _0x87818b=this[_0x834e('0x15')][_0x3181af[_0x834e('0x6d')]];var _0x324f67;if(_0x87818b){switch(_0x2df64f){case'1':_0x87818b['outboundNoSuchCallsDay']+=0x1;_0x3181af[_0x834e('0x9b')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x0,'NoSuchNumber');ami[_0x834e('0x9e')]('custom:agentnosuchnumber',ut['buildObj'](_0x3181af,'nosuchnumber'));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0x9f'));if(ut['totalGlobal'](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,'Global');rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xa2'));}else{if(_0x3181af['countnosuchnumberretry']>=_0x87818b['dialNoSuchNumberMaxRetry']){rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xa2'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0x9b'),_0x87818b['dialNoSuchNumberRetryFrequency']),_0x3181af[_0x834e('0xa5')],_0x3181af['activeContact']);}}delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xa6')]];break;case _0x834e('0xa7'):var _0x5afb41=moment()[_0x834e('0x58')](_0x834e('0x8a'));_0x3181af['responsetime']=_0x5afb41;_0x3181af[_0x834e('0xa8')]=_0x5afb41;_0x3181af[_0x834e('0x6f')]=!![];_0x87818b[_0x834e('0x2a')]+=0x1;logger['info'](_0x834e('0xa9'),_0x3181af[_0x834e('0xaa')],_0x834e('0xab'),_0x87818b[_0x834e('0x54')],_0x834e('0x6e'),_0x87818b[_0x834e('0x2a')]);ami[_0x834e('0x9e')](_0x834e('0xac'),ut[_0x834e('0xad')](_0x3181af,_0x834e('0xae'),this['campaignsPreview'][_0x3181af['queue']]));if(_0x87818b['acw']){ami[_0x834e('0x9e')](_0x834e('0xaf'),ut[_0x834e('0xb0')](_0x3181af));}break;case'16':ami[_0x834e('0x9e')](_0x834e('0xb1'),ut['buildObj'](_0x3181af,'complete',this[_0x834e('0x15')][_0x3181af[_0x834e('0x6d')]]));emitVoiceQueueChannelRemove(ut[_0x834e('0xad')](_0x3181af,_0x834e('0xb2')));_0x87818b[_0x834e('0xb3')]+=0x1;_0x87818b['total']+=0x1;_0x87818b[_0x834e('0x28')]+=0x1;ut[_0x834e('0x7a')](_0x87818b,_0x834e('0xb4'));_0x3181af['countglobal']=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x4,_0x834e('0xb5'));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xb6'));rpcDb['createCustomerFinal'](_0x3181af,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x834e('0xb7')](_0x3181af);_0x87818b[_0x834e('0x2b')]+=_0x3181af['talktime'];_0x87818b[_0x834e('0xb8')]+=_0x3181af['talktime'];logger[_0x834e('0x55')](_0x834e('0xb9'),_0x3181af[_0x834e('0xaa')],'\x20Queue',_0x87818b[_0x834e('0x54')],'pTalking:\x20',_0x87818b['pTalking']);delete this['actions'][_0x2b0d93[_0x834e('0xa6')]];break;case _0x834e('0xba'):_0x87818b[_0x834e('0xbb')]+=0x1;_0x3181af[_0x834e('0xbc')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x5,_0x834e('0xbd'));ami[_0x834e('0x9e')]('custom:agentbusy',ut[_0x834e('0xad')](_0x3181af,'busy'));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xbe'));if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb['createCustomerFinal'](_0x324f67,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x3181af[_0x834e('0xbc')]>=_0x87818b[_0x834e('0xc0')]){rpcDb['createCustomerFinal'](_0x3181af,_0x834e('0xbe'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xbc'),_0x87818b[_0x834e('0xc1')]),_0x3181af['unlockAgent'],_0x3181af[_0x834e('0xc2')]);}}break;case _0x834e('0xc3'):_0x87818b['outboundNoAnswerCallsDay']+=0x1;_0x3181af['countnoanswerretry']+=0x1;_0x3181af['countglobal']=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x3,'NoAnswer');ami[_0x834e('0x9e')](_0x834e('0xc4'),ut['buildObj'](_0x3181af,_0x834e('0xc5')));rpcDb['createCustomerHistory'](_0x3181af,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb['createCustomerFinal'](_0x324f67,_0x834e('0xc6'));}else{if(_0x3181af[_0x834e('0xc7')]>=_0x87818b[_0x834e('0xc8')]){rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xc9'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xc7'),_0x87818b[_0x834e('0xca')]),_0x3181af[_0x834e('0xa5')],_0x3181af[_0x834e('0xc2')]);}}break;case _0x834e('0xcb'):_0x87818b[_0x834e('0xcc')]+=0x1;_0x3181af[_0x834e('0xcd')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x8,_0x834e('0xce'));ami[_0x834e('0x9e')](_0x834e('0xcf'),ut[_0x834e('0xad')](_0x3181af,_0x834e('0xd0')));rpcDb['createCustomerHistory'](_0x3181af,_0x834e('0xd1'));if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xd2'));}else{if(_0x3181af[_0x834e('0xcd')]>=_0x87818b[_0x834e('0xd3')]){rpcDb['createCustomerFinal'](_0x3181af,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x834e('0xa4')](_0x3181af,'countcongestionretry',_0x87818b[_0x834e('0xc1')]),_0x3181af[_0x834e('0xa5')],_0x3181af[_0x834e('0xc2')]);}}break;case'CANCEL':_0x87818b[_0x834e('0x3c')]+=0x1;_0x3181af[_0x834e('0xd4')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x14,_0x834e('0xd5'));ami['emit'](_0x834e('0xd6'),ut[_0x834e('0xad')](_0x3181af,_0x834e('0xd7')));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xd8'));if(ut['totalGlobal'](_0x3181af)>=_0x87818b['dialGlobalMaxRetry']){_0x324f67=ut['cloneAction'](_0x3181af,0x14,'AgentReject');rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xd9'));}else{if(_0x3181af['countagentrejectretry']>=_0x87818b[_0x834e('0xda')]){rpcDb[_0x834e('0x93')](_0x3181af,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xd4'),_0x87818b[_0x834e('0xdb')]),_0x3181af[_0x834e('0xa5')],_0x3181af[_0x834e('0xc2')]);}}break;case'ABANDONED':_0x87818b['outboundAbandonedCallsDay']+=0x1;_0x3181af[_0x834e('0xdc')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut['logCustomer'](_0x3181af,0xb,_0x834e('0xdd'));rpcDb[_0x834e('0x90')](_0x3181af,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb['createCustomerFinal'](_0x324f67,_0x834e('0xde'));}else{if(_0x3181af['countabandonedetry']>=_0x87818b['dialAbandonedMaxRety']){rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xde'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xdc'),_0x87818b[_0x834e('0xdf')]),_0x3181af['unlockAgent'],_0x3181af['activeContact']);}}break;default:if(_0x3181af[_0x834e('0x6f')]){ut[_0x834e('0x7a')](_0x87818b,_0x834e('0xe0'));ut[_0x834e('0x7b')](_0x834e('0xe1')+_0x87818b[_0x834e('0x54')],_0x2b0d93);}_0x87818b[_0x834e('0x3d')]+=0x1;_0x3181af['countglobal']=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0xc,_0x2b0d93['cause-txt']||_0x2b0d93[_0x834e('0xe2')]);rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xe3'));if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xe4'));}else{rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xe4'));}delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xa6')]];}if(!(_0x3181af[_0x834e('0x6f')]&&_0x2df64f==='16')){ut['updateOriginated'](_0x87818b,_0x834e('0xe5'));logger[_0x834e('0x55')]('[originated][decrement][callProgressDetectingCustomer]',_0x3181af[_0x834e('0xaa')],'\x20Queue',_0x87818b[_0x834e('0x54')],'originated:\x20',_0x87818b[_0x834e('0x4a')]);}if(_0x2df64f!=='ANSWER'){delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xa6')]];delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xe6')]];}}};Preview['prototype'][_0x834e('0xe7')]=function(_0x38085e,_0x375fec,_0x2247f7){if(_[_0x834e('0xe8')](_0x375fec)&&_0x834e('0xe9')!==typeof _0x375fec){return;}if(_[_0x834e('0xe8')](_0x2247f7)&&_0x834e('0xe9')!==typeof _0x2247f7){return;}switch(_0x2247f7[_0x834e('0xea')]){case'0':ut[_0x834e('0xeb')](_0x38085e,0x0,_0x834e('0xec'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xee'));break;case'3':ut[_0x834e('0xeb')](_0x38085e,0x3,_0x834e('0xef'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf0'));break;case'5':ut['logAgent'](_0x38085e,0x5,'Busy');rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf1'));break;case'8':ut[_0x834e('0xeb')](_0x38085e,0x8,_0x834e('0xce'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf2'));break;case'22':ut[_0x834e('0xeb')](_0x38085e,0x16,_0x834e('0xf3'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf4'));break;default:ut[_0x834e('0xeb')](_0x38085e,0xc,_0x2247f7[_0x834e('0xea')]);rpcDb['createAgentHistory'](_0x38085e,_0x834e('0xf2'));}ut['updateOriginated'](_0x375fec,_0x834e('0xf5'));logger[_0x834e('0x55')](_0x834e('0xf6'),_0x38085e['uniqueid'],_0x834e('0xab'),_0x375fec[_0x834e('0x54')],'originated:\x20',_0x375fec['originated']);delete this[_0x834e('0x6a')][_0x38085e[_0x834e('0xaa')]];};Preview['prototype'][_0x834e('0xf7')]=function(_0x132edd,_0x4643d9,_0x135219,_0x170ec2,_0x5e6fff){var _0x4e7545=this;return new BPromise(function(_0x453e58,_0x5dd31e){if(_['isNil'](_0x4643d9)||_['isNil'](_0x4643d9[_0x834e('0xf8')])||_[_0x834e('0xf9')](_0x4643d9['Contact'][_0x834e('0xfa')])||_[_0x834e('0xf9')](_0x4643d9[_0x834e('0x73')])){_0x5dd31e(ut[_0x834e('0x49')]('Contact\x20is\x20undefined',_0x170ec2,_0x5e6fff));return;}var _0x1998ba=uuid['v4']();var _0x288eb1=_0x4e7545[_0x834e('0x15')][_0x4643d9['Queue'][_0x834e('0x54')]];var _0x5f3b7d=_0x135219?_0x4e7545[_0x834e('0x17')][_0x135219]['id']:undefined;_0x4e7545['actions'][_0x1998ba]=new Action(_0x4643d9,_0x288eb1,_0x1998ba,_0x135219,_0x5f3b7d);var _0x461420=_0x4e7545[_0x834e('0x6a')][_0x1998ba];_0x461420['unlockAgent']=_0x170ec2;_0x461420[_0x834e('0xc2')]=_0x5e6fff;_0x461420[_0x834e('0xfb')]=_0x135219;if(_[_0x834e('0xfc')](_0x132edd)){_0x4e7545[_0x834e('0xfd')](_0x461420,_0x288eb1,_0x4643d9,_0x135219)[_0x834e('0x80')](function(_0x24d77c){logger['info'](_0x834e('0xfe'),_0x834e('0xff')+_0x461420[_0x834e('0x6d')]+_0x834e('0x100')+_0x461420[_0x834e('0x101')],JSON[_0x834e('0x57')](_0x24d77c));ami['emit'](_0x834e('0x102'),ut['buildObj'](_0x461420,'called',_0x4e7545[_0x834e('0x15')][_0x461420['queue']]));_0x453e58(ut['message'](_0x834e('0x103')));})[_0x834e('0x76')](function(_0x257fed){ut[_0x834e('0x61')](_0x834e('0x104'),_0x257fed);_0x5dd31e(ut[_0x834e('0x49')](_0x834e('0x105'),_0x170ec2,_0x5e6fff));});}else{_0x288eb1[_0x834e('0x106')]+=0x1;ut[_0x834e('0x107')](_0x461420);rpcDb[_0x834e('0x108')](_0x461420,_0x834e('0x109'));delete _0x4e7545[_0x834e('0x6a')][_0x1998ba];_0x5dd31e(ut[_0x834e('0x49')](_0x834e('0x10a'),_0x170ec2,_0x5e6fff));}});};Preview['prototype'][_0x834e('0x98')]=function(_0x4874e1){return!_[_0x834e('0xf9')](_0x4874e1)&&!_[_0x834e('0xf9')](_0x4874e1[_0x834e('0x54')])&&!_[_0x834e('0xf9')](_0x4874e1['active'])&&_0x4874e1['active']&&!_[_0x834e('0xf9')](this[_0x834e('0x16')][util['format'](_0x834e('0x10b'),_0x4874e1[_0x834e('0x54')])])&&!_['isNil'](this[_0x834e('0x16')][util[_0x834e('0x58')](_0x834e('0x10b'),_0x4874e1[_0x834e('0x54')])]['status'])&&(this['trunks'][util['format']('SIP/%s',_0x4874e1[_0x834e('0x54')])][_0x834e('0x75')]==='reachable'||this[_0x834e('0x16')][util['format'](_0x834e('0x10b'),_0x4874e1[_0x834e('0x54')])][_0x834e('0x75')]===_0x834e('0x10c'));};Preview[_0x834e('0x10')][_0x834e('0x10d')]=function(_0x3c775f,_0x4fc61d){var _0x12a0f3=this;return new BPromise(function(_0x20d52f,_0x59ac23){_0x12a0f3[_0x834e('0x10e')](_0x3c775f,_0x4fc61d)[_0x834e('0x80')](function(_0x536f66){_0x20d52f(_['pick'](_0x536f66,['message']));})[_0x834e('0x76')](function(_0x19e17b){if(_0x19e17b[_0x834e('0x10f')]){rpcDb['unlockContact'](_0x3c775f);}if(_0x19e17b[_0x834e('0x110')]){rpcDb[_0x834e('0x88')](_0x3c775f);}_0x59ac23(_[_0x834e('0x70')](_0x19e17b,[_0x834e('0x49')]));});});};Preview[_0x834e('0x10')][_0x834e('0x10e')]=function(_0x19cb0b,_0x13af70){var _0x8804a8=this;return new BPromise(function(_0x102640,_0x48b6c4){var _0x5d6b66,_0x117e8f;rpcDb[_0x834e('0x111')](_0x19cb0b)[_0x834e('0x80')](function(_0x3eda93){if(!_[_0x834e('0xf9')](_0x3eda93[0x0])){_0x117e8f=_0x3eda93[0x0][_0x834e('0x112')]?![]:!![];_0x5d6b66=_0x3eda93[0x0][_0x834e('0x112')]?!![]:![];_0x5d6b66=_0x13af70?!![]:_0x5d6b66;}var _0x39210f=_0x8804a8[_0x834e('0x113')](_0x3eda93);if(_0x39210f[_0x834e('0x114')]){rpcDb[_0x834e('0x115')](_[_0x834e('0x70')](_0x3eda93[0x0],[_0x834e('0x73'),'Contact.phone']))[_0x834e('0x80')](function(_0x3b13be){_0x8804a8[_0x834e('0xf7')](_0x3b13be,_0x3eda93[0x0],_0x13af70,_0x117e8f,_0x5d6b66)[_0x834e('0x80')](function(_0x495697){_0x102640(_0x495697);})['catch'](function(_0x4e7c43){_0x48b6c4(_0x4e7c43);});})[_0x834e('0x76')](function(_0xf98fb4){ut[_0x834e('0x61')](_0x834e('0x116'),_0xf98fb4);_0x48b6c4(ut[_0x834e('0x49')](_0x834e('0x117'),_0x117e8f,_0x5d6b66));});}else{_0x48b6c4(ut[_0x834e('0x49')](_0x39210f[_0x834e('0x49')],_0x117e8f,_0x5d6b66));}})['catch'](function(_0x58ff66){ut['logger']('[Preview][getContactPreview]',_0x58ff66);_0x48b6c4(ut[_0x834e('0x49')](_0x834e('0x117'),![],!![]));});});};Preview[_0x834e('0x10')][_0x834e('0x113')]=function(_0x72f950){if(_[_0x834e('0xf9')](_0x72f950)||_[_0x834e('0xfc')](_0x72f950)||!_[_0x834e('0xf9')](_0x72f950[0x0][_0x834e('0x84')])&&_['isNil'](_0x72f950[0x0]['Agent']['name'])){ut['logger'](_0x834e('0x118'),_0x72f950);return{'isValid':![],'message':_0x834e('0x119')};}var _0x284183=this[_0x834e('0x15')][_0x72f950[0x0][_0x834e('0x6c')][_0x834e('0x54')]];_0x284183[_0x834e('0x49')]=_0x834e('0x9a');if(_[_0x834e('0xf9')](_0x284183)){ut[_0x834e('0x61')](_0x834e('0x11a'),_0x284183);return{'isValid':![],'message':_0x834e('0x11b')};}if(!this[_0x834e('0x98')](_0x284183[_0x834e('0x50')])){ut[_0x834e('0x61')](_0x834e('0x11c'),'campaign\x20Name:\x20'+_0x284183[_0x834e('0x54')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x834e('0x98')](_0x284183[_0x834e('0x99')])){ut[_0x834e('0x61')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x284183[_0x834e('0x54')]+_0x834e('0x11d'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x284183[_0x834e('0x66')])){ut[_0x834e('0x61')](_0x834e('0x11e'),_0x284183[_0x834e('0x54')]+_0x834e('0x11f'));return{'isValid':![],'message':_0x834e('0x120')+_0x284183[_0x834e('0x54')]+_0x834e('0x11f')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x834e('0x10')][_0x834e('0xfd')]=function(_0x375e40,_0x1d4947,_0x1912e6,_0x614e15){var _0x17aaae=this;return new BPromise(function(_0x58ebc8,_0x40a92a){var _0x59e298=_0x375e40['uniqueid'];var _0x1115b7=_0x17aaae[_0x834e('0x98')](_0x1d4947['Trunk'])?util[_0x834e('0x58')](_0x834e('0x121'),_0x1d4947['Trunk'][_0x834e('0x54')],_[_0x834e('0xf9')](_0x1d4947['dialPrefix'])?'':_0x1d4947['dialPrefix'][_0x834e('0x122')]()||'',_0x1d4947[_0x834e('0x123')]>0x0?_0x1912e6['Contact']['phone'][_0x834e('0x124')](_0x1d4947[_0x834e('0x123')]):_0x1912e6['Contact']['phone']):util['format']('SIP/%s/%s%s',_[_0x834e('0xf9')](_0x1d4947['TrunkBackup'])?_0x1d4947[_0x834e('0x50')]['name']:_0x1d4947[_0x834e('0x99')][_0x834e('0x54')],_[_0x834e('0xf9')](_0x1d4947[_0x834e('0x34')])?'':_0x1d4947['dialPrefix'][_0x834e('0x122')]()||'',_0x1d4947[_0x834e('0x123')]>0x0?_0x1912e6[_0x834e('0xf8')][_0x834e('0xfa')][_0x834e('0x124')](_0x1d4947[_0x834e('0x123')]):_0x1912e6[_0x834e('0xf8')][_0x834e('0xfa')]);var _0x464ae6=_0x17aaae[_0x834e('0x98')](_0x1d4947['Trunk'])?ut[_0x834e('0x125')](_0x1d4947['Trunk'][_0x834e('0x51')],_0x1d4947[_0x834e('0x31')],_0x1d4947[_0x834e('0x126')]>0x0?ut[_0x834e('0x127')](_0x1d4947[_0x834e('0x32')],_0x1d4947['dialRandomLastDigitCallerIdNumber']):_0x1d4947[_0x834e('0x32')]):ut['getCallerId'](_['isNil'](_0x1d4947[_0x834e('0x99')])?_0x1d4947[_0x834e('0x50')][_0x834e('0x51')]:_0x1d4947['TrunkBackup'][_0x834e('0x51')],_0x1d4947[_0x834e('0x31')],_0x1d4947[_0x834e('0x126')]>0x0?ut[_0x834e('0x127')](_0x1d4947[_0x834e('0x32')],_0x1d4947[_0x834e('0x126')]):_0x1d4947[_0x834e('0x32')]);if(_0x464ae6){_0x375e40[_0x834e('0x128')]=ut[_0x834e('0x129')](_0x464ae6);_0x375e40[_0x834e('0x12a')]=ut[_0x834e('0x12b')](_0x464ae6);}var _0x578204=ut[_0x834e('0x12c')](_0x1d4947,_0x1912e6,_0x1115b7,_0x464ae6,_0x59e298,_0x375e40);_[_0x834e('0x12d')](_0x375e40,ut[_0x834e('0x12e')](_0x578204));_0x375e40[_0x834e('0x89')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));ami['Action'](ut[_0x834e('0x12f')](_0x375e40,_0x1d4947,_0x578204,_0x375e40[_0x834e('0xc2')],_0x614e15))[_0x834e('0x80')](function(_0x37dea1){_0x1d4947[_0x834e('0x4a')]+=0x1;logger[_0x834e('0x55')](_0x834e('0x130'),_0x59e298,_0x834e('0xab'),_0x1d4947[_0x834e('0x54')],_0x834e('0x131'),_0x1d4947['originated']);_0x58ebc8(_0x37dea1);})['catch'](function(_0x5f339f){ut['logAgent'](_0x375e40,0xe,_0x834e('0x132'));rpcDb[_0x834e('0xed')](_0x375e40,_0x834e('0x133'));_0x40a92a(_0x5f339f);});});};Preview[_0x834e('0x10')][_0x834e('0x134')]=function(_0x1d53c6){if(this['actions'][_0x1d53c6[_0x834e('0xa6')]]){this['actions'][_0x1d53c6['linkedid']]['channel']=_0x1d53c6[_0x834e('0x135')];}};Preview[_0x834e('0x10')]['syncOriginateResponse']=function(_0x5cb379){var _0x494e08=this;var _0x2515f6=this[_0x834e('0x6a')][_0x5cb379[_0x834e('0x136')]];if(_0x2515f6){if(_0x2515f6['lookAgent']&&this[_0x834e('0x17')][_0x2515f6[_0x834e('0xfb')]]){ut[_0x834e('0x137')](_0x2515f6,this[_0x834e('0x17')][_0x2515f6[_0x834e('0xfb')]][_0x834e('0x54')],this['agents'][_0x2515f6['lookAgent']]['id']);}var _0x5c7fe3=_['clone'](_0x2515f6);_0x5c7fe3[_0x834e('0x138')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));var _0xfa95ad=_0x494e08[_0x834e('0x15')][_0x2515f6[_0x834e('0x6d')]];if(ut[_0x834e('0x139')](_0x5cb379[_0x834e('0x13a')])){if(_0x2515f6[_0x834e('0xa5')]){rpcDb[_0x834e('0x13b')](_0x2515f6[_0x834e('0x101')]);}if(_0x2515f6[_0x834e('0xc2')]){rpcDb[_0x834e('0x88')](_0x2515f6[_0x834e('0x101')]);}ami[_0x834e('0x9e')]('custom:agentringnoanswer',ut['buildObj'](_0x2515f6,_0x834e('0x13c'),this[_0x834e('0x15')][_0x2515f6[_0x834e('0x6d')]]));this['callProgressDetectingAgent'](_0x5c7fe3,_0xfa95ad,_0x5cb379);}else{_0x2515f6[_0x834e('0x89')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));ut[_0x834e('0xeb')](_0x5c7fe3,0x4,_0x834e('0xb5'));rpcDb[_0x834e('0xed')](_0x5c7fe3,_0x834e('0x13d'));}}};Preview[_0x834e('0x10')][_0x834e('0x13e')]=function(_0x53850c){var _0x1785ca=this;var _0x2e0674=this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]];var _0x4b6834;if(_0x2e0674){_0x4b6834=this[_0x834e('0x15')][_0x2e0674[_0x834e('0x6d')]];logger[_0x834e('0x55')](_0x834e('0x13f'),_0x53850c[_0x834e('0xa6')],_0x834e('0xab'),_0x4b6834[_0x834e('0x54')],_0x834e('0x6e'),_0x4b6834[_0x834e('0x2a')]);}if(this['actions'][_0x53850c[_0x834e('0xa6')]]&&_0x53850c['linkedid']!==_0x53850c[_0x834e('0xaa')]){if(_0x53850c['cause']==='16'&&this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]][_0x834e('0x6f')]){this[_0x834e('0x140')](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c['cause']);}else if(this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]]['dialAnswer']){logger['info'](_0x834e('0x141'),_0x53850c['linkedid'],_0x53850c['cause'],'\x20Queue',_0x4b6834[_0x834e('0x54')],_0x834e('0x6e'),_0x4b6834[_0x834e('0x2a')]);this[_0x834e('0x140')](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')]);}}else if(_0x2e0674&&_[_0x834e('0xf9')](_0x2e0674['statedesc'])&&_0x4b6834[_0x834e('0x143')]&&_0x53850c[_0x834e('0xa6')]===_0x53850c['uniqueid']&&_['isNil'](_0x53850c[_0x834e('0xea')])&&_0x53850c[_0x834e('0x142')]==='16'&&_0x53850c['channelstate']==='6'&&_['isUndefined'](_0x2e0674[_0x834e('0x144')])){if(_0x2e0674[_0x834e('0xa5')]){rpcDb[_0x834e('0x13b')](_0x2e0674['idContact']);}if(_0x2e0674[_0x834e('0xc2')]){rpcDb[_0x834e('0x88')](_0x2e0674[_0x834e('0x101')]);}_0x53850c['reason']='22';this[_0x834e('0xe7')](_0x2e0674,_0x4b6834,_0x53850c);}else if(_0x2e0674&&_0x2e0674['transfer']){if(_0x53850c[_0x834e('0x142')]==='16'&&this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]][_0x834e('0x6f')]){logger[_0x834e('0x55')]('[syncHangup][talking][transfer]',_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')],_0x834e('0xab'),_0x4b6834[_0x834e('0x54')],_0x834e('0x6e'),_0x4b6834['pTalking']);this['callProgressDetectingCustomer'](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')]);}else if(this[_0x834e('0x6a')][_0x53850c['linkedid']][_0x834e('0x6f')]){logger[_0x834e('0x55')](_0x834e('0x141'),_0x53850c[_0x834e('0xa6')],_0x53850c['cause'],_0x834e('0xab'),_0x4b6834[_0x834e('0x54')],'pTalking:\x20',_0x4b6834[_0x834e('0x2a')]);this[_0x834e('0x140')](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')]);}}};Preview['prototype'][_0x834e('0x1d')]=function(_0x52a673){if(this[_0x834e('0x6a')][_0x52a673[_0x834e('0xe6')]]&&_0x52a673[_0x834e('0xe6')]!==_0x52a673[_0x834e('0x145')]){this[_0x834e('0x140')](_0x52a673,_0x52a673[_0x834e('0xe6')],_0x52a673['dialstatus']);}};Preview['prototype'][_0x834e('0x1c')]=function(_0x3f2c59){if(this['actions'][_0x3f2c59[_0x834e('0xa6')]]&&_0x3f2c59['linkedid']!==_0x3f2c59[_0x834e('0xaa')]&&!this[_0x834e('0x6a')][_0x3f2c59[_0x834e('0xa6')]][_0x834e('0x6f')]){if(_0x3f2c59[_0x834e('0x142')]==='1'){this[_0x834e('0x140')](_0x3f2c59,_0x3f2c59[_0x834e('0xa6')],_0x3f2c59['cause']);}}};Preview[_0x834e('0x10')][_0x834e('0x146')]=function(_0x2a6bca,_0x223d48,_0x1c03bc){if(this['actions'][_0x2a6bca]){if(_[_0x834e('0xf9')](this[_0x834e('0x6a')][_0x2a6bca][_0x834e('0x147')])){this['actions'][_0x2a6bca]['variables']={};}this['actions'][_0x2a6bca][_0x834e('0x147')][_0x223d48]=_0x1c03bc;}};Preview[_0x834e('0x10')][_0x834e('0x20')]=function(_0xd6f2cc){try{if(!_[_0x834e('0xf9')](_0xd6f2cc)){if(ut[_0x834e('0x148')](_[_0x834e('0x149')](_0xd6f2cc[_0x834e('0x14a')])[0x0])){this[_0x834e('0x146')](_0xd6f2cc[_0x834e('0xaa')],_[_0x834e('0x149')](_0xd6f2cc['variable'])[0x0],_0xd6f2cc[_0x834e('0x14b')]);}}}catch(_0x3552b1){logger[_0x834e('0x14c')](_0x834e('0x14d'),util[_0x834e('0x14e')](_0x3552b1,{'showHidden':![],'depth':null}));}};Preview[_0x834e('0x10')][_0x834e('0x22')]=function(_0xa4bb26){if(_0xa4bb26){if(this['actions'][_0xa4bb26[_0x834e('0x14f')]]){this[_0x834e('0x6a')][_0xa4bb26['transfertargetlinkedid']][_0x834e('0x144')]=!![];}}};Preview[_0x834e('0x10')][_0x834e('0x23')]=function(_0x3fba1d){if(_0x3fba1d){if(this['actions'][_0x3fba1d['transfererlinkedid']]){this[_0x834e('0x6a')][_0x3fba1d['transfererlinkedid']][_0x834e('0x144')]=!![];}}};module[_0x834e('0x150')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index ea7adb4..8f1e8a6 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 _0xee14=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','unlockContact','[activeContact]\x20','type'];(function(_0x1ba721,_0x46c292){var _0x45fdab=function(_0x13a2a5){while(--_0x13a2a5){_0x1ba721['push'](_0x1ba721['shift']());}};_0x45fdab(++_0x46c292);}(_0xee14,0x13a));var _0x4ee1=function(_0x22fa25,_0x2cf805){_0x22fa25=_0x22fa25-0x0;var _0x3363e1=_0xee14[_0x22fa25];return _0x3363e1;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var _=require(_0x4ee1('0x2'));var cmHopper=require(_0x4ee1('0x3'));var cmHopperFinal=require(_0x4ee1('0x4'));var cmHopperHistory=require(_0x4ee1('0x5'));var cmHopperBlack=require(_0x4ee1('0x6'));var voiceQueueRt=require(_0x4ee1('0x7'));var agentReportPreview=require(_0x4ee1('0x8'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0xba6d36){return function(_0x573700){logger[_0x4ee1('0x9')](_0xba6d36,util[_0x4ee1('0xa')](_0x573700,{'showHidden':![],'depth':null}));};}function create(_0x187656){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopperHistory[_0x4ee1('0xd')](_0x187656))['catch'](loggerCatch(_0x4ee1('0xe')));}function createAgent(_0x38be25){return BPromise['resolve']()[_0x4ee1('0xc')](agentReportPreview[_0x4ee1('0xd')](_0x38be25))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0xe')));}function moveContact(_0x5cbcb0){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x10')](_0x5cbcb0,!![]))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x11')));}exports[_0x4ee1('0x12')]=function(_0x5616d6){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopperBlack[_0x4ee1('0x12')](_0x5616d6))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x13')));};exports[_0x4ee1('0x14')]=function(_0x2ffb2d){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper['getContactPreview'](_0x2ffb2d))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x15')));};exports[_0x4ee1('0xd')]=function(_0x1b1e0e,_0x123c5e){create(_0x1b1e0e)[_0x4ee1('0xf')](loggerCatch(_0x123c5e));moveContact(_0x1b1e0e)[_0x4ee1('0xf')](loggerCatch(_0x123c5e));};exports[_0x4ee1('0x16')]=function(_0x360056,_0x3a0967){createAgent(_0x360056)[_0x4ee1('0xf')](loggerCatch(_0x3a0967));};exports['createCustomerHistory']=function(_0x236215,_0x3db827){create(_0x236215)[_0x4ee1('0xf')](loggerCatch(_0x3db827));};exports[_0x4ee1('0x17')]=function(_0x43f9a2,_0x383ab0){moveContact(_0x43f9a2)['catch'](loggerCatch(_0x383ab0));};exports[_0x4ee1('0x18')]=function(_0x333e96,_0x46611a,_0x3f0d59){if(_0x46611a){_0x333e96[_0x4ee1('0x19')]=null;}if(_0x3f0d59){_0x333e96[_0x4ee1('0x1a')]=![];}return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x18')](_0x333e96))[_0x4ee1('0xf')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x14110c){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x1b')](_0x14110c))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x1c')));};exports['unlockContact']=function(_0x5cc0b5){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper['unlockContact']({'UserId':null},_0x5cc0b5,0x1))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x1d')));};exports[_0x4ee1('0x1e')]=function(_0x215949){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x1f')]({'active':![]},_0x215949,0x1))['catch'](loggerCatch(_0x4ee1('0x20')));};exports['crateCustomerReportQueue']=function(_0x4746c2){var _0x4ec408={};_0x4ec408[_0x4ee1('0x21')]=_0x4746c2[_0x4ee1('0x21')];_0x4ec408[_0x4ee1('0x22')]=_0x4746c2[_0x4ee1('0x22')];_0x4ec408[_0x4ee1('0x23')]=_0x4746c2['calleridnum'];_0x4ec408[_0x4ee1('0x24')]=_0x4746c2['calleridname'];_0x4ec408[_0x4ee1('0x25')]=_0x4746c2[_0x4ee1('0x25')];_0x4ec408[_0x4ee1('0x26')]=_0x4746c2[_0x4ee1('0x27')];_0x4ec408[_0x4ee1('0x28')]=_0x4746c2['answertime'];_0x4ec408[_0x4ee1('0x29')]=0x1;_0x4ec408[_0x4ee1('0x2a')]=_0x4746c2[_0x4ee1('0x2b')];_0x4ec408[_0x4ee1('0x2c')]=_0x4746c2[_0x4ee1('0x2d')];_0x4ec408[_0x4ee1('0x2e')]='from-sip';_0x4ec408['exten']=_0x4ee1('0x2f');_0x4ec408[_0x4ee1('0x30')]=0x0;_0x4ec408[_0x4ee1('0x31')]=0x1;_0x4ec408['lastAssignedTo']=_0x4746c2[_0x4ee1('0x2d')];_0x4ec408[_0x4ee1('0x32')]=_0x4ee1('0x33');return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](voiceQueueReport[_0x4ee1('0x34')](_0x4ec408))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x35')));};exports[_0x4ee1('0x36')]=function(_0x3cc595,_0x4445d0){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper['getContactRecallMe'](_0x3cc595,_0x4445d0))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x37')));};exports[_0x4ee1('0x38')]=function(_0x50539f){return BPromise['resolve']()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x18')](_0x50539f,!![],!![]))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x39')));}; \ No newline at end of file +var _0x1b20=['inspect','then','catch','[createHistory]\x20','resolve','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','holdtime','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error'];(function(_0x18c231,_0xb1d34b){var _0x4f6f32=function(_0x144f47){while(--_0x144f47){_0x18c231['push'](_0x18c231['shift']());}};_0x4f6f32(++_0xb1d34b);}(_0x1b20,0x66));var _0x01b2=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1b20[_0x502c7d];return _0x30b7ed;};'use strict';var util=require('util');var BPromise=require(_0x01b2('0x0'));var logger=require(_0x01b2('0x1'))('preview');var _=require('lodash');var cmHopper=require(_0x01b2('0x2'));var cmHopperFinal=require(_0x01b2('0x3'));var cmHopperHistory=require(_0x01b2('0x4'));var cmHopperBlack=require(_0x01b2('0x5'));var voiceQueueRt=require(_0x01b2('0x6'));var agentReportPreview=require(_0x01b2('0x7'));var voiceQueueReport=require(_0x01b2('0x8'));function loggerCatch(_0x28de4a){return function(_0x46e745){logger[_0x01b2('0x9')](_0x28de4a,util[_0x01b2('0xa')](_0x46e745,{'showHidden':![],'depth':null}));};}function create(_0x323470){return BPromise['resolve']()[_0x01b2('0xb')](cmHopperHistory['createHistory'](_0x323470))[_0x01b2('0xc')](loggerCatch(_0x01b2('0xd')));}function createAgent(_0x3bad99){return BPromise[_0x01b2('0xe')]()[_0x01b2('0xb')](agentReportPreview[_0x01b2('0xf')](_0x3bad99))[_0x01b2('0xc')](loggerCatch(_0x01b2('0xd')));}function moveContact(_0x55804c){return BPromise[_0x01b2('0xe')]()['then'](cmHopper[_0x01b2('0x10')](_0x55804c,!![]))['catch'](loggerCatch(_0x01b2('0x11')));}exports[_0x01b2('0x12')]=function(_0x2c6d4d){return BPromise[_0x01b2('0xe')]()['then'](cmHopperBlack[_0x01b2('0x12')](_0x2c6d4d))[_0x01b2('0xc')](loggerCatch(_0x01b2('0x13')));};exports[_0x01b2('0x14')]=function(_0x3bb071){return BPromise['resolve']()[_0x01b2('0xb')](cmHopper[_0x01b2('0x14')](_0x3bb071))[_0x01b2('0xc')](loggerCatch(_0x01b2('0x15')));};exports['createHistory']=function(_0x523b80,_0x2a8458){create(_0x523b80)[_0x01b2('0xc')](loggerCatch(_0x2a8458));moveContact(_0x523b80)['catch'](loggerCatch(_0x2a8458));};exports[_0x01b2('0x16')]=function(_0x444236,_0x27a0bc){createAgent(_0x444236)['catch'](loggerCatch(_0x27a0bc));};exports[_0x01b2('0x17')]=function(_0x9f182b,_0x38c4c8){create(_0x9f182b)[_0x01b2('0xc')](loggerCatch(_0x38c4c8));};exports[_0x01b2('0x18')]=function(_0x56ea3c,_0xfbd5db){moveContact(_0x56ea3c)['catch'](loggerCatch(_0xfbd5db));};exports[_0x01b2('0x19')]=function(_0x4c0008,_0x400f80,_0x266264){if(_0x400f80){_0x4c0008[_0x01b2('0x1a')]=null;}if(_0x266264){_0x4c0008['active']=![];}return BPromise[_0x01b2('0xe')]()[_0x01b2('0xb')](cmHopper[_0x01b2('0x19')](_0x4c0008))[_0x01b2('0xc')](loggerCatch(_0x01b2('0x1b')));};exports['countReScheduled']=function(_0x1874b9){return BPromise['resolve']()['then'](cmHopper[_0x01b2('0x1c')](_0x1874b9))[_0x01b2('0xc')](loggerCatch(_0x01b2('0x1d')));};exports[_0x01b2('0x1e')]=function(_0x2e32c1){return BPromise[_0x01b2('0xe')]()['then'](cmHopper[_0x01b2('0x1e')]({'UserId':null},_0x2e32c1,0x1))[_0x01b2('0xc')](loggerCatch(_0x01b2('0x1f')));};exports[_0x01b2('0x20')]=function(_0x54543b){return BPromise[_0x01b2('0xe')]()['then'](cmHopper[_0x01b2('0x1e')]({'active':![]},_0x54543b,0x1))[_0x01b2('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0x01b2('0x21')]=function(_0x5efdda){var _0x487c49={};_0x487c49[_0x01b2('0x22')]=_0x5efdda[_0x01b2('0x22')];_0x487c49['uniqueid']=_0x5efdda[_0x01b2('0x23')];_0x487c49[_0x01b2('0x24')]=_0x5efdda[_0x01b2('0x24')];_0x487c49[_0x01b2('0x25')]=_0x5efdda[_0x01b2('0x25')];_0x487c49[_0x01b2('0x26')]=_0x5efdda[_0x01b2('0x26')];_0x487c49[_0x01b2('0x27')]=_0x5efdda[_0x01b2('0x28')];_0x487c49[_0x01b2('0x29')]=_0x5efdda[_0x01b2('0x28')];_0x487c49['queuecallercomplete']=0x1;_0x487c49[_0x01b2('0x2a')]=_0x5efdda[_0x01b2('0x2b')];_0x487c49[_0x01b2('0x2c')]=_0x5efdda[_0x01b2('0x2d')];_0x487c49[_0x01b2('0x2e')]=_0x01b2('0x2f');_0x487c49['exten']='xcally-motion-preview';_0x487c49[_0x01b2('0x30')]=0x0;_0x487c49['assigned']=0x1;_0x487c49['lastAssignedTo']=_0x5efdda[_0x01b2('0x2d')];_0x487c49[_0x01b2('0x31')]=_0x01b2('0x32');return BPromise[_0x01b2('0xe')]()['then'](voiceQueueReport[_0x01b2('0x33')](_0x487c49))['catch'](loggerCatch(_0x01b2('0x34')));};exports['getContactRecallMe']=function(_0x5af6ff,_0x5e23dd){return BPromise[_0x01b2('0xe')]()[_0x01b2('0xb')](cmHopper[_0x01b2('0x35')](_0x5af6ff,_0x5e23dd))[_0x01b2('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x01b2('0x36')]=function(_0x2bd252){return BPromise['resolve']()[_0x01b2('0xb')](cmHopper[_0x01b2('0x19')](_0x2bd252,!![],!![]))[_0x01b2('0xc')](loggerCatch(_0x01b2('0x37')));}; \ 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 c978fc6..3b7acdb 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 _0x052a=['moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','error','info','loggerError','inspect','message','getCallerId','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isActive','addVariables','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','isNil','%s%s','XMD-','toUpper','Contact','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','endtime','logAgent','state','statedesc','ringtime','starttime','logLookAgent','membername','logCustomer','responsetime','talktime','answertime','variablesAction','RECALL','BOOKED','originate','from-sip','timeout','uniqueid','countagentrejectretry','cloneAction','clone','Global','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','mandatoryDisposition','buildAcw','queue','interface','channelAgent','agentReadyId','not_inuse','status','getDiff','createBody','CampaignId','filterKey','idContact','type','dialAnswer','active','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash'];(function(_0x30688c,_0x20adc7){var _0x574366=function(_0xbd61cc){while(--_0xbd61cc){_0x30688c['push'](_0x30688c['shift']());}};_0x574366(++_0x20adc7);}(_0x052a,0x8a));var _0xa052=function(_0x57d370,_0x3ed0f6){_0x57d370=_0x57d370-0x0;var _0x550fd2=_0x052a[_0x57d370];return _0x550fd2;};'use strict';var util=require(_0xa052('0x0'));var _=require(_0xa052('0x1'));var moment=require(_0xa052('0x2'));var logger=require(_0xa052('0x3'))(_0xa052('0x4'));var ipAgi=process[_0xa052('0x5')][_0xa052('0x6')]||'127.0.0.1';function getSeconds(_0x6e894f,_0x10f603){var _0x49b02d=moment(_0x6e894f)[_0xa052('0x7')](0x0);var _0x67602c=moment(_0x10f603)[_0xa052('0x7')](0x0);return _0x49b02d[_0xa052('0x8')](_0x67602c,_0xa052('0x9'));}exports[_0xa052('0xa')]=function(_0x3ef2de){return function(_0x4911c7){logger[_0xa052('0xb')](_0x3ef2de,util['inspect'](_0x4911c7,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5a94b9,_0xc837d8){logger[_0xa052('0xc')](_0x5a94b9,util['inspect'](_0xc837d8,{'showHidden':![],'depth':null}));};exports[_0xa052('0xd')]=function(_0x357e34,_0x43be99){logger[_0xa052('0xb')](_0x357e34,util[_0xa052('0xe')](_0x43be99,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3e18c7){return function(_0x80f129){logger[_0xa052('0xc')](_0x3e18c7,util[_0xa052('0xe')](_0x80f129,{'showHidden':![],'depth':null}));};};exports[_0xa052('0xf')]=function(_0x21fdae,_0x3013df,_0x1fbe2c){return{'message':_0x21fdae,'unlock':_0x3013df,'active':_0x1fbe2c};};exports[_0xa052('0x10')]=function(_0x23ff93,_0x2df484,_0x5c798c){if(!_[_0xa052('0x11')](_0x5c798c)&&_0xa052('0x12')===typeof _0x5c798c&&!_[_0xa052('0x13')](_0x5c798c)){if(!_[_0xa052('0x11')](_0x2df484)&&_0xa052('0x12')===typeof _0x2df484&&!_[_0xa052('0x13')](_0x2df484)){return util[_0xa052('0x14')]('\x22%s\x22\x20<%s>',_0x2df484,_0x5c798c);}return util['format']('\x22%s\x22\x20<%s>',_0x5c798c,_0x5c798c);}if(!_[_0xa052('0x11')](_0x23ff93)&&_0xa052('0x12')===typeof _0x23ff93&&!_[_0xa052('0x13')](_0x23ff93)){return _0x23ff93;}return _0xa052('0x15');};exports[_0xa052('0x16')]=function(_0xd23a5e){if(_['isNil'](_0xd23a5e)){return![];}return _0xd23a5e;};exports[_0xa052('0x17')]=function(_0x5325db,_0x5a6284,_0x1850b0,_0x4118af,_0x2801a0,_0x48024d){var _0x5549e1={'XMD-QUEUE':_0x5a6284[_0xa052('0x18')]?_0x5a6284[_0xa052('0x18')][_0xa052('0x19')]:'','XMD-CALLERID':_0x4118af,'XMD-CALLERID-PREVIEW':_0x48024d?util[_0xa052('0x14')](_0xa052('0x1a'),_0x48024d[_0xa052('0x1b')],_0x48024d[_0xa052('0x1c')]):_0x4118af,'XMD-DIALID':_0x2801a0,'XMD-CONTACTID':_0x5a6284['ContactId'],'XMD-CDRTYPE':_0xa052('0x1d'),'CALLERID(all)':_0x4118af,'XMD-VOICEQUEUEID':_0x5a6284[_0xa052('0x1e')],'XMD-DIALCHANNEL':_0x1850b0,'XMD-DIALTIMEOUT':_0x5325db['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xa052('0x14')](_0xa052('0x1f'),_0x5325db[_0xa052('0x20')]?'g':'',_[_0xa052('0x13')](_0x5325db[_0xa052('0x21')])?'':_0xa052('0x22')),'XMD-DIALURL':_0x5325db[_0xa052('0x23')]||'','XMD-AGI':_0x5325db['dialQueueProject']?util[_0xa052('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5325db['dialQueueProject']):_0xa052('0x24'),'XMD-AGIAFTER':_0x5325db[_0xa052('0x20')]?util[_0xa052('0x14')](_0xa052('0x25'),ipAgi,_0x5325db[_0xa052('0x20')]):_0xa052('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x48024d?_0x48024d[_0xa052('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x48024d?_0x48024d[_0xa052('0x27')]:'','XMD-DESTINATION':_0xa052('0x28')};if(!_[_0xa052('0x13')](_0x5325db[_0xa052('0x21')])){_0x5549e1[util[_0xa052('0x14')]('%s',_0xa052('0x29'))]=_0x5325db[_0xa052('0x21')];_0x5549e1[util[_0xa052('0x14')]('%s',_0xa052('0x2a'))]=_0x2801a0;}if(_0x5a6284&&_0x5a6284['Contact']){for(var _0x26e67a in _0x5a6284['Contact']){if(_0x5a6284['Contact'][_0xa052('0x2b')](_0x26e67a)){if(!_[_0xa052('0x2c')](_0x5a6284['Contact'][_0x26e67a])&&_0x26e67a!=='id'&&_0x26e67a!=='tags'&&_0x26e67a!=='createdAt'&&_0x26e67a!=='updatedAt'){_0x5549e1[util[_0xa052('0x14')](_0xa052('0x2d'),_0xa052('0x2e'),_[_0xa052('0x2f')](_0x26e67a))]=_0x5a6284[_0xa052('0x30')][_0x26e67a];}}}}return _0x5549e1;};exports[_0xa052('0x31')]=function(_0x20857e){var _0x340510={};for(var _0x4e5dcc in _0x20857e){if(_0x20857e[_0xa052('0x2b')](_0x4e5dcc)){_0x340510[util['format']('%s',_[_0xa052('0x32')](_0x4e5dcc))]=_0x20857e[_0x4e5dcc];}}return{'variables':_0x340510};};exports[_0xa052('0x33')]=function(_0x771b71,_0x2372fd){if(!_[_0xa052('0x2c')](_0x771b71)){if(_0x771b71[_0xa052('0x2b')](_0xa052('0x34'))){if(_0x771b71[_0xa052('0x34')]>0x0){_0x771b71['originated']-=0x1;}else{logger[_0xa052('0xb')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x2372fd);}}}else{logger[_0xa052('0xb')](_0xa052('0x35'),_0x2372fd);}};exports[_0xa052('0x36')]=function(_0xf31d0d){var _0x21e438=moment()[_0xa052('0x14')](_0xa052('0x37'));_0xf31d0d['state']=0xd;_0xf31d0d['statedesc']='Blacklist';_0xf31d0d['starttime']=_0x21e438;_0xf31d0d['responsetime']=_0x21e438;_0xf31d0d[_0xa052('0x38')]=_0x21e438;};exports[_0xa052('0x39')]=function(_0x7ca252,_0x241ef6,_0x2cdfe4){var _0x25e469=moment()[_0xa052('0x14')](_0xa052('0x37'));_0x7ca252[_0xa052('0x3a')]=_0x241ef6;_0x7ca252[_0xa052('0x3b')]=_0x2cdfe4;_0x7ca252['responsetime']=_0x25e469;_0x7ca252[_0xa052('0x3c')]=getSeconds(_0x7ca252['responsetime'],_0x7ca252[_0xa052('0x3d')]);};exports[_0xa052('0x3e')]=function(_0x3a74a9,_0x4cf906,_0x4b553d){_0x3a74a9[_0xa052('0x3f')]=_0x4cf906;_0x3a74a9['UserId']=_0x4b553d;};exports[_0xa052('0x40')]=function(_0x381875,_0x559f4b,_0x3bde68){var _0x51b5f0=moment()[_0xa052('0x14')](_0xa052('0x37'));_0x381875[_0xa052('0x3a')]=_0x559f4b;_0x381875[_0xa052('0x3b')]=_0x3bde68;_0x381875['responsetime']=_0x381875[_0xa052('0x41')]?_0x381875[_0xa052('0x41')]:_0x51b5f0;_0x381875[_0xa052('0x38')]=_0x381875['endtime']?_0x381875['endtime']:_0x51b5f0;_0x381875[_0xa052('0x3c')]=getSeconds(_0x381875['responsetime']||0x0,_0x381875[_0xa052('0x3d')]||0x0);_0x381875[_0xa052('0x42')]=_0x381875[_0xa052('0x43')]?getSeconds(_0x381875[_0xa052('0x38')],_0x381875[_0xa052('0x43')]):0x0;};exports['isFailure']=function(_0x161642){return _0x161642==='Failure';};exports[_0xa052('0x44')]=function(_0xf21d40,_0x24e53d,_0x1b8d1b,_0x2a3d8e,_0x1217de){var _0xcd7339=_0x2a3d8e?_0xa052('0x45'):_0xf21d40[_0xa052('0x1b')];_0xcd7339=_0x1217de?_0xa052('0x46'):_0xcd7339;return{'actionid':_0xf21d40['uniqueid'],'action':_0xa052('0x47'),'channel':_0xf21d40['channelAgent'],'callerid':util[_0xa052('0x14')](_0xa052('0x1a'),_0xcd7339,_0xf21d40[_0xa052('0x1c')]),'Exten':_0xa052('0x28'),'Context':_0xa052('0x48'),'Priority':'1','variable':_0x1b8d1b,'timeout':(_0x24e53d[_0xa052('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0xf21d40[_0xa052('0x4a')]};};exports['totalGlobal']=function(_0x37dfce){return _0x37dfce['countbusyretry']+_0x37dfce['countcongestionretry']+_0x37dfce['countnoanswerretry']+_0x37dfce[_0xa052('0x4b')]+_0x37dfce['countnosuchnumberretry'];};exports[_0xa052('0x4c')]=function(_0x19822e){var _0x485aa2=_[_0xa052('0x4d')](_0x19822e);_0x485aa2[_0xa052('0x3a')]=0xf;_0x485aa2[_0xa052('0x3b')]=_0xa052('0x4e');return _0x485aa2;};exports['scheduledAt']=function(_0x38a5eb,_0x3b610c,_0x29077a){var _0xacc14e={};_0xacc14e[_0x3b610c]=_0x38a5eb[_0x3b610c];_0xacc14e['active']=![];_0xacc14e[_0xa052('0x4f')]=moment()[_0xa052('0x50')](_0x29077a,_0xa052('0x51'))['format'](_0xa052('0x37'));_0xacc14e[_0xa052('0x52')]=_0x38a5eb[_0xa052('0x52')];_0xacc14e[_0xa052('0x53')]=_0x38a5eb['ListId'];_0xacc14e[_0xa052('0x1e')]=_0x38a5eb['VoiceQueueId']||undefined;return _0xacc14e;};exports[_0xa052('0x54')]=function(_0x2e44f7,_0xeab12){if(!_['isNil'](_0x2e44f7)){if(_0x2e44f7[_0xa052('0x55')]>0x0){_0x2e44f7['pTalking']-=0x1;}else{logger[_0xa052('0xb')](_0xeab12,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xa052('0xb')](_0xeab12,_0xa052('0x56'));}};exports[_0xa052('0x57')]=function(_0x1a5510){if(_0x1a5510<=0x0){return!![];}return![];};exports[_0xa052('0x58')]=function(_0x4c59a9,_0x14b8c0,_0x387160){_0x4c59a9['lastevent']=_0x14b8c0;_0x4c59a9[_0xa052('0x19')]=_0x4c59a9['queue'];_0x4c59a9['interface']=_0x4c59a9['channelAgent'];if(_0x387160){_0x4c59a9[_0xa052('0x59')]=_0x387160[_0xa052('0x59')];}return _0x4c59a9;};exports[_0xa052('0x5a')]=function(_0x4d296a){var _0x4981e4={};_0x4981e4['queue']=_0x4d296a[_0xa052('0x5b')];_0x4981e4[_0xa052('0x5c')]=_0x4d296a[_0xa052('0x5d')];_0x4981e4[_0xa052('0x4a')]=_0x4d296a[_0xa052('0x4a')];return _0x4981e4;};exports[_0xa052('0x5e')]=function(_0x420974){var _0x46fbad=[];for(var _0x5e4420 in _0x420974){if(_0x420974[_0xa052('0x2b')](_0x5e4420)){if(!_[_0xa052('0x2c')](_0x420974[_0x5e4420])&&_0x420974[_0x5e4420][_0xa052('0x3a')]===_0xa052('0x5f')&&_0x420974[_0x5e4420][_0xa052('0x60')]==='reachable'){_0x46fbad['push'](_0x420974[_0x5e4420]['id']);}}}return _0x46fbad;};exports[_0xa052('0x61')]=function(_0x13410f){var _0x3c93cc=moment()['milliseconds'](0x0);var _0x16685b=moment(_0x13410f)['milliseconds'](0x0);return _0x3c93cc['diff'](_0x16685b,'seconds');};exports[_0xa052('0x62')]=function(_0xb23b3e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xb23b3e[_0xa052('0x52')],'ListId':_0xb23b3e['ListId'],'VoiceQueueId':_0xb23b3e[_0xa052('0x1e')]||undefined,'CampaignId':_0xb23b3e[_0xa052('0x63')]||undefined};};exports[_0xa052('0x64')]=function(_0x8a5d85){if(_0x8a5d85===_0xa052('0x4a')||_0x8a5d85===_0xa052('0x65')||_0x8a5d85===_0xa052('0x5b')||_0x8a5d85===_0xa052('0x66')||_0x8a5d85==='campaigntype'||_0x8a5d85===_0xa052('0x67')||_0x8a5d85===_0xa052('0x3f')||_0x8a5d85==='channelAgent'||_0x8a5d85===_0xa052('0x1b')||_0x8a5d85===_0xa052('0x68')||_0x8a5d85==='calleridnum'||_0x8a5d85===_0xa052('0x4f')||_0x8a5d85===_0xa052('0x69')||_0x8a5d85===_0xa052('0x6a')||_0x8a5d85===_0xa052('0x6b')||_0x8a5d85===_0xa052('0x6c')||_0x8a5d85==='callback'||_0x8a5d85==='callbackuniqueid'||_0x8a5d85==='callbackat'||_0x8a5d85===_0xa052('0x6d')||_0x8a5d85==='ContactId'||_0x8a5d85==='ListId'||_0x8a5d85===_0xa052('0x6e')||_0x8a5d85===_0xa052('0x1e')||_0x8a5d85===_0xa052('0x6f')||_0x8a5d85===_0xa052('0x70')||_0x8a5d85===_0xa052('0x71')||_0x8a5d85===_0xa052('0x72')||_0x8a5d85==='xmd-listid'||_0x8a5d85===_0xa052('0x73')||_0x8a5d85==='xmd-dialtimeout'||_0x8a5d85===_0xa052('0x74')||_0x8a5d85===_0xa052('0x75')||_0x8a5d85===_0xa052('0x76')||_0x8a5d85===_0xa052('0x77')||_0x8a5d85===_0xa052('0x78')||_0x8a5d85===_0xa052('0x79')||_0x8a5d85===_0xa052('0x7a')||_0x8a5d85===_0xa052('0x7b')||_0x8a5d85===_0xa052('0x7c')||_0x8a5d85===_0xa052('0x7d')||_0x8a5d85==='rtpaudioqosjitter'||_0x8a5d85===_0xa052('0x7e')||_0x8a5d85==='rtpaudioqosloss'||_0x8a5d85===_0xa052('0x7f')||_0x8a5d85===_0xa052('0x80')||_0x8a5d85===_0xa052('0x81')||_0x8a5d85==='rtpaudioqos'||_0x8a5d85===_0xa052('0x7d')||_0x8a5d85==='rtpaudioqosjitter'||_0x8a5d85===_0xa052('0x7e')||_0x8a5d85===_0xa052('0x82')||_0x8a5d85===_0xa052('0x7f')||_0x8a5d85===_0xa052('0x80')||_0x8a5d85===_0xa052('0x81')||_0x8a5d85===_0xa052('0x83')||_0x8a5d85===_0xa052('0x84')||_0x8a5d85===_0xa052('0x3a')||_0x8a5d85==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x48bdb0,_0x475608){var _0x244660,_0x40c5bf,_0x4da1c1;if(_0x475608<=0x0){_0x475608=0x1;}_0x244660=new RegExp(_0xa052('0x85')+_0x475608+'}$');_0x40c5bf=Math[_0xa052('0x86')](0xa,_0x475608-0x1);_0x4da1c1=Math[_0xa052('0x86')](0xa,_0x475608)-0x1;return util[_0xa052('0x14')]('%s',_[_0xa052('0x87')](_0x48bdb0,_0x244660,_[_0xa052('0x88')](_0x40c5bf,_0x4da1c1)));};exports[_0xa052('0x89')]=function(_0x5ae352){var _0x4cd912=_0x5ae352[_0xa052('0x8a')](/"(.*?)"/);return _0x4cd912?_0x4cd912[0x1]:_0x5ae352;};exports[_0xa052('0x8b')]=function(_0xf7ca4f){var _0x19684d=_0xf7ca4f[_0xa052('0x8a')](/<(.*?)>/);return _0x19684d?_0x19684d[0x1]:_0xf7ca4f;}; \ No newline at end of file +var _0x0a3e=['xmd-queue','xmd-phone','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','inspect','loggerError','error','info','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','isNil','tags','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','responsetime','endtime','logAgent','state','ringtime','starttime','logLookAgent','membername','UserId','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callbackuniqueid','callbackat','recallme','sipcallid'];(function(_0xdb703c,_0x2feb75){var _0x31bb23=function(_0x4ae204){while(--_0x4ae204){_0xdb703c['push'](_0xdb703c['shift']());}};_0x31bb23(++_0x2feb75);}(_0x0a3e,0xa6));var _0xe0a3=function(_0xa77639,_0x5281ad){_0xa77639=_0xa77639-0x0;var _0x10c447=_0x0a3e[_0xa77639];return _0x10c447;};'use strict';var util=require(_0xe0a3('0x0'));var _=require(_0xe0a3('0x1'));var moment=require(_0xe0a3('0x2'));var logger=require(_0xe0a3('0x3'))('preview');var ipAgi=process[_0xe0a3('0x4')][_0xe0a3('0x5')]||_0xe0a3('0x6');function getSeconds(_0x488d65,_0x37c8c6){var _0x32c8df=moment(_0x488d65)[_0xe0a3('0x7')](0x0);var _0x2fde75=moment(_0x37c8c6)[_0xe0a3('0x7')](0x0);return _0x32c8df[_0xe0a3('0x8')](_0x2fde75,_0xe0a3('0x9'));}exports[_0xe0a3('0xa')]=function(_0x195c4d){return function(_0x5eb862){logger['error'](_0x195c4d,util[_0xe0a3('0xb')](_0x5eb862,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x290e13,_0x21a6fe){logger['info'](_0x290e13,util[_0xe0a3('0xb')](_0x21a6fe,{'showHidden':![],'depth':null}));};exports[_0xe0a3('0xc')]=function(_0x13f002,_0x3cc2bb){logger[_0xe0a3('0xd')](_0x13f002,util['inspect'](_0x3cc2bb,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x57b22b){return function(_0x345b66){logger[_0xe0a3('0xe')](_0x57b22b,util[_0xe0a3('0xb')](_0x345b66,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x263d41,_0xe56d19,_0x2de1c2){return{'message':_0x263d41,'unlock':_0xe56d19,'active':_0x2de1c2};};exports['getCallerId']=function(_0xe48f02,_0xf25971,_0x49650f){if(!_[_0xe0a3('0xf')](_0x49650f)&&_0xe0a3('0x10')===typeof _0x49650f&&!_[_0xe0a3('0x11')](_0x49650f)){if(!_[_0xe0a3('0xf')](_0xf25971)&&_0xe0a3('0x10')===typeof _0xf25971&&!_['isEmpty'](_0xf25971)){return util[_0xe0a3('0x12')](_0xe0a3('0x13'),_0xf25971,_0x49650f);}return util[_0xe0a3('0x12')](_0xe0a3('0x13'),_0x49650f,_0x49650f);}if(!_[_0xe0a3('0xf')](_0xe48f02)&&'string'===typeof _0xe48f02&&!_[_0xe0a3('0x11')](_0xe48f02)){return _0xe48f02;}return _0xe0a3('0x14');};exports[_0xe0a3('0x15')]=function(_0x45a811){if(_['isNil'](_0x45a811)){return![];}return _0x45a811;};exports[_0xe0a3('0x16')]=function(_0x16156a,_0x55f3e5,_0x2266cc,_0x1bfbe9,_0x46ad39,_0x5653a4){var _0x121996={'XMD-QUEUE':_0x55f3e5['Queue']?_0x55f3e5[_0xe0a3('0x17')][_0xe0a3('0x18')]:'','XMD-CALLERID':_0x1bfbe9,'XMD-CALLERID-PREVIEW':_0x5653a4?util[_0xe0a3('0x12')](_0xe0a3('0x13'),_0x5653a4[_0xe0a3('0x19')],_0x5653a4[_0xe0a3('0x1a')]):_0x1bfbe9,'XMD-DIALID':_0x46ad39,'XMD-CONTACTID':_0x55f3e5[_0xe0a3('0x1b')],'XMD-CDRTYPE':_0xe0a3('0x1c'),'CALLERID(all)':_0x1bfbe9,'XMD-VOICEQUEUEID':_0x55f3e5[_0xe0a3('0x1d')],'XMD-DIALCHANNEL':_0x2266cc,'XMD-DIALTIMEOUT':_0x16156a['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xe0a3('0x12')](_0xe0a3('0x1e'),_0x16156a[_0xe0a3('0x1f')]?'g':'',_[_0xe0a3('0x11')](_0x16156a[_0xe0a3('0x20')])?'':_0xe0a3('0x21')),'XMD-DIALURL':_0x16156a[_0xe0a3('0x22')]||'','XMD-AGI':_0x16156a[_0xe0a3('0x23')]?util[_0xe0a3('0x12')](_0xe0a3('0x24'),ipAgi,_0x16156a[_0xe0a3('0x23')]):_0xe0a3('0x25'),'XMD-AGIAFTER':_0x16156a[_0xe0a3('0x1f')]?util[_0xe0a3('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x16156a['dialQueueProject2']):_0xe0a3('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x5653a4?_0x5653a4[_0xe0a3('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x5653a4?_0x5653a4[_0xe0a3('0x27')]:'','XMD-DESTINATION':_0xe0a3('0x28')};if(!_['isEmpty'](_0x16156a['monitor_format'])){_0x121996[util[_0xe0a3('0x12')]('%s',_0xe0a3('0x29'))]=_0x16156a[_0xe0a3('0x20')];_0x121996[util[_0xe0a3('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x46ad39;}if(_0x55f3e5&&_0x55f3e5[_0xe0a3('0x2a')]){for(var _0x4c6f40 in _0x55f3e5[_0xe0a3('0x2a')]){if(_0x55f3e5[_0xe0a3('0x2a')]['hasOwnProperty'](_0x4c6f40)){if(!_[_0xe0a3('0x2b')](_0x55f3e5['Contact'][_0x4c6f40])&&_0x4c6f40!=='id'&&_0x4c6f40!==_0xe0a3('0x2c')&&_0x4c6f40!==_0xe0a3('0x2d')&&_0x4c6f40!==_0xe0a3('0x2e')){_0x121996[util[_0xe0a3('0x12')](_0xe0a3('0x2f'),_0xe0a3('0x30'),_['toUpper'](_0x4c6f40))]=_0x55f3e5['Contact'][_0x4c6f40];}}}}return _0x121996;};exports[_0xe0a3('0x31')]=function(_0x21eee4){var _0x548d79={};for(var _0x2af29d in _0x21eee4){if(_0x21eee4[_0xe0a3('0x32')](_0x2af29d)){_0x548d79[util[_0xe0a3('0x12')]('%s',_[_0xe0a3('0x33')](_0x2af29d))]=_0x21eee4[_0x2af29d];}}return{'variables':_0x548d79};};exports[_0xe0a3('0x34')]=function(_0x599889,_0x764905){if(!_[_0xe0a3('0x2b')](_0x599889)){if(_0x599889[_0xe0a3('0x32')]('originated')){if(_0x599889[_0xe0a3('0x35')]>0x0){_0x599889[_0xe0a3('0x35')]-=0x1;}else{logger[_0xe0a3('0xd')](_0xe0a3('0x36'),_0x764905);}}}else{logger[_0xe0a3('0xd')](_0xe0a3('0x37'),_0x764905);}};exports[_0xe0a3('0x38')]=function(_0x236601){var _0xb986fd=moment()[_0xe0a3('0x12')](_0xe0a3('0x39'));_0x236601['state']=0xd;_0x236601[_0xe0a3('0x3a')]=_0xe0a3('0x3b');_0x236601['starttime']=_0xb986fd;_0x236601[_0xe0a3('0x3c')]=_0xb986fd;_0x236601[_0xe0a3('0x3d')]=_0xb986fd;};exports[_0xe0a3('0x3e')]=function(_0x1a4eab,_0x497aa4,_0x32edc8){var _0x1ca3aa=moment()['format'](_0xe0a3('0x39'));_0x1a4eab[_0xe0a3('0x3f')]=_0x497aa4;_0x1a4eab[_0xe0a3('0x3a')]=_0x32edc8;_0x1a4eab[_0xe0a3('0x3c')]=_0x1ca3aa;_0x1a4eab[_0xe0a3('0x40')]=getSeconds(_0x1a4eab[_0xe0a3('0x3c')],_0x1a4eab[_0xe0a3('0x41')]);};exports[_0xe0a3('0x42')]=function(_0x212d0b,_0x3cab1d,_0x104a76){_0x212d0b[_0xe0a3('0x43')]=_0x3cab1d;_0x212d0b[_0xe0a3('0x44')]=_0x104a76;};exports['logCustomer']=function(_0x476a74,_0x3a5e0e,_0x3ed541){var _0x51c51a=moment()[_0xe0a3('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x476a74[_0xe0a3('0x3f')]=_0x3a5e0e;_0x476a74[_0xe0a3('0x3a')]=_0x3ed541;_0x476a74[_0xe0a3('0x3c')]=_0x476a74['responsetime']?_0x476a74[_0xe0a3('0x3c')]:_0x51c51a;_0x476a74['endtime']=_0x476a74[_0xe0a3('0x3d')]?_0x476a74[_0xe0a3('0x3d')]:_0x51c51a;_0x476a74[_0xe0a3('0x40')]=getSeconds(_0x476a74[_0xe0a3('0x3c')]||0x0,_0x476a74[_0xe0a3('0x41')]||0x0);_0x476a74[_0xe0a3('0x45')]=_0x476a74[_0xe0a3('0x46')]?getSeconds(_0x476a74[_0xe0a3('0x3d')],_0x476a74[_0xe0a3('0x46')]):0x0;};exports[_0xe0a3('0x47')]=function(_0xe6b611){return _0xe6b611===_0xe0a3('0x48');};exports['variablesAction']=function(_0x4e6ee8,_0x564250,_0x3702f8,_0xbaf7be,_0x3be6f1){var _0x30e27e=_0xbaf7be?_0xe0a3('0x49'):_0x4e6ee8[_0xe0a3('0x19')];_0x30e27e=_0x3be6f1?_0xe0a3('0x4a'):_0x30e27e;return{'actionid':_0x4e6ee8[_0xe0a3('0x4b')],'action':_0xe0a3('0x4c'),'channel':_0x4e6ee8[_0xe0a3('0x4d')],'callerid':util[_0xe0a3('0x12')](_0xe0a3('0x13'),_0x30e27e,_0x4e6ee8['calleridnum']),'Exten':_0xe0a3('0x28'),'Context':_0xe0a3('0x4e'),'Priority':'1','variable':_0x3702f8,'timeout':(_0x564250[_0xe0a3('0x4f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4e6ee8[_0xe0a3('0x4b')]};};exports[_0xe0a3('0x50')]=function(_0x8a96cd){return _0x8a96cd[_0xe0a3('0x51')]+_0x8a96cd[_0xe0a3('0x52')]+_0x8a96cd[_0xe0a3('0x53')]+_0x8a96cd[_0xe0a3('0x54')]+_0x8a96cd[_0xe0a3('0x55')];};exports['cloneAction']=function(_0x16484f){var _0x26f3af=_['clone'](_0x16484f);_0x26f3af[_0xe0a3('0x3f')]=0xf;_0x26f3af[_0xe0a3('0x3a')]=_0xe0a3('0x56');return _0x26f3af;};exports[_0xe0a3('0x57')]=function(_0x215ae3,_0x38fe9b,_0x93b87b){var _0x17b7a6={};_0x17b7a6[_0x38fe9b]=_0x215ae3[_0x38fe9b];_0x17b7a6[_0xe0a3('0x58')]=![];_0x17b7a6[_0xe0a3('0x59')]=moment()[_0xe0a3('0x5a')](_0x93b87b,'minutes')[_0xe0a3('0x12')](_0xe0a3('0x39'));_0x17b7a6[_0xe0a3('0x1b')]=_0x215ae3[_0xe0a3('0x1b')];_0x17b7a6[_0xe0a3('0x5b')]=_0x215ae3[_0xe0a3('0x5b')];_0x17b7a6[_0xe0a3('0x1d')]=_0x215ae3['VoiceQueueId']||undefined;return _0x17b7a6;};exports[_0xe0a3('0x5c')]=function(_0xc15b9,_0x44872b){if(!_['isNil'](_0xc15b9)){if(_0xc15b9['pTalking']>0x0){_0xc15b9['pTalking']-=0x1;}else{logger[_0xe0a3('0xd')](_0x44872b,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x44872b,_0xe0a3('0x5d'));}};exports[_0xe0a3('0x5e')]=function(_0x3c75d8){if(_0x3c75d8<=0x0){return!![];}return![];};exports[_0xe0a3('0x5f')]=function(_0x3de5e3,_0x2f0306,_0x3bf541){_0x3de5e3[_0xe0a3('0x60')]=_0x2f0306;_0x3de5e3[_0xe0a3('0x18')]=_0x3de5e3[_0xe0a3('0x61')];_0x3de5e3[_0xe0a3('0x62')]=_0x3de5e3[_0xe0a3('0x4d')];if(_0x3bf541){_0x3de5e3[_0xe0a3('0x63')]=_0x3bf541['mandatoryDisposition'];}return _0x3de5e3;};exports[_0xe0a3('0x64')]=function(_0x2140f1){var _0x23e6bd={};_0x23e6bd['queue']=_0x2140f1[_0xe0a3('0x61')];_0x23e6bd[_0xe0a3('0x62')]=_0x2140f1[_0xe0a3('0x4d')];_0x23e6bd['uniqueid']=_0x2140f1[_0xe0a3('0x4b')];return _0x23e6bd;};exports[_0xe0a3('0x65')]=function(_0x4ef133){var _0x72bbdc=[];for(var _0x188100 in _0x4ef133){if(_0x4ef133[_0xe0a3('0x32')](_0x188100)){if(!_[_0xe0a3('0x2b')](_0x4ef133[_0x188100])&&_0x4ef133[_0x188100]['state']===_0xe0a3('0x66')&&_0x4ef133[_0x188100][_0xe0a3('0x67')]===_0xe0a3('0x68')){_0x72bbdc[_0xe0a3('0x69')](_0x4ef133[_0x188100]['id']);}}}return _0x72bbdc;};exports['getDiff']=function(_0x574891){var _0x5861fd=moment()[_0xe0a3('0x7')](0x0);var _0xbb1bf5=moment(_0x574891)['milliseconds'](0x0);return _0x5861fd[_0xe0a3('0x8')](_0xbb1bf5,'seconds');};exports[_0xe0a3('0x6a')]=function(_0xd1e1a5){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xd1e1a5[_0xe0a3('0x1b')],'ListId':_0xd1e1a5['ListId'],'VoiceQueueId':_0xd1e1a5[_0xe0a3('0x1d')]||undefined,'CampaignId':_0xd1e1a5[_0xe0a3('0x6b')]||undefined};};exports[_0xe0a3('0x6c')]=function(_0x1bae8b){if(_0x1bae8b===_0xe0a3('0x4b')||_0x1bae8b===_0xe0a3('0x6d')||_0x1bae8b===_0xe0a3('0x61')||_0x1bae8b===_0xe0a3('0x6e')||_0x1bae8b===_0xe0a3('0x6f')||_0x1bae8b===_0xe0a3('0x70')||_0x1bae8b===_0xe0a3('0x43')||_0x1bae8b===_0xe0a3('0x4d')||_0x1bae8b===_0xe0a3('0x19')||_0x1bae8b===_0xe0a3('0x58')||_0x1bae8b===_0xe0a3('0x1a')||_0x1bae8b==='scheduledat'||_0x1bae8b===_0xe0a3('0x51')||_0x1bae8b===_0xe0a3('0x52')||_0x1bae8b===_0xe0a3('0x53')||_0x1bae8b===_0xe0a3('0x71')||_0x1bae8b==='callback'||_0x1bae8b===_0xe0a3('0x72')||_0x1bae8b===_0xe0a3('0x73')||_0x1bae8b===_0xe0a3('0x74')||_0x1bae8b===_0xe0a3('0x1b')||_0x1bae8b===_0xe0a3('0x5b')||_0x1bae8b===_0xe0a3('0x44')||_0x1bae8b===_0xe0a3('0x1d')||_0x1bae8b===_0xe0a3('0x75')||_0x1bae8b==='xmd-voicequeueid'||_0x1bae8b===_0xe0a3('0x76')||_0x1bae8b===_0xe0a3('0x77')||_0x1bae8b==='xmd-listid'||_0x1bae8b==='xmd-dialurl'||_0x1bae8b==='xmd-dialtimeout'||_0x1bae8b===_0xe0a3('0x78')||_0x1bae8b===_0xe0a3('0x79')||_0x1bae8b==='xmd-dialchannel'||_0x1bae8b===_0xe0a3('0x7a')||_0x1bae8b==='xmd-cdrtype'||_0x1bae8b===_0xe0a3('0x7b')||_0x1bae8b===_0xe0a3('0x7c')||_0x1bae8b===_0xe0a3('0x7d')||_0x1bae8b===_0xe0a3('0x7e')||_0x1bae8b===_0xe0a3('0x7f')||_0x1bae8b==='rtpaudioqosjitter'||_0x1bae8b===_0xe0a3('0x80')||_0x1bae8b===_0xe0a3('0x81')||_0x1bae8b===_0xe0a3('0x82')||_0x1bae8b===_0xe0a3('0x83')||_0x1bae8b===_0xe0a3('0x84')||_0x1bae8b===_0xe0a3('0x7e')||_0x1bae8b==='rtpaudioqosbridged'||_0x1bae8b===_0xe0a3('0x85')||_0x1bae8b===_0xe0a3('0x80')||_0x1bae8b==='rtpaudioqosloss'||_0x1bae8b===_0xe0a3('0x82')||_0x1bae8b===_0xe0a3('0x83')||_0x1bae8b===_0xe0a3('0x84')||_0x1bae8b===_0xe0a3('0x86')||_0x1bae8b===_0xe0a3('0x87')||_0x1bae8b===_0xe0a3('0x3f')||_0x1bae8b===_0xe0a3('0x3a')){return![];}return!![];};exports[_0xe0a3('0x88')]=function(_0x52e0e4,_0x3bb630){var _0x2116b7,_0x1494b6,_0x446385;if(_0x3bb630<=0x0){_0x3bb630=0x1;}_0x2116b7=new RegExp('\x5cw{0,'+_0x3bb630+'}$');_0x1494b6=Math[_0xe0a3('0x89')](0xa,_0x3bb630-0x1);_0x446385=Math[_0xe0a3('0x89')](0xa,_0x3bb630)-0x1;return util['format']('%s',_[_0xe0a3('0x8a')](_0x52e0e4,_0x2116b7,_[_0xe0a3('0x8b')](_0x1494b6,_0x446385)));};exports[_0xe0a3('0x8c')]=function(_0x3f18d1){var _0x1e7454=_0x3f18d1[_0xe0a3('0x8d')](/"(.*?)"/);return _0x1e7454?_0x1e7454[0x1]:_0x3f18d1;};exports['extractCalleridNumber']=function(_0x3cd952){var _0xc305f0=_0x3cd952[_0xe0a3('0x8d')](/<(.*?)>/);return _0xc305f0?_0xc305f0[0x1]:_0x3cd952;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index dc15eff..687f36d 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 _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x3c7e74,_0x431a67){var _0x5e7924=function(_0x39e11f){while(--_0x39e11f){_0x3c7e74['push'](_0x3c7e74['shift']());}};_0x5e7924(++_0x431a67);}(_0x5f2f,0x73));var _0xf5f2=function(_0x170023,_0x18320f){_0x170023=_0x170023-0x0;var _0x348f38=_0x5f2f[_0x170023];return _0x348f38;};'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 +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x20a56e,_0x2a7c8e){var _0x45acfc=function(_0x156f2f){while(--_0x156f2f){_0x20a56e['push'](_0x20a56e['shift']());}};_0x45acfc(++_0x2a7c8e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x41ce5f,_0x233698){_0x41ce5f=_0x41ce5f-0x0;var _0x29f927=_0x5f2f[_0x41ce5f];return _0x29f927;};'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 e13c832..578d75c 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 _0x426a=['uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','freshdeskAccounts','deskAccounts','dynamics365Accounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','isNil','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','abandoned','sumDuration','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy'];(function(_0xc45c30,_0x206f01){var _0x22797e=function(_0x1c6033){while(--_0x1c6033){_0xc45c30['push'](_0xc45c30['shift']());}};_0x22797e(++_0x206f01);}(_0x426a,0x1c6));var _0xa426=function(_0x1aa565,_0x4c322a){_0x1aa565=_0x1aa565-0x0;var _0x5f5015=_0x426a[_0x1aa565];return _0x5f5015;};'use strict';var BPromise=require(_0xa426('0x0'));var util=require(_0xa426('0x1'));var _=require(_0xa426('0x2'));var moment=require(_0xa426('0x3'));var Agent=require(_0xa426('0x4'));var Telephone=require(_0xa426('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa426('0x6'));var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require(_0xa426('0x7'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xa426('0x8'));var SalesforceAccount=require(_0xa426('0x9'));var FreshdeskAccount=require(_0xa426('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xa426('0xb'));var DeskAccount=require(_0xa426('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xa426('0xd'));var FreshsalesAccount=require(_0xa426('0xe'));var FaxAccount=require(_0xa426('0xf'));var Realtime=function(){this[_0xa426('0x10')]={};this[_0xa426('0x11')]={};this[_0xa426('0x12')]={};this[_0xa426('0x13')]={};this[_0xa426('0x14')]={};this[_0xa426('0x15')]={};this[_0xa426('0x16')]={};this[_0xa426('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xa426('0x18')]={};this[_0xa426('0x19')]={};this[_0xa426('0x1a')]={};this[_0xa426('0x1b')]={};this[_0xa426('0x1c')]={};this[_0xa426('0x1d')]={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this[_0xa426('0x1e')]={};this['zohoAccounts']={};this[_0xa426('0x1f')]={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0xa426('0x20')]={};this['freshsalesAccounts']={};this[_0xa426('0x21')]={};};function freeIsNotKey(_0x3de49a,_0x13d649,_0x5c6da2){var _0x2ffea9=_[_0xa426('0x22')](_0x3de49a,function(_0x4c7617,_0x26c666){return _0x4c7617[_0x5c6da2];});for(var _0x2f2357 in _0x13d649){if(_0x13d649['hasOwnProperty'](_0x2f2357)){if(!_0x2ffea9[_0x2f2357]){delete _0x13d649[_0x2f2357];}}}}function freeIsNotKeySip(_0x38a9f0,_0x254939){var _0x5eb1de=_['mapKeys'](_0x38a9f0,function(_0xae9e4f,_0x10d1cd){return util[_0xa426('0x23')](_0xa426('0x24'),_0xae9e4f[_0xa426('0x25')]);});for(var _0x6fa356 in _0x254939){if(_0x254939[_0xa426('0x26')](_0x6fa356)){if(!_0x5eb1de[_0x6fa356]){delete _0x254939[_0x6fa356];}}}}function freeIsNotKeyAgent(_0xfc6f55,_0x5eb4aa){var _0x7715c4=_[_0xa426('0x22')](_0xfc6f55,function(_0x50f681,_0x34d53a){var _0x428f04=_[_0xa426('0x27')](_0x50f681[_0xa426('0x28')])?util[_0xa426('0x23')]('SIP/%s',_0x50f681[_0xa426('0x25')]):_0x50f681['interface'];return _0x428f04;});for(var _0x4b9f75 in _0x5eb4aa){if(_0x5eb4aa['hasOwnProperty'](_0x4b9f75)){if(!_0x7715c4[_0x4b9f75]){delete _0x5eb4aa[_0x4b9f75];}}}}function clearVoiceCallReports(_0x5e349e){_0x5e349e[_0xa426('0x29')]=0x0;_0x5e349e[_0xa426('0x2a')]=0x0;_0x5e349e[_0xa426('0x2b')]=0x0;_0x5e349e['sumDuration']=0x0;_0x5e349e[_0xa426('0x2c')]=0x0;}function clearCampaigns(_0x4115d7){if(!_[_0xa426('0x2d')](_0x4115d7)){for(var _0x57046c in _0x4115d7){if(_0x4115d7[_0xa426('0x26')](_0x57046c)){_0x4115d7[_0x57046c]['ivrTotalCallsDays']=0x0;_0x4115d7[_0x57046c][_0xa426('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x2839e1){if(!_[_0xa426('0x2d')](_0x2839e1)){for(var _0x57ed6a in _0x2839e1){if(_0x2839e1[_0xa426('0x26')](_0x57ed6a)){_0x2839e1[_0x57ed6a]['total']=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x2a')]=0x0;_0x2839e1[_0x57ed6a]['unmanaged']=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x2f')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x2b')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x30')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x2c')]=0x0;_0x2839e1[_0x57ed6a]['outboundAnswerAgiCallsDay']=0x0;_0x2839e1[_0x57ed6a]['outboundNoAnswerCallsDay']=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x31')]=0x0;_0x2839e1[_0x57ed6a]['outboundCongestionCallsDay']=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x32')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x33')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x34')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x35')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x36')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x37')]=0x0;_0x2839e1[_0x57ed6a]['outboundRejectCallsDay']=0x0;_0x2839e1[_0x57ed6a]['outboundReCallsDay']=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x38')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x39')]=0x0;_0x2839e1[_0x57ed6a]['queueStatusComplete']=!![];}}}}Realtime[_0xa426('0x3a')][_0xa426('0x3b')]=function(_0x3f00f1,_0x15ac40){for(var _0x321fb8 in _0x15ac40){if(_0x3f00f1['hasOwnProperty'](_0x321fb8)){_0x3f00f1[_0x321fb8]=_0x15ac40[_0x321fb8];}}};Realtime['prototype'][_0xa426('0x3c')]=function(){var _0x58be5c=this;return function(_0x3a0a2e){if(_0x3a0a2e){freeIsNotKeyAgent(_0x3a0a2e,_0x58be5c['agents']);for(var _0x3504a8=0x0,_0x92a2d3={},_0x18046c={};_0x3504a8<_0x3a0a2e[_0xa426('0x3d')];_0x3504a8+=0x1){_0x92a2d3=_0x3a0a2e[_0x3504a8];var _0x4614b9=_['isNil'](_0x92a2d3[_0xa426('0x28')])?util[_0xa426('0x23')](_0xa426('0x24'),_0x92a2d3[_0xa426('0x25')]):_0x92a2d3['interface'];if(_[_0xa426('0x3e')](_0x58be5c['agents'][_0x4614b9])){_0x58be5c['agents'][_0x4614b9]=new Agent(_0x92a2d3);}else{_0x58be5c[_0xa426('0x3b')](_0x58be5c[_0xa426('0x10')][_0x4614b9],_0x92a2d3);}}}return _0x58be5c[_0xa426('0x10')];};};Realtime[_0xa426('0x3a')][_0xa426('0x3f')]=function(){var _0x18966d=this;return function(_0x181706){if(_0x181706){freeIsNotKeySip(_0x181706,_0x18966d[_0xa426('0x11')]);for(var _0x496312=0x0,_0x1bb38e={},_0x999671={};_0x496312<_0x181706[_0xa426('0x3d')];_0x496312+=0x1){_0x1bb38e=_0x181706[_0x496312];if(_[_0xa426('0x3e')](_0x18966d['telephones'][util[_0xa426('0x23')](_0xa426('0x24'),_0x1bb38e[_0xa426('0x25')])])){_0x18966d['telephones'][util[_0xa426('0x23')]('SIP/%s',_0x1bb38e['name'])]=new Telephone(_0x1bb38e);}else{_0x18966d['mergeFromDatabase'](_0x18966d['telephones'][util['format'](_0xa426('0x24'),_0x1bb38e['name'])],_0x1bb38e);}}}return _0x18966d[_0xa426('0x11')];};};Realtime['prototype'][_0xa426('0x40')]=function(){var _0x309545=this;return function(_0x18d0ef){if(_0x18d0ef){freeIsNotKeySip(_0x18d0ef,_0x309545['trunks']);for(var _0x3b89b7=0x0,_0x225b78={},_0x4a740c={};_0x3b89b7<_0x18d0ef[_0xa426('0x3d')];_0x3b89b7+=0x1){_0x225b78=_0x18d0ef[_0x3b89b7];if(_[_0xa426('0x3e')](_0x309545[_0xa426('0x12')][util[_0xa426('0x23')](_0xa426('0x24'),_0x225b78[_0xa426('0x25')])])){_0x309545[_0xa426('0x12')][util[_0xa426('0x23')]('SIP/%s',_0x225b78[_0xa426('0x25')])]=new Trunk(_0x225b78);}else{_0x309545['mergeFromDatabase'](_0x309545['trunks'][util[_0xa426('0x23')]('SIP/%s',_0x225b78[_0xa426('0x25')])],_0x225b78);}}}return _0x309545[_0xa426('0x12')];};};Realtime[_0xa426('0x3a')][_0xa426('0x41')]=function(){var _0x50e487=this;return function(_0x3b2823){if(_0x3b2823){freeIsNotKey(_0x3b2823,_0x50e487[_0xa426('0x13')],_0xa426('0x25'));for(var _0x130c40=0x0,_0x30d61b={},_0x21ac30={};_0x130c40<_0x3b2823[_0xa426('0x3d')];_0x130c40+=0x1){_0x30d61b=_0x3b2823[_0x130c40];if(_[_0xa426('0x3e')](_0x50e487['voiceQueues'][_0x30d61b[_0xa426('0x25')]])){_0x50e487[_0xa426('0x13')][_0x30d61b['name']]=new VoiceQueue(_0x30d61b);}else{_0x50e487[_0xa426('0x3b')](_0x50e487[_0xa426('0x13')][_0x30d61b[_0xa426('0x25')]],_0x30d61b);}}}return _0x50e487[_0xa426('0x13')];};};Realtime[_0xa426('0x3a')][_0xa426('0x42')]=function(){var _0x73665d=this;return function(_0x4410bf){if(_0x4410bf){freeIsNotKey(_0x4410bf,_0x73665d[_0xa426('0x14')],'id');for(var _0x4ea8de=0x0,_0x59d87c={},_0x485673={};_0x4ea8de<_0x4410bf[_0xa426('0x3d')];_0x4ea8de+=0x1){_0x59d87c=_0x4410bf[_0x4ea8de];if(_['isUndefined'](_0x73665d[_0xa426('0x14')][_0x59d87c['id']])){_0x73665d[_0xa426('0x14')][_0x59d87c['id']]=new Trigger(_0x59d87c);}else{_0x73665d[_0xa426('0x3b')](_0x73665d['triggers'][_0x59d87c['id']],_0x59d87c);}}}return _0x73665d['triggers'];};};Realtime[_0xa426('0x3a')][_0xa426('0x43')]=function(){var _0x18dccd=this;return function(_0x52629b){if(_0x52629b){freeIsNotKey(_0x52629b,_0x18dccd['templates'],'id');for(var _0x40de1c=0x0,_0x5b255a={},_0x26c2b2={};_0x40de1c<_0x52629b['length'];_0x40de1c+=0x1){_0x5b255a=_0x52629b[_0x40de1c];if(_[_0xa426('0x3e')](_0x18dccd[_0xa426('0x16')][_0x5b255a['id']])){_0x18dccd[_0xa426('0x16')][_0x5b255a['id']]=new Template(_0x5b255a);}else{_0x18dccd['mergeFromDatabase'](_0x18dccd['templates'][_0x5b255a['id']],_0x5b255a);}}}return _0x18dccd[_0xa426('0x16')];};};Realtime['prototype'][_0xa426('0x44')]=function(){var _0x39da3a=this;return function(_0x3de1a7){if(_0x3de1a7){freeIsNotKey(_0x3de1a7,_0x39da3a[_0xa426('0x1d')],'id');for(var _0x4a9318=0x0,_0x5d4bef={},_0x35b0a5={};_0x4a9318<_0x3de1a7['length'];_0x4a9318+=0x1){_0x5d4bef=_0x3de1a7[_0x4a9318];if(_[_0xa426('0x3e')](_0x39da3a[_0xa426('0x1d')][_0x5d4bef['id']])){_0x39da3a[_0xa426('0x1d')][_0x5d4bef['id']]=new ZendeskAccount(_0x5d4bef);}else{_0x39da3a[_0xa426('0x3b')](_0x39da3a[_0xa426('0x1d')][_0x5d4bef['id']],_0x5d4bef);}}}return _0x39da3a['zendeskAccounts'];};};Realtime['prototype'][_0xa426('0x45')]=function(){var _0x3d6321=this;return function(_0xce7e){if(_0xce7e){freeIsNotKey(_0xce7e,_0x3d6321['salesforceAccounts'],'id');for(var _0x43f4ab=0x0,_0x49c41d={},_0x4c8e6b={};_0x43f4ab<_0xce7e[_0xa426('0x3d')];_0x43f4ab+=0x1){_0x49c41d=_0xce7e[_0x43f4ab];if(_['isUndefined'](_0x3d6321['salesforceAccounts'][_0x49c41d['id']])){_0x3d6321['salesforceAccounts'][_0x49c41d['id']]=new SalesforceAccount(_0x49c41d);}else{_0x3d6321['mergeFromDatabase'](_0x3d6321[_0xa426('0x46')][_0x49c41d['id']],_0x49c41d);}}}return _0x3d6321['salesforceAccounts'];};};Realtime[_0xa426('0x3a')][_0xa426('0x47')]=function(){var _0x4cc52b=this;return function(_0xa842ce){if(_0xa842ce){freeIsNotKey(_0xa842ce,_0x4cc52b[_0xa426('0x1e')],'id');for(var _0x3e770f=0x0,_0x11f0c2={},_0x59d416={};_0x3e770f<_0xa842ce[_0xa426('0x3d')];_0x3e770f+=0x1){_0x11f0c2=_0xa842ce[_0x3e770f];if(_[_0xa426('0x3e')](_0x4cc52b[_0xa426('0x1e')][_0x11f0c2['id']])){_0x4cc52b[_0xa426('0x1e')][_0x11f0c2['id']]=new FreshdeskAccount(_0x11f0c2);}else{_0x4cc52b[_0xa426('0x3b')](_0x4cc52b[_0xa426('0x1e')][_0x11f0c2['id']],_0x11f0c2);}}}return _0x4cc52b[_0xa426('0x1e')];};};Realtime['prototype'][_0xa426('0x48')]=function(){var _0xde3287=this;return function(_0x5d07ab){if(_0x5d07ab){freeIsNotKey(_0x5d07ab,_0xde3287[_0xa426('0x49')],'id');for(var _0x26606e=0x0,_0x436eeb={},_0x2c844a={};_0x26606e<_0x5d07ab[_0xa426('0x3d')];_0x26606e+=0x1){_0x436eeb=_0x5d07ab[_0x26606e];if(_[_0xa426('0x3e')](_0xde3287[_0xa426('0x49')][_0x436eeb['id']])){_0xde3287[_0xa426('0x49')][_0x436eeb['id']]=new ZohoAccount(_0x436eeb);}else{_0xde3287['mergeFromDatabase'](_0xde3287[_0xa426('0x49')][_0x436eeb['id']],_0x436eeb);}}}return _0xde3287[_0xa426('0x49')];};};Realtime[_0xa426('0x3a')]['initDeskAccounts']=function(){var _0x5a61ad=this;return function(_0x34d973){if(_0x34d973){freeIsNotKey(_0x34d973,_0x5a61ad[_0xa426('0x1f')],'id');for(var _0x5bb2da=0x0,_0xa845d6={},_0x2e252d={};_0x5bb2da<_0x34d973[_0xa426('0x3d')];_0x5bb2da+=0x1){_0xa845d6=_0x34d973[_0x5bb2da];if(_[_0xa426('0x3e')](_0x5a61ad[_0xa426('0x1f')][_0xa845d6['id']])){_0x5a61ad[_0xa426('0x1f')][_0xa845d6['id']]=new DeskAccount(_0xa845d6);}else{_0x5a61ad[_0xa426('0x3b')](_0x5a61ad['deskAccounts'][_0xa845d6['id']],_0xa845d6);}}}return _0x5a61ad[_0xa426('0x1f')];};};Realtime[_0xa426('0x3a')][_0xa426('0x4a')]=function(){var _0x317a48=this;return function(_0x11d17f){if(_0x11d17f){freeIsNotKey(_0x11d17f,_0x317a48[_0xa426('0x4b')],'id');for(var _0xff5b31=0x0,_0x2a7467={},_0x568286={};_0xff5b31<_0x11d17f[_0xa426('0x3d')];_0xff5b31+=0x1){_0x2a7467=_0x11d17f[_0xff5b31];if(_[_0xa426('0x3e')](_0x317a48[_0xa426('0x4b')][_0x2a7467['id']])){_0x317a48[_0xa426('0x4b')][_0x2a7467['id']]=new SugarcrmAccount(_0x2a7467);}else{_0x317a48[_0xa426('0x3b')](_0x317a48[_0xa426('0x4b')][_0x2a7467['id']],_0x2a7467);}}}return _0x317a48['sugarcrmAccounts'];};};Realtime[_0xa426('0x3a')][_0xa426('0x4c')]=function(){var _0x15d686=this;return function(_0x387ac4){if(_0x387ac4){freeIsNotKey(_0x387ac4,_0x15d686['vtigerAccounts'],'id');for(var _0x1438d6=0x0,_0x1d764f={},_0xf1e098={};_0x1438d6<_0x387ac4[_0xa426('0x3d')];_0x1438d6+=0x1){_0x1d764f=_0x387ac4[_0x1438d6];if(_[_0xa426('0x3e')](_0x15d686[_0xa426('0x4d')][_0x1d764f['id']])){_0x15d686['vtigerAccounts'][_0x1d764f['id']]=new VtigerAccount(_0x1d764f);}else{_0x15d686[_0xa426('0x3b')](_0x15d686[_0xa426('0x4d')][_0x1d764f['id']],_0x1d764f);}}}return _0x15d686[_0xa426('0x4d')];};};Realtime['prototype'][_0xa426('0x4e')]=function(){var _0x1e5845=this;return function(_0x502ef3){if(_0x502ef3){freeIsNotKey(_0x502ef3,_0x1e5845[_0xa426('0x4f')],'id');for(var _0x2d3b67=0x0,_0x3ccc9d={},_0x1bb35c={};_0x2d3b67<_0x502ef3[_0xa426('0x3d')];_0x2d3b67+=0x1){_0x3ccc9d=_0x502ef3[_0x2d3b67];if(_[_0xa426('0x3e')](_0x1e5845[_0xa426('0x4f')][_0x3ccc9d['id']])){_0x1e5845[_0xa426('0x4f')][_0x3ccc9d['id']]=new ServicenowAccount(_0x3ccc9d);}else{_0x1e5845['mergeFromDatabase'](_0x1e5845[_0xa426('0x4f')][_0x3ccc9d['id']],_0x3ccc9d);}}}return _0x1e5845[_0xa426('0x4f')];};};Realtime[_0xa426('0x3a')][_0xa426('0x50')]=function(){var _0x27a986=this;return function(_0x12943f){if(_0x12943f){freeIsNotKey(_0x12943f,_0x27a986[_0xa426('0x20')],'id');for(var _0x559491=0x0,_0x379ad7={},_0x3befb={};_0x559491<_0x12943f[_0xa426('0x3d')];_0x559491+=0x1){_0x379ad7=_0x12943f[_0x559491];if(_[_0xa426('0x3e')](_0x27a986[_0xa426('0x20')][_0x379ad7['id']])){_0x27a986[_0xa426('0x20')][_0x379ad7['id']]=new Dynamics365Account(_0x379ad7);}else{_0x27a986[_0xa426('0x3b')](_0x27a986[_0xa426('0x20')][_0x379ad7['id']],_0x379ad7);}}}return _0x27a986[_0xa426('0x20')];};};Realtime[_0xa426('0x3a')][_0xa426('0x51')]=function(){var _0x3a9a30=this;return function(_0x56c356){if(_0x56c356){freeIsNotKey(_0x56c356,_0x3a9a30[_0xa426('0x52')],'id');for(var _0x1c2fe3=0x0,_0x53f2cc={},_0x475e57={};_0x1c2fe3<_0x56c356[_0xa426('0x3d')];_0x1c2fe3+=0x1){_0x53f2cc=_0x56c356[_0x1c2fe3];if(_['isUndefined'](_0x3a9a30['freshsalesAccounts'][_0x53f2cc['id']])){_0x3a9a30[_0xa426('0x52')][_0x53f2cc['id']]=new FreshsalesAccount(_0x53f2cc);}else{_0x3a9a30[_0xa426('0x3b')](_0x3a9a30[_0xa426('0x52')][_0x53f2cc['id']],_0x53f2cc);}}}return _0x3a9a30[_0xa426('0x52')];};};Realtime[_0xa426('0x3a')][_0xa426('0x53')]=function(){var _0x5546c7=this;return function(_0x2a8155){for(var _0x1fcbe1=0x0;_0x1fcbe1<_0x2a8155[_0xa426('0x3d')];_0x1fcbe1+=0x1){_['merge'](_0x5546c7[_0xa426('0x13')][_0x2a8155[_0x1fcbe1][_0xa426('0x25')]],_0x2a8155[_0x1fcbe1]);}return _0x5546c7['voiceQueues'];};};Realtime[_0xa426('0x3a')][_0xa426('0x54')]=function(){var _0x49fd7d=this;return function(_0x29ca7d){clearVoiceQueues(_0x49fd7d[_0xa426('0x13')]);if(_0x29ca7d){_0x29ca7d=_[_0xa426('0x55')](_0x29ca7d,_0xa426('0x56'));for(var _0x48c170 in _0x29ca7d){if(_0x29ca7d[_0xa426('0x26')](_0x48c170)){var _0x52b8ac={};for(var _0xaec777=0x0;_0xaec777<_0x29ca7d[_0x48c170][_0xa426('0x3d')];_0xaec777+=0x1){var _0x40ec6a=_0x29ca7d[_0x48c170][_0xaec777]['queue'];if(_0x49fd7d['voiceQueues'][_0x40ec6a]){if(_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x57')]){_0x49fd7d[_0xa426('0x13')][_0x40ec6a]['unmanaged']+=0x1;}if(_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x58')]){_0x49fd7d[_0xa426('0x13')][_0x40ec6a][_0xa426('0x2f')]+=0x1;}_0x49fd7d[_0xa426('0x13')][_0x40ec6a][_0xa426('0x2b')]+=moment(_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x59')])[_0xa426('0x5a')](moment(_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x5b')]),_0xa426('0x5c'))||0x0;if(_0xaec777===_0x29ca7d[_0x48c170]['length']-0x1){_0x49fd7d[_0xa426('0x13')][_0x40ec6a][_0xa426('0x30')]+=moment(_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x5d')]||_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x5e')]||_0x29ca7d[_0x48c170][_0xaec777]['queuecallerexitAt'])[_0xa426('0x5a')](moment(_0x29ca7d[_0x48c170][_0xaec777]['queuecallerjoinAt']),'seconds')||0x0;_0x49fd7d[_0xa426('0x13')][_0x40ec6a][_0xa426('0x29')]+=0x1;if(_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x5f')]){_0x49fd7d[_0xa426('0x13')][_0x40ec6a][_0xa426('0x2a')]+=0x1;_0x49fd7d[_0xa426('0x13')][_0x40ec6a]['sumBillable']+=moment(_0x29ca7d[_0x48c170][_0xaec777]['queuecallercompleteAt'])['diff'](moment(_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x59')]),_0xa426('0x5c'))||0x0;}}else{_0x49fd7d['voiceQueues'][_0x40ec6a][_0xa426('0x30')]+=_0x49fd7d[_0xa426('0x13')][_0x40ec6a][_0xa426('0x2b')]||0x0;}}}}}}return _0x49fd7d[_0xa426('0x13')];};};Realtime[_0xa426('0x3a')][_0xa426('0x60')]=function(){var _0x2576d6=this;return function(_0x493d70){clearVoiceCallReports(_0x2576d6['outbound']);if(_0x493d70){for(var _0x389da1=0x0;_0x389da1<_0x493d70['length'];_0x389da1+=0x1){_0x2576d6['outbound'][_0xa426('0x29')]+=0x1;_0x2576d6[_0xa426('0x17')][_0xa426('0x30')]+=_0x493d70[_0x389da1][_0xa426('0x61')];if(_0x493d70[_0x389da1][_0xa426('0x62')]===_0xa426('0x63')){_0x2576d6['outbound'][_0xa426('0x2a')]+=0x1;_0x2576d6[_0xa426('0x17')]['sumHoldTime']+=_0x493d70[_0x389da1][_0xa426('0x61')]-_0x493d70[_0x389da1]['billableseconds']||0x0;_0x2576d6[_0xa426('0x17')][_0xa426('0x2c')]+=_0x493d70[_0x389da1][_0xa426('0x64')];}}}return _0x2576d6['outbound'];};};Realtime[_0xa426('0x3a')][_0xa426('0x65')]=function(){var _0x33449d=this;return function(_0x2c22ab){if(_0x2c22ab){freeIsNotKey(_0x2c22ab,_0x33449d['campaigns'],_0xa426('0x25'));for(var _0x2d25d6=0x0,_0x462032={};_0x2d25d6<_0x2c22ab[_0xa426('0x3d')];_0x2d25d6+=0x1){_0x462032=_0x2c22ab[_0x2d25d6];if(_[_0xa426('0x3e')](_0x33449d[_0xa426('0x15')][_0x462032[_0xa426('0x25')]])){_0x33449d[_0xa426('0x15')][_0x462032[_0xa426('0x25')]]=new Campaign(_0x462032);}else{_0x33449d[_0xa426('0x3b')](_0x33449d[_0xa426('0x15')][_0x462032[_0xa426('0x25')]],_0x462032);_0x33449d[_0xa426('0x15')][_0x462032[_0xa426('0x25')]][_0xa426('0x66')]=_0x462032[_0xa426('0x67')]?_0x462032[_0xa426('0x67')][_0xa426('0x25')]:undefined;}}}return _0x33449d['campaigns'];};};Realtime[_0xa426('0x3a')][_0xa426('0x68')]=function(){var _0xfbcf9=this;return function(_0x10fdfa){if(_0x10fdfa){freeIsNotKey(_0x10fdfa,_0xfbcf9[_0xa426('0x18')],'id');for(var _0x1acfb9=0x0,_0x4cba32={};_0x1acfb9<_0x10fdfa[_0xa426('0x3d')];_0x1acfb9+=0x1){_0x4cba32=_0x10fdfa[_0x1acfb9];if(_['isUndefined'](_0xfbcf9[_0xa426('0x18')][_0x4cba32['id']])){_0xfbcf9['voiceExtensions'][_0x4cba32['id']]=new VoiceExtension(_0x4cba32);}else{_0xfbcf9[_0xa426('0x3b')](_0xfbcf9[_0xa426('0x18')][_0x4cba32['id']],_0x4cba32);}}}return _0xfbcf9[_0xa426('0x18')];};};Realtime['prototype'][_0xa426('0x69')]=function(){var _0x308074=this;return function(_0x1f01ed){clearCampaigns(_0x308074['campaigns']);for(var _0x529cda=0x0;_0x529cda<_0x1f01ed[_0xa426('0x3d')];_0x529cda+=0x1){_['merge'](_0x308074['campaigns'][_0x1f01ed[_0x529cda]['name']],_0x1f01ed[_0x529cda]);}return _0x308074['campaigns'];};};Realtime['prototype'][_0xa426('0x6a')]=function(){var _0x5d409d=this;return function(_0xef4b57){if(_0xef4b57){freeIsNotKey(_0xef4b57,_0x5d409d[_0xa426('0x21')],'id');for(var _0x39f7fb=0x0,_0x4273b2={},_0x51c374={};_0x39f7fb<_0xef4b57[_0xa426('0x3d')];_0x39f7fb+=0x1){_0x4273b2=_0xef4b57[_0x39f7fb];if(_[_0xa426('0x3e')](_0x5d409d[_0xa426('0x21')][_0x4273b2['id']])){_0x5d409d[_0xa426('0x21')][_0x4273b2['id']]=new FaxAccount(_0x4273b2);}else{_0x5d409d[_0xa426('0x3b')](_0x5d409d[_0xa426('0x21')][_0x4273b2['id']],_0x4273b2);}}}return _0x5d409d['faxAccounts'];};};module[_0xa426('0x6b')]=Realtime; \ No newline at end of file +var _0xbf33=['initVtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','seconds','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallercompleteAt','queuecallerleaveAt','initVoiceCallReports','disposition','ANSWERED','SquareProject','voiceExtensions','initFaxAccounts','exports','bluebird','util','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','triggers','campaigns','templates','outbound','queueChannels','outboundChannels','timers','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','answered','sumHoldTime','sumDuration','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','length','isNil','isUndefined','initTelephones','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts'];(function(_0x31fcc0,_0x3c0495){var _0x106572=function(_0x52294b){while(--_0x52294b){_0x31fcc0['push'](_0x31fcc0['shift']());}};_0x106572(++_0x3c0495);}(_0xbf33,0x82));var _0x3bf3=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xbf33[_0x4243a3];return _0x1b2a33;};'use strict';var BPromise=require(_0x3bf3('0x0'));var util=require(_0x3bf3('0x1'));var _=require('lodash');var moment=require(_0x3bf3('0x2'));var Agent=require(_0x3bf3('0x3'));var Telephone=require(_0x3bf3('0x4'));var Trunk=require(_0x3bf3('0x5'));var VoiceQueue=require(_0x3bf3('0x6'));var Trigger=require(_0x3bf3('0x7'));var Template=require(_0x3bf3('0x8'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x3bf3('0x9'));var ZendeskAccount=require(_0x3bf3('0xa'));var SalesforceAccount=require(_0x3bf3('0xb'));var FreshdeskAccount=require(_0x3bf3('0xc'));var SugarcrmAccount=require(_0x3bf3('0xd'));var ZohoAccount=require(_0x3bf3('0xe'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x3bf3('0xf'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x3bf3('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x3bf3('0x11'));var Realtime=function(){this[_0x3bf3('0x12')]={};this[_0x3bf3('0x13')]={};this[_0x3bf3('0x14')]={};this['voiceQueues']={};this[_0x3bf3('0x15')]={};this[_0x3bf3('0x16')]={};this[_0x3bf3('0x17')]={};this[_0x3bf3('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0x3bf3('0x19')]={};this[_0x3bf3('0x1a')]={};this[_0x3bf3('0x1b')]={};this[_0x3bf3('0x1c')]={};this['salesforceAccounts']={};this[_0x3bf3('0x1d')]={};this[_0x3bf3('0x1e')]={};this[_0x3bf3('0x1f')]={};this[_0x3bf3('0x20')]={};this[_0x3bf3('0x21')]={};this[_0x3bf3('0x22')]={};this[_0x3bf3('0x23')]={};this[_0x3bf3('0x24')]={};this[_0x3bf3('0x25')]={};};function freeIsNotKey(_0x21d76b,_0x57b99b,_0x8f738d){var _0x363ef8=_[_0x3bf3('0x26')](_0x21d76b,function(_0x3356ff,_0x129819){return _0x3356ff[_0x8f738d];});for(var _0x531c39 in _0x57b99b){if(_0x57b99b[_0x3bf3('0x27')](_0x531c39)){if(!_0x363ef8[_0x531c39]){delete _0x57b99b[_0x531c39];}}}}function freeIsNotKeySip(_0x42c271,_0xdfa4d9){var _0x5707fa=_['mapKeys'](_0x42c271,function(_0x1eab8c,_0x2774c7){return util[_0x3bf3('0x28')](_0x3bf3('0x29'),_0x1eab8c[_0x3bf3('0x2a')]);});for(var _0x3f3952 in _0xdfa4d9){if(_0xdfa4d9[_0x3bf3('0x27')](_0x3f3952)){if(!_0x5707fa[_0x3f3952]){delete _0xdfa4d9[_0x3f3952];}}}}function freeIsNotKeyAgent(_0x1b1494,_0x24d106){var _0x57e507=_[_0x3bf3('0x26')](_0x1b1494,function(_0x258f4a,_0x2da7c5){var _0x36c8e8=_['isNil'](_0x258f4a[_0x3bf3('0x2b')])?util[_0x3bf3('0x28')](_0x3bf3('0x29'),_0x258f4a[_0x3bf3('0x2a')]):_0x258f4a[_0x3bf3('0x2b')];return _0x36c8e8;});for(var _0x5b4e1e in _0x24d106){if(_0x24d106['hasOwnProperty'](_0x5b4e1e)){if(!_0x57e507[_0x5b4e1e]){delete _0x24d106[_0x5b4e1e];}}}}function clearVoiceCallReports(_0x35ebab){_0x35ebab[_0x3bf3('0x2c')]=0x0;_0x35ebab[_0x3bf3('0x2d')]=0x0;_0x35ebab[_0x3bf3('0x2e')]=0x0;_0x35ebab[_0x3bf3('0x2f')]=0x0;_0x35ebab['sumBillable']=0x0;}function clearCampaigns(_0x3c30cf){if(!_[_0x3bf3('0x30')](_0x3c30cf)){for(var _0x2a7d5b in _0x3c30cf){if(_0x3c30cf[_0x3bf3('0x27')](_0x2a7d5b)){_0x3c30cf[_0x2a7d5b]['ivrTotalCallsDays']=0x0;_0x3c30cf[_0x2a7d5b][_0x3bf3('0x31')]=0x0;}}}}function clearVoiceQueues(_0x20b215){if(!_[_0x3bf3('0x30')](_0x20b215)){for(var _0x55aa06 in _0x20b215){if(_0x20b215[_0x3bf3('0x27')](_0x55aa06)){_0x20b215[_0x55aa06]['total']=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x2d')]=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x32')]=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x33')]=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x2e')]=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x2f')]=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x34')]=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x35')]=0x0;_0x20b215[_0x55aa06]['outboundNoAnswerCallsDay']=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x36')]=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x37')]=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x38')]=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x39')]=0x0;_0x20b215[_0x55aa06]['outboundDropCallsDayTimeout']=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x3a')]=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x3b')]=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x3c')]=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x3d')]=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x3e')]=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x35')]=0x0;_0x20b215[_0x55aa06][_0x3bf3('0x3f')]=0x0;_0x20b215[_0x55aa06]['queueStatusComplete']=!![];}}}}Realtime[_0x3bf3('0x40')][_0x3bf3('0x41')]=function(_0x370a9d,_0x2a92c7){for(var _0x27ff72 in _0x2a92c7){if(_0x370a9d[_0x3bf3('0x27')](_0x27ff72)){_0x370a9d[_0x27ff72]=_0x2a92c7[_0x27ff72];}}};Realtime[_0x3bf3('0x40')][_0x3bf3('0x42')]=function(){var _0x16a416=this;return function(_0x3e18d8){if(_0x3e18d8){freeIsNotKeyAgent(_0x3e18d8,_0x16a416['agents']);for(var _0x4d530a=0x0,_0x35cb81={},_0x457332={};_0x4d530a<_0x3e18d8[_0x3bf3('0x43')];_0x4d530a+=0x1){_0x35cb81=_0x3e18d8[_0x4d530a];var _0x51821d=_[_0x3bf3('0x44')](_0x35cb81[_0x3bf3('0x2b')])?util[_0x3bf3('0x28')](_0x3bf3('0x29'),_0x35cb81['name']):_0x35cb81[_0x3bf3('0x2b')];if(_[_0x3bf3('0x45')](_0x16a416['agents'][_0x51821d])){_0x16a416[_0x3bf3('0x12')][_0x51821d]=new Agent(_0x35cb81);}else{_0x16a416[_0x3bf3('0x41')](_0x16a416[_0x3bf3('0x12')][_0x51821d],_0x35cb81);}}}return _0x16a416[_0x3bf3('0x12')];};};Realtime[_0x3bf3('0x40')][_0x3bf3('0x46')]=function(){var _0x2bb7a6=this;return function(_0x33b444){if(_0x33b444){freeIsNotKeySip(_0x33b444,_0x2bb7a6[_0x3bf3('0x13')]);for(var _0x9515c1=0x0,_0x35f94a={},_0x2cd966={};_0x9515c1<_0x33b444['length'];_0x9515c1+=0x1){_0x35f94a=_0x33b444[_0x9515c1];if(_[_0x3bf3('0x45')](_0x2bb7a6[_0x3bf3('0x13')][util[_0x3bf3('0x28')](_0x3bf3('0x29'),_0x35f94a[_0x3bf3('0x2a')])])){_0x2bb7a6[_0x3bf3('0x13')][util[_0x3bf3('0x28')](_0x3bf3('0x29'),_0x35f94a[_0x3bf3('0x2a')])]=new Telephone(_0x35f94a);}else{_0x2bb7a6[_0x3bf3('0x41')](_0x2bb7a6[_0x3bf3('0x13')][util[_0x3bf3('0x28')]('SIP/%s',_0x35f94a[_0x3bf3('0x2a')])],_0x35f94a);}}}return _0x2bb7a6[_0x3bf3('0x13')];};};Realtime['prototype'][_0x3bf3('0x47')]=function(){var _0x44c2fa=this;return function(_0x5412b1){if(_0x5412b1){freeIsNotKeySip(_0x5412b1,_0x44c2fa[_0x3bf3('0x14')]);for(var _0x15f415=0x0,_0x4c8f02={},_0x959ac5={};_0x15f415<_0x5412b1[_0x3bf3('0x43')];_0x15f415+=0x1){_0x4c8f02=_0x5412b1[_0x15f415];if(_[_0x3bf3('0x45')](_0x44c2fa['trunks'][util[_0x3bf3('0x28')](_0x3bf3('0x29'),_0x4c8f02[_0x3bf3('0x2a')])])){_0x44c2fa[_0x3bf3('0x14')][util[_0x3bf3('0x28')](_0x3bf3('0x29'),_0x4c8f02['name'])]=new Trunk(_0x4c8f02);}else{_0x44c2fa[_0x3bf3('0x41')](_0x44c2fa[_0x3bf3('0x14')][util[_0x3bf3('0x28')](_0x3bf3('0x29'),_0x4c8f02[_0x3bf3('0x2a')])],_0x4c8f02);}}}return _0x44c2fa[_0x3bf3('0x14')];};};Realtime[_0x3bf3('0x40')][_0x3bf3('0x48')]=function(){var _0x2b15d0=this;return function(_0x2f3380){if(_0x2f3380){freeIsNotKey(_0x2f3380,_0x2b15d0[_0x3bf3('0x49')],_0x3bf3('0x2a'));for(var _0x5ded38=0x0,_0x43a74b={},_0x50e35d={};_0x5ded38<_0x2f3380[_0x3bf3('0x43')];_0x5ded38+=0x1){_0x43a74b=_0x2f3380[_0x5ded38];if(_[_0x3bf3('0x45')](_0x2b15d0[_0x3bf3('0x49')][_0x43a74b[_0x3bf3('0x2a')]])){_0x2b15d0[_0x3bf3('0x49')][_0x43a74b[_0x3bf3('0x2a')]]=new VoiceQueue(_0x43a74b);}else{_0x2b15d0[_0x3bf3('0x41')](_0x2b15d0[_0x3bf3('0x49')][_0x43a74b[_0x3bf3('0x2a')]],_0x43a74b);}}}return _0x2b15d0['voiceQueues'];};};Realtime[_0x3bf3('0x40')][_0x3bf3('0x4a')]=function(){var _0x24e384=this;return function(_0x54ee20){if(_0x54ee20){freeIsNotKey(_0x54ee20,_0x24e384['triggers'],'id');for(var _0x2105ef=0x0,_0x26b357={},_0x43f696={};_0x2105ef<_0x54ee20['length'];_0x2105ef+=0x1){_0x26b357=_0x54ee20[_0x2105ef];if(_[_0x3bf3('0x45')](_0x24e384[_0x3bf3('0x15')][_0x26b357['id']])){_0x24e384[_0x3bf3('0x15')][_0x26b357['id']]=new Trigger(_0x26b357);}else{_0x24e384[_0x3bf3('0x41')](_0x24e384[_0x3bf3('0x15')][_0x26b357['id']],_0x26b357);}}}return _0x24e384[_0x3bf3('0x15')];};};Realtime['prototype'][_0x3bf3('0x4b')]=function(){var _0x5cf226=this;return function(_0x288102){if(_0x288102){freeIsNotKey(_0x288102,_0x5cf226[_0x3bf3('0x17')],'id');for(var _0x52be7e=0x0,_0x2019f3={},_0xc6d3f3={};_0x52be7e<_0x288102['length'];_0x52be7e+=0x1){_0x2019f3=_0x288102[_0x52be7e];if(_['isUndefined'](_0x5cf226['templates'][_0x2019f3['id']])){_0x5cf226[_0x3bf3('0x17')][_0x2019f3['id']]=new Template(_0x2019f3);}else{_0x5cf226[_0x3bf3('0x41')](_0x5cf226['templates'][_0x2019f3['id']],_0x2019f3);}}}return _0x5cf226[_0x3bf3('0x17')];};};Realtime[_0x3bf3('0x40')][_0x3bf3('0x4c')]=function(){var _0x4a7ea4=this;return function(_0x94224){if(_0x94224){freeIsNotKey(_0x94224,_0x4a7ea4[_0x3bf3('0x1c')],'id');for(var _0x553603=0x0,_0x3ca212={},_0x5015ac={};_0x553603<_0x94224['length'];_0x553603+=0x1){_0x3ca212=_0x94224[_0x553603];if(_[_0x3bf3('0x45')](_0x4a7ea4['zendeskAccounts'][_0x3ca212['id']])){_0x4a7ea4[_0x3bf3('0x1c')][_0x3ca212['id']]=new ZendeskAccount(_0x3ca212);}else{_0x4a7ea4[_0x3bf3('0x41')](_0x4a7ea4[_0x3bf3('0x1c')][_0x3ca212['id']],_0x3ca212);}}}return _0x4a7ea4[_0x3bf3('0x1c')];};};Realtime['prototype'][_0x3bf3('0x4d')]=function(){var _0x3cfd4c=this;return function(_0x37a702){if(_0x37a702){freeIsNotKey(_0x37a702,_0x3cfd4c[_0x3bf3('0x4e')],'id');for(var _0xc39bbf=0x0,_0x1e9e60={},_0x508e0a={};_0xc39bbf<_0x37a702[_0x3bf3('0x43')];_0xc39bbf+=0x1){_0x1e9e60=_0x37a702[_0xc39bbf];if(_[_0x3bf3('0x45')](_0x3cfd4c[_0x3bf3('0x4e')][_0x1e9e60['id']])){_0x3cfd4c[_0x3bf3('0x4e')][_0x1e9e60['id']]=new SalesforceAccount(_0x1e9e60);}else{_0x3cfd4c[_0x3bf3('0x41')](_0x3cfd4c[_0x3bf3('0x4e')][_0x1e9e60['id']],_0x1e9e60);}}}return _0x3cfd4c['salesforceAccounts'];};};Realtime[_0x3bf3('0x40')][_0x3bf3('0x4f')]=function(){var _0x5273e3=this;return function(_0xcd6b77){if(_0xcd6b77){freeIsNotKey(_0xcd6b77,_0x5273e3[_0x3bf3('0x1e')],'id');for(var _0x41c659=0x0,_0x26624f={},_0x315f72={};_0x41c659<_0xcd6b77[_0x3bf3('0x43')];_0x41c659+=0x1){_0x26624f=_0xcd6b77[_0x41c659];if(_[_0x3bf3('0x45')](_0x5273e3[_0x3bf3('0x1e')][_0x26624f['id']])){_0x5273e3[_0x3bf3('0x1e')][_0x26624f['id']]=new FreshdeskAccount(_0x26624f);}else{_0x5273e3['mergeFromDatabase'](_0x5273e3[_0x3bf3('0x1e')][_0x26624f['id']],_0x26624f);}}}return _0x5273e3['freshdeskAccounts'];};};Realtime[_0x3bf3('0x40')][_0x3bf3('0x50')]=function(){var _0x4357bd=this;return function(_0x1e5fe4){if(_0x1e5fe4){freeIsNotKey(_0x1e5fe4,_0x4357bd['zohoAccounts'],'id');for(var _0x22a539=0x0,_0x29ea3b={},_0x3325d0={};_0x22a539<_0x1e5fe4['length'];_0x22a539+=0x1){_0x29ea3b=_0x1e5fe4[_0x22a539];if(_[_0x3bf3('0x45')](_0x4357bd[_0x3bf3('0x1f')][_0x29ea3b['id']])){_0x4357bd[_0x3bf3('0x1f')][_0x29ea3b['id']]=new ZohoAccount(_0x29ea3b);}else{_0x4357bd[_0x3bf3('0x41')](_0x4357bd['zohoAccounts'][_0x29ea3b['id']],_0x29ea3b);}}}return _0x4357bd[_0x3bf3('0x1f')];};};Realtime[_0x3bf3('0x40')][_0x3bf3('0x51')]=function(){var _0x5d9768=this;return function(_0x43d3ac){if(_0x43d3ac){freeIsNotKey(_0x43d3ac,_0x5d9768[_0x3bf3('0x20')],'id');for(var _0x295374=0x0,_0x4d606b={},_0x3e9abc={};_0x295374<_0x43d3ac[_0x3bf3('0x43')];_0x295374+=0x1){_0x4d606b=_0x43d3ac[_0x295374];if(_[_0x3bf3('0x45')](_0x5d9768[_0x3bf3('0x20')][_0x4d606b['id']])){_0x5d9768[_0x3bf3('0x20')][_0x4d606b['id']]=new DeskAccount(_0x4d606b);}else{_0x5d9768['mergeFromDatabase'](_0x5d9768['deskAccounts'][_0x4d606b['id']],_0x4d606b);}}}return _0x5d9768[_0x3bf3('0x20')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x171ea8=this;return function(_0x2d8920){if(_0x2d8920){freeIsNotKey(_0x2d8920,_0x171ea8[_0x3bf3('0x1d')],'id');for(var _0x1a439f=0x0,_0x4978b0={},_0x183e92={};_0x1a439f<_0x2d8920[_0x3bf3('0x43')];_0x1a439f+=0x1){_0x4978b0=_0x2d8920[_0x1a439f];if(_['isUndefined'](_0x171ea8[_0x3bf3('0x1d')][_0x4978b0['id']])){_0x171ea8['sugarcrmAccounts'][_0x4978b0['id']]=new SugarcrmAccount(_0x4978b0);}else{_0x171ea8[_0x3bf3('0x41')](_0x171ea8[_0x3bf3('0x1d')][_0x4978b0['id']],_0x4978b0);}}}return _0x171ea8[_0x3bf3('0x1d')];};};Realtime[_0x3bf3('0x40')][_0x3bf3('0x52')]=function(){var _0x328f4f=this;return function(_0x3363b2){if(_0x3363b2){freeIsNotKey(_0x3363b2,_0x328f4f[_0x3bf3('0x21')],'id');for(var _0x5458b9=0x0,_0x34e3e4={},_0xef0134={};_0x5458b9<_0x3363b2['length'];_0x5458b9+=0x1){_0x34e3e4=_0x3363b2[_0x5458b9];if(_[_0x3bf3('0x45')](_0x328f4f[_0x3bf3('0x21')][_0x34e3e4['id']])){_0x328f4f['vtigerAccounts'][_0x34e3e4['id']]=new VtigerAccount(_0x34e3e4);}else{_0x328f4f[_0x3bf3('0x41')](_0x328f4f[_0x3bf3('0x21')][_0x34e3e4['id']],_0x34e3e4);}}}return _0x328f4f[_0x3bf3('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0xc2a2fb=this;return function(_0x12ae4c){if(_0x12ae4c){freeIsNotKey(_0x12ae4c,_0xc2a2fb[_0x3bf3('0x22')],'id');for(var _0x250b19=0x0,_0x5249ca={},_0x3edca4={};_0x250b19<_0x12ae4c[_0x3bf3('0x43')];_0x250b19+=0x1){_0x5249ca=_0x12ae4c[_0x250b19];if(_[_0x3bf3('0x45')](_0xc2a2fb[_0x3bf3('0x22')][_0x5249ca['id']])){_0xc2a2fb[_0x3bf3('0x22')][_0x5249ca['id']]=new ServicenowAccount(_0x5249ca);}else{_0xc2a2fb['mergeFromDatabase'](_0xc2a2fb[_0x3bf3('0x22')][_0x5249ca['id']],_0x5249ca);}}}return _0xc2a2fb[_0x3bf3('0x22')];};};Realtime[_0x3bf3('0x40')][_0x3bf3('0x53')]=function(){var _0x38a1e6=this;return function(_0x62005d){if(_0x62005d){freeIsNotKey(_0x62005d,_0x38a1e6['dynamics365Accounts'],'id');for(var _0x407559=0x0,_0x10847={},_0x5d6c94={};_0x407559<_0x62005d[_0x3bf3('0x43')];_0x407559+=0x1){_0x10847=_0x62005d[_0x407559];if(_['isUndefined'](_0x38a1e6[_0x3bf3('0x23')][_0x10847['id']])){_0x38a1e6[_0x3bf3('0x23')][_0x10847['id']]=new Dynamics365Account(_0x10847);}else{_0x38a1e6[_0x3bf3('0x41')](_0x38a1e6['dynamics365Accounts'][_0x10847['id']],_0x10847);}}}return _0x38a1e6[_0x3bf3('0x23')];};};Realtime[_0x3bf3('0x40')][_0x3bf3('0x54')]=function(){var _0x4f55ad=this;return function(_0x3a5257){if(_0x3a5257){freeIsNotKey(_0x3a5257,_0x4f55ad['freshsalesAccounts'],'id');for(var _0x37b782=0x0,_0x5f3dde={},_0xfb9a6b={};_0x37b782<_0x3a5257[_0x3bf3('0x43')];_0x37b782+=0x1){_0x5f3dde=_0x3a5257[_0x37b782];if(_[_0x3bf3('0x45')](_0x4f55ad['freshsalesAccounts'][_0x5f3dde['id']])){_0x4f55ad[_0x3bf3('0x24')][_0x5f3dde['id']]=new FreshsalesAccount(_0x5f3dde);}else{_0x4f55ad[_0x3bf3('0x41')](_0x4f55ad[_0x3bf3('0x24')][_0x5f3dde['id']],_0x5f3dde);}}}return _0x4f55ad[_0x3bf3('0x24')];};};Realtime[_0x3bf3('0x40')][_0x3bf3('0x55')]=function(){var _0x3535f1=this;return function(_0x3aa530){for(var _0x265913=0x0;_0x265913<_0x3aa530[_0x3bf3('0x43')];_0x265913+=0x1){_[_0x3bf3('0x56')](_0x3535f1[_0x3bf3('0x49')][_0x3aa530[_0x265913][_0x3bf3('0x2a')]],_0x3aa530[_0x265913]);}return _0x3535f1[_0x3bf3('0x49')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0xadef40=this;return function(_0x320cee){clearVoiceQueues(_0xadef40[_0x3bf3('0x49')]);if(_0x320cee){_0x320cee=_[_0x3bf3('0x57')](_0x320cee,_0x3bf3('0x58'));for(var _0x3518e3 in _0x320cee){if(_0x320cee['hasOwnProperty'](_0x3518e3)){var _0x45eb93={};for(var _0x1cd924=0x0;_0x1cd924<_0x320cee[_0x3518e3][_0x3bf3('0x43')];_0x1cd924+=0x1){var _0x7e7f5a=_0x320cee[_0x3518e3][_0x1cd924][_0x3bf3('0x59')];if(_0xadef40[_0x3bf3('0x49')][_0x7e7f5a]){if(_0x320cee[_0x3518e3][_0x1cd924][_0x3bf3('0x5a')]){_0xadef40['voiceQueues'][_0x7e7f5a][_0x3bf3('0x32')]+=0x1;}if(_0x320cee[_0x3518e3][_0x1cd924][_0x3bf3('0x5b')]){_0xadef40['voiceQueues'][_0x7e7f5a][_0x3bf3('0x33')]+=0x1;}_0xadef40['voiceQueues'][_0x7e7f5a][_0x3bf3('0x2e')]+=moment(_0x320cee[_0x3518e3][_0x1cd924]['queuecallerleaveAt'])['diff'](moment(_0x320cee[_0x3518e3][_0x1cd924]['queuecallerjoinAt']),_0x3bf3('0x5c'))||0x0;if(_0x1cd924===_0x320cee[_0x3518e3][_0x3bf3('0x43')]-0x1){_0xadef40[_0x3bf3('0x49')][_0x7e7f5a][_0x3bf3('0x2f')]+=moment(_0x320cee[_0x3518e3][_0x1cd924]['queuecallercompleteAt']||_0x320cee[_0x3518e3][_0x1cd924][_0x3bf3('0x5d')]||_0x320cee[_0x3518e3][_0x1cd924][_0x3bf3('0x5e')])[_0x3bf3('0x5f')](moment(_0x320cee[_0x3518e3][_0x1cd924]['queuecallerjoinAt']),_0x3bf3('0x5c'))||0x0;_0xadef40[_0x3bf3('0x49')][_0x7e7f5a][_0x3bf3('0x2c')]+=0x1;if(_0x320cee[_0x3518e3][_0x1cd924][_0x3bf3('0x60')]){_0xadef40[_0x3bf3('0x49')][_0x7e7f5a][_0x3bf3('0x2d')]+=0x1;_0xadef40[_0x3bf3('0x49')][_0x7e7f5a][_0x3bf3('0x34')]+=moment(_0x320cee[_0x3518e3][_0x1cd924][_0x3bf3('0x61')])[_0x3bf3('0x5f')](moment(_0x320cee[_0x3518e3][_0x1cd924][_0x3bf3('0x62')]),'seconds')||0x0;}}else{_0xadef40[_0x3bf3('0x49')][_0x7e7f5a][_0x3bf3('0x2f')]+=_0xadef40[_0x3bf3('0x49')][_0x7e7f5a][_0x3bf3('0x2e')]||0x0;}}}}}}return _0xadef40[_0x3bf3('0x49')];};};Realtime[_0x3bf3('0x40')][_0x3bf3('0x63')]=function(){var _0x8ca9f0=this;return function(_0x1a6089){clearVoiceCallReports(_0x8ca9f0[_0x3bf3('0x18')]);if(_0x1a6089){for(var _0x51b238=0x0;_0x51b238<_0x1a6089[_0x3bf3('0x43')];_0x51b238+=0x1){_0x8ca9f0[_0x3bf3('0x18')][_0x3bf3('0x2c')]+=0x1;_0x8ca9f0[_0x3bf3('0x18')][_0x3bf3('0x2f')]+=_0x1a6089[_0x51b238]['duration'];if(_0x1a6089[_0x51b238][_0x3bf3('0x64')]===_0x3bf3('0x65')){_0x8ca9f0[_0x3bf3('0x18')]['answered']+=0x1;_0x8ca9f0[_0x3bf3('0x18')]['sumHoldTime']+=_0x1a6089[_0x51b238]['duration']-_0x1a6089[_0x51b238]['billableseconds']||0x0;_0x8ca9f0[_0x3bf3('0x18')]['sumBillable']+=_0x1a6089[_0x51b238]['billableseconds'];}}}return _0x8ca9f0[_0x3bf3('0x18')];};};Realtime[_0x3bf3('0x40')]['initCampaigns']=function(){var _0x504545=this;return function(_0xffd6b0){if(_0xffd6b0){freeIsNotKey(_0xffd6b0,_0x504545[_0x3bf3('0x16')],_0x3bf3('0x2a'));for(var _0x13cca6=0x0,_0x2d3bad={};_0x13cca6<_0xffd6b0[_0x3bf3('0x43')];_0x13cca6+=0x1){_0x2d3bad=_0xffd6b0[_0x13cca6];if(_[_0x3bf3('0x45')](_0x504545[_0x3bf3('0x16')][_0x2d3bad[_0x3bf3('0x2a')]])){_0x504545['campaigns'][_0x2d3bad['name']]=new Campaign(_0x2d3bad);}else{_0x504545[_0x3bf3('0x41')](_0x504545['campaigns'][_0x2d3bad[_0x3bf3('0x2a')]],_0x2d3bad);_0x504545[_0x3bf3('0x16')][_0x2d3bad[_0x3bf3('0x2a')]]['dialQueueProject']=_0x2d3bad[_0x3bf3('0x66')]?_0x2d3bad[_0x3bf3('0x66')][_0x3bf3('0x2a')]:undefined;}}}return _0x504545[_0x3bf3('0x16')];};};Realtime[_0x3bf3('0x40')]['initVoiceExtensions']=function(){var _0xab2219=this;return function(_0x52feed){if(_0x52feed){freeIsNotKey(_0x52feed,_0xab2219[_0x3bf3('0x67')],'id');for(var _0x5d16f8=0x0,_0x1915c8={};_0x5d16f8<_0x52feed[_0x3bf3('0x43')];_0x5d16f8+=0x1){_0x1915c8=_0x52feed[_0x5d16f8];if(_['isUndefined'](_0xab2219['voiceExtensions'][_0x1915c8['id']])){_0xab2219[_0x3bf3('0x67')][_0x1915c8['id']]=new VoiceExtension(_0x1915c8);}else{_0xab2219['mergeFromDatabase'](_0xab2219[_0x3bf3('0x67')][_0x1915c8['id']],_0x1915c8);}}}return _0xab2219[_0x3bf3('0x67')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x164be7=this;return function(_0x1980f2){clearCampaigns(_0x164be7[_0x3bf3('0x16')]);for(var _0x5c5494=0x0;_0x5c5494<_0x1980f2[_0x3bf3('0x43')];_0x5c5494+=0x1){_[_0x3bf3('0x56')](_0x164be7[_0x3bf3('0x16')][_0x1980f2[_0x5c5494]['name']],_0x1980f2[_0x5c5494]);}return _0x164be7[_0x3bf3('0x16')];};};Realtime[_0x3bf3('0x40')][_0x3bf3('0x68')]=function(){var _0x5b4a83=this;return function(_0x461453){if(_0x461453){freeIsNotKey(_0x461453,_0x5b4a83[_0x3bf3('0x25')],'id');for(var _0x19bdde=0x0,_0x1caaee={},_0x2b9f0a={};_0x19bdde<_0x461453[_0x3bf3('0x43')];_0x19bdde+=0x1){_0x1caaee=_0x461453[_0x19bdde];if(_['isUndefined'](_0x5b4a83[_0x3bf3('0x25')][_0x1caaee['id']])){_0x5b4a83[_0x3bf3('0x25')][_0x1caaee['id']]=new FaxAccount(_0x1caaee);}else{_0x5b4a83[_0x3bf3('0x41')](_0x5b4a83[_0x3bf3('0x25')][_0x1caaee['id']],_0x1caaee);}}}return _0x5b4a83[_0x3bf3('0x25')];};};module[_0x3bf3('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 7ca6422..45245d1 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 _0xadb9=['blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','isNil','accountcode','interface','format','SIP/%s','voiceQueueReport','connectedlinenum','assigned','lastAssignedTo','name','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','ANSWERED','transfers','linkedid','create','monitor','monitors','length','filename','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','substring','mobile','phone','indexOf','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./userReport','realtime','agents','telephones','prototype','xdr','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport'];(function(_0xfab68e,_0x24ffff){var _0x4e9380=function(_0x59b6fa){while(--_0x59b6fa){_0xfab68e['push'](_0xfab68e['shift']());}};_0x4e9380(++_0x24ffff);}(_0xadb9,0x188));var _0x9adb=function(_0x20b8d,_0x471e78){_0x20b8d=_0x20b8d-0x0;var _0x44b833=_0xadb9[_0x20b8d];return _0x44b833;};'use strict';var _=require(_0x9adb('0x0'));var moment=require(_0x9adb('0x1'));var util=require(_0x9adb('0x2'));var config=require(_0x9adb('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x9adb('0x4'));var RpcVoiceCallReport=require(_0x9adb('0x5'));var RpcVoiceDialReport=require(_0x9adb('0x6'));var RpcMemberReport=require(_0x9adb('0x7'));var RpcVoiceQueueReport=require(_0x9adb('0x8'));var RpcVoiceRecording=require(_0x9adb('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x9adb('0xa'));var VoiceCallReport=require(_0x9adb('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x9adb('0xc'));function Report(_0x568761){this[_0x9adb('0xd')]=_0x568761;this[_0x9adb('0xe')]=_0x568761[_0x9adb('0xe')];this[_0x9adb('0xf')]=_0x568761[_0x9adb('0xf')];}Report[_0x9adb('0x10')]['sync']=function(_0x5b38e3){var _0x2c107c=new VoiceQueueReport(this[_0x9adb('0xd')]);var _0x418d2d=new VoiceAgentReport(this[_0x9adb('0xd')]);var _0x291521=new VoiceDialReport(this[_0x9adb('0xd')]);var _0xe3a882=new VoiceCallReport(this[_0x9adb('0xd')]);var _0x1c4672=new UserReport(this[_0x9adb('0xd')]);if(config['xdr']&&config[_0x9adb('0x11')]['disabled']){ami['on']('custom:voiceQueueReport',this['voiceQueueReport']['bind'](this));ami['on']('custom:voiceCallReport',this[_0x9adb('0x12')][_0x9adb('0x13')](this));ami['on'](_0x9adb('0x14'),this[_0x9adb('0x15')][_0x9adb('0x13')](this));ami['on'](_0x9adb('0x16'),this['voiceDialReport'][_0x9adb('0x13')](this));ami['on'](_0x9adb('0x17'),this[_0x9adb('0x18')][_0x9adb('0x13')](this));ami['on'](_0x9adb('0x19'),this[_0x9adb('0x1a')][_0x9adb('0x13')](this));}};Report[_0x9adb('0x10')][_0x9adb('0x1b')]=function(_0x36260d){var _0x4cc329;_0x4cc329=_[_0x9adb('0x1c')](this['agents'],function(_0x8827f2){return _0x8827f2['accountcode']==_0x36260d||_0x8827f2['name']==_0x36260d;});if(_[_0x9adb('0x1d')](_0x4cc329)){var _0x9eafde=_['find'](this['telephones'],function(_0x31103b){return _0x31103b[_0x9adb('0x1e')]==_0x36260d||_0x31103b['name']==_0x36260d;});if(_0x9eafde){_0x4cc329=_[_0x9adb('0x1c')](this[_0x9adb('0xe')],function(_0x46fb9e){return _0x46fb9e[_0x9adb('0x1f')]==util[_0x9adb('0x20')](_0x9adb('0x21'),_0x9eafde['name']);});}}return _0x4cc329;};Report[_0x9adb('0x10')][_0x9adb('0x22')]=function(_0x6bd8ca){for(var _0x2bd13c=0x0;_0x2bd13c<_0x6bd8ca['length'];_0x2bd13c+=0x1){var _0x4c13d5=this[_0x9adb('0x1b')](_0x6bd8ca[_0x2bd13c][_0x9adb('0x23')]);if(_0x4c13d5){_0x6bd8ca[_0x2bd13c]['accountcode']=_0x4c13d5['accountcode'];_0x6bd8ca[_0x2bd13c][_0x9adb('0x24')]=!![];_0x6bd8ca[_0x2bd13c][_0x9adb('0x25')]=_0x4c13d5['name'];_0x6bd8ca[_0x2bd13c][_0x9adb('0x1f')]=_['isNil'](_0x4c13d5[_0x9adb('0x1f')])?util[_0x9adb('0x20')](_0x9adb('0x21'),_0x4c13d5[_0x9adb('0x26')]):_0x4c13d5[_0x9adb('0x1f')];if(_0x6bd8ca[_0x2bd13c][_0x9adb('0x27')]){_0x6bd8ca[_0x2bd13c]['queuecallercompleteAt']=moment()[_0x9adb('0x20')](_0x9adb('0x28'));}if(_0x6bd8ca[_0x2bd13c]['queuecallerexit']){_0x6bd8ca[_0x2bd13c]['queuecallerexitAt']=moment()[_0x9adb('0x20')](_0x9adb('0x28'));}RpcMemberReport[_0x9adb('0x22')](_0x6bd8ca[_0x2bd13c]);}RpcVoiceQueueReport['create'](_0x6bd8ca[_0x2bd13c]);}};function extractCalleridNumber(_0x1ce746){var _0x1ffa10=_0x1ce746[_0x9adb('0x29')](/<(.*?)>/);return _0x1ffa10?_0x1ffa10[0x1]:_0x1ce746;}Report[_0x9adb('0x10')][_0x9adb('0x12')]=function(_0x599df7){_0x599df7[_0x9adb('0x2a')]=_0x599df7[_0x9adb('0x2a')]||_0x599df7[_0x9adb('0x2b')];if(_0x599df7[_0x9adb('0x2c')]==_0x9adb('0x2d')){_0x599df7[_0x9adb('0x2e')]=_0x9adb('0x2f');_0x599df7[_0x9adb('0x30')]=_0x599df7[_0x9adb('0x2f')];if(_0x599df7[_0x9adb('0x31')]=='from-voip-provider'){_0x599df7['accountcode']='';_0x599df7[_0x9adb('0x2a')]=extractCalleridNumber(_0x599df7[_0x9adb('0x32')]);}else if(_0x599df7[_0x9adb('0x31')]==_0x9adb('0x33')){if(_0x599df7[_0x9adb('0x2a')]==_0x9adb('0x34')){_0x599df7[_0x9adb('0x2a')]=extractCalleridNumber(_0x599df7[_0x9adb('0x35')]);_0x599df7[_0x9adb('0x36')]=_0x599df7[_0x9adb('0x37')];_0x599df7['destinationchannel']=[_0x599df7[_0x9adb('0x38')],_0x599df7['channel']=_0x599df7[_0x9adb('0x39')]][0x0];_0x599df7[_0x9adb('0x32')]=_0x599df7[_0x9adb('0x35')];}else{_0x599df7[_0x9adb('0x2a')]=_0x599df7['calleridnum'];_0x599df7[_0x9adb('0x36')]=_0x599df7[_0x9adb('0x37')];if(_0x599df7[_0x9adb('0x3a')]==_0x9adb('0x3b')){_0x599df7[_0x9adb('0x1e')]=_0x599df7[_0x9adb('0x23')];}else{_0x599df7[_0x9adb('0x1e')]='';}}}}else{_0x599df7[_0x9adb('0x32')]=util[_0x9adb('0x20')]('\x22%s\x22\x20<%s>',_0x599df7['calleridname'],_0x599df7['calleridnum']);}if(RpcVoiceTransferReport[_0x9adb('0x3c')][_0x599df7['linkedid']]){var _0x56cabb=RpcVoiceTransferReport[_0x9adb('0x3c')][_0x599df7[_0x9adb('0x3d')]];_0x56cabb['transfereelinkedid']=_0x599df7['uniqueid'];RpcVoiceTransferReport[_0x9adb('0x18')](_0x56cabb);delete RpcVoiceTransferReport['transfers'][_0x599df7[_0x9adb('0x3d')]];}RpcVoiceCallReport[_0x9adb('0x3e')](_0x599df7);if(_0x599df7[_0x9adb('0x3f')]){for(var _0x496bc4=0x0;_0x496bc4<_0x599df7[_0x9adb('0x40')][_0x9adb('0x41')];_0x496bc4+=0x1){_0x599df7['monitorFilename']=_0x599df7[_0x9adb('0x40')][_0x496bc4][_0x9adb('0x42')];_0x599df7['createdAt']=_0x599df7[_0x9adb('0x40')][_0x496bc4][_0x9adb('0x43')];if(_0x599df7['exten']==_0x9adb('0x34')){_0x599df7[_0x9adb('0x36')]=_0x599df7[_0x9adb('0x23')];_0x599df7[_0x9adb('0x44')]=_0x599df7[_0x9adb('0x45')];_0x599df7[_0x9adb('0x23')]=_0x599df7[_0x9adb('0x1e')];_0x599df7[_0x9adb('0x45')]=_0x599df7[_0x9adb('0x46')];_0x599df7[_0x9adb('0x2b')]=_0x599df7['originatecalleridnum'];}else if(_0x599df7['exten']==_0x9adb('0x47')){_0x599df7[_0x9adb('0x36')]=_0x599df7[_0x9adb('0x2a')];_0x599df7[_0x9adb('0x2b')]=_0x599df7[_0x9adb('0x37')];}RpcVoiceRecording[_0x9adb('0x3e')](_0x599df7);}}};Report[_0x9adb('0x10')][_0x9adb('0x15')]=function(_0x2309e1){if(_[_0x9adb('0x48')](_0x2309e1)){_0x2309e1[_0x9adb('0x49')](function(_0x2c71e8){RpcVoiceAgentReport[_0x9adb('0x3e')](_0x2c71e8);});}else{RpcVoiceAgentReport[_0x9adb('0x3e')](_0x2309e1);}};Report[_0x9adb('0x10')][_0x9adb('0x4a')]=function(_0x1bfc56){RpcVoiceDialReport['create'](_0x1bfc56);var _0x1cc446;var _0x30e827;var _0x20a0ca=_0x1bfc56[_0x9adb('0x38')];if(_[_0x9adb('0x4b')](_0x20a0ca,'Local')){_0x30e827=_0x20a0ca[_0x9adb('0x4c')](_0x20a0ca['indexOf']('/')+0x1,_0x20a0ca['indexOf']('@'));_0x1cc446=_[_0x9adb('0x1c')](this[_0x9adb('0xe')],function(_0x307b75){return _0x307b75[_0x9adb('0x4d')]==_0x30e827||_0x307b75[_0x9adb('0x4e')]==_0x30e827||_0x307b75[_0x9adb('0x1e')]==_0x30e827;});}else{_0x30e827=_0x20a0ca[_0x9adb('0x4c')](_0x20a0ca[_0x9adb('0x4f')]('/')+0x1,_0x20a0ca[_0x9adb('0x50')]('-'));_0x1cc446=this[_0x9adb('0x1b')](_0x30e827);}if(_0x1cc446){_0x1bfc56[_0x9adb('0x1f')]=_[_0x9adb('0x1d')](_0x1cc446['interface'])?util[_0x9adb('0x20')]('SIP/%s',_0x1cc446[_0x9adb('0x26')]):_0x1cc446[_0x9adb('0x1f')];_0x1bfc56[_0x9adb('0x46')]=_0x1cc446[_0x9adb('0x26')];_0x1bfc56[_0x9adb('0x1e')]=_0x1cc446['accountcode'];RpcMemberReport[_0x9adb('0x4a')](_0x1bfc56);}};Report[_0x9adb('0x10')][_0x9adb('0x18')]=function(_0x41807d){RpcVoiceTransferReport[_0x9adb('0x3c')][_0x41807d[_0x9adb('0x51')]]=_0x41807d;};Report['prototype'][_0x9adb('0x1a')]=function(_0x3a151a){RpcVoiceTransferReport[_0x9adb('0x1a')](_0x3a151a);};module[_0x9adb('0x52')]=Report; \ No newline at end of file +var _0x4f06=['xcally-motion-dialer','voiceAgentReport','isArray','startsWith','Local','substring','indexOf','lastIndexOf','exports','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','interface','format','SIP/%s','voiceQueueReport','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','destination','exten','type','dialer','lastapplication','queue','context','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','length','monitorFilename','filename','monitors','membername'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f06,0x18f));var _0x64f0=function(_0x2e07b8,_0x44d712){_0x2e07b8=_0x2e07b8-0x0;var _0x16c432=_0x4f06[_0x2e07b8];return _0x16c432;};'use strict';var _=require('lodash');var moment=require(_0x64f0('0x0'));var util=require(_0x64f0('0x1'));var config=require(_0x64f0('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x64f0('0x3'));var RpcVoiceCallReport=require(_0x64f0('0x4'));var RpcVoiceDialReport=require(_0x64f0('0x5'));var RpcMemberReport=require(_0x64f0('0x6'));var RpcVoiceQueueReport=require(_0x64f0('0x7'));var RpcVoiceRecording=require(_0x64f0('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x64f0('0x9'));var VoiceCallReport=require(_0x64f0('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x64f0('0xb'));var UserReport=require(_0x64f0('0xc'));function Report(_0x57cdba){this[_0x64f0('0xd')]=_0x57cdba;this['agents']=_0x57cdba[_0x64f0('0xe')];this[_0x64f0('0xf')]=_0x57cdba[_0x64f0('0xf')];}Report[_0x64f0('0x10')][_0x64f0('0x11')]=function(_0x11e8b4){var _0x3cfef5=new VoiceQueueReport(this[_0x64f0('0xd')]);var _0x58608b=new VoiceAgentReport(this[_0x64f0('0xd')]);var _0x780ad4=new VoiceDialReport(this[_0x64f0('0xd')]);var _0x588311=new VoiceCallReport(this[_0x64f0('0xd')]);var _0x8fda35=new UserReport(this[_0x64f0('0xd')]);if(config[_0x64f0('0x12')]&&config[_0x64f0('0x12')]['disabled']){ami['on'](_0x64f0('0x13'),this['voiceQueueReport']['bind'](this));ami['on'](_0x64f0('0x14'),this[_0x64f0('0x15')][_0x64f0('0x16')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0x64f0('0x16')](this));ami['on'](_0x64f0('0x17'),this[_0x64f0('0x18')][_0x64f0('0x16')](this));ami['on'](_0x64f0('0x19'),this[_0x64f0('0x1a')][_0x64f0('0x16')](this));ami['on']('attendedtransfer',this[_0x64f0('0x1b')][_0x64f0('0x16')](this));}};Report['prototype'][_0x64f0('0x1c')]=function(_0x179ee5){var _0xee2ff2;_0xee2ff2=_[_0x64f0('0x1d')](this['agents'],function(_0x1f51be){return _0x1f51be['accountcode']==_0x179ee5||_0x1f51be[_0x64f0('0x1e')]==_0x179ee5;});if(_[_0x64f0('0x1f')](_0xee2ff2)){var _0x43c831=_[_0x64f0('0x1d')](this[_0x64f0('0xf')],function(_0x3b7180){return _0x3b7180[_0x64f0('0x20')]==_0x179ee5||_0x3b7180['name']==_0x179ee5;});if(_0x43c831){_0xee2ff2=_[_0x64f0('0x1d')](this[_0x64f0('0xe')],function(_0x4c03f5){return _0x4c03f5[_0x64f0('0x21')]==util[_0x64f0('0x22')](_0x64f0('0x23'),_0x43c831[_0x64f0('0x1e')]);});}}return _0xee2ff2;};Report['prototype'][_0x64f0('0x24')]=function(_0xc305b8){for(var _0x3d6dcd=0x0;_0x3d6dcd<_0xc305b8['length'];_0x3d6dcd+=0x1){var _0x441f3f=this[_0x64f0('0x1c')](_0xc305b8[_0x3d6dcd]['connectedlinenum']);if(_0x441f3f){_0xc305b8[_0x3d6dcd][_0x64f0('0x20')]=_0x441f3f['accountcode'];_0xc305b8[_0x3d6dcd][_0x64f0('0x25')]=!![];_0xc305b8[_0x3d6dcd][_0x64f0('0x26')]=_0x441f3f[_0x64f0('0x1e')];_0xc305b8[_0x3d6dcd][_0x64f0('0x21')]=_[_0x64f0('0x1f')](_0x441f3f[_0x64f0('0x21')])?util[_0x64f0('0x22')](_0x64f0('0x23'),_0x441f3f['name']):_0x441f3f[_0x64f0('0x21')];if(_0xc305b8[_0x3d6dcd][_0x64f0('0x27')]){_0xc305b8[_0x3d6dcd][_0x64f0('0x28')]=moment()[_0x64f0('0x22')](_0x64f0('0x29'));}if(_0xc305b8[_0x3d6dcd][_0x64f0('0x2a')]){_0xc305b8[_0x3d6dcd]['queuecallerexitAt']=moment()[_0x64f0('0x22')](_0x64f0('0x29'));}RpcMemberReport[_0x64f0('0x24')](_0xc305b8[_0x3d6dcd]);}RpcVoiceQueueReport[_0x64f0('0x2b')](_0xc305b8[_0x3d6dcd]);}};function extractCalleridNumber(_0x3860ef){var _0x736eb5=_0x3860ef['match'](/<(.*?)>/);return _0x736eb5?_0x736eb5[0x1]:_0x3860ef;}Report[_0x64f0('0x10')][_0x64f0('0x15')]=function(_0x287194){_0x287194[_0x64f0('0x2c')]=_0x287194[_0x64f0('0x2c')]||_0x287194[_0x64f0('0x2d')];if(_0x287194[_0x64f0('0x2e')]==_0x64f0('0x2f')){_0x287194[_0x64f0('0x30')]=_0x64f0('0x31');_0x287194['lastdata']=_0x287194[_0x64f0('0x31')];if(_0x287194[_0x64f0('0x32')]=='from-voip-provider'){_0x287194[_0x64f0('0x20')]='';_0x287194[_0x64f0('0x2c')]=extractCalleridNumber(_0x287194['callerid']);}else if(_0x287194[_0x64f0('0x32')]=='from-sip'){if(_0x287194[_0x64f0('0x2c')]==_0x64f0('0x33')){_0x287194[_0x64f0('0x2c')]=extractCalleridNumber(_0x287194[_0x64f0('0x34')]);_0x287194['calleridnum']=_0x287194[_0x64f0('0x35')];_0x287194[_0x64f0('0x36')]=[_0x287194[_0x64f0('0x37')],_0x287194['channel']=_0x287194[_0x64f0('0x36')]][0x0];_0x287194['callerid']=_0x287194[_0x64f0('0x34')];}else{_0x287194[_0x64f0('0x2c')]=_0x287194[_0x64f0('0x38')];_0x287194['calleridnum']=_0x287194[_0x64f0('0x35')];if(_0x287194['disposition']=='ANSWERED'){_0x287194['accountcode']=_0x287194[_0x64f0('0x39')];}else{_0x287194['accountcode']='';}}}}else{_0x287194['callerid']=util[_0x64f0('0x22')](_0x64f0('0x3a'),_0x287194[_0x64f0('0x3b')],_0x287194[_0x64f0('0x38')]);}if(RpcVoiceTransferReport[_0x64f0('0x3c')][_0x287194[_0x64f0('0x3d')]]){var _0xc8946=RpcVoiceTransferReport['transfers'][_0x287194['linkedid']];_0xc8946[_0x64f0('0x3e')]=_0x287194[_0x64f0('0x3f')];RpcVoiceTransferReport[_0x64f0('0x1a')](_0xc8946);delete RpcVoiceTransferReport[_0x64f0('0x3c')][_0x287194[_0x64f0('0x3d')]];}RpcVoiceCallReport[_0x64f0('0x2b')](_0x287194);if(_0x287194['monitor']){for(var _0x53a004=0x0;_0x53a004<_0x287194['monitors'][_0x64f0('0x40')];_0x53a004+=0x1){_0x287194[_0x64f0('0x41')]=_0x287194['monitors'][_0x53a004][_0x64f0('0x42')];_0x287194['createdAt']=_0x287194[_0x64f0('0x43')][_0x53a004]['createdAt'];if(_0x287194[_0x64f0('0x2d')]==_0x64f0('0x33')){_0x287194['calleridnum']=_0x287194['connectedlinenum'];_0x287194[_0x64f0('0x3b')]=_0x287194['connectedlinename'];_0x287194[_0x64f0('0x39')]=_0x287194[_0x64f0('0x20')];_0x287194['connectedlinename']=_0x287194[_0x64f0('0x44')];_0x287194[_0x64f0('0x2d')]=_0x287194[_0x64f0('0x35')];}else if(_0x287194[_0x64f0('0x2d')]==_0x64f0('0x45')){_0x287194[_0x64f0('0x38')]=_0x287194[_0x64f0('0x2c')];_0x287194[_0x64f0('0x2d')]=_0x287194[_0x64f0('0x35')];}RpcVoiceRecording[_0x64f0('0x2b')](_0x287194);}}};Report[_0x64f0('0x10')][_0x64f0('0x46')]=function(_0x2ea9e9){if(_[_0x64f0('0x47')](_0x2ea9e9)){_0x2ea9e9['forEach'](function(_0x3de9d5){RpcVoiceAgentReport['create'](_0x3de9d5);});}else{RpcVoiceAgentReport['create'](_0x2ea9e9);}};Report[_0x64f0('0x10')][_0x64f0('0x18')]=function(_0x55f15d){RpcVoiceDialReport[_0x64f0('0x2b')](_0x55f15d);var _0x588767;var _0x2385cd;var _0x190125=_0x55f15d['channel'];if(_[_0x64f0('0x48')](_0x190125,_0x64f0('0x49'))){_0x2385cd=_0x190125[_0x64f0('0x4a')](_0x190125[_0x64f0('0x4b')]('/')+0x1,_0x190125['indexOf']('@'));_0x588767=_[_0x64f0('0x1d')](this[_0x64f0('0xe')],function(_0x3cb150){return _0x3cb150['mobile']==_0x2385cd||_0x3cb150['phone']==_0x2385cd||_0x3cb150['accountcode']==_0x2385cd;});}else{_0x2385cd=_0x190125['substring'](_0x190125[_0x64f0('0x4b')]('/')+0x1,_0x190125[_0x64f0('0x4c')]('-'));_0x588767=this[_0x64f0('0x1c')](_0x2385cd);}if(_0x588767){_0x55f15d[_0x64f0('0x21')]=_[_0x64f0('0x1f')](_0x588767[_0x64f0('0x21')])?util[_0x64f0('0x22')](_0x64f0('0x23'),_0x588767[_0x64f0('0x1e')]):_0x588767[_0x64f0('0x21')];_0x55f15d[_0x64f0('0x44')]=_0x588767[_0x64f0('0x1e')];_0x55f15d[_0x64f0('0x20')]=_0x588767[_0x64f0('0x20')];RpcMemberReport[_0x64f0('0x18')](_0x55f15d);}};Report[_0x64f0('0x10')][_0x64f0('0x1a')]=function(_0x31ccfb){RpcVoiceTransferReport[_0x64f0('0x3c')][_0x31ccfb['transfererlinkedid']]=_0x31ccfb;};Report[_0x64f0('0x10')][_0x64f0('0x1b')]=function(_0x417df6){RpcVoiceTransferReport[_0x64f0('0x1b')](_0x417df6);};module[_0x64f0('0x4d')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 02decce..ac1900c 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 _0x2630=['[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','inuse','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','debug','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','substring','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','then','actionDeviceStateList','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state'];(function(_0x2641da,_0x30ff28){var _0x1f8431=function(_0x4daacc){while(--_0x4daacc){_0x2641da['push'](_0x2641da['shift']());}};_0x1f8431(++_0x30ff28);}(_0x2630,0x79));var _0x0263=function(_0x391e7c,_0x14818f){_0x391e7c=_0x391e7c-0x0;var _0x1b5a58=_0x2630[_0x391e7c];return _0x1b5a58;};'use strict';var _=require(_0x0263('0x0'));var moment=require(_0x0263('0x1'));var util=require(_0x0263('0x2'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x0263('0x3'));var logger=require(_0x0263('0x4'))(_0x0263('0x5'));var ami=require(_0x0263('0x6'));config[_0x0263('0x7')]=_[_0x0263('0x8')](config['redis'],{'host':_0x0263('0x9'),'port':0x18eb});var io=require(_0x0263('0xa'))(new Redis(config['redis']));function UserReport(_0x8053d9){this[_0x0263('0xb')]=_0x8053d9[_0x0263('0xb')];this[_0x0263('0xc')]=_0x8053d9[_0x0263('0xc')];this['telephones']=_0x8053d9[_0x0263('0xd')];ami['on'](_0x0263('0xe'),this[_0x0263('0xf')][_0x0263('0x10')](this));ami['on'](_0x0263('0x11'),this['syncRegistry'][_0x0263('0x10')](this));ami['on']('devicestatechange',this[_0x0263('0x12')][_0x0263('0x10')](this));ami['on'](_0x0263('0x13'),this['syncPeerStatus'][_0x0263('0x10')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x0263('0x14')]()['then'](ami[_0x0263('0x15')]())[_0x0263('0x16')](function(_0x1dda38){logger[_0x0263('0x17')](_0x0263('0x18'),util[_0x0263('0x19')](_0x1dda38,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x0263('0x14')]()[_0x0263('0x1a')](ami[_0x0263('0x1b')]())[_0x0263('0x16')](function(_0x480793){logger['error']('[userReport][devicestatelist]',util['inspect'](_0x480793,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x0263('0x14')]()['then'](ami[_0x0263('0x1c')]())['catch'](function(_0x22cd32){logger['error'](_0x0263('0x1d'),util['inspect'](_0x22cd32,{'showHidden':![],'depth':null}));});}UserReport[_0x0263('0x1e')]['syncRealtimeShow']=function(){setInterval(function(){BPromise['resolve']()[_0x0263('0x1a')](showSipRegistrations())[_0x0263('0x1a')](listDeviceStates())[_0x0263('0x1a')](showPeersStatus());},0x32c8);};UserReport[_0x0263('0x1e')][_0x0263('0x1f')]=function(_0x1e2311){return _0x1e2311!==null&&!_['isUndefined'](_0x1e2311);};UserReport[_0x0263('0x1e')][_0x0263('0x20')]=function(_0xf630ac,_0x1f0fb4,_0xad6e40){io['to'](_0xf630ac)[_0x0263('0x20')](_0x1f0fb4,_0xad6e40);};UserReport['prototype'][_0x0263('0xf')]=function(_0x121e86){try{if(this[_0x0263('0x1f')](_0x121e86)){logger[_0x0263('0x21')](_0x0263('0x22'),_0x121e86[_0x0263('0x23')],_0x121e86[_0x0263('0x24')]);logger['debug'](_0x0263('0x25'),util[_0x0263('0x19')](_0x121e86,{'showHidden':![],'depth':null}));var _0x41b743=_[_0x0263('0x26')](this[_0x0263('0xb')],{'registry':_0x121e86[_0x0263('0x23')]});if(_0x41b743){_0x121e86[_0x0263('0x27')]=_0x121e86[_0x0263('0x24')];_[_0x0263('0x28')](_0x41b743,_[_0x0263('0x29')](_0x121e86,[_0x0263('0x2a'),_0x0263('0x2b'),_0x0263('0x23'),'state']));logger['debug'](_0x0263('0x2c'),util[_0x0263('0x19')](_0x41b743,{'showHidden':![],'depth':null}));this[_0x0263('0x20')](util[_0x0263('0x2d')](_0x0263('0x2e'),_0x41b743[_0x0263('0x2f')]),_0x0263('0x30'),_0x41b743);}}}catch(_0x2033ca){logger[_0x0263('0x17')](_0x0263('0x25'),util[_0x0263('0x19')](_0x2033ca,{'showHidden':![],'depth':null}));}};UserReport[_0x0263('0x1e')][_0x0263('0x12')]=function(_0x59059c){try{if(this[_0x0263('0x1f')](_0x59059c)){logger[_0x0263('0x21')](_0x0263('0x31'),_0x59059c['device'],_0x59059c[_0x0263('0x24')]);logger['debug']('[userReport][devicestatechange]',util[_0x0263('0x19')](_0x59059c,{'showHidden':![],'depth':null}));if(this[_0x0263('0xc')][_0x59059c[_0x0263('0x32')]]){if(!this[_0x0263('0xc')][_0x59059c[_0x0263('0x32')]]['local']||_0x59059c['state']['toLowerCase']()==_0x0263('0x33')){this['agents'][_0x59059c[_0x0263('0x32')]][_0x0263('0x34')]=![];if(this['agents'][_0x59059c['device']][_0x0263('0x24')]!==_0x59059c[_0x0263('0x24')][_0x0263('0x35')]()){this[_0x0263('0xc')][_0x59059c[_0x0263('0x32')]][_0x0263('0x36')]=_[_0x0263('0x37')](moment()[_0x0263('0x2d')]('x'));}this[_0x0263('0xc')][_0x59059c[_0x0263('0x32')]][_0x0263('0x24')]=_0x59059c[_0x0263('0x24')][_0x0263('0x35')]();this[_0x0263('0xc')][_0x59059c[_0x0263('0x32')]][_0x0263('0x38')](_0x59059c);}}else if(this['telephones'][_0x59059c[_0x0263('0x32')]]){if(this[_0x0263('0xd')][_0x59059c[_0x0263('0x32')]][_0x0263('0x24')]!==_0x59059c[_0x0263('0x24')][_0x0263('0x35')]()){this[_0x0263('0xd')][_0x59059c['device']][_0x0263('0x36')]=_[_0x0263('0x37')](moment()['format']('x'));}this[_0x0263('0xd')][_0x59059c['device']][_0x0263('0x24')]=_0x59059c[_0x0263('0x24')]['toLowerCase']();logger[_0x0263('0x39')](_0x0263('0x3a'),util[_0x0263('0x19')](this['telephones'][_0x59059c[_0x0263('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x0263('0x2d')]('telephone:%s',this[_0x0263('0xd')][_0x59059c['device']][_0x0263('0x2f')]),_0x0263('0x3b'),this[_0x0263('0xd')][_0x59059c[_0x0263('0x32')]]);}else if(this[_0x0263('0xb')][_0x59059c[_0x0263('0x32')]]){if(this['trunks'][_0x59059c['device']][_0x0263('0x24')]!==_0x59059c['state'][_0x0263('0x35')]()){this[_0x0263('0xb')][_0x59059c[_0x0263('0x32')]][_0x0263('0x36')]=_[_0x0263('0x37')](moment()[_0x0263('0x2d')]('x'));}this[_0x0263('0xb')][_0x59059c[_0x0263('0x32')]][_0x0263('0x24')]=_0x59059c['state'][_0x0263('0x35')]();logger[_0x0263('0x39')](_0x0263('0x3c'),util['inspect'](this['trunks'][_0x59059c[_0x0263('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x0263('0x2d')](_0x0263('0x2e'),this[_0x0263('0xb')][_0x59059c[_0x0263('0x32')]]['name']),_0x0263('0x30'),this[_0x0263('0xb')][_0x59059c[_0x0263('0x32')]]);}else if(_[_0x0263('0x3d')](_0x59059c[_0x0263('0x32')],'Local')){var _0x303328=_0x59059c[_0x0263('0x32')];var _0x214166=_0x303328[_0x0263('0x3e')](_0x303328[_0x0263('0x3f')]('/')+0x1,_0x303328[_0x0263('0x3f')]('@'));var _0xf23c30=_[_0x0263('0x26')](this['agents'],function(_0x15255c){return _0x15255c[_0x0263('0x40')]==_0x214166||_0x15255c[_0x0263('0x41')]==_0x214166||_0x15255c[_0x0263('0x42')]==_0x214166;});if(_0xf23c30){if(_0xf23c30[_0x0263('0x24')]!==_0x59059c[_0x0263('0x24')][_0x0263('0x35')]()){_0xf23c30[_0x0263('0x36')]=_[_0x0263('0x37')](moment()[_0x0263('0x2d')]('x'));}_0xf23c30[_0x0263('0x24')]=_0x59059c[_0x0263('0x24')][_0x0263('0x35')]();_0xf23c30['local']=!![];_0xf23c30[_0x0263('0x38')](_0x59059c);}}}}catch(_0x295faa){logger[_0x0263('0x17')](_0x0263('0x43'),util['inspect'](_0x295faa,{'showHidden':![],'depth':null}));}};UserReport[_0x0263('0x1e')][_0x0263('0x44')]=function(_0x58b3da){try{if(this['isNotNull'](_0x58b3da)&&this[_0x0263('0x1f')](_0x58b3da[_0x0263('0x13')])){logger[_0x0263('0x21')](_0x0263('0x45'),_0x58b3da[_0x0263('0x46')],_0x58b3da['address'],_0x58b3da[_0x0263('0x13')]);logger[_0x0263('0x39')](_0x0263('0x47'),util[_0x0263('0x19')](_0x58b3da,{'showHidden':![],'depth':null}));if(this[_0x0263('0xc')][_0x58b3da[_0x0263('0x46')]]){if(!this[_0x0263('0xc')][_0x58b3da[_0x0263('0x46')]][_0x0263('0x34')]||_0x58b3da[_0x0263('0x13')]['toLowerCase']()==_0x0263('0x48')){this[_0x0263('0xc')][_0x58b3da['peer']][_0x0263('0x34')]=![];this[_0x0263('0xc')][_0x58b3da[_0x0263('0x46')]][_0x0263('0x49')]=_0x58b3da[_0x0263('0x13')]['toLowerCase']();this[_0x0263('0xc')][_0x58b3da[_0x0263('0x46')]][_0x0263('0x4a')]=_0x58b3da[_0x0263('0x4a')];this[_0x0263('0xc')][_0x58b3da[_0x0263('0x46')]][_0x0263('0x38')](_0x58b3da);}}else if(this[_0x0263('0xd')][_0x58b3da[_0x0263('0x46')]]){this[_0x0263('0xd')][_0x58b3da[_0x0263('0x46')]][_0x0263('0x49')]=_0x58b3da[_0x0263('0x13')][_0x0263('0x35')]();this['telephones'][_0x58b3da['peer']][_0x0263('0x4a')]=_0x58b3da[_0x0263('0x4a')];logger[_0x0263('0x39')](_0x0263('0x4b'),util[_0x0263('0x19')](this[_0x0263('0xd')][_0x58b3da[_0x0263('0x46')]],{'showHidden':![],'depth':null}));this[_0x0263('0x20')](util[_0x0263('0x2d')](_0x0263('0x4c'),this['telephones'][_0x58b3da[_0x0263('0x46')]][_0x0263('0x2f')]),'telephone:save',this['telephones'][_0x58b3da[_0x0263('0x46')]]);}else if(this[_0x0263('0xb')][_0x58b3da[_0x0263('0x46')]]){this[_0x0263('0xb')][_0x58b3da[_0x0263('0x46')]][_0x0263('0x49')]=_0x58b3da['peerstatus'][_0x0263('0x35')]();this[_0x0263('0xb')][_0x58b3da['peer']][_0x0263('0x4a')]=_0x58b3da[_0x0263('0x4a')];logger[_0x0263('0x39')](_0x0263('0x4d'),util[_0x0263('0x19')](this[_0x0263('0xb')][_0x58b3da['peer']],{'showHidden':![],'depth':null}));this[_0x0263('0x20')](util[_0x0263('0x2d')](_0x0263('0x2e'),this['trunks'][_0x58b3da[_0x0263('0x46')]][_0x0263('0x2f')]),'trunk:save',this[_0x0263('0xb')][_0x58b3da[_0x0263('0x46')]]);}}}catch(_0x43ed5b){logger['error'](_0x0263('0x47'),util['inspect'](_0x43ed5b,{'showHidden':![],'depth':null}));}};module[_0x0263('0x4e')]=UserReport; \ No newline at end of file +var _0x4328=['prototype','isNotNull','isUndefined','emit','info','username','debug','find','stateRegistry','state','merge','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','trunk:save','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','inuse','toLowerCase','toNumber','updateStatusRealtime','format','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','stateTime','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','[userReport][devicestatelist]','[userReport][sippeerstatus]'];(function(_0x33c349,_0x371084){var _0x16c6eb=function(_0x20e726){while(--_0x20e726){_0x33c349['push'](_0x33c349['shift']());}};_0x16c6eb(++_0x371084);}(_0x4328,0x7b));var _0x8432=function(_0x13a064,_0x10f3ad){_0x13a064=_0x13a064-0x0;var _0x4cf273=_0x4328[_0x13a064];return _0x4cf273;};'use strict';var _=require('lodash');var moment=require(_0x8432('0x0'));var util=require(_0x8432('0x1'));var Redis=require(_0x8432('0x2'));var BPromise=require(_0x8432('0x3'));var config=require(_0x8432('0x4'));var logger=require(_0x8432('0x5'))(_0x8432('0x6'));var ami=require('../ami');config[_0x8432('0x7')]=_[_0x8432('0x8')](config[_0x8432('0x7')],{'host':_0x8432('0x9'),'port':0x18eb});var io=require(_0x8432('0xa'))(new Redis(config[_0x8432('0x7')]));function UserReport(_0x1061ff){this[_0x8432('0xb')]=_0x1061ff[_0x8432('0xb')];this[_0x8432('0xc')]=_0x1061ff['agents'];this[_0x8432('0xd')]=_0x1061ff[_0x8432('0xd')];ami['on'](_0x8432('0xe'),this['syncRegistry']['bind'](this));ami['on']('registry',this[_0x8432('0xf')][_0x8432('0x10')](this));ami['on'](_0x8432('0x11'),this[_0x8432('0x12')]['bind'](this));ami['on'](_0x8432('0x13'),this[_0x8432('0x14')][_0x8432('0x10')](this));return this[_0x8432('0x15')]();}function showSipRegistrations(){Promise[_0x8432('0x16')]()[_0x8432('0x17')](ami[_0x8432('0x18')]())[_0x8432('0x19')](function(_0x3af2c7){logger[_0x8432('0x1a')](_0x8432('0x1b'),util[_0x8432('0x1c')](_0x3af2c7,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x8432('0x16')]()[_0x8432('0x17')](ami['actionDeviceStateList']())[_0x8432('0x19')](function(_0x1894ab){logger[_0x8432('0x1a')](_0x8432('0x1d'),util[_0x8432('0x1c')](_0x1894ab,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x8432('0x16')]()[_0x8432('0x17')](ami['actionSipPeerStatus']())[_0x8432('0x19')](function(_0x23d695){logger['error'](_0x8432('0x1e'),util[_0x8432('0x1c')](_0x23d695,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x8432('0x15')]=function(){setInterval(function(){BPromise[_0x8432('0x16')]()[_0x8432('0x17')](showSipRegistrations())[_0x8432('0x17')](listDeviceStates())[_0x8432('0x17')](showPeersStatus());},0x32c8);};UserReport[_0x8432('0x1f')][_0x8432('0x20')]=function(_0x37ba2f){return _0x37ba2f!==null&&!_[_0x8432('0x21')](_0x37ba2f);};UserReport[_0x8432('0x1f')][_0x8432('0x22')]=function(_0xf4b6b4,_0x5bc225,_0x1a23fc){io['to'](_0xf4b6b4)['emit'](_0x5bc225,_0x1a23fc);};UserReport[_0x8432('0x1f')][_0x8432('0xf')]=function(_0x5efef5){try{if(this[_0x8432('0x20')](_0x5efef5)){logger[_0x8432('0x23')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x5efef5[_0x8432('0x24')],_0x5efef5['state']);logger[_0x8432('0x25')]('[userReport][registry]',util[_0x8432('0x1c')](_0x5efef5,{'showHidden':![],'depth':null}));var _0xc22292=_[_0x8432('0x26')](this[_0x8432('0xb')],{'registry':_0x5efef5['username']});if(_0xc22292){_0x5efef5[_0x8432('0x27')]=_0x5efef5[_0x8432('0x28')];_[_0x8432('0x29')](_0xc22292,_['omit'](_0x5efef5,[_0x8432('0x2a'),_0x8432('0x2b'),'username',_0x8432('0x28')]));logger[_0x8432('0x25')](_0x8432('0x2c'),util['inspect'](_0xc22292,{'showHidden':![],'depth':null}));this[_0x8432('0x22')](util['format'](_0x8432('0x2d'),_0xc22292[_0x8432('0x2e')]),_0x8432('0x2f'),_0xc22292);}}}catch(_0x45076f){logger['error'](_0x8432('0x30'),util[_0x8432('0x1c')](_0x45076f,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x8432('0x12')]=function(_0x242b46){try{if(this['isNotNull'](_0x242b46)){logger[_0x8432('0x23')](_0x8432('0x31'),_0x242b46[_0x8432('0x32')],_0x242b46[_0x8432('0x28')]);logger['debug']('[userReport][devicestatechange]',util['inspect'](_0x242b46,{'showHidden':![],'depth':null}));if(this[_0x8432('0xc')][_0x242b46[_0x8432('0x32')]]){if(!this[_0x8432('0xc')][_0x242b46[_0x8432('0x32')]][_0x8432('0x33')]||_0x242b46[_0x8432('0x28')]['toLowerCase']()==_0x8432('0x34')){this[_0x8432('0xc')][_0x242b46[_0x8432('0x32')]][_0x8432('0x33')]=![];if(this[_0x8432('0xc')][_0x242b46[_0x8432('0x32')]][_0x8432('0x28')]!==_0x242b46['state'][_0x8432('0x35')]()){this[_0x8432('0xc')][_0x242b46[_0x8432('0x32')]]['stateTime']=_[_0x8432('0x36')](moment()['format']('x'));}this[_0x8432('0xc')][_0x242b46[_0x8432('0x32')]][_0x8432('0x28')]=_0x242b46[_0x8432('0x28')][_0x8432('0x35')]();this['agents'][_0x242b46['device']][_0x8432('0x37')](_0x242b46);}}else if(this[_0x8432('0xd')][_0x242b46['device']]){if(this[_0x8432('0xd')][_0x242b46[_0x8432('0x32')]]['state']!==_0x242b46[_0x8432('0x28')][_0x8432('0x35')]()){this[_0x8432('0xd')][_0x242b46['device']]['stateTime']=_[_0x8432('0x36')](moment()[_0x8432('0x38')]('x'));}this[_0x8432('0xd')][_0x242b46[_0x8432('0x32')]]['state']=_0x242b46[_0x8432('0x28')]['toLowerCase']();logger['debug'](_0x8432('0x39'),util[_0x8432('0x1c')](this[_0x8432('0xd')][_0x242b46['device']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x8432('0x3a'),this[_0x8432('0xd')][_0x242b46[_0x8432('0x32')]]['name']),_0x8432('0x3b'),this[_0x8432('0xd')][_0x242b46[_0x8432('0x32')]]);}else if(this[_0x8432('0xb')][_0x242b46[_0x8432('0x32')]]){if(this[_0x8432('0xb')][_0x242b46[_0x8432('0x32')]][_0x8432('0x28')]!==_0x242b46[_0x8432('0x28')][_0x8432('0x35')]()){this[_0x8432('0xb')][_0x242b46['device']][_0x8432('0x3c')]=_[_0x8432('0x36')](moment()['format']('x'));}this[_0x8432('0xb')][_0x242b46['device']][_0x8432('0x28')]=_0x242b46[_0x8432('0x28')][_0x8432('0x35')]();logger[_0x8432('0x25')](_0x8432('0x3d'),util[_0x8432('0x1c')](this[_0x8432('0xb')][_0x242b46[_0x8432('0x32')]],{'showHidden':![],'depth':null}));this[_0x8432('0x22')](util[_0x8432('0x38')](_0x8432('0x2d'),this[_0x8432('0xb')][_0x242b46[_0x8432('0x32')]][_0x8432('0x2e')]),'trunk:save',this[_0x8432('0xb')][_0x242b46['device']]);}else if(_['startsWith'](_0x242b46[_0x8432('0x32')],_0x8432('0x3e'))){var _0x51d6c3=_0x242b46['device'];var _0x15eb0e=_0x51d6c3['substring'](_0x51d6c3[_0x8432('0x3f')]('/')+0x1,_0x51d6c3[_0x8432('0x3f')]('@'));var _0xf76346=_[_0x8432('0x26')](this[_0x8432('0xc')],function(_0x1492a9){return _0x1492a9[_0x8432('0x40')]==_0x15eb0e||_0x1492a9[_0x8432('0x41')]==_0x15eb0e||_0x1492a9[_0x8432('0x42')]==_0x15eb0e;});if(_0xf76346){if(_0xf76346['state']!==_0x242b46['state']['toLowerCase']()){_0xf76346[_0x8432('0x3c')]=_[_0x8432('0x36')](moment()['format']('x'));}_0xf76346[_0x8432('0x28')]=_0x242b46['state'][_0x8432('0x35')]();_0xf76346[_0x8432('0x33')]=!![];_0xf76346[_0x8432('0x37')](_0x242b46);}}}}catch(_0x1a2c72){logger[_0x8432('0x1a')](_0x8432('0x43'),util[_0x8432('0x1c')](_0x1a2c72,{'showHidden':![],'depth':null}));}};UserReport[_0x8432('0x1f')][_0x8432('0x14')]=function(_0x4dbda1){try{if(this[_0x8432('0x20')](_0x4dbda1)&&this['isNotNull'](_0x4dbda1[_0x8432('0x13')])){logger['info'](_0x8432('0x44'),_0x4dbda1['peer'],_0x4dbda1[_0x8432('0x45')],_0x4dbda1['peerstatus']);logger[_0x8432('0x25')](_0x8432('0x46'),util['inspect'](_0x4dbda1,{'showHidden':![],'depth':null}));if(this['agents'][_0x4dbda1[_0x8432('0x47')]]){if(!this['agents'][_0x4dbda1[_0x8432('0x47')]][_0x8432('0x33')]||_0x4dbda1['peerstatus'][_0x8432('0x35')]()==_0x8432('0x48')){this[_0x8432('0xc')][_0x4dbda1[_0x8432('0x47')]][_0x8432('0x33')]=![];this['agents'][_0x4dbda1[_0x8432('0x47')]][_0x8432('0x49')]=_0x4dbda1[_0x8432('0x13')][_0x8432('0x35')]();this[_0x8432('0xc')][_0x4dbda1[_0x8432('0x47')]]['address']=_0x4dbda1['address'];this[_0x8432('0xc')][_0x4dbda1[_0x8432('0x47')]][_0x8432('0x37')](_0x4dbda1);}}else if(this['telephones'][_0x4dbda1['peer']]){this[_0x8432('0xd')][_0x4dbda1[_0x8432('0x47')]][_0x8432('0x49')]=_0x4dbda1[_0x8432('0x13')][_0x8432('0x35')]();this[_0x8432('0xd')][_0x4dbda1[_0x8432('0x47')]][_0x8432('0x45')]=_0x4dbda1[_0x8432('0x45')];logger[_0x8432('0x25')](_0x8432('0x4a'),util[_0x8432('0x1c')](this[_0x8432('0xd')][_0x4dbda1[_0x8432('0x47')]],{'showHidden':![],'depth':null}));this[_0x8432('0x22')](util[_0x8432('0x38')](_0x8432('0x3a'),this['telephones'][_0x4dbda1[_0x8432('0x47')]][_0x8432('0x2e')]),'telephone:save',this[_0x8432('0xd')][_0x4dbda1[_0x8432('0x47')]]);}else if(this[_0x8432('0xb')][_0x4dbda1[_0x8432('0x47')]]){this[_0x8432('0xb')][_0x4dbda1[_0x8432('0x47')]]['status']=_0x4dbda1['peerstatus'][_0x8432('0x35')]();this[_0x8432('0xb')][_0x4dbda1[_0x8432('0x47')]][_0x8432('0x45')]=_0x4dbda1['address'];logger[_0x8432('0x25')](_0x8432('0x4b'),util[_0x8432('0x1c')](this[_0x8432('0xb')][_0x4dbda1[_0x8432('0x47')]],{'showHidden':![],'depth':null}));this[_0x8432('0x22')](util[_0x8432('0x38')](_0x8432('0x2d'),this['trunks'][_0x4dbda1[_0x8432('0x47')]][_0x8432('0x2e')]),_0x8432('0x2f'),this[_0x8432('0xb')][_0x4dbda1[_0x8432('0x47')]]);}}}catch(_0x40a6fb){logger['error'](_0x8432('0x46'),util['inspect'](_0x40a6fb,{'showHidden':![],'depth':null}));}};module[_0x8432('0x4c')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 7b333b2..0062965 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 _0x18a4=['info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','inbound','merge','omit','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','membername','error','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:%s','user:agentconnect','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','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','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variables','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','socket.io-emitter','voiceQueues','agents','syncAgentCalled','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','bind','queuecallerabandon','agentcomplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined'];(function(_0x7b47c7,_0x5002b1){var _0x59e875=function(_0x572a10){while(--_0x572a10){_0x7b47c7['push'](_0x7b47c7['shift']());}};_0x59e875(++_0x5002b1);}(_0x18a4,0x75));var _0x418a=function(_0x620cbe,_0x193075){_0x620cbe=_0x620cbe-0x0;var _0x30ad91=_0x18a4[_0x620cbe];return _0x30ad91;};'use strict';var _=require(_0x418a('0x0'));var moment=require(_0x418a('0x1'));var util=require(_0x418a('0x2'));var Redis=require(_0x418a('0x3'));var config=require(_0x418a('0x4'));var logger=require('../../../config/logger')(_0x418a('0x5'));var ami=require(_0x418a('0x6'));config[_0x418a('0x7')]=_[_0x418a('0x8')](config[_0x418a('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x418a('0x9'))(new Redis(config[_0x418a('0x7')]));function VoiceAgentReport(_0x48c4bf){this['channels']={};this[_0x418a('0xa')]=_0x48c4bf['voiceQueues'];this[_0x418a('0xb')]=_0x48c4bf[_0x418a('0xb')];this['variables']={};ami['on']('agentcalled',this[_0x418a('0xc')]['bind'](this));ami['on'](_0x418a('0xd'),this[_0x418a('0xe')]['bind'](this));ami['on'](_0x418a('0xf'),this[_0x418a('0x10')][_0x418a('0x11')](this));ami['on'](_0x418a('0x12'),this['syncQueueCallerAbandon'][_0x418a('0x11')](this));ami['on'](_0x418a('0x13'),this['syncAgentComplete'][_0x418a('0x11')](this));ami['on'](_0x418a('0x14'),this[_0x418a('0x15')][_0x418a('0x11')](this));ami['on'](_0x418a('0x16'),this[_0x418a('0x17')][_0x418a('0x11')](this));ami['on'](_0x418a('0x18'),this[_0x418a('0x19')][_0x418a('0x11')](this));ami['on'](_0x418a('0x1a'),this['syncMusicOnHoldStop'][_0x418a('0x11')](this));ami['on']('attendedtransfer',this[_0x418a('0x1b')][_0x418a('0x11')](this));ami['on'](_0x418a('0x1c'),this['syncBlindTransfer'][_0x418a('0x11')](this));}VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x1e')]=function(_0x425079,_0x2fcd8f,_0x46cc01){io['to'](_0x425079)['emit'](_0x2fcd8f,_0x46cc01);};VoiceAgentReport['prototype'][_0x418a('0x1f')]=function(_0x7aa944){return _0x7aa944!==null&&!_[_0x418a('0x20')](_0x7aa944);};VoiceAgentReport['prototype'][_0x418a('0xc')]=function(_0x5ca22c){try{if(this['isNotNull'](_0x5ca22c)){logger[_0x418a('0x21')](_0x418a('0x22'),_0x5ca22c['uniqueid'],_0x5ca22c['membername'],_0x5ca22c[_0x418a('0x23')]);logger[_0x418a('0x24')](_0x418a('0x25'),_0x5ca22c[_0x418a('0x26')],util[_0x418a('0x27')](_0x5ca22c,{'showHidden':![],'depth':null}));if(_[_0x418a('0x20')](this[_0x418a('0x28')][_0x5ca22c[_0x418a('0x26')]])){this[_0x418a('0x28')][_0x5ca22c[_0x418a('0x26')]]={};}if(_[_0x418a('0x20')](this[_0x418a('0x28')][_0x5ca22c[_0x418a('0x26')]][_0x5ca22c[_0x418a('0x23')]])){this[_0x418a('0x28')][_0x5ca22c[_0x418a('0x26')]][_0x5ca22c[_0x418a('0x23')]]={'agentcalledAt':moment()[_0x418a('0x29')](_0x418a('0x2a')),'lastevent':_0x418a('0x2b'),'mandatoryDisposition':this[_0x418a('0xa')][_0x5ca22c['queue']]?this[_0x418a('0xa')][_0x5ca22c[_0x418a('0x2c')]][_0x418a('0x2d')]||![]:![],'type':this[_0x418a('0xa')][_0x5ca22c[_0x418a('0x2c')]]?this['voiceQueues'][_0x5ca22c['queue']]['type']||_0x418a('0x2e'):_0x418a('0x2e'),'variables':this['variables'][_0x5ca22c[_0x418a('0x26')]]};}_[_0x418a('0x2f')](this[_0x418a('0x28')][_0x5ca22c['uniqueid']][_0x5ca22c[_0x418a('0x23')]],_[_0x418a('0x30')](_0x5ca22c,[_0x418a('0x31'),'privilege']));logger[_0x418a('0x24')](_0x418a('0x32'),_0x5ca22c[_0x418a('0x26')],util[_0x418a('0x27')](this[_0x418a('0x28')][_0x5ca22c[_0x418a('0x26')]][_0x5ca22c[_0x418a('0x23')]],{'showHidden':![],'depth':null}));ami[_0x418a('0x1e')]('custom:agentcalled',this[_0x418a('0x28')][_0x5ca22c[_0x418a('0x26')]][_0x5ca22c['destuniqueid']]);logger['debug'](_0x418a('0x33'),_0x5ca22c[_0x418a('0x26')],util[_0x418a('0x27')](this['channels'][_0x5ca22c[_0x418a('0x26')]][_0x5ca22c[_0x418a('0x23')]],{'showHidden':![],'depth':null}));this[_0x418a('0x1e')](util[_0x418a('0x29')]('user:%s',_0x5ca22c[_0x418a('0x34')]),'user:called',this['channels'][_0x5ca22c['uniqueid']][_0x5ca22c[_0x418a('0x23')]]);}}catch(_0x3697f0){logger[_0x418a('0x35')]('[%s][voiceAgentReport][agentcalled]',_0x5ca22c[_0x418a('0x26')],util['inspect'](_0x3697f0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x418a('0xe')]=function(_0x15ae56){try{if(this['isNotNull'](_0x15ae56)){if(this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]]){logger[_0x418a('0x24')](_0x418a('0x36'),_0x15ae56[_0x418a('0x26')],util['inspect'](_0x15ae56,{'showHidden':![],'depth':null}));for(var _0x1823aa in this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]]){if(this[_0x418a('0x28')][_0x15ae56['uniqueid']][_0x418a('0x37')](_0x1823aa)){if(_0x15ae56[_0x418a('0x23')]===_0x1823aa){logger[_0x418a('0x21')](_0x418a('0x38'),_0x15ae56[_0x418a('0x26')],_0x15ae56[_0x418a('0x34')],_0x15ae56[_0x418a('0x23')]);this[_0x418a('0x28')][_0x15ae56['uniqueid']][_0x1823aa][_0x418a('0x39')]=moment()[_0x418a('0x29')](_0x418a('0x2a'));this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x3a')]=_0x15ae56[_0x418a('0x3a')];this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x3b')]=_0x15ae56[_0x418a('0x3b')];this['channels'][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x3c')]=_0x15ae56[_0x418a('0x3c')];this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x3d')]=_0x15ae56[_0x418a('0x3d')];this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa]['holdtime']=_0x15ae56[_0x418a('0x3e')];this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x3f')]='connect';_[_0x418a('0x2f')](this[_0x418a('0xb')][_0x15ae56[_0x418a('0x40')]],_[_0x418a('0x41')](_0x15ae56,[_0x418a('0x2c'),_0x418a('0x42')]));logger[_0x418a('0x24')](_0x418a('0x43'),_0x15ae56[_0x418a('0x26')],util[_0x418a('0x27')](this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x15ae56[_0x418a('0x23')]],{'showHidden':![],'depth':null}));ami[_0x418a('0x1e')](_0x418a('0x44'),this['channels'][_0x15ae56[_0x418a('0x26')]][_0x15ae56[_0x418a('0x23')]]);logger[_0x418a('0x24')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x15ae56[_0x418a('0x26')],util[_0x418a('0x27')](this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x15ae56['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x418a('0x1e')](util['format'](_0x418a('0x45'),_0x15ae56[_0x418a('0x34')]),_0x418a('0x46'),this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x15ae56[_0x418a('0x23')]]);}else if(!this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0xf')]&&!this['channels'][_0x15ae56['uniqueid']][_0x1823aa]['agentcomplete']){logger[_0x418a('0x21')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x15ae56[_0x418a('0x26')],this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa]['membername'],_0x1823aa);this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0xf')]=!![];this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x47')]=moment()[_0x418a('0x29')](_0x418a('0x2a'));this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x48')]=_0x15ae56[_0x418a('0x23')];this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x49')]=_0x15ae56[_0x418a('0x34')];this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa]['lastevent']='answered_elsewhere';this['channels'][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x4a')]=_0x418a('0x4b');logger[_0x418a('0x24')](_0x418a('0x4c'),_0x15ae56[_0x418a('0x26')],util[_0x418a('0x27')](this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa],{'showHidden':![],'depth':null}));ami[_0x418a('0x1e')]('custom:agentansweredelsewhere',this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa]);}}}}}}catch(_0x39294b){logger['error'](_0x418a('0x4d'),_0x15ae56[_0x418a('0x26')],util['inspect'](_0x39294b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x38e2a5){try{if(this['isNotNull'](_0x38e2a5)){logger[_0x418a('0x24')](_0x418a('0x4e'),_0x38e2a5[_0x418a('0x26')],util[_0x418a('0x27')](_0x38e2a5,{'showHidden':![],'depth':null}));if(this[_0x418a('0x28')][_0x38e2a5[_0x418a('0x26')]]&&this[_0x418a('0x28')][_0x38e2a5[_0x418a('0x26')]][_0x38e2a5['destuniqueid']]){logger[_0x418a('0x21')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x38e2a5[_0x418a('0x26')],_0x38e2a5[_0x418a('0x34')],_0x38e2a5['destuniqueid']);this[_0x418a('0x28')][_0x38e2a5[_0x418a('0x26')]][_0x38e2a5[_0x418a('0x23')]]['agentringnoanswer']=!![];this[_0x418a('0x28')][_0x38e2a5[_0x418a('0x26')]][_0x38e2a5['destuniqueid']][_0x418a('0x47')]=moment()['format'](_0x418a('0x2a'));this[_0x418a('0x28')][_0x38e2a5['uniqueid']][_0x38e2a5[_0x418a('0x23')]][_0x418a('0x3f')]=_0x418a('0x4f');this[_0x418a('0x28')][_0x38e2a5['uniqueid']][_0x38e2a5[_0x418a('0x23')]][_0x418a('0x4a')]=_0x418a('0x4f');logger[_0x418a('0x24')](_0x418a('0x50'),_0x38e2a5[_0x418a('0x26')],util[_0x418a('0x27')](this['channels'][_0x38e2a5[_0x418a('0x26')]][_0x38e2a5['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x418a('0x1e')](_0x418a('0x51'),this[_0x418a('0x28')][_0x38e2a5['uniqueid']][_0x38e2a5[_0x418a('0x23')]]);}}}catch(_0x49b239){logger[_0x418a('0x35')](_0x418a('0x52'),_0x38e2a5['uniqueid'],util['inspect'](_0x49b239,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x53')]=function(_0x38f469){try{if(this[_0x418a('0x1f')](_0x38f469)){logger[_0x418a('0x24')](_0x418a('0x54'),_0x38f469[_0x418a('0x26')],util[_0x418a('0x27')](_0x38f469,{'showHidden':![],'depth':null}));if(this[_0x418a('0x28')][_0x38f469['uniqueid']]){for(var _0x3e7423 in this[_0x418a('0x28')][_0x38f469['uniqueid']]){if(this[_0x418a('0x28')][_0x38f469['uniqueid']][_0x418a('0x37')](_0x3e7423)&&!this['channels'][_0x38f469[_0x418a('0x26')]][_0x3e7423][_0x418a('0xf')]&&!this['channels'][_0x38f469['uniqueid']][_0x3e7423][_0x418a('0x13')]){logger[_0x418a('0x21')](_0x418a('0x55'),_0x38f469[_0x418a('0x26')],this[_0x418a('0x28')][_0x38f469[_0x418a('0x26')]][_0x3e7423][_0x418a('0x34')],_0x3e7423);this['channels'][_0x38f469[_0x418a('0x26')]][_0x3e7423][_0x418a('0xf')]=!![];this['channels'][_0x38f469[_0x418a('0x26')]][_0x3e7423]['agentringnoanswerAt']=moment()[_0x418a('0x29')](_0x418a('0x2a'));this[_0x418a('0x28')][_0x38f469[_0x418a('0x26')]][_0x3e7423][_0x418a('0x3f')]='abandoned';this[_0x418a('0x28')][_0x38f469[_0x418a('0x26')]][_0x3e7423][_0x418a('0x4a')]=_0x418a('0x56');logger[_0x418a('0x24')](_0x418a('0x57'),_0x38f469[_0x418a('0x26')],util['inspect'](this[_0x418a('0x28')][_0x38f469[_0x418a('0x26')]][_0x3e7423],{'showHidden':![],'depth':null}));ami[_0x418a('0x1e')]('custom:agentqueuecallerabandon',this['channels'][_0x38f469[_0x418a('0x26')]][_0x3e7423]);}}}}}catch(_0x31a88e){logger[_0x418a('0x35')]('[%s][voiceAgentReport][queuecallerabandon]',_0x38f469[_0x418a('0x26')],util[_0x418a('0x27')](_0x31a88e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x58')]=function(_0x47b179){try{if(this['isNotNull'](_0x47b179)){logger[_0x418a('0x24')](_0x418a('0x59'),_0x47b179[_0x418a('0x26')],util[_0x418a('0x27')](_0x47b179,{'showHidden':![],'depth':null}));if(this[_0x418a('0x28')][_0x47b179['uniqueid']]){for(var _0x46dca0 in this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]]){if(this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x418a('0x37')](_0x46dca0)){if(this['channels'][_0x47b179[_0x418a('0x26')]][_0x46dca0][_0x418a('0x39')]&&!this['channels'][_0x47b179[_0x418a('0x26')]][_0x46dca0][_0x418a('0x13')]){logger[_0x418a('0x21')](_0x418a('0x5a'),_0x47b179[_0x418a('0x26')],this['channels'][_0x47b179['uniqueid']][_0x46dca0][_0x418a('0x34')],_0x46dca0);this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x46dca0]['agentcomplete']=!![];this['channels'][_0x47b179['uniqueid']][_0x46dca0][_0x418a('0x5b')]=moment()[_0x418a('0x29')](_0x418a('0x2a'));this[_0x418a('0x28')][_0x47b179['uniqueid']][_0x46dca0]['lastevent']=_0x418a('0x5c');this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x46dca0][_0x418a('0x4a')]=_0x47b179[_0x418a('0x4a')]=='transfer'?_0x418a('0x5d'):_0x47b179[_0x418a('0x4a')];this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x46dca0][_0x418a('0x5e')]=_0x47b179['talktime'];if(this[_0x418a('0xa')][_0x47b179[_0x418a('0x2c')]]&&this['voiceQueues'][_0x47b179['queue']][_0x418a('0x5f')]){this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x46dca0][_0x418a('0x60')]=this['voiceQueues'][_0x47b179[_0x418a('0x2c')]][_0x418a('0x61')];this[_0x418a('0x28')][_0x47b179['uniqueid']][_0x46dca0][_0x418a('0x62')]=!![];}this[_0x418a('0xb')][_0x47b179[_0x418a('0x40')]]=_[_0x418a('0x30')](this[_0x418a('0xb')][_0x47b179[_0x418a('0x40')]],['queue',_0x418a('0x42')]);logger[_0x418a('0x24')](_0x418a('0x63'),_0x47b179[_0x418a('0x26')],util['inspect'](this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x46dca0],{'showHidden':![],'depth':null}));ami[_0x418a('0x1e')](_0x418a('0x64'),this['channels'][_0x47b179[_0x418a('0x26')]][_0x46dca0]);logger['debug'](_0x418a('0x65'),_0x47b179[_0x418a('0x26')],util[_0x418a('0x27')](this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x46dca0],{'showHidden':![],'depth':null}));this[_0x418a('0x1e')](util[_0x418a('0x29')](_0x418a('0x45'),_0x47b179[_0x418a('0x34')]),_0x418a('0x66'),this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x46dca0]);}}}}}}catch(_0x1589fc){logger[_0x418a('0x35')](_0x418a('0x67'),_0x47b179['uniqueid'],util[_0x418a('0x27')](_0x1589fc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x15')]=function(_0x8fcbe0){try{if(this[_0x418a('0x1f')](_0x8fcbe0)){logger[_0x418a('0x24')](_0x418a('0x68'),_0x8fcbe0['uniqueid'],util['inspect'](_0x8fcbe0,{'showHidden':![],'depth':null}));this[_0x418a('0x69')](_0x8fcbe0[_0x418a('0x26')],_[_0x418a('0x6a')](_0x8fcbe0[_0x418a('0x6b')])[0x0],_0x8fcbe0[_0x418a('0x6c')]);if(this[_0x418a('0x28')][_0x8fcbe0[_0x418a('0x26')]]){for(var _0x22e53a in this['channels'][_0x8fcbe0[_0x418a('0x26')]]){if(this[_0x418a('0x28')][_0x8fcbe0[_0x418a('0x26')]][_0x418a('0x37')](_0x22e53a)){logger[_0x418a('0x21')](_0x418a('0x6d'),_0x8fcbe0['uniqueid'],_0x22e53a,_[_0x418a('0x6a')](_0x8fcbe0['variable'])[0x0],_0x8fcbe0[_0x418a('0x6c')]);if(_['isUndefined'](this[_0x418a('0x28')][_0x8fcbe0[_0x418a('0x26')]][_0x22e53a][_0x418a('0x6e')])){this[_0x418a('0x28')][_0x8fcbe0[_0x418a('0x26')]][_0x22e53a][_0x418a('0x6e')]={};}this[_0x418a('0x28')][_0x8fcbe0[_0x418a('0x26')]][_0x22e53a][_0x418a('0x6e')]=this[_0x418a('0x6e')][_0x8fcbe0[_0x418a('0x26')]];}}}}}catch(_0x533d09){logger['error'](_0x418a('0x6f'),_0x8fcbe0[_0x418a('0x26')],util[_0x418a('0x27')](_0x533d09,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x69')]=function(_0x1b4a00,_0x13ba2e,_0x318034){var _0x27c6ee=[_0x418a('0x70'),_0x418a('0x71'),'rtpaudioqosjitter',_0x418a('0x72'),_0x418a('0x73'),_0x418a('0x74'),_0x418a('0x75'),'rtpaudioqosrttbridged',_0x418a('0x76'),'sipuri','bridgepeer','bridgepvtcallid',_0x418a('0x77'),_0x418a('0x78'),_0x418a('0x79'),_0x418a('0x7a'),_0x418a('0x34'),_0x418a('0x7b'),'memberrealtime'];if(!_['isNil'](_0x13ba2e)&&!_[_0x418a('0x7c')](_0x27c6ee,_0x13ba2e)){if(_[_0x418a('0x20')](this[_0x418a('0x6e')][_0x1b4a00])){this[_0x418a('0x6e')][_0x1b4a00]={};}this[_0x418a('0x6e')][_0x1b4a00][_0x13ba2e]=_0x318034;}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x17')]=function(_0x20a102){try{if(this[_0x418a('0x1f')](_0x20a102)){logger[_0x418a('0x24')](_0x418a('0x7d'),_0x20a102[_0x418a('0x26')],util['inspect'](_0x20a102,{'showHidden':![],'depth':null}));if(this[_0x418a('0x28')][_0x20a102['uniqueid']]){for(var _0x499c0e in this[_0x418a('0x28')][_0x20a102['uniqueid']]){if(this[_0x418a('0x28')][_0x20a102[_0x418a('0x26')]][_0x418a('0x37')](_0x499c0e)){if(this[_0x418a('0x28')][_0x20a102[_0x418a('0x26')]][_0x499c0e][_0x418a('0x4a')]==_0x418a('0x7e')&&this['channels'][_0x20a102[_0x418a('0x26')]][_0x499c0e][_0x418a('0x13')]){logger['info'](_0x418a('0x7f'),_0x20a102['uniqueid'],_0x499c0e);this[_0x418a('0x28')][_0x20a102[_0x418a('0x26')]][_0x499c0e]['agentcompleteAt']=moment()[_0x418a('0x29')](_0x418a('0x2a'));}}}logger['debug'](_0x418a('0x80'),_0x20a102[_0x418a('0x26')],util[_0x418a('0x27')](_[_0x418a('0x81')](this[_0x418a('0x28')][_0x20a102[_0x418a('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x418a('0x1e')](_0x418a('0x82'),_[_0x418a('0x81')](this[_0x418a('0x28')][_0x20a102[_0x418a('0x26')]]));delete this[_0x418a('0x28')][_0x20a102['uniqueid']];}if(this[_0x418a('0x6e')][_0x20a102[_0x418a('0x26')]]){delete this[_0x418a('0x6e')][_0x20a102[_0x418a('0x26')]];}}}catch(_0x13c7b9){logger[_0x418a('0x35')]('[%s][voiceAgentReport][hangup]',_0x20a102['uniqueid'],util[_0x418a('0x27')](_0x13c7b9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x1b')]=function(_0x698472){try{if(this[_0x418a('0x1f')](_0x698472)){logger[_0x418a('0x24')](_0x418a('0x83'),_0x698472[_0x418a('0x26')],util['inspect'](_0x698472,{'showHidden':![],'depth':null}));if(this['channels'][_0x698472[_0x418a('0x84')]]){for(var _0x35b563 in this[_0x418a('0x28')][_0x698472[_0x418a('0x84')]]){if(this[_0x418a('0x28')][_0x698472['transfereeuniqueid']]['hasOwnProperty'](_0x35b563)){if(_0x698472[_0x418a('0x85')]===_0x35b563){logger[_0x418a('0x21')](_0x418a('0x86'),_0x698472[_0x418a('0x26')],this['channels'][_0x698472['transfereeuniqueid']][_0x35b563]['membername'],_0x35b563);var _0x4d8d57=moment();this[_0x418a('0x28')][_0x698472[_0x418a('0x84')]][_0x35b563][_0x418a('0x13')]=!![];this['channels'][_0x698472['transfereeuniqueid']][_0x35b563][_0x418a('0x5b')]=moment()[_0x418a('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x698472['transfereeuniqueid']][_0x35b563][_0x418a('0x3f')]='complete';this['channels'][_0x698472[_0x418a('0x84')]][_0x35b563][_0x418a('0x4a')]=_0x418a('0x7e');this[_0x418a('0x28')][_0x698472['transfereeuniqueid']][_0x35b563][_0x418a('0x5e')]=_0x4d8d57[_0x418a('0x87')](this[_0x418a('0x28')][_0x698472[_0x418a('0x84')]][_0x35b563][_0x418a('0x39')],_0x418a('0x88'));}}}}if(this['channels'][_0x698472[_0x418a('0x89')]]){var _0x3e8350=this[_0x418a('0x28')][_0x698472[_0x418a('0x89')]];this[_0x418a('0x28')][_0x698472[_0x418a('0x89')]]=this[_0x418a('0x28')][_0x698472[_0x418a('0x84')]];this['channels'][_0x698472[_0x418a('0x84')]]=_0x3e8350;}}}catch(_0x6d003d){logger[_0x418a('0x35')]('[%s][voiceAgentReport][attendedtransfer]',_0x698472[_0x418a('0x26')],util[_0x418a('0x27')](_0x6d003d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x8a')]=function(_0x14792f){try{if(this[_0x418a('0x1f')](_0x14792f)){logger[_0x418a('0x24')](_0x418a('0x8b'),_0x14792f[_0x418a('0x26')],util[_0x418a('0x27')](_0x14792f,{'showHidden':![],'depth':null}));if(this[_0x418a('0x28')][_0x14792f[_0x418a('0x84')]]){for(var _0x1cfe6f in this['channels'][_0x14792f[_0x418a('0x84')]]){if(this['channels'][_0x14792f[_0x418a('0x84')]][_0x418a('0x37')](_0x1cfe6f)){if(_0x14792f[_0x418a('0x8c')]===_0x1cfe6f){logger[_0x418a('0x21')](_0x418a('0x8d'),_0x14792f[_0x418a('0x26')],this[_0x418a('0x28')][_0x14792f[_0x418a('0x84')]][_0x1cfe6f][_0x418a('0x34')],_0x1cfe6f);var _0x7336c5=moment();this[_0x418a('0x28')][_0x14792f[_0x418a('0x84')]][_0x1cfe6f][_0x418a('0x13')]=!![];this['channels'][_0x14792f[_0x418a('0x84')]][_0x1cfe6f][_0x418a('0x5b')]=_0x7336c5;this[_0x418a('0x28')][_0x14792f['transfereeuniqueid']][_0x1cfe6f]['lastevent']='complete';this[_0x418a('0x28')][_0x14792f[_0x418a('0x84')]][_0x1cfe6f][_0x418a('0x4a')]='transfer';this['channels'][_0x14792f[_0x418a('0x84')]][_0x1cfe6f][_0x418a('0x5e')]=_0x7336c5[_0x418a('0x87')](this[_0x418a('0x28')][_0x14792f[_0x418a('0x84')]][_0x1cfe6f]['agentconnectAt'],_0x418a('0x88'));}}}}}}catch(_0x332244){logger['error'](_0x418a('0x8e'),_0x14792f[_0x418a('0x26')],util[_0x418a('0x27')](_0x332244,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x19')]=function(_0x7f70d5){var _0xee199c='';try{if(this[_0x418a('0x1f')](_0x7f70d5)){logger[_0x418a('0x24')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x7f70d5['uniqueid'],util[_0x418a('0x27')](_0x7f70d5,{'showHidden':![],'depth':null}));if(_0x7f70d5[_0x418a('0x8f')]){_0xee199c=_0x7f70d5[_0x418a('0x8f')][_0x418a('0x90')](0x0,_0x7f70d5[_0x418a('0x8f')]['lastIndexOf']('-'));if(this['agents'][_0xee199c]){logger[_0x418a('0x21')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x7f70d5[_0x418a('0x26')],_0xee199c);this[_0x418a('0xb')][_0xee199c][_0x418a('0x91')]=!![];}}}}catch(_0x1663e9){logger[_0x418a('0x35')]('[%s][voiceAgentReport][musiconholdstart]',_0x7f70d5[_0x418a('0x26')],util[_0x418a('0x27')](_0x1663e9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0x25f07b){var _0x583940='';try{if(this[_0x418a('0x1f')](_0x25f07b)){logger[_0x418a('0x24')](_0x418a('0x92'),_0x25f07b[_0x418a('0x26')],util[_0x418a('0x27')](_0x25f07b,{'showHidden':![],'depth':null}));if(_0x25f07b[_0x418a('0x8f')]){_0x583940=_0x25f07b[_0x418a('0x8f')]['substring'](0x0,_0x25f07b[_0x418a('0x8f')][_0x418a('0x93')]('-'));if(this['agents'][_0x583940]){logger[_0x418a('0x21')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x25f07b[_0x418a('0x26')],_0x583940);this[_0x418a('0xb')][_0x583940][_0x418a('0x91')]=![];}}}}catch(_0xcd7a32){logger['error'](_0x418a('0x94'),_0x25f07b[_0x418a('0x26')],util['inspect'](_0xcd7a32,{'showHidden':![],'depth':null}));}};module[_0x418a('0x95')]=VoiceAgentReport; \ No newline at end of file +var _0x0d67=['[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','format','user:%s','membername','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','variable','value','keys','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','lodash','util','../../../config/environment','ami','../ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstart','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','isNotNull','info'];(function(_0x23c965,_0x2029b6){var _0x197c94=function(_0x1e71f7){while(--_0x1e71f7){_0x23c965['push'](_0x23c965['shift']());}};_0x197c94(++_0x2029b6);}(_0x0d67,0x104));var _0x70d6=function(_0x278452,_0x117e29){_0x278452=_0x278452-0x0;var _0x3fbd3e=_0x0d67[_0x278452];return _0x3fbd3e;};'use strict';var _=require(_0x70d6('0x0'));var moment=require('moment');var util=require(_0x70d6('0x1'));var Redis=require('ioredis');var config=require(_0x70d6('0x2'));var logger=require('../../../config/logger')(_0x70d6('0x3'));var ami=require(_0x70d6('0x4'));config[_0x70d6('0x5')]=_[_0x70d6('0x6')](config[_0x70d6('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x70d6('0x7'))(new Redis(config['redis']));function VoiceAgentReport(_0x61b17c){this[_0x70d6('0x8')]={};this[_0x70d6('0x9')]=_0x61b17c['voiceQueues'];this[_0x70d6('0xa')]=_0x61b17c[_0x70d6('0xa')];this[_0x70d6('0xb')]={};ami['on']('agentcalled',this[_0x70d6('0xc')][_0x70d6('0xd')](this));ami['on']('agentconnect',this[_0x70d6('0xe')][_0x70d6('0xd')](this));ami['on'](_0x70d6('0xf'),this[_0x70d6('0x10')][_0x70d6('0xd')](this));ami['on'](_0x70d6('0x11'),this[_0x70d6('0x12')]['bind'](this));ami['on'](_0x70d6('0x13'),this[_0x70d6('0x14')][_0x70d6('0xd')](this));ami['on'](_0x70d6('0x15'),this[_0x70d6('0x16')]['bind'](this));ami['on']('hangup',this[_0x70d6('0x17')][_0x70d6('0xd')](this));ami['on'](_0x70d6('0x18'),this['syncMusicOnHoldStart'][_0x70d6('0xd')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x70d6('0xd')](this));ami['on'](_0x70d6('0x19'),this[_0x70d6('0x1a')][_0x70d6('0xd')](this));ami['on'](_0x70d6('0x1b'),this[_0x70d6('0x1c')][_0x70d6('0xd')](this));}VoiceAgentReport[_0x70d6('0x1d')][_0x70d6('0x1e')]=function(_0x3f7958,_0x1108fd,_0x2a271e){io['to'](_0x3f7958)['emit'](_0x1108fd,_0x2a271e);};VoiceAgentReport['prototype']['isNotNull']=function(_0x2d1765){return _0x2d1765!==null&&!_[_0x70d6('0x1f')](_0x2d1765);};VoiceAgentReport['prototype'][_0x70d6('0xc')]=function(_0x1a5147){try{if(this[_0x70d6('0x20')](_0x1a5147)){logger[_0x70d6('0x21')](_0x70d6('0x22'),_0x1a5147[_0x70d6('0x23')],_0x1a5147['membername'],_0x1a5147[_0x70d6('0x24')]);logger[_0x70d6('0x25')](_0x70d6('0x26'),_0x1a5147[_0x70d6('0x23')],util[_0x70d6('0x27')](_0x1a5147,{'showHidden':![],'depth':null}));if(_[_0x70d6('0x1f')](this['channels'][_0x1a5147['uniqueid']])){this[_0x70d6('0x8')][_0x1a5147[_0x70d6('0x23')]]={};}if(_['isUndefined'](this['channels'][_0x1a5147[_0x70d6('0x23')]][_0x1a5147[_0x70d6('0x24')]])){this['channels'][_0x1a5147[_0x70d6('0x23')]][_0x1a5147[_0x70d6('0x24')]]={'agentcalledAt':moment()['format'](_0x70d6('0x28')),'lastevent':_0x70d6('0x29'),'mandatoryDisposition':this[_0x70d6('0x9')][_0x1a5147[_0x70d6('0x2a')]]?this['voiceQueues'][_0x1a5147[_0x70d6('0x2a')]]['mandatoryDisposition']||![]:![],'type':this['voiceQueues'][_0x1a5147['queue']]?this['voiceQueues'][_0x1a5147['queue']][_0x70d6('0x2b')]||'inbound':_0x70d6('0x2c'),'variables':this[_0x70d6('0xb')][_0x1a5147[_0x70d6('0x23')]]};}_[_0x70d6('0x2d')](this[_0x70d6('0x8')][_0x1a5147[_0x70d6('0x23')]][_0x1a5147[_0x70d6('0x24')]],_[_0x70d6('0x2e')](_0x1a5147,[_0x70d6('0x2f'),_0x70d6('0x30')]));logger[_0x70d6('0x25')](_0x70d6('0x31'),_0x1a5147[_0x70d6('0x23')],util[_0x70d6('0x27')](this[_0x70d6('0x8')][_0x1a5147[_0x70d6('0x23')]][_0x1a5147['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcalled',this['channels'][_0x1a5147[_0x70d6('0x23')]][_0x1a5147[_0x70d6('0x24')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x1a5147[_0x70d6('0x23')],util[_0x70d6('0x27')](this[_0x70d6('0x8')][_0x1a5147['uniqueid']][_0x1a5147[_0x70d6('0x24')]],{'showHidden':![],'depth':null}));this[_0x70d6('0x1e')](util[_0x70d6('0x32')](_0x70d6('0x33'),_0x1a5147[_0x70d6('0x34')]),'user:called',this[_0x70d6('0x8')][_0x1a5147[_0x70d6('0x23')]][_0x1a5147[_0x70d6('0x24')]]);}}catch(_0x29744d){logger['error'](_0x70d6('0x35'),_0x1a5147[_0x70d6('0x23')],util[_0x70d6('0x27')](_0x29744d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x70d6('0x1d')][_0x70d6('0xe')]=function(_0x45fbf8){try{if(this[_0x70d6('0x20')](_0x45fbf8)){if(this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]]){logger[_0x70d6('0x25')](_0x70d6('0x36'),_0x45fbf8[_0x70d6('0x23')],util[_0x70d6('0x27')](_0x45fbf8,{'showHidden':![],'depth':null}));for(var _0x3d483e in this[_0x70d6('0x8')][_0x45fbf8['uniqueid']]){if(this['channels'][_0x45fbf8[_0x70d6('0x23')]][_0x70d6('0x37')](_0x3d483e)){if(_0x45fbf8[_0x70d6('0x24')]===_0x3d483e){logger['info'](_0x70d6('0x38'),_0x45fbf8[_0x70d6('0x23')],_0x45fbf8[_0x70d6('0x34')],_0x45fbf8[_0x70d6('0x24')]);this['channels'][_0x45fbf8[_0x70d6('0x23')]][_0x3d483e][_0x70d6('0x39')]=moment()['format'](_0x70d6('0x28'));this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x3d483e][_0x70d6('0x3a')]=_0x45fbf8['connectedlinename'];this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x3d483e][_0x70d6('0x3b')]=_0x45fbf8[_0x70d6('0x3b')];this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x3d483e][_0x70d6('0x3c')]=_0x45fbf8[_0x70d6('0x3c')];this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x3d483e][_0x70d6('0x3d')]=_0x45fbf8[_0x70d6('0x3d')];this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x3d483e][_0x70d6('0x3e')]=_0x45fbf8[_0x70d6('0x3e')];this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x3d483e][_0x70d6('0x3f')]='connect';_['merge'](this['agents'][_0x45fbf8[_0x70d6('0x40')]],_[_0x70d6('0x41')](_0x45fbf8,[_0x70d6('0x2a'),_0x70d6('0x42')]));logger[_0x70d6('0x25')](_0x70d6('0x43'),_0x45fbf8['uniqueid'],util[_0x70d6('0x27')](this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x45fbf8[_0x70d6('0x24')]],{'showHidden':![],'depth':null}));ami[_0x70d6('0x1e')](_0x70d6('0x44'),this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x45fbf8[_0x70d6('0x24')]]);logger[_0x70d6('0x25')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x45fbf8['uniqueid'],util['inspect'](this['channels'][_0x45fbf8[_0x70d6('0x23')]][_0x45fbf8[_0x70d6('0x24')]],{'showHidden':![],'depth':null}));this[_0x70d6('0x1e')](util[_0x70d6('0x32')]('user:%s',_0x45fbf8[_0x70d6('0x34')]),_0x70d6('0x45'),this[_0x70d6('0x8')][_0x45fbf8['uniqueid']][_0x45fbf8[_0x70d6('0x24')]]);}else if(!this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x3d483e][_0x70d6('0xf')]&&!this['channels'][_0x45fbf8['uniqueid']][_0x3d483e][_0x70d6('0x13')]){logger[_0x70d6('0x21')](_0x70d6('0x46'),_0x45fbf8[_0x70d6('0x23')],this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x3d483e][_0x70d6('0x34')],_0x3d483e);this['channels'][_0x45fbf8['uniqueid']][_0x3d483e]['agentringnoanswer']=!![];this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x3d483e][_0x70d6('0x47')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x3d483e][_0x70d6('0x48')]=_0x45fbf8[_0x70d6('0x24')];this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x3d483e]['answeredelsewheremembername']=_0x45fbf8['membername'];this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x3d483e][_0x70d6('0x3f')]=_0x70d6('0x49');this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x3d483e][_0x70d6('0x4a')]='answered_elsewhere';logger['debug'](_0x70d6('0x4b'),_0x45fbf8[_0x70d6('0x23')],util['inspect'](this[_0x70d6('0x8')][_0x45fbf8['uniqueid']][_0x3d483e],{'showHidden':![],'depth':null}));ami[_0x70d6('0x1e')](_0x70d6('0x4c'),this[_0x70d6('0x8')][_0x45fbf8[_0x70d6('0x23')]][_0x3d483e]);}}}}}}catch(_0x3c1008){logger[_0x70d6('0x4d')](_0x70d6('0x4e'),_0x45fbf8[_0x70d6('0x23')],util[_0x70d6('0x27')](_0x3c1008,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x70d6('0x1d')][_0x70d6('0x10')]=function(_0x433d42){try{if(this[_0x70d6('0x20')](_0x433d42)){logger[_0x70d6('0x25')](_0x70d6('0x4f'),_0x433d42[_0x70d6('0x23')],util['inspect'](_0x433d42,{'showHidden':![],'depth':null}));if(this[_0x70d6('0x8')][_0x433d42[_0x70d6('0x23')]]&&this[_0x70d6('0x8')][_0x433d42[_0x70d6('0x23')]][_0x433d42[_0x70d6('0x24')]]){logger[_0x70d6('0x21')](_0x70d6('0x50'),_0x433d42[_0x70d6('0x23')],_0x433d42[_0x70d6('0x34')],_0x433d42[_0x70d6('0x24')]);this[_0x70d6('0x8')][_0x433d42['uniqueid']][_0x433d42[_0x70d6('0x24')]][_0x70d6('0xf')]=!![];this[_0x70d6('0x8')][_0x433d42['uniqueid']][_0x433d42[_0x70d6('0x24')]]['agentringnoanswerAt']=moment()[_0x70d6('0x32')](_0x70d6('0x28'));this['channels'][_0x433d42[_0x70d6('0x23')]][_0x433d42[_0x70d6('0x24')]][_0x70d6('0x3f')]=_0x70d6('0x51');this['channels'][_0x433d42[_0x70d6('0x23')]][_0x433d42['destuniqueid']]['reason']=_0x70d6('0x51');logger[_0x70d6('0x25')](_0x70d6('0x52'),_0x433d42[_0x70d6('0x23')],util[_0x70d6('0x27')](this['channels'][_0x433d42[_0x70d6('0x23')]][_0x433d42[_0x70d6('0x24')]],{'showHidden':![],'depth':null}));ami[_0x70d6('0x1e')]('custom:agentringnoanswer',this[_0x70d6('0x8')][_0x433d42['uniqueid']][_0x433d42['destuniqueid']]);}}}catch(_0x5a25ff){logger['error']('[%s][voiceAgentReport][agentringnoanswer]',_0x433d42['uniqueid'],util[_0x70d6('0x27')](_0x5a25ff,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x70d6('0x1d')][_0x70d6('0x12')]=function(_0x2d6694){try{if(this[_0x70d6('0x20')](_0x2d6694)){logger[_0x70d6('0x25')](_0x70d6('0x53'),_0x2d6694[_0x70d6('0x23')],util[_0x70d6('0x27')](_0x2d6694,{'showHidden':![],'depth':null}));if(this[_0x70d6('0x8')][_0x2d6694[_0x70d6('0x23')]]){for(var _0x43f896 in this[_0x70d6('0x8')][_0x2d6694[_0x70d6('0x23')]]){if(this[_0x70d6('0x8')][_0x2d6694[_0x70d6('0x23')]]['hasOwnProperty'](_0x43f896)&&!this[_0x70d6('0x8')][_0x2d6694[_0x70d6('0x23')]][_0x43f896][_0x70d6('0xf')]&&!this[_0x70d6('0x8')][_0x2d6694[_0x70d6('0x23')]][_0x43f896][_0x70d6('0x13')]){logger[_0x70d6('0x21')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2d6694[_0x70d6('0x23')],this[_0x70d6('0x8')][_0x2d6694[_0x70d6('0x23')]][_0x43f896][_0x70d6('0x34')],_0x43f896);this['channels'][_0x2d6694[_0x70d6('0x23')]][_0x43f896]['agentringnoanswer']=!![];this[_0x70d6('0x8')][_0x2d6694[_0x70d6('0x23')]][_0x43f896]['agentringnoanswerAt']=moment()[_0x70d6('0x32')](_0x70d6('0x28'));this[_0x70d6('0x8')][_0x2d6694[_0x70d6('0x23')]][_0x43f896][_0x70d6('0x3f')]='abandoned';this[_0x70d6('0x8')][_0x2d6694['uniqueid']][_0x43f896][_0x70d6('0x4a')]=_0x70d6('0x54');logger[_0x70d6('0x25')](_0x70d6('0x55'),_0x2d6694['uniqueid'],util[_0x70d6('0x27')](this[_0x70d6('0x8')][_0x2d6694[_0x70d6('0x23')]][_0x43f896],{'showHidden':![],'depth':null}));ami[_0x70d6('0x1e')](_0x70d6('0x56'),this[_0x70d6('0x8')][_0x2d6694['uniqueid']][_0x43f896]);}}}}}catch(_0x3c9afe){logger[_0x70d6('0x4d')](_0x70d6('0x57'),_0x2d6694[_0x70d6('0x23')],util[_0x70d6('0x27')](_0x3c9afe,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x70d6('0x1d')]['syncAgentComplete']=function(_0x2f6b7e){try{if(this[_0x70d6('0x20')](_0x2f6b7e)){logger[_0x70d6('0x25')](_0x70d6('0x58'),_0x2f6b7e[_0x70d6('0x23')],util[_0x70d6('0x27')](_0x2f6b7e,{'showHidden':![],'depth':null}));if(this[_0x70d6('0x8')][_0x2f6b7e[_0x70d6('0x23')]]){for(var _0x22e0c2 in this['channels'][_0x2f6b7e['uniqueid']]){if(this['channels'][_0x2f6b7e['uniqueid']][_0x70d6('0x37')](_0x22e0c2)){if(this[_0x70d6('0x8')][_0x2f6b7e[_0x70d6('0x23')]][_0x22e0c2][_0x70d6('0x39')]&&!this[_0x70d6('0x8')][_0x2f6b7e[_0x70d6('0x23')]][_0x22e0c2]['agentcomplete']){logger[_0x70d6('0x21')](_0x70d6('0x59'),_0x2f6b7e[_0x70d6('0x23')],this[_0x70d6('0x8')][_0x2f6b7e[_0x70d6('0x23')]][_0x22e0c2][_0x70d6('0x34')],_0x22e0c2);this['channels'][_0x2f6b7e[_0x70d6('0x23')]][_0x22e0c2]['agentcomplete']=!![];this['channels'][_0x2f6b7e['uniqueid']][_0x22e0c2]['agentcompleteAt']=moment()['format'](_0x70d6('0x28'));this['channels'][_0x2f6b7e[_0x70d6('0x23')]][_0x22e0c2][_0x70d6('0x3f')]='complete';this[_0x70d6('0x8')][_0x2f6b7e['uniqueid']][_0x22e0c2][_0x70d6('0x4a')]=_0x2f6b7e[_0x70d6('0x4a')]==_0x70d6('0x5a')?_0x70d6('0x5b'):_0x2f6b7e[_0x70d6('0x4a')];this[_0x70d6('0x8')][_0x2f6b7e[_0x70d6('0x23')]][_0x22e0c2][_0x70d6('0x5c')]=_0x2f6b7e[_0x70d6('0x5c')];if(this[_0x70d6('0x9')][_0x2f6b7e[_0x70d6('0x2a')]]&&this['voiceQueues'][_0x2f6b7e[_0x70d6('0x2a')]][_0x70d6('0x5d')]){this[_0x70d6('0x8')][_0x2f6b7e[_0x70d6('0x23')]][_0x22e0c2][_0x70d6('0x5e')]=this[_0x70d6('0x9')][_0x2f6b7e[_0x70d6('0x2a')]][_0x70d6('0x5f')];this[_0x70d6('0x8')][_0x2f6b7e[_0x70d6('0x23')]][_0x22e0c2][_0x70d6('0x60')]=!![];}this[_0x70d6('0xa')][_0x2f6b7e[_0x70d6('0x40')]]=_[_0x70d6('0x2e')](this[_0x70d6('0xa')][_0x2f6b7e['interface']],[_0x70d6('0x2a'),_0x70d6('0x42')]);logger['debug'](_0x70d6('0x61'),_0x2f6b7e[_0x70d6('0x23')],util[_0x70d6('0x27')](this[_0x70d6('0x8')][_0x2f6b7e[_0x70d6('0x23')]][_0x22e0c2],{'showHidden':![],'depth':null}));ami[_0x70d6('0x1e')]('custom:agentcomplete',this[_0x70d6('0x8')][_0x2f6b7e['uniqueid']][_0x22e0c2]);logger[_0x70d6('0x25')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x2f6b7e[_0x70d6('0x23')],util['inspect'](this['channels'][_0x2f6b7e[_0x70d6('0x23')]][_0x22e0c2],{'showHidden':![],'depth':null}));this[_0x70d6('0x1e')](util[_0x70d6('0x32')](_0x70d6('0x33'),_0x2f6b7e[_0x70d6('0x34')]),_0x70d6('0x62'),this[_0x70d6('0x8')][_0x2f6b7e[_0x70d6('0x23')]][_0x22e0c2]);}}}}}}catch(_0x12f350){logger[_0x70d6('0x4d')](_0x70d6('0x63'),_0x2f6b7e[_0x70d6('0x23')],util[_0x70d6('0x27')](_0x12f350,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x70d6('0x1d')][_0x70d6('0x16')]=function(_0x106294){try{if(this[_0x70d6('0x20')](_0x106294)){logger[_0x70d6('0x25')](_0x70d6('0x64'),_0x106294[_0x70d6('0x23')],util['inspect'](_0x106294,{'showHidden':![],'depth':null}));this['addVariable'](_0x106294[_0x70d6('0x23')],_['keys'](_0x106294[_0x70d6('0x65')])[0x0],_0x106294[_0x70d6('0x66')]);if(this[_0x70d6('0x8')][_0x106294['uniqueid']]){for(var _0x2d5611 in this['channels'][_0x106294[_0x70d6('0x23')]]){if(this[_0x70d6('0x8')][_0x106294['uniqueid']][_0x70d6('0x37')](_0x2d5611)){logger[_0x70d6('0x21')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x106294[_0x70d6('0x23')],_0x2d5611,_[_0x70d6('0x67')](_0x106294['variable'])[0x0],_0x106294[_0x70d6('0x66')]);if(_[_0x70d6('0x1f')](this['channels'][_0x106294[_0x70d6('0x23')]][_0x2d5611]['variables'])){this[_0x70d6('0x8')][_0x106294['uniqueid']][_0x2d5611][_0x70d6('0xb')]={};}this[_0x70d6('0x8')][_0x106294['uniqueid']][_0x2d5611][_0x70d6('0xb')]=this['variables'][_0x106294[_0x70d6('0x23')]];}}}}}catch(_0x43c18e){logger[_0x70d6('0x4d')](_0x70d6('0x68'),_0x106294[_0x70d6('0x23')],util[_0x70d6('0x27')](_0x43c18e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x70d6('0x1d')][_0x70d6('0x69')]=function(_0x2ae583,_0x2590d1,_0x3f6a45){var _0x49ca20=[_0x70d6('0x6a'),_0x70d6('0x6b'),_0x70d6('0x6c'),_0x70d6('0x6d'),_0x70d6('0x6e'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x70d6('0x6f'),_0x70d6('0x70'),_0x70d6('0x71'),_0x70d6('0x72'),_0x70d6('0x73'),'membercalls',_0x70d6('0x74'),'memberinterface','memberlastcall',_0x70d6('0x34'),_0x70d6('0x75'),_0x70d6('0x76')];if(!_[_0x70d6('0x77')](_0x2590d1)&&!_[_0x70d6('0x78')](_0x49ca20,_0x2590d1)){if(_[_0x70d6('0x1f')](this[_0x70d6('0xb')][_0x2ae583])){this['variables'][_0x2ae583]={};}this['variables'][_0x2ae583][_0x2590d1]=_0x3f6a45;}};VoiceAgentReport[_0x70d6('0x1d')]['syncHangup']=function(_0xa91dc1){try{if(this[_0x70d6('0x20')](_0xa91dc1)){logger[_0x70d6('0x25')]('[%s][voiceAgentReport][hangup]\x20event:',_0xa91dc1[_0x70d6('0x23')],util[_0x70d6('0x27')](_0xa91dc1,{'showHidden':![],'depth':null}));if(this[_0x70d6('0x8')][_0xa91dc1[_0x70d6('0x23')]]){for(var _0x244220 in this[_0x70d6('0x8')][_0xa91dc1['uniqueid']]){if(this[_0x70d6('0x8')][_0xa91dc1[_0x70d6('0x23')]]['hasOwnProperty'](_0x244220)){if(this[_0x70d6('0x8')][_0xa91dc1[_0x70d6('0x23')]][_0x244220]['reason']==_0x70d6('0x5a')&&this[_0x70d6('0x8')][_0xa91dc1['uniqueid']][_0x244220][_0x70d6('0x13')]){logger[_0x70d6('0x21')](_0x70d6('0x79'),_0xa91dc1[_0x70d6('0x23')],_0x244220);this['channels'][_0xa91dc1[_0x70d6('0x23')]][_0x244220][_0x70d6('0x7a')]=moment()[_0x70d6('0x32')](_0x70d6('0x28'));}}}logger[_0x70d6('0x25')](_0x70d6('0x7b'),_0xa91dc1['uniqueid'],util[_0x70d6('0x27')](_[_0x70d6('0x7c')](this[_0x70d6('0x8')][_0xa91dc1[_0x70d6('0x23')]]),{'showHidden':![],'depth':null}));ami[_0x70d6('0x1e')]('custom:voiceAgentReport',_['values'](this[_0x70d6('0x8')][_0xa91dc1[_0x70d6('0x23')]]));delete this['channels'][_0xa91dc1[_0x70d6('0x23')]];}if(this[_0x70d6('0xb')][_0xa91dc1[_0x70d6('0x23')]]){delete this[_0x70d6('0xb')][_0xa91dc1['uniqueid']];}}}catch(_0x2a9e09){logger[_0x70d6('0x4d')](_0x70d6('0x7d'),_0xa91dc1[_0x70d6('0x23')],util[_0x70d6('0x27')](_0x2a9e09,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x70d6('0x1d')][_0x70d6('0x1a')]=function(_0x5366d8){try{if(this[_0x70d6('0x20')](_0x5366d8)){logger[_0x70d6('0x25')](_0x70d6('0x7e'),_0x5366d8[_0x70d6('0x23')],util[_0x70d6('0x27')](_0x5366d8,{'showHidden':![],'depth':null}));if(this[_0x70d6('0x8')][_0x5366d8[_0x70d6('0x7f')]]){for(var _0x14ddf2 in this[_0x70d6('0x8')][_0x5366d8[_0x70d6('0x7f')]]){if(this[_0x70d6('0x8')][_0x5366d8[_0x70d6('0x7f')]][_0x70d6('0x37')](_0x14ddf2)){if(_0x5366d8['origtransfereruniqueid']===_0x14ddf2){logger['info'](_0x70d6('0x80'),_0x5366d8['uniqueid'],this[_0x70d6('0x8')][_0x5366d8[_0x70d6('0x7f')]][_0x14ddf2][_0x70d6('0x34')],_0x14ddf2);var _0x4adcc7=moment();this['channels'][_0x5366d8[_0x70d6('0x7f')]][_0x14ddf2][_0x70d6('0x13')]=!![];this[_0x70d6('0x8')][_0x5366d8[_0x70d6('0x7f')]][_0x14ddf2][_0x70d6('0x7a')]=moment()[_0x70d6('0x32')](_0x70d6('0x28'));this[_0x70d6('0x8')][_0x5366d8[_0x70d6('0x7f')]][_0x14ddf2][_0x70d6('0x3f')]=_0x70d6('0x81');this[_0x70d6('0x8')][_0x5366d8['transfereeuniqueid']][_0x14ddf2][_0x70d6('0x4a')]='transfer';this[_0x70d6('0x8')][_0x5366d8['transfereeuniqueid']][_0x14ddf2][_0x70d6('0x5c')]=_0x4adcc7[_0x70d6('0x82')](this[_0x70d6('0x8')][_0x5366d8['transfereeuniqueid']][_0x14ddf2][_0x70d6('0x39')],_0x70d6('0x83'));}}}}if(this[_0x70d6('0x8')][_0x5366d8[_0x70d6('0x84')]]){var _0x45423e=this[_0x70d6('0x8')][_0x5366d8[_0x70d6('0x84')]];this[_0x70d6('0x8')][_0x5366d8[_0x70d6('0x84')]]=this[_0x70d6('0x8')][_0x5366d8['transfereeuniqueid']];this[_0x70d6('0x8')][_0x5366d8[_0x70d6('0x7f')]]=_0x45423e;}}}catch(_0x356a96){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x5366d8[_0x70d6('0x23')],util['inspect'](_0x356a96,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x70d6('0x1d')][_0x70d6('0x1c')]=function(_0x1fd723){try{if(this[_0x70d6('0x20')](_0x1fd723)){logger[_0x70d6('0x25')](_0x70d6('0x85'),_0x1fd723[_0x70d6('0x23')],util[_0x70d6('0x27')](_0x1fd723,{'showHidden':![],'depth':null}));if(this[_0x70d6('0x8')][_0x1fd723[_0x70d6('0x7f')]]){for(var _0xd8ef05 in this[_0x70d6('0x8')][_0x1fd723['transfereeuniqueid']]){if(this['channels'][_0x1fd723[_0x70d6('0x7f')]][_0x70d6('0x37')](_0xd8ef05)){if(_0x1fd723[_0x70d6('0x86')]===_0xd8ef05){logger['info'](_0x70d6('0x87'),_0x1fd723[_0x70d6('0x23')],this['channels'][_0x1fd723['transfereeuniqueid']][_0xd8ef05][_0x70d6('0x34')],_0xd8ef05);var _0x79ebeb=moment();this['channels'][_0x1fd723['transfereeuniqueid']][_0xd8ef05][_0x70d6('0x13')]=!![];this[_0x70d6('0x8')][_0x1fd723['transfereeuniqueid']][_0xd8ef05][_0x70d6('0x7a')]=_0x79ebeb;this[_0x70d6('0x8')][_0x1fd723['transfereeuniqueid']][_0xd8ef05][_0x70d6('0x3f')]='complete';this[_0x70d6('0x8')][_0x1fd723[_0x70d6('0x7f')]][_0xd8ef05][_0x70d6('0x4a')]=_0x70d6('0x5a');this[_0x70d6('0x8')][_0x1fd723[_0x70d6('0x7f')]][_0xd8ef05]['talktime']=_0x79ebeb[_0x70d6('0x82')](this[_0x70d6('0x8')][_0x1fd723['transfereeuniqueid']][_0xd8ef05]['agentconnectAt'],_0x70d6('0x83'));}}}}}}catch(_0x498490){logger[_0x70d6('0x4d')](_0x70d6('0x88'),_0x1fd723[_0x70d6('0x23')],util[_0x70d6('0x27')](_0x498490,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x70d6('0x1d')][_0x70d6('0x89')]=function(_0x323d79){var _0x431dd4='';try{if(this[_0x70d6('0x20')](_0x323d79)){logger[_0x70d6('0x25')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x323d79[_0x70d6('0x23')],util[_0x70d6('0x27')](_0x323d79,{'showHidden':![],'depth':null}));if(_0x323d79[_0x70d6('0x8a')]){_0x431dd4=_0x323d79[_0x70d6('0x8a')]['substring'](0x0,_0x323d79['channel'][_0x70d6('0x8b')]('-'));if(this[_0x70d6('0xa')][_0x431dd4]){logger['info'](_0x70d6('0x8c'),_0x323d79[_0x70d6('0x23')],_0x431dd4);this['agents'][_0x431dd4][_0x70d6('0x8d')]=!![];}}}}catch(_0x54a2cd){logger[_0x70d6('0x4d')](_0x70d6('0x8e'),_0x323d79['uniqueid'],util[_0x70d6('0x27')](_0x54a2cd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x70d6('0x1d')][_0x70d6('0x8f')]=function(_0x551570){var _0x470d2d='';try{if(this[_0x70d6('0x20')](_0x551570)){logger[_0x70d6('0x25')](_0x70d6('0x90'),_0x551570[_0x70d6('0x23')],util['inspect'](_0x551570,{'showHidden':![],'depth':null}));if(_0x551570['channel']){_0x470d2d=_0x551570['channel'][_0x70d6('0x91')](0x0,_0x551570[_0x70d6('0x8a')]['lastIndexOf']('-'));if(this[_0x70d6('0xa')][_0x470d2d]){logger['info'](_0x70d6('0x92'),_0x551570['uniqueid'],_0x470d2d);this[_0x70d6('0xa')][_0x470d2d]['onhold']=![];}}}}catch(_0x121372){logger[_0x70d6('0x4d')]('[%s][voiceAgentReport][musiconholdstop]',_0x551570['uniqueid'],util[_0x70d6('0x27')](_0x121372,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 1135106..83e9730 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 _0xd2cf=['application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','disposition','keys','includes','lastdata','set','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','toNumber','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','push','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','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]\x20reason:%s','cause-txt','endtime','billableseconds','answertime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','blindTransfers','type','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transferconnectedlinenum','syncHangup','transfererchannel','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','queue','agi','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','defaults','redis','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','attendedtransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','pick','error','debug','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','channelstate','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0xd2cf,0x1e6));var _0xfd2c=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0xd2cf[_0xb1cf84];return _0x4bad2e;};'use strict';var BPromise=require(_0xfd2c('0x0'));var _=require(_0xfd2c('0x1'));var moment=require('moment');var util=require(_0xfd2c('0x2'));var path=require(_0xfd2c('0x3'));var Redis=require(_0xfd2c('0x4'));var config=require(_0xfd2c('0x5'));var logger=require(_0xfd2c('0x6'))(_0xfd2c('0x7'));var ami=require(_0xfd2c('0x8'));var Channel=require('../model/channel');var statusDesc=[_0xfd2c('0x9'),_0xfd2c('0xa'),_0xfd2c('0xb'),_0xfd2c('0xc'),'invalid',_0xfd2c('0xd'),_0xfd2c('0xe'),_0xfd2c('0xf'),_0xfd2c('0x10')];var applications=['set',_0xfd2c('0x11'),_0xfd2c('0x12'),_0xfd2c('0x13'),_0xfd2c('0x14'),'voicemail'];var dispositions=[_0xfd2c('0x15'),'FAILED',_0xfd2c('0x16'),_0xfd2c('0x15'),_0xfd2c('0x15'),_0xfd2c('0x15'),_0xfd2c('0x17'),'BUSY','FAILED',_0xfd2c('0x16'),'FAILED'];var actions={};config['redis']=_[_0xfd2c('0x18')](config[_0xfd2c('0x19')],{'host':'localhost','port':0x18eb});var io=require(_0xfd2c('0x1a'))(new Redis(config[_0xfd2c('0x19')]));function VoiceCallReport(_0x435dbe){this[_0xfd2c('0x1b')]=_0x435dbe['channels'];this[_0xfd2c('0x1c')]=_0x435dbe[_0xfd2c('0x1c')];this['blindTransfers']={};ami['on'](_0xfd2c('0x1d'),this[_0xfd2c('0x1e')][_0xfd2c('0x1f')](this));ami['on'](_0xfd2c('0x20'),this[_0xfd2c('0x1e')][_0xfd2c('0x1f')](this));ami['on']('newchannel',this[_0xfd2c('0x21')][_0xfd2c('0x1f')](this));ami['on'](_0xfd2c('0x22'),this[_0xfd2c('0x23')]['bind'](this));ami['on'](_0xfd2c('0x24'),this[_0xfd2c('0x25')]['bind'](this));ami['on'](_0xfd2c('0x26'),this['syncHangup'][_0xfd2c('0x1f')](this));ami['on']('newcallerid',this['syncNewCallerId'][_0xfd2c('0x1f')](this));ami['on'](_0xfd2c('0x27'),this['syncAttendedTransfer'][_0xfd2c('0x1f')](this));ami['on'](_0xfd2c('0x28'),this['syncBlindTransfer'][_0xfd2c('0x1f')](this));ami['on'](_0xfd2c('0x29'),this[_0xfd2c('0x2a')]['bind'](this));ami['on'](_0xfd2c('0x2b'),this[_0xfd2c('0x2c')][_0xfd2c('0x1f')](this));try{logger[_0xfd2c('0x2d')](_0xfd2c('0x2e'));ami[_0xfd2c('0x2f')]();}catch(_0x24d880){logger['error'](_0xfd2c('0x30'),util[_0xfd2c('0x31')](_0x24d880,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xfd2c('0x32')]['isNotNull']=function(_0x2d606b){return _0x2d606b!==null&&!_[_0xfd2c('0x33')](_0x2d606b);};VoiceCallReport[_0xfd2c('0x32')]['emit']=function(_0x16a410,_0x511b76,_0x19a3bd){io['to'](_0x16a410)[_0xfd2c('0x34')](_0x511b76,_0x19a3bd);};VoiceCallReport[_0xfd2c('0x32')]['syncNewCallerId']=function(_0x3f8ed0){try{if(this[_0xfd2c('0x35')](_0x3f8ed0)){logger['info'](_0xfd2c('0x36'),_0x3f8ed0['uniqueid'],_0x3f8ed0[_0xfd2c('0x37')],_0x3f8ed0[_0xfd2c('0x38')]);logger['debug'](_0xfd2c('0x39'),_0x3f8ed0['uniqueid'],util[_0xfd2c('0x31')](_0x3f8ed0,{'showHidden':![],'depth':null}));if(_0x3f8ed0[_0xfd2c('0x3a')]===_0x3f8ed0[_0xfd2c('0x3b')]){if(!_['isUndefined'](this[_0xfd2c('0x1b')][_0x3f8ed0['uniqueid']])){_[_0xfd2c('0x3c')](this[_0xfd2c('0x1b')][_0x3f8ed0[_0xfd2c('0x3a')]],_[_0xfd2c('0x3d')](_0x3f8ed0,_['keys'](this['channels'][_0x3f8ed0['uniqueid']])));}}}}catch(_0x55abd5){logger[_0xfd2c('0x3e')]('[%s][voiceCallReport][newcallerid]',_0x3f8ed0[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x55abd5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd2c('0x32')][_0xfd2c('0x21')]=function(_0x49ca0a){try{if(this[_0xfd2c('0x35')](_0x49ca0a)){logger[_0xfd2c('0x3f')](_0xfd2c('0x40'),_0x49ca0a[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x49ca0a,{'showHidden':![],'depth':null}));if(_0x49ca0a[_0xfd2c('0x3a')]===_0x49ca0a['linkedid']&&_0x49ca0a[_0xfd2c('0x41')]!=_0xfd2c('0x42')){if(_[_0xfd2c('0x33')](this[_0xfd2c('0x1b')][_0x49ca0a[_0xfd2c('0x3a')]])){logger[_0xfd2c('0x2d')](_0xfd2c('0x43'),_0x49ca0a[_0xfd2c('0x3a')],_0x49ca0a[_0xfd2c('0x44')],_0x49ca0a[_0xfd2c('0x45')]);this[_0xfd2c('0x1b')][_0x49ca0a['uniqueid']]=new Channel();this[_0xfd2c('0x1b')][_0x49ca0a[_0xfd2c('0x3a')]][_0xfd2c('0x46')]=moment()[_0xfd2c('0x47')](_0xfd2c('0x48'));this[_0xfd2c('0x1b')][_0x49ca0a['uniqueid']]['disposition']=dispositions[_['toNumber'](_0x49ca0a[_0xfd2c('0x49')])];_[_0xfd2c('0x3c')](this[_0xfd2c('0x1b')][_0x49ca0a[_0xfd2c('0x3a')]],_[_0xfd2c('0x3d')](_0x49ca0a,_['keys'](this[_0xfd2c('0x1b')][_0x49ca0a[_0xfd2c('0x3a')]])));if(_0x49ca0a[_0xfd2c('0x44')]===_0xfd2c('0x4a')){if(this[_0xfd2c('0x1c')][_0x49ca0a[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]]){this['agents'][_0x49ca0a[_0xfd2c('0x41')]['split']('-')[0x0]][_0xfd2c('0x4c')]=_0x49ca0a[_0xfd2c('0x45')];logger[_0xfd2c('0x3f')](_0xfd2c('0x4d'),_0x49ca0a[_0xfd2c('0x3a')],util[_0xfd2c('0x31')]({'destaccountcode':this[_0xfd2c('0x1c')][_0x49ca0a['channel'][_0xfd2c('0x4b')]('-')[0x0]][_0xfd2c('0x4e')],'destconnectedlinenum':_0x49ca0a[_0xfd2c('0x45')]},{'showHidden':![],'depth':null}));this[_0xfd2c('0x34')](util[_0xfd2c('0x47')](_0xfd2c('0x4f'),this[_0xfd2c('0x1c')][_0x49ca0a['channel']['split']('-')[0x0]][_0xfd2c('0x50')]),_0xfd2c('0x51'),{'destaccountcode':this[_0xfd2c('0x1c')][_0x49ca0a[_0xfd2c('0x41')]['split']('-')[0x0]][_0xfd2c('0x4e')],'destconnectedlinenum':_0x49ca0a['exten']});}}}}}}catch(_0x4a34fa){logger[_0xfd2c('0x3e')](_0xfd2c('0x52'),_0x49ca0a[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x4a34fa,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd2c('0x32')][_0xfd2c('0x1e')]=function(_0x2539f4){try{if(this[_0xfd2c('0x35')](_0x2539f4)){logger[_0xfd2c('0x3f')](_0xfd2c('0x53'),_0x2539f4['uniqueid'],util['inspect'](_0x2539f4,{'showHidden':![],'depth':null}));if(_0x2539f4[_0xfd2c('0x3a')]===_0x2539f4[_0xfd2c('0x3b')]&&_0x2539f4['exten']!='h'&&_0x2539f4['channel']!=_0xfd2c('0x42')){_0x2539f4[_0xfd2c('0x54')]=_0x2539f4[_0xfd2c('0x54')][_0xfd2c('0x55')]();_0x2539f4[_0xfd2c('0x56')]=(_0x2539f4[_0xfd2c('0x57')]||_0x2539f4[_0xfd2c('0x56')])[_0xfd2c('0x55')]();logger[_0xfd2c('0x2d')](_0xfd2c('0x58'),_0x2539f4[_0xfd2c('0x3a')],_0x2539f4['application'],_0x2539f4[_0xfd2c('0x56')]);if(_['isUndefined'](this[_0xfd2c('0x1b')][_0x2539f4[_0xfd2c('0x3a')]])){this['channels'][_0x2539f4[_0xfd2c('0x3a')]]=new Channel();this[_0xfd2c('0x1b')][_0x2539f4[_0xfd2c('0x3a')]][_0xfd2c('0x46')]=_0x2539f4['duration']?moment()[_0xfd2c('0x59')](moment[_0xfd2c('0x5a')](_0x2539f4[_0xfd2c('0x5a')])[_0xfd2c('0x5b')](),_0xfd2c('0x5b'))[_0xfd2c('0x47')](_0xfd2c('0x48')):moment()[_0xfd2c('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfd2c('0x1b')][_0x2539f4[_0xfd2c('0x3a')]][_0xfd2c('0x5c')]='NO\x20ANSWER';}_[_0xfd2c('0x3c')](this[_0xfd2c('0x1b')][_0x2539f4['uniqueid']],_[_0xfd2c('0x3d')](_0x2539f4,_[_0xfd2c('0x5d')](this[_0xfd2c('0x1b')][_0x2539f4[_0xfd2c('0x3a')]])));if(_[_0xfd2c('0x5e')](applications,_0x2539f4[_0xfd2c('0x54')])){this[_0xfd2c('0x1b')][_0x2539f4[_0xfd2c('0x3a')]]['lastapplication']=_0x2539f4[_0xfd2c('0x54')];this['channels'][_0x2539f4[_0xfd2c('0x3a')]][_0xfd2c('0x5f')]=_0x2539f4[_0xfd2c('0x56')];if(_0x2539f4[_0xfd2c('0x54')]===_0xfd2c('0x60')&&_[_0xfd2c('0x61')](_0x2539f4[_0xfd2c('0x56')],_0xfd2c('0x62'))){var _0x4091d0=_0x2539f4[_0xfd2c('0x56')][_0xfd2c('0x4b')]('=');var _0x598290=_0x4091d0[0x0][_0xfd2c('0x63')](/cdr\((.*)\)/);if(_0x598290){this[_0xfd2c('0x1b')][_0x2539f4['uniqueid']][_0x598290[0x1]]=_0x4091d0[0x1];}}else if(_0x2539f4[_0xfd2c('0x54')]==='queue'){this['channels'][_0x2539f4[_0xfd2c('0x3a')]][_0xfd2c('0x11')]=_0x2539f4['applicationdata'][_0xfd2c('0x4b')](',')[0x0];}}}}}catch(_0x3771e){logger[_0xfd2c('0x3e')](_0xfd2c('0x64'),_0x2539f4['uniqueid'],util[_0xfd2c('0x31')](_0x3771e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd2c('0x32')][_0xfd2c('0x23')]=function(_0x3bfdbf){try{if(this['isNotNull'](_0x3bfdbf)){logger[_0xfd2c('0x2d')](_0xfd2c('0x65'),_0x3bfdbf['uniqueid'],_0x3bfdbf[_0xfd2c('0x3b')],_0x3bfdbf[_0xfd2c('0x37')],_0x3bfdbf['calleridnum']);logger[_0xfd2c('0x3f')](_0xfd2c('0x66'),_0x3bfdbf[_0xfd2c('0x3a')],util['inspect'](_0x3bfdbf,{'showHidden':![],'depth':null}));if(_0x3bfdbf[_0xfd2c('0x3a')]!==_0x3bfdbf[_0xfd2c('0x3b')]){if(this[_0xfd2c('0x1b')][_0x3bfdbf[_0xfd2c('0x3b')]]){if(_0x3bfdbf[_0xfd2c('0x49')]==='6'){if(!this['channels'][_0x3bfdbf[_0xfd2c('0x3b')]]['answered']){var _0x140b6b=moment();this['channels'][_0x3bfdbf['linkedid']][_0xfd2c('0x67')]=!![];this['channels'][_0x3bfdbf[_0xfd2c('0x3b')]]['answertime']=_0x140b6b[_0xfd2c('0x47')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xfd2c('0x1b')][_0x3bfdbf[_0xfd2c('0x3b')]][_0xfd2c('0x46')]){this['channels'][_0x3bfdbf[_0xfd2c('0x3b')]]['holdtime']=_0x140b6b[_0xfd2c('0x68')](this[_0xfd2c('0x1b')][_0x3bfdbf[_0xfd2c('0x3b')]]['starttime'],_0xfd2c('0x5b'));}}this[_0xfd2c('0x1b')][_0x3bfdbf[_0xfd2c('0x3b')]][_0xfd2c('0x3b')]=_0x3bfdbf[_0xfd2c('0x3a')];if(_0x3bfdbf[_0xfd2c('0x38')]!==_0xfd2c('0x69')){this[_0xfd2c('0x1b')][_0x3bfdbf[_0xfd2c('0x3b')]][_0xfd2c('0x6a')]=_0x3bfdbf[_0xfd2c('0x38')];}this['channels'][_0x3bfdbf[_0xfd2c('0x3b')]][_0xfd2c('0x6b')]=_0x3bfdbf[_0xfd2c('0x37')];this['channels'][_0x3bfdbf[_0xfd2c('0x3b')]][_0xfd2c('0x6c')]=_0x3bfdbf['channel'];this[_0xfd2c('0x1b')][_0x3bfdbf[_0xfd2c('0x3b')]]['disposition']=dispositions[_[_0xfd2c('0x6d')](_0x3bfdbf[_0xfd2c('0x49')])];if(this['agents'][_0x3bfdbf[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]]){this[_0xfd2c('0x1b')][_0x3bfdbf[_0xfd2c('0x3b')]][_0xfd2c('0x6e')]=this[_0xfd2c('0x1c')][_0x3bfdbf[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]]['id'];this[_0xfd2c('0x1b')][_0x3bfdbf['linkedid']][_0xfd2c('0x6f')]=this[_0xfd2c('0x1c')][_0x3bfdbf['channel'][_0xfd2c('0x4b')]('-')[0x0]]['name'];}}}}else{if(this[_0xfd2c('0x1b')][_0x3bfdbf['uniqueid']]){if(_0x3bfdbf[_0xfd2c('0x49')]==='6'){if(this[_0xfd2c('0x1c')][_0x3bfdbf[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]]){this[_0xfd2c('0x1b')][_0x3bfdbf['uniqueid']]['UserId']=this['agents'][_0x3bfdbf['channel'][_0xfd2c('0x4b')]('-')[0x0]]['id'];this['channels'][_0x3bfdbf[_0xfd2c('0x3a')]][_0xfd2c('0x6f')]=this[_0xfd2c('0x1c')][_0x3bfdbf[_0xfd2c('0x41')]['split']('-')[0x0]][_0xfd2c('0x50')];}}}}}}catch(_0x20fbb2){logger[_0xfd2c('0x3e')](_0xfd2c('0x70'),_0x3bfdbf[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x20fbb2,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xfd2c('0x71')]=function(_0x219b88,_0x47e3e2){try{if(this['channels'][_0x219b88]){logger['info'](_0xfd2c('0x72'),_0x219b88,_0x47e3e2);this[_0xfd2c('0x1b')][_0x219b88]['monitor']=!![];if(_[_0xfd2c('0x73')](_0x47e3e2,_0xfd2c('0x74'))){_0x47e3e2=_0x47e3e2[_0xfd2c('0x75')]('.wav49',_0xfd2c('0x76'));}this[_0xfd2c('0x1b')][_0x219b88][_0xfd2c('0x77')]=_0x47e3e2;var _0x4d1b24=_['find'](this[_0xfd2c('0x1b')][_0x219b88][_0xfd2c('0x78')],{'filename':_0x47e3e2});if(_['isNil'](_0x4d1b24)){this[_0xfd2c('0x1b')][_0x219b88][_0xfd2c('0x78')][_0xfd2c('0x79')]({'filename':_0x47e3e2,'createdAt':moment()['format'](_0xfd2c('0x48')),'mixmonitorid':'','status':'rec'});}}}catch(_0x12c9a1){logger['error'](_0xfd2c('0x7a'),_0x219b88,util[_0xfd2c('0x31')](_0x12c9a1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd2c('0x32')]['syncVarSet']=function(_0x36c4cd){try{if(this['isNotNull'](_0x36c4cd)){logger[_0xfd2c('0x3f')](_0xfd2c('0x7b'),_0x36c4cd[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x36c4cd,{'showHidden':![],'depth':null}));if(this['channels'][_0x36c4cd[_0xfd2c('0x3a')]]&&_0x36c4cd[_0xfd2c('0x41')]!='OutgoingSpoolFailed'){if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')])){if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x7d')])){logger[_0xfd2c('0x2d')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd[_0xfd2c('0x7e')]);this[_0xfd2c('0x71')](_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd[_0xfd2c('0x7e')]);}else if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x7f')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd['value']);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]][_0xfd2c('0x38')]=_0x36c4cd[_0xfd2c('0x7e')];}else if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x80')])){logger['info'](_0xfd2c('0x81'),_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd['value']);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]][_0xfd2c('0x82')]=_0x36c4cd[_0xfd2c('0x7e')];}else if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x83')])){logger[_0xfd2c('0x2d')](_0xfd2c('0x84'),_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd[_0xfd2c('0x7e')]);this['channels'][_0x36c4cd[_0xfd2c('0x3a')]]['type']=_0x36c4cd[_0xfd2c('0x7e')];}else if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x85')])){logger[_0xfd2c('0x2d')](_0xfd2c('0x86'),_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd[_0xfd2c('0x7e')][_0xfd2c('0x4b')](',')[0x0]);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]][_0xfd2c('0x11')]=_0x36c4cd['value'][_0xfd2c('0x4b')](',')[0x0];}else if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x87')])){logger[_0xfd2c('0x2d')](_0xfd2c('0x88'),_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd[_0xfd2c('0x7e')]);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]][_0xfd2c('0x89')]=_0x36c4cd[_0xfd2c('0x7e')];}else if(this[_0xfd2c('0x35')](_0x36c4cd['variable'][_0xfd2c('0x8a')])){logger[_0xfd2c('0x2d')](_0xfd2c('0x8b'),_0x36c4cd['uniqueid'],_0x36c4cd[_0xfd2c('0x7e')]);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]]['destination']=_0x36c4cd[_0xfd2c('0x7e')];}else if(this[_0xfd2c('0x35')](_0x36c4cd['variable'][_0xfd2c('0x8c')])){logger[_0xfd2c('0x2d')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd[_0xfd2c('0x7e')]);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]]['calleridpreview']=_0x36c4cd[_0xfd2c('0x7e')];}else if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x8d')])){logger[_0xfd2c('0x2d')](_0xfd2c('0x8e'),_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd[_0xfd2c('0x7e')]);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]][_0xfd2c('0x11')]=_0x36c4cd['value'];}else if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x8f')])){logger[_0xfd2c('0x2d')](_0xfd2c('0x90'),_0x36c4cd['uniqueid'],_0x36c4cd['value']);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]]['sipcalluniqueid']=_0x36c4cd[_0xfd2c('0x7e')];}}}else if(this['isNotNull'](_0x36c4cd[_0xfd2c('0x7c')]['mixmonitor_filename'])){if(_0x36c4cd[_0xfd2c('0x7e')]){var _0xfb6285=path[_0xfd2c('0x91')](_0x36c4cd[_0xfd2c('0x7e')])['name'];logger[_0xfd2c('0x2d')](_0xfd2c('0x92'),_0xfb6285,_0x36c4cd[_0xfd2c('0x7e')]);this['syncMixMonitorFilename'](_0xfb6285,_0x36c4cd['value']);}}else if(this[_0xfd2c('0x1b')][_0x36c4cd['linkedid']]){if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')])){if(this['isNotNull'](_0x36c4cd['variable'][_0xfd2c('0x8f')])){logger[_0xfd2c('0x2d')](_0xfd2c('0x90'),_0x36c4cd['linkedid'],_0x36c4cd[_0xfd2c('0x7e')]);this[_0xfd2c('0x1b')][_0x36c4cd['linkedid']]['sipcalllinkedid']=_0x36c4cd[_0xfd2c('0x7e')];}}}}}catch(_0x341257){logger[_0xfd2c('0x3e')](_0xfd2c('0x93'),_0x36c4cd[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x341257,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x1cf540){try{if(this['isNotNull'](_0x1cf540)){logger['debug']('[%s][voiceCallReport][hangup]\x20event:',_0x1cf540[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x1cf540,{'showHidden':![],'depth':null}));if(this['channels'][_0x1cf540['uniqueid']]){logger[_0xfd2c('0x2d')](_0xfd2c('0x94'),_0x1cf540[_0xfd2c('0x3a')],_0x1cf540[_0xfd2c('0x95')]);var _0x1c4004=moment();this[_0xfd2c('0x1b')][_0x1cf540[_0xfd2c('0x3a')]][_0xfd2c('0x96')]=_0x1c4004['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xfd2c('0x1b')][_0x1cf540['uniqueid']][_0xfd2c('0x5a')]=_0x1c4004[_0xfd2c('0x68')](this[_0xfd2c('0x1b')][_0x1cf540['uniqueid']]['starttime'],_0xfd2c('0x5b'));if(this[_0xfd2c('0x1b')][_0x1cf540[_0xfd2c('0x3a')]][_0xfd2c('0x67')]){this[_0xfd2c('0x1b')][_0x1cf540[_0xfd2c('0x3a')]][_0xfd2c('0x97')]=_0x1c4004['diff'](this[_0xfd2c('0x1b')][_0x1cf540['uniqueid']][_0xfd2c('0x98')],_0xfd2c('0x5b'));this['channels'][_0x1cf540[_0xfd2c('0x3a')]]['holdtime']=this[_0xfd2c('0x1b')][_0x1cf540['uniqueid']][_0xfd2c('0x5a')]-this[_0xfd2c('0x1b')][_0x1cf540['uniqueid']][_0xfd2c('0x97')];}if(_0x1cf540['context']===_0xfd2c('0x4a')){if(this[_0xfd2c('0x1c')][_0x1cf540['channel'][_0xfd2c('0x4b')]('-')[0x0]]){this[_0xfd2c('0x1c')][_0x1cf540[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]]=_[_0xfd2c('0x99')](this['agents'][_0x1cf540[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]],[_0xfd2c('0x4c')]);logger[_0xfd2c('0x3f')](_0xfd2c('0x9a'),_0x1cf540[_0xfd2c('0x3a')],util[_0xfd2c('0x31')]({'destaccountcode':this[_0xfd2c('0x1c')][_0x1cf540[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]][_0xfd2c('0x4e')]},{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',this[_0xfd2c('0x1c')][_0x1cf540[_0xfd2c('0x41')]['split']('-')[0x0]][_0xfd2c('0x50')]),_0xfd2c('0x9b'),{'destaccountcode':this[_0xfd2c('0x1c')][_0x1cf540[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]][_0xfd2c('0x4e')]});}}if(_0x1cf540[_0xfd2c('0x9c')]===_0xfd2c('0x9d')){this[_0xfd2c('0x9e')][_0x1cf540[_0xfd2c('0x3a')]]=this[_0xfd2c('0x1b')][_0x1cf540[_0xfd2c('0x3a')]];}else{if(this[_0xfd2c('0x1b')][_0x1cf540[_0xfd2c('0x3a')]][_0xfd2c('0x9f')]==='outbound'&&this[_0xfd2c('0x9e')][_0x1cf540[_0xfd2c('0x3a')]]){this[_0xfd2c('0x1b')][_0x1cf540[_0xfd2c('0x3a')]][_0xfd2c('0x3a')]=[this['channels'][_0x1cf540[_0xfd2c('0x3a')]]['linkedid'],this['channels'][_0x1cf540[_0xfd2c('0x3a')]]['linkedid']=this[_0xfd2c('0x1b')][_0x1cf540['uniqueid']][_0xfd2c('0x3a')]][0x0];delete this[_0xfd2c('0x9e')][_0x1cf540[_0xfd2c('0x3a')]];}}logger[_0xfd2c('0x3f')](_0xfd2c('0xa0'),_0x1cf540[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](this[_0xfd2c('0x1b')][_0x1cf540['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xfd2c('0x34')](_0xfd2c('0xa1'),this[_0xfd2c('0x1b')][_0x1cf540[_0xfd2c('0x3a')]]);delete this['channels'][_0x1cf540[_0xfd2c('0x3a')]];}}}catch(_0x8e666b){logger[_0xfd2c('0x3e')](_0xfd2c('0xa2'),_0x1cf540['uniqueid'],util['inspect'](_0x8e666b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd2c('0x32')][_0xfd2c('0xa3')]=function(_0x40e3b6){try{if(this[_0xfd2c('0x35')](_0x40e3b6)){logger[_0xfd2c('0x2d')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x40e3b6[_0xfd2c('0x3a')],_0x40e3b6[_0xfd2c('0xa4')],_0x40e3b6[_0xfd2c('0xa5')]);logger[_0xfd2c('0x3f')](_0xfd2c('0xa6'),_0x40e3b6[_0xfd2c('0x3a')],util['inspect'](_0x40e3b6,{'showHidden':![],'depth':null}));if(this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xa7')]]){this['channels'][_0x40e3b6[_0xfd2c('0xa7')]][_0xfd2c('0xa8')]=_0x40e3b6['origtransferercalleridnum'];this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xa7')]]['transferconnectedlinenum']=_0x40e3b6[_0xfd2c('0xa5')];if(this['channels'][_0x40e3b6[_0xfd2c('0xa9')]]){var _0x4595f0=this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xa9')]];this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xa9')]]=this[_0xfd2c('0x1b')][_0x40e3b6['transfereeuniqueid']];this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xa7')]]=_0x4595f0;}}else if(this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xaa')]]){this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xaa')]]['transfercalleridnum']=_0x40e3b6[_0xfd2c('0xa4')];this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xaa')]]['transferconnectedlinenum']=_0x40e3b6[_0xfd2c('0xa5')];if(this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xab')]]){var _0x4595f0=this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xab')]];this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xab')]]=this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xaa')]];this[_0xfd2c('0x1b')][_0x40e3b6['transfertargetuniqueid']]=_0x4595f0;}}}}catch(_0x52a775){logger['error'](_0xfd2c('0xac'),_0x40e3b6['uniqueid'],util[_0xfd2c('0x31')](_0x52a775,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd2c('0x32')]['syncBlindTransfer']=function(_0x3247e3){try{if(this[_0xfd2c('0x35')](_0x3247e3)){logger['info'](_0xfd2c('0xad'),_0x3247e3['uniqueid'],_0x3247e3[_0xfd2c('0xae')],_0x3247e3[_0xfd2c('0xaf')]);logger['debug'](_0xfd2c('0xb0'),_0x3247e3[_0xfd2c('0x3a')],util['inspect'](_0x3247e3,{'showHidden':![],'depth':null}));if(this[_0xfd2c('0x1b')][_0x3247e3[_0xfd2c('0xa7')]]){this[_0xfd2c('0x1b')][_0x3247e3[_0xfd2c('0xa7')]][_0xfd2c('0xa8')]=_0x3247e3[_0xfd2c('0xae')];this[_0xfd2c('0x1b')][_0x3247e3[_0xfd2c('0xa7')]][_0xfd2c('0xb1')]=_0x3247e3[_0xfd2c('0xaf')];this[_0xfd2c('0xb2')]({'event':_0xfd2c('0x9d'),'uniqueid':_0x3247e3[_0xfd2c('0xa7')],'context':_0x3247e3['context'],'channel':_0x3247e3[_0xfd2c('0xb3')]});}}}catch(_0x2e8801){logger['error']('[%s][voiceCallReport][blindtransfer]',_0x3247e3['uniqueid'],util['inspect'](_0x2e8801,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd2c('0x32')]['syncMusicOnHoldStart']=function(_0x5b3fa3){try{if(this[_0xfd2c('0x35')](_0x5b3fa3)){logger[_0xfd2c('0x3f')](_0xfd2c('0xb4'),_0x5b3fa3[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x5b3fa3,{'showHidden':![],'depth':null}));if(this[_0xfd2c('0x1b')][_0x5b3fa3[_0xfd2c('0x3a')]]){if(!_['isNil'](this[_0xfd2c('0x1b')][_0x5b3fa3[_0xfd2c('0x3a')]][_0xfd2c('0x98')])){this[_0xfd2c('0x1b')][_0x5b3fa3[_0xfd2c('0x3a')]][_0xfd2c('0xb5')]=moment()[_0xfd2c('0x47')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xfd2c('0x2d')](_0xfd2c('0xb6'),_0x5b3fa3[_0xfd2c('0x3a')],this[_0xfd2c('0x1b')][_0x5b3fa3[_0xfd2c('0x3a')]]['mohstarttime']);}}}}catch(_0xd1aa75){logger[_0xfd2c('0x3e')](_0xfd2c('0xb7'),_0x5b3fa3[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0xd1aa75,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xfd2c('0x2c')]=function(_0x3ce1ea){try{if(this[_0xfd2c('0x35')](_0x3ce1ea)){logger[_0xfd2c('0x3f')](_0xfd2c('0xb8'),_0x3ce1ea['uniqueid'],util[_0xfd2c('0x31')](_0x3ce1ea,{'showHidden':![],'depth':null}));if(this[_0xfd2c('0x1b')][_0x3ce1ea[_0xfd2c('0x3a')]]){if(!_['isNil'](this[_0xfd2c('0x1b')][_0x3ce1ea['uniqueid']][_0xfd2c('0xb5')])){this[_0xfd2c('0x1b')][_0x3ce1ea[_0xfd2c('0x3a')]][_0xfd2c('0xb9')]+=moment()[_0xfd2c('0xba')](0x0)['diff'](this['channels'][_0x3ce1ea[_0xfd2c('0x3a')]]['mohstarttime'],_0xfd2c('0x5b'));logger[_0xfd2c('0x2d')](_0xfd2c('0xbb'),_0x3ce1ea[_0xfd2c('0x3a')],this[_0xfd2c('0x1b')][_0x3ce1ea[_0xfd2c('0x3a')]]['mohtime']);delete this['channels'][_0x3ce1ea[_0xfd2c('0x3a')]][_0xfd2c('0xb5')];}}}}catch(_0x47b2ae){logger[_0xfd2c('0x3e')](_0xfd2c('0xbc'),_0x3ce1ea['uniqueid'],util[_0xfd2c('0x31')](_0x47b2ae,{'showHidden':![],'depth':null}));}};module[_0xfd2c('0xbd')]=VoiceCallReport; \ No newline at end of file +var _0x4be5=['[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','BlindTransfer','type','outbound','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfercalleridnum','transfereeuniqueid','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohstarttime','mohtime','milliseconds','diff','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','unknown','busy','invalid','ringing','set','agi','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','bind','newexten','syncNewExten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','inspect','prototype','isUndefined','emit','isNotNull','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','error','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','user:agentconnect','[%s][voiceCallReport][newchannel]','application','toLowerCase','appdata','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','disposition','includes','lastapplication','lastdata','startsWith','cdr(','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','name','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec'];(function(_0x5cc71f,_0x4f6f52){var _0x4e1b52=function(_0x1bea3b){while(--_0x1bea3b){_0x5cc71f['push'](_0x5cc71f['shift']());}};_0x4e1b52(++_0x4f6f52);}(_0x4be5,0xef));var _0x54be=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x4be5[_0x4099ee];return _0x1b7bfc;};'use strict';var BPromise=require('bluebird');var _=require(_0x54be('0x0'));var moment=require(_0x54be('0x1'));var util=require(_0x54be('0x2'));var path=require(_0x54be('0x3'));var Redis=require(_0x54be('0x4'));var config=require(_0x54be('0x5'));var logger=require(_0x54be('0x6'))(_0x54be('0x7'));var ami=require('../ami');var Channel=require(_0x54be('0x8'));var statusDesc=[_0x54be('0x9'),'not_inuse','inuse',_0x54be('0xa'),_0x54be('0xb'),'unavailable',_0x54be('0xc'),'ringinuse','onhold'];var applications=[_0x54be('0xd'),'queue',_0x54be('0xe'),'dial',_0x54be('0xf'),_0x54be('0x10')];var dispositions=[_0x54be('0x11'),_0x54be('0x12'),_0x54be('0x12'),'NO\x20ANSWER',_0x54be('0x11'),_0x54be('0x11'),'ANSWERED',_0x54be('0x13'),_0x54be('0x12'),_0x54be('0x12'),'FAILED'];var actions={};config[_0x54be('0x14')]=_[_0x54be('0x15')](config[_0x54be('0x14')],{'host':'localhost','port':0x18eb});var io=require(_0x54be('0x16'))(new Redis(config[_0x54be('0x14')]));function VoiceCallReport(_0x1ca9e9){this['channels']=_0x1ca9e9[_0x54be('0x17')];this['agents']=_0x1ca9e9[_0x54be('0x18')];this[_0x54be('0x19')]={};ami['on']('coreshowchannel',this['syncNewExten'][_0x54be('0x1a')](this));ami['on'](_0x54be('0x1b'),this[_0x54be('0x1c')][_0x54be('0x1a')](this));ami['on']('newchannel',this[_0x54be('0x1d')]['bind'](this));ami['on'](_0x54be('0x1e'),this[_0x54be('0x1f')]['bind'](this));ami['on'](_0x54be('0x20'),this[_0x54be('0x21')][_0x54be('0x1a')](this));ami['on'](_0x54be('0x22'),this[_0x54be('0x23')][_0x54be('0x1a')](this));ami['on'](_0x54be('0x24'),this[_0x54be('0x25')][_0x54be('0x1a')](this));ami['on']('attendedtransfer',this[_0x54be('0x26')][_0x54be('0x1a')](this));ami['on'](_0x54be('0x27'),this[_0x54be('0x28')][_0x54be('0x1a')](this));ami['on']('musiconholdstart',this[_0x54be('0x29')][_0x54be('0x1a')](this));ami['on'](_0x54be('0x2a'),this['syncMusicOnHoldStop'][_0x54be('0x1a')](this));try{logger[_0x54be('0x2b')](_0x54be('0x2c'));ami[_0x54be('0x2d')]();}catch(_0x7b0ff9){logger['error']('[voiceCallReport][coreshowchannels]',util[_0x54be('0x2e')](_0x7b0ff9,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x54be('0x2f')]['isNotNull']=function(_0x815b7){return _0x815b7!==null&&!_[_0x54be('0x30')](_0x815b7);};VoiceCallReport['prototype'][_0x54be('0x31')]=function(_0x2970b9,_0x177877,_0x4b7188){io['to'](_0x2970b9)['emit'](_0x177877,_0x4b7188);};VoiceCallReport[_0x54be('0x2f')]['syncNewCallerId']=function(_0x3eca1a){try{if(this[_0x54be('0x32')](_0x3eca1a)){logger[_0x54be('0x2b')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x3eca1a[_0x54be('0x33')],_0x3eca1a[_0x54be('0x34')],_0x3eca1a[_0x54be('0x35')]);logger[_0x54be('0x36')](_0x54be('0x37'),_0x3eca1a[_0x54be('0x33')],util[_0x54be('0x2e')](_0x3eca1a,{'showHidden':![],'depth':null}));if(_0x3eca1a[_0x54be('0x33')]===_0x3eca1a[_0x54be('0x38')]){if(!_['isUndefined'](this['channels'][_0x3eca1a[_0x54be('0x33')]])){_[_0x54be('0x39')](this[_0x54be('0x17')][_0x3eca1a[_0x54be('0x33')]],_[_0x54be('0x3a')](_0x3eca1a,_[_0x54be('0x3b')](this[_0x54be('0x17')][_0x3eca1a[_0x54be('0x33')]])));}}}}catch(_0xb097ad){logger[_0x54be('0x3c')]('[%s][voiceCallReport][newcallerid]',_0x3eca1a['uniqueid'],util[_0x54be('0x2e')](_0xb097ad,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x54be('0x2f')]['syncNewChannel']=function(_0xa0062e){try{if(this['isNotNull'](_0xa0062e)){logger[_0x54be('0x36')](_0x54be('0x3d'),_0xa0062e[_0x54be('0x33')],util['inspect'](_0xa0062e,{'showHidden':![],'depth':null}));if(_0xa0062e['uniqueid']===_0xa0062e[_0x54be('0x38')]&&_0xa0062e[_0x54be('0x3e')]!=_0x54be('0x3f')){if(_[_0x54be('0x30')](this[_0x54be('0x17')][_0xa0062e['uniqueid']])){logger[_0x54be('0x2b')](_0x54be('0x40'),_0xa0062e[_0x54be('0x33')],_0xa0062e[_0x54be('0x41')],_0xa0062e[_0x54be('0x42')]);this[_0x54be('0x17')][_0xa0062e[_0x54be('0x33')]]=new Channel();this[_0x54be('0x17')][_0xa0062e[_0x54be('0x33')]][_0x54be('0x43')]=moment()[_0x54be('0x44')](_0x54be('0x45'));this[_0x54be('0x17')][_0xa0062e[_0x54be('0x33')]]['disposition']=dispositions[_[_0x54be('0x46')](_0xa0062e[_0x54be('0x47')])];_['merge'](this[_0x54be('0x17')][_0xa0062e[_0x54be('0x33')]],_[_0x54be('0x3a')](_0xa0062e,_['keys'](this[_0x54be('0x17')][_0xa0062e[_0x54be('0x33')]])));if(_0xa0062e[_0x54be('0x41')]===_0x54be('0x48')){if(this[_0x54be('0x18')][_0xa0062e['channel'][_0x54be('0x49')]('-')[0x0]]){this[_0x54be('0x18')][_0xa0062e[_0x54be('0x3e')]['split']('-')[0x0]][_0x54be('0x4a')]=_0xa0062e[_0x54be('0x42')];logger[_0x54be('0x36')](_0x54be('0x4b'),_0xa0062e[_0x54be('0x33')],util[_0x54be('0x2e')]({'destaccountcode':this[_0x54be('0x18')][_0xa0062e[_0x54be('0x3e')]['split']('-')[0x0]][_0x54be('0x4c')],'destconnectedlinenum':_0xa0062e[_0x54be('0x42')]},{'showHidden':![],'depth':null}));this[_0x54be('0x31')](util['format'](_0x54be('0x4d'),this[_0x54be('0x18')][_0xa0062e[_0x54be('0x3e')]['split']('-')[0x0]]['name']),_0x54be('0x4e'),{'destaccountcode':this[_0x54be('0x18')][_0xa0062e[_0x54be('0x3e')]['split']('-')[0x0]][_0x54be('0x4c')],'destconnectedlinenum':_0xa0062e['exten']});}}}}}}catch(_0x2d285b){logger[_0x54be('0x3c')](_0x54be('0x4f'),_0xa0062e['uniqueid'],util[_0x54be('0x2e')](_0x2d285b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x2b0877){try{if(this['isNotNull'](_0x2b0877)){logger[_0x54be('0x36')]('[%s][voiceCallReport][newexten]\x20event:',_0x2b0877[_0x54be('0x33')],util[_0x54be('0x2e')](_0x2b0877,{'showHidden':![],'depth':null}));if(_0x2b0877[_0x54be('0x33')]===_0x2b0877[_0x54be('0x38')]&&_0x2b0877[_0x54be('0x42')]!='h'&&_0x2b0877[_0x54be('0x3e')]!=_0x54be('0x3f')){_0x2b0877[_0x54be('0x50')]=_0x2b0877[_0x54be('0x50')][_0x54be('0x51')]();_0x2b0877['applicationdata']=(_0x2b0877[_0x54be('0x52')]||_0x2b0877[_0x54be('0x53')])[_0x54be('0x51')]();logger['info'](_0x54be('0x54'),_0x2b0877[_0x54be('0x33')],_0x2b0877[_0x54be('0x50')],_0x2b0877[_0x54be('0x53')]);if(_[_0x54be('0x30')](this[_0x54be('0x17')][_0x2b0877['uniqueid']])){this[_0x54be('0x17')][_0x2b0877[_0x54be('0x33')]]=new Channel();this[_0x54be('0x17')][_0x2b0877['uniqueid']][_0x54be('0x43')]=_0x2b0877['duration']?moment()[_0x54be('0x55')](moment['duration'](_0x2b0877[_0x54be('0x56')])[_0x54be('0x57')](),_0x54be('0x57'))[_0x54be('0x44')](_0x54be('0x45')):moment()[_0x54be('0x44')](_0x54be('0x45'));this[_0x54be('0x17')][_0x2b0877[_0x54be('0x33')]][_0x54be('0x58')]='NO\x20ANSWER';}_[_0x54be('0x39')](this[_0x54be('0x17')][_0x2b0877[_0x54be('0x33')]],_['pick'](_0x2b0877,_[_0x54be('0x3b')](this[_0x54be('0x17')][_0x2b0877['uniqueid']])));if(_[_0x54be('0x59')](applications,_0x2b0877[_0x54be('0x50')])){this['channels'][_0x2b0877[_0x54be('0x33')]][_0x54be('0x5a')]=_0x2b0877[_0x54be('0x50')];this[_0x54be('0x17')][_0x2b0877['uniqueid']][_0x54be('0x5b')]=_0x2b0877[_0x54be('0x53')];if(_0x2b0877[_0x54be('0x50')]===_0x54be('0xd')&&_[_0x54be('0x5c')](_0x2b0877[_0x54be('0x53')],_0x54be('0x5d'))){var _0x43f025=_0x2b0877['applicationdata'][_0x54be('0x49')]('=');var _0x1fccc1=_0x43f025[0x0]['match'](/cdr\((.*)\)/);if(_0x1fccc1){this[_0x54be('0x17')][_0x2b0877[_0x54be('0x33')]][_0x1fccc1[0x1]]=_0x43f025[0x1];}}else if(_0x2b0877['application']===_0x54be('0x5e')){this['channels'][_0x2b0877['uniqueid']][_0x54be('0x5e')]=_0x2b0877[_0x54be('0x53')][_0x54be('0x49')](',')[0x0];}}}}}catch(_0xc3fa60){logger[_0x54be('0x3c')](_0x54be('0x5f'),_0x2b0877[_0x54be('0x33')],util['inspect'](_0xc3fa60,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x108766){try{if(this['isNotNull'](_0x108766)){logger[_0x54be('0x2b')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x108766[_0x54be('0x33')],_0x108766['linkedid'],_0x108766[_0x54be('0x34')],_0x108766[_0x54be('0x35')]);logger[_0x54be('0x36')](_0x54be('0x60'),_0x108766[_0x54be('0x33')],util[_0x54be('0x2e')](_0x108766,{'showHidden':![],'depth':null}));if(_0x108766[_0x54be('0x33')]!==_0x108766[_0x54be('0x38')]){if(this[_0x54be('0x17')][_0x108766['linkedid']]){if(_0x108766['channelstate']==='6'){if(!this[_0x54be('0x17')][_0x108766['linkedid']][_0x54be('0x61')]){var _0x6e48c5=moment();this['channels'][_0x108766[_0x54be('0x38')]][_0x54be('0x61')]=!![];this[_0x54be('0x17')][_0x108766[_0x54be('0x38')]][_0x54be('0x62')]=_0x6e48c5['format'](_0x54be('0x45'));if(this[_0x54be('0x17')][_0x108766[_0x54be('0x38')]][_0x54be('0x43')]){this['channels'][_0x108766[_0x54be('0x38')]]['holdtime']=_0x6e48c5['diff'](this[_0x54be('0x17')][_0x108766[_0x54be('0x38')]]['starttime'],'seconds');}}this['channels'][_0x108766[_0x54be('0x38')]][_0x54be('0x38')]=_0x108766[_0x54be('0x33')];if(_0x108766[_0x54be('0x35')]!==_0x54be('0x63')){this[_0x54be('0x17')][_0x108766[_0x54be('0x38')]][_0x54be('0x64')]=_0x108766[_0x54be('0x35')];}this[_0x54be('0x17')][_0x108766[_0x54be('0x38')]][_0x54be('0x65')]=_0x108766['calleridname'];this[_0x54be('0x17')][_0x108766[_0x54be('0x38')]][_0x54be('0x66')]=_0x108766[_0x54be('0x3e')];this['channels'][_0x108766[_0x54be('0x38')]][_0x54be('0x58')]=dispositions[_[_0x54be('0x46')](_0x108766['channelstate'])];if(this[_0x54be('0x18')][_0x108766['channel'][_0x54be('0x49')]('-')[0x0]]){this['channels'][_0x108766[_0x54be('0x38')]][_0x54be('0x67')]=this[_0x54be('0x18')][_0x108766[_0x54be('0x3e')][_0x54be('0x49')]('-')[0x0]]['id'];this[_0x54be('0x17')][_0x108766[_0x54be('0x38')]][_0x54be('0x68')]=this[_0x54be('0x18')][_0x108766[_0x54be('0x3e')]['split']('-')[0x0]][_0x54be('0x69')];}}}}else{if(this[_0x54be('0x17')][_0x108766[_0x54be('0x33')]]){if(_0x108766[_0x54be('0x47')]==='6'){if(this['agents'][_0x108766[_0x54be('0x3e')][_0x54be('0x49')]('-')[0x0]]){this[_0x54be('0x17')][_0x108766[_0x54be('0x33')]][_0x54be('0x67')]=this[_0x54be('0x18')][_0x108766[_0x54be('0x3e')][_0x54be('0x49')]('-')[0x0]]['id'];this[_0x54be('0x17')][_0x108766[_0x54be('0x33')]][_0x54be('0x68')]=this[_0x54be('0x18')][_0x108766[_0x54be('0x3e')][_0x54be('0x49')]('-')[0x0]]['name'];}}}}}}catch(_0xcf100){logger[_0x54be('0x3c')]('[%s][voiceCallReport][newstate]',_0x108766[_0x54be('0x33')],util[_0x54be('0x2e')](_0xcf100,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x54be('0x6a')]=function(_0x509ec0,_0x4b4a04){try{if(this[_0x54be('0x17')][_0x509ec0]){logger[_0x54be('0x2b')](_0x54be('0x6b'),_0x509ec0,_0x4b4a04);this[_0x54be('0x17')][_0x509ec0][_0x54be('0x6c')]=!![];if(_[_0x54be('0x6d')](_0x4b4a04,_0x54be('0x6e'))){_0x4b4a04=_0x4b4a04[_0x54be('0x6f')](_0x54be('0x6e'),_0x54be('0x70'));}this['channels'][_0x509ec0][_0x54be('0x71')]=_0x4b4a04;var _0x532e0b=_[_0x54be('0x72')](this[_0x54be('0x17')][_0x509ec0][_0x54be('0x73')],{'filename':_0x4b4a04});if(_[_0x54be('0x74')](_0x532e0b)){this['channels'][_0x509ec0][_0x54be('0x73')][_0x54be('0x75')]({'filename':_0x4b4a04,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x54be('0x76')});}}}catch(_0x399688){logger['error'](_0x54be('0x77'),_0x509ec0,util[_0x54be('0x2e')](_0x399688,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x54be('0x2f')]['syncVarSet']=function(_0x2359fa){try{if(this[_0x54be('0x32')](_0x2359fa)){logger[_0x54be('0x36')]('[%s][voiceCallReport][varset]\x20event:',_0x2359fa['uniqueid'],util['inspect'](_0x2359fa,{'showHidden':![],'depth':null}));if(this[_0x54be('0x17')][_0x2359fa['uniqueid']]&&_0x2359fa[_0x54be('0x3e')]!=_0x54be('0x3f')){if(this[_0x54be('0x32')](_0x2359fa[_0x54be('0x78')])){if(this[_0x54be('0x32')](_0x2359fa[_0x54be('0x78')][_0x54be('0x79')])){logger[_0x54be('0x2b')](_0x54be('0x7a'),_0x2359fa[_0x54be('0x33')],_0x2359fa[_0x54be('0x7b')]);this['syncMixMonitorFilename'](_0x2359fa[_0x54be('0x33')],_0x2359fa[_0x54be('0x7b')]);}else if(this[_0x54be('0x32')](_0x2359fa['variable'][_0x54be('0x7c')])){logger[_0x54be('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x2359fa[_0x54be('0x33')],_0x2359fa['value']);this['channels'][_0x2359fa[_0x54be('0x33')]][_0x54be('0x35')]=_0x2359fa[_0x54be('0x7b')];}else if(this[_0x54be('0x32')](_0x2359fa[_0x54be('0x78')][_0x54be('0x7d')])){logger[_0x54be('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x2359fa[_0x54be('0x33')],_0x2359fa[_0x54be('0x7b')]);this['channels'][_0x2359fa[_0x54be('0x33')]][_0x54be('0x7e')]=_0x2359fa[_0x54be('0x7b')];}else if(this['isNotNull'](_0x2359fa[_0x54be('0x78')][_0x54be('0x7f')])){logger[_0x54be('0x2b')](_0x54be('0x80'),_0x2359fa[_0x54be('0x33')],_0x2359fa[_0x54be('0x7b')]);this[_0x54be('0x17')][_0x2359fa[_0x54be('0x33')]]['type']=_0x2359fa['value'];}else if(this['isNotNull'](_0x2359fa[_0x54be('0x78')]['xmd-queue'])){logger['info'](_0x54be('0x81'),_0x2359fa['uniqueid'],_0x2359fa[_0x54be('0x7b')][_0x54be('0x49')](',')[0x0]);this[_0x54be('0x17')][_0x2359fa['uniqueid']][_0x54be('0x5e')]=_0x2359fa[_0x54be('0x7b')][_0x54be('0x49')](',')[0x0];}else if(this[_0x54be('0x32')](_0x2359fa[_0x54be('0x78')][_0x54be('0x82')])){logger[_0x54be('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x2359fa[_0x54be('0x33')],_0x2359fa[_0x54be('0x7b')]);this['channels'][_0x2359fa[_0x54be('0x33')]]['originatecalleridnum']=_0x2359fa[_0x54be('0x7b')];}else if(this[_0x54be('0x32')](_0x2359fa[_0x54be('0x78')]['xmd-destination'])){logger[_0x54be('0x2b')](_0x54be('0x83'),_0x2359fa['uniqueid'],_0x2359fa[_0x54be('0x7b')]);this[_0x54be('0x17')][_0x2359fa['uniqueid']][_0x54be('0x84')]=_0x2359fa[_0x54be('0x7b')];}else if(this['isNotNull'](_0x2359fa[_0x54be('0x78')][_0x54be('0x85')])){logger['info'](_0x54be('0x86'),_0x2359fa[_0x54be('0x33')],_0x2359fa[_0x54be('0x7b')]);this['channels'][_0x2359fa['uniqueid']][_0x54be('0x87')]=_0x2359fa['value'];}else if(this['isNotNull'](_0x2359fa[_0x54be('0x78')][_0x54be('0x88')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x2359fa[_0x54be('0x33')],_0x2359fa['value']);this[_0x54be('0x17')][_0x2359fa['uniqueid']][_0x54be('0x5e')]=_0x2359fa[_0x54be('0x7b')];}else if(this[_0x54be('0x32')](_0x2359fa[_0x54be('0x78')]['sipcallid'])){logger[_0x54be('0x2b')](_0x54be('0x89'),_0x2359fa['uniqueid'],_0x2359fa[_0x54be('0x7b')]);this[_0x54be('0x17')][_0x2359fa[_0x54be('0x33')]]['sipcalluniqueid']=_0x2359fa[_0x54be('0x7b')];}}}else if(this[_0x54be('0x32')](_0x2359fa[_0x54be('0x78')]['mixmonitor_filename'])){if(_0x2359fa[_0x54be('0x7b')]){var _0x1d6398=path[_0x54be('0x8a')](_0x2359fa[_0x54be('0x7b')])[_0x54be('0x69')];logger[_0x54be('0x2b')](_0x54be('0x7a'),_0x1d6398,_0x2359fa[_0x54be('0x7b')]);this['syncMixMonitorFilename'](_0x1d6398,_0x2359fa[_0x54be('0x7b')]);}}else if(this[_0x54be('0x17')][_0x2359fa[_0x54be('0x38')]]){if(this[_0x54be('0x32')](_0x2359fa[_0x54be('0x78')])){if(this[_0x54be('0x32')](_0x2359fa[_0x54be('0x78')]['sipcallid'])){logger[_0x54be('0x2b')](_0x54be('0x89'),_0x2359fa[_0x54be('0x38')],_0x2359fa[_0x54be('0x7b')]);this[_0x54be('0x17')][_0x2359fa['linkedid']][_0x54be('0x8b')]=_0x2359fa[_0x54be('0x7b')];}}}}}catch(_0x5bb2e9){logger[_0x54be('0x3c')](_0x54be('0x8c'),_0x2359fa[_0x54be('0x33')],util[_0x54be('0x2e')](_0x5bb2e9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x2df722){try{if(this[_0x54be('0x32')](_0x2df722)){logger[_0x54be('0x36')](_0x54be('0x8d'),_0x2df722['uniqueid'],util[_0x54be('0x2e')](_0x2df722,{'showHidden':![],'depth':null}));if(this[_0x54be('0x17')][_0x2df722[_0x54be('0x33')]]){logger[_0x54be('0x2b')](_0x54be('0x8e'),_0x2df722[_0x54be('0x33')],_0x2df722[_0x54be('0x8f')]);var _0x4d2ef3=moment();this[_0x54be('0x17')][_0x2df722[_0x54be('0x33')]]['endtime']=_0x4d2ef3[_0x54be('0x44')](_0x54be('0x45'));this[_0x54be('0x17')][_0x2df722[_0x54be('0x33')]][_0x54be('0x56')]=_0x4d2ef3['diff'](this[_0x54be('0x17')][_0x2df722[_0x54be('0x33')]][_0x54be('0x43')],'seconds');if(this['channels'][_0x2df722[_0x54be('0x33')]][_0x54be('0x61')]){this['channels'][_0x2df722['uniqueid']]['billableseconds']=_0x4d2ef3['diff'](this[_0x54be('0x17')][_0x2df722[_0x54be('0x33')]][_0x54be('0x62')],'seconds');this['channels'][_0x2df722[_0x54be('0x33')]][_0x54be('0x90')]=this[_0x54be('0x17')][_0x2df722[_0x54be('0x33')]][_0x54be('0x56')]-this['channels'][_0x2df722[_0x54be('0x33')]]['billableseconds'];}if(_0x2df722[_0x54be('0x41')]===_0x54be('0x48')){if(this[_0x54be('0x18')][_0x2df722[_0x54be('0x3e')][_0x54be('0x49')]('-')[0x0]]){this[_0x54be('0x18')][_0x2df722[_0x54be('0x3e')][_0x54be('0x49')]('-')[0x0]]=_[_0x54be('0x91')](this[_0x54be('0x18')][_0x2df722[_0x54be('0x3e')][_0x54be('0x49')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0x54be('0x92'),_0x2df722[_0x54be('0x33')],util[_0x54be('0x2e')]({'destaccountcode':this[_0x54be('0x18')][_0x2df722[_0x54be('0x3e')][_0x54be('0x49')]('-')[0x0]][_0x54be('0x4c')]},{'showHidden':![],'depth':null}));this[_0x54be('0x31')](util[_0x54be('0x44')](_0x54be('0x4d'),this['agents'][_0x2df722[_0x54be('0x3e')][_0x54be('0x49')]('-')[0x0]][_0x54be('0x69')]),_0x54be('0x93'),{'destaccountcode':this[_0x54be('0x18')][_0x2df722[_0x54be('0x3e')]['split']('-')[0x0]]['accountcode']});}}if(_0x2df722['event']===_0x54be('0x94')){this[_0x54be('0x19')][_0x2df722[_0x54be('0x33')]]=this[_0x54be('0x17')][_0x2df722[_0x54be('0x33')]];}else{if(this[_0x54be('0x17')][_0x2df722[_0x54be('0x33')]][_0x54be('0x95')]===_0x54be('0x96')&&this[_0x54be('0x19')][_0x2df722[_0x54be('0x33')]]){this['channels'][_0x2df722[_0x54be('0x33')]][_0x54be('0x33')]=[this[_0x54be('0x17')][_0x2df722[_0x54be('0x33')]][_0x54be('0x38')],this[_0x54be('0x17')][_0x2df722['uniqueid']][_0x54be('0x38')]=this[_0x54be('0x17')][_0x2df722[_0x54be('0x33')]][_0x54be('0x33')]][0x0];delete this['blindTransfers'][_0x2df722['uniqueid']];}}logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x2df722[_0x54be('0x33')],util[_0x54be('0x2e')](this[_0x54be('0x17')][_0x2df722[_0x54be('0x33')]],{'showHidden':![],'depth':null}));ami[_0x54be('0x31')](_0x54be('0x97'),this[_0x54be('0x17')][_0x2df722[_0x54be('0x33')]]);delete this[_0x54be('0x17')][_0x2df722[_0x54be('0x33')]];}}}catch(_0x3ce310){logger['error'](_0x54be('0x98'),_0x2df722[_0x54be('0x33')],util[_0x54be('0x2e')](_0x3ce310,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x54be('0x2f')][_0x54be('0x26')]=function(_0x541b7d){try{if(this[_0x54be('0x32')](_0x541b7d)){logger[_0x54be('0x2b')](_0x54be('0x99'),_0x541b7d[_0x54be('0x33')],_0x541b7d[_0x54be('0x9a')],_0x541b7d['transfertargetcalleridnum']);logger[_0x54be('0x36')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x541b7d[_0x54be('0x33')],util[_0x54be('0x2e')](_0x541b7d,{'showHidden':![],'depth':null}));if(this[_0x54be('0x17')][_0x541b7d['transfereeuniqueid']]){this[_0x54be('0x17')][_0x541b7d['transfereeuniqueid']][_0x54be('0x9b')]=_0x541b7d[_0x54be('0x9a')];this[_0x54be('0x17')][_0x541b7d[_0x54be('0x9c')]][_0x54be('0x9d')]=_0x541b7d[_0x54be('0x9e')];if(this[_0x54be('0x17')][_0x541b7d['secondtransfereruniqueid']]){var _0x43066f=this[_0x54be('0x17')][_0x541b7d[_0x54be('0x9f')]];this[_0x54be('0x17')][_0x541b7d[_0x54be('0x9f')]]=this['channels'][_0x541b7d['transfereeuniqueid']];this[_0x54be('0x17')][_0x541b7d[_0x54be('0x9c')]]=_0x43066f;}}else if(this['channels'][_0x541b7d['transfertargetuniqueid']]){this[_0x54be('0x17')][_0x541b7d['transfertargetuniqueid']][_0x54be('0x9b')]=_0x541b7d[_0x54be('0x9a')];this[_0x54be('0x17')][_0x541b7d[_0x54be('0xa0')]][_0x54be('0x9d')]=_0x541b7d[_0x54be('0x9e')];if(this[_0x54be('0x17')][_0x541b7d[_0x54be('0xa1')]]){var _0x43066f=this[_0x54be('0x17')][_0x541b7d[_0x54be('0xa1')]];this[_0x54be('0x17')][_0x541b7d[_0x54be('0xa1')]]=this[_0x54be('0x17')][_0x541b7d[_0x54be('0xa0')]];this[_0x54be('0x17')][_0x541b7d['transfertargetuniqueid']]=_0x43066f;}}}}catch(_0x5184c5){logger[_0x54be('0x3c')](_0x54be('0xa2'),_0x541b7d[_0x54be('0x33')],util['inspect'](_0x5184c5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x54be('0x2f')][_0x54be('0x28')]=function(_0x42dbe0){try{if(this[_0x54be('0x32')](_0x42dbe0)){logger[_0x54be('0x2b')](_0x54be('0xa3'),_0x42dbe0[_0x54be('0x33')],_0x42dbe0[_0x54be('0xa4')],_0x42dbe0['extension']);logger[_0x54be('0x36')](_0x54be('0xa5'),_0x42dbe0[_0x54be('0x33')],util[_0x54be('0x2e')](_0x42dbe0,{'showHidden':![],'depth':null}));if(this['channels'][_0x42dbe0[_0x54be('0x9c')]]){this[_0x54be('0x17')][_0x42dbe0['transfereeuniqueid']][_0x54be('0x9b')]=_0x42dbe0[_0x54be('0xa4')];this[_0x54be('0x17')][_0x42dbe0['transfereeuniqueid']][_0x54be('0x9d')]=_0x42dbe0[_0x54be('0xa6')];this[_0x54be('0x23')]({'event':_0x54be('0x94'),'uniqueid':_0x42dbe0[_0x54be('0x9c')],'context':_0x42dbe0['context'],'channel':_0x42dbe0['transfererchannel']});}}}catch(_0x88b7d){logger[_0x54be('0x3c')](_0x54be('0xa7'),_0x42dbe0[_0x54be('0x33')],util[_0x54be('0x2e')](_0x88b7d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x54be('0x2f')][_0x54be('0x29')]=function(_0x3df0bf){try{if(this[_0x54be('0x32')](_0x3df0bf)){logger[_0x54be('0x36')](_0x54be('0xa8'),_0x3df0bf[_0x54be('0x33')],util[_0x54be('0x2e')](_0x3df0bf,{'showHidden':![],'depth':null}));if(this[_0x54be('0x17')][_0x3df0bf[_0x54be('0x33')]]){if(!_[_0x54be('0x74')](this[_0x54be('0x17')][_0x3df0bf[_0x54be('0x33')]]['answertime'])){this['channels'][_0x3df0bf[_0x54be('0x33')]]['mohstarttime']=moment()[_0x54be('0x44')](_0x54be('0x45'));logger[_0x54be('0x2b')](_0x54be('0xa9'),_0x3df0bf[_0x54be('0x33')],this[_0x54be('0x17')][_0x3df0bf[_0x54be('0x33')]]['mohstarttime']);}}}}catch(_0x578f45){logger['error'](_0x54be('0xaa'),_0x3df0bf[_0x54be('0x33')],util[_0x54be('0x2e')](_0x578f45,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x54be('0x2f')][_0x54be('0xab')]=function(_0x2c3c2e){try{if(this['isNotNull'](_0x2c3c2e)){logger[_0x54be('0x36')](_0x54be('0xac'),_0x2c3c2e[_0x54be('0x33')],util[_0x54be('0x2e')](_0x2c3c2e,{'showHidden':![],'depth':null}));if(this['channels'][_0x2c3c2e[_0x54be('0x33')]]){if(!_[_0x54be('0x74')](this['channels'][_0x2c3c2e[_0x54be('0x33')]][_0x54be('0xad')])){this[_0x54be('0x17')][_0x2c3c2e['uniqueid']][_0x54be('0xae')]+=moment()[_0x54be('0xaf')](0x0)[_0x54be('0xb0')](this[_0x54be('0x17')][_0x2c3c2e[_0x54be('0x33')]]['mohstarttime'],'seconds');logger[_0x54be('0x2b')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x2c3c2e[_0x54be('0x33')],this[_0x54be('0x17')][_0x2c3c2e[_0x54be('0x33')]][_0x54be('0xae')]);delete this[_0x54be('0x17')][_0x2c3c2e[_0x54be('0x33')]][_0x54be('0xad')];}}}}catch(_0x5ea23a){logger['error'](_0x54be('0xb1'),_0x2c3c2e['uniqueid'],util['inspect'](_0x5ea23a,{'showHidden':![],'depth':null}));}};module[_0x54be('0xb2')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 2e6cd5a..91f3305 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 _0x354e=['destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','prototype','isNotNull','isUndefined','emit','[%s][voiceDialReport][dialbegin]\x20event:','inspect','channels','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','duration','endtime','diff','starttime','complete','total','answered','seconds','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','stringify','linkedid'];(function(_0x323419,_0x2a6172){var _0x4c0be7=function(_0x5ae2df){while(--_0x5ae2df){_0x323419['push'](_0x323419['shift']());}};_0x4c0be7(++_0x2a6172);}(_0x354e,0x14a));var _0xe354=function(_0x255709,_0x390c9a){_0x255709=_0x255709-0x0;var _0x28ba83=_0x354e[_0x255709];return _0x28ba83;};'use strict';var _=require(_0xe354('0x0'));var moment=require(_0xe354('0x1'));var util=require(_0xe354('0x2'));var Redis=require(_0xe354('0x3'));var config=require(_0xe354('0x4'));var logger=require(_0xe354('0x5'))(_0xe354('0x6'));var ami=require(_0xe354('0x7'));config[_0xe354('0x8')]=_['defaults'](config[_0xe354('0x8')],{'host':_0xe354('0x9'),'port':0x18eb});var io=require(_0xe354('0xa'))(new Redis(config[_0xe354('0x8')]));function VoiceDialReport(_0x32046b){this['channels']=_0x32046b[_0xe354('0xb')];this[_0xe354('0xc')]=_0x32046b[_0xe354('0xc')];this[_0xe354('0xd')]={};ami['on'](_0xe354('0xe'),this[_0xe354('0xf')][_0xe354('0x10')](this));ami['on'](_0xe354('0x11'),this[_0xe354('0x12')]['bind'](this));ami['on'](_0xe354('0x13'),this[_0xe354('0x14')][_0xe354('0x10')](this));ami['on']('hangup',this['syncHangup'][_0xe354('0x10')](this));}VoiceDialReport[_0xe354('0x15')][_0xe354('0x16')]=function(_0x2bfb54){return _0x2bfb54!==null&&!_[_0xe354('0x17')](_0x2bfb54);};VoiceDialReport[_0xe354('0x15')][_0xe354('0x18')]=function(_0x4a5bac,_0x1f320a,_0x536269){io['to'](_0x4a5bac)[_0xe354('0x18')](_0x1f320a,_0x536269);};VoiceDialReport['prototype'][_0xe354('0xf')]=function(_0x2c944c){try{if(this['isNotNull'](_0x2c944c)){logger['debug'](_0xe354('0x19'),_0x2c944c['uniqueid'],util[_0xe354('0x1a')](_0x2c944c,{'showHidden':![],'depth':null}));if(this[_0xe354('0x1b')][_0x2c944c[_0xe354('0x1c')]]){_[_0xe354('0x1d')](this[_0xe354('0x1b')][_0x2c944c[_0xe354('0x1c')]],{'starttime':moment()[_0xe354('0x1e')](_0xe354('0x1f')),'lastevent':'called','interface':_0x2c944c[_0xe354('0x20')][_0xe354('0x21')](0x0,_0x2c944c['channel'][_0xe354('0x22')]('-')),'membername':_0x2c944c[_0xe354('0x20')]['substring'](_0x2c944c['channel']['lastIndexOf']('/')+0x1,_0x2c944c[_0xe354('0x20')][_0xe354('0x22')]('-'))},_[_0xe354('0x23')](_0x2c944c,[_0xe354('0x24'),_0xe354('0x25')]));logger[_0xe354('0x26')](_0xe354('0x27'),_0x2c944c[_0xe354('0x1c')],this[_0xe354('0x1b')][_0x2c944c[_0xe354('0x1c')]][_0xe354('0x28')],this[_0xe354('0x1b')][_0x2c944c[_0xe354('0x1c')]][_0xe354('0x29')]);logger['debug'](_0xe354('0x2a'),_0x2c944c[_0xe354('0x1c')],util[_0xe354('0x1a')](this['channels'][_0x2c944c[_0xe354('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0xe354('0x2b'),'voice_outbound_channel:save',this['channels'][_0x2c944c['uniqueid']]);logger[_0xe354('0x2c')](_0xe354('0x2d'),_0x2c944c[_0xe354('0x1c')],util[_0xe354('0x1a')](this['channels'][_0x2c944c[_0xe354('0x1c')]],{'showHidden':![],'depth':null}));ami['emit'](_0xe354('0x2e'),this[_0xe354('0x1b')][_0x2c944c[_0xe354('0x1c')]]);}}}catch(_0x1e13fa){logger[_0xe354('0x2f')](_0xe354('0x30'),_0x2c944c['uniqueid'],util['inspect'](_0x1e13fa,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xe354('0x12')]=function(_0x4910a0){try{if(this[_0xe354('0x16')](_0x4910a0)){logger[_0xe354('0x2c')](_0xe354('0x31'),_0x4910a0['uniqueid'],util[_0xe354('0x1a')](_0x4910a0,{'showHidden':![],'depth':null}));if(this[_0xe354('0x1b')][_0x4910a0[_0xe354('0x1c')]]){this['channels'][_0x4910a0['uniqueid']][_0xe354('0x32')]=_0x4910a0[_0xe354('0x32')];if(_0x4910a0['dialstatus']===_0xe354('0x33')){this[_0xe354('0x1b')][_0x4910a0[_0xe354('0x1c')]][_0xe354('0x34')]=_0x4910a0[_0xe354('0x34')];this[_0xe354('0x1b')][_0x4910a0[_0xe354('0x1c')]][_0xe354('0x35')]=_0x4910a0[_0xe354('0x35')];this[_0xe354('0x1b')][_0x4910a0[_0xe354('0x1c')]][_0xe354('0x36')]=moment()[_0xe354('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe354('0x1b')][_0x4910a0['uniqueid']][_0xe354('0x37')]=_0xe354('0x38');logger[_0xe354('0x26')](_0xe354('0x39'),_0x4910a0[_0xe354('0x1c')],_0x4910a0[_0xe354('0x20')][_0xe354('0x21')](_0x4910a0['channel']['lastIndexOf']('/')+0x1,_0x4910a0[_0xe354('0x20')][_0xe354('0x22')]('-')));logger[_0xe354('0x2c')](_0xe354('0x3a'),_0x4910a0[_0xe354('0x1c')],util['inspect'](this[_0xe354('0x1b')][_0x4910a0['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:dialconnect',this[_0xe354('0x1b')][_0x4910a0[_0xe354('0x1c')]]);}logger[_0xe354('0x2c')](_0xe354('0x3b'),_0x4910a0[_0xe354('0x1c')],util[_0xe354('0x1a')](this['channels'][_0x4910a0['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0xe354('0x2b'),_0xe354('0x3c'),this[_0xe354('0x1b')][_0x4910a0[_0xe354('0x1c')]]);}}}catch(_0x439213){logger['error'](_0xe354('0x3d'),_0x4910a0[_0xe354('0x1c')],util[_0xe354('0x1a')](_0x439213,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe354('0x15')][_0xe354('0x14')]=function(_0x4fc5b8){try{if(this[_0xe354('0x16')](_0x4fc5b8)){logger['debug']('[%s][voiceDialReport][varset]\x20event:',_0x4fc5b8[_0xe354('0x1c')],util['inspect'](_0x4fc5b8,{'showHidden':![],'depth':null}));this[_0xe354('0x3e')](_0x4fc5b8[_0xe354('0x1c')],_[_0xe354('0x3f')](_0x4fc5b8[_0xe354('0x40')])[0x0],_0x4fc5b8[_0xe354('0x41')]);if(this[_0xe354('0x16')](_0x4fc5b8[_0xe354('0x40')])&&this['isNotNull'](_0x4fc5b8[_0xe354('0x40')][_0xe354('0x42')])){if(_[_0xe354('0x17')](this[_0xe354('0x1b')][_0x4fc5b8['uniqueid']])){this[_0xe354('0x1b')][_0x4fc5b8[_0xe354('0x1c')]]={'routeId':_0x4fc5b8['value'],'variables':this[_0xe354('0xd')][_0x4fc5b8['uniqueid']]};logger[_0xe354('0x26')](_0xe354('0x43'),_0x4fc5b8[_0xe354('0x1c')],_0x4fc5b8[_0xe354('0x40')][_0xe354('0x42')],_[_0xe354('0x3f')](_0x4fc5b8[_0xe354('0x40')])[0x0],_0x4fc5b8[_0xe354('0x41')]);logger[_0xe354('0x2c')](_0xe354('0x44'),_0x4fc5b8['uniqueid'],util[_0xe354('0x1a')](this[_0xe354('0x1b')][_0x4fc5b8['uniqueid']],{'showHidden':![],'depth':null}));this[_0xe354('0x18')](_0xe354('0x2b'),_0xe354('0x3c'),this['channels'][_0x4fc5b8[_0xe354('0x1c')]]);}}}}catch(_0x297b41){logger['error'](_0xe354('0x45'),_0x4fc5b8[_0xe354('0x1c')],util[_0xe354('0x1a')](_0x297b41,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe354('0x15')][_0xe354('0x3e')]=function(_0x3db04c,_0x11dc03,_0x4d3d55){var _0x1a8b05=[_0xe354('0x46'),_0xe354('0x47'),'rtpaudioqosjitter',_0xe354('0x48'),_0xe354('0x49'),_0xe354('0x4a'),_0xe354('0x4b'),'rtpaudioqosrttbridged',_0xe354('0x4c'),'sipuri','bridgepeer','bridgepvtcallid',_0xe354('0x4d'),_0xe354('0x4e'),_0xe354('0x4f'),_0xe354('0x50'),_0xe354('0x28'),_0xe354('0x51'),_0xe354('0x52')];if(!_[_0xe354('0x53')](_0x11dc03)&&!_[_0xe354('0x54')](_0x1a8b05,_0x11dc03)){if(_[_0xe354('0x17')](this[_0xe354('0xd')][_0x3db04c])){this[_0xe354('0xd')][_0x3db04c]={};}this['variables'][_0x3db04c][_0x11dc03]=_0x4d3d55;}};VoiceDialReport['prototype'][_0xe354('0x55')]=function(_0x4ff538){try{if(this[_0xe354('0x16')](_0x4ff538)){logger[_0xe354('0x2c')](_0xe354('0x56'),_0x4ff538['uniqueid'],util[_0xe354('0x1a')](_0x4ff538,{'showHidden':![],'depth':null}));if(this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]]){logger[_0xe354('0x26')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x4ff538[_0xe354('0x1c')],_0x4ff538['cause-txt']);this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]]['endtime']=moment()['format'](_0xe354('0x1f'));this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x57')]=moment(this['channels'][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x58')])[_0xe354('0x59')](this[_0xe354('0x1b')][_0x4ff538['uniqueid']][_0xe354('0x5a')],'seconds');this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]]['lastevent']=_0xe354('0x5b');this['outbound'][_0xe354('0x5c')]+=0x1;if(this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x36')]){this['outbound'][_0xe354('0x5d')]+=0x1;this['channels'][_0x4ff538[_0xe354('0x1c')]]['holdtime']=moment(this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x36')])[_0xe354('0x59')](this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x5a')],_0xe354('0x5e'));this[_0xe354('0x1b')][_0x4ff538['uniqueid']][_0xe354('0x5f')]=moment(this['channels'][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x58')])[_0xe354('0x59')](this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x36')],_0xe354('0x5e'));this[_0xe354('0xc')][_0xe354('0x60')]+=this['channels'][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x61')]||0x0;this[_0xe354('0xc')][_0xe354('0x62')]+=this['channels'][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x5f')];}this['outbound'][_0xe354('0x63')]+=this[_0xe354('0x1b')][_0x4ff538['uniqueid']][_0xe354('0x57')];logger[_0xe354('0x2c')](_0xe354('0x64'),_0x4ff538[_0xe354('0x1c')],util[_0xe354('0x1a')](this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xe354('0x18')]('custom:voiceDialReport',this[_0xe354('0x1b')][_0x4ff538['uniqueid']]);logger[_0xe354('0x2c')](_0xe354('0x65'),_0x4ff538[_0xe354('0x1c')],util[_0xe354('0x1a')](this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xe354('0x18')](_0xe354('0x66'),this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]]);logger[_0xe354('0x2c')](_0xe354('0x67'),_0x4ff538['uniqueid'],util['inspect'](this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]],{'showHidden':![],'depth':null}));this[_0xe354('0x18')](_0xe354('0x2b'),'voice_outbound:save',this[_0xe354('0xc')]);logger[_0xe354('0x26')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0xe354('0x68')](this[_0xe354('0x1b')][_0x4ff538['uniqueid']]));logger[_0xe354('0x2c')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x4ff538[_0xe354('0x1c')],util[_0xe354('0x1a')](this['channels'][_0x4ff538[_0xe354('0x1c')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound_channel:remove',this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]]);delete this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]];}else if(this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x69')]]){this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x69')]][_0xe354('0x1c')]=this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x69')]][_0xe354('0x6a')];}if(this['variables'][_0x4ff538[_0xe354('0x1c')]]){delete this[_0xe354('0xd')][_0x4ff538['uniqueid']];}}}catch(_0xf45239){logger['error'](_0xe354('0x6b'),_0x4ff538[_0xe354('0x1c')],util[_0xe354('0x1a')](_0xf45239,{'showHidden':![],'depth':null}));}};module[_0xe354('0x6c')]=VoiceDialReport; \ No newline at end of file +var _0xf44f=['total','answered','holdtime','billableseconds','sumBillable','sumDuration','duration','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','moment','util','ioredis','../../../config/logger','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','called','channel','lastIndexOf','substring','omit','event','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','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','answertime','format','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:','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','diff','starttime','seconds','complete'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xf44f,0x7f));var _0xff44=function(_0x235b06,_0x3ddca2){_0x235b06=_0x235b06-0x0;var _0xcd3900=_0xf44f[_0x235b06];return _0xcd3900;};'use strict';var _=require('lodash');var moment=require(_0xff44('0x0'));var util=require(_0xff44('0x1'));var Redis=require(_0xff44('0x2'));var config=require('../../../config/environment');var logger=require(_0xff44('0x3'))('ami');var ami=require(_0xff44('0x4'));config[_0xff44('0x5')]=_[_0xff44('0x6')](config['redis'],{'host':_0xff44('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xff44('0x5')]));function VoiceDialReport(_0x405325){this[_0xff44('0x8')]=_0x405325[_0xff44('0x9')];this[_0xff44('0xa')]=_0x405325[_0xff44('0xa')];this[_0xff44('0xb')]={};ami['on'](_0xff44('0xc'),this[_0xff44('0xd')][_0xff44('0xe')](this));ami['on'](_0xff44('0xf'),this[_0xff44('0x10')]['bind'](this));ami['on'](_0xff44('0x11'),this['syncVarSet']['bind'](this));ami['on'](_0xff44('0x12'),this[_0xff44('0x13')][_0xff44('0xe')](this));}VoiceDialReport[_0xff44('0x14')][_0xff44('0x15')]=function(_0x5e6d87){return _0x5e6d87!==null&&!_[_0xff44('0x16')](_0x5e6d87);};VoiceDialReport['prototype'][_0xff44('0x17')]=function(_0x2ef40f,_0x29f17,_0x102a6b){io['to'](_0x2ef40f)[_0xff44('0x17')](_0x29f17,_0x102a6b);};VoiceDialReport[_0xff44('0x14')][_0xff44('0xd')]=function(_0x5425bf){try{if(this[_0xff44('0x15')](_0x5425bf)){logger[_0xff44('0x18')](_0xff44('0x19'),_0x5425bf[_0xff44('0x1a')],util[_0xff44('0x1b')](_0x5425bf,{'showHidden':![],'depth':null}));if(this[_0xff44('0x8')][_0x5425bf[_0xff44('0x1a')]]){_[_0xff44('0x1c')](this['channels'][_0x5425bf['uniqueid']],{'starttime':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xff44('0x1d'),'interface':_0x5425bf['channel']['substring'](0x0,_0x5425bf[_0xff44('0x1e')][_0xff44('0x1f')]('-')),'membername':_0x5425bf['channel'][_0xff44('0x20')](_0x5425bf['channel'][_0xff44('0x1f')]('/')+0x1,_0x5425bf[_0xff44('0x1e')][_0xff44('0x1f')]('-'))},_[_0xff44('0x21')](_0x5425bf,[_0xff44('0x22'),'privilege']));logger[_0xff44('0x23')](_0xff44('0x24'),_0x5425bf[_0xff44('0x1a')],this[_0xff44('0x8')][_0x5425bf[_0xff44('0x1a')]][_0xff44('0x25')],this[_0xff44('0x8')][_0x5425bf['uniqueid']]['interface']);logger[_0xff44('0x18')](_0xff44('0x26'),_0x5425bf[_0xff44('0x1a')],util[_0xff44('0x1b')](this[_0xff44('0x8')][_0x5425bf['uniqueid']],{'showHidden':![],'depth':null}));this[_0xff44('0x17')](_0xff44('0x27'),_0xff44('0x28'),this[_0xff44('0x8')][_0x5425bf[_0xff44('0x1a')]]);logger[_0xff44('0x18')](_0xff44('0x29'),_0x5425bf[_0xff44('0x1a')],util[_0xff44('0x1b')](this[_0xff44('0x8')][_0x5425bf['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xff44('0x17')](_0xff44('0x2a'),this['channels'][_0x5425bf[_0xff44('0x1a')]]);}}}catch(_0x468e27){logger[_0xff44('0x2b')](_0xff44('0x2c'),_0x5425bf[_0xff44('0x1a')],util[_0xff44('0x1b')](_0x468e27,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xff44('0x14')][_0xff44('0x10')]=function(_0x59a1bf){try{if(this[_0xff44('0x15')](_0x59a1bf)){logger[_0xff44('0x18')](_0xff44('0x2d'),_0x59a1bf['uniqueid'],util[_0xff44('0x1b')](_0x59a1bf,{'showHidden':![],'depth':null}));if(this[_0xff44('0x8')][_0x59a1bf[_0xff44('0x1a')]]){this[_0xff44('0x8')][_0x59a1bf[_0xff44('0x1a')]][_0xff44('0x2e')]=_0x59a1bf[_0xff44('0x2e')];if(_0x59a1bf[_0xff44('0x2e')]==='ANSWER'){this[_0xff44('0x8')][_0x59a1bf[_0xff44('0x1a')]]['connectedlinenum']=_0x59a1bf[_0xff44('0x2f')];this['channels'][_0x59a1bf[_0xff44('0x1a')]]['connectedlinename']=_0x59a1bf[_0xff44('0x30')];this[_0xff44('0x8')][_0x59a1bf[_0xff44('0x1a')]][_0xff44('0x31')]=moment()[_0xff44('0x32')](_0xff44('0x33'));this[_0xff44('0x8')][_0x59a1bf['uniqueid']][_0xff44('0x34')]=_0xff44('0x35');logger[_0xff44('0x23')](_0xff44('0x36'),_0x59a1bf['uniqueid'],_0x59a1bf[_0xff44('0x1e')][_0xff44('0x20')](_0x59a1bf[_0xff44('0x1e')][_0xff44('0x1f')]('/')+0x1,_0x59a1bf[_0xff44('0x1e')][_0xff44('0x1f')]('-')));logger[_0xff44('0x18')](_0xff44('0x37'),_0x59a1bf[_0xff44('0x1a')],util[_0xff44('0x1b')](this['channels'][_0x59a1bf['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xff44('0x17')](_0xff44('0x38'),this[_0xff44('0x8')][_0x59a1bf[_0xff44('0x1a')]]);}logger[_0xff44('0x18')](_0xff44('0x39'),_0x59a1bf[_0xff44('0x1a')],util[_0xff44('0x1b')](this['channels'][_0x59a1bf[_0xff44('0x1a')]],{'showHidden':![],'depth':null}));this[_0xff44('0x17')]('voice:outbound',_0xff44('0x28'),this['channels'][_0x59a1bf[_0xff44('0x1a')]]);}}}catch(_0x297db2){logger['error'](_0xff44('0x3a'),_0x59a1bf[_0xff44('0x1a')],util[_0xff44('0x1b')](_0x297db2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xff44('0x14')][_0xff44('0x3b')]=function(_0x1429ee){try{if(this[_0xff44('0x15')](_0x1429ee)){logger[_0xff44('0x18')](_0xff44('0x3c'),_0x1429ee[_0xff44('0x1a')],util[_0xff44('0x1b')](_0x1429ee,{'showHidden':![],'depth':null}));this[_0xff44('0x3d')](_0x1429ee['uniqueid'],_[_0xff44('0x3e')](_0x1429ee[_0xff44('0x3f')])[0x0],_0x1429ee[_0xff44('0x40')]);if(this[_0xff44('0x15')](_0x1429ee['variable'])&&this['isNotNull'](_0x1429ee[_0xff44('0x3f')][_0xff44('0x41')])){if(_['isUndefined'](this['channels'][_0x1429ee[_0xff44('0x1a')]])){this[_0xff44('0x8')][_0x1429ee['uniqueid']]={'routeId':_0x1429ee[_0xff44('0x40')],'variables':this[_0xff44('0xb')][_0x1429ee[_0xff44('0x1a')]]};logger['info'](_0xff44('0x42'),_0x1429ee[_0xff44('0x1a')],_0x1429ee[_0xff44('0x3f')][_0xff44('0x41')],_['keys'](_0x1429ee[_0xff44('0x3f')])[0x0],_0x1429ee[_0xff44('0x40')]);logger[_0xff44('0x18')](_0xff44('0x43'),_0x1429ee[_0xff44('0x1a')],util[_0xff44('0x1b')](this[_0xff44('0x8')][_0x1429ee[_0xff44('0x1a')]],{'showHidden':![],'depth':null}));this[_0xff44('0x17')](_0xff44('0x27'),_0xff44('0x28'),this[_0xff44('0x8')][_0x1429ee[_0xff44('0x1a')]]);}}}}catch(_0x2615f4){logger[_0xff44('0x2b')](_0xff44('0x44'),_0x1429ee[_0xff44('0x1a')],util[_0xff44('0x1b')](_0x2615f4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xff44('0x14')][_0xff44('0x3d')]=function(_0x18c8ff,_0x266ef8,_0x10c9bd){var _0x1303f4=[_0xff44('0x45'),_0xff44('0x46'),_0xff44('0x47'),_0xff44('0x48'),_0xff44('0x49'),_0xff44('0x4a'),_0xff44('0x4b'),_0xff44('0x4c'),'sipcallid',_0xff44('0x4d'),_0xff44('0x4e'),'bridgepvtcallid',_0xff44('0x4f'),_0xff44('0x50'),'memberinterface',_0xff44('0x51'),_0xff44('0x25'),_0xff44('0x52'),_0xff44('0x53')];if(!_[_0xff44('0x54')](_0x266ef8)&&!_['includes'](_0x1303f4,_0x266ef8)){if(_['isUndefined'](this[_0xff44('0xb')][_0x18c8ff])){this[_0xff44('0xb')][_0x18c8ff]={};}this[_0xff44('0xb')][_0x18c8ff][_0x266ef8]=_0x10c9bd;}};VoiceDialReport[_0xff44('0x14')]['syncHangup']=function(_0x4f1465){try{if(this[_0xff44('0x15')](_0x4f1465)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x4f1465['uniqueid'],util[_0xff44('0x1b')](_0x4f1465,{'showHidden':![],'depth':null}));if(this[_0xff44('0x8')][_0x4f1465[_0xff44('0x1a')]]){logger[_0xff44('0x23')](_0xff44('0x55'),_0x4f1465[_0xff44('0x1a')],_0x4f1465['cause-txt']);this[_0xff44('0x8')][_0x4f1465['uniqueid']][_0xff44('0x56')]=moment()[_0xff44('0x32')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xff44('0x8')][_0x4f1465[_0xff44('0x1a')]]['duration']=moment(this['channels'][_0x4f1465[_0xff44('0x1a')]][_0xff44('0x56')])[_0xff44('0x57')](this[_0xff44('0x8')][_0x4f1465[_0xff44('0x1a')]][_0xff44('0x58')],_0xff44('0x59'));this[_0xff44('0x8')][_0x4f1465['uniqueid']]['lastevent']=_0xff44('0x5a');this[_0xff44('0xa')][_0xff44('0x5b')]+=0x1;if(this[_0xff44('0x8')][_0x4f1465['uniqueid']][_0xff44('0x31')]){this['outbound'][_0xff44('0x5c')]+=0x1;this[_0xff44('0x8')][_0x4f1465['uniqueid']][_0xff44('0x5d')]=moment(this[_0xff44('0x8')][_0x4f1465['uniqueid']][_0xff44('0x31')])['diff'](this[_0xff44('0x8')][_0x4f1465[_0xff44('0x1a')]][_0xff44('0x58')],_0xff44('0x59'));this[_0xff44('0x8')][_0x4f1465[_0xff44('0x1a')]][_0xff44('0x5e')]=moment(this[_0xff44('0x8')][_0x4f1465['uniqueid']][_0xff44('0x56')])[_0xff44('0x57')](this[_0xff44('0x8')][_0x4f1465[_0xff44('0x1a')]][_0xff44('0x31')],'seconds');this[_0xff44('0xa')]['sumHoldTime']+=this[_0xff44('0x8')][_0x4f1465[_0xff44('0x1a')]][_0xff44('0x5d')]||0x0;this[_0xff44('0xa')][_0xff44('0x5f')]+=this['channels'][_0x4f1465[_0xff44('0x1a')]]['billableseconds'];}this[_0xff44('0xa')][_0xff44('0x60')]+=this[_0xff44('0x8')][_0x4f1465[_0xff44('0x1a')]][_0xff44('0x61')];logger[_0xff44('0x18')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x4f1465[_0xff44('0x1a')],util[_0xff44('0x1b')](this[_0xff44('0x8')][_0x4f1465[_0xff44('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xff44('0x17')](_0xff44('0x62'),this[_0xff44('0x8')][_0x4f1465[_0xff44('0x1a')]]);logger[_0xff44('0x18')](_0xff44('0x63'),_0x4f1465['uniqueid'],util[_0xff44('0x1b')](this[_0xff44('0x8')][_0x4f1465[_0xff44('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xff44('0x17')]('custom:dialend',this[_0xff44('0x8')][_0x4f1465['uniqueid']]);logger[_0xff44('0x18')](_0xff44('0x64'),_0x4f1465[_0xff44('0x1a')],util['inspect'](this['channels'][_0x4f1465['uniqueid']],{'showHidden':![],'depth':null}));this[_0xff44('0x17')]('voice:outbound',_0xff44('0x65'),this['outbound']);logger[_0xff44('0x23')](_0xff44('0x66'),JSON[_0xff44('0x67')](this[_0xff44('0x8')][_0x4f1465[_0xff44('0x1a')]]));logger[_0xff44('0x18')](_0xff44('0x68'),_0x4f1465[_0xff44('0x1a')],util[_0xff44('0x1b')](this[_0xff44('0x8')][_0x4f1465[_0xff44('0x1a')]],{'showHidden':![],'depth':null}));this[_0xff44('0x17')]('voice:outbound','voice_outbound_channel:remove',this[_0xff44('0x8')][_0x4f1465[_0xff44('0x1a')]]);delete this[_0xff44('0x8')][_0x4f1465[_0xff44('0x1a')]];}else if(this[_0xff44('0x8')][_0x4f1465[_0xff44('0x69')]]){this[_0xff44('0x8')][_0x4f1465[_0xff44('0x69')]][_0xff44('0x1a')]=this[_0xff44('0x8')][_0x4f1465[_0xff44('0x69')]][_0xff44('0x6a')];}if(this[_0xff44('0xb')][_0x4f1465[_0xff44('0x1a')]]){delete this[_0xff44('0xb')][_0x4f1465[_0xff44('0x1a')]];}}}catch(_0x259330){logger[_0xff44('0x2b')](_0xff44('0x6b'),_0x4f1465['uniqueid'],util[_0xff44('0x1b')](_0x259330,{'showHidden':![],'depth':null}));}};module[_0xff44('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 e6247f5..4dde33d 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 _0x659c=['agentconnect','syncAgentConnect','varset','syncVarSet','fullybooted','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','waiting','queueStatusComplete','unlockRR','prototype','enqueue','Action','channel','catch','No\x20such\x20channel','error','inspect','[%s][voiceQueueReport][checkQueueReport]','variables','[%s][voiceQueueReport][checkVariables]','syncFullyBooted','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','name','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','type','inbound','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice:queue:%s','voice_queue:save','isNotNull','isUndefined','clearZombieChannels','queues','[voiceQueueReport][queues]','then','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummary]\x20event:','queue','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','emitVoiceQueueSummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','queuecallerexitreason','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','reason','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','value','variable','CONTINUE','TIMEOUT','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','keys','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceQueueReport][hangup]','length','milliseconds','diff','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transferexten','transferuniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','switch','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','syncMusicOnHoldStart','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','lodash','md5','ioredis','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','agentcomplete','syncAgentComplete'];(function(_0x73eba4,_0x1686c2){var _0x40f4fe=function(_0x1093b1){while(--_0x1093b1){_0x73eba4['push'](_0x73eba4['shift']());}};_0x40f4fe(++_0x1686c2);}(_0x659c,0x1aa));var _0xc659=function(_0x549555,_0x5c2217){_0x549555=_0x549555-0x0;var _0x259593=_0x659c[_0x549555];return _0x259593;};'use strict';var _=require(_0xc659('0x0'));var moment=require('moment');var util=require('util');var md5=require(_0xc659('0x1'));var Redis=require(_0xc659('0x2'));var config=require('../../../config/environment');var logger=require(_0xc659('0x3'))(_0xc659('0x4'));var ami=require('../ami');var QueueReport=require('../model/queueReport');config[_0xc659('0x5')]=_[_0xc659('0x6')](config[_0xc659('0x5')],{'host':_0xc659('0x7'),'port':0x18eb});var io=require(_0xc659('0x8'))(new Redis(config[_0xc659('0x5')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x2cc93d){this['tail']=this['tail']?this['tail'][_0xc659('0x9')](_0x2cc93d):_0x2cc93d();};function VoiceQueueReport(_0x2ea975){this[_0xc659('0xa')]=new Sequence();this[_0xc659('0xb')]={};this[_0xc659('0xc')]=_0x2ea975[_0xc659('0xc')];this[_0xc659('0xd')]=_0x2ea975[_0xc659('0xe')];this['voiceQueues']=_0x2ea975[_0xc659('0xf')];this[_0xc659('0x10')]=!![];this[_0xc659('0x11')]=_0x2ea975['campaigns'];this['variables']={};ami['on'](_0xc659('0x12'),this[_0xc659('0x13')]['bind'](this));ami['on'](_0xc659('0x14'),this[_0xc659('0x15')][_0xc659('0x16')](this));ami['on'](_0xc659('0x17'),this[_0xc659('0x18')][_0xc659('0x16')](this));ami['on'](_0xc659('0x19'),this[_0xc659('0x1a')][_0xc659('0x16')](this));ami['on'](_0xc659('0x1b'),this['syncQueueCallerLeave'][_0xc659('0x16')](this));ami['on'](_0xc659('0x1c'),this[_0xc659('0x1d')][_0xc659('0x16')](this));ami['on'](_0xc659('0x1e'),this[_0xc659('0x1f')]['bind'](this));ami['on'](_0xc659('0x20'),this[_0xc659('0x21')][_0xc659('0x16')](this));ami['on']('hangup',this['syncHangup'][_0xc659('0x16')](this));ami['on'](_0xc659('0x22'),this['syncFullyBooted'][_0xc659('0x16')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0xc659('0x23'),this[_0xc659('0x24')][_0xc659('0x16')](this));ami['on'](_0xc659('0x25'),this[_0xc659('0x26')][_0xc659('0x16')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));this[_0xc659('0x27')]();this[_0xc659('0x28')]();}function clearChannels(_0x4c0fb7){if(!_[_0xc659('0x29')](_0x4c0fb7)){for(var _0x5db7cf in _0x4c0fb7){if(_0x4c0fb7[_0xc659('0x2a')](_0x5db7cf)){delete _0x4c0fb7[_0x5db7cf];}}}}function clearCampaigns(_0x2794b2){if(!_[_0xc659('0x29')](_0x2794b2)){for(var _0x36e194 in _0x2794b2){if(_0x2794b2[_0xc659('0x2a')](_0x36e194)){_0x2794b2[_0x36e194][_0xc659('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x3a35e4){if(!_[_0xc659('0x29')](_0x3a35e4)){for(var _0x288b02 in _0x3a35e4){if(_0x3a35e4[_0xc659('0x2a')](_0x288b02)){_0x3a35e4[_0x288b02][_0xc659('0x2b')]=0x0;_0x3a35e4[_0x288b02][_0xc659('0x2c')]=0x0;_0x3a35e4[_0x288b02]['pTalking']=0x0;_0x3a35e4[_0x288b02][_0xc659('0x2d')]=0x0;_0x3a35e4[_0x288b02][_0xc659('0x2e')]=!![];}}}}function clearAgentBooked(_0x5deee1){if(!_['isEmpty'](_0x5deee1)){for(var _0x1dc3b7 in _0x5deee1){if(_0x5deee1[_0xc659('0x2a')](_0x1dc3b7)){_0x5deee1[_0x1dc3b7][_0xc659('0x2f')]=!![];}}}}VoiceQueueReport[_0xc659('0x30')]['clearZombieChannels']=function(){var _0x475bd3=this;for(var _0xd5c464 in this[_0xc659('0xd')]){if(this['channels'][_0xc659('0x2a')](_0xd5c464)&&!this[_0xc659('0xd')][_0xd5c464]['switch']){this['sequence'][_0xc659('0x31')](function(){if(!_['isNil'](_0x475bd3[_0xc659('0xd')][_0xd5c464])){return ami[_0xc659('0x32')]({'action':'status','channel':_0x475bd3[_0xc659('0xd')][_0xd5c464][_0xc659('0x33')]})[_0xc659('0x34')](function(_0x3eb7c3){if(_0x3eb7c3['message']===_0xc659('0x35')){setTimeout(function(){if(_0x475bd3[_0xc659('0xd')][_0xd5c464]){delete _0x475bd3['channels'][_0xd5c464];logger[_0xc659('0x36')]('[%s][voiceQueueReport][checkChannel]',_0xd5c464,util[_0xc659('0x37')](_0x3eb7c3,{'showHidden':![],'depth':null}));}if(_0x475bd3['queueReports'][_0xd5c464]){delete _0x475bd3[_0xc659('0xb')][_0xd5c464];logger['error'](_0xc659('0x38'),_0xd5c464,util[_0xc659('0x37')](_0x3eb7c3,{'showHidden':![],'depth':null}));}if(_0x475bd3[_0xc659('0x39')][_0xd5c464]){delete _0x475bd3[_0xc659('0x39')][_0xd5c464];logger[_0xc659('0x36')](_0xc659('0x3a'),_0xd5c464,util[_0xc659('0x37')](_0x3eb7c3,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xc659('0x30')][_0xc659('0x3b')]=function(){logger[_0xc659('0x36')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0xc659('0xd')]);this[_0xc659('0x3c')](this[_0xc659('0xb')]);clearAgentBooked(this[_0xc659('0xc')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xc659('0x11')]);};VoiceQueueReport[_0xc659('0x30')][_0xc659('0x3c')]=function(_0x143e5a){var _0x408637=this;if(!_[_0xc659('0x29')](_0x143e5a)){for(var _0x5ce879 in _0x143e5a){if(_0x143e5a['hasOwnProperty'](_0x5ce879)){_0x408637[_0xc659('0x3d')](_0x143e5a[_0x5ce879],_0xc659('0x3e'));delete _0x143e5a[_0x5ce879];}}}};VoiceQueueReport[_0xc659('0x30')]['emit']=function(_0x286843,_0x583f91,_0x47d9e3){io['to'](_0x286843)[_0xc659('0x3f')](_0x583f91,_0x47d9e3);};VoiceQueueReport[_0xc659('0x30')][_0xc659('0x40')]=function(_0x199ba1,_0xbc35d2){logger[_0xc659('0x41')]('[%s][voiceQueueReport]['+_0xbc35d2+_0xc659('0x42'),_0x199ba1[_0xc659('0x43')],util[_0xc659('0x37')](_0x199ba1,{'showHidden':![],'depth':null}));this[_0xc659('0x3f')](util[_0xc659('0x44')]('voice:queue:%s',_0x199ba1[_0xc659('0x45')]),_0xc659('0x46'),_0x199ba1);};VoiceQueueReport['prototype'][_0xc659('0x3d')]=function(_0x4b71c3,_0x5a97e6){logger[_0xc659('0x41')]('[%s][voiceQueueReport]['+_0x5a97e6+_0xc659('0x47'),_0x4b71c3[_0xc659('0x43')],util[_0xc659('0x37')](_0x4b71c3,{'showHidden':![],'depth':null}));this[_0xc659('0x3f')](util[_0xc659('0x44')]('voice:queue:%s',_0x4b71c3[_0xc659('0x45')]),'voice_queue_channel:remove',_0x4b71c3);};VoiceQueueReport['prototype']['emitVoiceQueueSummary']=function(_0x39f2b8,_0x268194){if(_0x39f2b8[_0xc659('0x48')]===_0xc659('0x49')){var _0x105197={'id':_0x39f2b8['id'],'name':_0x39f2b8[_0xc659('0x45')],'strategy':_0x39f2b8['strategy'],'answered':_0x39f2b8[_0xc659('0x4a')],'available':_0x39f2b8[_0xc659('0x4b')],'loggedIn':_0x39f2b8[_0xc659('0x4c')],'pTalking':_0x39f2b8['pTalking'],'sumBillable':_0x39f2b8[_0xc659('0x4d')],'sumDuration':_0x39f2b8[_0xc659('0x4e')],'sumHoldTime':_0x39f2b8[_0xc659('0x4f')]||0x0,'talking':_0x39f2b8['talking'],'total':_0x39f2b8[_0xc659('0x50')],'type':_0x39f2b8[_0xc659('0x48')],'unmanaged':_0x39f2b8[_0xc659('0x51')],'abandoned':_0x39f2b8[_0xc659('0x52')],'waiting':_0x39f2b8['waiting']};if(_0x39f2b8[_0xc659('0x53')]){_0x105197[_0xc659('0x53')]={'id':_0x39f2b8[_0xc659('0x53')]['id'],'name':_0x39f2b8[_0xc659('0x53')][_0xc659('0x45')],'active':_0x39f2b8[_0xc659('0x53')][_0xc659('0x54')],'callerid':_0x39f2b8[_0xc659('0x53')][_0xc659('0x55')]};}if(_0x39f2b8[_0xc659('0x56')]){_0x105197['Interval']={'id':_0x39f2b8['Interval']['id'],'name':_0x39f2b8[_0xc659('0x56')][_0xc659('0x45')]};}var _0x1e1ad7=md5(JSON[_0xc659('0x57')](_0x105197));if(_0x39f2b8[_0xc659('0x1')]!==_0x1e1ad7){_0x39f2b8[_0xc659('0x1')]=_0x1e1ad7;logger['debug'](_0xc659('0x58')+_0x268194+_0xc659('0x59'),util[_0xc659('0x37')](_0x105197,{'showHidden':![],'depth':null}));this[_0xc659('0x3f')](util['format'](_0xc659('0x5a'),_0x105197['name']),_0xc659('0x5b'),_0x105197);}}};VoiceQueueReport[_0xc659('0x30')][_0xc659('0x5c')]=function(_0x108fd2){return _0x108fd2!==null&&!_[_0xc659('0x5d')](_0x108fd2);};VoiceQueueReport[_0xc659('0x30')][_0xc659('0x28')]=function(){var _0x1c66fd=this;setInterval(function(){_0x1c66fd[_0xc659('0x5e')]();ami['Action']({'action':_0xc659('0x5f')})[_0xc659('0x34')](function(_0x46fea9){logger['error'](_0xc659('0x60'),util[_0xc659('0x37')](_0x46fea9,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xc659('0x30')][_0xc659('0x27')]=function(){var _0x31df71=this;setInterval(function(){if(_0x31df71[_0xc659('0x10')]){return ami[_0xc659('0x32')]({'action':_0xc659('0x12')})[_0xc659('0x61')](function(_0x4e2692){_0x31df71[_0xc659('0x10')]=![];})['catch'](function(_0x370aa5){logger[_0xc659('0x36')](_0xc659('0x62'),util[_0xc659('0x37')](_0x370aa5,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xc659('0x30')][_0xc659('0x13')]=function(_0x3cbb6c){try{if(this[_0xc659('0x5c')](_0x3cbb6c)&&this[_0xc659('0x5c')](_0x3cbb6c['queue'])){logger[_0xc659('0x41')](_0xc659('0x63'),util[_0xc659('0x37')](_0x3cbb6c,{'showHidden':![],'depth':null}));if(this[_0xc659('0xf')][_0x3cbb6c[_0xc659('0x64')]]){logger[_0xc659('0x65')](_0xc659('0x66'),_0x3cbb6c[_0xc659('0x64')]);var _0x3e3d4d=_[_0xc659('0x67')](this[_0xc659('0xd')],_0xc659('0x64'))[_0x3cbb6c['queue']]||0x0;var _0x9fa40e=_0x3e3d4d-_0x3cbb6c[_0xc659('0x68')];if(this['voiceQueues'][_0x3cbb6c[_0xc659('0x64')]][_0xc659('0x2d')]!==_[_0xc659('0x69')](_0x3cbb6c[_0xc659('0x68')])||this[_0xc659('0xf')][_0x3cbb6c[_0xc659('0x64')]][_0xc659('0x4c')]!==_[_0xc659('0x69')](_0x3cbb6c[_0xc659('0x6a')])||this['voiceQueues'][_0x3cbb6c[_0xc659('0x64')]][_0xc659('0x4b')]!==_[_0xc659('0x69')](_0x3cbb6c['available'])||this[_0xc659('0xf')][_0x3cbb6c[_0xc659('0x64')]][_0xc659('0x2c')]!==_0x9fa40e){this[_0xc659('0xf')][_0x3cbb6c[_0xc659('0x64')]][_0xc659('0x2d')]=_[_0xc659('0x69')](_0x3cbb6c['callers']);this[_0xc659('0xf')][_0x3cbb6c[_0xc659('0x64')]][_0xc659('0x4c')]=_['toNumber'](_0x3cbb6c[_0xc659('0x6a')]);this[_0xc659('0xf')][_0x3cbb6c[_0xc659('0x64')]][_0xc659('0x4b')]=_[_0xc659('0x69')](_0x3cbb6c['available']);this[_0xc659('0xf')][_0x3cbb6c['queue']][_0xc659('0x2c')]=_0x9fa40e>0x0?_0x9fa40e:0x0;this[_0xc659('0xf')][_0x3cbb6c[_0xc659('0x64')]][_0xc659('0x2c')]=this[_0xc659('0xf')][_0x3cbb6c[_0xc659('0x64')]][_0xc659('0x2c')]>_[_0xc659('0x69')](_0x3cbb6c[_0xc659('0x6a')])?_[_0xc659('0x69')](_0x3cbb6c[_0xc659('0x6a')]):this[_0xc659('0xf')][_0x3cbb6c[_0xc659('0x64')]][_0xc659('0x2c')];this[_0xc659('0x6b')](this[_0xc659('0xf')][_0x3cbb6c['queue']],_0xc659('0x12'));}logger['debug'](_0xc659('0x6c'),util[_0xc659('0x37')](this[_0xc659('0xf')][_0x3cbb6c[_0xc659('0x64')]],{'showHidden':![],'depth':null}));ami[_0xc659('0x3f')](_0xc659('0x6d'),this['voiceQueues'][_0x3cbb6c[_0xc659('0x64')]]);}}}catch(_0x1b4e6b){logger[_0xc659('0x36')](_0xc659('0x62'),util[_0xc659('0x37')](_0x1b4e6b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc659('0x30')]['syncQueueSummaryComplete']=function(_0x1b3504){logger[_0xc659('0x41')](_0xc659('0x6e'),util['inspect'](_0x1b3504,{'showHidden':![],'depth':null}));this[_0xc659('0x10')]=!![];};VoiceQueueReport[_0xc659('0x30')]['syncQueueCallerJoin']=function(_0x3b58f7){try{if(this[_0xc659('0x5c')](_0x3b58f7)){logger[_0xc659('0x41')](_0xc659('0x6f'),_0x3b58f7[_0xc659('0x43')],util[_0xc659('0x37')](_0x3b58f7,{'showHidden':![],'depth':null}));if(_[_0xc659('0x5d')](this['queueReports'][_0x3b58f7[_0xc659('0x43')]])){this[_0xc659('0xb')][_0x3b58f7['uniqueid']]=[];this[_0xc659('0xd')][_0x3b58f7['uniqueid']]={};}var _0x7fbb8e=new QueueReport();_0x7fbb8e[_0xc659('0x45')]=_0x3b58f7['queue'];_0x7fbb8e[_0xc659('0x48')]=this[_0xc659('0xf')][_0x7fbb8e['name']]&&this['voiceQueues'][_0x7fbb8e[_0xc659('0x45')]][_0xc659('0x48')]?this[_0xc659('0xf')][_0x7fbb8e[_0xc659('0x45')]][_0xc659('0x48')]||_0xc659('0x49'):'inbound';_0x7fbb8e['queue']=_0x3b58f7['queue'];_0x7fbb8e[_0xc659('0x70')]=moment()[_0xc659('0x44')](_0xc659('0x71'));_0x7fbb8e[_0xc659('0x72')]=_0x3b58f7[_0xc659('0x72')];_0x7fbb8e['count']=_0x3b58f7[_0xc659('0x73')];_0x7fbb8e['uniqueid']=_0x3b58f7[_0xc659('0x43')];logger[_0xc659('0x65')](_0xc659('0x74'),_0x7fbb8e[_0xc659('0x45')],_0x7fbb8e[_0xc659('0x48')]);_[_0xc659('0x75')](_0x7fbb8e,_[_0xc659('0x76')](_0x3b58f7,_['keys'](_0x7fbb8e)));this['queueReports'][_0x3b58f7[_0xc659('0x43')]]['push'](_0x7fbb8e);this['channels'][_0x3b58f7[_0xc659('0x43')]]=_0x7fbb8e;this[_0xc659('0x40')](_0x7fbb8e,_0xc659('0x17'));}}catch(_0x1938a7){logger[_0xc659('0x36')](_0xc659('0x6f'),_0x3b58f7[_0xc659('0x43')],util['inspect'](_0x1938a7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc659('0x30')]['syncQueueCallerAbandon']=function(_0x43e7c3){try{if(this[_0xc659('0x5c')](_0x43e7c3)){logger[_0xc659('0x41')](_0xc659('0x77'),_0x43e7c3[_0xc659('0x43')],util['inspect'](_0x43e7c3,{'showHidden':![],'depth':null}));if(this[_0xc659('0xb')][_0x43e7c3[_0xc659('0x43')]]){var _0x44dc3b=_[_0xc659('0x78')](this[_0xc659('0xb')][_0x43e7c3[_0xc659('0x43')]]);_0x44dc3b[_0xc659('0x79')]=![];_0x44dc3b[_0xc659('0x7a')]=null;_0x44dc3b[_0xc659('0x7b')]=_0x43e7c3[_0xc659('0x7b')];_0x44dc3b[_0xc659('0x7c')]=_0x43e7c3[_0xc659('0x7c')];_0x44dc3b[_0xc659('0x19')]=!![];_0x44dc3b['queuecallerabandonAt']=moment()[_0xc659('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x44dc3b['queuecallerexitreason']='ABANDONED';_0x44dc3b[_0xc659('0x7d')]=null;logger[_0xc659('0x65')](_0xc659('0x7e'),_0x44dc3b[_0xc659('0x45')],_0x44dc3b[_0xc659('0x48')]);this[_0xc659('0xd')][_0x43e7c3[_0xc659('0x43')]]=_0x44dc3b;this[_0xc659('0x3d')](_0x44dc3b,_0xc659('0x19'));}}}catch(_0x382041){logger[_0xc659('0x36')](_0xc659('0x77'),_0x43e7c3[_0xc659('0x43')],util[_0xc659('0x37')](_0x382041,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc659('0x30')]['syncQueueCallerLeave']=function(_0x4781a6){try{if(this['isNotNull'](_0x4781a6)){logger[_0xc659('0x41')](_0xc659('0x7f'),_0x4781a6[_0xc659('0x43')],util['inspect'](_0x4781a6,{'showHidden':![],'depth':null}));if(this[_0xc659('0xb')][_0x4781a6[_0xc659('0x43')]]){var _0x29b3ad=_['last'](this[_0xc659('0xb')][_0x4781a6[_0xc659('0x43')]]);_0x29b3ad[_0xc659('0x80')]=moment()[_0xc659('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x29b3ad[_0xc659('0x81')]=_0x4781a6[_0xc659('0x81')];_0x29b3ad[_0xc659('0x82')]=_0x4781a6[_0xc659('0x82')];logger[_0xc659('0x65')](_0xc659('0x83'),_0x29b3ad[_0xc659('0x45')],_0x29b3ad[_0xc659('0x48')],_0x4781a6['connectedlinenum'],_0x4781a6['connectedlinename']);this['channels'][_0x4781a6[_0xc659('0x43')]]=_0x29b3ad;this[_0xc659('0x40')](_0x29b3ad,'queuecallerleave');}}}catch(_0x138daa){logger[_0xc659('0x36')]('[%s][voiceQueueReport][queuecallerleave]',_0x4781a6[_0xc659('0x43')],util[_0xc659('0x37')](_0x138daa,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc659('0x1f')]=function(_0x6e82f3){try{if(this[_0xc659('0x5c')](_0x6e82f3)){logger['debug'](_0xc659('0x84'),_0x6e82f3['uniqueid'],util[_0xc659('0x37')](_0x6e82f3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x6e82f3[_0xc659('0x43')]]){var _0x19eeb0=_['last'](this[_0xc659('0xb')][_0x6e82f3['uniqueid']]);_0x19eeb0[_0xc659('0x79')]=!![];_0x19eeb0[_0xc659('0x85')]=_0xc659('0x86');logger['info'](_0xc659('0x87'),_0x19eeb0[_0xc659('0x45')],_0x19eeb0[_0xc659('0x48')]);}}}catch(_0x37638c){logger['error'](_0xc659('0x84'),_0x6e82f3['uniqueid'],util[_0xc659('0x37')](_0x37638c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc659('0x30')][_0xc659('0x1d')]=function(_0xe66d63){try{if(this[_0xc659('0x5c')](_0xe66d63)){logger[_0xc659('0x41')](_0xc659('0x88'),_0xe66d63[_0xc659('0x43')],util['inspect'](_0xe66d63,{'showHidden':![],'depth':null}));if(this[_0xc659('0xb')][_0xe66d63[_0xc659('0x43')]]){var _0x38dd10=_[_0xc659('0x78')](this[_0xc659('0xb')][_0xe66d63[_0xc659('0x43')]]);_0x38dd10['queuecallerabandon']=![];_0x38dd10[_0xc659('0x89')]=null;_0x38dd10[_0xc659('0x8a')]=!![];_0x38dd10['lastAssignedTo']=_0xe66d63[_0xc659('0x8b')];_0x38dd10[_0xc659('0x7b')]=_0xe66d63[_0xc659('0x7b')];_0x38dd10[_0xc659('0x79')]=!![];_0x38dd10[_0xc659('0x8c')]=![];_0x38dd10[_0xc659('0x8d')]=null;if(!_0x38dd10[_0xc659('0x8e')]){if(_0xe66d63['reason']==_0xc659('0x8e')){_0x38dd10[_0xc659('0x85')]=_0xc659('0x8f');logger['info'](_0xc659('0x90'),_0x38dd10[_0xc659('0x45')],_0x38dd10[_0xc659('0x48')]);}else{if(_['startsWith'](_0xe66d63['channel'][_0xc659('0x91')](),_0xc659('0x92'))){if(this[_0xc659('0xb')][_0xe66d63[_0xc659('0x93')]]){var _0x2e82c3=_[_0xc659('0x78')](this['queueReports'][_0xe66d63['linkedid']]);_0x2e82c3[_0xc659('0x79')]=![];_0x2e82c3[_0xc659('0x8c')]=!![];_0x2e82c3[_0xc659('0x8d')]=moment(_0x38dd10['queuecallerjoinAt'])[_0xc659('0x94')](_0xe66d63[_0xc659('0x7b')],_0xc659('0x95'))[_0xc659('0x44')](_0xc659('0x71'));_0x2e82c3[_0xc659('0x85')]=_0xc659('0x96');_0x2e82c3[_0xc659('0x8e')]=!![];_0x2e82c3[_0xc659('0x97')]=_0xc659('0x98');_0x2e82c3['transferexten']=_0xe66d63[_0xc659('0x99')];_0x2e82c3['transferuniqueid']=_0xe66d63['uniqueid'];logger[_0xc659('0x65')](_0xc659('0x9a'),_0x2e82c3[_0xc659('0x45')],_0x2e82c3['type']);var _0x19c44a=this['queueReports'][_0xe66d63[_0xc659('0x93')]];this[_0xc659('0xb')][_0xe66d63[_0xc659('0x93')]]=this['queueReports'][_0xe66d63[_0xc659('0x43')]];this[_0xc659('0xb')][_0xe66d63[_0xc659('0x43')]]=_0x19c44a;}}else{_0x38dd10[_0xc659('0x85')]=_0xc659('0x9b')+_0xe66d63[_0xc659('0x9c')][_0xc659('0x9d')]();logger[_0xc659('0x65')](_0xc659('0x9e'),_0x38dd10[_0xc659('0x45')],_0x38dd10['type'],_0x38dd10[_0xc659('0x85')]);}}}this['channels'][_0xe66d63['uniqueid']]=_0x38dd10;this[_0xc659('0x3d')](_0x38dd10,_0xc659('0x1c'));}}}catch(_0x3726cd){logger[_0xc659('0x36')](_0xc659('0x88'),_0xe66d63['uniqueid'],util['inspect'](_0x3726cd,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x3d7545){try{if(this[_0xc659('0x5c')](_0x3d7545)){logger[_0xc659('0x41')](_0xc659('0x9f'),_0x3d7545['uniqueid'],util[_0xc659('0x37')](_0x3d7545,{'showHidden':![],'depth':null}));this['addVariable'](_0x3d7545[_0xc659('0x43')],_['keys'](_0x3d7545['variable'])[0x0],_0x3d7545[_0xc659('0xa0')]);if(this['queueReports'][_0x3d7545[_0xc659('0x43')]]){var _0x57709e=_['last'](this[_0xc659('0xb')][_0x3d7545[_0xc659('0x43')]]);if(_0x57709e){if(this[_0xc659('0x5c')](_0x3d7545[_0xc659('0xa1')])&&this[_0xc659('0x5c')](_0x3d7545['variable']['queuestatus'])){switch(_0x3d7545[_0xc659('0xa0')]){case _0xc659('0xa2'):_0x57709e['queuecallerexit']=![];_0x57709e['queuecallerexitAt']=null;break;case _0xc659('0xa3'):_0x57709e['lastevent']='timeout';_0x57709e['queuecallerexit']=!![];_0x57709e['queuecallerexitAt']=moment()[_0xc659('0x44')](_0xc659('0x71'));_0x57709e['queuecallerleaveAt']=moment()[_0xc659('0x44')](_0xc659('0x71'));logger['debug'](_0xc659('0xa4'),_0x3d7545[_0xc659('0x43')],util[_0xc659('0x37')](_0x57709e,{'showHidden':![],'depth':null}));ami[_0xc659('0x3f')](_0xc659('0xa5'),_0x57709e);break;default:_0x57709e['queuecallerexit']=!![];_0x57709e[_0xc659('0x8d')]=moment()['format'](_0xc659('0x71'));_0x57709e[_0xc659('0x80')]=moment()[_0xc659('0x44')](_0xc659('0x71'));}_0x57709e[_0xc659('0x19')]=![];_0x57709e[_0xc659('0x89')]=null;_0x57709e[_0xc659('0x85')]=_0x3d7545[_0xc659('0xa0')];this[_0xc659('0xd')][_0x3d7545[_0xc659('0x43')]]=_0x57709e;this[_0xc659('0x3d')](_0x57709e,_0xc659('0x20'));}else if(this[_0xc659('0x5c')](_0x3d7545[_0xc659('0xa1')])&&this[_0xc659('0x5c')](_0x3d7545[_0xc659('0xa1')][_0xc659('0xa6')])){if(!_0x57709e[_0xc659('0x19')]){_0x57709e['queuecallerexit']=!![];_0x57709e[_0xc659('0x8d')]=moment()['format'](_0xc659('0x71'));_0x57709e['queuecallerexitreason']=_0xc659('0xa7');_0x57709e[_0xc659('0x80')]=moment()['format'](_0xc659('0x71'));this[_0xc659('0xd')][_0x3d7545[_0xc659('0x43')]]=_0x57709e;}}logger[_0xc659('0x65')](_0xc659('0xa8'),_0x3d7545[_0xc659('0x43')],_0x57709e[_0xc659('0x45')],_0x57709e[_0xc659('0x48')],_[_0xc659('0xa9')](_0x3d7545[_0xc659('0xa1')])[0x0],_0x3d7545[_0xc659('0xa0')]);_0x57709e['variables']=this[_0xc659('0x39')][_0x3d7545[_0xc659('0x43')]];}}}}catch(_0x2b99bd){logger[_0xc659('0x36')](_0xc659('0x9f'),_0x3d7545[_0xc659('0x43')],util['inspect'](_0x2b99bd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc659('0x30')][_0xc659('0xaa')]=function(_0x254e28,_0x27a7fc,_0x114cbd){var _0x358a36=[_0xc659('0xab'),_0xc659('0xac'),_0xc659('0xad'),_0xc659('0xae'),_0xc659('0xaf'),'rtpaudioqoslossbridged',_0xc659('0xb0'),_0xc659('0xb1'),'sipcallid',_0xc659('0xb2'),_0xc659('0xb3'),_0xc659('0xb4'),_0xc659('0xb5'),_0xc659('0xb6'),_0xc659('0xb7'),'memberlastcall','membername',_0xc659('0xb8'),_0xc659('0xb9')];if(!_[_0xc659('0xba')](_0x27a7fc)&&!_[_0xc659('0xbb')](_0x358a36,_0x27a7fc)){if(_[_0xc659('0x5d')](this[_0xc659('0x39')][_0x254e28])){this[_0xc659('0x39')][_0x254e28]={};}this[_0xc659('0x39')][_0x254e28][_0x27a7fc]=_0x114cbd;}};VoiceQueueReport['prototype'][_0xc659('0xbc')]=function(_0x171750){try{if(this[_0xc659('0x5c')](_0x171750)){logger[_0xc659('0x41')](_0xc659('0xbd'),_0x171750['uniqueid'],util['inspect'](_0x171750,{'showHidden':![],'depth':null}));if(this[_0xc659('0xb')][_0x171750[_0xc659('0x43')]]){for(var _0x22dbf2=0x0,_0x24b6b0={};_0x22dbf20x0?_0x37a49c:0x0;this[_0x3f64('0x15')][_0x43411c[_0x3f64('0x6a')]]['talking']=this[_0x3f64('0x15')][_0x43411c['queue']][_0x3f64('0x34')]>_[_0x3f64('0x6f')](_0x43411c[_0x3f64('0x70')])?_[_0x3f64('0x6f')](_0x43411c[_0x3f64('0x70')]):this[_0x3f64('0x15')][_0x43411c[_0x3f64('0x6a')]]['talking'];this[_0x3f64('0x50')](this[_0x3f64('0x15')][_0x43411c[_0x3f64('0x6a')]],_0x3f64('0x19'));}logger[_0x3f64('0x4e')](_0x3f64('0x71'),util['inspect'](this['voiceQueues'][_0x43411c[_0x3f64('0x6a')]],{'showHidden':![],'depth':null}));ami[_0x3f64('0x47')](_0x3f64('0x72'),this['voiceQueues'][_0x43411c[_0x3f64('0x6a')]]);}}}catch(_0x11ea84){logger[_0x3f64('0x44')](_0x3f64('0x68'),util[_0x3f64('0x40')](_0x11ea84,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3f64('0x73')]=function(_0x2a69cb){logger['debug'](_0x3f64('0x74'),util[_0x3f64('0x40')](_0x2a69cb,{'showHidden':![],'depth':null}));this[_0x3f64('0x16')]=!![];};VoiceQueueReport['prototype'][_0x3f64('0x1e')]=function(_0x5608a5){try{if(this[_0x3f64('0x69')](_0x5608a5)){logger[_0x3f64('0x4e')](_0x3f64('0x75'),_0x5608a5[_0x3f64('0x4a')],util[_0x3f64('0x40')](_0x5608a5,{'showHidden':![],'depth':null}));if(_[_0x3f64('0x63')](this[_0x3f64('0x11')][_0x5608a5['uniqueid']])){this['queueReports'][_0x5608a5['uniqueid']]=[];this[_0x3f64('0x13')][_0x5608a5[_0x3f64('0x4a')]]={};}var _0x292e83=new QueueReport();_0x292e83[_0x3f64('0x4c')]=_0x5608a5[_0x3f64('0x6a')];_0x292e83['type']=this[_0x3f64('0x15')][_0x292e83[_0x3f64('0x4c')]]&&this[_0x3f64('0x15')][_0x292e83[_0x3f64('0x4c')]]['type']?this[_0x3f64('0x15')][_0x292e83[_0x3f64('0x4c')]][_0x3f64('0x51')]||'inbound':_0x3f64('0x52');_0x292e83[_0x3f64('0x6a')]=_0x5608a5[_0x3f64('0x6a')];_0x292e83[_0x3f64('0x76')]=moment()[_0x3f64('0x62')](_0x3f64('0x77'));_0x292e83[_0x3f64('0x78')]=_0x5608a5[_0x3f64('0x78')];_0x292e83['count']=_0x5608a5['count'];_0x292e83[_0x3f64('0x4a')]=_0x5608a5[_0x3f64('0x4a')];logger['info'](_0x3f64('0x79'),_0x292e83[_0x3f64('0x4c')],_0x292e83[_0x3f64('0x51')]);_['merge'](_0x292e83,_[_0x3f64('0x7a')](_0x5608a5,_[_0x3f64('0x7b')](_0x292e83)));this[_0x3f64('0x11')][_0x5608a5[_0x3f64('0x4a')]][_0x3f64('0x7c')](_0x292e83);this[_0x3f64('0x13')][_0x5608a5[_0x3f64('0x4a')]]=_0x292e83;this[_0x3f64('0x48')](_0x292e83,_0x3f64('0x1d'));}}catch(_0x3015e5){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x5608a5['uniqueid'],util['inspect'](_0x3015e5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f64('0xc')][_0x3f64('0x1f')]=function(_0x4821c7){try{if(this[_0x3f64('0x69')](_0x4821c7)){logger[_0x3f64('0x4e')](_0x3f64('0x7d'),_0x4821c7[_0x3f64('0x4a')],util['inspect'](_0x4821c7,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4821c7[_0x3f64('0x4a')]]){var _0x5375ac=_[_0x3f64('0x7e')](this['queueReports'][_0x4821c7['uniqueid']]);_0x5375ac[_0x3f64('0x7f')]=![];_0x5375ac[_0x3f64('0x80')]=null;_0x5375ac[_0x3f64('0x81')]=_0x4821c7[_0x3f64('0x81')];_0x5375ac[_0x3f64('0x82')]=_0x4821c7['originalposition'];_0x5375ac[_0x3f64('0x83')]=!![];_0x5375ac[_0x3f64('0x84')]=moment()[_0x3f64('0x62')](_0x3f64('0x77'));_0x5375ac[_0x3f64('0x85')]=_0x3f64('0x86');_0x5375ac[_0x3f64('0x87')]=null;logger[_0x3f64('0x6c')](_0x3f64('0x88'),_0x5375ac[_0x3f64('0x4c')],_0x5375ac['type']);this['channels'][_0x4821c7[_0x3f64('0x4a')]]=_0x5375ac;this[_0x3f64('0x46')](_0x5375ac,'queuecallerabandon');}}}catch(_0x480a8a){logger[_0x3f64('0x44')](_0x3f64('0x7d'),_0x4821c7[_0x3f64('0x4a')],util[_0x3f64('0x40')](_0x480a8a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f64('0xc')]['syncQueueCallerLeave']=function(_0x38084c){try{if(this[_0x3f64('0x69')](_0x38084c)){logger[_0x3f64('0x4e')]('[%s][voiceQueueReport][queuecallerleave]',_0x38084c['uniqueid'],util['inspect'](_0x38084c,{'showHidden':![],'depth':null}));if(this[_0x3f64('0x11')][_0x38084c['uniqueid']]){var _0x5d941a=_['last'](this[_0x3f64('0x11')][_0x38084c[_0x3f64('0x4a')]]);_0x5d941a[_0x3f64('0x89')]=moment()[_0x3f64('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d941a['connectedlinenum']=_0x38084c[_0x3f64('0x8a')];_0x5d941a['connectedlinename']=_0x38084c['connectedlinename'];logger[_0x3f64('0x6c')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5d941a[_0x3f64('0x4c')],_0x5d941a[_0x3f64('0x51')],_0x38084c[_0x3f64('0x8a')],_0x38084c[_0x3f64('0x8b')]);this[_0x3f64('0x13')][_0x38084c[_0x3f64('0x4a')]]=_0x5d941a;this[_0x3f64('0x48')](_0x5d941a,'queuecallerleave');}}}catch(_0x7a67b8){logger[_0x3f64('0x44')](_0x3f64('0x8c'),_0x38084c[_0x3f64('0x4a')],util[_0x3f64('0x40')](_0x7a67b8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x3d6758){try{if(this['isNotNull'](_0x3d6758)){logger['debug'](_0x3f64('0x8d'),_0x3d6758['uniqueid'],util[_0x3f64('0x40')](_0x3d6758,{'showHidden':![],'depth':null}));if(this[_0x3f64('0x11')][_0x3d6758[_0x3f64('0x4a')]]){var _0x27fb38=_['last'](this[_0x3f64('0x11')][_0x3d6758[_0x3f64('0x4a')]]);_0x27fb38[_0x3f64('0x7f')]=!![];_0x27fb38[_0x3f64('0x85')]=_0x3f64('0x8e');logger[_0x3f64('0x6c')](_0x3f64('0x8f'),_0x27fb38['name'],_0x27fb38[_0x3f64('0x51')]);}}}catch(_0x5af0d8){logger[_0x3f64('0x44')](_0x3f64('0x8d'),_0x3d6758['uniqueid'],util['inspect'](_0x5af0d8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f64('0xc')][_0x3f64('0x23')]=function(_0x16c333){try{if(this[_0x3f64('0x69')](_0x16c333)){logger[_0x3f64('0x4e')]('[%s][voiceQueueReport][agentcomplete]',_0x16c333[_0x3f64('0x4a')],util[_0x3f64('0x40')](_0x16c333,{'showHidden':![],'depth':null}));if(this[_0x3f64('0x11')][_0x16c333[_0x3f64('0x4a')]]){var _0x31f82e=_[_0x3f64('0x7e')](this['queueReports'][_0x16c333[_0x3f64('0x4a')]]);_0x31f82e[_0x3f64('0x83')]=![];_0x31f82e[_0x3f64('0x84')]=null;_0x31f82e[_0x3f64('0x90')]=!![];_0x31f82e['lastAssignedTo']=_0x16c333[_0x3f64('0x91')];_0x31f82e[_0x3f64('0x81')]=_0x16c333[_0x3f64('0x81')];_0x31f82e[_0x3f64('0x7f')]=!![];_0x31f82e[_0x3f64('0x92')]=![];_0x31f82e[_0x3f64('0x93')]=null;if(!_0x31f82e['transfer']){if(_0x16c333[_0x3f64('0x94')]==_0x3f64('0x95')){_0x31f82e[_0x3f64('0x85')]='COMPLETED';logger[_0x3f64('0x6c')](_0x3f64('0x96'),_0x31f82e['name'],_0x31f82e[_0x3f64('0x51')]);}else{if(_[_0x3f64('0x97')](_0x16c333[_0x3f64('0x3d')]['toLowerCase'](),_0x3f64('0x98'))){if(this[_0x3f64('0x11')][_0x16c333['linkedid']]){var _0x22f5a8=_[_0x3f64('0x7e')](this[_0x3f64('0x11')][_0x16c333[_0x3f64('0x99')]]);_0x22f5a8[_0x3f64('0x7f')]=![];_0x22f5a8[_0x3f64('0x92')]=!![];_0x22f5a8['queuecallerexitAt']=moment(_0x31f82e['queuecallerjoinAt'])[_0x3f64('0x9a')](_0x16c333[_0x3f64('0x81')],_0x3f64('0x9b'))['format'](_0x3f64('0x77'));_0x22f5a8['queuecallerexitreason']=_0x3f64('0x9c');_0x22f5a8['transfer']=!![];_0x22f5a8[_0x3f64('0x9d')]='FORWARD';_0x22f5a8['transferexten']=_0x16c333[_0x3f64('0x9e')];_0x22f5a8['transferuniqueid']=_0x16c333['uniqueid'];logger[_0x3f64('0x6c')](_0x3f64('0x9f'),_0x22f5a8[_0x3f64('0x4c')],_0x22f5a8[_0x3f64('0x51')]);var _0x475bd2=this[_0x3f64('0x11')][_0x16c333[_0x3f64('0x99')]];this[_0x3f64('0x11')][_0x16c333[_0x3f64('0x99')]]=this['queueReports'][_0x16c333[_0x3f64('0x4a')]];this['queueReports'][_0x16c333[_0x3f64('0x4a')]]=_0x475bd2;}}else{_0x31f82e[_0x3f64('0x85')]=_0x3f64('0xa0')+_0x16c333[_0x3f64('0x94')][_0x3f64('0xa1')]();logger[_0x3f64('0x6c')](_0x3f64('0xa2'),_0x31f82e[_0x3f64('0x4c')],_0x31f82e[_0x3f64('0x51')],_0x31f82e['queuecallerexitreason']);}}}this[_0x3f64('0x13')][_0x16c333[_0x3f64('0x4a')]]=_0x31f82e;this[_0x3f64('0x46')](_0x31f82e,_0x3f64('0x22'));}}}catch(_0x3e03b4){logger[_0x3f64('0x44')](_0x3f64('0xa3'),_0x16c333['uniqueid'],util[_0x3f64('0x40')](_0x3e03b4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3f64('0x26')]=function(_0x32816d){try{if(this[_0x3f64('0x69')](_0x32816d)){logger[_0x3f64('0x4e')](_0x3f64('0xa4'),_0x32816d[_0x3f64('0x4a')],util[_0x3f64('0x40')](_0x32816d,{'showHidden':![],'depth':null}));this['addVariable'](_0x32816d[_0x3f64('0x4a')],_[_0x3f64('0x7b')](_0x32816d[_0x3f64('0xa5')])[0x0],_0x32816d[_0x3f64('0xa6')]);if(this[_0x3f64('0x11')][_0x32816d[_0x3f64('0x4a')]]){var _0x1ad46c=_[_0x3f64('0x7e')](this[_0x3f64('0x11')][_0x32816d['uniqueid']]);if(_0x1ad46c){if(this[_0x3f64('0x69')](_0x32816d['variable'])&&this[_0x3f64('0x69')](_0x32816d[_0x3f64('0xa5')][_0x3f64('0xa7')])){switch(_0x32816d['value']){case'CONTINUE':_0x1ad46c[_0x3f64('0x92')]=![];_0x1ad46c['queuecallerexitAt']=null;break;case _0x3f64('0xa8'):_0x1ad46c[_0x3f64('0xa9')]=_0x3f64('0xaa');_0x1ad46c['queuecallerexit']=!![];_0x1ad46c[_0x3f64('0x93')]=moment()[_0x3f64('0x62')](_0x3f64('0x77'));_0x1ad46c[_0x3f64('0x89')]=moment()[_0x3f64('0x62')](_0x3f64('0x77'));logger[_0x3f64('0x4e')](_0x3f64('0xab'),_0x32816d[_0x3f64('0x4a')],util['inspect'](_0x1ad46c,{'showHidden':![],'depth':null}));ami[_0x3f64('0x47')]('custom:timeout',_0x1ad46c);break;default:_0x1ad46c[_0x3f64('0x92')]=!![];_0x1ad46c[_0x3f64('0x93')]=moment()['format'](_0x3f64('0x77'));_0x1ad46c[_0x3f64('0x89')]=moment()[_0x3f64('0x62')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1ad46c[_0x3f64('0x83')]=![];_0x1ad46c[_0x3f64('0x84')]=null;_0x1ad46c[_0x3f64('0x85')]=_0x32816d[_0x3f64('0xa6')];this['channels'][_0x32816d['uniqueid']]=_0x1ad46c;this[_0x3f64('0x46')](_0x1ad46c,_0x3f64('0xac'));}else if(this[_0x3f64('0x69')](_0x32816d[_0x3f64('0xa5')])&&this[_0x3f64('0x69')](_0x32816d[_0x3f64('0xa5')]['queueposition'])){if(!_0x1ad46c[_0x3f64('0x83')]){_0x1ad46c[_0x3f64('0x92')]=!![];_0x1ad46c[_0x3f64('0x93')]=moment()[_0x3f64('0x62')](_0x3f64('0x77'));_0x1ad46c['queuecallerexitreason']=_0x3f64('0xad');_0x1ad46c['queuecallerleaveAt']=moment()[_0x3f64('0x62')](_0x3f64('0x77'));this[_0x3f64('0x13')][_0x32816d[_0x3f64('0x4a')]]=_0x1ad46c;}}logger[_0x3f64('0x6c')](_0x3f64('0xae'),_0x32816d[_0x3f64('0x4a')],_0x1ad46c['name'],_0x1ad46c['type'],_[_0x3f64('0x7b')](_0x32816d['variable'])[0x0],_0x32816d[_0x3f64('0xa6')]);_0x1ad46c['variables']=this['variables'][_0x32816d[_0x3f64('0x4a')]];}}}}catch(_0x13fc3a){logger['error'](_0x3f64('0xa4'),_0x32816d[_0x3f64('0x4a')],util[_0x3f64('0x40')](_0x13fc3a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x8fe18c,_0x50f22f,_0x579472){var _0x1d2c03=[_0x3f64('0xaf'),_0x3f64('0xb0'),_0x3f64('0xb1'),_0x3f64('0xb2'),'rtpaudioqosloss',_0x3f64('0xb3'),_0x3f64('0xb4'),'rtpaudioqosrttbridged',_0x3f64('0xb5'),_0x3f64('0xb6'),'bridgepeer',_0x3f64('0xb7'),_0x3f64('0xb8'),_0x3f64('0xb9'),'memberinterface',_0x3f64('0xba'),_0x3f64('0x91'),_0x3f64('0xbb'),'memberrealtime'];if(!_[_0x3f64('0x3a')](_0x50f22f)&&!_[_0x3f64('0xbc')](_0x1d2c03,_0x50f22f)){if(_['isUndefined'](this['variables'][_0x8fe18c])){this[_0x3f64('0x18')][_0x8fe18c]={};}this['variables'][_0x8fe18c][_0x50f22f]=_0x579472;}};VoiceQueueReport[_0x3f64('0xc')][_0x3f64('0x27')]=function(_0x17e705){try{if(this['isNotNull'](_0x17e705)){logger[_0x3f64('0x4e')](_0x3f64('0xbd'),_0x17e705[_0x3f64('0x4a')],util[_0x3f64('0x40')](_0x17e705,{'showHidden':![],'depth':null}));if(this[_0x3f64('0x11')][_0x17e705['uniqueid']]){for(var _0x96a1=0x0,_0x2bb2a3={};_0x96a1=0x0?moment(_0x3cefca[_0x5c7c('0x18')])[_0x5c7c('0xe')](_0x3cefca[_0x5c7c('0x19')],_0x5c7c('0xf')):null,'data1':_0x5c7c('0x1a'),'data2':_0x3cefca[_0x5c7c('0x1b')],'data3':_0x3cefca[_0x5c7c('0x12')],'data4':_0x3cefca[_0x5c7c('0x1c')]||null,'role':'agent','internal':_0x3cefca['accountcode']?_[_0x5c7c('0x14')](_0x3cefca[_0x5c7c('0x1b')]):undefined,'uniqueid':_0x3cefca[_0x5c7c('0x15')]},'log':_0x5c7c('0x7')});}; \ No newline at end of file +var _0x6bdc=['isNil','interface','format','TALKING','queuecallerleaveAt','diff','inbound','calleridnum','queue','agent','accountcode','toNumber','membername','endtime','starttime','seconds','outbound','exten','uniqueid','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x6bdc,0x12b));var _0xc6bd=function(_0xd4dcf5,_0x44bdaf){_0xd4dcf5=_0xd4dcf5-0x0;var _0x331b03=_0x6bdc[_0xd4dcf5];return _0x331b03;};'use strict';var moment=require('moment');var _=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var client=require('../client');exports[_0xc6bd('0x2')]=function(_0x4df095){var _0x33dac0=_0x4df095[_0xc6bd('0x3')]||_0x4df095[_0xc6bd('0x4')];return client[_0xc6bd('0x5')](_0xc6bd('0x6'),{'body':{'channel':_0xc6bd('0x7'),'membername':_0x4df095[_0xc6bd('0x8')],'interface':_[_0xc6bd('0x9')](_0x4df095[_0xc6bd('0xa')])?util[_0xc6bd('0xb')]('SIP/%s',_0x4df095[_0xc6bd('0x8')]):_0x4df095[_0xc6bd('0xa')],'type':_0xc6bd('0xc'),'enterAt':_0x4df095[_0xc6bd('0xd')],'exitAt':_0x33dac0,'duration':moment(_0x33dac0)[_0xc6bd('0xe')](_0x4df095[_0xc6bd('0xd')],'seconds'),'data1':_0xc6bd('0xf'),'data2':_0x4df095[_0xc6bd('0x10')],'data3':_0x4df095['exten'],'data4':null,'data5':_0x4df095[_0xc6bd('0x11')],'role':_0xc6bd('0x12'),'internal':_0x4df095[_0xc6bd('0x13')]?_[_0xc6bd('0x14')](_0x4df095['accountcode']):undefined,'uniqueid':_0x4df095['uniqueid']},'log':_0xc6bd('0x6')});};exports['voiceDialReport']=function(_0x5ca35e){return client[_0xc6bd('0x5')](_0xc6bd('0x6'),{'body':{'channel':'voice','membername':_0x5ca35e[_0xc6bd('0x15')],'interface':_0x5ca35e[_0xc6bd('0xa')],'type':_0xc6bd('0xc'),'enterAt':_0x5ca35e['starttime'],'exitAt':_0x5ca35e[_0xc6bd('0x16')],'duration':moment(_0x5ca35e[_0xc6bd('0x16')])[_0xc6bd('0xe')](_0x5ca35e[_0xc6bd('0x17')],_0xc6bd('0x18'))>=0x0?moment(_0x5ca35e[_0xc6bd('0x16')])['diff'](_0x5ca35e[_0xc6bd('0x17')],_0xc6bd('0x18')):null,'data1':_0xc6bd('0x19'),'data2':_0x5ca35e[_0xc6bd('0x13')],'data3':_0x5ca35e[_0xc6bd('0x1a')],'data4':_0x5ca35e['dialstring']||null,'role':_0xc6bd('0x12'),'internal':_0x5ca35e[_0xc6bd('0x13')]?_[_0xc6bd('0x14')](_0x5ca35e['accountcode']):undefined,'uniqueid':_0x5ca35e[_0xc6bd('0x1b')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index ab65af4..6922eb8 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 _0x823c=['GetTemplate','name','html','../client','Request'];(function(_0x5abb00,_0x342d70){var _0xf9b854=function(_0x43ac30){while(--_0x43ac30){_0x5abb00['push'](_0x5abb00['shift']());}};_0xf9b854(++_0x342d70);}(_0x823c,0x143));var _0xc823=function(_0x3c4721,_0x3a44e8){_0x3c4721=_0x3c4721-0x0;var _0x1e9835=_0x823c[_0x3c4721];return _0x1e9835;};'use strict';var client=require(_0xc823('0x0'));exports['getTemplates']=function(_0x30a06f){return function(_0x5f9bd8){return client[_0xc823('0x1')](_0xc823('0x2'),{'options':{'raw':!![],'attributes':['id',_0xc823('0x3'),_0xc823('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x3eec=['getTemplates','GetTemplate','name','html','../client'];(function(_0x32c82a,_0x159aa){var _0x1c5705=function(_0x29457f){while(--_0x29457f){_0x32c82a['push'](_0x32c82a['shift']());}};_0x1c5705(++_0x159aa);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x296a62,_0x39e39c){_0x296a62=_0x296a62-0x0;var _0x201a37=_0x3eec[_0x296a62];return _0x201a37;};'use strict';var client=require(_0xc3ee('0x0'));exports[_0xc3ee('0x1')]=function(_0x181c8e){return function(_0x3b1908){return client['Request'](_0xc3ee('0x2'),{'options':{'raw':!![],'attributes':['id',_0xc3ee('0x3'),_0xc3ee('0x4')]},'log':_0xc3ee('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 91edf7c..0c964f1 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 _0x7bc2=['Action','Actions','action','data1','data2','data3','data4','data6','data7','GetTrigger','../client','getTriggers','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions'];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0x7bc2,0xb2));var _0x27bc=function(_0x32f977,_0x375585){_0x32f977=_0x32f977-0x0;var _0x2a0ebd=_0x7bc2[_0x32f977];return _0x2a0ebd;};'use strict';var client=require(_0x27bc('0x0'));exports[_0x27bc('0x1')]=function(_0x323f43){return function(_0x80bfd1){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x27bc('0x2'),_0x27bc('0x3'),_0x27bc('0x4')],'include':[{'model':_0x27bc('0x5'),'as':_0x27bc('0x6'),'attributes':['id',_0x27bc('0x7'),_0x27bc('0x8'),_0x27bc('0x9')]},{'model':_0x27bc('0x5'),'as':_0x27bc('0xa'),'attributes':['id',_0x27bc('0x7'),_0x27bc('0x8'),_0x27bc('0x9')]},{'model':_0x27bc('0xb'),'as':_0x27bc('0xc'),'attributes':['id',_0x27bc('0xd'),_0x27bc('0xe'),_0x27bc('0xf'),_0x27bc('0x10'),_0x27bc('0x11'),'data5',_0x27bc('0x12'),_0x27bc('0x13')]}]},'log':_0x27bc('0x14')});};}; \ No newline at end of file +var _0xab04=['../client','getTriggers','Request','GetTrigger','name','Condition','AllConditions','field','value','AnyConditions','operator','Action','Actions','action','data1','data2','data3','data5','data6','data7'];(function(_0x47cd53,_0x43e9b4){var _0x2d128c=function(_0x585312){while(--_0x585312){_0x47cd53['push'](_0x47cd53['shift']());}};_0x2d128c(++_0x43e9b4);}(_0xab04,0x1b8));var _0x4ab0=function(_0x2b27a0,_0x2ee33){_0x2b27a0=_0x2b27a0-0x0;var _0x44ec6b=_0xab04[_0x2b27a0];return _0x44ec6b;};'use strict';var client=require(_0x4ab0('0x0'));exports[_0x4ab0('0x1')]=function(_0xd9d99f){return function(_0x57a05f){return client[_0x4ab0('0x2')](_0x4ab0('0x3'),{'options':{'raw':![],'attributes':['id',_0x4ab0('0x4'),'channel','status'],'include':[{'model':_0x4ab0('0x5'),'as':_0x4ab0('0x6'),'attributes':['id',_0x4ab0('0x7'),'operator',_0x4ab0('0x8')]},{'model':_0x4ab0('0x5'),'as':_0x4ab0('0x9'),'attributes':['id',_0x4ab0('0x7'),_0x4ab0('0xa'),_0x4ab0('0x8')]},{'model':_0x4ab0('0xb'),'as':_0x4ab0('0xc'),'attributes':['id',_0x4ab0('0xd'),_0x4ab0('0xe'),_0x4ab0('0xf'),_0x4ab0('0x10'),'data4',_0x4ab0('0x11'),_0x4ab0('0x12'),_0x4ab0('0x13')]}]},'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 7ffca94..cac00f3 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 _0xa10d=['../client','getTrunks','GetTrunk','name'];(function(_0x4b7982,_0x5b0967){var _0x3239b6=function(_0x4c309f){while(--_0x4c309f){_0x4b7982['push'](_0x4b7982['shift']());}};_0x3239b6(++_0x5b0967);}(_0xa10d,0xac));var _0xda10=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xa10d[_0x344a3f];return _0x264712;};'use strict';var client=require(_0xda10('0x0'));exports[_0xda10('0x1')]=function(_0x1f08e0){return function(_0x44fd4c){return client['Request'](_0xda10('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xda10('0x3'),'registry']},'log':_0xda10('0x2')});};}; \ No newline at end of file +var _0x660b=['getTrunks','Request','GetTrunk','name','../client'];(function(_0x3c1a30,_0x1073c8){var _0x307988=function(_0x424649){while(--_0x424649){_0x3c1a30['push'](_0x3c1a30['shift']());}};_0x307988(++_0x1073c8);}(_0x660b,0x194));var _0xb660=function(_0x578320,_0x4b27a0){_0x578320=_0x578320-0x0;var _0x218799=_0x660b[_0x578320];return _0x218799;};'use strict';var client=require(_0xb660('0x0'));exports[_0xb660('0x1')]=function(_0x403164){return function(_0x368c54){return client[_0xb660('0x2')](_0xb660('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb660('0x4'),'registry']},'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 8365c5c..6680a26 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 _0xa216=['Request','GetUser','agent','email','accountcode','fullname','online','lastLoginAt','voicePause','mobile','getAgents','getTelephones','telephone','name','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','pauseType','../client'];(function(_0x216d9d,_0x4e9708){var _0x3fbfb6=function(_0x5e88d6){while(--_0x5e88d6){_0x216d9d['push'](_0x216d9d['shift']());}};_0x3fbfb6(++_0x4e9708);}(_0xa216,0x1e2));var _0x6a21=function(_0x320fa3,_0x1a10c5){_0x320fa3=_0x320fa3-0x0;var _0x2a0ba3=_0xa216[_0x320fa3];return _0x2a0ba3;};'use strict';var client=require(_0x6a21('0x0'));exports['getAgents']=function(){return function(){return client[_0x6a21('0x1')](_0x6a21('0x2'),{'options':{'raw':![],'where':{'role':_0x6a21('0x3')},'attributes':['id','name',_0x6a21('0x4'),_0x6a21('0x5'),_0x6a21('0x6'),_0x6a21('0x7'),_0x6a21('0x8'),'pauseType','lastPauseAt',_0x6a21('0x9'),'phone',_0x6a21('0xa'),'interface']},'log':_0x6a21('0xb')});};};exports[_0x6a21('0xc')]=function(){return function(){return client[_0x6a21('0x1')](_0x6a21('0x2'),{'options':{'raw':!![],'where':{'role':_0x6a21('0xd')},'attributes':['id',_0x6a21('0xe'),_0x6a21('0x5'),'internal']},'log':_0x6a21('0xc')});};};exports[_0x6a21('0xf')]=function(_0x47d633,_0x2877e1,_0x4c64d2){return client['Request']('PauseUser',{'body':{'type':_0x2877e1,'uniqueid':_0x4c64d2},'options':{'where':{'id':_0x47d633['id']}},'log':_0x6a21('0xf')});};exports[_0x6a21('0x10')]=function(_0xe67401){return client['Request'](_0x6a21('0x11'),{'body':{},'options':{'where':{'id':_0xe67401['id']}},'log':_0x6a21('0xf')});};exports[_0x6a21('0x12')]=function(_0x1d8202){return client[_0x6a21('0x1')](_0x6a21('0x13'),{'options':{'raw':![],'where':{'role':_0x6a21('0x3'),'id':_0x1d8202},'attributes':['id',_0x6a21('0xe'),_0x6a21('0x4'),_0x6a21('0x5'),_0x6a21('0x6'),_0x6a21('0x7'),_0x6a21('0x8'),_0x6a21('0x14'),'lastPauseAt',_0x6a21('0x9'),'interface']},'log':_0x6a21('0x12')});}; \ No newline at end of file +var _0x0379=['internal','savePause','PauseUser','UnpauseUser','getAgent','ShowUser','email','online','interface','../client','getAgents','Request','agent','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','getTelephones','GetUser','telephone'];(function(_0x5e97b1,_0x3c16bc){var _0x2ef581=function(_0x386f22){while(--_0x386f22){_0x5e97b1['push'](_0x5e97b1['shift']());}};_0x2ef581(++_0x3c16bc);}(_0x0379,0x129));var _0x9037=function(_0x22a50b,_0x96421f){_0x22a50b=_0x22a50b-0x0;var _0x109ae8=_0x0379[_0x22a50b];return _0x109ae8;};'use strict';var client=require(_0x9037('0x0'));exports[_0x9037('0x1')]=function(){return function(){return client[_0x9037('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x9037('0x3')},'attributes':['id','name','email',_0x9037('0x4'),_0x9037('0x5'),'online',_0x9037('0x6'),_0x9037('0x7'),_0x9037('0x8'),_0x9037('0x9'),_0x9037('0xa'),_0x9037('0xb'),'interface']},'log':_0x9037('0x1')});};};exports[_0x9037('0xc')]=function(){return function(){return client[_0x9037('0x2')](_0x9037('0xd'),{'options':{'raw':!![],'where':{'role':_0x9037('0xe')},'attributes':['id','name',_0x9037('0x4'),_0x9037('0xf')]},'log':_0x9037('0xc')});};};exports[_0x9037('0x10')]=function(_0x5281cd,_0x3aac9b,_0x11dad4){return client[_0x9037('0x2')](_0x9037('0x11'),{'body':{'type':_0x3aac9b,'uniqueid':_0x11dad4},'options':{'where':{'id':_0x5281cd['id']}},'log':_0x9037('0x10')});};exports['saveUnpause']=function(_0x479d68){return client[_0x9037('0x2')](_0x9037('0x12'),{'body':{},'options':{'where':{'id':_0x479d68['id']}},'log':'savePause'});};exports[_0x9037('0x13')]=function(_0x1eb6b9){return client[_0x9037('0x2')](_0x9037('0x14'),{'options':{'raw':![],'where':{'role':_0x9037('0x3'),'id':_0x1eb6b9},'attributes':['id','name',_0x9037('0x15'),_0x9037('0x4'),'fullname',_0x9037('0x16'),'lastLoginAt','pauseType',_0x9037('0x8'),_0x9037('0x9'),_0x9037('0x17')]},'log':_0x9037('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 18576e6..faf31eb 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 _0xa882=['update','Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport'];(function(_0x2407c2,_0x376131){var _0x4ec0b4=function(_0x1e9f99){while(--_0x1e9f99){_0x2407c2['push'](_0x2407c2['shift']());}};_0x4ec0b4(++_0x376131);}(_0xa882,0x135));var _0x2a88=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xa882[_0x4f9b18];return _0x29f20c;};'use strict';var client=require(_0x2a88('0x0'));exports[_0x2a88('0x1')]=function(_0x4408e7){return client['Request'](_0x2a88('0x2'),{'body':_0x4408e7,'log':'CreateVoiceAgentReport'});};exports[_0x2a88('0x3')]=function(_0x32a298,_0x124ee7,_0x30511f){return client[_0x2a88('0x4')]('UpdateVoiceAgentReport',{'body':_0x32a298,'options':{'where':{'uniqueid':_0x124ee7,'interface':_0x30511f,'agentcomplete':!![]}},'log':_0x2a88('0x5')});}; \ No newline at end of file +var _0x81c4=['UpdateVoiceAgentReport','Request','CreateVoiceAgentReport','update'];(function(_0x48c290,_0x558081){var _0x153b62=function(_0x1d6148){while(--_0x1d6148){_0x48c290['push'](_0x48c290['shift']());}};_0x153b62(++_0x558081);}(_0x81c4,0x179));var _0x481c=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x81c4[_0x4243a3];return _0x1b2a33;};'use strict';var client=require('../client');exports['create']=function(_0x1164bf){return client[_0x481c('0x0')](_0x481c('0x1'),{'body':_0x1164bf,'log':_0x481c('0x1')});};exports[_0x481c('0x2')]=function(_0x470d05,_0x2b749b,_0x31e2c0){return client[_0x481c('0x0')](_0x481c('0x3'),{'body':_0x470d05,'options':{'where':{'uniqueid':_0x2b749b,'interface':_0x31e2c0,'agentcomplete':!![]}},'log':_0x481c('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index df5030a..af0be6e 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 _0x9f6a=['create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client'];(function(_0x235e7e,_0x5079e9){var _0x30410e=function(_0x437257){while(--_0x437257){_0x235e7e['push'](_0x235e7e['shift']());}};_0x30410e(++_0x5079e9);}(_0x9f6a,0x128));var _0xa9f6=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0x9f6a[_0x223461];return _0x4dbe0a;};'use strict';var moment=require('moment');var util=require(_0xa9f6('0x0'));var _=require(_0xa9f6('0x1'));var client=require(_0xa9f6('0x2'));exports[_0xa9f6('0x3')]=function(_0x2bb530){return client[_0xa9f6('0x4')](_0xa9f6('0x5'),{'body':_[_0xa9f6('0x6')](_0x2bb530,{'source':_0x2bb530[_0xa9f6('0x7')],'destinationcontext':_0x2bb530[_0xa9f6('0x8')],'callerid':_0x2bb530[_0xa9f6('0x9')],'amaflags':_0xa9f6('0xa')}),'log':'CreateVoiceCallReport'});};exports[_0xa9f6('0xb')]=function(){return function(){return client['Request'](_0xa9f6('0xc'),{'options':{'where':{'type':[_0xa9f6('0xd')],'createdAt':{'$between':[moment()['startOf'](_0xa9f6('0xe'))[_0xa9f6('0xf')](_0xa9f6('0x10')),moment()[_0xa9f6('0x11')](_0xa9f6('0xe'))[_0xa9f6('0xf')](_0xa9f6('0x10'))]}},'attributes':[_0xa9f6('0x12'),_0xa9f6('0x13'),_0xa9f6('0x14'),_0xa9f6('0x15')]},'log':_0xa9f6('0x16')});};}; \ No newline at end of file +var _0x82e8=['calleridnum','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','Request','CreateVoiceCallReport'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x82e8,0x1b3));var _0x882e=function(_0x37d5ff,_0x5ee83b){_0x37d5ff=_0x37d5ff-0x0;var _0x146b37=_0x82e8[_0x37d5ff];return _0x146b37;};'use strict';var moment=require('moment');var util=require(_0x882e('0x0'));var _=require(_0x882e('0x1'));var client=require(_0x882e('0x2'));exports['create']=function(_0x5b5872){return client[_0x882e('0x3')](_0x882e('0x4'),{'body':_['merge'](_0x5b5872,{'source':_0x5b5872[_0x882e('0x5')],'destinationcontext':_0x5b5872['context'],'callerid':_0x5b5872[_0x882e('0x6')],'amaflags':'DOCUMENTATION'}),'log':_0x882e('0x4')});};exports[_0x882e('0x7')]=function(){return function(){return client[_0x882e('0x3')](_0x882e('0x8'),{'options':{'where':{'type':[_0x882e('0x9')],'createdAt':{'$between':[moment()[_0x882e('0xa')]('day')[_0x882e('0xb')](_0x882e('0xc')),moment()[_0x882e('0xd')](_0x882e('0xe'))[_0x882e('0xb')](_0x882e('0xc'))]}},'attributes':[_0x882e('0xf'),_0x882e('0x10'),_0x882e('0x11'),_0x882e('0x12')]},'log':_0x882e('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 3b9e015..bc59136 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 _0x20ae=['create','Request'];(function(_0x3cfe49,_0x4f4b56){var _0x17c3b5=function(_0x4fe442){while(--_0x4fe442){_0x3cfe49['push'](_0x3cfe49['shift']());}};_0x17c3b5(++_0x4f4b56);}(_0x20ae,0x9e));var _0xe20a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x20ae[_0x17b6e3];return _0x3906f3;};'use strict';var client=require('../client');exports[_0xe20a('0x0')]=function(_0x4c99ca){return client[_0xe20a('0x1')]('CreateVoiceDialReport',{'body':_0x4c99ca,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x9827=['create','CreateVoiceDialReport'];(function(_0x455807,_0xf0fef3){var _0x521949=function(_0x35fbdd){while(--_0x35fbdd){_0x455807['push'](_0x455807['shift']());}};_0x521949(++_0xf0fef3);}(_0x9827,0x106));var _0x7982=function(_0x2cc594,_0x4d727b){_0x2cc594=_0x2cc594-0x0;var _0x4abff7=_0x9827[_0x2cc594];return _0x4abff7;};'use strict';var client=require('../client');exports[_0x7982('0x0')]=function(_0x16b222){return client['Request'](_0x7982('0x1'),{'body':_0x16b222,'log':_0x7982('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 22f07c0..f84a029 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 _0xfce5=['GetVoiceExtension','getVoiceExtensions','Request'];(function(_0x53f715,_0x52587b){var _0x16c757=function(_0x5cc9bf){while(--_0x5cc9bf){_0x53f715['push'](_0x53f715['shift']());}};_0x16c757(++_0x52587b);}(_0xfce5,0x70));var _0x5fce=function(_0x25ad66,_0x46e4dc){_0x25ad66=_0x25ad66-0x0;var _0x141bc4=_0xfce5[_0x25ad66];return _0x141bc4;};'use strict';var client=require('../client');exports[_0x5fce('0x0')]=function(){return function(){return client[_0x5fce('0x1')](_0x5fce('0x2'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x5fce('0x0')});};}; \ No newline at end of file +var _0x352e=['exten','recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x1290a7,_0x4a3b0b){var _0xb8f971=function(_0x2af0b8){while(--_0x2af0b8){_0x1290a7['push'](_0x1290a7['shift']());}};_0xb8f971(++_0x4a3b0b);}(_0x352e,0x1a6));var _0xe352=function(_0x2ae7ce,_0x20332c){_0x2ae7ce=_0x2ae7ce-0x0;var _0x21d90c=_0x352e[_0x2ae7ce];return _0x21d90c;};'use strict';var client=require(_0xe352('0x0'));exports[_0xe352('0x1')]=function(){return function(){return client[_0xe352('0x2')](_0xe352('0x3'),{'options':{'raw':!![],'attributes':['id',_0xe352('0x4'),_0xe352('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xe352('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index fec6d6a..7ed1013 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 _0x1814=['dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','name','TrunkBackup','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','acw','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient'];(function(_0x9a803a,_0x9a79fc){var _0x1bd637=function(_0x27a1b9){while(--_0x27a1b9){_0x9a803a['push'](_0x9a803a['shift']());}};_0x1bd637(++_0x9a79fc);}(_0x1814,0x109));var _0x4181=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1814[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4181('0x0'));exports[_0x4181('0x1')]=function(){return function(){return client['Request'](_0x4181('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x4181('0x3'),'acwTimeout',_0x4181('0x4'),_0x4181('0x5'),_0x4181('0x6'),'dialActive',_0x4181('0x7'),_0x4181('0x8'),'dialLimitQueue',_0x4181('0x9'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0x4181('0xa'),_0x4181('0xb'),_0x4181('0xc'),_0x4181('0xd'),'dialQueueOptions',_0x4181('0xe'),'dialQueueProject',_0x4181('0xf'),_0x4181('0x10'),_0x4181('0x11'),_0x4181('0x12'),_0x4181('0x13'),_0x4181('0x14'),_0x4181('0x15'),_0x4181('0x16'),_0x4181('0x17'),_0x4181('0x18'),_0x4181('0x19'),_0x4181('0x1a'),_0x4181('0x1b'),_0x4181('0x1c'),_0x4181('0x1d'),_0x4181('0x1e'),_0x4181('0x1f'),_0x4181('0x20'),_0x4181('0x21'),'dialAMDSilenceThreshold',_0x4181('0x22'),_0x4181('0x23'),_0x4181('0x24'),_0x4181('0x25'),_0x4181('0x26'),'dialAgiAfterHangupAgent',_0x4181('0x27'),_0x4181('0x28'),'monitor_format',_0x4181('0x29'),_0x4181('0x2a'),_0x4181('0x2b'),_0x4181('0x2c'),'dialNoSuchNumberRetryFrequency',_0x4181('0x2d'),'dialDropRetryFrequency',_0x4181('0x2e'),_0x4181('0x2f'),_0x4181('0x30'),_0x4181('0x31'),'dialAgentRejectMaxRetry',_0x4181('0x32'),_0x4181('0x33'),_0x4181('0x34'),_0x4181('0x35')],'include':[{'model':'Trunk','as':_0x4181('0x36'),'attributes':['id','name',_0x4181('0x37'),'active']},{'model':_0x4181('0x38'),'as':'mandatoryDispositionPause','attributes':['id',_0x4181('0x39')]},{'model':_0x4181('0x36'),'as':_0x4181('0x3a'),'attributes':['id',_0x4181('0x39'),_0x4181('0x37'),'active']},{'model':'Interval','as':'Interval','attributes':['id',_0x4181('0x39')],'include':[{'model':'Interval','as':_0x4181('0x3b'),'attributes':['id','name',_0x4181('0x3c')]}]}]},'log':_0x4181('0x1')});};}; \ No newline at end of file +var _0x16bc=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','TrunkBackup','Interval','Intervals','interval','../client','Request','acw','acwTimeout','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x16bc,0x11e));var _0xc16b=function(_0x319855,_0x55a20d){_0x319855=_0x319855-0x0;var _0xfb7f50=_0x16bc[_0x319855];return _0xfb7f50;};'use strict';var client=require(_0xc16b('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xc16b('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0xc16b('0x2'),_0xc16b('0x3'),'autopause',_0xc16b('0x4'),_0xc16b('0x5'),'dialActive',_0xc16b('0x6'),_0xc16b('0x7'),_0xc16b('0x8'),_0xc16b('0x9'),_0xc16b('0xa'),_0xc16b('0xb'),_0xc16b('0xc'),'dialOriginateCallerIdName',_0xc16b('0xd'),_0xc16b('0xe'),_0xc16b('0xf'),_0xc16b('0x10'),_0xc16b('0x11'),_0xc16b('0x12'),_0xc16b('0x13'),_0xc16b('0x14'),_0xc16b('0x15'),_0xc16b('0x16'),_0xc16b('0x17'),'dialGlobalMaxRetry','dialTimezone',_0xc16b('0x18'),_0xc16b('0x19'),'dialCheckDuplicateType',_0xc16b('0x1a'),_0xc16b('0x1b'),_0xc16b('0x1c'),_0xc16b('0x1d'),'dialAMDTotalAnalysisTime',_0xc16b('0x1e'),_0xc16b('0x1f'),_0xc16b('0x20'),_0xc16b('0x21'),'dialAMDMaximumWordLength',_0xc16b('0x22'),_0xc16b('0x23'),'dialRecallInQueue',_0xc16b('0x24'),_0xc16b('0x25'),_0xc16b('0x26'),_0xc16b('0x27'),_0xc16b('0x4'),'strategy','dialRandomLastDigitCallerIdNumber',_0xc16b('0x28'),_0xc16b('0x29'),_0xc16b('0x2a'),_0xc16b('0x2b'),_0xc16b('0x2c'),_0xc16b('0x2d'),_0xc16b('0x2e'),_0xc16b('0x2f'),_0xc16b('0x30'),_0xc16b('0x31'),_0xc16b('0x32'),'mandatoryDisposition',_0xc16b('0x33'),_0xc16b('0x34')],'include':[{'model':_0xc16b('0x35'),'as':_0xc16b('0x35'),'attributes':['id',_0xc16b('0x36'),_0xc16b('0x37'),_0xc16b('0x38')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0xc16b('0x36')]},{'model':_0xc16b('0x35'),'as':_0xc16b('0x39'),'attributes':['id',_0xc16b('0x36'),'callerid',_0xc16b('0x38')]},{'model':_0xc16b('0x3a'),'as':_0xc16b('0x3a'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xc16b('0x3b'),'attributes':['id','name',_0xc16b('0x3c')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f9d0131..be67c31 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 _0xa66b=['lodash','../client','create','Request','CreateVoiceQueueReport','GetVoiceQueueReport','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','moment'];(function(_0x1fc41f,_0xa4e0a9){var _0x32600d=function(_0x2358bf){while(--_0x2358bf){_0x1fc41f['push'](_0x1fc41f['shift']());}};_0x32600d(++_0xa4e0a9);}(_0xa66b,0x68));var _0xba66=function(_0x28d225,_0x43be18){_0x28d225=_0x28d225-0x0;var _0x1f79e1=_0xa66b[_0x28d225];return _0x1f79e1;};'use strict';var moment=require(_0xba66('0x0'));var _=require(_0xba66('0x1'));var client=require(_0xba66('0x2'));exports[_0xba66('0x3')]=function(_0x3a9c80){return client[_0xba66('0x4')](_0xba66('0x5'),{'body':_0x3a9c80,'log':_0xba66('0x5')});};exports['getVoiceQueueReports']=function(){return function(){return client['Request'](_0xba66('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xba66('0x7')](_0xba66('0x8'))[_0xba66('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xba66('0xa')](_0xba66('0x8'))[_0xba66('0x9')](_0xba66('0xb'))]}},'attributes':['uniqueid',_0xba66('0xc'),_0xba66('0xd'),_0xba66('0xe'),_0xba66('0xf'),_0xba66('0x10'),_0xba66('0x11'),_0xba66('0x12'),_0xba66('0x13'),_0xba66('0x14')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xc8a4=['endOf','YYYY-MM-DD\x20HH:mm:ss','queue','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','day','format'];(function(_0x1bda1f,_0x7361c1){var _0xabb9e3=function(_0x240b8b){while(--_0x240b8b){_0x1bda1f['push'](_0x1bda1f['shift']());}};_0xabb9e3(++_0x7361c1);}(_0xc8a4,0x99));var _0x4c8a=function(_0xfb1cea,_0x38ca21){_0xfb1cea=_0xfb1cea-0x0;var _0x3c7c26=_0xc8a4[_0xfb1cea];return _0x3c7c26;};'use strict';var moment=require(_0x4c8a('0x0'));var _=require(_0x4c8a('0x1'));var client=require(_0x4c8a('0x2'));exports[_0x4c8a('0x3')]=function(_0x586237){return client[_0x4c8a('0x4')](_0x4c8a('0x5'),{'body':_0x586237,'log':_0x4c8a('0x5')});};exports[_0x4c8a('0x6')]=function(){return function(){return client[_0x4c8a('0x4')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x4c8a('0x7'))[_0x4c8a('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x4c8a('0x9')](_0x4c8a('0x7'))['format'](_0x4c8a('0xa'))]}},'attributes':['uniqueid',_0x4c8a('0xb'),_0x4c8a('0xc'),'queuecallerleaveAt',_0x4c8a('0xd'),_0x4c8a('0xe'),_0x4c8a('0xf'),_0x4c8a('0x10'),_0x4c8a('0x11'),'queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 2e97ee9..ff74946 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 _0xf774=['Request','../client'];(function(_0x106f05,_0x1eed65){var _0x5081f1=function(_0x5d8a8f){while(--_0x5d8a8f){_0x106f05['push'](_0x106f05['shift']());}};_0x5081f1(++_0x1eed65);}(_0xf774,0x15d));var _0x4f77=function(_0x563508,_0x54e679){_0x563508=_0x563508-0x0;var _0x25439e=_0xf774[_0x563508];return _0x25439e;};'use strict';var client=require(_0x4f77('0x0'));exports['getVoiceQueueRtPauses']=function(_0x111d08){return function(){return client[_0x4f77('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x111d08,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xc8c9=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x48faec,_0x4ebc60){var _0xb8370e=function(_0x2d7595){while(--_0x2d7595){_0x48faec['push'](_0x48faec['shift']());}};_0xb8370e(++_0x4ebc60);}(_0xc8c9,0x176));var _0x9c8c=function(_0x1fcf1b,_0x214549){_0x1fcf1b=_0x1fcf1b-0x0;var _0x5d2952=_0xc8c9[_0x1fcf1b];return _0x5d2952;};'use strict';var client=require(_0x9c8c('0x0'));exports[_0x9c8c('0x1')]=function(_0x2c873d){return function(){return client[_0x9c8c('0x2')](_0x9c8c('0x3'),{'options':{'where':{'VoiceQueueId':_0x2c873d,'paused':!![]},'raw':!![]},'log':_0x9c8c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 09ae086..29a53a2 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 _0x1d13=['CreateVoiceRecording','monitorFilename','lodash'];(function(_0x21fc76,_0x5ba9a0){var _0x4a579b=function(_0x2ce02f){while(--_0x2ce02f){_0x21fc76['push'](_0x21fc76['shift']());}};_0x4a579b(++_0x5ba9a0);}(_0x1d13,0xe6));var _0x31d1=function(_0x13e914,_0x25a3c3){_0x13e914=_0x13e914-0x0;var _0x32b3be=_0x1d13[_0x13e914];return _0x32b3be;};'use strict';var _=require(_0x31d1('0x0'));var client=require('../client');exports['create']=function(_0x57082d){return client['Request'](_0x31d1('0x1'),{'body':_['merge'](_0x57082d,{'value':_0x57082d[_0x31d1('0x2')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0x2434=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x2e36f6,_0x518b63){var _0x3a68e2=function(_0x4b8c4f){while(--_0x4b8c4f){_0x2e36f6['push'](_0x2e36f6['shift']());}};_0x3a68e2(++_0x518b63);}(_0x2434,0x81));var _0x4243=function(_0x3018d4,_0x5863e2){_0x3018d4=_0x3018d4-0x0;var _0xa677b5=_0x2434[_0x3018d4];return _0xa677b5;};'use strict';var _=require(_0x4243('0x0'));var client=require(_0x4243('0x1'));exports[_0x4243('0x2')]=function(_0x44a776){return client['Request'](_0x4243('0x3'),{'body':_[_0x4243('0x4')](_0x44a776,{'value':_0x44a776[_0x4243('0x5')]}),'log':_0x4243('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 351fe2a..896aa69 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 _0x7191=['secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','blindTransfer','Request','CreateVoiceTransferReport','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x10d44a,_0x4a421a){var _0x199e2b=function(_0x411637){while(--_0x411637){_0x10d44a['push'](_0x10d44a['shift']());}};_0x199e2b(++_0x4a421a);}(_0x7191,0x160));var _0x1719=function(_0x4bf885,_0x3b0f7a){_0x4bf885=_0x4bf885-0x0;var _0x462f25=_0x7191[_0x4bf885];return _0x462f25;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x1719('0x0')]=function(_0x3feeb9){return client[_0x1719('0x1')](_0x1719('0x2'),{'body':{'result':_0x3feeb9['result'],'transfererchannel':_0x3feeb9['transfererchannel'],'transferercalleridnum':_0x3feeb9[_0x1719('0x3')],'transferercalleridname':_0x3feeb9[_0x1719('0x4')],'transfererconnectedlinenum':_0x3feeb9[_0x1719('0x5')],'transfererconnectedlinename':_0x3feeb9[_0x1719('0x6')],'transfereraccountcode':_0x3feeb9[_0x1719('0x7')],'transferercontext':_0x3feeb9[_0x1719('0x8')],'transfererexten':_0x3feeb9[_0x1719('0x9')],'transfererlinkedid':_0x3feeb9[_0x1719('0xa')],'transfereechannel':_0x3feeb9[_0x1719('0xb')],'transfereecalleridnum':_0x3feeb9[_0x1719('0xc')],'transfereecalleridname':_0x3feeb9['transfereecalleridname'],'transfereeconnectedlinenum':_0x3feeb9[_0x1719('0xd')],'transfereeconnectedlinename':_0x3feeb9[_0x1719('0xe')],'transfereeaccountcode':_0x3feeb9[_0x1719('0xf')],'transfereecontext':_0x3feeb9['transfereecontext'],'transfereeexten':_0x3feeb9['transfereeexten'],'transfereelinkedid':_0x3feeb9[_0x1719('0x10')],'isexternal':_0x3feeb9[_0x1719('0x11')],'context':_0x3feeb9[_0x1719('0x12')],'extension':_0x3feeb9[_0x1719('0x13')],'type':'blind'},'log':_0x1719('0x2')});};exports[_0x1719('0x14')]=function(_0xdffad1){return client['Request'](_0x1719('0x2'),{'body':{'result':_0xdffad1[_0x1719('0x15')],'transfererchannel':_0xdffad1[_0x1719('0x16')],'transferercalleridnum':_0xdffad1[_0x1719('0x17')],'transferercalleridname':_0xdffad1[_0x1719('0x18')],'transfererconnectedlinenum':_0xdffad1[_0x1719('0x19')],'transfererconnectedlinename':_0xdffad1[_0x1719('0x1a')],'transfereraccountcode':_0xdffad1[_0x1719('0x1b')],'transferercontext':_0xdffad1['secondtransferercontext'],'transfererexten':_0xdffad1[_0x1719('0x1c')],'transfererlinkedid':_0xdffad1[_0x1719('0x1d')],'transfereechannel':_0xdffad1[_0x1719('0x1e')],'transfereecalleridnum':_0xdffad1[_0x1719('0x1f')],'transfereecalleridname':_0xdffad1['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xdffad1['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xdffad1[_0x1719('0x20')],'transfereeaccountcode':_0xdffad1['transfertargetaccountcode'],'transfereecontext':_0xdffad1[_0x1719('0x21')],'transfereeexten':_0xdffad1[_0x1719('0x22')],'transfereelinkedid':_0xdffad1[_0x1719('0x23')],'isexternal':_0xdffad1['isexternal'],'context':_0xdffad1['origtransferercontext'],'extension':_0xdffad1[_0x1719('0x24')],'type':_0x1719('0x25')},'log':_0x1719('0x2')});}; \ No newline at end of file +var _0xad14=['transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext'];(function(_0x3dfbb3,_0x2f0680){var _0x62d3bb=function(_0x194a9b){while(--_0x194a9b){_0x3dfbb3['push'](_0x3dfbb3['shift']());}};_0x62d3bb(++_0x2f0680);}(_0xad14,0x123));var _0x4ad1=function(_0x362ad7,_0x948800){_0x362ad7=_0x362ad7-0x0;var _0x54703b=_0xad14[_0x362ad7];return _0x54703b;};'use strict';var client=require(_0x4ad1('0x0'));exports[_0x4ad1('0x1')]={};exports[_0x4ad1('0x2')]=function(_0x57e37d){return client[_0x4ad1('0x3')](_0x4ad1('0x4'),{'body':{'result':_0x57e37d[_0x4ad1('0x5')],'transfererchannel':_0x57e37d[_0x4ad1('0x6')],'transferercalleridnum':_0x57e37d['transferercalleridnum'],'transferercalleridname':_0x57e37d['transferercalleridname'],'transfererconnectedlinenum':_0x57e37d[_0x4ad1('0x7')],'transfererconnectedlinename':_0x57e37d[_0x4ad1('0x8')],'transfereraccountcode':_0x57e37d[_0x4ad1('0x9')],'transferercontext':_0x57e37d[_0x4ad1('0xa')],'transfererexten':_0x57e37d['transfererexten'],'transfererlinkedid':_0x57e37d['transfererlinkedid'],'transfereechannel':_0x57e37d['transfereechannel'],'transfereecalleridnum':_0x57e37d[_0x4ad1('0xb')],'transfereecalleridname':_0x57e37d[_0x4ad1('0xc')],'transfereeconnectedlinenum':_0x57e37d[_0x4ad1('0xd')],'transfereeconnectedlinename':_0x57e37d['transfereeconnectedlinename'],'transfereeaccountcode':_0x57e37d[_0x4ad1('0xe')],'transfereecontext':_0x57e37d['transfereecontext'],'transfereeexten':_0x57e37d[_0x4ad1('0xf')],'transfereelinkedid':_0x57e37d[_0x4ad1('0x10')],'isexternal':_0x57e37d[_0x4ad1('0x11')],'context':_0x57e37d['context'],'extension':_0x57e37d[_0x4ad1('0x12')],'type':_0x4ad1('0x13')},'log':_0x4ad1('0x4')});};exports[_0x4ad1('0x14')]=function(_0x3ee34e){return client[_0x4ad1('0x3')](_0x4ad1('0x4'),{'body':{'result':_0x3ee34e['result'],'transfererchannel':_0x3ee34e['origtransfererchannel'],'transferercalleridnum':_0x3ee34e[_0x4ad1('0x15')],'transferercalleridname':_0x3ee34e[_0x4ad1('0x16')],'transfererconnectedlinenum':_0x3ee34e[_0x4ad1('0x17')],'transfererconnectedlinename':_0x3ee34e['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3ee34e[_0x4ad1('0x18')],'transferercontext':_0x3ee34e['secondtransferercontext'],'transfererexten':_0x3ee34e[_0x4ad1('0x19')],'transfererlinkedid':_0x3ee34e[_0x4ad1('0x1a')],'transfereechannel':_0x3ee34e[_0x4ad1('0x1b')],'transfereecalleridnum':_0x3ee34e[_0x4ad1('0x1c')],'transfereecalleridname':_0x3ee34e[_0x4ad1('0x1d')],'transfereeconnectedlinenum':_0x3ee34e[_0x4ad1('0x1e')],'transfereeconnectedlinename':_0x3ee34e['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3ee34e[_0x4ad1('0x1f')],'transfereecontext':_0x3ee34e[_0x4ad1('0x20')],'transfereeexten':_0x3ee34e['transfertargetexten'],'transfereelinkedid':_0x3ee34e[_0x4ad1('0x21')],'isexternal':_0x3ee34e['isexternal'],'context':_0x3ee34e[_0x4ad1('0x22')],'extension':_0x3ee34e['origtransfererexten'],'type':_0x4ad1('0x23')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 7e890ea..c9cbde6 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 _0x3a75=['pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','values','channels','username','uniqueid','channel','%s.%s','filename','MixMonitor','ai(mixmonitorid)','then','find','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','wav','stop','StopMixMonitor\x20Success','voicequeuechannelhangup','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','ami\x20disconnected','join','module','action','Reload','message','catch','error','pick','command','Command','Action','voiceQueues','hasOwnProperty','available','loggedIn'];(function(_0xf89d02,_0x5197c9){var _0x2bf516=function(_0x33e0a6){while(--_0x33e0a6){_0xf89d02['push'](_0xf89d02['shift']());}};_0x2bf516(++_0x5197c9);}(_0x3a75,0x66));var _0x53a7=function(_0x3b65a4,_0xfb86df){_0x3b65a4=_0x3b65a4-0x0;var _0x589cec=_0x3a75[_0x3b65a4];return _0x589cec;};'use strict';var _=require(_0x53a7('0x0'));var util=require(_0x53a7('0x1'));var jayson=require('jayson/promise');var schema=require(_0x53a7('0x2'));var BPromise=require(_0x53a7('0x3'));var moment=require(_0x53a7('0x4'));var config=require(_0x53a7('0x5'));var properties=require(_0x53a7('0x6'));var ami=require(_0x53a7('0x7'));exports[_0x53a7('0x8')]=function(_0x9d9eb8,_0x3a13e6,_0x577f37){return new BPromise(function(_0x3b1ac2,_0x71b464){var _0x1ccfc0={'QueuePause':function(_0x18b68e){return new Promise(function(_0xd007c2,_0x2302c4){var _0x4f8938=util[_0x53a7('0x9')](_0x53a7('0xa'),'SIP',_0x18b68e[_0x53a7('0xb')]);if(_0x9d9eb8[_0x53a7('0xc')]&&_0x9d9eb8['timers'][_0x4f8938]&&_0x9d9eb8[_0x53a7('0xc')][_0x4f8938][_0x53a7('0xd')]){_0x9d9eb8[_0x53a7('0xc')][_0x4f8938][_0x53a7('0xe')]();}if(_0x9d9eb8[_0x53a7('0xf')][_0x4f8938]){_0x9d9eb8[_0x53a7('0xf')][_0x4f8938][_0x53a7('0x10')]({'statePause':_0x18b68e[_0x53a7('0x11')]?!![]:![]});}_0xd007c2({'code':0xc8,'message':_0x53a7('0x12')});});},'Reload':function(_0x522161){var _0x53d63a=this;return new Promise(function(_0x518178,_0x4bfa82){if(ami[_0x53a7('0x13')]()==![]){return _0x4bfa82(_0x53d63a['error'](0x1f4,[config[_0x53a7('0x14')]['ip'],config[_0x53a7('0x14')]['username'],_0x53a7('0x15')][_0x53a7('0x16')]('\x20')));}_0x522161=_['pick'](_0x522161,_['keys'](properties[_0x53a7('0x17')]));_0x522161[_0x53a7('0x18')]=_0x53a7('0x19');return ami['Action'](_0x522161)['then'](function(_0x536725){_0x518178({'code':0xc8,'message':_0x536725[_0x53a7('0x1a')]});})[_0x53a7('0x1b')](function(_0xd03ca2){_0x4bfa82(_0x53d63a[_0x53a7('0x1c')](0x1f5,_0xd03ca2[_0x53a7('0x1a')]));});});},'Command':function(_0x41dc8b){var _0x5cd317=this;return new Promise(function(_0x515d65,_0x36a00b){if(ami[_0x53a7('0x13')]()==![]){return _0x36a00b(_0x5cd317[_0x53a7('0x1c')](0x1f4,[config[_0x53a7('0x14')]['ip'],config[_0x53a7('0x14')]['username'],'ami\x20disconnected']['join']('\x20')));}_0x41dc8b=_[_0x53a7('0x1d')](_0x41dc8b,_0x53a7('0x1e'));_0x41dc8b['action']=_0x53a7('0x1f');return ami[_0x53a7('0x20')](_0x41dc8b)['then'](function(_0xacf7e9){_0x515d65({'code':0xc8,'message':_0xacf7e9['content']});})['catch'](function(_0x4eba26){_0x36a00b(_0x5cd317[_0x53a7('0x1c')](0x1f5,_0x4eba26[_0x53a7('0x1a')]));});});},'VoiceQueues':function(_0x5997d7){return new Promise(function(_0x2e42cc,_0x508eb3){var _0x4802f2=[];for(var _0x1ce1b9 in _0x9d9eb8['voiceQueues']){if(_0x9d9eb8[_0x53a7('0x21')][_0x53a7('0x22')](_0x1ce1b9)){var _0x2673e4=_0x9d9eb8[_0x53a7('0x21')][_0x1ce1b9];var _0x47dfd1={'id':_0x2673e4['id'],'name':_0x2673e4[_0x53a7('0xb')],'strategy':_0x2673e4['strategy'],'answered':_0x2673e4['answered'],'available':_0x2673e4[_0x53a7('0x23')],'loggedIn':_0x2673e4[_0x53a7('0x24')],'pTalking':_0x2673e4[_0x53a7('0x25')],'sumBillable':_0x2673e4[_0x53a7('0x26')],'sumDuration':_0x2673e4[_0x53a7('0x27')],'sumHoldTime':_0x2673e4[_0x53a7('0x28')]||0x0,'talking':_0x2673e4[_0x53a7('0x29')],'total':_0x2673e4[_0x53a7('0x2a')],'type':_0x2673e4[_0x53a7('0x2b')],'unmanaged':_0x2673e4['unmanaged'],'abandoned':_0x2673e4[_0x53a7('0x2c')],'waiting':_0x2673e4[_0x53a7('0x2d')],'loggedInDb':_0x2673e4[_0x53a7('0x2e')]};if(_0x2673e4[_0x53a7('0x2b')]===_0x53a7('0x2f')){_0x47dfd1['dialActive']=_0x2673e4[_0x53a7('0x30')];_0x47dfd1['dialMethod']=_0x2673e4[_0x53a7('0x31')];_0x47dfd1[_0x53a7('0x32')]=_0x2673e4['dialOriginateCallerIdName'];_0x47dfd1[_0x53a7('0x33')]=_0x2673e4[_0x53a7('0x33')];_0x47dfd1[_0x53a7('0x34')]=_0x2673e4[_0x53a7('0x34')];_0x47dfd1[_0x53a7('0x35')]=_0x2673e4[_0x53a7('0x35')];_0x47dfd1['outboundAnswerAgiCallsDay']=_0x2673e4[_0x53a7('0x36')];_0x47dfd1[_0x53a7('0x37')]=_0x2673e4[_0x53a7('0x37')];_0x47dfd1[_0x53a7('0x38')]=_0x2673e4[_0x53a7('0x38')];_0x47dfd1[_0x53a7('0x39')]=_0x2673e4['outboundBusyCallsDay'];_0x47dfd1[_0x53a7('0x3a')]=_0x2673e4['outboundCongestionCallsDay'];_0x47dfd1[_0x53a7('0x3b')]=_0x2673e4['outboundDropCallsDayACS'];_0x47dfd1[_0x53a7('0x3c')]=_0x2673e4['outboundDropCallsDayCallersExit'];_0x47dfd1['outboundDropCallsDayTimeout']=_0x2673e4['outboundDropCallsDayTimeout'];_0x47dfd1['outboundNoAnswerCallsDay']=_0x2673e4[_0x53a7('0x3d')];_0x47dfd1[_0x53a7('0x3e')]=_0x2673e4[_0x53a7('0x3e')];_0x47dfd1[_0x53a7('0x3f')]=_0x2673e4[_0x53a7('0x3f')];_0x47dfd1['outboundReCallsDay']=_0x2673e4[_0x53a7('0x40')];_0x47dfd1[_0x53a7('0x41')]=_0x2673e4[_0x53a7('0x41')];_0x47dfd1[_0x53a7('0x42')]=_0x2673e4[_0x53a7('0x42')];_0x47dfd1['predictiveIntervalAnsweredCalls']=_0x2673e4[_0x53a7('0x43')];_0x47dfd1[_0x53a7('0x44')]=_0x2673e4[_0x53a7('0x44')];_0x47dfd1[_0x53a7('0x45')]=_0x2673e4[_0x53a7('0x45')];_0x47dfd1[_0x53a7('0x46')]=_0x2673e4['predictiveIntervalDroppedCallsCallersExit'];_0x47dfd1[_0x53a7('0x47')]=_0x2673e4[_0x53a7('0x47')];_0x47dfd1[_0x53a7('0x48')]=_0x2673e4[_0x53a7('0x48')];_0x47dfd1['predictiveIntervalErlangCallsDroppedCalls']=_0x2673e4[_0x53a7('0x49')];_0x47dfd1['predictiveIntervalHitRate']=_0x2673e4['predictiveIntervalHitRate'];_0x47dfd1[_0x53a7('0x4a')]=_0x2673e4[_0x53a7('0x4a')];_0x47dfd1[_0x53a7('0x4b')]=_0x2673e4[_0x53a7('0x4b')];_0x47dfd1[_0x53a7('0x4c')]=_0x2673e4['predictiveIntervalAvailable'];_0x47dfd1[_0x53a7('0x4d')]=_0x2673e4[_0x53a7('0x4d')];_0x47dfd1[_0x53a7('0x1a')]=_0x2673e4[_0x53a7('0x1a')];_0x47dfd1['originated']=_0x2673e4[_0x53a7('0x4e')];_0x47dfd1[_0x53a7('0x4f')]=_0x2673e4[_0x53a7('0x4f')];_0x47dfd1[_0x53a7('0x50')]=_0x2673e4[_0x53a7('0x50')];_0x47dfd1[_0x53a7('0x51')]=_0x2673e4['erlangAbandonmentRate'];_0x47dfd1['erlangBusyFactor']=_0x2673e4['erlangBusyFactor'];_0x47dfd1[_0x53a7('0x52')]=_0x2673e4['startPredictive'];_0x47dfd1['startProgressive']=_0x2673e4[_0x53a7('0x53')];}if(_0x2673e4[_0x53a7('0x54')]){_0x47dfd1['Trunk']={'id':_0x2673e4[_0x53a7('0x54')]['id'],'name':_0x2673e4[_0x53a7('0x54')][_0x53a7('0xb')],'active':_0x2673e4[_0x53a7('0x54')]['active'],'callerid':_0x2673e4[_0x53a7('0x54')][_0x53a7('0x55')]};}if(_0x2673e4['Interval']){_0x47dfd1['Interval']={'id':_0x2673e4[_0x53a7('0x56')]['id'],'name':_0x2673e4[_0x53a7('0x56')][_0x53a7('0xb')]};}_0x4802f2[_0x53a7('0x57')](_0x47dfd1);}}_0x2e42cc({'count':_0x4802f2[_0x53a7('0x58')],'rows':_0x4802f2});});},'VoiceChannels':function(_0x5a5634){return new Promise(function(_0x23f1e9,_0x285a8c){var _0x13c148=_[_0x53a7('0x59')](_0x9d9eb8[_0x53a7('0x5a')]);_0x23f1e9({'count':_0x13c148[_0x53a7('0x58')],'rows':_0x13c148});});},'VoiceChannelMixMonitor':function(_0x542f1e){var _0x3af95a=this;return new Promise(function(_0x2d43f7,_0x4e71c2){if(ami[_0x53a7('0x13')]()==![]){return _0x4e71c2(_0x3af95a[_0x53a7('0x1c')](0x1f4,[config[_0x53a7('0x14')]['ip'],config[_0x53a7('0x14')][_0x53a7('0x5b')],_0x53a7('0x15')]['join']('\x20')));}var _0x4757da=schema(properties['voicechannel'])[_0x53a7('0x2')](_0x542f1e);if(_0x4757da[_0x53a7('0x58')]>0x0){return _0x4e71c2(_0x3af95a[_0x53a7('0x1c')](0x1f4,_['map'](_0x4757da,'message')[_0x53a7('0x16')](',\x20')));}var _0x408d05=_['find'](_0x9d9eb8[_0x53a7('0x5a')],{'uniqueid':_0x542f1e[_0x53a7('0x5c')]});if(_0x408d05&&_0x408d05[_0x53a7('0x5d')]){var _0x2105f5=util[_0x53a7('0x9')](_0x53a7('0x5e'),_0x542f1e[_0x53a7('0x5f')]||_0x542f1e[_0x53a7('0x5c')],_0x542f1e[_0x53a7('0x9')]||'wav');return ami[_0x53a7('0x20')]({'action':_0x53a7('0x60'),'channel':_0x408d05[_0x53a7('0x5d')],'file':_0x2105f5,'options':_0x53a7('0x61')})[_0x53a7('0x62')](function(_0x10f31c){var _0x1c1758=_[_0x53a7('0x63')](_0x408d05['monitors'],{'filename':_0x53a7('0x64')+_0x2105f5[_0x53a7('0x65')]()});if(_[_0x53a7('0x66')](_0x1c1758)){_0x408d05[_0x53a7('0x67')][_0x53a7('0x57')]({'filename':'/var/spool/asterisk/monitor/'+_0x2105f5['toLowerCase'](),'createdAt':moment()[_0x53a7('0x9')](_0x53a7('0x68')),'mixmonitorid':_0x10f31c[_0x53a7('0x69')],'status':_0x53a7('0x6a')});}else{_0x1c1758[_0x53a7('0x69')]=_0x10f31c[_0x53a7('0x69')];_0x1c1758[_0x53a7('0x6b')]=_0x53a7('0x6a');}_0x2d43f7({'code':0xc8,'message':[_0x542f1e[_0x53a7('0x5c')],_0x53a7('0x6c'),_0x10f31c[_0x53a7('0x69')]][_0x53a7('0x16')]('\x20'),'mixmonitorid':_0x10f31c[_0x53a7('0x69')]});})[_0x53a7('0x1b')](function(_0xc85e29){_0x4e71c2(_0x3af95a[_0x53a7('0x1c')](0x1f5,[_0x542f1e[_0x53a7('0x5c')],_0xc85e29[_0x53a7('0x1a')]['toLowerCase']()][_0x53a7('0x16')]('\x20')));});}else{return _0x4e71c2(_0x3af95a[_0x53a7('0x1c')](0x1f5,_0x53a7('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x35a39d){var _0x2fa260=this;return new Promise(function(_0x256390,_0x4d5479){if(ami['isConnected']()==![]){return _0x4d5479(_0x2fa260['error'](0x1f4,[config[_0x53a7('0x14')]['ip'],config[_0x53a7('0x14')][_0x53a7('0x5b')],_0x53a7('0x15')][_0x53a7('0x16')]('\x20')));}var _0x2727bc=schema(properties['voicechannel'])['validate'](_0x35a39d);if(_0x2727bc[_0x53a7('0x58')]>0x0){return _0x4d5479(_0x2fa260[_0x53a7('0x1c')](0x1f4,_[_0x53a7('0x6e')](_0x2727bc,_0x53a7('0x1a'))[_0x53a7('0x16')](',\x20')));}var _0x410bb7=_['find'](_0x9d9eb8[_0x53a7('0x5a')],{'uniqueid':_0x35a39d[_0x53a7('0x5c')]});if(_0x410bb7){return BPromise[_0x53a7('0x6f')]()[_0x53a7('0x62')](function(){if(_0x410bb7[_0x53a7('0x5d')]){return ami[_0x53a7('0x20')]({'action':_0x53a7('0x70'),'channel':_0x410bb7[_0x53a7('0x5d')],'mixmonitorid':_0x35a39d['mixmonitorid']})['catch'](function(_0x55dd5e){});}})[_0x53a7('0x62')](function(){if(_0x410bb7[_0x53a7('0x71')]){return ami['Action']({'action':_0x53a7('0x70'),'channel':_0x410bb7[_0x53a7('0x71')],'mixmonitorid':_0x35a39d[_0x53a7('0x69')]})[_0x53a7('0x1b')](function(_0x35929f){});}})['then'](function(_0x363012){var _0x2835cb=_[_0x53a7('0x63')](_0x410bb7[_0x53a7('0x67')],{'mixmonitorid':_0x35a39d[_0x53a7('0x69')]});if(_0x2835cb){_0x2835cb[_0x53a7('0x6b')]='stop';}})['then'](function(){var _0x3d548b=util['format'](_0x53a7('0x5e'),_0x35a39d[_0x53a7('0x5f')]||_0x35a39d[_0x53a7('0x5c')],_0x35a39d['format']||_0x53a7('0x72'));var _0x57aa40=_[_0x53a7('0x63')](_0x410bb7[_0x53a7('0x67')],{'filename':'/var/spool/asterisk/monitor/'+_0x3d548b['toLowerCase']()});if(_0x57aa40){_0x57aa40[_0x53a7('0x6b')]=_0x53a7('0x73');}})[_0x53a7('0x62')](function(){_0x256390({'code':0xc8,'message':[_0x35a39d[_0x53a7('0x5c')],_0x53a7('0x74')]['join']('\x20')});})['catch'](function(_0x437d58){_0x4d5479(_0x2fa260[_0x53a7('0x1c')](0x1f5,[_0x35a39d[_0x53a7('0x5c')],_0x437d58['message'][_0x53a7('0x65')]()][_0x53a7('0x16')]('\x20')));});}else{return _0x4d5479(_0x2fa260[_0x53a7('0x1c')](0x1f5,_0x53a7('0x6d')));}});},'VoiceQueuesChannels':function(_0xdd92b2){return new Promise(function(_0x37d28b,_0x510bb1){var _0x1dcdb5=_['values'](_0x9d9eb8['queueChannels']);_0x37d28b({'count':_0x1dcdb5['length'],'rows':_0x1dcdb5});});},'VoiceQueuesChannel':function(_0x3bdfaa){var _0x23d5f2=this;return new Promise(function(_0x1c5ed1,_0x2482ed){var _0x4198b2=schema(properties['voicequeuechannel'])['validate'](_0x3bdfaa);if(_0x4198b2['length']>0x0){return _0x2482ed(_0x23d5f2[_0x53a7('0x1c')](0x1f4,_[_0x53a7('0x6e')](_0x4198b2,_0x53a7('0x1a'))['join'](',\x20')));}var _0x30bf83=_[_0x53a7('0x63')](_0x9d9eb8['queueChannels'],{'uniqueid':_0x3bdfaa[_0x53a7('0x5c')]});if(_0x30bf83){_0x1c5ed1(_0x30bf83);}else{return _0x2482ed(_0x23d5f2[_0x53a7('0x1c')](0x1f5,_0x53a7('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x320f07){var _0x921600=this;return new Promise(function(_0x192de1,_0x302efa){if(ami[_0x53a7('0x13')]()==![]){return _0x302efa(_0x921600[_0x53a7('0x1c')](0x1f4,[config[_0x53a7('0x14')]['ip'],config[_0x53a7('0x14')][_0x53a7('0x5b')],_0x53a7('0x15')][_0x53a7('0x16')]('\x20')));}var _0x4c807a=schema(properties[_0x53a7('0x75')])['validate'](_0x320f07);if(_0x4c807a[_0x53a7('0x58')]>0x0){return _0x302efa(_0x921600[_0x53a7('0x1c')](0x1f4,_[_0x53a7('0x6e')](_0x4c807a,_0x53a7('0x1a'))['join'](',\x20')));}var _0x380c38=_['find'](_0x9d9eb8[_0x53a7('0x76')],{'uniqueid':_0x320f07[_0x53a7('0x5c')]});if(_0x380c38&&_0x380c38[_0x53a7('0x5d')]){return ami['Action']({'action':_0x53a7('0x77'),'channel':_0x380c38[_0x53a7('0x5d')]})[_0x53a7('0x62')](function(_0x2dfd46){_0x192de1({'code':0xc8,'message':[_0x320f07[_0x53a7('0x5c')],_0x2dfd46['message']['toLowerCase']()][_0x53a7('0x16')]('\x20')});})[_0x53a7('0x1b')](function(_0x3bce14){_0x302efa(_0x921600[_0x53a7('0x1c')](0x1f5,[_0x320f07[_0x53a7('0x5c')],_0x3bce14[_0x53a7('0x1a')][_0x53a7('0x65')]()][_0x53a7('0x16')]('\x20')));});}else{return _0x302efa(_0x921600['error'](0x1f5,_0x53a7('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x53ed81){var _0x5ec220=this;return new Promise(function(_0x426841,_0x5a2caf){if(ami[_0x53a7('0x13')]()==![]){return _0x5a2caf(_0x5ec220[_0x53a7('0x1c')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x53a7('0x15')]['join']('\x20')));}var _0x3cfb9d=schema(properties[_0x53a7('0x78')])[_0x53a7('0x2')](_0x53ed81);if(_0x3cfb9d[_0x53a7('0x58')]>0x0){return _0x5a2caf(_0x5ec220[_0x53a7('0x1c')](0x1f4,_['map'](_0x3cfb9d,_0x53a7('0x1a'))[_0x53a7('0x16')](',\x20')));}var _0x156f3d=_[_0x53a7('0x63')](_0x9d9eb8[_0x53a7('0x76')],{'uniqueid':_0x53ed81[_0x53a7('0x5c')]});if(_0x156f3d&&_0x156f3d[_0x53a7('0x5d')]){return ami[_0x53a7('0x20')]({'action':_0x53a7('0x79'),'channel':_0x156f3d[_0x53a7('0x5d')],'exten':_0x53ed81[_0x53a7('0x7a')],'context':_0x53ed81[_0x53a7('0x7b')]||_0x156f3d[_0x53a7('0x7b')],'priority':0x1})['then'](function(_0x23810e){_0x426841({'code':0xc8,'message':[_0x53ed81[_0x53a7('0x5c')],_0x23810e[_0x53a7('0x1a')]['toLowerCase']()][_0x53a7('0x16')]('\x20')});})[_0x53a7('0x1b')](function(_0x490fff){_0x5a2caf(_0x5ec220['error'](0x1f5,[_0x53ed81[_0x53a7('0x5c')],_0x490fff[_0x53a7('0x1a')]['toLowerCase']()][_0x53a7('0x16')]('\x20')));});}else{return _0x5a2caf(_0x5ec220['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x360c5d){return new Promise(function(_0x22c002,_0x1a5bce){var _0xbe689a=_[_0x53a7('0x59')](_0x9d9eb8['agents']);_0x22c002({'count':_0xbe689a[_0x53a7('0x58')],'rows':_0xbe689a});});},'Telephones':function(_0x238e61){return new Promise(function(_0x3de335,_0xa68d0c){var _0x15b58d=_[_0x53a7('0x59')](_0x9d9eb8[_0x53a7('0x7c')]);_0x3de335({'count':_0x15b58d['length'],'rows':_0x15b58d});});},'Trunks':function(_0x68239c){return new Promise(function(_0x45c144,_0x2b315c){var _0x224241=_[_0x53a7('0x59')](_0x9d9eb8[_0x53a7('0x7d')]);_0x45c144({'count':_0x224241['length'],'rows':_0x224241});});},'OutboundChannels':function(_0x98ea86){return new Promise(function(_0x2da202,_0x12e9d4){var _0x5b461a=_[_0x53a7('0x59')](_0x9d9eb8[_0x53a7('0x7e')]);_0x2da202({'count':_0x5b461a[_0x53a7('0x58')],'rows':_0x5b461a});});},'Outbound':function(_0x37487f){return new Promise(function(_0xf69fa7,_0x4e25f2){_0xf69fa7(_0x9d9eb8[_0x53a7('0x2f')]);});},'Campaigns':function(_0x219cd7){return new Promise(function(_0x177794,_0x342e84){var _0x489581=_[_0x53a7('0x59')](_0x9d9eb8[_0x53a7('0x7f')]);_0x177794({'count':_0x489581['length'],'rows':_0x489581});});},'VoiceQueuesPreview':function(_0x5659e8){var _0x223e67=this;return new Promise(function(_0x326394,_0x37bd44){_0x3a13e6['run'](_0x5659e8['id'])[_0x53a7('0x62')](function(_0x3a8bdb){_0x326394({'code':0xc8,'message':_0x3a8bdb['message']});})[_0x53a7('0x1b')](function(_0x2ccc4f){_0x37bd44(_0x223e67[_0x53a7('0x1c')](0x1f4,_0x2ccc4f[_0x53a7('0x1a')]));});});},'EventManager':function(_0x1c67a6){var _0xa49922=this;return new Promise(function(_0x5787bc,_0x16db74){if(!_0x1c67a6[_0x53a7('0x80')]){return _0x16db74(_0xa49922[_0x53a7('0x1c')](0x1f4,_0x53a7('0x81')));}ami[_0x53a7('0x82')](_0x53a7('0x83')+_0x1c67a6[_0x53a7('0x80')],_0x1c67a6[_0x53a7('0x1a')]);_0x5787bc({'code':0xc8,'message':_0x1c67a6});});},'FaxAccounts':function(_0x273283){return new Promise(function(_0x4d7c12,_0x418b81){var _0x4c1dce=_['values'](_0x9d9eb8[_0x53a7('0x84')]);_0x4d7c12({'count':_0x4c1dce['length'],'rows':_0x4c1dce});});},'SendFax':function(_0x3c25ef){var _0x39a36f=this;return new Promise(function(_0x173828,_0x7eb1cb){_0x577f37[_0x53a7('0x85')](_0x3c25ef)[_0x53a7('0x62')](function(_0x13daff){_0x173828({'code':0xc8,'message':_0x13daff['message']});})[_0x53a7('0x1b')](function(_0x16dad7){_0x7eb1cb(_0x39a36f[_0x53a7('0x1c')](0x1f4,_0x16dad7[_0x53a7('0x1a')]));});});},'CheckAfterSend':function(_0x31e2a8){var _0x24e9ac=this;return new Promise(function(_0xb046fc,_0x1c8ffd){_0x577f37[_0x53a7('0x86')](_0x31e2a8)['then'](function(_0x1ddb46){_0xb046fc({'code':0xc8,'message':_0x1ddb46[_0x53a7('0x1a')]});})[_0x53a7('0x1b')](function(_0x2c42cf){_0x1c8ffd(_0x24e9ac[_0x53a7('0x1c')](0x1f4,_0x2c42cf[_0x53a7('0x1a')]));});});}};var _0x48a8ef=jayson['server'](_0x1ccfc0)['http']();_0x48a8ef['on']('error',function(_0x55798d){return _0x71b464(_0x55798d);});_0x48a8ef[_0x53a7('0x8')](0x232a,_0x53a7('0x87'),function(){console[_0x53a7('0x88')](_0x53a7('0x89'),0x232a);return _0x3b1ac2(_0x53a7('0x8a')+0x232a);});});}; \ No newline at end of file +var _0x5d9e=['outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','channels','username','map','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','values','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','moment','../properties','../ami','listen','format','%s/%s','name','timers','timer','agents','pause','error','asterisk','ami\x20disconnected','join','pick','module','Reload','Action','then','message','isConnected','command','catch','voiceQueues','loggedIn','sumBillable','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x5d9e,0x155));var _0xe5d9=function(_0xb2d06d,_0x452a70){_0xb2d06d=_0xb2d06d-0x0;var _0x88c80c=_0x5d9e[_0xb2d06d];return _0x88c80c;};'use strict';var _=require(_0xe5d9('0x0'));var util=require(_0xe5d9('0x1'));var jayson=require('jayson/promise');var schema=require(_0xe5d9('0x2'));var BPromise=require(_0xe5d9('0x3'));var moment=require(_0xe5d9('0x4'));var config=require('../../../config/environment');var properties=require(_0xe5d9('0x5'));var ami=require(_0xe5d9('0x6'));exports[_0xe5d9('0x7')]=function(_0x3638b6,_0x5430dd,_0x2e22c2){return new BPromise(function(_0x2f914a,_0x16fd72){var _0x2f6085={'QueuePause':function(_0xe9e628){return new Promise(function(_0x519a61,_0x1dc4be){var _0x4271f3=util[_0xe5d9('0x8')](_0xe5d9('0x9'),'SIP',_0xe9e628[_0xe5d9('0xa')]);if(_0x3638b6[_0xe5d9('0xb')]&&_0x3638b6[_0xe5d9('0xb')][_0x4271f3]&&_0x3638b6[_0xe5d9('0xb')][_0x4271f3][_0xe5d9('0xc')]){_0x3638b6[_0xe5d9('0xb')][_0x4271f3]['updateAcw']();}if(_0x3638b6[_0xe5d9('0xd')][_0x4271f3]){_0x3638b6[_0xe5d9('0xd')][_0x4271f3]['updateStatusRealtime']({'statePause':_0xe9e628[_0xe5d9('0xe')]?!![]:![]});}_0x519a61({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x23ff7f){var _0xbe32b8=this;return new Promise(function(_0x16a5af,_0x122264){if(ami['isConnected']()==![]){return _0x122264(_0xbe32b8[_0xe5d9('0xf')](0x1f4,[config[_0xe5d9('0x10')]['ip'],config[_0xe5d9('0x10')]['username'],_0xe5d9('0x11')][_0xe5d9('0x12')]('\x20')));}_0x23ff7f=_[_0xe5d9('0x13')](_0x23ff7f,_['keys'](properties[_0xe5d9('0x14')]));_0x23ff7f['action']=_0xe5d9('0x15');return ami[_0xe5d9('0x16')](_0x23ff7f)[_0xe5d9('0x17')](function(_0x3bebf3){_0x16a5af({'code':0xc8,'message':_0x3bebf3[_0xe5d9('0x18')]});})['catch'](function(_0x413c9c){_0x122264(_0xbe32b8[_0xe5d9('0xf')](0x1f5,_0x413c9c[_0xe5d9('0x18')]));});});},'Command':function(_0x3c5758){var _0x165343=this;return new Promise(function(_0x32bd5e,_0x2cf512){if(ami[_0xe5d9('0x19')]()==![]){return _0x2cf512(_0x165343['error'](0x1f4,[config['asterisk']['ip'],config[_0xe5d9('0x10')]['username'],_0xe5d9('0x11')]['join']('\x20')));}_0x3c5758=_[_0xe5d9('0x13')](_0x3c5758,_0xe5d9('0x1a'));_0x3c5758['action']='Command';return ami[_0xe5d9('0x16')](_0x3c5758)['then'](function(_0x1fa654){_0x32bd5e({'code':0xc8,'message':_0x1fa654['content']});})[_0xe5d9('0x1b')](function(_0x225b21){_0x2cf512(_0x165343['error'](0x1f5,_0x225b21[_0xe5d9('0x18')]));});});},'VoiceQueues':function(_0x5af514){return new Promise(function(_0x2fe51d,_0x2033a3){var _0x57d70a=[];for(var _0x776cc4 in _0x3638b6['voiceQueues']){if(_0x3638b6[_0xe5d9('0x1c')]['hasOwnProperty'](_0x776cc4)){var _0xfd0848=_0x3638b6[_0xe5d9('0x1c')][_0x776cc4];var _0x42d3b9={'id':_0xfd0848['id'],'name':_0xfd0848[_0xe5d9('0xa')],'strategy':_0xfd0848['strategy'],'answered':_0xfd0848['answered'],'available':_0xfd0848['available'],'loggedIn':_0xfd0848[_0xe5d9('0x1d')],'pTalking':_0xfd0848['pTalking'],'sumBillable':_0xfd0848[_0xe5d9('0x1e')],'sumDuration':_0xfd0848['sumDuration'],'sumHoldTime':_0xfd0848['sumHoldTime']||0x0,'talking':_0xfd0848[_0xe5d9('0x1f')],'total':_0xfd0848[_0xe5d9('0x20')],'type':_0xfd0848[_0xe5d9('0x21')],'unmanaged':_0xfd0848['unmanaged'],'abandoned':_0xfd0848[_0xe5d9('0x22')],'waiting':_0xfd0848[_0xe5d9('0x23')],'loggedInDb':_0xfd0848[_0xe5d9('0x24')]};if(_0xfd0848[_0xe5d9('0x21')]===_0xe5d9('0x25')){_0x42d3b9[_0xe5d9('0x26')]=_0xfd0848['dialActive'];_0x42d3b9[_0xe5d9('0x27')]=_0xfd0848[_0xe5d9('0x27')];_0x42d3b9[_0xe5d9('0x28')]=_0xfd0848[_0xe5d9('0x28')];_0x42d3b9['dialOriginateCallerIdNumber']=_0xfd0848['dialOriginateCallerIdNumber'];_0x42d3b9[_0xe5d9('0x29')]=_0xfd0848[_0xe5d9('0x29')];_0x42d3b9['dialPrefix']=_0xfd0848[_0xe5d9('0x2a')];_0x42d3b9[_0xe5d9('0x2b')]=_0xfd0848[_0xe5d9('0x2b')];_0x42d3b9[_0xe5d9('0x2c')]=_0xfd0848['outboundAnswerCallsDay'];_0x42d3b9[_0xe5d9('0x2d')]=_0xfd0848['outboundBlacklistCallsDay'];_0x42d3b9[_0xe5d9('0x2e')]=_0xfd0848['outboundBusyCallsDay'];_0x42d3b9['outboundCongestionCallsDay']=_0xfd0848[_0xe5d9('0x2f')];_0x42d3b9[_0xe5d9('0x30')]=_0xfd0848[_0xe5d9('0x30')];_0x42d3b9[_0xe5d9('0x31')]=_0xfd0848[_0xe5d9('0x31')];_0x42d3b9[_0xe5d9('0x32')]=_0xfd0848[_0xe5d9('0x32')];_0x42d3b9['outboundNoAnswerCallsDay']=_0xfd0848[_0xe5d9('0x33')];_0x42d3b9[_0xe5d9('0x34')]=_0xfd0848['outboundNoSuchCallsDay'];_0x42d3b9[_0xe5d9('0x35')]=_0xfd0848[_0xe5d9('0x35')];_0x42d3b9[_0xe5d9('0x36')]=_0xfd0848[_0xe5d9('0x36')];_0x42d3b9[_0xe5d9('0x37')]=_0xfd0848[_0xe5d9('0x37')];_0x42d3b9[_0xe5d9('0x38')]=_0xfd0848[_0xe5d9('0x38')];_0x42d3b9['predictiveIntervalAnsweredCalls']=_0xfd0848[_0xe5d9('0x39')];_0x42d3b9[_0xe5d9('0x3a')]=_0xfd0848['predictiveIntervalAvgHoldtime'];_0x42d3b9['predictiveIntervalAvgTalktime']=_0xfd0848[_0xe5d9('0x3b')];_0x42d3b9[_0xe5d9('0x3c')]=_0xfd0848[_0xe5d9('0x3c')];_0x42d3b9[_0xe5d9('0x3d')]=_0xfd0848[_0xe5d9('0x3d')];_0x42d3b9[_0xe5d9('0x3e')]=_0xfd0848[_0xe5d9('0x3e')];_0x42d3b9[_0xe5d9('0x3f')]=_0xfd0848[_0xe5d9('0x3f')];_0x42d3b9[_0xe5d9('0x40')]=_0xfd0848[_0xe5d9('0x40')];_0x42d3b9['predictiveIntervalMultiplicativeFactor']=_0xfd0848[_0xe5d9('0x41')];_0x42d3b9[_0xe5d9('0x42')]=_0xfd0848['predictiveIntervalPauses'];_0x42d3b9['predictiveIntervalAvailable']=_0xfd0848['predictiveIntervalAvailable'];_0x42d3b9[_0xe5d9('0x43')]=_0xfd0848[_0xe5d9('0x43')];_0x42d3b9['message']=_0xfd0848[_0xe5d9('0x18')];_0x42d3b9[_0xe5d9('0x44')]=_0xfd0848[_0xe5d9('0x44')];_0x42d3b9['erlangCalls']=_0xfd0848[_0xe5d9('0x45')];_0x42d3b9['erlangCallToSecond']=_0xfd0848[_0xe5d9('0x46')];_0x42d3b9[_0xe5d9('0x47')]=_0xfd0848[_0xe5d9('0x47')];_0x42d3b9[_0xe5d9('0x48')]=_0xfd0848['erlangBusyFactor'];_0x42d3b9['startPredictive']=_0xfd0848[_0xe5d9('0x49')];_0x42d3b9[_0xe5d9('0x4a')]=_0xfd0848[_0xe5d9('0x4a')];}if(_0xfd0848[_0xe5d9('0x4b')]){_0x42d3b9['Trunk']={'id':_0xfd0848[_0xe5d9('0x4b')]['id'],'name':_0xfd0848[_0xe5d9('0x4b')][_0xe5d9('0xa')],'active':_0xfd0848['Trunk'][_0xe5d9('0x4c')],'callerid':_0xfd0848[_0xe5d9('0x4b')][_0xe5d9('0x4d')]};}if(_0xfd0848[_0xe5d9('0x4e')]){_0x42d3b9[_0xe5d9('0x4e')]={'id':_0xfd0848[_0xe5d9('0x4e')]['id'],'name':_0xfd0848['Interval'][_0xe5d9('0xa')]};}_0x57d70a[_0xe5d9('0x4f')](_0x42d3b9);}}_0x2fe51d({'count':_0x57d70a[_0xe5d9('0x50')],'rows':_0x57d70a});});},'VoiceChannels':function(_0x2c3826){return new Promise(function(_0x2906aa,_0x37e777){var _0x442328=_['values'](_0x3638b6[_0xe5d9('0x51')]);_0x2906aa({'count':_0x442328['length'],'rows':_0x442328});});},'VoiceChannelMixMonitor':function(_0xa90660){var _0x4673cd=this;return new Promise(function(_0x42f060,_0xb060b){if(ami[_0xe5d9('0x19')]()==![]){return _0xb060b(_0x4673cd[_0xe5d9('0xf')](0x1f4,[config[_0xe5d9('0x10')]['ip'],config['asterisk'][_0xe5d9('0x52')],_0xe5d9('0x11')][_0xe5d9('0x12')]('\x20')));}var _0x52d877=schema(properties['voicechannel'])[_0xe5d9('0x2')](_0xa90660);if(_0x52d877[_0xe5d9('0x50')]>0x0){return _0xb060b(_0x4673cd['error'](0x1f4,_[_0xe5d9('0x53')](_0x52d877,'message')[_0xe5d9('0x12')](',\x20')));}var _0x4d3297=_[_0xe5d9('0x54')](_0x3638b6['channels'],{'uniqueid':_0xa90660[_0xe5d9('0x55')]});if(_0x4d3297&&_0x4d3297[_0xe5d9('0x56')]){var _0x18b049=util[_0xe5d9('0x8')](_0xe5d9('0x57'),_0xa90660[_0xe5d9('0x58')]||_0xa90660[_0xe5d9('0x55')],_0xa90660[_0xe5d9('0x8')]||_0xe5d9('0x59'));return ami['Action']({'action':_0xe5d9('0x5a'),'channel':_0x4d3297[_0xe5d9('0x56')],'file':_0x18b049,'options':_0xe5d9('0x5b')})[_0xe5d9('0x17')](function(_0x554d9f){var _0x274739=_[_0xe5d9('0x54')](_0x4d3297[_0xe5d9('0x5c')],{'filename':'/var/spool/asterisk/monitor/'+_0x18b049[_0xe5d9('0x5d')]()});if(_[_0xe5d9('0x5e')](_0x274739)){_0x4d3297[_0xe5d9('0x5c')][_0xe5d9('0x4f')]({'filename':_0xe5d9('0x5f')+_0x18b049[_0xe5d9('0x5d')](),'createdAt':moment()[_0xe5d9('0x8')](_0xe5d9('0x60')),'mixmonitorid':_0x554d9f[_0xe5d9('0x61')],'status':'rec'});}else{_0x274739[_0xe5d9('0x61')]=_0x554d9f['mixmonitorid'];_0x274739[_0xe5d9('0x62')]='rec';}_0x42f060({'code':0xc8,'message':[_0xa90660['uniqueid'],_0xe5d9('0x63'),_0x554d9f['mixmonitorid']][_0xe5d9('0x12')]('\x20'),'mixmonitorid':_0x554d9f[_0xe5d9('0x61')]});})[_0xe5d9('0x1b')](function(_0x4e10c3){_0xb060b(_0x4673cd['error'](0x1f5,[_0xa90660[_0xe5d9('0x55')],_0x4e10c3[_0xe5d9('0x18')][_0xe5d9('0x5d')]()][_0xe5d9('0x12')]('\x20')));});}else{return _0xb060b(_0x4673cd[_0xe5d9('0xf')](0x1f5,_0xe5d9('0x64')));}});},'VoiceChannelStopMixMonitor':function(_0x5d44dd){var _0xa732e7=this;return new Promise(function(_0x671a3e,_0x9e8236){if(ami['isConnected']()==![]){return _0x9e8236(_0xa732e7[_0xe5d9('0xf')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0xe5d9('0x11')][_0xe5d9('0x12')]('\x20')));}var _0x267c76=schema(properties[_0xe5d9('0x65')])[_0xe5d9('0x2')](_0x5d44dd);if(_0x267c76[_0xe5d9('0x50')]>0x0){return _0x9e8236(_0xa732e7[_0xe5d9('0xf')](0x1f4,_[_0xe5d9('0x53')](_0x267c76,_0xe5d9('0x18'))[_0xe5d9('0x12')](',\x20')));}var _0x3bf606=_['find'](_0x3638b6['channels'],{'uniqueid':_0x5d44dd[_0xe5d9('0x55')]});if(_0x3bf606){return BPromise[_0xe5d9('0x66')]()[_0xe5d9('0x17')](function(){if(_0x3bf606[_0xe5d9('0x56')]){return ami[_0xe5d9('0x16')]({'action':_0xe5d9('0x67'),'channel':_0x3bf606['channel'],'mixmonitorid':_0x5d44dd[_0xe5d9('0x61')]})[_0xe5d9('0x1b')](function(_0x173593){});}})[_0xe5d9('0x17')](function(){if(_0x3bf606[_0xe5d9('0x68')]){return ami['Action']({'action':_0xe5d9('0x67'),'channel':_0x3bf606[_0xe5d9('0x68')],'mixmonitorid':_0x5d44dd[_0xe5d9('0x61')]})[_0xe5d9('0x1b')](function(_0x15cceb){});}})['then'](function(_0x5d11be){var _0x3d9c06=_[_0xe5d9('0x54')](_0x3bf606[_0xe5d9('0x5c')],{'mixmonitorid':_0x5d44dd[_0xe5d9('0x61')]});if(_0x3d9c06){_0x3d9c06[_0xe5d9('0x62')]='stop';}})[_0xe5d9('0x17')](function(){var _0x24a9db=util[_0xe5d9('0x8')](_0xe5d9('0x57'),_0x5d44dd['filename']||_0x5d44dd['uniqueid'],_0x5d44dd[_0xe5d9('0x8')]||_0xe5d9('0x59'));var _0x5c112a=_['find'](_0x3bf606[_0xe5d9('0x5c')],{'filename':_0xe5d9('0x5f')+_0x24a9db[_0xe5d9('0x5d')]()});if(_0x5c112a){_0x5c112a['status']=_0xe5d9('0x69');}})['then'](function(){_0x671a3e({'code':0xc8,'message':[_0x5d44dd['uniqueid'],_0xe5d9('0x6a')][_0xe5d9('0x12')]('\x20')});})[_0xe5d9('0x1b')](function(_0x272d36){_0x9e8236(_0xa732e7['error'](0x1f5,[_0x5d44dd[_0xe5d9('0x55')],_0x272d36[_0xe5d9('0x18')]['toLowerCase']()][_0xe5d9('0x12')]('\x20')));});}else{return _0x9e8236(_0xa732e7[_0xe5d9('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x3d2638){return new Promise(function(_0x774709,_0x47db5d){var _0x2884cc=_['values'](_0x3638b6[_0xe5d9('0x6b')]);_0x774709({'count':_0x2884cc[_0xe5d9('0x50')],'rows':_0x2884cc});});},'VoiceQueuesChannel':function(_0x45b808){var _0x15c3fa=this;return new Promise(function(_0x32a6b3,_0x332e67){var _0x14cb8c=schema(properties[_0xe5d9('0x6c')])[_0xe5d9('0x2')](_0x45b808);if(_0x14cb8c[_0xe5d9('0x50')]>0x0){return _0x332e67(_0x15c3fa[_0xe5d9('0xf')](0x1f4,_[_0xe5d9('0x53')](_0x14cb8c,_0xe5d9('0x18'))['join'](',\x20')));}var _0x28ec09=_[_0xe5d9('0x54')](_0x3638b6[_0xe5d9('0x6b')],{'uniqueid':_0x45b808[_0xe5d9('0x55')]});if(_0x28ec09){_0x32a6b3(_0x28ec09);}else{return _0x332e67(_0x15c3fa[_0xe5d9('0xf')](0x1f5,_0xe5d9('0x64')));}});},'VoiceQueuesChannelHangup':function(_0x4d9e48){var _0x10ccaf=this;return new Promise(function(_0x1ed347,_0x23cc58){if(ami[_0xe5d9('0x19')]()==![]){return _0x23cc58(_0x10ccaf[_0xe5d9('0xf')](0x1f4,[config[_0xe5d9('0x10')]['ip'],config['asterisk']['username'],'ami\x20disconnected']['join']('\x20')));}var _0x13376c=schema(properties[_0xe5d9('0x6d')])[_0xe5d9('0x2')](_0x4d9e48);if(_0x13376c[_0xe5d9('0x50')]>0x0){return _0x23cc58(_0x10ccaf['error'](0x1f4,_[_0xe5d9('0x53')](_0x13376c,_0xe5d9('0x18'))['join'](',\x20')));}var _0x4f6e98=_[_0xe5d9('0x54')](_0x3638b6[_0xe5d9('0x6b')],{'uniqueid':_0x4d9e48[_0xe5d9('0x55')]});if(_0x4f6e98&&_0x4f6e98['channel']){return ami[_0xe5d9('0x16')]({'action':_0xe5d9('0x6e'),'channel':_0x4f6e98[_0xe5d9('0x56')]})[_0xe5d9('0x17')](function(_0x39e346){_0x1ed347({'code':0xc8,'message':[_0x4d9e48[_0xe5d9('0x55')],_0x39e346[_0xe5d9('0x18')][_0xe5d9('0x5d')]()][_0xe5d9('0x12')]('\x20')});})[_0xe5d9('0x1b')](function(_0x30d4fe){_0x23cc58(_0x10ccaf['error'](0x1f5,[_0x4d9e48[_0xe5d9('0x55')],_0x30d4fe[_0xe5d9('0x18')][_0xe5d9('0x5d')]()]['join']('\x20')));});}else{return _0x23cc58(_0x10ccaf[_0xe5d9('0xf')](0x1f5,_0xe5d9('0x64')));}});},'VoiceQueuesChannelRedirect':function(_0x102db3){var _0x367f22=this;return new Promise(function(_0x4ebeaf,_0x3e7faf){if(ami[_0xe5d9('0x19')]()==![]){return _0x3e7faf(_0x367f22['error'](0x1f4,[config[_0xe5d9('0x10')]['ip'],config[_0xe5d9('0x10')][_0xe5d9('0x52')],_0xe5d9('0x11')][_0xe5d9('0x12')]('\x20')));}var _0x43c79b=schema(properties[_0xe5d9('0x6f')])[_0xe5d9('0x2')](_0x102db3);if(_0x43c79b[_0xe5d9('0x50')]>0x0){return _0x3e7faf(_0x367f22[_0xe5d9('0xf')](0x1f4,_['map'](_0x43c79b,'message')['join'](',\x20')));}var _0x2b0588=_['find'](_0x3638b6[_0xe5d9('0x6b')],{'uniqueid':_0x102db3[_0xe5d9('0x55')]});if(_0x2b0588&&_0x2b0588[_0xe5d9('0x56')]){return ami[_0xe5d9('0x16')]({'action':_0xe5d9('0x70'),'channel':_0x2b0588['channel'],'exten':_0x102db3[_0xe5d9('0x71')],'context':_0x102db3[_0xe5d9('0x72')]||_0x2b0588['context'],'priority':0x1})[_0xe5d9('0x17')](function(_0x2ef1cf){_0x4ebeaf({'code':0xc8,'message':[_0x102db3['uniqueid'],_0x2ef1cf['message'][_0xe5d9('0x5d')]()][_0xe5d9('0x12')]('\x20')});})[_0xe5d9('0x1b')](function(_0x278c9c){_0x3e7faf(_0x367f22[_0xe5d9('0xf')](0x1f5,[_0x102db3['uniqueid'],_0x278c9c[_0xe5d9('0x18')][_0xe5d9('0x5d')]()][_0xe5d9('0x12')]('\x20')));});}else{return _0x3e7faf(_0x367f22[_0xe5d9('0xf')](0x1f5,_0xe5d9('0x64')));}});},'Agents':function(_0x125d6a){return new Promise(function(_0x3f4533,_0x5e44ac){var _0x1761a5=_[_0xe5d9('0x73')](_0x3638b6[_0xe5d9('0xd')]);_0x3f4533({'count':_0x1761a5[_0xe5d9('0x50')],'rows':_0x1761a5});});},'Telephones':function(_0xf5af01){return new Promise(function(_0x3667c4,_0x289f36){var _0x406838=_[_0xe5d9('0x73')](_0x3638b6[_0xe5d9('0x74')]);_0x3667c4({'count':_0x406838[_0xe5d9('0x50')],'rows':_0x406838});});},'Trunks':function(_0x20ab9d){return new Promise(function(_0x41273e,_0x4ee649){var _0x21514b=_[_0xe5d9('0x73')](_0x3638b6[_0xe5d9('0x75')]);_0x41273e({'count':_0x21514b[_0xe5d9('0x50')],'rows':_0x21514b});});},'OutboundChannels':function(_0x432eca){return new Promise(function(_0x555f01,_0x223133){var _0x9ea692=_['values'](_0x3638b6[_0xe5d9('0x76')]);_0x555f01({'count':_0x9ea692[_0xe5d9('0x50')],'rows':_0x9ea692});});},'Outbound':function(_0x54d107){return new Promise(function(_0x22d3d5,_0x81fc3b){_0x22d3d5(_0x3638b6[_0xe5d9('0x25')]);});},'Campaigns':function(_0x790df8){return new Promise(function(_0x12e5c0,_0x49a2bf){var _0x1a3b2c=_[_0xe5d9('0x73')](_0x3638b6[_0xe5d9('0x77')]);_0x12e5c0({'count':_0x1a3b2c[_0xe5d9('0x50')],'rows':_0x1a3b2c});});},'VoiceQueuesPreview':function(_0xc85e1){var _0xf7c1c5=this;return new Promise(function(_0x3ff82e,_0x3338a3){_0x5430dd[_0xe5d9('0x78')](_0xc85e1['id'])[_0xe5d9('0x17')](function(_0x7bab9f){_0x3ff82e({'code':0xc8,'message':_0x7bab9f[_0xe5d9('0x18')]});})[_0xe5d9('0x1b')](function(_0x303470){_0x3338a3(_0xf7c1c5['error'](0x1f4,_0x303470[_0xe5d9('0x18')]));});});},'EventManager':function(_0x783a38){var _0x11537d=this;return new Promise(function(_0x27cff8,_0x13fc68){if(!_0x783a38[_0xe5d9('0x79')]){return _0x13fc68(_0x11537d[_0xe5d9('0xf')](0x1f4,_0xe5d9('0x7a')));}ami[_0xe5d9('0x7b')](_0xe5d9('0x7c')+_0x783a38[_0xe5d9('0x79')],_0x783a38['message']);_0x27cff8({'code':0xc8,'message':_0x783a38});});},'FaxAccounts':function(_0x23f972){return new Promise(function(_0x388359,_0x1d2a11){var _0x2737b5=_[_0xe5d9('0x73')](_0x3638b6[_0xe5d9('0x7d')]);_0x388359({'count':_0x2737b5[_0xe5d9('0x50')],'rows':_0x2737b5});});},'SendFax':function(_0x42039c){var _0x256de4=this;return new Promise(function(_0x3066be,_0x3e9636){_0x2e22c2['send'](_0x42039c)[_0xe5d9('0x17')](function(_0x43ec59){_0x3066be({'code':0xc8,'message':_0x43ec59[_0xe5d9('0x18')]});})['catch'](function(_0x1c649f){_0x3e9636(_0x256de4[_0xe5d9('0xf')](0x1f4,_0x1c649f[_0xe5d9('0x18')]));});});},'CheckAfterSend':function(_0x5b4bd2){var _0xb9ba52=this;return new Promise(function(_0x5ee2d9,_0xa1c570){_0x2e22c2['checkAfterSend'](_0x5b4bd2)[_0xe5d9('0x17')](function(_0x30c1cb){_0x5ee2d9({'code':0xc8,'message':_0x30c1cb[_0xe5d9('0x18')]});})['catch'](function(_0x102828){_0xa1c570(_0xb9ba52[_0xe5d9('0xf')](0x1f4,_0x102828[_0xe5d9('0x18')]));});});}};var _0x2488b9=jayson[_0xe5d9('0x7e')](_0x2f6085)[_0xe5d9('0x7f')]();_0x2488b9['on'](_0xe5d9('0xf'),function(_0x182272){return _0x16fd72(_0x182272);});_0x2488b9[_0xe5d9('0x7')](0x232a,_0xe5d9('0x80'),function(){console['log'](_0xe5d9('0x81'),0x232a);return _0x2f914a(_0xe5d9('0x82')+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 f8334c4..d55904e 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 _0x5422=['destcalleridnum','firstName','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridnum','calleridname','','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','Unknown','format','user:%s','name','action','merge','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data2','xmd-contactid','ListId','data3','split','phone','$or','routeId'];(function(_0x295a3d,_0x56d487){var _0x23a732=function(_0x15cfc2){while(--_0x15cfc2){_0x295a3d['push'](_0x295a3d['shift']());}};_0x23a732(++_0x56d487);}(_0x5422,0x1aa));var _0x2542=function(_0x19ecb5,_0x8fc0b9){_0x19ecb5=_0x19ecb5-0x0;var _0x4f2ae3=_0x5422[_0x19ecb5];return _0x4f2ae3;};'use strict';var _=require(_0x2542('0x0'));var BPromise=require('bluebird');var Redis=require(_0x2542('0x1'));var util=require(_0x2542('0x2'));var config=require(_0x2542('0x3'));var logger=require(_0x2542('0x4'))(_0x2542('0x5'));var cmContactRpc=require(_0x2542('0x6'));config[_0x2542('0x7')]=_['defaults'](config[_0x2542('0x7')],{'host':_0x2542('0x8'),'port':0x18eb});var io=require(_0x2542('0x9'))(new Redis(config[_0x2542('0x7')]));function emit(_0x28e6a1,_0xcf99a7,_0x5b8b1e,_0x2723ed,_0x858ccf){logger[_0x2542('0xa')](_0x2542('0xb'),_0x28e6a1,_0xcf99a7['id'],_0x5b8b1e,_0x2723ed,JSON[_0x2542('0xc')](_0x858ccf));io['to'](_0x5b8b1e)[_0x2542('0xd')](_0x2723ed,_0x858ccf);}exports['exec']=function(_0x5bfac0,_0x40a56a,_0x5d2c72,_0x144097){var _0x36d6fe,_0x41535a;var _0x31d87f={};var _0x216cf5=Number(_0x5d2c72['data1']);var _0x35aca0=_0x5d2c72[_0x2542('0xe')]?Boolean(Number(_0x5d2c72[_0x2542('0xe')])):![];var _0x14b7a9;if(_0x144097[_0x2542('0xf')]){_0x31d87f['id']=_0x144097[_0x2542('0xf')];}if(!_0x31d87f['id']){_0x31d87f[_0x2542('0x10')]=_0x216cf5;_0x14b7a9=_0x5d2c72['data3']&&_0x5d2c72[_0x2542('0x11')]!=='0'?_0x5d2c72[_0x2542('0x11')][_0x2542('0x12')](','):[_0x2542('0x13')];_0x31d87f[_0x2542('0x14')]=_['map'](_0x14b7a9,function(_0x2d17dd){var _0x43b124={};_0x43b124[_0x2d17dd]=_0x144097[_0x2542('0x15')]?_0x144097[_0x2542('0x16')]:_0x144097['calleridnum'];return _0x43b124;});}var _0x44d4c8=['id',_0x2542('0x17'),'lastName',_0x2542('0x13'),'mobile',_0x2542('0x18'),_0x2542('0x10'),_0x2542('0x19'),_0x2542('0x1a'),_0x2542('0x1b')];var _0x4f4c6b=_[_0x2542('0x1c')](_0x44d4c8,_0x14b7a9);BPromise[_0x2542('0x1d')]()[_0x2542('0x1e')](cmContactRpc[_0x2542('0x1f')]({'attributes':_0x4f4c6b,'where':_0x31d87f}))['then'](function(_0x40d9d2){_0x41535a=_0x40d9d2;if(!_[_0x2542('0x20')](_0x41535a)){if(_0x41535a[_0x2542('0x21')]===0x1){_0x36d6fe=_0x41535a[0x0];logger['info'](_0x2542('0x22'),_0x144097[_0x2542('0x23')],_0x40a56a['id'],_0x36d6fe['id']);}else{logger[_0x2542('0xa')](_0x2542('0x24'),_0x144097[_0x2542('0x23')],_0x40a56a['id'],_[_0x2542('0x25')](_0x41535a,'id')[_0x2542('0x26')](','));}return;}else{logger[_0x2542('0xa')](_0x2542('0x27'),_0x144097[_0x2542('0x23')],_0x40a56a['id']);var _0x456c5d={'ListId':_0x216cf5};var _0x27ac78=_0x5d2c72['data4']&&_0x5d2c72[_0x2542('0x28')]!=='0'?_0x5d2c72['data4']:_0x2542('0x13');if(_0x35aca0){logger[_0x2542('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x144097[_0x2542('0x23')],_0x40a56a['id']);_0x456c5d[_0x27ac78]=_['isNil'](_0x144097[_0x2542('0x15')])?_0x144097[_0x2542('0x29')]:_0x144097[_0x2542('0x16')];if(_['isNil'](_0x144097['routeId'])){_0x456c5d[_0x2542('0x17')]=_0x144097[_0x2542('0x2a')]&&_0x144097[_0x2542('0x2a')]!==_0x2542('0x2b')?_0x144097[_0x2542('0x2a')]:'Unknown';}else{_0x456c5d[_0x2542('0x17')]=_0x144097[_0x2542('0x2c')]&&_0x144097[_0x2542('0x2c')]!==_0x2542('0x2b')?_0x144097[_0x2542('0x2c')]:'Unknown';}return BPromise[_0x2542('0x1d')]()['then'](cmContactRpc[_0x2542('0x2d')](_0x456c5d))[_0x2542('0x1e')](function(_0xfebcb4){_0x36d6fe=_0xfebcb4;_0x41535a[_0x2542('0x2e')](_0xfebcb4);if(_0x36d6fe){logger[_0x2542('0xa')](_0x2542('0x2f'),_0x144097['uniqueid'],_0x40a56a['id'],_0x36d6fe['id']);}return;});}else{logger[_0x2542('0xa')](_0x2542('0x30'),_0x144097[_0x2542('0x23')],_0x40a56a['id']);_0x456c5d[_0x27ac78]=_['isNil'](_0x144097[_0x2542('0x15')])?_0x144097['calleridnum']:_0x144097[_0x2542('0x16')];if(_[_0x2542('0x31')](_0x144097[_0x2542('0x15')])){_0x456c5d[_0x2542('0x17')]=_0x144097[_0x2542('0x2a')]&&_0x144097['calleridname']!==''?_0x144097[_0x2542('0x2a')]:_0x2542('0x32');}else{_0x456c5d[_0x2542('0x17')]=_0x144097[_0x2542('0x2c')]&&_0x144097[_0x2542('0x2c')]!==_0x2542('0x2b')?_0x144097[_0x2542('0x2c')]:_0x2542('0x32');}_0x36d6fe=_0x456c5d;_0x41535a[_0x2542('0x2e')](_0x456c5d);return;}}})[_0x2542('0x1e')](function(){if(_0x5bfac0){emit(_0x144097[_0x2542('0x23')],_0x40a56a,util[_0x2542('0x33')](_0x2542('0x34'),_0x5bfac0[_0x2542('0x35')]),util['format']('trigger:%s',_0x5d2c72[_0x2542('0x36')]['toLowerCase']()),{'evt':_[_0x2542('0x37')](_0x144097,{'autoCreate':_0x35aca0}),'contact':_0x36d6fe===undefined?{}:_0x36d6fe,'contacts':_0x41535a[_0x2542('0x21')]===0x0?undefined:_0x41535a});}});}; \ No newline at end of file +var _0xe1cb=['createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','Unknown','format','user:%s','name','trigger:%s','action','bluebird','ioredis','../../../../config/logger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','fax','scheduledAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridname','destcalleridname',''];(function(_0x1df920,_0xb351c6){var _0x1e5905=function(_0x23b57e){while(--_0x23b57e){_0x1df920['push'](_0x1df920['shift']());}};_0x1e5905(++_0xb351c6);}(_0xe1cb,0x6f));var _0xbe1c=function(_0x173b69,_0x34531b){_0x173b69=_0x173b69-0x0;var _0x217d41=_0xe1cb[_0x173b69];return _0x217d41;};'use strict';var _=require('lodash');var BPromise=require(_0xbe1c('0x0'));var Redis=require(_0xbe1c('0x1'));var util=require('util');var config=require('../../../../config/environment');var logger=require(_0xbe1c('0x2'))('trigger');var cmContactRpc=require(_0xbe1c('0x3'));config['redis']=_[_0xbe1c('0x4')](config[_0xbe1c('0x5')],{'host':_0xbe1c('0x6'),'port':0x18eb});var io=require(_0xbe1c('0x7'))(new Redis(config[_0xbe1c('0x5')]));function emit(_0x293477,_0x113c9d,_0x54eac6,_0x406840,_0x4e52bb){logger[_0xbe1c('0x8')](_0xbe1c('0x9'),_0x293477,_0x113c9d['id'],_0x54eac6,_0x406840,JSON[_0xbe1c('0xa')](_0x4e52bb));io['to'](_0x54eac6)[_0xbe1c('0xb')](_0x406840,_0x4e52bb);}exports[_0xbe1c('0xc')]=function(_0x286874,_0x1bd339,_0x57c4df,_0x41c16a){var _0x503d23,_0x3dbc81;var _0x10f5ce={};var _0x6cb737=Number(_0x57c4df[_0xbe1c('0xd')]);var _0xa21414=_0x57c4df['data2']?Boolean(Number(_0x57c4df['data2'])):![];var _0x557e80;if(_0x41c16a['xmd-contactid']){_0x10f5ce['id']=_0x41c16a['xmd-contactid'];}if(!_0x10f5ce['id']){_0x10f5ce[_0xbe1c('0xe')]=_0x6cb737;_0x557e80=_0x57c4df[_0xbe1c('0xf')]&&_0x57c4df[_0xbe1c('0xf')]!=='0'?_0x57c4df[_0xbe1c('0xf')][_0xbe1c('0x10')](','):[_0xbe1c('0x11')];_0x10f5ce[_0xbe1c('0x12')]=_['map'](_0x557e80,function(_0x1da6f1){var _0x177c8b={};_0x177c8b[_0x1da6f1]=_0x41c16a[_0xbe1c('0x13')]?_0x41c16a[_0xbe1c('0x14')]:_0x41c16a[_0xbe1c('0x15')];return _0x177c8b;});}var _0x483521=['id',_0xbe1c('0x16'),_0xbe1c('0x17'),'phone','mobile',_0xbe1c('0x18'),'ListId','createdAt',_0xbe1c('0x19'),'updatedAt'];var _0x3e714f=_['union'](_0x483521,_0x557e80);BPromise[_0xbe1c('0x1a')]()[_0xbe1c('0x1b')](cmContactRpc[_0xbe1c('0x1c')]({'attributes':_0x3e714f,'where':_0x10f5ce}))[_0xbe1c('0x1b')](function(_0x9a650c){_0x3dbc81=_0x9a650c;if(!_[_0xbe1c('0x1d')](_0x3dbc81)){if(_0x3dbc81[_0xbe1c('0x1e')]===0x1){_0x503d23=_0x3dbc81[0x0];logger[_0xbe1c('0x8')](_0xbe1c('0x1f'),_0x41c16a[_0xbe1c('0x20')],_0x1bd339['id'],_0x503d23['id']);}else{logger['info'](_0xbe1c('0x21'),_0x41c16a[_0xbe1c('0x20')],_0x1bd339['id'],_[_0xbe1c('0x22')](_0x3dbc81,'id')[_0xbe1c('0x23')](','));}return;}else{logger[_0xbe1c('0x8')](_0xbe1c('0x24'),_0x41c16a[_0xbe1c('0x20')],_0x1bd339['id']);var _0x42e5a2={'ListId':_0x6cb737};var _0x14646c=_0x57c4df[_0xbe1c('0x25')]&&_0x57c4df[_0xbe1c('0x25')]!=='0'?_0x57c4df['data4']:_0xbe1c('0x11');if(_0xa21414){logger[_0xbe1c('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x41c16a['uniqueid'],_0x1bd339['id']);_0x42e5a2[_0x14646c]=_[_0xbe1c('0x26')](_0x41c16a[_0xbe1c('0x13')])?_0x41c16a['calleridnum']:_0x41c16a['destcalleridnum'];if(_['isNil'](_0x41c16a[_0xbe1c('0x13')])){_0x42e5a2[_0xbe1c('0x16')]=_0x41c16a['calleridname']&&_0x41c16a['calleridname']!==''?_0x41c16a[_0xbe1c('0x27')]:'Unknown';}else{_0x42e5a2[_0xbe1c('0x16')]=_0x41c16a[_0xbe1c('0x28')]&&_0x41c16a['destcalleridname']!==_0xbe1c('0x29')?_0x41c16a[_0xbe1c('0x28')]:'Unknown';}return BPromise[_0xbe1c('0x1a')]()[_0xbe1c('0x1b')](cmContactRpc[_0xbe1c('0x2a')](_0x42e5a2))[_0xbe1c('0x1b')](function(_0x161e38){_0x503d23=_0x161e38;_0x3dbc81[_0xbe1c('0x2b')](_0x161e38);if(_0x503d23){logger[_0xbe1c('0x8')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x41c16a['uniqueid'],_0x1bd339['id'],_0x503d23['id']);}return;});}else{logger[_0xbe1c('0x8')](_0xbe1c('0x2c'),_0x41c16a['uniqueid'],_0x1bd339['id']);_0x42e5a2[_0x14646c]=_[_0xbe1c('0x26')](_0x41c16a[_0xbe1c('0x13')])?_0x41c16a[_0xbe1c('0x15')]:_0x41c16a[_0xbe1c('0x14')];if(_[_0xbe1c('0x26')](_0x41c16a[_0xbe1c('0x13')])){_0x42e5a2[_0xbe1c('0x16')]=_0x41c16a[_0xbe1c('0x27')]&&_0x41c16a['calleridname']!==''?_0x41c16a[_0xbe1c('0x27')]:_0xbe1c('0x2d');}else{_0x42e5a2['firstName']=_0x41c16a[_0xbe1c('0x28')]&&_0x41c16a[_0xbe1c('0x28')]!==_0xbe1c('0x29')?_0x41c16a[_0xbe1c('0x28')]:'Unknown';}_0x503d23=_0x42e5a2;_0x3dbc81['push'](_0x42e5a2);return;}}})['then'](function(){if(_0x286874){emit(_0x41c16a[_0xbe1c('0x20')],_0x1bd339,util[_0xbe1c('0x2e')](_0xbe1c('0x2f'),_0x286874[_0xbe1c('0x30')]),util['format'](_0xbe1c('0x31'),_0x57c4df[_0xbe1c('0x32')]['toLowerCase']()),{'evt':_['merge'](_0x41c16a,{'autoCreate':_0xa21414}),'contact':_0x503d23===undefined?{}:_0x503d23,'contacts':_0x3dbc81[_0xbe1c('0x1e')]===0x0?undefined:_0x3dbc81});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index e288e08..194f271 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 _0xee04=['event','queue','agent','membername','lastevent','routeId','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','trigger','../ami','redis','defaults','localhost','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','info','stringify','emit','clone','checkTriggers','interface','hasOwnProperty','checkTrigger','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','TemplateId','html','data2','render','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winapp','winApplication','winArguments','format','trigger:%s:%s','data1','merge','jscripty','trigger:%s','user:%s','exec','integration','script','buildUri','replace','AllConditions','checkConditions','AnyConditions','some','channel','field','account','chat','operator','ChatWebsiteId','value','AccountId','interaction','message'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xee04,0x16f));var _0x4ee0=function(_0x53ee4c,_0x2ccbc5){_0x53ee4c=_0x53ee4c-0x0;var _0x281acb=_0xee04[_0x53ee4c];return _0x281acb;};'use strict';var util=require(_0x4ee0('0x0'));var _=require(_0x4ee0('0x1'));var url=require(_0x4ee0('0x2'));var Mustache=require(_0x4ee0('0x3'));var Redis=require(_0x4ee0('0x4'));var urlforward=require(_0x4ee0('0x5'));var integration=require(_0x4ee0('0x6'));var cmContact=require(_0x4ee0('0x7'));var script=require(_0x4ee0('0x8'));var config=require(_0x4ee0('0x9'));var logger=require('../../../config/logger')(_0x4ee0('0xa'));var ami=require(_0x4ee0('0xb'));config[_0x4ee0('0xc')]=_[_0x4ee0('0xd')](config[_0x4ee0('0xc')],{'host':_0x4ee0('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4ee0('0xc')]));var operators={'equals':function(_0x582129,_0x3458a3){return _0x582129==_0x3458a3;},'not_equals':function(_0x52eb02,_0x1c5828){return _0x52eb02!=_0x1c5828;}};var barAndWebActions=[_0x4ee0('0xf'),'url','winapp'];function Trigger(_0x4da1d0){this[_0x4ee0('0x10')]=_0x4da1d0[_0x4ee0('0x10')];this[_0x4ee0('0x11')]=_0x4da1d0['agents'];this[_0x4ee0('0x12')]=_0x4da1d0[_0x4ee0('0x12')];this['templates']=_0x4da1d0[_0x4ee0('0x13')];this[_0x4ee0('0x14')]=_0x4da1d0[_0x4ee0('0x14')];this[_0x4ee0('0x15')]=_0x4da1d0[_0x4ee0('0x15')];this[_0x4ee0('0x16')]=_0x4da1d0[_0x4ee0('0x16')];this['salesforceAccounts']=_0x4da1d0[_0x4ee0('0x17')];this[_0x4ee0('0x18')]=_0x4da1d0['sugarcrmAccounts'];this[_0x4ee0('0x19')]=_0x4da1d0['zohoAccounts'];this[_0x4ee0('0x1a')]=_0x4da1d0[_0x4ee0('0x1a')];this[_0x4ee0('0x1b')]=_0x4da1d0[_0x4ee0('0x1b')];this[_0x4ee0('0x1c')]=_0x4da1d0[_0x4ee0('0x1c')];this[_0x4ee0('0x1d')]=_0x4da1d0[_0x4ee0('0x1d')];this[_0x4ee0('0x1e')]=_0x4da1d0[_0x4ee0('0x1e')];this[_0x4ee0('0x1f')]={'zendesk':this[_0x4ee0('0x15')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x4ee0('0x16')],'sugarcrm':this[_0x4ee0('0x18')],'zoho':this['zohoAccounts'],'desk':this[_0x4ee0('0x1a')],'vtiger':this[_0x4ee0('0x1b')],'dynamics365':this[_0x4ee0('0x1d')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x4ee0('0x1c')]};ami['on'](_0x4ee0('0x20'),this[_0x4ee0('0x21')][_0x4ee0('0x22')](this));ami['on'](_0x4ee0('0x23'),this['syncCustomEvent']['bind'](this));ami['on'](_0x4ee0('0x24'),this['syncCustomEvent']['bind'](this));ami['on'](_0x4ee0('0x25'),this[_0x4ee0('0x21')]['bind'](this));ami['on']('custom:agentnosuchnumber',this[_0x4ee0('0x21')][_0x4ee0('0x22')](this));ami['on'](_0x4ee0('0x26'),this[_0x4ee0('0x21')][_0x4ee0('0x22')](this));ami['on'](_0x4ee0('0x27'),this['syncCustomEvent'][_0x4ee0('0x22')](this));ami['on']('custom:agentcongestion',this[_0x4ee0('0x21')][_0x4ee0('0x22')](this));ami['on'](_0x4ee0('0x28'),this[_0x4ee0('0x21')][_0x4ee0('0x22')](this));ami['on'](_0x4ee0('0x29'),this[_0x4ee0('0x21')][_0x4ee0('0x22')](this));ami['on']('custom:timeout',this['syncCustomEvent']['bind'](this));ami['on'](_0x4ee0('0x2a'),this[_0x4ee0('0x2b')][_0x4ee0('0x22')](this));ami['on'](_0x4ee0('0x2c'),this[_0x4ee0('0x2b')][_0x4ee0('0x22')](this));ami['on']('custom:dialend',this[_0x4ee0('0x2b')][_0x4ee0('0x22')](this));ami['on'](_0x4ee0('0x2d'),this['syncCustomEvent'][_0x4ee0('0x22')](this));ami['on'](_0x4ee0('0x2e'),this[_0x4ee0('0x21')][_0x4ee0('0x22')](this));ami['on'](_0x4ee0('0x2f'),this[_0x4ee0('0x21')][_0x4ee0('0x22')](this));ami['on'](_0x4ee0('0x30'),this['syncCustomEvent'][_0x4ee0('0x22')](this));ami['on'](_0x4ee0('0x31'),this['syncCustomEvent'][_0x4ee0('0x22')](this));ami['on'](_0x4ee0('0x32'),this[_0x4ee0('0x21')]['bind'](this));}Trigger[_0x4ee0('0x33')]['emit']=function(_0x17105b,_0x1cfdc0,_0x4cff22){logger[_0x4ee0('0x34')](_0x17105b,_0x1cfdc0,JSON[_0x4ee0('0x35')](_0x4cff22));io['to'](_0x17105b)[_0x4ee0('0x36')](_0x1cfdc0,_0x4cff22);};Trigger[_0x4ee0('0x33')][_0x4ee0('0x21')]=function(_0x16f1f7){var _0x41df4c=_[_0x4ee0('0x37')](_0x16f1f7);this[_0x4ee0('0x38')](_0x41df4c);};Trigger['prototype'][_0x4ee0('0x2b')]=function(_0x2a3cbf){if(this[_0x4ee0('0x11')][_0x2a3cbf[_0x4ee0('0x39')]]){this['syncCustomEvent'](_0x2a3cbf);}};Trigger[_0x4ee0('0x33')][_0x4ee0('0x38')]=function(_0x283557){var _0xb60cb0;for(var _0x37bb8a in this[_0x4ee0('0x10')]){if(this['triggers'][_0x4ee0('0x3a')](_0x37bb8a)){if(this[_0x4ee0('0x10')][_0x37bb8a]['status']){_0xb60cb0=this[_0x4ee0('0x3b')](this[_0x4ee0('0x10')][_0x37bb8a],_0x283557);if(_0xb60cb0){_['merge'](_0x283557,_0x283557[_0x4ee0('0x3c')]);for(var _0x25d38a=0x0,_0x58ecf9,_0xc40130,_0x56b614;_0x25d38a0x0){_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(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 40be49c..c4af0ee 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 _0x65b7=['assign','callDirection','queue','odata-entityid','format','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\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','bluebird','request-promise','util','./util','md5','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','POST','clientId','remoteUri','username','password','clientSecret','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','then','value','isNil','userEmail','length','internalemailaddress','email','info',']\x20Agent\x20found\x20','systemuserid','userId','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','substring','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','nameField','idField','indexOf','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x65b7,0x197));var _0x765b=function(_0x1a3083,_0x5bfa95){_0x1a3083=_0x1a3083-0x0;var _0xe8fea5=_0x65b7[_0x1a3083];return _0xe8fea5;};'use strict';var _=require('lodash');var BPromise=require(_0x765b('0x0'));var rp=require(_0x765b('0x1'));var util=require(_0x765b('0x2'));var intUtil=require(_0x765b('0x3'));var md5=require(_0x765b('0x4'));var Redis=require('ioredis');var logger=require(_0x765b('0x5'))('dynamics365');var config=require(_0x765b('0x6'));config[_0x765b('0x7')]=_[_0x765b('0x8')](config[_0x765b('0x7')],{'host':_0x765b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x765b('0x7')]));function getAuthToken(_0x504eee,_0x1ef61a,_0x3ae025){var _0x171bd5={'method':_0x765b('0xa'),'uri':_0x1ef61a,'form':{'client_id':_0x504eee[_0x765b('0xb')],'resource':_0x504eee[_0x765b('0xc')],'username':_0x504eee[_0x765b('0xd')],'password':_0x504eee[_0x765b('0xe')],'grant_type':_0x765b('0xe'),'client_secret':_0x504eee[_0x765b('0xf')]},'json':!![]};return rp(_0x171bd5)['then'](function(_0x282d92){return _0x282d92[_0x765b('0x10')];})['catch'](function(_0x30b10a){logger[_0x765b('0x11')]('['+[_0x3ae025[_0x765b('0x12')]()]+_0x765b('0x13'));return _0x30b10a[_0x765b('0x14')];});}function getUser(_0x445a97,_0x4873b7,_0x13940b,_0x48e949,_0x38ce35,_0x2583e1){return new BPromise(function(_0x215b66,_0x5e741b){return getAuthToken(_0x4873b7,_0x48e949,_0x2583e1)['then'](function(_0x4b9c37){var _0x24271c={'method':_0x765b('0x15'),'uri':_0x38ce35+_0x765b('0x16'),'headers':{'Authorization':_0x765b('0x17')+_0x4b9c37,'OData-Version':_0x765b('0x18')},'json':!![]};return rp(_0x24271c);})[_0x765b('0x19')](function(_0x4ac926){var _0x418e33=_0x4ac926[_0x765b('0x1a')];var _0x56bde0=![];var _0x3c2e2f=null;if(!_[_0x765b('0x1b')](_0x13940b)){if(intUtil['validateEmail'](_0x13940b['email'])){_0x445a97[_0x765b('0x1c')]=_0x13940b['email'];for(_0x3c2e2f=0x0;_0x3c2e2f<_0x418e33[_0x765b('0x1d')];_0x3c2e2f++){if(_0x418e33[_0x3c2e2f][_0x765b('0x1e')]===_0x13940b[_0x765b('0x1f')]&&!_0x418e33[_0x3c2e2f]['isdisabled']){_0x56bde0=!![];logger[_0x765b('0x20')]('['+[_0x2583e1[_0x765b('0x12')]()]+_0x765b('0x21')+_0x418e33[_0x3c2e2f][_0x765b('0x22')]+'!');_0x445a97[_0x765b('0x23')]=_0x418e33[_0x3c2e2f][_0x765b('0x22')];}}}}if(!_0x56bde0){logger[_0x765b('0x20')]('['+[_0x2583e1[_0x765b('0x12')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x445a97[_0x765b('0x1c')]=_0x4873b7[_0x765b('0xd')];for(_0x3c2e2f=0x0;_0x3c2e2f<_0x418e33[_0x765b('0x1d')];_0x3c2e2f++){if(_0x418e33[_0x3c2e2f][_0x765b('0x1e')]===_0x4873b7[_0x765b('0xd')]){_0x445a97[_0x765b('0x23')]=_0x418e33[_0x3c2e2f][_0x765b('0x22')];}}}_0x215b66(_0x445a97);})[_0x765b('0x24')](function(_0x223df4){_0x5e741b(_0x223df4[_0x765b('0x14')]);});});}function createEndUser(_0x4ecb42,_0x1e535a,_0x17c4d9,_0x2bacba,_0x352318,_0x1c40c0){return new BPromise(function(_0x2868c8,_0x42b3be){return getAuthToken(_0x1e535a,_0x17c4d9,_0x1c40c0)['then'](function(_0x1202b9){var _0x4df8ca=_0x1c40c0[_0x765b('0x25')]()===_0x765b('0x26')?_0x352318[_0x765b('0x27')]:_0x352318[_0x765b('0x28')];var _0x20dff1={'method':_0x765b('0xa'),'uri':_0x2bacba+_0x765b('0x29'),'body':{'telephone1':_0x4df8ca,'fullname':_0x4df8ca,'firstname':_0x4df8ca,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x765b('0x2a')+_0x4ecb42[_0x765b('0x23')]+')'},'headers':{'Authorization':_0x765b('0x17')+_0x1202b9,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x20dff1);})[_0x765b('0x19')](function(_0x1cf889){var _0x26b3b6=_0x1cf889[_0x765b('0x2b')]['odata-entityid'];var _0x44ea2f=_0x26b3b6[_0x765b('0x2c')](_0x26b3b6['lastIndexOf']('(')+0x1,_0x26b3b6[_0x765b('0x2d')](')'));_0x4ecb42[_0x765b('0x2e')]=_0x44ea2f;_0x2868c8(_0x4ecb42);})[_0x765b('0x24')](function(_0x1d17be){_0x42b3be(_0x1d17be[_0x765b('0x14')]);});});}function getEndUser(_0x519156,_0x53cf5d,_0x2ed7e7,_0xfd4616,_0x5947ae,_0x53b48f){return new BPromise(function(_0x2a1074,_0x78cdf9){return getAuthToken(_0x53cf5d,_0x2ed7e7,_0x53b48f)[_0x765b('0x19')](function(_0x5bcdcc){var _0xebd93={'method':_0x765b('0x15'),'uri':_0xfd4616+_0x765b('0x2f'),'headers':{'Authorization':_0x765b('0x17')+_0x5bcdcc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xebd93);})['then'](function(_0xa43794){var _0x7940f1=null;if(_0xa43794){var _0x44dec8=_0xa43794['value'];var _0x5c1039=![];for(_0x7940f1=0x0;_0x7940f1<_0x44dec8[_0x765b('0x1d')];_0x7940f1++){var _0x126e57=_0x53b48f['toLowerCase']()===_0x765b('0x26')?_0x5947ae[_0x765b('0x27')]:_0x5947ae[_0x765b('0x28')];if(_0x44dec8[_0x7940f1][_0x765b('0x30')]===_0x126e57){_0x5c1039=!![];_0x519156[_0x765b('0x2e')]=_0x44dec8[_0x7940f1][_0x765b('0x31')];}}if(_0x5c1039){_0x2a1074(_0x519156);}else{return createEndUser(_0x519156,_0x53cf5d,_0x2ed7e7,_0xfd4616,_0x5947ae,_0x53b48f)[_0x765b('0x19')](function(_0x4ae5e2){logger[_0x765b('0x20')]('['+[_0x53b48f[_0x765b('0x12')]()]+_0x765b('0x32'),_0x4ae5e2['enduserId']);_0x2a1074(_0x4ae5e2);});}}else{return createEndUser(_0x519156,_0x53cf5d,_0x2ed7e7,_0xfd4616,_0x5947ae,_0x53b48f)[_0x765b('0x19')](function(_0x44b52f){logger[_0x765b('0x20')]('['+[_0x53b48f['toUpperCase']()]+_0x765b('0x33'),_0x44b52f[_0x765b('0x2e')]);_0x2a1074(_0x44b52f);});}});});}function getCustomFields(_0x251819,_0x22c9cb,_0x476062){var _0x1db7d2={};if(_0x251819[_0x765b('0x1d')]>0x0){_[_0x765b('0x34')](_0x251819,function(_0x105cdb){if(_0x105cdb[_0x765b('0x35')]===_0x765b('0x36')&&_0x105cdb[_0x765b('0x37')]&&!_0x105cdb['customField']){var _0x2cf8ed=_0x105cdb[_0x765b('0x38')][_0x765b('0x25')]();var _0x2218b6=_0x2cf8ed['substring'](0x0,_0x2cf8ed['indexOf']('_'));var _0x4556f6=_0x2cf8ed[_0x765b('0x2c')](_0x2cf8ed[_0x765b('0x39')]('_')+0x1);if(_0x2218b6===_0x476062){_0x1db7d2[_0x4556f6]=_0x105cdb['content'];}}});}return _0x1db7d2;}function getTicket(_0x1102d6,_0x522091,_0xa4378e,_0x5d683e,_0x51cc06,_0x5459b8,_0xf54b98){return new BPromise(function(_0x39b353,_0x250c82){var _0x22a28d;return getAuthToken(_0x522091,_0xa4378e,_0xf54b98)[_0x765b('0x19')](function(_0x210d48){if(_0x5459b8[_0x765b('0x3a')]===_0x765b('0x3b')){_0x22a28d={'method':_0x765b('0xa'),'uri':_0x5d683e+_0x765b('0x3c'),'body':Object['assign']({},{'title':intUtil[_0x765b('0x3d')](_0x5459b8[_0x765b('0x3e')],_0x51cc06,'\x20'),'description':intUtil['getString'](_0x5459b8[_0x765b('0x3f')],_0x51cc06,'\x0a'),'customerid_contact@odata.bind':_0x765b('0x40')+_0x1102d6[_0x765b('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x1102d6['userId']+')','caseorigincode':'1'},getCustomFields(_0x5459b8[_0x765b('0x41')],_0x51cc06,_0x5459b8['ticketType'])),'headers':{'Authorization':_0x765b('0x17')+_0x210d48,'OData-Version':_0x765b('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5459b8['ticketType']===_0x765b('0x42')){_0x22a28d={'method':'POST','uri':_0x5d683e+_0x765b('0x43'),'body':Object[_0x765b('0x44')]({},{'subject':intUtil['getString'](_0x5459b8[_0x765b('0x3e')],_0x51cc06,'\x20'),'phonenumber':String(_0x51cc06[_0x765b('0x28')]),'description':intUtil[_0x765b('0x3d')](_0x5459b8[_0x765b('0x3f')],_0x51cc06,'\x0a'),'regardingobjectid_contact@odata.bind':_0x765b('0x40')+_0x1102d6[_0x765b('0x2e')]+')','ownerid@odata.bind':_0x765b('0x2a')+_0x1102d6[_0x765b('0x23')]+')','directioncode':_0x1102d6[_0x765b('0x45')]===_0x765b('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x765b('0x2a')+_0x1102d6['userId']+')','participationtypemask':_0x1102d6['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x765b('0x40')+_0x1102d6[_0x765b('0x2e')]+')','participationtypemask':_0x1102d6[_0x765b('0x45')]===_0x765b('0x46')?0x1:0x2}]},getCustomFields(_0x5459b8[_0x765b('0x41')],_0x51cc06,_0x5459b8[_0x765b('0x3a')])),'headers':{'Authorization':_0x765b('0x17')+_0x210d48,'OData-Version':_0x765b('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x22a28d);})['then'](function(_0x15fb06){var _0x1db35c=_0x15fb06[_0x765b('0x2b')][_0x765b('0x47')];var _0x556d86=_0x1db35c[_0x765b('0x2c')](_0x1db35c[_0x765b('0x2d')]('(')+0x1,_0x1db35c[_0x765b('0x2d')](')'));_0x1102d6['ticketId']=_0x556d86;_0x39b353(_0x1102d6);})[_0x765b('0x24')](function(_0x27a3cd){_0x250c82(_0x27a3cd['message']);});});}function emit(_0x326c14,_0x77f099,_0x288c61,_0x41a610){var _0x1db3b1={'uri':util[_0x765b('0x48')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x326c14,_0x288c61,_0x41a610)};io['to'](util['format'](_0x765b('0x49'),_0x77f099))[_0x765b('0x4a')]('trigger:browser:url',_0x1db3b1);}exports['cs']=function(_0x591474,_0xd00e8,_0x36835f,_0x23a62a,_0x508b27,_0x3314d9,_0x36fd2f,_0x486649){var _0x15e5bb={};_0x3314d9[_0x765b('0xc')]=intUtil[_0x765b('0x4b')](_0x3314d9['remoteUri']);_0x3314d9['serverUrl']=intUtil['stripTrailingSlash'](_0x3314d9[_0x765b('0x4c')]);_0x15e5bb[_0x765b('0x45')]=_0x486649===_0x765b('0x46')||_0x486649===_0x765b('0x4d')?_0x765b('0x46'):_0x765b('0x26');var _0x51a297=util[_0x765b('0x48')](_0x765b('0x4e'),_0x3314d9['remoteUri']);var _0x3ea2b8=util[_0x765b('0x48')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3314d9['tenantId']);var _0x21d704=util[_0x765b('0x48')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3314d9['serverUrl'],_0xd00e8[_0x765b('0x4f')],md5(_0xd00e8[_0x765b('0x4f')]));if(_0x508b27&&_0x508b27[_0x765b('0x50')]){logger[_0x765b('0x20')](_0x765b('0x51'),'Recording\x20is\x20enabled!');_0xd00e8[_0x765b('0x52')]=_0x21d704;}else if(_0x36fd2f&&_0x36fd2f[_0x765b('0x53')]&&_0x36fd2f['recordingFormat']!=='none'){logger['info'](_0x765b('0x54'),_0x765b('0x55'));_0xd00e8[_0x765b('0x52')]=_0x21d704;}else{_0xd00e8[_0x765b('0x52')]='';}return getUser(_0x15e5bb,_0x3314d9,_0x23a62a,_0x3ea2b8,_0x51a297,_0x486649)[_0x765b('0x19')](function(_0x4c9919){logger[_0x765b('0x20')]('['+_0x486649[_0x765b('0x12')]()+_0x765b('0x56'),_0x4c9919['userId']);logger[_0x765b('0x20')]('['+_0x486649[_0x765b('0x12')]()+_0x765b('0x57'),_0x4c9919[_0x765b('0x1c')]);return getEndUser(_0x4c9919,_0x3314d9,_0x3ea2b8,_0x51a297,_0xd00e8,_0x486649);})[_0x765b('0x19')](function(_0x32074c){logger[_0x765b('0x20')]('['+_0x486649[_0x765b('0x12')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x32074c[_0x765b('0x2e')]);logger[_0x765b('0x20')]('['+_0x486649[_0x765b('0x12')]()+_0x765b('0x58'),_0xd00e8[_0x765b('0x28')]);return getTicket(_0x32074c,_0x3314d9,_0x3ea2b8,_0x51a297,_0xd00e8,_0x36835f,_0x486649);})['then'](function(_0x33852a){logger[_0x765b('0x20')](util[_0x765b('0x48')]('['+_0x486649[_0x765b('0x12')]()+_0x765b('0x59'),_0x36835f[_0x765b('0x3a')],_0x33852a[_0x765b('0x5a')]));logger[_0x765b('0x20')](util[_0x765b('0x48')]('['+_0x486649[_0x765b('0x12')]()+_0x765b('0x5b'),_0x486649));if(_0x486649!=='unmanaged'){logger[_0x765b('0x20')]('['+_0x486649[_0x765b('0x12')]()+']',_0x765b('0x5c'));emit(_0x3314d9[_0x765b('0xc')],_0x23a62a['name'],_0x36835f['ticketType'],_0x33852a['ticketId']);}})[_0x765b('0x24')](function(_0x34530b){logger[_0x765b('0x11')]('['+_0x486649[_0x765b('0x12')]()+_0x765b('0x5d'),util[_0x765b('0x5e')](_0x34530b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x77d1=['util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','POST','remoteUri','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','toLowerCase','calleridnum','contacts','/systemusers(','4.0','headers','odata-entityid','lastIndexOf','enduserId','contacts?$select=telephone1','value','outbound','destcalleridnum','telephone1',']\x20Enduser\x20created!','forEach','string','nameField','idField','substring','indexOf','content','incidents','getString','Descriptions','/contacts(','ticketType','phonecall','phonecalls','assign','Subjects','callDirection','queue','Fields','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\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','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','request-promise'];(function(_0x204ddc,_0x581ed7){var _0x2ee64f=function(_0x48713a){while(--_0x48713a){_0x204ddc['push'](_0x204ddc['shift']());}};_0x2ee64f(++_0x581ed7);}(_0x77d1,0xbd));var _0x177d=function(_0x3048ea,_0x3838c2){_0x3048ea=_0x3048ea-0x0;var _0x1a13c4=_0x77d1[_0x3048ea];return _0x1a13c4;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require(_0x177d('0x0'));var util=require(_0x177d('0x1'));var intUtil=require('./util');var md5=require(_0x177d('0x2'));var Redis=require(_0x177d('0x3'));var logger=require(_0x177d('0x4'))(_0x177d('0x5'));var config=require(_0x177d('0x6'));config[_0x177d('0x7')]=_[_0x177d('0x8')](config[_0x177d('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x177d('0x9'))(new Redis(config['redis']));function getAuthToken(_0x1ab8da,_0x267708,_0x164c62){var _0x407d46={'method':_0x177d('0xa'),'uri':_0x267708,'form':{'client_id':_0x1ab8da['clientId'],'resource':_0x1ab8da[_0x177d('0xb')],'username':_0x1ab8da[_0x177d('0xc')],'password':_0x1ab8da[_0x177d('0xd')],'grant_type':_0x177d('0xd'),'client_secret':_0x1ab8da['clientSecret']},'json':!![]};return rp(_0x407d46)[_0x177d('0xe')](function(_0x4a6a71){return _0x4a6a71[_0x177d('0xf')];})[_0x177d('0x10')](function(_0x1c1a1f){logger[_0x177d('0x11')]('['+[_0x164c62[_0x177d('0x12')]()]+_0x177d('0x13'));return _0x1c1a1f[_0x177d('0x14')];});}function getUser(_0x35cd89,_0x4f636d,_0x3d2122,_0x203eee,_0x3e0ed3,_0x453e40){return new BPromise(function(_0x2a79d6,_0x26d2c0){return getAuthToken(_0x4f636d,_0x203eee,_0x453e40)['then'](function(_0x543d17){var _0x583706={'method':_0x177d('0x15'),'uri':_0x3e0ed3+_0x177d('0x16'),'headers':{'Authorization':_0x177d('0x17')+_0x543d17,'OData-Version':'4.0'},'json':!![]};return rp(_0x583706);})[_0x177d('0xe')](function(_0x1dd5f6){var _0x5bafd8=_0x1dd5f6['value'];var _0x5322db=![];var _0x4fb9d5=null;if(!_[_0x177d('0x18')](_0x3d2122)){if(intUtil[_0x177d('0x19')](_0x3d2122[_0x177d('0x1a')])){_0x35cd89[_0x177d('0x1b')]=_0x3d2122['email'];for(_0x4fb9d5=0x0;_0x4fb9d5<_0x5bafd8[_0x177d('0x1c')];_0x4fb9d5++){if(_0x5bafd8[_0x4fb9d5][_0x177d('0x1d')]===_0x3d2122[_0x177d('0x1a')]&&!_0x5bafd8[_0x4fb9d5][_0x177d('0x1e')]){_0x5322db=!![];logger[_0x177d('0x1f')]('['+[_0x453e40[_0x177d('0x12')]()]+_0x177d('0x20')+_0x5bafd8[_0x4fb9d5][_0x177d('0x21')]+'!');_0x35cd89[_0x177d('0x22')]=_0x5bafd8[_0x4fb9d5]['systemuserid'];}}}}if(!_0x5322db){logger[_0x177d('0x1f')]('['+[_0x453e40['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x35cd89[_0x177d('0x1b')]=_0x4f636d[_0x177d('0xc')];for(_0x4fb9d5=0x0;_0x4fb9d5<_0x5bafd8[_0x177d('0x1c')];_0x4fb9d5++){if(_0x5bafd8[_0x4fb9d5][_0x177d('0x1d')]===_0x4f636d['username']){_0x35cd89[_0x177d('0x22')]=_0x5bafd8[_0x4fb9d5][_0x177d('0x21')];}}}_0x2a79d6(_0x35cd89);})[_0x177d('0x10')](function(_0x38cb7d){_0x26d2c0(_0x38cb7d[_0x177d('0x14')]);});});}function createEndUser(_0x403425,_0x4d5864,_0x569443,_0xf3c863,_0x510194,_0x2fda96){return new BPromise(function(_0x4d2598,_0x376084){return getAuthToken(_0x4d5864,_0x569443,_0x2fda96)[_0x177d('0xe')](function(_0x31b8a9){var _0x147456=_0x2fda96[_0x177d('0x23')]()==='outbound'?_0x510194['destcalleridnum']:_0x510194[_0x177d('0x24')];var _0x1cddf1={'method':_0x177d('0xa'),'uri':_0xf3c863+_0x177d('0x25'),'body':{'telephone1':_0x147456,'fullname':_0x147456,'firstname':_0x147456,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x177d('0x26')+_0x403425[_0x177d('0x22')]+')'},'headers':{'Authorization':_0x177d('0x17')+_0x31b8a9,'OData-Version':_0x177d('0x27')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1cddf1);})[_0x177d('0xe')](function(_0x150b17){var _0x5eba30=_0x150b17[_0x177d('0x28')][_0x177d('0x29')];var _0x42032d=_0x5eba30['substring'](_0x5eba30[_0x177d('0x2a')]('(')+0x1,_0x5eba30[_0x177d('0x2a')](')'));_0x403425[_0x177d('0x2b')]=_0x42032d;_0x4d2598(_0x403425);})[_0x177d('0x10')](function(_0x46933b){_0x376084(_0x46933b[_0x177d('0x14')]);});});}function getEndUser(_0x3ff84e,_0x15c466,_0xb6f831,_0x42584e,_0x2b36d8,_0x109553){return new BPromise(function(_0x4a8bd7,_0x500535){return getAuthToken(_0x15c466,_0xb6f831,_0x109553)[_0x177d('0xe')](function(_0x176d5c){var _0x2169eb={'method':_0x177d('0x15'),'uri':_0x42584e+_0x177d('0x2c'),'headers':{'Authorization':_0x177d('0x17')+_0x176d5c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2169eb);})['then'](function(_0x7b0d9f){var _0xa42d20=null;if(_0x7b0d9f){var _0x11b8f5=_0x7b0d9f[_0x177d('0x2d')];var _0xe12412=![];for(_0xa42d20=0x0;_0xa42d20<_0x11b8f5[_0x177d('0x1c')];_0xa42d20++){var _0x30866c=_0x109553[_0x177d('0x23')]()===_0x177d('0x2e')?_0x2b36d8[_0x177d('0x2f')]:_0x2b36d8[_0x177d('0x24')];if(_0x11b8f5[_0xa42d20][_0x177d('0x30')]===_0x30866c){_0xe12412=!![];_0x3ff84e[_0x177d('0x2b')]=_0x11b8f5[_0xa42d20]['contactid'];}}if(_0xe12412){_0x4a8bd7(_0x3ff84e);}else{return createEndUser(_0x3ff84e,_0x15c466,_0xb6f831,_0x42584e,_0x2b36d8,_0x109553)[_0x177d('0xe')](function(_0x563648){logger[_0x177d('0x1f')]('['+[_0x109553[_0x177d('0x12')]()]+_0x177d('0x31'),_0x563648[_0x177d('0x2b')]);_0x4a8bd7(_0x563648);});}}else{return createEndUser(_0x3ff84e,_0x15c466,_0xb6f831,_0x42584e,_0x2b36d8,_0x109553)[_0x177d('0xe')](function(_0x1a62db){logger['info']('['+[_0x109553[_0x177d('0x12')]()]+']\x20Enduser\x20Created!',_0x1a62db['enduserId']);_0x4a8bd7(_0x1a62db);});}});});}function getCustomFields(_0x2be6d5,_0x511101,_0x32ab2d){var _0x2573c8={};if(_0x2be6d5['length']>0x0){_[_0x177d('0x32')](_0x2be6d5,function(_0x1ae683){if(_0x1ae683['type']===_0x177d('0x33')&&_0x1ae683[_0x177d('0x34')]&&!_0x1ae683['customField']){var _0x22101a=_0x1ae683[_0x177d('0x35')][_0x177d('0x23')]();var _0x4457bc=_0x22101a[_0x177d('0x36')](0x0,_0x22101a[_0x177d('0x37')]('_'));var _0x5b7149=_0x22101a[_0x177d('0x36')](_0x22101a[_0x177d('0x37')]('_')+0x1);if(_0x4457bc===_0x32ab2d){_0x2573c8[_0x5b7149]=_0x1ae683[_0x177d('0x38')];}}});}return _0x2573c8;}function getTicket(_0x2e9108,_0x49e61e,_0x12025a,_0x477064,_0x47b8c8,_0x1addd6,_0x34a63f){return new BPromise(function(_0x4ec594,_0x332322){var _0x2e7b0e;return getAuthToken(_0x49e61e,_0x12025a,_0x34a63f)[_0x177d('0xe')](function(_0xa1c56b){if(_0x1addd6['ticketType']==='incident'){_0x2e7b0e={'method':_0x177d('0xa'),'uri':_0x477064+_0x177d('0x39'),'body':Object['assign']({},{'title':intUtil[_0x177d('0x3a')](_0x1addd6['Subjects'],_0x47b8c8,'\x20'),'description':intUtil[_0x177d('0x3a')](_0x1addd6[_0x177d('0x3b')],_0x47b8c8,'\x0a'),'customerid_contact@odata.bind':_0x177d('0x3c')+_0x2e9108[_0x177d('0x2b')]+')','ownerid@odata.bind':_0x177d('0x26')+_0x2e9108[_0x177d('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x1addd6['Fields'],_0x47b8c8,_0x1addd6[_0x177d('0x3d')])),'headers':{'Authorization':_0x177d('0x17')+_0xa1c56b,'OData-Version':_0x177d('0x27')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1addd6['ticketType']===_0x177d('0x3e')){_0x2e7b0e={'method':_0x177d('0xa'),'uri':_0x477064+_0x177d('0x3f'),'body':Object[_0x177d('0x40')]({},{'subject':intUtil['getString'](_0x1addd6[_0x177d('0x41')],_0x47b8c8,'\x20'),'phonenumber':String(_0x47b8c8['calleridnum']),'description':intUtil['getString'](_0x1addd6[_0x177d('0x3b')],_0x47b8c8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x177d('0x3c')+_0x2e9108[_0x177d('0x2b')]+')','ownerid@odata.bind':_0x177d('0x26')+_0x2e9108['userId']+')','directioncode':_0x2e9108[_0x177d('0x42')]===_0x177d('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x177d('0x26')+_0x2e9108[_0x177d('0x22')]+')','participationtypemask':_0x2e9108[_0x177d('0x42')]===_0x177d('0x43')?0x2:0x1},{'partyid_contact@odata.bind':_0x177d('0x3c')+_0x2e9108[_0x177d('0x2b')]+')','participationtypemask':_0x2e9108['callDirection']===_0x177d('0x43')?0x1:0x2}]},getCustomFields(_0x1addd6[_0x177d('0x44')],_0x47b8c8,_0x1addd6[_0x177d('0x3d')])),'headers':{'Authorization':_0x177d('0x17')+_0xa1c56b,'OData-Version':_0x177d('0x27')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2e7b0e);})[_0x177d('0xe')](function(_0x224444){var _0x251335=_0x224444[_0x177d('0x28')][_0x177d('0x29')];var _0x39822c=_0x251335[_0x177d('0x36')](_0x251335[_0x177d('0x2a')]('(')+0x1,_0x251335[_0x177d('0x2a')](')'));_0x2e9108[_0x177d('0x45')]=_0x39822c;_0x4ec594(_0x2e9108);})[_0x177d('0x10')](function(_0x41a6b7){_0x332322(_0x41a6b7[_0x177d('0x14')]);});});}function emit(_0x4eccac,_0x48da9e,_0xeebea7,_0x4543a8){var _0x2e3dba={'uri':util[_0x177d('0x46')](_0x177d('0x47'),_0x4eccac,_0xeebea7,_0x4543a8)};io['to'](util['format']('user:%s',_0x48da9e))[_0x177d('0x48')](_0x177d('0x49'),_0x2e3dba);}exports['cs']=function(_0x37b5e6,_0xadc3c8,_0x476e38,_0xc3cb91,_0x1fc90f,_0x557c7a,_0x19b29f,_0x31201a){var _0x46d450={};_0x557c7a[_0x177d('0xb')]=intUtil[_0x177d('0x4a')](_0x557c7a['remoteUri']);_0x557c7a[_0x177d('0x4b')]=intUtil[_0x177d('0x4a')](_0x557c7a['serverUrl']);_0x46d450[_0x177d('0x42')]=_0x31201a===_0x177d('0x43')||_0x31201a===_0x177d('0x4c')?_0x177d('0x43'):_0x177d('0x2e');var _0x25a72b=util[_0x177d('0x46')](_0x177d('0x4d'),_0x557c7a[_0x177d('0xb')]);var _0xe8091a=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x557c7a[_0x177d('0x4e')]);var _0x214b31=util['format'](_0x177d('0x4f'),_0x557c7a[_0x177d('0x4b')],_0xadc3c8[_0x177d('0x50')],md5(_0xadc3c8[_0x177d('0x50')]));if(_0x1fc90f&&_0x1fc90f[_0x177d('0x51')]){logger[_0x177d('0x1f')](_0x177d('0x52'),_0x177d('0x53'));_0xadc3c8[_0x177d('0x54')]=_0x214b31;}else if(_0x19b29f&&_0x19b29f[_0x177d('0x55')]&&_0x19b29f[_0x177d('0x55')]!=='none'){logger[_0x177d('0x1f')](_0x177d('0x56'),_0x177d('0x53'));_0xadc3c8[_0x177d('0x54')]=_0x214b31;}else{_0xadc3c8['recordingURL']='';}return getUser(_0x46d450,_0x557c7a,_0xc3cb91,_0xe8091a,_0x25a72b,_0x31201a)[_0x177d('0xe')](function(_0x5a2af1){logger[_0x177d('0x1f')]('['+_0x31201a[_0x177d('0x12')]()+_0x177d('0x57'),_0x5a2af1['userId']);logger['info']('['+_0x31201a['toUpperCase']()+_0x177d('0x58'),_0x5a2af1['userEmail']);return getEndUser(_0x5a2af1,_0x557c7a,_0xe8091a,_0x25a72b,_0xadc3c8,_0x31201a);})[_0x177d('0xe')](function(_0x57bf54){logger[_0x177d('0x1f')]('['+_0x31201a['toUpperCase']()+_0x177d('0x59'),_0x57bf54['enduserId']);logger[_0x177d('0x1f')]('['+_0x31201a['toUpperCase']()+_0x177d('0x5a'),_0xadc3c8[_0x177d('0x24')]);return getTicket(_0x57bf54,_0x557c7a,_0xe8091a,_0x25a72b,_0xadc3c8,_0x476e38,_0x31201a);})[_0x177d('0xe')](function(_0xffb6cf){logger[_0x177d('0x1f')](util[_0x177d('0x46')]('['+_0x31201a[_0x177d('0x12')]()+_0x177d('0x5b'),_0x476e38['ticketType'],_0xffb6cf[_0x177d('0x45')]));logger['info'](util[_0x177d('0x46')]('['+_0x31201a['toUpperCase']()+_0x177d('0x5c'),_0x31201a));if(_0x31201a!==_0x177d('0x4c')){logger[_0x177d('0x1f')]('['+_0x31201a['toUpperCase']()+']',_0x177d('0x5d'));emit(_0x557c7a[_0x177d('0xb')],_0xc3cb91[_0x177d('0x5e')],_0x476e38[_0x177d('0x3d')],_0xffb6cf[_0x177d('0x45')]);}})[_0x177d('0x10')](function(_0x4071a2){logger[_0x177d('0x11')]('['+_0x31201a[_0x177d('0x12')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util['inspect'](_0x4071a2,{'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 f25c8bf..d486f58 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 _0x5aeb=['Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','variable','variableName','push','customVariable','Variable','name','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','unmanaged','lastevent','toUpperCase','Authorization','catch','request-promise','util','ioredis','./util','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','merge','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','format','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts'];(function(_0x4f4d19,_0x574245){var _0x27a258=function(_0x38da3e){while(--_0x38da3e){_0x4f4d19['push'](_0x4f4d19['shift']());}};_0x27a258(++_0x574245);}(_0x5aeb,0x95));var _0xb5ae=function(_0x3588f1,_0x261028){_0x3588f1=_0x3588f1-0x0;var _0x2631d4=_0x5aeb[_0x3588f1];return _0x2631d4;};'use strict';var _=require('lodash');var rp=require(_0xb5ae('0x0'));var md5=require('md5');var util=require(_0xb5ae('0x1'));var Redis=require(_0xb5ae('0x2'));var intUtil=require(_0xb5ae('0x3'));var config=require(_0xb5ae('0x4'));var logger=require('../../../../config/logger')(_0xb5ae('0x5'));config[_0xb5ae('0x6')]=_['defaults'](config[_0xb5ae('0x6')],{'host':_0xb5ae('0x7'),'port':0x18eb});var io=require(_0xb5ae('0x8'))(new Redis(config[_0xb5ae('0x6')]));var headers={'Content-Type':_0xb5ae('0x9'),'Accept':_0xb5ae('0x9')};function emit(_0x7a1d13,_0x215733,_0x376882){io['to'](_0x7a1d13)[_0xb5ae('0xa')](_0x215733,_0x376882);}function getTicket(_0x3c9e9c,_0x2dba06,_0x1bcadd,_0x36eaa5,_0x3802fe){logger[_0xb5ae('0xb')]('Creating\x20new\x20ticket...');var _0x24ac1a=_[_0xb5ae('0xc')]({'responder_id':_0x2dba06['id'],'requester_id':_0x1bcadd['id'],'name':util['format'](_0xb5ae('0xd'),_0x3802fe['calleridname']),'phone':_0x3802fe[_0xb5ae('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb5ae('0xf')](_0x36eaa5[_0xb5ae('0x10')],_0x3802fe,'\x20'),'description':intUtil['getString'](_0x36eaa5[_0xb5ae('0x11')],_0x3802fe,_0xb5ae('0x12')),'tags':getTags(_0x36eaa5[_0xb5ae('0x13')],'name')},getCustomFields(_0x36eaa5[_0xb5ae('0x14')],_0x3802fe));_0x24ac1a[_0xb5ae('0x15')]=_[_0xb5ae('0x16')](_[_0xb5ae('0x17')](_0x24ac1a[_0xb5ae('0x15')],'id'),_0xb5ae('0x18'));return request({'uri':util['format'](_0xb5ae('0x19'),_0x3c9e9c['remoteUri']),'method':_0xb5ae('0x1a'),'body':_0x24ac1a})[_0xb5ae('0x1b')](function(_0x5dc1b3){logger['info'](_0xb5ae('0x1c'));return _0x5dc1b3;});}function getUser(_0x313cbd,_0x585368){if(intUtil[_0xb5ae('0x1d')](_0x585368)){return request({'uri':util[_0xb5ae('0x1e')](_0xb5ae('0x1f'),_0x313cbd[_0xb5ae('0x20')]),'qs':{'email':_0x585368}})['then'](function(_0x300ead){if(_0x300ead[_0xb5ae('0x21')]){logger[_0xb5ae('0xb')](_0xb5ae('0x22'));return _[_0xb5ae('0x23')](_0x300ead,function(_0x46794f){return _0x46794f[_0xb5ae('0x24')]['email']===_0x585368;});}else{logger[_0xb5ae('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xb5ae('0x25'),_0x313cbd[_0xb5ae('0x20')])})['then'](function(_0x4c9aed){logger[_0xb5ae('0xb')](_0xb5ae('0x26'));return _0x4c9aed;});}});}else{logger[_0xb5ae('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb5ae('0x1e')](_0xb5ae('0x25'),_0x313cbd['remoteUri'])})[_0xb5ae('0x1b')](function(_0x57a63d){logger[_0xb5ae('0xb')]('Admin\x20account\x20selected.');return _0x57a63d;});}}function getEndUser(_0x46c6d2,_0x3ff72a,_0xf65587){logger[_0xb5ae('0xb')](_0xb5ae('0x27'),_0xf65587);return request({'uri':util[_0xb5ae('0x1e')](_0xb5ae('0x28'),_0x46c6d2['remoteUri']),'qs':{'phone':_0xf65587}})[_0xb5ae('0x1b')](function(_0x4bc83f){if(_0x4bc83f[_0xb5ae('0x21')]){logger[_0xb5ae('0xb')]('Enduser\x20found!');return _['find'](_0x4bc83f,{'phone':_0xf65587});}else{logger[_0xb5ae('0xb')](_0xb5ae('0x29'));return request({'uri':util[_0xb5ae('0x1e')](_0xb5ae('0x28'),_0x46c6d2['remoteUri']),'method':'POST','body':{'name':_0x3ff72a,'phone':_0xf65587}})[_0xb5ae('0x1b')](function(_0x3090c2){logger['info'](_0xb5ae('0x2a'));return _0x3090c2;});}});}function getAuth(_0x5718b7){return util[_0xb5ae('0x1e')](_0xb5ae('0x2b'),new Buffer(_0x5718b7[_0xb5ae('0x2c')]+':X')[_0xb5ae('0x2d')](_0xb5ae('0x2e')));}function request(_0x5cbacd){logger[_0xb5ae('0x2f')](_0xb5ae('0x30'),JSON[_0xb5ae('0x31')](_0x5cbacd));return rp(_[_0xb5ae('0x32')](_0x5cbacd,{'method':_0xb5ae('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x5139a6,_0x4ed051){var _0x4c26ed=[];if(_0x5139a6&&_0x5139a6[_0xb5ae('0x21')]>0x0){_0x4c26ed=_[_0xb5ae('0x34')](_0x5139a6,_0x4ed051);}return _0x4c26ed;}function getCustomFields(_0x50b4bd,_0x65bd4e){var _0x5beb66=[];var _0x1bffea={'custom_fields':[]};if(_0x50b4bd[_0xb5ae('0x21')]>0x0){_[_0xb5ae('0x35')](_0x50b4bd,function(_0x23704c){if(_0x23704c[_0xb5ae('0x36')]===_0xb5ae('0x37')&&_0x23704c[_0xb5ae('0x38')]&&!_0x23704c[_0xb5ae('0x39')]){_0x1bffea[_0x23704c['nameField'][_0xb5ae('0x3a')]()]=_0x23704c[_0xb5ae('0x3b')]['toString']();}else if(_0x23704c[_0xb5ae('0x36')]===_0xb5ae('0x37')&&_0x23704c['idField']&&_0x23704c['customField']){_0x1bffea[_0xb5ae('0x15')]['push']({'id':_0x23704c[_0xb5ae('0x3c')],'value':_0x23704c[_0xb5ae('0x3b')]['toString']()});}else if(_0x23704c['type']===_0xb5ae('0x3d')&&_0x23704c[_0xb5ae('0x3e')]&&_0x23704c['idField']&&_0x23704c['customField']){_0x65bd4e[_0x23704c[_0xb5ae('0x3e')]]&&_0x1bffea[_0xb5ae('0x15')][_0xb5ae('0x3f')]({'id':_0x23704c[_0xb5ae('0x3c')],'value':_0x65bd4e[_0x23704c[_0xb5ae('0x3e')]][_0xb5ae('0x2d')]()});}else if(_0x23704c[_0xb5ae('0x36')]===_0xb5ae('0x40')&&_0x23704c[_0xb5ae('0x41')]&&_0x23704c[_0xb5ae('0x41')][_0xb5ae('0x42')]&&_0x23704c['idField']&&_0x23704c[_0xb5ae('0x39')]){_0x65bd4e[_0x23704c[_0xb5ae('0x41')][_0xb5ae('0x42')]['toLowerCase']()]&&_0x1bffea[_0xb5ae('0x15')][_0xb5ae('0x3f')]({'id':_0x23704c[_0xb5ae('0x3c')],'value':_0x65bd4e[_0x23704c[_0xb5ae('0x41')][_0xb5ae('0x42')][_0xb5ae('0x3a')]()][_0xb5ae('0x2d')]()});}});}return _0x1bffea;}exports['queue']=function(_0x6bcad0,_0x525dfb,_0x16fe74,_0x1957d4,_0x161367,_0x213fc6){var _0x564540,_0x568784;_0x213fc6['remoteUri']=intUtil[_0xb5ae('0x43')](_0x213fc6[_0xb5ae('0x20')]);_0x213fc6['serverUrl']=intUtil['stripTrailingSlash'](_0x213fc6['serverUrl']);if(_0x161367&&_0x161367[_0xb5ae('0x44')]){logger[_0xb5ae('0xb')]('[QUEUE]',_0xb5ae('0x45'));_0x525dfb[_0xb5ae('0x46')]=util[_0xb5ae('0x1e')](_0xb5ae('0x47'),_0x213fc6[_0xb5ae('0x48')],_0x525dfb[_0xb5ae('0x49')],md5(_0x525dfb['uniqueid']));}else{_0x525dfb[_0xb5ae('0x46')]='';}headers['Authorization']=getAuth(_0x213fc6);return getUser(_0x213fc6,_0x1957d4[_0xb5ae('0x4a')])[_0xb5ae('0x1b')](function(_0x5702f3){_0x564540=_0x5702f3;logger['info'](_0xb5ae('0x4b'),_0x564540['id']);return getEndUser(_0x213fc6,_0x525dfb[_0xb5ae('0x4c')],_0x525dfb['calleridnum']);})[_0xb5ae('0x1b')](function(_0x1cca51){_0x568784=_0x1cca51;logger[_0xb5ae('0xb')](_0xb5ae('0x4d'),_0x568784['id']);return getTicket(_0x213fc6,_0x564540,_0x568784,_0x16fe74,_0x525dfb);})[_0xb5ae('0x1b')](function(_0x49db6e){if(_0x49db6e&&_0x49db6e['id']){logger['info'](_0xb5ae('0x1c'));logger['info'](_0xb5ae('0x4e'),_0x49db6e['id']);logger[_0xb5ae('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb5ae('0x1e')](_0xb5ae('0x4f'),_0x1957d4[_0xb5ae('0x42')]),_0xb5ae('0x50'),{'uri':util[_0xb5ae('0x1e')](_0xb5ae('0x51'),_0x213fc6['remoteUri'],_0x49db6e['id'])});}})['catch'](function(_0x418ab7){logger[_0xb5ae('0x52')](_0xb5ae('0x53'),JSON[_0xb5ae('0x31')](_0x418ab7));});};exports[_0xb5ae('0x54')]=function(_0x528705,_0x2c677d,_0x4ae15e,_0x1e4e2d,_0x213855,_0x4a8151,_0x44da48){var _0x45bd4b,_0x40f7dd;_0x4a8151[_0xb5ae('0x20')]=intUtil[_0xb5ae('0x43')](_0x4a8151[_0xb5ae('0x20')]);_0x4a8151[_0xb5ae('0x48')]=intUtil[_0xb5ae('0x43')](_0x4a8151[_0xb5ae('0x48')]);if(_0x44da48&&_0x44da48[_0xb5ae('0x55')]&&_0x44da48[_0xb5ae('0x55')]!==_0xb5ae('0x56')){logger[_0xb5ae('0xb')](_0xb5ae('0x57'),'Recording\x20is\x20enabled!');_0x2c677d[_0xb5ae('0x46')]=util[_0xb5ae('0x1e')](_0xb5ae('0x47'),_0x4a8151[_0xb5ae('0x48')],_0x2c677d[_0xb5ae('0x49')],md5(_0x2c677d['uniqueid']));}headers['Authorization']=getAuth(_0x4a8151);return getUser(_0x4a8151,_0x1e4e2d[_0xb5ae('0x4a')])[_0xb5ae('0x1b')](function(_0x4ced21){_0x45bd4b=_0x4ced21;logger[_0xb5ae('0xb')]('The\x20User\x20ID\x20is:',_0x45bd4b['id']);return getEndUser(_0x4a8151,_0x2c677d[_0xb5ae('0x58')],_0x2c677d[_0xb5ae('0x59')]);})[_0xb5ae('0x1b')](function(_0x66b77f){_0x40f7dd=_0x66b77f;logger[_0xb5ae('0xb')](_0xb5ae('0x4d'),_0x40f7dd['id']);return getTicket(_0x4a8151,_0x45bd4b,_0x40f7dd,_0x4ae15e,_0x2c677d);})[_0xb5ae('0x1b')](function(_0xc54dbe){if(_0xc54dbe&&_0xc54dbe['id']){logger[_0xb5ae('0xb')]('Ticket\x20created!');logger[_0xb5ae('0xb')](_0xb5ae('0x4e'),_0xc54dbe['id']);logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb5ae('0x1e')](_0xb5ae('0x4f'),_0x1e4e2d[_0xb5ae('0x42')]),_0xb5ae('0x50'),{'uri':util['format'](_0xb5ae('0x51'),_0x4a8151[_0xb5ae('0x20')],_0xc54dbe['id'])});}})['catch'](function(_0x126ac3){logger[_0xb5ae('0x52')](_0xb5ae('0x57'),JSON[_0xb5ae('0x31')](_0x126ac3));});};exports[_0xb5ae('0x5a')]=function(_0x88b2,_0x3ddb55,_0x2bbb7c,_0x125db8,_0x3138b4,_0x187ed9){var _0x52bcaf,_0x2a9ffe;_0x187ed9[_0xb5ae('0x20')]=intUtil['stripTrailingSlash'](_0x187ed9[_0xb5ae('0x20')]);_0x187ed9[_0xb5ae('0x48')]=intUtil[_0xb5ae('0x43')](_0x187ed9[_0xb5ae('0x48')]);if(_0x3138b4&&_0x3138b4[_0xb5ae('0x44')]){logger[_0xb5ae('0xb')]('['+_0x3ddb55[_0xb5ae('0x5b')][_0xb5ae('0x5c')]()+']','Recording\x20is\x20enabled!');_0x3ddb55[_0xb5ae('0x46')]=util[_0xb5ae('0x1e')](_0xb5ae('0x47'),_0x187ed9[_0xb5ae('0x48')],_0x3ddb55[_0xb5ae('0x49')],md5(_0x3ddb55[_0xb5ae('0x49')]));}else{_0x3ddb55[_0xb5ae('0x46')]='';}headers[_0xb5ae('0x5d')]=getAuth(_0x187ed9);return getUser(_0x187ed9,'')[_0xb5ae('0x1b')](function(_0x12e045){_0x52bcaf=_0x12e045;logger['info']('The\x20User\x20ID\x20is:',_0x52bcaf['id']);return getEndUser(_0x187ed9,_0x3ddb55[_0xb5ae('0x4c')],_0x3ddb55[_0xb5ae('0xe')]);})[_0xb5ae('0x1b')](function(_0x463892){_0x2a9ffe=_0x463892;logger[_0xb5ae('0xb')]('The\x20Enduser\x20ID\x20is:',_0x2a9ffe['id']);return getTicket(_0x187ed9,_0x52bcaf,_0x2a9ffe,_0x2bbb7c,_0x3ddb55);})[_0xb5ae('0x1b')](function(_0x38b5fe){if(_0x38b5fe){logger['info'](_0xb5ae('0x1c'));logger[_0xb5ae('0xb')]('The\x20Ticket\x20ID\x20is:',_0x38b5fe['id']);}})[_0xb5ae('0x5e')](function(_0x42f538){logger[_0xb5ae('0x52')]('['+_0x3ddb55[_0xb5ae('0x5b')][_0xb5ae('0x5c')]()+']',JSON[_0xb5ae('0x31')](_0x42f538));});}; \ No newline at end of file +var _0x300f=['Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','customField','nameField','toLowerCase','string','idField','push','content','type','variable','variableName','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','uniqueid','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/helpdesk/tickets/%d','lastevent','toUpperCase','lodash','request-promise','md5','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','emit','info','format','calleridname','calleridnum','getString','Subjects','
','Tags','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','then','Ticket\x20created!','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me'];(function(_0x1e115c,_0x3a3517){var _0x2de184=function(_0x400d2b){while(--_0x400d2b){_0x1e115c['push'](_0x1e115c['shift']());}};_0x2de184(++_0x3a3517);}(_0x300f,0x136));var _0xf300=function(_0xbe8a9,_0x514ec0){_0xbe8a9=_0xbe8a9-0x0;var _0x2a9dfc=_0x300f[_0xbe8a9];return _0x2a9dfc;};'use strict';var _=require(_0xf300('0x0'));var rp=require(_0xf300('0x1'));var md5=require(_0xf300('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xf300('0x3'));var config=require(_0xf300('0x4'));var logger=require('../../../../config/logger')(_0xf300('0x5'));config[_0xf300('0x6')]=_[_0xf300('0x7')](config[_0xf300('0x6')],{'host':_0xf300('0x8'),'port':0x18eb});var io=require(_0xf300('0x9'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x3faf44,_0x32c8f4,_0x42d7d0){io['to'](_0x3faf44)[_0xf300('0xa')](_0x32c8f4,_0x42d7d0);}function getTicket(_0x5c5a88,_0x405438,_0x18d99a,_0x4705be,_0x14471d){logger[_0xf300('0xb')]('Creating\x20new\x20ticket...');var _0x3d0f22=_['merge']({'responder_id':_0x405438['id'],'requester_id':_0x18d99a['id'],'name':util[_0xf300('0xc')]('Caller\x20-\x20%s',_0x14471d[_0xf300('0xd')]),'phone':_0x14471d[_0xf300('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf300('0xf')](_0x4705be[_0xf300('0x10')],_0x14471d,'\x20'),'description':intUtil[_0xf300('0xf')](_0x4705be['Descriptions'],_0x14471d,_0xf300('0x11')),'tags':getTags(_0x4705be[_0xf300('0x12')],'name')},getCustomFields(_0x4705be[_0xf300('0x13')],_0x14471d));_0x3d0f22[_0xf300('0x14')]=_['mapValues'](_[_0xf300('0x15')](_0x3d0f22[_0xf300('0x14')],'id'),_0xf300('0x16'));return request({'uri':util[_0xf300('0xc')](_0xf300('0x17'),_0x5c5a88['remoteUri']),'method':'POST','body':_0x3d0f22})[_0xf300('0x18')](function(_0x4cd5f3){logger['info'](_0xf300('0x19'));return _0x4cd5f3;});}function getUser(_0x5acb23,_0x47ddd9){if(intUtil['validateEmail'](_0x47ddd9)){return request({'uri':util[_0xf300('0xc')](_0xf300('0x1a'),_0x5acb23[_0xf300('0x1b')]),'qs':{'email':_0x47ddd9}})[_0xf300('0x18')](function(_0xc90f79){if(_0xc90f79[_0xf300('0x1c')]){logger[_0xf300('0xb')](_0xf300('0x1d'));return _[_0xf300('0x1e')](_0xc90f79,function(_0x189b54){return _0x189b54[_0xf300('0x1f')]['email']===_0x47ddd9;});}else{logger[_0xf300('0xb')](_0xf300('0x20'));return request({'uri':util[_0xf300('0xc')]('%s/api/v2/agents/me',_0x5acb23[_0xf300('0x1b')])})[_0xf300('0x18')](function(_0x2e702b){logger['info']('Admin\x20account\x20selected.');return _0x2e702b;});}});}else{logger[_0xf300('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf300('0xc')](_0xf300('0x21'),_0x5acb23[_0xf300('0x1b')])})[_0xf300('0x18')](function(_0x1430a1){logger[_0xf300('0xb')](_0xf300('0x22'));return _0x1430a1;});}}function getEndUser(_0x45afc4,_0x4bea1b,_0x22644d){logger[_0xf300('0xb')](_0xf300('0x23'),_0x22644d);return request({'uri':util[_0xf300('0xc')](_0xf300('0x24'),_0x45afc4[_0xf300('0x1b')]),'qs':{'phone':_0x22644d}})[_0xf300('0x18')](function(_0x2904f7){if(_0x2904f7[_0xf300('0x1c')]){logger[_0xf300('0xb')]('Enduser\x20found!');return _[_0xf300('0x1e')](_0x2904f7,{'phone':_0x22644d});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/api/v2/contacts',_0x45afc4['remoteUri']),'method':_0xf300('0x25'),'body':{'name':_0x4bea1b,'phone':_0x22644d}})[_0xf300('0x18')](function(_0x919775){logger['info'](_0xf300('0x26'));return _0x919775;});}});}function getAuth(_0x46239b){return util[_0xf300('0xc')](_0xf300('0x27'),new Buffer(_0x46239b[_0xf300('0x28')]+':X')[_0xf300('0x29')](_0xf300('0x2a')));}function request(_0x34353b){logger[_0xf300('0x2b')](_0xf300('0x2c'),JSON[_0xf300('0x2d')](_0x34353b));return rp(_[_0xf300('0x7')](_0x34353b,{'method':_0xf300('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x39e610,_0x2ffb4d){var _0x1530b7=[];if(_0x39e610&&_0x39e610[_0xf300('0x1c')]>0x0){_0x1530b7=_['map'](_0x39e610,_0x2ffb4d);}return _0x1530b7;}function getCustomFields(_0x285702,_0x1372ef){var _0x23b37a=[];var _0x46e09b={'custom_fields':[]};if(_0x285702[_0xf300('0x1c')]>0x0){_['forEach'](_0x285702,function(_0x2e7edb){if(_0x2e7edb['type']==='string'&&_0x2e7edb['nameField']&&!_0x2e7edb[_0xf300('0x2f')]){_0x46e09b[_0x2e7edb[_0xf300('0x30')][_0xf300('0x31')]()]=_0x2e7edb['content'][_0xf300('0x29')]();}else if(_0x2e7edb['type']===_0xf300('0x32')&&_0x2e7edb[_0xf300('0x33')]&&_0x2e7edb[_0xf300('0x2f')]){_0x46e09b[_0xf300('0x14')][_0xf300('0x34')]({'id':_0x2e7edb[_0xf300('0x33')],'value':_0x2e7edb[_0xf300('0x35')]['toString']()});}else if(_0x2e7edb[_0xf300('0x36')]===_0xf300('0x37')&&_0x2e7edb[_0xf300('0x38')]&&_0x2e7edb[_0xf300('0x33')]&&_0x2e7edb[_0xf300('0x2f')]){_0x1372ef[_0x2e7edb['variableName']]&&_0x46e09b[_0xf300('0x14')][_0xf300('0x34')]({'id':_0x2e7edb[_0xf300('0x33')],'value':_0x1372ef[_0x2e7edb[_0xf300('0x38')]][_0xf300('0x29')]()});}else if(_0x2e7edb[_0xf300('0x36')]==='customVariable'&&_0x2e7edb[_0xf300('0x39')]&&_0x2e7edb['Variable']['name']&&_0x2e7edb[_0xf300('0x33')]&&_0x2e7edb[_0xf300('0x2f')]){_0x1372ef[_0x2e7edb['Variable'][_0xf300('0x3a')][_0xf300('0x31')]()]&&_0x46e09b[_0xf300('0x14')]['push']({'id':_0x2e7edb[_0xf300('0x33')],'value':_0x1372ef[_0x2e7edb[_0xf300('0x39')]['name'][_0xf300('0x31')]()][_0xf300('0x29')]()});}});}return _0x46e09b;}exports[_0xf300('0x3b')]=function(_0x8fac71,_0x30acad,_0x1e712a,_0x136b01,_0x1e93fc,_0x8644f1){var _0x56c005,_0x15a314;_0x8644f1[_0xf300('0x1b')]=intUtil[_0xf300('0x3c')](_0x8644f1['remoteUri']);_0x8644f1['serverUrl']=intUtil[_0xf300('0x3c')](_0x8644f1[_0xf300('0x3d')]);if(_0x1e93fc&&_0x1e93fc[_0xf300('0x3e')]){logger['info']('[QUEUE]',_0xf300('0x3f'));_0x30acad['recordingURL']=util[_0xf300('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x8644f1[_0xf300('0x3d')],_0x30acad[_0xf300('0x40')],md5(_0x30acad[_0xf300('0x40')]));}else{_0x30acad['recordingURL']='';}headers['Authorization']=getAuth(_0x8644f1);return getUser(_0x8644f1,_0x136b01['email'])['then'](function(_0x5a42fb){_0x56c005=_0x5a42fb;logger[_0xf300('0xb')]('The\x20User\x20ID\x20is:',_0x56c005['id']);return getEndUser(_0x8644f1,_0x30acad['calleridname'],_0x30acad[_0xf300('0xe')]);})[_0xf300('0x18')](function(_0x5db419){_0x15a314=_0x5db419;logger['info']('The\x20Enduser\x20ID\x20is:',_0x15a314['id']);return getTicket(_0x8644f1,_0x56c005,_0x15a314,_0x1e712a,_0x30acad);})[_0xf300('0x18')](function(_0x2ecae2){if(_0x2ecae2&&_0x2ecae2['id']){logger[_0xf300('0xb')](_0xf300('0x19'));logger[_0xf300('0xb')](_0xf300('0x41'),_0x2ecae2['id']);logger[_0xf300('0xb')]('[QUEUE]',_0xf300('0x42'));emit(util[_0xf300('0xc')](_0xf300('0x43'),_0x136b01[_0xf300('0x3a')]),_0xf300('0x44'),{'uri':util[_0xf300('0xc')]('%s/helpdesk/tickets/%d',_0x8644f1['remoteUri'],_0x2ecae2['id'])});}})[_0xf300('0x45')](function(_0x551673){logger[_0xf300('0x46')]('[QUEUE]',JSON['stringify'](_0x551673));});};exports[_0xf300('0x47')]=function(_0x1304c4,_0x59abd3,_0x272660,_0x445b9f,_0x385dc1,_0x100330,_0x56cb97){var _0x438c98,_0x3ad30c;_0x100330[_0xf300('0x1b')]=intUtil[_0xf300('0x3c')](_0x100330[_0xf300('0x1b')]);_0x100330[_0xf300('0x3d')]=intUtil[_0xf300('0x3c')](_0x100330[_0xf300('0x3d')]);if(_0x56cb97&&_0x56cb97[_0xf300('0x48')]&&_0x56cb97[_0xf300('0x48')]!==_0xf300('0x49')){logger['info'](_0xf300('0x4a'),'Recording\x20is\x20enabled!');_0x59abd3[_0xf300('0x4b')]=util[_0xf300('0xc')](_0xf300('0x4c'),_0x100330['serverUrl'],_0x59abd3[_0xf300('0x40')],md5(_0x59abd3[_0xf300('0x40')]));}headers[_0xf300('0x4d')]=getAuth(_0x100330);return getUser(_0x100330,_0x445b9f[_0xf300('0x4e')])['then'](function(_0x5b5638){_0x438c98=_0x5b5638;logger[_0xf300('0xb')](_0xf300('0x4f'),_0x438c98['id']);return getEndUser(_0x100330,_0x59abd3[_0xf300('0x50')],_0x59abd3[_0xf300('0x51')]);})[_0xf300('0x18')](function(_0x12b486){_0x3ad30c=_0x12b486;logger[_0xf300('0xb')](_0xf300('0x52'),_0x3ad30c['id']);return getTicket(_0x100330,_0x438c98,_0x3ad30c,_0x272660,_0x59abd3);})[_0xf300('0x18')](function(_0x5352ed){if(_0x5352ed&&_0x5352ed['id']){logger[_0xf300('0xb')](_0xf300('0x19'));logger['info'](_0xf300('0x41'),_0x5352ed['id']);logger[_0xf300('0xb')]('[OUTBOUND]',_0xf300('0x42'));emit(util[_0xf300('0xc')](_0xf300('0x43'),_0x445b9f[_0xf300('0x3a')]),_0xf300('0x44'),{'uri':util[_0xf300('0xc')](_0xf300('0x53'),_0x100330[_0xf300('0x1b')],_0x5352ed['id'])});}})[_0xf300('0x45')](function(_0x9d225){logger['error'](_0xf300('0x4a'),JSON[_0xf300('0x2d')](_0x9d225));});};exports['unmanaged']=function(_0x904f70,_0x37c89b,_0x28564a,_0x47cae0,_0x4076e4,_0x2ed903){var _0x26feb2,_0x2b4970;_0x2ed903[_0xf300('0x1b')]=intUtil[_0xf300('0x3c')](_0x2ed903['remoteUri']);_0x2ed903[_0xf300('0x3d')]=intUtil[_0xf300('0x3c')](_0x2ed903[_0xf300('0x3d')]);if(_0x4076e4&&_0x4076e4[_0xf300('0x3e')]){logger[_0xf300('0xb')]('['+_0x37c89b[_0xf300('0x54')][_0xf300('0x55')]()+']',_0xf300('0x3f'));_0x37c89b[_0xf300('0x4b')]=util[_0xf300('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ed903[_0xf300('0x3d')],_0x37c89b[_0xf300('0x40')],md5(_0x37c89b[_0xf300('0x40')]));}else{_0x37c89b[_0xf300('0x4b')]='';}headers[_0xf300('0x4d')]=getAuth(_0x2ed903);return getUser(_0x2ed903,'')[_0xf300('0x18')](function(_0x4c50d9){_0x26feb2=_0x4c50d9;logger[_0xf300('0xb')](_0xf300('0x4f'),_0x26feb2['id']);return getEndUser(_0x2ed903,_0x37c89b[_0xf300('0xd')],_0x37c89b[_0xf300('0xe')]);})['then'](function(_0x11f08d){_0x2b4970=_0x11f08d;logger[_0xf300('0xb')](_0xf300('0x52'),_0x2b4970['id']);return getTicket(_0x2ed903,_0x26feb2,_0x2b4970,_0x28564a,_0x37c89b);})[_0xf300('0x18')](function(_0x3c0721){if(_0x3c0721){logger[_0xf300('0xb')](_0xf300('0x19'));logger[_0xf300('0xb')](_0xf300('0x41'),_0x3c0721['id']);}})['catch'](function(_0x397835){logger[_0xf300('0x46')]('['+_0x37c89b['lastevent'][_0xf300('0x55')]()+']',JSON[_0xf300('0x2d')](_0x397835));});}; \ 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 2a83784..819e18b 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 _0xa74a=['Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','Task\x20created:','user:%s','emit','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','GET','headers','info','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','error','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','catch','POST','contactNumber','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','toUpperCase','message','Creating\x20new\x20task','getString','Descriptions'];(function(_0x58998c,_0x2b9ab4){var _0x9789db=function(_0x1c4108){while(--_0x1c4108){_0x58998c['push'](_0x58998c['shift']());}};_0x9789db(++_0x2b9ab4);}(_0xa74a,0x66));var _0xaa74=function(_0x50303d,_0x295b19){_0x50303d=_0x50303d-0x0;var _0x16b13f=_0xa74a[_0x50303d];return _0x16b13f;};'use strict';var _=require(_0xaa74('0x0'));var rp=require(_0xaa74('0x1'));var md5=require(_0xaa74('0x2'));var util=require(_0xaa74('0x3'));var moment=require(_0xaa74('0x4'));var Promise=require(_0xaa74('0x5'));var Redis=require('ioredis');var intUtil=require(_0xaa74('0x6'));var config=require(_0xaa74('0x7'));var logger=require(_0xaa74('0x8'))('freshsales');config['redis']=_[_0xaa74('0x9')](config[_0xaa74('0xa')],{'host':_0xaa74('0xb'),'port':0x18eb});var io=require(_0xaa74('0xc'))(new Redis(config[_0xaa74('0xa')]));function getAdminId(_0x5a3684,_0x197336,_0x5de8d6,_0x13b760){return new Promise(function(_0x502005,_0x29771f){var _0xbe2a51=![];var _0x4e5c4e={'method':_0xaa74('0xd'),'uri':_0x13b760+'/api/selector/owners','json':!![]};_0x4e5c4e[_0xaa74('0xe')]=_0x5de8d6;logger[_0xaa74('0xf')]('Getting\x20admin\x20information');return rp(_0x4e5c4e)[_0xaa74('0x10')](function(_0x28bc7f){if(_0x28bc7f){var _0x2065a1=_0x28bc7f[_0xaa74('0x11')];var _0x1455ab=null;for(_0x1455ab=0x0;_0x1455ab<_0x2065a1[_0xaa74('0x12')];_0x1455ab++){if(_0x2065a1[_0x1455ab][_0xaa74('0x13')]===_0x5a3684[_0xaa74('0x14')]){_0x5a3684[_0xaa74('0x15')]=_0x2065a1[_0x1455ab]['id'];_0xbe2a51=!![];}}if(_0xbe2a51){logger[_0xaa74('0xf')](_0xaa74('0x16'),_0x5a3684['adminId']);_0x502005(_0x5a3684);}else{_0x29771f({'statusCode':0x194,'message':_0xaa74('0x17')});}}else{_0x29771f({'statusCode':0x194,'message':_0xaa74('0x17')});}})['catch'](function(_0x3185f4){logger['error']('['+[_0x197336['toUpperCase']()]+']',_0x3185f4['message']);_0x29771f(_0x3185f4);});});}function getUser(_0x5925ac,_0xbe83ac,_0x4f9617){return function(_0x3d9b94){return new Promise(function(_0x57779d,_0x1c81ef){var _0x29eedb={'method':_0xaa74('0xd'),'uri':_0x4f9617+'/api/selector/owners','json':!![]};_0x29eedb['headers']=_0xbe83ac;logger['info']('Getting\x20user\x20list');return rp(_0x29eedb)[_0xaa74('0x10')](function(_0x163f06){if(_0x163f06){var _0x2c27dd=_0x163f06[_0xaa74('0x11')];var _0xcfc5ba=![];var _0x2b1d10=null;if(_0x3d9b94[_0xaa74('0x18')]!==null){logger[_0xaa74('0xf')]('Getting\x20user\x20with\x20email',_0x3d9b94[_0xaa74('0x18')]);_0x3d9b94[_0xaa74('0x19')]=_0x3d9b94[_0xaa74('0x18')];for(_0x2b1d10=0x0;_0x2b1d10<_0x2c27dd[_0xaa74('0x12')];_0x2b1d10++){if(_0x2c27dd[_0x2b1d10][_0xaa74('0x13')]===_0x3d9b94[_0xaa74('0x18')]){_0xcfc5ba=!![];_0x3d9b94[_0xaa74('0x1a')]=_0x2c27dd[_0x2b1d10]['id'];logger[_0xaa74('0xf')](_0xaa74('0x1b'),_0x3d9b94[_0xaa74('0x1a')]);}}}if(!_0xcfc5ba){logger['info'](_0xaa74('0x1c'));_0x3d9b94[_0xaa74('0x19')]=_0x3d9b94['adminEmail'];_0x3d9b94[_0xaa74('0x1a')]=_0x3d9b94['adminId'];_0xcfc5ba=!![];}if(_0xcfc5ba){_0x57779d(_0x3d9b94);}else{_0x1c81ef({'statusCode':0x194,'message':_0xaa74('0x17')});}}else{_0x1c81ef({'statusCode':0x194,'message':_0xaa74('0x17')});}})['catch'](function(_0x1361d6){logger[_0xaa74('0x1d')]('['+[_0x5925ac['toUpperCase']()]+']',_0x1361d6['message']);_0x1c81ef(_0x1361d6);});});};}function searchContact(_0x1ae058,_0x59c455,_0x40f328,_0x229418){return new Promise(function(_0x5a313b,_0x40bc29){var _0x2eb111={'method':'GET','headers':_0x59c455,'uri':_0x1ae058+'/api/lookup?q='+_0x229418+_0xaa74('0x1e')+_0x40f328+_0xaa74('0x1f'),'json':!![]};rp(_0x2eb111)[_0xaa74('0x10')](function(_0x33ab16){var _0x2624d3=_[_0xaa74('0x20')](_0x33ab16['contacts'][_0xaa74('0x21')],[_0x40f328,_0x229418]);_0x5a313b(_0x2624d3);})['catch'](function(_0xa8eefe){_0x40bc29(_0xa8eefe);});});}function getEndUser(_0x52fdfe,_0x2afb05,_0x3aff14){return function(_0x3d183d){return new Promise(function(_0x216202,_0x4fcb57){logger[_0xaa74('0xf')](util['format'](_0xaa74('0x22'),_0x3d183d['contactNumber']));searchContact(_0x3aff14,_0x2afb05,_0xaa74('0x23'),_0x3d183d['contactNumber'])[_0xaa74('0x10')](function(_0x599610){if(_0x599610){_0x3d183d[_0xaa74('0x24')]=_0x599610['id'];logger['info'](_0xaa74('0x25'),_0x3d183d[_0xaa74('0x24')]);return _0x216202(_0x3d183d);}searchContact(_0x3aff14,_0x2afb05,_0xaa74('0x26'),_0x3d183d['contactNumber'])[_0xaa74('0x10')](function(_0x4727db){if(_0x4727db){_0x3d183d[_0xaa74('0x24')]=_0x4727db['id'];logger[_0xaa74('0xf')]('Contact\x20found\x20work_number:',_0x3d183d[_0xaa74('0x24')]);return _0x216202(_0x3d183d);}createEndUser(_0x3d183d,_0x52fdfe,_0x2afb05,_0x3aff14)[_0xaa74('0x10')](function(_0x546971){logger[_0xaa74('0xf')](_0xaa74('0x27'),_0x546971['endUserId']);return _0x216202(_0x546971);});});})[_0xaa74('0x28')](function(_0x49d35d){_0x4fcb57(_0x49d35d);});});};}function createEndUser(_0x1e5f8f,_0x4db3ff,_0x3da413,_0x252b7b){return new Promise(function(_0x5d8405,_0xae0bc4){var _0x4a1c5d=moment();var _0x44c58c={'method':_0xaa74('0x29'),'uri':_0x252b7b+'/api/contacts','body':{'contact':{'last_name':_0x1e5f8f[_0xaa74('0x2a')],'work_number':_0x1e5f8f[_0xaa74('0x2a')],'mobile_number':_0x1e5f8f[_0xaa74('0x2a')],'owner_id':_0x1e5f8f[_0xaa74('0x1a')],'created_at':_0x4a1c5d[_0xaa74('0x2b')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x44c58c[_0xaa74('0xe')]=_0x3da413;logger[_0xaa74('0xf')](_0xaa74('0x2c'));return rp(_0x44c58c)[_0xaa74('0x10')](function(_0x353348){_0x1e5f8f[_0xaa74('0x24')]=_0x353348['contact']['id'];_0x5d8405(_0x1e5f8f);})[_0xaa74('0x28')](function(_0x57f6ec){logger[_0xaa74('0x1d')]('['+[_0x4db3ff[_0xaa74('0x2d')]()]+']',_0x57f6ec[_0xaa74('0x2e')]);_0xae0bc4(_0x57f6ec[_0xaa74('0x2e')]);});});}function getTicket(_0x56c7cf,_0x888cc1,_0x1b1a4a,_0x2a3e63,_0x5bcc67){return function(_0x3bbd50){logger[_0xaa74('0xf')](_0xaa74('0x2f'));return new Promise(function(_0x562d03,_0x20b1c3){var _0x529fdf=moment();var _0x151d2a={'method':_0xaa74('0x29'),'uri':_0x1b1a4a+'/api/tasks','body':{'title':intUtil[_0xaa74('0x30')](_0x2a3e63['Subjects'],_0x5bcc67,'\x20'),'description':intUtil[_0xaa74('0x30')](_0x2a3e63[_0xaa74('0x31')],_0x5bcc67,'\x0a'),'owner_id':_0x3bbd50[_0xaa74('0x1a')],'creater_id':_0x3bbd50[_0xaa74('0x15')],'targetable_id':_0x3bbd50['endUserId'],'targetable_type':_0xaa74('0x32'),'created_at':_0x529fdf[_0xaa74('0x2b')](_0xaa74('0x33')),'due_date':_0x529fdf[_0xaa74('0x34')](0x1e,'m')[_0xaa74('0x2b')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x151d2a[_0xaa74('0xe')]=_0x888cc1;return rp(_0x151d2a)[_0xaa74('0x10')](function(_0x560658){_0x3bbd50[_0xaa74('0x35')]=_0x560658['task']['id'];logger[_0xaa74('0xf')](_0xaa74('0x36'),_0x3bbd50['ticketId']);_0x562d03(_0x3bbd50);})[_0xaa74('0x28')](function(_0xf01dde){logger[_0xaa74('0x1d')]('['+[_0x56c7cf[_0xaa74('0x2d')]()]+']',_0xf01dde[_0xaa74('0x2e')]);_0x20b1c3(_0xf01dde[_0xaa74('0x2e')]);});});};}function emit(_0x4d424b,_0x3936bf,_0x2f6295){var _0x23116a={'uri':_0x4d424b+'/contacts/'+_0x2f6295};io['to'](util[_0xaa74('0x2b')](_0xaa74('0x37'),_0x3936bf))[_0xaa74('0x38')]('trigger:browser:url',_0x23116a);}exports['cs']=function(_0x764c14,_0x519846,_0x3631ed,_0x2a81e8,_0x52b2f5,_0x1a0a5f,_0x15e073,_0x28c34c){var _0x2f8254={};var _0x1584d8={'Authorization':_0xaa74('0x39')+_0x1a0a5f[_0xaa74('0x3a')]};_0x1a0a5f[_0xaa74('0x3b')]=intUtil['stripTrailingSlash'](_0x1a0a5f['remoteUri']);_0x1a0a5f[_0xaa74('0x3c')]=intUtil[_0xaa74('0x3d')](_0x1a0a5f[_0xaa74('0x3c')]);var _0x49cec8=_0x1a0a5f['remoteUri'];_0x2f8254['adminEmail']=_0x1a0a5f[_0xaa74('0x3e')];_0x2f8254[_0xaa74('0x2a')]=_0x28c34c[_0xaa74('0x3f')]()===_0xaa74('0x40')?_0x519846['destcalleridnum']:_0x519846['calleridnum'];_0x2f8254['callDirection']=_0x28c34c===_0xaa74('0x41')||_0x28c34c===_0xaa74('0x42')?_0xaa74('0x41'):'outbound';if(_0x2a81e8){_0x2f8254['agentEmail']=_0x2a81e8[_0xaa74('0x13')];}var _0x38ab13=util[_0xaa74('0x2b')](_0xaa74('0x43'),_0x1a0a5f[_0xaa74('0x3c')],_0x519846['uniqueid'],md5(_0x519846[_0xaa74('0x44')]));if(_0x52b2f5&&_0x52b2f5[_0xaa74('0x45')]){logger[_0xaa74('0xf')]('[QUEUE]',_0xaa74('0x46'));_0x519846['recordingURL']=_0x38ab13;}else if(_0x15e073&&_0x15e073['recordingFormat']&&_0x15e073['recordingFormat']!==_0xaa74('0x47')){logger[_0xaa74('0xf')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x519846[_0xaa74('0x48')]=_0x38ab13;}else{_0x519846[_0xaa74('0x48')]='';}return getAdminId(_0x2f8254,_0x28c34c,_0x1584d8,_0x49cec8)[_0xaa74('0x10')](getUser(_0x28c34c,_0x1584d8,_0x49cec8))[_0xaa74('0x10')](getEndUser(_0x28c34c,_0x1584d8,_0x49cec8))[_0xaa74('0x10')](getTicket(_0x28c34c,_0x1584d8,_0x49cec8,_0x3631ed,_0x519846))[_0xaa74('0x10')](function(_0x10bb23){logger[_0xaa74('0xf')](util[_0xaa74('0x2b')](_0xaa74('0x49'),_0x10bb23[_0xaa74('0x35')]));if(_0x28c34c!==_0xaa74('0x42')){logger[_0xaa74('0xf')]('['+[_0x28c34c[_0xaa74('0x2d')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x49cec8,_0x2a81e8[_0xaa74('0x4a')],_0x10bb23[_0xaa74('0x24')]);}})[_0xaa74('0x28')](function(_0x1ab376){logger[_0xaa74('0x1d')]('['+[_0x28c34c[_0xaa74('0x2d')]()]+_0xaa74('0x4b'),util['inspect'](_0x1ab376,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x43fd=['headers','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','catch','message','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','moment','bluebird','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase'];(function(_0x5b8871,_0xfe7ea1){var _0x57d152=function(_0x3bfb9d){while(--_0x3bfb9d){_0x5b8871['push'](_0x5b8871['shift']());}};_0x57d152(++_0xfe7ea1);}(_0x43fd,0x1ec));var _0xd43f=function(_0x5e82e0,_0x26d739){_0x5e82e0=_0x5e82e0-0x0;var _0x2cc3e4=_0x43fd[_0x5e82e0];return _0x2cc3e4;};'use strict';var _=require('lodash');var rp=require(_0xd43f('0x0'));var md5=require('md5');var util=require('util');var moment=require(_0xd43f('0x1'));var Promise=require(_0xd43f('0x2'));var Redis=require('ioredis');var intUtil=require(_0xd43f('0x3'));var config=require('../../../../config/environment');var logger=require(_0xd43f('0x4'))(_0xd43f('0x5'));config[_0xd43f('0x6')]=_[_0xd43f('0x7')](config['redis'],{'host':_0xd43f('0x8'),'port':0x18eb});var io=require(_0xd43f('0x9'))(new Redis(config[_0xd43f('0x6')]));function getAdminId(_0x331163,_0x547e12,_0x19c71d,_0x20d066){return new Promise(function(_0x52e9c8,_0x474216){var _0x2d5011=![];var _0x114c2e={'method':_0xd43f('0xa'),'uri':_0x20d066+_0xd43f('0xb'),'json':!![]};_0x114c2e['headers']=_0x19c71d;logger[_0xd43f('0xc')](_0xd43f('0xd'));return rp(_0x114c2e)[_0xd43f('0xe')](function(_0x1ed31a){if(_0x1ed31a){var _0x430977=_0x1ed31a[_0xd43f('0xf')];var _0x22f057=null;for(_0x22f057=0x0;_0x22f057<_0x430977[_0xd43f('0x10')];_0x22f057++){if(_0x430977[_0x22f057][_0xd43f('0x11')]===_0x331163[_0xd43f('0x12')]){_0x331163[_0xd43f('0x13')]=_0x430977[_0x22f057]['id'];_0x2d5011=!![];}}if(_0x2d5011){logger['info'](_0xd43f('0x14'),_0x331163[_0xd43f('0x13')]);_0x52e9c8(_0x331163);}else{_0x474216({'statusCode':0x194,'message':_0xd43f('0x15')});}}else{_0x474216({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x4a2b49){logger[_0xd43f('0x16')]('['+[_0x547e12[_0xd43f('0x17')]()]+']',_0x4a2b49['message']);_0x474216(_0x4a2b49);});});}function getUser(_0x3c0953,_0x3647df,_0x57635e){return function(_0x5ced70){return new Promise(function(_0x4fd639,_0x54bbcd){var _0x135734={'method':_0xd43f('0xa'),'uri':_0x57635e+'/api/selector/owners','json':!![]};_0x135734[_0xd43f('0x18')]=_0x3647df;logger[_0xd43f('0xc')](_0xd43f('0x19'));return rp(_0x135734)[_0xd43f('0xe')](function(_0x5deaed){if(_0x5deaed){var _0xa86810=_0x5deaed[_0xd43f('0xf')];var _0xb37d52=![];var _0x564261=null;if(_0x5ced70['agentEmail']!==null){logger['info'](_0xd43f('0x1a'),_0x5ced70[_0xd43f('0x1b')]);_0x5ced70[_0xd43f('0x1c')]=_0x5ced70[_0xd43f('0x1b')];for(_0x564261=0x0;_0x564261<_0xa86810[_0xd43f('0x10')];_0x564261++){if(_0xa86810[_0x564261][_0xd43f('0x11')]===_0x5ced70[_0xd43f('0x1b')]){_0xb37d52=!![];_0x5ced70['userId']=_0xa86810[_0x564261]['id'];logger[_0xd43f('0xc')]('User\x20found:',_0x5ced70[_0xd43f('0x1d')]);}}}if(!_0xb37d52){logger['info']('Admin\x20selected');_0x5ced70[_0xd43f('0x1c')]=_0x5ced70[_0xd43f('0x12')];_0x5ced70[_0xd43f('0x1d')]=_0x5ced70[_0xd43f('0x13')];_0xb37d52=!![];}if(_0xb37d52){_0x4fd639(_0x5ced70);}else{_0x54bbcd({'statusCode':0x194,'message':_0xd43f('0x15')});}}else{_0x54bbcd({'statusCode':0x194,'message':_0xd43f('0x15')});}})[_0xd43f('0x1e')](function(_0xc2e3da){logger[_0xd43f('0x16')]('['+[_0x3c0953['toUpperCase']()]+']',_0xc2e3da[_0xd43f('0x1f')]);_0x54bbcd(_0xc2e3da);});});};}function searchContact(_0x2d5915,_0x366cf7,_0x2d54a7,_0x209ccd){return new Promise(function(_0x4a8b4d,_0x161540){var _0x7b6761={'method':_0xd43f('0xa'),'headers':_0x366cf7,'uri':_0x2d5915+_0xd43f('0x20')+_0x209ccd+_0xd43f('0x21')+_0x2d54a7+_0xd43f('0x22'),'json':!![]};rp(_0x7b6761)['then'](function(_0x1e54d0){var _0x1f476d=_['find'](_0x1e54d0[_0xd43f('0x23')]['contacts'],[_0x2d54a7,_0x209ccd]);_0x4a8b4d(_0x1f476d);})['catch'](function(_0x45e84a){_0x161540(_0x45e84a);});});}function getEndUser(_0x18472c,_0x29e123,_0x4d032e){return function(_0x410921){return new Promise(function(_0x23c4f7,_0x5bba3d){logger['info'](util[_0xd43f('0x24')](_0xd43f('0x25'),_0x410921[_0xd43f('0x26')]));searchContact(_0x4d032e,_0x29e123,_0xd43f('0x27'),_0x410921['contactNumber'])[_0xd43f('0xe')](function(_0x24015b){if(_0x24015b){_0x410921[_0xd43f('0x28')]=_0x24015b['id'];logger[_0xd43f('0xc')](_0xd43f('0x29'),_0x410921[_0xd43f('0x28')]);return _0x23c4f7(_0x410921);}searchContact(_0x4d032e,_0x29e123,_0xd43f('0x2a'),_0x410921['contactNumber'])[_0xd43f('0xe')](function(_0x57ac0f){if(_0x57ac0f){_0x410921[_0xd43f('0x28')]=_0x57ac0f['id'];logger[_0xd43f('0xc')](_0xd43f('0x2b'),_0x410921['endUserId']);return _0x23c4f7(_0x410921);}createEndUser(_0x410921,_0x18472c,_0x29e123,_0x4d032e)[_0xd43f('0xe')](function(_0x2ccd50){logger['info'](_0xd43f('0x2c'),_0x2ccd50[_0xd43f('0x28')]);return _0x23c4f7(_0x2ccd50);});});})[_0xd43f('0x1e')](function(_0x4ed4eb){_0x5bba3d(_0x4ed4eb);});});};}function createEndUser(_0x291f05,_0x13f996,_0x1c0d7f,_0x20682d){return new Promise(function(_0x176aac,_0x5bce4d){var _0x3386d9=moment();var _0x4b1c73={'method':_0xd43f('0x2d'),'uri':_0x20682d+_0xd43f('0x2e'),'body':{'contact':{'last_name':_0x291f05[_0xd43f('0x26')],'work_number':_0x291f05['contactNumber'],'mobile_number':_0x291f05[_0xd43f('0x26')],'owner_id':_0x291f05[_0xd43f('0x1d')],'created_at':_0x3386d9['format'](_0xd43f('0x2f'))}},'json':!![]};_0x4b1c73['headers']=_0x1c0d7f;logger['info'](_0xd43f('0x30'));return rp(_0x4b1c73)['then'](function(_0x5b648f){_0x291f05[_0xd43f('0x28')]=_0x5b648f['contact']['id'];_0x176aac(_0x291f05);})['catch'](function(_0x10679a){logger[_0xd43f('0x16')]('['+[_0x13f996[_0xd43f('0x17')]()]+']',_0x10679a[_0xd43f('0x1f')]);_0x5bce4d(_0x10679a[_0xd43f('0x1f')]);});});}function getTicket(_0x5caa8c,_0x44d29f,_0x236571,_0x8016ca,_0x3a823b){return function(_0x31e8c2){logger[_0xd43f('0xc')](_0xd43f('0x31'));return new Promise(function(_0x41f7e4,_0x173b01){var _0x3929e9=moment();var _0x37f496={'method':'POST','uri':_0x236571+_0xd43f('0x32'),'body':{'title':intUtil[_0xd43f('0x33')](_0x8016ca['Subjects'],_0x3a823b,'\x20'),'description':intUtil['getString'](_0x8016ca[_0xd43f('0x34')],_0x3a823b,'\x0a'),'owner_id':_0x31e8c2[_0xd43f('0x1d')],'creater_id':_0x31e8c2[_0xd43f('0x13')],'targetable_id':_0x31e8c2['endUserId'],'targetable_type':_0xd43f('0x35'),'created_at':_0x3929e9[_0xd43f('0x24')](_0xd43f('0x2f')),'due_date':_0x3929e9[_0xd43f('0x36')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x37f496[_0xd43f('0x18')]=_0x44d29f;return rp(_0x37f496)[_0xd43f('0xe')](function(_0x156e8a){_0x31e8c2['ticketId']=_0x156e8a[_0xd43f('0x37')]['id'];logger[_0xd43f('0xc')](_0xd43f('0x38'),_0x31e8c2[_0xd43f('0x39')]);_0x41f7e4(_0x31e8c2);})[_0xd43f('0x1e')](function(_0xc2a5a6){logger[_0xd43f('0x16')]('['+[_0x5caa8c[_0xd43f('0x17')]()]+']',_0xc2a5a6['message']);_0x173b01(_0xc2a5a6[_0xd43f('0x1f')]);});});};}function emit(_0x464d7d,_0x386dfa,_0x400273){var _0x343902={'uri':_0x464d7d+_0xd43f('0x3a')+_0x400273};io['to'](util[_0xd43f('0x24')](_0xd43f('0x3b'),_0x386dfa))[_0xd43f('0x3c')](_0xd43f('0x3d'),_0x343902);}exports['cs']=function(_0x3a17fe,_0x517509,_0x440627,_0x15d79c,_0x3b6d79,_0x237bc1,_0x45207d,_0x4763b7){var _0x54eaa2={};var _0x9e1727={'Authorization':'Token\x20token='+_0x237bc1[_0xd43f('0x3e')]};_0x237bc1['remoteUri']=intUtil[_0xd43f('0x3f')](_0x237bc1[_0xd43f('0x40')]);_0x237bc1[_0xd43f('0x41')]=intUtil[_0xd43f('0x3f')](_0x237bc1[_0xd43f('0x41')]);var _0x2eb1bf=_0x237bc1[_0xd43f('0x40')];_0x54eaa2[_0xd43f('0x12')]=_0x237bc1[_0xd43f('0x42')];_0x54eaa2['contactNumber']=_0x4763b7[_0xd43f('0x43')]()===_0xd43f('0x44')?_0x517509[_0xd43f('0x45')]:_0x517509[_0xd43f('0x46')];_0x54eaa2[_0xd43f('0x47')]=_0x4763b7===_0xd43f('0x48')||_0x4763b7===_0xd43f('0x49')?_0xd43f('0x48'):_0xd43f('0x44');if(_0x15d79c){_0x54eaa2[_0xd43f('0x1b')]=_0x15d79c[_0xd43f('0x11')];}var _0x5bb8e5=util['format'](_0xd43f('0x4a'),_0x237bc1[_0xd43f('0x41')],_0x517509[_0xd43f('0x4b')],md5(_0x517509['uniqueid']));if(_0x3b6d79&&_0x3b6d79['monitor_format']){logger[_0xd43f('0xc')](_0xd43f('0x4c'),_0xd43f('0x4d'));_0x517509[_0xd43f('0x4e')]=_0x5bb8e5;}else if(_0x45207d&&_0x45207d[_0xd43f('0x4f')]&&_0x45207d['recordingFormat']!==_0xd43f('0x50')){logger[_0xd43f('0xc')](_0xd43f('0x51'),_0xd43f('0x4d'));_0x517509[_0xd43f('0x4e')]=_0x5bb8e5;}else{_0x517509[_0xd43f('0x4e')]='';}return getAdminId(_0x54eaa2,_0x4763b7,_0x9e1727,_0x2eb1bf)['then'](getUser(_0x4763b7,_0x9e1727,_0x2eb1bf))[_0xd43f('0xe')](getEndUser(_0x4763b7,_0x9e1727,_0x2eb1bf))[_0xd43f('0xe')](getTicket(_0x4763b7,_0x9e1727,_0x2eb1bf,_0x440627,_0x517509))[_0xd43f('0xe')](function(_0x376d02){logger[_0xd43f('0xc')](util[_0xd43f('0x24')](_0xd43f('0x52'),_0x376d02[_0xd43f('0x39')]));if(_0x4763b7!=='unmanaged'){logger[_0xd43f('0xc')]('['+[_0x4763b7[_0xd43f('0x17')]()]+']',_0xd43f('0x53'));emit(_0x2eb1bf,_0x15d79c['name'],_0x376d02[_0xd43f('0x28')]);}})[_0xd43f('0x1e')](function(_0xb719d){logger[_0xd43f('0x16')]('['+[_0x4763b7[_0xd43f('0x17')]()]+_0xd43f('0x54'),util[_0xd43f('0x55')](_0xb719d,{'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 e23aff3..19f0635 100644 --- a/server/services/ami/trigger/integration/index.js +++ b/server/services/ami/trigger/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./dynamics365','./freshsales','zendesk','freshdesk','zoho','desk','freshsales','data1','toLowerCase','data2','find','Configurations','queue','outbound','log','unmanaged','salesforce','sugarcrm','vtiger','servicenow','dynamics365'];(function(_0x1bc77c,_0x8bf8da){var _0xd9fe11=function(_0x2ca2e4){while(--_0x2ca2e4){_0x1bc77c['push'](_0x1bc77c['shift']());}};_0xd9fe11(++_0x8bf8da);}(_0x14a0,0x8e));var _0x014a=function(_0xf6fc7c,_0x4c29ab){_0xf6fc7c=_0xf6fc7c-0x0;var _0xccc936=_0x14a0[_0xf6fc7c];return _0xccc936;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var zendesk=require(_0x014a('0x1'));var salesforce=require(_0x014a('0x2'));var sugarcrm=require(_0x014a('0x3'));var freshdesk=require(_0x014a('0x4'));var zoho=require(_0x014a('0x5'));var desk=require(_0x014a('0x6'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x014a('0x7'));var freshsales=require(_0x014a('0x8'));var integrations=[_0x014a('0x9'),'salesforce','sugarcrm',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'vtiger','dynamics365',_0x014a('0xd'),'servicenow'];exports['exec']=function(_0x5aa52f,_0x4f3539,_0x330469,_0x4c7418,_0x431be8,_0x168c70){if(_0x330469){if(_['includes'](integrations,_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]())){try{var _0x2c84ad=null;var _0x43bfeb='';var _0x1bcd1=_0x330469[_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]()];if(_0x1bcd1){var _0x23c917=_0x1bcd1[_0x5aa52f[_0x014a('0x10')]];if(_0x23c917){var _0x71535d=_[_0x014a('0x11')](_0x23c917[_0x014a('0x12')],{'id':parseInt(_0x5aa52f['data3'],0xa)});if(_0x71535d){if(_0x4c7418){if(_0x431be8&&_0x4f3539[_0x014a('0x13')]){_0x43bfeb=_0x014a('0x13');}else if(_0x4f3539['routeId']){_0x43bfeb=_0x014a('0x14');}else{console[_0x014a('0x15')]('EVENT\x20UNKNOWN',_0x4f3539);}}else{_0x43bfeb=_0x014a('0x16');}switch(_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]()){case _0x014a('0x9'):zendesk[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0x17'):salesforce[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0x18'):sugarcrm[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xa'):freshdesk[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xb'):zoho[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xc'):desk[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0x19'):vtiger[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xd'):freshsales['cs'](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70,_0x43bfeb);break;case _0x014a('0x1a'):servicenow['cs'](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70,_0x43bfeb);break;case _0x014a('0x1b'):dynamics365['cs'](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70,_0x43bfeb);break;default:console[_0x014a('0x15')]('unknown\x20integration');}}else{_0x2c84ad=require(_0x014a('0x1c'))(_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]());_0x2c84ad[_0x014a('0x1d')](_0x014a('0x1e'),util[_0x014a('0x1f')](_0x014a('0x20'),_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')](),_0x5aa52f['data3']));}}else{_0x2c84ad=require(_0x014a('0x1c'))(_0x5aa52f['data1'][_0x014a('0xf')]());_0x2c84ad[_0x014a('0x1d')](_0x014a('0x1e'),util[_0x014a('0x1f')](_0x014a('0x21'),_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')](),_0x5aa52f[_0x014a('0x10')]));}}else{}}catch(_0x165a42){console['error'](_0x165a42);}}}}; \ No newline at end of file +var _0xe605=['./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','freshdesk','vtiger','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho'];(function(_0x5ac954,_0x541d45){var _0x16b423=function(_0xb35748){while(--_0xb35748){_0x5ac954['push'](_0x5ac954['shift']());}};_0x16b423(++_0x541d45);}(_0xe605,0x92));var _0x5e60=function(_0x2c8572,_0x1491c2){_0x2c8572=_0x2c8572-0x0;var _0xac8a95=_0xe605[_0x2c8572];return _0xac8a95;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x5e60('0x2'));var sugarcrm=require(_0x5e60('0x3'));var freshdesk=require(_0x5e60('0x4'));var zoho=require(_0x5e60('0x5'));var desk=require(_0x5e60('0x6'));var vtiger=require(_0x5e60('0x7'));var servicenow=require(_0x5e60('0x8'));var dynamics365=require(_0x5e60('0x9'));var freshsales=require(_0x5e60('0xa'));var integrations=[_0x5e60('0xb'),_0x5e60('0xc'),_0x5e60('0xd'),'freshdesk',_0x5e60('0xe'),'desk','vtiger','dynamics365',_0x5e60('0xf'),_0x5e60('0x10')];exports[_0x5e60('0x11')]=function(_0x2c5425,_0x331b3e,_0x2cbe4e,_0x56f05a,_0x6ab0ce,_0x527f7b){if(_0x2cbe4e){if(_[_0x5e60('0x12')](integrations,_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]())){try{var _0x51e7f6=null;var _0x371df7='';var _0x178782=_0x2cbe4e[_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]()];if(_0x178782){var _0x2874c4=_0x178782[_0x2c5425[_0x5e60('0x15')]];if(_0x2874c4){var _0x4fd10e=_[_0x5e60('0x16')](_0x2874c4[_0x5e60('0x17')],{'id':parseInt(_0x2c5425[_0x5e60('0x18')],0xa)});if(_0x4fd10e){if(_0x56f05a){if(_0x6ab0ce&&_0x331b3e[_0x5e60('0x19')]){_0x371df7='queue';}else if(_0x331b3e[_0x5e60('0x1a')]){_0x371df7='outbound';}else{console[_0x5e60('0x1b')](_0x5e60('0x1c'),_0x331b3e);}}else{_0x371df7='unmanaged';}switch(_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]()){case _0x5e60('0xb'):zendesk[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0xc'):salesforce[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case'sugarcrm':sugarcrm[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0x1d'):freshdesk[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0xe'):zoho[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case'desk':desk[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0x1e'):vtiger[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0xf'):freshsales['cs'](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b,_0x371df7);break;case _0x5e60('0x10'):servicenow['cs'](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b,_0x371df7);break;case _0x5e60('0x1f'):dynamics365['cs'](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b,_0x371df7);break;default:console[_0x5e60('0x1b')](_0x5e60('0x20'));}}else{_0x51e7f6=require(_0x5e60('0x21'))(_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]());_0x51e7f6[_0x5e60('0x22')](_0x5e60('0x23'),util['format'](_0x5e60('0x24'),_0x2c5425['data1'][_0x5e60('0x14')](),_0x2c5425[_0x5e60('0x18')]));}}else{_0x51e7f6=require(_0x5e60('0x21'))(_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]());_0x51e7f6[_0x5e60('0x22')](_0x5e60('0x23'),util['format'](_0x5e60('0x25'),_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')](),_0x2c5425['data2']));}}else{}}catch(_0x45cb62){console[_0x5e60('0x22')](_0x45cb62);}}}}; \ 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 401b0b4..33a52e2 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 _0x08c5=['resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','lead','Case','contact','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.','Company','No\x20Company','upperFirst','string','idField','toString','type','variable','variableName','customVariable','Variable','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','name','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','recordingURL','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','emit','ticketType','Task','assign','utc','getString','Subjects','Descriptions','WhoId','ContactId','sobject','create','isNil','validateEmail','User','find','execute','length','info','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then'];(function(_0xff6314,_0xdd09b){var _0x1d38f4=function(_0x25b328){while(--_0x25b328){_0xff6314['push'](_0xff6314['shift']());}};_0x1d38f4(++_0xdd09b);}(_0x08c5,0x197));var _0x508c=function(_0x1acb08,_0x1a1c0e){_0x1acb08=_0x1acb08-0x0;var _0x183cef=_0x08c5[_0x1acb08];return _0x183cef;};'use strict';var _=require(_0x508c('0x0'));var rp=require('request-promise');var moment=require(_0x508c('0x1'));var BPromise=require(_0x508c('0x2'));var md5=require('md5');var jsforce=require(_0x508c('0x3'));var util=require(_0x508c('0x4'));var Redis=require('ioredis');var intUtil=require(_0x508c('0x5'));var config=require(_0x508c('0x6'));var logger=require(_0x508c('0x7'))(_0x508c('0x8'));config[_0x508c('0x9')]=_['defaults'](config[_0x508c('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x508c('0x9')]));function emit(_0x47aaec,_0x254413,_0x41b5d4){io['to'](_0x47aaec)[_0x508c('0xa')](_0x254413,_0x41b5d4);}function getTicket(_0x8d145a,_0xc2b6d8,_0x295549,_0x2674cc,_0x408bfb,_0x3e78de,_0x2b11d2,_0xa8da75){var _0x77b64c={};if(_0x2674cc[_0x508c('0xb')]===_0x508c('0xc')){_0x77b64c=Object[_0x508c('0xd')]({},{'OwnerId':_0xc2b6d8['id'],'ActivityDate':moment[_0x508c('0xe')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x508c('0xf')](_0x2674cc[_0x508c('0x10')],_0x408bfb,'\x20'),'Description':intUtil[_0x508c('0xf')](_0x2674cc[_0x508c('0x11')],_0x408bfb,'\x0a')},getCustomFields(_0x3e78de,_0x408bfb));if(_0x295549){_0x77b64c[_0x508c('0x12')]=_0x295549['id'];}}else if(_0x2674cc['ticketType']==='Case'){_0x77b64c=Object[_0x508c('0xd')]({},{'OwnerId':_0xc2b6d8['id'],'Subject':intUtil['getString'](_0x2674cc[_0x508c('0x10')],_0x408bfb,'\x20'),'Description':intUtil[_0x508c('0xf')](_0x2674cc['Descriptions'],_0x408bfb,'\x0a')},getCustomFields(_0x3e78de,_0x408bfb));if(_0x295549){_0x77b64c[_0x508c('0x13')]=_0x295549['id'];}}return _0x2b11d2[_0x508c('0x14')](_0x2674cc[_0x508c('0xb')])[_0x508c('0x15')](_0x77b64c);}function getUser(_0x458860,_0x160875,_0x4ffe57){if(!_[_0x508c('0x16')](_0x160875)&&intUtil[_0x508c('0x17')](_0x160875)){var _0x2850b3={'Email':_0x160875};var _0x2f470e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4ffe57[_0x508c('0x14')](_0x508c('0x18'))[_0x508c('0x19')](_0x2850b3,_0x2f470e)[_0x508c('0x1a')]()['then'](function(_0x453398){if(_0x453398[_0x508c('0x1b')]){var _0x3dbfd4=_['find'](_0x453398,function(_0x1b3ff0){return _0x1b3ff0['Email']===_0x160875;});if(_0x3dbfd4){logger[_0x508c('0x1c')]('Agent\x20%s\x20found.',_0x160875);return BPromise['resolve']({'id':_0x3dbfd4['Id'],'name':_0x3dbfd4[_0x508c('0x1d')]});}}else{logger[_0x508c('0x1c')](_0x508c('0x1e'),_0x160875);return _0x4ffe57[_0x508c('0x1f')]()[_0x508c('0x20')](function(_0x518092){return BPromise[_0x508c('0x21')]({'id':_0x518092[_0x508c('0x22')],'name':_0x518092[_0x508c('0x23')]});});}});}else{logger['info'](_0x508c('0x1e'),_0x160875);return _0x4ffe57[_0x508c('0x1f')]()[_0x508c('0x20')](function(_0x3b9061){return BPromise['resolve']({'id':_0x3b9061[_0x508c('0x22')],'name':_0x3b9061[_0x508c('0x23')]});});}}function getEndUser(_0x217a13,_0x5c6d3f,_0x1a2bba,_0x41dc72,_0x2b6a74){var _0x1cc702={'Phone':_0x41dc72};var _0x132245={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x508c('0x21')]()[_0x508c('0x20')](function(){if(_0x5c6d3f['ticketType']===_0x508c('0xc')){logger[_0x508c('0x1c')](_0x508c('0x24'),_0x41dc72,_0x5c6d3f['moduleSearch']);switch(_0x5c6d3f[_0x508c('0x25')]){case _0x508c('0x26'):return _0x2b6a74[_0x508c('0x14')](_0x508c('0x27'))['find'](_0x1cc702,_0x132245)[_0x508c('0x1a')]()[_0x508c('0x20')](function(_0x4d8f0f){if(_0x4d8f0f&&_0x4d8f0f[_0x508c('0x1b')]){return _0x4d8f0f;}else{return _0x2b6a74[_0x508c('0x14')](_0x508c('0x28'))['find'](_0x1cc702,_0x132245);}});case'contact':return _0x2b6a74[_0x508c('0x14')](_0x508c('0x27'))[_0x508c('0x19')](_0x1cc702,_0x132245)[_0x508c('0x1a')]();case _0x508c('0x29'):return _0x2b6a74[_0x508c('0x14')](_0x508c('0x28'))['find'](_0x1cc702,_0x132245);default:return null;}}else if(_0x5c6d3f[_0x508c('0xb')]===_0x508c('0x2a')){logger[_0x508c('0x1c')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x41dc72,_0x508c('0x2b'));return _0x2b6a74[_0x508c('0x14')]('Contact')[_0x508c('0x19')](_0x1cc702,_0x132245)[_0x508c('0x1a')]();}})['then'](function(_0x1337ad){if(_0x1337ad&&_0x1337ad[_0x508c('0x1b')]){var _0x37e1c1=_[_0x508c('0x19')](_0x1337ad,function(_0x4185cf){return _0x4185cf[_0x508c('0x2c')]===_0x41dc72;});if(_0x37e1c1){return BPromise[_0x508c('0x21')]({'id':_0x37e1c1['Id'],'name':_0x37e1c1[_0x508c('0x1d')],'phone':_0x37e1c1[_0x508c('0x2c')]});}}})[_0x508c('0x20')](function(_0x39970e){if(_0x39970e){logger[_0x508c('0x1c')](_0x508c('0x2d'),_0x41dc72);return BPromise[_0x508c('0x21')](_0x39970e);}else{logger['info'](_0x508c('0x2e'),_0x41dc72);var _0x4a6690={'LastName':_0x1a2bba!==''?_0x1a2bba:util[_0x508c('0x2f')](_0x508c('0x30'),_0x41dc72),'Phone':_0x41dc72};if(_0x5c6d3f[_0x508c('0x31')]){if(_0x5c6d3f[_0x508c('0x31')]===_0x508c('0x2b')){logger[_0x508c('0x1c')](_0x508c('0x32'),_0x41dc72,_0x5c6d3f[_0x508c('0x31')]);}else if(_0x5c6d3f[_0x508c('0x31')]===_0x508c('0x29')&&_0x5c6d3f['ticketType']==='Task'){logger[_0x508c('0x1c')](_0x508c('0x32'),_0x41dc72,_0x5c6d3f['moduleCreate']);_0x4a6690[_0x508c('0x33')]=_0x508c('0x34');}else{return null;}}return _0x2b6a74[_0x508c('0x14')](_[_0x508c('0x35')](_0x5c6d3f[_0x508c('0x31')]))[_0x508c('0x15')](_0x4a6690);}});}function getCustomFields(_0x93c557,_0x49ad29){var _0x385a1d={};if(_0x93c557['length']>0x0){_['forEach'](_0x93c557,function(_0x5004d6){if(_0x5004d6['type']===_0x508c('0x36')&&_0x5004d6['idField']){_0x385a1d[_0x5004d6[_0x508c('0x37')]]=_0x5004d6['content'][_0x508c('0x38')]();}else if(_0x5004d6[_0x508c('0x39')]===_0x508c('0x3a')&&_0x5004d6['variableName']&&_0x5004d6[_0x508c('0x37')]){_0x49ad29[_0x5004d6['variableName']]&&(_0x385a1d[_0x5004d6[_0x508c('0x37')]]=_0x49ad29[_0x5004d6[_0x508c('0x3b')]][_0x508c('0x38')]());}else if(_0x5004d6[_0x508c('0x39')]===_0x508c('0x3c')&&_0x5004d6['Variable']&&_0x5004d6[_0x508c('0x3d')]['name']&&_0x5004d6['idField']){_0x49ad29[_0x5004d6[_0x508c('0x3d')]['name']['toLowerCase']()]&&(_0x385a1d[_0x5004d6[_0x508c('0x37')]]=_0x49ad29[_0x5004d6['Variable']['name']['toLowerCase']()][_0x508c('0x38')]());}});}return _0x385a1d;}function getConnection(_0x55ba4b){var _0x57d01b=_0x55ba4b[_0x508c('0x3e')][_0x508c('0x3f')](_0x55ba4b[_0x508c('0x40')]);var _0x13c205=new jsforce[(_0x508c('0x41'))]({'oauth2':{'loginUrl':_0x55ba4b[_0x508c('0x42')]||_0x508c('0x43'),'clientId':_0x55ba4b['clientId'],'clientSecret':_0x55ba4b[_0x508c('0x44')]}});return _0x13c205[_0x508c('0x45')](_0x55ba4b[_0x508c('0x46')],_0x57d01b)[_0x508c('0x20')](function(){logger[_0x508c('0x1c')](_0x508c('0x47'));return _0x13c205;});}exports['queue']=function(_0x132639,_0x3f1678,_0x267b5e,_0x405b04,_0x5dc376,_0xe6810e){var _0x321bc5,_0x33dd1f,_0x495f50,_0x54fcac;_0xe6810e[_0x508c('0x48')]=intUtil['stripTrailingSlash'](_0xe6810e['serverUrl']);_0xe6810e[_0x508c('0x42')]=intUtil['stripTrailingSlash'](_0xe6810e['remoteUri']);if(_0x5dc376&&_0x5dc376[_0x508c('0x49')]){logger[_0x508c('0x1c')](_0x508c('0x4a'),_0x508c('0x4b'));_0x3f1678['recordingURL']=util['format'](_0x508c('0x4c'),_0xe6810e['serverUrl'],_0x3f1678['uniqueid'],md5(_0x3f1678['uniqueid']));}else{_0x3f1678['recordingURL']='';}return getConnection(_0xe6810e)['then'](function(_0x1c432e){_0x54fcac=_0x1c432e;return getUser(_0xe6810e,_0x405b04['email'],_0x54fcac);})['then'](function(_0x36dc38){_0x321bc5=_0x36dc38;return getEndUser(_0xe6810e,_0x267b5e,_0x3f1678[_0x508c('0x4d')],_0x3f1678[_0x508c('0x4e')],_0x54fcac);})[_0x508c('0x20')](function(_0x8da8e1){_0x33dd1f=_0x8da8e1;return getTicket(_0xe6810e,_0x321bc5,_0x33dd1f,_0x267b5e,_0x3f1678,_0x267b5e[_0x508c('0x4f')],_0x54fcac,_0x508c('0x50'));})[_0x508c('0x20')](function(_0x2a40cf){_0x495f50=_0x2a40cf;logger[_0x508c('0x1c')](_0x508c('0x51'),_0x495f50['id']);logger[_0x508c('0x1c')](_0x508c('0x52'),_0x495f50['id'],_0x405b04['name'],_0xe6810e[_0x508c('0x39')]);switch(_0xe6810e[_0x508c('0x39')]){case _0x508c('0x53'):emit(util[_0x508c('0x2f')](_0x508c('0x54'),_0x405b04['name']),_0x508c('0x55'),{'recordId':_0x495f50['id']});break;case _0x508c('0x56'):emit(util[_0x508c('0x2f')]('user:%s',_0x405b04['name']),'trigger:browser:url',{'uri':util[_0x508c('0x2f')](_0x508c('0x57'),_0x54fcac['instanceUrl'],_0x495f50['id'])});break;default:logger[_0x508c('0x58')](_0x508c('0x59'));}})[_0x508c('0x5a')](function(_0x1bc144){logger[_0x508c('0x58')](_0x508c('0x4a'),JSON[_0x508c('0x5b')](_0x1bc144));});};exports[_0x508c('0x5c')]=function(_0x2fc834,_0xe91890,_0x112ece,_0x4a8905,_0x1dd7da,_0x4f30bc,_0x481fe7){var _0x527f45,_0x189302,_0x4ae17d,_0x30f8be;_0x4f30bc['serverUrl']=intUtil[_0x508c('0x5d')](_0x4f30bc[_0x508c('0x48')]);_0x4f30bc['remoteUri']=intUtil[_0x508c('0x5d')](_0x4f30bc[_0x508c('0x42')]);if(_0x481fe7&&_0x481fe7[_0x508c('0x5e')]&&_0x481fe7[_0x508c('0x5e')]!==_0x508c('0x5f')){logger[_0x508c('0x1c')](_0x508c('0x60'),'Recording\x20is\x20enabled!');_0xe91890['recordingURL']=util[_0x508c('0x2f')](_0x508c('0x4c'),_0x4f30bc[_0x508c('0x48')],_0xe91890['uniqueid'],md5(_0xe91890[_0x508c('0x61')]));}return getConnection(_0x4f30bc)[_0x508c('0x20')](function(_0x3222a9){_0x30f8be=_0x3222a9;return getUser(_0x4f30bc,_0x4a8905[_0x508c('0x62')],_0x30f8be);})['then'](function(_0x505f9b){_0x527f45=_0x505f9b;return getEndUser(_0x4f30bc,_0x112ece,_0xe91890[_0x508c('0x63')],_0xe91890[_0x508c('0x64')],_0x30f8be);})[_0x508c('0x20')](function(_0x7bb9f5){_0x189302=_0x7bb9f5;return getTicket(_0x4f30bc,_0x527f45,_0x189302,_0x112ece,_0xe91890,_0x112ece['Fields'],_0x30f8be,_0x508c('0x5c'));})['then'](function(_0x1b840){_0x4ae17d=_0x1b840;logger[_0x508c('0x1c')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x4ae17d['id']);logger[_0x508c('0x1c')](_0x508c('0x65'),_0x4ae17d['id'],_0x4a8905[_0x508c('0x66')],_0x4f30bc[_0x508c('0x39')]);switch(_0x4f30bc[_0x508c('0x39')]){case _0x508c('0x53'):emit(util['format'](_0x508c('0x54'),_0x4a8905[_0x508c('0x66')]),_0x508c('0x55'),{'recordId':_0x4ae17d['id']});break;case _0x508c('0x56'):emit(util['format']('user:%s',_0x4a8905[_0x508c('0x66')]),'trigger:browser:url',{'uri':util[_0x508c('0x2f')](_0x508c('0x57'),_0x30f8be[_0x508c('0x67')],_0x4ae17d['id'])});break;default:logger[_0x508c('0x58')](_0x508c('0x60'),_0x508c('0x68'));}})[_0x508c('0x5a')](function(_0xb06531){logger[_0x508c('0x58')](_0x508c('0x60'),JSON[_0x508c('0x5b')](_0xb06531));});};exports[_0x508c('0x69')]=function(_0x2738e1,_0x421b8d,_0x433bbc,_0x4041bb,_0xd451f8,_0x48b617){var _0x4b01e0,_0x76479b,_0x33cbd6,_0x4028a0;_0x48b617[_0x508c('0x48')]=intUtil[_0x508c('0x5d')](_0x48b617[_0x508c('0x48')]);_0x48b617[_0x508c('0x42')]=intUtil['stripTrailingSlash'](_0x48b617['remoteUri']);if(_0xd451f8&&_0xd451f8[_0x508c('0x49')]){logger[_0x508c('0x1c')]('['+_0x421b8d[_0x508c('0x6a')]['toUpperCase']()+']',_0x508c('0x4b'));_0x421b8d[_0x508c('0x6b')]=util[_0x508c('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x48b617[_0x508c('0x48')],_0x421b8d['uniqueid'],md5(_0x421b8d[_0x508c('0x61')]));}else{_0x421b8d[_0x508c('0x6b')]='';}return getConnection(_0x48b617)[_0x508c('0x20')](function(_0x2aa64a){_0x4028a0=_0x2aa64a;if(!_[_0x508c('0x16')](_0x4041bb)){return getUser(_0x48b617,_0x4041bb[_0x508c('0x66')],_0x4028a0);}else{return getUser(_0x48b617,null,_0x4028a0);}})[_0x508c('0x20')](function(_0x1cc8de){_0x4b01e0=_0x1cc8de;return getEndUser(_0x48b617,_0x433bbc,_0x421b8d[_0x508c('0x4d')],_0x421b8d['calleridnum'],_0x4028a0);})[_0x508c('0x20')](function(_0xdd2f53){_0x76479b=_0xdd2f53;return getTicket(_0x48b617,_0x4b01e0,_0x76479b,_0x433bbc,_0x421b8d,_0x433bbc[_0x508c('0x4f')],_0x4028a0);})[_0x508c('0x20')](function(_0x3d05cc){_0x33cbd6=_0x3d05cc;logger[_0x508c('0x1c')]('['+_0x421b8d[_0x508c('0x6a')][_0x508c('0x6c')]()+']\x20Ticket\x20%s\x20created.',_0x33cbd6['id']);logger[_0x508c('0x1c')]('['+_0x421b8d[_0x508c('0x6a')]['toUpperCase']()+_0x508c('0x6d'),_0x48b617['type']);})[_0x508c('0x5a')](function(_0x5a6695){logger['error']('['+_0x421b8d[_0x508c('0x6a')][_0x508c('0x6c')]()+']',JSON[_0x508c('0x5b')](_0x5a6695));});}; \ No newline at end of file +var _0xdb10=['Email','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','execute','Lead','contact','lead','Case','Phone','Enduser\x20with\x20phone\x20%s\x20found.','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Task','No\x20Company','upperFirst','create','forEach','string','idField','content','toString','type','variable','variableName','customVariable','name','Variable','toLowerCase','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','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.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','stringify','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','WhoId','ContactId','sobject','ticketType','isNil','validateEmail','User','find','then','length'];(function(_0x13dbb1,_0x56edc7){var _0xe196dd=function(_0x8bc97a){while(--_0x8bc97a){_0x13dbb1['push'](_0x13dbb1['shift']());}};_0xe196dd(++_0x56edc7);}(_0xdb10,0x12b));var _0x0db1=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xdb10[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0x0db1('0x0'));var rp=require(_0x0db1('0x1'));var moment=require(_0x0db1('0x2'));var BPromise=require(_0x0db1('0x3'));var md5=require('md5');var jsforce=require(_0x0db1('0x4'));var util=require(_0x0db1('0x5'));var Redis=require(_0x0db1('0x6'));var intUtil=require(_0x0db1('0x7'));var config=require(_0x0db1('0x8'));var logger=require('../../../../config/logger')(_0x0db1('0x9'));config[_0x0db1('0xa')]=_[_0x0db1('0xb')](config['redis'],{'host':_0x0db1('0xc'),'port':0x18eb});var io=require(_0x0db1('0xd'))(new Redis(config[_0x0db1('0xa')]));function emit(_0x3108bc,_0xa7d4ee,_0x5cbd28){io['to'](_0x3108bc)[_0x0db1('0xe')](_0xa7d4ee,_0x5cbd28);}function getTicket(_0x11a94c,_0x296cd5,_0x2dd080,_0x474ab8,_0x5d436f,_0x5c36ff,_0x817227,_0x172b11){var _0x478110={};if(_0x474ab8['ticketType']==='Task'){_0x478110=Object['assign']({},{'OwnerId':_0x296cd5['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x0db1('0xf')](_0x474ab8[_0x0db1('0x10')],_0x5d436f,'\x20'),'Description':intUtil[_0x0db1('0xf')](_0x474ab8[_0x0db1('0x11')],_0x5d436f,'\x0a')},getCustomFields(_0x5c36ff,_0x5d436f));if(_0x2dd080){_0x478110[_0x0db1('0x12')]=_0x2dd080['id'];}}else if(_0x474ab8['ticketType']==='Case'){_0x478110=Object['assign']({},{'OwnerId':_0x296cd5['id'],'Subject':intUtil[_0x0db1('0xf')](_0x474ab8[_0x0db1('0x10')],_0x5d436f,'\x20'),'Description':intUtil[_0x0db1('0xf')](_0x474ab8[_0x0db1('0x11')],_0x5d436f,'\x0a')},getCustomFields(_0x5c36ff,_0x5d436f));if(_0x2dd080){_0x478110[_0x0db1('0x13')]=_0x2dd080['id'];}}return _0x817227[_0x0db1('0x14')](_0x474ab8[_0x0db1('0x15')])['create'](_0x478110);}function getUser(_0x409946,_0x5e3cbc,_0x10c746){if(!_[_0x0db1('0x16')](_0x5e3cbc)&&intUtil[_0x0db1('0x17')](_0x5e3cbc)){var _0xeb4102={'Email':_0x5e3cbc};var _0x38efa0={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x10c746[_0x0db1('0x14')](_0x0db1('0x18'))[_0x0db1('0x19')](_0xeb4102,_0x38efa0)['execute']()[_0x0db1('0x1a')](function(_0x25c9a2){if(_0x25c9a2[_0x0db1('0x1b')]){var _0x564ec9=_[_0x0db1('0x19')](_0x25c9a2,function(_0x4d4583){return _0x4d4583[_0x0db1('0x1c')]===_0x5e3cbc;});if(_0x564ec9){logger['info']('Agent\x20%s\x20found.',_0x5e3cbc);return BPromise['resolve']({'id':_0x564ec9['Id'],'name':_0x564ec9[_0x0db1('0x1d')]});}}else{logger[_0x0db1('0x1e')](_0x0db1('0x1f'),_0x5e3cbc);return _0x10c746[_0x0db1('0x20')]()['then'](function(_0x32e786){return BPromise[_0x0db1('0x21')]({'id':_0x32e786['user_id'],'name':_0x32e786['display_name']});});}});}else{logger['info'](_0x0db1('0x1f'),_0x5e3cbc);return _0x10c746[_0x0db1('0x20')]()[_0x0db1('0x1a')](function(_0x38847d){return BPromise[_0x0db1('0x21')]({'id':_0x38847d['user_id'],'name':_0x38847d['display_name']});});}}function getEndUser(_0x704e15,_0x1682c1,_0x654d77,_0x22120c,_0x39401f){var _0xd32c38={'Phone':_0x22120c};var _0x311ea8={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x0db1('0x21')]()[_0x0db1('0x1a')](function(){if(_0x1682c1[_0x0db1('0x15')]==='Task'){logger[_0x0db1('0x1e')](_0x0db1('0x22'),_0x22120c,_0x1682c1[_0x0db1('0x23')]);switch(_0x1682c1[_0x0db1('0x23')]){case _0x0db1('0x24'):return _0x39401f[_0x0db1('0x14')](_0x0db1('0x25'))['find'](_0xd32c38,_0x311ea8)[_0x0db1('0x26')]()[_0x0db1('0x1a')](function(_0x43e6de){if(_0x43e6de&&_0x43e6de[_0x0db1('0x1b')]){return _0x43e6de;}else{return _0x39401f[_0x0db1('0x14')](_0x0db1('0x27'))[_0x0db1('0x19')](_0xd32c38,_0x311ea8);}});case _0x0db1('0x28'):return _0x39401f[_0x0db1('0x14')](_0x0db1('0x25'))[_0x0db1('0x19')](_0xd32c38,_0x311ea8)['execute']();case _0x0db1('0x29'):return _0x39401f['sobject']('Lead')[_0x0db1('0x19')](_0xd32c38,_0x311ea8);default:return null;}}else if(_0x1682c1[_0x0db1('0x15')]===_0x0db1('0x2a')){logger[_0x0db1('0x1e')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x22120c,_0x0db1('0x28'));return _0x39401f[_0x0db1('0x14')](_0x0db1('0x25'))[_0x0db1('0x19')](_0xd32c38,_0x311ea8)['execute']();}})[_0x0db1('0x1a')](function(_0x57c81a){if(_0x57c81a&&_0x57c81a[_0x0db1('0x1b')]){var _0x54f282=_[_0x0db1('0x19')](_0x57c81a,function(_0x3ebd4f){return _0x3ebd4f[_0x0db1('0x2b')]===_0x22120c;});if(_0x54f282){return BPromise['resolve']({'id':_0x54f282['Id'],'name':_0x54f282['Name'],'phone':_0x54f282[_0x0db1('0x2b')]});}}})['then'](function(_0x1026dc){if(_0x1026dc){logger[_0x0db1('0x1e')](_0x0db1('0x2c'),_0x22120c);return BPromise[_0x0db1('0x21')](_0x1026dc);}else{logger[_0x0db1('0x1e')]('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x22120c);var _0x185857={'LastName':_0x654d77!==''?_0x654d77:util[_0x0db1('0x2d')](_0x0db1('0x2e'),_0x22120c),'Phone':_0x22120c};if(_0x1682c1['moduleCreate']){if(_0x1682c1[_0x0db1('0x2f')]===_0x0db1('0x28')){logger[_0x0db1('0x1e')](_0x0db1('0x30'),_0x22120c,_0x1682c1[_0x0db1('0x2f')]);}else if(_0x1682c1[_0x0db1('0x2f')]===_0x0db1('0x29')&&_0x1682c1[_0x0db1('0x15')]===_0x0db1('0x31')){logger[_0x0db1('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x22120c,_0x1682c1[_0x0db1('0x2f')]);_0x185857['Company']=_0x0db1('0x32');}else{return null;}}return _0x39401f[_0x0db1('0x14')](_[_0x0db1('0x33')](_0x1682c1[_0x0db1('0x2f')]))[_0x0db1('0x34')](_0x185857);}});}function getCustomFields(_0x191923,_0x1c6e7c){var _0x32dde6={};if(_0x191923[_0x0db1('0x1b')]>0x0){_[_0x0db1('0x35')](_0x191923,function(_0x2f3d18){if(_0x2f3d18['type']===_0x0db1('0x36')&&_0x2f3d18[_0x0db1('0x37')]){_0x32dde6[_0x2f3d18[_0x0db1('0x37')]]=_0x2f3d18[_0x0db1('0x38')][_0x0db1('0x39')]();}else if(_0x2f3d18[_0x0db1('0x3a')]===_0x0db1('0x3b')&&_0x2f3d18[_0x0db1('0x3c')]&&_0x2f3d18[_0x0db1('0x37')]){_0x1c6e7c[_0x2f3d18[_0x0db1('0x3c')]]&&(_0x32dde6[_0x2f3d18['idField']]=_0x1c6e7c[_0x2f3d18['variableName']][_0x0db1('0x39')]());}else if(_0x2f3d18['type']===_0x0db1('0x3d')&&_0x2f3d18['Variable']&&_0x2f3d18['Variable'][_0x0db1('0x3e')]&&_0x2f3d18[_0x0db1('0x37')]){_0x1c6e7c[_0x2f3d18[_0x0db1('0x3f')]['name']['toLowerCase']()]&&(_0x32dde6[_0x2f3d18['idField']]=_0x1c6e7c[_0x2f3d18['Variable'][_0x0db1('0x3e')][_0x0db1('0x40')]()][_0x0db1('0x39')]());}});}return _0x32dde6;}function getConnection(_0x24fd7a){var _0x1cfb0a=_0x24fd7a[_0x0db1('0x41')]['concat'](_0x24fd7a[_0x0db1('0x42')]);var _0x30c577=new jsforce[(_0x0db1('0x43'))]({'oauth2':{'loginUrl':_0x24fd7a[_0x0db1('0x44')]||_0x0db1('0x45'),'clientId':_0x24fd7a[_0x0db1('0x46')],'clientSecret':_0x24fd7a[_0x0db1('0x47')]}});return _0x30c577['login'](_0x24fd7a[_0x0db1('0x48')],_0x1cfb0a)['then'](function(){logger[_0x0db1('0x1e')](_0x0db1('0x49'));return _0x30c577;});}exports[_0x0db1('0x4a')]=function(_0x551a5e,_0x54e2ae,_0x4b586a,_0x2bf81a,_0x4549a9,_0xbf33c6){var _0x458a97,_0x2af5ce,_0x6b762b,_0x33fdc7;_0xbf33c6[_0x0db1('0x4b')]=intUtil[_0x0db1('0x4c')](_0xbf33c6[_0x0db1('0x4b')]);_0xbf33c6[_0x0db1('0x44')]=intUtil[_0x0db1('0x4c')](_0xbf33c6['remoteUri']);if(_0x4549a9&&_0x4549a9[_0x0db1('0x4d')]){logger[_0x0db1('0x1e')](_0x0db1('0x4e'),_0x0db1('0x4f'));_0x54e2ae[_0x0db1('0x50')]=util[_0x0db1('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xbf33c6[_0x0db1('0x4b')],_0x54e2ae[_0x0db1('0x51')],md5(_0x54e2ae[_0x0db1('0x51')]));}else{_0x54e2ae[_0x0db1('0x50')]='';}return getConnection(_0xbf33c6)['then'](function(_0x1e1305){_0x33fdc7=_0x1e1305;return getUser(_0xbf33c6,_0x2bf81a[_0x0db1('0x52')],_0x33fdc7);})[_0x0db1('0x1a')](function(_0x3ef604){_0x458a97=_0x3ef604;return getEndUser(_0xbf33c6,_0x4b586a,_0x54e2ae['calleridname'],_0x54e2ae[_0x0db1('0x53')],_0x33fdc7);})[_0x0db1('0x1a')](function(_0x5a2a0d){_0x2af5ce=_0x5a2a0d;return getTicket(_0xbf33c6,_0x458a97,_0x2af5ce,_0x4b586a,_0x54e2ae,_0x4b586a[_0x0db1('0x54')],_0x33fdc7,'queue');})[_0x0db1('0x1a')](function(_0x92c858){_0x6b762b=_0x92c858;logger[_0x0db1('0x1e')](_0x0db1('0x55'),_0x6b762b['id']);logger[_0x0db1('0x1e')](_0x0db1('0x56'),_0x6b762b['id'],_0x2bf81a[_0x0db1('0x3e')],_0xbf33c6[_0x0db1('0x3a')]);switch(_0xbf33c6[_0x0db1('0x3a')]){case _0x0db1('0x57'):emit(util['format'](_0x0db1('0x58'),_0x2bf81a['name']),'trigger:salesforce:display',{'recordId':_0x6b762b['id']});break;case _0x0db1('0x59'):emit(util[_0x0db1('0x2d')](_0x0db1('0x58'),_0x2bf81a[_0x0db1('0x3e')]),_0x0db1('0x5a'),{'uri':util['format'](_0x0db1('0x5b'),_0x33fdc7[_0x0db1('0x5c')],_0x6b762b['id'])});break;default:logger[_0x0db1('0x5d')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x0db1('0x5e')](function(_0x579129){logger[_0x0db1('0x5d')](_0x0db1('0x4e'),JSON['stringify'](_0x579129));});};exports[_0x0db1('0x5f')]=function(_0x2cff2e,_0x958c72,_0x3d7b05,_0x3625e9,_0x1c3d7a,_0x498242,_0x15f68c){var _0x20efc0,_0x51618f,_0x438b1e,_0x49006b;_0x498242[_0x0db1('0x4b')]=intUtil[_0x0db1('0x4c')](_0x498242[_0x0db1('0x4b')]);_0x498242[_0x0db1('0x44')]=intUtil[_0x0db1('0x4c')](_0x498242[_0x0db1('0x44')]);if(_0x15f68c&&_0x15f68c[_0x0db1('0x60')]&&_0x15f68c['recordingFormat']!=='none'){logger[_0x0db1('0x1e')](_0x0db1('0x61'),'Recording\x20is\x20enabled!');_0x958c72['recordingURL']=util[_0x0db1('0x2d')](_0x0db1('0x62'),_0x498242['serverUrl'],_0x958c72[_0x0db1('0x51')],md5(_0x958c72['uniqueid']));}return getConnection(_0x498242)[_0x0db1('0x1a')](function(_0x35d44f){_0x49006b=_0x35d44f;return getUser(_0x498242,_0x3625e9[_0x0db1('0x52')],_0x49006b);})['then'](function(_0x1de84e){_0x20efc0=_0x1de84e;return getEndUser(_0x498242,_0x3d7b05,_0x958c72[_0x0db1('0x63')],_0x958c72[_0x0db1('0x64')],_0x49006b);})[_0x0db1('0x1a')](function(_0x2a02c0){_0x51618f=_0x2a02c0;return getTicket(_0x498242,_0x20efc0,_0x51618f,_0x3d7b05,_0x958c72,_0x3d7b05[_0x0db1('0x54')],_0x49006b,_0x0db1('0x5f'));})['then'](function(_0x3688b5){_0x438b1e=_0x3688b5;logger[_0x0db1('0x1e')](_0x0db1('0x65'),_0x438b1e['id']);logger['info'](_0x0db1('0x66'),_0x438b1e['id'],_0x3625e9['name'],_0x498242['type']);switch(_0x498242['type']){case'integrationTab':emit(util[_0x0db1('0x2d')](_0x0db1('0x58'),_0x3625e9[_0x0db1('0x3e')]),'trigger:salesforce:display',{'recordId':_0x438b1e['id']});break;case _0x0db1('0x59'):emit(util[_0x0db1('0x2d')](_0x0db1('0x58'),_0x3625e9[_0x0db1('0x3e')]),_0x0db1('0x5a'),{'uri':util[_0x0db1('0x2d')](_0x0db1('0x5b'),_0x49006b[_0x0db1('0x5c')],_0x438b1e['id'])});break;default:logger[_0x0db1('0x5d')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x0db1('0x5e')](function(_0x184420){logger[_0x0db1('0x5d')](_0x0db1('0x61'),JSON[_0x0db1('0x67')](_0x184420));});};exports['unmanaged']=function(_0x1b6e0d,_0x80e740,_0x3b83c6,_0x2b279c,_0xcc5cbb,_0x3d9da8){var _0x2f17ec,_0xc9e929,_0x29f5c2,_0x150159;_0x3d9da8[_0x0db1('0x4b')]=intUtil[_0x0db1('0x4c')](_0x3d9da8['serverUrl']);_0x3d9da8['remoteUri']=intUtil[_0x0db1('0x4c')](_0x3d9da8[_0x0db1('0x44')]);if(_0xcc5cbb&&_0xcc5cbb['monitor_format']){logger[_0x0db1('0x1e')]('['+_0x80e740[_0x0db1('0x68')][_0x0db1('0x69')]()+']','Recording\x20is\x20enabled!');_0x80e740[_0x0db1('0x50')]=util[_0x0db1('0x2d')](_0x0db1('0x62'),_0x3d9da8['serverUrl'],_0x80e740[_0x0db1('0x51')],md5(_0x80e740[_0x0db1('0x51')]));}else{_0x80e740[_0x0db1('0x50')]='';}return getConnection(_0x3d9da8)[_0x0db1('0x1a')](function(_0x459628){_0x150159=_0x459628;if(!_[_0x0db1('0x16')](_0x2b279c)){return getUser(_0x3d9da8,_0x2b279c[_0x0db1('0x3e')],_0x150159);}else{return getUser(_0x3d9da8,null,_0x150159);}})[_0x0db1('0x1a')](function(_0x18cff4){_0x2f17ec=_0x18cff4;return getEndUser(_0x3d9da8,_0x3b83c6,_0x80e740[_0x0db1('0x6a')],_0x80e740[_0x0db1('0x53')],_0x150159);})['then'](function(_0x360f30){_0xc9e929=_0x360f30;return getTicket(_0x3d9da8,_0x2f17ec,_0xc9e929,_0x3b83c6,_0x80e740,_0x3b83c6[_0x0db1('0x54')],_0x150159);})[_0x0db1('0x1a')](function(_0x592d76){_0x29f5c2=_0x592d76;logger[_0x0db1('0x1e')]('['+_0x80e740[_0x0db1('0x68')]['toUpperCase']()+_0x0db1('0x6b'),_0x29f5c2['id']);logger[_0x0db1('0x1e')]('['+_0x80e740['lastevent']['toUpperCase']()+_0x0db1('0x6c'),_0x3d9da8['type']);})[_0x0db1('0x5e')](function(_0x35f37e){logger[_0x0db1('0x5d')]('['+_0x80e740[_0x0db1('0x68')][_0x0db1('0x69')]()+']',JSON[_0x0db1('0x67')](_0x35f37e));});}; \ 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 c899264..67e4e8b 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 _0x326f=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','nameField','customField','idField','toLowerCase','toString','string','content','variable','variableName','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','forEach','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','email','destcalleridnum','callDirection','queue','unmanaged'];(function(_0x1b9930,_0x5bf350){var _0x336cf3=function(_0x3a84cb){while(--_0x3a84cb){_0x1b9930['push'](_0x1b9930['shift']());}};_0x336cf3(++_0x5bf350);}(_0x326f,0xd1));var _0xf326=function(_0x72474a,_0x378493){_0x72474a=_0x72474a-0x0;var _0x3c5939=_0x326f[_0x72474a];return _0x3c5939;};'use strict';var _=require(_0xf326('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xf326('0x1'));var md5=require(_0xf326('0x2'));var Redis=require(_0xf326('0x3'));var intUtil=require(_0xf326('0x4'));var config=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));config[_0xf326('0x8')]=_[_0xf326('0x9')](config[_0xf326('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf326('0xa'))(new Redis(config[_0xf326('0x8')]));function getAdminUser(_0x165f95,_0x1e7b8a,_0x515bfa,_0x4c206c,_0x592975,_0x3bacf2){return new Promise(function(_0x1fc80e,_0x163416){var _0x2686e1={'method':_0xf326('0xb'),'uri':_0x4c206c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x592975+'&'+_0x3bacf2,'auth':_0x1e7b8a,'json':!![]};return rp(_0x2686e1)[_0xf326('0xc')](function(_0x53cbcd){if(_0x53cbcd[_0xf326('0xd')]['length']>0x0){_0x515bfa[_0xf326('0xe')]=_0x53cbcd['result'][0x0][_0xf326('0xf')];}logger[_0xf326('0x10')]('['+[_0x165f95['toUpperCase']()]+_0xf326('0x11'),_0x515bfa);_0x1fc80e(_0x515bfa);})[_0xf326('0x12')](function(_0x3504eb){logger[_0xf326('0x13')]('['+[_0x165f95['toUpperCase']()]+']',_0x3504eb[_0xf326('0x14')]);_0x163416(_0x3504eb['message']);});});}function getUser(_0x54bd1a,_0xdf21d9,_0x11f6d2,_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+_0xf326('0x16'),_0x292f4b);return new Promise(function(_0x5a682a,_0x3ad7da){if(intUtil[_0xf326('0x17')](_0x292f4b[_0xf326('0x18')])){var _0x31ffb9={'method':_0xf326('0xb'),'uri':_0x11f6d2+_0xf326('0x19')+_0x292f4b['userEmail']+'&'+_0x1f2e5a+'&'+_0xa63d1a,'auth':_0xdf21d9,'json':!![]};logger['info']('['+[_0x54bd1a['toUpperCase']()]+_0xf326('0x1a'),_0x31ffb9);return rp(_0x31ffb9)[_0xf326('0xc')](function(_0x484cbe){logger['info']('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20entity',_0x484cbe);if(_0x484cbe['result'][_0xf326('0x1b')]>0x0&&String(_0x484cbe[_0xf326('0xd')][0x0]['active'])==='true'){_0x292f4b[_0xf326('0x1c')]=_0x484cbe[_0xf326('0xd')][0x0]['sys_id'];}else{_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b[_0xf326('0x1d')];}logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20crm',_0x292f4b);_0x5a682a(_0x292f4b);})['catch'](function(_0x4f31f6){logger[_0xf326('0x13')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']',_0x4f31f6[_0xf326('0x14')]);_0x3ad7da(_0x4f31f6[_0xf326('0x14')]);});}else{logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']\x20using\x20admin\x20profile');_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b['adminEmail'];_0x5a682a(_0x292f4b);}});};}function createEndUser(_0x1617d2,_0x55ad0f,_0x4a9abf,_0x6a8e89,_0x1ae23a){logger[_0xf326('0x10')]('['+[_0x1617d2['toUpperCase']()]+_0xf326('0x1e'),_0x4a9abf);return new Promise(function(_0x292500,_0x55790d){var _0x225776={'method':_0xf326('0x1f'),'uri':_0x6a8e89+_0xf326('0x20')+_0x1ae23a,'body':{'user_name':_0x4a9abf[_0xf326('0x21')],'roles':_0xf326('0x22'),'first_name':_0x4a9abf[_0xf326('0x21')],'active':_0xf326('0x23'),'date_format':_0xf326('0x24'),'phone':_0x4a9abf[_0xf326('0x21')]},'auth':_0x55ad0f,'json':!![]};return rp(_0x225776)[_0xf326('0xc')](function(_0x4b52f2){logger[_0xf326('0x10')]('['+[_0x1617d2[_0xf326('0x15')]()]+_0xf326('0x25'),_0x4b52f2['result']);_0x4a9abf[_0xf326('0x26')]=_0x4b52f2[_0xf326('0xd')][_0xf326('0xf')];_0x292500(_0x4a9abf);})['catch'](function(_0x5b101d){logger[_0xf326('0x13')]('['+[_0x1617d2[_0xf326('0x15')]()]+']',_0x5b101d[_0xf326('0x14')]);_0x55790d(_0x5b101d[_0xf326('0x14')]);});});}function getEndUser(_0x30694f,_0x2e8a64,_0x62585a,_0x2d5f20,_0x580374){return function(_0x461e93){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x27'),_0x461e93);return new Promise(function(_0x4e5d7c,_0xce1cbb){var _0x481b64={'method':'GET','uri':_0x62585a+_0xf326('0x28')+_0x461e93['endUserNumber']+'&'+_0x2d5f20+'&'+_0x580374,'auth':_0x2e8a64,'json':!![]};return rp(_0x481b64)[_0xf326('0xc')](function(_0x57aa27){if(_0x57aa27[_0xf326('0xd')][_0xf326('0x1b')]>0x0){_0x461e93[_0xf326('0x26')]=_0x57aa27['result'][0x0][_0xf326('0xf')];logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x29'),_0x461e93);_0x4e5d7c(_0x461e93);}else{return createEndUser(_0x30694f,_0x2e8a64,_0x461e93,_0x62585a,_0x2d5f20)[_0xf326('0xc')](function(_0x40fa7a){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x2a'),_0x40fa7a);_0x4e5d7c(_0x40fa7a);});}})[_0xf326('0x12')](function(_0x1e69b1){logger[_0xf326('0x13')]('['+[_0x30694f[_0xf326('0x15')]()]+']',_0x1e69b1['message']);_0xce1cbb(_0x1e69b1[_0xf326('0x14')]);});});};}function getCustomFields(_0x1b7bf6,_0x5cfb97){var _0x4dd361={};if(_0x1b7bf6[_0xf326('0x1b')]>0x0){_['forEach'](_0x1b7bf6,function(_0x55dfa8){if(_0x55dfa8[_0xf326('0x2b')]==='string'&&_0x55dfa8[_0xf326('0x2c')]&&!_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8['content'][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x31')&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8[_0xf326('0x32')][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x33')&&_0x55dfa8[_0xf326('0x34')]&&_0x55dfa8['idField']&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x34')]][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]==='customVariable'&&_0x55dfa8[_0xf326('0x35')]&&_0x55dfa8[_0xf326('0x35')]['name']&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x35')]['name']['toLowerCase']()][_0xf326('0x30')]();}});}return _0x4dd361;}function getTicket(_0x44e101,_0x5ed62e,_0x4bd865,_0x8e318d,_0x269e89,_0x21c98e){return function(_0x5b3705){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x36'),_0x5b3705);return new Promise(function(_0xc43507,_0xc99be){var _0x2d9bba=_0x44e101[_0xf326('0x2f')]()===_0xf326('0x37')?_0x5b3705[_0xf326('0x1c')]:_0x5b3705[_0xf326('0x26')];var _0x1c76c8={'method':_0xf326('0x1f'),'uri':_0x4bd865+_0xf326('0x38')+'?'+_0x21c98e,'body':Object[_0xf326('0x39')]({},{'active':_0xf326('0x23'),'caller_id':_0x2d9bba,'assigned_to':_0x5b3705['userId'],'short_description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3b')],_0x269e89,'\x20'),'description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3c')],_0x269e89,'\x0a')},getCustomFields(_0x8e318d['Fields'],_0x269e89)),'auth':_0x5ed62e,'json':!![]};return rp(_0x1c76c8)[_0xf326('0xc')](function(_0x2f5511){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2f5511[_0xf326('0xd')]);_0x5b3705[_0xf326('0x3d')]=_0x2f5511[_0xf326('0xd')][_0xf326('0xf')];_0x5b3705[_0xf326('0x3e')]=_0x2f5511['result']['number'];logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x3f'),_0x5b3705);_0xc43507(_0x5b3705);})['catch'](function(_0x102fba){logger[_0xf326('0x13')]('['+[_0x44e101[_0xf326('0x15')]()]+']',_0x102fba['message']);_0xc99be(_0x102fba['message']);});});};}function createRemoteTag(_0x36ef89,_0x5b4832,_0x1cf58f,_0x554277){return new Promise(function(_0x458e5f,_0x7ee57){var _0x28c959={'method':_0xf326('0x1f'),'uri':_0x1cf58f+_0xf326('0x40')+'?'+_0x554277,'body':{'short_description':_0x36ef89,'global':!![],'active':!![],'name':_0x36ef89},'auth':_0x5b4832,'json':!![]};return rp(_0x28c959)[_0xf326('0xc')](function(_0x7f7ece){var _0x495a16=_0x7f7ece[_0xf326('0xd')][_0xf326('0xf')];_0x458e5f(_0x495a16);});});}function getRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f,_0x3b8635){return new Promise(function(_0x16c578,_0x1159e){var _0x58fcf0={'method':_0xf326('0xb'),'uri':_0x208ba4+_0xf326('0x40')+_0xf326('0x41')+_0x424d24+'&'+_0x3a832f,'auth':_0x4b0d8e,'json':!![]};return rp(_0x58fcf0)[_0xf326('0xc')](function(_0x50690e){if(_0x50690e[_0xf326('0xd')][_0xf326('0x1b')]>0x0){var _0x227850=_0x50690e[_0xf326('0xd')][0x0]['sys_id'];_0x16c578(_0x227850);}else{return createRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f)['then'](function(_0x18b46e){_0x16c578(_0x18b46e);});}});});}function assignTagToIncident(_0x44d2ed,_0x55ca96,_0x3cf6fa,_0x29de71,_0x316609){return new Promise(function(_0x1258d1,_0x5765b0){var _0xb1c18c={'method':'POST','uri':_0x3cf6fa+'label_entry'+'?'+_0x316609,'body':{'label':_0x44d2ed,'table':_0xf326('0x38'),'id_type':'Incident','table_key':_0x29de71[_0xf326('0x3d')],'title':_0xf326('0x42')+_0x29de71[_0xf326('0x3e')],'id_display':_0x29de71['ticketNumber']},'auth':_0x55ca96,'json':!![]};return rp(_0xb1c18c)['then'](function(_0x1fd9c9){_0x1258d1();})[_0xf326('0x12')](function(){_0x1258d1();});});}function manageTags(_0x33b259,_0x5d0177,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c,_0x131184){return new Promise(function(_0x217897,_0xbd3a01){var _0x18dbfc=[];_0x5d0177[_0xf326('0x43')](function(_0x3aeb20){_0x18dbfc[_0xf326('0x44')](getRemoteTag(_0x3aeb20,_0x2759d7,_0x487020,_0x40929c,_0x131184));});return Promise[_0xf326('0x45')](_0x18dbfc)[_0xf326('0xc')](function(_0x1e56fb){if(_0x1e56fb[_0xf326('0x1b')]){logger['info']('['+[_0x33b259[_0xf326('0x15')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1e56fb);var _0x6ac6=[];_0x1e56fb[_0xf326('0x43')](function(_0x5e858d){_0x6ac6[_0xf326('0x44')](assignTagToIncident(_0x5e858d,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c));});return Promise['all'](_0x6ac6)[_0xf326('0xc')](function(){_0x217897();})[_0xf326('0x12')](function(){_0x217897();});}else{_0x217897();}});});}function getTags(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x51ff5e,_0x4ec099,_0x1209ca){return function(_0x32fe3a){return new Promise(function(_0x15a538,_0x21b3cc){var _0x1fc586=[];var _0x579d2c=_0x51ff5e[_0xf326('0x46')];if(_0x579d2c&&_0x579d2c[_0xf326('0x1b')]>0x0){_0x1fc586=_['map'](_0x579d2c,'name');}if(_0x1fc586['length']>0x0){return manageTags(_0x28f3cb,_0x1fc586,_0x2d45c9,_0x31b6dd,_0x32fe3a,_0x4ec099,_0x1209ca)[_0xf326('0xc')](function(){_0x15a538(_0x32fe3a);});}else{_0x15a538(_0x32fe3a);}});};}function emit(_0x7edf5,_0x4150fa,_0x235525){var _0x240ce5=_0xf326('0x47')+_0xf326('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xf326('0x49');var _0x588d26={'uri':_0x7edf5+_0xf326('0x4a')+_0x235525+_0x240ce5};io['to'](util[_0xf326('0x4b')]('user:%s',_0x4150fa))[_0xf326('0x4c')]('trigger:browser:url',_0x588d26);}exports['cs']=function(_0x499b59,_0x2dd9e4,_0x540fa0,_0x78ba34,_0x3411a4,_0x461059,_0x2ea5a2,_0x17cd36){var _0x541491={};var _0x4a053c={'user':_0x461059['username'],'pass':_0x461059[_0xf326('0x4d')]};var _0x307441=_0xf326('0x4e');var _0x180616=_0xf326('0x4f');_0x461059['remoteUri']=intUtil[_0xf326('0x50')](_0x461059[_0xf326('0x51')]);_0x461059[_0xf326('0x52')]=intUtil['stripTrailingSlash'](_0x461059['serverUrl']);var _0x830c9f=util[_0xf326('0x4b')]('%s/api/now/table/',_0x461059['remoteUri']);_0x541491[_0xf326('0x18')]=!_['isNil'](_0x78ba34)?_0x78ba34[_0xf326('0x53')]:null;_0x541491['adminEmail']=_0x461059['email'];_0x541491['endUserNumber']=_0x17cd36[_0xf326('0x2f')]()===_0xf326('0x37')?_0x2dd9e4[_0xf326('0x54')]:_0x2dd9e4['calleridnum'];_0x541491[_0xf326('0x55')]=_0x17cd36===_0xf326('0x56')||_0x17cd36===_0xf326('0x57')?_0xf326('0x56'):_0xf326('0x37');var _0x39e73d=util[_0xf326('0x4b')](_0xf326('0x58'),_0x461059[_0xf326('0x52')],_0x2dd9e4['uniqueid'],md5(_0x2dd9e4[_0xf326('0x59')]));if(_0x3411a4&&_0x3411a4['monitor_format']){logger[_0xf326('0x10')](_0xf326('0x5a'),_0xf326('0x5b'));_0x2dd9e4['recordingURL']=_0x39e73d;}else if(_0x2ea5a2&&_0x2ea5a2[_0xf326('0x5c')]&&_0x2ea5a2[_0xf326('0x5c')]!==_0xf326('0x5d')){logger['info'](_0xf326('0x5e'),_0xf326('0x5b'));_0x2dd9e4[_0xf326('0x5f')]=_0x39e73d;}else{_0x2dd9e4[_0xf326('0x5f')]='';}return getAdminUser(_0x17cd36,_0x4a053c,_0x541491,_0x830c9f,_0x180616,_0x307441)['then'](getUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))[_0xf326('0xc')](getEndUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))['then'](getTicket(_0x17cd36,_0x4a053c,_0x830c9f,_0x540fa0,_0x2dd9e4,_0x180616))['then'](function(_0x32d9c5){logger[_0xf326('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x32d9c5['ticketId']));logger[_0xf326('0x10')](util['format'](_0xf326('0x60'),_0x17cd36));if(_0x17cd36!==_0xf326('0x57')){logger[_0xf326('0x10')]('['+[_0x17cd36[_0xf326('0x15')]()]+']',_0xf326('0x61'));emit(_0x461059[_0xf326('0x51')],_0x78ba34['name'],_0x32d9c5[_0xf326('0x3d')]);}})[_0xf326('0x12')](function(_0x5f1724){logger['error']('['+[_0x17cd36[_0xf326('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xf326('0x62')](_0x5f1724,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc4aa=['all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','isNil','email','destcalleridnum','calleridnum','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','POST','ticketNumber','push'];(function(_0x2fdf02,_0x13700c){var _0x5b559c=function(_0x53226e){while(--_0x53226e){_0x2fdf02['push'](_0x2fdf02['shift']());}};_0x5b559c(++_0x13700c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc4aa[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xac4a('0x0'));var Promise=require(_0xac4a('0x1'));var rp=require(_0xac4a('0x2'));var util=require(_0xac4a('0x3'));var md5=require(_0xac4a('0x4'));var Redis=require(_0xac4a('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xac4a('0x6'));config[_0xac4a('0x7')]=_[_0xac4a('0x8')](config[_0xac4a('0x7')],{'host':_0xac4a('0x9'),'port':0x18eb});var io=require(_0xac4a('0xa'))(new Redis(config[_0xac4a('0x7')]));function getAdminUser(_0x10525b,_0x5c6179,_0x5b8339,_0x1aba6d,_0x2a4d53,_0x26ec84){return new Promise(function(_0x4f4146,_0x1d182e){var _0x3a82de={'method':_0xac4a('0xb'),'uri':_0x1aba6d+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x2a4d53+'&'+_0x26ec84,'auth':_0x5c6179,'json':!![]};return rp(_0x3a82de)[_0xac4a('0xc')](function(_0x488e3c){if(_0x488e3c[_0xac4a('0xd')]['length']>0x0){_0x5b8339[_0xac4a('0xe')]=_0x488e3c[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}logger['info']('['+[_0x10525b[_0xac4a('0x10')]()]+_0xac4a('0x11'),_0x5b8339);_0x4f4146(_0x5b8339);})[_0xac4a('0x12')](function(_0x6e00d4){logger[_0xac4a('0x13')]('['+[_0x10525b[_0xac4a('0x10')]()]+']',_0x6e00d4[_0xac4a('0x14')]);_0x1d182e(_0x6e00d4[_0xac4a('0x14')]);});});}function getUser(_0x190418,_0x42c7fc,_0x11e101,_0x26dbb8,_0x4a2119){return function(_0x402fff){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x16'),_0x402fff);return new Promise(function(_0x3e88e3,_0x387a54){if(intUtil[_0xac4a('0x17')](_0x402fff[_0xac4a('0x18')])){var _0x546c5d={'method':'GET','uri':_0x11e101+_0xac4a('0x19')+_0x402fff[_0xac4a('0x18')]+'&'+_0x26dbb8+'&'+_0x4a2119,'auth':_0x42c7fc,'json':!![]};logger[_0xac4a('0x15')]('['+[_0x190418['toUpperCase']()]+_0xac4a('0x1a'),_0x546c5d);return rp(_0x546c5d)[_0xac4a('0xc')](function(_0x3752e4){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x1b'),_0x3752e4);if(_0x3752e4[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0&&String(_0x3752e4['result'][0x0][_0xac4a('0x1d')])===_0xac4a('0x1e')){_0x402fff['userId']=_0x3752e4[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}else{_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff['userEmail']=_0x402fff[_0xac4a('0x20')];}logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x21'),_0x402fff);_0x3e88e3(_0x402fff);})[_0xac4a('0x12')](function(_0x2b0dc2){logger[_0xac4a('0x13')]('['+[_0x190418[_0xac4a('0x10')]()]+']',_0x2b0dc2[_0xac4a('0x14')]);_0x387a54(_0x2b0dc2[_0xac4a('0x14')]);});}else{logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x22'));_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff[_0xac4a('0x18')]=_0x402fff['adminEmail'];_0x3e88e3(_0x402fff);}});};}function createEndUser(_0x23b061,_0x267a22,_0x42a33c,_0x2772fe,_0x116700){logger['info']('['+[_0x23b061['toUpperCase']()]+_0xac4a('0x23'),_0x42a33c);return new Promise(function(_0x7a948b,_0x1f12d5){var _0x546b65={'method':'POST','uri':_0x2772fe+_0xac4a('0x24')+_0x116700,'body':{'user_name':_0x42a33c[_0xac4a('0x25')],'roles':_0xac4a('0x26'),'first_name':_0x42a33c[_0xac4a('0x25')],'active':_0xac4a('0x1e'),'date_format':'System','phone':_0x42a33c[_0xac4a('0x25')]},'auth':_0x267a22,'json':!![]};return rp(_0x546b65)['then'](function(_0x30364b){logger['info']('['+[_0x23b061[_0xac4a('0x10')]()]+_0xac4a('0x27'),_0x30364b[_0xac4a('0xd')]);_0x42a33c[_0xac4a('0x28')]=_0x30364b[_0xac4a('0xd')][_0xac4a('0xf')];_0x7a948b(_0x42a33c);})[_0xac4a('0x12')](function(_0x1f13f3){logger[_0xac4a('0x13')]('['+[_0x23b061[_0xac4a('0x10')]()]+']',_0x1f13f3[_0xac4a('0x14')]);_0x1f12d5(_0x1f13f3[_0xac4a('0x14')]);});});}function getEndUser(_0x1a9be2,_0x1a9d4e,_0x5634e2,_0x30442d,_0x1c41fb){return function(_0x5a4e2b){logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x5a4e2b);return new Promise(function(_0x58804b,_0x11f0be){var _0x1ba096={'method':_0xac4a('0xb'),'uri':_0x5634e2+_0xac4a('0x29')+_0x5a4e2b['endUserNumber']+'&'+_0x30442d+'&'+_0x1c41fb,'auth':_0x1a9d4e,'json':!![]};return rp(_0x1ba096)[_0xac4a('0xc')](function(_0x2e56c6){if(_0x2e56c6['result'][_0xac4a('0x1c')]>0x0){_0x5a4e2b[_0xac4a('0x28')]=_0x2e56c6[_0xac4a('0xd')][0x0]['sys_id'];logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+_0xac4a('0x2a'),_0x5a4e2b);_0x58804b(_0x5a4e2b);}else{return createEndUser(_0x1a9be2,_0x1a9d4e,_0x5a4e2b,_0x5634e2,_0x30442d)['then'](function(_0x35bc94){logger[_0xac4a('0x15')]('['+[_0x1a9be2['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x35bc94);_0x58804b(_0x35bc94);});}})[_0xac4a('0x12')](function(_0x5e0926){logger['error']('['+[_0x1a9be2['toUpperCase']()]+']',_0x5e0926['message']);_0x11f0be(_0x5e0926[_0xac4a('0x14')]);});});};}function getCustomFields(_0x2bf8e8,_0x37834b){var _0x472484={};if(_0x2bf8e8[_0xac4a('0x1c')]>0x0){_[_0xac4a('0x2b')](_0x2bf8e8,function(_0x4220e2){if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x2e')]&&!_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')]['toLowerCase']()]=_0x4220e2['content']['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x4220e2[_0xac4a('0x32')][_0xac4a('0x33')]();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x34')&&_0x4220e2['variableName']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x35')]]['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x36')&&_0x4220e2['Variable']&&_0x4220e2[_0xac4a('0x37')]['name']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x37')][_0xac4a('0x38')][_0xac4a('0x31')]()][_0xac4a('0x33')]();}});}return _0x472484;}function getTicket(_0x98e0c4,_0xcb002b,_0x4fa9eb,_0x3b68b3,_0x569812,_0x1646ea){return function(_0x41d11d){logger[_0xac4a('0x15')]('['+[_0x98e0c4['toUpperCase']()]+_0xac4a('0x39'),_0x41d11d);return new Promise(function(_0x19276e,_0x5f54ff){var _0x42969b=_0x98e0c4['toLowerCase']()===_0xac4a('0x3a')?_0x41d11d[_0xac4a('0x1f')]:_0x41d11d[_0xac4a('0x28')];var _0x5e3581={'method':'POST','uri':_0x4fa9eb+_0xac4a('0x3b')+'?'+_0x1646ea,'body':Object['assign']({},{'active':_0xac4a('0x1e'),'caller_id':_0x42969b,'assigned_to':_0x41d11d['userId'],'short_description':intUtil[_0xac4a('0x3c')](_0x3b68b3['Subjects'],_0x569812,'\x20'),'description':intUtil[_0xac4a('0x3c')](_0x3b68b3[_0xac4a('0x3d')],_0x569812,'\x0a')},getCustomFields(_0x3b68b3[_0xac4a('0x3e')],_0x569812)),'auth':_0xcb002b,'json':!![]};return rp(_0x5e3581)[_0xac4a('0xc')](function(_0x54782f){logger[_0xac4a('0x15')]('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x3f'),_0x54782f[_0xac4a('0xd')]);_0x41d11d[_0xac4a('0x40')]=_0x54782f[_0xac4a('0xd')][_0xac4a('0xf')];_0x41d11d['ticketNumber']=_0x54782f[_0xac4a('0xd')][_0xac4a('0x41')];logger['info']('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x42'),_0x41d11d);_0x19276e(_0x41d11d);})[_0xac4a('0x12')](function(_0x3ac36e){logger['error']('['+[_0x98e0c4[_0xac4a('0x10')]()]+']',_0x3ac36e[_0xac4a('0x14')]);_0x5f54ff(_0x3ac36e[_0xac4a('0x14')]);});});};}function createRemoteTag(_0x129d58,_0x890910,_0x49fbc3,_0x179373){return new Promise(function(_0x564b10,_0x307441){var _0x2c04af={'method':'POST','uri':_0x49fbc3+'label'+'?'+_0x179373,'body':{'short_description':_0x129d58,'global':!![],'active':!![],'name':_0x129d58},'auth':_0x890910,'json':!![]};return rp(_0x2c04af)[_0xac4a('0xc')](function(_0x70fdc3){var _0x4d448f=_0x70fdc3[_0xac4a('0xd')][_0xac4a('0xf')];_0x564b10(_0x4d448f);});});}function getRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6,_0x108f7c){return new Promise(function(_0xb43fdb,_0xb5897b){var _0xdc80e3={'method':_0xac4a('0xb'),'uri':_0x48900f+_0xac4a('0x43')+'?sysparm_query=name%3D'+_0x26b582+'&'+_0x3057d6,'auth':_0x103d05,'json':!![]};return rp(_0xdc80e3)[_0xac4a('0xc')](function(_0xef51d0){if(_0xef51d0[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0){var _0x1b7231=_0xef51d0[_0xac4a('0xd')][0x0][_0xac4a('0xf')];_0xb43fdb(_0x1b7231);}else{return createRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6)[_0xac4a('0xc')](function(_0x159e43){_0xb43fdb(_0x159e43);});}});});}function assignTagToIncident(_0x786d9,_0x3b175a,_0x38dd4f,_0x400ac4,_0x2fe7df){return new Promise(function(_0x5222f3,_0x11c753){var _0x492aae={'method':_0xac4a('0x44'),'uri':_0x38dd4f+'label_entry'+'?'+_0x2fe7df,'body':{'label':_0x786d9,'table':_0xac4a('0x3b'),'id_type':'Incident','table_key':_0x400ac4[_0xac4a('0x40')],'title':'Incident\x20-\x20'+_0x400ac4[_0xac4a('0x45')],'id_display':_0x400ac4['ticketNumber']},'auth':_0x3b175a,'json':!![]};return rp(_0x492aae)['then'](function(_0x52c957){_0x5222f3();})[_0xac4a('0x12')](function(){_0x5222f3();});});}function manageTags(_0x3bcae2,_0x3c2f84,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa,_0x50dece){return new Promise(function(_0x34215e,_0x5d03e5){var _0x347880=[];_0x3c2f84[_0xac4a('0x2b')](function(_0x3da7e7){_0x347880[_0xac4a('0x46')](getRemoteTag(_0x3da7e7,_0x2f9940,_0xb7b884,_0x1e1ffa,_0x50dece));});return Promise[_0xac4a('0x47')](_0x347880)[_0xac4a('0xc')](function(_0x3abd57){if(_0x3abd57[_0xac4a('0x1c')]){logger[_0xac4a('0x15')]('['+[_0x3bcae2[_0xac4a('0x10')]()]+_0xac4a('0x48'),_0x3abd57);var _0x2498ad=[];_0x3abd57[_0xac4a('0x2b')](function(_0x2cc410){_0x2498ad[_0xac4a('0x46')](assignTagToIncident(_0x2cc410,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa));});return Promise[_0xac4a('0x47')](_0x2498ad)[_0xac4a('0xc')](function(){_0x34215e();})['catch'](function(){_0x34215e();});}else{_0x34215e();}});});}function getTags(_0xa90d71,_0x1672c0,_0x4fb812,_0x3c3576,_0x34bd1c,_0x2d24c7){return function(_0x2b8562){return new Promise(function(_0x357cac,_0x4d1440){var _0x47c6d8=[];var _0x45f3c3=_0x3c3576[_0xac4a('0x49')];if(_0x45f3c3&&_0x45f3c3[_0xac4a('0x1c')]>0x0){_0x47c6d8=_[_0xac4a('0x4a')](_0x45f3c3,_0xac4a('0x38'));}if(_0x47c6d8[_0xac4a('0x1c')]>0x0){return manageTags(_0xa90d71,_0x47c6d8,_0x1672c0,_0x4fb812,_0x2b8562,_0x34bd1c,_0x2d24c7)[_0xac4a('0xc')](function(){_0x357cac(_0x2b8562);});}else{_0x357cac(_0x2b8562);}});};}function emit(_0x2988d7,_0x44c60b,_0x295f21){var _0x278c09='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xac4a('0x4b')+_0xac4a('0x4c');var _0x2954fc={'uri':_0x2988d7+_0xac4a('0x4d')+_0x295f21+_0x278c09};io['to'](util[_0xac4a('0x4e')](_0xac4a('0x4f'),_0x44c60b))[_0xac4a('0x50')](_0xac4a('0x51'),_0x2954fc);}exports['cs']=function(_0x453d62,_0x2a5acc,_0xb09b89,_0xb12cc5,_0x5f0173,_0x13c854,_0xc74ce8,_0x26bd31){var _0x231932={};var _0x513976={'user':_0x13c854[_0xac4a('0x52')],'pass':_0x13c854['password']};var _0xab4305=_0xac4a('0x53');var _0x499abc='sysparm_display_value=true';_0x13c854[_0xac4a('0x54')]=intUtil[_0xac4a('0x55')](_0x13c854[_0xac4a('0x54')]);_0x13c854['serverUrl']=intUtil[_0xac4a('0x55')](_0x13c854['serverUrl']);var _0x114b11=util['format']('%s/api/now/table/',_0x13c854[_0xac4a('0x54')]);_0x231932['userEmail']=!_[_0xac4a('0x56')](_0xb12cc5)?_0xb12cc5['email']:null;_0x231932[_0xac4a('0x20')]=_0x13c854[_0xac4a('0x57')];_0x231932['endUserNumber']=_0x26bd31[_0xac4a('0x31')]()==='outbound'?_0x2a5acc[_0xac4a('0x58')]:_0x2a5acc[_0xac4a('0x59')];_0x231932['callDirection']=_0x26bd31===_0xac4a('0x5a')||_0x26bd31==='unmanaged'?'queue':_0xac4a('0x3a');var _0x4e3129=util[_0xac4a('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13c854['serverUrl'],_0x2a5acc[_0xac4a('0x5b')],md5(_0x2a5acc[_0xac4a('0x5b')]));if(_0x5f0173&&_0x5f0173[_0xac4a('0x5c')]){logger['info']('[QUEUE]',_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else if(_0xc74ce8&&_0xc74ce8['recordingFormat']&&_0xc74ce8['recordingFormat']!==_0xac4a('0x5f')){logger[_0xac4a('0x15')](_0xac4a('0x60'),_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else{_0x2a5acc[_0xac4a('0x5e')]='';}return getAdminUser(_0x26bd31,_0x513976,_0x231932,_0x114b11,_0x499abc,_0xab4305)[_0xac4a('0xc')](getUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getEndUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getTicket(_0x26bd31,_0x513976,_0x114b11,_0xb09b89,_0x2a5acc,_0x499abc))['then'](function(_0x1201e8){logger[_0xac4a('0x15')](util[_0xac4a('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1201e8[_0xac4a('0x40')]));logger[_0xac4a('0x15')](util[_0xac4a('0x4e')](_0xac4a('0x61'),_0x26bd31));if(_0x26bd31!==_0xac4a('0x62')){logger['info']('['+[_0x26bd31[_0xac4a('0x10')]()]+']',_0xac4a('0x63'));emit(_0x13c854[_0xac4a('0x54')],_0xb12cc5[_0xac4a('0x38')],_0x1201e8[_0xac4a('0x40')]);}})[_0xac4a('0x12')](function(_0xd7bdd6){logger['error']('['+[_0x26bd31[_0xac4a('0x10')]()]+_0xac4a('0x64'),util[_0xac4a('0x65')](_0xd7bdd6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 097a2dc..986b28e 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 _0x0630=['Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','description','getString','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','Contacts','parent_name','direction','length','idField','JSON','stringify','Calls','format','apiKey','toString','base64','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','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','Enduser\x20created.','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','custom_fields','push','content','variable','variableName','Variable','username','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','users','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','unmanaged','uri','lastevent','isNil','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','localhost','POST','info'];(function(_0x40b7ad,_0xc20173){var _0x1f263e=function(_0x3e0c0a){while(--_0x3e0c0a){_0x40b7ad['push'](_0x40b7ad['shift']());}};_0x1f263e(++_0xc20173);}(_0x0630,0xde));var _0x0063=function(_0x5cc2cc,_0xa5eb7e){_0x5cc2cc=_0x5cc2cc-0x0;var _0x5bb4cd=_0x0630[_0x5cc2cc];return _0x5bb4cd;};'use strict';var _=require(_0x0063('0x0'));var rp=require(_0x0063('0x1'));var BPromise=require(_0x0063('0x2'));var md5=require(_0x0063('0x3'));var util=require(_0x0063('0x4'));var Redis=require(_0x0063('0x5'));var intUtil=require(_0x0063('0x6'));var config=require(_0x0063('0x7'));var logger=require(_0x0063('0x8'))(_0x0063('0x9'));config['redis']=_[_0x0063('0xa')](config['redis'],{'host':_0x0063('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0x0063('0xc'),'json':!![]};function emit(_0x5c3dda,_0x19dbc3,_0x52f9b9){io['to'](_0x5c3dda)['emit'](_0x19dbc3,_0x52f9b9);}function getTicket(_0x4798d5,_0x20355c,_0x2683c1,_0x3e0e2a,_0x3ed8f9,_0x40d9ec,_0x51f75b,_0x7a5f24){logger[_0x0063('0xd')](_0x0063('0xe'));var _0x202105=new Date();var _0x242b9f=[{'name':_0x0063('0xf'),'value':intUtil['getString'](_0x3e0e2a[_0x0063('0x10')],_0x3ed8f9,'\x20')},{'name':_0x0063('0x11'),'value':_0x20355c['id']},{'name':'created_by','value':_0x20355c['id']},{'name':_0x0063('0x12'),'value':intUtil[_0x0063('0x13')](_0x3e0e2a[_0x0063('0x14')],_0x3ed8f9,'\x0a')},{'name':'date_start','value':_0x202105[_0x0063('0x15')]()[_0x0063('0x16')](0x0,0x13)[_0x0063('0x17')]('T','\x20')},{'name':_0x0063('0x18'),'value':'0'},{'name':_0x0063('0x19'),'value':'15'},{'name':'parent_id','value':_0x2683c1['id']},{'name':'parent_type','value':_0x0063('0x1a')},{'name':_0x0063('0x1b'),'value':_0x2683c1[_0x0063('0xf')]},{'name':_0x0063('0x1c'),'value':_0x7a5f24}];if(_0x40d9ec[_0x0063('0x1d')]){_['forEach'](_0x40d9ec,function(_0x1d85aa){if(_0x3ed8f9[_0x1d85aa['variableName']]){_0x242b9f['push']({'name':_0x1d85aa[_0x0063('0x1e')],'value':_0x3ed8f9[_0x1d85aa['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x0063('0x1f'),'response_type':'JSON','rest_data':JSON[_0x0063('0x20')]({'session':_0x51f75b['id'],'module_name':_0x0063('0x21'),'name_value_list':_0x242b9f})}});}function getAuth(_0x16f7a1){return util[_0x0063('0x22')]('Basic\x20%s',new Buffer(_0x16f7a1[_0x0063('0x23')]+':X')[_0x0063('0x24')](_0x0063('0x25')));}function getServerInfo(_0x2b7136){return request({'form':{'method':'get_server_info','input_type':_0x0063('0x1f'),'response_type':_0x0063('0x1f'),'rest_data':JSON['stringify']({'session':_0x2b7136['id']})}});}function getUser(_0x36944c,_0x4fd8c5,_0x209c8f){if(!_['isNil'](_0x4fd8c5)){logger['info'](_0x0063('0x26'),_0x4fd8c5);return request({'form':{'method':_0x0063('0x27'),'input_type':_0x0063('0x1f'),'response_type':'JSON','rest_data':JSON[_0x0063('0x20')]({'session':_0x209c8f['id'],'module_name':_0x0063('0x28'),'query':util['format'](_0x0063('0x29'),_0x4fd8c5),'order_by':'','offset':'0','select_fields':['id','name',_0x0063('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0063('0x2b')](function(_0x2fd1c3){if(_0x2fd1c3[_0x0063('0x2c')][_0x0063('0x1d')]){var _0x379db9=_[_0x0063('0x2d')](_0x2fd1c3[_0x0063('0x2c')],function(_0x268df2){return _0x268df2[_0x0063('0x2e')]['user_name'][_0x0063('0x2f')]===_0x4fd8c5;});if(_0x379db9){logger[_0x0063('0xd')]('Agent\x20found!');return BPromise[_0x0063('0x30')]({'id':_0x379db9['name_value_list']['id'][_0x0063('0x2f')],'name':_0x379db9[_0x0063('0x2e')][_0x0063('0xf')][_0x0063('0x2f')]});}}logger['info'](_0x0063('0x31'));return BPromise[_0x0063('0x30')]({'id':_0x209c8f[_0x0063('0x2e')][_0x0063('0x32')][_0x0063('0x2f')],'name':_0x209c8f[_0x0063('0x2e')][_0x0063('0x2a')][_0x0063('0x2f')]});});}else{logger['info'](_0x0063('0x33'));return BPromise[_0x0063('0x30')]({'id':_0x209c8f['name_value_list']['user_id'][_0x0063('0x2f')],'name':_0x209c8f[_0x0063('0x2e')][_0x0063('0x2a')][_0x0063('0x2f')]});}}function getEndUser(_0x78e502,_0x995f43,_0x581553,_0x472359){logger[_0x0063('0xd')](_0x0063('0x34'),_0x581553);return request({'form':{'method':'get_entry_list','input_type':_0x0063('0x1f'),'response_type':'JSON','rest_data':JSON[_0x0063('0x20')]({'session':_0x472359['id'],'module_name':_0x0063('0x1a'),'query':util[_0x0063('0x22')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x581553),'order_by':'','offset':'0','select_fields':['id',_0x0063('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0063('0x2b')](function(_0x38d6f7){if(_0x38d6f7['entry_list']['length']){var _0x1f31e7=_[_0x0063('0x2d')](_0x38d6f7['entry_list'],function(_0xeda140){return _0xeda140[_0x0063('0x2e')][_0x0063('0x35')]['value']===_0x581553;});if(_0x1f31e7){logger[_0x0063('0xd')]('Enduser\x20found!');return BPromise[_0x0063('0x30')]({'id':_0x1f31e7[_0x0063('0x2e')]['id'][_0x0063('0x2f')],'name':_0x1f31e7[_0x0063('0x2e')][_0x0063('0xf')]['value'],'phone':_0x1f31e7[_0x0063('0x2e')][_0x0063('0x35')]['value']});}}else{logger['info'](_0x0063('0x36'));return request({'form':{'method':_0x0063('0x37'),'input_type':_0x0063('0x1f'),'response_type':_0x0063('0x1f'),'rest_data':JSON[_0x0063('0x20')]({'session':_0x472359['id'],'module_name':_0x0063('0x1a'),'name_value_list':[{'name':_0x0063('0x38'),'value':_0x995f43!==''?_0x995f43:util[_0x0063('0x22')]('Caller\x20-\x20%s',_0x581553)},{'name':'phone_home','value':_0x581553}]})}})[_0x0063('0x2b')](function(_0xe93c5f){logger[_0x0063('0xd')](_0x0063('0x39'));return BPromise[_0x0063('0x30')]({'id':_0xe93c5f['id'],'name':_0xe93c5f[_0x0063('0x2c')][_0x0063('0x38')][_0x0063('0x2f')],'phone':_0xe93c5f[_0x0063('0x2c')][_0x0063('0x35')][_0x0063('0x2f')]});});}});}function request(_0x5ba483){logger['debug'](_0x0063('0x3a'),JSON[_0x0063('0x20')](_0x5ba483));return rp(_[_0x0063('0x3b')](def,_0x5ba483));}function getTags(_0x2d180e,_0x1832c9){var _0x5cdbbd=[];if(_0x2d180e&&_0x2d180e[_0x0063('0x1d')]>0x0){_0x5cdbbd=_[_0x0063('0x3c')](_0x2d180e,_0x1832c9);}return _0x5cdbbd;}function getCustomFields(_0x283c25,_0x3a705d){var _0x121a58=[];var _0x5e5055={'custom_fields':[]};if(_0x283c25[_0x0063('0x1d')]>0x0){_[_0x0063('0x3d')](_0x283c25,function(_0x31b4b3){if(_0x31b4b3[_0x0063('0x3e')]===_0x0063('0x3f')&&_0x31b4b3[_0x0063('0x40')]&&!_0x31b4b3[_0x0063('0x41')]){_0x5e5055[_0x31b4b3[_0x0063('0x40')][_0x0063('0x42')]()]=_0x31b4b3['content'][_0x0063('0x24')]();}else if(_0x31b4b3[_0x0063('0x3e')]===_0x0063('0x3f')&&_0x31b4b3[_0x0063('0x1e')]&&_0x31b4b3['customField']){_0x5e5055[_0x0063('0x43')][_0x0063('0x44')]({'id':_0x31b4b3['idField'],'value':_0x31b4b3[_0x0063('0x45')]['toString']()});}else if(_0x31b4b3[_0x0063('0x3e')]===_0x0063('0x46')&&_0x31b4b3[_0x0063('0x47')]&&_0x31b4b3[_0x0063('0x1e')]&&_0x31b4b3[_0x0063('0x41')]){_0x3a705d[_0x31b4b3[_0x0063('0x47')]]&&_0x5e5055[_0x0063('0x43')][_0x0063('0x44')]({'id':_0x31b4b3[_0x0063('0x1e')],'value':_0x3a705d[_0x31b4b3['variableName']][_0x0063('0x24')]()});}else if(_0x31b4b3['type']==='customVariable'&&_0x31b4b3[_0x0063('0x48')]&&_0x31b4b3[_0x0063('0x48')]['name']&&_0x31b4b3['idField']&&_0x31b4b3[_0x0063('0x41')]){_0x3a705d[_0x31b4b3[_0x0063('0x48')][_0x0063('0xf')][_0x0063('0x42')]()]&&_0x5e5055[_0x0063('0x43')][_0x0063('0x44')]({'id':_0x31b4b3[_0x0063('0x1e')],'value':_0x3a705d[_0x31b4b3[_0x0063('0x48')][_0x0063('0xf')][_0x0063('0x42')]()][_0x0063('0x24')]()});}});}return _0x5e5055;}function getConnection(_0x2ad33e){return request({'method':_0x0063('0xc'),'form':{'method':'login','input_type':_0x0063('0x1f'),'response_type':_0x0063('0x1f'),'rest_data':JSON[_0x0063('0x20')]({'user_auth':{'user_name':_0x2ad33e[_0x0063('0x49')],'password':_0x2ad33e['password'],'encryption':'PLAIN'},'application':_0x0063('0x4a')})}})[_0x0063('0x2b')](function(_0x5e934a){var _0x4c406a=_0x5e934a;if(_0x4c406a['id']){def[_0x0063('0x4b')]=_0x4c406a['id'];return BPromise['resolve'](_0x4c406a);}else{throw new Error(util[_0x0063('0x22')](_0x0063('0x4c'),_0x2ad33e['id']));}});}function setRelationship(_0x308742,_0x4e47ec,_0x2dcdb3,_0xca1be4){return request({'form':{'method':_0x0063('0x4d'),'input_type':_0x0063('0x1f'),'response_type':_0x0063('0x1f'),'rest_data':JSON[_0x0063('0x20')]({'session':_0x308742['id'],'module_name':_0x0063('0x21'),'module_id':_0x2dcdb3['id'],'link_field_name':_0xca1be4,'related_ids':[_0x4e47ec['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x0063('0x4e')]=function(_0x593114,_0x299f6a,_0xf0303b,_0x4d3355,_0x3baf27,_0x496acf){var _0x2bec17,_0x11a7cb,_0x21035c,_0x4d4a1c;_0x496acf['remoteUri']=intUtil[_0x0063('0x4f')](_0x496acf[_0x0063('0x50')]);_0x496acf[_0x0063('0x51')]=intUtil['stripTrailingSlash'](_0x496acf['serverUrl']);def['uri']=util[_0x0063('0x22')](_0x0063('0x52'),_0x496acf['remoteUri']);if(_0x3baf27&&_0x3baf27[_0x0063('0x53')]){logger[_0x0063('0xd')](_0x0063('0x54'),_0x0063('0x55'));_0x299f6a[_0x0063('0x56')]=util[_0x0063('0x22')](_0x0063('0x57'),_0x496acf['serverUrl'],_0x299f6a['uniqueid'],md5(_0x299f6a[_0x0063('0x58')]));}else{_0x299f6a[_0x0063('0x56')]='';}return getConnection(_0x496acf)[_0x0063('0x2b')](function(_0xdb2fd3){_0x4d4a1c=_0xdb2fd3;return getUser(_0x496acf,_0x4d3355[_0x0063('0xf')],_0x4d4a1c);})[_0x0063('0x2b')](function(_0xe48f3a){_0x2bec17=_0xe48f3a;logger[_0x0063('0xd')](_0x0063('0x59'),_0x2bec17['id']);return getEndUser(_0x496acf,_0x299f6a[_0x0063('0x5a')],_0x299f6a['calleridnum'],_0x4d4a1c);})[_0x0063('0x2b')](function(_0x92ae6e){_0x11a7cb=_0x92ae6e;logger[_0x0063('0xd')]('The\x20Enduser\x20ID\x20is:',_0x11a7cb['id']);return getTicket(_0x496acf,_0x2bec17,_0x11a7cb,_0xf0303b,_0x299f6a,_0xf0303b[_0x0063('0x5b')],_0x4d4a1c,_0x0063('0x5c'));})[_0x0063('0x2b')](function(_0x1837c3){_0x21035c=_0x1837c3;logger[_0x0063('0xd')](_0x0063('0x5d'));logger[_0x0063('0xd')](_0x0063('0x5e'),_0x21035c['id']);return setRelationship(_0x4d4a1c,_0x2bec17,_0x21035c,'users');})['then'](function(){return setRelationship(_0x4d4a1c,_0x11a7cb,_0x21035c,_0x0063('0x5f'));})['then'](function(){return getServerInfo(_0x4d4a1c);})[_0x0063('0x2b')](function(_0x48c573){var _0x1083fb=parseInt(_0x48c573[_0x0063('0x60')][_0x0063('0x61')](0x0));var _0x2b51b2=util[_0x0063('0x22')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x496acf[_0x0063('0x50')],_0x21035c['id']);if(_0x1083fb>0x6){_0x2b51b2=util['format'](_0x0063('0x62'),_0x496acf[_0x0063('0x50')],_0x21035c['id']);}logger['info'](_0x0063('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0063('0x22')](_0x0063('0x63'),_0x4d3355[_0x0063('0xf')]),_0x0063('0x64'),{'uri':_0x2b51b2});})[_0x0063('0x65')](function(_0x376889){logger['error'](_0x0063('0x54'),JSON[_0x0063('0x20')](_0x376889));});};exports['outbound']=function(_0x3c3091,_0x30c440,_0x2d1bed,_0x3b2820,_0xdd6ec,_0xfdfe86,_0x4b0b6d){var _0x1abac9,_0x4169fd,_0x55cced,_0x51cc13;_0xfdfe86[_0x0063('0x50')]=intUtil[_0x0063('0x4f')](_0xfdfe86[_0x0063('0x50')]);_0xfdfe86[_0x0063('0x51')]=intUtil[_0x0063('0x4f')](_0xfdfe86[_0x0063('0x51')]);def['uri']=util[_0x0063('0x22')](_0x0063('0x52'),_0xfdfe86[_0x0063('0x50')]);if(_0x4b0b6d&&_0x4b0b6d['recordingFormat']&&_0x4b0b6d[_0x0063('0x66')]!==_0x0063('0x67')){logger[_0x0063('0xd')](_0x0063('0x68'),_0x0063('0x55'));_0x30c440['recordingURL']=util[_0x0063('0x22')](_0x0063('0x57'),_0xfdfe86[_0x0063('0x51')],_0x30c440[_0x0063('0x58')],md5(_0x30c440['uniqueid']));}return getConnection(_0xfdfe86)[_0x0063('0x2b')](function(_0x197993){_0x51cc13=_0x197993;return getUser(_0xfdfe86,_0x3b2820[_0x0063('0xf')],_0x51cc13);})[_0x0063('0x2b')](function(_0x123f82){_0x1abac9=_0x123f82;logger[_0x0063('0xd')](_0x0063('0x59'),_0x1abac9['id']);return getEndUser(_0xfdfe86,_0x30c440[_0x0063('0x69')],_0x30c440[_0x0063('0x6a')],_0x51cc13);})[_0x0063('0x2b')](function(_0x4e1375){_0x4169fd=_0x4e1375;logger[_0x0063('0xd')](_0x0063('0x6b'),_0x4169fd['id']);return getTicket(_0xfdfe86,_0x1abac9,_0x4169fd,_0x2d1bed,_0x30c440,_0x2d1bed[_0x0063('0x5b')],_0x51cc13,_0x0063('0x6c'));})[_0x0063('0x2b')](function(_0x583d3b){_0x55cced=_0x583d3b;logger[_0x0063('0xd')](_0x0063('0x5d'));logger[_0x0063('0xd')](_0x0063('0x5e'),_0x55cced['id']);return setRelationship(_0x51cc13,_0x1abac9,_0x55cced,_0x0063('0x6d'));})[_0x0063('0x2b')](function(){return setRelationship(_0x51cc13,_0x4169fd,_0x55cced,_0x0063('0x5f'));})[_0x0063('0x2b')](function(){return getServerInfo(_0x51cc13);})[_0x0063('0x2b')](function(_0xe663e){var _0x727e45=parseInt(_0xe663e['version']['charAt'](0x0));var _0x2a6390=util[_0x0063('0x22')](_0x0063('0x6e'),_0xfdfe86[_0x0063('0x50')],_0x55cced['id']);if(_0x727e45>0x6){_0x2a6390=util['format'](_0x0063('0x62'),_0xfdfe86[_0x0063('0x50')],_0x55cced['id']);}logger[_0x0063('0xd')](_0x0063('0x68'),_0x0063('0x6f'));emit(util[_0x0063('0x22')](_0x0063('0x63'),_0x3b2820[_0x0063('0xf')]),_0x0063('0x64'),{'uri':_0x2a6390});})[_0x0063('0x65')](function(_0x244360){logger[_0x0063('0x70')](_0x0063('0x68'),JSON[_0x0063('0x20')](_0x244360));});};exports[_0x0063('0x71')]=function(_0x450eea,_0x3d9b31,_0x1d139e,_0x27662e,_0x539b8,_0x166a94){var _0x1bea94,_0x3052a6,_0x2fcd65,_0x44ed12;_0x166a94[_0x0063('0x50')]=intUtil['stripTrailingSlash'](_0x166a94['remoteUri']);_0x166a94['serverUrl']=intUtil[_0x0063('0x4f')](_0x166a94['serverUrl']);def[_0x0063('0x72')]=util[_0x0063('0x22')](_0x0063('0x52'),_0x166a94[_0x0063('0x50')]);if(_0x539b8&&_0x539b8[_0x0063('0x53')]){logger[_0x0063('0xd')]('['+_0x3d9b31[_0x0063('0x73')]['toUpperCase']()+']',_0x0063('0x55'));_0x3d9b31['recordingURL']=util[_0x0063('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x166a94['serverUrl'],_0x3d9b31[_0x0063('0x58')],md5(_0x3d9b31[_0x0063('0x58')]));}else{_0x3d9b31['recordingURL']='';}return getConnection(_0x166a94)[_0x0063('0x2b')](function(_0x36d4b2){_0x44ed12=_0x36d4b2;if(!_[_0x0063('0x74')](_0x27662e)){return getUser(_0x166a94,_0x27662e[_0x0063('0xf')],_0x44ed12);}else{return getUser(_0x166a94,null,_0x44ed12);}})[_0x0063('0x2b')](function(_0x42d0c9){_0x1bea94=_0x42d0c9;logger[_0x0063('0xd')](_0x0063('0x59'),_0x1bea94['id']);return getEndUser(_0x166a94,_0x3d9b31[_0x0063('0x5a')],_0x3d9b31['calleridnum'],_0x44ed12);})[_0x0063('0x2b')](function(_0x1db8d3){_0x3052a6=_0x1db8d3;logger[_0x0063('0xd')](_0x0063('0x6b'),_0x3052a6['id']);return getTicket(_0x166a94,_0x1bea94,_0x3052a6,_0x1d139e,_0x3d9b31,_0x1d139e[_0x0063('0x5b')],_0x44ed12,_0x0063('0x5c'));})[_0x0063('0x2b')](function(_0x2352e2){_0x2fcd65=_0x2352e2;logger[_0x0063('0xd')](_0x0063('0x5d'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2fcd65['id']);return setRelationship(_0x44ed12,_0x1bea94,_0x2fcd65,_0x0063('0x6d'));})[_0x0063('0x2b')](function(){return setRelationship(_0x44ed12,_0x3052a6,_0x2fcd65,'contacts');})['then'](function(){return getServerInfo(_0x44ed12);})[_0x0063('0x65')](function(_0x3d1c2d){logger[_0x0063('0x70')]('['+_0x3d9b31[_0x0063('0x73')][_0x0063('0x75')]()+']',JSON[_0x0063('0x20')](_0x3d1c2d));});}; \ No newline at end of file +var _0x280b=['duration_hours','duration_minutes','parent_id','Contacts','parent_name','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','find','name_value_list','user_name','value','Agent\x20found!','resolve','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','forEach','type','customField','nameField','content','toString','string','variable','customVariable','Variable','toLowerCase','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Outbound','contacts','user:%s','trigger:browser:url','unmanaged','uri','monitor_format','calleridname','toUpperCase','request-promise','bluebird','ioredis','./util','redis','defaults','localhost','info','name','getString','created_by','description','Descriptions','date_start','toISOString','slice','replace'];(function(_0x1b00d0,_0x265b67){var _0x31446c=function(_0x4e4679){while(--_0x4e4679){_0x1b00d0['push'](_0x1b00d0['shift']());}};_0x31446c(++_0x265b67);}(_0x280b,0x1bf));var _0xb280=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x280b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var rp=require(_0xb280('0x0'));var BPromise=require(_0xb280('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xb280('0x2'));var intUtil=require(_0xb280('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('sugarcrm');config[_0xb280('0x4')]=_[_0xb280('0x5')](config['redis'],{'host':_0xb280('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0xd044e8,_0x4f79cd,_0x17bb79){io['to'](_0xd044e8)['emit'](_0x4f79cd,_0x17bb79);}function getTicket(_0x10eed9,_0x2ba011,_0x48296b,_0x5c98b1,_0x314169,_0x54713e,_0x4672bd,_0x4b0365){logger[_0xb280('0x7')]('Creating\x20new\x20ticket...');var _0x2178a9=new Date();var _0x3a9573=[{'name':_0xb280('0x8'),'value':intUtil[_0xb280('0x9')](_0x5c98b1['Subjects'],_0x314169,'\x20')},{'name':'assigned_user_id','value':_0x2ba011['id']},{'name':_0xb280('0xa'),'value':_0x2ba011['id']},{'name':_0xb280('0xb'),'value':intUtil['getString'](_0x5c98b1[_0xb280('0xc')],_0x314169,'\x0a')},{'name':_0xb280('0xd'),'value':_0x2178a9[_0xb280('0xe')]()[_0xb280('0xf')](0x0,0x13)[_0xb280('0x10')]('T','\x20')},{'name':_0xb280('0x11'),'value':'0'},{'name':_0xb280('0x12'),'value':'15'},{'name':_0xb280('0x13'),'value':_0x48296b['id']},{'name':'parent_type','value':_0xb280('0x14')},{'name':_0xb280('0x15'),'value':_0x48296b[_0xb280('0x8')]},{'name':'direction','value':_0x4b0365}];if(_0x54713e['length']){_['forEach'](_0x54713e,function(_0xa7bb4b){if(_0x314169[_0xa7bb4b[_0xb280('0x16')]]){_0x3a9573[_0xb280('0x17')]({'name':_0xa7bb4b[_0xb280('0x18')],'value':_0x314169[_0xa7bb4b[_0xb280('0x16')]]});}});}return request({'form':{'method':_0xb280('0x19'),'input_type':_0xb280('0x1a'),'response_type':_0xb280('0x1a'),'rest_data':JSON[_0xb280('0x1b')]({'session':_0x4672bd['id'],'module_name':_0xb280('0x1c'),'name_value_list':_0x3a9573})}});}function getAuth(_0x52cc87){return util[_0xb280('0x1d')](_0xb280('0x1e'),new Buffer(_0x52cc87[_0xb280('0x1f')]+':X')['toString'](_0xb280('0x20')));}function getServerInfo(_0x336088){return request({'form':{'method':_0xb280('0x21'),'input_type':_0xb280('0x1a'),'response_type':_0xb280('0x1a'),'rest_data':JSON[_0xb280('0x1b')]({'session':_0x336088['id']})}});}function getUser(_0x760e2,_0x145c92,_0xd7a11d){if(!_[_0xb280('0x22')](_0x145c92)){logger[_0xb280('0x7')](_0xb280('0x23'),_0x145c92);return request({'form':{'method':_0xb280('0x24'),'input_type':_0xb280('0x1a'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0xd7a11d['id'],'module_name':_0xb280('0x25'),'query':util[_0xb280('0x1d')](_0xb280('0x26'),_0x145c92),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb280('0x27')](function(_0x42979e){if(_0x42979e[_0xb280('0x28')][_0xb280('0x29')]){var _0x228713=_[_0xb280('0x2a')](_0x42979e[_0xb280('0x28')],function(_0x4942ee){return _0x4942ee[_0xb280('0x2b')][_0xb280('0x2c')][_0xb280('0x2d')]===_0x145c92;});if(_0x228713){logger[_0xb280('0x7')](_0xb280('0x2e'));return BPromise[_0xb280('0x2f')]({'id':_0x228713[_0xb280('0x2b')]['id'][_0xb280('0x2d')],'name':_0x228713[_0xb280('0x2b')]['name'][_0xb280('0x2d')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0xd7a11d[_0xb280('0x2b')][_0xb280('0x30')][_0xb280('0x2d')],'name':_0xd7a11d[_0xb280('0x2b')][_0xb280('0x2c')]['value']});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0xd7a11d[_0xb280('0x2b')][_0xb280('0x30')][_0xb280('0x2d')],'name':_0xd7a11d[_0xb280('0x2b')]['user_name']['value']});}}function getEndUser(_0x4ce40d,_0x3a6172,_0x951efc,_0x5167ee){logger[_0xb280('0x7')](_0xb280('0x31'),_0x951efc);return request({'form':{'method':_0xb280('0x24'),'input_type':_0xb280('0x1a'),'response_type':_0xb280('0x1a'),'rest_data':JSON[_0xb280('0x1b')]({'session':_0x5167ee['id'],'module_name':'Contacts','query':util[_0xb280('0x1d')](_0xb280('0x32'),_0x951efc),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb280('0x27')](function(_0x443dd7){if(_0x443dd7[_0xb280('0x28')][_0xb280('0x29')]){var _0x55be72=_['find'](_0x443dd7[_0xb280('0x28')],function(_0xf674f4){return _0xf674f4[_0xb280('0x2b')][_0xb280('0x33')][_0xb280('0x2d')]===_0x951efc;});if(_0x55be72){logger['info'](_0xb280('0x34'));return BPromise['resolve']({'id':_0x55be72[_0xb280('0x2b')]['id'][_0xb280('0x2d')],'name':_0x55be72[_0xb280('0x2b')]['name'][_0xb280('0x2d')],'phone':_0x55be72['name_value_list'][_0xb280('0x33')][_0xb280('0x2d')]});}}else{logger[_0xb280('0x7')](_0xb280('0x35'));return request({'form':{'method':_0xb280('0x19'),'input_type':_0xb280('0x1a'),'response_type':_0xb280('0x1a'),'rest_data':JSON[_0xb280('0x1b')]({'session':_0x5167ee['id'],'module_name':_0xb280('0x14'),'name_value_list':[{'name':_0xb280('0x36'),'value':_0x3a6172!==_0xb280('0x37')?_0x3a6172:util[_0xb280('0x1d')](_0xb280('0x38'),_0x951efc)},{'name':'phone_home','value':_0x951efc}]})}})[_0xb280('0x27')](function(_0x5d9e4c){logger['info'](_0xb280('0x39'));return BPromise[_0xb280('0x2f')]({'id':_0x5d9e4c['id'],'name':_0x5d9e4c['entry_list'][_0xb280('0x36')]['value'],'phone':_0x5d9e4c['entry_list']['phone_home'][_0xb280('0x2d')]});});}});}function request(_0x36e71a){logger[_0xb280('0x3a')]('[HTTP]',JSON['stringify'](_0x36e71a));return rp(_[_0xb280('0x3b')](def,_0x36e71a));}function getTags(_0x5f44a2,_0x322a0e){var _0x504609=[];if(_0x5f44a2&&_0x5f44a2[_0xb280('0x29')]>0x0){_0x504609=_[_0xb280('0x3c')](_0x5f44a2,_0x322a0e);}return _0x504609;}function getCustomFields(_0x1dc885,_0x5caba3){var _0x508b93=[];var _0x58d04c={'custom_fields':[]};if(_0x1dc885[_0xb280('0x29')]>0x0){_[_0xb280('0x3d')](_0x1dc885,function(_0xd4e079){if(_0xd4e079[_0xb280('0x3e')]==='string'&&_0xd4e079['nameField']&&!_0xd4e079[_0xb280('0x3f')]){_0x58d04c[_0xd4e079[_0xb280('0x40')]['toLowerCase']()]=_0xd4e079[_0xb280('0x41')][_0xb280('0x42')]();}else if(_0xd4e079['type']===_0xb280('0x43')&&_0xd4e079['idField']&&_0xd4e079[_0xb280('0x3f')]){_0x58d04c['custom_fields']['push']({'id':_0xd4e079[_0xb280('0x18')],'value':_0xd4e079[_0xb280('0x41')][_0xb280('0x42')]()});}else if(_0xd4e079[_0xb280('0x3e')]===_0xb280('0x44')&&_0xd4e079['variableName']&&_0xd4e079[_0xb280('0x18')]&&_0xd4e079['customField']){_0x5caba3[_0xd4e079[_0xb280('0x16')]]&&_0x58d04c['custom_fields'][_0xb280('0x17')]({'id':_0xd4e079[_0xb280('0x18')],'value':_0x5caba3[_0xd4e079[_0xb280('0x16')]][_0xb280('0x42')]()});}else if(_0xd4e079[_0xb280('0x3e')]===_0xb280('0x45')&&_0xd4e079['Variable']&&_0xd4e079['Variable'][_0xb280('0x8')]&&_0xd4e079[_0xb280('0x18')]&&_0xd4e079['customField']){_0x5caba3[_0xd4e079[_0xb280('0x46')][_0xb280('0x8')][_0xb280('0x47')]()]&&_0x58d04c['custom_fields'][_0xb280('0x17')]({'id':_0xd4e079[_0xb280('0x18')],'value':_0x5caba3[_0xd4e079[_0xb280('0x46')]['name']['toLowerCase']()][_0xb280('0x42')]()});}});}return _0x58d04c;}function getConnection(_0x45092f){return request({'method':_0xb280('0x48'),'form':{'method':_0xb280('0x49'),'input_type':'JSON','response_type':_0xb280('0x1a'),'rest_data':JSON[_0xb280('0x1b')]({'user_auth':{'user_name':_0x45092f[_0xb280('0x4a')],'password':_0x45092f[_0xb280('0x4b')],'encryption':_0xb280('0x4c')},'application':_0xb280('0x4d')})}})['then'](function(_0x1d38dc){var _0x3e1ed5=_0x1d38dc;if(_0x3e1ed5['id']){def[_0xb280('0x4e')]=_0x3e1ed5['id'];return BPromise[_0xb280('0x2f')](_0x3e1ed5);}else{throw new Error(util[_0xb280('0x1d')]('Account\x20%d\x20is\x20not\x20valid',_0x45092f['id']));}});}function setRelationship(_0x8d1b78,_0x4d051b,_0x33f58b,_0x34604b){return request({'form':{'method':_0xb280('0x4f'),'input_type':_0xb280('0x1a'),'response_type':_0xb280('0x1a'),'rest_data':JSON[_0xb280('0x1b')]({'session':_0x8d1b78['id'],'module_name':'Calls','module_id':_0x33f58b['id'],'link_field_name':_0x34604b,'related_ids':[_0x4d051b['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x25b277,_0x465e29,_0x5b6d76,_0x549e8c,_0x143a9b,_0x317c0c){var _0x45470b,_0x322f03,_0x572032,_0x42ce43;_0x317c0c[_0xb280('0x50')]=intUtil[_0xb280('0x51')](_0x317c0c[_0xb280('0x50')]);_0x317c0c['serverUrl']=intUtil[_0xb280('0x51')](_0x317c0c[_0xb280('0x52')]);def['uri']=util['format'](_0xb280('0x53'),_0x317c0c['remoteUri']);if(_0x143a9b&&_0x143a9b['monitor_format']){logger['info'](_0xb280('0x54'),_0xb280('0x55'));_0x465e29['recordingURL']=util[_0xb280('0x1d')](_0xb280('0x56'),_0x317c0c[_0xb280('0x52')],_0x465e29[_0xb280('0x57')],md5(_0x465e29[_0xb280('0x57')]));}else{_0x465e29[_0xb280('0x58')]='';}return getConnection(_0x317c0c)[_0xb280('0x27')](function(_0x388113){_0x42ce43=_0x388113;return getUser(_0x317c0c,_0x549e8c[_0xb280('0x8')],_0x42ce43);})[_0xb280('0x27')](function(_0x9d4d33){_0x45470b=_0x9d4d33;logger[_0xb280('0x7')](_0xb280('0x59'),_0x45470b['id']);return getEndUser(_0x317c0c,_0x465e29['calleridname'],_0x465e29[_0xb280('0x5a')],_0x42ce43);})[_0xb280('0x27')](function(_0x445146){_0x322f03=_0x445146;logger[_0xb280('0x7')](_0xb280('0x5b'),_0x322f03['id']);return getTicket(_0x317c0c,_0x45470b,_0x322f03,_0x5b6d76,_0x465e29,_0x5b6d76[_0xb280('0x5c')],_0x42ce43,_0xb280('0x5d'));})['then'](function(_0x253be9){_0x572032=_0x253be9;logger[_0xb280('0x7')](_0xb280('0x5e'));logger[_0xb280('0x7')](_0xb280('0x5f'),_0x572032['id']);return setRelationship(_0x42ce43,_0x45470b,_0x572032,_0xb280('0x60'));})['then'](function(){return setRelationship(_0x42ce43,_0x322f03,_0x572032,'contacts');})[_0xb280('0x27')](function(){return getServerInfo(_0x42ce43);})['then'](function(_0x53d731){var _0x23289e=parseInt(_0x53d731[_0xb280('0x61')]['charAt'](0x0));var _0xa49863=util[_0xb280('0x1d')](_0xb280('0x62'),_0x317c0c[_0xb280('0x50')],_0x572032['id']);if(_0x23289e>0x6){_0xa49863=util[_0xb280('0x1d')](_0xb280('0x63'),_0x317c0c['remoteUri'],_0x572032['id']);}logger[_0xb280('0x7')](_0xb280('0x54'),_0xb280('0x64'));emit(util['format']('user:%s',_0x549e8c['name']),'trigger:browser:url',{'uri':_0xa49863});})[_0xb280('0x65')](function(_0x43df8c){logger[_0xb280('0x66')](_0xb280('0x54'),JSON[_0xb280('0x1b')](_0x43df8c));});};exports[_0xb280('0x67')]=function(_0x5c760f,_0x264bba,_0x5b2c92,_0x5542aa,_0x1e74b8,_0x3703fb,_0x4cc30a){var _0x3d3b82,_0x2acedc,_0x5b5340,_0x313cbe;_0x3703fb[_0xb280('0x50')]=intUtil[_0xb280('0x51')](_0x3703fb['remoteUri']);_0x3703fb[_0xb280('0x52')]=intUtil[_0xb280('0x51')](_0x3703fb[_0xb280('0x52')]);def['uri']=util[_0xb280('0x1d')](_0xb280('0x53'),_0x3703fb[_0xb280('0x50')]);if(_0x4cc30a&&_0x4cc30a[_0xb280('0x68')]&&_0x4cc30a[_0xb280('0x68')]!==_0xb280('0x69')){logger[_0xb280('0x7')](_0xb280('0x6a'),_0xb280('0x55'));_0x264bba['recordingURL']=util[_0xb280('0x1d')](_0xb280('0x56'),_0x3703fb['serverUrl'],_0x264bba[_0xb280('0x57')],md5(_0x264bba[_0xb280('0x57')]));}return getConnection(_0x3703fb)[_0xb280('0x27')](function(_0x1fcee2){_0x313cbe=_0x1fcee2;return getUser(_0x3703fb,_0x5542aa['name'],_0x313cbe);})[_0xb280('0x27')](function(_0x36f43c){_0x3d3b82=_0x36f43c;logger[_0xb280('0x7')](_0xb280('0x59'),_0x3d3b82['id']);return getEndUser(_0x3703fb,_0x264bba['destcalleridname'],_0x264bba['destcalleridnum'],_0x313cbe);})[_0xb280('0x27')](function(_0x4cff10){_0x2acedc=_0x4cff10;logger[_0xb280('0x7')](_0xb280('0x5b'),_0x2acedc['id']);return getTicket(_0x3703fb,_0x3d3b82,_0x2acedc,_0x5b2c92,_0x264bba,_0x5b2c92[_0xb280('0x5c')],_0x313cbe,_0xb280('0x6b'));})[_0xb280('0x27')](function(_0x25e632){_0x5b5340=_0x25e632;logger[_0xb280('0x7')](_0xb280('0x5e'));logger[_0xb280('0x7')]('The\x20Ticket\x20ID\x20is:',_0x5b5340['id']);return setRelationship(_0x313cbe,_0x3d3b82,_0x5b5340,_0xb280('0x60'));})[_0xb280('0x27')](function(){return setRelationship(_0x313cbe,_0x2acedc,_0x5b5340,_0xb280('0x6c'));})[_0xb280('0x27')](function(){return getServerInfo(_0x313cbe);})[_0xb280('0x27')](function(_0x11f5e2){var _0x58485d=parseInt(_0x11f5e2[_0xb280('0x61')]['charAt'](0x0));var _0x403805=util[_0xb280('0x1d')](_0xb280('0x62'),_0x3703fb[_0xb280('0x50')],_0x5b5340['id']);if(_0x58485d>0x6){_0x403805=util[_0xb280('0x1d')](_0xb280('0x63'),_0x3703fb[_0xb280('0x50')],_0x5b5340['id']);}logger[_0xb280('0x7')](_0xb280('0x6a'),_0xb280('0x64'));emit(util[_0xb280('0x1d')](_0xb280('0x6d'),_0x5542aa[_0xb280('0x8')]),_0xb280('0x6e'),{'uri':_0x403805});})[_0xb280('0x65')](function(_0x25be72){logger[_0xb280('0x66')]('[OUTBOUND]',JSON[_0xb280('0x1b')](_0x25be72));});};exports[_0xb280('0x6f')]=function(_0x3780b0,_0x4b556d,_0x544e86,_0x2fb468,_0x13500f,_0x2c6d6f){var _0x41b0fb,_0x2841af,_0x1bb55d,_0x13f604;_0x2c6d6f[_0xb280('0x50')]=intUtil[_0xb280('0x51')](_0x2c6d6f[_0xb280('0x50')]);_0x2c6d6f[_0xb280('0x52')]=intUtil[_0xb280('0x51')](_0x2c6d6f[_0xb280('0x52')]);def[_0xb280('0x70')]=util[_0xb280('0x1d')](_0xb280('0x53'),_0x2c6d6f[_0xb280('0x50')]);if(_0x13500f&&_0x13500f[_0xb280('0x71')]){logger[_0xb280('0x7')]('['+_0x4b556d['lastevent']['toUpperCase']()+']',_0xb280('0x55'));_0x4b556d[_0xb280('0x58')]=util[_0xb280('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2c6d6f[_0xb280('0x52')],_0x4b556d[_0xb280('0x57')],md5(_0x4b556d[_0xb280('0x57')]));}else{_0x4b556d[_0xb280('0x58')]='';}return getConnection(_0x2c6d6f)[_0xb280('0x27')](function(_0x6eba28){_0x13f604=_0x6eba28;if(!_['isNil'](_0x2fb468)){return getUser(_0x2c6d6f,_0x2fb468[_0xb280('0x8')],_0x13f604);}else{return getUser(_0x2c6d6f,null,_0x13f604);}})['then'](function(_0x149140){_0x41b0fb=_0x149140;logger[_0xb280('0x7')](_0xb280('0x59'),_0x41b0fb['id']);return getEndUser(_0x2c6d6f,_0x4b556d[_0xb280('0x72')],_0x4b556d[_0xb280('0x5a')],_0x13f604);})[_0xb280('0x27')](function(_0x426fbd){_0x2841af=_0x426fbd;logger[_0xb280('0x7')]('The\x20Enduser\x20ID\x20is:',_0x2841af['id']);return getTicket(_0x2c6d6f,_0x41b0fb,_0x2841af,_0x544e86,_0x4b556d,_0x544e86[_0xb280('0x5c')],_0x13f604,'Inbound');})[_0xb280('0x27')](function(_0x139347){_0x1bb55d=_0x139347;logger[_0xb280('0x7')](_0xb280('0x5e'));logger[_0xb280('0x7')](_0xb280('0x5f'),_0x1bb55d['id']);return setRelationship(_0x13f604,_0x41b0fb,_0x1bb55d,_0xb280('0x60'));})[_0xb280('0x27')](function(){return setRelationship(_0x13f604,_0x2841af,_0x1bb55d,'contacts');})[_0xb280('0x27')](function(){return getServerInfo(_0x13f604);})['catch'](function(_0x35de62){logger[_0xb280('0x66')]('['+_0x4b556d['lastevent'][_0xb280('0x73')]()+']',JSON[_0xb280('0x1b')](_0x35de62));});}; \ 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 bf16a5e..213fa45 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 _0x1b73=['Variable','name','push','toLowerCase','keyValue','keyType','format','%s:\x20%s','keyContent','key','join','slice','substring','lastIndexOf','validateEmail','isNil','test','util','getString','length','type','string','variable','variableName','toString','customVariable'];(function(_0x29a62d,_0x2790e3){var _0x3fd562=function(_0x161a74){while(--_0x161a74){_0x29a62d['push'](_0x29a62d['shift']());}};_0x3fd562(++_0x2790e3);}(_0x1b73,0x163));var _0x31b7=function(_0x383522,_0x139c39){_0x383522=_0x383522-0x0;var _0x70e7a7=_0x1b73[_0x383522];return _0x70e7a7;};'use strict';var _=require('lodash');var util=require(_0x31b7('0x0'));exports[_0x31b7('0x1')]=function(_0x16c0b2,_0x1ad60a,_0x3bb035){var _0x3160b6=[];if(_0x16c0b2['length']>0x0){var _0x51e183=_['sortBy'](_0x16c0b2,['id']);for(var _0x239d95=0x0;_0x239d95<_0x51e183[_0x31b7('0x2')];_0x239d95++){var _0xd539dd=_0x51e183[_0x239d95];if(_0xd539dd[_0x31b7('0x3')]===_0x31b7('0x4')){_0x3160b6['push'](_0xd539dd['content']);}else if(_0xd539dd[_0x31b7('0x3')]===_0x31b7('0x5')&&_0xd539dd[_0x31b7('0x6')]){_0x1ad60a[_0xd539dd[_0x31b7('0x6')]]&&_0x3160b6['push'](_0x1ad60a[_0xd539dd['variableName']][_0x31b7('0x7')]());}else if(_0xd539dd[_0x31b7('0x3')]===_0x31b7('0x8')&&_0xd539dd[_0x31b7('0x9')]&&_0xd539dd[_0x31b7('0x9')][_0x31b7('0xa')]){_0x1ad60a[_0xd539dd[_0x31b7('0x9')][_0x31b7('0xa')]['toLowerCase']()]&&_0x3160b6[_0x31b7('0xb')](_0x1ad60a[_0xd539dd['Variable'][_0x31b7('0xa')][_0x31b7('0xc')]()]['toString']());}else if(_0xd539dd[_0x31b7('0x3')]===_0x31b7('0xd')){if(_0xd539dd[_0x31b7('0xe')]===_0x31b7('0x4')&&_0xd539dd['key']){_0x3160b6[_0x31b7('0xb')](util[_0x31b7('0xf')](_0x31b7('0x10'),_0xd539dd['key'],_0xd539dd[_0x31b7('0x11')]));}else if(_0xd539dd[_0x31b7('0xe')]===_0x31b7('0x5')&&_0xd539dd[_0x31b7('0x6')]&&_0xd539dd[_0x31b7('0x12')]){_0x1ad60a[_0xd539dd['variableName']]&&_0x3160b6[_0x31b7('0xb')](util[_0x31b7('0xf')]('%s:\x20%s',_0xd539dd['key'],_0x1ad60a[_0xd539dd[_0x31b7('0x6')]]));}else if(_0xd539dd[_0x31b7('0xe')]==='customVariable'&&_0xd539dd[_0x31b7('0x9')]&&_0xd539dd['Variable'][_0x31b7('0xa')]&&_0xd539dd[_0x31b7('0x12')]){_0x1ad60a[_0xd539dd[_0x31b7('0x9')]['name'][_0x31b7('0xc')]()]&&_0x3160b6[_0x31b7('0xb')](util[_0x31b7('0xf')](_0x31b7('0x10'),_0xd539dd['key'],_0x1ad60a[_0xd539dd['Variable'][_0x31b7('0xa')][_0x31b7('0xc')]()]));}}}}return _0x3160b6[_0x31b7('0x13')](_0x3bb035);};exports['stripTrailingSlash']=function(_0x5ed94b){var _0x5c4691=_0x5ed94b[_0x31b7('0x14')](-0x1);if(_0x5c4691==='/'){_0x5ed94b=_0x5ed94b[_0x31b7('0x15')](0x0,_0x5ed94b[_0x31b7('0x16')](_0x5c4691));}return _0x5ed94b;};exports[_0x31b7('0x17')]=function(_0x286552){if(!_[_0x31b7('0x18')](_0x286552)&&_0x286552!==''){var _0x5916bb=/^(([^<>()\[\]\\.,;:\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 _0x5916bb[_0x31b7('0x19')](String(_0x286552)[_0x31b7('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x0677=['sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','key','%s:\x20%s','keyType','format','join','stripTrailingSlash','slice','substring','validateEmail','isNil','lodash'];(function(_0x236cab,_0x2c780f){var _0x2f3726=function(_0x2422d8){while(--_0x2422d8){_0x236cab['push'](_0x236cab['shift']());}};_0x2f3726(++_0x2c780f);}(_0x0677,0xd7));var _0x7067=function(_0x5be8cc,_0x4a6037){_0x5be8cc=_0x5be8cc-0x0;var _0x5f1b7e=_0x0677[_0x5be8cc];return _0x5f1b7e;};'use strict';var _=require(_0x7067('0x0'));var util=require('util');exports['getString']=function(_0x218c29,_0x1471f5,_0x24045f){var _0x584e4c=[];if(_0x218c29['length']>0x0){var _0x3c1078=_[_0x7067('0x1')](_0x218c29,['id']);for(var _0x5858f1=0x0;_0x5858f1<_0x3c1078['length'];_0x5858f1++){var _0x4feb29=_0x3c1078[_0x5858f1];if(_0x4feb29[_0x7067('0x2')]===_0x7067('0x3')){_0x584e4c[_0x7067('0x4')](_0x4feb29[_0x7067('0x5')]);}else if(_0x4feb29[_0x7067('0x2')]===_0x7067('0x6')&&_0x4feb29[_0x7067('0x7')]){_0x1471f5[_0x4feb29[_0x7067('0x7')]]&&_0x584e4c['push'](_0x1471f5[_0x4feb29[_0x7067('0x7')]][_0x7067('0x8')]());}else if(_0x4feb29[_0x7067('0x2')]===_0x7067('0x9')&&_0x4feb29[_0x7067('0xa')]&&_0x4feb29[_0x7067('0xa')][_0x7067('0xb')]){_0x1471f5[_0x4feb29['Variable'][_0x7067('0xb')]['toLowerCase']()]&&_0x584e4c[_0x7067('0x4')](_0x1471f5[_0x4feb29['Variable'][_0x7067('0xb')][_0x7067('0xc')]()]['toString']());}else if(_0x4feb29['type']===_0x7067('0xd')){if(_0x4feb29['keyType']===_0x7067('0x3')&&_0x4feb29[_0x7067('0xe')]){_0x584e4c[_0x7067('0x4')](util['format'](_0x7067('0xf'),_0x4feb29[_0x7067('0xe')],_0x4feb29['keyContent']));}else if(_0x4feb29[_0x7067('0x10')]===_0x7067('0x6')&&_0x4feb29[_0x7067('0x7')]&&_0x4feb29['key']){_0x1471f5[_0x4feb29['variableName']]&&_0x584e4c[_0x7067('0x4')](util[_0x7067('0x11')](_0x7067('0xf'),_0x4feb29['key'],_0x1471f5[_0x4feb29[_0x7067('0x7')]]));}else if(_0x4feb29['keyType']===_0x7067('0x9')&&_0x4feb29['Variable']&&_0x4feb29[_0x7067('0xa')][_0x7067('0xb')]&&_0x4feb29[_0x7067('0xe')]){_0x1471f5[_0x4feb29[_0x7067('0xa')]['name']['toLowerCase']()]&&_0x584e4c['push'](util[_0x7067('0x11')](_0x7067('0xf'),_0x4feb29[_0x7067('0xe')],_0x1471f5[_0x4feb29[_0x7067('0xa')][_0x7067('0xb')][_0x7067('0xc')]()]));}}}}return _0x584e4c[_0x7067('0x12')](_0x24045f);};exports[_0x7067('0x13')]=function(_0x122a70){var _0x576e2d=_0x122a70[_0x7067('0x14')](-0x1);if(_0x576e2d==='/'){_0x122a70=_0x122a70[_0x7067('0x15')](0x0,_0x122a70['lastIndexOf'](_0x576e2d));}return _0x122a70;};exports[_0x7067('0x16')]=function(_0x3f8dcb){if(!_[_0x7067('0x17')](_0x3f8dcb)&&_0x3f8dcb!==''){var _0x5a3cd5=/^(([^<>()\[\]\\.,;:\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 _0x5a3cd5['test'](String(_0x3f8dcb)[_0x7067('0xc')]());}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 71c812c..3ecf420 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 _0x98dc=['resolve','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','then','result','Agent\x20found!','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','admin','%s/webservice.php','Enduser\x20found!','firstname','lastname','Contacts','phone','getEndUser','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','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','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','serverUrl','recordingFormat','email','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[OUTBOUND]','trigger:browser:url','lastevent','toUpperCase','calleridname','Ticket\x20created!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','socket.io-emitter','emit','length','type','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','merge','Normal','Open','Subjects','getString','POST','remoteUri','create','sessionName','HelpDesk','stringify','success'];(function(_0x28f76b,_0x357734){var _0x19c11e=function(_0x48d0ca){while(--_0x48d0ca){_0x28f76b['push'](_0x28f76b['shift']());}};_0x19c11e(++_0x357734);}(_0x98dc,0x96));var _0xc98d=function(_0x1f39d1,_0x3ac1cd){_0x1f39d1=_0x1f39d1-0x0;var _0x4dd32c=_0x98dc[_0x1f39d1];return _0x4dd32c;};'use strict';var _=require(_0xc98d('0x0'));var rp=require(_0xc98d('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0xc98d('0x2'));var Redis=require(_0xc98d('0x3'));var intUtil=require(_0xc98d('0x4'));var config=require(_0xc98d('0x5'));var logger=require(_0xc98d('0x6'))(_0xc98d('0x7'));config[_0xc98d('0x8')]=_[_0xc98d('0x9')](config[_0xc98d('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc98d('0xa'))(new Redis(config[_0xc98d('0x8')]));function emit(_0x2a86e3,_0x286edc,_0x145a00){io['to'](_0x2a86e3)[_0xc98d('0xb')](_0x286edc,_0x145a00);}function getCustomFields(_0x5e7b63,_0x517138){var _0x539d4e={};if(_0x5e7b63[_0xc98d('0xc')]>0x0){_['forEach'](_0x5e7b63,function(_0x3d45dc){if(_0x3d45dc[_0xc98d('0xd')]===_0xc98d('0xe')&&_0x3d45dc[_0xc98d('0xf')]){_0x539d4e[_0x3d45dc[_0xc98d('0xf')]]=_0x3d45dc['content'][_0xc98d('0x10')]();}else if(_0x3d45dc[_0xc98d('0xd')]===_0xc98d('0x11')&&_0x3d45dc[_0xc98d('0x12')]&&_0x3d45dc[_0xc98d('0xf')]&&_0x517138[_0x3d45dc[_0xc98d('0x12')]]){_0x539d4e[_0x3d45dc[_0xc98d('0xf')]]=_0x517138[_0x3d45dc[_0xc98d('0x12')]]['toString']();}else if(_0x3d45dc[_0xc98d('0xd')]===_0xc98d('0x13')&&_0x3d45dc[_0xc98d('0x14')]&&_0x3d45dc[_0xc98d('0x14')]['name']&&_0x3d45dc[_0xc98d('0xf')]&&_0x517138[_0x3d45dc['Variable'][_0xc98d('0x15')][_0xc98d('0x16')]()]){_0x539d4e[_0x3d45dc[_0xc98d('0xf')]]=_0x517138[_0x3d45dc[_0xc98d('0x14')]['name'][_0xc98d('0x16')]()]['toString']();}});}return _0x539d4e;}function createTicket(_0x4a6e97,_0x14bc4c,_0x56e60b,_0x25daff,_0x5e9730,_0x1109ac,_0x331f22){logger[_0xc98d('0x17')]('Creating\x20new\x20ticket...');var _0x3b9219=_[_0xc98d('0x18')]({'parent_id':'','assigned_user_id':_0x14bc4c['id'],'ticketpriorities':_0xc98d('0x19'),'ticketstatus':_0xc98d('0x1a'),'ticket_title':intUtil['getString'](_0x25daff[_0xc98d('0x1b')],_0x5e9730,'\x20'),'description':intUtil[_0xc98d('0x1c')](_0x25daff['Descriptions'],_0x5e9730,'\x0a'),'contact_id':_0x56e60b['id']},getCustomFields(_0x1109ac,_0x5e9730));var _0x1f965c={'method':_0xc98d('0x1d'),'uri':util['format']('%s/webservice.php',_0x4a6e97[_0xc98d('0x1e')]),'form':{'operation':_0xc98d('0x1f'),'username':_0x4a6e97['username'],'sessionName':_0x331f22[_0xc98d('0x20')],'elementType':_0xc98d('0x21'),'element':JSON[_0xc98d('0x22')](_0x3b9219)},'json':!![]};return request(_0x1f965c)['then'](function(_0x5a4058){if(_0x5a4058[_0xc98d('0x23')]){return BPromise[_0xc98d('0x24')]({'id':_0x5a4058['result']['id']});}else{throw new Error(util[_0xc98d('0x25')](_0xc98d('0x26'),JSON['stringify'](_0x5a4058[_0xc98d('0x27')])));}})[_0xc98d('0x28')](function(_0x8262c6){var _0x5bb0bd=_0x8262c6[_0xc98d('0x29')]||0x1f4;logger[_0xc98d('0x27')](_0xc98d('0x2a'),'createTicket',_0x5bb0bd,JSON['stringify'](_0x8262c6));});}function getUser(_0x5c87e1,_0x139be0,_0x4af3a9){if(intUtil['validateEmail'](_0x139be0)){logger['info'](_0xc98d('0x2b'),_0x139be0);return request({'method':_0xc98d('0x2c'),'uri':util[_0xc98d('0x25')]('%s/webservice.php',_0x5c87e1[_0xc98d('0x1e')]),'qs':{'operation':_0xc98d('0x2d'),'username':_0x5c87e1['username'],'sessionName':_0x4af3a9[_0xc98d('0x20')],'query':util[_0xc98d('0x25')](_0xc98d('0x2e'),_0x139be0)},'json':!![]})[_0xc98d('0x2f')](function(_0xdd44a7){if(_0xdd44a7[_0xc98d('0x23')]&&_0xdd44a7[_0xc98d('0x30')]['length']){logger[_0xc98d('0x17')](_0xc98d('0x31'));return BPromise[_0xc98d('0x24')]({'id':_0xdd44a7[_0xc98d('0x30')][0x0]['id'],'email':_0xdd44a7[_0xc98d('0x30')][0x0][_0xc98d('0x32')],'name':_0xdd44a7['result'][0x0][_0xc98d('0x33')]+'\x20'+_0xdd44a7[_0xc98d('0x30')]['last_name']});}else{logger[_0xc98d('0x17')](_0xc98d('0x34'));return BPromise[_0xc98d('0x24')]({'id':_0x4af3a9['userId'],'email':_0x5c87e1[_0xc98d('0x35')],'name':_0xc98d('0x36')});}})[_0xc98d('0x28')](function(_0x3c46a0){var _0x4a96a0=_0x3c46a0[_0xc98d('0x29')]||0x1f4;logger[_0xc98d('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x4a96a0,JSON[_0xc98d('0x22')](_0x3c46a0));});}else{logger[_0xc98d('0x17')](_0xc98d('0x34'));return BPromise['resolve']({'id':_0x4af3a9['userId'],'email':_0x5c87e1[_0xc98d('0x35')],'name':_0xc98d('0x36')})[_0xc98d('0x28')](function(_0x2d76b3){var _0x2f220f=_0x2d76b3[_0xc98d('0x29')]||0x1f4;logger['error'](_0xc98d('0x2a'),'getUser',_0x2f220f,JSON[_0xc98d('0x22')](_0x2d76b3));});}}function getEndUser(_0x2fa4dd,_0x4248e7,_0x20a6b5,_0x4ed72d){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x20a6b5);return request({'method':'GET','uri':util[_0xc98d('0x25')](_0xc98d('0x37'),_0x2fa4dd['remoteUri']),'qs':{'operation':'query','username':_0x2fa4dd[_0xc98d('0x35')],'sessionName':_0x4ed72d['sessionName'],'query':util['format']('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;',_0x20a6b5,_0x20a6b5,_0x20a6b5,_0x20a6b5,_0x20a6b5)},'json':!![]})['then'](function(_0x5896ac){if(_0x5896ac[_0xc98d('0x23')]&&_0x5896ac[_0xc98d('0x30')][_0xc98d('0xc')]){logger[_0xc98d('0x17')](_0xc98d('0x38'));return BPromise['resolve']({'id':_0x5896ac['result'][0x0]['id'],'name':_0x5896ac[_0xc98d('0x30')][0x0][_0xc98d('0x39')]+'\x20'+_0x5896ac[_0xc98d('0x30')][0x0][_0xc98d('0x3a')],'phone':_0x20a6b5});}else{logger[_0xc98d('0x17')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util[_0xc98d('0x25')]('%s/webservice.php',_0x2fa4dd['remoteUri']),'form':{'operation':_0xc98d('0x1f'),'sessionName':_0x4ed72d[_0xc98d('0x20')],'elementType':_0xc98d('0x3b'),'element':JSON[_0xc98d('0x22')]({'lastname':_0x4248e7,'phone':_0x20a6b5,'assigned_user_id':'\x20'})},'json':!![]})[_0xc98d('0x2f')](function(_0x351713){logger[_0xc98d('0x17')]('Enduser\x20created.');return BPromise[_0xc98d('0x24')]({'id':_0x351713[_0xc98d('0x30')]['id'],'name':_0x351713[_0xc98d('0x30')][_0xc98d('0x3a')],'phone':_0x351713['result'][_0xc98d('0x3c')]});})[_0xc98d('0x28')](function(_0x4ec319){var _0x1fdea7=_0x4ec319[_0xc98d('0x29')]||0x1f4;logger[_0xc98d('0x27')](_0xc98d('0x2a'),_0xc98d('0x3d'),_0x1fdea7,JSON[_0xc98d('0x22')](_0x4ec319));});}});}function getConnection(_0x56b4af){var _0x1a5437=_0x56b4af[_0xc98d('0x35')];var _0x31efa4=_0x56b4af['accessKey'];return request({'method':_0xc98d('0x2c'),'uri':util[_0xc98d('0x25')](_0xc98d('0x37'),_0x56b4af[_0xc98d('0x1e')]),'qs':{'operation':_0xc98d('0x3e'),'username':_0x1a5437},'json':!![]})[_0xc98d('0x2f')](function(_0x5f40b5){if(_0x5f40b5['success']){return request({'method':_0xc98d('0x1d'),'uri':util['format'](_0xc98d('0x37'),_0x56b4af['remoteUri']),'form':{'operation':'login','username':_0x1a5437,'accessKey':md5(_0x5f40b5[_0xc98d('0x30')][_0xc98d('0x3f')]+_0x31efa4)},'json':!![]});}})[_0xc98d('0x2f')](function(_0x416d55){if(_0x416d55[_0xc98d('0x23')]){return BPromise[_0xc98d('0x24')](_0x416d55[_0xc98d('0x30')]);}else{throw new Error(util[_0xc98d('0x25')](_0xc98d('0x40'),_0x56b4af['id']));}})[_0xc98d('0x28')](function(_0x1d5b6f){var _0x2924aa=_0x1d5b6f[_0xc98d('0x29')]||0x1f4;logger['error'](_0xc98d('0x2a'),_0xc98d('0x41'),_0x2924aa,JSON[_0xc98d('0x22')](_0x1d5b6f));});}function request(_0x5d15d4){logger['info'](_0xc98d('0x42'),JSON['stringify'](_0x5d15d4));return rp(_0x5d15d4);}exports[_0xc98d('0x43')]=function(_0x15b956,_0x536e13,_0x297050,_0x579a7b,_0x4c7eea,_0x5df668){var _0x891b91,_0x115c17,_0x2f1ede,_0x1de65a;_0x5df668['remoteUri']=intUtil[_0xc98d('0x44')](_0x5df668[_0xc98d('0x1e')]);if(_0x4c7eea&&_0x4c7eea['monitor_format']){logger[_0xc98d('0x17')](_0xc98d('0x45'),_0xc98d('0x46'));_0x536e13[_0xc98d('0x47')]=util[_0xc98d('0x25')](_0xc98d('0x48'),_0x5df668['serverUrl'],_0x536e13[_0xc98d('0x49')],md5(_0x536e13[_0xc98d('0x49')]));}else{_0x536e13[_0xc98d('0x47')]='';}return getConnection(_0x5df668)[_0xc98d('0x2f')](function(_0x4b22e8){_0x1de65a=_0x4b22e8;return getUser(_0x5df668,_0x579a7b['email'],_0x1de65a);})['then'](function(_0x3528ac){_0x891b91=_0x3528ac;logger[_0xc98d('0x17')](_0xc98d('0x4a'),_0x891b91['id']);return getEndUser(_0x5df668,_0x536e13['calleridname'],_0x536e13[_0xc98d('0x4b')],_0x1de65a);})[_0xc98d('0x2f')](function(_0x364df7){_0x115c17=_0x364df7;logger[_0xc98d('0x17')](_0xc98d('0x4c'),_0x115c17['id']);return createTicket(_0x5df668,_0x891b91,_0x115c17,_0x297050,_0x536e13,_0x297050[_0xc98d('0x4d')],_0x1de65a);})[_0xc98d('0x2f')](function(_0x29ab91){_0x2f1ede=_0x29ab91;logger[_0xc98d('0x17')]('Ticket\x20created!');logger[_0xc98d('0x17')](_0xc98d('0x4e'),_0x2f1ede['id']);var _0x419f20=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x5df668['remoteUri'],_[_0xc98d('0x4f')](_0x2f1ede['id'],'x')[0x1]);logger[_0xc98d('0x17')](_0xc98d('0x45'),_0xc98d('0x50'));emit(util[_0xc98d('0x25')](_0xc98d('0x51'),_0x579a7b[_0xc98d('0x15')]),'trigger:browser:url',{'uri':_0x419f20});})['catch'](function(_0x2c3623){logger[_0xc98d('0x27')](_0xc98d('0x45'),JSON['stringify'](_0x2c3623));});};exports[_0xc98d('0x52')]=function(_0x18d4e4,_0x1a1fd6,_0x148ace,_0x3f9aef,_0x208826,_0x2e41cf,_0x282573){var _0x1892e9,_0x52d62c,_0x6eddbd,_0x13385c;_0x2e41cf[_0xc98d('0x1e')]=intUtil['stripTrailingSlash'](_0x2e41cf[_0xc98d('0x1e')]);_0x2e41cf[_0xc98d('0x53')]=intUtil[_0xc98d('0x44')](_0x2e41cf[_0xc98d('0x53')]);if(_0x282573&&_0x282573[_0xc98d('0x54')]&&_0x282573[_0xc98d('0x54')]!=='none'){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1a1fd6[_0xc98d('0x47')]=util['format'](_0xc98d('0x48'),_0x2e41cf['serverUrl'],_0x1a1fd6[_0xc98d('0x49')],md5(_0x1a1fd6[_0xc98d('0x49')]));}return getConnection(_0x2e41cf)[_0xc98d('0x2f')](function(_0xe2ea90){_0x13385c=_0xe2ea90;return getUser(_0x2e41cf,_0x3f9aef[_0xc98d('0x55')],_0x13385c);})[_0xc98d('0x2f')](function(_0x4a3e5f){_0x1892e9=_0x4a3e5f;logger[_0xc98d('0x17')]('The\x20User\x20ID\x20is:',_0x1892e9['id']);return getEndUser(_0x2e41cf,_0x1a1fd6['destcalleridname'],_0x1a1fd6['destcalleridnum'],_0x13385c);})[_0xc98d('0x2f')](function(_0x30823f){_0x52d62c=_0x30823f;logger[_0xc98d('0x17')](_0xc98d('0x4c'),_0x52d62c['id']);return createTicket(_0x2e41cf,_0x1892e9,_0x52d62c,_0x148ace,_0x1a1fd6,_0x148ace[_0xc98d('0x4d')],_0x13385c);})['then'](function(_0x363ff0){_0x6eddbd=_0x363ff0;logger['info']('Ticket\x20created!');logger['info'](_0xc98d('0x4e'),_0x6eddbd['id']);var _0x48a6fa=util[_0xc98d('0x25')](_0xc98d('0x56'),_0x2e41cf[_0xc98d('0x1e')],_['split'](_0x6eddbd['id'],'x')[0x1]);logger[_0xc98d('0x17')](_0xc98d('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc98d('0x25')](_0xc98d('0x51'),_0x3f9aef['name']),_0xc98d('0x58'),{'uri':_0x48a6fa});})['catch'](function(_0x2d19ab){logger[_0xc98d('0x27')]('[OUTBOUND]',JSON[_0xc98d('0x22')](_0x2d19ab));});};exports['unmanaged']=function(_0x107246,_0x3bb6b5,_0x32b8aa,_0x20edbf,_0x472f94,_0x2220d1){var _0x41564d,_0x345f52,_0x3cebe6,_0x18eb64;_0x2220d1[_0xc98d('0x1e')]=intUtil[_0xc98d('0x44')](_0x2220d1['remoteUri']);_0x2220d1[_0xc98d('0x53')]=intUtil[_0xc98d('0x44')](_0x2220d1[_0xc98d('0x53')]);if(_0x472f94&&_0x472f94['monitor_format']){logger[_0xc98d('0x17')]('['+_0x3bb6b5[_0xc98d('0x59')][_0xc98d('0x5a')]()+']',_0xc98d('0x46'));_0x3bb6b5[_0xc98d('0x47')]=util[_0xc98d('0x25')](_0xc98d('0x48'),_0x2220d1[_0xc98d('0x53')],_0x3bb6b5[_0xc98d('0x49')],md5(_0x3bb6b5[_0xc98d('0x49')]));}else{_0x3bb6b5[_0xc98d('0x47')]='';}return getConnection(_0x2220d1)[_0xc98d('0x2f')](function(_0xa1a21c){_0x18eb64=_0xa1a21c;return getUser(_0x2220d1,'',_0x18eb64);})[_0xc98d('0x2f')](function(_0x518a81){_0x41564d=_0x518a81;logger[_0xc98d('0x17')](_0xc98d('0x4a'),_0x41564d['id']);return getEndUser(_0x2220d1,_0x3bb6b5[_0xc98d('0x5b')],_0x3bb6b5[_0xc98d('0x4b')],_0x18eb64);})['then'](function(_0x39e2ba){_0x345f52=_0x39e2ba;logger[_0xc98d('0x17')](_0xc98d('0x4c'),_0x345f52['id']);return createTicket(_0x2220d1,_0x41564d,_0x345f52,_0x32b8aa,_0x3bb6b5,_0x32b8aa[_0xc98d('0x4d')],_0x18eb64);})[_0xc98d('0x2f')](function(_0x5b3ef7){_0x3cebe6=_0x5b3ef7;logger['info'](_0xc98d('0x5c'));logger[_0xc98d('0x17')]('The\x20Ticket\x20ID\x20is:',_0x3cebe6['id']);})[_0xc98d('0x28')](function(_0x99832){logger[_0xc98d('0x27')]('['+_0x3bb6b5[_0xc98d('0x59')]['toUpperCase']()+']',JSON['stringify'](_0x99832));});}; \ No newline at end of file +var _0x8f09=['bluebird','md5','util','ioredis','./util','../../../../config/environment','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','Open','getString','Subjects','Descriptions','POST','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','createTicket','validateEmail','info','Getting\x20agent\x20with\x20email','format','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','email1','first_name','last_name','userId','admin','statusCode','getUser','[vTiger],\x20%s,\x20%s,\x20%s','Searching\x20end\x20user\x20with\x20phone','GET','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','unmanaged','toUpperCase','lastevent','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8f09,0x19f));var _0x98f0=function(_0x2f38ca,_0x3bae29){_0x2f38ca=_0x2f38ca-0x0;var _0x2f914d=_0x8f09[_0x2f38ca];return _0x2f914d;};'use strict';var _=require('lodash');var rp=require(_0x98f0('0x0'));var BPromise=require(_0x98f0('0x1'));var md5=require(_0x98f0('0x2'));var util=require(_0x98f0('0x3'));var Redis=require(_0x98f0('0x4'));var intUtil=require(_0x98f0('0x5'));var config=require(_0x98f0('0x6'));var logger=require('../../../../config/logger')(_0x98f0('0x7'));config[_0x98f0('0x8')]=_[_0x98f0('0x9')](config[_0x98f0('0x8')],{'host':_0x98f0('0xa'),'port':0x18eb});var io=require(_0x98f0('0xb'))(new Redis(config[_0x98f0('0x8')]));function emit(_0x2b86b5,_0x2bce67,_0x38131b){io['to'](_0x2b86b5)[_0x98f0('0xc')](_0x2bce67,_0x38131b);}function getCustomFields(_0x3c42ba,_0x592687){var _0x289df9={};if(_0x3c42ba[_0x98f0('0xd')]>0x0){_[_0x98f0('0xe')](_0x3c42ba,function(_0x1d35d4){if(_0x1d35d4[_0x98f0('0xf')]===_0x98f0('0x10')&&_0x1d35d4['idField']){_0x289df9[_0x1d35d4[_0x98f0('0x11')]]=_0x1d35d4[_0x98f0('0x12')]['toString']();}else if(_0x1d35d4[_0x98f0('0xf')]===_0x98f0('0x13')&&_0x1d35d4[_0x98f0('0x14')]&&_0x1d35d4[_0x98f0('0x11')]&&_0x592687[_0x1d35d4['variableName']]){_0x289df9[_0x1d35d4[_0x98f0('0x11')]]=_0x592687[_0x1d35d4[_0x98f0('0x14')]][_0x98f0('0x15')]();}else if(_0x1d35d4[_0x98f0('0xf')]===_0x98f0('0x16')&&_0x1d35d4[_0x98f0('0x17')]&&_0x1d35d4[_0x98f0('0x17')][_0x98f0('0x18')]&&_0x1d35d4['idField']&&_0x592687[_0x1d35d4[_0x98f0('0x17')][_0x98f0('0x18')]['toLowerCase']()]){_0x289df9[_0x1d35d4[_0x98f0('0x11')]]=_0x592687[_0x1d35d4[_0x98f0('0x17')][_0x98f0('0x18')][_0x98f0('0x19')]()][_0x98f0('0x15')]();}});}return _0x289df9;}function createTicket(_0x1548bb,_0x744e8c,_0x4cd9b9,_0x1c2de2,_0x331249,_0x321c78,_0x5ba836){logger['info'](_0x98f0('0x1a'));var _0x3a7557=_['merge']({'parent_id':'','assigned_user_id':_0x744e8c['id'],'ticketpriorities':'Normal','ticketstatus':_0x98f0('0x1b'),'ticket_title':intUtil[_0x98f0('0x1c')](_0x1c2de2[_0x98f0('0x1d')],_0x331249,'\x20'),'description':intUtil[_0x98f0('0x1c')](_0x1c2de2[_0x98f0('0x1e')],_0x331249,'\x0a'),'contact_id':_0x4cd9b9['id']},getCustomFields(_0x321c78,_0x331249));var _0x3d0d08={'method':_0x98f0('0x1f'),'uri':util['format'](_0x98f0('0x20'),_0x1548bb[_0x98f0('0x21')]),'form':{'operation':_0x98f0('0x22'),'username':_0x1548bb[_0x98f0('0x23')],'sessionName':_0x5ba836[_0x98f0('0x24')],'elementType':_0x98f0('0x25'),'element':JSON[_0x98f0('0x26')](_0x3a7557)},'json':!![]};return request(_0x3d0d08)[_0x98f0('0x27')](function(_0x28896c){if(_0x28896c[_0x98f0('0x28')]){return BPromise[_0x98f0('0x29')]({'id':_0x28896c[_0x98f0('0x2a')]['id']});}else{throw new Error(util['format'](_0x98f0('0x2b'),JSON[_0x98f0('0x26')](_0x28896c[_0x98f0('0x2c')])));}})[_0x98f0('0x2d')](function(_0x529987){var _0x4718fd=_0x529987['statusCode']||0x1f4;logger[_0x98f0('0x2c')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x98f0('0x2e'),_0x4718fd,JSON[_0x98f0('0x26')](_0x529987));});}function getUser(_0x1398ec,_0x13eed7,_0x43358d){if(intUtil[_0x98f0('0x2f')](_0x13eed7)){logger[_0x98f0('0x30')](_0x98f0('0x31'),_0x13eed7);return request({'method':'GET','uri':util[_0x98f0('0x32')](_0x98f0('0x20'),_0x1398ec[_0x98f0('0x21')]),'qs':{'operation':'query','username':_0x1398ec['username'],'sessionName':_0x43358d['sessionName'],'query':util[_0x98f0('0x32')](_0x98f0('0x33'),_0x13eed7)},'json':!![]})[_0x98f0('0x27')](function(_0x231c14){if(_0x231c14[_0x98f0('0x28')]&&_0x231c14[_0x98f0('0x2a')]['length']){logger['info']('Agent\x20found!');return BPromise[_0x98f0('0x29')]({'id':_0x231c14[_0x98f0('0x2a')][0x0]['id'],'email':_0x231c14[_0x98f0('0x2a')][0x0][_0x98f0('0x34')],'name':_0x231c14[_0x98f0('0x2a')][0x0][_0x98f0('0x35')]+'\x20'+_0x231c14['result'][_0x98f0('0x36')]});}else{logger[_0x98f0('0x30')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x98f0('0x29')]({'id':_0x43358d[_0x98f0('0x37')],'email':_0x1398ec[_0x98f0('0x23')],'name':_0x98f0('0x38')});}})['catch'](function(_0x72c628){var _0x1befad=_0x72c628[_0x98f0('0x39')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x98f0('0x3a'),_0x1befad,JSON[_0x98f0('0x26')](_0x72c628));});}else{logger[_0x98f0('0x30')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x98f0('0x29')]({'id':_0x43358d[_0x98f0('0x37')],'email':_0x1398ec[_0x98f0('0x23')],'name':_0x98f0('0x38')})[_0x98f0('0x2d')](function(_0xdc2533){var _0x31d208=_0xdc2533[_0x98f0('0x39')]||0x1f4;logger[_0x98f0('0x2c')](_0x98f0('0x3b'),_0x98f0('0x3a'),_0x31d208,JSON[_0x98f0('0x26')](_0xdc2533));});}}function getEndUser(_0xe0a9f4,_0x5ea256,_0x4158d9,_0x3eac17){logger[_0x98f0('0x30')](_0x98f0('0x3c'),_0x4158d9);return request({'method':_0x98f0('0x3d'),'uri':util[_0x98f0('0x32')](_0x98f0('0x20'),_0xe0a9f4[_0x98f0('0x21')]),'qs':{'operation':'query','username':_0xe0a9f4[_0x98f0('0x23')],'sessionName':_0x3eac17[_0x98f0('0x24')],'query':util[_0x98f0('0x32')](_0x98f0('0x3e'),_0x4158d9,_0x4158d9,_0x4158d9,_0x4158d9,_0x4158d9)},'json':!![]})['then'](function(_0x2edfcd){if(_0x2edfcd[_0x98f0('0x28')]&&_0x2edfcd['result'][_0x98f0('0xd')]){logger[_0x98f0('0x30')](_0x98f0('0x3f'));return BPromise['resolve']({'id':_0x2edfcd['result'][0x0]['id'],'name':_0x2edfcd['result'][0x0][_0x98f0('0x40')]+'\x20'+_0x2edfcd[_0x98f0('0x2a')][0x0][_0x98f0('0x41')],'phone':_0x4158d9});}else{logger[_0x98f0('0x30')](_0x98f0('0x42'));return request({'method':_0x98f0('0x1f'),'uri':util[_0x98f0('0x32')]('%s/webservice.php',_0xe0a9f4[_0x98f0('0x21')]),'form':{'operation':'create','sessionName':_0x3eac17[_0x98f0('0x24')],'elementType':'Contacts','element':JSON[_0x98f0('0x26')]({'lastname':_0x5ea256,'phone':_0x4158d9,'assigned_user_id':'\x20'})},'json':!![]})[_0x98f0('0x27')](function(_0x2f8c6b){logger[_0x98f0('0x30')](_0x98f0('0x43'));return BPromise[_0x98f0('0x29')]({'id':_0x2f8c6b[_0x98f0('0x2a')]['id'],'name':_0x2f8c6b['result'][_0x98f0('0x41')],'phone':_0x2f8c6b[_0x98f0('0x2a')]['phone']});})[_0x98f0('0x2d')](function(_0x3aea8f){var _0x497a60=_0x3aea8f[_0x98f0('0x39')]||0x1f4;logger[_0x98f0('0x2c')](_0x98f0('0x3b'),_0x98f0('0x44'),_0x497a60,JSON[_0x98f0('0x26')](_0x3aea8f));});}});}function getConnection(_0x1cf5d9){var _0x479bff=_0x1cf5d9[_0x98f0('0x23')];var _0x15e988=_0x1cf5d9[_0x98f0('0x45')];return request({'method':_0x98f0('0x3d'),'uri':util[_0x98f0('0x32')]('%s/webservice.php',_0x1cf5d9['remoteUri']),'qs':{'operation':_0x98f0('0x46'),'username':_0x479bff},'json':!![]})[_0x98f0('0x27')](function(_0x18c6c9){if(_0x18c6c9[_0x98f0('0x28')]){return request({'method':'POST','uri':util[_0x98f0('0x32')](_0x98f0('0x20'),_0x1cf5d9[_0x98f0('0x21')]),'form':{'operation':_0x98f0('0x47'),'username':_0x479bff,'accessKey':md5(_0x18c6c9['result'][_0x98f0('0x48')]+_0x15e988)},'json':!![]});}})[_0x98f0('0x27')](function(_0x2c54b9){if(_0x2c54b9[_0x98f0('0x28')]){return BPromise[_0x98f0('0x29')](_0x2c54b9[_0x98f0('0x2a')]);}else{throw new Error(util['format'](_0x98f0('0x49'),_0x1cf5d9['id']));}})[_0x98f0('0x2d')](function(_0x4c1f67){var _0x3f00e3=_0x4c1f67[_0x98f0('0x39')]||0x1f4;logger['error'](_0x98f0('0x3b'),_0x98f0('0x4a'),_0x3f00e3,JSON[_0x98f0('0x26')](_0x4c1f67));});}function request(_0x2cdbc0){logger[_0x98f0('0x30')](_0x98f0('0x4b'),JSON['stringify'](_0x2cdbc0));return rp(_0x2cdbc0);}exports[_0x98f0('0x4c')]=function(_0x93c47f,_0x29414f,_0x3ed620,_0x4a293e,_0x4bcbff,_0x5f171e){var _0x21a099,_0x169778,_0x2c345d,_0x2ea2a9;_0x5f171e[_0x98f0('0x21')]=intUtil[_0x98f0('0x4d')](_0x5f171e['remoteUri']);if(_0x4bcbff&&_0x4bcbff[_0x98f0('0x4e')]){logger[_0x98f0('0x30')](_0x98f0('0x4f'),'Recording\x20is\x20enabled!');_0x29414f[_0x98f0('0x50')]=util[_0x98f0('0x32')](_0x98f0('0x51'),_0x5f171e[_0x98f0('0x52')],_0x29414f[_0x98f0('0x53')],md5(_0x29414f[_0x98f0('0x53')]));}else{_0x29414f[_0x98f0('0x50')]='';}return getConnection(_0x5f171e)[_0x98f0('0x27')](function(_0x87cf75){_0x2ea2a9=_0x87cf75;return getUser(_0x5f171e,_0x4a293e[_0x98f0('0x54')],_0x2ea2a9);})[_0x98f0('0x27')](function(_0x243b9c){_0x21a099=_0x243b9c;logger[_0x98f0('0x30')]('The\x20User\x20ID\x20is:',_0x21a099['id']);return getEndUser(_0x5f171e,_0x29414f['calleridname'],_0x29414f[_0x98f0('0x55')],_0x2ea2a9);})['then'](function(_0x857ecb){_0x169778=_0x857ecb;logger[_0x98f0('0x30')](_0x98f0('0x56'),_0x169778['id']);return createTicket(_0x5f171e,_0x21a099,_0x169778,_0x3ed620,_0x29414f,_0x3ed620[_0x98f0('0x57')],_0x2ea2a9);})[_0x98f0('0x27')](function(_0x1cee05){_0x2c345d=_0x1cee05;logger[_0x98f0('0x30')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x2c345d['id']);var _0x19a14e=util[_0x98f0('0x32')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x5f171e[_0x98f0('0x21')],_[_0x98f0('0x58')](_0x2c345d['id'],'x')[0x1]);logger[_0x98f0('0x30')](_0x98f0('0x4f'),_0x98f0('0x59'));emit(util[_0x98f0('0x32')](_0x98f0('0x5a'),_0x4a293e[_0x98f0('0x18')]),_0x98f0('0x5b'),{'uri':_0x19a14e});})[_0x98f0('0x2d')](function(_0x5c73c4){logger[_0x98f0('0x2c')](_0x98f0('0x4f'),JSON[_0x98f0('0x26')](_0x5c73c4));});};exports['outbound']=function(_0x56dafa,_0x208a36,_0x2449f4,_0x5e4f4e,_0x1c1ff5,_0x382a44,_0x3d87f1){var _0x170c4f,_0x391bd2,_0x118b75,_0x5c71ea;_0x382a44['remoteUri']=intUtil['stripTrailingSlash'](_0x382a44['remoteUri']);_0x382a44[_0x98f0('0x52')]=intUtil[_0x98f0('0x4d')](_0x382a44['serverUrl']);if(_0x3d87f1&&_0x3d87f1[_0x98f0('0x5c')]&&_0x3d87f1['recordingFormat']!==_0x98f0('0x5d')){logger[_0x98f0('0x30')](_0x98f0('0x5e'),_0x98f0('0x5f'));_0x208a36[_0x98f0('0x50')]=util['format'](_0x98f0('0x51'),_0x382a44[_0x98f0('0x52')],_0x208a36[_0x98f0('0x53')],md5(_0x208a36[_0x98f0('0x53')]));}return getConnection(_0x382a44)['then'](function(_0x1ea348){_0x5c71ea=_0x1ea348;return getUser(_0x382a44,_0x5e4f4e[_0x98f0('0x54')],_0x5c71ea);})['then'](function(_0x37a2ba){_0x170c4f=_0x37a2ba;logger[_0x98f0('0x30')](_0x98f0('0x60'),_0x170c4f['id']);return getEndUser(_0x382a44,_0x208a36['destcalleridname'],_0x208a36[_0x98f0('0x61')],_0x5c71ea);})[_0x98f0('0x27')](function(_0x3e0bf0){_0x391bd2=_0x3e0bf0;logger[_0x98f0('0x30')](_0x98f0('0x56'),_0x391bd2['id']);return createTicket(_0x382a44,_0x170c4f,_0x391bd2,_0x2449f4,_0x208a36,_0x2449f4['Fields'],_0x5c71ea);})['then'](function(_0xbd4c24){_0x118b75=_0xbd4c24;logger[_0x98f0('0x30')](_0x98f0('0x62'));logger[_0x98f0('0x30')](_0x98f0('0x63'),_0x118b75['id']);var _0x3005b4=util[_0x98f0('0x32')](_0x98f0('0x64'),_0x382a44[_0x98f0('0x21')],_[_0x98f0('0x58')](_0x118b75['id'],'x')[0x1]);logger[_0x98f0('0x30')](_0x98f0('0x5e'),_0x98f0('0x59'));emit(util[_0x98f0('0x32')](_0x98f0('0x5a'),_0x5e4f4e['name']),_0x98f0('0x5b'),{'uri':_0x3005b4});})[_0x98f0('0x2d')](function(_0x5b2563){logger[_0x98f0('0x2c')](_0x98f0('0x5e'),JSON[_0x98f0('0x26')](_0x5b2563));});};exports[_0x98f0('0x65')]=function(_0x3d557c,_0x18931b,_0x18fbd8,_0x1ce140,_0x3a2418,_0xa9eadb){var _0x50b878,_0x30f5d8,_0x564e91,_0xffa5ed;_0xa9eadb[_0x98f0('0x21')]=intUtil[_0x98f0('0x4d')](_0xa9eadb[_0x98f0('0x21')]);_0xa9eadb[_0x98f0('0x52')]=intUtil[_0x98f0('0x4d')](_0xa9eadb[_0x98f0('0x52')]);if(_0x3a2418&&_0x3a2418[_0x98f0('0x4e')]){logger[_0x98f0('0x30')]('['+_0x18931b['lastevent'][_0x98f0('0x66')]()+']',_0x98f0('0x5f'));_0x18931b[_0x98f0('0x50')]=util[_0x98f0('0x32')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa9eadb[_0x98f0('0x52')],_0x18931b[_0x98f0('0x53')],md5(_0x18931b[_0x98f0('0x53')]));}else{_0x18931b['recordingURL']='';}return getConnection(_0xa9eadb)[_0x98f0('0x27')](function(_0x39820e){_0xffa5ed=_0x39820e;return getUser(_0xa9eadb,'',_0xffa5ed);})[_0x98f0('0x27')](function(_0x94dbe0){_0x50b878=_0x94dbe0;logger[_0x98f0('0x30')]('The\x20User\x20ID\x20is:',_0x50b878['id']);return getEndUser(_0xa9eadb,_0x18931b['calleridname'],_0x18931b[_0x98f0('0x55')],_0xffa5ed);})[_0x98f0('0x27')](function(_0x219eef){_0x30f5d8=_0x219eef;logger['info'](_0x98f0('0x56'),_0x30f5d8['id']);return createTicket(_0xa9eadb,_0x50b878,_0x30f5d8,_0x18fbd8,_0x18931b,_0x18fbd8[_0x98f0('0x57')],_0xffa5ed);})[_0x98f0('0x27')](function(_0x5359f6){_0x564e91=_0x5359f6;logger[_0x98f0('0x30')]('Ticket\x20created!');logger[_0x98f0('0x30')](_0x98f0('0x63'),_0x564e91['id']);})[_0x98f0('0x2d')](function(_0x55d676){logger[_0x98f0('0x2c')]('['+_0x18931b[_0x98f0('0x67')][_0x98f0('0x66')]()+']',JSON['stringify'](_0x55d676));});}; \ 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 b7493e7..9648c44 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 _0x02ad=['zendesk','redis','defaults','localhost','emit','application/json','info','format','%s/tickets.json','POST','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','%s/token:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','nameField','toLowerCase','content','string','idField','customField','push','variableName','customVariable','Variable','custom_fields','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','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','replace','/api/v2','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','monitor_format','lastevent','calleridnum','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','./util','../../../../config/logger'];(function(_0x1b2477,_0x368cc0){var _0x38b837=function(_0x353499){while(--_0x353499){_0x1b2477['push'](_0x1b2477['shift']());}};_0x38b837(++_0x368cc0);}(_0x02ad,0x68));var _0xd02a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x02ad[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var rp=require(_0xd02a('0x0'));var md5=require(_0xd02a('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xd02a('0x2'));var config=require('../../../../config/environment');var logger=require(_0xd02a('0x3'))(_0xd02a('0x4'));config[_0xd02a('0x5')]=_[_0xd02a('0x6')](config[_0xd02a('0x5')],{'host':_0xd02a('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd02a('0x5')]));function emit(_0x113939,_0x5327c1,_0x1b4cd3){io['to'](_0x113939)[_0xd02a('0x8')](_0x5327c1,_0x1b4cd3);}var headers={'Content-Type':_0xd02a('0x9'),'Accept':'application/json'};function getTicket(_0x14f52d,_0x39b452,_0x1a55a7,_0xb290e8,_0x284ce2){logger[_0xd02a('0xa')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xd02a('0xb')](_0xd02a('0xc'),_0x14f52d['remoteUri']),'method':_0xd02a('0xd'),'body':{'ticket':_['merge']({'requester_id':_0x1a55a7['id'],'submitter_id':_0x39b452?_0x39b452['id']:undefined,'assignee_id':_0x39b452?_0x39b452['id']:undefined,'tags':getTags(_0xb290e8['Tags'],_0xd02a('0xe')),'subject':intUtil[_0xd02a('0xf')](_0xb290e8[_0xd02a('0x10')],_0x284ce2,'\x20'),'description':intUtil['getString'](_0xb290e8[_0xd02a('0x11')],_0x284ce2,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0xb290e8['Descriptions'],_0x284ce2,'\x0a')}},getCustomFields(_0xb290e8[_0xd02a('0x12')],_0x284ce2))}})[_0xd02a('0x13')](function(_0x1b85cf){logger[_0xd02a('0xa')](_0xd02a('0x14'));return _0x1b85cf['ticket'];});}function getUser(_0x896b3,_0x4832b0){if(intUtil[_0xd02a('0x15')](_0x4832b0)){logger[_0xd02a('0xa')](_0xd02a('0x16'),_0x4832b0);return request({'uri':util[_0xd02a('0xb')](_0xd02a('0x17'),_0x896b3[_0xd02a('0x18')]),'qs':{'query':util[_0xd02a('0xb')](_0xd02a('0x19'),_0x4832b0)}})[_0xd02a('0x13')](function(_0x35636a){if(_0x35636a[_0xd02a('0x1a')]){logger[_0xd02a('0xa')](_0xd02a('0x1b'));return _[_0xd02a('0x1c')](_0x35636a[_0xd02a('0x1d')],{'email':_0x4832b0,'role':_0xd02a('0x1e')});}else{logger['info'](_0xd02a('0x1f'));return request({'uri':util[_0xd02a('0xb')]('%s/users/me.json',_0x896b3[_0xd02a('0x18')])})[_0xd02a('0x13')](function(_0x3fac0a){logger['info'](_0xd02a('0x20'));return _0x3fac0a[_0xd02a('0x21')];});}});}else{logger[_0xd02a('0xa')](_0xd02a('0x1f'));return request({'uri':util[_0xd02a('0xb')](_0xd02a('0x22'),_0x896b3[_0xd02a('0x18')])})[_0xd02a('0x13')](function(_0x29ff5f){logger[_0xd02a('0xa')](_0xd02a('0x20'));return _0x29ff5f[_0xd02a('0x21')];});}}function getEndUser(_0x334b04,_0x2638b4,_0x3e6ec2){logger[_0xd02a('0xa')](_0xd02a('0x23'),_0x3e6ec2);return request({'uri':util[_0xd02a('0xb')](_0xd02a('0x17'),_0x334b04[_0xd02a('0x18')]),'qs':{'query':util[_0xd02a('0xb')](_0xd02a('0x24'),_0x3e6ec2)}})[_0xd02a('0x13')](function(_0x4ac4ed){var _0x377a3d;if(_0x4ac4ed['results']['length']){_0x4ac4ed[_0xd02a('0x1d')]=_[_0xd02a('0x25')](_0x4ac4ed[_0xd02a('0x1d')],{'suspended':![],'role':_0xd02a('0x26')});if(_0x4ac4ed['results'][_0xd02a('0x27')]){_0x377a3d=_[_0xd02a('0x28')](_0x4ac4ed[_0xd02a('0x1d')]);}}if(_0x377a3d){logger['info'](_0xd02a('0x29'));return _0x377a3d;}else{logger[_0xd02a('0xa')](_0xd02a('0x2a'));return request({'uri':util['format'](_0xd02a('0x2b'),_0x334b04[_0xd02a('0x18')]),'method':'POST','body':{'user':{'role':_0xd02a('0x26'),'name':util[_0xd02a('0xb')](_0xd02a('0x2c'),_0x2638b4||_0x3e6ec2),'phone':_0x3e6ec2}}})[_0xd02a('0x13')](function(_0x23d024){logger[_0xd02a('0xa')]('Enduser\x20created.');return _0x23d024[_0xd02a('0x21')];});}});}function getAuth(_0x38ac84){var _0x2fa5a7;if(_0x38ac84[_0xd02a('0x2d')]===_0xd02a('0x2e')){_0x2fa5a7=util[_0xd02a('0xb')](_0xd02a('0x2f'),_0x38ac84[_0xd02a('0x30')],_0x38ac84['password']);}else if(_0x38ac84[_0xd02a('0x2d')]==='token'){_0x2fa5a7=util[_0xd02a('0xb')](_0xd02a('0x31'),_0x38ac84[_0xd02a('0x30')],_0x38ac84[_0xd02a('0x32')]);}return util[_0xd02a('0xb')](_0xd02a('0x33'),new Buffer(_0x2fa5a7)[_0xd02a('0x34')](_0xd02a('0x35')));}function request(_0xede411){logger[_0xd02a('0x36')](_0xd02a('0x37'),JSON[_0xd02a('0x38')](_0xede411));return rp(_[_0xd02a('0x6')](_0xede411,{'method':_0xd02a('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x88c4e2,_0x5803c5){var _0x55d2a9=[];if(_0x88c4e2&&_0x88c4e2[_0xd02a('0x27')]>0x0){_0x55d2a9=_[_0xd02a('0x3a')](_0x88c4e2,_0x5803c5);}return _0x55d2a9;}function getCustomFields(_0x3db1b1,_0x45f0e5){var _0x1c8379=[];var _0x285202={'custom_fields':[]};if(_0x3db1b1[_0xd02a('0x27')]>0x0){_[_0xd02a('0x3b')](_0x3db1b1,function(_0xc9d287){if(_0xc9d287[_0xd02a('0x3c')]==='string'&&_0xc9d287[_0xd02a('0x3d')]&&!_0xc9d287['customField']){_0x285202[_0xc9d287['nameField'][_0xd02a('0x3e')]()]=_0xc9d287[_0xd02a('0x3f')]['toString']();}else if(_0xc9d287[_0xd02a('0x3c')]===_0xd02a('0x40')&&_0xc9d287[_0xd02a('0x41')]&&_0xc9d287[_0xd02a('0x42')]){_0x285202['custom_fields'][_0xd02a('0x43')]({'id':_0xc9d287[_0xd02a('0x41')],'value':_0xc9d287[_0xd02a('0x3f')][_0xd02a('0x34')]()});}else if(_0xc9d287[_0xd02a('0x3c')]==='variable'&&_0xc9d287['variableName']&&_0xc9d287[_0xd02a('0x41')]&&_0xc9d287[_0xd02a('0x42')]){_0x45f0e5[_0xc9d287['variableName']]&&_0x285202['custom_fields'][_0xd02a('0x43')]({'id':_0xc9d287['idField'],'value':_0x45f0e5[_0xc9d287[_0xd02a('0x44')]][_0xd02a('0x34')]()});}else if(_0xc9d287[_0xd02a('0x3c')]===_0xd02a('0x45')&&_0xc9d287[_0xd02a('0x46')]&&_0xc9d287[_0xd02a('0x46')][_0xd02a('0xe')]&&_0xc9d287[_0xd02a('0x41')]&&_0xc9d287[_0xd02a('0x42')]){_0x45f0e5[_0xc9d287[_0xd02a('0x46')][_0xd02a('0xe')][_0xd02a('0x3e')]()]&&_0x285202[_0xd02a('0x47')][_0xd02a('0x43')]({'id':_0xc9d287[_0xd02a('0x41')],'value':_0x45f0e5[_0xc9d287[_0xd02a('0x46')][_0xd02a('0xe')][_0xd02a('0x3e')]()][_0xd02a('0x34')]()});}});}return _0x285202;}exports['queue']=function(_0x366d62,_0x57c30c,_0x1c950b,_0x372087,_0x3aa9e0,_0x56fde5){var _0xa4e309,_0x1e74c2;_0x56fde5[_0xd02a('0x18')]=intUtil[_0xd02a('0x48')](_0x56fde5[_0xd02a('0x18')]);_0x56fde5[_0xd02a('0x49')]=intUtil['stripTrailingSlash'](_0x56fde5[_0xd02a('0x49')]);if(_0x3aa9e0&&_0x3aa9e0['monitor_format']){logger[_0xd02a('0xa')]('[QUEUE]',_0xd02a('0x4a'));_0x57c30c[_0xd02a('0x4b')]=util['format'](_0xd02a('0x4c'),_0x56fde5[_0xd02a('0x49')],_0x57c30c[_0xd02a('0x4d')],md5(_0x57c30c[_0xd02a('0x4d')]));}else{_0x57c30c['recordingURL']='';}headers[_0xd02a('0x4e')]=getAuth(_0x56fde5);return getUser(_0x56fde5,_0x372087[_0xd02a('0x4f')])['then'](function(_0x1ea9ef){_0xa4e309=_0x1ea9ef;logger[_0xd02a('0xa')]('The\x20User\x20ID\x20is:',_0xa4e309['id']);return getEndUser(_0x56fde5,_0x57c30c[_0xd02a('0x50')],_0x57c30c['calleridnum']);})[_0xd02a('0x13')](function(_0x56a830){_0x1e74c2=_0x56a830;logger[_0xd02a('0xa')](_0xd02a('0x51'),_0x1e74c2['id']);return getTicket(_0x56fde5,_0xa4e309,_0x1e74c2,_0x1c950b,_0x57c30c);})[_0xd02a('0x13')](function(_0x4a8f41){if(_0x4a8f41){logger[_0xd02a('0xa')](_0xd02a('0x52'),_0x4a8f41['id']);switch(_0x56fde5[_0xd02a('0x3c')]){case _0xd02a('0x53'):logger['info'](_0xd02a('0x54'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xd02a('0xb')](_0xd02a('0x55'),_0x56fde5['remoteUri'],_0xa4e309['id'],_0x4a8f41['id']),'method':_0xd02a('0xd')});case _0xd02a('0x56'):logger[_0xd02a('0xa')](_0xd02a('0x54'),_0xd02a('0x57'));emit(util['format'](_0xd02a('0x58'),_0x372087[_0xd02a('0xe')]),_0xd02a('0x59'),{'uri':util[_0xd02a('0xb')](_0xd02a('0x5a'),_0x56fde5[_0xd02a('0x18')][_0xd02a('0x5b')](_0xd02a('0x5c'),''),_0x4a8f41['id'])});break;default:logger[_0xd02a('0x5d')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x35f368){logger['error'](_0xd02a('0x5e'),util[_0xd02a('0x5f')](_0x35f368,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x32256b,_0x36da29,_0x250e53,_0x4bb560,_0x482360,_0x35d98c,_0x3e5c83){var _0x30e40f,_0xcc8d79;_0x35d98c[_0xd02a('0x18')]=intUtil[_0xd02a('0x48')](_0x35d98c[_0xd02a('0x18')]);_0x35d98c[_0xd02a('0x49')]=intUtil[_0xd02a('0x48')](_0x35d98c['serverUrl']);if(_0x3e5c83&&_0x3e5c83['recordingFormat']&&_0x3e5c83['recordingFormat']!=='none'){logger['info'](_0xd02a('0x60'),_0xd02a('0x4a'));_0x36da29[_0xd02a('0x4b')]=util['format'](_0xd02a('0x4c'),_0x35d98c[_0xd02a('0x49')],_0x36da29[_0xd02a('0x4d')],md5(_0x36da29[_0xd02a('0x4d')]));}headers[_0xd02a('0x4e')]=getAuth(_0x35d98c);return getUser(_0x35d98c,_0x4bb560[_0xd02a('0x4f')])[_0xd02a('0x13')](function(_0x4ad2e0){_0x30e40f=_0x4ad2e0;logger[_0xd02a('0xa')](_0xd02a('0x61'),_0x30e40f['id']);return getEndUser(_0x35d98c,_0x36da29['destcalleridname'],_0x36da29[_0xd02a('0x62')]);})[_0xd02a('0x13')](function(_0x2310ea){_0xcc8d79=_0x2310ea;logger[_0xd02a('0xa')](_0xd02a('0x51'),_0xcc8d79['id']);return getTicket(_0x35d98c,_0x30e40f,_0xcc8d79,_0x250e53,_0x36da29);})[_0xd02a('0x13')](function(_0x271111){if(_0x271111){logger['info'](_0xd02a('0x52'),_0x271111['id']);switch(_0x35d98c['type']){case'integrationTab':logger[_0xd02a('0xa')]('[OUTBOUND]',_0xd02a('0x63'));return request({'uri':util[_0xd02a('0xb')](_0xd02a('0x55'),_0x35d98c[_0xd02a('0x18')],_0x30e40f['id'],_0x271111['id']),'method':_0xd02a('0xd')});case'newTab':logger[_0xd02a('0xa')](_0xd02a('0x60'),_0xd02a('0x57'));emit(util[_0xd02a('0xb')](_0xd02a('0x58'),_0x4bb560[_0xd02a('0xe')]),_0xd02a('0x59'),{'uri':util['format'](_0xd02a('0x5a'),_0x35d98c[_0xd02a('0x18')][_0xd02a('0x5b')]('/api/v2',''),_0x271111['id'])});break;default:logger[_0xd02a('0x5d')]('[OUTBOUND]',_0xd02a('0x64'));}}})[_0xd02a('0x65')](function(_0x27e833){logger[_0xd02a('0x5d')](_0xd02a('0x66'),util[_0xd02a('0x5f')](_0x27e833,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x213b48,_0x2f47d4,_0x58f1e7,_0x438621,_0xf7c202,_0x473ca9){var _0x3168ad,_0x3c35f8;_0x473ca9[_0xd02a('0x18')]=intUtil['stripTrailingSlash'](_0x473ca9['remoteUri']);_0x473ca9[_0xd02a('0x49')]=intUtil[_0xd02a('0x48')](_0x473ca9[_0xd02a('0x49')]);if(_0xf7c202&&_0xf7c202[_0xd02a('0x67')]){logger[_0xd02a('0xa')]('['+_0x2f47d4[_0xd02a('0x68')]['toUpperCase']()+']',_0xd02a('0x4a'));_0x2f47d4[_0xd02a('0x4b')]=util[_0xd02a('0xb')](_0xd02a('0x4c'),_0x473ca9[_0xd02a('0x49')],_0x2f47d4['uniqueid'],md5(_0x2f47d4[_0xd02a('0x4d')]));}else{_0x2f47d4[_0xd02a('0x4b')]='';}headers['Authorization']=getAuth(_0x473ca9);return getUser(_0x473ca9)[_0xd02a('0x13')](function(_0x123d2c){_0x3168ad=_0x123d2c;logger[_0xd02a('0xa')]('The\x20User\x20ID\x20is:',_0x3168ad['id']);return getEndUser(_0x473ca9,_0x2f47d4['calleridname'],_0x2f47d4[_0xd02a('0x69')]);})['then'](function(_0xd8313c){_0x3c35f8=_0xd8313c;logger[_0xd02a('0xa')]('The\x20Enduser\x20ID\x20is:',_0x3c35f8['id']);return getTicket(_0x473ca9,_0x3168ad,_0x3c35f8,_0x58f1e7,_0x2f47d4);})['then'](function(_0x44b422){if(_0x44b422){logger[_0xd02a('0xa')](_0xd02a('0x52'),_0x44b422['id']);}})[_0xd02a('0x65')](function(_0x548e41){logger[_0xd02a('0x5d')]('['+_0x2f47d4[_0xd02a('0x68')][_0xd02a('0x6a')]()+']'+_0xd02a('0x6b'),util[_0xd02a('0x5f')](_0x548e41,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6d4b=['[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','newTab','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','monitor_format','lastevent','toUpperCase','calleridname','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','Subjects','getString','Descriptions','Fields','validateEmail','Getting\x20agent\x20with\x20email','then','count','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','%s/search.json','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none'];(function(_0x581b8c,_0x45fafe){var _0x3e768f=function(_0x194578){while(--_0x194578){_0x581b8c['push'](_0x581b8c['shift']());}};_0x3e768f(++_0x45fafe);}(_0x6d4b,0x158));var _0xb6d4=function(_0x3f1fb2,_0x22be7b){_0x3f1fb2=_0x3f1fb2-0x0;var _0x1d6c89=_0x6d4b[_0x3f1fb2];return _0x1d6c89;};'use strict';var _=require(_0xb6d4('0x0'));var rp=require(_0xb6d4('0x1'));var md5=require(_0xb6d4('0x2'));var util=require('util');var Redis=require(_0xb6d4('0x3'));var intUtil=require(_0xb6d4('0x4'));var config=require('../../../../config/environment');var logger=require(_0xb6d4('0x5'))(_0xb6d4('0x6'));config[_0xb6d4('0x7')]=_[_0xb6d4('0x8')](config[_0xb6d4('0x7')],{'host':_0xb6d4('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb6d4('0x7')]));function emit(_0x2a792,_0x52a9b5,_0x44ea9d){io['to'](_0x2a792)[_0xb6d4('0xa')](_0x52a9b5,_0x44ea9d);}var headers={'Content-Type':_0xb6d4('0xb'),'Accept':_0xb6d4('0xb')};function getTicket(_0x5e582d,_0x12ff54,_0x118c2f,_0x293b18,_0x17c770){logger[_0xb6d4('0xc')](_0xb6d4('0xd'));return request({'uri':util[_0xb6d4('0xe')](_0xb6d4('0xf'),_0x5e582d[_0xb6d4('0x10')]),'method':'POST','body':{'ticket':_[_0xb6d4('0x11')]({'requester_id':_0x118c2f['id'],'submitter_id':_0x12ff54?_0x12ff54['id']:undefined,'assignee_id':_0x12ff54?_0x12ff54['id']:undefined,'tags':getTags(_0x293b18[_0xb6d4('0x12')],'name'),'subject':intUtil['getString'](_0x293b18[_0xb6d4('0x13')],_0x17c770,'\x20'),'description':intUtil['getString'](_0x293b18['Descriptions'],_0x17c770,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb6d4('0x14')](_0x293b18[_0xb6d4('0x15')],_0x17c770,'\x0a')}},getCustomFields(_0x293b18[_0xb6d4('0x16')],_0x17c770))}})['then'](function(_0x2375c5){logger[_0xb6d4('0xc')]('Ticket\x20created!');return _0x2375c5['ticket'];});}function getUser(_0x582d68,_0x1c7284){if(intUtil[_0xb6d4('0x17')](_0x1c7284)){logger['info'](_0xb6d4('0x18'),_0x1c7284);return request({'uri':util[_0xb6d4('0xe')]('%s/search.json',_0x582d68[_0xb6d4('0x10')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x1c7284)}})[_0xb6d4('0x19')](function(_0x222cb8){if(_0x222cb8[_0xb6d4('0x1a')]){logger[_0xb6d4('0xc')](_0xb6d4('0x1b'));return _['find'](_0x222cb8['results'],{'email':_0x1c7284,'role':'agent'});}else{logger['info'](_0xb6d4('0x1c'));return request({'uri':util[_0xb6d4('0xe')](_0xb6d4('0x1d'),_0x582d68[_0xb6d4('0x10')])})[_0xb6d4('0x19')](function(_0x91ed3){logger[_0xb6d4('0xc')](_0xb6d4('0x1e'));return _0x91ed3[_0xb6d4('0x1f')];});}});}else{logger['info'](_0xb6d4('0x1c'));return request({'uri':util[_0xb6d4('0xe')](_0xb6d4('0x1d'),_0x582d68[_0xb6d4('0x10')])})[_0xb6d4('0x19')](function(_0x30de95){logger['info'](_0xb6d4('0x1e'));return _0x30de95['user'];});}}function getEndUser(_0xa5942c,_0x2eaf96,_0x48eb84){logger['info']('Searching\x20enduser\x20with\x20phone',_0x48eb84);return request({'uri':util['format'](_0xb6d4('0x20'),_0xa5942c['remoteUri']),'qs':{'query':util['format'](_0xb6d4('0x21'),_0x48eb84)}})[_0xb6d4('0x19')](function(_0x1c1f21){var _0x1a6657;if(_0x1c1f21[_0xb6d4('0x22')][_0xb6d4('0x23')]){_0x1c1f21[_0xb6d4('0x22')]=_[_0xb6d4('0x24')](_0x1c1f21[_0xb6d4('0x22')],{'suspended':![],'role':_0xb6d4('0x25')});if(_0x1c1f21[_0xb6d4('0x22')][_0xb6d4('0x23')]){_0x1a6657=_['first'](_0x1c1f21[_0xb6d4('0x22')]);}}if(_0x1a6657){logger['info'](_0xb6d4('0x26'));return _0x1a6657;}else{logger[_0xb6d4('0xc')](_0xb6d4('0x27'));return request({'uri':util[_0xb6d4('0xe')](_0xb6d4('0x28'),_0xa5942c['remoteUri']),'method':_0xb6d4('0x29'),'body':{'user':{'role':'end-user','name':util[_0xb6d4('0xe')]('Caller\x20-\x20%s',_0x2eaf96||_0x48eb84),'phone':_0x48eb84}}})['then'](function(_0x3fc1ca){logger[_0xb6d4('0xc')](_0xb6d4('0x2a'));return _0x3fc1ca[_0xb6d4('0x1f')];});}});}function getAuth(_0x4501b3){var _0x42b0e6;if(_0x4501b3[_0xb6d4('0x2b')]===_0xb6d4('0x2c')){_0x42b0e6=util['format']('%s:%s',_0x4501b3[_0xb6d4('0x2d')],_0x4501b3[_0xb6d4('0x2c')]);}else if(_0x4501b3[_0xb6d4('0x2b')]===_0xb6d4('0x2e')){_0x42b0e6=util[_0xb6d4('0xe')](_0xb6d4('0x2f'),_0x4501b3[_0xb6d4('0x2d')],_0x4501b3['token']);}return util[_0xb6d4('0xe')](_0xb6d4('0x30'),new Buffer(_0x42b0e6)[_0xb6d4('0x31')](_0xb6d4('0x32')));}function request(_0x44fc22){logger[_0xb6d4('0x33')](_0xb6d4('0x34'),JSON[_0xb6d4('0x35')](_0x44fc22));return rp(_[_0xb6d4('0x8')](_0x44fc22,{'method':_0xb6d4('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x477059,_0x50dbe0){var _0x4a16a7=[];if(_0x477059&&_0x477059[_0xb6d4('0x23')]>0x0){_0x4a16a7=_[_0xb6d4('0x37')](_0x477059,_0x50dbe0);}return _0x4a16a7;}function getCustomFields(_0x2e0ffd,_0x43ba29){var _0x7d9986=[];var _0x31f145={'custom_fields':[]};if(_0x2e0ffd[_0xb6d4('0x23')]>0x0){_[_0xb6d4('0x38')](_0x2e0ffd,function(_0x1e011c){if(_0x1e011c[_0xb6d4('0x39')]===_0xb6d4('0x3a')&&_0x1e011c[_0xb6d4('0x3b')]&&!_0x1e011c[_0xb6d4('0x3c')]){_0x31f145[_0x1e011c[_0xb6d4('0x3b')]['toLowerCase']()]=_0x1e011c[_0xb6d4('0x3d')][_0xb6d4('0x31')]();}else if(_0x1e011c['type']===_0xb6d4('0x3a')&&_0x1e011c[_0xb6d4('0x3e')]&&_0x1e011c[_0xb6d4('0x3c')]){_0x31f145[_0xb6d4('0x3f')][_0xb6d4('0x40')]({'id':_0x1e011c['idField'],'value':_0x1e011c['content'][_0xb6d4('0x31')]()});}else if(_0x1e011c['type']===_0xb6d4('0x41')&&_0x1e011c[_0xb6d4('0x42')]&&_0x1e011c['idField']&&_0x1e011c[_0xb6d4('0x3c')]){_0x43ba29[_0x1e011c[_0xb6d4('0x42')]]&&_0x31f145[_0xb6d4('0x3f')]['push']({'id':_0x1e011c['idField'],'value':_0x43ba29[_0x1e011c['variableName']][_0xb6d4('0x31')]()});}else if(_0x1e011c[_0xb6d4('0x39')]===_0xb6d4('0x43')&&_0x1e011c['Variable']&&_0x1e011c['Variable']['name']&&_0x1e011c[_0xb6d4('0x3e')]&&_0x1e011c['customField']){_0x43ba29[_0x1e011c[_0xb6d4('0x44')][_0xb6d4('0x45')][_0xb6d4('0x46')]()]&&_0x31f145[_0xb6d4('0x3f')][_0xb6d4('0x40')]({'id':_0x1e011c[_0xb6d4('0x3e')],'value':_0x43ba29[_0x1e011c[_0xb6d4('0x44')][_0xb6d4('0x45')][_0xb6d4('0x46')]()]['toString']()});}});}return _0x31f145;}exports[_0xb6d4('0x47')]=function(_0x3323c9,_0x46d9bb,_0x3f1f1b,_0x198c7f,_0x14c547,_0x1a0e54){var _0x51efc6,_0x4ac561;_0x1a0e54['remoteUri']=intUtil[_0xb6d4('0x48')](_0x1a0e54[_0xb6d4('0x10')]);_0x1a0e54[_0xb6d4('0x49')]=intUtil['stripTrailingSlash'](_0x1a0e54['serverUrl']);if(_0x14c547&&_0x14c547['monitor_format']){logger['info'](_0xb6d4('0x4a'),'Recording\x20is\x20enabled!');_0x46d9bb['recordingURL']=util['format'](_0xb6d4('0x4b'),_0x1a0e54[_0xb6d4('0x49')],_0x46d9bb[_0xb6d4('0x4c')],md5(_0x46d9bb[_0xb6d4('0x4c')]));}else{_0x46d9bb[_0xb6d4('0x4d')]='';}headers[_0xb6d4('0x4e')]=getAuth(_0x1a0e54);return getUser(_0x1a0e54,_0x198c7f[_0xb6d4('0x4f')])[_0xb6d4('0x19')](function(_0x5cdcb8){_0x51efc6=_0x5cdcb8;logger[_0xb6d4('0xc')](_0xb6d4('0x50'),_0x51efc6['id']);return getEndUser(_0x1a0e54,_0x46d9bb['calleridname'],_0x46d9bb['calleridnum']);})[_0xb6d4('0x19')](function(_0x52b22f){_0x4ac561=_0x52b22f;logger[_0xb6d4('0xc')](_0xb6d4('0x51'),_0x4ac561['id']);return getTicket(_0x1a0e54,_0x51efc6,_0x4ac561,_0x3f1f1b,_0x46d9bb);})[_0xb6d4('0x19')](function(_0x2fd7a4){if(_0x2fd7a4){logger['info']('The\x20Ticket\x20ID\x20is:',_0x2fd7a4['id']);switch(_0x1a0e54[_0xb6d4('0x39')]){case _0xb6d4('0x52'):logger[_0xb6d4('0xc')](_0xb6d4('0x4a'),_0xb6d4('0x53'));return request({'uri':util['format'](_0xb6d4('0x54'),_0x1a0e54['remoteUri'],_0x51efc6['id'],_0x2fd7a4['id']),'method':_0xb6d4('0x29')});case'newTab':logger[_0xb6d4('0xc')](_0xb6d4('0x4a'),_0xb6d4('0x55'));emit(util[_0xb6d4('0xe')]('user:%s',_0x198c7f[_0xb6d4('0x45')]),_0xb6d4('0x56'),{'uri':util['format']('%s/agent/tickets/%s',_0x1a0e54[_0xb6d4('0x10')][_0xb6d4('0x57')](_0xb6d4('0x58'),''),_0x2fd7a4['id'])});break;default:logger[_0xb6d4('0x59')](_0xb6d4('0x4a'),_0xb6d4('0x5a'));}}})[_0xb6d4('0x5b')](function(_0x21d756){logger[_0xb6d4('0x59')](_0xb6d4('0x5c'),util['inspect'](_0x21d756,{'showHidden':!![],'depth':null}));});};exports[_0xb6d4('0x5d')]=function(_0x28c54b,_0x3a7b0d,_0x55e54e,_0x6349ea,_0x36839f,_0x538b23,_0x200646){var _0x56ef1c,_0x4f8ba3;_0x538b23['remoteUri']=intUtil[_0xb6d4('0x48')](_0x538b23[_0xb6d4('0x10')]);_0x538b23[_0xb6d4('0x49')]=intUtil[_0xb6d4('0x48')](_0x538b23['serverUrl']);if(_0x200646&&_0x200646[_0xb6d4('0x5e')]&&_0x200646['recordingFormat']!==_0xb6d4('0x5f')){logger['info'](_0xb6d4('0x60'),_0xb6d4('0x61'));_0x3a7b0d[_0xb6d4('0x4d')]=util[_0xb6d4('0xe')](_0xb6d4('0x4b'),_0x538b23[_0xb6d4('0x49')],_0x3a7b0d['uniqueid'],md5(_0x3a7b0d[_0xb6d4('0x4c')]));}headers[_0xb6d4('0x4e')]=getAuth(_0x538b23);return getUser(_0x538b23,_0x6349ea[_0xb6d4('0x4f')])['then'](function(_0x367ebc){_0x56ef1c=_0x367ebc;logger[_0xb6d4('0xc')]('The\x20User\x20ID\x20is:',_0x56ef1c['id']);return getEndUser(_0x538b23,_0x3a7b0d[_0xb6d4('0x62')],_0x3a7b0d[_0xb6d4('0x63')]);})[_0xb6d4('0x19')](function(_0x466bbc){_0x4f8ba3=_0x466bbc;logger[_0xb6d4('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4f8ba3['id']);return getTicket(_0x538b23,_0x56ef1c,_0x4f8ba3,_0x55e54e,_0x3a7b0d);})[_0xb6d4('0x19')](function(_0x22764d){if(_0x22764d){logger[_0xb6d4('0xc')]('The\x20Ticket\x20ID\x20is:',_0x22764d['id']);switch(_0x538b23[_0xb6d4('0x39')]){case'integrationTab':logger['info'](_0xb6d4('0x60'),_0xb6d4('0x53'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x538b23[_0xb6d4('0x10')],_0x56ef1c['id'],_0x22764d['id']),'method':_0xb6d4('0x29')});case _0xb6d4('0x64'):logger[_0xb6d4('0xc')]('[OUTBOUND]',_0xb6d4('0x55'));emit(util[_0xb6d4('0xe')](_0xb6d4('0x65'),_0x6349ea[_0xb6d4('0x45')]),_0xb6d4('0x56'),{'uri':util[_0xb6d4('0xe')]('%s/agent/tickets/%s',_0x538b23[_0xb6d4('0x10')][_0xb6d4('0x57')](_0xb6d4('0x58'),''),_0x22764d['id'])});break;default:logger['error'](_0xb6d4('0x60'),_0xb6d4('0x5a'));}}})[_0xb6d4('0x5b')](function(_0x4c6b73){logger[_0xb6d4('0x59')](_0xb6d4('0x66'),util[_0xb6d4('0x67')](_0x4c6b73,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x4b5406,_0x3ff0ea,_0x11db99,_0x4cec02,_0x30e864,_0x1b69ee){var _0x3d5b9,_0x4109ee;_0x1b69ee[_0xb6d4('0x10')]=intUtil[_0xb6d4('0x48')](_0x1b69ee[_0xb6d4('0x10')]);_0x1b69ee['serverUrl']=intUtil['stripTrailingSlash'](_0x1b69ee['serverUrl']);if(_0x30e864&&_0x30e864[_0xb6d4('0x68')]){logger[_0xb6d4('0xc')]('['+_0x3ff0ea[_0xb6d4('0x69')][_0xb6d4('0x6a')]()+']',_0xb6d4('0x61'));_0x3ff0ea[_0xb6d4('0x4d')]=util[_0xb6d4('0xe')](_0xb6d4('0x4b'),_0x1b69ee[_0xb6d4('0x49')],_0x3ff0ea['uniqueid'],md5(_0x3ff0ea[_0xb6d4('0x4c')]));}else{_0x3ff0ea['recordingURL']='';}headers[_0xb6d4('0x4e')]=getAuth(_0x1b69ee);return getUser(_0x1b69ee)[_0xb6d4('0x19')](function(_0x20d2f1){_0x3d5b9=_0x20d2f1;logger[_0xb6d4('0xc')](_0xb6d4('0x50'),_0x3d5b9['id']);return getEndUser(_0x1b69ee,_0x3ff0ea[_0xb6d4('0x6b')],_0x3ff0ea[_0xb6d4('0x6c')]);})[_0xb6d4('0x19')](function(_0x16a7a4){_0x4109ee=_0x16a7a4;logger[_0xb6d4('0xc')](_0xb6d4('0x51'),_0x4109ee['id']);return getTicket(_0x1b69ee,_0x3d5b9,_0x4109ee,_0x11db99,_0x3ff0ea);})[_0xb6d4('0x19')](function(_0x26787c){if(_0x26787c){logger[_0xb6d4('0xc')]('The\x20Ticket\x20ID\x20is:',_0x26787c['id']);}})[_0xb6d4('0x5b')](function(_0x15c202){logger[_0xb6d4('0x59')]('['+_0x3ff0ea[_0xb6d4('0x69')][_0xb6d4('0x6a')]()+']'+_0xb6d4('0x6d'),util['inspect'](_0x15c202,{'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 9e5296e..3c11959 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 _0xb199=['last_name','data','code','SUCCESS','moduleCreate','Error:\x20','log','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','Owner','administrator','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','answertime','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','Timeout','outbound','starttime','Inbound','Fields','/crm/v2/Calls','details','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','none','[OUTBOUND]','destcalleridnum','user:%s','https://crm.','unmanaged','toUpperCase','/downloads?type=uniqueid&token=','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','stringify','length','forEach','string','idField','toString','variable','variableName','type','customVariable','name','Variable','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','clientSecret','then','add','seconds','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','POST','https://www.zohoapis.','startCase','role','first_name'];(function(_0x5ad74d,_0xc5b4db){var _0x5b0b4f=function(_0x396ef9){while(--_0x396ef9){_0x5ad74d['push'](_0x5ad74d['shift']());}};_0x5b0b4f(++_0xc5b4db);}(_0xb199,0xdc));var _0x9b19=function(_0x212faf,_0x28bd40){_0x212faf=_0x212faf-0x0;var _0x5844a7=_0xb199[_0x212faf];return _0x5844a7;};'use strict';var _=require('lodash');var rp=require(_0x9b19('0x0'));var md5=require(_0x9b19('0x1'));var util=require(_0x9b19('0x2'));var intUtil=require(_0x9b19('0x3'));var moment=require('moment');var Redis=require(_0x9b19('0x4'));var BPromise=require(_0x9b19('0x5'));var config=require(_0x9b19('0x6'));var logger=require(_0x9b19('0x7'))(_0x9b19('0x8'));config[_0x9b19('0x9')]=_[_0x9b19('0xa')](config['redis'],{'host':_0x9b19('0xb'),'port':0x18eb});var io=require(_0x9b19('0xc'))(new Redis(config[_0x9b19('0x9')]));function emit(_0x2c0186,_0x39a0eb,_0x36e712){io['to'](_0x2c0186)[_0x9b19('0xd')](_0x39a0eb,_0x36e712);}function request(_0x4e26d7){logger['debug']('[HTTP]',JSON[_0x9b19('0xe')](_0x4e26d7));return rp(_0x4e26d7);}function getCustomFields(_0x55406a,_0x52a916){var _0xb65165={};if(_0x55406a[_0x9b19('0xf')]>0x0){_[_0x9b19('0x10')](_0x55406a,function(_0x1adfbc){if(_0x1adfbc['type']===_0x9b19('0x11')&&_0x1adfbc[_0x9b19('0x12')]){_0xb65165[_0x1adfbc['idField']]=_0x1adfbc['content'][_0x9b19('0x13')]();}else if(_0x1adfbc['type']===_0x9b19('0x14')&&_0x1adfbc[_0x9b19('0x15')]&&_0x1adfbc[_0x9b19('0x12')]&&_0x52a916[_0x1adfbc[_0x9b19('0x15')]]){_0xb65165[_0x1adfbc[_0x9b19('0x12')]]=_0x52a916[_0x1adfbc['variableName']]['toString']();}else if(_0x1adfbc[_0x9b19('0x16')]===_0x9b19('0x17')&&_0x1adfbc['Variable']&&_0x1adfbc['Variable'][_0x9b19('0x18')]&&_0x1adfbc['idField']&&_0x52a916[_0x1adfbc[_0x9b19('0x19')]['name'][_0x9b19('0x1a')]()]){_0xb65165[_0x1adfbc[_0x9b19('0x12')]]=_0x52a916[_0x1adfbc[_0x9b19('0x19')][_0x9b19('0x18')][_0x9b19('0x1a')]()][_0x9b19('0x13')]();}});}return _0xb65165;}function getName(_0x438153){if(_0x438153[_0x9b19('0x1b')]('\x20')>0x0){var _0x1898d8=_0x438153[_0x9b19('0x1c')](/ (.+)/);if(_0x1898d8[0x1]){return _0x1898d8;}}return[_0x438153,_0x438153];}var accountsTokens={};function getAccessToken(_0x7c1723){return new Promise(function(_0xa973aa,_0x1ec994){if(!_[_0x9b19('0x1d')](accountsTokens[_0x7c1723['id']])&&!_[_0x9b19('0x1d')](accountsTokens[_0x7c1723['id']][_0x9b19('0x1e')])){if(moment()[_0x9b19('0x1f')](accountsTokens[_0x7c1723['id']][_0x9b19('0x20')])){_0xa973aa(accountsTokens[_0x7c1723['id']][_0x9b19('0x1e')]);}}var _0x973a75;switch(_0x7c1723[_0x9b19('0x21')]){case'US':_0x973a75=_0x9b19('0x22');break;case'AU':_0x973a75='https://accounts.zoho.com.au';break;case'EU':_0x973a75='https://accounts.zoho.eu';break;case'IN':_0x973a75='https://accounts.zoho.in';break;case'CN':_0x973a75=_0x9b19('0x23');break;default:_0x973a75='https://accounts.zoho.eu';break;}var _0x4eab6a={'method':'POST','uri':_0x973a75+_0x9b19('0x24'),'qs':{'refresh_token':_0x7c1723['refreshToken'],'client_id':_0x7c1723[_0x9b19('0x25')],'client_secret':_0x7c1723[_0x9b19('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4eab6a)[_0x9b19('0x27')](function(_0x1dd724){accountsTokens[_0x7c1723['id']]={'access_token':_0x1dd724[_0x9b19('0x1e')],'expires_in':moment()[_0x9b19('0x28')](_0x1dd724[_0x9b19('0x20')],_0x9b19('0x29'))};_0xa973aa(_0x1dd724[_0x9b19('0x1e')]);})[_0x9b19('0x2a')](function(_0x5e3298){logger[_0x9b19('0x2b')]('Failing\x20creating\x20the\x20access_token',_0x5e3298[_0x9b19('0x2c')]);_0x1ec994(_0x5e3298);});});}function getUser(_0x4c2a62,_0x1dca03,_0x346375,_0x385bd6){logger[_0x9b19('0x2d')](_0x9b19('0x2e'));return request({'method':_0x9b19('0x2f'),'uri':util[_0x9b19('0x30')](_0x9b19('0x31'),_0x1dca03),'qs':{'type':_0x9b19('0x32')},'headers':{'Authorization':_0x9b19('0x33')+_0x4c2a62},'json':!![]})['then'](function(_0x582179){if(_0x582179['users']){var _0x1f3bb0=-0x1;if(_[_0x9b19('0x34')](_0x582179['users'])){if(!_['isNil'](_0x385bd6)){_0x1f3bb0=_['findIndex'](_0x582179[_0x9b19('0x35')],function(_0x25236b){return _0x25236b[_0x9b19('0x36')]===_0x385bd6;});}if(_0x1f3bb0>=0x0){logger[_0x9b19('0x2d')](_0x9b19('0x37'));}else{logger[_0x9b19('0x2d')](_0x9b19('0x38'));_0x1f3bb0=_['findIndex'](_0x582179[_0x9b19('0x35')],function(_0x57ab64){return _0x57ab64[_0x9b19('0x39')]['name']===_0x9b19('0x3a');});}return _0x582179['users'][_0x1f3bb0];}else{if(_0x582179[_0x9b19('0x3b')][_0x9b19('0x39')]['name']===_0x9b19('0x3a')){logger[_0x9b19('0x2d')](_0x9b19('0x38'));user=_0x582179[_0x9b19('0x3b')];return user;}else{logger['error'](_0x9b19('0x3c'),JSON[_0x9b19('0xe')](_0x582179));throw new Error(_0x9b19('0x3d')+JSON['stringify'](_0x582179));}}}else{logger[_0x9b19('0x2b')](_0x9b19('0x3c'),JSON[_0x9b19('0xe')](_0x582179));throw new Error(_0x9b19('0x3d')+JSON[_0x9b19('0xe')](_0x582179));}})['catch'](function(_0x4b3708){console[_0x9b19('0x2b')](_0x4b3708);});}function getZohoUser(_0x4beafb,_0x26da61){return new BPromise(function(_0x369590,_0x4b7fcb){request(_0x4beafb)[_0x9b19('0x27')](function(_0x1e08eb){var _0x272b0b=null;if(_0x1e08eb){_0x272b0b=_0x1e08eb['data'][0x0];_0x272b0b[_0x9b19('0x3e')]=_0x26da61;}_0x369590(_0x272b0b);})['catch'](function(_0x3d278d){_0x4b7fcb(_0x3d278d);});});}function createEndUser(_0x4c3a13,_0x424b41,_0x2a1b95,_0x69dda7,_0x2ef7ad,_0x2c78d8){var _0x2a1b95=getName(_0x2a1b95);return request({'method':_0x9b19('0x3f'),'uri':_0x9b19('0x40')+_0x424b41+'/crm/v2/'+_[_0x9b19('0x41')](_0x2c78d8['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x2a1b95[0x1],'First_Name':_0x2a1b95[0x0],'Phone':_0x69dda7,'Owner':{'name':!_[_0x9b19('0x1d')](_0x2ef7ad['role']['name'])?_0x2ef7ad[_0x9b19('0x42')][_0x9b19('0x18')]:!_[_0x9b19('0x1d')](_0x2ef7ad[_0x9b19('0x43')])?_0x2ef7ad['first_name']+'\x20'+_0x2ef7ad[_0x9b19('0x44')]:_0x2ef7ad[_0x9b19('0x44')],'id':_0x2ef7ad['id']}}]},'headers':{'Authorization':_0x9b19('0x33')+_0x4c3a13},'json':!![]})[_0x9b19('0x27')](function(_0x800159){if(_0x800159&&_0x800159[_0x9b19('0x45')][0x0][_0x9b19('0x46')]===_0x9b19('0x47')){var _0x4331f8=_0x800159[_0x9b19('0x45')][0x0]['details'];_0x4331f8['enduserType']=_[_0x9b19('0x41')](_0x2c78d8[_0x9b19('0x48')])+'s';return _0x4331f8;}logger['error'](_0x9b19('0x3c'),JSON[_0x9b19('0xe')](data));throw new Error(_0x9b19('0x49')+JSON[_0x9b19('0xe')](data));})[_0x9b19('0x2a')](function(_0x14fd25){console[_0x9b19('0x4a')]('CREATE\x20ERROR',_0x14fd25);});}function getEndUser(_0x3e2a19,_0x3e5635,_0x14f374,_0x393a9f,_0x2e70d6,_0x557f18,_0x5a46c6){var _0x5e5357={'method':_0x9b19('0x2f'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3e2a19},'json':!![]};switch(_0x5a46c6[_0x9b19('0x4b')]){case'contact_lead':_0x5e5357[_0x9b19('0x4c')]='https://www.zohoapis.'+_0x3e5635+_0x9b19('0x4d')+_0x2e70d6+'))';return getZohoUser(_0x5e5357,_0x9b19('0x4e'))[_0x9b19('0x27')](function(_0x591f4f){if(_0x591f4f)return _0x591f4f;_0x5e5357[_0x9b19('0x4c')]=_0x9b19('0x40')+_0x3e5635+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2e70d6+'))';return getZohoUser(_0x5e5357,_0x9b19('0x4f'))[_0x9b19('0x27')](function(_0x6497bf){if(_0x6497bf)return _0x6497bf;if(_0x5a46c6[_0x9b19('0x48')]!=_0x9b19('0x50')){return createEndUser(_0x3e2a19,_0x3e5635,_0x393a9f,_0x2e70d6,_0x557f18,_0x5a46c6);}else{return{};}});});break;case'contact':_0x5e5357['uri']=_0x9b19('0x40')+_0x3e5635+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2e70d6+'))';return getZohoUser(_0x5e5357,_0x9b19('0x4e'))['then'](function(_0x4f9220){if(_0x4f9220)return _0x4f9220;if(_0x5a46c6[_0x9b19('0x48')]!=_0x9b19('0x50')){return createEndUser(_0x3e2a19,_0x3e5635,_0x393a9f,_0x2e70d6,_0x557f18,_0x5a46c6);}else{return{};}});break;case'lead':_0x5e5357[_0x9b19('0x4c')]=_0x9b19('0x40')+_0x3e5635+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2e70d6+'))';return getZohoUser(_0x5e5357,_0x9b19('0x4f'))['then'](function(_0x129345){if(_0x129345)return _0x129345;if(_0x5a46c6[_0x9b19('0x48')]!=_0x9b19('0x50')){return createEndUser(_0x3e2a19,_0x3e5635,_0x393a9f,_0x2e70d6,_0x557f18,_0x5a46c6);}else{return{};}});break;}}function getCall(_0x4aaf35,_0x3def1c,_0x6fe833,_0x5926e8,_0x1c5b1e,_0x538dfc,_0x4bf668,_0xee3f15){logger[_0x9b19('0x2d')]('Creating\x20new\x20call...');var _0x4a8617={};_0x4a8617[_0x9b19('0x51')]={'name':!_['isNil'](_0x5926e8[_0x9b19('0x42')][_0x9b19('0x18')])&&!_['isNil'](_0x5926e8[_0x9b19('0x39')][_0x9b19('0x18')])&&_0x5926e8['profile'][_0x9b19('0x18')]===_0x9b19('0x52')?_0x5926e8['role'][_0x9b19('0x18')]:!_[_0x9b19('0x1d')](_0x5926e8[_0x9b19('0x43')])?_0x5926e8[_0x9b19('0x43')]+'\x20'+_0x5926e8[_0x9b19('0x44')]:_0x5926e8[_0x9b19('0x44')],'id':_0x5926e8['id']};_0x4a8617[_0x9b19('0x53')]=intUtil[_0x9b19('0x54')](_0x538dfc[_0x9b19('0x55')],_0x4bf668,'\x20');_0x4a8617[_0x9b19('0x56')]=intUtil['getString'](_0x538dfc['Descriptions'],_0x4bf668,'\x0a');if(_0x1c5b1e[_0x9b19('0x3e')]===_0x9b19('0x4e')){_0x4a8617[_0x9b19('0x57')]={'name':!_['isNil'](_0x1c5b1e[_0x9b19('0x58')])?_0x1c5b1e[_0x9b19('0x58')]:!_[_0x9b19('0x1d')](_0x1c5b1e[_0x9b19('0x59')])?_0x1c5b1e[_0x9b19('0x59')]+'\x20'+_0x1c5b1e['Last_Name']:_0x1c5b1e[_0x9b19('0x5a')],'id':_0x1c5b1e['id']};}if(_0x1c5b1e[_0x9b19('0x3e')]===_0x9b19('0x4f')){_0x4a8617[_0x9b19('0x5b')]={'name':!_[_0x9b19('0x1d')](_0x1c5b1e[_0x9b19('0x58')])?_0x1c5b1e['Full_Name']:!_['isNil'](_0x1c5b1e[_0x9b19('0x59')])?_0x1c5b1e[_0x9b19('0x59')]+'\x20'+_0x1c5b1e[_0x9b19('0x5a')]:_0x1c5b1e['Last_Name'],'id':_0x1c5b1e['id']};_0x4a8617[_0x9b19('0x5c')]=_[_0x9b19('0x41')](_0x1c5b1e[_0x9b19('0x3e')]);}if(_0x4bf668[_0x9b19('0x5d')]){_0x4a8617[_0x9b19('0x5e')]=moment['utc'](parseInt(_0x4bf668[_0x9b19('0x5d')])*0x3e8)[_0x9b19('0x30')]('mm:ss');}else if(_0x4bf668[_0x9b19('0x5f')]&&_0x4bf668['endtime']){_0x4a8617[_0x9b19('0x5e')]=moment[_0x9b19('0x60')](moment(_0x4bf668[_0x9b19('0x61')],_0x9b19('0x62'))[_0x9b19('0x63')](moment(_0x4bf668['starttime'],_0x9b19('0x62'))))['format']('mm:ss');}switch(_0x4bf668[_0x9b19('0x64')]){case'called':_0x4a8617[_0x9b19('0x65')]=_0x9b19('0x66');break;case _0x9b19('0x67'):case _0x9b19('0x68'):_0x4a8617[_0x9b19('0x65')]='Answered';break;case _0x9b19('0x69'):_0x4a8617[_0x9b19('0x65')]=_0x9b19('0x6a');break;case _0x9b19('0x6b'):_0x4a8617[_0x9b19('0x65')]=_0x9b19('0x6c');break;case'timeout':_0x4a8617[_0x9b19('0x65')]=_0x9b19('0x6d');default:}_0x4a8617['Call_Start_Time']=(_0xee3f15===_0x9b19('0x6e')?moment(_0x4bf668[_0x9b19('0x6f')])[_0x9b19('0x30')](_0x9b19('0x62')):moment(_0x4bf668['agentcalledAt'])['format'](_0x9b19('0x62')))||moment()['format'](_0x9b19('0x62'));_0x4a8617['Call_Type']=_0xee3f15||_0x9b19('0x70');_0x4a8617=_['merge'](_0x4a8617,getCustomFields(_0x538dfc[_0x9b19('0x71')],_0x4bf668));return request({'method':_0x9b19('0x3f'),'uri':'https://www.zohoapis.'+_0x3def1c+_0x9b19('0x72'),'headers':{'Authorization':_0x9b19('0x33')+_0x4aaf35},'body':{'data':[_0x4a8617]},'json':!![]})['then'](function(_0x48e2eb){if(_0x48e2eb&&_0x48e2eb['data'][0x0]['code']===_0x9b19('0x47')){logger[_0x9b19('0x2d')]('Call\x20created!');return{'id':_0x48e2eb[_0x9b19('0x45')][0x0][_0x9b19('0x73')]['id']};}})['catch'](function(_0x2368eb){logger[_0x9b19('0x2d')](_0x9b19('0x74'),_0x2368eb[_0x9b19('0x2c')]);console['log'](_0x9b19('0x74'),_0x2368eb);});}exports[_0x9b19('0x75')]=function(_0x7624c6,_0x46600c,_0x43a4fb,_0x36f1d6,_0x4d7667,_0x441acf){var _0xb697d2,_0x4fb840,_0x34dbd2;_0x441acf[_0x9b19('0x76')]=intUtil['stripTrailingSlash'](_0x441acf['host']);_0x441acf[_0x9b19('0x77')]=intUtil[_0x9b19('0x78')](_0x441acf['serverUrl']);if(_0x4d7667&&_0x4d7667[_0x9b19('0x79')]){logger[_0x9b19('0x2d')](_0x9b19('0x7a'),_0x9b19('0x7b'));_0x46600c[_0x9b19('0x7c')]=_0x441acf['serverUrl']+_0x9b19('0x7d')+_0x46600c[_0x9b19('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x46600c[_0x9b19('0x7e')]);}else{_0x46600c[_0x9b19('0x7c')]='';}var _0x51e4b3=_0x441acf[_0x9b19('0x76')]===_0x9b19('0x7f')?'eu':_0x9b19('0x80');return getAccessToken(_0x441acf)[_0x9b19('0x27')](function(_0x544c20){_0x34dbd2=_0x544c20;return getUser(_0x34dbd2,_0x51e4b3,_0x441acf,_0x36f1d6[_0x9b19('0x36')]);})['then'](function(_0x5c0b20){_0xb697d2=_0x5c0b20;logger[_0x9b19('0x2d')](_0x9b19('0x81'),_0xb697d2['id']);return getEndUser(_0x34dbd2,_0x51e4b3,_0x441acf,_0x46600c[_0x9b19('0x82')],_0x46600c[_0x9b19('0x83')],_0xb697d2,_0x43a4fb);})[_0x9b19('0x27')](function(_0x36cac1){_0x4fb840=_0x36cac1;return getCall(_0x34dbd2,_0x51e4b3,_0x441acf,_0xb697d2,_0x4fb840,_0x43a4fb,_0x46600c,_0x9b19('0x70'));})[_0x9b19('0x27')](function(_0x573ceb){if(_0x573ceb){logger[_0x9b19('0x2d')](_0x9b19('0x84'),_0x573ceb['id']);logger[_0x9b19('0x2d')](_0x9b19('0x7a'),_0x9b19('0x85'));emit(util[_0x9b19('0x30')]('user:%s',_0x36f1d6[_0x9b19('0x18')]),_0x9b19('0x86'),{'uri':'https://crm.'+_0x441acf['host']+_0x9b19('0x87')+_0x573ceb['id']});}})[_0x9b19('0x2a')](function(_0x3290e2){logger[_0x9b19('0x2b')](_0x9b19('0x7a'),JSON[_0x9b19('0xe')](_0x3290e2));});};exports[_0x9b19('0x6e')]=function(_0x454523,_0x160b6d,_0x33bf81,_0xed4dcd,_0x2c9d20,_0x16f078,_0x2e9444){var _0x4bbe00,_0x15df64,_0x2483d4;_0x16f078[_0x9b19('0x76')]=intUtil['stripTrailingSlash'](_0x16f078[_0x9b19('0x76')]);_0x16f078[_0x9b19('0x77')]=intUtil[_0x9b19('0x78')](_0x16f078['serverUrl']);if(_0x2e9444&&_0x2e9444['recordingFormat']&&_0x2e9444['recordingFormat']!==_0x9b19('0x88')){logger[_0x9b19('0x2d')](_0x9b19('0x89'),'Recording\x20is\x20enabled!');_0x160b6d['recordingURL']=_0x16f078[_0x9b19('0x77')]+_0x9b19('0x7d')+_0x160b6d[_0x9b19('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x160b6d[_0x9b19('0x7e')]);}var _0x26e611=_0x16f078[_0x9b19('0x76')]===_0x9b19('0x7f')?'eu':_0x9b19('0x80');return getAccessToken(_0x16f078)[_0x9b19('0x27')](function(_0x416e7c){_0x2483d4=_0x416e7c;return getUser(_0x2483d4,_0x26e611,_0x16f078,_0xed4dcd[_0x9b19('0x36')]);})[_0x9b19('0x27')](function(_0x4e3dcb){_0x4bbe00=_0x4e3dcb;logger[_0x9b19('0x2d')]('The\x20User\x20ID\x20is:',_0x4bbe00['id']);return getEndUser(_0x2483d4,_0x26e611,_0x16f078,_0x160b6d['destcalleridname'],_0x160b6d[_0x9b19('0x8a')],_0x4bbe00,_0x33bf81);})[_0x9b19('0x27')](function(_0x298a63){_0x15df64=_0x298a63;return getCall(_0x2483d4,_0x26e611,_0x16f078,_0x4bbe00,_0x15df64,_0x33bf81,_0x160b6d,'Outbound');})['then'](function(_0x828a31){if(_0x828a31){logger[_0x9b19('0x2d')]('The\x20Call\x20ID\x20is:',_0x828a31['id']);logger['info']('[OUTBOUND]',_0x9b19('0x85'));emit(util[_0x9b19('0x30')](_0x9b19('0x8b'),_0xed4dcd[_0x9b19('0x18')]),_0x9b19('0x86'),{'uri':_0x9b19('0x8c')+_0x16f078[_0x9b19('0x76')]+_0x9b19('0x87')+_0x828a31['id']});}})[_0x9b19('0x2a')](function(_0xba2f0e){logger[_0x9b19('0x2b')](_0x9b19('0x89'),JSON[_0x9b19('0xe')](_0xba2f0e));});};exports[_0x9b19('0x8d')]=function(_0x99a8b7,_0x3d6656,_0x4057d5,_0x3e6e6c,_0x5dabc2,_0x152419){var _0x2e4fab,_0x413cbe,_0x8fe088;_0x152419[_0x9b19('0x76')]=intUtil[_0x9b19('0x78')](_0x152419[_0x9b19('0x76')]);_0x152419[_0x9b19('0x77')]=intUtil['stripTrailingSlash'](_0x152419[_0x9b19('0x77')]);if(_0x5dabc2&&_0x5dabc2['monitor_format']){logger[_0x9b19('0x2d')]('['+_0x3d6656[_0x9b19('0x64')][_0x9b19('0x8e')]()+']',_0x9b19('0x7b'));_0x3d6656[_0x9b19('0x7c')]=_0x152419[_0x9b19('0x77')]+_0x9b19('0x7d')+_0x3d6656[_0x9b19('0x7e')]+_0x9b19('0x8f')+md5(_0x3d6656[_0x9b19('0x7e')]);}else{_0x3d6656[_0x9b19('0x7c')]='';}var _0x2eb9d8=_0x152419['host']===_0x9b19('0x7f')?'eu':_0x9b19('0x80');return getAccessToken(_0x152419)['then'](function(_0x3400f5){_0x8fe088=_0x3400f5;return getUser(_0x8fe088,_0x2eb9d8,_0x152419);})[_0x9b19('0x27')](function(_0x12e285){_0x2e4fab=_0x12e285;logger[_0x9b19('0x2d')](_0x9b19('0x81'),_0x2e4fab['id']);return getEndUser(_0x8fe088,_0x2eb9d8,_0x152419,_0x3d6656[_0x9b19('0x82')],_0x3d6656['calleridnum'],_0x2e4fab,_0x4057d5);})[_0x9b19('0x27')](function(_0x438df0){_0x413cbe=_0x438df0;return getCall(_0x8fe088,_0x2eb9d8,_0x152419,_0x2e4fab,_0x413cbe,_0x4057d5,_0x3d6656,_0x9b19('0x70'));})['then'](function(_0x3f716f){if(_0x3f716f){logger[_0x9b19('0x2d')](_0x9b19('0x84'),_0x3f716f['id']);}})[_0x9b19('0x2a')](function(_0x2ce9ee){logger[_0x9b19('0x2b')]('['+_0x3d6656[_0x9b19('0x64')][_0x9b19('0x8e')]()+']',JSON[_0x9b19('0xe')](_0x2ce9ee));});}; \ No newline at end of file +var _0x6a5f=['/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','com','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','calleridnum','lodash','request-promise','util','./util','ioredis','../../../../config/logger','defaults','localhost','socket.io-emitter','redis','emit','debug','stringify','length','forEach','string','idField','content','type','variableName','toString','customVariable','Variable','name','toLowerCase','split','isNil','access_token','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','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','email','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','then','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','enduserType','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','contact','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','utc','format','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Call_Result','Called','connect','Answered','rejected','Rejected','Abandoned','timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','Fields'];(function(_0x2f0519,_0x12ab67){var _0x1bcd06=function(_0x2e2c7e){while(--_0x2e2c7e){_0x2f0519['push'](_0x2f0519['shift']());}};_0x1bcd06(++_0x12ab67);}(_0x6a5f,0xbb));var _0xf6a5=function(_0x5b02ff,_0x4ce260){_0x5b02ff=_0x5b02ff-0x0;var _0xfe3187=_0x6a5f[_0x5b02ff];return _0xfe3187;};'use strict';var _=require(_0xf6a5('0x0'));var rp=require(_0xf6a5('0x1'));var md5=require('md5');var util=require(_0xf6a5('0x2'));var intUtil=require(_0xf6a5('0x3'));var moment=require('moment');var Redis=require(_0xf6a5('0x4'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0xf6a5('0x5'))('zoho');config['redis']=_[_0xf6a5('0x6')](config['redis'],{'host':_0xf6a5('0x7'),'port':0x18eb});var io=require(_0xf6a5('0x8'))(new Redis(config[_0xf6a5('0x9')]));function emit(_0x1e3360,_0x19facf,_0x476e35){io['to'](_0x1e3360)[_0xf6a5('0xa')](_0x19facf,_0x476e35);}function request(_0x3eaf83){logger[_0xf6a5('0xb')]('[HTTP]',JSON[_0xf6a5('0xc')](_0x3eaf83));return rp(_0x3eaf83);}function getCustomFields(_0x148158,_0x348de4){var _0x4673b2={};if(_0x148158[_0xf6a5('0xd')]>0x0){_[_0xf6a5('0xe')](_0x148158,function(_0x99fbf2){if(_0x99fbf2['type']===_0xf6a5('0xf')&&_0x99fbf2[_0xf6a5('0x10')]){_0x4673b2[_0x99fbf2[_0xf6a5('0x10')]]=_0x99fbf2[_0xf6a5('0x11')]['toString']();}else if(_0x99fbf2[_0xf6a5('0x12')]==='variable'&&_0x99fbf2['variableName']&&_0x99fbf2[_0xf6a5('0x10')]&&_0x348de4[_0x99fbf2[_0xf6a5('0x13')]]){_0x4673b2[_0x99fbf2['idField']]=_0x348de4[_0x99fbf2[_0xf6a5('0x13')]][_0xf6a5('0x14')]();}else if(_0x99fbf2[_0xf6a5('0x12')]===_0xf6a5('0x15')&&_0x99fbf2[_0xf6a5('0x16')]&&_0x99fbf2[_0xf6a5('0x16')][_0xf6a5('0x17')]&&_0x99fbf2['idField']&&_0x348de4[_0x99fbf2[_0xf6a5('0x16')]['name']['toLowerCase']()]){_0x4673b2[_0x99fbf2[_0xf6a5('0x10')]]=_0x348de4[_0x99fbf2[_0xf6a5('0x16')][_0xf6a5('0x17')][_0xf6a5('0x18')]()][_0xf6a5('0x14')]();}});}return _0x4673b2;}function getName(_0x4140bd){if(_0x4140bd['indexOf']('\x20')>0x0){var _0x537dbb=_0x4140bd[_0xf6a5('0x19')](/ (.+)/);if(_0x537dbb[0x1]){return _0x537dbb;}}return[_0x4140bd,_0x4140bd];}var accountsTokens={};function getAccessToken(_0x2d1cc8){return new Promise(function(_0x5b9945,_0x2baeca){if(!_['isNil'](accountsTokens[_0x2d1cc8['id']])&&!_[_0xf6a5('0x1a')](accountsTokens[_0x2d1cc8['id']][_0xf6a5('0x1b')])){if(moment()['isBefore'](accountsTokens[_0x2d1cc8['id']]['expires_in'])){_0x5b9945(accountsTokens[_0x2d1cc8['id']][_0xf6a5('0x1b')]);}}var _0x504b35;switch(_0x2d1cc8[_0xf6a5('0x1c')]){case'US':_0x504b35=_0xf6a5('0x1d');break;case'AU':_0x504b35=_0xf6a5('0x1e');break;case'EU':_0x504b35=_0xf6a5('0x1f');break;case'IN':_0x504b35=_0xf6a5('0x20');break;case'CN':_0x504b35=_0xf6a5('0x21');break;default:_0x504b35=_0xf6a5('0x1f');break;}var _0x812231={'method':_0xf6a5('0x22'),'uri':_0x504b35+_0xf6a5('0x23'),'qs':{'refresh_token':_0x2d1cc8[_0xf6a5('0x24')],'client_id':_0x2d1cc8[_0xf6a5('0x25')],'client_secret':_0x2d1cc8[_0xf6a5('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x812231)['then'](function(_0x15b4e1){accountsTokens[_0x2d1cc8['id']]={'access_token':_0x15b4e1[_0xf6a5('0x1b')],'expires_in':moment()[_0xf6a5('0x27')](_0x15b4e1[_0xf6a5('0x28')],_0xf6a5('0x29'))};_0x5b9945(_0x15b4e1[_0xf6a5('0x1b')]);})[_0xf6a5('0x2a')](function(_0x4cf574){logger[_0xf6a5('0x2b')](_0xf6a5('0x2c'),_0x4cf574[_0xf6a5('0x2d')]);_0x2baeca(_0x4cf574);});});}function getUser(_0x4a6003,_0x2ef1ca,_0x3f5be9,_0x547cd2){logger[_0xf6a5('0x2e')](_0xf6a5('0x2f'));return request({'method':_0xf6a5('0x30'),'uri':util['format'](_0xf6a5('0x31'),_0x2ef1ca),'qs':{'type':_0xf6a5('0x32')},'headers':{'Authorization':_0xf6a5('0x33')+_0x4a6003},'json':!![]})['then'](function(_0x3034fd){if(_0x3034fd[_0xf6a5('0x34')]){var _0xde005f=-0x1;if(_['isArrayLikeObject'](_0x3034fd['users'])){if(!_[_0xf6a5('0x1a')](_0x547cd2)){_0xde005f=_['findIndex'](_0x3034fd['users'],function(_0x1cb71c){return _0x1cb71c[_0xf6a5('0x35')]===_0x547cd2;});}if(_0xde005f>=0x0){logger['info']('Agent\x20found!');}else{logger['info'](_0xf6a5('0x36'));_0xde005f=_['findIndex'](_0x3034fd[_0xf6a5('0x34')],function(_0x1329c5){return _0x1329c5['profile'][_0xf6a5('0x17')]===_0xf6a5('0x37');});}return _0x3034fd['users'][_0xde005f];}else{if(_0x3034fd[_0xf6a5('0x38')][_0xf6a5('0x39')]['name']===_0xf6a5('0x37')){logger['info'](_0xf6a5('0x36'));user=_0x3034fd[_0xf6a5('0x38')];return user;}else{logger[_0xf6a5('0x2b')](_0xf6a5('0x3a'),JSON[_0xf6a5('0xc')](_0x3034fd));throw new Error(_0xf6a5('0x3b')+JSON[_0xf6a5('0xc')](_0x3034fd));}}}else{logger['error'](_0xf6a5('0x3a'),JSON[_0xf6a5('0xc')](_0x3034fd));throw new Error(_0xf6a5('0x3b')+JSON['stringify'](_0x3034fd));}})['catch'](function(_0x33981e){console[_0xf6a5('0x2b')](_0x33981e);});}function getZohoUser(_0x3e271c,_0x33e620){return new BPromise(function(_0x44b234,_0x4e20c7){request(_0x3e271c)[_0xf6a5('0x3c')](function(_0x211a6b){var _0x37ef7c=null;if(_0x211a6b){_0x37ef7c=_0x211a6b[_0xf6a5('0x3d')][0x0];_0x37ef7c['enduserType']=_0x33e620;}_0x44b234(_0x37ef7c);})[_0xf6a5('0x2a')](function(_0x1b9b26){_0x4e20c7(_0x1b9b26);});});}function createEndUser(_0x442bbe,_0x529c89,_0x5681ce,_0x22cd6e,_0x59b5dd,_0x52c024){var _0x5681ce=getName(_0x5681ce);return request({'method':_0xf6a5('0x22'),'uri':_0xf6a5('0x3e')+_0x529c89+_0xf6a5('0x3f')+_[_0xf6a5('0x40')](_0x52c024[_0xf6a5('0x41')])+'s','body':{'data':[{'Last_Name':_0x5681ce[0x1],'First_Name':_0x5681ce[0x0],'Phone':_0x22cd6e,'Owner':{'name':!_[_0xf6a5('0x1a')](_0x59b5dd[_0xf6a5('0x42')][_0xf6a5('0x17')])?_0x59b5dd[_0xf6a5('0x42')]['name']:!_['isNil'](_0x59b5dd['first_name'])?_0x59b5dd[_0xf6a5('0x43')]+'\x20'+_0x59b5dd[_0xf6a5('0x44')]:_0x59b5dd[_0xf6a5('0x44')],'id':_0x59b5dd['id']}}]},'headers':{'Authorization':_0xf6a5('0x33')+_0x442bbe},'json':!![]})[_0xf6a5('0x3c')](function(_0x3161a9){if(_0x3161a9&&_0x3161a9[_0xf6a5('0x3d')][0x0]['code']===_0xf6a5('0x45')){var _0x1b01dd=_0x3161a9['data'][0x0][_0xf6a5('0x46')];_0x1b01dd[_0xf6a5('0x47')]=_[_0xf6a5('0x40')](_0x52c024['moduleCreate'])+'s';return _0x1b01dd;}logger[_0xf6a5('0x2b')](_0xf6a5('0x3a'),JSON[_0xf6a5('0xc')](data));throw new Error(_0xf6a5('0x48')+JSON['stringify'](data));})[_0xf6a5('0x2a')](function(_0xdfde3f){console[_0xf6a5('0x49')](_0xf6a5('0x4a'),_0xdfde3f);});}function getEndUser(_0x201b70,_0x2abd03,_0x390634,_0x96cf75,_0x1a577f,_0xf6322,_0x2701a3){var _0x4da677={'method':_0xf6a5('0x30'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x201b70},'json':!![]};switch(_0x2701a3[_0xf6a5('0x4b')]){case _0xf6a5('0x4c'):_0x4da677[_0xf6a5('0x4d')]=_0xf6a5('0x3e')+_0x2abd03+_0xf6a5('0x4e')+_0x1a577f+'))';return getZohoUser(_0x4da677,_0xf6a5('0x4f'))[_0xf6a5('0x3c')](function(_0x3c042b){if(_0x3c042b)return _0x3c042b;_0x4da677[_0xf6a5('0x4d')]='https://www.zohoapis.'+_0x2abd03+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1a577f+'))';return getZohoUser(_0x4da677,_0xf6a5('0x50'))[_0xf6a5('0x3c')](function(_0x17f392){if(_0x17f392)return _0x17f392;if(_0x2701a3[_0xf6a5('0x41')]!='nothing'){return createEndUser(_0x201b70,_0x2abd03,_0x96cf75,_0x1a577f,_0xf6322,_0x2701a3);}else{return{};}});});break;case _0xf6a5('0x51'):_0x4da677[_0xf6a5('0x4d')]=_0xf6a5('0x3e')+_0x2abd03+_0xf6a5('0x4e')+_0x1a577f+'))';return getZohoUser(_0x4da677,_0xf6a5('0x4f'))['then'](function(_0x494be7){if(_0x494be7)return _0x494be7;if(_0x2701a3[_0xf6a5('0x41')]!=_0xf6a5('0x52')){return createEndUser(_0x201b70,_0x2abd03,_0x96cf75,_0x1a577f,_0xf6322,_0x2701a3);}else{return{};}});break;case _0xf6a5('0x53'):_0x4da677[_0xf6a5('0x4d')]='https://www.zohoapis.'+_0x2abd03+_0xf6a5('0x54')+_0x1a577f+'))';return getZohoUser(_0x4da677,_0xf6a5('0x50'))['then'](function(_0x391f62){if(_0x391f62)return _0x391f62;if(_0x2701a3[_0xf6a5('0x41')]!=_0xf6a5('0x52')){return createEndUser(_0x201b70,_0x2abd03,_0x96cf75,_0x1a577f,_0xf6322,_0x2701a3);}else{return{};}});break;}}function getCall(_0x2f1955,_0x569aca,_0x5416b5,_0x1a96a7,_0x42cc21,_0x4f14e3,_0x40bfdb,_0x4c9999){logger[_0xf6a5('0x2e')]('Creating\x20new\x20call...');var _0x143c6f={};_0x143c6f['Owner']={'name':!_[_0xf6a5('0x1a')](_0x1a96a7[_0xf6a5('0x42')][_0xf6a5('0x17')])&&!_[_0xf6a5('0x1a')](_0x1a96a7['profile']['name'])&&_0x1a96a7['profile'][_0xf6a5('0x17')]===_0xf6a5('0x55')?_0x1a96a7[_0xf6a5('0x42')]['name']:!_['isNil'](_0x1a96a7[_0xf6a5('0x43')])?_0x1a96a7['first_name']+'\x20'+_0x1a96a7[_0xf6a5('0x44')]:_0x1a96a7[_0xf6a5('0x44')],'id':_0x1a96a7['id']};_0x143c6f[_0xf6a5('0x56')]=intUtil[_0xf6a5('0x57')](_0x4f14e3[_0xf6a5('0x58')],_0x40bfdb,'\x20');_0x143c6f[_0xf6a5('0x59')]=intUtil[_0xf6a5('0x57')](_0x4f14e3[_0xf6a5('0x5a')],_0x40bfdb,'\x0a');if(_0x42cc21['enduserType']==='Contacts'){_0x143c6f[_0xf6a5('0x5b')]={'name':!_['isNil'](_0x42cc21[_0xf6a5('0x5c')])?_0x42cc21[_0xf6a5('0x5c')]:!_[_0xf6a5('0x1a')](_0x42cc21['First_Name'])?_0x42cc21[_0xf6a5('0x5d')]+'\x20'+_0x42cc21[_0xf6a5('0x5e')]:_0x42cc21[_0xf6a5('0x5e')],'id':_0x42cc21['id']};}if(_0x42cc21[_0xf6a5('0x47')]===_0xf6a5('0x50')){_0x143c6f['What_Id']={'name':!_[_0xf6a5('0x1a')](_0x42cc21[_0xf6a5('0x5c')])?_0x42cc21[_0xf6a5('0x5c')]:!_['isNil'](_0x42cc21['First_Name'])?_0x42cc21[_0xf6a5('0x5d')]+'\x20'+_0x42cc21[_0xf6a5('0x5e')]:_0x42cc21[_0xf6a5('0x5e')],'id':_0x42cc21['id']};_0x143c6f[_0xf6a5('0x5f')]=_[_0xf6a5('0x40')](_0x42cc21[_0xf6a5('0x47')]);}if(_0x40bfdb[_0xf6a5('0x60')]){_0x143c6f['Call_Duration']=moment[_0xf6a5('0x61')](parseInt(_0x40bfdb[_0xf6a5('0x60')])*0x3e8)[_0xf6a5('0x62')](_0xf6a5('0x63'));}else if(_0x40bfdb[_0xf6a5('0x64')]&&_0x40bfdb[_0xf6a5('0x65')]){_0x143c6f[_0xf6a5('0x66')]=moment[_0xf6a5('0x61')](moment(_0x40bfdb[_0xf6a5('0x65')],_0xf6a5('0x67'))[_0xf6a5('0x68')](moment(_0x40bfdb['starttime'],_0xf6a5('0x67'))))[_0xf6a5('0x62')](_0xf6a5('0x63'));}switch(_0x40bfdb[_0xf6a5('0x69')]){case _0xf6a5('0x6a'):_0x143c6f[_0xf6a5('0x6b')]=_0xf6a5('0x6c');break;case'complete':case _0xf6a5('0x6d'):_0x143c6f['Call_Result']=_0xf6a5('0x6e');break;case _0xf6a5('0x6f'):_0x143c6f[_0xf6a5('0x6b')]=_0xf6a5('0x70');break;case'abandoned':_0x143c6f[_0xf6a5('0x6b')]=_0xf6a5('0x71');break;case _0xf6a5('0x72'):_0x143c6f[_0xf6a5('0x6b')]='Timeout';default:}_0x143c6f[_0xf6a5('0x73')]=(_0x4c9999===_0xf6a5('0x74')?moment(_0x40bfdb[_0xf6a5('0x75')])[_0xf6a5('0x62')](_0xf6a5('0x67')):moment(_0x40bfdb[_0xf6a5('0x76')])[_0xf6a5('0x62')](_0xf6a5('0x67')))||moment()[_0xf6a5('0x62')](_0xf6a5('0x67'));_0x143c6f[_0xf6a5('0x77')]=_0x4c9999||_0xf6a5('0x78');_0x143c6f=_[_0xf6a5('0x79')](_0x143c6f,getCustomFields(_0x4f14e3[_0xf6a5('0x7a')],_0x40bfdb));return request({'method':_0xf6a5('0x22'),'uri':_0xf6a5('0x3e')+_0x569aca+_0xf6a5('0x7b'),'headers':{'Authorization':_0xf6a5('0x33')+_0x2f1955},'body':{'data':[_0x143c6f]},'json':!![]})['then'](function(_0x47e329){if(_0x47e329&&_0x47e329['data'][0x0]['code']===_0xf6a5('0x45')){logger[_0xf6a5('0x2e')](_0xf6a5('0x7c'));return{'id':_0x47e329['data'][0x0][_0xf6a5('0x46')]['id']};}})[_0xf6a5('0x2a')](function(_0x4ead82){logger['info'](_0xf6a5('0x7d'),_0x4ead82[_0xf6a5('0x2d')]);console[_0xf6a5('0x49')](_0xf6a5('0x7d'),_0x4ead82);});}exports['queue']=function(_0xc4e248,_0xda0f2,_0x388efb,_0x11f043,_0x3ee7a3,_0xa36168){var _0x2032d6,_0x20bfcc,_0x1108f5;_0xa36168[_0xf6a5('0x7e')]=intUtil[_0xf6a5('0x7f')](_0xa36168[_0xf6a5('0x7e')]);_0xa36168[_0xf6a5('0x80')]=intUtil[_0xf6a5('0x7f')](_0xa36168[_0xf6a5('0x80')]);if(_0x3ee7a3&&_0x3ee7a3[_0xf6a5('0x81')]){logger[_0xf6a5('0x2e')](_0xf6a5('0x82'),_0xf6a5('0x83'));_0xda0f2['recordingURL']=_0xa36168[_0xf6a5('0x80')]+_0xf6a5('0x84')+_0xda0f2[_0xf6a5('0x85')]+_0xf6a5('0x86')+md5(_0xda0f2[_0xf6a5('0x85')]);}else{_0xda0f2[_0xf6a5('0x87')]='';}var _0x40bf6b=_0xa36168['host']===_0xf6a5('0x88')?'eu':'com';return getAccessToken(_0xa36168)[_0xf6a5('0x3c')](function(_0x49c361){_0x1108f5=_0x49c361;return getUser(_0x1108f5,_0x40bf6b,_0xa36168,_0x11f043[_0xf6a5('0x35')]);})[_0xf6a5('0x3c')](function(_0x31e4b3){_0x2032d6=_0x31e4b3;logger[_0xf6a5('0x2e')](_0xf6a5('0x89'),_0x2032d6['id']);return getEndUser(_0x1108f5,_0x40bf6b,_0xa36168,_0xda0f2[_0xf6a5('0x8a')],_0xda0f2['calleridnum'],_0x2032d6,_0x388efb);})['then'](function(_0x67c183){_0x20bfcc=_0x67c183;return getCall(_0x1108f5,_0x40bf6b,_0xa36168,_0x2032d6,_0x20bfcc,_0x388efb,_0xda0f2,_0xf6a5('0x78'));})[_0xf6a5('0x3c')](function(_0x65c897){if(_0x65c897){logger['info'](_0xf6a5('0x8b'),_0x65c897['id']);logger[_0xf6a5('0x2e')](_0xf6a5('0x82'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf6a5('0x62')](_0xf6a5('0x8c'),_0x11f043[_0xf6a5('0x17')]),_0xf6a5('0x8d'),{'uri':_0xf6a5('0x8e')+_0xa36168[_0xf6a5('0x7e')]+_0xf6a5('0x8f')+_0x65c897['id']});}})[_0xf6a5('0x2a')](function(_0x62684a){logger[_0xf6a5('0x2b')](_0xf6a5('0x82'),JSON[_0xf6a5('0xc')](_0x62684a));});};exports[_0xf6a5('0x74')]=function(_0x288a13,_0x255f46,_0x425717,_0x4cb8aa,_0x1ac159,_0x574218,_0x5a5344){var _0x4f00d5,_0x133c7f,_0xb1d34;_0x574218[_0xf6a5('0x7e')]=intUtil[_0xf6a5('0x7f')](_0x574218[_0xf6a5('0x7e')]);_0x574218[_0xf6a5('0x80')]=intUtil['stripTrailingSlash'](_0x574218[_0xf6a5('0x80')]);if(_0x5a5344&&_0x5a5344[_0xf6a5('0x90')]&&_0x5a5344[_0xf6a5('0x90')]!==_0xf6a5('0x91')){logger[_0xf6a5('0x2e')]('[OUTBOUND]',_0xf6a5('0x83'));_0x255f46[_0xf6a5('0x87')]=_0x574218['serverUrl']+_0xf6a5('0x84')+_0x255f46[_0xf6a5('0x85')]+_0xf6a5('0x86')+md5(_0x255f46[_0xf6a5('0x85')]);}var _0x351efb=_0x574218['host']===_0xf6a5('0x88')?'eu':_0xf6a5('0x92');return getAccessToken(_0x574218)['then'](function(_0x5e8964){_0xb1d34=_0x5e8964;return getUser(_0xb1d34,_0x351efb,_0x574218,_0x4cb8aa[_0xf6a5('0x35')]);})[_0xf6a5('0x3c')](function(_0x53f836){_0x4f00d5=_0x53f836;logger[_0xf6a5('0x2e')](_0xf6a5('0x89'),_0x4f00d5['id']);return getEndUser(_0xb1d34,_0x351efb,_0x574218,_0x255f46[_0xf6a5('0x93')],_0x255f46[_0xf6a5('0x94')],_0x4f00d5,_0x425717);})['then'](function(_0xc393c5){_0x133c7f=_0xc393c5;return getCall(_0xb1d34,_0x351efb,_0x574218,_0x4f00d5,_0x133c7f,_0x425717,_0x255f46,_0xf6a5('0x95'));})['then'](function(_0x8922ec){if(_0x8922ec){logger[_0xf6a5('0x2e')](_0xf6a5('0x8b'),_0x8922ec['id']);logger[_0xf6a5('0x2e')](_0xf6a5('0x96'),_0xf6a5('0x97'));emit(util[_0xf6a5('0x62')](_0xf6a5('0x8c'),_0x4cb8aa[_0xf6a5('0x17')]),_0xf6a5('0x8d'),{'uri':_0xf6a5('0x8e')+_0x574218[_0xf6a5('0x7e')]+_0xf6a5('0x8f')+_0x8922ec['id']});}})[_0xf6a5('0x2a')](function(_0x4213ef){logger[_0xf6a5('0x2b')]('[OUTBOUND]',JSON[_0xf6a5('0xc')](_0x4213ef));});};exports[_0xf6a5('0x98')]=function(_0x4ee0dc,_0x435df2,_0xb1dd22,_0xe60f86,_0xb32285,_0x1cb89b){var _0x5266c8,_0x22d59f,_0x31faba;_0x1cb89b['host']=intUtil['stripTrailingSlash'](_0x1cb89b[_0xf6a5('0x7e')]);_0x1cb89b['serverUrl']=intUtil['stripTrailingSlash'](_0x1cb89b[_0xf6a5('0x80')]);if(_0xb32285&&_0xb32285[_0xf6a5('0x81')]){logger[_0xf6a5('0x2e')]('['+_0x435df2[_0xf6a5('0x69')][_0xf6a5('0x99')]()+']','Recording\x20is\x20enabled!');_0x435df2[_0xf6a5('0x87')]=_0x1cb89b[_0xf6a5('0x80')]+_0xf6a5('0x84')+_0x435df2[_0xf6a5('0x85')]+_0xf6a5('0x86')+md5(_0x435df2[_0xf6a5('0x85')]);}else{_0x435df2['recordingURL']='';}var _0x2ea23a=_0x1cb89b['host']==='zoho.eu'?'eu':_0xf6a5('0x92');return getAccessToken(_0x1cb89b)['then'](function(_0x4ea496){_0x31faba=_0x4ea496;return getUser(_0x31faba,_0x2ea23a,_0x1cb89b);})[_0xf6a5('0x3c')](function(_0x128204){_0x5266c8=_0x128204;logger[_0xf6a5('0x2e')](_0xf6a5('0x89'),_0x5266c8['id']);return getEndUser(_0x31faba,_0x2ea23a,_0x1cb89b,_0x435df2['calleridname'],_0x435df2[_0xf6a5('0x9a')],_0x5266c8,_0xb1dd22);})[_0xf6a5('0x3c')](function(_0x6a353e){_0x22d59f=_0x6a353e;return getCall(_0x31faba,_0x2ea23a,_0x1cb89b,_0x5266c8,_0x22d59f,_0xb1dd22,_0x435df2,'Inbound');})['then'](function(_0x14ed68){if(_0x14ed68){logger[_0xf6a5('0x2e')](_0xf6a5('0x8b'),_0x14ed68['id']);}})['catch'](function(_0x17396b){logger[_0xf6a5('0x2b')]('['+_0x435df2[_0xf6a5('0x69')][_0xf6a5('0x99')]()+']',JSON[_0xf6a5('0xc')](_0x17396b));});}; \ 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 71e964e..9c35e5e 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(_0x4867e9,_0x2afddc){var _0x35f715=function(_0x57650c){while(--_0x57650c){_0x4867e9['push'](_0x4867e9['shift']());}};_0x35f715(++_0x2afddc);}(_0x7a54,0x106));var _0x47a5=function(_0x2ef8c9,_0x3f6d7c){_0x2ef8c9=_0x2ef8c9-0x0;var _0x1aaa45=_0x7a54[_0x2ef8c9];return _0x1aaa45;};'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(_0x1390fb,_0x4bcf9c){var _0x2f5992=function(_0x45c484){while(--_0x45c484){_0x1390fb['push'](_0x1390fb['shift']());}};_0x2f5992(++_0x4bcf9c);}(_0x7a54,0x106));var _0x47a5=function(_0x74f8a1,_0x4f5f3c){_0x74f8a1=_0x74f8a1-0x0;var _0x42d37c=_0x7a54[_0x74f8a1];return _0x42d37c;};'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 94fa77c..76df94d 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x5650f2,_0xef79fe){var _0x28049d=function(_0x5070e6){while(--_0x5070e6){_0x5650f2['push'](_0x5650f2['shift']());}};_0x28049d(++_0xef79fe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x48bc79,_0xe4b766){_0x48bc79=_0x48bc79-0x0;var _0x2f2bf2=_0x5f2f[_0x48bc79];return _0x2f2bf2;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x3113a5,_0x3941f7){var _0x6923e5=function(_0x4749d3){while(--_0x4749d3){_0x3113a5['push'](_0x3113a5['shift']());}};_0x6923e5(++_0x3941f7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a574c,_0x97e146){_0x4a574c=_0x4a574c-0x0;var _0xc20a44=_0x5f2f[_0x4a574c];return _0xc20a44;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index f44097a..61297e1 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 _0xde64=['client','http','request','then','rpc','error','message','catch','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x47a261,_0x6d2b0b){var _0x2254ec=function(_0x5ed2da){while(--_0x5ed2da){_0x47a261['push'](_0x47a261['shift']());}};_0x2254ec(++_0x6d2b0b);}(_0xde64,0x17c));var _0x4de6=function(_0x1dc9a4,_0x3beafe){_0x1dc9a4=_0x1dc9a4-0x0;var _0x4977db=_0xde64[_0x1dc9a4];return _0x4977db;};'use strict';var jayson=require(_0x4de6('0x0'));var BPromise=require(_0x4de6('0x1'));var logger=require(_0x4de6('0x2'))(_0x4de6('0x3'));var client=jayson[_0x4de6('0x4')][_0x4de6('0x5')]({'port':0x2329});client['Request']=function(_0x3c4b91,_0x3bd290){return new BPromise(function(_0x5a5c5a,_0x529726){return client[_0x4de6('0x6')](_0x3c4b91,_0x3bd290)[_0x4de6('0x7')](function(_0x4da17f){logger['debug'](_0x4de6('0x8'),_0x4de6('0x3'),_0x3c4b91,_0x3bd290,_0x4da17f);if(_0x4da17f[_0x4de6('0x9')]){logger[_0x4de6('0x9')](_0x4de6('0x8'),_0x4de6('0x3'),_0x3c4b91,_0x4da17f['error'][_0x4de6('0xa')],_0x3bd290);return _0x529726(_0x4da17f[_0x4de6('0x9')][_0x4de6('0xa')]);}else{return _0x5a5c5a(_0x4da17f['result']);}})[_0x4de6('0xb')](function(_0x170183){logger[_0x4de6('0x9')](_0x4de6('0x8'),_0x4de6('0x3'),_0x3c4b91,_0x170183,_0x3bd290);return _0x529726(_0x170183);});});};module['exports']=client; \ No newline at end of file +var _0xe107=['client','Request','request','debug','rpc','error','message','result','catch','exports','jayson/promise','../../config/logger','routing'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe107,0xb3));var _0x7e10=function(_0x3087a3,_0xd5e3ad){_0x3087a3=_0x3087a3-0x0;var _0x91e71f=_0xe107[_0x3087a3];return _0x91e71f;};'use strict';var jayson=require(_0x7e10('0x0'));var BPromise=require('bluebird');var logger=require(_0x7e10('0x1'))(_0x7e10('0x2'));var client=jayson[_0x7e10('0x3')]['http']({'port':0x2329});client[_0x7e10('0x4')]=function(_0x56db00,_0x4db676){return new BPromise(function(_0x2bdf3c,_0x46e807){return client[_0x7e10('0x5')](_0x56db00,_0x4db676)['then'](function(_0x5f1edf){logger[_0x7e10('0x6')](_0x7e10('0x7'),_0x7e10('0x2'),_0x56db00,_0x4db676,_0x5f1edf);if(_0x5f1edf[_0x7e10('0x8')]){logger['error']('rpc',_0x7e10('0x2'),_0x56db00,_0x5f1edf['error']['message'],_0x4db676);return _0x46e807(_0x5f1edf[_0x7e10('0x8')][_0x7e10('0x9')]);}else{return _0x2bdf3c(_0x5f1edf[_0x7e10('0xa')]);}})[_0x7e10('0xb')](function(_0x256cb1){logger['error'](_0x7e10('0x7'),'routing',_0x56db00,_0x256cb1,_0x4db676);return _0x46e807(_0x256cb1);});});};module[_0x7e10('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 416fb07..501546d 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 _0xc15b=['bluebird','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','getMailAccounts','then','initMailAccounts','listen','findOne','loginMailFrequency','log'];(function(_0x4d9ea1,_0x164c30){var _0x8a5bc4=function(_0x103064){while(--_0x103064){_0x4d9ea1['push'](_0x4d9ea1['shift']());}};_0x8a5bc4(++_0x164c30);}(_0xc15b,0xe4));var _0xbc15=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xc15b[_0x209941];return _0x1e8729;};'use strict';var BPromise=require(_0xbc15('0x0'));var server=require('./server');var Realtime=require(_0xbc15('0x1'));var EmailChannel=require(_0xbc15('0x2'));var mailAccount=require(_0xbc15('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xbc15('0x4'))['db'];function initRealtime(){return BPromise['resolve']()['then'](mailAccount[_0xbc15('0x5')]())[_0xbc15('0x6')](realtime[_0xbc15('0x7')]())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xbc15('0x8')](realtime,email)[_0xbc15('0x6')](function(_0x3cb4b5){return initRealtime();})['then'](function(_0x5c6269){return db['Setting'][_0xbc15('0x9')]({'attributes':['id','loginMailFrequency'],'raw':!![]});})[_0xbc15('0x6')](function(_0x42f0b9){return setInterval(initRealtime,_0x42f0b9[_0xbc15('0xa')]*0x3e8);})['catch'](function(_0x413eda){console[_0xbc15('0xb')](_0x413eda);});}main(); \ No newline at end of file +var _0xf23b=['log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch'];(function(_0x1c9a2f,_0x42208a){var _0x8eebbc=function(_0x28fca6){while(--_0x28fca6){_0x1c9a2f['push'](_0x1c9a2f['shift']());}};_0x8eebbc(++_0x42208a);}(_0xf23b,0x133));var _0xbf23=function(_0x549d51,_0x2c469a){_0x549d51=_0x549d51-0x0;var _0x40fa44=_0xf23b[_0x549d51];return _0x40fa44;};'use strict';var BPromise=require(_0xbf23('0x0'));var server=require(_0xbf23('0x1'));var Realtime=require(_0xbf23('0x2'));var EmailChannel=require(_0xbf23('0x3'));var mailAccount=require(_0xbf23('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0xbf23('0x5')]()[_0xbf23('0x6')](mailAccount[_0xbf23('0x7')]())['then'](realtime[_0xbf23('0x8')]())[_0xbf23('0x6')](function(){email[_0xbf23('0x9')](realtime[_0xbf23('0xa')]);return realtime;});}function main(){return server[_0xbf23('0xb')](realtime,email)['then'](function(_0x4b5e1e){return initRealtime();})[_0xbf23('0x6')](function(_0x486c02){return db[_0xbf23('0xc')][_0xbf23('0xd')]({'attributes':['id',_0xbf23('0xe')],'raw':!![]});})[_0xbf23('0x6')](function(_0x16e09c){return setInterval(initRealtime,_0x16e09c['loginMailFrequency']*0x3e8);})[_0xbf23('0xf')](function(_0x1d372c){console[_0xbf23('0x10')](_0x1d372c);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 95bce01..4f2452d 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 _0x1215=['total','isNil','emit','refresh','hasOwnProperty','email','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','status','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','then','Mail\x20accepted\x20from\x20routing','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','catch','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','key','active','Imap','messageStatus'];(function(_0x47f732,_0x1f38bc){var _0xf080de=function(_0x3bf80b){while(--_0x3bf80b){_0x47f732['push'](_0x47f732['shift']());}};_0xf080de(++_0x1f38bc);}(_0x1215,0x86));var _0x5121=function(_0x578062,_0x2858e9){_0x578062=_0x578062-0x0;var _0x2ba7f5=_0x1215[_0x578062];return _0x2ba7f5;};'use strict';var _=require('lodash');var moment=require(_0x5121('0x0'));var BPromise=require(_0x5121('0x1'));var md5=require(_0x5121('0x2'));var Redis=require(_0x5121('0x3'));var config=require(_0x5121('0x4'));var logger=require(_0x5121('0x5'))('email');config[_0x5121('0x6')]=_[_0x5121('0x7')](config[_0x5121('0x6')],{'host':_0x5121('0x8'),'port':0x18eb});var io=require(_0x5121('0x9'))(new Redis(config[_0x5121('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x5121('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3bd229){logger[_0x5121('0xb')](_0x5121('0xc'));this[_0x5121('0xd')]=_0x3bd229[_0x5121('0xd')];this[_0x5121('0xe')]={};this[_0x5121('0xf')]=new EmailSmtp();}EmailChannel[_0x5121('0x10')]['emit']=function(_0x38f0a5){var _0x4c4417=this[_0x5121('0xd')][_0x38f0a5];var _0x2190b7={'id':_0x4c4417['id'],'name':_0x4c4417[_0x5121('0x11')],'key':_0x4c4417[_0x5121('0x12')],'active':_0x4c4417[_0x5121('0x13')],'Imap':{'status':_0x4c4417[_0x5121('0x14')]['status'],'messageStatus':_0x4c4417[_0x5121('0x14')][_0x5121('0x15')],'total':_0x4c4417['Imap'][_0x5121('0x16')]}};if(_[_0x5121('0x17')](md5Accounts[_0x38f0a5])){md5Accounts[_0x38f0a5]={};}var _0xff9f3f=md5(JSON['stringify'](_0x2190b7));if(md5Accounts[_0x38f0a5][_0x5121('0x2')]!==_0xff9f3f){md5Accounts[_0x38f0a5][_0x5121('0x2')]=_0xff9f3f;io[_0x5121('0x18')]('mailAccount:update',_0x2190b7);}};EmailChannel[_0x5121('0x10')][_0x5121('0x19')]=function(_0x65cada){for(var _0x50939d in _0x65cada){if(_0x65cada[_0x5121('0x1a')](_0x50939d)){if(_0x65cada[_0x50939d][_0x5121('0x14')]&&_0x65cada[_0x50939d][_0x5121('0x13')]){var _0x45cbde=_0x65cada[_0x50939d][_0x5121('0x14')];if(!this['imapAccounts'][_0x5121('0x1a')](_0x45cbde['id'])){this['imapAccounts'][_0x45cbde['id']]=new EmailImap(_0x45cbde,_0x65cada[_0x50939d][_0x5121('0x1b')]);this[_0x5121('0xe')][_0x45cbde['id']]['on']('box',this[_0x5121('0x1c')][_0x5121('0x1d')](this,_0x50939d));this[_0x5121('0xe')][_0x45cbde['id']]['on'](_0x5121('0x1b'),this[_0x5121('0x1e')][_0x5121('0x1d')](this,_0x50939d));this[_0x5121('0xe')][_0x45cbde['id']]['on'](_0x5121('0x1f'),this[_0x5121('0x20')][_0x5121('0x1d')](this,_0x50939d));this[_0x5121('0xe')][_0x45cbde['id']]['on'](_0x5121('0x21'),this[_0x5121('0x22')][_0x5121('0x1d')](this,_0x50939d));}}else{if(_[_0x5121('0x17')](this['mailAccounts'][_0x50939d]['Imap'])){this[_0x5121('0xd')][_0x50939d]['Imap']={};}this[_0x5121('0xd')][_0x50939d][_0x5121('0x14')][_0x5121('0x23')]='disabled';this[_0x5121('0xd')][_0x50939d][_0x5121('0x14')][_0x5121('0x15')]='';this[_0x5121('0x18')](_0x50939d);}}}};EmailChannel[_0x5121('0x10')][_0x5121('0x1c')]=function(_0x22bfc6,_0x59b3a4){if(this[_0x5121('0xd')][_0x22bfc6]){this[_0x5121('0xd')][_0x22bfc6][_0x5121('0x14')][_0x5121('0x23')]=_0x5121('0x24');this[_0x5121('0xd')][_0x22bfc6][_0x5121('0x14')][_0x5121('0x15')]=_0x59b3a4['name'];if(_0x59b3a4[_0x5121('0x25')]){this[_0x5121('0xd')][_0x22bfc6][_0x5121('0x14')][_0x5121('0x16')]=_0x59b3a4[_0x5121('0x25')][_0x5121('0x16')];}return this['emit'](_0x22bfc6);}};EmailChannel['prototype'][_0x5121('0x1e')]=function(_0x49de05,_0x40a73a){logger['info'](_0x5121('0x26'),_0x40a73a['firstName'],_0x40a73a[_0x5121('0x27')],_0x40a73a[_0x5121('0x28')],_0x49de05);if(this[_0x5121('0xd')][_0x49de05]){return mailAccount['notify'](_0x49de05,_0x40a73a)[_0x5121('0x29')](function(_0x581c4c){if(_0x581c4c){logger[_0x5121('0xb')](_0x5121('0x2a'));}})['catch'](function(_0x36436f){logger[_0x5121('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x36436f));});}};EmailChannel[_0x5121('0x10')]['handleImapEnd']=function(_0x41d21b){if(this[_0x5121('0xd')][_0x41d21b]&&this[_0x5121('0xd')][_0x41d21b]['Imap']){if(this[_0x5121('0xe')][this[_0x5121('0xd')][_0x41d21b][_0x5121('0x14')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x41d21b]['Imap']['id']];}this[_0x5121('0xd')][_0x41d21b][_0x5121('0x14')][_0x5121('0x2b')]=moment();this['emit'](_0x41d21b);}};EmailChannel['prototype'][_0x5121('0x22')]=function(_0x21cba4,_0x1fc19a){if(this['mailAccounts'][_0x21cba4]){this['mailAccounts'][_0x21cba4][_0x5121('0x14')]['status']=_0x5121('0x21');this['mailAccounts'][_0x21cba4]['Imap'][_0x5121('0x15')]=_0x1fc19a;return this[_0x5121('0x18')](_0x21cba4);}};EmailChannel[_0x5121('0x10')][_0x5121('0x2c')]=function(_0x56e679,_0x58aa0d){return this[_0x5121('0xf')][_0x5121('0x2d')](_0x56e679,_0x58aa0d);};EmailChannel[_0x5121('0x10')][_0x5121('0x2e')]=function(_0x472243){var _0x46c6c9=this;if(this[_0x5121('0xd')][_0x472243['id']]){if(_[_0x5121('0x17')](this['mailAccounts'][_0x472243['id']]['Smtp'])){this[_0x5121('0xd')][_0x472243['id']][_0x5121('0x2f')]={};}this[_0x5121('0xd')][_0x472243['id']][_0x5121('0x2f')][_0x5121('0x2b')]=moment();return new BPromise(function(_0x4dcd16,_0x1c9acf){return _0x46c6c9['smtp'][_0x5121('0x30')](_0x472243)[_0x5121('0x29')](function(_0x57cdc6){_0x46c6c9[_0x5121('0xd')][_0x472243['id']][_0x5121('0x2f')][_0x5121('0x23')]=_0x5121('0x31');_0x46c6c9[_0x5121('0xd')][_0x472243['id']]['Smtp'][_0x5121('0x15')]='';_0x46c6c9[_0x5121('0x18')](_0x472243['id']);_0x4dcd16(_0x57cdc6);})[_0x5121('0x32')](function(_0x20cc5b){_0x46c6c9[_0x5121('0xd')][_0x472243['id']]['Smtp'][_0x5121('0x23')]=_0x5121('0x21');_0x46c6c9[_0x5121('0xd')][_0x472243['id']][_0x5121('0x2f')][_0x5121('0x15')]=_0x20cc5b;_0x46c6c9[_0x5121('0x18')](_0x472243['id']);_0x1c9acf(_0x20cc5b);});});}return this[_0x5121('0xf')][_0x5121('0x30')](_0x472243);};module[_0x5121('0x33')]=EmailChannel; \ No newline at end of file +var _0x2599=['lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','key','active','Imap','status','stringify','emit','mailAccount:update','hasOwnProperty','box','handleImapBox','bind','end','error','isNil','disabled','messageStatus','messages','total','handleImapEmail','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','handleImapEnd'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x2599,0x1a0));var _0x9259=function(_0x1d9339,_0x5b8458){_0x1d9339=_0x1d9339-0x0;var _0x5c6960=_0x2599[_0x1d9339];return _0x5c6960;};'use strict';var _=require(_0x9259('0x0'));var moment=require('moment');var BPromise=require(_0x9259('0x1'));var md5=require(_0x9259('0x2'));var Redis=require(_0x9259('0x3'));var config=require(_0x9259('0x4'));var logger=require(_0x9259('0x5'))(_0x9259('0x6'));config[_0x9259('0x7')]=_[_0x9259('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9259('0x7')]));var EmailImap=require(_0x9259('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x9259('0xa'));var md5Accounts={};function EmailChannel(_0xb71f39){logger[_0x9259('0xb')](_0x9259('0xc'));this[_0x9259('0xd')]=_0xb71f39[_0x9259('0xd')];this[_0x9259('0xe')]={};this[_0x9259('0xf')]=new EmailSmtp();}EmailChannel[_0x9259('0x10')]['emit']=function(_0x3b6595){var _0x2da0d1=this[_0x9259('0xd')][_0x3b6595];var _0x2a7073={'id':_0x2da0d1['id'],'name':_0x2da0d1['name'],'key':_0x2da0d1[_0x9259('0x11')],'active':_0x2da0d1[_0x9259('0x12')],'Imap':{'status':_0x2da0d1[_0x9259('0x13')][_0x9259('0x14')],'messageStatus':_0x2da0d1[_0x9259('0x13')]['messageStatus'],'total':_0x2da0d1[_0x9259('0x13')]['total']}};if(_['isNil'](md5Accounts[_0x3b6595])){md5Accounts[_0x3b6595]={};}var _0x1893bb=md5(JSON[_0x9259('0x15')](_0x2a7073));if(md5Accounts[_0x3b6595][_0x9259('0x2')]!==_0x1893bb){md5Accounts[_0x3b6595]['md5']=_0x1893bb;io[_0x9259('0x16')](_0x9259('0x17'),_0x2a7073);}};EmailChannel[_0x9259('0x10')]['refresh']=function(_0x229952){for(var _0xfc6bc3 in _0x229952){if(_0x229952[_0x9259('0x18')](_0xfc6bc3)){if(_0x229952[_0xfc6bc3][_0x9259('0x13')]&&_0x229952[_0xfc6bc3]['active']){var _0x2d0e34=_0x229952[_0xfc6bc3][_0x9259('0x13')];if(!this['imapAccounts']['hasOwnProperty'](_0x2d0e34['id'])){this['imapAccounts'][_0x2d0e34['id']]=new EmailImap(_0x2d0e34,_0x229952[_0xfc6bc3]['email']);this[_0x9259('0xe')][_0x2d0e34['id']]['on'](_0x9259('0x19'),this[_0x9259('0x1a')][_0x9259('0x1b')](this,_0xfc6bc3));this['imapAccounts'][_0x2d0e34['id']]['on'](_0x9259('0x6'),this['handleImapEmail'][_0x9259('0x1b')](this,_0xfc6bc3));this[_0x9259('0xe')][_0x2d0e34['id']]['on'](_0x9259('0x1c'),this['handleImapEnd']['bind'](this,_0xfc6bc3));this[_0x9259('0xe')][_0x2d0e34['id']]['on'](_0x9259('0x1d'),this['handleImapError'][_0x9259('0x1b')](this,_0xfc6bc3));}}else{if(_[_0x9259('0x1e')](this['mailAccounts'][_0xfc6bc3][_0x9259('0x13')])){this[_0x9259('0xd')][_0xfc6bc3][_0x9259('0x13')]={};}this[_0x9259('0xd')][_0xfc6bc3]['Imap'][_0x9259('0x14')]=_0x9259('0x1f');this[_0x9259('0xd')][_0xfc6bc3][_0x9259('0x13')][_0x9259('0x20')]='';this[_0x9259('0x16')](_0xfc6bc3);}}}};EmailChannel[_0x9259('0x10')][_0x9259('0x1a')]=function(_0x4ba9be,_0x51db15){if(this['mailAccounts'][_0x4ba9be]){this[_0x9259('0xd')][_0x4ba9be][_0x9259('0x13')]['status']='connected';this['mailAccounts'][_0x4ba9be][_0x9259('0x13')][_0x9259('0x20')]=_0x51db15['name'];if(_0x51db15[_0x9259('0x21')]){this[_0x9259('0xd')][_0x4ba9be][_0x9259('0x13')][_0x9259('0x22')]=_0x51db15[_0x9259('0x21')][_0x9259('0x22')];}return this[_0x9259('0x16')](_0x4ba9be);}};EmailChannel['prototype'][_0x9259('0x23')]=function(_0x50c1f3,_0x357ab5){logger[_0x9259('0xb')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x357ab5[_0x9259('0x24')],_0x357ab5['lastName'],_0x357ab5[_0x9259('0x25')],_0x50c1f3);if(this['mailAccounts'][_0x50c1f3]){return mailAccount[_0x9259('0x26')](_0x50c1f3,_0x357ab5)[_0x9259('0x27')](function(_0xc29577){if(_0xc29577){logger['info'](_0x9259('0x28'));}})[_0x9259('0x29')](function(_0x7739a1){logger[_0x9259('0x1d')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x9259('0x15')](_0x7739a1));});}};EmailChannel[_0x9259('0x10')][_0x9259('0x2a')]=function(_0x4dd5b0){if(this[_0x9259('0xd')][_0x4dd5b0]&&this[_0x9259('0xd')][_0x4dd5b0]['Imap']){if(this[_0x9259('0xe')][this[_0x9259('0xd')][_0x4dd5b0][_0x9259('0x13')]['id']]){delete this[_0x9259('0xe')][this['mailAccounts'][_0x4dd5b0][_0x9259('0x13')]['id']];}this[_0x9259('0xd')][_0x4dd5b0][_0x9259('0x13')][_0x9259('0x2b')]=moment();this[_0x9259('0x16')](_0x4dd5b0);}};EmailChannel[_0x9259('0x10')]['handleImapError']=function(_0x573be8,_0x56b4c6){if(this[_0x9259('0xd')][_0x573be8]){this[_0x9259('0xd')][_0x573be8][_0x9259('0x13')][_0x9259('0x14')]=_0x9259('0x1d');this[_0x9259('0xd')][_0x573be8]['Imap']['messageStatus']=_0x56b4c6;return this['emit'](_0x573be8);}};EmailChannel[_0x9259('0x10')][_0x9259('0x2c')]=function(_0x45fd2a,_0x1117ae){return this[_0x9259('0xf')][_0x9259('0x2d')](_0x45fd2a,_0x1117ae);};EmailChannel[_0x9259('0x10')][_0x9259('0x2e')]=function(_0x16645c){var _0x4732bb=this;if(this[_0x9259('0xd')][_0x16645c['id']]){if(_['isNil'](this[_0x9259('0xd')][_0x16645c['id']][_0x9259('0x2f')])){this[_0x9259('0xd')][_0x16645c['id']][_0x9259('0x2f')]={};}this[_0x9259('0xd')][_0x16645c['id']]['Smtp'][_0x9259('0x2b')]=moment();return new BPromise(function(_0x58b663,_0x29894e){return _0x4732bb[_0x9259('0xf')][_0x9259('0x30')](_0x16645c)[_0x9259('0x27')](function(_0x45d5ff){_0x4732bb[_0x9259('0xd')][_0x16645c['id']][_0x9259('0x2f')][_0x9259('0x14')]=_0x9259('0x31');_0x4732bb[_0x9259('0xd')][_0x16645c['id']][_0x9259('0x2f')][_0x9259('0x20')]='';_0x4732bb[_0x9259('0x16')](_0x16645c['id']);_0x58b663(_0x45d5ff);})[_0x9259('0x29')](function(_0x5b421c){_0x4732bb[_0x9259('0xd')][_0x16645c['id']][_0x9259('0x2f')]['status']=_0x9259('0x1d');_0x4732bb[_0x9259('0xd')][_0x16645c['id']][_0x9259('0x2f')][_0x9259('0x20')]=_0x5b421c;_0x4732bb[_0x9259('0x16')](_0x16645c['id']);_0x29894e(_0x5b421c);});});}return this[_0x9259('0xf')][_0x9259('0x30')](_0x16645c);};module[_0x9259('0x32')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 1ab4e1e..9ed2978 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 _0xc2ba=['imap','lodash','randomstring','mailparser','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','end','error','handleError','inherits','prototype','connTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','handleFetchError','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports'];(function(_0x58c525,_0x571d1a){var _0x34272f=function(_0x2e0ddc){while(--_0x2e0ddc){_0x58c525['push'](_0x58c525['shift']());}};_0x34272f(++_0x571d1a);}(_0xc2ba,0x131));var _0xac2b=function(_0x3295ed,_0x47006d){_0x3295ed=_0x3295ed-0x0;var _0x190c3f=_0xc2ba[_0x3295ed];return _0x190c3f;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0xac2b('0x0'));var _=require(_0xac2b('0x1'));var rs=require(_0xac2b('0x2'));var simpleParser=require(_0xac2b('0x3'))['simpleParser'];var Iconv=require(_0xac2b('0x4'))['Iconv'];var EventEmitter=require(_0xac2b('0x5'))[_0xac2b('0x6')];var utils=require(_0xac2b('0x7'));var logger=require(_0xac2b('0x8'))(_0xac2b('0x9'));function EmailImap(_0x1364b1,_0x3fb6a5){this[_0xac2b('0xa')]=_0xac2b('0xb');this[_0xac2b('0xc')]=this[_0xac2b('0xd')](_0x1364b1,_0x3fb6a5);this[_0xac2b('0x0')]=new Imap(this['account']);this[_0xac2b('0x0')][_0xac2b('0xe')](_0xac2b('0xf'),this[_0xac2b('0x10')][_0xac2b('0x11')](this));this[_0xac2b('0x0')]['once'](_0xac2b('0x12'),this['handleEnd'][_0xac2b('0x11')](this));this[_0xac2b('0x0')]['on'](_0xac2b('0x13'),this[_0xac2b('0x14')][_0xac2b('0x11')](this));this[_0xac2b('0x0')]['connect']();}util[_0xac2b('0x15')](EmailImap,EventEmitter);EmailImap[_0xac2b('0x16')][_0xac2b('0xd')]=function(_0x37e88e,_0x346af5){var _0x300c9d={'connTimeout':_0x37e88e[_0xac2b('0x17')]?_0x37e88e[_0xac2b('0x17')]*0x3e8:0x2710,'authTimeout':_0x37e88e['authTimeout']?_0x37e88e['authTimeout']*0x3e8:0x1388};if(_[_0xac2b('0x18')](_0x37e88e[_0xac2b('0x19')])){if(_0x37e88e[_0xac2b('0x1a')]){_0x300c9d[_0xac2b('0x1b')]=_0x37e88e[_0xac2b('0x1b')];_0x300c9d[_0xac2b('0x1c')]=_0x37e88e[_0xac2b('0x1c')];}_0x300c9d[_0xac2b('0x1d')]=_0x37e88e[_0xac2b('0x1d')];_0x300c9d[_0xac2b('0x1e')]=_0x37e88e[_0xac2b('0x1e')]||0x3e1;if(_0x37e88e[_0xac2b('0x1f')]){_0x300c9d[_0xac2b('0x1f')]=!![];}else{_0x300c9d['tls']=![];_0x300c9d[_0xac2b('0x20')]=_0xac2b('0x21');}}else{_0x300c9d[_0xac2b('0x1b')]=_0x37e88e[_0xac2b('0x1b')];_0x300c9d[_0xac2b('0x1c')]=_0x37e88e['password'];_0x300c9d['host']=utils[_0xac2b('0x22')](_0x37e88e[_0xac2b('0x19')]);_0x300c9d[_0xac2b('0x1e')]=0x3e1;_0x300c9d['tls']=!![];}_0x300c9d[_0xac2b('0x9')]=_0x346af5||_0x37e88e['user']||_0xac2b('0x23');return _0x300c9d;};EmailImap[_0xac2b('0x16')][_0xac2b('0x10')]=function(){this[_0xac2b('0x0')]['openBox'](this[_0xac2b('0xa')],![],this[_0xac2b('0x24')]['bind'](this));};EmailImap['prototype'][_0xac2b('0x24')]=function(_0x146847,_0x4ec0f7){if(_0x146847){this[_0xac2b('0x14')](_0x146847,!![]);}else{this[_0xac2b('0x25')](_0xac2b('0x26'),_0x4ec0f7);this[_0xac2b('0x27')]();}};EmailImap[_0xac2b('0x16')][_0xac2b('0x28')]=function(_0x2778af){if(_0x2778af){this[_0xac2b('0x14')](_0x2778af,!![]);}else{this[_0xac2b('0x0')]['end']();}};EmailImap[_0xac2b('0x16')][_0xac2b('0x27')]=function(){this['imap'][_0xac2b('0x29')]([_0xac2b('0x2a')],this['handleReadUnseen'][_0xac2b('0x11')](this));};EmailImap['prototype'][_0xac2b('0x2b')]=function(_0xbcb118,_0x25da09){if(_0xbcb118){this['handleError'](_0xbcb118,!![]);}else{if(_0x25da09['length']){try{var _0x91b067=this[_0xac2b('0x0')][_0xac2b('0x2c')](_0x25da09,{'bodies':'','markSeen':!![]});_0x91b067['on'](_0xac2b('0x2d'),this[_0xac2b('0x2e')]['bind'](this));_0x91b067['once'](_0xac2b('0x13'),this['handleFetchError'][_0xac2b('0x11')](this));_0x91b067[_0xac2b('0xe')](_0xac2b('0x12'),this[_0xac2b('0x2f')][_0xac2b('0x11')](this));}catch(_0x5c1488){logger[_0xac2b('0x13')](_0x5c1488);}}else{this[_0xac2b('0x0')][_0xac2b('0x30')](!![],this[_0xac2b('0x28')][_0xac2b('0x11')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x478d76,_0x37b836){_0x478d76['on']('body',this[_0xac2b('0x31')][_0xac2b('0x11')](this));_0x478d76['once'](_0xac2b('0x32'),this[_0xac2b('0x33')][_0xac2b('0x11')](this));_0x478d76['once'](_0xac2b('0x12'),this['handleMessageEnd'][_0xac2b('0x11')](this));};EmailImap[_0xac2b('0x16')][_0xac2b('0x31')]=function(_0x4e22f2,_0xb01cdb){simpleParser(_0x4e22f2,{'Iconv':Iconv},this[_0xac2b('0x34')]['bind'](this));};EmailImap[_0xac2b('0x16')][_0xac2b('0x33')]=function(_0x21f703){};EmailImap['prototype'][_0xac2b('0x35')]=function(){};EmailImap['prototype'][_0xac2b('0x34')]=function(_0x33cdc2,_0x540d84){if(_0x33cdc2){logger[_0xac2b('0x13')](_0x33cdc2);}else{var _0x4f3782=this;utils['parser'](this['account'],_0x540d84,function(_0x48ede1){_0x4f3782[_0xac2b('0x25')](_0xac2b('0x9'),_0x48ede1);});}};EmailImap[_0xac2b('0x16')][_0xac2b('0x2f')]=function(){this[_0xac2b('0x0')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xac2b('0x16')][_0xac2b('0x36')]=function(_0x1d4096){this[_0xac2b('0x14')](_0x1d4096);this[_0xac2b('0x0')][_0xac2b('0x30')](!![],this[_0xac2b('0x28')][_0xac2b('0x11')](this));};EmailImap['prototype'][_0xac2b('0x37')]=function(){this['emit'](_0xac2b('0x12'));};EmailImap[_0xac2b('0x16')]['handleError']=function(_0x16359a,_0x37d00e){logger[_0xac2b('0x13')](_0xac2b('0x14'),this[_0xac2b('0xc')][_0xac2b('0x9')],JSON[_0xac2b('0x38')](_0x16359a));var _0x4b9a45='';if(_0x16359a){if(_0x16359a[_0xac2b('0x39')]){_0x4b9a45=_0x16359a[_0xac2b('0x39')];}else{for(var _0xe53d9 in _0x16359a){if(_0x16359a[_0xac2b('0x3a')](_0xe53d9)){_0x4b9a45+=_[_0xac2b('0x3b')](_0xe53d9)+':\x20'+_0x16359a[_0xe53d9]+'\x0a';}}}}if(_0x37d00e){this[_0xac2b('0x0')][_0xac2b('0x12')]();}else{this['emit'](_0xac2b('0x13'),_0x4b9a45);this[_0xac2b('0x25')](_0xac2b('0x12'));}};module[_0xac2b('0x3c')]=EmailImap; \ No newline at end of file +var _0x5969=['account','once','ready','handleReady','bind','end','handleEnd','error','handleError','inherits','prototype','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchError','textCode','hasOwnProperty','upperFirst','imap','randomstring','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','mailbox'];(function(_0x4c8890,_0x34c779){var _0x2e7ed5=function(_0x6ba2c6){while(--_0x6ba2c6){_0x4c8890['push'](_0x4c8890['shift']());}};_0x2e7ed5(++_0x34c779);}(_0x5969,0x18c));var _0x9596=function(_0x3263fc,_0x5a0477){_0x3263fc=_0x3263fc-0x0;var _0x14433f=_0x5969[_0x3263fc];return _0x14433f;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0x9596('0x0'));var _=require('lodash');var rs=require(_0x9596('0x1'));var simpleParser=require('mailparser')[_0x9596('0x2')];var Iconv=require(_0x9596('0x3'))[_0x9596('0x4')];var EventEmitter=require('events')[_0x9596('0x5')];var utils=require(_0x9596('0x6'));var logger=require(_0x9596('0x7'))(_0x9596('0x8'));function EmailImap(_0xb27c3f,_0x4a26b7){this[_0x9596('0x9')]='INBOX';this[_0x9596('0xa')]=this['getAccount'](_0xb27c3f,_0x4a26b7);this[_0x9596('0x0')]=new Imap(this['account']);this[_0x9596('0x0')][_0x9596('0xb')](_0x9596('0xc'),this[_0x9596('0xd')][_0x9596('0xe')](this));this[_0x9596('0x0')][_0x9596('0xb')](_0x9596('0xf'),this[_0x9596('0x10')][_0x9596('0xe')](this));this['imap']['on'](_0x9596('0x11'),this[_0x9596('0x12')]['bind'](this));this['imap']['connect']();}util[_0x9596('0x13')](EmailImap,EventEmitter);EmailImap[_0x9596('0x14')]['getAccount']=function(_0x5949e2,_0x348b42){var _0x5c3ada={'connTimeout':_0x5949e2['connTimeout']?_0x5949e2['connTimeout']*0x3e8:0x2710,'authTimeout':_0x5949e2[_0x9596('0x15')]?_0x5949e2[_0x9596('0x15')]*0x3e8:0x1388};if(_[_0x9596('0x16')](_0x5949e2[_0x9596('0x17')])){if(_0x5949e2[_0x9596('0x18')]){_0x5c3ada[_0x9596('0x19')]=_0x5949e2['user'];_0x5c3ada['password']=_0x5949e2[_0x9596('0x1a')];}_0x5c3ada['host']=_0x5949e2[_0x9596('0x1b')];_0x5c3ada[_0x9596('0x1c')]=_0x5949e2[_0x9596('0x1c')]||0x3e1;if(_0x5949e2['tls']){_0x5c3ada[_0x9596('0x1d')]=!![];}else{_0x5c3ada[_0x9596('0x1d')]=![];_0x5c3ada[_0x9596('0x1e')]='required';}}else{_0x5c3ada[_0x9596('0x19')]=_0x5949e2[_0x9596('0x19')];_0x5c3ada[_0x9596('0x1a')]=_0x5949e2[_0x9596('0x1a')];_0x5c3ada['host']=utils[_0x9596('0x1f')](_0x5949e2[_0x9596('0x17')]);_0x5c3ada[_0x9596('0x1c')]=0x3e1;_0x5c3ada[_0x9596('0x1d')]=!![];}_0x5c3ada[_0x9596('0x8')]=_0x348b42||_0x5949e2[_0x9596('0x19')]||_0x9596('0x20');return _0x5c3ada;};EmailImap[_0x9596('0x14')]['handleReady']=function(){this[_0x9596('0x0')][_0x9596('0x21')](this[_0x9596('0x9')],![],this[_0x9596('0x22')]['bind'](this));};EmailImap['prototype']['handleOpenBox']=function(_0x338bde,_0x24ec0e){if(_0x338bde){this[_0x9596('0x12')](_0x338bde,!![]);}else{this[_0x9596('0x23')](_0x9596('0x24'),_0x24ec0e);this['readUnseen']();}};EmailImap[_0x9596('0x14')]['handleCloseBox']=function(_0x50043c){if(_0x50043c){this[_0x9596('0x12')](_0x50043c,!![]);}else{this[_0x9596('0x0')][_0x9596('0xf')]();}};EmailImap[_0x9596('0x14')][_0x9596('0x25')]=function(){this[_0x9596('0x0')][_0x9596('0x26')]([_0x9596('0x27')],this[_0x9596('0x28')][_0x9596('0xe')](this));};EmailImap[_0x9596('0x14')][_0x9596('0x28')]=function(_0x1c8dbf,_0x1e0667){if(_0x1c8dbf){this[_0x9596('0x12')](_0x1c8dbf,!![]);}else{if(_0x1e0667[_0x9596('0x29')]){try{var _0x1e2c9f=this[_0x9596('0x0')][_0x9596('0x2a')](_0x1e0667,{'bodies':'','markSeen':!![]});_0x1e2c9f['on'](_0x9596('0x2b'),this[_0x9596('0x2c')][_0x9596('0xe')](this));_0x1e2c9f[_0x9596('0xb')]('error',this['handleFetchError'][_0x9596('0xe')](this));_0x1e2c9f[_0x9596('0xb')](_0x9596('0xf'),this[_0x9596('0x2d')][_0x9596('0xe')](this));}catch(_0x2da952){logger['error'](_0x2da952);}}else{this['imap'][_0x9596('0x2e')](!![],this[_0x9596('0x2f')]['bind'](this));}}};EmailImap[_0x9596('0x14')][_0x9596('0x2c')]=function(_0xbdbeaf,_0x67a25f){_0xbdbeaf['on'](_0x9596('0x30'),this[_0x9596('0x31')][_0x9596('0xe')](this));_0xbdbeaf[_0x9596('0xb')](_0x9596('0x32'),this[_0x9596('0x33')][_0x9596('0xe')](this));_0xbdbeaf[_0x9596('0xb')](_0x9596('0xf'),this[_0x9596('0x34')][_0x9596('0xe')](this));};EmailImap[_0x9596('0x14')][_0x9596('0x31')]=function(_0x44eab7,_0x5818be){simpleParser(_0x44eab7,{'Iconv':Iconv},this[_0x9596('0x35')][_0x9596('0xe')](this));};EmailImap[_0x9596('0x14')][_0x9596('0x33')]=function(_0x31cc60){};EmailImap[_0x9596('0x14')]['handleMessageEnd']=function(){};EmailImap[_0x9596('0x14')]['handleSimpleParser']=function(_0x3c7464,_0x3efef6){if(_0x3c7464){logger[_0x9596('0x11')](_0x3c7464);}else{var _0x2067aa=this;utils['parser'](this[_0x9596('0xa')],_0x3efef6,function(_0x9c0e75){_0x2067aa[_0x9596('0x23')](_0x9596('0x8'),_0x9c0e75);});}};EmailImap[_0x9596('0x14')]['handleFetchEnd']=function(){this['imap'][_0x9596('0x2e')](!![],this[_0x9596('0x2f')][_0x9596('0xe')](this));};EmailImap[_0x9596('0x14')][_0x9596('0x36')]=function(_0x29b68a){this['handleError'](_0x29b68a);this[_0x9596('0x0')][_0x9596('0x2e')](!![],this[_0x9596('0x2f')][_0x9596('0xe')](this));};EmailImap[_0x9596('0x14')][_0x9596('0x10')]=function(){this[_0x9596('0x23')](_0x9596('0xf'));};EmailImap[_0x9596('0x14')][_0x9596('0x12')]=function(_0x233b72,_0x358fb4){logger[_0x9596('0x11')](_0x9596('0x12'),this[_0x9596('0xa')][_0x9596('0x8')],JSON['stringify'](_0x233b72));var _0xb3c8ae='';if(_0x233b72){if(_0x233b72[_0x9596('0x37')]){_0xb3c8ae=_0x233b72[_0x9596('0x37')];}else{for(var _0x18daa7 in _0x233b72){if(_0x233b72[_0x9596('0x38')](_0x18daa7)){_0xb3c8ae+=_[_0x9596('0x39')](_0x18daa7)+':\x20'+_0x233b72[_0x18daa7]+'\x0a';}}}}if(_0x358fb4){this['imap'][_0x9596('0xf')]();}else{this[_0x9596('0x23')](_0x9596('0x11'),_0xb3c8ae);this[_0x9596('0x23')](_0x9596('0xf'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 888f7ca..a67cb18 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 _0x7fe6=['verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7fe6,0x1ae));var _0x67fe=function(_0x412ff5,_0x47a49f){_0x412ff5=_0x412ff5-0x0;var _0x280aeb=_0x7fe6[_0x412ff5];return _0x280aeb;};'use strict';var nodemailer=require(_0x67fe('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x67fe('0x1'));function EmailSmtp(){}EmailSmtp[_0x67fe('0x2')]['send']=function(_0x53d25f,_0x4f9fa3){return new BPromise(function(_0x3f4070,_0x2bf6ee){var _0x42127b=nodemailer[_0x67fe('0x3')](_0x53d25f);_0x42127b['use']('compile',inlineBase64());_0x42127b['sendMail'](_0x4f9fa3,function(_0x458b0c,_0x483715){if(_0x458b0c){_0x2bf6ee(_0x458b0c['toString']());}else{_0x3f4070(_0x483715);}});});};EmailSmtp[_0x67fe('0x2')]['verify']=function(_0xcb7634){return new BPromise(function(_0x1d10bf,_0x48314f){var _0x5f406c=nodemailer['createTransport'](_0xcb7634);_0x5f406c[_0x67fe('0x4')](function(_0x4ea3cd,_0x4e9045){if(_0x4ea3cd){_0x48314f(_0x4ea3cd['toString']());}else{if(_0x4e9045){_0x1d10bf(_0x4e9045);}else{_0x48314f(_0x67fe('0x5'));}}});});};module[_0x67fe('0x6')]=EmailSmtp; \ No newline at end of file +var _0x7409=['createTransport','compile','sendMail','prototype','verify','toString','Not\x20verifired','nodemailer','bluebird','nodemailer-plugin-inline-base64','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7409,0xee));var _0x9740=function(_0x5a09f3,_0x9ce907){_0x5a09f3=_0x5a09f3-0x0;var _0x3665c2=_0x7409[_0x5a09f3];return _0x3665c2;};'use strict';var nodemailer=require(_0x9740('0x0'));var BPromise=require(_0x9740('0x1'));var inlineBase64=require(_0x9740('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0x9740('0x3')]=function(_0x2ac826,_0x7c0223){return new BPromise(function(_0x70b603,_0x1c9a4e){var _0x317a91=nodemailer[_0x9740('0x4')](_0x2ac826);_0x317a91['use'](_0x9740('0x5'),inlineBase64());_0x317a91[_0x9740('0x6')](_0x7c0223,function(_0x19836a,_0x376992){if(_0x19836a){_0x1c9a4e(_0x19836a['toString']());}else{_0x70b603(_0x376992);}});});};EmailSmtp[_0x9740('0x7')][_0x9740('0x8')]=function(_0x37ab93){return new BPromise(function(_0x42b80e,_0x5cb6b5){var _0x3f4e1d=nodemailer['createTransport'](_0x37ab93);_0x3f4e1d[_0x9740('0x8')](function(_0x4f301e,_0x123bb7){if(_0x4f301e){_0x5cb6b5(_0x4f301e[_0x9740('0x9')]());}else{if(_0x123bb7){_0x42b80e(_0x123bb7);}else{_0x5cb6b5(_0x9740('0xa'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index f829eaa..89baf42 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 _0xda3b=['from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','split','length','Anonymous','pop','isEmpty','html','test','body','message','originCc','originTo','includes','bcc','attachments','type','attachment','filename','attachment-','format','%s-%s','join','root','writeFileSync','content','push','contentType','parser'];(function(_0x5ac6b6,_0x360830){var _0x1e2d88=function(_0x10a329){while(--_0x10a329){_0x5ac6b6['push'](_0x5ac6b6['shift']());}};_0x1e2d88(++_0x360830);}(_0xda3b,0x99));var _0xbda3=function(_0x18a601,_0x4ecde7){_0x18a601=_0x18a601-0x0;var _0x25bf03=_0xda3b[_0x18a601];return _0x25bf03;};'use strict';var _=require(_0xbda3('0x0'));var moment=require(_0xbda3('0x1'));var random=require(_0xbda3('0x2'));var fs=require('fs');var path=require(_0xbda3('0x3'));var util=require(_0xbda3('0x4'));var tnef=require(_0xbda3('0x5'));var logger=require(_0xbda3('0x6'))(_0xbda3('0x7'));var config=require('../../../config/environment');function getAddress(_0x197b5a){var _0x5d5e16=_[_0xbda3('0x8')](_0x197b5a[_0xbda3('0x9')]);return _0x5d5e16&&_0x5d5e16[_0xbda3('0xa')]?_0x5d5e16[_0xbda3('0xa')]:_0xbda3('0xb')+random[_0xbda3('0xc')](0x6)+_0xbda3('0xd');}function getFirstName(_0x2e3d70){var _0x3e9490=_[_0xbda3('0x8')](_0x2e3d70[_0xbda3('0x9')]);if(_0x3e9490&&_0x3e9490[_0xbda3('0xe')]){var _0x287e31=_0x3e9490['name'][_0xbda3('0xf')](/\s+/);return _0x287e31[_0xbda3('0x10')]?_0x287e31['slice'](0x0,-0x1)['join']('\x20'):_0x3e9490[_0xbda3('0xe')];}return _0xbda3('0x11');}function getLastName(_0x56c924){var _0x537206=_[_0xbda3('0x8')](_0x56c924[_0xbda3('0x9')]);if(_0x537206&&_0x537206['name']){var _0x4381f7=_0x537206[_0xbda3('0xe')][_0xbda3('0xf')](/\s+/);return _0x4381f7[_0xbda3('0x10')]>0x1?_0x4381f7[_0xbda3('0x12')]():'';}return'';}function getMails(_0x2e6d0c,_0x68459e){var _0x5c190f='';for(var _0x32d8b2=0x0;_0x32d8b2<_0x68459e[_0xbda3('0x9')][_0xbda3('0x10')];_0x32d8b2+=0x1){if(_0x68459e['value'][_0x32d8b2][_0xbda3('0xa')]!==_0x2e6d0c){if(!_[_0xbda3('0x13')](_0x5c190f)){_0x5c190f+=',';}_0x5c190f+=_0x68459e[_0xbda3('0x9')][_0x32d8b2][_0xbda3('0xe')]||_0x68459e[_0xbda3('0x9')][_0x32d8b2][_0xbda3('0xa')]||'';_0x5c190f+='\x20<';_0x5c190f+=_0x68459e['value'][_0x32d8b2][_0xbda3('0xa')]?_0x68459e[_0xbda3('0x9')][_0x32d8b2][_0xbda3('0xa')]:_0xbda3('0xb')+random[_0xbda3('0xc')](0x6)+_0xbda3('0xd');_0x5c190f+='>';}}return _0x5c190f;}function parseEmail(_0x203e21,_0x254b75,_0x2d7819){if(_0x254b75[_0xbda3('0x14')]){var _0x4a77bb=/)<[^<]*)*<\/script>/gi;while(_0x4a77bb[_0xbda3('0x15')](_0x254b75[_0xbda3('0x14')])){_0x254b75[_0xbda3('0x14')]=_0x254b75[_0xbda3('0x14')]['replace'](_0x4a77bb,'');}_0x2d7819[_0xbda3('0x16')]=_0x254b75[_0xbda3('0x14')];}else{_0x2d7819['body']=_0x254b75['textAsHtml'];}if(_0x2d7819['body']){_0x2d7819[_0xbda3('0x16')]=_0x2d7819[_0xbda3('0x16')]['replace'](/Empty\x20message

','Attachments','Title','Data','gmail','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','randomstring','path','util','../../../config/logger','../../../config/environment','head','value','address','generate','@xcally.com','name','split','slice','join','Anonymous','length','pop','isEmpty','anonymous','html','replace','body','textAsHtml','0x1?_0x3268c6[_0xf020('0x10')]():'';}return'';}function getMails(_0x159cb9,_0x38dd81){var _0x558b50='';for(var _0x56685a=0x0;_0x56685a<_0x38dd81['value'][_0xf020('0xf')];_0x56685a+=0x1){if(_0x38dd81[_0xf020('0x6')][_0x56685a][_0xf020('0x7')]!==_0x159cb9){if(!_[_0xf020('0x11')](_0x558b50)){_0x558b50+=',';}_0x558b50+=_0x38dd81[_0xf020('0x6')][_0x56685a][_0xf020('0xa')]||_0x38dd81[_0xf020('0x6')][_0x56685a][_0xf020('0x7')]||'';_0x558b50+='\x20<';_0x558b50+=_0x38dd81[_0xf020('0x6')][_0x56685a][_0xf020('0x7')]?_0x38dd81[_0xf020('0x6')][_0x56685a][_0xf020('0x7')]:_0xf020('0x12')+random[_0xf020('0x8')](0x6)+_0xf020('0x9');_0x558b50+='>';}}return _0x558b50;}function parseEmail(_0x233410,_0x40dcc1,_0xb4c9b8){if(_0x40dcc1['html']){var _0x2406c7=/)<[^<]*)*<\/script>/gi;while(_0x2406c7['test'](_0x40dcc1[_0xf020('0x13')])){_0x40dcc1['html']=_0x40dcc1[_0xf020('0x13')][_0xf020('0x14')](_0x2406c7,'');}_0xb4c9b8[_0xf020('0x15')]=_0x40dcc1[_0xf020('0x13')];}else{_0xb4c9b8[_0xf020('0x15')]=_0x40dcc1[_0xf020('0x16')];}if(_0xb4c9b8['body']){_0xb4c9b8[_0xf020('0x15')]=_0xb4c9b8[_0xf020('0x15')][_0xf020('0x14')](/0x0){if(this[_0x3eccee+_0x702f('0x28')]>0x0&&this[_0x3eccee+_0x702f('0x27')]>=this[_0x3eccee+_0x702f('0x28')]){return _0x702f('0x29');}else{return _0x702f('0x2a');}}else{return _0x702f('0x2b');}};Agent[_0x702f('0x2c')][_0x702f('0x25')]=function(){var _0x28a0d8=[_0x702f('0x2d'),_0x702f('0x2e'),_0x702f('0x2f'),_0x702f('0x30'),_0x702f('0x31'),'whatsapp'];for(var _0x3a2aeb=0x0;_0x3a2aeb<_0x28a0d8[_0x702f('0x32')];_0x3a2aeb+=0x1){var _0x46136d=this[_0x702f('0x26')](_0x28a0d8[_0x3a2aeb]);if(this[_0x28a0d8[_0x3a2aeb]+_0x702f('0x33')]!==_0x46136d){this[_0x28a0d8[_0x3a2aeb]+'StatusTime']=_[_0x702f('0x34')](moment()['format']('x'));}this[_0x28a0d8[_0x3a2aeb]+_0x702f('0x33')]=_0x46136d;}var _0x62bc25={'id':this['id'],'name':this[_0x702f('0x8')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x702f('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0x702f('0xe')],'faxPause':this[_0x702f('0xd')],'openchannelPause':this[_0x702f('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x702f('0x11')],'chatCapacity':this[_0x702f('0x12')],'chatCurrentCapacity':this[_0x702f('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x702f('0x16')],'mailCurrentCapacity':this[_0x702f('0x17')],'faxStatus':this[_0x702f('0x18')],'faxStatusTime':this[_0x702f('0x19')],'faxCapacity':this[_0x702f('0x1a')],'faxCurrentCapacity':this[_0x702f('0x1b')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x702f('0x1d')],'smsCapacity':this[_0x702f('0x35')],'smsCurrentCapacity':this[_0x702f('0x1e')],'whatsappStatus':this[_0x702f('0x36')],'whatsappStatusTime':this[_0x702f('0x1f')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x702f('0x37')],'openchannelStatus':this[_0x702f('0x21')],'openchannelStatusTime':this[_0x702f('0x38')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x702f('0x23')],'busy':this[_0x702f('0x39')],'busyQueue':this[_0x702f('0x24')]};var _0x8a908a=md5(JSON[_0x702f('0x3a')](_0x62bc25));if(this[_0x702f('0x2')]!==_0x8a908a){this[_0x702f('0x2')]=_0x8a908a;io[_0x702f('0x3b')](_0x702f('0x3c'),_0x62bc25);}};module[_0x702f('0x3d')]=Agent; \ No newline at end of file +var _0x6836=['faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','mail','chat','fax','sms','whatsapp','Status','StatusTime','format','chatStatus','whatsappStatusTime','user:save','exports','lodash','moment','md5','../../../config/environment','defaults','localhost','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus'];(function(_0x1a0297,_0x365f31){var _0x4b1a08=function(_0x46fa49){while(--_0x46fa49){_0x1a0297['push'](_0x1a0297['shift']());}};_0x4b1a08(++_0x365f31);}(_0x6836,0x1c0));var _0x6683=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x6836[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x6683('0x0'));var moment=require(_0x6683('0x1'));var md5=require(_0x6683('0x2'));var Redis=require('ioredis');var config=require(_0x6683('0x3'));config['redis']=_[_0x6683('0x4')](config['redis'],{'host':_0x6683('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6683('0x6')]));function Agent(_0x361057){this['id']=_0x361057['id']||0x0;this[_0x6683('0x7')]=_0x361057[_0x6683('0x7')]||'';this['online']=_0x361057[_0x6683('0x8')]||!![];this[_0x6683('0x9')]=_0x361057[_0x6683('0x9')]||![];this[_0x6683('0xa')]=_0x361057[_0x6683('0xa')]||![];this[_0x6683('0xb')]=_0x361057['mailPause']||![];this['faxPause']=_0x361057[_0x6683('0xc')]||![];this[_0x6683('0xd')]=_0x361057[_0x6683('0xd')]||![];this['openchannelPause']=_0x361057[_0x6683('0xe')]||![];this['chatStatus']=_0x6683('0xf');this[_0x6683('0x10')]=0x0;this[_0x6683('0x11')]=_0x361057[_0x6683('0x11')]||0x0;this[_0x6683('0x12')]=0x0;this[_0x6683('0x13')]=_0x6683('0xf');this[_0x6683('0x14')]=0x0;this['mailCapacity']=_0x361057[_0x6683('0x15')]||0x0;this[_0x6683('0x16')]=0x0;this[_0x6683('0x17')]=_0x6683('0xf');this[_0x6683('0x18')]=0x0;this['faxCapacity']=_0x361057[_0x6683('0x19')]||0x0;this[_0x6683('0x1a')]=0x0;this[_0x6683('0x1b')]=_0x6683('0xf');this[_0x6683('0x1c')]=0x0;this[_0x6683('0x1d')]=_0x361057[_0x6683('0x1d')]||0x0;this[_0x6683('0x1e')]=0x0;this[_0x6683('0x1f')]=_0x6683('0xf');this['whatsappStatusTime']=0x0;this[_0x6683('0x20')]=_0x361057[_0x6683('0x20')]||0x0;this[_0x6683('0x21')]=0x0;this[_0x6683('0x22')]='unknown';this[_0x6683('0x23')]=0x0;this[_0x6683('0x24')]=_0x361057[_0x6683('0x24')]||0x0;this[_0x6683('0x25')]=0x0;this[_0x6683('0x26')]=![];this[_0x6683('0x27')]=undefined;this[_0x6683('0x2')]='';this[_0x6683('0x28')]();}Agent[_0x6683('0x29')][_0x6683('0x2a')]=function(_0x38e166){if(this[_0x38e166+_0x6683('0x2b')]>0x0){if(this[_0x38e166+_0x6683('0x2c')]>0x0&&this[_0x38e166+_0x6683('0x2b')]>=this[_0x38e166+_0x6683('0x2c')]){return _0x6683('0x2d');}else{return'working';}}else{return _0x6683('0x2e');}};Agent[_0x6683('0x29')]['updateRealtime']=function(){var _0x3250e5=[_0x6683('0x2f'),_0x6683('0x30'),'openchannel',_0x6683('0x31'),_0x6683('0x32'),_0x6683('0x33')];for(var _0xd93a1=0x0;_0xd93a1<_0x3250e5['length'];_0xd93a1+=0x1){var _0x1e9c1e=this[_0x6683('0x2a')](_0x3250e5[_0xd93a1]);if(this[_0x3250e5[_0xd93a1]+_0x6683('0x34')]!==_0x1e9c1e){this[_0x3250e5[_0xd93a1]+_0x6683('0x35')]=_['toNumber'](moment()[_0x6683('0x36')]('x'));}this[_0x3250e5[_0xd93a1]+_0x6683('0x34')]=_0x1e9c1e;}var _0x2324ba={'id':this['id'],'name':this[_0x6683('0x7')],'online':this[_0x6683('0x8')],'voicePause':this[_0x6683('0x9')],'chatPause':this[_0x6683('0xa')],'mailPause':this[_0x6683('0xb')],'smsPause':this[_0x6683('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0x6683('0xe')],'chatStatus':this[_0x6683('0x37')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x6683('0x11')],'chatCurrentCapacity':this[_0x6683('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x6683('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x6683('0x16')],'faxStatus':this[_0x6683('0x17')],'faxStatusTime':this[_0x6683('0x18')],'faxCapacity':this[_0x6683('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x6683('0x1b')],'smsStatusTime':this[_0x6683('0x1c')],'smsCapacity':this[_0x6683('0x1d')],'smsCurrentCapacity':this[_0x6683('0x1e')],'whatsappStatus':this[_0x6683('0x1f')],'whatsappStatusTime':this[_0x6683('0x38')],'whatsappCapacity':this[_0x6683('0x20')],'whatsappCurrentCapacity':this[_0x6683('0x21')],'openchannelStatus':this[_0x6683('0x22')],'openchannelStatusTime':this[_0x6683('0x23')],'openchannelCapacity':this[_0x6683('0x24')],'openchannelCurrentCapacity':this[_0x6683('0x25')],'busy':this[_0x6683('0x26')],'busyQueue':this[_0x6683('0x27')]};var _0x3f0c25=md5(JSON['stringify'](_0x2324ba));if(this[_0x6683('0x2')]!==_0x3f0c25){this['md5']=_0x3f0c25;io['emit'](_0x6683('0x39'),_0x2324ba);}};module[_0x6683('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 4aa1ae4..fc70d7d 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 _0x3633=['paused','length','online','chatPause','available','waiting','format','chat:queue:%s','emit','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','prototype','updateRouting','_rr','Agents','loggedIn'];(function(_0x30da35,_0x280ba8){var _0x4f47bb=function(_0x1c0121){while(--_0x1c0121){_0x30da35['push'](_0x30da35['shift']());}};_0x4f47bb(++_0x280ba8);}(_0x3633,0xda));var _0x3363=function(_0x42ca45,_0x52d00b){_0x42ca45=_0x42ca45-0x0;var _0xa6205c=_0x3633[_0x42ca45];return _0xa6205c;};'use strict';var _=require(_0x3363('0x0'));var md5=require(_0x3363('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x3363('0x2'));config[_0x3363('0x3')]=_[_0x3363('0x4')](config[_0x3363('0x3')],{'host':_0x3363('0x5'),'port':0x18eb});var io=require(_0x3363('0x6'))(new Redis(config[_0x3363('0x3')]));function ChatQueue(_0x4966f4){this['id']=_0x4966f4['id']||0x0;this['name']=_0x4966f4[_0x3363('0x7')]||'';this[_0x3363('0x8')]=_0x4966f4[_0x3363('0x8')]||0xa;this['strategy']=_0x4966f4[_0x3363('0x9')]||'beepall';this['Agents']=_0x4966f4['Agents'];this[_0x3363('0xa')]={};this['waiting']=0x0;this[_0x3363('0x1')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x3363('0xb')][_0x3363('0xc')]=function(){var _0x39b018=this[_0x3363('0xa')][_0x3363('0xd')];this[_0x3363('0xa')]=_['map'](this[_0x3363('0xe')],'id');this[_0x3363('0xa')]['_rr']=_0x39b018;};ChatQueue[_0x3363('0xb')]['updateRealtime']=function(){this[_0x3363('0xf')]=0x0;this[_0x3363('0x10')]=0x0;for(var _0x4158b2=0x0;_0x4158b2=0x0?this['available']:0x0;var _0x38b308={'id':this['id'],'available':this[_0x3363('0x14')],'loggedIn':this[_0x3363('0xf')],'name':this['name'],'paused':this[_0x3363('0x10')],'waiting':this[_0x3363('0x15')]};var _0x4b83c4=md5(JSON['stringify'](_0x38b308));if(this[_0x3363('0x1')]!==_0x4b83c4){this[_0x3363('0x1')]=_0x4b83c4;io['to'](util[_0x3363('0x16')](_0x3363('0x17'),_0x38b308['name']))[_0x3363('0x18')]('chat_queue:save',_0x38b308);}};module[_0x3363('0x19')]=ChatQueue; \ No newline at end of file +var _0xadb9=['waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xadb9,0x12c));var _0x9adb=function(_0x384412,_0x6ad830){_0x384412=_0x384412-0x0;var _0x4c3e4f=_0xadb9[_0x384412];return _0x4c3e4f;};'use strict';var _=require('lodash');var md5=require(_0x9adb('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x9adb('0x1'));config[_0x9adb('0x2')]=_[_0x9adb('0x3')](config[_0x9adb('0x2')],{'host':_0x9adb('0x4'),'port':0x18eb});var io=require(_0x9adb('0x5'))(new Redis(config[_0x9adb('0x2')]));function ChatQueue(_0x1d9f30){this['id']=_0x1d9f30['id']||0x0;this[_0x9adb('0x6')]=_0x1d9f30[_0x9adb('0x6')]||'';this[_0x9adb('0x7')]=_0x1d9f30['timeout']||0xa;this[_0x9adb('0x8')]=_0x1d9f30[_0x9adb('0x8')]||_0x9adb('0x9');this[_0x9adb('0xa')]=_0x1d9f30[_0x9adb('0xa')];this[_0x9adb('0xb')]={};this[_0x9adb('0xc')]=0x0;this[_0x9adb('0x0')]='';this[_0x9adb('0xd')]();this[_0x9adb('0xe')]();}ChatQueue[_0x9adb('0xf')][_0x9adb('0xd')]=function(){var _0x57243a=this[_0x9adb('0xb')][_0x9adb('0x10')];this[_0x9adb('0xb')]=_['map'](this[_0x9adb('0xa')],'id');this[_0x9adb('0xb')][_0x9adb('0x10')]=_0x57243a;};ChatQueue[_0x9adb('0xf')][_0x9adb('0xe')]=function(){this[_0x9adb('0x11')]=0x0;this[_0x9adb('0x12')]=0x0;for(var _0x2ad45c=0x0;_0x2ad45c=0x0?this[_0x9adb('0x16')]:0x0;var _0x3f3244={'id':this['id'],'available':this[_0x9adb('0x16')],'loggedIn':this[_0x9adb('0x11')],'name':this['name'],'paused':this[_0x9adb('0x12')],'waiting':this[_0x9adb('0xc')]};var _0x4b5b7f=md5(JSON[_0x9adb('0x17')](_0x3f3244));if(this[_0x9adb('0x0')]!==_0x4b5b7f){this['md5']=_0x4b5b7f;io['to'](util[_0x9adb('0x18')](_0x9adb('0x19'),_0x3f3244[_0x9adb('0x6')]))['emit']('chat_queue:save',_0x3f3244);}};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 fe9001d..0fcf17f 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(_0x3ce98d,_0x4dbf4b){var _0x22e6cb=function(_0x2fee66){while(--_0x2fee66){_0x3ce98d['push'](_0x3ce98d['shift']());}};_0x22e6cb(++_0x4dbf4b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x3f8667,_0x526ac1){var _0x413586=function(_0x5b4a70){while(--_0x5b4a70){_0x3f8667['push'](_0x3f8667['shift']());}};_0x413586(++_0x526ac1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 7975bbe..e126687 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 _0xa3e5=['name','Intervals','exports'];(function(_0x5d7487,_0x5f2539){var _0x274f25=function(_0x35a95b){while(--_0x35a95b){_0x5d7487['push'](_0x5d7487['shift']());}};_0x274f25(++_0x5f2539);}(_0xa3e5,0x198));var _0x5a3e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa3e5[_0x311c35];return _0x5cc50c;};'use strict';function Interval(_0x3b4b03){this['id']=_0x3b4b03['id']||0x0;this['name']=_0x3b4b03[_0x5a3e('0x0')]||'';this['Intervals']=_0x3b4b03[_0x5a3e('0x1')]||{};}module[_0x5a3e('0x2')]=Interval; \ No newline at end of file +var _0x13a8=['Intervals','exports','name'];(function(_0x166dcd,_0x1ba118){var _0x1731d4=function(_0xa31e02){while(--_0xa31e02){_0x166dcd['push'](_0x166dcd['shift']());}};_0x1731d4(++_0x1ba118);}(_0x13a8,0xc8));var _0x813a=function(_0x3ab4c9,_0x4ae876){_0x3ab4c9=_0x3ab4c9-0x0;var _0x305291=_0x13a8[_0x3ab4c9];return _0x305291;};'use strict';function Interval(_0x464bad){this['id']=_0x464bad['id']||0x0;this[_0x813a('0x0')]=_0x464bad[_0x813a('0x0')]||'';this[_0x813a('0x1')]=_0x464bad[_0x813a('0x1')]||{};}module[_0x813a('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 a5bb063..eab2f83 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 _0x7847=['md5','ioredis','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','map','mapAgentsId','_rr','loggedIn','paused','length','online','mailPause','available','stringify','format','emit','mail_queue:save','exports','lodash'];(function(_0x9e53fd,_0x2c6bce){var _0xecf3f4=function(_0x2dbedb){while(--_0x2dbedb){_0x9e53fd['push'](_0x9e53fd['shift']());}};_0xecf3f4(++_0x2c6bce);}(_0x7847,0xca));var _0x7784=function(_0x33e61d,_0x182628){_0x33e61d=_0x33e61d-0x0;var _0x185b31=_0x7847[_0x33e61d];return _0x185b31;};'use strict';var _=require(_0x7784('0x0'));var md5=require(_0x7784('0x1'));var util=require('util');var Redis=require(_0x7784('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x7784('0x3')](config[_0x7784('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x7784('0x5'))(new Redis(config[_0x7784('0x4')]));function MailQueue(_0x1bf408){this['id']=_0x1bf408['id']||0x0;this[_0x7784('0x6')]=_0x1bf408[_0x7784('0x6')]||'';this[_0x7784('0x7')]=_0x1bf408[_0x7784('0x7')]||0xa;this['strategy']=_0x1bf408[_0x7784('0x8')]||_0x7784('0x9');this[_0x7784('0xa')]=_0x1bf408[_0x7784('0xa')];this['mapAgentsId']={};this[_0x7784('0xb')]=0x0;this[_0x7784('0x1')]='';this[_0x7784('0xc')]();this[_0x7784('0xd')]();}MailQueue[_0x7784('0xe')]['updateRouting']=function(){var _0x2353a6=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x7784('0xf')](this['Agents'],'id');this[_0x7784('0x10')][_0x7784('0x11')]=_0x2353a6;};MailQueue[_0x7784('0xe')]['updateRealtime']=function(){this[_0x7784('0x12')]=0x0;this[_0x7784('0x13')]=0x0;for(var _0x36ee32=0x0;_0x36ee32=0x0?this[_0x7784('0x17')]:0x0;var _0x35ce10={'id':this['id'],'available':this[_0x7784('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x7784('0x6')],'paused':this[_0x7784('0x13')],'waiting':this['waiting']};var _0x484fae=md5(JSON[_0x7784('0x18')](_0x35ce10));if(this[_0x7784('0x1')]!==_0x484fae){this['md5']=_0x484fae;io['to'](util[_0x7784('0x19')]('mail:queue:%s',_0x35ce10[_0x7784('0x6')]))[_0x7784('0x1a')](_0x7784('0x1b'),_0x35ce10);}};module[_0x7784('0x1c')]=MailQueue; \ No newline at end of file +var _0x1e8b=['ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','md5','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','length','mailPause','paused','available','waiting','stringify','format','mail:queue:%s','emit','exports','lodash','util'];(function(_0x5964d1,_0x543132){var _0x3f13e5=function(_0x39f500){while(--_0x39f500){_0x5964d1['push'](_0x5964d1['shift']());}};_0x3f13e5(++_0x543132);}(_0x1e8b,0x1eb));var _0xb1e8=function(_0x13b7c4,_0x32d511){_0x13b7c4=_0x13b7c4-0x0;var _0x5a1efe=_0x1e8b[_0x13b7c4];return _0x5a1efe;};'use strict';var _=require(_0xb1e8('0x0'));var md5=require('md5');var util=require(_0xb1e8('0x1'));var Redis=require(_0xb1e8('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xb1e8('0x3')](config[_0xb1e8('0x4')],{'host':_0xb1e8('0x5'),'port':0x18eb});var io=require(_0xb1e8('0x6'))(new Redis(config[_0xb1e8('0x4')]));function MailQueue(_0x2d1b42){this['id']=_0x2d1b42['id']||0x0;this['name']=_0x2d1b42[_0xb1e8('0x7')]||'';this[_0xb1e8('0x8')]=_0x2d1b42['timeout']||0xa;this[_0xb1e8('0x9')]=_0x2d1b42[_0xb1e8('0x9')]||'beepall';this[_0xb1e8('0xa')]=_0x2d1b42[_0xb1e8('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xb1e8('0xb')]='';this[_0xb1e8('0xc')]();this['updateRealtime']();}MailQueue[_0xb1e8('0xd')][_0xb1e8('0xc')]=function(){var _0x1f929f=this[_0xb1e8('0xe')][_0xb1e8('0xf')];this[_0xb1e8('0xe')]=_[_0xb1e8('0x10')](this['Agents'],'id');this[_0xb1e8('0xe')][_0xb1e8('0xf')]=_0x1f929f;};MailQueue[_0xb1e8('0xd')][_0xb1e8('0x11')]=function(){this[_0xb1e8('0x12')]=0x0;this['paused']=0x0;for(var _0x6ecaa7=0x0;_0x6ecaa7=0x0?this['available']:0x0;var _0x19faa3={'id':this['id'],'available':this[_0xb1e8('0x16')],'loggedIn':this[_0xb1e8('0x12')],'name':this[_0xb1e8('0x7')],'paused':this['paused'],'waiting':this[_0xb1e8('0x17')]};var _0x572f29=md5(JSON[_0xb1e8('0x18')](_0x19faa3));if(this['md5']!==_0x572f29){this[_0xb1e8('0xb')]=_0x572f29;io['to'](util[_0xb1e8('0x19')](_0xb1e8('0x1a'),_0x19faa3[_0xb1e8('0x7')]))[_0xb1e8('0x1b')]('mail_queue:save',_0x19faa3);}};module[_0xb1e8('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 0416888..c3bd904 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 _0x60e5=['md5','updateRealtime','updateRouting','mapAgentsId','Agents','_rr','length','online','loggedIn','openchannelPause','paused','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','waiting'];(function(_0x1ffd47,_0x33f9ad){var _0x5f3d74=function(_0x3e2ef7){while(--_0x3e2ef7){_0x1ffd47['push'](_0x1ffd47['shift']());}};_0x5f3d74(++_0x33f9ad);}(_0x60e5,0x197));var _0x560e=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x60e5[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x560e('0x0'));var md5=require('md5');var util=require(_0x560e('0x1'));var Redis=require(_0x560e('0x2'));var config=require(_0x560e('0x3'));config['redis']=_[_0x560e('0x4')](config['redis'],{'host':_0x560e('0x5'),'port':0x18eb});var io=require(_0x560e('0x6'))(new Redis(config[_0x560e('0x7')]));function OpenchannelQueue(_0x2aabdc){this['id']=_0x2aabdc['id']||0x0;this[_0x560e('0x8')]=_0x2aabdc['name']||'';this[_0x560e('0x9')]=_0x2aabdc['timeout']||0xa;this['strategy']=_0x2aabdc[_0x560e('0xa')]||_0x560e('0xb');this['Agents']=_0x2aabdc['Agents'];this['mapAgentsId']={};this[_0x560e('0xc')]=0x0;this[_0x560e('0xd')]='';this['updateRouting']();this[_0x560e('0xe')]();}OpenchannelQueue['prototype'][_0x560e('0xf')]=function(){var _0x3ba902=this['mapAgentsId']['_rr'];this[_0x560e('0x10')]=_['map'](this[_0x560e('0x11')],'id');this[_0x560e('0x10')][_0x560e('0x12')]=_0x3ba902;};OpenchannelQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3604c2=0x0;_0x3604c2=0x0?this[_0x560e('0x18')]:0x0;var _0x26e687={'id':this['id'],'available':this[_0x560e('0x18')],'loggedIn':this[_0x560e('0x15')],'name':this[_0x560e('0x8')],'paused':this[_0x560e('0x17')],'waiting':this[_0x560e('0xc')]};var _0x3f6416=md5(JSON[_0x560e('0x19')](_0x26e687));if(this[_0x560e('0xd')]!==_0x3f6416){this[_0x560e('0xd')]=_0x3f6416;io['to'](util[_0x560e('0x1a')](_0x560e('0x1b'),_0x26e687[_0x560e('0x8')]))[_0x560e('0x1c')](_0x560e('0x1d'),_0x26e687);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0xd0be=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','openchannelPause','available','stringify','openchannel:queue:%s','emit','exports','lodash','md5','util','ioredis','redis'];(function(_0x54db14,_0x5a3cee){var _0x587884=function(_0x941121){while(--_0x941121){_0x54db14['push'](_0x54db14['shift']());}};_0x587884(++_0x5a3cee);}(_0xd0be,0x6f));var _0xed0b=function(_0x5a4935,_0x9a0cee){_0x5a4935=_0x5a4935-0x0;var _0x116100=_0xd0be[_0x5a4935];return _0x116100;};'use strict';var _=require(_0xed0b('0x0'));var md5=require(_0xed0b('0x1'));var util=require(_0xed0b('0x2'));var Redis=require(_0xed0b('0x3'));var config=require('../../../config/environment');config[_0xed0b('0x4')]=_[_0xed0b('0x5')](config[_0xed0b('0x4')],{'host':_0xed0b('0x6'),'port':0x18eb});var io=require(_0xed0b('0x7'))(new Redis(config[_0xed0b('0x4')]));function OpenchannelQueue(_0x355a31){this['id']=_0x355a31['id']||0x0;this[_0xed0b('0x8')]=_0x355a31[_0xed0b('0x8')]||'';this[_0xed0b('0x9')]=_0x355a31[_0xed0b('0x9')]||0xa;this[_0xed0b('0xa')]=_0x355a31[_0xed0b('0xa')]||_0xed0b('0xb');this[_0xed0b('0xc')]=_0x355a31['Agents'];this[_0xed0b('0xd')]={};this[_0xed0b('0xe')]=0x0;this[_0xed0b('0x1')]='';this[_0xed0b('0xf')]();this[_0xed0b('0x10')]();}OpenchannelQueue[_0xed0b('0x11')]['updateRouting']=function(){var _0x415cc5=this[_0xed0b('0xd')][_0xed0b('0x12')];this[_0xed0b('0xd')]=_['map'](this[_0xed0b('0xc')],'id');this[_0xed0b('0xd')]['_rr']=_0x415cc5;};OpenchannelQueue[_0xed0b('0x11')][_0xed0b('0x10')]=function(){this[_0xed0b('0x13')]=0x0;this[_0xed0b('0x14')]=0x0;for(var _0x1f5627=0x0;_0x1f5627=0x0?this[_0xed0b('0x18')]:0x0;var _0x5efc18={'id':this['id'],'available':this[_0xed0b('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xed0b('0x8')],'paused':this['paused'],'waiting':this[_0xed0b('0xe')]};var _0x822cfe=md5(JSON[_0xed0b('0x19')](_0x5efc18));if(this['md5']!==_0x822cfe){this[_0xed0b('0x1')]=_0x822cfe;io['to'](util['format'](_0xed0b('0x1a'),_0x5efc18[_0xed0b('0x8')]))[_0xed0b('0x1b')]('openchannel_queue:save',_0x5efc18);}};module[_0xed0b('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index a8fe4af..dadd186 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 _0xbaf0=['online','paused','available','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var md5=require(_0x0baf('0x0'));var util=require(_0x0baf('0x1'));var Redis=require(_0x0baf('0x2'));var config=require(_0x0baf('0x3'));config[_0x0baf('0x4')]=_[_0x0baf('0x5')](config['redis'],{'host':_0x0baf('0x6'),'port':0x18eb});var io=require(_0x0baf('0x7'))(new Redis(config[_0x0baf('0x4')]));function SmsQueue(_0x39b8f3){this['id']=_0x39b8f3['id']||0x0;this[_0x0baf('0x8')]=_0x39b8f3[_0x0baf('0x8')]||'';this[_0x0baf('0x9')]=_0x39b8f3[_0x0baf('0x9')]||0xa;this[_0x0baf('0xa')]=_0x39b8f3['strategy']||_0x0baf('0xb');this['Agents']=_0x39b8f3[_0x0baf('0xc')];this[_0x0baf('0xd')]={};this[_0x0baf('0xe')]=0x0;this[_0x0baf('0x0')]='';this[_0x0baf('0xf')]();this[_0x0baf('0x10')]();}SmsQueue[_0x0baf('0x11')][_0x0baf('0xf')]=function(){var _0x1fc6b2=this[_0x0baf('0xd')][_0x0baf('0x12')];this['mapAgentsId']=_['map'](this[_0x0baf('0xc')],'id');this[_0x0baf('0xd')][_0x0baf('0x12')]=_0x1fc6b2;};SmsQueue[_0x0baf('0x11')]['updateRealtime']=function(){this[_0x0baf('0x13')]=0x0;this['paused']=0x0;for(var _0x1c76a8=0x0;_0x1c76a8=0x0?this['available']:0x0;var _0x63c820={'id':this['id'],'available':this[_0x0baf('0x17')],'loggedIn':this[_0x0baf('0x13')],'name':this[_0x0baf('0x8')],'paused':this[_0x0baf('0x16')],'waiting':this[_0x0baf('0xe')]};var _0x4ff793=md5(JSON['stringify'](_0x63c820));if(this[_0x0baf('0x0')]!==_0x4ff793){this[_0x0baf('0x0')]=_0x4ff793;io['to'](util[_0x0baf('0x18')](_0x0baf('0x19'),_0x63c820[_0x0baf('0x8')]))[_0x0baf('0x1a')](_0x0baf('0x1b'),_0x63c820);}};module[_0x0baf('0x1c')]=SmsQueue; \ No newline at end of file +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(_0xc17427,_0x57cf5d){var _0x35a8c1=function(_0x231e3d){while(--_0x231e3d){_0xc17427['push'](_0xc17427['shift']());}};_0x35a8c1(++_0x57cf5d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x334d1e,_0x28a488){_0x334d1e=_0x334d1e-0x0;var _0x3b33ba=_0xcb91[_0x334d1e];return _0x3b33ba;};'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 diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b001138..4a9e960 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 _0xc7bd=['paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn'];(function(_0x3bd208,_0x3a59c2){var _0x97a34f=function(_0x55cb80){while(--_0x55cb80){_0x3bd208['push'](_0x3bd208['shift']());}};_0x97a34f(++_0x3a59c2);}(_0xc7bd,0x115));var _0xdc7b=function(_0x5bdf55,_0x770947){_0x5bdf55=_0x5bdf55-0x0;var _0x536329=_0xc7bd[_0x5bdf55];return _0x536329;};'use strict';var _=require(_0xdc7b('0x0'));var md5=require('md5');var util=require(_0xdc7b('0x1'));var Redis=require(_0xdc7b('0x2'));var config=require('../../../config/environment');config[_0xdc7b('0x3')]=_[_0xdc7b('0x4')](config[_0xdc7b('0x3')],{'host':_0xdc7b('0x5'),'port':0x18eb});var io=require(_0xdc7b('0x6'))(new Redis(config[_0xdc7b('0x3')]));function WhatsappQueue(_0x4e9652){this['id']=_0x4e9652['id']||0x0;this[_0xdc7b('0x7')]=_0x4e9652['name']||'';this[_0xdc7b('0x8')]=_0x4e9652[_0xdc7b('0x8')]||0xa;this[_0xdc7b('0x9')]=_0x4e9652[_0xdc7b('0x9')]||_0xdc7b('0xa');this[_0xdc7b('0xb')]=_0x4e9652[_0xdc7b('0xb')];this['mapAgentsId']={};this[_0xdc7b('0xc')]=0x0;this[_0xdc7b('0xd')]='';this['updateRouting']();this[_0xdc7b('0xe')]();}WhatsappQueue[_0xdc7b('0xf')][_0xdc7b('0x10')]=function(){var _0x19fd3c=this['mapAgentsId'][_0xdc7b('0x11')];this['mapAgentsId']=_[_0xdc7b('0x12')](this[_0xdc7b('0xb')],'id');this['mapAgentsId'][_0xdc7b('0x11')]=_0x19fd3c;};WhatsappQueue['prototype'][_0xdc7b('0xe')]=function(){this[_0xdc7b('0x13')]=0x0;this[_0xdc7b('0x14')]=0x0;for(var _0x10e7b4=0x0;_0x10e7b4=0x0?this[_0xdc7b('0x18')]:0x0;var _0x1865b5={'id':this['id'],'available':this[_0xdc7b('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xdc7b('0x7')],'paused':this[_0xdc7b('0x14')],'waiting':this[_0xdc7b('0xc')]};var _0xc976d5=md5(JSON['stringify'](_0x1865b5));if(this['md5']!==_0xc976d5){this[_0xdc7b('0xd')]=_0xc976d5;io['to'](util[_0xdc7b('0x19')](_0xdc7b('0x1a'),_0x1865b5[_0xdc7b('0x7')]))['emit']('whatsapp_queue:save',_0x1865b5);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x7a8c=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','whatsappPause','loggedIn','available','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout'];(function(_0x4ee9f4,_0x484733){var _0x4a80cb=function(_0x5a0490){while(--_0x5a0490){_0x4ee9f4['push'](_0x4ee9f4['shift']());}};_0x4a80cb(++_0x484733);}(_0x7a8c,0x146));var _0xc7a8=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x7a8c[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xc7a8('0x0'));var md5=require(_0xc7a8('0x1'));var util=require(_0xc7a8('0x2'));var Redis=require(_0xc7a8('0x3'));var config=require(_0xc7a8('0x4'));config[_0xc7a8('0x5')]=_[_0xc7a8('0x6')](config['redis'],{'host':_0xc7a8('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc7a8('0x5')]));function WhatsappQueue(_0x5545bc){this['id']=_0x5545bc['id']||0x0;this['name']=_0x5545bc[_0xc7a8('0x8')]||'';this[_0xc7a8('0x9')]=_0x5545bc['timeout']||0xa;this[_0xc7a8('0xa')]=_0x5545bc['strategy']||_0xc7a8('0xb');this[_0xc7a8('0xc')]=_0x5545bc['Agents'];this[_0xc7a8('0xd')]={};this[_0xc7a8('0xe')]=0x0;this[_0xc7a8('0x1')]='';this[_0xc7a8('0xf')]();this[_0xc7a8('0x10')]();}WhatsappQueue[_0xc7a8('0x11')]['updateRouting']=function(){var _0x283d93=this[_0xc7a8('0xd')][_0xc7a8('0x12')];this[_0xc7a8('0xd')]=_['map'](this['Agents'],'id');this[_0xc7a8('0xd')][_0xc7a8('0x12')]=_0x283d93;};WhatsappQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xc7a8('0x13')]=0x0;for(var _0x599870=0x0;_0x599870=0x0?this['available']:0x0;var _0x59cdb3={'id':this['id'],'available':this[_0xc7a8('0x16')],'loggedIn':this[_0xc7a8('0x15')],'name':this['name'],'paused':this[_0xc7a8('0x13')],'waiting':this[_0xc7a8('0xe')]};var _0x4081af=md5(JSON[_0xc7a8('0x17')](_0x59cdb3));if(this[_0xc7a8('0x1')]!==_0x4081af){this[_0xc7a8('0x1')]=_0x4081af;io['to'](util[_0xc7a8('0x18')](_0xc7a8('0x19'),_0x59cdb3[_0xc7a8('0x8')]))['emit'](_0xc7a8('0x1a'),_0x59cdb3);}};module[_0xc7a8('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index c5f503e..40b8e3d 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 _0xe14b=['initMailQueues','mailQueues','initFaxQueues','faxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','../model/agent','../model/interval','../model/chatQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues'];(function(_0x175e3f,_0x427787){var _0x1ba866=function(_0x4576df){while(--_0x4576df){_0x175e3f['push'](_0x175e3f['shift']());}};_0x1ba866(++_0x427787);}(_0xe14b,0x93));var _0xbe14=function(_0x528bac,_0x2f1aef){_0x528bac=_0x528bac-0x0;var _0x5ba7c9=_0xe14b[_0x528bac];return _0x5ba7c9;};'use strict';var BPromise=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0xbe14('0x2'));var Interval=require(_0xbe14('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0xbe14('0x4'));var SmsQueue=require('../model/smsQueue');var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0xbe14('0x5'));var WhatsappQueue=require(_0xbe14('0x6'));var Realtime=function(){this[_0xbe14('0x7')]={};this[_0xbe14('0x8')]={};this[_0xbe14('0x9')]={};this[_0xbe14('0xa')]={};this[_0xbe14('0xb')]={};this['mailQueues']={};this['faxQueues']={};this['whatsappQueues']={};this[_0xbe14('0xc')]={};this[_0xbe14('0xd')]={};this[_0xbe14('0xe')]={};this[_0xbe14('0xf')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x113243,_0x3f70cb,_0x4935cc){var _0x254c3b=_[_0xbe14('0x10')](_0x113243,function(_0x886a5e,_0x3d38c2){return _0x886a5e[_0x4935cc];});for(var _0x27792f in _0x3f70cb){if(_0x3f70cb[_0xbe14('0x11')](_0x27792f)){if(!_0x254c3b[_0x27792f]){delete _0x3f70cb[_0x27792f];}}}}Realtime[_0xbe14('0x12')][_0xbe14('0x13')]=function(_0x16893f,_0xa2cf72){for(var _0x1e4826 in _0xa2cf72){if(_0x16893f[_0xbe14('0x11')](_0x1e4826)){_0x16893f[_0x1e4826]=_0xa2cf72[_0x1e4826];}}};Realtime[_0xbe14('0x12')]['initAgents']=function(){var _0x55b3a7=this;return function(_0x3f58f5){if(_0x3f58f5){freeIsNotKey(_0x3f58f5,_0x55b3a7[_0xbe14('0x7')],'id');for(var _0xf4ac9=0x0,_0x37ce4e={},_0x4e8f34={};_0xf4ac9<_0x3f58f5[_0xbe14('0x14')];_0xf4ac9+=0x1){_0x37ce4e=_0x3f58f5[_0xf4ac9];if(_[_0xbe14('0x15')](_0x55b3a7[_0xbe14('0x7')][_0x37ce4e['id']])){_0x55b3a7[_0xbe14('0x7')][_0x37ce4e['id']]=new Agent(_0x37ce4e);}else{_0x55b3a7[_0xbe14('0x13')](_0x55b3a7[_0xbe14('0x7')][_0x37ce4e['id']],_0x37ce4e);}}}return _0x55b3a7[_0xbe14('0x7')];};};Realtime['prototype'][_0xbe14('0x16')]=function(){var _0x456ca8=this;return function(_0x329588){if(_0x329588){freeIsNotKey(_0x329588,_0x456ca8[_0xbe14('0x8')],'id');for(var _0x3249da=0x0,_0x37e4c1={},_0x59a9e3={};_0x3249da<_0x329588[_0xbe14('0x14')];_0x3249da+=0x1){_0x37e4c1=_0x329588[_0x3249da];if(_[_0xbe14('0x15')](_0x456ca8[_0xbe14('0x8')][_0x37e4c1['id']])){_0x456ca8[_0xbe14('0x8')][_0x37e4c1['id']]=new Interval(_0x37e4c1);}else{_0x456ca8[_0xbe14('0x13')](_0x456ca8['intervals'][_0x37e4c1['id']],_0x37e4c1);}}}return _0x456ca8[_0xbe14('0x8')];};};Realtime['prototype'][_0xbe14('0x17')]=function(){var _0x56e80c=this;return function(_0x32e8eb){if(_0x32e8eb){freeIsNotKey(_0x32e8eb,_0x56e80c['openchannelQueues'],'id');for(var _0x274018=0x0,_0x3d3608={},_0x505dbd={};_0x274018<_0x32e8eb[_0xbe14('0x14')];_0x274018+=0x1){_0x3d3608=_0x32e8eb[_0x274018];if(_['isUndefined'](_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']])){_0x56e80c['openchannelQueues'][_0x3d3608['id']]=new OpenchannelQueue(_0x3d3608);}else{_0x56e80c[_0xbe14('0x13')](_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']],_0x3d3608);}_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']][_0xbe14('0x18')]();_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']][_0xbe14('0x19')]();}}return _0x56e80c['openchannelQueues'];};};Realtime[_0xbe14('0x12')][_0xbe14('0x1a')]=function(){var _0x391556=this;return function(_0x169369){if(_0x169369){freeIsNotKey(_0x169369,_0x391556['chatQueues'],'id');for(var _0x16f884=0x0,_0x29fc64={},_0x59bf34={};_0x16f884<_0x169369[_0xbe14('0x14')];_0x16f884+=0x1){_0x29fc64=_0x169369[_0x16f884];if(_[_0xbe14('0x15')](_0x391556[_0xbe14('0xa')][_0x29fc64['id']])){_0x391556[_0xbe14('0xa')][_0x29fc64['id']]=new ChatQueue(_0x29fc64);}else{_0x391556[_0xbe14('0x13')](_0x391556[_0xbe14('0xa')][_0x29fc64['id']],_0x29fc64);}_0x391556[_0xbe14('0xa')][_0x29fc64['id']][_0xbe14('0x18')]();_0x391556[_0xbe14('0xa')][_0x29fc64['id']][_0xbe14('0x19')]();}}return _0x391556[_0xbe14('0xa')];};};Realtime[_0xbe14('0x12')][_0xbe14('0x1b')]=function(){var _0x10ae36=this;return function(_0x223f7a){if(_0x223f7a){freeIsNotKey(_0x223f7a,_0x10ae36[_0xbe14('0xb')],'id');for(var _0x6ba36c=0x0,_0x2ff48e={},_0x29e76a={};_0x6ba36c<_0x223f7a[_0xbe14('0x14')];_0x6ba36c+=0x1){_0x2ff48e=_0x223f7a[_0x6ba36c];if(_['isUndefined'](_0x10ae36[_0xbe14('0xb')][_0x2ff48e['id']])){_0x10ae36['smsQueues'][_0x2ff48e['id']]=new SmsQueue(_0x2ff48e);}else{_0x10ae36['mergeFromDatabase'](_0x10ae36[_0xbe14('0xb')][_0x2ff48e['id']],_0x2ff48e);}_0x10ae36['smsQueues'][_0x2ff48e['id']][_0xbe14('0x18')]();_0x10ae36[_0xbe14('0xb')][_0x2ff48e['id']]['updateRealtime']();}}return _0x10ae36['smsQueues'];};};Realtime['prototype'][_0xbe14('0x1c')]=function(){var _0xa3d24=this;return function(_0x5f27b6){if(_0x5f27b6){freeIsNotKey(_0x5f27b6,_0xa3d24[_0xbe14('0x1d')],'id');for(var _0x1faf3e=0x0,_0x452635={},_0x1aa849={};_0x1faf3e<_0x5f27b6[_0xbe14('0x14')];_0x1faf3e+=0x1){_0x452635=_0x5f27b6[_0x1faf3e];if(_['isUndefined'](_0xa3d24['mailQueues'][_0x452635['id']])){_0xa3d24[_0xbe14('0x1d')][_0x452635['id']]=new MailQueue(_0x452635);}else{_0xa3d24['mergeFromDatabase'](_0xa3d24['mailQueues'][_0x452635['id']],_0x452635);}_0xa3d24['mailQueues'][_0x452635['id']][_0xbe14('0x18')]();_0xa3d24[_0xbe14('0x1d')][_0x452635['id']][_0xbe14('0x19')]();}}return _0xa3d24[_0xbe14('0x1d')];};};Realtime[_0xbe14('0x12')][_0xbe14('0x1e')]=function(){var _0xcdc50=this;return function(_0x10ec3c){if(_0x10ec3c){freeIsNotKey(_0x10ec3c,_0xcdc50[_0xbe14('0x1f')],'id');for(var _0x2dfd5a=0x0,_0x41652d={},_0x32c59d={};_0x2dfd5a<_0x10ec3c['length'];_0x2dfd5a+=0x1){_0x41652d=_0x10ec3c[_0x2dfd5a];if(_['isUndefined'](_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']])){_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']]=new FaxQueue(_0x41652d);}else{_0xcdc50[_0xbe14('0x13')](_0xcdc50['faxQueues'][_0x41652d['id']],_0x41652d);}_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']][_0xbe14('0x18')]();_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']][_0xbe14('0x19')]();}}return _0xcdc50[_0xbe14('0x1f')];};};Realtime[_0xbe14('0x12')][_0xbe14('0x20')]=function(){var _0x128843=this;return function(_0x1b2608){if(_0x1b2608){freeIsNotKey(_0x1b2608,_0x128843['whatsappQueues'],'id');for(var _0xe51424=0x0,_0x841b71={},_0x3463c4={};_0xe51424<_0x1b2608[_0xbe14('0x14')];_0xe51424+=0x1){_0x841b71=_0x1b2608[_0xe51424];if(_[_0xbe14('0x15')](_0x128843[_0xbe14('0x21')][_0x841b71['id']])){_0x128843['whatsappQueues'][_0x841b71['id']]=new WhatsappQueue(_0x841b71);}else{_0x128843[_0xbe14('0x13')](_0x128843[_0xbe14('0x21')][_0x841b71['id']],_0x841b71);}_0x128843[_0xbe14('0x21')][_0x841b71['id']][_0xbe14('0x18')]();_0x128843['whatsappQueues'][_0x841b71['id']]['updateRealtime']();}}return _0x128843[_0xbe14('0x21')];};};module[_0xbe14('0x22')]=Realtime; \ No newline at end of file +var _0x4b84=['../model/agent','../model/chatQueue','../model/smsQueue','../model/mailQueue','intervals','chatQueues','mailQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty','agents','isUndefined','mergeFromDatabase','length','initOpenchannelQueues','openchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','faxQueues','initWhatsappQueues','whatsappQueues','bluebird','util'];(function(_0x24db36,_0x50b247){var _0x541cd7=function(_0x1b83fe){while(--_0x1b83fe){_0x24db36['push'](_0x24db36['shift']());}};_0x541cd7(++_0x50b247);}(_0x4b84,0x1cc));var _0x44b8=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0x4b84[_0x265003];return _0x33c743;};'use strict';var BPromise=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x44b8('0x2'));var Interval=require('../model/interval');var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x44b8('0x3'));var SmsQueue=require(_0x44b8('0x4'));var MailQueue=require(_0x44b8('0x5'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this['agents']={};this[_0x44b8('0x6')]={};this['openchannelQueues']={};this[_0x44b8('0x7')]={};this['smsQueues']={};this[_0x44b8('0x8')]={};this['faxQueues']={};this['whatsappQueues']={};this[_0x44b8('0x9')]={};this[_0x44b8('0xa')]={};this[_0x44b8('0xb')]={};this['smsQueuesWaitingInteractions']={};this[_0x44b8('0xc')]={};this[_0x44b8('0xd')]={};};function freeIsNotKey(_0x4315f6,_0x9b6048,_0x24dd10){var _0x37e471=_[_0x44b8('0xe')](_0x4315f6,function(_0x4ae8a1,_0x147529){return _0x4ae8a1[_0x24dd10];});for(var _0x4301a6 in _0x9b6048){if(_0x9b6048['hasOwnProperty'](_0x4301a6)){if(!_0x37e471[_0x4301a6]){delete _0x9b6048[_0x4301a6];}}}}Realtime[_0x44b8('0xf')]['mergeFromDatabase']=function(_0x833ea3,_0x18d642){for(var _0x4df670 in _0x18d642){if(_0x833ea3[_0x44b8('0x10')](_0x4df670)){_0x833ea3[_0x4df670]=_0x18d642[_0x4df670];}}};Realtime['prototype']['initAgents']=function(){var _0x2a3e4c=this;return function(_0x2af0ad){if(_0x2af0ad){freeIsNotKey(_0x2af0ad,_0x2a3e4c[_0x44b8('0x11')],'id');for(var _0x41ab46=0x0,_0x5e52f2={},_0x495c74={};_0x41ab46<_0x2af0ad['length'];_0x41ab46+=0x1){_0x5e52f2=_0x2af0ad[_0x41ab46];if(_[_0x44b8('0x12')](_0x2a3e4c['agents'][_0x5e52f2['id']])){_0x2a3e4c[_0x44b8('0x11')][_0x5e52f2['id']]=new Agent(_0x5e52f2);}else{_0x2a3e4c[_0x44b8('0x13')](_0x2a3e4c['agents'][_0x5e52f2['id']],_0x5e52f2);}}}return _0x2a3e4c[_0x44b8('0x11')];};};Realtime[_0x44b8('0xf')]['initIntervals']=function(){var _0x89bc30=this;return function(_0x3f4688){if(_0x3f4688){freeIsNotKey(_0x3f4688,_0x89bc30['intervals'],'id');for(var _0xcce202=0x0,_0x8b4301={},_0xebfe79={};_0xcce202<_0x3f4688[_0x44b8('0x14')];_0xcce202+=0x1){_0x8b4301=_0x3f4688[_0xcce202];if(_[_0x44b8('0x12')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']])){_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']]=new Interval(_0x8b4301);}else{_0x89bc30[_0x44b8('0x13')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']],_0x8b4301);}}}return _0x89bc30[_0x44b8('0x6')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x15')]=function(){var _0x48327e=this;return function(_0x56549a){if(_0x56549a){freeIsNotKey(_0x56549a,_0x48327e[_0x44b8('0x16')],'id');for(var _0x416b34=0x0,_0x1418db={},_0x305a5c={};_0x416b34<_0x56549a['length'];_0x416b34+=0x1){_0x1418db=_0x56549a[_0x416b34];if(_[_0x44b8('0x12')](_0x48327e['openchannelQueues'][_0x1418db['id']])){_0x48327e[_0x44b8('0x16')][_0x1418db['id']]=new OpenchannelQueue(_0x1418db);}else{_0x48327e[_0x44b8('0x13')](_0x48327e[_0x44b8('0x16')][_0x1418db['id']],_0x1418db);}_0x48327e[_0x44b8('0x16')][_0x1418db['id']][_0x44b8('0x17')]();_0x48327e['openchannelQueues'][_0x1418db['id']][_0x44b8('0x18')]();}}return _0x48327e['openchannelQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x19')]=function(){var _0x549a26=this;return function(_0x17ac44){if(_0x17ac44){freeIsNotKey(_0x17ac44,_0x549a26[_0x44b8('0x7')],'id');for(var _0x2656d7=0x0,_0x59c1bf={},_0xb22107={};_0x2656d7<_0x17ac44[_0x44b8('0x14')];_0x2656d7+=0x1){_0x59c1bf=_0x17ac44[_0x2656d7];if(_['isUndefined'](_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']])){_0x549a26['chatQueues'][_0x59c1bf['id']]=new ChatQueue(_0x59c1bf);}else{_0x549a26[_0x44b8('0x13')](_0x549a26['chatQueues'][_0x59c1bf['id']],_0x59c1bf);}_0x549a26['chatQueues'][_0x59c1bf['id']]['updateRouting']();_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']][_0x44b8('0x18')]();}}return _0x549a26[_0x44b8('0x7')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1a')]=function(){var _0xc3f667=this;return function(_0x2cf205){if(_0x2cf205){freeIsNotKey(_0x2cf205,_0xc3f667[_0x44b8('0x1b')],'id');for(var _0xd1d320=0x0,_0x28f918={},_0x5e1129={};_0xd1d320<_0x2cf205[_0x44b8('0x14')];_0xd1d320+=0x1){_0x28f918=_0x2cf205[_0xd1d320];if(_[_0x44b8('0x12')](_0xc3f667['smsQueues'][_0x28f918['id']])){_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']]=new SmsQueue(_0x28f918);}else{_0xc3f667['mergeFromDatabase'](_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']],_0x28f918);}_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x17')]();_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x18')]();}}return _0xc3f667['smsQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1c')]=function(){var _0x26265f=this;return function(_0x339f0f){if(_0x339f0f){freeIsNotKey(_0x339f0f,_0x26265f[_0x44b8('0x8')],'id');for(var _0x5f541d=0x0,_0x3875a5={},_0x400edc={};_0x5f541d<_0x339f0f[_0x44b8('0x14')];_0x5f541d+=0x1){_0x3875a5=_0x339f0f[_0x5f541d];if(_[_0x44b8('0x12')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']])){_0x26265f[_0x44b8('0x8')][_0x3875a5['id']]=new MailQueue(_0x3875a5);}else{_0x26265f[_0x44b8('0x13')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']],_0x3875a5);}_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x17')]();_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x18')]();}}return _0x26265f[_0x44b8('0x8')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1d')]=function(){var _0x1becb0=this;return function(_0x323c50){if(_0x323c50){freeIsNotKey(_0x323c50,_0x1becb0[_0x44b8('0x1e')],'id');for(var _0x28faa9=0x0,_0x3984f8={},_0x2c02d6={};_0x28faa9<_0x323c50[_0x44b8('0x14')];_0x28faa9+=0x1){_0x3984f8=_0x323c50[_0x28faa9];if(_['isUndefined'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']])){_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]=new FaxQueue(_0x3984f8);}else{_0x1becb0['mergeFromDatabase'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']],_0x3984f8);}_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']][_0x44b8('0x17')]();_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]['updateRealtime']();}}return _0x1becb0[_0x44b8('0x1e')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1f')]=function(){var _0x1ee3cc=this;return function(_0x9cb2a){if(_0x9cb2a){freeIsNotKey(_0x9cb2a,_0x1ee3cc[_0x44b8('0x20')],'id');for(var _0x46aadd=0x0,_0x3581b8={},_0x209039={};_0x46aadd<_0x9cb2a[_0x44b8('0x14')];_0x46aadd+=0x1){_0x3581b8=_0x9cb2a[_0x46aadd];if(_[_0x44b8('0x12')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']])){_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]=new WhatsappQueue(_0x3581b8);}else{_0x1ee3cc[_0x44b8('0x13')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']],_0x3581b8);}_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]['updateRouting']();_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']][_0x44b8('0x18')]();}}return _0x1ee3cc[_0x44b8('0x20')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index ea5f8d4..f019766 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 _0xd850=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x4248e9,_0x19f4bc){var _0x4a26af=function(_0x4fa24a){while(--_0x4fa24a){_0x4248e9['push'](_0x4248e9['shift']());}};_0x4a26af(++_0x19f4bc);}(_0xd850,0x127));var _0x0d85=function(_0x128a9c,_0x1370e6){_0x128a9c=_0x128a9c-0x0;var _0x3a5ba6=_0xd850[_0x128a9c];return _0x3a5ba6;};'use strict';var client=require(_0x0d85('0x0'));exports[_0x0d85('0x1')]=function(_0x2c7847,_0x158976){return client[_0x0d85('0x2')](_0x0d85('0x3'),{'body':_0x158976,'options':{'where':{'id':_0x2c7847}},'log':_0x0d85('0x4')});};exports[_0x0d85('0x5')]=function(_0x57f5ab,_0x2cb5c7){return client[_0x0d85('0x2')](_0x0d85('0x6'),{'body':_0x2cb5c7,'options':{'where':{'id':_0x57f5ab}},'log':_0x0d85('0x7')});}; \ No newline at end of file +var _0x5f59=['update','Request','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x2245ab,_0x388bad){var _0x125382=function(_0x10f8ab){while(--_0x10f8ab){_0x2245ab['push'](_0x2245ab['shift']());}};_0x125382(++_0x388bad);}(_0x5f59,0x131));var _0x95f5=function(_0x474c24,_0x35b08b){_0x474c24=_0x474c24-0x0;var _0x2857b7=_0x5f59[_0x474c24];return _0x2857b7;};'use strict';var client=require(_0x95f5('0x0'));exports[_0x95f5('0x1')]=function(_0x3fb029,_0x48cfd3){return client[_0x95f5('0x2')]('UpdateChatInteraction',{'body':_0x48cfd3,'options':{'where':{'id':_0x3fb029}},'log':'updateChatInteraction'});};exports[_0x95f5('0x3')]=function(_0xcb03cf,_0x4008b6){return client[_0x95f5('0x2')](_0x95f5('0x4'),{'body':_0x4008b6,'options':{'where':{'id':_0xcb03cf}},'log':_0x95f5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 9b789d2..dd3d546 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 _0x5178=['createChatMessage','create','Request','CreateChatMessage'];(function(_0x1357be,_0x2947ed){var _0x338882=function(_0x66f99c){while(--_0x66f99c){_0x1357be['push'](_0x1357be['shift']());}};_0x338882(++_0x2947ed);}(_0x5178,0x149));var _0x8517=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5178[_0x1facfa];return _0x9ec701;};'use strict';var client=require('../client');exports[_0x8517('0x0')]=function(_0x1e482c){return client[_0x8517('0x1')](_0x8517('0x2'),{'body':_0x1e482c,'log':_0x8517('0x3')});}; \ No newline at end of file +var _0x5ef0=['create','createChatMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ef0,0x130));var _0x05ef=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5ef0[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0x05ef('0x0')]=function(_0x4d9988){return client['Request']('CreateChatMessage',{'body':_0x4d9988,'log':_0x05ef('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 2fb2b06..0b93182 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 _0x0210=['online','chatPause','../client','getChatQueues','Request','User','Agents'];(function(_0x14b3fa,_0x2112ab){var _0x21319d=function(_0x5df354){while(--_0x5df354){_0x14b3fa['push'](_0x14b3fa['shift']());}};_0x21319d(++_0x2112ab);}(_0x0210,0x136));var _0x0021=function(_0x3da6d1,_0x3f53a){_0x3da6d1=_0x3da6d1-0x0;var _0xfff18c=_0x0210[_0x3da6d1];return _0xfff18c;};'use strict';var client=require(_0x0021('0x0'));exports[_0x0021('0x1')]=function(){return function(){return client[_0x0021('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x0021('0x3'),'as':_0x0021('0x4'),'attributes':['id','name',_0x0021('0x5'),_0x0021('0x6')]}]},'log':_0x0021('0x1')});};}; \ No newline at end of file +var _0x86e3=['GetChatQueue','name','User','Agents','online','getChatQueues'];(function(_0x5fe9ac,_0x587f42){var _0x37d039=function(_0x4cea7f){while(--_0x4cea7f){_0x5fe9ac['push'](_0x5fe9ac['shift']());}};_0x37d039(++_0x587f42);}(_0x86e3,0x1aa));var _0x386e=function(_0x457549,_0x3e0f46){_0x457549=_0x457549-0x0;var _0x3c1d6f=_0x86e3[_0x457549];return _0x3c1d6f;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client['Request'](_0x386e('0x0'),{'options':{'raw':![],'attributes':['id',_0x386e('0x1'),'timeout','strategy'],'include':[{'model':_0x386e('0x2'),'as':_0x386e('0x3'),'attributes':['id',_0x386e('0x1'),_0x386e('0x4'),'chatPause']}]},'log':_0x386e('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 8f865a8..0e8ef14 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 _0x90ae=['create','CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC','../client'];(function(_0x162f62,_0x3a9bfb){var _0x2157b3=function(_0x2e50fc){while(--_0x2e50fc){_0x162f62['push'](_0x162f62['shift']());}};_0x2157b3(++_0x3a9bfb);}(_0x90ae,0x195));var _0xe90a=function(_0x524269,_0x4353eb){_0x524269=_0x524269-0x0;var _0x79c72d=_0x90ae[_0x524269];return _0x79c72d;};'use strict';var client=require(_0xe90a('0x0'));exports[_0xe90a('0x1')]=function(_0x384758){return client['Request'](_0xe90a('0x2'),{'body':_0x384758,'log':_0xe90a('0x2')});};exports[_0xe90a('0x3')]=function(_0xcb31b6,_0x2b677c){return client[_0xe90a('0x4')](_0xe90a('0x5'),{'body':_0x2b677c,'options':{'where':{'uniqueid':_0xcb31b6},'order':[['id',_0xe90a('0x6')]],'limit':0x1},'log':_0xe90a('0x5')});}; \ No newline at end of file +var _0x1542=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x1542,0x116));var _0x2154=function(_0x41c53f,_0x452056){_0x41c53f=_0x41c53f-0x0;var _0x2aadb1=_0x1542[_0x41c53f];return _0x2aadb1;};'use strict';var client=require(_0x2154('0x0'));exports[_0x2154('0x1')]=function(_0x24448e){return client[_0x2154('0x2')](_0x2154('0x3'),{'body':_0x24448e,'log':'CreateChatQueueReport'});};exports[_0x2154('0x4')]=function(_0x376a87,_0x13e41b){return client['Request'](_0x2154('0x5'),{'body':_0x13e41b,'options':{'where':{'uniqueid':_0x376a87},'order':[['id',_0x2154('0x6')]],'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 8ebdfde..06e27f7 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 _0x0de3=['update','Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0de3,0x137));var _0x30de=function(_0x623c4,_0xbf74ca){_0x623c4=_0x623c4-0x0;var _0x433fb2=_0x0de3[_0x623c4];return _0x433fb2;};'use strict';var client=require(_0x30de('0x0'));exports[_0x30de('0x1')]=function(_0x88d483,_0x363184){return client[_0x30de('0x2')](_0x30de('0x3'),{'body':_0x363184,'options':{'where':{'id':_0x88d483}},'log':_0x30de('0x4')});};exports[_0x30de('0x5')]=function(_0x21fe62,_0x37e746){return client['Request'](_0x30de('0x6'),{'body':_0x37e746,'options':{'where':{'id':_0x21fe62}},'log':_0x30de('0x7')});}; \ No newline at end of file +var _0x3693=['../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags','Request'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x3693,0x9c));var _0x3369=function(_0x178686,_0x3cd6a5){_0x178686=_0x178686-0x0;var _0x36b82e=_0x3693[_0x178686];return _0x36b82e;};'use strict';var client=require(_0x3369('0x0'));exports[_0x3369('0x1')]=function(_0x138391,_0x357981){return client['Request'](_0x3369('0x2'),{'body':_0x357981,'options':{'where':{'id':_0x138391}},'log':_0x3369('0x3')});};exports[_0x3369('0x4')]=function(_0x11984f,_0x94676e){return client[_0x3369('0x5')]('AddTagsToFaxInteraction',{'body':_0x94676e,'options':{'where':{'id':_0x11984f}},'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 af41402..064ff93 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 _0x36a7=['create','CreateFaxMessage','../client'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x36a7,0x17f));var _0x736a=function(_0x27aed8,_0x230fc1){_0x27aed8=_0x27aed8-0x0;var _0x574952=_0x36a7[_0x27aed8];return _0x574952;};'use strict';var client=require(_0x736a('0x0'));exports[_0x736a('0x1')]=function(_0x4eeb30){return client['Request'](_0x736a('0x2'),{'body':_0x4eeb30,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x01c1=['create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x40db20,_0x5c5ef7){var _0x27ee31=function(_0x573468){while(--_0x573468){_0x40db20['push'](_0x40db20['shift']());}};_0x27ee31(++_0x5c5ef7);}(_0x01c1,0x94));var _0x101c=function(_0x1b212b,_0xfed4e){_0x1b212b=_0x1b212b-0x0;var _0x138cd0=_0x01c1[_0x1b212b];return _0x138cd0;};'use strict';var client=require('../client');exports[_0x101c('0x0')]=function(_0x1a7892){return client[_0x101c('0x1')](_0x101c('0x2'),{'body':_0x1a7892,'log':_0x101c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 4129c5f..e407c20 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 _0x4f42=['getFaxQueues','Request','GetFaxQueue','name','timeout','User','online','faxPause','../client'];(function(_0x26d386,_0x1660c0){var _0x4ef9a8=function(_0x55e2d3){while(--_0x55e2d3){_0x26d386['push'](_0x26d386['shift']());}};_0x4ef9a8(++_0x1660c0);}(_0x4f42,0x167));var _0x24f4=function(_0x5d3b00,_0x1eb66f){_0x5d3b00=_0x5d3b00-0x0;var _0x5813e8=_0x4f42[_0x5d3b00];return _0x5813e8;};'use strict';var client=require(_0x24f4('0x0'));exports[_0x24f4('0x1')]=function(){return function(){return client[_0x24f4('0x2')](_0x24f4('0x3'),{'options':{'raw':![],'attributes':['id',_0x24f4('0x4'),_0x24f4('0x5'),'strategy'],'include':[{'model':_0x24f4('0x6'),'as':'Agents','attributes':['id',_0x24f4('0x4'),_0x24f4('0x7'),_0x24f4('0x8')]}]},'log':_0x24f4('0x1')});};}; \ No newline at end of file +var _0x5f50=['strategy','User','faxPause','../client','getFaxQueues','GetFaxQueue','name'];(function(_0x3727ae,_0x165f88){var _0x1c3f01=function(_0x5cd5a5){while(--_0x5cd5a5){_0x3727ae['push'](_0x3727ae['shift']());}};_0x1c3f01(++_0x165f88);}(_0x5f50,0x1ca));var _0x05f5=function(_0xe2a1aa,_0x525d7b){_0xe2a1aa=_0xe2a1aa-0x0;var _0x5a8362=_0x5f50[_0xe2a1aa];return _0x5a8362;};'use strict';var client=require(_0x05f5('0x0'));exports[_0x05f5('0x1')]=function(){return function(){return client['Request'](_0x05f5('0x2'),{'options':{'raw':![],'attributes':['id',_0x05f5('0x3'),'timeout',_0x05f5('0x4')],'include':[{'model':_0x05f5('0x5'),'as':'Agents','attributes':['id',_0x05f5('0x3'),'online',_0x05f5('0x6')]}]},'log':_0x05f5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index dd45c9d..af05f15 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 _0x0a9e=['update','UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0x0a9e,0x1c5));var _0xe0a9=function(_0x25aa24,_0x47fe6b){_0x25aa24=_0x25aa24-0x0;var _0x947233=_0x0a9e[_0x25aa24];return _0x947233;};'use strict';var client=require(_0xe0a9('0x0'));exports[_0xe0a9('0x1')]=function(_0x2dd2ca){return client['Request'](_0xe0a9('0x2'),{'body':_0x2dd2ca,'log':_0xe0a9('0x2')});};exports[_0xe0a9('0x3')]=function(_0x5c7f2b,_0x106a6a){return client['Request'](_0xe0a9('0x4'),{'body':_0x106a6a,'options':{'where':{'uniqueid':_0x5c7f2b},'order':[['id',_0xe0a9('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x6523=['CreateFaxQueueReport','UpdateFaxQueueReport','../client','create','Request'];(function(_0x7a112,_0x2eb4a0){var _0x136dc5=function(_0x437650){while(--_0x437650){_0x7a112['push'](_0x7a112['shift']());}};_0x136dc5(++_0x2eb4a0);}(_0x6523,0x1a6));var _0x3652=function(_0x24c178,_0x2e588b){_0x24c178=_0x24c178-0x0;var _0x35a2d8=_0x6523[_0x24c178];return _0x35a2d8;};'use strict';var client=require(_0x3652('0x0'));exports[_0x3652('0x1')]=function(_0x4a5fdf){return client[_0x3652('0x2')](_0x3652('0x3'),{'body':_0x4a5fdf,'log':_0x3652('0x3')});};exports['update']=function(_0x18a487,_0x35dcd9){return client[_0x3652('0x2')](_0x3652('0x4'),{'body':_0x35dcd9,'options':{'where':{'uniqueid':_0x18a487},'order':[['id','DESC']],'limit':0x1},'log':_0x3652('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 7bfc3b7..1d5c934 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 _0xdd4f=['interval','getIntervals','../client','name','Interval'];(function(_0x58ab22,_0x42c988){var _0x3bedba=function(_0x121f16){while(--_0x121f16){_0x58ab22['push'](_0x58ab22['shift']());}};_0x3bedba(++_0x42c988);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0xc4879e,_0x32fc57){_0xc4879e=_0xc4879e-0x0;var _0xcb113b=_0xdd4f[_0xc4879e];return _0xcb113b;};'use strict';var client=require(_0xfdd4('0x0'));exports['getIntervals']=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xfdd4('0x1')],'include':[{'model':_0xfdd4('0x2'),'as':'Intervals','attributes':['id',_0xfdd4('0x1'),_0xfdd4('0x3')]}]},'log':_0xfdd4('0x4')});};}; \ No newline at end of file +var _0x49f8=['../client','GetInterval','name','Intervals','interval'];(function(_0x56c7b9,_0xedf603){var _0x513097=function(_0x20d8db){while(--_0x20d8db){_0x56c7b9['push'](_0x56c7b9['shift']());}};_0x513097(++_0xedf603);}(_0x49f8,0xff));var _0x849f=function(_0x5cdf85,_0x4f5610){_0x5cdf85=_0x5cdf85-0x0;var _0x109a19=_0x49f8[_0x5cdf85];return _0x109a19;};'use strict';var client=require(_0x849f('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0x849f('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x849f('0x2')],'include':[{'model':'Interval','as':_0x849f('0x3'),'attributes':['id','name',_0x849f('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 79c94fb..8eb750e 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 _0x1a1d=['updateMailInteraction','../client','update','Request','UpdateMailInteraction'];(function(_0x1b852e,_0x185f0d){var _0x2fd5cf=function(_0x1dc638){while(--_0x1dc638){_0x1b852e['push'](_0x1b852e['shift']());}};_0x2fd5cf(++_0x185f0d);}(_0x1a1d,0x150));var _0xd1a1=function(_0x46ec98,_0x1244ce){_0x46ec98=_0x46ec98-0x0;var _0x2680f0=_0x1a1d[_0x46ec98];return _0x2680f0;};'use strict';var client=require(_0xd1a1('0x0'));exports[_0xd1a1('0x1')]=function(_0x212937,_0x26a24a){return client[_0xd1a1('0x2')](_0xd1a1('0x3'),{'body':_0x26a24a,'options':{'where':{'id':_0x212937}},'log':_0xd1a1('0x4')});};exports['addTags']=function(_0x18430f,_0xa57b12){return client[_0xd1a1('0x2')]('AddTagsToMailInteraction',{'body':_0xa57b12,'options':{'where':{'id':_0x18430f}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x9b7d=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','updateMailInteraction'];(function(_0x243e82,_0x50326d){var _0x44babd=function(_0x4504f8){while(--_0x4504f8){_0x243e82['push'](_0x243e82['shift']());}};_0x44babd(++_0x50326d);}(_0x9b7d,0x88));var _0xd9b7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9b7d[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0xd9b7('0x0'));exports[_0xd9b7('0x1')]=function(_0x4363a6,_0x261bfd){return client[_0xd9b7('0x2')]('UpdateMailInteraction',{'body':_0x261bfd,'options':{'where':{'id':_0x4363a6}},'log':_0xd9b7('0x3')});};exports[_0xd9b7('0x4')]=function(_0x560425,_0x3ec0a8){return client['Request'](_0xd9b7('0x5'),{'body':_0x3ec0a8,'options':{'where':{'id':_0x560425}},'log':_0xd9b7('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index c66bd1e..860e660 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 _0xa4d6=['create','CreateMailMessage','createMailMessage','../client'];(function(_0x7e3f06,_0x426f70){var _0x12b8ff=function(_0x47c83c){while(--_0x47c83c){_0x7e3f06['push'](_0x7e3f06['shift']());}};_0x12b8ff(++_0x426f70);}(_0xa4d6,0xd3));var _0x6a4d=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xa4d6[_0xef8146];return _0x5a6cb0;};'use strict';var client=require(_0x6a4d('0x0'));exports[_0x6a4d('0x1')]=function(_0x428a2e){return client['Request'](_0x6a4d('0x2'),{'body':_0x428a2e,'log':_0x6a4d('0x3')});}; \ No newline at end of file +var _0xee6e=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x55dcef,_0x13de5c){var _0x40e2e7=function(_0x1eed20){while(--_0x1eed20){_0x55dcef['push'](_0x55dcef['shift']());}};_0x40e2e7(++_0x13de5c);}(_0xee6e,0x75));var _0xeee6=function(_0x29e0c8,_0x41a939){_0x29e0c8=_0x29e0c8-0x0;var _0x2e356f=_0xee6e[_0x29e0c8];return _0x2e356f;};'use strict';var client=require(_0xeee6('0x0'));exports[_0xeee6('0x1')]=function(_0x41137c){return client[_0xeee6('0x2')](_0xeee6('0x3'),{'body':_0x41137c,'log':_0xeee6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 45b7b1a..98b91bb 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 _0x9041=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','User','Agents','name'];(function(_0x304b67,_0x31cb39){var _0x493afb=function(_0x21dce3){while(--_0x21dce3){_0x304b67['push'](_0x304b67['shift']());}};_0x493afb(++_0x31cb39);}(_0x9041,0x12b));var _0x1904=function(_0x1f2129,_0x37fed3){_0x1f2129=_0x1f2129-0x0;var _0x2bc546=_0x9041[_0x1f2129];return _0x2bc546;};'use strict';var client=require(_0x1904('0x0'));exports[_0x1904('0x1')]=function(){return function(){return client[_0x1904('0x2')](_0x1904('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x1904('0x4'),'as':_0x1904('0x5'),'attributes':['id',_0x1904('0x6'),_0x1904('0x7'),_0x1904('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x9c36=['../client','getMailQueues','Request','name','timeout','strategy','User','Agents','mailPause'];(function(_0x1ab313,_0x12bccc){var _0x2d73f4=function(_0x225f28){while(--_0x225f28){_0x1ab313['push'](_0x1ab313['shift']());}};_0x2d73f4(++_0x12bccc);}(_0x9c36,0x117));var _0x69c3=function(_0xd39e58,_0xe2c0ec){_0xd39e58=_0xd39e58-0x0;var _0x3664ea=_0x9c36[_0xd39e58];return _0x3664ea;};'use strict';var client=require(_0x69c3('0x0'));exports[_0x69c3('0x1')]=function(){return function(){return client[_0x69c3('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x69c3('0x3'),_0x69c3('0x4'),_0x69c3('0x5')],'include':[{'model':_0x69c3('0x6'),'as':_0x69c3('0x7'),'attributes':['id','name','online',_0x69c3('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index ec64aff..d895f91 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 _0xcf28=['Request','UpdateMailQueueReport','DESC','../client','create','CreateMailQueueReport','update'];(function(_0x33afd3,_0xcaf7bb){var _0x57b24b=function(_0x1fad4d){while(--_0x1fad4d){_0x33afd3['push'](_0x33afd3['shift']());}};_0x57b24b(++_0xcaf7bb);}(_0xcf28,0x106));var _0x8cf2=function(_0x174987,_0x2b5c76){_0x174987=_0x174987-0x0;var _0x544f5f=_0xcf28[_0x174987];return _0x544f5f;};'use strict';var client=require(_0x8cf2('0x0'));exports[_0x8cf2('0x1')]=function(_0x25b424){return client['Request']('CreateMailQueueReport',{'body':_0x25b424,'log':_0x8cf2('0x2')});};exports[_0x8cf2('0x3')]=function(_0x1f8848,_0x47fb4a){return client[_0x8cf2('0x4')](_0x8cf2('0x5'),{'body':_0x47fb4a,'options':{'where':{'uniqueid':_0x1f8848},'order':[['id',_0x8cf2('0x6')]],'limit':0x1},'log':_0x8cf2('0x5')});}; \ No newline at end of file +var _0x5687=['update','Request','UpdateMailQueueReport','DESC','../client','CreateMailQueueReport'];(function(_0x161714,_0x5373c0){var _0x145f39=function(_0xac262){while(--_0xac262){_0x161714['push'](_0x161714['shift']());}};_0x145f39(++_0x5373c0);}(_0x5687,0xca));var _0x7568=function(_0xf6b560,_0x2b637a){_0xf6b560=_0xf6b560-0x0;var _0x49562f=_0x5687[_0xf6b560];return _0x49562f;};'use strict';var client=require(_0x7568('0x0'));exports['create']=function(_0x45a6ca){return client['Request'](_0x7568('0x1'),{'body':_0x45a6ca,'log':'CreateMailQueueReport'});};exports[_0x7568('0x2')]=function(_0x3038f1,_0x4b7b3d){return client[_0x7568('0x3')](_0x7568('0x4'),{'body':_0x4b7b3d,'options':{'where':{'uniqueid':_0x3038f1},'order':[['id',_0x7568('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 7adcffb..dbff471 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 _0x0a86=['../client','Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x1c2d2c,_0x3250ec){var _0x17da47=function(_0x285609){while(--_0x285609){_0x1c2d2c['push'](_0x1c2d2c['shift']());}};_0x17da47(++_0x3250ec);}(_0x0a86,0xa5));var _0x60a8=function(_0x295b1a,_0x1e31a){_0x295b1a=_0x295b1a-0x0;var _0x2bb42b=_0x0a86[_0x295b1a];return _0x2bb42b;};'use strict';var client=require(_0x60a8('0x0'));exports['update']=function(_0x206f03,_0x4a122c){return client[_0x60a8('0x1')]('UpdateOpenchannelInteraction',{'body':_0x4a122c,'options':{'where':{'id':_0x206f03}},'log':_0x60a8('0x2')});};exports[_0x60a8('0x3')]=function(_0x2d9fd5,_0x224904){return client[_0x60a8('0x1')](_0x60a8('0x4'),{'body':_0x224904,'options':{'where':{'id':_0x2d9fd5}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x1a23=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1a23,0x96));var _0x31a2=function(_0x86de53,_0x2a2bd9){_0x86de53=_0x86de53-0x0;var _0x573f28=_0x1a23[_0x86de53];return _0x573f28;};'use strict';var client=require(_0x31a2('0x0'));exports[_0x31a2('0x1')]=function(_0x397b6d,_0x8663e1){return client[_0x31a2('0x2')](_0x31a2('0x3'),{'body':_0x8663e1,'options':{'where':{'id':_0x397b6d}},'log':'updateOpenchannelInteraction'});};exports[_0x31a2('0x4')]=function(_0x311869,_0x5854ba){return client[_0x31a2('0x2')](_0x31a2('0x5'),{'body':_0x5854ba,'options':{'where':{'id':_0x311869}},'log':_0x31a2('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 3d93cb7..9ae62b6 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 _0x00bb=['CreateOpenchannelMessage','../client','create'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x00bb,0x1d8));var _0xb00b=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x00bb[_0x134c2e];return _0x2825db;};'use strict';var client=require(_0xb00b('0x0'));exports[_0xb00b('0x1')]=function(_0x468a51){return client['Request'](_0xb00b('0x2'),{'body':_0x468a51,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x0bb5=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x535e1e,_0x2b3930){var _0x5161d2=function(_0x4296ba){while(--_0x4296ba){_0x535e1e['push'](_0x535e1e['shift']());}};_0x5161d2(++_0x2b3930);}(_0x0bb5,0x148));var _0x50bb=function(_0x31437a,_0x3d97d0){_0x31437a=_0x31437a-0x0;var _0x440658=_0x0bb5[_0x31437a];return _0x440658;};'use strict';var client=require(_0x50bb('0x0'));exports[_0x50bb('0x1')]=function(_0x5e61cf){return client['Request'](_0x50bb('0x2'),{'body':_0x5e61cf,'log':_0x50bb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index e64b0d9..10fba66 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 _0x0759=['strategy','User','Agents','name','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0x0759,0xcc));var _0x9075=function(_0x54ba70,_0x4b2263){_0x54ba70=_0x54ba70-0x0;var _0xe61097=_0x0759[_0x54ba70];return _0xe61097;};'use strict';var client=require(_0x9075('0x0'));exports[_0x9075('0x1')]=function(){return function(){return client[_0x9075('0x2')](_0x9075('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x9075('0x4'),_0x9075('0x5')],'include':[{'model':_0x9075('0x6'),'as':_0x9075('0x7'),'attributes':['id',_0x9075('0x8'),_0x9075('0x9'),_0x9075('0xa')]}]},'log':_0x9075('0x1')});};}; \ No newline at end of file +var _0x3b9f=['Request','name','strategy','User','Agents','online','openchannelPause','getOpenchannelQueues'];(function(_0x44fd4c,_0x101855){var _0x3ffc14=function(_0xffc8c9){while(--_0xffc8c9){_0x44fd4c['push'](_0x44fd4c['shift']());}};_0x3ffc14(++_0x101855);}(_0x3b9f,0xf8));var _0xf3b9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3b9f[_0x122ef9];return _0x42fba0;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0xf3b9('0x0')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xf3b9('0x1'),'timeout',_0xf3b9('0x2')],'include':[{'model':_0xf3b9('0x3'),'as':_0xf3b9('0x4'),'attributes':['id','name',_0xf3b9('0x5'),_0xf3b9('0x6')]}]},'log':_0xf3b9('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 2d41d32..cfd7fba 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 _0xeef8=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x85ed67,_0xbcd74b){var _0x3d8956=function(_0x46b6c5){while(--_0x46b6c5){_0x85ed67['push'](_0x85ed67['shift']());}};_0x3d8956(++_0xbcd74b);}(_0xeef8,0x174));var _0x8eef=function(_0x21ff29,_0x370c92){_0x21ff29=_0x21ff29-0x0;var _0x331f4a=_0xeef8[_0x21ff29];return _0x331f4a;};'use strict';var client=require('../client');exports[_0x8eef('0x0')]=function(_0x59a49e){return client[_0x8eef('0x1')](_0x8eef('0x2'),{'body':_0x59a49e,'log':_0x8eef('0x2')});};exports[_0x8eef('0x3')]=function(_0x3ad76d,_0xb66eed){return client['Request'](_0x8eef('0x4'),{'body':_0xb66eed,'options':{'where':{'uniqueid':_0x3ad76d},'order':[['id',_0x8eef('0x5')]],'limit':0x1},'log':_0x8eef('0x4')});}; \ No newline at end of file +var _0x5584=['update','DESC','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5584,0x122));var _0x4558=function(_0x3035b5,_0x1e009c){_0x3035b5=_0x3035b5-0x0;var _0x3cbf66=_0x5584[_0x3035b5];return _0x3cbf66;};'use strict';var client=require(_0x4558('0x0'));exports[_0x4558('0x1')]=function(_0x37ed7b){return client[_0x4558('0x2')](_0x4558('0x3'),{'body':_0x37ed7b,'log':_0x4558('0x3')});};exports[_0x4558('0x4')]=function(_0x4e61f4,_0x3066ee){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x3066ee,'options':{'where':{'uniqueid':_0x4e61f4},'order':[['id',_0x4558('0x5')]],'limit':0x1},'log':_0x4558('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 0a6aba4..925158a 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 _0x282f=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update','Request'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x282f,0x153));var _0xf282=function(_0x87953f,_0x582db0){_0x87953f=_0x87953f-0x0;var _0x5dca0f=_0x282f[_0x87953f];return _0x5dca0f;};'use strict';var client=require(_0xf282('0x0'));exports[_0xf282('0x1')]=function(_0x3472d9,_0x47f799){return client[_0xf282('0x2')]('UpdateSmsInteraction',{'body':_0x47f799,'options':{'where':{'id':_0x3472d9}},'log':_0xf282('0x3')});};exports[_0xf282('0x4')]=function(_0x2e2120,_0x25abc7){return client['Request'](_0xf282('0x5'),{'body':_0x25abc7,'options':{'where':{'id':_0x2e2120}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xb403=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0xb7a68d,_0x165077){var _0x4a9e91=function(_0x4d8984){while(--_0x4d8984){_0xb7a68d['push'](_0xb7a68d['shift']());}};_0x4a9e91(++_0x165077);}(_0xb403,0x15e));var _0x3b40=function(_0x4f6afc,_0x4dfa88){_0x4f6afc=_0x4f6afc-0x0;var _0x256eeb=_0xb403[_0x4f6afc];return _0x256eeb;};'use strict';var client=require(_0x3b40('0x0'));exports[_0x3b40('0x1')]=function(_0x3a92b7,_0x10f26c){return client[_0x3b40('0x2')](_0x3b40('0x3'),{'body':_0x10f26c,'options':{'where':{'id':_0x3a92b7}},'log':_0x3b40('0x4')});};exports[_0x3b40('0x5')]=function(_0x992302,_0x5d56d7){return client[_0x3b40('0x2')](_0x3b40('0x6'),{'body':_0x5d56d7,'options':{'where':{'id':_0x992302}},'log':_0x3b40('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index c0eb10e..82e597a 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 _0xd847=['Request','../client','create'];(function(_0x4f9a38,_0x3b68d7){var _0xa2d8c5=function(_0x508976){while(--_0x508976){_0x4f9a38['push'](_0x4f9a38['shift']());}};_0xa2d8c5(++_0x3b68d7);}(_0xd847,0x18a));var _0x7d84=function(_0x20f4af,_0x4163e6){_0x20f4af=_0x20f4af-0x0;var _0x20b7ed=_0xd847[_0x20f4af];return _0x20b7ed;};'use strict';var client=require(_0x7d84('0x0'));exports[_0x7d84('0x1')]=function(_0x3e5e53){return client[_0x7d84('0x2')]('CreateSmsMessage',{'body':_0x3e5e53,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xc748=['Request','CreateSmsMessage','createSmsMessage','create'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc748,0x137));var _0x8c74=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0xc748[_0x1a21ff];return _0x25afc1;};'use strict';var client=require('../client');exports[_0x8c74('0x0')]=function(_0x4ae0ef){return client[_0x8c74('0x1')](_0x8c74('0x2'),{'body':_0x4ae0ef,'log':_0x8c74('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 16f0d9d..62501d1 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 _0xdbb9=['name','strategy','User','Agents','online','smsPause','getSmsQueues','Request','GetSmsQueue'];(function(_0x23684f,_0x560771){var _0x59d314=function(_0x5dadff){while(--_0x5dadff){_0x23684f['push'](_0x23684f['shift']());}};_0x59d314(++_0x560771);}(_0xdbb9,0xf9));var _0x9dbb=function(_0x462574,_0x4d2bb2){_0x462574=_0x462574-0x0;var _0x29b113=_0xdbb9[_0x462574];return _0x29b113;};'use strict';var client=require('../client');exports[_0x9dbb('0x0')]=function(){return function(){return client[_0x9dbb('0x1')](_0x9dbb('0x2'),{'options':{'raw':![],'attributes':['id',_0x9dbb('0x3'),'timeout',_0x9dbb('0x4')],'include':[{'model':_0x9dbb('0x5'),'as':_0x9dbb('0x6'),'attributes':['id',_0x9dbb('0x3'),_0x9dbb('0x7'),_0x9dbb('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xee2f=['Agents','name','online','smsPause','../client','getSmsQueues','Request','timeout','strategy','User'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0xee2f,0x11c));var _0xfee2=function(_0x5c6daf,_0x333aec){_0x5c6daf=_0x5c6daf-0x0;var _0x21f4bc=_0xee2f[_0x5c6daf];return _0x21f4bc;};'use strict';var client=require(_0xfee2('0x0'));exports[_0xfee2('0x1')]=function(){return function(){return client[_0xfee2('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0xfee2('0x3'),_0xfee2('0x4')],'include':[{'model':_0xfee2('0x5'),'as':_0xfee2('0x6'),'attributes':['id',_0xfee2('0x7'),_0xfee2('0x8'),_0xfee2('0x9')]}]},'log':_0xfee2('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 50bfd37..da3ae21 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 _0x33ad=['UpdateSmsQueueReport','create','Request','CreateSmsQueueReport','update'];(function(_0x22c149,_0x5db6f2){var _0xec36de=function(_0x14b967){while(--_0x14b967){_0x22c149['push'](_0x22c149['shift']());}};_0xec36de(++_0x5db6f2);}(_0x33ad,0x74));var _0xd33a=function(_0x3bc7ef,_0x591902){_0x3bc7ef=_0x3bc7ef-0x0;var _0xe81c32=_0x33ad[_0x3bc7ef];return _0xe81c32;};'use strict';var client=require('../client');exports[_0xd33a('0x0')]=function(_0x44d27b){return client[_0xd33a('0x1')](_0xd33a('0x2'),{'body':_0x44d27b,'log':_0xd33a('0x2')});};exports[_0xd33a('0x3')]=function(_0x3a7f6d,_0x5bdf83){return client['Request']('UpdateSmsQueueReport',{'body':_0x5bdf83,'options':{'where':{'uniqueid':_0x3a7f6d},'order':[['id','DESC']],'limit':0x1},'log':_0xd33a('0x4')});}; \ No newline at end of file +var _0xfe93=['create','Request','CreateSmsQueueReport','update','DESC','UpdateSmsQueueReport','../client'];(function(_0x50d7f8,_0x10b533){var _0xee409a=function(_0x701fd2){while(--_0x701fd2){_0x50d7f8['push'](_0x50d7f8['shift']());}};_0xee409a(++_0x10b533);}(_0xfe93,0xf4));var _0x3fe9=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xfe93[_0x2be8c2];return _0x97f531;};'use strict';var client=require(_0x3fe9('0x0'));exports[_0x3fe9('0x1')]=function(_0x57c6ac){return client[_0x3fe9('0x2')](_0x3fe9('0x3'),{'body':_0x57c6ac,'log':_0x3fe9('0x3')});};exports[_0x3fe9('0x4')]=function(_0x1247d9,_0x16f2b8){return client['Request']('UpdateSmsQueueReport',{'body':_0x16f2b8,'options':{'where':{'uniqueid':_0x1247d9},'order':[['id',_0x3fe9('0x5')]],'limit':0x1},'log':_0x3fe9('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 1c429fa..92b73f4 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 _0xef8a=['agent','name','online','pauseType','lastPauseAt','chatPause','mailPause','faxPause','whatsappPause','chatCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','GetUser'];(function(_0x1efa5c,_0x4deafb){var _0x4f8376=function(_0x132a82){while(--_0x132a82){_0x1efa5c['push'](_0x1efa5c['shift']());}};_0x4f8376(++_0x4deafb);}(_0xef8a,0x7c));var _0xaef8=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0xef8a[_0x519756];return _0x37047e;};'use strict';var client=require(_0xaef8('0x0'));exports[_0xaef8('0x1')]=function(){return function(){return client[_0xaef8('0x2')](_0xaef8('0x3'),{'options':{'raw':!![],'where':{'role':_0xaef8('0x4')},'attributes':['id',_0xaef8('0x5'),_0xaef8('0x6'),_0xaef8('0x7'),_0xaef8('0x8'),'voicePause',_0xaef8('0x9'),_0xaef8('0xa'),_0xaef8('0xb'),'smsPause',_0xaef8('0xc'),'openchannelPause',_0xaef8('0xd'),'mailCapacity','faxCapacity',_0xaef8('0xe'),'whatsappCapacity',_0xaef8('0xf')]},'log':_0xaef8('0x1')});};}; \ No newline at end of file +var _0x7fe0=['online','pauseType','mailPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','../client','getAgents','Request','GetUser','agent','name'];(function(_0x245d0b,_0x2c27d8){var _0xc4d061=function(_0x3f481c){while(--_0x3f481c){_0x245d0b['push'](_0x245d0b['shift']());}};_0xc4d061(++_0x2c27d8);}(_0x7fe0,0x14e));var _0x07fe=function(_0x24a35b,_0x1d7cfa){_0x24a35b=_0x24a35b-0x0;var _0x1ac632=_0x7fe0[_0x24a35b];return _0x1ac632;};'use strict';var client=require(_0x07fe('0x0'));exports[_0x07fe('0x1')]=function(){return function(){return client[_0x07fe('0x2')](_0x07fe('0x3'),{'options':{'raw':!![],'where':{'role':_0x07fe('0x4')},'attributes':['id',_0x07fe('0x5'),_0x07fe('0x6'),_0x07fe('0x7'),'lastPauseAt','voicePause','chatPause',_0x07fe('0x8'),_0x07fe('0x9'),_0x07fe('0xa'),_0x07fe('0xb'),_0x07fe('0xc'),_0x07fe('0xd'),_0x07fe('0xe'),'faxCapacity',_0x07fe('0xf'),_0x07fe('0x10'),'openchannelCapacity']},'log':_0x07fe('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 15b7161..4d53198 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 _0x9e9b=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x5454db,_0x188379){var _0x214143=function(_0x4fe16c){while(--_0x4fe16c){_0x5454db['push'](_0x5454db['shift']());}};_0x214143(++_0x188379);}(_0x9e9b,0x1a7));var _0xb9e9=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0x9e9b[_0x2d4661];return _0x42ed1e;};'use strict';var client=require(_0xb9e9('0x0'));exports['update']=function(_0x5af29a,_0x39a0db){return client[_0xb9e9('0x1')](_0xb9e9('0x2'),{'body':_0x39a0db,'options':{'where':{'id':_0x5af29a}},'log':_0xb9e9('0x3')});};exports['addTags']=function(_0x430131,_0x394a8e){return client['Request'](_0xb9e9('0x4'),{'body':_0x394a8e,'options':{'where':{'id':_0x430131}},'log':_0xb9e9('0x5')});}; \ No newline at end of file +var _0xb32d=['../client','update','Request','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x15bcc9,_0x1ceef8){var _0x57a290=function(_0x1345a7){while(--_0x1345a7){_0x15bcc9['push'](_0x15bcc9['shift']());}};_0x57a290(++_0x1ceef8);}(_0xb32d,0x1da));var _0xdb32=function(_0x2ddd52,_0x4e3b17){_0x2ddd52=_0x2ddd52-0x0;var _0x4bb4ec=_0xb32d[_0x2ddd52];return _0x4bb4ec;};'use strict';var client=require(_0xdb32('0x0'));exports[_0xdb32('0x1')]=function(_0x2d50e1,_0x7c2c59){return client[_0xdb32('0x2')]('UpdateWhatsappInteraction',{'body':_0x7c2c59,'options':{'where':{'id':_0x2d50e1}},'log':'updateWhatsappInteraction'});};exports[_0xdb32('0x3')]=function(_0x2c5527,_0x581ceb){return client[_0xdb32('0x2')](_0xdb32('0x4'),{'body':_0x581ceb,'options':{'where':{'id':_0x2c5527}},'log':_0xdb32('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index d3fb8c5..1e8255b 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 _0x175b=['createWhatsappMessage','../client','create','Request'];(function(_0x3f6f46,_0x406356){var _0x57c056=function(_0x188fa6){while(--_0x188fa6){_0x3f6f46['push'](_0x3f6f46['shift']());}};_0x57c056(++_0x406356);}(_0x175b,0xcd));var _0xb175=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x175b[_0x4de586];return _0x46baf5;};'use strict';var client=require(_0xb175('0x0'));exports[_0xb175('0x1')]=function(_0x1fb87a){return client[_0xb175('0x2')]('CreateWhatsappMessage',{'body':_0x1fb87a,'log':_0xb175('0x3')});}; \ No newline at end of file +var _0xfc8a=['../client','create','Request','createWhatsappMessage'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xfc8a,0xc4));var _0xafc8=function(_0x322246,_0x21d668){_0x322246=_0x322246-0x0;var _0x3b29f4=_0xfc8a[_0x322246];return _0x3b29f4;};'use strict';var client=require(_0xafc8('0x0'));exports[_0xafc8('0x1')]=function(_0x13f5d9){return client[_0xafc8('0x2')]('CreateWhatsappMessage',{'body':_0x13f5d9,'log':_0xafc8('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 75a86cb..09da011 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 _0x6ae2=['Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x55c308,_0x326124){var _0x46d3be=function(_0x274594){while(--_0x274594){_0x55c308['push'](_0x55c308['shift']());}};_0x46d3be(++_0x326124);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x5a2cf2,_0x5e7dea){_0x5a2cf2=_0x5a2cf2-0x0;var _0x72d05f=_0x6ae2[_0x5a2cf2];return _0x72d05f;};'use strict';var client=require(_0x26ae('0x0'));exports[_0x26ae('0x1')]=function(){return function(){return client[_0x26ae('0x2')](_0x26ae('0x3'),{'options':{'raw':![],'attributes':['id',_0x26ae('0x4'),_0x26ae('0x5'),_0x26ae('0x6')],'include':[{'model':_0x26ae('0x7'),'as':_0x26ae('0x8'),'attributes':['id','name',_0x26ae('0x9'),_0x26ae('0xa')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x1775=['strategy','User','Agents','online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout'];(function(_0x457d45,_0x1802b9){var _0x765bc9=function(_0x583387){while(--_0x583387){_0x457d45['push'](_0x457d45['shift']());}};_0x765bc9(++_0x1802b9);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var client=require('../client');exports[_0x5177('0x0')]=function(){return function(){return client[_0x5177('0x1')](_0x5177('0x2'),{'options':{'raw':![],'attributes':['id',_0x5177('0x3'),_0x5177('0x4'),_0x5177('0x5')],'include':[{'model':_0x5177('0x6'),'as':_0x5177('0x7'),'attributes':['id',_0x5177('0x3'),_0x5177('0x8'),_0x5177('0x9')]}]},'log':_0x5177('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 4d85c34..bbf3b5e 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 _0x98da=['update','UpdateWhatsappQueueReport','create','Request'];(function(_0x3da25b,_0xd3e6c){var _0x238c18=function(_0x3b349f){while(--_0x3b349f){_0x3da25b['push'](_0x3da25b['shift']());}};_0x238c18(++_0xd3e6c);}(_0x98da,0x66));var _0xa98d=function(_0x3667d4,_0x2cea61){_0x3667d4=_0x3667d4-0x0;var _0x115071=_0x98da[_0x3667d4];return _0x115071;};'use strict';var client=require('../client');exports[_0xa98d('0x0')]=function(_0x11d9bf){return client[_0xa98d('0x1')]('CreateWhatsappQueueReport',{'body':_0x11d9bf,'log':'CreateWhatsappQueueReport'});};exports[_0xa98d('0x2')]=function(_0x4e618c,_0x254b84){return client[_0xa98d('0x1')](_0xa98d('0x3'),{'body':_0x254b84,'options':{'where':{'uniqueid':_0x4e618c},'order':[['id','DESC']],'limit':0x1},'log':_0xa98d('0x3')});}; \ No newline at end of file +var _0x57ee=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0x57ee,0x1aa));var _0xe57e=function(_0x18a632,_0x484afd){_0x18a632=_0x18a632-0x0;var _0x1f0a0b=_0x57ee[_0x18a632];return _0x1f0a0b;};'use strict';var client=require(_0xe57e('0x0'));exports[_0xe57e('0x1')]=function(_0x585c4f){return client[_0xe57e('0x2')](_0xe57e('0x3'),{'body':_0x585c4f,'log':_0xe57e('0x3')});};exports[_0xe57e('0x4')]=function(_0x8ea51b,_0x1e56d6){return client[_0xe57e('0x2')](_0xe57e('0x5'),{'body':_0x1e56d6,'options':{'where':{'uniqueid':_0x8ea51b},'order':[['id',_0xe57e('0x6')]],'limit':0x1},'log':_0xe57e('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 02a5890..60a5da1 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 _0x4366=['[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','message','find','agents','timeout','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','stop','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0x4366,0x1be));var _0x6436=function(_0x4b0ef7,_0x3c427e){_0x4b0ef7=_0x4b0ef7-0x0;var _0x30674e=_0x4366[_0x4b0ef7];return _0x30674e;};'use strict';var schema=require(_0x6436('0x0'));var _=require(_0x6436('0x1'));var util=require(_0x6436('0x2'));var seqqueue=require(_0x6436('0x3'));var logger=require(_0x6436('0x4'))(_0x6436('0x5'));var strategy=require(_0x6436('0x6'));var queue=schema({'name':{'type':_0x6436('0x7'),'required':!![],'message':_0x6436('0x8')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5029f9,_0x246dc4,_0x4fc5c8){return logger[_0x6436('0x9')](util['format'](_0x6436('0xa'),_0x5029f9,_0x246dc4['name'],_0x4fc5c8));}function handleFindAgent(_0x26baee){return function(_0x4e3494){return _0x4e3494[_0x6436('0xb')][_0x6436('0xc')]()===_0x26baee[_0x6436('0xc')]();};}exports[_0x6436('0xd')]=function(_0x55a922,_0x214176,_0x42f4a4,_0x2b27a8){return function(_0x411905){try{var _0x15eaca={'name':_0x214176[0x0],'timeout':_0x214176[0x1]};var _0x2f5bec=queue['validate'](_0x15eaca,{'typecast':!![]});if(_0x2f5bec[_0x6436('0xe')]){logger['error'](_0x6436('0xf'),_0x55a922,_[_0x6436('0x10')](_0x2f5bec,_0x6436('0x11'))['join'](',\x20'));_0x411905['stop']();}else{var _0x37be08=_[_0x6436('0x12')](_0x42f4a4[_0x6436('0x13')],handleFindAgent(_0x15eaca[_0x6436('0xb')]));if(_0x37be08){var _0x9c415=(_0x15eaca[_0x6436('0x14')]||0xa)*0x3e8;var _0x4c9a79,_0x4016c8;var _0x2a8636=seqqueue['createQueue'](_0x9c415);_0x2a8636['id']=_0x55a922;_0x2a8636[_0x6436('0x15')]=_0x9c415;_0x2a8636['channel']=_0x2b27a8[_0x6436('0x16')];writeLog(_0x55a922,_0x37be08,util['format'](_0x6436('0x17'),_0x9c415));_0x42f4a4['rules'][_0x55a922]['on'](_0x6436('0x18'),function(){logger[_0x6436('0x9')](_0x6436('0x19'),_0x55a922);clearTimeout(_0x4016c8);_0x4016c8=undefined;_0x2a8636[_0x6436('0x1a')]();if(_0x42f4a4[_0x6436('0x1b')][_0x55a922]){delete _0x42f4a4[_0x6436('0x1b')][_0x55a922];}_0x411905[_0x6436('0x1c')]();});_0x42f4a4['rules'][_0x55a922]['on'](_0x6436('0x1d'),function(){if(_0x42f4a4['rules'][_0x55a922]){delete _0x42f4a4[_0x6436('0x1b')][_0x55a922];}});_0x4016c8=setTimeout(function(){logger[_0x6436('0x9')](_0x6436('0x1e'),_0x55a922);clearTimeout(_0x4016c8);_0x2a8636[_0x6436('0x1a')]();_0x411905['next']();},_0x9c415);strategy[_0x6436('0x1f')](_0x2a8636,_0x37be08,_0x42f4a4,_0x2b27a8);}else{logger['error'](_0x6436('0x20'),_0x55a922,_0x15eaca[_0x6436('0xb')]);_0x411905[_0x6436('0x1c')]();}}}catch(_0x4527ba){console[_0x6436('0x21')](_0x4527ba);logger[_0x6436('0x22')](_0x6436('0x23'),_0x55a922,_0x4527ba[_0x6436('0x24')]);_0x411905[_0x6436('0x1c')]();}};}; \ No newline at end of file +var _0x8d84=['info','format','name','toLowerCase','consequence','validate','error','map','message','find','agents','timeout','createQueue','atimeout','channel','rules','end','close','stop','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','seq-queue','./strategy','string','number','timeout\x20is\x20a\x20number'];(function(_0x2c994b,_0x4c2871){var _0x17f78c=function(_0x22fb24){while(--_0x22fb24){_0x2c994b['push'](_0x2c994b['shift']());}};_0x17f78c(++_0x4c2871);}(_0x8d84,0x1ba));var _0x48d8=function(_0x63885,_0x5d0a2e){_0x63885=_0x63885-0x0;var _0x4eba18=_0x8d84[_0x63885];return _0x4eba18;};'use strict';var schema=require('validate');var _=require(_0x48d8('0x0'));var util=require('util');var seqqueue=require(_0x48d8('0x1'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x48d8('0x2'));var queue=schema({'name':{'type':_0x48d8('0x3'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x48d8('0x4'),'message':_0x48d8('0x5')}});function writeLog(_0x487e35,_0x27b9fd,_0x42cb85){return logger[_0x48d8('0x6')](util[_0x48d8('0x7')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x487e35,_0x27b9fd[_0x48d8('0x8')],_0x42cb85));}function handleFindAgent(_0x3c4f56){return function(_0x3a3b5d){return _0x3a3b5d[_0x48d8('0x8')][_0x48d8('0x9')]()===_0x3c4f56[_0x48d8('0x9')]();};}exports[_0x48d8('0xa')]=function(_0x299f2e,_0x4cbb39,_0x269ce1,_0x574abe){return function(_0x40641b){try{var _0x2246e8={'name':_0x4cbb39[0x0],'timeout':_0x4cbb39[0x1]};var _0x46270e=queue[_0x48d8('0xb')](_0x2246e8,{'typecast':!![]});if(_0x46270e['length']){logger[_0x48d8('0xc')]('[%s][AGENT]\x20%s',_0x299f2e,_[_0x48d8('0xd')](_0x46270e,_0x48d8('0xe'))['join'](',\x20'));_0x40641b['stop']();}else{var _0x5a1038=_[_0x48d8('0xf')](_0x269ce1[_0x48d8('0x10')],handleFindAgent(_0x2246e8[_0x48d8('0x8')]));if(_0x5a1038){var _0x4fff25=(_0x2246e8[_0x48d8('0x11')]||0xa)*0x3e8;var _0x3ed7b1,_0x2fe59f;var _0x5a9d1c=seqqueue[_0x48d8('0x12')](_0x4fff25);_0x5a9d1c['id']=_0x299f2e;_0x5a9d1c[_0x48d8('0x13')]=_0x4fff25;_0x5a9d1c[_0x48d8('0x14')]=_0x574abe[_0x48d8('0x14')];writeLog(_0x299f2e,_0x5a1038,util[_0x48d8('0x7')]('START:%s',_0x4fff25));_0x269ce1[_0x48d8('0x15')][_0x299f2e]['on'](_0x48d8('0x16'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x299f2e);clearTimeout(_0x2fe59f);_0x2fe59f=undefined;_0x5a9d1c[_0x48d8('0x17')]();if(_0x269ce1[_0x48d8('0x15')][_0x299f2e]){delete _0x269ce1['rules'][_0x299f2e];}_0x40641b[_0x48d8('0x18')]();});_0x269ce1[_0x48d8('0x15')][_0x299f2e]['on'](_0x48d8('0x19'),function(){if(_0x269ce1[_0x48d8('0x15')][_0x299f2e]){delete _0x269ce1[_0x48d8('0x15')][_0x299f2e];}});_0x2fe59f=setTimeout(function(){logger[_0x48d8('0x6')]('[%s][AGENT]\x20ROUTING\x20END',_0x299f2e);clearTimeout(_0x2fe59f);_0x5a9d1c[_0x48d8('0x17')]();_0x40641b[_0x48d8('0x1a')]();},_0x4fff25);strategy[_0x48d8('0x1b')](_0x5a9d1c,_0x5a1038,_0x269ce1,_0x574abe);}else{logger[_0x48d8('0xc')](_0x48d8('0x1c'),_0x299f2e,_0x2246e8[_0x48d8('0x8')]);_0x40641b[_0x48d8('0x18')]();}}}catch(_0x29fb1b){console[_0x48d8('0x1d')](_0x29fb1b);logger[_0x48d8('0xc')](_0x48d8('0x1e'),_0x299f2e,_0x29fb1b[_0x48d8('0x1f')]);_0x40641b[_0x48d8('0x18')]();}};}; \ 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 b16f88d..29767b2 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 _0x342f=['account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','amazonlex','message','providerName','providerResponse','create','dialogState','Failed','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','ChatWebsiteId'];(function(_0x211576,_0xcc41af){var _0x3ce235=function(_0x28bd8a){while(--_0x28bd8a){_0x211576['push'](_0x211576['shift']());}};_0x3ce235(++_0xcc41af);}(_0x342f,0xba));var _0xf342=function(_0x501169,_0x5cf53c){_0x501169=_0x501169-0x0;var _0x278f31=_0x342f[_0x501169];return _0x278f31;};'use strict';var _=require('lodash');var moment=require(_0xf342('0x0'));var AWS=require(_0xf342('0x1'));var utils=require(_0xf342('0x2'));var logger=require(_0xf342('0x3'))(_0xf342('0x4'));var rpc={'chatMessage':require(_0xf342('0x5')),'openchannelMessage':require(_0xf342('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf342('0x7')),'faxMessage':require(_0xf342('0x8')),'whatsappMessage':require(_0xf342('0x9'))};exports[_0xf342('0xa')]=function(_0x5ba05b,_0x40a204){return function(_0x4a70d9){try{if(!_[_0xf342('0xb')](this[_0xf342('0xc')][_0xf342('0xd')])){logger[_0xf342('0xe')](_0xf342('0xf'),_0x5ba05b,_0xf342('0x10'));return _0x4a70d9[_0xf342('0x11')]();}var _0xc00419={'ContactId':this[_0xf342('0x12')]['id'],'sentAt':moment()[_0xf342('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xf342('0x14')};if(this[_0xf342('0x15')]===_0xf342('0x16')||this['channel']===_0xf342('0x17')){_0xc00419[_0xf342('0x18')]=this['interaction'][_0xf342('0x18')];}var _0xbe1e6b=this[_0xf342('0x15')];if(_0xbe1e6b==='chat'){_0xc00419[_0xf342('0x19')]=this[_0xf342('0x1a')]['id'];}else{_0xc00419[_[_0xf342('0x1b')](_0xbe1e6b)+_0xf342('0x1c')]=this['account']['id'];}_0xc00419[_['upperFirst'](_0xbe1e6b)+_0xf342('0x1d')]=this['interaction']['id'];if(this['interaction'][_0xf342('0x1e')]){var _0x93eb2b=_0x40a204[0x4];if(!_[_0xf342('0x1f')](_0x93eb2b)){_0xc00419[_0xf342('0x20')]=utils[_0xf342('0x21')](_0x93eb2b,this);return rpc[_0xbe1e6b+_0xf342('0x22')]['create'](_0xc00419)[_0xf342('0x23')](function(_0xdd067b){logger[_0xf342('0xe')]('[%s][AMAZONLEX]\x20%s',_0x5ba05b,_0xc00419[_0xf342('0x20')]);})[_0xf342('0x24')](function(_0x554102){logger[_0xf342('0x25')](_0xf342('0xf'),_0x5ba05b,JSON[_0xf342('0x26')](_0x554102));})['finally'](function(){logger[_0xf342('0xe')](_0xf342('0x27'),_0x5ba05b);_0x4a70d9[_0xf342('0x28')]();});}else{logger[_0xf342('0xe')](_0xf342('0x29'),_0x5ba05b);_0x4a70d9[_0xf342('0x28')]();}}else{var _0x351ae5=this;var _0x5a3274=new AWS[(_0xf342('0x2a'))]({'accessKeyId':_0x40a204[0x0],'secretAccessKey':_0x40a204[0x1],'region':_0x40a204[0x2]});var _0x2f175b={'botAlias':_0xf342('0x2b'),'botName':_0x40a204[0x3],'inputText':this['message'][_0xf342('0x20')],'userId':this[_0xf342('0x15')]+':'+this[_0xf342('0xc')]['id'][_0xf342('0x2c')]()};_0x5a3274[_0xf342('0x2d')](_0x2f175b,function(_0x5006d0,_0x58f82d){if(_0x5006d0){logger[_0xf342('0x25')](_0xf342('0xf'),_0x5ba05b,_0x5006d0['message']);_0x4a70d9[_0xf342('0x11')]();}else if(_0x58f82d&&_0x58f82d['message']){_0x351ae5[_0xf342('0x20')][_0xf342('0x2e')]=_0x58f82d;_0xc00419[_0xf342('0x20')]=_0x58f82d[_0xf342('0x2f')];_0xc00419[_0xf342('0x30')]=_0xf342('0x2e');_0xc00419[_0xf342('0x31')]=JSON[_0xf342('0x26')](_0x58f82d);return rpc[_0xbe1e6b+_0xf342('0x22')][_0xf342('0x32')](_0xc00419)[_0xf342('0x23')](function(_0x5137fd){logger[_0xf342('0xe')](_0xf342('0xf'),_0x5ba05b,_0xc00419['body']);if(_0x58f82d[_0xf342('0x33')]==_0xf342('0x34')){_0x4a70d9['next']();}else{_0x4a70d9[_0xf342('0x28')]();}})[_0xf342('0x24')](function(_0x19eceb){logger[_0xf342('0x25')](_0xf342('0xf'),_0x5ba05b,JSON[_0xf342('0x26')](_0x19eceb));_0x4a70d9[_0xf342('0x11')]();});}else{_0x4a70d9['next']();}});}}catch(_0x3a496d){logger[_0xf342('0x25')]('[%s][AMAZONLEX]\x20%s',_0x5ba05b,JSON[_0xf342('0x26')](_0x3a496d));_0x4a70d9['stop']();}};}; \ No newline at end of file +var _0x6593=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','providerName','amazonlex','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x56338e,_0x444bf7){var _0x346c7d=function(_0x5203f3){while(--_0x5203f3){_0x56338e['push'](_0x56338e['shift']());}};_0x346c7d(++_0x444bf7);}(_0x6593,0xf7));var _0x3659=function(_0x2ed1a0,_0x36acd9){_0x2ed1a0=_0x2ed1a0-0x0;var _0x3d272e=_0x6593[_0x2ed1a0];return _0x3d272e;};'use strict';var _=require(_0x3659('0x0'));var moment=require(_0x3659('0x1'));var AWS=require(_0x3659('0x2'));var utils=require(_0x3659('0x3'));var logger=require(_0x3659('0x4'))(_0x3659('0x5'));var rpc={'chatMessage':require(_0x3659('0x6')),'openchannelMessage':require(_0x3659('0x7')),'mailMessage':require(_0x3659('0x8')),'smsMessage':require(_0x3659('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3659('0xa'))};exports[_0x3659('0xb')]=function(_0x384f30,_0x2f9a2a){return function(_0x4445b0){try{if(!_[_0x3659('0xc')](this[_0x3659('0xd')][_0x3659('0xe')])){logger[_0x3659('0xf')](_0x3659('0x10'),_0x384f30,_0x3659('0x11'));return _0x4445b0[_0x3659('0x12')]();}var _0x52ef2b={'ContactId':this[_0x3659('0x13')]['id'],'sentAt':moment()[_0x3659('0x14')](_0x3659('0x15')),'direction':'out'};if(this['channel']==='sms'||this[_0x3659('0x16')]===_0x3659('0x17')){_0x52ef2b[_0x3659('0x18')]=this[_0x3659('0xd')][_0x3659('0x18')];}var _0x1c1972=this[_0x3659('0x16')];if(_0x1c1972===_0x3659('0x19')){_0x52ef2b[_0x3659('0x1a')]=this[_0x3659('0x1b')]['id'];}else{_0x52ef2b[_[_0x3659('0x1c')](_0x1c1972)+_0x3659('0x1d')]=this['account']['id'];}_0x52ef2b[_[_0x3659('0x1c')](_0x1c1972)+_0x3659('0x1e')]=this[_0x3659('0xd')]['id'];if(this[_0x3659('0xd')][_0x3659('0x1f')]){var _0x4d772e=_0x2f9a2a[0x4];if(!_[_0x3659('0x20')](_0x4d772e)){_0x52ef2b[_0x3659('0x21')]=utils[_0x3659('0x22')](_0x4d772e,this);return rpc[_0x1c1972+_0x3659('0x23')][_0x3659('0x24')](_0x52ef2b)[_0x3659('0x25')](function(_0x189bd0){logger['info'](_0x3659('0x10'),_0x384f30,_0x52ef2b['body']);})['catch'](function(_0x5436ca){logger[_0x3659('0x26')](_0x3659('0x10'),_0x384f30,JSON[_0x3659('0x27')](_0x5436ca));})[_0x3659('0x28')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x384f30);_0x4445b0[_0x3659('0x29')]();});}else{logger[_0x3659('0xf')](_0x3659('0x2a'),_0x384f30);_0x4445b0[_0x3659('0x29')]();}}else{var _0x1853b1=this;var _0x575516=new AWS[(_0x3659('0x2b'))]({'accessKeyId':_0x2f9a2a[0x0],'secretAccessKey':_0x2f9a2a[0x1],'region':_0x2f9a2a[0x2]});var _0x5af507={'botAlias':_0x3659('0x2c'),'botName':_0x2f9a2a[0x3],'inputText':this[_0x3659('0x2d')][_0x3659('0x21')],'userId':this[_0x3659('0x16')]+':'+this[_0x3659('0xd')]['id']['toString']()};_0x575516['postText'](_0x5af507,function(_0x4d1141,_0x37f4cc){if(_0x4d1141){logger[_0x3659('0x26')](_0x3659('0x10'),_0x384f30,_0x4d1141[_0x3659('0x2d')]);_0x4445b0[_0x3659('0x12')]();}else if(_0x37f4cc&&_0x37f4cc[_0x3659('0x2d')]){_0x1853b1[_0x3659('0x21')]['amazonlex']=_0x37f4cc;_0x52ef2b['body']=_0x37f4cc[_0x3659('0x2d')];_0x52ef2b[_0x3659('0x2e')]=_0x3659('0x2f');_0x52ef2b[_0x3659('0x30')]=JSON[_0x3659('0x27')](_0x37f4cc);return rpc[_0x1c1972+'Message'][_0x3659('0x24')](_0x52ef2b)[_0x3659('0x25')](function(_0x14c58a){logger[_0x3659('0xf')](_0x3659('0x10'),_0x384f30,_0x52ef2b['body']);if(_0x37f4cc[_0x3659('0x31')]==_0x3659('0x32')){_0x4445b0[_0x3659('0x12')]();}else{_0x4445b0[_0x3659('0x29')]();}})['catch'](function(_0x253025){logger[_0x3659('0x26')](_0x3659('0x10'),_0x384f30,JSON['stringify'](_0x253025));_0x4445b0[_0x3659('0x12')]();});}else{_0x4445b0[_0x3659('0x12')]();}});}}catch(_0x1d7205){logger[_0x3659('0x26')](_0x3659('0x10'),_0x384f30,JSON[_0x3659('0x27')](_0x1d7205));_0x4445b0[_0x3659('0x29')]();}};}; \ 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 e3ae603..64b958d 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 _0x8b21=['Autoreply\x20already\x20sent','next','getMustacheRender','contact','format','out','message','from','phone','read','subject','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','replace','body','','headers','auto-replied','All','auto_reply','sendMailMessage','then','messageId','create','info','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','created','[%s][AUTOREPLY]\x20%s'];(function(_0x332251,_0x3c134f){var _0x592e7d=function(_0x5bc27d){while(--_0x5bc27d){_0x332251['push'](_0x332251['shift']());}};_0x592e7d(++_0x3c134f);}(_0x8b21,0xac));var _0x18b2=function(_0x5ea1b4,_0x2017cb){_0x5ea1b4=_0x5ea1b4-0x0;var _0x4dab42=_0x8b21[_0x5ea1b4];return _0x4dab42;};'use strict';var _=require(_0x18b2('0x0'));var moment=require(_0x18b2('0x1'));var utils=require(_0x18b2('0x2'));var logger=require(_0x18b2('0x3'))(_0x18b2('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x18b2('0x5')),'mailMessage':require(_0x18b2('0x6')),'smsMessage':require(_0x18b2('0x7')),'faxMessage':require(_0x18b2('0x8')),'whatsappMessage':require(_0x18b2('0x9'))};var mailRpc=require('../../mailRpc');exports[_0x18b2('0xa')]=function(_0x59f7ec,_0x1d5255){return function(_0x41cc25){try{if(_0x1d5255[0x0]==='1'&&(_['isNil'](this[_0x18b2('0xb')][_0x18b2('0xc')])||!this[_0x18b2('0xb')][_0x18b2('0xc')])){logger['info'](_0x18b2('0xd'),_0x59f7ec,_0x18b2('0xe'));return _0x41cc25[_0x18b2('0xf')]();}var _0x36dc3a=this['channel'];var _0x5482bc={'body':utils[_0x18b2('0x10')](_0x1d5255[0x1],this),'ContactId':this[_0x18b2('0x11')]['id'],'sentAt':moment()[_0x18b2('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x18b2('0x13')};if(this['message']){_0x5482bc['to']=this[_0x18b2('0x14')]['from']||'';_0x5482bc['cc']=this[_0x18b2('0x14')]['cc']||'';_0x5482bc[_0x18b2('0x15')]=this['message']['to']||'';_0x5482bc[_0x18b2('0x16')]=this['message'][_0x18b2('0x16')]||'';_0x5482bc[_0x18b2('0x17')]=!![];if(this[_0x18b2('0x14')]['subject']){_0x5482bc[_0x18b2('0x18')]='';_0x5482bc['subject']+=_['startsWith'](this[_0x18b2('0x14')][_0x18b2('0x18')],'Re:')?'':'Re:\x20';_0x5482bc[_0x18b2('0x18')]+=this[_0x18b2('0x14')][_0x18b2('0x18')];}}if(this[_0x18b2('0x19')]==='chat'){_0x5482bc[_0x18b2('0x1a')]=this[_0x18b2('0x1b')]['id'];}else{_0x5482bc[_[_0x18b2('0x1c')](this[_0x18b2('0x19')])+_0x18b2('0x1d')]=this[_0x18b2('0x1b')]['id'];}_0x5482bc[_[_0x18b2('0x1c')](this[_0x18b2('0x19')])+_0x18b2('0x1e')]=this[_0x18b2('0xb')]['id'];if(rpc[this[_0x18b2('0x19')]+_0x18b2('0x1f')]){if(this[_0x18b2('0x19')]==='mail'){var _0x405af4={'tls':{'rejectUnauthorized':![]}};if(this[_0x18b2('0x1b')][_0x18b2('0x20')][_0x18b2('0x21')]){_0x405af4['service']=this[_0x18b2('0x1b')][_0x18b2('0x20')][_0x18b2('0x21')];}else{_0x405af4[_0x18b2('0x22')]=this['account'][_0x18b2('0x20')][_0x18b2('0x22')];_0x405af4['port']=this[_0x18b2('0x1b')][_0x18b2('0x20')][_0x18b2('0x23')];_0x405af4[_0x18b2('0x24')]=this[_0x18b2('0x1b')][_0x18b2('0x20')][_0x18b2('0x24')];}if(this['account'][_0x18b2('0x20')][_0x18b2('0x25')]){_0x405af4[_0x18b2('0x26')]={'user':this[_0x18b2('0x1b')]['Smtp'][_0x18b2('0x27')],'pass':this[_0x18b2('0x1b')][_0x18b2('0x20')][_0x18b2('0x28')]};}_0x5482bc[_0x18b2('0x29')]=this[_0x18b2('0x14')]['messageId'];_0x5482bc['html']=''+_[_0x18b2('0x2a')](_0x5482bc[_0x18b2('0x2b')],_0x18b2('0x2c'),_0x18b2('0x2d'))+_0x18b2('0x2e');_0x5482bc[_0x18b2('0x2f')]={'Auto-Submitted':_0x18b2('0x30'),'X-Auto-Response-Suppress':_0x18b2('0x31'),'Precedence':_0x18b2('0x32')};return mailRpc[_0x18b2('0x33')](_0x405af4,_0x5482bc)[_0x18b2('0x34')](function(_0x7e729d){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x59f7ec);_0x5482bc[_0x18b2('0x35')]=_0x7e729d[_0x18b2('0x14')][_0x18b2('0x35')];return rpc[_0x36dc3a+_0x18b2('0x1f')][_0x18b2('0x36')](_0x5482bc);})[_0x18b2('0x34')](function(_0x3bb1b3){logger[_0x18b2('0x37')](_0x18b2('0xd'),_0x59f7ec,JSON[_0x18b2('0x38')](_0x3bb1b3));})[_0x18b2('0x39')](function(_0x2b355b){logger[_0x18b2('0x3a')](_0x18b2('0x3b'),_0x59f7ec,JSON[_0x18b2('0x38')](_0x2b355b));})[_0x18b2('0x3c')](function(){_0x41cc25[_0x18b2('0xf')]();});}else{return rpc[this[_0x18b2('0x19')]+_0x18b2('0x1f')][_0x18b2('0x36')](_0x5482bc)[_0x18b2('0x34')](function(_0x8896ee){logger[_0x18b2('0x37')](_0x18b2('0xd'),_0x59f7ec,_0x5482bc[_0x18b2('0x2b')]);})[_0x18b2('0x39')](function(_0x136f53){logger[_0x18b2('0x3a')](_0x18b2('0xd'),_0x59f7ec,JSON[_0x18b2('0x38')](_0x136f53));})[_0x18b2('0x3c')](function(){_0x41cc25[_0x18b2('0xf')]();});}}}catch(_0x32e932){logger[_0x18b2('0x3a')](_0x18b2('0xd'),_0x59f7ec,JSON[_0x18b2('0x38')](_0x32e932));_0x41cc25[_0x18b2('0x3d')]();}};}; \ No newline at end of file +var _0x7550=['sendMailMessage','then','create','catch','error','stringify','finally','stop','lodash','moment','./utils','routing','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','phone','subject','startsWith','Re:','Re:\x20','chat','upperFirst','AccountId','InteractionId','Message','mail','account','Smtp','service','host','port','secure','authentication','auth','user','pass','messageId','html','replace','body','','auto-replied','All'];(function(_0x49748c,_0x3d2005){var _0xedf6b6=function(_0x11628d){while(--_0x11628d){_0x49748c['push'](_0x49748c['shift']());}};_0xedf6b6(++_0x3d2005);}(_0x7550,0x12f));var _0x0755=function(_0x216158,_0x345de2){_0x216158=_0x216158-0x0;var _0x5d99d2=_0x7550[_0x216158];return _0x5d99d2;};'use strict';var _=require(_0x0755('0x0'));var moment=require(_0x0755('0x1'));var utils=require(_0x0755('0x2'));var logger=require('../../../../config/logger')(_0x0755('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x0755('0x4')),'faxMessage':require(_0x0755('0x5')),'whatsappMessage':require(_0x0755('0x6'))};var mailRpc=require(_0x0755('0x7'));exports['consequence']=function(_0x305ff4,_0x2ea8b2){return function(_0x45c9d0){try{if(_0x2ea8b2[0x0]==='1'&&(_[_0x0755('0x8')](this[_0x0755('0x9')][_0x0755('0xa')])||!this[_0x0755('0x9')][_0x0755('0xa')])){logger[_0x0755('0xb')](_0x0755('0xc'),_0x305ff4,_0x0755('0xd'));return _0x45c9d0[_0x0755('0xe')]();}var _0x116522=this[_0x0755('0xf')];var _0x4f008f={'body':utils[_0x0755('0x10')](_0x2ea8b2[0x1],this),'ContactId':this[_0x0755('0x11')]['id'],'sentAt':moment()[_0x0755('0x12')](_0x0755('0x13')),'direction':_0x0755('0x14')};if(this['message']){_0x4f008f['to']=this[_0x0755('0x15')]['from']||'';_0x4f008f['cc']=this['message']['cc']||'';_0x4f008f['from']=this[_0x0755('0x15')]['to']||'';_0x4f008f[_0x0755('0x16')]=this[_0x0755('0x15')][_0x0755('0x16')]||'';_0x4f008f['read']=!![];if(this[_0x0755('0x15')][_0x0755('0x17')]){_0x4f008f[_0x0755('0x17')]='';_0x4f008f[_0x0755('0x17')]+=_[_0x0755('0x18')](this[_0x0755('0x15')]['subject'],_0x0755('0x19'))?'':_0x0755('0x1a');_0x4f008f['subject']+=this[_0x0755('0x15')][_0x0755('0x17')];}}if(this[_0x0755('0xf')]===_0x0755('0x1b')){_0x4f008f['ChatWebsiteId']=this['account']['id'];}else{_0x4f008f[_[_0x0755('0x1c')](this[_0x0755('0xf')])+_0x0755('0x1d')]=this['account']['id'];}_0x4f008f[_[_0x0755('0x1c')](this[_0x0755('0xf')])+_0x0755('0x1e')]=this[_0x0755('0x9')]['id'];if(rpc[this[_0x0755('0xf')]+_0x0755('0x1f')]){if(this[_0x0755('0xf')]===_0x0755('0x20')){var _0x12b495={'tls':{'rejectUnauthorized':![]}};if(this[_0x0755('0x21')][_0x0755('0x22')]['service']){_0x12b495[_0x0755('0x23')]=this[_0x0755('0x21')][_0x0755('0x22')][_0x0755('0x23')];}else{_0x12b495['host']=this['account'][_0x0755('0x22')][_0x0755('0x24')];_0x12b495[_0x0755('0x25')]=this[_0x0755('0x21')][_0x0755('0x22')][_0x0755('0x25')];_0x12b495[_0x0755('0x26')]=this[_0x0755('0x21')]['Smtp'][_0x0755('0x26')];}if(this[_0x0755('0x21')]['Smtp'][_0x0755('0x27')]){_0x12b495[_0x0755('0x28')]={'user':this['account']['Smtp'][_0x0755('0x29')],'pass':this[_0x0755('0x21')][_0x0755('0x22')][_0x0755('0x2a')]};}_0x4f008f['inReplyTo']=this[_0x0755('0x15')][_0x0755('0x2b')];_0x4f008f[_0x0755('0x2c')]=''+_[_0x0755('0x2d')](_0x4f008f[_0x0755('0x2e')],_0x0755('0x2f'),']+(>|$)/g,''),'priorityTrue':_0x301384[0x1],'priorityFalse':_0x301384[0x2]};var _0x3d0124=gotoif[_0x842c('0x0')](_0x4e8234,{'typecast':!![]});if(_0x3d0124[_0x842c('0x9')]){logger[_0x842c('0xa')](_0x842c('0xb'),_0xdb9c6e,_[_0x842c('0xc')](_0x3d0124,'message')[_0x842c('0xd')](',\x20'));_0x33bd2a[_0x842c('0xe')]();}else{try{var _0x4708e3=eval('('+_0x4e8234[_0x842c('0xf')]+')');var _0x2a3e1e=_0x4708e3?_0x4e8234['priorityTrue']:_0x4e8234[_0x842c('0x10')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0xdb9c6e,_0x4e8234['condition'],_0x4708e3,_0x2a3e1e||_0x842c('0x11'));if(_0x2a3e1e){var _0x32eabf=_[_0x842c('0x12')](_0x33bd2a['rules'](),{'p':_0x2a3e1e});if(_0x32eabf>=0x0){logger['info'](_0x842c('0x13'),_0xdb9c6e,_0x2a3e1e||'next',_0x32eabf);_0x33bd2a[_0x842c('0x11')](_0x32eabf);}else{logger[_0x842c('0x14')](_0x842c('0x15'),_0xdb9c6e,_0x2a3e1e||_0x842c('0x11'));_0x33bd2a['stop']();}}else{_0x33bd2a[_0x842c('0x11')]();}}catch(_0x6a4693){logger[_0x842c('0xa')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0xdb9c6e,_0x6a4693[_0x842c('0x16')]);_0x33bd2a['stop']();}}}catch(_0x25bdfe){logger[_0x842c('0xa')](_0x842c('0xb'),_0xdb9c6e,JSON['stringify'](_0x25bdfe));_0x33bd2a['stop']();}};}; \ No newline at end of file +var _0xee9a=['rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','message','validate','lodash','html-to-text','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString','replace','length','error','[%s][GOTOIF]\x20%s','map','stop','condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex'];(function(_0x488ca1,_0xf6858e){var _0x4dd0a4=function(_0x40fb65){while(--_0x40fb65){_0x488ca1['push'](_0x488ca1['shift']());}};_0x4dd0a4(++_0xf6858e);}(_0xee9a,0xe6));var _0xaee9=function(_0x53bbf5,_0x313f09){_0x53bbf5=_0x53bbf5-0x0;var _0x533499=_0xee9a[_0x53bbf5];return _0x533499;};'use strict';var schema=require(_0xaee9('0x0'));var _=require(_0xaee9('0x1'));var htmlToText=require(_0xaee9('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xaee9('0x3'));var gotoif=schema({'condition':{'type':_0xaee9('0x4'),'required':!![],'message':_0xaee9('0x5')},'priorityTrue':{'type':_0xaee9('0x6'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xaee9('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xaee9('0x7')]=function(_0x281d3b,_0x3a100d){return function(_0x167dda){try{var _0x47d1c5={'condition':htmlToText[_0xaee9('0x8')](utils['getMustacheRender'](_0x3a100d[0x0],this),{'wordwrap':![]})[_0xaee9('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3a100d[0x1],'priorityFalse':_0x3a100d[0x2]};var _0x4c1dec=gotoif['validate'](_0x47d1c5,{'typecast':!![]});if(_0x4c1dec[_0xaee9('0xa')]){logger[_0xaee9('0xb')](_0xaee9('0xc'),_0x281d3b,_[_0xaee9('0xd')](_0x4c1dec,'message')['join'](',\x20'));_0x167dda[_0xaee9('0xe')]();}else{try{var _0x3dcea9=eval('('+_0x47d1c5[_0xaee9('0xf')]+')');var _0x11fc0b=_0x3dcea9?_0x47d1c5['priorityTrue']:_0x47d1c5[_0xaee9('0x10')];logger['info'](_0xaee9('0x11'),_0x281d3b,_0x47d1c5['condition'],_0x3dcea9,_0x11fc0b||_0xaee9('0x12'));if(_0x11fc0b){var _0x372ea5=_[_0xaee9('0x13')](_0x167dda[_0xaee9('0x14')](),{'p':_0x11fc0b});if(_0x372ea5>=0x0){logger[_0xaee9('0x15')](_0xaee9('0x16'),_0x281d3b,_0x11fc0b||_0xaee9('0x12'),_0x372ea5);_0x167dda[_0xaee9('0x12')](_0x372ea5);}else{logger[_0xaee9('0x15')](_0xaee9('0x17'),_0x281d3b,_0x11fc0b||_0xaee9('0x12'));_0x167dda[_0xaee9('0xe')]();}}else{_0x167dda[_0xaee9('0x12')]();}}catch(_0x217ce3){logger[_0xaee9('0xb')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x281d3b,_0x217ce3[_0xaee9('0x18')]);_0x167dda['stop']();}}}catch(_0x837d41){logger[_0xaee9('0xb')]('[%s][GOTOIF]\x20%s',_0x281d3b,JSON['stringify'](_0x837d41));_0x167dda['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 50ccfb9..2f30ec6 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 _0xdb7d=['[%s][GOTOP]\x20%s','map','message','join','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','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error'];(function(_0x4d81b4,_0xaf4f9b){var _0x2e2fe0=function(_0x1e3322){while(--_0x1e3322){_0x4d81b4['push'](_0x4d81b4['shift']());}};_0x2e2fe0(++_0xaf4f9b);}(_0xdb7d,0x174));var _0xddb7=function(_0x51aae2,_0x24124d){_0x51aae2=_0x51aae2-0x0;var _0x3532de=_0xdb7d[_0x51aae2];return _0x3532de;};'use strict';var schema=require('validate');var _=require(_0xddb7('0x0'));var logger=require(_0xddb7('0x1'))(_0xddb7('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xddb7('0x3')}});exports[_0xddb7('0x4')]=function(_0x10828b,_0x3ebe38){return function(_0x20ced4){try{var _0x11a516={'priority':_0x3ebe38[0x0]};var _0x198830=gotop[_0xddb7('0x5')](_0x11a516,{'typecast':!![]});if(_0x198830[_0xddb7('0x6')]){logger[_0xddb7('0x7')](_0xddb7('0x8'),_0x10828b,_[_0xddb7('0x9')](_0x198830,_0xddb7('0xa'))[_0xddb7('0xb')](',\x20'));_0x20ced4[_0xddb7('0xc')]();}else{logger[_0xddb7('0xd')](_0xddb7('0xe'),_0x10828b,_0x11a516['priority']);if(_0x11a516[_0xddb7('0xf')]){var _0x137906=_['findIndex'](_0x20ced4[_0xddb7('0x10')](),{'p':_0x11a516['priority']});if(_0x137906>=0x0){logger['info'](_0xddb7('0x11'),_0x10828b,_0x11a516['priority']||'next',_0x137906);_0x20ced4[_0xddb7('0x12')](_0x137906);}else{logger[_0xddb7('0xd')](_0xddb7('0x13'),_0x10828b,_0x11a516['priority']||_0xddb7('0x12'));_0x20ced4['stop']();}}else{_0x20ced4[_0xddb7('0x12')]();}}}catch(_0xe06e09){logger['error'](_0xddb7('0x8'),_0x10828b,JSON['stringify'](_0xe06e09));_0x20ced4['stop']();}};}; \ No newline at end of file +var _0x05a4=['stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%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','[%s][GOTOP]\x20%s','map','message','join'];(function(_0x299028,_0x4d7e9f){var _0x12154e=function(_0x558d18){while(--_0x558d18){_0x299028['push'](_0x299028['shift']());}};_0x12154e(++_0x4d7e9f);}(_0x05a4,0x199));var _0x405a=function(_0x1f93b2,_0xac1aa){_0x1f93b2=_0x1f93b2-0x0;var _0xaeab8c=_0x05a4[_0x1f93b2];return _0xaeab8c;};'use strict';var schema=require(_0x405a('0x0'));var _=require(_0x405a('0x1'));var logger=require('../../../../config/logger')(_0x405a('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x405a('0x3')}});exports[_0x405a('0x4')]=function(_0x52c47e,_0x25ffcf){return function(_0x1a4945){try{var _0x531fd0={'priority':_0x25ffcf[0x0]};var _0x4d7310=gotop[_0x405a('0x0')](_0x531fd0,{'typecast':!![]});if(_0x4d7310['length']){logger['error'](_0x405a('0x5'),_0x52c47e,_[_0x405a('0x6')](_0x4d7310,_0x405a('0x7'))[_0x405a('0x8')](',\x20'));_0x1a4945[_0x405a('0x9')]();}else{logger['info'](_0x405a('0xa'),_0x52c47e,_0x531fd0[_0x405a('0xb')]);if(_0x531fd0[_0x405a('0xb')]){var _0x33cbac=_[_0x405a('0xc')](_0x1a4945[_0x405a('0xd')](),{'p':_0x531fd0['priority']});if(_0x33cbac>=0x0){logger[_0x405a('0xe')](_0x405a('0xf'),_0x52c47e,_0x531fd0[_0x405a('0xb')]||'next',_0x33cbac);_0x1a4945[_0x405a('0x10')](_0x33cbac);}else{logger[_0x405a('0xe')](_0x405a('0x11'),_0x52c47e,_0x531fd0[_0x405a('0xb')]||_0x405a('0x10'));_0x1a4945[_0x405a('0x9')]();}}else{_0x1a4945[_0x405a('0x10')]();}}}catch(_0x70e832){logger['error']('[%s][GOTOP]\x20%s',_0x52c47e,JSON[_0x405a('0x12')](_0x70e832));_0x1a4945[_0x405a('0x9')]();}};}; \ 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 7b56d4e..59bcfe9 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 _0xfc25=['interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','account','upperFirst','AccountId','channel','InteractionId'];(function(_0x1311cc,_0x13fae7){var _0xa37f96=function(_0x35e0ae){while(--_0x35e0ae){_0x1311cc['push'](_0x1311cc['shift']());}};_0xa37f96(++_0x13fae7);}(_0xfc25,0x10f));var _0x5fc2=function(_0x2cd145,_0x4e181f){_0x2cd145=_0x2cd145-0x0;var _0x1b3d13=_0xfc25[_0x2cd145];return _0x1b3d13;};'use strict';var _=require(_0x5fc2('0x0'));var utils=require(_0x5fc2('0x1'));var logger=require(_0x5fc2('0x2'))(_0x5fc2('0x3'));var rpc={'chatMessage':require(_0x5fc2('0x4')),'openchannelMessage':require(_0x5fc2('0x5')),'mailMessage':require(_0x5fc2('0x6')),'smsMessage':require(_0x5fc2('0x7')),'faxMessage':require(_0x5fc2('0x8')),'whatsappMessage':require(_0x5fc2('0x9'))};exports[_0x5fc2('0xa')]=function(_0x5af151,_0x417036){return function(_0x38beaf){try{var _0x2603e9={'body':utils[_0x5fc2('0xb')](_0x417036[0x0],this),'ContactId':this[_0x5fc2('0xc')]['id']};if(this['channel']===_0x5fc2('0xd')){_0x2603e9['ChatWebsiteId']=this[_0x5fc2('0xe')]['id'];}else{_0x2603e9[_[_0x5fc2('0xf')](this['channel'])+_0x5fc2('0x10')]=this['account']['id'];}_0x2603e9[_[_0x5fc2('0xf')](this[_0x5fc2('0x11')])+_0x5fc2('0x12')]=this[_0x5fc2('0x13')]['id'];if(rpc[this[_0x5fc2('0x11')]+_0x5fc2('0x14')]){return rpc[this[_0x5fc2('0x11')]+_0x5fc2('0x14')][_0x5fc2('0x15')](_0x2603e9)[_0x5fc2('0x16')](function(_0x2c0360){logger[_0x5fc2('0x17')](_0x5fc2('0x18'),_0x5af151,_0x2603e9[_0x5fc2('0x19')]);_0x38beaf['next']();})[_0x5fc2('0x1a')](function(_0x5b72a6){logger['error'](_0x5fc2('0x18'),_0x5af151,JSON[_0x5fc2('0x1b')](_0x5b72a6));_0x38beaf[_0x5fc2('0x1c')]();});}}catch(_0x3add35){logger['error'](_0x5fc2('0x18'),_0x5af151,JSON['stringify'](_0x3add35));_0x38beaf[_0x5fc2('0x1c')]();}};}; \ No newline at end of file +var _0x2946=['routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','AccountId','account','upperFirst','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stop','stringify','lodash'];(function(_0x4d4a61,_0x32075f){var _0x1b0b7d=function(_0x2bd4ed){while(--_0x2bd4ed){_0x4d4a61['push'](_0x4d4a61['shift']());}};_0x1b0b7d(++_0x32075f);}(_0x2946,0x1da));var _0x6294=function(_0x5ec420,_0x2e0af1){_0x5ec420=_0x5ec420-0x0;var _0x4768f2=_0x2946[_0x5ec420];return _0x4768f2;};'use strict';var _=require(_0x6294('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x6294('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6294('0x2')),'smsMessage':require(_0x6294('0x3')),'faxMessage':require(_0x6294('0x4')),'whatsappMessage':require(_0x6294('0x5'))};exports[_0x6294('0x6')]=function(_0x29ee78,_0x4b672f){return function(_0x2d699b){try{var _0x5e973c={'body':utils[_0x6294('0x7')](_0x4b672f[0x0],this),'ContactId':this[_0x6294('0x8')]['id']};if(this[_0x6294('0x9')]===_0x6294('0xa')){_0x5e973c['ChatWebsiteId']=this['account']['id'];}else{_0x5e973c[_['upperFirst'](this[_0x6294('0x9')])+_0x6294('0xb')]=this[_0x6294('0xc')]['id'];}_0x5e973c[_[_0x6294('0xd')](this['channel'])+_0x6294('0xe')]=this[_0x6294('0xf')]['id'];if(rpc[this[_0x6294('0x9')]+'Message']){return rpc[this[_0x6294('0x9')]+_0x6294('0x10')]['create'](_0x5e973c)[_0x6294('0x11')](function(_0x560300){logger[_0x6294('0x12')](_0x6294('0x13'),_0x29ee78,_0x5e973c[_0x6294('0x14')]);_0x2d699b['next']();})[_0x6294('0x15')](function(_0x2bc84e){logger[_0x6294('0x16')](_0x6294('0x13'),_0x29ee78,JSON['stringify'](_0x2bc84e));_0x2d699b[_0x6294('0x17')]();});}}catch(_0x59e817){logger['error'](_0x6294('0x13'),_0x29ee78,JSON[_0x6294('0x18')](_0x59e817));_0x2d699b['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 b1419e8..aaa792f 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 _0x7dec=['stringify','consequence','info','[%s][NOOP]\x20%s','next','error'];(function(_0x5e3678,_0x51a39a){var _0xd66960=function(_0x368c5e){while(--_0x368c5e){_0x5e3678['push'](_0x5e3678['shift']());}};_0xd66960(++_0x51a39a);}(_0x7dec,0x1b7));var _0xc7de=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x7dec[_0x5d80de];return _0x1c7556;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')('routing');exports[_0xc7de('0x0')]=function(_0x4542b3,_0x33ed6c){return function(_0x34e53b){try{logger[_0xc7de('0x1')](_0xc7de('0x2'),_0x4542b3,utils['getMustacheRender'](_0x33ed6c[0x0],this));_0x34e53b[_0xc7de('0x3')]();}catch(_0x41e4d2){logger[_0xc7de('0x4')](_0xc7de('0x2'),_0x4542b3,JSON[_0xc7de('0x5')](_0x41e4d2));_0x34e53b['stop']();}};}; \ No newline at end of file +var _0x5310=['../../../../config/logger','routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify','stop','./utils'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x5310,0x14c));var _0x0531=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0x5310[_0x3a9661];return _0x5bb119;};'use strict';var utils=require(_0x0531('0x0'));var logger=require(_0x0531('0x1'))(_0x0531('0x2'));exports['consequence']=function(_0xd38913,_0x383117){return function(_0x394cfe){try{logger[_0x0531('0x3')](_0x0531('0x4'),_0xd38913,utils[_0x0531('0x5')](_0x383117[0x0],this));_0x394cfe[_0x0531('0x6')]();}catch(_0x35e2c3){logger['error']('[%s][NOOP]\x20%s',_0xd38913,JSON[_0x0531('0x7')](_0x35e2c3));_0x394cfe[_0x0531('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 176109c..7d67d6d 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 _0xedd9=['[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','close','rules','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','account','queue','from','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','chat','AccountId','info','name','message','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted'];(function(_0x3b3896,_0x4610a0){var _0x27a648=function(_0x257a34){while(--_0x257a34){_0x3b3896['push'](_0x3b3896['shift']());}};_0x27a648(++_0x4610a0);}(_0xedd9,0xfc));var _0x9edd=function(_0x4c8976,_0x5784b1){_0x4c8976=_0x4c8976-0x0;var _0x55ee12=_0xedd9[_0x4c8976];return _0x55ee12;};'use strict';var schema=require('validate');var _=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var seqqueue=require(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var Redis=require(_0x9edd('0x4'));var config=require(_0x9edd('0x5'));var logger=require(_0x9edd('0x6'))(_0x9edd('0x7'));var strategy=require('./strategy');config[_0x9edd('0x8')]=_[_0x9edd('0x9')](config[_0x9edd('0x8')],{'host':_0x9edd('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9edd('0x8')]));var attributes=['id','queue_id',_0x9edd('0xb'),_0x9edd('0xc'),_0x9edd('0xd'),_0x9edd('0xe')];function emit(_0x49d5e3,_0x494a24,_0x5d2f90){io['to'](_0x49d5e3)[_0x9edd('0xf')](_0x494a24,_0x5d2f90);}function emitChannelQueueInteraction(_0x138767,_0x523026,_0xbf9da6,_0x13dc4f,_0x5b6c00,_0x30c0d7,_0x1b73d1,_0x25e64c){var _0xfd544a=_[_0x9edd('0x10')](_0xbf9da6);_0xfd544a[_0x9edd('0x11')]=_0x25e64c;_0xfd544a[_0x9edd('0xc')]=_0x523026;_0xfd544a[_0x9edd('0xb')]=_0x13dc4f;_0xfd544a['id']=_0x5b6c00;if(_0x30c0d7){_0x1b73d1[util['format'](_0x9edd('0x12'),_0x138767)][_0x5b6c00]=_[_0x9edd('0x13')](_0xfd544a,attributes);}else{delete _0x1b73d1[util[_0x9edd('0x14')](_0x9edd('0x12'),_0x138767)][_0x5b6c00];}emit(util[_0x9edd('0x14')](_0x9edd('0x15'),_0x138767,_0x523026),util[_0x9edd('0x14')](_0x9edd('0x16'),_0x138767,_0x30c0d7?'save':_0x9edd('0x17')),_[_0x9edd('0x13')](_0xfd544a,attributes));}var rpc={'openchannelQueueReport':require(_0x9edd('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x9edd('0x19')),'smsQueueReport':require(_0x9edd('0x1a')),'faxQueueReport':require(_0x9edd('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x9edd('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9edd('0x1d'),'message':_0x9edd('0x1e')}});function startRouting(_0x4bdb88,_0x498977,_0x45c3ab,_0x50338f){if(_0x4bdb88&&_0x498977&&_0x45c3ab){_0x498977[_0x9edd('0x1f')]+=0x1;var _0x54a03f={'uniqueid':_0x4bdb88,'from':_0x45c3ab['body']?_0x45c3ab[_0x9edd('0x20')][_0x9edd('0xd')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x45c3ab[_0x9edd('0x21')]?_0x45c3ab[_0x9edd('0x21')]['id']:null,'ListId':_0x45c3ab[_0x9edd('0x22')]?_0x45c3ab['list']['id']:null};_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x25')]=_0x498977['id']||null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+'InteractionId']=_0x45c3ab[_0x9edd('0x26')]?_0x45c3ab[_0x9edd('0x26')]['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x27')]=_0x45c3ab['message']?_0x45c3ab['message']['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+(_0x45c3ab[_0x9edd('0x24')]!==_0x9edd('0x28')?_0x9edd('0x29'):'WebsiteId')]=_0x45c3ab['account']?_0x45c3ab[_0x9edd('0xb')]['id']:null;logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x4bdb88,_0x498977[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x45c3ab[_0x9edd('0x24')],_0x498977[_0x9edd('0x2b')],_0x54a03f,_0x45c3ab[_0x9edd('0xb')]['name'],_0x45c3ab[_0x9edd('0x2c')]['id'],!![],_0x50338f,_0x498977['id']);if(rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')][_0x9edd('0x2e')](_0x54a03f)[_0x9edd('0x2f')](function(_0x1fba7b){logger[_0x9edd('0x30')](_0x9edd('0x31'));});}}}function stopRouting(_0x4fd03f,_0x138002,_0x6907a5,_0xa55906){if(_0x4fd03f&&_0x138002){_0x138002[_0x9edd('0x1f')]-=0x1;var _0x5af178={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'acceptAt':moment()[_0x9edd('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x9edd('0x33')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')](_0x9edd('0x34'),_0x4fd03f,_0x138002[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x6907a5[_0x9edd('0x24')],_0x138002[_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x20')],_0x6907a5[_0x9edd('0xb')][_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x2c')]['id'],![],_0xa55906,_0x138002['id']);if(rpc[_0x6907a5[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x6907a5[_0x9edd('0x24')]+'QueueReport'][_0x9edd('0x35')](_0x4fd03f,_0x5af178)['catch'](function(_0x968303){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function endRouting(_0x434d26,_0x16770e,_0x4fa5ab,_0x6de835){if(_0x434d26&&_0x16770e){_0x16770e[_0x9edd('0x1f')]-=0x1;var _0x2b3469={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'exitAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'reason':_0x9edd('0x37')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x434d26,_0x16770e[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x4fa5ab['channel'],_0x16770e[_0x9edd('0x2b')],_0x4fa5ab['body'],_0x4fa5ab[_0x9edd('0xb')][_0x9edd('0x2b')],_0x4fa5ab[_0x9edd('0x2c')]['id'],![],_0x6de835);if(rpc[_0x4fa5ab['channel']+_0x9edd('0x2d')]){return rpc[_0x4fa5ab[_0x9edd('0x24')]+_0x9edd('0x2d')]['update'](_0x434d26,_0x2b3469)[_0x9edd('0x2f')](function(_0x51ad91){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function handleFindQueue(_0x50be2c){return function(_0x315f52){return _0x315f52[_0x9edd('0x2b')][_0x9edd('0x38')]()===_0x50be2c[_0x9edd('0x38')]();};}exports['consequence']=function(_0x449f01,_0x5bbdf8,_0x2bdb3f,_0xc1e657){return function(_0x587d74){try{var _0x318757={'name':_0x5bbdf8[0x0],'timeout':_0x5bbdf8[0x1]};var _0x49a128=queue['validate'](_0x318757,{'typecast':!![]});if(_0x49a128[_0x9edd('0x39')]){logger[_0x9edd('0x30')](_0x9edd('0x3a'),_0x449f01,_[_0x9edd('0x3b')](_0x49a128,_0x9edd('0x2c'))[_0x9edd('0x3c')](',\x20'));_0x587d74[_0x9edd('0x3d')]();}else{var _0x75efbe=_[_0x9edd('0x3e')](_0x2bdb3f[_0xc1e657[_0x9edd('0x24')]+_0x9edd('0x3f')],handleFindQueue(_0x318757[_0x9edd('0x2b')]));if(_0x75efbe){startRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);var _0x3d5eba=(_0x75efbe[_0x9edd('0x37')]||0xa)*0x3e8;var _0x46e9f4=(_0x318757['timeout']||0x14)*0x3e8;var _0x13197d,_0x2570e3;if(_0x3d5eba>_0x46e9f4){_0x46e9f4=_0x3d5eba;}var _0x2231c1=seqqueue[_0x9edd('0x40')](_0x3d5eba);_0x2231c1['id']=_0x449f01;_0x2231c1[_0x9edd('0x41')]=_0x3d5eba;_0x2231c1[_0x9edd('0x42')]=_0x46e9f4;_0x2231c1[_0x9edd('0x24')]=_0xc1e657['channel'];_0x2bdb3f['rules'][_0x449f01]['on']('end',function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x449f01);stopRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x13197d=undefined;_0x2231c1[_0x9edd('0x43')](!![]);if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}_0x587d74[_0x9edd('0x3d')]();});_0x2bdb3f[_0x9edd('0x44')][_0x449f01]['on']('complete',function(){if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}});_0x13197d=setTimeout(function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x449f01);endRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x2231c1[_0x9edd('0x43')](!![]);_0x587d74[_0x9edd('0x45')]();},_0x46e9f4);switch(_0x75efbe[_0x9edd('0x46')]){case _0x9edd('0x47'):strategy[_0x9edd('0x47')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);break;default:strategy[_0x9edd('0x48')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);}}else{logger['error'](_0x9edd('0x49'),_0x449f01,_0x318757[_0x9edd('0x2b')]);_0x587d74['stop']();}}}catch(_0xb93816){console[_0x9edd('0x4a')](_0xb93816);logger['error'](_0x9edd('0x3a'),_0x449f01,_0xb93816[_0x9edd('0x4b')]);_0x587d74[_0x9edd('0x3d')]();}};}; \ No newline at end of file +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(_0x334651,_0x6e99f6){var _0x29657c=function(_0x420a94){while(--_0x420a94){_0x334651['push'](_0x334651['shift']());}};_0x29657c(++_0x6e99f6);}(_0x3e74,0x175));var _0x43e7=function(_0x5b78c3,_0x373f66){_0x5b78c3=_0x5b78c3-0x0;var _0x12c9b5=_0x3e74[_0x5b78c3];return _0x12c9b5;};'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 diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 19f84ae..bd94b5d 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 _0xf757=['channel','busy','busyQueue','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','handleRun','bind','timeout','handleTimeout','drained','handleDrained','push','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership'];(function(_0x287d78,_0x82c6a0){var _0x880125=function(_0x46a636){while(--_0x46a636){_0x287d78['push'](_0x287d78['shift']());}};_0x880125(++_0x82c6a0);}(_0xf757,0x89));var _0x7f75=function(_0x1f1511,_0x4ea911){_0x1f1511=_0x1f1511-0x0;var _0x1d9ab8=_0xf757[_0x1f1511];return _0x1d9ab8;};'use strict';var _=require(_0x7f75('0x0'));var uuid=require(_0x7f75('0x1'));var util=require(_0x7f75('0x2'));var logger=require(_0x7f75('0x3'))(_0x7f75('0x4'));var Agent=function(_0x31d79b,_0x542a02,_0x27af46,_0x11d0a0){this[_0x7f75('0x5')]=uuid['v4']();this[_0x7f75('0x6')]=_0x31d79b;this[_0x7f75('0x7')]=_0x542a02;this[_0x7f75('0x8')]=_0x27af46;this['routing']=_0x11d0a0;this[_0x7f75('0x6')]['push'](this[_0x7f75('0x9')][_0x7f75('0xa')](this),this['handleTimeout']['bind'](this));this['squeue']['on'](_0x7f75('0xb'),this[_0x7f75('0xc')][_0x7f75('0xa')](this));this[_0x7f75('0x6')]['on'](_0x7f75('0xd'),this[_0x7f75('0xe')][_0x7f75('0xa')](this));};Agent['prototype'][_0x7f75('0xf')]=function(){this[_0x7f75('0x6')][_0x7f75('0xf')](this[_0x7f75('0x9')][_0x7f75('0xa')](this),this['handleTimeout']['bind'](this));};Agent[_0x7f75('0x10')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0x7f75('0x10')][_0x7f75('0x9')]=function(_0x1a4fb8){logger[_0x7f75('0x11')](_0x7f75('0x12'),this[_0x7f75('0x6')]['id'],this[_0x7f75('0x7')]['id']);if(_[_0x7f75('0x13')](this[_0x7f75('0x8')][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']])){logger['info'](_0x7f75('0x15'),this[_0x7f75('0x6')]['id'],this[_0x7f75('0x7')]['id']);setTimeout(this[_0x7f75('0xf')][_0x7f75('0xa')](this),0x3e8);}else{if(this[_0x7f75('0x4')][_0x7f75('0x16')]||util['isAgentAvailable'](this[_0x7f75('0x6')]['id'],this['realtime'][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']],this['squeue'][_0x7f75('0x17')],![])){this[_0x7f75('0x8')][_0x7f75('0x14')][this['agent']['id']][_0x7f75('0x18')]=!![];this[_0x7f75('0x8')]['agents'][this[_0x7f75('0x7')]['id']][_0x7f75('0x19')]=undefined;util['showNotification'](this[_0x7f75('0x5')],this[_0x7f75('0x6')]['id'],this['realtime'][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']],null,this[_0x7f75('0x4')]);util['writeLog'](this[_0x7f75('0x6')]['id'],this[_0x7f75('0x8')][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']],'RINGING'+(this['routing'][_0x7f75('0x16')]?':FORCED':''));}else{logger[_0x7f75('0x11')](_0x7f75('0x1a'),this[_0x7f75('0x6')]['id'],this[_0x7f75('0x7')]['id']);setTimeout(this[_0x7f75('0xf')]['bind'](this),0x3e8);}}};Agent[_0x7f75('0x10')][_0x7f75('0xc')]=function(_0x21a480){if(_[_0x7f75('0x13')](this[_0x7f75('0x8')][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']])){return logger[_0x7f75('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);}else{logger[_0x7f75('0x11')](_0x7f75('0x1b'),this[_0x7f75('0x6')]['id'],this[_0x7f75('0x7')]['id']);util[_0x7f75('0x1c')](this['notificationId'],this[_0x7f75('0x6')]['id'],this[_0x7f75('0x8')][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']],null,this[_0x7f75('0x4')]);this[_0x7f75('0x8')][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']]['busy']=![];this[_0x7f75('0x8')]['agents'][this[_0x7f75('0x7')]['id']]['busyQueue']=undefined;util['writeLog'](this[_0x7f75('0x6')]['id'],this[_0x7f75('0x8')][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']],_0x21a480?_0x7f75('0x1d'):_0x7f75('0x1e'));}if(!_0x21a480){setTimeout(this['push'][_0x7f75('0xa')](this),0x3e8);}};function agent(_0x130e0b,_0x4161e5,_0x47cd6a,_0x544e0f){return new Agent(_0x130e0b,_0x4161e5,_0x47cd6a,_0x544e0f);}module[_0x7f75('0x1f')]=agent; \ No newline at end of file +var _0xe746=['prototype','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','../../../../../config/logger','notificationId','agent','realtime','routing','squeue','handleRun','bind','timeout','drained','handleDrained','push','handleTimeout','info','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x182941,_0x2ee2ce){var _0x322428=function(_0x5e2c9d){while(--_0x5e2c9d){_0x182941['push'](_0x182941['shift']());}};_0x322428(++_0x2ee2ce);}(_0xe746,0xcc));var _0x6e74=function(_0x2407fa,_0x422faf){_0x2407fa=_0x2407fa-0x0;var _0x43f05e=_0xe746[_0x2407fa];return _0x43f05e;};'use strict';var _=require(_0x6e74('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x6e74('0x1'))('routing');var Agent=function(_0xaf65e6,_0x3fa18a,_0x3bfe84,_0x1b9ea5){this[_0x6e74('0x2')]=uuid['v4']();this['squeue']=_0xaf65e6;this[_0x6e74('0x3')]=_0x3fa18a;this[_0x6e74('0x4')]=_0x3bfe84;this[_0x6e74('0x5')]=_0x1b9ea5;this[_0x6e74('0x6')]['push'](this[_0x6e74('0x7')]['bind'](this),this['handleTimeout'][_0x6e74('0x8')](this));this[_0x6e74('0x6')]['on'](_0x6e74('0x9'),this['handleTimeout']['bind'](this));this[_0x6e74('0x6')]['on'](_0x6e74('0xa'),this[_0x6e74('0xb')]['bind'](this));};Agent['prototype'][_0x6e74('0xc')]=function(){this[_0x6e74('0x6')][_0x6e74('0xc')](this[_0x6e74('0x7')][_0x6e74('0x8')](this),this[_0x6e74('0xd')][_0x6e74('0x8')](this));};Agent['prototype'][_0x6e74('0xb')]=function(){this[_0x6e74('0xd')](!![]);};Agent['prototype'][_0x6e74('0x7')]=function(_0x3a423c){logger[_0x6e74('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x6e74('0x6')]['id'],this[_0x6e74('0x3')]['id']);if(_[_0x6e74('0xf')](this['realtime'][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']])){logger[_0x6e74('0xe')](_0x6e74('0x11'),this['squeue']['id'],this[_0x6e74('0x3')]['id']);setTimeout(this['push'][_0x6e74('0x8')](this),0x3e8);}else{if(this[_0x6e74('0x5')][_0x6e74('0x12')]||util[_0x6e74('0x13')](this['squeue']['id'],this['realtime']['agents'][this['agent']['id']],this['squeue'][_0x6e74('0x14')],![])){this[_0x6e74('0x4')][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']]['busy']=!![];this[_0x6e74('0x4')][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']][_0x6e74('0x15')]=undefined;util[_0x6e74('0x16')](this[_0x6e74('0x2')],this['squeue']['id'],this[_0x6e74('0x4')]['agents'][this['agent']['id']],null,this['routing']);util[_0x6e74('0x17')](this[_0x6e74('0x6')]['id'],this['realtime'][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']],_0x6e74('0x18')+(this[_0x6e74('0x5')][_0x6e74('0x12')]?_0x6e74('0x19'):''));}else{logger[_0x6e74('0xe')](_0x6e74('0x1a'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x6e74('0x8')](this),0x3e8);}}};Agent[_0x6e74('0x1b')]['handleTimeout']=function(_0x10db4e){if(_[_0x6e74('0xf')](this[_0x6e74('0x4')][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']])){return logger[_0x6e74('0xe')](_0x6e74('0x11'),this[_0x6e74('0x6')]['id'],this[_0x6e74('0x3')]['id']);}else{logger[_0x6e74('0xe')](_0x6e74('0x1c'),this[_0x6e74('0x6')]['id'],this[_0x6e74('0x3')]['id']);util[_0x6e74('0x1d')](this[_0x6e74('0x2')],this[_0x6e74('0x6')]['id'],this[_0x6e74('0x4')][_0x6e74('0x10')][this['agent']['id']],null,this[_0x6e74('0x5')]);this[_0x6e74('0x4')][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']]['busy']=![];this[_0x6e74('0x4')][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']][_0x6e74('0x15')]=undefined;util['writeLog'](this[_0x6e74('0x6')]['id'],this['realtime'][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']],_0x10db4e?_0x6e74('0x1e'):_0x6e74('0x1f'));}if(!_0x10db4e){setTimeout(this[_0x6e74('0xc')][_0x6e74('0x8')](this),0x3e8);}};function agent(_0x38d45e,_0x17d7aa,_0x24d528,_0x38f7d5){return new Agent(_0x38d45e,_0x17d7aa,_0x24d528,_0x38f7d5);}module[_0x6e74('0x20')]=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 37b4f63..51533af 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 _0x6a2a=['prototype','isNil','length','Agents','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busy','busyQueue','name','showNotification','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','queue','realtime','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained'];(function(_0x34c562,_0xa49d96){var _0x34f738=function(_0x4572eb){while(--_0x4572eb){_0x34c562['push'](_0x34c562['shift']());}};_0x34f738(++_0xa49d96);}(_0x6a2a,0xb7));var _0xa6a2=function(_0x4fb614,_0x3f1326){_0x4fb614=_0x4fb614-0x0;var _0x14222b=_0x6a2a[_0x4fb614];return _0x14222b;};'use strict';var _=require(_0xa6a2('0x0'));var uuid=require(_0xa6a2('0x1'));var util=require(_0xa6a2('0x2'));var logger=require(_0xa6a2('0x3'))(_0xa6a2('0x4'));var Beepall=function(_0x29bc22,_0x38a211,_0x34404e,_0x168846){this['notificationId']=uuid['v4']();this[_0xa6a2('0x5')]=_0x29bc22;this[_0xa6a2('0x6')]=_0x38a211;this[_0xa6a2('0x7')]=_0x34404e;this[_0xa6a2('0x4')]=_0x168846;this['squeue'][_0xa6a2('0x8')](this[_0xa6a2('0x9')][_0xa6a2('0xa')](this),this['handleTimeout'][_0xa6a2('0xa')](this));this['squeue']['on'](_0xa6a2('0xb'),this[_0xa6a2('0xc')]['bind'](this));this[_0xa6a2('0x5')]['on'](_0xa6a2('0xd'),this[_0xa6a2('0xe')][_0xa6a2('0xa')](this));};Beepall[_0xa6a2('0xf')][_0xa6a2('0x8')]=function(){this[_0xa6a2('0x5')][_0xa6a2('0x8')](this[_0xa6a2('0x9')][_0xa6a2('0xa')](this),this[_0xa6a2('0xc')][_0xa6a2('0xa')](this));};Beepall[_0xa6a2('0xf')][_0xa6a2('0xe')]=function(_0x49163){this[_0xa6a2('0xc')](!![]);};Beepall[_0xa6a2('0xf')][_0xa6a2('0x9')]=function(_0x5daf9b){var _0x2ad403=!![];if(!_[_0xa6a2('0x10')](this['queue'])&&!_[_0xa6a2('0x10')](this[_0xa6a2('0x6')]['Agents'])&&this[_0xa6a2('0x6')]['Agents'][_0xa6a2('0x11')]>0x0){for(var _0xb1853d=0x0,_0x5e42ff;_0xb1853d0x0){for(var _0x2852be=0x0,_0x2b0fe;_0x2852be0x0&&_0x2c443c[_0x14cd25+_0xca45('0x21')]>=_0x2c443c[_0x14cd25+_0xca45('0x22')]){writeLog(_0x14816d,_0x2c443c,_0x14cd25[_0xca45('0x23')]()+_0xca45('0x24'));return![];}}return!![];};exports[_0xca45('0x25')]=function(_0x59cb19,_0x27353b,_0x2a5cd4,_0x3593a5,_0x4d546c){return sendNotification(!![],_0x59cb19,_0x27353b,_0x2a5cd4,_0x3593a5,_0x4d546c);};exports['hideNotification']=function(_0x592ad2,_0x430591,_0x2e51b1,_0x5cb991,_0xa1870d){return sendNotification(![],_0x592ad2,_0x430591,_0x2e51b1,_0x5cb991,_0xa1870d);};exports[_0xca45('0x26')]=writeLog; \ No newline at end of file +var _0xf8aa=['msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','message','notification:%s','save','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','lodash','mustache','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue'];(function(_0x33a48c,_0x4676f1){var _0x512897=function(_0x3423af){while(--_0x3423af){_0x33a48c['push'](_0x33a48c['shift']());}};_0x512897(++_0x4676f1);}(_0xf8aa,0x13b));var _0xaf8a=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xf8aa[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xaf8a('0x0'));var util=require('util');var utils=require('../utils');var Mustache=require(_0xaf8a('0x1'));var Redis=require('ioredis');var config=require(_0xaf8a('0x2'));var logger=require(_0xaf8a('0x3'))(_0xaf8a('0x4'));config[_0xaf8a('0x5')]=_[_0xaf8a('0x6')](config[_0xaf8a('0x5')],{'host':_0xaf8a('0x7'),'port':0x18eb});var io=require(_0xaf8a('0x8'))(new Redis(config[_0xaf8a('0x5')]));function emit(_0x2ce005,_0x249266,_0x396b5e){io['to'](_0x2ce005)[_0xaf8a('0x9')](_0x249266,_0x396b5e);}function sendNotification(_0x3e667d,_0x35dcf1,_0x4f0a62,_0x45932f,_0x43cf79,_0xcc4ea){io['to'](util[_0xaf8a('0xa')](_0xaf8a('0xb'),_0x45932f[_0xaf8a('0xc')]))['emit'](_0xaf8a('0xd'),_0x45932f);var _0x38db75=_0xcc4ea||{};var _0x1eb352=_0x4f0a62[_0xaf8a('0xe')]('.');var _0xedd483={'uniqueid':_0x35dcf1,'channel':_0x1eb352[0x0],'id':_0x1eb352[0x1],'title':_0x1eb352[0x0]+_0xaf8a('0xf'),'interactionId':_0x1eb352[0x2],'queue':_0x43cf79?_0x43cf79[_0xaf8a('0xc')]:null,'sound':_0x38db75[_0xaf8a('0x10')][_0xaf8a('0x11')],'shake':_0x38db75[_0xaf8a('0x10')][_0xaf8a('0x12')]};try{if(!_0x38db75[_0xaf8a('0x13')]){_0x38db75[_0xaf8a('0x13')]={};}if(_0x43cf79){_0x38db75[_0xaf8a('0x13')][_0xaf8a('0x14')]=_0x43cf79;}else if(_0x38db75[_0xaf8a('0x13')][_0xaf8a('0x14')]){delete _0x38db75[_0xaf8a('0x13')]['queue'];}_0xedd483[_0xaf8a('0x15')]=utils[_0xaf8a('0x16')](_0x38db75[_0xaf8a('0x10')][_0xaf8a('0x17')],_0x38db75);}catch(_0x5c8877){_0xedd483['msg']=_0xaf8a('0x18');logger['error'](util['format']('[%s][QUEUE]\x20%s',_0x35dcf1,_0x5c8877[_0xaf8a('0x19')]));}io['to'](util[_0xaf8a('0xa')]('user:%s',_0x45932f[_0xaf8a('0xc')]))[_0xaf8a('0x9')](util[_0xaf8a('0xa')](_0xaf8a('0x1a'),_0x3e667d?_0xaf8a('0x1b'):'remove'),_0xedd483);}function writeLog(_0x4d5a55,_0x3ba000,_0x550a1d){return logger['info'](util[_0xaf8a('0xa')](_0xaf8a('0x1c'),_0x4d5a55,_0x3ba000[_0xaf8a('0xc')],_0x550a1d));}exports[_0xaf8a('0x1d')]=function(_0x123bfa,_0x343664,_0x23ba85,_0x1312b){if(_0x343664['busy']){writeLog(_0x123bfa,_0x343664,_0xaf8a('0x1e'));return![];}if(!_0x343664[_0xaf8a('0x1f')]){writeLog(_0x123bfa,_0x343664,_0xaf8a('0x20'));return![];}if(_0x343664[_0x23ba85+_0xaf8a('0x21')]){writeLog(_0x123bfa,_0x343664,_0xaf8a('0x22'));return![];}if(_0x1312b&&_0x343664[_0xaf8a('0x23')](_0x23ba85+_0xaf8a('0x24'))&&_0x343664[_0xaf8a('0x23')](_0x23ba85+_0xaf8a('0x25'))){if(_0x343664[_0x23ba85+_0xaf8a('0x24')]>0x0&&_0x343664[_0x23ba85+_0xaf8a('0x25')]>=_0x343664[_0x23ba85+_0xaf8a('0x24')]){writeLog(_0x123bfa,_0x343664,_0x23ba85[_0xaf8a('0x26')]()+_0xaf8a('0x27'));return![];}}return!![];};exports[_0xaf8a('0x28')]=function(_0x3bb114,_0x27bded,_0x41781f,_0x24efaf,_0x13168c){return sendNotification(!![],_0x3bb114,_0x27bded,_0x41781f,_0x24efaf,_0x13168c);};exports[_0xaf8a('0x29')]=function(_0xfc4061,_0x5e6d16,_0x17544a,_0x1f7642,_0x238e09){return sendNotification(![],_0xfc4061,_0x5e6d16,_0x17544a,_0x1f7642,_0x238e09);};exports['writeLog']=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 57ed86d..f55f62b 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 _0x9e5a=['replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','lodash','consequence','validate','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x9e5a,0x118));var _0xa9e5=function(_0x4d09eb,_0x9a0421){_0x4d09eb=_0x4d09eb-0x0;var _0x4429b4=_0x9e5a[_0x4d09eb];return _0x4429b4;};'use strict';var schema=require('validate');var sh=require(_0xa9e5('0x0'));var _=require(_0xa9e5('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xa9e5('0x2')]=function(_0x517f6e,_0x1f2eb7){return function(_0x550f9c){try{var _0x2698e3={'command':_0x1f2eb7[0x0]};var _0x5123b3=system[_0xa9e5('0x3')](_0x2698e3,{'typecast':!![]});if(_0x5123b3['length']){logger[_0xa9e5('0x4')](_0xa9e5('0x5'),_0x517f6e,_[_0xa9e5('0x6')](_0x5123b3,_0xa9e5('0x7'))['join'](',\x20'));logger[_0xa9e5('0x8')](_0xa9e5('0x9'),_0x517f6e);_0x550f9c[_0xa9e5('0xa')]();}else{var _0x33679e=this;var _0x3ce2a1=utils[_0xa9e5('0xb')](_0x1f2eb7[0x0],this);logger['info'](_0xa9e5('0xc'),_0x517f6e,_0x3ce2a1);sh[_0xa9e5('0xd')](_['trim'](_0x3ce2a1),function(_0x245065,_0x47534b){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x517f6e,_0x245065);if(_0x245065==0x0){var _0x5f2f2c=_0x47534b[_0xa9e5('0xe')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x1f2eb7[0x1])||_[_0xa9e5('0xf')](_0x1f2eb7[0x1])){logger['info'](_0xa9e5('0x10'),_0x517f6e);_0x33679e[_0xa9e5('0x11')][_0x1f2eb7[0x1]]=_0x5f2f2c;}else{logger['info'](_0xa9e5('0x12'),_0x517f6e,_0x1f2eb7[0x1],_0x5f2f2c);_0x33679e['body'][_0x1f2eb7[0x1]]=_0x5f2f2c;}}_0x550f9c[_0xa9e5('0xa')]();});}}catch(_0x4b2e84){logger[_0xa9e5('0x4')](_0xa9e5('0x5'),_0x517f6e,_[_0xa9e5('0x13')](_0x4b2e84)?JSON[_0xa9e5('0x14')](_0x4b2e84):_0x4b2e84);logger[_0xa9e5('0x8')](_0xa9e5('0x9'),_0x517f6e);_0x550f9c[_0xa9e5('0xa')]();}};}; \ No newline at end of file +var _0x6ce3=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','[%s][SYSTEM]\x20%s','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','map','join','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isEmpty'];(function(_0x36f641,_0x1a3063){var _0x39b299=function(_0x20c0a3){while(--_0x20c0a3){_0x36f641['push'](_0x36f641['shift']());}};_0x39b299(++_0x1a3063);}(_0x6ce3,0x1bf));var _0x36ce=function(_0x3525b3,_0x71b7aa){_0x3525b3=_0x3525b3-0x0;var _0x287126=_0x6ce3[_0x3525b3];return _0x287126;};'use strict';var schema=require(_0x36ce('0x0'));var sh=require(_0x36ce('0x1'));var _=require(_0x36ce('0x2'));var utils=require('./utils');var logger=require(_0x36ce('0x3'))('routing');var system=schema({'command':{'type':_0x36ce('0x4'),'required':!![],'message':_0x36ce('0x5')}});exports['consequence']=function(_0x3cd53f,_0x59eac1){return function(_0x18041a){try{var _0x2a7ff4={'command':_0x59eac1[0x0]};var _0x5f2c34=system[_0x36ce('0x0')](_0x2a7ff4,{'typecast':!![]});if(_0x5f2c34['length']){logger[_0x36ce('0x6')]('[%s][SYSTEM]\x20%s',_0x3cd53f,_[_0x36ce('0x7')](_0x5f2c34,'message')[_0x36ce('0x8')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3cd53f);_0x18041a['next']();}else{var _0x4a6ed9=this;var _0x4b2825=utils[_0x36ce('0x9')](_0x59eac1[0x0],this);logger[_0x36ce('0xa')](_0x36ce('0xb'),_0x3cd53f,_0x4b2825);sh[_0x36ce('0xc')](_['trim'](_0x4b2825),function(_0x3b0860,_0x39378b){logger[_0x36ce('0xa')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x3cd53f,_0x3b0860);if(_0x3b0860==0x0){var _0x714e8d=_0x39378b[_0x36ce('0xd')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x59eac1[0x1])||_[_0x36ce('0xe')](_0x59eac1[0x1])){logger[_0x36ce('0xa')](_0x36ce('0xf'),_0x3cd53f);_0x4a6ed9[_0x36ce('0x10')][_0x59eac1[0x1]]=_0x714e8d;}else{logger[_0x36ce('0xa')](_0x36ce('0x11'),_0x3cd53f,_0x59eac1[0x1],_0x714e8d);_0x4a6ed9['body'][_0x59eac1[0x1]]=_0x714e8d;}}_0x18041a[_0x36ce('0x12')]();});}}catch(_0x5eb756){logger[_0x36ce('0x6')](_0x36ce('0x13'),_0x3cd53f,_[_0x36ce('0x14')](_0x5eb756)?JSON['stringify'](_0x5eb756):_0x5eb756);logger[_0x36ce('0xa')](_0x36ce('0x15'),_0x3cd53f);_0x18041a['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index f761e94..5a61dd6 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 _0x4b20=['../../rpc/mailInteraction','../../rpc/faxInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','catch','stringify','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x16440b,_0x4befe6){var _0x443362=function(_0x1cb562){while(--_0x1cb562){_0x16440b['push'](_0x16440b['shift']());}};_0x443362(++_0x4befe6);}(_0x4b20,0x8d));var _0x04b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b20[_0x14add3];return _0x4a174f;};'use strict';var schema=require('validate');var _=require(_0x04b2('0x0'));var rpc={'chatInteraction':require(_0x04b2('0x1')),'openchannelInteraction':require(_0x04b2('0x2')),'smsInteraction':require(_0x04b2('0x3')),'mailInteraction':require(_0x04b2('0x4')),'faxInteraction':require(_0x04b2('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x04b2('0x6'));var tag=schema({'tag':{'type':_0x04b2('0x7'),'required':!![],'message':_0x04b2('0x8')}});exports[_0x04b2('0x9')]=function(_0x43d1d5,_0x363a07,_0x39c5c9,_0x29366d){return function(_0x40149a){try{var _0x1f1b3d={'tag':_0x363a07[0x0]};var _0x116fc3=tag[_0x04b2('0xa')](_0x1f1b3d,{'typecast':!![]});if(_0x116fc3[_0x04b2('0xb')]){logger[_0x04b2('0xc')](_0x04b2('0xd'),_0x43d1d5,_[_0x04b2('0xe')](_0x116fc3,_0x04b2('0xf'))[_0x04b2('0x10')](',\x20'));logger[_0x04b2('0x11')](_0x04b2('0x12'),_0x43d1d5);_0x40149a[_0x04b2('0x13')]();}else{var _0x464b8f={'ids':[_0x363a07[0x0]]};if(rpc[_0x29366d['channel']+'Interaction']){rpc[_0x29366d['channel']+_0x04b2('0x14')][_0x04b2('0x15')](_0x29366d[_0x04b2('0x16')]['id'],_0x464b8f)[_0x04b2('0x17')](function(_0x2f62ba){logger[_0x04b2('0x11')](_0x04b2('0x18'),_0x43d1d5,_0x363a07[0x1],_0x29366d[_0x04b2('0x19')],_0x29366d[_0x04b2('0x16')]['id']);})[_0x04b2('0x1a')](function(_0x4fb595){logger[_0x04b2('0xc')]('[%s][TAG]\x20%s',_0x43d1d5,JSON[_0x04b2('0x1b')](_0x4fb595));logger[_0x04b2('0x11')](_0x04b2('0x12'),_0x43d1d5);})['finally'](function(){_0x40149a[_0x04b2('0x13')]();});}}}catch(_0x285d60){logger['error'](_0x04b2('0xd'),_0x43d1d5,_[_0x04b2('0x1c')](_0x285d60)?JSON[_0x04b2('0x1b')](_0x285d60):_0x285d60);logger[_0x04b2('0x11')](_0x04b2('0x12'),_0x43d1d5);_0x40149a[_0x04b2('0x13')]();}};}; \ No newline at end of file +var _0x4282=['error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','finally','next','stringify','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','consequence','length'];(function(_0x5a1fdc,_0x41b01a){var _0x3e1096=function(_0x3be327){while(--_0x3be327){_0x5a1fdc['push'](_0x5a1fdc['shift']());}};_0x3e1096(++_0x41b01a);}(_0x4282,0x1dc));var _0x2428=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0x4282[_0x6f1a87];return _0x2495c7;};'use strict';var schema=require(_0x2428('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x2428('0x1')),'openchannelInteraction':require(_0x2428('0x2')),'smsInteraction':require(_0x2428('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x2428('0x4')),'whatsappInteraction':require(_0x2428('0x5'))};var logger=require('../../../../config/logger')(_0x2428('0x6'));var tag=schema({'tag':{'type':_0x2428('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x2428('0x8')]=function(_0x122a62,_0x2320c0,_0x20f324,_0x24fd81){return function(_0x3bd2d3){try{var _0x5d573f={'tag':_0x2320c0[0x0]};var _0x53e2d3=tag[_0x2428('0x0')](_0x5d573f,{'typecast':!![]});if(_0x53e2d3[_0x2428('0x9')]){logger[_0x2428('0xa')](_0x2428('0xb'),_0x122a62,_[_0x2428('0xc')](_0x53e2d3,_0x2428('0xd'))[_0x2428('0xe')](',\x20'));logger[_0x2428('0xf')](_0x2428('0x10'),_0x122a62);_0x3bd2d3['next']();}else{var _0x506e02={'ids':[_0x2320c0[0x0]]};if(rpc[_0x24fd81['channel']+_0x2428('0x11')]){rpc[_0x24fd81[_0x2428('0x12')]+_0x2428('0x11')][_0x2428('0x13')](_0x24fd81[_0x2428('0x14')]['id'],_0x506e02)[_0x2428('0x15')](function(_0x5ecef9){logger[_0x2428('0xf')](_0x2428('0x16'),_0x122a62,_0x2320c0[0x1],_0x24fd81['channel'],_0x24fd81[_0x2428('0x14')]['id']);})[_0x2428('0x17')](function(_0x411134){logger[_0x2428('0xa')](_0x2428('0xb'),_0x122a62,JSON['stringify'](_0x411134));logger['info'](_0x2428('0x10'),_0x122a62);})[_0x2428('0x18')](function(){_0x3bd2d3[_0x2428('0x19')]();});}}}catch(_0x1e22b1){logger[_0x2428('0xa')]('[%s][TAG]\x20%s',_0x122a62,_['isObject'](_0x1e22b1)?JSON[_0x2428('0x1a')](_0x1e22b1):_0x1e22b1);logger[_0x2428('0xf')](_0x2428('0x10'),_0x122a62);_0x3bd2d3[_0x2428('0x19')]();}};}; \ 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 68eca7f..c2dce73 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 _0x1f38=['lodash','exports','render','body','contact','message','account','interaction','mustache'];(function(_0x46890c,_0x5a478c){var _0x1b0cde=function(_0x14a48e){while(--_0x14a48e){_0x46890c['push'](_0x46890c['shift']());}};_0x1b0cde(++_0x5a478c);}(_0x1f38,0xd7));var _0x81f3=function(_0x4b662d,_0x5b8058){_0x4b662d=_0x4b662d-0x0;var _0x3b9fd4=_0x1f38[_0x4b662d];return _0x3b9fd4;};'use strict';var Mustache=require(_0x81f3('0x0'));var _=require(_0x81f3('0x1'));module[_0x81f3('0x2')]={'getMustacheRender':function(_0x3f167c,_0x261dcf){return Mustache[_0x81f3('0x3')](_0x3f167c,_['merge'](_0x261dcf[_0x81f3('0x4')],{'contact':_0x261dcf[_0x81f3('0x5')],'message':_0x261dcf[_0x81f3('0x6')],'account':_0x261dcf[_0x81f3('0x7')],'interaction':_0x261dcf[_0x81f3('0x8')],'list':_0x261dcf['list']}))||'';}}; \ No newline at end of file +var _0xd4bd=['lodash','exports','merge','body','contact','message','account','mustache'];(function(_0x55b86a,_0x9f9772){var _0x46f950=function(_0x3113b0){while(--_0x3113b0){_0x55b86a['push'](_0x55b86a['shift']());}};_0x46f950(++_0x9f9772);}(_0xd4bd,0x15f));var _0xdd4b=function(_0x539b71,_0x4daf0b){_0x539b71=_0x539b71-0x0;var _0x3d1a59=_0xd4bd[_0x539b71];return _0x3d1a59;};'use strict';var Mustache=require(_0xdd4b('0x0'));var _=require(_0xdd4b('0x1'));module[_0xdd4b('0x2')]={'getMustacheRender':function(_0x1c766f,_0x54b1db){return Mustache['render'](_0x1c766f,_[_0xdd4b('0x3')](_0x54b1db[_0xdd4b('0x4')],{'contact':_0x54b1db[_0xdd4b('0x5')],'message':_0x54b1db[_0xdd4b('0x6')],'account':_0x54b1db[_0xdd4b('0x7')],'interaction':_0x54b1db['interaction'],'list':_0x54b1db['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index e0dec80..e9d495e 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 _0x5dc2=['server','http','127.0.0.1','log','lodash','util','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','split','push','slice','dialogflow','dialogflowv2','appdata','amazonlex','tag','%s:%s:%s','intervals','./applications/','consequence','priority','Push\x20new\x20rule','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','info','stack','routing\x20is\x20empty','QueueReport','UserId','catch','agent','agents','busy','busyQueue','message\x20is\x20empty','hasOwnProperty','capacity','agent\x20not\x20found','chatQueues','loggedIn','waiting','mailQueues','available','openchannelQueues','name','paused','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','values','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions'];(function(_0x2c1fbd,_0x3470ff){var _0x506652=function(_0x45544f){while(--_0x45544f){_0x2c1fbd['push'](_0x2c1fbd['shift']());}};_0x506652(++_0x3470ff);}(_0x5dc2,0xb6));var _0x25dc=function(_0x2b2321,_0x2ccacd){_0x2b2321=_0x2b2321-0x0;var _0x14e601=_0x5dc2[_0x2b2321];return _0x14e601;};'use strict';var _=require(_0x25dc('0x0'));var util=require(_0x25dc('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x25dc('0x2'));var BPromise=require(_0x25dc('0x3'));var uuid=require(_0x25dc('0x4'));var config=require('../../../config/environment');var logger=require(_0x25dc('0x5'))(_0x25dc('0x6'));var rpc={'openchannelQueueReport':require(_0x25dc('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x25dc('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x25dc('0x9')),'whatsappQueueReport':require(_0x25dc('0xa'))};var RuleEngine=require(_0x25dc('0xb'));function getId(_0x46b603,_0x1fa806,_0x575178){return util[_0x25dc('0xc')](_0x25dc('0xd'),_0x46b603,_0x1fa806||0x0,_0x575178||0x0);}function getIntervals(_0x52f81a,_0x209dd0){var _0xb3a2ec=[];if(!_[_0x25dc('0xe')](_0x209dd0[_0x25dc('0xf')])&&!_['isNil'](_0x52f81a[_0x209dd0[_0x25dc('0xf')]])&&!_[_0x25dc('0xe')](_0x52f81a[_0x209dd0[_0x25dc('0xf')]][_0x25dc('0x10')])){_0xb3a2ec=_[_0x25dc('0x11')](_0x52f81a[_0x209dd0[_0x25dc('0xf')]][_0x25dc('0x10')],_0x25dc('0x12'));}else if(!_[_0x25dc('0xe')](_0x209dd0['interval'])){_0xb3a2ec=[_0x209dd0[_0x25dc('0x12')]];}return _0xb3a2ec;}exports[_0x25dc('0x13')]=function(_0x2531cf){_0x2531cf[_0x25dc('0x14')]={};return new BPromise(function(_0x164526,_0x14a680){var _0x41bf64={'Start':function(_0x453126){var _0x6fbdff=this;return new Promise(function(_0x55af7b,_0xaaa430){if(_0x453126){try{var _0x38a162=[];var _0x294b4e=getId(_0x453126[_0x25dc('0x15')],_0x453126[_0x25dc('0x16')]?_0x453126[_0x25dc('0x16')]['id']:0x0,_0x453126[_0x25dc('0x17')]?_0x453126[_0x25dc('0x17')]['id']:0x0);if(_0x453126['applications']&&_[_0x25dc('0x18')](_0x453126[_0x25dc('0x19')])&&_0x453126['applications']['length']){for(var _0x8344b7=0x0;_0x8344b7<_0x453126[_0x25dc('0x19')][_0x25dc('0x1a')];_0x8344b7+=0x1){var _0x9b94e6=_0x453126['applications'][_0x8344b7];if(fs[_0x25dc('0x1b')](path[_0x25dc('0x1c')](__dirname,_0x25dc('0x19'),_0x9b94e6[_0x25dc('0x1d')]+_0x25dc('0x1e')))){var _0x45a4ac=[];switch(_0x9b94e6[_0x25dc('0x1d')][_0x25dc('0x1f')]()){case _0x25dc('0x20'):var _0x8d9fcb=_0x9b94e6['appdata'][_0x25dc('0x21')](',');_0x45a4ac[_0x25dc('0x22')](_0x8d9fcb[0x0]);_0x45a4ac['push'](_0x8d9fcb[_0x25dc('0x23')](0x1,_0x8d9fcb[_0x25dc('0x1a')])[_0x25dc('0x1c')](','));break;case _0x25dc('0x24'):var _0x3a8417=_0x9b94e6['appdata'][_0x25dc('0x21')](',');_0x45a4ac[_0x25dc('0x22')](_0x3a8417[0x0]);_0x45a4ac[_0x25dc('0x22')](_0x3a8417[0x1]);_0x45a4ac[_0x25dc('0x22')](_0x3a8417[_0x25dc('0x23')](0x2,_0x3a8417['length'])[_0x25dc('0x1c')](','));break;case _0x25dc('0x25'):var _0x3138af=_0x9b94e6[_0x25dc('0x26')]['split'](',');_0x45a4ac[_0x25dc('0x22')](_0x3138af[0x0]);_0x45a4ac[_0x25dc('0x22')](_0x3138af[0x1]);_0x45a4ac[_0x25dc('0x22')](_0x3138af[0x2]);_0x45a4ac[_0x25dc('0x22')](_0x3138af[0x3]);_0x45a4ac['push'](_0x3138af[_0x25dc('0x23')](0x4,_0x3138af[_0x25dc('0x1a')])[_0x25dc('0x1c')](','));break;case _0x25dc('0x27'):var _0x5afdbf=_0x9b94e6[_0x25dc('0x26')]['split'](',');_0x45a4ac['push'](_0x5afdbf[0x0]);_0x45a4ac[_0x25dc('0x22')](_0x5afdbf[0x1]);_0x45a4ac['push'](_0x5afdbf[0x2]);_0x45a4ac['push'](_0x5afdbf[0x3]);_0x45a4ac[_0x25dc('0x22')](_0x5afdbf[_0x25dc('0x23')](0x4,_0x5afdbf[_0x25dc('0x1a')])['join'](','));break;case'message':_0x45a4ac[_0x25dc('0x22')](_0x9b94e6[_0x25dc('0x26')]);break;case _0x25dc('0x28'):_0x45a4ac[_0x25dc('0x22')](_0x9b94e6['TagId']);_0x45a4ac[_0x25dc('0x22')](_0x9b94e6['appdata']);break;default:_0x45a4ac=_[_0x25dc('0xe')](_0x9b94e6[_0x25dc('0x26')])?[]:_0x9b94e6[_0x25dc('0x26')]['split'](',');}var _0x2fcbc7={'id':util[_0x25dc('0xc')](_0x25dc('0x29'),_0x294b4e,_0x9b94e6['id'],_0x9b94e6[_0x25dc('0x1d')]),'condition':require('./interval')['condition'](_0x294b4e,getIntervals(_0x2531cf[_0x25dc('0x2a')],_0x9b94e6),_0x2531cf),'consequence':require(_0x25dc('0x2b')+_0x9b94e6[_0x25dc('0x1d')])[_0x25dc('0x2c')](_0x294b4e,_0x45a4ac,_0x2531cf,_0x453126),'p':_0x9b94e6[_0x25dc('0x2d')]||0x0};logger['info'](_0x25dc('0x2e'),_0x2fcbc7['id'],'on\x20interval',getIntervals(_0x2531cf['intervals'],_0x9b94e6)['join']('\x20|\x20'));_0x38a162['push'](_0x2fcbc7);}else{logger[_0x25dc('0x2f')](_0x25dc('0x30'),path[_0x25dc('0x1c')](__dirname,_0x25dc('0x19'),_0x9b94e6[_0x25dc('0x1d')]+_0x25dc('0x1e')));}}_0x2531cf[_0x25dc('0x14')][_0x294b4e]=new RuleEngine(_0x38a162);_0x2531cf[_0x25dc('0x14')][_0x294b4e][_0x25dc('0x31')](_0x453126,function(_0x5a2c40){logger['info'](_0x25dc('0x32'),JSON[_0x25dc('0x33')](_0x5a2c40[_0x25dc('0x34')]));if(_0x2531cf[_0x25dc('0x14')][_0x294b4e]){_0x2531cf[_0x25dc('0x14')][_0x294b4e][_0x25dc('0x35')]('complete');}});return _0x55af7b({'code':0xc8,'message':_0x453126});}else{logger[_0x25dc('0x36')]('No\x20applications\x20to\x20execute');return _0x55af7b({'code':0xc8,'message':_0x453126});}}catch(_0x87b77b){logger[_0x25dc('0x2f')](_0x87b77b[_0x25dc('0x37')]);return _0xaaa430(_0x6fbdff['error'](0x1f4,_0x87b77b));}}return _0xaaa430(_0x25dc('0x38'));});},'AcceptMessage':function(_0x30e9c6){var _0x24722f=this;return new Promise(function(_0x585d3f,_0x530978){if(_0x30e9c6[_0x25dc('0x16')]&&_0x30e9c6[_0x25dc('0x16')]['id']){try{var _0x16ade3=getId(_0x30e9c6[_0x25dc('0x15')],_0x30e9c6[_0x25dc('0x16')]?_0x30e9c6['message']['id']:0x0,_0x30e9c6['interaction']?_0x30e9c6[_0x25dc('0x17')]['id']:0x0);if(_0x2531cf[_0x25dc('0x14')][_0x16ade3]){_0x2531cf[_0x25dc('0x14')][_0x16ade3][_0x25dc('0x35')]('end');if(rpc[_0x30e9c6[_0x25dc('0x15')]+_0x25dc('0x39')]){rpc[_0x30e9c6[_0x25dc('0x15')]+_0x25dc('0x39')]['update'](_0x16ade3,{'UserId':_0x30e9c6[_0x25dc('0x16')][_0x25dc('0x3a')]})[_0x25dc('0x3b')](function(_0x65d126){logger[_0x25dc('0x2f')]('error\x20update\x20queue\x20report');});}}return _0x585d3f({'code':0xc8,'message':_0x30e9c6});}catch(_0x3960bf){logger[_0x25dc('0x2f')](_0x3960bf[_0x25dc('0x37')]);return _0x530978(_0x24722f[_0x25dc('0x2f')](0x1f4,_0x3960bf));}}logger[_0x25dc('0x2f')]('message\x20is\x20empty');return _0x530978(_0x24722f[_0x25dc('0x2f')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x14c7e4){var _0x1aa9b7=this;return new Promise(function(_0x5c701d,_0x5cc1ea){if(_0x14c7e4[_0x25dc('0x3c')]&&_0x14c7e4[_0x25dc('0x3c')]['id']){try{if(_0x2531cf[_0x25dc('0x3d')][_0x14c7e4[_0x25dc('0x3c')]['id']]){_0x2531cf['agents'][_0x14c7e4[_0x25dc('0x3c')]['id']][_0x25dc('0x3e')]=![];_0x2531cf[_0x25dc('0x3d')][_0x14c7e4[_0x25dc('0x3c')]['id']][_0x25dc('0x3f')]=undefined;}return _0x5c701d({'code':0xc8,'message':_0x14c7e4});}catch(_0x29d2f2){logger[_0x25dc('0x2f')](_0x29d2f2[_0x25dc('0x37')]);return _0x5cc1ea(_0x1aa9b7[_0x25dc('0x2f')](0x1f4,_0x29d2f2));}}logger[_0x25dc('0x2f')](_0x25dc('0x40'));return _0x5cc1ea(_0x1aa9b7[_0x25dc('0x2f')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x824698){var _0x4bb11e=this;return new Promise(function(_0x406775,_0x53012a){if(_0x824698[_0x25dc('0x15')]&&_0x824698[_0x25dc('0x17')]&&_0x824698[_0x25dc('0x17')]['id']){try{var _0x440fd0=getId(_0x824698[_0x25dc('0x15')],_0x824698[_0x25dc('0x16')]?_0x824698[_0x25dc('0x16')]['id']:0x0,_0x824698['interaction']?_0x824698['interaction']['id']:0x0);if(_0x2531cf[_0x25dc('0x14')][_0x440fd0]){_0x2531cf['rules'][_0x440fd0][_0x25dc('0x35')]('end');}return _0x406775({'code':0xc8,'message':_0x824698});}catch(_0x16ba1b){logger['error'](_0x16ba1b[_0x25dc('0x37')]);return _0x53012a(_0x4bb11e['error'](0x1f4,_0x16ba1b));}}logger[_0x25dc('0x2f')](_0x25dc('0x40'));return _0x53012a(_0x4bb11e['error'](0x1f4,_0x25dc('0x40')));});},'AgentCapacity':function(_0x542bbd){var _0x42836c=this;return new Promise(function(_0x55dd6d,_0x21c431){if(_0x2531cf['agents'][_0x25dc('0x41')](_0x542bbd['id'])){for(var _0x2bfb2a in _0x542bbd[_0x25dc('0x42')]){if(_0x542bbd[_0x25dc('0x42')][_0x25dc('0x41')](_0x2bfb2a)){if(_0x2531cf[_0x25dc('0x3d')][_0x542bbd['id']][_0x25dc('0x41')](_0x2bfb2a+'CurrentCapacity')){_0x2531cf[_0x25dc('0x3d')][_0x542bbd['id']][_0x2bfb2a+'CurrentCapacity']=parseInt(_0x542bbd['capacity'][_0x2bfb2a],0xa);}}}_0x2531cf['agents'][_0x542bbd['id']]['updateRealtime']();return _0x55dd6d({'code':0xc8,'message':_0x2531cf[_0x25dc('0x3d')][_0x542bbd['id']]});}else{return _0x21c431(_0x42836c[_0x25dc('0x2f')](0x1f4,_0x25dc('0x43')));}});},'Agents':function(_0xafdb4b){return new Promise(function(_0x5e38e6,_0x42b337){var _0x235b80=_['values'](_0x2531cf[_0x25dc('0x3d')]);_0x5e38e6({'count':_0x235b80[_0x25dc('0x1a')],'rows':_0x235b80});});},'ChatQueues':function(_0x502c1b){return new Promise(function(_0x3538c4,_0x4d9125){var _0x4a9cf2=[];for(var _0x49f67d in _0x2531cf[_0x25dc('0x44')]){if(_0x2531cf['chatQueues'][_0x25dc('0x41')](_0x49f67d)){var _0x37603a=_0x2531cf[_0x25dc('0x44')][_0x49f67d];var _0x1eba5e={'id':_0x37603a['id'],'available':_0x37603a['available'],'loggedIn':_0x37603a[_0x25dc('0x45')],'name':_0x37603a['name'],'paused':_0x37603a['paused'],'waiting':_0x37603a[_0x25dc('0x46')]};_0x4a9cf2['push'](_0x1eba5e);}}_0x3538c4({'count':_0x4a9cf2['length'],'rows':_0x4a9cf2});});},'MailQueues':function(_0x18bf2f){return new Promise(function(_0x28d281,_0x401a00){var _0x274bf5=[];for(var _0x557f48 in _0x2531cf[_0x25dc('0x47')]){if(_0x2531cf[_0x25dc('0x47')][_0x25dc('0x41')](_0x557f48)){var _0x141c92=_0x2531cf[_0x25dc('0x47')][_0x557f48];var _0x7f9b80={'id':_0x141c92['id'],'available':_0x141c92[_0x25dc('0x48')],'loggedIn':_0x141c92[_0x25dc('0x45')],'name':_0x141c92['name'],'paused':_0x141c92['paused'],'waiting':_0x141c92[_0x25dc('0x46')]};_0x274bf5[_0x25dc('0x22')](_0x7f9b80);}}_0x28d281({'count':_0x274bf5['length'],'rows':_0x274bf5});});},'OpenchannelQueues':function(_0x59647f){return new Promise(function(_0x3bb133,_0x46d7e9){var _0x3f5a7e=[];for(var _0x47566a in _0x2531cf[_0x25dc('0x49')]){if(_0x2531cf[_0x25dc('0x49')][_0x25dc('0x41')](_0x47566a)){var _0x1c8642=_0x2531cf[_0x25dc('0x49')][_0x47566a];var _0x2bb8be={'id':_0x1c8642['id'],'available':_0x1c8642['available'],'loggedIn':_0x1c8642['loggedIn'],'name':_0x1c8642[_0x25dc('0x4a')],'paused':_0x1c8642[_0x25dc('0x4b')],'waiting':_0x1c8642['waiting']};_0x3f5a7e[_0x25dc('0x22')](_0x2bb8be);}}_0x3bb133({'count':_0x3f5a7e[_0x25dc('0x1a')],'rows':_0x3f5a7e});});},'SmsQueues':function(_0x513cae){return new Promise(function(_0x3a9109,_0x3c994f){var _0x4edee3=[];for(var _0x26308e in _0x2531cf[_0x25dc('0x4c')]){if(_0x2531cf['smsQueues'][_0x25dc('0x41')](_0x26308e)){var _0x139b74=_0x2531cf[_0x25dc('0x4c')][_0x26308e];var _0xc0bac8={'id':_0x139b74['id'],'available':_0x139b74[_0x25dc('0x48')],'loggedIn':_0x139b74[_0x25dc('0x45')],'name':_0x139b74[_0x25dc('0x4a')],'paused':_0x139b74[_0x25dc('0x4b')],'waiting':_0x139b74['waiting']};_0x4edee3[_0x25dc('0x22')](_0xc0bac8);}}_0x3a9109({'count':_0x4edee3[_0x25dc('0x1a')],'rows':_0x4edee3});});},'FaxQueues':function(_0x642758){return new Promise(function(_0x15f4bc,_0x200bb1){var _0x132d6c=[];for(var _0x535508 in _0x2531cf[_0x25dc('0x4d')]){if(_0x2531cf[_0x25dc('0x4d')]['hasOwnProperty'](_0x535508)){var _0x32d15d=_0x2531cf[_0x25dc('0x4d')][_0x535508];var _0x158579={'id':_0x32d15d['id'],'available':_0x32d15d['available'],'loggedIn':_0x32d15d['loggedIn'],'name':_0x32d15d[_0x25dc('0x4a')],'paused':_0x32d15d[_0x25dc('0x4b')],'waiting':_0x32d15d[_0x25dc('0x46')]};_0x132d6c[_0x25dc('0x22')](_0x158579);}}_0x15f4bc({'count':_0x132d6c['length'],'rows':_0x132d6c});});},'WhatsappQueues':function(_0x3ec514){return new Promise(function(_0x522dc9,_0x3c8d88){var _0x278635=[];for(var _0x10f578 in _0x2531cf[_0x25dc('0x4e')]){if(_0x2531cf[_0x25dc('0x4e')]['hasOwnProperty'](_0x10f578)){var _0x10a377=_0x2531cf[_0x25dc('0x4e')][_0x10f578];var _0x1878e4={'id':_0x10a377['id'],'available':_0x10a377['available'],'loggedIn':_0x10a377[_0x25dc('0x45')],'name':_0x10a377['name'],'paused':_0x10a377['paused'],'waiting':_0x10a377[_0x25dc('0x46')]};_0x278635['push'](_0x1878e4);}}_0x522dc9({'count':_0x278635[_0x25dc('0x1a')],'rows':_0x278635});});},'ChatQueuesWaitingInteractions':function(_0x2b8d2c){return new Promise(function(_0x1837c1,_0x36df95){var _0x32cccd=_['values'](_0x2531cf[_0x25dc('0x4f')]);_0x1837c1({'count':_0x32cccd[_0x25dc('0x1a')],'rows':_0x32cccd});});},'MailQueuesWaitingInteractions':function(_0x3ea37e){return new Promise(function(_0x28a918,_0x2bda09){var _0x497ecc=_['values'](_0x2531cf[_0x25dc('0x50')]);_0x28a918({'count':_0x497ecc[_0x25dc('0x1a')],'rows':_0x497ecc});});},'OpenchannelQueuesWaitingInteractions':function(_0x2a5e6d){return new Promise(function(_0x26a13c,_0x5a190a){var _0x59b6ce=_[_0x25dc('0x51')](_0x2531cf[_0x25dc('0x52')]);_0x26a13c({'count':_0x59b6ce[_0x25dc('0x1a')],'rows':_0x59b6ce});});},'SmsQueuesWaitingInteractions':function(_0x4e29f1){return new Promise(function(_0x59be8f,_0x4e135c){var _0x1e29f5=_[_0x25dc('0x51')](_0x2531cf[_0x25dc('0x53')]);_0x59be8f({'count':_0x1e29f5[_0x25dc('0x1a')],'rows':_0x1e29f5});});},'FaxQueuesWaitingInteractions':function(_0x26dd5e){return new Promise(function(_0x10a3fa,_0x47e39c){var _0x4a6347=_[_0x25dc('0x51')](_0x2531cf[_0x25dc('0x54')]);_0x10a3fa({'count':_0x4a6347[_0x25dc('0x1a')],'rows':_0x4a6347});});},'WhatsappQueuesWaitingInteractions':function(_0x4784e0){return new Promise(function(_0x2e3c68,_0x678d66){var _0x90646f=_[_0x25dc('0x51')](_0x2531cf['whatsappQueuesWaitingInteractions']);_0x2e3c68({'count':_0x90646f['length'],'rows':_0x90646f});});}};var _0x5c8bfd=jayson[_0x25dc('0x55')](_0x41bf64)[_0x25dc('0x56')]();_0x5c8bfd['on'](_0x25dc('0x2f'),function(_0x1c370a){logger[_0x25dc('0x2f')](JSON[_0x25dc('0x33')](_0x1c370a));return _0x14a680(_0x1c370a);});_0x5c8bfd['listen'](0x232c,_0x25dc('0x57'),function(){console[_0x25dc('0x58')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x164526('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xfdb3=['values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','../../../config/environment','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','rules','message','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','channel','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found'];(function(_0x3ef937,_0x12dc99){var _0x18fead=function(_0x355055){while(--_0x355055){_0x3ef937['push'](_0x3ef937['shift']());}};_0x18fead(++_0x12dc99);}(_0xfdb3,0xd8));var _0x3fdb=function(_0x2ebe07,_0x55dcec){_0x2ebe07=_0x2ebe07-0x0;var _0x1bc170=_0xfdb3[_0x2ebe07];return _0x1bc170;};'use strict';var _=require(_0x3fdb('0x0'));var util=require(_0x3fdb('0x1'));var path=require(_0x3fdb('0x2'));var fs=require('fs');var jayson=require(_0x3fdb('0x3'));var BPromise=require(_0x3fdb('0x4'));var uuid=require('uuid');var config=require(_0x3fdb('0x5'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0x3fdb('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x3fdb('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x3fdb('0x8'));function getId(_0x5a0aae,_0x4bf41e,_0x24fa75){return util[_0x3fdb('0x9')]('%s.%s.%s',_0x5a0aae,_0x4bf41e||0x0,_0x24fa75||0x0);}function getIntervals(_0x24c989,_0x4fc997){var _0x569d16=[];if(!_[_0x3fdb('0xa')](_0x4fc997[_0x3fdb('0xb')])&&!_['isNil'](_0x24c989[_0x4fc997['IntervalId']])&&!_[_0x3fdb('0xa')](_0x24c989[_0x4fc997['IntervalId']][_0x3fdb('0xc')])){_0x569d16=_[_0x3fdb('0xd')](_0x24c989[_0x4fc997[_0x3fdb('0xb')]][_0x3fdb('0xc')],_0x3fdb('0xe'));}else if(!_[_0x3fdb('0xa')](_0x4fc997[_0x3fdb('0xe')])){_0x569d16=[_0x4fc997['interval']];}return _0x569d16;}exports['listen']=function(_0x5d7e11){_0x5d7e11[_0x3fdb('0xf')]={};return new BPromise(function(_0x7a94b,_0x3879e7){var _0x16b84b={'Start':function(_0x2e0c2f){var _0x4df52a=this;return new Promise(function(_0x1920a0,_0x45f957){if(_0x2e0c2f){try{var _0x560d69=[];var _0x100e0b=getId(_0x2e0c2f['channel'],_0x2e0c2f[_0x3fdb('0x10')]?_0x2e0c2f['message']['id']:0x0,_0x2e0c2f[_0x3fdb('0x11')]?_0x2e0c2f[_0x3fdb('0x11')]['id']:0x0);if(_0x2e0c2f['applications']&&_[_0x3fdb('0x12')](_0x2e0c2f[_0x3fdb('0x13')])&&_0x2e0c2f[_0x3fdb('0x13')][_0x3fdb('0x14')]){for(var _0x3266c8=0x0;_0x3266c8<_0x2e0c2f[_0x3fdb('0x13')][_0x3fdb('0x14')];_0x3266c8+=0x1){var _0x2542a0=_0x2e0c2f[_0x3fdb('0x13')][_0x3266c8];if(fs[_0x3fdb('0x15')](path[_0x3fdb('0x16')](__dirname,'applications',_0x2542a0[_0x3fdb('0x17')]+_0x3fdb('0x18')))){var _0x40ef69=[];switch(_0x2542a0[_0x3fdb('0x17')][_0x3fdb('0x19')]()){case _0x3fdb('0x1a'):var _0x192375=_0x2542a0[_0x3fdb('0x1b')][_0x3fdb('0x1c')](',');_0x40ef69['push'](_0x192375[0x0]);_0x40ef69[_0x3fdb('0x1d')](_0x192375[_0x3fdb('0x1e')](0x1,_0x192375['length'])['join'](','));break;case _0x3fdb('0x1f'):var _0x3ab825=_0x2542a0[_0x3fdb('0x1b')][_0x3fdb('0x1c')](',');_0x40ef69[_0x3fdb('0x1d')](_0x3ab825[0x0]);_0x40ef69[_0x3fdb('0x1d')](_0x3ab825[0x1]);_0x40ef69[_0x3fdb('0x1d')](_0x3ab825[_0x3fdb('0x1e')](0x2,_0x3ab825[_0x3fdb('0x14')])['join'](','));break;case _0x3fdb('0x20'):var _0x2375ab=_0x2542a0[_0x3fdb('0x1b')][_0x3fdb('0x1c')](',');_0x40ef69[_0x3fdb('0x1d')](_0x2375ab[0x0]);_0x40ef69[_0x3fdb('0x1d')](_0x2375ab[0x1]);_0x40ef69[_0x3fdb('0x1d')](_0x2375ab[0x2]);_0x40ef69[_0x3fdb('0x1d')](_0x2375ab[0x3]);_0x40ef69[_0x3fdb('0x1d')](_0x2375ab['slice'](0x4,_0x2375ab[_0x3fdb('0x14')])['join'](','));break;case _0x3fdb('0x21'):var _0x31f390=_0x2542a0[_0x3fdb('0x1b')][_0x3fdb('0x1c')](',');_0x40ef69[_0x3fdb('0x1d')](_0x31f390[0x0]);_0x40ef69[_0x3fdb('0x1d')](_0x31f390[0x1]);_0x40ef69['push'](_0x31f390[0x2]);_0x40ef69[_0x3fdb('0x1d')](_0x31f390[0x3]);_0x40ef69['push'](_0x31f390['slice'](0x4,_0x31f390['length'])[_0x3fdb('0x16')](','));break;case _0x3fdb('0x10'):_0x40ef69[_0x3fdb('0x1d')](_0x2542a0[_0x3fdb('0x1b')]);break;case _0x3fdb('0x22'):_0x40ef69[_0x3fdb('0x1d')](_0x2542a0[_0x3fdb('0x23')]);_0x40ef69[_0x3fdb('0x1d')](_0x2542a0[_0x3fdb('0x1b')]);break;default:_0x40ef69=_[_0x3fdb('0xa')](_0x2542a0[_0x3fdb('0x1b')])?[]:_0x2542a0['appdata'][_0x3fdb('0x1c')](',');}var _0x3410f5={'id':util[_0x3fdb('0x9')](_0x3fdb('0x24'),_0x100e0b,_0x2542a0['id'],_0x2542a0['app']),'condition':require(_0x3fdb('0x25'))[_0x3fdb('0x26')](_0x100e0b,getIntervals(_0x5d7e11[_0x3fdb('0x27')],_0x2542a0),_0x5d7e11),'consequence':require(_0x3fdb('0x28')+_0x2542a0[_0x3fdb('0x17')])['consequence'](_0x100e0b,_0x40ef69,_0x5d7e11,_0x2e0c2f),'p':_0x2542a0[_0x3fdb('0x29')]||0x0};logger[_0x3fdb('0x2a')](_0x3fdb('0x2b'),_0x3410f5['id'],_0x3fdb('0x2c'),getIntervals(_0x5d7e11[_0x3fdb('0x27')],_0x2542a0)[_0x3fdb('0x16')](_0x3fdb('0x2d')));_0x560d69[_0x3fdb('0x1d')](_0x3410f5);}else{logger[_0x3fdb('0x2e')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0x3fdb('0x13'),_0x2542a0[_0x3fdb('0x17')]+_0x3fdb('0x18')));}}_0x5d7e11[_0x3fdb('0xf')][_0x100e0b]=new RuleEngine(_0x560d69);_0x5d7e11['rules'][_0x100e0b][_0x3fdb('0x2f')](_0x2e0c2f,function(_0x4a5d87){logger[_0x3fdb('0x2a')]('Applications\x20executed',JSON[_0x3fdb('0x30')](_0x4a5d87[_0x3fdb('0x31')]));if(_0x5d7e11[_0x3fdb('0xf')][_0x100e0b]){_0x5d7e11[_0x3fdb('0xf')][_0x100e0b][_0x3fdb('0x32')](_0x3fdb('0x33'));}});return _0x1920a0({'code':0xc8,'message':_0x2e0c2f});}else{logger['info'](_0x3fdb('0x34'));return _0x1920a0({'code':0xc8,'message':_0x2e0c2f});}}catch(_0x4efec3){logger[_0x3fdb('0x2e')](_0x4efec3[_0x3fdb('0x35')]);return _0x45f957(_0x4df52a[_0x3fdb('0x2e')](0x1f4,_0x4efec3));}}return _0x45f957(_0x3fdb('0x36'));});},'AcceptMessage':function(_0x235e2c){var _0x184995=this;return new Promise(function(_0x5af558,_0x18869d){if(_0x235e2c[_0x3fdb('0x10')]&&_0x235e2c[_0x3fdb('0x10')]['id']){try{var _0x32c660=getId(_0x235e2c[_0x3fdb('0x37')],_0x235e2c[_0x3fdb('0x10')]?_0x235e2c['message']['id']:0x0,_0x235e2c[_0x3fdb('0x11')]?_0x235e2c[_0x3fdb('0x11')]['id']:0x0);if(_0x5d7e11[_0x3fdb('0xf')][_0x32c660]){_0x5d7e11[_0x3fdb('0xf')][_0x32c660]['emit'](_0x3fdb('0x38'));if(rpc[_0x235e2c['channel']+_0x3fdb('0x39')]){rpc[_0x235e2c['channel']+_0x3fdb('0x39')][_0x3fdb('0x3a')](_0x32c660,{'UserId':_0x235e2c[_0x3fdb('0x10')][_0x3fdb('0x3b')]})[_0x3fdb('0x3c')](function(_0x236e3a){logger[_0x3fdb('0x2e')](_0x3fdb('0x3d'));});}}return _0x5af558({'code':0xc8,'message':_0x235e2c});}catch(_0x24c50f){logger[_0x3fdb('0x2e')](_0x24c50f[_0x3fdb('0x35')]);return _0x18869d(_0x184995['error'](0x1f4,_0x24c50f));}}logger['error'](_0x3fdb('0x3e'));return _0x18869d(_0x184995['error'](0x1f4,_0x3fdb('0x3e')));});},'RejectMessage':function(_0x4059c2){var _0x19012e=this;return new Promise(function(_0x12db8c,_0x4e178a){if(_0x4059c2['agent']&&_0x4059c2[_0x3fdb('0x3f')]['id']){try{if(_0x5d7e11[_0x3fdb('0x40')][_0x4059c2[_0x3fdb('0x3f')]['id']]){_0x5d7e11['agents'][_0x4059c2[_0x3fdb('0x3f')]['id']][_0x3fdb('0x41')]=![];_0x5d7e11['agents'][_0x4059c2[_0x3fdb('0x3f')]['id']][_0x3fdb('0x42')]=undefined;}return _0x12db8c({'code':0xc8,'message':_0x4059c2});}catch(_0x367acd){logger['error'](_0x367acd[_0x3fdb('0x35')]);return _0x4e178a(_0x19012e[_0x3fdb('0x2e')](0x1f4,_0x367acd));}}logger[_0x3fdb('0x2e')](_0x3fdb('0x3e'));return _0x4e178a(_0x19012e['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x341295){var _0x4c6c82=this;return new Promise(function(_0x5467bb,_0x1ce3e3){if(_0x341295['channel']&&_0x341295['interaction']&&_0x341295['interaction']['id']){try{var _0x21e3d8=getId(_0x341295[_0x3fdb('0x37')],_0x341295[_0x3fdb('0x10')]?_0x341295[_0x3fdb('0x10')]['id']:0x0,_0x341295['interaction']?_0x341295[_0x3fdb('0x11')]['id']:0x0);if(_0x5d7e11[_0x3fdb('0xf')][_0x21e3d8]){_0x5d7e11[_0x3fdb('0xf')][_0x21e3d8]['emit']('end');}return _0x5467bb({'code':0xc8,'message':_0x341295});}catch(_0x342811){logger['error'](_0x342811[_0x3fdb('0x35')]);return _0x1ce3e3(_0x4c6c82[_0x3fdb('0x2e')](0x1f4,_0x342811));}}logger[_0x3fdb('0x2e')](_0x3fdb('0x3e'));return _0x1ce3e3(_0x4c6c82[_0x3fdb('0x2e')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x4e5e61){var _0x27fefe=this;return new Promise(function(_0x242480,_0x1557e8){if(_0x5d7e11[_0x3fdb('0x40')][_0x3fdb('0x43')](_0x4e5e61['id'])){for(var _0x42af43 in _0x4e5e61[_0x3fdb('0x44')]){if(_0x4e5e61['capacity'][_0x3fdb('0x43')](_0x42af43)){if(_0x5d7e11[_0x3fdb('0x40')][_0x4e5e61['id']][_0x3fdb('0x43')](_0x42af43+_0x3fdb('0x45'))){_0x5d7e11[_0x3fdb('0x40')][_0x4e5e61['id']][_0x42af43+_0x3fdb('0x45')]=parseInt(_0x4e5e61[_0x3fdb('0x44')][_0x42af43],0xa);}}}_0x5d7e11[_0x3fdb('0x40')][_0x4e5e61['id']][_0x3fdb('0x46')]();return _0x242480({'code':0xc8,'message':_0x5d7e11[_0x3fdb('0x40')][_0x4e5e61['id']]});}else{return _0x1557e8(_0x27fefe['error'](0x1f4,_0x3fdb('0x47')));}});},'Agents':function(_0xa388bb){return new Promise(function(_0x52a59f,_0x1c2a23){var _0x33aaa5=_[_0x3fdb('0x48')](_0x5d7e11[_0x3fdb('0x40')]);_0x52a59f({'count':_0x33aaa5[_0x3fdb('0x14')],'rows':_0x33aaa5});});},'ChatQueues':function(_0x107796){return new Promise(function(_0x16bd1d,_0x60f00b){var _0x3efea8=[];for(var _0xe7d4c9 in _0x5d7e11[_0x3fdb('0x49')]){if(_0x5d7e11['chatQueues'][_0x3fdb('0x43')](_0xe7d4c9)){var _0x508ec1=_0x5d7e11['chatQueues'][_0xe7d4c9];var _0x500f1e={'id':_0x508ec1['id'],'available':_0x508ec1[_0x3fdb('0x4a')],'loggedIn':_0x508ec1[_0x3fdb('0x4b')],'name':_0x508ec1[_0x3fdb('0x4c')],'paused':_0x508ec1[_0x3fdb('0x4d')],'waiting':_0x508ec1[_0x3fdb('0x4e')]};_0x3efea8[_0x3fdb('0x1d')](_0x500f1e);}}_0x16bd1d({'count':_0x3efea8[_0x3fdb('0x14')],'rows':_0x3efea8});});},'MailQueues':function(_0x8ac6e3){return new Promise(function(_0x5a5854,_0x3e591d){var _0x3f06d9=[];for(var _0x51486a in _0x5d7e11[_0x3fdb('0x4f')]){if(_0x5d7e11[_0x3fdb('0x4f')][_0x3fdb('0x43')](_0x51486a)){var _0x3a2614=_0x5d7e11[_0x3fdb('0x4f')][_0x51486a];var _0x1df601={'id':_0x3a2614['id'],'available':_0x3a2614[_0x3fdb('0x4a')],'loggedIn':_0x3a2614[_0x3fdb('0x4b')],'name':_0x3a2614[_0x3fdb('0x4c')],'paused':_0x3a2614[_0x3fdb('0x4d')],'waiting':_0x3a2614['waiting']};_0x3f06d9['push'](_0x1df601);}}_0x5a5854({'count':_0x3f06d9[_0x3fdb('0x14')],'rows':_0x3f06d9});});},'OpenchannelQueues':function(_0x5baad4){return new Promise(function(_0x141cb9,_0x31567a){var _0x4dc552=[];for(var _0x119326 in _0x5d7e11[_0x3fdb('0x50')]){if(_0x5d7e11['openchannelQueues'][_0x3fdb('0x43')](_0x119326)){var _0x40a1ce=_0x5d7e11[_0x3fdb('0x50')][_0x119326];var _0x4007ed={'id':_0x40a1ce['id'],'available':_0x40a1ce[_0x3fdb('0x4a')],'loggedIn':_0x40a1ce['loggedIn'],'name':_0x40a1ce[_0x3fdb('0x4c')],'paused':_0x40a1ce[_0x3fdb('0x4d')],'waiting':_0x40a1ce['waiting']};_0x4dc552[_0x3fdb('0x1d')](_0x4007ed);}}_0x141cb9({'count':_0x4dc552[_0x3fdb('0x14')],'rows':_0x4dc552});});},'SmsQueues':function(_0x82308f){return new Promise(function(_0x31672a,_0x16fb30){var _0x2f2681=[];for(var _0x5239dd in _0x5d7e11[_0x3fdb('0x51')]){if(_0x5d7e11[_0x3fdb('0x51')][_0x3fdb('0x43')](_0x5239dd)){var _0x1ccae4=_0x5d7e11['smsQueues'][_0x5239dd];var _0x42bd6b={'id':_0x1ccae4['id'],'available':_0x1ccae4['available'],'loggedIn':_0x1ccae4[_0x3fdb('0x4b')],'name':_0x1ccae4['name'],'paused':_0x1ccae4[_0x3fdb('0x4d')],'waiting':_0x1ccae4[_0x3fdb('0x4e')]};_0x2f2681[_0x3fdb('0x1d')](_0x42bd6b);}}_0x31672a({'count':_0x2f2681[_0x3fdb('0x14')],'rows':_0x2f2681});});},'FaxQueues':function(_0x4b468e){return new Promise(function(_0x56af3c,_0x34c13d){var _0x5eaa18=[];for(var _0x2a51e3 in _0x5d7e11[_0x3fdb('0x52')]){if(_0x5d7e11['faxQueues'][_0x3fdb('0x43')](_0x2a51e3)){var _0x16a9de=_0x5d7e11[_0x3fdb('0x52')][_0x2a51e3];var _0x504a87={'id':_0x16a9de['id'],'available':_0x16a9de[_0x3fdb('0x4a')],'loggedIn':_0x16a9de['loggedIn'],'name':_0x16a9de[_0x3fdb('0x4c')],'paused':_0x16a9de['paused'],'waiting':_0x16a9de[_0x3fdb('0x4e')]};_0x5eaa18['push'](_0x504a87);}}_0x56af3c({'count':_0x5eaa18['length'],'rows':_0x5eaa18});});},'WhatsappQueues':function(_0x4d5821){return new Promise(function(_0x4c9dbb,_0x1b12b2){var _0x5cf454=[];for(var _0x25fe0d in _0x5d7e11[_0x3fdb('0x53')]){if(_0x5d7e11[_0x3fdb('0x53')][_0x3fdb('0x43')](_0x25fe0d)){var _0x14c4d1=_0x5d7e11[_0x3fdb('0x53')][_0x25fe0d];var _0x232bd7={'id':_0x14c4d1['id'],'available':_0x14c4d1[_0x3fdb('0x4a')],'loggedIn':_0x14c4d1['loggedIn'],'name':_0x14c4d1[_0x3fdb('0x4c')],'paused':_0x14c4d1[_0x3fdb('0x4d')],'waiting':_0x14c4d1[_0x3fdb('0x4e')]};_0x5cf454[_0x3fdb('0x1d')](_0x232bd7);}}_0x4c9dbb({'count':_0x5cf454['length'],'rows':_0x5cf454});});},'ChatQueuesWaitingInteractions':function(_0x14b702){return new Promise(function(_0x26de6b,_0x1db151){var _0x479728=_[_0x3fdb('0x48')](_0x5d7e11[_0x3fdb('0x54')]);_0x26de6b({'count':_0x479728['length'],'rows':_0x479728});});},'MailQueuesWaitingInteractions':function(_0x1c2658){return new Promise(function(_0x4ab5f3,_0x376e77){var _0x4f81c7=_['values'](_0x5d7e11[_0x3fdb('0x55')]);_0x4ab5f3({'count':_0x4f81c7[_0x3fdb('0x14')],'rows':_0x4f81c7});});},'OpenchannelQueuesWaitingInteractions':function(_0x2dce8c){return new Promise(function(_0x208994,_0x5dc287){var _0x1368b1=_[_0x3fdb('0x48')](_0x5d7e11[_0x3fdb('0x56')]);_0x208994({'count':_0x1368b1[_0x3fdb('0x14')],'rows':_0x1368b1});});},'SmsQueuesWaitingInteractions':function(_0x4a1ce1){return new Promise(function(_0x5922a5,_0x14b532){var _0xd6333a=_[_0x3fdb('0x48')](_0x5d7e11['smsQueuesWaitingInteractions']);_0x5922a5({'count':_0xd6333a[_0x3fdb('0x14')],'rows':_0xd6333a});});},'FaxQueuesWaitingInteractions':function(_0x4fd555){return new Promise(function(_0x1630cc,_0xd42b02){var _0x456982=_[_0x3fdb('0x48')](_0x5d7e11[_0x3fdb('0x57')]);_0x1630cc({'count':_0x456982['length'],'rows':_0x456982});});},'WhatsappQueuesWaitingInteractions':function(_0x509ee8){return new Promise(function(_0xbb3371,_0xa50d1d){var _0x181965=_[_0x3fdb('0x48')](_0x5d7e11[_0x3fdb('0x58')]);_0xbb3371({'count':_0x181965[_0x3fdb('0x14')],'rows':_0x181965});});}};var _0x106f90=jayson[_0x3fdb('0x59')](_0x16b84b)[_0x3fdb('0x5a')]();_0x106f90['on']('error',function(_0xef8ebc){logger[_0x3fdb('0x2e')](JSON[_0x3fdb('0x30')](_0xef8ebc));return _0x3879e7(_0xef8ebc);});_0x106f90[_0x3fdb('0x5b')](0x232c,_0x3fdb('0x5c'),function(){console[_0x3fdb('0x5d')](_0x3fdb('0x5e'),0x232c);return _0x7a94b(_0x3fdb('0x5f')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index c3c1152..63d24c6 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 _0xee64=['true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s'];(function(_0xb51f38,_0x37361b){var _0x333754=function(_0x442f07){while(--_0x442f07){_0xb51f38['push'](_0xb51f38['shift']());}};_0x333754(++_0x37361b);}(_0xee64,0x19c));var _0x4ee6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xee64[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0x4ee6('0x0'));var BPromise=require(_0x4ee6('0x1'));var jayson=require(_0x4ee6('0x2'));var _=require(_0x4ee6('0x3'));var logger=require(_0x4ee6('0x4'))(_0x4ee6('0x5'));var client=jayson[_0x4ee6('0x6')][_0x4ee6('0x7')]({'port':0x232a});function request(_0x5477a3,_0x4bf865){return new BPromise(function(_0x3d7886,_0x25c824){return client[_0x4ee6('0x8')](_0x5477a3,_0x4bf865)[_0x4ee6('0x9')](function(_0x5e8f91){if(_0x5e8f91['error']){return _0x25c824(_0x5e8f91[_0x4ee6('0xa')][_0x4ee6('0xb')]);}else{return _0x3d7886(_0x5e8f91['result']);}})[_0x4ee6('0xc')](function(_0x2eb012){return _0x25c824(_0x2eb012);});});}exports[_0x4ee6('0xd')]=function(_0x4e3249,_0x294adb,_0x12ce14){return function(_0x5ba8ee){if(_0x12ce14[_0x4ee6('0xe')]&&!_0x12ce14[_0x4ee6('0xe')][_0x4e3249]){logger[_0x4ee6('0xf')](_0x4ee6('0x10'),_0x4e3249);return _0x5ba8ee[_0x4ee6('0x11')]();}var _0x5214ba=[];for(var _0x4993aa=0x0;_0x4993aa<_0x294adb['length'];_0x4993aa+=0x1){_0x5214ba[_0x4ee6('0x12')](request(_0x4ee6('0x13'),{'command':util[_0x4ee6('0x14')](_0x4ee6('0x15'),_0x294adb[_0x4993aa])})[_0x4ee6('0x9')](function(_0x8fa939){return _0x8fa939&&_0x8fa939[_0x4ee6('0xb')]&&_0x8fa939[_0x4ee6('0xb')]['indexOf'](_0x4ee6('0x16'))>=0x0?!![]:![];})[_0x4ee6('0xc')](function(_0x3cbf8c){logger[_0x4ee6('0xa')](_0x4ee6('0x17'),_0x4e3249,_0x294adb[_0x4993aa]);}));}BPromise[_0x4ee6('0x18')](_0x5214ba)['then'](function(_0x4649eb){var _0x64d2ee=_[_0x4ee6('0x19')](_0x4649eb);logger['info'](_0x4ee6('0x1a'),_0x4e3249,_0x294adb[_0x4ee6('0x1b')](_0x4ee6('0x1c')),_0x64d2ee);_0x5ba8ee[_0x4ee6('0x1d')](_0x64d2ee);})['catch'](function(_0x1abbf0){console[_0x4ee6('0x1e')](_0x1abbf0);logger[_0x4ee6('0xa')](_0x4ee6('0x1a'),_0x4e3249,_0x294adb[_0x4ee6('0x1b')](_0x4ee6('0x1c')),_0x1abbf0['stack']);_0x5ba8ee[_0x4ee6('0x11')]();});};}; \ No newline at end of file +var _0x3f02=['join','\x20|\x20','when','log','stack','util','bluebird','lodash','../../../config/logger','routing','client','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','indexOf','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x4301d5,_0x63b417){var _0xf9e507=function(_0x5c6e73){while(--_0x5c6e73){_0x4301d5['push'](_0x4301d5['shift']());}};_0xf9e507(++_0x63b417);}(_0x3f02,0x1b5));var _0x23f0=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0x3f02[_0x12d812];return _0x3711ab;};'use strict';var util=require(_0x23f0('0x0'));var BPromise=require(_0x23f0('0x1'));var jayson=require('jayson/promise');var _=require(_0x23f0('0x2'));var logger=require(_0x23f0('0x3'))(_0x23f0('0x4'));var client=jayson[_0x23f0('0x5')]['http']({'port':0x232a});function request(_0x324c5e,_0x191565){return new BPromise(function(_0xa5bf7c,_0x18bb31){return client[_0x23f0('0x6')](_0x324c5e,_0x191565)[_0x23f0('0x7')](function(_0x5c1ed9){if(_0x5c1ed9[_0x23f0('0x8')]){return _0x18bb31(_0x5c1ed9[_0x23f0('0x8')][_0x23f0('0x9')]);}else{return _0xa5bf7c(_0x5c1ed9[_0x23f0('0xa')]);}})[_0x23f0('0xb')](function(_0x3b090b){return _0x18bb31(_0x3b090b);});});}exports[_0x23f0('0xc')]=function(_0x592c3d,_0x15c638,_0xeba6cf){return function(_0x53fa9b){if(_0xeba6cf[_0x23f0('0xd')]&&!_0xeba6cf[_0x23f0('0xd')][_0x592c3d]){logger[_0x23f0('0xe')](_0x23f0('0xf'),_0x592c3d);return _0x53fa9b[_0x23f0('0x10')]();}var _0x2330c9=[];for(var _0x30c951=0x0;_0x30c951<_0x15c638['length'];_0x30c951+=0x1){_0x2330c9[_0x23f0('0x11')](request(_0x23f0('0x12'),{'command':util[_0x23f0('0x13')]('iftime\x20%s',_0x15c638[_0x30c951])})[_0x23f0('0x7')](function(_0x585014){return _0x585014&&_0x585014[_0x23f0('0x9')]&&_0x585014[_0x23f0('0x9')][_0x23f0('0x14')]('true')>=0x0?!![]:![];})[_0x23f0('0xb')](function(_0x242615){logger[_0x23f0('0x8')]('[%s][INTERVAL]\x20%s',_0x592c3d,_0x15c638[_0x30c951]);}));}BPromise['all'](_0x2330c9)[_0x23f0('0x7')](function(_0x55f2d5){var _0x361dc3=_['some'](_0x55f2d5);logger[_0x23f0('0xe')](_0x23f0('0x15'),_0x592c3d,_0x15c638[_0x23f0('0x16')](_0x23f0('0x17')),_0x361dc3);_0x53fa9b[_0x23f0('0x18')](_0x361dc3);})['catch'](function(_0x2acebc){console[_0x23f0('0x19')](_0x2acebc);logger[_0x23f0('0x8')](_0x23f0('0x15'),_0x592c3d,_0x15c638['join']('\x20|\x20'),_0x2acebc[_0x23f0('0x1a')]);_0x53fa9b[_0x23f0('0x10')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index a34d3f8..bfcbd02 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 _0xc2e2=['acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','uniqueid','agentcalledAt','lastevent','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','[%s][agents][agentringnoanswer]','now','timeout','holdtime','ringtime','talktime','push','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','reason','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','isNil','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','diffTime','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete'];(function(_0x14ea32,_0x262909){var _0x137bbb=function(_0x4a36ab){while(--_0x4a36ab){_0x14ea32['push'](_0x14ea32['shift']());}};_0x137bbb(++_0x262909);}(_0xc2e2,0x140));var _0x2c2e=function(_0x594d1e,_0x12fa4e){_0x594d1e=_0x594d1e-0x0;var _0x5363e4=_0xc2e2[_0x594d1e];return _0x5363e4;};'use strict';var _=require(_0x2c2e('0x0'));var util=require(_0x2c2e('0x1'));var utils=require(_0x2c2e('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4e57ac,_0x12f116){utils[_0x2c2e('0x3')](util[_0x2c2e('0x4')](_0x2c2e('0x5'),_0x4e57ac['uniqueid'],_0x4e57ac['channel'],_0x4e57ac[_0x2c2e('0x6')],_0x4e57ac[_0x2c2e('0x7')],_0x4e57ac[_0x2c2e('0x8')],_0x4e57ac[_0x2c2e('0x9')],_0x4e57ac[_0x2c2e('0xa')],_0x4e57ac['lastevent']));if(_0x4e57ac[_0x2c2e('0x6')]){utils[_0x2c2e('0xb')](_0x4e57ac['queue'])[_0x2c2e('0xc')](function(_0x34381f){if(_0x34381f){_0x4e57ac[_0x2c2e('0xd')]=_0x34381f['type'];_0x4e57ac[_0x2c2e('0xe')]=_0x4e57ac[_0x2c2e('0xf')]?_0x34381f[_0x2c2e('0x10')]:![];_0x4e57ac[_0x2c2e('0x11')]=_0x4e57ac['agentacw']?_0x34381f[_0x2c2e('0x12')]:0x0;}utils[_0x2c2e('0x13')](_0x2c2e('0x14'),_0x4e57ac);});}else{utils['request'](_0x2c2e('0x14'),_0x4e57ac);}if(_0x12f116){delete transfers[_0x4e57ac['uniqueid']];}else{delete agents[_0x4e57ac[_0x2c2e('0x15')]];}}exports['agentcalled']=function(_0x592354){try{utils[_0x2c2e('0x16')](util['format']('[%s][agents][agentcalled]',_0x592354[_0x2c2e('0x17')]),_0x592354);agents[_0x592354[_0x2c2e('0x15')]]=_0x592354;agents[_0x592354[_0x2c2e('0x15')]][_0x2c2e('0x18')]=utils['now']();agents[_0x592354[_0x2c2e('0x15')]][_0x2c2e('0x19')]='called';agents[_0x592354['destuniqueid']][_0x2c2e('0xa')]=null;agents[_0x592354[_0x2c2e('0x15')]][_0x2c2e('0x1a')]=null;utils[_0x2c2e('0x3')](util['format'](_0x2c2e('0x1b'),_0x592354[_0x2c2e('0x17')],agents[_0x592354['destuniqueid']][_0x2c2e('0x7')],_0x592354[_0x2c2e('0x15')]));}catch(_0x9189da){utils[_0x2c2e('0x1c')](util['format'](_0x2c2e('0x1d'),_0x592354[_0x2c2e('0x17')]),_0x9189da);}};exports[_0x2c2e('0x1e')]=function(_0x197e3a){try{if(!_['isNil'](agents[_0x197e3a['destuniqueid']])){utils['debug'](util['format'](_0x2c2e('0x1f'),_0x197e3a[_0x2c2e('0x17')]),_0x197e3a);utils[_0x2c2e('0x3')](util[_0x2c2e('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x197e3a[_0x2c2e('0x17')],agents[_0x197e3a[_0x2c2e('0x15')]][_0x2c2e('0x7')],_0x197e3a[_0x2c2e('0x15')]));agents[_0x197e3a[_0x2c2e('0x15')]][_0x2c2e('0x1e')]=!![];agents[_0x197e3a[_0x2c2e('0x15')]]['agentringnoanswerAt']=utils[_0x2c2e('0x20')]();agents[_0x197e3a[_0x2c2e('0x15')]][_0x2c2e('0x19')]='timeout';agents[_0x197e3a[_0x2c2e('0x15')]]['reason']=_0x2c2e('0x21');agents[_0x197e3a['destuniqueid']][_0x2c2e('0x22')]=_0x197e3a[_0x2c2e('0x23')]?parseInt(_0x197e3a[_0x2c2e('0x23')])/0x3e8:0x0;agents[_0x197e3a[_0x2c2e('0x15')]][_0x2c2e('0x24')]=0x0;unanswered[_0x2c2e('0x25')](_0x197e3a['destuniqueid']);}}catch(_0x23b008){utils['error'](util[_0x2c2e('0x4')](_0x2c2e('0x1f'),_0x197e3a[_0x2c2e('0x17')]),_0x23b008);}};exports['queuecallerabandon']=function(_0x555c7f){try{_[_0x2c2e('0x26')](agents,function(_0x50b82e,_0x3fea28){if(_0x50b82e[_0x2c2e('0x17')]==_0x555c7f[_0x2c2e('0x17')]&&!_['includes'](unanswered,_0x50b82e[_0x2c2e('0x15')])){utils['debug'](util[_0x2c2e('0x4')](_0x2c2e('0x27'),_0x555c7f['uniqueid']),_0x555c7f);utils[_0x2c2e('0x3')](util['format'](_0x2c2e('0x28'),_0x555c7f[_0x2c2e('0x17')],_0x50b82e[_0x2c2e('0x7')],_0x50b82e['destuniqueid']));_0x50b82e['agentringnoanswer']=!![];_0x50b82e[_0x2c2e('0x29')]=utils[_0x2c2e('0x20')]();_0x50b82e['lastevent']=_0x2c2e('0x2a');_0x50b82e[_0x2c2e('0x2b')]='abandoned';_0x50b82e[_0x2c2e('0x22')]=_0x555c7f[_0x2c2e('0x22')];_0x50b82e[_0x2c2e('0x24')]=0x0;writeDB(_0x50b82e);}});}catch(_0x4cc1ab){utils[_0x2c2e('0x1c')](util['format']('[%s][agents][queuecallerabandon]',_0x555c7f[_0x2c2e('0x17')]),_0x4cc1ab);}};exports['agentconnect']=function(_0x587f45){try{if(agents[_0x587f45[_0x2c2e('0x15')]]){utils[_0x2c2e('0x16')](util[_0x2c2e('0x4')]('[%s][agents][agentconnect]',_0x587f45['uniqueid']),_0x587f45);utils[_0x2c2e('0x3')](util[_0x2c2e('0x4')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x587f45[_0x2c2e('0x17')],agents[_0x587f45['destuniqueid']][_0x2c2e('0x7')],_0x587f45['destuniqueid']));agents[_0x587f45[_0x2c2e('0x15')]][_0x2c2e('0x2c')]=utils[_0x2c2e('0x20')]();agents[_0x587f45['destuniqueid']][_0x2c2e('0xa')]=_0x587f45[_0x2c2e('0xa')];agents[_0x587f45['destuniqueid']][_0x2c2e('0x1a')]=_0x587f45[_0x2c2e('0x1a')];agents[_0x587f45[_0x2c2e('0x15')]][_0x2c2e('0x22')]=_0x587f45[_0x2c2e('0x23')];agents[_0x587f45[_0x2c2e('0x15')]][_0x2c2e('0x19')]=_0x2c2e('0x2d');_[_0x2c2e('0x26')](agents,function(_0x5bab69,_0x3949ac){if(_0x5bab69[_0x2c2e('0x15')]!=_0x587f45[_0x2c2e('0x15')]&&_0x5bab69[_0x2c2e('0x17')]==_0x587f45[_0x2c2e('0x17')]){_0x5bab69[_0x2c2e('0x24')]=0x0;_0x5bab69['holdtime']=_0x587f45['ringtime'];_0x5bab69[_0x2c2e('0x1e')]=!![];_0x5bab69[_0x2c2e('0x29')]=utils['now']();_0x5bab69[_0x2c2e('0x19')]=_0x2c2e('0x2e');_0x5bab69[_0x2c2e('0x2b')]=_0x2c2e('0x2e');_0x5bab69[_0x2c2e('0x2f')]=_0x587f45[_0x2c2e('0x15')];_0x5bab69[_0x2c2e('0x30')]=_0x587f45[_0x2c2e('0x7')];writeDB(_0x5bab69);}});}}catch(_0x25c21e){utils[_0x2c2e('0x1c')](util[_0x2c2e('0x4')](_0x2c2e('0x31'),_0x587f45[_0x2c2e('0x17')]),_0x25c21e);}};exports['agentcomplete']=function(_0x5d46ed){try{if(!_['isNil'](agents[_0x5d46ed[_0x2c2e('0x15')]])){utils[_0x2c2e('0x16')](util[_0x2c2e('0x4')](_0x2c2e('0x32'),_0x5d46ed[_0x2c2e('0x17')]),_0x5d46ed);utils[_0x2c2e('0x3')](util['format'](_0x2c2e('0x33'),_0x5d46ed[_0x2c2e('0x17')],agents[_0x5d46ed[_0x2c2e('0x15')]][_0x2c2e('0x7')],_0x5d46ed['destuniqueid']));agents[_0x5d46ed['destuniqueid']]['agentcomplete']=!![];agents[_0x5d46ed[_0x2c2e('0x15')]][_0x2c2e('0x34')]=utils[_0x2c2e('0x20')]();agents[_0x5d46ed[_0x2c2e('0x15')]][_0x2c2e('0x24')]=utils['diffTime'](agents[_0x5d46ed[_0x2c2e('0x15')]][_0x2c2e('0x34')],agents[_0x5d46ed[_0x2c2e('0x15')]][_0x2c2e('0x2c')]);agents[_0x5d46ed[_0x2c2e('0x15')]][_0x2c2e('0x2b')]=_0x5d46ed[_0x2c2e('0x2b')];agents[_0x5d46ed[_0x2c2e('0x15')]][_0x2c2e('0x19')]=_0x2c2e('0x35');writeDB(agents[_0x5d46ed['destuniqueid']]);}}catch(_0x5c8678){utils[_0x2c2e('0x1c')](util[_0x2c2e('0x4')](_0x2c2e('0x32'),_0x5d46ed[_0x2c2e('0x17')]),_0x5c8678);}};exports[_0x2c2e('0x36')]=function(_0xcc1c1a){try{if(!_[_0x2c2e('0x37')](agents[_0xcc1c1a[_0x2c2e('0x38')]])){utils['debug'](util[_0x2c2e('0x4')](_0x2c2e('0x39'),_0xcc1c1a[_0x2c2e('0x17')]),_0xcc1c1a);utils[_0x2c2e('0x3')](util[_0x2c2e('0x4')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0xcc1c1a[_0x2c2e('0x17')],agents[_0xcc1c1a[_0x2c2e('0x38')]][_0x2c2e('0x7')],agents[_0xcc1c1a[_0x2c2e('0x38')]][_0x2c2e('0x17')]));agents[_0xcc1c1a['transfereruniqueid']][_0x2c2e('0x3a')]=!![];agents[_0xcc1c1a[_0x2c2e('0x38')]][_0x2c2e('0x3b')]='blind';agents[_0xcc1c1a[_0x2c2e('0x38')]]['transferexten']=_0xcc1c1a[_0x2c2e('0x3c')];agents[_0xcc1c1a[_0x2c2e('0x38')]][_0x2c2e('0x3d')]=agents[_0xcc1c1a[_0x2c2e('0x38')]][_0x2c2e('0x17')];}}catch(_0x3efe01){utils['error'](util[_0x2c2e('0x4')](_0x2c2e('0x39'),_0xcc1c1a[_0x2c2e('0x17')]),_0x3efe01);}};exports['attendedtransfer']=function(_0x4b7482){try{utils[_0x2c2e('0x16')](util[_0x2c2e('0x4')](_0x2c2e('0x3e'),_0x4b7482[_0x2c2e('0x3f')]),_0x4b7482);if(_0x4b7482[_0x2c2e('0x3f')]==_0x4b7482[_0x2c2e('0x40')]){if(!_[_0x2c2e('0x37')](agents[_0x4b7482[_0x2c2e('0x41')]])){utils[_0x2c2e('0x3')](util['format'](_0x2c2e('0x42'),_0x4b7482['origtransfereruniqueid'],agents[_0x4b7482[_0x2c2e('0x41')]][_0x2c2e('0x7')]));agents[_0x4b7482[_0x2c2e('0x41')]][_0x2c2e('0x3a')]=!![];agents[_0x4b7482[_0x2c2e('0x41')]][_0x2c2e('0x3b')]=_0x2c2e('0x43');agents[_0x4b7482['secondtransfereruniqueid']][_0x2c2e('0x44')]=_0x4b7482[_0x2c2e('0x45')];agents[_0x4b7482['secondtransfereruniqueid']][_0x2c2e('0x3d')]=_0x4b7482['origtransfereruniqueid'];}if(_0x4b7482[_0x2c2e('0x46')]&&agents[_0x4b7482[_0x2c2e('0x46')]]){agents[_0x4b7482[_0x2c2e('0x46')]][_0x2c2e('0x47')]=0x1;transfers[_0x4b7482[_0x2c2e('0x46')]]=_[_0x2c2e('0x48')](agents[_0x4b7482[_0x2c2e('0x46')]]);transfers[_0x4b7482[_0x2c2e('0x46')]]['calleridnum']=agents[_0x4b7482[_0x2c2e('0x41')]][_0x2c2e('0x9')];transfers[_0x4b7482[_0x2c2e('0x46')]][_0x2c2e('0x49')]=agents[_0x4b7482[_0x2c2e('0x41')]]['calleridname'];transfers[_0x4b7482[_0x2c2e('0x46')]][_0x2c2e('0x18')]=utils[_0x2c2e('0x20')]();transfers[_0x4b7482['transfereeuniqueid']]['agentconnectAt']=utils[_0x2c2e('0x20')]();transfers[_0x4b7482[_0x2c2e('0x46')]][_0x2c2e('0x22')]=0x0;transfers[_0x4b7482[_0x2c2e('0x46')]][_0x2c2e('0x47')]=0x2;}}else if(_0x4b7482[_0x2c2e('0x41')]==_0x4b7482[_0x2c2e('0x4a')]){if(!_[_0x2c2e('0x37')](agents[_0x4b7482[_0x2c2e('0x3f')]])){utils[_0x2c2e('0x3')](util[_0x2c2e('0x4')](_0x2c2e('0x42'),_0x4b7482['origtransfereruniqueid'],agents[_0x4b7482[_0x2c2e('0x3f')]]['membername']));agents[_0x4b7482[_0x2c2e('0x3f')]]['transfer']=!![];agents[_0x4b7482[_0x2c2e('0x3f')]]['transfertype']='ATTENDED';agents[_0x4b7482[_0x2c2e('0x3f')]][_0x2c2e('0x44')]=_0x4b7482[_0x2c2e('0x4b')];agents[_0x4b7482[_0x2c2e('0x3f')]][_0x2c2e('0x3d')]=_0x4b7482[_0x2c2e('0x41')];}if(_0x4b7482[_0x2c2e('0x4c')]&&agents[_0x4b7482['transfertargetuniqueid']]){agents[_0x4b7482['transfertargetuniqueid']][_0x2c2e('0x47')]=0x1;transfers[_0x4b7482[_0x2c2e('0x4c')]]=_[_0x2c2e('0x48')](agents[_0x4b7482[_0x2c2e('0x4c')]]);transfers[_0x4b7482['transfertargetuniqueid']][_0x2c2e('0x9')]=agents[_0x4b7482['origtransfereruniqueid']][_0x2c2e('0x9')];transfers[_0x4b7482['transfertargetuniqueid']][_0x2c2e('0x49')]=agents[_0x4b7482[_0x2c2e('0x3f')]][_0x2c2e('0x49')];transfers[_0x4b7482[_0x2c2e('0x4c')]][_0x2c2e('0x18')]=utils[_0x2c2e('0x20')]();transfers[_0x4b7482[_0x2c2e('0x4c')]]['agentconnectAt']=utils[_0x2c2e('0x20')]();transfers[_0x4b7482['transfertargetuniqueid']][_0x2c2e('0x22')]=0x0;transfers[_0x4b7482[_0x2c2e('0x4c')]][_0x2c2e('0x47')]=0x2;}}}catch(_0x48dfeb){utils[_0x2c2e('0x1c')](util[_0x2c2e('0x4')](_0x2c2e('0x3e'),_0x4b7482[_0x2c2e('0x3f')]),_0x48dfeb);}};exports[_0x2c2e('0x4d')]=function(_0x3b22ce){try{utils[_0x2c2e('0x16')](util[_0x2c2e('0x4')](_0x2c2e('0x4e'),_0x3b22ce[_0x2c2e('0x17')]),_0x3b22ce);if(agents[_0x3b22ce[_0x2c2e('0x17')]]&&agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x2b')]==='timeout'){if(_0x3b22ce['cause']==='21'){agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x2b')]=_0x2c2e('0x4f');agents[_0x3b22ce['uniqueid']][_0x2c2e('0x19')]='rejected';}utils[_0x2c2e('0x3')](util['format'](_0x2c2e('0x50'),_0x3b22ce[_0x2c2e('0x17')],agents[_0x3b22ce[_0x2c2e('0x17')]]['membername'],agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x2b')],agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x19')]));writeDB(agents[_0x3b22ce[_0x2c2e('0x17')]]);var _0x12d876=unanswered[_0x2c2e('0x51')](_0x3b22ce['uniqueid']);if(_0x12d876>-0x1){unanswered['splice'](_0x12d876,0x1);}}if(transfers[_0x3b22ce['uniqueid']]){transfers[_0x3b22ce[_0x2c2e('0x17')]]['agentcomplete']=!![];transfers[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x34')]=utils[_0x2c2e('0x20')]();transfers[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x24')]=utils['diffTime'](transfers[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x34')],transfers[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x2c')]);transfers[_0x3b22ce['uniqueid']][_0x2c2e('0x2b')]=_0x2c2e('0x52');transfers[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x19')]='complete';utils['info'](util[_0x2c2e('0x4')](_0x2c2e('0x50'),_0x3b22ce[_0x2c2e('0x17')],transfers[_0x3b22ce['uniqueid']][_0x2c2e('0x7')],transfers[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x2b')],transfers[_0x3b22ce['uniqueid']][_0x2c2e('0x19')]));writeDB(transfers[_0x3b22ce[_0x2c2e('0x17')]],!![]);}if(agents[_0x3b22ce[_0x2c2e('0x17')]]&&agents[_0x3b22ce[_0x2c2e('0x17')]]['agentconnectAt']){agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0xf')]=!![];agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x34')]=utils['now']();agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x24')]=utils[_0x2c2e('0x53')](agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x34')],agents[_0x3b22ce[_0x2c2e('0x17')]]['agentconnectAt']);agents[_0x3b22ce['uniqueid']][_0x2c2e('0x2b')]=agents[_0x3b22ce['uniqueid']][_0x2c2e('0x3a')]?_0x2c2e('0x3a'):_0x2c2e('0x52');agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x19')]=_0x2c2e('0x35');utils[_0x2c2e('0x3')](util[_0x2c2e('0x4')](_0x2c2e('0x50'),_0x3b22ce[_0x2c2e('0x17')],agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x7')],agents[_0x3b22ce['uniqueid']]['reason'],agents[_0x3b22ce[_0x2c2e('0x17')]]['lastevent']));writeDB(agents[_0x3b22ce[_0x2c2e('0x17')]]);}}catch(_0x1713bd){utils[_0x2c2e('0x1c')](util[_0x2c2e('0x4')](_0x2c2e('0x4e'),_0x3b22ce[_0x2c2e('0x17')]),_0x1713bd);}}; \ No newline at end of file +var _0x4084=['debug','format','now','lastevent','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','ringtime','push','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','agentcalledAt','secondtransfererlinkedid','transferexten','secondtransfererexten','transfertargetuniqueid','clone','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','queue','getVoiceQueueByName','then','type','agentacw','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled'];(function(_0x3ae715,_0x8eedaf){var _0x2abe29=function(_0x339a3a){while(--_0x339a3a){_0x3ae715['push'](_0x3ae715['shift']());}};_0x2abe29(++_0x8eedaf);}(_0x4084,0x9f));var _0x4408=function(_0x209517,_0x2828ac){_0x209517=_0x209517-0x0;var _0xa4a36b=_0x4084[_0x209517];return _0xa4a36b;};'use strict';var _=require(_0x4408('0x0'));var util=require(_0x4408('0x1'));var utils=require(_0x4408('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2a089a,_0x2d9b2c){utils['info'](util['format'](_0x4408('0x3'),_0x2a089a[_0x4408('0x4')],_0x2a089a[_0x4408('0x5')],_0x2a089a['queue'],_0x2a089a[_0x4408('0x6')],_0x2a089a[_0x4408('0x7')],_0x2a089a[_0x4408('0x8')],_0x2a089a[_0x4408('0x9')],_0x2a089a['lastevent']));if(_0x2a089a[_0x4408('0xa')]){utils[_0x4408('0xb')](_0x2a089a[_0x4408('0xa')])[_0x4408('0xc')](function(_0x18b3f7){if(_0x18b3f7){_0x2a089a[_0x4408('0xd')]=_0x18b3f7['type'];_0x2a089a[_0x4408('0xe')]=_0x2a089a['agentcomplete']?_0x18b3f7[_0x4408('0xf')]:![];_0x2a089a['acwtime']=_0x2a089a[_0x4408('0xe')]?_0x18b3f7[_0x4408('0x10')]:0x0;}utils[_0x4408('0x11')](_0x4408('0x12'),_0x2a089a);});}else{utils[_0x4408('0x11')](_0x4408('0x12'),_0x2a089a);}if(_0x2d9b2c){delete transfers[_0x2a089a[_0x4408('0x4')]];}else{delete agents[_0x2a089a[_0x4408('0x13')]];}}exports[_0x4408('0x14')]=function(_0x5de544){try{utils[_0x4408('0x15')](util[_0x4408('0x16')]('[%s][agents][agentcalled]',_0x5de544[_0x4408('0x4')]),_0x5de544);agents[_0x5de544[_0x4408('0x13')]]=_0x5de544;agents[_0x5de544['destuniqueid']]['agentcalledAt']=utils[_0x4408('0x17')]();agents[_0x5de544[_0x4408('0x13')]][_0x4408('0x18')]='called';agents[_0x5de544[_0x4408('0x13')]][_0x4408('0x9')]=null;agents[_0x5de544[_0x4408('0x13')]][_0x4408('0x19')]=null;utils[_0x4408('0x1a')](util['format'](_0x4408('0x1b'),_0x5de544[_0x4408('0x4')],agents[_0x5de544[_0x4408('0x13')]]['membername'],_0x5de544[_0x4408('0x13')]));}catch(_0x514eb7){utils[_0x4408('0x1c')](util[_0x4408('0x16')](_0x4408('0x1d'),_0x5de544[_0x4408('0x4')]),_0x514eb7);}};exports[_0x4408('0x1e')]=function(_0x4e7b4e){try{if(!_[_0x4408('0x1f')](agents[_0x4e7b4e[_0x4408('0x13')]])){utils[_0x4408('0x15')](util['format'](_0x4408('0x20'),_0x4e7b4e[_0x4408('0x4')]),_0x4e7b4e);utils[_0x4408('0x1a')](util['format'](_0x4408('0x21'),_0x4e7b4e[_0x4408('0x4')],agents[_0x4e7b4e[_0x4408('0x13')]][_0x4408('0x6')],_0x4e7b4e[_0x4408('0x13')]));agents[_0x4e7b4e['destuniqueid']][_0x4408('0x1e')]=!![];agents[_0x4e7b4e['destuniqueid']][_0x4408('0x22')]=utils[_0x4408('0x17')]();agents[_0x4e7b4e[_0x4408('0x13')]][_0x4408('0x18')]='timeout';agents[_0x4e7b4e[_0x4408('0x13')]][_0x4408('0x23')]=_0x4408('0x24');agents[_0x4e7b4e[_0x4408('0x13')]]['holdtime']=_0x4e7b4e[_0x4408('0x25')]?parseInt(_0x4e7b4e[_0x4408('0x25')])/0x3e8:0x0;agents[_0x4e7b4e['destuniqueid']]['talktime']=0x0;unanswered[_0x4408('0x26')](_0x4e7b4e[_0x4408('0x13')]);}}catch(_0x51ff28){utils[_0x4408('0x1c')](util[_0x4408('0x16')](_0x4408('0x20'),_0x4e7b4e[_0x4408('0x4')]),_0x51ff28);}};exports['queuecallerabandon']=function(_0x1c1895){try{_[_0x4408('0x27')](agents,function(_0x5a91c4,_0x47850a){if(_0x5a91c4['uniqueid']==_0x1c1895[_0x4408('0x4')]&&!_[_0x4408('0x28')](unanswered,_0x5a91c4[_0x4408('0x13')])){utils[_0x4408('0x15')](util[_0x4408('0x16')]('[%s][agents][queuecallerabandon]',_0x1c1895['uniqueid']),_0x1c1895);utils[_0x4408('0x1a')](util[_0x4408('0x16')](_0x4408('0x29'),_0x1c1895[_0x4408('0x4')],_0x5a91c4[_0x4408('0x6')],_0x5a91c4[_0x4408('0x13')]));_0x5a91c4[_0x4408('0x1e')]=!![];_0x5a91c4[_0x4408('0x22')]=utils['now']();_0x5a91c4['lastevent']=_0x4408('0x2a');_0x5a91c4[_0x4408('0x23')]=_0x4408('0x2a');_0x5a91c4['holdtime']=_0x1c1895[_0x4408('0x2b')];_0x5a91c4['talktime']=0x0;writeDB(_0x5a91c4);}});}catch(_0x1c9057){utils[_0x4408('0x1c')](util[_0x4408('0x16')](_0x4408('0x2c'),_0x1c1895[_0x4408('0x4')]),_0x1c9057);}};exports[_0x4408('0x2d')]=function(_0x54f864){try{if(agents[_0x54f864['destuniqueid']]){utils[_0x4408('0x15')](util[_0x4408('0x16')](_0x4408('0x2e'),_0x54f864[_0x4408('0x4')]),_0x54f864);utils[_0x4408('0x1a')](util[_0x4408('0x16')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54f864[_0x4408('0x4')],agents[_0x54f864[_0x4408('0x13')]][_0x4408('0x6')],_0x54f864[_0x4408('0x13')]));agents[_0x54f864[_0x4408('0x13')]][_0x4408('0x2f')]=utils[_0x4408('0x17')]();agents[_0x54f864[_0x4408('0x13')]][_0x4408('0x9')]=_0x54f864[_0x4408('0x9')];agents[_0x54f864[_0x4408('0x13')]][_0x4408('0x19')]=_0x54f864[_0x4408('0x19')];agents[_0x54f864[_0x4408('0x13')]][_0x4408('0x2b')]=_0x54f864[_0x4408('0x25')];agents[_0x54f864['destuniqueid']][_0x4408('0x18')]=_0x4408('0x30');_['forIn'](agents,function(_0x180e3e,_0x4fb7f2){if(_0x180e3e[_0x4408('0x13')]!=_0x54f864['destuniqueid']&&_0x180e3e[_0x4408('0x4')]==_0x54f864['uniqueid']){_0x180e3e[_0x4408('0x31')]=0x0;_0x180e3e['holdtime']=_0x54f864['ringtime'];_0x180e3e[_0x4408('0x1e')]=!![];_0x180e3e[_0x4408('0x22')]=utils[_0x4408('0x17')]();_0x180e3e[_0x4408('0x18')]=_0x4408('0x32');_0x180e3e[_0x4408('0x23')]=_0x4408('0x32');_0x180e3e[_0x4408('0x33')]=_0x54f864[_0x4408('0x13')];_0x180e3e[_0x4408('0x34')]=_0x54f864['membername'];writeDB(_0x180e3e);}});}}catch(_0x2422a0){utils['error'](util['format'](_0x4408('0x2e'),_0x54f864[_0x4408('0x4')]),_0x2422a0);}};exports[_0x4408('0x35')]=function(_0x2344a3){try{if(!_[_0x4408('0x1f')](agents[_0x2344a3[_0x4408('0x13')]])){utils['debug'](util[_0x4408('0x16')](_0x4408('0x36'),_0x2344a3[_0x4408('0x4')]),_0x2344a3);utils['info'](util[_0x4408('0x16')](_0x4408('0x37'),_0x2344a3[_0x4408('0x4')],agents[_0x2344a3[_0x4408('0x13')]][_0x4408('0x6')],_0x2344a3[_0x4408('0x13')]));agents[_0x2344a3['destuniqueid']][_0x4408('0x35')]=!![];agents[_0x2344a3[_0x4408('0x13')]][_0x4408('0x38')]=utils[_0x4408('0x17')]();agents[_0x2344a3[_0x4408('0x13')]][_0x4408('0x31')]=utils[_0x4408('0x39')](agents[_0x2344a3[_0x4408('0x13')]][_0x4408('0x38')],agents[_0x2344a3[_0x4408('0x13')]]['agentconnectAt']);agents[_0x2344a3[_0x4408('0x13')]]['reason']=_0x2344a3['reason'];agents[_0x2344a3[_0x4408('0x13')]][_0x4408('0x18')]=_0x4408('0x3a');writeDB(agents[_0x2344a3[_0x4408('0x13')]]);}}catch(_0x414f2b){utils[_0x4408('0x1c')](util[_0x4408('0x16')](_0x4408('0x36'),_0x2344a3[_0x4408('0x4')]),_0x414f2b);}};exports[_0x4408('0x3b')]=function(_0x5787d4){try{if(!_['isNil'](agents[_0x5787d4[_0x4408('0x3c')]])){utils[_0x4408('0x15')](util['format']('[%s][agents][blindtransfer]',_0x5787d4[_0x4408('0x4')]),_0x5787d4);utils[_0x4408('0x1a')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5787d4[_0x4408('0x4')],agents[_0x5787d4[_0x4408('0x3c')]][_0x4408('0x6')],agents[_0x5787d4[_0x4408('0x3c')]][_0x4408('0x4')]));agents[_0x5787d4[_0x4408('0x3c')]]['transfer']=!![];agents[_0x5787d4[_0x4408('0x3c')]]['transfertype']='blind';agents[_0x5787d4[_0x4408('0x3c')]]['transferexten']=_0x5787d4[_0x4408('0x3d')];agents[_0x5787d4[_0x4408('0x3c')]][_0x4408('0x3e')]=agents[_0x5787d4[_0x4408('0x3c')]]['uniqueid'];}}catch(_0x35bae8){utils[_0x4408('0x1c')](util[_0x4408('0x16')](_0x4408('0x3f'),_0x5787d4['uniqueid']),_0x35bae8);}};exports[_0x4408('0x40')]=function(_0x5d73ac){try{utils[_0x4408('0x15')](util[_0x4408('0x16')](_0x4408('0x41'),_0x5d73ac[_0x4408('0x42')]),_0x5d73ac);if(_0x5d73ac[_0x4408('0x42')]==_0x5d73ac[_0x4408('0x43')]){if(!_['isNil'](agents[_0x5d73ac[_0x4408('0x44')]])){utils[_0x4408('0x1a')](util[_0x4408('0x16')](_0x4408('0x45'),_0x5d73ac[_0x4408('0x42')],agents[_0x5d73ac[_0x4408('0x44')]][_0x4408('0x6')]));agents[_0x5d73ac[_0x4408('0x44')]][_0x4408('0x46')]=!![];agents[_0x5d73ac[_0x4408('0x44')]][_0x4408('0x47')]=_0x4408('0x48');agents[_0x5d73ac['secondtransfereruniqueid']]['transferexten']=_0x5d73ac[_0x4408('0x49')];agents[_0x5d73ac[_0x4408('0x44')]][_0x4408('0x3e')]=_0x5d73ac[_0x4408('0x42')];}if(_0x5d73ac[_0x4408('0x4a')]&&agents[_0x5d73ac['transfereeuniqueid']]){agents[_0x5d73ac[_0x4408('0x4a')]][_0x4408('0x4b')]=0x1;transfers[_0x5d73ac[_0x4408('0x4a')]]=_['clone'](agents[_0x5d73ac[_0x4408('0x4a')]]);transfers[_0x5d73ac[_0x4408('0x4a')]][_0x4408('0x8')]=agents[_0x5d73ac['secondtransfereruniqueid']]['calleridnum'];transfers[_0x5d73ac[_0x4408('0x4a')]][_0x4408('0x4c')]=agents[_0x5d73ac[_0x4408('0x44')]][_0x4408('0x4c')];transfers[_0x5d73ac[_0x4408('0x4a')]][_0x4408('0x4d')]=utils[_0x4408('0x17')]();transfers[_0x5d73ac[_0x4408('0x4a')]][_0x4408('0x2f')]=utils[_0x4408('0x17')]();transfers[_0x5d73ac[_0x4408('0x4a')]][_0x4408('0x2b')]=0x0;transfers[_0x5d73ac[_0x4408('0x4a')]][_0x4408('0x4b')]=0x2;}}else if(_0x5d73ac[_0x4408('0x44')]==_0x5d73ac[_0x4408('0x4e')]){if(!_['isNil'](agents[_0x5d73ac[_0x4408('0x42')]])){utils['info'](util[_0x4408('0x16')](_0x4408('0x45'),_0x5d73ac[_0x4408('0x42')],agents[_0x5d73ac[_0x4408('0x42')]]['membername']));agents[_0x5d73ac[_0x4408('0x42')]][_0x4408('0x46')]=!![];agents[_0x5d73ac[_0x4408('0x42')]][_0x4408('0x47')]=_0x4408('0x48');agents[_0x5d73ac[_0x4408('0x42')]][_0x4408('0x4f')]=_0x5d73ac[_0x4408('0x50')];agents[_0x5d73ac[_0x4408('0x42')]]['transferuniqueid']=_0x5d73ac[_0x4408('0x44')];}if(_0x5d73ac[_0x4408('0x51')]&&agents[_0x5d73ac[_0x4408('0x51')]]){agents[_0x5d73ac[_0x4408('0x51')]][_0x4408('0x4b')]=0x1;transfers[_0x5d73ac[_0x4408('0x51')]]=_[_0x4408('0x52')](agents[_0x5d73ac[_0x4408('0x51')]]);transfers[_0x5d73ac[_0x4408('0x51')]][_0x4408('0x8')]=agents[_0x5d73ac['origtransfereruniqueid']][_0x4408('0x8')];transfers[_0x5d73ac[_0x4408('0x51')]]['calleridname']=agents[_0x5d73ac[_0x4408('0x42')]][_0x4408('0x4c')];transfers[_0x5d73ac[_0x4408('0x51')]][_0x4408('0x4d')]=utils[_0x4408('0x17')]();transfers[_0x5d73ac['transfertargetuniqueid']][_0x4408('0x2f')]=utils[_0x4408('0x17')]();transfers[_0x5d73ac[_0x4408('0x51')]][_0x4408('0x2b')]=0x0;transfers[_0x5d73ac[_0x4408('0x51')]][_0x4408('0x4b')]=0x2;}}}catch(_0x19d481){utils[_0x4408('0x1c')](util[_0x4408('0x16')](_0x4408('0x41'),_0x5d73ac[_0x4408('0x42')]),_0x19d481);}};exports['hangup']=function(_0x1d9c59){try{utils[_0x4408('0x15')](util[_0x4408('0x16')](_0x4408('0x53'),_0x1d9c59[_0x4408('0x4')]),_0x1d9c59);if(agents[_0x1d9c59[_0x4408('0x4')]]&&agents[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x23')]===_0x4408('0x24')){if(_0x1d9c59[_0x4408('0x54')]==='21'){agents[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x23')]=_0x4408('0x55');agents[_0x1d9c59['uniqueid']][_0x4408('0x18')]=_0x4408('0x55');}utils['info'](util[_0x4408('0x16')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1d9c59[_0x4408('0x4')],agents[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x6')],agents[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x23')],agents[_0x1d9c59[_0x4408('0x4')]]['lastevent']));writeDB(agents[_0x1d9c59[_0x4408('0x4')]]);var _0x5c0fbe=unanswered[_0x4408('0x56')](_0x1d9c59[_0x4408('0x4')]);if(_0x5c0fbe>-0x1){unanswered[_0x4408('0x57')](_0x5c0fbe,0x1);}}if(transfers[_0x1d9c59[_0x4408('0x4')]]){transfers[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x35')]=!![];transfers[_0x1d9c59[_0x4408('0x4')]]['agentcompleteAt']=utils[_0x4408('0x17')]();transfers[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x31')]=utils[_0x4408('0x39')](transfers[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x38')],transfers[_0x1d9c59[_0x4408('0x4')]]['agentconnectAt']);transfers[_0x1d9c59['uniqueid']][_0x4408('0x23')]=_0x4408('0x58');transfers[_0x1d9c59[_0x4408('0x4')]]['lastevent']=_0x4408('0x3a');utils[_0x4408('0x1a')](util[_0x4408('0x16')](_0x4408('0x59'),_0x1d9c59['uniqueid'],transfers[_0x1d9c59['uniqueid']][_0x4408('0x6')],transfers[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x23')],transfers[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x18')]));writeDB(transfers[_0x1d9c59[_0x4408('0x4')]],!![]);}if(agents[_0x1d9c59[_0x4408('0x4')]]&&agents[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x2f')]){agents[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x35')]=!![];agents[_0x1d9c59[_0x4408('0x4')]]['agentcompleteAt']=utils[_0x4408('0x17')]();agents[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x31')]=utils[_0x4408('0x39')](agents[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x38')],agents[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x2f')]);agents[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x23')]=agents[_0x1d9c59['uniqueid']][_0x4408('0x46')]?_0x4408('0x46'):_0x4408('0x58');agents[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x18')]=_0x4408('0x3a');utils[_0x4408('0x1a')](util[_0x4408('0x16')](_0x4408('0x59'),_0x1d9c59[_0x4408('0x4')],agents[_0x1d9c59[_0x4408('0x4')]][_0x4408('0x6')],agents[_0x1d9c59['uniqueid']][_0x4408('0x23')],agents[_0x1d9c59['uniqueid']][_0x4408('0x18')]));writeDB(agents[_0x1d9c59[_0x4408('0x4')]]);}}catch(_0x4950cf){utils['error'](util['format']('[%s][agents][hangup]',_0x1d9c59[_0x4408('0x4')]),_0x4950cf);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 224d753..2f41a26 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 _0xf00b=['calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','[%s][calls][newchannel]','linkedid','context','exten','now','DOCUMENTATION','error','newstate','debug','format','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','cause-txt','endtime','duration','diffTime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','appdata','substring','lastIndexOf','includes','noop','execif','gotoif','[%s][calls][newexten]','lodash','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xf00b,0x133));var _0xbf00=function(_0x18c22d,_0x315d7e){_0x18c22d=_0x18c22d-0x0;var _0x3bbb6b=_0xf00b[_0x18c22d];return _0x3bbb6b;};'use strict';var _=require(_0xbf00('0x0'));var util=require('util');var utils=require(_0xbf00('0x1'));var dispositions=['NO\x20ANSWER',_0xbf00('0x2'),_0xbf00('0x2'),_0xbf00('0x3'),_0xbf00('0x3'),_0xbf00('0x3'),_0xbf00('0x4'),_0xbf00('0x5'),_0xbf00('0x2'),_0xbf00('0x2'),_0xbf00('0x2')];var channels={};function writeDB(_0x1d7a0a){utils[_0xbf00('0x6')](util['format'](_0xbf00('0x7'),_0x1d7a0a['uniqueid'],_0x1d7a0a[_0xbf00('0x8')],_0x1d7a0a['queue'],_0x1d7a0a[_0xbf00('0x9')],_0x1d7a0a[_0xbf00('0xa')],_0x1d7a0a[_0xbf00('0xb')],_0x1d7a0a[_0xbf00('0xc')],_0x1d7a0a[_0xbf00('0xd')]));if(_0x1d7a0a[_0xbf00('0xe')]){utils[_0xbf00('0xf')](_0x1d7a0a[_0xbf00('0xe')])[_0xbf00('0x10')](function(_0x4db1b0){if(_0x4db1b0){_0x1d7a0a[_0xbf00('0x11')]=_0x4db1b0['id'];}utils[_0xbf00('0x12')](_0xbf00('0x13'),_0x1d7a0a);});}else{utils[_0xbf00('0x12')](_0xbf00('0x13'),_0x1d7a0a);}if(channels[_0x1d7a0a['uniqueid']]){delete channels[_0x1d7a0a[_0xbf00('0x14')]];}}exports[_0xbf00('0x15')]=function(_0x147ac0){try{utils['debug'](util['format'](_0xbf00('0x16'),_0x147ac0[_0xbf00('0x14')]),_0x147ac0);if(_0x147ac0[_0xbf00('0x14')]==_0x147ac0[_0xbf00('0x17')]&&_0x147ac0[_0xbf00('0x8')]!='OutgoingSpoolFailed'){utils[_0xbf00('0x6')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x147ac0[_0xbf00('0x14')],_0x147ac0[_0xbf00('0x18')],_0x147ac0[_0xbf00('0x19')]));channels[_0x147ac0[_0xbf00('0x14')]]={'uniqueid':_0x147ac0['uniqueid'],'accountcode':_0x147ac0['accountcode'],'source':_0x147ac0[_0xbf00('0xb')],'destination':_0x147ac0['exten'],'destinationcontext':_0x147ac0['context'],'channel':_0x147ac0[_0xbf00('0x8')],'starttime':utils[_0xbf00('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xbf00('0x3'),'amaflags':_0xbf00('0x1b')};}}catch(_0x2bddc9){utils[_0xbf00('0x1c')](util['format']('[%s][calls][newchannel]',_0x147ac0[_0xbf00('0x14')]),_0x2bddc9);}};exports[_0xbf00('0x1d')]=function(_0x1b2828){try{utils[_0xbf00('0x1e')](util[_0xbf00('0x1f')](_0xbf00('0x20'),_0x1b2828[_0xbf00('0x14')]),_0x1b2828);if(!_['isNil'](channels[_0x1b2828[_0xbf00('0x14')]])&&_0x1b2828[_0xbf00('0x21')]==0x6){utils[_0xbf00('0x6')](util[_0xbf00('0x1f')](_0xbf00('0x22'),_0x1b2828['uniqueid'],_0x1b2828[_0xbf00('0x18')],_0x1b2828['channel']));if(_[_0xbf00('0x23')](channels[_0x1b2828[_0xbf00('0x14')]][_0xbf00('0x24')])){channels[_0x1b2828[_0xbf00('0x14')]][_0xbf00('0x24')]=utils[_0xbf00('0x1a')]();}}else if(!_[_0xbf00('0x23')](channels[_0x1b2828[_0xbf00('0x17')]])&&_0x1b2828['channelstate']==0x6&&_0x1b2828[_0xbf00('0x18')]!=_0xbf00('0x25')){utils[_0xbf00('0x6')](util['format'](_0xbf00('0x26'),_0x1b2828['uniqueid'],_0x1b2828['linkedid'],_0x1b2828[_0xbf00('0x18')],_0x1b2828[_0xbf00('0x8')]));channels[_0x1b2828[_0xbf00('0x17')]][_0xbf00('0xe')]=_0x1b2828['accountcode'];channels[_0x1b2828['linkedid']][_0xbf00('0x27')]=_0x1b2828[_0xbf00('0x8')];if(_[_0xbf00('0x23')](channels[_0x1b2828[_0xbf00('0x17')]][_0xbf00('0x28')])){channels[_0x1b2828['linkedid']][_0xbf00('0x28')]=utils['now']();}channels[_0x1b2828[_0xbf00('0x17')]][_0xbf00('0x29')]=dispositions[_[_0xbf00('0x2a')](_0x1b2828[_0xbf00('0x21')])]||'ANSWERED';}}catch(_0x4273f5){utils[_0xbf00('0x1c')](util[_0xbf00('0x1f')](_0xbf00('0x20'),_0x1b2828[_0xbf00('0x14')]),_0x4273f5);}};exports[_0xbf00('0x2b')]=function(_0x9fa870){try{if(!_[_0xbf00('0x23')](channels[_0x9fa870[_0xbf00('0x14')]])){utils[_0xbf00('0x1e')](util['format']('[%s][calls][hangup]',_0x9fa870[_0xbf00('0x14')]),_0x9fa870);if(_[_0xbf00('0x23')](channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x2c')])){channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x2c')]=_0x9fa870[_0xbf00('0x2d')]+'\x20<'+_0x9fa870[_0xbf00('0xb')]+'>';}utils[_0xbf00('0x6')](util[_0xbf00('0x1f')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x9fa870['uniqueid'],channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x2c')],_0x9fa870[_0xbf00('0x2e')]));channels[_0x9fa870['uniqueid']][_0xbf00('0x2f')]=utils[_0xbf00('0x1a')]();channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x30')]=utils[_0xbf00('0x31')](channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x2f')],channels[_0x9fa870[_0xbf00('0x14')]]['starttime']);channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x32')]=channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x28')]?utils[_0xbf00('0x31')](channels[_0x9fa870[_0xbf00('0x14')]]['endtime'],channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x28')]):0x0;writeDB(channels[_0x9fa870[_0xbf00('0x14')]]);}}catch(_0x46965e){utils[_0xbf00('0x1c')](util[_0xbf00('0x1f')](_0xbf00('0x33'),_0x9fa870['uniqueid']),_0x46965e);}};exports[_0xbf00('0x34')]=function(_0x115bbf){try{if(!_['isNil'](channels[_0x115bbf[_0xbf00('0x35')]])){utils['debug'](util[_0xbf00('0x1f')](_0xbf00('0x36'),_0x115bbf[_0xbf00('0x37')]),_0x115bbf);if(channels[_0x115bbf[_0xbf00('0x35')]]['channel']==_0x115bbf['transfereechannel']){utils['info'](util['format'](_0xbf00('0x38'),_0x115bbf[_0xbf00('0x37')],_0x115bbf[_0xbf00('0x35')],_0x115bbf[_0xbf00('0x39')]));channels[_0x115bbf[_0xbf00('0x35')]][_0xbf00('0x27')]=_0x115bbf[_0xbf00('0x39')];channels[_0x115bbf[_0xbf00('0x35')]][_0xbf00('0x3a')]=_0xbf00('0x3b');}else if(channels[_0x115bbf[_0xbf00('0x35')]][_0xbf00('0x8')]=_0x115bbf[_0xbf00('0x3c')]){utils['info'](util[_0xbf00('0x1f')](_0xbf00('0x38'),_0x115bbf[_0xbf00('0x37')],_0x115bbf[_0xbf00('0x35')],_0x115bbf[_0xbf00('0x3d')]));channels[_0x115bbf[_0xbf00('0x35')]]['destinationchannel']=_0x115bbf['origtransfererchannel'];channels[_0x115bbf[_0xbf00('0x35')]][_0xbf00('0x3a')]=_0xbf00('0x3b');}}}catch(_0xb8e6d4){utils[_0xbf00('0x1c')](util['format'](_0xbf00('0x36'),_0x115bbf['origtransfereruniqueid']),_0xb8e6d4);}};exports['musiconholdstart']=function(_0x5f1083){try{if(!_[_0xbf00('0x23')](channels[_0x5f1083[_0xbf00('0x14')]])){utils[_0xbf00('0x1e')](util[_0xbf00('0x1f')]('[%s][calls][musiconholdstart]',_0x5f1083[_0xbf00('0x14')]),_0x5f1083);channels[_0x5f1083['uniqueid']][_0xbf00('0x3e')]=utils[_0xbf00('0x1a')]();utils[_0xbf00('0x6')](util[_0xbf00('0x1f')](_0xbf00('0x3f'),_0x5f1083['uniqueid'],channels[_0x5f1083[_0xbf00('0x14')]][_0xbf00('0x3e')]));}}catch(_0x137a9b){utils[_0xbf00('0x1c')](util[_0xbf00('0x1f')]('[%s][calls][musiconholdstart]',_0x5f1083[_0xbf00('0x14')]),_0x137a9b);}};exports[_0xbf00('0x40')]=function(_0x34080e){try{if(!_['isNil'](channels[_0x34080e[_0xbf00('0x14')]])){utils['debug'](util[_0xbf00('0x1f')]('[%s][calls][musiconholdstop]',_0x34080e['uniqueid']),_0x34080e);if(!_['isNil'](channels[_0x34080e[_0xbf00('0x14')]][_0xbf00('0x3e')])){channels[_0x34080e['uniqueid']]['mohtime']+=utils[_0xbf00('0x31')](utils[_0xbf00('0x1a')](),channels[_0x34080e['uniqueid']][_0xbf00('0x3e')]);utils['info'](util[_0xbf00('0x1f')](_0xbf00('0x41'),_0x34080e['uniqueid'],channels[_0x34080e[_0xbf00('0x14')]]['mohtime']));delete channels[_0x34080e[_0xbf00('0x14')]]['musiconholdstartAt'];}}}catch(_0x4fcc4a){utils[_0xbf00('0x1c')](util[_0xbf00('0x1f')](_0xbf00('0x42'),_0x34080e[_0xbf00('0x14')]),_0x4fcc4a);}};exports[_0xbf00('0x43')]=function(_0x5d0ce3){try{if(!_[_0xbf00('0x23')](channels[_0x5d0ce3[_0xbf00('0x14')]])){utils[_0xbf00('0x1e')](util[_0xbf00('0x1f')](_0xbf00('0x44'),_0x5d0ce3['uniqueid']),_0x5d0ce3);if(!_[_0xbf00('0x23')](_0x5d0ce3['variable']['xmd-originatecalleridnum'])){utils['info'](util[_0xbf00('0x1f')](_0xbf00('0x45'),_0x5d0ce3['uniqueid'],_0x5d0ce3[_0xbf00('0x46')]));channels[_0x5d0ce3[_0xbf00('0x14')]][_0xbf00('0x47')]=_0x5d0ce3[_0xbf00('0x46')];}if(!_[_0xbf00('0x23')](_0x5d0ce3[_0xbf00('0x48')][_0xbf00('0x49')])){utils[_0xbf00('0x6')](util[_0xbf00('0x1f')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x5d0ce3['uniqueid'],_0x5d0ce3['value']));channels[_0x5d0ce3[_0xbf00('0x14')]][_0xbf00('0x4a')]=_0x5d0ce3[_0xbf00('0x46')];channels[_0x5d0ce3['uniqueid']][_0xbf00('0x2c')]='\x22'+_0x5d0ce3[_0xbf00('0x46')]+_0xbf00('0x4b')+_0x5d0ce3[_0xbf00('0x46')]+'>';}if(!_[_0xbf00('0x23')](_0x5d0ce3[_0xbf00('0x48')][_0xbf00('0x4c')])||!_['isNil'](_0x5d0ce3['variable'][_0xbf00('0x4d')])){utils[_0xbf00('0x6')](util[_0xbf00('0x1f')](_0xbf00('0x4e'),_0x5d0ce3[_0xbf00('0x14')],!_['isNil'](_0x5d0ce3[_0xbf00('0x48')][_0xbf00('0x4c')])?_0xbf00('0x4c'):_0xbf00('0x4d'),_0x5d0ce3['value']));channels[_0x5d0ce3[_0xbf00('0x14')]]['callerid']=_0x5d0ce3[_0xbf00('0x46')];}if(!_[_0xbf00('0x23')](_0x5d0ce3[_0xbf00('0x48')]['xmd-queue'])||!_[_0xbf00('0x23')](_0x5d0ce3[_0xbf00('0x48')]['xmcs-queue'])){utils['info'](util['format'](_0xbf00('0x4e'),_0x5d0ce3['uniqueid'],!_[_0xbf00('0x23')](_0x5d0ce3[_0xbf00('0x48')][_0xbf00('0x4f')])?_0xbf00('0x4f'):_0xbf00('0x50'),_0x5d0ce3[_0xbf00('0x46')]));channels[_0x5d0ce3['uniqueid']][_0xbf00('0x51')]=_0xbf00('0x52');channels[_0x5d0ce3['uniqueid']][_0xbf00('0x53')]=_0x5d0ce3['value'];channels[_0x5d0ce3['uniqueid']][_0xbf00('0x54')]=!![];}if(!_[_0xbf00('0x23')](_0x5d0ce3[_0xbf00('0x48')][_0xbf00('0x55')])){utils[_0xbf00('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x5d0ce3[_0xbf00('0x14')],_0x5d0ce3[_0xbf00('0x46')]));channels[_0x5d0ce3[_0xbf00('0x14')]][_0xbf00('0x56')]=_0x5d0ce3[_0xbf00('0x46')];}if(!_[_0xbf00('0x23')](_0x5d0ce3['variable']['xmd-cdrtype'])){utils[_0xbf00('0x6')](util[_0xbf00('0x1f')](_0xbf00('0x57'),_0x5d0ce3[_0xbf00('0x14')],_0x5d0ce3[_0xbf00('0x46')]));channels[_0x5d0ce3[_0xbf00('0x14')]]['type']=_0x5d0ce3['value'];}if(!_['isNil'](_0x5d0ce3[_0xbf00('0x48')][_0xbf00('0x58')])){utils[_0xbf00('0x6')](util[_0xbf00('0x1f')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5d0ce3['uniqueid'],_0x5d0ce3[_0xbf00('0x46')]));channels[_0x5d0ce3[_0xbf00('0x14')]][_0xbf00('0x59')]=_0x5d0ce3[_0xbf00('0x46')];}if(!_[_0xbf00('0x23')](_0x5d0ce3[_0xbf00('0x48')]['sipcallid'])){utils[_0xbf00('0x6')](util[_0xbf00('0x1f')](_0xbf00('0x5a'),_0x5d0ce3[_0xbf00('0x14')],_0x5d0ce3[_0xbf00('0x46')]));channels[_0x5d0ce3[_0xbf00('0x14')]][_0xbf00('0x5b')]=_0x5d0ce3['value'];}}}catch(_0x594406){utils['error'](util[_0xbf00('0x1f')](_0xbf00('0x44'),_0x5d0ce3[_0xbf00('0x14')]),_0x594406);}};exports['newexten']=function(_0x1d0d4a){try{if(!_[_0xbf00('0x23')](channels[_0x1d0d4a[_0xbf00('0x14')]])){utils['debug'](util[_0xbf00('0x1f')]('[%s][calls][newexten]',_0x1d0d4a[_0xbf00('0x14')]),_0x1d0d4a);utils[_0xbf00('0x6')](util['format'](_0xbf00('0x5c'),_0x1d0d4a['uniqueid'],_0x1d0d4a[_0xbf00('0x5d')],_0x1d0d4a['appdata']));if(_0x1d0d4a[_0xbf00('0x5d')][_0xbf00('0x5e')]()==_0xbf00('0x5f')&&_[_0xbf00('0x60')](_0x1d0d4a['appdata'][_0xbf00('0x5e')](),_0xbf00('0x61'))){var _0x2dda7a=_0x1d0d4a[_0xbf00('0x62')]['split']('=');var _0x4ed323=_0x2dda7a[0x0][_0xbf00('0x63')](_0x2dda7a[0x0][_0xbf00('0x64')]('(')+0x1,_0x2dda7a[0x0]['lastIndexOf'](')'));var _0x15e2db=_0x2dda7a[0x1];channels[_0x1d0d4a['uniqueid']][_0x4ed323]=_0x15e2db;}if(!_[_0xbf00('0x65')]([_0xbf00('0x2b'),_0xbf00('0x66'),_0xbf00('0x67'),'set',_0xbf00('0x68')],_0x1d0d4a[_0xbf00('0x5d')][_0xbf00('0x5e')]())){channels[_0x1d0d4a[_0xbf00('0x14')]]['lastapplication']=_0x1d0d4a[_0xbf00('0x5d')];channels[_0x1d0d4a[_0xbf00('0x14')]][_0xbf00('0x53')]=_0x1d0d4a[_0xbf00('0x62')];}}}catch(_0x76c2f7){utils[_0xbf00('0x1c')](util[_0xbf00('0x1f')](_0xbf00('0x69'),_0x1d0d4a[_0xbf00('0x14')]),_0x76c2f7);}}; \ No newline at end of file +var _0xfebf=['[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','isNil','channelstate','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','calleridnum','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','mohtime','diffTime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','appdata','cdr','split','substring','noop','set','lastapplication','lodash','util','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','membername','interface','connectedlinenum','lastevent','getUserByInternal','accountcode','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed'];(function(_0xe4f180,_0x46e1b7){var _0x1a3add=function(_0x2750be){while(--_0x2750be){_0xe4f180['push'](_0xe4f180['shift']());}};_0x1a3add(++_0x46e1b7);}(_0xfebf,0x173));var _0xffeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xffeb('0x0'));var util=require(_0xffeb('0x1'));var utils=require('./utils');var dispositions=[_0xffeb('0x2'),'FAILED',_0xffeb('0x3'),_0xffeb('0x2'),'NO\x20ANSWER',_0xffeb('0x2'),_0xffeb('0x4'),_0xffeb('0x5'),_0xffeb('0x3'),'FAILED','FAILED'];var channels={};function writeDB(_0x56b980){utils[_0xffeb('0x6')](util[_0xffeb('0x7')](_0xffeb('0x8'),_0x56b980[_0xffeb('0x9')],_0x56b980[_0xffeb('0xa')],_0x56b980['queue'],_0x56b980[_0xffeb('0xb')],_0x56b980[_0xffeb('0xc')],_0x56b980['calleridnum'],_0x56b980[_0xffeb('0xd')],_0x56b980[_0xffeb('0xe')]));if(_0x56b980['accountcode']){utils[_0xffeb('0xf')](_0x56b980[_0xffeb('0x10')])['then'](function(_0x3d7450){if(_0x3d7450){_0x56b980[_0xffeb('0x11')]=_0x3d7450['id'];}utils[_0xffeb('0x12')](_0xffeb('0x13'),_0x56b980);});}else{utils[_0xffeb('0x12')](_0xffeb('0x13'),_0x56b980);}if(channels[_0x56b980[_0xffeb('0x9')]]){delete channels[_0x56b980['uniqueid']];}}exports[_0xffeb('0x14')]=function(_0x4663ad){try{utils[_0xffeb('0x15')](util[_0xffeb('0x7')](_0xffeb('0x16'),_0x4663ad['uniqueid']),_0x4663ad);if(_0x4663ad[_0xffeb('0x9')]==_0x4663ad[_0xffeb('0x17')]&&_0x4663ad[_0xffeb('0xa')]!=_0xffeb('0x18')){utils['info'](util['format'](_0xffeb('0x19'),_0x4663ad[_0xffeb('0x9')],_0x4663ad[_0xffeb('0x1a')],_0x4663ad[_0xffeb('0x1b')]));channels[_0x4663ad['uniqueid']]={'uniqueid':_0x4663ad[_0xffeb('0x9')],'accountcode':_0x4663ad[_0xffeb('0x10')],'source':_0x4663ad['calleridnum'],'destination':_0x4663ad[_0xffeb('0x1b')],'destinationcontext':_0x4663ad[_0xffeb('0x1a')],'channel':_0x4663ad[_0xffeb('0xa')],'starttime':utils[_0xffeb('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xffeb('0x2'),'amaflags':_0xffeb('0x1d')};}}catch(_0x415425){utils['error'](util[_0xffeb('0x7')](_0xffeb('0x16'),_0x4663ad[_0xffeb('0x9')]),_0x415425);}};exports['newstate']=function(_0x3835e4){try{utils['debug'](util['format']('[%s][calls][newstate]',_0x3835e4[_0xffeb('0x9')]),_0x3835e4);if(!_[_0xffeb('0x1e')](channels[_0x3835e4[_0xffeb('0x9')]])&&_0x3835e4[_0xffeb('0x1f')]==0x6){utils[_0xffeb('0x6')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x3835e4[_0xffeb('0x9')],_0x3835e4[_0xffeb('0x1a')],_0x3835e4['channel']));if(_[_0xffeb('0x1e')](channels[_0x3835e4[_0xffeb('0x9')]][_0xffeb('0x20')])){channels[_0x3835e4[_0xffeb('0x9')]]['systemanswertime']=utils[_0xffeb('0x1c')]();}}else if(!_[_0xffeb('0x1e')](channels[_0x3835e4[_0xffeb('0x17')]])&&_0x3835e4[_0xffeb('0x1f')]==0x6&&_0x3835e4[_0xffeb('0x1a')]!='transfer'){utils[_0xffeb('0x6')](util[_0xffeb('0x7')](_0xffeb('0x21'),_0x3835e4[_0xffeb('0x9')],_0x3835e4[_0xffeb('0x17')],_0x3835e4[_0xffeb('0x1a')],_0x3835e4['channel']));channels[_0x3835e4[_0xffeb('0x17')]]['accountcode']=_0x3835e4[_0xffeb('0x10')];channels[_0x3835e4['linkedid']][_0xffeb('0x22')]=_0x3835e4['channel'];if(_[_0xffeb('0x1e')](channels[_0x3835e4['linkedid']][_0xffeb('0x23')])){channels[_0x3835e4['linkedid']]['answertime']=utils[_0xffeb('0x1c')]();}channels[_0x3835e4[_0xffeb('0x17')]][_0xffeb('0x24')]=dispositions[_[_0xffeb('0x25')](_0x3835e4[_0xffeb('0x1f')])]||'ANSWERED';}}catch(_0x5702c0){utils[_0xffeb('0x26')](util['format'](_0xffeb('0x27'),_0x3835e4[_0xffeb('0x9')]),_0x5702c0);}};exports[_0xffeb('0x28')]=function(_0x127453){try{if(!_[_0xffeb('0x1e')](channels[_0x127453[_0xffeb('0x9')]])){utils[_0xffeb('0x15')](util[_0xffeb('0x7')](_0xffeb('0x29'),_0x127453[_0xffeb('0x9')]),_0x127453);if(_['isNil'](channels[_0x127453['uniqueid']][_0xffeb('0x2a')])){channels[_0x127453['uniqueid']]['callerid']=_0x127453[_0xffeb('0x2b')]+'\x20<'+_0x127453[_0xffeb('0x2c')]+'>';}utils['info'](util[_0xffeb('0x7')](_0xffeb('0x2d'),_0x127453['uniqueid'],channels[_0x127453['uniqueid']][_0xffeb('0x2a')],_0x127453[_0xffeb('0x2e')]));channels[_0x127453['uniqueid']][_0xffeb('0x2f')]=utils[_0xffeb('0x1c')]();channels[_0x127453[_0xffeb('0x9')]][_0xffeb('0x30')]=utils['diffTime'](channels[_0x127453['uniqueid']]['endtime'],channels[_0x127453[_0xffeb('0x9')]][_0xffeb('0x31')]);channels[_0x127453[_0xffeb('0x9')]][_0xffeb('0x32')]=channels[_0x127453[_0xffeb('0x9')]][_0xffeb('0x23')]?utils['diffTime'](channels[_0x127453['uniqueid']]['endtime'],channels[_0x127453[_0xffeb('0x9')]][_0xffeb('0x23')]):0x0;writeDB(channels[_0x127453[_0xffeb('0x9')]]);}}catch(_0x18f7c9){utils[_0xffeb('0x26')](util[_0xffeb('0x7')]('[%s][calls][hangup]',_0x127453['uniqueid']),_0x18f7c9);}};exports['attendedtransfer']=function(_0x316bd6){try{if(!_[_0xffeb('0x1e')](channels[_0x316bd6[_0xffeb('0x33')]])){utils[_0xffeb('0x15')](util[_0xffeb('0x7')](_0xffeb('0x34'),_0x316bd6['origtransfereruniqueid']),_0x316bd6);if(channels[_0x316bd6[_0xffeb('0x33')]][_0xffeb('0xa')]==_0x316bd6[_0xffeb('0x35')]){utils[_0xffeb('0x6')](util[_0xffeb('0x7')](_0xffeb('0x36'),_0x316bd6[_0xffeb('0x37')],_0x316bd6[_0xffeb('0x33')],_0x316bd6[_0xffeb('0x38')]));channels[_0x316bd6[_0xffeb('0x33')]][_0xffeb('0x22')]=_0x316bd6['secondtransfererchannel'];channels[_0x316bd6['localtwolinkedid']][_0xffeb('0x39')]=_0xffeb('0x3a');}else if(channels[_0x316bd6['localtwolinkedid']][_0xffeb('0xa')]=_0x316bd6[_0xffeb('0x3b')]){utils['info'](util[_0xffeb('0x7')](_0xffeb('0x36'),_0x316bd6['origtransfereruniqueid'],_0x316bd6['localtwolinkedid'],_0x316bd6[_0xffeb('0x3c')]));channels[_0x316bd6['localtwolinkedid']]['destinationchannel']=_0x316bd6['origtransfererchannel'];channels[_0x316bd6[_0xffeb('0x33')]][_0xffeb('0x39')]=_0xffeb('0x3a');}}}catch(_0xb9b50b){utils['error'](util['format']('[%s][calls][attendedtransfer]',_0x316bd6[_0xffeb('0x37')]),_0xb9b50b);}};exports[_0xffeb('0x3d')]=function(_0x1b7013){try{if(!_[_0xffeb('0x1e')](channels[_0x1b7013[_0xffeb('0x9')]])){utils[_0xffeb('0x15')](util[_0xffeb('0x7')]('[%s][calls][musiconholdstart]',_0x1b7013[_0xffeb('0x9')]),_0x1b7013);channels[_0x1b7013[_0xffeb('0x9')]][_0xffeb('0x3e')]=utils[_0xffeb('0x1c')]();utils[_0xffeb('0x6')](util[_0xffeb('0x7')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x1b7013[_0xffeb('0x9')],channels[_0x1b7013[_0xffeb('0x9')]][_0xffeb('0x3e')]));}}catch(_0x4342b9){utils[_0xffeb('0x26')](util[_0xffeb('0x7')]('[%s][calls][musiconholdstart]',_0x1b7013[_0xffeb('0x9')]),_0x4342b9);}};exports['musiconholdstop']=function(_0x502b0b){try{if(!_[_0xffeb('0x1e')](channels[_0x502b0b[_0xffeb('0x9')]])){utils[_0xffeb('0x15')](util[_0xffeb('0x7')]('[%s][calls][musiconholdstop]',_0x502b0b[_0xffeb('0x9')]),_0x502b0b);if(!_['isNil'](channels[_0x502b0b[_0xffeb('0x9')]][_0xffeb('0x3e')])){channels[_0x502b0b[_0xffeb('0x9')]][_0xffeb('0x3f')]+=utils[_0xffeb('0x40')](utils[_0xffeb('0x1c')](),channels[_0x502b0b[_0xffeb('0x9')]][_0xffeb('0x3e')]);utils[_0xffeb('0x6')](util[_0xffeb('0x7')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x502b0b['uniqueid'],channels[_0x502b0b['uniqueid']][_0xffeb('0x3f')]));delete channels[_0x502b0b[_0xffeb('0x9')]]['musiconholdstartAt'];}}}catch(_0xfaec){utils[_0xffeb('0x26')](util['format'](_0xffeb('0x41'),_0x502b0b[_0xffeb('0x9')]),_0xfaec);}};exports[_0xffeb('0x42')]=function(_0x50955d){try{if(!_[_0xffeb('0x1e')](channels[_0x50955d['uniqueid']])){utils[_0xffeb('0x15')](util[_0xffeb('0x7')](_0xffeb('0x43'),_0x50955d[_0xffeb('0x9')]),_0x50955d);if(!_['isNil'](_0x50955d[_0xffeb('0x44')]['xmd-originatecalleridnum'])){utils[_0xffeb('0x6')](util[_0xffeb('0x7')](_0xffeb('0x45'),_0x50955d[_0xffeb('0x9')],_0x50955d[_0xffeb('0x46')]));channels[_0x50955d['uniqueid']][_0xffeb('0x47')]=_0x50955d[_0xffeb('0x46')];}if(!_['isNil'](_0x50955d[_0xffeb('0x44')][_0xffeb('0x48')])){utils['info'](util[_0xffeb('0x7')](_0xffeb('0x49'),_0x50955d[_0xffeb('0x9')],_0x50955d['value']));channels[_0x50955d[_0xffeb('0x9')]]['destination']=_0x50955d['value'];channels[_0x50955d[_0xffeb('0x9')]][_0xffeb('0x2a')]='\x22'+_0x50955d[_0xffeb('0x46')]+'\x22\x20<'+_0x50955d[_0xffeb('0x46')]+'>';}if(!_[_0xffeb('0x1e')](_0x50955d[_0xffeb('0x44')][_0xffeb('0x4a')])||!_[_0xffeb('0x1e')](_0x50955d[_0xffeb('0x44')]['xmd-callerid'])){utils[_0xffeb('0x6')](util[_0xffeb('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x50955d[_0xffeb('0x9')],!_[_0xffeb('0x1e')](_0x50955d[_0xffeb('0x44')][_0xffeb('0x4a')])?_0xffeb('0x4a'):_0xffeb('0x4b'),_0x50955d[_0xffeb('0x46')]));channels[_0x50955d[_0xffeb('0x9')]][_0xffeb('0x2a')]=_0x50955d[_0xffeb('0x46')];}if(!_['isNil'](_0x50955d[_0xffeb('0x44')][_0xffeb('0x4c')])||!_['isNil'](_0x50955d[_0xffeb('0x44')][_0xffeb('0x4d')])){utils['info'](util[_0xffeb('0x7')](_0xffeb('0x4e'),_0x50955d[_0xffeb('0x9')],!_['isNil'](_0x50955d[_0xffeb('0x44')][_0xffeb('0x4c')])?_0xffeb('0x4c'):_0xffeb('0x4d'),_0x50955d[_0xffeb('0x46')]));channels[_0x50955d['uniqueid']]['lastapplication']='Queue';channels[_0x50955d['uniqueid']][_0xffeb('0x4f')]=_0x50955d[_0xffeb('0x46')];channels[_0x50955d[_0xffeb('0x9')]]['queue']=!![];}if(!_[_0xffeb('0x1e')](_0x50955d['variable'][_0xffeb('0x50')])){utils['info'](util[_0xffeb('0x7')](_0xffeb('0x51'),_0x50955d[_0xffeb('0x9')],_0x50955d[_0xffeb('0x46')]));channels[_0x50955d[_0xffeb('0x9')]][_0xffeb('0x52')]=_0x50955d[_0xffeb('0x46')];}if(!_[_0xffeb('0x1e')](_0x50955d[_0xffeb('0x44')]['xmd-cdrtype'])){utils[_0xffeb('0x6')](util['format'](_0xffeb('0x53'),_0x50955d[_0xffeb('0x9')],_0x50955d[_0xffeb('0x46')]));channels[_0x50955d[_0xffeb('0x9')]]['type']=_0x50955d[_0xffeb('0x46')];}if(!_[_0xffeb('0x1e')](_0x50955d[_0xffeb('0x44')][_0xffeb('0x54')])){utils['info'](util[_0xffeb('0x7')](_0xffeb('0x55'),_0x50955d[_0xffeb('0x9')],_0x50955d[_0xffeb('0x46')]));channels[_0x50955d[_0xffeb('0x9')]][_0xffeb('0x56')]=_0x50955d[_0xffeb('0x46')];}if(!_['isNil'](_0x50955d['variable']['sipcallid'])){utils['info'](util[_0xffeb('0x7')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x50955d[_0xffeb('0x9')],_0x50955d[_0xffeb('0x46')]));channels[_0x50955d['uniqueid']]['sipcallid']=_0x50955d[_0xffeb('0x46')];}}}catch(_0x47e7d8){utils[_0xffeb('0x26')](util[_0xffeb('0x7')](_0xffeb('0x43'),_0x50955d[_0xffeb('0x9')]),_0x47e7d8);}};exports[_0xffeb('0x57')]=function(_0x2aa3ff){try{if(!_[_0xffeb('0x1e')](channels[_0x2aa3ff[_0xffeb('0x9')]])){utils[_0xffeb('0x15')](util[_0xffeb('0x7')](_0xffeb('0x58'),_0x2aa3ff[_0xffeb('0x9')]),_0x2aa3ff);utils[_0xffeb('0x6')](util[_0xffeb('0x7')](_0xffeb('0x59'),_0x2aa3ff[_0xffeb('0x9')],_0x2aa3ff[_0xffeb('0x5a')],_0x2aa3ff['appdata']));if(_0x2aa3ff['application'][_0xffeb('0x5b')]()=='set'&&_['startsWith'](_0x2aa3ff[_0xffeb('0x5c')][_0xffeb('0x5b')](),_0xffeb('0x5d'))){var _0x6a1447=_0x2aa3ff[_0xffeb('0x5c')][_0xffeb('0x5e')]('=');var _0x2b007c=_0x6a1447[0x0][_0xffeb('0x5f')](_0x6a1447[0x0]['lastIndexOf']('(')+0x1,_0x6a1447[0x0]['lastIndexOf'](')'));var _0x5ea69c=_0x6a1447[0x1];channels[_0x2aa3ff['uniqueid']][_0x2b007c]=_0x5ea69c;}if(!_['includes']([_0xffeb('0x28'),_0xffeb('0x60'),'execif',_0xffeb('0x61'),'gotoif'],_0x2aa3ff[_0xffeb('0x5a')][_0xffeb('0x5b')]())){channels[_0x2aa3ff[_0xffeb('0x9')]][_0xffeb('0x62')]=_0x2aa3ff[_0xffeb('0x5a')];channels[_0x2aa3ff['uniqueid']][_0xffeb('0x4f')]=_0x2aa3ff[_0xffeb('0x5c')];}}}catch(_0x272378){utils['error'](util[_0xffeb('0x7')](_0xffeb('0x58'),_0x2aa3ff[_0xffeb('0x9')]),_0x272378);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index ea9bc1f..a031dee 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 _0x5938=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected'];(function(_0x1e6f6a,_0x206956){var _0xd3e41d=function(_0x9a8d14){while(--_0x9a8d14){_0x1e6f6a['push'](_0x1e6f6a['shift']());}};_0xd3e41d(++_0x206956);}(_0x5938,0x18d));var _0x8593=function(_0x3da148,_0x549dda){_0x3da148=_0x3da148-0x0;var _0x3c37cf=_0x5938[_0x3da148];return _0x3c37cf;};'use strict';var utils=require(_0x8593('0x0'));exports['connect']=function(){utils[_0x8593('0x1')](_0x8593('0x2'));};exports['shutdown']=function(){utils[_0x8593('0x1')]('[core]\x20shutdown');};exports[_0x8593('0x3')]=function(){utils[_0x8593('0x1')](_0x8593('0x4'));};exports[_0x8593('0x5')]=function(_0xa81945){utils['error'](_0x8593('0x6'),_0xa81945);};exports[_0x8593('0x7')]=function(){utils['info'](_0x8593('0x8'));};exports[_0x8593('0x9')]=function(_0x4c9772){}; \ No newline at end of file +var _0xa174=['fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x583e17,_0x101a27){var _0x25e100=function(_0x562715){while(--_0x562715){_0x583e17['push'](_0x583e17['shift']());}};_0x25e100(++_0x101a27);}(_0xa174,0x145));var _0x4a17=function(_0x509919,_0x163c28){_0x509919=_0x509919-0x0;var _0x36c6b8=_0xa174[_0x509919];return _0x36c6b8;};'use strict';var utils=require(_0x4a17('0x0'));exports['connect']=function(){utils[_0x4a17('0x1')](_0x4a17('0x2'));};exports[_0x4a17('0x3')]=function(){utils[_0x4a17('0x1')](_0x4a17('0x4'));};exports[_0x4a17('0x5')]=function(){utils[_0x4a17('0x1')]('[core]\x20fullybooted');};exports[_0x4a17('0x6')]=function(_0x2e509a){utils[_0x4a17('0x6')](_0x4a17('0x7'),_0x2e509a);};exports[_0x4a17('0x8')]=function(){utils[_0x4a17('0x1')](_0x4a17('0x9'));};exports[_0x4a17('0xa')]=function(_0x1c3d6e){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index b10ec47..1aaa171 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 _0xe60a=['channel','calleridnum','connectedlinenum','dialstatus','request','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','split','error','[%s][dials][newexten]','varset','debug','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s'];(function(_0x3eeccc,_0x257200){var _0x73d5e5=function(_0x1d9503){while(--_0x1d9503){_0x3eeccc['push'](_0x3eeccc['shift']());}};_0x73d5e5(++_0x257200);}(_0xe60a,0x8e));var _0xae60=function(_0x5b734b,_0x4553b2){_0x5b734b=_0x5b734b-0x0;var _0x3f88f1=_0xe60a[_0x5b734b];return _0x3f88f1;};'use strict';var _=require('lodash');var util=require(_0xae60('0x0'));var utils=require(_0xae60('0x1'));var dials={};function writeDB(_0x4c6a7f){utils[_0xae60('0x2')](util[_0xae60('0x3')](_0xae60('0x4'),_0x4c6a7f['uniqueid'],_0x4c6a7f[_0xae60('0x5')],_0x4c6a7f['dialstring'],_0x4c6a7f[_0xae60('0x6')],_0x4c6a7f[_0xae60('0x7')],_0x4c6a7f[_0xae60('0x8')]));utils[_0xae60('0x9')]('CreateVoiceDialReport',_0x4c6a7f);delete dials[_0x4c6a7f[_0xae60('0xa')]];}exports['newexten']=function(_0x261ebb){try{utils['debug'](util[_0xae60('0x3')]('[%s][dials][newexten]',_0x261ebb['uniqueid']),_0x261ebb);utils[_0xae60('0x2')](util[_0xae60('0x3')](_0xae60('0xb'),_0x261ebb[_0xae60('0xa')],_0x261ebb[_0xae60('0xc')],_0x261ebb[_0xae60('0xd')]));if(_0x261ebb[_0xae60('0xc')][_0xae60('0xe')]()==_0xae60('0xf')&&_['startsWith'](_0x261ebb[_0xae60('0xd')][_0xae60('0xe')](),_0xae60('0x10'))){var _0x4ca4e7=_0x261ebb['appdata'][_0xae60('0x11')]('=');dials[_0x261ebb[_0xae60('0xa')]]={'routeId':_0x4ca4e7[0x1]};}}catch(_0x397a21){utils[_0xae60('0x12')](util[_0xae60('0x3')](_0xae60('0x13'),_0x261ebb[_0xae60('0xa')]),_0x397a21);}};exports[_0xae60('0x14')]=function(_0x151d50){try{utils[_0xae60('0x15')](util[_0xae60('0x3')](_0xae60('0x16'),_0x151d50['uniqueid']),_0x151d50);if(!_['isNil'](_0x151d50[_0xae60('0x17')][_0xae60('0x18')])){utils[_0xae60('0x2')](util['format'](_0xae60('0x19'),_0x151d50['uniqueid'],_0x151d50[_0xae60('0x1a')]));dials[_0x151d50[_0xae60('0xa')]]={'routeId':_0x151d50[_0xae60('0x1a')]};}}catch(_0x2389b1){utils[_0xae60('0x12')](util[_0xae60('0x3')]('[%s][dials][varset]',_0x151d50[_0xae60('0xa')]),_0x2389b1);}};exports['dialbegin']=function(_0x256d32){try{if(!_[_0xae60('0x1b')](dials[_0x256d32[_0xae60('0xa')]])){utils['debug'](util['format'](_0xae60('0x1c'),_0x256d32[_0xae60('0xa')]),_0x256d32);dials[_0x256d32['uniqueid']]=_[_0xae60('0x1d')](dials[_0x256d32[_0xae60('0xa')]],_0x256d32);dials[_0x256d32[_0xae60('0xa')]][_0xae60('0x1e')]=utils[_0xae60('0x1f')]();dials[_0x256d32[_0xae60('0xa')]][_0xae60('0x20')]='called';utils[_0xae60('0x2')](util[_0xae60('0x3')](_0xae60('0x21'),_0x256d32[_0xae60('0xa')],dials[_0x256d32[_0xae60('0xa')]][_0xae60('0x1e')]));}}catch(_0x40dd3d){utils[_0xae60('0x12')](util[_0xae60('0x3')](_0xae60('0x1c'),_0x256d32[_0xae60('0xa')]),_0x40dd3d);}};exports['dialend']=function(_0xbd99ca){try{if(!_[_0xae60('0x1b')](dials[_0xbd99ca[_0xae60('0xa')]])){utils[_0xae60('0x15')](util[_0xae60('0x3')](_0xae60('0x22'),_0xbd99ca[_0xae60('0xa')]),_0xbd99ca);dials[_0xbd99ca[_0xae60('0xa')]][_0xae60('0x8')]=_0xbd99ca[_0xae60('0x8')];if(_0xbd99ca[_0xae60('0x8')]==_0xae60('0x23')){dials[_0xbd99ca[_0xae60('0xa')]]=_[_0xae60('0x1d')](dials[_0xbd99ca['uniqueid']],_0xbd99ca);dials[_0xbd99ca[_0xae60('0xa')]][_0xae60('0x24')]=utils[_0xae60('0x1f')]();dials[_0xbd99ca[_0xae60('0xa')]][_0xae60('0x20')]=_0xae60('0x25');utils[_0xae60('0x2')](util['format'](_0xae60('0x26'),_0xbd99ca[_0xae60('0xa')],_0xbd99ca[_0xae60('0x8')],dials[_0xbd99ca[_0xae60('0xa')]][_0xae60('0x24')]));}else{utils['info'](util[_0xae60('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0xbd99ca[_0xae60('0xa')],_0xbd99ca[_0xae60('0x8')]));}}}catch(_0x4c6113){utils[_0xae60('0x12')](util[_0xae60('0x3')](_0xae60('0x22'),_0xbd99ca[_0xae60('0xa')]),_0x4c6113);}};exports[_0xae60('0x27')]=function(_0x93ea46){try{if(!_[_0xae60('0x1b')](dials[_0x93ea46[_0xae60('0xa')]])){utils[_0xae60('0x15')](util['format'](_0xae60('0x28'),_0x93ea46[_0xae60('0xa')]),_0x93ea46);utils['info'](util[_0xae60('0x3')](_0xae60('0x29'),_0x93ea46[_0xae60('0xa')],_0x93ea46[_0xae60('0x6')],_0x93ea46[_0xae60('0x2a')],_0x93ea46[_0xae60('0x2b')]));dials[_0x93ea46[_0xae60('0xa')]]=_['assign'](dials[_0x93ea46['uniqueid']],{'endtime':utils[_0xae60('0x1f')](),'lastevent':_0xae60('0x2c')});dials[_0x93ea46[_0xae60('0xa')]][_0xae60('0x2d')]=utils[_0xae60('0x2e')](dials[_0x93ea46[_0xae60('0xa')]][_0xae60('0x2f')],dials[_0x93ea46[_0xae60('0xa')]][_0xae60('0x1e')]);dials[_0x93ea46[_0xae60('0xa')]]['holdtime']=utils['diffTime'](dials[_0x93ea46[_0xae60('0xa')]][_0xae60('0x24')]||dials[_0x93ea46['uniqueid']][_0xae60('0x2f')],dials[_0x93ea46[_0xae60('0xa')]]['starttime']);dials[_0x93ea46[_0xae60('0xa')]][_0xae60('0x30')]=dials[_0x93ea46[_0xae60('0xa')]][_0xae60('0x24')]?utils[_0xae60('0x2e')](dials[_0x93ea46[_0xae60('0xa')]]['endtime'],dials[_0x93ea46[_0xae60('0xa')]][_0xae60('0x24')]):0x0;writeDB(dials[_0x93ea46[_0xae60('0xa')]]);}}catch(_0x4c9e94){utils['error'](util[_0xae60('0x3')](_0xae60('0x28'),_0x93ea46[_0xae60('0xa')]),_0x4c9e94);}}; \ No newline at end of file +var _0xeed6=['lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','diffTime','holdtime','endtime','billableseconds','[%s][dials][hangup]','lodash','util','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','info','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now'];(function(_0x16e2c4,_0x259972){var _0x2cbb02=function(_0x3dfa5f){while(--_0x3dfa5f){_0x16e2c4['push'](_0x16e2c4['shift']());}};_0x2cbb02(++_0x259972);}(_0xeed6,0x7b));var _0x6eed=function(_0x525284,_0x525c3e){_0x525284=_0x525284-0x0;var _0x1fbcd6=_0xeed6[_0x525284];return _0x1fbcd6;};'use strict';var _=require(_0x6eed('0x0'));var util=require(_0x6eed('0x1'));var utils=require(_0x6eed('0x2'));var dials={};function writeDB(_0x324a62){utils['info'](util['format'](_0x6eed('0x3'),_0x324a62['uniqueid'],_0x324a62[_0x6eed('0x4')],_0x324a62[_0x6eed('0x5')],_0x324a62[_0x6eed('0x6')],_0x324a62[_0x6eed('0x7')],_0x324a62['dialstatus']));utils[_0x6eed('0x8')](_0x6eed('0x9'),_0x324a62);delete dials[_0x324a62['uniqueid']];}exports[_0x6eed('0xa')]=function(_0x1469ff){try{utils[_0x6eed('0xb')](util[_0x6eed('0xc')](_0x6eed('0xd'),_0x1469ff[_0x6eed('0xe')]),_0x1469ff);utils['info'](util[_0x6eed('0xc')](_0x6eed('0xf'),_0x1469ff[_0x6eed('0xe')],_0x1469ff[_0x6eed('0x10')],_0x1469ff[_0x6eed('0x11')]));if(_0x1469ff[_0x6eed('0x10')][_0x6eed('0x12')]()=='set'&&_[_0x6eed('0x13')](_0x1469ff[_0x6eed('0x11')][_0x6eed('0x12')](),_0x6eed('0x14'))){var _0x92089e=_0x1469ff[_0x6eed('0x11')][_0x6eed('0x15')]('=');dials[_0x1469ff[_0x6eed('0xe')]]={'routeId':_0x92089e[0x1]};}}catch(_0x690488){utils[_0x6eed('0x16')](util[_0x6eed('0xc')]('[%s][dials][newexten]',_0x1469ff['uniqueid']),_0x690488);}};exports[_0x6eed('0x17')]=function(_0x269fa8){try{utils[_0x6eed('0xb')](util['format'](_0x6eed('0x18'),_0x269fa8[_0x6eed('0xe')]),_0x269fa8);if(!_[_0x6eed('0x19')](_0x269fa8[_0x6eed('0x1a')][_0x6eed('0x1b')])){utils[_0x6eed('0x1c')](util[_0x6eed('0xc')](_0x6eed('0x1d'),_0x269fa8['uniqueid'],_0x269fa8[_0x6eed('0x1e')]));dials[_0x269fa8['uniqueid']]={'routeId':_0x269fa8['value']};}}catch(_0x2fc959){utils[_0x6eed('0x16')](util[_0x6eed('0xc')]('[%s][dials][varset]',_0x269fa8['uniqueid']),_0x2fc959);}};exports[_0x6eed('0x1f')]=function(_0x2f08fb){try{if(!_[_0x6eed('0x19')](dials[_0x2f08fb[_0x6eed('0xe')]])){utils[_0x6eed('0xb')](util['format'](_0x6eed('0x20'),_0x2f08fb[_0x6eed('0xe')]),_0x2f08fb);dials[_0x2f08fb['uniqueid']]=_[_0x6eed('0x21')](dials[_0x2f08fb['uniqueid']],_0x2f08fb);dials[_0x2f08fb[_0x6eed('0xe')]][_0x6eed('0x22')]=utils[_0x6eed('0x23')]();dials[_0x2f08fb[_0x6eed('0xe')]][_0x6eed('0x24')]=_0x6eed('0x25');utils['info'](util[_0x6eed('0xc')](_0x6eed('0x26'),_0x2f08fb[_0x6eed('0xe')],dials[_0x2f08fb['uniqueid']][_0x6eed('0x22')]));}}catch(_0x4ee365){utils[_0x6eed('0x16')](util[_0x6eed('0xc')](_0x6eed('0x20'),_0x2f08fb[_0x6eed('0xe')]),_0x4ee365);}};exports[_0x6eed('0x27')]=function(_0x1ff524){try{if(!_['isNil'](dials[_0x1ff524['uniqueid']])){utils[_0x6eed('0xb')](util[_0x6eed('0xc')]('[%s][dials][dialend]',_0x1ff524[_0x6eed('0xe')]),_0x1ff524);dials[_0x1ff524[_0x6eed('0xe')]][_0x6eed('0x28')]=_0x1ff524[_0x6eed('0x28')];if(_0x1ff524['dialstatus']==_0x6eed('0x29')){dials[_0x1ff524[_0x6eed('0xe')]]=_[_0x6eed('0x21')](dials[_0x1ff524[_0x6eed('0xe')]],_0x1ff524);dials[_0x1ff524[_0x6eed('0xe')]][_0x6eed('0x2a')]=utils['now']();dials[_0x1ff524[_0x6eed('0xe')]][_0x6eed('0x24')]=_0x6eed('0x2b');utils[_0x6eed('0x1c')](util['format']('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x1ff524[_0x6eed('0xe')],_0x1ff524[_0x6eed('0x28')],dials[_0x1ff524['uniqueid']][_0x6eed('0x2a')]));}else{utils[_0x6eed('0x1c')](util[_0x6eed('0xc')](_0x6eed('0x2c'),_0x1ff524['uniqueid'],_0x1ff524[_0x6eed('0x28')]));}}}catch(_0x532e20){utils[_0x6eed('0x16')](util['format'](_0x6eed('0x2d'),_0x1ff524['uniqueid']),_0x532e20);}};exports['hangup']=function(_0x5c8669){try{if(!_[_0x6eed('0x19')](dials[_0x5c8669[_0x6eed('0xe')]])){utils[_0x6eed('0xb')](util[_0x6eed('0xc')]('[%s][dials][hangup]',_0x5c8669[_0x6eed('0xe')]),_0x5c8669);utils[_0x6eed('0x1c')](util['format'](_0x6eed('0x2e'),_0x5c8669['uniqueid'],_0x5c8669[_0x6eed('0x6')],_0x5c8669['calleridname'],_0x5c8669[_0x6eed('0x2f')]));dials[_0x5c8669[_0x6eed('0xe')]]=_[_0x6eed('0x21')](dials[_0x5c8669[_0x6eed('0xe')]],{'endtime':utils[_0x6eed('0x23')](),'lastevent':'complete'});dials[_0x5c8669[_0x6eed('0xe')]]['duration']=utils[_0x6eed('0x30')](dials[_0x5c8669[_0x6eed('0xe')]]['endtime'],dials[_0x5c8669[_0x6eed('0xe')]]['starttime']);dials[_0x5c8669[_0x6eed('0xe')]][_0x6eed('0x31')]=utils[_0x6eed('0x30')](dials[_0x5c8669[_0x6eed('0xe')]][_0x6eed('0x2a')]||dials[_0x5c8669['uniqueid']][_0x6eed('0x32')],dials[_0x5c8669[_0x6eed('0xe')]][_0x6eed('0x22')]);dials[_0x5c8669['uniqueid']][_0x6eed('0x33')]=dials[_0x5c8669[_0x6eed('0xe')]]['answertime']?utils[_0x6eed('0x30')](dials[_0x5c8669[_0x6eed('0xe')]][_0x6eed('0x32')],dials[_0x5c8669[_0x6eed('0xe')]][_0x6eed('0x2a')]):0x0;writeDB(dials[_0x5c8669[_0x6eed('0xe')]]);}}catch(_0x33553d){utils[_0x6eed('0x16')](util[_0x6eed('0xc')](_0x6eed('0x34'),_0x5c8669[_0x6eed('0xe')]),_0x33553d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 922667b..2da7a1e 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 _0x4d2a=['./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','uniqueid','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s][index][dialend]','asterisk-manager','../../config/environment','asterisk','port','password','keepConnected','xdr','disabled','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller'];(function(_0x39db49,_0x5a1bfd){var _0x345c13=function(_0x42c8fe){while(--_0x42c8fe){_0x39db49['push'](_0x39db49['shift']());}};_0x345c13(++_0x5a1bfd);}(_0x4d2a,0x165));var _0xa4d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d2a[_0x3dd15e];return _0x231fd0;};var AsteriskManager=require(_0xa4d2('0x0'));var config=require(_0xa4d2('0x1'));var utils=require('./utils');var util=require('util');var ami=new AsteriskManager(config[_0xa4d2('0x2')][_0xa4d2('0x3')],config['asterisk']['ip'],config[_0xa4d2('0x2')]['username'],config[_0xa4d2('0x2')][_0xa4d2('0x4')],!![]);ami[_0xa4d2('0x5')]();if(config[_0xa4d2('0x6')]&&config[_0xa4d2('0x6')][_0xa4d2('0x7')]){utils['info'](_0xa4d2('0x8'));}else{var agents=require(_0xa4d2('0x9'));var calls=require('./calls.controller');var queues=require(_0xa4d2('0xa'));var recordings=require(_0xa4d2('0xb'));var members=require(_0xa4d2('0xc'));var dials=require(_0xa4d2('0xd'));var transfers=require(_0xa4d2('0xe'));var core=require(_0xa4d2('0xf'));ami['on']('connect',core['connect']);ami['on'](_0xa4d2('0x10'),core[_0xa4d2('0x10')]);ami['on'](_0xa4d2('0x11'),core['fullybooted']);ami['on'](_0xa4d2('0x12'),core[_0xa4d2('0x12')]);ami['on'](_0xa4d2('0x13'),core[_0xa4d2('0x13')]);ami['on'](_0xa4d2('0x14'),core[_0xa4d2('0x14')]);ami['on'](_0xa4d2('0x15'),function(_0x3650c7){try{utils[_0xa4d2('0x16')](util['format'](_0xa4d2('0x17'),_0x3650c7[_0xa4d2('0x18')]),_0x3650c7);members[_0xa4d2('0x15')](_0x3650c7);}catch(_0x907717){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x17'),_0x3650c7['device']),_0x907717);}});ami['on'](_0xa4d2('0x1a'),function(_0x1c8e57){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')]('[%s][index][agentcalled]',_0x1c8e57[_0xa4d2('0x1b')]),_0x1c8e57);agents[_0xa4d2('0x1a')](_0x1c8e57);}catch(_0xdc6f68){utils[_0xa4d2('0x12')](util['format'](_0xa4d2('0x1c'),_0x1c8e57[_0xa4d2('0x1b')]),_0xdc6f68);}});ami['on']('agentringnoanswer',function(_0x424858){try{utils['debug'](util[_0xa4d2('0x19')](_0xa4d2('0x1d'),_0x424858[_0xa4d2('0x1b')]),_0x424858);agents['agentringnoanswer'](_0x424858);}catch(_0x12d240){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x1d'),_0x424858[_0xa4d2('0x1b')]),_0x12d240);}});ami['on'](_0xa4d2('0x1e'),function(_0x428e31){try{utils[_0xa4d2('0x16')](util['format'](_0xa4d2('0x1f'),_0x428e31[_0xa4d2('0x1b')]),_0x428e31);agents[_0xa4d2('0x1e')](_0x428e31);queues[_0xa4d2('0x1e')](_0x428e31);}catch(_0x5547e0){utils[_0xa4d2('0x12')](util['format'](_0xa4d2('0x1f'),_0x428e31[_0xa4d2('0x1b')]),_0x5547e0);}});ami['on'](_0xa4d2('0x20'),function(_0x270d17){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x21'),_0x270d17['uniqueid']),_0x270d17);agents[_0xa4d2('0x20')](_0x270d17);queues[_0xa4d2('0x20')](_0x270d17);members[_0xa4d2('0x20')](_0x270d17);}catch(_0x26ac98){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x21'),_0x270d17[_0xa4d2('0x1b')]),_0x26ac98);}});ami['on'](_0xa4d2('0x22'),function(_0x7a1900){try{utils[_0xa4d2('0x16')](util['format']('[%s][index][queuecallerabandon]',_0x7a1900[_0xa4d2('0x1b')]),_0x7a1900);agents[_0xa4d2('0x22')](_0x7a1900);queues[_0xa4d2('0x22')](_0x7a1900);}catch(_0x20e1bb){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')]('[%s][index][queuecallerabandon]',_0x7a1900[_0xa4d2('0x1b')]),_0x20e1bb);}});ami['on'](_0xa4d2('0x23'),function(_0x50bc0c){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x24'),_0x50bc0c[_0xa4d2('0x1b')]),_0x50bc0c);queues[_0xa4d2('0x23')](_0x50bc0c);recordings[_0xa4d2('0x23')](_0x50bc0c);}catch(_0x4e259f){utils['error'](util['format'](_0xa4d2('0x24'),_0x50bc0c[_0xa4d2('0x1b')]),_0x4e259f);}});ami['on'](_0xa4d2('0x25'),function(_0x56563a){try{utils['debug'](util['format']('[%s][index][queuecallerleave]',_0x56563a[_0xa4d2('0x1b')]),_0x56563a);queues[_0xa4d2('0x25')](_0x56563a);}catch(_0x1ccb16){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')]('[%s][index][queuecallerleave]',_0x56563a[_0xa4d2('0x1b')]),_0x1ccb16);}});ami['on'](_0xa4d2('0x26'),function(_0x312dfe){try{utils[_0xa4d2('0x16')](util['format'](_0xa4d2('0x27'),_0x312dfe[_0xa4d2('0x1b')]),_0x312dfe);queues[_0xa4d2('0x26')](_0x312dfe);calls[_0xa4d2('0x26')](_0x312dfe);}catch(_0x2cdad2){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x27'),_0x312dfe['uniqueid']),_0x2cdad2);}});ami['on'](_0xa4d2('0x28'),function(_0x1b3cbd){try{utils['debug'](util['format'](_0xa4d2('0x29'),_0x1b3cbd['uniqueid']),_0x1b3cbd);queues[_0xa4d2('0x28')](_0x1b3cbd);calls['musiconholdstop'](_0x1b3cbd);}catch(_0x161e4d){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x29'),_0x1b3cbd[_0xa4d2('0x1b')]),_0x161e4d);}});ami['on']('newstate',function(_0x21f9fb){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')]('[%s][index][newstate]',_0x21f9fb[_0xa4d2('0x1b')]),_0x21f9fb);calls['newstate'](_0x21f9fb);recordings[_0xa4d2('0x2a')](_0x21f9fb);}catch(_0x271a65){utils[_0xa4d2('0x12')](util['format'](_0xa4d2('0x2b'),_0x21f9fb[_0xa4d2('0x1b')]),_0x271a65);}});ami['on']('hangup',function(_0x25a4d3){try{utils['debug'](util[_0xa4d2('0x19')]('[%s][index][hangup]',_0x25a4d3[_0xa4d2('0x1b')]),_0x25a4d3);calls['hangup'](_0x25a4d3);recordings[_0xa4d2('0x2c')](_0x25a4d3);dials['hangup'](_0x25a4d3);agents[_0xa4d2('0x2c')](_0x25a4d3);queues['hangup'](_0x25a4d3);}catch(_0x35670f){utils[_0xa4d2('0x12')](util['format'](_0xa4d2('0x2d'),_0x25a4d3['uniqueid']),_0x35670f);}});ami['on'](_0xa4d2('0x2e'),function(_0x3e1cfc){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x2f'),_0x3e1cfc[_0xa4d2('0x1b')]),_0x3e1cfc);members[_0xa4d2('0x2e')](_0x3e1cfc);}catch(_0x23de07){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')]('[%s][index][cdr]',_0x3e1cfc[_0xa4d2('0x1b')]),_0x23de07);}});ami['on']('blindtransfer',function(_0x3812f7){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x30'),_0x3812f7[_0xa4d2('0x1b')]),_0x3812f7);queues[_0xa4d2('0x31')](_0x3812f7);agents[_0xa4d2('0x31')](_0x3812f7);transfers[_0xa4d2('0x31')](_0x3812f7);}catch(_0x3d9dc7){utils[_0xa4d2('0x12')](util['format'](_0xa4d2('0x30'),_0x3812f7[_0xa4d2('0x1b')]),_0x3d9dc7);}});ami['on'](_0xa4d2('0x32'),function(_0x3dad56){try{utils['debug'](util[_0xa4d2('0x19')]('[%s][index][attendedtransfer]',_0x3dad56[_0xa4d2('0x33')]),_0x3dad56);queues[_0xa4d2('0x32')](_0x3dad56);transfers['attendedtransfer'](_0x3dad56);agents['attendedtransfer'](_0x3dad56);calls['attendedtransfer'](_0x3dad56);}catch(_0x1e480a){utils['error'](util['format'](_0xa4d2('0x34'),_0x3dad56['origtransfereruniqueid']),_0x1e480a);}});ami['on']('varset',function(_0x379819){try{utils['debug'](util[_0xa4d2('0x19')](_0xa4d2('0x35'),_0x379819[_0xa4d2('0x1b')]),_0x379819);queues[_0xa4d2('0x36')](_0x379819);recordings[_0xa4d2('0x36')](_0x379819);calls[_0xa4d2('0x36')](_0x379819);dials['varset'](_0x379819);}catch(_0x43d8d7){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x35'),_0x379819[_0xa4d2('0x1b')]),_0x43d8d7);}});ami['on'](_0xa4d2('0x37'),function(_0x2b0960){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x38'),_0x2b0960['uniqueid']),_0x2b0960);calls[_0xa4d2('0x37')](_0x2b0960);recordings[_0xa4d2('0x37')](_0x2b0960);dials['newexten'](_0x2b0960);}catch(_0x5f3849){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x38'),_0x2b0960[_0xa4d2('0x1b')]),_0x5f3849);}});ami['on'](_0xa4d2('0x39'),function(_0x495cf1){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x3a'),_0x495cf1[_0xa4d2('0x1b')]),_0x495cf1);calls[_0xa4d2('0x39')](_0x495cf1);recordings[_0xa4d2('0x39')](_0x495cf1);}catch(_0x19176e){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x3a'),_0x495cf1[_0xa4d2('0x1b')]),_0x19176e);}});ami['on'](_0xa4d2('0x3b'),function(_0x472c2f){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x3c'),_0x472c2f['uniqueid']),_0x472c2f);dials[_0xa4d2('0x3b')](_0x472c2f);}catch(_0xb2ba33){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')]('[%s]dialbegin',_0x472c2f[_0xa4d2('0x1b')]),_0xb2ba33);}});ami['on']('dialend',function(_0x2641f3){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x3d'),_0x2641f3['uniqueid']),_0x2641f3);dials['dialend'](_0x2641f3);}catch(_0x54ef96){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')]('[%s][index][dialend]',_0x2641f3[_0xa4d2('0x1b')]),_0x54ef96);}});} \ No newline at end of file +var _0x7d3b=['hangup','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][dialbegin]','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','port','username','xdr','XDR\x20DISABLED','./calls.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','[%s][index][hangup]'];(function(_0x47f026,_0x24c95f){var _0x40bf6c=function(_0x1f151f){while(--_0x1f151f){_0x47f026['push'](_0x47f026['shift']());}};_0x40bf6c(++_0x24c95f);}(_0x7d3b,0x8b));var _0xb7d3=function(_0x1ba67b,_0x35ba6f){_0x1ba67b=_0x1ba67b-0x0;var _0x2247dd=_0x7d3b[_0x1ba67b];return _0x2247dd;};var AsteriskManager=require(_0xb7d3('0x0'));var config=require(_0xb7d3('0x1'));var utils=require(_0xb7d3('0x2'));var util=require(_0xb7d3('0x3'));var ami=new AsteriskManager(config[_0xb7d3('0x4')][_0xb7d3('0x5')],config['asterisk']['ip'],config['asterisk'][_0xb7d3('0x6')],config['asterisk']['password'],!![]);ami['keepConnected']();if(config[_0xb7d3('0x7')]&&config['xdr']['disabled']){utils['info'](_0xb7d3('0x8'));}else{var agents=require('./agents.controller');var calls=require(_0xb7d3('0x9'));var queues=require('./queues.controller');var recordings=require(_0xb7d3('0xa'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xb7d3('0xb'));var core=require(_0xb7d3('0xc'));ami['on'](_0xb7d3('0xd'),core[_0xb7d3('0xd')]);ami['on'](_0xb7d3('0xe'),core[_0xb7d3('0xe')]);ami['on']('fullybooted',core[_0xb7d3('0xf')]);ami['on'](_0xb7d3('0x10'),core['error']);ami['on'](_0xb7d3('0x11'),core[_0xb7d3('0x11')]);ami['on']('managerevent',core[_0xb7d3('0x12')]);ami['on'](_0xb7d3('0x13'),function(_0x2234a5){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x15')]('[%s][index][devicestatechange]',_0x2234a5[_0xb7d3('0x16')]),_0x2234a5);members[_0xb7d3('0x13')](_0x2234a5);}catch(_0x337dea){utils[_0xb7d3('0x10')](util[_0xb7d3('0x15')]('[%s][index][devicestatechange]',_0x2234a5['device']),_0x337dea);}});ami['on'](_0xb7d3('0x17'),function(_0x5ab270){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x15')](_0xb7d3('0x18'),_0x5ab270[_0xb7d3('0x19')]),_0x5ab270);agents[_0xb7d3('0x17')](_0x5ab270);}catch(_0x485cc5){utils[_0xb7d3('0x10')](util[_0xb7d3('0x15')](_0xb7d3('0x18'),_0x5ab270[_0xb7d3('0x19')]),_0x485cc5);}});ami['on'](_0xb7d3('0x1a'),function(_0x2099fc){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x15')](_0xb7d3('0x1b'),_0x2099fc[_0xb7d3('0x19')]),_0x2099fc);agents['agentringnoanswer'](_0x2099fc);}catch(_0x44982a){utils[_0xb7d3('0x10')](util['format'](_0xb7d3('0x1b'),_0x2099fc['uniqueid']),_0x44982a);}});ami['on'](_0xb7d3('0x1c'),function(_0x14a0a1){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x15')](_0xb7d3('0x1d'),_0x14a0a1['uniqueid']),_0x14a0a1);agents[_0xb7d3('0x1c')](_0x14a0a1);queues['agentconnect'](_0x14a0a1);}catch(_0x411766){utils[_0xb7d3('0x10')](util[_0xb7d3('0x15')](_0xb7d3('0x1d'),_0x14a0a1[_0xb7d3('0x19')]),_0x411766);}});ami['on']('agentcomplete',function(_0x3ce0c5){try{utils['debug'](util[_0xb7d3('0x15')]('[%s][index][agentcomplete]',_0x3ce0c5[_0xb7d3('0x19')]),_0x3ce0c5);agents['agentcomplete'](_0x3ce0c5);queues[_0xb7d3('0x1e')](_0x3ce0c5);members[_0xb7d3('0x1e')](_0x3ce0c5);}catch(_0x308580){utils['error'](util[_0xb7d3('0x15')]('[%s][index][agentcomplete]',_0x3ce0c5[_0xb7d3('0x19')]),_0x308580);}});ami['on'](_0xb7d3('0x1f'),function(_0x3678bb){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x15')](_0xb7d3('0x20'),_0x3678bb[_0xb7d3('0x19')]),_0x3678bb);agents[_0xb7d3('0x1f')](_0x3678bb);queues[_0xb7d3('0x1f')](_0x3678bb);}catch(_0x1fb882){utils[_0xb7d3('0x10')](util[_0xb7d3('0x15')](_0xb7d3('0x20'),_0x3678bb[_0xb7d3('0x19')]),_0x1fb882);}});ami['on'](_0xb7d3('0x21'),function(_0x38a48e){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x15')](_0xb7d3('0x22'),_0x38a48e[_0xb7d3('0x19')]),_0x38a48e);queues[_0xb7d3('0x21')](_0x38a48e);recordings[_0xb7d3('0x21')](_0x38a48e);}catch(_0x419d78){utils[_0xb7d3('0x10')](util[_0xb7d3('0x15')](_0xb7d3('0x22'),_0x38a48e[_0xb7d3('0x19')]),_0x419d78);}});ami['on'](_0xb7d3('0x23'),function(_0x5fb8b7){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x15')](_0xb7d3('0x24'),_0x5fb8b7['uniqueid']),_0x5fb8b7);queues[_0xb7d3('0x23')](_0x5fb8b7);}catch(_0x567994){utils[_0xb7d3('0x10')](util[_0xb7d3('0x15')](_0xb7d3('0x24'),_0x5fb8b7[_0xb7d3('0x19')]),_0x567994);}});ami['on'](_0xb7d3('0x25'),function(_0x2f18b5){try{utils['debug'](util[_0xb7d3('0x15')](_0xb7d3('0x26'),_0x2f18b5[_0xb7d3('0x19')]),_0x2f18b5);queues['musiconholdstart'](_0x2f18b5);calls[_0xb7d3('0x25')](_0x2f18b5);}catch(_0x2261f9){utils[_0xb7d3('0x10')](util['format'](_0xb7d3('0x26'),_0x2f18b5['uniqueid']),_0x2261f9);}});ami['on']('musiconholdstop',function(_0x45a86d){try{utils['debug'](util[_0xb7d3('0x15')](_0xb7d3('0x27'),_0x45a86d['uniqueid']),_0x45a86d);queues[_0xb7d3('0x28')](_0x45a86d);calls['musiconholdstop'](_0x45a86d);}catch(_0x3491b4){utils[_0xb7d3('0x10')](util['format'](_0xb7d3('0x27'),_0x45a86d[_0xb7d3('0x19')]),_0x3491b4);}});ami['on'](_0xb7d3('0x29'),function(_0x784b4a){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x15')](_0xb7d3('0x2a'),_0x784b4a[_0xb7d3('0x19')]),_0x784b4a);calls[_0xb7d3('0x29')](_0x784b4a);recordings[_0xb7d3('0x29')](_0x784b4a);}catch(_0x40a6be){utils['error'](util['format']('[%s][index][newstate]',_0x784b4a[_0xb7d3('0x19')]),_0x40a6be);}});ami['on']('hangup',function(_0x29be60){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x15')](_0xb7d3('0x2b'),_0x29be60[_0xb7d3('0x19')]),_0x29be60);calls[_0xb7d3('0x2c')](_0x29be60);recordings[_0xb7d3('0x2c')](_0x29be60);dials[_0xb7d3('0x2c')](_0x29be60);agents[_0xb7d3('0x2c')](_0x29be60);queues[_0xb7d3('0x2c')](_0x29be60);}catch(_0x238a43){utils[_0xb7d3('0x10')](util['format']('[%s][index][hangup]',_0x29be60[_0xb7d3('0x19')]),_0x238a43);}});ami['on'](_0xb7d3('0x2d'),function(_0x3e2906){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x15')](_0xb7d3('0x2e'),_0x3e2906['uniqueid']),_0x3e2906);members[_0xb7d3('0x2d')](_0x3e2906);}catch(_0x3dac27){utils[_0xb7d3('0x10')](util[_0xb7d3('0x15')](_0xb7d3('0x2e'),_0x3e2906['uniqueid']),_0x3dac27);}});ami['on']('blindtransfer',function(_0x1aadd6){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x15')](_0xb7d3('0x2f'),_0x1aadd6[_0xb7d3('0x19')]),_0x1aadd6);queues[_0xb7d3('0x30')](_0x1aadd6);agents['blindtransfer'](_0x1aadd6);transfers[_0xb7d3('0x30')](_0x1aadd6);}catch(_0x2862bf){utils[_0xb7d3('0x10')](util[_0xb7d3('0x15')](_0xb7d3('0x2f'),_0x1aadd6[_0xb7d3('0x19')]),_0x2862bf);}});ami['on'](_0xb7d3('0x31'),function(_0x31d9df){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x15')](_0xb7d3('0x32'),_0x31d9df[_0xb7d3('0x33')]),_0x31d9df);queues[_0xb7d3('0x31')](_0x31d9df);transfers[_0xb7d3('0x31')](_0x31d9df);agents[_0xb7d3('0x31')](_0x31d9df);calls[_0xb7d3('0x31')](_0x31d9df);}catch(_0x378423){utils['error'](util[_0xb7d3('0x15')](_0xb7d3('0x32'),_0x31d9df[_0xb7d3('0x33')]),_0x378423);}});ami['on'](_0xb7d3('0x34'),function(_0x3d2f1b){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x15')](_0xb7d3('0x35'),_0x3d2f1b['uniqueid']),_0x3d2f1b);queues[_0xb7d3('0x34')](_0x3d2f1b);recordings[_0xb7d3('0x34')](_0x3d2f1b);calls[_0xb7d3('0x34')](_0x3d2f1b);dials[_0xb7d3('0x34')](_0x3d2f1b);}catch(_0x144480){utils['error'](util[_0xb7d3('0x15')]('[%s][index][varset]',_0x3d2f1b[_0xb7d3('0x19')]),_0x144480);}});ami['on'](_0xb7d3('0x36'),function(_0x561dee){try{utils['debug'](util[_0xb7d3('0x15')](_0xb7d3('0x37'),_0x561dee[_0xb7d3('0x19')]),_0x561dee);calls[_0xb7d3('0x36')](_0x561dee);recordings[_0xb7d3('0x36')](_0x561dee);dials[_0xb7d3('0x36')](_0x561dee);}catch(_0x2fa40a){utils[_0xb7d3('0x10')](util[_0xb7d3('0x15')]('[%s][index][newexten]',_0x561dee[_0xb7d3('0x19')]),_0x2fa40a);}});ami['on'](_0xb7d3('0x38'),function(_0x3af74d){try{utils['debug'](util[_0xb7d3('0x15')]('[%s][index][newchannel]',_0x3af74d['uniqueid']),_0x3af74d);calls[_0xb7d3('0x38')](_0x3af74d);recordings[_0xb7d3('0x38')](_0x3af74d);}catch(_0x3dbcd8){utils[_0xb7d3('0x10')](util[_0xb7d3('0x15')]('[%s][index][newchannel]',_0x3af74d['uniqueid']),_0x3dbcd8);}});ami['on']('dialbegin',function(_0x186ae6){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x15')](_0xb7d3('0x39'),_0x186ae6[_0xb7d3('0x19')]),_0x186ae6);dials[_0xb7d3('0x3a')](_0x186ae6);}catch(_0xe0a484){utils['error'](util[_0xb7d3('0x15')]('[%s]dialbegin',_0x186ae6['uniqueid']),_0xe0a484);}});ami['on'](_0xb7d3('0x3b'),function(_0x242a5d){try{utils[_0xb7d3('0x14')](util[_0xb7d3('0x15')](_0xb7d3('0x3c'),_0x242a5d[_0xb7d3('0x19')]),_0x242a5d);dials[_0xb7d3('0x3b')](_0x242a5d);}catch(_0x505ea0){utils[_0xb7d3('0x10')](util[_0xb7d3('0x15')](_0xb7d3('0x3c'),_0x242a5d[_0xb7d3('0x19')]),_0x505ea0);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index ef31db2..e43e10f 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 _0x89f2=['voice','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data1','data3','lodash','util','Local/_attended@transfer','Queue:','info','uniqueid','channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','format','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x89f2,0x11f));var _0x289f=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x89f2[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x289f('0x0'));var util=require(_0x289f('0x1'));var utils=require('./utils');var members={};var exclude=[_0x289f('0x2'),_0x289f('0x3')];function writeDB(_0x2cf347){utils[_0x289f('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x2cf347[_0x289f('0x5')],_0x2cf347['interface'],_0x2cf347[_0x289f('0x6')],_0x2cf347[_0x289f('0x7')],_0x2cf347[_0x289f('0x8')],_0x2cf347[_0x289f('0x9')]));if(_0x2cf347[_0x289f('0xa')]){utils[_0x289f('0xb')](_0x2cf347[_0x289f('0xa')])[_0x289f('0xc')](function(_0x17e08e){if(_0x17e08e){_0x2cf347[_0x289f('0x8')]=_0x17e08e[_0x289f('0xd')];_0x2cf347[_0x289f('0xe')]=_0x17e08e[_0x289f('0xe')];utils[_0x289f('0xf')](_0x289f('0x10'),_0x2cf347);}else{utils[_0x289f('0x11')](_0x2cf347[_0x289f('0xa')][_0x289f('0x12')]('/')[0x1])[_0x289f('0xc')](function(_0x4a7649){if(_0x4a7649){_0x2cf347[_0x289f('0x8')]=_0x4a7649['name'];_0x2cf347[_0x289f('0xe')]=_0x4a7649[_0x289f('0xe')];utils[_0x289f('0xf')]('CreateMemberReport',_0x2cf347);}});}})[_0x289f('0x13')](function(_0x33b8ec){utils[_0x289f('0x14')](util['format'](_0x289f('0x15'),_0x2cf347[_0x289f('0x5')]),_0x33b8ec);});}delete members[_0x2cf347[_0x289f('0xa')]];}function startsWith(_0x5b0f7,_0x592b1e){return _[_0x289f('0x16')](_0x5b0f7,function(_0x1bc291){return _[_0x289f('0x17')](_0x592b1e,_0x1bc291);});}exports[_0x289f('0x18')]=function(_0x12b980){try{utils[_0x289f('0x19')](util[_0x289f('0x1a')]('[%s][members][devicestatechange]',members[_0x12b980[_0x289f('0x1b')]]?members[_0x12b980['device']][_0x289f('0x5')]:_0x12b980[_0x289f('0x1b')]),_0x12b980);utils[_0x289f('0x4')](util['format'](_0x289f('0x1c'),members[_0x12b980['device']]?members[_0x12b980[_0x289f('0x1b')]][_0x289f('0x5')]:_0x12b980[_0x289f('0x1b')],_0x12b980[_0x289f('0x1d')],_0x12b980['device']));switch(_0x12b980[_0x289f('0x1d')]){case _0x289f('0x1e'):case'BUSY':if(!startsWith(exclude,_0x12b980[_0x289f('0x1b')])){members[_0x12b980[_0x289f('0x1b')]]={'channel':_0x289f('0x1f'),'interface':_0x12b980[_0x289f('0x1b')],'type':'TALKING','enterAt':utils['now'](),'role':_0x289f('0x20')};}break;case _0x289f('0x21'):if(!_[_0x289f('0x22')](members[_0x12b980[_0x289f('0x1b')]])){members[_0x12b980[_0x289f('0x1b')]][_0x289f('0x23')]=utils[_0x289f('0x24')]();members[_0x12b980[_0x289f('0x1b')]][_0x289f('0x25')]=utils[_0x289f('0x26')](members[_0x12b980[_0x289f('0x1b')]]['exitAt'],members[_0x12b980[_0x289f('0x1b')]][_0x289f('0x27')]);if(members[_0x12b980[_0x289f('0x1b')]]['uniqueid']){writeDB(members[_0x12b980[_0x289f('0x1b')]]);}}break;default:break;}}catch(_0x24997b){utils[_0x289f('0x14')](util['format']('[%s][members][devicestatechange]',members[_0x12b980[_0x289f('0x1b')]]?members[_0x12b980['device']][_0x289f('0x5')]:_0x12b980[_0x289f('0x1b')]),_0x24997b);}};exports[_0x289f('0x28')]=function(_0x1b6980){try{if(!_[_0x289f('0x22')](members[_0x1b6980[_0x289f('0xa')]])){utils['debug'](util[_0x289f('0x1a')](_0x289f('0x29'),_0x1b6980[_0x289f('0x5')]),_0x1b6980);utils[_0x289f('0x4')](util[_0x289f('0x1a')](_0x289f('0x2a'),_0x1b6980[_0x289f('0x5')],_0x1b6980[_0x289f('0xa')],_0x1b6980[_0x289f('0x2b')]));members[_0x1b6980[_0x289f('0xa')]]=_[_0x289f('0x2c')](members[_0x1b6980[_0x289f('0xa')]],{'data4':_0x1b6980[_0x289f('0x2b')],'uniqueid':_0x1b6980[_0x289f('0x5')]});}}catch(_0x633a49){utils['error'](util[_0x289f('0x1a')]('[%s][members][agentcomplete]',_0x1b6980['uniqueid']),_0x633a49);}};exports[_0x289f('0x2d')]=function(_0x930f61){try{utils[_0x289f('0x19')](util['format'](_0x289f('0x2e'),_0x930f61[_0x289f('0x5')]),_0x930f61);if(_0x930f61[_0x289f('0x6')]){var _0xf61cc0=_0x930f61['channel'][_0x289f('0x12')]('-')[0x0];if(!_[_0x289f('0x22')](members[_0xf61cc0])){members[_0xf61cc0]=_['assign'](members[_0xf61cc0],{'data1':members[_0xf61cc0]['data1']||_0x930f61[_0x289f('0x9')],'data2':members[_0xf61cc0][_0x289f('0x7')]||_0x930f61[_0x289f('0x2f')],'data3':members[_0xf61cc0]['data3']||_0x930f61[_0x289f('0x30')],'uniqueid':members[_0xf61cc0]['uniqueid']||_0x930f61[_0x289f('0x5')]});utils[_0x289f('0x4')](util[_0x289f('0x1a')](_0x289f('0x31'),_0x930f61[_0x289f('0x5')],members[_0xf61cc0]['data1'],members[_0xf61cc0][_0x289f('0x7')],members[_0xf61cc0]['data3']));if(members[_0xf61cc0][_0x289f('0x23')]){writeDB(members[_0xf61cc0]);}}}if(_0x930f61[_0x289f('0x32')]){var _0x8463aa=_0x930f61[_0x289f('0x32')][_0x289f('0x12')]('-')[0x0];if(!_[_0x289f('0x22')](members[_0x8463aa])){members[_0x8463aa]=_['assign'](members[_0x8463aa],{'data1':members[_0x8463aa]['data1']||_0x930f61[_0x289f('0x9')],'data2':members[_0x8463aa][_0x289f('0x7')]||_0x930f61['source'],'data3':members[_0x8463aa]['data3']||_0x930f61[_0x289f('0x30')],'uniqueid':members[_0x8463aa]['uniqueid']||_0x930f61['uniqueid']});utils['info'](util[_0x289f('0x1a')](_0x289f('0x31'),_0x930f61[_0x289f('0x5')],members[_0x8463aa][_0x289f('0x33')],members[_0x8463aa]['data2'],members[_0x8463aa][_0x289f('0x34')]));if(members[_0x8463aa][_0x289f('0x23')]){writeDB(members[_0x8463aa]);}}}}catch(_0x1b1499){utils[_0x289f('0x14')](util['format'](_0x289f('0x2e'),_0x930f61['uniqueid']),_0x1b1499);}}; \ No newline at end of file +var _0x6e00=['data2','type','interface','getUserByInterface','membername','name','internal','CreateMemberReport','getUserByName','split','then','request','catch','error','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','data3','destination','destinationchannel','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','channel'];(function(_0x29ea48,_0x466ba0){var _0x2dce4a=function(_0x519493){while(--_0x519493){_0x29ea48['push'](_0x29ea48['shift']());}};_0x2dce4a(++_0x466ba0);}(_0x6e00,0x1b9));var _0x06e0=function(_0x2cb967,_0xe645e1){_0x2cb967=_0x2cb967-0x0;var _0x1c8f42=_0x6e00[_0x2cb967];return _0x1c8f42;};'use strict';var _=require(_0x06e0('0x0'));var util=require(_0x06e0('0x1'));var utils=require(_0x06e0('0x2'));var members={};var exclude=[_0x06e0('0x3'),_0x06e0('0x4')];function writeDB(_0x372c91){utils[_0x06e0('0x5')](util[_0x06e0('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x372c91[_0x06e0('0x7')],_0x372c91['interface'],_0x372c91[_0x06e0('0x8')],_0x372c91[_0x06e0('0x9')],_0x372c91['membername'],_0x372c91[_0x06e0('0xa')]));if(_0x372c91[_0x06e0('0xb')]){utils[_0x06e0('0xc')](_0x372c91[_0x06e0('0xb')])['then'](function(_0x145635){if(_0x145635){_0x372c91[_0x06e0('0xd')]=_0x145635[_0x06e0('0xe')];_0x372c91['internal']=_0x145635[_0x06e0('0xf')];utils['request'](_0x06e0('0x10'),_0x372c91);}else{utils[_0x06e0('0x11')](_0x372c91[_0x06e0('0xb')][_0x06e0('0x12')]('/')[0x1])[_0x06e0('0x13')](function(_0xa708e5){if(_0xa708e5){_0x372c91[_0x06e0('0xd')]=_0xa708e5[_0x06e0('0xe')];_0x372c91[_0x06e0('0xf')]=_0xa708e5[_0x06e0('0xf')];utils[_0x06e0('0x14')]('CreateMemberReport',_0x372c91);}});}})[_0x06e0('0x15')](function(_0x6e7edd){utils[_0x06e0('0x16')](util['format']('[%s][members][writeDB]',_0x372c91[_0x06e0('0x7')]),_0x6e7edd);});}delete members[_0x372c91[_0x06e0('0xb')]];}function startsWith(_0x1db8d6,_0x191612){return _['some'](_0x1db8d6,function(_0x51b943){return _['startsWith'](_0x191612,_0x51b943);});}exports[_0x06e0('0x17')]=function(_0x43bb19){try{utils[_0x06e0('0x18')](util[_0x06e0('0x6')](_0x06e0('0x19'),members[_0x43bb19['device']]?members[_0x43bb19[_0x06e0('0x1a')]][_0x06e0('0x7')]:_0x43bb19[_0x06e0('0x1a')]),_0x43bb19);utils[_0x06e0('0x5')](util[_0x06e0('0x6')](_0x06e0('0x1b'),members[_0x43bb19[_0x06e0('0x1a')]]?members[_0x43bb19[_0x06e0('0x1a')]][_0x06e0('0x7')]:_0x43bb19[_0x06e0('0x1a')],_0x43bb19[_0x06e0('0x1c')],_0x43bb19['device']));switch(_0x43bb19[_0x06e0('0x1c')]){case _0x06e0('0x1d'):case _0x06e0('0x1e'):if(!startsWith(exclude,_0x43bb19[_0x06e0('0x1a')])){members[_0x43bb19[_0x06e0('0x1a')]]={'channel':_0x06e0('0x1f'),'interface':_0x43bb19[_0x06e0('0x1a')],'type':'TALKING','enterAt':utils[_0x06e0('0x20')](),'role':'agent'};}break;case _0x06e0('0x21'):if(!_[_0x06e0('0x22')](members[_0x43bb19[_0x06e0('0x1a')]])){members[_0x43bb19[_0x06e0('0x1a')]][_0x06e0('0x23')]=utils[_0x06e0('0x20')]();members[_0x43bb19[_0x06e0('0x1a')]][_0x06e0('0x24')]=utils[_0x06e0('0x25')](members[_0x43bb19[_0x06e0('0x1a')]][_0x06e0('0x23')],members[_0x43bb19[_0x06e0('0x1a')]][_0x06e0('0x26')]);if(members[_0x43bb19[_0x06e0('0x1a')]][_0x06e0('0x7')]){writeDB(members[_0x43bb19[_0x06e0('0x1a')]]);}}break;default:break;}}catch(_0x293bb8){utils['error'](util[_0x06e0('0x6')](_0x06e0('0x19'),members[_0x43bb19[_0x06e0('0x1a')]]?members[_0x43bb19[_0x06e0('0x1a')]]['uniqueid']:_0x43bb19[_0x06e0('0x1a')]),_0x293bb8);}};exports['agentcomplete']=function(_0x210873){try{if(!_[_0x06e0('0x22')](members[_0x210873[_0x06e0('0xb')]])){utils[_0x06e0('0x18')](util['format']('[%s][members][agentcomplete]',_0x210873[_0x06e0('0x7')]),_0x210873);utils[_0x06e0('0x5')](util[_0x06e0('0x6')](_0x06e0('0x27'),_0x210873[_0x06e0('0x7')],_0x210873[_0x06e0('0xb')],_0x210873[_0x06e0('0x28')]));members[_0x210873[_0x06e0('0xb')]]=_[_0x06e0('0x29')](members[_0x210873[_0x06e0('0xb')]],{'data4':_0x210873['queue'],'uniqueid':_0x210873[_0x06e0('0x7')]});}}catch(_0x286a40){utils[_0x06e0('0x16')](util[_0x06e0('0x6')]('[%s][members][agentcomplete]',_0x210873[_0x06e0('0x7')]),_0x286a40);}};exports[_0x06e0('0x2a')]=function(_0xa26e1a){try{utils['debug'](util[_0x06e0('0x6')](_0x06e0('0x2b'),_0xa26e1a['uniqueid']),_0xa26e1a);if(_0xa26e1a['channel']){var _0x4ea057=_0xa26e1a[_0x06e0('0x8')][_0x06e0('0x12')]('-')[0x0];if(!_[_0x06e0('0x22')](members[_0x4ea057])){members[_0x4ea057]=_[_0x06e0('0x29')](members[_0x4ea057],{'data1':members[_0x4ea057][_0x06e0('0x2c')]||_0xa26e1a['type'],'data2':members[_0x4ea057][_0x06e0('0x9')]||_0xa26e1a['source'],'data3':members[_0x4ea057][_0x06e0('0x2d')]||_0xa26e1a[_0x06e0('0x2e')],'uniqueid':members[_0x4ea057][_0x06e0('0x7')]||_0xa26e1a[_0x06e0('0x7')]});utils['info'](util[_0x06e0('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xa26e1a[_0x06e0('0x7')],members[_0x4ea057][_0x06e0('0x2c')],members[_0x4ea057][_0x06e0('0x9')],members[_0x4ea057][_0x06e0('0x2d')]));if(members[_0x4ea057][_0x06e0('0x23')]){writeDB(members[_0x4ea057]);}}}if(_0xa26e1a[_0x06e0('0x2f')]){var _0x276778=_0xa26e1a[_0x06e0('0x2f')][_0x06e0('0x12')]('-')[0x0];if(!_[_0x06e0('0x22')](members[_0x276778])){members[_0x276778]=_[_0x06e0('0x29')](members[_0x276778],{'data1':members[_0x276778][_0x06e0('0x2c')]||_0xa26e1a['type'],'data2':members[_0x276778][_0x06e0('0x9')]||_0xa26e1a[_0x06e0('0x30')],'data3':members[_0x276778][_0x06e0('0x2d')]||_0xa26e1a[_0x06e0('0x2e')],'uniqueid':members[_0x276778][_0x06e0('0x7')]||_0xa26e1a[_0x06e0('0x7')]});utils[_0x06e0('0x5')](util[_0x06e0('0x6')](_0x06e0('0x31'),_0xa26e1a[_0x06e0('0x7')],members[_0x276778][_0x06e0('0x2c')],members[_0x276778][_0x06e0('0x9')],members[_0x276778][_0x06e0('0x2d')]));if(members[_0x276778]['exitAt']){writeDB(members[_0x276778]);}}}}catch(_0x466162){utils[_0x06e0('0x16')](util[_0x06e0('0x6')]('[%s][members][cdr]',_0xa26e1a[_0x06e0('0x7')]),_0x466162);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 4b922c5..bf1b6a3 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 _0x1267=['isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','COMPLETEDBYAGENT','name','varset','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','diffTime','position','count','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','queuecallercompleteAt','reason','transfer','TRANSFER','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','now','error','hangup'];(function(_0x1b5328,_0x5a359e){var _0x2fde32=function(_0x59864a){while(--_0x59864a){_0x1b5328['push'](_0x1b5328['shift']());}};_0x2fde32(++_0x5a359e);}(_0x1267,0xb5));var _0x7126=function(_0x246967,_0x11dd9a){_0x246967=_0x246967-0x0;var _0x239faa=_0x1267[_0x246967];return _0x239faa;};'use strict';var _=require(_0x7126('0x0'));var util=require(_0x7126('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x4c4304){utils[_0x7126('0x2')](util[_0x7126('0x3')](_0x7126('0x4'),_0x4c4304[_0x7126('0x5')],_0x4c4304[_0x7126('0x6')],_0x4c4304[_0x7126('0x7')],_0x4c4304[_0x7126('0x8')],_0x4c4304['calleridnum'],_0x4c4304[_0x7126('0x9')],_0x4c4304[_0x7126('0xa')]));if(_0x4c4304[_0x7126('0x7')]){utils[_0x7126('0xb')](_0x4c4304['queue'])[_0x7126('0xc')](function(_0x4f1e7f){if(_0x4f1e7f){_0x4c4304[_0x7126('0xd')]=_0x4f1e7f['type'];}utils[_0x7126('0xe')](_0x7126('0xf'),_0x4c4304);});}else{utils[_0x7126('0xe')](_0x7126('0xf'),_0x4c4304);}if(_0x4c4304[_0x7126('0x10')]){delete queues[_0x4c4304['transfereduniqueid']];}else{delete queues[_0x4c4304['uniqueid']];}}exports[_0x7126('0x11')]=function(_0x397339){try{utils[_0x7126('0x12')](util[_0x7126('0x3')](_0x7126('0x13'),_0x397339[_0x7126('0x5')]),_0x397339);utils['info'](util['format'](_0x7126('0x14'),_0x397339[_0x7126('0x5')],_0x397339['queue'],_0x397339['position']));queues[_0x397339[_0x7126('0x5')]]=_[_0x7126('0x15')](_0x397339,{'originalposition':_0x397339['position'],'queuecallerjoinAt':utils[_0x7126('0x16')](),'mohtime':0x0});}catch(_0x52866f){utils[_0x7126('0x17')](util[_0x7126('0x3')]('[%s][queues][queuecallerjoin]',_0x397339['uniqueid']),_0x52866f);}};exports[_0x7126('0x18')]=function(_0x4bd126){try{if(!_[_0x7126('0x19')](queues[_0x4bd126[_0x7126('0x5')]])){utils[_0x7126('0x12')](util[_0x7126('0x3')](_0x7126('0x1a'),_0x4bd126[_0x7126('0x5')]),_0x4bd126);if(queues[_0x4bd126[_0x7126('0x5')]]['queuecallerleaveAt']){if(!queues[_0x4bd126[_0x7126('0x5')]][_0x7126('0x1b')]&&!queues[_0x4bd126['uniqueid']][_0x7126('0x1c')]){queues[_0x4bd126[_0x7126('0x5')]]['queuecallercomplete']=!![];queues[_0x4bd126[_0x7126('0x5')]]['queuecallercompleteAt']=utils['now']();queues[_0x4bd126[_0x7126('0x5')]][_0x7126('0xa')]=_0x7126('0x1d');}utils[_0x7126('0x2')](util[_0x7126('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x4bd126[_0x7126('0x5')],queues[_0x4bd126[_0x7126('0x5')]][_0x7126('0x1e')],queues[_0x4bd126[_0x7126('0x5')]][_0x7126('0xa')]));writeDB(queues[_0x4bd126[_0x7126('0x5')]]);}else if(queues[_0x4bd126[_0x7126('0x5')]][_0x7126('0x10')]){utils['info'](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4bd126[_0x7126('0x5')],queues[_0x4bd126[_0x7126('0x5')]][_0x7126('0x1e')],queues[_0x4bd126[_0x7126('0x5')]][_0x7126('0x10')]));queues[queues[_0x4bd126[_0x7126('0x5')]]['transfereduniqueid']]=queues[_0x4bd126[_0x7126('0x5')]];queues[queues[_0x4bd126['uniqueid']][_0x7126('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x4bd126[_0x7126('0x5')]];}}}catch(_0x15b2bb){utils[_0x7126('0x17')](util['format']('[%s][queues][hangup]',_0x4bd126['uniqueid']),_0x15b2bb);}};exports[_0x7126('0x1f')]=function(_0x4a74c4){try{utils['debug'](util[_0x7126('0x3')](_0x7126('0x20'),_0x4a74c4[_0x7126('0x5')]),_0x4a74c4);if(!_[_0x7126('0x19')](_0x4a74c4[_0x7126('0x21')][_0x7126('0x22')])&&_0x4a74c4[_0x7126('0x23')]['toUpperCase']()!==_0x7126('0x24')){if(!_['isNil'](queues[_0x4a74c4['uniqueid']])){queues[_0x4a74c4[_0x7126('0x5')]][_0x7126('0x1b')]=![];queues[_0x4a74c4[_0x7126('0x5')]][_0x7126('0x25')]=null;queues[_0x4a74c4['uniqueid']][_0x7126('0x1c')]=!![];queues[_0x4a74c4[_0x7126('0x5')]][_0x7126('0x26')]=utils['now']();queues[_0x4a74c4['uniqueid']][_0x7126('0xa')]=_0x4a74c4[_0x7126('0x23')][_0x7126('0x27')]();utils[_0x7126('0x2')](util[_0x7126('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4a74c4[_0x7126('0x5')],queues[_0x4a74c4[_0x7126('0x5')]][_0x7126('0x1e')],_0x4a74c4[_0x7126('0x23')],queues[_0x4a74c4[_0x7126('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x4a74c4['uniqueid']]);}}else if(!_[_0x7126('0x19')](_0x4a74c4[_0x7126('0x21')][_0x7126('0x28')])){if(!_[_0x7126('0x19')](queues[_0x4a74c4[_0x7126('0x5')]])&&!queues[_0x4a74c4['uniqueid']][_0x7126('0x1b')]){queues[_0x4a74c4['uniqueid']][_0x7126('0x1b')]=![];queues[_0x4a74c4[_0x7126('0x5')]]['queuecallerabandonAt']=null;queues[_0x4a74c4[_0x7126('0x5')]][_0x7126('0x1c')]=!![];queues[_0x4a74c4[_0x7126('0x5')]]['queuecallerexitAt']=utils[_0x7126('0x16')]();queues[_0x4a74c4[_0x7126('0x5')]]['queuecallerexitreason']=_0x7126('0x29');utils[_0x7126('0x2')](util[_0x7126('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4a74c4[_0x7126('0x5')],queues[_0x4a74c4['uniqueid']][_0x7126('0x1e')],_0x4a74c4[_0x7126('0x23')],queues[_0x4a74c4['uniqueid']][_0x7126('0xa')]));}}}catch(_0x153c44){utils[_0x7126('0x17')](util[_0x7126('0x3')](_0x7126('0x20'),_0x4a74c4[_0x7126('0x5')]),_0x153c44);}};exports[_0x7126('0x1b')]=function(_0x59d293){try{if(!_[_0x7126('0x19')](queues[_0x59d293[_0x7126('0x5')]])){utils[_0x7126('0x12')](util[_0x7126('0x3')](_0x7126('0x2a'),_0x59d293[_0x7126('0x5')]),_0x59d293);queues[_0x59d293[_0x7126('0x5')]][_0x7126('0x1c')]=![];queues[_0x59d293[_0x7126('0x5')]][_0x7126('0x26')]=null;queues[_0x59d293[_0x7126('0x5')]]['queuecallerabandon']=!![];queues[_0x59d293[_0x7126('0x5')]][_0x7126('0x25')]=utils[_0x7126('0x16')]();queues[_0x59d293[_0x7126('0x5')]][_0x7126('0xa')]=_0x7126('0x2b');utils[_0x7126('0x2')](util[_0x7126('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x59d293[_0x7126('0x5')],queues[_0x59d293['uniqueid']][_0x7126('0x1e')],queues[_0x59d293[_0x7126('0x5')]][_0x7126('0xa')]));}}catch(_0xf825d9){utils[_0x7126('0x17')](util[_0x7126('0x3')](_0x7126('0x2a'),_0x59d293['uniqueid']),_0xf825d9);}};exports[_0x7126('0x2c')]=function(_0x2371de){try{if(!_[_0x7126('0x19')](queues[_0x2371de['uniqueid']])){utils[_0x7126('0x12')](util[_0x7126('0x3')]('[%s][queues][queuecallerleave]',_0x2371de[_0x7126('0x5')]),_0x2371de);utils[_0x7126('0x2')](util['format'](_0x7126('0x2d'),_0x2371de[_0x7126('0x5')],queues[_0x2371de[_0x7126('0x5')]][_0x7126('0x1e')],_0x2371de[_0x7126('0x2e')],_0x2371de[_0x7126('0x2f')]));queues[_0x2371de[_0x7126('0x5')]][_0x7126('0x2c')]=!![];queues[_0x2371de[_0x7126('0x5')]][_0x7126('0x30')]=utils[_0x7126('0x16')]();queues[_0x2371de[_0x7126('0x5')]]['holdtime']=utils[_0x7126('0x31')](queues[_0x2371de[_0x7126('0x5')]]['queuecallerleaveAt'],queues[_0x2371de[_0x7126('0x5')]]['queuecallerjoinAt']);queues[_0x2371de[_0x7126('0x5')]][_0x7126('0x32')]=_0x2371de[_0x7126('0x32')];queues[_0x2371de[_0x7126('0x5')]][_0x7126('0x33')]=_0x2371de[_0x7126('0x33')];queues[_0x2371de[_0x7126('0x5')]][_0x7126('0x2e')]=_0x2371de[_0x7126('0x2e')];queues[_0x2371de[_0x7126('0x5')]][_0x7126('0x2f')]=_0x2371de[_0x7126('0x2f')];}}catch(_0x17e123){utils[_0x7126('0x17')](util[_0x7126('0x3')](_0x7126('0x34'),_0x2371de[_0x7126('0x5')]),_0x17e123);}};exports['agentconnect']=function(_0x5b443f){try{if(!_[_0x7126('0x19')](queues[_0x5b443f['uniqueid']])){utils[_0x7126('0x12')](util[_0x7126('0x3')](_0x7126('0x35'),_0x5b443f['uniqueid']),_0x5b443f);utils['info'](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5b443f[_0x7126('0x5')],queues[_0x5b443f[_0x7126('0x5')]][_0x7126('0x1e')],_0x5b443f[_0x7126('0x36')],_0x5b443f[_0x7126('0x37')]));queues[_0x5b443f[_0x7126('0x5')]][_0x7126('0x1b')]=![];queues[_0x5b443f[_0x7126('0x5')]][_0x7126('0x1b')]=![];queues[_0x5b443f['uniqueid']][_0x7126('0x25')]=null;queues[_0x5b443f[_0x7126('0x5')]][_0x7126('0x1c')]=![];queues[_0x5b443f[_0x7126('0x5')]][_0x7126('0xa')]=null;queues[_0x5b443f[_0x7126('0x5')]][_0x7126('0x26')]=null;queues[_0x5b443f['uniqueid']][_0x7126('0x38')]=!![];queues[_0x5b443f['uniqueid']]['accountcode']=_0x5b443f[_0x7126('0x37')];queues[_0x5b443f[_0x7126('0x5')]][_0x7126('0x8')]=_0x5b443f[_0x7126('0x36')];}}catch(_0x2d59d6){utils['error'](util[_0x7126('0x3')](_0x7126('0x35'),_0x5b443f[_0x7126('0x5')]),_0x2d59d6);}};exports[_0x7126('0x39')]=function(_0xdcc04b){try{if(!_[_0x7126('0x19')](queues[_0xdcc04b['uniqueid']])){if(queues[_0xdcc04b[_0x7126('0x5')]][_0x7126('0x30')]){utils['debug'](util[_0x7126('0x3')](_0x7126('0x3a'),_0xdcc04b[_0x7126('0x5')]),_0xdcc04b);queues[_0xdcc04b[_0x7126('0x5')]]['queuecallerabandon']=![];queues[_0xdcc04b[_0x7126('0x5')]][_0x7126('0x1b')]=![];queues[_0xdcc04b[_0x7126('0x5')]][_0x7126('0x25')]=null;queues[_0xdcc04b['uniqueid']][_0x7126('0x1c')]=![];queues[_0xdcc04b['uniqueid']][_0x7126('0x26')]=null;queues[_0xdcc04b[_0x7126('0x5')]][_0x7126('0x38')]=!![];queues[_0xdcc04b[_0x7126('0x5')]][_0x7126('0x8')]=_0xdcc04b[_0x7126('0x36')];queues[_0xdcc04b[_0x7126('0x5')]][_0x7126('0x3b')]=!![];queues[_0xdcc04b[_0x7126('0x5')]][_0x7126('0x3c')]=utils[_0x7126('0x16')]();if(_0xdcc04b[_0x7126('0x3d')]=='transfer'){if(!queues[_0xdcc04b['uniqueid']][_0x7126('0x3e')]){queues[_0xdcc04b[_0x7126('0x5')]]['queuecallerexitreason']=_0x7126('0x3f');}}else{queues[_0xdcc04b['uniqueid']][_0x7126('0xa')]='COMPLETEDBY'+_0xdcc04b[_0x7126('0x3d')][_0x7126('0x27')]();}utils[_0x7126('0x2')](util[_0x7126('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0xdcc04b[_0x7126('0x5')],queues[_0xdcc04b[_0x7126('0x5')]]['name'],_0xdcc04b[_0x7126('0x36')],queues[_0xdcc04b[_0x7126('0x5')]]['queuecallerexitreason']));writeDB(queues[_0xdcc04b[_0x7126('0x5')]]);}}}catch(_0x110beb){utils[_0x7126('0x17')](util[_0x7126('0x3')](_0x7126('0x3a'),_0xdcc04b['uniqueid']),_0x110beb);}};exports['blindtransfer']=function(_0x5d1e5d){try{if(!_['isNil'](queues[_0x5d1e5d[_0x7126('0x40')]])){utils[_0x7126('0x12')](util[_0x7126('0x3')]('[%s][queues][blindtransfer]',_0x5d1e5d[_0x7126('0x5')]),_0x5d1e5d);queues[_0x5d1e5d['transfereeuniqueid']][_0x7126('0x3e')]=!![];queues[_0x5d1e5d[_0x7126('0x40')]][_0x7126('0x41')]=_0x7126('0x42');queues[_0x5d1e5d['transfereeuniqueid']][_0x7126('0x43')]=_0x5d1e5d['extension'];queues[_0x5d1e5d[_0x7126('0x40')]][_0x7126('0x44')]=_0x5d1e5d[_0x7126('0x40')];queues[_0x5d1e5d['transfereeuniqueid']][_0x7126('0xa')]=_0x7126('0x45');utils[_0x7126('0x2')](util['format'](_0x7126('0x46'),_0x5d1e5d[_0x7126('0x5')],queues[_0x5d1e5d[_0x7126('0x40')]][_0x7126('0x1e')],_0x5d1e5d['transfereeuniqueid'],_0x5d1e5d['extension']));}}catch(_0x549671){utils[_0x7126('0x17')](util[_0x7126('0x3')](_0x7126('0x47'),_0x5d1e5d[_0x7126('0x5')]),_0x549671);}};exports[_0x7126('0x48')]=function(_0xa991d1){try{utils[_0x7126('0x12')](util[_0x7126('0x3')]('[%s][queues][attendedtransfer]',_0xa991d1[_0x7126('0x49')]),_0xa991d1);if(_0xa991d1[_0x7126('0x49')]==_0xa991d1[_0x7126('0x4a')]){if(!_['isNil'](queues[_0xa991d1[_0x7126('0x4b')]])){utils[_0x7126('0x2')](util[_0x7126('0x3')](_0x7126('0x4c'),_0xa991d1[_0x7126('0x49')],queues[_0xa991d1[_0x7126('0x4b')]][_0x7126('0x1e')],_0xa991d1[_0x7126('0x4d')]));queues[_0xa991d1['secondtransfererlinkedid']]['transfer']=!![];queues[_0xa991d1[_0x7126('0x4b')]][_0x7126('0x41')]=_0x7126('0x4e');queues[_0xa991d1['secondtransfererlinkedid']]['transferexten']=_0xa991d1[_0x7126('0x4d')];queues[_0xa991d1[_0x7126('0x4b')]]['transferuniqueid']=_0xa991d1[_0x7126('0x49')];queues[_0xa991d1[_0x7126('0x4b')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x7126('0x19')](queues[_0xa991d1['origtransfererlinkedid']])){if(_0xa991d1['transfereelinkedid']&&queues[_0xa991d1[_0x7126('0x4f')]]){queues[_0xa991d1['transfereelinkedid']][_0x7126('0x50')]=0x1;queues[_0xa991d1[_0x7126('0x40')]]=_[_0x7126('0x51')](queues[_0xa991d1['transfereelinkedid']]);queues[_0xa991d1[_0x7126('0x40')]]['transfereduniqueid']=_0xa991d1[_0x7126('0x52')];queues[_0xa991d1[_0x7126('0x40')]][_0x7126('0x50')]=0x2;queues[_0xa991d1['transfereeuniqueid']][_0x7126('0x53')]=queues[_0xa991d1['secondtransfererlinkedid']][_0x7126('0x53')];queues[_0xa991d1[_0x7126('0x40')]]['calleridname']=queues[_0xa991d1[_0x7126('0x4b')]][_0x7126('0x54')];queues[_0xa991d1['transfereeuniqueid']][_0x7126('0x55')]=utils[_0x7126('0x16')]();queues[_0xa991d1[_0x7126('0x40')]][_0x7126('0x30')]=utils['now']();queues[_0xa991d1[_0x7126('0x40')]][_0x7126('0x56')]=0x0;queues[_0xa991d1[_0x7126('0x40')]][_0x7126('0x57')]=0x0;utils['info'](util[_0x7126('0x3')](_0x7126('0x58'),_0xa991d1[_0x7126('0x49')],queues[_0xa991d1[_0x7126('0x40')]][_0x7126('0x1e')],queues[_0xa991d1[_0x7126('0x40')]][_0x7126('0x53')],queues[_0xa991d1['transfereeuniqueid']][_0x7126('0x54')]));}else{utils[_0x7126('0x2')](util[_0x7126('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xa991d1['origtransfereruniqueid'],queues[_0xa991d1[_0x7126('0x4a')]][_0x7126('0x1e')],_0xa991d1[_0x7126('0x4b')]));queues[_0xa991d1[_0x7126('0x4a')]]['transfereduniqueid']=_0xa991d1['secondtransfererlinkedid'];}}}else if(_0xa991d1[_0x7126('0x59')]==_0xa991d1['secondtransfererlinkedid']){if(!_[_0x7126('0x19')](queues[_0xa991d1[_0x7126('0x4a')]])){utils[_0x7126('0x2')](util[_0x7126('0x3')](_0x7126('0x5a'),_0xa991d1['origtransfereruniqueid'],queues[_0xa991d1[_0x7126('0x4a')]]['name'],_0xa991d1[_0x7126('0x59')],_0xa991d1[_0x7126('0x5b')]));queues[_0xa991d1['origtransfererlinkedid']][_0x7126('0x3e')]=!![];queues[_0xa991d1[_0x7126('0x4a')]]['transfertype']=_0x7126('0x4e');queues[_0xa991d1['origtransfererlinkedid']][_0x7126('0x43')]=_0xa991d1[_0x7126('0x5b')];queues[_0xa991d1['origtransfererlinkedid']][_0x7126('0x44')]=_0xa991d1[_0x7126('0x59')];queues[_0xa991d1[_0x7126('0x4a')]]['queuecallerexitreason']=_0x7126('0x5c');}if(!_[_0x7126('0x19')](queues[_0xa991d1['secondtransfererlinkedid']])){if(_0xa991d1[_0x7126('0x5d')]&&queues[_0xa991d1['transfertargetlinkedid']]){queues[_0xa991d1[_0x7126('0x5d')]][_0x7126('0x50')]=0x1;queues[_0xa991d1[_0x7126('0x52')]]=_['clone'](queues[_0xa991d1[_0x7126('0x5d')]]);queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x10')]=_0xa991d1[_0x7126('0x52')];queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x50')]=0x2;queues[_0xa991d1['transfertargetuniqueid']]['calleridnum']=queues[_0xa991d1[_0x7126('0x4a')]][_0x7126('0x53')];queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x54')]=queues[_0xa991d1[_0x7126('0x4a')]][_0x7126('0x54')];queues[_0xa991d1['transfertargetuniqueid']][_0x7126('0x55')]=utils[_0x7126('0x16')]();queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x30')]=utils[_0x7126('0x16')]();queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x56')]=0x0;queues[_0xa991d1['transfertargetuniqueid']][_0x7126('0x57')]=0x0;utils[_0x7126('0x2')](util[_0x7126('0x3')](_0x7126('0x5e'),_0xa991d1[_0x7126('0x49')],queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x1e')],queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x10')],queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x53')],queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x54')]));}else{utils[_0x7126('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xa991d1['origtransfereruniqueid'],queues[_0xa991d1[_0x7126('0x4b')]]['name'],_0xa991d1['origtransfererlinkedid']));queues[_0xa991d1['secondtransfererlinkedid']][_0x7126('0x10')]=_0xa991d1[_0x7126('0x4a')];}}}}catch(_0x2e5169){utils[_0x7126('0x17')](util[_0x7126('0x3')](_0x7126('0x5f'),_0xa991d1[_0x7126('0x49')]),_0x2e5169);}};exports[_0x7126('0x60')]=function(_0x44a638){try{if(!_[_0x7126('0x19')](queues[_0x44a638[_0x7126('0x5')]])){utils[_0x7126('0x12')](util[_0x7126('0x3')](_0x7126('0x61'),_0x44a638[_0x7126('0x5')]),_0x44a638);queues[_0x44a638[_0x7126('0x5')]][_0x7126('0x62')]=utils[_0x7126('0x16')]();utils['info'](util[_0x7126('0x3')](_0x7126('0x63'),_0x44a638[_0x7126('0x5')],queues[_0x44a638['uniqueid']]['name'],queues[_0x44a638[_0x7126('0x5')]]['musiconholdstartAt']));}}catch(_0x5dd0bf){utils[_0x7126('0x17')](util[_0x7126('0x3')](_0x7126('0x61'),_0x44a638[_0x7126('0x5')]),_0x5dd0bf);}};exports[_0x7126('0x64')]=function(_0x30993a){try{if(!_[_0x7126('0x19')](queues[_0x30993a[_0x7126('0x5')]])){if(!_[_0x7126('0x19')](queues[_0x30993a[_0x7126('0x5')]][_0x7126('0x62')])){utils[_0x7126('0x12')](util[_0x7126('0x3')](_0x7126('0x65'),_0x30993a[_0x7126('0x5')]),_0x30993a);queues[_0x30993a[_0x7126('0x5')]][_0x7126('0x57')]+=utils['diffTime'](utils[_0x7126('0x16')](),queues[_0x30993a[_0x7126('0x5')]]['musiconholdstartAt']);utils[_0x7126('0x2')](util['format'](_0x7126('0x66'),_0x30993a[_0x7126('0x5')],queues[_0x30993a[_0x7126('0x5')]][_0x7126('0x1e')],queues[_0x30993a['uniqueid']][_0x7126('0x57')]));delete queues[_0x30993a[_0x7126('0x5')]][_0x7126('0x62')];}}}catch(_0x471457){utils['error'](util[_0x7126('0x3')]('[%s][queues][musiconholdstop]',_0x30993a[_0x7126('0x5')]),_0x471457);}}; \ No newline at end of file +var _0xe9ef=['toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','error','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfer','transfertype','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','transferexten','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','format','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','variable','queuestatus','value','isNil','queuecallerexit','queuecallerexitAt'];(function(_0x1090f4,_0x24bccc){var _0x3d8962=function(_0x4d0cc5){while(--_0x4d0cc5){_0x1090f4['push'](_0x1090f4['shift']());}};_0x3d8962(++_0x24bccc);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x4fdc46,_0x2a3759){_0x4fdc46=_0x4fdc46-0x0;var _0x2c178a=_0xe9ef[_0x4fdc46];return _0x2c178a;};'use strict';var _=require(_0xfe9e('0x0'));var util=require('util');var utils=require(_0xfe9e('0x1'));var queues={};function writeDB(_0x15d1f4){utils['info'](util[_0xfe9e('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x15d1f4[_0xfe9e('0x3')],_0x15d1f4[_0xfe9e('0x4')],_0x15d1f4[_0xfe9e('0x5')],_0x15d1f4[_0xfe9e('0x6')],_0x15d1f4['calleridnum'],_0x15d1f4[_0xfe9e('0x7')],_0x15d1f4[_0xfe9e('0x8')]));if(_0x15d1f4['queue']){utils['getVoiceQueueByName'](_0x15d1f4[_0xfe9e('0x5')])['then'](function(_0x4325a6){if(_0x4325a6){_0x15d1f4[_0xfe9e('0x9')]=_0x4325a6[_0xfe9e('0x9')];}utils['request'](_0xfe9e('0xa'),_0x15d1f4);});}else{utils[_0xfe9e('0xb')](_0xfe9e('0xa'),_0x15d1f4);}if(_0x15d1f4['transfereduniqueid']){delete queues[_0x15d1f4[_0xfe9e('0xc')]];}else{delete queues[_0x15d1f4['uniqueid']];}}exports[_0xfe9e('0xd')]=function(_0x318158){try{utils[_0xfe9e('0xe')](util[_0xfe9e('0x2')](_0xfe9e('0xf'),_0x318158[_0xfe9e('0x3')]),_0x318158);utils[_0xfe9e('0x10')](util[_0xfe9e('0x2')](_0xfe9e('0x11'),_0x318158['uniqueid'],_0x318158[_0xfe9e('0x5')],_0x318158[_0xfe9e('0x12')]));queues[_0x318158['uniqueid']]=_[_0xfe9e('0x13')](_0x318158,{'originalposition':_0x318158[_0xfe9e('0x12')],'queuecallerjoinAt':utils[_0xfe9e('0x14')](),'mohtime':0x0});}catch(_0x3f5f68){utils['error'](util['format'](_0xfe9e('0xf'),_0x318158[_0xfe9e('0x3')]),_0x3f5f68);}};exports[_0xfe9e('0x15')]=function(_0x30ad77){try{if(!_['isNil'](queues[_0x30ad77[_0xfe9e('0x3')]])){utils[_0xfe9e('0xe')](util[_0xfe9e('0x2')](_0xfe9e('0x16'),_0x30ad77['uniqueid']),_0x30ad77);if(queues[_0x30ad77[_0xfe9e('0x3')]][_0xfe9e('0x17')]){if(!queues[_0x30ad77[_0xfe9e('0x3')]][_0xfe9e('0x18')]&&!queues[_0x30ad77[_0xfe9e('0x3')]]['queuecallerexit']){queues[_0x30ad77['uniqueid']][_0xfe9e('0x19')]=!![];queues[_0x30ad77[_0xfe9e('0x3')]][_0xfe9e('0x1a')]=utils[_0xfe9e('0x14')]();queues[_0x30ad77[_0xfe9e('0x3')]][_0xfe9e('0x8')]=_0xfe9e('0x1b');}utils[_0xfe9e('0x10')](util[_0xfe9e('0x2')](_0xfe9e('0x1c'),_0x30ad77[_0xfe9e('0x3')],queues[_0x30ad77[_0xfe9e('0x3')]]['name'],queues[_0x30ad77[_0xfe9e('0x3')]][_0xfe9e('0x8')]));writeDB(queues[_0x30ad77['uniqueid']]);}else if(queues[_0x30ad77[_0xfe9e('0x3')]]['transfereduniqueid']){utils[_0xfe9e('0x10')](util[_0xfe9e('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x30ad77[_0xfe9e('0x3')],queues[_0x30ad77[_0xfe9e('0x3')]][_0xfe9e('0x1d')],queues[_0x30ad77[_0xfe9e('0x3')]][_0xfe9e('0xc')]));queues[queues[_0x30ad77[_0xfe9e('0x3')]][_0xfe9e('0xc')]]=queues[_0x30ad77[_0xfe9e('0x3')]];queues[queues[_0x30ad77[_0xfe9e('0x3')]][_0xfe9e('0xc')]][_0xfe9e('0x1e')]=0x2;delete queues[_0x30ad77[_0xfe9e('0x3')]];}}}catch(_0x1595a5){utils['error'](util['format'](_0xfe9e('0x16'),_0x30ad77[_0xfe9e('0x3')]),_0x1595a5);}};exports[_0xfe9e('0x1f')]=function(_0x11be5f){try{utils['debug'](util[_0xfe9e('0x2')]('[%s][queues][varset]',_0x11be5f['uniqueid']),_0x11be5f);if(!_['isNil'](_0x11be5f[_0xfe9e('0x20')][_0xfe9e('0x21')])&&_0x11be5f[_0xfe9e('0x22')]['toUpperCase']()!=='CONTINUE'){if(!_[_0xfe9e('0x23')](queues[_0x11be5f[_0xfe9e('0x3')]])){queues[_0x11be5f[_0xfe9e('0x3')]][_0xfe9e('0x18')]=![];queues[_0x11be5f[_0xfe9e('0x3')]]['queuecallerabandonAt']=null;queues[_0x11be5f['uniqueid']][_0xfe9e('0x24')]=!![];queues[_0x11be5f[_0xfe9e('0x3')]][_0xfe9e('0x25')]=utils[_0xfe9e('0x14')]();queues[_0x11be5f[_0xfe9e('0x3')]][_0xfe9e('0x8')]=_0x11be5f[_0xfe9e('0x22')][_0xfe9e('0x26')]();utils['info'](util[_0xfe9e('0x2')](_0xfe9e('0x27'),_0x11be5f[_0xfe9e('0x3')],queues[_0x11be5f['uniqueid']][_0xfe9e('0x1d')],_0x11be5f[_0xfe9e('0x22')],queues[_0x11be5f['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x11be5f[_0xfe9e('0x3')]]);}}else if(!_[_0xfe9e('0x23')](_0x11be5f[_0xfe9e('0x20')][_0xfe9e('0x28')])){if(!_[_0xfe9e('0x23')](queues[_0x11be5f[_0xfe9e('0x3')]])&&!queues[_0x11be5f[_0xfe9e('0x3')]]['queuecallerabandon']){queues[_0x11be5f['uniqueid']][_0xfe9e('0x18')]=![];queues[_0x11be5f[_0xfe9e('0x3')]][_0xfe9e('0x29')]=null;queues[_0x11be5f[_0xfe9e('0x3')]][_0xfe9e('0x24')]=!![];queues[_0x11be5f[_0xfe9e('0x3')]][_0xfe9e('0x25')]=utils['now']();queues[_0x11be5f[_0xfe9e('0x3')]]['queuecallerexitreason']=_0xfe9e('0x2a');utils['info'](util[_0xfe9e('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x11be5f[_0xfe9e('0x3')],queues[_0x11be5f[_0xfe9e('0x3')]][_0xfe9e('0x1d')],_0x11be5f[_0xfe9e('0x22')],queues[_0x11be5f[_0xfe9e('0x3')]][_0xfe9e('0x8')]));}}}catch(_0x58e703){utils['error'](util[_0xfe9e('0x2')]('[%s][queues][varset]',_0x11be5f[_0xfe9e('0x3')]),_0x58e703);}};exports[_0xfe9e('0x18')]=function(_0x51f709){try{if(!_[_0xfe9e('0x23')](queues[_0x51f709[_0xfe9e('0x3')]])){utils[_0xfe9e('0xe')](util[_0xfe9e('0x2')](_0xfe9e('0x2b'),_0x51f709['uniqueid']),_0x51f709);queues[_0x51f709[_0xfe9e('0x3')]][_0xfe9e('0x24')]=![];queues[_0x51f709[_0xfe9e('0x3')]][_0xfe9e('0x25')]=null;queues[_0x51f709[_0xfe9e('0x3')]][_0xfe9e('0x18')]=!![];queues[_0x51f709[_0xfe9e('0x3')]][_0xfe9e('0x29')]=utils[_0xfe9e('0x14')]();queues[_0x51f709['uniqueid']][_0xfe9e('0x8')]=_0xfe9e('0x2c');utils[_0xfe9e('0x10')](util[_0xfe9e('0x2')](_0xfe9e('0x2d'),_0x51f709['uniqueid'],queues[_0x51f709[_0xfe9e('0x3')]][_0xfe9e('0x1d')],queues[_0x51f709[_0xfe9e('0x3')]][_0xfe9e('0x8')]));}}catch(_0xfb551f){utils['error'](util[_0xfe9e('0x2')](_0xfe9e('0x2b'),_0x51f709[_0xfe9e('0x3')]),_0xfb551f);}};exports[_0xfe9e('0x2e')]=function(_0x3cda45){try{if(!_[_0xfe9e('0x23')](queues[_0x3cda45['uniqueid']])){utils['debug'](util[_0xfe9e('0x2')](_0xfe9e('0x2f'),_0x3cda45[_0xfe9e('0x3')]),_0x3cda45);utils[_0xfe9e('0x10')](util[_0xfe9e('0x2')](_0xfe9e('0x30'),_0x3cda45['uniqueid'],queues[_0x3cda45['uniqueid']][_0xfe9e('0x1d')],_0x3cda45[_0xfe9e('0x31')],_0x3cda45[_0xfe9e('0x32')]));queues[_0x3cda45['uniqueid']][_0xfe9e('0x2e')]=!![];queues[_0x3cda45[_0xfe9e('0x3')]][_0xfe9e('0x17')]=utils[_0xfe9e('0x14')]();queues[_0x3cda45['uniqueid']][_0xfe9e('0x33')]=utils[_0xfe9e('0x34')](queues[_0x3cda45[_0xfe9e('0x3')]][_0xfe9e('0x17')],queues[_0x3cda45[_0xfe9e('0x3')]]['queuecallerjoinAt']);queues[_0x3cda45[_0xfe9e('0x3')]][_0xfe9e('0x12')]=_0x3cda45[_0xfe9e('0x12')];queues[_0x3cda45[_0xfe9e('0x3')]]['count']=_0x3cda45['count'];queues[_0x3cda45[_0xfe9e('0x3')]][_0xfe9e('0x31')]=_0x3cda45[_0xfe9e('0x31')];queues[_0x3cda45[_0xfe9e('0x3')]][_0xfe9e('0x32')]=_0x3cda45[_0xfe9e('0x32')];}}catch(_0x3e4acd){utils[_0xfe9e('0x35')](util[_0xfe9e('0x2')](_0xfe9e('0x2f'),_0x3cda45[_0xfe9e('0x3')]),_0x3e4acd);}};exports[_0xfe9e('0x36')]=function(_0x4caa65){try{if(!_['isNil'](queues[_0x4caa65[_0xfe9e('0x3')]])){utils['debug'](util['format'](_0xfe9e('0x37'),_0x4caa65[_0xfe9e('0x3')]),_0x4caa65);utils[_0xfe9e('0x10')](util[_0xfe9e('0x2')](_0xfe9e('0x38'),_0x4caa65[_0xfe9e('0x3')],queues[_0x4caa65['uniqueid']]['name'],_0x4caa65[_0xfe9e('0x39')],_0x4caa65[_0xfe9e('0x3a')]));queues[_0x4caa65[_0xfe9e('0x3')]][_0xfe9e('0x18')]=![];queues[_0x4caa65[_0xfe9e('0x3')]][_0xfe9e('0x18')]=![];queues[_0x4caa65[_0xfe9e('0x3')]][_0xfe9e('0x29')]=null;queues[_0x4caa65['uniqueid']]['queuecallerexit']=![];queues[_0x4caa65[_0xfe9e('0x3')]][_0xfe9e('0x8')]=null;queues[_0x4caa65[_0xfe9e('0x3')]][_0xfe9e('0x25')]=null;queues[_0x4caa65[_0xfe9e('0x3')]][_0xfe9e('0x3b')]=!![];queues[_0x4caa65[_0xfe9e('0x3')]][_0xfe9e('0x7')]=_0x4caa65[_0xfe9e('0x3a')];queues[_0x4caa65[_0xfe9e('0x3')]][_0xfe9e('0x6')]=_0x4caa65[_0xfe9e('0x39')];}}catch(_0x41ae0a){utils[_0xfe9e('0x35')](util[_0xfe9e('0x2')](_0xfe9e('0x37'),_0x4caa65['uniqueid']),_0x41ae0a);}};exports[_0xfe9e('0x3c')]=function(_0x36f0af){try{if(!_['isNil'](queues[_0x36f0af[_0xfe9e('0x3')]])){if(queues[_0x36f0af[_0xfe9e('0x3')]][_0xfe9e('0x17')]){utils[_0xfe9e('0xe')](util['format'](_0xfe9e('0x3d'),_0x36f0af['uniqueid']),_0x36f0af);queues[_0x36f0af[_0xfe9e('0x3')]][_0xfe9e('0x18')]=![];queues[_0x36f0af[_0xfe9e('0x3')]][_0xfe9e('0x18')]=![];queues[_0x36f0af[_0xfe9e('0x3')]]['queuecallerabandonAt']=null;queues[_0x36f0af['uniqueid']][_0xfe9e('0x24')]=![];queues[_0x36f0af['uniqueid']][_0xfe9e('0x25')]=null;queues[_0x36f0af[_0xfe9e('0x3')]][_0xfe9e('0x3b')]=!![];queues[_0x36f0af[_0xfe9e('0x3')]][_0xfe9e('0x6')]=_0x36f0af[_0xfe9e('0x39')];queues[_0x36f0af[_0xfe9e('0x3')]][_0xfe9e('0x19')]=!![];queues[_0x36f0af[_0xfe9e('0x3')]]['queuecallercompleteAt']=utils[_0xfe9e('0x14')]();if(_0x36f0af['reason']=='transfer'){if(!queues[_0x36f0af['uniqueid']]['transfer']){queues[_0x36f0af[_0xfe9e('0x3')]]['queuecallerexitreason']=_0xfe9e('0x3e');}}else{queues[_0x36f0af['uniqueid']]['queuecallerexitreason']=_0xfe9e('0x3f')+_0x36f0af[_0xfe9e('0x40')][_0xfe9e('0x26')]();}utils[_0xfe9e('0x10')](util[_0xfe9e('0x2')](_0xfe9e('0x41'),_0x36f0af[_0xfe9e('0x3')],queues[_0x36f0af[_0xfe9e('0x3')]][_0xfe9e('0x1d')],_0x36f0af[_0xfe9e('0x39')],queues[_0x36f0af[_0xfe9e('0x3')]][_0xfe9e('0x8')]));writeDB(queues[_0x36f0af[_0xfe9e('0x3')]]);}}}catch(_0x3be095){utils[_0xfe9e('0x35')](util[_0xfe9e('0x2')](_0xfe9e('0x3d'),_0x36f0af[_0xfe9e('0x3')]),_0x3be095);}};exports[_0xfe9e('0x42')]=function(_0x2e01c2){try{if(!_[_0xfe9e('0x23')](queues[_0x2e01c2[_0xfe9e('0x43')]])){utils[_0xfe9e('0xe')](util[_0xfe9e('0x2')](_0xfe9e('0x44'),_0x2e01c2[_0xfe9e('0x3')]),_0x2e01c2);queues[_0x2e01c2[_0xfe9e('0x43')]][_0xfe9e('0x45')]=!![];queues[_0x2e01c2['transfereeuniqueid']][_0xfe9e('0x46')]='BLIND';queues[_0x2e01c2[_0xfe9e('0x43')]]['transferexten']=_0x2e01c2[_0xfe9e('0x47')];queues[_0x2e01c2[_0xfe9e('0x43')]][_0xfe9e('0x48')]=_0x2e01c2[_0xfe9e('0x43')];queues[_0x2e01c2[_0xfe9e('0x43')]][_0xfe9e('0x8')]='BLINDTRANSFER';utils[_0xfe9e('0x10')](util['format'](_0xfe9e('0x49'),_0x2e01c2[_0xfe9e('0x3')],queues[_0x2e01c2[_0xfe9e('0x43')]]['name'],_0x2e01c2[_0xfe9e('0x43')],_0x2e01c2[_0xfe9e('0x47')]));}}catch(_0x232c73){utils[_0xfe9e('0x35')](util[_0xfe9e('0x2')](_0xfe9e('0x44'),_0x2e01c2[_0xfe9e('0x3')]),_0x232c73);}};exports['attendedtransfer']=function(_0x5b1eb3){try{utils[_0xfe9e('0xe')](util[_0xfe9e('0x2')]('[%s][queues][attendedtransfer]',_0x5b1eb3['origtransfereruniqueid']),_0x5b1eb3);if(_0x5b1eb3[_0xfe9e('0x4a')]==_0x5b1eb3[_0xfe9e('0x4b')]){if(!_['isNil'](queues[_0x5b1eb3[_0xfe9e('0x4c')]])){utils[_0xfe9e('0x10')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x5b1eb3['origtransfereruniqueid'],queues[_0x5b1eb3['secondtransfererlinkedid']]['name'],_0x5b1eb3['origtransfererexten']));queues[_0x5b1eb3[_0xfe9e('0x4c')]][_0xfe9e('0x45')]=!![];queues[_0x5b1eb3[_0xfe9e('0x4c')]][_0xfe9e('0x46')]='ATTENDED';queues[_0x5b1eb3[_0xfe9e('0x4c')]][_0xfe9e('0x4d')]=_0x5b1eb3[_0xfe9e('0x4e')];queues[_0x5b1eb3[_0xfe9e('0x4c')]][_0xfe9e('0x48')]=_0x5b1eb3[_0xfe9e('0x4a')];queues[_0x5b1eb3[_0xfe9e('0x4c')]][_0xfe9e('0x8')]=_0xfe9e('0x4f');}if(!_[_0xfe9e('0x23')](queues[_0x5b1eb3[_0xfe9e('0x4b')]])){if(_0x5b1eb3[_0xfe9e('0x50')]&&queues[_0x5b1eb3['transfereelinkedid']]){queues[_0x5b1eb3[_0xfe9e('0x50')]][_0xfe9e('0x1e')]=0x1;queues[_0x5b1eb3[_0xfe9e('0x43')]]=_[_0xfe9e('0x51')](queues[_0x5b1eb3[_0xfe9e('0x50')]]);queues[_0x5b1eb3[_0xfe9e('0x43')]][_0xfe9e('0xc')]=_0x5b1eb3[_0xfe9e('0x52')];queues[_0x5b1eb3['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x5b1eb3[_0xfe9e('0x43')]][_0xfe9e('0x53')]=queues[_0x5b1eb3[_0xfe9e('0x4c')]][_0xfe9e('0x53')];queues[_0x5b1eb3['transfereeuniqueid']][_0xfe9e('0x54')]=queues[_0x5b1eb3[_0xfe9e('0x4c')]][_0xfe9e('0x54')];queues[_0x5b1eb3[_0xfe9e('0x43')]][_0xfe9e('0x55')]=utils[_0xfe9e('0x14')]();queues[_0x5b1eb3[_0xfe9e('0x43')]][_0xfe9e('0x17')]=utils['now']();queues[_0x5b1eb3[_0xfe9e('0x43')]][_0xfe9e('0x33')]=0x0;queues[_0x5b1eb3[_0xfe9e('0x43')]][_0xfe9e('0x56')]=0x0;utils['info'](util[_0xfe9e('0x2')](_0xfe9e('0x57'),_0x5b1eb3[_0xfe9e('0x4a')],queues[_0x5b1eb3[_0xfe9e('0x43')]][_0xfe9e('0x1d')],queues[_0x5b1eb3[_0xfe9e('0x43')]]['calleridnum'],queues[_0x5b1eb3[_0xfe9e('0x43')]][_0xfe9e('0x54')]));}else{utils[_0xfe9e('0x10')](util[_0xfe9e('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5b1eb3['origtransfereruniqueid'],queues[_0x5b1eb3[_0xfe9e('0x4b')]]['name'],_0x5b1eb3['secondtransfererlinkedid']));queues[_0x5b1eb3[_0xfe9e('0x4b')]][_0xfe9e('0xc')]=_0x5b1eb3[_0xfe9e('0x4c')];}}}else if(_0x5b1eb3[_0xfe9e('0x58')]==_0x5b1eb3[_0xfe9e('0x4c')]){if(!_[_0xfe9e('0x23')](queues[_0x5b1eb3[_0xfe9e('0x4b')]])){utils[_0xfe9e('0x10')](util[_0xfe9e('0x2')](_0xfe9e('0x59'),_0x5b1eb3['origtransfereruniqueid'],queues[_0x5b1eb3[_0xfe9e('0x4b')]][_0xfe9e('0x1d')],_0x5b1eb3['secondtransfereruniqueid'],_0x5b1eb3[_0xfe9e('0x5a')]));queues[_0x5b1eb3['origtransfererlinkedid']][_0xfe9e('0x45')]=!![];queues[_0x5b1eb3['origtransfererlinkedid']]['transfertype']=_0xfe9e('0x5b');queues[_0x5b1eb3['origtransfererlinkedid']][_0xfe9e('0x4d')]=_0x5b1eb3[_0xfe9e('0x5a')];queues[_0x5b1eb3[_0xfe9e('0x4b')]][_0xfe9e('0x48')]=_0x5b1eb3[_0xfe9e('0x58')];queues[_0x5b1eb3[_0xfe9e('0x4b')]]['queuecallerexitreason']=_0xfe9e('0x4f');}if(!_[_0xfe9e('0x23')](queues[_0x5b1eb3[_0xfe9e('0x4c')]])){if(_0x5b1eb3['transfertargetlinkedid']&&queues[_0x5b1eb3['transfertargetlinkedid']]){queues[_0x5b1eb3[_0xfe9e('0x5c')]][_0xfe9e('0x1e')]=0x1;queues[_0x5b1eb3[_0xfe9e('0x52')]]=_[_0xfe9e('0x51')](queues[_0x5b1eb3[_0xfe9e('0x5c')]]);queues[_0x5b1eb3['transfertargetuniqueid']][_0xfe9e('0xc')]=_0x5b1eb3[_0xfe9e('0x52')];queues[_0x5b1eb3[_0xfe9e('0x52')]]['queuecallerenterreason']=0x2;queues[_0x5b1eb3[_0xfe9e('0x52')]][_0xfe9e('0x53')]=queues[_0x5b1eb3['origtransfererlinkedid']][_0xfe9e('0x53')];queues[_0x5b1eb3[_0xfe9e('0x52')]][_0xfe9e('0x54')]=queues[_0x5b1eb3[_0xfe9e('0x4b')]][_0xfe9e('0x54')];queues[_0x5b1eb3[_0xfe9e('0x52')]]['queuecallerjoinAt']=utils[_0xfe9e('0x14')]();queues[_0x5b1eb3[_0xfe9e('0x52')]]['queuecallerleaveAt']=utils[_0xfe9e('0x14')]();queues[_0x5b1eb3[_0xfe9e('0x52')]][_0xfe9e('0x33')]=0x0;queues[_0x5b1eb3['transfertargetuniqueid']][_0xfe9e('0x56')]=0x0;utils[_0xfe9e('0x10')](util['format'](_0xfe9e('0x5d'),_0x5b1eb3[_0xfe9e('0x4a')],queues[_0x5b1eb3[_0xfe9e('0x52')]]['name'],queues[_0x5b1eb3[_0xfe9e('0x52')]][_0xfe9e('0xc')],queues[_0x5b1eb3['transfertargetuniqueid']]['calleridnum'],queues[_0x5b1eb3['transfertargetuniqueid']]['calleridname']));}else{utils['info'](util[_0xfe9e('0x2')](_0xfe9e('0x5e'),_0x5b1eb3[_0xfe9e('0x4a')],queues[_0x5b1eb3[_0xfe9e('0x4c')]][_0xfe9e('0x1d')],_0x5b1eb3[_0xfe9e('0x4b')]));queues[_0x5b1eb3['secondtransfererlinkedid']][_0xfe9e('0xc')]=_0x5b1eb3['origtransfererlinkedid'];}}}}catch(_0x219f48){utils[_0xfe9e('0x35')](util[_0xfe9e('0x2')](_0xfe9e('0x5f'),_0x5b1eb3[_0xfe9e('0x4a')]),_0x219f48);}};exports['musiconholdstart']=function(_0x5ef9e7){try{if(!_[_0xfe9e('0x23')](queues[_0x5ef9e7[_0xfe9e('0x3')]])){utils['debug'](util[_0xfe9e('0x2')]('[%s][queues][musiconholdstart]',_0x5ef9e7[_0xfe9e('0x3')]),_0x5ef9e7);queues[_0x5ef9e7['uniqueid']][_0xfe9e('0x60')]=utils['now']();utils[_0xfe9e('0x10')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x5ef9e7['uniqueid'],queues[_0x5ef9e7[_0xfe9e('0x3')]][_0xfe9e('0x1d')],queues[_0x5ef9e7['uniqueid']]['musiconholdstartAt']));}}catch(_0x4300f5){utils[_0xfe9e('0x35')](util['format'](_0xfe9e('0x61'),_0x5ef9e7[_0xfe9e('0x3')]),_0x4300f5);}};exports[_0xfe9e('0x62')]=function(_0x59cb74){try{if(!_[_0xfe9e('0x23')](queues[_0x59cb74[_0xfe9e('0x3')]])){if(!_[_0xfe9e('0x23')](queues[_0x59cb74['uniqueid']][_0xfe9e('0x60')])){utils[_0xfe9e('0xe')](util[_0xfe9e('0x2')](_0xfe9e('0x63'),_0x59cb74[_0xfe9e('0x3')]),_0x59cb74);queues[_0x59cb74[_0xfe9e('0x3')]]['mohtime']+=utils[_0xfe9e('0x34')](utils[_0xfe9e('0x14')](),queues[_0x59cb74[_0xfe9e('0x3')]][_0xfe9e('0x60')]);utils[_0xfe9e('0x10')](util['format'](_0xfe9e('0x64'),_0x59cb74[_0xfe9e('0x3')],queues[_0x59cb74['uniqueid']]['name'],queues[_0x59cb74[_0xfe9e('0x3')]][_0xfe9e('0x56')]));delete queues[_0x59cb74[_0xfe9e('0x3')]][_0xfe9e('0x60')];}}}catch(_0x520015){utils[_0xfe9e('0x35')](util[_0xfe9e('0x2')](_0xfe9e('0x63'),_0x59cb74[_0xfe9e('0x3')]),_0x520015);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 805d34c..48169cc 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 _0x6cc0=['substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','monitors','push','hangup','calleridname','cause-txt','calleridnum','connectedlinename','type','outbound','connectedlinenum','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x6cc0,0x1d5));var _0x06cc=function(_0x53f9bb,_0x4733a5){_0x53f9bb=_0x53f9bb-0x0;var _0x26351c=_0x6cc0[_0x53f9bb];return _0x26351c;};'use strict';var _=require(_0x06cc('0x0'));var util=require(_0x06cc('0x1'));var utils=require(_0x06cc('0x2'));var recordings={};function writeDB(_0x49b018){utils[_0x06cc('0x3')](util[_0x06cc('0x4')](_0x06cc('0x5'),_0x49b018[_0x06cc('0x6')]));if(_0x49b018['accountcode']){utils[_0x06cc('0x7')](_0x49b018[_0x06cc('0x8')])['then'](function(_0x38b206){if(_0x38b206){_0x49b018[_0x06cc('0x9')]=_0x38b206[_0x06cc('0xa')];_0x49b018[_0x06cc('0xb')]=_0x38b206['id'];}utils['request'](_0x06cc('0xc'),_0x49b018);});}else{utils[_0x06cc('0xd')](_0x06cc('0xc'),_0x49b018);}}exports[_0x06cc('0xe')]=function(_0x40c238){try{utils[_0x06cc('0xf')](util[_0x06cc('0x4')](_0x06cc('0x10'),_0x40c238['uniqueid']),_0x40c238);if(_0x40c238[_0x06cc('0x6')]==_0x40c238[_0x06cc('0x11')]){utils[_0x06cc('0x3')](util['format'](_0x06cc('0x12'),_0x40c238[_0x06cc('0x6')],_0x40c238[_0x06cc('0x13')],_0x40c238[_0x06cc('0x14')]));recordings[_0x40c238['uniqueid']]={'uniqueid':_0x40c238[_0x06cc('0x6')],'accountcode':_0x40c238[_0x06cc('0x8')],'exten':_0x40c238[_0x06cc('0x14')],'context':_0x40c238[_0x06cc('0x13')],'channel':_0x40c238[_0x06cc('0x15')],'monitors':[]};}}catch(_0x1c4898){utils[_0x06cc('0x16')](util[_0x06cc('0x4')](_0x06cc('0x10'),_0x40c238['uniqueid']),_0x1c4898);}};exports[_0x06cc('0x17')]=function(_0x298a88){try{utils[_0x06cc('0xf')](util['format'](_0x06cc('0x18'),_0x298a88[_0x06cc('0x6')]),_0x298a88);if(!_[_0x06cc('0x19')](recordings[_0x298a88[_0x06cc('0x6')]])&&_0x298a88[_0x06cc('0x1a')]==0x6){utils[_0x06cc('0x3')](util['format'](_0x06cc('0x1b'),_0x298a88[_0x06cc('0x6')],_0x298a88[_0x06cc('0x13')],_0x298a88['channel']));}else if(!_[_0x06cc('0x19')](recordings[_0x298a88['linkedid']])&&_0x298a88[_0x06cc('0x1a')]==0x6&&_0x298a88[_0x06cc('0x13')]!=_0x06cc('0x1c')){utils[_0x06cc('0x3')](util[_0x06cc('0x4')](_0x06cc('0x1d'),_0x298a88['uniqueid'],_0x298a88[_0x06cc('0x11')],_0x298a88[_0x06cc('0x13')],_0x298a88['channel']));recordings[_0x298a88[_0x06cc('0x11')]][_0x06cc('0x8')]=_0x298a88[_0x06cc('0x8')];}}catch(_0x1e9080){utils[_0x06cc('0x16')](util[_0x06cc('0x4')]('[%s][recordings][newstate]',_0x298a88[_0x06cc('0x6')]),_0x1e9080);}};exports['varset']=function(_0x16d8db){try{if(!_['isNil'](_0x16d8db[_0x06cc('0x1e')])&&!_['isNil'](_0x16d8db[_0x06cc('0x1e')][_0x06cc('0x1f')])){utils[_0x06cc('0xf')](util[_0x06cc('0x4')](_0x06cc('0x20'),_0x16d8db[_0x06cc('0x6')]),_0x16d8db);utils[_0x06cc('0x3')](util['format'](_0x06cc('0x21'),_0x16d8db[_0x06cc('0x6')],_0x16d8db['variable'],_0x16d8db[_0x06cc('0x22')]));if(_[_0x06cc('0x23')](_0x16d8db[_0x06cc('0x22')],'.wav49')){_0x16d8db[_0x06cc('0x22')]=_0x16d8db[_0x06cc('0x22')]['replace'](_0x06cc('0x24'),_0x06cc('0x25'));}if(recordings[_0x16d8db[_0x06cc('0x11')]]){var _0x4e3e6a=_[_0x06cc('0x26')](recordings[_0x16d8db[_0x06cc('0x11')]][_0x06cc('0x27')],{'value':_0x16d8db[_0x06cc('0x22')]});if(_[_0x06cc('0x19')](_0x4e3e6a)){recordings[_0x16d8db['linkedid']][_0x06cc('0x27')][_0x06cc('0x28')]({'value':_0x16d8db[_0x06cc('0x22')]});}}}}catch(_0x17092a){utils[_0x06cc('0x16')](util[_0x06cc('0x4')](_0x06cc('0x20'),_0x16d8db[_0x06cc('0x6')]),_0x17092a);}};exports[_0x06cc('0x29')]=function(_0xf63258){try{if(!_[_0x06cc('0x19')](recordings[_0xf63258[_0x06cc('0x6')]])){utils[_0x06cc('0xf')](util['format']('[%s][recordings][hangup]',_0xf63258[_0x06cc('0x6')]),_0xf63258);utils[_0x06cc('0x3')](util[_0x06cc('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0xf63258['uniqueid'],_0xf63258['calleridnum'],_0xf63258[_0x06cc('0x2a')],_0xf63258[_0x06cc('0x2b')]));recordings[_0xf63258[_0x06cc('0x6')]][_0x06cc('0x2c')]=_0xf63258['calleridnum'];recordings[_0xf63258[_0x06cc('0x6')]][_0x06cc('0x2a')]=_0xf63258[_0x06cc('0x2a')];recordings[_0xf63258[_0x06cc('0x6')]]['connectedlinenum']=_0xf63258['connectedlinenum'];recordings[_0xf63258['uniqueid']][_0x06cc('0x2d')]=_0xf63258[_0x06cc('0x2d')];if(recordings[_0xf63258['uniqueid']][_0x06cc('0x2e')]==_0x06cc('0x2f')&&recordings[_0xf63258['uniqueid']]['accountcode']){recordings[_0xf63258[_0x06cc('0x6')]][_0x06cc('0x30')]=recordings[_0xf63258[_0x06cc('0x6')]][_0x06cc('0x8')];recordings[_0xf63258['uniqueid']][_0x06cc('0x2d')]='';}recordings[_0xf63258[_0x06cc('0x6')]]['monitors'][_0x06cc('0x31')](function(_0x354e8e){var _0x468b2d=_[_0x06cc('0x32')](recordings[_0xf63258[_0x06cc('0x6')]]);_0x468b2d[_0x06cc('0x22')]=_0x354e8e['value'];writeDB(_0x468b2d);});delete recordings[_0xf63258[_0x06cc('0x6')]];}}catch(_0x366129){utils[_0x06cc('0x16')](util['format'](_0x06cc('0x33'),_0xf63258[_0x06cc('0x6')]),_0x366129);}};exports[_0x06cc('0x34')]=function(_0x18f3bd){try{if(!_[_0x06cc('0x19')](recordings[_0x18f3bd['uniqueid']])){utils[_0x06cc('0xf')](util[_0x06cc('0x4')]('[%s][recordings][newexten]',_0x18f3bd[_0x06cc('0x6')]),_0x18f3bd);utils['info'](util[_0x06cc('0x4')](_0x06cc('0x35'),_0x18f3bd[_0x06cc('0x6')],_0x18f3bd[_0x06cc('0x36')],_0x18f3bd[_0x06cc('0x37')]));if(_0x18f3bd['application'][_0x06cc('0x38')]()==_0x06cc('0x39')&&_['startsWith'](_0x18f3bd[_0x06cc('0x37')][_0x06cc('0x38')](),_0x06cc('0x3a'))){var _0x25fd7e=_0x18f3bd[_0x06cc('0x37')]['split']('=');var _0x8ed1af=_0x25fd7e[0x0][_0x06cc('0x3b')](_0x25fd7e[0x0][_0x06cc('0x3c')]('(')+0x1,_0x25fd7e[0x0][_0x06cc('0x3c')](')'));var _0x8eaaa8=_0x25fd7e[0x1];recordings[_0x18f3bd[_0x06cc('0x6')]][_0x8ed1af]=_0x8eaaa8;}}}catch(_0x15630a){utils[_0x06cc('0x16')](util['format'](_0x06cc('0x3d'),_0x18f3bd['uniqueid']),_0x15630a);}};exports[_0x06cc('0x3e')]=function(_0x4e9b41){try{if(!_['isNil'](recordings[_0x4e9b41[_0x06cc('0x6')]])){utils[_0x06cc('0xf')](util[_0x06cc('0x4')](_0x06cc('0x3f'),_0x4e9b41[_0x06cc('0x6')]),_0x4e9b41);utils[_0x06cc('0x3')](util[_0x06cc('0x4')](_0x06cc('0x40'),_0x4e9b41[_0x06cc('0x6')],_0x4e9b41['queue']));recordings[_0x4e9b41['uniqueid']][_0x06cc('0x41')]=_0x4e9b41[_0x06cc('0x41')];}}catch(_0x2a638f){utils[_0x06cc('0x16')](util[_0x06cc('0x4')](_0x06cc('0x3f'),_0x4e9b41[_0x06cc('0x6')]),_0x2a638f);}}; \ No newline at end of file +var _0x3d53=['cdr','split','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','util','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','context','exten','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','set','startsWith','toLowerCase'];(function(_0x5c3b31,_0x5b2df8){var _0x57b973=function(_0x21a617){while(--_0x21a617){_0x5c3b31['push'](_0x5c3b31['shift']());}};_0x57b973(++_0x5b2df8);}(_0x3d53,0xc9));var _0x33d5=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0x3d53[_0xf34109];return _0x570bfc;};'use strict';var _=require(_0x33d5('0x0'));var util=require(_0x33d5('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x4e2a96){utils[_0x33d5('0x2')](util[_0x33d5('0x3')](_0x33d5('0x4'),_0x4e2a96[_0x33d5('0x5')]));if(_0x4e2a96[_0x33d5('0x6')]){utils[_0x33d5('0x7')](_0x4e2a96[_0x33d5('0x6')])[_0x33d5('0x8')](function(_0x63a8d6){if(_0x63a8d6){_0x4e2a96[_0x33d5('0x9')]=_0x63a8d6[_0x33d5('0xa')];_0x4e2a96[_0x33d5('0xb')]=_0x63a8d6['id'];}utils[_0x33d5('0xc')]('CreateVoiceRecording',_0x4e2a96);});}else{utils[_0x33d5('0xc')](_0x33d5('0xd'),_0x4e2a96);}}exports[_0x33d5('0xe')]=function(_0x121ab7){try{utils[_0x33d5('0xf')](util[_0x33d5('0x3')]('[%s][recordings][newchannel]',_0x121ab7[_0x33d5('0x5')]),_0x121ab7);if(_0x121ab7['uniqueid']==_0x121ab7['linkedid']){utils['info'](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x121ab7[_0x33d5('0x5')],_0x121ab7[_0x33d5('0x10')],_0x121ab7[_0x33d5('0x11')]));recordings[_0x121ab7[_0x33d5('0x5')]]={'uniqueid':_0x121ab7[_0x33d5('0x5')],'accountcode':_0x121ab7[_0x33d5('0x6')],'exten':_0x121ab7[_0x33d5('0x11')],'context':_0x121ab7[_0x33d5('0x10')],'channel':_0x121ab7[_0x33d5('0x12')],'monitors':[]};}}catch(_0x4e3b83){utils[_0x33d5('0x13')](util[_0x33d5('0x3')](_0x33d5('0x14'),_0x121ab7['uniqueid']),_0x4e3b83);}};exports[_0x33d5('0x15')]=function(_0x354f0b){try{utils['debug'](util['format'](_0x33d5('0x16'),_0x354f0b[_0x33d5('0x5')]),_0x354f0b);if(!_[_0x33d5('0x17')](recordings[_0x354f0b[_0x33d5('0x5')]])&&_0x354f0b[_0x33d5('0x18')]==0x6){utils[_0x33d5('0x2')](util['format'](_0x33d5('0x19'),_0x354f0b[_0x33d5('0x5')],_0x354f0b[_0x33d5('0x10')],_0x354f0b[_0x33d5('0x12')]));}else if(!_[_0x33d5('0x17')](recordings[_0x354f0b[_0x33d5('0x1a')]])&&_0x354f0b[_0x33d5('0x18')]==0x6&&_0x354f0b[_0x33d5('0x10')]!=_0x33d5('0x1b')){utils['info'](util[_0x33d5('0x3')](_0x33d5('0x1c'),_0x354f0b[_0x33d5('0x5')],_0x354f0b['linkedid'],_0x354f0b[_0x33d5('0x10')],_0x354f0b['channel']));recordings[_0x354f0b['linkedid']][_0x33d5('0x6')]=_0x354f0b['accountcode'];}}catch(_0x1d12ac){utils[_0x33d5('0x13')](util[_0x33d5('0x3')](_0x33d5('0x16'),_0x354f0b['uniqueid']),_0x1d12ac);}};exports['varset']=function(_0x24a38d){try{if(!_[_0x33d5('0x17')](_0x24a38d[_0x33d5('0x1d')])&&!_[_0x33d5('0x17')](_0x24a38d[_0x33d5('0x1d')]['mixmonitor_filename'])){utils[_0x33d5('0xf')](util['format'](_0x33d5('0x1e'),_0x24a38d['uniqueid']),_0x24a38d);utils['info'](util[_0x33d5('0x3')](_0x33d5('0x1f'),_0x24a38d['uniqueid'],_0x24a38d[_0x33d5('0x1d')],_0x24a38d[_0x33d5('0x20')]));if(_[_0x33d5('0x21')](_0x24a38d[_0x33d5('0x20')],_0x33d5('0x22'))){_0x24a38d[_0x33d5('0x20')]=_0x24a38d[_0x33d5('0x20')][_0x33d5('0x23')](_0x33d5('0x22'),_0x33d5('0x24'));}if(recordings[_0x24a38d[_0x33d5('0x1a')]]){var _0x15c191=_[_0x33d5('0x25')](recordings[_0x24a38d[_0x33d5('0x1a')]][_0x33d5('0x26')],{'value':_0x24a38d[_0x33d5('0x20')]});if(_[_0x33d5('0x17')](_0x15c191)){recordings[_0x24a38d[_0x33d5('0x1a')]][_0x33d5('0x26')][_0x33d5('0x27')]({'value':_0x24a38d['value']});}}}}catch(_0x319c5e){utils[_0x33d5('0x13')](util[_0x33d5('0x3')](_0x33d5('0x1e'),_0x24a38d[_0x33d5('0x5')]),_0x319c5e);}};exports[_0x33d5('0x28')]=function(_0x212bfa){try{if(!_[_0x33d5('0x17')](recordings[_0x212bfa[_0x33d5('0x5')]])){utils['debug'](util[_0x33d5('0x3')](_0x33d5('0x29'),_0x212bfa[_0x33d5('0x5')]),_0x212bfa);utils[_0x33d5('0x2')](util[_0x33d5('0x3')](_0x33d5('0x2a'),_0x212bfa[_0x33d5('0x5')],_0x212bfa[_0x33d5('0x2b')],_0x212bfa['calleridname'],_0x212bfa[_0x33d5('0x2c')]));recordings[_0x212bfa[_0x33d5('0x5')]][_0x33d5('0x2b')]=_0x212bfa['calleridnum'];recordings[_0x212bfa[_0x33d5('0x5')]][_0x33d5('0x2d')]=_0x212bfa[_0x33d5('0x2d')];recordings[_0x212bfa['uniqueid']][_0x33d5('0x2e')]=_0x212bfa['connectedlinenum'];recordings[_0x212bfa[_0x33d5('0x5')]][_0x33d5('0x2f')]=_0x212bfa[_0x33d5('0x2f')];if(recordings[_0x212bfa[_0x33d5('0x5')]][_0x33d5('0x30')]==_0x33d5('0x31')&&recordings[_0x212bfa[_0x33d5('0x5')]][_0x33d5('0x6')]){recordings[_0x212bfa[_0x33d5('0x5')]][_0x33d5('0x2e')]=recordings[_0x212bfa['uniqueid']][_0x33d5('0x6')];recordings[_0x212bfa['uniqueid']]['connectedlinename']='';}recordings[_0x212bfa['uniqueid']][_0x33d5('0x26')][_0x33d5('0x32')](function(_0xe440d3){var _0x4563da=_[_0x33d5('0x33')](recordings[_0x212bfa['uniqueid']]);_0x4563da[_0x33d5('0x20')]=_0xe440d3[_0x33d5('0x20')];writeDB(_0x4563da);});delete recordings[_0x212bfa[_0x33d5('0x5')]];}}catch(_0x5b7297){utils[_0x33d5('0x13')](util['format']('[%s][recordings][hangup]',_0x212bfa['uniqueid']),_0x5b7297);}};exports[_0x33d5('0x34')]=function(_0x355834){try{if(!_['isNil'](recordings[_0x355834['uniqueid']])){utils['debug'](util[_0x33d5('0x3')](_0x33d5('0x35'),_0x355834[_0x33d5('0x5')]),_0x355834);utils['info'](util[_0x33d5('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x355834[_0x33d5('0x5')],_0x355834[_0x33d5('0x36')],_0x355834[_0x33d5('0x37')]));if(_0x355834[_0x33d5('0x36')]['toLowerCase']()==_0x33d5('0x38')&&_[_0x33d5('0x39')](_0x355834[_0x33d5('0x37')][_0x33d5('0x3a')](),_0x33d5('0x3b'))){var _0x347f89=_0x355834['appdata'][_0x33d5('0x3c')]('=');var _0x386f11=_0x347f89[0x0]['substring'](_0x347f89[0x0][_0x33d5('0x3d')]('(')+0x1,_0x347f89[0x0][_0x33d5('0x3d')](')'));var _0x21ca38=_0x347f89[0x1];recordings[_0x355834[_0x33d5('0x5')]][_0x386f11]=_0x21ca38;}}}catch(_0x16bcff){utils[_0x33d5('0x13')](util[_0x33d5('0x3')]('[%s][recordings][newexten]',_0x355834[_0x33d5('0x5')]),_0x16bcff);}};exports['queuecallerjoin']=function(_0x27018d){try{if(!_[_0x33d5('0x17')](recordings[_0x27018d['uniqueid']])){utils[_0x33d5('0xf')](util['format']('[%s][recordings][queuecallerjoin]',_0x27018d[_0x33d5('0x5')]),_0x27018d);utils['info'](util[_0x33d5('0x3')](_0x33d5('0x3e'),_0x27018d['uniqueid'],_0x27018d[_0x33d5('0x3f')]));recordings[_0x27018d[_0x33d5('0x5')]][_0x33d5('0x3f')]=_0x27018d['queue'];}}catch(_0x4423e7){utils[_0x33d5('0x13')](util[_0x33d5('0x3')](_0x33d5('0x40'),_0x27018d[_0x33d5('0x5')]),_0x4423e7);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 00f0d0f..bc9d2c9 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 _0x453d=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel','secondtransfererconnectedlinenum'];(function(_0x22fe5c,_0x28645c){var _0x17a217=function(_0x1306f0){while(--_0x1306f0){_0x22fe5c['push'](_0x22fe5c['shift']());}};_0x17a217(++_0x28645c);}(_0x453d,0x19f));var _0xd453=function(_0x283f62,_0x14b393){_0x283f62=_0x283f62-0x0;var _0x43e7df=_0x453d[_0x283f62];return _0x43e7df;};'use strict';var _=require(_0xd453('0x0'));var util=require(_0xd453('0x1'));var utils=require(_0xd453('0x2'));function writeDB(_0x2d1de7){utils[_0xd453('0x3')](util[_0xd453('0x4')](_0xd453('0x5'),_0x2d1de7['type']===_0xd453('0x6')?_0x2d1de7[_0xd453('0x7')]:_0x2d1de7[_0xd453('0x8')],_0x2d1de7[_0xd453('0x9')]));utils[_0xd453('0xa')]('CreateVoiceTransferReport',_0x2d1de7);}exports['blindtransfer']=function(_0x545138){try{utils['debug'](util[_0xd453('0x4')](_0xd453('0xb'),_0x545138[_0xd453('0x8')]),_0x545138);utils[_0xd453('0x3')](util['format'](_0xd453('0xc'),_0x545138['uniqueid'],_0x545138[_0xd453('0xd')],_0x545138['transferercalleridname'],_0x545138[_0xd453('0xe')],_0x545138[_0xd453('0xf')]));_0x545138[_0xd453('0x9')]=_0xd453('0x10');writeDB(_0x545138);}catch(_0x347d34){utils[_0xd453('0x11')](util[_0xd453('0x4')]('[%s][transfers][blindtransfer]',_0x545138[_0xd453('0x8')]),_0x347d34);}};exports[_0xd453('0x12')]=function(_0x47cc1c){try{utils['debug'](util[_0xd453('0x4')](_0xd453('0x13'),_0x47cc1c['origtransfereruniqueid']),_0x47cc1c);utils[_0xd453('0x3')](util['format'](_0xd453('0x14'),_0x47cc1c[_0xd453('0x7')],_0x47cc1c['origtransferercalleridnum'],_0x47cc1c[_0xd453('0x15')],_0x47cc1c[_0xd453('0x16')],_0x47cc1c['transfertargetcalleridname']));_0x47cc1c=_['assign'](_0x47cc1c,{'transfererchannel':_0x47cc1c[_0xd453('0x17')],'transferercalleridnum':_0x47cc1c['origtransferercalleridnum'],'transferercalleridname':_0x47cc1c['origtransferercalleridname'],'transfererconnectedlinenum':_0x47cc1c[_0xd453('0x18')],'transfererconnectedlinename':_0x47cc1c[_0xd453('0x19')],'transfereraccountcode':_0x47cc1c[_0xd453('0x1a')],'transferercontext':_0x47cc1c[_0xd453('0x1b')],'transfererexten':_0x47cc1c['secondtransfererexten'],'transfererlinkedid':_0x47cc1c['origtransfererlinkedid'],'context':_0x47cc1c[_0xd453('0x1c')],'extension':_0x47cc1c[_0xd453('0x1d')],'type':_0xd453('0x6')});if(_[_0xd453('0x1e')](_0x47cc1c[_0xd453('0x1f')])){_0x47cc1c=_['assign'](_0x47cc1c,{'transfereechannel':_0x47cc1c[_0xd453('0x20')],'transfereecalleridnum':_0x47cc1c[_0xd453('0x16')],'transfereecalleridname':_0x47cc1c[_0xd453('0x21')],'transfereeconnectedlinenum':_0x47cc1c[_0xd453('0x22')],'transfereeconnectedlinename':_0x47cc1c[_0xd453('0x23')],'transfereeaccountcode':_0x47cc1c[_0xd453('0x24')],'transfereecontext':_0x47cc1c[_0xd453('0x25')],'transfereeexten':_0x47cc1c[_0xd453('0x26')],'transfereelinkedid':_0x47cc1c[_0xd453('0x27')]});}writeDB(_0x47cc1c);}catch(_0x24f966){utils[_0xd453('0x11')](util[_0xd453('0x4')](_0xd453('0x13'),_0x47cc1c[_0xd453('0x7')]),_0x24f966);}}; \ No newline at end of file +var _0xfa9b=['transfertargetcontext','transfertargetlinkedid','lodash','util','./utils','info','format','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','type','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransferercontext','origtransfererexten','transfereechannel','transfertargetcalleridname','transfertargetaccountcode'];(function(_0x163614,_0x4b0550){var _0x25af47=function(_0x3c0193){while(--_0x3c0193){_0x163614['push'](_0x163614['shift']());}};_0x25af47(++_0x4b0550);}(_0xfa9b,0x1f0));var _0xbfa9=function(_0x19e974,_0x274146){_0x19e974=_0x19e974-0x0;var _0x3f1a92=_0xfa9b[_0x19e974];return _0x3f1a92;};'use strict';var _=require(_0xbfa9('0x0'));var util=require(_0xbfa9('0x1'));var utils=require(_0xbfa9('0x2'));function writeDB(_0xcf304b){utils[_0xbfa9('0x3')](util[_0xbfa9('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0xcf304b['type']===_0xbfa9('0x5')?_0xcf304b[_0xbfa9('0x6')]:_0xcf304b[_0xbfa9('0x7')],_0xcf304b['type']));utils[_0xbfa9('0x8')](_0xbfa9('0x9'),_0xcf304b);}exports[_0xbfa9('0xa')]=function(_0x10f2b2){try{utils[_0xbfa9('0xb')](util[_0xbfa9('0x4')]('[%s][transfers][blindtransfer]',_0x10f2b2['uniqueid']),_0x10f2b2);utils[_0xbfa9('0x3')](util[_0xbfa9('0x4')](_0xbfa9('0xc'),_0x10f2b2[_0xbfa9('0x7')],_0x10f2b2[_0xbfa9('0xd')],_0x10f2b2[_0xbfa9('0xe')],_0x10f2b2[_0xbfa9('0xf')],_0x10f2b2[_0xbfa9('0x10')]));_0x10f2b2[_0xbfa9('0x11')]='blind';writeDB(_0x10f2b2);}catch(_0x1efc85){utils[_0xbfa9('0x12')](util['format'](_0xbfa9('0x13'),_0x10f2b2[_0xbfa9('0x7')]),_0x1efc85);}};exports[_0xbfa9('0x14')]=function(_0x596a9a){try{utils[_0xbfa9('0xb')](util[_0xbfa9('0x4')](_0xbfa9('0x15'),_0x596a9a[_0xbfa9('0x6')]),_0x596a9a);utils[_0xbfa9('0x3')](util[_0xbfa9('0x4')](_0xbfa9('0x16'),_0x596a9a[_0xbfa9('0x6')],_0x596a9a[_0xbfa9('0x17')],_0x596a9a['origtransferercalleridname'],_0x596a9a[_0xbfa9('0x18')],_0x596a9a['transfertargetcalleridname']));_0x596a9a=_[_0xbfa9('0x19')](_0x596a9a,{'transfererchannel':_0x596a9a[_0xbfa9('0x1a')],'transferercalleridnum':_0x596a9a['origtransferercalleridnum'],'transferercalleridname':_0x596a9a['origtransferercalleridname'],'transfererconnectedlinenum':_0x596a9a[_0xbfa9('0x1b')],'transfererconnectedlinename':_0x596a9a[_0xbfa9('0x1c')],'transfereraccountcode':_0x596a9a[_0xbfa9('0x1d')],'transferercontext':_0x596a9a['secondtransferercontext'],'transfererexten':_0x596a9a[_0xbfa9('0x1e')],'transfererlinkedid':_0x596a9a['origtransfererlinkedid'],'context':_0x596a9a[_0xbfa9('0x1f')],'extension':_0x596a9a[_0xbfa9('0x20')],'type':_0xbfa9('0x5')});if(_['isNil'](_0x596a9a[_0xbfa9('0x21')])){_0x596a9a=_['assign'](_0x596a9a,{'transfereechannel':_0x596a9a['transfertargetchannel'],'transfereecalleridnum':_0x596a9a[_0xbfa9('0x18')],'transfereecalleridname':_0x596a9a[_0xbfa9('0x22')],'transfereeconnectedlinenum':_0x596a9a['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x596a9a['transfertargetconnectedlinename'],'transfereeaccountcode':_0x596a9a[_0xbfa9('0x23')],'transfereecontext':_0x596a9a[_0xbfa9('0x24')],'transfereeexten':_0x596a9a['transfertargetexten'],'transfereelinkedid':_0x596a9a[_0xbfa9('0x25')]});}writeDB(_0x596a9a);}catch(_0x31f341){utils[_0xbfa9('0x12')](util[_0xbfa9('0x4')](_0xbfa9('0x15'),_0x596a9a[_0xbfa9('0x6')]),_0x31f341);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 8323aa2..93e76f1 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(_0x479722,_0x231cef){var _0x2310fe=function(_0xd96529){while(--_0xd96529){_0x479722['push'](_0x479722['shift']());}};_0x2310fe(++_0x231cef);}(_0x7a54,0x106));var _0x47a5=function(_0x50e77a,_0x50b66a){_0x50e77a=_0x50e77a-0x0;var _0x28bca6=_0x7a54[_0x50e77a];return _0x28bca6;};'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(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xb10b,0x12a));var _0xbb10=function(_0x5866d1,_0xa6dc72){_0x5866d1=_0x5866d1-0x0;var _0x30071f=_0xb10b[_0x5866d1];return _0x30071f;};'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